diff --git a/.gitignore b/.gitignore index 05f981a0ace..4f9ec0649b3 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,8 @@ tests/cases/perf/* !tests/cases/webharness/compilerToString.js test-args.txt ~*.docx +\#*\# +.\#* tests/baselines/local/* tests/services/baselines/local/* tests/baselines/prototyping/local/* @@ -26,11 +28,13 @@ rwc-report.html *.swp build.json *.actual +tests/webTestServer.js +tests/webTestServer.js.map tests/webhost/*.d.ts tests/webhost/webtsc.js -tests/*.js -tests/*.js.map -tests/*.d.ts +tests/cases/**/*.js +tests/cases/**/*.js.map +tests/cases/**/*.d.ts *.config scripts/debug.bat scripts/run.bat @@ -42,5 +46,6 @@ coverage/ internal/ **/.DS_Store .settings -.vscode/* -!.vscode/tasks.json +**/.vs +**/.vscode +!**/.vscode/tasks.json diff --git a/.npmignore b/.npmignore index d295e9bbd77..02d8fe428f9 100644 --- a/.npmignore +++ b/.npmignore @@ -1,10 +1,12 @@ built doc +internal +issue_template.md lib/README.md +pull_request_template.md scripts src tests -internal tslint.json Jakefile.js .editorconfig diff --git a/AUTHORS.md b/AUTHORS.md index 486a15bf47f..0501514d758 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -2,9 +2,11 @@ TypeScript is authored by: * Adam Freidin * Ahmad Farid +* Akshar Patel * Anders Hejlsberg * Arnav Singh * Arthur Ozga +* Asad Saeeduddin * Basarat Ali Syed * Ben Duffield * Bill Ticehurst @@ -15,30 +17,39 @@ TypeScript is authored by: * Colby Russell * Colin Snover * Cyrus Najmabadi +* Dan Corder * Dan Quirk * Daniel Rosenwasser +* @dashaus * David Li * Denis Nedelyaev * Dick van den Brink * Dirk Bäumer +* Dirk Holtwick * Eyas Sharaiha +* @falsandtru * Frank Wallis * Gabriel Isenberg * Gilad Peleg * Graeme Wicksted * Guillaume Salles +* Guy Bedford * Harald Niesche +* Iain Monro * Ingvar Stepanyan * Ivo Gabe de Wolff * James Whitney * Jason Freeman +* Jason Killian * Jason Ramsay * Jed Mao +* Jeffrey Morlan * Johannes Rieken * John Vilk * Jonathan Bond-Caron * Jonathan Park * Jonathan Turner +* Jonathon Smith * Josh Kalderimis * Julian Williams * Kagami Sascha Rosylight @@ -46,21 +57,27 @@ TypeScript is authored by: * Ken Howard * Kenji Imamula * Lorant Pinter +* Lucien Greathouse * Martin Všetička * Masahiro Wakame +* Mattias Buelens * Max Deepfield * Micah Zoltu * Mohamed Hegazy * Nathan Shively-Sanders +* Nathan Yee * Oleg Mihailik * Oleksandr Chekhovskyi * Paul van Brenk +* @pcbro * Pedro Maltez * Philip Bulley * piloopin * @progre * Punya Biswal +* Richard Sentino * Ron Buckton +* Rowan Wyborn * Ryan Cavanaugh * Ryohei Ikegami * Sébastien Arod @@ -71,7 +88,9 @@ TypeScript is authored by: * Solal Pirelli * Stan Thomas * Steve Lucco +* Thomas Loubiou * Tien Hoanhtien +* Tim Perry * Tingan Ho * togru * Tomas Grubliauskas @@ -81,5 +100,6 @@ TypeScript is authored by: * Wesley Wigham * York Yao * Yui Tanglertsampan +* Yuichi Nukiyama * Zev Spitz * Zhengbo Li diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3a712b5619a..7a99bf318d2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,3 +1,45 @@ +# Instructions for Logging Issues + +## 1. Read the FAQ + +Please [read the FAQ](https://github.com/Microsoft/TypeScript/wiki/FAQ) before logging new issues, even if you think you have found a bug. + +Issues that ask questions answered in the FAQ will be closed without elaboration. + +## 2. Search for Duplicates + +[Search the existing issues](https://github.com/Microsoft/TypeScript/issues?utf8=%E2%9C%93&q=is%3Aissue) before logging a new one. + +## 3. Do you have a question? + +The issue tracker is for **issues**, in other words, bugs and suggestions. +If you have a *question*, please use [Stack Overflow](http://stackoverflow.com/questions/tagged/typescript), [Gitter](https://gitter.im/Microsoft/TypeScript), your favorite search engine, or other resources. +Due to increased traffic, we can no longer answer questions in the issue tracker. + +## 4. Did you find a bug? + +When logging a bug, please be sure to include the following: + * What version of TypeScript you're using (run `tsc --v`) + * If at all possible, an *isolated* way to reproduce the behavior + * The behavior you expect to see, and the actual behavior + +You can try out the nightly build of TypeScript (`npm install typescript@next`) to see if the bug has already been fixed. + +## 5. Do you have a suggestion? + +We also accept suggestions in the issue tracker. +Be sure to [check the FAQ](https://github.com/Microsoft/TypeScript/wiki/FAQ) and [search](https://github.com/Microsoft/TypeScript/issues?utf8=%E2%9C%93&q=is%3Aissue) first. + +In general, things we find useful when reviewing suggestions are: +* A description of the problem you're trying to solve +* An overview of the suggested solution +* Examples of how the suggestion would work in various places + * Code examples showing e.g. "this would be an error, this wouldn't" + * Code examples showing the generated JavaScript (if applicable) +* If relevant, precedent in other languages can be useful for establishing context and expected behavior + +# Instructions for Contributing Code + ## Contributing bug fixes TypeScript is currently accepting contributions in the form of bug fixes. A bug must have an issue tracking it in the issue tracker that has been approved ("Milestone == Community") by the TypeScript team. Your pull request should include a link to the bug that you are fixing. If you've submitted a PR for a bug, please post a comment in the bug to avoid duplication of effort. @@ -29,7 +71,7 @@ Your pull request should: * Tests should include reasonable permutations of the target fix/change * Include baseline changes with your change * All changed code must have 100% code coverage -* Follow the code conventions descriped in [Coding guidelines](https://github.com/Microsoft/TypeScript/wiki/Coding-guidelines) +* Follow the code conventions described in [Coding guidelines](https://github.com/Microsoft/TypeScript/wiki/Coding-guidelines) * To avoid line ending issues, set `autocrlf = input` and `whitespace = cr-at-eol` in your git configuration ## Contributing `lib.d.ts` fixes diff --git a/Jakefile.js b/Jakefile.js index 744914c3157..498b41e0a91 100644 --- a/Jakefile.js +++ b/Jakefile.js @@ -152,6 +152,9 @@ var harnessSources = harnessCoreSources.concat([ "cachingInServerLSHost.ts", "moduleResolution.ts", "tsconfigParsing.ts", + "commandLineParsing.ts", + "convertCompilerOptionsFromJson.ts", + "convertTypingOptionsFromJson.ts", "matchFiles.ts" ].map(function (f) { return path.join(unittestsDirectory, f); @@ -159,21 +162,59 @@ var harnessSources = harnessCoreSources.concat([ "protocol.d.ts", "session.ts", "client.ts", - "editorServices.ts", + "editorServices.ts" ].map(function (f) { return path.join(serverDirectory, f); })); -var librarySourceMap = [ - { target: "lib.core.d.ts", sources: ["core.d.ts"] }, - { target: "lib.dom.d.ts", sources: ["importcore.d.ts", "intl.d.ts", "dom.generated.d.ts"], }, - { target: "lib.webworker.d.ts", sources: ["importcore.d.ts", "intl.d.ts", "webworker.generated.d.ts"], }, - { target: "lib.scriptHost.d.ts", sources: ["importcore.d.ts", "scriptHost.d.ts"], }, - { target: "lib.d.ts", sources: ["core.d.ts", "intl.d.ts", "dom.generated.d.ts", "webworker.importscripts.d.ts", "scriptHost.d.ts"], }, - { target: "lib.core.es6.d.ts", sources: ["core.d.ts", "es6.d.ts"]}, - { target: "lib.es6.d.ts", sources: ["es6.d.ts", "core.d.ts", "intl.d.ts", "dom.generated.d.ts", "dom.es6.d.ts", "webworker.importscripts.d.ts", "scriptHost.d.ts"] } +var es2015LibrarySources = [ + "es2015.core.d.ts", + "es2015.collection.d.ts", + "es2015.generator.d.ts", + "es2015.iterable.d.ts", + "es2015.promise.d.ts", + "es2015.proxy.d.ts", + "es2015.reflect.d.ts", + "es2015.symbol.d.ts", + "es2015.symbol.wellknown.d.ts" ]; +var es2015LibrarySourceMap = es2015LibrarySources.map(function(source) { + return { target: "lib." + source, sources: ["header.d.ts", source] }; +}); + +var es2016LibrarySource = [ "es2016.array.include.d.ts" ]; + +var es2016LibrarySourceMap = es2016LibrarySource.map(function (source) { + return { target: "lib." + source, sources: ["header.d.ts", source] }; +}); + +var es2017LibrarySource = ["es2017.object.d.ts"]; + +var es2017LibrarySourceMap = es2017LibrarySource.map(function (source) { + return { target: "lib." + source, sources: ["header.d.ts", source] }; +}); + +var hostsLibrarySources = ["dom.generated.d.ts", "webworker.importscripts.d.ts", "scripthost.d.ts"]; + +var librarySourceMap = [ + // Host library + { target: "lib.dom.d.ts", sources: ["header.d.ts", "dom.generated.d.ts"] }, + { target: "lib.dom.iterable.d.ts", sources: ["header.d.ts", "dom.iterable.d.ts"] }, + { target: "lib.webworker.d.ts", sources: ["header.d.ts", "webworker.generated.d.ts"] }, + { target: "lib.scripthost.d.ts", sources: ["header.d.ts", "scripthost.d.ts"] }, + + // JavaScript library + { target: "lib.es5.d.ts", sources: ["header.d.ts", "es5.d.ts"] }, + { target: "lib.es2015.d.ts", sources: ["header.d.ts", "es2015.d.ts"] }, + { target: "lib.es2016.d.ts", sources: ["header.d.ts", "es2016.d.ts"] }, + { target: "lib.es2017.d.ts", sources: ["header.d.ts", "es2017.d.ts"] }, + + // JavaScript + all host library + { target: "lib.d.ts", sources: ["header.d.ts", "es5.d.ts"].concat(hostsLibrarySources) }, + { target: "lib.es6.d.ts", sources: ["header.d.ts", "es5.d.ts"].concat(es2015LibrarySources, hostsLibrarySources, "dom.iterable.d.ts") } +].concat(es2015LibrarySourceMap, es2016LibrarySourceMap, es2017LibrarySourceMap); + var libraryTargets = librarySourceMap.map(function (f) { return path.join(builtLocalDirectory, f.target); }); @@ -212,7 +253,7 @@ function concatenateFiles(destinationFile, sourceFiles) { } var useDebugMode = true; -var host = (process.env.host || process.env.TYPESCRIPT_HOST || "node"); +var host = process.env.TYPESCRIPT_HOST || process.env.host || "node"; var compilerFilename = "tsc.js"; var LKGCompiler = path.join(LKGDirectory, compilerFilename); var builtLocalCompiler = path.join(builtLocalDirectory, compilerFilename); @@ -223,52 +264,60 @@ var builtLocalCompiler = path.join(builtLocalDirectory, compilerFilename); * @param prereqs: prerequisite tasks to compiling the file * @param prefixes: a list of files to prepend to the target file * @param useBuiltCompiler: true to use the built compiler, false to use the LKG - * @param noOutFile: true to compile without using --out - * @param generateDeclarations: true to compile using --declaration - * @param outDir: true to compile using --outDir - * @param keepComments: false to compile using --removeComments + * @parap {Object} opts - property bag containing auxiliary options + * @param {boolean} opts.noOutFile: true to compile without using --out + * @param {boolean} opts.generateDeclarations: true to compile using --declaration + * @param {string} opts.outDir: value for '--outDir' command line option + * @param {boolean} opts.keepComments: false to compile using --removeComments + * @param {boolean} opts.preserveConstEnums: true if compiler should keep const enums in code + * @param {boolean} opts.noResolve: true if compiler should not include non-rooted files in compilation + * @param {boolean} opts.stripInternal: true if compiler should remove declarations marked as @internal + * @param {boolean} opts.noMapRoot: true if compiler omit mapRoot option * @param callback: a function to execute after the compilation process ends */ -function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, noOutFile, generateDeclarations, outDir, preserveConstEnums, keepComments, noResolve, stripInternal, callback) { +function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, opts, callback) { file(outFile, prereqs, function() { var compilerPath = useBuiltCompiler ? builtLocalCompiler : LKGCompiler; var options = "--noImplicitAny --noEmitOnError --pretty"; - + opts = opts || {}; // Keep comments when specifically requested // or when in debug mode. - if (!(keepComments || useDebugMode)) { + if (!(opts.keepComments || useDebugMode)) { options += " --removeComments"; } - if (generateDeclarations) { + if (opts.generateDeclarations) { options += " --declaration"; } - if (preserveConstEnums || useDebugMode) { + if (opts.preserveConstEnums || useDebugMode) { options += " --preserveConstEnums"; } - if (outDir) { - options += " --outDir " + outDir; + if (opts.outDir) { + options += " --outDir " + opts.outDir; } - if (!noOutFile) { + if (!opts.noOutFile) { options += " --out " + outFile; } else { - options += " --module commonjs" + options += " --module commonjs"; } - if(noResolve) { + if(opts.noResolve) { options += " --noResolve"; } if (useDebugMode) { - options += " -sourcemap -mapRoot file:///" + path.resolve(path.dirname(outFile)); + options += " -sourcemap"; + if (!opts.noMapRoot) { + options += " -mapRoot file:///" + path.resolve(path.dirname(outFile)); + } } - if (stripInternal) { - options += " --stripInternal" + if (opts.stripInternal) { + options += " --stripInternal"; } var cmd = host + " " + compilerPath + " " + options + " "; @@ -382,13 +431,7 @@ compileFile(/*outfile*/configureNightlyJs, /*prereqs*/ [configureNightlyTs], /*prefixes*/ [], /*useBuiltCompiler*/ false, - /*noOutFile*/ false, - /*generateDeclarations*/ false, - /*outDir*/ undefined, - /*preserveConstEnums*/ undefined, - /*keepComments*/ false, - /*noResolve*/ false, - /*stripInternal*/ false); + { noOutFile: false, generateDeclarations: false, keepComments: false, noResolve: false, stripInternal: false }); task("setDebugMode", function() { useDebugMode = true; @@ -412,9 +455,9 @@ file(scriptsTsdJson); task("tsd-scripts", [scriptsTsdJson], function () { var cmd = "tsd --config " + scriptsTsdJson + " install"; - console.log(cmd) + console.log(cmd); exec(cmd); -}, { async: true }) +}, { async: true }); var importDefinitelyTypedTestsDirectory = path.join(scriptsDirectory, "importDefinitelyTypedTests"); var importDefinitelyTypedTestsJs = path.join(importDefinitelyTypedTestsDirectory, "importDefinitelyTypedTests.js"); @@ -438,6 +481,7 @@ var tscFile = path.join(builtLocalDirectory, compilerFilename); compileFile(tscFile, compilerSources, [builtLocalDirectory, copyright].concat(compilerSources), [copyright], /*useBuiltCompiler:*/ false); var servicesFile = path.join(builtLocalDirectory, "typescriptServices.js"); +var servicesFileInBrowserTest = path.join(builtLocalDirectory, "typescriptServicesInBrowserTest.js"); var standaloneDefinitionsFile = path.join(builtLocalDirectory, "typescriptServices.d.ts"); var nodePackageFile = path.join(builtLocalDirectory, "typescript.js"); var nodeDefinitionsFile = path.join(builtLocalDirectory, "typescript.d.ts"); @@ -446,13 +490,7 @@ var nodeStandaloneDefinitionsFile = path.join(builtLocalDirectory, "typescript_s compileFile(servicesFile, servicesSources,[builtLocalDirectory, copyright].concat(servicesSources), /*prefixes*/ [copyright], /*useBuiltCompiler*/ true, - /*noOutFile*/ false, - /*generateDeclarations*/ true, - /*outDir*/ undefined, - /*preserveConstEnums*/ true, - /*keepComments*/ true, - /*noResolve*/ false, - /*stripInternal*/ true, + { noOutFile: false, generateDeclarations: true, preserveConstEnums: true, keepComments: true, noResolve: false, stripInternal: true }, /*callback*/ function () { jake.cpR(servicesFile, nodePackageFile, {silent: true}); @@ -475,23 +513,33 @@ compileFile(servicesFile, servicesSources,[builtLocalDirectory, copyright].conca fs.writeFileSync(nodeStandaloneDefinitionsFile, nodeStandaloneDefinitionsFileContents); }); +compileFile(servicesFileInBrowserTest, servicesSources,[builtLocalDirectory, copyright].concat(servicesSources), + /*prefixes*/ [copyright], + /*useBuiltCompiler*/ true, + { noOutFile: false, generateDeclarations: true, preserveConstEnums: true, keepComments: true, noResolve: false, stripInternal: true, noMapRoot: true }, + /*callback*/ function () { + var content = fs.readFileSync(servicesFileInBrowserTest).toString(); + var i = content.lastIndexOf("\n"); + fs.writeFileSync(servicesFileInBrowserTest, content.substring(0, i) + "\r\n//# sourceURL=../built/local/typeScriptServices.js" + content.substring(i)); + }); + var serverFile = path.join(builtLocalDirectory, "tsserver.js"); compileFile(serverFile, serverSources,[builtLocalDirectory, copyright].concat(serverSources), /*prefixes*/ [copyright], /*useBuiltCompiler*/ true); -var lsslFile = path.join(builtLocalDirectory, "tslssl.js"); +var tsserverLibraryFile = path.join(builtLocalDirectory, "tsserverlibrary.js"); +var tsserverLibraryDefinitionFile = path.join(builtLocalDirectory, "tsserverlibrary.d.ts"); compileFile( - lsslFile, + tsserverLibraryFile, languageServiceLibrarySources, [builtLocalDirectory, copyright].concat(languageServiceLibrarySources), /*prefixes*/ [copyright], /*useBuiltCompiler*/ true, - /*noOutFile*/ false, - /*generateDeclarations*/ true); + { noOutFile: false, generateDeclarations: true }); // Local target to build the language service server library desc("Builds language service server library"); -task("lssl", [lsslFile]); +task("lssl", [tsserverLibraryFile, tsserverLibraryDefinitionFile]); // Local target to build the compiler and services desc("Builds the full compiler and services"); @@ -550,8 +598,8 @@ task("generate-spec", [specMd]); // Makes a new LKG. This target does not build anything, but errors if not all the outputs are present in the built/local directory desc("Makes a new LKG out of the built js files"); -task("LKG", ["clean", "release", "local"].concat(libraryTargets), function() { - var expectedFiles = [tscFile, servicesFile, serverFile, nodePackageFile, nodeDefinitionsFile, standaloneDefinitionsFile].concat(libraryTargets); +task("LKG", ["clean", "release", "local", "lssl"].concat(libraryTargets), function() { + var expectedFiles = [tscFile, servicesFile, serverFile, nodePackageFile, nodeDefinitionsFile, standaloneDefinitionsFile, tsserverLibraryFile, tsserverLibraryDefinitionFile].concat(libraryTargets); var missingFiles = expectedFiles.filter(function (f) { return !fs.existsSync(f); }); @@ -577,7 +625,7 @@ directory(builtLocalDirectory); var run = path.join(builtLocalDirectory, "run.js"); compileFile(run, harnessSources, [builtLocalDirectory, tscFile].concat(libraryTargets).concat(harnessSources), [], /*useBuiltCompiler:*/ true); -var internalTests = "internal/" +var internalTests = "internal/"; var localBaseline = "tests/baselines/local/"; var refBaseline = "tests/baselines/reference/"; @@ -646,7 +694,7 @@ function deleteTemporaryProjectOutput() { } } -function runConsoleTests(defaultReporter, defaultSubsets, postLint) { +function runConsoleTests(defaultReporter, defaultSubsets) { cleanTestDirs(); var debug = process.env.debug || process.env.d; tests = process.env.test || process.env.tests || process.env.t; @@ -664,38 +712,40 @@ function runConsoleTests(defaultReporter, defaultSubsets, postLint) { testTimeout = 100000; } - colors = process.env.colors || process.env.color + colors = process.env.colors || process.env.color; colors = colors ? ' --no-colors ' : ' --colors '; reporter = process.env.reporter || process.env.r || defaultReporter; + var lintFlag = process.env.lint !== 'false'; // 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 var subsetRegexes; if(defaultSubsets.length === 0) { - subsetRegexes = [tests] + subsetRegexes = [tests]; } else { var subsets = tests ? tests.split("|") : defaultSubsets; subsetRegexes = subsets.map(function (sub) { return "^" + sub + ".*$"; }); subsetRegexes.push("^(?!" + subsets.join("|") + ").*$"); } - subsetRegexes.forEach(function (subsetRegex) { + subsetRegexes.forEach(function (subsetRegex, i) { tests = subsetRegex ? ' -g "' + subsetRegex + '"' : ''; var cmd = "mocha" + (debug ? " --debug-brk" : "") + " -R " + reporter + tests + colors + ' -t ' + testTimeout + ' ' + run; console.log(cmd); - exec(cmd, function () { + function finish() { deleteTemporaryProjectOutput(); - if (postLint) { + complete(); + } + exec(cmd, function () { + if (lintFlag && i === 0) { var lint = jake.Task['lint']; lint.addListener('complete', function () { complete(); }); lint.invoke(); } - else { - complete(); - } - }); + finish(); + }, finish); }); } @@ -705,9 +755,9 @@ task("runtests-parallel", ["build-rules", "tests", builtLocalDirectory], functio runConsoleTests('min', ['compiler', 'conformance', 'Projects', 'fourslash']); }, {async: true}); -desc("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."); +desc("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."); task("runtests", ["build-rules", "tests", builtLocalDirectory], function() { - runConsoleTests('mocha-fivemat-progress-reporter', [], /*postLint*/ true); + runConsoleTests('mocha-fivemat-progress-reporter', []); }, {async: true}); desc("Generates code coverage data via instanbul"); @@ -718,9 +768,9 @@ task("generate-code-coverage", ["tests", builtLocalDirectory], function () { }, { async: true }); // Browser tests -var nodeServerOutFile = 'tests/webTestServer.js' -var nodeServerInFile = 'tests/webTestServer.ts' -compileFile(nodeServerOutFile, [nodeServerInFile], [builtLocalDirectory, tscFile], [], /*useBuiltCompiler:*/ true, /*noOutFile*/ true); +var nodeServerOutFile = "tests/webTestServer.js"; +var nodeServerInFile = "tests/webTestServer.ts"; +compileFile(nodeServerOutFile, [nodeServerInFile], [builtLocalDirectory, tscFile], [], /*useBuiltCompiler:*/ true, { noOutFile: true }); desc("Runs browserify on run.js to produce a file suitable for running tests in the browser"); task("browserify", ["tests", builtLocalDirectory, nodeServerOutFile], function() { @@ -729,9 +779,9 @@ task("browserify", ["tests", builtLocalDirectory, nodeServerOutFile], function() }, {async: true}); desc("Runs the tests using the built run.js file like 'jake runtests'. Syntax is jake runtests-browser. Additional optional parameters tests=[regex], port=, browser=[chrome|IE]"); -task("runtests-browser", ["tests", "browserify", builtLocalDirectory], function() { +task("runtests-browser", ["tests", "browserify", builtLocalDirectory, servicesFileInBrowserTest], function() { cleanTestDirs(); - host = "node" + host = "node"; port = process.env.port || process.env.p || '8888'; browser = process.env.browser || process.env.b || "IE"; tests = process.env.test || process.env.tests || process.env.t; @@ -745,13 +795,13 @@ task("runtests-browser", ["tests", "browserify", builtLocalDirectory], function( } tests = tests ? tests : ''; - var cmd = host + " tests/webTestServer.js " + port + " " + browser + " " + tests + var cmd = host + " tests/webTestServer.js " + port + " " + browser + " " + tests; console.log(cmd); exec(cmd); }, {async: true}); function getDiffTool() { - var program = process.env['DIFF'] + var program = process.env['DIFF']; if (!program) { fail("Add the 'DIFF' environment variable to the path of the program you want to use."); } @@ -780,11 +830,11 @@ task("tests-debug", ["setDebugMode", "tests"]); // Makes the test results the new baseline desc("Makes the most recent test results the new baseline, overwriting the old baseline"); task("baseline-accept", function(hardOrSoft) { - if (!hardOrSoft || hardOrSoft == "hard") { + if (!hardOrSoft || hardOrSoft === "hard") { jake.rmRf(refBaseline); fs.renameSync(localBaseline, refBaseline); } - else if (hardOrSoft == "soft") { + else if (hardOrSoft === "soft") { var files = jake.readdirR(localBaseline); for (var i in files) { jake.cpR(files[i], refBaseline); @@ -863,15 +913,14 @@ task("update-sublime", ["local", serverFile], function() { }); var tslintRuleDir = "scripts/tslint"; -var tslintRules = ([ +var tslintRules = [ "nextLineRule", - "noNullRule", "preferConstRule", "booleanTriviaRule", "typeOperatorSpacingRule", "noInOperatorRule", "noIncrementDecrementRule" -]); +]; var tslintRulesFiles = tslintRules.map(function(p) { return path.join(tslintRuleDir, p + ".ts"); }); @@ -881,7 +930,8 @@ var tslintRulesOutFiles = tslintRules.map(function(p) { desc("Compiles tslint rules to js"); task("build-rules", tslintRulesOutFiles); tslintRulesFiles.forEach(function(ruleFile, i) { - compileFile(tslintRulesOutFiles[i], [ruleFile], [ruleFile], [], /*useBuiltCompiler*/ false, /*noOutFile*/ true, /*generateDeclarations*/ false, path.join(builtLocalDirectory, "tslint")); + compileFile(tslintRulesOutFiles[i], [ruleFile], [ruleFile], [], /*useBuiltCompiler*/ false, + { noOutFile: true, generateDeclarations: false, outDir: path.join(builtLocalDirectory, "tslint")}); }); function getLinterOptions() { @@ -895,6 +945,7 @@ function getLinterOptions() { function lintFileContents(options, path, contents) { var ll = new Linter(path, contents, options); + console.log("Linting '" + path + "'."); return ll.lint(); } @@ -914,10 +965,13 @@ function lintFileAsync(options, path, cb) { } var servicesLintTargets = [ - "services.ts", - "outliningElementsCollector.ts", "navigateTo.ts", + "navigationBar.ts", + "outliningElementsCollector.ts", "patternMatcher.ts", + "services.ts", + "shims.ts", + "jsTyping.ts" ].map(function (s) { return path.join(servicesDirectory, s); }); @@ -927,15 +981,19 @@ var lintTargets = compilerSources .concat(tslintRulesFiles) .concat(servicesLintTargets); -desc("Runs tslint on the compiler sources"); +desc("Runs tslint on the compiler sources. Optional arguments are: f[iles]=regex"); task("lint", ["build-rules"], function() { var lintOptions = getLinterOptions(); var failed = 0; + var fileMatcher = RegExp(process.env.f || process.env.file || process.env.files || ""); for (var i in lintTargets) { - var result = lintFile(lintOptions, lintTargets[i]); - if (result.failureCount > 0) { - console.log(result.output); - failed += result.failureCount; + var target = lintTargets[i]; + if (fileMatcher.test(target)) { + var result = lintFile(lintOptions, target); + if (result.failureCount > 0) { + console.log(result.output); + failed += result.failureCount; + } } } if (failed > 0) { diff --git a/doc/README.md b/doc/README.md index 164fb69ee20..cfc97fedbe9 100644 --- a/doc/README.md +++ b/doc/README.md @@ -1,7 +1,9 @@ +# Read This! + This directory contains miscellaneous documentation such as the TypeScript language specification and logo. If you are looking for more introductory material, you might want to take a look at the [TypeScript Handbook](https://github.com/Microsoft/TypeScript-Handbook). # Spec Contributions The specification is first authored as a Microsoft Word (docx) file and then generated into Markdown and PDF formats. -Due to the binary format of docx files, and the merging difficulties that may come with it, it is preferred that any suggestions or problems found in the spec should be [filed as issues](https://github.com/Microsoft/TypeScript/issues/new) rather than sent as pull requests. \ No newline at end of file +Due to the binary format of docx files, and the merging difficulties that may come with it, it is preferred that **any suggestions or problems found in the spec should be [filed as issues](https://github.com/Microsoft/TypeScript/issues/new)** rather than sent as pull requests. diff --git a/doc/TypeScript Language Specification (Change Markup).docx b/doc/TypeScript Language Specification (Change Markup).docx index 24e7d1b623a..1db9f4e5908 100644 Binary files a/doc/TypeScript Language Specification (Change Markup).docx and b/doc/TypeScript Language Specification (Change Markup).docx differ diff --git a/doc/TypeScript Language Specification (Change Markup).pdf b/doc/TypeScript Language Specification (Change Markup).pdf index 1b4faab62e1..3403ba90217 100644 Binary files a/doc/TypeScript Language Specification (Change Markup).pdf and b/doc/TypeScript Language Specification (Change Markup).pdf differ diff --git a/doc/TypeScript Language Specification.docx b/doc/TypeScript Language Specification.docx index 370e5e25d89..4b8d3998f90 100644 Binary files a/doc/TypeScript Language Specification.docx and b/doc/TypeScript Language Specification.docx differ diff --git a/doc/TypeScript Language Specification.pdf b/doc/TypeScript Language Specification.pdf index 277fcecf2de..07069f6d3a0 100644 Binary files a/doc/TypeScript Language Specification.pdf and b/doc/TypeScript Language Specification.pdf differ diff --git a/doc/handbook/README.md b/doc/handbook/README.md new file mode 100644 index 00000000000..2d2e0e83a46 --- /dev/null +++ b/doc/handbook/README.md @@ -0,0 +1,4 @@ +# The TypeScript Handbook + +The contents of the TypeScript Handbook can be read from [its GitHub repository](https://github.com/Microsoft/TypeScript-Handbook). +Issues and pull requests should be directed there. \ No newline at end of file diff --git a/doc/spec.md b/doc/spec.md index df3f4d90b0a..fa69d321056 100644 --- a/doc/spec.md +++ b/doc/spec.md @@ -1,8 +1,8 @@ # TypeScript Language Specification -Version 1.6 +Version 1.8 -August, 2015 +January, 2016
@@ -58,8 +58,8 @@ TypeScript is a trademark of Microsoft Corporation. * [3.6 Type Parameters](#3.6) * [3.6.1 Type Parameter Lists](#3.6.1) * [3.6.2 Type Argument Lists](#3.6.2) + * [3.6.3 This-types](#3.6.3) * [3.7 Named Types](#3.7) - * [3.7.1 Instance Types](#3.7.1) * [3.8 Specifying Types](#3.8) * [3.8.1 Predefined Types](#3.8.1) * [3.8.2 Type References](#3.8.2) @@ -71,6 +71,7 @@ TypeScript is a trademark of Microsoft Corporation. * [3.8.8 Function Type Literals](#3.8.8) * [3.8.9 Constructor Type Literals](#3.8.9) * [3.8.10 Type Queries](#3.8.10) + * [3.8.11 This-Type References](#3.8.11) * [3.9 Specifying Members](#3.9) * [3.9.1 Property Signatures](#3.9.1) * [3.9.2 Call Signatures](#3.9.2) @@ -158,7 +159,8 @@ TypeScript is a trademark of Microsoft Corporation. * [6.5 Generic Functions](#6.5) * [6.6 Code Generation](#6.6) * [6.7 Generator Functions](#6.7) - * [6.8 Type Guard Functions](#6.8) + * [6.8 Asynchronous Functions](#6.8) + * [6.9 Type Guard Functions](#6.9) * [7 Interfaces](#7) * [7.1 Interface Declarations](#7.1) * [7.2 Declaration Merging](#7.2) @@ -184,9 +186,10 @@ TypeScript is a trademark of Microsoft Corporation. * [8.4.3 Member Accessor Declarations](#8.4.3) * [8.4.4 Dynamic Property Declarations](#8.4.4) * [8.5 Index Member Declarations](#8.5) - * [8.6 Code Generation](#8.6) - * [8.6.1 Classes Without Extends Clauses](#8.6.1) - * [8.6.2 Classes With Extends Clauses](#8.6.2) + * [8.6 Decorators](#8.6) + * [8.7 Code Generation](#8.7) + * [8.7.1 Classes Without Extends Clauses](#8.7.1) + * [8.7.2 Classes With Extends Clauses](#8.7.2) * [9 Enums](#9) * [9.1 Enum Declarations](#9.1) * [9.2 Enum Members](#9.2) @@ -238,9 +241,9 @@ TypeScript is a trademark of Microsoft Corporation. JavaScript applications such as web e-mail, maps, document editing, and collaboration tools are becoming an increasingly important part of the everyday computing. We designed TypeScript to meet the needs of the JavaScript programming teams that build and maintain large JavaScript programs. TypeScript helps programming teams to define interfaces between software components and to gain insight into the behavior of existing JavaScript libraries. TypeScript also enables teams to reduce naming conflicts by organizing their code into dynamically-loadable modules. TypeScript's optional type system enables JavaScript programmers to use highly-productive development tools and practices: static checking, symbol-based navigation, statement completion, and code re-factoring. -TypeScript is a syntactic sugar for JavaScript. TypeScript syntax is a superset of ECMAScript 6 (ES6) syntax. Every JavaScript program is also a TypeScript program. The TypeScript compiler performs only file-local transformations on TypeScript programs and does not re-order variables declared in TypeScript. This leads to JavaScript output that closely matches the TypeScript input. TypeScript does not transform variable names, making tractable the direct debugging of emitted JavaScript. TypeScript optionally provides source maps, enabling source-level debugging. TypeScript tools typically emit JavaScript upon file save, preserving the test, edit, refresh cycle commonly used in JavaScript development. +TypeScript is a syntactic sugar for JavaScript. TypeScript syntax is a superset of ECMAScript 2015 (ES2015) syntax. Every JavaScript program is also a TypeScript program. The TypeScript compiler performs only file-local transformations on TypeScript programs and does not re-order variables declared in TypeScript. This leads to JavaScript output that closely matches the TypeScript input. TypeScript does not transform variable names, making tractable the direct debugging of emitted JavaScript. TypeScript optionally provides source maps, enabling source-level debugging. TypeScript tools typically emit JavaScript upon file save, preserving the test, edit, refresh cycle commonly used in JavaScript development. -TypeScript syntax includes all features of ECMAScript 6 (ES6), including classes and modules, and provides the ability to translate these features into ECMAScript 3 or 5 compliant code. +TypeScript syntax includes all features of ECMAScript 2015, including classes and modules, and provides the ability to translate these features into ECMAScript 3 or 5 compliant code. Classes enable programmers to express common object-oriented patterns in a standard way, making features like inheritance more readable and interoperable. Modules enable programmers to organize their code into components while avoiding naming conflicts. The TypeScript compiler provides module code generation options that support either static or dynamic loading of module contents. @@ -474,7 +477,7 @@ Section [4.23](#4.23) provides additional information about contextually typed e ## 1.6 Classes -JavaScript practice has two very common design patterns: the module pattern and the class pattern. Roughly speaking, the module pattern uses closures to hide names and to encapsulate private data, while the class pattern uses prototype chains to implement many variations on object-oriented inheritance mechanisms. Libraries such as 'prototype.js' are typical of this practice. TypeScript's namespaces are a formalization of the module pattern. (The term "module pattern" is somewhat unfortunate now that ECMAScript 6 formally supports modules in a manner different from what the module pattern prescribes. For this reason, TypeScript uses the term "namespace" for its formalization of the module pattern.) +JavaScript practice has two very common design patterns: the module pattern and the class pattern. Roughly speaking, the module pattern uses closures to hide names and to encapsulate private data, while the class pattern uses prototype chains to implement many variations on object-oriented inheritance mechanisms. Libraries such as 'prototype.js' are typical of this practice. TypeScript's namespaces are a formalization of the module pattern. (The term "module pattern" is somewhat unfortunate now that ECMAScript 2015 formally supports modules in a manner different from what the module pattern prescribes. For this reason, TypeScript uses the term "namespace" for its formalization of the module pattern.) This section and the namespace section below will show how TypeScript emits consistent, idiomatic JavaScript when emitting ECMAScript 3 or 5 compliant code for classes and namespaces. The goal of TypeScript's translation is to emit exactly what a programmer would type when implementing a class or namespace unaided by a tool. This section will also describe how TypeScript infers a type for each class declaration. We'll start with a simple BankAccount class. @@ -773,13 +776,13 @@ In this case, the compiler assumes that the namespace object resides in global v ## 1.11 Modules -TypeScript also supports ECMAScript 6 modules, which are files that contain top-level *export* and *import* directives. For this type of module the TypeScript compiler can emit both ECMAScript 6 compliant code and down-level ECMAScript 3 or 5 compliant code for a variety of module loading systems, including CommonJS, Asynchronous Module Definition (AMD), and Universal Module Definition (UMD). +TypeScript also supports ECMAScript 2015 modules, which are files that contain top-level *export* and *import* directives. For this type of module the TypeScript compiler can emit both ECMAScript 2015 compliant code and down-level ECMAScript 3 or 5 compliant code for a variety of module loading systems, including CommonJS, Asynchronous Module Definition (AMD), and Universal Module Definition (UMD).
#
2 Basic Concepts -The remainder of this document is the formal specification of the TypeScript programming language and is intended to be read as an adjunct to the [ECMAScript Language Specification](http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf) (specifically, the ECMA-262 Standard, 6th Edition). This document describes the syntactic grammar added by TypeScript along with the compile-time processing and type checking performed by the TypeScript compiler, but it only minimally discusses the run-time behavior of programs since that is covered by the ECMAScript specification. +The remainder of this document is the formal specification of the TypeScript programming language and is intended to be read as an adjunct to the [ECMAScript 2015 Language Specification](http://www.ecma-international.org/ecma-262/6.0/) (specifically, the ECMA-262 Standard, 6th Edition). This document describes the syntactic grammar added by TypeScript along with the compile-time processing and type checking performed by the TypeScript compiler, but it only minimally discusses the run-time behavior of programs since that is covered by the ECMAScript specification. ## 2.1 Grammar Conventions @@ -866,7 +869,7 @@ A property name can be any identifier (including a reserved word), a string lite ### 2.2.3 Computed Property Names -ECMAScript 6 permits object literals and classes to declare members with computed property names. A computed property name specifies an expression that computes the actual property name at run-time. Because the final property name isn't known at compile-time, TypeScript can only perform limited checks for entities declared with computed property names. However, a subset of computed property names known as ***well-known symbols*** can be used anywhere a *PropertyName* is expected, including property names within types. A computed property name is a well-known symbol if it is of the form +ECMAScript 2015 permits object literals and classes to declare members with computed property names. A computed property name specifies an expression that computes the actual property name at run-time. Because the final property name isn't known at compile-time, TypeScript can only perform limited checks for entities declared with computed property names. However, a subset of computed property names known as ***well-known symbols*** can be used anywhere a *PropertyName* is expected, including property names within types. A computed property name is a well-known symbol if it is of the form ```TypeScript [ Symbol . xxx ] @@ -884,6 +887,8 @@ interface Iterable { } ``` +*TODO: Update to reflect treatment of [computed property names with literal expressions](https://github.com/Microsoft/TypeScript/pull/5535)*. + ## 2.3 Declarations Declarations introduce names in their associated ***declaration spaces***. A name must be unique in its declaration space and can denote a ***value***, a ***type***, or a ***namespace***, or some combination thereof. Effectively, a single name can have as many as three distinct meanings. For example: @@ -913,7 +918,7 @@ Declarations introduce the following meanings for the name they declare: * A variable, parameter, function, generator, member variable, member function, member accessor, or enum member declaration introduces a value meaning. * An interface, type alias, or type parameter declaration introduces a type meaning. -* A class declaration introduces a value meaning (the constructor function) and a type meaning (the class instance type). +* A class declaration introduces a value meaning (the constructor function) and a type meaning (the class type). * An enum declaration introduces a value meaning (the enum instance) and a type meaning (the enum type). * A namespace declaration introduces a namespace meaning (the type and namespace container) and, if the namespace is instantiated (section [10.1](#10.1)), a value meaning (the namespace instance). * An import or export declaration introduces the meaning(s) of the imported or exported entity. @@ -996,7 +1001,9 @@ When an identifier is resolved as a *TypeName* (section [3.8.2](#3.8.2)), only n When an identifier is resolved as a *NamespaceName* (section [3.8.2](#3.8.2)), only names in scope with a namespace meaning are considered and other names are ignored. -Note that class members are never directly in scope—they can only be accessed by applying the dot ('.') operator to a class instance. This even includes members of the current instance in a constructor or member function, which are accessed by applying the dot operator to `this`. +*TODO: [Include specific rules for alias resolution](https://github.com/Microsoft/TypeScript/issues/3158)*. + +Note that class and interface members are never directly in scope—they can only be accessed by applying the dot ('.') operator to a class or interface instance. This even includes members of the current instance in a constructor or member function, which are accessed by applying the dot operator to `this`. As the rules above imply, locally declared entities in a namespace are closer in scope than exported entities declared in other namespace declarations for the same namespace. For example: @@ -1121,7 +1128,7 @@ var c = abc.charAt(2); // Property of String interface The Symbol primitive type corresponds to the similarly named JavaScript primitive type and represents unique tokens that may be used as keys for object properties. -The `symbol` keyword references the Symbol primitive type. Symbol values are obtained using the global object 'Symbol' which has a number of methods and properties and can be invoked as a function. In particular, the global object 'Symbol' defines a number of well-known symbols ([2.2.3](#2.2.3)) that can be used in a manner similar to identifiers. Note that the 'Symbol' object is available only in ECMAScript 6 environments. +The `symbol` keyword references the Symbol primitive type. Symbol values are obtained using the global object 'Symbol' which has a number of methods and properties and can be invoked as a function. In particular, the global object 'Symbol' defines a number of well-known symbols ([2.2.3](#2.2.3)) that can be used in a manner similar to identifiers. Note that the 'Symbol' object is available only in ECMAScript 2015 environments. For purposes of determining type relationships (section [3.11](#3.11)) and accessing properties (section [4.13](#4.13)), the Symbol primitive type behaves as an object type with the same properties as the global interface type 'Symbol'. @@ -1186,6 +1193,8 @@ Specialized signatures (section [3.9.2.4](#3.9.2.4)) permit string literals to b All string literal types are subtypes of the String primitive type. +*TODO: Update to reflect [expanded support for string literal types](https://github.com/Microsoft/TypeScript/pull/5185)*. + ## 3.3 Object Types Object types are composed from properties, call signatures, construct signatures, and index signatures, collectively called members. @@ -1352,7 +1361,7 @@ var b = x.b; // b has type number var c = x.c; // Error, no property c in union type ``` -Note that 'x.a' has a union type because the type of 'a' is different in 'A' and 'B', whereas 'x.b' simply has type number because that is the type of 'b' in both 'A' and 'B'. Also note that there is no property 'x.c' because only 'A' has a property 'c'. +Note that 'x.a' has a union type because the type of 'a' is different in 'A' and 'B', whereas 'x.b' simply has type number because that is the type of 'b' in both 'A' and 'B'. Also note that there is no property 'x.c' because only 'B' has a property 'c'. When used as a contextual type (section [4.23](#4.23)), a union type has those members that are present in any of its constituent types, with types that are unions of the respective members in the constituent types. Specifically, a union type used as a contextual type has the apparent members defined in section [3.11.1](#3.11.1), except that a particular member need only be present in one or more constituent types instead of all constituent types. @@ -1437,7 +1446,7 @@ Type parameter names must be unique. A compile-time error occurs if two or more The scope of a type parameter extends over the entire declaration with which the type parameter list is associated, with the exception of static member declarations in classes. -Each type parameter has an associated type parameter ***constraint*** that establishes an upper bound for type arguments. Omitting a constraint or specifying type `any` as the constraint corresponds to specifying the empty object type `{}`. Type parameters declared in a particular type parameter list may not be referenced in constraints in that type parameter list. +A type parameter may have an associated type parameter ***constraint*** that establishes an upper bound for type arguments. Type parameters may be referenced in type parameter constraints within the same type parameter list, including even constraint declarations that occur to the left of the type parameter. The ***base constraint*** of a type parameter *T* is defined as follows: @@ -1448,15 +1457,21 @@ The ***base constraint*** of a type parameter *T* is defined as follows: In the example ```TypeScript -interface G { - f(x: V): V; -} +interface G { } ``` -the base constraint of 'T' is the empty object type, and the base constraint of 'U' and 'V' is 'Function'. +the base constraint of 'T' is the empty object type and the base constraint of 'U' and 'V' is 'Function'. For purposes of determining type relationships (section [3.11](#3.11)), type parameters appear to be subtypes of their base constraint. Likewise, in property accesses (section [4.13](#4.13)), `new` operations (section [4.14](#4.14)), and function calls (section [4.15](#4.15)), type parameters appear to have the members of their base constraint, but no other members. +It is an error for a type parameter to directly or indirectly be a constraint for itself. For example, both of the following declarations are invalid: + +```TypeScript +interface A { } + +interface B { } +``` + ### 3.6.2 Type Argument Lists A type reference (section [3.8.2](#3.8.2)) to a generic type must include a list of type arguments enclosed in angle brackets and separated by commas. Similarly, a call (section [4.15](#4.15)) to a generic function may explicitly include a type argument list instead of relying on type inference. @@ -1471,7 +1486,7 @@ A type reference (section [3.8.2](#3.8.2)) to a generic type must include a list   *TypeArgument:*    *Type* -Type arguments correspond one-to-one with type parameters of the generic type or function being referenced. A type argument list is required to specify exactly one type argument for each corresponding type parameter, and each type argument is required to ***satisfy*** the constraint of its corresponding type parameter. A type argument satisfies a type parameter constraint if the type argument is assignable to (section [3.11.4](#3.11.4)) the constraint type once type arguments are substituted for type parameters. +Type arguments correspond one-to-one with type parameters of the generic type or function being referenced. A type argument list is required to specify exactly one type argument for each corresponding type parameter, and each type argument for a constrained type parameter is required to ***satisfy*** the constraint of that type parameter. A type argument satisfies a type parameter constraint if the type argument is assignable to (section [3.11.4](#3.11.4)) the constraint type once type arguments are substituted for type parameters. Given the declaration @@ -1483,6 +1498,33 @@ a type reference of the form 'G<A, B>' places no requirements on 'A' but requ The process of substituting type arguments for type parameters in a generic type or generic signature is known as ***instantiating*** the generic type or signature. Instantiation of a generic type or signature can fail if the supplied type arguments do not satisfy the constraints of their corresponding type parameters. +### 3.6.3 This-types + +Every class and interface has a ***this-type*** that represents the actual type of instances of the class or interface within the declaration of the class or interface. The this-type is referenced using the keyword `this` in a type position. Within instance methods and constructors of a class, the type of the expression `this` (section [4.2](#4.2)) is the this-type of the class. + +Classes and interfaces support inheritance and therefore the instance represented by `this` in a method isn't necessarily an instance of the containing class—it may in fact be an instance of a derived class or interface. To model this relationship, the this-type of a class or interface is classified as a type parameter. Unlike other type parameters, it is not possible to explicitly pass a type argument for a this-type. Instead, in a type reference to a class or interface type, the type reference *itself* is implicitly passed as a type argument for the this-type. For example: + +```TypeScript +class A { + foo() { + return this; + } +} + +class B extends A { + bar() { + return this; + } +} + +let b: B; +let x = b.foo().bar(); // Fluent pattern works, type of x is B +``` + +In the declaration of `b` above, the type reference `B` is itself passed as a type argument for B's this-type. Thus, the referenced type is an instantiation of class `B` where all occurrences of the type `this` are replaced with `B`, and for that reason the `foo` method of `B` actually returns `B` (as opposed to `A`). + +The this-type of a given class or interface type *C* implicitly has a constraint consisting of a type reference to *C* with *C*'s own type parameters passed as type arguments and with that type reference passed as the type argument for the this-type. + ## 3.7 Named Types Classes, interfaces, enums, and type aliases are ***named types*** that are introduced through class declarations (section [8.1](#8.1)), interface declarations (section [7.1](#7.1)), enum declarations ([9.1](#9.1)), and type alias declarations (section [3.10](#3.10)). Classes, interfaces, and type aliases may have type parameters and are then called ***generic types***. Conversely, named types without type parameters are called ***non-generic types***. @@ -1511,21 +1553,6 @@ is indistinguishable from the type { first: string; second: Entity; } ``` -### 3.7.1 Instance Types - -Each class and interface has an associated actual type known as the ***instance type***. For a non-generic class or interface, the instance type is simply a type reference to the class or interface. For a generic class or interface, the instance type is an instantiation of the generic type where each of the type arguments is the corresponding type parameter. Since the instance type uses the type parameters it can be used only where the type parameters are in scope—that is, inside the declaration of the class or interface. Within the constructor and instance member functions of a class, the type of `this` is the instance type of the class. - -The following example illustrates the concept of an instance type: - -```TypeScript -class G { // Introduce type parameter T - self: G; // Use T as type argument to form instance type - f() { - this.self = this; // self and this are both of type G - } -} -``` - ## 3.8 Specifying Types Types are specified either by referencing their keyword or name, or by writing object type literals, array type literals, tuple type literals, function type literals, constructor type literals, or type queries. @@ -1550,7 +1577,8 @@ Types are specified either by referencing their keyword or name, or by writing o    *ObjectType*    *ArrayType*    *TupleType* -   *TypeQuery* +   *TypeQuery* +   *ThisType*   *ParenthesizedType:*    `(` *Type* `)` @@ -1711,7 +1739,7 @@ A union type literal is written as a sequence of types separated by vertical bar   *UnionType:*    *UnionOrIntersectionOrPrimaryType* `|` *IntersectionOrPrimaryType* -A union typle literal references a union type (section [3.4](#3.4)). +A union type literal references a union type (section [3.4](#3.4)). ### 3.8.7 Intersection Type Literals @@ -1720,7 +1748,7 @@ An intersection type literal is written as a sequence of types separated by ampe   *IntersectionType:*    *IntersectionOrPrimaryType* `&` *PrimaryType* -An intersection typle literal references an intersection type (section [3.5](#3.5)). +An intersection type literal references an intersection type (section [3.5](#3.5)). ### 3.8.8 Function Type Literals @@ -1804,6 +1832,41 @@ var h: () => typeof h; Here, 'g' and 'g.x' have the same recursive type, and likewise 'h' and 'h()' have the same recursive type. +### 3.8.11 This-Type References + +The `this` keyword is used to reference the this-type (section [3.6.3](#3.6.3)) of a class or interface. + +  *ThisType:* +   `this` + +The meaning of a *ThisType* depends on the closest enclosing *FunctionDeclaration*, *FunctionExpression*, *PropertyDefinition*, *ClassElement*, or *TypeMember*, known as the root declaration of the *ThisType*, as follows: + +* When the root declaration is an instance member or constructor of a class, the *ThisType* references the this-type of that class. +* When the root declaration is a member of an interface type, the *ThisType* references the this-type of that interface. +* Otherwise, the *ThisType* is an error. + +Note that in order to avoid ambiguities it is not possible to reference the this-type of a class or interface in a nested object type literal. In the example + +```TypeScript +interface ListItem { + getHead(): this; + getTail(): this; + getHeadAndTail(): { head: this, tail: this }; // Error +} +``` + +the `this` references on the last line are in error because their root declarations are not members of a class or interface. The recommended way to reference the this-type of an outer class or interface in an object type literal is to declare an intermediate generic type and pass `this` as a type argument. For example: + +```TypeScript +type HeadAndTail = { head: T, tail: T }; + +interface ListItem { + getHead(): this; + getTail(): this; + getHeadAndTail(): HeadAndTail; +} +``` + ## 3.9 Specifying Members The members of an object type literal (section [3.8.3](#3.8.3)) are specified as a combination of property, call, construct, index, and method signatures. @@ -1931,6 +1994,8 @@ A parameter can be marked optional by following its name or binding pattern with *TODO: Update to reflect [binding parameter cannot be optional in implementation signature](https://github.com/Microsoft/TypeScript/issues/2797)*. +*TODO: Update to reflect [required parameters support initializers](https://github.com/Microsoft/TypeScript/pull/4022)*. + #### 3.9.2.3 Return Type If present, a call signature's return type annotation specifies the type of the value computed and returned by a call operation. A `void` return type annotation is used to indicate that a function has no return value. @@ -2122,8 +2187,9 @@ Types in TypeScript have identity, subtype, supertype, and assignment compatibil The ***apparent members*** of a type are the members observed in subtype, supertype, and assignment compatibility relationships, as well as in the type checking of property accesses (section [4.13](#4.13)), `new` operations (section [4.14](#4.14)), and function calls (section [4.15](#4.15)). The apparent members of a type are determined as follows: -* The apparent members of the primitive types Number, Boolean, and String are the apparent members of the global interface types 'Number', 'Boolean', and 'String' respectively. -* The apparent members of an enum type are the apparent members of the global interface type 'Number'. +* The apparent members of the primitive type Number and all enum types are the apparent members of the global interface type 'Number'. +* The apparent members of the primitive type Boolean are the apparent members of the global interface type 'Boolean'. +* The apparent members of the primitive type String and all string literal types are the apparent members of the global interface type 'String'. * The apparent members of a type parameter are the apparent members of the constraint (section [3.6.1](#3.6.1)) of that type parameter. * The apparent members of an object type *T* are the combination of the following: * The declared and/or inherited members of *T*. @@ -2239,7 +2305,7 @@ Types are required to be assignment compatible in certain circumstances, such as * *S* or *T* is the Any type. * *S* is the Undefined type. * *S* is the Null type and *T* is not the Undefined type. -* *S* or *T* is an enum type and* *the other is the primitive type Number. +* *S* or *T* is an enum type and the other is the primitive type Number. * *S* is a string literal type and *T* is the primitive type String. * *S* is a union type and each constituent type of *S* is assignable to *T*. * *S* is an intersection type and at least one constituent type of *S* is assignable to *T*. @@ -2258,8 +2324,8 @@ Types are required to be assignment compatible in certain circumstances, such as * *M* has a rest parameter or the number of non-optional parameters in *N* is less than or equal to the total number of parameters in *M*, * for parameter positions that are present in both signatures, each parameter type in *N* is assignable to or from the corresponding parameter type in *M*, and * the result type of *M* is Void, or the result type of *N* is assignable to that of *M*. - * *M* is a string index signature of type *U* and *S* has an apparent string index signature of a type that is assignable to *U*. - * *M* is a numeric index signature of type *U* and *S* has an apparent string or numeric index signature of a type that is assignable to *U*. + * *M* is a string index signature of type *U*, and *U* is the Any type or *S* has an apparent string index signature of a type that is assignable to *U*. + * *M* is a numeric index signature of type *U*, and *U* is the Any type or *S* has an apparent string or numeric index signature of a type that is assignable to *U*. When comparing call or construct signatures, parameter names are ignored and rest parameters correspond to an unbounded expansion of optional parameters of the rest parameter element type. @@ -2366,6 +2432,8 @@ In certain contexts, inferences for a given set of type parameters are made *fro When comparing call or construct signatures, signatures in *S* correspond to signatures of the same kind in *T* pairwise in declaration order. If *S* and *T* have different numbers of a given kind of signature, the excess *first* signatures in declaration order of the longer list are ignored. +*TODO: Update to reflect [improved union and intersection type inference](https://github.com/Microsoft/TypeScript/pull/5738)*. + ### 3.11.8 Recursive Types Classes and interfaces can reference themselves in their internal structure, in effect creating recursive types with infinite nesting. For example, the type @@ -2443,7 +2511,7 @@ Expressions are classified as ***values*** or ***references***. References are t The type of `this` in an expression depends on the location in which the reference takes place: -* In a constructor, instance member function, instance member accessor, or instance member variable initializer, `this` is of the class instance type of the containing class. +* In a constructor, instance member function, instance member accessor, or instance member variable initializer, `this` is of the this-type (section [3.6.3](#3.6.3)) of the containing class. * In a static member function or static member accessor, the type of `this` is the constructor function type of the containing class. * In a function declaration or a function expression, `this` is of type Any. * In the global namespace, `this` is of type Any. @@ -2569,6 +2637,8 @@ The resulting type an array literal expression is determined as follows: A spread element must specify an expression of an array-like type (section [3.3.2](#3.3.2)), or otherwise an error occurs. +*TODO: The compiler currently doesn't support applying the spread operator to a string (to spread the individual characters of a string into a string array). This will eventually be allowed, but only when the code generation target is ECMAScript 2015 or later*. + *TODO: Document spreading an [iterator](https://github.com/Microsoft/TypeScript/pull/2498) into an array literal*. The rules above mean that an array literal is always of an array type, unless it is contextually typed by a tuple-like type. For example @@ -2619,7 +2689,7 @@ A super call invokes the constructor of the base class on the instance reference The type of a super call expression is Void. -The JavaScript code generated for a super call is specified in section [8.6.2](#8.6.2). +The JavaScript code generated for a super call is specified in section [8.7.2](#8.7.2). ### 4.9.2 Super Property Access @@ -2632,7 +2702,7 @@ Super property accesses are not permitted in other contexts, and it is not possi Super property accesses are typically used to access overridden base class member functions from derived class member functions. For an example of this, see section [8.4.2](#8.4.2). -The JavaScript code generated for a super property access is specified in section [8.6.2](#8.6.2). +The JavaScript code generated for a super property access is specified in section [8.7.2](#8.7.2). *TODO: Update section to include [bracket notation in super property access](https://github.com/Microsoft/TypeScript/issues/3970)*. @@ -2777,7 +2847,7 @@ object . name where *object* is an expression and *name* is an identifier (including, possibly, a reserved word), is used to access the property with the given name on the given object. A dot notation property access is processed as follows at compile-time: * If *object* is of type Any, any *name* is permitted and the property access is of type Any. -* Otherwise, if *name* denotes an accessible apparent property (section [3.11.1](#3.11.1)) in the type of *object*, the property access is of the type of that property. Public members are always accessible, but private and protected members of a class have restricted accessibility, as described in [8.2.2](#8.2.2). +* Otherwise, if *name* denotes an accessible apparent property (section [3.11.1](#3.11.1)) in the widened type (section [3.12](#3.12)) of *object*, the property access is of the type of that property. Public members are always accessible, but private and protected members of a class have restricted accessibility, as described in [8.2.2](#8.2.2). * Otherwise, the property access is invalid and a compile-time error occurs. A bracket notation property access of the form @@ -2892,7 +2962,7 @@ Given a signature < *T1* , *T2* , … , *Tn* Type argument inference produces a set of candidate types for each type parameter. Given a type parameter *T* and set of candidate types, the actual inferred type argument is determined as follows: * If the set of candidate argument types is empty, the inferred type argument for *T* is *T*'s constraint. -* Otherwise, if at least one of the candidate types is a supertype of all of the other candidate types, let *C* denote the first such candidate type. If *C* satisfies *T*'s constraint, the inferred type argument for *T* is *C*. Otherwise, the inferred type argument for *T* is *T*'s constraint. +* Otherwise, if at least one of the candidate types is a supertype of all of the other candidate types, let *C* denote the widened form (section [3.12](#3.12)) of the first such candidate type. If *C* satisfies *T*'s constraint, the inferred type argument for *T* is *C*. Otherwise, the inferred type argument for *T* is *T*'s constraint. * Otherwise, if no candidate type is a supertype of all of the other candidate types, type inference has fails and no type argument is inferred for *T*. In order to compute candidate types, the argument list is processed as follows: @@ -3030,6 +3100,8 @@ if (shape instanceof Circle) { } ``` +*TODO: Document [as operator](https://github.com/Microsoft/TypeScript/pull/3564)*. + ## 4.17 JSX Expressions *TODO: Document [JSX expressions](https://github.com/Microsoft/TypeScript/issues/3203)*. @@ -3106,6 +3178,8 @@ These operators require their operands to be of type Any, the Number primitive t |String|||||| |Other|||||| +*TODO: Document the [exponentation operator](https://github.com/Microsoft/TypeScript/issues/4812)*. + ### 4.19.2 The + operator The binary + operator requires both operands to be of the Number primitive type or an enum type, or at least one of the operands to be of type Any or the String primitive type. Operands of an enum type are treated as having the primitive type Number. If one operand is the `null` or `undefined` value, it is treated as having the type of the other operand. If both operands are of the Number primitive type, the result is of the Number primitive type. If one or both operands are of the String primitive type, the result is of the String primitive type. Otherwise, the result is of type Any. @@ -3218,7 +3292,7 @@ is subject to the same requirements, and produces a value of the same type, as t ### 4.21.1 Destructuring Assignment -A ***destructuring assignment*** is an assignment operation in which the left hand operand is a destructuring assignment pattern as defined by the *AssignmentPattern* production in the ECMAScript 6 specification. +A ***destructuring assignment*** is an assignment operation in which the left hand operand is a destructuring assignment pattern as defined by the *AssignmentPattern* production in the ECMAScript 2015 specification. In a destructuring assignment expression, the type of the expression on the right must be assignable to the assignment target on the left. An expression of type *S* is considered assignable to an assignment target *V* if one of the following is true: @@ -3233,9 +3307,11 @@ In a destructuring assignment expression, the type of the expression on the righ * *S* is a tuple-like type (section [3.3.3](#3.3.3)) with a property named *N* of a type that is assignable to the target given in *E*, where *N* is the numeric index of *E* in the array assignment pattern, or * *S* is not a tuple-like type and the numeric index signature type of *S* is assignable to the target given in *E*. +*TODO: [Update to specify behavior when assignment element E is a rest element](https://github.com/Microsoft/TypeScript/issues/2713)*. + In an assignment property or element that includes a default value, the type of the default value must be assignable to the target given in the assignment property or element. -When the output target is ECMAScript 6 or higher, destructuring variable assignments remain unchanged in the emitted JavaScript code. When the output target is ECMAScript 3 or 5, destructuring variable assignments are rewritten to series of simple assignments. For example, the destructuring assignment +When the output target is ECMAScript 2015 or higher, destructuring variable assignments remain unchanged in the emitted JavaScript code. When the output target is ECMAScript 3 or 5, destructuring variable assignments are rewritten to series of simple assignments. For example, the destructuring assignment ```TypeScript var x = 1; @@ -3360,6 +3436,8 @@ In the rules above, when a narrowing operation would remove all constituent type Note that type guards affect types of variables and parameters only and have no effect on members of objects such as properties. Also note that it is possible to defeat a type guard by calling a function that changes the type of the guarded variable. +*TODO: Document [user defined type guard functions](https://github.com/Microsoft/TypeScript/issues/1007)*. + In the example ```TypeScript @@ -3432,7 +3510,7 @@ This chapter describes the static type checking TypeScript provides for JavaScri ## 5.1 Blocks -Blocks are extended to include local interface, type alias, and enum declarations (classes are already included by the ECMAScript 6 grammar). +Blocks are extended to include local interface, type alias, and enum declarations (classes are already included by the ECMAScript 2015 grammar).   *Declaration:* *( Modified )*    … @@ -3549,7 +3627,9 @@ The type *T* associated with a binding element is determined as follows: When a destructuring variable declaration, binding property, or binding element specifies an initializer expression, the type of the initializer expression is required to be assignable to the widened form of the type associated with the destructuring variable declaration, binding property, or binding element. -When the output target is ECMAScript 6 or higher, except for removing the optional type annotation, destructuring variable declarations remain unchanged in the emitted JavaScript code. +*TODO: Update rules to reflect [improved checking of destructuring with literal initializers](https://github.com/Microsoft/TypeScript/pull/4598)*. + +When the output target is ECMAScript 2015 or higher, except for removing the optional type annotation, destructuring variable declarations remain unchanged in the emitted JavaScript code. When the output target is ECMAScript 3 or 5, destructuring variable declarations are rewritten to simple variable declarations. For example, an object destructuring declaration of the form @@ -3805,7 +3885,7 @@ function g(x: number) { the inferred return type for 'f' and 'g' is Any because the functions reference themselves through a cycle with no return type annotations. Adding an explicit return type 'number' to either breaks the cycle and causes the return type 'number' to be inferred for the other. -An explicitly typed function whose return type isn't the Void or the Any type must have at least one return statement somewhere in its body. An exception to this rule is if the function implementation consists of a single 'throw' statement. +An explicitly typed function whose return type isn't the Void type, the Any type, or a union type containing the Void or Any type as a constituent must have at least one return statement somewhere in its body. An exception to this rule is if the function implementation consists of a single 'throw' statement. The type of 'this' in a function implementation is the Any type. @@ -3855,7 +3935,7 @@ The type of local introduced in a destructuring parameter declaration is determi * Otherwise, if the parameter is a rest parameter, *T* is `any[]`. * Otherwise, *T* is `any`. -When the output target is ECMAScript 6 or higher, except for removing the optional type annotation, destructuring parameter declarations remain unchanged in the emitted JavaScript code. When the output target is ECMAScript 3 or 5, destructuring parameter declarations are rewritten to local variable declarations. +When the output target is ECMAScript 2015 or higher, except for removing the optional type annotation, destructuring parameter declarations remain unchanged in the emitted JavaScript code. When the output target is ECMAScript 3 or 5, destructuring parameter declarations are rewritten to local variable declarations. The example @@ -3965,9 +4045,13 @@ where *Parameter* is the parameter name and *Default* is the default value expre *TODO: Document [generator functions](https://github.com/Microsoft/TypeScript/issues/2873)*. -## 6.8 Type Guard Functions +## 6.8 Asynchronous Functions -*TODO: Document [type guard functions](https://github.com/Microsoft/TypeScript/issues/1007)*. +*TODO: Document [asynchronous functions](https://github.com/Microsoft/TypeScript/issues/1664)*. + +## 6.9 Type Guard Functions + +*TODO: Document [type guard functions](https://github.com/Microsoft/TypeScript/issues/1007), including [this type predicates](https://github.com/Microsoft/TypeScript/pull/5906)*.
@@ -4016,7 +4100,7 @@ The following constraints must be satisfied by an interface declaration or other * An interface cannot declare a property with the same name as an inherited private or protected property. * Inherited properties with the same name must be identical (section [3.11.2](#3.11.2)). * All properties of the interface must satisfy the constraints implied by the index signatures of the interface as specified in section [3.9.4](#3.9.4). -* The instance type (section [3.7.1](#3.7.1)) of the declared interface must be assignable (section [3.11.4](#3.11.4)) to each of the base type references. +* The this-type (section [3.6.3](#3.6.3)) of the declared interface must be assignable (section [3.11.4](#3.11.4)) to each of the base type references. An interface is permitted to inherit identical members from multiple base types and will in that case only contain one occurrence of each particular member. @@ -4090,6 +4174,8 @@ interface Document { Note that the members of the last interface declaration appear first in the merged declaration. Also note that the relative order of members declared in the same interface body is preserved. +*TODO: Document [class and interface declaration merging](https://github.com/Microsoft/TypeScript/pull/3333)*. + ##
7.3 Interfaces Extending Classes When an interface type extends a class type it inherits the members of the class but not their implementations. It is as if the interface had declared all of the members of the class without providing an implementation. Interfaces inherit even the private and protected members of a base class. When a class containing private or protected members is the base type of an interface type, that interface type can only be implemented by that class or a descendant class. For example: @@ -4193,13 +4279,13 @@ var Point: { }; ``` -The context in which a class is referenced distinguishes between the class instance type and the constructor function. For example, in the assignment statement +The context in which a class is referenced distinguishes between the class type and the constructor function. For example, in the assignment statement ```TypeScript var p: Point = new Point(10, 20); ``` -the identifier 'Point' in the type annotation refers to the class instance type, whereas the identifier 'Point' in the `new` expression refers to the constructor function object. +the identifier 'Point' in the type annotation refers to the class type, whereas the identifier 'Point' in the `new` expression refers to the constructor function object. ### 8.1.1 Class Heritage Specification @@ -4225,7 +4311,7 @@ The following constraints must be satisfied by the class heritage specification * If present, the type reference specified in the `extends` clause must denote a class type. Furthermore, the *TypeName* part of the type reference is required to be a reference to the class constructor function when evaluated as an expression. * A class declaration may not, directly or indirectly, specify a base class that originates in the same declaration. In other words a class cannot, directly or indirectly, be a base class of itself, regardless of type arguments. -* The instance type (section [3.7.1](#3.7.1)) of the declared class must be assignable (section [3.11.4](#3.11.4)) to the base type reference and each of the type references listed in the `implements` clause. +* The this-type (section [3.6.3](#3.6.3)) of the declared class must be assignable (section [3.11.4](#3.11.4)) to the base type reference and each of the type references listed in the `implements` clause. * The constructor function type created by the class declaration must be assignable to the base class constructor function type, ignoring construct signatures. The following example illustrates a situation in which the first rule above would be violated: @@ -4266,7 +4352,7 @@ The members of a class consist of the members introduced through member declarat Members are either ***instance members*** or ***static members***. -Instance members are members of the class type (section [8.2.4](#8.2.4)) and its associated instance type. Within constructors, instance member functions, and instance member accessors, the type of `this` is the instance type (section [3.7.1](#3.7.1)) of the class. +Instance members are members of the class type (section [8.2.4](#8.2.4)) and its associated this-type. Within constructors, instance member functions, and instance member accessors, the type of `this` is the this-type (section [3.6.3](#3.6.3)) of the class. Static members are declared using the `static` modifier and are members of the constructor function type (section [8.2.5](#8.2.5)). Within static member functions and static member accessors, the type of `this` is the constructor function type. @@ -4280,7 +4366,7 @@ Public property members can be accessed everywhere without restrictions. Private property members can be accessed only within their declaring class. Specifically, a private member *M* declared in a class *C* can be accessed only within the class body of *C*. -Protected property members can be accessed only within their declaring class and classes derived from their declaring class, and a protected instance property member must be accessed *through* an instance of the enclosing class. Specifically, a protected member *M* declared in a class *C* can be accessed only within the class body of *C* or the class body of a class derived from *C*. Furthermore, when a protected instance member *M* is accessed in a property access *E*`.`*M* within the body of a class *D*, the type of *E* is required to be *D* or a type that directly or indirectly has *D* as a base type, regardless of type arguments. +Protected property members can be accessed only within their declaring class and classes derived from their declaring class, and a protected instance property member must be accessed *through* an instance of the enclosing class or a subclass thereof. Specifically, a protected member *M* declared in a class *C* can be accessed only within the class body of *C* or the class body of a class derived from *C*. Furthermore, when a protected instance member *M* is accessed in a property access *E*`.`*M* within the body of a class *D*, the type of *E* is required to be *D* or a type that directly or indirectly has *D* as a base type, regardless of type arguments. Private and protected accessibility is enforced only at compile-time and serves as no more than an *indication of intent*. Since JavaScript provides no mechanism to create private and protected properties on an object, it is not possible to enforce the private and protected modifiers in dynamic code at run-time. For example, private and protected accessibility can be defeated by changing an object's static type to Any and accessing the member dynamically. @@ -4326,14 +4412,14 @@ An index member in a derived class is said to override an index member in a base ### 8.2.4 Class Types -A class declaration declares a new named type (section [3.7](#3.7)) called a class type. Within the constructor and member functions of a class, the type of `this` is the instance type (section [3.7.1](#3.7.1)) of this class type. The class type has the following members: +A class declaration declares a new named type (section [3.7](#3.7)) called a class type. Within the constructor and instance member functions of a class, the type of `this` is the this-type (section [3.6.3](#3.6.3)) of that class type. The class type has the following members: * A property for each instance member variable declaration in the class body. * A property of a function type for each instance member function declaration in the class body. * A property for each uniquely named instance member accessor declaration in the class body. * A property for each constructor parameter declared with a `public`, `private`, or `protected` modifier. * An index signature for each instance index member declaration in the class body. -* All base class instance type property or index members that are not overridden in the class. +* All base class instance property or index members that are not overridden in the class. All instance property members (including those that are private or protected) of a class must satisfy the constraints implied by the index members of the class as specified in section [3.9.4](#3.9.4). @@ -4353,7 +4439,7 @@ class B extends A { } ``` -the instance type of 'A' is +the class type of 'A' is equivalent to ```TypeScript interface A { @@ -4363,7 +4449,7 @@ interface A { } ``` -and the instance type of 'B' is +and the class type of 'B' is equivalent to ```TypeScript interface B { @@ -4374,16 +4460,16 @@ interface B { } ``` -Note that static declarations in a class do not contribute to the class type and its instance type—rather, static declarations introduce properties on the constructor function object. Also note that the declaration of 'g' in 'B' overrides the member inherited from 'A'. +Note that static declarations in a class do not contribute to the class type—rather, static declarations introduce properties on the constructor function object. Also note that the declaration of 'g' in 'B' overrides the member inherited from 'A'. ### 8.2.5 Constructor Function Types The type of the constructor function introduced by a class declaration is called the constructor function type. The constructor function type has the following members: -* If the class contains no constructor declaration and has no base class, a single construct signature with no parameters, having the same type parameters as the class and returning the instance type of the class. -* If the class contains no constructor declaration and has a base class, a set of construct signatures with the same parameters as those of the base class constructor function type following substitution of type parameters with the type arguments specified in the base class type reference, all having the same type parameters as the class and returning the instance type of the class. -* If the class contains a constructor declaration with no overloads, a construct signature with the parameter list of the constructor implementation, having the same type parameters as the class and returning the instance type of the class. -* If the class contains a constructor declaration with overloads, a set of construct signatures with the parameter lists of the overloads, all having the same type parameters as the class and returning the instance type of the class. +* If the class contains no constructor declaration and has no base class, a single construct signature with no parameters, having the same type parameters as the class (if any) and returning an instantiation of the class type with those type parameters passed as type arguments. +* If the class contains no constructor declaration and has a base class, a set of construct signatures with the same parameters as those of the base class constructor function type following substitution of type parameters with the type arguments specified in the base class type reference, all having the same type parameters as the class (if any) and returning an instantiation of the class type with those type parameters passed as type arguments. +* If the class contains a constructor declaration with no overloads, a construct signature with the parameter list of the constructor implementation, having the same type parameters as the class (if any) and returning an instantiation of the class type with those type parameters passed as type arguments. +* If the class contains a constructor declaration with overloads, a set of construct signatures with the parameter lists of the overloads, all having the same type parameters as the class (if any) and returning an instantiation of the class type with those type parameters passed as type arguments. * A property for each static member variable declaration in the class body. * A property of a function type for each static member function declaration in the class body. * A property for each uniquely named static member accessor declaration in the class body. @@ -4428,7 +4514,7 @@ var TwoArrays: { } ``` -Note that the construct signatures in the constructor function types have the same type parameters as their class and return the instance type of their class. Also note that when a derived class doesn't declare a constructor, type arguments from the base class reference are substituted before construct signatures are propagated from the base constructor function type to the derived constructor function type. +Note that each construct signature in the constructor function types has the same type parameters as its class and returns an instantiation of its class with those type parameters passed as type arguments. Also note that when a derived class doesn't declare a constructor, type arguments from the base class reference are substituted before construct signatures are propagated from the base constructor function type to the derived constructor function type. ## 8.3 Constructor Declarations @@ -4446,7 +4532,7 @@ When a class has constructor overloads, the overloads determine the construct si When a class has both constructor overloads and a constructor implementation, the overloads must precede the implementation and all of the declarations must be consecutive with no intervening grammatical elements. -The function body of a constructor is permitted to contain return statements. If return statements specify expressions, those expressions must be of types that are assignable to the instance type of the class. +The function body of a constructor is permitted to contain return statements. If return statements specify expressions, those expressions must be of types that are assignable to the this-type (section [3.6.3](#3.6.3)) of the class. The type parameters of a generic class are in scope and accessible in a constructor declaration. @@ -4478,6 +4564,8 @@ class Point { } ``` +A parameter property declaration may declare an optional parameter (by including a question mark or a default value), but the property introduced by such a declaration is always considered a required property (section [3.3.6](#3.3.6)). + ### 8.3.2 Super Calls Super calls (section [4.9.1](#4.9.1)) are used to call the constructor of the base class. A super call consists of the keyword `super` followed by an argument list enclosed in parentheses. For example: @@ -4524,7 +4612,7 @@ Property member declarations can be member variable declarations, member functio    *MemberFunctionDeclaration*    *MemberAccessorDeclaration* -Member declarations without a `static` modifier are called instance member declarations. Instance property member declarations declare properties in the class instance type (section [8.2.4](#8.2.4)), and must specify names that are unique among all instance property member and parameter property declarations in the containing class, with the exception that instance get and set accessor declarations may pairwise specify the same name. +Member declarations without a `static` modifier are called instance member declarations. Instance property member declarations declare properties in the class type (section [8.2.4](#8.2.4)), and must specify names that are unique among all instance property member and parameter property declarations in the containing class, with the exception that instance get and set accessor declarations may pairwise specify the same name. Member declarations with a `static` modifier are called static member declarations. Static property member declarations declare properties in the constructor function type (section [8.2.5](#8.2.5)), and must specify names that are unique among all static property member declarations in the containing class, with the exception that static get and set accessor declarations may pairwise specify the same name. @@ -4549,7 +4637,7 @@ class Point { } ``` -The class instance type 'Point' has the members: +The class type 'Point' has the members: ```TypeScript interface Point { @@ -4578,7 +4666,7 @@ A member variable declaration declares an instance member variable or a static m The type associated with a member variable declaration is determined in the same manner as an ordinary variable declaration (see section [5.2](#5.2)). -An instance member variable declaration introduces a member in the class instance type and optionally initializes a property on instances of the class. Initializers in instance member variable declarations are executed once for every new instance of the class and are equivalent to assignments to properties of `this` in the constructor. In an initializer expression for an instance member variable, `this` is of the class instance type. +An instance member variable declaration introduces a member in the class type and optionally initializes a property on instances of the class. Initializers in instance member variable declarations are executed once for every new instance of the class and are equivalent to assignments to properties of `this` in the constructor. In an initializer expression for an instance member variable, `this` is of the this-type (section [3.6.3](#3.6.3)) of the class. A static member variable declaration introduces a property in the constructor function type and optionally initializes a property on the constructor function object. Initializers in static member variable declarations are executed once when the containing script or module is loaded. @@ -4625,7 +4713,7 @@ A member function declaration is processed in the same manner as an ordinary fun All declarations for the same member function must specify the same accessibility (public, private, or protected) and kind (instance or static). -An instance member function declaration declares a property in the class instance type and assigns a function object to a property on the prototype object of the class. In the body of an instance member function declaration, `this` is of the class instance type. +An instance member function declaration declares a property in the class type and assigns a function object to a property on the prototype object of the class. In the body of an instance member function declaration, `this` is of the this-type (section [3.6.3](#3.6.3)) of the class. A static member function declaration declares a property in the constructor function type and assigns a function object to a property on the constructor function object. In the body of a static member function declaration, the type of `this` is the constructor function type. @@ -4691,23 +4779,23 @@ Get and set accessors are processed in the same manner as in an object literal ( Accessors for the same member name must specify the same accessibility. -An instance member accessor declaration declares a property in the class instance type and defines a property on the prototype object of the class with a get or set accessor. In the body of an instance member accessor declaration, `this` is of the class instance type. +An instance member accessor declaration declares a property in the class type and defines a property on the prototype object of the class with a get or set accessor. In the body of an instance member accessor declaration, `this` is of the this-type (section [3.6.3](#3.6.3)) of the class. A static member accessor declaration declares a property in the constructor function type and defines a property on the constructor function object of the class with a get or set accessor. In the body of a static member accessor declaration, the type of `this` is the constructor function type. -Get and set accessors are emitted as calls to 'Object.defineProperty' in the generated JavaScript, as described in section [8.6.1](#8.6.1). +Get and set accessors are emitted as calls to 'Object.defineProperty' in the generated JavaScript, as described in section [8.7.1](#8.7.1). ### 8.4.4 Dynamic Property Declarations If the *PropertyName* of a property member declaration is a computed property name that doesn't denote a well-known symbol ([2.2.3](#2.2.3)), the construct is considered a ***dynamic property declaration***. The following rules apply to dynamic property declarations: -* A dynamic property declaration does not introduce a property in the class instance type or constructor function type. +* A dynamic property declaration does not introduce a property in the class type or constructor function type. * The property name expression of a dynamic property assignment must be of type Any or the String, Number, or Symbol primitive type. * The name associated with a dynamic property declarations is considered to be a numeric property name if the property name expression is of type Any or the Number primitive type. ## 8.5 Index Member Declarations -An index member declaration introduces an index signature (section [3.9.4](#3.9.4)) in the class instance type. +An index member declaration introduces an index signature (section [3.9.4](#3.9.4)) in the class type.   *IndexMemberDeclaration:*    *IndexSignature* `;` @@ -4720,11 +4808,15 @@ It is not possible to declare index members for the static side of a class. Note that it is seldom meaningful to include a string index signature in a class because it constrains all instance properties of the class. However, numeric index signatures can be useful to control the element type when a class is used in an array-like manner. -## 8.6 Code Generation +## 8.6 Decorators -When the output target is ECMAScript 6 or higher, type parameters, implements clauses, accessibility modifiers, and member variable declarations are removed in the emitted code, but otherwise class declarations are emitted as written. When the output target is ECMAScript 3 or 5, more comprehensive rewrites are performed, as described in this section. +*TODO: Document [decorators](https://github.com/Microsoft/TypeScript/issues/2249)*. -### 8.6.1 Classes Without Extends Clauses +## 8.7 Code Generation + +When the output target is ECMAScript 2015 or higher, type parameters, implements clauses, accessibility modifiers, and member variable declarations are removed in the emitted code, but otherwise class declarations are emitted as written. When the output target is ECMAScript 3 or 5, more comprehensive rewrites are performed, as described in this section. + +### 8.7.1 Classes Without Extends Clauses A class with no `extends` clause generates JavaScript equivalent to the following: @@ -4828,7 +4920,7 @@ where *MemberName* is the name of the member accessor, *GetAccessorStatements* i where *MemberName* is the name of the static variable, and *InitializerExpression* is the code generated for the initializer expression. -### 8.6.2 Classes With Extends Clauses +### 8.7.2 Classes With Extends Clauses A class with an `extends` clause generates JavaScript equivalent to the following: @@ -5396,7 +5488,7 @@ This copies a reference to the entity into a property on the namespace instance. # 11 Scripts and Modules -TypeScript implements support for ECMAScript 6 modules and supports down-level code generation targeting CommonJS, AMD, and other module systems. +TypeScript implements support for ECMAScript 2015 modules and supports down-level code generation targeting CommonJS, AMD, and other module systems. ## 11.1 Programs and Source Files @@ -5424,7 +5516,7 @@ When a TypeScript program is compiled, all of the program's source files are pro The TypeScript compiler automatically determines a source file's dependencies and includes those dependencies in the program being compiled. The determination is made from "reference comments" and module import declarations as follows: -* A comment of the form /// <reference path="…"/> adds a dependency on the source file specified in the path argument. The path is resolved relative to the directory of the containing source file. +* A comment of the form /// <reference path="…"/> that occurs before the first token in a source file adds a dependency on the source file specified in the path argument. The path is resolved relative to the directory of the containing source file. * A module import declaration that specifies a relative module name (section [11.3.1](#11.3.1)) resolves the name relative to the directory of the containing source file. If a source file with the resulting path and file extension '.ts' exists, that file is added as a dependency. Otherwise, if a source file with the resulting path and file extension '.d.ts' exists, that file is added as a dependency. * A module import declaration that specifies a top-level module name (section [11.3.1](#11.3.1)) resolves the name in a host dependent manner (typically by resolving the name relative to a module name space root or searching for the name in a series of directories). If a source file with extension '.ts' or '.d.ts' corresponding to the reference is located, that file is added as a dependency. @@ -5539,7 +5631,7 @@ TypeScript supports multiple patterns of JavaScript code generation for modules: * CommonJS. This format is used by server frameworks such as node.js. * AMD (Asynchronous Module Definition). This format is used by asynchronous module loaders such as RequireJS. * UMD (Universal Module Definition). A variation of the AMD format that allows modules to also be loaded by CommonJS loaders. -* System. This format is used to represent ECMAScript 6 semantics with high fidelity in down-level environments. +* System. This format is used to represent ECMAScript 2015 semantics with high fidelity in down-level environments. The desired module code generation pattern is selected through a compiler option and does not affect the TypeScript source code. Indeed, it is possible to author modules that can be compiled for use both on the server side (e.g. using node.js) and on the client side (using an AMD compliant loader) with no changes to the TypeScript source code. @@ -5620,7 +5712,7 @@ An import require declaration of the form import m = require("mod"); ``` -is equivalent to the ECMAScript 6 import declaration +is equivalent to the ECMAScript 2015 import declaration ```TypeScript import * as m from "mod"; @@ -5828,16 +5920,17 @@ The 'main' and 'log' example from section [11.3](#11.3) above generates the foll File main.js: ```TypeScript -var log = require("./log"); -log.message("hello"); +var log_1 = require("./log"); +log_1.message("hello"); ``` File log.js: ```TypeScript -exports.message = function(s) { +function message(s) { console.log(s); -} +} +exports.message = message; ``` A module import declaration is represented in the generated JavaScript as a variable initialized by a call to the 'require' function provided by the module system host. A variable declaration and 'require' call is emitted for a particular imported module only if the imported module, or a local alias (section [10.3](#10.3)) that references the imported module, is referenced as a *PrimaryExpression* somewhere in the body of the importing module. If an imported module is referenced only as a *NamespaceName* or *TypeQueryExpression*, nothing is emitted. @@ -5850,15 +5943,15 @@ File geometry.ts: export interface Point { x: number; y: number }; export function point(x: number, y: number): Point { - return { x: x, y: y }; + return { x, y }; } ``` File game.ts: ```TypeScript -import g = require("./geometry"); -var p = g.point(10, 20); +import * as g from "./geometry"; +let p = g.point(10, 20); ``` The 'game' module references the imported 'geometry' module in an expression (through its alias 'g') and a 'require' call is therefore included in the emitted JavaScript: @@ -5871,8 +5964,8 @@ var p = g.point(10, 20); Had the 'game' module instead been written to only reference 'geometry' in a type position ```TypeScript -import g = require("./geometry"); -var p: g.Point = { x: 10, y: 20 }; +import * as g from "./geometry"; +let p: g.Point = { x: 10, y: 20 }; ``` the emitted JavaScript would have no dependency on the 'geometry' module and would simply be @@ -5890,8 +5983,8 @@ The "main" and "log" example from above generates the following JavaScript code File main.js: ```TypeScript -define(["require", "exports", "./log"], function(require, exports, log) { - log.message("hello"); +define(["require", "exports", "./log"], function(require, exports, log_1) { + log_1.message("hello"); } ``` @@ -5899,9 +5992,10 @@ File log.js: ```TypeScript define(["require", "exports"], function(require, exports) { - exports.message = function(s) { + function message(s) { console.log(s); } + exports.message = message; } ``` @@ -5957,7 +6051,7 @@ Ambient function declarations cannot specify a function bodies and do not permit ### 12.1.3 Ambient Class Declarations -An ambient class declaration declares a class instance type and a constructor function in the containing declaration space. +An ambient class declaration declares a class type and a constructor function in the containing declaration space.   *AmbientClassDeclaration:*    `class` *BindingIdentifier* *TypeParametersopt* *ClassHeritage* `{` *AmbientClassBody* `}` @@ -6057,7 +6151,7 @@ declare module "io" { # A Grammar -This appendix contains a summary of the grammar found in the main document. As described in section [2.1](#2.1), the TypeScript grammar is a superset of the grammar defined in the [ECMAScript Language Specification](http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf) (specifically, the ECMA-262 Standard, 6th Edition) and this appendix lists only productions that are new or modified from the ECMAScript grammar. +This appendix contains a summary of the grammar found in the main document. As described in section [2.1](#2.1), the TypeScript grammar is a superset of the grammar defined in the [ECMAScript 2015 Language Specification](http://www.ecma-international.org/ecma-262/6.0/) (specifically, the ECMA-262 Standard, 6th Edition) and this appendix lists only productions that are new or modified from the ECMAScript grammar. ## A.1 Types @@ -6104,7 +6198,8 @@ This appendix contains a summary of the grammar found in the main document. As d    *ObjectType*    *ArrayType*    *TupleType* -   *TypeQuery* +   *TypeQuery* +   *ThisType*   *ParenthesizedType:*    `(` *Type* `)` @@ -6179,6 +6274,9 @@ This appendix contains a summary of the grammar found in the main document. As d    *IdentifierReference*    *TypeQueryExpression* `.` *IdentifierName* +  *ThisType:* +   `this` +   *PropertySignature:*    *PropertyName* `?`*opt* *TypeAnnotationopt* diff --git a/doc/wiki/README.md b/doc/wiki/README.md new file mode 100644 index 00000000000..19961197840 --- /dev/null +++ b/doc/wiki/README.md @@ -0,0 +1,6 @@ +# The TypeScript Wiki + +To read the wiki, [visit the wiki on GitHub](https://github.com/Microsoft/TypeScript/wiki). + +To contribute by filing an issue or sending a pull request, [visit the wiki repository](https://github.com/Microsoft/TypeScript-wiki). + diff --git a/issue_template.md b/issue_template.md new file mode 100644 index 00000000000..dcd2280570c --- /dev/null +++ b/issue_template.md @@ -0,0 +1,27 @@ + + +**TypeScript Version:** + +1.7.5 / 1.8.0-beta / nightly (1.9.0-dev.20160217) + +**Code** + +```ts +// A self-contained demonstration of the problem follows... + +``` + +**Expected behavior:** + +**Actual behavior:** diff --git a/lib/README.md b/lib/README.md index 583ddf91156..852d449f1e5 100644 --- a/lib/README.md +++ b/lib/README.md @@ -1,4 +1,5 @@ -# Read this! +# Read This! -These files are not meant to be edited by hand. -If you need to make modifications, the respective files should be changed within the repository's top-level `src` directory. Running `jake LKG` will then appropriately update the files in this directory. +**These files are not meant to be edited by hand.** +If you need to make modifications, the respective files should be changed within the repository's top-level `src` directory. +Running `jake LKG` will then appropriately update the files in this directory. diff --git a/lib/lib.core.es6.d.ts b/lib/lib.core.es6.d.ts deleted file mode 100644 index 857f5957a45..00000000000 --- a/lib/lib.core.es6.d.ts +++ /dev/null @@ -1,5155 +0,0 @@ -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. All rights reserved. -Licensed under the Apache License, Version 2.0 (the "License"); you may not use -this file except in compliance with the License. You may obtain a copy of the -License at http://www.apache.org/licenses/LICENSE-2.0 - -THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED -WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, -MERCHANTABLITY OR NON-INFRINGEMENT. - -See the Apache Version 2.0 License for specific language governing permissions -and limitations under the License. -***************************************************************************** */ - -/// - -///////////////////////////// -/// ECMAScript APIs -///////////////////////////// - -declare var NaN: number; -declare var Infinity: number; - -/** - * Evaluates JavaScript code and executes it. - * @param x A String value that contains valid JavaScript code. - */ -declare function eval(x: string): any; - -/** - * Converts A string to an integer. - * @param s A string to convert into a number. - * @param radix A value between 2 and 36 that specifies the base of the number in numString. - * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. - * All other strings are considered decimal. - */ -declare function parseInt(s: string, radix?: number): number; - -/** - * Converts a string to a floating-point number. - * @param string A string that contains a floating-point number. - */ -declare function parseFloat(string: string): number; - -/** - * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a number). - * @param number A numeric value. - */ -declare function isNaN(number: number): boolean; - -/** - * Determines whether a supplied number is finite. - * @param number Any numeric value. - */ -declare function isFinite(number: number): boolean; - -/** - * Gets the unencoded version of an encoded Uniform Resource Identifier (URI). - * @param encodedURI A value representing an encoded URI. - */ -declare function decodeURI(encodedURI: string): string; - -/** - * Gets the unencoded version of an encoded component of a Uniform Resource Identifier (URI). - * @param encodedURIComponent A value representing an encoded URI component. - */ -declare function decodeURIComponent(encodedURIComponent: string): string; - -/** - * Encodes a text string as a valid Uniform Resource Identifier (URI) - * @param uri A value representing an encoded URI. - */ -declare function encodeURI(uri: string): string; - -/** - * Encodes a text string as a valid component of a Uniform Resource Identifier (URI). - * @param uriComponent A value representing an encoded URI component. - */ -declare function encodeURIComponent(uriComponent: string): string; - -interface PropertyDescriptor { - configurable?: boolean; - enumerable?: boolean; - value?: any; - writable?: boolean; - get? (): any; - set? (v: any): void; -} - -interface PropertyDescriptorMap { - [s: string]: PropertyDescriptor; -} - -interface Object { - /** The initial value of Object.prototype.constructor is the standard built-in Object constructor. */ - constructor: Function; - - /** Returns a string representation of an object. */ - toString(): string; - - /** Returns a date converted to a string using the current locale. */ - toLocaleString(): string; - - /** Returns the primitive value of the specified object. */ - valueOf(): Object; - - /** - * Determines whether an object has a property with the specified name. - * @param v A property name. - */ - hasOwnProperty(v: string): boolean; - - /** - * Determines whether an object exists in another object's prototype chain. - * @param v Another object whose prototype chain is to be checked. - */ - isPrototypeOf(v: Object): boolean; - - /** - * Determines whether a specified property is enumerable. - * @param v A property name. - */ - propertyIsEnumerable(v: string): boolean; -} - -interface ObjectConstructor { - new (value?: any): Object; - (): any; - (value: any): any; - - /** A reference to the prototype for a class of objects. */ - prototype: Object; - - /** - * Returns the prototype of an object. - * @param o The object that references the prototype. - */ - getPrototypeOf(o: any): any; - - /** - * Gets the own property descriptor of the specified object. - * An own property descriptor is one that is defined directly on the object and is not inherited from the object's prototype. - * @param o Object that contains the property. - * @param p Name of the property. - */ - getOwnPropertyDescriptor(o: any, p: string): PropertyDescriptor; - - /** - * Returns the names of the own properties of an object. The own properties of an object are those that are defined directly - * on that object, and are not inherited from the object's prototype. The properties of an object include both fields (objects) and functions. - * @param o Object that contains the own properties. - */ - getOwnPropertyNames(o: any): string[]; - - /** - * Creates an object that has the specified prototype, and that optionally contains specified properties. - * @param o Object to use as a prototype. May be null - * @param properties JavaScript object that contains one or more property descriptors. - */ - create(o: any, properties?: PropertyDescriptorMap): any; - - /** - * Adds a property to an object, or modifies attributes of an existing property. - * @param o Object on which to add or modify the property. This can be a native JavaScript object (that is, a user-defined object or a built in object) or a DOM object. - * @param p The property name. - * @param attributes Descriptor for the property. It can be for a data property or an accessor property. - */ - defineProperty(o: any, p: string, attributes: PropertyDescriptor): any; - - /** - * Adds one or more properties to an object, and/or modifies attributes of existing properties. - * @param o Object on which to add or modify the properties. This can be a native JavaScript object or a DOM object. - * @param properties JavaScript object that contains one or more descriptor objects. Each descriptor object describes a data property or an accessor property. - */ - defineProperties(o: any, properties: PropertyDescriptorMap): any; - - /** - * Prevents the modification of attributes of existing properties, and prevents the addition of new properties. - * @param o Object on which to lock the attributes. - */ - seal(o: T): T; - - /** - * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. - * @param o Object on which to lock the attributes. - */ - freeze(o: T): T; - - /** - * Prevents the addition of new properties to an object. - * @param o Object to make non-extensible. - */ - preventExtensions(o: T): T; - - /** - * Returns true if existing property attributes cannot be modified in an object and new properties cannot be added to the object. - * @param o Object to test. - */ - isSealed(o: any): boolean; - - /** - * Returns true if existing property attributes and values cannot be modified in an object, and new properties cannot be added to the object. - * @param o Object to test. - */ - isFrozen(o: any): boolean; - - /** - * Returns a value that indicates whether new properties can be added to an object. - * @param o Object to test. - */ - isExtensible(o: any): boolean; - - /** - * Returns the names of the enumerable properties and methods of an object. - * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. - */ - keys(o: any): string[]; -} - -/** - * Provides functionality common to all JavaScript objects. - */ -declare var Object: ObjectConstructor; - -/** - * Creates a new function. - */ -interface Function { - /** - * Calls the function, substituting the specified object for the this value of the function, and the specified array for the arguments of the function. - * @param thisArg The object to be used as the this object. - * @param argArray A set of arguments to be passed to the function. - */ - apply(thisArg: any, argArray?: any): any; - - /** - * Calls a method of an object, substituting another object for the current object. - * @param thisArg The object to be used as the current object. - * @param argArray A list of arguments to be passed to the method. - */ - call(thisArg: any, ...argArray: any[]): any; - - /** - * For a given function, creates a bound function that has the same body as the original function. - * The this object of the bound function is associated with the specified object, and has the specified initial parameters. - * @param thisArg An object to which the this keyword can refer inside the new function. - * @param argArray A list of arguments to be passed to the new function. - */ - bind(thisArg: any, ...argArray: any[]): any; - - prototype: any; - length: number; - - // Non-standard extensions - arguments: any; - caller: Function; -} - -interface FunctionConstructor { - /** - * Creates a new function. - * @param args A list of arguments the function accepts. - */ - new (...args: string[]): Function; - (...args: string[]): Function; - prototype: Function; -} - -declare var Function: FunctionConstructor; - -interface IArguments { - [index: number]: any; - length: number; - callee: Function; -} - -interface String { - /** Returns a string representation of a string. */ - toString(): string; - - /** - * Returns the character at the specified index. - * @param pos The zero-based index of the desired character. - */ - charAt(pos: number): string; - - /** - * Returns the Unicode value of the character at the specified location. - * @param index The zero-based index of the desired character. If there is no character at the specified index, NaN is returned. - */ - charCodeAt(index: number): number; - - /** - * Returns a string that contains the concatenation of two or more strings. - * @param strings The strings to append to the end of the string. - */ - concat(...strings: string[]): string; - - /** - * Returns the position of the first occurrence of a substring. - * @param searchString The substring to search for in the string - * @param position The index at which to begin searching the String object. If omitted, search starts at the beginning of the string. - */ - indexOf(searchString: string, position?: number): number; - - /** - * Returns the last occurrence of a substring in the string. - * @param searchString The substring to search for. - * @param position The index at which to begin searching. If omitted, the search begins at the end of the string. - */ - lastIndexOf(searchString: string, position?: number): number; - - /** - * Determines whether two strings are equivalent in the current locale. - * @param that String to compare to target string - */ - localeCompare(that: string): number; - - /** - * Matches a string with a regular expression, and returns an array containing the results of that search. - * @param regexp A variable name or string literal containing the regular expression pattern and flags. - */ - match(regexp: string): RegExpMatchArray; - - /** - * Matches a string with a regular expression, and returns an array containing the results of that search. - * @param regexp A regular expression object that contains the regular expression pattern and applicable flags. - */ - match(regexp: RegExp): RegExpMatchArray; - - /** - * Replaces text in a string, using a regular expression or search string. - * @param searchValue A string that represents the regular expression. - * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. - */ - replace(searchValue: string, replaceValue: string): string; - - /** - * Replaces text in a string, using a regular expression or search string. - * @param searchValue A string that represents the regular expression. - * @param replacer A function that returns the replacement text. - */ - replace(searchValue: string, replacer: (substring: string, ...args: any[]) => string): string; - - /** - * Replaces text in a string, using a regular expression or search string. - * @param searchValue A Regular Expression object containing the regular expression pattern and applicable flags. - * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. - */ - replace(searchValue: RegExp, replaceValue: string): string; - - /** - * Replaces text in a string, using a regular expression or search string. - * @param searchValue A Regular Expression object containing the regular expression pattern and applicable flags - * @param replacer A function that returns the replacement text. - */ - replace(searchValue: RegExp, replacer: (substring: string, ...args: any[]) => string): string; - - /** - * Finds the first substring match in a regular expression search. - * @param regexp The regular expression pattern and applicable flags. - */ - search(regexp: string): number; - - /** - * Finds the first substring match in a regular expression search. - * @param regexp The regular expression pattern and applicable flags. - */ - search(regexp: RegExp): number; - - /** - * Returns a section of a string. - * @param start The index to the beginning of the specified portion of stringObj. - * @param end The index to the end of the specified portion of stringObj. The substring includes the characters up to, but not including, the character indicated by end. - * If this value is not specified, the substring continues to the end of stringObj. - */ - slice(start?: number, end?: number): string; - - /** - * Split a string into substrings using the specified separator and return them as an array. - * @param separator A string that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. - * @param limit A value used to limit the number of elements returned in the array. - */ - split(separator: string, limit?: number): string[]; - - /** - * Split a string into substrings using the specified separator and return them as an array. - * @param separator A Regular Express that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. - * @param limit A value used to limit the number of elements returned in the array. - */ - split(separator: RegExp, limit?: number): string[]; - - /** - * Returns the substring at the specified location within a String object. - * @param start The zero-based index number indicating the beginning of the substring. - * @param end Zero-based index number indicating the end of the substring. The substring includes the characters up to, but not including, the character indicated by end. - * If end is omitted, the characters from start through the end of the original string are returned. - */ - substring(start: number, end?: number): string; - - /** Converts all the alphabetic characters in a string to lowercase. */ - toLowerCase(): string; - - /** Converts all alphabetic characters to lowercase, taking into account the host environment's current locale. */ - toLocaleLowerCase(): string; - - /** Converts all the alphabetic characters in a string to uppercase. */ - toUpperCase(): string; - - /** Returns a string where all alphabetic characters have been converted to uppercase, taking into account the host environment's current locale. */ - toLocaleUpperCase(): string; - - /** Removes the leading and trailing white space and line terminator characters from a string. */ - trim(): string; - - /** Returns the length of a String object. */ - length: number; - - // IE extensions - /** - * Gets a substring beginning at the specified location and having the specified length. - * @param from The starting position of the desired substring. The index of the first character in the string is zero. - * @param length The number of characters to include in the returned substring. - */ - substr(from: number, length?: number): string; - - /** Returns the primitive value of the specified object. */ - valueOf(): string; - - [index: number]: string; -} - -interface StringConstructor { - new (value?: any): String; - (value?: any): string; - prototype: String; - fromCharCode(...codes: number[]): string; -} - -/** - * Allows manipulation and formatting of text strings and determination and location of substrings within strings. - */ -declare var String: StringConstructor; - -interface Boolean { - /** Returns the primitive value of the specified object. */ - valueOf(): boolean; -} - -interface BooleanConstructor { - new (value?: any): Boolean; - (value?: any): boolean; - prototype: Boolean; -} - -declare var Boolean: BooleanConstructor; - -interface Number { - /** - * Returns a string representation of an object. - * @param radix Specifies a radix for converting numeric values to strings. This value is only used for numbers. - */ - toString(radix?: number): string; - - /** - * Returns a string representing a number in fixed-point notation. - * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive. - */ - toFixed(fractionDigits?: number): string; - - /** - * Returns a string containing a number represented in exponential notation. - * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive. - */ - toExponential(fractionDigits?: number): string; - - /** - * Returns a string containing a number represented either in exponential or fixed-point notation with a specified number of digits. - * @param precision Number of significant digits. Must be in the range 1 - 21, inclusive. - */ - toPrecision(precision?: number): string; - - /** Returns the primitive value of the specified object. */ - valueOf(): number; -} - -interface NumberConstructor { - new (value?: any): Number; - (value?: any): number; - prototype: Number; - - /** The largest number that can be represented in JavaScript. Equal to approximately 1.79E+308. */ - MAX_VALUE: number; - - /** The closest number to zero that can be represented in JavaScript. Equal to approximately 5.00E-324. */ - MIN_VALUE: number; - - /** - * A value that is not a number. - * In equality comparisons, NaN does not equal any value, including itself. To test whether a value is equivalent to NaN, use the isNaN function. - */ - NaN: number; - - /** - * A value that is less than the largest negative number that can be represented in JavaScript. - * JavaScript displays NEGATIVE_INFINITY values as -infinity. - */ - NEGATIVE_INFINITY: number; - - /** - * A value greater than the largest number that can be represented in JavaScript. - * JavaScript displays POSITIVE_INFINITY values as infinity. - */ - POSITIVE_INFINITY: number; -} - -/** An object that represents a number of any kind. All JavaScript numbers are 64-bit floating-point numbers. */ -declare var Number: NumberConstructor; - -interface TemplateStringsArray extends Array { - raw: string[]; -} - -interface Math { - /** The mathematical constant e. This is Euler's number, the base of natural logarithms. */ - E: number; - /** The natural logarithm of 10. */ - LN10: number; - /** The natural logarithm of 2. */ - LN2: number; - /** The base-2 logarithm of e. */ - LOG2E: number; - /** The base-10 logarithm of e. */ - LOG10E: number; - /** Pi. This is the ratio of the circumference of a circle to its diameter. */ - PI: number; - /** The square root of 0.5, or, equivalently, one divided by the square root of 2. */ - SQRT1_2: number; - /** The square root of 2. */ - SQRT2: number; - /** - * Returns the absolute value of a number (the value without regard to whether it is positive or negative). - * For example, the absolute value of -5 is the same as the absolute value of 5. - * @param x A numeric expression for which the absolute value is needed. - */ - abs(x: number): number; - /** - * Returns the arc cosine (or inverse cosine) of a number. - * @param x A numeric expression. - */ - acos(x: number): number; - /** - * Returns the arcsine of a number. - * @param x A numeric expression. - */ - asin(x: number): number; - /** - * Returns the arctangent of a number. - * @param x A numeric expression for which the arctangent is needed. - */ - atan(x: number): number; - /** - * Returns the angle (in radians) from the X axis to a point. - * @param y A numeric expression representing the cartesian y-coordinate. - * @param x A numeric expression representing the cartesian x-coordinate. - */ - atan2(y: number, x: number): number; - /** - * Returns the smallest number greater than or equal to its numeric argument. - * @param x A numeric expression. - */ - ceil(x: number): number; - /** - * Returns the cosine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - cos(x: number): number; - /** - * Returns e (the base of natural logarithms) raised to a power. - * @param x A numeric expression representing the power of e. - */ - exp(x: number): number; - /** - * Returns the greatest number less than or equal to its numeric argument. - * @param x A numeric expression. - */ - floor(x: number): number; - /** - * Returns the natural logarithm (base e) of a number. - * @param x A numeric expression. - */ - log(x: number): number; - /** - * Returns the larger of a set of supplied numeric expressions. - * @param values Numeric expressions to be evaluated. - */ - max(...values: number[]): number; - /** - * Returns the smaller of a set of supplied numeric expressions. - * @param values Numeric expressions to be evaluated. - */ - min(...values: number[]): number; - /** - * Returns the value of a base expression taken to a specified power. - * @param x The base value of the expression. - * @param y The exponent value of the expression. - */ - pow(x: number, y: number): number; - /** Returns a pseudorandom number between 0 and 1. */ - random(): number; - /** - * Returns a supplied numeric expression rounded to the nearest number. - * @param x The value to be rounded to the nearest number. - */ - round(x: number): number; - /** - * Returns the sine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - sin(x: number): number; - /** - * Returns the square root of a number. - * @param x A numeric expression. - */ - sqrt(x: number): number; - /** - * Returns the tangent of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - tan(x: number): number; -} -/** An intrinsic object that provides basic mathematics functionality and constants. */ -declare var Math: Math; - -/** Enables basic storage and retrieval of dates and times. */ -interface Date { - /** Returns a string representation of a date. The format of the string depends on the locale. */ - toString(): string; - /** Returns a date as a string value. */ - toDateString(): string; - /** Returns a time as a string value. */ - toTimeString(): string; - /** Returns a value as a string value appropriate to the host environment's current locale. */ - toLocaleString(): string; - /** Returns a date as a string value appropriate to the host environment's current locale. */ - toLocaleDateString(): string; - /** Returns a time as a string value appropriate to the host environment's current locale. */ - toLocaleTimeString(): string; - /** Returns the stored time value in milliseconds since midnight, January 1, 1970 UTC. */ - valueOf(): number; - /** Gets the time value in milliseconds. */ - getTime(): number; - /** Gets the year, using local time. */ - getFullYear(): number; - /** Gets the year using Universal Coordinated Time (UTC). */ - getUTCFullYear(): number; - /** Gets the month, using local time. */ - getMonth(): number; - /** Gets the month of a Date object using Universal Coordinated Time (UTC). */ - getUTCMonth(): number; - /** Gets the day-of-the-month, using local time. */ - getDate(): number; - /** Gets the day-of-the-month, using Universal Coordinated Time (UTC). */ - getUTCDate(): number; - /** Gets the day of the week, using local time. */ - getDay(): number; - /** Gets the day of the week using Universal Coordinated Time (UTC). */ - getUTCDay(): number; - /** Gets the hours in a date, using local time. */ - getHours(): number; - /** Gets the hours value in a Date object using Universal Coordinated Time (UTC). */ - getUTCHours(): number; - /** Gets the minutes of a Date object, using local time. */ - getMinutes(): number; - /** Gets the minutes of a Date object using Universal Coordinated Time (UTC). */ - getUTCMinutes(): number; - /** Gets the seconds of a Date object, using local time. */ - getSeconds(): number; - /** Gets the seconds of a Date object using Universal Coordinated Time (UTC). */ - getUTCSeconds(): number; - /** Gets the milliseconds of a Date, using local time. */ - getMilliseconds(): number; - /** Gets the milliseconds of a Date object using Universal Coordinated Time (UTC). */ - getUTCMilliseconds(): number; - /** Gets the difference in minutes between the time on the local computer and Universal Coordinated Time (UTC). */ - getTimezoneOffset(): number; - /** - * Sets the date and time value in the Date object. - * @param time A numeric value representing the number of elapsed milliseconds since midnight, January 1, 1970 GMT. - */ - setTime(time: number): number; - /** - * Sets the milliseconds value in the Date object using local time. - * @param ms A numeric value equal to the millisecond value. - */ - setMilliseconds(ms: number): number; - /** - * Sets the milliseconds value in the Date object using Universal Coordinated Time (UTC). - * @param ms A numeric value equal to the millisecond value. - */ - setUTCMilliseconds(ms: number): number; - - /** - * Sets the seconds value in the Date object using local time. - * @param sec A numeric value equal to the seconds value. - * @param ms A numeric value equal to the milliseconds value. - */ - setSeconds(sec: number, ms?: number): number; - /** - * Sets the seconds value in the Date object using Universal Coordinated Time (UTC). - * @param sec A numeric value equal to the seconds value. - * @param ms A numeric value equal to the milliseconds value. - */ - setUTCSeconds(sec: number, ms?: number): number; - /** - * Sets the minutes value in the Date object using local time. - * @param min A numeric value equal to the minutes value. - * @param sec A numeric value equal to the seconds value. - * @param ms A numeric value equal to the milliseconds value. - */ - setMinutes(min: number, sec?: number, ms?: number): number; - /** - * Sets the minutes value in the Date object using Universal Coordinated Time (UTC). - * @param min A numeric value equal to the minutes value. - * @param sec A numeric value equal to the seconds value. - * @param ms A numeric value equal to the milliseconds value. - */ - setUTCMinutes(min: number, sec?: number, ms?: number): number; - /** - * Sets the hour value in the Date object using local time. - * @param hours A numeric value equal to the hours value. - * @param min A numeric value equal to the minutes value. - * @param sec A numeric value equal to the seconds value. - * @param ms A numeric value equal to the milliseconds value. - */ - setHours(hours: number, min?: number, sec?: number, ms?: number): number; - /** - * Sets the hours value in the Date object using Universal Coordinated Time (UTC). - * @param hours A numeric value equal to the hours value. - * @param min A numeric value equal to the minutes value. - * @param sec A numeric value equal to the seconds value. - * @param ms A numeric value equal to the milliseconds value. - */ - setUTCHours(hours: number, min?: number, sec?: number, ms?: number): number; - /** - * Sets the numeric day-of-the-month value of the Date object using local time. - * @param date A numeric value equal to the day of the month. - */ - setDate(date: number): number; - /** - * Sets the numeric day of the month in the Date object using Universal Coordinated Time (UTC). - * @param date A numeric value equal to the day of the month. - */ - setUTCDate(date: number): number; - /** - * Sets the month value in the Date object using local time. - * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. - * @param date A numeric value representing the day of the month. If this value is not supplied, the value from a call to the getDate method is used. - */ - setMonth(month: number, date?: number): number; - /** - * Sets the month value in the Date object using Universal Coordinated Time (UTC). - * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. - * @param date A numeric value representing the day of the month. If it is not supplied, the value from a call to the getUTCDate method is used. - */ - setUTCMonth(month: number, date?: number): number; - /** - * Sets the year of the Date object using local time. - * @param year A numeric value for the year. - * @param month A zero-based numeric value for the month (0 for January, 11 for December). Must be specified if numDate is specified. - * @param date A numeric value equal for the day of the month. - */ - setFullYear(year: number, month?: number, date?: number): number; - /** - * Sets the year value in the Date object using Universal Coordinated Time (UTC). - * @param year A numeric value equal to the year. - * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. Must be supplied if numDate is supplied. - * @param date A numeric value equal to the day of the month. - */ - setUTCFullYear(year: number, month?: number, date?: number): number; - /** Returns a date converted to a string using Universal Coordinated Time (UTC). */ - toUTCString(): string; - /** Returns a date as a string value in ISO format. */ - toISOString(): string; - /** Used by the JSON.stringify method to enable the transformation of an object's data for JavaScript Object Notation (JSON) serialization. */ - toJSON(key?: any): string; -} - -interface DateConstructor { - new (): Date; - new (value: number): Date; - new (value: string): Date; - new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; - (): string; - prototype: Date; - /** - * Parses a string containing a date, and returns the number of milliseconds between that date and midnight, January 1, 1970. - * @param s A date string - */ - parse(s: string): number; - /** - * Returns the number of milliseconds between midnight, January 1, 1970 Universal Coordinated Time (UTC) (or GMT) and the specified date. - * @param year The full year designation is required for cross-century date accuracy. If year is between 0 and 99 is used, then year is assumed to be 1900 + year. - * @param month The month as an number between 0 and 11 (January to December). - * @param date The date as an number between 1 and 31. - * @param hours Must be supplied if minutes is supplied. An number from 0 to 23 (midnight to 11pm) that specifies the hour. - * @param minutes Must be supplied if seconds is supplied. An number from 0 to 59 that specifies the minutes. - * @param seconds Must be supplied if milliseconds is supplied. An number from 0 to 59 that specifies the seconds. - * @param ms An number from 0 to 999 that specifies the milliseconds. - */ - UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; - now(): number; -} - -declare var Date: DateConstructor; - -interface RegExpMatchArray extends Array { - index?: number; - input?: string; -} - -interface RegExpExecArray extends Array { - index: number; - input: string; -} - -interface RegExp { - /** - * Executes a search on a string using a regular expression pattern, and returns an array containing the results of that search. - * @param string The String object or string literal on which to perform the search. - */ - exec(string: string): RegExpExecArray; - - /** - * Returns a Boolean value that indicates whether or not a pattern exists in a searched string. - * @param string String on which to perform the search. - */ - test(string: string): boolean; - - /** Returns a copy of the text of the regular expression pattern. Read-only. The regExp argument is a Regular expression object. It can be a variable name or a literal. */ - source: string; - - /** Returns a Boolean value indicating the state of the global flag (g) used with a regular expression. Default is false. Read-only. */ - global: boolean; - - /** Returns a Boolean value indicating the state of the ignoreCase flag (i) used with a regular expression. Default is false. Read-only. */ - ignoreCase: boolean; - - /** Returns a Boolean value indicating the state of the multiline flag (m) used with a regular expression. Default is false. Read-only. */ - multiline: boolean; - - lastIndex: number; - - // Non-standard extensions - compile(): RegExp; -} - -interface RegExpConstructor { - new (pattern: string, flags?: string): RegExp; - (pattern: string, flags?: string): RegExp; - prototype: RegExp; - - // Non-standard extensions - $1: string; - $2: string; - $3: string; - $4: string; - $5: string; - $6: string; - $7: string; - $8: string; - $9: string; - lastMatch: string; -} - -declare var RegExp: RegExpConstructor; - -interface Error { - name: string; - message: string; -} - -interface ErrorConstructor { - new (message?: string): Error; - (message?: string): Error; - prototype: Error; -} - -declare var Error: ErrorConstructor; - -interface EvalError extends Error { -} - -interface EvalErrorConstructor { - new (message?: string): EvalError; - (message?: string): EvalError; - prototype: EvalError; -} - -declare var EvalError: EvalErrorConstructor; - -interface RangeError extends Error { -} - -interface RangeErrorConstructor { - new (message?: string): RangeError; - (message?: string): RangeError; - prototype: RangeError; -} - -declare var RangeError: RangeErrorConstructor; - -interface ReferenceError extends Error { -} - -interface ReferenceErrorConstructor { - new (message?: string): ReferenceError; - (message?: string): ReferenceError; - prototype: ReferenceError; -} - -declare var ReferenceError: ReferenceErrorConstructor; - -interface SyntaxError extends Error { -} - -interface SyntaxErrorConstructor { - new (message?: string): SyntaxError; - (message?: string): SyntaxError; - prototype: SyntaxError; -} - -declare var SyntaxError: SyntaxErrorConstructor; - -interface TypeError extends Error { -} - -interface TypeErrorConstructor { - new (message?: string): TypeError; - (message?: string): TypeError; - prototype: TypeError; -} - -declare var TypeError: TypeErrorConstructor; - -interface URIError extends Error { -} - -interface URIErrorConstructor { - new (message?: string): URIError; - (message?: string): URIError; - prototype: URIError; -} - -declare var URIError: URIErrorConstructor; - -interface JSON { - /** - * Converts a JavaScript Object Notation (JSON) string into an object. - * @param text A valid JSON string. - * @param reviver A function that transforms the results. This function is called for each member of the object. - * If a member contains nested objects, the nested objects are transformed before the parent object is. - */ - parse(text: string, reviver?: (key: any, value: any) => any): any; - /** - * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. - * @param value A JavaScript value, usually an object or array, to be converted. - */ - stringify(value: any): string; - /** - * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. - * @param value A JavaScript value, usually an object or array, to be converted. - * @param replacer A function that transforms the results. - */ - stringify(value: any, replacer: (key: string, value: any) => any): string; - /** - * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. - * @param value A JavaScript value, usually an object or array, to be converted. - * @param replacer Array that transforms the results. - */ - stringify(value: any, replacer: any[]): string; - /** - * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. - * @param value A JavaScript value, usually an object or array, to be converted. - * @param replacer A function that transforms the results. - * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. - */ - stringify(value: any, replacer: (key: string, value: any) => any, space: string | number): string; - /** - * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. - * @param value A JavaScript value, usually an object or array, to be converted. - * @param replacer Array that transforms the results. - * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. - */ - stringify(value: any, replacer: any[], space: string | number): string; -} -/** - * An intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format. - */ -declare var JSON: JSON; - - -///////////////////////////// -/// ECMAScript Array API (specially handled by compiler) -///////////////////////////// - -interface Array { - /** - * Gets or sets the length of the array. This is a number one higher than the highest element defined in an array. - */ - length: number; - /** - * Returns a string representation of an array. - */ - toString(): string; - toLocaleString(): string; - /** - * Appends new elements to an array, and returns the new length of the array. - * @param items New elements of the Array. - */ - push(...items: T[]): number; - /** - * Removes the last element from an array and returns it. - */ - pop(): T; - /** - * Combines two or more arrays. - * @param items Additional items to add to the end of array1. - */ - concat(...items: U[]): T[]; - /** - * Combines two or more arrays. - * @param items Additional items to add to the end of array1. - */ - concat(...items: T[]): T[]; - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - /** - * Reverses the elements in an Array. - */ - reverse(): T[]; - /** - * Removes the first element from an array and returns it. - */ - shift(): T; - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): T[]; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: T, b: T) => number): T[]; - - /** - * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. - * @param start The zero-based location in the array from which to start removing elements. - */ - splice(start: number): T[]; - - /** - * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. - * @param start The zero-based location in the array from which to start removing elements. - * @param deleteCount The number of elements to remove. - * @param items Elements to insert into the array in place of the deleted elements. - */ - splice(start: number, deleteCount: number, ...items: T[]): T[]; - - /** - * Inserts new elements at the start of an array. - * @param items Elements to insert at the start of the Array. - */ - unshift(...items: T[]): number; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. - */ - indexOf(searchElement: T, fromIndex?: number): number; - - /** - * Returns the index of the last occurrence of a specified value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array. - */ - lastIndexOf(searchElement: T, fromIndex?: number): number; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void; - - /** - * Calls a defined callback function on each element of an array, and returns an array that contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[]; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): T[]; - - /** - * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - */ - reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; - /** - * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; - /** - * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; - - [n: number]: T; -} - -interface ArrayConstructor { - new (arrayLength?: number): any[]; - new (arrayLength: number): T[]; - new (...items: T[]): T[]; - (arrayLength?: number): any[]; - (arrayLength: number): T[]; - (...items: T[]): T[]; - isArray(arg: any): arg is Array; - prototype: Array; -} - -declare var Array: ArrayConstructor; - -interface TypedPropertyDescriptor { - enumerable?: boolean; - configurable?: boolean; - writable?: boolean; - value?: T; - get?: () => T; - set?: (value: T) => void; -} - -declare type ClassDecorator = (target: TFunction) => TFunction | void; -declare type PropertyDecorator = (target: Object, propertyKey: string | symbol) => void; -declare type MethodDecorator = (target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor) => TypedPropertyDescriptor | void; -declare type ParameterDecorator = (target: Object, propertyKey: string | symbol, parameterIndex: number) => void; - -declare type PromiseConstructorLike = new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void) => PromiseLike; - -interface PromiseLike { - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): PromiseLike; - then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): PromiseLike; -} - -interface ArrayLike { - length: number; - [n: number]: T; -} - - -/** - * Represents a raw buffer of binary data, which is used to store data for the - * different typed arrays. ArrayBuffers cannot be read from or written to directly, - * but can be passed to a typed array or DataView Object to interpret the raw - * buffer as needed. - */ -interface ArrayBuffer { - /** - * Read-only. The length of the ArrayBuffer (in bytes). - */ - byteLength: number; - - /** - * Returns a section of an ArrayBuffer. - */ - slice(begin:number, end?:number): ArrayBuffer; -} - -interface ArrayBufferConstructor { - prototype: ArrayBuffer; - new (byteLength: number): ArrayBuffer; - isView(arg: any): arg is ArrayBufferView; -} -declare var ArrayBuffer: ArrayBufferConstructor; - -interface ArrayBufferView { - /** - * The ArrayBuffer instance referenced by the array. - */ - buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - byteLength: number; - - /** - * The offset in bytes of the array. - */ - byteOffset: number; -} - -interface DataView { - buffer: ArrayBuffer; - byteLength: number; - byteOffset: number; - /** - * Gets the Float32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getFloat32(byteOffset: number, littleEndian?: boolean): number; - - /** - * Gets the Float64 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getFloat64(byteOffset: number, littleEndian?: boolean): number; - - /** - * Gets the Int8 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getInt8(byteOffset: number): number; - - /** - * Gets the Int16 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getInt16(byteOffset: number, littleEndian?: boolean): number; - /** - * Gets the Int32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getInt32(byteOffset: number, littleEndian?: boolean): number; - - /** - * Gets the Uint8 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getUint8(byteOffset: number): number; - - /** - * Gets the Uint16 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getUint16(byteOffset: number, littleEndian?: boolean): number; - - /** - * Gets the Uint32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getUint32(byteOffset: number, littleEndian?: boolean): number; - - /** - * Stores an Float32 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setFloat32(byteOffset: number, value: number, littleEndian?: boolean): void; - - /** - * Stores an Float64 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setFloat64(byteOffset: number, value: number, littleEndian?: boolean): void; - - /** - * Stores an Int8 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - */ - setInt8(byteOffset: number, value: number): void; - - /** - * Stores an Int16 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setInt16(byteOffset: number, value: number, littleEndian?: boolean): void; - - /** - * Stores an Int32 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setInt32(byteOffset: number, value: number, littleEndian?: boolean): void; - - /** - * Stores an Uint8 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - */ - setUint8(byteOffset: number, value: number): void; - - /** - * Stores an Uint16 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setUint16(byteOffset: number, value: number, littleEndian?: boolean): void; - - /** - * Stores an Uint32 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setUint32(byteOffset: number, value: number, littleEndian?: boolean): void; -} - -interface DataViewConstructor { - new (buffer: ArrayBuffer, byteOffset?: number, byteLength?: number): DataView; -} -declare var DataView: DataViewConstructor; - -/** - * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested - * number of bytes could not be allocated an exception is raised. - */ -interface Int8Array { - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - byteLength: number; - - /** - * The offset in bytes of the array. - */ - byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): Int8Array; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): Int8Array; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): Int8Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Int8Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Int8Array) => number, thisArg?: any): Int8Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Int8Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Int8Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): Int8Array; - - /** - * Gets a new Int8Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Int8Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} -interface Int8ArrayConstructor { - prototype: Int8Array; - new (length: number): Int8Array; - new (array: ArrayLike): Int8Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int8Array; - - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Int8Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array; - -} -declare var Int8Array: Int8ArrayConstructor; - -/** - * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint8Array { - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - byteLength: number; - - /** - * The offset in bytes of the array. - */ - byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): Uint8Array; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): Uint8Array; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): Uint8Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Uint8Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Uint8Array) => number, thisArg?: any): Uint8Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Uint8Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Uint8Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): Uint8Array; - - /** - * Gets a new Uint8Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Uint8Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Uint8ArrayConstructor { - prototype: Uint8Array; - new (length: number): Uint8Array; - new (array: ArrayLike): Uint8Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8Array; - - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Uint8Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array; - -} -declare var Uint8Array: Uint8ArrayConstructor; - -/** - * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. - * If the requested number of bytes could not be allocated an exception is raised. - */ -interface Uint8ClampedArray { - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - byteLength: number; - - /** - * The offset in bytes of the array. - */ - byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): Uint8ClampedArray; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): Uint8ClampedArray; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): Uint8ClampedArray; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => number, thisArg?: any): Uint8ClampedArray; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Uint8ClampedArray; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: Uint8ClampedArray, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Uint8ClampedArray; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): Uint8ClampedArray; - - /** - * Gets a new Uint8ClampedArray view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Uint8ClampedArray; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Uint8ClampedArrayConstructor { - prototype: Uint8ClampedArray; - new (length: number): Uint8ClampedArray; - new (array: ArrayLike): Uint8ClampedArray; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8ClampedArray; - - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Uint8ClampedArray; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray; -} -declare var Uint8ClampedArray: Uint8ClampedArrayConstructor; - -/** - * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Int16Array { - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - byteLength: number; - - /** - * The offset in bytes of the array. - */ - byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): Int16Array; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): Int16Array; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): Int16Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Int16Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Int16Array) => number, thisArg?: any): Int16Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Int16Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Int16Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): Int16Array; - - /** - * Gets a new Int16Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Int16Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Int16ArrayConstructor { - prototype: Int16Array; - new (length: number): Int16Array; - new (array: ArrayLike): Int16Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int16Array; - - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Int16Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array; - -} -declare var Int16Array: Int16ArrayConstructor; - -/** - * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint16Array { - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - byteLength: number; - - /** - * The offset in bytes of the array. - */ - byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): Uint16Array; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): Uint16Array; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): Uint16Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Uint16Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Uint16Array) => number, thisArg?: any): Uint16Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Uint16Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Uint16Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): Uint16Array; - - /** - * Gets a new Uint16Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Uint16Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Uint16ArrayConstructor { - prototype: Uint16Array; - new (length: number): Uint16Array; - new (array: ArrayLike): Uint16Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint16Array; - - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Uint16Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array; - -} -declare var Uint16Array: Uint16ArrayConstructor; -/** - * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Int32Array { - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - byteLength: number; - - /** - * The offset in bytes of the array. - */ - byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): Int32Array; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): Int32Array; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): Int32Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Int32Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Int32Array) => number, thisArg?: any): Int32Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Int32Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Int32Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): Int32Array; - - /** - * Gets a new Int32Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Int32Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Int32ArrayConstructor { - prototype: Int32Array; - new (length: number): Int32Array; - new (array: ArrayLike): Int32Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int32Array; - - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Int32Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array; -} -declare var Int32Array: Int32ArrayConstructor; - -/** - * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint32Array { - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - byteLength: number; - - /** - * The offset in bytes of the array. - */ - byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): Uint32Array; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): Uint32Array; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): Uint32Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Uint32Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Uint32Array) => number, thisArg?: any): Uint32Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Uint32Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Uint32Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): Uint32Array; - - /** - * Gets a new Uint32Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Uint32Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Uint32ArrayConstructor { - prototype: Uint32Array; - new (length: number): Uint32Array; - new (array: ArrayLike): Uint32Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint32Array; - - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Uint32Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array; -} -declare var Uint32Array: Uint32ArrayConstructor; - -/** - * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number - * of bytes could not be allocated an exception is raised. - */ -interface Float32Array { - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - byteLength: number; - - /** - * The offset in bytes of the array. - */ - byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): Float32Array; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): Float32Array; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): Float32Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Float32Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Float32Array) => number, thisArg?: any): Float32Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Float32Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Float32Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): Float32Array; - - /** - * Gets a new Float32Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Float32Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Float32ArrayConstructor { - prototype: Float32Array; - new (length: number): Float32Array; - new (array: ArrayLike): Float32Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float32Array; - - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Float32Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array; - -} -declare var Float32Array: Float32ArrayConstructor; - -/** - * A typed array of 64-bit float values. The contents are initialized to 0. If the requested - * number of bytes could not be allocated an exception is raised. - */ -interface Float64Array { - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - byteLength: number; - - /** - * The offset in bytes of the array. - */ - byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): Float64Array; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): Float64Array; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): Float64Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Float64Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Float64Array) => number, thisArg?: any): Float64Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Float64Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Float64Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): Float64Array; - - /** - * Gets a new Float64Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Float64Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Float64ArrayConstructor { - prototype: Float64Array; - new (length: number): Float64Array; - new (array: ArrayLike): Float64Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float64Array; - - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Float64Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; -} -declare var Float64Array: Float64ArrayConstructor; -declare type PropertyKey = string | number | symbol; - -interface Symbol { - /** Returns a string representation of an object. */ - toString(): string; - - /** Returns the primitive value of the specified object. */ - valueOf(): Object; - - [Symbol.toStringTag]: string; -} - -interface SymbolConstructor { - /** - * A reference to the prototype. - */ - prototype: Symbol; - - /** - * Returns a new unique Symbol value. - * @param description Description of the new Symbol object. - */ - (description?: string|number): symbol; - - /** - * Returns a Symbol object from the global symbol registry matching the given key if found. - * Otherwise, returns a new symbol with this key. - * @param key key to search for. - */ - for(key: string): symbol; - - /** - * Returns a key from the global symbol registry matching the given Symbol if found. - * Otherwise, returns a undefined. - * @param sym Symbol to find the key for. - */ - keyFor(sym: symbol): string; - - // Well-known Symbols - - /** - * A method that determines if a constructor object recognizes an object as one of the - * constructor’s instances. Called by the semantics of the instanceof operator. - */ - hasInstance: symbol; - - /** - * A Boolean value that if true indicates that an object should flatten to its array elements - * by Array.prototype.concat. - */ - isConcatSpreadable: symbol; - - /** - * A method that returns the default iterator for an object. Called by the semantics of the - * for-of statement. - */ - iterator: symbol; - - /** - * A regular expression method that matches the regular expression against a string. Called - * by the String.prototype.match method. - */ - match: symbol; - - /** - * A regular expression method that replaces matched substrings of a string. Called by the - * String.prototype.replace method. - */ - replace: symbol; - - /** - * A regular expression method that returns the index within a string that matches the - * regular expression. Called by the String.prototype.search method. - */ - search: symbol; - - /** - * A function valued property that is the constructor function that is used to create - * derived objects. - */ - species: symbol; - - /** - * A regular expression method that splits a string at the indices that match the regular - * expression. Called by the String.prototype.split method. - */ - split: symbol; - - /** - * A method that converts an object to a corresponding primitive value. - * Called by the ToPrimitive abstract operation. - */ - toPrimitive: symbol; - - /** - * A String value that is used in the creation of the default string description of an object. - * Called by the built-in method Object.prototype.toString. - */ - toStringTag: symbol; - - /** - * An Object whose own property names are property names that are excluded from the 'with' - * environment bindings of the associated objects. - */ - unscopables: symbol; -} -declare var Symbol: SymbolConstructor; - -interface Object { - /** - * Determines whether an object has a property with the specified name. - * @param v A property name. - */ - hasOwnProperty(v: PropertyKey): boolean; - - /** - * Determines whether a specified property is enumerable. - * @param v A property name. - */ - propertyIsEnumerable(v: PropertyKey): boolean; -} - -interface ObjectConstructor { - /** - * Copy the values of all of the enumerable own properties from one or more source objects to a - * target object. Returns the target object. - * @param target The target object to copy to. - * @param source The source object from which to copy properties. - */ - assign(target: T, source: U): T & U; - - /** - * Copy the values of all of the enumerable own properties from one or more source objects to a - * target object. Returns the target object. - * @param target The target object to copy to. - * @param source1 The first source object from which to copy properties. - * @param source2 The second source object from which to copy properties. - */ - assign(target: T, source1: U, source2: V): T & U & V; - - /** - * Copy the values of all of the enumerable own properties from one or more source objects to a - * target object. Returns the target object. - * @param target The target object to copy to. - * @param source1 The first source object from which to copy properties. - * @param source2 The second source object from which to copy properties. - * @param source3 The third source object from which to copy properties. - */ - assign(target: T, source1: U, source2: V, source3: W): T & U & V & W; - - /** - * Copy the values of all of the enumerable own properties from one or more source objects to a - * target object. Returns the target object. - * @param target The target object to copy to. - * @param sources One or more source objects from which to copy properties - */ - assign(target: any, ...sources: any[]): any; - - /** - * Returns an array of all symbol properties found directly on object o. - * @param o Object to retrieve the symbols from. - */ - getOwnPropertySymbols(o: any): symbol[]; - - /** - * Returns true if the values are the same value, false otherwise. - * @param value1 The first value. - * @param value2 The second value. - */ - is(value1: any, value2: any): boolean; - - /** - * Sets the prototype of a specified object o to object proto or null. Returns the object o. - * @param o The object to change its prototype. - * @param proto The value of the new prototype or null. - */ - setPrototypeOf(o: any, proto: any): any; - - /** - * Gets the own property descriptor of the specified object. - * An own property descriptor is one that is defined directly on the object and is not - * inherited from the object's prototype. - * @param o Object that contains the property. - * @param p Name of the property. - */ - getOwnPropertyDescriptor(o: any, propertyKey: PropertyKey): PropertyDescriptor; - - /** - * Adds a property to an object, or modifies attributes of an existing property. - * @param o Object on which to add or modify the property. This can be a native JavaScript - * object (that is, a user-defined object or a built in object) or a DOM object. - * @param p The property name. - * @param attributes Descriptor for the property. It can be for a data property or an accessor - * property. - */ - defineProperty(o: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): any; -} - -interface Function { - /** - * Returns the name of the function. Function names are read-only and can not be changed. - */ - name: string; - - /** - * Determines whether the given value inherits from this function if this function was used - * as a constructor function. - * - * A constructor function can control which objects are recognized as its instances by - * 'instanceof' by overriding this method. - */ - [Symbol.hasInstance](value: any): boolean; -} - -interface NumberConstructor { - /** - * The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1 - * that is representable as a Number value, which is approximately: - * 2.2204460492503130808472633361816 x 10‍−‍16. - */ - EPSILON: number; - - /** - * Returns true if passed value is finite. - * Unlike the global isFininte, Number.isFinite doesn't forcibly convert the parameter to a - * number. Only finite values of the type number, result in true. - * @param number A numeric value. - */ - isFinite(number: number): boolean; - - /** - * Returns true if the value passed is an integer, false otherwise. - * @param number A numeric value. - */ - isInteger(number: number): boolean; - - /** - * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a - * number). Unlike the global isNaN(), Number.isNaN() doesn't forcefully convert the parameter - * to a number. Only values of the type number, that are also NaN, result in true. - * @param number A numeric value. - */ - isNaN(number: number): boolean; - - /** - * Returns true if the value passed is a safe integer. - * @param number A numeric value. - */ - isSafeInteger(number: number): boolean; - - /** - * The value of the largest integer n such that n and n + 1 are both exactly representable as - * a Number value. - * The value of Number.MIN_SAFE_INTEGER is 9007199254740991 2^53 − 1. - */ - MAX_SAFE_INTEGER: number; - - /** - * The value of the smallest integer n such that n and n − 1 are both exactly representable as - * a Number value. - * The value of Number.MIN_SAFE_INTEGER is −9007199254740991 (−(2^53 − 1)). - */ - MIN_SAFE_INTEGER: number; - - /** - * Converts a string to a floating-point number. - * @param string A string that contains a floating-point number. - */ - parseFloat(string: string): number; - - /** - * Converts A string to an integer. - * @param s A string to convert into a number. - * @param radix A value between 2 and 36 that specifies the base of the number in numString. - * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. - * All other strings are considered decimal. - */ - parseInt(string: string, radix?: number): number; -} - -interface Array { - /** Iterator */ - [Symbol.iterator](): IterableIterator; - - /** - * Returns an object whose properties have the value 'true' - * when they will be absent when used in a 'with' statement. - */ - [Symbol.unscopables](): { - copyWithin: boolean; - entries: boolean; - fill: boolean; - find: boolean; - findIndex: boolean; - keys: boolean; - values: boolean; - }; - - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, T]>; - - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: T, index: number, obj: Array) => boolean, thisArg?: any): T; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: T) => boolean, thisArg?: any): number; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: T, start?: number, end?: number): T[]; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): T[]; -} - -interface IArguments { - /** Iterator */ - [Symbol.iterator](): IterableIterator; -} - -interface ArrayConstructor { - /** - * Creates an array from an array-like object. - * @param arrayLike An array-like object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): Array; - - /** - * Creates an array from an iterable object. - * @param iterable An iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(iterable: Iterable, mapfn: (v: T, k: number) => U, thisArg?: any): Array; - - /** - * Creates an array from an array-like object. - * @param arrayLike An array-like object to convert to an array. - */ - from(arrayLike: ArrayLike): Array; - - /** - * Creates an array from an iterable object. - * @param iterable An iterable object to convert to an array. - */ - from(iterable: Iterable): Array; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: T[]): Array; -} - -interface String { - /** Iterator */ - [Symbol.iterator](): IterableIterator; - - /** - * Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point - * value of the UTF-16 encoded code point starting at the string element at position pos in - * the String resulting from converting this object to a String. - * If there is no element at that position, the result is undefined. - * If a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos. - */ - codePointAt(pos: number): number; - - /** - * Returns true if searchString appears as a substring of the result of converting this - * object to a String, at one or more positions that are - * greater than or equal to position; otherwise, returns false. - * @param searchString search string - * @param position If position is undefined, 0 is assumed, so as to search all of the String. - */ - includes(searchString: string, position?: number): boolean; - - /** - * Returns true if the sequence of elements of searchString converted to a String is the - * same as the corresponding elements of this object (converted to a String) starting at - * endPosition – length(this). Otherwise returns false. - */ - endsWith(searchString: string, endPosition?: number): boolean; - - /** - * Returns the String value result of normalizing the string into the normalization form - * named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms. - * @param form Applicable values: "NFC", "NFD", "NFKC", or "NFKD", If not specified default - * is "NFC" - */ - normalize(form?: string): string; - - /** - * Returns a String value that is made from count copies appended together. If count is 0, - * T is the empty String is returned. - * @param count number of copies to append - */ - repeat(count: number): string; - - /** - * Returns true if the sequence of elements of searchString converted to a String is the - * same as the corresponding elements of this object (converted to a String) starting at - * position. Otherwise returns false. - */ - startsWith(searchString: string, position?: number): boolean; - - // Overloads for objects with methods of well-known symbols. - - /** - * Matches a string an object that supports being matched against, and returns an array containing the results of that search. - * @param matcher An object that supports being matched against. - */ - match(matcher: { [Symbol.match](string: string): RegExpMatchArray; }): RegExpMatchArray; - - /** - * Replaces text in a string, using an object that supports replacement within a string. - * @param searchValue A object can search for and replace matches within a string. - * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. - */ - replace(searchValue: { [Symbol.replace](string: string, replaceValue: string): string; }, replaceValue: string): string; - - /** - * Replaces text in a string, using an object that supports replacement within a string. - * @param searchValue A object can search for and replace matches within a string. - * @param replacer A function that returns the replacement text. - */ - replace(searchValue: { [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; }, replacer: (substring: string, ...args: any[]) => string): string; - - /** - * Finds the first substring match in a regular expression search. - * @param searcher An object which supports searching within a string. - */ - search(searcher: { [Symbol.search](string: string): number; }): number; - - /** - * Split a string into substrings using the specified separator and return them as an array. - * @param splitter An object that can split a string. - * @param limit A value used to limit the number of elements returned in the array. - */ - split(splitter: { [Symbol.split](string: string, limit?: number): string[]; }, limit?: number): string[]; - - /** - * Returns an HTML anchor element and sets the name attribute to the text value - * @param name - */ - anchor(name: string): string; - - /** Returns a HTML element */ - big(): string; - - /** Returns a HTML element */ - blink(): string; - - /** Returns a HTML element */ - bold(): string; - - /** Returns a HTML element */ - fixed(): string - - /** Returns a HTML element and sets the color attribute value */ - fontcolor(color: string): string - - /** Returns a HTML element and sets the size attribute value */ - fontsize(size: number): string; - - /** Returns a HTML element and sets the size attribute value */ - fontsize(size: string): string; - - /** Returns an HTML element */ - italics(): string; - - /** Returns an HTML element and sets the href attribute value */ - link(url: string): string; - - /** Returns a HTML element */ - small(): string; - - /** Returns a HTML element */ - strike(): string; - - /** Returns a HTML element */ - sub(): string; - - /** Returns a HTML element */ - sup(): string; -} - -interface StringConstructor { - /** - * Return the String value whose elements are, in order, the elements in the List elements. - * If length is 0, the empty string is returned. - */ - fromCodePoint(...codePoints: number[]): string; - - /** - * String.raw is intended for use as a tag function of a Tagged Template String. When called - * as such the first argument will be a well formed template call site object and the rest - * parameter will contain the substitution values. - * @param template A well-formed template string call site representation. - * @param substitutions A set of substitution values. - */ - raw(template: TemplateStringsArray, ...substitutions: any[]): string; -} - -interface IteratorResult { - done: boolean; - value?: T; -} - -interface Iterator { - next(value?: any): IteratorResult; - return?(value?: any): IteratorResult; - throw?(e?: any): IteratorResult; -} - -interface Iterable { - [Symbol.iterator](): Iterator; -} - -interface IterableIterator extends Iterator { - [Symbol.iterator](): IterableIterator; -} - -interface GeneratorFunction extends Function { - -} - -interface GeneratorFunctionConstructor { - /** - * Creates a new Generator function. - * @param args A list of arguments the function accepts. - */ - new (...args: string[]): GeneratorFunction; - (...args: string[]): GeneratorFunction; - prototype: GeneratorFunction; -} -declare var GeneratorFunction: GeneratorFunctionConstructor; - -interface Math { - /** - * Returns the number of leading zero bits in the 32-bit binary representation of a number. - * @param x A numeric expression. - */ - clz32(x: number): number; - - /** - * Returns the result of 32-bit multiplication of two numbers. - * @param x First number - * @param y Second number - */ - imul(x: number, y: number): number; - - /** - * Returns the sign of the x, indicating whether x is positive, negative or zero. - * @param x The numeric expression to test - */ - sign(x: number): number; - - /** - * Returns the base 10 logarithm of a number. - * @param x A numeric expression. - */ - log10(x: number): number; - - /** - * Returns the base 2 logarithm of a number. - * @param x A numeric expression. - */ - log2(x: number): number; - - /** - * Returns the natural logarithm of 1 + x. - * @param x A numeric expression. - */ - log1p(x: number): number; - - /** - * Returns the result of (e^x - 1) of x (e raised to the power of x, where e is the base of - * the natural logarithms). - * @param x A numeric expression. - */ - expm1(x: number): number; - - /** - * Returns the hyperbolic cosine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - cosh(x: number): number; - - /** - * Returns the hyperbolic sine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - sinh(x: number): number; - - /** - * Returns the hyperbolic tangent of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - tanh(x: number): number; - - /** - * Returns the inverse hyperbolic cosine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - acosh(x: number): number; - - /** - * Returns the inverse hyperbolic sine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - asinh(x: number): number; - - /** - * Returns the inverse hyperbolic tangent of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - atanh(x: number): number; - - /** - * Returns the square root of the sum of squares of its arguments. - * @param values Values to compute the square root for. - * If no arguments are passed, the result is +0. - * If there is only one argument, the result is the absolute value. - * If any argument is +Infinity or -Infinity, the result is +Infinity. - * If any argument is NaN, the result is NaN. - * If all arguments are either +0 or −0, the result is +0. - */ - hypot(...values: number[] ): number; - - /** - * Returns the integral part of the a numeric expression, x, removing any fractional digits. - * If x is already an integer, the result is x. - * @param x A numeric expression. - */ - trunc(x: number): number; - - /** - * Returns the nearest single precision float representation of a number. - * @param x A numeric expression. - */ - fround(x: number): number; - - /** - * Returns an implementation-dependent approximation to the cube root of number. - * @param x A numeric expression. - */ - cbrt(x: number): number; - - [Symbol.toStringTag]: string; -} - -interface Date { - /** - * Converts a Date object to a string. - */ - [Symbol.toPrimitive](hint: "default"): string; - /** - * Converts a Date object to a string. - */ - [Symbol.toPrimitive](hint: "string"): string; - /** - * Converts a Date object to a number. - */ - [Symbol.toPrimitive](hint: "number"): number; - /** - * Converts a Date object to a string or number. - * - * @param hint The strings "number", "string", or "default" to specify what primitive to return. - * - * @throws {TypeError} If 'hint' was given something other than "number", "string", or "default". - * @returns A number if 'hint' was "number", a string if 'hint' was "string" or "default". - */ - [Symbol.toPrimitive](hint: string): string | number; -} - -interface RegExp { - /** - * Matches a string with this regular expression, and returns an array containing the results of - * that search. - * @param string A string to search within. - */ - [Symbol.match](string: string): RegExpMatchArray; - - /** - * Replaces text in a string, using this regular expression. - * @param string A String object or string literal whose contents matching against - * this regular expression will be replaced - * @param replaceValue A String object or string literal containing the text to replace for every - * successful match of this regular expression. - */ - [Symbol.replace](string: string, replaceValue: string): string; - - /** - * Replaces text in a string, using this regular expression. - * @param string A String object or string literal whose contents matching against - * this regular expression will be replaced - * @param replacer A function that returns the replacement text. - */ - [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; - - /** - * Finds the position beginning first substring match in a regular expression search - * using this regular expression. - * - * @param string The string to search within. - */ - [Symbol.search](string: string): number; - - /** - * Returns an array of substrings that were delimited by strings in the original input that - * match against this regular expression. - * - * If the regular expression contains capturing parentheses, then each time this - * regular expression matches, the results (including any undefined results) of the - * capturing parentheses are spliced. - * - * @param string string value to split - * @param limit if not undefined, the output array is truncated so that it contains no more - * than 'limit' elements. - */ - [Symbol.split](string: string, limit?: number): string[]; - - /** - * Returns a string indicating the flags of the regular expression in question. This field is read-only. - * The characters in this string are sequenced and concatenated in the following order: - * - * - "g" for global - * - "i" for ignoreCase - * - "m" for multiline - * - "u" for unicode - * - "y" for sticky - * - * If no flags are set, the value is the empty string. - */ - flags: string; - - /** - * Returns a Boolean value indicating the state of the sticky flag (y) used with a regular - * expression. Default is false. Read-only. - */ - sticky: boolean; - - /** - * Returns a Boolean value indicating the state of the Unicode flag (u) used with a regular - * expression. Default is false. Read-only. - */ - unicode: boolean; -} - -interface RegExpConstructor { - [Symbol.species](): RegExpConstructor; -} - -interface Map { - clear(): void; - delete(key: K): boolean; - entries(): IterableIterator<[K, V]>; - forEach(callbackfn: (value: V, index: K, map: Map) => void, thisArg?: any): void; - get(key: K): V; - has(key: K): boolean; - keys(): IterableIterator; - set(key: K, value?: V): Map; - size: number; - values(): IterableIterator; - [Symbol.iterator]():IterableIterator<[K,V]>; - [Symbol.toStringTag]: string; -} - -interface MapConstructor { - new (): Map; - new (): Map; - new (iterable: Iterable<[K, V]>): Map; - prototype: Map; -} -declare var Map: MapConstructor; - -interface WeakMap { - clear(): void; - delete(key: K): boolean; - get(key: K): V; - has(key: K): boolean; - set(key: K, value?: V): WeakMap; - [Symbol.toStringTag]: string; -} - -interface WeakMapConstructor { - new (): WeakMap; - new (): WeakMap; - new (iterable: Iterable<[K, V]>): WeakMap; - prototype: WeakMap; -} -declare var WeakMap: WeakMapConstructor; - -interface Set { - add(value: T): Set; - clear(): void; - delete(value: T): boolean; - entries(): IterableIterator<[T, T]>; - forEach(callbackfn: (value: T, index: T, set: Set) => void, thisArg?: any): void; - has(value: T): boolean; - keys(): IterableIterator; - size: number; - values(): IterableIterator; - [Symbol.iterator]():IterableIterator; - [Symbol.toStringTag]: string; -} - -interface SetConstructor { - new (): Set; - new (): Set; - new (iterable: Iterable): Set; - prototype: Set; -} -declare var Set: SetConstructor; - -interface WeakSet { - add(value: T): WeakSet; - clear(): void; - delete(value: T): boolean; - has(value: T): boolean; - [Symbol.toStringTag]: string; -} - -interface WeakSetConstructor { - new (): WeakSet; - new (): WeakSet; - new (iterable: Iterable): WeakSet; - prototype: WeakSet; -} -declare var WeakSet: WeakSetConstructor; - -interface JSON { - [Symbol.toStringTag]: string; -} - -/** - * Represents a raw buffer of binary data, which is used to store data for the - * different typed arrays. ArrayBuffers cannot be read from or written to directly, - * but can be passed to a typed array or DataView Object to interpret the raw - * buffer as needed. - */ -interface ArrayBuffer { - [Symbol.toStringTag]: string; -} - -interface DataView { - [Symbol.toStringTag]: string; -} - -/** - * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested - * number of bytes could not be allocated an exception is raised. - */ -interface Int8Array { - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - [Symbol.iterator](): IterableIterator; -} - -interface Int8ArrayConstructor { - new (elements: Iterable): Int8Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array; -} - -/** - * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint8Array { - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - [Symbol.iterator](): IterableIterator; -} - -interface Uint8ArrayConstructor { - new (elements: Iterable): Uint8Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array; -} - -/** - * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. - * If the requested number of bytes could not be allocated an exception is raised. - */ -interface Uint8ClampedArray { - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - - [Symbol.iterator](): IterableIterator; -} - -interface Uint8ClampedArrayConstructor { - new (elements: Iterable): Uint8ClampedArray; - - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray; -} - -/** - * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Int16Array { - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - - - [Symbol.iterator](): IterableIterator; -} - -interface Int16ArrayConstructor { - new (elements: Iterable): Int16Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array; -} - -/** - * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint16Array { - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - [Symbol.iterator](): IterableIterator; -} - -interface Uint16ArrayConstructor { - new (elements: Iterable): Uint16Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array; -} - -/** - * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Int32Array { - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - [Symbol.iterator](): IterableIterator; -} - -interface Int32ArrayConstructor { - new (elements: Iterable): Int32Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array; -} - -/** - * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint32Array { - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - [Symbol.iterator](): IterableIterator; -} - -interface Uint32ArrayConstructor { - new (elements: Iterable): Uint32Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array; -} - -/** - * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number - * of bytes could not be allocated an exception is raised. - */ -interface Float32Array { - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - [Symbol.iterator](): IterableIterator; -} - -interface Float32ArrayConstructor { - new (elements: Iterable): Float32Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array; -} - -/** - * A typed array of 64-bit float values. The contents are initialized to 0. If the requested - * number of bytes could not be allocated an exception is raised. - */ -interface Float64Array { - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - [Symbol.iterator](): IterableIterator; -} - -interface Float64ArrayConstructor { - new (elements: Iterable): Float64Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; -} - -interface ProxyHandler { - getPrototypeOf? (target: T): any; - setPrototypeOf? (target: T, v: any): boolean; - isExtensible? (target: T): boolean; - preventExtensions? (target: T): boolean; - getOwnPropertyDescriptor? (target: T, p: PropertyKey): PropertyDescriptor; - has? (target: T, p: PropertyKey): boolean; - get? (target: T, p: PropertyKey, receiver: any): any; - set? (target: T, p: PropertyKey, value: any, receiver: any): boolean; - deleteProperty? (target: T, p: PropertyKey): boolean; - defineProperty? (target: T, p: PropertyKey, attributes: PropertyDescriptor): boolean; - enumerate? (target: T): PropertyKey[]; - ownKeys? (target: T): PropertyKey[]; - apply? (target: T, thisArg: any, argArray?: any): any; - construct? (target: T, thisArg: any, argArray?: any): any; -} - -interface ProxyConstructor { - revocable(target: T, handler: ProxyHandler): { proxy: T; revoke: () => void; }; - new (target: T, handler: ProxyHandler): T -} -declare var Proxy: ProxyConstructor; - -declare namespace Reflect { - function apply(target: Function, thisArgument: any, argumentsList: ArrayLike): any; - function construct(target: Function, argumentsList: ArrayLike, newTarget?: any): any; - function defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean; - function deleteProperty(target: any, propertyKey: PropertyKey): boolean; - function enumerate(target: any): IterableIterator; - function get(target: any, propertyKey: PropertyKey, receiver?: any): any; - function getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor; - function getPrototypeOf(target: any): any; - function has(target: any, propertyKey: string): boolean; - function has(target: any, propertyKey: symbol): boolean; - function isExtensible(target: any): boolean; - function ownKeys(target: any): Array; - function preventExtensions(target: any): boolean; - function set(target: any, propertyKey: PropertyKey, value: any, receiver? :any): boolean; - function setPrototypeOf(target: any, proto: any): boolean; -} - -/** - * Represents the completion of an asynchronous operation - */ -interface Promise { - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; - then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): Promise; - - /** - * Attaches a callback for only the rejection of the Promise. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of the callback. - */ - catch(onrejected?: (reason: any) => T | PromiseLike): Promise; - catch(onrejected?: (reason: any) => void): Promise; - - [Symbol.toStringTag]: string; -} - -interface PromiseConstructor { - /** - * A reference to the prototype. - */ - prototype: Promise; - - /** - * Creates a new Promise. - * @param executor A callback used to initialize the promise. This callback is passed two arguments: - * a resolve callback used resolve the promise with a value or the result of another promise, - * and a reject callback used to reject the promise with a provided reason or error. - */ - new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void): Promise; - - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: Iterable>): Promise; - - /** - * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved - * or rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - race(values: Iterable>): Promise; - - /** - * Creates a new rejected promise for the provided reason. - * @param reason The reason the promise was rejected. - * @returns A new rejected Promise. - */ - reject(reason: any): Promise; - - /** - * Creates a new rejected promise for the provided reason. - * @param reason The reason the promise was rejected. - * @returns A new rejected Promise. - */ - reject(reason: any): Promise; - - /** - * Creates a new resolved promise for the provided value. - * @param value A promise. - * @returns A promise whose internal state matches the provided promise. - */ - resolve(value: T | PromiseLike): Promise; - - /** - * Creates a new resolved promise . - * @returns A resolved promise. - */ - resolve(): Promise; - - [Symbol.species]: Function; -} - -declare var Promise: PromiseConstructor; diff --git a/lib/lib.d.ts b/lib/lib.d.ts index fd4c05da220..6bded7a1135 100644 --- a/lib/lib.d.ts +++ b/lib/lib.d.ts @@ -14,16 +14,15 @@ and limitations under the License. ***************************************************************************** */ /// - ///////////////////////////// /// ECMAScript APIs ///////////////////////////// -declare var NaN: number; -declare var Infinity: number; +declare const NaN: number; +declare const Infinity: number; /** - * Evaluates JavaScript code and executes it. + * Evaluates JavaScript code and executes it. * @param x A String value that contains valid JavaScript code. */ declare function eval(x: string): any; @@ -31,25 +30,25 @@ declare function eval(x: string): any; /** * Converts A string to an integer. * @param s A string to convert into a number. - * @param radix A value between 2 and 36 that specifies the base of the number in numString. + * @param radix A value between 2 and 36 that specifies the base of the number in numString. * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. * All other strings are considered decimal. */ declare function parseInt(s: string, radix?: number): number; /** - * Converts a string to a floating-point number. - * @param string A string that contains a floating-point number. + * Converts a string to a floating-point number. + * @param string A string that contains a floating-point number. */ declare function parseFloat(string: string): number; /** - * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a number). + * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a number). * @param number A numeric value. */ declare function isNaN(number: number): boolean; -/** +/** * Determines whether a supplied number is finite. * @param number Any numeric value. */ @@ -67,7 +66,7 @@ declare function decodeURI(encodedURI: string): string; */ declare function decodeURIComponent(encodedURIComponent: string): string; -/** +/** * Encodes a text string as a valid Uniform Resource Identifier (URI) * @param uri A value representing an encoded URI. */ @@ -106,18 +105,18 @@ interface Object { valueOf(): Object; /** - * Determines whether an object has a property with the specified name. + * Determines whether an object has a property with the specified name. * @param v A property name. */ hasOwnProperty(v: string): boolean; /** - * Determines whether an object exists in another object's prototype chain. + * Determines whether an object exists in another object's prototype chain. * @param v Another object whose prototype chain is to be checked. */ isPrototypeOf(v: Object): boolean; - /** + /** * Determines whether a specified property is enumerable. * @param v A property name. */ @@ -130,38 +129,38 @@ interface ObjectConstructor { (value: any): any; /** A reference to the prototype for a class of objects. */ - prototype: Object; + readonly prototype: Object; - /** - * Returns the prototype of an object. + /** + * Returns the prototype of an object. * @param o The object that references the prototype. */ getPrototypeOf(o: any): any; /** - * Gets the own property descriptor of the specified object. - * An own property descriptor is one that is defined directly on the object and is not inherited from the object's prototype. + * Gets the own property descriptor of the specified object. + * An own property descriptor is one that is defined directly on the object and is not inherited from the object's prototype. * @param o Object that contains the property. * @param p Name of the property. */ getOwnPropertyDescriptor(o: any, p: string): PropertyDescriptor; - /** - * Returns the names of the own properties of an object. The own properties of an object are those that are defined directly + /** + * Returns the names of the own properties of an object. The own properties of an object are those that are defined directly * on that object, and are not inherited from the object's prototype. The properties of an object include both fields (objects) and functions. * @param o Object that contains the own properties. */ getOwnPropertyNames(o: any): string[]; - /** + /** * Creates an object that has the specified prototype, and that optionally contains specified properties. * @param o Object to use as a prototype. May be null - * @param properties JavaScript object that contains one or more property descriptors. + * @param properties JavaScript object that contains one or more property descriptors. */ create(o: any, properties?: PropertyDescriptorMap): any; /** - * Adds a property to an object, or modifies attributes of an existing property. + * Adds a property to an object, or modifies attributes of an existing property. * @param o Object on which to add or modify the property. This can be a native JavaScript object (that is, a user-defined object or a built in object) or a DOM object. * @param p The property name. * @param attributes Descriptor for the property. It can be for a data property or an accessor property. @@ -169,7 +168,7 @@ interface ObjectConstructor { defineProperty(o: any, p: string, attributes: PropertyDescriptor): any; /** - * Adds one or more properties to an object, and/or modifies attributes of existing properties. + * Adds one or more properties to an object, and/or modifies attributes of existing properties. * @param o Object on which to add or modify the properties. This can be a native JavaScript object or a DOM object. * @param properties JavaScript object that contains one or more descriptor objects. Each descriptor object describes a data property or an accessor property. */ @@ -177,7 +176,7 @@ interface ObjectConstructor { /** * Prevents the modification of attributes of existing properties, and prevents the addition of new properties. - * @param o Object on which to lock the attributes. + * @param o Object on which to lock the attributes. */ seal(o: T): T; @@ -189,25 +188,25 @@ interface ObjectConstructor { /** * Prevents the addition of new properties to an object. - * @param o Object to make non-extensible. + * @param o Object to make non-extensible. */ preventExtensions(o: T): T; /** * Returns true if existing property attributes cannot be modified in an object and new properties cannot be added to the object. - * @param o Object to test. + * @param o Object to test. */ isSealed(o: any): boolean; /** * Returns true if existing property attributes and values cannot be modified in an object, and new properties cannot be added to the object. - * @param o Object to test. + * @param o Object to test. */ isFrozen(o: any): boolean; /** * Returns a value that indicates whether new properties can be added to an object. - * @param o Object to test. + * @param o Object to test. */ isExtensible(o: any): boolean; @@ -221,7 +220,7 @@ interface ObjectConstructor { /** * Provides functionality common to all JavaScript objects. */ -declare var Object: ObjectConstructor; +declare const Object: ObjectConstructor; /** * Creates a new function. @@ -232,25 +231,25 @@ interface Function { * @param thisArg The object to be used as the this object. * @param argArray A set of arguments to be passed to the function. */ - apply(thisArg: any, argArray?: any): any; + apply(this: Function, thisArg: any, argArray?: any): any; /** * Calls a method of an object, substituting another object for the current object. * @param thisArg The object to be used as the current object. * @param argArray A list of arguments to be passed to the method. */ - call(thisArg: any, ...argArray: any[]): any; + call(this: Function, thisArg: any, ...argArray: any[]): any; /** - * For a given function, creates a bound function that has the same body as the original function. + * For a given function, creates a bound function that has the same body as the original function. * The this object of the bound function is associated with the specified object, and has the specified initial parameters. * @param thisArg An object to which the this keyword can refer inside the new function. * @param argArray A list of arguments to be passed to the new function. */ - bind(thisArg: any, ...argArray: any[]): any; + bind(this: Function, thisArg: any, ...argArray: any[]): any; prototype: any; - length: number; + readonly length: number; // Non-standard extensions arguments: any; @@ -264,10 +263,10 @@ interface FunctionConstructor { */ new (...args: string[]): Function; (...args: string[]): Function; - prototype: Function; + readonly prototype: Function; } -declare var Function: FunctionConstructor; +declare const Function: FunctionConstructor; interface IArguments { [index: number]: any; @@ -285,7 +284,7 @@ interface String { */ charAt(pos: number): string; - /** + /** * Returns the Unicode value of the character at the specified location. * @param index The zero-based index of the desired character. If there is no character at the specified index, NaN is returned. */ @@ -293,12 +292,12 @@ interface String { /** * Returns a string that contains the concatenation of two or more strings. - * @param strings The strings to append to the end of the string. + * @param strings The strings to append to the end of the string. */ concat(...strings: string[]): string; /** - * Returns the position of the first occurrence of a substring. + * Returns the position of the first occurrence of a substring. * @param searchString The substring to search for in the string * @param position The index at which to begin searching the String object. If omitted, search starts at the beginning of the string. */ @@ -317,17 +316,17 @@ interface String { */ localeCompare(that: string): number; - /** + /** * Matches a string with a regular expression, and returns an array containing the results of that search. * @param regexp A variable name or string literal containing the regular expression pattern and flags. */ - match(regexp: string): RegExpMatchArray; + match(regexp: string): RegExpMatchArray | null; - /** + /** * Matches a string with a regular expression, and returns an array containing the results of that search. - * @param regexp A regular expression object that contains the regular expression pattern and applicable flags. + * @param regexp A regular expression object that contains the regular expression pattern and applicable flags. */ - match(regexp: RegExp): RegExpMatchArray; + match(regexp: RegExp): RegExpMatchArray | null; /** * Replaces text in a string, using a regular expression or search string. @@ -359,40 +358,40 @@ interface String { /** * Finds the first substring match in a regular expression search. - * @param regexp The regular expression pattern and applicable flags. + * @param regexp The regular expression pattern and applicable flags. */ search(regexp: string): number; /** * Finds the first substring match in a regular expression search. - * @param regexp The regular expression pattern and applicable flags. + * @param regexp The regular expression pattern and applicable flags. */ search(regexp: RegExp): number; /** * Returns a section of a string. - * @param start The index to the beginning of the specified portion of stringObj. - * @param end The index to the end of the specified portion of stringObj. The substring includes the characters up to, but not including, the character indicated by end. + * @param start The index to the beginning of the specified portion of stringObj. + * @param end The index to the end of the specified portion of stringObj. The substring includes the characters up to, but not including, the character indicated by end. * If this value is not specified, the substring continues to the end of stringObj. */ slice(start?: number, end?: number): string; /** * Split a string into substrings using the specified separator and return them as an array. - * @param separator A string that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. + * @param separator A string that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. * @param limit A value used to limit the number of elements returned in the array. */ split(separator: string, limit?: number): string[]; /** * Split a string into substrings using the specified separator and return them as an array. - * @param separator A Regular Express that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. + * @param separator A Regular Express that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. * @param limit A value used to limit the number of elements returned in the array. */ split(separator: RegExp, limit?: number): string[]; /** - * Returns the substring at the specified location within a String object. + * Returns the substring at the specified location within a String object. * @param start The zero-based index number indicating the beginning of the substring. * @param end Zero-based index number indicating the end of the substring. The substring includes the characters up to, but not including, the character indicated by end. * If end is omitted, the characters from start through the end of the original string are returned. @@ -415,7 +414,7 @@ interface String { trim(): string; /** Returns the length of a String object. */ - length: number; + readonly length: number; // IE extensions /** @@ -428,20 +427,20 @@ interface String { /** Returns the primitive value of the specified object. */ valueOf(): string; - [index: number]: string; + readonly [index: number]: string; } interface StringConstructor { new (value?: any): String; (value?: any): string; - prototype: String; + readonly prototype: String; fromCharCode(...codes: number[]): string; } -/** - * Allows manipulation and formatting of text strings and determination and location of substrings within strings. +/** + * Allows manipulation and formatting of text strings and determination and location of substrings within strings. */ -declare var String: StringConstructor; +declare const String: StringConstructor; interface Boolean { /** Returns the primitive value of the specified object. */ @@ -451,10 +450,10 @@ interface Boolean { interface BooleanConstructor { new (value?: any): Boolean; (value?: any): boolean; - prototype: Boolean; + readonly prototype: Boolean; } -declare var Boolean: BooleanConstructor; +declare const Boolean: BooleanConstructor; interface Number { /** @@ -463,7 +462,7 @@ interface Number { */ toString(radix?: number): string; - /** + /** * Returns a string representing a number in fixed-point notation. * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive. */ @@ -488,75 +487,75 @@ interface Number { interface NumberConstructor { new (value?: any): Number; (value?: any): number; - prototype: Number; + readonly prototype: Number; /** The largest number that can be represented in JavaScript. Equal to approximately 1.79E+308. */ - MAX_VALUE: number; + readonly MAX_VALUE: number; /** The closest number to zero that can be represented in JavaScript. Equal to approximately 5.00E-324. */ - MIN_VALUE: number; + readonly MIN_VALUE: number; - /** + /** * A value that is not a number. * In equality comparisons, NaN does not equal any value, including itself. To test whether a value is equivalent to NaN, use the isNaN function. */ - NaN: number; - - /** - * A value that is less than the largest negative number that can be represented in JavaScript. - * JavaScript displays NEGATIVE_INFINITY values as -infinity. - */ - NEGATIVE_INFINITY: number; + readonly NaN: number; /** - * A value greater than the largest number that can be represented in JavaScript. - * JavaScript displays POSITIVE_INFINITY values as infinity. + * A value that is less than the largest negative number that can be represented in JavaScript. + * JavaScript displays NEGATIVE_INFINITY values as -infinity. */ - POSITIVE_INFINITY: number; + readonly NEGATIVE_INFINITY: number; + + /** + * A value greater than the largest number that can be represented in JavaScript. + * JavaScript displays POSITIVE_INFINITY values as infinity. + */ + readonly POSITIVE_INFINITY: number; } /** An object that represents a number of any kind. All JavaScript numbers are 64-bit floating-point numbers. */ -declare var Number: NumberConstructor; +declare const Number: NumberConstructor; interface TemplateStringsArray extends Array { - raw: string[]; + readonly raw: string[]; } interface Math { /** The mathematical constant e. This is Euler's number, the base of natural logarithms. */ - E: number; + readonly E: number; /** The natural logarithm of 10. */ - LN10: number; + readonly LN10: number; /** The natural logarithm of 2. */ - LN2: number; + readonly LN2: number; /** The base-2 logarithm of e. */ - LOG2E: number; + readonly LOG2E: number; /** The base-10 logarithm of e. */ - LOG10E: number; + readonly LOG10E: number; /** Pi. This is the ratio of the circumference of a circle to its diameter. */ - PI: number; + readonly PI: number; /** The square root of 0.5, or, equivalently, one divided by the square root of 2. */ - SQRT1_2: number; + readonly SQRT1_2: number; /** The square root of 2. */ - SQRT2: number; + readonly SQRT2: number; /** - * Returns the absolute value of a number (the value without regard to whether it is positive or negative). + * Returns the absolute value of a number (the value without regard to whether it is positive or negative). * For example, the absolute value of -5 is the same as the absolute value of 5. * @param x A numeric expression for which the absolute value is needed. */ abs(x: number): number; /** - * Returns the arc cosine (or inverse cosine) of a number. + * Returns the arc cosine (or inverse cosine) of a number. * @param x A numeric expression. */ acos(x: number): number; - /** - * Returns the arcsine of a number. + /** + * Returns the arcsine of a number. * @param x A numeric expression. */ asin(x: number): number; /** - * Returns the arctangent of a number. + * Returns the arctangent of a number. * @param x A numeric expression for which the arctangent is needed. */ atan(x: number): number; @@ -567,49 +566,49 @@ interface Math { */ atan2(y: number, x: number): number; /** - * Returns the smallest number greater than or equal to its numeric argument. + * Returns the smallest number greater than or equal to its numeric argument. * @param x A numeric expression. */ ceil(x: number): number; /** - * Returns the cosine of a number. + * Returns the cosine of a number. * @param x A numeric expression that contains an angle measured in radians. */ cos(x: number): number; /** - * Returns e (the base of natural logarithms) raised to a power. + * Returns e (the base of natural logarithms) raised to a power. * @param x A numeric expression representing the power of e. */ exp(x: number): number; /** - * Returns the greatest number less than or equal to its numeric argument. + * Returns the greatest number less than or equal to its numeric argument. * @param x A numeric expression. */ floor(x: number): number; /** - * Returns the natural logarithm (base e) of a number. + * Returns the natural logarithm (base e) of a number. * @param x A numeric expression. */ log(x: number): number; /** - * Returns the larger of a set of supplied numeric expressions. + * Returns the larger of a set of supplied numeric expressions. * @param values Numeric expressions to be evaluated. */ max(...values: number[]): number; /** - * Returns the smaller of a set of supplied numeric expressions. + * Returns the smaller of a set of supplied numeric expressions. * @param values Numeric expressions to be evaluated. */ min(...values: number[]): number; /** - * Returns the value of a base expression taken to a specified power. + * Returns the value of a base expression taken to a specified power. * @param x The base value of the expression. * @param y The exponent value of the expression. */ pow(x: number, y: number): number; /** Returns a pseudorandom number between 0 and 1. */ random(): number; - /** + /** * Returns a supplied numeric expression rounded to the nearest number. * @param x The value to be rounded to the nearest number. */ @@ -631,7 +630,7 @@ interface Math { tan(x: number): number; } /** An intrinsic object that provides basic mathematics functionality and constants. */ -declare var Math: Math; +declare const Math: Math; /** Enables basic storage and retrieval of dates and times. */ interface Date { @@ -685,24 +684,24 @@ interface Date { getUTCMilliseconds(): number; /** Gets the difference in minutes between the time on the local computer and Universal Coordinated Time (UTC). */ getTimezoneOffset(): number; - /** + /** * Sets the date and time value in the Date object. - * @param time A numeric value representing the number of elapsed milliseconds since midnight, January 1, 1970 GMT. + * @param time A numeric value representing the number of elapsed milliseconds since midnight, January 1, 1970 GMT. */ setTime(time: number): number; /** - * Sets the milliseconds value in the Date object using local time. + * Sets the milliseconds value in the Date object using local time. * @param ms A numeric value equal to the millisecond value. */ setMilliseconds(ms: number): number; - /** + /** * Sets the milliseconds value in the Date object using Universal Coordinated Time (UTC). - * @param ms A numeric value equal to the millisecond value. + * @param ms A numeric value equal to the millisecond value. */ setUTCMilliseconds(ms: number): number; /** - * Sets the seconds value in the Date object using local time. + * Sets the seconds value in the Date object using local time. * @param sec A numeric value equal to the seconds value. * @param ms A numeric value equal to the milliseconds value. */ @@ -714,16 +713,16 @@ interface Date { */ setUTCSeconds(sec: number, ms?: number): number; /** - * Sets the minutes value in the Date object using local time. - * @param min A numeric value equal to the minutes value. - * @param sec A numeric value equal to the seconds value. + * Sets the minutes value in the Date object using local time. + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. * @param ms A numeric value equal to the milliseconds value. */ setMinutes(min: number, sec?: number, ms?: number): number; /** * Sets the minutes value in the Date object using Universal Coordinated Time (UTC). - * @param min A numeric value equal to the minutes value. - * @param sec A numeric value equal to the seconds value. + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. * @param ms A numeric value equal to the milliseconds value. */ setUTCMinutes(min: number, sec?: number, ms?: number): number; @@ -731,7 +730,7 @@ interface Date { * Sets the hour value in the Date object using local time. * @param hours A numeric value equal to the hours value. * @param min A numeric value equal to the minutes value. - * @param sec A numeric value equal to the seconds value. + * @param sec A numeric value equal to the seconds value. * @param ms A numeric value equal to the milliseconds value. */ setHours(hours: number, min?: number, sec?: number, ms?: number): number; @@ -739,23 +738,23 @@ interface Date { * Sets the hours value in the Date object using Universal Coordinated Time (UTC). * @param hours A numeric value equal to the hours value. * @param min A numeric value equal to the minutes value. - * @param sec A numeric value equal to the seconds value. + * @param sec A numeric value equal to the seconds value. * @param ms A numeric value equal to the milliseconds value. */ setUTCHours(hours: number, min?: number, sec?: number, ms?: number): number; /** - * Sets the numeric day-of-the-month value of the Date object using local time. + * Sets the numeric day-of-the-month value of the Date object using local time. * @param date A numeric value equal to the day of the month. */ setDate(date: number): number; - /** + /** * Sets the numeric day of the month in the Date object using Universal Coordinated Time (UTC). - * @param date A numeric value equal to the day of the month. + * @param date A numeric value equal to the day of the month. */ setUTCDate(date: number): number; - /** - * Sets the month value in the Date object using local time. - * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. + /** + * Sets the month value in the Date object using local time. + * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. * @param date A numeric value representing the day of the month. If this value is not supplied, the value from a call to the getDate method is used. */ setMonth(month: number, date?: number): number; @@ -793,14 +792,14 @@ interface DateConstructor { new (value: string): Date; new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; (): string; - prototype: Date; + readonly prototype: Date; /** * Parses a string containing a date, and returns the number of milliseconds between that date and midnight, January 1, 1970. * @param s A date string */ parse(s: string): number; /** - * Returns the number of milliseconds between midnight, January 1, 1970 Universal Coordinated Time (UTC) (or GMT) and the specified date. + * Returns the number of milliseconds between midnight, January 1, 1970 Universal Coordinated Time (UTC) (or GMT) and the specified date. * @param year The full year designation is required for cross-century date accuracy. If year is between 0 and 99 is used, then year is assumed to be 1900 + year. * @param month The month as an number between 0 and 11 (January to December). * @param date The date as an number between 1 and 31. @@ -813,7 +812,7 @@ interface DateConstructor { now(): number; } -declare var Date: DateConstructor; +declare const Date: DateConstructor; interface RegExpMatchArray extends Array { index?: number; @@ -826,40 +825,42 @@ interface RegExpExecArray extends Array { } interface RegExp { - /** + /** * Executes a search on a string using a regular expression pattern, and returns an array containing the results of that search. * @param string The String object or string literal on which to perform the search. */ - exec(string: string): RegExpExecArray; + exec(string: string): RegExpExecArray | null; - /** + /** * Returns a Boolean value that indicates whether or not a pattern exists in a searched string. * @param string String on which to perform the search. */ test(string: string): boolean; /** Returns a copy of the text of the regular expression pattern. Read-only. The regExp argument is a Regular expression object. It can be a variable name or a literal. */ - source: string; + readonly source: string; /** Returns a Boolean value indicating the state of the global flag (g) used with a regular expression. Default is false. Read-only. */ - global: boolean; + readonly global: boolean; /** Returns a Boolean value indicating the state of the ignoreCase flag (i) used with a regular expression. Default is false. Read-only. */ - ignoreCase: boolean; + readonly ignoreCase: boolean; /** Returns a Boolean value indicating the state of the multiline flag (m) used with a regular expression. Default is false. Read-only. */ - multiline: boolean; + readonly multiline: boolean; lastIndex: number; // Non-standard extensions - compile(): RegExp; + compile(): this; } interface RegExpConstructor { + new (pattern: RegExp): RegExp; new (pattern: string, flags?: string): RegExp; + (pattern: RegExp): RegExp; (pattern: string, flags?: string): RegExp; - prototype: RegExp; + readonly prototype: RegExp; // Non-standard extensions $1: string; @@ -874,20 +875,21 @@ interface RegExpConstructor { lastMatch: string; } -declare var RegExp: RegExpConstructor; +declare const RegExp: RegExpConstructor; interface Error { name: string; message: string; + stack?: string; } interface ErrorConstructor { new (message?: string): Error; (message?: string): Error; - prototype: Error; + readonly prototype: Error; } -declare var Error: ErrorConstructor; +declare const Error: ErrorConstructor; interface EvalError extends Error { } @@ -895,10 +897,10 @@ interface EvalError extends Error { interface EvalErrorConstructor { new (message?: string): EvalError; (message?: string): EvalError; - prototype: EvalError; + readonly prototype: EvalError; } -declare var EvalError: EvalErrorConstructor; +declare const EvalError: EvalErrorConstructor; interface RangeError extends Error { } @@ -906,10 +908,10 @@ interface RangeError extends Error { interface RangeErrorConstructor { new (message?: string): RangeError; (message?: string): RangeError; - prototype: RangeError; + readonly prototype: RangeError; } -declare var RangeError: RangeErrorConstructor; +declare const RangeError: RangeErrorConstructor; interface ReferenceError extends Error { } @@ -917,10 +919,10 @@ interface ReferenceError extends Error { interface ReferenceErrorConstructor { new (message?: string): ReferenceError; (message?: string): ReferenceError; - prototype: ReferenceError; + readonly prototype: ReferenceError; } -declare var ReferenceError: ReferenceErrorConstructor; +declare const ReferenceError: ReferenceErrorConstructor; interface SyntaxError extends Error { } @@ -928,10 +930,10 @@ interface SyntaxError extends Error { interface SyntaxErrorConstructor { new (message?: string): SyntaxError; (message?: string): SyntaxError; - prototype: SyntaxError; + readonly prototype: SyntaxError; } -declare var SyntaxError: SyntaxErrorConstructor; +declare const SyntaxError: SyntaxErrorConstructor; interface TypeError extends Error { } @@ -939,10 +941,10 @@ interface TypeError extends Error { interface TypeErrorConstructor { new (message?: string): TypeError; (message?: string): TypeError; - prototype: TypeError; + readonly prototype: TypeError; } -declare var TypeError: TypeErrorConstructor; +declare const TypeError: TypeErrorConstructor; interface URIError extends Error { } @@ -950,17 +952,17 @@ interface URIError extends Error { interface URIErrorConstructor { new (message?: string): URIError; (message?: string): URIError; - prototype: URIError; + readonly prototype: URIError; } -declare var URIError: URIErrorConstructor; +declare const URIError: URIErrorConstructor; interface JSON { /** * Converts a JavaScript Object Notation (JSON) string into an object. * @param text A valid JSON string. - * @param reviver A function that transforms the results. This function is called for each member of the object. - * If a member contains nested objects, the nested objects are transformed before the parent object is. + * @param reviver A function that transforms the results. This function is called for each member of the object. + * If a member contains nested objects, the nested objects are transformed before the parent object is. */ parse(text: string, reviver?: (key: any, value: any) => any): any; /** @@ -998,13 +1000,115 @@ interface JSON { /** * An intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format. */ -declare var JSON: JSON; +declare const JSON: JSON; ///////////////////////////// /// ECMAScript Array API (specially handled by compiler) ///////////////////////////// +interface ReadonlyArray { + /** + * Gets the length of the array. This is a number one higher than the highest element defined in an array. + */ + readonly length: number; + /** + * Returns a string representation of an array. + */ + toString(): string; + toLocaleString(): string; + /** + * Combines two or more arrays. + * @param items Additional items to add to the end of array1. + */ + concat>(...items: U[]): T[]; + /** + * Combines two or more arrays. + * @param items Additional items to add to the end of array1. + */ + concat(...items: T[]): T[]; + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): T[]; + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. + */ + indexOf(searchElement: T, fromIndex?: number): number; + + /** + * Returns the index of the last occurrence of a specified value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array. + */ + lastIndexOf(searchElement: T, fromIndex?: number): number; + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: T, index: number, array: ReadonlyArray) => boolean, thisArg?: any): boolean; + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: T, index: number, array: ReadonlyArray) => boolean, thisArg?: any): boolean; + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: T, index: number, array: ReadonlyArray) => void, thisArg?: any): void; + /** + * Calls a defined callback function on each element of an array, and returns an array that contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: T, index: number, array: ReadonlyArray) => U, thisArg?: any): U[]; + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (value: T, index: number, array: ReadonlyArray) => any, thisArg?: any): T[]; + /** + * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: ReadonlyArray) => T, initialValue?: T): T; + /** + * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: ReadonlyArray) => U, initialValue: U): U; + /** + * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: ReadonlyArray) => T, initialValue?: T): T; + /** + * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: ReadonlyArray) => U, initialValue: U): U; + + readonly [n: number]: T; +} + interface Array { /** * Gets or sets the length of the array. This is a number one higher than the highest element defined in an array. @@ -1023,49 +1127,41 @@ interface Array { /** * Removes the last element from an array and returns it. */ - pop(): T; + pop(): T | undefined; /** * Combines two or more arrays. * @param items Additional items to add to the end of array1. */ - concat(...items: U[]): T[]; - /** - * Combines two or more arrays. - * @param items Additional items to add to the end of array1. - */ - concat(...items: T[]): T[]; + concat(...items: (T | T[])[]): T[]; /** * Adds all the elements of an array separated by the specified separator string. * @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): T[]; /** * Removes the first element from an array and returns it. */ - shift(): T; - /** + shift(): T | undefined; + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. */ slice(start?: number, end?: number): T[]; - /** * Sorts an array. * @param compareFn The name of the function used to determine the order of the elements. If omitted, the elements are sorted in ascending, ASCII character order. */ - sort(compareFn?: (a: T, b: T) => number): T[]; - + sort(compareFn?: (a: T, b: T) => number): this; /** * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. * @param start The zero-based location in the array from which to start removing elements. */ splice(start: number): T[]; - /** * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. * @param start The zero-based location in the array from which to start removing elements. @@ -1073,62 +1169,53 @@ interface Array { * @param items Elements to insert into the array in place of the deleted elements. */ splice(start: number, deleteCount: number, ...items: T[]): T[]; - /** * Inserts new elements at the start of an array. * @param items Elements to insert at the start of the Array. */ unshift(...items: T[]): number; - /** * Returns the index of the first occurrence of a value in an array. * @param searchElement The value to locate in the array. * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. */ indexOf(searchElement: T, fromIndex?: number): number; - /** * Returns the index of the last occurrence of a specified value in an array. * @param searchElement The value to locate in the array. * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array. */ lastIndexOf(searchElement: T, fromIndex?: number): number; - /** * Determines whether all the members of an array satisfy the specified test. * @param callbackfn A function that accepts up to three arguments. The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. */ every(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; - /** * Determines whether the specified callback function returns true for any element of an array. * @param callbackfn A function that accepts up to three arguments. The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; - /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void; - /** * Calls a defined callback function on each element of an array, and returns an array that contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. + * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[]; - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. */ - filter(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): T[]; - + filter(callbackfn: (value: T, index: number, array: T[]) => any, thisArg?: any): T[]; /** * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. @@ -1141,16 +1228,15 @@ interface Array { * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; - - /** + /** * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. */ reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; - /** + /** * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; @@ -1166,10 +1252,10 @@ interface ArrayConstructor { (arrayLength: number): T[]; (...items: T[]): T[]; isArray(arg: any): arg is Array; - prototype: Array; + readonly prototype: Array; } -declare var Array: ArrayConstructor; +declare const Array: ArrayConstructor; interface TypedPropertyDescriptor { enumerable?: boolean; @@ -1199,22 +1285,21 @@ interface PromiseLike { } interface ArrayLike { - length: number; - [n: number]: T; + readonly length: number; + readonly [n: number]: T; } - /** - * Represents a raw buffer of binary data, which is used to store data for the - * different typed arrays. ArrayBuffers cannot be read from or written to directly, - * but can be passed to a typed array or DataView Object to interpret the raw - * buffer as needed. + * Represents a raw buffer of binary data, which is used to store data for the + * different typed arrays. ArrayBuffers cannot be read from or written to directly, + * but can be passed to a typed array or DataView Object to interpret the raw + * buffer as needed. */ interface ArrayBuffer { /** * Read-only. The length of the ArrayBuffer (in bytes). */ - byteLength: number; + readonly byteLength: number; /** * Returns a section of an ArrayBuffer. @@ -1223,15 +1308,15 @@ interface ArrayBuffer { } interface ArrayBufferConstructor { - prototype: ArrayBuffer; + readonly prototype: ArrayBuffer; new (byteLength: number): ArrayBuffer; isView(arg: any): arg is ArrayBufferView; } -declare var ArrayBuffer: ArrayBufferConstructor; +declare const ArrayBuffer: ArrayBufferConstructor; interface ArrayBufferView { /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ buffer: ArrayBuffer; @@ -1247,128 +1332,128 @@ interface ArrayBufferView { } interface DataView { - buffer: ArrayBuffer; - byteLength: number; - byteOffset: number; + readonly buffer: ArrayBuffer; + readonly byteLength: number; + readonly byteOffset: number; /** - * Gets the Float32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. + * Gets the Float32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. * @param byteOffset The place in the buffer at which the value should be retrieved. */ getFloat32(byteOffset: number, littleEndian?: boolean): number; /** * Gets the Float64 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. + * no alignment constraint; multi-byte values may be fetched from any offset. * @param byteOffset The place in the buffer at which the value should be retrieved. */ getFloat64(byteOffset: number, littleEndian?: boolean): number; /** - * Gets the Int8 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. + * Gets the Int8 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. * @param byteOffset The place in the buffer at which the value should be retrieved. */ getInt8(byteOffset: number): number; /** - * Gets the Int16 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. + * Gets the Int16 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. * @param byteOffset The place in the buffer at which the value should be retrieved. */ getInt16(byteOffset: number, littleEndian?: boolean): number; /** - * Gets the Int32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. + * Gets the Int32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. * @param byteOffset The place in the buffer at which the value should be retrieved. */ getInt32(byteOffset: number, littleEndian?: boolean): number; /** - * Gets the Uint8 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. + * Gets the Uint8 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. * @param byteOffset The place in the buffer at which the value should be retrieved. */ getUint8(byteOffset: number): number; /** - * Gets the Uint16 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. + * Gets the Uint16 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. * @param byteOffset The place in the buffer at which the value should be retrieved. */ getUint16(byteOffset: number, littleEndian?: boolean): number; /** - * Gets the Uint32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. + * Gets the Uint32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. * @param byteOffset The place in the buffer at which the value should be retrieved. */ getUint32(byteOffset: number, littleEndian?: boolean): number; /** - * Stores an Float32 value at the specified byte offset from the start of the view. + * Stores an Float32 value at the specified byte offset from the start of the view. * @param byteOffset The place in the buffer at which the value should be set. * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, + * @param littleEndian If false or undefined, a big-endian value should be written, * otherwise a little-endian value should be written. */ setFloat32(byteOffset: number, value: number, littleEndian?: boolean): void; /** - * Stores an Float64 value at the specified byte offset from the start of the view. + * Stores an Float64 value at the specified byte offset from the start of the view. * @param byteOffset The place in the buffer at which the value should be set. * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, + * @param littleEndian If false or undefined, a big-endian value should be written, * otherwise a little-endian value should be written. */ setFloat64(byteOffset: number, value: number, littleEndian?: boolean): void; /** - * Stores an Int8 value at the specified byte offset from the start of the view. + * Stores an Int8 value at the specified byte offset from the start of the view. * @param byteOffset The place in the buffer at which the value should be set. * @param value The value to set. */ setInt8(byteOffset: number, value: number): void; /** - * Stores an Int16 value at the specified byte offset from the start of the view. + * Stores an Int16 value at the specified byte offset from the start of the view. * @param byteOffset The place in the buffer at which the value should be set. * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, + * @param littleEndian If false or undefined, a big-endian value should be written, * otherwise a little-endian value should be written. */ setInt16(byteOffset: number, value: number, littleEndian?: boolean): void; /** - * Stores an Int32 value at the specified byte offset from the start of the view. + * Stores an Int32 value at the specified byte offset from the start of the view. * @param byteOffset The place in the buffer at which the value should be set. * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, + * @param littleEndian If false or undefined, a big-endian value should be written, * otherwise a little-endian value should be written. */ setInt32(byteOffset: number, value: number, littleEndian?: boolean): void; /** - * Stores an Uint8 value at the specified byte offset from the start of the view. + * Stores an Uint8 value at the specified byte offset from the start of the view. * @param byteOffset The place in the buffer at which the value should be set. * @param value The value to set. */ setUint8(byteOffset: number, value: number): void; /** - * Stores an Uint16 value at the specified byte offset from the start of the view. + * Stores an Uint16 value at the specified byte offset from the start of the view. * @param byteOffset The place in the buffer at which the value should be set. * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, + * @param littleEndian If false or undefined, a big-endian value should be written, * otherwise a little-endian value should be written. */ setUint16(byteOffset: number, value: number, littleEndian?: boolean): void; /** - * Stores an Uint32 value at the specified byte offset from the start of the view. + * Stores an Uint32 value at the specified byte offset from the start of the view. * @param byteOffset The place in the buffer at which the value should be set. * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, + * @param littleEndian If false or undefined, a big-endian value should be written, * otherwise a little-endian value should be written. */ setUint32(byteOffset: number, value: number, littleEndian?: boolean): void; @@ -1377,48 +1462,48 @@ interface DataView { interface DataViewConstructor { new (buffer: ArrayBuffer, byteOffset?: number, byteLength?: number): DataView; } -declare var DataView: DataViewConstructor; +declare const DataView: DataViewConstructor; /** - * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested + * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested * number of bytes could not be allocated an exception is raised. */ interface Int8Array { /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ - BYTES_PER_ELEMENT: number; + readonly BYTES_PER_ELEMENT: number; /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ - buffer: ArrayBuffer; + readonly buffer: ArrayBuffer; /** * The length in bytes of the array. */ - byteLength: number; + readonly byteLength: number; /** * The offset in bytes of the array. */ - byteOffset: number; + readonly byteOffset: number; - /** + /** * Returns the this object after copying a section of the array identified by start and end * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * @param end If not specified, length of the this object is used as its default value. */ - copyWithin(target: number, start: number, end?: number): Int8Array; + copyWithin(target: number, start: number, end?: number): this; /** * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, * or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. @@ -1428,49 +1513,49 @@ interface Int8Array { /** * Returns the this object after filling the section identified by start and end with value * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ - fill(value: number, start?: number, end?: number): Int8Array; + fill(value: number, start?: number, end?: number): this; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - filter(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): Int8Array; + filter(callbackfn: (value: number, index: number, array: Int8Array) => any, thisArg?: any): Int8Array; - /** - * Returns the value of the first element in the array where predicate is true, and undefined + /** + * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; - /** - * Returns the index of the first element in the array where predicate is true, and undefined + /** + * Returns the index of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ findIndex(predicate: (value: number) => boolean, thisArg?: any): number; /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: number, index: number, array: Int8Array) => void, thisArg?: any): void; @@ -1485,7 +1570,7 @@ interface Int8Array { /** * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the + * @param separator A string used to separate one element of an array from the next in the * resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; @@ -1493,7 +1578,7 @@ interface Int8Array { /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the * search starts at index 0. */ lastIndexOf(searchElement: number, fromIndex?: number): number; @@ -1501,68 +1586,68 @@ interface Int8Array { /** * The length of the array. */ - length: number; + readonly length: number; /** - * Calls a defined callback function on each element of an array, and returns an array that + * Calls a defined callback function on each element of an array, and returns an array that * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: number, index: number, array: Int8Array) => number, thisArg?: any): Int8Array; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): Int8Array; @@ -1580,7 +1665,7 @@ interface Int8Array { */ set(array: ArrayLike, offset?: number): void; - /** + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. @@ -1589,31 +1674,31 @@ interface Int8Array { /** * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean; /** * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If + * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ - sort(compareFn?: (a: number, b: number) => number): Int8Array; + sort(compareFn?: (a: number, b: number) => number): this; /** * Gets a new Int8Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. + * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ subarray(begin: number, end?: number): Int8Array; /** - * Converts a number to a string by using the current locale. + * Converts a number to a string by using the current locale. */ toLocaleString(): string; @@ -1625,22 +1710,22 @@ interface Int8Array { [index: number]: number; } interface Int8ArrayConstructor { - prototype: Int8Array; + readonly prototype: Int8Array; new (length: number): Int8Array; new (array: ArrayLike): Int8Array; new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int8Array; /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ - BYTES_PER_ELEMENT: number; + readonly BYTES_PER_ELEMENT: number; /** * Returns a new array from a set of elements. * @param items A set of elements to include in the new array object. */ of(...items: number[]): Int8Array; - + /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. @@ -1650,48 +1735,48 @@ interface Int8ArrayConstructor { from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array; } -declare var Int8Array: Int8ArrayConstructor; +declare const Int8Array: Int8ArrayConstructor; /** - * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the + * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the * requested number of bytes could not be allocated an exception is raised. */ interface Uint8Array { /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ - BYTES_PER_ELEMENT: number; + readonly BYTES_PER_ELEMENT: number; /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ - buffer: ArrayBuffer; + readonly buffer: ArrayBuffer; /** * The length in bytes of the array. */ - byteLength: number; + readonly byteLength: number; /** * The offset in bytes of the array. */ - byteOffset: number; + readonly byteOffset: number; - /** + /** * Returns the this object after copying a section of the array identified by start and end * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * @param end If not specified, length of the this object is used as its default value. */ - copyWithin(target: number, start: number, end?: number): Uint8Array; + copyWithin(target: number, start: number, end?: number): this; /** * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, * or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. @@ -1701,49 +1786,49 @@ interface Uint8Array { /** * Returns the this object after filling the section identified by start and end with value * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ - fill(value: number, start?: number, end?: number): Uint8Array; + fill(value: number, start?: number, end?: number): this; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - filter(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): Uint8Array; + filter(callbackfn: (value: number, index: number, array: Uint8Array) => any, thisArg?: any): Uint8Array; - /** - * Returns the value of the first element in the array where predicate is true, and undefined + /** + * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; - /** - * Returns the index of the first element in the array where predicate is true, and undefined + /** + * Returns the index of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ findIndex(predicate: (value: number) => boolean, thisArg?: any): number; /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: number, index: number, array: Uint8Array) => void, thisArg?: any): void; @@ -1758,7 +1843,7 @@ interface Uint8Array { /** * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the + * @param separator A string used to separate one element of an array from the next in the * resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; @@ -1766,7 +1851,7 @@ interface Uint8Array { /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the * search starts at index 0. */ lastIndexOf(searchElement: number, fromIndex?: number): number; @@ -1774,68 +1859,68 @@ interface Uint8Array { /** * The length of the array. */ - length: number; + readonly length: number; /** - * Calls a defined callback function on each element of an array, and returns an array that + * Calls a defined callback function on each element of an array, and returns an array that * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: number, index: number, array: Uint8Array) => number, thisArg?: any): Uint8Array; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): Uint8Array; @@ -1853,7 +1938,7 @@ interface Uint8Array { */ set(array: ArrayLike, offset?: number): void; - /** + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. @@ -1862,31 +1947,31 @@ interface Uint8Array { /** * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean; /** * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If + * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ - sort(compareFn?: (a: number, b: number) => number): Uint8Array; + sort(compareFn?: (a: number, b: number) => number): this; /** * Gets a new Uint8Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. + * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ subarray(begin: number, end?: number): Uint8Array; /** - * Converts a number to a string by using the current locale. + * Converts a number to a string by using the current locale. */ toLocaleString(): string; @@ -1899,22 +1984,22 @@ interface Uint8Array { } interface Uint8ArrayConstructor { - prototype: Uint8Array; + readonly prototype: Uint8Array; new (length: number): Uint8Array; new (array: ArrayLike): Uint8Array; new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8Array; /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ - BYTES_PER_ELEMENT: number; + readonly BYTES_PER_ELEMENT: number; /** * Returns a new array from a set of elements. * @param items A set of elements to include in the new array object. */ of(...items: number[]): Uint8Array; - + /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. @@ -1924,48 +2009,48 @@ interface Uint8ArrayConstructor { from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array; } -declare var Uint8Array: Uint8ArrayConstructor; +declare const Uint8Array: Uint8ArrayConstructor; /** - * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. + * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. * If the requested number of bytes could not be allocated an exception is raised. */ interface Uint8ClampedArray { /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ - BYTES_PER_ELEMENT: number; + readonly BYTES_PER_ELEMENT: number; /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ - buffer: ArrayBuffer; + readonly buffer: ArrayBuffer; /** * The length in bytes of the array. */ - byteLength: number; + readonly byteLength: number; /** * The offset in bytes of the array. */ - byteOffset: number; + readonly byteOffset: number; - /** + /** * Returns the this object after copying a section of the array identified by start and end * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * @param end If not specified, length of the this object is used as its default value. */ - copyWithin(target: number, start: number, end?: number): Uint8ClampedArray; + copyWithin(target: number, start: number, end?: number): this; /** * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, * or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. @@ -1975,49 +2060,49 @@ interface Uint8ClampedArray { /** * Returns the this object after filling the section identified by start and end with value * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ - fill(value: number, start?: number, end?: number): Uint8ClampedArray; + fill(value: number, start?: number, end?: number): this; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - filter(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): Uint8ClampedArray; + filter(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => any, thisArg?: any): Uint8ClampedArray; - /** - * Returns the value of the first element in the array where predicate is true, and undefined + /** + * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; - /** - * Returns the index of the first element in the array where predicate is true, and undefined + /** + * Returns the index of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ findIndex(predicate: (value: number) => boolean, thisArg?: any): number; /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => void, thisArg?: any): void; @@ -2032,7 +2117,7 @@ interface Uint8ClampedArray { /** * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the + * @param separator A string used to separate one element of an array from the next in the * resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; @@ -2040,7 +2125,7 @@ interface Uint8ClampedArray { /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the * search starts at index 0. */ lastIndexOf(searchElement: number, fromIndex?: number): number; @@ -2048,68 +2133,68 @@ interface Uint8ClampedArray { /** * The length of the array. */ - length: number; + readonly length: number; /** - * Calls a defined callback function on each element of an array, and returns an array that + * Calls a defined callback function on each element of an array, and returns an array that * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => number, thisArg?: any): Uint8ClampedArray; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): Uint8ClampedArray; @@ -2127,7 +2212,7 @@ interface Uint8ClampedArray { */ set(array: Uint8ClampedArray, offset?: number): void; - /** + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. @@ -2136,31 +2221,31 @@ interface Uint8ClampedArray { /** * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): boolean; /** * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If + * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ - sort(compareFn?: (a: number, b: number) => number): Uint8ClampedArray; + sort(compareFn?: (a: number, b: number) => number): this; /** * Gets a new Uint8ClampedArray view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. + * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ subarray(begin: number, end?: number): Uint8ClampedArray; /** - * Converts a number to a string by using the current locale. + * Converts a number to a string by using the current locale. */ toLocaleString(): string; @@ -2173,15 +2258,15 @@ interface Uint8ClampedArray { } interface Uint8ClampedArrayConstructor { - prototype: Uint8ClampedArray; + readonly prototype: Uint8ClampedArray; new (length: number): Uint8ClampedArray; new (array: ArrayLike): Uint8ClampedArray; new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8ClampedArray; /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ - BYTES_PER_ELEMENT: number; + readonly BYTES_PER_ELEMENT: number; /** * Returns a new array from a set of elements. @@ -2197,48 +2282,48 @@ interface Uint8ClampedArrayConstructor { */ from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray; } -declare var Uint8ClampedArray: Uint8ClampedArrayConstructor; +declare const Uint8ClampedArray: Uint8ClampedArrayConstructor; /** - * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the + * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the * requested number of bytes could not be allocated an exception is raised. */ interface Int16Array { /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ - BYTES_PER_ELEMENT: number; + readonly BYTES_PER_ELEMENT: number; /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ - buffer: ArrayBuffer; + readonly buffer: ArrayBuffer; /** * The length in bytes of the array. */ - byteLength: number; + readonly byteLength: number; /** * The offset in bytes of the array. */ - byteOffset: number; + readonly byteOffset: number; - /** + /** * Returns the this object after copying a section of the array identified by start and end * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * @param end If not specified, length of the this object is used as its default value. */ - copyWithin(target: number, start: number, end?: number): Int16Array; + copyWithin(target: number, start: number, end?: number): this; /** * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, * or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. @@ -2248,49 +2333,49 @@ interface Int16Array { /** * Returns the this object after filling the section identified by start and end with value * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ - fill(value: number, start?: number, end?: number): Int16Array; + fill(value: number, start?: number, end?: number): this; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - filter(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): Int16Array; + filter(callbackfn: (value: number, index: number, array: Int16Array) => any, thisArg?: any): Int16Array; - /** - * Returns the value of the first element in the array where predicate is true, and undefined + /** + * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; - /** - * Returns the index of the first element in the array where predicate is true, and undefined + /** + * Returns the index of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ findIndex(predicate: (value: number) => boolean, thisArg?: any): number; /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: number, index: number, array: Int16Array) => void, thisArg?: any): void; @@ -2305,7 +2390,7 @@ interface Int16Array { /** * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the + * @param separator A string used to separate one element of an array from the next in the * resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; @@ -2313,7 +2398,7 @@ interface Int16Array { /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the * search starts at index 0. */ lastIndexOf(searchElement: number, fromIndex?: number): number; @@ -2321,68 +2406,68 @@ interface Int16Array { /** * The length of the array. */ - length: number; + readonly length: number; /** - * Calls a defined callback function on each element of an array, and returns an array that + * Calls a defined callback function on each element of an array, and returns an array that * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: number, index: number, array: Int16Array) => number, thisArg?: any): Int16Array; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): Int16Array; @@ -2400,7 +2485,7 @@ interface Int16Array { */ set(array: ArrayLike, offset?: number): void; - /** + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. @@ -2409,31 +2494,31 @@ interface Int16Array { /** * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean; /** * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If + * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ - sort(compareFn?: (a: number, b: number) => number): Int16Array; + sort(compareFn?: (a: number, b: number) => number): this; /** * Gets a new Int16Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. + * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ subarray(begin: number, end?: number): Int16Array; /** - * Converts a number to a string by using the current locale. + * Converts a number to a string by using the current locale. */ toLocaleString(): string; @@ -2446,22 +2531,22 @@ interface Int16Array { } interface Int16ArrayConstructor { - prototype: Int16Array; + readonly prototype: Int16Array; new (length: number): Int16Array; new (array: ArrayLike): Int16Array; new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int16Array; /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ - BYTES_PER_ELEMENT: number; + readonly BYTES_PER_ELEMENT: number; /** * Returns a new array from a set of elements. * @param items A set of elements to include in the new array object. */ of(...items: number[]): Int16Array; - + /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. @@ -2471,48 +2556,48 @@ interface Int16ArrayConstructor { from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array; } -declare var Int16Array: Int16ArrayConstructor; +declare const Int16Array: Int16ArrayConstructor; /** - * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the + * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the * requested number of bytes could not be allocated an exception is raised. */ interface Uint16Array { /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ - BYTES_PER_ELEMENT: number; + readonly BYTES_PER_ELEMENT: number; /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ - buffer: ArrayBuffer; + readonly buffer: ArrayBuffer; /** * The length in bytes of the array. */ - byteLength: number; + readonly byteLength: number; /** * The offset in bytes of the array. */ - byteOffset: number; + readonly byteOffset: number; - /** + /** * Returns the this object after copying a section of the array identified by start and end * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * @param end If not specified, length of the this object is used as its default value. */ - copyWithin(target: number, start: number, end?: number): Uint16Array; + copyWithin(target: number, start: number, end?: number): this; /** * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, * or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. @@ -2522,49 +2607,49 @@ interface Uint16Array { /** * Returns the this object after filling the section identified by start and end with value * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ - fill(value: number, start?: number, end?: number): Uint16Array; + fill(value: number, start?: number, end?: number): this; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - filter(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): Uint16Array; + filter(callbackfn: (value: number, index: number, array: Uint16Array) => any, thisArg?: any): Uint16Array; - /** - * Returns the value of the first element in the array where predicate is true, and undefined + /** + * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; - /** - * Returns the index of the first element in the array where predicate is true, and undefined + /** + * Returns the index of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ findIndex(predicate: (value: number) => boolean, thisArg?: any): number; /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: number, index: number, array: Uint16Array) => void, thisArg?: any): void; @@ -2579,7 +2664,7 @@ interface Uint16Array { /** * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the + * @param separator A string used to separate one element of an array from the next in the * resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; @@ -2587,7 +2672,7 @@ interface Uint16Array { /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the * search starts at index 0. */ lastIndexOf(searchElement: number, fromIndex?: number): number; @@ -2595,68 +2680,68 @@ interface Uint16Array { /** * The length of the array. */ - length: number; + readonly length: number; /** - * Calls a defined callback function on each element of an array, and returns an array that + * Calls a defined callback function on each element of an array, and returns an array that * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: number, index: number, array: Uint16Array) => number, thisArg?: any): Uint16Array; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): Uint16Array; @@ -2674,7 +2759,7 @@ interface Uint16Array { */ set(array: ArrayLike, offset?: number): void; - /** + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. @@ -2683,31 +2768,31 @@ interface Uint16Array { /** * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean; /** * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If + * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ - sort(compareFn?: (a: number, b: number) => number): Uint16Array; + sort(compareFn?: (a: number, b: number) => number): this; /** * Gets a new Uint16Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. + * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ subarray(begin: number, end?: number): Uint16Array; /** - * Converts a number to a string by using the current locale. + * Converts a number to a string by using the current locale. */ toLocaleString(): string; @@ -2720,22 +2805,22 @@ interface Uint16Array { } interface Uint16ArrayConstructor { - prototype: Uint16Array; + readonly prototype: Uint16Array; new (length: number): Uint16Array; new (array: ArrayLike): Uint16Array; new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint16Array; /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ - BYTES_PER_ELEMENT: number; + readonly BYTES_PER_ELEMENT: number; /** * Returns a new array from a set of elements. * @param items A set of elements to include in the new array object. */ of(...items: number[]): Uint16Array; - + /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. @@ -2745,47 +2830,47 @@ interface Uint16ArrayConstructor { from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array; } -declare var Uint16Array: Uint16ArrayConstructor; +declare const Uint16Array: Uint16ArrayConstructor; /** - * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the + * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the * requested number of bytes could not be allocated an exception is raised. */ interface Int32Array { /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ - BYTES_PER_ELEMENT: number; + readonly BYTES_PER_ELEMENT: number; /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ - buffer: ArrayBuffer; + readonly buffer: ArrayBuffer; /** * The length in bytes of the array. */ - byteLength: number; + readonly byteLength: number; /** * The offset in bytes of the array. */ - byteOffset: number; + readonly byteOffset: number; - /** + /** * Returns the this object after copying a section of the array identified by start and end * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * @param end If not specified, length of the this object is used as its default value. */ - copyWithin(target: number, start: number, end?: number): Int32Array; + copyWithin(target: number, start: number, end?: number): this; /** * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, * or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. @@ -2795,49 +2880,49 @@ interface Int32Array { /** * Returns the this object after filling the section identified by start and end with value * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ - fill(value: number, start?: number, end?: number): Int32Array; + fill(value: number, start?: number, end?: number): this; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - filter(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): Int32Array; + filter(callbackfn: (value: number, index: number, array: Int32Array) => any, thisArg?: any): Int32Array; - /** - * Returns the value of the first element in the array where predicate is true, and undefined + /** + * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; - /** - * Returns the index of the first element in the array where predicate is true, and undefined + /** + * Returns the index of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ findIndex(predicate: (value: number) => boolean, thisArg?: any): number; /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: number, index: number, array: Int32Array) => void, thisArg?: any): void; @@ -2852,7 +2937,7 @@ interface Int32Array { /** * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the + * @param separator A string used to separate one element of an array from the next in the * resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; @@ -2860,7 +2945,7 @@ interface Int32Array { /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the * search starts at index 0. */ lastIndexOf(searchElement: number, fromIndex?: number): number; @@ -2868,68 +2953,68 @@ interface Int32Array { /** * The length of the array. */ - length: number; + readonly length: number; /** - * Calls a defined callback function on each element of an array, and returns an array that + * Calls a defined callback function on each element of an array, and returns an array that * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: number, index: number, array: Int32Array) => number, thisArg?: any): Int32Array; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): Int32Array; @@ -2947,7 +3032,7 @@ interface Int32Array { */ set(array: ArrayLike, offset?: number): void; - /** + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. @@ -2956,31 +3041,31 @@ interface Int32Array { /** * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean; /** * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If + * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ - sort(compareFn?: (a: number, b: number) => number): Int32Array; + sort(compareFn?: (a: number, b: number) => number): this; /** * Gets a new Int32Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. + * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ subarray(begin: number, end?: number): Int32Array; /** - * Converts a number to a string by using the current locale. + * Converts a number to a string by using the current locale. */ toLocaleString(): string; @@ -2993,22 +3078,22 @@ interface Int32Array { } interface Int32ArrayConstructor { - prototype: Int32Array; + readonly prototype: Int32Array; new (length: number): Int32Array; new (array: ArrayLike): Int32Array; new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int32Array; /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ - BYTES_PER_ELEMENT: number; + readonly BYTES_PER_ELEMENT: number; /** * Returns a new array from a set of elements. * @param items A set of elements to include in the new array object. */ of(...items: number[]): Int32Array; - + /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. @@ -3017,48 +3102,48 @@ interface Int32ArrayConstructor { */ from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array; } -declare var Int32Array: Int32ArrayConstructor; +declare const Int32Array: Int32ArrayConstructor; /** - * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the + * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the * requested number of bytes could not be allocated an exception is raised. */ interface Uint32Array { /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ - BYTES_PER_ELEMENT: number; + readonly BYTES_PER_ELEMENT: number; /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ - buffer: ArrayBuffer; + readonly buffer: ArrayBuffer; /** * The length in bytes of the array. */ - byteLength: number; + readonly byteLength: number; /** * The offset in bytes of the array. */ - byteOffset: number; + readonly byteOffset: number; - /** + /** * Returns the this object after copying a section of the array identified by start and end * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * @param end If not specified, length of the this object is used as its default value. */ - copyWithin(target: number, start: number, end?: number): Uint32Array; + copyWithin(target: number, start: number, end?: number): this; /** * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, * or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. @@ -3068,49 +3153,49 @@ interface Uint32Array { /** * Returns the this object after filling the section identified by start and end with value * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ - fill(value: number, start?: number, end?: number): Uint32Array; + fill(value: number, start?: number, end?: number): this; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - filter(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): Uint32Array; + filter(callbackfn: (value: number, index: number, array: Uint32Array) => any, thisArg?: any): Uint32Array; - /** - * Returns the value of the first element in the array where predicate is true, and undefined + /** + * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; - /** - * Returns the index of the first element in the array where predicate is true, and undefined + /** + * Returns the index of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ findIndex(predicate: (value: number) => boolean, thisArg?: any): number; /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: number, index: number, array: Uint32Array) => void, thisArg?: any): void; @@ -3125,7 +3210,7 @@ interface Uint32Array { /** * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the + * @param separator A string used to separate one element of an array from the next in the * resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; @@ -3133,7 +3218,7 @@ interface Uint32Array { /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the * search starts at index 0. */ lastIndexOf(searchElement: number, fromIndex?: number): number; @@ -3141,68 +3226,68 @@ interface Uint32Array { /** * The length of the array. */ - length: number; + readonly length: number; /** - * Calls a defined callback function on each element of an array, and returns an array that + * Calls a defined callback function on each element of an array, and returns an array that * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: number, index: number, array: Uint32Array) => number, thisArg?: any): Uint32Array; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): Uint32Array; @@ -3220,7 +3305,7 @@ interface Uint32Array { */ set(array: ArrayLike, offset?: number): void; - /** + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. @@ -3229,31 +3314,31 @@ interface Uint32Array { /** * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean; /** * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If + * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ - sort(compareFn?: (a: number, b: number) => number): Uint32Array; + sort(compareFn?: (a: number, b: number) => number): this; /** * Gets a new Uint32Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. + * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ subarray(begin: number, end?: number): Uint32Array; /** - * Converts a number to a string by using the current locale. + * Converts a number to a string by using the current locale. */ toLocaleString(): string; @@ -3266,22 +3351,22 @@ interface Uint32Array { } interface Uint32ArrayConstructor { - prototype: Uint32Array; + readonly prototype: Uint32Array; new (length: number): Uint32Array; new (array: ArrayLike): Uint32Array; new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint32Array; /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ - BYTES_PER_ELEMENT: number; + readonly BYTES_PER_ELEMENT: number; /** * Returns a new array from a set of elements. * @param items A set of elements to include in the new array object. */ of(...items: number[]): Uint32Array; - + /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. @@ -3290,7 +3375,7 @@ interface Uint32ArrayConstructor { */ from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array; } -declare var Uint32Array: Uint32ArrayConstructor; +declare const Uint32Array: Uint32ArrayConstructor; /** * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number @@ -3298,40 +3383,40 @@ declare var Uint32Array: Uint32ArrayConstructor; */ interface Float32Array { /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ - BYTES_PER_ELEMENT: number; + readonly BYTES_PER_ELEMENT: number; /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ - buffer: ArrayBuffer; + readonly buffer: ArrayBuffer; /** * The length in bytes of the array. */ - byteLength: number; + readonly byteLength: number; /** * The offset in bytes of the array. */ - byteOffset: number; + readonly byteOffset: number; - /** + /** * Returns the this object after copying a section of the array identified by start and end * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * @param end If not specified, length of the this object is used as its default value. */ - copyWithin(target: number, start: number, end?: number): Float32Array; + copyWithin(target: number, start: number, end?: number): this; /** * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, * or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. @@ -3341,49 +3426,49 @@ interface Float32Array { /** * Returns the this object after filling the section identified by start and end with value * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ - fill(value: number, start?: number, end?: number): Float32Array; + fill(value: number, start?: number, end?: number): this; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - filter(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): Float32Array; + filter(callbackfn: (value: number, index: number, array: Float32Array) => any, thisArg?: any): Float32Array; - /** - * Returns the value of the first element in the array where predicate is true, and undefined + /** + * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; - /** - * Returns the index of the first element in the array where predicate is true, and undefined + /** + * Returns the index of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ findIndex(predicate: (value: number) => boolean, thisArg?: any): number; /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: number, index: number, array: Float32Array) => void, thisArg?: any): void; @@ -3398,7 +3483,7 @@ interface Float32Array { /** * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the + * @param separator A string used to separate one element of an array from the next in the * resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; @@ -3406,7 +3491,7 @@ interface Float32Array { /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the * search starts at index 0. */ lastIndexOf(searchElement: number, fromIndex?: number): number; @@ -3414,68 +3499,68 @@ interface Float32Array { /** * The length of the array. */ - length: number; + readonly length: number; /** - * Calls a defined callback function on each element of an array, and returns an array that + * Calls a defined callback function on each element of an array, and returns an array that * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: number, index: number, array: Float32Array) => number, thisArg?: any): Float32Array; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): Float32Array; @@ -3493,7 +3578,7 @@ interface Float32Array { */ set(array: ArrayLike, offset?: number): void; - /** + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. @@ -3502,31 +3587,31 @@ interface Float32Array { /** * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean; /** * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If + * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ - sort(compareFn?: (a: number, b: number) => number): Float32Array; + sort(compareFn?: (a: number, b: number) => number): this; /** * Gets a new Float32Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. + * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ subarray(begin: number, end?: number): Float32Array; /** - * Converts a number to a string by using the current locale. + * Converts a number to a string by using the current locale. */ toLocaleString(): string; @@ -3539,22 +3624,22 @@ interface Float32Array { } interface Float32ArrayConstructor { - prototype: Float32Array; + readonly prototype: Float32Array; new (length: number): Float32Array; new (array: ArrayLike): Float32Array; new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float32Array; /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ - BYTES_PER_ELEMENT: number; + readonly BYTES_PER_ELEMENT: number; /** * Returns a new array from a set of elements. * @param items A set of elements to include in the new array object. */ of(...items: number[]): Float32Array; - + /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. @@ -3564,48 +3649,48 @@ interface Float32ArrayConstructor { from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array; } -declare var Float32Array: Float32ArrayConstructor; +declare const Float32Array: Float32ArrayConstructor; /** - * A typed array of 64-bit float values. The contents are initialized to 0. If the requested + * A typed array of 64-bit float values. The contents are initialized to 0. If the requested * number of bytes could not be allocated an exception is raised. */ interface Float64Array { /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ - BYTES_PER_ELEMENT: number; + readonly BYTES_PER_ELEMENT: number; /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ - buffer: ArrayBuffer; + readonly buffer: ArrayBuffer; /** * The length in bytes of the array. */ - byteLength: number; + readonly byteLength: number; /** * The offset in bytes of the array. */ - byteOffset: number; + readonly byteOffset: number; - /** + /** * Returns the this object after copying a section of the array identified by start and end * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * @param end If not specified, length of the this object is used as its default value. */ - copyWithin(target: number, start: number, end?: number): Float64Array; + copyWithin(target: number, start: number, end?: number): this; /** * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, * or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. @@ -3615,49 +3700,49 @@ interface Float64Array { /** * Returns the this object after filling the section identified by start and end with value * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ - fill(value: number, start?: number, end?: number): Float64Array; + fill(value: number, start?: number, end?: number): this; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - filter(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): Float64Array; + filter(callbackfn: (value: number, index: number, array: Float64Array) => any, thisArg?: any): Float64Array; - /** - * Returns the value of the first element in the array where predicate is true, and undefined + /** + * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; - /** - * Returns the index of the first element in the array where predicate is true, and undefined + /** + * Returns the index of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ findIndex(predicate: (value: number) => boolean, thisArg?: any): number; /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: number, index: number, array: Float64Array) => void, thisArg?: any): void; @@ -3672,7 +3757,7 @@ interface Float64Array { /** * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the + * @param separator A string used to separate one element of an array from the next in the * resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; @@ -3680,7 +3765,7 @@ interface Float64Array { /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the * search starts at index 0. */ lastIndexOf(searchElement: number, fromIndex?: number): number; @@ -3688,68 +3773,68 @@ interface Float64Array { /** * The length of the array. */ - length: number; + readonly length: number; /** - * Calls a defined callback function on each element of an array, and returns an array that + * Calls a defined callback function on each element of an array, and returns an array that * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: number, index: number, array: Float64Array) => number, thisArg?: any): Float64Array; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): Float64Array; @@ -3767,7 +3852,7 @@ interface Float64Array { */ set(array: ArrayLike, offset?: number): void; - /** + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. @@ -3776,31 +3861,31 @@ interface Float64Array { /** * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean; /** * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If + * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ - sort(compareFn?: (a: number, b: number) => number): Float64Array; + sort(compareFn?: (a: number, b: number) => number): this; /** * Gets a new Float64Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. + * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ subarray(begin: number, end?: number): Float64Array; /** - * Converts a number to a string by using the current locale. + * Converts a number to a string by using the current locale. */ toLocaleString(): string; @@ -3813,22 +3898,22 @@ interface Float64Array { } interface Float64ArrayConstructor { - prototype: Float64Array; + readonly prototype: Float64Array; new (length: number): Float64Array; new (array: ArrayLike): Float64Array; new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float64Array; /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ - BYTES_PER_ELEMENT: number; + readonly BYTES_PER_ELEMENT: number; /** * Returns a new array from a set of elements. * @param items A set of elements to include in the new array object. */ of(...items: number[]): Float64Array; - + /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. @@ -3837,9 +3922,10 @@ interface Float64ArrayConstructor { */ from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; } -declare var Float64Array: Float64ArrayConstructor; +declare const Float64Array: Float64ArrayConstructor; + ///////////////////////////// -/// ECMAScript Internationalization API +/// ECMAScript Internationalization API ///////////////////////////// declare module Intl { @@ -3982,14 +4068,14 @@ interface String { interface Number { /** - * Converts a number to a string by using the current or specified locale. + * Converts a number to a string by using the current or specified locale. * @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. * @param options An object that contains one or more properties that specify comparison options. */ toLocaleString(locales?: string[], options?: Intl.NumberFormatOptions): string; /** - * Converts a number to a string by using the current or specified locale. + * Converts a number to a string by using the current or specified locale. * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. * @param options An object that contains one or more properties that specify comparison options. */ @@ -3998,48 +4084,47 @@ interface Number { interface Date { /** - * Converts a date and time to a string by using the current or specified locale. + * Converts a date and time to a string by using the current or specified locale. * @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. * @param options An object that contains one or more properties that specify comparison options. */ toLocaleString(locales?: string[], options?: Intl.DateTimeFormatOptions): string; /** - * Converts a date to a string by using the current or specified locale. + * Converts a date to a string by using the current or specified locale. * @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. * @param options An object that contains one or more properties that specify comparison options. */ toLocaleDateString(locales?: string[], options?: Intl.DateTimeFormatOptions): string; /** - * Converts a time to a string by using the current or specified locale. + * Converts a time to a string by using the current or specified locale. * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. * @param options An object that contains one or more properties that specify comparison options. */ toLocaleTimeString(locale?: string[], options?: Intl.DateTimeFormatOptions): string; - + /** - * Converts a date and time to a string by using the current or specified locale. + * Converts a date and time to a string by using the current or specified locale. * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. * @param options An object that contains one or more properties that specify comparison options. */ toLocaleString(locale?: string, options?: Intl.DateTimeFormatOptions): string; - + /** - * Converts a date to a string by using the current or specified locale. + * Converts a date to a string by using the current or specified locale. * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. * @param options An object that contains one or more properties that specify comparison options. */ toLocaleDateString(locale?: string, options?: Intl.DateTimeFormatOptions): string; /** - * Converts a time to a string by using the current or specified locale. + * Converts a time to a string by using the current or specified locale. * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. * @param options An object that contains one or more properties that specify comparison options. */ toLocaleTimeString(locale?: string, options?: Intl.DateTimeFormatOptions): string; } - ///////////////////////////// /// IE DOM APIs ///////////////////////////// @@ -4053,11 +4138,6 @@ interface AriaRequestEventInit extends EventInit { attributeValue?: string; } -interface ClipboardEventInit extends EventInit { - data?: string; - dataType?: string; -} - interface CommandEventInit extends EventInit { commandName?: string; detail?: string; @@ -4071,6 +4151,31 @@ interface ConfirmSiteSpecificExceptionsInformation extends ExceptionInformation arrayOfDomainStrings?: string[]; } +interface ConstrainBooleanParameters { + exact?: boolean; + ideal?: boolean; +} + +interface ConstrainDOMStringParameters { + exact?: string | string[]; + ideal?: string | string[]; +} + +interface ConstrainDoubleRange extends DoubleRange { + exact?: number; + ideal?: number; +} + +interface ConstrainLongRange extends LongRange { + exact?: number; + ideal?: number; +} + +interface ConstrainVideoFacingModeParameters { + exact?: string | string[]; + ideal?: string | string[]; +} + interface CustomEventInit extends EventInit { detail?: any; } @@ -4081,17 +4186,44 @@ interface DeviceAccelerationDict { z?: number; } +interface DeviceLightEventInit extends EventInit { + value?: number; +} + interface DeviceRotationRateDict { alpha?: number; beta?: number; gamma?: number; } +interface DoubleRange { + max?: number; + min?: number; +} + interface EventInit { bubbles?: boolean; cancelable?: boolean; } +interface EventModifierInit extends UIEventInit { + ctrlKey?: boolean; + shiftKey?: boolean; + altKey?: boolean; + metaKey?: boolean; + modifierAltGraph?: boolean; + modifierCapsLock?: boolean; + modifierFn?: boolean; + modifierFnLock?: boolean; + modifierHyper?: boolean; + modifierNumLock?: boolean; + modifierOS?: boolean; + modifierScrollLock?: boolean; + modifierSuper?: boolean; + modifierSymbol?: boolean; + modifierSymbolLock?: boolean; +} + interface ExceptionInformation { domain?: string; } @@ -4105,17 +4237,415 @@ interface HashChangeEventInit extends EventInit { oldURL?: string; } +interface IDBIndexParameters { + multiEntry?: boolean; + unique?: boolean; +} + +interface IDBObjectStoreParameters { + autoIncrement?: boolean; + keyPath?: IDBKeyPath; +} + interface KeyAlgorithm { name?: string; } -interface KeyboardEventInit extends SharedKeyboardAndMouseEventInit { +interface KeyboardEventInit extends EventModifierInit { key?: string; location?: number; repeat?: boolean; } -interface MouseEventInit extends SharedKeyboardAndMouseEventInit { +interface LongRange { + max?: number; + min?: number; +} + +interface MSAccountInfo { + rpDisplayName?: string; + userDisplayName?: string; + accountName?: string; + userId?: string; + accountImageUri?: string; +} + +interface MSAudioLocalClientEvent extends MSLocalClientEventBase { + networkSendQualityEventRatio?: number; + networkDelayEventRatio?: number; + cpuInsufficientEventRatio?: number; + deviceHalfDuplexAECEventRatio?: number; + deviceRenderNotFunctioningEventRatio?: number; + deviceCaptureNotFunctioningEventRatio?: number; + deviceGlitchesEventRatio?: number; + deviceLowSNREventRatio?: number; + deviceLowSpeechLevelEventRatio?: number; + deviceClippingEventRatio?: number; + deviceEchoEventRatio?: number; + deviceNearEndToEchoRatioEventRatio?: number; + deviceRenderZeroVolumeEventRatio?: number; + deviceRenderMuteEventRatio?: number; + deviceMultipleEndpointsEventCount?: number; + deviceHowlingEventCount?: number; +} + +interface MSAudioRecvPayload extends MSPayloadBase { + samplingRate?: number; + signal?: MSAudioRecvSignal; + packetReorderRatio?: number; + packetReorderDepthAvg?: number; + packetReorderDepthMax?: number; + burstLossLength1?: number; + burstLossLength2?: number; + burstLossLength3?: number; + burstLossLength4?: number; + burstLossLength5?: number; + burstLossLength6?: number; + burstLossLength7?: number; + burstLossLength8OrHigher?: number; + fecRecvDistance1?: number; + fecRecvDistance2?: number; + fecRecvDistance3?: number; + ratioConcealedSamplesAvg?: number; + ratioStretchedSamplesAvg?: number; + ratioCompressedSamplesAvg?: number; +} + +interface MSAudioRecvSignal { + initialSignalLevelRMS?: number; + recvSignalLevelCh1?: number; + recvNoiseLevelCh1?: number; + renderSignalLevel?: number; + renderNoiseLevel?: number; + renderLoopbackSignalLevel?: number; +} + +interface MSAudioSendPayload extends MSPayloadBase { + samplingRate?: number; + signal?: MSAudioSendSignal; + audioFECUsed?: boolean; + sendMutePercent?: number; +} + +interface MSAudioSendSignal { + noiseLevel?: number; + sendSignalLevelCh1?: number; + sendNoiseLevelCh1?: number; +} + +interface MSConnectivity { + iceType?: string; + iceWarningFlags?: MSIceWarningFlags; + relayAddress?: MSRelayAddress; +} + +interface MSCredentialFilter { + accept?: MSCredentialSpec[]; +} + +interface MSCredentialParameters { + type?: string; +} + +interface MSCredentialSpec { + type?: string; + id?: string; +} + +interface MSDelay { + roundTrip?: number; + roundTripMax?: number; +} + +interface MSDescription extends RTCStats { + connectivity?: MSConnectivity; + transport?: string; + networkconnectivity?: MSNetworkConnectivityInfo; + localAddr?: MSIPAddressInfo; + remoteAddr?: MSIPAddressInfo; + deviceDevName?: string; + reflexiveLocalIPAddr?: MSIPAddressInfo; +} + +interface MSFIDOCredentialParameters extends MSCredentialParameters { + algorithm?: string | Algorithm; + authenticators?: AAGUID[]; +} + +interface MSIPAddressInfo { + ipAddr?: string; + port?: number; + manufacturerMacAddrMask?: string; +} + +interface MSIceWarningFlags { + turnTcpTimedOut?: boolean; + turnUdpAllocateFailed?: boolean; + turnUdpSendFailed?: boolean; + turnTcpAllocateFailed?: boolean; + turnTcpSendFailed?: boolean; + udpLocalConnectivityFailed?: boolean; + udpNatConnectivityFailed?: boolean; + udpRelayConnectivityFailed?: boolean; + tcpNatConnectivityFailed?: boolean; + tcpRelayConnectivityFailed?: boolean; + connCheckMessageIntegrityFailed?: boolean; + allocationMessageIntegrityFailed?: boolean; + connCheckOtherError?: boolean; + turnAuthUnknownUsernameError?: boolean; + noRelayServersConfigured?: boolean; + multipleRelayServersAttempted?: boolean; + portRangeExhausted?: boolean; + alternateServerReceived?: boolean; + pseudoTLSFailure?: boolean; + turnTurnTcpConnectivityFailed?: boolean; + useCandidateChecksFailed?: boolean; + fipsAllocationFailure?: boolean; +} + +interface MSJitter { + interArrival?: number; + interArrivalMax?: number; + interArrivalSD?: number; +} + +interface MSLocalClientEventBase extends RTCStats { + networkReceiveQualityEventRatio?: number; + networkBandwidthLowEventRatio?: number; +} + +interface MSNetwork extends RTCStats { + jitter?: MSJitter; + delay?: MSDelay; + packetLoss?: MSPacketLoss; + utilization?: MSUtilization; +} + +interface MSNetworkConnectivityInfo { + vpn?: boolean; + linkspeed?: number; + networkConnectionDetails?: string; +} + +interface MSNetworkInterfaceType { + interfaceTypeEthernet?: boolean; + interfaceTypeWireless?: boolean; + interfaceTypePPP?: boolean; + interfaceTypeTunnel?: boolean; + interfaceTypeWWAN?: boolean; +} + +interface MSOutboundNetwork extends MSNetwork { + appliedBandwidthLimit?: number; +} + +interface MSPacketLoss { + lossRate?: number; + lossRateMax?: number; +} + +interface MSPayloadBase extends RTCStats { + payloadDescription?: string; +} + +interface MSRelayAddress { + relayAddress?: string; + port?: number; +} + +interface MSSignatureParameters { + userPrompt?: string; +} + +interface MSTransportDiagnosticsStats extends RTCStats { + baseAddress?: string; + localAddress?: string; + localSite?: string; + networkName?: string; + remoteAddress?: string; + remoteSite?: string; + localMR?: string; + remoteMR?: string; + iceWarningFlags?: MSIceWarningFlags; + portRangeMin?: number; + portRangeMax?: number; + localMRTCPPort?: number; + remoteMRTCPPort?: number; + stunVer?: number; + numConsentReqSent?: number; + numConsentReqReceived?: number; + numConsentRespSent?: number; + numConsentRespReceived?: number; + interfaces?: MSNetworkInterfaceType; + baseInterface?: MSNetworkInterfaceType; + protocol?: string; + localInterface?: MSNetworkInterfaceType; + localAddrType?: string; + remoteAddrType?: string; + iceRole?: string; + rtpRtcpMux?: boolean; + allocationTimeInMs?: number; + msRtcEngineVersion?: string; +} + +interface MSUtilization { + packets?: number; + bandwidthEstimation?: number; + bandwidthEstimationMin?: number; + bandwidthEstimationMax?: number; + bandwidthEstimationStdDev?: number; + bandwidthEstimationAvg?: number; +} + +interface MSVideoPayload extends MSPayloadBase { + resoluton?: string; + videoBitRateAvg?: number; + videoBitRateMax?: number; + videoFrameRateAvg?: number; + videoPacketLossRate?: number; + durationSeconds?: number; +} + +interface MSVideoRecvPayload extends MSVideoPayload { + videoFrameLossRate?: number; + recvCodecType?: string; + recvResolutionWidth?: number; + recvResolutionHeight?: number; + videoResolutions?: MSVideoResolutionDistribution; + recvFrameRateAverage?: number; + recvBitRateMaximum?: number; + recvBitRateAverage?: number; + recvVideoStreamsMax?: number; + recvVideoStreamsMin?: number; + recvVideoStreamsMode?: number; + videoPostFECPLR?: number; + lowBitRateCallPercent?: number; + lowFrameRateCallPercent?: number; + reorderBufferTotalPackets?: number; + recvReorderBufferReorderedPackets?: number; + recvReorderBufferPacketsDroppedDueToBufferExhaustion?: number; + recvReorderBufferMaxSuccessfullyOrderedExtent?: number; + recvReorderBufferMaxSuccessfullyOrderedLateTime?: number; + recvReorderBufferPacketsDroppedDueToTimeout?: number; + recvFpsHarmonicAverage?: number; + recvNumResSwitches?: number; +} + +interface MSVideoResolutionDistribution { + cifQuality?: number; + vgaQuality?: number; + h720Quality?: number; + h1080Quality?: number; + h1440Quality?: number; + h2160Quality?: number; +} + +interface MSVideoSendPayload extends MSVideoPayload { + sendFrameRateAverage?: number; + sendBitRateMaximum?: number; + sendBitRateAverage?: number; + sendVideoStreamsMax?: number; + sendResolutionWidth?: number; + sendResolutionHeight?: number; +} + +interface MediaEncryptedEventInit extends EventInit { + initDataType?: string; + initData?: ArrayBuffer; +} + +interface MediaKeyMessageEventInit extends EventInit { + messageType?: string; + message?: ArrayBuffer; +} + +interface MediaKeySystemConfiguration { + initDataTypes?: string[]; + audioCapabilities?: MediaKeySystemMediaCapability[]; + videoCapabilities?: MediaKeySystemMediaCapability[]; + distinctiveIdentifier?: string; + persistentState?: string; +} + +interface MediaKeySystemMediaCapability { + contentType?: string; + robustness?: string; +} + +interface MediaStreamConstraints { + video?: boolean | MediaTrackConstraints; + audio?: boolean | MediaTrackConstraints; +} + +interface MediaStreamErrorEventInit extends EventInit { + error?: MediaStreamError; +} + +interface MediaStreamTrackEventInit extends EventInit { + track?: MediaStreamTrack; +} + +interface MediaTrackCapabilities { + width?: number | LongRange; + height?: number | LongRange; + aspectRatio?: number | DoubleRange; + frameRate?: number | DoubleRange; + facingMode?: string; + volume?: number | DoubleRange; + sampleRate?: number | LongRange; + sampleSize?: number | LongRange; + echoCancellation?: boolean[]; + deviceId?: string; + groupId?: string; +} + +interface MediaTrackConstraintSet { + width?: number | ConstrainLongRange; + height?: number | ConstrainLongRange; + aspectRatio?: number | ConstrainDoubleRange; + frameRate?: number | ConstrainDoubleRange; + facingMode?: string | string[] | ConstrainDOMStringParameters; + volume?: number | ConstrainDoubleRange; + sampleRate?: number | ConstrainLongRange; + sampleSize?: number | ConstrainLongRange; + echoCancelation?: boolean | ConstrainBooleanParameters; + deviceId?: string | string[] | ConstrainDOMStringParameters; + groupId?: string | string[] | ConstrainDOMStringParameters; +} + +interface MediaTrackConstraints extends MediaTrackConstraintSet { + advanced?: MediaTrackConstraintSet[]; +} + +interface MediaTrackSettings { + width?: number; + height?: number; + aspectRatio?: number; + frameRate?: number; + facingMode?: string; + volume?: number; + sampleRate?: number; + sampleSize?: number; + echoCancellation?: boolean; + deviceId?: string; + groupId?: string; +} + +interface MediaTrackSupportedConstraints { + width?: boolean; + height?: boolean; + aspectRatio?: boolean; + frameRate?: boolean; + facingMode?: boolean; + volume?: boolean; + sampleRate?: boolean; + sampleSize?: boolean; + echoCancellation?: boolean; + deviceId?: boolean; + groupId?: boolean; +} + +interface MouseEventInit extends EventModifierInit { screenX?: number; screenY?: number; clientX?: number; @@ -4148,6 +4678,10 @@ interface ObjectURLOptions { oneTimeOnly?: boolean; } +interface PeriodicWaveConstraints { + disableNormalization?: boolean; +} + interface PointerEventInit extends MouseEventInit { pointerId?: number; width?: number; @@ -4165,22 +4699,266 @@ interface PositionOptions { maximumAge?: number; } -interface SharedKeyboardAndMouseEventInit extends UIEventInit { - ctrlKey?: boolean; - shiftKey?: boolean; - altKey?: boolean; - metaKey?: boolean; - keyModifierStateAltGraph?: boolean; - keyModifierStateCapsLock?: boolean; - keyModifierStateFn?: boolean; - keyModifierStateFnLock?: boolean; - keyModifierStateHyper?: boolean; - keyModifierStateNumLock?: boolean; - keyModifierStateOS?: boolean; - keyModifierStateScrollLock?: boolean; - keyModifierStateSuper?: boolean; - keyModifierStateSymbol?: boolean; - keyModifierStateSymbolLock?: boolean; +interface RTCDTMFToneChangeEventInit extends EventInit { + tone?: string; +} + +interface RTCDtlsFingerprint { + algorithm?: string; + value?: string; +} + +interface RTCDtlsParameters { + role?: string; + fingerprints?: RTCDtlsFingerprint[]; +} + +interface RTCIceCandidate { + foundation?: string; + priority?: number; + ip?: string; + protocol?: string; + port?: number; + type?: string; + tcpType?: string; + relatedAddress?: string; + relatedPort?: number; +} + +interface RTCIceCandidateAttributes extends RTCStats { + ipAddress?: string; + portNumber?: number; + transport?: string; + candidateType?: string; + priority?: number; + addressSourceUrl?: string; +} + +interface RTCIceCandidateComplete { +} + +interface RTCIceCandidatePair { + local?: RTCIceCandidate; + remote?: RTCIceCandidate; +} + +interface RTCIceCandidatePairStats extends RTCStats { + transportId?: string; + localCandidateId?: string; + remoteCandidateId?: string; + state?: string; + priority?: number; + nominated?: boolean; + writable?: boolean; + readable?: boolean; + bytesSent?: number; + bytesReceived?: number; + roundTripTime?: number; + availableOutgoingBitrate?: number; + availableIncomingBitrate?: number; +} + +interface RTCIceGatherOptions { + gatherPolicy?: string; + iceservers?: RTCIceServer[]; +} + +interface RTCIceParameters { + usernameFragment?: string; + password?: string; +} + +interface RTCIceServer { + urls?: any; + username?: string; + credential?: string; +} + +interface RTCInboundRTPStreamStats extends RTCRTPStreamStats { + packetsReceived?: number; + bytesReceived?: number; + packetsLost?: number; + jitter?: number; + fractionLost?: number; +} + +interface RTCMediaStreamTrackStats extends RTCStats { + trackIdentifier?: string; + remoteSource?: boolean; + ssrcIds?: string[]; + frameWidth?: number; + frameHeight?: number; + framesPerSecond?: number; + framesSent?: number; + framesReceived?: number; + framesDecoded?: number; + framesDropped?: number; + framesCorrupted?: number; + audioLevel?: number; + echoReturnLoss?: number; + echoReturnLossEnhancement?: number; +} + +interface RTCOutboundRTPStreamStats extends RTCRTPStreamStats { + packetsSent?: number; + bytesSent?: number; + targetBitrate?: number; + roundTripTime?: number; +} + +interface RTCRTPStreamStats extends RTCStats { + ssrc?: string; + associateStatsId?: string; + isRemote?: boolean; + mediaTrackId?: string; + transportId?: string; + codecId?: string; + firCount?: number; + pliCount?: number; + nackCount?: number; + sliCount?: number; +} + +interface RTCRtcpFeedback { + type?: string; + parameter?: string; +} + +interface RTCRtcpParameters { + ssrc?: number; + cname?: string; + reducedSize?: boolean; + mux?: boolean; +} + +interface RTCRtpCapabilities { + codecs?: RTCRtpCodecCapability[]; + headerExtensions?: RTCRtpHeaderExtension[]; + fecMechanisms?: string[]; +} + +interface RTCRtpCodecCapability { + name?: string; + kind?: string; + clockRate?: number; + preferredPayloadType?: number; + maxptime?: number; + numChannels?: number; + rtcpFeedback?: RTCRtcpFeedback[]; + parameters?: any; + options?: any; + maxTemporalLayers?: number; + maxSpatialLayers?: number; + svcMultiStreamSupport?: boolean; +} + +interface RTCRtpCodecParameters { + name?: string; + payloadType?: any; + clockRate?: number; + maxptime?: number; + numChannels?: number; + rtcpFeedback?: RTCRtcpFeedback[]; + parameters?: any; +} + +interface RTCRtpContributingSource { + timestamp?: number; + csrc?: number; + audioLevel?: number; +} + +interface RTCRtpEncodingParameters { + ssrc?: number; + codecPayloadType?: number; + fec?: RTCRtpFecParameters; + rtx?: RTCRtpRtxParameters; + priority?: number; + maxBitrate?: number; + minQuality?: number; + framerateBias?: number; + resolutionScale?: number; + framerateScale?: number; + active?: boolean; + encodingId?: string; + dependencyEncodingIds?: string[]; + ssrcRange?: RTCSsrcRange; +} + +interface RTCRtpFecParameters { + ssrc?: number; + mechanism?: string; +} + +interface RTCRtpHeaderExtension { + kind?: string; + uri?: string; + preferredId?: number; + preferredEncrypt?: boolean; +} + +interface RTCRtpHeaderExtensionParameters { + uri?: string; + id?: number; + encrypt?: boolean; +} + +interface RTCRtpParameters { + muxId?: string; + codecs?: RTCRtpCodecParameters[]; + headerExtensions?: RTCRtpHeaderExtensionParameters[]; + encodings?: RTCRtpEncodingParameters[]; + rtcp?: RTCRtcpParameters; +} + +interface RTCRtpRtxParameters { + ssrc?: number; +} + +interface RTCRtpUnhandled { + ssrc?: number; + payloadType?: number; + muxId?: string; +} + +interface RTCSrtpKeyParam { + keyMethod?: string; + keySalt?: string; + lifetime?: string; + mkiValue?: number; + mkiLength?: number; +} + +interface RTCSrtpSdesParameters { + tag?: number; + cryptoSuite?: string; + keyParams?: RTCSrtpKeyParam[]; + sessionParams?: string[]; +} + +interface RTCSsrcRange { + min?: number; + max?: number; +} + +interface RTCStats { + timestamp?: number; + type?: string; + id?: string; + msType?: string; +} + +interface RTCStatsReport { +} + +interface RTCTransportStats extends RTCStats { + bytesSent?: number; + bytesReceived?: number; + rtcpTransportStatsId?: string; + activeConnection?: boolean; + selectedCandidatePairId?: string; + localCertificateId?: string; + remoteCertificateId?: string; } interface StoreExceptionsInformation extends ExceptionInformation { @@ -4226,18 +5004,18 @@ interface ANGLE_instanced_arrays { drawArraysInstancedANGLE(mode: number, first: number, count: number, primcount: number): void; drawElementsInstancedANGLE(mode: number, count: number, type: number, offset: number, primcount: number): void; vertexAttribDivisorANGLE(index: number, divisor: number): void; - VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: number; + readonly VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: number; } declare var ANGLE_instanced_arrays: { prototype: ANGLE_instanced_arrays; new(): ANGLE_instanced_arrays; - VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: number; + readonly VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: number; } interface AnalyserNode extends AudioNode { fftSize: number; - frequencyBinCount: number; + readonly frequencyBinCount: number; maxDecibels: number; minDecibels: number; smoothingTimeConstant: number; @@ -4253,8 +5031,8 @@ declare var AnalyserNode: { } interface AnimationEvent extends Event { - animationName: string; - elapsedTime: number; + readonly animationName: string; + readonly elapsedTime: number; initAnimationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, animationNameArg: string, elapsedTimeArg: number): void; } @@ -4272,16 +5050,16 @@ interface ApplicationCache extends EventTarget { onobsolete: (ev: Event) => any; onprogress: (ev: ProgressEvent) => any; onupdateready: (ev: Event) => any; - status: number; + readonly status: number; abort(): void; swapCache(): void; update(): void; - CHECKING: number; - DOWNLOADING: number; - IDLE: number; - OBSOLETE: number; - UNCACHED: number; - UPDATEREADY: number; + readonly CHECKING: number; + readonly DOWNLOADING: number; + readonly IDLE: number; + readonly OBSOLETE: number; + readonly UNCACHED: number; + readonly UPDATEREADY: number; addEventListener(type: "cached", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "checking", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "downloading", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -4296,17 +5074,17 @@ interface ApplicationCache extends EventTarget { declare var ApplicationCache: { prototype: ApplicationCache; new(): ApplicationCache; - CHECKING: number; - DOWNLOADING: number; - IDLE: number; - OBSOLETE: number; - UNCACHED: number; - UPDATEREADY: number; + readonly CHECKING: number; + readonly DOWNLOADING: number; + readonly IDLE: number; + readonly OBSOLETE: number; + readonly UNCACHED: number; + readonly UPDATEREADY: number; } interface AriaRequestEvent extends Event { - attributeName: string; - attributeValue: string; + readonly attributeName: string; + attributeValue: string | null; } declare var AriaRequestEvent: { @@ -4315,9 +5093,10 @@ declare var AriaRequestEvent: { } interface Attr extends Node { - name: string; - ownerElement: Element; - specified: boolean; + readonly name: string; + readonly ownerElement: Element; + readonly prefix: string | null; + readonly specified: boolean; value: string; } @@ -4327,10 +5106,12 @@ declare var Attr: { } interface AudioBuffer { - duration: number; - length: number; - numberOfChannels: number; - sampleRate: number; + readonly duration: number; + readonly length: number; + readonly numberOfChannels: number; + readonly sampleRate: number; + copyFromChannel(destination: Float32Array, channelNumber: number, startInChannel?: number): void; + copyToChannel(source: Float32Array, channelNumber: number, startInChannel?: number): void; getChannelData(channel: number): Float32Array; } @@ -4340,15 +5121,16 @@ declare var AudioBuffer: { } interface AudioBufferSourceNode extends AudioNode { - buffer: AudioBuffer; + buffer: AudioBuffer | null; + readonly detune: AudioParam; loop: boolean; loopEnd: number; loopStart: number; - onended: (ev: Event) => any; - playbackRate: AudioParam; + onended: (ev: MediaStreamErrorEvent) => any; + readonly playbackRate: AudioParam; start(when?: number, offset?: number, duration?: number): void; stop(when?: number): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -4358,10 +5140,11 @@ declare var AudioBufferSourceNode: { } interface AudioContext extends EventTarget { - currentTime: number; - destination: AudioDestinationNode; - listener: AudioListener; - sampleRate: number; + readonly currentTime: number; + readonly destination: AudioDestinationNode; + readonly listener: AudioListener; + readonly sampleRate: number; + state: string; createAnalyser(): AnalyserNode; createBiquadFilter(): BiquadFilterNode; createBuffer(numberOfChannels: number, length: number, sampleRate: number): AudioBuffer; @@ -4373,13 +5156,14 @@ interface AudioContext extends EventTarget { createDynamicsCompressor(): DynamicsCompressorNode; createGain(): GainNode; createMediaElementSource(mediaElement: HTMLMediaElement): MediaElementAudioSourceNode; + createMediaStreamSource(mediaStream: MediaStream): MediaStreamAudioSourceNode; createOscillator(): OscillatorNode; createPanner(): PannerNode; - createPeriodicWave(real: Float32Array, imag: Float32Array): PeriodicWave; + createPeriodicWave(real: Float32Array, imag: Float32Array, constraints?: PeriodicWaveConstraints): PeriodicWave; createScriptProcessor(bufferSize?: number, numberOfInputChannels?: number, numberOfOutputChannels?: number): ScriptProcessorNode; createStereoPanner(): StereoPannerNode; createWaveShaper(): WaveShaperNode; - decodeAudioData(audioData: ArrayBuffer, successCallback: DecodeSuccessCallback, errorCallback?: DecodeErrorCallback): void; + decodeAudioData(audioData: ArrayBuffer, successCallback?: DecodeSuccessCallback, errorCallback?: DecodeErrorCallback): PromiseLike; } declare var AudioContext: { @@ -4388,7 +5172,7 @@ declare var AudioContext: { } interface AudioDestinationNode extends AudioNode { - maxChannelCount: number; + readonly maxChannelCount: number; } declare var AudioDestinationNode: { @@ -4413,11 +5197,13 @@ interface AudioNode extends EventTarget { channelCount: number; channelCountMode: string; channelInterpretation: string; - context: AudioContext; - numberOfInputs: number; - numberOfOutputs: number; + readonly context: AudioContext; + readonly numberOfInputs: number; + readonly numberOfOutputs: number; connect(destination: AudioNode, output?: number, input?: number): void; disconnect(output?: number): void; + disconnect(destination: AudioNode, output?: number, input?: number): void; + disconnect(destination: AudioParam, output?: number): void; } declare var AudioNode: { @@ -4426,7 +5212,7 @@ declare var AudioNode: { } interface AudioParam { - defaultValue: number; + readonly defaultValue: number; value: number; cancelScheduledValues(startTime: number): void; exponentialRampToValueAtTime(value: number, endTime: number): void; @@ -4442,9 +5228,9 @@ declare var AudioParam: { } interface AudioProcessingEvent extends Event { - inputBuffer: AudioBuffer; - outputBuffer: AudioBuffer; - playbackTime: number; + readonly inputBuffer: AudioBuffer; + readonly outputBuffer: AudioBuffer; + readonly playbackTime: number; } declare var AudioProcessingEvent: { @@ -4454,11 +5240,11 @@ declare var AudioProcessingEvent: { interface AudioTrack { enabled: boolean; - id: string; + readonly id: string; kind: string; - label: string; + readonly label: string; language: string; - sourceBuffer: SourceBuffer; + readonly sourceBuffer: SourceBuffer; } declare var AudioTrack: { @@ -4467,11 +5253,11 @@ declare var AudioTrack: { } interface AudioTrackList extends EventTarget { - length: number; + readonly length: number; onaddtrack: (ev: TrackEvent) => any; onchange: (ev: Event) => any; onremovetrack: (ev: TrackEvent) => any; - getTrackById(id: string): AudioTrack; + getTrackById(id: string): AudioTrack | null; item(index: number): AudioTrack; addEventListener(type: "addtrack", listener: (ev: TrackEvent) => any, useCapture?: boolean): void; addEventListener(type: "change", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -4486,7 +5272,7 @@ declare var AudioTrackList: { } interface BarProp { - visible: boolean; + readonly visible: boolean; } declare var BarProp: { @@ -4504,10 +5290,10 @@ declare var BeforeUnloadEvent: { } interface BiquadFilterNode extends AudioNode { - Q: AudioParam; - detune: AudioParam; - frequency: AudioParam; - gain: AudioParam; + readonly Q: AudioParam; + readonly detune: AudioParam; + readonly frequency: AudioParam; + readonly gain: AudioParam; type: string; getFrequencyResponse(frequencyHz: Float32Array, magResponse: Float32Array, phaseResponse: Float32Array): void; } @@ -4518,8 +5304,8 @@ declare var BiquadFilterNode: { } interface Blob { - size: number; - type: string; + readonly size: number; + readonly type: string; msClose(): void; msDetachStream(): any; slice(start?: number, end?: number, contentType?: string): Blob; @@ -4553,7 +5339,7 @@ declare var CSSConditionRule: { } interface CSSFontFaceRule extends CSSRule { - style: CSSStyleDeclaration; + readonly style: CSSStyleDeclaration; } declare var CSSFontFaceRule: { @@ -4562,9 +5348,9 @@ declare var CSSFontFaceRule: { } interface CSSGroupingRule extends CSSRule { - cssRules: CSSRuleList; - deleteRule(index?: number): void; - insertRule(rule: string, index?: number): number; + readonly cssRules: CSSRuleList; + deleteRule(index: number): void; + insertRule(rule: string, index: number): number; } declare var CSSGroupingRule: { @@ -4573,9 +5359,9 @@ declare var CSSGroupingRule: { } interface CSSImportRule extends CSSRule { - href: string; - media: MediaList; - styleSheet: CSSStyleSheet; + readonly href: string; + readonly media: MediaList; + readonly styleSheet: CSSStyleSheet; } declare var CSSImportRule: { @@ -4585,7 +5371,7 @@ declare var CSSImportRule: { interface CSSKeyframeRule extends CSSRule { keyText: string; - style: CSSStyleDeclaration; + readonly style: CSSStyleDeclaration; } declare var CSSKeyframeRule: { @@ -4594,7 +5380,7 @@ declare var CSSKeyframeRule: { } interface CSSKeyframesRule extends CSSRule { - cssRules: CSSRuleList; + readonly cssRules: CSSRuleList; name: string; appendRule(rule: string): void; deleteRule(rule: string): void; @@ -4607,7 +5393,7 @@ declare var CSSKeyframesRule: { } interface CSSMediaRule extends CSSConditionRule { - media: MediaList; + readonly media: MediaList; } declare var CSSMediaRule: { @@ -4616,8 +5402,8 @@ declare var CSSMediaRule: { } interface CSSNamespaceRule extends CSSRule { - namespaceURI: string; - prefix: string; + readonly namespaceURI: string; + readonly prefix: string; } declare var CSSNamespaceRule: { @@ -4626,10 +5412,10 @@ declare var CSSNamespaceRule: { } interface CSSPageRule extends CSSRule { - pseudoClass: string; - selector: string; + readonly pseudoClass: string; + readonly selector: string; selectorText: string; - style: CSSStyleDeclaration; + readonly style: CSSStyleDeclaration; } declare var CSSPageRule: { @@ -4639,42 +5425,42 @@ declare var CSSPageRule: { interface CSSRule { cssText: string; - parentRule: CSSRule; - parentStyleSheet: CSSStyleSheet; - type: number; - CHARSET_RULE: number; - FONT_FACE_RULE: number; - IMPORT_RULE: number; - KEYFRAMES_RULE: number; - KEYFRAME_RULE: number; - MEDIA_RULE: number; - NAMESPACE_RULE: number; - PAGE_RULE: number; - STYLE_RULE: number; - SUPPORTS_RULE: number; - UNKNOWN_RULE: number; - VIEWPORT_RULE: number; + readonly parentRule: CSSRule; + readonly parentStyleSheet: CSSStyleSheet; + readonly type: number; + readonly CHARSET_RULE: number; + readonly FONT_FACE_RULE: number; + readonly IMPORT_RULE: number; + readonly KEYFRAMES_RULE: number; + readonly KEYFRAME_RULE: number; + readonly MEDIA_RULE: number; + readonly NAMESPACE_RULE: number; + readonly PAGE_RULE: number; + readonly STYLE_RULE: number; + readonly SUPPORTS_RULE: number; + readonly UNKNOWN_RULE: number; + readonly VIEWPORT_RULE: number; } declare var CSSRule: { prototype: CSSRule; new(): CSSRule; - CHARSET_RULE: number; - FONT_FACE_RULE: number; - IMPORT_RULE: number; - KEYFRAMES_RULE: number; - KEYFRAME_RULE: number; - MEDIA_RULE: number; - NAMESPACE_RULE: number; - PAGE_RULE: number; - STYLE_RULE: number; - SUPPORTS_RULE: number; - UNKNOWN_RULE: number; - VIEWPORT_RULE: number; + readonly CHARSET_RULE: number; + readonly FONT_FACE_RULE: number; + readonly IMPORT_RULE: number; + readonly KEYFRAMES_RULE: number; + readonly KEYFRAME_RULE: number; + readonly MEDIA_RULE: number; + readonly NAMESPACE_RULE: number; + readonly PAGE_RULE: number; + readonly STYLE_RULE: number; + readonly SUPPORTS_RULE: number; + readonly UNKNOWN_RULE: number; + readonly VIEWPORT_RULE: number; } interface CSSRuleList { - length: number; + readonly length: number; item(index: number): CSSRule; [index: number]: CSSRule; } @@ -4685,356 +5471,343 @@ declare var CSSRuleList: { } interface CSSStyleDeclaration { - alignContent: string; - alignItems: string; - alignSelf: string; - alignmentBaseline: string; - animation: string; - animationDelay: string; - animationDirection: string; - animationDuration: string; - animationFillMode: string; - animationIterationCount: string; - animationName: string; - animationPlayState: string; - animationTimingFunction: string; - backfaceVisibility: string; - background: string; - backgroundAttachment: string; - backgroundClip: string; - backgroundColor: string; - backgroundImage: string; - backgroundOrigin: string; - backgroundPosition: string; - backgroundPositionX: string; - backgroundPositionY: string; - backgroundRepeat: string; - backgroundSize: string; - baselineShift: string; - border: string; - borderBottom: string; - borderBottomColor: string; - borderBottomLeftRadius: string; - borderBottomRightRadius: string; - borderBottomStyle: string; - borderBottomWidth: string; - borderCollapse: string; - borderColor: string; - borderImage: string; - borderImageOutset: string; - borderImageRepeat: string; - borderImageSlice: string; - borderImageSource: string; - borderImageWidth: string; - borderLeft: string; - borderLeftColor: string; - borderLeftStyle: string; - borderLeftWidth: string; - borderRadius: string; - borderRight: string; - borderRightColor: string; - borderRightStyle: string; - borderRightWidth: string; - borderSpacing: string; - borderStyle: string; - borderTop: string; - borderTopColor: string; - borderTopLeftRadius: string; - borderTopRightRadius: string; - borderTopStyle: string; - borderTopWidth: string; - borderWidth: string; - bottom: string; - boxShadow: string; - boxSizing: string; - breakAfter: string; - breakBefore: string; - breakInside: string; - captionSide: string; - clear: string; - clip: string; - clipPath: string; - clipRule: string; - color: string; - colorInterpolationFilters: string; + alignContent: string | null; + alignItems: string | null; + alignSelf: string | null; + alignmentBaseline: string | null; + animation: string | null; + animationDelay: string | null; + animationDirection: string | null; + animationDuration: string | null; + animationFillMode: string | null; + animationIterationCount: string | null; + animationName: string | null; + animationPlayState: string | null; + animationTimingFunction: string | null; + backfaceVisibility: string | null; + background: string | null; + backgroundAttachment: string | null; + backgroundClip: string | null; + backgroundColor: string | null; + backgroundImage: string | null; + backgroundOrigin: string | null; + backgroundPosition: string | null; + backgroundPositionX: string | null; + backgroundPositionY: string | null; + backgroundRepeat: string | null; + backgroundSize: string | null; + baselineShift: string | null; + border: string | null; + borderBottom: string | null; + borderBottomColor: string | null; + borderBottomLeftRadius: string | null; + borderBottomRightRadius: string | null; + borderBottomStyle: string | null; + borderBottomWidth: string | null; + borderCollapse: string | null; + borderColor: string | null; + borderImage: string | null; + borderImageOutset: string | null; + borderImageRepeat: string | null; + borderImageSlice: string | null; + borderImageSource: string | null; + borderImageWidth: string | null; + borderLeft: string | null; + borderLeftColor: string | null; + borderLeftStyle: string | null; + borderLeftWidth: string | null; + borderRadius: string | null; + borderRight: string | null; + borderRightColor: string | null; + borderRightStyle: string | null; + borderRightWidth: string | null; + borderSpacing: string | null; + borderStyle: string | null; + borderTop: string | null; + borderTopColor: string | null; + borderTopLeftRadius: string | null; + borderTopRightRadius: string | null; + borderTopStyle: string | null; + borderTopWidth: string | null; + borderWidth: string | null; + bottom: string | null; + boxShadow: string | null; + boxSizing: string | null; + breakAfter: string | null; + breakBefore: string | null; + breakInside: string | null; + captionSide: string | null; + clear: string | null; + clip: string | null; + clipPath: string | null; + clipRule: string | null; + color: string | null; + colorInterpolationFilters: string | null; columnCount: any; - columnFill: string; + columnFill: string | null; columnGap: any; - columnRule: string; + columnRule: string | null; columnRuleColor: any; - columnRuleStyle: string; + columnRuleStyle: string | null; columnRuleWidth: any; - columnSpan: string; + columnSpan: string | null; columnWidth: any; - columns: string; - content: string; - counterIncrement: string; - counterReset: string; - cssFloat: string; + columns: string | null; + content: string | null; + counterIncrement: string | null; + counterReset: string | null; + cssFloat: string | null; cssText: string; - cursor: string; - direction: string; - display: string; - dominantBaseline: string; - emptyCells: string; - enableBackground: string; - fill: string; - fillOpacity: string; - fillRule: string; - filter: string; - flex: string; - flexBasis: string; - flexDirection: string; - flexFlow: string; - flexGrow: string; - flexShrink: string; - flexWrap: string; - floodColor: string; - floodOpacity: string; - font: string; - fontFamily: string; - fontFeatureSettings: string; - fontSize: string; - fontSizeAdjust: string; - fontStretch: string; - fontStyle: string; - fontVariant: string; - fontWeight: string; - glyphOrientationHorizontal: string; - glyphOrientationVertical: string; - height: string; - imeMode: string; - justifyContent: string; - kerning: string; - left: string; - length: number; - letterSpacing: string; - lightingColor: string; - lineHeight: string; - listStyle: string; - listStyleImage: string; - listStylePosition: string; - listStyleType: string; - margin: string; - marginBottom: string; - marginLeft: string; - marginRight: string; - marginTop: string; - marker: string; - markerEnd: string; - markerMid: string; - markerStart: string; - mask: string; - maxHeight: string; - maxWidth: string; - minHeight: string; - minWidth: string; - msContentZoomChaining: string; - msContentZoomLimit: string; + cursor: string | null; + direction: string | null; + display: string | null; + dominantBaseline: string | null; + emptyCells: string | null; + enableBackground: string | null; + fill: string | null; + fillOpacity: string | null; + fillRule: string | null; + filter: string | null; + flex: string | null; + flexBasis: string | null; + flexDirection: string | null; + flexFlow: string | null; + flexGrow: string | null; + flexShrink: string | null; + flexWrap: string | null; + floodColor: string | null; + floodOpacity: string | null; + font: string | null; + fontFamily: string | null; + fontFeatureSettings: string | null; + fontSize: string | null; + fontSizeAdjust: string | null; + fontStretch: string | null; + fontStyle: string | null; + fontVariant: string | null; + fontWeight: string | null; + glyphOrientationHorizontal: string | null; + glyphOrientationVertical: string | null; + height: string | null; + imeMode: string | null; + justifyContent: string | null; + kerning: string | null; + left: string | null; + readonly length: number; + letterSpacing: string | null; + lightingColor: string | null; + lineHeight: string | null; + listStyle: string | null; + listStyleImage: string | null; + listStylePosition: string | null; + listStyleType: string | null; + margin: string | null; + marginBottom: string | null; + marginLeft: string | null; + marginRight: string | null; + marginTop: string | null; + marker: string | null; + markerEnd: string | null; + markerMid: string | null; + markerStart: string | null; + mask: string | null; + maxHeight: string | null; + maxWidth: string | null; + minHeight: string | null; + minWidth: string | null; + msContentZoomChaining: string | null; + msContentZoomLimit: string | null; msContentZoomLimitMax: any; msContentZoomLimitMin: any; - msContentZoomSnap: string; - msContentZoomSnapPoints: string; - msContentZoomSnapType: string; - msContentZooming: string; - msFlowFrom: string; - msFlowInto: string; - msFontFeatureSettings: string; + msContentZoomSnap: string | null; + msContentZoomSnapPoints: string | null; + msContentZoomSnapType: string | null; + msContentZooming: string | null; + msFlowFrom: string | null; + msFlowInto: string | null; + msFontFeatureSettings: string | null; msGridColumn: any; - msGridColumnAlign: string; + msGridColumnAlign: string | null; msGridColumnSpan: any; - msGridColumns: string; + msGridColumns: string | null; msGridRow: any; - msGridRowAlign: string; + msGridRowAlign: string | null; msGridRowSpan: any; - msGridRows: string; - msHighContrastAdjust: string; - msHyphenateLimitChars: string; + msGridRows: string | null; + msHighContrastAdjust: string | null; + msHyphenateLimitChars: string | null; msHyphenateLimitLines: any; msHyphenateLimitZone: any; - msHyphens: string; - msImeAlign: string; - msOverflowStyle: string; - msScrollChaining: string; - msScrollLimit: string; + msHyphens: string | null; + msImeAlign: string | null; + msOverflowStyle: string | null; + msScrollChaining: string | null; + msScrollLimit: string | null; msScrollLimitXMax: any; msScrollLimitXMin: any; msScrollLimitYMax: any; msScrollLimitYMin: any; - msScrollRails: string; - msScrollSnapPointsX: string; - msScrollSnapPointsY: string; - msScrollSnapType: string; - msScrollSnapX: string; - msScrollSnapY: string; - msScrollTranslation: string; - msTextCombineHorizontal: string; + msScrollRails: string | null; + msScrollSnapPointsX: string | null; + msScrollSnapPointsY: string | null; + msScrollSnapType: string | null; + msScrollSnapX: string | null; + msScrollSnapY: string | null; + msScrollTranslation: string | null; + msTextCombineHorizontal: string | null; msTextSizeAdjust: any; - msTouchAction: string; - msTouchSelect: string; - msUserSelect: string; + msTouchAction: string | null; + msTouchSelect: string | null; + msUserSelect: string | null; msWrapFlow: string; msWrapMargin: any; msWrapThrough: string; - opacity: string; - order: string; - orphans: string; - outline: string; - outlineColor: string; - outlineStyle: string; - outlineWidth: string; - overflow: string; - overflowX: string; - overflowY: string; - padding: string; - paddingBottom: string; - paddingLeft: string; - paddingRight: string; - paddingTop: string; - pageBreakAfter: string; - pageBreakBefore: string; - pageBreakInside: string; - parentRule: CSSRule; - perspective: string; - perspectiveOrigin: string; - pointerEvents: string; - position: string; - quotes: string; - right: string; - rubyAlign: string; - rubyOverhang: string; - rubyPosition: string; - stopColor: string; - stopOpacity: string; - stroke: string; - strokeDasharray: string; - strokeDashoffset: string; - strokeLinecap: string; - strokeLinejoin: string; - strokeMiterlimit: string; - strokeOpacity: string; - strokeWidth: string; - tableLayout: string; - textAlign: string; - textAlignLast: string; - textAnchor: string; - textDecoration: string; - textFillColor: string; - textIndent: string; - textJustify: string; - textKashida: string; - textKashidaSpace: string; - textOverflow: string; - textShadow: string; - textTransform: string; - textUnderlinePosition: string; - top: string; - touchAction: string; - transform: string; - transformOrigin: string; - transformStyle: string; - transition: string; - transitionDelay: string; - transitionDuration: string; - transitionProperty: string; - transitionTimingFunction: string; - unicodeBidi: string; - verticalAlign: string; - visibility: string; - webkitAlignContent: string; - webkitAlignItems: string; - webkitAlignSelf: string; - webkitAnimation: string; - webkitAnimationDelay: string; - webkitAnimationDirection: string; - webkitAnimationDuration: string; - webkitAnimationFillMode: string; - webkitAnimationIterationCount: string; - webkitAnimationName: string; - webkitAnimationPlayState: string; - webkitAnimationTimingFunction: string; - webkitAppearance: string; - webkitBackfaceVisibility: string; - webkitBackground: string; - webkitBackgroundAttachment: string; - webkitBackgroundClip: string; - webkitBackgroundColor: string; - webkitBackgroundImage: string; - webkitBackgroundOrigin: string; - webkitBackgroundPosition: string; - webkitBackgroundPositionX: string; - webkitBackgroundPositionY: string; - webkitBackgroundRepeat: string; - webkitBackgroundSize: string; - webkitBorderBottomLeftRadius: string; - webkitBorderBottomRightRadius: string; - webkitBorderImage: string; - webkitBorderImageOutset: string; - webkitBorderImageRepeat: string; - webkitBorderImageSlice: string; - webkitBorderImageSource: string; - webkitBorderImageWidth: string; - webkitBorderRadius: string; - webkitBorderTopLeftRadius: string; - webkitBorderTopRightRadius: string; - webkitBoxAlign: string; - webkitBoxDirection: string; - webkitBoxFlex: string; - webkitBoxOrdinalGroup: string; - webkitBoxOrient: string; - webkitBoxPack: string; - webkitBoxSizing: string; - webkitColumnBreakAfter: string; - webkitColumnBreakBefore: string; - webkitColumnBreakInside: string; + opacity: string | null; + order: string | null; + orphans: string | null; + outline: string | null; + outlineColor: string | null; + outlineStyle: string | null; + outlineWidth: string | null; + overflow: string | null; + overflowX: string | null; + overflowY: string | null; + padding: string | null; + paddingBottom: string | null; + paddingLeft: string | null; + paddingRight: string | null; + paddingTop: string | null; + pageBreakAfter: string | null; + pageBreakBefore: string | null; + pageBreakInside: string | null; + readonly parentRule: CSSRule; + perspective: string | null; + perspectiveOrigin: string | null; + pointerEvents: string | null; + position: string | null; + quotes: string | null; + right: string | null; + rubyAlign: string | null; + rubyOverhang: string | null; + rubyPosition: string | null; + stopColor: string | null; + stopOpacity: string | null; + stroke: string | null; + strokeDasharray: string | null; + strokeDashoffset: string | null; + strokeLinecap: string | null; + strokeLinejoin: string | null; + strokeMiterlimit: string | null; + strokeOpacity: string | null; + strokeWidth: string | null; + tableLayout: string | null; + textAlign: string | null; + textAlignLast: string | null; + textAnchor: string | null; + textDecoration: string | null; + textIndent: string | null; + textJustify: string | null; + textKashida: string | null; + textKashidaSpace: string | null; + textOverflow: string | null; + textShadow: string | null; + textTransform: string | null; + textUnderlinePosition: string | null; + top: string | null; + touchAction: string | null; + transform: string | null; + transformOrigin: string | null; + transformStyle: string | null; + transition: string | null; + transitionDelay: string | null; + transitionDuration: string | null; + transitionProperty: string | null; + transitionTimingFunction: string | null; + unicodeBidi: string | null; + verticalAlign: string | null; + visibility: string | null; + webkitAlignContent: string | null; + webkitAlignItems: string | null; + webkitAlignSelf: string | null; + webkitAnimation: string | null; + webkitAnimationDelay: string | null; + webkitAnimationDirection: string | null; + webkitAnimationDuration: string | null; + webkitAnimationFillMode: string | null; + webkitAnimationIterationCount: string | null; + webkitAnimationName: string | null; + webkitAnimationPlayState: string | null; + webkitAnimationTimingFunction: string | null; + webkitAppearance: string | null; + webkitBackfaceVisibility: string | null; + webkitBackgroundClip: string | null; + webkitBackgroundOrigin: string | null; + webkitBackgroundSize: string | null; + webkitBorderBottomLeftRadius: string | null; + webkitBorderBottomRightRadius: string | null; + webkitBorderImage: string | null; + webkitBorderRadius: string | null; + webkitBorderTopLeftRadius: string | null; + webkitBorderTopRightRadius: string | null; + webkitBoxAlign: string | null; + webkitBoxDirection: string | null; + webkitBoxFlex: string | null; + webkitBoxOrdinalGroup: string | null; + webkitBoxOrient: string | null; + webkitBoxPack: string | null; + webkitBoxSizing: string | null; + webkitColumnBreakAfter: string | null; + webkitColumnBreakBefore: string | null; + webkitColumnBreakInside: string | null; webkitColumnCount: any; webkitColumnGap: any; - webkitColumnRule: string; + webkitColumnRule: string | null; webkitColumnRuleColor: any; - webkitColumnRuleStyle: string; + webkitColumnRuleStyle: string | null; webkitColumnRuleWidth: any; - webkitColumnSpan: string; + webkitColumnSpan: string | null; webkitColumnWidth: any; - webkitColumns: string; - webkitFilter: string; - webkitFlex: string; - webkitFlexBasis: string; - webkitFlexDirection: string; - webkitFlexFlow: string; - webkitFlexGrow: string; - webkitFlexShrink: string; - webkitFlexWrap: string; - webkitJustifyContent: string; - webkitOrder: string; - webkitPerspective: string; - webkitPerspectiveOrigin: string; - webkitTapHighlightColor: string; - webkitTextFillColor: string; + webkitColumns: string | null; + webkitFilter: string | null; + webkitFlex: string | null; + webkitFlexBasis: string | null; + webkitFlexDirection: string | null; + webkitFlexFlow: string | null; + webkitFlexGrow: string | null; + webkitFlexShrink: string | null; + webkitFlexWrap: string | null; + webkitJustifyContent: string | null; + webkitOrder: string | null; + webkitPerspective: string | null; + webkitPerspectiveOrigin: string | null; + webkitTapHighlightColor: string | null; + webkitTextFillColor: string | null; webkitTextSizeAdjust: any; - webkitTransform: string; - webkitTransformOrigin: string; - webkitTransformStyle: string; - webkitTransition: string; - webkitTransitionDelay: string; - webkitTransitionDuration: string; - webkitTransitionProperty: string; - webkitTransitionTimingFunction: string; - webkitUserSelect: string; - webkitWritingMode: string; - whiteSpace: string; - widows: string; - width: string; - wordBreak: string; - wordSpacing: string; - wordWrap: string; - writingMode: string; - zIndex: string; - zoom: string; + webkitTransform: string | null; + webkitTransformOrigin: string | null; + webkitTransformStyle: string | null; + webkitTransition: string | null; + webkitTransitionDelay: string | null; + webkitTransitionDuration: string | null; + webkitTransitionProperty: string | null; + webkitTransitionTimingFunction: string | null; + webkitUserModify: string | null; + webkitUserSelect: string | null; + webkitWritingMode: string | null; + whiteSpace: string | null; + widows: string | null; + width: string | null; + wordBreak: string | null; + wordSpacing: string | null; + wordWrap: string | null; + writingMode: string | null; + zIndex: string | null; + zoom: string | null; getPropertyPriority(propertyName: string): string; getPropertyValue(propertyName: string): string; item(index: number): string; removeProperty(propertyName: string): string; - setProperty(propertyName: string, value: string, priority?: string): void; + setProperty(propertyName: string, value: string | null, priority?: string): void; [index: number]: string; } @@ -5044,9 +5817,9 @@ declare var CSSStyleDeclaration: { } interface CSSStyleRule extends CSSRule { - readOnly: boolean; + readonly readOnly: boolean; selectorText: string; - style: CSSStyleDeclaration; + readonly style: CSSStyleDeclaration; } declare var CSSStyleRule: { @@ -5055,18 +5828,18 @@ declare var CSSStyleRule: { } interface CSSStyleSheet extends StyleSheet { - cssRules: CSSRuleList; + readonly cssRules: CSSRuleList; cssText: string; - href: string; - id: string; - imports: StyleSheetList; - isAlternate: boolean; - isPrefAlternate: boolean; - ownerRule: CSSRule; - owningElement: Element; - pages: StyleSheetPageList; - readOnly: boolean; - rules: CSSRuleList; + readonly href: string; + readonly id: string; + readonly imports: StyleSheetList; + readonly isAlternate: boolean; + readonly isPrefAlternate: boolean; + readonly ownerRule: CSSRule; + readonly owningElement: Element; + readonly pages: StyleSheetPageList; + readonly readOnly: boolean; + readonly rules: CSSRuleList; addImport(bstrURL: string, lIndex?: number): number; addPageRule(bstrSelector: string, bstrStyle: string, lIndex?: number): number; addRule(bstrSelector: string, bstrStyle?: string, lIndex?: number): number; @@ -5106,8 +5879,8 @@ declare var CanvasPattern: { new(): CanvasPattern; } -interface CanvasRenderingContext2D { - canvas: HTMLCanvasElement; +interface CanvasRenderingContext2D extends Object, CanvasPathMethods { + readonly canvas: HTMLCanvasElement; fillStyle: string | CanvasGradient | CanvasPattern; font: string; globalAlpha: number; @@ -5126,13 +5899,12 @@ interface CanvasRenderingContext2D { strokeStyle: string | CanvasGradient | CanvasPattern; textAlign: string; textBaseline: string; - arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void; - arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void; + mozImageSmoothingEnabled: boolean; + webkitImageSmoothingEnabled: boolean; + oImageSmoothingEnabled: boolean; beginPath(): void; - bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void; clearRect(x: number, y: number, w: number, h: number): void; clip(fillRule?: string): void; - closePath(): void; createImageData(imageDataOrSw: number | ImageData, sh?: number): ImageData; createLinearGradient(x0: number, y0: number, x1: number, y1: number): CanvasGradient; createPattern(image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement, repetition: string): CanvasPattern; @@ -5144,12 +5916,8 @@ interface CanvasRenderingContext2D { getImageData(sx: number, sy: number, sw: number, sh: number): ImageData; getLineDash(): number[]; isPointInPath(x: number, y: number, fillRule?: string): boolean; - lineTo(x: number, y: number): void; measureText(text: string): TextMetrics; - moveTo(x: number, y: number): void; putImageData(imagedata: ImageData, dx: number, dy: number, dirtyX?: number, dirtyY?: number, dirtyWidth?: number, dirtyHeight?: number): void; - quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void; - rect(x: number, y: number, w: number, h: number): void; restore(): void; rotate(angle: number): void; save(): void; @@ -5186,7 +5954,7 @@ declare var ChannelSplitterNode: { interface CharacterData extends Node, ChildNode { data: string; - length: number; + readonly length: number; appendData(arg: string): void; deleteData(offset: number, count: number): void; insertData(offset: number, arg: string): void; @@ -5202,11 +5970,11 @@ declare var CharacterData: { interface ClientRect { bottom: number; - height: number; + readonly height: number; left: number; right: number; top: number; - width: number; + readonly width: number; } declare var ClientRect: { @@ -5215,7 +5983,7 @@ declare var ClientRect: { } interface ClientRectList { - length: number; + readonly length: number; item(index: number): ClientRect; [index: number]: ClientRect; } @@ -5226,7 +5994,7 @@ declare var ClientRectList: { } interface ClipboardEvent extends Event { - clipboardData: DataTransfer; + readonly clipboardData: DataTransfer; } declare var ClipboardEvent: { @@ -5235,9 +6003,9 @@ declare var ClipboardEvent: { } interface CloseEvent extends Event { - code: number; - reason: string; - wasClean: boolean; + readonly code: number; + readonly reason: string; + readonly wasClean: boolean; initCloseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, wasCleanArg: boolean, codeArg: number, reasonArg: string): void; } @@ -5247,8 +6015,8 @@ declare var CloseEvent: { } interface CommandEvent extends Event { - commandName: string; - detail: string; + readonly commandName: string; + readonly detail: string | null; } declare var CommandEvent: { @@ -5266,8 +6034,8 @@ declare var Comment: { } interface CompositionEvent extends UIEvent { - data: string; - locale: string; + readonly data: string; + readonly locale: string; initCompositionEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, dataArg: string, locale: string): void; } @@ -5284,6 +6052,7 @@ interface Console { dir(value?: any, ...optionalParams: any[]): void; dirxml(value: any): void; error(message?: any, ...optionalParams: any[]): void; + exception(message?: string, ...optionalParams: any[]): void; group(groupTitle?: string): void; groupCollapsed(groupTitle?: string): void; groupEnd(): void; @@ -5293,9 +6062,10 @@ interface Console { profile(reportName?: string): void; profileEnd(): void; select(element: Element): void; + table(...data: any[]): void; time(timerName?: string): void; timeEnd(timerName?: string): void; - trace(): void; + trace(message?: any, ...optionalParams: any[]): void; warn(message?: any, ...optionalParams: any[]): void; } @@ -5305,7 +6075,7 @@ declare var Console: { } interface ConvolverNode extends AudioNode { - buffer: AudioBuffer; + buffer: AudioBuffer | null; normalize: boolean; } @@ -5315,13 +6085,13 @@ declare var ConvolverNode: { } interface Coordinates { - accuracy: number; - altitude: number; - altitudeAccuracy: number; - heading: number; - latitude: number; - longitude: number; - speed: number; + readonly accuracy: number; + readonly altitude: number | null; + readonly altitudeAccuracy: number | null; + readonly heading: number | null; + readonly latitude: number; + readonly longitude: number; + readonly speed: number | null; } declare var Coordinates: { @@ -5330,7 +6100,7 @@ declare var Coordinates: { } interface Crypto extends Object, RandomSource { - subtle: SubtleCrypto; + readonly subtle: SubtleCrypto; } declare var Crypto: { @@ -5339,10 +6109,10 @@ declare var Crypto: { } interface CryptoKey { - algorithm: KeyAlgorithm; - extractable: boolean; - type: string; - usages: string[]; + readonly algorithm: KeyAlgorithm; + readonly extractable: boolean; + readonly type: string; + readonly usages: string[]; } declare var CryptoKey: { @@ -5361,7 +6131,7 @@ declare var CryptoKeyPair: { } interface CustomEvent extends Event { - detail: any; + readonly detail: any; initCustomEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, detailArg: any): void; } @@ -5371,7 +6141,7 @@ declare var CustomEvent: { } interface DOMError { - name: string; + readonly name: string; toString(): string; } @@ -5381,76 +6151,76 @@ declare var DOMError: { } interface DOMException { - code: number; - message: string; - name: string; + readonly code: number; + readonly message: string; + readonly name: string; toString(): string; - ABORT_ERR: number; - DATA_CLONE_ERR: number; - DOMSTRING_SIZE_ERR: number; - HIERARCHY_REQUEST_ERR: number; - INDEX_SIZE_ERR: number; - INUSE_ATTRIBUTE_ERR: number; - INVALID_ACCESS_ERR: number; - INVALID_CHARACTER_ERR: number; - INVALID_MODIFICATION_ERR: number; - INVALID_NODE_TYPE_ERR: number; - INVALID_STATE_ERR: number; - NAMESPACE_ERR: number; - NETWORK_ERR: number; - NOT_FOUND_ERR: number; - NOT_SUPPORTED_ERR: number; - NO_DATA_ALLOWED_ERR: number; - NO_MODIFICATION_ALLOWED_ERR: number; - PARSE_ERR: number; - QUOTA_EXCEEDED_ERR: number; - SECURITY_ERR: number; - SERIALIZE_ERR: number; - SYNTAX_ERR: number; - TIMEOUT_ERR: number; - TYPE_MISMATCH_ERR: number; - URL_MISMATCH_ERR: number; - VALIDATION_ERR: number; - WRONG_DOCUMENT_ERR: number; + readonly ABORT_ERR: number; + readonly DATA_CLONE_ERR: number; + readonly DOMSTRING_SIZE_ERR: number; + readonly HIERARCHY_REQUEST_ERR: number; + readonly INDEX_SIZE_ERR: number; + readonly INUSE_ATTRIBUTE_ERR: number; + readonly INVALID_ACCESS_ERR: number; + readonly INVALID_CHARACTER_ERR: number; + readonly INVALID_MODIFICATION_ERR: number; + readonly INVALID_NODE_TYPE_ERR: number; + readonly INVALID_STATE_ERR: number; + readonly NAMESPACE_ERR: number; + readonly NETWORK_ERR: number; + readonly NOT_FOUND_ERR: number; + readonly NOT_SUPPORTED_ERR: number; + readonly NO_DATA_ALLOWED_ERR: number; + readonly NO_MODIFICATION_ALLOWED_ERR: number; + readonly PARSE_ERR: number; + readonly QUOTA_EXCEEDED_ERR: number; + readonly SECURITY_ERR: number; + readonly SERIALIZE_ERR: number; + readonly SYNTAX_ERR: number; + readonly TIMEOUT_ERR: number; + readonly TYPE_MISMATCH_ERR: number; + readonly URL_MISMATCH_ERR: number; + readonly VALIDATION_ERR: number; + readonly WRONG_DOCUMENT_ERR: number; } declare var DOMException: { prototype: DOMException; new(): DOMException; - ABORT_ERR: number; - DATA_CLONE_ERR: number; - DOMSTRING_SIZE_ERR: number; - HIERARCHY_REQUEST_ERR: number; - INDEX_SIZE_ERR: number; - INUSE_ATTRIBUTE_ERR: number; - INVALID_ACCESS_ERR: number; - INVALID_CHARACTER_ERR: number; - INVALID_MODIFICATION_ERR: number; - INVALID_NODE_TYPE_ERR: number; - INVALID_STATE_ERR: number; - NAMESPACE_ERR: number; - NETWORK_ERR: number; - NOT_FOUND_ERR: number; - NOT_SUPPORTED_ERR: number; - NO_DATA_ALLOWED_ERR: number; - NO_MODIFICATION_ALLOWED_ERR: number; - PARSE_ERR: number; - QUOTA_EXCEEDED_ERR: number; - SECURITY_ERR: number; - SERIALIZE_ERR: number; - SYNTAX_ERR: number; - TIMEOUT_ERR: number; - TYPE_MISMATCH_ERR: number; - URL_MISMATCH_ERR: number; - VALIDATION_ERR: number; - WRONG_DOCUMENT_ERR: number; + readonly ABORT_ERR: number; + readonly DATA_CLONE_ERR: number; + readonly DOMSTRING_SIZE_ERR: number; + readonly HIERARCHY_REQUEST_ERR: number; + readonly INDEX_SIZE_ERR: number; + readonly INUSE_ATTRIBUTE_ERR: number; + readonly INVALID_ACCESS_ERR: number; + readonly INVALID_CHARACTER_ERR: number; + readonly INVALID_MODIFICATION_ERR: number; + readonly INVALID_NODE_TYPE_ERR: number; + readonly INVALID_STATE_ERR: number; + readonly NAMESPACE_ERR: number; + readonly NETWORK_ERR: number; + readonly NOT_FOUND_ERR: number; + readonly NOT_SUPPORTED_ERR: number; + readonly NO_DATA_ALLOWED_ERR: number; + readonly NO_MODIFICATION_ALLOWED_ERR: number; + readonly PARSE_ERR: number; + readonly QUOTA_EXCEEDED_ERR: number; + readonly SECURITY_ERR: number; + readonly SERIALIZE_ERR: number; + readonly SYNTAX_ERR: number; + readonly TIMEOUT_ERR: number; + readonly TYPE_MISMATCH_ERR: number; + readonly URL_MISMATCH_ERR: number; + readonly VALIDATION_ERR: number; + readonly WRONG_DOCUMENT_ERR: number; } interface DOMImplementation { - createDocument(namespaceURI: string, qualifiedName: string, doctype: DocumentType): Document; - createDocumentType(qualifiedName: string, publicId: string, systemId: string): DocumentType; + createDocument(namespaceURI: string | null, qualifiedName: string | null, doctype: DocumentType): Document; + createDocumentType(qualifiedName: string, publicId: string | null, systemId: string | null): DocumentType; createHTMLDocument(title: string): Document; - hasFeature(feature: string, version: string): boolean; + hasFeature(feature: string | null, version: string | null): boolean; } declare var DOMImplementation: { @@ -5477,9 +6247,9 @@ declare var DOMSettableTokenList: { } interface DOMStringList { - length: number; + readonly length: number; contains(str: string): boolean; - item(index: number): string; + item(index: number): string | null; [index: number]: string; } @@ -5498,7 +6268,7 @@ declare var DOMStringMap: { } interface DOMTokenList { - length: number; + readonly length: number; add(...token: string[]): void; contains(token: string): boolean; item(index: number): string; @@ -5525,9 +6295,9 @@ declare var DataCue: { interface DataTransfer { dropEffect: string; effectAllowed: string; - files: FileList; - items: DataTransferItemList; - types: DOMStringList; + readonly files: FileList; + readonly items: DataTransferItemList; + readonly types: DOMStringList; clearData(format?: string): boolean; getData(format: string): string; setData(format: string, data: string): boolean; @@ -5539,10 +6309,10 @@ declare var DataTransfer: { } interface DataTransferItem { - kind: string; - type: string; - getAsFile(): File; - getAsString(_callback: FunctionStringCallback): void; + readonly kind: string; + readonly type: string; + getAsFile(): File | null; + getAsString(_callback: FunctionStringCallback | null): void; } declare var DataTransferItem: { @@ -5551,12 +6321,12 @@ declare var DataTransferItem: { } interface DataTransferItemList { - length: number; - add(data: File): DataTransferItem; + readonly length: number; + add(data: File): DataTransferItem | null; clear(): void; - item(index: number): File; + item(index: number): DataTransferItem; remove(index: number): void; - [index: number]: File; + [index: number]: DataTransferItem; } declare var DataTransferItemList: { @@ -5565,9 +6335,9 @@ declare var DataTransferItemList: { } interface DeferredPermissionRequest { - id: number; - type: string; - uri: string; + readonly id: number; + readonly type: string; + readonly uri: string; allow(): void; deny(): void; } @@ -5578,7 +6348,7 @@ declare var DeferredPermissionRequest: { } interface DelayNode extends AudioNode { - delayTime: AudioParam; + readonly delayTime: AudioParam; } declare var DelayNode: { @@ -5587,9 +6357,9 @@ declare var DelayNode: { } interface DeviceAcceleration { - x: number; - y: number; - z: number; + readonly x: number | null; + readonly y: number | null; + readonly z: number | null; } declare var DeviceAcceleration: { @@ -5597,12 +6367,21 @@ declare var DeviceAcceleration: { new(): DeviceAcceleration; } +interface DeviceLightEvent extends Event { + readonly value: number; +} + +declare var DeviceLightEvent: { + prototype: DeviceLightEvent; + new(type: string, eventInitDict?: DeviceLightEventInit): DeviceLightEvent; +} + interface DeviceMotionEvent extends Event { - acceleration: DeviceAcceleration; - accelerationIncludingGravity: DeviceAcceleration; - interval: number; - rotationRate: DeviceRotationRate; - initDeviceMotionEvent(type: string, bubbles: boolean, cancelable: boolean, acceleration: DeviceAccelerationDict, accelerationIncludingGravity: DeviceAccelerationDict, rotationRate: DeviceRotationRateDict, interval: number): void; + readonly acceleration: DeviceAcceleration | null; + readonly accelerationIncludingGravity: DeviceAcceleration | null; + readonly interval: number | null; + readonly rotationRate: DeviceRotationRate | null; + initDeviceMotionEvent(type: string, bubbles: boolean, cancelable: boolean, acceleration: DeviceAccelerationDict | null, accelerationIncludingGravity: DeviceAccelerationDict | null, rotationRate: DeviceRotationRateDict | null, interval: number | null): void; } declare var DeviceMotionEvent: { @@ -5611,11 +6390,11 @@ declare var DeviceMotionEvent: { } interface DeviceOrientationEvent extends Event { - absolute: boolean; - alpha: number; - beta: number; - gamma: number; - initDeviceOrientationEvent(type: string, bubbles: boolean, cancelable: boolean, alpha: number, beta: number, gamma: number, absolute: boolean): void; + readonly absolute: boolean; + readonly alpha: number | null; + readonly beta: number | null; + readonly gamma: number | null; + initDeviceOrientationEvent(type: string, bubbles: boolean, cancelable: boolean, alpha: number | null, beta: number | null, gamma: number | null, absolute: boolean): void; } declare var DeviceOrientationEvent: { @@ -5624,9 +6403,9 @@ declare var DeviceOrientationEvent: { } interface DeviceRotationRate { - alpha: number; - beta: number; - gamma: number; + readonly alpha: number | null; + readonly beta: number | null; + readonly gamma: number | null; } declare var DeviceRotationRate: { @@ -5638,15 +6417,15 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven /** * Sets or gets the URL for the current document. */ - URL: string; + readonly URL: string; /** * Gets the URL for the document, stripped of any character encoding. */ - URLUnencoded: string; + readonly URLUnencoded: string; /** * Gets the object that has the focus when the parent document has focus. */ - activeElement: Element; + readonly activeElement: Element; /** * Sets or gets the color of all active links in the document. */ @@ -5654,15 +6433,15 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven /** * Returns a reference to the collection of elements contained by the object. */ - all: HTMLCollection; + readonly all: HTMLAllCollection; /** * Retrieves a collection of all a objects that have a name and/or id property. Objects in this collection are in HTML source order. */ - anchors: HTMLCollection; + anchors: HTMLCollectionOf; /** * Retrieves a collection of all applet objects in the document. */ - applets: HTMLCollection; + applets: HTMLCollectionOf; /** * Deprecated. Sets or retrieves a value that indicates the background color behind the object. */ @@ -5671,7 +6450,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * Specifies the beginning and end of the document body. */ body: HTMLElement; - characterSet: string; + readonly characterSet: string; /** * Gets or sets the character set used to encode the object. */ @@ -5679,13 +6458,14 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven /** * Gets a value that indicates whether standards-compliant mode is switched on for the object. */ - compatMode: string; + readonly compatMode: string; cookie: string; + readonly currentScript: HTMLScriptElement | SVGScriptElement; /** * Gets the default character set from the current regional language settings. */ - defaultCharset: string; - defaultView: Window; + readonly defaultCharset: string; + readonly defaultView: Window; /** * Sets or gets a value that indicates whether the document can be edited. */ @@ -5697,7 +6477,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven /** * Gets an object representing the document type declaration associated with the current document. */ - doctype: DocumentType; + readonly doctype: DocumentType; /** * Gets a reference to the root node of the document. */ @@ -5709,7 +6489,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven /** * Retrieves a collection of all embed objects in the document. */ - embeds: HTMLCollection; + embeds: HTMLCollectionOf; /** * Sets or gets the foreground (text) color of the document. */ @@ -5717,27 +6497,27 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven /** * Retrieves a collection, in source order, of all form objects in the document. */ - forms: HTMLCollection; - fullscreenElement: Element; - fullscreenEnabled: boolean; - head: HTMLHeadElement; - hidden: boolean; + forms: HTMLCollectionOf; + readonly fullscreenElement: Element | null; + readonly fullscreenEnabled: boolean; + readonly head: HTMLHeadElement; + readonly hidden: boolean; /** * Retrieves a collection, in source order, of img objects in the document. */ - images: HTMLCollection; + images: HTMLCollectionOf; /** * Gets the implementation object of the current document. */ - implementation: DOMImplementation; + readonly implementation: DOMImplementation; /** * Returns the character encoding used to create the webpage that is loaded into the document object. */ - inputEncoding: string; + readonly inputEncoding: string | null; /** * Gets the date that the page was last modified, if the page supplies one. */ - lastModified: string; + readonly lastModified: string; /** * Sets or gets the color of the document links. */ @@ -5745,16 +6525,13 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven /** * Retrieves a collection of all a objects that specify the href property and all area objects in the document. */ - links: HTMLCollection; + links: HTMLCollectionOf; /** * Contains information about the current URL. */ - location: Location; - media: string; + readonly location: Location; msCSSOMElementFloatMetrics: boolean; msCapsLockWarningOff: boolean; - msHidden: boolean; - msVisibilityState: string; /** * Fires when the user aborts the download. * @param ev The event. @@ -5856,7 +6633,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * Occurs when the end of playback is reached. * @param ev The event */ - onended: (ev: Event) => any; + onended: (ev: MediaStreamErrorEvent) => any; /** * Fires when an error occurs during object loading. * @param ev The event. @@ -5870,6 +6647,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven onfullscreenchange: (ev: Event) => any; onfullscreenerror: (ev: Event) => any; oninput: (ev: Event) => any; + oninvalid: (ev: Event) => any; /** * Fires when the user presses a key. * @param ev The keyboard event @@ -5934,7 +6712,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * Fires when the wheel button is rotated. * @param ev The mouse event */ - onmousewheel: (ev: MouseWheelEvent) => any; + onmousewheel: (ev: WheelEvent) => any; onmscontentzoom: (ev: UIEvent) => any; onmsgesturechange: (ev: MSGestureEvent) => any; onmsgesturedoubletap: (ev: MSGestureEvent) => any; @@ -6019,6 +6797,11 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * @param ev The event. */ onselect: (ev: UIEvent) => any; + /** + * Fires when the selection state of a document changes. + * @param ev The event. + */ + onselectionchange: (ev: Event) => any; onselectstart: (ev: Event) => any; /** * Occurs when the download has stopped. @@ -6057,50 +6840,51 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven onwaiting: (ev: Event) => any; onwebkitfullscreenchange: (ev: Event) => any; onwebkitfullscreenerror: (ev: Event) => any; - plugins: HTMLCollection; - pointerLockElement: Element; + plugins: HTMLCollectionOf; + readonly pointerLockElement: Element; /** * Retrieves a value that indicates the current state of the object. */ - readyState: string; + readonly readyState: string; /** * Gets the URL of the location that referred the user to the current page. */ - referrer: string; + readonly referrer: string; /** * Gets the root svg element in the document hierarchy. */ - rootElement: SVGSVGElement; + readonly rootElement: SVGSVGElement; /** * Retrieves a collection of all script objects in the document. */ - scripts: HTMLCollection; - security: string; + scripts: HTMLCollectionOf; + readonly scrollingElement: Element | null; /** * Retrieves a collection of styleSheet objects representing the style sheets that correspond to each instance of a link or style object in the document. */ - styleSheets: StyleSheetList; + readonly styleSheets: StyleSheetList; /** * Contains the title of the document. */ title: string; - visibilityState: string; + readonly visibilityState: string; /** * Sets or gets the color of the links that the user has visited. */ vlinkColor: string; - webkitCurrentFullScreenElement: Element; - webkitFullscreenElement: Element; - webkitFullscreenEnabled: boolean; - webkitIsFullScreen: boolean; - xmlEncoding: string; + readonly webkitCurrentFullScreenElement: Element | null; + readonly webkitFullscreenElement: Element | null; + readonly webkitFullscreenEnabled: boolean; + readonly webkitIsFullScreen: boolean; + readonly xmlEncoding: string | null; xmlStandalone: boolean; /** * Gets or sets the version attribute specified in the declaration of an XML document. */ - xmlVersion: string; + xmlVersion: string | null; adoptNode(source: Node): Node; captureEvents(): void; + caretRangeFromPoint(x: number, y: number): Range; clear(): void; /** * Closes an output stream and forces the sent data to display. @@ -6111,7 +6895,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * @param name String that sets the attribute object's name. */ createAttribute(name: string): Attr; - createAttributeNS(namespaceURI: string, qualifiedName: string): Attr; + createAttributeNS(namespaceURI: string | null, qualifiedName: string): Attr; createCDATASection(data: string): CDATASection; /** * Creates a comment object with the specified data. @@ -6127,37 +6911,24 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * @param tagName The name of an element. */ createElement(tagName: "a"): HTMLAnchorElement; - createElement(tagName: "abbr"): HTMLPhraseElement; - createElement(tagName: "acronym"): HTMLPhraseElement; - createElement(tagName: "address"): HTMLBlockElement; createElement(tagName: "applet"): HTMLAppletElement; createElement(tagName: "area"): HTMLAreaElement; createElement(tagName: "audio"): HTMLAudioElement; - createElement(tagName: "b"): HTMLPhraseElement; createElement(tagName: "base"): HTMLBaseElement; createElement(tagName: "basefont"): HTMLBaseFontElement; - createElement(tagName: "bdo"): HTMLPhraseElement; - createElement(tagName: "big"): HTMLPhraseElement; - createElement(tagName: "blockquote"): HTMLBlockElement; + createElement(tagName: "blockquote"): HTMLQuoteElement; createElement(tagName: "body"): HTMLBodyElement; createElement(tagName: "br"): HTMLBRElement; createElement(tagName: "button"): HTMLButtonElement; createElement(tagName: "canvas"): HTMLCanvasElement; createElement(tagName: "caption"): HTMLTableCaptionElement; - createElement(tagName: "center"): HTMLBlockElement; - createElement(tagName: "cite"): HTMLPhraseElement; - createElement(tagName: "code"): HTMLPhraseElement; createElement(tagName: "col"): HTMLTableColElement; createElement(tagName: "colgroup"): HTMLTableColElement; createElement(tagName: "datalist"): HTMLDataListElement; - createElement(tagName: "dd"): HTMLDDElement; createElement(tagName: "del"): HTMLModElement; - createElement(tagName: "dfn"): HTMLPhraseElement; createElement(tagName: "dir"): HTMLDirectoryElement; createElement(tagName: "div"): HTMLDivElement; createElement(tagName: "dl"): HTMLDListElement; - createElement(tagName: "dt"): HTMLDTElement; - createElement(tagName: "em"): HTMLPhraseElement; createElement(tagName: "embed"): HTMLEmbedElement; createElement(tagName: "fieldset"): HTMLFieldSetElement; createElement(tagName: "font"): HTMLFontElement; @@ -6173,52 +6944,41 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven createElement(tagName: "head"): HTMLHeadElement; createElement(tagName: "hr"): HTMLHRElement; createElement(tagName: "html"): HTMLHtmlElement; - createElement(tagName: "i"): HTMLPhraseElement; createElement(tagName: "iframe"): HTMLIFrameElement; createElement(tagName: "img"): HTMLImageElement; createElement(tagName: "input"): HTMLInputElement; createElement(tagName: "ins"): HTMLModElement; - createElement(tagName: "isindex"): HTMLIsIndexElement; - createElement(tagName: "kbd"): HTMLPhraseElement; - createElement(tagName: "keygen"): HTMLBlockElement; + createElement(tagName: "isindex"): HTMLUnknownElement; createElement(tagName: "label"): HTMLLabelElement; createElement(tagName: "legend"): HTMLLegendElement; createElement(tagName: "li"): HTMLLIElement; createElement(tagName: "link"): HTMLLinkElement; - createElement(tagName: "listing"): HTMLBlockElement; + createElement(tagName: "listing"): HTMLPreElement; createElement(tagName: "map"): HTMLMapElement; createElement(tagName: "marquee"): HTMLMarqueeElement; createElement(tagName: "menu"): HTMLMenuElement; createElement(tagName: "meta"): HTMLMetaElement; - createElement(tagName: "nextid"): HTMLNextIdElement; - createElement(tagName: "nobr"): HTMLPhraseElement; + createElement(tagName: "meter"): HTMLMeterElement; + createElement(tagName: "nextid"): HTMLUnknownElement; createElement(tagName: "object"): HTMLObjectElement; createElement(tagName: "ol"): HTMLOListElement; createElement(tagName: "optgroup"): HTMLOptGroupElement; createElement(tagName: "option"): HTMLOptionElement; createElement(tagName: "p"): HTMLParagraphElement; createElement(tagName: "param"): HTMLParamElement; - createElement(tagName: "plaintext"): HTMLBlockElement; + createElement(tagName: "picture"): HTMLPictureElement; createElement(tagName: "pre"): HTMLPreElement; createElement(tagName: "progress"): HTMLProgressElement; createElement(tagName: "q"): HTMLQuoteElement; - createElement(tagName: "rt"): HTMLPhraseElement; - createElement(tagName: "ruby"): HTMLPhraseElement; - createElement(tagName: "s"): HTMLPhraseElement; - createElement(tagName: "samp"): HTMLPhraseElement; createElement(tagName: "script"): HTMLScriptElement; createElement(tagName: "select"): HTMLSelectElement; - createElement(tagName: "small"): HTMLPhraseElement; createElement(tagName: "source"): HTMLSourceElement; createElement(tagName: "span"): HTMLSpanElement; - createElement(tagName: "strike"): HTMLPhraseElement; - createElement(tagName: "strong"): HTMLPhraseElement; createElement(tagName: "style"): HTMLStyleElement; - createElement(tagName: "sub"): HTMLPhraseElement; - createElement(tagName: "sup"): HTMLPhraseElement; createElement(tagName: "table"): HTMLTableElement; createElement(tagName: "tbody"): HTMLTableSectionElement; createElement(tagName: "td"): HTMLTableDataCellElement; + createElement(tagName: "template"): HTMLTemplateElement; createElement(tagName: "textarea"): HTMLTextAreaElement; createElement(tagName: "tfoot"): HTMLTableSectionElement; createElement(tagName: "th"): HTMLTableHeaderCellElement; @@ -6226,14 +6986,12 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven createElement(tagName: "title"): HTMLTitleElement; createElement(tagName: "tr"): HTMLTableRowElement; createElement(tagName: "track"): HTMLTrackElement; - createElement(tagName: "tt"): HTMLPhraseElement; - createElement(tagName: "u"): HTMLPhraseElement; createElement(tagName: "ul"): HTMLUListElement; - createElement(tagName: "var"): HTMLPhraseElement; createElement(tagName: "video"): HTMLVideoElement; createElement(tagName: "x-ms-webview"): MSHTMLWebViewElement; - createElement(tagName: "xmp"): HTMLBlockElement; + createElement(tagName: "xmp"): HTMLPreElement; createElement(tagName: string): HTMLElement; + createElementNS(namespaceURI: "http://www.w3.org/1999/xhtml", qualifiedName: string): HTMLElement createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "a"): SVGAElement createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "circle"): SVGCircleElement createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "clipPath"): SVGClipPathElement @@ -6296,7 +7054,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "use"): SVGUseElement createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "view"): SVGViewElement createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: string): SVGElement - createElementNS(namespaceURI: string, qualifiedName: string): Element; + createElementNS(namespaceURI: string | null, qualifiedName: string): Element; createExpression(expression: string, resolver: XPathNSResolver): XPathExpression; createNSResolver(nodeResolver: Node): XPathNSResolver; /** @@ -6317,7 +7075,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * @param data String that specifies the nodeValue property of the text node. */ createTextNode(data: string): Text; - createTouch(view: any, target: EventTarget, identifier: number, pageX: number, pageY: number, screenX: number, screenY: number): Touch; + createTouch(view: Window, target: EventTarget, identifier: number, pageX: number, pageY: number, screenX: number, screenY: number): Touch; createTouchList(...touches: Touch[]): TouchList; /** * Creates a TreeWalker object that you can use to traverse filtered lists of nodes or elements in a document. @@ -6357,55 +7115,55 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * @param elementId String that specifies the ID value. Case-insensitive. */ getElementById(elementId: string): HTMLElement; - getElementsByClassName(classNames: string): NodeListOf; + getElementsByClassName(classNames: string): HTMLCollectionOf; /** * Gets a collection of objects based on the value of the NAME or ID attribute. * @param elementName Gets a collection of objects based on the value of the NAME or ID attribute. */ - getElementsByName(elementName: string): NodeListOf; + getElementsByName(elementName: string): NodeListOf; /** * Retrieves a collection of objects based on the specified element name. * @param name Specifies the name of an element. */ getElementsByTagName(tagname: "a"): NodeListOf; - getElementsByTagName(tagname: "abbr"): NodeListOf; - getElementsByTagName(tagname: "acronym"): NodeListOf; - getElementsByTagName(tagname: "address"): NodeListOf; + getElementsByTagName(tagname: "abbr"): NodeListOf; + getElementsByTagName(tagname: "acronym"): NodeListOf; + getElementsByTagName(tagname: "address"): NodeListOf; getElementsByTagName(tagname: "applet"): NodeListOf; getElementsByTagName(tagname: "area"): NodeListOf; getElementsByTagName(tagname: "article"): NodeListOf; getElementsByTagName(tagname: "aside"): NodeListOf; getElementsByTagName(tagname: "audio"): NodeListOf; - getElementsByTagName(tagname: "b"): NodeListOf; + getElementsByTagName(tagname: "b"): NodeListOf; getElementsByTagName(tagname: "base"): NodeListOf; getElementsByTagName(tagname: "basefont"): NodeListOf; - getElementsByTagName(tagname: "bdo"): NodeListOf; - getElementsByTagName(tagname: "big"): NodeListOf; - getElementsByTagName(tagname: "blockquote"): NodeListOf; + getElementsByTagName(tagname: "bdo"): NodeListOf; + getElementsByTagName(tagname: "big"): NodeListOf; + getElementsByTagName(tagname: "blockquote"): NodeListOf; getElementsByTagName(tagname: "body"): NodeListOf; getElementsByTagName(tagname: "br"): NodeListOf; getElementsByTagName(tagname: "button"): NodeListOf; getElementsByTagName(tagname: "canvas"): NodeListOf; getElementsByTagName(tagname: "caption"): NodeListOf; - getElementsByTagName(tagname: "center"): NodeListOf; + getElementsByTagName(tagname: "center"): NodeListOf; getElementsByTagName(tagname: "circle"): NodeListOf; - getElementsByTagName(tagname: "cite"): NodeListOf; + getElementsByTagName(tagname: "cite"): NodeListOf; getElementsByTagName(tagname: "clippath"): NodeListOf; - getElementsByTagName(tagname: "code"): NodeListOf; + getElementsByTagName(tagname: "code"): NodeListOf; getElementsByTagName(tagname: "col"): NodeListOf; getElementsByTagName(tagname: "colgroup"): NodeListOf; getElementsByTagName(tagname: "datalist"): NodeListOf; - getElementsByTagName(tagname: "dd"): NodeListOf; + getElementsByTagName(tagname: "dd"): NodeListOf; getElementsByTagName(tagname: "defs"): NodeListOf; getElementsByTagName(tagname: "del"): NodeListOf; getElementsByTagName(tagname: "desc"): NodeListOf; - getElementsByTagName(tagname: "dfn"): NodeListOf; + getElementsByTagName(tagname: "dfn"): NodeListOf; getElementsByTagName(tagname: "dir"): NodeListOf; getElementsByTagName(tagname: "div"): NodeListOf; getElementsByTagName(tagname: "dl"): NodeListOf; - getElementsByTagName(tagname: "dt"): NodeListOf; + getElementsByTagName(tagname: "dt"): NodeListOf; getElementsByTagName(tagname: "ellipse"): NodeListOf; - getElementsByTagName(tagname: "em"): NodeListOf; + getElementsByTagName(tagname: "em"): NodeListOf; getElementsByTagName(tagname: "embed"): NodeListOf; getElementsByTagName(tagname: "feblend"): NodeListOf; getElementsByTagName(tagname: "fecolormatrix"): NodeListOf; @@ -6453,22 +7211,22 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven getElementsByTagName(tagname: "hgroup"): NodeListOf; getElementsByTagName(tagname: "hr"): NodeListOf; getElementsByTagName(tagname: "html"): NodeListOf; - getElementsByTagName(tagname: "i"): NodeListOf; + getElementsByTagName(tagname: "i"): NodeListOf; getElementsByTagName(tagname: "iframe"): NodeListOf; getElementsByTagName(tagname: "image"): NodeListOf; getElementsByTagName(tagname: "img"): NodeListOf; getElementsByTagName(tagname: "input"): NodeListOf; getElementsByTagName(tagname: "ins"): NodeListOf; - getElementsByTagName(tagname: "isindex"): NodeListOf; - getElementsByTagName(tagname: "kbd"): NodeListOf; - getElementsByTagName(tagname: "keygen"): NodeListOf; + getElementsByTagName(tagname: "isindex"): NodeListOf; + getElementsByTagName(tagname: "kbd"): NodeListOf; + getElementsByTagName(tagname: "keygen"): NodeListOf; getElementsByTagName(tagname: "label"): NodeListOf; getElementsByTagName(tagname: "legend"): NodeListOf; getElementsByTagName(tagname: "li"): NodeListOf; getElementsByTagName(tagname: "line"): NodeListOf; getElementsByTagName(tagname: "lineargradient"): NodeListOf; getElementsByTagName(tagname: "link"): NodeListOf; - getElementsByTagName(tagname: "listing"): NodeListOf; + getElementsByTagName(tagname: "listing"): NodeListOf; getElementsByTagName(tagname: "map"): NodeListOf; getElementsByTagName(tagname: "mark"): NodeListOf; getElementsByTagName(tagname: "marker"): NodeListOf; @@ -6477,9 +7235,10 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven getElementsByTagName(tagname: "menu"): NodeListOf; getElementsByTagName(tagname: "meta"): NodeListOf; getElementsByTagName(tagname: "metadata"): NodeListOf; + getElementsByTagName(tagname: "meter"): NodeListOf; getElementsByTagName(tagname: "nav"): NodeListOf; - getElementsByTagName(tagname: "nextid"): NodeListOf; - getElementsByTagName(tagname: "nobr"): NodeListOf; + getElementsByTagName(tagname: "nextid"): NodeListOf; + getElementsByTagName(tagname: "nobr"): NodeListOf; getElementsByTagName(tagname: "noframes"): NodeListOf; getElementsByTagName(tagname: "noscript"): NodeListOf; getElementsByTagName(tagname: "object"): NodeListOf; @@ -6490,7 +7249,8 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven getElementsByTagName(tagname: "param"): NodeListOf; getElementsByTagName(tagname: "path"): NodeListOf; getElementsByTagName(tagname: "pattern"): NodeListOf; - getElementsByTagName(tagname: "plaintext"): NodeListOf; + getElementsByTagName(tagname: "picture"): NodeListOf; + getElementsByTagName(tagname: "plaintext"): NodeListOf; getElementsByTagName(tagname: "polygon"): NodeListOf; getElementsByTagName(tagname: "polyline"): NodeListOf; getElementsByTagName(tagname: "pre"): NodeListOf; @@ -6498,28 +7258,29 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven getElementsByTagName(tagname: "q"): NodeListOf; getElementsByTagName(tagname: "radialgradient"): NodeListOf; getElementsByTagName(tagname: "rect"): NodeListOf; - getElementsByTagName(tagname: "rt"): NodeListOf; - getElementsByTagName(tagname: "ruby"): NodeListOf; - getElementsByTagName(tagname: "s"): NodeListOf; - getElementsByTagName(tagname: "samp"): NodeListOf; + getElementsByTagName(tagname: "rt"): NodeListOf; + getElementsByTagName(tagname: "ruby"): NodeListOf; + getElementsByTagName(tagname: "s"): NodeListOf; + getElementsByTagName(tagname: "samp"): NodeListOf; getElementsByTagName(tagname: "script"): NodeListOf; getElementsByTagName(tagname: "section"): NodeListOf; getElementsByTagName(tagname: "select"): NodeListOf; - getElementsByTagName(tagname: "small"): NodeListOf; + getElementsByTagName(tagname: "small"): NodeListOf; getElementsByTagName(tagname: "source"): NodeListOf; getElementsByTagName(tagname: "span"): NodeListOf; getElementsByTagName(tagname: "stop"): NodeListOf; - getElementsByTagName(tagname: "strike"): NodeListOf; - getElementsByTagName(tagname: "strong"): NodeListOf; + getElementsByTagName(tagname: "strike"): NodeListOf; + getElementsByTagName(tagname: "strong"): NodeListOf; getElementsByTagName(tagname: "style"): NodeListOf; - getElementsByTagName(tagname: "sub"): NodeListOf; - getElementsByTagName(tagname: "sup"): NodeListOf; + getElementsByTagName(tagname: "sub"): NodeListOf; + getElementsByTagName(tagname: "sup"): NodeListOf; getElementsByTagName(tagname: "svg"): NodeListOf; getElementsByTagName(tagname: "switch"): NodeListOf; getElementsByTagName(tagname: "symbol"): NodeListOf; getElementsByTagName(tagname: "table"): NodeListOf; getElementsByTagName(tagname: "tbody"): NodeListOf; getElementsByTagName(tagname: "td"): NodeListOf; + getElementsByTagName(tagname: "template"): NodeListOf; getElementsByTagName(tagname: "text"): NodeListOf; getElementsByTagName(tagname: "textpath"): NodeListOf; getElementsByTagName(tagname: "textarea"): NodeListOf; @@ -6530,18 +7291,20 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven getElementsByTagName(tagname: "tr"): NodeListOf; getElementsByTagName(tagname: "track"): NodeListOf; getElementsByTagName(tagname: "tspan"): NodeListOf; - getElementsByTagName(tagname: "tt"): NodeListOf; - getElementsByTagName(tagname: "u"): NodeListOf; + getElementsByTagName(tagname: "tt"): NodeListOf; + getElementsByTagName(tagname: "u"): NodeListOf; getElementsByTagName(tagname: "ul"): NodeListOf; getElementsByTagName(tagname: "use"): NodeListOf; - getElementsByTagName(tagname: "var"): NodeListOf; + getElementsByTagName(tagname: "var"): NodeListOf; getElementsByTagName(tagname: "video"): NodeListOf; getElementsByTagName(tagname: "view"): NodeListOf; getElementsByTagName(tagname: "wbr"): NodeListOf; getElementsByTagName(tagname: "x-ms-webview"): NodeListOf; - getElementsByTagName(tagname: "xmp"): NodeListOf; + getElementsByTagName(tagname: "xmp"): NodeListOf; getElementsByTagName(tagname: string): NodeListOf; - getElementsByTagNameNS(namespaceURI: string, localName: string): NodeListOf; + getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf; + getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf; + getElementsByTagNameNS(namespaceURI: string, localName: string): HTMLCollectionOf; /** * Returns an object representing the current selection of the document that is loaded into the object displaying a webpage. */ @@ -6551,8 +7314,8 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven */ hasFocus(): boolean; importNode(importedNode: Node, deep: boolean): Node; - msElementsFromPoint(x: number, y: number): NodeList; - msElementsFromRect(left: number, top: number, width: number, height: number): NodeList; + msElementsFromPoint(x: number, y: number): NodeListOf; + msElementsFromRect(left: number, top: number, width: number, height: number): NodeListOf; /** * Opens a new window and loads a document specified by a given URL. Also, opens a new window that uses the url parameter and the name parameter to collect the output of the write method and the writeln method. * @param url Specifies a MIME type for the document. @@ -6646,12 +7409,13 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "fullscreenchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "fullscreenerror", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -6664,7 +7428,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; addEventListener(type: "mssitemodejumplistitemremoved", listener: (ev: MSSiteModeEvent) => any, useCapture?: boolean): void; addEventListener(type: "msthumbnailclick", listener: (ev: MSSiteModeEvent) => any, useCapture?: boolean): void; addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -6688,6 +7452,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven addEventListener(type: "seeked", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "seeking", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "select", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "selectionchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "selectstart", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "stalled", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "stop", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -6721,12 +7486,12 @@ declare var DocumentFragment: { } interface DocumentType extends Node, ChildNode { - entities: NamedNodeMap; - internalSubset: string; - name: string; - notations: NamedNodeMap; - publicId: string; - systemId: string; + readonly entities: NamedNodeMap; + readonly internalSubset: string | null; + readonly name: string; + readonly notations: NamedNodeMap; + readonly publicId: string | null; + readonly systemId: string | null; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -6736,7 +7501,7 @@ declare var DocumentType: { } interface DragEvent extends MouseEvent { - dataTransfer: DataTransfer; + readonly dataTransfer: DataTransfer; initDragEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, dataTransferArg: DataTransfer): void; msConvertURL(file: File, targetType: string, targetURL?: string): void; } @@ -6747,12 +7512,12 @@ declare var DragEvent: { } interface DynamicsCompressorNode extends AudioNode { - attack: AudioParam; - knee: AudioParam; - ratio: AudioParam; - reduction: AudioParam; - release: AudioParam; - threshold: AudioParam; + readonly attack: AudioParam; + readonly knee: AudioParam; + readonly ratio: AudioParam; + readonly reduction: AudioParam; + readonly release: AudioParam; + readonly threshold: AudioParam; } declare var DynamicsCompressorNode: { @@ -6760,26 +7525,36 @@ declare var DynamicsCompressorNode: { new(): DynamicsCompressorNode; } +interface EXT_frag_depth { +} + +declare var EXT_frag_depth: { + prototype: EXT_frag_depth; + new(): EXT_frag_depth; +} + interface EXT_texture_filter_anisotropic { - MAX_TEXTURE_MAX_ANISOTROPY_EXT: number; - TEXTURE_MAX_ANISOTROPY_EXT: number; + readonly MAX_TEXTURE_MAX_ANISOTROPY_EXT: number; + readonly TEXTURE_MAX_ANISOTROPY_EXT: number; } declare var EXT_texture_filter_anisotropic: { prototype: EXT_texture_filter_anisotropic; new(): EXT_texture_filter_anisotropic; - MAX_TEXTURE_MAX_ANISOTROPY_EXT: number; - TEXTURE_MAX_ANISOTROPY_EXT: number; + readonly MAX_TEXTURE_MAX_ANISOTROPY_EXT: number; + readonly TEXTURE_MAX_ANISOTROPY_EXT: number; } interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelector, ChildNode { - classList: DOMTokenList; - clientHeight: number; - clientLeft: number; - clientTop: number; - clientWidth: number; + readonly classList: DOMTokenList; + className: string; + readonly clientHeight: number; + readonly clientLeft: number; + readonly clientTop: number; + readonly clientWidth: number; + id: string; msContentZoomFactor: number; - msRegionOverflow: string; + readonly msRegionOverflow: string; onariarequest: (ev: AriaRequestEvent) => any; oncommand: (ev: CommandEvent) => any; ongotpointercapture: (ev: PointerEvent) => any; @@ -6807,58 +7582,58 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec ontouchstart: (ev: TouchEvent) => any; onwebkitfullscreenchange: (ev: Event) => any; onwebkitfullscreenerror: (ev: Event) => any; - scrollHeight: number; + readonly prefix: string | null; + readonly scrollHeight: number; scrollLeft: number; scrollTop: number; - scrollWidth: number; - tagName: string; - id: string; - className: string; - getAttribute(name?: string): string; + readonly scrollWidth: number; + readonly tagName: string; + innerHTML: string; + getAttribute(name?: string): string | null; getAttributeNS(namespaceURI: string, localName: string): string; getAttributeNode(name: string): Attr; getAttributeNodeNS(namespaceURI: string, localName: string): Attr; getBoundingClientRect(): ClientRect; getClientRects(): ClientRectList; getElementsByTagName(name: "a"): NodeListOf; - getElementsByTagName(name: "abbr"): NodeListOf; - getElementsByTagName(name: "acronym"): NodeListOf; - getElementsByTagName(name: "address"): NodeListOf; + getElementsByTagName(name: "abbr"): NodeListOf; + getElementsByTagName(name: "acronym"): NodeListOf; + getElementsByTagName(name: "address"): NodeListOf; getElementsByTagName(name: "applet"): NodeListOf; getElementsByTagName(name: "area"): NodeListOf; getElementsByTagName(name: "article"): NodeListOf; getElementsByTagName(name: "aside"): NodeListOf; getElementsByTagName(name: "audio"): NodeListOf; - getElementsByTagName(name: "b"): NodeListOf; + getElementsByTagName(name: "b"): NodeListOf; getElementsByTagName(name: "base"): NodeListOf; getElementsByTagName(name: "basefont"): NodeListOf; - getElementsByTagName(name: "bdo"): NodeListOf; - getElementsByTagName(name: "big"): NodeListOf; - getElementsByTagName(name: "blockquote"): NodeListOf; + getElementsByTagName(name: "bdo"): NodeListOf; + getElementsByTagName(name: "big"): NodeListOf; + getElementsByTagName(name: "blockquote"): NodeListOf; getElementsByTagName(name: "body"): NodeListOf; getElementsByTagName(name: "br"): NodeListOf; getElementsByTagName(name: "button"): NodeListOf; getElementsByTagName(name: "canvas"): NodeListOf; getElementsByTagName(name: "caption"): NodeListOf; - getElementsByTagName(name: "center"): NodeListOf; + getElementsByTagName(name: "center"): NodeListOf; getElementsByTagName(name: "circle"): NodeListOf; - getElementsByTagName(name: "cite"): NodeListOf; + getElementsByTagName(name: "cite"): NodeListOf; getElementsByTagName(name: "clippath"): NodeListOf; - getElementsByTagName(name: "code"): NodeListOf; + getElementsByTagName(name: "code"): NodeListOf; getElementsByTagName(name: "col"): NodeListOf; getElementsByTagName(name: "colgroup"): NodeListOf; getElementsByTagName(name: "datalist"): NodeListOf; - getElementsByTagName(name: "dd"): NodeListOf; + getElementsByTagName(name: "dd"): NodeListOf; getElementsByTagName(name: "defs"): NodeListOf; getElementsByTagName(name: "del"): NodeListOf; getElementsByTagName(name: "desc"): NodeListOf; - getElementsByTagName(name: "dfn"): NodeListOf; + getElementsByTagName(name: "dfn"): NodeListOf; getElementsByTagName(name: "dir"): NodeListOf; getElementsByTagName(name: "div"): NodeListOf; getElementsByTagName(name: "dl"): NodeListOf; - getElementsByTagName(name: "dt"): NodeListOf; + getElementsByTagName(name: "dt"): NodeListOf; getElementsByTagName(name: "ellipse"): NodeListOf; - getElementsByTagName(name: "em"): NodeListOf; + getElementsByTagName(name: "em"): NodeListOf; getElementsByTagName(name: "embed"): NodeListOf; getElementsByTagName(name: "feblend"): NodeListOf; getElementsByTagName(name: "fecolormatrix"): NodeListOf; @@ -6906,22 +7681,22 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec getElementsByTagName(name: "hgroup"): NodeListOf; getElementsByTagName(name: "hr"): NodeListOf; getElementsByTagName(name: "html"): NodeListOf; - getElementsByTagName(name: "i"): NodeListOf; + getElementsByTagName(name: "i"): NodeListOf; getElementsByTagName(name: "iframe"): NodeListOf; getElementsByTagName(name: "image"): NodeListOf; getElementsByTagName(name: "img"): NodeListOf; getElementsByTagName(name: "input"): NodeListOf; getElementsByTagName(name: "ins"): NodeListOf; - getElementsByTagName(name: "isindex"): NodeListOf; - getElementsByTagName(name: "kbd"): NodeListOf; - getElementsByTagName(name: "keygen"): NodeListOf; + getElementsByTagName(name: "isindex"): NodeListOf; + getElementsByTagName(name: "kbd"): NodeListOf; + getElementsByTagName(name: "keygen"): NodeListOf; getElementsByTagName(name: "label"): NodeListOf; getElementsByTagName(name: "legend"): NodeListOf; getElementsByTagName(name: "li"): NodeListOf; getElementsByTagName(name: "line"): NodeListOf; getElementsByTagName(name: "lineargradient"): NodeListOf; getElementsByTagName(name: "link"): NodeListOf; - getElementsByTagName(name: "listing"): NodeListOf; + getElementsByTagName(name: "listing"): NodeListOf; getElementsByTagName(name: "map"): NodeListOf; getElementsByTagName(name: "mark"): NodeListOf; getElementsByTagName(name: "marker"): NodeListOf; @@ -6930,9 +7705,10 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec getElementsByTagName(name: "menu"): NodeListOf; getElementsByTagName(name: "meta"): NodeListOf; getElementsByTagName(name: "metadata"): NodeListOf; + getElementsByTagName(name: "meter"): NodeListOf; getElementsByTagName(name: "nav"): NodeListOf; - getElementsByTagName(name: "nextid"): NodeListOf; - getElementsByTagName(name: "nobr"): NodeListOf; + getElementsByTagName(name: "nextid"): NodeListOf; + getElementsByTagName(name: "nobr"): NodeListOf; getElementsByTagName(name: "noframes"): NodeListOf; getElementsByTagName(name: "noscript"): NodeListOf; getElementsByTagName(name: "object"): NodeListOf; @@ -6943,7 +7719,8 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec getElementsByTagName(name: "param"): NodeListOf; getElementsByTagName(name: "path"): NodeListOf; getElementsByTagName(name: "pattern"): NodeListOf; - getElementsByTagName(name: "plaintext"): NodeListOf; + getElementsByTagName(name: "picture"): NodeListOf; + getElementsByTagName(name: "plaintext"): NodeListOf; getElementsByTagName(name: "polygon"): NodeListOf; getElementsByTagName(name: "polyline"): NodeListOf; getElementsByTagName(name: "pre"): NodeListOf; @@ -6951,28 +7728,29 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec getElementsByTagName(name: "q"): NodeListOf; getElementsByTagName(name: "radialgradient"): NodeListOf; getElementsByTagName(name: "rect"): NodeListOf; - getElementsByTagName(name: "rt"): NodeListOf; - getElementsByTagName(name: "ruby"): NodeListOf; - getElementsByTagName(name: "s"): NodeListOf; - getElementsByTagName(name: "samp"): NodeListOf; + getElementsByTagName(name: "rt"): NodeListOf; + getElementsByTagName(name: "ruby"): NodeListOf; + getElementsByTagName(name: "s"): NodeListOf; + getElementsByTagName(name: "samp"): NodeListOf; getElementsByTagName(name: "script"): NodeListOf; getElementsByTagName(name: "section"): NodeListOf; getElementsByTagName(name: "select"): NodeListOf; - getElementsByTagName(name: "small"): NodeListOf; + getElementsByTagName(name: "small"): NodeListOf; getElementsByTagName(name: "source"): NodeListOf; getElementsByTagName(name: "span"): NodeListOf; getElementsByTagName(name: "stop"): NodeListOf; - getElementsByTagName(name: "strike"): NodeListOf; - getElementsByTagName(name: "strong"): NodeListOf; + getElementsByTagName(name: "strike"): NodeListOf; + getElementsByTagName(name: "strong"): NodeListOf; getElementsByTagName(name: "style"): NodeListOf; - getElementsByTagName(name: "sub"): NodeListOf; - getElementsByTagName(name: "sup"): NodeListOf; + getElementsByTagName(name: "sub"): NodeListOf; + getElementsByTagName(name: "sup"): NodeListOf; getElementsByTagName(name: "svg"): NodeListOf; getElementsByTagName(name: "switch"): NodeListOf; getElementsByTagName(name: "symbol"): NodeListOf; getElementsByTagName(name: "table"): NodeListOf; getElementsByTagName(name: "tbody"): NodeListOf; getElementsByTagName(name: "td"): NodeListOf; + getElementsByTagName(name: "template"): NodeListOf; getElementsByTagName(name: "text"): NodeListOf; getElementsByTagName(name: "textpath"): NodeListOf; getElementsByTagName(name: "textarea"): NodeListOf; @@ -6983,18 +7761,20 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec getElementsByTagName(name: "tr"): NodeListOf; getElementsByTagName(name: "track"): NodeListOf; getElementsByTagName(name: "tspan"): NodeListOf; - getElementsByTagName(name: "tt"): NodeListOf; - getElementsByTagName(name: "u"): NodeListOf; + getElementsByTagName(name: "tt"): NodeListOf; + getElementsByTagName(name: "u"): NodeListOf; getElementsByTagName(name: "ul"): NodeListOf; getElementsByTagName(name: "use"): NodeListOf; - getElementsByTagName(name: "var"): NodeListOf; + getElementsByTagName(name: "var"): NodeListOf; getElementsByTagName(name: "video"): NodeListOf; getElementsByTagName(name: "view"): NodeListOf; getElementsByTagName(name: "wbr"): NodeListOf; getElementsByTagName(name: "x-ms-webview"): NodeListOf; - getElementsByTagName(name: "xmp"): NodeListOf; + getElementsByTagName(name: "xmp"): NodeListOf; getElementsByTagName(name: string): NodeListOf; - getElementsByTagNameNS(namespaceURI: string, localName: string): NodeListOf; + getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf; + getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf; + getElementsByTagNameNS(namespaceURI: string, localName: string): HTMLCollectionOf; hasAttribute(name: string): boolean; hasAttributeNS(namespaceURI: string, localName: string): boolean; msGetRegionContent(): MSRangeCollection; @@ -7009,7 +7789,7 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec removeAttributeNode(oldAttr: Attr): Attr; requestFullscreen(): void; requestPointerLock(): void; - setAttribute(name?: string, value?: string): void; + setAttribute(name: string, value: string): void; setAttributeNS(namespaceURI: string, qualifiedName: string, value: string): void; setAttributeNode(newAttr: Attr): Attr; setAttributeNodeNS(newAttr: Attr): Attr; @@ -7018,6 +7798,7 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec webkitRequestFullScreen(): void; webkitRequestFullscreen(): void; getElementsByClassName(classNames: string): NodeListOf; + matches(selector: string): boolean; addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; addEventListener(type: "MSGestureEnd", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; @@ -7063,11 +7844,11 @@ declare var Element: { } interface ErrorEvent extends Event { - colno: number; - error: any; - filename: string; - lineno: number; - message: string; + readonly colno: number; + readonly error: any; + readonly filename: string; + readonly lineno: number; + readonly message: string; initErrorEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, messageArg: string, filenameArg: string, linenoArg: number): void; } @@ -7077,39 +7858,39 @@ declare var ErrorEvent: { } interface Event { - bubbles: boolean; + readonly bubbles: boolean; cancelBubble: boolean; - cancelable: boolean; - currentTarget: EventTarget; - defaultPrevented: boolean; - eventPhase: number; - isTrusted: boolean; + readonly cancelable: boolean; + readonly currentTarget: EventTarget; + readonly defaultPrevented: boolean; + readonly eventPhase: number; + readonly isTrusted: boolean; returnValue: boolean; - srcElement: Element; - target: EventTarget; - timeStamp: number; - type: string; + readonly srcElement: Element | null; + readonly target: EventTarget; + readonly timeStamp: number; + readonly type: string; initEvent(eventTypeArg: string, canBubbleArg: boolean, cancelableArg: boolean): void; preventDefault(): void; stopImmediatePropagation(): void; stopPropagation(): void; - AT_TARGET: number; - BUBBLING_PHASE: number; - CAPTURING_PHASE: number; + readonly AT_TARGET: number; + readonly BUBBLING_PHASE: number; + readonly CAPTURING_PHASE: number; } declare var Event: { prototype: Event; new(type: string, eventInitDict?: EventInit): Event; - AT_TARGET: number; - BUBBLING_PHASE: number; - CAPTURING_PHASE: number; + readonly AT_TARGET: number; + readonly BUBBLING_PHASE: number; + readonly CAPTURING_PHASE: number; } interface EventTarget { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + addEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; dispatchEvent(evt: Event): boolean; - removeEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var EventTarget: { @@ -7126,8 +7907,9 @@ declare var External: { } interface File extends Blob { - lastModifiedDate: any; - name: string; + readonly lastModifiedDate: any; + readonly name: string; + readonly webkitRelativePath: string; } declare var File: { @@ -7136,7 +7918,7 @@ declare var File: { } interface FileList { - length: number; + readonly length: number; item(index: number): File; [index: number]: File; } @@ -7147,7 +7929,7 @@ declare var FileList: { } interface FileReader extends EventTarget, MSBaseReader { - error: DOMError; + readonly error: DOMError; readAsArrayBuffer(blob: Blob): void; readAsBinaryString(blob: Blob): void; readAsDataURL(blob: Blob): void; @@ -7161,7 +7943,7 @@ declare var FileReader: { } interface FocusEvent extends UIEvent { - relatedTarget: EventTarget; + readonly relatedTarget: EventTarget; initFocusEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, relatedTargetArg: EventTarget): void; } @@ -7180,7 +7962,7 @@ declare var FormData: { } interface GainNode extends AudioNode { - gain: AudioParam; + readonly gain: AudioParam; } declare var GainNode: { @@ -7189,13 +7971,13 @@ declare var GainNode: { } interface Gamepad { - axes: number[]; - buttons: GamepadButton[]; - connected: boolean; - id: string; - index: number; - mapping: string; - timestamp: number; + readonly axes: number[]; + readonly buttons: GamepadButton[]; + readonly connected: boolean; + readonly id: string; + readonly index: number; + readonly mapping: string; + readonly timestamp: number; } declare var Gamepad: { @@ -7204,8 +7986,8 @@ declare var Gamepad: { } interface GamepadButton { - pressed: boolean; - value: number; + readonly pressed: boolean; + readonly value: number; } declare var GamepadButton: { @@ -7214,7 +7996,7 @@ declare var GamepadButton: { } interface GamepadEvent extends Event { - gamepad: Gamepad; + readonly gamepad: Gamepad; } declare var GamepadEvent: { @@ -7252,6 +8034,7 @@ interface HTMLAnchorElement extends HTMLElement { * Sets or retrieves the coordinates of the object. */ coords: string; + download: string; /** * Contains the anchor portion of the URL including the hash sign (#). */ @@ -7272,12 +8055,12 @@ interface HTMLAnchorElement extends HTMLElement { * Sets or retrieves the language code of the object. */ hreflang: string; - mimeType: string; + readonly mimeType: string; /** * Sets or retrieves the shape of the object. */ name: string; - nameProp: string; + readonly nameProp: string; /** * Contains the pathname of the URL. */ @@ -7290,7 +8073,7 @@ interface HTMLAnchorElement extends HTMLElement { * Contains the protocol of the URL. */ protocol: string; - protocolLong: string; + readonly protocolLong: string; /** * Sets or retrieves the relationship between the object and the destination of the link. */ @@ -7332,7 +8115,7 @@ interface HTMLAppletElement extends HTMLElement { /** * Retrieves a string of the URL where the object tag can be found. This is often the href of the document that the object is in, or the value set by a base element. */ - BaseHref: string; + readonly BaseHref: string; align: string; /** * Sets or retrieves a text alternative to the graphic. @@ -7359,7 +8142,7 @@ interface HTMLAppletElement extends HTMLElement { /** * Address of a pointer to the document this page or frame contains. If there is no document, then null will be returned. */ - contentDocument: Document; + readonly contentDocument: Document; /** * Sets or retrieves the URL that references the data of the object. */ @@ -7368,7 +8151,7 @@ interface HTMLAppletElement extends HTMLElement { * Sets or retrieves a character string that can be used to implement your own declare functionality for the object. */ declare: boolean; - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * Sets or retrieves the height of the object. */ @@ -7378,7 +8161,7 @@ interface HTMLAppletElement extends HTMLElement { * Sets or retrieves the shape of the object. */ name: string; - object: string; + object: string | null; /** * Sets or retrieves a message to be displayed while an object is loading. */ @@ -7409,6 +8192,7 @@ interface HTMLAreaElement extends HTMLElement { * Sets or retrieves the coordinates of the object. */ coords: string; + download: string; /** * Sets or retrieves the subsection of the href property that follows the number sign (#). */ @@ -7534,23 +8318,6 @@ declare var HTMLBaseFontElement: { new(): HTMLBaseFontElement; } -interface HTMLBlockElement extends HTMLElement { - /** - * Sets or retrieves reference information about the object. - */ - cite: string; - clear: string; - /** - * Sets or retrieves the width of the object. - */ - width: number; -} - -declare var HTMLBlockElement: { - prototype: HTMLBlockElement; - new(): HTMLBlockElement; -} - interface HTMLBodyElement extends HTMLElement { aLink: any; background: string; @@ -7578,7 +8345,6 @@ interface HTMLBodyElement extends HTMLElement { onunload: (ev: Event) => any; text: any; vLink: any; - createTextRange(): TextRange; addEventListener(type: "MSContentZoom", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; @@ -7603,10 +8369,10 @@ interface HTMLBodyElement extends HTMLElement { addEventListener(type: "afterprint", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "ariarequest", listener: (ev: AriaRequestEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforeprint", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "beforeunload", listener: (ev: BeforeUnloadEvent) => any, useCapture?: boolean): void; addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; @@ -7617,9 +8383,9 @@ interface HTMLBodyElement extends HTMLElement { addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "command", listener: (ev: CommandEvent) => any, useCapture?: boolean): void; addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; @@ -7631,7 +8397,7 @@ interface HTMLBodyElement extends HTMLElement { addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; @@ -7639,6 +8405,7 @@ interface HTMLBodyElement extends HTMLElement { addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; addEventListener(type: "hashchange", listener: (ev: HashChangeEvent) => any, useCapture?: boolean): void; addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -7656,13 +8423,13 @@ interface HTMLBodyElement extends HTMLElement { addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; addEventListener(type: "offline", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "online", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "orientationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "pagehide", listener: (ev: PageTransitionEvent) => any, useCapture?: boolean): void; addEventListener(type: "pageshow", listener: (ev: PageTransitionEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -7716,7 +8483,7 @@ interface HTMLButtonElement extends HTMLElement { /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * Overrides the action attribute (where the data on a form is sent) on the parent form element. */ @@ -7749,11 +8516,11 @@ interface HTMLButtonElement extends HTMLElement { /** * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. */ - validationMessage: string; + readonly validationMessage: string; /** * Returns a ValidityState object that represents the validity states of an element. */ - validity: ValidityState; + readonly validity: ValidityState; /** * Sets or retrieves the default or selected value of the control. */ @@ -7761,15 +8528,11 @@ interface HTMLButtonElement extends HTMLElement { /** * Returns whether an element will successfully validate based on forms validation rules and constraints. */ - willValidate: boolean; + readonly willValidate: boolean; /** * Returns whether a form will validate when it is submitted, without having to submit it. */ checkValidity(): boolean; - /** - * Creates a TextRange object for the element. - */ - createTextRange(): TextRange; /** * Sets a custom error message that is displayed when a form is submitted. * @param error Sets a custom error message that is displayed when a form is submitted. @@ -7807,6 +8570,7 @@ interface HTMLCanvasElement extends HTMLElement { * @param type The standard MIME type for the image format to return. If you do not specify this parameter, the default value is a PNG format image. */ toDataURL(type?: string, ...args: any[]): string; + toBlob(): Blob; } declare var HTMLCanvasElement: { @@ -7818,11 +8582,11 @@ interface HTMLCollection { /** * Sets or retrieves the number of objects in a collection. */ - length: number; + readonly length: number; /** * Retrieves an object from various collections. */ - item(nameOrIndex?: any, optionalIndex?: any): Element; + item(index: number): Element; /** * Retrieves a select object or an object from an options collection. */ @@ -7835,18 +8599,6 @@ declare var HTMLCollection: { new(): HTMLCollection; } -interface HTMLDDElement extends HTMLElement { - /** - * Sets or retrieves whether the browser automatically performs wordwrap. - */ - noWrap: boolean; -} - -declare var HTMLDDElement: { - prototype: HTMLDDElement; - new(): HTMLDDElement; -} - interface HTMLDListElement extends HTMLElement { compact: boolean; } @@ -7856,20 +8608,8 @@ declare var HTMLDListElement: { new(): HTMLDListElement; } -interface HTMLDTElement extends HTMLElement { - /** - * Sets or retrieves whether the browser automatically performs wordwrap. - */ - noWrap: boolean; -} - -declare var HTMLDTElement: { - prototype: HTMLDTElement; - new(): HTMLDTElement; -} - interface HTMLDataListElement extends HTMLElement { - options: HTMLCollection; + options: HTMLCollectionOf; } declare var HTMLDataListElement: { @@ -7912,38 +8652,38 @@ declare var HTMLDocument: { interface HTMLElement extends Element { accessKey: string; - children: HTMLCollection; + readonly children: HTMLCollection; contentEditable: string; - dataset: DOMStringMap; + readonly dataset: DOMStringMap; dir: string; draggable: boolean; hidden: boolean; hideFocus: boolean; innerHTML: string; innerText: string; - isContentEditable: boolean; + readonly isContentEditable: boolean; lang: string; - offsetHeight: number; - offsetLeft: number; - offsetParent: Element; - offsetTop: number; - offsetWidth: number; + readonly offsetHeight: number; + readonly offsetLeft: number; + readonly offsetParent: Element; + readonly offsetTop: number; + readonly offsetWidth: number; onabort: (ev: Event) => any; onactivate: (ev: UIEvent) => any; onbeforeactivate: (ev: UIEvent) => any; - onbeforecopy: (ev: DragEvent) => any; - onbeforecut: (ev: DragEvent) => any; + onbeforecopy: (ev: ClipboardEvent) => any; + onbeforecut: (ev: ClipboardEvent) => any; onbeforedeactivate: (ev: UIEvent) => any; - onbeforepaste: (ev: DragEvent) => any; + onbeforepaste: (ev: ClipboardEvent) => any; onblur: (ev: FocusEvent) => any; oncanplay: (ev: Event) => any; oncanplaythrough: (ev: Event) => any; onchange: (ev: Event) => any; onclick: (ev: MouseEvent) => any; oncontextmenu: (ev: PointerEvent) => any; - oncopy: (ev: DragEvent) => any; + oncopy: (ev: ClipboardEvent) => any; oncuechange: (ev: Event) => any; - oncut: (ev: DragEvent) => any; + oncut: (ev: ClipboardEvent) => any; ondblclick: (ev: MouseEvent) => any; ondeactivate: (ev: UIEvent) => any; ondrag: (ev: DragEvent) => any; @@ -7955,10 +8695,11 @@ interface HTMLElement extends Element { ondrop: (ev: DragEvent) => any; ondurationchange: (ev: Event) => any; onemptied: (ev: Event) => any; - onended: (ev: Event) => any; + onended: (ev: MediaStreamErrorEvent) => any; onerror: (ev: Event) => any; onfocus: (ev: FocusEvent) => any; oninput: (ev: Event) => any; + oninvalid: (ev: Event) => any; onkeydown: (ev: KeyboardEvent) => any; onkeypress: (ev: KeyboardEvent) => any; onkeyup: (ev: KeyboardEvent) => any; @@ -7973,10 +8714,10 @@ interface HTMLElement extends Element { onmouseout: (ev: MouseEvent) => any; onmouseover: (ev: MouseEvent) => any; onmouseup: (ev: MouseEvent) => any; - onmousewheel: (ev: MouseWheelEvent) => any; + onmousewheel: (ev: WheelEvent) => any; onmscontentzoom: (ev: UIEvent) => any; onmsmanipulationstatechanged: (ev: MSManipulationEvent) => any; - onpaste: (ev: DragEvent) => any; + onpaste: (ev: ClipboardEvent) => any; onpause: (ev: Event) => any; onplay: (ev: Event) => any; onplaying: (ev: Event) => any; @@ -7997,12 +8738,11 @@ interface HTMLElement extends Element { outerHTML: string; outerText: string; spellcheck: boolean; - style: CSSStyleDeclaration; + readonly style: CSSStyleDeclaration; tabIndex: number; title: string; blur(): void; click(): void; - contains(child: HTMLElement): boolean; dragDrop(): boolean; focus(): void; insertAdjacentElement(position: string, insertedElement: Element): Element; @@ -8034,10 +8774,10 @@ interface HTMLElement extends Element { addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "ariarequest", listener: (ev: AriaRequestEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -8045,9 +8785,9 @@ interface HTMLElement extends Element { addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "command", listener: (ev: CommandEvent) => any, useCapture?: boolean): void; addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; @@ -8059,11 +8799,12 @@ interface HTMLElement extends Element { addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -8079,8 +8820,8 @@ interface HTMLElement extends Element { addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -8142,7 +8883,7 @@ interface HTMLEmbedElement extends HTMLElement, GetSVGDocument { /** * Gets the source associated with the media element for use by the PlayToManager. */ - msPlayToSource: any; + readonly msPlayToSource: any; /** * Sets or retrieves the name of the object. */ @@ -8150,12 +8891,12 @@ interface HTMLEmbedElement extends HTMLElement, GetSVGDocument { /** * Retrieves the palette used for the embedded document. */ - palette: string; + readonly palette: string; /** * Retrieves the URL of the plug-in used to view an embedded document. */ - pluginspage: string; - readyState: string; + readonly pluginspage: string; + readonly readyState: string; /** * Sets or retrieves a URL to be loaded by the object. */ @@ -8185,19 +8926,19 @@ interface HTMLFieldSetElement extends HTMLElement { /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. */ - validationMessage: string; + readonly validationMessage: string; /** * Returns a ValidityState object that represents the validity states of an element. */ - validity: ValidityState; + readonly validity: ValidityState; /** * Returns whether an element will successfully validate based on forms validation rules and constraints. */ - willValidate: boolean; + readonly willValidate: boolean; /** * Returns whether a form will validate when it is submitted, without having to submit it. */ @@ -8243,7 +8984,7 @@ interface HTMLFormElement extends HTMLElement { /** * Retrieves a collection, in source order, of all controls in a given form. */ - elements: HTMLCollection; + readonly elements: HTMLCollection; /** * Sets or retrieves the MIME encoding for the form. */ @@ -8255,7 +8996,7 @@ interface HTMLFormElement extends HTMLElement { /** * Sets or retrieves the number of objects in a collection. */ - length: number; + readonly length: number; /** * Sets or retrieves how to send the form data to the server. */ @@ -8314,11 +9055,11 @@ interface HTMLFrameElement extends HTMLElement, GetSVGDocument { /** * Retrieves the document object of the page or frame. */ - contentDocument: Document; + readonly contentDocument: Document; /** * Retrieves the object of the specified. */ - contentWindow: Window; + readonly contentWindow: Window; /** * Sets or retrieves whether to display a border for the frame. */ @@ -8359,10 +9100,6 @@ interface HTMLFrameElement extends HTMLElement, GetSVGDocument { * Sets or retrieves whether the frame can be scrolled. */ scrolling: string; - /** - * Sets the value indicating whether the source file of a frame or iframe has specific security restrictions applied. - */ - security: any; /** * Sets or retrieves a URL to be loaded by the object. */ @@ -8394,10 +9131,10 @@ interface HTMLFrameElement extends HTMLElement, GetSVGDocument { addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "ariarequest", listener: (ev: AriaRequestEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -8405,9 +9142,9 @@ interface HTMLFrameElement extends HTMLElement, GetSVGDocument { addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "command", listener: (ev: CommandEvent) => any, useCapture?: boolean): void; addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; @@ -8419,11 +9156,12 @@ interface HTMLFrameElement extends HTMLElement, GetSVGDocument { addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -8440,8 +9178,8 @@ interface HTMLFrameElement extends HTMLElement, GetSVGDocument { addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -8551,10 +9289,10 @@ interface HTMLFrameSetElement extends HTMLElement { addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "ariarequest", listener: (ev: AriaRequestEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforeprint", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "beforeunload", listener: (ev: BeforeUnloadEvent) => any, useCapture?: boolean): void; addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; @@ -8565,9 +9303,9 @@ interface HTMLFrameSetElement extends HTMLElement { addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "command", listener: (ev: CommandEvent) => any, useCapture?: boolean): void; addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; @@ -8579,7 +9317,7 @@ interface HTMLFrameSetElement extends HTMLElement { addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; @@ -8587,6 +9325,7 @@ interface HTMLFrameSetElement extends HTMLElement { addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; addEventListener(type: "hashchange", listener: (ev: HashChangeEvent) => any, useCapture?: boolean): void; addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -8604,13 +9343,13 @@ interface HTMLFrameSetElement extends HTMLElement { addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; addEventListener(type: "offline", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "online", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "orientationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "pagehide", listener: (ev: PageTransitionEvent) => any, useCapture?: boolean): void; addEventListener(type: "pageshow", listener: (ev: PageTransitionEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -8689,7 +9428,6 @@ interface HTMLHeadingElement extends HTMLElement { * Sets or retrieves a value that indicates the table alignment. */ align: string; - clear: string; } declare var HTMLHeadingElement: { @@ -8722,11 +9460,11 @@ interface HTMLIFrameElement extends HTMLElement, GetSVGDocument { /** * Retrieves the document object of the page or frame. */ - contentDocument: Document; + readonly contentDocument: Document; /** * Retrieves the object of the specified. */ - contentWindow: Window; + readonly contentWindow: Window; /** * Sets or retrieves whether to display a border for the frame. */ @@ -8767,15 +9505,11 @@ interface HTMLIFrameElement extends HTMLElement, GetSVGDocument { * Raised when the object has been completely received from the server. */ onload: (ev: Event) => any; - sandbox: DOMSettableTokenList; + readonly sandbox: DOMSettableTokenList; /** * Sets or retrieves whether the frame can be scrolled. */ scrolling: string; - /** - * Sets the value indicating whether the source file of a frame or iframe has specific security restrictions applied. - */ - security: any; /** * Sets or retrieves a URL to be loaded by the object. */ @@ -8811,10 +9545,10 @@ interface HTMLIFrameElement extends HTMLElement, GetSVGDocument { addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "ariarequest", listener: (ev: AriaRequestEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -8822,9 +9556,9 @@ interface HTMLIFrameElement extends HTMLElement, GetSVGDocument { addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "command", listener: (ev: CommandEvent) => any, useCapture?: boolean): void; addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; @@ -8836,11 +9570,12 @@ interface HTMLIFrameElement extends HTMLElement, GetSVGDocument { addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -8857,8 +9592,8 @@ interface HTMLIFrameElement extends HTMLElement, GetSVGDocument { addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -8915,9 +9650,9 @@ interface HTMLImageElement extends HTMLElement { /** * Retrieves whether the object is fully loaded. */ - complete: boolean; + readonly complete: boolean; crossOrigin: string; - currentSrc: string; + readonly currentSrc: string; /** * Sets or retrieves the height of the object. */ @@ -8934,6 +9669,7 @@ interface HTMLImageElement extends HTMLElement { * Sets or retrieves a Uniform Resource Identifier (URI) to a long description of the object. */ longDesc: string; + lowsrc: string; /** * Gets or sets whether the DLNA PlayTo device is available. */ @@ -8946,7 +9682,7 @@ interface HTMLImageElement extends HTMLElement { /** * Gets the source associated with the media element for use by the PlayToManager. */ - msPlayToSource: any; + readonly msPlayToSource: any; /** * Sets or retrieves the name of the object. */ @@ -8954,11 +9690,12 @@ interface HTMLImageElement extends HTMLElement { /** * The original height of the image resource before sizing. */ - naturalHeight: number; + readonly naturalHeight: number; /** * The original width of the image resource before sizing. */ - naturalWidth: number; + readonly naturalWidth: number; + sizes: string; /** * The address or URL of the a media resource that is to be considered. */ @@ -8976,8 +9713,8 @@ interface HTMLImageElement extends HTMLElement { * Sets or retrieves the width of the object. */ width: number; - x: number; - y: number; + readonly x: number; + readonly y: number; msGetAsCastingSource(): any; } @@ -9019,7 +9756,7 @@ interface HTMLInputElement extends HTMLElement { /** * Retrieves whether the object is fully loaded. */ - complete: boolean; + readonly complete: boolean; /** * Sets or retrieves the state of the check box or radio button. */ @@ -9032,11 +9769,11 @@ interface HTMLInputElement extends HTMLElement { /** * Returns a FileList object on a file type input object. */ - files: FileList; + readonly files: FileList; /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * Overrides the action attribute (where the data on a form is sent) on the parent form element. */ @@ -9069,7 +9806,7 @@ interface HTMLInputElement extends HTMLElement { /** * Specifies the ID of a pre-defined datalist of options for an input element. */ - list: HTMLElement; + readonly list: HTMLElement; /** * Defines the maximum acceptable value for an input element with type="number".When used with the min and step attributes, lets you control the range and increment (such as only even numbers) that the user can enter into an input field. */ @@ -9103,6 +9840,7 @@ interface HTMLInputElement extends HTMLElement { * When present, marks an element that can't be submitted without a value. */ required: boolean; + selectionDirection: string; /** * Gets or sets the end position or offset of a text selection. */ @@ -9132,11 +9870,11 @@ interface HTMLInputElement extends HTMLElement { /** * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. */ - validationMessage: string; + readonly validationMessage: string; /** * Returns a ValidityState object that represents the validity states of an element. */ - validity: ValidityState; + readonly validity: ValidityState; /** * Returns the value of the data at the cursor's current position. */ @@ -9150,6 +9888,7 @@ interface HTMLInputElement extends HTMLElement { * Sets or retrieves the vertical margin for the object. */ vspace: number; + webkitdirectory: boolean; /** * Sets or retrieves the width of the object. */ @@ -9157,15 +9896,12 @@ interface HTMLInputElement extends HTMLElement { /** * Returns whether an element will successfully validate based on forms validation rules and constraints. */ - willValidate: boolean; + readonly willValidate: boolean; + minLength: number; /** * Returns whether a form will validate when it is submitted, without having to submit it. */ checkValidity(): boolean; - /** - * Creates a TextRange object for the element. - */ - createTextRange(): TextRange; /** * Makes the selection equal to the current object. */ @@ -9180,7 +9916,7 @@ interface HTMLInputElement extends HTMLElement { * @param start The offset into the text field for the start of the selection. * @param end The offset into the text field for the end of the selection. */ - setSelectionRange(start: number, end: number): void; + setSelectionRange(start?: number, end?: number, direction?: string): void; /** * Decrements a range input control's value by the value given by the Step attribute. If the optional parameter is used, it will decrement the input control's step value multiplied by the parameter's value. * @param n Value to decrement the value by. @@ -9198,23 +9934,6 @@ declare var HTMLInputElement: { new(): HTMLInputElement; } -interface HTMLIsIndexElement extends HTMLElement { - /** - * Sets or retrieves the URL to which the form content is sent for processing. - */ - action: string; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - form: HTMLFormElement; - prompt: string; -} - -declare var HTMLIsIndexElement: { - prototype: HTMLIsIndexElement; - new(): HTMLIsIndexElement; -} - interface HTMLLIElement extends HTMLElement { type: string; /** @@ -9232,7 +9951,7 @@ interface HTMLLabelElement extends HTMLElement { /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * Sets or retrieves the object to which the given label object is assigned. */ @@ -9252,7 +9971,7 @@ interface HTMLLegendElement extends HTMLElement { /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; } declare var HTMLLegendElement: { @@ -9294,6 +10013,7 @@ interface HTMLLinkElement extends HTMLElement, LinkStyle { * Sets or retrieves the MIME type of the object. */ type: string; + import?: Document; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -9306,7 +10026,7 @@ interface HTMLMapElement extends HTMLElement { /** * Retrieves a collection of the area objects defined for the given map object. */ - areas: HTMLAreasCollection; + readonly areas: HTMLAreasCollection; /** * Sets or retrieves the name of the object. */ @@ -9358,10 +10078,10 @@ interface HTMLMarqueeElement extends HTMLElement { addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "ariarequest", listener: (ev: AriaRequestEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "bounce", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -9370,9 +10090,9 @@ interface HTMLMarqueeElement extends HTMLElement { addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "command", listener: (ev: CommandEvent) => any, useCapture?: boolean): void; addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; @@ -9384,12 +10104,13 @@ interface HTMLMarqueeElement extends HTMLElement { addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "finish", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -9405,8 +10126,8 @@ interface HTMLMarqueeElement extends HTMLElement { addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -9452,7 +10173,7 @@ interface HTMLMediaElement extends HTMLElement { /** * Returns an AudioTrackList object with the audio tracks for a given video element. */ - audioTracks: AudioTrackList; + readonly audioTracks: AudioTrackList; /** * Gets or sets a value that indicates whether to start playing the media automatically. */ @@ -9460,15 +10181,16 @@ interface HTMLMediaElement extends HTMLElement { /** * Gets a collection of buffered time ranges. */ - buffered: TimeRanges; + readonly buffered: TimeRanges; /** * Gets or sets a flag that indicates whether the client provides a set of controls for the media (in case the developer does not include controls for the player). */ controls: boolean; + crossOrigin: string; /** * Gets the address or URL of the current media resource that is selected by IHTMLMediaElement. */ - currentSrc: string; + readonly currentSrc: string; /** * Gets or sets the current playback position, in seconds. */ @@ -9481,19 +10203,20 @@ interface HTMLMediaElement extends HTMLElement { /** * Returns the duration in seconds of the current media resource. A NaN value is returned if duration is not available, or Infinity if the media resource is streaming. */ - duration: number; + readonly duration: number; /** * Gets information about whether the playback has ended or not. */ - ended: boolean; + readonly ended: boolean; /** * Returns an object representing the current error state of the audio or video element. */ - error: MediaError; + readonly error: MediaError; /** * Gets or sets a flag to specify whether playback should restart after it completes. */ loop: boolean; + readonly mediaKeys: MediaKeys | null; /** * Specifies the purpose of the audio or video media, such as background audio or alerts. */ @@ -9502,11 +10225,11 @@ interface HTMLMediaElement extends HTMLElement { * Specifies the output device id that the audio will be sent to. */ msAudioDeviceType: string; - msGraphicsTrustStatus: MSGraphicsTrust; + readonly msGraphicsTrustStatus: MSGraphicsTrust; /** * Gets the MSMediaKeys object, which is used for decrypting media data, that is associated with this media element. */ - msKeys: MSMediaKeys; + readonly msKeys: MSMediaKeys; /** * Gets or sets whether the DLNA PlayTo device is available. */ @@ -9522,7 +10245,7 @@ interface HTMLMediaElement extends HTMLElement { /** * Gets the source associated with the media element for use by the PlayToManager. */ - msPlayToSource: any; + readonly msPlayToSource: any; /** * Specifies whether or not to enable low-latency playback on the media element. */ @@ -9534,12 +10257,13 @@ interface HTMLMediaElement extends HTMLElement { /** * Gets the current network activity for the element. */ - networkState: number; + readonly networkState: number; + onencrypted: (ev: MediaEncryptedEvent) => any; onmsneedkey: (ev: MSMediaKeyNeededEvent) => any; /** * Gets a flag that specifies whether playback is paused. */ - paused: boolean; + readonly paused: boolean; /** * Gets or sets the current rate of speed for the media resource to play. This speed is expressed as a multiple of the normal speed of the media resource. */ @@ -9547,26 +10271,27 @@ interface HTMLMediaElement extends HTMLElement { /** * Gets TimeRanges for the current media resource that has been played. */ - played: TimeRanges; + readonly played: TimeRanges; /** * Gets or sets the current playback position, in seconds. */ preload: string; - readyState: any; + readyState: number; /** * Returns a TimeRanges object that represents the ranges of the current media resource that can be seeked. */ - seekable: TimeRanges; + readonly seekable: TimeRanges; /** * Gets a flag that indicates whether the the client is currently moving to a new playback position in the media resource. */ - seeking: boolean; + readonly seeking: boolean; /** * The address or URL of the a media resource that is to be considered. */ src: string; - textTracks: TextTrackList; - videoTracks: VideoTrackList; + srcObject: MediaStream | null; + readonly textTracks: TextTrackList; + readonly videoTracks: VideoTrackList; /** * Gets or sets the volume level for audio portions of the media element. */ @@ -9602,15 +10327,16 @@ interface HTMLMediaElement extends HTMLElement { * Loads and starts playback of a media resource. */ play(): void; - HAVE_CURRENT_DATA: number; - HAVE_ENOUGH_DATA: number; - HAVE_FUTURE_DATA: number; - HAVE_METADATA: number; - HAVE_NOTHING: number; - NETWORK_EMPTY: number; - NETWORK_IDLE: number; - NETWORK_LOADING: number; - NETWORK_NO_SOURCE: number; + setMediaKeys(mediaKeys: MediaKeys | null): PromiseLike; + readonly HAVE_CURRENT_DATA: number; + readonly HAVE_ENOUGH_DATA: number; + readonly HAVE_FUTURE_DATA: number; + readonly HAVE_METADATA: number; + readonly HAVE_NOTHING: number; + readonly NETWORK_EMPTY: number; + readonly NETWORK_IDLE: number; + readonly NETWORK_LOADING: number; + readonly NETWORK_NO_SOURCE: number; addEventListener(type: "MSContentZoom", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; @@ -9634,10 +10360,10 @@ interface HTMLMediaElement extends HTMLElement { addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "ariarequest", listener: (ev: AriaRequestEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -9645,9 +10371,9 @@ interface HTMLMediaElement extends HTMLElement { addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "command", listener: (ev: CommandEvent) => any, useCapture?: boolean): void; addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; @@ -9659,11 +10385,13 @@ interface HTMLMediaElement extends HTMLElement { addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "encrypted", listener: (ev: MediaEncryptedEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -9679,9 +10407,9 @@ interface HTMLMediaElement extends HTMLElement { addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; addEventListener(type: "msneedkey", listener: (ev: MSMediaKeyNeededEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -9720,15 +10448,15 @@ interface HTMLMediaElement extends HTMLElement { declare var HTMLMediaElement: { prototype: HTMLMediaElement; new(): HTMLMediaElement; - HAVE_CURRENT_DATA: number; - HAVE_ENOUGH_DATA: number; - HAVE_FUTURE_DATA: number; - HAVE_METADATA: number; - HAVE_NOTHING: number; - NETWORK_EMPTY: number; - NETWORK_IDLE: number; - NETWORK_LOADING: number; - NETWORK_NO_SOURCE: number; + readonly HAVE_CURRENT_DATA: number; + readonly HAVE_ENOUGH_DATA: number; + readonly HAVE_FUTURE_DATA: number; + readonly HAVE_METADATA: number; + readonly HAVE_NOTHING: number; + readonly NETWORK_EMPTY: number; + readonly NETWORK_IDLE: number; + readonly NETWORK_LOADING: number; + readonly NETWORK_NO_SOURCE: number; } interface HTMLMenuElement extends HTMLElement { @@ -9773,6 +10501,20 @@ declare var HTMLMetaElement: { new(): HTMLMetaElement; } +interface HTMLMeterElement extends HTMLElement { + high: number; + low: number; + max: number; + min: number; + optimum: number; + value: number; +} + +declare var HTMLMeterElement: { + prototype: HTMLMeterElement; + new(): HTMLMeterElement; +} + interface HTMLModElement extends HTMLElement { /** * Sets or retrieves reference information about the object. @@ -9789,15 +10531,6 @@ declare var HTMLModElement: { new(): HTMLModElement; } -interface HTMLNextIdElement extends HTMLElement { - n: string; -} - -declare var HTMLNextIdElement: { - prototype: HTMLNextIdElement; - new(): HTMLNextIdElement; -} - interface HTMLOListElement extends HTMLElement { compact: boolean; /** @@ -9816,7 +10549,7 @@ interface HTMLObjectElement extends HTMLElement, GetSVGDocument { /** * Retrieves a string of the URL where the object tag can be found. This is often the href of the document that the object is in, or the value set by a base element. */ - BaseHref: string; + readonly BaseHref: string; align: string; /** * Sets or retrieves a text alternative to the graphic. @@ -9846,7 +10579,7 @@ interface HTMLObjectElement extends HTMLElement, GetSVGDocument { /** * Retrieves the document object of the page or frame. */ - contentDocument: Document; + readonly contentDocument: Document; /** * Sets or retrieves the URL that references the data of the object. */ @@ -9855,7 +10588,7 @@ interface HTMLObjectElement extends HTMLElement, GetSVGDocument { /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * Sets or retrieves the height of the object. */ @@ -9876,7 +10609,7 @@ interface HTMLObjectElement extends HTMLElement, GetSVGDocument { /** * Gets the source associated with the media element for use by the PlayToManager. */ - msPlayToSource: any; + readonly msPlayToSource: any; /** * Sets or retrieves the name of the object. */ @@ -9884,8 +10617,8 @@ interface HTMLObjectElement extends HTMLElement, GetSVGDocument { /** * Retrieves the contained object. */ - object: any; - readyState: number; + readonly object: any; + readonly readyState: number; /** * Sets or retrieves a message to be displayed while an object is loading. */ @@ -9901,11 +10634,11 @@ interface HTMLObjectElement extends HTMLElement, GetSVGDocument { /** * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. */ - validationMessage: string; + readonly validationMessage: string; /** * Returns a ValidityState object that represents the validity states of an element. */ - validity: ValidityState; + readonly validity: ValidityState; vspace: number; /** * Sets or retrieves the width of the object. @@ -9914,7 +10647,7 @@ interface HTMLObjectElement extends HTMLElement, GetSVGDocument { /** * Returns whether an element will successfully validate based on forms validation rules and constraints. */ - willValidate: boolean; + readonly willValidate: boolean; /** * Returns whether a form will validate when it is submitted, without having to submit it. */ @@ -9941,11 +10674,11 @@ interface HTMLOptGroupElement extends HTMLElement { /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * Sets or retrieves the ordinal position of an option in a list box. */ - index: number; + readonly index: number; /** * Sets or retrieves a value that you can use to implement your own label functionality for the object. */ @@ -9957,7 +10690,7 @@ interface HTMLOptGroupElement extends HTMLElement { /** * Sets or retrieves the text string specified by the option tag. */ - text: string; + readonly text: string; /** * Sets or retrieves the value which is returned to the server when the form control is submitted. */ @@ -9978,11 +10711,11 @@ interface HTMLOptionElement extends HTMLElement { /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * Sets or retrieves the ordinal position of an option in a list box. */ - index: number; + readonly index: number; /** * Sets or retrieves a value that you can use to implement your own label functionality for the object. */ @@ -10007,6 +10740,18 @@ declare var HTMLOptionElement: { create(): HTMLOptionElement; } +interface HTMLOptionsCollection extends HTMLCollection { + length: number; + selectedIndex: number; + add(element: HTMLOptionElement | HTMLOptGroupElement, before?: HTMLElement | number): void; + remove(index: number): void; +} + +declare var HTMLOptionsCollection: { + prototype: HTMLOptionsCollection; + new(): HTMLOptionsCollection; +} + interface HTMLParagraphElement extends HTMLElement { /** * Sets or retrieves how the object is aligned with adjacent text. @@ -10044,28 +10789,15 @@ declare var HTMLParamElement: { new(): HTMLParamElement; } -interface HTMLPhraseElement extends HTMLElement { - /** - * Sets or retrieves reference information about the object. - */ - cite: string; - /** - * Sets or retrieves the date and time of a modification to the object. - */ - dateTime: string; +interface HTMLPictureElement extends HTMLElement { } -declare var HTMLPhraseElement: { - prototype: HTMLPhraseElement; - new(): HTMLPhraseElement; +declare var HTMLPictureElement: { + prototype: HTMLPictureElement; + new(): HTMLPictureElement; } interface HTMLPreElement extends HTMLElement { - /** - * Indicates a citation by rendering text in italic type. - */ - cite: string; - clear: string; /** * Sets or gets a value that you can use to implement your own width functionality for the object. */ @@ -10081,7 +10813,7 @@ interface HTMLProgressElement extends HTMLElement { /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * Defines the maximum, or "done" value for a progress element. */ @@ -10089,7 +10821,7 @@ interface HTMLProgressElement extends HTMLElement { /** * Returns the quotient of value/max when the value attribute is set (determinate progress bar), or -1 when the value attribute is missing (indeterminate progress bar). */ - position: number; + readonly position: number; /** * Sets or gets the current value of a progress element. The value must be a non-negative number between 0 and the max value. */ @@ -10106,10 +10838,6 @@ interface HTMLQuoteElement extends HTMLElement { * Sets or retrieves reference information about the object. */ cite: string; - /** - * Sets or retrieves the date and time of a modification to the object. - */ - dateTime: string; } declare var HTMLQuoteElement: { @@ -10163,7 +10891,7 @@ interface HTMLSelectElement extends HTMLElement { /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * Sets or retrieves the number of objects in a collection. */ @@ -10176,7 +10904,7 @@ interface HTMLSelectElement extends HTMLElement { * Sets or retrieves the name of the object. */ name: string; - options: HTMLSelectElement; + options: HTMLCollectionOf; /** * When present, marks an element that can't be submitted without a value. */ @@ -10185,6 +10913,7 @@ interface HTMLSelectElement extends HTMLElement { * Sets or retrieves the index of the selected option in a select object. */ selectedIndex: number; + selectedOptions: HTMLCollectionOf; /** * Sets or retrieves the number of rows in the list box. */ @@ -10192,15 +10921,15 @@ interface HTMLSelectElement extends HTMLElement { /** * Retrieves the type of select control based on the value of the MULTIPLE attribute. */ - type: string; + readonly type: string; /** * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. */ - validationMessage: string; + readonly validationMessage: string; /** * Returns a ValidityState object that represents the validity states of an element. */ - validity: ValidityState; + readonly validity: ValidityState; /** * Sets or retrieves the value which is returned to the server when the form control is submitted. */ @@ -10208,7 +10937,7 @@ interface HTMLSelectElement extends HTMLElement { /** * Returns whether an element will successfully validate based on forms validation rules and constraints. */ - willValidate: boolean; + readonly willValidate: boolean; /** * Adds an element to the areas, controlRange, or options collection. * @param element Variant of type Number that specifies the index position in the collection where the element is placed. If no value is given, the method places the element at the end of the collection. @@ -10254,10 +10983,12 @@ interface HTMLSourceElement extends HTMLElement { */ media: string; msKeySystem: string; + sizes: string; /** * The address or URL of the a media resource that is to be considered. */ src: string; + srcset: string; /** * Gets or sets the MIME type of a media resource. */ @@ -10278,6 +11009,7 @@ declare var HTMLSpanElement: { } interface HTMLStyleElement extends HTMLElement, LinkStyle { + disabled: boolean; /** * Sets or retrieves the media type. */ @@ -10327,7 +11059,7 @@ interface HTMLTableCellElement extends HTMLElement, HTMLTableAlignment { /** * Retrieves the position of the object in the cells collection of a row. */ - cellIndex: number; + readonly cellIndex: number; /** * Sets or retrieves the number columns in the table that the object should span. */ @@ -10434,7 +11166,7 @@ interface HTMLTableElement extends HTMLElement { /** * Sets or retrieves the number of horizontal rows contained in the object. */ - rows: HTMLCollection; + rows: HTMLCollectionOf; /** * Sets or retrieves which dividing lines (inner borders) are displayed. */ @@ -10446,7 +11178,7 @@ interface HTMLTableElement extends HTMLElement { /** * Retrieves a collection of all tBody objects in the table. Objects in this collection are in source order. */ - tBodies: HTMLCollection; + tBodies: HTMLCollectionOf; /** * Retrieves the tFoot object of the table. */ @@ -10462,19 +11194,19 @@ interface HTMLTableElement extends HTMLElement { /** * Creates an empty caption element in the table. */ - createCaption(): HTMLElement; + createCaption(): HTMLTableCaptionElement; /** * Creates an empty tBody element in the table. */ - createTBody(): HTMLElement; + createTBody(): HTMLTableSectionElement; /** * Creates an empty tFoot element in the table. */ - createTFoot(): HTMLElement; + createTFoot(): HTMLTableSectionElement; /** * Returns the tHead element object if successful, or null otherwise. */ - createTHead(): HTMLElement; + createTHead(): HTMLTableSectionElement; /** * Deletes the caption element and its contents from the table. */ @@ -10496,7 +11228,7 @@ interface HTMLTableElement extends HTMLElement { * Creates a new row (tr) in the table, and adds the row to the rows collection. * @param index Number that specifies where to insert the row in the rows collection. The default value is -1, which appends the new row to the end of the rows collection. */ - insertRow(index?: number): HTMLElement; + insertRow(index?: number): HTMLTableRowElement; } declare var HTMLTableElement: { @@ -10525,7 +11257,7 @@ interface HTMLTableRowElement extends HTMLElement, HTMLTableAlignment { /** * Retrieves a collection of all cells in the table row. */ - cells: HTMLCollection; + cells: HTMLCollectionOf; /** * Sets or retrieves the height of the object. */ @@ -10533,11 +11265,11 @@ interface HTMLTableRowElement extends HTMLElement, HTMLTableAlignment { /** * Retrieves the position of the object in the rows collection for the table. */ - rowIndex: number; + readonly rowIndex: number; /** * Retrieves the position of the object in the collection. */ - sectionRowIndex: number; + readonly sectionRowIndex: number; /** * Removes the specified cell from the table row, as well as from the cells collection. * @param index Number that specifies the zero-based position of the cell to remove from the table row. If no value is provided, the last cell in the cells collection is deleted. @@ -10547,7 +11279,7 @@ interface HTMLTableRowElement extends HTMLElement, HTMLTableAlignment { * Creates a new cell in the table row, and adds the cell to the cells collection. * @param index Number that specifies where to insert the cell in the tr. The default value is -1, which appends the new cell to the end of the cells collection. */ - insertCell(index?: number): HTMLElement; + insertCell(index?: number): HTMLTableDataCellElement; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -10564,7 +11296,7 @@ interface HTMLTableSectionElement extends HTMLElement, HTMLTableAlignment { /** * Sets or retrieves the number of horizontal rows contained in the object. */ - rows: HTMLCollection; + rows: HTMLCollectionOf; /** * Removes the specified row (tr) from the element and from the rows collection. * @param index Number that specifies the zero-based position in the rows collection of the row to remove. @@ -10574,7 +11306,7 @@ interface HTMLTableSectionElement extends HTMLElement, HTMLTableAlignment { * Creates a new row (tr) in the table, and adds the row to the rows collection. * @param index Number that specifies where to insert the row in the rows collection. The default value is -1, which appends the new row to the end of the rows collection. */ - insertRow(index?: number): HTMLElement; + insertRow(index?: number): HTMLTableRowElement; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -10583,6 +11315,15 @@ declare var HTMLTableSectionElement: { new(): HTMLTableSectionElement; } +interface HTMLTemplateElement extends HTMLElement { + readonly content: DocumentFragment; +} + +declare var HTMLTemplateElement: { + prototype: HTMLTemplateElement; + new(): HTMLTemplateElement; +} + interface HTMLTextAreaElement extends HTMLElement { /** * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing. @@ -10600,7 +11341,7 @@ interface HTMLTextAreaElement extends HTMLElement { /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * Sets or retrieves the maximum number of characters that the user can enter in a text control. */ @@ -10640,15 +11381,15 @@ interface HTMLTextAreaElement extends HTMLElement { /** * Retrieves the type of control. */ - type: string; + readonly type: string; /** * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. */ - validationMessage: string; + readonly validationMessage: string; /** * Returns a ValidityState object that represents the validity states of an element. */ - validity: ValidityState; + readonly validity: ValidityState; /** * Retrieves or sets the text in the entry field of the textArea element. */ @@ -10656,19 +11397,16 @@ interface HTMLTextAreaElement extends HTMLElement { /** * Returns whether an element will successfully validate based on forms validation rules and constraints. */ - willValidate: boolean; + readonly willValidate: boolean; /** * Sets or retrieves how to handle wordwrapping in the object. */ wrap: string; + minLength: number; /** * Returns whether a form will validate when it is submitted, without having to submit it. */ checkValidity(): boolean; - /** - * Creates a TextRange object for the element. - */ - createTextRange(): TextRange; /** * Highlights the input area of a form element. */ @@ -10707,23 +11445,23 @@ interface HTMLTrackElement extends HTMLElement { default: boolean; kind: string; label: string; - readyState: number; + readonly readyState: number; src: string; srclang: string; - track: TextTrack; - ERROR: number; - LOADED: number; - LOADING: number; - NONE: number; + readonly track: TextTrack; + readonly ERROR: number; + readonly LOADED: number; + readonly LOADING: number; + readonly NONE: number; } declare var HTMLTrackElement: { prototype: HTMLTrackElement; new(): HTMLTrackElement; - ERROR: number; - LOADED: number; - LOADING: number; - NONE: number; + readonly ERROR: number; + readonly LOADED: number; + readonly LOADING: number; + readonly NONE: number; } interface HTMLUListElement extends HTMLElement { @@ -10750,8 +11488,8 @@ interface HTMLVideoElement extends HTMLMediaElement { */ height: number; msHorizontalMirror: boolean; - msIsLayoutOptimalForPlayback: boolean; - msIsStereo3D: boolean; + readonly msIsLayoutOptimalForPlayback: boolean; + readonly msIsStereo3D: boolean; msStereo3DPackingMode: string; msStereo3DRenderMode: string; msZoom: boolean; @@ -10765,13 +11503,13 @@ interface HTMLVideoElement extends HTMLMediaElement { /** * Gets the intrinsic height of a video in CSS pixels, or zero if the dimensions are not known. */ - videoHeight: number; + readonly videoHeight: number; /** * Gets the intrinsic width of a video in CSS pixels, or zero if the dimensions are not known. */ - videoWidth: number; - webkitDisplayingFullscreen: boolean; - webkitSupportsFullscreen: boolean; + readonly videoWidth: number; + readonly webkitDisplayingFullscreen: boolean; + readonly webkitSupportsFullscreen: boolean; /** * Gets or sets the width of the video element. */ @@ -10810,10 +11548,10 @@ interface HTMLVideoElement extends HTMLMediaElement { addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "ariarequest", listener: (ev: AriaRequestEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -10821,9 +11559,9 @@ interface HTMLVideoElement extends HTMLMediaElement { addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "command", listener: (ev: CommandEvent) => any, useCapture?: boolean): void; addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; @@ -10835,11 +11573,13 @@ interface HTMLVideoElement extends HTMLMediaElement { addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "encrypted", listener: (ev: MediaEncryptedEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -10855,9 +11595,9 @@ interface HTMLVideoElement extends HTMLMediaElement { addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; addEventListener(type: "msneedkey", listener: (ev: MSMediaKeyNeededEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -10899,8 +11639,8 @@ declare var HTMLVideoElement: { } interface HashChangeEvent extends Event { - newURL: string; - oldURL: string; + readonly newURL: string | null; + readonly oldURL: string | null; } declare var HashChangeEvent: { @@ -10909,8 +11649,8 @@ declare var HashChangeEvent: { } interface History { - length: number; - state: any; + readonly length: number; + readonly state: any; back(distance?: any): void; forward(distance?: any): void; go(delta?: any): void; @@ -10924,31 +11664,31 @@ declare var History: { } interface IDBCursor { - direction: string; - key: any; - primaryKey: any; - source: any; + readonly direction: string; + key: IDBKeyRange | IDBValidKey; + readonly primaryKey: any; + source: IDBObjectStore | IDBIndex; advance(count: number): void; - continue(key?: any): void; + continue(key?: IDBKeyRange | IDBValidKey): void; delete(): IDBRequest; update(value: any): IDBRequest; - NEXT: string; - NEXT_NO_DUPLICATE: string; - PREV: string; - PREV_NO_DUPLICATE: string; + readonly NEXT: string; + readonly NEXT_NO_DUPLICATE: string; + readonly PREV: string; + readonly PREV_NO_DUPLICATE: string; } declare var IDBCursor: { prototype: IDBCursor; new(): IDBCursor; - NEXT: string; - NEXT_NO_DUPLICATE: string; - PREV: string; - PREV_NO_DUPLICATE: string; + readonly NEXT: string; + readonly NEXT_NO_DUPLICATE: string; + readonly PREV: string; + readonly PREV_NO_DUPLICATE: string; } interface IDBCursorWithValue extends IDBCursor { - value: any; + readonly value: any; } declare var IDBCursorWithValue: { @@ -10957,15 +11697,17 @@ declare var IDBCursorWithValue: { } interface IDBDatabase extends EventTarget { - name: string; - objectStoreNames: DOMStringList; + readonly name: string; + readonly objectStoreNames: DOMStringList; onabort: (ev: Event) => any; onerror: (ev: Event) => any; - version: string; + version: number; + onversionchange: (ev: IDBVersionChangeEvent) => any; close(): void; - createObjectStore(name: string, optionalParameters?: any): IDBObjectStore; + createObjectStore(name: string, optionalParameters?: IDBObjectStoreParameters): IDBObjectStore; deleteObjectStore(name: string): void; - transaction(storeNames: any, mode?: string): IDBTransaction; + transaction(storeNames: string | string[], mode?: string): IDBTransaction; + addEventListener(type: "versionchange", listener: (ev: IDBVersionChangeEvent) => any, useCapture?: boolean): void; addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; @@ -10988,15 +11730,16 @@ declare var IDBFactory: { } interface IDBIndex { - keyPath: string; - name: string; - objectStore: IDBObjectStore; - unique: boolean; - count(key?: any): IDBRequest; - get(key: any): IDBRequest; - getKey(key: any): IDBRequest; - openCursor(range?: IDBKeyRange, direction?: string): IDBRequest; - openKeyCursor(range?: IDBKeyRange, direction?: string): IDBRequest; + keyPath: string | string[]; + readonly name: string; + readonly objectStore: IDBObjectStore; + readonly unique: boolean; + multiEntry: boolean; + count(key?: IDBKeyRange | IDBValidKey): IDBRequest; + get(key: IDBKeyRange | IDBValidKey): IDBRequest; + getKey(key: IDBKeyRange | IDBValidKey): IDBRequest; + openCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; + openKeyCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; } declare var IDBIndex: { @@ -11005,36 +11748,37 @@ declare var IDBIndex: { } interface IDBKeyRange { - lower: any; - lowerOpen: boolean; - upper: any; - upperOpen: boolean; + readonly lower: any; + readonly lowerOpen: boolean; + readonly upper: any; + readonly upperOpen: boolean; } declare var IDBKeyRange: { prototype: IDBKeyRange; new(): IDBKeyRange; bound(lower: any, upper: any, lowerOpen?: boolean, upperOpen?: boolean): IDBKeyRange; - lowerBound(bound: any, open?: boolean): IDBKeyRange; + lowerBound(lower: any, open?: boolean): IDBKeyRange; only(value: any): IDBKeyRange; - upperBound(bound: any, open?: boolean): IDBKeyRange; + upperBound(upper: any, open?: boolean): IDBKeyRange; } interface IDBObjectStore { - indexNames: DOMStringList; - keyPath: string; - name: string; - transaction: IDBTransaction; - add(value: any, key?: any): IDBRequest; + readonly indexNames: DOMStringList; + keyPath: string | string[]; + readonly name: string; + readonly transaction: IDBTransaction; + autoIncrement: boolean; + add(value: any, key?: IDBKeyRange | IDBValidKey): IDBRequest; clear(): IDBRequest; - count(key?: any): IDBRequest; - createIndex(name: string, keyPath: string, optionalParameters?: any): IDBIndex; - delete(key: any): IDBRequest; + count(key?: IDBKeyRange | IDBValidKey): IDBRequest; + createIndex(name: string, keyPath: string | string[], optionalParameters?: IDBIndexParameters): IDBIndex; + delete(key: IDBKeyRange | IDBValidKey): IDBRequest; deleteIndex(indexName: string): void; get(key: any): IDBRequest; index(name: string): IDBIndex; - openCursor(range?: any, direction?: string): IDBRequest; - put(value: any, key?: any): IDBRequest; + openCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; + put(value: any, key?: IDBKeyRange | IDBValidKey): IDBRequest; } declare var IDBObjectStore: { @@ -11058,13 +11802,13 @@ declare var IDBOpenDBRequest: { } interface IDBRequest extends EventTarget { - error: DOMError; + readonly error: DOMError; onerror: (ev: Event) => any; onsuccess: (ev: Event) => any; - readyState: string; - result: any; - source: any; - transaction: IDBTransaction; + readonly readyState: string; + readonly result: any; + source: IDBObjectStore | IDBIndex | IDBCursor; + readonly transaction: IDBTransaction; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "success", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; @@ -11076,17 +11820,17 @@ declare var IDBRequest: { } interface IDBTransaction extends EventTarget { - db: IDBDatabase; - error: DOMError; - mode: string; + readonly db: IDBDatabase; + readonly error: DOMError; + readonly mode: string; onabort: (ev: Event) => any; oncomplete: (ev: Event) => any; onerror: (ev: Event) => any; abort(): void; objectStore(name: string): IDBObjectStore; - READ_ONLY: string; - READ_WRITE: string; - VERSION_CHANGE: string; + readonly READ_ONLY: string; + readonly READ_WRITE: string; + readonly VERSION_CHANGE: string; addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "complete", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; @@ -11096,14 +11840,14 @@ interface IDBTransaction extends EventTarget { declare var IDBTransaction: { prototype: IDBTransaction; new(): IDBTransaction; - READ_ONLY: string; - READ_WRITE: string; - VERSION_CHANGE: string; + readonly READ_ONLY: string; + readonly READ_WRITE: string; + readonly VERSION_CHANGE: string; } interface IDBVersionChangeEvent extends Event { - newVersion: number; - oldVersion: number; + readonly newVersion: number | null; + readonly oldVersion: number; } declare var IDBVersionChangeEvent: { @@ -11112,9 +11856,9 @@ declare var IDBVersionChangeEvent: { } interface ImageData { - data: number[]; - height: number; - width: number; + data: Uint8ClampedArray; + readonly height: number; + readonly width: number; } declare var ImageData: { @@ -11124,37 +11868,47 @@ declare var ImageData: { } interface KeyboardEvent extends UIEvent { - altKey: boolean; - char: string; - charCode: number; - ctrlKey: boolean; - key: string; - keyCode: number; - locale: string; - location: number; - metaKey: boolean; - repeat: boolean; - shiftKey: boolean; - which: number; + readonly altKey: boolean; + readonly char: string | null; + readonly charCode: number; + readonly ctrlKey: boolean; + readonly key: string; + readonly keyCode: number; + readonly locale: string; + readonly location: number; + readonly metaKey: boolean; + readonly repeat: boolean; + readonly shiftKey: boolean; + readonly which: number; getModifierState(keyArg: string): boolean; initKeyboardEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, keyArg: string, locationArg: number, modifiersListArg: string, repeat: boolean, locale: string): void; - DOM_KEY_LOCATION_JOYSTICK: number; - DOM_KEY_LOCATION_LEFT: number; - DOM_KEY_LOCATION_MOBILE: number; - DOM_KEY_LOCATION_NUMPAD: number; - DOM_KEY_LOCATION_RIGHT: number; - DOM_KEY_LOCATION_STANDARD: number; + readonly DOM_KEY_LOCATION_JOYSTICK: number; + readonly DOM_KEY_LOCATION_LEFT: number; + readonly DOM_KEY_LOCATION_MOBILE: number; + readonly DOM_KEY_LOCATION_NUMPAD: number; + readonly DOM_KEY_LOCATION_RIGHT: number; + readonly DOM_KEY_LOCATION_STANDARD: number; } declare var KeyboardEvent: { prototype: KeyboardEvent; new(typeArg: string, eventInitDict?: KeyboardEventInit): KeyboardEvent; - DOM_KEY_LOCATION_JOYSTICK: number; - DOM_KEY_LOCATION_LEFT: number; - DOM_KEY_LOCATION_MOBILE: number; - DOM_KEY_LOCATION_NUMPAD: number; - DOM_KEY_LOCATION_RIGHT: number; - DOM_KEY_LOCATION_STANDARD: number; + readonly DOM_KEY_LOCATION_JOYSTICK: number; + readonly DOM_KEY_LOCATION_LEFT: number; + readonly DOM_KEY_LOCATION_MOBILE: number; + readonly DOM_KEY_LOCATION_NUMPAD: number; + readonly DOM_KEY_LOCATION_RIGHT: number; + readonly DOM_KEY_LOCATION_STANDARD: number; +} + +interface ListeningStateChangedEvent extends Event { + readonly label: string; + readonly state: string; +} + +declare var ListeningStateChangedEvent: { + prototype: ListeningStateChangedEvent; + new(): ListeningStateChangedEvent; } interface Location { @@ -11162,7 +11916,7 @@ interface Location { host: string; hostname: string; href: string; - origin: string; + readonly origin: string; pathname: string; port: string; protocol: string; @@ -11179,7 +11933,7 @@ declare var Location: { } interface LongRunningScriptDetectedEvent extends Event { - executionTime: number; + readonly executionTime: number; stopPageScriptExecution: boolean; } @@ -11198,29 +11952,29 @@ interface MSApp { execAsyncAtPriority(asynchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): void; execAtPriority(synchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): any; getCurrentPriority(): string; - getHtmlPrintDocumentSourceAsync(htmlDoc: any): any; + getHtmlPrintDocumentSourceAsync(htmlDoc: any): PromiseLike; getViewId(view: any): any; isTaskScheduledAtPriorityOrHigher(priority: string): boolean; pageHandlesAllApplicationActivations(enabled: boolean): void; suppressSubdownloadCredentialPrompts(suppress: boolean): void; terminateApp(exceptionObject: any): void; - CURRENT: string; - HIGH: string; - IDLE: string; - NORMAL: string; + readonly CURRENT: string; + readonly HIGH: string; + readonly IDLE: string; + readonly NORMAL: string; } declare var MSApp: MSApp; interface MSAppAsyncOperation extends EventTarget { - error: DOMError; + readonly error: DOMError; oncomplete: (ev: Event) => any; onerror: (ev: Event) => any; - readyState: number; - result: any; + readonly readyState: number; + readonly result: any; start(): void; - COMPLETED: number; - ERROR: number; - STARTED: number; + readonly COMPLETED: number; + readonly ERROR: number; + readonly STARTED: number; addEventListener(type: "complete", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; @@ -11229,9 +11983,19 @@ interface MSAppAsyncOperation extends EventTarget { declare var MSAppAsyncOperation: { prototype: MSAppAsyncOperation; new(): MSAppAsyncOperation; - COMPLETED: number; - ERROR: number; - STARTED: number; + readonly COMPLETED: number; + readonly ERROR: number; + readonly STARTED: number; +} + +interface MSAssertion { + readonly id: string; + readonly type: string; +} + +declare var MSAssertion: { + prototype: MSAssertion; + new(): MSAssertion; } interface MSBlobBuilder { @@ -11244,44 +12008,46 @@ declare var MSBlobBuilder: { new(): MSBlobBuilder; } -interface MSCSSMatrix { - a: number; - b: number; - c: number; - d: number; - e: number; - f: number; - m11: number; - m12: number; - m13: number; - m14: number; - m21: number; - m22: number; - m23: number; - m24: number; - m31: number; - m32: number; - m33: number; - m34: number; - m41: number; - m42: number; - m43: number; - m44: number; - inverse(): MSCSSMatrix; - multiply(secondMatrix: MSCSSMatrix): MSCSSMatrix; - rotate(angleX: number, angleY?: number, angleZ?: number): MSCSSMatrix; - rotateAxisAngle(x: number, y: number, z: number, angle: number): MSCSSMatrix; - scale(scaleX: number, scaleY?: number, scaleZ?: number): MSCSSMatrix; - setMatrixValue(value: string): void; - skewX(angle: number): MSCSSMatrix; - skewY(angle: number): MSCSSMatrix; - toString(): string; - translate(x: number, y: number, z?: number): MSCSSMatrix; +interface MSCredentials { + getAssertion(challenge: string, filter?: MSCredentialFilter, params?: MSSignatureParameters): PromiseLike; + makeCredential(accountInfo: MSAccountInfo, params: MSCredentialParameters[], challenge?: string): PromiseLike; } -declare var MSCSSMatrix: { - prototype: MSCSSMatrix; - new(text?: string): MSCSSMatrix; +declare var MSCredentials: { + prototype: MSCredentials; + new(): MSCredentials; +} + +interface MSFIDOCredentialAssertion extends MSAssertion { + readonly algorithm: string | Algorithm; + readonly attestation: any; + readonly publicKey: string; + readonly transportHints: string[]; +} + +declare var MSFIDOCredentialAssertion: { + prototype: MSFIDOCredentialAssertion; + new(): MSFIDOCredentialAssertion; +} + +interface MSFIDOSignature { + readonly authnrData: string; + readonly clientData: string; + readonly signature: string; +} + +declare var MSFIDOSignature: { + prototype: MSFIDOSignature; + new(): MSFIDOSignature; +} + +interface MSFIDOSignatureAssertion extends MSAssertion { + readonly signature: MSFIDOSignature; +} + +declare var MSFIDOSignatureAssertion: { + prototype: MSFIDOSignatureAssertion; + new(): MSFIDOSignatureAssertion; } interface MSGesture { @@ -11296,44 +12062,44 @@ declare var MSGesture: { } interface MSGestureEvent extends UIEvent { - clientX: number; - clientY: number; - expansion: number; - gestureObject: any; - hwTimestamp: number; - offsetX: number; - offsetY: number; - rotation: number; - scale: number; - screenX: number; - screenY: number; - translationX: number; - translationY: number; - velocityAngular: number; - velocityExpansion: number; - velocityX: number; - velocityY: number; + readonly clientX: number; + readonly clientY: number; + readonly expansion: number; + readonly gestureObject: any; + readonly hwTimestamp: number; + readonly offsetX: number; + readonly offsetY: number; + readonly rotation: number; + readonly scale: number; + readonly screenX: number; + readonly screenY: number; + readonly translationX: number; + readonly translationY: number; + readonly velocityAngular: number; + readonly velocityExpansion: number; + readonly velocityX: number; + readonly velocityY: number; initGestureEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, offsetXArg: number, offsetYArg: number, translationXArg: number, translationYArg: number, scaleArg: number, expansionArg: number, rotationArg: number, velocityXArg: number, velocityYArg: number, velocityExpansionArg: number, velocityAngularArg: number, hwTimestampArg: number): void; - MSGESTURE_FLAG_BEGIN: number; - MSGESTURE_FLAG_CANCEL: number; - MSGESTURE_FLAG_END: number; - MSGESTURE_FLAG_INERTIA: number; - MSGESTURE_FLAG_NONE: number; + readonly MSGESTURE_FLAG_BEGIN: number; + readonly MSGESTURE_FLAG_CANCEL: number; + readonly MSGESTURE_FLAG_END: number; + readonly MSGESTURE_FLAG_INERTIA: number; + readonly MSGESTURE_FLAG_NONE: number; } declare var MSGestureEvent: { prototype: MSGestureEvent; new(): MSGestureEvent; - MSGESTURE_FLAG_BEGIN: number; - MSGESTURE_FLAG_CANCEL: number; - MSGESTURE_FLAG_END: number; - MSGESTURE_FLAG_INERTIA: number; - MSGESTURE_FLAG_NONE: number; + readonly MSGESTURE_FLAG_BEGIN: number; + readonly MSGESTURE_FLAG_CANCEL: number; + readonly MSGESTURE_FLAG_END: number; + readonly MSGESTURE_FLAG_INERTIA: number; + readonly MSGESTURE_FLAG_NONE: number; } interface MSGraphicsTrust { - constrictionActive: boolean; - status: string; + readonly constrictionActive: boolean; + readonly status: string; } declare var MSGraphicsTrust: { @@ -11342,12 +12108,12 @@ declare var MSGraphicsTrust: { } interface MSHTMLWebViewElement extends HTMLElement { - canGoBack: boolean; - canGoForward: boolean; - containsFullScreenElement: boolean; - documentTitle: string; + readonly canGoBack: boolean; + readonly canGoForward: boolean; + readonly containsFullScreenElement: boolean; + readonly documentTitle: string; height: number; - settings: MSWebViewSettings; + readonly settings: MSWebViewSettings; src: string; width: number; addWebAllowedObject(name: string, applicationObject: any): void; @@ -11373,12 +12139,12 @@ declare var MSHTMLWebViewElement: { } interface MSInputMethodContext extends EventTarget { - compositionEndOffset: number; - compositionStartOffset: number; + readonly compositionEndOffset: number; + readonly compositionStartOffset: number; oncandidatewindowhide: (ev: Event) => any; oncandidatewindowshow: (ev: Event) => any; oncandidatewindowupdate: (ev: Event) => any; - target: HTMLElement; + readonly target: HTMLElement; getCandidateWindowClientRect(): ClientRect; getCompositionAlternatives(): string[]; hasComposition(): boolean; @@ -11395,59 +12161,59 @@ declare var MSInputMethodContext: { } interface MSManipulationEvent extends UIEvent { - currentState: number; - inertiaDestinationX: number; - inertiaDestinationY: number; - lastState: number; + readonly currentState: number; + readonly inertiaDestinationX: number; + readonly inertiaDestinationY: number; + readonly lastState: number; initMSManipulationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, lastState: number, currentState: number): void; - MS_MANIPULATION_STATE_ACTIVE: number; - MS_MANIPULATION_STATE_CANCELLED: number; - MS_MANIPULATION_STATE_COMMITTED: number; - MS_MANIPULATION_STATE_DRAGGING: number; - MS_MANIPULATION_STATE_INERTIA: number; - MS_MANIPULATION_STATE_PRESELECT: number; - MS_MANIPULATION_STATE_SELECTING: number; - MS_MANIPULATION_STATE_STOPPED: number; + readonly MS_MANIPULATION_STATE_ACTIVE: number; + readonly MS_MANIPULATION_STATE_CANCELLED: number; + readonly MS_MANIPULATION_STATE_COMMITTED: number; + readonly MS_MANIPULATION_STATE_DRAGGING: number; + readonly MS_MANIPULATION_STATE_INERTIA: number; + readonly MS_MANIPULATION_STATE_PRESELECT: number; + readonly MS_MANIPULATION_STATE_SELECTING: number; + readonly MS_MANIPULATION_STATE_STOPPED: number; } declare var MSManipulationEvent: { prototype: MSManipulationEvent; new(): MSManipulationEvent; - MS_MANIPULATION_STATE_ACTIVE: number; - MS_MANIPULATION_STATE_CANCELLED: number; - MS_MANIPULATION_STATE_COMMITTED: number; - MS_MANIPULATION_STATE_DRAGGING: number; - MS_MANIPULATION_STATE_INERTIA: number; - MS_MANIPULATION_STATE_PRESELECT: number; - MS_MANIPULATION_STATE_SELECTING: number; - MS_MANIPULATION_STATE_STOPPED: number; + readonly MS_MANIPULATION_STATE_ACTIVE: number; + readonly MS_MANIPULATION_STATE_CANCELLED: number; + readonly MS_MANIPULATION_STATE_COMMITTED: number; + readonly MS_MANIPULATION_STATE_DRAGGING: number; + readonly MS_MANIPULATION_STATE_INERTIA: number; + readonly MS_MANIPULATION_STATE_PRESELECT: number; + readonly MS_MANIPULATION_STATE_SELECTING: number; + readonly MS_MANIPULATION_STATE_STOPPED: number; } interface MSMediaKeyError { - code: number; - systemCode: number; - MS_MEDIA_KEYERR_CLIENT: number; - MS_MEDIA_KEYERR_DOMAIN: number; - MS_MEDIA_KEYERR_HARDWARECHANGE: number; - MS_MEDIA_KEYERR_OUTPUT: number; - MS_MEDIA_KEYERR_SERVICE: number; - MS_MEDIA_KEYERR_UNKNOWN: number; + readonly code: number; + readonly systemCode: number; + readonly MS_MEDIA_KEYERR_CLIENT: number; + readonly MS_MEDIA_KEYERR_DOMAIN: number; + readonly MS_MEDIA_KEYERR_HARDWARECHANGE: number; + readonly MS_MEDIA_KEYERR_OUTPUT: number; + readonly MS_MEDIA_KEYERR_SERVICE: number; + readonly MS_MEDIA_KEYERR_UNKNOWN: number; } declare var MSMediaKeyError: { prototype: MSMediaKeyError; new(): MSMediaKeyError; - MS_MEDIA_KEYERR_CLIENT: number; - MS_MEDIA_KEYERR_DOMAIN: number; - MS_MEDIA_KEYERR_HARDWARECHANGE: number; - MS_MEDIA_KEYERR_OUTPUT: number; - MS_MEDIA_KEYERR_SERVICE: number; - MS_MEDIA_KEYERR_UNKNOWN: number; + readonly MS_MEDIA_KEYERR_CLIENT: number; + readonly MS_MEDIA_KEYERR_DOMAIN: number; + readonly MS_MEDIA_KEYERR_HARDWARECHANGE: number; + readonly MS_MEDIA_KEYERR_OUTPUT: number; + readonly MS_MEDIA_KEYERR_SERVICE: number; + readonly MS_MEDIA_KEYERR_UNKNOWN: number; } interface MSMediaKeyMessageEvent extends Event { - destinationURL: string; - message: Uint8Array; + readonly destinationURL: string | null; + readonly message: Uint8Array; } declare var MSMediaKeyMessageEvent: { @@ -11456,7 +12222,7 @@ declare var MSMediaKeyMessageEvent: { } interface MSMediaKeyNeededEvent extends Event { - initData: Uint8Array; + readonly initData: Uint8Array | null; } declare var MSMediaKeyNeededEvent: { @@ -11465,9 +12231,9 @@ declare var MSMediaKeyNeededEvent: { } interface MSMediaKeySession extends EventTarget { - error: MSMediaKeyError; - keySystem: string; - sessionId: string; + readonly error: MSMediaKeyError | null; + readonly keySystem: string; + readonly sessionId: string; close(): void; update(key: Uint8Array): void; } @@ -11478,7 +12244,7 @@ declare var MSMediaKeySession: { } interface MSMediaKeys { - keySystem: string; + readonly keySystem: string; createSession(type: string, initData: Uint8Array, cdmData?: Uint8Array): MSMediaKeySession; } @@ -11486,40 +12252,22 @@ declare var MSMediaKeys: { prototype: MSMediaKeys; new(keySystem: string): MSMediaKeys; isTypeSupported(keySystem: string, type?: string): boolean; -} - -interface MSMimeTypesCollection { - length: number; -} - -declare var MSMimeTypesCollection: { - prototype: MSMimeTypesCollection; - new(): MSMimeTypesCollection; -} - -interface MSPluginsCollection { - length: number; - refresh(reload?: boolean): void; -} - -declare var MSPluginsCollection: { - prototype: MSPluginsCollection; - new(): MSPluginsCollection; + isTypeSupportedWithFeatures(keySystem: string, type?: string): string; } interface MSPointerEvent extends MouseEvent { - currentPoint: any; - height: number; - hwTimestamp: number; - intermediatePoints: any; - isPrimary: boolean; - pointerId: number; - pointerType: any; - pressure: number; - rotation: number; - tiltX: number; - tiltY: number; - width: number; + readonly currentPoint: any; + readonly height: number; + readonly hwTimestamp: number; + readonly intermediatePoints: any; + readonly isPrimary: boolean; + readonly pointerId: number; + readonly pointerType: any; + readonly pressure: number; + readonly rotation: number; + readonly tiltX: number; + readonly tiltY: number; + readonly width: number; getCurrentPoint(element: Element): void; getIntermediatePoints(element: Element): void; initPointerEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, offsetXArg: number, offsetYArg: number, widthArg: number, heightArg: number, pressure: number, rotation: number, tiltX: number, tiltY: number, pointerIdArg: number, pointerType: any, hwTimestampArg: number, isPrimary: boolean): void; @@ -11531,7 +12279,7 @@ declare var MSPointerEvent: { } interface MSRangeCollection { - length: number; + readonly length: number; item(index: number): Range; [index: number]: Range; } @@ -11542,8 +12290,8 @@ declare var MSRangeCollection: { } interface MSSiteModeEvent extends Event { - actionURL: string; - buttonID: number; + readonly actionURL: string; + readonly buttonID: number; } declare var MSSiteModeEvent: { @@ -11552,7 +12300,7 @@ declare var MSSiteModeEvent: { } interface MSStream { - type: string; + readonly type: string; msClose(): void; msDetachStream(): any; } @@ -11563,7 +12311,7 @@ declare var MSStream: { } interface MSStreamReader extends EventTarget, MSBaseReader { - error: DOMError; + readonly error: DOMError; readAsArrayBuffer(stream: MSStream, size?: number): void; readAsBinaryString(stream: MSStream, size?: number): void; readAsBlob(stream: MSStream, size?: number): void; @@ -11578,20 +12326,20 @@ declare var MSStreamReader: { } interface MSWebViewAsyncOperation extends EventTarget { - error: DOMError; + readonly error: DOMError; oncomplete: (ev: Event) => any; onerror: (ev: Event) => any; - readyState: number; - result: any; - target: MSHTMLWebViewElement; - type: number; + readonly readyState: number; + readonly result: any; + readonly target: MSHTMLWebViewElement; + readonly type: number; start(): void; - COMPLETED: number; - ERROR: number; - STARTED: number; - TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number; - TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number; - TYPE_INVOKE_SCRIPT: number; + readonly COMPLETED: number; + readonly ERROR: number; + readonly STARTED: number; + readonly TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number; + readonly TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number; + readonly TYPE_INVOKE_SCRIPT: number; addEventListener(type: "complete", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; @@ -11600,12 +12348,12 @@ interface MSWebViewAsyncOperation extends EventTarget { declare var MSWebViewAsyncOperation: { prototype: MSWebViewAsyncOperation; new(): MSWebViewAsyncOperation; - COMPLETED: number; - ERROR: number; - STARTED: number; - TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number; - TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number; - TYPE_INVOKE_SCRIPT: number; + readonly COMPLETED: number; + readonly ERROR: number; + readonly STARTED: number; + readonly TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number; + readonly TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number; + readonly TYPE_INVOKE_SCRIPT: number; } interface MSWebViewSettings { @@ -11618,6 +12366,32 @@ declare var MSWebViewSettings: { new(): MSWebViewSettings; } +interface MediaDeviceInfo { + readonly deviceId: string; + readonly groupId: string; + readonly kind: string; + readonly label: string; +} + +declare var MediaDeviceInfo: { + prototype: MediaDeviceInfo; + new(): MediaDeviceInfo; +} + +interface MediaDevices extends EventTarget { + ondevicechange: (ev: Event) => any; + enumerateDevices(): any; + getSupportedConstraints(): MediaTrackSupportedConstraints; + getUserMedia(constraints: MediaStreamConstraints): PromiseLike; + addEventListener(type: "devicechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MediaDevices: { + prototype: MediaDevices; + new(): MediaDevices; +} + interface MediaElementAudioSourceNode extends AudioNode { } @@ -11626,28 +12400,98 @@ declare var MediaElementAudioSourceNode: { new(): MediaElementAudioSourceNode; } +interface MediaEncryptedEvent extends Event { + readonly initData: ArrayBuffer | null; + readonly initDataType: string; +} + +declare var MediaEncryptedEvent: { + prototype: MediaEncryptedEvent; + new(type: string, eventInitDict?: MediaEncryptedEventInit): MediaEncryptedEvent; +} + interface MediaError { - code: number; - msExtendedCode: number; - MEDIA_ERR_ABORTED: number; - MEDIA_ERR_DECODE: number; - MEDIA_ERR_NETWORK: number; - MEDIA_ERR_SRC_NOT_SUPPORTED: number; - MS_MEDIA_ERR_ENCRYPTED: number; + readonly code: number; + readonly msExtendedCode: number; + readonly MEDIA_ERR_ABORTED: number; + readonly MEDIA_ERR_DECODE: number; + readonly MEDIA_ERR_NETWORK: number; + readonly MEDIA_ERR_SRC_NOT_SUPPORTED: number; + readonly MS_MEDIA_ERR_ENCRYPTED: number; } declare var MediaError: { prototype: MediaError; new(): MediaError; - MEDIA_ERR_ABORTED: number; - MEDIA_ERR_DECODE: number; - MEDIA_ERR_NETWORK: number; - MEDIA_ERR_SRC_NOT_SUPPORTED: number; - MS_MEDIA_ERR_ENCRYPTED: number; + readonly MEDIA_ERR_ABORTED: number; + readonly MEDIA_ERR_DECODE: number; + readonly MEDIA_ERR_NETWORK: number; + readonly MEDIA_ERR_SRC_NOT_SUPPORTED: number; + readonly MS_MEDIA_ERR_ENCRYPTED: number; +} + +interface MediaKeyMessageEvent extends Event { + readonly message: ArrayBuffer; + readonly messageType: string; +} + +declare var MediaKeyMessageEvent: { + prototype: MediaKeyMessageEvent; + new(type: string, eventInitDict?: MediaKeyMessageEventInit): MediaKeyMessageEvent; +} + +interface MediaKeySession extends EventTarget { + readonly closed: PromiseLike; + readonly expiration: number; + readonly keyStatuses: MediaKeyStatusMap; + readonly sessionId: string; + close(): PromiseLike; + generateRequest(initDataType: string, initData: any): PromiseLike; + load(sessionId: string): PromiseLike; + remove(): PromiseLike; + update(response: any): PromiseLike; +} + +declare var MediaKeySession: { + prototype: MediaKeySession; + new(): MediaKeySession; +} + +interface MediaKeyStatusMap { + readonly size: number; + forEach(callback: ForEachCallback): void; + get(keyId: any): string; + has(keyId: any): boolean; +} + +declare var MediaKeyStatusMap: { + prototype: MediaKeyStatusMap; + new(): MediaKeyStatusMap; +} + +interface MediaKeySystemAccess { + readonly keySystem: string; + createMediaKeys(): PromiseLike; + getConfiguration(): MediaKeySystemConfiguration; +} + +declare var MediaKeySystemAccess: { + prototype: MediaKeySystemAccess; + new(): MediaKeySystemAccess; +} + +interface MediaKeys { + createSession(sessionType?: string): MediaKeySession; + setServerCertificate(serverCertificate: any): PromiseLike; +} + +declare var MediaKeys: { + prototype: MediaKeys; + new(): MediaKeys; } interface MediaList { - length: number; + readonly length: number; mediaText: string; appendMedium(newMedium: string): void; deleteMedium(oldMedium: string): void; @@ -11662,8 +12506,8 @@ declare var MediaList: { } interface MediaQueryList { - matches: boolean; - media: string; + readonly matches: boolean; + readonly media: string; addListener(listener: MediaQueryListListener): void; removeListener(listener: MediaQueryListListener): void; } @@ -11674,10 +12518,10 @@ declare var MediaQueryList: { } interface MediaSource extends EventTarget { - activeSourceBuffers: SourceBufferList; + readonly activeSourceBuffers: SourceBufferList; duration: number; - readyState: number; - sourceBuffers: SourceBufferList; + readonly readyState: string; + readonly sourceBuffers: SourceBufferList; addSourceBuffer(type: string): SourceBuffer; endOfStream(error?: number): void; removeSourceBuffer(sourceBuffer: SourceBuffer): void; @@ -11689,9 +12533,104 @@ declare var MediaSource: { isTypeSupported(type: string): boolean; } +interface MediaStream extends EventTarget { + readonly active: boolean; + readonly id: string; + onactive: (ev: Event) => any; + onaddtrack: (ev: TrackEvent) => any; + oninactive: (ev: Event) => any; + onremovetrack: (ev: TrackEvent) => any; + addTrack(track: MediaStreamTrack): void; + clone(): MediaStream; + getAudioTracks(): MediaStreamTrack[]; + getTrackById(trackId: string): MediaStreamTrack | null; + getTracks(): MediaStreamTrack[]; + getVideoTracks(): MediaStreamTrack[]; + removeTrack(track: MediaStreamTrack): void; + stop(): void; + addEventListener(type: "active", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "addtrack", listener: (ev: TrackEvent) => any, useCapture?: boolean): void; + addEventListener(type: "inactive", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "removetrack", listener: (ev: TrackEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MediaStream: { + prototype: MediaStream; + new(streamOrTracks?: MediaStream | MediaStreamTrack[]): MediaStream; +} + +interface MediaStreamAudioSourceNode extends AudioNode { +} + +declare var MediaStreamAudioSourceNode: { + prototype: MediaStreamAudioSourceNode; + new(): MediaStreamAudioSourceNode; +} + +interface MediaStreamError { + readonly constraintName: string | null; + readonly message: string | null; + readonly name: string; +} + +declare var MediaStreamError: { + prototype: MediaStreamError; + new(): MediaStreamError; +} + +interface MediaStreamErrorEvent extends Event { + readonly error: MediaStreamError | null; +} + +declare var MediaStreamErrorEvent: { + prototype: MediaStreamErrorEvent; + new(type: string, eventInitDict?: MediaStreamErrorEventInit): MediaStreamErrorEvent; +} + +interface MediaStreamTrack extends EventTarget { + enabled: boolean; + readonly id: string; + readonly kind: string; + readonly label: string; + readonly muted: boolean; + onended: (ev: MediaStreamErrorEvent) => any; + onmute: (ev: Event) => any; + onoverconstrained: (ev: MediaStreamErrorEvent) => any; + onunmute: (ev: Event) => any; + readonly readonly: boolean; + readonly readyState: string; + readonly remote: boolean; + applyConstraints(constraints: MediaTrackConstraints): PromiseLike; + clone(): MediaStreamTrack; + getCapabilities(): MediaTrackCapabilities; + getConstraints(): MediaTrackConstraints; + getSettings(): MediaTrackSettings; + stop(): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mute", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "overconstrained", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "unmute", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MediaStreamTrack: { + prototype: MediaStreamTrack; + new(): MediaStreamTrack; +} + +interface MediaStreamTrackEvent extends Event { + readonly track: MediaStreamTrack; +} + +declare var MediaStreamTrackEvent: { + prototype: MediaStreamTrackEvent; + new(type: string, eventInitDict?: MediaStreamTrackEventInit): MediaStreamTrackEvent; +} + interface MessageChannel { - port1: MessagePort; - port2: MessagePort; + readonly port1: MessagePort; + readonly port2: MessagePort; } declare var MessageChannel: { @@ -11700,10 +12639,10 @@ declare var MessageChannel: { } interface MessageEvent extends Event { - data: any; - origin: string; - ports: any; - source: Window; + readonly data: any; + readonly origin: string; + readonly ports: any; + readonly source: Window; initMessageEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, dataArg: any, originArg: string, lastEventIdArg: string, sourceArg: Window): void; } @@ -11727,10 +12666,10 @@ declare var MessagePort: { } interface MimeType { - description: string; - enabledPlugin: Plugin; - suffixes: string; - type: string; + readonly description: string; + readonly enabledPlugin: Plugin; + readonly suffixes: string; + readonly type: string; } declare var MimeType: { @@ -11739,7 +12678,7 @@ declare var MimeType: { } interface MimeTypeArray { - length: number; + readonly length: number; item(index: number): Plugin; namedItem(type: string): Plugin; [index: number]: Plugin; @@ -11751,30 +12690,30 @@ declare var MimeTypeArray: { } interface MouseEvent extends UIEvent { - altKey: boolean; - button: number; - buttons: number; - clientX: number; - clientY: number; - ctrlKey: boolean; - fromElement: Element; - layerX: number; - layerY: number; - metaKey: boolean; - movementX: number; - movementY: number; - offsetX: number; - offsetY: number; - pageX: number; - pageY: number; - relatedTarget: EventTarget; - screenX: number; - screenY: number; - shiftKey: boolean; - toElement: Element; - which: number; - x: number; - y: number; + readonly altKey: boolean; + readonly button: number; + readonly buttons: number; + readonly clientX: number; + readonly clientY: number; + readonly ctrlKey: boolean; + readonly fromElement: Element; + readonly layerX: number; + readonly layerY: number; + readonly metaKey: boolean; + readonly movementX: number; + readonly movementY: number; + readonly offsetX: number; + readonly offsetY: number; + readonly pageX: number; + readonly pageY: number; + readonly relatedTarget: EventTarget; + readonly screenX: number; + readonly screenY: number; + readonly shiftKey: boolean; + readonly toElement: Element; + readonly which: number; + readonly x: number; + readonly y: number; getModifierState(keyArg: string): boolean; initMouseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget): void; } @@ -11784,36 +12723,24 @@ declare var MouseEvent: { new(typeArg: string, eventInitDict?: MouseEventInit): MouseEvent; } -interface MouseWheelEvent extends MouseEvent { - wheelDelta: number; - wheelDeltaX: number; - wheelDeltaY: number; - initMouseWheelEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, buttonArg: number, relatedTargetArg: EventTarget, modifiersListArg: string, wheelDeltaArg: number): void; -} - -declare var MouseWheelEvent: { - prototype: MouseWheelEvent; - new(): MouseWheelEvent; -} - interface MutationEvent extends Event { - attrChange: number; - attrName: string; - newValue: string; - prevValue: string; - relatedNode: Node; + readonly attrChange: number; + readonly attrName: string; + readonly newValue: string; + readonly prevValue: string; + readonly relatedNode: Node; initMutationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, relatedNodeArg: Node, prevValueArg: string, newValueArg: string, attrNameArg: string, attrChangeArg: number): void; - ADDITION: number; - MODIFICATION: number; - REMOVAL: number; + readonly ADDITION: number; + readonly MODIFICATION: number; + readonly REMOVAL: number; } declare var MutationEvent: { prototype: MutationEvent; new(): MutationEvent; - ADDITION: number; - MODIFICATION: number; - REMOVAL: number; + readonly ADDITION: number; + readonly MODIFICATION: number; + readonly REMOVAL: number; } interface MutationObserver { @@ -11828,15 +12755,15 @@ declare var MutationObserver: { } interface MutationRecord { - addedNodes: NodeList; - attributeName: string; - attributeNamespace: string; - nextSibling: Node; - oldValue: string; - previousSibling: Node; - removedNodes: NodeList; - target: Node; - type: string; + readonly addedNodes: NodeList; + readonly attributeName: string | null; + readonly attributeNamespace: string | null; + readonly nextSibling: Node | null; + readonly oldValue: string | null; + readonly previousSibling: Node | null; + readonly removedNodes: NodeList; + readonly target: Node; + readonly type: string; } declare var MutationRecord: { @@ -11845,12 +12772,12 @@ declare var MutationRecord: { } interface NamedNodeMap { - length: number; + readonly length: number; getNamedItem(name: string): Attr; - getNamedItemNS(namespaceURI: string, localName: string): Attr; + getNamedItemNS(namespaceURI: string | null, localName: string | null): Attr; item(index: number): Attr; removeNamedItem(name: string): Attr; - removeNamedItemNS(namespaceURI: string, localName: string): Attr; + removeNamedItemNS(namespaceURI: string | null, localName: string | null): Attr; setNamedItem(arg: Attr): Attr; setNamedItemNS(arg: Attr): Attr; [index: number]: Attr; @@ -11862,8 +12789,8 @@ declare var NamedNodeMap: { } interface NavigationCompletedEvent extends NavigationEvent { - isSuccess: boolean; - webErrorStatus: number; + readonly isSuccess: boolean; + readonly webErrorStatus: number; } declare var NavigationCompletedEvent: { @@ -11872,7 +12799,7 @@ declare var NavigationCompletedEvent: { } interface NavigationEvent extends Event { - uri: string; + readonly uri: string; } declare var NavigationEvent: { @@ -11881,7 +12808,7 @@ declare var NavigationEvent: { } interface NavigationEventWithReferrer extends NavigationEvent { - referer: string; + readonly referer: string; } declare var NavigationEventWithReferrer: { @@ -11889,27 +12816,23 @@ declare var NavigationEventWithReferrer: { new(): NavigationEventWithReferrer; } -interface Navigator extends Object, NavigatorID, NavigatorOnLine, NavigatorContentUtils, NavigatorStorageUtils, NavigatorGeolocation, MSNavigatorDoNotTrack, MSFileSaver { - appCodeName: string; - appMinorVersion: string; - browserLanguage: string; - connectionSpeed: number; - cookieEnabled: boolean; - cpuClass: string; - language: string; - maxTouchPoints: number; - mimeTypes: MSMimeTypesCollection; - msManipulationViewsEnabled: boolean; - msMaxTouchPoints: number; - msPointerEnabled: boolean; - plugins: MSPluginsCollection; - pointerEnabled: boolean; - systemLanguage: string; - userLanguage: string; - webdriver: boolean; +interface Navigator extends Object, NavigatorID, NavigatorOnLine, NavigatorContentUtils, NavigatorStorageUtils, NavigatorGeolocation, MSNavigatorDoNotTrack, MSFileSaver, NavigatorUserMedia { + readonly appCodeName: string; + readonly cookieEnabled: boolean; + readonly language: string; + readonly maxTouchPoints: number; + readonly mimeTypes: MimeTypeArray; + readonly msManipulationViewsEnabled: boolean; + readonly msMaxTouchPoints: number; + readonly msPointerEnabled: boolean; + readonly plugins: PluginArray; + readonly pointerEnabled: boolean; + readonly webdriver: boolean; getGamepads(): Gamepad[]; javaEnabled(): boolean; msLaunchUri(uri: string, successCallback?: MSLaunchUriCallback, noHandlerCallback?: MSLaunchUriCallback): void; + requestMediaKeySystemAccess(keySystem: string, supportedConfigurations: MediaKeySystemConfiguration[]): PromiseLike; + vibrate(pattern: number | number[]): boolean; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -11919,78 +12842,79 @@ declare var Navigator: { } interface Node extends EventTarget { - attributes: NamedNodeMap; - baseURI: string; - childNodes: NodeList; - firstChild: Node; - lastChild: Node; - localName: string; - namespaceURI: string; - nextSibling: Node; - nodeName: string; - nodeType: number; - nodeValue: string; - ownerDocument: Document; - parentElement: HTMLElement; - parentNode: Node; - prefix: string; - previousSibling: Node; - textContent: string; + readonly attributes: NamedNodeMap; + readonly baseURI: string | null; + readonly childNodes: NodeList; + readonly firstChild: Node; + readonly lastChild: Node; + readonly localName: string | null; + readonly namespaceURI: string | null; + readonly nextSibling: Node; + readonly nodeName: string; + readonly nodeType: number; + nodeValue: string | null; + readonly ownerDocument: Document; + readonly parentElement: HTMLElement; + readonly parentNode: Node; + readonly previousSibling: Node; + textContent: string | null; appendChild(newChild: Node): Node; cloneNode(deep?: boolean): Node; compareDocumentPosition(other: Node): number; + contains(child: Node): boolean; hasAttributes(): boolean; hasChildNodes(): boolean; - insertBefore(newChild: Node, refChild?: Node): Node; - isDefaultNamespace(namespaceURI: string): boolean; + insertBefore(newChild: Node, refChild: Node): Node; + isDefaultNamespace(namespaceURI: string | null): boolean; isEqualNode(arg: Node): boolean; isSameNode(other: Node): boolean; - lookupNamespaceURI(prefix: string): string; - lookupPrefix(namespaceURI: string): string; + lookupNamespaceURI(prefix: string | null): string | null; + lookupPrefix(namespaceURI: string | null): string | null; normalize(): void; removeChild(oldChild: Node): Node; replaceChild(newChild: Node, oldChild: Node): Node; - ATTRIBUTE_NODE: number; - CDATA_SECTION_NODE: number; - COMMENT_NODE: number; - DOCUMENT_FRAGMENT_NODE: number; - DOCUMENT_NODE: number; - DOCUMENT_POSITION_CONTAINED_BY: number; - DOCUMENT_POSITION_CONTAINS: number; - DOCUMENT_POSITION_DISCONNECTED: number; - DOCUMENT_POSITION_FOLLOWING: number; - DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number; - DOCUMENT_POSITION_PRECEDING: number; - DOCUMENT_TYPE_NODE: number; - ELEMENT_NODE: number; - ENTITY_NODE: number; - ENTITY_REFERENCE_NODE: number; - NOTATION_NODE: number; - PROCESSING_INSTRUCTION_NODE: number; - TEXT_NODE: number; + contains(node: Node): boolean; + readonly ATTRIBUTE_NODE: number; + readonly CDATA_SECTION_NODE: number; + readonly COMMENT_NODE: number; + readonly DOCUMENT_FRAGMENT_NODE: number; + readonly DOCUMENT_NODE: number; + readonly DOCUMENT_POSITION_CONTAINED_BY: number; + readonly DOCUMENT_POSITION_CONTAINS: number; + readonly DOCUMENT_POSITION_DISCONNECTED: number; + readonly DOCUMENT_POSITION_FOLLOWING: number; + readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number; + readonly DOCUMENT_POSITION_PRECEDING: number; + readonly DOCUMENT_TYPE_NODE: number; + readonly ELEMENT_NODE: number; + readonly ENTITY_NODE: number; + readonly ENTITY_REFERENCE_NODE: number; + readonly NOTATION_NODE: number; + readonly PROCESSING_INSTRUCTION_NODE: number; + readonly TEXT_NODE: number; } declare var Node: { prototype: Node; new(): Node; - ATTRIBUTE_NODE: number; - CDATA_SECTION_NODE: number; - COMMENT_NODE: number; - DOCUMENT_FRAGMENT_NODE: number; - DOCUMENT_NODE: number; - DOCUMENT_POSITION_CONTAINED_BY: number; - DOCUMENT_POSITION_CONTAINS: number; - DOCUMENT_POSITION_DISCONNECTED: number; - DOCUMENT_POSITION_FOLLOWING: number; - DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number; - DOCUMENT_POSITION_PRECEDING: number; - DOCUMENT_TYPE_NODE: number; - ELEMENT_NODE: number; - ENTITY_NODE: number; - ENTITY_REFERENCE_NODE: number; - NOTATION_NODE: number; - PROCESSING_INSTRUCTION_NODE: number; - TEXT_NODE: number; + readonly ATTRIBUTE_NODE: number; + readonly CDATA_SECTION_NODE: number; + readonly COMMENT_NODE: number; + readonly DOCUMENT_FRAGMENT_NODE: number; + readonly DOCUMENT_NODE: number; + readonly DOCUMENT_POSITION_CONTAINED_BY: number; + readonly DOCUMENT_POSITION_CONTAINS: number; + readonly DOCUMENT_POSITION_DISCONNECTED: number; + readonly DOCUMENT_POSITION_FOLLOWING: number; + readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number; + readonly DOCUMENT_POSITION_PRECEDING: number; + readonly DOCUMENT_TYPE_NODE: number; + readonly ELEMENT_NODE: number; + readonly ENTITY_NODE: number; + readonly ENTITY_REFERENCE_NODE: number; + readonly NOTATION_NODE: number; + readonly PROCESSING_INSTRUCTION_NODE: number; + readonly TEXT_NODE: number; } interface NodeFilter { @@ -11998,29 +12922,29 @@ interface NodeFilter { } declare var NodeFilter: { - FILTER_ACCEPT: number; - FILTER_REJECT: number; - FILTER_SKIP: number; - SHOW_ALL: number; - SHOW_ATTRIBUTE: number; - SHOW_CDATA_SECTION: number; - SHOW_COMMENT: number; - SHOW_DOCUMENT: number; - SHOW_DOCUMENT_FRAGMENT: number; - SHOW_DOCUMENT_TYPE: number; - SHOW_ELEMENT: number; - SHOW_ENTITY: number; - SHOW_ENTITY_REFERENCE: number; - SHOW_NOTATION: number; - SHOW_PROCESSING_INSTRUCTION: number; - SHOW_TEXT: number; + readonly FILTER_ACCEPT: number; + readonly FILTER_REJECT: number; + readonly FILTER_SKIP: number; + readonly SHOW_ALL: number; + readonly SHOW_ATTRIBUTE: number; + readonly SHOW_CDATA_SECTION: number; + readonly SHOW_COMMENT: number; + readonly SHOW_DOCUMENT: number; + readonly SHOW_DOCUMENT_FRAGMENT: number; + readonly SHOW_DOCUMENT_TYPE: number; + readonly SHOW_ELEMENT: number; + readonly SHOW_ENTITY: number; + readonly SHOW_ENTITY_REFERENCE: number; + readonly SHOW_NOTATION: number; + readonly SHOW_PROCESSING_INSTRUCTION: number; + readonly SHOW_TEXT: number; } interface NodeIterator { - expandEntityReferences: boolean; - filter: NodeFilter; - root: Node; - whatToShow: number; + readonly expandEntityReferences: boolean; + readonly filter: NodeFilter; + readonly root: Node; + readonly whatToShow: number; detach(): void; nextNode(): Node; previousNode(): Node; @@ -12032,7 +12956,7 @@ declare var NodeIterator: { } interface NodeList { - length: number; + readonly length: number; item(index: number): Node; [index: number]: Node; } @@ -12051,13 +12975,13 @@ declare var OES_element_index_uint: { } interface OES_standard_derivatives { - FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number; + readonly FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number; } declare var OES_standard_derivatives: { prototype: OES_standard_derivatives; new(): OES_standard_derivatives; - FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number; + readonly FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number; } interface OES_texture_float { @@ -12077,7 +13001,7 @@ declare var OES_texture_float_linear: { } interface OfflineAudioCompletionEvent extends Event { - renderedBuffer: AudioBuffer; + readonly renderedBuffer: AudioBuffer; } declare var OfflineAudioCompletionEvent: { @@ -12087,7 +13011,7 @@ declare var OfflineAudioCompletionEvent: { interface OfflineAudioContext extends AudioContext { oncomplete: (ev: Event) => any; - startRendering(): void; + startRendering(): PromiseLike; addEventListener(type: "complete", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -12098,14 +13022,14 @@ declare var OfflineAudioContext: { } interface OscillatorNode extends AudioNode { - detune: AudioParam; - frequency: AudioParam; - onended: (ev: Event) => any; + readonly detune: AudioParam; + readonly frequency: AudioParam; + onended: (ev: MediaStreamErrorEvent) => any; type: string; setPeriodicWave(periodicWave: PeriodicWave): void; start(when?: number): void; stop(when?: number): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -12114,8 +13038,25 @@ declare var OscillatorNode: { new(): OscillatorNode; } +interface OverflowEvent extends UIEvent { + readonly horizontalOverflow: boolean; + readonly orient: number; + readonly verticalOverflow: boolean; + readonly BOTH: number; + readonly HORIZONTAL: number; + readonly VERTICAL: number; +} + +declare var OverflowEvent: { + prototype: OverflowEvent; + new(): OverflowEvent; + readonly BOTH: number; + readonly HORIZONTAL: number; + readonly VERTICAL: number; +} + interface PageTransitionEvent extends Event { - persisted: boolean; + readonly persisted: boolean; } declare var PageTransitionEvent: { @@ -12143,24 +13084,24 @@ declare var PannerNode: { } interface PerfWidgetExternal { - activeNetworkRequestCount: number; - averageFrameTime: number; - averagePaintTime: number; - extraInformationEnabled: boolean; - independentRenderingEnabled: boolean; - irDisablingContentString: string; - irStatusAvailable: boolean; - maxCpuSpeed: number; - paintRequestsPerSecond: number; - performanceCounter: number; - performanceCounterFrequency: number; + readonly activeNetworkRequestCount: number; + readonly averageFrameTime: number; + readonly averagePaintTime: number; + readonly extraInformationEnabled: boolean; + readonly independentRenderingEnabled: boolean; + readonly irDisablingContentString: string; + readonly irStatusAvailable: boolean; + readonly maxCpuSpeed: number; + readonly paintRequestsPerSecond: number; + readonly performanceCounter: number; + readonly performanceCounterFrequency: number; addEventListener(eventType: string, callback: Function): void; getMemoryUsage(): number; getProcessCpuUsage(): number; - getRecentCpuUsage(last: number): any; - getRecentFrames(last: number): any; - getRecentMemoryUsage(last: number): any; - getRecentPaintRequests(last: number): any; + getRecentCpuUsage(last: number | null): any; + getRecentFrames(last: number | null): any; + getRecentMemoryUsage(last: number | null): any; + getRecentPaintRequests(last: number | null): any; removeEventListener(eventType: string, callback: Function): void; repositionWindow(x: number, y: number): void; resizeWindow(width: number, height: number): void; @@ -12172,8 +13113,8 @@ declare var PerfWidgetExternal: { } interface Performance { - navigation: PerformanceNavigation; - timing: PerformanceTiming; + readonly navigation: PerformanceNavigation; + readonly timing: PerformanceTiming; clearMarks(markName?: string): void; clearMeasures(measureName?: string): void; clearResourceTimings(): void; @@ -12195,10 +13136,10 @@ declare var Performance: { } interface PerformanceEntry { - duration: number; - entryType: string; - name: string; - startTime: number; + readonly duration: number; + readonly entryType: string; + readonly name: string; + readonly startTime: number; } declare var PerformanceEntry: { @@ -12223,47 +13164,47 @@ declare var PerformanceMeasure: { } interface PerformanceNavigation { - redirectCount: number; - type: number; + readonly redirectCount: number; + readonly type: number; toJSON(): any; - TYPE_BACK_FORWARD: number; - TYPE_NAVIGATE: number; - TYPE_RELOAD: number; - TYPE_RESERVED: number; + readonly TYPE_BACK_FORWARD: number; + readonly TYPE_NAVIGATE: number; + readonly TYPE_RELOAD: number; + readonly TYPE_RESERVED: number; } declare var PerformanceNavigation: { prototype: PerformanceNavigation; new(): PerformanceNavigation; - TYPE_BACK_FORWARD: number; - TYPE_NAVIGATE: number; - TYPE_RELOAD: number; - TYPE_RESERVED: number; + readonly TYPE_BACK_FORWARD: number; + readonly TYPE_NAVIGATE: number; + readonly TYPE_RELOAD: number; + readonly TYPE_RESERVED: number; } interface PerformanceNavigationTiming extends PerformanceEntry { - connectEnd: number; - connectStart: number; - domComplete: number; - domContentLoadedEventEnd: number; - domContentLoadedEventStart: number; - domInteractive: number; - domLoading: number; - domainLookupEnd: number; - domainLookupStart: number; - fetchStart: number; - loadEventEnd: number; - loadEventStart: number; - navigationStart: number; - redirectCount: number; - redirectEnd: number; - redirectStart: number; - requestStart: number; - responseEnd: number; - responseStart: number; - type: string; - unloadEventEnd: number; - unloadEventStart: number; + readonly connectEnd: number; + readonly connectStart: number; + readonly domComplete: number; + readonly domContentLoadedEventEnd: number; + readonly domContentLoadedEventStart: number; + readonly domInteractive: number; + readonly domLoading: number; + readonly domainLookupEnd: number; + readonly domainLookupStart: number; + readonly fetchStart: number; + readonly loadEventEnd: number; + readonly loadEventStart: number; + readonly navigationStart: number; + readonly redirectCount: number; + readonly redirectEnd: number; + readonly redirectStart: number; + readonly requestStart: number; + readonly responseEnd: number; + readonly responseStart: number; + readonly type: string; + readonly unloadEventEnd: number; + readonly unloadEventStart: number; } declare var PerformanceNavigationTiming: { @@ -12272,17 +13213,17 @@ declare var PerformanceNavigationTiming: { } interface PerformanceResourceTiming extends PerformanceEntry { - connectEnd: number; - connectStart: number; - domainLookupEnd: number; - domainLookupStart: number; - fetchStart: number; - initiatorType: string; - redirectEnd: number; - redirectStart: number; - requestStart: number; - responseEnd: number; - responseStart: number; + readonly connectEnd: number; + readonly connectStart: number; + readonly domainLookupEnd: number; + readonly domainLookupStart: number; + readonly fetchStart: number; + readonly initiatorType: string; + readonly redirectEnd: number; + readonly redirectStart: number; + readonly requestStart: number; + readonly responseEnd: number; + readonly responseStart: number; } declare var PerformanceResourceTiming: { @@ -12291,27 +13232,27 @@ declare var PerformanceResourceTiming: { } interface PerformanceTiming { - connectEnd: number; - connectStart: number; - domComplete: number; - domContentLoadedEventEnd: number; - domContentLoadedEventStart: number; - domInteractive: number; - domLoading: number; - domainLookupEnd: number; - domainLookupStart: number; - fetchStart: number; - loadEventEnd: number; - loadEventStart: number; - msFirstPaint: number; - navigationStart: number; - redirectEnd: number; - redirectStart: number; - requestStart: number; - responseEnd: number; - responseStart: number; - unloadEventEnd: number; - unloadEventStart: number; + readonly connectEnd: number; + readonly connectStart: number; + readonly domComplete: number; + readonly domContentLoadedEventEnd: number; + readonly domContentLoadedEventStart: number; + readonly domInteractive: number; + readonly domLoading: number; + readonly domainLookupEnd: number; + readonly domainLookupStart: number; + readonly fetchStart: number; + readonly loadEventEnd: number; + readonly loadEventStart: number; + readonly msFirstPaint: number; + readonly navigationStart: number; + readonly redirectEnd: number; + readonly redirectStart: number; + readonly requestStart: number; + readonly responseEnd: number; + readonly responseStart: number; + readonly unloadEventEnd: number; + readonly unloadEventStart: number; toJSON(): any; } @@ -12329,7 +13270,7 @@ declare var PeriodicWave: { } interface PermissionRequest extends DeferredPermissionRequest { - state: string; + readonly state: string; defer(): void; } @@ -12339,7 +13280,7 @@ declare var PermissionRequest: { } interface PermissionRequestedEvent extends Event { - permissionRequest: PermissionRequest; + readonly permissionRequest: PermissionRequest; } declare var PermissionRequestedEvent: { @@ -12348,11 +13289,11 @@ declare var PermissionRequestedEvent: { } interface Plugin { - description: string; - filename: string; - length: number; - name: string; - version: string; + readonly description: string; + readonly filename: string; + readonly length: number; + readonly name: string; + readonly version: string; item(index: number): MimeType; namedItem(type: string): MimeType; [index: number]: MimeType; @@ -12364,7 +13305,7 @@ declare var Plugin: { } interface PluginArray { - length: number; + readonly length: number; item(index: number): Plugin; namedItem(name: string): Plugin; refresh(reload?: boolean): void; @@ -12377,18 +13318,18 @@ declare var PluginArray: { } interface PointerEvent extends MouseEvent { - currentPoint: any; - height: number; - hwTimestamp: number; - intermediatePoints: any; - isPrimary: boolean; - pointerId: number; - pointerType: any; - pressure: number; - rotation: number; - tiltX: number; - tiltY: number; - width: number; + readonly currentPoint: any; + readonly height: number; + readonly hwTimestamp: number; + readonly intermediatePoints: any; + readonly isPrimary: boolean; + readonly pointerId: number; + readonly pointerType: any; + readonly pressure: number; + readonly rotation: number; + readonly tiltX: number; + readonly tiltY: number; + readonly width: number; getCurrentPoint(element: Element): void; getIntermediatePoints(element: Element): void; initPointerEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, offsetXArg: number, offsetYArg: number, widthArg: number, heightArg: number, pressure: number, rotation: number, tiltX: number, tiltY: number, pointerIdArg: number, pointerType: any, hwTimestampArg: number, isPrimary: boolean): void; @@ -12400,7 +13341,7 @@ declare var PointerEvent: { } interface PopStateEvent extends Event { - state: any; + readonly state: any; initPopStateEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, stateArg: any): void; } @@ -12410,8 +13351,8 @@ declare var PopStateEvent: { } interface Position { - coords: Coordinates; - timestamp: number; + readonly coords: Coordinates; + readonly timestamp: number; } declare var Position: { @@ -12420,24 +13361,24 @@ declare var Position: { } interface PositionError { - code: number; - message: string; + readonly code: number; + readonly message: string; toString(): string; - PERMISSION_DENIED: number; - POSITION_UNAVAILABLE: number; - TIMEOUT: number; + readonly PERMISSION_DENIED: number; + readonly POSITION_UNAVAILABLE: number; + readonly TIMEOUT: number; } declare var PositionError: { prototype: PositionError; new(): PositionError; - PERMISSION_DENIED: number; - POSITION_UNAVAILABLE: number; - TIMEOUT: number; + readonly PERMISSION_DENIED: number; + readonly POSITION_UNAVAILABLE: number; + readonly TIMEOUT: number; } interface ProcessingInstruction extends CharacterData { - target: string; + readonly target: string; } declare var ProcessingInstruction: { @@ -12446,9 +13387,9 @@ declare var ProcessingInstruction: { } interface ProgressEvent extends Event { - lengthComputable: boolean; - loaded: number; - total: number; + readonly lengthComputable: boolean; + readonly loaded: number; + readonly total: number; initProgressEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, lengthComputableArg: boolean, loadedArg: number, totalArg: number): void; } @@ -12457,13 +13398,210 @@ declare var ProgressEvent: { new(type: string, eventInitDict?: ProgressEventInit): ProgressEvent; } +interface RTCDTMFToneChangeEvent extends Event { + readonly tone: string; +} + +declare var RTCDTMFToneChangeEvent: { + prototype: RTCDTMFToneChangeEvent; + new(type: string, eventInitDict: RTCDTMFToneChangeEventInit): RTCDTMFToneChangeEvent; +} + +interface RTCDtlsTransport extends RTCStatsProvider { + ondtlsstatechange: ((ev: RTCDtlsTransportStateChangedEvent) => any) | null; + onerror: ((ev: Event) => any) | null; + readonly state: string; + readonly transport: RTCIceTransport; + getLocalParameters(): RTCDtlsParameters; + getRemoteCertificates(): ArrayBuffer[]; + getRemoteParameters(): RTCDtlsParameters | null; + start(remoteParameters: RTCDtlsParameters): void; + stop(): void; + addEventListener(type: "dtlsstatechange", listener: (ev: RTCDtlsTransportStateChangedEvent) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCDtlsTransport: { + prototype: RTCDtlsTransport; + new(transport: RTCIceTransport): RTCDtlsTransport; +} + +interface RTCDtlsTransportStateChangedEvent extends Event { + readonly state: string; +} + +declare var RTCDtlsTransportStateChangedEvent: { + prototype: RTCDtlsTransportStateChangedEvent; + new(): RTCDtlsTransportStateChangedEvent; +} + +interface RTCDtmfSender extends EventTarget { + readonly canInsertDTMF: boolean; + readonly duration: number; + readonly interToneGap: number; + ontonechange: (ev: RTCDTMFToneChangeEvent) => any; + readonly sender: RTCRtpSender; + readonly toneBuffer: string; + insertDTMF(tones: string, duration?: number, interToneGap?: number): void; + addEventListener(type: "tonechange", listener: (ev: RTCDTMFToneChangeEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCDtmfSender: { + prototype: RTCDtmfSender; + new(sender: RTCRtpSender): RTCDtmfSender; +} + +interface RTCIceCandidatePairChangedEvent extends Event { + readonly pair: RTCIceCandidatePair; +} + +declare var RTCIceCandidatePairChangedEvent: { + prototype: RTCIceCandidatePairChangedEvent; + new(): RTCIceCandidatePairChangedEvent; +} + +interface RTCIceGatherer extends RTCStatsProvider { + readonly component: string; + onerror: ((ev: Event) => any) | null; + onlocalcandidate: ((ev: RTCIceGathererEvent) => any) | null; + createAssociatedGatherer(): RTCIceGatherer; + getLocalCandidates(): RTCIceCandidate[]; + getLocalParameters(): RTCIceParameters; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "localcandidate", listener: (ev: RTCIceGathererEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCIceGatherer: { + prototype: RTCIceGatherer; + new(options: RTCIceGatherOptions): RTCIceGatherer; +} + +interface RTCIceGathererEvent extends Event { + readonly candidate: RTCIceCandidate | RTCIceCandidateComplete; +} + +declare var RTCIceGathererEvent: { + prototype: RTCIceGathererEvent; + new(): RTCIceGathererEvent; +} + +interface RTCIceTransport extends RTCStatsProvider { + readonly component: string; + readonly iceGatherer: RTCIceGatherer | null; + oncandidatepairchange: ((ev: RTCIceCandidatePairChangedEvent) => any) | null; + onicestatechange: ((ev: RTCIceTransportStateChangedEvent) => any) | null; + readonly role: string; + readonly state: string; + addRemoteCandidate(remoteCandidate: RTCIceCandidate | RTCIceCandidateComplete): void; + createAssociatedTransport(): RTCIceTransport; + getNominatedCandidatePair(): RTCIceCandidatePair | null; + getRemoteCandidates(): RTCIceCandidate[]; + getRemoteParameters(): RTCIceParameters | null; + setRemoteCandidates(remoteCandidates: RTCIceCandidate[]): void; + start(gatherer: RTCIceGatherer, remoteParameters: RTCIceParameters, role?: string): void; + stop(): void; + addEventListener(type: "candidatepairchange", listener: (ev: RTCIceCandidatePairChangedEvent) => any, useCapture?: boolean): void; + addEventListener(type: "icestatechange", listener: (ev: RTCIceTransportStateChangedEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCIceTransport: { + prototype: RTCIceTransport; + new(): RTCIceTransport; +} + +interface RTCIceTransportStateChangedEvent extends Event { + readonly state: string; +} + +declare var RTCIceTransportStateChangedEvent: { + prototype: RTCIceTransportStateChangedEvent; + new(): RTCIceTransportStateChangedEvent; +} + +interface RTCRtpReceiver extends RTCStatsProvider { + onerror: ((ev: Event) => any) | null; + readonly rtcpTransport: RTCDtlsTransport; + readonly track: MediaStreamTrack | null; + readonly transport: RTCDtlsTransport | RTCSrtpSdesTransport; + getContributingSources(): RTCRtpContributingSource[]; + receive(parameters: RTCRtpParameters): void; + requestSendCSRC(csrc: number): void; + setTransport(transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): void; + stop(): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCRtpReceiver: { + prototype: RTCRtpReceiver; + new(transport: RTCDtlsTransport | RTCSrtpSdesTransport, kind: string, rtcpTransport?: RTCDtlsTransport): RTCRtpReceiver; + getCapabilities(kind?: string): RTCRtpCapabilities; +} + +interface RTCRtpSender extends RTCStatsProvider { + onerror: ((ev: Event) => any) | null; + onssrcconflict: ((ev: RTCSsrcConflictEvent) => any) | null; + readonly rtcpTransport: RTCDtlsTransport; + readonly track: MediaStreamTrack; + readonly transport: RTCDtlsTransport | RTCSrtpSdesTransport; + send(parameters: RTCRtpParameters): void; + setTrack(track: MediaStreamTrack): void; + setTransport(transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): void; + stop(): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ssrcconflict", listener: (ev: RTCSsrcConflictEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCRtpSender: { + prototype: RTCRtpSender; + new(track: MediaStreamTrack, transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): RTCRtpSender; + getCapabilities(kind?: string): RTCRtpCapabilities; +} + +interface RTCSrtpSdesTransport extends EventTarget { + onerror: ((ev: Event) => any) | null; + readonly transport: RTCIceTransport; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCSrtpSdesTransport: { + prototype: RTCSrtpSdesTransport; + new(transport: RTCIceTransport, encryptParameters: RTCSrtpSdesParameters, decryptParameters: RTCSrtpSdesParameters): RTCSrtpSdesTransport; + getLocalParameters(): RTCSrtpSdesParameters[]; +} + +interface RTCSsrcConflictEvent extends Event { + readonly ssrc: number; +} + +declare var RTCSsrcConflictEvent: { + prototype: RTCSsrcConflictEvent; + new(): RTCSsrcConflictEvent; +} + +interface RTCStatsProvider extends EventTarget { + getStats(): PromiseLike; + msGetStats(): PromiseLike; +} + +declare var RTCStatsProvider: { + prototype: RTCStatsProvider; + new(): RTCStatsProvider; +} + interface Range { - collapsed: boolean; - commonAncestorContainer: Node; - endContainer: Node; - endOffset: number; - startContainer: Node; - startOffset: number; + readonly collapsed: boolean; + readonly commonAncestorContainer: Node; + readonly endContainer: Node; + readonly endOffset: number; + readonly startContainer: Node; + readonly startOffset: number; cloneContents(): DocumentFragment; cloneRange(): Range; collapse(toStart: boolean): void; @@ -12486,23 +13624,23 @@ interface Range { setStartBefore(refNode: Node): void; surroundContents(newParent: Node): void; toString(): string; - END_TO_END: number; - END_TO_START: number; - START_TO_END: number; - START_TO_START: number; + readonly END_TO_END: number; + readonly END_TO_START: number; + readonly START_TO_END: number; + readonly START_TO_START: number; } declare var Range: { prototype: Range; new(): Range; - END_TO_END: number; - END_TO_START: number; - START_TO_END: number; - START_TO_START: number; + readonly END_TO_END: number; + readonly END_TO_START: number; + readonly START_TO_END: number; + readonly START_TO_START: number; } interface SVGAElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference { - target: SVGAnimatedString; + readonly target: SVGAnimatedString; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -12512,32 +13650,32 @@ declare var SVGAElement: { } interface SVGAngle { - unitType: number; + readonly unitType: number; value: number; valueAsString: string; valueInSpecifiedUnits: number; convertToSpecifiedUnits(unitType: number): void; newValueSpecifiedUnits(unitType: number, valueInSpecifiedUnits: number): void; - SVG_ANGLETYPE_DEG: number; - SVG_ANGLETYPE_GRAD: number; - SVG_ANGLETYPE_RAD: number; - SVG_ANGLETYPE_UNKNOWN: number; - SVG_ANGLETYPE_UNSPECIFIED: number; + readonly SVG_ANGLETYPE_DEG: number; + readonly SVG_ANGLETYPE_GRAD: number; + readonly SVG_ANGLETYPE_RAD: number; + readonly SVG_ANGLETYPE_UNKNOWN: number; + readonly SVG_ANGLETYPE_UNSPECIFIED: number; } declare var SVGAngle: { prototype: SVGAngle; new(): SVGAngle; - SVG_ANGLETYPE_DEG: number; - SVG_ANGLETYPE_GRAD: number; - SVG_ANGLETYPE_RAD: number; - SVG_ANGLETYPE_UNKNOWN: number; - SVG_ANGLETYPE_UNSPECIFIED: number; + readonly SVG_ANGLETYPE_DEG: number; + readonly SVG_ANGLETYPE_GRAD: number; + readonly SVG_ANGLETYPE_RAD: number; + readonly SVG_ANGLETYPE_UNKNOWN: number; + readonly SVG_ANGLETYPE_UNSPECIFIED: number; } interface SVGAnimatedAngle { - animVal: SVGAngle; - baseVal: SVGAngle; + readonly animVal: SVGAngle; + readonly baseVal: SVGAngle; } declare var SVGAnimatedAngle: { @@ -12546,7 +13684,7 @@ declare var SVGAnimatedAngle: { } interface SVGAnimatedBoolean { - animVal: boolean; + readonly animVal: boolean; baseVal: boolean; } @@ -12556,7 +13694,7 @@ declare var SVGAnimatedBoolean: { } interface SVGAnimatedEnumeration { - animVal: number; + readonly animVal: number; baseVal: number; } @@ -12566,7 +13704,7 @@ declare var SVGAnimatedEnumeration: { } interface SVGAnimatedInteger { - animVal: number; + readonly animVal: number; baseVal: number; } @@ -12576,8 +13714,8 @@ declare var SVGAnimatedInteger: { } interface SVGAnimatedLength { - animVal: SVGLength; - baseVal: SVGLength; + readonly animVal: SVGLength; + readonly baseVal: SVGLength; } declare var SVGAnimatedLength: { @@ -12586,8 +13724,8 @@ declare var SVGAnimatedLength: { } interface SVGAnimatedLengthList { - animVal: SVGLengthList; - baseVal: SVGLengthList; + readonly animVal: SVGLengthList; + readonly baseVal: SVGLengthList; } declare var SVGAnimatedLengthList: { @@ -12596,7 +13734,7 @@ declare var SVGAnimatedLengthList: { } interface SVGAnimatedNumber { - animVal: number; + readonly animVal: number; baseVal: number; } @@ -12606,8 +13744,8 @@ declare var SVGAnimatedNumber: { } interface SVGAnimatedNumberList { - animVal: SVGNumberList; - baseVal: SVGNumberList; + readonly animVal: SVGNumberList; + readonly baseVal: SVGNumberList; } declare var SVGAnimatedNumberList: { @@ -12616,8 +13754,8 @@ declare var SVGAnimatedNumberList: { } interface SVGAnimatedPreserveAspectRatio { - animVal: SVGPreserveAspectRatio; - baseVal: SVGPreserveAspectRatio; + readonly animVal: SVGPreserveAspectRatio; + readonly baseVal: SVGPreserveAspectRatio; } declare var SVGAnimatedPreserveAspectRatio: { @@ -12626,8 +13764,8 @@ declare var SVGAnimatedPreserveAspectRatio: { } interface SVGAnimatedRect { - animVal: SVGRect; - baseVal: SVGRect; + readonly animVal: SVGRect; + readonly baseVal: SVGRect; } declare var SVGAnimatedRect: { @@ -12636,7 +13774,7 @@ declare var SVGAnimatedRect: { } interface SVGAnimatedString { - animVal: string; + readonly animVal: string; baseVal: string; } @@ -12646,8 +13784,8 @@ declare var SVGAnimatedString: { } interface SVGAnimatedTransformList { - animVal: SVGTransformList; - baseVal: SVGTransformList; + readonly animVal: SVGTransformList; + readonly baseVal: SVGTransformList; } declare var SVGAnimatedTransformList: { @@ -12656,9 +13794,9 @@ declare var SVGAnimatedTransformList: { } interface SVGCircleElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - cx: SVGAnimatedLength; - cy: SVGAnimatedLength; - r: SVGAnimatedLength; + readonly cx: SVGAnimatedLength; + readonly cy: SVGAnimatedLength; + readonly r: SVGAnimatedLength; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -12668,7 +13806,7 @@ declare var SVGCircleElement: { } interface SVGClipPathElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGUnitTypes { - clipPathUnits: SVGAnimatedEnumeration; + readonly clipPathUnits: SVGAnimatedEnumeration; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -12678,30 +13816,30 @@ declare var SVGClipPathElement: { } interface SVGComponentTransferFunctionElement extends SVGElement { - amplitude: SVGAnimatedNumber; - exponent: SVGAnimatedNumber; - intercept: SVGAnimatedNumber; - offset: SVGAnimatedNumber; - slope: SVGAnimatedNumber; - tableValues: SVGAnimatedNumberList; - type: SVGAnimatedEnumeration; - SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number; - SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number; - SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number; - SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number; - SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number; - SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number; + readonly amplitude: SVGAnimatedNumber; + readonly exponent: SVGAnimatedNumber; + readonly intercept: SVGAnimatedNumber; + readonly offset: SVGAnimatedNumber; + readonly slope: SVGAnimatedNumber; + readonly tableValues: SVGAnimatedNumberList; + readonly type: SVGAnimatedEnumeration; + readonly SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number; } declare var SVGComponentTransferFunctionElement: { prototype: SVGComponentTransferFunctionElement; new(): SVGComponentTransferFunctionElement; - SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number; - SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number; - SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number; - SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number; - SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number; - SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number; } interface SVGDefsElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { @@ -12723,7 +13861,6 @@ declare var SVGDescElement: { } interface SVGElement extends Element { - id: string; onclick: (ev: MouseEvent) => any; ondblclick: (ev: MouseEvent) => any; onfocusin: (ev: FocusEvent) => any; @@ -12734,8 +13871,8 @@ interface SVGElement extends Element { onmouseout: (ev: MouseEvent) => any; onmouseover: (ev: MouseEvent) => any; onmouseup: (ev: MouseEvent) => any; - ownerSVGElement: SVGSVGElement; - viewportElement: SVGElement; + readonly ownerSVGElement: SVGSVGElement; + readonly viewportElement: SVGElement; xmlbase: string; className: any; addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; @@ -12793,14 +13930,14 @@ declare var SVGElement: { } interface SVGElementInstance extends EventTarget { - childNodes: SVGElementInstanceList; - correspondingElement: SVGElement; - correspondingUseElement: SVGUseElement; - firstChild: SVGElementInstance; - lastChild: SVGElementInstance; - nextSibling: SVGElementInstance; - parentNode: SVGElementInstance; - previousSibling: SVGElementInstance; + readonly childNodes: SVGElementInstanceList; + readonly correspondingElement: SVGElement; + readonly correspondingUseElement: SVGUseElement; + readonly firstChild: SVGElementInstance; + readonly lastChild: SVGElementInstance; + readonly nextSibling: SVGElementInstance; + readonly parentNode: SVGElementInstance; + readonly previousSibling: SVGElementInstance; } declare var SVGElementInstance: { @@ -12809,7 +13946,7 @@ declare var SVGElementInstance: { } interface SVGElementInstanceList { - length: number; + readonly length: number; item(index: number): SVGElementInstance; } @@ -12819,10 +13956,10 @@ declare var SVGElementInstanceList: { } interface SVGEllipseElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - cx: SVGAnimatedLength; - cy: SVGAnimatedLength; - rx: SVGAnimatedLength; - ry: SVGAnimatedLength; + readonly cx: SVGAnimatedLength; + readonly cy: SVGAnimatedLength; + readonly rx: SVGAnimatedLength; + readonly ry: SVGAnimatedLength; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -12832,75 +13969,75 @@ declare var SVGEllipseElement: { } interface SVGFEBlendElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in1: SVGAnimatedString; - in2: SVGAnimatedString; - mode: SVGAnimatedEnumeration; - SVG_FEBLEND_MODE_COLOR: number; - SVG_FEBLEND_MODE_COLOR_BURN: number; - SVG_FEBLEND_MODE_COLOR_DODGE: number; - SVG_FEBLEND_MODE_DARKEN: number; - SVG_FEBLEND_MODE_DIFFERENCE: number; - SVG_FEBLEND_MODE_EXCLUSION: number; - SVG_FEBLEND_MODE_HARD_LIGHT: number; - SVG_FEBLEND_MODE_HUE: number; - SVG_FEBLEND_MODE_LIGHTEN: number; - SVG_FEBLEND_MODE_LUMINOSITY: number; - SVG_FEBLEND_MODE_MULTIPLY: number; - SVG_FEBLEND_MODE_NORMAL: number; - SVG_FEBLEND_MODE_OVERLAY: number; - SVG_FEBLEND_MODE_SATURATION: number; - SVG_FEBLEND_MODE_SCREEN: number; - SVG_FEBLEND_MODE_SOFT_LIGHT: number; - SVG_FEBLEND_MODE_UNKNOWN: number; + readonly in1: SVGAnimatedString; + readonly in2: SVGAnimatedString; + readonly mode: SVGAnimatedEnumeration; + readonly SVG_FEBLEND_MODE_COLOR: number; + readonly SVG_FEBLEND_MODE_COLOR_BURN: number; + readonly SVG_FEBLEND_MODE_COLOR_DODGE: number; + readonly SVG_FEBLEND_MODE_DARKEN: number; + readonly SVG_FEBLEND_MODE_DIFFERENCE: number; + readonly SVG_FEBLEND_MODE_EXCLUSION: number; + readonly SVG_FEBLEND_MODE_HARD_LIGHT: number; + readonly SVG_FEBLEND_MODE_HUE: number; + readonly SVG_FEBLEND_MODE_LIGHTEN: number; + readonly SVG_FEBLEND_MODE_LUMINOSITY: number; + readonly SVG_FEBLEND_MODE_MULTIPLY: number; + readonly SVG_FEBLEND_MODE_NORMAL: number; + readonly SVG_FEBLEND_MODE_OVERLAY: number; + readonly SVG_FEBLEND_MODE_SATURATION: number; + readonly SVG_FEBLEND_MODE_SCREEN: number; + readonly SVG_FEBLEND_MODE_SOFT_LIGHT: number; + readonly SVG_FEBLEND_MODE_UNKNOWN: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGFEBlendElement: { prototype: SVGFEBlendElement; new(): SVGFEBlendElement; - SVG_FEBLEND_MODE_COLOR: number; - SVG_FEBLEND_MODE_COLOR_BURN: number; - SVG_FEBLEND_MODE_COLOR_DODGE: number; - SVG_FEBLEND_MODE_DARKEN: number; - SVG_FEBLEND_MODE_DIFFERENCE: number; - SVG_FEBLEND_MODE_EXCLUSION: number; - SVG_FEBLEND_MODE_HARD_LIGHT: number; - SVG_FEBLEND_MODE_HUE: number; - SVG_FEBLEND_MODE_LIGHTEN: number; - SVG_FEBLEND_MODE_LUMINOSITY: number; - SVG_FEBLEND_MODE_MULTIPLY: number; - SVG_FEBLEND_MODE_NORMAL: number; - SVG_FEBLEND_MODE_OVERLAY: number; - SVG_FEBLEND_MODE_SATURATION: number; - SVG_FEBLEND_MODE_SCREEN: number; - SVG_FEBLEND_MODE_SOFT_LIGHT: number; - SVG_FEBLEND_MODE_UNKNOWN: number; + readonly SVG_FEBLEND_MODE_COLOR: number; + readonly SVG_FEBLEND_MODE_COLOR_BURN: number; + readonly SVG_FEBLEND_MODE_COLOR_DODGE: number; + readonly SVG_FEBLEND_MODE_DARKEN: number; + readonly SVG_FEBLEND_MODE_DIFFERENCE: number; + readonly SVG_FEBLEND_MODE_EXCLUSION: number; + readonly SVG_FEBLEND_MODE_HARD_LIGHT: number; + readonly SVG_FEBLEND_MODE_HUE: number; + readonly SVG_FEBLEND_MODE_LIGHTEN: number; + readonly SVG_FEBLEND_MODE_LUMINOSITY: number; + readonly SVG_FEBLEND_MODE_MULTIPLY: number; + readonly SVG_FEBLEND_MODE_NORMAL: number; + readonly SVG_FEBLEND_MODE_OVERLAY: number; + readonly SVG_FEBLEND_MODE_SATURATION: number; + readonly SVG_FEBLEND_MODE_SCREEN: number; + readonly SVG_FEBLEND_MODE_SOFT_LIGHT: number; + readonly SVG_FEBLEND_MODE_UNKNOWN: number; } interface SVGFEColorMatrixElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in1: SVGAnimatedString; - type: SVGAnimatedEnumeration; - values: SVGAnimatedNumberList; - SVG_FECOLORMATRIX_TYPE_HUEROTATE: number; - SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number; - SVG_FECOLORMATRIX_TYPE_MATRIX: number; - SVG_FECOLORMATRIX_TYPE_SATURATE: number; - SVG_FECOLORMATRIX_TYPE_UNKNOWN: number; + readonly in1: SVGAnimatedString; + readonly type: SVGAnimatedEnumeration; + readonly values: SVGAnimatedNumberList; + readonly SVG_FECOLORMATRIX_TYPE_HUEROTATE: number; + readonly SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number; + readonly SVG_FECOLORMATRIX_TYPE_MATRIX: number; + readonly SVG_FECOLORMATRIX_TYPE_SATURATE: number; + readonly SVG_FECOLORMATRIX_TYPE_UNKNOWN: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGFEColorMatrixElement: { prototype: SVGFEColorMatrixElement; new(): SVGFEColorMatrixElement; - SVG_FECOLORMATRIX_TYPE_HUEROTATE: number; - SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number; - SVG_FECOLORMATRIX_TYPE_MATRIX: number; - SVG_FECOLORMATRIX_TYPE_SATURATE: number; - SVG_FECOLORMATRIX_TYPE_UNKNOWN: number; + readonly SVG_FECOLORMATRIX_TYPE_HUEROTATE: number; + readonly SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number; + readonly SVG_FECOLORMATRIX_TYPE_MATRIX: number; + readonly SVG_FECOLORMATRIX_TYPE_SATURATE: number; + readonly SVG_FECOLORMATRIX_TYPE_UNKNOWN: number; } interface SVGFEComponentTransferElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in1: SVGAnimatedString; + readonly in1: SVGAnimatedString; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -12910,70 +14047,70 @@ declare var SVGFEComponentTransferElement: { } interface SVGFECompositeElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in1: SVGAnimatedString; - in2: SVGAnimatedString; - k1: SVGAnimatedNumber; - k2: SVGAnimatedNumber; - k3: SVGAnimatedNumber; - k4: SVGAnimatedNumber; - operator: SVGAnimatedEnumeration; - SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number; - SVG_FECOMPOSITE_OPERATOR_ATOP: number; - SVG_FECOMPOSITE_OPERATOR_IN: number; - SVG_FECOMPOSITE_OPERATOR_OUT: number; - SVG_FECOMPOSITE_OPERATOR_OVER: number; - SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number; - SVG_FECOMPOSITE_OPERATOR_XOR: number; + readonly in1: SVGAnimatedString; + readonly in2: SVGAnimatedString; + readonly k1: SVGAnimatedNumber; + readonly k2: SVGAnimatedNumber; + readonly k3: SVGAnimatedNumber; + readonly k4: SVGAnimatedNumber; + readonly operator: SVGAnimatedEnumeration; + readonly SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number; + readonly SVG_FECOMPOSITE_OPERATOR_ATOP: number; + readonly SVG_FECOMPOSITE_OPERATOR_IN: number; + readonly SVG_FECOMPOSITE_OPERATOR_OUT: number; + readonly SVG_FECOMPOSITE_OPERATOR_OVER: number; + readonly SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number; + readonly SVG_FECOMPOSITE_OPERATOR_XOR: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGFECompositeElement: { prototype: SVGFECompositeElement; new(): SVGFECompositeElement; - SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number; - SVG_FECOMPOSITE_OPERATOR_ATOP: number; - SVG_FECOMPOSITE_OPERATOR_IN: number; - SVG_FECOMPOSITE_OPERATOR_OUT: number; - SVG_FECOMPOSITE_OPERATOR_OVER: number; - SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number; - SVG_FECOMPOSITE_OPERATOR_XOR: number; + readonly SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number; + readonly SVG_FECOMPOSITE_OPERATOR_ATOP: number; + readonly SVG_FECOMPOSITE_OPERATOR_IN: number; + readonly SVG_FECOMPOSITE_OPERATOR_OUT: number; + readonly SVG_FECOMPOSITE_OPERATOR_OVER: number; + readonly SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number; + readonly SVG_FECOMPOSITE_OPERATOR_XOR: number; } interface SVGFEConvolveMatrixElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - bias: SVGAnimatedNumber; - divisor: SVGAnimatedNumber; - edgeMode: SVGAnimatedEnumeration; - in1: SVGAnimatedString; - kernelMatrix: SVGAnimatedNumberList; - kernelUnitLengthX: SVGAnimatedNumber; - kernelUnitLengthY: SVGAnimatedNumber; - orderX: SVGAnimatedInteger; - orderY: SVGAnimatedInteger; - preserveAlpha: SVGAnimatedBoolean; - targetX: SVGAnimatedInteger; - targetY: SVGAnimatedInteger; - SVG_EDGEMODE_DUPLICATE: number; - SVG_EDGEMODE_NONE: number; - SVG_EDGEMODE_UNKNOWN: number; - SVG_EDGEMODE_WRAP: number; + readonly bias: SVGAnimatedNumber; + readonly divisor: SVGAnimatedNumber; + readonly edgeMode: SVGAnimatedEnumeration; + readonly in1: SVGAnimatedString; + readonly kernelMatrix: SVGAnimatedNumberList; + readonly kernelUnitLengthX: SVGAnimatedNumber; + readonly kernelUnitLengthY: SVGAnimatedNumber; + readonly orderX: SVGAnimatedInteger; + readonly orderY: SVGAnimatedInteger; + readonly preserveAlpha: SVGAnimatedBoolean; + readonly targetX: SVGAnimatedInteger; + readonly targetY: SVGAnimatedInteger; + readonly SVG_EDGEMODE_DUPLICATE: number; + readonly SVG_EDGEMODE_NONE: number; + readonly SVG_EDGEMODE_UNKNOWN: number; + readonly SVG_EDGEMODE_WRAP: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGFEConvolveMatrixElement: { prototype: SVGFEConvolveMatrixElement; new(): SVGFEConvolveMatrixElement; - SVG_EDGEMODE_DUPLICATE: number; - SVG_EDGEMODE_NONE: number; - SVG_EDGEMODE_UNKNOWN: number; - SVG_EDGEMODE_WRAP: number; + readonly SVG_EDGEMODE_DUPLICATE: number; + readonly SVG_EDGEMODE_NONE: number; + readonly SVG_EDGEMODE_UNKNOWN: number; + readonly SVG_EDGEMODE_WRAP: number; } interface SVGFEDiffuseLightingElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - diffuseConstant: SVGAnimatedNumber; - in1: SVGAnimatedString; - kernelUnitLengthX: SVGAnimatedNumber; - kernelUnitLengthY: SVGAnimatedNumber; - surfaceScale: SVGAnimatedNumber; + readonly diffuseConstant: SVGAnimatedNumber; + readonly in1: SVGAnimatedString; + readonly kernelUnitLengthX: SVGAnimatedNumber; + readonly kernelUnitLengthY: SVGAnimatedNumber; + readonly surfaceScale: SVGAnimatedNumber; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -12983,32 +14120,32 @@ declare var SVGFEDiffuseLightingElement: { } interface SVGFEDisplacementMapElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in1: SVGAnimatedString; - in2: SVGAnimatedString; - scale: SVGAnimatedNumber; - xChannelSelector: SVGAnimatedEnumeration; - yChannelSelector: SVGAnimatedEnumeration; - SVG_CHANNEL_A: number; - SVG_CHANNEL_B: number; - SVG_CHANNEL_G: number; - SVG_CHANNEL_R: number; - SVG_CHANNEL_UNKNOWN: number; + readonly in1: SVGAnimatedString; + readonly in2: SVGAnimatedString; + readonly scale: SVGAnimatedNumber; + readonly xChannelSelector: SVGAnimatedEnumeration; + readonly yChannelSelector: SVGAnimatedEnumeration; + readonly SVG_CHANNEL_A: number; + readonly SVG_CHANNEL_B: number; + readonly SVG_CHANNEL_G: number; + readonly SVG_CHANNEL_R: number; + readonly SVG_CHANNEL_UNKNOWN: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGFEDisplacementMapElement: { prototype: SVGFEDisplacementMapElement; new(): SVGFEDisplacementMapElement; - SVG_CHANNEL_A: number; - SVG_CHANNEL_B: number; - SVG_CHANNEL_G: number; - SVG_CHANNEL_R: number; - SVG_CHANNEL_UNKNOWN: number; + readonly SVG_CHANNEL_A: number; + readonly SVG_CHANNEL_B: number; + readonly SVG_CHANNEL_G: number; + readonly SVG_CHANNEL_R: number; + readonly SVG_CHANNEL_UNKNOWN: number; } interface SVGFEDistantLightElement extends SVGElement { - azimuth: SVGAnimatedNumber; - elevation: SVGAnimatedNumber; + readonly azimuth: SVGAnimatedNumber; + readonly elevation: SVGAnimatedNumber; } declare var SVGFEDistantLightElement: { @@ -13058,9 +14195,9 @@ declare var SVGFEFuncRElement: { } interface SVGFEGaussianBlurElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in1: SVGAnimatedString; - stdDeviationX: SVGAnimatedNumber; - stdDeviationY: SVGAnimatedNumber; + readonly in1: SVGAnimatedString; + readonly stdDeviationX: SVGAnimatedNumber; + readonly stdDeviationY: SVGAnimatedNumber; setStdDeviation(stdDeviationX: number, stdDeviationY: number): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -13071,7 +14208,7 @@ declare var SVGFEGaussianBlurElement: { } interface SVGFEImageElement extends SVGElement, SVGFilterPrimitiveStandardAttributes, SVGLangSpace, SVGURIReference, SVGExternalResourcesRequired { - preserveAspectRatio: SVGAnimatedPreserveAspectRatio; + readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -13090,7 +14227,7 @@ declare var SVGFEMergeElement: { } interface SVGFEMergeNodeElement extends SVGElement { - in1: SVGAnimatedString; + readonly in1: SVGAnimatedString; } declare var SVGFEMergeNodeElement: { @@ -13099,28 +14236,28 @@ declare var SVGFEMergeNodeElement: { } interface SVGFEMorphologyElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in1: SVGAnimatedString; - operator: SVGAnimatedEnumeration; - radiusX: SVGAnimatedNumber; - radiusY: SVGAnimatedNumber; - SVG_MORPHOLOGY_OPERATOR_DILATE: number; - SVG_MORPHOLOGY_OPERATOR_ERODE: number; - SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number; + readonly in1: SVGAnimatedString; + readonly operator: SVGAnimatedEnumeration; + readonly radiusX: SVGAnimatedNumber; + readonly radiusY: SVGAnimatedNumber; + readonly SVG_MORPHOLOGY_OPERATOR_DILATE: number; + readonly SVG_MORPHOLOGY_OPERATOR_ERODE: number; + readonly SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGFEMorphologyElement: { prototype: SVGFEMorphologyElement; new(): SVGFEMorphologyElement; - SVG_MORPHOLOGY_OPERATOR_DILATE: number; - SVG_MORPHOLOGY_OPERATOR_ERODE: number; - SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number; + readonly SVG_MORPHOLOGY_OPERATOR_DILATE: number; + readonly SVG_MORPHOLOGY_OPERATOR_ERODE: number; + readonly SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number; } interface SVGFEOffsetElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - dx: SVGAnimatedNumber; - dy: SVGAnimatedNumber; - in1: SVGAnimatedString; + readonly dx: SVGAnimatedNumber; + readonly dy: SVGAnimatedNumber; + readonly in1: SVGAnimatedString; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -13130,9 +14267,9 @@ declare var SVGFEOffsetElement: { } interface SVGFEPointLightElement extends SVGElement { - x: SVGAnimatedNumber; - y: SVGAnimatedNumber; - z: SVGAnimatedNumber; + readonly x: SVGAnimatedNumber; + readonly y: SVGAnimatedNumber; + readonly z: SVGAnimatedNumber; } declare var SVGFEPointLightElement: { @@ -13141,12 +14278,12 @@ declare var SVGFEPointLightElement: { } interface SVGFESpecularLightingElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in1: SVGAnimatedString; - kernelUnitLengthX: SVGAnimatedNumber; - kernelUnitLengthY: SVGAnimatedNumber; - specularConstant: SVGAnimatedNumber; - specularExponent: SVGAnimatedNumber; - surfaceScale: SVGAnimatedNumber; + readonly in1: SVGAnimatedString; + readonly kernelUnitLengthX: SVGAnimatedNumber; + readonly kernelUnitLengthY: SVGAnimatedNumber; + readonly specularConstant: SVGAnimatedNumber; + readonly specularExponent: SVGAnimatedNumber; + readonly surfaceScale: SVGAnimatedNumber; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -13156,14 +14293,14 @@ declare var SVGFESpecularLightingElement: { } interface SVGFESpotLightElement extends SVGElement { - limitingConeAngle: SVGAnimatedNumber; - pointsAtX: SVGAnimatedNumber; - pointsAtY: SVGAnimatedNumber; - pointsAtZ: SVGAnimatedNumber; - specularExponent: SVGAnimatedNumber; - x: SVGAnimatedNumber; - y: SVGAnimatedNumber; - z: SVGAnimatedNumber; + readonly limitingConeAngle: SVGAnimatedNumber; + readonly pointsAtX: SVGAnimatedNumber; + readonly pointsAtY: SVGAnimatedNumber; + readonly pointsAtZ: SVGAnimatedNumber; + readonly specularExponent: SVGAnimatedNumber; + readonly x: SVGAnimatedNumber; + readonly y: SVGAnimatedNumber; + readonly z: SVGAnimatedNumber; } declare var SVGFESpotLightElement: { @@ -13172,7 +14309,7 @@ declare var SVGFESpotLightElement: { } interface SVGFETileElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in1: SVGAnimatedString; + readonly in1: SVGAnimatedString; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -13182,41 +14319,41 @@ declare var SVGFETileElement: { } interface SVGFETurbulenceElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - baseFrequencyX: SVGAnimatedNumber; - baseFrequencyY: SVGAnimatedNumber; - numOctaves: SVGAnimatedInteger; - seed: SVGAnimatedNumber; - stitchTiles: SVGAnimatedEnumeration; - type: SVGAnimatedEnumeration; - SVG_STITCHTYPE_NOSTITCH: number; - SVG_STITCHTYPE_STITCH: number; - SVG_STITCHTYPE_UNKNOWN: number; - SVG_TURBULENCE_TYPE_FRACTALNOISE: number; - SVG_TURBULENCE_TYPE_TURBULENCE: number; - SVG_TURBULENCE_TYPE_UNKNOWN: number; + readonly baseFrequencyX: SVGAnimatedNumber; + readonly baseFrequencyY: SVGAnimatedNumber; + readonly numOctaves: SVGAnimatedInteger; + readonly seed: SVGAnimatedNumber; + readonly stitchTiles: SVGAnimatedEnumeration; + readonly type: SVGAnimatedEnumeration; + readonly SVG_STITCHTYPE_NOSTITCH: number; + readonly SVG_STITCHTYPE_STITCH: number; + readonly SVG_STITCHTYPE_UNKNOWN: number; + readonly SVG_TURBULENCE_TYPE_FRACTALNOISE: number; + readonly SVG_TURBULENCE_TYPE_TURBULENCE: number; + readonly SVG_TURBULENCE_TYPE_UNKNOWN: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGFETurbulenceElement: { prototype: SVGFETurbulenceElement; new(): SVGFETurbulenceElement; - SVG_STITCHTYPE_NOSTITCH: number; - SVG_STITCHTYPE_STITCH: number; - SVG_STITCHTYPE_UNKNOWN: number; - SVG_TURBULENCE_TYPE_FRACTALNOISE: number; - SVG_TURBULENCE_TYPE_TURBULENCE: number; - SVG_TURBULENCE_TYPE_UNKNOWN: number; + readonly SVG_STITCHTYPE_NOSTITCH: number; + readonly SVG_STITCHTYPE_STITCH: number; + readonly SVG_STITCHTYPE_UNKNOWN: number; + readonly SVG_TURBULENCE_TYPE_FRACTALNOISE: number; + readonly SVG_TURBULENCE_TYPE_TURBULENCE: number; + readonly SVG_TURBULENCE_TYPE_UNKNOWN: number; } interface SVGFilterElement extends SVGElement, SVGUnitTypes, SVGStylable, SVGLangSpace, SVGURIReference, SVGExternalResourcesRequired { - filterResX: SVGAnimatedInteger; - filterResY: SVGAnimatedInteger; - filterUnits: SVGAnimatedEnumeration; - height: SVGAnimatedLength; - primitiveUnits: SVGAnimatedEnumeration; - width: SVGAnimatedLength; - x: SVGAnimatedLength; - y: SVGAnimatedLength; + readonly filterResX: SVGAnimatedInteger; + readonly filterResY: SVGAnimatedInteger; + readonly filterUnits: SVGAnimatedEnumeration; + readonly height: SVGAnimatedLength; + readonly primitiveUnits: SVGAnimatedEnumeration; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; setFilterRes(filterResX: number, filterResY: number): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -13227,10 +14364,10 @@ declare var SVGFilterElement: { } interface SVGForeignObjectElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - height: SVGAnimatedLength; - width: SVGAnimatedLength; - x: SVGAnimatedLength; - y: SVGAnimatedLength; + readonly height: SVGAnimatedLength; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -13249,31 +14386,31 @@ declare var SVGGElement: { } interface SVGGradientElement extends SVGElement, SVGStylable, SVGExternalResourcesRequired, SVGURIReference, SVGUnitTypes { - gradientTransform: SVGAnimatedTransformList; - gradientUnits: SVGAnimatedEnumeration; - spreadMethod: SVGAnimatedEnumeration; - SVG_SPREADMETHOD_PAD: number; - SVG_SPREADMETHOD_REFLECT: number; - SVG_SPREADMETHOD_REPEAT: number; - SVG_SPREADMETHOD_UNKNOWN: number; + readonly gradientTransform: SVGAnimatedTransformList; + readonly gradientUnits: SVGAnimatedEnumeration; + readonly spreadMethod: SVGAnimatedEnumeration; + readonly SVG_SPREADMETHOD_PAD: number; + readonly SVG_SPREADMETHOD_REFLECT: number; + readonly SVG_SPREADMETHOD_REPEAT: number; + readonly SVG_SPREADMETHOD_UNKNOWN: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGGradientElement: { prototype: SVGGradientElement; new(): SVGGradientElement; - SVG_SPREADMETHOD_PAD: number; - SVG_SPREADMETHOD_REFLECT: number; - SVG_SPREADMETHOD_REPEAT: number; - SVG_SPREADMETHOD_UNKNOWN: number; + readonly SVG_SPREADMETHOD_PAD: number; + readonly SVG_SPREADMETHOD_REFLECT: number; + readonly SVG_SPREADMETHOD_REPEAT: number; + readonly SVG_SPREADMETHOD_UNKNOWN: number; } interface SVGImageElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference { - height: SVGAnimatedLength; - preserveAspectRatio: SVGAnimatedPreserveAspectRatio; - width: SVGAnimatedLength; - x: SVGAnimatedLength; - y: SVGAnimatedLength; + readonly height: SVGAnimatedLength; + readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -13283,43 +14420,43 @@ declare var SVGImageElement: { } interface SVGLength { - unitType: number; + readonly unitType: number; value: number; valueAsString: string; valueInSpecifiedUnits: number; convertToSpecifiedUnits(unitType: number): void; newValueSpecifiedUnits(unitType: number, valueInSpecifiedUnits: number): void; - SVG_LENGTHTYPE_CM: number; - SVG_LENGTHTYPE_EMS: number; - SVG_LENGTHTYPE_EXS: number; - SVG_LENGTHTYPE_IN: number; - SVG_LENGTHTYPE_MM: number; - SVG_LENGTHTYPE_NUMBER: number; - SVG_LENGTHTYPE_PC: number; - SVG_LENGTHTYPE_PERCENTAGE: number; - SVG_LENGTHTYPE_PT: number; - SVG_LENGTHTYPE_PX: number; - SVG_LENGTHTYPE_UNKNOWN: number; + readonly SVG_LENGTHTYPE_CM: number; + readonly SVG_LENGTHTYPE_EMS: number; + readonly SVG_LENGTHTYPE_EXS: number; + readonly SVG_LENGTHTYPE_IN: number; + readonly SVG_LENGTHTYPE_MM: number; + readonly SVG_LENGTHTYPE_NUMBER: number; + readonly SVG_LENGTHTYPE_PC: number; + readonly SVG_LENGTHTYPE_PERCENTAGE: number; + readonly SVG_LENGTHTYPE_PT: number; + readonly SVG_LENGTHTYPE_PX: number; + readonly SVG_LENGTHTYPE_UNKNOWN: number; } declare var SVGLength: { prototype: SVGLength; new(): SVGLength; - SVG_LENGTHTYPE_CM: number; - SVG_LENGTHTYPE_EMS: number; - SVG_LENGTHTYPE_EXS: number; - SVG_LENGTHTYPE_IN: number; - SVG_LENGTHTYPE_MM: number; - SVG_LENGTHTYPE_NUMBER: number; - SVG_LENGTHTYPE_PC: number; - SVG_LENGTHTYPE_PERCENTAGE: number; - SVG_LENGTHTYPE_PT: number; - SVG_LENGTHTYPE_PX: number; - SVG_LENGTHTYPE_UNKNOWN: number; + readonly SVG_LENGTHTYPE_CM: number; + readonly SVG_LENGTHTYPE_EMS: number; + readonly SVG_LENGTHTYPE_EXS: number; + readonly SVG_LENGTHTYPE_IN: number; + readonly SVG_LENGTHTYPE_MM: number; + readonly SVG_LENGTHTYPE_NUMBER: number; + readonly SVG_LENGTHTYPE_PC: number; + readonly SVG_LENGTHTYPE_PERCENTAGE: number; + readonly SVG_LENGTHTYPE_PT: number; + readonly SVG_LENGTHTYPE_PX: number; + readonly SVG_LENGTHTYPE_UNKNOWN: number; } interface SVGLengthList { - numberOfItems: number; + readonly numberOfItems: number; appendItem(newItem: SVGLength): SVGLength; clear(): void; getItem(index: number): SVGLength; @@ -13335,10 +14472,10 @@ declare var SVGLengthList: { } interface SVGLineElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - x1: SVGAnimatedLength; - x2: SVGAnimatedLength; - y1: SVGAnimatedLength; - y2: SVGAnimatedLength; + readonly x1: SVGAnimatedLength; + readonly x2: SVGAnimatedLength; + readonly y1: SVGAnimatedLength; + readonly y2: SVGAnimatedLength; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -13348,10 +14485,10 @@ declare var SVGLineElement: { } interface SVGLinearGradientElement extends SVGGradientElement { - x1: SVGAnimatedLength; - x2: SVGAnimatedLength; - y1: SVGAnimatedLength; - y2: SVGAnimatedLength; + readonly x1: SVGAnimatedLength; + readonly x2: SVGAnimatedLength; + readonly y1: SVGAnimatedLength; + readonly y2: SVGAnimatedLength; } declare var SVGLinearGradientElement: { @@ -13360,42 +14497,42 @@ declare var SVGLinearGradientElement: { } interface SVGMarkerElement extends SVGElement, SVGStylable, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox { - markerHeight: SVGAnimatedLength; - markerUnits: SVGAnimatedEnumeration; - markerWidth: SVGAnimatedLength; - orientAngle: SVGAnimatedAngle; - orientType: SVGAnimatedEnumeration; - refX: SVGAnimatedLength; - refY: SVGAnimatedLength; + readonly markerHeight: SVGAnimatedLength; + readonly markerUnits: SVGAnimatedEnumeration; + readonly markerWidth: SVGAnimatedLength; + readonly orientAngle: SVGAnimatedAngle; + readonly orientType: SVGAnimatedEnumeration; + readonly refX: SVGAnimatedLength; + readonly refY: SVGAnimatedLength; setOrientToAngle(angle: SVGAngle): void; setOrientToAuto(): void; - SVG_MARKERUNITS_STROKEWIDTH: number; - SVG_MARKERUNITS_UNKNOWN: number; - SVG_MARKERUNITS_USERSPACEONUSE: number; - SVG_MARKER_ORIENT_ANGLE: number; - SVG_MARKER_ORIENT_AUTO: number; - SVG_MARKER_ORIENT_UNKNOWN: number; + readonly SVG_MARKERUNITS_STROKEWIDTH: number; + readonly SVG_MARKERUNITS_UNKNOWN: number; + readonly SVG_MARKERUNITS_USERSPACEONUSE: number; + readonly SVG_MARKER_ORIENT_ANGLE: number; + readonly SVG_MARKER_ORIENT_AUTO: number; + readonly SVG_MARKER_ORIENT_UNKNOWN: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGMarkerElement: { prototype: SVGMarkerElement; new(): SVGMarkerElement; - SVG_MARKERUNITS_STROKEWIDTH: number; - SVG_MARKERUNITS_UNKNOWN: number; - SVG_MARKERUNITS_USERSPACEONUSE: number; - SVG_MARKER_ORIENT_ANGLE: number; - SVG_MARKER_ORIENT_AUTO: number; - SVG_MARKER_ORIENT_UNKNOWN: number; + readonly SVG_MARKERUNITS_STROKEWIDTH: number; + readonly SVG_MARKERUNITS_UNKNOWN: number; + readonly SVG_MARKERUNITS_USERSPACEONUSE: number; + readonly SVG_MARKER_ORIENT_ANGLE: number; + readonly SVG_MARKER_ORIENT_AUTO: number; + readonly SVG_MARKER_ORIENT_UNKNOWN: number; } interface SVGMaskElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGUnitTypes { - height: SVGAnimatedLength; - maskContentUnits: SVGAnimatedEnumeration; - maskUnits: SVGAnimatedEnumeration; - width: SVGAnimatedLength; - x: SVGAnimatedLength; - y: SVGAnimatedLength; + readonly height: SVGAnimatedLength; + readonly maskContentUnits: SVGAnimatedEnumeration; + readonly maskUnits: SVGAnimatedEnumeration; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -13447,7 +14584,7 @@ declare var SVGNumber: { } interface SVGNumberList { - numberOfItems: number; + readonly numberOfItems: number; appendItem(newItem: SVGNumber): SVGNumber; clear(): void; getItem(index: number): SVGNumber; @@ -13494,53 +14631,53 @@ declare var SVGPathElement: { } interface SVGPathSeg { - pathSegType: number; - pathSegTypeAsLetter: string; - PATHSEG_ARC_ABS: number; - PATHSEG_ARC_REL: number; - PATHSEG_CLOSEPATH: number; - PATHSEG_CURVETO_CUBIC_ABS: number; - PATHSEG_CURVETO_CUBIC_REL: number; - PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number; - PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number; - PATHSEG_CURVETO_QUADRATIC_ABS: number; - PATHSEG_CURVETO_QUADRATIC_REL: number; - PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number; - PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number; - PATHSEG_LINETO_ABS: number; - PATHSEG_LINETO_HORIZONTAL_ABS: number; - PATHSEG_LINETO_HORIZONTAL_REL: number; - PATHSEG_LINETO_REL: number; - PATHSEG_LINETO_VERTICAL_ABS: number; - PATHSEG_LINETO_VERTICAL_REL: number; - PATHSEG_MOVETO_ABS: number; - PATHSEG_MOVETO_REL: number; - PATHSEG_UNKNOWN: number; + readonly pathSegType: number; + readonly pathSegTypeAsLetter: string; + readonly PATHSEG_ARC_ABS: number; + readonly PATHSEG_ARC_REL: number; + readonly PATHSEG_CLOSEPATH: number; + readonly PATHSEG_CURVETO_CUBIC_ABS: number; + readonly PATHSEG_CURVETO_CUBIC_REL: number; + readonly PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number; + readonly PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number; + readonly PATHSEG_CURVETO_QUADRATIC_ABS: number; + readonly PATHSEG_CURVETO_QUADRATIC_REL: number; + readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number; + readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number; + readonly PATHSEG_LINETO_ABS: number; + readonly PATHSEG_LINETO_HORIZONTAL_ABS: number; + readonly PATHSEG_LINETO_HORIZONTAL_REL: number; + readonly PATHSEG_LINETO_REL: number; + readonly PATHSEG_LINETO_VERTICAL_ABS: number; + readonly PATHSEG_LINETO_VERTICAL_REL: number; + readonly PATHSEG_MOVETO_ABS: number; + readonly PATHSEG_MOVETO_REL: number; + readonly PATHSEG_UNKNOWN: number; } declare var SVGPathSeg: { prototype: SVGPathSeg; new(): SVGPathSeg; - PATHSEG_ARC_ABS: number; - PATHSEG_ARC_REL: number; - PATHSEG_CLOSEPATH: number; - PATHSEG_CURVETO_CUBIC_ABS: number; - PATHSEG_CURVETO_CUBIC_REL: number; - PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number; - PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number; - PATHSEG_CURVETO_QUADRATIC_ABS: number; - PATHSEG_CURVETO_QUADRATIC_REL: number; - PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number; - PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number; - PATHSEG_LINETO_ABS: number; - PATHSEG_LINETO_HORIZONTAL_ABS: number; - PATHSEG_LINETO_HORIZONTAL_REL: number; - PATHSEG_LINETO_REL: number; - PATHSEG_LINETO_VERTICAL_ABS: number; - PATHSEG_LINETO_VERTICAL_REL: number; - PATHSEG_MOVETO_ABS: number; - PATHSEG_MOVETO_REL: number; - PATHSEG_UNKNOWN: number; + readonly PATHSEG_ARC_ABS: number; + readonly PATHSEG_ARC_REL: number; + readonly PATHSEG_CLOSEPATH: number; + readonly PATHSEG_CURVETO_CUBIC_ABS: number; + readonly PATHSEG_CURVETO_CUBIC_REL: number; + readonly PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number; + readonly PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number; + readonly PATHSEG_CURVETO_QUADRATIC_ABS: number; + readonly PATHSEG_CURVETO_QUADRATIC_REL: number; + readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number; + readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number; + readonly PATHSEG_LINETO_ABS: number; + readonly PATHSEG_LINETO_HORIZONTAL_ABS: number; + readonly PATHSEG_LINETO_HORIZONTAL_REL: number; + readonly PATHSEG_LINETO_REL: number; + readonly PATHSEG_LINETO_VERTICAL_ABS: number; + readonly PATHSEG_LINETO_VERTICAL_REL: number; + readonly PATHSEG_MOVETO_ABS: number; + readonly PATHSEG_MOVETO_REL: number; + readonly PATHSEG_UNKNOWN: number; } interface SVGPathSegArcAbs extends SVGPathSeg { @@ -13734,7 +14871,7 @@ declare var SVGPathSegLinetoVerticalRel: { } interface SVGPathSegList { - numberOfItems: number; + readonly numberOfItems: number; appendItem(newItem: SVGPathSeg): SVGPathSeg; clear(): void; getItem(index: number): SVGPathSeg; @@ -13770,13 +14907,13 @@ declare var SVGPathSegMovetoRel: { } interface SVGPatternElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox, SVGURIReference, SVGUnitTypes { - height: SVGAnimatedLength; - patternContentUnits: SVGAnimatedEnumeration; - patternTransform: SVGAnimatedTransformList; - patternUnits: SVGAnimatedEnumeration; - width: SVGAnimatedLength; - x: SVGAnimatedLength; - y: SVGAnimatedLength; + readonly height: SVGAnimatedLength; + readonly patternContentUnits: SVGAnimatedEnumeration; + readonly patternTransform: SVGAnimatedTransformList; + readonly patternUnits: SVGAnimatedEnumeration; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -13797,7 +14934,7 @@ declare var SVGPoint: { } interface SVGPointList { - numberOfItems: number; + readonly numberOfItems: number; appendItem(newItem: SVGPoint): SVGPoint; clear(): void; getItem(index: number): SVGPoint; @@ -13833,47 +14970,47 @@ declare var SVGPolylineElement: { interface SVGPreserveAspectRatio { align: number; meetOrSlice: number; - SVG_MEETORSLICE_MEET: number; - SVG_MEETORSLICE_SLICE: number; - SVG_MEETORSLICE_UNKNOWN: number; - SVG_PRESERVEASPECTRATIO_NONE: number; - SVG_PRESERVEASPECTRATIO_UNKNOWN: number; - SVG_PRESERVEASPECTRATIO_XMAXYMAX: number; - SVG_PRESERVEASPECTRATIO_XMAXYMID: number; - SVG_PRESERVEASPECTRATIO_XMAXYMIN: number; - SVG_PRESERVEASPECTRATIO_XMIDYMAX: number; - SVG_PRESERVEASPECTRATIO_XMIDYMID: number; - SVG_PRESERVEASPECTRATIO_XMIDYMIN: number; - SVG_PRESERVEASPECTRATIO_XMINYMAX: number; - SVG_PRESERVEASPECTRATIO_XMINYMID: number; - SVG_PRESERVEASPECTRATIO_XMINYMIN: number; + readonly SVG_MEETORSLICE_MEET: number; + readonly SVG_MEETORSLICE_SLICE: number; + readonly SVG_MEETORSLICE_UNKNOWN: number; + readonly SVG_PRESERVEASPECTRATIO_NONE: number; + readonly SVG_PRESERVEASPECTRATIO_UNKNOWN: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMIN: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMIN: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMIN: number; } declare var SVGPreserveAspectRatio: { prototype: SVGPreserveAspectRatio; new(): SVGPreserveAspectRatio; - SVG_MEETORSLICE_MEET: number; - SVG_MEETORSLICE_SLICE: number; - SVG_MEETORSLICE_UNKNOWN: number; - SVG_PRESERVEASPECTRATIO_NONE: number; - SVG_PRESERVEASPECTRATIO_UNKNOWN: number; - SVG_PRESERVEASPECTRATIO_XMAXYMAX: number; - SVG_PRESERVEASPECTRATIO_XMAXYMID: number; - SVG_PRESERVEASPECTRATIO_XMAXYMIN: number; - SVG_PRESERVEASPECTRATIO_XMIDYMAX: number; - SVG_PRESERVEASPECTRATIO_XMIDYMID: number; - SVG_PRESERVEASPECTRATIO_XMIDYMIN: number; - SVG_PRESERVEASPECTRATIO_XMINYMAX: number; - SVG_PRESERVEASPECTRATIO_XMINYMID: number; - SVG_PRESERVEASPECTRATIO_XMINYMIN: number; + readonly SVG_MEETORSLICE_MEET: number; + readonly SVG_MEETORSLICE_SLICE: number; + readonly SVG_MEETORSLICE_UNKNOWN: number; + readonly SVG_PRESERVEASPECTRATIO_NONE: number; + readonly SVG_PRESERVEASPECTRATIO_UNKNOWN: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMIN: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMIN: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMIN: number; } interface SVGRadialGradientElement extends SVGGradientElement { - cx: SVGAnimatedLength; - cy: SVGAnimatedLength; - fx: SVGAnimatedLength; - fy: SVGAnimatedLength; - r: SVGAnimatedLength; + readonly cx: SVGAnimatedLength; + readonly cy: SVGAnimatedLength; + readonly fx: SVGAnimatedLength; + readonly fy: SVGAnimatedLength; + readonly r: SVGAnimatedLength; } declare var SVGRadialGradientElement: { @@ -13894,12 +15031,12 @@ declare var SVGRect: { } interface SVGRectElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - height: SVGAnimatedLength; - rx: SVGAnimatedLength; - ry: SVGAnimatedLength; - width: SVGAnimatedLength; - x: SVGAnimatedLength; - y: SVGAnimatedLength; + readonly height: SVGAnimatedLength; + readonly rx: SVGAnimatedLength; + readonly ry: SVGAnimatedLength; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -13912,22 +15049,22 @@ interface SVGSVGElement extends SVGElement, DocumentEvent, SVGLocatable, SVGTest contentScriptType: string; contentStyleType: string; currentScale: number; - currentTranslate: SVGPoint; - height: SVGAnimatedLength; + readonly currentTranslate: SVGPoint; + readonly height: SVGAnimatedLength; onabort: (ev: Event) => any; onerror: (ev: Event) => any; onresize: (ev: UIEvent) => any; onscroll: (ev: UIEvent) => any; onunload: (ev: Event) => any; onzoom: (ev: SVGZoomEvent) => any; - pixelUnitToMillimeterX: number; - pixelUnitToMillimeterY: number; - screenPixelToMillimeterX: number; - screenPixelToMillimeterY: number; - viewport: SVGRect; - width: SVGAnimatedLength; - x: SVGAnimatedLength; - y: SVGAnimatedLength; + readonly pixelUnitToMillimeterX: number; + readonly pixelUnitToMillimeterY: number; + readonly screenPixelToMillimeterX: number; + readonly screenPixelToMillimeterY: number; + readonly viewport: SVGRect; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; checkEnclosure(element: SVGElement, rect: SVGRect): boolean; checkIntersection(element: SVGElement, rect: SVGRect): boolean; createSVGAngle(): SVGAngle; @@ -13943,8 +15080,8 @@ interface SVGSVGElement extends SVGElement, DocumentEvent, SVGLocatable, SVGTest getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration; getCurrentTime(): number; getElementById(elementId: string): Element; - getEnclosureList(rect: SVGRect, referenceElement: SVGElement): NodeList; - getIntersectionList(rect: SVGRect, referenceElement: SVGElement): NodeList; + getEnclosureList(rect: SVGRect, referenceElement: SVGElement): NodeListOf; + getIntersectionList(rect: SVGRect, referenceElement: SVGElement): NodeListOf; pauseAnimations(): void; setCurrentTime(seconds: number): void; suspendRedraw(maxWaitMilliseconds: number): number; @@ -14022,7 +15159,7 @@ declare var SVGScriptElement: { } interface SVGStopElement extends SVGElement, SVGStylable { - offset: SVGAnimatedNumber; + readonly offset: SVGAnimatedNumber; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -14032,7 +15169,7 @@ declare var SVGStopElement: { } interface SVGStringList { - numberOfItems: number; + readonly numberOfItems: number; appendItem(newItem: string): string; clear(): void; getItem(index: number): string; @@ -14048,6 +15185,7 @@ declare var SVGStringList: { } interface SVGStyleElement extends SVGElement, SVGLangSpace { + disabled: boolean; media: string; title: string; type: string; @@ -14086,8 +15224,8 @@ declare var SVGTSpanElement: { } interface SVGTextContentElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - lengthAdjust: SVGAnimatedEnumeration; - textLength: SVGAnimatedLength; + readonly lengthAdjust: SVGAnimatedEnumeration; + readonly textLength: SVGAnimatedLength; getCharNumAtPosition(point: SVGPoint): number; getComputedTextLength(): number; getEndPositionOfChar(charnum: number): SVGPoint; @@ -14097,18 +15235,18 @@ interface SVGTextContentElement extends SVGElement, SVGStylable, SVGTests, SVGLa getStartPositionOfChar(charnum: number): SVGPoint; getSubStringLength(charnum: number, nchars: number): number; selectSubString(charnum: number, nchars: number): void; - LENGTHADJUST_SPACING: number; - LENGTHADJUST_SPACINGANDGLYPHS: number; - LENGTHADJUST_UNKNOWN: number; + readonly LENGTHADJUST_SPACING: number; + readonly LENGTHADJUST_SPACINGANDGLYPHS: number; + readonly LENGTHADJUST_UNKNOWN: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGTextContentElement: { prototype: SVGTextContentElement; new(): SVGTextContentElement; - LENGTHADJUST_SPACING: number; - LENGTHADJUST_SPACINGANDGLYPHS: number; - LENGTHADJUST_UNKNOWN: number; + readonly LENGTHADJUST_SPACING: number; + readonly LENGTHADJUST_SPACINGANDGLYPHS: number; + readonly LENGTHADJUST_UNKNOWN: number; } interface SVGTextElement extends SVGTextPositioningElement, SVGTransformable { @@ -14121,35 +15259,35 @@ declare var SVGTextElement: { } interface SVGTextPathElement extends SVGTextContentElement, SVGURIReference { - method: SVGAnimatedEnumeration; - spacing: SVGAnimatedEnumeration; - startOffset: SVGAnimatedLength; - TEXTPATH_METHODTYPE_ALIGN: number; - TEXTPATH_METHODTYPE_STRETCH: number; - TEXTPATH_METHODTYPE_UNKNOWN: number; - TEXTPATH_SPACINGTYPE_AUTO: number; - TEXTPATH_SPACINGTYPE_EXACT: number; - TEXTPATH_SPACINGTYPE_UNKNOWN: number; + readonly method: SVGAnimatedEnumeration; + readonly spacing: SVGAnimatedEnumeration; + readonly startOffset: SVGAnimatedLength; + readonly TEXTPATH_METHODTYPE_ALIGN: number; + readonly TEXTPATH_METHODTYPE_STRETCH: number; + readonly TEXTPATH_METHODTYPE_UNKNOWN: number; + readonly TEXTPATH_SPACINGTYPE_AUTO: number; + readonly TEXTPATH_SPACINGTYPE_EXACT: number; + readonly TEXTPATH_SPACINGTYPE_UNKNOWN: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGTextPathElement: { prototype: SVGTextPathElement; new(): SVGTextPathElement; - TEXTPATH_METHODTYPE_ALIGN: number; - TEXTPATH_METHODTYPE_STRETCH: number; - TEXTPATH_METHODTYPE_UNKNOWN: number; - TEXTPATH_SPACINGTYPE_AUTO: number; - TEXTPATH_SPACINGTYPE_EXACT: number; - TEXTPATH_SPACINGTYPE_UNKNOWN: number; + readonly TEXTPATH_METHODTYPE_ALIGN: number; + readonly TEXTPATH_METHODTYPE_STRETCH: number; + readonly TEXTPATH_METHODTYPE_UNKNOWN: number; + readonly TEXTPATH_SPACINGTYPE_AUTO: number; + readonly TEXTPATH_SPACINGTYPE_EXACT: number; + readonly TEXTPATH_SPACINGTYPE_UNKNOWN: number; } interface SVGTextPositioningElement extends SVGTextContentElement { - dx: SVGAnimatedLengthList; - dy: SVGAnimatedLengthList; - rotate: SVGAnimatedNumberList; - x: SVGAnimatedLengthList; - y: SVGAnimatedLengthList; + readonly dx: SVGAnimatedLengthList; + readonly dy: SVGAnimatedLengthList; + readonly rotate: SVGAnimatedNumberList; + readonly x: SVGAnimatedLengthList; + readonly y: SVGAnimatedLengthList; } declare var SVGTextPositioningElement: { @@ -14167,38 +15305,38 @@ declare var SVGTitleElement: { } interface SVGTransform { - angle: number; - matrix: SVGMatrix; - type: number; + readonly angle: number; + readonly matrix: SVGMatrix; + readonly type: number; setMatrix(matrix: SVGMatrix): void; setRotate(angle: number, cx: number, cy: number): void; setScale(sx: number, sy: number): void; setSkewX(angle: number): void; setSkewY(angle: number): void; setTranslate(tx: number, ty: number): void; - SVG_TRANSFORM_MATRIX: number; - SVG_TRANSFORM_ROTATE: number; - SVG_TRANSFORM_SCALE: number; - SVG_TRANSFORM_SKEWX: number; - SVG_TRANSFORM_SKEWY: number; - SVG_TRANSFORM_TRANSLATE: number; - SVG_TRANSFORM_UNKNOWN: number; + readonly SVG_TRANSFORM_MATRIX: number; + readonly SVG_TRANSFORM_ROTATE: number; + readonly SVG_TRANSFORM_SCALE: number; + readonly SVG_TRANSFORM_SKEWX: number; + readonly SVG_TRANSFORM_SKEWY: number; + readonly SVG_TRANSFORM_TRANSLATE: number; + readonly SVG_TRANSFORM_UNKNOWN: number; } declare var SVGTransform: { prototype: SVGTransform; new(): SVGTransform; - SVG_TRANSFORM_MATRIX: number; - SVG_TRANSFORM_ROTATE: number; - SVG_TRANSFORM_SCALE: number; - SVG_TRANSFORM_SKEWX: number; - SVG_TRANSFORM_SKEWY: number; - SVG_TRANSFORM_TRANSLATE: number; - SVG_TRANSFORM_UNKNOWN: number; + readonly SVG_TRANSFORM_MATRIX: number; + readonly SVG_TRANSFORM_ROTATE: number; + readonly SVG_TRANSFORM_SCALE: number; + readonly SVG_TRANSFORM_SKEWX: number; + readonly SVG_TRANSFORM_SKEWY: number; + readonly SVG_TRANSFORM_TRANSLATE: number; + readonly SVG_TRANSFORM_UNKNOWN: number; } interface SVGTransformList { - numberOfItems: number; + readonly numberOfItems: number; appendItem(newItem: SVGTransform): SVGTransform; clear(): void; consolidate(): SVGTransform; @@ -14216,19 +15354,19 @@ declare var SVGTransformList: { } interface SVGUnitTypes { - SVG_UNIT_TYPE_OBJECTBOUNDINGBOX: number; - SVG_UNIT_TYPE_UNKNOWN: number; - SVG_UNIT_TYPE_USERSPACEONUSE: number; + readonly SVG_UNIT_TYPE_OBJECTBOUNDINGBOX: number; + readonly SVG_UNIT_TYPE_UNKNOWN: number; + readonly SVG_UNIT_TYPE_USERSPACEONUSE: number; } declare var SVGUnitTypes: SVGUnitTypes; interface SVGUseElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference { - animatedInstanceRoot: SVGElementInstance; - height: SVGAnimatedLength; - instanceRoot: SVGElementInstance; - width: SVGAnimatedLength; - x: SVGAnimatedLength; - y: SVGAnimatedLength; + readonly animatedInstanceRoot: SVGElementInstance; + readonly height: SVGAnimatedLength; + readonly instanceRoot: SVGElementInstance; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -14238,7 +15376,7 @@ declare var SVGUseElement: { } interface SVGViewElement extends SVGElement, SVGExternalResourcesRequired, SVGFitToViewBox, SVGZoomAndPan { - viewTarget: SVGStringList; + readonly viewTarget: SVGStringList; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -14248,18 +15386,21 @@ declare var SVGViewElement: { } interface SVGZoomAndPan { - SVG_ZOOMANDPAN_DISABLE: number; - SVG_ZOOMANDPAN_MAGNIFY: number; - SVG_ZOOMANDPAN_UNKNOWN: number; + readonly zoomAndPan: number; +} + +declare var SVGZoomAndPan: { + readonly SVG_ZOOMANDPAN_DISABLE: number; + readonly SVG_ZOOMANDPAN_MAGNIFY: number; + readonly SVG_ZOOMANDPAN_UNKNOWN: number; } -declare var SVGZoomAndPan: SVGZoomAndPan; interface SVGZoomEvent extends UIEvent { - newScale: number; - newTranslate: SVGPoint; - previousScale: number; - previousTranslate: SVGPoint; - zoomRectScreen: SVGRect; + readonly newScale: number; + readonly newTranslate: SVGPoint; + readonly previousScale: number; + readonly previousTranslate: SVGPoint; + readonly zoomRectScreen: SVGRect; } declare var SVGZoomEvent: { @@ -14268,22 +15409,22 @@ declare var SVGZoomEvent: { } interface Screen extends EventTarget { - availHeight: number; - availWidth: number; + readonly availHeight: number; + readonly availWidth: number; bufferDepth: number; - colorDepth: number; - deviceXDPI: number; - deviceYDPI: number; - fontSmoothingEnabled: boolean; - height: number; - logicalXDPI: number; - logicalYDPI: number; - msOrientation: string; + readonly colorDepth: number; + readonly deviceXDPI: number; + readonly deviceYDPI: number; + readonly fontSmoothingEnabled: boolean; + readonly height: number; + readonly logicalXDPI: number; + readonly logicalYDPI: number; + readonly msOrientation: string; onmsorientationchange: (ev: Event) => any; - pixelDepth: number; - systemXDPI: number; - systemYDPI: number; - width: number; + readonly pixelDepth: number; + readonly systemXDPI: number; + readonly systemYDPI: number; + readonly width: number; msLockOrientation(orientations: string | string[]): boolean; msUnlockOrientation(): void; addEventListener(type: "MSOrientationChange", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -14296,8 +15437,8 @@ declare var Screen: { } interface ScriptNotifyEvent extends Event { - callingUri: string; - value: string; + readonly callingUri: string; + readonly value: string; } declare var ScriptNotifyEvent: { @@ -14306,7 +15447,7 @@ declare var ScriptNotifyEvent: { } interface ScriptProcessorNode extends AudioNode { - bufferSize: number; + readonly bufferSize: number; onaudioprocess: (ev: AudioProcessingEvent) => any; addEventListener(type: "audioprocess", listener: (ev: AudioProcessingEvent) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; @@ -14318,13 +15459,13 @@ declare var ScriptProcessorNode: { } interface Selection { - anchorNode: Node; - anchorOffset: number; - focusNode: Node; - focusOffset: number; - isCollapsed: boolean; - rangeCount: number; - type: string; + readonly anchorNode: Node; + readonly anchorOffset: number; + readonly focusNode: Node; + readonly focusOffset: number; + readonly isCollapsed: boolean; + readonly rangeCount: number; + readonly type: string; addRange(range: Range): void; collapse(parentNode: Node, offset: number): void; collapseToEnd(): void; @@ -14349,12 +15490,12 @@ declare var Selection: { interface SourceBuffer extends EventTarget { appendWindowEnd: number; appendWindowStart: number; - audioTracks: AudioTrackList; - buffered: TimeRanges; + readonly audioTracks: AudioTrackList; + readonly buffered: TimeRanges; mode: string; timestampOffset: number; - updating: boolean; - videoTracks: VideoTrackList; + readonly updating: boolean; + readonly videoTracks: VideoTrackList; abort(): void; appendBuffer(data: ArrayBuffer | ArrayBufferView): void; appendStream(stream: MSStream, maxSize?: number): void; @@ -14367,7 +15508,7 @@ declare var SourceBuffer: { } interface SourceBufferList extends EventTarget { - length: number; + readonly length: number; item(index: number): SourceBuffer; [index: number]: SourceBuffer; } @@ -14378,7 +15519,7 @@ declare var SourceBufferList: { } interface StereoPannerNode extends AudioNode { - pan: AudioParam; + readonly pan: AudioParam; } declare var StereoPannerNode: { @@ -14387,9 +15528,9 @@ declare var StereoPannerNode: { } interface Storage { - length: number; + readonly length: number; clear(): void; - getItem(key: string): any; + getItem(key: string): string; key(index: number): string; removeItem(key: string): void; setItem(key: string, data: string): void; @@ -14403,21 +15544,20 @@ declare var Storage: { } interface StorageEvent extends Event { - key: string; - newValue: any; - oldValue: any; - storageArea: Storage; - url: string; - initStorageEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, keyArg: string, oldValueArg: any, newValueArg: any, urlArg: string, storageAreaArg: Storage): void; + readonly url: string; + key?: string; + oldValue?: string; + newValue?: string; + storageArea?: Storage; } declare var StorageEvent: { prototype: StorageEvent; - new(): StorageEvent; + new (type: string, eventInitDict?: StorageEventInit): StorageEvent; } interface StyleMedia { - type: string; + readonly type: string; matchMedium(mediaquery: string): boolean; } @@ -14428,12 +15568,12 @@ declare var StyleMedia: { interface StyleSheet { disabled: boolean; - href: string; - media: MediaList; - ownerNode: Node; - parentStyleSheet: StyleSheet; - title: string; - type: string; + readonly href: string; + readonly media: MediaList; + readonly ownerNode: Node; + readonly parentStyleSheet: StyleSheet; + readonly title: string; + readonly type: string; } declare var StyleSheet: { @@ -14442,7 +15582,7 @@ declare var StyleSheet: { } interface StyleSheetList { - length: number; + readonly length: number; item(index?: number): StyleSheet; [index: number]: StyleSheet; } @@ -14453,7 +15593,7 @@ declare var StyleSheetList: { } interface StyleSheetPageList { - length: number; + readonly length: number; item(index: number): CSSPageRule; [index: number]: CSSPageRule; } @@ -14464,18 +15604,18 @@ declare var StyleSheetPageList: { } interface SubtleCrypto { - decrypt(algorithm: string | Algorithm, key: CryptoKey, data: ArrayBufferView): any; - deriveBits(algorithm: string | Algorithm, baseKey: CryptoKey, length: number): any; - deriveKey(algorithm: string | Algorithm, baseKey: CryptoKey, derivedKeyType: string | Algorithm, extractable: boolean, keyUsages: string[]): any; - digest(algorithm: string | Algorithm, data: ArrayBufferView): any; - encrypt(algorithm: string | Algorithm, key: CryptoKey, data: ArrayBufferView): any; - exportKey(format: string, key: CryptoKey): any; - generateKey(algorithm: string | Algorithm, extractable: boolean, keyUsages: string[]): any; - importKey(format: string, keyData: ArrayBufferView, algorithm: string | Algorithm, extractable: boolean, keyUsages: string[]): any; - sign(algorithm: string | Algorithm, key: CryptoKey, data: ArrayBufferView): any; - unwrapKey(format: string, wrappedKey: ArrayBufferView, unwrappingKey: CryptoKey, unwrapAlgorithm: string | Algorithm, unwrappedKeyAlgorithm: string | Algorithm, extractable: boolean, keyUsages: string[]): any; - verify(algorithm: string | Algorithm, key: CryptoKey, signature: ArrayBufferView, data: ArrayBufferView): any; - wrapKey(format: string, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: string | Algorithm): any; + decrypt(algorithm: string | Algorithm, key: CryptoKey, data: ArrayBufferView): PromiseLike; + deriveBits(algorithm: string | Algorithm, baseKey: CryptoKey, length: number): PromiseLike; + deriveKey(algorithm: string | Algorithm, baseKey: CryptoKey, derivedKeyType: string | Algorithm, extractable: boolean, keyUsages: string[]): PromiseLike; + digest(algorithm: string | Algorithm, data: ArrayBufferView): PromiseLike; + encrypt(algorithm: string | Algorithm, key: CryptoKey, data: ArrayBufferView): PromiseLike; + exportKey(format: string, key: CryptoKey): PromiseLike; + generateKey(algorithm: string | Algorithm, extractable: boolean, keyUsages: string[]): PromiseLike; + importKey(format: string, keyData: ArrayBufferView, algorithm: string | Algorithm | null, extractable: boolean, keyUsages: string[]): PromiseLike; + sign(algorithm: string | Algorithm, key: CryptoKey, data: ArrayBufferView): PromiseLike; + unwrapKey(format: string, wrappedKey: ArrayBufferView, unwrappingKey: CryptoKey, unwrapAlgorithm: string | Algorithm, unwrappedKeyAlgorithm: string | Algorithm | null, extractable: boolean, keyUsages: string[]): PromiseLike; + verify(algorithm: string | Algorithm, key: CryptoKey, signature: ArrayBufferView, data: ArrayBufferView): PromiseLike; + wrapKey(format: string, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: string | Algorithm): PromiseLike; } declare var SubtleCrypto: { @@ -14484,8 +15624,7 @@ declare var SubtleCrypto: { } interface Text extends CharacterData { - wholeText: string; - replaceWholeText(content: string): Text; + readonly wholeText: string; splitText(offset: number): Text; } @@ -14495,39 +15634,39 @@ declare var Text: { } interface TextEvent extends UIEvent { - data: string; - inputMethod: number; - locale: string; + readonly data: string; + readonly inputMethod: number; + readonly locale: string; initTextEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, dataArg: string, inputMethod: number, locale: string): void; - DOM_INPUT_METHOD_DROP: number; - DOM_INPUT_METHOD_HANDWRITING: number; - DOM_INPUT_METHOD_IME: number; - DOM_INPUT_METHOD_KEYBOARD: number; - DOM_INPUT_METHOD_MULTIMODAL: number; - DOM_INPUT_METHOD_OPTION: number; - DOM_INPUT_METHOD_PASTE: number; - DOM_INPUT_METHOD_SCRIPT: number; - DOM_INPUT_METHOD_UNKNOWN: number; - DOM_INPUT_METHOD_VOICE: number; + readonly DOM_INPUT_METHOD_DROP: number; + readonly DOM_INPUT_METHOD_HANDWRITING: number; + readonly DOM_INPUT_METHOD_IME: number; + readonly DOM_INPUT_METHOD_KEYBOARD: number; + readonly DOM_INPUT_METHOD_MULTIMODAL: number; + readonly DOM_INPUT_METHOD_OPTION: number; + readonly DOM_INPUT_METHOD_PASTE: number; + readonly DOM_INPUT_METHOD_SCRIPT: number; + readonly DOM_INPUT_METHOD_UNKNOWN: number; + readonly DOM_INPUT_METHOD_VOICE: number; } declare var TextEvent: { prototype: TextEvent; new(): TextEvent; - DOM_INPUT_METHOD_DROP: number; - DOM_INPUT_METHOD_HANDWRITING: number; - DOM_INPUT_METHOD_IME: number; - DOM_INPUT_METHOD_KEYBOARD: number; - DOM_INPUT_METHOD_MULTIMODAL: number; - DOM_INPUT_METHOD_OPTION: number; - DOM_INPUT_METHOD_PASTE: number; - DOM_INPUT_METHOD_SCRIPT: number; - DOM_INPUT_METHOD_UNKNOWN: number; - DOM_INPUT_METHOD_VOICE: number; + readonly DOM_INPUT_METHOD_DROP: number; + readonly DOM_INPUT_METHOD_HANDWRITING: number; + readonly DOM_INPUT_METHOD_IME: number; + readonly DOM_INPUT_METHOD_KEYBOARD: number; + readonly DOM_INPUT_METHOD_MULTIMODAL: number; + readonly DOM_INPUT_METHOD_OPTION: number; + readonly DOM_INPUT_METHOD_PASTE: number; + readonly DOM_INPUT_METHOD_SCRIPT: number; + readonly DOM_INPUT_METHOD_UNKNOWN: number; + readonly DOM_INPUT_METHOD_VOICE: number; } interface TextMetrics { - width: number; + readonly width: number; } declare var TextMetrics: { @@ -14535,83 +15674,27 @@ declare var TextMetrics: { new(): TextMetrics; } -interface TextRange { - boundingHeight: number; - boundingLeft: number; - boundingTop: number; - boundingWidth: number; - htmlText: string; - offsetLeft: number; - offsetTop: number; - text: string; - collapse(start?: boolean): void; - compareEndPoints(how: string, sourceRange: TextRange): number; - duplicate(): TextRange; - execCommand(cmdID: string, showUI?: boolean, value?: any): boolean; - execCommandShowHelp(cmdID: string): boolean; - expand(Unit: string): boolean; - findText(string: string, count?: number, flags?: number): boolean; - getBookmark(): string; - getBoundingClientRect(): ClientRect; - getClientRects(): ClientRectList; - inRange(range: TextRange): boolean; - isEqual(range: TextRange): boolean; - move(unit: string, count?: number): number; - moveEnd(unit: string, count?: number): number; - moveStart(unit: string, count?: number): number; - moveToBookmark(bookmark: string): boolean; - moveToElementText(element: Element): void; - moveToPoint(x: number, y: number): void; - parentElement(): Element; - pasteHTML(html: string): void; - queryCommandEnabled(cmdID: string): boolean; - queryCommandIndeterm(cmdID: string): boolean; - queryCommandState(cmdID: string): boolean; - queryCommandSupported(cmdID: string): boolean; - queryCommandText(cmdID: string): string; - queryCommandValue(cmdID: string): any; - scrollIntoView(fStart?: boolean): void; - select(): void; - setEndPoint(how: string, SourceRange: TextRange): void; -} - -declare var TextRange: { - prototype: TextRange; - new(): TextRange; -} - -interface TextRangeCollection { - length: number; - item(index: number): TextRange; - [index: number]: TextRange; -} - -declare var TextRangeCollection: { - prototype: TextRangeCollection; - new(): TextRangeCollection; -} - interface TextTrack extends EventTarget { - activeCues: TextTrackCueList; - cues: TextTrackCueList; - inBandMetadataTrackDispatchType: string; - kind: string; - label: string; - language: string; + readonly activeCues: TextTrackCueList; + readonly cues: TextTrackCueList; + readonly inBandMetadataTrackDispatchType: string; + readonly kind: string; + readonly label: string; + readonly language: string; mode: any; oncuechange: (ev: Event) => any; onerror: (ev: Event) => any; onload: (ev: Event) => any; - readyState: number; + readonly readyState: number; addCue(cue: TextTrackCue): void; removeCue(cue: TextTrackCue): void; - DISABLED: number; - ERROR: number; - HIDDEN: number; - LOADED: number; - LOADING: number; - NONE: number; - SHOWING: number; + readonly DISABLED: number; + readonly ERROR: number; + readonly HIDDEN: number; + readonly LOADED: number; + readonly LOADING: number; + readonly NONE: number; + readonly SHOWING: number; addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -14621,13 +15704,13 @@ interface TextTrack extends EventTarget { declare var TextTrack: { prototype: TextTrack; new(): TextTrack; - DISABLED: number; - ERROR: number; - HIDDEN: number; - LOADED: number; - LOADING: number; - NONE: number; - SHOWING: number; + readonly DISABLED: number; + readonly ERROR: number; + readonly HIDDEN: number; + readonly LOADED: number; + readonly LOADING: number; + readonly NONE: number; + readonly SHOWING: number; } interface TextTrackCue extends EventTarget { @@ -14638,7 +15721,7 @@ interface TextTrackCue extends EventTarget { pauseOnExit: boolean; startTime: number; text: string; - track: TextTrack; + readonly track: TextTrack; getCueAsHTML(): DocumentFragment; addEventListener(type: "enter", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "exit", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -14651,7 +15734,7 @@ declare var TextTrackCue: { } interface TextTrackCueList { - length: number; + readonly length: number; getCueById(id: string): TextTrackCue; item(index: number): TextTrackCue; [index: number]: TextTrackCue; @@ -14663,8 +15746,8 @@ declare var TextTrackCueList: { } interface TextTrackList extends EventTarget { - length: number; - onaddtrack: (ev: TrackEvent) => any; + readonly length: number; + onaddtrack: ((ev: TrackEvent) => any) | null; item(index: number): TextTrack; addEventListener(type: "addtrack", listener: (ev: TrackEvent) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; @@ -14677,7 +15760,7 @@ declare var TextTrackList: { } interface TimeRanges { - length: number; + readonly length: number; end(index: number): number; start(index: number): number; } @@ -14688,14 +15771,14 @@ declare var TimeRanges: { } interface Touch { - clientX: number; - clientY: number; - identifier: number; - pageX: number; - pageY: number; - screenX: number; - screenY: number; - target: EventTarget; + readonly clientX: number; + readonly clientY: number; + readonly identifier: number; + readonly pageX: number; + readonly pageY: number; + readonly screenX: number; + readonly screenY: number; + readonly target: EventTarget; } declare var Touch: { @@ -14704,13 +15787,13 @@ declare var Touch: { } interface TouchEvent extends UIEvent { - altKey: boolean; - changedTouches: TouchList; - ctrlKey: boolean; - metaKey: boolean; - shiftKey: boolean; - targetTouches: TouchList; - touches: TouchList; + readonly altKey: boolean; + readonly changedTouches: TouchList; + readonly ctrlKey: boolean; + readonly metaKey: boolean; + readonly shiftKey: boolean; + readonly targetTouches: TouchList; + readonly touches: TouchList; } declare var TouchEvent: { @@ -14719,8 +15802,8 @@ declare var TouchEvent: { } interface TouchList { - length: number; - item(index: number): Touch; + readonly length: number; + item(index: number): Touch | null; [index: number]: Touch; } @@ -14730,7 +15813,7 @@ declare var TouchList: { } interface TrackEvent extends Event { - track: any; + readonly track: any; } declare var TrackEvent: { @@ -14739,8 +15822,8 @@ declare var TrackEvent: { } interface TransitionEvent extends Event { - elapsedTime: number; - propertyName: string; + readonly elapsedTime: number; + readonly propertyName: string; initTransitionEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, propertyNameArg: string, elapsedTimeArg: number): void; } @@ -14751,10 +15834,10 @@ declare var TransitionEvent: { interface TreeWalker { currentNode: Node; - expandEntityReferences: boolean; - filter: NodeFilter; - root: Node; - whatToShow: number; + readonly expandEntityReferences: boolean; + readonly filter: NodeFilter; + readonly root: Node; + readonly whatToShow: number; firstChild(): Node; lastChild(): Node; nextNode(): Node; @@ -14770,8 +15853,8 @@ declare var TreeWalker: { } interface UIEvent extends Event { - detail: number; - view: Window; + readonly detail: number; + readonly view: Window; initUIEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number): void; } @@ -14781,13 +15864,29 @@ declare var UIEvent: { } interface URL { + hash: string; + host: string; + hostname: string; + href: string; + readonly origin: string; + password: string; + pathname: string; + port: string; + protocol: string; + search: string; + username: string; + toString(): string; +} + +declare var URL: { + prototype: URL; + new(url: string, base?: string): URL; createObjectURL(object: any, options?: ObjectURLOptions): string; revokeObjectURL(url: string): void; } -declare var URL: URL; interface UnviewableContentIdentifiedEvent extends NavigationEventWithReferrer { - mediaType: string; + readonly mediaType: string; } declare var UnviewableContentIdentifiedEvent: { @@ -14796,16 +15895,16 @@ declare var UnviewableContentIdentifiedEvent: { } interface ValidityState { - badInput: boolean; - customError: boolean; - patternMismatch: boolean; - rangeOverflow: boolean; - rangeUnderflow: boolean; - stepMismatch: boolean; - tooLong: boolean; - typeMismatch: boolean; - valid: boolean; - valueMissing: boolean; + readonly badInput: boolean; + readonly customError: boolean; + readonly patternMismatch: boolean; + readonly rangeOverflow: boolean; + readonly rangeUnderflow: boolean; + readonly stepMismatch: boolean; + readonly tooLong: boolean; + readonly typeMismatch: boolean; + readonly valid: boolean; + readonly valueMissing: boolean; } declare var ValidityState: { @@ -14814,11 +15913,11 @@ declare var ValidityState: { } interface VideoPlaybackQuality { - corruptedVideoFrames: number; - creationTime: number; - droppedVideoFrames: number; - totalFrameDelay: number; - totalVideoFrames: number; + readonly corruptedVideoFrames: number; + readonly creationTime: number; + readonly droppedVideoFrames: number; + readonly totalFrameDelay: number; + readonly totalVideoFrames: number; } declare var VideoPlaybackQuality: { @@ -14827,12 +15926,12 @@ declare var VideoPlaybackQuality: { } interface VideoTrack { - id: string; + readonly id: string; kind: string; - label: string; + readonly label: string; language: string; selected: boolean; - sourceBuffer: SourceBuffer; + readonly sourceBuffer: SourceBuffer; } declare var VideoTrack: { @@ -14841,12 +15940,12 @@ declare var VideoTrack: { } interface VideoTrackList extends EventTarget { - length: number; + readonly length: number; onaddtrack: (ev: TrackEvent) => any; onchange: (ev: Event) => any; onremovetrack: (ev: TrackEvent) => any; - selectedIndex: number; - getTrackById(id: string): VideoTrack; + readonly selectedIndex: number; + getTrackById(id: string): VideoTrack | null; item(index: number): VideoTrack; addEventListener(type: "addtrack", listener: (ev: TrackEvent) => any, useCapture?: boolean): void; addEventListener(type: "change", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -14861,45 +15960,45 @@ declare var VideoTrackList: { } interface WEBGL_compressed_texture_s3tc { - COMPRESSED_RGBA_S3TC_DXT1_EXT: number; - COMPRESSED_RGBA_S3TC_DXT3_EXT: number; - COMPRESSED_RGBA_S3TC_DXT5_EXT: number; - COMPRESSED_RGB_S3TC_DXT1_EXT: number; + readonly COMPRESSED_RGBA_S3TC_DXT1_EXT: number; + readonly COMPRESSED_RGBA_S3TC_DXT3_EXT: number; + readonly COMPRESSED_RGBA_S3TC_DXT5_EXT: number; + readonly COMPRESSED_RGB_S3TC_DXT1_EXT: number; } declare var WEBGL_compressed_texture_s3tc: { prototype: WEBGL_compressed_texture_s3tc; new(): WEBGL_compressed_texture_s3tc; - COMPRESSED_RGBA_S3TC_DXT1_EXT: number; - COMPRESSED_RGBA_S3TC_DXT3_EXT: number; - COMPRESSED_RGBA_S3TC_DXT5_EXT: number; - COMPRESSED_RGB_S3TC_DXT1_EXT: number; + readonly COMPRESSED_RGBA_S3TC_DXT1_EXT: number; + readonly COMPRESSED_RGBA_S3TC_DXT3_EXT: number; + readonly COMPRESSED_RGBA_S3TC_DXT5_EXT: number; + readonly COMPRESSED_RGB_S3TC_DXT1_EXT: number; } interface WEBGL_debug_renderer_info { - UNMASKED_RENDERER_WEBGL: number; - UNMASKED_VENDOR_WEBGL: number; + readonly UNMASKED_RENDERER_WEBGL: number; + readonly UNMASKED_VENDOR_WEBGL: number; } declare var WEBGL_debug_renderer_info: { prototype: WEBGL_debug_renderer_info; new(): WEBGL_debug_renderer_info; - UNMASKED_RENDERER_WEBGL: number; - UNMASKED_VENDOR_WEBGL: number; + readonly UNMASKED_RENDERER_WEBGL: number; + readonly UNMASKED_VENDOR_WEBGL: number; } interface WEBGL_depth_texture { - UNSIGNED_INT_24_8_WEBGL: number; + readonly UNSIGNED_INT_24_8_WEBGL: number; } declare var WEBGL_depth_texture: { prototype: WEBGL_depth_texture; new(): WEBGL_depth_texture; - UNSIGNED_INT_24_8_WEBGL: number; + readonly UNSIGNED_INT_24_8_WEBGL: number; } interface WaveShaperNode extends AudioNode { - curve: Float32Array; + curve: Float32Array | null; oversample: string; } @@ -14909,9 +16008,9 @@ declare var WaveShaperNode: { } interface WebGLActiveInfo { - name: string; - size: number; - type: number; + readonly name: string; + readonly size: number; + readonly type: number; } declare var WebGLActiveInfo: { @@ -14928,12 +16027,12 @@ declare var WebGLBuffer: { } interface WebGLContextEvent extends Event { - statusMessage: string; + readonly statusMessage: string; } declare var WebGLContextEvent: { prototype: WebGLContextEvent; - new(): WebGLContextEvent; + new(type: string, eventInitDict?: WebGLContextEventInit): WebGLContextEvent; } interface WebGLFramebuffer extends WebGLObject { @@ -14969,16 +16068,16 @@ declare var WebGLRenderbuffer: { } interface WebGLRenderingContext { - canvas: HTMLCanvasElement; - drawingBufferHeight: number; - drawingBufferWidth: number; + readonly canvas: HTMLCanvasElement; + readonly drawingBufferHeight: number; + readonly drawingBufferWidth: number; activeTexture(texture: number): void; - attachShader(program: WebGLProgram, shader: WebGLShader): void; - bindAttribLocation(program: WebGLProgram, index: number, name: string): void; - bindBuffer(target: number, buffer: WebGLBuffer): void; - bindFramebuffer(target: number, framebuffer: WebGLFramebuffer): void; - bindRenderbuffer(target: number, renderbuffer: WebGLRenderbuffer): void; - bindTexture(target: number, texture: WebGLTexture): void; + attachShader(program: WebGLProgram | null, shader: WebGLShader | null): void; + bindAttribLocation(program: WebGLProgram | null, index: number, name: string): void; + bindBuffer(target: number, buffer: WebGLBuffer | null): void; + bindFramebuffer(target: number, framebuffer: WebGLFramebuffer | null): void; + bindRenderbuffer(target: number, renderbuffer: WebGLRenderbuffer | null): void; + bindTexture(target: number, texture: WebGLTexture | null): void; blendColor(red: number, green: number, blue: number, alpha: number): void; blendEquation(mode: number): void; blendEquationSeparate(modeRGB: number, modeAlpha: number): void; @@ -14992,28 +16091,28 @@ interface WebGLRenderingContext { clearDepth(depth: number): void; clearStencil(s: number): void; colorMask(red: boolean, green: boolean, blue: boolean, alpha: boolean): void; - compileShader(shader: WebGLShader): void; + compileShader(shader: WebGLShader | null): void; compressedTexImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, data: ArrayBufferView): void; compressedTexSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, data: ArrayBufferView): void; copyTexImage2D(target: number, level: number, internalformat: number, x: number, y: number, width: number, height: number, border: number): void; copyTexSubImage2D(target: number, level: number, xoffset: number, yoffset: number, x: number, y: number, width: number, height: number): void; - createBuffer(): WebGLBuffer; - createFramebuffer(): WebGLFramebuffer; - createProgram(): WebGLProgram; - createRenderbuffer(): WebGLRenderbuffer; - createShader(type: number): WebGLShader; - createTexture(): WebGLTexture; + createBuffer(): WebGLBuffer | null; + createFramebuffer(): WebGLFramebuffer | null; + createProgram(): WebGLProgram | null; + createRenderbuffer(): WebGLRenderbuffer | null; + createShader(type: number): WebGLShader | null; + createTexture(): WebGLTexture | null; cullFace(mode: number): void; - deleteBuffer(buffer: WebGLBuffer): void; - deleteFramebuffer(framebuffer: WebGLFramebuffer): void; - deleteProgram(program: WebGLProgram): void; - deleteRenderbuffer(renderbuffer: WebGLRenderbuffer): void; - deleteShader(shader: WebGLShader): void; - deleteTexture(texture: WebGLTexture): void; + deleteBuffer(buffer: WebGLBuffer | null): void; + deleteFramebuffer(framebuffer: WebGLFramebuffer | null): void; + deleteProgram(program: WebGLProgram | null): void; + deleteRenderbuffer(renderbuffer: WebGLRenderbuffer | null): void; + deleteShader(shader: WebGLShader | null): void; + deleteTexture(texture: WebGLTexture | null): void; depthFunc(func: number): void; depthMask(flag: boolean): void; depthRange(zNear: number, zFar: number): void; - detachShader(program: WebGLProgram, shader: WebGLShader): void; + detachShader(program: WebGLProgram | null, shader: WebGLShader | null): void; disable(cap: number): void; disableVertexAttribArray(index: number): void; drawArrays(mode: number, first: number, count: number): void; @@ -15022,51 +16121,51 @@ interface WebGLRenderingContext { enableVertexAttribArray(index: number): void; finish(): void; flush(): void; - framebufferRenderbuffer(target: number, attachment: number, renderbuffertarget: number, renderbuffer: WebGLRenderbuffer): void; - framebufferTexture2D(target: number, attachment: number, textarget: number, texture: WebGLTexture, level: number): void; + framebufferRenderbuffer(target: number, attachment: number, renderbuffertarget: number, renderbuffer: WebGLRenderbuffer | null): void; + framebufferTexture2D(target: number, attachment: number, textarget: number, texture: WebGLTexture | null, level: number): void; frontFace(mode: number): void; generateMipmap(target: number): void; - getActiveAttrib(program: WebGLProgram, index: number): WebGLActiveInfo; - getActiveUniform(program: WebGLProgram, index: number): WebGLActiveInfo; - getAttachedShaders(program: WebGLProgram): WebGLShader[]; - getAttribLocation(program: WebGLProgram, name: string): number; + getActiveAttrib(program: WebGLProgram | null, index: number): WebGLActiveInfo | null; + getActiveUniform(program: WebGLProgram | null, index: number): WebGLActiveInfo | null; + getAttachedShaders(program: WebGLProgram | null): WebGLShader[] | null; + getAttribLocation(program: WebGLProgram | null, name: string): number; getBufferParameter(target: number, pname: number): any; getContextAttributes(): WebGLContextAttributes; getError(): number; getExtension(name: string): any; getFramebufferAttachmentParameter(target: number, attachment: number, pname: number): any; getParameter(pname: number): any; - getProgramInfoLog(program: WebGLProgram): string; - getProgramParameter(program: WebGLProgram, pname: number): any; + getProgramInfoLog(program: WebGLProgram | null): string | null; + getProgramParameter(program: WebGLProgram | null, pname: number): any; getRenderbufferParameter(target: number, pname: number): any; - getShaderInfoLog(shader: WebGLShader): string; - getShaderParameter(shader: WebGLShader, pname: number): any; - getShaderPrecisionFormat(shadertype: number, precisiontype: number): WebGLShaderPrecisionFormat; - getShaderSource(shader: WebGLShader): string; - getSupportedExtensions(): string[]; + getShaderInfoLog(shader: WebGLShader | null): string | null; + getShaderParameter(shader: WebGLShader | null, pname: number): any; + getShaderPrecisionFormat(shadertype: number, precisiontype: number): WebGLShaderPrecisionFormat | null; + getShaderSource(shader: WebGLShader | null): string | null; + getSupportedExtensions(): string[] | null; getTexParameter(target: number, pname: number): any; - getUniform(program: WebGLProgram, location: WebGLUniformLocation): any; - getUniformLocation(program: WebGLProgram, name: string): WebGLUniformLocation; + getUniform(program: WebGLProgram | null, location: WebGLUniformLocation | null): any; + getUniformLocation(program: WebGLProgram | null, name: string): WebGLUniformLocation | null; getVertexAttrib(index: number, pname: number): any; getVertexAttribOffset(index: number, pname: number): number; hint(target: number, mode: number): void; - isBuffer(buffer: WebGLBuffer): boolean; + isBuffer(buffer: WebGLBuffer | null): boolean; isContextLost(): boolean; isEnabled(cap: number): boolean; - isFramebuffer(framebuffer: WebGLFramebuffer): boolean; - isProgram(program: WebGLProgram): boolean; - isRenderbuffer(renderbuffer: WebGLRenderbuffer): boolean; - isShader(shader: WebGLShader): boolean; - isTexture(texture: WebGLTexture): boolean; + isFramebuffer(framebuffer: WebGLFramebuffer | null): boolean; + isProgram(program: WebGLProgram | null): boolean; + isRenderbuffer(renderbuffer: WebGLRenderbuffer | null): boolean; + isShader(shader: WebGLShader | null): boolean; + isTexture(texture: WebGLTexture | null): boolean; lineWidth(width: number): void; - linkProgram(program: WebGLProgram): void; + linkProgram(program: WebGLProgram | null): void; pixelStorei(pname: number, param: number): void; polygonOffset(factor: number, units: number): void; - readPixels(x: number, y: number, width: number, height: number, format: number, type: number, pixels: ArrayBufferView): void; + readPixels(x: number, y: number, width: number, height: number, format: number, type: number, pixels: ArrayBufferView | null): void; renderbufferStorage(target: number, internalformat: number, width: number, height: number): void; sampleCoverage(value: number, invert: boolean): void; scissor(x: number, y: number, width: number, height: number): void; - shaderSource(shader: WebGLShader, source: string): void; + shaderSource(shader: WebGLShader | null, source: string): void; stencilFunc(func: number, ref: number, mask: number): void; stencilFuncSeparate(face: number, func: number, ref: number, mask: number): void; stencilMask(mask: number): void; @@ -15085,636 +16184,636 @@ interface WebGLRenderingContext { texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, canvas: HTMLCanvasElement): void; texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, video: HTMLVideoElement): void; texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, pixels: ImageData): void; - uniform1f(location: WebGLUniformLocation, x: number): void; - uniform1fv(location: WebGLUniformLocation, v: Float32Array): void; - uniform1i(location: WebGLUniformLocation, x: number): void; - uniform1iv(location: WebGLUniformLocation, v: Int32Array): void; - uniform2f(location: WebGLUniformLocation, x: number, y: number): void; - uniform2fv(location: WebGLUniformLocation, v: Float32Array): void; - uniform2i(location: WebGLUniformLocation, x: number, y: number): void; - uniform2iv(location: WebGLUniformLocation, v: Int32Array): void; - uniform3f(location: WebGLUniformLocation, x: number, y: number, z: number): void; - uniform3fv(location: WebGLUniformLocation, v: Float32Array): void; - uniform3i(location: WebGLUniformLocation, x: number, y: number, z: number): void; - uniform3iv(location: WebGLUniformLocation, v: Int32Array): void; - uniform4f(location: WebGLUniformLocation, x: number, y: number, z: number, w: number): void; - uniform4fv(location: WebGLUniformLocation, v: Float32Array): void; - uniform4i(location: WebGLUniformLocation, x: number, y: number, z: number, w: number): void; - uniform4iv(location: WebGLUniformLocation, v: Int32Array): void; - uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void; - uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void; - uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void; - useProgram(program: WebGLProgram): void; - validateProgram(program: WebGLProgram): void; + uniform1f(location: WebGLUniformLocation | null, x: number): void; + uniform1fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; + uniform1i(location: WebGLUniformLocation | null, x: number): void; + uniform1iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; + uniform2f(location: WebGLUniformLocation | null, x: number, y: number): void; + uniform2fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; + uniform2i(location: WebGLUniformLocation | null, x: number, y: number): void; + uniform2iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; + uniform3f(location: WebGLUniformLocation | null, x: number, y: number, z: number): void; + uniform3fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; + uniform3i(location: WebGLUniformLocation | null, x: number, y: number, z: number): void; + uniform3iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; + uniform4f(location: WebGLUniformLocation | null, x: number, y: number, z: number, w: number): void; + uniform4fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; + uniform4i(location: WebGLUniformLocation | null, x: number, y: number, z: number, w: number): void; + uniform4iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; + uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void; + uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void; + uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void; + useProgram(program: WebGLProgram | null): void; + validateProgram(program: WebGLProgram | null): void; vertexAttrib1f(indx: number, x: number): void; - vertexAttrib1fv(indx: number, values: Float32Array): void; + vertexAttrib1fv(indx: number, values: Float32Array | number[]): void; vertexAttrib2f(indx: number, x: number, y: number): void; - vertexAttrib2fv(indx: number, values: Float32Array): void; + vertexAttrib2fv(indx: number, values: Float32Array | number[]): void; vertexAttrib3f(indx: number, x: number, y: number, z: number): void; - vertexAttrib3fv(indx: number, values: Float32Array): void; + vertexAttrib3fv(indx: number, values: Float32Array | number[]): void; vertexAttrib4f(indx: number, x: number, y: number, z: number, w: number): void; - vertexAttrib4fv(indx: number, values: Float32Array): void; + vertexAttrib4fv(indx: number, values: Float32Array | number[]): void; vertexAttribPointer(indx: number, size: number, type: number, normalized: boolean, stride: number, offset: number): void; viewport(x: number, y: number, width: number, height: number): void; - ACTIVE_ATTRIBUTES: number; - ACTIVE_TEXTURE: number; - ACTIVE_UNIFORMS: number; - ALIASED_LINE_WIDTH_RANGE: number; - ALIASED_POINT_SIZE_RANGE: number; - ALPHA: number; - ALPHA_BITS: number; - ALWAYS: number; - ARRAY_BUFFER: number; - ARRAY_BUFFER_BINDING: number; - ATTACHED_SHADERS: number; - BACK: number; - BLEND: number; - BLEND_COLOR: number; - BLEND_DST_ALPHA: number; - BLEND_DST_RGB: number; - BLEND_EQUATION: number; - BLEND_EQUATION_ALPHA: number; - BLEND_EQUATION_RGB: number; - BLEND_SRC_ALPHA: number; - BLEND_SRC_RGB: number; - BLUE_BITS: number; - BOOL: number; - BOOL_VEC2: number; - BOOL_VEC3: number; - BOOL_VEC4: number; - BROWSER_DEFAULT_WEBGL: number; - BUFFER_SIZE: number; - BUFFER_USAGE: number; - BYTE: number; - CCW: number; - CLAMP_TO_EDGE: number; - COLOR_ATTACHMENT0: number; - COLOR_BUFFER_BIT: number; - COLOR_CLEAR_VALUE: number; - COLOR_WRITEMASK: number; - COMPILE_STATUS: number; - COMPRESSED_TEXTURE_FORMATS: number; - CONSTANT_ALPHA: number; - CONSTANT_COLOR: number; - CONTEXT_LOST_WEBGL: number; - CULL_FACE: number; - CULL_FACE_MODE: number; - CURRENT_PROGRAM: number; - CURRENT_VERTEX_ATTRIB: number; - CW: number; - DECR: number; - DECR_WRAP: number; - DELETE_STATUS: number; - DEPTH_ATTACHMENT: number; - DEPTH_BITS: number; - DEPTH_BUFFER_BIT: number; - DEPTH_CLEAR_VALUE: number; - DEPTH_COMPONENT: number; - DEPTH_COMPONENT16: number; - DEPTH_FUNC: number; - DEPTH_RANGE: number; - DEPTH_STENCIL: number; - DEPTH_STENCIL_ATTACHMENT: number; - DEPTH_TEST: number; - DEPTH_WRITEMASK: number; - DITHER: number; - DONT_CARE: number; - DST_ALPHA: number; - DST_COLOR: number; - DYNAMIC_DRAW: number; - ELEMENT_ARRAY_BUFFER: number; - ELEMENT_ARRAY_BUFFER_BINDING: number; - EQUAL: number; - FASTEST: number; - FLOAT: number; - FLOAT_MAT2: number; - FLOAT_MAT3: number; - FLOAT_MAT4: number; - FLOAT_VEC2: number; - FLOAT_VEC3: number; - FLOAT_VEC4: number; - FRAGMENT_SHADER: number; - FRAMEBUFFER: number; - FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number; - FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number; - FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number; - FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number; - FRAMEBUFFER_BINDING: number; - FRAMEBUFFER_COMPLETE: number; - FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number; - FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number; - FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number; - FRAMEBUFFER_UNSUPPORTED: number; - FRONT: number; - FRONT_AND_BACK: number; - FRONT_FACE: number; - FUNC_ADD: number; - FUNC_REVERSE_SUBTRACT: number; - FUNC_SUBTRACT: number; - GENERATE_MIPMAP_HINT: number; - GEQUAL: number; - GREATER: number; - GREEN_BITS: number; - HIGH_FLOAT: number; - HIGH_INT: number; - IMPLEMENTATION_COLOR_READ_FORMAT: number; - IMPLEMENTATION_COLOR_READ_TYPE: number; - INCR: number; - INCR_WRAP: number; - INT: number; - INT_VEC2: number; - INT_VEC3: number; - INT_VEC4: number; - INVALID_ENUM: number; - INVALID_FRAMEBUFFER_OPERATION: number; - INVALID_OPERATION: number; - INVALID_VALUE: number; - INVERT: number; - KEEP: number; - LEQUAL: number; - LESS: number; - LINEAR: number; - LINEAR_MIPMAP_LINEAR: number; - LINEAR_MIPMAP_NEAREST: number; - LINES: number; - LINE_LOOP: number; - LINE_STRIP: number; - LINE_WIDTH: number; - LINK_STATUS: number; - LOW_FLOAT: number; - LOW_INT: number; - LUMINANCE: number; - LUMINANCE_ALPHA: number; - MAX_COMBINED_TEXTURE_IMAGE_UNITS: number; - MAX_CUBE_MAP_TEXTURE_SIZE: number; - MAX_FRAGMENT_UNIFORM_VECTORS: number; - MAX_RENDERBUFFER_SIZE: number; - MAX_TEXTURE_IMAGE_UNITS: number; - MAX_TEXTURE_SIZE: number; - MAX_VARYING_VECTORS: number; - MAX_VERTEX_ATTRIBS: number; - MAX_VERTEX_TEXTURE_IMAGE_UNITS: number; - MAX_VERTEX_UNIFORM_VECTORS: number; - MAX_VIEWPORT_DIMS: number; - MEDIUM_FLOAT: number; - MEDIUM_INT: number; - MIRRORED_REPEAT: number; - NEAREST: number; - NEAREST_MIPMAP_LINEAR: number; - NEAREST_MIPMAP_NEAREST: number; - NEVER: number; - NICEST: number; - NONE: number; - NOTEQUAL: number; - NO_ERROR: number; - ONE: number; - ONE_MINUS_CONSTANT_ALPHA: number; - ONE_MINUS_CONSTANT_COLOR: number; - ONE_MINUS_DST_ALPHA: number; - ONE_MINUS_DST_COLOR: number; - ONE_MINUS_SRC_ALPHA: number; - ONE_MINUS_SRC_COLOR: number; - OUT_OF_MEMORY: number; - PACK_ALIGNMENT: number; - POINTS: number; - POLYGON_OFFSET_FACTOR: number; - POLYGON_OFFSET_FILL: number; - POLYGON_OFFSET_UNITS: number; - RED_BITS: number; - RENDERBUFFER: number; - RENDERBUFFER_ALPHA_SIZE: number; - RENDERBUFFER_BINDING: number; - RENDERBUFFER_BLUE_SIZE: number; - RENDERBUFFER_DEPTH_SIZE: number; - RENDERBUFFER_GREEN_SIZE: number; - RENDERBUFFER_HEIGHT: number; - RENDERBUFFER_INTERNAL_FORMAT: number; - RENDERBUFFER_RED_SIZE: number; - RENDERBUFFER_STENCIL_SIZE: number; - RENDERBUFFER_WIDTH: number; - RENDERER: number; - REPEAT: number; - REPLACE: number; - RGB: number; - RGB565: number; - RGB5_A1: number; - RGBA: number; - RGBA4: number; - SAMPLER_2D: number; - SAMPLER_CUBE: number; - SAMPLES: number; - SAMPLE_ALPHA_TO_COVERAGE: number; - SAMPLE_BUFFERS: number; - SAMPLE_COVERAGE: number; - SAMPLE_COVERAGE_INVERT: number; - SAMPLE_COVERAGE_VALUE: number; - SCISSOR_BOX: number; - SCISSOR_TEST: number; - SHADER_TYPE: number; - SHADING_LANGUAGE_VERSION: number; - SHORT: number; - SRC_ALPHA: number; - SRC_ALPHA_SATURATE: number; - SRC_COLOR: number; - STATIC_DRAW: number; - STENCIL_ATTACHMENT: number; - STENCIL_BACK_FAIL: number; - STENCIL_BACK_FUNC: number; - STENCIL_BACK_PASS_DEPTH_FAIL: number; - STENCIL_BACK_PASS_DEPTH_PASS: number; - STENCIL_BACK_REF: number; - STENCIL_BACK_VALUE_MASK: number; - STENCIL_BACK_WRITEMASK: number; - STENCIL_BITS: number; - STENCIL_BUFFER_BIT: number; - STENCIL_CLEAR_VALUE: number; - STENCIL_FAIL: number; - STENCIL_FUNC: number; - STENCIL_INDEX: number; - STENCIL_INDEX8: number; - STENCIL_PASS_DEPTH_FAIL: number; - STENCIL_PASS_DEPTH_PASS: number; - STENCIL_REF: number; - STENCIL_TEST: number; - STENCIL_VALUE_MASK: number; - STENCIL_WRITEMASK: number; - STREAM_DRAW: number; - SUBPIXEL_BITS: number; - TEXTURE: number; - TEXTURE0: number; - TEXTURE1: number; - TEXTURE10: number; - TEXTURE11: number; - TEXTURE12: number; - TEXTURE13: number; - TEXTURE14: number; - TEXTURE15: number; - TEXTURE16: number; - TEXTURE17: number; - TEXTURE18: number; - TEXTURE19: number; - TEXTURE2: number; - TEXTURE20: number; - TEXTURE21: number; - TEXTURE22: number; - TEXTURE23: number; - TEXTURE24: number; - TEXTURE25: number; - TEXTURE26: number; - TEXTURE27: number; - TEXTURE28: number; - TEXTURE29: number; - TEXTURE3: number; - TEXTURE30: number; - TEXTURE31: number; - TEXTURE4: number; - TEXTURE5: number; - TEXTURE6: number; - TEXTURE7: number; - TEXTURE8: number; - TEXTURE9: number; - TEXTURE_2D: number; - TEXTURE_BINDING_2D: number; - TEXTURE_BINDING_CUBE_MAP: number; - TEXTURE_CUBE_MAP: number; - TEXTURE_CUBE_MAP_NEGATIVE_X: number; - TEXTURE_CUBE_MAP_NEGATIVE_Y: number; - TEXTURE_CUBE_MAP_NEGATIVE_Z: number; - TEXTURE_CUBE_MAP_POSITIVE_X: number; - TEXTURE_CUBE_MAP_POSITIVE_Y: number; - TEXTURE_CUBE_MAP_POSITIVE_Z: number; - TEXTURE_MAG_FILTER: number; - TEXTURE_MIN_FILTER: number; - TEXTURE_WRAP_S: number; - TEXTURE_WRAP_T: number; - TRIANGLES: number; - TRIANGLE_FAN: number; - TRIANGLE_STRIP: number; - UNPACK_ALIGNMENT: number; - UNPACK_COLORSPACE_CONVERSION_WEBGL: number; - UNPACK_FLIP_Y_WEBGL: number; - UNPACK_PREMULTIPLY_ALPHA_WEBGL: number; - UNSIGNED_BYTE: number; - UNSIGNED_INT: number; - UNSIGNED_SHORT: number; - UNSIGNED_SHORT_4_4_4_4: number; - UNSIGNED_SHORT_5_5_5_1: number; - UNSIGNED_SHORT_5_6_5: number; - VALIDATE_STATUS: number; - VENDOR: number; - VERSION: number; - VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number; - VERTEX_ATTRIB_ARRAY_ENABLED: number; - VERTEX_ATTRIB_ARRAY_NORMALIZED: number; - VERTEX_ATTRIB_ARRAY_POINTER: number; - VERTEX_ATTRIB_ARRAY_SIZE: number; - VERTEX_ATTRIB_ARRAY_STRIDE: number; - VERTEX_ATTRIB_ARRAY_TYPE: number; - VERTEX_SHADER: number; - VIEWPORT: number; - ZERO: number; + readonly ACTIVE_ATTRIBUTES: number; + readonly ACTIVE_TEXTURE: number; + readonly ACTIVE_UNIFORMS: number; + readonly ALIASED_LINE_WIDTH_RANGE: number; + readonly ALIASED_POINT_SIZE_RANGE: number; + readonly ALPHA: number; + readonly ALPHA_BITS: number; + readonly ALWAYS: number; + readonly ARRAY_BUFFER: number; + readonly ARRAY_BUFFER_BINDING: number; + readonly ATTACHED_SHADERS: number; + readonly BACK: number; + readonly BLEND: number; + readonly BLEND_COLOR: number; + readonly BLEND_DST_ALPHA: number; + readonly BLEND_DST_RGB: number; + readonly BLEND_EQUATION: number; + readonly BLEND_EQUATION_ALPHA: number; + readonly BLEND_EQUATION_RGB: number; + readonly BLEND_SRC_ALPHA: number; + readonly BLEND_SRC_RGB: number; + readonly BLUE_BITS: number; + readonly BOOL: number; + readonly BOOL_VEC2: number; + readonly BOOL_VEC3: number; + readonly BOOL_VEC4: number; + readonly BROWSER_DEFAULT_WEBGL: number; + readonly BUFFER_SIZE: number; + readonly BUFFER_USAGE: number; + readonly BYTE: number; + readonly CCW: number; + readonly CLAMP_TO_EDGE: number; + readonly COLOR_ATTACHMENT0: number; + readonly COLOR_BUFFER_BIT: number; + readonly COLOR_CLEAR_VALUE: number; + readonly COLOR_WRITEMASK: number; + readonly COMPILE_STATUS: number; + readonly COMPRESSED_TEXTURE_FORMATS: number; + readonly CONSTANT_ALPHA: number; + readonly CONSTANT_COLOR: number; + readonly CONTEXT_LOST_WEBGL: number; + readonly CULL_FACE: number; + readonly CULL_FACE_MODE: number; + readonly CURRENT_PROGRAM: number; + readonly CURRENT_VERTEX_ATTRIB: number; + readonly CW: number; + readonly DECR: number; + readonly DECR_WRAP: number; + readonly DELETE_STATUS: number; + readonly DEPTH_ATTACHMENT: number; + readonly DEPTH_BITS: number; + readonly DEPTH_BUFFER_BIT: number; + readonly DEPTH_CLEAR_VALUE: number; + readonly DEPTH_COMPONENT: number; + readonly DEPTH_COMPONENT16: number; + readonly DEPTH_FUNC: number; + readonly DEPTH_RANGE: number; + readonly DEPTH_STENCIL: number; + readonly DEPTH_STENCIL_ATTACHMENT: number; + readonly DEPTH_TEST: number; + readonly DEPTH_WRITEMASK: number; + readonly DITHER: number; + readonly DONT_CARE: number; + readonly DST_ALPHA: number; + readonly DST_COLOR: number; + readonly DYNAMIC_DRAW: number; + readonly ELEMENT_ARRAY_BUFFER: number; + readonly ELEMENT_ARRAY_BUFFER_BINDING: number; + readonly EQUAL: number; + readonly FASTEST: number; + readonly FLOAT: number; + readonly FLOAT_MAT2: number; + readonly FLOAT_MAT3: number; + readonly FLOAT_MAT4: number; + readonly FLOAT_VEC2: number; + readonly FLOAT_VEC3: number; + readonly FLOAT_VEC4: number; + readonly FRAGMENT_SHADER: number; + readonly FRAMEBUFFER: number; + readonly FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number; + readonly FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number; + readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number; + readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number; + readonly FRAMEBUFFER_BINDING: number; + readonly FRAMEBUFFER_COMPLETE: number; + readonly FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number; + readonly FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number; + readonly FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number; + readonly FRAMEBUFFER_UNSUPPORTED: number; + readonly FRONT: number; + readonly FRONT_AND_BACK: number; + readonly FRONT_FACE: number; + readonly FUNC_ADD: number; + readonly FUNC_REVERSE_SUBTRACT: number; + readonly FUNC_SUBTRACT: number; + readonly GENERATE_MIPMAP_HINT: number; + readonly GEQUAL: number; + readonly GREATER: number; + readonly GREEN_BITS: number; + readonly HIGH_FLOAT: number; + readonly HIGH_INT: number; + readonly IMPLEMENTATION_COLOR_READ_FORMAT: number; + readonly IMPLEMENTATION_COLOR_READ_TYPE: number; + readonly INCR: number; + readonly INCR_WRAP: number; + readonly INT: number; + readonly INT_VEC2: number; + readonly INT_VEC3: number; + readonly INT_VEC4: number; + readonly INVALID_ENUM: number; + readonly INVALID_FRAMEBUFFER_OPERATION: number; + readonly INVALID_OPERATION: number; + readonly INVALID_VALUE: number; + readonly INVERT: number; + readonly KEEP: number; + readonly LEQUAL: number; + readonly LESS: number; + readonly LINEAR: number; + readonly LINEAR_MIPMAP_LINEAR: number; + readonly LINEAR_MIPMAP_NEAREST: number; + readonly LINES: number; + readonly LINE_LOOP: number; + readonly LINE_STRIP: number; + readonly LINE_WIDTH: number; + readonly LINK_STATUS: number; + readonly LOW_FLOAT: number; + readonly LOW_INT: number; + readonly LUMINANCE: number; + readonly LUMINANCE_ALPHA: number; + readonly MAX_COMBINED_TEXTURE_IMAGE_UNITS: number; + readonly MAX_CUBE_MAP_TEXTURE_SIZE: number; + readonly MAX_FRAGMENT_UNIFORM_VECTORS: number; + readonly MAX_RENDERBUFFER_SIZE: number; + readonly MAX_TEXTURE_IMAGE_UNITS: number; + readonly MAX_TEXTURE_SIZE: number; + readonly MAX_VARYING_VECTORS: number; + readonly MAX_VERTEX_ATTRIBS: number; + readonly MAX_VERTEX_TEXTURE_IMAGE_UNITS: number; + readonly MAX_VERTEX_UNIFORM_VECTORS: number; + readonly MAX_VIEWPORT_DIMS: number; + readonly MEDIUM_FLOAT: number; + readonly MEDIUM_INT: number; + readonly MIRRORED_REPEAT: number; + readonly NEAREST: number; + readonly NEAREST_MIPMAP_LINEAR: number; + readonly NEAREST_MIPMAP_NEAREST: number; + readonly NEVER: number; + readonly NICEST: number; + readonly NONE: number; + readonly NOTEQUAL: number; + readonly NO_ERROR: number; + readonly ONE: number; + readonly ONE_MINUS_CONSTANT_ALPHA: number; + readonly ONE_MINUS_CONSTANT_COLOR: number; + readonly ONE_MINUS_DST_ALPHA: number; + readonly ONE_MINUS_DST_COLOR: number; + readonly ONE_MINUS_SRC_ALPHA: number; + readonly ONE_MINUS_SRC_COLOR: number; + readonly OUT_OF_MEMORY: number; + readonly PACK_ALIGNMENT: number; + readonly POINTS: number; + readonly POLYGON_OFFSET_FACTOR: number; + readonly POLYGON_OFFSET_FILL: number; + readonly POLYGON_OFFSET_UNITS: number; + readonly RED_BITS: number; + readonly RENDERBUFFER: number; + readonly RENDERBUFFER_ALPHA_SIZE: number; + readonly RENDERBUFFER_BINDING: number; + readonly RENDERBUFFER_BLUE_SIZE: number; + readonly RENDERBUFFER_DEPTH_SIZE: number; + readonly RENDERBUFFER_GREEN_SIZE: number; + readonly RENDERBUFFER_HEIGHT: number; + readonly RENDERBUFFER_INTERNAL_FORMAT: number; + readonly RENDERBUFFER_RED_SIZE: number; + readonly RENDERBUFFER_STENCIL_SIZE: number; + readonly RENDERBUFFER_WIDTH: number; + readonly RENDERER: number; + readonly REPEAT: number; + readonly REPLACE: number; + readonly RGB: number; + readonly RGB565: number; + readonly RGB5_A1: number; + readonly RGBA: number; + readonly RGBA4: number; + readonly SAMPLER_2D: number; + readonly SAMPLER_CUBE: number; + readonly SAMPLES: number; + readonly SAMPLE_ALPHA_TO_COVERAGE: number; + readonly SAMPLE_BUFFERS: number; + readonly SAMPLE_COVERAGE: number; + readonly SAMPLE_COVERAGE_INVERT: number; + readonly SAMPLE_COVERAGE_VALUE: number; + readonly SCISSOR_BOX: number; + readonly SCISSOR_TEST: number; + readonly SHADER_TYPE: number; + readonly SHADING_LANGUAGE_VERSION: number; + readonly SHORT: number; + readonly SRC_ALPHA: number; + readonly SRC_ALPHA_SATURATE: number; + readonly SRC_COLOR: number; + readonly STATIC_DRAW: number; + readonly STENCIL_ATTACHMENT: number; + readonly STENCIL_BACK_FAIL: number; + readonly STENCIL_BACK_FUNC: number; + readonly STENCIL_BACK_PASS_DEPTH_FAIL: number; + readonly STENCIL_BACK_PASS_DEPTH_PASS: number; + readonly STENCIL_BACK_REF: number; + readonly STENCIL_BACK_VALUE_MASK: number; + readonly STENCIL_BACK_WRITEMASK: number; + readonly STENCIL_BITS: number; + readonly STENCIL_BUFFER_BIT: number; + readonly STENCIL_CLEAR_VALUE: number; + readonly STENCIL_FAIL: number; + readonly STENCIL_FUNC: number; + readonly STENCIL_INDEX: number; + readonly STENCIL_INDEX8: number; + readonly STENCIL_PASS_DEPTH_FAIL: number; + readonly STENCIL_PASS_DEPTH_PASS: number; + readonly STENCIL_REF: number; + readonly STENCIL_TEST: number; + readonly STENCIL_VALUE_MASK: number; + readonly STENCIL_WRITEMASK: number; + readonly STREAM_DRAW: number; + readonly SUBPIXEL_BITS: number; + readonly TEXTURE: number; + readonly TEXTURE0: number; + readonly TEXTURE1: number; + readonly TEXTURE10: number; + readonly TEXTURE11: number; + readonly TEXTURE12: number; + readonly TEXTURE13: number; + readonly TEXTURE14: number; + readonly TEXTURE15: number; + readonly TEXTURE16: number; + readonly TEXTURE17: number; + readonly TEXTURE18: number; + readonly TEXTURE19: number; + readonly TEXTURE2: number; + readonly TEXTURE20: number; + readonly TEXTURE21: number; + readonly TEXTURE22: number; + readonly TEXTURE23: number; + readonly TEXTURE24: number; + readonly TEXTURE25: number; + readonly TEXTURE26: number; + readonly TEXTURE27: number; + readonly TEXTURE28: number; + readonly TEXTURE29: number; + readonly TEXTURE3: number; + readonly TEXTURE30: number; + readonly TEXTURE31: number; + readonly TEXTURE4: number; + readonly TEXTURE5: number; + readonly TEXTURE6: number; + readonly TEXTURE7: number; + readonly TEXTURE8: number; + readonly TEXTURE9: number; + readonly TEXTURE_2D: number; + readonly TEXTURE_BINDING_2D: number; + readonly TEXTURE_BINDING_CUBE_MAP: number; + readonly TEXTURE_CUBE_MAP: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_X: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_Y: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_Z: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_X: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_Y: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_Z: number; + readonly TEXTURE_MAG_FILTER: number; + readonly TEXTURE_MIN_FILTER: number; + readonly TEXTURE_WRAP_S: number; + readonly TEXTURE_WRAP_T: number; + readonly TRIANGLES: number; + readonly TRIANGLE_FAN: number; + readonly TRIANGLE_STRIP: number; + readonly UNPACK_ALIGNMENT: number; + readonly UNPACK_COLORSPACE_CONVERSION_WEBGL: number; + readonly UNPACK_FLIP_Y_WEBGL: number; + readonly UNPACK_PREMULTIPLY_ALPHA_WEBGL: number; + readonly UNSIGNED_BYTE: number; + readonly UNSIGNED_INT: number; + readonly UNSIGNED_SHORT: number; + readonly UNSIGNED_SHORT_4_4_4_4: number; + readonly UNSIGNED_SHORT_5_5_5_1: number; + readonly UNSIGNED_SHORT_5_6_5: number; + readonly VALIDATE_STATUS: number; + readonly VENDOR: number; + readonly VERSION: number; + readonly VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number; + readonly VERTEX_ATTRIB_ARRAY_ENABLED: number; + readonly VERTEX_ATTRIB_ARRAY_NORMALIZED: number; + readonly VERTEX_ATTRIB_ARRAY_POINTER: number; + readonly VERTEX_ATTRIB_ARRAY_SIZE: number; + readonly VERTEX_ATTRIB_ARRAY_STRIDE: number; + readonly VERTEX_ATTRIB_ARRAY_TYPE: number; + readonly VERTEX_SHADER: number; + readonly VIEWPORT: number; + readonly ZERO: number; } declare var WebGLRenderingContext: { prototype: WebGLRenderingContext; new(): WebGLRenderingContext; - ACTIVE_ATTRIBUTES: number; - ACTIVE_TEXTURE: number; - ACTIVE_UNIFORMS: number; - ALIASED_LINE_WIDTH_RANGE: number; - ALIASED_POINT_SIZE_RANGE: number; - ALPHA: number; - ALPHA_BITS: number; - ALWAYS: number; - ARRAY_BUFFER: number; - ARRAY_BUFFER_BINDING: number; - ATTACHED_SHADERS: number; - BACK: number; - BLEND: number; - BLEND_COLOR: number; - BLEND_DST_ALPHA: number; - BLEND_DST_RGB: number; - BLEND_EQUATION: number; - BLEND_EQUATION_ALPHA: number; - BLEND_EQUATION_RGB: number; - BLEND_SRC_ALPHA: number; - BLEND_SRC_RGB: number; - BLUE_BITS: number; - BOOL: number; - BOOL_VEC2: number; - BOOL_VEC3: number; - BOOL_VEC4: number; - BROWSER_DEFAULT_WEBGL: number; - BUFFER_SIZE: number; - BUFFER_USAGE: number; - BYTE: number; - CCW: number; - CLAMP_TO_EDGE: number; - COLOR_ATTACHMENT0: number; - COLOR_BUFFER_BIT: number; - COLOR_CLEAR_VALUE: number; - COLOR_WRITEMASK: number; - COMPILE_STATUS: number; - COMPRESSED_TEXTURE_FORMATS: number; - CONSTANT_ALPHA: number; - CONSTANT_COLOR: number; - CONTEXT_LOST_WEBGL: number; - CULL_FACE: number; - CULL_FACE_MODE: number; - CURRENT_PROGRAM: number; - CURRENT_VERTEX_ATTRIB: number; - CW: number; - DECR: number; - DECR_WRAP: number; - DELETE_STATUS: number; - DEPTH_ATTACHMENT: number; - DEPTH_BITS: number; - DEPTH_BUFFER_BIT: number; - DEPTH_CLEAR_VALUE: number; - DEPTH_COMPONENT: number; - DEPTH_COMPONENT16: number; - DEPTH_FUNC: number; - DEPTH_RANGE: number; - DEPTH_STENCIL: number; - DEPTH_STENCIL_ATTACHMENT: number; - DEPTH_TEST: number; - DEPTH_WRITEMASK: number; - DITHER: number; - DONT_CARE: number; - DST_ALPHA: number; - DST_COLOR: number; - DYNAMIC_DRAW: number; - ELEMENT_ARRAY_BUFFER: number; - ELEMENT_ARRAY_BUFFER_BINDING: number; - EQUAL: number; - FASTEST: number; - FLOAT: number; - FLOAT_MAT2: number; - FLOAT_MAT3: number; - FLOAT_MAT4: number; - FLOAT_VEC2: number; - FLOAT_VEC3: number; - FLOAT_VEC4: number; - FRAGMENT_SHADER: number; - FRAMEBUFFER: number; - FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number; - FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number; - FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number; - FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number; - FRAMEBUFFER_BINDING: number; - FRAMEBUFFER_COMPLETE: number; - FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number; - FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number; - FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number; - FRAMEBUFFER_UNSUPPORTED: number; - FRONT: number; - FRONT_AND_BACK: number; - FRONT_FACE: number; - FUNC_ADD: number; - FUNC_REVERSE_SUBTRACT: number; - FUNC_SUBTRACT: number; - GENERATE_MIPMAP_HINT: number; - GEQUAL: number; - GREATER: number; - GREEN_BITS: number; - HIGH_FLOAT: number; - HIGH_INT: number; - IMPLEMENTATION_COLOR_READ_FORMAT: number; - IMPLEMENTATION_COLOR_READ_TYPE: number; - INCR: number; - INCR_WRAP: number; - INT: number; - INT_VEC2: number; - INT_VEC3: number; - INT_VEC4: number; - INVALID_ENUM: number; - INVALID_FRAMEBUFFER_OPERATION: number; - INVALID_OPERATION: number; - INVALID_VALUE: number; - INVERT: number; - KEEP: number; - LEQUAL: number; - LESS: number; - LINEAR: number; - LINEAR_MIPMAP_LINEAR: number; - LINEAR_MIPMAP_NEAREST: number; - LINES: number; - LINE_LOOP: number; - LINE_STRIP: number; - LINE_WIDTH: number; - LINK_STATUS: number; - LOW_FLOAT: number; - LOW_INT: number; - LUMINANCE: number; - LUMINANCE_ALPHA: number; - MAX_COMBINED_TEXTURE_IMAGE_UNITS: number; - MAX_CUBE_MAP_TEXTURE_SIZE: number; - MAX_FRAGMENT_UNIFORM_VECTORS: number; - MAX_RENDERBUFFER_SIZE: number; - MAX_TEXTURE_IMAGE_UNITS: number; - MAX_TEXTURE_SIZE: number; - MAX_VARYING_VECTORS: number; - MAX_VERTEX_ATTRIBS: number; - MAX_VERTEX_TEXTURE_IMAGE_UNITS: number; - MAX_VERTEX_UNIFORM_VECTORS: number; - MAX_VIEWPORT_DIMS: number; - MEDIUM_FLOAT: number; - MEDIUM_INT: number; - MIRRORED_REPEAT: number; - NEAREST: number; - NEAREST_MIPMAP_LINEAR: number; - NEAREST_MIPMAP_NEAREST: number; - NEVER: number; - NICEST: number; - NONE: number; - NOTEQUAL: number; - NO_ERROR: number; - ONE: number; - ONE_MINUS_CONSTANT_ALPHA: number; - ONE_MINUS_CONSTANT_COLOR: number; - ONE_MINUS_DST_ALPHA: number; - ONE_MINUS_DST_COLOR: number; - ONE_MINUS_SRC_ALPHA: number; - ONE_MINUS_SRC_COLOR: number; - OUT_OF_MEMORY: number; - PACK_ALIGNMENT: number; - POINTS: number; - POLYGON_OFFSET_FACTOR: number; - POLYGON_OFFSET_FILL: number; - POLYGON_OFFSET_UNITS: number; - RED_BITS: number; - RENDERBUFFER: number; - RENDERBUFFER_ALPHA_SIZE: number; - RENDERBUFFER_BINDING: number; - RENDERBUFFER_BLUE_SIZE: number; - RENDERBUFFER_DEPTH_SIZE: number; - RENDERBUFFER_GREEN_SIZE: number; - RENDERBUFFER_HEIGHT: number; - RENDERBUFFER_INTERNAL_FORMAT: number; - RENDERBUFFER_RED_SIZE: number; - RENDERBUFFER_STENCIL_SIZE: number; - RENDERBUFFER_WIDTH: number; - RENDERER: number; - REPEAT: number; - REPLACE: number; - RGB: number; - RGB565: number; - RGB5_A1: number; - RGBA: number; - RGBA4: number; - SAMPLER_2D: number; - SAMPLER_CUBE: number; - SAMPLES: number; - SAMPLE_ALPHA_TO_COVERAGE: number; - SAMPLE_BUFFERS: number; - SAMPLE_COVERAGE: number; - SAMPLE_COVERAGE_INVERT: number; - SAMPLE_COVERAGE_VALUE: number; - SCISSOR_BOX: number; - SCISSOR_TEST: number; - SHADER_TYPE: number; - SHADING_LANGUAGE_VERSION: number; - SHORT: number; - SRC_ALPHA: number; - SRC_ALPHA_SATURATE: number; - SRC_COLOR: number; - STATIC_DRAW: number; - STENCIL_ATTACHMENT: number; - STENCIL_BACK_FAIL: number; - STENCIL_BACK_FUNC: number; - STENCIL_BACK_PASS_DEPTH_FAIL: number; - STENCIL_BACK_PASS_DEPTH_PASS: number; - STENCIL_BACK_REF: number; - STENCIL_BACK_VALUE_MASK: number; - STENCIL_BACK_WRITEMASK: number; - STENCIL_BITS: number; - STENCIL_BUFFER_BIT: number; - STENCIL_CLEAR_VALUE: number; - STENCIL_FAIL: number; - STENCIL_FUNC: number; - STENCIL_INDEX: number; - STENCIL_INDEX8: number; - STENCIL_PASS_DEPTH_FAIL: number; - STENCIL_PASS_DEPTH_PASS: number; - STENCIL_REF: number; - STENCIL_TEST: number; - STENCIL_VALUE_MASK: number; - STENCIL_WRITEMASK: number; - STREAM_DRAW: number; - SUBPIXEL_BITS: number; - TEXTURE: number; - TEXTURE0: number; - TEXTURE1: number; - TEXTURE10: number; - TEXTURE11: number; - TEXTURE12: number; - TEXTURE13: number; - TEXTURE14: number; - TEXTURE15: number; - TEXTURE16: number; - TEXTURE17: number; - TEXTURE18: number; - TEXTURE19: number; - TEXTURE2: number; - TEXTURE20: number; - TEXTURE21: number; - TEXTURE22: number; - TEXTURE23: number; - TEXTURE24: number; - TEXTURE25: number; - TEXTURE26: number; - TEXTURE27: number; - TEXTURE28: number; - TEXTURE29: number; - TEXTURE3: number; - TEXTURE30: number; - TEXTURE31: number; - TEXTURE4: number; - TEXTURE5: number; - TEXTURE6: number; - TEXTURE7: number; - TEXTURE8: number; - TEXTURE9: number; - TEXTURE_2D: number; - TEXTURE_BINDING_2D: number; - TEXTURE_BINDING_CUBE_MAP: number; - TEXTURE_CUBE_MAP: number; - TEXTURE_CUBE_MAP_NEGATIVE_X: number; - TEXTURE_CUBE_MAP_NEGATIVE_Y: number; - TEXTURE_CUBE_MAP_NEGATIVE_Z: number; - TEXTURE_CUBE_MAP_POSITIVE_X: number; - TEXTURE_CUBE_MAP_POSITIVE_Y: number; - TEXTURE_CUBE_MAP_POSITIVE_Z: number; - TEXTURE_MAG_FILTER: number; - TEXTURE_MIN_FILTER: number; - TEXTURE_WRAP_S: number; - TEXTURE_WRAP_T: number; - TRIANGLES: number; - TRIANGLE_FAN: number; - TRIANGLE_STRIP: number; - UNPACK_ALIGNMENT: number; - UNPACK_COLORSPACE_CONVERSION_WEBGL: number; - UNPACK_FLIP_Y_WEBGL: number; - UNPACK_PREMULTIPLY_ALPHA_WEBGL: number; - UNSIGNED_BYTE: number; - UNSIGNED_INT: number; - UNSIGNED_SHORT: number; - UNSIGNED_SHORT_4_4_4_4: number; - UNSIGNED_SHORT_5_5_5_1: number; - UNSIGNED_SHORT_5_6_5: number; - VALIDATE_STATUS: number; - VENDOR: number; - VERSION: number; - VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number; - VERTEX_ATTRIB_ARRAY_ENABLED: number; - VERTEX_ATTRIB_ARRAY_NORMALIZED: number; - VERTEX_ATTRIB_ARRAY_POINTER: number; - VERTEX_ATTRIB_ARRAY_SIZE: number; - VERTEX_ATTRIB_ARRAY_STRIDE: number; - VERTEX_ATTRIB_ARRAY_TYPE: number; - VERTEX_SHADER: number; - VIEWPORT: number; - ZERO: number; + readonly ACTIVE_ATTRIBUTES: number; + readonly ACTIVE_TEXTURE: number; + readonly ACTIVE_UNIFORMS: number; + readonly ALIASED_LINE_WIDTH_RANGE: number; + readonly ALIASED_POINT_SIZE_RANGE: number; + readonly ALPHA: number; + readonly ALPHA_BITS: number; + readonly ALWAYS: number; + readonly ARRAY_BUFFER: number; + readonly ARRAY_BUFFER_BINDING: number; + readonly ATTACHED_SHADERS: number; + readonly BACK: number; + readonly BLEND: number; + readonly BLEND_COLOR: number; + readonly BLEND_DST_ALPHA: number; + readonly BLEND_DST_RGB: number; + readonly BLEND_EQUATION: number; + readonly BLEND_EQUATION_ALPHA: number; + readonly BLEND_EQUATION_RGB: number; + readonly BLEND_SRC_ALPHA: number; + readonly BLEND_SRC_RGB: number; + readonly BLUE_BITS: number; + readonly BOOL: number; + readonly BOOL_VEC2: number; + readonly BOOL_VEC3: number; + readonly BOOL_VEC4: number; + readonly BROWSER_DEFAULT_WEBGL: number; + readonly BUFFER_SIZE: number; + readonly BUFFER_USAGE: number; + readonly BYTE: number; + readonly CCW: number; + readonly CLAMP_TO_EDGE: number; + readonly COLOR_ATTACHMENT0: number; + readonly COLOR_BUFFER_BIT: number; + readonly COLOR_CLEAR_VALUE: number; + readonly COLOR_WRITEMASK: number; + readonly COMPILE_STATUS: number; + readonly COMPRESSED_TEXTURE_FORMATS: number; + readonly CONSTANT_ALPHA: number; + readonly CONSTANT_COLOR: number; + readonly CONTEXT_LOST_WEBGL: number; + readonly CULL_FACE: number; + readonly CULL_FACE_MODE: number; + readonly CURRENT_PROGRAM: number; + readonly CURRENT_VERTEX_ATTRIB: number; + readonly CW: number; + readonly DECR: number; + readonly DECR_WRAP: number; + readonly DELETE_STATUS: number; + readonly DEPTH_ATTACHMENT: number; + readonly DEPTH_BITS: number; + readonly DEPTH_BUFFER_BIT: number; + readonly DEPTH_CLEAR_VALUE: number; + readonly DEPTH_COMPONENT: number; + readonly DEPTH_COMPONENT16: number; + readonly DEPTH_FUNC: number; + readonly DEPTH_RANGE: number; + readonly DEPTH_STENCIL: number; + readonly DEPTH_STENCIL_ATTACHMENT: number; + readonly DEPTH_TEST: number; + readonly DEPTH_WRITEMASK: number; + readonly DITHER: number; + readonly DONT_CARE: number; + readonly DST_ALPHA: number; + readonly DST_COLOR: number; + readonly DYNAMIC_DRAW: number; + readonly ELEMENT_ARRAY_BUFFER: number; + readonly ELEMENT_ARRAY_BUFFER_BINDING: number; + readonly EQUAL: number; + readonly FASTEST: number; + readonly FLOAT: number; + readonly FLOAT_MAT2: number; + readonly FLOAT_MAT3: number; + readonly FLOAT_MAT4: number; + readonly FLOAT_VEC2: number; + readonly FLOAT_VEC3: number; + readonly FLOAT_VEC4: number; + readonly FRAGMENT_SHADER: number; + readonly FRAMEBUFFER: number; + readonly FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number; + readonly FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number; + readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number; + readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number; + readonly FRAMEBUFFER_BINDING: number; + readonly FRAMEBUFFER_COMPLETE: number; + readonly FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number; + readonly FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number; + readonly FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number; + readonly FRAMEBUFFER_UNSUPPORTED: number; + readonly FRONT: number; + readonly FRONT_AND_BACK: number; + readonly FRONT_FACE: number; + readonly FUNC_ADD: number; + readonly FUNC_REVERSE_SUBTRACT: number; + readonly FUNC_SUBTRACT: number; + readonly GENERATE_MIPMAP_HINT: number; + readonly GEQUAL: number; + readonly GREATER: number; + readonly GREEN_BITS: number; + readonly HIGH_FLOAT: number; + readonly HIGH_INT: number; + readonly IMPLEMENTATION_COLOR_READ_FORMAT: number; + readonly IMPLEMENTATION_COLOR_READ_TYPE: number; + readonly INCR: number; + readonly INCR_WRAP: number; + readonly INT: number; + readonly INT_VEC2: number; + readonly INT_VEC3: number; + readonly INT_VEC4: number; + readonly INVALID_ENUM: number; + readonly INVALID_FRAMEBUFFER_OPERATION: number; + readonly INVALID_OPERATION: number; + readonly INVALID_VALUE: number; + readonly INVERT: number; + readonly KEEP: number; + readonly LEQUAL: number; + readonly LESS: number; + readonly LINEAR: number; + readonly LINEAR_MIPMAP_LINEAR: number; + readonly LINEAR_MIPMAP_NEAREST: number; + readonly LINES: number; + readonly LINE_LOOP: number; + readonly LINE_STRIP: number; + readonly LINE_WIDTH: number; + readonly LINK_STATUS: number; + readonly LOW_FLOAT: number; + readonly LOW_INT: number; + readonly LUMINANCE: number; + readonly LUMINANCE_ALPHA: number; + readonly MAX_COMBINED_TEXTURE_IMAGE_UNITS: number; + readonly MAX_CUBE_MAP_TEXTURE_SIZE: number; + readonly MAX_FRAGMENT_UNIFORM_VECTORS: number; + readonly MAX_RENDERBUFFER_SIZE: number; + readonly MAX_TEXTURE_IMAGE_UNITS: number; + readonly MAX_TEXTURE_SIZE: number; + readonly MAX_VARYING_VECTORS: number; + readonly MAX_VERTEX_ATTRIBS: number; + readonly MAX_VERTEX_TEXTURE_IMAGE_UNITS: number; + readonly MAX_VERTEX_UNIFORM_VECTORS: number; + readonly MAX_VIEWPORT_DIMS: number; + readonly MEDIUM_FLOAT: number; + readonly MEDIUM_INT: number; + readonly MIRRORED_REPEAT: number; + readonly NEAREST: number; + readonly NEAREST_MIPMAP_LINEAR: number; + readonly NEAREST_MIPMAP_NEAREST: number; + readonly NEVER: number; + readonly NICEST: number; + readonly NONE: number; + readonly NOTEQUAL: number; + readonly NO_ERROR: number; + readonly ONE: number; + readonly ONE_MINUS_CONSTANT_ALPHA: number; + readonly ONE_MINUS_CONSTANT_COLOR: number; + readonly ONE_MINUS_DST_ALPHA: number; + readonly ONE_MINUS_DST_COLOR: number; + readonly ONE_MINUS_SRC_ALPHA: number; + readonly ONE_MINUS_SRC_COLOR: number; + readonly OUT_OF_MEMORY: number; + readonly PACK_ALIGNMENT: number; + readonly POINTS: number; + readonly POLYGON_OFFSET_FACTOR: number; + readonly POLYGON_OFFSET_FILL: number; + readonly POLYGON_OFFSET_UNITS: number; + readonly RED_BITS: number; + readonly RENDERBUFFER: number; + readonly RENDERBUFFER_ALPHA_SIZE: number; + readonly RENDERBUFFER_BINDING: number; + readonly RENDERBUFFER_BLUE_SIZE: number; + readonly RENDERBUFFER_DEPTH_SIZE: number; + readonly RENDERBUFFER_GREEN_SIZE: number; + readonly RENDERBUFFER_HEIGHT: number; + readonly RENDERBUFFER_INTERNAL_FORMAT: number; + readonly RENDERBUFFER_RED_SIZE: number; + readonly RENDERBUFFER_STENCIL_SIZE: number; + readonly RENDERBUFFER_WIDTH: number; + readonly RENDERER: number; + readonly REPEAT: number; + readonly REPLACE: number; + readonly RGB: number; + readonly RGB565: number; + readonly RGB5_A1: number; + readonly RGBA: number; + readonly RGBA4: number; + readonly SAMPLER_2D: number; + readonly SAMPLER_CUBE: number; + readonly SAMPLES: number; + readonly SAMPLE_ALPHA_TO_COVERAGE: number; + readonly SAMPLE_BUFFERS: number; + readonly SAMPLE_COVERAGE: number; + readonly SAMPLE_COVERAGE_INVERT: number; + readonly SAMPLE_COVERAGE_VALUE: number; + readonly SCISSOR_BOX: number; + readonly SCISSOR_TEST: number; + readonly SHADER_TYPE: number; + readonly SHADING_LANGUAGE_VERSION: number; + readonly SHORT: number; + readonly SRC_ALPHA: number; + readonly SRC_ALPHA_SATURATE: number; + readonly SRC_COLOR: number; + readonly STATIC_DRAW: number; + readonly STENCIL_ATTACHMENT: number; + readonly STENCIL_BACK_FAIL: number; + readonly STENCIL_BACK_FUNC: number; + readonly STENCIL_BACK_PASS_DEPTH_FAIL: number; + readonly STENCIL_BACK_PASS_DEPTH_PASS: number; + readonly STENCIL_BACK_REF: number; + readonly STENCIL_BACK_VALUE_MASK: number; + readonly STENCIL_BACK_WRITEMASK: number; + readonly STENCIL_BITS: number; + readonly STENCIL_BUFFER_BIT: number; + readonly STENCIL_CLEAR_VALUE: number; + readonly STENCIL_FAIL: number; + readonly STENCIL_FUNC: number; + readonly STENCIL_INDEX: number; + readonly STENCIL_INDEX8: number; + readonly STENCIL_PASS_DEPTH_FAIL: number; + readonly STENCIL_PASS_DEPTH_PASS: number; + readonly STENCIL_REF: number; + readonly STENCIL_TEST: number; + readonly STENCIL_VALUE_MASK: number; + readonly STENCIL_WRITEMASK: number; + readonly STREAM_DRAW: number; + readonly SUBPIXEL_BITS: number; + readonly TEXTURE: number; + readonly TEXTURE0: number; + readonly TEXTURE1: number; + readonly TEXTURE10: number; + readonly TEXTURE11: number; + readonly TEXTURE12: number; + readonly TEXTURE13: number; + readonly TEXTURE14: number; + readonly TEXTURE15: number; + readonly TEXTURE16: number; + readonly TEXTURE17: number; + readonly TEXTURE18: number; + readonly TEXTURE19: number; + readonly TEXTURE2: number; + readonly TEXTURE20: number; + readonly TEXTURE21: number; + readonly TEXTURE22: number; + readonly TEXTURE23: number; + readonly TEXTURE24: number; + readonly TEXTURE25: number; + readonly TEXTURE26: number; + readonly TEXTURE27: number; + readonly TEXTURE28: number; + readonly TEXTURE29: number; + readonly TEXTURE3: number; + readonly TEXTURE30: number; + readonly TEXTURE31: number; + readonly TEXTURE4: number; + readonly TEXTURE5: number; + readonly TEXTURE6: number; + readonly TEXTURE7: number; + readonly TEXTURE8: number; + readonly TEXTURE9: number; + readonly TEXTURE_2D: number; + readonly TEXTURE_BINDING_2D: number; + readonly TEXTURE_BINDING_CUBE_MAP: number; + readonly TEXTURE_CUBE_MAP: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_X: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_Y: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_Z: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_X: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_Y: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_Z: number; + readonly TEXTURE_MAG_FILTER: number; + readonly TEXTURE_MIN_FILTER: number; + readonly TEXTURE_WRAP_S: number; + readonly TEXTURE_WRAP_T: number; + readonly TRIANGLES: number; + readonly TRIANGLE_FAN: number; + readonly TRIANGLE_STRIP: number; + readonly UNPACK_ALIGNMENT: number; + readonly UNPACK_COLORSPACE_CONVERSION_WEBGL: number; + readonly UNPACK_FLIP_Y_WEBGL: number; + readonly UNPACK_PREMULTIPLY_ALPHA_WEBGL: number; + readonly UNSIGNED_BYTE: number; + readonly UNSIGNED_INT: number; + readonly UNSIGNED_SHORT: number; + readonly UNSIGNED_SHORT_4_4_4_4: number; + readonly UNSIGNED_SHORT_5_5_5_1: number; + readonly UNSIGNED_SHORT_5_6_5: number; + readonly VALIDATE_STATUS: number; + readonly VENDOR: number; + readonly VERSION: number; + readonly VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number; + readonly VERTEX_ATTRIB_ARRAY_ENABLED: number; + readonly VERTEX_ATTRIB_ARRAY_NORMALIZED: number; + readonly VERTEX_ATTRIB_ARRAY_POINTER: number; + readonly VERTEX_ATTRIB_ARRAY_SIZE: number; + readonly VERTEX_ATTRIB_ARRAY_STRIDE: number; + readonly VERTEX_ATTRIB_ARRAY_TYPE: number; + readonly VERTEX_SHADER: number; + readonly VIEWPORT: number; + readonly ZERO: number; } interface WebGLShader extends WebGLObject { @@ -15726,9 +16825,9 @@ declare var WebGLShader: { } interface WebGLShaderPrecisionFormat { - precision: number; - rangeMax: number; - rangeMin: number; + readonly precision: number; + readonly rangeMax: number; + readonly rangeMin: number; } declare var WebGLShaderPrecisionFormat: { @@ -15804,21 +16903,21 @@ declare var WebKitPoint: { interface WebSocket extends EventTarget { binaryType: string; - bufferedAmount: number; - extensions: string; + readonly bufferedAmount: number; + readonly extensions: string; onclose: (ev: CloseEvent) => any; onerror: (ev: Event) => any; onmessage: (ev: MessageEvent) => any; onopen: (ev: Event) => any; - protocol: string; - readyState: number; - url: string; + readonly protocol: string; + readonly readyState: number; + readonly url: string; close(code?: number, reason?: string): void; send(data: any): void; - CLOSED: number; - CLOSING: number; - CONNECTING: number; - OPEN: number; + readonly CLOSED: number; + readonly CLOSING: number; + readonly CONNECTING: number; + readonly OPEN: number; addEventListener(type: "close", listener: (ev: CloseEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "message", listener: (ev: MessageEvent) => any, useCapture?: boolean): void; @@ -15829,56 +16928,58 @@ interface WebSocket extends EventTarget { declare var WebSocket: { prototype: WebSocket; new(url: string, protocols?: string | string[]): WebSocket; - CLOSED: number; - CLOSING: number; - CONNECTING: number; - OPEN: number; + readonly CLOSED: number; + readonly CLOSING: number; + readonly CONNECTING: number; + readonly OPEN: number; } interface WheelEvent extends MouseEvent { - deltaMode: number; - deltaX: number; - deltaY: number; - deltaZ: number; + readonly deltaMode: number; + readonly deltaX: number; + readonly deltaY: number; + readonly deltaZ: number; + readonly wheelDelta: number; + readonly wheelDeltaX: number; + readonly wheelDeltaY: number; getCurrentPoint(element: Element): void; initWheelEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, buttonArg: number, relatedTargetArg: EventTarget, modifiersListArg: string, deltaXArg: number, deltaYArg: number, deltaZArg: number, deltaMode: number): void; - DOM_DELTA_LINE: number; - DOM_DELTA_PAGE: number; - DOM_DELTA_PIXEL: number; + readonly DOM_DELTA_LINE: number; + readonly DOM_DELTA_PAGE: number; + readonly DOM_DELTA_PIXEL: number; } declare var WheelEvent: { prototype: WheelEvent; new(typeArg: string, eventInitDict?: WheelEventInit): WheelEvent; - DOM_DELTA_LINE: number; - DOM_DELTA_PAGE: number; - DOM_DELTA_PIXEL: number; + readonly DOM_DELTA_LINE: number; + readonly DOM_DELTA_PAGE: number; + readonly DOM_DELTA_PIXEL: number; } interface Window extends EventTarget, WindowTimers, WindowSessionStorage, WindowLocalStorage, WindowConsole, GlobalEventHandlers, IDBEnvironment, WindowBase64 { - animationStartTime: number; - applicationCache: ApplicationCache; - clientInformation: Navigator; - closed: boolean; - crypto: Crypto; + readonly applicationCache: ApplicationCache; + readonly clientInformation: Navigator; + readonly closed: boolean; + readonly crypto: Crypto; defaultStatus: string; - devicePixelRatio: number; - doNotTrack: string; - document: Document; + readonly devicePixelRatio: number; + readonly doNotTrack: string; + readonly document: Document; event: Event; - external: External; - frameElement: Element; - frames: Window; - history: History; - innerHeight: number; - innerWidth: number; - length: number; - location: Location; - locationbar: BarProp; - menubar: BarProp; - msAnimationStartTime: number; + readonly external: External; + readonly frameElement: Element; + readonly frames: Window; + readonly history: History; + readonly innerHeight: number; + readonly innerWidth: number; + readonly length: number; + readonly location: Location; + readonly locationbar: BarProp; + readonly menubar: BarProp; + readonly msCredentials: MSCredentials; name: string; - navigator: Navigator; + readonly navigator: Navigator; offscreenBuffering: string | boolean; onabort: (ev: Event) => any; onafterprint: (ev: Event) => any; @@ -15892,6 +16993,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window oncompassneedscalibration: (ev: Event) => any; oncontextmenu: (ev: PointerEvent) => any; ondblclick: (ev: MouseEvent) => any; + ondevicelight: (ev: DeviceLightEvent) => any; ondevicemotion: (ev: DeviceMotionEvent) => any; ondeviceorientation: (ev: DeviceOrientationEvent) => any; ondrag: (ev: DragEvent) => any; @@ -15903,11 +17005,12 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window ondrop: (ev: DragEvent) => any; ondurationchange: (ev: Event) => any; onemptied: (ev: Event) => any; - onended: (ev: Event) => any; + onended: (ev: MediaStreamErrorEvent) => any; onerror: ErrorEventHandler; onfocus: (ev: FocusEvent) => any; onhashchange: (ev: HashChangeEvent) => any; oninput: (ev: Event) => any; + oninvalid: (ev: Event) => any; onkeydown: (ev: KeyboardEvent) => any; onkeypress: (ev: KeyboardEvent) => any; onkeyup: (ev: KeyboardEvent) => any; @@ -15923,7 +17026,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window onmouseout: (ev: MouseEvent) => any; onmouseover: (ev: MouseEvent) => any; onmouseup: (ev: MouseEvent) => any; - onmousewheel: (ev: MouseWheelEvent) => any; + onmousewheel: (ev: WheelEvent) => any; onmsgesturechange: (ev: MSGestureEvent) => any; onmsgesturedoubletap: (ev: MSGestureEvent) => any; onmsgestureend: (ev: MSGestureEvent) => any; @@ -15962,38 +17065,38 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window onsubmit: (ev: Event) => any; onsuspend: (ev: Event) => any; ontimeupdate: (ev: Event) => any; - ontouchcancel: any; - ontouchend: any; - ontouchmove: any; - ontouchstart: any; + ontouchcancel: (ev: TouchEvent) => any; + ontouchend: (ev: TouchEvent) => any; + ontouchmove: (ev: TouchEvent) => any; + ontouchstart: (ev: TouchEvent) => any; onunload: (ev: Event) => any; onvolumechange: (ev: Event) => any; onwaiting: (ev: Event) => any; - opener: Window; + readonly opener: Window; orientation: string | number; - outerHeight: number; - outerWidth: number; - pageXOffset: number; - pageYOffset: number; - parent: Window; - performance: Performance; - personalbar: BarProp; - screen: Screen; - screenLeft: number; - screenTop: number; - screenX: number; - screenY: number; - scrollX: number; - scrollY: number; - scrollbars: BarProp; - self: Window; + readonly outerHeight: number; + readonly outerWidth: number; + readonly pageXOffset: number; + readonly pageYOffset: number; + readonly parent: Window; + readonly performance: Performance; + readonly personalbar: BarProp; + readonly screen: Screen; + readonly screenLeft: number; + readonly screenTop: number; + readonly screenX: number; + readonly screenY: number; + readonly scrollX: number; + readonly scrollY: number; + readonly scrollbars: BarProp; + readonly self: Window; status: string; - statusbar: BarProp; - styleMedia: StyleMedia; - toolbar: BarProp; - top: Window; - window: Window; - URL: URL; + readonly statusbar: BarProp; + readonly styleMedia: StyleMedia; + readonly toolbar: BarProp; + readonly top: Window; + readonly window: Window; + URL: typeof URL; alert(message?: any): void; blur(): void; cancelAnimationFrame(handle: number): void; @@ -16007,14 +17110,11 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window matchMedia(mediaQuery: string): MediaQueryList; moveBy(x?: number, y?: number): void; moveTo(x?: number, y?: number): void; - msCancelRequestAnimationFrame(handle: number): void; - msMatchMedia(mediaQuery: string): MediaQueryList; - msRequestAnimationFrame(callback: FrameRequestCallback): number; msWriteProfilerMark(profilerMarkName: string): void; - open(url?: string, target?: string, features?: string, replace?: boolean): any; - postMessage(message: any, targetOrigin: string, ports?: any): void; + open(url?: string, target?: string, features?: string, replace?: boolean): Window; + postMessage(message: any, targetOrigin: string, transfer?: any[]): void; print(): void; - prompt(message?: string, _default?: string): string; + prompt(message?: string, _default?: string): string | null; releaseEvents(): void; requestAnimationFrame(callback: FrameRequestCallback): number; resizeBy(x?: number, y?: number): void; @@ -16022,8 +17122,10 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window scroll(x?: number, y?: number): void; scrollBy(x?: number, y?: number): void; scrollTo(x?: number, y?: number): void; + webkitCancelAnimationFrame(handle: number): void; webkitConvertPointFromNodeToPage(node: Node, pt: WebKitPoint): WebKitPoint; webkitConvertPointFromPageToNode(node: Node, pt: WebKitPoint): WebKitPoint; + webkitRequestAnimationFrame(callback: FrameRequestCallback): number; addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; addEventListener(type: "MSGestureEnd", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; @@ -16051,6 +17153,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window addEventListener(type: "compassneedscalibration", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "devicelight", listener: (ev: DeviceLightEvent) => any, useCapture?: boolean): void; addEventListener(type: "devicemotion", listener: (ev: DeviceMotionEvent) => any, useCapture?: boolean): void; addEventListener(type: "deviceorientation", listener: (ev: DeviceOrientationEvent) => any, useCapture?: boolean): void; addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; @@ -16062,10 +17165,11 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "hashchange", listener: (ev: HashChangeEvent) => any, useCapture?: boolean): void; addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -16081,7 +17185,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; addEventListener(type: "offline", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "online", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "orientationchange", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -16151,20 +17255,19 @@ declare var XMLDocument: { interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget { msCaching: string; onreadystatechange: (ev: ProgressEvent) => any; - readyState: number; - response: any; - responseBody: any; - responseText: string; + readonly readyState: number; + readonly response: any; + readonly responseText: string; responseType: string; - responseXML: any; - status: number; - statusText: string; + readonly responseXML: any; + readonly status: number; + readonly statusText: string; timeout: number; - upload: XMLHttpRequestUpload; + readonly upload: XMLHttpRequestUpload; withCredentials: boolean; abort(): void; getAllResponseHeaders(): string; - getResponseHeader(header: string): string; + getResponseHeader(header: string): string | null; msCachingEnabled(): boolean; open(method: string, url: string, async?: boolean, user?: string, password?: string): void; overrideMimeType(mime: string): void; @@ -16172,11 +17275,11 @@ interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget { send(data?: string): void; send(data?: any): void; setRequestHeader(header: string, value: string): void; - DONE: number; - HEADERS_RECEIVED: number; - LOADING: number; - OPENED: number; - UNSENT: number; + readonly DONE: number; + readonly HEADERS_RECEIVED: number; + readonly LOADING: number; + readonly OPENED: number; + readonly UNSENT: number; addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -16191,11 +17294,11 @@ interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget { declare var XMLHttpRequest: { prototype: XMLHttpRequest; new(): XMLHttpRequest; - DONE: number; - HEADERS_RECEIVED: number; - LOADING: number; - OPENED: number; - UNSENT: number; + readonly DONE: number; + readonly HEADERS_RECEIVED: number; + readonly LOADING: number; + readonly OPENED: number; + readonly UNSENT: number; create(): XMLHttpRequest; } @@ -16247,40 +17350,40 @@ declare var XPathNSResolver: { } interface XPathResult { - booleanValue: boolean; - invalidIteratorState: boolean; - numberValue: number; - resultType: number; - singleNodeValue: Node; - snapshotLength: number; - stringValue: string; + readonly booleanValue: boolean; + readonly invalidIteratorState: boolean; + readonly numberValue: number; + readonly resultType: number; + readonly singleNodeValue: Node; + readonly snapshotLength: number; + readonly stringValue: string; iterateNext(): Node; snapshotItem(index: number): Node; - ANY_TYPE: number; - ANY_UNORDERED_NODE_TYPE: number; - BOOLEAN_TYPE: number; - FIRST_ORDERED_NODE_TYPE: number; - NUMBER_TYPE: number; - ORDERED_NODE_ITERATOR_TYPE: number; - ORDERED_NODE_SNAPSHOT_TYPE: number; - STRING_TYPE: number; - UNORDERED_NODE_ITERATOR_TYPE: number; - UNORDERED_NODE_SNAPSHOT_TYPE: number; + readonly ANY_TYPE: number; + readonly ANY_UNORDERED_NODE_TYPE: number; + readonly BOOLEAN_TYPE: number; + readonly FIRST_ORDERED_NODE_TYPE: number; + readonly NUMBER_TYPE: number; + readonly ORDERED_NODE_ITERATOR_TYPE: number; + readonly ORDERED_NODE_SNAPSHOT_TYPE: number; + readonly STRING_TYPE: number; + readonly UNORDERED_NODE_ITERATOR_TYPE: number; + readonly UNORDERED_NODE_SNAPSHOT_TYPE: number; } declare var XPathResult: { prototype: XPathResult; new(): XPathResult; - ANY_TYPE: number; - ANY_UNORDERED_NODE_TYPE: number; - BOOLEAN_TYPE: number; - FIRST_ORDERED_NODE_TYPE: number; - NUMBER_TYPE: number; - ORDERED_NODE_ITERATOR_TYPE: number; - ORDERED_NODE_SNAPSHOT_TYPE: number; - STRING_TYPE: number; - UNORDERED_NODE_ITERATOR_TYPE: number; - UNORDERED_NODE_SNAPSHOT_TYPE: number; + readonly ANY_TYPE: number; + readonly ANY_UNORDERED_NODE_TYPE: number; + readonly BOOLEAN_TYPE: number; + readonly FIRST_ORDERED_NODE_TYPE: number; + readonly NUMBER_TYPE: number; + readonly ORDERED_NODE_ITERATOR_TYPE: number; + readonly ORDERED_NODE_SNAPSHOT_TYPE: number; + readonly STRING_TYPE: number; + readonly UNORDERED_NODE_ITERATOR_TYPE: number; + readonly UNORDERED_NODE_SNAPSHOT_TYPE: number; } interface XSLTProcessor { @@ -16305,6 +17408,18 @@ interface AbstractWorker { addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } +interface CanvasPathMethods { + arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void; + arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void; + bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void; + closePath(): void; + ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void; + lineTo(x: number, y: number): void; + moveTo(x: number, y: number): void; + quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void; + rect(x: number, y: number, w: number, h: number): void; +} + interface ChildNode { remove(): void; } @@ -16327,6 +17442,7 @@ interface DocumentEvent { createEvent(eventInterface:"CommandEvent"): CommandEvent; createEvent(eventInterface:"CompositionEvent"): CompositionEvent; createEvent(eventInterface:"CustomEvent"): CustomEvent; + createEvent(eventInterface:"DeviceLightEvent"): DeviceLightEvent; createEvent(eventInterface:"DeviceMotionEvent"): DeviceMotionEvent; createEvent(eventInterface:"DeviceOrientationEvent"): DeviceOrientationEvent; createEvent(eventInterface:"DragEvent"): DragEvent; @@ -16338,6 +17454,7 @@ interface DocumentEvent { createEvent(eventInterface:"HashChangeEvent"): HashChangeEvent; createEvent(eventInterface:"IDBVersionChangeEvent"): IDBVersionChangeEvent; createEvent(eventInterface:"KeyboardEvent"): KeyboardEvent; + createEvent(eventInterface:"ListeningStateChangedEvent"): ListeningStateChangedEvent; createEvent(eventInterface:"LongRunningScriptDetectedEvent"): LongRunningScriptDetectedEvent; createEvent(eventInterface:"MSGestureEvent"): MSGestureEvent; createEvent(eventInterface:"MSManipulationEvent"): MSManipulationEvent; @@ -16345,21 +17462,31 @@ interface DocumentEvent { createEvent(eventInterface:"MSMediaKeyNeededEvent"): MSMediaKeyNeededEvent; createEvent(eventInterface:"MSPointerEvent"): MSPointerEvent; createEvent(eventInterface:"MSSiteModeEvent"): MSSiteModeEvent; + createEvent(eventInterface:"MediaEncryptedEvent"): MediaEncryptedEvent; + createEvent(eventInterface:"MediaKeyMessageEvent"): MediaKeyMessageEvent; + createEvent(eventInterface:"MediaStreamErrorEvent"): MediaStreamErrorEvent; + createEvent(eventInterface:"MediaStreamTrackEvent"): MediaStreamTrackEvent; createEvent(eventInterface:"MessageEvent"): MessageEvent; createEvent(eventInterface:"MouseEvent"): MouseEvent; createEvent(eventInterface:"MouseEvents"): MouseEvent; - createEvent(eventInterface:"MouseWheelEvent"): MouseWheelEvent; createEvent(eventInterface:"MutationEvent"): MutationEvent; createEvent(eventInterface:"MutationEvents"): MutationEvent; createEvent(eventInterface:"NavigationCompletedEvent"): NavigationCompletedEvent; createEvent(eventInterface:"NavigationEvent"): NavigationEvent; createEvent(eventInterface:"NavigationEventWithReferrer"): NavigationEventWithReferrer; createEvent(eventInterface:"OfflineAudioCompletionEvent"): OfflineAudioCompletionEvent; + createEvent(eventInterface:"OverflowEvent"): OverflowEvent; createEvent(eventInterface:"PageTransitionEvent"): PageTransitionEvent; createEvent(eventInterface:"PermissionRequestedEvent"): PermissionRequestedEvent; createEvent(eventInterface:"PointerEvent"): PointerEvent; createEvent(eventInterface:"PopStateEvent"): PopStateEvent; createEvent(eventInterface:"ProgressEvent"): ProgressEvent; + createEvent(eventInterface:"RTCDTMFToneChangeEvent"): RTCDTMFToneChangeEvent; + createEvent(eventInterface:"RTCDtlsTransportStateChangedEvent"): RTCDtlsTransportStateChangedEvent; + createEvent(eventInterface:"RTCIceCandidatePairChangedEvent"): RTCIceCandidatePairChangedEvent; + createEvent(eventInterface:"RTCIceGathererEvent"): RTCIceGathererEvent; + createEvent(eventInterface:"RTCIceTransportStateChangedEvent"): RTCIceTransportStateChangedEvent; + createEvent(eventInterface:"RTCSsrcConflictEvent"): RTCSsrcConflictEvent; createEvent(eventInterface:"SVGZoomEvent"): SVGZoomEvent; createEvent(eventInterface:"SVGZoomEvents"): SVGZoomEvent; createEvent(eventInterface:"ScriptNotifyEvent"): ScriptNotifyEvent; @@ -16377,11 +17504,11 @@ interface DocumentEvent { } interface ElementTraversal { - childElementCount: number; - firstElementChild: Element; - lastElementChild: Element; - nextElementSibling: Element; - previousElementSibling: Element; + readonly childElementCount: number; + readonly firstElementChild: Element; + readonly lastElementChild: Element; + readonly nextElementSibling: Element; + readonly previousElementSibling: Element; } interface GetSVGDocument { @@ -16426,12 +17553,11 @@ interface HTMLTableAlignment { } interface IDBEnvironment { - indexedDB: IDBFactory; - msIndexedDB: IDBFactory; + readonly indexedDB: IDBFactory; } interface LinkStyle { - sheet: StyleSheet; + readonly sheet: StyleSheet; } interface MSBaseReader { @@ -16441,12 +17567,12 @@ interface MSBaseReader { onloadend: (ev: ProgressEvent) => any; onloadstart: (ev: Event) => any; onprogress: (ev: ProgressEvent) => any; - readyState: number; - result: any; + readonly readyState: number; + readonly result: any; abort(): void; - DONE: number; - EMPTY: number; - LOADING: number; + readonly DONE: number; + readonly EMPTY: number; + readonly LOADING: number; addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -16474,27 +17600,32 @@ interface NavigatorContentUtils { } interface NavigatorGeolocation { - geolocation: Geolocation; + readonly geolocation: Geolocation; } interface NavigatorID { - appName: string; - appVersion: string; - platform: string; - product: string; - productSub: string; - userAgent: string; - vendor: string; - vendorSub: string; + readonly appName: string; + readonly appVersion: string; + readonly platform: string; + readonly product: string; + readonly productSub: string; + readonly userAgent: string; + readonly vendor: string; + readonly vendorSub: string; } interface NavigatorOnLine { - onLine: boolean; + readonly onLine: boolean; } interface NavigatorStorageUtils { } +interface NavigatorUserMedia { + readonly mediaDevices: MediaDevices; + getUserMedia(constraints: MediaStreamConstraints, successCallback: NavigatorUserMediaSuccessCallback, errorCallback: NavigatorUserMediaErrorCallback): void; +} + interface NodeSelector { querySelector(selectors: string): Element; querySelectorAll(selectors: string): NodeListOf; @@ -16505,29 +17636,29 @@ interface RandomSource { } interface SVGAnimatedPathData { - pathSegList: SVGPathSegList; + readonly pathSegList: SVGPathSegList; } interface SVGAnimatedPoints { - animatedPoints: SVGPointList; - points: SVGPointList; + readonly animatedPoints: SVGPointList; + readonly points: SVGPointList; } interface SVGExternalResourcesRequired { - externalResourcesRequired: SVGAnimatedBoolean; + readonly externalResourcesRequired: SVGAnimatedBoolean; } interface SVGFilterPrimitiveStandardAttributes extends SVGStylable { - height: SVGAnimatedLength; - result: SVGAnimatedString; - width: SVGAnimatedLength; - x: SVGAnimatedLength; - y: SVGAnimatedLength; + readonly height: SVGAnimatedLength; + readonly result: SVGAnimatedString; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; } interface SVGFitToViewBox { - preserveAspectRatio: SVGAnimatedPreserveAspectRatio; - viewBox: SVGAnimatedRect; + readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio; + readonly viewBox: SVGAnimatedRect; } interface SVGLangSpace { @@ -16536,8 +17667,8 @@ interface SVGLangSpace { } interface SVGLocatable { - farthestViewportElement: SVGElement; - nearestViewportElement: SVGElement; + readonly farthestViewportElement: SVGElement; + readonly nearestViewportElement: SVGElement; getBBox(): SVGRect; getCTM(): SVGMatrix; getScreenCTM(): SVGMatrix; @@ -16546,22 +17677,22 @@ interface SVGLocatable { interface SVGStylable { className: any; - style: CSSStyleDeclaration; + readonly style: CSSStyleDeclaration; } interface SVGTests { - requiredExtensions: SVGStringList; - requiredFeatures: SVGStringList; - systemLanguage: SVGStringList; + readonly requiredExtensions: SVGStringList; + readonly requiredFeatures: SVGStringList; + readonly systemLanguage: SVGStringList; hasExtension(extension: string): boolean; } interface SVGTransformable extends SVGLocatable { - transform: SVGAnimatedTransformList; + readonly transform: SVGAnimatedTransformList; } interface SVGURIReference { - href: SVGAnimatedString; + readonly href: SVGAnimatedString; } interface WindowBase64 { @@ -16570,15 +17701,15 @@ interface WindowBase64 { } interface WindowConsole { - console: Console; + readonly console: Console; } interface WindowLocalStorage { - localStorage: Storage; + readonly localStorage: Storage; } interface WindowSessionStorage { - sessionStorage: Storage; + readonly sessionStorage: Storage; } interface WindowTimers extends Object, WindowTimersExtension { @@ -16590,8 +17721,6 @@ interface WindowTimers extends Object, WindowTimersExtension { interface WindowTimersExtension { clearImmediate(handle: number): void; - msClearImmediate(handle: number): void; - msSetImmediate(expression: any, ...args: any[]): number; setImmediate(expression: any, ...args: any[]): number; } @@ -16613,12 +17742,26 @@ interface XMLHttpRequestEventTarget { addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } +interface StorageEventInit extends EventInit { + key?: string; + oldValue?: string; + newValue?: string; + url: string; + storageArea?: Storage; +} + interface NodeListOf extends NodeList { length: number; item(index: number): TNode; [index: number]: TNode; } +interface HTMLCollectionOf extends HTMLCollection { + item(index: number): T; + namedItem(name: string): T; + [index: number]: T; +} + interface BlobPropertyBag { type?: string; endings?: string; @@ -16648,6 +17791,14 @@ interface ProgressEventInit extends EventInit { total?: number; } +interface ClipboardEventInit extends EventInit { + data?: string; + dataType?: string; +} + +interface IDBArrayKey extends Array { +} + declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject; interface ErrorEventHandler { @@ -16681,15 +17832,23 @@ interface DecodeSuccessCallback { (decodedData: AudioBuffer): void; } interface DecodeErrorCallback { - (): void; + (error: DOMException): void; } interface FunctionStringCallback { (data: string): void; } +interface NavigatorUserMediaSuccessCallback { + (stream: MediaStream): void; +} +interface NavigatorUserMediaErrorCallback { + (error: MediaStreamError): void; +} +interface ForEachCallback { + (keyId: any, status: string): void; +} declare var Audio: {new(src?: string): HTMLAudioElement; }; declare var Image: {new(width?: number, height?: number): HTMLImageElement; }; declare var Option: {new(text?: string, value?: string, defaultSelected?: boolean, selected?: boolean): HTMLOptionElement; }; -declare var animationStartTime: number; declare var applicationCache: ApplicationCache; declare var clientInformation: Navigator; declare var closed: boolean; @@ -16709,7 +17868,7 @@ declare var length: number; declare var location: Location; declare var locationbar: BarProp; declare var menubar: BarProp; -declare var msAnimationStartTime: number; +declare var msCredentials: MSCredentials; declare var name: string; declare var navigator: Navigator; declare var offscreenBuffering: string | boolean; @@ -16725,6 +17884,7 @@ declare var onclick: (ev: MouseEvent) => any; declare var oncompassneedscalibration: (ev: Event) => any; declare var oncontextmenu: (ev: PointerEvent) => any; declare var ondblclick: (ev: MouseEvent) => any; +declare var ondevicelight: (ev: DeviceLightEvent) => any; declare var ondevicemotion: (ev: DeviceMotionEvent) => any; declare var ondeviceorientation: (ev: DeviceOrientationEvent) => any; declare var ondrag: (ev: DragEvent) => any; @@ -16736,11 +17896,12 @@ declare var ondragstart: (ev: DragEvent) => any; declare var ondrop: (ev: DragEvent) => any; declare var ondurationchange: (ev: Event) => any; declare var onemptied: (ev: Event) => any; -declare var onended: (ev: Event) => any; +declare var onended: (ev: MediaStreamErrorEvent) => any; declare var onerror: ErrorEventHandler; declare var onfocus: (ev: FocusEvent) => any; declare var onhashchange: (ev: HashChangeEvent) => any; declare var oninput: (ev: Event) => any; +declare var oninvalid: (ev: Event) => any; declare var onkeydown: (ev: KeyboardEvent) => any; declare var onkeypress: (ev: KeyboardEvent) => any; declare var onkeyup: (ev: KeyboardEvent) => any; @@ -16756,7 +17917,7 @@ declare var onmousemove: (ev: MouseEvent) => any; declare var onmouseout: (ev: MouseEvent) => any; declare var onmouseover: (ev: MouseEvent) => any; declare var onmouseup: (ev: MouseEvent) => any; -declare var onmousewheel: (ev: MouseWheelEvent) => any; +declare var onmousewheel: (ev: WheelEvent) => any; declare var onmsgesturechange: (ev: MSGestureEvent) => any; declare var onmsgesturedoubletap: (ev: MSGestureEvent) => any; declare var onmsgestureend: (ev: MSGestureEvent) => any; @@ -16795,10 +17956,10 @@ declare var onstorage: (ev: StorageEvent) => any; declare var onsubmit: (ev: Event) => any; declare var onsuspend: (ev: Event) => any; declare var ontimeupdate: (ev: Event) => any; -declare var ontouchcancel: any; -declare var ontouchend: any; -declare var ontouchmove: any; -declare var ontouchstart: any; +declare var ontouchcancel: (ev: TouchEvent) => any; +declare var ontouchend: (ev: TouchEvent) => any; +declare var ontouchmove: (ev: TouchEvent) => any; +declare var ontouchstart: (ev: TouchEvent) => any; declare var onunload: (ev: Event) => any; declare var onvolumechange: (ev: Event) => any; declare var onwaiting: (ev: Event) => any; @@ -16826,7 +17987,6 @@ declare var styleMedia: StyleMedia; declare var toolbar: BarProp; declare var top: Window; declare var window: Window; -declare var URL: URL; declare function alert(message?: any): void; declare function blur(): void; declare function cancelAnimationFrame(handle: number): void; @@ -16840,14 +18000,11 @@ declare function getSelection(): Selection; declare function matchMedia(mediaQuery: string): MediaQueryList; declare function moveBy(x?: number, y?: number): void; declare function moveTo(x?: number, y?: number): void; -declare function msCancelRequestAnimationFrame(handle: number): void; -declare function msMatchMedia(mediaQuery: string): MediaQueryList; -declare function msRequestAnimationFrame(callback: FrameRequestCallback): number; declare function msWriteProfilerMark(profilerMarkName: string): void; -declare function open(url?: string, target?: string, features?: string, replace?: boolean): any; -declare function postMessage(message: any, targetOrigin: string, ports?: any): void; +declare function open(url?: string, target?: string, features?: string, replace?: boolean): Window; +declare function postMessage(message: any, targetOrigin: string, transfer?: any[]): void; declare function print(): void; -declare function prompt(message?: string, _default?: string): string; +declare function prompt(message?: string, _default?: string): string | null; declare function releaseEvents(): void; declare function requestAnimationFrame(callback: FrameRequestCallback): number; declare function resizeBy(x?: number, y?: number): void; @@ -16855,19 +18012,19 @@ declare function resizeTo(x?: number, y?: number): void; declare function scroll(x?: number, y?: number): void; declare function scrollBy(x?: number, y?: number): void; declare function scrollTo(x?: number, y?: number): void; +declare function webkitCancelAnimationFrame(handle: number): void; declare function webkitConvertPointFromNodeToPage(node: Node, pt: WebKitPoint): WebKitPoint; declare function webkitConvertPointFromPageToNode(node: Node, pt: WebKitPoint): WebKitPoint; +declare function webkitRequestAnimationFrame(callback: FrameRequestCallback): number; declare function toString(): string; -declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +declare function addEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; declare function dispatchEvent(evt: Event): boolean; -declare function removeEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +declare function removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; declare function clearInterval(handle: number): void; declare function clearTimeout(handle: number): void; declare function setInterval(handler: any, timeout?: any, ...args: any[]): number; declare function setTimeout(handler: any, timeout?: any, ...args: any[]): number; declare function clearImmediate(handle: number): void; -declare function msClearImmediate(handle: number): void; -declare function msSetImmediate(expression: any, ...args: any[]): number; declare function setImmediate(expression: any, ...args: any[]): number; declare var sessionStorage: Storage; declare var localStorage: Storage; @@ -16882,7 +18039,6 @@ declare var onpointerover: (ev: PointerEvent) => any; declare var onpointerup: (ev: PointerEvent) => any; declare var onwheel: (ev: WheelEvent) => any; declare var indexedDB: IDBFactory; -declare var msIndexedDB: IDBFactory; declare function atob(encodedString: string): string; declare function btoa(rawString: string): string; declare function addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; @@ -16912,6 +18068,7 @@ declare function addEventListener(type: "click", listener: (ev: MouseEvent) => a declare function addEventListener(type: "compassneedscalibration", listener: (ev: Event) => any, useCapture?: boolean): void; declare function addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "devicelight", listener: (ev: DeviceLightEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "devicemotion", listener: (ev: DeviceMotionEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "deviceorientation", listener: (ev: DeviceOrientationEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; @@ -16923,10 +18080,11 @@ declare function addEventListener(type: "dragstart", listener: (ev: DragEvent) = declare function addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; declare function addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "hashchange", listener: (ev: HashChangeEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; declare function addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -16942,7 +18100,7 @@ declare function addEventListener(type: "mousemove", listener: (ev: MouseEvent) declare function addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "offline", listener: (ev: Event) => any, useCapture?: boolean): void; declare function addEventListener(type: "online", listener: (ev: Event) => any, useCapture?: boolean): void; declare function addEventListener(type: "orientationchange", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -16979,6 +18137,38 @@ declare function addEventListener(type: "volumechange", listener: (ev: Event) => declare function addEventListener(type: "waiting", listener: (ev: Event) => any, useCapture?: boolean): void; declare function addEventListener(type: "wheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +type AAGUID = string; +type AlgorithmIdentifier = string | Algorithm; +type ConstrainBoolean = boolean | ConstrainBooleanParameters; +type ConstrainDOMString = string | string[] | ConstrainDOMStringParameters; +type ConstrainDouble = number | ConstrainDoubleRange; +type ConstrainLong = number | ConstrainLongRange; +type CryptoOperationData = ArrayBufferView; +type GLbitfield = number; +type GLboolean = boolean; +type GLbyte = number; +type GLclampf = number; +type GLenum = number; +type GLfloat = number; +type GLint = number; +type GLintptr = number; +type GLshort = number; +type GLsizei = number; +type GLsizeiptr = number; +type GLubyte = number; +type GLuint = number; +type GLushort = number; +type IDBKeyPath = string; +type KeyFormat = string; +type KeyType = string; +type KeyUsage = string; +type MSInboundPayload = MSVideoRecvPayload | MSAudioRecvPayload; +type MSLocalClientEvent = MSLocalClientEventBase | MSAudioLocalClientEvent; +type MSOutboundPayload = MSVideoSendPayload | MSAudioSendPayload; +type RTCIceGatherCandidate = RTCIceCandidate | RTCIceCandidateComplete; +type RTCTransport = RTCDtlsTransport | RTCSrtpSdesTransport; +type payloadtype = number; +type IDBValidKey = number | string | Date | IDBArrayKey; ///////////////////////////// /// WorkerGlobalScope APIs ///////////////////////////// diff --git a/lib/lib.dom.d.ts b/lib/lib.dom.d.ts index 69014415c15..673bd34ee3c 100644 --- a/lib/lib.dom.d.ts +++ b/lib/lib.dom.d.ts @@ -13,208 +13,7 @@ See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ -/// -///////////////////////////// -/// ECMAScript Internationalization API -///////////////////////////// - -declare module Intl { - interface CollatorOptions { - usage?: string; - localeMatcher?: string; - numeric?: boolean; - caseFirst?: string; - sensitivity?: string; - ignorePunctuation?: boolean; - } - - interface ResolvedCollatorOptions { - locale: string; - usage: string; - sensitivity: string; - ignorePunctuation: boolean; - collation: string; - caseFirst: string; - numeric: boolean; - } - - interface Collator { - compare(x: string, y: string): number; - resolvedOptions(): ResolvedCollatorOptions; - } - var Collator: { - new (locales?: string[], options?: CollatorOptions): Collator; - new (locale?: string, options?: CollatorOptions): Collator; - (locales?: string[], options?: CollatorOptions): Collator; - (locale?: string, options?: CollatorOptions): Collator; - supportedLocalesOf(locales: string[], options?: CollatorOptions): string[]; - supportedLocalesOf(locale: string, options?: CollatorOptions): string[]; - } - - interface NumberFormatOptions { - localeMatcher?: string; - style?: string; - currency?: string; - currencyDisplay?: string; - useGrouping?: boolean; - minimumIntegerDigits?: number; - minimumFractionDigits?: number; - maximumFractionDigits?: number; - minimumSignificantDigits?: number; - maximumSignificantDigits?: number; - } - - interface ResolvedNumberFormatOptions { - locale: string; - numberingSystem: string; - style: string; - currency?: string; - currencyDisplay?: string; - minimumIntegerDigits: number; - minimumFractionDigits: number; - maximumFractionDigits: number; - minimumSignificantDigits?: number; - maximumSignificantDigits?: number; - useGrouping: boolean; - } - - interface NumberFormat { - format(value: number): string; - resolvedOptions(): ResolvedNumberFormatOptions; - } - var NumberFormat: { - new (locales?: string[], options?: NumberFormatOptions): NumberFormat; - new (locale?: string, options?: NumberFormatOptions): NumberFormat; - (locales?: string[], options?: NumberFormatOptions): NumberFormat; - (locale?: string, options?: NumberFormatOptions): NumberFormat; - supportedLocalesOf(locales: string[], options?: NumberFormatOptions): string[]; - supportedLocalesOf(locale: string, options?: NumberFormatOptions): string[]; - } - - interface DateTimeFormatOptions { - localeMatcher?: string; - weekday?: string; - era?: string; - year?: string; - month?: string; - day?: string; - hour?: string; - minute?: string; - second?: string; - timeZoneName?: string; - formatMatcher?: string; - hour12?: boolean; - timeZone?: string; - } - - interface ResolvedDateTimeFormatOptions { - locale: string; - calendar: string; - numberingSystem: string; - timeZone: string; - hour12?: boolean; - weekday?: string; - era?: string; - year?: string; - month?: string; - day?: string; - hour?: string; - minute?: string; - second?: string; - timeZoneName?: string; - } - - interface DateTimeFormat { - format(date?: Date | number): string; - resolvedOptions(): ResolvedDateTimeFormatOptions; - } - var DateTimeFormat: { - new (locales?: string[], options?: DateTimeFormatOptions): DateTimeFormat; - new (locale?: string, options?: DateTimeFormatOptions): DateTimeFormat; - (locales?: string[], options?: DateTimeFormatOptions): DateTimeFormat; - (locale?: string, options?: DateTimeFormatOptions): DateTimeFormat; - supportedLocalesOf(locales: string[], options?: DateTimeFormatOptions): string[]; - supportedLocalesOf(locale: string, options?: DateTimeFormatOptions): string[]; - } -} - -interface String { - /** - * Determines whether two strings are equivalent in the current locale. - * @param that String to compare to target string - * @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. This parameter must conform to BCP 47 standards; see the Intl.Collator object for details. - * @param options An object that contains one or more properties that specify comparison options. see the Intl.Collator object for details. - */ - localeCompare(that: string, locales: string[], options?: Intl.CollatorOptions): number; - - /** - * Determines whether two strings are equivalent in the current locale. - * @param that String to compare to target string - * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. This parameter must conform to BCP 47 standards; see the Intl.Collator object for details. - * @param options An object that contains one or more properties that specify comparison options. see the Intl.Collator object for details. - */ - localeCompare(that: string, locale: string, options?: Intl.CollatorOptions): number; -} - -interface Number { - /** - * Converts a number to a string by using the current or specified locale. - * @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleString(locales?: string[], options?: Intl.NumberFormatOptions): string; - - /** - * Converts a number to a string by using the current or specified locale. - * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleString(locale?: string, options?: Intl.NumberFormatOptions): string; -} - -interface Date { - /** - * Converts a date and time to a string by using the current or specified locale. - * @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleString(locales?: string[], options?: Intl.DateTimeFormatOptions): string; - /** - * Converts a date to a string by using the current or specified locale. - * @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleDateString(locales?: string[], options?: Intl.DateTimeFormatOptions): string; - - /** - * Converts a time to a string by using the current or specified locale. - * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleTimeString(locale?: string[], options?: Intl.DateTimeFormatOptions): string; - - /** - * Converts a date and time to a string by using the current or specified locale. - * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleString(locale?: string, options?: Intl.DateTimeFormatOptions): string; - - /** - * Converts a date to a string by using the current or specified locale. - * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleDateString(locale?: string, options?: Intl.DateTimeFormatOptions): string; - - /** - * Converts a time to a string by using the current or specified locale. - * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleTimeString(locale?: string, options?: Intl.DateTimeFormatOptions): string; -} - +/// ///////////////////////////// /// IE DOM APIs @@ -229,11 +28,6 @@ interface AriaRequestEventInit extends EventInit { attributeValue?: string; } -interface ClipboardEventInit extends EventInit { - data?: string; - dataType?: string; -} - interface CommandEventInit extends EventInit { commandName?: string; detail?: string; @@ -247,6 +41,31 @@ interface ConfirmSiteSpecificExceptionsInformation extends ExceptionInformation arrayOfDomainStrings?: string[]; } +interface ConstrainBooleanParameters { + exact?: boolean; + ideal?: boolean; +} + +interface ConstrainDOMStringParameters { + exact?: string | string[]; + ideal?: string | string[]; +} + +interface ConstrainDoubleRange extends DoubleRange { + exact?: number; + ideal?: number; +} + +interface ConstrainLongRange extends LongRange { + exact?: number; + ideal?: number; +} + +interface ConstrainVideoFacingModeParameters { + exact?: string | string[]; + ideal?: string | string[]; +} + interface CustomEventInit extends EventInit { detail?: any; } @@ -257,17 +76,44 @@ interface DeviceAccelerationDict { z?: number; } +interface DeviceLightEventInit extends EventInit { + value?: number; +} + interface DeviceRotationRateDict { alpha?: number; beta?: number; gamma?: number; } +interface DoubleRange { + max?: number; + min?: number; +} + interface EventInit { bubbles?: boolean; cancelable?: boolean; } +interface EventModifierInit extends UIEventInit { + ctrlKey?: boolean; + shiftKey?: boolean; + altKey?: boolean; + metaKey?: boolean; + modifierAltGraph?: boolean; + modifierCapsLock?: boolean; + modifierFn?: boolean; + modifierFnLock?: boolean; + modifierHyper?: boolean; + modifierNumLock?: boolean; + modifierOS?: boolean; + modifierScrollLock?: boolean; + modifierSuper?: boolean; + modifierSymbol?: boolean; + modifierSymbolLock?: boolean; +} + interface ExceptionInformation { domain?: string; } @@ -281,17 +127,415 @@ interface HashChangeEventInit extends EventInit { oldURL?: string; } +interface IDBIndexParameters { + multiEntry?: boolean; + unique?: boolean; +} + +interface IDBObjectStoreParameters { + autoIncrement?: boolean; + keyPath?: IDBKeyPath; +} + interface KeyAlgorithm { name?: string; } -interface KeyboardEventInit extends SharedKeyboardAndMouseEventInit { +interface KeyboardEventInit extends EventModifierInit { key?: string; location?: number; repeat?: boolean; } -interface MouseEventInit extends SharedKeyboardAndMouseEventInit { +interface LongRange { + max?: number; + min?: number; +} + +interface MSAccountInfo { + rpDisplayName?: string; + userDisplayName?: string; + accountName?: string; + userId?: string; + accountImageUri?: string; +} + +interface MSAudioLocalClientEvent extends MSLocalClientEventBase { + networkSendQualityEventRatio?: number; + networkDelayEventRatio?: number; + cpuInsufficientEventRatio?: number; + deviceHalfDuplexAECEventRatio?: number; + deviceRenderNotFunctioningEventRatio?: number; + deviceCaptureNotFunctioningEventRatio?: number; + deviceGlitchesEventRatio?: number; + deviceLowSNREventRatio?: number; + deviceLowSpeechLevelEventRatio?: number; + deviceClippingEventRatio?: number; + deviceEchoEventRatio?: number; + deviceNearEndToEchoRatioEventRatio?: number; + deviceRenderZeroVolumeEventRatio?: number; + deviceRenderMuteEventRatio?: number; + deviceMultipleEndpointsEventCount?: number; + deviceHowlingEventCount?: number; +} + +interface MSAudioRecvPayload extends MSPayloadBase { + samplingRate?: number; + signal?: MSAudioRecvSignal; + packetReorderRatio?: number; + packetReorderDepthAvg?: number; + packetReorderDepthMax?: number; + burstLossLength1?: number; + burstLossLength2?: number; + burstLossLength3?: number; + burstLossLength4?: number; + burstLossLength5?: number; + burstLossLength6?: number; + burstLossLength7?: number; + burstLossLength8OrHigher?: number; + fecRecvDistance1?: number; + fecRecvDistance2?: number; + fecRecvDistance3?: number; + ratioConcealedSamplesAvg?: number; + ratioStretchedSamplesAvg?: number; + ratioCompressedSamplesAvg?: number; +} + +interface MSAudioRecvSignal { + initialSignalLevelRMS?: number; + recvSignalLevelCh1?: number; + recvNoiseLevelCh1?: number; + renderSignalLevel?: number; + renderNoiseLevel?: number; + renderLoopbackSignalLevel?: number; +} + +interface MSAudioSendPayload extends MSPayloadBase { + samplingRate?: number; + signal?: MSAudioSendSignal; + audioFECUsed?: boolean; + sendMutePercent?: number; +} + +interface MSAudioSendSignal { + noiseLevel?: number; + sendSignalLevelCh1?: number; + sendNoiseLevelCh1?: number; +} + +interface MSConnectivity { + iceType?: string; + iceWarningFlags?: MSIceWarningFlags; + relayAddress?: MSRelayAddress; +} + +interface MSCredentialFilter { + accept?: MSCredentialSpec[]; +} + +interface MSCredentialParameters { + type?: string; +} + +interface MSCredentialSpec { + type?: string; + id?: string; +} + +interface MSDelay { + roundTrip?: number; + roundTripMax?: number; +} + +interface MSDescription extends RTCStats { + connectivity?: MSConnectivity; + transport?: string; + networkconnectivity?: MSNetworkConnectivityInfo; + localAddr?: MSIPAddressInfo; + remoteAddr?: MSIPAddressInfo; + deviceDevName?: string; + reflexiveLocalIPAddr?: MSIPAddressInfo; +} + +interface MSFIDOCredentialParameters extends MSCredentialParameters { + algorithm?: string | Algorithm; + authenticators?: AAGUID[]; +} + +interface MSIPAddressInfo { + ipAddr?: string; + port?: number; + manufacturerMacAddrMask?: string; +} + +interface MSIceWarningFlags { + turnTcpTimedOut?: boolean; + turnUdpAllocateFailed?: boolean; + turnUdpSendFailed?: boolean; + turnTcpAllocateFailed?: boolean; + turnTcpSendFailed?: boolean; + udpLocalConnectivityFailed?: boolean; + udpNatConnectivityFailed?: boolean; + udpRelayConnectivityFailed?: boolean; + tcpNatConnectivityFailed?: boolean; + tcpRelayConnectivityFailed?: boolean; + connCheckMessageIntegrityFailed?: boolean; + allocationMessageIntegrityFailed?: boolean; + connCheckOtherError?: boolean; + turnAuthUnknownUsernameError?: boolean; + noRelayServersConfigured?: boolean; + multipleRelayServersAttempted?: boolean; + portRangeExhausted?: boolean; + alternateServerReceived?: boolean; + pseudoTLSFailure?: boolean; + turnTurnTcpConnectivityFailed?: boolean; + useCandidateChecksFailed?: boolean; + fipsAllocationFailure?: boolean; +} + +interface MSJitter { + interArrival?: number; + interArrivalMax?: number; + interArrivalSD?: number; +} + +interface MSLocalClientEventBase extends RTCStats { + networkReceiveQualityEventRatio?: number; + networkBandwidthLowEventRatio?: number; +} + +interface MSNetwork extends RTCStats { + jitter?: MSJitter; + delay?: MSDelay; + packetLoss?: MSPacketLoss; + utilization?: MSUtilization; +} + +interface MSNetworkConnectivityInfo { + vpn?: boolean; + linkspeed?: number; + networkConnectionDetails?: string; +} + +interface MSNetworkInterfaceType { + interfaceTypeEthernet?: boolean; + interfaceTypeWireless?: boolean; + interfaceTypePPP?: boolean; + interfaceTypeTunnel?: boolean; + interfaceTypeWWAN?: boolean; +} + +interface MSOutboundNetwork extends MSNetwork { + appliedBandwidthLimit?: number; +} + +interface MSPacketLoss { + lossRate?: number; + lossRateMax?: number; +} + +interface MSPayloadBase extends RTCStats { + payloadDescription?: string; +} + +interface MSRelayAddress { + relayAddress?: string; + port?: number; +} + +interface MSSignatureParameters { + userPrompt?: string; +} + +interface MSTransportDiagnosticsStats extends RTCStats { + baseAddress?: string; + localAddress?: string; + localSite?: string; + networkName?: string; + remoteAddress?: string; + remoteSite?: string; + localMR?: string; + remoteMR?: string; + iceWarningFlags?: MSIceWarningFlags; + portRangeMin?: number; + portRangeMax?: number; + localMRTCPPort?: number; + remoteMRTCPPort?: number; + stunVer?: number; + numConsentReqSent?: number; + numConsentReqReceived?: number; + numConsentRespSent?: number; + numConsentRespReceived?: number; + interfaces?: MSNetworkInterfaceType; + baseInterface?: MSNetworkInterfaceType; + protocol?: string; + localInterface?: MSNetworkInterfaceType; + localAddrType?: string; + remoteAddrType?: string; + iceRole?: string; + rtpRtcpMux?: boolean; + allocationTimeInMs?: number; + msRtcEngineVersion?: string; +} + +interface MSUtilization { + packets?: number; + bandwidthEstimation?: number; + bandwidthEstimationMin?: number; + bandwidthEstimationMax?: number; + bandwidthEstimationStdDev?: number; + bandwidthEstimationAvg?: number; +} + +interface MSVideoPayload extends MSPayloadBase { + resoluton?: string; + videoBitRateAvg?: number; + videoBitRateMax?: number; + videoFrameRateAvg?: number; + videoPacketLossRate?: number; + durationSeconds?: number; +} + +interface MSVideoRecvPayload extends MSVideoPayload { + videoFrameLossRate?: number; + recvCodecType?: string; + recvResolutionWidth?: number; + recvResolutionHeight?: number; + videoResolutions?: MSVideoResolutionDistribution; + recvFrameRateAverage?: number; + recvBitRateMaximum?: number; + recvBitRateAverage?: number; + recvVideoStreamsMax?: number; + recvVideoStreamsMin?: number; + recvVideoStreamsMode?: number; + videoPostFECPLR?: number; + lowBitRateCallPercent?: number; + lowFrameRateCallPercent?: number; + reorderBufferTotalPackets?: number; + recvReorderBufferReorderedPackets?: number; + recvReorderBufferPacketsDroppedDueToBufferExhaustion?: number; + recvReorderBufferMaxSuccessfullyOrderedExtent?: number; + recvReorderBufferMaxSuccessfullyOrderedLateTime?: number; + recvReorderBufferPacketsDroppedDueToTimeout?: number; + recvFpsHarmonicAverage?: number; + recvNumResSwitches?: number; +} + +interface MSVideoResolutionDistribution { + cifQuality?: number; + vgaQuality?: number; + h720Quality?: number; + h1080Quality?: number; + h1440Quality?: number; + h2160Quality?: number; +} + +interface MSVideoSendPayload extends MSVideoPayload { + sendFrameRateAverage?: number; + sendBitRateMaximum?: number; + sendBitRateAverage?: number; + sendVideoStreamsMax?: number; + sendResolutionWidth?: number; + sendResolutionHeight?: number; +} + +interface MediaEncryptedEventInit extends EventInit { + initDataType?: string; + initData?: ArrayBuffer; +} + +interface MediaKeyMessageEventInit extends EventInit { + messageType?: string; + message?: ArrayBuffer; +} + +interface MediaKeySystemConfiguration { + initDataTypes?: string[]; + audioCapabilities?: MediaKeySystemMediaCapability[]; + videoCapabilities?: MediaKeySystemMediaCapability[]; + distinctiveIdentifier?: string; + persistentState?: string; +} + +interface MediaKeySystemMediaCapability { + contentType?: string; + robustness?: string; +} + +interface MediaStreamConstraints { + video?: boolean | MediaTrackConstraints; + audio?: boolean | MediaTrackConstraints; +} + +interface MediaStreamErrorEventInit extends EventInit { + error?: MediaStreamError; +} + +interface MediaStreamTrackEventInit extends EventInit { + track?: MediaStreamTrack; +} + +interface MediaTrackCapabilities { + width?: number | LongRange; + height?: number | LongRange; + aspectRatio?: number | DoubleRange; + frameRate?: number | DoubleRange; + facingMode?: string; + volume?: number | DoubleRange; + sampleRate?: number | LongRange; + sampleSize?: number | LongRange; + echoCancellation?: boolean[]; + deviceId?: string; + groupId?: string; +} + +interface MediaTrackConstraintSet { + width?: number | ConstrainLongRange; + height?: number | ConstrainLongRange; + aspectRatio?: number | ConstrainDoubleRange; + frameRate?: number | ConstrainDoubleRange; + facingMode?: string | string[] | ConstrainDOMStringParameters; + volume?: number | ConstrainDoubleRange; + sampleRate?: number | ConstrainLongRange; + sampleSize?: number | ConstrainLongRange; + echoCancelation?: boolean | ConstrainBooleanParameters; + deviceId?: string | string[] | ConstrainDOMStringParameters; + groupId?: string | string[] | ConstrainDOMStringParameters; +} + +interface MediaTrackConstraints extends MediaTrackConstraintSet { + advanced?: MediaTrackConstraintSet[]; +} + +interface MediaTrackSettings { + width?: number; + height?: number; + aspectRatio?: number; + frameRate?: number; + facingMode?: string; + volume?: number; + sampleRate?: number; + sampleSize?: number; + echoCancellation?: boolean; + deviceId?: string; + groupId?: string; +} + +interface MediaTrackSupportedConstraints { + width?: boolean; + height?: boolean; + aspectRatio?: boolean; + frameRate?: boolean; + facingMode?: boolean; + volume?: boolean; + sampleRate?: boolean; + sampleSize?: boolean; + echoCancellation?: boolean; + deviceId?: boolean; + groupId?: boolean; +} + +interface MouseEventInit extends EventModifierInit { screenX?: number; screenY?: number; clientX?: number; @@ -324,6 +568,10 @@ interface ObjectURLOptions { oneTimeOnly?: boolean; } +interface PeriodicWaveConstraints { + disableNormalization?: boolean; +} + interface PointerEventInit extends MouseEventInit { pointerId?: number; width?: number; @@ -341,22 +589,266 @@ interface PositionOptions { maximumAge?: number; } -interface SharedKeyboardAndMouseEventInit extends UIEventInit { - ctrlKey?: boolean; - shiftKey?: boolean; - altKey?: boolean; - metaKey?: boolean; - keyModifierStateAltGraph?: boolean; - keyModifierStateCapsLock?: boolean; - keyModifierStateFn?: boolean; - keyModifierStateFnLock?: boolean; - keyModifierStateHyper?: boolean; - keyModifierStateNumLock?: boolean; - keyModifierStateOS?: boolean; - keyModifierStateScrollLock?: boolean; - keyModifierStateSuper?: boolean; - keyModifierStateSymbol?: boolean; - keyModifierStateSymbolLock?: boolean; +interface RTCDTMFToneChangeEventInit extends EventInit { + tone?: string; +} + +interface RTCDtlsFingerprint { + algorithm?: string; + value?: string; +} + +interface RTCDtlsParameters { + role?: string; + fingerprints?: RTCDtlsFingerprint[]; +} + +interface RTCIceCandidate { + foundation?: string; + priority?: number; + ip?: string; + protocol?: string; + port?: number; + type?: string; + tcpType?: string; + relatedAddress?: string; + relatedPort?: number; +} + +interface RTCIceCandidateAttributes extends RTCStats { + ipAddress?: string; + portNumber?: number; + transport?: string; + candidateType?: string; + priority?: number; + addressSourceUrl?: string; +} + +interface RTCIceCandidateComplete { +} + +interface RTCIceCandidatePair { + local?: RTCIceCandidate; + remote?: RTCIceCandidate; +} + +interface RTCIceCandidatePairStats extends RTCStats { + transportId?: string; + localCandidateId?: string; + remoteCandidateId?: string; + state?: string; + priority?: number; + nominated?: boolean; + writable?: boolean; + readable?: boolean; + bytesSent?: number; + bytesReceived?: number; + roundTripTime?: number; + availableOutgoingBitrate?: number; + availableIncomingBitrate?: number; +} + +interface RTCIceGatherOptions { + gatherPolicy?: string; + iceservers?: RTCIceServer[]; +} + +interface RTCIceParameters { + usernameFragment?: string; + password?: string; +} + +interface RTCIceServer { + urls?: any; + username?: string; + credential?: string; +} + +interface RTCInboundRTPStreamStats extends RTCRTPStreamStats { + packetsReceived?: number; + bytesReceived?: number; + packetsLost?: number; + jitter?: number; + fractionLost?: number; +} + +interface RTCMediaStreamTrackStats extends RTCStats { + trackIdentifier?: string; + remoteSource?: boolean; + ssrcIds?: string[]; + frameWidth?: number; + frameHeight?: number; + framesPerSecond?: number; + framesSent?: number; + framesReceived?: number; + framesDecoded?: number; + framesDropped?: number; + framesCorrupted?: number; + audioLevel?: number; + echoReturnLoss?: number; + echoReturnLossEnhancement?: number; +} + +interface RTCOutboundRTPStreamStats extends RTCRTPStreamStats { + packetsSent?: number; + bytesSent?: number; + targetBitrate?: number; + roundTripTime?: number; +} + +interface RTCRTPStreamStats extends RTCStats { + ssrc?: string; + associateStatsId?: string; + isRemote?: boolean; + mediaTrackId?: string; + transportId?: string; + codecId?: string; + firCount?: number; + pliCount?: number; + nackCount?: number; + sliCount?: number; +} + +interface RTCRtcpFeedback { + type?: string; + parameter?: string; +} + +interface RTCRtcpParameters { + ssrc?: number; + cname?: string; + reducedSize?: boolean; + mux?: boolean; +} + +interface RTCRtpCapabilities { + codecs?: RTCRtpCodecCapability[]; + headerExtensions?: RTCRtpHeaderExtension[]; + fecMechanisms?: string[]; +} + +interface RTCRtpCodecCapability { + name?: string; + kind?: string; + clockRate?: number; + preferredPayloadType?: number; + maxptime?: number; + numChannels?: number; + rtcpFeedback?: RTCRtcpFeedback[]; + parameters?: any; + options?: any; + maxTemporalLayers?: number; + maxSpatialLayers?: number; + svcMultiStreamSupport?: boolean; +} + +interface RTCRtpCodecParameters { + name?: string; + payloadType?: any; + clockRate?: number; + maxptime?: number; + numChannels?: number; + rtcpFeedback?: RTCRtcpFeedback[]; + parameters?: any; +} + +interface RTCRtpContributingSource { + timestamp?: number; + csrc?: number; + audioLevel?: number; +} + +interface RTCRtpEncodingParameters { + ssrc?: number; + codecPayloadType?: number; + fec?: RTCRtpFecParameters; + rtx?: RTCRtpRtxParameters; + priority?: number; + maxBitrate?: number; + minQuality?: number; + framerateBias?: number; + resolutionScale?: number; + framerateScale?: number; + active?: boolean; + encodingId?: string; + dependencyEncodingIds?: string[]; + ssrcRange?: RTCSsrcRange; +} + +interface RTCRtpFecParameters { + ssrc?: number; + mechanism?: string; +} + +interface RTCRtpHeaderExtension { + kind?: string; + uri?: string; + preferredId?: number; + preferredEncrypt?: boolean; +} + +interface RTCRtpHeaderExtensionParameters { + uri?: string; + id?: number; + encrypt?: boolean; +} + +interface RTCRtpParameters { + muxId?: string; + codecs?: RTCRtpCodecParameters[]; + headerExtensions?: RTCRtpHeaderExtensionParameters[]; + encodings?: RTCRtpEncodingParameters[]; + rtcp?: RTCRtcpParameters; +} + +interface RTCRtpRtxParameters { + ssrc?: number; +} + +interface RTCRtpUnhandled { + ssrc?: number; + payloadType?: number; + muxId?: string; +} + +interface RTCSrtpKeyParam { + keyMethod?: string; + keySalt?: string; + lifetime?: string; + mkiValue?: number; + mkiLength?: number; +} + +interface RTCSrtpSdesParameters { + tag?: number; + cryptoSuite?: string; + keyParams?: RTCSrtpKeyParam[]; + sessionParams?: string[]; +} + +interface RTCSsrcRange { + min?: number; + max?: number; +} + +interface RTCStats { + timestamp?: number; + type?: string; + id?: string; + msType?: string; +} + +interface RTCStatsReport { +} + +interface RTCTransportStats extends RTCStats { + bytesSent?: number; + bytesReceived?: number; + rtcpTransportStatsId?: string; + activeConnection?: boolean; + selectedCandidatePairId?: string; + localCertificateId?: string; + remoteCertificateId?: string; } interface StoreExceptionsInformation extends ExceptionInformation { @@ -402,18 +894,18 @@ interface ANGLE_instanced_arrays { drawArraysInstancedANGLE(mode: number, first: number, count: number, primcount: number): void; drawElementsInstancedANGLE(mode: number, count: number, type: number, offset: number, primcount: number): void; vertexAttribDivisorANGLE(index: number, divisor: number): void; - VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: number; + readonly VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: number; } declare var ANGLE_instanced_arrays: { prototype: ANGLE_instanced_arrays; new(): ANGLE_instanced_arrays; - VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: number; + readonly VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: number; } interface AnalyserNode extends AudioNode { fftSize: number; - frequencyBinCount: number; + readonly frequencyBinCount: number; maxDecibels: number; minDecibels: number; smoothingTimeConstant: number; @@ -429,8 +921,8 @@ declare var AnalyserNode: { } interface AnimationEvent extends Event { - animationName: string; - elapsedTime: number; + readonly animationName: string; + readonly elapsedTime: number; initAnimationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, animationNameArg: string, elapsedTimeArg: number): void; } @@ -448,16 +940,16 @@ interface ApplicationCache extends EventTarget { onobsolete: (ev: Event) => any; onprogress: (ev: ProgressEvent) => any; onupdateready: (ev: Event) => any; - status: number; + readonly status: number; abort(): void; swapCache(): void; update(): void; - CHECKING: number; - DOWNLOADING: number; - IDLE: number; - OBSOLETE: number; - UNCACHED: number; - UPDATEREADY: number; + readonly CHECKING: number; + readonly DOWNLOADING: number; + readonly IDLE: number; + readonly OBSOLETE: number; + readonly UNCACHED: number; + readonly UPDATEREADY: number; addEventListener(type: "cached", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "checking", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "downloading", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -472,17 +964,17 @@ interface ApplicationCache extends EventTarget { declare var ApplicationCache: { prototype: ApplicationCache; new(): ApplicationCache; - CHECKING: number; - DOWNLOADING: number; - IDLE: number; - OBSOLETE: number; - UNCACHED: number; - UPDATEREADY: number; + readonly CHECKING: number; + readonly DOWNLOADING: number; + readonly IDLE: number; + readonly OBSOLETE: number; + readonly UNCACHED: number; + readonly UPDATEREADY: number; } interface AriaRequestEvent extends Event { - attributeName: string; - attributeValue: string; + readonly attributeName: string; + attributeValue: string | null; } declare var AriaRequestEvent: { @@ -491,9 +983,10 @@ declare var AriaRequestEvent: { } interface Attr extends Node { - name: string; - ownerElement: Element; - specified: boolean; + readonly name: string; + readonly ownerElement: Element; + readonly prefix: string | null; + readonly specified: boolean; value: string; } @@ -503,10 +996,12 @@ declare var Attr: { } interface AudioBuffer { - duration: number; - length: number; - numberOfChannels: number; - sampleRate: number; + readonly duration: number; + readonly length: number; + readonly numberOfChannels: number; + readonly sampleRate: number; + copyFromChannel(destination: Float32Array, channelNumber: number, startInChannel?: number): void; + copyToChannel(source: Float32Array, channelNumber: number, startInChannel?: number): void; getChannelData(channel: number): Float32Array; } @@ -516,15 +1011,16 @@ declare var AudioBuffer: { } interface AudioBufferSourceNode extends AudioNode { - buffer: AudioBuffer; + buffer: AudioBuffer | null; + readonly detune: AudioParam; loop: boolean; loopEnd: number; loopStart: number; - onended: (ev: Event) => any; - playbackRate: AudioParam; + onended: (ev: MediaStreamErrorEvent) => any; + readonly playbackRate: AudioParam; start(when?: number, offset?: number, duration?: number): void; stop(when?: number): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -534,10 +1030,11 @@ declare var AudioBufferSourceNode: { } interface AudioContext extends EventTarget { - currentTime: number; - destination: AudioDestinationNode; - listener: AudioListener; - sampleRate: number; + readonly currentTime: number; + readonly destination: AudioDestinationNode; + readonly listener: AudioListener; + readonly sampleRate: number; + state: string; createAnalyser(): AnalyserNode; createBiquadFilter(): BiquadFilterNode; createBuffer(numberOfChannels: number, length: number, sampleRate: number): AudioBuffer; @@ -549,13 +1046,14 @@ interface AudioContext extends EventTarget { createDynamicsCompressor(): DynamicsCompressorNode; createGain(): GainNode; createMediaElementSource(mediaElement: HTMLMediaElement): MediaElementAudioSourceNode; + createMediaStreamSource(mediaStream: MediaStream): MediaStreamAudioSourceNode; createOscillator(): OscillatorNode; createPanner(): PannerNode; - createPeriodicWave(real: Float32Array, imag: Float32Array): PeriodicWave; + createPeriodicWave(real: Float32Array, imag: Float32Array, constraints?: PeriodicWaveConstraints): PeriodicWave; createScriptProcessor(bufferSize?: number, numberOfInputChannels?: number, numberOfOutputChannels?: number): ScriptProcessorNode; createStereoPanner(): StereoPannerNode; createWaveShaper(): WaveShaperNode; - decodeAudioData(audioData: ArrayBuffer, successCallback: DecodeSuccessCallback, errorCallback?: DecodeErrorCallback): void; + decodeAudioData(audioData: ArrayBuffer, successCallback?: DecodeSuccessCallback, errorCallback?: DecodeErrorCallback): PromiseLike; } declare var AudioContext: { @@ -564,7 +1062,7 @@ declare var AudioContext: { } interface AudioDestinationNode extends AudioNode { - maxChannelCount: number; + readonly maxChannelCount: number; } declare var AudioDestinationNode: { @@ -589,11 +1087,13 @@ interface AudioNode extends EventTarget { channelCount: number; channelCountMode: string; channelInterpretation: string; - context: AudioContext; - numberOfInputs: number; - numberOfOutputs: number; + readonly context: AudioContext; + readonly numberOfInputs: number; + readonly numberOfOutputs: number; connect(destination: AudioNode, output?: number, input?: number): void; disconnect(output?: number): void; + disconnect(destination: AudioNode, output?: number, input?: number): void; + disconnect(destination: AudioParam, output?: number): void; } declare var AudioNode: { @@ -602,7 +1102,7 @@ declare var AudioNode: { } interface AudioParam { - defaultValue: number; + readonly defaultValue: number; value: number; cancelScheduledValues(startTime: number): void; exponentialRampToValueAtTime(value: number, endTime: number): void; @@ -618,9 +1118,9 @@ declare var AudioParam: { } interface AudioProcessingEvent extends Event { - inputBuffer: AudioBuffer; - outputBuffer: AudioBuffer; - playbackTime: number; + readonly inputBuffer: AudioBuffer; + readonly outputBuffer: AudioBuffer; + readonly playbackTime: number; } declare var AudioProcessingEvent: { @@ -630,11 +1130,11 @@ declare var AudioProcessingEvent: { interface AudioTrack { enabled: boolean; - id: string; + readonly id: string; kind: string; - label: string; + readonly label: string; language: string; - sourceBuffer: SourceBuffer; + readonly sourceBuffer: SourceBuffer; } declare var AudioTrack: { @@ -643,11 +1143,11 @@ declare var AudioTrack: { } interface AudioTrackList extends EventTarget { - length: number; + readonly length: number; onaddtrack: (ev: TrackEvent) => any; onchange: (ev: Event) => any; onremovetrack: (ev: TrackEvent) => any; - getTrackById(id: string): AudioTrack; + getTrackById(id: string): AudioTrack | null; item(index: number): AudioTrack; addEventListener(type: "addtrack", listener: (ev: TrackEvent) => any, useCapture?: boolean): void; addEventListener(type: "change", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -662,7 +1162,7 @@ declare var AudioTrackList: { } interface BarProp { - visible: boolean; + readonly visible: boolean; } declare var BarProp: { @@ -680,10 +1180,10 @@ declare var BeforeUnloadEvent: { } interface BiquadFilterNode extends AudioNode { - Q: AudioParam; - detune: AudioParam; - frequency: AudioParam; - gain: AudioParam; + readonly Q: AudioParam; + readonly detune: AudioParam; + readonly frequency: AudioParam; + readonly gain: AudioParam; type: string; getFrequencyResponse(frequencyHz: Float32Array, magResponse: Float32Array, phaseResponse: Float32Array): void; } @@ -694,8 +1194,8 @@ declare var BiquadFilterNode: { } interface Blob { - size: number; - type: string; + readonly size: number; + readonly type: string; msClose(): void; msDetachStream(): any; slice(start?: number, end?: number, contentType?: string): Blob; @@ -729,7 +1229,7 @@ declare var CSSConditionRule: { } interface CSSFontFaceRule extends CSSRule { - style: CSSStyleDeclaration; + readonly style: CSSStyleDeclaration; } declare var CSSFontFaceRule: { @@ -738,9 +1238,9 @@ declare var CSSFontFaceRule: { } interface CSSGroupingRule extends CSSRule { - cssRules: CSSRuleList; - deleteRule(index?: number): void; - insertRule(rule: string, index?: number): number; + readonly cssRules: CSSRuleList; + deleteRule(index: number): void; + insertRule(rule: string, index: number): number; } declare var CSSGroupingRule: { @@ -749,9 +1249,9 @@ declare var CSSGroupingRule: { } interface CSSImportRule extends CSSRule { - href: string; - media: MediaList; - styleSheet: CSSStyleSheet; + readonly href: string; + readonly media: MediaList; + readonly styleSheet: CSSStyleSheet; } declare var CSSImportRule: { @@ -761,7 +1261,7 @@ declare var CSSImportRule: { interface CSSKeyframeRule extends CSSRule { keyText: string; - style: CSSStyleDeclaration; + readonly style: CSSStyleDeclaration; } declare var CSSKeyframeRule: { @@ -770,7 +1270,7 @@ declare var CSSKeyframeRule: { } interface CSSKeyframesRule extends CSSRule { - cssRules: CSSRuleList; + readonly cssRules: CSSRuleList; name: string; appendRule(rule: string): void; deleteRule(rule: string): void; @@ -783,7 +1283,7 @@ declare var CSSKeyframesRule: { } interface CSSMediaRule extends CSSConditionRule { - media: MediaList; + readonly media: MediaList; } declare var CSSMediaRule: { @@ -792,8 +1292,8 @@ declare var CSSMediaRule: { } interface CSSNamespaceRule extends CSSRule { - namespaceURI: string; - prefix: string; + readonly namespaceURI: string; + readonly prefix: string; } declare var CSSNamespaceRule: { @@ -802,10 +1302,10 @@ declare var CSSNamespaceRule: { } interface CSSPageRule extends CSSRule { - pseudoClass: string; - selector: string; + readonly pseudoClass: string; + readonly selector: string; selectorText: string; - style: CSSStyleDeclaration; + readonly style: CSSStyleDeclaration; } declare var CSSPageRule: { @@ -815,42 +1315,42 @@ declare var CSSPageRule: { interface CSSRule { cssText: string; - parentRule: CSSRule; - parentStyleSheet: CSSStyleSheet; - type: number; - CHARSET_RULE: number; - FONT_FACE_RULE: number; - IMPORT_RULE: number; - KEYFRAMES_RULE: number; - KEYFRAME_RULE: number; - MEDIA_RULE: number; - NAMESPACE_RULE: number; - PAGE_RULE: number; - STYLE_RULE: number; - SUPPORTS_RULE: number; - UNKNOWN_RULE: number; - VIEWPORT_RULE: number; + readonly parentRule: CSSRule; + readonly parentStyleSheet: CSSStyleSheet; + readonly type: number; + readonly CHARSET_RULE: number; + readonly FONT_FACE_RULE: number; + readonly IMPORT_RULE: number; + readonly KEYFRAMES_RULE: number; + readonly KEYFRAME_RULE: number; + readonly MEDIA_RULE: number; + readonly NAMESPACE_RULE: number; + readonly PAGE_RULE: number; + readonly STYLE_RULE: number; + readonly SUPPORTS_RULE: number; + readonly UNKNOWN_RULE: number; + readonly VIEWPORT_RULE: number; } declare var CSSRule: { prototype: CSSRule; new(): CSSRule; - CHARSET_RULE: number; - FONT_FACE_RULE: number; - IMPORT_RULE: number; - KEYFRAMES_RULE: number; - KEYFRAME_RULE: number; - MEDIA_RULE: number; - NAMESPACE_RULE: number; - PAGE_RULE: number; - STYLE_RULE: number; - SUPPORTS_RULE: number; - UNKNOWN_RULE: number; - VIEWPORT_RULE: number; + readonly CHARSET_RULE: number; + readonly FONT_FACE_RULE: number; + readonly IMPORT_RULE: number; + readonly KEYFRAMES_RULE: number; + readonly KEYFRAME_RULE: number; + readonly MEDIA_RULE: number; + readonly NAMESPACE_RULE: number; + readonly PAGE_RULE: number; + readonly STYLE_RULE: number; + readonly SUPPORTS_RULE: number; + readonly UNKNOWN_RULE: number; + readonly VIEWPORT_RULE: number; } interface CSSRuleList { - length: number; + readonly length: number; item(index: number): CSSRule; [index: number]: CSSRule; } @@ -861,356 +1361,343 @@ declare var CSSRuleList: { } interface CSSStyleDeclaration { - alignContent: string; - alignItems: string; - alignSelf: string; - alignmentBaseline: string; - animation: string; - animationDelay: string; - animationDirection: string; - animationDuration: string; - animationFillMode: string; - animationIterationCount: string; - animationName: string; - animationPlayState: string; - animationTimingFunction: string; - backfaceVisibility: string; - background: string; - backgroundAttachment: string; - backgroundClip: string; - backgroundColor: string; - backgroundImage: string; - backgroundOrigin: string; - backgroundPosition: string; - backgroundPositionX: string; - backgroundPositionY: string; - backgroundRepeat: string; - backgroundSize: string; - baselineShift: string; - border: string; - borderBottom: string; - borderBottomColor: string; - borderBottomLeftRadius: string; - borderBottomRightRadius: string; - borderBottomStyle: string; - borderBottomWidth: string; - borderCollapse: string; - borderColor: string; - borderImage: string; - borderImageOutset: string; - borderImageRepeat: string; - borderImageSlice: string; - borderImageSource: string; - borderImageWidth: string; - borderLeft: string; - borderLeftColor: string; - borderLeftStyle: string; - borderLeftWidth: string; - borderRadius: string; - borderRight: string; - borderRightColor: string; - borderRightStyle: string; - borderRightWidth: string; - borderSpacing: string; - borderStyle: string; - borderTop: string; - borderTopColor: string; - borderTopLeftRadius: string; - borderTopRightRadius: string; - borderTopStyle: string; - borderTopWidth: string; - borderWidth: string; - bottom: string; - boxShadow: string; - boxSizing: string; - breakAfter: string; - breakBefore: string; - breakInside: string; - captionSide: string; - clear: string; - clip: string; - clipPath: string; - clipRule: string; - color: string; - colorInterpolationFilters: string; + alignContent: string | null; + alignItems: string | null; + alignSelf: string | null; + alignmentBaseline: string | null; + animation: string | null; + animationDelay: string | null; + animationDirection: string | null; + animationDuration: string | null; + animationFillMode: string | null; + animationIterationCount: string | null; + animationName: string | null; + animationPlayState: string | null; + animationTimingFunction: string | null; + backfaceVisibility: string | null; + background: string | null; + backgroundAttachment: string | null; + backgroundClip: string | null; + backgroundColor: string | null; + backgroundImage: string | null; + backgroundOrigin: string | null; + backgroundPosition: string | null; + backgroundPositionX: string | null; + backgroundPositionY: string | null; + backgroundRepeat: string | null; + backgroundSize: string | null; + baselineShift: string | null; + border: string | null; + borderBottom: string | null; + borderBottomColor: string | null; + borderBottomLeftRadius: string | null; + borderBottomRightRadius: string | null; + borderBottomStyle: string | null; + borderBottomWidth: string | null; + borderCollapse: string | null; + borderColor: string | null; + borderImage: string | null; + borderImageOutset: string | null; + borderImageRepeat: string | null; + borderImageSlice: string | null; + borderImageSource: string | null; + borderImageWidth: string | null; + borderLeft: string | null; + borderLeftColor: string | null; + borderLeftStyle: string | null; + borderLeftWidth: string | null; + borderRadius: string | null; + borderRight: string | null; + borderRightColor: string | null; + borderRightStyle: string | null; + borderRightWidth: string | null; + borderSpacing: string | null; + borderStyle: string | null; + borderTop: string | null; + borderTopColor: string | null; + borderTopLeftRadius: string | null; + borderTopRightRadius: string | null; + borderTopStyle: string | null; + borderTopWidth: string | null; + borderWidth: string | null; + bottom: string | null; + boxShadow: string | null; + boxSizing: string | null; + breakAfter: string | null; + breakBefore: string | null; + breakInside: string | null; + captionSide: string | null; + clear: string | null; + clip: string | null; + clipPath: string | null; + clipRule: string | null; + color: string | null; + colorInterpolationFilters: string | null; columnCount: any; - columnFill: string; + columnFill: string | null; columnGap: any; - columnRule: string; + columnRule: string | null; columnRuleColor: any; - columnRuleStyle: string; + columnRuleStyle: string | null; columnRuleWidth: any; - columnSpan: string; + columnSpan: string | null; columnWidth: any; - columns: string; - content: string; - counterIncrement: string; - counterReset: string; - cssFloat: string; + columns: string | null; + content: string | null; + counterIncrement: string | null; + counterReset: string | null; + cssFloat: string | null; cssText: string; - cursor: string; - direction: string; - display: string; - dominantBaseline: string; - emptyCells: string; - enableBackground: string; - fill: string; - fillOpacity: string; - fillRule: string; - filter: string; - flex: string; - flexBasis: string; - flexDirection: string; - flexFlow: string; - flexGrow: string; - flexShrink: string; - flexWrap: string; - floodColor: string; - floodOpacity: string; - font: string; - fontFamily: string; - fontFeatureSettings: string; - fontSize: string; - fontSizeAdjust: string; - fontStretch: string; - fontStyle: string; - fontVariant: string; - fontWeight: string; - glyphOrientationHorizontal: string; - glyphOrientationVertical: string; - height: string; - imeMode: string; - justifyContent: string; - kerning: string; - left: string; - length: number; - letterSpacing: string; - lightingColor: string; - lineHeight: string; - listStyle: string; - listStyleImage: string; - listStylePosition: string; - listStyleType: string; - margin: string; - marginBottom: string; - marginLeft: string; - marginRight: string; - marginTop: string; - marker: string; - markerEnd: string; - markerMid: string; - markerStart: string; - mask: string; - maxHeight: string; - maxWidth: string; - minHeight: string; - minWidth: string; - msContentZoomChaining: string; - msContentZoomLimit: string; + cursor: string | null; + direction: string | null; + display: string | null; + dominantBaseline: string | null; + emptyCells: string | null; + enableBackground: string | null; + fill: string | null; + fillOpacity: string | null; + fillRule: string | null; + filter: string | null; + flex: string | null; + flexBasis: string | null; + flexDirection: string | null; + flexFlow: string | null; + flexGrow: string | null; + flexShrink: string | null; + flexWrap: string | null; + floodColor: string | null; + floodOpacity: string | null; + font: string | null; + fontFamily: string | null; + fontFeatureSettings: string | null; + fontSize: string | null; + fontSizeAdjust: string | null; + fontStretch: string | null; + fontStyle: string | null; + fontVariant: string | null; + fontWeight: string | null; + glyphOrientationHorizontal: string | null; + glyphOrientationVertical: string | null; + height: string | null; + imeMode: string | null; + justifyContent: string | null; + kerning: string | null; + left: string | null; + readonly length: number; + letterSpacing: string | null; + lightingColor: string | null; + lineHeight: string | null; + listStyle: string | null; + listStyleImage: string | null; + listStylePosition: string | null; + listStyleType: string | null; + margin: string | null; + marginBottom: string | null; + marginLeft: string | null; + marginRight: string | null; + marginTop: string | null; + marker: string | null; + markerEnd: string | null; + markerMid: string | null; + markerStart: string | null; + mask: string | null; + maxHeight: string | null; + maxWidth: string | null; + minHeight: string | null; + minWidth: string | null; + msContentZoomChaining: string | null; + msContentZoomLimit: string | null; msContentZoomLimitMax: any; msContentZoomLimitMin: any; - msContentZoomSnap: string; - msContentZoomSnapPoints: string; - msContentZoomSnapType: string; - msContentZooming: string; - msFlowFrom: string; - msFlowInto: string; - msFontFeatureSettings: string; + msContentZoomSnap: string | null; + msContentZoomSnapPoints: string | null; + msContentZoomSnapType: string | null; + msContentZooming: string | null; + msFlowFrom: string | null; + msFlowInto: string | null; + msFontFeatureSettings: string | null; msGridColumn: any; - msGridColumnAlign: string; + msGridColumnAlign: string | null; msGridColumnSpan: any; - msGridColumns: string; + msGridColumns: string | null; msGridRow: any; - msGridRowAlign: string; + msGridRowAlign: string | null; msGridRowSpan: any; - msGridRows: string; - msHighContrastAdjust: string; - msHyphenateLimitChars: string; + msGridRows: string | null; + msHighContrastAdjust: string | null; + msHyphenateLimitChars: string | null; msHyphenateLimitLines: any; msHyphenateLimitZone: any; - msHyphens: string; - msImeAlign: string; - msOverflowStyle: string; - msScrollChaining: string; - msScrollLimit: string; + msHyphens: string | null; + msImeAlign: string | null; + msOverflowStyle: string | null; + msScrollChaining: string | null; + msScrollLimit: string | null; msScrollLimitXMax: any; msScrollLimitXMin: any; msScrollLimitYMax: any; msScrollLimitYMin: any; - msScrollRails: string; - msScrollSnapPointsX: string; - msScrollSnapPointsY: string; - msScrollSnapType: string; - msScrollSnapX: string; - msScrollSnapY: string; - msScrollTranslation: string; - msTextCombineHorizontal: string; + msScrollRails: string | null; + msScrollSnapPointsX: string | null; + msScrollSnapPointsY: string | null; + msScrollSnapType: string | null; + msScrollSnapX: string | null; + msScrollSnapY: string | null; + msScrollTranslation: string | null; + msTextCombineHorizontal: string | null; msTextSizeAdjust: any; - msTouchAction: string; - msTouchSelect: string; - msUserSelect: string; + msTouchAction: string | null; + msTouchSelect: string | null; + msUserSelect: string | null; msWrapFlow: string; msWrapMargin: any; msWrapThrough: string; - opacity: string; - order: string; - orphans: string; - outline: string; - outlineColor: string; - outlineStyle: string; - outlineWidth: string; - overflow: string; - overflowX: string; - overflowY: string; - padding: string; - paddingBottom: string; - paddingLeft: string; - paddingRight: string; - paddingTop: string; - pageBreakAfter: string; - pageBreakBefore: string; - pageBreakInside: string; - parentRule: CSSRule; - perspective: string; - perspectiveOrigin: string; - pointerEvents: string; - position: string; - quotes: string; - right: string; - rubyAlign: string; - rubyOverhang: string; - rubyPosition: string; - stopColor: string; - stopOpacity: string; - stroke: string; - strokeDasharray: string; - strokeDashoffset: string; - strokeLinecap: string; - strokeLinejoin: string; - strokeMiterlimit: string; - strokeOpacity: string; - strokeWidth: string; - tableLayout: string; - textAlign: string; - textAlignLast: string; - textAnchor: string; - textDecoration: string; - textFillColor: string; - textIndent: string; - textJustify: string; - textKashida: string; - textKashidaSpace: string; - textOverflow: string; - textShadow: string; - textTransform: string; - textUnderlinePosition: string; - top: string; - touchAction: string; - transform: string; - transformOrigin: string; - transformStyle: string; - transition: string; - transitionDelay: string; - transitionDuration: string; - transitionProperty: string; - transitionTimingFunction: string; - unicodeBidi: string; - verticalAlign: string; - visibility: string; - webkitAlignContent: string; - webkitAlignItems: string; - webkitAlignSelf: string; - webkitAnimation: string; - webkitAnimationDelay: string; - webkitAnimationDirection: string; - webkitAnimationDuration: string; - webkitAnimationFillMode: string; - webkitAnimationIterationCount: string; - webkitAnimationName: string; - webkitAnimationPlayState: string; - webkitAnimationTimingFunction: string; - webkitAppearance: string; - webkitBackfaceVisibility: string; - webkitBackground: string; - webkitBackgroundAttachment: string; - webkitBackgroundClip: string; - webkitBackgroundColor: string; - webkitBackgroundImage: string; - webkitBackgroundOrigin: string; - webkitBackgroundPosition: string; - webkitBackgroundPositionX: string; - webkitBackgroundPositionY: string; - webkitBackgroundRepeat: string; - webkitBackgroundSize: string; - webkitBorderBottomLeftRadius: string; - webkitBorderBottomRightRadius: string; - webkitBorderImage: string; - webkitBorderImageOutset: string; - webkitBorderImageRepeat: string; - webkitBorderImageSlice: string; - webkitBorderImageSource: string; - webkitBorderImageWidth: string; - webkitBorderRadius: string; - webkitBorderTopLeftRadius: string; - webkitBorderTopRightRadius: string; - webkitBoxAlign: string; - webkitBoxDirection: string; - webkitBoxFlex: string; - webkitBoxOrdinalGroup: string; - webkitBoxOrient: string; - webkitBoxPack: string; - webkitBoxSizing: string; - webkitColumnBreakAfter: string; - webkitColumnBreakBefore: string; - webkitColumnBreakInside: string; + opacity: string | null; + order: string | null; + orphans: string | null; + outline: string | null; + outlineColor: string | null; + outlineStyle: string | null; + outlineWidth: string | null; + overflow: string | null; + overflowX: string | null; + overflowY: string | null; + padding: string | null; + paddingBottom: string | null; + paddingLeft: string | null; + paddingRight: string | null; + paddingTop: string | null; + pageBreakAfter: string | null; + pageBreakBefore: string | null; + pageBreakInside: string | null; + readonly parentRule: CSSRule; + perspective: string | null; + perspectiveOrigin: string | null; + pointerEvents: string | null; + position: string | null; + quotes: string | null; + right: string | null; + rubyAlign: string | null; + rubyOverhang: string | null; + rubyPosition: string | null; + stopColor: string | null; + stopOpacity: string | null; + stroke: string | null; + strokeDasharray: string | null; + strokeDashoffset: string | null; + strokeLinecap: string | null; + strokeLinejoin: string | null; + strokeMiterlimit: string | null; + strokeOpacity: string | null; + strokeWidth: string | null; + tableLayout: string | null; + textAlign: string | null; + textAlignLast: string | null; + textAnchor: string | null; + textDecoration: string | null; + textIndent: string | null; + textJustify: string | null; + textKashida: string | null; + textKashidaSpace: string | null; + textOverflow: string | null; + textShadow: string | null; + textTransform: string | null; + textUnderlinePosition: string | null; + top: string | null; + touchAction: string | null; + transform: string | null; + transformOrigin: string | null; + transformStyle: string | null; + transition: string | null; + transitionDelay: string | null; + transitionDuration: string | null; + transitionProperty: string | null; + transitionTimingFunction: string | null; + unicodeBidi: string | null; + verticalAlign: string | null; + visibility: string | null; + webkitAlignContent: string | null; + webkitAlignItems: string | null; + webkitAlignSelf: string | null; + webkitAnimation: string | null; + webkitAnimationDelay: string | null; + webkitAnimationDirection: string | null; + webkitAnimationDuration: string | null; + webkitAnimationFillMode: string | null; + webkitAnimationIterationCount: string | null; + webkitAnimationName: string | null; + webkitAnimationPlayState: string | null; + webkitAnimationTimingFunction: string | null; + webkitAppearance: string | null; + webkitBackfaceVisibility: string | null; + webkitBackgroundClip: string | null; + webkitBackgroundOrigin: string | null; + webkitBackgroundSize: string | null; + webkitBorderBottomLeftRadius: string | null; + webkitBorderBottomRightRadius: string | null; + webkitBorderImage: string | null; + webkitBorderRadius: string | null; + webkitBorderTopLeftRadius: string | null; + webkitBorderTopRightRadius: string | null; + webkitBoxAlign: string | null; + webkitBoxDirection: string | null; + webkitBoxFlex: string | null; + webkitBoxOrdinalGroup: string | null; + webkitBoxOrient: string | null; + webkitBoxPack: string | null; + webkitBoxSizing: string | null; + webkitColumnBreakAfter: string | null; + webkitColumnBreakBefore: string | null; + webkitColumnBreakInside: string | null; webkitColumnCount: any; webkitColumnGap: any; - webkitColumnRule: string; + webkitColumnRule: string | null; webkitColumnRuleColor: any; - webkitColumnRuleStyle: string; + webkitColumnRuleStyle: string | null; webkitColumnRuleWidth: any; - webkitColumnSpan: string; + webkitColumnSpan: string | null; webkitColumnWidth: any; - webkitColumns: string; - webkitFilter: string; - webkitFlex: string; - webkitFlexBasis: string; - webkitFlexDirection: string; - webkitFlexFlow: string; - webkitFlexGrow: string; - webkitFlexShrink: string; - webkitFlexWrap: string; - webkitJustifyContent: string; - webkitOrder: string; - webkitPerspective: string; - webkitPerspectiveOrigin: string; - webkitTapHighlightColor: string; - webkitTextFillColor: string; + webkitColumns: string | null; + webkitFilter: string | null; + webkitFlex: string | null; + webkitFlexBasis: string | null; + webkitFlexDirection: string | null; + webkitFlexFlow: string | null; + webkitFlexGrow: string | null; + webkitFlexShrink: string | null; + webkitFlexWrap: string | null; + webkitJustifyContent: string | null; + webkitOrder: string | null; + webkitPerspective: string | null; + webkitPerspectiveOrigin: string | null; + webkitTapHighlightColor: string | null; + webkitTextFillColor: string | null; webkitTextSizeAdjust: any; - webkitTransform: string; - webkitTransformOrigin: string; - webkitTransformStyle: string; - webkitTransition: string; - webkitTransitionDelay: string; - webkitTransitionDuration: string; - webkitTransitionProperty: string; - webkitTransitionTimingFunction: string; - webkitUserSelect: string; - webkitWritingMode: string; - whiteSpace: string; - widows: string; - width: string; - wordBreak: string; - wordSpacing: string; - wordWrap: string; - writingMode: string; - zIndex: string; - zoom: string; + webkitTransform: string | null; + webkitTransformOrigin: string | null; + webkitTransformStyle: string | null; + webkitTransition: string | null; + webkitTransitionDelay: string | null; + webkitTransitionDuration: string | null; + webkitTransitionProperty: string | null; + webkitTransitionTimingFunction: string | null; + webkitUserModify: string | null; + webkitUserSelect: string | null; + webkitWritingMode: string | null; + whiteSpace: string | null; + widows: string | null; + width: string | null; + wordBreak: string | null; + wordSpacing: string | null; + wordWrap: string | null; + writingMode: string | null; + zIndex: string | null; + zoom: string | null; getPropertyPriority(propertyName: string): string; getPropertyValue(propertyName: string): string; item(index: number): string; removeProperty(propertyName: string): string; - setProperty(propertyName: string, value: string, priority?: string): void; + setProperty(propertyName: string, value: string | null, priority?: string): void; [index: number]: string; } @@ -1220,9 +1707,9 @@ declare var CSSStyleDeclaration: { } interface CSSStyleRule extends CSSRule { - readOnly: boolean; + readonly readOnly: boolean; selectorText: string; - style: CSSStyleDeclaration; + readonly style: CSSStyleDeclaration; } declare var CSSStyleRule: { @@ -1231,18 +1718,18 @@ declare var CSSStyleRule: { } interface CSSStyleSheet extends StyleSheet { - cssRules: CSSRuleList; + readonly cssRules: CSSRuleList; cssText: string; - href: string; - id: string; - imports: StyleSheetList; - isAlternate: boolean; - isPrefAlternate: boolean; - ownerRule: CSSRule; - owningElement: Element; - pages: StyleSheetPageList; - readOnly: boolean; - rules: CSSRuleList; + readonly href: string; + readonly id: string; + readonly imports: StyleSheetList; + readonly isAlternate: boolean; + readonly isPrefAlternate: boolean; + readonly ownerRule: CSSRule; + readonly owningElement: Element; + readonly pages: StyleSheetPageList; + readonly readOnly: boolean; + readonly rules: CSSRuleList; addImport(bstrURL: string, lIndex?: number): number; addPageRule(bstrSelector: string, bstrStyle: string, lIndex?: number): number; addRule(bstrSelector: string, bstrStyle?: string, lIndex?: number): number; @@ -1282,8 +1769,8 @@ declare var CanvasPattern: { new(): CanvasPattern; } -interface CanvasRenderingContext2D { - canvas: HTMLCanvasElement; +interface CanvasRenderingContext2D extends Object, CanvasPathMethods { + readonly canvas: HTMLCanvasElement; fillStyle: string | CanvasGradient | CanvasPattern; font: string; globalAlpha: number; @@ -1302,13 +1789,12 @@ interface CanvasRenderingContext2D { strokeStyle: string | CanvasGradient | CanvasPattern; textAlign: string; textBaseline: string; - arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void; - arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void; + mozImageSmoothingEnabled: boolean; + webkitImageSmoothingEnabled: boolean; + oImageSmoothingEnabled: boolean; beginPath(): void; - bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void; clearRect(x: number, y: number, w: number, h: number): void; clip(fillRule?: string): void; - closePath(): void; createImageData(imageDataOrSw: number | ImageData, sh?: number): ImageData; createLinearGradient(x0: number, y0: number, x1: number, y1: number): CanvasGradient; createPattern(image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement, repetition: string): CanvasPattern; @@ -1320,12 +1806,8 @@ interface CanvasRenderingContext2D { getImageData(sx: number, sy: number, sw: number, sh: number): ImageData; getLineDash(): number[]; isPointInPath(x: number, y: number, fillRule?: string): boolean; - lineTo(x: number, y: number): void; measureText(text: string): TextMetrics; - moveTo(x: number, y: number): void; putImageData(imagedata: ImageData, dx: number, dy: number, dirtyX?: number, dirtyY?: number, dirtyWidth?: number, dirtyHeight?: number): void; - quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void; - rect(x: number, y: number, w: number, h: number): void; restore(): void; rotate(angle: number): void; save(): void; @@ -1362,7 +1844,7 @@ declare var ChannelSplitterNode: { interface CharacterData extends Node, ChildNode { data: string; - length: number; + readonly length: number; appendData(arg: string): void; deleteData(offset: number, count: number): void; insertData(offset: number, arg: string): void; @@ -1378,11 +1860,11 @@ declare var CharacterData: { interface ClientRect { bottom: number; - height: number; + readonly height: number; left: number; right: number; top: number; - width: number; + readonly width: number; } declare var ClientRect: { @@ -1391,7 +1873,7 @@ declare var ClientRect: { } interface ClientRectList { - length: number; + readonly length: number; item(index: number): ClientRect; [index: number]: ClientRect; } @@ -1402,7 +1884,7 @@ declare var ClientRectList: { } interface ClipboardEvent extends Event { - clipboardData: DataTransfer; + readonly clipboardData: DataTransfer; } declare var ClipboardEvent: { @@ -1411,9 +1893,9 @@ declare var ClipboardEvent: { } interface CloseEvent extends Event { - code: number; - reason: string; - wasClean: boolean; + readonly code: number; + readonly reason: string; + readonly wasClean: boolean; initCloseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, wasCleanArg: boolean, codeArg: number, reasonArg: string): void; } @@ -1423,8 +1905,8 @@ declare var CloseEvent: { } interface CommandEvent extends Event { - commandName: string; - detail: string; + readonly commandName: string; + readonly detail: string | null; } declare var CommandEvent: { @@ -1442,8 +1924,8 @@ declare var Comment: { } interface CompositionEvent extends UIEvent { - data: string; - locale: string; + readonly data: string; + readonly locale: string; initCompositionEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, dataArg: string, locale: string): void; } @@ -1460,6 +1942,7 @@ interface Console { dir(value?: any, ...optionalParams: any[]): void; dirxml(value: any): void; error(message?: any, ...optionalParams: any[]): void; + exception(message?: string, ...optionalParams: any[]): void; group(groupTitle?: string): void; groupCollapsed(groupTitle?: string): void; groupEnd(): void; @@ -1469,9 +1952,10 @@ interface Console { profile(reportName?: string): void; profileEnd(): void; select(element: Element): void; + table(...data: any[]): void; time(timerName?: string): void; timeEnd(timerName?: string): void; - trace(): void; + trace(message?: any, ...optionalParams: any[]): void; warn(message?: any, ...optionalParams: any[]): void; } @@ -1481,7 +1965,7 @@ declare var Console: { } interface ConvolverNode extends AudioNode { - buffer: AudioBuffer; + buffer: AudioBuffer | null; normalize: boolean; } @@ -1491,13 +1975,13 @@ declare var ConvolverNode: { } interface Coordinates { - accuracy: number; - altitude: number; - altitudeAccuracy: number; - heading: number; - latitude: number; - longitude: number; - speed: number; + readonly accuracy: number; + readonly altitude: number | null; + readonly altitudeAccuracy: number | null; + readonly heading: number | null; + readonly latitude: number; + readonly longitude: number; + readonly speed: number | null; } declare var Coordinates: { @@ -1506,7 +1990,7 @@ declare var Coordinates: { } interface Crypto extends Object, RandomSource { - subtle: SubtleCrypto; + readonly subtle: SubtleCrypto; } declare var Crypto: { @@ -1515,10 +1999,10 @@ declare var Crypto: { } interface CryptoKey { - algorithm: KeyAlgorithm; - extractable: boolean; - type: string; - usages: string[]; + readonly algorithm: KeyAlgorithm; + readonly extractable: boolean; + readonly type: string; + readonly usages: string[]; } declare var CryptoKey: { @@ -1537,7 +2021,7 @@ declare var CryptoKeyPair: { } interface CustomEvent extends Event { - detail: any; + readonly detail: any; initCustomEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, detailArg: any): void; } @@ -1547,7 +2031,7 @@ declare var CustomEvent: { } interface DOMError { - name: string; + readonly name: string; toString(): string; } @@ -1557,76 +2041,76 @@ declare var DOMError: { } interface DOMException { - code: number; - message: string; - name: string; + readonly code: number; + readonly message: string; + readonly name: string; toString(): string; - ABORT_ERR: number; - DATA_CLONE_ERR: number; - DOMSTRING_SIZE_ERR: number; - HIERARCHY_REQUEST_ERR: number; - INDEX_SIZE_ERR: number; - INUSE_ATTRIBUTE_ERR: number; - INVALID_ACCESS_ERR: number; - INVALID_CHARACTER_ERR: number; - INVALID_MODIFICATION_ERR: number; - INVALID_NODE_TYPE_ERR: number; - INVALID_STATE_ERR: number; - NAMESPACE_ERR: number; - NETWORK_ERR: number; - NOT_FOUND_ERR: number; - NOT_SUPPORTED_ERR: number; - NO_DATA_ALLOWED_ERR: number; - NO_MODIFICATION_ALLOWED_ERR: number; - PARSE_ERR: number; - QUOTA_EXCEEDED_ERR: number; - SECURITY_ERR: number; - SERIALIZE_ERR: number; - SYNTAX_ERR: number; - TIMEOUT_ERR: number; - TYPE_MISMATCH_ERR: number; - URL_MISMATCH_ERR: number; - VALIDATION_ERR: number; - WRONG_DOCUMENT_ERR: number; + readonly ABORT_ERR: number; + readonly DATA_CLONE_ERR: number; + readonly DOMSTRING_SIZE_ERR: number; + readonly HIERARCHY_REQUEST_ERR: number; + readonly INDEX_SIZE_ERR: number; + readonly INUSE_ATTRIBUTE_ERR: number; + readonly INVALID_ACCESS_ERR: number; + readonly INVALID_CHARACTER_ERR: number; + readonly INVALID_MODIFICATION_ERR: number; + readonly INVALID_NODE_TYPE_ERR: number; + readonly INVALID_STATE_ERR: number; + readonly NAMESPACE_ERR: number; + readonly NETWORK_ERR: number; + readonly NOT_FOUND_ERR: number; + readonly NOT_SUPPORTED_ERR: number; + readonly NO_DATA_ALLOWED_ERR: number; + readonly NO_MODIFICATION_ALLOWED_ERR: number; + readonly PARSE_ERR: number; + readonly QUOTA_EXCEEDED_ERR: number; + readonly SECURITY_ERR: number; + readonly SERIALIZE_ERR: number; + readonly SYNTAX_ERR: number; + readonly TIMEOUT_ERR: number; + readonly TYPE_MISMATCH_ERR: number; + readonly URL_MISMATCH_ERR: number; + readonly VALIDATION_ERR: number; + readonly WRONG_DOCUMENT_ERR: number; } declare var DOMException: { prototype: DOMException; new(): DOMException; - ABORT_ERR: number; - DATA_CLONE_ERR: number; - DOMSTRING_SIZE_ERR: number; - HIERARCHY_REQUEST_ERR: number; - INDEX_SIZE_ERR: number; - INUSE_ATTRIBUTE_ERR: number; - INVALID_ACCESS_ERR: number; - INVALID_CHARACTER_ERR: number; - INVALID_MODIFICATION_ERR: number; - INVALID_NODE_TYPE_ERR: number; - INVALID_STATE_ERR: number; - NAMESPACE_ERR: number; - NETWORK_ERR: number; - NOT_FOUND_ERR: number; - NOT_SUPPORTED_ERR: number; - NO_DATA_ALLOWED_ERR: number; - NO_MODIFICATION_ALLOWED_ERR: number; - PARSE_ERR: number; - QUOTA_EXCEEDED_ERR: number; - SECURITY_ERR: number; - SERIALIZE_ERR: number; - SYNTAX_ERR: number; - TIMEOUT_ERR: number; - TYPE_MISMATCH_ERR: number; - URL_MISMATCH_ERR: number; - VALIDATION_ERR: number; - WRONG_DOCUMENT_ERR: number; + readonly ABORT_ERR: number; + readonly DATA_CLONE_ERR: number; + readonly DOMSTRING_SIZE_ERR: number; + readonly HIERARCHY_REQUEST_ERR: number; + readonly INDEX_SIZE_ERR: number; + readonly INUSE_ATTRIBUTE_ERR: number; + readonly INVALID_ACCESS_ERR: number; + readonly INVALID_CHARACTER_ERR: number; + readonly INVALID_MODIFICATION_ERR: number; + readonly INVALID_NODE_TYPE_ERR: number; + readonly INVALID_STATE_ERR: number; + readonly NAMESPACE_ERR: number; + readonly NETWORK_ERR: number; + readonly NOT_FOUND_ERR: number; + readonly NOT_SUPPORTED_ERR: number; + readonly NO_DATA_ALLOWED_ERR: number; + readonly NO_MODIFICATION_ALLOWED_ERR: number; + readonly PARSE_ERR: number; + readonly QUOTA_EXCEEDED_ERR: number; + readonly SECURITY_ERR: number; + readonly SERIALIZE_ERR: number; + readonly SYNTAX_ERR: number; + readonly TIMEOUT_ERR: number; + readonly TYPE_MISMATCH_ERR: number; + readonly URL_MISMATCH_ERR: number; + readonly VALIDATION_ERR: number; + readonly WRONG_DOCUMENT_ERR: number; } interface DOMImplementation { - createDocument(namespaceURI: string, qualifiedName: string, doctype: DocumentType): Document; - createDocumentType(qualifiedName: string, publicId: string, systemId: string): DocumentType; + createDocument(namespaceURI: string | null, qualifiedName: string | null, doctype: DocumentType): Document; + createDocumentType(qualifiedName: string, publicId: string | null, systemId: string | null): DocumentType; createHTMLDocument(title: string): Document; - hasFeature(feature: string, version: string): boolean; + hasFeature(feature: string | null, version: string | null): boolean; } declare var DOMImplementation: { @@ -1653,9 +2137,9 @@ declare var DOMSettableTokenList: { } interface DOMStringList { - length: number; + readonly length: number; contains(str: string): boolean; - item(index: number): string; + item(index: number): string | null; [index: number]: string; } @@ -1674,7 +2158,7 @@ declare var DOMStringMap: { } interface DOMTokenList { - length: number; + readonly length: number; add(...token: string[]): void; contains(token: string): boolean; item(index: number): string; @@ -1701,9 +2185,9 @@ declare var DataCue: { interface DataTransfer { dropEffect: string; effectAllowed: string; - files: FileList; - items: DataTransferItemList; - types: DOMStringList; + readonly files: FileList; + readonly items: DataTransferItemList; + readonly types: DOMStringList; clearData(format?: string): boolean; getData(format: string): string; setData(format: string, data: string): boolean; @@ -1715,10 +2199,10 @@ declare var DataTransfer: { } interface DataTransferItem { - kind: string; - type: string; - getAsFile(): File; - getAsString(_callback: FunctionStringCallback): void; + readonly kind: string; + readonly type: string; + getAsFile(): File | null; + getAsString(_callback: FunctionStringCallback | null): void; } declare var DataTransferItem: { @@ -1727,12 +2211,12 @@ declare var DataTransferItem: { } interface DataTransferItemList { - length: number; - add(data: File): DataTransferItem; + readonly length: number; + add(data: File): DataTransferItem | null; clear(): void; - item(index: number): File; + item(index: number): DataTransferItem; remove(index: number): void; - [index: number]: File; + [index: number]: DataTransferItem; } declare var DataTransferItemList: { @@ -1741,9 +2225,9 @@ declare var DataTransferItemList: { } interface DeferredPermissionRequest { - id: number; - type: string; - uri: string; + readonly id: number; + readonly type: string; + readonly uri: string; allow(): void; deny(): void; } @@ -1754,7 +2238,7 @@ declare var DeferredPermissionRequest: { } interface DelayNode extends AudioNode { - delayTime: AudioParam; + readonly delayTime: AudioParam; } declare var DelayNode: { @@ -1763,9 +2247,9 @@ declare var DelayNode: { } interface DeviceAcceleration { - x: number; - y: number; - z: number; + readonly x: number | null; + readonly y: number | null; + readonly z: number | null; } declare var DeviceAcceleration: { @@ -1773,12 +2257,21 @@ declare var DeviceAcceleration: { new(): DeviceAcceleration; } +interface DeviceLightEvent extends Event { + readonly value: number; +} + +declare var DeviceLightEvent: { + prototype: DeviceLightEvent; + new(type: string, eventInitDict?: DeviceLightEventInit): DeviceLightEvent; +} + interface DeviceMotionEvent extends Event { - acceleration: DeviceAcceleration; - accelerationIncludingGravity: DeviceAcceleration; - interval: number; - rotationRate: DeviceRotationRate; - initDeviceMotionEvent(type: string, bubbles: boolean, cancelable: boolean, acceleration: DeviceAccelerationDict, accelerationIncludingGravity: DeviceAccelerationDict, rotationRate: DeviceRotationRateDict, interval: number): void; + readonly acceleration: DeviceAcceleration | null; + readonly accelerationIncludingGravity: DeviceAcceleration | null; + readonly interval: number | null; + readonly rotationRate: DeviceRotationRate | null; + initDeviceMotionEvent(type: string, bubbles: boolean, cancelable: boolean, acceleration: DeviceAccelerationDict | null, accelerationIncludingGravity: DeviceAccelerationDict | null, rotationRate: DeviceRotationRateDict | null, interval: number | null): void; } declare var DeviceMotionEvent: { @@ -1787,11 +2280,11 @@ declare var DeviceMotionEvent: { } interface DeviceOrientationEvent extends Event { - absolute: boolean; - alpha: number; - beta: number; - gamma: number; - initDeviceOrientationEvent(type: string, bubbles: boolean, cancelable: boolean, alpha: number, beta: number, gamma: number, absolute: boolean): void; + readonly absolute: boolean; + readonly alpha: number | null; + readonly beta: number | null; + readonly gamma: number | null; + initDeviceOrientationEvent(type: string, bubbles: boolean, cancelable: boolean, alpha: number | null, beta: number | null, gamma: number | null, absolute: boolean): void; } declare var DeviceOrientationEvent: { @@ -1800,9 +2293,9 @@ declare var DeviceOrientationEvent: { } interface DeviceRotationRate { - alpha: number; - beta: number; - gamma: number; + readonly alpha: number | null; + readonly beta: number | null; + readonly gamma: number | null; } declare var DeviceRotationRate: { @@ -1814,15 +2307,15 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven /** * Sets or gets the URL for the current document. */ - URL: string; + readonly URL: string; /** * Gets the URL for the document, stripped of any character encoding. */ - URLUnencoded: string; + readonly URLUnencoded: string; /** * Gets the object that has the focus when the parent document has focus. */ - activeElement: Element; + readonly activeElement: Element; /** * Sets or gets the color of all active links in the document. */ @@ -1830,15 +2323,15 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven /** * Returns a reference to the collection of elements contained by the object. */ - all: HTMLCollection; + readonly all: HTMLAllCollection; /** * Retrieves a collection of all a objects that have a name and/or id property. Objects in this collection are in HTML source order. */ - anchors: HTMLCollection; + anchors: HTMLCollectionOf; /** * Retrieves a collection of all applet objects in the document. */ - applets: HTMLCollection; + applets: HTMLCollectionOf; /** * Deprecated. Sets or retrieves a value that indicates the background color behind the object. */ @@ -1847,7 +2340,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * Specifies the beginning and end of the document body. */ body: HTMLElement; - characterSet: string; + readonly characterSet: string; /** * Gets or sets the character set used to encode the object. */ @@ -1855,13 +2348,14 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven /** * Gets a value that indicates whether standards-compliant mode is switched on for the object. */ - compatMode: string; + readonly compatMode: string; cookie: string; + readonly currentScript: HTMLScriptElement | SVGScriptElement; /** * Gets the default character set from the current regional language settings. */ - defaultCharset: string; - defaultView: Window; + readonly defaultCharset: string; + readonly defaultView: Window; /** * Sets or gets a value that indicates whether the document can be edited. */ @@ -1873,7 +2367,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven /** * Gets an object representing the document type declaration associated with the current document. */ - doctype: DocumentType; + readonly doctype: DocumentType; /** * Gets a reference to the root node of the document. */ @@ -1885,7 +2379,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven /** * Retrieves a collection of all embed objects in the document. */ - embeds: HTMLCollection; + embeds: HTMLCollectionOf; /** * Sets or gets the foreground (text) color of the document. */ @@ -1893,27 +2387,27 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven /** * Retrieves a collection, in source order, of all form objects in the document. */ - forms: HTMLCollection; - fullscreenElement: Element; - fullscreenEnabled: boolean; - head: HTMLHeadElement; - hidden: boolean; + forms: HTMLCollectionOf; + readonly fullscreenElement: Element | null; + readonly fullscreenEnabled: boolean; + readonly head: HTMLHeadElement; + readonly hidden: boolean; /** * Retrieves a collection, in source order, of img objects in the document. */ - images: HTMLCollection; + images: HTMLCollectionOf; /** * Gets the implementation object of the current document. */ - implementation: DOMImplementation; + readonly implementation: DOMImplementation; /** * Returns the character encoding used to create the webpage that is loaded into the document object. */ - inputEncoding: string; + readonly inputEncoding: string | null; /** * Gets the date that the page was last modified, if the page supplies one. */ - lastModified: string; + readonly lastModified: string; /** * Sets or gets the color of the document links. */ @@ -1921,16 +2415,13 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven /** * Retrieves a collection of all a objects that specify the href property and all area objects in the document. */ - links: HTMLCollection; + links: HTMLCollectionOf; /** * Contains information about the current URL. */ - location: Location; - media: string; + readonly location: Location; msCSSOMElementFloatMetrics: boolean; msCapsLockWarningOff: boolean; - msHidden: boolean; - msVisibilityState: string; /** * Fires when the user aborts the download. * @param ev The event. @@ -2032,7 +2523,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * Occurs when the end of playback is reached. * @param ev The event */ - onended: (ev: Event) => any; + onended: (ev: MediaStreamErrorEvent) => any; /** * Fires when an error occurs during object loading. * @param ev The event. @@ -2046,6 +2537,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven onfullscreenchange: (ev: Event) => any; onfullscreenerror: (ev: Event) => any; oninput: (ev: Event) => any; + oninvalid: (ev: Event) => any; /** * Fires when the user presses a key. * @param ev The keyboard event @@ -2110,7 +2602,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * Fires when the wheel button is rotated. * @param ev The mouse event */ - onmousewheel: (ev: MouseWheelEvent) => any; + onmousewheel: (ev: WheelEvent) => any; onmscontentzoom: (ev: UIEvent) => any; onmsgesturechange: (ev: MSGestureEvent) => any; onmsgesturedoubletap: (ev: MSGestureEvent) => any; @@ -2195,6 +2687,11 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * @param ev The event. */ onselect: (ev: UIEvent) => any; + /** + * Fires when the selection state of a document changes. + * @param ev The event. + */ + onselectionchange: (ev: Event) => any; onselectstart: (ev: Event) => any; /** * Occurs when the download has stopped. @@ -2233,50 +2730,51 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven onwaiting: (ev: Event) => any; onwebkitfullscreenchange: (ev: Event) => any; onwebkitfullscreenerror: (ev: Event) => any; - plugins: HTMLCollection; - pointerLockElement: Element; + plugins: HTMLCollectionOf; + readonly pointerLockElement: Element; /** * Retrieves a value that indicates the current state of the object. */ - readyState: string; + readonly readyState: string; /** * Gets the URL of the location that referred the user to the current page. */ - referrer: string; + readonly referrer: string; /** * Gets the root svg element in the document hierarchy. */ - rootElement: SVGSVGElement; + readonly rootElement: SVGSVGElement; /** * Retrieves a collection of all script objects in the document. */ - scripts: HTMLCollection; - security: string; + scripts: HTMLCollectionOf; + readonly scrollingElement: Element | null; /** * Retrieves a collection of styleSheet objects representing the style sheets that correspond to each instance of a link or style object in the document. */ - styleSheets: StyleSheetList; + readonly styleSheets: StyleSheetList; /** * Contains the title of the document. */ title: string; - visibilityState: string; + readonly visibilityState: string; /** * Sets or gets the color of the links that the user has visited. */ vlinkColor: string; - webkitCurrentFullScreenElement: Element; - webkitFullscreenElement: Element; - webkitFullscreenEnabled: boolean; - webkitIsFullScreen: boolean; - xmlEncoding: string; + readonly webkitCurrentFullScreenElement: Element | null; + readonly webkitFullscreenElement: Element | null; + readonly webkitFullscreenEnabled: boolean; + readonly webkitIsFullScreen: boolean; + readonly xmlEncoding: string | null; xmlStandalone: boolean; /** * Gets or sets the version attribute specified in the declaration of an XML document. */ - xmlVersion: string; + xmlVersion: string | null; adoptNode(source: Node): Node; captureEvents(): void; + caretRangeFromPoint(x: number, y: number): Range; clear(): void; /** * Closes an output stream and forces the sent data to display. @@ -2287,7 +2785,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * @param name String that sets the attribute object's name. */ createAttribute(name: string): Attr; - createAttributeNS(namespaceURI: string, qualifiedName: string): Attr; + createAttributeNS(namespaceURI: string | null, qualifiedName: string): Attr; createCDATASection(data: string): CDATASection; /** * Creates a comment object with the specified data. @@ -2303,37 +2801,24 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * @param tagName The name of an element. */ createElement(tagName: "a"): HTMLAnchorElement; - createElement(tagName: "abbr"): HTMLPhraseElement; - createElement(tagName: "acronym"): HTMLPhraseElement; - createElement(tagName: "address"): HTMLBlockElement; createElement(tagName: "applet"): HTMLAppletElement; createElement(tagName: "area"): HTMLAreaElement; createElement(tagName: "audio"): HTMLAudioElement; - createElement(tagName: "b"): HTMLPhraseElement; createElement(tagName: "base"): HTMLBaseElement; createElement(tagName: "basefont"): HTMLBaseFontElement; - createElement(tagName: "bdo"): HTMLPhraseElement; - createElement(tagName: "big"): HTMLPhraseElement; - createElement(tagName: "blockquote"): HTMLBlockElement; + createElement(tagName: "blockquote"): HTMLQuoteElement; createElement(tagName: "body"): HTMLBodyElement; createElement(tagName: "br"): HTMLBRElement; createElement(tagName: "button"): HTMLButtonElement; createElement(tagName: "canvas"): HTMLCanvasElement; createElement(tagName: "caption"): HTMLTableCaptionElement; - createElement(tagName: "center"): HTMLBlockElement; - createElement(tagName: "cite"): HTMLPhraseElement; - createElement(tagName: "code"): HTMLPhraseElement; createElement(tagName: "col"): HTMLTableColElement; createElement(tagName: "colgroup"): HTMLTableColElement; createElement(tagName: "datalist"): HTMLDataListElement; - createElement(tagName: "dd"): HTMLDDElement; createElement(tagName: "del"): HTMLModElement; - createElement(tagName: "dfn"): HTMLPhraseElement; createElement(tagName: "dir"): HTMLDirectoryElement; createElement(tagName: "div"): HTMLDivElement; createElement(tagName: "dl"): HTMLDListElement; - createElement(tagName: "dt"): HTMLDTElement; - createElement(tagName: "em"): HTMLPhraseElement; createElement(tagName: "embed"): HTMLEmbedElement; createElement(tagName: "fieldset"): HTMLFieldSetElement; createElement(tagName: "font"): HTMLFontElement; @@ -2349,52 +2834,41 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven createElement(tagName: "head"): HTMLHeadElement; createElement(tagName: "hr"): HTMLHRElement; createElement(tagName: "html"): HTMLHtmlElement; - createElement(tagName: "i"): HTMLPhraseElement; createElement(tagName: "iframe"): HTMLIFrameElement; createElement(tagName: "img"): HTMLImageElement; createElement(tagName: "input"): HTMLInputElement; createElement(tagName: "ins"): HTMLModElement; - createElement(tagName: "isindex"): HTMLIsIndexElement; - createElement(tagName: "kbd"): HTMLPhraseElement; - createElement(tagName: "keygen"): HTMLBlockElement; + createElement(tagName: "isindex"): HTMLUnknownElement; createElement(tagName: "label"): HTMLLabelElement; createElement(tagName: "legend"): HTMLLegendElement; createElement(tagName: "li"): HTMLLIElement; createElement(tagName: "link"): HTMLLinkElement; - createElement(tagName: "listing"): HTMLBlockElement; + createElement(tagName: "listing"): HTMLPreElement; createElement(tagName: "map"): HTMLMapElement; createElement(tagName: "marquee"): HTMLMarqueeElement; createElement(tagName: "menu"): HTMLMenuElement; createElement(tagName: "meta"): HTMLMetaElement; - createElement(tagName: "nextid"): HTMLNextIdElement; - createElement(tagName: "nobr"): HTMLPhraseElement; + createElement(tagName: "meter"): HTMLMeterElement; + createElement(tagName: "nextid"): HTMLUnknownElement; createElement(tagName: "object"): HTMLObjectElement; createElement(tagName: "ol"): HTMLOListElement; createElement(tagName: "optgroup"): HTMLOptGroupElement; createElement(tagName: "option"): HTMLOptionElement; createElement(tagName: "p"): HTMLParagraphElement; createElement(tagName: "param"): HTMLParamElement; - createElement(tagName: "plaintext"): HTMLBlockElement; + createElement(tagName: "picture"): HTMLPictureElement; createElement(tagName: "pre"): HTMLPreElement; createElement(tagName: "progress"): HTMLProgressElement; createElement(tagName: "q"): HTMLQuoteElement; - createElement(tagName: "rt"): HTMLPhraseElement; - createElement(tagName: "ruby"): HTMLPhraseElement; - createElement(tagName: "s"): HTMLPhraseElement; - createElement(tagName: "samp"): HTMLPhraseElement; createElement(tagName: "script"): HTMLScriptElement; createElement(tagName: "select"): HTMLSelectElement; - createElement(tagName: "small"): HTMLPhraseElement; createElement(tagName: "source"): HTMLSourceElement; createElement(tagName: "span"): HTMLSpanElement; - createElement(tagName: "strike"): HTMLPhraseElement; - createElement(tagName: "strong"): HTMLPhraseElement; createElement(tagName: "style"): HTMLStyleElement; - createElement(tagName: "sub"): HTMLPhraseElement; - createElement(tagName: "sup"): HTMLPhraseElement; createElement(tagName: "table"): HTMLTableElement; createElement(tagName: "tbody"): HTMLTableSectionElement; createElement(tagName: "td"): HTMLTableDataCellElement; + createElement(tagName: "template"): HTMLTemplateElement; createElement(tagName: "textarea"): HTMLTextAreaElement; createElement(tagName: "tfoot"): HTMLTableSectionElement; createElement(tagName: "th"): HTMLTableHeaderCellElement; @@ -2402,14 +2876,12 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven createElement(tagName: "title"): HTMLTitleElement; createElement(tagName: "tr"): HTMLTableRowElement; createElement(tagName: "track"): HTMLTrackElement; - createElement(tagName: "tt"): HTMLPhraseElement; - createElement(tagName: "u"): HTMLPhraseElement; createElement(tagName: "ul"): HTMLUListElement; - createElement(tagName: "var"): HTMLPhraseElement; createElement(tagName: "video"): HTMLVideoElement; createElement(tagName: "x-ms-webview"): MSHTMLWebViewElement; - createElement(tagName: "xmp"): HTMLBlockElement; + createElement(tagName: "xmp"): HTMLPreElement; createElement(tagName: string): HTMLElement; + createElementNS(namespaceURI: "http://www.w3.org/1999/xhtml", qualifiedName: string): HTMLElement createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "a"): SVGAElement createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "circle"): SVGCircleElement createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "clipPath"): SVGClipPathElement @@ -2472,7 +2944,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "use"): SVGUseElement createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "view"): SVGViewElement createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: string): SVGElement - createElementNS(namespaceURI: string, qualifiedName: string): Element; + createElementNS(namespaceURI: string | null, qualifiedName: string): Element; createExpression(expression: string, resolver: XPathNSResolver): XPathExpression; createNSResolver(nodeResolver: Node): XPathNSResolver; /** @@ -2493,7 +2965,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * @param data String that specifies the nodeValue property of the text node. */ createTextNode(data: string): Text; - createTouch(view: any, target: EventTarget, identifier: number, pageX: number, pageY: number, screenX: number, screenY: number): Touch; + createTouch(view: Window, target: EventTarget, identifier: number, pageX: number, pageY: number, screenX: number, screenY: number): Touch; createTouchList(...touches: Touch[]): TouchList; /** * Creates a TreeWalker object that you can use to traverse filtered lists of nodes or elements in a document. @@ -2533,55 +3005,55 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * @param elementId String that specifies the ID value. Case-insensitive. */ getElementById(elementId: string): HTMLElement; - getElementsByClassName(classNames: string): NodeListOf; + getElementsByClassName(classNames: string): HTMLCollectionOf; /** * Gets a collection of objects based on the value of the NAME or ID attribute. * @param elementName Gets a collection of objects based on the value of the NAME or ID attribute. */ - getElementsByName(elementName: string): NodeListOf; + getElementsByName(elementName: string): NodeListOf; /** * Retrieves a collection of objects based on the specified element name. * @param name Specifies the name of an element. */ getElementsByTagName(tagname: "a"): NodeListOf; - getElementsByTagName(tagname: "abbr"): NodeListOf; - getElementsByTagName(tagname: "acronym"): NodeListOf; - getElementsByTagName(tagname: "address"): NodeListOf; + getElementsByTagName(tagname: "abbr"): NodeListOf; + getElementsByTagName(tagname: "acronym"): NodeListOf; + getElementsByTagName(tagname: "address"): NodeListOf; getElementsByTagName(tagname: "applet"): NodeListOf; getElementsByTagName(tagname: "area"): NodeListOf; getElementsByTagName(tagname: "article"): NodeListOf; getElementsByTagName(tagname: "aside"): NodeListOf; getElementsByTagName(tagname: "audio"): NodeListOf; - getElementsByTagName(tagname: "b"): NodeListOf; + getElementsByTagName(tagname: "b"): NodeListOf; getElementsByTagName(tagname: "base"): NodeListOf; getElementsByTagName(tagname: "basefont"): NodeListOf; - getElementsByTagName(tagname: "bdo"): NodeListOf; - getElementsByTagName(tagname: "big"): NodeListOf; - getElementsByTagName(tagname: "blockquote"): NodeListOf; + getElementsByTagName(tagname: "bdo"): NodeListOf; + getElementsByTagName(tagname: "big"): NodeListOf; + getElementsByTagName(tagname: "blockquote"): NodeListOf; getElementsByTagName(tagname: "body"): NodeListOf; getElementsByTagName(tagname: "br"): NodeListOf; getElementsByTagName(tagname: "button"): NodeListOf; getElementsByTagName(tagname: "canvas"): NodeListOf; getElementsByTagName(tagname: "caption"): NodeListOf; - getElementsByTagName(tagname: "center"): NodeListOf; + getElementsByTagName(tagname: "center"): NodeListOf; getElementsByTagName(tagname: "circle"): NodeListOf; - getElementsByTagName(tagname: "cite"): NodeListOf; + getElementsByTagName(tagname: "cite"): NodeListOf; getElementsByTagName(tagname: "clippath"): NodeListOf; - getElementsByTagName(tagname: "code"): NodeListOf; + getElementsByTagName(tagname: "code"): NodeListOf; getElementsByTagName(tagname: "col"): NodeListOf; getElementsByTagName(tagname: "colgroup"): NodeListOf; getElementsByTagName(tagname: "datalist"): NodeListOf; - getElementsByTagName(tagname: "dd"): NodeListOf; + getElementsByTagName(tagname: "dd"): NodeListOf; getElementsByTagName(tagname: "defs"): NodeListOf; getElementsByTagName(tagname: "del"): NodeListOf; getElementsByTagName(tagname: "desc"): NodeListOf; - getElementsByTagName(tagname: "dfn"): NodeListOf; + getElementsByTagName(tagname: "dfn"): NodeListOf; getElementsByTagName(tagname: "dir"): NodeListOf; getElementsByTagName(tagname: "div"): NodeListOf; getElementsByTagName(tagname: "dl"): NodeListOf; - getElementsByTagName(tagname: "dt"): NodeListOf; + getElementsByTagName(tagname: "dt"): NodeListOf; getElementsByTagName(tagname: "ellipse"): NodeListOf; - getElementsByTagName(tagname: "em"): NodeListOf; + getElementsByTagName(tagname: "em"): NodeListOf; getElementsByTagName(tagname: "embed"): NodeListOf; getElementsByTagName(tagname: "feblend"): NodeListOf; getElementsByTagName(tagname: "fecolormatrix"): NodeListOf; @@ -2629,22 +3101,22 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven getElementsByTagName(tagname: "hgroup"): NodeListOf; getElementsByTagName(tagname: "hr"): NodeListOf; getElementsByTagName(tagname: "html"): NodeListOf; - getElementsByTagName(tagname: "i"): NodeListOf; + getElementsByTagName(tagname: "i"): NodeListOf; getElementsByTagName(tagname: "iframe"): NodeListOf; getElementsByTagName(tagname: "image"): NodeListOf; getElementsByTagName(tagname: "img"): NodeListOf; getElementsByTagName(tagname: "input"): NodeListOf; getElementsByTagName(tagname: "ins"): NodeListOf; - getElementsByTagName(tagname: "isindex"): NodeListOf; - getElementsByTagName(tagname: "kbd"): NodeListOf; - getElementsByTagName(tagname: "keygen"): NodeListOf; + getElementsByTagName(tagname: "isindex"): NodeListOf; + getElementsByTagName(tagname: "kbd"): NodeListOf; + getElementsByTagName(tagname: "keygen"): NodeListOf; getElementsByTagName(tagname: "label"): NodeListOf; getElementsByTagName(tagname: "legend"): NodeListOf; getElementsByTagName(tagname: "li"): NodeListOf; getElementsByTagName(tagname: "line"): NodeListOf; getElementsByTagName(tagname: "lineargradient"): NodeListOf; getElementsByTagName(tagname: "link"): NodeListOf; - getElementsByTagName(tagname: "listing"): NodeListOf; + getElementsByTagName(tagname: "listing"): NodeListOf; getElementsByTagName(tagname: "map"): NodeListOf; getElementsByTagName(tagname: "mark"): NodeListOf; getElementsByTagName(tagname: "marker"): NodeListOf; @@ -2653,9 +3125,10 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven getElementsByTagName(tagname: "menu"): NodeListOf; getElementsByTagName(tagname: "meta"): NodeListOf; getElementsByTagName(tagname: "metadata"): NodeListOf; + getElementsByTagName(tagname: "meter"): NodeListOf; getElementsByTagName(tagname: "nav"): NodeListOf; - getElementsByTagName(tagname: "nextid"): NodeListOf; - getElementsByTagName(tagname: "nobr"): NodeListOf; + getElementsByTagName(tagname: "nextid"): NodeListOf; + getElementsByTagName(tagname: "nobr"): NodeListOf; getElementsByTagName(tagname: "noframes"): NodeListOf; getElementsByTagName(tagname: "noscript"): NodeListOf; getElementsByTagName(tagname: "object"): NodeListOf; @@ -2666,7 +3139,8 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven getElementsByTagName(tagname: "param"): NodeListOf; getElementsByTagName(tagname: "path"): NodeListOf; getElementsByTagName(tagname: "pattern"): NodeListOf; - getElementsByTagName(tagname: "plaintext"): NodeListOf; + getElementsByTagName(tagname: "picture"): NodeListOf; + getElementsByTagName(tagname: "plaintext"): NodeListOf; getElementsByTagName(tagname: "polygon"): NodeListOf; getElementsByTagName(tagname: "polyline"): NodeListOf; getElementsByTagName(tagname: "pre"): NodeListOf; @@ -2674,28 +3148,29 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven getElementsByTagName(tagname: "q"): NodeListOf; getElementsByTagName(tagname: "radialgradient"): NodeListOf; getElementsByTagName(tagname: "rect"): NodeListOf; - getElementsByTagName(tagname: "rt"): NodeListOf; - getElementsByTagName(tagname: "ruby"): NodeListOf; - getElementsByTagName(tagname: "s"): NodeListOf; - getElementsByTagName(tagname: "samp"): NodeListOf; + getElementsByTagName(tagname: "rt"): NodeListOf; + getElementsByTagName(tagname: "ruby"): NodeListOf; + getElementsByTagName(tagname: "s"): NodeListOf; + getElementsByTagName(tagname: "samp"): NodeListOf; getElementsByTagName(tagname: "script"): NodeListOf; getElementsByTagName(tagname: "section"): NodeListOf; getElementsByTagName(tagname: "select"): NodeListOf; - getElementsByTagName(tagname: "small"): NodeListOf; + getElementsByTagName(tagname: "small"): NodeListOf; getElementsByTagName(tagname: "source"): NodeListOf; getElementsByTagName(tagname: "span"): NodeListOf; getElementsByTagName(tagname: "stop"): NodeListOf; - getElementsByTagName(tagname: "strike"): NodeListOf; - getElementsByTagName(tagname: "strong"): NodeListOf; + getElementsByTagName(tagname: "strike"): NodeListOf; + getElementsByTagName(tagname: "strong"): NodeListOf; getElementsByTagName(tagname: "style"): NodeListOf; - getElementsByTagName(tagname: "sub"): NodeListOf; - getElementsByTagName(tagname: "sup"): NodeListOf; + getElementsByTagName(tagname: "sub"): NodeListOf; + getElementsByTagName(tagname: "sup"): NodeListOf; getElementsByTagName(tagname: "svg"): NodeListOf; getElementsByTagName(tagname: "switch"): NodeListOf; getElementsByTagName(tagname: "symbol"): NodeListOf; getElementsByTagName(tagname: "table"): NodeListOf; getElementsByTagName(tagname: "tbody"): NodeListOf; getElementsByTagName(tagname: "td"): NodeListOf; + getElementsByTagName(tagname: "template"): NodeListOf; getElementsByTagName(tagname: "text"): NodeListOf; getElementsByTagName(tagname: "textpath"): NodeListOf; getElementsByTagName(tagname: "textarea"): NodeListOf; @@ -2706,18 +3181,20 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven getElementsByTagName(tagname: "tr"): NodeListOf; getElementsByTagName(tagname: "track"): NodeListOf; getElementsByTagName(tagname: "tspan"): NodeListOf; - getElementsByTagName(tagname: "tt"): NodeListOf; - getElementsByTagName(tagname: "u"): NodeListOf; + getElementsByTagName(tagname: "tt"): NodeListOf; + getElementsByTagName(tagname: "u"): NodeListOf; getElementsByTagName(tagname: "ul"): NodeListOf; getElementsByTagName(tagname: "use"): NodeListOf; - getElementsByTagName(tagname: "var"): NodeListOf; + getElementsByTagName(tagname: "var"): NodeListOf; getElementsByTagName(tagname: "video"): NodeListOf; getElementsByTagName(tagname: "view"): NodeListOf; getElementsByTagName(tagname: "wbr"): NodeListOf; getElementsByTagName(tagname: "x-ms-webview"): NodeListOf; - getElementsByTagName(tagname: "xmp"): NodeListOf; + getElementsByTagName(tagname: "xmp"): NodeListOf; getElementsByTagName(tagname: string): NodeListOf; - getElementsByTagNameNS(namespaceURI: string, localName: string): NodeListOf; + getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf; + getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf; + getElementsByTagNameNS(namespaceURI: string, localName: string): HTMLCollectionOf; /** * Returns an object representing the current selection of the document that is loaded into the object displaying a webpage. */ @@ -2727,8 +3204,8 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven */ hasFocus(): boolean; importNode(importedNode: Node, deep: boolean): Node; - msElementsFromPoint(x: number, y: number): NodeList; - msElementsFromRect(left: number, top: number, width: number, height: number): NodeList; + msElementsFromPoint(x: number, y: number): NodeListOf; + msElementsFromRect(left: number, top: number, width: number, height: number): NodeListOf; /** * Opens a new window and loads a document specified by a given URL. Also, opens a new window that uses the url parameter and the name parameter to collect the output of the write method and the writeln method. * @param url Specifies a MIME type for the document. @@ -2822,12 +3299,13 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "fullscreenchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "fullscreenerror", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -2840,7 +3318,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; addEventListener(type: "mssitemodejumplistitemremoved", listener: (ev: MSSiteModeEvent) => any, useCapture?: boolean): void; addEventListener(type: "msthumbnailclick", listener: (ev: MSSiteModeEvent) => any, useCapture?: boolean): void; addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -2864,6 +3342,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven addEventListener(type: "seeked", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "seeking", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "select", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "selectionchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "selectstart", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "stalled", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "stop", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -2897,12 +3376,12 @@ declare var DocumentFragment: { } interface DocumentType extends Node, ChildNode { - entities: NamedNodeMap; - internalSubset: string; - name: string; - notations: NamedNodeMap; - publicId: string; - systemId: string; + readonly entities: NamedNodeMap; + readonly internalSubset: string | null; + readonly name: string; + readonly notations: NamedNodeMap; + readonly publicId: string | null; + readonly systemId: string | null; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -2912,7 +3391,7 @@ declare var DocumentType: { } interface DragEvent extends MouseEvent { - dataTransfer: DataTransfer; + readonly dataTransfer: DataTransfer; initDragEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, dataTransferArg: DataTransfer): void; msConvertURL(file: File, targetType: string, targetURL?: string): void; } @@ -2923,12 +3402,12 @@ declare var DragEvent: { } interface DynamicsCompressorNode extends AudioNode { - attack: AudioParam; - knee: AudioParam; - ratio: AudioParam; - reduction: AudioParam; - release: AudioParam; - threshold: AudioParam; + readonly attack: AudioParam; + readonly knee: AudioParam; + readonly ratio: AudioParam; + readonly reduction: AudioParam; + readonly release: AudioParam; + readonly threshold: AudioParam; } declare var DynamicsCompressorNode: { @@ -2936,26 +3415,36 @@ declare var DynamicsCompressorNode: { new(): DynamicsCompressorNode; } +interface EXT_frag_depth { +} + +declare var EXT_frag_depth: { + prototype: EXT_frag_depth; + new(): EXT_frag_depth; +} + interface EXT_texture_filter_anisotropic { - MAX_TEXTURE_MAX_ANISOTROPY_EXT: number; - TEXTURE_MAX_ANISOTROPY_EXT: number; + readonly MAX_TEXTURE_MAX_ANISOTROPY_EXT: number; + readonly TEXTURE_MAX_ANISOTROPY_EXT: number; } declare var EXT_texture_filter_anisotropic: { prototype: EXT_texture_filter_anisotropic; new(): EXT_texture_filter_anisotropic; - MAX_TEXTURE_MAX_ANISOTROPY_EXT: number; - TEXTURE_MAX_ANISOTROPY_EXT: number; + readonly MAX_TEXTURE_MAX_ANISOTROPY_EXT: number; + readonly TEXTURE_MAX_ANISOTROPY_EXT: number; } interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelector, ChildNode { - classList: DOMTokenList; - clientHeight: number; - clientLeft: number; - clientTop: number; - clientWidth: number; + readonly classList: DOMTokenList; + className: string; + readonly clientHeight: number; + readonly clientLeft: number; + readonly clientTop: number; + readonly clientWidth: number; + id: string; msContentZoomFactor: number; - msRegionOverflow: string; + readonly msRegionOverflow: string; onariarequest: (ev: AriaRequestEvent) => any; oncommand: (ev: CommandEvent) => any; ongotpointercapture: (ev: PointerEvent) => any; @@ -2983,58 +3472,58 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec ontouchstart: (ev: TouchEvent) => any; onwebkitfullscreenchange: (ev: Event) => any; onwebkitfullscreenerror: (ev: Event) => any; - scrollHeight: number; + readonly prefix: string | null; + readonly scrollHeight: number; scrollLeft: number; scrollTop: number; - scrollWidth: number; - tagName: string; - id: string; - className: string; - getAttribute(name?: string): string; + readonly scrollWidth: number; + readonly tagName: string; + innerHTML: string; + getAttribute(name?: string): string | null; getAttributeNS(namespaceURI: string, localName: string): string; getAttributeNode(name: string): Attr; getAttributeNodeNS(namespaceURI: string, localName: string): Attr; getBoundingClientRect(): ClientRect; getClientRects(): ClientRectList; getElementsByTagName(name: "a"): NodeListOf; - getElementsByTagName(name: "abbr"): NodeListOf; - getElementsByTagName(name: "acronym"): NodeListOf; - getElementsByTagName(name: "address"): NodeListOf; + getElementsByTagName(name: "abbr"): NodeListOf; + getElementsByTagName(name: "acronym"): NodeListOf; + getElementsByTagName(name: "address"): NodeListOf; getElementsByTagName(name: "applet"): NodeListOf; getElementsByTagName(name: "area"): NodeListOf; getElementsByTagName(name: "article"): NodeListOf; getElementsByTagName(name: "aside"): NodeListOf; getElementsByTagName(name: "audio"): NodeListOf; - getElementsByTagName(name: "b"): NodeListOf; + getElementsByTagName(name: "b"): NodeListOf; getElementsByTagName(name: "base"): NodeListOf; getElementsByTagName(name: "basefont"): NodeListOf; - getElementsByTagName(name: "bdo"): NodeListOf; - getElementsByTagName(name: "big"): NodeListOf; - getElementsByTagName(name: "blockquote"): NodeListOf; + getElementsByTagName(name: "bdo"): NodeListOf; + getElementsByTagName(name: "big"): NodeListOf; + getElementsByTagName(name: "blockquote"): NodeListOf; getElementsByTagName(name: "body"): NodeListOf; getElementsByTagName(name: "br"): NodeListOf; getElementsByTagName(name: "button"): NodeListOf; getElementsByTagName(name: "canvas"): NodeListOf; getElementsByTagName(name: "caption"): NodeListOf; - getElementsByTagName(name: "center"): NodeListOf; + getElementsByTagName(name: "center"): NodeListOf; getElementsByTagName(name: "circle"): NodeListOf; - getElementsByTagName(name: "cite"): NodeListOf; + getElementsByTagName(name: "cite"): NodeListOf; getElementsByTagName(name: "clippath"): NodeListOf; - getElementsByTagName(name: "code"): NodeListOf; + getElementsByTagName(name: "code"): NodeListOf; getElementsByTagName(name: "col"): NodeListOf; getElementsByTagName(name: "colgroup"): NodeListOf; getElementsByTagName(name: "datalist"): NodeListOf; - getElementsByTagName(name: "dd"): NodeListOf; + getElementsByTagName(name: "dd"): NodeListOf; getElementsByTagName(name: "defs"): NodeListOf; getElementsByTagName(name: "del"): NodeListOf; getElementsByTagName(name: "desc"): NodeListOf; - getElementsByTagName(name: "dfn"): NodeListOf; + getElementsByTagName(name: "dfn"): NodeListOf; getElementsByTagName(name: "dir"): NodeListOf; getElementsByTagName(name: "div"): NodeListOf; getElementsByTagName(name: "dl"): NodeListOf; - getElementsByTagName(name: "dt"): NodeListOf; + getElementsByTagName(name: "dt"): NodeListOf; getElementsByTagName(name: "ellipse"): NodeListOf; - getElementsByTagName(name: "em"): NodeListOf; + getElementsByTagName(name: "em"): NodeListOf; getElementsByTagName(name: "embed"): NodeListOf; getElementsByTagName(name: "feblend"): NodeListOf; getElementsByTagName(name: "fecolormatrix"): NodeListOf; @@ -3082,22 +3571,22 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec getElementsByTagName(name: "hgroup"): NodeListOf; getElementsByTagName(name: "hr"): NodeListOf; getElementsByTagName(name: "html"): NodeListOf; - getElementsByTagName(name: "i"): NodeListOf; + getElementsByTagName(name: "i"): NodeListOf; getElementsByTagName(name: "iframe"): NodeListOf; getElementsByTagName(name: "image"): NodeListOf; getElementsByTagName(name: "img"): NodeListOf; getElementsByTagName(name: "input"): NodeListOf; getElementsByTagName(name: "ins"): NodeListOf; - getElementsByTagName(name: "isindex"): NodeListOf; - getElementsByTagName(name: "kbd"): NodeListOf; - getElementsByTagName(name: "keygen"): NodeListOf; + getElementsByTagName(name: "isindex"): NodeListOf; + getElementsByTagName(name: "kbd"): NodeListOf; + getElementsByTagName(name: "keygen"): NodeListOf; getElementsByTagName(name: "label"): NodeListOf; getElementsByTagName(name: "legend"): NodeListOf; getElementsByTagName(name: "li"): NodeListOf; getElementsByTagName(name: "line"): NodeListOf; getElementsByTagName(name: "lineargradient"): NodeListOf; getElementsByTagName(name: "link"): NodeListOf; - getElementsByTagName(name: "listing"): NodeListOf; + getElementsByTagName(name: "listing"): NodeListOf; getElementsByTagName(name: "map"): NodeListOf; getElementsByTagName(name: "mark"): NodeListOf; getElementsByTagName(name: "marker"): NodeListOf; @@ -3106,9 +3595,10 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec getElementsByTagName(name: "menu"): NodeListOf; getElementsByTagName(name: "meta"): NodeListOf; getElementsByTagName(name: "metadata"): NodeListOf; + getElementsByTagName(name: "meter"): NodeListOf; getElementsByTagName(name: "nav"): NodeListOf; - getElementsByTagName(name: "nextid"): NodeListOf; - getElementsByTagName(name: "nobr"): NodeListOf; + getElementsByTagName(name: "nextid"): NodeListOf; + getElementsByTagName(name: "nobr"): NodeListOf; getElementsByTagName(name: "noframes"): NodeListOf; getElementsByTagName(name: "noscript"): NodeListOf; getElementsByTagName(name: "object"): NodeListOf; @@ -3119,7 +3609,8 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec getElementsByTagName(name: "param"): NodeListOf; getElementsByTagName(name: "path"): NodeListOf; getElementsByTagName(name: "pattern"): NodeListOf; - getElementsByTagName(name: "plaintext"): NodeListOf; + getElementsByTagName(name: "picture"): NodeListOf; + getElementsByTagName(name: "plaintext"): NodeListOf; getElementsByTagName(name: "polygon"): NodeListOf; getElementsByTagName(name: "polyline"): NodeListOf; getElementsByTagName(name: "pre"): NodeListOf; @@ -3127,28 +3618,29 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec getElementsByTagName(name: "q"): NodeListOf; getElementsByTagName(name: "radialgradient"): NodeListOf; getElementsByTagName(name: "rect"): NodeListOf; - getElementsByTagName(name: "rt"): NodeListOf; - getElementsByTagName(name: "ruby"): NodeListOf; - getElementsByTagName(name: "s"): NodeListOf; - getElementsByTagName(name: "samp"): NodeListOf; + getElementsByTagName(name: "rt"): NodeListOf; + getElementsByTagName(name: "ruby"): NodeListOf; + getElementsByTagName(name: "s"): NodeListOf; + getElementsByTagName(name: "samp"): NodeListOf; getElementsByTagName(name: "script"): NodeListOf; getElementsByTagName(name: "section"): NodeListOf; getElementsByTagName(name: "select"): NodeListOf; - getElementsByTagName(name: "small"): NodeListOf; + getElementsByTagName(name: "small"): NodeListOf; getElementsByTagName(name: "source"): NodeListOf; getElementsByTagName(name: "span"): NodeListOf; getElementsByTagName(name: "stop"): NodeListOf; - getElementsByTagName(name: "strike"): NodeListOf; - getElementsByTagName(name: "strong"): NodeListOf; + getElementsByTagName(name: "strike"): NodeListOf; + getElementsByTagName(name: "strong"): NodeListOf; getElementsByTagName(name: "style"): NodeListOf; - getElementsByTagName(name: "sub"): NodeListOf; - getElementsByTagName(name: "sup"): NodeListOf; + getElementsByTagName(name: "sub"): NodeListOf; + getElementsByTagName(name: "sup"): NodeListOf; getElementsByTagName(name: "svg"): NodeListOf; getElementsByTagName(name: "switch"): NodeListOf; getElementsByTagName(name: "symbol"): NodeListOf; getElementsByTagName(name: "table"): NodeListOf; getElementsByTagName(name: "tbody"): NodeListOf; getElementsByTagName(name: "td"): NodeListOf; + getElementsByTagName(name: "template"): NodeListOf; getElementsByTagName(name: "text"): NodeListOf; getElementsByTagName(name: "textpath"): NodeListOf; getElementsByTagName(name: "textarea"): NodeListOf; @@ -3159,18 +3651,20 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec getElementsByTagName(name: "tr"): NodeListOf; getElementsByTagName(name: "track"): NodeListOf; getElementsByTagName(name: "tspan"): NodeListOf; - getElementsByTagName(name: "tt"): NodeListOf; - getElementsByTagName(name: "u"): NodeListOf; + getElementsByTagName(name: "tt"): NodeListOf; + getElementsByTagName(name: "u"): NodeListOf; getElementsByTagName(name: "ul"): NodeListOf; getElementsByTagName(name: "use"): NodeListOf; - getElementsByTagName(name: "var"): NodeListOf; + getElementsByTagName(name: "var"): NodeListOf; getElementsByTagName(name: "video"): NodeListOf; getElementsByTagName(name: "view"): NodeListOf; getElementsByTagName(name: "wbr"): NodeListOf; getElementsByTagName(name: "x-ms-webview"): NodeListOf; - getElementsByTagName(name: "xmp"): NodeListOf; + getElementsByTagName(name: "xmp"): NodeListOf; getElementsByTagName(name: string): NodeListOf; - getElementsByTagNameNS(namespaceURI: string, localName: string): NodeListOf; + getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf; + getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf; + getElementsByTagNameNS(namespaceURI: string, localName: string): HTMLCollectionOf; hasAttribute(name: string): boolean; hasAttributeNS(namespaceURI: string, localName: string): boolean; msGetRegionContent(): MSRangeCollection; @@ -3185,7 +3679,7 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec removeAttributeNode(oldAttr: Attr): Attr; requestFullscreen(): void; requestPointerLock(): void; - setAttribute(name?: string, value?: string): void; + setAttribute(name: string, value: string): void; setAttributeNS(namespaceURI: string, qualifiedName: string, value: string): void; setAttributeNode(newAttr: Attr): Attr; setAttributeNodeNS(newAttr: Attr): Attr; @@ -3194,6 +3688,7 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec webkitRequestFullScreen(): void; webkitRequestFullscreen(): void; getElementsByClassName(classNames: string): NodeListOf; + matches(selector: string): boolean; addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; addEventListener(type: "MSGestureEnd", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; @@ -3239,11 +3734,11 @@ declare var Element: { } interface ErrorEvent extends Event { - colno: number; - error: any; - filename: string; - lineno: number; - message: string; + readonly colno: number; + readonly error: any; + readonly filename: string; + readonly lineno: number; + readonly message: string; initErrorEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, messageArg: string, filenameArg: string, linenoArg: number): void; } @@ -3253,39 +3748,39 @@ declare var ErrorEvent: { } interface Event { - bubbles: boolean; + readonly bubbles: boolean; cancelBubble: boolean; - cancelable: boolean; - currentTarget: EventTarget; - defaultPrevented: boolean; - eventPhase: number; - isTrusted: boolean; + readonly cancelable: boolean; + readonly currentTarget: EventTarget; + readonly defaultPrevented: boolean; + readonly eventPhase: number; + readonly isTrusted: boolean; returnValue: boolean; - srcElement: Element; - target: EventTarget; - timeStamp: number; - type: string; + readonly srcElement: Element | null; + readonly target: EventTarget; + readonly timeStamp: number; + readonly type: string; initEvent(eventTypeArg: string, canBubbleArg: boolean, cancelableArg: boolean): void; preventDefault(): void; stopImmediatePropagation(): void; stopPropagation(): void; - AT_TARGET: number; - BUBBLING_PHASE: number; - CAPTURING_PHASE: number; + readonly AT_TARGET: number; + readonly BUBBLING_PHASE: number; + readonly CAPTURING_PHASE: number; } declare var Event: { prototype: Event; new(type: string, eventInitDict?: EventInit): Event; - AT_TARGET: number; - BUBBLING_PHASE: number; - CAPTURING_PHASE: number; + readonly AT_TARGET: number; + readonly BUBBLING_PHASE: number; + readonly CAPTURING_PHASE: number; } interface EventTarget { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + addEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; dispatchEvent(evt: Event): boolean; - removeEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var EventTarget: { @@ -3302,8 +3797,9 @@ declare var External: { } interface File extends Blob { - lastModifiedDate: any; - name: string; + readonly lastModifiedDate: any; + readonly name: string; + readonly webkitRelativePath: string; } declare var File: { @@ -3312,7 +3808,7 @@ declare var File: { } interface FileList { - length: number; + readonly length: number; item(index: number): File; [index: number]: File; } @@ -3323,7 +3819,7 @@ declare var FileList: { } interface FileReader extends EventTarget, MSBaseReader { - error: DOMError; + readonly error: DOMError; readAsArrayBuffer(blob: Blob): void; readAsBinaryString(blob: Blob): void; readAsDataURL(blob: Blob): void; @@ -3337,7 +3833,7 @@ declare var FileReader: { } interface FocusEvent extends UIEvent { - relatedTarget: EventTarget; + readonly relatedTarget: EventTarget; initFocusEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, relatedTargetArg: EventTarget): void; } @@ -3356,7 +3852,7 @@ declare var FormData: { } interface GainNode extends AudioNode { - gain: AudioParam; + readonly gain: AudioParam; } declare var GainNode: { @@ -3365,13 +3861,13 @@ declare var GainNode: { } interface Gamepad { - axes: number[]; - buttons: GamepadButton[]; - connected: boolean; - id: string; - index: number; - mapping: string; - timestamp: number; + readonly axes: number[]; + readonly buttons: GamepadButton[]; + readonly connected: boolean; + readonly id: string; + readonly index: number; + readonly mapping: string; + readonly timestamp: number; } declare var Gamepad: { @@ -3380,8 +3876,8 @@ declare var Gamepad: { } interface GamepadButton { - pressed: boolean; - value: number; + readonly pressed: boolean; + readonly value: number; } declare var GamepadButton: { @@ -3390,7 +3886,7 @@ declare var GamepadButton: { } interface GamepadEvent extends Event { - gamepad: Gamepad; + readonly gamepad: Gamepad; } declare var GamepadEvent: { @@ -3428,6 +3924,7 @@ interface HTMLAnchorElement extends HTMLElement { * Sets or retrieves the coordinates of the object. */ coords: string; + download: string; /** * Contains the anchor portion of the URL including the hash sign (#). */ @@ -3448,12 +3945,12 @@ interface HTMLAnchorElement extends HTMLElement { * Sets or retrieves the language code of the object. */ hreflang: string; - mimeType: string; + readonly mimeType: string; /** * Sets or retrieves the shape of the object. */ name: string; - nameProp: string; + readonly nameProp: string; /** * Contains the pathname of the URL. */ @@ -3466,7 +3963,7 @@ interface HTMLAnchorElement extends HTMLElement { * Contains the protocol of the URL. */ protocol: string; - protocolLong: string; + readonly protocolLong: string; /** * Sets or retrieves the relationship between the object and the destination of the link. */ @@ -3508,7 +4005,7 @@ interface HTMLAppletElement extends HTMLElement { /** * Retrieves a string of the URL where the object tag can be found. This is often the href of the document that the object is in, or the value set by a base element. */ - BaseHref: string; + readonly BaseHref: string; align: string; /** * Sets or retrieves a text alternative to the graphic. @@ -3535,7 +4032,7 @@ interface HTMLAppletElement extends HTMLElement { /** * Address of a pointer to the document this page or frame contains. If there is no document, then null will be returned. */ - contentDocument: Document; + readonly contentDocument: Document; /** * Sets or retrieves the URL that references the data of the object. */ @@ -3544,7 +4041,7 @@ interface HTMLAppletElement extends HTMLElement { * Sets or retrieves a character string that can be used to implement your own declare functionality for the object. */ declare: boolean; - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * Sets or retrieves the height of the object. */ @@ -3554,7 +4051,7 @@ interface HTMLAppletElement extends HTMLElement { * Sets or retrieves the shape of the object. */ name: string; - object: string; + object: string | null; /** * Sets or retrieves a message to be displayed while an object is loading. */ @@ -3585,6 +4082,7 @@ interface HTMLAreaElement extends HTMLElement { * Sets or retrieves the coordinates of the object. */ coords: string; + download: string; /** * Sets or retrieves the subsection of the href property that follows the number sign (#). */ @@ -3710,23 +4208,6 @@ declare var HTMLBaseFontElement: { new(): HTMLBaseFontElement; } -interface HTMLBlockElement extends HTMLElement { - /** - * Sets or retrieves reference information about the object. - */ - cite: string; - clear: string; - /** - * Sets or retrieves the width of the object. - */ - width: number; -} - -declare var HTMLBlockElement: { - prototype: HTMLBlockElement; - new(): HTMLBlockElement; -} - interface HTMLBodyElement extends HTMLElement { aLink: any; background: string; @@ -3754,7 +4235,6 @@ interface HTMLBodyElement extends HTMLElement { onunload: (ev: Event) => any; text: any; vLink: any; - createTextRange(): TextRange; addEventListener(type: "MSContentZoom", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; @@ -3779,10 +4259,10 @@ interface HTMLBodyElement extends HTMLElement { addEventListener(type: "afterprint", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "ariarequest", listener: (ev: AriaRequestEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforeprint", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "beforeunload", listener: (ev: BeforeUnloadEvent) => any, useCapture?: boolean): void; addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; @@ -3793,9 +4273,9 @@ interface HTMLBodyElement extends HTMLElement { addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "command", listener: (ev: CommandEvent) => any, useCapture?: boolean): void; addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; @@ -3807,7 +4287,7 @@ interface HTMLBodyElement extends HTMLElement { addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; @@ -3815,6 +4295,7 @@ interface HTMLBodyElement extends HTMLElement { addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; addEventListener(type: "hashchange", listener: (ev: HashChangeEvent) => any, useCapture?: boolean): void; addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -3832,13 +4313,13 @@ interface HTMLBodyElement extends HTMLElement { addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; addEventListener(type: "offline", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "online", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "orientationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "pagehide", listener: (ev: PageTransitionEvent) => any, useCapture?: boolean): void; addEventListener(type: "pageshow", listener: (ev: PageTransitionEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -3892,7 +4373,7 @@ interface HTMLButtonElement extends HTMLElement { /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * Overrides the action attribute (where the data on a form is sent) on the parent form element. */ @@ -3925,11 +4406,11 @@ interface HTMLButtonElement extends HTMLElement { /** * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. */ - validationMessage: string; + readonly validationMessage: string; /** * Returns a ValidityState object that represents the validity states of an element. */ - validity: ValidityState; + readonly validity: ValidityState; /** * Sets or retrieves the default or selected value of the control. */ @@ -3937,15 +4418,11 @@ interface HTMLButtonElement extends HTMLElement { /** * Returns whether an element will successfully validate based on forms validation rules and constraints. */ - willValidate: boolean; + readonly willValidate: boolean; /** * Returns whether a form will validate when it is submitted, without having to submit it. */ checkValidity(): boolean; - /** - * Creates a TextRange object for the element. - */ - createTextRange(): TextRange; /** * Sets a custom error message that is displayed when a form is submitted. * @param error Sets a custom error message that is displayed when a form is submitted. @@ -3983,6 +4460,7 @@ interface HTMLCanvasElement extends HTMLElement { * @param type The standard MIME type for the image format to return. If you do not specify this parameter, the default value is a PNG format image. */ toDataURL(type?: string, ...args: any[]): string; + toBlob(): Blob; } declare var HTMLCanvasElement: { @@ -3994,11 +4472,11 @@ interface HTMLCollection { /** * Sets or retrieves the number of objects in a collection. */ - length: number; + readonly length: number; /** * Retrieves an object from various collections. */ - item(nameOrIndex?: any, optionalIndex?: any): Element; + item(index: number): Element; /** * Retrieves a select object or an object from an options collection. */ @@ -4011,18 +4489,6 @@ declare var HTMLCollection: { new(): HTMLCollection; } -interface HTMLDDElement extends HTMLElement { - /** - * Sets or retrieves whether the browser automatically performs wordwrap. - */ - noWrap: boolean; -} - -declare var HTMLDDElement: { - prototype: HTMLDDElement; - new(): HTMLDDElement; -} - interface HTMLDListElement extends HTMLElement { compact: boolean; } @@ -4032,20 +4498,8 @@ declare var HTMLDListElement: { new(): HTMLDListElement; } -interface HTMLDTElement extends HTMLElement { - /** - * Sets or retrieves whether the browser automatically performs wordwrap. - */ - noWrap: boolean; -} - -declare var HTMLDTElement: { - prototype: HTMLDTElement; - new(): HTMLDTElement; -} - interface HTMLDataListElement extends HTMLElement { - options: HTMLCollection; + options: HTMLCollectionOf; } declare var HTMLDataListElement: { @@ -4088,38 +4542,38 @@ declare var HTMLDocument: { interface HTMLElement extends Element { accessKey: string; - children: HTMLCollection; + readonly children: HTMLCollection; contentEditable: string; - dataset: DOMStringMap; + readonly dataset: DOMStringMap; dir: string; draggable: boolean; hidden: boolean; hideFocus: boolean; innerHTML: string; innerText: string; - isContentEditable: boolean; + readonly isContentEditable: boolean; lang: string; - offsetHeight: number; - offsetLeft: number; - offsetParent: Element; - offsetTop: number; - offsetWidth: number; + readonly offsetHeight: number; + readonly offsetLeft: number; + readonly offsetParent: Element; + readonly offsetTop: number; + readonly offsetWidth: number; onabort: (ev: Event) => any; onactivate: (ev: UIEvent) => any; onbeforeactivate: (ev: UIEvent) => any; - onbeforecopy: (ev: DragEvent) => any; - onbeforecut: (ev: DragEvent) => any; + onbeforecopy: (ev: ClipboardEvent) => any; + onbeforecut: (ev: ClipboardEvent) => any; onbeforedeactivate: (ev: UIEvent) => any; - onbeforepaste: (ev: DragEvent) => any; + onbeforepaste: (ev: ClipboardEvent) => any; onblur: (ev: FocusEvent) => any; oncanplay: (ev: Event) => any; oncanplaythrough: (ev: Event) => any; onchange: (ev: Event) => any; onclick: (ev: MouseEvent) => any; oncontextmenu: (ev: PointerEvent) => any; - oncopy: (ev: DragEvent) => any; + oncopy: (ev: ClipboardEvent) => any; oncuechange: (ev: Event) => any; - oncut: (ev: DragEvent) => any; + oncut: (ev: ClipboardEvent) => any; ondblclick: (ev: MouseEvent) => any; ondeactivate: (ev: UIEvent) => any; ondrag: (ev: DragEvent) => any; @@ -4131,10 +4585,11 @@ interface HTMLElement extends Element { ondrop: (ev: DragEvent) => any; ondurationchange: (ev: Event) => any; onemptied: (ev: Event) => any; - onended: (ev: Event) => any; + onended: (ev: MediaStreamErrorEvent) => any; onerror: (ev: Event) => any; onfocus: (ev: FocusEvent) => any; oninput: (ev: Event) => any; + oninvalid: (ev: Event) => any; onkeydown: (ev: KeyboardEvent) => any; onkeypress: (ev: KeyboardEvent) => any; onkeyup: (ev: KeyboardEvent) => any; @@ -4149,10 +4604,10 @@ interface HTMLElement extends Element { onmouseout: (ev: MouseEvent) => any; onmouseover: (ev: MouseEvent) => any; onmouseup: (ev: MouseEvent) => any; - onmousewheel: (ev: MouseWheelEvent) => any; + onmousewheel: (ev: WheelEvent) => any; onmscontentzoom: (ev: UIEvent) => any; onmsmanipulationstatechanged: (ev: MSManipulationEvent) => any; - onpaste: (ev: DragEvent) => any; + onpaste: (ev: ClipboardEvent) => any; onpause: (ev: Event) => any; onplay: (ev: Event) => any; onplaying: (ev: Event) => any; @@ -4173,12 +4628,11 @@ interface HTMLElement extends Element { outerHTML: string; outerText: string; spellcheck: boolean; - style: CSSStyleDeclaration; + readonly style: CSSStyleDeclaration; tabIndex: number; title: string; blur(): void; click(): void; - contains(child: HTMLElement): boolean; dragDrop(): boolean; focus(): void; insertAdjacentElement(position: string, insertedElement: Element): Element; @@ -4210,10 +4664,10 @@ interface HTMLElement extends Element { addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "ariarequest", listener: (ev: AriaRequestEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -4221,9 +4675,9 @@ interface HTMLElement extends Element { addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "command", listener: (ev: CommandEvent) => any, useCapture?: boolean): void; addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; @@ -4235,11 +4689,12 @@ interface HTMLElement extends Element { addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -4255,8 +4710,8 @@ interface HTMLElement extends Element { addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -4318,7 +4773,7 @@ interface HTMLEmbedElement extends HTMLElement, GetSVGDocument { /** * Gets the source associated with the media element for use by the PlayToManager. */ - msPlayToSource: any; + readonly msPlayToSource: any; /** * Sets or retrieves the name of the object. */ @@ -4326,12 +4781,12 @@ interface HTMLEmbedElement extends HTMLElement, GetSVGDocument { /** * Retrieves the palette used for the embedded document. */ - palette: string; + readonly palette: string; /** * Retrieves the URL of the plug-in used to view an embedded document. */ - pluginspage: string; - readyState: string; + readonly pluginspage: string; + readonly readyState: string; /** * Sets or retrieves a URL to be loaded by the object. */ @@ -4361,19 +4816,19 @@ interface HTMLFieldSetElement extends HTMLElement { /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. */ - validationMessage: string; + readonly validationMessage: string; /** * Returns a ValidityState object that represents the validity states of an element. */ - validity: ValidityState; + readonly validity: ValidityState; /** * Returns whether an element will successfully validate based on forms validation rules and constraints. */ - willValidate: boolean; + readonly willValidate: boolean; /** * Returns whether a form will validate when it is submitted, without having to submit it. */ @@ -4419,7 +4874,7 @@ interface HTMLFormElement extends HTMLElement { /** * Retrieves a collection, in source order, of all controls in a given form. */ - elements: HTMLCollection; + readonly elements: HTMLCollection; /** * Sets or retrieves the MIME encoding for the form. */ @@ -4431,7 +4886,7 @@ interface HTMLFormElement extends HTMLElement { /** * Sets or retrieves the number of objects in a collection. */ - length: number; + readonly length: number; /** * Sets or retrieves how to send the form data to the server. */ @@ -4490,11 +4945,11 @@ interface HTMLFrameElement extends HTMLElement, GetSVGDocument { /** * Retrieves the document object of the page or frame. */ - contentDocument: Document; + readonly contentDocument: Document; /** * Retrieves the object of the specified. */ - contentWindow: Window; + readonly contentWindow: Window; /** * Sets or retrieves whether to display a border for the frame. */ @@ -4535,10 +4990,6 @@ interface HTMLFrameElement extends HTMLElement, GetSVGDocument { * Sets or retrieves whether the frame can be scrolled. */ scrolling: string; - /** - * Sets the value indicating whether the source file of a frame or iframe has specific security restrictions applied. - */ - security: any; /** * Sets or retrieves a URL to be loaded by the object. */ @@ -4570,10 +5021,10 @@ interface HTMLFrameElement extends HTMLElement, GetSVGDocument { addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "ariarequest", listener: (ev: AriaRequestEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -4581,9 +5032,9 @@ interface HTMLFrameElement extends HTMLElement, GetSVGDocument { addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "command", listener: (ev: CommandEvent) => any, useCapture?: boolean): void; addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; @@ -4595,11 +5046,12 @@ interface HTMLFrameElement extends HTMLElement, GetSVGDocument { addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -4616,8 +5068,8 @@ interface HTMLFrameElement extends HTMLElement, GetSVGDocument { addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -4727,10 +5179,10 @@ interface HTMLFrameSetElement extends HTMLElement { addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "ariarequest", listener: (ev: AriaRequestEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforeprint", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "beforeunload", listener: (ev: BeforeUnloadEvent) => any, useCapture?: boolean): void; addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; @@ -4741,9 +5193,9 @@ interface HTMLFrameSetElement extends HTMLElement { addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "command", listener: (ev: CommandEvent) => any, useCapture?: boolean): void; addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; @@ -4755,7 +5207,7 @@ interface HTMLFrameSetElement extends HTMLElement { addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; @@ -4763,6 +5215,7 @@ interface HTMLFrameSetElement extends HTMLElement { addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; addEventListener(type: "hashchange", listener: (ev: HashChangeEvent) => any, useCapture?: boolean): void; addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -4780,13 +5233,13 @@ interface HTMLFrameSetElement extends HTMLElement { addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; addEventListener(type: "offline", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "online", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "orientationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "pagehide", listener: (ev: PageTransitionEvent) => any, useCapture?: boolean): void; addEventListener(type: "pageshow", listener: (ev: PageTransitionEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -4865,7 +5318,6 @@ interface HTMLHeadingElement extends HTMLElement { * Sets or retrieves a value that indicates the table alignment. */ align: string; - clear: string; } declare var HTMLHeadingElement: { @@ -4898,11 +5350,11 @@ interface HTMLIFrameElement extends HTMLElement, GetSVGDocument { /** * Retrieves the document object of the page or frame. */ - contentDocument: Document; + readonly contentDocument: Document; /** * Retrieves the object of the specified. */ - contentWindow: Window; + readonly contentWindow: Window; /** * Sets or retrieves whether to display a border for the frame. */ @@ -4943,15 +5395,11 @@ interface HTMLIFrameElement extends HTMLElement, GetSVGDocument { * Raised when the object has been completely received from the server. */ onload: (ev: Event) => any; - sandbox: DOMSettableTokenList; + readonly sandbox: DOMSettableTokenList; /** * Sets or retrieves whether the frame can be scrolled. */ scrolling: string; - /** - * Sets the value indicating whether the source file of a frame or iframe has specific security restrictions applied. - */ - security: any; /** * Sets or retrieves a URL to be loaded by the object. */ @@ -4987,10 +5435,10 @@ interface HTMLIFrameElement extends HTMLElement, GetSVGDocument { addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "ariarequest", listener: (ev: AriaRequestEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -4998,9 +5446,9 @@ interface HTMLIFrameElement extends HTMLElement, GetSVGDocument { addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "command", listener: (ev: CommandEvent) => any, useCapture?: boolean): void; addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; @@ -5012,11 +5460,12 @@ interface HTMLIFrameElement extends HTMLElement, GetSVGDocument { addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -5033,8 +5482,8 @@ interface HTMLIFrameElement extends HTMLElement, GetSVGDocument { addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -5091,9 +5540,9 @@ interface HTMLImageElement extends HTMLElement { /** * Retrieves whether the object is fully loaded. */ - complete: boolean; + readonly complete: boolean; crossOrigin: string; - currentSrc: string; + readonly currentSrc: string; /** * Sets or retrieves the height of the object. */ @@ -5110,6 +5559,7 @@ interface HTMLImageElement extends HTMLElement { * Sets or retrieves a Uniform Resource Identifier (URI) to a long description of the object. */ longDesc: string; + lowsrc: string; /** * Gets or sets whether the DLNA PlayTo device is available. */ @@ -5122,7 +5572,7 @@ interface HTMLImageElement extends HTMLElement { /** * Gets the source associated with the media element for use by the PlayToManager. */ - msPlayToSource: any; + readonly msPlayToSource: any; /** * Sets or retrieves the name of the object. */ @@ -5130,11 +5580,12 @@ interface HTMLImageElement extends HTMLElement { /** * The original height of the image resource before sizing. */ - naturalHeight: number; + readonly naturalHeight: number; /** * The original width of the image resource before sizing. */ - naturalWidth: number; + readonly naturalWidth: number; + sizes: string; /** * The address or URL of the a media resource that is to be considered. */ @@ -5152,8 +5603,8 @@ interface HTMLImageElement extends HTMLElement { * Sets or retrieves the width of the object. */ width: number; - x: number; - y: number; + readonly x: number; + readonly y: number; msGetAsCastingSource(): any; } @@ -5195,7 +5646,7 @@ interface HTMLInputElement extends HTMLElement { /** * Retrieves whether the object is fully loaded. */ - complete: boolean; + readonly complete: boolean; /** * Sets or retrieves the state of the check box or radio button. */ @@ -5208,11 +5659,11 @@ interface HTMLInputElement extends HTMLElement { /** * Returns a FileList object on a file type input object. */ - files: FileList; + readonly files: FileList; /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * Overrides the action attribute (where the data on a form is sent) on the parent form element. */ @@ -5245,7 +5696,7 @@ interface HTMLInputElement extends HTMLElement { /** * Specifies the ID of a pre-defined datalist of options for an input element. */ - list: HTMLElement; + readonly list: HTMLElement; /** * Defines the maximum acceptable value for an input element with type="number".When used with the min and step attributes, lets you control the range and increment (such as only even numbers) that the user can enter into an input field. */ @@ -5279,6 +5730,7 @@ interface HTMLInputElement extends HTMLElement { * When present, marks an element that can't be submitted without a value. */ required: boolean; + selectionDirection: string; /** * Gets or sets the end position or offset of a text selection. */ @@ -5308,11 +5760,11 @@ interface HTMLInputElement extends HTMLElement { /** * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. */ - validationMessage: string; + readonly validationMessage: string; /** * Returns a ValidityState object that represents the validity states of an element. */ - validity: ValidityState; + readonly validity: ValidityState; /** * Returns the value of the data at the cursor's current position. */ @@ -5326,6 +5778,7 @@ interface HTMLInputElement extends HTMLElement { * Sets or retrieves the vertical margin for the object. */ vspace: number; + webkitdirectory: boolean; /** * Sets or retrieves the width of the object. */ @@ -5333,15 +5786,12 @@ interface HTMLInputElement extends HTMLElement { /** * Returns whether an element will successfully validate based on forms validation rules and constraints. */ - willValidate: boolean; + readonly willValidate: boolean; + minLength: number; /** * Returns whether a form will validate when it is submitted, without having to submit it. */ checkValidity(): boolean; - /** - * Creates a TextRange object for the element. - */ - createTextRange(): TextRange; /** * Makes the selection equal to the current object. */ @@ -5356,7 +5806,7 @@ interface HTMLInputElement extends HTMLElement { * @param start The offset into the text field for the start of the selection. * @param end The offset into the text field for the end of the selection. */ - setSelectionRange(start: number, end: number): void; + setSelectionRange(start?: number, end?: number, direction?: string): void; /** * Decrements a range input control's value by the value given by the Step attribute. If the optional parameter is used, it will decrement the input control's step value multiplied by the parameter's value. * @param n Value to decrement the value by. @@ -5374,23 +5824,6 @@ declare var HTMLInputElement: { new(): HTMLInputElement; } -interface HTMLIsIndexElement extends HTMLElement { - /** - * Sets or retrieves the URL to which the form content is sent for processing. - */ - action: string; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - form: HTMLFormElement; - prompt: string; -} - -declare var HTMLIsIndexElement: { - prototype: HTMLIsIndexElement; - new(): HTMLIsIndexElement; -} - interface HTMLLIElement extends HTMLElement { type: string; /** @@ -5408,7 +5841,7 @@ interface HTMLLabelElement extends HTMLElement { /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * Sets or retrieves the object to which the given label object is assigned. */ @@ -5428,7 +5861,7 @@ interface HTMLLegendElement extends HTMLElement { /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; } declare var HTMLLegendElement: { @@ -5470,6 +5903,7 @@ interface HTMLLinkElement extends HTMLElement, LinkStyle { * Sets or retrieves the MIME type of the object. */ type: string; + import?: Document; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -5482,7 +5916,7 @@ interface HTMLMapElement extends HTMLElement { /** * Retrieves a collection of the area objects defined for the given map object. */ - areas: HTMLAreasCollection; + readonly areas: HTMLAreasCollection; /** * Sets or retrieves the name of the object. */ @@ -5534,10 +5968,10 @@ interface HTMLMarqueeElement extends HTMLElement { addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "ariarequest", listener: (ev: AriaRequestEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "bounce", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -5546,9 +5980,9 @@ interface HTMLMarqueeElement extends HTMLElement { addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "command", listener: (ev: CommandEvent) => any, useCapture?: boolean): void; addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; @@ -5560,12 +5994,13 @@ interface HTMLMarqueeElement extends HTMLElement { addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "finish", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -5581,8 +6016,8 @@ interface HTMLMarqueeElement extends HTMLElement { addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -5628,7 +6063,7 @@ interface HTMLMediaElement extends HTMLElement { /** * Returns an AudioTrackList object with the audio tracks for a given video element. */ - audioTracks: AudioTrackList; + readonly audioTracks: AudioTrackList; /** * Gets or sets a value that indicates whether to start playing the media automatically. */ @@ -5636,15 +6071,16 @@ interface HTMLMediaElement extends HTMLElement { /** * Gets a collection of buffered time ranges. */ - buffered: TimeRanges; + readonly buffered: TimeRanges; /** * Gets or sets a flag that indicates whether the client provides a set of controls for the media (in case the developer does not include controls for the player). */ controls: boolean; + crossOrigin: string; /** * Gets the address or URL of the current media resource that is selected by IHTMLMediaElement. */ - currentSrc: string; + readonly currentSrc: string; /** * Gets or sets the current playback position, in seconds. */ @@ -5657,19 +6093,20 @@ interface HTMLMediaElement extends HTMLElement { /** * Returns the duration in seconds of the current media resource. A NaN value is returned if duration is not available, or Infinity if the media resource is streaming. */ - duration: number; + readonly duration: number; /** * Gets information about whether the playback has ended or not. */ - ended: boolean; + readonly ended: boolean; /** * Returns an object representing the current error state of the audio or video element. */ - error: MediaError; + readonly error: MediaError; /** * Gets or sets a flag to specify whether playback should restart after it completes. */ loop: boolean; + readonly mediaKeys: MediaKeys | null; /** * Specifies the purpose of the audio or video media, such as background audio or alerts. */ @@ -5678,11 +6115,11 @@ interface HTMLMediaElement extends HTMLElement { * Specifies the output device id that the audio will be sent to. */ msAudioDeviceType: string; - msGraphicsTrustStatus: MSGraphicsTrust; + readonly msGraphicsTrustStatus: MSGraphicsTrust; /** * Gets the MSMediaKeys object, which is used for decrypting media data, that is associated with this media element. */ - msKeys: MSMediaKeys; + readonly msKeys: MSMediaKeys; /** * Gets or sets whether the DLNA PlayTo device is available. */ @@ -5698,7 +6135,7 @@ interface HTMLMediaElement extends HTMLElement { /** * Gets the source associated with the media element for use by the PlayToManager. */ - msPlayToSource: any; + readonly msPlayToSource: any; /** * Specifies whether or not to enable low-latency playback on the media element. */ @@ -5710,12 +6147,13 @@ interface HTMLMediaElement extends HTMLElement { /** * Gets the current network activity for the element. */ - networkState: number; + readonly networkState: number; + onencrypted: (ev: MediaEncryptedEvent) => any; onmsneedkey: (ev: MSMediaKeyNeededEvent) => any; /** * Gets a flag that specifies whether playback is paused. */ - paused: boolean; + readonly paused: boolean; /** * Gets or sets the current rate of speed for the media resource to play. This speed is expressed as a multiple of the normal speed of the media resource. */ @@ -5723,26 +6161,27 @@ interface HTMLMediaElement extends HTMLElement { /** * Gets TimeRanges for the current media resource that has been played. */ - played: TimeRanges; + readonly played: TimeRanges; /** * Gets or sets the current playback position, in seconds. */ preload: string; - readyState: any; + readyState: number; /** * Returns a TimeRanges object that represents the ranges of the current media resource that can be seeked. */ - seekable: TimeRanges; + readonly seekable: TimeRanges; /** * Gets a flag that indicates whether the the client is currently moving to a new playback position in the media resource. */ - seeking: boolean; + readonly seeking: boolean; /** * The address or URL of the a media resource that is to be considered. */ src: string; - textTracks: TextTrackList; - videoTracks: VideoTrackList; + srcObject: MediaStream | null; + readonly textTracks: TextTrackList; + readonly videoTracks: VideoTrackList; /** * Gets or sets the volume level for audio portions of the media element. */ @@ -5778,15 +6217,16 @@ interface HTMLMediaElement extends HTMLElement { * Loads and starts playback of a media resource. */ play(): void; - HAVE_CURRENT_DATA: number; - HAVE_ENOUGH_DATA: number; - HAVE_FUTURE_DATA: number; - HAVE_METADATA: number; - HAVE_NOTHING: number; - NETWORK_EMPTY: number; - NETWORK_IDLE: number; - NETWORK_LOADING: number; - NETWORK_NO_SOURCE: number; + setMediaKeys(mediaKeys: MediaKeys | null): PromiseLike; + readonly HAVE_CURRENT_DATA: number; + readonly HAVE_ENOUGH_DATA: number; + readonly HAVE_FUTURE_DATA: number; + readonly HAVE_METADATA: number; + readonly HAVE_NOTHING: number; + readonly NETWORK_EMPTY: number; + readonly NETWORK_IDLE: number; + readonly NETWORK_LOADING: number; + readonly NETWORK_NO_SOURCE: number; addEventListener(type: "MSContentZoom", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; @@ -5810,10 +6250,10 @@ interface HTMLMediaElement extends HTMLElement { addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "ariarequest", listener: (ev: AriaRequestEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -5821,9 +6261,9 @@ interface HTMLMediaElement extends HTMLElement { addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "command", listener: (ev: CommandEvent) => any, useCapture?: boolean): void; addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; @@ -5835,11 +6275,13 @@ interface HTMLMediaElement extends HTMLElement { addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "encrypted", listener: (ev: MediaEncryptedEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -5855,9 +6297,9 @@ interface HTMLMediaElement extends HTMLElement { addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; addEventListener(type: "msneedkey", listener: (ev: MSMediaKeyNeededEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -5896,15 +6338,15 @@ interface HTMLMediaElement extends HTMLElement { declare var HTMLMediaElement: { prototype: HTMLMediaElement; new(): HTMLMediaElement; - HAVE_CURRENT_DATA: number; - HAVE_ENOUGH_DATA: number; - HAVE_FUTURE_DATA: number; - HAVE_METADATA: number; - HAVE_NOTHING: number; - NETWORK_EMPTY: number; - NETWORK_IDLE: number; - NETWORK_LOADING: number; - NETWORK_NO_SOURCE: number; + readonly HAVE_CURRENT_DATA: number; + readonly HAVE_ENOUGH_DATA: number; + readonly HAVE_FUTURE_DATA: number; + readonly HAVE_METADATA: number; + readonly HAVE_NOTHING: number; + readonly NETWORK_EMPTY: number; + readonly NETWORK_IDLE: number; + readonly NETWORK_LOADING: number; + readonly NETWORK_NO_SOURCE: number; } interface HTMLMenuElement extends HTMLElement { @@ -5949,6 +6391,20 @@ declare var HTMLMetaElement: { new(): HTMLMetaElement; } +interface HTMLMeterElement extends HTMLElement { + high: number; + low: number; + max: number; + min: number; + optimum: number; + value: number; +} + +declare var HTMLMeterElement: { + prototype: HTMLMeterElement; + new(): HTMLMeterElement; +} + interface HTMLModElement extends HTMLElement { /** * Sets or retrieves reference information about the object. @@ -5965,15 +6421,6 @@ declare var HTMLModElement: { new(): HTMLModElement; } -interface HTMLNextIdElement extends HTMLElement { - n: string; -} - -declare var HTMLNextIdElement: { - prototype: HTMLNextIdElement; - new(): HTMLNextIdElement; -} - interface HTMLOListElement extends HTMLElement { compact: boolean; /** @@ -5992,7 +6439,7 @@ interface HTMLObjectElement extends HTMLElement, GetSVGDocument { /** * Retrieves a string of the URL where the object tag can be found. This is often the href of the document that the object is in, or the value set by a base element. */ - BaseHref: string; + readonly BaseHref: string; align: string; /** * Sets or retrieves a text alternative to the graphic. @@ -6022,7 +6469,7 @@ interface HTMLObjectElement extends HTMLElement, GetSVGDocument { /** * Retrieves the document object of the page or frame. */ - contentDocument: Document; + readonly contentDocument: Document; /** * Sets or retrieves the URL that references the data of the object. */ @@ -6031,7 +6478,7 @@ interface HTMLObjectElement extends HTMLElement, GetSVGDocument { /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * Sets or retrieves the height of the object. */ @@ -6052,7 +6499,7 @@ interface HTMLObjectElement extends HTMLElement, GetSVGDocument { /** * Gets the source associated with the media element for use by the PlayToManager. */ - msPlayToSource: any; + readonly msPlayToSource: any; /** * Sets or retrieves the name of the object. */ @@ -6060,8 +6507,8 @@ interface HTMLObjectElement extends HTMLElement, GetSVGDocument { /** * Retrieves the contained object. */ - object: any; - readyState: number; + readonly object: any; + readonly readyState: number; /** * Sets or retrieves a message to be displayed while an object is loading. */ @@ -6077,11 +6524,11 @@ interface HTMLObjectElement extends HTMLElement, GetSVGDocument { /** * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. */ - validationMessage: string; + readonly validationMessage: string; /** * Returns a ValidityState object that represents the validity states of an element. */ - validity: ValidityState; + readonly validity: ValidityState; vspace: number; /** * Sets or retrieves the width of the object. @@ -6090,7 +6537,7 @@ interface HTMLObjectElement extends HTMLElement, GetSVGDocument { /** * Returns whether an element will successfully validate based on forms validation rules and constraints. */ - willValidate: boolean; + readonly willValidate: boolean; /** * Returns whether a form will validate when it is submitted, without having to submit it. */ @@ -6117,11 +6564,11 @@ interface HTMLOptGroupElement extends HTMLElement { /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * Sets or retrieves the ordinal position of an option in a list box. */ - index: number; + readonly index: number; /** * Sets or retrieves a value that you can use to implement your own label functionality for the object. */ @@ -6133,7 +6580,7 @@ interface HTMLOptGroupElement extends HTMLElement { /** * Sets or retrieves the text string specified by the option tag. */ - text: string; + readonly text: string; /** * Sets or retrieves the value which is returned to the server when the form control is submitted. */ @@ -6154,11 +6601,11 @@ interface HTMLOptionElement extends HTMLElement { /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * Sets or retrieves the ordinal position of an option in a list box. */ - index: number; + readonly index: number; /** * Sets or retrieves a value that you can use to implement your own label functionality for the object. */ @@ -6183,6 +6630,18 @@ declare var HTMLOptionElement: { create(): HTMLOptionElement; } +interface HTMLOptionsCollection extends HTMLCollection { + length: number; + selectedIndex: number; + add(element: HTMLOptionElement | HTMLOptGroupElement, before?: HTMLElement | number): void; + remove(index: number): void; +} + +declare var HTMLOptionsCollection: { + prototype: HTMLOptionsCollection; + new(): HTMLOptionsCollection; +} + interface HTMLParagraphElement extends HTMLElement { /** * Sets or retrieves how the object is aligned with adjacent text. @@ -6220,28 +6679,15 @@ declare var HTMLParamElement: { new(): HTMLParamElement; } -interface HTMLPhraseElement extends HTMLElement { - /** - * Sets or retrieves reference information about the object. - */ - cite: string; - /** - * Sets or retrieves the date and time of a modification to the object. - */ - dateTime: string; +interface HTMLPictureElement extends HTMLElement { } -declare var HTMLPhraseElement: { - prototype: HTMLPhraseElement; - new(): HTMLPhraseElement; +declare var HTMLPictureElement: { + prototype: HTMLPictureElement; + new(): HTMLPictureElement; } interface HTMLPreElement extends HTMLElement { - /** - * Indicates a citation by rendering text in italic type. - */ - cite: string; - clear: string; /** * Sets or gets a value that you can use to implement your own width functionality for the object. */ @@ -6257,7 +6703,7 @@ interface HTMLProgressElement extends HTMLElement { /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * Defines the maximum, or "done" value for a progress element. */ @@ -6265,7 +6711,7 @@ interface HTMLProgressElement extends HTMLElement { /** * Returns the quotient of value/max when the value attribute is set (determinate progress bar), or -1 when the value attribute is missing (indeterminate progress bar). */ - position: number; + readonly position: number; /** * Sets or gets the current value of a progress element. The value must be a non-negative number between 0 and the max value. */ @@ -6282,10 +6728,6 @@ interface HTMLQuoteElement extends HTMLElement { * Sets or retrieves reference information about the object. */ cite: string; - /** - * Sets or retrieves the date and time of a modification to the object. - */ - dateTime: string; } declare var HTMLQuoteElement: { @@ -6339,7 +6781,7 @@ interface HTMLSelectElement extends HTMLElement { /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * Sets or retrieves the number of objects in a collection. */ @@ -6352,7 +6794,7 @@ interface HTMLSelectElement extends HTMLElement { * Sets or retrieves the name of the object. */ name: string; - options: HTMLSelectElement; + options: HTMLCollectionOf; /** * When present, marks an element that can't be submitted without a value. */ @@ -6361,6 +6803,7 @@ interface HTMLSelectElement extends HTMLElement { * Sets or retrieves the index of the selected option in a select object. */ selectedIndex: number; + selectedOptions: HTMLCollectionOf; /** * Sets or retrieves the number of rows in the list box. */ @@ -6368,15 +6811,15 @@ interface HTMLSelectElement extends HTMLElement { /** * Retrieves the type of select control based on the value of the MULTIPLE attribute. */ - type: string; + readonly type: string; /** * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. */ - validationMessage: string; + readonly validationMessage: string; /** * Returns a ValidityState object that represents the validity states of an element. */ - validity: ValidityState; + readonly validity: ValidityState; /** * Sets or retrieves the value which is returned to the server when the form control is submitted. */ @@ -6384,7 +6827,7 @@ interface HTMLSelectElement extends HTMLElement { /** * Returns whether an element will successfully validate based on forms validation rules and constraints. */ - willValidate: boolean; + readonly willValidate: boolean; /** * Adds an element to the areas, controlRange, or options collection. * @param element Variant of type Number that specifies the index position in the collection where the element is placed. If no value is given, the method places the element at the end of the collection. @@ -6430,10 +6873,12 @@ interface HTMLSourceElement extends HTMLElement { */ media: string; msKeySystem: string; + sizes: string; /** * The address or URL of the a media resource that is to be considered. */ src: string; + srcset: string; /** * Gets or sets the MIME type of a media resource. */ @@ -6454,6 +6899,7 @@ declare var HTMLSpanElement: { } interface HTMLStyleElement extends HTMLElement, LinkStyle { + disabled: boolean; /** * Sets or retrieves the media type. */ @@ -6503,7 +6949,7 @@ interface HTMLTableCellElement extends HTMLElement, HTMLTableAlignment { /** * Retrieves the position of the object in the cells collection of a row. */ - cellIndex: number; + readonly cellIndex: number; /** * Sets or retrieves the number columns in the table that the object should span. */ @@ -6610,7 +7056,7 @@ interface HTMLTableElement extends HTMLElement { /** * Sets or retrieves the number of horizontal rows contained in the object. */ - rows: HTMLCollection; + rows: HTMLCollectionOf; /** * Sets or retrieves which dividing lines (inner borders) are displayed. */ @@ -6622,7 +7068,7 @@ interface HTMLTableElement extends HTMLElement { /** * Retrieves a collection of all tBody objects in the table. Objects in this collection are in source order. */ - tBodies: HTMLCollection; + tBodies: HTMLCollectionOf; /** * Retrieves the tFoot object of the table. */ @@ -6638,19 +7084,19 @@ interface HTMLTableElement extends HTMLElement { /** * Creates an empty caption element in the table. */ - createCaption(): HTMLElement; + createCaption(): HTMLTableCaptionElement; /** * Creates an empty tBody element in the table. */ - createTBody(): HTMLElement; + createTBody(): HTMLTableSectionElement; /** * Creates an empty tFoot element in the table. */ - createTFoot(): HTMLElement; + createTFoot(): HTMLTableSectionElement; /** * Returns the tHead element object if successful, or null otherwise. */ - createTHead(): HTMLElement; + createTHead(): HTMLTableSectionElement; /** * Deletes the caption element and its contents from the table. */ @@ -6672,7 +7118,7 @@ interface HTMLTableElement extends HTMLElement { * Creates a new row (tr) in the table, and adds the row to the rows collection. * @param index Number that specifies where to insert the row in the rows collection. The default value is -1, which appends the new row to the end of the rows collection. */ - insertRow(index?: number): HTMLElement; + insertRow(index?: number): HTMLTableRowElement; } declare var HTMLTableElement: { @@ -6701,7 +7147,7 @@ interface HTMLTableRowElement extends HTMLElement, HTMLTableAlignment { /** * Retrieves a collection of all cells in the table row. */ - cells: HTMLCollection; + cells: HTMLCollectionOf; /** * Sets or retrieves the height of the object. */ @@ -6709,11 +7155,11 @@ interface HTMLTableRowElement extends HTMLElement, HTMLTableAlignment { /** * Retrieves the position of the object in the rows collection for the table. */ - rowIndex: number; + readonly rowIndex: number; /** * Retrieves the position of the object in the collection. */ - sectionRowIndex: number; + readonly sectionRowIndex: number; /** * Removes the specified cell from the table row, as well as from the cells collection. * @param index Number that specifies the zero-based position of the cell to remove from the table row. If no value is provided, the last cell in the cells collection is deleted. @@ -6723,7 +7169,7 @@ interface HTMLTableRowElement extends HTMLElement, HTMLTableAlignment { * Creates a new cell in the table row, and adds the cell to the cells collection. * @param index Number that specifies where to insert the cell in the tr. The default value is -1, which appends the new cell to the end of the cells collection. */ - insertCell(index?: number): HTMLElement; + insertCell(index?: number): HTMLTableDataCellElement; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -6740,7 +7186,7 @@ interface HTMLTableSectionElement extends HTMLElement, HTMLTableAlignment { /** * Sets or retrieves the number of horizontal rows contained in the object. */ - rows: HTMLCollection; + rows: HTMLCollectionOf; /** * Removes the specified row (tr) from the element and from the rows collection. * @param index Number that specifies the zero-based position in the rows collection of the row to remove. @@ -6750,7 +7196,7 @@ interface HTMLTableSectionElement extends HTMLElement, HTMLTableAlignment { * Creates a new row (tr) in the table, and adds the row to the rows collection. * @param index Number that specifies where to insert the row in the rows collection. The default value is -1, which appends the new row to the end of the rows collection. */ - insertRow(index?: number): HTMLElement; + insertRow(index?: number): HTMLTableRowElement; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -6759,6 +7205,15 @@ declare var HTMLTableSectionElement: { new(): HTMLTableSectionElement; } +interface HTMLTemplateElement extends HTMLElement { + readonly content: DocumentFragment; +} + +declare var HTMLTemplateElement: { + prototype: HTMLTemplateElement; + new(): HTMLTemplateElement; +} + interface HTMLTextAreaElement extends HTMLElement { /** * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing. @@ -6776,7 +7231,7 @@ interface HTMLTextAreaElement extends HTMLElement { /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * Sets or retrieves the maximum number of characters that the user can enter in a text control. */ @@ -6816,15 +7271,15 @@ interface HTMLTextAreaElement extends HTMLElement { /** * Retrieves the type of control. */ - type: string; + readonly type: string; /** * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. */ - validationMessage: string; + readonly validationMessage: string; /** * Returns a ValidityState object that represents the validity states of an element. */ - validity: ValidityState; + readonly validity: ValidityState; /** * Retrieves or sets the text in the entry field of the textArea element. */ @@ -6832,19 +7287,16 @@ interface HTMLTextAreaElement extends HTMLElement { /** * Returns whether an element will successfully validate based on forms validation rules and constraints. */ - willValidate: boolean; + readonly willValidate: boolean; /** * Sets or retrieves how to handle wordwrapping in the object. */ wrap: string; + minLength: number; /** * Returns whether a form will validate when it is submitted, without having to submit it. */ checkValidity(): boolean; - /** - * Creates a TextRange object for the element. - */ - createTextRange(): TextRange; /** * Highlights the input area of a form element. */ @@ -6883,23 +7335,23 @@ interface HTMLTrackElement extends HTMLElement { default: boolean; kind: string; label: string; - readyState: number; + readonly readyState: number; src: string; srclang: string; - track: TextTrack; - ERROR: number; - LOADED: number; - LOADING: number; - NONE: number; + readonly track: TextTrack; + readonly ERROR: number; + readonly LOADED: number; + readonly LOADING: number; + readonly NONE: number; } declare var HTMLTrackElement: { prototype: HTMLTrackElement; new(): HTMLTrackElement; - ERROR: number; - LOADED: number; - LOADING: number; - NONE: number; + readonly ERROR: number; + readonly LOADED: number; + readonly LOADING: number; + readonly NONE: number; } interface HTMLUListElement extends HTMLElement { @@ -6926,8 +7378,8 @@ interface HTMLVideoElement extends HTMLMediaElement { */ height: number; msHorizontalMirror: boolean; - msIsLayoutOptimalForPlayback: boolean; - msIsStereo3D: boolean; + readonly msIsLayoutOptimalForPlayback: boolean; + readonly msIsStereo3D: boolean; msStereo3DPackingMode: string; msStereo3DRenderMode: string; msZoom: boolean; @@ -6941,13 +7393,13 @@ interface HTMLVideoElement extends HTMLMediaElement { /** * Gets the intrinsic height of a video in CSS pixels, or zero if the dimensions are not known. */ - videoHeight: number; + readonly videoHeight: number; /** * Gets the intrinsic width of a video in CSS pixels, or zero if the dimensions are not known. */ - videoWidth: number; - webkitDisplayingFullscreen: boolean; - webkitSupportsFullscreen: boolean; + readonly videoWidth: number; + readonly webkitDisplayingFullscreen: boolean; + readonly webkitSupportsFullscreen: boolean; /** * Gets or sets the width of the video element. */ @@ -6986,10 +7438,10 @@ interface HTMLVideoElement extends HTMLMediaElement { addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "ariarequest", listener: (ev: AriaRequestEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -6997,9 +7449,9 @@ interface HTMLVideoElement extends HTMLMediaElement { addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "command", listener: (ev: CommandEvent) => any, useCapture?: boolean): void; addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; @@ -7011,11 +7463,13 @@ interface HTMLVideoElement extends HTMLMediaElement { addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "encrypted", listener: (ev: MediaEncryptedEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -7031,9 +7485,9 @@ interface HTMLVideoElement extends HTMLMediaElement { addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; addEventListener(type: "msneedkey", listener: (ev: MSMediaKeyNeededEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -7075,8 +7529,8 @@ declare var HTMLVideoElement: { } interface HashChangeEvent extends Event { - newURL: string; - oldURL: string; + readonly newURL: string | null; + readonly oldURL: string | null; } declare var HashChangeEvent: { @@ -7085,8 +7539,8 @@ declare var HashChangeEvent: { } interface History { - length: number; - state: any; + readonly length: number; + readonly state: any; back(distance?: any): void; forward(distance?: any): void; go(delta?: any): void; @@ -7100,31 +7554,31 @@ declare var History: { } interface IDBCursor { - direction: string; - key: any; - primaryKey: any; - source: any; + readonly direction: string; + key: IDBKeyRange | IDBValidKey; + readonly primaryKey: any; + source: IDBObjectStore | IDBIndex; advance(count: number): void; - continue(key?: any): void; + continue(key?: IDBKeyRange | IDBValidKey): void; delete(): IDBRequest; update(value: any): IDBRequest; - NEXT: string; - NEXT_NO_DUPLICATE: string; - PREV: string; - PREV_NO_DUPLICATE: string; + readonly NEXT: string; + readonly NEXT_NO_DUPLICATE: string; + readonly PREV: string; + readonly PREV_NO_DUPLICATE: string; } declare var IDBCursor: { prototype: IDBCursor; new(): IDBCursor; - NEXT: string; - NEXT_NO_DUPLICATE: string; - PREV: string; - PREV_NO_DUPLICATE: string; + readonly NEXT: string; + readonly NEXT_NO_DUPLICATE: string; + readonly PREV: string; + readonly PREV_NO_DUPLICATE: string; } interface IDBCursorWithValue extends IDBCursor { - value: any; + readonly value: any; } declare var IDBCursorWithValue: { @@ -7133,15 +7587,17 @@ declare var IDBCursorWithValue: { } interface IDBDatabase extends EventTarget { - name: string; - objectStoreNames: DOMStringList; + readonly name: string; + readonly objectStoreNames: DOMStringList; onabort: (ev: Event) => any; onerror: (ev: Event) => any; - version: string; + version: number; + onversionchange: (ev: IDBVersionChangeEvent) => any; close(): void; - createObjectStore(name: string, optionalParameters?: any): IDBObjectStore; + createObjectStore(name: string, optionalParameters?: IDBObjectStoreParameters): IDBObjectStore; deleteObjectStore(name: string): void; - transaction(storeNames: any, mode?: string): IDBTransaction; + transaction(storeNames: string | string[], mode?: string): IDBTransaction; + addEventListener(type: "versionchange", listener: (ev: IDBVersionChangeEvent) => any, useCapture?: boolean): void; addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; @@ -7164,15 +7620,16 @@ declare var IDBFactory: { } interface IDBIndex { - keyPath: string; - name: string; - objectStore: IDBObjectStore; - unique: boolean; - count(key?: any): IDBRequest; - get(key: any): IDBRequest; - getKey(key: any): IDBRequest; - openCursor(range?: IDBKeyRange, direction?: string): IDBRequest; - openKeyCursor(range?: IDBKeyRange, direction?: string): IDBRequest; + keyPath: string | string[]; + readonly name: string; + readonly objectStore: IDBObjectStore; + readonly unique: boolean; + multiEntry: boolean; + count(key?: IDBKeyRange | IDBValidKey): IDBRequest; + get(key: IDBKeyRange | IDBValidKey): IDBRequest; + getKey(key: IDBKeyRange | IDBValidKey): IDBRequest; + openCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; + openKeyCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; } declare var IDBIndex: { @@ -7181,36 +7638,37 @@ declare var IDBIndex: { } interface IDBKeyRange { - lower: any; - lowerOpen: boolean; - upper: any; - upperOpen: boolean; + readonly lower: any; + readonly lowerOpen: boolean; + readonly upper: any; + readonly upperOpen: boolean; } declare var IDBKeyRange: { prototype: IDBKeyRange; new(): IDBKeyRange; bound(lower: any, upper: any, lowerOpen?: boolean, upperOpen?: boolean): IDBKeyRange; - lowerBound(bound: any, open?: boolean): IDBKeyRange; + lowerBound(lower: any, open?: boolean): IDBKeyRange; only(value: any): IDBKeyRange; - upperBound(bound: any, open?: boolean): IDBKeyRange; + upperBound(upper: any, open?: boolean): IDBKeyRange; } interface IDBObjectStore { - indexNames: DOMStringList; - keyPath: string; - name: string; - transaction: IDBTransaction; - add(value: any, key?: any): IDBRequest; + readonly indexNames: DOMStringList; + keyPath: string | string[]; + readonly name: string; + readonly transaction: IDBTransaction; + autoIncrement: boolean; + add(value: any, key?: IDBKeyRange | IDBValidKey): IDBRequest; clear(): IDBRequest; - count(key?: any): IDBRequest; - createIndex(name: string, keyPath: string, optionalParameters?: any): IDBIndex; - delete(key: any): IDBRequest; + count(key?: IDBKeyRange | IDBValidKey): IDBRequest; + createIndex(name: string, keyPath: string | string[], optionalParameters?: IDBIndexParameters): IDBIndex; + delete(key: IDBKeyRange | IDBValidKey): IDBRequest; deleteIndex(indexName: string): void; get(key: any): IDBRequest; index(name: string): IDBIndex; - openCursor(range?: any, direction?: string): IDBRequest; - put(value: any, key?: any): IDBRequest; + openCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; + put(value: any, key?: IDBKeyRange | IDBValidKey): IDBRequest; } declare var IDBObjectStore: { @@ -7234,13 +7692,13 @@ declare var IDBOpenDBRequest: { } interface IDBRequest extends EventTarget { - error: DOMError; + readonly error: DOMError; onerror: (ev: Event) => any; onsuccess: (ev: Event) => any; - readyState: string; - result: any; - source: any; - transaction: IDBTransaction; + readonly readyState: string; + readonly result: any; + source: IDBObjectStore | IDBIndex | IDBCursor; + readonly transaction: IDBTransaction; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "success", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; @@ -7252,17 +7710,17 @@ declare var IDBRequest: { } interface IDBTransaction extends EventTarget { - db: IDBDatabase; - error: DOMError; - mode: string; + readonly db: IDBDatabase; + readonly error: DOMError; + readonly mode: string; onabort: (ev: Event) => any; oncomplete: (ev: Event) => any; onerror: (ev: Event) => any; abort(): void; objectStore(name: string): IDBObjectStore; - READ_ONLY: string; - READ_WRITE: string; - VERSION_CHANGE: string; + readonly READ_ONLY: string; + readonly READ_WRITE: string; + readonly VERSION_CHANGE: string; addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "complete", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; @@ -7272,14 +7730,14 @@ interface IDBTransaction extends EventTarget { declare var IDBTransaction: { prototype: IDBTransaction; new(): IDBTransaction; - READ_ONLY: string; - READ_WRITE: string; - VERSION_CHANGE: string; + readonly READ_ONLY: string; + readonly READ_WRITE: string; + readonly VERSION_CHANGE: string; } interface IDBVersionChangeEvent extends Event { - newVersion: number; - oldVersion: number; + readonly newVersion: number | null; + readonly oldVersion: number; } declare var IDBVersionChangeEvent: { @@ -7288,9 +7746,9 @@ declare var IDBVersionChangeEvent: { } interface ImageData { - data: number[]; - height: number; - width: number; + data: Uint8ClampedArray; + readonly height: number; + readonly width: number; } declare var ImageData: { @@ -7300,37 +7758,47 @@ declare var ImageData: { } interface KeyboardEvent extends UIEvent { - altKey: boolean; - char: string; - charCode: number; - ctrlKey: boolean; - key: string; - keyCode: number; - locale: string; - location: number; - metaKey: boolean; - repeat: boolean; - shiftKey: boolean; - which: number; + readonly altKey: boolean; + readonly char: string | null; + readonly charCode: number; + readonly ctrlKey: boolean; + readonly key: string; + readonly keyCode: number; + readonly locale: string; + readonly location: number; + readonly metaKey: boolean; + readonly repeat: boolean; + readonly shiftKey: boolean; + readonly which: number; getModifierState(keyArg: string): boolean; initKeyboardEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, keyArg: string, locationArg: number, modifiersListArg: string, repeat: boolean, locale: string): void; - DOM_KEY_LOCATION_JOYSTICK: number; - DOM_KEY_LOCATION_LEFT: number; - DOM_KEY_LOCATION_MOBILE: number; - DOM_KEY_LOCATION_NUMPAD: number; - DOM_KEY_LOCATION_RIGHT: number; - DOM_KEY_LOCATION_STANDARD: number; + readonly DOM_KEY_LOCATION_JOYSTICK: number; + readonly DOM_KEY_LOCATION_LEFT: number; + readonly DOM_KEY_LOCATION_MOBILE: number; + readonly DOM_KEY_LOCATION_NUMPAD: number; + readonly DOM_KEY_LOCATION_RIGHT: number; + readonly DOM_KEY_LOCATION_STANDARD: number; } declare var KeyboardEvent: { prototype: KeyboardEvent; new(typeArg: string, eventInitDict?: KeyboardEventInit): KeyboardEvent; - DOM_KEY_LOCATION_JOYSTICK: number; - DOM_KEY_LOCATION_LEFT: number; - DOM_KEY_LOCATION_MOBILE: number; - DOM_KEY_LOCATION_NUMPAD: number; - DOM_KEY_LOCATION_RIGHT: number; - DOM_KEY_LOCATION_STANDARD: number; + readonly DOM_KEY_LOCATION_JOYSTICK: number; + readonly DOM_KEY_LOCATION_LEFT: number; + readonly DOM_KEY_LOCATION_MOBILE: number; + readonly DOM_KEY_LOCATION_NUMPAD: number; + readonly DOM_KEY_LOCATION_RIGHT: number; + readonly DOM_KEY_LOCATION_STANDARD: number; +} + +interface ListeningStateChangedEvent extends Event { + readonly label: string; + readonly state: string; +} + +declare var ListeningStateChangedEvent: { + prototype: ListeningStateChangedEvent; + new(): ListeningStateChangedEvent; } interface Location { @@ -7338,7 +7806,7 @@ interface Location { host: string; hostname: string; href: string; - origin: string; + readonly origin: string; pathname: string; port: string; protocol: string; @@ -7355,7 +7823,7 @@ declare var Location: { } interface LongRunningScriptDetectedEvent extends Event { - executionTime: number; + readonly executionTime: number; stopPageScriptExecution: boolean; } @@ -7374,29 +7842,29 @@ interface MSApp { execAsyncAtPriority(asynchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): void; execAtPriority(synchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): any; getCurrentPriority(): string; - getHtmlPrintDocumentSourceAsync(htmlDoc: any): any; + getHtmlPrintDocumentSourceAsync(htmlDoc: any): PromiseLike; getViewId(view: any): any; isTaskScheduledAtPriorityOrHigher(priority: string): boolean; pageHandlesAllApplicationActivations(enabled: boolean): void; suppressSubdownloadCredentialPrompts(suppress: boolean): void; terminateApp(exceptionObject: any): void; - CURRENT: string; - HIGH: string; - IDLE: string; - NORMAL: string; + readonly CURRENT: string; + readonly HIGH: string; + readonly IDLE: string; + readonly NORMAL: string; } declare var MSApp: MSApp; interface MSAppAsyncOperation extends EventTarget { - error: DOMError; + readonly error: DOMError; oncomplete: (ev: Event) => any; onerror: (ev: Event) => any; - readyState: number; - result: any; + readonly readyState: number; + readonly result: any; start(): void; - COMPLETED: number; - ERROR: number; - STARTED: number; + readonly COMPLETED: number; + readonly ERROR: number; + readonly STARTED: number; addEventListener(type: "complete", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; @@ -7405,9 +7873,19 @@ interface MSAppAsyncOperation extends EventTarget { declare var MSAppAsyncOperation: { prototype: MSAppAsyncOperation; new(): MSAppAsyncOperation; - COMPLETED: number; - ERROR: number; - STARTED: number; + readonly COMPLETED: number; + readonly ERROR: number; + readonly STARTED: number; +} + +interface MSAssertion { + readonly id: string; + readonly type: string; +} + +declare var MSAssertion: { + prototype: MSAssertion; + new(): MSAssertion; } interface MSBlobBuilder { @@ -7420,44 +7898,46 @@ declare var MSBlobBuilder: { new(): MSBlobBuilder; } -interface MSCSSMatrix { - a: number; - b: number; - c: number; - d: number; - e: number; - f: number; - m11: number; - m12: number; - m13: number; - m14: number; - m21: number; - m22: number; - m23: number; - m24: number; - m31: number; - m32: number; - m33: number; - m34: number; - m41: number; - m42: number; - m43: number; - m44: number; - inverse(): MSCSSMatrix; - multiply(secondMatrix: MSCSSMatrix): MSCSSMatrix; - rotate(angleX: number, angleY?: number, angleZ?: number): MSCSSMatrix; - rotateAxisAngle(x: number, y: number, z: number, angle: number): MSCSSMatrix; - scale(scaleX: number, scaleY?: number, scaleZ?: number): MSCSSMatrix; - setMatrixValue(value: string): void; - skewX(angle: number): MSCSSMatrix; - skewY(angle: number): MSCSSMatrix; - toString(): string; - translate(x: number, y: number, z?: number): MSCSSMatrix; +interface MSCredentials { + getAssertion(challenge: string, filter?: MSCredentialFilter, params?: MSSignatureParameters): PromiseLike; + makeCredential(accountInfo: MSAccountInfo, params: MSCredentialParameters[], challenge?: string): PromiseLike; } -declare var MSCSSMatrix: { - prototype: MSCSSMatrix; - new(text?: string): MSCSSMatrix; +declare var MSCredentials: { + prototype: MSCredentials; + new(): MSCredentials; +} + +interface MSFIDOCredentialAssertion extends MSAssertion { + readonly algorithm: string | Algorithm; + readonly attestation: any; + readonly publicKey: string; + readonly transportHints: string[]; +} + +declare var MSFIDOCredentialAssertion: { + prototype: MSFIDOCredentialAssertion; + new(): MSFIDOCredentialAssertion; +} + +interface MSFIDOSignature { + readonly authnrData: string; + readonly clientData: string; + readonly signature: string; +} + +declare var MSFIDOSignature: { + prototype: MSFIDOSignature; + new(): MSFIDOSignature; +} + +interface MSFIDOSignatureAssertion extends MSAssertion { + readonly signature: MSFIDOSignature; +} + +declare var MSFIDOSignatureAssertion: { + prototype: MSFIDOSignatureAssertion; + new(): MSFIDOSignatureAssertion; } interface MSGesture { @@ -7472,44 +7952,44 @@ declare var MSGesture: { } interface MSGestureEvent extends UIEvent { - clientX: number; - clientY: number; - expansion: number; - gestureObject: any; - hwTimestamp: number; - offsetX: number; - offsetY: number; - rotation: number; - scale: number; - screenX: number; - screenY: number; - translationX: number; - translationY: number; - velocityAngular: number; - velocityExpansion: number; - velocityX: number; - velocityY: number; + readonly clientX: number; + readonly clientY: number; + readonly expansion: number; + readonly gestureObject: any; + readonly hwTimestamp: number; + readonly offsetX: number; + readonly offsetY: number; + readonly rotation: number; + readonly scale: number; + readonly screenX: number; + readonly screenY: number; + readonly translationX: number; + readonly translationY: number; + readonly velocityAngular: number; + readonly velocityExpansion: number; + readonly velocityX: number; + readonly velocityY: number; initGestureEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, offsetXArg: number, offsetYArg: number, translationXArg: number, translationYArg: number, scaleArg: number, expansionArg: number, rotationArg: number, velocityXArg: number, velocityYArg: number, velocityExpansionArg: number, velocityAngularArg: number, hwTimestampArg: number): void; - MSGESTURE_FLAG_BEGIN: number; - MSGESTURE_FLAG_CANCEL: number; - MSGESTURE_FLAG_END: number; - MSGESTURE_FLAG_INERTIA: number; - MSGESTURE_FLAG_NONE: number; + readonly MSGESTURE_FLAG_BEGIN: number; + readonly MSGESTURE_FLAG_CANCEL: number; + readonly MSGESTURE_FLAG_END: number; + readonly MSGESTURE_FLAG_INERTIA: number; + readonly MSGESTURE_FLAG_NONE: number; } declare var MSGestureEvent: { prototype: MSGestureEvent; new(): MSGestureEvent; - MSGESTURE_FLAG_BEGIN: number; - MSGESTURE_FLAG_CANCEL: number; - MSGESTURE_FLAG_END: number; - MSGESTURE_FLAG_INERTIA: number; - MSGESTURE_FLAG_NONE: number; + readonly MSGESTURE_FLAG_BEGIN: number; + readonly MSGESTURE_FLAG_CANCEL: number; + readonly MSGESTURE_FLAG_END: number; + readonly MSGESTURE_FLAG_INERTIA: number; + readonly MSGESTURE_FLAG_NONE: number; } interface MSGraphicsTrust { - constrictionActive: boolean; - status: string; + readonly constrictionActive: boolean; + readonly status: string; } declare var MSGraphicsTrust: { @@ -7518,12 +7998,12 @@ declare var MSGraphicsTrust: { } interface MSHTMLWebViewElement extends HTMLElement { - canGoBack: boolean; - canGoForward: boolean; - containsFullScreenElement: boolean; - documentTitle: string; + readonly canGoBack: boolean; + readonly canGoForward: boolean; + readonly containsFullScreenElement: boolean; + readonly documentTitle: string; height: number; - settings: MSWebViewSettings; + readonly settings: MSWebViewSettings; src: string; width: number; addWebAllowedObject(name: string, applicationObject: any): void; @@ -7549,12 +8029,12 @@ declare var MSHTMLWebViewElement: { } interface MSInputMethodContext extends EventTarget { - compositionEndOffset: number; - compositionStartOffset: number; + readonly compositionEndOffset: number; + readonly compositionStartOffset: number; oncandidatewindowhide: (ev: Event) => any; oncandidatewindowshow: (ev: Event) => any; oncandidatewindowupdate: (ev: Event) => any; - target: HTMLElement; + readonly target: HTMLElement; getCandidateWindowClientRect(): ClientRect; getCompositionAlternatives(): string[]; hasComposition(): boolean; @@ -7571,59 +8051,59 @@ declare var MSInputMethodContext: { } interface MSManipulationEvent extends UIEvent { - currentState: number; - inertiaDestinationX: number; - inertiaDestinationY: number; - lastState: number; + readonly currentState: number; + readonly inertiaDestinationX: number; + readonly inertiaDestinationY: number; + readonly lastState: number; initMSManipulationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, lastState: number, currentState: number): void; - MS_MANIPULATION_STATE_ACTIVE: number; - MS_MANIPULATION_STATE_CANCELLED: number; - MS_MANIPULATION_STATE_COMMITTED: number; - MS_MANIPULATION_STATE_DRAGGING: number; - MS_MANIPULATION_STATE_INERTIA: number; - MS_MANIPULATION_STATE_PRESELECT: number; - MS_MANIPULATION_STATE_SELECTING: number; - MS_MANIPULATION_STATE_STOPPED: number; + readonly MS_MANIPULATION_STATE_ACTIVE: number; + readonly MS_MANIPULATION_STATE_CANCELLED: number; + readonly MS_MANIPULATION_STATE_COMMITTED: number; + readonly MS_MANIPULATION_STATE_DRAGGING: number; + readonly MS_MANIPULATION_STATE_INERTIA: number; + readonly MS_MANIPULATION_STATE_PRESELECT: number; + readonly MS_MANIPULATION_STATE_SELECTING: number; + readonly MS_MANIPULATION_STATE_STOPPED: number; } declare var MSManipulationEvent: { prototype: MSManipulationEvent; new(): MSManipulationEvent; - MS_MANIPULATION_STATE_ACTIVE: number; - MS_MANIPULATION_STATE_CANCELLED: number; - MS_MANIPULATION_STATE_COMMITTED: number; - MS_MANIPULATION_STATE_DRAGGING: number; - MS_MANIPULATION_STATE_INERTIA: number; - MS_MANIPULATION_STATE_PRESELECT: number; - MS_MANIPULATION_STATE_SELECTING: number; - MS_MANIPULATION_STATE_STOPPED: number; + readonly MS_MANIPULATION_STATE_ACTIVE: number; + readonly MS_MANIPULATION_STATE_CANCELLED: number; + readonly MS_MANIPULATION_STATE_COMMITTED: number; + readonly MS_MANIPULATION_STATE_DRAGGING: number; + readonly MS_MANIPULATION_STATE_INERTIA: number; + readonly MS_MANIPULATION_STATE_PRESELECT: number; + readonly MS_MANIPULATION_STATE_SELECTING: number; + readonly MS_MANIPULATION_STATE_STOPPED: number; } interface MSMediaKeyError { - code: number; - systemCode: number; - MS_MEDIA_KEYERR_CLIENT: number; - MS_MEDIA_KEYERR_DOMAIN: number; - MS_MEDIA_KEYERR_HARDWARECHANGE: number; - MS_MEDIA_KEYERR_OUTPUT: number; - MS_MEDIA_KEYERR_SERVICE: number; - MS_MEDIA_KEYERR_UNKNOWN: number; + readonly code: number; + readonly systemCode: number; + readonly MS_MEDIA_KEYERR_CLIENT: number; + readonly MS_MEDIA_KEYERR_DOMAIN: number; + readonly MS_MEDIA_KEYERR_HARDWARECHANGE: number; + readonly MS_MEDIA_KEYERR_OUTPUT: number; + readonly MS_MEDIA_KEYERR_SERVICE: number; + readonly MS_MEDIA_KEYERR_UNKNOWN: number; } declare var MSMediaKeyError: { prototype: MSMediaKeyError; new(): MSMediaKeyError; - MS_MEDIA_KEYERR_CLIENT: number; - MS_MEDIA_KEYERR_DOMAIN: number; - MS_MEDIA_KEYERR_HARDWARECHANGE: number; - MS_MEDIA_KEYERR_OUTPUT: number; - MS_MEDIA_KEYERR_SERVICE: number; - MS_MEDIA_KEYERR_UNKNOWN: number; + readonly MS_MEDIA_KEYERR_CLIENT: number; + readonly MS_MEDIA_KEYERR_DOMAIN: number; + readonly MS_MEDIA_KEYERR_HARDWARECHANGE: number; + readonly MS_MEDIA_KEYERR_OUTPUT: number; + readonly MS_MEDIA_KEYERR_SERVICE: number; + readonly MS_MEDIA_KEYERR_UNKNOWN: number; } interface MSMediaKeyMessageEvent extends Event { - destinationURL: string; - message: Uint8Array; + readonly destinationURL: string | null; + readonly message: Uint8Array; } declare var MSMediaKeyMessageEvent: { @@ -7632,7 +8112,7 @@ declare var MSMediaKeyMessageEvent: { } interface MSMediaKeyNeededEvent extends Event { - initData: Uint8Array; + readonly initData: Uint8Array | null; } declare var MSMediaKeyNeededEvent: { @@ -7641,9 +8121,9 @@ declare var MSMediaKeyNeededEvent: { } interface MSMediaKeySession extends EventTarget { - error: MSMediaKeyError; - keySystem: string; - sessionId: string; + readonly error: MSMediaKeyError | null; + readonly keySystem: string; + readonly sessionId: string; close(): void; update(key: Uint8Array): void; } @@ -7654,7 +8134,7 @@ declare var MSMediaKeySession: { } interface MSMediaKeys { - keySystem: string; + readonly keySystem: string; createSession(type: string, initData: Uint8Array, cdmData?: Uint8Array): MSMediaKeySession; } @@ -7662,40 +8142,22 @@ declare var MSMediaKeys: { prototype: MSMediaKeys; new(keySystem: string): MSMediaKeys; isTypeSupported(keySystem: string, type?: string): boolean; -} - -interface MSMimeTypesCollection { - length: number; -} - -declare var MSMimeTypesCollection: { - prototype: MSMimeTypesCollection; - new(): MSMimeTypesCollection; -} - -interface MSPluginsCollection { - length: number; - refresh(reload?: boolean): void; -} - -declare var MSPluginsCollection: { - prototype: MSPluginsCollection; - new(): MSPluginsCollection; + isTypeSupportedWithFeatures(keySystem: string, type?: string): string; } interface MSPointerEvent extends MouseEvent { - currentPoint: any; - height: number; - hwTimestamp: number; - intermediatePoints: any; - isPrimary: boolean; - pointerId: number; - pointerType: any; - pressure: number; - rotation: number; - tiltX: number; - tiltY: number; - width: number; + readonly currentPoint: any; + readonly height: number; + readonly hwTimestamp: number; + readonly intermediatePoints: any; + readonly isPrimary: boolean; + readonly pointerId: number; + readonly pointerType: any; + readonly pressure: number; + readonly rotation: number; + readonly tiltX: number; + readonly tiltY: number; + readonly width: number; getCurrentPoint(element: Element): void; getIntermediatePoints(element: Element): void; initPointerEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, offsetXArg: number, offsetYArg: number, widthArg: number, heightArg: number, pressure: number, rotation: number, tiltX: number, tiltY: number, pointerIdArg: number, pointerType: any, hwTimestampArg: number, isPrimary: boolean): void; @@ -7707,7 +8169,7 @@ declare var MSPointerEvent: { } interface MSRangeCollection { - length: number; + readonly length: number; item(index: number): Range; [index: number]: Range; } @@ -7718,8 +8180,8 @@ declare var MSRangeCollection: { } interface MSSiteModeEvent extends Event { - actionURL: string; - buttonID: number; + readonly actionURL: string; + readonly buttonID: number; } declare var MSSiteModeEvent: { @@ -7728,7 +8190,7 @@ declare var MSSiteModeEvent: { } interface MSStream { - type: string; + readonly type: string; msClose(): void; msDetachStream(): any; } @@ -7739,7 +8201,7 @@ declare var MSStream: { } interface MSStreamReader extends EventTarget, MSBaseReader { - error: DOMError; + readonly error: DOMError; readAsArrayBuffer(stream: MSStream, size?: number): void; readAsBinaryString(stream: MSStream, size?: number): void; readAsBlob(stream: MSStream, size?: number): void; @@ -7754,20 +8216,20 @@ declare var MSStreamReader: { } interface MSWebViewAsyncOperation extends EventTarget { - error: DOMError; + readonly error: DOMError; oncomplete: (ev: Event) => any; onerror: (ev: Event) => any; - readyState: number; - result: any; - target: MSHTMLWebViewElement; - type: number; + readonly readyState: number; + readonly result: any; + readonly target: MSHTMLWebViewElement; + readonly type: number; start(): void; - COMPLETED: number; - ERROR: number; - STARTED: number; - TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number; - TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number; - TYPE_INVOKE_SCRIPT: number; + readonly COMPLETED: number; + readonly ERROR: number; + readonly STARTED: number; + readonly TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number; + readonly TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number; + readonly TYPE_INVOKE_SCRIPT: number; addEventListener(type: "complete", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; @@ -7776,12 +8238,12 @@ interface MSWebViewAsyncOperation extends EventTarget { declare var MSWebViewAsyncOperation: { prototype: MSWebViewAsyncOperation; new(): MSWebViewAsyncOperation; - COMPLETED: number; - ERROR: number; - STARTED: number; - TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number; - TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number; - TYPE_INVOKE_SCRIPT: number; + readonly COMPLETED: number; + readonly ERROR: number; + readonly STARTED: number; + readonly TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number; + readonly TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number; + readonly TYPE_INVOKE_SCRIPT: number; } interface MSWebViewSettings { @@ -7794,6 +8256,32 @@ declare var MSWebViewSettings: { new(): MSWebViewSettings; } +interface MediaDeviceInfo { + readonly deviceId: string; + readonly groupId: string; + readonly kind: string; + readonly label: string; +} + +declare var MediaDeviceInfo: { + prototype: MediaDeviceInfo; + new(): MediaDeviceInfo; +} + +interface MediaDevices extends EventTarget { + ondevicechange: (ev: Event) => any; + enumerateDevices(): any; + getSupportedConstraints(): MediaTrackSupportedConstraints; + getUserMedia(constraints: MediaStreamConstraints): PromiseLike; + addEventListener(type: "devicechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MediaDevices: { + prototype: MediaDevices; + new(): MediaDevices; +} + interface MediaElementAudioSourceNode extends AudioNode { } @@ -7802,28 +8290,98 @@ declare var MediaElementAudioSourceNode: { new(): MediaElementAudioSourceNode; } +interface MediaEncryptedEvent extends Event { + readonly initData: ArrayBuffer | null; + readonly initDataType: string; +} + +declare var MediaEncryptedEvent: { + prototype: MediaEncryptedEvent; + new(type: string, eventInitDict?: MediaEncryptedEventInit): MediaEncryptedEvent; +} + interface MediaError { - code: number; - msExtendedCode: number; - MEDIA_ERR_ABORTED: number; - MEDIA_ERR_DECODE: number; - MEDIA_ERR_NETWORK: number; - MEDIA_ERR_SRC_NOT_SUPPORTED: number; - MS_MEDIA_ERR_ENCRYPTED: number; + readonly code: number; + readonly msExtendedCode: number; + readonly MEDIA_ERR_ABORTED: number; + readonly MEDIA_ERR_DECODE: number; + readonly MEDIA_ERR_NETWORK: number; + readonly MEDIA_ERR_SRC_NOT_SUPPORTED: number; + readonly MS_MEDIA_ERR_ENCRYPTED: number; } declare var MediaError: { prototype: MediaError; new(): MediaError; - MEDIA_ERR_ABORTED: number; - MEDIA_ERR_DECODE: number; - MEDIA_ERR_NETWORK: number; - MEDIA_ERR_SRC_NOT_SUPPORTED: number; - MS_MEDIA_ERR_ENCRYPTED: number; + readonly MEDIA_ERR_ABORTED: number; + readonly MEDIA_ERR_DECODE: number; + readonly MEDIA_ERR_NETWORK: number; + readonly MEDIA_ERR_SRC_NOT_SUPPORTED: number; + readonly MS_MEDIA_ERR_ENCRYPTED: number; +} + +interface MediaKeyMessageEvent extends Event { + readonly message: ArrayBuffer; + readonly messageType: string; +} + +declare var MediaKeyMessageEvent: { + prototype: MediaKeyMessageEvent; + new(type: string, eventInitDict?: MediaKeyMessageEventInit): MediaKeyMessageEvent; +} + +interface MediaKeySession extends EventTarget { + readonly closed: PromiseLike; + readonly expiration: number; + readonly keyStatuses: MediaKeyStatusMap; + readonly sessionId: string; + close(): PromiseLike; + generateRequest(initDataType: string, initData: any): PromiseLike; + load(sessionId: string): PromiseLike; + remove(): PromiseLike; + update(response: any): PromiseLike; +} + +declare var MediaKeySession: { + prototype: MediaKeySession; + new(): MediaKeySession; +} + +interface MediaKeyStatusMap { + readonly size: number; + forEach(callback: ForEachCallback): void; + get(keyId: any): string; + has(keyId: any): boolean; +} + +declare var MediaKeyStatusMap: { + prototype: MediaKeyStatusMap; + new(): MediaKeyStatusMap; +} + +interface MediaKeySystemAccess { + readonly keySystem: string; + createMediaKeys(): PromiseLike; + getConfiguration(): MediaKeySystemConfiguration; +} + +declare var MediaKeySystemAccess: { + prototype: MediaKeySystemAccess; + new(): MediaKeySystemAccess; +} + +interface MediaKeys { + createSession(sessionType?: string): MediaKeySession; + setServerCertificate(serverCertificate: any): PromiseLike; +} + +declare var MediaKeys: { + prototype: MediaKeys; + new(): MediaKeys; } interface MediaList { - length: number; + readonly length: number; mediaText: string; appendMedium(newMedium: string): void; deleteMedium(oldMedium: string): void; @@ -7838,8 +8396,8 @@ declare var MediaList: { } interface MediaQueryList { - matches: boolean; - media: string; + readonly matches: boolean; + readonly media: string; addListener(listener: MediaQueryListListener): void; removeListener(listener: MediaQueryListListener): void; } @@ -7850,10 +8408,10 @@ declare var MediaQueryList: { } interface MediaSource extends EventTarget { - activeSourceBuffers: SourceBufferList; + readonly activeSourceBuffers: SourceBufferList; duration: number; - readyState: number; - sourceBuffers: SourceBufferList; + readonly readyState: string; + readonly sourceBuffers: SourceBufferList; addSourceBuffer(type: string): SourceBuffer; endOfStream(error?: number): void; removeSourceBuffer(sourceBuffer: SourceBuffer): void; @@ -7865,9 +8423,104 @@ declare var MediaSource: { isTypeSupported(type: string): boolean; } +interface MediaStream extends EventTarget { + readonly active: boolean; + readonly id: string; + onactive: (ev: Event) => any; + onaddtrack: (ev: TrackEvent) => any; + oninactive: (ev: Event) => any; + onremovetrack: (ev: TrackEvent) => any; + addTrack(track: MediaStreamTrack): void; + clone(): MediaStream; + getAudioTracks(): MediaStreamTrack[]; + getTrackById(trackId: string): MediaStreamTrack | null; + getTracks(): MediaStreamTrack[]; + getVideoTracks(): MediaStreamTrack[]; + removeTrack(track: MediaStreamTrack): void; + stop(): void; + addEventListener(type: "active", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "addtrack", listener: (ev: TrackEvent) => any, useCapture?: boolean): void; + addEventListener(type: "inactive", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "removetrack", listener: (ev: TrackEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MediaStream: { + prototype: MediaStream; + new(streamOrTracks?: MediaStream | MediaStreamTrack[]): MediaStream; +} + +interface MediaStreamAudioSourceNode extends AudioNode { +} + +declare var MediaStreamAudioSourceNode: { + prototype: MediaStreamAudioSourceNode; + new(): MediaStreamAudioSourceNode; +} + +interface MediaStreamError { + readonly constraintName: string | null; + readonly message: string | null; + readonly name: string; +} + +declare var MediaStreamError: { + prototype: MediaStreamError; + new(): MediaStreamError; +} + +interface MediaStreamErrorEvent extends Event { + readonly error: MediaStreamError | null; +} + +declare var MediaStreamErrorEvent: { + prototype: MediaStreamErrorEvent; + new(type: string, eventInitDict?: MediaStreamErrorEventInit): MediaStreamErrorEvent; +} + +interface MediaStreamTrack extends EventTarget { + enabled: boolean; + readonly id: string; + readonly kind: string; + readonly label: string; + readonly muted: boolean; + onended: (ev: MediaStreamErrorEvent) => any; + onmute: (ev: Event) => any; + onoverconstrained: (ev: MediaStreamErrorEvent) => any; + onunmute: (ev: Event) => any; + readonly readonly: boolean; + readonly readyState: string; + readonly remote: boolean; + applyConstraints(constraints: MediaTrackConstraints): PromiseLike; + clone(): MediaStreamTrack; + getCapabilities(): MediaTrackCapabilities; + getConstraints(): MediaTrackConstraints; + getSettings(): MediaTrackSettings; + stop(): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mute", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "overconstrained", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "unmute", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MediaStreamTrack: { + prototype: MediaStreamTrack; + new(): MediaStreamTrack; +} + +interface MediaStreamTrackEvent extends Event { + readonly track: MediaStreamTrack; +} + +declare var MediaStreamTrackEvent: { + prototype: MediaStreamTrackEvent; + new(type: string, eventInitDict?: MediaStreamTrackEventInit): MediaStreamTrackEvent; +} + interface MessageChannel { - port1: MessagePort; - port2: MessagePort; + readonly port1: MessagePort; + readonly port2: MessagePort; } declare var MessageChannel: { @@ -7876,10 +8529,10 @@ declare var MessageChannel: { } interface MessageEvent extends Event { - data: any; - origin: string; - ports: any; - source: Window; + readonly data: any; + readonly origin: string; + readonly ports: any; + readonly source: Window; initMessageEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, dataArg: any, originArg: string, lastEventIdArg: string, sourceArg: Window): void; } @@ -7903,10 +8556,10 @@ declare var MessagePort: { } interface MimeType { - description: string; - enabledPlugin: Plugin; - suffixes: string; - type: string; + readonly description: string; + readonly enabledPlugin: Plugin; + readonly suffixes: string; + readonly type: string; } declare var MimeType: { @@ -7915,7 +8568,7 @@ declare var MimeType: { } interface MimeTypeArray { - length: number; + readonly length: number; item(index: number): Plugin; namedItem(type: string): Plugin; [index: number]: Plugin; @@ -7927,30 +8580,30 @@ declare var MimeTypeArray: { } interface MouseEvent extends UIEvent { - altKey: boolean; - button: number; - buttons: number; - clientX: number; - clientY: number; - ctrlKey: boolean; - fromElement: Element; - layerX: number; - layerY: number; - metaKey: boolean; - movementX: number; - movementY: number; - offsetX: number; - offsetY: number; - pageX: number; - pageY: number; - relatedTarget: EventTarget; - screenX: number; - screenY: number; - shiftKey: boolean; - toElement: Element; - which: number; - x: number; - y: number; + readonly altKey: boolean; + readonly button: number; + readonly buttons: number; + readonly clientX: number; + readonly clientY: number; + readonly ctrlKey: boolean; + readonly fromElement: Element; + readonly layerX: number; + readonly layerY: number; + readonly metaKey: boolean; + readonly movementX: number; + readonly movementY: number; + readonly offsetX: number; + readonly offsetY: number; + readonly pageX: number; + readonly pageY: number; + readonly relatedTarget: EventTarget; + readonly screenX: number; + readonly screenY: number; + readonly shiftKey: boolean; + readonly toElement: Element; + readonly which: number; + readonly x: number; + readonly y: number; getModifierState(keyArg: string): boolean; initMouseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget): void; } @@ -7960,36 +8613,24 @@ declare var MouseEvent: { new(typeArg: string, eventInitDict?: MouseEventInit): MouseEvent; } -interface MouseWheelEvent extends MouseEvent { - wheelDelta: number; - wheelDeltaX: number; - wheelDeltaY: number; - initMouseWheelEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, buttonArg: number, relatedTargetArg: EventTarget, modifiersListArg: string, wheelDeltaArg: number): void; -} - -declare var MouseWheelEvent: { - prototype: MouseWheelEvent; - new(): MouseWheelEvent; -} - interface MutationEvent extends Event { - attrChange: number; - attrName: string; - newValue: string; - prevValue: string; - relatedNode: Node; + readonly attrChange: number; + readonly attrName: string; + readonly newValue: string; + readonly prevValue: string; + readonly relatedNode: Node; initMutationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, relatedNodeArg: Node, prevValueArg: string, newValueArg: string, attrNameArg: string, attrChangeArg: number): void; - ADDITION: number; - MODIFICATION: number; - REMOVAL: number; + readonly ADDITION: number; + readonly MODIFICATION: number; + readonly REMOVAL: number; } declare var MutationEvent: { prototype: MutationEvent; new(): MutationEvent; - ADDITION: number; - MODIFICATION: number; - REMOVAL: number; + readonly ADDITION: number; + readonly MODIFICATION: number; + readonly REMOVAL: number; } interface MutationObserver { @@ -8004,15 +8645,15 @@ declare var MutationObserver: { } interface MutationRecord { - addedNodes: NodeList; - attributeName: string; - attributeNamespace: string; - nextSibling: Node; - oldValue: string; - previousSibling: Node; - removedNodes: NodeList; - target: Node; - type: string; + readonly addedNodes: NodeList; + readonly attributeName: string | null; + readonly attributeNamespace: string | null; + readonly nextSibling: Node | null; + readonly oldValue: string | null; + readonly previousSibling: Node | null; + readonly removedNodes: NodeList; + readonly target: Node; + readonly type: string; } declare var MutationRecord: { @@ -8021,12 +8662,12 @@ declare var MutationRecord: { } interface NamedNodeMap { - length: number; + readonly length: number; getNamedItem(name: string): Attr; - getNamedItemNS(namespaceURI: string, localName: string): Attr; + getNamedItemNS(namespaceURI: string | null, localName: string | null): Attr; item(index: number): Attr; removeNamedItem(name: string): Attr; - removeNamedItemNS(namespaceURI: string, localName: string): Attr; + removeNamedItemNS(namespaceURI: string | null, localName: string | null): Attr; setNamedItem(arg: Attr): Attr; setNamedItemNS(arg: Attr): Attr; [index: number]: Attr; @@ -8038,8 +8679,8 @@ declare var NamedNodeMap: { } interface NavigationCompletedEvent extends NavigationEvent { - isSuccess: boolean; - webErrorStatus: number; + readonly isSuccess: boolean; + readonly webErrorStatus: number; } declare var NavigationCompletedEvent: { @@ -8048,7 +8689,7 @@ declare var NavigationCompletedEvent: { } interface NavigationEvent extends Event { - uri: string; + readonly uri: string; } declare var NavigationEvent: { @@ -8057,7 +8698,7 @@ declare var NavigationEvent: { } interface NavigationEventWithReferrer extends NavigationEvent { - referer: string; + readonly referer: string; } declare var NavigationEventWithReferrer: { @@ -8065,27 +8706,23 @@ declare var NavigationEventWithReferrer: { new(): NavigationEventWithReferrer; } -interface Navigator extends Object, NavigatorID, NavigatorOnLine, NavigatorContentUtils, NavigatorStorageUtils, NavigatorGeolocation, MSNavigatorDoNotTrack, MSFileSaver { - appCodeName: string; - appMinorVersion: string; - browserLanguage: string; - connectionSpeed: number; - cookieEnabled: boolean; - cpuClass: string; - language: string; - maxTouchPoints: number; - mimeTypes: MSMimeTypesCollection; - msManipulationViewsEnabled: boolean; - msMaxTouchPoints: number; - msPointerEnabled: boolean; - plugins: MSPluginsCollection; - pointerEnabled: boolean; - systemLanguage: string; - userLanguage: string; - webdriver: boolean; +interface Navigator extends Object, NavigatorID, NavigatorOnLine, NavigatorContentUtils, NavigatorStorageUtils, NavigatorGeolocation, MSNavigatorDoNotTrack, MSFileSaver, NavigatorUserMedia { + readonly appCodeName: string; + readonly cookieEnabled: boolean; + readonly language: string; + readonly maxTouchPoints: number; + readonly mimeTypes: MimeTypeArray; + readonly msManipulationViewsEnabled: boolean; + readonly msMaxTouchPoints: number; + readonly msPointerEnabled: boolean; + readonly plugins: PluginArray; + readonly pointerEnabled: boolean; + readonly webdriver: boolean; getGamepads(): Gamepad[]; javaEnabled(): boolean; msLaunchUri(uri: string, successCallback?: MSLaunchUriCallback, noHandlerCallback?: MSLaunchUriCallback): void; + requestMediaKeySystemAccess(keySystem: string, supportedConfigurations: MediaKeySystemConfiguration[]): PromiseLike; + vibrate(pattern: number | number[]): boolean; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -8095,78 +8732,79 @@ declare var Navigator: { } interface Node extends EventTarget { - attributes: NamedNodeMap; - baseURI: string; - childNodes: NodeList; - firstChild: Node; - lastChild: Node; - localName: string; - namespaceURI: string; - nextSibling: Node; - nodeName: string; - nodeType: number; - nodeValue: string; - ownerDocument: Document; - parentElement: HTMLElement; - parentNode: Node; - prefix: string; - previousSibling: Node; - textContent: string; + readonly attributes: NamedNodeMap; + readonly baseURI: string | null; + readonly childNodes: NodeList; + readonly firstChild: Node; + readonly lastChild: Node; + readonly localName: string | null; + readonly namespaceURI: string | null; + readonly nextSibling: Node; + readonly nodeName: string; + readonly nodeType: number; + nodeValue: string | null; + readonly ownerDocument: Document; + readonly parentElement: HTMLElement; + readonly parentNode: Node; + readonly previousSibling: Node; + textContent: string | null; appendChild(newChild: Node): Node; cloneNode(deep?: boolean): Node; compareDocumentPosition(other: Node): number; + contains(child: Node): boolean; hasAttributes(): boolean; hasChildNodes(): boolean; - insertBefore(newChild: Node, refChild?: Node): Node; - isDefaultNamespace(namespaceURI: string): boolean; + insertBefore(newChild: Node, refChild: Node): Node; + isDefaultNamespace(namespaceURI: string | null): boolean; isEqualNode(arg: Node): boolean; isSameNode(other: Node): boolean; - lookupNamespaceURI(prefix: string): string; - lookupPrefix(namespaceURI: string): string; + lookupNamespaceURI(prefix: string | null): string | null; + lookupPrefix(namespaceURI: string | null): string | null; normalize(): void; removeChild(oldChild: Node): Node; replaceChild(newChild: Node, oldChild: Node): Node; - ATTRIBUTE_NODE: number; - CDATA_SECTION_NODE: number; - COMMENT_NODE: number; - DOCUMENT_FRAGMENT_NODE: number; - DOCUMENT_NODE: number; - DOCUMENT_POSITION_CONTAINED_BY: number; - DOCUMENT_POSITION_CONTAINS: number; - DOCUMENT_POSITION_DISCONNECTED: number; - DOCUMENT_POSITION_FOLLOWING: number; - DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number; - DOCUMENT_POSITION_PRECEDING: number; - DOCUMENT_TYPE_NODE: number; - ELEMENT_NODE: number; - ENTITY_NODE: number; - ENTITY_REFERENCE_NODE: number; - NOTATION_NODE: number; - PROCESSING_INSTRUCTION_NODE: number; - TEXT_NODE: number; + contains(node: Node): boolean; + readonly ATTRIBUTE_NODE: number; + readonly CDATA_SECTION_NODE: number; + readonly COMMENT_NODE: number; + readonly DOCUMENT_FRAGMENT_NODE: number; + readonly DOCUMENT_NODE: number; + readonly DOCUMENT_POSITION_CONTAINED_BY: number; + readonly DOCUMENT_POSITION_CONTAINS: number; + readonly DOCUMENT_POSITION_DISCONNECTED: number; + readonly DOCUMENT_POSITION_FOLLOWING: number; + readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number; + readonly DOCUMENT_POSITION_PRECEDING: number; + readonly DOCUMENT_TYPE_NODE: number; + readonly ELEMENT_NODE: number; + readonly ENTITY_NODE: number; + readonly ENTITY_REFERENCE_NODE: number; + readonly NOTATION_NODE: number; + readonly PROCESSING_INSTRUCTION_NODE: number; + readonly TEXT_NODE: number; } declare var Node: { prototype: Node; new(): Node; - ATTRIBUTE_NODE: number; - CDATA_SECTION_NODE: number; - COMMENT_NODE: number; - DOCUMENT_FRAGMENT_NODE: number; - DOCUMENT_NODE: number; - DOCUMENT_POSITION_CONTAINED_BY: number; - DOCUMENT_POSITION_CONTAINS: number; - DOCUMENT_POSITION_DISCONNECTED: number; - DOCUMENT_POSITION_FOLLOWING: number; - DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number; - DOCUMENT_POSITION_PRECEDING: number; - DOCUMENT_TYPE_NODE: number; - ELEMENT_NODE: number; - ENTITY_NODE: number; - ENTITY_REFERENCE_NODE: number; - NOTATION_NODE: number; - PROCESSING_INSTRUCTION_NODE: number; - TEXT_NODE: number; + readonly ATTRIBUTE_NODE: number; + readonly CDATA_SECTION_NODE: number; + readonly COMMENT_NODE: number; + readonly DOCUMENT_FRAGMENT_NODE: number; + readonly DOCUMENT_NODE: number; + readonly DOCUMENT_POSITION_CONTAINED_BY: number; + readonly DOCUMENT_POSITION_CONTAINS: number; + readonly DOCUMENT_POSITION_DISCONNECTED: number; + readonly DOCUMENT_POSITION_FOLLOWING: number; + readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number; + readonly DOCUMENT_POSITION_PRECEDING: number; + readonly DOCUMENT_TYPE_NODE: number; + readonly ELEMENT_NODE: number; + readonly ENTITY_NODE: number; + readonly ENTITY_REFERENCE_NODE: number; + readonly NOTATION_NODE: number; + readonly PROCESSING_INSTRUCTION_NODE: number; + readonly TEXT_NODE: number; } interface NodeFilter { @@ -8174,29 +8812,29 @@ interface NodeFilter { } declare var NodeFilter: { - FILTER_ACCEPT: number; - FILTER_REJECT: number; - FILTER_SKIP: number; - SHOW_ALL: number; - SHOW_ATTRIBUTE: number; - SHOW_CDATA_SECTION: number; - SHOW_COMMENT: number; - SHOW_DOCUMENT: number; - SHOW_DOCUMENT_FRAGMENT: number; - SHOW_DOCUMENT_TYPE: number; - SHOW_ELEMENT: number; - SHOW_ENTITY: number; - SHOW_ENTITY_REFERENCE: number; - SHOW_NOTATION: number; - SHOW_PROCESSING_INSTRUCTION: number; - SHOW_TEXT: number; + readonly FILTER_ACCEPT: number; + readonly FILTER_REJECT: number; + readonly FILTER_SKIP: number; + readonly SHOW_ALL: number; + readonly SHOW_ATTRIBUTE: number; + readonly SHOW_CDATA_SECTION: number; + readonly SHOW_COMMENT: number; + readonly SHOW_DOCUMENT: number; + readonly SHOW_DOCUMENT_FRAGMENT: number; + readonly SHOW_DOCUMENT_TYPE: number; + readonly SHOW_ELEMENT: number; + readonly SHOW_ENTITY: number; + readonly SHOW_ENTITY_REFERENCE: number; + readonly SHOW_NOTATION: number; + readonly SHOW_PROCESSING_INSTRUCTION: number; + readonly SHOW_TEXT: number; } interface NodeIterator { - expandEntityReferences: boolean; - filter: NodeFilter; - root: Node; - whatToShow: number; + readonly expandEntityReferences: boolean; + readonly filter: NodeFilter; + readonly root: Node; + readonly whatToShow: number; detach(): void; nextNode(): Node; previousNode(): Node; @@ -8208,7 +8846,7 @@ declare var NodeIterator: { } interface NodeList { - length: number; + readonly length: number; item(index: number): Node; [index: number]: Node; } @@ -8227,13 +8865,13 @@ declare var OES_element_index_uint: { } interface OES_standard_derivatives { - FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number; + readonly FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number; } declare var OES_standard_derivatives: { prototype: OES_standard_derivatives; new(): OES_standard_derivatives; - FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number; + readonly FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number; } interface OES_texture_float { @@ -8253,7 +8891,7 @@ declare var OES_texture_float_linear: { } interface OfflineAudioCompletionEvent extends Event { - renderedBuffer: AudioBuffer; + readonly renderedBuffer: AudioBuffer; } declare var OfflineAudioCompletionEvent: { @@ -8263,7 +8901,7 @@ declare var OfflineAudioCompletionEvent: { interface OfflineAudioContext extends AudioContext { oncomplete: (ev: Event) => any; - startRendering(): void; + startRendering(): PromiseLike; addEventListener(type: "complete", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -8274,14 +8912,14 @@ declare var OfflineAudioContext: { } interface OscillatorNode extends AudioNode { - detune: AudioParam; - frequency: AudioParam; - onended: (ev: Event) => any; + readonly detune: AudioParam; + readonly frequency: AudioParam; + onended: (ev: MediaStreamErrorEvent) => any; type: string; setPeriodicWave(periodicWave: PeriodicWave): void; start(when?: number): void; stop(when?: number): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -8290,8 +8928,25 @@ declare var OscillatorNode: { new(): OscillatorNode; } +interface OverflowEvent extends UIEvent { + readonly horizontalOverflow: boolean; + readonly orient: number; + readonly verticalOverflow: boolean; + readonly BOTH: number; + readonly HORIZONTAL: number; + readonly VERTICAL: number; +} + +declare var OverflowEvent: { + prototype: OverflowEvent; + new(): OverflowEvent; + readonly BOTH: number; + readonly HORIZONTAL: number; + readonly VERTICAL: number; +} + interface PageTransitionEvent extends Event { - persisted: boolean; + readonly persisted: boolean; } declare var PageTransitionEvent: { @@ -8319,24 +8974,24 @@ declare var PannerNode: { } interface PerfWidgetExternal { - activeNetworkRequestCount: number; - averageFrameTime: number; - averagePaintTime: number; - extraInformationEnabled: boolean; - independentRenderingEnabled: boolean; - irDisablingContentString: string; - irStatusAvailable: boolean; - maxCpuSpeed: number; - paintRequestsPerSecond: number; - performanceCounter: number; - performanceCounterFrequency: number; + readonly activeNetworkRequestCount: number; + readonly averageFrameTime: number; + readonly averagePaintTime: number; + readonly extraInformationEnabled: boolean; + readonly independentRenderingEnabled: boolean; + readonly irDisablingContentString: string; + readonly irStatusAvailable: boolean; + readonly maxCpuSpeed: number; + readonly paintRequestsPerSecond: number; + readonly performanceCounter: number; + readonly performanceCounterFrequency: number; addEventListener(eventType: string, callback: Function): void; getMemoryUsage(): number; getProcessCpuUsage(): number; - getRecentCpuUsage(last: number): any; - getRecentFrames(last: number): any; - getRecentMemoryUsage(last: number): any; - getRecentPaintRequests(last: number): any; + getRecentCpuUsage(last: number | null): any; + getRecentFrames(last: number | null): any; + getRecentMemoryUsage(last: number | null): any; + getRecentPaintRequests(last: number | null): any; removeEventListener(eventType: string, callback: Function): void; repositionWindow(x: number, y: number): void; resizeWindow(width: number, height: number): void; @@ -8348,8 +9003,8 @@ declare var PerfWidgetExternal: { } interface Performance { - navigation: PerformanceNavigation; - timing: PerformanceTiming; + readonly navigation: PerformanceNavigation; + readonly timing: PerformanceTiming; clearMarks(markName?: string): void; clearMeasures(measureName?: string): void; clearResourceTimings(): void; @@ -8371,10 +9026,10 @@ declare var Performance: { } interface PerformanceEntry { - duration: number; - entryType: string; - name: string; - startTime: number; + readonly duration: number; + readonly entryType: string; + readonly name: string; + readonly startTime: number; } declare var PerformanceEntry: { @@ -8399,47 +9054,47 @@ declare var PerformanceMeasure: { } interface PerformanceNavigation { - redirectCount: number; - type: number; + readonly redirectCount: number; + readonly type: number; toJSON(): any; - TYPE_BACK_FORWARD: number; - TYPE_NAVIGATE: number; - TYPE_RELOAD: number; - TYPE_RESERVED: number; + readonly TYPE_BACK_FORWARD: number; + readonly TYPE_NAVIGATE: number; + readonly TYPE_RELOAD: number; + readonly TYPE_RESERVED: number; } declare var PerformanceNavigation: { prototype: PerformanceNavigation; new(): PerformanceNavigation; - TYPE_BACK_FORWARD: number; - TYPE_NAVIGATE: number; - TYPE_RELOAD: number; - TYPE_RESERVED: number; + readonly TYPE_BACK_FORWARD: number; + readonly TYPE_NAVIGATE: number; + readonly TYPE_RELOAD: number; + readonly TYPE_RESERVED: number; } interface PerformanceNavigationTiming extends PerformanceEntry { - connectEnd: number; - connectStart: number; - domComplete: number; - domContentLoadedEventEnd: number; - domContentLoadedEventStart: number; - domInteractive: number; - domLoading: number; - domainLookupEnd: number; - domainLookupStart: number; - fetchStart: number; - loadEventEnd: number; - loadEventStart: number; - navigationStart: number; - redirectCount: number; - redirectEnd: number; - redirectStart: number; - requestStart: number; - responseEnd: number; - responseStart: number; - type: string; - unloadEventEnd: number; - unloadEventStart: number; + readonly connectEnd: number; + readonly connectStart: number; + readonly domComplete: number; + readonly domContentLoadedEventEnd: number; + readonly domContentLoadedEventStart: number; + readonly domInteractive: number; + readonly domLoading: number; + readonly domainLookupEnd: number; + readonly domainLookupStart: number; + readonly fetchStart: number; + readonly loadEventEnd: number; + readonly loadEventStart: number; + readonly navigationStart: number; + readonly redirectCount: number; + readonly redirectEnd: number; + readonly redirectStart: number; + readonly requestStart: number; + readonly responseEnd: number; + readonly responseStart: number; + readonly type: string; + readonly unloadEventEnd: number; + readonly unloadEventStart: number; } declare var PerformanceNavigationTiming: { @@ -8448,17 +9103,17 @@ declare var PerformanceNavigationTiming: { } interface PerformanceResourceTiming extends PerformanceEntry { - connectEnd: number; - connectStart: number; - domainLookupEnd: number; - domainLookupStart: number; - fetchStart: number; - initiatorType: string; - redirectEnd: number; - redirectStart: number; - requestStart: number; - responseEnd: number; - responseStart: number; + readonly connectEnd: number; + readonly connectStart: number; + readonly domainLookupEnd: number; + readonly domainLookupStart: number; + readonly fetchStart: number; + readonly initiatorType: string; + readonly redirectEnd: number; + readonly redirectStart: number; + readonly requestStart: number; + readonly responseEnd: number; + readonly responseStart: number; } declare var PerformanceResourceTiming: { @@ -8467,27 +9122,27 @@ declare var PerformanceResourceTiming: { } interface PerformanceTiming { - connectEnd: number; - connectStart: number; - domComplete: number; - domContentLoadedEventEnd: number; - domContentLoadedEventStart: number; - domInteractive: number; - domLoading: number; - domainLookupEnd: number; - domainLookupStart: number; - fetchStart: number; - loadEventEnd: number; - loadEventStart: number; - msFirstPaint: number; - navigationStart: number; - redirectEnd: number; - redirectStart: number; - requestStart: number; - responseEnd: number; - responseStart: number; - unloadEventEnd: number; - unloadEventStart: number; + readonly connectEnd: number; + readonly connectStart: number; + readonly domComplete: number; + readonly domContentLoadedEventEnd: number; + readonly domContentLoadedEventStart: number; + readonly domInteractive: number; + readonly domLoading: number; + readonly domainLookupEnd: number; + readonly domainLookupStart: number; + readonly fetchStart: number; + readonly loadEventEnd: number; + readonly loadEventStart: number; + readonly msFirstPaint: number; + readonly navigationStart: number; + readonly redirectEnd: number; + readonly redirectStart: number; + readonly requestStart: number; + readonly responseEnd: number; + readonly responseStart: number; + readonly unloadEventEnd: number; + readonly unloadEventStart: number; toJSON(): any; } @@ -8505,7 +9160,7 @@ declare var PeriodicWave: { } interface PermissionRequest extends DeferredPermissionRequest { - state: string; + readonly state: string; defer(): void; } @@ -8515,7 +9170,7 @@ declare var PermissionRequest: { } interface PermissionRequestedEvent extends Event { - permissionRequest: PermissionRequest; + readonly permissionRequest: PermissionRequest; } declare var PermissionRequestedEvent: { @@ -8524,11 +9179,11 @@ declare var PermissionRequestedEvent: { } interface Plugin { - description: string; - filename: string; - length: number; - name: string; - version: string; + readonly description: string; + readonly filename: string; + readonly length: number; + readonly name: string; + readonly version: string; item(index: number): MimeType; namedItem(type: string): MimeType; [index: number]: MimeType; @@ -8540,7 +9195,7 @@ declare var Plugin: { } interface PluginArray { - length: number; + readonly length: number; item(index: number): Plugin; namedItem(name: string): Plugin; refresh(reload?: boolean): void; @@ -8553,18 +9208,18 @@ declare var PluginArray: { } interface PointerEvent extends MouseEvent { - currentPoint: any; - height: number; - hwTimestamp: number; - intermediatePoints: any; - isPrimary: boolean; - pointerId: number; - pointerType: any; - pressure: number; - rotation: number; - tiltX: number; - tiltY: number; - width: number; + readonly currentPoint: any; + readonly height: number; + readonly hwTimestamp: number; + readonly intermediatePoints: any; + readonly isPrimary: boolean; + readonly pointerId: number; + readonly pointerType: any; + readonly pressure: number; + readonly rotation: number; + readonly tiltX: number; + readonly tiltY: number; + readonly width: number; getCurrentPoint(element: Element): void; getIntermediatePoints(element: Element): void; initPointerEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, offsetXArg: number, offsetYArg: number, widthArg: number, heightArg: number, pressure: number, rotation: number, tiltX: number, tiltY: number, pointerIdArg: number, pointerType: any, hwTimestampArg: number, isPrimary: boolean): void; @@ -8576,7 +9231,7 @@ declare var PointerEvent: { } interface PopStateEvent extends Event { - state: any; + readonly state: any; initPopStateEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, stateArg: any): void; } @@ -8586,8 +9241,8 @@ declare var PopStateEvent: { } interface Position { - coords: Coordinates; - timestamp: number; + readonly coords: Coordinates; + readonly timestamp: number; } declare var Position: { @@ -8596,24 +9251,24 @@ declare var Position: { } interface PositionError { - code: number; - message: string; + readonly code: number; + readonly message: string; toString(): string; - PERMISSION_DENIED: number; - POSITION_UNAVAILABLE: number; - TIMEOUT: number; + readonly PERMISSION_DENIED: number; + readonly POSITION_UNAVAILABLE: number; + readonly TIMEOUT: number; } declare var PositionError: { prototype: PositionError; new(): PositionError; - PERMISSION_DENIED: number; - POSITION_UNAVAILABLE: number; - TIMEOUT: number; + readonly PERMISSION_DENIED: number; + readonly POSITION_UNAVAILABLE: number; + readonly TIMEOUT: number; } interface ProcessingInstruction extends CharacterData { - target: string; + readonly target: string; } declare var ProcessingInstruction: { @@ -8622,9 +9277,9 @@ declare var ProcessingInstruction: { } interface ProgressEvent extends Event { - lengthComputable: boolean; - loaded: number; - total: number; + readonly lengthComputable: boolean; + readonly loaded: number; + readonly total: number; initProgressEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, lengthComputableArg: boolean, loadedArg: number, totalArg: number): void; } @@ -8633,13 +9288,210 @@ declare var ProgressEvent: { new(type: string, eventInitDict?: ProgressEventInit): ProgressEvent; } +interface RTCDTMFToneChangeEvent extends Event { + readonly tone: string; +} + +declare var RTCDTMFToneChangeEvent: { + prototype: RTCDTMFToneChangeEvent; + new(type: string, eventInitDict: RTCDTMFToneChangeEventInit): RTCDTMFToneChangeEvent; +} + +interface RTCDtlsTransport extends RTCStatsProvider { + ondtlsstatechange: ((ev: RTCDtlsTransportStateChangedEvent) => any) | null; + onerror: ((ev: Event) => any) | null; + readonly state: string; + readonly transport: RTCIceTransport; + getLocalParameters(): RTCDtlsParameters; + getRemoteCertificates(): ArrayBuffer[]; + getRemoteParameters(): RTCDtlsParameters | null; + start(remoteParameters: RTCDtlsParameters): void; + stop(): void; + addEventListener(type: "dtlsstatechange", listener: (ev: RTCDtlsTransportStateChangedEvent) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCDtlsTransport: { + prototype: RTCDtlsTransport; + new(transport: RTCIceTransport): RTCDtlsTransport; +} + +interface RTCDtlsTransportStateChangedEvent extends Event { + readonly state: string; +} + +declare var RTCDtlsTransportStateChangedEvent: { + prototype: RTCDtlsTransportStateChangedEvent; + new(): RTCDtlsTransportStateChangedEvent; +} + +interface RTCDtmfSender extends EventTarget { + readonly canInsertDTMF: boolean; + readonly duration: number; + readonly interToneGap: number; + ontonechange: (ev: RTCDTMFToneChangeEvent) => any; + readonly sender: RTCRtpSender; + readonly toneBuffer: string; + insertDTMF(tones: string, duration?: number, interToneGap?: number): void; + addEventListener(type: "tonechange", listener: (ev: RTCDTMFToneChangeEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCDtmfSender: { + prototype: RTCDtmfSender; + new(sender: RTCRtpSender): RTCDtmfSender; +} + +interface RTCIceCandidatePairChangedEvent extends Event { + readonly pair: RTCIceCandidatePair; +} + +declare var RTCIceCandidatePairChangedEvent: { + prototype: RTCIceCandidatePairChangedEvent; + new(): RTCIceCandidatePairChangedEvent; +} + +interface RTCIceGatherer extends RTCStatsProvider { + readonly component: string; + onerror: ((ev: Event) => any) | null; + onlocalcandidate: ((ev: RTCIceGathererEvent) => any) | null; + createAssociatedGatherer(): RTCIceGatherer; + getLocalCandidates(): RTCIceCandidate[]; + getLocalParameters(): RTCIceParameters; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "localcandidate", listener: (ev: RTCIceGathererEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCIceGatherer: { + prototype: RTCIceGatherer; + new(options: RTCIceGatherOptions): RTCIceGatherer; +} + +interface RTCIceGathererEvent extends Event { + readonly candidate: RTCIceCandidate | RTCIceCandidateComplete; +} + +declare var RTCIceGathererEvent: { + prototype: RTCIceGathererEvent; + new(): RTCIceGathererEvent; +} + +interface RTCIceTransport extends RTCStatsProvider { + readonly component: string; + readonly iceGatherer: RTCIceGatherer | null; + oncandidatepairchange: ((ev: RTCIceCandidatePairChangedEvent) => any) | null; + onicestatechange: ((ev: RTCIceTransportStateChangedEvent) => any) | null; + readonly role: string; + readonly state: string; + addRemoteCandidate(remoteCandidate: RTCIceCandidate | RTCIceCandidateComplete): void; + createAssociatedTransport(): RTCIceTransport; + getNominatedCandidatePair(): RTCIceCandidatePair | null; + getRemoteCandidates(): RTCIceCandidate[]; + getRemoteParameters(): RTCIceParameters | null; + setRemoteCandidates(remoteCandidates: RTCIceCandidate[]): void; + start(gatherer: RTCIceGatherer, remoteParameters: RTCIceParameters, role?: string): void; + stop(): void; + addEventListener(type: "candidatepairchange", listener: (ev: RTCIceCandidatePairChangedEvent) => any, useCapture?: boolean): void; + addEventListener(type: "icestatechange", listener: (ev: RTCIceTransportStateChangedEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCIceTransport: { + prototype: RTCIceTransport; + new(): RTCIceTransport; +} + +interface RTCIceTransportStateChangedEvent extends Event { + readonly state: string; +} + +declare var RTCIceTransportStateChangedEvent: { + prototype: RTCIceTransportStateChangedEvent; + new(): RTCIceTransportStateChangedEvent; +} + +interface RTCRtpReceiver extends RTCStatsProvider { + onerror: ((ev: Event) => any) | null; + readonly rtcpTransport: RTCDtlsTransport; + readonly track: MediaStreamTrack | null; + readonly transport: RTCDtlsTransport | RTCSrtpSdesTransport; + getContributingSources(): RTCRtpContributingSource[]; + receive(parameters: RTCRtpParameters): void; + requestSendCSRC(csrc: number): void; + setTransport(transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): void; + stop(): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCRtpReceiver: { + prototype: RTCRtpReceiver; + new(transport: RTCDtlsTransport | RTCSrtpSdesTransport, kind: string, rtcpTransport?: RTCDtlsTransport): RTCRtpReceiver; + getCapabilities(kind?: string): RTCRtpCapabilities; +} + +interface RTCRtpSender extends RTCStatsProvider { + onerror: ((ev: Event) => any) | null; + onssrcconflict: ((ev: RTCSsrcConflictEvent) => any) | null; + readonly rtcpTransport: RTCDtlsTransport; + readonly track: MediaStreamTrack; + readonly transport: RTCDtlsTransport | RTCSrtpSdesTransport; + send(parameters: RTCRtpParameters): void; + setTrack(track: MediaStreamTrack): void; + setTransport(transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): void; + stop(): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ssrcconflict", listener: (ev: RTCSsrcConflictEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCRtpSender: { + prototype: RTCRtpSender; + new(track: MediaStreamTrack, transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): RTCRtpSender; + getCapabilities(kind?: string): RTCRtpCapabilities; +} + +interface RTCSrtpSdesTransport extends EventTarget { + onerror: ((ev: Event) => any) | null; + readonly transport: RTCIceTransport; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCSrtpSdesTransport: { + prototype: RTCSrtpSdesTransport; + new(transport: RTCIceTransport, encryptParameters: RTCSrtpSdesParameters, decryptParameters: RTCSrtpSdesParameters): RTCSrtpSdesTransport; + getLocalParameters(): RTCSrtpSdesParameters[]; +} + +interface RTCSsrcConflictEvent extends Event { + readonly ssrc: number; +} + +declare var RTCSsrcConflictEvent: { + prototype: RTCSsrcConflictEvent; + new(): RTCSsrcConflictEvent; +} + +interface RTCStatsProvider extends EventTarget { + getStats(): PromiseLike; + msGetStats(): PromiseLike; +} + +declare var RTCStatsProvider: { + prototype: RTCStatsProvider; + new(): RTCStatsProvider; +} + interface Range { - collapsed: boolean; - commonAncestorContainer: Node; - endContainer: Node; - endOffset: number; - startContainer: Node; - startOffset: number; + readonly collapsed: boolean; + readonly commonAncestorContainer: Node; + readonly endContainer: Node; + readonly endOffset: number; + readonly startContainer: Node; + readonly startOffset: number; cloneContents(): DocumentFragment; cloneRange(): Range; collapse(toStart: boolean): void; @@ -8662,23 +9514,23 @@ interface Range { setStartBefore(refNode: Node): void; surroundContents(newParent: Node): void; toString(): string; - END_TO_END: number; - END_TO_START: number; - START_TO_END: number; - START_TO_START: number; + readonly END_TO_END: number; + readonly END_TO_START: number; + readonly START_TO_END: number; + readonly START_TO_START: number; } declare var Range: { prototype: Range; new(): Range; - END_TO_END: number; - END_TO_START: number; - START_TO_END: number; - START_TO_START: number; + readonly END_TO_END: number; + readonly END_TO_START: number; + readonly START_TO_END: number; + readonly START_TO_START: number; } interface SVGAElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference { - target: SVGAnimatedString; + readonly target: SVGAnimatedString; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -8688,32 +9540,32 @@ declare var SVGAElement: { } interface SVGAngle { - unitType: number; + readonly unitType: number; value: number; valueAsString: string; valueInSpecifiedUnits: number; convertToSpecifiedUnits(unitType: number): void; newValueSpecifiedUnits(unitType: number, valueInSpecifiedUnits: number): void; - SVG_ANGLETYPE_DEG: number; - SVG_ANGLETYPE_GRAD: number; - SVG_ANGLETYPE_RAD: number; - SVG_ANGLETYPE_UNKNOWN: number; - SVG_ANGLETYPE_UNSPECIFIED: number; + readonly SVG_ANGLETYPE_DEG: number; + readonly SVG_ANGLETYPE_GRAD: number; + readonly SVG_ANGLETYPE_RAD: number; + readonly SVG_ANGLETYPE_UNKNOWN: number; + readonly SVG_ANGLETYPE_UNSPECIFIED: number; } declare var SVGAngle: { prototype: SVGAngle; new(): SVGAngle; - SVG_ANGLETYPE_DEG: number; - SVG_ANGLETYPE_GRAD: number; - SVG_ANGLETYPE_RAD: number; - SVG_ANGLETYPE_UNKNOWN: number; - SVG_ANGLETYPE_UNSPECIFIED: number; + readonly SVG_ANGLETYPE_DEG: number; + readonly SVG_ANGLETYPE_GRAD: number; + readonly SVG_ANGLETYPE_RAD: number; + readonly SVG_ANGLETYPE_UNKNOWN: number; + readonly SVG_ANGLETYPE_UNSPECIFIED: number; } interface SVGAnimatedAngle { - animVal: SVGAngle; - baseVal: SVGAngle; + readonly animVal: SVGAngle; + readonly baseVal: SVGAngle; } declare var SVGAnimatedAngle: { @@ -8722,7 +9574,7 @@ declare var SVGAnimatedAngle: { } interface SVGAnimatedBoolean { - animVal: boolean; + readonly animVal: boolean; baseVal: boolean; } @@ -8732,7 +9584,7 @@ declare var SVGAnimatedBoolean: { } interface SVGAnimatedEnumeration { - animVal: number; + readonly animVal: number; baseVal: number; } @@ -8742,7 +9594,7 @@ declare var SVGAnimatedEnumeration: { } interface SVGAnimatedInteger { - animVal: number; + readonly animVal: number; baseVal: number; } @@ -8752,8 +9604,8 @@ declare var SVGAnimatedInteger: { } interface SVGAnimatedLength { - animVal: SVGLength; - baseVal: SVGLength; + readonly animVal: SVGLength; + readonly baseVal: SVGLength; } declare var SVGAnimatedLength: { @@ -8762,8 +9614,8 @@ declare var SVGAnimatedLength: { } interface SVGAnimatedLengthList { - animVal: SVGLengthList; - baseVal: SVGLengthList; + readonly animVal: SVGLengthList; + readonly baseVal: SVGLengthList; } declare var SVGAnimatedLengthList: { @@ -8772,7 +9624,7 @@ declare var SVGAnimatedLengthList: { } interface SVGAnimatedNumber { - animVal: number; + readonly animVal: number; baseVal: number; } @@ -8782,8 +9634,8 @@ declare var SVGAnimatedNumber: { } interface SVGAnimatedNumberList { - animVal: SVGNumberList; - baseVal: SVGNumberList; + readonly animVal: SVGNumberList; + readonly baseVal: SVGNumberList; } declare var SVGAnimatedNumberList: { @@ -8792,8 +9644,8 @@ declare var SVGAnimatedNumberList: { } interface SVGAnimatedPreserveAspectRatio { - animVal: SVGPreserveAspectRatio; - baseVal: SVGPreserveAspectRatio; + readonly animVal: SVGPreserveAspectRatio; + readonly baseVal: SVGPreserveAspectRatio; } declare var SVGAnimatedPreserveAspectRatio: { @@ -8802,8 +9654,8 @@ declare var SVGAnimatedPreserveAspectRatio: { } interface SVGAnimatedRect { - animVal: SVGRect; - baseVal: SVGRect; + readonly animVal: SVGRect; + readonly baseVal: SVGRect; } declare var SVGAnimatedRect: { @@ -8812,7 +9664,7 @@ declare var SVGAnimatedRect: { } interface SVGAnimatedString { - animVal: string; + readonly animVal: string; baseVal: string; } @@ -8822,8 +9674,8 @@ declare var SVGAnimatedString: { } interface SVGAnimatedTransformList { - animVal: SVGTransformList; - baseVal: SVGTransformList; + readonly animVal: SVGTransformList; + readonly baseVal: SVGTransformList; } declare var SVGAnimatedTransformList: { @@ -8832,9 +9684,9 @@ declare var SVGAnimatedTransformList: { } interface SVGCircleElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - cx: SVGAnimatedLength; - cy: SVGAnimatedLength; - r: SVGAnimatedLength; + readonly cx: SVGAnimatedLength; + readonly cy: SVGAnimatedLength; + readonly r: SVGAnimatedLength; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -8844,7 +9696,7 @@ declare var SVGCircleElement: { } interface SVGClipPathElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGUnitTypes { - clipPathUnits: SVGAnimatedEnumeration; + readonly clipPathUnits: SVGAnimatedEnumeration; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -8854,30 +9706,30 @@ declare var SVGClipPathElement: { } interface SVGComponentTransferFunctionElement extends SVGElement { - amplitude: SVGAnimatedNumber; - exponent: SVGAnimatedNumber; - intercept: SVGAnimatedNumber; - offset: SVGAnimatedNumber; - slope: SVGAnimatedNumber; - tableValues: SVGAnimatedNumberList; - type: SVGAnimatedEnumeration; - SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number; - SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number; - SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number; - SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number; - SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number; - SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number; + readonly amplitude: SVGAnimatedNumber; + readonly exponent: SVGAnimatedNumber; + readonly intercept: SVGAnimatedNumber; + readonly offset: SVGAnimatedNumber; + readonly slope: SVGAnimatedNumber; + readonly tableValues: SVGAnimatedNumberList; + readonly type: SVGAnimatedEnumeration; + readonly SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number; } declare var SVGComponentTransferFunctionElement: { prototype: SVGComponentTransferFunctionElement; new(): SVGComponentTransferFunctionElement; - SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number; - SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number; - SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number; - SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number; - SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number; - SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number; } interface SVGDefsElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { @@ -8899,7 +9751,6 @@ declare var SVGDescElement: { } interface SVGElement extends Element { - id: string; onclick: (ev: MouseEvent) => any; ondblclick: (ev: MouseEvent) => any; onfocusin: (ev: FocusEvent) => any; @@ -8910,8 +9761,8 @@ interface SVGElement extends Element { onmouseout: (ev: MouseEvent) => any; onmouseover: (ev: MouseEvent) => any; onmouseup: (ev: MouseEvent) => any; - ownerSVGElement: SVGSVGElement; - viewportElement: SVGElement; + readonly ownerSVGElement: SVGSVGElement; + readonly viewportElement: SVGElement; xmlbase: string; className: any; addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; @@ -8969,14 +9820,14 @@ declare var SVGElement: { } interface SVGElementInstance extends EventTarget { - childNodes: SVGElementInstanceList; - correspondingElement: SVGElement; - correspondingUseElement: SVGUseElement; - firstChild: SVGElementInstance; - lastChild: SVGElementInstance; - nextSibling: SVGElementInstance; - parentNode: SVGElementInstance; - previousSibling: SVGElementInstance; + readonly childNodes: SVGElementInstanceList; + readonly correspondingElement: SVGElement; + readonly correspondingUseElement: SVGUseElement; + readonly firstChild: SVGElementInstance; + readonly lastChild: SVGElementInstance; + readonly nextSibling: SVGElementInstance; + readonly parentNode: SVGElementInstance; + readonly previousSibling: SVGElementInstance; } declare var SVGElementInstance: { @@ -8985,7 +9836,7 @@ declare var SVGElementInstance: { } interface SVGElementInstanceList { - length: number; + readonly length: number; item(index: number): SVGElementInstance; } @@ -8995,10 +9846,10 @@ declare var SVGElementInstanceList: { } interface SVGEllipseElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - cx: SVGAnimatedLength; - cy: SVGAnimatedLength; - rx: SVGAnimatedLength; - ry: SVGAnimatedLength; + readonly cx: SVGAnimatedLength; + readonly cy: SVGAnimatedLength; + readonly rx: SVGAnimatedLength; + readonly ry: SVGAnimatedLength; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -9008,75 +9859,75 @@ declare var SVGEllipseElement: { } interface SVGFEBlendElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in1: SVGAnimatedString; - in2: SVGAnimatedString; - mode: SVGAnimatedEnumeration; - SVG_FEBLEND_MODE_COLOR: number; - SVG_FEBLEND_MODE_COLOR_BURN: number; - SVG_FEBLEND_MODE_COLOR_DODGE: number; - SVG_FEBLEND_MODE_DARKEN: number; - SVG_FEBLEND_MODE_DIFFERENCE: number; - SVG_FEBLEND_MODE_EXCLUSION: number; - SVG_FEBLEND_MODE_HARD_LIGHT: number; - SVG_FEBLEND_MODE_HUE: number; - SVG_FEBLEND_MODE_LIGHTEN: number; - SVG_FEBLEND_MODE_LUMINOSITY: number; - SVG_FEBLEND_MODE_MULTIPLY: number; - SVG_FEBLEND_MODE_NORMAL: number; - SVG_FEBLEND_MODE_OVERLAY: number; - SVG_FEBLEND_MODE_SATURATION: number; - SVG_FEBLEND_MODE_SCREEN: number; - SVG_FEBLEND_MODE_SOFT_LIGHT: number; - SVG_FEBLEND_MODE_UNKNOWN: number; + readonly in1: SVGAnimatedString; + readonly in2: SVGAnimatedString; + readonly mode: SVGAnimatedEnumeration; + readonly SVG_FEBLEND_MODE_COLOR: number; + readonly SVG_FEBLEND_MODE_COLOR_BURN: number; + readonly SVG_FEBLEND_MODE_COLOR_DODGE: number; + readonly SVG_FEBLEND_MODE_DARKEN: number; + readonly SVG_FEBLEND_MODE_DIFFERENCE: number; + readonly SVG_FEBLEND_MODE_EXCLUSION: number; + readonly SVG_FEBLEND_MODE_HARD_LIGHT: number; + readonly SVG_FEBLEND_MODE_HUE: number; + readonly SVG_FEBLEND_MODE_LIGHTEN: number; + readonly SVG_FEBLEND_MODE_LUMINOSITY: number; + readonly SVG_FEBLEND_MODE_MULTIPLY: number; + readonly SVG_FEBLEND_MODE_NORMAL: number; + readonly SVG_FEBLEND_MODE_OVERLAY: number; + readonly SVG_FEBLEND_MODE_SATURATION: number; + readonly SVG_FEBLEND_MODE_SCREEN: number; + readonly SVG_FEBLEND_MODE_SOFT_LIGHT: number; + readonly SVG_FEBLEND_MODE_UNKNOWN: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGFEBlendElement: { prototype: SVGFEBlendElement; new(): SVGFEBlendElement; - SVG_FEBLEND_MODE_COLOR: number; - SVG_FEBLEND_MODE_COLOR_BURN: number; - SVG_FEBLEND_MODE_COLOR_DODGE: number; - SVG_FEBLEND_MODE_DARKEN: number; - SVG_FEBLEND_MODE_DIFFERENCE: number; - SVG_FEBLEND_MODE_EXCLUSION: number; - SVG_FEBLEND_MODE_HARD_LIGHT: number; - SVG_FEBLEND_MODE_HUE: number; - SVG_FEBLEND_MODE_LIGHTEN: number; - SVG_FEBLEND_MODE_LUMINOSITY: number; - SVG_FEBLEND_MODE_MULTIPLY: number; - SVG_FEBLEND_MODE_NORMAL: number; - SVG_FEBLEND_MODE_OVERLAY: number; - SVG_FEBLEND_MODE_SATURATION: number; - SVG_FEBLEND_MODE_SCREEN: number; - SVG_FEBLEND_MODE_SOFT_LIGHT: number; - SVG_FEBLEND_MODE_UNKNOWN: number; + readonly SVG_FEBLEND_MODE_COLOR: number; + readonly SVG_FEBLEND_MODE_COLOR_BURN: number; + readonly SVG_FEBLEND_MODE_COLOR_DODGE: number; + readonly SVG_FEBLEND_MODE_DARKEN: number; + readonly SVG_FEBLEND_MODE_DIFFERENCE: number; + readonly SVG_FEBLEND_MODE_EXCLUSION: number; + readonly SVG_FEBLEND_MODE_HARD_LIGHT: number; + readonly SVG_FEBLEND_MODE_HUE: number; + readonly SVG_FEBLEND_MODE_LIGHTEN: number; + readonly SVG_FEBLEND_MODE_LUMINOSITY: number; + readonly SVG_FEBLEND_MODE_MULTIPLY: number; + readonly SVG_FEBLEND_MODE_NORMAL: number; + readonly SVG_FEBLEND_MODE_OVERLAY: number; + readonly SVG_FEBLEND_MODE_SATURATION: number; + readonly SVG_FEBLEND_MODE_SCREEN: number; + readonly SVG_FEBLEND_MODE_SOFT_LIGHT: number; + readonly SVG_FEBLEND_MODE_UNKNOWN: number; } interface SVGFEColorMatrixElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in1: SVGAnimatedString; - type: SVGAnimatedEnumeration; - values: SVGAnimatedNumberList; - SVG_FECOLORMATRIX_TYPE_HUEROTATE: number; - SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number; - SVG_FECOLORMATRIX_TYPE_MATRIX: number; - SVG_FECOLORMATRIX_TYPE_SATURATE: number; - SVG_FECOLORMATRIX_TYPE_UNKNOWN: number; + readonly in1: SVGAnimatedString; + readonly type: SVGAnimatedEnumeration; + readonly values: SVGAnimatedNumberList; + readonly SVG_FECOLORMATRIX_TYPE_HUEROTATE: number; + readonly SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number; + readonly SVG_FECOLORMATRIX_TYPE_MATRIX: number; + readonly SVG_FECOLORMATRIX_TYPE_SATURATE: number; + readonly SVG_FECOLORMATRIX_TYPE_UNKNOWN: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGFEColorMatrixElement: { prototype: SVGFEColorMatrixElement; new(): SVGFEColorMatrixElement; - SVG_FECOLORMATRIX_TYPE_HUEROTATE: number; - SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number; - SVG_FECOLORMATRIX_TYPE_MATRIX: number; - SVG_FECOLORMATRIX_TYPE_SATURATE: number; - SVG_FECOLORMATRIX_TYPE_UNKNOWN: number; + readonly SVG_FECOLORMATRIX_TYPE_HUEROTATE: number; + readonly SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number; + readonly SVG_FECOLORMATRIX_TYPE_MATRIX: number; + readonly SVG_FECOLORMATRIX_TYPE_SATURATE: number; + readonly SVG_FECOLORMATRIX_TYPE_UNKNOWN: number; } interface SVGFEComponentTransferElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in1: SVGAnimatedString; + readonly in1: SVGAnimatedString; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -9086,70 +9937,70 @@ declare var SVGFEComponentTransferElement: { } interface SVGFECompositeElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in1: SVGAnimatedString; - in2: SVGAnimatedString; - k1: SVGAnimatedNumber; - k2: SVGAnimatedNumber; - k3: SVGAnimatedNumber; - k4: SVGAnimatedNumber; - operator: SVGAnimatedEnumeration; - SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number; - SVG_FECOMPOSITE_OPERATOR_ATOP: number; - SVG_FECOMPOSITE_OPERATOR_IN: number; - SVG_FECOMPOSITE_OPERATOR_OUT: number; - SVG_FECOMPOSITE_OPERATOR_OVER: number; - SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number; - SVG_FECOMPOSITE_OPERATOR_XOR: number; + readonly in1: SVGAnimatedString; + readonly in2: SVGAnimatedString; + readonly k1: SVGAnimatedNumber; + readonly k2: SVGAnimatedNumber; + readonly k3: SVGAnimatedNumber; + readonly k4: SVGAnimatedNumber; + readonly operator: SVGAnimatedEnumeration; + readonly SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number; + readonly SVG_FECOMPOSITE_OPERATOR_ATOP: number; + readonly SVG_FECOMPOSITE_OPERATOR_IN: number; + readonly SVG_FECOMPOSITE_OPERATOR_OUT: number; + readonly SVG_FECOMPOSITE_OPERATOR_OVER: number; + readonly SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number; + readonly SVG_FECOMPOSITE_OPERATOR_XOR: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGFECompositeElement: { prototype: SVGFECompositeElement; new(): SVGFECompositeElement; - SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number; - SVG_FECOMPOSITE_OPERATOR_ATOP: number; - SVG_FECOMPOSITE_OPERATOR_IN: number; - SVG_FECOMPOSITE_OPERATOR_OUT: number; - SVG_FECOMPOSITE_OPERATOR_OVER: number; - SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number; - SVG_FECOMPOSITE_OPERATOR_XOR: number; + readonly SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number; + readonly SVG_FECOMPOSITE_OPERATOR_ATOP: number; + readonly SVG_FECOMPOSITE_OPERATOR_IN: number; + readonly SVG_FECOMPOSITE_OPERATOR_OUT: number; + readonly SVG_FECOMPOSITE_OPERATOR_OVER: number; + readonly SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number; + readonly SVG_FECOMPOSITE_OPERATOR_XOR: number; } interface SVGFEConvolveMatrixElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - bias: SVGAnimatedNumber; - divisor: SVGAnimatedNumber; - edgeMode: SVGAnimatedEnumeration; - in1: SVGAnimatedString; - kernelMatrix: SVGAnimatedNumberList; - kernelUnitLengthX: SVGAnimatedNumber; - kernelUnitLengthY: SVGAnimatedNumber; - orderX: SVGAnimatedInteger; - orderY: SVGAnimatedInteger; - preserveAlpha: SVGAnimatedBoolean; - targetX: SVGAnimatedInteger; - targetY: SVGAnimatedInteger; - SVG_EDGEMODE_DUPLICATE: number; - SVG_EDGEMODE_NONE: number; - SVG_EDGEMODE_UNKNOWN: number; - SVG_EDGEMODE_WRAP: number; + readonly bias: SVGAnimatedNumber; + readonly divisor: SVGAnimatedNumber; + readonly edgeMode: SVGAnimatedEnumeration; + readonly in1: SVGAnimatedString; + readonly kernelMatrix: SVGAnimatedNumberList; + readonly kernelUnitLengthX: SVGAnimatedNumber; + readonly kernelUnitLengthY: SVGAnimatedNumber; + readonly orderX: SVGAnimatedInteger; + readonly orderY: SVGAnimatedInteger; + readonly preserveAlpha: SVGAnimatedBoolean; + readonly targetX: SVGAnimatedInteger; + readonly targetY: SVGAnimatedInteger; + readonly SVG_EDGEMODE_DUPLICATE: number; + readonly SVG_EDGEMODE_NONE: number; + readonly SVG_EDGEMODE_UNKNOWN: number; + readonly SVG_EDGEMODE_WRAP: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGFEConvolveMatrixElement: { prototype: SVGFEConvolveMatrixElement; new(): SVGFEConvolveMatrixElement; - SVG_EDGEMODE_DUPLICATE: number; - SVG_EDGEMODE_NONE: number; - SVG_EDGEMODE_UNKNOWN: number; - SVG_EDGEMODE_WRAP: number; + readonly SVG_EDGEMODE_DUPLICATE: number; + readonly SVG_EDGEMODE_NONE: number; + readonly SVG_EDGEMODE_UNKNOWN: number; + readonly SVG_EDGEMODE_WRAP: number; } interface SVGFEDiffuseLightingElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - diffuseConstant: SVGAnimatedNumber; - in1: SVGAnimatedString; - kernelUnitLengthX: SVGAnimatedNumber; - kernelUnitLengthY: SVGAnimatedNumber; - surfaceScale: SVGAnimatedNumber; + readonly diffuseConstant: SVGAnimatedNumber; + readonly in1: SVGAnimatedString; + readonly kernelUnitLengthX: SVGAnimatedNumber; + readonly kernelUnitLengthY: SVGAnimatedNumber; + readonly surfaceScale: SVGAnimatedNumber; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -9159,32 +10010,32 @@ declare var SVGFEDiffuseLightingElement: { } interface SVGFEDisplacementMapElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in1: SVGAnimatedString; - in2: SVGAnimatedString; - scale: SVGAnimatedNumber; - xChannelSelector: SVGAnimatedEnumeration; - yChannelSelector: SVGAnimatedEnumeration; - SVG_CHANNEL_A: number; - SVG_CHANNEL_B: number; - SVG_CHANNEL_G: number; - SVG_CHANNEL_R: number; - SVG_CHANNEL_UNKNOWN: number; + readonly in1: SVGAnimatedString; + readonly in2: SVGAnimatedString; + readonly scale: SVGAnimatedNumber; + readonly xChannelSelector: SVGAnimatedEnumeration; + readonly yChannelSelector: SVGAnimatedEnumeration; + readonly SVG_CHANNEL_A: number; + readonly SVG_CHANNEL_B: number; + readonly SVG_CHANNEL_G: number; + readonly SVG_CHANNEL_R: number; + readonly SVG_CHANNEL_UNKNOWN: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGFEDisplacementMapElement: { prototype: SVGFEDisplacementMapElement; new(): SVGFEDisplacementMapElement; - SVG_CHANNEL_A: number; - SVG_CHANNEL_B: number; - SVG_CHANNEL_G: number; - SVG_CHANNEL_R: number; - SVG_CHANNEL_UNKNOWN: number; + readonly SVG_CHANNEL_A: number; + readonly SVG_CHANNEL_B: number; + readonly SVG_CHANNEL_G: number; + readonly SVG_CHANNEL_R: number; + readonly SVG_CHANNEL_UNKNOWN: number; } interface SVGFEDistantLightElement extends SVGElement { - azimuth: SVGAnimatedNumber; - elevation: SVGAnimatedNumber; + readonly azimuth: SVGAnimatedNumber; + readonly elevation: SVGAnimatedNumber; } declare var SVGFEDistantLightElement: { @@ -9234,9 +10085,9 @@ declare var SVGFEFuncRElement: { } interface SVGFEGaussianBlurElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in1: SVGAnimatedString; - stdDeviationX: SVGAnimatedNumber; - stdDeviationY: SVGAnimatedNumber; + readonly in1: SVGAnimatedString; + readonly stdDeviationX: SVGAnimatedNumber; + readonly stdDeviationY: SVGAnimatedNumber; setStdDeviation(stdDeviationX: number, stdDeviationY: number): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -9247,7 +10098,7 @@ declare var SVGFEGaussianBlurElement: { } interface SVGFEImageElement extends SVGElement, SVGFilterPrimitiveStandardAttributes, SVGLangSpace, SVGURIReference, SVGExternalResourcesRequired { - preserveAspectRatio: SVGAnimatedPreserveAspectRatio; + readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -9266,7 +10117,7 @@ declare var SVGFEMergeElement: { } interface SVGFEMergeNodeElement extends SVGElement { - in1: SVGAnimatedString; + readonly in1: SVGAnimatedString; } declare var SVGFEMergeNodeElement: { @@ -9275,28 +10126,28 @@ declare var SVGFEMergeNodeElement: { } interface SVGFEMorphologyElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in1: SVGAnimatedString; - operator: SVGAnimatedEnumeration; - radiusX: SVGAnimatedNumber; - radiusY: SVGAnimatedNumber; - SVG_MORPHOLOGY_OPERATOR_DILATE: number; - SVG_MORPHOLOGY_OPERATOR_ERODE: number; - SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number; + readonly in1: SVGAnimatedString; + readonly operator: SVGAnimatedEnumeration; + readonly radiusX: SVGAnimatedNumber; + readonly radiusY: SVGAnimatedNumber; + readonly SVG_MORPHOLOGY_OPERATOR_DILATE: number; + readonly SVG_MORPHOLOGY_OPERATOR_ERODE: number; + readonly SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGFEMorphologyElement: { prototype: SVGFEMorphologyElement; new(): SVGFEMorphologyElement; - SVG_MORPHOLOGY_OPERATOR_DILATE: number; - SVG_MORPHOLOGY_OPERATOR_ERODE: number; - SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number; + readonly SVG_MORPHOLOGY_OPERATOR_DILATE: number; + readonly SVG_MORPHOLOGY_OPERATOR_ERODE: number; + readonly SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number; } interface SVGFEOffsetElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - dx: SVGAnimatedNumber; - dy: SVGAnimatedNumber; - in1: SVGAnimatedString; + readonly dx: SVGAnimatedNumber; + readonly dy: SVGAnimatedNumber; + readonly in1: SVGAnimatedString; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -9306,9 +10157,9 @@ declare var SVGFEOffsetElement: { } interface SVGFEPointLightElement extends SVGElement { - x: SVGAnimatedNumber; - y: SVGAnimatedNumber; - z: SVGAnimatedNumber; + readonly x: SVGAnimatedNumber; + readonly y: SVGAnimatedNumber; + readonly z: SVGAnimatedNumber; } declare var SVGFEPointLightElement: { @@ -9317,12 +10168,12 @@ declare var SVGFEPointLightElement: { } interface SVGFESpecularLightingElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in1: SVGAnimatedString; - kernelUnitLengthX: SVGAnimatedNumber; - kernelUnitLengthY: SVGAnimatedNumber; - specularConstant: SVGAnimatedNumber; - specularExponent: SVGAnimatedNumber; - surfaceScale: SVGAnimatedNumber; + readonly in1: SVGAnimatedString; + readonly kernelUnitLengthX: SVGAnimatedNumber; + readonly kernelUnitLengthY: SVGAnimatedNumber; + readonly specularConstant: SVGAnimatedNumber; + readonly specularExponent: SVGAnimatedNumber; + readonly surfaceScale: SVGAnimatedNumber; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -9332,14 +10183,14 @@ declare var SVGFESpecularLightingElement: { } interface SVGFESpotLightElement extends SVGElement { - limitingConeAngle: SVGAnimatedNumber; - pointsAtX: SVGAnimatedNumber; - pointsAtY: SVGAnimatedNumber; - pointsAtZ: SVGAnimatedNumber; - specularExponent: SVGAnimatedNumber; - x: SVGAnimatedNumber; - y: SVGAnimatedNumber; - z: SVGAnimatedNumber; + readonly limitingConeAngle: SVGAnimatedNumber; + readonly pointsAtX: SVGAnimatedNumber; + readonly pointsAtY: SVGAnimatedNumber; + readonly pointsAtZ: SVGAnimatedNumber; + readonly specularExponent: SVGAnimatedNumber; + readonly x: SVGAnimatedNumber; + readonly y: SVGAnimatedNumber; + readonly z: SVGAnimatedNumber; } declare var SVGFESpotLightElement: { @@ -9348,7 +10199,7 @@ declare var SVGFESpotLightElement: { } interface SVGFETileElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in1: SVGAnimatedString; + readonly in1: SVGAnimatedString; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -9358,41 +10209,41 @@ declare var SVGFETileElement: { } interface SVGFETurbulenceElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - baseFrequencyX: SVGAnimatedNumber; - baseFrequencyY: SVGAnimatedNumber; - numOctaves: SVGAnimatedInteger; - seed: SVGAnimatedNumber; - stitchTiles: SVGAnimatedEnumeration; - type: SVGAnimatedEnumeration; - SVG_STITCHTYPE_NOSTITCH: number; - SVG_STITCHTYPE_STITCH: number; - SVG_STITCHTYPE_UNKNOWN: number; - SVG_TURBULENCE_TYPE_FRACTALNOISE: number; - SVG_TURBULENCE_TYPE_TURBULENCE: number; - SVG_TURBULENCE_TYPE_UNKNOWN: number; + readonly baseFrequencyX: SVGAnimatedNumber; + readonly baseFrequencyY: SVGAnimatedNumber; + readonly numOctaves: SVGAnimatedInteger; + readonly seed: SVGAnimatedNumber; + readonly stitchTiles: SVGAnimatedEnumeration; + readonly type: SVGAnimatedEnumeration; + readonly SVG_STITCHTYPE_NOSTITCH: number; + readonly SVG_STITCHTYPE_STITCH: number; + readonly SVG_STITCHTYPE_UNKNOWN: number; + readonly SVG_TURBULENCE_TYPE_FRACTALNOISE: number; + readonly SVG_TURBULENCE_TYPE_TURBULENCE: number; + readonly SVG_TURBULENCE_TYPE_UNKNOWN: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGFETurbulenceElement: { prototype: SVGFETurbulenceElement; new(): SVGFETurbulenceElement; - SVG_STITCHTYPE_NOSTITCH: number; - SVG_STITCHTYPE_STITCH: number; - SVG_STITCHTYPE_UNKNOWN: number; - SVG_TURBULENCE_TYPE_FRACTALNOISE: number; - SVG_TURBULENCE_TYPE_TURBULENCE: number; - SVG_TURBULENCE_TYPE_UNKNOWN: number; + readonly SVG_STITCHTYPE_NOSTITCH: number; + readonly SVG_STITCHTYPE_STITCH: number; + readonly SVG_STITCHTYPE_UNKNOWN: number; + readonly SVG_TURBULENCE_TYPE_FRACTALNOISE: number; + readonly SVG_TURBULENCE_TYPE_TURBULENCE: number; + readonly SVG_TURBULENCE_TYPE_UNKNOWN: number; } interface SVGFilterElement extends SVGElement, SVGUnitTypes, SVGStylable, SVGLangSpace, SVGURIReference, SVGExternalResourcesRequired { - filterResX: SVGAnimatedInteger; - filterResY: SVGAnimatedInteger; - filterUnits: SVGAnimatedEnumeration; - height: SVGAnimatedLength; - primitiveUnits: SVGAnimatedEnumeration; - width: SVGAnimatedLength; - x: SVGAnimatedLength; - y: SVGAnimatedLength; + readonly filterResX: SVGAnimatedInteger; + readonly filterResY: SVGAnimatedInteger; + readonly filterUnits: SVGAnimatedEnumeration; + readonly height: SVGAnimatedLength; + readonly primitiveUnits: SVGAnimatedEnumeration; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; setFilterRes(filterResX: number, filterResY: number): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -9403,10 +10254,10 @@ declare var SVGFilterElement: { } interface SVGForeignObjectElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - height: SVGAnimatedLength; - width: SVGAnimatedLength; - x: SVGAnimatedLength; - y: SVGAnimatedLength; + readonly height: SVGAnimatedLength; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -9425,31 +10276,31 @@ declare var SVGGElement: { } interface SVGGradientElement extends SVGElement, SVGStylable, SVGExternalResourcesRequired, SVGURIReference, SVGUnitTypes { - gradientTransform: SVGAnimatedTransformList; - gradientUnits: SVGAnimatedEnumeration; - spreadMethod: SVGAnimatedEnumeration; - SVG_SPREADMETHOD_PAD: number; - SVG_SPREADMETHOD_REFLECT: number; - SVG_SPREADMETHOD_REPEAT: number; - SVG_SPREADMETHOD_UNKNOWN: number; + readonly gradientTransform: SVGAnimatedTransformList; + readonly gradientUnits: SVGAnimatedEnumeration; + readonly spreadMethod: SVGAnimatedEnumeration; + readonly SVG_SPREADMETHOD_PAD: number; + readonly SVG_SPREADMETHOD_REFLECT: number; + readonly SVG_SPREADMETHOD_REPEAT: number; + readonly SVG_SPREADMETHOD_UNKNOWN: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGGradientElement: { prototype: SVGGradientElement; new(): SVGGradientElement; - SVG_SPREADMETHOD_PAD: number; - SVG_SPREADMETHOD_REFLECT: number; - SVG_SPREADMETHOD_REPEAT: number; - SVG_SPREADMETHOD_UNKNOWN: number; + readonly SVG_SPREADMETHOD_PAD: number; + readonly SVG_SPREADMETHOD_REFLECT: number; + readonly SVG_SPREADMETHOD_REPEAT: number; + readonly SVG_SPREADMETHOD_UNKNOWN: number; } interface SVGImageElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference { - height: SVGAnimatedLength; - preserveAspectRatio: SVGAnimatedPreserveAspectRatio; - width: SVGAnimatedLength; - x: SVGAnimatedLength; - y: SVGAnimatedLength; + readonly height: SVGAnimatedLength; + readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -9459,43 +10310,43 @@ declare var SVGImageElement: { } interface SVGLength { - unitType: number; + readonly unitType: number; value: number; valueAsString: string; valueInSpecifiedUnits: number; convertToSpecifiedUnits(unitType: number): void; newValueSpecifiedUnits(unitType: number, valueInSpecifiedUnits: number): void; - SVG_LENGTHTYPE_CM: number; - SVG_LENGTHTYPE_EMS: number; - SVG_LENGTHTYPE_EXS: number; - SVG_LENGTHTYPE_IN: number; - SVG_LENGTHTYPE_MM: number; - SVG_LENGTHTYPE_NUMBER: number; - SVG_LENGTHTYPE_PC: number; - SVG_LENGTHTYPE_PERCENTAGE: number; - SVG_LENGTHTYPE_PT: number; - SVG_LENGTHTYPE_PX: number; - SVG_LENGTHTYPE_UNKNOWN: number; + readonly SVG_LENGTHTYPE_CM: number; + readonly SVG_LENGTHTYPE_EMS: number; + readonly SVG_LENGTHTYPE_EXS: number; + readonly SVG_LENGTHTYPE_IN: number; + readonly SVG_LENGTHTYPE_MM: number; + readonly SVG_LENGTHTYPE_NUMBER: number; + readonly SVG_LENGTHTYPE_PC: number; + readonly SVG_LENGTHTYPE_PERCENTAGE: number; + readonly SVG_LENGTHTYPE_PT: number; + readonly SVG_LENGTHTYPE_PX: number; + readonly SVG_LENGTHTYPE_UNKNOWN: number; } declare var SVGLength: { prototype: SVGLength; new(): SVGLength; - SVG_LENGTHTYPE_CM: number; - SVG_LENGTHTYPE_EMS: number; - SVG_LENGTHTYPE_EXS: number; - SVG_LENGTHTYPE_IN: number; - SVG_LENGTHTYPE_MM: number; - SVG_LENGTHTYPE_NUMBER: number; - SVG_LENGTHTYPE_PC: number; - SVG_LENGTHTYPE_PERCENTAGE: number; - SVG_LENGTHTYPE_PT: number; - SVG_LENGTHTYPE_PX: number; - SVG_LENGTHTYPE_UNKNOWN: number; + readonly SVG_LENGTHTYPE_CM: number; + readonly SVG_LENGTHTYPE_EMS: number; + readonly SVG_LENGTHTYPE_EXS: number; + readonly SVG_LENGTHTYPE_IN: number; + readonly SVG_LENGTHTYPE_MM: number; + readonly SVG_LENGTHTYPE_NUMBER: number; + readonly SVG_LENGTHTYPE_PC: number; + readonly SVG_LENGTHTYPE_PERCENTAGE: number; + readonly SVG_LENGTHTYPE_PT: number; + readonly SVG_LENGTHTYPE_PX: number; + readonly SVG_LENGTHTYPE_UNKNOWN: number; } interface SVGLengthList { - numberOfItems: number; + readonly numberOfItems: number; appendItem(newItem: SVGLength): SVGLength; clear(): void; getItem(index: number): SVGLength; @@ -9511,10 +10362,10 @@ declare var SVGLengthList: { } interface SVGLineElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - x1: SVGAnimatedLength; - x2: SVGAnimatedLength; - y1: SVGAnimatedLength; - y2: SVGAnimatedLength; + readonly x1: SVGAnimatedLength; + readonly x2: SVGAnimatedLength; + readonly y1: SVGAnimatedLength; + readonly y2: SVGAnimatedLength; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -9524,10 +10375,10 @@ declare var SVGLineElement: { } interface SVGLinearGradientElement extends SVGGradientElement { - x1: SVGAnimatedLength; - x2: SVGAnimatedLength; - y1: SVGAnimatedLength; - y2: SVGAnimatedLength; + readonly x1: SVGAnimatedLength; + readonly x2: SVGAnimatedLength; + readonly y1: SVGAnimatedLength; + readonly y2: SVGAnimatedLength; } declare var SVGLinearGradientElement: { @@ -9536,42 +10387,42 @@ declare var SVGLinearGradientElement: { } interface SVGMarkerElement extends SVGElement, SVGStylable, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox { - markerHeight: SVGAnimatedLength; - markerUnits: SVGAnimatedEnumeration; - markerWidth: SVGAnimatedLength; - orientAngle: SVGAnimatedAngle; - orientType: SVGAnimatedEnumeration; - refX: SVGAnimatedLength; - refY: SVGAnimatedLength; + readonly markerHeight: SVGAnimatedLength; + readonly markerUnits: SVGAnimatedEnumeration; + readonly markerWidth: SVGAnimatedLength; + readonly orientAngle: SVGAnimatedAngle; + readonly orientType: SVGAnimatedEnumeration; + readonly refX: SVGAnimatedLength; + readonly refY: SVGAnimatedLength; setOrientToAngle(angle: SVGAngle): void; setOrientToAuto(): void; - SVG_MARKERUNITS_STROKEWIDTH: number; - SVG_MARKERUNITS_UNKNOWN: number; - SVG_MARKERUNITS_USERSPACEONUSE: number; - SVG_MARKER_ORIENT_ANGLE: number; - SVG_MARKER_ORIENT_AUTO: number; - SVG_MARKER_ORIENT_UNKNOWN: number; + readonly SVG_MARKERUNITS_STROKEWIDTH: number; + readonly SVG_MARKERUNITS_UNKNOWN: number; + readonly SVG_MARKERUNITS_USERSPACEONUSE: number; + readonly SVG_MARKER_ORIENT_ANGLE: number; + readonly SVG_MARKER_ORIENT_AUTO: number; + readonly SVG_MARKER_ORIENT_UNKNOWN: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGMarkerElement: { prototype: SVGMarkerElement; new(): SVGMarkerElement; - SVG_MARKERUNITS_STROKEWIDTH: number; - SVG_MARKERUNITS_UNKNOWN: number; - SVG_MARKERUNITS_USERSPACEONUSE: number; - SVG_MARKER_ORIENT_ANGLE: number; - SVG_MARKER_ORIENT_AUTO: number; - SVG_MARKER_ORIENT_UNKNOWN: number; + readonly SVG_MARKERUNITS_STROKEWIDTH: number; + readonly SVG_MARKERUNITS_UNKNOWN: number; + readonly SVG_MARKERUNITS_USERSPACEONUSE: number; + readonly SVG_MARKER_ORIENT_ANGLE: number; + readonly SVG_MARKER_ORIENT_AUTO: number; + readonly SVG_MARKER_ORIENT_UNKNOWN: number; } interface SVGMaskElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGUnitTypes { - height: SVGAnimatedLength; - maskContentUnits: SVGAnimatedEnumeration; - maskUnits: SVGAnimatedEnumeration; - width: SVGAnimatedLength; - x: SVGAnimatedLength; - y: SVGAnimatedLength; + readonly height: SVGAnimatedLength; + readonly maskContentUnits: SVGAnimatedEnumeration; + readonly maskUnits: SVGAnimatedEnumeration; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -9623,7 +10474,7 @@ declare var SVGNumber: { } interface SVGNumberList { - numberOfItems: number; + readonly numberOfItems: number; appendItem(newItem: SVGNumber): SVGNumber; clear(): void; getItem(index: number): SVGNumber; @@ -9670,53 +10521,53 @@ declare var SVGPathElement: { } interface SVGPathSeg { - pathSegType: number; - pathSegTypeAsLetter: string; - PATHSEG_ARC_ABS: number; - PATHSEG_ARC_REL: number; - PATHSEG_CLOSEPATH: number; - PATHSEG_CURVETO_CUBIC_ABS: number; - PATHSEG_CURVETO_CUBIC_REL: number; - PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number; - PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number; - PATHSEG_CURVETO_QUADRATIC_ABS: number; - PATHSEG_CURVETO_QUADRATIC_REL: number; - PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number; - PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number; - PATHSEG_LINETO_ABS: number; - PATHSEG_LINETO_HORIZONTAL_ABS: number; - PATHSEG_LINETO_HORIZONTAL_REL: number; - PATHSEG_LINETO_REL: number; - PATHSEG_LINETO_VERTICAL_ABS: number; - PATHSEG_LINETO_VERTICAL_REL: number; - PATHSEG_MOVETO_ABS: number; - PATHSEG_MOVETO_REL: number; - PATHSEG_UNKNOWN: number; + readonly pathSegType: number; + readonly pathSegTypeAsLetter: string; + readonly PATHSEG_ARC_ABS: number; + readonly PATHSEG_ARC_REL: number; + readonly PATHSEG_CLOSEPATH: number; + readonly PATHSEG_CURVETO_CUBIC_ABS: number; + readonly PATHSEG_CURVETO_CUBIC_REL: number; + readonly PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number; + readonly PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number; + readonly PATHSEG_CURVETO_QUADRATIC_ABS: number; + readonly PATHSEG_CURVETO_QUADRATIC_REL: number; + readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number; + readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number; + readonly PATHSEG_LINETO_ABS: number; + readonly PATHSEG_LINETO_HORIZONTAL_ABS: number; + readonly PATHSEG_LINETO_HORIZONTAL_REL: number; + readonly PATHSEG_LINETO_REL: number; + readonly PATHSEG_LINETO_VERTICAL_ABS: number; + readonly PATHSEG_LINETO_VERTICAL_REL: number; + readonly PATHSEG_MOVETO_ABS: number; + readonly PATHSEG_MOVETO_REL: number; + readonly PATHSEG_UNKNOWN: number; } declare var SVGPathSeg: { prototype: SVGPathSeg; new(): SVGPathSeg; - PATHSEG_ARC_ABS: number; - PATHSEG_ARC_REL: number; - PATHSEG_CLOSEPATH: number; - PATHSEG_CURVETO_CUBIC_ABS: number; - PATHSEG_CURVETO_CUBIC_REL: number; - PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number; - PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number; - PATHSEG_CURVETO_QUADRATIC_ABS: number; - PATHSEG_CURVETO_QUADRATIC_REL: number; - PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number; - PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number; - PATHSEG_LINETO_ABS: number; - PATHSEG_LINETO_HORIZONTAL_ABS: number; - PATHSEG_LINETO_HORIZONTAL_REL: number; - PATHSEG_LINETO_REL: number; - PATHSEG_LINETO_VERTICAL_ABS: number; - PATHSEG_LINETO_VERTICAL_REL: number; - PATHSEG_MOVETO_ABS: number; - PATHSEG_MOVETO_REL: number; - PATHSEG_UNKNOWN: number; + readonly PATHSEG_ARC_ABS: number; + readonly PATHSEG_ARC_REL: number; + readonly PATHSEG_CLOSEPATH: number; + readonly PATHSEG_CURVETO_CUBIC_ABS: number; + readonly PATHSEG_CURVETO_CUBIC_REL: number; + readonly PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number; + readonly PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number; + readonly PATHSEG_CURVETO_QUADRATIC_ABS: number; + readonly PATHSEG_CURVETO_QUADRATIC_REL: number; + readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number; + readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number; + readonly PATHSEG_LINETO_ABS: number; + readonly PATHSEG_LINETO_HORIZONTAL_ABS: number; + readonly PATHSEG_LINETO_HORIZONTAL_REL: number; + readonly PATHSEG_LINETO_REL: number; + readonly PATHSEG_LINETO_VERTICAL_ABS: number; + readonly PATHSEG_LINETO_VERTICAL_REL: number; + readonly PATHSEG_MOVETO_ABS: number; + readonly PATHSEG_MOVETO_REL: number; + readonly PATHSEG_UNKNOWN: number; } interface SVGPathSegArcAbs extends SVGPathSeg { @@ -9910,7 +10761,7 @@ declare var SVGPathSegLinetoVerticalRel: { } interface SVGPathSegList { - numberOfItems: number; + readonly numberOfItems: number; appendItem(newItem: SVGPathSeg): SVGPathSeg; clear(): void; getItem(index: number): SVGPathSeg; @@ -9946,13 +10797,13 @@ declare var SVGPathSegMovetoRel: { } interface SVGPatternElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox, SVGURIReference, SVGUnitTypes { - height: SVGAnimatedLength; - patternContentUnits: SVGAnimatedEnumeration; - patternTransform: SVGAnimatedTransformList; - patternUnits: SVGAnimatedEnumeration; - width: SVGAnimatedLength; - x: SVGAnimatedLength; - y: SVGAnimatedLength; + readonly height: SVGAnimatedLength; + readonly patternContentUnits: SVGAnimatedEnumeration; + readonly patternTransform: SVGAnimatedTransformList; + readonly patternUnits: SVGAnimatedEnumeration; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -9973,7 +10824,7 @@ declare var SVGPoint: { } interface SVGPointList { - numberOfItems: number; + readonly numberOfItems: number; appendItem(newItem: SVGPoint): SVGPoint; clear(): void; getItem(index: number): SVGPoint; @@ -10009,47 +10860,47 @@ declare var SVGPolylineElement: { interface SVGPreserveAspectRatio { align: number; meetOrSlice: number; - SVG_MEETORSLICE_MEET: number; - SVG_MEETORSLICE_SLICE: number; - SVG_MEETORSLICE_UNKNOWN: number; - SVG_PRESERVEASPECTRATIO_NONE: number; - SVG_PRESERVEASPECTRATIO_UNKNOWN: number; - SVG_PRESERVEASPECTRATIO_XMAXYMAX: number; - SVG_PRESERVEASPECTRATIO_XMAXYMID: number; - SVG_PRESERVEASPECTRATIO_XMAXYMIN: number; - SVG_PRESERVEASPECTRATIO_XMIDYMAX: number; - SVG_PRESERVEASPECTRATIO_XMIDYMID: number; - SVG_PRESERVEASPECTRATIO_XMIDYMIN: number; - SVG_PRESERVEASPECTRATIO_XMINYMAX: number; - SVG_PRESERVEASPECTRATIO_XMINYMID: number; - SVG_PRESERVEASPECTRATIO_XMINYMIN: number; + readonly SVG_MEETORSLICE_MEET: number; + readonly SVG_MEETORSLICE_SLICE: number; + readonly SVG_MEETORSLICE_UNKNOWN: number; + readonly SVG_PRESERVEASPECTRATIO_NONE: number; + readonly SVG_PRESERVEASPECTRATIO_UNKNOWN: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMIN: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMIN: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMIN: number; } declare var SVGPreserveAspectRatio: { prototype: SVGPreserveAspectRatio; new(): SVGPreserveAspectRatio; - SVG_MEETORSLICE_MEET: number; - SVG_MEETORSLICE_SLICE: number; - SVG_MEETORSLICE_UNKNOWN: number; - SVG_PRESERVEASPECTRATIO_NONE: number; - SVG_PRESERVEASPECTRATIO_UNKNOWN: number; - SVG_PRESERVEASPECTRATIO_XMAXYMAX: number; - SVG_PRESERVEASPECTRATIO_XMAXYMID: number; - SVG_PRESERVEASPECTRATIO_XMAXYMIN: number; - SVG_PRESERVEASPECTRATIO_XMIDYMAX: number; - SVG_PRESERVEASPECTRATIO_XMIDYMID: number; - SVG_PRESERVEASPECTRATIO_XMIDYMIN: number; - SVG_PRESERVEASPECTRATIO_XMINYMAX: number; - SVG_PRESERVEASPECTRATIO_XMINYMID: number; - SVG_PRESERVEASPECTRATIO_XMINYMIN: number; + readonly SVG_MEETORSLICE_MEET: number; + readonly SVG_MEETORSLICE_SLICE: number; + readonly SVG_MEETORSLICE_UNKNOWN: number; + readonly SVG_PRESERVEASPECTRATIO_NONE: number; + readonly SVG_PRESERVEASPECTRATIO_UNKNOWN: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMIN: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMIN: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMIN: number; } interface SVGRadialGradientElement extends SVGGradientElement { - cx: SVGAnimatedLength; - cy: SVGAnimatedLength; - fx: SVGAnimatedLength; - fy: SVGAnimatedLength; - r: SVGAnimatedLength; + readonly cx: SVGAnimatedLength; + readonly cy: SVGAnimatedLength; + readonly fx: SVGAnimatedLength; + readonly fy: SVGAnimatedLength; + readonly r: SVGAnimatedLength; } declare var SVGRadialGradientElement: { @@ -10070,12 +10921,12 @@ declare var SVGRect: { } interface SVGRectElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - height: SVGAnimatedLength; - rx: SVGAnimatedLength; - ry: SVGAnimatedLength; - width: SVGAnimatedLength; - x: SVGAnimatedLength; - y: SVGAnimatedLength; + readonly height: SVGAnimatedLength; + readonly rx: SVGAnimatedLength; + readonly ry: SVGAnimatedLength; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -10088,22 +10939,22 @@ interface SVGSVGElement extends SVGElement, DocumentEvent, SVGLocatable, SVGTest contentScriptType: string; contentStyleType: string; currentScale: number; - currentTranslate: SVGPoint; - height: SVGAnimatedLength; + readonly currentTranslate: SVGPoint; + readonly height: SVGAnimatedLength; onabort: (ev: Event) => any; onerror: (ev: Event) => any; onresize: (ev: UIEvent) => any; onscroll: (ev: UIEvent) => any; onunload: (ev: Event) => any; onzoom: (ev: SVGZoomEvent) => any; - pixelUnitToMillimeterX: number; - pixelUnitToMillimeterY: number; - screenPixelToMillimeterX: number; - screenPixelToMillimeterY: number; - viewport: SVGRect; - width: SVGAnimatedLength; - x: SVGAnimatedLength; - y: SVGAnimatedLength; + readonly pixelUnitToMillimeterX: number; + readonly pixelUnitToMillimeterY: number; + readonly screenPixelToMillimeterX: number; + readonly screenPixelToMillimeterY: number; + readonly viewport: SVGRect; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; checkEnclosure(element: SVGElement, rect: SVGRect): boolean; checkIntersection(element: SVGElement, rect: SVGRect): boolean; createSVGAngle(): SVGAngle; @@ -10119,8 +10970,8 @@ interface SVGSVGElement extends SVGElement, DocumentEvent, SVGLocatable, SVGTest getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration; getCurrentTime(): number; getElementById(elementId: string): Element; - getEnclosureList(rect: SVGRect, referenceElement: SVGElement): NodeList; - getIntersectionList(rect: SVGRect, referenceElement: SVGElement): NodeList; + getEnclosureList(rect: SVGRect, referenceElement: SVGElement): NodeListOf; + getIntersectionList(rect: SVGRect, referenceElement: SVGElement): NodeListOf; pauseAnimations(): void; setCurrentTime(seconds: number): void; suspendRedraw(maxWaitMilliseconds: number): number; @@ -10198,7 +11049,7 @@ declare var SVGScriptElement: { } interface SVGStopElement extends SVGElement, SVGStylable { - offset: SVGAnimatedNumber; + readonly offset: SVGAnimatedNumber; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -10208,7 +11059,7 @@ declare var SVGStopElement: { } interface SVGStringList { - numberOfItems: number; + readonly numberOfItems: number; appendItem(newItem: string): string; clear(): void; getItem(index: number): string; @@ -10224,6 +11075,7 @@ declare var SVGStringList: { } interface SVGStyleElement extends SVGElement, SVGLangSpace { + disabled: boolean; media: string; title: string; type: string; @@ -10262,8 +11114,8 @@ declare var SVGTSpanElement: { } interface SVGTextContentElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - lengthAdjust: SVGAnimatedEnumeration; - textLength: SVGAnimatedLength; + readonly lengthAdjust: SVGAnimatedEnumeration; + readonly textLength: SVGAnimatedLength; getCharNumAtPosition(point: SVGPoint): number; getComputedTextLength(): number; getEndPositionOfChar(charnum: number): SVGPoint; @@ -10273,18 +11125,18 @@ interface SVGTextContentElement extends SVGElement, SVGStylable, SVGTests, SVGLa getStartPositionOfChar(charnum: number): SVGPoint; getSubStringLength(charnum: number, nchars: number): number; selectSubString(charnum: number, nchars: number): void; - LENGTHADJUST_SPACING: number; - LENGTHADJUST_SPACINGANDGLYPHS: number; - LENGTHADJUST_UNKNOWN: number; + readonly LENGTHADJUST_SPACING: number; + readonly LENGTHADJUST_SPACINGANDGLYPHS: number; + readonly LENGTHADJUST_UNKNOWN: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGTextContentElement: { prototype: SVGTextContentElement; new(): SVGTextContentElement; - LENGTHADJUST_SPACING: number; - LENGTHADJUST_SPACINGANDGLYPHS: number; - LENGTHADJUST_UNKNOWN: number; + readonly LENGTHADJUST_SPACING: number; + readonly LENGTHADJUST_SPACINGANDGLYPHS: number; + readonly LENGTHADJUST_UNKNOWN: number; } interface SVGTextElement extends SVGTextPositioningElement, SVGTransformable { @@ -10297,35 +11149,35 @@ declare var SVGTextElement: { } interface SVGTextPathElement extends SVGTextContentElement, SVGURIReference { - method: SVGAnimatedEnumeration; - spacing: SVGAnimatedEnumeration; - startOffset: SVGAnimatedLength; - TEXTPATH_METHODTYPE_ALIGN: number; - TEXTPATH_METHODTYPE_STRETCH: number; - TEXTPATH_METHODTYPE_UNKNOWN: number; - TEXTPATH_SPACINGTYPE_AUTO: number; - TEXTPATH_SPACINGTYPE_EXACT: number; - TEXTPATH_SPACINGTYPE_UNKNOWN: number; + readonly method: SVGAnimatedEnumeration; + readonly spacing: SVGAnimatedEnumeration; + readonly startOffset: SVGAnimatedLength; + readonly TEXTPATH_METHODTYPE_ALIGN: number; + readonly TEXTPATH_METHODTYPE_STRETCH: number; + readonly TEXTPATH_METHODTYPE_UNKNOWN: number; + readonly TEXTPATH_SPACINGTYPE_AUTO: number; + readonly TEXTPATH_SPACINGTYPE_EXACT: number; + readonly TEXTPATH_SPACINGTYPE_UNKNOWN: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGTextPathElement: { prototype: SVGTextPathElement; new(): SVGTextPathElement; - TEXTPATH_METHODTYPE_ALIGN: number; - TEXTPATH_METHODTYPE_STRETCH: number; - TEXTPATH_METHODTYPE_UNKNOWN: number; - TEXTPATH_SPACINGTYPE_AUTO: number; - TEXTPATH_SPACINGTYPE_EXACT: number; - TEXTPATH_SPACINGTYPE_UNKNOWN: number; + readonly TEXTPATH_METHODTYPE_ALIGN: number; + readonly TEXTPATH_METHODTYPE_STRETCH: number; + readonly TEXTPATH_METHODTYPE_UNKNOWN: number; + readonly TEXTPATH_SPACINGTYPE_AUTO: number; + readonly TEXTPATH_SPACINGTYPE_EXACT: number; + readonly TEXTPATH_SPACINGTYPE_UNKNOWN: number; } interface SVGTextPositioningElement extends SVGTextContentElement { - dx: SVGAnimatedLengthList; - dy: SVGAnimatedLengthList; - rotate: SVGAnimatedNumberList; - x: SVGAnimatedLengthList; - y: SVGAnimatedLengthList; + readonly dx: SVGAnimatedLengthList; + readonly dy: SVGAnimatedLengthList; + readonly rotate: SVGAnimatedNumberList; + readonly x: SVGAnimatedLengthList; + readonly y: SVGAnimatedLengthList; } declare var SVGTextPositioningElement: { @@ -10343,38 +11195,38 @@ declare var SVGTitleElement: { } interface SVGTransform { - angle: number; - matrix: SVGMatrix; - type: number; + readonly angle: number; + readonly matrix: SVGMatrix; + readonly type: number; setMatrix(matrix: SVGMatrix): void; setRotate(angle: number, cx: number, cy: number): void; setScale(sx: number, sy: number): void; setSkewX(angle: number): void; setSkewY(angle: number): void; setTranslate(tx: number, ty: number): void; - SVG_TRANSFORM_MATRIX: number; - SVG_TRANSFORM_ROTATE: number; - SVG_TRANSFORM_SCALE: number; - SVG_TRANSFORM_SKEWX: number; - SVG_TRANSFORM_SKEWY: number; - SVG_TRANSFORM_TRANSLATE: number; - SVG_TRANSFORM_UNKNOWN: number; + readonly SVG_TRANSFORM_MATRIX: number; + readonly SVG_TRANSFORM_ROTATE: number; + readonly SVG_TRANSFORM_SCALE: number; + readonly SVG_TRANSFORM_SKEWX: number; + readonly SVG_TRANSFORM_SKEWY: number; + readonly SVG_TRANSFORM_TRANSLATE: number; + readonly SVG_TRANSFORM_UNKNOWN: number; } declare var SVGTransform: { prototype: SVGTransform; new(): SVGTransform; - SVG_TRANSFORM_MATRIX: number; - SVG_TRANSFORM_ROTATE: number; - SVG_TRANSFORM_SCALE: number; - SVG_TRANSFORM_SKEWX: number; - SVG_TRANSFORM_SKEWY: number; - SVG_TRANSFORM_TRANSLATE: number; - SVG_TRANSFORM_UNKNOWN: number; + readonly SVG_TRANSFORM_MATRIX: number; + readonly SVG_TRANSFORM_ROTATE: number; + readonly SVG_TRANSFORM_SCALE: number; + readonly SVG_TRANSFORM_SKEWX: number; + readonly SVG_TRANSFORM_SKEWY: number; + readonly SVG_TRANSFORM_TRANSLATE: number; + readonly SVG_TRANSFORM_UNKNOWN: number; } interface SVGTransformList { - numberOfItems: number; + readonly numberOfItems: number; appendItem(newItem: SVGTransform): SVGTransform; clear(): void; consolidate(): SVGTransform; @@ -10392,19 +11244,19 @@ declare var SVGTransformList: { } interface SVGUnitTypes { - SVG_UNIT_TYPE_OBJECTBOUNDINGBOX: number; - SVG_UNIT_TYPE_UNKNOWN: number; - SVG_UNIT_TYPE_USERSPACEONUSE: number; + readonly SVG_UNIT_TYPE_OBJECTBOUNDINGBOX: number; + readonly SVG_UNIT_TYPE_UNKNOWN: number; + readonly SVG_UNIT_TYPE_USERSPACEONUSE: number; } declare var SVGUnitTypes: SVGUnitTypes; interface SVGUseElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference { - animatedInstanceRoot: SVGElementInstance; - height: SVGAnimatedLength; - instanceRoot: SVGElementInstance; - width: SVGAnimatedLength; - x: SVGAnimatedLength; - y: SVGAnimatedLength; + readonly animatedInstanceRoot: SVGElementInstance; + readonly height: SVGAnimatedLength; + readonly instanceRoot: SVGElementInstance; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -10414,7 +11266,7 @@ declare var SVGUseElement: { } interface SVGViewElement extends SVGElement, SVGExternalResourcesRequired, SVGFitToViewBox, SVGZoomAndPan { - viewTarget: SVGStringList; + readonly viewTarget: SVGStringList; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -10424,18 +11276,21 @@ declare var SVGViewElement: { } interface SVGZoomAndPan { - SVG_ZOOMANDPAN_DISABLE: number; - SVG_ZOOMANDPAN_MAGNIFY: number; - SVG_ZOOMANDPAN_UNKNOWN: number; + readonly zoomAndPan: number; +} + +declare var SVGZoomAndPan: { + readonly SVG_ZOOMANDPAN_DISABLE: number; + readonly SVG_ZOOMANDPAN_MAGNIFY: number; + readonly SVG_ZOOMANDPAN_UNKNOWN: number; } -declare var SVGZoomAndPan: SVGZoomAndPan; interface SVGZoomEvent extends UIEvent { - newScale: number; - newTranslate: SVGPoint; - previousScale: number; - previousTranslate: SVGPoint; - zoomRectScreen: SVGRect; + readonly newScale: number; + readonly newTranslate: SVGPoint; + readonly previousScale: number; + readonly previousTranslate: SVGPoint; + readonly zoomRectScreen: SVGRect; } declare var SVGZoomEvent: { @@ -10444,22 +11299,22 @@ declare var SVGZoomEvent: { } interface Screen extends EventTarget { - availHeight: number; - availWidth: number; + readonly availHeight: number; + readonly availWidth: number; bufferDepth: number; - colorDepth: number; - deviceXDPI: number; - deviceYDPI: number; - fontSmoothingEnabled: boolean; - height: number; - logicalXDPI: number; - logicalYDPI: number; - msOrientation: string; + readonly colorDepth: number; + readonly deviceXDPI: number; + readonly deviceYDPI: number; + readonly fontSmoothingEnabled: boolean; + readonly height: number; + readonly logicalXDPI: number; + readonly logicalYDPI: number; + readonly msOrientation: string; onmsorientationchange: (ev: Event) => any; - pixelDepth: number; - systemXDPI: number; - systemYDPI: number; - width: number; + readonly pixelDepth: number; + readonly systemXDPI: number; + readonly systemYDPI: number; + readonly width: number; msLockOrientation(orientations: string | string[]): boolean; msUnlockOrientation(): void; addEventListener(type: "MSOrientationChange", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -10472,8 +11327,8 @@ declare var Screen: { } interface ScriptNotifyEvent extends Event { - callingUri: string; - value: string; + readonly callingUri: string; + readonly value: string; } declare var ScriptNotifyEvent: { @@ -10482,7 +11337,7 @@ declare var ScriptNotifyEvent: { } interface ScriptProcessorNode extends AudioNode { - bufferSize: number; + readonly bufferSize: number; onaudioprocess: (ev: AudioProcessingEvent) => any; addEventListener(type: "audioprocess", listener: (ev: AudioProcessingEvent) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; @@ -10494,13 +11349,13 @@ declare var ScriptProcessorNode: { } interface Selection { - anchorNode: Node; - anchorOffset: number; - focusNode: Node; - focusOffset: number; - isCollapsed: boolean; - rangeCount: number; - type: string; + readonly anchorNode: Node; + readonly anchorOffset: number; + readonly focusNode: Node; + readonly focusOffset: number; + readonly isCollapsed: boolean; + readonly rangeCount: number; + readonly type: string; addRange(range: Range): void; collapse(parentNode: Node, offset: number): void; collapseToEnd(): void; @@ -10525,12 +11380,12 @@ declare var Selection: { interface SourceBuffer extends EventTarget { appendWindowEnd: number; appendWindowStart: number; - audioTracks: AudioTrackList; - buffered: TimeRanges; + readonly audioTracks: AudioTrackList; + readonly buffered: TimeRanges; mode: string; timestampOffset: number; - updating: boolean; - videoTracks: VideoTrackList; + readonly updating: boolean; + readonly videoTracks: VideoTrackList; abort(): void; appendBuffer(data: ArrayBuffer | ArrayBufferView): void; appendStream(stream: MSStream, maxSize?: number): void; @@ -10543,7 +11398,7 @@ declare var SourceBuffer: { } interface SourceBufferList extends EventTarget { - length: number; + readonly length: number; item(index: number): SourceBuffer; [index: number]: SourceBuffer; } @@ -10554,7 +11409,7 @@ declare var SourceBufferList: { } interface StereoPannerNode extends AudioNode { - pan: AudioParam; + readonly pan: AudioParam; } declare var StereoPannerNode: { @@ -10563,9 +11418,9 @@ declare var StereoPannerNode: { } interface Storage { - length: number; + readonly length: number; clear(): void; - getItem(key: string): any; + getItem(key: string): string; key(index: number): string; removeItem(key: string): void; setItem(key: string, data: string): void; @@ -10579,21 +11434,20 @@ declare var Storage: { } interface StorageEvent extends Event { - key: string; - newValue: any; - oldValue: any; - storageArea: Storage; - url: string; - initStorageEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, keyArg: string, oldValueArg: any, newValueArg: any, urlArg: string, storageAreaArg: Storage): void; + readonly url: string; + key?: string; + oldValue?: string; + newValue?: string; + storageArea?: Storage; } declare var StorageEvent: { prototype: StorageEvent; - new(): StorageEvent; + new (type: string, eventInitDict?: StorageEventInit): StorageEvent; } interface StyleMedia { - type: string; + readonly type: string; matchMedium(mediaquery: string): boolean; } @@ -10604,12 +11458,12 @@ declare var StyleMedia: { interface StyleSheet { disabled: boolean; - href: string; - media: MediaList; - ownerNode: Node; - parentStyleSheet: StyleSheet; - title: string; - type: string; + readonly href: string; + readonly media: MediaList; + readonly ownerNode: Node; + readonly parentStyleSheet: StyleSheet; + readonly title: string; + readonly type: string; } declare var StyleSheet: { @@ -10618,7 +11472,7 @@ declare var StyleSheet: { } interface StyleSheetList { - length: number; + readonly length: number; item(index?: number): StyleSheet; [index: number]: StyleSheet; } @@ -10629,7 +11483,7 @@ declare var StyleSheetList: { } interface StyleSheetPageList { - length: number; + readonly length: number; item(index: number): CSSPageRule; [index: number]: CSSPageRule; } @@ -10640,18 +11494,18 @@ declare var StyleSheetPageList: { } interface SubtleCrypto { - decrypt(algorithm: string | Algorithm, key: CryptoKey, data: ArrayBufferView): any; - deriveBits(algorithm: string | Algorithm, baseKey: CryptoKey, length: number): any; - deriveKey(algorithm: string | Algorithm, baseKey: CryptoKey, derivedKeyType: string | Algorithm, extractable: boolean, keyUsages: string[]): any; - digest(algorithm: string | Algorithm, data: ArrayBufferView): any; - encrypt(algorithm: string | Algorithm, key: CryptoKey, data: ArrayBufferView): any; - exportKey(format: string, key: CryptoKey): any; - generateKey(algorithm: string | Algorithm, extractable: boolean, keyUsages: string[]): any; - importKey(format: string, keyData: ArrayBufferView, algorithm: string | Algorithm, extractable: boolean, keyUsages: string[]): any; - sign(algorithm: string | Algorithm, key: CryptoKey, data: ArrayBufferView): any; - unwrapKey(format: string, wrappedKey: ArrayBufferView, unwrappingKey: CryptoKey, unwrapAlgorithm: string | Algorithm, unwrappedKeyAlgorithm: string | Algorithm, extractable: boolean, keyUsages: string[]): any; - verify(algorithm: string | Algorithm, key: CryptoKey, signature: ArrayBufferView, data: ArrayBufferView): any; - wrapKey(format: string, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: string | Algorithm): any; + decrypt(algorithm: string | Algorithm, key: CryptoKey, data: ArrayBufferView): PromiseLike; + deriveBits(algorithm: string | Algorithm, baseKey: CryptoKey, length: number): PromiseLike; + deriveKey(algorithm: string | Algorithm, baseKey: CryptoKey, derivedKeyType: string | Algorithm, extractable: boolean, keyUsages: string[]): PromiseLike; + digest(algorithm: string | Algorithm, data: ArrayBufferView): PromiseLike; + encrypt(algorithm: string | Algorithm, key: CryptoKey, data: ArrayBufferView): PromiseLike; + exportKey(format: string, key: CryptoKey): PromiseLike; + generateKey(algorithm: string | Algorithm, extractable: boolean, keyUsages: string[]): PromiseLike; + importKey(format: string, keyData: ArrayBufferView, algorithm: string | Algorithm | null, extractable: boolean, keyUsages: string[]): PromiseLike; + sign(algorithm: string | Algorithm, key: CryptoKey, data: ArrayBufferView): PromiseLike; + unwrapKey(format: string, wrappedKey: ArrayBufferView, unwrappingKey: CryptoKey, unwrapAlgorithm: string | Algorithm, unwrappedKeyAlgorithm: string | Algorithm | null, extractable: boolean, keyUsages: string[]): PromiseLike; + verify(algorithm: string | Algorithm, key: CryptoKey, signature: ArrayBufferView, data: ArrayBufferView): PromiseLike; + wrapKey(format: string, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: string | Algorithm): PromiseLike; } declare var SubtleCrypto: { @@ -10660,8 +11514,7 @@ declare var SubtleCrypto: { } interface Text extends CharacterData { - wholeText: string; - replaceWholeText(content: string): Text; + readonly wholeText: string; splitText(offset: number): Text; } @@ -10671,39 +11524,39 @@ declare var Text: { } interface TextEvent extends UIEvent { - data: string; - inputMethod: number; - locale: string; + readonly data: string; + readonly inputMethod: number; + readonly locale: string; initTextEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, dataArg: string, inputMethod: number, locale: string): void; - DOM_INPUT_METHOD_DROP: number; - DOM_INPUT_METHOD_HANDWRITING: number; - DOM_INPUT_METHOD_IME: number; - DOM_INPUT_METHOD_KEYBOARD: number; - DOM_INPUT_METHOD_MULTIMODAL: number; - DOM_INPUT_METHOD_OPTION: number; - DOM_INPUT_METHOD_PASTE: number; - DOM_INPUT_METHOD_SCRIPT: number; - DOM_INPUT_METHOD_UNKNOWN: number; - DOM_INPUT_METHOD_VOICE: number; + readonly DOM_INPUT_METHOD_DROP: number; + readonly DOM_INPUT_METHOD_HANDWRITING: number; + readonly DOM_INPUT_METHOD_IME: number; + readonly DOM_INPUT_METHOD_KEYBOARD: number; + readonly DOM_INPUT_METHOD_MULTIMODAL: number; + readonly DOM_INPUT_METHOD_OPTION: number; + readonly DOM_INPUT_METHOD_PASTE: number; + readonly DOM_INPUT_METHOD_SCRIPT: number; + readonly DOM_INPUT_METHOD_UNKNOWN: number; + readonly DOM_INPUT_METHOD_VOICE: number; } declare var TextEvent: { prototype: TextEvent; new(): TextEvent; - DOM_INPUT_METHOD_DROP: number; - DOM_INPUT_METHOD_HANDWRITING: number; - DOM_INPUT_METHOD_IME: number; - DOM_INPUT_METHOD_KEYBOARD: number; - DOM_INPUT_METHOD_MULTIMODAL: number; - DOM_INPUT_METHOD_OPTION: number; - DOM_INPUT_METHOD_PASTE: number; - DOM_INPUT_METHOD_SCRIPT: number; - DOM_INPUT_METHOD_UNKNOWN: number; - DOM_INPUT_METHOD_VOICE: number; + readonly DOM_INPUT_METHOD_DROP: number; + readonly DOM_INPUT_METHOD_HANDWRITING: number; + readonly DOM_INPUT_METHOD_IME: number; + readonly DOM_INPUT_METHOD_KEYBOARD: number; + readonly DOM_INPUT_METHOD_MULTIMODAL: number; + readonly DOM_INPUT_METHOD_OPTION: number; + readonly DOM_INPUT_METHOD_PASTE: number; + readonly DOM_INPUT_METHOD_SCRIPT: number; + readonly DOM_INPUT_METHOD_UNKNOWN: number; + readonly DOM_INPUT_METHOD_VOICE: number; } interface TextMetrics { - width: number; + readonly width: number; } declare var TextMetrics: { @@ -10711,83 +11564,27 @@ declare var TextMetrics: { new(): TextMetrics; } -interface TextRange { - boundingHeight: number; - boundingLeft: number; - boundingTop: number; - boundingWidth: number; - htmlText: string; - offsetLeft: number; - offsetTop: number; - text: string; - collapse(start?: boolean): void; - compareEndPoints(how: string, sourceRange: TextRange): number; - duplicate(): TextRange; - execCommand(cmdID: string, showUI?: boolean, value?: any): boolean; - execCommandShowHelp(cmdID: string): boolean; - expand(Unit: string): boolean; - findText(string: string, count?: number, flags?: number): boolean; - getBookmark(): string; - getBoundingClientRect(): ClientRect; - getClientRects(): ClientRectList; - inRange(range: TextRange): boolean; - isEqual(range: TextRange): boolean; - move(unit: string, count?: number): number; - moveEnd(unit: string, count?: number): number; - moveStart(unit: string, count?: number): number; - moveToBookmark(bookmark: string): boolean; - moveToElementText(element: Element): void; - moveToPoint(x: number, y: number): void; - parentElement(): Element; - pasteHTML(html: string): void; - queryCommandEnabled(cmdID: string): boolean; - queryCommandIndeterm(cmdID: string): boolean; - queryCommandState(cmdID: string): boolean; - queryCommandSupported(cmdID: string): boolean; - queryCommandText(cmdID: string): string; - queryCommandValue(cmdID: string): any; - scrollIntoView(fStart?: boolean): void; - select(): void; - setEndPoint(how: string, SourceRange: TextRange): void; -} - -declare var TextRange: { - prototype: TextRange; - new(): TextRange; -} - -interface TextRangeCollection { - length: number; - item(index: number): TextRange; - [index: number]: TextRange; -} - -declare var TextRangeCollection: { - prototype: TextRangeCollection; - new(): TextRangeCollection; -} - interface TextTrack extends EventTarget { - activeCues: TextTrackCueList; - cues: TextTrackCueList; - inBandMetadataTrackDispatchType: string; - kind: string; - label: string; - language: string; + readonly activeCues: TextTrackCueList; + readonly cues: TextTrackCueList; + readonly inBandMetadataTrackDispatchType: string; + readonly kind: string; + readonly label: string; + readonly language: string; mode: any; oncuechange: (ev: Event) => any; onerror: (ev: Event) => any; onload: (ev: Event) => any; - readyState: number; + readonly readyState: number; addCue(cue: TextTrackCue): void; removeCue(cue: TextTrackCue): void; - DISABLED: number; - ERROR: number; - HIDDEN: number; - LOADED: number; - LOADING: number; - NONE: number; - SHOWING: number; + readonly DISABLED: number; + readonly ERROR: number; + readonly HIDDEN: number; + readonly LOADED: number; + readonly LOADING: number; + readonly NONE: number; + readonly SHOWING: number; addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -10797,13 +11594,13 @@ interface TextTrack extends EventTarget { declare var TextTrack: { prototype: TextTrack; new(): TextTrack; - DISABLED: number; - ERROR: number; - HIDDEN: number; - LOADED: number; - LOADING: number; - NONE: number; - SHOWING: number; + readonly DISABLED: number; + readonly ERROR: number; + readonly HIDDEN: number; + readonly LOADED: number; + readonly LOADING: number; + readonly NONE: number; + readonly SHOWING: number; } interface TextTrackCue extends EventTarget { @@ -10814,7 +11611,7 @@ interface TextTrackCue extends EventTarget { pauseOnExit: boolean; startTime: number; text: string; - track: TextTrack; + readonly track: TextTrack; getCueAsHTML(): DocumentFragment; addEventListener(type: "enter", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "exit", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -10827,7 +11624,7 @@ declare var TextTrackCue: { } interface TextTrackCueList { - length: number; + readonly length: number; getCueById(id: string): TextTrackCue; item(index: number): TextTrackCue; [index: number]: TextTrackCue; @@ -10839,8 +11636,8 @@ declare var TextTrackCueList: { } interface TextTrackList extends EventTarget { - length: number; - onaddtrack: (ev: TrackEvent) => any; + readonly length: number; + onaddtrack: ((ev: TrackEvent) => any) | null; item(index: number): TextTrack; addEventListener(type: "addtrack", listener: (ev: TrackEvent) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; @@ -10853,7 +11650,7 @@ declare var TextTrackList: { } interface TimeRanges { - length: number; + readonly length: number; end(index: number): number; start(index: number): number; } @@ -10864,14 +11661,14 @@ declare var TimeRanges: { } interface Touch { - clientX: number; - clientY: number; - identifier: number; - pageX: number; - pageY: number; - screenX: number; - screenY: number; - target: EventTarget; + readonly clientX: number; + readonly clientY: number; + readonly identifier: number; + readonly pageX: number; + readonly pageY: number; + readonly screenX: number; + readonly screenY: number; + readonly target: EventTarget; } declare var Touch: { @@ -10880,13 +11677,13 @@ declare var Touch: { } interface TouchEvent extends UIEvent { - altKey: boolean; - changedTouches: TouchList; - ctrlKey: boolean; - metaKey: boolean; - shiftKey: boolean; - targetTouches: TouchList; - touches: TouchList; + readonly altKey: boolean; + readonly changedTouches: TouchList; + readonly ctrlKey: boolean; + readonly metaKey: boolean; + readonly shiftKey: boolean; + readonly targetTouches: TouchList; + readonly touches: TouchList; } declare var TouchEvent: { @@ -10895,8 +11692,8 @@ declare var TouchEvent: { } interface TouchList { - length: number; - item(index: number): Touch; + readonly length: number; + item(index: number): Touch | null; [index: number]: Touch; } @@ -10906,7 +11703,7 @@ declare var TouchList: { } interface TrackEvent extends Event { - track: any; + readonly track: any; } declare var TrackEvent: { @@ -10915,8 +11712,8 @@ declare var TrackEvent: { } interface TransitionEvent extends Event { - elapsedTime: number; - propertyName: string; + readonly elapsedTime: number; + readonly propertyName: string; initTransitionEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, propertyNameArg: string, elapsedTimeArg: number): void; } @@ -10927,10 +11724,10 @@ declare var TransitionEvent: { interface TreeWalker { currentNode: Node; - expandEntityReferences: boolean; - filter: NodeFilter; - root: Node; - whatToShow: number; + readonly expandEntityReferences: boolean; + readonly filter: NodeFilter; + readonly root: Node; + readonly whatToShow: number; firstChild(): Node; lastChild(): Node; nextNode(): Node; @@ -10946,8 +11743,8 @@ declare var TreeWalker: { } interface UIEvent extends Event { - detail: number; - view: Window; + readonly detail: number; + readonly view: Window; initUIEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number): void; } @@ -10957,13 +11754,29 @@ declare var UIEvent: { } interface URL { + hash: string; + host: string; + hostname: string; + href: string; + readonly origin: string; + password: string; + pathname: string; + port: string; + protocol: string; + search: string; + username: string; + toString(): string; +} + +declare var URL: { + prototype: URL; + new(url: string, base?: string): URL; createObjectURL(object: any, options?: ObjectURLOptions): string; revokeObjectURL(url: string): void; } -declare var URL: URL; interface UnviewableContentIdentifiedEvent extends NavigationEventWithReferrer { - mediaType: string; + readonly mediaType: string; } declare var UnviewableContentIdentifiedEvent: { @@ -10972,16 +11785,16 @@ declare var UnviewableContentIdentifiedEvent: { } interface ValidityState { - badInput: boolean; - customError: boolean; - patternMismatch: boolean; - rangeOverflow: boolean; - rangeUnderflow: boolean; - stepMismatch: boolean; - tooLong: boolean; - typeMismatch: boolean; - valid: boolean; - valueMissing: boolean; + readonly badInput: boolean; + readonly customError: boolean; + readonly patternMismatch: boolean; + readonly rangeOverflow: boolean; + readonly rangeUnderflow: boolean; + readonly stepMismatch: boolean; + readonly tooLong: boolean; + readonly typeMismatch: boolean; + readonly valid: boolean; + readonly valueMissing: boolean; } declare var ValidityState: { @@ -10990,11 +11803,11 @@ declare var ValidityState: { } interface VideoPlaybackQuality { - corruptedVideoFrames: number; - creationTime: number; - droppedVideoFrames: number; - totalFrameDelay: number; - totalVideoFrames: number; + readonly corruptedVideoFrames: number; + readonly creationTime: number; + readonly droppedVideoFrames: number; + readonly totalFrameDelay: number; + readonly totalVideoFrames: number; } declare var VideoPlaybackQuality: { @@ -11003,12 +11816,12 @@ declare var VideoPlaybackQuality: { } interface VideoTrack { - id: string; + readonly id: string; kind: string; - label: string; + readonly label: string; language: string; selected: boolean; - sourceBuffer: SourceBuffer; + readonly sourceBuffer: SourceBuffer; } declare var VideoTrack: { @@ -11017,12 +11830,12 @@ declare var VideoTrack: { } interface VideoTrackList extends EventTarget { - length: number; + readonly length: number; onaddtrack: (ev: TrackEvent) => any; onchange: (ev: Event) => any; onremovetrack: (ev: TrackEvent) => any; - selectedIndex: number; - getTrackById(id: string): VideoTrack; + readonly selectedIndex: number; + getTrackById(id: string): VideoTrack | null; item(index: number): VideoTrack; addEventListener(type: "addtrack", listener: (ev: TrackEvent) => any, useCapture?: boolean): void; addEventListener(type: "change", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -11037,45 +11850,45 @@ declare var VideoTrackList: { } interface WEBGL_compressed_texture_s3tc { - COMPRESSED_RGBA_S3TC_DXT1_EXT: number; - COMPRESSED_RGBA_S3TC_DXT3_EXT: number; - COMPRESSED_RGBA_S3TC_DXT5_EXT: number; - COMPRESSED_RGB_S3TC_DXT1_EXT: number; + readonly COMPRESSED_RGBA_S3TC_DXT1_EXT: number; + readonly COMPRESSED_RGBA_S3TC_DXT3_EXT: number; + readonly COMPRESSED_RGBA_S3TC_DXT5_EXT: number; + readonly COMPRESSED_RGB_S3TC_DXT1_EXT: number; } declare var WEBGL_compressed_texture_s3tc: { prototype: WEBGL_compressed_texture_s3tc; new(): WEBGL_compressed_texture_s3tc; - COMPRESSED_RGBA_S3TC_DXT1_EXT: number; - COMPRESSED_RGBA_S3TC_DXT3_EXT: number; - COMPRESSED_RGBA_S3TC_DXT5_EXT: number; - COMPRESSED_RGB_S3TC_DXT1_EXT: number; + readonly COMPRESSED_RGBA_S3TC_DXT1_EXT: number; + readonly COMPRESSED_RGBA_S3TC_DXT3_EXT: number; + readonly COMPRESSED_RGBA_S3TC_DXT5_EXT: number; + readonly COMPRESSED_RGB_S3TC_DXT1_EXT: number; } interface WEBGL_debug_renderer_info { - UNMASKED_RENDERER_WEBGL: number; - UNMASKED_VENDOR_WEBGL: number; + readonly UNMASKED_RENDERER_WEBGL: number; + readonly UNMASKED_VENDOR_WEBGL: number; } declare var WEBGL_debug_renderer_info: { prototype: WEBGL_debug_renderer_info; new(): WEBGL_debug_renderer_info; - UNMASKED_RENDERER_WEBGL: number; - UNMASKED_VENDOR_WEBGL: number; + readonly UNMASKED_RENDERER_WEBGL: number; + readonly UNMASKED_VENDOR_WEBGL: number; } interface WEBGL_depth_texture { - UNSIGNED_INT_24_8_WEBGL: number; + readonly UNSIGNED_INT_24_8_WEBGL: number; } declare var WEBGL_depth_texture: { prototype: WEBGL_depth_texture; new(): WEBGL_depth_texture; - UNSIGNED_INT_24_8_WEBGL: number; + readonly UNSIGNED_INT_24_8_WEBGL: number; } interface WaveShaperNode extends AudioNode { - curve: Float32Array; + curve: Float32Array | null; oversample: string; } @@ -11085,9 +11898,9 @@ declare var WaveShaperNode: { } interface WebGLActiveInfo { - name: string; - size: number; - type: number; + readonly name: string; + readonly size: number; + readonly type: number; } declare var WebGLActiveInfo: { @@ -11104,12 +11917,12 @@ declare var WebGLBuffer: { } interface WebGLContextEvent extends Event { - statusMessage: string; + readonly statusMessage: string; } declare var WebGLContextEvent: { prototype: WebGLContextEvent; - new(): WebGLContextEvent; + new(type: string, eventInitDict?: WebGLContextEventInit): WebGLContextEvent; } interface WebGLFramebuffer extends WebGLObject { @@ -11145,16 +11958,16 @@ declare var WebGLRenderbuffer: { } interface WebGLRenderingContext { - canvas: HTMLCanvasElement; - drawingBufferHeight: number; - drawingBufferWidth: number; + readonly canvas: HTMLCanvasElement; + readonly drawingBufferHeight: number; + readonly drawingBufferWidth: number; activeTexture(texture: number): void; - attachShader(program: WebGLProgram, shader: WebGLShader): void; - bindAttribLocation(program: WebGLProgram, index: number, name: string): void; - bindBuffer(target: number, buffer: WebGLBuffer): void; - bindFramebuffer(target: number, framebuffer: WebGLFramebuffer): void; - bindRenderbuffer(target: number, renderbuffer: WebGLRenderbuffer): void; - bindTexture(target: number, texture: WebGLTexture): void; + attachShader(program: WebGLProgram | null, shader: WebGLShader | null): void; + bindAttribLocation(program: WebGLProgram | null, index: number, name: string): void; + bindBuffer(target: number, buffer: WebGLBuffer | null): void; + bindFramebuffer(target: number, framebuffer: WebGLFramebuffer | null): void; + bindRenderbuffer(target: number, renderbuffer: WebGLRenderbuffer | null): void; + bindTexture(target: number, texture: WebGLTexture | null): void; blendColor(red: number, green: number, blue: number, alpha: number): void; blendEquation(mode: number): void; blendEquationSeparate(modeRGB: number, modeAlpha: number): void; @@ -11168,28 +11981,28 @@ interface WebGLRenderingContext { clearDepth(depth: number): void; clearStencil(s: number): void; colorMask(red: boolean, green: boolean, blue: boolean, alpha: boolean): void; - compileShader(shader: WebGLShader): void; + compileShader(shader: WebGLShader | null): void; compressedTexImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, data: ArrayBufferView): void; compressedTexSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, data: ArrayBufferView): void; copyTexImage2D(target: number, level: number, internalformat: number, x: number, y: number, width: number, height: number, border: number): void; copyTexSubImage2D(target: number, level: number, xoffset: number, yoffset: number, x: number, y: number, width: number, height: number): void; - createBuffer(): WebGLBuffer; - createFramebuffer(): WebGLFramebuffer; - createProgram(): WebGLProgram; - createRenderbuffer(): WebGLRenderbuffer; - createShader(type: number): WebGLShader; - createTexture(): WebGLTexture; + createBuffer(): WebGLBuffer | null; + createFramebuffer(): WebGLFramebuffer | null; + createProgram(): WebGLProgram | null; + createRenderbuffer(): WebGLRenderbuffer | null; + createShader(type: number): WebGLShader | null; + createTexture(): WebGLTexture | null; cullFace(mode: number): void; - deleteBuffer(buffer: WebGLBuffer): void; - deleteFramebuffer(framebuffer: WebGLFramebuffer): void; - deleteProgram(program: WebGLProgram): void; - deleteRenderbuffer(renderbuffer: WebGLRenderbuffer): void; - deleteShader(shader: WebGLShader): void; - deleteTexture(texture: WebGLTexture): void; + deleteBuffer(buffer: WebGLBuffer | null): void; + deleteFramebuffer(framebuffer: WebGLFramebuffer | null): void; + deleteProgram(program: WebGLProgram | null): void; + deleteRenderbuffer(renderbuffer: WebGLRenderbuffer | null): void; + deleteShader(shader: WebGLShader | null): void; + deleteTexture(texture: WebGLTexture | null): void; depthFunc(func: number): void; depthMask(flag: boolean): void; depthRange(zNear: number, zFar: number): void; - detachShader(program: WebGLProgram, shader: WebGLShader): void; + detachShader(program: WebGLProgram | null, shader: WebGLShader | null): void; disable(cap: number): void; disableVertexAttribArray(index: number): void; drawArrays(mode: number, first: number, count: number): void; @@ -11198,51 +12011,51 @@ interface WebGLRenderingContext { enableVertexAttribArray(index: number): void; finish(): void; flush(): void; - framebufferRenderbuffer(target: number, attachment: number, renderbuffertarget: number, renderbuffer: WebGLRenderbuffer): void; - framebufferTexture2D(target: number, attachment: number, textarget: number, texture: WebGLTexture, level: number): void; + framebufferRenderbuffer(target: number, attachment: number, renderbuffertarget: number, renderbuffer: WebGLRenderbuffer | null): void; + framebufferTexture2D(target: number, attachment: number, textarget: number, texture: WebGLTexture | null, level: number): void; frontFace(mode: number): void; generateMipmap(target: number): void; - getActiveAttrib(program: WebGLProgram, index: number): WebGLActiveInfo; - getActiveUniform(program: WebGLProgram, index: number): WebGLActiveInfo; - getAttachedShaders(program: WebGLProgram): WebGLShader[]; - getAttribLocation(program: WebGLProgram, name: string): number; + getActiveAttrib(program: WebGLProgram | null, index: number): WebGLActiveInfo | null; + getActiveUniform(program: WebGLProgram | null, index: number): WebGLActiveInfo | null; + getAttachedShaders(program: WebGLProgram | null): WebGLShader[] | null; + getAttribLocation(program: WebGLProgram | null, name: string): number; getBufferParameter(target: number, pname: number): any; getContextAttributes(): WebGLContextAttributes; getError(): number; getExtension(name: string): any; getFramebufferAttachmentParameter(target: number, attachment: number, pname: number): any; getParameter(pname: number): any; - getProgramInfoLog(program: WebGLProgram): string; - getProgramParameter(program: WebGLProgram, pname: number): any; + getProgramInfoLog(program: WebGLProgram | null): string | null; + getProgramParameter(program: WebGLProgram | null, pname: number): any; getRenderbufferParameter(target: number, pname: number): any; - getShaderInfoLog(shader: WebGLShader): string; - getShaderParameter(shader: WebGLShader, pname: number): any; - getShaderPrecisionFormat(shadertype: number, precisiontype: number): WebGLShaderPrecisionFormat; - getShaderSource(shader: WebGLShader): string; - getSupportedExtensions(): string[]; + getShaderInfoLog(shader: WebGLShader | null): string | null; + getShaderParameter(shader: WebGLShader | null, pname: number): any; + getShaderPrecisionFormat(shadertype: number, precisiontype: number): WebGLShaderPrecisionFormat | null; + getShaderSource(shader: WebGLShader | null): string | null; + getSupportedExtensions(): string[] | null; getTexParameter(target: number, pname: number): any; - getUniform(program: WebGLProgram, location: WebGLUniformLocation): any; - getUniformLocation(program: WebGLProgram, name: string): WebGLUniformLocation; + getUniform(program: WebGLProgram | null, location: WebGLUniformLocation | null): any; + getUniformLocation(program: WebGLProgram | null, name: string): WebGLUniformLocation | null; getVertexAttrib(index: number, pname: number): any; getVertexAttribOffset(index: number, pname: number): number; hint(target: number, mode: number): void; - isBuffer(buffer: WebGLBuffer): boolean; + isBuffer(buffer: WebGLBuffer | null): boolean; isContextLost(): boolean; isEnabled(cap: number): boolean; - isFramebuffer(framebuffer: WebGLFramebuffer): boolean; - isProgram(program: WebGLProgram): boolean; - isRenderbuffer(renderbuffer: WebGLRenderbuffer): boolean; - isShader(shader: WebGLShader): boolean; - isTexture(texture: WebGLTexture): boolean; + isFramebuffer(framebuffer: WebGLFramebuffer | null): boolean; + isProgram(program: WebGLProgram | null): boolean; + isRenderbuffer(renderbuffer: WebGLRenderbuffer | null): boolean; + isShader(shader: WebGLShader | null): boolean; + isTexture(texture: WebGLTexture | null): boolean; lineWidth(width: number): void; - linkProgram(program: WebGLProgram): void; + linkProgram(program: WebGLProgram | null): void; pixelStorei(pname: number, param: number): void; polygonOffset(factor: number, units: number): void; - readPixels(x: number, y: number, width: number, height: number, format: number, type: number, pixels: ArrayBufferView): void; + readPixels(x: number, y: number, width: number, height: number, format: number, type: number, pixels: ArrayBufferView | null): void; renderbufferStorage(target: number, internalformat: number, width: number, height: number): void; sampleCoverage(value: number, invert: boolean): void; scissor(x: number, y: number, width: number, height: number): void; - shaderSource(shader: WebGLShader, source: string): void; + shaderSource(shader: WebGLShader | null, source: string): void; stencilFunc(func: number, ref: number, mask: number): void; stencilFuncSeparate(face: number, func: number, ref: number, mask: number): void; stencilMask(mask: number): void; @@ -11261,636 +12074,636 @@ interface WebGLRenderingContext { texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, canvas: HTMLCanvasElement): void; texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, video: HTMLVideoElement): void; texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, pixels: ImageData): void; - uniform1f(location: WebGLUniformLocation, x: number): void; - uniform1fv(location: WebGLUniformLocation, v: Float32Array): void; - uniform1i(location: WebGLUniformLocation, x: number): void; - uniform1iv(location: WebGLUniformLocation, v: Int32Array): void; - uniform2f(location: WebGLUniformLocation, x: number, y: number): void; - uniform2fv(location: WebGLUniformLocation, v: Float32Array): void; - uniform2i(location: WebGLUniformLocation, x: number, y: number): void; - uniform2iv(location: WebGLUniformLocation, v: Int32Array): void; - uniform3f(location: WebGLUniformLocation, x: number, y: number, z: number): void; - uniform3fv(location: WebGLUniformLocation, v: Float32Array): void; - uniform3i(location: WebGLUniformLocation, x: number, y: number, z: number): void; - uniform3iv(location: WebGLUniformLocation, v: Int32Array): void; - uniform4f(location: WebGLUniformLocation, x: number, y: number, z: number, w: number): void; - uniform4fv(location: WebGLUniformLocation, v: Float32Array): void; - uniform4i(location: WebGLUniformLocation, x: number, y: number, z: number, w: number): void; - uniform4iv(location: WebGLUniformLocation, v: Int32Array): void; - uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void; - uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void; - uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void; - useProgram(program: WebGLProgram): void; - validateProgram(program: WebGLProgram): void; + uniform1f(location: WebGLUniformLocation | null, x: number): void; + uniform1fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; + uniform1i(location: WebGLUniformLocation | null, x: number): void; + uniform1iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; + uniform2f(location: WebGLUniformLocation | null, x: number, y: number): void; + uniform2fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; + uniform2i(location: WebGLUniformLocation | null, x: number, y: number): void; + uniform2iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; + uniform3f(location: WebGLUniformLocation | null, x: number, y: number, z: number): void; + uniform3fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; + uniform3i(location: WebGLUniformLocation | null, x: number, y: number, z: number): void; + uniform3iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; + uniform4f(location: WebGLUniformLocation | null, x: number, y: number, z: number, w: number): void; + uniform4fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; + uniform4i(location: WebGLUniformLocation | null, x: number, y: number, z: number, w: number): void; + uniform4iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; + uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void; + uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void; + uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void; + useProgram(program: WebGLProgram | null): void; + validateProgram(program: WebGLProgram | null): void; vertexAttrib1f(indx: number, x: number): void; - vertexAttrib1fv(indx: number, values: Float32Array): void; + vertexAttrib1fv(indx: number, values: Float32Array | number[]): void; vertexAttrib2f(indx: number, x: number, y: number): void; - vertexAttrib2fv(indx: number, values: Float32Array): void; + vertexAttrib2fv(indx: number, values: Float32Array | number[]): void; vertexAttrib3f(indx: number, x: number, y: number, z: number): void; - vertexAttrib3fv(indx: number, values: Float32Array): void; + vertexAttrib3fv(indx: number, values: Float32Array | number[]): void; vertexAttrib4f(indx: number, x: number, y: number, z: number, w: number): void; - vertexAttrib4fv(indx: number, values: Float32Array): void; + vertexAttrib4fv(indx: number, values: Float32Array | number[]): void; vertexAttribPointer(indx: number, size: number, type: number, normalized: boolean, stride: number, offset: number): void; viewport(x: number, y: number, width: number, height: number): void; - ACTIVE_ATTRIBUTES: number; - ACTIVE_TEXTURE: number; - ACTIVE_UNIFORMS: number; - ALIASED_LINE_WIDTH_RANGE: number; - ALIASED_POINT_SIZE_RANGE: number; - ALPHA: number; - ALPHA_BITS: number; - ALWAYS: number; - ARRAY_BUFFER: number; - ARRAY_BUFFER_BINDING: number; - ATTACHED_SHADERS: number; - BACK: number; - BLEND: number; - BLEND_COLOR: number; - BLEND_DST_ALPHA: number; - BLEND_DST_RGB: number; - BLEND_EQUATION: number; - BLEND_EQUATION_ALPHA: number; - BLEND_EQUATION_RGB: number; - BLEND_SRC_ALPHA: number; - BLEND_SRC_RGB: number; - BLUE_BITS: number; - BOOL: number; - BOOL_VEC2: number; - BOOL_VEC3: number; - BOOL_VEC4: number; - BROWSER_DEFAULT_WEBGL: number; - BUFFER_SIZE: number; - BUFFER_USAGE: number; - BYTE: number; - CCW: number; - CLAMP_TO_EDGE: number; - COLOR_ATTACHMENT0: number; - COLOR_BUFFER_BIT: number; - COLOR_CLEAR_VALUE: number; - COLOR_WRITEMASK: number; - COMPILE_STATUS: number; - COMPRESSED_TEXTURE_FORMATS: number; - CONSTANT_ALPHA: number; - CONSTANT_COLOR: number; - CONTEXT_LOST_WEBGL: number; - CULL_FACE: number; - CULL_FACE_MODE: number; - CURRENT_PROGRAM: number; - CURRENT_VERTEX_ATTRIB: number; - CW: number; - DECR: number; - DECR_WRAP: number; - DELETE_STATUS: number; - DEPTH_ATTACHMENT: number; - DEPTH_BITS: number; - DEPTH_BUFFER_BIT: number; - DEPTH_CLEAR_VALUE: number; - DEPTH_COMPONENT: number; - DEPTH_COMPONENT16: number; - DEPTH_FUNC: number; - DEPTH_RANGE: number; - DEPTH_STENCIL: number; - DEPTH_STENCIL_ATTACHMENT: number; - DEPTH_TEST: number; - DEPTH_WRITEMASK: number; - DITHER: number; - DONT_CARE: number; - DST_ALPHA: number; - DST_COLOR: number; - DYNAMIC_DRAW: number; - ELEMENT_ARRAY_BUFFER: number; - ELEMENT_ARRAY_BUFFER_BINDING: number; - EQUAL: number; - FASTEST: number; - FLOAT: number; - FLOAT_MAT2: number; - FLOAT_MAT3: number; - FLOAT_MAT4: number; - FLOAT_VEC2: number; - FLOAT_VEC3: number; - FLOAT_VEC4: number; - FRAGMENT_SHADER: number; - FRAMEBUFFER: number; - FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number; - FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number; - FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number; - FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number; - FRAMEBUFFER_BINDING: number; - FRAMEBUFFER_COMPLETE: number; - FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number; - FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number; - FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number; - FRAMEBUFFER_UNSUPPORTED: number; - FRONT: number; - FRONT_AND_BACK: number; - FRONT_FACE: number; - FUNC_ADD: number; - FUNC_REVERSE_SUBTRACT: number; - FUNC_SUBTRACT: number; - GENERATE_MIPMAP_HINT: number; - GEQUAL: number; - GREATER: number; - GREEN_BITS: number; - HIGH_FLOAT: number; - HIGH_INT: number; - IMPLEMENTATION_COLOR_READ_FORMAT: number; - IMPLEMENTATION_COLOR_READ_TYPE: number; - INCR: number; - INCR_WRAP: number; - INT: number; - INT_VEC2: number; - INT_VEC3: number; - INT_VEC4: number; - INVALID_ENUM: number; - INVALID_FRAMEBUFFER_OPERATION: number; - INVALID_OPERATION: number; - INVALID_VALUE: number; - INVERT: number; - KEEP: number; - LEQUAL: number; - LESS: number; - LINEAR: number; - LINEAR_MIPMAP_LINEAR: number; - LINEAR_MIPMAP_NEAREST: number; - LINES: number; - LINE_LOOP: number; - LINE_STRIP: number; - LINE_WIDTH: number; - LINK_STATUS: number; - LOW_FLOAT: number; - LOW_INT: number; - LUMINANCE: number; - LUMINANCE_ALPHA: number; - MAX_COMBINED_TEXTURE_IMAGE_UNITS: number; - MAX_CUBE_MAP_TEXTURE_SIZE: number; - MAX_FRAGMENT_UNIFORM_VECTORS: number; - MAX_RENDERBUFFER_SIZE: number; - MAX_TEXTURE_IMAGE_UNITS: number; - MAX_TEXTURE_SIZE: number; - MAX_VARYING_VECTORS: number; - MAX_VERTEX_ATTRIBS: number; - MAX_VERTEX_TEXTURE_IMAGE_UNITS: number; - MAX_VERTEX_UNIFORM_VECTORS: number; - MAX_VIEWPORT_DIMS: number; - MEDIUM_FLOAT: number; - MEDIUM_INT: number; - MIRRORED_REPEAT: number; - NEAREST: number; - NEAREST_MIPMAP_LINEAR: number; - NEAREST_MIPMAP_NEAREST: number; - NEVER: number; - NICEST: number; - NONE: number; - NOTEQUAL: number; - NO_ERROR: number; - ONE: number; - ONE_MINUS_CONSTANT_ALPHA: number; - ONE_MINUS_CONSTANT_COLOR: number; - ONE_MINUS_DST_ALPHA: number; - ONE_MINUS_DST_COLOR: number; - ONE_MINUS_SRC_ALPHA: number; - ONE_MINUS_SRC_COLOR: number; - OUT_OF_MEMORY: number; - PACK_ALIGNMENT: number; - POINTS: number; - POLYGON_OFFSET_FACTOR: number; - POLYGON_OFFSET_FILL: number; - POLYGON_OFFSET_UNITS: number; - RED_BITS: number; - RENDERBUFFER: number; - RENDERBUFFER_ALPHA_SIZE: number; - RENDERBUFFER_BINDING: number; - RENDERBUFFER_BLUE_SIZE: number; - RENDERBUFFER_DEPTH_SIZE: number; - RENDERBUFFER_GREEN_SIZE: number; - RENDERBUFFER_HEIGHT: number; - RENDERBUFFER_INTERNAL_FORMAT: number; - RENDERBUFFER_RED_SIZE: number; - RENDERBUFFER_STENCIL_SIZE: number; - RENDERBUFFER_WIDTH: number; - RENDERER: number; - REPEAT: number; - REPLACE: number; - RGB: number; - RGB565: number; - RGB5_A1: number; - RGBA: number; - RGBA4: number; - SAMPLER_2D: number; - SAMPLER_CUBE: number; - SAMPLES: number; - SAMPLE_ALPHA_TO_COVERAGE: number; - SAMPLE_BUFFERS: number; - SAMPLE_COVERAGE: number; - SAMPLE_COVERAGE_INVERT: number; - SAMPLE_COVERAGE_VALUE: number; - SCISSOR_BOX: number; - SCISSOR_TEST: number; - SHADER_TYPE: number; - SHADING_LANGUAGE_VERSION: number; - SHORT: number; - SRC_ALPHA: number; - SRC_ALPHA_SATURATE: number; - SRC_COLOR: number; - STATIC_DRAW: number; - STENCIL_ATTACHMENT: number; - STENCIL_BACK_FAIL: number; - STENCIL_BACK_FUNC: number; - STENCIL_BACK_PASS_DEPTH_FAIL: number; - STENCIL_BACK_PASS_DEPTH_PASS: number; - STENCIL_BACK_REF: number; - STENCIL_BACK_VALUE_MASK: number; - STENCIL_BACK_WRITEMASK: number; - STENCIL_BITS: number; - STENCIL_BUFFER_BIT: number; - STENCIL_CLEAR_VALUE: number; - STENCIL_FAIL: number; - STENCIL_FUNC: number; - STENCIL_INDEX: number; - STENCIL_INDEX8: number; - STENCIL_PASS_DEPTH_FAIL: number; - STENCIL_PASS_DEPTH_PASS: number; - STENCIL_REF: number; - STENCIL_TEST: number; - STENCIL_VALUE_MASK: number; - STENCIL_WRITEMASK: number; - STREAM_DRAW: number; - SUBPIXEL_BITS: number; - TEXTURE: number; - TEXTURE0: number; - TEXTURE1: number; - TEXTURE10: number; - TEXTURE11: number; - TEXTURE12: number; - TEXTURE13: number; - TEXTURE14: number; - TEXTURE15: number; - TEXTURE16: number; - TEXTURE17: number; - TEXTURE18: number; - TEXTURE19: number; - TEXTURE2: number; - TEXTURE20: number; - TEXTURE21: number; - TEXTURE22: number; - TEXTURE23: number; - TEXTURE24: number; - TEXTURE25: number; - TEXTURE26: number; - TEXTURE27: number; - TEXTURE28: number; - TEXTURE29: number; - TEXTURE3: number; - TEXTURE30: number; - TEXTURE31: number; - TEXTURE4: number; - TEXTURE5: number; - TEXTURE6: number; - TEXTURE7: number; - TEXTURE8: number; - TEXTURE9: number; - TEXTURE_2D: number; - TEXTURE_BINDING_2D: number; - TEXTURE_BINDING_CUBE_MAP: number; - TEXTURE_CUBE_MAP: number; - TEXTURE_CUBE_MAP_NEGATIVE_X: number; - TEXTURE_CUBE_MAP_NEGATIVE_Y: number; - TEXTURE_CUBE_MAP_NEGATIVE_Z: number; - TEXTURE_CUBE_MAP_POSITIVE_X: number; - TEXTURE_CUBE_MAP_POSITIVE_Y: number; - TEXTURE_CUBE_MAP_POSITIVE_Z: number; - TEXTURE_MAG_FILTER: number; - TEXTURE_MIN_FILTER: number; - TEXTURE_WRAP_S: number; - TEXTURE_WRAP_T: number; - TRIANGLES: number; - TRIANGLE_FAN: number; - TRIANGLE_STRIP: number; - UNPACK_ALIGNMENT: number; - UNPACK_COLORSPACE_CONVERSION_WEBGL: number; - UNPACK_FLIP_Y_WEBGL: number; - UNPACK_PREMULTIPLY_ALPHA_WEBGL: number; - UNSIGNED_BYTE: number; - UNSIGNED_INT: number; - UNSIGNED_SHORT: number; - UNSIGNED_SHORT_4_4_4_4: number; - UNSIGNED_SHORT_5_5_5_1: number; - UNSIGNED_SHORT_5_6_5: number; - VALIDATE_STATUS: number; - VENDOR: number; - VERSION: number; - VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number; - VERTEX_ATTRIB_ARRAY_ENABLED: number; - VERTEX_ATTRIB_ARRAY_NORMALIZED: number; - VERTEX_ATTRIB_ARRAY_POINTER: number; - VERTEX_ATTRIB_ARRAY_SIZE: number; - VERTEX_ATTRIB_ARRAY_STRIDE: number; - VERTEX_ATTRIB_ARRAY_TYPE: number; - VERTEX_SHADER: number; - VIEWPORT: number; - ZERO: number; + readonly ACTIVE_ATTRIBUTES: number; + readonly ACTIVE_TEXTURE: number; + readonly ACTIVE_UNIFORMS: number; + readonly ALIASED_LINE_WIDTH_RANGE: number; + readonly ALIASED_POINT_SIZE_RANGE: number; + readonly ALPHA: number; + readonly ALPHA_BITS: number; + readonly ALWAYS: number; + readonly ARRAY_BUFFER: number; + readonly ARRAY_BUFFER_BINDING: number; + readonly ATTACHED_SHADERS: number; + readonly BACK: number; + readonly BLEND: number; + readonly BLEND_COLOR: number; + readonly BLEND_DST_ALPHA: number; + readonly BLEND_DST_RGB: number; + readonly BLEND_EQUATION: number; + readonly BLEND_EQUATION_ALPHA: number; + readonly BLEND_EQUATION_RGB: number; + readonly BLEND_SRC_ALPHA: number; + readonly BLEND_SRC_RGB: number; + readonly BLUE_BITS: number; + readonly BOOL: number; + readonly BOOL_VEC2: number; + readonly BOOL_VEC3: number; + readonly BOOL_VEC4: number; + readonly BROWSER_DEFAULT_WEBGL: number; + readonly BUFFER_SIZE: number; + readonly BUFFER_USAGE: number; + readonly BYTE: number; + readonly CCW: number; + readonly CLAMP_TO_EDGE: number; + readonly COLOR_ATTACHMENT0: number; + readonly COLOR_BUFFER_BIT: number; + readonly COLOR_CLEAR_VALUE: number; + readonly COLOR_WRITEMASK: number; + readonly COMPILE_STATUS: number; + readonly COMPRESSED_TEXTURE_FORMATS: number; + readonly CONSTANT_ALPHA: number; + readonly CONSTANT_COLOR: number; + readonly CONTEXT_LOST_WEBGL: number; + readonly CULL_FACE: number; + readonly CULL_FACE_MODE: number; + readonly CURRENT_PROGRAM: number; + readonly CURRENT_VERTEX_ATTRIB: number; + readonly CW: number; + readonly DECR: number; + readonly DECR_WRAP: number; + readonly DELETE_STATUS: number; + readonly DEPTH_ATTACHMENT: number; + readonly DEPTH_BITS: number; + readonly DEPTH_BUFFER_BIT: number; + readonly DEPTH_CLEAR_VALUE: number; + readonly DEPTH_COMPONENT: number; + readonly DEPTH_COMPONENT16: number; + readonly DEPTH_FUNC: number; + readonly DEPTH_RANGE: number; + readonly DEPTH_STENCIL: number; + readonly DEPTH_STENCIL_ATTACHMENT: number; + readonly DEPTH_TEST: number; + readonly DEPTH_WRITEMASK: number; + readonly DITHER: number; + readonly DONT_CARE: number; + readonly DST_ALPHA: number; + readonly DST_COLOR: number; + readonly DYNAMIC_DRAW: number; + readonly ELEMENT_ARRAY_BUFFER: number; + readonly ELEMENT_ARRAY_BUFFER_BINDING: number; + readonly EQUAL: number; + readonly FASTEST: number; + readonly FLOAT: number; + readonly FLOAT_MAT2: number; + readonly FLOAT_MAT3: number; + readonly FLOAT_MAT4: number; + readonly FLOAT_VEC2: number; + readonly FLOAT_VEC3: number; + readonly FLOAT_VEC4: number; + readonly FRAGMENT_SHADER: number; + readonly FRAMEBUFFER: number; + readonly FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number; + readonly FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number; + readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number; + readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number; + readonly FRAMEBUFFER_BINDING: number; + readonly FRAMEBUFFER_COMPLETE: number; + readonly FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number; + readonly FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number; + readonly FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number; + readonly FRAMEBUFFER_UNSUPPORTED: number; + readonly FRONT: number; + readonly FRONT_AND_BACK: number; + readonly FRONT_FACE: number; + readonly FUNC_ADD: number; + readonly FUNC_REVERSE_SUBTRACT: number; + readonly FUNC_SUBTRACT: number; + readonly GENERATE_MIPMAP_HINT: number; + readonly GEQUAL: number; + readonly GREATER: number; + readonly GREEN_BITS: number; + readonly HIGH_FLOAT: number; + readonly HIGH_INT: number; + readonly IMPLEMENTATION_COLOR_READ_FORMAT: number; + readonly IMPLEMENTATION_COLOR_READ_TYPE: number; + readonly INCR: number; + readonly INCR_WRAP: number; + readonly INT: number; + readonly INT_VEC2: number; + readonly INT_VEC3: number; + readonly INT_VEC4: number; + readonly INVALID_ENUM: number; + readonly INVALID_FRAMEBUFFER_OPERATION: number; + readonly INVALID_OPERATION: number; + readonly INVALID_VALUE: number; + readonly INVERT: number; + readonly KEEP: number; + readonly LEQUAL: number; + readonly LESS: number; + readonly LINEAR: number; + readonly LINEAR_MIPMAP_LINEAR: number; + readonly LINEAR_MIPMAP_NEAREST: number; + readonly LINES: number; + readonly LINE_LOOP: number; + readonly LINE_STRIP: number; + readonly LINE_WIDTH: number; + readonly LINK_STATUS: number; + readonly LOW_FLOAT: number; + readonly LOW_INT: number; + readonly LUMINANCE: number; + readonly LUMINANCE_ALPHA: number; + readonly MAX_COMBINED_TEXTURE_IMAGE_UNITS: number; + readonly MAX_CUBE_MAP_TEXTURE_SIZE: number; + readonly MAX_FRAGMENT_UNIFORM_VECTORS: number; + readonly MAX_RENDERBUFFER_SIZE: number; + readonly MAX_TEXTURE_IMAGE_UNITS: number; + readonly MAX_TEXTURE_SIZE: number; + readonly MAX_VARYING_VECTORS: number; + readonly MAX_VERTEX_ATTRIBS: number; + readonly MAX_VERTEX_TEXTURE_IMAGE_UNITS: number; + readonly MAX_VERTEX_UNIFORM_VECTORS: number; + readonly MAX_VIEWPORT_DIMS: number; + readonly MEDIUM_FLOAT: number; + readonly MEDIUM_INT: number; + readonly MIRRORED_REPEAT: number; + readonly NEAREST: number; + readonly NEAREST_MIPMAP_LINEAR: number; + readonly NEAREST_MIPMAP_NEAREST: number; + readonly NEVER: number; + readonly NICEST: number; + readonly NONE: number; + readonly NOTEQUAL: number; + readonly NO_ERROR: number; + readonly ONE: number; + readonly ONE_MINUS_CONSTANT_ALPHA: number; + readonly ONE_MINUS_CONSTANT_COLOR: number; + readonly ONE_MINUS_DST_ALPHA: number; + readonly ONE_MINUS_DST_COLOR: number; + readonly ONE_MINUS_SRC_ALPHA: number; + readonly ONE_MINUS_SRC_COLOR: number; + readonly OUT_OF_MEMORY: number; + readonly PACK_ALIGNMENT: number; + readonly POINTS: number; + readonly POLYGON_OFFSET_FACTOR: number; + readonly POLYGON_OFFSET_FILL: number; + readonly POLYGON_OFFSET_UNITS: number; + readonly RED_BITS: number; + readonly RENDERBUFFER: number; + readonly RENDERBUFFER_ALPHA_SIZE: number; + readonly RENDERBUFFER_BINDING: number; + readonly RENDERBUFFER_BLUE_SIZE: number; + readonly RENDERBUFFER_DEPTH_SIZE: number; + readonly RENDERBUFFER_GREEN_SIZE: number; + readonly RENDERBUFFER_HEIGHT: number; + readonly RENDERBUFFER_INTERNAL_FORMAT: number; + readonly RENDERBUFFER_RED_SIZE: number; + readonly RENDERBUFFER_STENCIL_SIZE: number; + readonly RENDERBUFFER_WIDTH: number; + readonly RENDERER: number; + readonly REPEAT: number; + readonly REPLACE: number; + readonly RGB: number; + readonly RGB565: number; + readonly RGB5_A1: number; + readonly RGBA: number; + readonly RGBA4: number; + readonly SAMPLER_2D: number; + readonly SAMPLER_CUBE: number; + readonly SAMPLES: number; + readonly SAMPLE_ALPHA_TO_COVERAGE: number; + readonly SAMPLE_BUFFERS: number; + readonly SAMPLE_COVERAGE: number; + readonly SAMPLE_COVERAGE_INVERT: number; + readonly SAMPLE_COVERAGE_VALUE: number; + readonly SCISSOR_BOX: number; + readonly SCISSOR_TEST: number; + readonly SHADER_TYPE: number; + readonly SHADING_LANGUAGE_VERSION: number; + readonly SHORT: number; + readonly SRC_ALPHA: number; + readonly SRC_ALPHA_SATURATE: number; + readonly SRC_COLOR: number; + readonly STATIC_DRAW: number; + readonly STENCIL_ATTACHMENT: number; + readonly STENCIL_BACK_FAIL: number; + readonly STENCIL_BACK_FUNC: number; + readonly STENCIL_BACK_PASS_DEPTH_FAIL: number; + readonly STENCIL_BACK_PASS_DEPTH_PASS: number; + readonly STENCIL_BACK_REF: number; + readonly STENCIL_BACK_VALUE_MASK: number; + readonly STENCIL_BACK_WRITEMASK: number; + readonly STENCIL_BITS: number; + readonly STENCIL_BUFFER_BIT: number; + readonly STENCIL_CLEAR_VALUE: number; + readonly STENCIL_FAIL: number; + readonly STENCIL_FUNC: number; + readonly STENCIL_INDEX: number; + readonly STENCIL_INDEX8: number; + readonly STENCIL_PASS_DEPTH_FAIL: number; + readonly STENCIL_PASS_DEPTH_PASS: number; + readonly STENCIL_REF: number; + readonly STENCIL_TEST: number; + readonly STENCIL_VALUE_MASK: number; + readonly STENCIL_WRITEMASK: number; + readonly STREAM_DRAW: number; + readonly SUBPIXEL_BITS: number; + readonly TEXTURE: number; + readonly TEXTURE0: number; + readonly TEXTURE1: number; + readonly TEXTURE10: number; + readonly TEXTURE11: number; + readonly TEXTURE12: number; + readonly TEXTURE13: number; + readonly TEXTURE14: number; + readonly TEXTURE15: number; + readonly TEXTURE16: number; + readonly TEXTURE17: number; + readonly TEXTURE18: number; + readonly TEXTURE19: number; + readonly TEXTURE2: number; + readonly TEXTURE20: number; + readonly TEXTURE21: number; + readonly TEXTURE22: number; + readonly TEXTURE23: number; + readonly TEXTURE24: number; + readonly TEXTURE25: number; + readonly TEXTURE26: number; + readonly TEXTURE27: number; + readonly TEXTURE28: number; + readonly TEXTURE29: number; + readonly TEXTURE3: number; + readonly TEXTURE30: number; + readonly TEXTURE31: number; + readonly TEXTURE4: number; + readonly TEXTURE5: number; + readonly TEXTURE6: number; + readonly TEXTURE7: number; + readonly TEXTURE8: number; + readonly TEXTURE9: number; + readonly TEXTURE_2D: number; + readonly TEXTURE_BINDING_2D: number; + readonly TEXTURE_BINDING_CUBE_MAP: number; + readonly TEXTURE_CUBE_MAP: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_X: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_Y: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_Z: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_X: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_Y: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_Z: number; + readonly TEXTURE_MAG_FILTER: number; + readonly TEXTURE_MIN_FILTER: number; + readonly TEXTURE_WRAP_S: number; + readonly TEXTURE_WRAP_T: number; + readonly TRIANGLES: number; + readonly TRIANGLE_FAN: number; + readonly TRIANGLE_STRIP: number; + readonly UNPACK_ALIGNMENT: number; + readonly UNPACK_COLORSPACE_CONVERSION_WEBGL: number; + readonly UNPACK_FLIP_Y_WEBGL: number; + readonly UNPACK_PREMULTIPLY_ALPHA_WEBGL: number; + readonly UNSIGNED_BYTE: number; + readonly UNSIGNED_INT: number; + readonly UNSIGNED_SHORT: number; + readonly UNSIGNED_SHORT_4_4_4_4: number; + readonly UNSIGNED_SHORT_5_5_5_1: number; + readonly UNSIGNED_SHORT_5_6_5: number; + readonly VALIDATE_STATUS: number; + readonly VENDOR: number; + readonly VERSION: number; + readonly VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number; + readonly VERTEX_ATTRIB_ARRAY_ENABLED: number; + readonly VERTEX_ATTRIB_ARRAY_NORMALIZED: number; + readonly VERTEX_ATTRIB_ARRAY_POINTER: number; + readonly VERTEX_ATTRIB_ARRAY_SIZE: number; + readonly VERTEX_ATTRIB_ARRAY_STRIDE: number; + readonly VERTEX_ATTRIB_ARRAY_TYPE: number; + readonly VERTEX_SHADER: number; + readonly VIEWPORT: number; + readonly ZERO: number; } declare var WebGLRenderingContext: { prototype: WebGLRenderingContext; new(): WebGLRenderingContext; - ACTIVE_ATTRIBUTES: number; - ACTIVE_TEXTURE: number; - ACTIVE_UNIFORMS: number; - ALIASED_LINE_WIDTH_RANGE: number; - ALIASED_POINT_SIZE_RANGE: number; - ALPHA: number; - ALPHA_BITS: number; - ALWAYS: number; - ARRAY_BUFFER: number; - ARRAY_BUFFER_BINDING: number; - ATTACHED_SHADERS: number; - BACK: number; - BLEND: number; - BLEND_COLOR: number; - BLEND_DST_ALPHA: number; - BLEND_DST_RGB: number; - BLEND_EQUATION: number; - BLEND_EQUATION_ALPHA: number; - BLEND_EQUATION_RGB: number; - BLEND_SRC_ALPHA: number; - BLEND_SRC_RGB: number; - BLUE_BITS: number; - BOOL: number; - BOOL_VEC2: number; - BOOL_VEC3: number; - BOOL_VEC4: number; - BROWSER_DEFAULT_WEBGL: number; - BUFFER_SIZE: number; - BUFFER_USAGE: number; - BYTE: number; - CCW: number; - CLAMP_TO_EDGE: number; - COLOR_ATTACHMENT0: number; - COLOR_BUFFER_BIT: number; - COLOR_CLEAR_VALUE: number; - COLOR_WRITEMASK: number; - COMPILE_STATUS: number; - COMPRESSED_TEXTURE_FORMATS: number; - CONSTANT_ALPHA: number; - CONSTANT_COLOR: number; - CONTEXT_LOST_WEBGL: number; - CULL_FACE: number; - CULL_FACE_MODE: number; - CURRENT_PROGRAM: number; - CURRENT_VERTEX_ATTRIB: number; - CW: number; - DECR: number; - DECR_WRAP: number; - DELETE_STATUS: number; - DEPTH_ATTACHMENT: number; - DEPTH_BITS: number; - DEPTH_BUFFER_BIT: number; - DEPTH_CLEAR_VALUE: number; - DEPTH_COMPONENT: number; - DEPTH_COMPONENT16: number; - DEPTH_FUNC: number; - DEPTH_RANGE: number; - DEPTH_STENCIL: number; - DEPTH_STENCIL_ATTACHMENT: number; - DEPTH_TEST: number; - DEPTH_WRITEMASK: number; - DITHER: number; - DONT_CARE: number; - DST_ALPHA: number; - DST_COLOR: number; - DYNAMIC_DRAW: number; - ELEMENT_ARRAY_BUFFER: number; - ELEMENT_ARRAY_BUFFER_BINDING: number; - EQUAL: number; - FASTEST: number; - FLOAT: number; - FLOAT_MAT2: number; - FLOAT_MAT3: number; - FLOAT_MAT4: number; - FLOAT_VEC2: number; - FLOAT_VEC3: number; - FLOAT_VEC4: number; - FRAGMENT_SHADER: number; - FRAMEBUFFER: number; - FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number; - FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number; - FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number; - FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number; - FRAMEBUFFER_BINDING: number; - FRAMEBUFFER_COMPLETE: number; - FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number; - FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number; - FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number; - FRAMEBUFFER_UNSUPPORTED: number; - FRONT: number; - FRONT_AND_BACK: number; - FRONT_FACE: number; - FUNC_ADD: number; - FUNC_REVERSE_SUBTRACT: number; - FUNC_SUBTRACT: number; - GENERATE_MIPMAP_HINT: number; - GEQUAL: number; - GREATER: number; - GREEN_BITS: number; - HIGH_FLOAT: number; - HIGH_INT: number; - IMPLEMENTATION_COLOR_READ_FORMAT: number; - IMPLEMENTATION_COLOR_READ_TYPE: number; - INCR: number; - INCR_WRAP: number; - INT: number; - INT_VEC2: number; - INT_VEC3: number; - INT_VEC4: number; - INVALID_ENUM: number; - INVALID_FRAMEBUFFER_OPERATION: number; - INVALID_OPERATION: number; - INVALID_VALUE: number; - INVERT: number; - KEEP: number; - LEQUAL: number; - LESS: number; - LINEAR: number; - LINEAR_MIPMAP_LINEAR: number; - LINEAR_MIPMAP_NEAREST: number; - LINES: number; - LINE_LOOP: number; - LINE_STRIP: number; - LINE_WIDTH: number; - LINK_STATUS: number; - LOW_FLOAT: number; - LOW_INT: number; - LUMINANCE: number; - LUMINANCE_ALPHA: number; - MAX_COMBINED_TEXTURE_IMAGE_UNITS: number; - MAX_CUBE_MAP_TEXTURE_SIZE: number; - MAX_FRAGMENT_UNIFORM_VECTORS: number; - MAX_RENDERBUFFER_SIZE: number; - MAX_TEXTURE_IMAGE_UNITS: number; - MAX_TEXTURE_SIZE: number; - MAX_VARYING_VECTORS: number; - MAX_VERTEX_ATTRIBS: number; - MAX_VERTEX_TEXTURE_IMAGE_UNITS: number; - MAX_VERTEX_UNIFORM_VECTORS: number; - MAX_VIEWPORT_DIMS: number; - MEDIUM_FLOAT: number; - MEDIUM_INT: number; - MIRRORED_REPEAT: number; - NEAREST: number; - NEAREST_MIPMAP_LINEAR: number; - NEAREST_MIPMAP_NEAREST: number; - NEVER: number; - NICEST: number; - NONE: number; - NOTEQUAL: number; - NO_ERROR: number; - ONE: number; - ONE_MINUS_CONSTANT_ALPHA: number; - ONE_MINUS_CONSTANT_COLOR: number; - ONE_MINUS_DST_ALPHA: number; - ONE_MINUS_DST_COLOR: number; - ONE_MINUS_SRC_ALPHA: number; - ONE_MINUS_SRC_COLOR: number; - OUT_OF_MEMORY: number; - PACK_ALIGNMENT: number; - POINTS: number; - POLYGON_OFFSET_FACTOR: number; - POLYGON_OFFSET_FILL: number; - POLYGON_OFFSET_UNITS: number; - RED_BITS: number; - RENDERBUFFER: number; - RENDERBUFFER_ALPHA_SIZE: number; - RENDERBUFFER_BINDING: number; - RENDERBUFFER_BLUE_SIZE: number; - RENDERBUFFER_DEPTH_SIZE: number; - RENDERBUFFER_GREEN_SIZE: number; - RENDERBUFFER_HEIGHT: number; - RENDERBUFFER_INTERNAL_FORMAT: number; - RENDERBUFFER_RED_SIZE: number; - RENDERBUFFER_STENCIL_SIZE: number; - RENDERBUFFER_WIDTH: number; - RENDERER: number; - REPEAT: number; - REPLACE: number; - RGB: number; - RGB565: number; - RGB5_A1: number; - RGBA: number; - RGBA4: number; - SAMPLER_2D: number; - SAMPLER_CUBE: number; - SAMPLES: number; - SAMPLE_ALPHA_TO_COVERAGE: number; - SAMPLE_BUFFERS: number; - SAMPLE_COVERAGE: number; - SAMPLE_COVERAGE_INVERT: number; - SAMPLE_COVERAGE_VALUE: number; - SCISSOR_BOX: number; - SCISSOR_TEST: number; - SHADER_TYPE: number; - SHADING_LANGUAGE_VERSION: number; - SHORT: number; - SRC_ALPHA: number; - SRC_ALPHA_SATURATE: number; - SRC_COLOR: number; - STATIC_DRAW: number; - STENCIL_ATTACHMENT: number; - STENCIL_BACK_FAIL: number; - STENCIL_BACK_FUNC: number; - STENCIL_BACK_PASS_DEPTH_FAIL: number; - STENCIL_BACK_PASS_DEPTH_PASS: number; - STENCIL_BACK_REF: number; - STENCIL_BACK_VALUE_MASK: number; - STENCIL_BACK_WRITEMASK: number; - STENCIL_BITS: number; - STENCIL_BUFFER_BIT: number; - STENCIL_CLEAR_VALUE: number; - STENCIL_FAIL: number; - STENCIL_FUNC: number; - STENCIL_INDEX: number; - STENCIL_INDEX8: number; - STENCIL_PASS_DEPTH_FAIL: number; - STENCIL_PASS_DEPTH_PASS: number; - STENCIL_REF: number; - STENCIL_TEST: number; - STENCIL_VALUE_MASK: number; - STENCIL_WRITEMASK: number; - STREAM_DRAW: number; - SUBPIXEL_BITS: number; - TEXTURE: number; - TEXTURE0: number; - TEXTURE1: number; - TEXTURE10: number; - TEXTURE11: number; - TEXTURE12: number; - TEXTURE13: number; - TEXTURE14: number; - TEXTURE15: number; - TEXTURE16: number; - TEXTURE17: number; - TEXTURE18: number; - TEXTURE19: number; - TEXTURE2: number; - TEXTURE20: number; - TEXTURE21: number; - TEXTURE22: number; - TEXTURE23: number; - TEXTURE24: number; - TEXTURE25: number; - TEXTURE26: number; - TEXTURE27: number; - TEXTURE28: number; - TEXTURE29: number; - TEXTURE3: number; - TEXTURE30: number; - TEXTURE31: number; - TEXTURE4: number; - TEXTURE5: number; - TEXTURE6: number; - TEXTURE7: number; - TEXTURE8: number; - TEXTURE9: number; - TEXTURE_2D: number; - TEXTURE_BINDING_2D: number; - TEXTURE_BINDING_CUBE_MAP: number; - TEXTURE_CUBE_MAP: number; - TEXTURE_CUBE_MAP_NEGATIVE_X: number; - TEXTURE_CUBE_MAP_NEGATIVE_Y: number; - TEXTURE_CUBE_MAP_NEGATIVE_Z: number; - TEXTURE_CUBE_MAP_POSITIVE_X: number; - TEXTURE_CUBE_MAP_POSITIVE_Y: number; - TEXTURE_CUBE_MAP_POSITIVE_Z: number; - TEXTURE_MAG_FILTER: number; - TEXTURE_MIN_FILTER: number; - TEXTURE_WRAP_S: number; - TEXTURE_WRAP_T: number; - TRIANGLES: number; - TRIANGLE_FAN: number; - TRIANGLE_STRIP: number; - UNPACK_ALIGNMENT: number; - UNPACK_COLORSPACE_CONVERSION_WEBGL: number; - UNPACK_FLIP_Y_WEBGL: number; - UNPACK_PREMULTIPLY_ALPHA_WEBGL: number; - UNSIGNED_BYTE: number; - UNSIGNED_INT: number; - UNSIGNED_SHORT: number; - UNSIGNED_SHORT_4_4_4_4: number; - UNSIGNED_SHORT_5_5_5_1: number; - UNSIGNED_SHORT_5_6_5: number; - VALIDATE_STATUS: number; - VENDOR: number; - VERSION: number; - VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number; - VERTEX_ATTRIB_ARRAY_ENABLED: number; - VERTEX_ATTRIB_ARRAY_NORMALIZED: number; - VERTEX_ATTRIB_ARRAY_POINTER: number; - VERTEX_ATTRIB_ARRAY_SIZE: number; - VERTEX_ATTRIB_ARRAY_STRIDE: number; - VERTEX_ATTRIB_ARRAY_TYPE: number; - VERTEX_SHADER: number; - VIEWPORT: number; - ZERO: number; + readonly ACTIVE_ATTRIBUTES: number; + readonly ACTIVE_TEXTURE: number; + readonly ACTIVE_UNIFORMS: number; + readonly ALIASED_LINE_WIDTH_RANGE: number; + readonly ALIASED_POINT_SIZE_RANGE: number; + readonly ALPHA: number; + readonly ALPHA_BITS: number; + readonly ALWAYS: number; + readonly ARRAY_BUFFER: number; + readonly ARRAY_BUFFER_BINDING: number; + readonly ATTACHED_SHADERS: number; + readonly BACK: number; + readonly BLEND: number; + readonly BLEND_COLOR: number; + readonly BLEND_DST_ALPHA: number; + readonly BLEND_DST_RGB: number; + readonly BLEND_EQUATION: number; + readonly BLEND_EQUATION_ALPHA: number; + readonly BLEND_EQUATION_RGB: number; + readonly BLEND_SRC_ALPHA: number; + readonly BLEND_SRC_RGB: number; + readonly BLUE_BITS: number; + readonly BOOL: number; + readonly BOOL_VEC2: number; + readonly BOOL_VEC3: number; + readonly BOOL_VEC4: number; + readonly BROWSER_DEFAULT_WEBGL: number; + readonly BUFFER_SIZE: number; + readonly BUFFER_USAGE: number; + readonly BYTE: number; + readonly CCW: number; + readonly CLAMP_TO_EDGE: number; + readonly COLOR_ATTACHMENT0: number; + readonly COLOR_BUFFER_BIT: number; + readonly COLOR_CLEAR_VALUE: number; + readonly COLOR_WRITEMASK: number; + readonly COMPILE_STATUS: number; + readonly COMPRESSED_TEXTURE_FORMATS: number; + readonly CONSTANT_ALPHA: number; + readonly CONSTANT_COLOR: number; + readonly CONTEXT_LOST_WEBGL: number; + readonly CULL_FACE: number; + readonly CULL_FACE_MODE: number; + readonly CURRENT_PROGRAM: number; + readonly CURRENT_VERTEX_ATTRIB: number; + readonly CW: number; + readonly DECR: number; + readonly DECR_WRAP: number; + readonly DELETE_STATUS: number; + readonly DEPTH_ATTACHMENT: number; + readonly DEPTH_BITS: number; + readonly DEPTH_BUFFER_BIT: number; + readonly DEPTH_CLEAR_VALUE: number; + readonly DEPTH_COMPONENT: number; + readonly DEPTH_COMPONENT16: number; + readonly DEPTH_FUNC: number; + readonly DEPTH_RANGE: number; + readonly DEPTH_STENCIL: number; + readonly DEPTH_STENCIL_ATTACHMENT: number; + readonly DEPTH_TEST: number; + readonly DEPTH_WRITEMASK: number; + readonly DITHER: number; + readonly DONT_CARE: number; + readonly DST_ALPHA: number; + readonly DST_COLOR: number; + readonly DYNAMIC_DRAW: number; + readonly ELEMENT_ARRAY_BUFFER: number; + readonly ELEMENT_ARRAY_BUFFER_BINDING: number; + readonly EQUAL: number; + readonly FASTEST: number; + readonly FLOAT: number; + readonly FLOAT_MAT2: number; + readonly FLOAT_MAT3: number; + readonly FLOAT_MAT4: number; + readonly FLOAT_VEC2: number; + readonly FLOAT_VEC3: number; + readonly FLOAT_VEC4: number; + readonly FRAGMENT_SHADER: number; + readonly FRAMEBUFFER: number; + readonly FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number; + readonly FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number; + readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number; + readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number; + readonly FRAMEBUFFER_BINDING: number; + readonly FRAMEBUFFER_COMPLETE: number; + readonly FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number; + readonly FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number; + readonly FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number; + readonly FRAMEBUFFER_UNSUPPORTED: number; + readonly FRONT: number; + readonly FRONT_AND_BACK: number; + readonly FRONT_FACE: number; + readonly FUNC_ADD: number; + readonly FUNC_REVERSE_SUBTRACT: number; + readonly FUNC_SUBTRACT: number; + readonly GENERATE_MIPMAP_HINT: number; + readonly GEQUAL: number; + readonly GREATER: number; + readonly GREEN_BITS: number; + readonly HIGH_FLOAT: number; + readonly HIGH_INT: number; + readonly IMPLEMENTATION_COLOR_READ_FORMAT: number; + readonly IMPLEMENTATION_COLOR_READ_TYPE: number; + readonly INCR: number; + readonly INCR_WRAP: number; + readonly INT: number; + readonly INT_VEC2: number; + readonly INT_VEC3: number; + readonly INT_VEC4: number; + readonly INVALID_ENUM: number; + readonly INVALID_FRAMEBUFFER_OPERATION: number; + readonly INVALID_OPERATION: number; + readonly INVALID_VALUE: number; + readonly INVERT: number; + readonly KEEP: number; + readonly LEQUAL: number; + readonly LESS: number; + readonly LINEAR: number; + readonly LINEAR_MIPMAP_LINEAR: number; + readonly LINEAR_MIPMAP_NEAREST: number; + readonly LINES: number; + readonly LINE_LOOP: number; + readonly LINE_STRIP: number; + readonly LINE_WIDTH: number; + readonly LINK_STATUS: number; + readonly LOW_FLOAT: number; + readonly LOW_INT: number; + readonly LUMINANCE: number; + readonly LUMINANCE_ALPHA: number; + readonly MAX_COMBINED_TEXTURE_IMAGE_UNITS: number; + readonly MAX_CUBE_MAP_TEXTURE_SIZE: number; + readonly MAX_FRAGMENT_UNIFORM_VECTORS: number; + readonly MAX_RENDERBUFFER_SIZE: number; + readonly MAX_TEXTURE_IMAGE_UNITS: number; + readonly MAX_TEXTURE_SIZE: number; + readonly MAX_VARYING_VECTORS: number; + readonly MAX_VERTEX_ATTRIBS: number; + readonly MAX_VERTEX_TEXTURE_IMAGE_UNITS: number; + readonly MAX_VERTEX_UNIFORM_VECTORS: number; + readonly MAX_VIEWPORT_DIMS: number; + readonly MEDIUM_FLOAT: number; + readonly MEDIUM_INT: number; + readonly MIRRORED_REPEAT: number; + readonly NEAREST: number; + readonly NEAREST_MIPMAP_LINEAR: number; + readonly NEAREST_MIPMAP_NEAREST: number; + readonly NEVER: number; + readonly NICEST: number; + readonly NONE: number; + readonly NOTEQUAL: number; + readonly NO_ERROR: number; + readonly ONE: number; + readonly ONE_MINUS_CONSTANT_ALPHA: number; + readonly ONE_MINUS_CONSTANT_COLOR: number; + readonly ONE_MINUS_DST_ALPHA: number; + readonly ONE_MINUS_DST_COLOR: number; + readonly ONE_MINUS_SRC_ALPHA: number; + readonly ONE_MINUS_SRC_COLOR: number; + readonly OUT_OF_MEMORY: number; + readonly PACK_ALIGNMENT: number; + readonly POINTS: number; + readonly POLYGON_OFFSET_FACTOR: number; + readonly POLYGON_OFFSET_FILL: number; + readonly POLYGON_OFFSET_UNITS: number; + readonly RED_BITS: number; + readonly RENDERBUFFER: number; + readonly RENDERBUFFER_ALPHA_SIZE: number; + readonly RENDERBUFFER_BINDING: number; + readonly RENDERBUFFER_BLUE_SIZE: number; + readonly RENDERBUFFER_DEPTH_SIZE: number; + readonly RENDERBUFFER_GREEN_SIZE: number; + readonly RENDERBUFFER_HEIGHT: number; + readonly RENDERBUFFER_INTERNAL_FORMAT: number; + readonly RENDERBUFFER_RED_SIZE: number; + readonly RENDERBUFFER_STENCIL_SIZE: number; + readonly RENDERBUFFER_WIDTH: number; + readonly RENDERER: number; + readonly REPEAT: number; + readonly REPLACE: number; + readonly RGB: number; + readonly RGB565: number; + readonly RGB5_A1: number; + readonly RGBA: number; + readonly RGBA4: number; + readonly SAMPLER_2D: number; + readonly SAMPLER_CUBE: number; + readonly SAMPLES: number; + readonly SAMPLE_ALPHA_TO_COVERAGE: number; + readonly SAMPLE_BUFFERS: number; + readonly SAMPLE_COVERAGE: number; + readonly SAMPLE_COVERAGE_INVERT: number; + readonly SAMPLE_COVERAGE_VALUE: number; + readonly SCISSOR_BOX: number; + readonly SCISSOR_TEST: number; + readonly SHADER_TYPE: number; + readonly SHADING_LANGUAGE_VERSION: number; + readonly SHORT: number; + readonly SRC_ALPHA: number; + readonly SRC_ALPHA_SATURATE: number; + readonly SRC_COLOR: number; + readonly STATIC_DRAW: number; + readonly STENCIL_ATTACHMENT: number; + readonly STENCIL_BACK_FAIL: number; + readonly STENCIL_BACK_FUNC: number; + readonly STENCIL_BACK_PASS_DEPTH_FAIL: number; + readonly STENCIL_BACK_PASS_DEPTH_PASS: number; + readonly STENCIL_BACK_REF: number; + readonly STENCIL_BACK_VALUE_MASK: number; + readonly STENCIL_BACK_WRITEMASK: number; + readonly STENCIL_BITS: number; + readonly STENCIL_BUFFER_BIT: number; + readonly STENCIL_CLEAR_VALUE: number; + readonly STENCIL_FAIL: number; + readonly STENCIL_FUNC: number; + readonly STENCIL_INDEX: number; + readonly STENCIL_INDEX8: number; + readonly STENCIL_PASS_DEPTH_FAIL: number; + readonly STENCIL_PASS_DEPTH_PASS: number; + readonly STENCIL_REF: number; + readonly STENCIL_TEST: number; + readonly STENCIL_VALUE_MASK: number; + readonly STENCIL_WRITEMASK: number; + readonly STREAM_DRAW: number; + readonly SUBPIXEL_BITS: number; + readonly TEXTURE: number; + readonly TEXTURE0: number; + readonly TEXTURE1: number; + readonly TEXTURE10: number; + readonly TEXTURE11: number; + readonly TEXTURE12: number; + readonly TEXTURE13: number; + readonly TEXTURE14: number; + readonly TEXTURE15: number; + readonly TEXTURE16: number; + readonly TEXTURE17: number; + readonly TEXTURE18: number; + readonly TEXTURE19: number; + readonly TEXTURE2: number; + readonly TEXTURE20: number; + readonly TEXTURE21: number; + readonly TEXTURE22: number; + readonly TEXTURE23: number; + readonly TEXTURE24: number; + readonly TEXTURE25: number; + readonly TEXTURE26: number; + readonly TEXTURE27: number; + readonly TEXTURE28: number; + readonly TEXTURE29: number; + readonly TEXTURE3: number; + readonly TEXTURE30: number; + readonly TEXTURE31: number; + readonly TEXTURE4: number; + readonly TEXTURE5: number; + readonly TEXTURE6: number; + readonly TEXTURE7: number; + readonly TEXTURE8: number; + readonly TEXTURE9: number; + readonly TEXTURE_2D: number; + readonly TEXTURE_BINDING_2D: number; + readonly TEXTURE_BINDING_CUBE_MAP: number; + readonly TEXTURE_CUBE_MAP: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_X: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_Y: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_Z: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_X: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_Y: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_Z: number; + readonly TEXTURE_MAG_FILTER: number; + readonly TEXTURE_MIN_FILTER: number; + readonly TEXTURE_WRAP_S: number; + readonly TEXTURE_WRAP_T: number; + readonly TRIANGLES: number; + readonly TRIANGLE_FAN: number; + readonly TRIANGLE_STRIP: number; + readonly UNPACK_ALIGNMENT: number; + readonly UNPACK_COLORSPACE_CONVERSION_WEBGL: number; + readonly UNPACK_FLIP_Y_WEBGL: number; + readonly UNPACK_PREMULTIPLY_ALPHA_WEBGL: number; + readonly UNSIGNED_BYTE: number; + readonly UNSIGNED_INT: number; + readonly UNSIGNED_SHORT: number; + readonly UNSIGNED_SHORT_4_4_4_4: number; + readonly UNSIGNED_SHORT_5_5_5_1: number; + readonly UNSIGNED_SHORT_5_6_5: number; + readonly VALIDATE_STATUS: number; + readonly VENDOR: number; + readonly VERSION: number; + readonly VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number; + readonly VERTEX_ATTRIB_ARRAY_ENABLED: number; + readonly VERTEX_ATTRIB_ARRAY_NORMALIZED: number; + readonly VERTEX_ATTRIB_ARRAY_POINTER: number; + readonly VERTEX_ATTRIB_ARRAY_SIZE: number; + readonly VERTEX_ATTRIB_ARRAY_STRIDE: number; + readonly VERTEX_ATTRIB_ARRAY_TYPE: number; + readonly VERTEX_SHADER: number; + readonly VIEWPORT: number; + readonly ZERO: number; } interface WebGLShader extends WebGLObject { @@ -11902,9 +12715,9 @@ declare var WebGLShader: { } interface WebGLShaderPrecisionFormat { - precision: number; - rangeMax: number; - rangeMin: number; + readonly precision: number; + readonly rangeMax: number; + readonly rangeMin: number; } declare var WebGLShaderPrecisionFormat: { @@ -11980,21 +12793,21 @@ declare var WebKitPoint: { interface WebSocket extends EventTarget { binaryType: string; - bufferedAmount: number; - extensions: string; + readonly bufferedAmount: number; + readonly extensions: string; onclose: (ev: CloseEvent) => any; onerror: (ev: Event) => any; onmessage: (ev: MessageEvent) => any; onopen: (ev: Event) => any; - protocol: string; - readyState: number; - url: string; + readonly protocol: string; + readonly readyState: number; + readonly url: string; close(code?: number, reason?: string): void; send(data: any): void; - CLOSED: number; - CLOSING: number; - CONNECTING: number; - OPEN: number; + readonly CLOSED: number; + readonly CLOSING: number; + readonly CONNECTING: number; + readonly OPEN: number; addEventListener(type: "close", listener: (ev: CloseEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "message", listener: (ev: MessageEvent) => any, useCapture?: boolean): void; @@ -12005,56 +12818,58 @@ interface WebSocket extends EventTarget { declare var WebSocket: { prototype: WebSocket; new(url: string, protocols?: string | string[]): WebSocket; - CLOSED: number; - CLOSING: number; - CONNECTING: number; - OPEN: number; + readonly CLOSED: number; + readonly CLOSING: number; + readonly CONNECTING: number; + readonly OPEN: number; } interface WheelEvent extends MouseEvent { - deltaMode: number; - deltaX: number; - deltaY: number; - deltaZ: number; + readonly deltaMode: number; + readonly deltaX: number; + readonly deltaY: number; + readonly deltaZ: number; + readonly wheelDelta: number; + readonly wheelDeltaX: number; + readonly wheelDeltaY: number; getCurrentPoint(element: Element): void; initWheelEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, buttonArg: number, relatedTargetArg: EventTarget, modifiersListArg: string, deltaXArg: number, deltaYArg: number, deltaZArg: number, deltaMode: number): void; - DOM_DELTA_LINE: number; - DOM_DELTA_PAGE: number; - DOM_DELTA_PIXEL: number; + readonly DOM_DELTA_LINE: number; + readonly DOM_DELTA_PAGE: number; + readonly DOM_DELTA_PIXEL: number; } declare var WheelEvent: { prototype: WheelEvent; new(typeArg: string, eventInitDict?: WheelEventInit): WheelEvent; - DOM_DELTA_LINE: number; - DOM_DELTA_PAGE: number; - DOM_DELTA_PIXEL: number; + readonly DOM_DELTA_LINE: number; + readonly DOM_DELTA_PAGE: number; + readonly DOM_DELTA_PIXEL: number; } interface Window extends EventTarget, WindowTimers, WindowSessionStorage, WindowLocalStorage, WindowConsole, GlobalEventHandlers, IDBEnvironment, WindowBase64 { - animationStartTime: number; - applicationCache: ApplicationCache; - clientInformation: Navigator; - closed: boolean; - crypto: Crypto; + readonly applicationCache: ApplicationCache; + readonly clientInformation: Navigator; + readonly closed: boolean; + readonly crypto: Crypto; defaultStatus: string; - devicePixelRatio: number; - doNotTrack: string; - document: Document; + readonly devicePixelRatio: number; + readonly doNotTrack: string; + readonly document: Document; event: Event; - external: External; - frameElement: Element; - frames: Window; - history: History; - innerHeight: number; - innerWidth: number; - length: number; - location: Location; - locationbar: BarProp; - menubar: BarProp; - msAnimationStartTime: number; + readonly external: External; + readonly frameElement: Element; + readonly frames: Window; + readonly history: History; + readonly innerHeight: number; + readonly innerWidth: number; + readonly length: number; + readonly location: Location; + readonly locationbar: BarProp; + readonly menubar: BarProp; + readonly msCredentials: MSCredentials; name: string; - navigator: Navigator; + readonly navigator: Navigator; offscreenBuffering: string | boolean; onabort: (ev: Event) => any; onafterprint: (ev: Event) => any; @@ -12068,6 +12883,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window oncompassneedscalibration: (ev: Event) => any; oncontextmenu: (ev: PointerEvent) => any; ondblclick: (ev: MouseEvent) => any; + ondevicelight: (ev: DeviceLightEvent) => any; ondevicemotion: (ev: DeviceMotionEvent) => any; ondeviceorientation: (ev: DeviceOrientationEvent) => any; ondrag: (ev: DragEvent) => any; @@ -12079,11 +12895,12 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window ondrop: (ev: DragEvent) => any; ondurationchange: (ev: Event) => any; onemptied: (ev: Event) => any; - onended: (ev: Event) => any; + onended: (ev: MediaStreamErrorEvent) => any; onerror: ErrorEventHandler; onfocus: (ev: FocusEvent) => any; onhashchange: (ev: HashChangeEvent) => any; oninput: (ev: Event) => any; + oninvalid: (ev: Event) => any; onkeydown: (ev: KeyboardEvent) => any; onkeypress: (ev: KeyboardEvent) => any; onkeyup: (ev: KeyboardEvent) => any; @@ -12099,7 +12916,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window onmouseout: (ev: MouseEvent) => any; onmouseover: (ev: MouseEvent) => any; onmouseup: (ev: MouseEvent) => any; - onmousewheel: (ev: MouseWheelEvent) => any; + onmousewheel: (ev: WheelEvent) => any; onmsgesturechange: (ev: MSGestureEvent) => any; onmsgesturedoubletap: (ev: MSGestureEvent) => any; onmsgestureend: (ev: MSGestureEvent) => any; @@ -12138,38 +12955,38 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window onsubmit: (ev: Event) => any; onsuspend: (ev: Event) => any; ontimeupdate: (ev: Event) => any; - ontouchcancel: any; - ontouchend: any; - ontouchmove: any; - ontouchstart: any; + ontouchcancel: (ev: TouchEvent) => any; + ontouchend: (ev: TouchEvent) => any; + ontouchmove: (ev: TouchEvent) => any; + ontouchstart: (ev: TouchEvent) => any; onunload: (ev: Event) => any; onvolumechange: (ev: Event) => any; onwaiting: (ev: Event) => any; - opener: Window; + readonly opener: Window; orientation: string | number; - outerHeight: number; - outerWidth: number; - pageXOffset: number; - pageYOffset: number; - parent: Window; - performance: Performance; - personalbar: BarProp; - screen: Screen; - screenLeft: number; - screenTop: number; - screenX: number; - screenY: number; - scrollX: number; - scrollY: number; - scrollbars: BarProp; - self: Window; + readonly outerHeight: number; + readonly outerWidth: number; + readonly pageXOffset: number; + readonly pageYOffset: number; + readonly parent: Window; + readonly performance: Performance; + readonly personalbar: BarProp; + readonly screen: Screen; + readonly screenLeft: number; + readonly screenTop: number; + readonly screenX: number; + readonly screenY: number; + readonly scrollX: number; + readonly scrollY: number; + readonly scrollbars: BarProp; + readonly self: Window; status: string; - statusbar: BarProp; - styleMedia: StyleMedia; - toolbar: BarProp; - top: Window; - window: Window; - URL: URL; + readonly statusbar: BarProp; + readonly styleMedia: StyleMedia; + readonly toolbar: BarProp; + readonly top: Window; + readonly window: Window; + URL: typeof URL; alert(message?: any): void; blur(): void; cancelAnimationFrame(handle: number): void; @@ -12183,14 +13000,11 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window matchMedia(mediaQuery: string): MediaQueryList; moveBy(x?: number, y?: number): void; moveTo(x?: number, y?: number): void; - msCancelRequestAnimationFrame(handle: number): void; - msMatchMedia(mediaQuery: string): MediaQueryList; - msRequestAnimationFrame(callback: FrameRequestCallback): number; msWriteProfilerMark(profilerMarkName: string): void; - open(url?: string, target?: string, features?: string, replace?: boolean): any; - postMessage(message: any, targetOrigin: string, ports?: any): void; + open(url?: string, target?: string, features?: string, replace?: boolean): Window; + postMessage(message: any, targetOrigin: string, transfer?: any[]): void; print(): void; - prompt(message?: string, _default?: string): string; + prompt(message?: string, _default?: string): string | null; releaseEvents(): void; requestAnimationFrame(callback: FrameRequestCallback): number; resizeBy(x?: number, y?: number): void; @@ -12198,8 +13012,10 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window scroll(x?: number, y?: number): void; scrollBy(x?: number, y?: number): void; scrollTo(x?: number, y?: number): void; + webkitCancelAnimationFrame(handle: number): void; webkitConvertPointFromNodeToPage(node: Node, pt: WebKitPoint): WebKitPoint; webkitConvertPointFromPageToNode(node: Node, pt: WebKitPoint): WebKitPoint; + webkitRequestAnimationFrame(callback: FrameRequestCallback): number; addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; addEventListener(type: "MSGestureEnd", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; @@ -12227,6 +13043,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window addEventListener(type: "compassneedscalibration", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "devicelight", listener: (ev: DeviceLightEvent) => any, useCapture?: boolean): void; addEventListener(type: "devicemotion", listener: (ev: DeviceMotionEvent) => any, useCapture?: boolean): void; addEventListener(type: "deviceorientation", listener: (ev: DeviceOrientationEvent) => any, useCapture?: boolean): void; addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; @@ -12238,10 +13055,11 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "hashchange", listener: (ev: HashChangeEvent) => any, useCapture?: boolean): void; addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -12257,7 +13075,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; addEventListener(type: "offline", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "online", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "orientationchange", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -12327,20 +13145,19 @@ declare var XMLDocument: { interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget { msCaching: string; onreadystatechange: (ev: ProgressEvent) => any; - readyState: number; - response: any; - responseBody: any; - responseText: string; + readonly readyState: number; + readonly response: any; + readonly responseText: string; responseType: string; - responseXML: any; - status: number; - statusText: string; + readonly responseXML: any; + readonly status: number; + readonly statusText: string; timeout: number; - upload: XMLHttpRequestUpload; + readonly upload: XMLHttpRequestUpload; withCredentials: boolean; abort(): void; getAllResponseHeaders(): string; - getResponseHeader(header: string): string; + getResponseHeader(header: string): string | null; msCachingEnabled(): boolean; open(method: string, url: string, async?: boolean, user?: string, password?: string): void; overrideMimeType(mime: string): void; @@ -12348,11 +13165,11 @@ interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget { send(data?: string): void; send(data?: any): void; setRequestHeader(header: string, value: string): void; - DONE: number; - HEADERS_RECEIVED: number; - LOADING: number; - OPENED: number; - UNSENT: number; + readonly DONE: number; + readonly HEADERS_RECEIVED: number; + readonly LOADING: number; + readonly OPENED: number; + readonly UNSENT: number; addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -12367,11 +13184,11 @@ interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget { declare var XMLHttpRequest: { prototype: XMLHttpRequest; new(): XMLHttpRequest; - DONE: number; - HEADERS_RECEIVED: number; - LOADING: number; - OPENED: number; - UNSENT: number; + readonly DONE: number; + readonly HEADERS_RECEIVED: number; + readonly LOADING: number; + readonly OPENED: number; + readonly UNSENT: number; create(): XMLHttpRequest; } @@ -12423,40 +13240,40 @@ declare var XPathNSResolver: { } interface XPathResult { - booleanValue: boolean; - invalidIteratorState: boolean; - numberValue: number; - resultType: number; - singleNodeValue: Node; - snapshotLength: number; - stringValue: string; + readonly booleanValue: boolean; + readonly invalidIteratorState: boolean; + readonly numberValue: number; + readonly resultType: number; + readonly singleNodeValue: Node; + readonly snapshotLength: number; + readonly stringValue: string; iterateNext(): Node; snapshotItem(index: number): Node; - ANY_TYPE: number; - ANY_UNORDERED_NODE_TYPE: number; - BOOLEAN_TYPE: number; - FIRST_ORDERED_NODE_TYPE: number; - NUMBER_TYPE: number; - ORDERED_NODE_ITERATOR_TYPE: number; - ORDERED_NODE_SNAPSHOT_TYPE: number; - STRING_TYPE: number; - UNORDERED_NODE_ITERATOR_TYPE: number; - UNORDERED_NODE_SNAPSHOT_TYPE: number; + readonly ANY_TYPE: number; + readonly ANY_UNORDERED_NODE_TYPE: number; + readonly BOOLEAN_TYPE: number; + readonly FIRST_ORDERED_NODE_TYPE: number; + readonly NUMBER_TYPE: number; + readonly ORDERED_NODE_ITERATOR_TYPE: number; + readonly ORDERED_NODE_SNAPSHOT_TYPE: number; + readonly STRING_TYPE: number; + readonly UNORDERED_NODE_ITERATOR_TYPE: number; + readonly UNORDERED_NODE_SNAPSHOT_TYPE: number; } declare var XPathResult: { prototype: XPathResult; new(): XPathResult; - ANY_TYPE: number; - ANY_UNORDERED_NODE_TYPE: number; - BOOLEAN_TYPE: number; - FIRST_ORDERED_NODE_TYPE: number; - NUMBER_TYPE: number; - ORDERED_NODE_ITERATOR_TYPE: number; - ORDERED_NODE_SNAPSHOT_TYPE: number; - STRING_TYPE: number; - UNORDERED_NODE_ITERATOR_TYPE: number; - UNORDERED_NODE_SNAPSHOT_TYPE: number; + readonly ANY_TYPE: number; + readonly ANY_UNORDERED_NODE_TYPE: number; + readonly BOOLEAN_TYPE: number; + readonly FIRST_ORDERED_NODE_TYPE: number; + readonly NUMBER_TYPE: number; + readonly ORDERED_NODE_ITERATOR_TYPE: number; + readonly ORDERED_NODE_SNAPSHOT_TYPE: number; + readonly STRING_TYPE: number; + readonly UNORDERED_NODE_ITERATOR_TYPE: number; + readonly UNORDERED_NODE_SNAPSHOT_TYPE: number; } interface XSLTProcessor { @@ -12481,6 +13298,18 @@ interface AbstractWorker { addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } +interface CanvasPathMethods { + arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void; + arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void; + bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void; + closePath(): void; + ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void; + lineTo(x: number, y: number): void; + moveTo(x: number, y: number): void; + quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void; + rect(x: number, y: number, w: number, h: number): void; +} + interface ChildNode { remove(): void; } @@ -12503,6 +13332,7 @@ interface DocumentEvent { createEvent(eventInterface:"CommandEvent"): CommandEvent; createEvent(eventInterface:"CompositionEvent"): CompositionEvent; createEvent(eventInterface:"CustomEvent"): CustomEvent; + createEvent(eventInterface:"DeviceLightEvent"): DeviceLightEvent; createEvent(eventInterface:"DeviceMotionEvent"): DeviceMotionEvent; createEvent(eventInterface:"DeviceOrientationEvent"): DeviceOrientationEvent; createEvent(eventInterface:"DragEvent"): DragEvent; @@ -12514,6 +13344,7 @@ interface DocumentEvent { createEvent(eventInterface:"HashChangeEvent"): HashChangeEvent; createEvent(eventInterface:"IDBVersionChangeEvent"): IDBVersionChangeEvent; createEvent(eventInterface:"KeyboardEvent"): KeyboardEvent; + createEvent(eventInterface:"ListeningStateChangedEvent"): ListeningStateChangedEvent; createEvent(eventInterface:"LongRunningScriptDetectedEvent"): LongRunningScriptDetectedEvent; createEvent(eventInterface:"MSGestureEvent"): MSGestureEvent; createEvent(eventInterface:"MSManipulationEvent"): MSManipulationEvent; @@ -12521,21 +13352,31 @@ interface DocumentEvent { createEvent(eventInterface:"MSMediaKeyNeededEvent"): MSMediaKeyNeededEvent; createEvent(eventInterface:"MSPointerEvent"): MSPointerEvent; createEvent(eventInterface:"MSSiteModeEvent"): MSSiteModeEvent; + createEvent(eventInterface:"MediaEncryptedEvent"): MediaEncryptedEvent; + createEvent(eventInterface:"MediaKeyMessageEvent"): MediaKeyMessageEvent; + createEvent(eventInterface:"MediaStreamErrorEvent"): MediaStreamErrorEvent; + createEvent(eventInterface:"MediaStreamTrackEvent"): MediaStreamTrackEvent; createEvent(eventInterface:"MessageEvent"): MessageEvent; createEvent(eventInterface:"MouseEvent"): MouseEvent; createEvent(eventInterface:"MouseEvents"): MouseEvent; - createEvent(eventInterface:"MouseWheelEvent"): MouseWheelEvent; createEvent(eventInterface:"MutationEvent"): MutationEvent; createEvent(eventInterface:"MutationEvents"): MutationEvent; createEvent(eventInterface:"NavigationCompletedEvent"): NavigationCompletedEvent; createEvent(eventInterface:"NavigationEvent"): NavigationEvent; createEvent(eventInterface:"NavigationEventWithReferrer"): NavigationEventWithReferrer; createEvent(eventInterface:"OfflineAudioCompletionEvent"): OfflineAudioCompletionEvent; + createEvent(eventInterface:"OverflowEvent"): OverflowEvent; createEvent(eventInterface:"PageTransitionEvent"): PageTransitionEvent; createEvent(eventInterface:"PermissionRequestedEvent"): PermissionRequestedEvent; createEvent(eventInterface:"PointerEvent"): PointerEvent; createEvent(eventInterface:"PopStateEvent"): PopStateEvent; createEvent(eventInterface:"ProgressEvent"): ProgressEvent; + createEvent(eventInterface:"RTCDTMFToneChangeEvent"): RTCDTMFToneChangeEvent; + createEvent(eventInterface:"RTCDtlsTransportStateChangedEvent"): RTCDtlsTransportStateChangedEvent; + createEvent(eventInterface:"RTCIceCandidatePairChangedEvent"): RTCIceCandidatePairChangedEvent; + createEvent(eventInterface:"RTCIceGathererEvent"): RTCIceGathererEvent; + createEvent(eventInterface:"RTCIceTransportStateChangedEvent"): RTCIceTransportStateChangedEvent; + createEvent(eventInterface:"RTCSsrcConflictEvent"): RTCSsrcConflictEvent; createEvent(eventInterface:"SVGZoomEvent"): SVGZoomEvent; createEvent(eventInterface:"SVGZoomEvents"): SVGZoomEvent; createEvent(eventInterface:"ScriptNotifyEvent"): ScriptNotifyEvent; @@ -12553,11 +13394,11 @@ interface DocumentEvent { } interface ElementTraversal { - childElementCount: number; - firstElementChild: Element; - lastElementChild: Element; - nextElementSibling: Element; - previousElementSibling: Element; + readonly childElementCount: number; + readonly firstElementChild: Element; + readonly lastElementChild: Element; + readonly nextElementSibling: Element; + readonly previousElementSibling: Element; } interface GetSVGDocument { @@ -12602,12 +13443,11 @@ interface HTMLTableAlignment { } interface IDBEnvironment { - indexedDB: IDBFactory; - msIndexedDB: IDBFactory; + readonly indexedDB: IDBFactory; } interface LinkStyle { - sheet: StyleSheet; + readonly sheet: StyleSheet; } interface MSBaseReader { @@ -12617,12 +13457,12 @@ interface MSBaseReader { onloadend: (ev: ProgressEvent) => any; onloadstart: (ev: Event) => any; onprogress: (ev: ProgressEvent) => any; - readyState: number; - result: any; + readonly readyState: number; + readonly result: any; abort(): void; - DONE: number; - EMPTY: number; - LOADING: number; + readonly DONE: number; + readonly EMPTY: number; + readonly LOADING: number; addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -12650,27 +13490,32 @@ interface NavigatorContentUtils { } interface NavigatorGeolocation { - geolocation: Geolocation; + readonly geolocation: Geolocation; } interface NavigatorID { - appName: string; - appVersion: string; - platform: string; - product: string; - productSub: string; - userAgent: string; - vendor: string; - vendorSub: string; + readonly appName: string; + readonly appVersion: string; + readonly platform: string; + readonly product: string; + readonly productSub: string; + readonly userAgent: string; + readonly vendor: string; + readonly vendorSub: string; } interface NavigatorOnLine { - onLine: boolean; + readonly onLine: boolean; } interface NavigatorStorageUtils { } +interface NavigatorUserMedia { + readonly mediaDevices: MediaDevices; + getUserMedia(constraints: MediaStreamConstraints, successCallback: NavigatorUserMediaSuccessCallback, errorCallback: NavigatorUserMediaErrorCallback): void; +} + interface NodeSelector { querySelector(selectors: string): Element; querySelectorAll(selectors: string): NodeListOf; @@ -12681,29 +13526,29 @@ interface RandomSource { } interface SVGAnimatedPathData { - pathSegList: SVGPathSegList; + readonly pathSegList: SVGPathSegList; } interface SVGAnimatedPoints { - animatedPoints: SVGPointList; - points: SVGPointList; + readonly animatedPoints: SVGPointList; + readonly points: SVGPointList; } interface SVGExternalResourcesRequired { - externalResourcesRequired: SVGAnimatedBoolean; + readonly externalResourcesRequired: SVGAnimatedBoolean; } interface SVGFilterPrimitiveStandardAttributes extends SVGStylable { - height: SVGAnimatedLength; - result: SVGAnimatedString; - width: SVGAnimatedLength; - x: SVGAnimatedLength; - y: SVGAnimatedLength; + readonly height: SVGAnimatedLength; + readonly result: SVGAnimatedString; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; } interface SVGFitToViewBox { - preserveAspectRatio: SVGAnimatedPreserveAspectRatio; - viewBox: SVGAnimatedRect; + readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio; + readonly viewBox: SVGAnimatedRect; } interface SVGLangSpace { @@ -12712,8 +13557,8 @@ interface SVGLangSpace { } interface SVGLocatable { - farthestViewportElement: SVGElement; - nearestViewportElement: SVGElement; + readonly farthestViewportElement: SVGElement; + readonly nearestViewportElement: SVGElement; getBBox(): SVGRect; getCTM(): SVGMatrix; getScreenCTM(): SVGMatrix; @@ -12722,22 +13567,22 @@ interface SVGLocatable { interface SVGStylable { className: any; - style: CSSStyleDeclaration; + readonly style: CSSStyleDeclaration; } interface SVGTests { - requiredExtensions: SVGStringList; - requiredFeatures: SVGStringList; - systemLanguage: SVGStringList; + readonly requiredExtensions: SVGStringList; + readonly requiredFeatures: SVGStringList; + readonly systemLanguage: SVGStringList; hasExtension(extension: string): boolean; } interface SVGTransformable extends SVGLocatable { - transform: SVGAnimatedTransformList; + readonly transform: SVGAnimatedTransformList; } interface SVGURIReference { - href: SVGAnimatedString; + readonly href: SVGAnimatedString; } interface WindowBase64 { @@ -12746,15 +13591,15 @@ interface WindowBase64 { } interface WindowConsole { - console: Console; + readonly console: Console; } interface WindowLocalStorage { - localStorage: Storage; + readonly localStorage: Storage; } interface WindowSessionStorage { - sessionStorage: Storage; + readonly sessionStorage: Storage; } interface WindowTimers extends Object, WindowTimersExtension { @@ -12766,8 +13611,6 @@ interface WindowTimers extends Object, WindowTimersExtension { interface WindowTimersExtension { clearImmediate(handle: number): void; - msClearImmediate(handle: number): void; - msSetImmediate(expression: any, ...args: any[]): number; setImmediate(expression: any, ...args: any[]): number; } @@ -12789,12 +13632,26 @@ interface XMLHttpRequestEventTarget { addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } +interface StorageEventInit extends EventInit { + key?: string; + oldValue?: string; + newValue?: string; + url: string; + storageArea?: Storage; +} + interface NodeListOf extends NodeList { length: number; item(index: number): TNode; [index: number]: TNode; } +interface HTMLCollectionOf extends HTMLCollection { + item(index: number): T; + namedItem(name: string): T; + [index: number]: T; +} + interface BlobPropertyBag { type?: string; endings?: string; @@ -12824,6 +13681,14 @@ interface ProgressEventInit extends EventInit { total?: number; } +interface ClipboardEventInit extends EventInit { + data?: string; + dataType?: string; +} + +interface IDBArrayKey extends Array { +} + declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject; interface ErrorEventHandler { @@ -12857,15 +13722,23 @@ interface DecodeSuccessCallback { (decodedData: AudioBuffer): void; } interface DecodeErrorCallback { - (): void; + (error: DOMException): void; } interface FunctionStringCallback { (data: string): void; } +interface NavigatorUserMediaSuccessCallback { + (stream: MediaStream): void; +} +interface NavigatorUserMediaErrorCallback { + (error: MediaStreamError): void; +} +interface ForEachCallback { + (keyId: any, status: string): void; +} declare var Audio: {new(src?: string): HTMLAudioElement; }; declare var Image: {new(width?: number, height?: number): HTMLImageElement; }; declare var Option: {new(text?: string, value?: string, defaultSelected?: boolean, selected?: boolean): HTMLOptionElement; }; -declare var animationStartTime: number; declare var applicationCache: ApplicationCache; declare var clientInformation: Navigator; declare var closed: boolean; @@ -12885,7 +13758,7 @@ declare var length: number; declare var location: Location; declare var locationbar: BarProp; declare var menubar: BarProp; -declare var msAnimationStartTime: number; +declare var msCredentials: MSCredentials; declare var name: string; declare var navigator: Navigator; declare var offscreenBuffering: string | boolean; @@ -12901,6 +13774,7 @@ declare var onclick: (ev: MouseEvent) => any; declare var oncompassneedscalibration: (ev: Event) => any; declare var oncontextmenu: (ev: PointerEvent) => any; declare var ondblclick: (ev: MouseEvent) => any; +declare var ondevicelight: (ev: DeviceLightEvent) => any; declare var ondevicemotion: (ev: DeviceMotionEvent) => any; declare var ondeviceorientation: (ev: DeviceOrientationEvent) => any; declare var ondrag: (ev: DragEvent) => any; @@ -12912,11 +13786,12 @@ declare var ondragstart: (ev: DragEvent) => any; declare var ondrop: (ev: DragEvent) => any; declare var ondurationchange: (ev: Event) => any; declare var onemptied: (ev: Event) => any; -declare var onended: (ev: Event) => any; +declare var onended: (ev: MediaStreamErrorEvent) => any; declare var onerror: ErrorEventHandler; declare var onfocus: (ev: FocusEvent) => any; declare var onhashchange: (ev: HashChangeEvent) => any; declare var oninput: (ev: Event) => any; +declare var oninvalid: (ev: Event) => any; declare var onkeydown: (ev: KeyboardEvent) => any; declare var onkeypress: (ev: KeyboardEvent) => any; declare var onkeyup: (ev: KeyboardEvent) => any; @@ -12932,7 +13807,7 @@ declare var onmousemove: (ev: MouseEvent) => any; declare var onmouseout: (ev: MouseEvent) => any; declare var onmouseover: (ev: MouseEvent) => any; declare var onmouseup: (ev: MouseEvent) => any; -declare var onmousewheel: (ev: MouseWheelEvent) => any; +declare var onmousewheel: (ev: WheelEvent) => any; declare var onmsgesturechange: (ev: MSGestureEvent) => any; declare var onmsgesturedoubletap: (ev: MSGestureEvent) => any; declare var onmsgestureend: (ev: MSGestureEvent) => any; @@ -12971,10 +13846,10 @@ declare var onstorage: (ev: StorageEvent) => any; declare var onsubmit: (ev: Event) => any; declare var onsuspend: (ev: Event) => any; declare var ontimeupdate: (ev: Event) => any; -declare var ontouchcancel: any; -declare var ontouchend: any; -declare var ontouchmove: any; -declare var ontouchstart: any; +declare var ontouchcancel: (ev: TouchEvent) => any; +declare var ontouchend: (ev: TouchEvent) => any; +declare var ontouchmove: (ev: TouchEvent) => any; +declare var ontouchstart: (ev: TouchEvent) => any; declare var onunload: (ev: Event) => any; declare var onvolumechange: (ev: Event) => any; declare var onwaiting: (ev: Event) => any; @@ -13002,7 +13877,6 @@ declare var styleMedia: StyleMedia; declare var toolbar: BarProp; declare var top: Window; declare var window: Window; -declare var URL: URL; declare function alert(message?: any): void; declare function blur(): void; declare function cancelAnimationFrame(handle: number): void; @@ -13016,14 +13890,11 @@ declare function getSelection(): Selection; declare function matchMedia(mediaQuery: string): MediaQueryList; declare function moveBy(x?: number, y?: number): void; declare function moveTo(x?: number, y?: number): void; -declare function msCancelRequestAnimationFrame(handle: number): void; -declare function msMatchMedia(mediaQuery: string): MediaQueryList; -declare function msRequestAnimationFrame(callback: FrameRequestCallback): number; declare function msWriteProfilerMark(profilerMarkName: string): void; -declare function open(url?: string, target?: string, features?: string, replace?: boolean): any; -declare function postMessage(message: any, targetOrigin: string, ports?: any): void; +declare function open(url?: string, target?: string, features?: string, replace?: boolean): Window; +declare function postMessage(message: any, targetOrigin: string, transfer?: any[]): void; declare function print(): void; -declare function prompt(message?: string, _default?: string): string; +declare function prompt(message?: string, _default?: string): string | null; declare function releaseEvents(): void; declare function requestAnimationFrame(callback: FrameRequestCallback): number; declare function resizeBy(x?: number, y?: number): void; @@ -13031,19 +13902,19 @@ declare function resizeTo(x?: number, y?: number): void; declare function scroll(x?: number, y?: number): void; declare function scrollBy(x?: number, y?: number): void; declare function scrollTo(x?: number, y?: number): void; +declare function webkitCancelAnimationFrame(handle: number): void; declare function webkitConvertPointFromNodeToPage(node: Node, pt: WebKitPoint): WebKitPoint; declare function webkitConvertPointFromPageToNode(node: Node, pt: WebKitPoint): WebKitPoint; +declare function webkitRequestAnimationFrame(callback: FrameRequestCallback): number; declare function toString(): string; -declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +declare function addEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; declare function dispatchEvent(evt: Event): boolean; -declare function removeEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +declare function removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; declare function clearInterval(handle: number): void; declare function clearTimeout(handle: number): void; declare function setInterval(handler: any, timeout?: any, ...args: any[]): number; declare function setTimeout(handler: any, timeout?: any, ...args: any[]): number; declare function clearImmediate(handle: number): void; -declare function msClearImmediate(handle: number): void; -declare function msSetImmediate(expression: any, ...args: any[]): number; declare function setImmediate(expression: any, ...args: any[]): number; declare var sessionStorage: Storage; declare var localStorage: Storage; @@ -13058,7 +13929,6 @@ declare var onpointerover: (ev: PointerEvent) => any; declare var onpointerup: (ev: PointerEvent) => any; declare var onwheel: (ev: WheelEvent) => any; declare var indexedDB: IDBFactory; -declare var msIndexedDB: IDBFactory; declare function atob(encodedString: string): string; declare function btoa(rawString: string): string; declare function addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; @@ -13088,6 +13958,7 @@ declare function addEventListener(type: "click", listener: (ev: MouseEvent) => a declare function addEventListener(type: "compassneedscalibration", listener: (ev: Event) => any, useCapture?: boolean): void; declare function addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "devicelight", listener: (ev: DeviceLightEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "devicemotion", listener: (ev: DeviceMotionEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "deviceorientation", listener: (ev: DeviceOrientationEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; @@ -13099,10 +13970,11 @@ declare function addEventListener(type: "dragstart", listener: (ev: DragEvent) = declare function addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; declare function addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "hashchange", listener: (ev: HashChangeEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; declare function addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -13118,7 +13990,7 @@ declare function addEventListener(type: "mousemove", listener: (ev: MouseEvent) declare function addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "offline", listener: (ev: Event) => any, useCapture?: boolean): void; declare function addEventListener(type: "online", listener: (ev: Event) => any, useCapture?: boolean): void; declare function addEventListener(type: "orientationchange", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -13154,4 +14026,36 @@ declare function addEventListener(type: "unload", listener: (ev: Event) => any, declare function addEventListener(type: "volumechange", listener: (ev: Event) => any, useCapture?: boolean): void; declare function addEventListener(type: "waiting", listener: (ev: Event) => any, useCapture?: boolean): void; declare function addEventListener(type: "wheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; \ No newline at end of file +declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +type AAGUID = string; +type AlgorithmIdentifier = string | Algorithm; +type ConstrainBoolean = boolean | ConstrainBooleanParameters; +type ConstrainDOMString = string | string[] | ConstrainDOMStringParameters; +type ConstrainDouble = number | ConstrainDoubleRange; +type ConstrainLong = number | ConstrainLongRange; +type CryptoOperationData = ArrayBufferView; +type GLbitfield = number; +type GLboolean = boolean; +type GLbyte = number; +type GLclampf = number; +type GLenum = number; +type GLfloat = number; +type GLint = number; +type GLintptr = number; +type GLshort = number; +type GLsizei = number; +type GLsizeiptr = number; +type GLubyte = number; +type GLuint = number; +type GLushort = number; +type IDBKeyPath = string; +type KeyFormat = string; +type KeyType = string; +type KeyUsage = string; +type MSInboundPayload = MSVideoRecvPayload | MSAudioRecvPayload; +type MSLocalClientEvent = MSLocalClientEventBase | MSAudioLocalClientEvent; +type MSOutboundPayload = MSVideoSendPayload | MSAudioSendPayload; +type RTCIceGatherCandidate = RTCIceCandidate | RTCIceCandidateComplete; +type RTCTransport = RTCDtlsTransport | RTCSrtpSdesTransport; +type payloadtype = number; +type IDBValidKey = number | string | Date | IDBArrayKey; \ No newline at end of file diff --git a/lib/lib.dom.iterable.d.ts b/lib/lib.dom.iterable.d.ts new file mode 100644 index 00000000000..e9cf451bf49 --- /dev/null +++ b/lib/lib.dom.iterable.d.ts @@ -0,0 +1,29 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ + +/// +/// + +interface DOMTokenList { + [Symbol.iterator](): IterableIterator; +} + +interface NodeList { + [Symbol.iterator](): IterableIterator +} + +interface NodeListOf { + [Symbol.iterator](): IterableIterator +} diff --git a/lib/lib.es2015.collection.d.ts b/lib/lib.es2015.collection.d.ts new file mode 100644 index 00000000000..f014185d9e1 --- /dev/null +++ b/lib/lib.es2015.collection.d.ts @@ -0,0 +1,77 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ + +/// +interface Map { + clear(): void; + delete(key: K): boolean; + forEach(callbackfn: (value: V, index: K, map: Map) => void, thisArg?: any): void; + get(key: K): V | undefined; + has(key: K): boolean; + set(key: K, value?: V): this; + readonly size: number; +} + +interface MapConstructor { + new (): Map; + new (entries?: [K, V][]): Map; + readonly prototype: Map; +} +declare var Map: MapConstructor; + +interface WeakMap { + clear(): void; + delete(key: K): boolean; + get(key: K): V | undefined; + has(key: K): boolean; + set(key: K, value?: V): this; +} + +interface WeakMapConstructor { + new (): WeakMap; + new (entries?: [K, V][]): WeakMap; + readonly prototype: WeakMap; +} +declare var WeakMap: WeakMapConstructor; + +interface Set { + add(value: T): this; + clear(): void; + delete(value: T): boolean; + forEach(callbackfn: (value: T, index: T, set: Set) => void, thisArg?: any): void; + has(value: T): boolean; + readonly size: number; +} + +interface SetConstructor { + new (): Set; + new (values?: T[]): Set; + readonly prototype: Set; +} +declare var Set: SetConstructor; + +interface WeakSet { + add(value: T): this; + clear(): void; + delete(value: T): boolean; + has(value: T): boolean; +} + +interface WeakSetConstructor { + new (): WeakSet; + new (values?: T[]): WeakSet; + readonly prototype: WeakSet; +} +declare var WeakSet: WeakSetConstructor; diff --git a/lib/lib.es2015.core.d.ts b/lib/lib.es2015.core.d.ts new file mode 100644 index 00000000000..c7c7afb821b --- /dev/null +++ b/lib/lib.es2015.core.d.ts @@ -0,0 +1,512 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ + +/// +declare type PropertyKey = string | number | symbol; + +interface Array { + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: T, index: number, obj: Array) => boolean, thisArg?: any): T | undefined; + + /** + * Returns the index of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: T) => boolean, thisArg?: any): number; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: T, start?: number, end?: number): this; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; +} + +interface ArrayConstructor { + /** + * Creates an array from an array-like object. + * @param arrayLike An array-like object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): Array; + + + /** + * Creates an array from an array-like object. + * @param arrayLike An array-like object to convert to an array. + */ + from(arrayLike: ArrayLike): Array; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: T[]): Array; +} + +interface Function { + /** + * Returns the name of the function. Function names are read-only and can not be changed. + */ + readonly name: string; +} + +interface Math { + /** + * Returns the number of leading zero bits in the 32-bit binary representation of a number. + * @param x A numeric expression. + */ + clz32(x: number): number; + + /** + * Returns the result of 32-bit multiplication of two numbers. + * @param x First number + * @param y Second number + */ + imul(x: number, y: number): number; + + /** + * Returns the sign of the x, indicating whether x is positive, negative or zero. + * @param x The numeric expression to test + */ + sign(x: number): number; + + /** + * Returns the base 10 logarithm of a number. + * @param x A numeric expression. + */ + log10(x: number): number; + + /** + * Returns the base 2 logarithm of a number. + * @param x A numeric expression. + */ + log2(x: number): number; + + /** + * Returns the natural logarithm of 1 + x. + * @param x A numeric expression. + */ + log1p(x: number): number; + + /** + * Returns the result of (e^x - 1) of x (e raised to the power of x, where e is the base of + * the natural logarithms). + * @param x A numeric expression. + */ + expm1(x: number): number; + + /** + * Returns the hyperbolic cosine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + cosh(x: number): number; + + /** + * Returns the hyperbolic sine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + sinh(x: number): number; + + /** + * Returns the hyperbolic tangent of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + tanh(x: number): number; + + /** + * Returns the inverse hyperbolic cosine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + acosh(x: number): number; + + /** + * Returns the inverse hyperbolic sine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + asinh(x: number): number; + + /** + * Returns the inverse hyperbolic tangent of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + atanh(x: number): number; + + /** + * Returns the square root of the sum of squares of its arguments. + * @param values Values to compute the square root for. + * If no arguments are passed, the result is +0. + * If there is only one argument, the result is the absolute value. + * If any argument is +Infinity or -Infinity, the result is +Infinity. + * If any argument is NaN, the result is NaN. + * If all arguments are either +0 or −0, the result is +0. + */ + hypot(...values: number[] ): number; + + /** + * Returns the integral part of the a numeric expression, x, removing any fractional digits. + * If x is already an integer, the result is x. + * @param x A numeric expression. + */ + trunc(x: number): number; + + /** + * Returns the nearest single precision float representation of a number. + * @param x A numeric expression. + */ + fround(x: number): number; + + /** + * Returns an implementation-dependent approximation to the cube root of number. + * @param x A numeric expression. + */ + cbrt(x: number): number; +} + +interface NumberConstructor { + /** + * The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1 + * that is representable as a Number value, which is approximately: + * 2.2204460492503130808472633361816 x 10‍−‍16. + */ + readonly EPSILON: number; + + /** + * Returns true if passed value is finite. + * Unlike the global isFininte, Number.isFinite doesn't forcibly convert the parameter to a + * number. Only finite values of the type number, result in true. + * @param number A numeric value. + */ + isFinite(number: number): boolean; + + /** + * Returns true if the value passed is an integer, false otherwise. + * @param number A numeric value. + */ + isInteger(number: number): boolean; + + /** + * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a + * number). Unlike the global isNaN(), Number.isNaN() doesn't forcefully convert the parameter + * to a number. Only values of the type number, that are also NaN, result in true. + * @param number A numeric value. + */ + isNaN(number: number): boolean; + + /** + * Returns true if the value passed is a safe integer. + * @param number A numeric value. + */ + isSafeInteger(number: number): boolean; + + /** + * The value of the largest integer n such that n and n + 1 are both exactly representable as + * a Number value. + * The value of Number.MIN_SAFE_INTEGER is 9007199254740991 2^53 − 1. + */ + readonly MAX_SAFE_INTEGER: number; + + /** + * The value of the smallest integer n such that n and n − 1 are both exactly representable as + * a Number value. + * The value of Number.MIN_SAFE_INTEGER is −9007199254740991 (−(2^53 − 1)). + */ + readonly MIN_SAFE_INTEGER: number; + + /** + * Converts a string to a floating-point number. + * @param string A string that contains a floating-point number. + */ + parseFloat(string: string): number; + + /** + * Converts A string to an integer. + * @param s A string to convert into a number. + * @param radix A value between 2 and 36 that specifies the base of the number in numString. + * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. + * All other strings are considered decimal. + */ + parseInt(string: string, radix?: number): number; +} + +interface Object { + /** + * Determines whether an object has a property with the specified name. + * @param v A property name. + */ + hasOwnProperty(v: PropertyKey): boolean + + /** + * Determines whether a specified property is enumerable. + * @param v A property name. + */ + propertyIsEnumerable(v: PropertyKey): boolean; +} + +interface ObjectConstructor { + /** + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * @param target The target object to copy to. + * @param source The source object from which to copy properties. + */ + assign(target: T, source: U): T & U; + + /** + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * @param target The target object to copy to. + * @param source1 The first source object from which to copy properties. + * @param source2 The second source object from which to copy properties. + */ + assign(target: T, source1: U, source2: V): T & U & V; + + /** + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * @param target The target object to copy to. + * @param source1 The first source object from which to copy properties. + * @param source2 The second source object from which to copy properties. + * @param source3 The third source object from which to copy properties. + */ + assign(target: T, source1: U, source2: V, source3: W): T & U & V & W; + + /** + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * @param target The target object to copy to. + * @param sources One or more source objects from which to copy properties + */ + assign(target: any, ...sources: any[]): any; + + /** + * Returns an array of all symbol properties found directly on object o. + * @param o Object to retrieve the symbols from. + */ + getOwnPropertySymbols(o: any): symbol[]; + + /** + * Returns true if the values are the same value, false otherwise. + * @param value1 The first value. + * @param value2 The second value. + */ + is(value1: any, value2: any): boolean; + + /** + * Sets the prototype of a specified object o to object proto or null. Returns the object o. + * @param o The object to change its prototype. + * @param proto The value of the new prototype or null. + */ + setPrototypeOf(o: any, proto: any): any; + + /** + * Gets the own property descriptor of the specified object. + * An own property descriptor is one that is defined directly on the object and is not + * inherited from the object's prototype. + * @param o Object that contains the property. + * @param p Name of the property. + */ + getOwnPropertyDescriptor(o: any, propertyKey: PropertyKey): PropertyDescriptor; + + /** + * Adds a property to an object, or modifies attributes of an existing property. + * @param o Object on which to add or modify the property. This can be a native JavaScript + * object (that is, a user-defined object or a built in object) or a DOM object. + * @param p The property name. + * @param attributes Descriptor for the property. It can be for a data property or an accessor + * property. + */ + defineProperty(o: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): any; +} + +interface RegExp { + /** + * Returns a string indicating the flags of the regular expression in question. This field is read-only. + * The characters in this string are sequenced and concatenated in the following order: + * + * - "g" for global + * - "i" for ignoreCase + * - "m" for multiline + * - "u" for unicode + * - "y" for sticky + * + * If no flags are set, the value is the empty string. + */ + readonly flags: string; + + /** + * Returns a Boolean value indicating the state of the sticky flag (y) used with a regular + * expression. Default is false. Read-only. + */ + readonly sticky: boolean; + + /** + * Returns a Boolean value indicating the state of the Unicode flag (u) used with a regular + * expression. Default is false. Read-only. + */ + readonly unicode: boolean; +} + +interface RegExpConstructor { + new (pattern: RegExp, flags?: string): RegExp; + (pattern: RegExp, flags?: string): RegExp; +} + +interface String { + /** + * Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point + * value of the UTF-16 encoded code point starting at the string element at position pos in + * the String resulting from converting this object to a String. + * If there is no element at that position, the result is undefined. + * If a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos. + */ + codePointAt(pos: number): number | undefined; + + /** + * Returns true if searchString appears as a substring of the result of converting this + * object to a String, at one or more positions that are + * greater than or equal to position; otherwise, returns false. + * @param searchString search string + * @param position If position is undefined, 0 is assumed, so as to search all of the String. + */ + includes(searchString: string, position?: number): boolean; + + /** + * Returns true if the sequence of elements of searchString converted to a String is the + * same as the corresponding elements of this object (converted to a String) starting at + * endPosition – length(this). Otherwise returns false. + */ + endsWith(searchString: string, endPosition?: number): boolean; + + /** + * Returns the String value result of normalizing the string into the normalization form + * named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms. + * @param form Applicable values: "NFC", "NFD", "NFKC", or "NFKD", If not specified default + * is "NFC" + */ + normalize(form: "NFC" | "NFD" | "NFKC" | "NFKD"): string; + + /** + * Returns the String value result of normalizing the string into the normalization form + * named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms. + * @param form Applicable values: "NFC", "NFD", "NFKC", or "NFKD", If not specified default + * is "NFC" + */ + normalize(form?: string): string; + + /** + * Returns a String value that is made from count copies appended together. If count is 0, + * T is the empty String is returned. + * @param count number of copies to append + */ + repeat(count: number): string; + + /** + * Returns true if the sequence of elements of searchString converted to a String is the + * same as the corresponding elements of this object (converted to a String) starting at + * position. Otherwise returns false. + */ + startsWith(searchString: string, position?: number): boolean; + + /** + * Returns an HTML anchor element and sets the name attribute to the text value + * @param name + */ + anchor(name: string): string; + + /** Returns a HTML element */ + big(): string; + + /** Returns a HTML element */ + blink(): string; + + /** Returns a HTML element */ + bold(): string; + + /** Returns a HTML element */ + fixed(): string + + /** Returns a HTML element and sets the color attribute value */ + fontcolor(color: string): string + + /** Returns a HTML element and sets the size attribute value */ + fontsize(size: number): string; + + /** Returns a HTML element and sets the size attribute value */ + fontsize(size: string): string; + + /** Returns an HTML element */ + italics(): string; + + /** Returns an HTML element and sets the href attribute value */ + link(url: string): string; + + /** Returns a HTML element */ + small(): string; + + /** Returns a HTML element */ + strike(): string; + + /** Returns a HTML element */ + sub(): string; + + /** Returns a HTML element */ + sup(): string; +} + +interface StringConstructor { + /** + * Return the String value whose elements are, in order, the elements in the List elements. + * If length is 0, the empty string is returned. + */ + fromCodePoint(...codePoints: number[]): string; + + /** + * String.raw is intended for use as a tag function of a Tagged Template String. When called + * as such the first argument will be a well formed template call site object and the rest + * parameter will contain the substitution values. + * @param template A well-formed template string call site representation. + * @param substitutions A set of substitution values. + */ + raw(template: TemplateStringsArray, ...substitutions: any[]): string; +} diff --git a/lib/lib.es2015.d.ts b/lib/lib.es2015.d.ts new file mode 100644 index 00000000000..973d5180989 --- /dev/null +++ b/lib/lib.es2015.d.ts @@ -0,0 +1,26 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ + +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// \ No newline at end of file diff --git a/lib/lib.es2015.generator.d.ts b/lib/lib.es2015.generator.d.ts new file mode 100644 index 00000000000..003f325e4e0 --- /dev/null +++ b/lib/lib.es2015.generator.d.ts @@ -0,0 +1,28 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ + +/// +interface GeneratorFunction extends Function { } + +interface GeneratorFunctionConstructor { + /** + * Creates a new Generator function. + * @param args A list of arguments the function accepts. + */ + new (...args: string[]): GeneratorFunction; + (...args: string[]): GeneratorFunction; + readonly prototype: GeneratorFunction; +} +declare var GeneratorFunction: GeneratorFunctionConstructor; diff --git a/lib/lib.es2015.iterable.d.ts b/lib/lib.es2015.iterable.d.ts new file mode 100644 index 00000000000..a62d2635fae --- /dev/null +++ b/lib/lib.es2015.iterable.d.ts @@ -0,0 +1,441 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ + +/// +/// + +interface SymbolConstructor { + /** + * A method that returns the default iterator for an object. Called by the semantics of the + * for-of statement. + */ + readonly iterator: symbol; +} + +interface IteratorResult { + done: boolean; + value: T; +} + +interface Iterator { + next(value?: any): IteratorResult; + return?(value?: any): IteratorResult; + throw?(e?: any): IteratorResult; +} + +interface Iterable { + [Symbol.iterator](): Iterator; +} + +interface IterableIterator extends Iterator { + [Symbol.iterator](): IterableIterator; +} + +interface Array { + /** Iterator */ + [Symbol.iterator](): IterableIterator; + + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, T]>; + + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface ArrayConstructor { + /** + * Creates an array from an iterable object. + * @param iterable An iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(iterable: Iterable, mapfn: (v: T, k: number) => U, thisArg?: any): Array; + + /** + * Creates an array from an iterable object. + * @param iterable An iterable object to convert to an array. + */ + from(iterable: Iterable): Array; +} + +interface IArguments { + /** Iterator */ + [Symbol.iterator](): IterableIterator; +} + +interface Map { + [Symbol.iterator](): IterableIterator<[K,V]>; + entries(): IterableIterator<[K, V]>; + keys(): IterableIterator; + values(): IterableIterator; +} + +interface MapConstructor { + new (iterable: Iterable<[K, V]>): Map; +} + +interface WeakMap { } + +interface WeakMapConstructor { + new (iterable: Iterable<[K, V]>): WeakMap; +} + +interface Set { + [Symbol.iterator](): IterableIterator; + entries(): IterableIterator<[T, T]>; + keys(): IterableIterator; + values(): IterableIterator; +} + +interface SetConstructor { + new (iterable: Iterable): Set; +} + +interface WeakSet { } + +interface WeakSetConstructor { + new (iterable: Iterable): WeakSet; +} + +interface Promise { } + +interface PromiseConstructor { + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any Promise is rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + all(values: Iterable>): Promise; + + /** + * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved + * or rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + race(values: Iterable>): Promise; +} + +declare namespace Reflect { + function enumerate(target: any): IterableIterator; +} + +interface String { + /** Iterator */ + [Symbol.iterator](): IterableIterator; +} + +/** + * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Int8Array { + [Symbol.iterator](): IterableIterator; + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Int8ArrayConstructor { + new (elements: Iterable): Int8Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array; +} + +/** + * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8Array { + [Symbol.iterator](): IterableIterator; + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Uint8ArrayConstructor { + new (elements: Iterable): Uint8Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array; +} + +/** + * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. + * If the requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8ClampedArray { + [Symbol.iterator](): IterableIterator; + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Uint8ClampedArrayConstructor { + new (elements: Iterable): Uint8ClampedArray; + + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray; +} + +/** + * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int16Array { + [Symbol.iterator](): IterableIterator; + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Int16ArrayConstructor { + new (elements: Iterable): Int16Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array; +} + +/** + * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint16Array { + [Symbol.iterator](): IterableIterator; + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Uint16ArrayConstructor { + new (elements: Iterable): Uint16Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array; +} + +/** + * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int32Array { + [Symbol.iterator](): IterableIterator; + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Int32ArrayConstructor { + new (elements: Iterable): Int32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array; +} + +/** + * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint32Array { + [Symbol.iterator](): IterableIterator; + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Uint32ArrayConstructor { + new (elements: Iterable): Uint32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array; +} + +/** + * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number + * of bytes could not be allocated an exception is raised. + */ +interface Float32Array { + [Symbol.iterator](): IterableIterator; + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Float32ArrayConstructor { + new (elements: Iterable): Float32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array; +} + +/** + * A typed array of 64-bit float values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Float64Array { + [Symbol.iterator](): IterableIterator; + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Float64ArrayConstructor { + new (elements: Iterable): Float64Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; +} \ No newline at end of file diff --git a/lib/lib.es2015.promise.d.ts b/lib/lib.es2015.promise.d.ts new file mode 100644 index 00000000000..4817121154f --- /dev/null +++ b/lib/lib.es2015.promise.d.ts @@ -0,0 +1,97 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ + +/// +/** + * Represents the completion of an asynchronous operation + */ +interface Promise { + /** + * Attaches callbacks for the resolution and/or rejection of the Promise. + * @param onfulfilled The callback to execute when the Promise is resolved. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of which ever callback is executed. + */ + then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; + then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): Promise; + + /** + * Attaches a callback for only the rejection of the Promise. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of the callback. + */ + catch(onrejected?: (reason: any) => T | PromiseLike): Promise; + catch(onrejected?: (reason: any) => void): Promise; +} + +interface PromiseConstructor { + /** + * A reference to the prototype. + */ + readonly prototype: Promise; + + /** + * Creates a new Promise. + * @param executor A callback used to initialize the promise. This callback is passed two arguments: + * a resolve callback used resolve the promise with a value or the result of another promise, + * and a reject callback used to reject the promise with a provided reason or error. + */ + new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void): Promise; + + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any Promise is rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike, T10 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>; + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>; + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>; + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7]>; + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6]>; + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike]): Promise<[T1, T2, T3, T4, T5]>; + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike ]): Promise<[T1, T2, T3, T4]>; + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike]): Promise<[T1, T2, T3]>; + all(values: [T1 | PromiseLike, T2 | PromiseLike]): Promise<[T1, T2]>; + + /** + * Creates a new rejected promise for the provided reason. + * @param reason The reason the promise was rejected. + * @returns A new rejected Promise. + */ + reject(reason: any): Promise; + + /** + * Creates a new rejected promise for the provided reason. + * @param reason The reason the promise was rejected. + * @returns A new rejected Promise. + */ + reject(reason: any): Promise; + + /** + * Creates a new resolved promise for the provided value. + * @param value A promise. + * @returns A promise whose internal state matches the provided promise. + */ + resolve(value: T | PromiseLike): Promise; + + /** + * Creates a new resolved promise . + * @returns A resolved promise. + */ + resolve(): Promise; +} + +declare var Promise: PromiseConstructor; \ No newline at end of file diff --git a/lib/lib.es2015.proxy.d.ts b/lib/lib.es2015.proxy.d.ts new file mode 100644 index 00000000000..3908e97c17c --- /dev/null +++ b/lib/lib.es2015.proxy.d.ts @@ -0,0 +1,38 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ + +/// +interface ProxyHandler { + getPrototypeOf? (target: T): any; + setPrototypeOf? (target: T, v: any): boolean; + isExtensible? (target: T): boolean; + preventExtensions? (target: T): boolean; + getOwnPropertyDescriptor? (target: T, p: PropertyKey): PropertyDescriptor; + has? (target: T, p: PropertyKey): boolean; + get? (target: T, p: PropertyKey, receiver: any): any; + set? (target: T, p: PropertyKey, value: any, receiver: any): boolean; + deleteProperty? (target: T, p: PropertyKey): boolean; + defineProperty? (target: T, p: PropertyKey, attributes: PropertyDescriptor): boolean; + enumerate? (target: T): PropertyKey[]; + ownKeys? (target: T): PropertyKey[]; + apply? (target: T, thisArg: any, argArray?: any): any; + construct? (target: T, thisArg: any, argArray?: any): any; +} + +interface ProxyConstructor { + revocable(target: T, handler: ProxyHandler): { proxy: T; revoke: () => void; }; + new (target: T, handler: ProxyHandler): T +} +declare var Proxy: ProxyConstructor; \ No newline at end of file diff --git a/lib/lib.es2015.reflect.d.ts b/lib/lib.es2015.reflect.d.ts new file mode 100644 index 00000000000..c53cdaf88ac --- /dev/null +++ b/lib/lib.es2015.reflect.d.ts @@ -0,0 +1,32 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ + +/// +declare namespace Reflect { + function apply(target: Function, thisArgument: any, argumentsList: ArrayLike): any; + function construct(target: Function, argumentsList: ArrayLike, newTarget?: any): any; + function defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean; + function deleteProperty(target: any, propertyKey: PropertyKey): boolean; + function get(target: any, propertyKey: PropertyKey, receiver?: any): any; + function getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor; + function getPrototypeOf(target: any): any; + function has(target: any, propertyKey: string): boolean; + function has(target: any, propertyKey: symbol): boolean; + function isExtensible(target: any): boolean; + function ownKeys(target: any): Array; + function preventExtensions(target: any): boolean; + function set(target: any, propertyKey: PropertyKey, value: any, receiver?: any): boolean; + function setPrototypeOf(target: any, proto: any): boolean; +} \ No newline at end of file diff --git a/lib/lib.es2015.symbol.d.ts b/lib/lib.es2015.symbol.d.ts new file mode 100644 index 00000000000..4ab7b4374f1 --- /dev/null +++ b/lib/lib.es2015.symbol.d.ts @@ -0,0 +1,52 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ + +/// +interface Symbol { + /** Returns a string representation of an object. */ + toString(): string; + + /** Returns the primitive value of the specified object. */ + valueOf(): Object; +} + +interface SymbolConstructor { + /** + * A reference to the prototype. + */ + readonly prototype: Symbol; + + /** + * Returns a new unique Symbol value. + * @param description Description of the new Symbol object. + */ + (description?: string|number): symbol; + + /** + * Returns a Symbol object from the global symbol registry matching the given key if found. + * Otherwise, returns a new symbol with this key. + * @param key key to search for. + */ + for(key: string): symbol; + + /** + * Returns a key from the global symbol registry matching the given Symbol if found. + * Otherwise, returns a undefined. + * @param sym Symbol to find the key for. + */ + keyFor(sym: symbol): string | undefined; +} + +declare var Symbol: SymbolConstructor; \ No newline at end of file diff --git a/lib/lib.es2015.symbol.wellknown.d.ts b/lib/lib.es2015.symbol.wellknown.d.ts new file mode 100644 index 00000000000..2d122d1284e --- /dev/null +++ b/lib/lib.es2015.symbol.wellknown.d.ts @@ -0,0 +1,343 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ + +/// +/// + +interface SymbolConstructor { + /** + * A method that determines if a constructor object recognizes an object as one of the + * constructor’s instances. Called by the semantics of the instanceof operator. + */ + readonly hasInstance: symbol; + + /** + * A Boolean value that if true indicates that an object should flatten to its array elements + * by Array.prototype.concat. + */ + readonly isConcatSpreadable: symbol; + + /** + * A regular expression method that matches the regular expression against a string. Called + * by the String.prototype.match method. + */ + readonly match: symbol; + + /** + * A regular expression method that replaces matched substrings of a string. Called by the + * String.prototype.replace method. + */ + readonly replace: symbol; + + /** + * A regular expression method that returns the index within a string that matches the + * regular expression. Called by the String.prototype.search method. + */ + readonly search: symbol; + + /** + * A function valued property that is the constructor function that is used to create + * derived objects. + */ + readonly species: symbol; + + /** + * A regular expression method that splits a string at the indices that match the regular + * expression. Called by the String.prototype.split method. + */ + readonly split: symbol; + + /** + * A method that converts an object to a corresponding primitive value. + * Called by the ToPrimitive abstract operation. + */ + readonly toPrimitive: symbol; + + /** + * A String value that is used in the creation of the default string description of an object. + * Called by the built-in method Object.prototype.toString. + */ + readonly toStringTag: symbol; + + /** + * An Object whose own property names are property names that are excluded from the 'with' + * environment bindings of the associated objects. + */ + readonly unscopables: symbol; +} + +interface Symbol { + readonly [Symbol.toStringTag]: "Symbol"; +} + +interface Array { + /** + * Returns an object whose properties have the value 'true' + * when they will be absent when used in a 'with' statement. + */ + [Symbol.unscopables](): { + copyWithin: boolean; + entries: boolean; + fill: boolean; + find: boolean; + findIndex: boolean; + keys: boolean; + values: boolean; + }; +} + +interface Date { + /** + * Converts a Date object to a string. + */ + [Symbol.toPrimitive](hint: "default"): string; + /** + * Converts a Date object to a string. + */ + [Symbol.toPrimitive](hint: "string"): string; + /** + * Converts a Date object to a number. + */ + [Symbol.toPrimitive](hint: "number"): number; + /** + * Converts a Date object to a string or number. + * + * @param hint The strings "number", "string", or "default" to specify what primitive to return. + * + * @throws {TypeError} If 'hint' was given something other than "number", "string", or "default". + * @returns A number if 'hint' was "number", a string if 'hint' was "string" or "default". + */ + [Symbol.toPrimitive](hint: string): string | number; +} + +interface Map { + readonly [Symbol.toStringTag]: "Map"; +} + +interface WeakMap{ + readonly [Symbol.toStringTag]: "WeakMap"; +} + +interface Set { + readonly [Symbol.toStringTag]: "Set"; +} + +interface WeakSet { + readonly [Symbol.toStringTag]: "WeakSet"; +} + +interface JSON { + readonly [Symbol.toStringTag]: "JSON"; +} + +interface Function { + /** + * Determines whether the given value inherits from this function if this function was used + * as a constructor function. + * + * A constructor function can control which objects are recognized as its instances by + * 'instanceof' by overriding this method. + */ + [Symbol.hasInstance](value: any): boolean; +} + +interface GeneratorFunction extends Function { + readonly [Symbol.toStringTag]: "GeneratorFunction"; +} + +interface Math { + readonly [Symbol.toStringTag]: "Math"; +} + +interface Promise { + readonly [Symbol.toStringTag]: "Promise"; +} + +interface PromiseConstructor { + readonly [Symbol.species]: Function; +} + +interface RegExp { + /** + * Matches a string with this regular expression, and returns an array containing the results of + * that search. + * @param string A string to search within. + */ + [Symbol.match](string: string): RegExpMatchArray | null; + + /** + * Replaces text in a string, using this regular expression. + * @param string A String object or string literal whose contents matching against + * this regular expression will be replaced + * @param replaceValue A String object or string literal containing the text to replace for every + * successful match of this regular expression. + */ + [Symbol.replace](string: string, replaceValue: string): string; + + /** + * Replaces text in a string, using this regular expression. + * @param string A String object or string literal whose contents matching against + * this regular expression will be replaced + * @param replacer A function that returns the replacement text. + */ + [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; + + /** + * Finds the position beginning first substring match in a regular expression search + * using this regular expression. + * + * @param string The string to search within. + */ + [Symbol.search](string: string): number; + + /** + * Returns an array of substrings that were delimited by strings in the original input that + * match against this regular expression. + * + * If the regular expression contains capturing parentheses, then each time this + * regular expression matches, the results (including any undefined results) of the + * capturing parentheses are spliced. + * + * @param string string value to split + * @param limit if not undefined, the output array is truncated so that it contains no more + * than 'limit' elements. + */ + [Symbol.split](string: string, limit?: number): string[]; +} + +interface RegExpConstructor { + [Symbol.species](): RegExpConstructor; +} + +interface String { + /** + * Matches a string an object that supports being matched against, and returns an array containing the results of that search. + * @param matcher An object that supports being matched against. + */ + match(matcher: { [Symbol.match](string: string): RegExpMatchArray | null; }): RegExpMatchArray | null; + + /** + * Replaces text in a string, using an object that supports replacement within a string. + * @param searchValue A object can search for and replace matches within a string. + * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. + */ + replace(searchValue: { [Symbol.replace](string: string, replaceValue: string): string; }, replaceValue: string): string; + + /** + * Replaces text in a string, using an object that supports replacement within a string. + * @param searchValue A object can search for and replace matches within a string. + * @param replacer A function that returns the replacement text. + */ + replace(searchValue: { [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; }, replacer: (substring: string, ...args: any[]) => string): string; + + /** + * Finds the first substring match in a regular expression search. + * @param searcher An object which supports searching within a string. + */ + search(searcher: { [Symbol.search](string: string): number; }): number; + + /** + * Split a string into substrings using the specified separator and return them as an array. + * @param splitter An object that can split a string. + * @param limit A value used to limit the number of elements returned in the array. + */ + split(splitter: { [Symbol.split](string: string, limit?: number): string[]; }, limit?: number): string[]; +} + +/** + * Represents a raw buffer of binary data, which is used to store data for the + * different typed arrays. ArrayBuffers cannot be read from or written to directly, + * but can be passed to a typed array or DataView Object to interpret the raw + * buffer as needed. + */ +interface ArrayBuffer { + readonly [Symbol.toStringTag]: "ArrayBuffer"; +} + +interface DataView { + readonly [Symbol.toStringTag]: "DataView"; +} + +/** + * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Int8Array { + readonly [Symbol.toStringTag]: "Int8Array"; +} + +/** + * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8Array { + readonly [Symbol.toStringTag]: "UInt8Array"; +} + +/** + * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. + * If the requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8ClampedArray { + readonly [Symbol.toStringTag]: "Uint8ClampedArray"; +} + +/** + * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int16Array { + readonly [Symbol.toStringTag]: "Int16Array"; +} + +/** + * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint16Array { + readonly [Symbol.toStringTag]: "Uint16Array"; +} + +/** + * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int32Array { + readonly [Symbol.toStringTag]: "Int32Array"; +} + +/** + * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint32Array { + readonly [Symbol.toStringTag]: "Uint32Array"; +} + +/** + * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number + * of bytes could not be allocated an exception is raised. + */ +interface Float32Array { + readonly [Symbol.toStringTag]: "Float32Array"; +} + +/** + * A typed array of 64-bit float values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Float64Array { + readonly [Symbol.toStringTag]: "Float64Array"; +} \ No newline at end of file diff --git a/lib/lib.es2016.array.include.d.ts b/lib/lib.es2016.array.include.d.ts new file mode 100644 index 00000000000..a4677e7cf1e --- /dev/null +++ b/lib/lib.es2016.array.include.d.ts @@ -0,0 +1,105 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ + +/// +interface Array { + /** + * Determines whether an array includes a certain element, returning true or false as appropriate. + * @param searchElement The element to search for. + * @param fromIndex The position in this array at which to begin searching for searchElement. + */ + includes(searchElement: T, fromIndex?: number): boolean; +} + +interface Int8Array { + /** + * Determines whether an array includes a certain element, returning true or false as appropriate. + * @param searchElement The element to search for. + * @param fromIndex The position in this array at which to begin searching for searchElement. + */ + includes(searchElement: number, fromIndex?: number): boolean; +} + +interface Uint8Array { + /** + * Determines whether an array includes a certain element, returning true or false as appropriate. + * @param searchElement The element to search for. + * @param fromIndex The position in this array at which to begin searching for searchElement. + */ + includes(searchElement: number, fromIndex?: number): boolean; +} + +interface Uint8ClampedArray { + /** + * Determines whether an array includes a certain element, returning true or false as appropriate. + * @param searchElement The element to search for. + * @param fromIndex The position in this array at which to begin searching for searchElement. + */ + includes(searchElement: number, fromIndex?: number): boolean; +} + +interface Int16Array { + /** + * Determines whether an array includes a certain element, returning true or false as appropriate. + * @param searchElement The element to search for. + * @param fromIndex The position in this array at which to begin searching for searchElement. + */ + includes(searchElement: number, fromIndex?: number): boolean; +} + +interface Uint16Array { + /** + * Determines whether an array includes a certain element, returning true or false as appropriate. + * @param searchElement The element to search for. + * @param fromIndex The position in this array at which to begin searching for searchElement. + */ + includes(searchElement: number, fromIndex?: number): boolean; +} + +interface Int32Array { + /** + * Determines whether an array includes a certain element, returning true or false as appropriate. + * @param searchElement The element to search for. + * @param fromIndex The position in this array at which to begin searching for searchElement. + */ + includes(searchElement: number, fromIndex?: number): boolean; +} + +interface Uint32Array { + /** + * Determines whether an array includes a certain element, returning true or false as appropriate. + * @param searchElement The element to search for. + * @param fromIndex The position in this array at which to begin searching for searchElement. + */ + includes(searchElement: number, fromIndex?: number): boolean; +} + +interface Float32Array { + /** + * Determines whether an array includes a certain element, returning true or false as appropriate. + * @param searchElement The element to search for. + * @param fromIndex The position in this array at which to begin searching for searchElement. + */ + includes(searchElement: number, fromIndex?: number): boolean; +} + +interface Float64Array { + /** + * Determines whether an array includes a certain element, returning true or false as appropriate. + * @param searchElement The element to search for. + * @param fromIndex The position in this array at which to begin searching for searchElement. + */ + includes(searchElement: number, fromIndex?: number): boolean; +} \ No newline at end of file diff --git a/lib/lib.es2016.d.ts b/lib/lib.es2016.d.ts new file mode 100644 index 00000000000..04a23379676 --- /dev/null +++ b/lib/lib.es2016.d.ts @@ -0,0 +1,18 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ + +/// +/// +/// \ No newline at end of file diff --git a/lib/lib.es2017.d.ts b/lib/lib.es2017.d.ts new file mode 100644 index 00000000000..06dc9711df4 --- /dev/null +++ b/lib/lib.es2017.d.ts @@ -0,0 +1,18 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ + +/// +/// +/// \ No newline at end of file diff --git a/lib/lib.es2017.object.d.ts b/lib/lib.es2017.object.d.ts new file mode 100644 index 00000000000..ac3a16ab370 --- /dev/null +++ b/lib/lib.es2017.object.d.ts @@ -0,0 +1,30 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ + +/// +interface ObjectConstructor { + /** + * Returns an array of values of the enumerable properties of an object + * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. + */ + values(o: { [s: string]: T }): T[]; + values(o: any): any[]; + /** + * Returns an array of key/values of the enumerable properties of an object + * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. + */ + entries(o: { [s: string]: T }): [string, T][]; + entries(o: any): [string, any][]; +} \ No newline at end of file diff --git a/lib/lib.core.d.ts b/lib/lib.es5.d.ts similarity index 73% rename from lib/lib.core.d.ts rename to lib/lib.es5.d.ts index 50fd8a8e495..3a0f73f3cc7 100644 --- a/lib/lib.core.d.ts +++ b/lib/lib.es5.d.ts @@ -14,16 +14,15 @@ and limitations under the License. ***************************************************************************** */ /// - ///////////////////////////// /// ECMAScript APIs ///////////////////////////// -declare var NaN: number; -declare var Infinity: number; +declare const NaN: number; +declare const Infinity: number; /** - * Evaluates JavaScript code and executes it. + * Evaluates JavaScript code and executes it. * @param x A String value that contains valid JavaScript code. */ declare function eval(x: string): any; @@ -31,25 +30,25 @@ declare function eval(x: string): any; /** * Converts A string to an integer. * @param s A string to convert into a number. - * @param radix A value between 2 and 36 that specifies the base of the number in numString. + * @param radix A value between 2 and 36 that specifies the base of the number in numString. * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. * All other strings are considered decimal. */ declare function parseInt(s: string, radix?: number): number; /** - * Converts a string to a floating-point number. - * @param string A string that contains a floating-point number. + * Converts a string to a floating-point number. + * @param string A string that contains a floating-point number. */ declare function parseFloat(string: string): number; /** - * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a number). + * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a number). * @param number A numeric value. */ declare function isNaN(number: number): boolean; -/** +/** * Determines whether a supplied number is finite. * @param number Any numeric value. */ @@ -67,7 +66,7 @@ declare function decodeURI(encodedURI: string): string; */ declare function decodeURIComponent(encodedURIComponent: string): string; -/** +/** * Encodes a text string as a valid Uniform Resource Identifier (URI) * @param uri A value representing an encoded URI. */ @@ -106,18 +105,18 @@ interface Object { valueOf(): Object; /** - * Determines whether an object has a property with the specified name. + * Determines whether an object has a property with the specified name. * @param v A property name. */ hasOwnProperty(v: string): boolean; /** - * Determines whether an object exists in another object's prototype chain. + * Determines whether an object exists in another object's prototype chain. * @param v Another object whose prototype chain is to be checked. */ isPrototypeOf(v: Object): boolean; - /** + /** * Determines whether a specified property is enumerable. * @param v A property name. */ @@ -130,38 +129,38 @@ interface ObjectConstructor { (value: any): any; /** A reference to the prototype for a class of objects. */ - prototype: Object; + readonly prototype: Object; - /** - * Returns the prototype of an object. + /** + * Returns the prototype of an object. * @param o The object that references the prototype. */ getPrototypeOf(o: any): any; /** - * Gets the own property descriptor of the specified object. - * An own property descriptor is one that is defined directly on the object and is not inherited from the object's prototype. + * Gets the own property descriptor of the specified object. + * An own property descriptor is one that is defined directly on the object and is not inherited from the object's prototype. * @param o Object that contains the property. * @param p Name of the property. */ getOwnPropertyDescriptor(o: any, p: string): PropertyDescriptor; - /** - * Returns the names of the own properties of an object. The own properties of an object are those that are defined directly + /** + * Returns the names of the own properties of an object. The own properties of an object are those that are defined directly * on that object, and are not inherited from the object's prototype. The properties of an object include both fields (objects) and functions. * @param o Object that contains the own properties. */ getOwnPropertyNames(o: any): string[]; - /** + /** * Creates an object that has the specified prototype, and that optionally contains specified properties. * @param o Object to use as a prototype. May be null - * @param properties JavaScript object that contains one or more property descriptors. + * @param properties JavaScript object that contains one or more property descriptors. */ create(o: any, properties?: PropertyDescriptorMap): any; /** - * Adds a property to an object, or modifies attributes of an existing property. + * Adds a property to an object, or modifies attributes of an existing property. * @param o Object on which to add or modify the property. This can be a native JavaScript object (that is, a user-defined object or a built in object) or a DOM object. * @param p The property name. * @param attributes Descriptor for the property. It can be for a data property or an accessor property. @@ -169,7 +168,7 @@ interface ObjectConstructor { defineProperty(o: any, p: string, attributes: PropertyDescriptor): any; /** - * Adds one or more properties to an object, and/or modifies attributes of existing properties. + * Adds one or more properties to an object, and/or modifies attributes of existing properties. * @param o Object on which to add or modify the properties. This can be a native JavaScript object or a DOM object. * @param properties JavaScript object that contains one or more descriptor objects. Each descriptor object describes a data property or an accessor property. */ @@ -177,7 +176,7 @@ interface ObjectConstructor { /** * Prevents the modification of attributes of existing properties, and prevents the addition of new properties. - * @param o Object on which to lock the attributes. + * @param o Object on which to lock the attributes. */ seal(o: T): T; @@ -189,25 +188,25 @@ interface ObjectConstructor { /** * Prevents the addition of new properties to an object. - * @param o Object to make non-extensible. + * @param o Object to make non-extensible. */ preventExtensions(o: T): T; /** * Returns true if existing property attributes cannot be modified in an object and new properties cannot be added to the object. - * @param o Object to test. + * @param o Object to test. */ isSealed(o: any): boolean; /** * Returns true if existing property attributes and values cannot be modified in an object, and new properties cannot be added to the object. - * @param o Object to test. + * @param o Object to test. */ isFrozen(o: any): boolean; /** * Returns a value that indicates whether new properties can be added to an object. - * @param o Object to test. + * @param o Object to test. */ isExtensible(o: any): boolean; @@ -221,7 +220,7 @@ interface ObjectConstructor { /** * Provides functionality common to all JavaScript objects. */ -declare var Object: ObjectConstructor; +declare const Object: ObjectConstructor; /** * Creates a new function. @@ -232,25 +231,25 @@ interface Function { * @param thisArg The object to be used as the this object. * @param argArray A set of arguments to be passed to the function. */ - apply(thisArg: any, argArray?: any): any; + apply(this: Function, thisArg: any, argArray?: any): any; /** * Calls a method of an object, substituting another object for the current object. * @param thisArg The object to be used as the current object. * @param argArray A list of arguments to be passed to the method. */ - call(thisArg: any, ...argArray: any[]): any; + call(this: Function, thisArg: any, ...argArray: any[]): any; /** - * For a given function, creates a bound function that has the same body as the original function. + * For a given function, creates a bound function that has the same body as the original function. * The this object of the bound function is associated with the specified object, and has the specified initial parameters. * @param thisArg An object to which the this keyword can refer inside the new function. * @param argArray A list of arguments to be passed to the new function. */ - bind(thisArg: any, ...argArray: any[]): any; + bind(this: Function, thisArg: any, ...argArray: any[]): any; prototype: any; - length: number; + readonly length: number; // Non-standard extensions arguments: any; @@ -264,10 +263,10 @@ interface FunctionConstructor { */ new (...args: string[]): Function; (...args: string[]): Function; - prototype: Function; + readonly prototype: Function; } -declare var Function: FunctionConstructor; +declare const Function: FunctionConstructor; interface IArguments { [index: number]: any; @@ -285,7 +284,7 @@ interface String { */ charAt(pos: number): string; - /** + /** * Returns the Unicode value of the character at the specified location. * @param index The zero-based index of the desired character. If there is no character at the specified index, NaN is returned. */ @@ -293,12 +292,12 @@ interface String { /** * Returns a string that contains the concatenation of two or more strings. - * @param strings The strings to append to the end of the string. + * @param strings The strings to append to the end of the string. */ concat(...strings: string[]): string; /** - * Returns the position of the first occurrence of a substring. + * Returns the position of the first occurrence of a substring. * @param searchString The substring to search for in the string * @param position The index at which to begin searching the String object. If omitted, search starts at the beginning of the string. */ @@ -317,17 +316,17 @@ interface String { */ localeCompare(that: string): number; - /** + /** * Matches a string with a regular expression, and returns an array containing the results of that search. * @param regexp A variable name or string literal containing the regular expression pattern and flags. */ - match(regexp: string): RegExpMatchArray; + match(regexp: string): RegExpMatchArray | null; - /** + /** * Matches a string with a regular expression, and returns an array containing the results of that search. - * @param regexp A regular expression object that contains the regular expression pattern and applicable flags. + * @param regexp A regular expression object that contains the regular expression pattern and applicable flags. */ - match(regexp: RegExp): RegExpMatchArray; + match(regexp: RegExp): RegExpMatchArray | null; /** * Replaces text in a string, using a regular expression or search string. @@ -359,40 +358,40 @@ interface String { /** * Finds the first substring match in a regular expression search. - * @param regexp The regular expression pattern and applicable flags. + * @param regexp The regular expression pattern and applicable flags. */ search(regexp: string): number; /** * Finds the first substring match in a regular expression search. - * @param regexp The regular expression pattern and applicable flags. + * @param regexp The regular expression pattern and applicable flags. */ search(regexp: RegExp): number; /** * Returns a section of a string. - * @param start The index to the beginning of the specified portion of stringObj. - * @param end The index to the end of the specified portion of stringObj. The substring includes the characters up to, but not including, the character indicated by end. + * @param start The index to the beginning of the specified portion of stringObj. + * @param end The index to the end of the specified portion of stringObj. The substring includes the characters up to, but not including, the character indicated by end. * If this value is not specified, the substring continues to the end of stringObj. */ slice(start?: number, end?: number): string; /** * Split a string into substrings using the specified separator and return them as an array. - * @param separator A string that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. + * @param separator A string that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. * @param limit A value used to limit the number of elements returned in the array. */ split(separator: string, limit?: number): string[]; /** * Split a string into substrings using the specified separator and return them as an array. - * @param separator A Regular Express that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. + * @param separator A Regular Express that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. * @param limit A value used to limit the number of elements returned in the array. */ split(separator: RegExp, limit?: number): string[]; /** - * Returns the substring at the specified location within a String object. + * Returns the substring at the specified location within a String object. * @param start The zero-based index number indicating the beginning of the substring. * @param end Zero-based index number indicating the end of the substring. The substring includes the characters up to, but not including, the character indicated by end. * If end is omitted, the characters from start through the end of the original string are returned. @@ -415,7 +414,7 @@ interface String { trim(): string; /** Returns the length of a String object. */ - length: number; + readonly length: number; // IE extensions /** @@ -428,20 +427,20 @@ interface String { /** Returns the primitive value of the specified object. */ valueOf(): string; - [index: number]: string; + readonly [index: number]: string; } interface StringConstructor { new (value?: any): String; (value?: any): string; - prototype: String; + readonly prototype: String; fromCharCode(...codes: number[]): string; } -/** - * Allows manipulation and formatting of text strings and determination and location of substrings within strings. +/** + * Allows manipulation and formatting of text strings and determination and location of substrings within strings. */ -declare var String: StringConstructor; +declare const String: StringConstructor; interface Boolean { /** Returns the primitive value of the specified object. */ @@ -451,10 +450,10 @@ interface Boolean { interface BooleanConstructor { new (value?: any): Boolean; (value?: any): boolean; - prototype: Boolean; + readonly prototype: Boolean; } -declare var Boolean: BooleanConstructor; +declare const Boolean: BooleanConstructor; interface Number { /** @@ -463,7 +462,7 @@ interface Number { */ toString(radix?: number): string; - /** + /** * Returns a string representing a number in fixed-point notation. * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive. */ @@ -488,75 +487,75 @@ interface Number { interface NumberConstructor { new (value?: any): Number; (value?: any): number; - prototype: Number; + readonly prototype: Number; /** The largest number that can be represented in JavaScript. Equal to approximately 1.79E+308. */ - MAX_VALUE: number; + readonly MAX_VALUE: number; /** The closest number to zero that can be represented in JavaScript. Equal to approximately 5.00E-324. */ - MIN_VALUE: number; + readonly MIN_VALUE: number; - /** + /** * A value that is not a number. * In equality comparisons, NaN does not equal any value, including itself. To test whether a value is equivalent to NaN, use the isNaN function. */ - NaN: number; - - /** - * A value that is less than the largest negative number that can be represented in JavaScript. - * JavaScript displays NEGATIVE_INFINITY values as -infinity. - */ - NEGATIVE_INFINITY: number; + readonly NaN: number; /** - * A value greater than the largest number that can be represented in JavaScript. - * JavaScript displays POSITIVE_INFINITY values as infinity. + * A value that is less than the largest negative number that can be represented in JavaScript. + * JavaScript displays NEGATIVE_INFINITY values as -infinity. */ - POSITIVE_INFINITY: number; + readonly NEGATIVE_INFINITY: number; + + /** + * A value greater than the largest number that can be represented in JavaScript. + * JavaScript displays POSITIVE_INFINITY values as infinity. + */ + readonly POSITIVE_INFINITY: number; } /** An object that represents a number of any kind. All JavaScript numbers are 64-bit floating-point numbers. */ -declare var Number: NumberConstructor; +declare const Number: NumberConstructor; interface TemplateStringsArray extends Array { - raw: string[]; + readonly raw: string[]; } interface Math { /** The mathematical constant e. This is Euler's number, the base of natural logarithms. */ - E: number; + readonly E: number; /** The natural logarithm of 10. */ - LN10: number; + readonly LN10: number; /** The natural logarithm of 2. */ - LN2: number; + readonly LN2: number; /** The base-2 logarithm of e. */ - LOG2E: number; + readonly LOG2E: number; /** The base-10 logarithm of e. */ - LOG10E: number; + readonly LOG10E: number; /** Pi. This is the ratio of the circumference of a circle to its diameter. */ - PI: number; + readonly PI: number; /** The square root of 0.5, or, equivalently, one divided by the square root of 2. */ - SQRT1_2: number; + readonly SQRT1_2: number; /** The square root of 2. */ - SQRT2: number; + readonly SQRT2: number; /** - * Returns the absolute value of a number (the value without regard to whether it is positive or negative). + * Returns the absolute value of a number (the value without regard to whether it is positive or negative). * For example, the absolute value of -5 is the same as the absolute value of 5. * @param x A numeric expression for which the absolute value is needed. */ abs(x: number): number; /** - * Returns the arc cosine (or inverse cosine) of a number. + * Returns the arc cosine (or inverse cosine) of a number. * @param x A numeric expression. */ acos(x: number): number; - /** - * Returns the arcsine of a number. + /** + * Returns the arcsine of a number. * @param x A numeric expression. */ asin(x: number): number; /** - * Returns the arctangent of a number. + * Returns the arctangent of a number. * @param x A numeric expression for which the arctangent is needed. */ atan(x: number): number; @@ -567,49 +566,49 @@ interface Math { */ atan2(y: number, x: number): number; /** - * Returns the smallest number greater than or equal to its numeric argument. + * Returns the smallest number greater than or equal to its numeric argument. * @param x A numeric expression. */ ceil(x: number): number; /** - * Returns the cosine of a number. + * Returns the cosine of a number. * @param x A numeric expression that contains an angle measured in radians. */ cos(x: number): number; /** - * Returns e (the base of natural logarithms) raised to a power. + * Returns e (the base of natural logarithms) raised to a power. * @param x A numeric expression representing the power of e. */ exp(x: number): number; /** - * Returns the greatest number less than or equal to its numeric argument. + * Returns the greatest number less than or equal to its numeric argument. * @param x A numeric expression. */ floor(x: number): number; /** - * Returns the natural logarithm (base e) of a number. + * Returns the natural logarithm (base e) of a number. * @param x A numeric expression. */ log(x: number): number; /** - * Returns the larger of a set of supplied numeric expressions. + * Returns the larger of a set of supplied numeric expressions. * @param values Numeric expressions to be evaluated. */ max(...values: number[]): number; /** - * Returns the smaller of a set of supplied numeric expressions. + * Returns the smaller of a set of supplied numeric expressions. * @param values Numeric expressions to be evaluated. */ min(...values: number[]): number; /** - * Returns the value of a base expression taken to a specified power. + * Returns the value of a base expression taken to a specified power. * @param x The base value of the expression. * @param y The exponent value of the expression. */ pow(x: number, y: number): number; /** Returns a pseudorandom number between 0 and 1. */ random(): number; - /** + /** * Returns a supplied numeric expression rounded to the nearest number. * @param x The value to be rounded to the nearest number. */ @@ -631,7 +630,7 @@ interface Math { tan(x: number): number; } /** An intrinsic object that provides basic mathematics functionality and constants. */ -declare var Math: Math; +declare const Math: Math; /** Enables basic storage and retrieval of dates and times. */ interface Date { @@ -685,24 +684,24 @@ interface Date { getUTCMilliseconds(): number; /** Gets the difference in minutes between the time on the local computer and Universal Coordinated Time (UTC). */ getTimezoneOffset(): number; - /** + /** * Sets the date and time value in the Date object. - * @param time A numeric value representing the number of elapsed milliseconds since midnight, January 1, 1970 GMT. + * @param time A numeric value representing the number of elapsed milliseconds since midnight, January 1, 1970 GMT. */ setTime(time: number): number; /** - * Sets the milliseconds value in the Date object using local time. + * Sets the milliseconds value in the Date object using local time. * @param ms A numeric value equal to the millisecond value. */ setMilliseconds(ms: number): number; - /** + /** * Sets the milliseconds value in the Date object using Universal Coordinated Time (UTC). - * @param ms A numeric value equal to the millisecond value. + * @param ms A numeric value equal to the millisecond value. */ setUTCMilliseconds(ms: number): number; /** - * Sets the seconds value in the Date object using local time. + * Sets the seconds value in the Date object using local time. * @param sec A numeric value equal to the seconds value. * @param ms A numeric value equal to the milliseconds value. */ @@ -714,16 +713,16 @@ interface Date { */ setUTCSeconds(sec: number, ms?: number): number; /** - * Sets the minutes value in the Date object using local time. - * @param min A numeric value equal to the minutes value. - * @param sec A numeric value equal to the seconds value. + * Sets the minutes value in the Date object using local time. + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. * @param ms A numeric value equal to the milliseconds value. */ setMinutes(min: number, sec?: number, ms?: number): number; /** * Sets the minutes value in the Date object using Universal Coordinated Time (UTC). - * @param min A numeric value equal to the minutes value. - * @param sec A numeric value equal to the seconds value. + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. * @param ms A numeric value equal to the milliseconds value. */ setUTCMinutes(min: number, sec?: number, ms?: number): number; @@ -731,7 +730,7 @@ interface Date { * Sets the hour value in the Date object using local time. * @param hours A numeric value equal to the hours value. * @param min A numeric value equal to the minutes value. - * @param sec A numeric value equal to the seconds value. + * @param sec A numeric value equal to the seconds value. * @param ms A numeric value equal to the milliseconds value. */ setHours(hours: number, min?: number, sec?: number, ms?: number): number; @@ -739,23 +738,23 @@ interface Date { * Sets the hours value in the Date object using Universal Coordinated Time (UTC). * @param hours A numeric value equal to the hours value. * @param min A numeric value equal to the minutes value. - * @param sec A numeric value equal to the seconds value. + * @param sec A numeric value equal to the seconds value. * @param ms A numeric value equal to the milliseconds value. */ setUTCHours(hours: number, min?: number, sec?: number, ms?: number): number; /** - * Sets the numeric day-of-the-month value of the Date object using local time. + * Sets the numeric day-of-the-month value of the Date object using local time. * @param date A numeric value equal to the day of the month. */ setDate(date: number): number; - /** + /** * Sets the numeric day of the month in the Date object using Universal Coordinated Time (UTC). - * @param date A numeric value equal to the day of the month. + * @param date A numeric value equal to the day of the month. */ setUTCDate(date: number): number; - /** - * Sets the month value in the Date object using local time. - * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. + /** + * Sets the month value in the Date object using local time. + * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. * @param date A numeric value representing the day of the month. If this value is not supplied, the value from a call to the getDate method is used. */ setMonth(month: number, date?: number): number; @@ -793,14 +792,14 @@ interface DateConstructor { new (value: string): Date; new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; (): string; - prototype: Date; + readonly prototype: Date; /** * Parses a string containing a date, and returns the number of milliseconds between that date and midnight, January 1, 1970. * @param s A date string */ parse(s: string): number; /** - * Returns the number of milliseconds between midnight, January 1, 1970 Universal Coordinated Time (UTC) (or GMT) and the specified date. + * Returns the number of milliseconds between midnight, January 1, 1970 Universal Coordinated Time (UTC) (or GMT) and the specified date. * @param year The full year designation is required for cross-century date accuracy. If year is between 0 and 99 is used, then year is assumed to be 1900 + year. * @param month The month as an number between 0 and 11 (January to December). * @param date The date as an number between 1 and 31. @@ -813,7 +812,7 @@ interface DateConstructor { now(): number; } -declare var Date: DateConstructor; +declare const Date: DateConstructor; interface RegExpMatchArray extends Array { index?: number; @@ -826,40 +825,42 @@ interface RegExpExecArray extends Array { } interface RegExp { - /** + /** * Executes a search on a string using a regular expression pattern, and returns an array containing the results of that search. * @param string The String object or string literal on which to perform the search. */ - exec(string: string): RegExpExecArray; + exec(string: string): RegExpExecArray | null; - /** + /** * Returns a Boolean value that indicates whether or not a pattern exists in a searched string. * @param string String on which to perform the search. */ test(string: string): boolean; /** Returns a copy of the text of the regular expression pattern. Read-only. The regExp argument is a Regular expression object. It can be a variable name or a literal. */ - source: string; + readonly source: string; /** Returns a Boolean value indicating the state of the global flag (g) used with a regular expression. Default is false. Read-only. */ - global: boolean; + readonly global: boolean; /** Returns a Boolean value indicating the state of the ignoreCase flag (i) used with a regular expression. Default is false. Read-only. */ - ignoreCase: boolean; + readonly ignoreCase: boolean; /** Returns a Boolean value indicating the state of the multiline flag (m) used with a regular expression. Default is false. Read-only. */ - multiline: boolean; + readonly multiline: boolean; lastIndex: number; // Non-standard extensions - compile(): RegExp; + compile(): this; } interface RegExpConstructor { + new (pattern: RegExp): RegExp; new (pattern: string, flags?: string): RegExp; + (pattern: RegExp): RegExp; (pattern: string, flags?: string): RegExp; - prototype: RegExp; + readonly prototype: RegExp; // Non-standard extensions $1: string; @@ -874,20 +875,21 @@ interface RegExpConstructor { lastMatch: string; } -declare var RegExp: RegExpConstructor; +declare const RegExp: RegExpConstructor; interface Error { name: string; message: string; + stack?: string; } interface ErrorConstructor { new (message?: string): Error; (message?: string): Error; - prototype: Error; + readonly prototype: Error; } -declare var Error: ErrorConstructor; +declare const Error: ErrorConstructor; interface EvalError extends Error { } @@ -895,10 +897,10 @@ interface EvalError extends Error { interface EvalErrorConstructor { new (message?: string): EvalError; (message?: string): EvalError; - prototype: EvalError; + readonly prototype: EvalError; } -declare var EvalError: EvalErrorConstructor; +declare const EvalError: EvalErrorConstructor; interface RangeError extends Error { } @@ -906,10 +908,10 @@ interface RangeError extends Error { interface RangeErrorConstructor { new (message?: string): RangeError; (message?: string): RangeError; - prototype: RangeError; + readonly prototype: RangeError; } -declare var RangeError: RangeErrorConstructor; +declare const RangeError: RangeErrorConstructor; interface ReferenceError extends Error { } @@ -917,10 +919,10 @@ interface ReferenceError extends Error { interface ReferenceErrorConstructor { new (message?: string): ReferenceError; (message?: string): ReferenceError; - prototype: ReferenceError; + readonly prototype: ReferenceError; } -declare var ReferenceError: ReferenceErrorConstructor; +declare const ReferenceError: ReferenceErrorConstructor; interface SyntaxError extends Error { } @@ -928,10 +930,10 @@ interface SyntaxError extends Error { interface SyntaxErrorConstructor { new (message?: string): SyntaxError; (message?: string): SyntaxError; - prototype: SyntaxError; + readonly prototype: SyntaxError; } -declare var SyntaxError: SyntaxErrorConstructor; +declare const SyntaxError: SyntaxErrorConstructor; interface TypeError extends Error { } @@ -939,10 +941,10 @@ interface TypeError extends Error { interface TypeErrorConstructor { new (message?: string): TypeError; (message?: string): TypeError; - prototype: TypeError; + readonly prototype: TypeError; } -declare var TypeError: TypeErrorConstructor; +declare const TypeError: TypeErrorConstructor; interface URIError extends Error { } @@ -950,17 +952,17 @@ interface URIError extends Error { interface URIErrorConstructor { new (message?: string): URIError; (message?: string): URIError; - prototype: URIError; + readonly prototype: URIError; } -declare var URIError: URIErrorConstructor; +declare const URIError: URIErrorConstructor; interface JSON { /** * Converts a JavaScript Object Notation (JSON) string into an object. * @param text A valid JSON string. - * @param reviver A function that transforms the results. This function is called for each member of the object. - * If a member contains nested objects, the nested objects are transformed before the parent object is. + * @param reviver A function that transforms the results. This function is called for each member of the object. + * If a member contains nested objects, the nested objects are transformed before the parent object is. */ parse(text: string, reviver?: (key: any, value: any) => any): any; /** @@ -998,13 +1000,115 @@ interface JSON { /** * An intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format. */ -declare var JSON: JSON; +declare const JSON: JSON; ///////////////////////////// /// ECMAScript Array API (specially handled by compiler) ///////////////////////////// +interface ReadonlyArray { + /** + * Gets the length of the array. This is a number one higher than the highest element defined in an array. + */ + readonly length: number; + /** + * Returns a string representation of an array. + */ + toString(): string; + toLocaleString(): string; + /** + * Combines two or more arrays. + * @param items Additional items to add to the end of array1. + */ + concat>(...items: U[]): T[]; + /** + * Combines two or more arrays. + * @param items Additional items to add to the end of array1. + */ + concat(...items: T[]): T[]; + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): T[]; + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. + */ + indexOf(searchElement: T, fromIndex?: number): number; + + /** + * Returns the index of the last occurrence of a specified value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array. + */ + lastIndexOf(searchElement: T, fromIndex?: number): number; + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: T, index: number, array: ReadonlyArray) => boolean, thisArg?: any): boolean; + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: T, index: number, array: ReadonlyArray) => boolean, thisArg?: any): boolean; + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: T, index: number, array: ReadonlyArray) => void, thisArg?: any): void; + /** + * Calls a defined callback function on each element of an array, and returns an array that contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: T, index: number, array: ReadonlyArray) => U, thisArg?: any): U[]; + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (value: T, index: number, array: ReadonlyArray) => any, thisArg?: any): T[]; + /** + * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: ReadonlyArray) => T, initialValue?: T): T; + /** + * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: ReadonlyArray) => U, initialValue: U): U; + /** + * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: ReadonlyArray) => T, initialValue?: T): T; + /** + * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: ReadonlyArray) => U, initialValue: U): U; + + readonly [n: number]: T; +} + interface Array { /** * Gets or sets the length of the array. This is a number one higher than the highest element defined in an array. @@ -1023,49 +1127,41 @@ interface Array { /** * Removes the last element from an array and returns it. */ - pop(): T; + pop(): T | undefined; /** * Combines two or more arrays. * @param items Additional items to add to the end of array1. */ - concat(...items: U[]): T[]; - /** - * Combines two or more arrays. - * @param items Additional items to add to the end of array1. - */ - concat(...items: T[]): T[]; + concat(...items: (T | T[])[]): T[]; /** * Adds all the elements of an array separated by the specified separator string. * @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): T[]; /** * Removes the first element from an array and returns it. */ - shift(): T; - /** + shift(): T | undefined; + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. */ slice(start?: number, end?: number): T[]; - /** * Sorts an array. * @param compareFn The name of the function used to determine the order of the elements. If omitted, the elements are sorted in ascending, ASCII character order. */ - sort(compareFn?: (a: T, b: T) => number): T[]; - + sort(compareFn?: (a: T, b: T) => number): this; /** * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. * @param start The zero-based location in the array from which to start removing elements. */ splice(start: number): T[]; - /** * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. * @param start The zero-based location in the array from which to start removing elements. @@ -1073,62 +1169,53 @@ interface Array { * @param items Elements to insert into the array in place of the deleted elements. */ splice(start: number, deleteCount: number, ...items: T[]): T[]; - /** * Inserts new elements at the start of an array. * @param items Elements to insert at the start of the Array. */ unshift(...items: T[]): number; - /** * Returns the index of the first occurrence of a value in an array. * @param searchElement The value to locate in the array. * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. */ indexOf(searchElement: T, fromIndex?: number): number; - /** * Returns the index of the last occurrence of a specified value in an array. * @param searchElement The value to locate in the array. * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array. */ lastIndexOf(searchElement: T, fromIndex?: number): number; - /** * Determines whether all the members of an array satisfy the specified test. * @param callbackfn A function that accepts up to three arguments. The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. */ every(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; - /** * Determines whether the specified callback function returns true for any element of an array. * @param callbackfn A function that accepts up to three arguments. The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; - /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void; - /** * Calls a defined callback function on each element of an array, and returns an array that contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. + * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[]; - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. */ - filter(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): T[]; - + filter(callbackfn: (value: T, index: number, array: T[]) => any, thisArg?: any): T[]; /** * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. @@ -1141,16 +1228,15 @@ interface Array { * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; - - /** + /** * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. */ reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; - /** + /** * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; @@ -1166,10 +1252,10 @@ interface ArrayConstructor { (arrayLength: number): T[]; (...items: T[]): T[]; isArray(arg: any): arg is Array; - prototype: Array; + readonly prototype: Array; } -declare var Array: ArrayConstructor; +declare const Array: ArrayConstructor; interface TypedPropertyDescriptor { enumerable?: boolean; @@ -1199,22 +1285,21 @@ interface PromiseLike { } interface ArrayLike { - length: number; - [n: number]: T; + readonly length: number; + readonly [n: number]: T; } - /** - * Represents a raw buffer of binary data, which is used to store data for the - * different typed arrays. ArrayBuffers cannot be read from or written to directly, - * but can be passed to a typed array or DataView Object to interpret the raw - * buffer as needed. + * Represents a raw buffer of binary data, which is used to store data for the + * different typed arrays. ArrayBuffers cannot be read from or written to directly, + * but can be passed to a typed array or DataView Object to interpret the raw + * buffer as needed. */ interface ArrayBuffer { /** * Read-only. The length of the ArrayBuffer (in bytes). */ - byteLength: number; + readonly byteLength: number; /** * Returns a section of an ArrayBuffer. @@ -1223,15 +1308,15 @@ interface ArrayBuffer { } interface ArrayBufferConstructor { - prototype: ArrayBuffer; + readonly prototype: ArrayBuffer; new (byteLength: number): ArrayBuffer; isView(arg: any): arg is ArrayBufferView; } -declare var ArrayBuffer: ArrayBufferConstructor; +declare const ArrayBuffer: ArrayBufferConstructor; interface ArrayBufferView { /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ buffer: ArrayBuffer; @@ -1247,128 +1332,128 @@ interface ArrayBufferView { } interface DataView { - buffer: ArrayBuffer; - byteLength: number; - byteOffset: number; + readonly buffer: ArrayBuffer; + readonly byteLength: number; + readonly byteOffset: number; /** - * Gets the Float32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. + * Gets the Float32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. * @param byteOffset The place in the buffer at which the value should be retrieved. */ getFloat32(byteOffset: number, littleEndian?: boolean): number; /** * Gets the Float64 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. + * no alignment constraint; multi-byte values may be fetched from any offset. * @param byteOffset The place in the buffer at which the value should be retrieved. */ getFloat64(byteOffset: number, littleEndian?: boolean): number; /** - * Gets the Int8 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. + * Gets the Int8 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. * @param byteOffset The place in the buffer at which the value should be retrieved. */ getInt8(byteOffset: number): number; /** - * Gets the Int16 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. + * Gets the Int16 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. * @param byteOffset The place in the buffer at which the value should be retrieved. */ getInt16(byteOffset: number, littleEndian?: boolean): number; /** - * Gets the Int32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. + * Gets the Int32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. * @param byteOffset The place in the buffer at which the value should be retrieved. */ getInt32(byteOffset: number, littleEndian?: boolean): number; /** - * Gets the Uint8 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. + * Gets the Uint8 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. * @param byteOffset The place in the buffer at which the value should be retrieved. */ getUint8(byteOffset: number): number; /** - * Gets the Uint16 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. + * Gets the Uint16 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. * @param byteOffset The place in the buffer at which the value should be retrieved. */ getUint16(byteOffset: number, littleEndian?: boolean): number; /** - * Gets the Uint32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. + * Gets the Uint32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. * @param byteOffset The place in the buffer at which the value should be retrieved. */ getUint32(byteOffset: number, littleEndian?: boolean): number; /** - * Stores an Float32 value at the specified byte offset from the start of the view. + * Stores an Float32 value at the specified byte offset from the start of the view. * @param byteOffset The place in the buffer at which the value should be set. * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, + * @param littleEndian If false or undefined, a big-endian value should be written, * otherwise a little-endian value should be written. */ setFloat32(byteOffset: number, value: number, littleEndian?: boolean): void; /** - * Stores an Float64 value at the specified byte offset from the start of the view. + * Stores an Float64 value at the specified byte offset from the start of the view. * @param byteOffset The place in the buffer at which the value should be set. * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, + * @param littleEndian If false or undefined, a big-endian value should be written, * otherwise a little-endian value should be written. */ setFloat64(byteOffset: number, value: number, littleEndian?: boolean): void; /** - * Stores an Int8 value at the specified byte offset from the start of the view. + * Stores an Int8 value at the specified byte offset from the start of the view. * @param byteOffset The place in the buffer at which the value should be set. * @param value The value to set. */ setInt8(byteOffset: number, value: number): void; /** - * Stores an Int16 value at the specified byte offset from the start of the view. + * Stores an Int16 value at the specified byte offset from the start of the view. * @param byteOffset The place in the buffer at which the value should be set. * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, + * @param littleEndian If false or undefined, a big-endian value should be written, * otherwise a little-endian value should be written. */ setInt16(byteOffset: number, value: number, littleEndian?: boolean): void; /** - * Stores an Int32 value at the specified byte offset from the start of the view. + * Stores an Int32 value at the specified byte offset from the start of the view. * @param byteOffset The place in the buffer at which the value should be set. * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, + * @param littleEndian If false or undefined, a big-endian value should be written, * otherwise a little-endian value should be written. */ setInt32(byteOffset: number, value: number, littleEndian?: boolean): void; /** - * Stores an Uint8 value at the specified byte offset from the start of the view. + * Stores an Uint8 value at the specified byte offset from the start of the view. * @param byteOffset The place in the buffer at which the value should be set. * @param value The value to set. */ setUint8(byteOffset: number, value: number): void; /** - * Stores an Uint16 value at the specified byte offset from the start of the view. + * Stores an Uint16 value at the specified byte offset from the start of the view. * @param byteOffset The place in the buffer at which the value should be set. * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, + * @param littleEndian If false or undefined, a big-endian value should be written, * otherwise a little-endian value should be written. */ setUint16(byteOffset: number, value: number, littleEndian?: boolean): void; /** - * Stores an Uint32 value at the specified byte offset from the start of the view. + * Stores an Uint32 value at the specified byte offset from the start of the view. * @param byteOffset The place in the buffer at which the value should be set. * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, + * @param littleEndian If false or undefined, a big-endian value should be written, * otherwise a little-endian value should be written. */ setUint32(byteOffset: number, value: number, littleEndian?: boolean): void; @@ -1377,48 +1462,48 @@ interface DataView { interface DataViewConstructor { new (buffer: ArrayBuffer, byteOffset?: number, byteLength?: number): DataView; } -declare var DataView: DataViewConstructor; +declare const DataView: DataViewConstructor; /** - * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested + * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested * number of bytes could not be allocated an exception is raised. */ interface Int8Array { /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ - BYTES_PER_ELEMENT: number; + readonly BYTES_PER_ELEMENT: number; /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ - buffer: ArrayBuffer; + readonly buffer: ArrayBuffer; /** * The length in bytes of the array. */ - byteLength: number; + readonly byteLength: number; /** * The offset in bytes of the array. */ - byteOffset: number; + readonly byteOffset: number; - /** + /** * Returns the this object after copying a section of the array identified by start and end * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * @param end If not specified, length of the this object is used as its default value. */ - copyWithin(target: number, start: number, end?: number): Int8Array; + copyWithin(target: number, start: number, end?: number): this; /** * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, * or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. @@ -1428,49 +1513,49 @@ interface Int8Array { /** * Returns the this object after filling the section identified by start and end with value * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ - fill(value: number, start?: number, end?: number): Int8Array; + fill(value: number, start?: number, end?: number): this; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - filter(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): Int8Array; + filter(callbackfn: (value: number, index: number, array: Int8Array) => any, thisArg?: any): Int8Array; - /** - * Returns the value of the first element in the array where predicate is true, and undefined + /** + * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; - /** - * Returns the index of the first element in the array where predicate is true, and undefined + /** + * Returns the index of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ findIndex(predicate: (value: number) => boolean, thisArg?: any): number; /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: number, index: number, array: Int8Array) => void, thisArg?: any): void; @@ -1485,7 +1570,7 @@ interface Int8Array { /** * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the + * @param separator A string used to separate one element of an array from the next in the * resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; @@ -1493,7 +1578,7 @@ interface Int8Array { /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the * search starts at index 0. */ lastIndexOf(searchElement: number, fromIndex?: number): number; @@ -1501,68 +1586,68 @@ interface Int8Array { /** * The length of the array. */ - length: number; + readonly length: number; /** - * Calls a defined callback function on each element of an array, and returns an array that + * Calls a defined callback function on each element of an array, and returns an array that * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: number, index: number, array: Int8Array) => number, thisArg?: any): Int8Array; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): Int8Array; @@ -1580,7 +1665,7 @@ interface Int8Array { */ set(array: ArrayLike, offset?: number): void; - /** + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. @@ -1589,31 +1674,31 @@ interface Int8Array { /** * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean; /** * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If + * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ - sort(compareFn?: (a: number, b: number) => number): Int8Array; + sort(compareFn?: (a: number, b: number) => number): this; /** * Gets a new Int8Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. + * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ subarray(begin: number, end?: number): Int8Array; /** - * Converts a number to a string by using the current locale. + * Converts a number to a string by using the current locale. */ toLocaleString(): string; @@ -1625,22 +1710,22 @@ interface Int8Array { [index: number]: number; } interface Int8ArrayConstructor { - prototype: Int8Array; + readonly prototype: Int8Array; new (length: number): Int8Array; new (array: ArrayLike): Int8Array; new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int8Array; /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ - BYTES_PER_ELEMENT: number; + readonly BYTES_PER_ELEMENT: number; /** * Returns a new array from a set of elements. * @param items A set of elements to include in the new array object. */ of(...items: number[]): Int8Array; - + /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. @@ -1650,48 +1735,48 @@ interface Int8ArrayConstructor { from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array; } -declare var Int8Array: Int8ArrayConstructor; +declare const Int8Array: Int8ArrayConstructor; /** - * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the + * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the * requested number of bytes could not be allocated an exception is raised. */ interface Uint8Array { /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ - BYTES_PER_ELEMENT: number; + readonly BYTES_PER_ELEMENT: number; /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ - buffer: ArrayBuffer; + readonly buffer: ArrayBuffer; /** * The length in bytes of the array. */ - byteLength: number; + readonly byteLength: number; /** * The offset in bytes of the array. */ - byteOffset: number; + readonly byteOffset: number; - /** + /** * Returns the this object after copying a section of the array identified by start and end * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * @param end If not specified, length of the this object is used as its default value. */ - copyWithin(target: number, start: number, end?: number): Uint8Array; + copyWithin(target: number, start: number, end?: number): this; /** * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, * or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. @@ -1701,49 +1786,49 @@ interface Uint8Array { /** * Returns the this object after filling the section identified by start and end with value * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ - fill(value: number, start?: number, end?: number): Uint8Array; + fill(value: number, start?: number, end?: number): this; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - filter(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): Uint8Array; + filter(callbackfn: (value: number, index: number, array: Uint8Array) => any, thisArg?: any): Uint8Array; - /** - * Returns the value of the first element in the array where predicate is true, and undefined + /** + * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; - /** - * Returns the index of the first element in the array where predicate is true, and undefined + /** + * Returns the index of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ findIndex(predicate: (value: number) => boolean, thisArg?: any): number; /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: number, index: number, array: Uint8Array) => void, thisArg?: any): void; @@ -1758,7 +1843,7 @@ interface Uint8Array { /** * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the + * @param separator A string used to separate one element of an array from the next in the * resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; @@ -1766,7 +1851,7 @@ interface Uint8Array { /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the * search starts at index 0. */ lastIndexOf(searchElement: number, fromIndex?: number): number; @@ -1774,68 +1859,68 @@ interface Uint8Array { /** * The length of the array. */ - length: number; + readonly length: number; /** - * Calls a defined callback function on each element of an array, and returns an array that + * Calls a defined callback function on each element of an array, and returns an array that * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: number, index: number, array: Uint8Array) => number, thisArg?: any): Uint8Array; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): Uint8Array; @@ -1853,7 +1938,7 @@ interface Uint8Array { */ set(array: ArrayLike, offset?: number): void; - /** + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. @@ -1862,31 +1947,31 @@ interface Uint8Array { /** * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean; /** * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If + * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ - sort(compareFn?: (a: number, b: number) => number): Uint8Array; + sort(compareFn?: (a: number, b: number) => number): this; /** * Gets a new Uint8Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. + * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ subarray(begin: number, end?: number): Uint8Array; /** - * Converts a number to a string by using the current locale. + * Converts a number to a string by using the current locale. */ toLocaleString(): string; @@ -1899,22 +1984,22 @@ interface Uint8Array { } interface Uint8ArrayConstructor { - prototype: Uint8Array; + readonly prototype: Uint8Array; new (length: number): Uint8Array; new (array: ArrayLike): Uint8Array; new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8Array; /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ - BYTES_PER_ELEMENT: number; + readonly BYTES_PER_ELEMENT: number; /** * Returns a new array from a set of elements. * @param items A set of elements to include in the new array object. */ of(...items: number[]): Uint8Array; - + /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. @@ -1924,48 +2009,48 @@ interface Uint8ArrayConstructor { from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array; } -declare var Uint8Array: Uint8ArrayConstructor; +declare const Uint8Array: Uint8ArrayConstructor; /** - * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. + * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. * If the requested number of bytes could not be allocated an exception is raised. */ interface Uint8ClampedArray { /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ - BYTES_PER_ELEMENT: number; + readonly BYTES_PER_ELEMENT: number; /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ - buffer: ArrayBuffer; + readonly buffer: ArrayBuffer; /** * The length in bytes of the array. */ - byteLength: number; + readonly byteLength: number; /** * The offset in bytes of the array. */ - byteOffset: number; + readonly byteOffset: number; - /** + /** * Returns the this object after copying a section of the array identified by start and end * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * @param end If not specified, length of the this object is used as its default value. */ - copyWithin(target: number, start: number, end?: number): Uint8ClampedArray; + copyWithin(target: number, start: number, end?: number): this; /** * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, * or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. @@ -1975,49 +2060,49 @@ interface Uint8ClampedArray { /** * Returns the this object after filling the section identified by start and end with value * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ - fill(value: number, start?: number, end?: number): Uint8ClampedArray; + fill(value: number, start?: number, end?: number): this; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - filter(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): Uint8ClampedArray; + filter(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => any, thisArg?: any): Uint8ClampedArray; - /** - * Returns the value of the first element in the array where predicate is true, and undefined + /** + * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; - /** - * Returns the index of the first element in the array where predicate is true, and undefined + /** + * Returns the index of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ findIndex(predicate: (value: number) => boolean, thisArg?: any): number; /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => void, thisArg?: any): void; @@ -2032,7 +2117,7 @@ interface Uint8ClampedArray { /** * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the + * @param separator A string used to separate one element of an array from the next in the * resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; @@ -2040,7 +2125,7 @@ interface Uint8ClampedArray { /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the * search starts at index 0. */ lastIndexOf(searchElement: number, fromIndex?: number): number; @@ -2048,68 +2133,68 @@ interface Uint8ClampedArray { /** * The length of the array. */ - length: number; + readonly length: number; /** - * Calls a defined callback function on each element of an array, and returns an array that + * Calls a defined callback function on each element of an array, and returns an array that * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => number, thisArg?: any): Uint8ClampedArray; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): Uint8ClampedArray; @@ -2127,7 +2212,7 @@ interface Uint8ClampedArray { */ set(array: Uint8ClampedArray, offset?: number): void; - /** + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. @@ -2136,31 +2221,31 @@ interface Uint8ClampedArray { /** * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): boolean; /** * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If + * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ - sort(compareFn?: (a: number, b: number) => number): Uint8ClampedArray; + sort(compareFn?: (a: number, b: number) => number): this; /** * Gets a new Uint8ClampedArray view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. + * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ subarray(begin: number, end?: number): Uint8ClampedArray; /** - * Converts a number to a string by using the current locale. + * Converts a number to a string by using the current locale. */ toLocaleString(): string; @@ -2173,15 +2258,15 @@ interface Uint8ClampedArray { } interface Uint8ClampedArrayConstructor { - prototype: Uint8ClampedArray; + readonly prototype: Uint8ClampedArray; new (length: number): Uint8ClampedArray; new (array: ArrayLike): Uint8ClampedArray; new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8ClampedArray; /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ - BYTES_PER_ELEMENT: number; + readonly BYTES_PER_ELEMENT: number; /** * Returns a new array from a set of elements. @@ -2197,48 +2282,48 @@ interface Uint8ClampedArrayConstructor { */ from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray; } -declare var Uint8ClampedArray: Uint8ClampedArrayConstructor; +declare const Uint8ClampedArray: Uint8ClampedArrayConstructor; /** - * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the + * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the * requested number of bytes could not be allocated an exception is raised. */ interface Int16Array { /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ - BYTES_PER_ELEMENT: number; + readonly BYTES_PER_ELEMENT: number; /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ - buffer: ArrayBuffer; + readonly buffer: ArrayBuffer; /** * The length in bytes of the array. */ - byteLength: number; + readonly byteLength: number; /** * The offset in bytes of the array. */ - byteOffset: number; + readonly byteOffset: number; - /** + /** * Returns the this object after copying a section of the array identified by start and end * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * @param end If not specified, length of the this object is used as its default value. */ - copyWithin(target: number, start: number, end?: number): Int16Array; + copyWithin(target: number, start: number, end?: number): this; /** * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, * or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. @@ -2248,49 +2333,49 @@ interface Int16Array { /** * Returns the this object after filling the section identified by start and end with value * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ - fill(value: number, start?: number, end?: number): Int16Array; + fill(value: number, start?: number, end?: number): this; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - filter(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): Int16Array; + filter(callbackfn: (value: number, index: number, array: Int16Array) => any, thisArg?: any): Int16Array; - /** - * Returns the value of the first element in the array where predicate is true, and undefined + /** + * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; - /** - * Returns the index of the first element in the array where predicate is true, and undefined + /** + * Returns the index of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ findIndex(predicate: (value: number) => boolean, thisArg?: any): number; /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: number, index: number, array: Int16Array) => void, thisArg?: any): void; @@ -2305,7 +2390,7 @@ interface Int16Array { /** * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the + * @param separator A string used to separate one element of an array from the next in the * resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; @@ -2313,7 +2398,7 @@ interface Int16Array { /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the * search starts at index 0. */ lastIndexOf(searchElement: number, fromIndex?: number): number; @@ -2321,68 +2406,68 @@ interface Int16Array { /** * The length of the array. */ - length: number; + readonly length: number; /** - * Calls a defined callback function on each element of an array, and returns an array that + * Calls a defined callback function on each element of an array, and returns an array that * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: number, index: number, array: Int16Array) => number, thisArg?: any): Int16Array; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): Int16Array; @@ -2400,7 +2485,7 @@ interface Int16Array { */ set(array: ArrayLike, offset?: number): void; - /** + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. @@ -2409,31 +2494,31 @@ interface Int16Array { /** * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean; /** * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If + * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ - sort(compareFn?: (a: number, b: number) => number): Int16Array; + sort(compareFn?: (a: number, b: number) => number): this; /** * Gets a new Int16Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. + * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ subarray(begin: number, end?: number): Int16Array; /** - * Converts a number to a string by using the current locale. + * Converts a number to a string by using the current locale. */ toLocaleString(): string; @@ -2446,22 +2531,22 @@ interface Int16Array { } interface Int16ArrayConstructor { - prototype: Int16Array; + readonly prototype: Int16Array; new (length: number): Int16Array; new (array: ArrayLike): Int16Array; new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int16Array; /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ - BYTES_PER_ELEMENT: number; + readonly BYTES_PER_ELEMENT: number; /** * Returns a new array from a set of elements. * @param items A set of elements to include in the new array object. */ of(...items: number[]): Int16Array; - + /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. @@ -2471,48 +2556,48 @@ interface Int16ArrayConstructor { from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array; } -declare var Int16Array: Int16ArrayConstructor; +declare const Int16Array: Int16ArrayConstructor; /** - * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the + * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the * requested number of bytes could not be allocated an exception is raised. */ interface Uint16Array { /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ - BYTES_PER_ELEMENT: number; + readonly BYTES_PER_ELEMENT: number; /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ - buffer: ArrayBuffer; + readonly buffer: ArrayBuffer; /** * The length in bytes of the array. */ - byteLength: number; + readonly byteLength: number; /** * The offset in bytes of the array. */ - byteOffset: number; + readonly byteOffset: number; - /** + /** * Returns the this object after copying a section of the array identified by start and end * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * @param end If not specified, length of the this object is used as its default value. */ - copyWithin(target: number, start: number, end?: number): Uint16Array; + copyWithin(target: number, start: number, end?: number): this; /** * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, * or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. @@ -2522,49 +2607,49 @@ interface Uint16Array { /** * Returns the this object after filling the section identified by start and end with value * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ - fill(value: number, start?: number, end?: number): Uint16Array; + fill(value: number, start?: number, end?: number): this; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - filter(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): Uint16Array; + filter(callbackfn: (value: number, index: number, array: Uint16Array) => any, thisArg?: any): Uint16Array; - /** - * Returns the value of the first element in the array where predicate is true, and undefined + /** + * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; - /** - * Returns the index of the first element in the array where predicate is true, and undefined + /** + * Returns the index of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ findIndex(predicate: (value: number) => boolean, thisArg?: any): number; /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: number, index: number, array: Uint16Array) => void, thisArg?: any): void; @@ -2579,7 +2664,7 @@ interface Uint16Array { /** * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the + * @param separator A string used to separate one element of an array from the next in the * resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; @@ -2587,7 +2672,7 @@ interface Uint16Array { /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the * search starts at index 0. */ lastIndexOf(searchElement: number, fromIndex?: number): number; @@ -2595,68 +2680,68 @@ interface Uint16Array { /** * The length of the array. */ - length: number; + readonly length: number; /** - * Calls a defined callback function on each element of an array, and returns an array that + * Calls a defined callback function on each element of an array, and returns an array that * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: number, index: number, array: Uint16Array) => number, thisArg?: any): Uint16Array; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): Uint16Array; @@ -2674,7 +2759,7 @@ interface Uint16Array { */ set(array: ArrayLike, offset?: number): void; - /** + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. @@ -2683,31 +2768,31 @@ interface Uint16Array { /** * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean; /** * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If + * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ - sort(compareFn?: (a: number, b: number) => number): Uint16Array; + sort(compareFn?: (a: number, b: number) => number): this; /** * Gets a new Uint16Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. + * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ subarray(begin: number, end?: number): Uint16Array; /** - * Converts a number to a string by using the current locale. + * Converts a number to a string by using the current locale. */ toLocaleString(): string; @@ -2720,22 +2805,22 @@ interface Uint16Array { } interface Uint16ArrayConstructor { - prototype: Uint16Array; + readonly prototype: Uint16Array; new (length: number): Uint16Array; new (array: ArrayLike): Uint16Array; new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint16Array; /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ - BYTES_PER_ELEMENT: number; + readonly BYTES_PER_ELEMENT: number; /** * Returns a new array from a set of elements. * @param items A set of elements to include in the new array object. */ of(...items: number[]): Uint16Array; - + /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. @@ -2745,47 +2830,47 @@ interface Uint16ArrayConstructor { from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array; } -declare var Uint16Array: Uint16ArrayConstructor; +declare const Uint16Array: Uint16ArrayConstructor; /** - * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the + * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the * requested number of bytes could not be allocated an exception is raised. */ interface Int32Array { /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ - BYTES_PER_ELEMENT: number; + readonly BYTES_PER_ELEMENT: number; /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ - buffer: ArrayBuffer; + readonly buffer: ArrayBuffer; /** * The length in bytes of the array. */ - byteLength: number; + readonly byteLength: number; /** * The offset in bytes of the array. */ - byteOffset: number; + readonly byteOffset: number; - /** + /** * Returns the this object after copying a section of the array identified by start and end * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * @param end If not specified, length of the this object is used as its default value. */ - copyWithin(target: number, start: number, end?: number): Int32Array; + copyWithin(target: number, start: number, end?: number): this; /** * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, * or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. @@ -2795,49 +2880,49 @@ interface Int32Array { /** * Returns the this object after filling the section identified by start and end with value * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ - fill(value: number, start?: number, end?: number): Int32Array; + fill(value: number, start?: number, end?: number): this; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - filter(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): Int32Array; + filter(callbackfn: (value: number, index: number, array: Int32Array) => any, thisArg?: any): Int32Array; - /** - * Returns the value of the first element in the array where predicate is true, and undefined + /** + * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; - /** - * Returns the index of the first element in the array where predicate is true, and undefined + /** + * Returns the index of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ findIndex(predicate: (value: number) => boolean, thisArg?: any): number; /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: number, index: number, array: Int32Array) => void, thisArg?: any): void; @@ -2852,7 +2937,7 @@ interface Int32Array { /** * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the + * @param separator A string used to separate one element of an array from the next in the * resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; @@ -2860,7 +2945,7 @@ interface Int32Array { /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the * search starts at index 0. */ lastIndexOf(searchElement: number, fromIndex?: number): number; @@ -2868,68 +2953,68 @@ interface Int32Array { /** * The length of the array. */ - length: number; + readonly length: number; /** - * Calls a defined callback function on each element of an array, and returns an array that + * Calls a defined callback function on each element of an array, and returns an array that * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: number, index: number, array: Int32Array) => number, thisArg?: any): Int32Array; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): Int32Array; @@ -2947,7 +3032,7 @@ interface Int32Array { */ set(array: ArrayLike, offset?: number): void; - /** + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. @@ -2956,31 +3041,31 @@ interface Int32Array { /** * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean; /** * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If + * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ - sort(compareFn?: (a: number, b: number) => number): Int32Array; + sort(compareFn?: (a: number, b: number) => number): this; /** * Gets a new Int32Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. + * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ subarray(begin: number, end?: number): Int32Array; /** - * Converts a number to a string by using the current locale. + * Converts a number to a string by using the current locale. */ toLocaleString(): string; @@ -2993,22 +3078,22 @@ interface Int32Array { } interface Int32ArrayConstructor { - prototype: Int32Array; + readonly prototype: Int32Array; new (length: number): Int32Array; new (array: ArrayLike): Int32Array; new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int32Array; /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ - BYTES_PER_ELEMENT: number; + readonly BYTES_PER_ELEMENT: number; /** * Returns a new array from a set of elements. * @param items A set of elements to include in the new array object. */ of(...items: number[]): Int32Array; - + /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. @@ -3017,48 +3102,48 @@ interface Int32ArrayConstructor { */ from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array; } -declare var Int32Array: Int32ArrayConstructor; +declare const Int32Array: Int32ArrayConstructor; /** - * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the + * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the * requested number of bytes could not be allocated an exception is raised. */ interface Uint32Array { /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ - BYTES_PER_ELEMENT: number; + readonly BYTES_PER_ELEMENT: number; /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ - buffer: ArrayBuffer; + readonly buffer: ArrayBuffer; /** * The length in bytes of the array. */ - byteLength: number; + readonly byteLength: number; /** * The offset in bytes of the array. */ - byteOffset: number; + readonly byteOffset: number; - /** + /** * Returns the this object after copying a section of the array identified by start and end * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * @param end If not specified, length of the this object is used as its default value. */ - copyWithin(target: number, start: number, end?: number): Uint32Array; + copyWithin(target: number, start: number, end?: number): this; /** * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, * or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. @@ -3068,49 +3153,49 @@ interface Uint32Array { /** * Returns the this object after filling the section identified by start and end with value * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ - fill(value: number, start?: number, end?: number): Uint32Array; + fill(value: number, start?: number, end?: number): this; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - filter(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): Uint32Array; + filter(callbackfn: (value: number, index: number, array: Uint32Array) => any, thisArg?: any): Uint32Array; - /** - * Returns the value of the first element in the array where predicate is true, and undefined + /** + * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; - /** - * Returns the index of the first element in the array where predicate is true, and undefined + /** + * Returns the index of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ findIndex(predicate: (value: number) => boolean, thisArg?: any): number; /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: number, index: number, array: Uint32Array) => void, thisArg?: any): void; @@ -3125,7 +3210,7 @@ interface Uint32Array { /** * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the + * @param separator A string used to separate one element of an array from the next in the * resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; @@ -3133,7 +3218,7 @@ interface Uint32Array { /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the * search starts at index 0. */ lastIndexOf(searchElement: number, fromIndex?: number): number; @@ -3141,68 +3226,68 @@ interface Uint32Array { /** * The length of the array. */ - length: number; + readonly length: number; /** - * Calls a defined callback function on each element of an array, and returns an array that + * Calls a defined callback function on each element of an array, and returns an array that * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: number, index: number, array: Uint32Array) => number, thisArg?: any): Uint32Array; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): Uint32Array; @@ -3220,7 +3305,7 @@ interface Uint32Array { */ set(array: ArrayLike, offset?: number): void; - /** + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. @@ -3229,31 +3314,31 @@ interface Uint32Array { /** * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean; /** * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If + * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ - sort(compareFn?: (a: number, b: number) => number): Uint32Array; + sort(compareFn?: (a: number, b: number) => number): this; /** * Gets a new Uint32Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. + * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ subarray(begin: number, end?: number): Uint32Array; /** - * Converts a number to a string by using the current locale. + * Converts a number to a string by using the current locale. */ toLocaleString(): string; @@ -3266,22 +3351,22 @@ interface Uint32Array { } interface Uint32ArrayConstructor { - prototype: Uint32Array; + readonly prototype: Uint32Array; new (length: number): Uint32Array; new (array: ArrayLike): Uint32Array; new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint32Array; /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ - BYTES_PER_ELEMENT: number; + readonly BYTES_PER_ELEMENT: number; /** * Returns a new array from a set of elements. * @param items A set of elements to include in the new array object. */ of(...items: number[]): Uint32Array; - + /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. @@ -3290,7 +3375,7 @@ interface Uint32ArrayConstructor { */ from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array; } -declare var Uint32Array: Uint32ArrayConstructor; +declare const Uint32Array: Uint32ArrayConstructor; /** * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number @@ -3298,40 +3383,40 @@ declare var Uint32Array: Uint32ArrayConstructor; */ interface Float32Array { /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ - BYTES_PER_ELEMENT: number; + readonly BYTES_PER_ELEMENT: number; /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ - buffer: ArrayBuffer; + readonly buffer: ArrayBuffer; /** * The length in bytes of the array. */ - byteLength: number; + readonly byteLength: number; /** * The offset in bytes of the array. */ - byteOffset: number; + readonly byteOffset: number; - /** + /** * Returns the this object after copying a section of the array identified by start and end * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * @param end If not specified, length of the this object is used as its default value. */ - copyWithin(target: number, start: number, end?: number): Float32Array; + copyWithin(target: number, start: number, end?: number): this; /** * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, * or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. @@ -3341,49 +3426,49 @@ interface Float32Array { /** * Returns the this object after filling the section identified by start and end with value * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ - fill(value: number, start?: number, end?: number): Float32Array; + fill(value: number, start?: number, end?: number): this; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - filter(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): Float32Array; + filter(callbackfn: (value: number, index: number, array: Float32Array) => any, thisArg?: any): Float32Array; - /** - * Returns the value of the first element in the array where predicate is true, and undefined + /** + * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; - /** - * Returns the index of the first element in the array where predicate is true, and undefined + /** + * Returns the index of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ findIndex(predicate: (value: number) => boolean, thisArg?: any): number; /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: number, index: number, array: Float32Array) => void, thisArg?: any): void; @@ -3398,7 +3483,7 @@ interface Float32Array { /** * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the + * @param separator A string used to separate one element of an array from the next in the * resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; @@ -3406,7 +3491,7 @@ interface Float32Array { /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the * search starts at index 0. */ lastIndexOf(searchElement: number, fromIndex?: number): number; @@ -3414,68 +3499,68 @@ interface Float32Array { /** * The length of the array. */ - length: number; + readonly length: number; /** - * Calls a defined callback function on each element of an array, and returns an array that + * Calls a defined callback function on each element of an array, and returns an array that * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: number, index: number, array: Float32Array) => number, thisArg?: any): Float32Array; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): Float32Array; @@ -3493,7 +3578,7 @@ interface Float32Array { */ set(array: ArrayLike, offset?: number): void; - /** + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. @@ -3502,31 +3587,31 @@ interface Float32Array { /** * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean; /** * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If + * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ - sort(compareFn?: (a: number, b: number) => number): Float32Array; + sort(compareFn?: (a: number, b: number) => number): this; /** * Gets a new Float32Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. + * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ subarray(begin: number, end?: number): Float32Array; /** - * Converts a number to a string by using the current locale. + * Converts a number to a string by using the current locale. */ toLocaleString(): string; @@ -3539,22 +3624,22 @@ interface Float32Array { } interface Float32ArrayConstructor { - prototype: Float32Array; + readonly prototype: Float32Array; new (length: number): Float32Array; new (array: ArrayLike): Float32Array; new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float32Array; /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ - BYTES_PER_ELEMENT: number; + readonly BYTES_PER_ELEMENT: number; /** * Returns a new array from a set of elements. * @param items A set of elements to include in the new array object. */ of(...items: number[]): Float32Array; - + /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. @@ -3564,48 +3649,48 @@ interface Float32ArrayConstructor { from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array; } -declare var Float32Array: Float32ArrayConstructor; +declare const Float32Array: Float32ArrayConstructor; /** - * A typed array of 64-bit float values. The contents are initialized to 0. If the requested + * A typed array of 64-bit float values. The contents are initialized to 0. If the requested * number of bytes could not be allocated an exception is raised. */ interface Float64Array { /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ - BYTES_PER_ELEMENT: number; + readonly BYTES_PER_ELEMENT: number; /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ - buffer: ArrayBuffer; + readonly buffer: ArrayBuffer; /** * The length in bytes of the array. */ - byteLength: number; + readonly byteLength: number; /** * The offset in bytes of the array. */ - byteOffset: number; + readonly byteOffset: number; - /** + /** * Returns the this object after copying a section of the array identified by start and end * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * @param end If not specified, length of the this object is used as its default value. */ - copyWithin(target: number, start: number, end?: number): Float64Array; + copyWithin(target: number, start: number, end?: number): this; /** * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, * or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. @@ -3615,49 +3700,49 @@ interface Float64Array { /** * Returns the this object after filling the section identified by start and end with value * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ - fill(value: number, start?: number, end?: number): Float64Array; + fill(value: number, start?: number, end?: number): this; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - filter(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): Float64Array; + filter(callbackfn: (value: number, index: number, array: Float64Array) => any, thisArg?: any): Float64Array; - /** - * Returns the value of the first element in the array where predicate is true, and undefined + /** + * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; - /** - * Returns the index of the first element in the array where predicate is true, and undefined + /** + * Returns the index of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ findIndex(predicate: (value: number) => boolean, thisArg?: any): number; /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: number, index: number, array: Float64Array) => void, thisArg?: any): void; @@ -3672,7 +3757,7 @@ interface Float64Array { /** * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the + * @param separator A string used to separate one element of an array from the next in the * resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; @@ -3680,7 +3765,7 @@ interface Float64Array { /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the * search starts at index 0. */ lastIndexOf(searchElement: number, fromIndex?: number): number; @@ -3688,68 +3773,68 @@ interface Float64Array { /** * The length of the array. */ - length: number; + readonly length: number; /** - * Calls a defined callback function on each element of an array, and returns an array that + * Calls a defined callback function on each element of an array, and returns an array that * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: number, index: number, array: Float64Array) => number, thisArg?: any): Float64Array; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): Float64Array; @@ -3767,7 +3852,7 @@ interface Float64Array { */ set(array: ArrayLike, offset?: number): void; - /** + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. @@ -3776,31 +3861,31 @@ interface Float64Array { /** * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean; /** * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If + * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ - sort(compareFn?: (a: number, b: number) => number): Float64Array; + sort(compareFn?: (a: number, b: number) => number): this; /** * Gets a new Float64Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. + * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ subarray(begin: number, end?: number): Float64Array; /** - * Converts a number to a string by using the current locale. + * Converts a number to a string by using the current locale. */ toLocaleString(): string; @@ -3813,22 +3898,22 @@ interface Float64Array { } interface Float64ArrayConstructor { - prototype: Float64Array; + readonly prototype: Float64Array; new (length: number): Float64Array; new (array: ArrayLike): Float64Array; new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float64Array; /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ - BYTES_PER_ELEMENT: number; + readonly BYTES_PER_ELEMENT: number; /** * Returns a new array from a set of elements. * @param items A set of elements to include in the new array object. */ of(...items: number[]): Float64Array; - + /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. @@ -3837,4 +3922,205 @@ interface Float64ArrayConstructor { */ from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; } -declare var Float64Array: Float64ArrayConstructor; +declare const Float64Array: Float64ArrayConstructor; + +///////////////////////////// +/// ECMAScript Internationalization API +///////////////////////////// + +declare module Intl { + interface CollatorOptions { + usage?: string; + localeMatcher?: string; + numeric?: boolean; + caseFirst?: string; + sensitivity?: string; + ignorePunctuation?: boolean; + } + + interface ResolvedCollatorOptions { + locale: string; + usage: string; + sensitivity: string; + ignorePunctuation: boolean; + collation: string; + caseFirst: string; + numeric: boolean; + } + + interface Collator { + compare(x: string, y: string): number; + resolvedOptions(): ResolvedCollatorOptions; + } + var Collator: { + new (locales?: string[], options?: CollatorOptions): Collator; + new (locale?: string, options?: CollatorOptions): Collator; + (locales?: string[], options?: CollatorOptions): Collator; + (locale?: string, options?: CollatorOptions): Collator; + supportedLocalesOf(locales: string[], options?: CollatorOptions): string[]; + supportedLocalesOf(locale: string, options?: CollatorOptions): string[]; + } + + interface NumberFormatOptions { + localeMatcher?: string; + style?: string; + currency?: string; + currencyDisplay?: string; + useGrouping?: boolean; + minimumIntegerDigits?: number; + minimumFractionDigits?: number; + maximumFractionDigits?: number; + minimumSignificantDigits?: number; + maximumSignificantDigits?: number; + } + + interface ResolvedNumberFormatOptions { + locale: string; + numberingSystem: string; + style: string; + currency?: string; + currencyDisplay?: string; + minimumIntegerDigits: number; + minimumFractionDigits: number; + maximumFractionDigits: number; + minimumSignificantDigits?: number; + maximumSignificantDigits?: number; + useGrouping: boolean; + } + + interface NumberFormat { + format(value: number): string; + resolvedOptions(): ResolvedNumberFormatOptions; + } + var NumberFormat: { + new (locales?: string[], options?: NumberFormatOptions): NumberFormat; + new (locale?: string, options?: NumberFormatOptions): NumberFormat; + (locales?: string[], options?: NumberFormatOptions): NumberFormat; + (locale?: string, options?: NumberFormatOptions): NumberFormat; + supportedLocalesOf(locales: string[], options?: NumberFormatOptions): string[]; + supportedLocalesOf(locale: string, options?: NumberFormatOptions): string[]; + } + + interface DateTimeFormatOptions { + localeMatcher?: string; + weekday?: string; + era?: string; + year?: string; + month?: string; + day?: string; + hour?: string; + minute?: string; + second?: string; + timeZoneName?: string; + formatMatcher?: string; + hour12?: boolean; + timeZone?: string; + } + + interface ResolvedDateTimeFormatOptions { + locale: string; + calendar: string; + numberingSystem: string; + timeZone: string; + hour12?: boolean; + weekday?: string; + era?: string; + year?: string; + month?: string; + day?: string; + hour?: string; + minute?: string; + second?: string; + timeZoneName?: string; + } + + interface DateTimeFormat { + format(date?: Date | number): string; + resolvedOptions(): ResolvedDateTimeFormatOptions; + } + var DateTimeFormat: { + new (locales?: string[], options?: DateTimeFormatOptions): DateTimeFormat; + new (locale?: string, options?: DateTimeFormatOptions): DateTimeFormat; + (locales?: string[], options?: DateTimeFormatOptions): DateTimeFormat; + (locale?: string, options?: DateTimeFormatOptions): DateTimeFormat; + supportedLocalesOf(locales: string[], options?: DateTimeFormatOptions): string[]; + supportedLocalesOf(locale: string, options?: DateTimeFormatOptions): string[]; + } +} + +interface String { + /** + * Determines whether two strings are equivalent in the current locale. + * @param that String to compare to target string + * @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. This parameter must conform to BCP 47 standards; see the Intl.Collator object for details. + * @param options An object that contains one or more properties that specify comparison options. see the Intl.Collator object for details. + */ + localeCompare(that: string, locales: string[], options?: Intl.CollatorOptions): number; + + /** + * Determines whether two strings are equivalent in the current locale. + * @param that String to compare to target string + * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. This parameter must conform to BCP 47 standards; see the Intl.Collator object for details. + * @param options An object that contains one or more properties that specify comparison options. see the Intl.Collator object for details. + */ + localeCompare(that: string, locale: string, options?: Intl.CollatorOptions): number; +} + +interface Number { + /** + * Converts a number to a string by using the current or specified locale. + * @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleString(locales?: string[], options?: Intl.NumberFormatOptions): string; + + /** + * Converts a number to a string by using the current or specified locale. + * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleString(locale?: string, options?: Intl.NumberFormatOptions): string; +} + +interface Date { + /** + * Converts a date and time to a string by using the current or specified locale. + * @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleString(locales?: string[], options?: Intl.DateTimeFormatOptions): string; + /** + * Converts a date to a string by using the current or specified locale. + * @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleDateString(locales?: string[], options?: Intl.DateTimeFormatOptions): string; + + /** + * Converts a time to a string by using the current or specified locale. + * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleTimeString(locale?: string[], options?: Intl.DateTimeFormatOptions): string; + + /** + * Converts a date and time to a string by using the current or specified locale. + * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleString(locale?: string, options?: Intl.DateTimeFormatOptions): string; + + /** + * Converts a date to a string by using the current or specified locale. + * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleDateString(locale?: string, options?: Intl.DateTimeFormatOptions): string; + + /** + * Converts a time to a string by using the current or specified locale. + * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleTimeString(locale?: string, options?: Intl.DateTimeFormatOptions): string; +} diff --git a/lib/lib.es6.d.ts b/lib/lib.es6.d.ts index 564c302031d..6ed743d739a 100644 --- a/lib/lib.es6.d.ts +++ b/lib/lib.es6.d.ts @@ -13,1332 +13,16 @@ See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ -declare type PropertyKey = string | number | symbol; - -interface Symbol { - /** Returns a string representation of an object. */ - toString(): string; - - /** Returns the primitive value of the specified object. */ - valueOf(): Object; - - [Symbol.toStringTag]: string; -} - -interface SymbolConstructor { - /** - * A reference to the prototype. - */ - prototype: Symbol; - - /** - * Returns a new unique Symbol value. - * @param description Description of the new Symbol object. - */ - (description?: string|number): symbol; - - /** - * Returns a Symbol object from the global symbol registry matching the given key if found. - * Otherwise, returns a new symbol with this key. - * @param key key to search for. - */ - for(key: string): symbol; - - /** - * Returns a key from the global symbol registry matching the given Symbol if found. - * Otherwise, returns a undefined. - * @param sym Symbol to find the key for. - */ - keyFor(sym: symbol): string; - - // Well-known Symbols - - /** - * A method that determines if a constructor object recognizes an object as one of the - * constructor’s instances. Called by the semantics of the instanceof operator. - */ - hasInstance: symbol; - - /** - * A Boolean value that if true indicates that an object should flatten to its array elements - * by Array.prototype.concat. - */ - isConcatSpreadable: symbol; - - /** - * A method that returns the default iterator for an object. Called by the semantics of the - * for-of statement. - */ - iterator: symbol; - - /** - * A regular expression method that matches the regular expression against a string. Called - * by the String.prototype.match method. - */ - match: symbol; - - /** - * A regular expression method that replaces matched substrings of a string. Called by the - * String.prototype.replace method. - */ - replace: symbol; - - /** - * A regular expression method that returns the index within a string that matches the - * regular expression. Called by the String.prototype.search method. - */ - search: symbol; - - /** - * A function valued property that is the constructor function that is used to create - * derived objects. - */ - species: symbol; - - /** - * A regular expression method that splits a string at the indices that match the regular - * expression. Called by the String.prototype.split method. - */ - split: symbol; - - /** - * A method that converts an object to a corresponding primitive value. - * Called by the ToPrimitive abstract operation. - */ - toPrimitive: symbol; - - /** - * A String value that is used in the creation of the default string description of an object. - * Called by the built-in method Object.prototype.toString. - */ - toStringTag: symbol; - - /** - * An Object whose own property names are property names that are excluded from the 'with' - * environment bindings of the associated objects. - */ - unscopables: symbol; -} -declare var Symbol: SymbolConstructor; - -interface Object { - /** - * Determines whether an object has a property with the specified name. - * @param v A property name. - */ - hasOwnProperty(v: PropertyKey): boolean; - - /** - * Determines whether a specified property is enumerable. - * @param v A property name. - */ - propertyIsEnumerable(v: PropertyKey): boolean; -} - -interface ObjectConstructor { - /** - * Copy the values of all of the enumerable own properties from one or more source objects to a - * target object. Returns the target object. - * @param target The target object to copy to. - * @param source The source object from which to copy properties. - */ - assign(target: T, source: U): T & U; - - /** - * Copy the values of all of the enumerable own properties from one or more source objects to a - * target object. Returns the target object. - * @param target The target object to copy to. - * @param source1 The first source object from which to copy properties. - * @param source2 The second source object from which to copy properties. - */ - assign(target: T, source1: U, source2: V): T & U & V; - - /** - * Copy the values of all of the enumerable own properties from one or more source objects to a - * target object. Returns the target object. - * @param target The target object to copy to. - * @param source1 The first source object from which to copy properties. - * @param source2 The second source object from which to copy properties. - * @param source3 The third source object from which to copy properties. - */ - assign(target: T, source1: U, source2: V, source3: W): T & U & V & W; - - /** - * Copy the values of all of the enumerable own properties from one or more source objects to a - * target object. Returns the target object. - * @param target The target object to copy to. - * @param sources One or more source objects from which to copy properties - */ - assign(target: any, ...sources: any[]): any; - - /** - * Returns an array of all symbol properties found directly on object o. - * @param o Object to retrieve the symbols from. - */ - getOwnPropertySymbols(o: any): symbol[]; - - /** - * Returns true if the values are the same value, false otherwise. - * @param value1 The first value. - * @param value2 The second value. - */ - is(value1: any, value2: any): boolean; - - /** - * Sets the prototype of a specified object o to object proto or null. Returns the object o. - * @param o The object to change its prototype. - * @param proto The value of the new prototype or null. - */ - setPrototypeOf(o: any, proto: any): any; - - /** - * Gets the own property descriptor of the specified object. - * An own property descriptor is one that is defined directly on the object and is not - * inherited from the object's prototype. - * @param o Object that contains the property. - * @param p Name of the property. - */ - getOwnPropertyDescriptor(o: any, propertyKey: PropertyKey): PropertyDescriptor; - - /** - * Adds a property to an object, or modifies attributes of an existing property. - * @param o Object on which to add or modify the property. This can be a native JavaScript - * object (that is, a user-defined object or a built in object) or a DOM object. - * @param p The property name. - * @param attributes Descriptor for the property. It can be for a data property or an accessor - * property. - */ - defineProperty(o: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): any; -} - -interface Function { - /** - * Returns the name of the function. Function names are read-only and can not be changed. - */ - name: string; - - /** - * Determines whether the given value inherits from this function if this function was used - * as a constructor function. - * - * A constructor function can control which objects are recognized as its instances by - * 'instanceof' by overriding this method. - */ - [Symbol.hasInstance](value: any): boolean; -} - -interface NumberConstructor { - /** - * The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1 - * that is representable as a Number value, which is approximately: - * 2.2204460492503130808472633361816 x 10‍−‍16. - */ - EPSILON: number; - - /** - * Returns true if passed value is finite. - * Unlike the global isFininte, Number.isFinite doesn't forcibly convert the parameter to a - * number. Only finite values of the type number, result in true. - * @param number A numeric value. - */ - isFinite(number: number): boolean; - - /** - * Returns true if the value passed is an integer, false otherwise. - * @param number A numeric value. - */ - isInteger(number: number): boolean; - - /** - * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a - * number). Unlike the global isNaN(), Number.isNaN() doesn't forcefully convert the parameter - * to a number. Only values of the type number, that are also NaN, result in true. - * @param number A numeric value. - */ - isNaN(number: number): boolean; - - /** - * Returns true if the value passed is a safe integer. - * @param number A numeric value. - */ - isSafeInteger(number: number): boolean; - - /** - * The value of the largest integer n such that n and n + 1 are both exactly representable as - * a Number value. - * The value of Number.MIN_SAFE_INTEGER is 9007199254740991 2^53 − 1. - */ - MAX_SAFE_INTEGER: number; - - /** - * The value of the smallest integer n such that n and n − 1 are both exactly representable as - * a Number value. - * The value of Number.MIN_SAFE_INTEGER is −9007199254740991 (−(2^53 − 1)). - */ - MIN_SAFE_INTEGER: number; - - /** - * Converts a string to a floating-point number. - * @param string A string that contains a floating-point number. - */ - parseFloat(string: string): number; - - /** - * Converts A string to an integer. - * @param s A string to convert into a number. - * @param radix A value between 2 and 36 that specifies the base of the number in numString. - * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. - * All other strings are considered decimal. - */ - parseInt(string: string, radix?: number): number; -} - -interface Array { - /** Iterator */ - [Symbol.iterator](): IterableIterator; - - /** - * Returns an object whose properties have the value 'true' - * when they will be absent when used in a 'with' statement. - */ - [Symbol.unscopables](): { - copyWithin: boolean; - entries: boolean; - fill: boolean; - find: boolean; - findIndex: boolean; - keys: boolean; - values: boolean; - }; - - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, T]>; - - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: T, index: number, obj: Array) => boolean, thisArg?: any): T; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: T) => boolean, thisArg?: any): number; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: T, start?: number, end?: number): T[]; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): T[]; -} - -interface IArguments { - /** Iterator */ - [Symbol.iterator](): IterableIterator; -} - -interface ArrayConstructor { - /** - * Creates an array from an array-like object. - * @param arrayLike An array-like object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): Array; - - /** - * Creates an array from an iterable object. - * @param iterable An iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(iterable: Iterable, mapfn: (v: T, k: number) => U, thisArg?: any): Array; - - /** - * Creates an array from an array-like object. - * @param arrayLike An array-like object to convert to an array. - */ - from(arrayLike: ArrayLike): Array; - - /** - * Creates an array from an iterable object. - * @param iterable An iterable object to convert to an array. - */ - from(iterable: Iterable): Array; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: T[]): Array; -} - -interface String { - /** Iterator */ - [Symbol.iterator](): IterableIterator; - - /** - * Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point - * value of the UTF-16 encoded code point starting at the string element at position pos in - * the String resulting from converting this object to a String. - * If there is no element at that position, the result is undefined. - * If a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos. - */ - codePointAt(pos: number): number; - - /** - * Returns true if searchString appears as a substring of the result of converting this - * object to a String, at one or more positions that are - * greater than or equal to position; otherwise, returns false. - * @param searchString search string - * @param position If position is undefined, 0 is assumed, so as to search all of the String. - */ - includes(searchString: string, position?: number): boolean; - - /** - * Returns true if the sequence of elements of searchString converted to a String is the - * same as the corresponding elements of this object (converted to a String) starting at - * endPosition – length(this). Otherwise returns false. - */ - endsWith(searchString: string, endPosition?: number): boolean; - - /** - * Returns the String value result of normalizing the string into the normalization form - * named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms. - * @param form Applicable values: "NFC", "NFD", "NFKC", or "NFKD", If not specified default - * is "NFC" - */ - normalize(form?: string): string; - - /** - * Returns a String value that is made from count copies appended together. If count is 0, - * T is the empty String is returned. - * @param count number of copies to append - */ - repeat(count: number): string; - - /** - * Returns true if the sequence of elements of searchString converted to a String is the - * same as the corresponding elements of this object (converted to a String) starting at - * position. Otherwise returns false. - */ - startsWith(searchString: string, position?: number): boolean; - - // Overloads for objects with methods of well-known symbols. - - /** - * Matches a string an object that supports being matched against, and returns an array containing the results of that search. - * @param matcher An object that supports being matched against. - */ - match(matcher: { [Symbol.match](string: string): RegExpMatchArray; }): RegExpMatchArray; - - /** - * Replaces text in a string, using an object that supports replacement within a string. - * @param searchValue A object can search for and replace matches within a string. - * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. - */ - replace(searchValue: { [Symbol.replace](string: string, replaceValue: string): string; }, replaceValue: string): string; - - /** - * Replaces text in a string, using an object that supports replacement within a string. - * @param searchValue A object can search for and replace matches within a string. - * @param replacer A function that returns the replacement text. - */ - replace(searchValue: { [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; }, replacer: (substring: string, ...args: any[]) => string): string; - - /** - * Finds the first substring match in a regular expression search. - * @param searcher An object which supports searching within a string. - */ - search(searcher: { [Symbol.search](string: string): number; }): number; - - /** - * Split a string into substrings using the specified separator and return them as an array. - * @param splitter An object that can split a string. - * @param limit A value used to limit the number of elements returned in the array. - */ - split(splitter: { [Symbol.split](string: string, limit?: number): string[]; }, limit?: number): string[]; - - /** - * Returns an HTML anchor element and sets the name attribute to the text value - * @param name - */ - anchor(name: string): string; - - /** Returns a HTML element */ - big(): string; - - /** Returns a HTML element */ - blink(): string; - - /** Returns a HTML element */ - bold(): string; - - /** Returns a HTML element */ - fixed(): string - - /** Returns a HTML element and sets the color attribute value */ - fontcolor(color: string): string - - /** Returns a HTML element and sets the size attribute value */ - fontsize(size: number): string; - - /** Returns a HTML element and sets the size attribute value */ - fontsize(size: string): string; - - /** Returns an HTML element */ - italics(): string; - - /** Returns an HTML element and sets the href attribute value */ - link(url: string): string; - - /** Returns a HTML element */ - small(): string; - - /** Returns a HTML element */ - strike(): string; - - /** Returns a HTML element */ - sub(): string; - - /** Returns a HTML element */ - sup(): string; -} - -interface StringConstructor { - /** - * Return the String value whose elements are, in order, the elements in the List elements. - * If length is 0, the empty string is returned. - */ - fromCodePoint(...codePoints: number[]): string; - - /** - * String.raw is intended for use as a tag function of a Tagged Template String. When called - * as such the first argument will be a well formed template call site object and the rest - * parameter will contain the substitution values. - * @param template A well-formed template string call site representation. - * @param substitutions A set of substitution values. - */ - raw(template: TemplateStringsArray, ...substitutions: any[]): string; -} - -interface IteratorResult { - done: boolean; - value?: T; -} - -interface Iterator { - next(value?: any): IteratorResult; - return?(value?: any): IteratorResult; - throw?(e?: any): IteratorResult; -} - -interface Iterable { - [Symbol.iterator](): Iterator; -} - -interface IterableIterator extends Iterator { - [Symbol.iterator](): IterableIterator; -} - -interface GeneratorFunction extends Function { - -} - -interface GeneratorFunctionConstructor { - /** - * Creates a new Generator function. - * @param args A list of arguments the function accepts. - */ - new (...args: string[]): GeneratorFunction; - (...args: string[]): GeneratorFunction; - prototype: GeneratorFunction; -} -declare var GeneratorFunction: GeneratorFunctionConstructor; - -interface Math { - /** - * Returns the number of leading zero bits in the 32-bit binary representation of a number. - * @param x A numeric expression. - */ - clz32(x: number): number; - - /** - * Returns the result of 32-bit multiplication of two numbers. - * @param x First number - * @param y Second number - */ - imul(x: number, y: number): number; - - /** - * Returns the sign of the x, indicating whether x is positive, negative or zero. - * @param x The numeric expression to test - */ - sign(x: number): number; - - /** - * Returns the base 10 logarithm of a number. - * @param x A numeric expression. - */ - log10(x: number): number; - - /** - * Returns the base 2 logarithm of a number. - * @param x A numeric expression. - */ - log2(x: number): number; - - /** - * Returns the natural logarithm of 1 + x. - * @param x A numeric expression. - */ - log1p(x: number): number; - - /** - * Returns the result of (e^x - 1) of x (e raised to the power of x, where e is the base of - * the natural logarithms). - * @param x A numeric expression. - */ - expm1(x: number): number; - - /** - * Returns the hyperbolic cosine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - cosh(x: number): number; - - /** - * Returns the hyperbolic sine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - sinh(x: number): number; - - /** - * Returns the hyperbolic tangent of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - tanh(x: number): number; - - /** - * Returns the inverse hyperbolic cosine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - acosh(x: number): number; - - /** - * Returns the inverse hyperbolic sine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - asinh(x: number): number; - - /** - * Returns the inverse hyperbolic tangent of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - atanh(x: number): number; - - /** - * Returns the square root of the sum of squares of its arguments. - * @param values Values to compute the square root for. - * If no arguments are passed, the result is +0. - * If there is only one argument, the result is the absolute value. - * If any argument is +Infinity or -Infinity, the result is +Infinity. - * If any argument is NaN, the result is NaN. - * If all arguments are either +0 or −0, the result is +0. - */ - hypot(...values: number[] ): number; - - /** - * Returns the integral part of the a numeric expression, x, removing any fractional digits. - * If x is already an integer, the result is x. - * @param x A numeric expression. - */ - trunc(x: number): number; - - /** - * Returns the nearest single precision float representation of a number. - * @param x A numeric expression. - */ - fround(x: number): number; - - /** - * Returns an implementation-dependent approximation to the cube root of number. - * @param x A numeric expression. - */ - cbrt(x: number): number; - - [Symbol.toStringTag]: string; -} - -interface Date { - /** - * Converts a Date object to a string. - */ - [Symbol.toPrimitive](hint: "default"): string; - /** - * Converts a Date object to a string. - */ - [Symbol.toPrimitive](hint: "string"): string; - /** - * Converts a Date object to a number. - */ - [Symbol.toPrimitive](hint: "number"): number; - /** - * Converts a Date object to a string or number. - * - * @param hint The strings "number", "string", or "default" to specify what primitive to return. - * - * @throws {TypeError} If 'hint' was given something other than "number", "string", or "default". - * @returns A number if 'hint' was "number", a string if 'hint' was "string" or "default". - */ - [Symbol.toPrimitive](hint: string): string | number; -} - -interface RegExp { - /** - * Matches a string with this regular expression, and returns an array containing the results of - * that search. - * @param string A string to search within. - */ - [Symbol.match](string: string): RegExpMatchArray; - - /** - * Replaces text in a string, using this regular expression. - * @param string A String object or string literal whose contents matching against - * this regular expression will be replaced - * @param replaceValue A String object or string literal containing the text to replace for every - * successful match of this regular expression. - */ - [Symbol.replace](string: string, replaceValue: string): string; - - /** - * Replaces text in a string, using this regular expression. - * @param string A String object or string literal whose contents matching against - * this regular expression will be replaced - * @param replacer A function that returns the replacement text. - */ - [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; - - /** - * Finds the position beginning first substring match in a regular expression search - * using this regular expression. - * - * @param string The string to search within. - */ - [Symbol.search](string: string): number; - - /** - * Returns an array of substrings that were delimited by strings in the original input that - * match against this regular expression. - * - * If the regular expression contains capturing parentheses, then each time this - * regular expression matches, the results (including any undefined results) of the - * capturing parentheses are spliced. - * - * @param string string value to split - * @param limit if not undefined, the output array is truncated so that it contains no more - * than 'limit' elements. - */ - [Symbol.split](string: string, limit?: number): string[]; - - /** - * Returns a string indicating the flags of the regular expression in question. This field is read-only. - * The characters in this string are sequenced and concatenated in the following order: - * - * - "g" for global - * - "i" for ignoreCase - * - "m" for multiline - * - "u" for unicode - * - "y" for sticky - * - * If no flags are set, the value is the empty string. - */ - flags: string; - - /** - * Returns a Boolean value indicating the state of the sticky flag (y) used with a regular - * expression. Default is false. Read-only. - */ - sticky: boolean; - - /** - * Returns a Boolean value indicating the state of the Unicode flag (u) used with a regular - * expression. Default is false. Read-only. - */ - unicode: boolean; -} - -interface RegExpConstructor { - [Symbol.species](): RegExpConstructor; -} - -interface Map { - clear(): void; - delete(key: K): boolean; - entries(): IterableIterator<[K, V]>; - forEach(callbackfn: (value: V, index: K, map: Map) => void, thisArg?: any): void; - get(key: K): V; - has(key: K): boolean; - keys(): IterableIterator; - set(key: K, value?: V): Map; - size: number; - values(): IterableIterator; - [Symbol.iterator]():IterableIterator<[K,V]>; - [Symbol.toStringTag]: string; -} - -interface MapConstructor { - new (): Map; - new (): Map; - new (iterable: Iterable<[K, V]>): Map; - prototype: Map; -} -declare var Map: MapConstructor; - -interface WeakMap { - clear(): void; - delete(key: K): boolean; - get(key: K): V; - has(key: K): boolean; - set(key: K, value?: V): WeakMap; - [Symbol.toStringTag]: string; -} - -interface WeakMapConstructor { - new (): WeakMap; - new (): WeakMap; - new (iterable: Iterable<[K, V]>): WeakMap; - prototype: WeakMap; -} -declare var WeakMap: WeakMapConstructor; - -interface Set { - add(value: T): Set; - clear(): void; - delete(value: T): boolean; - entries(): IterableIterator<[T, T]>; - forEach(callbackfn: (value: T, index: T, set: Set) => void, thisArg?: any): void; - has(value: T): boolean; - keys(): IterableIterator; - size: number; - values(): IterableIterator; - [Symbol.iterator]():IterableIterator; - [Symbol.toStringTag]: string; -} - -interface SetConstructor { - new (): Set; - new (): Set; - new (iterable: Iterable): Set; - prototype: Set; -} -declare var Set: SetConstructor; - -interface WeakSet { - add(value: T): WeakSet; - clear(): void; - delete(value: T): boolean; - has(value: T): boolean; - [Symbol.toStringTag]: string; -} - -interface WeakSetConstructor { - new (): WeakSet; - new (): WeakSet; - new (iterable: Iterable): WeakSet; - prototype: WeakSet; -} -declare var WeakSet: WeakSetConstructor; - -interface JSON { - [Symbol.toStringTag]: string; -} - -/** - * Represents a raw buffer of binary data, which is used to store data for the - * different typed arrays. ArrayBuffers cannot be read from or written to directly, - * but can be passed to a typed array or DataView Object to interpret the raw - * buffer as needed. - */ -interface ArrayBuffer { - [Symbol.toStringTag]: string; -} - -interface DataView { - [Symbol.toStringTag]: string; -} - -/** - * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested - * number of bytes could not be allocated an exception is raised. - */ -interface Int8Array { - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - [Symbol.iterator](): IterableIterator; -} - -interface Int8ArrayConstructor { - new (elements: Iterable): Int8Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array; -} - -/** - * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint8Array { - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - [Symbol.iterator](): IterableIterator; -} - -interface Uint8ArrayConstructor { - new (elements: Iterable): Uint8Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array; -} - -/** - * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. - * If the requested number of bytes could not be allocated an exception is raised. - */ -interface Uint8ClampedArray { - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - - [Symbol.iterator](): IterableIterator; -} - -interface Uint8ClampedArrayConstructor { - new (elements: Iterable): Uint8ClampedArray; - - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray; -} - -/** - * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Int16Array { - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - - - [Symbol.iterator](): IterableIterator; -} - -interface Int16ArrayConstructor { - new (elements: Iterable): Int16Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array; -} - -/** - * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint16Array { - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - [Symbol.iterator](): IterableIterator; -} - -interface Uint16ArrayConstructor { - new (elements: Iterable): Uint16Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array; -} - -/** - * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Int32Array { - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - [Symbol.iterator](): IterableIterator; -} - -interface Int32ArrayConstructor { - new (elements: Iterable): Int32Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array; -} - -/** - * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint32Array { - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - [Symbol.iterator](): IterableIterator; -} - -interface Uint32ArrayConstructor { - new (elements: Iterable): Uint32Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array; -} - -/** - * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number - * of bytes could not be allocated an exception is raised. - */ -interface Float32Array { - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - [Symbol.iterator](): IterableIterator; -} - -interface Float32ArrayConstructor { - new (elements: Iterable): Float32Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array; -} - -/** - * A typed array of 64-bit float values. The contents are initialized to 0. If the requested - * number of bytes could not be allocated an exception is raised. - */ -interface Float64Array { - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - [Symbol.iterator](): IterableIterator; -} - -interface Float64ArrayConstructor { - new (elements: Iterable): Float64Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; -} - -interface ProxyHandler { - getPrototypeOf? (target: T): any; - setPrototypeOf? (target: T, v: any): boolean; - isExtensible? (target: T): boolean; - preventExtensions? (target: T): boolean; - getOwnPropertyDescriptor? (target: T, p: PropertyKey): PropertyDescriptor; - has? (target: T, p: PropertyKey): boolean; - get? (target: T, p: PropertyKey, receiver: any): any; - set? (target: T, p: PropertyKey, value: any, receiver: any): boolean; - deleteProperty? (target: T, p: PropertyKey): boolean; - defineProperty? (target: T, p: PropertyKey, attributes: PropertyDescriptor): boolean; - enumerate? (target: T): PropertyKey[]; - ownKeys? (target: T): PropertyKey[]; - apply? (target: T, thisArg: any, argArray?: any): any; - construct? (target: T, thisArg: any, argArray?: any): any; -} - -interface ProxyConstructor { - revocable(target: T, handler: ProxyHandler): { proxy: T; revoke: () => void; }; - new (target: T, handler: ProxyHandler): T -} -declare var Proxy: ProxyConstructor; - -declare namespace Reflect { - function apply(target: Function, thisArgument: any, argumentsList: ArrayLike): any; - function construct(target: Function, argumentsList: ArrayLike, newTarget?: any): any; - function defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean; - function deleteProperty(target: any, propertyKey: PropertyKey): boolean; - function enumerate(target: any): IterableIterator; - function get(target: any, propertyKey: PropertyKey, receiver?: any): any; - function getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor; - function getPrototypeOf(target: any): any; - function has(target: any, propertyKey: string): boolean; - function has(target: any, propertyKey: symbol): boolean; - function isExtensible(target: any): boolean; - function ownKeys(target: any): Array; - function preventExtensions(target: any): boolean; - function set(target: any, propertyKey: PropertyKey, value: any, receiver? :any): boolean; - function setPrototypeOf(target: any, proto: any): boolean; -} - -/** - * Represents the completion of an asynchronous operation - */ -interface Promise { - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; - then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): Promise; - - /** - * Attaches a callback for only the rejection of the Promise. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of the callback. - */ - catch(onrejected?: (reason: any) => T | PromiseLike): Promise; - catch(onrejected?: (reason: any) => void): Promise; - - [Symbol.toStringTag]: string; -} - -interface PromiseConstructor { - /** - * A reference to the prototype. - */ - prototype: Promise; - - /** - * Creates a new Promise. - * @param executor A callback used to initialize the promise. This callback is passed two arguments: - * a resolve callback used resolve the promise with a value or the result of another promise, - * and a reject callback used to reject the promise with a provided reason or error. - */ - new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void): Promise; - - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: Iterable>): Promise; - - /** - * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved - * or rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - race(values: Iterable>): Promise; - - /** - * Creates a new rejected promise for the provided reason. - * @param reason The reason the promise was rejected. - * @returns A new rejected Promise. - */ - reject(reason: any): Promise; - - /** - * Creates a new rejected promise for the provided reason. - * @param reason The reason the promise was rejected. - * @returns A new rejected Promise. - */ - reject(reason: any): Promise; - - /** - * Creates a new resolved promise for the provided value. - * @param value A promise. - * @returns A promise whose internal state matches the provided promise. - */ - resolve(value: T | PromiseLike): Promise; - - /** - * Creates a new resolved promise . - * @returns A resolved promise. - */ - resolve(): Promise; - - [Symbol.species]: Function; -} - -declare var Promise: PromiseConstructor; /// - ///////////////////////////// /// ECMAScript APIs ///////////////////////////// -declare var NaN: number; -declare var Infinity: number; +declare const NaN: number; +declare const Infinity: number; /** - * Evaluates JavaScript code and executes it. + * Evaluates JavaScript code and executes it. * @param x A String value that contains valid JavaScript code. */ declare function eval(x: string): any; @@ -1346,25 +30,25 @@ declare function eval(x: string): any; /** * Converts A string to an integer. * @param s A string to convert into a number. - * @param radix A value between 2 and 36 that specifies the base of the number in numString. + * @param radix A value between 2 and 36 that specifies the base of the number in numString. * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. * All other strings are considered decimal. */ declare function parseInt(s: string, radix?: number): number; /** - * Converts a string to a floating-point number. - * @param string A string that contains a floating-point number. + * Converts a string to a floating-point number. + * @param string A string that contains a floating-point number. */ declare function parseFloat(string: string): number; /** - * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a number). + * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a number). * @param number A numeric value. */ declare function isNaN(number: number): boolean; -/** +/** * Determines whether a supplied number is finite. * @param number Any numeric value. */ @@ -1382,7 +66,7 @@ declare function decodeURI(encodedURI: string): string; */ declare function decodeURIComponent(encodedURIComponent: string): string; -/** +/** * Encodes a text string as a valid Uniform Resource Identifier (URI) * @param uri A value representing an encoded URI. */ @@ -1421,18 +105,18 @@ interface Object { valueOf(): Object; /** - * Determines whether an object has a property with the specified name. + * Determines whether an object has a property with the specified name. * @param v A property name. */ hasOwnProperty(v: string): boolean; /** - * Determines whether an object exists in another object's prototype chain. + * Determines whether an object exists in another object's prototype chain. * @param v Another object whose prototype chain is to be checked. */ isPrototypeOf(v: Object): boolean; - /** + /** * Determines whether a specified property is enumerable. * @param v A property name. */ @@ -1445,38 +129,38 @@ interface ObjectConstructor { (value: any): any; /** A reference to the prototype for a class of objects. */ - prototype: Object; + readonly prototype: Object; - /** - * Returns the prototype of an object. + /** + * Returns the prototype of an object. * @param o The object that references the prototype. */ getPrototypeOf(o: any): any; /** - * Gets the own property descriptor of the specified object. - * An own property descriptor is one that is defined directly on the object and is not inherited from the object's prototype. + * Gets the own property descriptor of the specified object. + * An own property descriptor is one that is defined directly on the object and is not inherited from the object's prototype. * @param o Object that contains the property. * @param p Name of the property. */ getOwnPropertyDescriptor(o: any, p: string): PropertyDescriptor; - /** - * Returns the names of the own properties of an object. The own properties of an object are those that are defined directly + /** + * Returns the names of the own properties of an object. The own properties of an object are those that are defined directly * on that object, and are not inherited from the object's prototype. The properties of an object include both fields (objects) and functions. * @param o Object that contains the own properties. */ getOwnPropertyNames(o: any): string[]; - /** + /** * Creates an object that has the specified prototype, and that optionally contains specified properties. * @param o Object to use as a prototype. May be null - * @param properties JavaScript object that contains one or more property descriptors. + * @param properties JavaScript object that contains one or more property descriptors. */ create(o: any, properties?: PropertyDescriptorMap): any; /** - * Adds a property to an object, or modifies attributes of an existing property. + * Adds a property to an object, or modifies attributes of an existing property. * @param o Object on which to add or modify the property. This can be a native JavaScript object (that is, a user-defined object or a built in object) or a DOM object. * @param p The property name. * @param attributes Descriptor for the property. It can be for a data property or an accessor property. @@ -1484,7 +168,7 @@ interface ObjectConstructor { defineProperty(o: any, p: string, attributes: PropertyDescriptor): any; /** - * Adds one or more properties to an object, and/or modifies attributes of existing properties. + * Adds one or more properties to an object, and/or modifies attributes of existing properties. * @param o Object on which to add or modify the properties. This can be a native JavaScript object or a DOM object. * @param properties JavaScript object that contains one or more descriptor objects. Each descriptor object describes a data property or an accessor property. */ @@ -1492,7 +176,7 @@ interface ObjectConstructor { /** * Prevents the modification of attributes of existing properties, and prevents the addition of new properties. - * @param o Object on which to lock the attributes. + * @param o Object on which to lock the attributes. */ seal(o: T): T; @@ -1504,25 +188,25 @@ interface ObjectConstructor { /** * Prevents the addition of new properties to an object. - * @param o Object to make non-extensible. + * @param o Object to make non-extensible. */ preventExtensions(o: T): T; /** * Returns true if existing property attributes cannot be modified in an object and new properties cannot be added to the object. - * @param o Object to test. + * @param o Object to test. */ isSealed(o: any): boolean; /** * Returns true if existing property attributes and values cannot be modified in an object, and new properties cannot be added to the object. - * @param o Object to test. + * @param o Object to test. */ isFrozen(o: any): boolean; /** * Returns a value that indicates whether new properties can be added to an object. - * @param o Object to test. + * @param o Object to test. */ isExtensible(o: any): boolean; @@ -1536,7 +220,7 @@ interface ObjectConstructor { /** * Provides functionality common to all JavaScript objects. */ -declare var Object: ObjectConstructor; +declare const Object: ObjectConstructor; /** * Creates a new function. @@ -1547,25 +231,25 @@ interface Function { * @param thisArg The object to be used as the this object. * @param argArray A set of arguments to be passed to the function. */ - apply(thisArg: any, argArray?: any): any; + apply(this: Function, thisArg: any, argArray?: any): any; /** * Calls a method of an object, substituting another object for the current object. * @param thisArg The object to be used as the current object. * @param argArray A list of arguments to be passed to the method. */ - call(thisArg: any, ...argArray: any[]): any; + call(this: Function, thisArg: any, ...argArray: any[]): any; /** - * For a given function, creates a bound function that has the same body as the original function. + * For a given function, creates a bound function that has the same body as the original function. * The this object of the bound function is associated with the specified object, and has the specified initial parameters. * @param thisArg An object to which the this keyword can refer inside the new function. * @param argArray A list of arguments to be passed to the new function. */ - bind(thisArg: any, ...argArray: any[]): any; + bind(this: Function, thisArg: any, ...argArray: any[]): any; prototype: any; - length: number; + readonly length: number; // Non-standard extensions arguments: any; @@ -1579,10 +263,10 @@ interface FunctionConstructor { */ new (...args: string[]): Function; (...args: string[]): Function; - prototype: Function; + readonly prototype: Function; } -declare var Function: FunctionConstructor; +declare const Function: FunctionConstructor; interface IArguments { [index: number]: any; @@ -1600,7 +284,7 @@ interface String { */ charAt(pos: number): string; - /** + /** * Returns the Unicode value of the character at the specified location. * @param index The zero-based index of the desired character. If there is no character at the specified index, NaN is returned. */ @@ -1608,12 +292,12 @@ interface String { /** * Returns a string that contains the concatenation of two or more strings. - * @param strings The strings to append to the end of the string. + * @param strings The strings to append to the end of the string. */ concat(...strings: string[]): string; /** - * Returns the position of the first occurrence of a substring. + * Returns the position of the first occurrence of a substring. * @param searchString The substring to search for in the string * @param position The index at which to begin searching the String object. If omitted, search starts at the beginning of the string. */ @@ -1632,17 +316,17 @@ interface String { */ localeCompare(that: string): number; - /** + /** * Matches a string with a regular expression, and returns an array containing the results of that search. * @param regexp A variable name or string literal containing the regular expression pattern and flags. */ - match(regexp: string): RegExpMatchArray; + match(regexp: string): RegExpMatchArray | null; - /** + /** * Matches a string with a regular expression, and returns an array containing the results of that search. - * @param regexp A regular expression object that contains the regular expression pattern and applicable flags. + * @param regexp A regular expression object that contains the regular expression pattern and applicable flags. */ - match(regexp: RegExp): RegExpMatchArray; + match(regexp: RegExp): RegExpMatchArray | null; /** * Replaces text in a string, using a regular expression or search string. @@ -1674,40 +358,40 @@ interface String { /** * Finds the first substring match in a regular expression search. - * @param regexp The regular expression pattern and applicable flags. + * @param regexp The regular expression pattern and applicable flags. */ search(regexp: string): number; /** * Finds the first substring match in a regular expression search. - * @param regexp The regular expression pattern and applicable flags. + * @param regexp The regular expression pattern and applicable flags. */ search(regexp: RegExp): number; /** * Returns a section of a string. - * @param start The index to the beginning of the specified portion of stringObj. - * @param end The index to the end of the specified portion of stringObj. The substring includes the characters up to, but not including, the character indicated by end. + * @param start The index to the beginning of the specified portion of stringObj. + * @param end The index to the end of the specified portion of stringObj. The substring includes the characters up to, but not including, the character indicated by end. * If this value is not specified, the substring continues to the end of stringObj. */ slice(start?: number, end?: number): string; /** * Split a string into substrings using the specified separator and return them as an array. - * @param separator A string that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. + * @param separator A string that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. * @param limit A value used to limit the number of elements returned in the array. */ split(separator: string, limit?: number): string[]; /** * Split a string into substrings using the specified separator and return them as an array. - * @param separator A Regular Express that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. + * @param separator A Regular Express that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. * @param limit A value used to limit the number of elements returned in the array. */ split(separator: RegExp, limit?: number): string[]; /** - * Returns the substring at the specified location within a String object. + * Returns the substring at the specified location within a String object. * @param start The zero-based index number indicating the beginning of the substring. * @param end Zero-based index number indicating the end of the substring. The substring includes the characters up to, but not including, the character indicated by end. * If end is omitted, the characters from start through the end of the original string are returned. @@ -1730,7 +414,7 @@ interface String { trim(): string; /** Returns the length of a String object. */ - length: number; + readonly length: number; // IE extensions /** @@ -1743,20 +427,20 @@ interface String { /** Returns the primitive value of the specified object. */ valueOf(): string; - [index: number]: string; + readonly [index: number]: string; } interface StringConstructor { new (value?: any): String; (value?: any): string; - prototype: String; + readonly prototype: String; fromCharCode(...codes: number[]): string; } -/** - * Allows manipulation and formatting of text strings and determination and location of substrings within strings. +/** + * Allows manipulation and formatting of text strings and determination and location of substrings within strings. */ -declare var String: StringConstructor; +declare const String: StringConstructor; interface Boolean { /** Returns the primitive value of the specified object. */ @@ -1766,10 +450,10 @@ interface Boolean { interface BooleanConstructor { new (value?: any): Boolean; (value?: any): boolean; - prototype: Boolean; + readonly prototype: Boolean; } -declare var Boolean: BooleanConstructor; +declare const Boolean: BooleanConstructor; interface Number { /** @@ -1778,7 +462,7 @@ interface Number { */ toString(radix?: number): string; - /** + /** * Returns a string representing a number in fixed-point notation. * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive. */ @@ -1803,75 +487,75 @@ interface Number { interface NumberConstructor { new (value?: any): Number; (value?: any): number; - prototype: Number; + readonly prototype: Number; /** The largest number that can be represented in JavaScript. Equal to approximately 1.79E+308. */ - MAX_VALUE: number; + readonly MAX_VALUE: number; /** The closest number to zero that can be represented in JavaScript. Equal to approximately 5.00E-324. */ - MIN_VALUE: number; + readonly MIN_VALUE: number; - /** + /** * A value that is not a number. * In equality comparisons, NaN does not equal any value, including itself. To test whether a value is equivalent to NaN, use the isNaN function. */ - NaN: number; - - /** - * A value that is less than the largest negative number that can be represented in JavaScript. - * JavaScript displays NEGATIVE_INFINITY values as -infinity. - */ - NEGATIVE_INFINITY: number; + readonly NaN: number; /** - * A value greater than the largest number that can be represented in JavaScript. - * JavaScript displays POSITIVE_INFINITY values as infinity. + * A value that is less than the largest negative number that can be represented in JavaScript. + * JavaScript displays NEGATIVE_INFINITY values as -infinity. */ - POSITIVE_INFINITY: number; + readonly NEGATIVE_INFINITY: number; + + /** + * A value greater than the largest number that can be represented in JavaScript. + * JavaScript displays POSITIVE_INFINITY values as infinity. + */ + readonly POSITIVE_INFINITY: number; } /** An object that represents a number of any kind. All JavaScript numbers are 64-bit floating-point numbers. */ -declare var Number: NumberConstructor; +declare const Number: NumberConstructor; interface TemplateStringsArray extends Array { - raw: string[]; + readonly raw: string[]; } interface Math { /** The mathematical constant e. This is Euler's number, the base of natural logarithms. */ - E: number; + readonly E: number; /** The natural logarithm of 10. */ - LN10: number; + readonly LN10: number; /** The natural logarithm of 2. */ - LN2: number; + readonly LN2: number; /** The base-2 logarithm of e. */ - LOG2E: number; + readonly LOG2E: number; /** The base-10 logarithm of e. */ - LOG10E: number; + readonly LOG10E: number; /** Pi. This is the ratio of the circumference of a circle to its diameter. */ - PI: number; + readonly PI: number; /** The square root of 0.5, or, equivalently, one divided by the square root of 2. */ - SQRT1_2: number; + readonly SQRT1_2: number; /** The square root of 2. */ - SQRT2: number; + readonly SQRT2: number; /** - * Returns the absolute value of a number (the value without regard to whether it is positive or negative). + * Returns the absolute value of a number (the value without regard to whether it is positive or negative). * For example, the absolute value of -5 is the same as the absolute value of 5. * @param x A numeric expression for which the absolute value is needed. */ abs(x: number): number; /** - * Returns the arc cosine (or inverse cosine) of a number. + * Returns the arc cosine (or inverse cosine) of a number. * @param x A numeric expression. */ acos(x: number): number; - /** - * Returns the arcsine of a number. + /** + * Returns the arcsine of a number. * @param x A numeric expression. */ asin(x: number): number; /** - * Returns the arctangent of a number. + * Returns the arctangent of a number. * @param x A numeric expression for which the arctangent is needed. */ atan(x: number): number; @@ -1882,49 +566,49 @@ interface Math { */ atan2(y: number, x: number): number; /** - * Returns the smallest number greater than or equal to its numeric argument. + * Returns the smallest number greater than or equal to its numeric argument. * @param x A numeric expression. */ ceil(x: number): number; /** - * Returns the cosine of a number. + * Returns the cosine of a number. * @param x A numeric expression that contains an angle measured in radians. */ cos(x: number): number; /** - * Returns e (the base of natural logarithms) raised to a power. + * Returns e (the base of natural logarithms) raised to a power. * @param x A numeric expression representing the power of e. */ exp(x: number): number; /** - * Returns the greatest number less than or equal to its numeric argument. + * Returns the greatest number less than or equal to its numeric argument. * @param x A numeric expression. */ floor(x: number): number; /** - * Returns the natural logarithm (base e) of a number. + * Returns the natural logarithm (base e) of a number. * @param x A numeric expression. */ log(x: number): number; /** - * Returns the larger of a set of supplied numeric expressions. + * Returns the larger of a set of supplied numeric expressions. * @param values Numeric expressions to be evaluated. */ max(...values: number[]): number; /** - * Returns the smaller of a set of supplied numeric expressions. + * Returns the smaller of a set of supplied numeric expressions. * @param values Numeric expressions to be evaluated. */ min(...values: number[]): number; /** - * Returns the value of a base expression taken to a specified power. + * Returns the value of a base expression taken to a specified power. * @param x The base value of the expression. * @param y The exponent value of the expression. */ pow(x: number, y: number): number; /** Returns a pseudorandom number between 0 and 1. */ random(): number; - /** + /** * Returns a supplied numeric expression rounded to the nearest number. * @param x The value to be rounded to the nearest number. */ @@ -1946,7 +630,7 @@ interface Math { tan(x: number): number; } /** An intrinsic object that provides basic mathematics functionality and constants. */ -declare var Math: Math; +declare const Math: Math; /** Enables basic storage and retrieval of dates and times. */ interface Date { @@ -2000,24 +684,24 @@ interface Date { getUTCMilliseconds(): number; /** Gets the difference in minutes between the time on the local computer and Universal Coordinated Time (UTC). */ getTimezoneOffset(): number; - /** + /** * Sets the date and time value in the Date object. - * @param time A numeric value representing the number of elapsed milliseconds since midnight, January 1, 1970 GMT. + * @param time A numeric value representing the number of elapsed milliseconds since midnight, January 1, 1970 GMT. */ setTime(time: number): number; /** - * Sets the milliseconds value in the Date object using local time. + * Sets the milliseconds value in the Date object using local time. * @param ms A numeric value equal to the millisecond value. */ setMilliseconds(ms: number): number; - /** + /** * Sets the milliseconds value in the Date object using Universal Coordinated Time (UTC). - * @param ms A numeric value equal to the millisecond value. + * @param ms A numeric value equal to the millisecond value. */ setUTCMilliseconds(ms: number): number; /** - * Sets the seconds value in the Date object using local time. + * Sets the seconds value in the Date object using local time. * @param sec A numeric value equal to the seconds value. * @param ms A numeric value equal to the milliseconds value. */ @@ -2029,16 +713,16 @@ interface Date { */ setUTCSeconds(sec: number, ms?: number): number; /** - * Sets the minutes value in the Date object using local time. - * @param min A numeric value equal to the minutes value. - * @param sec A numeric value equal to the seconds value. + * Sets the minutes value in the Date object using local time. + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. * @param ms A numeric value equal to the milliseconds value. */ setMinutes(min: number, sec?: number, ms?: number): number; /** * Sets the minutes value in the Date object using Universal Coordinated Time (UTC). - * @param min A numeric value equal to the minutes value. - * @param sec A numeric value equal to the seconds value. + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. * @param ms A numeric value equal to the milliseconds value. */ setUTCMinutes(min: number, sec?: number, ms?: number): number; @@ -2046,7 +730,7 @@ interface Date { * Sets the hour value in the Date object using local time. * @param hours A numeric value equal to the hours value. * @param min A numeric value equal to the minutes value. - * @param sec A numeric value equal to the seconds value. + * @param sec A numeric value equal to the seconds value. * @param ms A numeric value equal to the milliseconds value. */ setHours(hours: number, min?: number, sec?: number, ms?: number): number; @@ -2054,23 +738,23 @@ interface Date { * Sets the hours value in the Date object using Universal Coordinated Time (UTC). * @param hours A numeric value equal to the hours value. * @param min A numeric value equal to the minutes value. - * @param sec A numeric value equal to the seconds value. + * @param sec A numeric value equal to the seconds value. * @param ms A numeric value equal to the milliseconds value. */ setUTCHours(hours: number, min?: number, sec?: number, ms?: number): number; /** - * Sets the numeric day-of-the-month value of the Date object using local time. + * Sets the numeric day-of-the-month value of the Date object using local time. * @param date A numeric value equal to the day of the month. */ setDate(date: number): number; - /** + /** * Sets the numeric day of the month in the Date object using Universal Coordinated Time (UTC). - * @param date A numeric value equal to the day of the month. + * @param date A numeric value equal to the day of the month. */ setUTCDate(date: number): number; - /** - * Sets the month value in the Date object using local time. - * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. + /** + * Sets the month value in the Date object using local time. + * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. * @param date A numeric value representing the day of the month. If this value is not supplied, the value from a call to the getDate method is used. */ setMonth(month: number, date?: number): number; @@ -2108,14 +792,14 @@ interface DateConstructor { new (value: string): Date; new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; (): string; - prototype: Date; + readonly prototype: Date; /** * Parses a string containing a date, and returns the number of milliseconds between that date and midnight, January 1, 1970. * @param s A date string */ parse(s: string): number; /** - * Returns the number of milliseconds between midnight, January 1, 1970 Universal Coordinated Time (UTC) (or GMT) and the specified date. + * Returns the number of milliseconds between midnight, January 1, 1970 Universal Coordinated Time (UTC) (or GMT) and the specified date. * @param year The full year designation is required for cross-century date accuracy. If year is between 0 and 99 is used, then year is assumed to be 1900 + year. * @param month The month as an number between 0 and 11 (January to December). * @param date The date as an number between 1 and 31. @@ -2128,7 +812,7 @@ interface DateConstructor { now(): number; } -declare var Date: DateConstructor; +declare const Date: DateConstructor; interface RegExpMatchArray extends Array { index?: number; @@ -2141,40 +825,42 @@ interface RegExpExecArray extends Array { } interface RegExp { - /** + /** * Executes a search on a string using a regular expression pattern, and returns an array containing the results of that search. * @param string The String object or string literal on which to perform the search. */ - exec(string: string): RegExpExecArray; + exec(string: string): RegExpExecArray | null; - /** + /** * Returns a Boolean value that indicates whether or not a pattern exists in a searched string. * @param string String on which to perform the search. */ test(string: string): boolean; /** Returns a copy of the text of the regular expression pattern. Read-only. The regExp argument is a Regular expression object. It can be a variable name or a literal. */ - source: string; + readonly source: string; /** Returns a Boolean value indicating the state of the global flag (g) used with a regular expression. Default is false. Read-only. */ - global: boolean; + readonly global: boolean; /** Returns a Boolean value indicating the state of the ignoreCase flag (i) used with a regular expression. Default is false. Read-only. */ - ignoreCase: boolean; + readonly ignoreCase: boolean; /** Returns a Boolean value indicating the state of the multiline flag (m) used with a regular expression. Default is false. Read-only. */ - multiline: boolean; + readonly multiline: boolean; lastIndex: number; // Non-standard extensions - compile(): RegExp; + compile(): this; } interface RegExpConstructor { + new (pattern: RegExp): RegExp; new (pattern: string, flags?: string): RegExp; + (pattern: RegExp): RegExp; (pattern: string, flags?: string): RegExp; - prototype: RegExp; + readonly prototype: RegExp; // Non-standard extensions $1: string; @@ -2189,20 +875,21 @@ interface RegExpConstructor { lastMatch: string; } -declare var RegExp: RegExpConstructor; +declare const RegExp: RegExpConstructor; interface Error { name: string; message: string; + stack?: string; } interface ErrorConstructor { new (message?: string): Error; (message?: string): Error; - prototype: Error; + readonly prototype: Error; } -declare var Error: ErrorConstructor; +declare const Error: ErrorConstructor; interface EvalError extends Error { } @@ -2210,10 +897,10 @@ interface EvalError extends Error { interface EvalErrorConstructor { new (message?: string): EvalError; (message?: string): EvalError; - prototype: EvalError; + readonly prototype: EvalError; } -declare var EvalError: EvalErrorConstructor; +declare const EvalError: EvalErrorConstructor; interface RangeError extends Error { } @@ -2221,10 +908,10 @@ interface RangeError extends Error { interface RangeErrorConstructor { new (message?: string): RangeError; (message?: string): RangeError; - prototype: RangeError; + readonly prototype: RangeError; } -declare var RangeError: RangeErrorConstructor; +declare const RangeError: RangeErrorConstructor; interface ReferenceError extends Error { } @@ -2232,10 +919,10 @@ interface ReferenceError extends Error { interface ReferenceErrorConstructor { new (message?: string): ReferenceError; (message?: string): ReferenceError; - prototype: ReferenceError; + readonly prototype: ReferenceError; } -declare var ReferenceError: ReferenceErrorConstructor; +declare const ReferenceError: ReferenceErrorConstructor; interface SyntaxError extends Error { } @@ -2243,10 +930,10 @@ interface SyntaxError extends Error { interface SyntaxErrorConstructor { new (message?: string): SyntaxError; (message?: string): SyntaxError; - prototype: SyntaxError; + readonly prototype: SyntaxError; } -declare var SyntaxError: SyntaxErrorConstructor; +declare const SyntaxError: SyntaxErrorConstructor; interface TypeError extends Error { } @@ -2254,10 +941,10 @@ interface TypeError extends Error { interface TypeErrorConstructor { new (message?: string): TypeError; (message?: string): TypeError; - prototype: TypeError; + readonly prototype: TypeError; } -declare var TypeError: TypeErrorConstructor; +declare const TypeError: TypeErrorConstructor; interface URIError extends Error { } @@ -2265,17 +952,17 @@ interface URIError extends Error { interface URIErrorConstructor { new (message?: string): URIError; (message?: string): URIError; - prototype: URIError; + readonly prototype: URIError; } -declare var URIError: URIErrorConstructor; +declare const URIError: URIErrorConstructor; interface JSON { /** * Converts a JavaScript Object Notation (JSON) string into an object. * @param text A valid JSON string. - * @param reviver A function that transforms the results. This function is called for each member of the object. - * If a member contains nested objects, the nested objects are transformed before the parent object is. + * @param reviver A function that transforms the results. This function is called for each member of the object. + * If a member contains nested objects, the nested objects are transformed before the parent object is. */ parse(text: string, reviver?: (key: any, value: any) => any): any; /** @@ -2313,13 +1000,115 @@ interface JSON { /** * An intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format. */ -declare var JSON: JSON; +declare const JSON: JSON; ///////////////////////////// /// ECMAScript Array API (specially handled by compiler) ///////////////////////////// +interface ReadonlyArray { + /** + * Gets the length of the array. This is a number one higher than the highest element defined in an array. + */ + readonly length: number; + /** + * Returns a string representation of an array. + */ + toString(): string; + toLocaleString(): string; + /** + * Combines two or more arrays. + * @param items Additional items to add to the end of array1. + */ + concat>(...items: U[]): T[]; + /** + * Combines two or more arrays. + * @param items Additional items to add to the end of array1. + */ + concat(...items: T[]): T[]; + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): T[]; + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. + */ + indexOf(searchElement: T, fromIndex?: number): number; + + /** + * Returns the index of the last occurrence of a specified value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array. + */ + lastIndexOf(searchElement: T, fromIndex?: number): number; + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: T, index: number, array: ReadonlyArray) => boolean, thisArg?: any): boolean; + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: T, index: number, array: ReadonlyArray) => boolean, thisArg?: any): boolean; + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: T, index: number, array: ReadonlyArray) => void, thisArg?: any): void; + /** + * Calls a defined callback function on each element of an array, and returns an array that contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: T, index: number, array: ReadonlyArray) => U, thisArg?: any): U[]; + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (value: T, index: number, array: ReadonlyArray) => any, thisArg?: any): T[]; + /** + * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: ReadonlyArray) => T, initialValue?: T): T; + /** + * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: ReadonlyArray) => U, initialValue: U): U; + /** + * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: ReadonlyArray) => T, initialValue?: T): T; + /** + * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: ReadonlyArray) => U, initialValue: U): U; + + readonly [n: number]: T; +} + interface Array { /** * Gets or sets the length of the array. This is a number one higher than the highest element defined in an array. @@ -2338,49 +1127,41 @@ interface Array { /** * Removes the last element from an array and returns it. */ - pop(): T; + pop(): T | undefined; /** * Combines two or more arrays. * @param items Additional items to add to the end of array1. */ - concat(...items: U[]): T[]; - /** - * Combines two or more arrays. - * @param items Additional items to add to the end of array1. - */ - concat(...items: T[]): T[]; + concat(...items: (T | T[])[]): T[]; /** * Adds all the elements of an array separated by the specified separator string. * @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): T[]; /** * Removes the first element from an array and returns it. */ - shift(): T; - /** + shift(): T | undefined; + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. */ slice(start?: number, end?: number): T[]; - /** * Sorts an array. * @param compareFn The name of the function used to determine the order of the elements. If omitted, the elements are sorted in ascending, ASCII character order. */ - sort(compareFn?: (a: T, b: T) => number): T[]; - + sort(compareFn?: (a: T, b: T) => number): this; /** * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. * @param start The zero-based location in the array from which to start removing elements. */ splice(start: number): T[]; - /** * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. * @param start The zero-based location in the array from which to start removing elements. @@ -2388,62 +1169,53 @@ interface Array { * @param items Elements to insert into the array in place of the deleted elements. */ splice(start: number, deleteCount: number, ...items: T[]): T[]; - /** * Inserts new elements at the start of an array. * @param items Elements to insert at the start of the Array. */ unshift(...items: T[]): number; - /** * Returns the index of the first occurrence of a value in an array. * @param searchElement The value to locate in the array. * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. */ indexOf(searchElement: T, fromIndex?: number): number; - /** * Returns the index of the last occurrence of a specified value in an array. * @param searchElement The value to locate in the array. * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array. */ lastIndexOf(searchElement: T, fromIndex?: number): number; - /** * Determines whether all the members of an array satisfy the specified test. * @param callbackfn A function that accepts up to three arguments. The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. */ every(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; - /** * Determines whether the specified callback function returns true for any element of an array. * @param callbackfn A function that accepts up to three arguments. The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; - /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void; - /** * Calls a defined callback function on each element of an array, and returns an array that contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. + * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[]; - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. */ - filter(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): T[]; - + filter(callbackfn: (value: T, index: number, array: T[]) => any, thisArg?: any): T[]; /** * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. @@ -2456,16 +1228,15 @@ interface Array { * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; - - /** + /** * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. */ reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; - /** + /** * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; @@ -2481,10 +1252,10 @@ interface ArrayConstructor { (arrayLength: number): T[]; (...items: T[]): T[]; isArray(arg: any): arg is Array; - prototype: Array; + readonly prototype: Array; } -declare var Array: ArrayConstructor; +declare const Array: ArrayConstructor; interface TypedPropertyDescriptor { enumerable?: boolean; @@ -2514,22 +1285,21 @@ interface PromiseLike { } interface ArrayLike { - length: number; - [n: number]: T; + readonly length: number; + readonly [n: number]: T; } - /** - * Represents a raw buffer of binary data, which is used to store data for the - * different typed arrays. ArrayBuffers cannot be read from or written to directly, - * but can be passed to a typed array or DataView Object to interpret the raw - * buffer as needed. + * Represents a raw buffer of binary data, which is used to store data for the + * different typed arrays. ArrayBuffers cannot be read from or written to directly, + * but can be passed to a typed array or DataView Object to interpret the raw + * buffer as needed. */ interface ArrayBuffer { /** * Read-only. The length of the ArrayBuffer (in bytes). */ - byteLength: number; + readonly byteLength: number; /** * Returns a section of an ArrayBuffer. @@ -2538,15 +1308,15 @@ interface ArrayBuffer { } interface ArrayBufferConstructor { - prototype: ArrayBuffer; + readonly prototype: ArrayBuffer; new (byteLength: number): ArrayBuffer; isView(arg: any): arg is ArrayBufferView; } -declare var ArrayBuffer: ArrayBufferConstructor; +declare const ArrayBuffer: ArrayBufferConstructor; interface ArrayBufferView { /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ buffer: ArrayBuffer; @@ -2562,128 +1332,128 @@ interface ArrayBufferView { } interface DataView { - buffer: ArrayBuffer; - byteLength: number; - byteOffset: number; + readonly buffer: ArrayBuffer; + readonly byteLength: number; + readonly byteOffset: number; /** - * Gets the Float32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. + * Gets the Float32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. * @param byteOffset The place in the buffer at which the value should be retrieved. */ getFloat32(byteOffset: number, littleEndian?: boolean): number; /** * Gets the Float64 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. + * no alignment constraint; multi-byte values may be fetched from any offset. * @param byteOffset The place in the buffer at which the value should be retrieved. */ getFloat64(byteOffset: number, littleEndian?: boolean): number; /** - * Gets the Int8 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. + * Gets the Int8 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. * @param byteOffset The place in the buffer at which the value should be retrieved. */ getInt8(byteOffset: number): number; /** - * Gets the Int16 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. + * Gets the Int16 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. * @param byteOffset The place in the buffer at which the value should be retrieved. */ getInt16(byteOffset: number, littleEndian?: boolean): number; /** - * Gets the Int32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. + * Gets the Int32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. * @param byteOffset The place in the buffer at which the value should be retrieved. */ getInt32(byteOffset: number, littleEndian?: boolean): number; /** - * Gets the Uint8 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. + * Gets the Uint8 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. * @param byteOffset The place in the buffer at which the value should be retrieved. */ getUint8(byteOffset: number): number; /** - * Gets the Uint16 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. + * Gets the Uint16 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. * @param byteOffset The place in the buffer at which the value should be retrieved. */ getUint16(byteOffset: number, littleEndian?: boolean): number; /** - * Gets the Uint32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. + * Gets the Uint32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. * @param byteOffset The place in the buffer at which the value should be retrieved. */ getUint32(byteOffset: number, littleEndian?: boolean): number; /** - * Stores an Float32 value at the specified byte offset from the start of the view. + * Stores an Float32 value at the specified byte offset from the start of the view. * @param byteOffset The place in the buffer at which the value should be set. * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, + * @param littleEndian If false or undefined, a big-endian value should be written, * otherwise a little-endian value should be written. */ setFloat32(byteOffset: number, value: number, littleEndian?: boolean): void; /** - * Stores an Float64 value at the specified byte offset from the start of the view. + * Stores an Float64 value at the specified byte offset from the start of the view. * @param byteOffset The place in the buffer at which the value should be set. * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, + * @param littleEndian If false or undefined, a big-endian value should be written, * otherwise a little-endian value should be written. */ setFloat64(byteOffset: number, value: number, littleEndian?: boolean): void; /** - * Stores an Int8 value at the specified byte offset from the start of the view. + * Stores an Int8 value at the specified byte offset from the start of the view. * @param byteOffset The place in the buffer at which the value should be set. * @param value The value to set. */ setInt8(byteOffset: number, value: number): void; /** - * Stores an Int16 value at the specified byte offset from the start of the view. + * Stores an Int16 value at the specified byte offset from the start of the view. * @param byteOffset The place in the buffer at which the value should be set. * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, + * @param littleEndian If false or undefined, a big-endian value should be written, * otherwise a little-endian value should be written. */ setInt16(byteOffset: number, value: number, littleEndian?: boolean): void; /** - * Stores an Int32 value at the specified byte offset from the start of the view. + * Stores an Int32 value at the specified byte offset from the start of the view. * @param byteOffset The place in the buffer at which the value should be set. * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, + * @param littleEndian If false or undefined, a big-endian value should be written, * otherwise a little-endian value should be written. */ setInt32(byteOffset: number, value: number, littleEndian?: boolean): void; /** - * Stores an Uint8 value at the specified byte offset from the start of the view. + * Stores an Uint8 value at the specified byte offset from the start of the view. * @param byteOffset The place in the buffer at which the value should be set. * @param value The value to set. */ setUint8(byteOffset: number, value: number): void; /** - * Stores an Uint16 value at the specified byte offset from the start of the view. + * Stores an Uint16 value at the specified byte offset from the start of the view. * @param byteOffset The place in the buffer at which the value should be set. * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, + * @param littleEndian If false or undefined, a big-endian value should be written, * otherwise a little-endian value should be written. */ setUint16(byteOffset: number, value: number, littleEndian?: boolean): void; /** - * Stores an Uint32 value at the specified byte offset from the start of the view. + * Stores an Uint32 value at the specified byte offset from the start of the view. * @param byteOffset The place in the buffer at which the value should be set. * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, + * @param littleEndian If false or undefined, a big-endian value should be written, * otherwise a little-endian value should be written. */ setUint32(byteOffset: number, value: number, littleEndian?: boolean): void; @@ -2692,48 +1462,48 @@ interface DataView { interface DataViewConstructor { new (buffer: ArrayBuffer, byteOffset?: number, byteLength?: number): DataView; } -declare var DataView: DataViewConstructor; +declare const DataView: DataViewConstructor; /** - * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested + * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested * number of bytes could not be allocated an exception is raised. */ interface Int8Array { /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ - BYTES_PER_ELEMENT: number; + readonly BYTES_PER_ELEMENT: number; /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ - buffer: ArrayBuffer; + readonly buffer: ArrayBuffer; /** * The length in bytes of the array. */ - byteLength: number; + readonly byteLength: number; /** * The offset in bytes of the array. */ - byteOffset: number; + readonly byteOffset: number; - /** + /** * Returns the this object after copying a section of the array identified by start and end * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * @param end If not specified, length of the this object is used as its default value. */ - copyWithin(target: number, start: number, end?: number): Int8Array; + copyWithin(target: number, start: number, end?: number): this; /** * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, * or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. @@ -2743,49 +1513,49 @@ interface Int8Array { /** * Returns the this object after filling the section identified by start and end with value * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ - fill(value: number, start?: number, end?: number): Int8Array; + fill(value: number, start?: number, end?: number): this; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - filter(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): Int8Array; + filter(callbackfn: (value: number, index: number, array: Int8Array) => any, thisArg?: any): Int8Array; - /** - * Returns the value of the first element in the array where predicate is true, and undefined + /** + * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; - /** - * Returns the index of the first element in the array where predicate is true, and undefined + /** + * Returns the index of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ findIndex(predicate: (value: number) => boolean, thisArg?: any): number; /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: number, index: number, array: Int8Array) => void, thisArg?: any): void; @@ -2800,7 +1570,7 @@ interface Int8Array { /** * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the + * @param separator A string used to separate one element of an array from the next in the * resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; @@ -2808,7 +1578,7 @@ interface Int8Array { /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the * search starts at index 0. */ lastIndexOf(searchElement: number, fromIndex?: number): number; @@ -2816,68 +1586,68 @@ interface Int8Array { /** * The length of the array. */ - length: number; + readonly length: number; /** - * Calls a defined callback function on each element of an array, and returns an array that + * Calls a defined callback function on each element of an array, and returns an array that * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: number, index: number, array: Int8Array) => number, thisArg?: any): Int8Array; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): Int8Array; @@ -2895,7 +1665,7 @@ interface Int8Array { */ set(array: ArrayLike, offset?: number): void; - /** + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. @@ -2904,31 +1674,31 @@ interface Int8Array { /** * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean; /** * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If + * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ - sort(compareFn?: (a: number, b: number) => number): Int8Array; + sort(compareFn?: (a: number, b: number) => number): this; /** * Gets a new Int8Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. + * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ subarray(begin: number, end?: number): Int8Array; /** - * Converts a number to a string by using the current locale. + * Converts a number to a string by using the current locale. */ toLocaleString(): string; @@ -2940,22 +1710,22 @@ interface Int8Array { [index: number]: number; } interface Int8ArrayConstructor { - prototype: Int8Array; + readonly prototype: Int8Array; new (length: number): Int8Array; new (array: ArrayLike): Int8Array; new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int8Array; /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ - BYTES_PER_ELEMENT: number; + readonly BYTES_PER_ELEMENT: number; /** * Returns a new array from a set of elements. * @param items A set of elements to include in the new array object. */ of(...items: number[]): Int8Array; - + /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. @@ -2965,48 +1735,48 @@ interface Int8ArrayConstructor { from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array; } -declare var Int8Array: Int8ArrayConstructor; +declare const Int8Array: Int8ArrayConstructor; /** - * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the + * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the * requested number of bytes could not be allocated an exception is raised. */ interface Uint8Array { /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ - BYTES_PER_ELEMENT: number; + readonly BYTES_PER_ELEMENT: number; /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ - buffer: ArrayBuffer; + readonly buffer: ArrayBuffer; /** * The length in bytes of the array. */ - byteLength: number; + readonly byteLength: number; /** * The offset in bytes of the array. */ - byteOffset: number; + readonly byteOffset: number; - /** + /** * Returns the this object after copying a section of the array identified by start and end * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * @param end If not specified, length of the this object is used as its default value. */ - copyWithin(target: number, start: number, end?: number): Uint8Array; + copyWithin(target: number, start: number, end?: number): this; /** * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, * or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. @@ -3016,49 +1786,49 @@ interface Uint8Array { /** * Returns the this object after filling the section identified by start and end with value * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ - fill(value: number, start?: number, end?: number): Uint8Array; + fill(value: number, start?: number, end?: number): this; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - filter(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): Uint8Array; + filter(callbackfn: (value: number, index: number, array: Uint8Array) => any, thisArg?: any): Uint8Array; - /** - * Returns the value of the first element in the array where predicate is true, and undefined + /** + * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; - /** - * Returns the index of the first element in the array where predicate is true, and undefined + /** + * Returns the index of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ findIndex(predicate: (value: number) => boolean, thisArg?: any): number; /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: number, index: number, array: Uint8Array) => void, thisArg?: any): void; @@ -3073,7 +1843,7 @@ interface Uint8Array { /** * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the + * @param separator A string used to separate one element of an array from the next in the * resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; @@ -3081,7 +1851,7 @@ interface Uint8Array { /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the * search starts at index 0. */ lastIndexOf(searchElement: number, fromIndex?: number): number; @@ -3089,68 +1859,68 @@ interface Uint8Array { /** * The length of the array. */ - length: number; + readonly length: number; /** - * Calls a defined callback function on each element of an array, and returns an array that + * Calls a defined callback function on each element of an array, and returns an array that * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: number, index: number, array: Uint8Array) => number, thisArg?: any): Uint8Array; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): Uint8Array; @@ -3168,7 +1938,7 @@ interface Uint8Array { */ set(array: ArrayLike, offset?: number): void; - /** + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. @@ -3177,31 +1947,31 @@ interface Uint8Array { /** * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean; /** * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If + * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ - sort(compareFn?: (a: number, b: number) => number): Uint8Array; + sort(compareFn?: (a: number, b: number) => number): this; /** * Gets a new Uint8Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. + * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ subarray(begin: number, end?: number): Uint8Array; /** - * Converts a number to a string by using the current locale. + * Converts a number to a string by using the current locale. */ toLocaleString(): string; @@ -3214,22 +1984,22 @@ interface Uint8Array { } interface Uint8ArrayConstructor { - prototype: Uint8Array; + readonly prototype: Uint8Array; new (length: number): Uint8Array; new (array: ArrayLike): Uint8Array; new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8Array; /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ - BYTES_PER_ELEMENT: number; + readonly BYTES_PER_ELEMENT: number; /** * Returns a new array from a set of elements. * @param items A set of elements to include in the new array object. */ of(...items: number[]): Uint8Array; - + /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. @@ -3239,48 +2009,48 @@ interface Uint8ArrayConstructor { from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array; } -declare var Uint8Array: Uint8ArrayConstructor; +declare const Uint8Array: Uint8ArrayConstructor; /** - * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. + * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. * If the requested number of bytes could not be allocated an exception is raised. */ interface Uint8ClampedArray { /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ - BYTES_PER_ELEMENT: number; + readonly BYTES_PER_ELEMENT: number; /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ - buffer: ArrayBuffer; + readonly buffer: ArrayBuffer; /** * The length in bytes of the array. */ - byteLength: number; + readonly byteLength: number; /** * The offset in bytes of the array. */ - byteOffset: number; + readonly byteOffset: number; - /** + /** * Returns the this object after copying a section of the array identified by start and end * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * @param end If not specified, length of the this object is used as its default value. */ - copyWithin(target: number, start: number, end?: number): Uint8ClampedArray; + copyWithin(target: number, start: number, end?: number): this; /** * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, * or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. @@ -3290,49 +2060,49 @@ interface Uint8ClampedArray { /** * Returns the this object after filling the section identified by start and end with value * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ - fill(value: number, start?: number, end?: number): Uint8ClampedArray; + fill(value: number, start?: number, end?: number): this; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - filter(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): Uint8ClampedArray; + filter(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => any, thisArg?: any): Uint8ClampedArray; - /** - * Returns the value of the first element in the array where predicate is true, and undefined + /** + * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; - /** - * Returns the index of the first element in the array where predicate is true, and undefined + /** + * Returns the index of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ findIndex(predicate: (value: number) => boolean, thisArg?: any): number; /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => void, thisArg?: any): void; @@ -3347,7 +2117,7 @@ interface Uint8ClampedArray { /** * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the + * @param separator A string used to separate one element of an array from the next in the * resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; @@ -3355,7 +2125,7 @@ interface Uint8ClampedArray { /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the * search starts at index 0. */ lastIndexOf(searchElement: number, fromIndex?: number): number; @@ -3363,68 +2133,68 @@ interface Uint8ClampedArray { /** * The length of the array. */ - length: number; + readonly length: number; /** - * Calls a defined callback function on each element of an array, and returns an array that + * Calls a defined callback function on each element of an array, and returns an array that * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => number, thisArg?: any): Uint8ClampedArray; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): Uint8ClampedArray; @@ -3442,7 +2212,7 @@ interface Uint8ClampedArray { */ set(array: Uint8ClampedArray, offset?: number): void; - /** + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. @@ -3451,31 +2221,31 @@ interface Uint8ClampedArray { /** * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): boolean; /** * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If + * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ - sort(compareFn?: (a: number, b: number) => number): Uint8ClampedArray; + sort(compareFn?: (a: number, b: number) => number): this; /** * Gets a new Uint8ClampedArray view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. + * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ subarray(begin: number, end?: number): Uint8ClampedArray; /** - * Converts a number to a string by using the current locale. + * Converts a number to a string by using the current locale. */ toLocaleString(): string; @@ -3488,15 +2258,15 @@ interface Uint8ClampedArray { } interface Uint8ClampedArrayConstructor { - prototype: Uint8ClampedArray; + readonly prototype: Uint8ClampedArray; new (length: number): Uint8ClampedArray; new (array: ArrayLike): Uint8ClampedArray; new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8ClampedArray; /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ - BYTES_PER_ELEMENT: number; + readonly BYTES_PER_ELEMENT: number; /** * Returns a new array from a set of elements. @@ -3512,48 +2282,48 @@ interface Uint8ClampedArrayConstructor { */ from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray; } -declare var Uint8ClampedArray: Uint8ClampedArrayConstructor; +declare const Uint8ClampedArray: Uint8ClampedArrayConstructor; /** - * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the + * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the * requested number of bytes could not be allocated an exception is raised. */ interface Int16Array { /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ - BYTES_PER_ELEMENT: number; + readonly BYTES_PER_ELEMENT: number; /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ - buffer: ArrayBuffer; + readonly buffer: ArrayBuffer; /** * The length in bytes of the array. */ - byteLength: number; + readonly byteLength: number; /** * The offset in bytes of the array. */ - byteOffset: number; + readonly byteOffset: number; - /** + /** * Returns the this object after copying a section of the array identified by start and end * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * @param end If not specified, length of the this object is used as its default value. */ - copyWithin(target: number, start: number, end?: number): Int16Array; + copyWithin(target: number, start: number, end?: number): this; /** * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, * or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. @@ -3563,49 +2333,49 @@ interface Int16Array { /** * Returns the this object after filling the section identified by start and end with value * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ - fill(value: number, start?: number, end?: number): Int16Array; + fill(value: number, start?: number, end?: number): this; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - filter(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): Int16Array; + filter(callbackfn: (value: number, index: number, array: Int16Array) => any, thisArg?: any): Int16Array; - /** - * Returns the value of the first element in the array where predicate is true, and undefined + /** + * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; - /** - * Returns the index of the first element in the array where predicate is true, and undefined + /** + * Returns the index of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ findIndex(predicate: (value: number) => boolean, thisArg?: any): number; /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: number, index: number, array: Int16Array) => void, thisArg?: any): void; @@ -3620,7 +2390,7 @@ interface Int16Array { /** * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the + * @param separator A string used to separate one element of an array from the next in the * resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; @@ -3628,7 +2398,7 @@ interface Int16Array { /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the * search starts at index 0. */ lastIndexOf(searchElement: number, fromIndex?: number): number; @@ -3636,68 +2406,68 @@ interface Int16Array { /** * The length of the array. */ - length: number; + readonly length: number; /** - * Calls a defined callback function on each element of an array, and returns an array that + * Calls a defined callback function on each element of an array, and returns an array that * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: number, index: number, array: Int16Array) => number, thisArg?: any): Int16Array; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): Int16Array; @@ -3715,7 +2485,7 @@ interface Int16Array { */ set(array: ArrayLike, offset?: number): void; - /** + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. @@ -3724,31 +2494,31 @@ interface Int16Array { /** * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean; /** * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If + * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ - sort(compareFn?: (a: number, b: number) => number): Int16Array; + sort(compareFn?: (a: number, b: number) => number): this; /** * Gets a new Int16Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. + * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ subarray(begin: number, end?: number): Int16Array; /** - * Converts a number to a string by using the current locale. + * Converts a number to a string by using the current locale. */ toLocaleString(): string; @@ -3761,22 +2531,22 @@ interface Int16Array { } interface Int16ArrayConstructor { - prototype: Int16Array; + readonly prototype: Int16Array; new (length: number): Int16Array; new (array: ArrayLike): Int16Array; new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int16Array; /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ - BYTES_PER_ELEMENT: number; + readonly BYTES_PER_ELEMENT: number; /** * Returns a new array from a set of elements. * @param items A set of elements to include in the new array object. */ of(...items: number[]): Int16Array; - + /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. @@ -3786,48 +2556,48 @@ interface Int16ArrayConstructor { from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array; } -declare var Int16Array: Int16ArrayConstructor; +declare const Int16Array: Int16ArrayConstructor; /** - * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the + * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the * requested number of bytes could not be allocated an exception is raised. */ interface Uint16Array { /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ - BYTES_PER_ELEMENT: number; + readonly BYTES_PER_ELEMENT: number; /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ - buffer: ArrayBuffer; + readonly buffer: ArrayBuffer; /** * The length in bytes of the array. */ - byteLength: number; + readonly byteLength: number; /** * The offset in bytes of the array. */ - byteOffset: number; + readonly byteOffset: number; - /** + /** * Returns the this object after copying a section of the array identified by start and end * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * @param end If not specified, length of the this object is used as its default value. */ - copyWithin(target: number, start: number, end?: number): Uint16Array; + copyWithin(target: number, start: number, end?: number): this; /** * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, * or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. @@ -3837,49 +2607,49 @@ interface Uint16Array { /** * Returns the this object after filling the section identified by start and end with value * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ - fill(value: number, start?: number, end?: number): Uint16Array; + fill(value: number, start?: number, end?: number): this; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - filter(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): Uint16Array; + filter(callbackfn: (value: number, index: number, array: Uint16Array) => any, thisArg?: any): Uint16Array; - /** - * Returns the value of the first element in the array where predicate is true, and undefined + /** + * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; - /** - * Returns the index of the first element in the array where predicate is true, and undefined + /** + * Returns the index of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ findIndex(predicate: (value: number) => boolean, thisArg?: any): number; /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: number, index: number, array: Uint16Array) => void, thisArg?: any): void; @@ -3894,7 +2664,7 @@ interface Uint16Array { /** * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the + * @param separator A string used to separate one element of an array from the next in the * resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; @@ -3902,7 +2672,7 @@ interface Uint16Array { /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the * search starts at index 0. */ lastIndexOf(searchElement: number, fromIndex?: number): number; @@ -3910,68 +2680,68 @@ interface Uint16Array { /** * The length of the array. */ - length: number; + readonly length: number; /** - * Calls a defined callback function on each element of an array, and returns an array that + * Calls a defined callback function on each element of an array, and returns an array that * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: number, index: number, array: Uint16Array) => number, thisArg?: any): Uint16Array; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): Uint16Array; @@ -3989,7 +2759,7 @@ interface Uint16Array { */ set(array: ArrayLike, offset?: number): void; - /** + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. @@ -3998,31 +2768,31 @@ interface Uint16Array { /** * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean; /** * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If + * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ - sort(compareFn?: (a: number, b: number) => number): Uint16Array; + sort(compareFn?: (a: number, b: number) => number): this; /** * Gets a new Uint16Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. + * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ subarray(begin: number, end?: number): Uint16Array; /** - * Converts a number to a string by using the current locale. + * Converts a number to a string by using the current locale. */ toLocaleString(): string; @@ -4035,22 +2805,22 @@ interface Uint16Array { } interface Uint16ArrayConstructor { - prototype: Uint16Array; + readonly prototype: Uint16Array; new (length: number): Uint16Array; new (array: ArrayLike): Uint16Array; new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint16Array; /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ - BYTES_PER_ELEMENT: number; + readonly BYTES_PER_ELEMENT: number; /** * Returns a new array from a set of elements. * @param items A set of elements to include in the new array object. */ of(...items: number[]): Uint16Array; - + /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. @@ -4060,47 +2830,47 @@ interface Uint16ArrayConstructor { from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array; } -declare var Uint16Array: Uint16ArrayConstructor; +declare const Uint16Array: Uint16ArrayConstructor; /** - * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the + * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the * requested number of bytes could not be allocated an exception is raised. */ interface Int32Array { /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ - BYTES_PER_ELEMENT: number; + readonly BYTES_PER_ELEMENT: number; /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ - buffer: ArrayBuffer; + readonly buffer: ArrayBuffer; /** * The length in bytes of the array. */ - byteLength: number; + readonly byteLength: number; /** * The offset in bytes of the array. */ - byteOffset: number; + readonly byteOffset: number; - /** + /** * Returns the this object after copying a section of the array identified by start and end * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * @param end If not specified, length of the this object is used as its default value. */ - copyWithin(target: number, start: number, end?: number): Int32Array; + copyWithin(target: number, start: number, end?: number): this; /** * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, * or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. @@ -4110,49 +2880,49 @@ interface Int32Array { /** * Returns the this object after filling the section identified by start and end with value * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ - fill(value: number, start?: number, end?: number): Int32Array; + fill(value: number, start?: number, end?: number): this; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - filter(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): Int32Array; + filter(callbackfn: (value: number, index: number, array: Int32Array) => any, thisArg?: any): Int32Array; - /** - * Returns the value of the first element in the array where predicate is true, and undefined + /** + * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; - /** - * Returns the index of the first element in the array where predicate is true, and undefined + /** + * Returns the index of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ findIndex(predicate: (value: number) => boolean, thisArg?: any): number; /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: number, index: number, array: Int32Array) => void, thisArg?: any): void; @@ -4167,7 +2937,7 @@ interface Int32Array { /** * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the + * @param separator A string used to separate one element of an array from the next in the * resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; @@ -4175,7 +2945,7 @@ interface Int32Array { /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the * search starts at index 0. */ lastIndexOf(searchElement: number, fromIndex?: number): number; @@ -4183,68 +2953,68 @@ interface Int32Array { /** * The length of the array. */ - length: number; + readonly length: number; /** - * Calls a defined callback function on each element of an array, and returns an array that + * Calls a defined callback function on each element of an array, and returns an array that * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: number, index: number, array: Int32Array) => number, thisArg?: any): Int32Array; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): Int32Array; @@ -4262,7 +3032,7 @@ interface Int32Array { */ set(array: ArrayLike, offset?: number): void; - /** + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. @@ -4271,31 +3041,31 @@ interface Int32Array { /** * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean; /** * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If + * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ - sort(compareFn?: (a: number, b: number) => number): Int32Array; + sort(compareFn?: (a: number, b: number) => number): this; /** * Gets a new Int32Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. + * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ subarray(begin: number, end?: number): Int32Array; /** - * Converts a number to a string by using the current locale. + * Converts a number to a string by using the current locale. */ toLocaleString(): string; @@ -4308,22 +3078,22 @@ interface Int32Array { } interface Int32ArrayConstructor { - prototype: Int32Array; + readonly prototype: Int32Array; new (length: number): Int32Array; new (array: ArrayLike): Int32Array; new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int32Array; /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ - BYTES_PER_ELEMENT: number; + readonly BYTES_PER_ELEMENT: number; /** * Returns a new array from a set of elements. * @param items A set of elements to include in the new array object. */ of(...items: number[]): Int32Array; - + /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. @@ -4332,48 +3102,48 @@ interface Int32ArrayConstructor { */ from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array; } -declare var Int32Array: Int32ArrayConstructor; +declare const Int32Array: Int32ArrayConstructor; /** - * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the + * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the * requested number of bytes could not be allocated an exception is raised. */ interface Uint32Array { /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ - BYTES_PER_ELEMENT: number; + readonly BYTES_PER_ELEMENT: number; /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ - buffer: ArrayBuffer; + readonly buffer: ArrayBuffer; /** * The length in bytes of the array. */ - byteLength: number; + readonly byteLength: number; /** * The offset in bytes of the array. */ - byteOffset: number; + readonly byteOffset: number; - /** + /** * Returns the this object after copying a section of the array identified by start and end * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * @param end If not specified, length of the this object is used as its default value. */ - copyWithin(target: number, start: number, end?: number): Uint32Array; + copyWithin(target: number, start: number, end?: number): this; /** * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, * or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. @@ -4383,49 +3153,49 @@ interface Uint32Array { /** * Returns the this object after filling the section identified by start and end with value * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ - fill(value: number, start?: number, end?: number): Uint32Array; + fill(value: number, start?: number, end?: number): this; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - filter(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): Uint32Array; + filter(callbackfn: (value: number, index: number, array: Uint32Array) => any, thisArg?: any): Uint32Array; - /** - * Returns the value of the first element in the array where predicate is true, and undefined + /** + * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; - /** - * Returns the index of the first element in the array where predicate is true, and undefined + /** + * Returns the index of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ findIndex(predicate: (value: number) => boolean, thisArg?: any): number; /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: number, index: number, array: Uint32Array) => void, thisArg?: any): void; @@ -4440,7 +3210,7 @@ interface Uint32Array { /** * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the + * @param separator A string used to separate one element of an array from the next in the * resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; @@ -4448,7 +3218,7 @@ interface Uint32Array { /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the * search starts at index 0. */ lastIndexOf(searchElement: number, fromIndex?: number): number; @@ -4456,68 +3226,68 @@ interface Uint32Array { /** * The length of the array. */ - length: number; + readonly length: number; /** - * Calls a defined callback function on each element of an array, and returns an array that + * Calls a defined callback function on each element of an array, and returns an array that * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: number, index: number, array: Uint32Array) => number, thisArg?: any): Uint32Array; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): Uint32Array; @@ -4535,7 +3305,7 @@ interface Uint32Array { */ set(array: ArrayLike, offset?: number): void; - /** + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. @@ -4544,31 +3314,31 @@ interface Uint32Array { /** * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean; /** * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If + * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ - sort(compareFn?: (a: number, b: number) => number): Uint32Array; + sort(compareFn?: (a: number, b: number) => number): this; /** * Gets a new Uint32Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. + * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ subarray(begin: number, end?: number): Uint32Array; /** - * Converts a number to a string by using the current locale. + * Converts a number to a string by using the current locale. */ toLocaleString(): string; @@ -4581,22 +3351,22 @@ interface Uint32Array { } interface Uint32ArrayConstructor { - prototype: Uint32Array; + readonly prototype: Uint32Array; new (length: number): Uint32Array; new (array: ArrayLike): Uint32Array; new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint32Array; /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ - BYTES_PER_ELEMENT: number; + readonly BYTES_PER_ELEMENT: number; /** * Returns a new array from a set of elements. * @param items A set of elements to include in the new array object. */ of(...items: number[]): Uint32Array; - + /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. @@ -4605,7 +3375,7 @@ interface Uint32ArrayConstructor { */ from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array; } -declare var Uint32Array: Uint32ArrayConstructor; +declare const Uint32Array: Uint32ArrayConstructor; /** * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number @@ -4613,40 +3383,40 @@ declare var Uint32Array: Uint32ArrayConstructor; */ interface Float32Array { /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ - BYTES_PER_ELEMENT: number; + readonly BYTES_PER_ELEMENT: number; /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ - buffer: ArrayBuffer; + readonly buffer: ArrayBuffer; /** * The length in bytes of the array. */ - byteLength: number; + readonly byteLength: number; /** * The offset in bytes of the array. */ - byteOffset: number; + readonly byteOffset: number; - /** + /** * Returns the this object after copying a section of the array identified by start and end * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * @param end If not specified, length of the this object is used as its default value. */ - copyWithin(target: number, start: number, end?: number): Float32Array; + copyWithin(target: number, start: number, end?: number): this; /** * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, * or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. @@ -4656,49 +3426,49 @@ interface Float32Array { /** * Returns the this object after filling the section identified by start and end with value * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ - fill(value: number, start?: number, end?: number): Float32Array; + fill(value: number, start?: number, end?: number): this; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - filter(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): Float32Array; + filter(callbackfn: (value: number, index: number, array: Float32Array) => any, thisArg?: any): Float32Array; - /** - * Returns the value of the first element in the array where predicate is true, and undefined + /** + * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; - /** - * Returns the index of the first element in the array where predicate is true, and undefined + /** + * Returns the index of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ findIndex(predicate: (value: number) => boolean, thisArg?: any): number; /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: number, index: number, array: Float32Array) => void, thisArg?: any): void; @@ -4713,7 +3483,7 @@ interface Float32Array { /** * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the + * @param separator A string used to separate one element of an array from the next in the * resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; @@ -4721,7 +3491,7 @@ interface Float32Array { /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the * search starts at index 0. */ lastIndexOf(searchElement: number, fromIndex?: number): number; @@ -4729,68 +3499,68 @@ interface Float32Array { /** * The length of the array. */ - length: number; + readonly length: number; /** - * Calls a defined callback function on each element of an array, and returns an array that + * Calls a defined callback function on each element of an array, and returns an array that * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: number, index: number, array: Float32Array) => number, thisArg?: any): Float32Array; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): Float32Array; @@ -4808,7 +3578,7 @@ interface Float32Array { */ set(array: ArrayLike, offset?: number): void; - /** + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. @@ -4817,31 +3587,31 @@ interface Float32Array { /** * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean; /** * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If + * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ - sort(compareFn?: (a: number, b: number) => number): Float32Array; + sort(compareFn?: (a: number, b: number) => number): this; /** * Gets a new Float32Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. + * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ subarray(begin: number, end?: number): Float32Array; /** - * Converts a number to a string by using the current locale. + * Converts a number to a string by using the current locale. */ toLocaleString(): string; @@ -4854,22 +3624,22 @@ interface Float32Array { } interface Float32ArrayConstructor { - prototype: Float32Array; + readonly prototype: Float32Array; new (length: number): Float32Array; new (array: ArrayLike): Float32Array; new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float32Array; /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ - BYTES_PER_ELEMENT: number; + readonly BYTES_PER_ELEMENT: number; /** * Returns a new array from a set of elements. * @param items A set of elements to include in the new array object. */ of(...items: number[]): Float32Array; - + /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. @@ -4879,48 +3649,48 @@ interface Float32ArrayConstructor { from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array; } -declare var Float32Array: Float32ArrayConstructor; +declare const Float32Array: Float32ArrayConstructor; /** - * A typed array of 64-bit float values. The contents are initialized to 0. If the requested + * A typed array of 64-bit float values. The contents are initialized to 0. If the requested * number of bytes could not be allocated an exception is raised. */ interface Float64Array { /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ - BYTES_PER_ELEMENT: number; + readonly BYTES_PER_ELEMENT: number; /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ - buffer: ArrayBuffer; + readonly buffer: ArrayBuffer; /** * The length in bytes of the array. */ - byteLength: number; + readonly byteLength: number; /** * The offset in bytes of the array. */ - byteOffset: number; + readonly byteOffset: number; - /** + /** * Returns the this object after copying a section of the array identified by start and end * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * @param end If not specified, length of the this object is used as its default value. */ - copyWithin(target: number, start: number, end?: number): Float64Array; + copyWithin(target: number, start: number, end?: number): this; /** * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, * or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. @@ -4930,49 +3700,49 @@ interface Float64Array { /** * Returns the this object after filling the section identified by start and end with value * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ - fill(value: number, start?: number, end?: number): Float64Array; + fill(value: number, start?: number, end?: number): this; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - filter(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): Float64Array; + filter(callbackfn: (value: number, index: number, array: Float64Array) => any, thisArg?: any): Float64Array; - /** - * Returns the value of the first element in the array where predicate is true, and undefined + /** + * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; - /** - * Returns the index of the first element in the array where predicate is true, and undefined + /** + * Returns the index of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ findIndex(predicate: (value: number) => boolean, thisArg?: any): number; /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: number, index: number, array: Float64Array) => void, thisArg?: any): void; @@ -4987,7 +3757,7 @@ interface Float64Array { /** * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the + * @param separator A string used to separate one element of an array from the next in the * resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; @@ -4995,7 +3765,7 @@ interface Float64Array { /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the * search starts at index 0. */ lastIndexOf(searchElement: number, fromIndex?: number): number; @@ -5003,68 +3773,68 @@ interface Float64Array { /** * The length of the array. */ - length: number; + readonly length: number; /** - * Calls a defined callback function on each element of an array, and returns an array that + * Calls a defined callback function on each element of an array, and returns an array that * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: number, index: number, array: Float64Array) => number, thisArg?: any): Float64Array; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): Float64Array; @@ -5082,7 +3852,7 @@ interface Float64Array { */ set(array: ArrayLike, offset?: number): void; - /** + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. @@ -5091,31 +3861,31 @@ interface Float64Array { /** * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean; /** * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If + * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ - sort(compareFn?: (a: number, b: number) => number): Float64Array; + sort(compareFn?: (a: number, b: number) => number): this; /** * Gets a new Float64Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. + * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ subarray(begin: number, end?: number): Float64Array; /** - * Converts a number to a string by using the current locale. + * Converts a number to a string by using the current locale. */ toLocaleString(): string; @@ -5128,22 +3898,22 @@ interface Float64Array { } interface Float64ArrayConstructor { - prototype: Float64Array; + readonly prototype: Float64Array; new (length: number): Float64Array; new (array: ArrayLike): Float64Array; new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float64Array; /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ - BYTES_PER_ELEMENT: number; + readonly BYTES_PER_ELEMENT: number; /** * Returns a new array from a set of elements. * @param items A set of elements to include in the new array object. */ of(...items: number[]): Float64Array; - + /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. @@ -5152,9 +3922,10 @@ interface Float64ArrayConstructor { */ from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; } -declare var Float64Array: Float64ArrayConstructor; +declare const Float64Array: Float64ArrayConstructor; + ///////////////////////////// -/// ECMAScript Internationalization API +/// ECMAScript Internationalization API ///////////////////////////// declare module Intl { @@ -5297,14 +4068,14 @@ interface String { interface Number { /** - * Converts a number to a string by using the current or specified locale. + * Converts a number to a string by using the current or specified locale. * @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. * @param options An object that contains one or more properties that specify comparison options. */ toLocaleString(locales?: string[], options?: Intl.NumberFormatOptions): string; /** - * Converts a number to a string by using the current or specified locale. + * Converts a number to a string by using the current or specified locale. * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. * @param options An object that contains one or more properties that specify comparison options. */ @@ -5313,48 +4084,1517 @@ interface Number { interface Date { /** - * Converts a date and time to a string by using the current or specified locale. + * Converts a date and time to a string by using the current or specified locale. * @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. * @param options An object that contains one or more properties that specify comparison options. */ toLocaleString(locales?: string[], options?: Intl.DateTimeFormatOptions): string; /** - * Converts a date to a string by using the current or specified locale. + * Converts a date to a string by using the current or specified locale. * @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. * @param options An object that contains one or more properties that specify comparison options. */ toLocaleDateString(locales?: string[], options?: Intl.DateTimeFormatOptions): string; /** - * Converts a time to a string by using the current or specified locale. + * Converts a time to a string by using the current or specified locale. * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. * @param options An object that contains one or more properties that specify comparison options. */ toLocaleTimeString(locale?: string[], options?: Intl.DateTimeFormatOptions): string; - + /** - * Converts a date and time to a string by using the current or specified locale. + * Converts a date and time to a string by using the current or specified locale. * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. * @param options An object that contains one or more properties that specify comparison options. */ toLocaleString(locale?: string, options?: Intl.DateTimeFormatOptions): string; - + /** - * Converts a date to a string by using the current or specified locale. + * Converts a date to a string by using the current or specified locale. * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. * @param options An object that contains one or more properties that specify comparison options. */ toLocaleDateString(locale?: string, options?: Intl.DateTimeFormatOptions): string; /** - * Converts a time to a string by using the current or specified locale. + * Converts a time to a string by using the current or specified locale. * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. * @param options An object that contains one or more properties that specify comparison options. */ toLocaleTimeString(locale?: string, options?: Intl.DateTimeFormatOptions): string; } +declare type PropertyKey = string | number | symbol; + +interface Array { + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: T, index: number, obj: Array) => boolean, thisArg?: any): T | undefined; + + /** + * Returns the index of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: T) => boolean, thisArg?: any): number; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: T, start?: number, end?: number): this; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; +} + +interface ArrayConstructor { + /** + * Creates an array from an array-like object. + * @param arrayLike An array-like object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): Array; + /** + * Creates an array from an array-like object. + * @param arrayLike An array-like object to convert to an array. + */ + from(arrayLike: ArrayLike): Array; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: T[]): Array; +} + +interface Function { + /** + * Returns the name of the function. Function names are read-only and can not be changed. + */ + readonly name: string; +} + +interface Math { + /** + * Returns the number of leading zero bits in the 32-bit binary representation of a number. + * @param x A numeric expression. + */ + clz32(x: number): number; + + /** + * Returns the result of 32-bit multiplication of two numbers. + * @param x First number + * @param y Second number + */ + imul(x: number, y: number): number; + + /** + * Returns the sign of the x, indicating whether x is positive, negative or zero. + * @param x The numeric expression to test + */ + sign(x: number): number; + + /** + * Returns the base 10 logarithm of a number. + * @param x A numeric expression. + */ + log10(x: number): number; + + /** + * Returns the base 2 logarithm of a number. + * @param x A numeric expression. + */ + log2(x: number): number; + + /** + * Returns the natural logarithm of 1 + x. + * @param x A numeric expression. + */ + log1p(x: number): number; + + /** + * Returns the result of (e^x - 1) of x (e raised to the power of x, where e is the base of + * the natural logarithms). + * @param x A numeric expression. + */ + expm1(x: number): number; + + /** + * Returns the hyperbolic cosine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + cosh(x: number): number; + + /** + * Returns the hyperbolic sine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + sinh(x: number): number; + + /** + * Returns the hyperbolic tangent of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + tanh(x: number): number; + + /** + * Returns the inverse hyperbolic cosine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + acosh(x: number): number; + + /** + * Returns the inverse hyperbolic sine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + asinh(x: number): number; + + /** + * Returns the inverse hyperbolic tangent of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + atanh(x: number): number; + + /** + * Returns the square root of the sum of squares of its arguments. + * @param values Values to compute the square root for. + * If no arguments are passed, the result is +0. + * If there is only one argument, the result is the absolute value. + * If any argument is +Infinity or -Infinity, the result is +Infinity. + * If any argument is NaN, the result is NaN. + * If all arguments are either +0 or −0, the result is +0. + */ + hypot(...values: number[] ): number; + + /** + * Returns the integral part of the a numeric expression, x, removing any fractional digits. + * If x is already an integer, the result is x. + * @param x A numeric expression. + */ + trunc(x: number): number; + + /** + * Returns the nearest single precision float representation of a number. + * @param x A numeric expression. + */ + fround(x: number): number; + + /** + * Returns an implementation-dependent approximation to the cube root of number. + * @param x A numeric expression. + */ + cbrt(x: number): number; +} + +interface NumberConstructor { + /** + * The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1 + * that is representable as a Number value, which is approximately: + * 2.2204460492503130808472633361816 x 10‍−‍16. + */ + readonly EPSILON: number; + + /** + * Returns true if passed value is finite. + * Unlike the global isFininte, Number.isFinite doesn't forcibly convert the parameter to a + * number. Only finite values of the type number, result in true. + * @param number A numeric value. + */ + isFinite(number: number): boolean; + + /** + * Returns true if the value passed is an integer, false otherwise. + * @param number A numeric value. + */ + isInteger(number: number): boolean; + + /** + * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a + * number). Unlike the global isNaN(), Number.isNaN() doesn't forcefully convert the parameter + * to a number. Only values of the type number, that are also NaN, result in true. + * @param number A numeric value. + */ + isNaN(number: number): boolean; + + /** + * Returns true if the value passed is a safe integer. + * @param number A numeric value. + */ + isSafeInteger(number: number): boolean; + + /** + * The value of the largest integer n such that n and n + 1 are both exactly representable as + * a Number value. + * The value of Number.MIN_SAFE_INTEGER is 9007199254740991 2^53 − 1. + */ + readonly MAX_SAFE_INTEGER: number; + + /** + * The value of the smallest integer n such that n and n − 1 are both exactly representable as + * a Number value. + * The value of Number.MIN_SAFE_INTEGER is −9007199254740991 (−(2^53 − 1)). + */ + readonly MIN_SAFE_INTEGER: number; + + /** + * Converts a string to a floating-point number. + * @param string A string that contains a floating-point number. + */ + parseFloat(string: string): number; + + /** + * Converts A string to an integer. + * @param s A string to convert into a number. + * @param radix A value between 2 and 36 that specifies the base of the number in numString. + * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. + * All other strings are considered decimal. + */ + parseInt(string: string, radix?: number): number; +} + +interface Object { + /** + * Determines whether an object has a property with the specified name. + * @param v A property name. + */ + hasOwnProperty(v: PropertyKey): boolean + + /** + * Determines whether a specified property is enumerable. + * @param v A property name. + */ + propertyIsEnumerable(v: PropertyKey): boolean; +} + +interface ObjectConstructor { + /** + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * @param target The target object to copy to. + * @param source The source object from which to copy properties. + */ + assign(target: T, source: U): T & U; + + /** + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * @param target The target object to copy to. + * @param source1 The first source object from which to copy properties. + * @param source2 The second source object from which to copy properties. + */ + assign(target: T, source1: U, source2: V): T & U & V; + + /** + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * @param target The target object to copy to. + * @param source1 The first source object from which to copy properties. + * @param source2 The second source object from which to copy properties. + * @param source3 The third source object from which to copy properties. + */ + assign(target: T, source1: U, source2: V, source3: W): T & U & V & W; + + /** + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * @param target The target object to copy to. + * @param sources One or more source objects from which to copy properties + */ + assign(target: any, ...sources: any[]): any; + + /** + * Returns an array of all symbol properties found directly on object o. + * @param o Object to retrieve the symbols from. + */ + getOwnPropertySymbols(o: any): symbol[]; + + /** + * Returns true if the values are the same value, false otherwise. + * @param value1 The first value. + * @param value2 The second value. + */ + is(value1: any, value2: any): boolean; + + /** + * Sets the prototype of a specified object o to object proto or null. Returns the object o. + * @param o The object to change its prototype. + * @param proto The value of the new prototype or null. + */ + setPrototypeOf(o: any, proto: any): any; + + /** + * Gets the own property descriptor of the specified object. + * An own property descriptor is one that is defined directly on the object and is not + * inherited from the object's prototype. + * @param o Object that contains the property. + * @param p Name of the property. + */ + getOwnPropertyDescriptor(o: any, propertyKey: PropertyKey): PropertyDescriptor; + + /** + * Adds a property to an object, or modifies attributes of an existing property. + * @param o Object on which to add or modify the property. This can be a native JavaScript + * object (that is, a user-defined object or a built in object) or a DOM object. + * @param p The property name. + * @param attributes Descriptor for the property. It can be for a data property or an accessor + * property. + */ + defineProperty(o: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): any; +} + +interface RegExp { + /** + * Returns a string indicating the flags of the regular expression in question. This field is read-only. + * The characters in this string are sequenced and concatenated in the following order: + * + * - "g" for global + * - "i" for ignoreCase + * - "m" for multiline + * - "u" for unicode + * - "y" for sticky + * + * If no flags are set, the value is the empty string. + */ + readonly flags: string; + + /** + * Returns a Boolean value indicating the state of the sticky flag (y) used with a regular + * expression. Default is false. Read-only. + */ + readonly sticky: boolean; + + /** + * Returns a Boolean value indicating the state of the Unicode flag (u) used with a regular + * expression. Default is false. Read-only. + */ + readonly unicode: boolean; +} + +interface RegExpConstructor { + new (pattern: RegExp, flags?: string): RegExp; + (pattern: RegExp, flags?: string): RegExp; +} + +interface String { + /** + * Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point + * value of the UTF-16 encoded code point starting at the string element at position pos in + * the String resulting from converting this object to a String. + * If there is no element at that position, the result is undefined. + * If a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos. + */ + codePointAt(pos: number): number | undefined; + + /** + * Returns true if searchString appears as a substring of the result of converting this + * object to a String, at one or more positions that are + * greater than or equal to position; otherwise, returns false. + * @param searchString search string + * @param position If position is undefined, 0 is assumed, so as to search all of the String. + */ + includes(searchString: string, position?: number): boolean; + + /** + * Returns true if the sequence of elements of searchString converted to a String is the + * same as the corresponding elements of this object (converted to a String) starting at + * endPosition – length(this). Otherwise returns false. + */ + endsWith(searchString: string, endPosition?: number): boolean; + + /** + * Returns the String value result of normalizing the string into the normalization form + * named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms. + * @param form Applicable values: "NFC", "NFD", "NFKC", or "NFKD", If not specified default + * is "NFC" + */ + normalize(form: "NFC" | "NFD" | "NFKC" | "NFKD"): string; + + /** + * Returns the String value result of normalizing the string into the normalization form + * named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms. + * @param form Applicable values: "NFC", "NFD", "NFKC", or "NFKD", If not specified default + * is "NFC" + */ + normalize(form?: string): string; + + /** + * Returns a String value that is made from count copies appended together. If count is 0, + * T is the empty String is returned. + * @param count number of copies to append + */ + repeat(count: number): string; + + /** + * Returns true if the sequence of elements of searchString converted to a String is the + * same as the corresponding elements of this object (converted to a String) starting at + * position. Otherwise returns false. + */ + startsWith(searchString: string, position?: number): boolean; + + /** + * Returns an HTML anchor element and sets the name attribute to the text value + * @param name + */ + anchor(name: string): string; + + /** Returns a HTML element */ + big(): string; + + /** Returns a HTML element */ + blink(): string; + + /** Returns a HTML element */ + bold(): string; + + /** Returns a HTML element */ + fixed(): string + + /** Returns a HTML element and sets the color attribute value */ + fontcolor(color: string): string + + /** Returns a HTML element and sets the size attribute value */ + fontsize(size: number): string; + + /** Returns a HTML element and sets the size attribute value */ + fontsize(size: string): string; + + /** Returns an HTML element */ + italics(): string; + + /** Returns an HTML element and sets the href attribute value */ + link(url: string): string; + + /** Returns a HTML element */ + small(): string; + + /** Returns a HTML element */ + strike(): string; + + /** Returns a HTML element */ + sub(): string; + + /** Returns a HTML element */ + sup(): string; +} + +interface StringConstructor { + /** + * Return the String value whose elements are, in order, the elements in the List elements. + * If length is 0, the empty string is returned. + */ + fromCodePoint(...codePoints: number[]): string; + + /** + * String.raw is intended for use as a tag function of a Tagged Template String. When called + * as such the first argument will be a well formed template call site object and the rest + * parameter will contain the substitution values. + * @param template A well-formed template string call site representation. + * @param substitutions A set of substitution values. + */ + raw(template: TemplateStringsArray, ...substitutions: any[]): string; +} +interface Map { + clear(): void; + delete(key: K): boolean; + forEach(callbackfn: (value: V, index: K, map: Map) => void, thisArg?: any): void; + get(key: K): V | undefined; + has(key: K): boolean; + set(key: K, value?: V): this; + readonly size: number; +} + +interface MapConstructor { + new (): Map; + new (entries?: [K, V][]): Map; + readonly prototype: Map; +} +declare var Map: MapConstructor; + +interface WeakMap { + clear(): void; + delete(key: K): boolean; + get(key: K): V | undefined; + has(key: K): boolean; + set(key: K, value?: V): this; +} + +interface WeakMapConstructor { + new (): WeakMap; + new (entries?: [K, V][]): WeakMap; + readonly prototype: WeakMap; +} +declare var WeakMap: WeakMapConstructor; + +interface Set { + add(value: T): this; + clear(): void; + delete(value: T): boolean; + forEach(callbackfn: (value: T, index: T, set: Set) => void, thisArg?: any): void; + has(value: T): boolean; + readonly size: number; +} + +interface SetConstructor { + new (): Set; + new (values?: T[]): Set; + readonly prototype: Set; +} +declare var Set: SetConstructor; + +interface WeakSet { + add(value: T): this; + clear(): void; + delete(value: T): boolean; + has(value: T): boolean; +} + +interface WeakSetConstructor { + new (): WeakSet; + new (values?: T[]): WeakSet; + readonly prototype: WeakSet; +} +declare var WeakSet: WeakSetConstructor; +interface GeneratorFunction extends Function { } + +interface GeneratorFunctionConstructor { + /** + * Creates a new Generator function. + * @param args A list of arguments the function accepts. + */ + new (...args: string[]): GeneratorFunction; + (...args: string[]): GeneratorFunction; + readonly prototype: GeneratorFunction; +} +declare var GeneratorFunction: GeneratorFunctionConstructor; +/// + +interface SymbolConstructor { + /** + * A method that returns the default iterator for an object. Called by the semantics of the + * for-of statement. + */ + readonly iterator: symbol; +} + +interface IteratorResult { + done: boolean; + value: T; +} + +interface Iterator { + next(value?: any): IteratorResult; + return?(value?: any): IteratorResult; + throw?(e?: any): IteratorResult; +} + +interface Iterable { + [Symbol.iterator](): Iterator; +} + +interface IterableIterator extends Iterator { + [Symbol.iterator](): IterableIterator; +} + +interface Array { + /** Iterator */ + [Symbol.iterator](): IterableIterator; + + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, T]>; + + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface ArrayConstructor { + /** + * Creates an array from an iterable object. + * @param iterable An iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(iterable: Iterable, mapfn: (v: T, k: number) => U, thisArg?: any): Array; + + /** + * Creates an array from an iterable object. + * @param iterable An iterable object to convert to an array. + */ + from(iterable: Iterable): Array; +} + +interface IArguments { + /** Iterator */ + [Symbol.iterator](): IterableIterator; +} + +interface Map { + [Symbol.iterator](): IterableIterator<[K,V]>; + entries(): IterableIterator<[K, V]>; + keys(): IterableIterator; + values(): IterableIterator; +} + +interface MapConstructor { + new (iterable: Iterable<[K, V]>): Map; +} + +interface WeakMap { } + +interface WeakMapConstructor { + new (iterable: Iterable<[K, V]>): WeakMap; +} + +interface Set { + [Symbol.iterator](): IterableIterator; + entries(): IterableIterator<[T, T]>; + keys(): IterableIterator; + values(): IterableIterator; +} + +interface SetConstructor { + new (iterable: Iterable): Set; +} + +interface WeakSet { } + +interface WeakSetConstructor { + new (iterable: Iterable): WeakSet; +} + +interface Promise { } + +interface PromiseConstructor { + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any Promise is rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + all(values: Iterable>): Promise; + + /** + * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved + * or rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + race(values: Iterable>): Promise; +} + +declare namespace Reflect { + function enumerate(target: any): IterableIterator; +} + +interface String { + /** Iterator */ + [Symbol.iterator](): IterableIterator; +} + +/** + * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Int8Array { + [Symbol.iterator](): IterableIterator; + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Int8ArrayConstructor { + new (elements: Iterable): Int8Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array; +} + +/** + * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8Array { + [Symbol.iterator](): IterableIterator; + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Uint8ArrayConstructor { + new (elements: Iterable): Uint8Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array; +} + +/** + * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. + * If the requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8ClampedArray { + [Symbol.iterator](): IterableIterator; + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Uint8ClampedArrayConstructor { + new (elements: Iterable): Uint8ClampedArray; + + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray; +} + +/** + * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int16Array { + [Symbol.iterator](): IterableIterator; + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Int16ArrayConstructor { + new (elements: Iterable): Int16Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array; +} + +/** + * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint16Array { + [Symbol.iterator](): IterableIterator; + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Uint16ArrayConstructor { + new (elements: Iterable): Uint16Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array; +} + +/** + * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int32Array { + [Symbol.iterator](): IterableIterator; + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Int32ArrayConstructor { + new (elements: Iterable): Int32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array; +} + +/** + * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint32Array { + [Symbol.iterator](): IterableIterator; + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Uint32ArrayConstructor { + new (elements: Iterable): Uint32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array; +} + +/** + * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number + * of bytes could not be allocated an exception is raised. + */ +interface Float32Array { + [Symbol.iterator](): IterableIterator; + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Float32ArrayConstructor { + new (elements: Iterable): Float32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array; +} + +/** + * A typed array of 64-bit float values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Float64Array { + [Symbol.iterator](): IterableIterator; + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Float64ArrayConstructor { + new (elements: Iterable): Float64Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; +}/** + * Represents the completion of an asynchronous operation + */ +interface Promise { + /** + * Attaches callbacks for the resolution and/or rejection of the Promise. + * @param onfulfilled The callback to execute when the Promise is resolved. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of which ever callback is executed. + */ + then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; + then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): Promise; + + /** + * Attaches a callback for only the rejection of the Promise. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of the callback. + */ + catch(onrejected?: (reason: any) => T | PromiseLike): Promise; + catch(onrejected?: (reason: any) => void): Promise; +} + +interface PromiseConstructor { + /** + * A reference to the prototype. + */ + readonly prototype: Promise; + + /** + * Creates a new Promise. + * @param executor A callback used to initialize the promise. This callback is passed two arguments: + * a resolve callback used resolve the promise with a value or the result of another promise, + * and a reject callback used to reject the promise with a provided reason or error. + */ + new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void): Promise; + + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any Promise is rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike, T10 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>; + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>; + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>; + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7]>; + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6]>; + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike]): Promise<[T1, T2, T3, T4, T5]>; + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike ]): Promise<[T1, T2, T3, T4]>; + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike]): Promise<[T1, T2, T3]>; + all(values: [T1 | PromiseLike, T2 | PromiseLike]): Promise<[T1, T2]>; + + /** + * Creates a new rejected promise for the provided reason. + * @param reason The reason the promise was rejected. + * @returns A new rejected Promise. + */ + reject(reason: any): Promise; + + /** + * Creates a new rejected promise for the provided reason. + * @param reason The reason the promise was rejected. + * @returns A new rejected Promise. + */ + reject(reason: any): Promise; + + /** + * Creates a new resolved promise for the provided value. + * @param value A promise. + * @returns A promise whose internal state matches the provided promise. + */ + resolve(value: T | PromiseLike): Promise; + + /** + * Creates a new resolved promise . + * @returns A resolved promise. + */ + resolve(): Promise; +} + +declare var Promise: PromiseConstructor;interface ProxyHandler { + getPrototypeOf? (target: T): any; + setPrototypeOf? (target: T, v: any): boolean; + isExtensible? (target: T): boolean; + preventExtensions? (target: T): boolean; + getOwnPropertyDescriptor? (target: T, p: PropertyKey): PropertyDescriptor; + has? (target: T, p: PropertyKey): boolean; + get? (target: T, p: PropertyKey, receiver: any): any; + set? (target: T, p: PropertyKey, value: any, receiver: any): boolean; + deleteProperty? (target: T, p: PropertyKey): boolean; + defineProperty? (target: T, p: PropertyKey, attributes: PropertyDescriptor): boolean; + enumerate? (target: T): PropertyKey[]; + ownKeys? (target: T): PropertyKey[]; + apply? (target: T, thisArg: any, argArray?: any): any; + construct? (target: T, thisArg: any, argArray?: any): any; +} + +interface ProxyConstructor { + revocable(target: T, handler: ProxyHandler): { proxy: T; revoke: () => void; }; + new (target: T, handler: ProxyHandler): T +} +declare var Proxy: ProxyConstructor;declare namespace Reflect { + function apply(target: Function, thisArgument: any, argumentsList: ArrayLike): any; + function construct(target: Function, argumentsList: ArrayLike, newTarget?: any): any; + function defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean; + function deleteProperty(target: any, propertyKey: PropertyKey): boolean; + function get(target: any, propertyKey: PropertyKey, receiver?: any): any; + function getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor; + function getPrototypeOf(target: any): any; + function has(target: any, propertyKey: string): boolean; + function has(target: any, propertyKey: symbol): boolean; + function isExtensible(target: any): boolean; + function ownKeys(target: any): Array; + function preventExtensions(target: any): boolean; + function set(target: any, propertyKey: PropertyKey, value: any, receiver?: any): boolean; + function setPrototypeOf(target: any, proto: any): boolean; +}interface Symbol { + /** Returns a string representation of an object. */ + toString(): string; + + /** Returns the primitive value of the specified object. */ + valueOf(): Object; +} + +interface SymbolConstructor { + /** + * A reference to the prototype. + */ + readonly prototype: Symbol; + + /** + * Returns a new unique Symbol value. + * @param description Description of the new Symbol object. + */ + (description?: string|number): symbol; + + /** + * Returns a Symbol object from the global symbol registry matching the given key if found. + * Otherwise, returns a new symbol with this key. + * @param key key to search for. + */ + for(key: string): symbol; + + /** + * Returns a key from the global symbol registry matching the given Symbol if found. + * Otherwise, returns a undefined. + * @param sym Symbol to find the key for. + */ + keyFor(sym: symbol): string | undefined; +} + +declare var Symbol: SymbolConstructor;/// + +interface SymbolConstructor { + /** + * A method that determines if a constructor object recognizes an object as one of the + * constructor’s instances. Called by the semantics of the instanceof operator. + */ + readonly hasInstance: symbol; + + /** + * A Boolean value that if true indicates that an object should flatten to its array elements + * by Array.prototype.concat. + */ + readonly isConcatSpreadable: symbol; + + /** + * A regular expression method that matches the regular expression against a string. Called + * by the String.prototype.match method. + */ + readonly match: symbol; + + /** + * A regular expression method that replaces matched substrings of a string. Called by the + * String.prototype.replace method. + */ + readonly replace: symbol; + + /** + * A regular expression method that returns the index within a string that matches the + * regular expression. Called by the String.prototype.search method. + */ + readonly search: symbol; + + /** + * A function valued property that is the constructor function that is used to create + * derived objects. + */ + readonly species: symbol; + + /** + * A regular expression method that splits a string at the indices that match the regular + * expression. Called by the String.prototype.split method. + */ + readonly split: symbol; + + /** + * A method that converts an object to a corresponding primitive value. + * Called by the ToPrimitive abstract operation. + */ + readonly toPrimitive: symbol; + + /** + * A String value that is used in the creation of the default string description of an object. + * Called by the built-in method Object.prototype.toString. + */ + readonly toStringTag: symbol; + + /** + * An Object whose own property names are property names that are excluded from the 'with' + * environment bindings of the associated objects. + */ + readonly unscopables: symbol; +} + +interface Symbol { + readonly [Symbol.toStringTag]: "Symbol"; +} + +interface Array { + /** + * Returns an object whose properties have the value 'true' + * when they will be absent when used in a 'with' statement. + */ + [Symbol.unscopables](): { + copyWithin: boolean; + entries: boolean; + fill: boolean; + find: boolean; + findIndex: boolean; + keys: boolean; + values: boolean; + }; +} + +interface Date { + /** + * Converts a Date object to a string. + */ + [Symbol.toPrimitive](hint: "default"): string; + /** + * Converts a Date object to a string. + */ + [Symbol.toPrimitive](hint: "string"): string; + /** + * Converts a Date object to a number. + */ + [Symbol.toPrimitive](hint: "number"): number; + /** + * Converts a Date object to a string or number. + * + * @param hint The strings "number", "string", or "default" to specify what primitive to return. + * + * @throws {TypeError} If 'hint' was given something other than "number", "string", or "default". + * @returns A number if 'hint' was "number", a string if 'hint' was "string" or "default". + */ + [Symbol.toPrimitive](hint: string): string | number; +} + +interface Map { + readonly [Symbol.toStringTag]: "Map"; +} + +interface WeakMap{ + readonly [Symbol.toStringTag]: "WeakMap"; +} + +interface Set { + readonly [Symbol.toStringTag]: "Set"; +} + +interface WeakSet { + readonly [Symbol.toStringTag]: "WeakSet"; +} + +interface JSON { + readonly [Symbol.toStringTag]: "JSON"; +} + +interface Function { + /** + * Determines whether the given value inherits from this function if this function was used + * as a constructor function. + * + * A constructor function can control which objects are recognized as its instances by + * 'instanceof' by overriding this method. + */ + [Symbol.hasInstance](value: any): boolean; +} + +interface GeneratorFunction extends Function { + readonly [Symbol.toStringTag]: "GeneratorFunction"; +} + +interface Math { + readonly [Symbol.toStringTag]: "Math"; +} + +interface Promise { + readonly [Symbol.toStringTag]: "Promise"; +} + +interface PromiseConstructor { + readonly [Symbol.species]: Function; +} + +interface RegExp { + /** + * Matches a string with this regular expression, and returns an array containing the results of + * that search. + * @param string A string to search within. + */ + [Symbol.match](string: string): RegExpMatchArray | null; + + /** + * Replaces text in a string, using this regular expression. + * @param string A String object or string literal whose contents matching against + * this regular expression will be replaced + * @param replaceValue A String object or string literal containing the text to replace for every + * successful match of this regular expression. + */ + [Symbol.replace](string: string, replaceValue: string): string; + + /** + * Replaces text in a string, using this regular expression. + * @param string A String object or string literal whose contents matching against + * this regular expression will be replaced + * @param replacer A function that returns the replacement text. + */ + [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; + + /** + * Finds the position beginning first substring match in a regular expression search + * using this regular expression. + * + * @param string The string to search within. + */ + [Symbol.search](string: string): number; + + /** + * Returns an array of substrings that were delimited by strings in the original input that + * match against this regular expression. + * + * If the regular expression contains capturing parentheses, then each time this + * regular expression matches, the results (including any undefined results) of the + * capturing parentheses are spliced. + * + * @param string string value to split + * @param limit if not undefined, the output array is truncated so that it contains no more + * than 'limit' elements. + */ + [Symbol.split](string: string, limit?: number): string[]; +} + +interface RegExpConstructor { + [Symbol.species](): RegExpConstructor; +} + +interface String { + /** + * Matches a string an object that supports being matched against, and returns an array containing the results of that search. + * @param matcher An object that supports being matched against. + */ + match(matcher: { [Symbol.match](string: string): RegExpMatchArray | null; }): RegExpMatchArray | null; + + /** + * Replaces text in a string, using an object that supports replacement within a string. + * @param searchValue A object can search for and replace matches within a string. + * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. + */ + replace(searchValue: { [Symbol.replace](string: string, replaceValue: string): string; }, replaceValue: string): string; + + /** + * Replaces text in a string, using an object that supports replacement within a string. + * @param searchValue A object can search for and replace matches within a string. + * @param replacer A function that returns the replacement text. + */ + replace(searchValue: { [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; }, replacer: (substring: string, ...args: any[]) => string): string; + + /** + * Finds the first substring match in a regular expression search. + * @param searcher An object which supports searching within a string. + */ + search(searcher: { [Symbol.search](string: string): number; }): number; + + /** + * Split a string into substrings using the specified separator and return them as an array. + * @param splitter An object that can split a string. + * @param limit A value used to limit the number of elements returned in the array. + */ + split(splitter: { [Symbol.split](string: string, limit?: number): string[]; }, limit?: number): string[]; +} + +/** + * Represents a raw buffer of binary data, which is used to store data for the + * different typed arrays. ArrayBuffers cannot be read from or written to directly, + * but can be passed to a typed array or DataView Object to interpret the raw + * buffer as needed. + */ +interface ArrayBuffer { + readonly [Symbol.toStringTag]: "ArrayBuffer"; +} + +interface DataView { + readonly [Symbol.toStringTag]: "DataView"; +} + +/** + * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Int8Array { + readonly [Symbol.toStringTag]: "Int8Array"; +} + +/** + * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8Array { + readonly [Symbol.toStringTag]: "UInt8Array"; +} + +/** + * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. + * If the requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8ClampedArray { + readonly [Symbol.toStringTag]: "Uint8ClampedArray"; +} + +/** + * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int16Array { + readonly [Symbol.toStringTag]: "Int16Array"; +} + +/** + * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint16Array { + readonly [Symbol.toStringTag]: "Uint16Array"; +} + +/** + * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int32Array { + readonly [Symbol.toStringTag]: "Int32Array"; +} + +/** + * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint32Array { + readonly [Symbol.toStringTag]: "Uint32Array"; +} + +/** + * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number + * of bytes could not be allocated an exception is raised. + */ +interface Float32Array { + readonly [Symbol.toStringTag]: "Float32Array"; +} + +/** + * A typed array of 64-bit float values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Float64Array { + readonly [Symbol.toStringTag]: "Float64Array"; +} ///////////////////////////// /// IE DOM APIs ///////////////////////////// @@ -5368,11 +5608,6 @@ interface AriaRequestEventInit extends EventInit { attributeValue?: string; } -interface ClipboardEventInit extends EventInit { - data?: string; - dataType?: string; -} - interface CommandEventInit extends EventInit { commandName?: string; detail?: string; @@ -5386,6 +5621,31 @@ interface ConfirmSiteSpecificExceptionsInformation extends ExceptionInformation arrayOfDomainStrings?: string[]; } +interface ConstrainBooleanParameters { + exact?: boolean; + ideal?: boolean; +} + +interface ConstrainDOMStringParameters { + exact?: string | string[]; + ideal?: string | string[]; +} + +interface ConstrainDoubleRange extends DoubleRange { + exact?: number; + ideal?: number; +} + +interface ConstrainLongRange extends LongRange { + exact?: number; + ideal?: number; +} + +interface ConstrainVideoFacingModeParameters { + exact?: string | string[]; + ideal?: string | string[]; +} + interface CustomEventInit extends EventInit { detail?: any; } @@ -5396,17 +5656,44 @@ interface DeviceAccelerationDict { z?: number; } +interface DeviceLightEventInit extends EventInit { + value?: number; +} + interface DeviceRotationRateDict { alpha?: number; beta?: number; gamma?: number; } +interface DoubleRange { + max?: number; + min?: number; +} + interface EventInit { bubbles?: boolean; cancelable?: boolean; } +interface EventModifierInit extends UIEventInit { + ctrlKey?: boolean; + shiftKey?: boolean; + altKey?: boolean; + metaKey?: boolean; + modifierAltGraph?: boolean; + modifierCapsLock?: boolean; + modifierFn?: boolean; + modifierFnLock?: boolean; + modifierHyper?: boolean; + modifierNumLock?: boolean; + modifierOS?: boolean; + modifierScrollLock?: boolean; + modifierSuper?: boolean; + modifierSymbol?: boolean; + modifierSymbolLock?: boolean; +} + interface ExceptionInformation { domain?: string; } @@ -5420,17 +5707,415 @@ interface HashChangeEventInit extends EventInit { oldURL?: string; } +interface IDBIndexParameters { + multiEntry?: boolean; + unique?: boolean; +} + +interface IDBObjectStoreParameters { + autoIncrement?: boolean; + keyPath?: IDBKeyPath; +} + interface KeyAlgorithm { name?: string; } -interface KeyboardEventInit extends SharedKeyboardAndMouseEventInit { +interface KeyboardEventInit extends EventModifierInit { key?: string; location?: number; repeat?: boolean; } -interface MouseEventInit extends SharedKeyboardAndMouseEventInit { +interface LongRange { + max?: number; + min?: number; +} + +interface MSAccountInfo { + rpDisplayName?: string; + userDisplayName?: string; + accountName?: string; + userId?: string; + accountImageUri?: string; +} + +interface MSAudioLocalClientEvent extends MSLocalClientEventBase { + networkSendQualityEventRatio?: number; + networkDelayEventRatio?: number; + cpuInsufficientEventRatio?: number; + deviceHalfDuplexAECEventRatio?: number; + deviceRenderNotFunctioningEventRatio?: number; + deviceCaptureNotFunctioningEventRatio?: number; + deviceGlitchesEventRatio?: number; + deviceLowSNREventRatio?: number; + deviceLowSpeechLevelEventRatio?: number; + deviceClippingEventRatio?: number; + deviceEchoEventRatio?: number; + deviceNearEndToEchoRatioEventRatio?: number; + deviceRenderZeroVolumeEventRatio?: number; + deviceRenderMuteEventRatio?: number; + deviceMultipleEndpointsEventCount?: number; + deviceHowlingEventCount?: number; +} + +interface MSAudioRecvPayload extends MSPayloadBase { + samplingRate?: number; + signal?: MSAudioRecvSignal; + packetReorderRatio?: number; + packetReorderDepthAvg?: number; + packetReorderDepthMax?: number; + burstLossLength1?: number; + burstLossLength2?: number; + burstLossLength3?: number; + burstLossLength4?: number; + burstLossLength5?: number; + burstLossLength6?: number; + burstLossLength7?: number; + burstLossLength8OrHigher?: number; + fecRecvDistance1?: number; + fecRecvDistance2?: number; + fecRecvDistance3?: number; + ratioConcealedSamplesAvg?: number; + ratioStretchedSamplesAvg?: number; + ratioCompressedSamplesAvg?: number; +} + +interface MSAudioRecvSignal { + initialSignalLevelRMS?: number; + recvSignalLevelCh1?: number; + recvNoiseLevelCh1?: number; + renderSignalLevel?: number; + renderNoiseLevel?: number; + renderLoopbackSignalLevel?: number; +} + +interface MSAudioSendPayload extends MSPayloadBase { + samplingRate?: number; + signal?: MSAudioSendSignal; + audioFECUsed?: boolean; + sendMutePercent?: number; +} + +interface MSAudioSendSignal { + noiseLevel?: number; + sendSignalLevelCh1?: number; + sendNoiseLevelCh1?: number; +} + +interface MSConnectivity { + iceType?: string; + iceWarningFlags?: MSIceWarningFlags; + relayAddress?: MSRelayAddress; +} + +interface MSCredentialFilter { + accept?: MSCredentialSpec[]; +} + +interface MSCredentialParameters { + type?: string; +} + +interface MSCredentialSpec { + type?: string; + id?: string; +} + +interface MSDelay { + roundTrip?: number; + roundTripMax?: number; +} + +interface MSDescription extends RTCStats { + connectivity?: MSConnectivity; + transport?: string; + networkconnectivity?: MSNetworkConnectivityInfo; + localAddr?: MSIPAddressInfo; + remoteAddr?: MSIPAddressInfo; + deviceDevName?: string; + reflexiveLocalIPAddr?: MSIPAddressInfo; +} + +interface MSFIDOCredentialParameters extends MSCredentialParameters { + algorithm?: string | Algorithm; + authenticators?: AAGUID[]; +} + +interface MSIPAddressInfo { + ipAddr?: string; + port?: number; + manufacturerMacAddrMask?: string; +} + +interface MSIceWarningFlags { + turnTcpTimedOut?: boolean; + turnUdpAllocateFailed?: boolean; + turnUdpSendFailed?: boolean; + turnTcpAllocateFailed?: boolean; + turnTcpSendFailed?: boolean; + udpLocalConnectivityFailed?: boolean; + udpNatConnectivityFailed?: boolean; + udpRelayConnectivityFailed?: boolean; + tcpNatConnectivityFailed?: boolean; + tcpRelayConnectivityFailed?: boolean; + connCheckMessageIntegrityFailed?: boolean; + allocationMessageIntegrityFailed?: boolean; + connCheckOtherError?: boolean; + turnAuthUnknownUsernameError?: boolean; + noRelayServersConfigured?: boolean; + multipleRelayServersAttempted?: boolean; + portRangeExhausted?: boolean; + alternateServerReceived?: boolean; + pseudoTLSFailure?: boolean; + turnTurnTcpConnectivityFailed?: boolean; + useCandidateChecksFailed?: boolean; + fipsAllocationFailure?: boolean; +} + +interface MSJitter { + interArrival?: number; + interArrivalMax?: number; + interArrivalSD?: number; +} + +interface MSLocalClientEventBase extends RTCStats { + networkReceiveQualityEventRatio?: number; + networkBandwidthLowEventRatio?: number; +} + +interface MSNetwork extends RTCStats { + jitter?: MSJitter; + delay?: MSDelay; + packetLoss?: MSPacketLoss; + utilization?: MSUtilization; +} + +interface MSNetworkConnectivityInfo { + vpn?: boolean; + linkspeed?: number; + networkConnectionDetails?: string; +} + +interface MSNetworkInterfaceType { + interfaceTypeEthernet?: boolean; + interfaceTypeWireless?: boolean; + interfaceTypePPP?: boolean; + interfaceTypeTunnel?: boolean; + interfaceTypeWWAN?: boolean; +} + +interface MSOutboundNetwork extends MSNetwork { + appliedBandwidthLimit?: number; +} + +interface MSPacketLoss { + lossRate?: number; + lossRateMax?: number; +} + +interface MSPayloadBase extends RTCStats { + payloadDescription?: string; +} + +interface MSRelayAddress { + relayAddress?: string; + port?: number; +} + +interface MSSignatureParameters { + userPrompt?: string; +} + +interface MSTransportDiagnosticsStats extends RTCStats { + baseAddress?: string; + localAddress?: string; + localSite?: string; + networkName?: string; + remoteAddress?: string; + remoteSite?: string; + localMR?: string; + remoteMR?: string; + iceWarningFlags?: MSIceWarningFlags; + portRangeMin?: number; + portRangeMax?: number; + localMRTCPPort?: number; + remoteMRTCPPort?: number; + stunVer?: number; + numConsentReqSent?: number; + numConsentReqReceived?: number; + numConsentRespSent?: number; + numConsentRespReceived?: number; + interfaces?: MSNetworkInterfaceType; + baseInterface?: MSNetworkInterfaceType; + protocol?: string; + localInterface?: MSNetworkInterfaceType; + localAddrType?: string; + remoteAddrType?: string; + iceRole?: string; + rtpRtcpMux?: boolean; + allocationTimeInMs?: number; + msRtcEngineVersion?: string; +} + +interface MSUtilization { + packets?: number; + bandwidthEstimation?: number; + bandwidthEstimationMin?: number; + bandwidthEstimationMax?: number; + bandwidthEstimationStdDev?: number; + bandwidthEstimationAvg?: number; +} + +interface MSVideoPayload extends MSPayloadBase { + resoluton?: string; + videoBitRateAvg?: number; + videoBitRateMax?: number; + videoFrameRateAvg?: number; + videoPacketLossRate?: number; + durationSeconds?: number; +} + +interface MSVideoRecvPayload extends MSVideoPayload { + videoFrameLossRate?: number; + recvCodecType?: string; + recvResolutionWidth?: number; + recvResolutionHeight?: number; + videoResolutions?: MSVideoResolutionDistribution; + recvFrameRateAverage?: number; + recvBitRateMaximum?: number; + recvBitRateAverage?: number; + recvVideoStreamsMax?: number; + recvVideoStreamsMin?: number; + recvVideoStreamsMode?: number; + videoPostFECPLR?: number; + lowBitRateCallPercent?: number; + lowFrameRateCallPercent?: number; + reorderBufferTotalPackets?: number; + recvReorderBufferReorderedPackets?: number; + recvReorderBufferPacketsDroppedDueToBufferExhaustion?: number; + recvReorderBufferMaxSuccessfullyOrderedExtent?: number; + recvReorderBufferMaxSuccessfullyOrderedLateTime?: number; + recvReorderBufferPacketsDroppedDueToTimeout?: number; + recvFpsHarmonicAverage?: number; + recvNumResSwitches?: number; +} + +interface MSVideoResolutionDistribution { + cifQuality?: number; + vgaQuality?: number; + h720Quality?: number; + h1080Quality?: number; + h1440Quality?: number; + h2160Quality?: number; +} + +interface MSVideoSendPayload extends MSVideoPayload { + sendFrameRateAverage?: number; + sendBitRateMaximum?: number; + sendBitRateAverage?: number; + sendVideoStreamsMax?: number; + sendResolutionWidth?: number; + sendResolutionHeight?: number; +} + +interface MediaEncryptedEventInit extends EventInit { + initDataType?: string; + initData?: ArrayBuffer; +} + +interface MediaKeyMessageEventInit extends EventInit { + messageType?: string; + message?: ArrayBuffer; +} + +interface MediaKeySystemConfiguration { + initDataTypes?: string[]; + audioCapabilities?: MediaKeySystemMediaCapability[]; + videoCapabilities?: MediaKeySystemMediaCapability[]; + distinctiveIdentifier?: string; + persistentState?: string; +} + +interface MediaKeySystemMediaCapability { + contentType?: string; + robustness?: string; +} + +interface MediaStreamConstraints { + video?: boolean | MediaTrackConstraints; + audio?: boolean | MediaTrackConstraints; +} + +interface MediaStreamErrorEventInit extends EventInit { + error?: MediaStreamError; +} + +interface MediaStreamTrackEventInit extends EventInit { + track?: MediaStreamTrack; +} + +interface MediaTrackCapabilities { + width?: number | LongRange; + height?: number | LongRange; + aspectRatio?: number | DoubleRange; + frameRate?: number | DoubleRange; + facingMode?: string; + volume?: number | DoubleRange; + sampleRate?: number | LongRange; + sampleSize?: number | LongRange; + echoCancellation?: boolean[]; + deviceId?: string; + groupId?: string; +} + +interface MediaTrackConstraintSet { + width?: number | ConstrainLongRange; + height?: number | ConstrainLongRange; + aspectRatio?: number | ConstrainDoubleRange; + frameRate?: number | ConstrainDoubleRange; + facingMode?: string | string[] | ConstrainDOMStringParameters; + volume?: number | ConstrainDoubleRange; + sampleRate?: number | ConstrainLongRange; + sampleSize?: number | ConstrainLongRange; + echoCancelation?: boolean | ConstrainBooleanParameters; + deviceId?: string | string[] | ConstrainDOMStringParameters; + groupId?: string | string[] | ConstrainDOMStringParameters; +} + +interface MediaTrackConstraints extends MediaTrackConstraintSet { + advanced?: MediaTrackConstraintSet[]; +} + +interface MediaTrackSettings { + width?: number; + height?: number; + aspectRatio?: number; + frameRate?: number; + facingMode?: string; + volume?: number; + sampleRate?: number; + sampleSize?: number; + echoCancellation?: boolean; + deviceId?: string; + groupId?: string; +} + +interface MediaTrackSupportedConstraints { + width?: boolean; + height?: boolean; + aspectRatio?: boolean; + frameRate?: boolean; + facingMode?: boolean; + volume?: boolean; + sampleRate?: boolean; + sampleSize?: boolean; + echoCancellation?: boolean; + deviceId?: boolean; + groupId?: boolean; +} + +interface MouseEventInit extends EventModifierInit { screenX?: number; screenY?: number; clientX?: number; @@ -5463,6 +6148,10 @@ interface ObjectURLOptions { oneTimeOnly?: boolean; } +interface PeriodicWaveConstraints { + disableNormalization?: boolean; +} + interface PointerEventInit extends MouseEventInit { pointerId?: number; width?: number; @@ -5480,22 +6169,266 @@ interface PositionOptions { maximumAge?: number; } -interface SharedKeyboardAndMouseEventInit extends UIEventInit { - ctrlKey?: boolean; - shiftKey?: boolean; - altKey?: boolean; - metaKey?: boolean; - keyModifierStateAltGraph?: boolean; - keyModifierStateCapsLock?: boolean; - keyModifierStateFn?: boolean; - keyModifierStateFnLock?: boolean; - keyModifierStateHyper?: boolean; - keyModifierStateNumLock?: boolean; - keyModifierStateOS?: boolean; - keyModifierStateScrollLock?: boolean; - keyModifierStateSuper?: boolean; - keyModifierStateSymbol?: boolean; - keyModifierStateSymbolLock?: boolean; +interface RTCDTMFToneChangeEventInit extends EventInit { + tone?: string; +} + +interface RTCDtlsFingerprint { + algorithm?: string; + value?: string; +} + +interface RTCDtlsParameters { + role?: string; + fingerprints?: RTCDtlsFingerprint[]; +} + +interface RTCIceCandidate { + foundation?: string; + priority?: number; + ip?: string; + protocol?: string; + port?: number; + type?: string; + tcpType?: string; + relatedAddress?: string; + relatedPort?: number; +} + +interface RTCIceCandidateAttributes extends RTCStats { + ipAddress?: string; + portNumber?: number; + transport?: string; + candidateType?: string; + priority?: number; + addressSourceUrl?: string; +} + +interface RTCIceCandidateComplete { +} + +interface RTCIceCandidatePair { + local?: RTCIceCandidate; + remote?: RTCIceCandidate; +} + +interface RTCIceCandidatePairStats extends RTCStats { + transportId?: string; + localCandidateId?: string; + remoteCandidateId?: string; + state?: string; + priority?: number; + nominated?: boolean; + writable?: boolean; + readable?: boolean; + bytesSent?: number; + bytesReceived?: number; + roundTripTime?: number; + availableOutgoingBitrate?: number; + availableIncomingBitrate?: number; +} + +interface RTCIceGatherOptions { + gatherPolicy?: string; + iceservers?: RTCIceServer[]; +} + +interface RTCIceParameters { + usernameFragment?: string; + password?: string; +} + +interface RTCIceServer { + urls?: any; + username?: string; + credential?: string; +} + +interface RTCInboundRTPStreamStats extends RTCRTPStreamStats { + packetsReceived?: number; + bytesReceived?: number; + packetsLost?: number; + jitter?: number; + fractionLost?: number; +} + +interface RTCMediaStreamTrackStats extends RTCStats { + trackIdentifier?: string; + remoteSource?: boolean; + ssrcIds?: string[]; + frameWidth?: number; + frameHeight?: number; + framesPerSecond?: number; + framesSent?: number; + framesReceived?: number; + framesDecoded?: number; + framesDropped?: number; + framesCorrupted?: number; + audioLevel?: number; + echoReturnLoss?: number; + echoReturnLossEnhancement?: number; +} + +interface RTCOutboundRTPStreamStats extends RTCRTPStreamStats { + packetsSent?: number; + bytesSent?: number; + targetBitrate?: number; + roundTripTime?: number; +} + +interface RTCRTPStreamStats extends RTCStats { + ssrc?: string; + associateStatsId?: string; + isRemote?: boolean; + mediaTrackId?: string; + transportId?: string; + codecId?: string; + firCount?: number; + pliCount?: number; + nackCount?: number; + sliCount?: number; +} + +interface RTCRtcpFeedback { + type?: string; + parameter?: string; +} + +interface RTCRtcpParameters { + ssrc?: number; + cname?: string; + reducedSize?: boolean; + mux?: boolean; +} + +interface RTCRtpCapabilities { + codecs?: RTCRtpCodecCapability[]; + headerExtensions?: RTCRtpHeaderExtension[]; + fecMechanisms?: string[]; +} + +interface RTCRtpCodecCapability { + name?: string; + kind?: string; + clockRate?: number; + preferredPayloadType?: number; + maxptime?: number; + numChannels?: number; + rtcpFeedback?: RTCRtcpFeedback[]; + parameters?: any; + options?: any; + maxTemporalLayers?: number; + maxSpatialLayers?: number; + svcMultiStreamSupport?: boolean; +} + +interface RTCRtpCodecParameters { + name?: string; + payloadType?: any; + clockRate?: number; + maxptime?: number; + numChannels?: number; + rtcpFeedback?: RTCRtcpFeedback[]; + parameters?: any; +} + +interface RTCRtpContributingSource { + timestamp?: number; + csrc?: number; + audioLevel?: number; +} + +interface RTCRtpEncodingParameters { + ssrc?: number; + codecPayloadType?: number; + fec?: RTCRtpFecParameters; + rtx?: RTCRtpRtxParameters; + priority?: number; + maxBitrate?: number; + minQuality?: number; + framerateBias?: number; + resolutionScale?: number; + framerateScale?: number; + active?: boolean; + encodingId?: string; + dependencyEncodingIds?: string[]; + ssrcRange?: RTCSsrcRange; +} + +interface RTCRtpFecParameters { + ssrc?: number; + mechanism?: string; +} + +interface RTCRtpHeaderExtension { + kind?: string; + uri?: string; + preferredId?: number; + preferredEncrypt?: boolean; +} + +interface RTCRtpHeaderExtensionParameters { + uri?: string; + id?: number; + encrypt?: boolean; +} + +interface RTCRtpParameters { + muxId?: string; + codecs?: RTCRtpCodecParameters[]; + headerExtensions?: RTCRtpHeaderExtensionParameters[]; + encodings?: RTCRtpEncodingParameters[]; + rtcp?: RTCRtcpParameters; +} + +interface RTCRtpRtxParameters { + ssrc?: number; +} + +interface RTCRtpUnhandled { + ssrc?: number; + payloadType?: number; + muxId?: string; +} + +interface RTCSrtpKeyParam { + keyMethod?: string; + keySalt?: string; + lifetime?: string; + mkiValue?: number; + mkiLength?: number; +} + +interface RTCSrtpSdesParameters { + tag?: number; + cryptoSuite?: string; + keyParams?: RTCSrtpKeyParam[]; + sessionParams?: string[]; +} + +interface RTCSsrcRange { + min?: number; + max?: number; +} + +interface RTCStats { + timestamp?: number; + type?: string; + id?: string; + msType?: string; +} + +interface RTCStatsReport { +} + +interface RTCTransportStats extends RTCStats { + bytesSent?: number; + bytesReceived?: number; + rtcpTransportStatsId?: string; + activeConnection?: boolean; + selectedCandidatePairId?: string; + localCertificateId?: string; + remoteCertificateId?: string; } interface StoreExceptionsInformation extends ExceptionInformation { @@ -5541,18 +6474,18 @@ interface ANGLE_instanced_arrays { drawArraysInstancedANGLE(mode: number, first: number, count: number, primcount: number): void; drawElementsInstancedANGLE(mode: number, count: number, type: number, offset: number, primcount: number): void; vertexAttribDivisorANGLE(index: number, divisor: number): void; - VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: number; + readonly VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: number; } declare var ANGLE_instanced_arrays: { prototype: ANGLE_instanced_arrays; new(): ANGLE_instanced_arrays; - VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: number; + readonly VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: number; } interface AnalyserNode extends AudioNode { fftSize: number; - frequencyBinCount: number; + readonly frequencyBinCount: number; maxDecibels: number; minDecibels: number; smoothingTimeConstant: number; @@ -5568,8 +6501,8 @@ declare var AnalyserNode: { } interface AnimationEvent extends Event { - animationName: string; - elapsedTime: number; + readonly animationName: string; + readonly elapsedTime: number; initAnimationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, animationNameArg: string, elapsedTimeArg: number): void; } @@ -5587,16 +6520,16 @@ interface ApplicationCache extends EventTarget { onobsolete: (ev: Event) => any; onprogress: (ev: ProgressEvent) => any; onupdateready: (ev: Event) => any; - status: number; + readonly status: number; abort(): void; swapCache(): void; update(): void; - CHECKING: number; - DOWNLOADING: number; - IDLE: number; - OBSOLETE: number; - UNCACHED: number; - UPDATEREADY: number; + readonly CHECKING: number; + readonly DOWNLOADING: number; + readonly IDLE: number; + readonly OBSOLETE: number; + readonly UNCACHED: number; + readonly UPDATEREADY: number; addEventListener(type: "cached", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "checking", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "downloading", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -5611,17 +6544,17 @@ interface ApplicationCache extends EventTarget { declare var ApplicationCache: { prototype: ApplicationCache; new(): ApplicationCache; - CHECKING: number; - DOWNLOADING: number; - IDLE: number; - OBSOLETE: number; - UNCACHED: number; - UPDATEREADY: number; + readonly CHECKING: number; + readonly DOWNLOADING: number; + readonly IDLE: number; + readonly OBSOLETE: number; + readonly UNCACHED: number; + readonly UPDATEREADY: number; } interface AriaRequestEvent extends Event { - attributeName: string; - attributeValue: string; + readonly attributeName: string; + attributeValue: string | null; } declare var AriaRequestEvent: { @@ -5630,9 +6563,10 @@ declare var AriaRequestEvent: { } interface Attr extends Node { - name: string; - ownerElement: Element; - specified: boolean; + readonly name: string; + readonly ownerElement: Element; + readonly prefix: string | null; + readonly specified: boolean; value: string; } @@ -5642,10 +6576,12 @@ declare var Attr: { } interface AudioBuffer { - duration: number; - length: number; - numberOfChannels: number; - sampleRate: number; + readonly duration: number; + readonly length: number; + readonly numberOfChannels: number; + readonly sampleRate: number; + copyFromChannel(destination: Float32Array, channelNumber: number, startInChannel?: number): void; + copyToChannel(source: Float32Array, channelNumber: number, startInChannel?: number): void; getChannelData(channel: number): Float32Array; } @@ -5655,15 +6591,16 @@ declare var AudioBuffer: { } interface AudioBufferSourceNode extends AudioNode { - buffer: AudioBuffer; + buffer: AudioBuffer | null; + readonly detune: AudioParam; loop: boolean; loopEnd: number; loopStart: number; - onended: (ev: Event) => any; - playbackRate: AudioParam; + onended: (ev: MediaStreamErrorEvent) => any; + readonly playbackRate: AudioParam; start(when?: number, offset?: number, duration?: number): void; stop(when?: number): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -5673,10 +6610,11 @@ declare var AudioBufferSourceNode: { } interface AudioContext extends EventTarget { - currentTime: number; - destination: AudioDestinationNode; - listener: AudioListener; - sampleRate: number; + readonly currentTime: number; + readonly destination: AudioDestinationNode; + readonly listener: AudioListener; + readonly sampleRate: number; + state: string; createAnalyser(): AnalyserNode; createBiquadFilter(): BiquadFilterNode; createBuffer(numberOfChannels: number, length: number, sampleRate: number): AudioBuffer; @@ -5688,13 +6626,14 @@ interface AudioContext extends EventTarget { createDynamicsCompressor(): DynamicsCompressorNode; createGain(): GainNode; createMediaElementSource(mediaElement: HTMLMediaElement): MediaElementAudioSourceNode; + createMediaStreamSource(mediaStream: MediaStream): MediaStreamAudioSourceNode; createOscillator(): OscillatorNode; createPanner(): PannerNode; - createPeriodicWave(real: Float32Array, imag: Float32Array): PeriodicWave; + createPeriodicWave(real: Float32Array, imag: Float32Array, constraints?: PeriodicWaveConstraints): PeriodicWave; createScriptProcessor(bufferSize?: number, numberOfInputChannels?: number, numberOfOutputChannels?: number): ScriptProcessorNode; createStereoPanner(): StereoPannerNode; createWaveShaper(): WaveShaperNode; - decodeAudioData(audioData: ArrayBuffer, successCallback: DecodeSuccessCallback, errorCallback?: DecodeErrorCallback): void; + decodeAudioData(audioData: ArrayBuffer, successCallback?: DecodeSuccessCallback, errorCallback?: DecodeErrorCallback): PromiseLike; } declare var AudioContext: { @@ -5703,7 +6642,7 @@ declare var AudioContext: { } interface AudioDestinationNode extends AudioNode { - maxChannelCount: number; + readonly maxChannelCount: number; } declare var AudioDestinationNode: { @@ -5728,11 +6667,13 @@ interface AudioNode extends EventTarget { channelCount: number; channelCountMode: string; channelInterpretation: string; - context: AudioContext; - numberOfInputs: number; - numberOfOutputs: number; + readonly context: AudioContext; + readonly numberOfInputs: number; + readonly numberOfOutputs: number; connect(destination: AudioNode, output?: number, input?: number): void; disconnect(output?: number): void; + disconnect(destination: AudioNode, output?: number, input?: number): void; + disconnect(destination: AudioParam, output?: number): void; } declare var AudioNode: { @@ -5741,7 +6682,7 @@ declare var AudioNode: { } interface AudioParam { - defaultValue: number; + readonly defaultValue: number; value: number; cancelScheduledValues(startTime: number): void; exponentialRampToValueAtTime(value: number, endTime: number): void; @@ -5757,9 +6698,9 @@ declare var AudioParam: { } interface AudioProcessingEvent extends Event { - inputBuffer: AudioBuffer; - outputBuffer: AudioBuffer; - playbackTime: number; + readonly inputBuffer: AudioBuffer; + readonly outputBuffer: AudioBuffer; + readonly playbackTime: number; } declare var AudioProcessingEvent: { @@ -5769,11 +6710,11 @@ declare var AudioProcessingEvent: { interface AudioTrack { enabled: boolean; - id: string; + readonly id: string; kind: string; - label: string; + readonly label: string; language: string; - sourceBuffer: SourceBuffer; + readonly sourceBuffer: SourceBuffer; } declare var AudioTrack: { @@ -5782,11 +6723,11 @@ declare var AudioTrack: { } interface AudioTrackList extends EventTarget { - length: number; + readonly length: number; onaddtrack: (ev: TrackEvent) => any; onchange: (ev: Event) => any; onremovetrack: (ev: TrackEvent) => any; - getTrackById(id: string): AudioTrack; + getTrackById(id: string): AudioTrack | null; item(index: number): AudioTrack; addEventListener(type: "addtrack", listener: (ev: TrackEvent) => any, useCapture?: boolean): void; addEventListener(type: "change", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -5801,7 +6742,7 @@ declare var AudioTrackList: { } interface BarProp { - visible: boolean; + readonly visible: boolean; } declare var BarProp: { @@ -5819,10 +6760,10 @@ declare var BeforeUnloadEvent: { } interface BiquadFilterNode extends AudioNode { - Q: AudioParam; - detune: AudioParam; - frequency: AudioParam; - gain: AudioParam; + readonly Q: AudioParam; + readonly detune: AudioParam; + readonly frequency: AudioParam; + readonly gain: AudioParam; type: string; getFrequencyResponse(frequencyHz: Float32Array, magResponse: Float32Array, phaseResponse: Float32Array): void; } @@ -5833,8 +6774,8 @@ declare var BiquadFilterNode: { } interface Blob { - size: number; - type: string; + readonly size: number; + readonly type: string; msClose(): void; msDetachStream(): any; slice(start?: number, end?: number, contentType?: string): Blob; @@ -5868,7 +6809,7 @@ declare var CSSConditionRule: { } interface CSSFontFaceRule extends CSSRule { - style: CSSStyleDeclaration; + readonly style: CSSStyleDeclaration; } declare var CSSFontFaceRule: { @@ -5877,9 +6818,9 @@ declare var CSSFontFaceRule: { } interface CSSGroupingRule extends CSSRule { - cssRules: CSSRuleList; - deleteRule(index?: number): void; - insertRule(rule: string, index?: number): number; + readonly cssRules: CSSRuleList; + deleteRule(index: number): void; + insertRule(rule: string, index: number): number; } declare var CSSGroupingRule: { @@ -5888,9 +6829,9 @@ declare var CSSGroupingRule: { } interface CSSImportRule extends CSSRule { - href: string; - media: MediaList; - styleSheet: CSSStyleSheet; + readonly href: string; + readonly media: MediaList; + readonly styleSheet: CSSStyleSheet; } declare var CSSImportRule: { @@ -5900,7 +6841,7 @@ declare var CSSImportRule: { interface CSSKeyframeRule extends CSSRule { keyText: string; - style: CSSStyleDeclaration; + readonly style: CSSStyleDeclaration; } declare var CSSKeyframeRule: { @@ -5909,7 +6850,7 @@ declare var CSSKeyframeRule: { } interface CSSKeyframesRule extends CSSRule { - cssRules: CSSRuleList; + readonly cssRules: CSSRuleList; name: string; appendRule(rule: string): void; deleteRule(rule: string): void; @@ -5922,7 +6863,7 @@ declare var CSSKeyframesRule: { } interface CSSMediaRule extends CSSConditionRule { - media: MediaList; + readonly media: MediaList; } declare var CSSMediaRule: { @@ -5931,8 +6872,8 @@ declare var CSSMediaRule: { } interface CSSNamespaceRule extends CSSRule { - namespaceURI: string; - prefix: string; + readonly namespaceURI: string; + readonly prefix: string; } declare var CSSNamespaceRule: { @@ -5941,10 +6882,10 @@ declare var CSSNamespaceRule: { } interface CSSPageRule extends CSSRule { - pseudoClass: string; - selector: string; + readonly pseudoClass: string; + readonly selector: string; selectorText: string; - style: CSSStyleDeclaration; + readonly style: CSSStyleDeclaration; } declare var CSSPageRule: { @@ -5954,42 +6895,42 @@ declare var CSSPageRule: { interface CSSRule { cssText: string; - parentRule: CSSRule; - parentStyleSheet: CSSStyleSheet; - type: number; - CHARSET_RULE: number; - FONT_FACE_RULE: number; - IMPORT_RULE: number; - KEYFRAMES_RULE: number; - KEYFRAME_RULE: number; - MEDIA_RULE: number; - NAMESPACE_RULE: number; - PAGE_RULE: number; - STYLE_RULE: number; - SUPPORTS_RULE: number; - UNKNOWN_RULE: number; - VIEWPORT_RULE: number; + readonly parentRule: CSSRule; + readonly parentStyleSheet: CSSStyleSheet; + readonly type: number; + readonly CHARSET_RULE: number; + readonly FONT_FACE_RULE: number; + readonly IMPORT_RULE: number; + readonly KEYFRAMES_RULE: number; + readonly KEYFRAME_RULE: number; + readonly MEDIA_RULE: number; + readonly NAMESPACE_RULE: number; + readonly PAGE_RULE: number; + readonly STYLE_RULE: number; + readonly SUPPORTS_RULE: number; + readonly UNKNOWN_RULE: number; + readonly VIEWPORT_RULE: number; } declare var CSSRule: { prototype: CSSRule; new(): CSSRule; - CHARSET_RULE: number; - FONT_FACE_RULE: number; - IMPORT_RULE: number; - KEYFRAMES_RULE: number; - KEYFRAME_RULE: number; - MEDIA_RULE: number; - NAMESPACE_RULE: number; - PAGE_RULE: number; - STYLE_RULE: number; - SUPPORTS_RULE: number; - UNKNOWN_RULE: number; - VIEWPORT_RULE: number; + readonly CHARSET_RULE: number; + readonly FONT_FACE_RULE: number; + readonly IMPORT_RULE: number; + readonly KEYFRAMES_RULE: number; + readonly KEYFRAME_RULE: number; + readonly MEDIA_RULE: number; + readonly NAMESPACE_RULE: number; + readonly PAGE_RULE: number; + readonly STYLE_RULE: number; + readonly SUPPORTS_RULE: number; + readonly UNKNOWN_RULE: number; + readonly VIEWPORT_RULE: number; } interface CSSRuleList { - length: number; + readonly length: number; item(index: number): CSSRule; [index: number]: CSSRule; } @@ -6000,356 +6941,343 @@ declare var CSSRuleList: { } interface CSSStyleDeclaration { - alignContent: string; - alignItems: string; - alignSelf: string; - alignmentBaseline: string; - animation: string; - animationDelay: string; - animationDirection: string; - animationDuration: string; - animationFillMode: string; - animationIterationCount: string; - animationName: string; - animationPlayState: string; - animationTimingFunction: string; - backfaceVisibility: string; - background: string; - backgroundAttachment: string; - backgroundClip: string; - backgroundColor: string; - backgroundImage: string; - backgroundOrigin: string; - backgroundPosition: string; - backgroundPositionX: string; - backgroundPositionY: string; - backgroundRepeat: string; - backgroundSize: string; - baselineShift: string; - border: string; - borderBottom: string; - borderBottomColor: string; - borderBottomLeftRadius: string; - borderBottomRightRadius: string; - borderBottomStyle: string; - borderBottomWidth: string; - borderCollapse: string; - borderColor: string; - borderImage: string; - borderImageOutset: string; - borderImageRepeat: string; - borderImageSlice: string; - borderImageSource: string; - borderImageWidth: string; - borderLeft: string; - borderLeftColor: string; - borderLeftStyle: string; - borderLeftWidth: string; - borderRadius: string; - borderRight: string; - borderRightColor: string; - borderRightStyle: string; - borderRightWidth: string; - borderSpacing: string; - borderStyle: string; - borderTop: string; - borderTopColor: string; - borderTopLeftRadius: string; - borderTopRightRadius: string; - borderTopStyle: string; - borderTopWidth: string; - borderWidth: string; - bottom: string; - boxShadow: string; - boxSizing: string; - breakAfter: string; - breakBefore: string; - breakInside: string; - captionSide: string; - clear: string; - clip: string; - clipPath: string; - clipRule: string; - color: string; - colorInterpolationFilters: string; + alignContent: string | null; + alignItems: string | null; + alignSelf: string | null; + alignmentBaseline: string | null; + animation: string | null; + animationDelay: string | null; + animationDirection: string | null; + animationDuration: string | null; + animationFillMode: string | null; + animationIterationCount: string | null; + animationName: string | null; + animationPlayState: string | null; + animationTimingFunction: string | null; + backfaceVisibility: string | null; + background: string | null; + backgroundAttachment: string | null; + backgroundClip: string | null; + backgroundColor: string | null; + backgroundImage: string | null; + backgroundOrigin: string | null; + backgroundPosition: string | null; + backgroundPositionX: string | null; + backgroundPositionY: string | null; + backgroundRepeat: string | null; + backgroundSize: string | null; + baselineShift: string | null; + border: string | null; + borderBottom: string | null; + borderBottomColor: string | null; + borderBottomLeftRadius: string | null; + borderBottomRightRadius: string | null; + borderBottomStyle: string | null; + borderBottomWidth: string | null; + borderCollapse: string | null; + borderColor: string | null; + borderImage: string | null; + borderImageOutset: string | null; + borderImageRepeat: string | null; + borderImageSlice: string | null; + borderImageSource: string | null; + borderImageWidth: string | null; + borderLeft: string | null; + borderLeftColor: string | null; + borderLeftStyle: string | null; + borderLeftWidth: string | null; + borderRadius: string | null; + borderRight: string | null; + borderRightColor: string | null; + borderRightStyle: string | null; + borderRightWidth: string | null; + borderSpacing: string | null; + borderStyle: string | null; + borderTop: string | null; + borderTopColor: string | null; + borderTopLeftRadius: string | null; + borderTopRightRadius: string | null; + borderTopStyle: string | null; + borderTopWidth: string | null; + borderWidth: string | null; + bottom: string | null; + boxShadow: string | null; + boxSizing: string | null; + breakAfter: string | null; + breakBefore: string | null; + breakInside: string | null; + captionSide: string | null; + clear: string | null; + clip: string | null; + clipPath: string | null; + clipRule: string | null; + color: string | null; + colorInterpolationFilters: string | null; columnCount: any; - columnFill: string; + columnFill: string | null; columnGap: any; - columnRule: string; + columnRule: string | null; columnRuleColor: any; - columnRuleStyle: string; + columnRuleStyle: string | null; columnRuleWidth: any; - columnSpan: string; + columnSpan: string | null; columnWidth: any; - columns: string; - content: string; - counterIncrement: string; - counterReset: string; - cssFloat: string; + columns: string | null; + content: string | null; + counterIncrement: string | null; + counterReset: string | null; + cssFloat: string | null; cssText: string; - cursor: string; - direction: string; - display: string; - dominantBaseline: string; - emptyCells: string; - enableBackground: string; - fill: string; - fillOpacity: string; - fillRule: string; - filter: string; - flex: string; - flexBasis: string; - flexDirection: string; - flexFlow: string; - flexGrow: string; - flexShrink: string; - flexWrap: string; - floodColor: string; - floodOpacity: string; - font: string; - fontFamily: string; - fontFeatureSettings: string; - fontSize: string; - fontSizeAdjust: string; - fontStretch: string; - fontStyle: string; - fontVariant: string; - fontWeight: string; - glyphOrientationHorizontal: string; - glyphOrientationVertical: string; - height: string; - imeMode: string; - justifyContent: string; - kerning: string; - left: string; - length: number; - letterSpacing: string; - lightingColor: string; - lineHeight: string; - listStyle: string; - listStyleImage: string; - listStylePosition: string; - listStyleType: string; - margin: string; - marginBottom: string; - marginLeft: string; - marginRight: string; - marginTop: string; - marker: string; - markerEnd: string; - markerMid: string; - markerStart: string; - mask: string; - maxHeight: string; - maxWidth: string; - minHeight: string; - minWidth: string; - msContentZoomChaining: string; - msContentZoomLimit: string; + cursor: string | null; + direction: string | null; + display: string | null; + dominantBaseline: string | null; + emptyCells: string | null; + enableBackground: string | null; + fill: string | null; + fillOpacity: string | null; + fillRule: string | null; + filter: string | null; + flex: string | null; + flexBasis: string | null; + flexDirection: string | null; + flexFlow: string | null; + flexGrow: string | null; + flexShrink: string | null; + flexWrap: string | null; + floodColor: string | null; + floodOpacity: string | null; + font: string | null; + fontFamily: string | null; + fontFeatureSettings: string | null; + fontSize: string | null; + fontSizeAdjust: string | null; + fontStretch: string | null; + fontStyle: string | null; + fontVariant: string | null; + fontWeight: string | null; + glyphOrientationHorizontal: string | null; + glyphOrientationVertical: string | null; + height: string | null; + imeMode: string | null; + justifyContent: string | null; + kerning: string | null; + left: string | null; + readonly length: number; + letterSpacing: string | null; + lightingColor: string | null; + lineHeight: string | null; + listStyle: string | null; + listStyleImage: string | null; + listStylePosition: string | null; + listStyleType: string | null; + margin: string | null; + marginBottom: string | null; + marginLeft: string | null; + marginRight: string | null; + marginTop: string | null; + marker: string | null; + markerEnd: string | null; + markerMid: string | null; + markerStart: string | null; + mask: string | null; + maxHeight: string | null; + maxWidth: string | null; + minHeight: string | null; + minWidth: string | null; + msContentZoomChaining: string | null; + msContentZoomLimit: string | null; msContentZoomLimitMax: any; msContentZoomLimitMin: any; - msContentZoomSnap: string; - msContentZoomSnapPoints: string; - msContentZoomSnapType: string; - msContentZooming: string; - msFlowFrom: string; - msFlowInto: string; - msFontFeatureSettings: string; + msContentZoomSnap: string | null; + msContentZoomSnapPoints: string | null; + msContentZoomSnapType: string | null; + msContentZooming: string | null; + msFlowFrom: string | null; + msFlowInto: string | null; + msFontFeatureSettings: string | null; msGridColumn: any; - msGridColumnAlign: string; + msGridColumnAlign: string | null; msGridColumnSpan: any; - msGridColumns: string; + msGridColumns: string | null; msGridRow: any; - msGridRowAlign: string; + msGridRowAlign: string | null; msGridRowSpan: any; - msGridRows: string; - msHighContrastAdjust: string; - msHyphenateLimitChars: string; + msGridRows: string | null; + msHighContrastAdjust: string | null; + msHyphenateLimitChars: string | null; msHyphenateLimitLines: any; msHyphenateLimitZone: any; - msHyphens: string; - msImeAlign: string; - msOverflowStyle: string; - msScrollChaining: string; - msScrollLimit: string; + msHyphens: string | null; + msImeAlign: string | null; + msOverflowStyle: string | null; + msScrollChaining: string | null; + msScrollLimit: string | null; msScrollLimitXMax: any; msScrollLimitXMin: any; msScrollLimitYMax: any; msScrollLimitYMin: any; - msScrollRails: string; - msScrollSnapPointsX: string; - msScrollSnapPointsY: string; - msScrollSnapType: string; - msScrollSnapX: string; - msScrollSnapY: string; - msScrollTranslation: string; - msTextCombineHorizontal: string; + msScrollRails: string | null; + msScrollSnapPointsX: string | null; + msScrollSnapPointsY: string | null; + msScrollSnapType: string | null; + msScrollSnapX: string | null; + msScrollSnapY: string | null; + msScrollTranslation: string | null; + msTextCombineHorizontal: string | null; msTextSizeAdjust: any; - msTouchAction: string; - msTouchSelect: string; - msUserSelect: string; + msTouchAction: string | null; + msTouchSelect: string | null; + msUserSelect: string | null; msWrapFlow: string; msWrapMargin: any; msWrapThrough: string; - opacity: string; - order: string; - orphans: string; - outline: string; - outlineColor: string; - outlineStyle: string; - outlineWidth: string; - overflow: string; - overflowX: string; - overflowY: string; - padding: string; - paddingBottom: string; - paddingLeft: string; - paddingRight: string; - paddingTop: string; - pageBreakAfter: string; - pageBreakBefore: string; - pageBreakInside: string; - parentRule: CSSRule; - perspective: string; - perspectiveOrigin: string; - pointerEvents: string; - position: string; - quotes: string; - right: string; - rubyAlign: string; - rubyOverhang: string; - rubyPosition: string; - stopColor: string; - stopOpacity: string; - stroke: string; - strokeDasharray: string; - strokeDashoffset: string; - strokeLinecap: string; - strokeLinejoin: string; - strokeMiterlimit: string; - strokeOpacity: string; - strokeWidth: string; - tableLayout: string; - textAlign: string; - textAlignLast: string; - textAnchor: string; - textDecoration: string; - textFillColor: string; - textIndent: string; - textJustify: string; - textKashida: string; - textKashidaSpace: string; - textOverflow: string; - textShadow: string; - textTransform: string; - textUnderlinePosition: string; - top: string; - touchAction: string; - transform: string; - transformOrigin: string; - transformStyle: string; - transition: string; - transitionDelay: string; - transitionDuration: string; - transitionProperty: string; - transitionTimingFunction: string; - unicodeBidi: string; - verticalAlign: string; - visibility: string; - webkitAlignContent: string; - webkitAlignItems: string; - webkitAlignSelf: string; - webkitAnimation: string; - webkitAnimationDelay: string; - webkitAnimationDirection: string; - webkitAnimationDuration: string; - webkitAnimationFillMode: string; - webkitAnimationIterationCount: string; - webkitAnimationName: string; - webkitAnimationPlayState: string; - webkitAnimationTimingFunction: string; - webkitAppearance: string; - webkitBackfaceVisibility: string; - webkitBackground: string; - webkitBackgroundAttachment: string; - webkitBackgroundClip: string; - webkitBackgroundColor: string; - webkitBackgroundImage: string; - webkitBackgroundOrigin: string; - webkitBackgroundPosition: string; - webkitBackgroundPositionX: string; - webkitBackgroundPositionY: string; - webkitBackgroundRepeat: string; - webkitBackgroundSize: string; - webkitBorderBottomLeftRadius: string; - webkitBorderBottomRightRadius: string; - webkitBorderImage: string; - webkitBorderImageOutset: string; - webkitBorderImageRepeat: string; - webkitBorderImageSlice: string; - webkitBorderImageSource: string; - webkitBorderImageWidth: string; - webkitBorderRadius: string; - webkitBorderTopLeftRadius: string; - webkitBorderTopRightRadius: string; - webkitBoxAlign: string; - webkitBoxDirection: string; - webkitBoxFlex: string; - webkitBoxOrdinalGroup: string; - webkitBoxOrient: string; - webkitBoxPack: string; - webkitBoxSizing: string; - webkitColumnBreakAfter: string; - webkitColumnBreakBefore: string; - webkitColumnBreakInside: string; + opacity: string | null; + order: string | null; + orphans: string | null; + outline: string | null; + outlineColor: string | null; + outlineStyle: string | null; + outlineWidth: string | null; + overflow: string | null; + overflowX: string | null; + overflowY: string | null; + padding: string | null; + paddingBottom: string | null; + paddingLeft: string | null; + paddingRight: string | null; + paddingTop: string | null; + pageBreakAfter: string | null; + pageBreakBefore: string | null; + pageBreakInside: string | null; + readonly parentRule: CSSRule; + perspective: string | null; + perspectiveOrigin: string | null; + pointerEvents: string | null; + position: string | null; + quotes: string | null; + right: string | null; + rubyAlign: string | null; + rubyOverhang: string | null; + rubyPosition: string | null; + stopColor: string | null; + stopOpacity: string | null; + stroke: string | null; + strokeDasharray: string | null; + strokeDashoffset: string | null; + strokeLinecap: string | null; + strokeLinejoin: string | null; + strokeMiterlimit: string | null; + strokeOpacity: string | null; + strokeWidth: string | null; + tableLayout: string | null; + textAlign: string | null; + textAlignLast: string | null; + textAnchor: string | null; + textDecoration: string | null; + textIndent: string | null; + textJustify: string | null; + textKashida: string | null; + textKashidaSpace: string | null; + textOverflow: string | null; + textShadow: string | null; + textTransform: string | null; + textUnderlinePosition: string | null; + top: string | null; + touchAction: string | null; + transform: string | null; + transformOrigin: string | null; + transformStyle: string | null; + transition: string | null; + transitionDelay: string | null; + transitionDuration: string | null; + transitionProperty: string | null; + transitionTimingFunction: string | null; + unicodeBidi: string | null; + verticalAlign: string | null; + visibility: string | null; + webkitAlignContent: string | null; + webkitAlignItems: string | null; + webkitAlignSelf: string | null; + webkitAnimation: string | null; + webkitAnimationDelay: string | null; + webkitAnimationDirection: string | null; + webkitAnimationDuration: string | null; + webkitAnimationFillMode: string | null; + webkitAnimationIterationCount: string | null; + webkitAnimationName: string | null; + webkitAnimationPlayState: string | null; + webkitAnimationTimingFunction: string | null; + webkitAppearance: string | null; + webkitBackfaceVisibility: string | null; + webkitBackgroundClip: string | null; + webkitBackgroundOrigin: string | null; + webkitBackgroundSize: string | null; + webkitBorderBottomLeftRadius: string | null; + webkitBorderBottomRightRadius: string | null; + webkitBorderImage: string | null; + webkitBorderRadius: string | null; + webkitBorderTopLeftRadius: string | null; + webkitBorderTopRightRadius: string | null; + webkitBoxAlign: string | null; + webkitBoxDirection: string | null; + webkitBoxFlex: string | null; + webkitBoxOrdinalGroup: string | null; + webkitBoxOrient: string | null; + webkitBoxPack: string | null; + webkitBoxSizing: string | null; + webkitColumnBreakAfter: string | null; + webkitColumnBreakBefore: string | null; + webkitColumnBreakInside: string | null; webkitColumnCount: any; webkitColumnGap: any; - webkitColumnRule: string; + webkitColumnRule: string | null; webkitColumnRuleColor: any; - webkitColumnRuleStyle: string; + webkitColumnRuleStyle: string | null; webkitColumnRuleWidth: any; - webkitColumnSpan: string; + webkitColumnSpan: string | null; webkitColumnWidth: any; - webkitColumns: string; - webkitFilter: string; - webkitFlex: string; - webkitFlexBasis: string; - webkitFlexDirection: string; - webkitFlexFlow: string; - webkitFlexGrow: string; - webkitFlexShrink: string; - webkitFlexWrap: string; - webkitJustifyContent: string; - webkitOrder: string; - webkitPerspective: string; - webkitPerspectiveOrigin: string; - webkitTapHighlightColor: string; - webkitTextFillColor: string; + webkitColumns: string | null; + webkitFilter: string | null; + webkitFlex: string | null; + webkitFlexBasis: string | null; + webkitFlexDirection: string | null; + webkitFlexFlow: string | null; + webkitFlexGrow: string | null; + webkitFlexShrink: string | null; + webkitFlexWrap: string | null; + webkitJustifyContent: string | null; + webkitOrder: string | null; + webkitPerspective: string | null; + webkitPerspectiveOrigin: string | null; + webkitTapHighlightColor: string | null; + webkitTextFillColor: string | null; webkitTextSizeAdjust: any; - webkitTransform: string; - webkitTransformOrigin: string; - webkitTransformStyle: string; - webkitTransition: string; - webkitTransitionDelay: string; - webkitTransitionDuration: string; - webkitTransitionProperty: string; - webkitTransitionTimingFunction: string; - webkitUserSelect: string; - webkitWritingMode: string; - whiteSpace: string; - widows: string; - width: string; - wordBreak: string; - wordSpacing: string; - wordWrap: string; - writingMode: string; - zIndex: string; - zoom: string; + webkitTransform: string | null; + webkitTransformOrigin: string | null; + webkitTransformStyle: string | null; + webkitTransition: string | null; + webkitTransitionDelay: string | null; + webkitTransitionDuration: string | null; + webkitTransitionProperty: string | null; + webkitTransitionTimingFunction: string | null; + webkitUserModify: string | null; + webkitUserSelect: string | null; + webkitWritingMode: string | null; + whiteSpace: string | null; + widows: string | null; + width: string | null; + wordBreak: string | null; + wordSpacing: string | null; + wordWrap: string | null; + writingMode: string | null; + zIndex: string | null; + zoom: string | null; getPropertyPriority(propertyName: string): string; getPropertyValue(propertyName: string): string; item(index: number): string; removeProperty(propertyName: string): string; - setProperty(propertyName: string, value: string, priority?: string): void; + setProperty(propertyName: string, value: string | null, priority?: string): void; [index: number]: string; } @@ -6359,9 +7287,9 @@ declare var CSSStyleDeclaration: { } interface CSSStyleRule extends CSSRule { - readOnly: boolean; + readonly readOnly: boolean; selectorText: string; - style: CSSStyleDeclaration; + readonly style: CSSStyleDeclaration; } declare var CSSStyleRule: { @@ -6370,18 +7298,18 @@ declare var CSSStyleRule: { } interface CSSStyleSheet extends StyleSheet { - cssRules: CSSRuleList; + readonly cssRules: CSSRuleList; cssText: string; - href: string; - id: string; - imports: StyleSheetList; - isAlternate: boolean; - isPrefAlternate: boolean; - ownerRule: CSSRule; - owningElement: Element; - pages: StyleSheetPageList; - readOnly: boolean; - rules: CSSRuleList; + readonly href: string; + readonly id: string; + readonly imports: StyleSheetList; + readonly isAlternate: boolean; + readonly isPrefAlternate: boolean; + readonly ownerRule: CSSRule; + readonly owningElement: Element; + readonly pages: StyleSheetPageList; + readonly readOnly: boolean; + readonly rules: CSSRuleList; addImport(bstrURL: string, lIndex?: number): number; addPageRule(bstrSelector: string, bstrStyle: string, lIndex?: number): number; addRule(bstrSelector: string, bstrStyle?: string, lIndex?: number): number; @@ -6421,8 +7349,8 @@ declare var CanvasPattern: { new(): CanvasPattern; } -interface CanvasRenderingContext2D { - canvas: HTMLCanvasElement; +interface CanvasRenderingContext2D extends Object, CanvasPathMethods { + readonly canvas: HTMLCanvasElement; fillStyle: string | CanvasGradient | CanvasPattern; font: string; globalAlpha: number; @@ -6441,13 +7369,12 @@ interface CanvasRenderingContext2D { strokeStyle: string | CanvasGradient | CanvasPattern; textAlign: string; textBaseline: string; - arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void; - arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void; + mozImageSmoothingEnabled: boolean; + webkitImageSmoothingEnabled: boolean; + oImageSmoothingEnabled: boolean; beginPath(): void; - bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void; clearRect(x: number, y: number, w: number, h: number): void; clip(fillRule?: string): void; - closePath(): void; createImageData(imageDataOrSw: number | ImageData, sh?: number): ImageData; createLinearGradient(x0: number, y0: number, x1: number, y1: number): CanvasGradient; createPattern(image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement, repetition: string): CanvasPattern; @@ -6459,12 +7386,8 @@ interface CanvasRenderingContext2D { getImageData(sx: number, sy: number, sw: number, sh: number): ImageData; getLineDash(): number[]; isPointInPath(x: number, y: number, fillRule?: string): boolean; - lineTo(x: number, y: number): void; measureText(text: string): TextMetrics; - moveTo(x: number, y: number): void; putImageData(imagedata: ImageData, dx: number, dy: number, dirtyX?: number, dirtyY?: number, dirtyWidth?: number, dirtyHeight?: number): void; - quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void; - rect(x: number, y: number, w: number, h: number): void; restore(): void; rotate(angle: number): void; save(): void; @@ -6501,7 +7424,7 @@ declare var ChannelSplitterNode: { interface CharacterData extends Node, ChildNode { data: string; - length: number; + readonly length: number; appendData(arg: string): void; deleteData(offset: number, count: number): void; insertData(offset: number, arg: string): void; @@ -6517,11 +7440,11 @@ declare var CharacterData: { interface ClientRect { bottom: number; - height: number; + readonly height: number; left: number; right: number; top: number; - width: number; + readonly width: number; } declare var ClientRect: { @@ -6530,7 +7453,7 @@ declare var ClientRect: { } interface ClientRectList { - length: number; + readonly length: number; item(index: number): ClientRect; [index: number]: ClientRect; } @@ -6541,7 +7464,7 @@ declare var ClientRectList: { } interface ClipboardEvent extends Event { - clipboardData: DataTransfer; + readonly clipboardData: DataTransfer; } declare var ClipboardEvent: { @@ -6550,9 +7473,9 @@ declare var ClipboardEvent: { } interface CloseEvent extends Event { - code: number; - reason: string; - wasClean: boolean; + readonly code: number; + readonly reason: string; + readonly wasClean: boolean; initCloseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, wasCleanArg: boolean, codeArg: number, reasonArg: string): void; } @@ -6562,8 +7485,8 @@ declare var CloseEvent: { } interface CommandEvent extends Event { - commandName: string; - detail: string; + readonly commandName: string; + readonly detail: string | null; } declare var CommandEvent: { @@ -6581,8 +7504,8 @@ declare var Comment: { } interface CompositionEvent extends UIEvent { - data: string; - locale: string; + readonly data: string; + readonly locale: string; initCompositionEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, dataArg: string, locale: string): void; } @@ -6599,6 +7522,7 @@ interface Console { dir(value?: any, ...optionalParams: any[]): void; dirxml(value: any): void; error(message?: any, ...optionalParams: any[]): void; + exception(message?: string, ...optionalParams: any[]): void; group(groupTitle?: string): void; groupCollapsed(groupTitle?: string): void; groupEnd(): void; @@ -6608,9 +7532,10 @@ interface Console { profile(reportName?: string): void; profileEnd(): void; select(element: Element): void; + table(...data: any[]): void; time(timerName?: string): void; timeEnd(timerName?: string): void; - trace(): void; + trace(message?: any, ...optionalParams: any[]): void; warn(message?: any, ...optionalParams: any[]): void; } @@ -6620,7 +7545,7 @@ declare var Console: { } interface ConvolverNode extends AudioNode { - buffer: AudioBuffer; + buffer: AudioBuffer | null; normalize: boolean; } @@ -6630,13 +7555,13 @@ declare var ConvolverNode: { } interface Coordinates { - accuracy: number; - altitude: number; - altitudeAccuracy: number; - heading: number; - latitude: number; - longitude: number; - speed: number; + readonly accuracy: number; + readonly altitude: number | null; + readonly altitudeAccuracy: number | null; + readonly heading: number | null; + readonly latitude: number; + readonly longitude: number; + readonly speed: number | null; } declare var Coordinates: { @@ -6645,7 +7570,7 @@ declare var Coordinates: { } interface Crypto extends Object, RandomSource { - subtle: SubtleCrypto; + readonly subtle: SubtleCrypto; } declare var Crypto: { @@ -6654,10 +7579,10 @@ declare var Crypto: { } interface CryptoKey { - algorithm: KeyAlgorithm; - extractable: boolean; - type: string; - usages: string[]; + readonly algorithm: KeyAlgorithm; + readonly extractable: boolean; + readonly type: string; + readonly usages: string[]; } declare var CryptoKey: { @@ -6676,7 +7601,7 @@ declare var CryptoKeyPair: { } interface CustomEvent extends Event { - detail: any; + readonly detail: any; initCustomEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, detailArg: any): void; } @@ -6686,7 +7611,7 @@ declare var CustomEvent: { } interface DOMError { - name: string; + readonly name: string; toString(): string; } @@ -6696,76 +7621,76 @@ declare var DOMError: { } interface DOMException { - code: number; - message: string; - name: string; + readonly code: number; + readonly message: string; + readonly name: string; toString(): string; - ABORT_ERR: number; - DATA_CLONE_ERR: number; - DOMSTRING_SIZE_ERR: number; - HIERARCHY_REQUEST_ERR: number; - INDEX_SIZE_ERR: number; - INUSE_ATTRIBUTE_ERR: number; - INVALID_ACCESS_ERR: number; - INVALID_CHARACTER_ERR: number; - INVALID_MODIFICATION_ERR: number; - INVALID_NODE_TYPE_ERR: number; - INVALID_STATE_ERR: number; - NAMESPACE_ERR: number; - NETWORK_ERR: number; - NOT_FOUND_ERR: number; - NOT_SUPPORTED_ERR: number; - NO_DATA_ALLOWED_ERR: number; - NO_MODIFICATION_ALLOWED_ERR: number; - PARSE_ERR: number; - QUOTA_EXCEEDED_ERR: number; - SECURITY_ERR: number; - SERIALIZE_ERR: number; - SYNTAX_ERR: number; - TIMEOUT_ERR: number; - TYPE_MISMATCH_ERR: number; - URL_MISMATCH_ERR: number; - VALIDATION_ERR: number; - WRONG_DOCUMENT_ERR: number; + readonly ABORT_ERR: number; + readonly DATA_CLONE_ERR: number; + readonly DOMSTRING_SIZE_ERR: number; + readonly HIERARCHY_REQUEST_ERR: number; + readonly INDEX_SIZE_ERR: number; + readonly INUSE_ATTRIBUTE_ERR: number; + readonly INVALID_ACCESS_ERR: number; + readonly INVALID_CHARACTER_ERR: number; + readonly INVALID_MODIFICATION_ERR: number; + readonly INVALID_NODE_TYPE_ERR: number; + readonly INVALID_STATE_ERR: number; + readonly NAMESPACE_ERR: number; + readonly NETWORK_ERR: number; + readonly NOT_FOUND_ERR: number; + readonly NOT_SUPPORTED_ERR: number; + readonly NO_DATA_ALLOWED_ERR: number; + readonly NO_MODIFICATION_ALLOWED_ERR: number; + readonly PARSE_ERR: number; + readonly QUOTA_EXCEEDED_ERR: number; + readonly SECURITY_ERR: number; + readonly SERIALIZE_ERR: number; + readonly SYNTAX_ERR: number; + readonly TIMEOUT_ERR: number; + readonly TYPE_MISMATCH_ERR: number; + readonly URL_MISMATCH_ERR: number; + readonly VALIDATION_ERR: number; + readonly WRONG_DOCUMENT_ERR: number; } declare var DOMException: { prototype: DOMException; new(): DOMException; - ABORT_ERR: number; - DATA_CLONE_ERR: number; - DOMSTRING_SIZE_ERR: number; - HIERARCHY_REQUEST_ERR: number; - INDEX_SIZE_ERR: number; - INUSE_ATTRIBUTE_ERR: number; - INVALID_ACCESS_ERR: number; - INVALID_CHARACTER_ERR: number; - INVALID_MODIFICATION_ERR: number; - INVALID_NODE_TYPE_ERR: number; - INVALID_STATE_ERR: number; - NAMESPACE_ERR: number; - NETWORK_ERR: number; - NOT_FOUND_ERR: number; - NOT_SUPPORTED_ERR: number; - NO_DATA_ALLOWED_ERR: number; - NO_MODIFICATION_ALLOWED_ERR: number; - PARSE_ERR: number; - QUOTA_EXCEEDED_ERR: number; - SECURITY_ERR: number; - SERIALIZE_ERR: number; - SYNTAX_ERR: number; - TIMEOUT_ERR: number; - TYPE_MISMATCH_ERR: number; - URL_MISMATCH_ERR: number; - VALIDATION_ERR: number; - WRONG_DOCUMENT_ERR: number; + readonly ABORT_ERR: number; + readonly DATA_CLONE_ERR: number; + readonly DOMSTRING_SIZE_ERR: number; + readonly HIERARCHY_REQUEST_ERR: number; + readonly INDEX_SIZE_ERR: number; + readonly INUSE_ATTRIBUTE_ERR: number; + readonly INVALID_ACCESS_ERR: number; + readonly INVALID_CHARACTER_ERR: number; + readonly INVALID_MODIFICATION_ERR: number; + readonly INVALID_NODE_TYPE_ERR: number; + readonly INVALID_STATE_ERR: number; + readonly NAMESPACE_ERR: number; + readonly NETWORK_ERR: number; + readonly NOT_FOUND_ERR: number; + readonly NOT_SUPPORTED_ERR: number; + readonly NO_DATA_ALLOWED_ERR: number; + readonly NO_MODIFICATION_ALLOWED_ERR: number; + readonly PARSE_ERR: number; + readonly QUOTA_EXCEEDED_ERR: number; + readonly SECURITY_ERR: number; + readonly SERIALIZE_ERR: number; + readonly SYNTAX_ERR: number; + readonly TIMEOUT_ERR: number; + readonly TYPE_MISMATCH_ERR: number; + readonly URL_MISMATCH_ERR: number; + readonly VALIDATION_ERR: number; + readonly WRONG_DOCUMENT_ERR: number; } interface DOMImplementation { - createDocument(namespaceURI: string, qualifiedName: string, doctype: DocumentType): Document; - createDocumentType(qualifiedName: string, publicId: string, systemId: string): DocumentType; + createDocument(namespaceURI: string | null, qualifiedName: string | null, doctype: DocumentType): Document; + createDocumentType(qualifiedName: string, publicId: string | null, systemId: string | null): DocumentType; createHTMLDocument(title: string): Document; - hasFeature(feature: string, version: string): boolean; + hasFeature(feature: string | null, version: string | null): boolean; } declare var DOMImplementation: { @@ -6792,9 +7717,9 @@ declare var DOMSettableTokenList: { } interface DOMStringList { - length: number; + readonly length: number; contains(str: string): boolean; - item(index: number): string; + item(index: number): string | null; [index: number]: string; } @@ -6813,7 +7738,7 @@ declare var DOMStringMap: { } interface DOMTokenList { - length: number; + readonly length: number; add(...token: string[]): void; contains(token: string): boolean; item(index: number): string; @@ -6840,9 +7765,9 @@ declare var DataCue: { interface DataTransfer { dropEffect: string; effectAllowed: string; - files: FileList; - items: DataTransferItemList; - types: DOMStringList; + readonly files: FileList; + readonly items: DataTransferItemList; + readonly types: DOMStringList; clearData(format?: string): boolean; getData(format: string): string; setData(format: string, data: string): boolean; @@ -6854,10 +7779,10 @@ declare var DataTransfer: { } interface DataTransferItem { - kind: string; - type: string; - getAsFile(): File; - getAsString(_callback: FunctionStringCallback): void; + readonly kind: string; + readonly type: string; + getAsFile(): File | null; + getAsString(_callback: FunctionStringCallback | null): void; } declare var DataTransferItem: { @@ -6866,12 +7791,12 @@ declare var DataTransferItem: { } interface DataTransferItemList { - length: number; - add(data: File): DataTransferItem; + readonly length: number; + add(data: File): DataTransferItem | null; clear(): void; - item(index: number): File; + item(index: number): DataTransferItem; remove(index: number): void; - [index: number]: File; + [index: number]: DataTransferItem; } declare var DataTransferItemList: { @@ -6880,9 +7805,9 @@ declare var DataTransferItemList: { } interface DeferredPermissionRequest { - id: number; - type: string; - uri: string; + readonly id: number; + readonly type: string; + readonly uri: string; allow(): void; deny(): void; } @@ -6893,7 +7818,7 @@ declare var DeferredPermissionRequest: { } interface DelayNode extends AudioNode { - delayTime: AudioParam; + readonly delayTime: AudioParam; } declare var DelayNode: { @@ -6902,9 +7827,9 @@ declare var DelayNode: { } interface DeviceAcceleration { - x: number; - y: number; - z: number; + readonly x: number | null; + readonly y: number | null; + readonly z: number | null; } declare var DeviceAcceleration: { @@ -6912,12 +7837,21 @@ declare var DeviceAcceleration: { new(): DeviceAcceleration; } +interface DeviceLightEvent extends Event { + readonly value: number; +} + +declare var DeviceLightEvent: { + prototype: DeviceLightEvent; + new(type: string, eventInitDict?: DeviceLightEventInit): DeviceLightEvent; +} + interface DeviceMotionEvent extends Event { - acceleration: DeviceAcceleration; - accelerationIncludingGravity: DeviceAcceleration; - interval: number; - rotationRate: DeviceRotationRate; - initDeviceMotionEvent(type: string, bubbles: boolean, cancelable: boolean, acceleration: DeviceAccelerationDict, accelerationIncludingGravity: DeviceAccelerationDict, rotationRate: DeviceRotationRateDict, interval: number): void; + readonly acceleration: DeviceAcceleration | null; + readonly accelerationIncludingGravity: DeviceAcceleration | null; + readonly interval: number | null; + readonly rotationRate: DeviceRotationRate | null; + initDeviceMotionEvent(type: string, bubbles: boolean, cancelable: boolean, acceleration: DeviceAccelerationDict | null, accelerationIncludingGravity: DeviceAccelerationDict | null, rotationRate: DeviceRotationRateDict | null, interval: number | null): void; } declare var DeviceMotionEvent: { @@ -6926,11 +7860,11 @@ declare var DeviceMotionEvent: { } interface DeviceOrientationEvent extends Event { - absolute: boolean; - alpha: number; - beta: number; - gamma: number; - initDeviceOrientationEvent(type: string, bubbles: boolean, cancelable: boolean, alpha: number, beta: number, gamma: number, absolute: boolean): void; + readonly absolute: boolean; + readonly alpha: number | null; + readonly beta: number | null; + readonly gamma: number | null; + initDeviceOrientationEvent(type: string, bubbles: boolean, cancelable: boolean, alpha: number | null, beta: number | null, gamma: number | null, absolute: boolean): void; } declare var DeviceOrientationEvent: { @@ -6939,9 +7873,9 @@ declare var DeviceOrientationEvent: { } interface DeviceRotationRate { - alpha: number; - beta: number; - gamma: number; + readonly alpha: number | null; + readonly beta: number | null; + readonly gamma: number | null; } declare var DeviceRotationRate: { @@ -6953,15 +7887,15 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven /** * Sets or gets the URL for the current document. */ - URL: string; + readonly URL: string; /** * Gets the URL for the document, stripped of any character encoding. */ - URLUnencoded: string; + readonly URLUnencoded: string; /** * Gets the object that has the focus when the parent document has focus. */ - activeElement: Element; + readonly activeElement: Element; /** * Sets or gets the color of all active links in the document. */ @@ -6969,15 +7903,15 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven /** * Returns a reference to the collection of elements contained by the object. */ - all: HTMLCollection; + readonly all: HTMLAllCollection; /** * Retrieves a collection of all a objects that have a name and/or id property. Objects in this collection are in HTML source order. */ - anchors: HTMLCollection; + anchors: HTMLCollectionOf; /** * Retrieves a collection of all applet objects in the document. */ - applets: HTMLCollection; + applets: HTMLCollectionOf; /** * Deprecated. Sets or retrieves a value that indicates the background color behind the object. */ @@ -6986,7 +7920,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * Specifies the beginning and end of the document body. */ body: HTMLElement; - characterSet: string; + readonly characterSet: string; /** * Gets or sets the character set used to encode the object. */ @@ -6994,13 +7928,14 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven /** * Gets a value that indicates whether standards-compliant mode is switched on for the object. */ - compatMode: string; + readonly compatMode: string; cookie: string; + readonly currentScript: HTMLScriptElement | SVGScriptElement; /** * Gets the default character set from the current regional language settings. */ - defaultCharset: string; - defaultView: Window; + readonly defaultCharset: string; + readonly defaultView: Window; /** * Sets or gets a value that indicates whether the document can be edited. */ @@ -7012,7 +7947,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven /** * Gets an object representing the document type declaration associated with the current document. */ - doctype: DocumentType; + readonly doctype: DocumentType; /** * Gets a reference to the root node of the document. */ @@ -7024,7 +7959,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven /** * Retrieves a collection of all embed objects in the document. */ - embeds: HTMLCollection; + embeds: HTMLCollectionOf; /** * Sets or gets the foreground (text) color of the document. */ @@ -7032,27 +7967,27 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven /** * Retrieves a collection, in source order, of all form objects in the document. */ - forms: HTMLCollection; - fullscreenElement: Element; - fullscreenEnabled: boolean; - head: HTMLHeadElement; - hidden: boolean; + forms: HTMLCollectionOf; + readonly fullscreenElement: Element | null; + readonly fullscreenEnabled: boolean; + readonly head: HTMLHeadElement; + readonly hidden: boolean; /** * Retrieves a collection, in source order, of img objects in the document. */ - images: HTMLCollection; + images: HTMLCollectionOf; /** * Gets the implementation object of the current document. */ - implementation: DOMImplementation; + readonly implementation: DOMImplementation; /** * Returns the character encoding used to create the webpage that is loaded into the document object. */ - inputEncoding: string; + readonly inputEncoding: string | null; /** * Gets the date that the page was last modified, if the page supplies one. */ - lastModified: string; + readonly lastModified: string; /** * Sets or gets the color of the document links. */ @@ -7060,16 +7995,13 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven /** * Retrieves a collection of all a objects that specify the href property and all area objects in the document. */ - links: HTMLCollection; + links: HTMLCollectionOf; /** * Contains information about the current URL. */ - location: Location; - media: string; + readonly location: Location; msCSSOMElementFloatMetrics: boolean; msCapsLockWarningOff: boolean; - msHidden: boolean; - msVisibilityState: string; /** * Fires when the user aborts the download. * @param ev The event. @@ -7171,7 +8103,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * Occurs when the end of playback is reached. * @param ev The event */ - onended: (ev: Event) => any; + onended: (ev: MediaStreamErrorEvent) => any; /** * Fires when an error occurs during object loading. * @param ev The event. @@ -7185,6 +8117,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven onfullscreenchange: (ev: Event) => any; onfullscreenerror: (ev: Event) => any; oninput: (ev: Event) => any; + oninvalid: (ev: Event) => any; /** * Fires when the user presses a key. * @param ev The keyboard event @@ -7249,7 +8182,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * Fires when the wheel button is rotated. * @param ev The mouse event */ - onmousewheel: (ev: MouseWheelEvent) => any; + onmousewheel: (ev: WheelEvent) => any; onmscontentzoom: (ev: UIEvent) => any; onmsgesturechange: (ev: MSGestureEvent) => any; onmsgesturedoubletap: (ev: MSGestureEvent) => any; @@ -7334,6 +8267,11 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * @param ev The event. */ onselect: (ev: UIEvent) => any; + /** + * Fires when the selection state of a document changes. + * @param ev The event. + */ + onselectionchange: (ev: Event) => any; onselectstart: (ev: Event) => any; /** * Occurs when the download has stopped. @@ -7372,50 +8310,51 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven onwaiting: (ev: Event) => any; onwebkitfullscreenchange: (ev: Event) => any; onwebkitfullscreenerror: (ev: Event) => any; - plugins: HTMLCollection; - pointerLockElement: Element; + plugins: HTMLCollectionOf; + readonly pointerLockElement: Element; /** * Retrieves a value that indicates the current state of the object. */ - readyState: string; + readonly readyState: string; /** * Gets the URL of the location that referred the user to the current page. */ - referrer: string; + readonly referrer: string; /** * Gets the root svg element in the document hierarchy. */ - rootElement: SVGSVGElement; + readonly rootElement: SVGSVGElement; /** * Retrieves a collection of all script objects in the document. */ - scripts: HTMLCollection; - security: string; + scripts: HTMLCollectionOf; + readonly scrollingElement: Element | null; /** * Retrieves a collection of styleSheet objects representing the style sheets that correspond to each instance of a link or style object in the document. */ - styleSheets: StyleSheetList; + readonly styleSheets: StyleSheetList; /** * Contains the title of the document. */ title: string; - visibilityState: string; + readonly visibilityState: string; /** * Sets or gets the color of the links that the user has visited. */ vlinkColor: string; - webkitCurrentFullScreenElement: Element; - webkitFullscreenElement: Element; - webkitFullscreenEnabled: boolean; - webkitIsFullScreen: boolean; - xmlEncoding: string; + readonly webkitCurrentFullScreenElement: Element | null; + readonly webkitFullscreenElement: Element | null; + readonly webkitFullscreenEnabled: boolean; + readonly webkitIsFullScreen: boolean; + readonly xmlEncoding: string | null; xmlStandalone: boolean; /** * Gets or sets the version attribute specified in the declaration of an XML document. */ - xmlVersion: string; + xmlVersion: string | null; adoptNode(source: Node): Node; captureEvents(): void; + caretRangeFromPoint(x: number, y: number): Range; clear(): void; /** * Closes an output stream and forces the sent data to display. @@ -7426,7 +8365,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * @param name String that sets the attribute object's name. */ createAttribute(name: string): Attr; - createAttributeNS(namespaceURI: string, qualifiedName: string): Attr; + createAttributeNS(namespaceURI: string | null, qualifiedName: string): Attr; createCDATASection(data: string): CDATASection; /** * Creates a comment object with the specified data. @@ -7442,37 +8381,24 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * @param tagName The name of an element. */ createElement(tagName: "a"): HTMLAnchorElement; - createElement(tagName: "abbr"): HTMLPhraseElement; - createElement(tagName: "acronym"): HTMLPhraseElement; - createElement(tagName: "address"): HTMLBlockElement; createElement(tagName: "applet"): HTMLAppletElement; createElement(tagName: "area"): HTMLAreaElement; createElement(tagName: "audio"): HTMLAudioElement; - createElement(tagName: "b"): HTMLPhraseElement; createElement(tagName: "base"): HTMLBaseElement; createElement(tagName: "basefont"): HTMLBaseFontElement; - createElement(tagName: "bdo"): HTMLPhraseElement; - createElement(tagName: "big"): HTMLPhraseElement; - createElement(tagName: "blockquote"): HTMLBlockElement; + createElement(tagName: "blockquote"): HTMLQuoteElement; createElement(tagName: "body"): HTMLBodyElement; createElement(tagName: "br"): HTMLBRElement; createElement(tagName: "button"): HTMLButtonElement; createElement(tagName: "canvas"): HTMLCanvasElement; createElement(tagName: "caption"): HTMLTableCaptionElement; - createElement(tagName: "center"): HTMLBlockElement; - createElement(tagName: "cite"): HTMLPhraseElement; - createElement(tagName: "code"): HTMLPhraseElement; createElement(tagName: "col"): HTMLTableColElement; createElement(tagName: "colgroup"): HTMLTableColElement; createElement(tagName: "datalist"): HTMLDataListElement; - createElement(tagName: "dd"): HTMLDDElement; createElement(tagName: "del"): HTMLModElement; - createElement(tagName: "dfn"): HTMLPhraseElement; createElement(tagName: "dir"): HTMLDirectoryElement; createElement(tagName: "div"): HTMLDivElement; createElement(tagName: "dl"): HTMLDListElement; - createElement(tagName: "dt"): HTMLDTElement; - createElement(tagName: "em"): HTMLPhraseElement; createElement(tagName: "embed"): HTMLEmbedElement; createElement(tagName: "fieldset"): HTMLFieldSetElement; createElement(tagName: "font"): HTMLFontElement; @@ -7488,52 +8414,41 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven createElement(tagName: "head"): HTMLHeadElement; createElement(tagName: "hr"): HTMLHRElement; createElement(tagName: "html"): HTMLHtmlElement; - createElement(tagName: "i"): HTMLPhraseElement; createElement(tagName: "iframe"): HTMLIFrameElement; createElement(tagName: "img"): HTMLImageElement; createElement(tagName: "input"): HTMLInputElement; createElement(tagName: "ins"): HTMLModElement; - createElement(tagName: "isindex"): HTMLIsIndexElement; - createElement(tagName: "kbd"): HTMLPhraseElement; - createElement(tagName: "keygen"): HTMLBlockElement; + createElement(tagName: "isindex"): HTMLUnknownElement; createElement(tagName: "label"): HTMLLabelElement; createElement(tagName: "legend"): HTMLLegendElement; createElement(tagName: "li"): HTMLLIElement; createElement(tagName: "link"): HTMLLinkElement; - createElement(tagName: "listing"): HTMLBlockElement; + createElement(tagName: "listing"): HTMLPreElement; createElement(tagName: "map"): HTMLMapElement; createElement(tagName: "marquee"): HTMLMarqueeElement; createElement(tagName: "menu"): HTMLMenuElement; createElement(tagName: "meta"): HTMLMetaElement; - createElement(tagName: "nextid"): HTMLNextIdElement; - createElement(tagName: "nobr"): HTMLPhraseElement; + createElement(tagName: "meter"): HTMLMeterElement; + createElement(tagName: "nextid"): HTMLUnknownElement; createElement(tagName: "object"): HTMLObjectElement; createElement(tagName: "ol"): HTMLOListElement; createElement(tagName: "optgroup"): HTMLOptGroupElement; createElement(tagName: "option"): HTMLOptionElement; createElement(tagName: "p"): HTMLParagraphElement; createElement(tagName: "param"): HTMLParamElement; - createElement(tagName: "plaintext"): HTMLBlockElement; + createElement(tagName: "picture"): HTMLPictureElement; createElement(tagName: "pre"): HTMLPreElement; createElement(tagName: "progress"): HTMLProgressElement; createElement(tagName: "q"): HTMLQuoteElement; - createElement(tagName: "rt"): HTMLPhraseElement; - createElement(tagName: "ruby"): HTMLPhraseElement; - createElement(tagName: "s"): HTMLPhraseElement; - createElement(tagName: "samp"): HTMLPhraseElement; createElement(tagName: "script"): HTMLScriptElement; createElement(tagName: "select"): HTMLSelectElement; - createElement(tagName: "small"): HTMLPhraseElement; createElement(tagName: "source"): HTMLSourceElement; createElement(tagName: "span"): HTMLSpanElement; - createElement(tagName: "strike"): HTMLPhraseElement; - createElement(tagName: "strong"): HTMLPhraseElement; createElement(tagName: "style"): HTMLStyleElement; - createElement(tagName: "sub"): HTMLPhraseElement; - createElement(tagName: "sup"): HTMLPhraseElement; createElement(tagName: "table"): HTMLTableElement; createElement(tagName: "tbody"): HTMLTableSectionElement; createElement(tagName: "td"): HTMLTableDataCellElement; + createElement(tagName: "template"): HTMLTemplateElement; createElement(tagName: "textarea"): HTMLTextAreaElement; createElement(tagName: "tfoot"): HTMLTableSectionElement; createElement(tagName: "th"): HTMLTableHeaderCellElement; @@ -7541,14 +8456,12 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven createElement(tagName: "title"): HTMLTitleElement; createElement(tagName: "tr"): HTMLTableRowElement; createElement(tagName: "track"): HTMLTrackElement; - createElement(tagName: "tt"): HTMLPhraseElement; - createElement(tagName: "u"): HTMLPhraseElement; createElement(tagName: "ul"): HTMLUListElement; - createElement(tagName: "var"): HTMLPhraseElement; createElement(tagName: "video"): HTMLVideoElement; createElement(tagName: "x-ms-webview"): MSHTMLWebViewElement; - createElement(tagName: "xmp"): HTMLBlockElement; + createElement(tagName: "xmp"): HTMLPreElement; createElement(tagName: string): HTMLElement; + createElementNS(namespaceURI: "http://www.w3.org/1999/xhtml", qualifiedName: string): HTMLElement createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "a"): SVGAElement createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "circle"): SVGCircleElement createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "clipPath"): SVGClipPathElement @@ -7611,7 +8524,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "use"): SVGUseElement createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "view"): SVGViewElement createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: string): SVGElement - createElementNS(namespaceURI: string, qualifiedName: string): Element; + createElementNS(namespaceURI: string | null, qualifiedName: string): Element; createExpression(expression: string, resolver: XPathNSResolver): XPathExpression; createNSResolver(nodeResolver: Node): XPathNSResolver; /** @@ -7632,7 +8545,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * @param data String that specifies the nodeValue property of the text node. */ createTextNode(data: string): Text; - createTouch(view: any, target: EventTarget, identifier: number, pageX: number, pageY: number, screenX: number, screenY: number): Touch; + createTouch(view: Window, target: EventTarget, identifier: number, pageX: number, pageY: number, screenX: number, screenY: number): Touch; createTouchList(...touches: Touch[]): TouchList; /** * Creates a TreeWalker object that you can use to traverse filtered lists of nodes or elements in a document. @@ -7672,55 +8585,55 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * @param elementId String that specifies the ID value. Case-insensitive. */ getElementById(elementId: string): HTMLElement; - getElementsByClassName(classNames: string): NodeListOf; + getElementsByClassName(classNames: string): HTMLCollectionOf; /** * Gets a collection of objects based on the value of the NAME or ID attribute. * @param elementName Gets a collection of objects based on the value of the NAME or ID attribute. */ - getElementsByName(elementName: string): NodeListOf; + getElementsByName(elementName: string): NodeListOf; /** * Retrieves a collection of objects based on the specified element name. * @param name Specifies the name of an element. */ getElementsByTagName(tagname: "a"): NodeListOf; - getElementsByTagName(tagname: "abbr"): NodeListOf; - getElementsByTagName(tagname: "acronym"): NodeListOf; - getElementsByTagName(tagname: "address"): NodeListOf; + getElementsByTagName(tagname: "abbr"): NodeListOf; + getElementsByTagName(tagname: "acronym"): NodeListOf; + getElementsByTagName(tagname: "address"): NodeListOf; getElementsByTagName(tagname: "applet"): NodeListOf; getElementsByTagName(tagname: "area"): NodeListOf; getElementsByTagName(tagname: "article"): NodeListOf; getElementsByTagName(tagname: "aside"): NodeListOf; getElementsByTagName(tagname: "audio"): NodeListOf; - getElementsByTagName(tagname: "b"): NodeListOf; + getElementsByTagName(tagname: "b"): NodeListOf; getElementsByTagName(tagname: "base"): NodeListOf; getElementsByTagName(tagname: "basefont"): NodeListOf; - getElementsByTagName(tagname: "bdo"): NodeListOf; - getElementsByTagName(tagname: "big"): NodeListOf; - getElementsByTagName(tagname: "blockquote"): NodeListOf; + getElementsByTagName(tagname: "bdo"): NodeListOf; + getElementsByTagName(tagname: "big"): NodeListOf; + getElementsByTagName(tagname: "blockquote"): NodeListOf; getElementsByTagName(tagname: "body"): NodeListOf; getElementsByTagName(tagname: "br"): NodeListOf; getElementsByTagName(tagname: "button"): NodeListOf; getElementsByTagName(tagname: "canvas"): NodeListOf; getElementsByTagName(tagname: "caption"): NodeListOf; - getElementsByTagName(tagname: "center"): NodeListOf; + getElementsByTagName(tagname: "center"): NodeListOf; getElementsByTagName(tagname: "circle"): NodeListOf; - getElementsByTagName(tagname: "cite"): NodeListOf; + getElementsByTagName(tagname: "cite"): NodeListOf; getElementsByTagName(tagname: "clippath"): NodeListOf; - getElementsByTagName(tagname: "code"): NodeListOf; + getElementsByTagName(tagname: "code"): NodeListOf; getElementsByTagName(tagname: "col"): NodeListOf; getElementsByTagName(tagname: "colgroup"): NodeListOf; getElementsByTagName(tagname: "datalist"): NodeListOf; - getElementsByTagName(tagname: "dd"): NodeListOf; + getElementsByTagName(tagname: "dd"): NodeListOf; getElementsByTagName(tagname: "defs"): NodeListOf; getElementsByTagName(tagname: "del"): NodeListOf; getElementsByTagName(tagname: "desc"): NodeListOf; - getElementsByTagName(tagname: "dfn"): NodeListOf; + getElementsByTagName(tagname: "dfn"): NodeListOf; getElementsByTagName(tagname: "dir"): NodeListOf; getElementsByTagName(tagname: "div"): NodeListOf; getElementsByTagName(tagname: "dl"): NodeListOf; - getElementsByTagName(tagname: "dt"): NodeListOf; + getElementsByTagName(tagname: "dt"): NodeListOf; getElementsByTagName(tagname: "ellipse"): NodeListOf; - getElementsByTagName(tagname: "em"): NodeListOf; + getElementsByTagName(tagname: "em"): NodeListOf; getElementsByTagName(tagname: "embed"): NodeListOf; getElementsByTagName(tagname: "feblend"): NodeListOf; getElementsByTagName(tagname: "fecolormatrix"): NodeListOf; @@ -7768,22 +8681,22 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven getElementsByTagName(tagname: "hgroup"): NodeListOf; getElementsByTagName(tagname: "hr"): NodeListOf; getElementsByTagName(tagname: "html"): NodeListOf; - getElementsByTagName(tagname: "i"): NodeListOf; + getElementsByTagName(tagname: "i"): NodeListOf; getElementsByTagName(tagname: "iframe"): NodeListOf; getElementsByTagName(tagname: "image"): NodeListOf; getElementsByTagName(tagname: "img"): NodeListOf; getElementsByTagName(tagname: "input"): NodeListOf; getElementsByTagName(tagname: "ins"): NodeListOf; - getElementsByTagName(tagname: "isindex"): NodeListOf; - getElementsByTagName(tagname: "kbd"): NodeListOf; - getElementsByTagName(tagname: "keygen"): NodeListOf; + getElementsByTagName(tagname: "isindex"): NodeListOf; + getElementsByTagName(tagname: "kbd"): NodeListOf; + getElementsByTagName(tagname: "keygen"): NodeListOf; getElementsByTagName(tagname: "label"): NodeListOf; getElementsByTagName(tagname: "legend"): NodeListOf; getElementsByTagName(tagname: "li"): NodeListOf; getElementsByTagName(tagname: "line"): NodeListOf; getElementsByTagName(tagname: "lineargradient"): NodeListOf; getElementsByTagName(tagname: "link"): NodeListOf; - getElementsByTagName(tagname: "listing"): NodeListOf; + getElementsByTagName(tagname: "listing"): NodeListOf; getElementsByTagName(tagname: "map"): NodeListOf; getElementsByTagName(tagname: "mark"): NodeListOf; getElementsByTagName(tagname: "marker"): NodeListOf; @@ -7792,9 +8705,10 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven getElementsByTagName(tagname: "menu"): NodeListOf; getElementsByTagName(tagname: "meta"): NodeListOf; getElementsByTagName(tagname: "metadata"): NodeListOf; + getElementsByTagName(tagname: "meter"): NodeListOf; getElementsByTagName(tagname: "nav"): NodeListOf; - getElementsByTagName(tagname: "nextid"): NodeListOf; - getElementsByTagName(tagname: "nobr"): NodeListOf; + getElementsByTagName(tagname: "nextid"): NodeListOf; + getElementsByTagName(tagname: "nobr"): NodeListOf; getElementsByTagName(tagname: "noframes"): NodeListOf; getElementsByTagName(tagname: "noscript"): NodeListOf; getElementsByTagName(tagname: "object"): NodeListOf; @@ -7805,7 +8719,8 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven getElementsByTagName(tagname: "param"): NodeListOf; getElementsByTagName(tagname: "path"): NodeListOf; getElementsByTagName(tagname: "pattern"): NodeListOf; - getElementsByTagName(tagname: "plaintext"): NodeListOf; + getElementsByTagName(tagname: "picture"): NodeListOf; + getElementsByTagName(tagname: "plaintext"): NodeListOf; getElementsByTagName(tagname: "polygon"): NodeListOf; getElementsByTagName(tagname: "polyline"): NodeListOf; getElementsByTagName(tagname: "pre"): NodeListOf; @@ -7813,28 +8728,29 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven getElementsByTagName(tagname: "q"): NodeListOf; getElementsByTagName(tagname: "radialgradient"): NodeListOf; getElementsByTagName(tagname: "rect"): NodeListOf; - getElementsByTagName(tagname: "rt"): NodeListOf; - getElementsByTagName(tagname: "ruby"): NodeListOf; - getElementsByTagName(tagname: "s"): NodeListOf; - getElementsByTagName(tagname: "samp"): NodeListOf; + getElementsByTagName(tagname: "rt"): NodeListOf; + getElementsByTagName(tagname: "ruby"): NodeListOf; + getElementsByTagName(tagname: "s"): NodeListOf; + getElementsByTagName(tagname: "samp"): NodeListOf; getElementsByTagName(tagname: "script"): NodeListOf; getElementsByTagName(tagname: "section"): NodeListOf; getElementsByTagName(tagname: "select"): NodeListOf; - getElementsByTagName(tagname: "small"): NodeListOf; + getElementsByTagName(tagname: "small"): NodeListOf; getElementsByTagName(tagname: "source"): NodeListOf; getElementsByTagName(tagname: "span"): NodeListOf; getElementsByTagName(tagname: "stop"): NodeListOf; - getElementsByTagName(tagname: "strike"): NodeListOf; - getElementsByTagName(tagname: "strong"): NodeListOf; + getElementsByTagName(tagname: "strike"): NodeListOf; + getElementsByTagName(tagname: "strong"): NodeListOf; getElementsByTagName(tagname: "style"): NodeListOf; - getElementsByTagName(tagname: "sub"): NodeListOf; - getElementsByTagName(tagname: "sup"): NodeListOf; + getElementsByTagName(tagname: "sub"): NodeListOf; + getElementsByTagName(tagname: "sup"): NodeListOf; getElementsByTagName(tagname: "svg"): NodeListOf; getElementsByTagName(tagname: "switch"): NodeListOf; getElementsByTagName(tagname: "symbol"): NodeListOf; getElementsByTagName(tagname: "table"): NodeListOf; getElementsByTagName(tagname: "tbody"): NodeListOf; getElementsByTagName(tagname: "td"): NodeListOf; + getElementsByTagName(tagname: "template"): NodeListOf; getElementsByTagName(tagname: "text"): NodeListOf; getElementsByTagName(tagname: "textpath"): NodeListOf; getElementsByTagName(tagname: "textarea"): NodeListOf; @@ -7845,18 +8761,20 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven getElementsByTagName(tagname: "tr"): NodeListOf; getElementsByTagName(tagname: "track"): NodeListOf; getElementsByTagName(tagname: "tspan"): NodeListOf; - getElementsByTagName(tagname: "tt"): NodeListOf; - getElementsByTagName(tagname: "u"): NodeListOf; + getElementsByTagName(tagname: "tt"): NodeListOf; + getElementsByTagName(tagname: "u"): NodeListOf; getElementsByTagName(tagname: "ul"): NodeListOf; getElementsByTagName(tagname: "use"): NodeListOf; - getElementsByTagName(tagname: "var"): NodeListOf; + getElementsByTagName(tagname: "var"): NodeListOf; getElementsByTagName(tagname: "video"): NodeListOf; getElementsByTagName(tagname: "view"): NodeListOf; getElementsByTagName(tagname: "wbr"): NodeListOf; getElementsByTagName(tagname: "x-ms-webview"): NodeListOf; - getElementsByTagName(tagname: "xmp"): NodeListOf; + getElementsByTagName(tagname: "xmp"): NodeListOf; getElementsByTagName(tagname: string): NodeListOf; - getElementsByTagNameNS(namespaceURI: string, localName: string): NodeListOf; + getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf; + getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf; + getElementsByTagNameNS(namespaceURI: string, localName: string): HTMLCollectionOf; /** * Returns an object representing the current selection of the document that is loaded into the object displaying a webpage. */ @@ -7866,8 +8784,8 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven */ hasFocus(): boolean; importNode(importedNode: Node, deep: boolean): Node; - msElementsFromPoint(x: number, y: number): NodeList; - msElementsFromRect(left: number, top: number, width: number, height: number): NodeList; + msElementsFromPoint(x: number, y: number): NodeListOf; + msElementsFromRect(left: number, top: number, width: number, height: number): NodeListOf; /** * Opens a new window and loads a document specified by a given URL. Also, opens a new window that uses the url parameter and the name parameter to collect the output of the write method and the writeln method. * @param url Specifies a MIME type for the document. @@ -7961,12 +8879,13 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "fullscreenchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "fullscreenerror", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -7979,7 +8898,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; addEventListener(type: "mssitemodejumplistitemremoved", listener: (ev: MSSiteModeEvent) => any, useCapture?: boolean): void; addEventListener(type: "msthumbnailclick", listener: (ev: MSSiteModeEvent) => any, useCapture?: boolean): void; addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -8003,6 +8922,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven addEventListener(type: "seeked", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "seeking", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "select", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "selectionchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "selectstart", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "stalled", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "stop", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -8036,12 +8956,12 @@ declare var DocumentFragment: { } interface DocumentType extends Node, ChildNode { - entities: NamedNodeMap; - internalSubset: string; - name: string; - notations: NamedNodeMap; - publicId: string; - systemId: string; + readonly entities: NamedNodeMap; + readonly internalSubset: string | null; + readonly name: string; + readonly notations: NamedNodeMap; + readonly publicId: string | null; + readonly systemId: string | null; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -8051,7 +8971,7 @@ declare var DocumentType: { } interface DragEvent extends MouseEvent { - dataTransfer: DataTransfer; + readonly dataTransfer: DataTransfer; initDragEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, dataTransferArg: DataTransfer): void; msConvertURL(file: File, targetType: string, targetURL?: string): void; } @@ -8062,12 +8982,12 @@ declare var DragEvent: { } interface DynamicsCompressorNode extends AudioNode { - attack: AudioParam; - knee: AudioParam; - ratio: AudioParam; - reduction: AudioParam; - release: AudioParam; - threshold: AudioParam; + readonly attack: AudioParam; + readonly knee: AudioParam; + readonly ratio: AudioParam; + readonly reduction: AudioParam; + readonly release: AudioParam; + readonly threshold: AudioParam; } declare var DynamicsCompressorNode: { @@ -8075,26 +8995,36 @@ declare var DynamicsCompressorNode: { new(): DynamicsCompressorNode; } +interface EXT_frag_depth { +} + +declare var EXT_frag_depth: { + prototype: EXT_frag_depth; + new(): EXT_frag_depth; +} + interface EXT_texture_filter_anisotropic { - MAX_TEXTURE_MAX_ANISOTROPY_EXT: number; - TEXTURE_MAX_ANISOTROPY_EXT: number; + readonly MAX_TEXTURE_MAX_ANISOTROPY_EXT: number; + readonly TEXTURE_MAX_ANISOTROPY_EXT: number; } declare var EXT_texture_filter_anisotropic: { prototype: EXT_texture_filter_anisotropic; new(): EXT_texture_filter_anisotropic; - MAX_TEXTURE_MAX_ANISOTROPY_EXT: number; - TEXTURE_MAX_ANISOTROPY_EXT: number; + readonly MAX_TEXTURE_MAX_ANISOTROPY_EXT: number; + readonly TEXTURE_MAX_ANISOTROPY_EXT: number; } interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelector, ChildNode { - classList: DOMTokenList; - clientHeight: number; - clientLeft: number; - clientTop: number; - clientWidth: number; + readonly classList: DOMTokenList; + className: string; + readonly clientHeight: number; + readonly clientLeft: number; + readonly clientTop: number; + readonly clientWidth: number; + id: string; msContentZoomFactor: number; - msRegionOverflow: string; + readonly msRegionOverflow: string; onariarequest: (ev: AriaRequestEvent) => any; oncommand: (ev: CommandEvent) => any; ongotpointercapture: (ev: PointerEvent) => any; @@ -8122,58 +9052,58 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec ontouchstart: (ev: TouchEvent) => any; onwebkitfullscreenchange: (ev: Event) => any; onwebkitfullscreenerror: (ev: Event) => any; - scrollHeight: number; + readonly prefix: string | null; + readonly scrollHeight: number; scrollLeft: number; scrollTop: number; - scrollWidth: number; - tagName: string; - id: string; - className: string; - getAttribute(name?: string): string; + readonly scrollWidth: number; + readonly tagName: string; + innerHTML: string; + getAttribute(name?: string): string | null; getAttributeNS(namespaceURI: string, localName: string): string; getAttributeNode(name: string): Attr; getAttributeNodeNS(namespaceURI: string, localName: string): Attr; getBoundingClientRect(): ClientRect; getClientRects(): ClientRectList; getElementsByTagName(name: "a"): NodeListOf; - getElementsByTagName(name: "abbr"): NodeListOf; - getElementsByTagName(name: "acronym"): NodeListOf; - getElementsByTagName(name: "address"): NodeListOf; + getElementsByTagName(name: "abbr"): NodeListOf; + getElementsByTagName(name: "acronym"): NodeListOf; + getElementsByTagName(name: "address"): NodeListOf; getElementsByTagName(name: "applet"): NodeListOf; getElementsByTagName(name: "area"): NodeListOf; getElementsByTagName(name: "article"): NodeListOf; getElementsByTagName(name: "aside"): NodeListOf; getElementsByTagName(name: "audio"): NodeListOf; - getElementsByTagName(name: "b"): NodeListOf; + getElementsByTagName(name: "b"): NodeListOf; getElementsByTagName(name: "base"): NodeListOf; getElementsByTagName(name: "basefont"): NodeListOf; - getElementsByTagName(name: "bdo"): NodeListOf; - getElementsByTagName(name: "big"): NodeListOf; - getElementsByTagName(name: "blockquote"): NodeListOf; + getElementsByTagName(name: "bdo"): NodeListOf; + getElementsByTagName(name: "big"): NodeListOf; + getElementsByTagName(name: "blockquote"): NodeListOf; getElementsByTagName(name: "body"): NodeListOf; getElementsByTagName(name: "br"): NodeListOf; getElementsByTagName(name: "button"): NodeListOf; getElementsByTagName(name: "canvas"): NodeListOf; getElementsByTagName(name: "caption"): NodeListOf; - getElementsByTagName(name: "center"): NodeListOf; + getElementsByTagName(name: "center"): NodeListOf; getElementsByTagName(name: "circle"): NodeListOf; - getElementsByTagName(name: "cite"): NodeListOf; + getElementsByTagName(name: "cite"): NodeListOf; getElementsByTagName(name: "clippath"): NodeListOf; - getElementsByTagName(name: "code"): NodeListOf; + getElementsByTagName(name: "code"): NodeListOf; getElementsByTagName(name: "col"): NodeListOf; getElementsByTagName(name: "colgroup"): NodeListOf; getElementsByTagName(name: "datalist"): NodeListOf; - getElementsByTagName(name: "dd"): NodeListOf; + getElementsByTagName(name: "dd"): NodeListOf; getElementsByTagName(name: "defs"): NodeListOf; getElementsByTagName(name: "del"): NodeListOf; getElementsByTagName(name: "desc"): NodeListOf; - getElementsByTagName(name: "dfn"): NodeListOf; + getElementsByTagName(name: "dfn"): NodeListOf; getElementsByTagName(name: "dir"): NodeListOf; getElementsByTagName(name: "div"): NodeListOf; getElementsByTagName(name: "dl"): NodeListOf; - getElementsByTagName(name: "dt"): NodeListOf; + getElementsByTagName(name: "dt"): NodeListOf; getElementsByTagName(name: "ellipse"): NodeListOf; - getElementsByTagName(name: "em"): NodeListOf; + getElementsByTagName(name: "em"): NodeListOf; getElementsByTagName(name: "embed"): NodeListOf; getElementsByTagName(name: "feblend"): NodeListOf; getElementsByTagName(name: "fecolormatrix"): NodeListOf; @@ -8221,22 +9151,22 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec getElementsByTagName(name: "hgroup"): NodeListOf; getElementsByTagName(name: "hr"): NodeListOf; getElementsByTagName(name: "html"): NodeListOf; - getElementsByTagName(name: "i"): NodeListOf; + getElementsByTagName(name: "i"): NodeListOf; getElementsByTagName(name: "iframe"): NodeListOf; getElementsByTagName(name: "image"): NodeListOf; getElementsByTagName(name: "img"): NodeListOf; getElementsByTagName(name: "input"): NodeListOf; getElementsByTagName(name: "ins"): NodeListOf; - getElementsByTagName(name: "isindex"): NodeListOf; - getElementsByTagName(name: "kbd"): NodeListOf; - getElementsByTagName(name: "keygen"): NodeListOf; + getElementsByTagName(name: "isindex"): NodeListOf; + getElementsByTagName(name: "kbd"): NodeListOf; + getElementsByTagName(name: "keygen"): NodeListOf; getElementsByTagName(name: "label"): NodeListOf; getElementsByTagName(name: "legend"): NodeListOf; getElementsByTagName(name: "li"): NodeListOf; getElementsByTagName(name: "line"): NodeListOf; getElementsByTagName(name: "lineargradient"): NodeListOf; getElementsByTagName(name: "link"): NodeListOf; - getElementsByTagName(name: "listing"): NodeListOf; + getElementsByTagName(name: "listing"): NodeListOf; getElementsByTagName(name: "map"): NodeListOf; getElementsByTagName(name: "mark"): NodeListOf; getElementsByTagName(name: "marker"): NodeListOf; @@ -8245,9 +9175,10 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec getElementsByTagName(name: "menu"): NodeListOf; getElementsByTagName(name: "meta"): NodeListOf; getElementsByTagName(name: "metadata"): NodeListOf; + getElementsByTagName(name: "meter"): NodeListOf; getElementsByTagName(name: "nav"): NodeListOf; - getElementsByTagName(name: "nextid"): NodeListOf; - getElementsByTagName(name: "nobr"): NodeListOf; + getElementsByTagName(name: "nextid"): NodeListOf; + getElementsByTagName(name: "nobr"): NodeListOf; getElementsByTagName(name: "noframes"): NodeListOf; getElementsByTagName(name: "noscript"): NodeListOf; getElementsByTagName(name: "object"): NodeListOf; @@ -8258,7 +9189,8 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec getElementsByTagName(name: "param"): NodeListOf; getElementsByTagName(name: "path"): NodeListOf; getElementsByTagName(name: "pattern"): NodeListOf; - getElementsByTagName(name: "plaintext"): NodeListOf; + getElementsByTagName(name: "picture"): NodeListOf; + getElementsByTagName(name: "plaintext"): NodeListOf; getElementsByTagName(name: "polygon"): NodeListOf; getElementsByTagName(name: "polyline"): NodeListOf; getElementsByTagName(name: "pre"): NodeListOf; @@ -8266,28 +9198,29 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec getElementsByTagName(name: "q"): NodeListOf; getElementsByTagName(name: "radialgradient"): NodeListOf; getElementsByTagName(name: "rect"): NodeListOf; - getElementsByTagName(name: "rt"): NodeListOf; - getElementsByTagName(name: "ruby"): NodeListOf; - getElementsByTagName(name: "s"): NodeListOf; - getElementsByTagName(name: "samp"): NodeListOf; + getElementsByTagName(name: "rt"): NodeListOf; + getElementsByTagName(name: "ruby"): NodeListOf; + getElementsByTagName(name: "s"): NodeListOf; + getElementsByTagName(name: "samp"): NodeListOf; getElementsByTagName(name: "script"): NodeListOf; getElementsByTagName(name: "section"): NodeListOf; getElementsByTagName(name: "select"): NodeListOf; - getElementsByTagName(name: "small"): NodeListOf; + getElementsByTagName(name: "small"): NodeListOf; getElementsByTagName(name: "source"): NodeListOf; getElementsByTagName(name: "span"): NodeListOf; getElementsByTagName(name: "stop"): NodeListOf; - getElementsByTagName(name: "strike"): NodeListOf; - getElementsByTagName(name: "strong"): NodeListOf; + getElementsByTagName(name: "strike"): NodeListOf; + getElementsByTagName(name: "strong"): NodeListOf; getElementsByTagName(name: "style"): NodeListOf; - getElementsByTagName(name: "sub"): NodeListOf; - getElementsByTagName(name: "sup"): NodeListOf; + getElementsByTagName(name: "sub"): NodeListOf; + getElementsByTagName(name: "sup"): NodeListOf; getElementsByTagName(name: "svg"): NodeListOf; getElementsByTagName(name: "switch"): NodeListOf; getElementsByTagName(name: "symbol"): NodeListOf; getElementsByTagName(name: "table"): NodeListOf; getElementsByTagName(name: "tbody"): NodeListOf; getElementsByTagName(name: "td"): NodeListOf; + getElementsByTagName(name: "template"): NodeListOf; getElementsByTagName(name: "text"): NodeListOf; getElementsByTagName(name: "textpath"): NodeListOf; getElementsByTagName(name: "textarea"): NodeListOf; @@ -8298,18 +9231,20 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec getElementsByTagName(name: "tr"): NodeListOf; getElementsByTagName(name: "track"): NodeListOf; getElementsByTagName(name: "tspan"): NodeListOf; - getElementsByTagName(name: "tt"): NodeListOf; - getElementsByTagName(name: "u"): NodeListOf; + getElementsByTagName(name: "tt"): NodeListOf; + getElementsByTagName(name: "u"): NodeListOf; getElementsByTagName(name: "ul"): NodeListOf; getElementsByTagName(name: "use"): NodeListOf; - getElementsByTagName(name: "var"): NodeListOf; + getElementsByTagName(name: "var"): NodeListOf; getElementsByTagName(name: "video"): NodeListOf; getElementsByTagName(name: "view"): NodeListOf; getElementsByTagName(name: "wbr"): NodeListOf; getElementsByTagName(name: "x-ms-webview"): NodeListOf; - getElementsByTagName(name: "xmp"): NodeListOf; + getElementsByTagName(name: "xmp"): NodeListOf; getElementsByTagName(name: string): NodeListOf; - getElementsByTagNameNS(namespaceURI: string, localName: string): NodeListOf; + getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf; + getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf; + getElementsByTagNameNS(namespaceURI: string, localName: string): HTMLCollectionOf; hasAttribute(name: string): boolean; hasAttributeNS(namespaceURI: string, localName: string): boolean; msGetRegionContent(): MSRangeCollection; @@ -8324,7 +9259,7 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec removeAttributeNode(oldAttr: Attr): Attr; requestFullscreen(): void; requestPointerLock(): void; - setAttribute(name?: string, value?: string): void; + setAttribute(name: string, value: string): void; setAttributeNS(namespaceURI: string, qualifiedName: string, value: string): void; setAttributeNode(newAttr: Attr): Attr; setAttributeNodeNS(newAttr: Attr): Attr; @@ -8333,6 +9268,7 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec webkitRequestFullScreen(): void; webkitRequestFullscreen(): void; getElementsByClassName(classNames: string): NodeListOf; + matches(selector: string): boolean; addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; addEventListener(type: "MSGestureEnd", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; @@ -8378,11 +9314,11 @@ declare var Element: { } interface ErrorEvent extends Event { - colno: number; - error: any; - filename: string; - lineno: number; - message: string; + readonly colno: number; + readonly error: any; + readonly filename: string; + readonly lineno: number; + readonly message: string; initErrorEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, messageArg: string, filenameArg: string, linenoArg: number): void; } @@ -8392,39 +9328,39 @@ declare var ErrorEvent: { } interface Event { - bubbles: boolean; + readonly bubbles: boolean; cancelBubble: boolean; - cancelable: boolean; - currentTarget: EventTarget; - defaultPrevented: boolean; - eventPhase: number; - isTrusted: boolean; + readonly cancelable: boolean; + readonly currentTarget: EventTarget; + readonly defaultPrevented: boolean; + readonly eventPhase: number; + readonly isTrusted: boolean; returnValue: boolean; - srcElement: Element; - target: EventTarget; - timeStamp: number; - type: string; + readonly srcElement: Element | null; + readonly target: EventTarget; + readonly timeStamp: number; + readonly type: string; initEvent(eventTypeArg: string, canBubbleArg: boolean, cancelableArg: boolean): void; preventDefault(): void; stopImmediatePropagation(): void; stopPropagation(): void; - AT_TARGET: number; - BUBBLING_PHASE: number; - CAPTURING_PHASE: number; + readonly AT_TARGET: number; + readonly BUBBLING_PHASE: number; + readonly CAPTURING_PHASE: number; } declare var Event: { prototype: Event; new(type: string, eventInitDict?: EventInit): Event; - AT_TARGET: number; - BUBBLING_PHASE: number; - CAPTURING_PHASE: number; + readonly AT_TARGET: number; + readonly BUBBLING_PHASE: number; + readonly CAPTURING_PHASE: number; } interface EventTarget { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + addEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; dispatchEvent(evt: Event): boolean; - removeEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var EventTarget: { @@ -8441,8 +9377,9 @@ declare var External: { } interface File extends Blob { - lastModifiedDate: any; - name: string; + readonly lastModifiedDate: any; + readonly name: string; + readonly webkitRelativePath: string; } declare var File: { @@ -8451,7 +9388,7 @@ declare var File: { } interface FileList { - length: number; + readonly length: number; item(index: number): File; [index: number]: File; } @@ -8462,7 +9399,7 @@ declare var FileList: { } interface FileReader extends EventTarget, MSBaseReader { - error: DOMError; + readonly error: DOMError; readAsArrayBuffer(blob: Blob): void; readAsBinaryString(blob: Blob): void; readAsDataURL(blob: Blob): void; @@ -8476,7 +9413,7 @@ declare var FileReader: { } interface FocusEvent extends UIEvent { - relatedTarget: EventTarget; + readonly relatedTarget: EventTarget; initFocusEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, relatedTargetArg: EventTarget): void; } @@ -8495,7 +9432,7 @@ declare var FormData: { } interface GainNode extends AudioNode { - gain: AudioParam; + readonly gain: AudioParam; } declare var GainNode: { @@ -8504,13 +9441,13 @@ declare var GainNode: { } interface Gamepad { - axes: number[]; - buttons: GamepadButton[]; - connected: boolean; - id: string; - index: number; - mapping: string; - timestamp: number; + readonly axes: number[]; + readonly buttons: GamepadButton[]; + readonly connected: boolean; + readonly id: string; + readonly index: number; + readonly mapping: string; + readonly timestamp: number; } declare var Gamepad: { @@ -8519,8 +9456,8 @@ declare var Gamepad: { } interface GamepadButton { - pressed: boolean; - value: number; + readonly pressed: boolean; + readonly value: number; } declare var GamepadButton: { @@ -8529,7 +9466,7 @@ declare var GamepadButton: { } interface GamepadEvent extends Event { - gamepad: Gamepad; + readonly gamepad: Gamepad; } declare var GamepadEvent: { @@ -8567,6 +9504,7 @@ interface HTMLAnchorElement extends HTMLElement { * Sets or retrieves the coordinates of the object. */ coords: string; + download: string; /** * Contains the anchor portion of the URL including the hash sign (#). */ @@ -8587,12 +9525,12 @@ interface HTMLAnchorElement extends HTMLElement { * Sets or retrieves the language code of the object. */ hreflang: string; - mimeType: string; + readonly mimeType: string; /** * Sets or retrieves the shape of the object. */ name: string; - nameProp: string; + readonly nameProp: string; /** * Contains the pathname of the URL. */ @@ -8605,7 +9543,7 @@ interface HTMLAnchorElement extends HTMLElement { * Contains the protocol of the URL. */ protocol: string; - protocolLong: string; + readonly protocolLong: string; /** * Sets or retrieves the relationship between the object and the destination of the link. */ @@ -8647,7 +9585,7 @@ interface HTMLAppletElement extends HTMLElement { /** * Retrieves a string of the URL where the object tag can be found. This is often the href of the document that the object is in, or the value set by a base element. */ - BaseHref: string; + readonly BaseHref: string; align: string; /** * Sets or retrieves a text alternative to the graphic. @@ -8674,7 +9612,7 @@ interface HTMLAppletElement extends HTMLElement { /** * Address of a pointer to the document this page or frame contains. If there is no document, then null will be returned. */ - contentDocument: Document; + readonly contentDocument: Document; /** * Sets or retrieves the URL that references the data of the object. */ @@ -8683,7 +9621,7 @@ interface HTMLAppletElement extends HTMLElement { * Sets or retrieves a character string that can be used to implement your own declare functionality for the object. */ declare: boolean; - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * Sets or retrieves the height of the object. */ @@ -8693,7 +9631,7 @@ interface HTMLAppletElement extends HTMLElement { * Sets or retrieves the shape of the object. */ name: string; - object: string; + object: string | null; /** * Sets or retrieves a message to be displayed while an object is loading. */ @@ -8724,6 +9662,7 @@ interface HTMLAreaElement extends HTMLElement { * Sets or retrieves the coordinates of the object. */ coords: string; + download: string; /** * Sets or retrieves the subsection of the href property that follows the number sign (#). */ @@ -8849,23 +9788,6 @@ declare var HTMLBaseFontElement: { new(): HTMLBaseFontElement; } -interface HTMLBlockElement extends HTMLElement { - /** - * Sets or retrieves reference information about the object. - */ - cite: string; - clear: string; - /** - * Sets or retrieves the width of the object. - */ - width: number; -} - -declare var HTMLBlockElement: { - prototype: HTMLBlockElement; - new(): HTMLBlockElement; -} - interface HTMLBodyElement extends HTMLElement { aLink: any; background: string; @@ -8893,7 +9815,6 @@ interface HTMLBodyElement extends HTMLElement { onunload: (ev: Event) => any; text: any; vLink: any; - createTextRange(): TextRange; addEventListener(type: "MSContentZoom", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; @@ -8918,10 +9839,10 @@ interface HTMLBodyElement extends HTMLElement { addEventListener(type: "afterprint", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "ariarequest", listener: (ev: AriaRequestEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforeprint", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "beforeunload", listener: (ev: BeforeUnloadEvent) => any, useCapture?: boolean): void; addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; @@ -8932,9 +9853,9 @@ interface HTMLBodyElement extends HTMLElement { addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "command", listener: (ev: CommandEvent) => any, useCapture?: boolean): void; addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; @@ -8946,7 +9867,7 @@ interface HTMLBodyElement extends HTMLElement { addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; @@ -8954,6 +9875,7 @@ interface HTMLBodyElement extends HTMLElement { addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; addEventListener(type: "hashchange", listener: (ev: HashChangeEvent) => any, useCapture?: boolean): void; addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -8971,13 +9893,13 @@ interface HTMLBodyElement extends HTMLElement { addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; addEventListener(type: "offline", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "online", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "orientationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "pagehide", listener: (ev: PageTransitionEvent) => any, useCapture?: boolean): void; addEventListener(type: "pageshow", listener: (ev: PageTransitionEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -9031,7 +9953,7 @@ interface HTMLButtonElement extends HTMLElement { /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * Overrides the action attribute (where the data on a form is sent) on the parent form element. */ @@ -9064,11 +9986,11 @@ interface HTMLButtonElement extends HTMLElement { /** * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. */ - validationMessage: string; + readonly validationMessage: string; /** * Returns a ValidityState object that represents the validity states of an element. */ - validity: ValidityState; + readonly validity: ValidityState; /** * Sets or retrieves the default or selected value of the control. */ @@ -9076,15 +9998,11 @@ interface HTMLButtonElement extends HTMLElement { /** * Returns whether an element will successfully validate based on forms validation rules and constraints. */ - willValidate: boolean; + readonly willValidate: boolean; /** * Returns whether a form will validate when it is submitted, without having to submit it. */ checkValidity(): boolean; - /** - * Creates a TextRange object for the element. - */ - createTextRange(): TextRange; /** * Sets a custom error message that is displayed when a form is submitted. * @param error Sets a custom error message that is displayed when a form is submitted. @@ -9122,6 +10040,7 @@ interface HTMLCanvasElement extends HTMLElement { * @param type The standard MIME type for the image format to return. If you do not specify this parameter, the default value is a PNG format image. */ toDataURL(type?: string, ...args: any[]): string; + toBlob(): Blob; } declare var HTMLCanvasElement: { @@ -9133,11 +10052,11 @@ interface HTMLCollection { /** * Sets or retrieves the number of objects in a collection. */ - length: number; + readonly length: number; /** * Retrieves an object from various collections. */ - item(nameOrIndex?: any, optionalIndex?: any): Element; + item(index: number): Element; /** * Retrieves a select object or an object from an options collection. */ @@ -9150,18 +10069,6 @@ declare var HTMLCollection: { new(): HTMLCollection; } -interface HTMLDDElement extends HTMLElement { - /** - * Sets or retrieves whether the browser automatically performs wordwrap. - */ - noWrap: boolean; -} - -declare var HTMLDDElement: { - prototype: HTMLDDElement; - new(): HTMLDDElement; -} - interface HTMLDListElement extends HTMLElement { compact: boolean; } @@ -9171,20 +10078,8 @@ declare var HTMLDListElement: { new(): HTMLDListElement; } -interface HTMLDTElement extends HTMLElement { - /** - * Sets or retrieves whether the browser automatically performs wordwrap. - */ - noWrap: boolean; -} - -declare var HTMLDTElement: { - prototype: HTMLDTElement; - new(): HTMLDTElement; -} - interface HTMLDataListElement extends HTMLElement { - options: HTMLCollection; + options: HTMLCollectionOf; } declare var HTMLDataListElement: { @@ -9227,38 +10122,38 @@ declare var HTMLDocument: { interface HTMLElement extends Element { accessKey: string; - children: HTMLCollection; + readonly children: HTMLCollection; contentEditable: string; - dataset: DOMStringMap; + readonly dataset: DOMStringMap; dir: string; draggable: boolean; hidden: boolean; hideFocus: boolean; innerHTML: string; innerText: string; - isContentEditable: boolean; + readonly isContentEditable: boolean; lang: string; - offsetHeight: number; - offsetLeft: number; - offsetParent: Element; - offsetTop: number; - offsetWidth: number; + readonly offsetHeight: number; + readonly offsetLeft: number; + readonly offsetParent: Element; + readonly offsetTop: number; + readonly offsetWidth: number; onabort: (ev: Event) => any; onactivate: (ev: UIEvent) => any; onbeforeactivate: (ev: UIEvent) => any; - onbeforecopy: (ev: DragEvent) => any; - onbeforecut: (ev: DragEvent) => any; + onbeforecopy: (ev: ClipboardEvent) => any; + onbeforecut: (ev: ClipboardEvent) => any; onbeforedeactivate: (ev: UIEvent) => any; - onbeforepaste: (ev: DragEvent) => any; + onbeforepaste: (ev: ClipboardEvent) => any; onblur: (ev: FocusEvent) => any; oncanplay: (ev: Event) => any; oncanplaythrough: (ev: Event) => any; onchange: (ev: Event) => any; onclick: (ev: MouseEvent) => any; oncontextmenu: (ev: PointerEvent) => any; - oncopy: (ev: DragEvent) => any; + oncopy: (ev: ClipboardEvent) => any; oncuechange: (ev: Event) => any; - oncut: (ev: DragEvent) => any; + oncut: (ev: ClipboardEvent) => any; ondblclick: (ev: MouseEvent) => any; ondeactivate: (ev: UIEvent) => any; ondrag: (ev: DragEvent) => any; @@ -9270,10 +10165,11 @@ interface HTMLElement extends Element { ondrop: (ev: DragEvent) => any; ondurationchange: (ev: Event) => any; onemptied: (ev: Event) => any; - onended: (ev: Event) => any; + onended: (ev: MediaStreamErrorEvent) => any; onerror: (ev: Event) => any; onfocus: (ev: FocusEvent) => any; oninput: (ev: Event) => any; + oninvalid: (ev: Event) => any; onkeydown: (ev: KeyboardEvent) => any; onkeypress: (ev: KeyboardEvent) => any; onkeyup: (ev: KeyboardEvent) => any; @@ -9288,10 +10184,10 @@ interface HTMLElement extends Element { onmouseout: (ev: MouseEvent) => any; onmouseover: (ev: MouseEvent) => any; onmouseup: (ev: MouseEvent) => any; - onmousewheel: (ev: MouseWheelEvent) => any; + onmousewheel: (ev: WheelEvent) => any; onmscontentzoom: (ev: UIEvent) => any; onmsmanipulationstatechanged: (ev: MSManipulationEvent) => any; - onpaste: (ev: DragEvent) => any; + onpaste: (ev: ClipboardEvent) => any; onpause: (ev: Event) => any; onplay: (ev: Event) => any; onplaying: (ev: Event) => any; @@ -9312,12 +10208,11 @@ interface HTMLElement extends Element { outerHTML: string; outerText: string; spellcheck: boolean; - style: CSSStyleDeclaration; + readonly style: CSSStyleDeclaration; tabIndex: number; title: string; blur(): void; click(): void; - contains(child: HTMLElement): boolean; dragDrop(): boolean; focus(): void; insertAdjacentElement(position: string, insertedElement: Element): Element; @@ -9349,10 +10244,10 @@ interface HTMLElement extends Element { addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "ariarequest", listener: (ev: AriaRequestEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -9360,9 +10255,9 @@ interface HTMLElement extends Element { addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "command", listener: (ev: CommandEvent) => any, useCapture?: boolean): void; addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; @@ -9374,11 +10269,12 @@ interface HTMLElement extends Element { addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -9394,8 +10290,8 @@ interface HTMLElement extends Element { addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -9457,7 +10353,7 @@ interface HTMLEmbedElement extends HTMLElement, GetSVGDocument { /** * Gets the source associated with the media element for use by the PlayToManager. */ - msPlayToSource: any; + readonly msPlayToSource: any; /** * Sets or retrieves the name of the object. */ @@ -9465,12 +10361,12 @@ interface HTMLEmbedElement extends HTMLElement, GetSVGDocument { /** * Retrieves the palette used for the embedded document. */ - palette: string; + readonly palette: string; /** * Retrieves the URL of the plug-in used to view an embedded document. */ - pluginspage: string; - readyState: string; + readonly pluginspage: string; + readonly readyState: string; /** * Sets or retrieves a URL to be loaded by the object. */ @@ -9500,19 +10396,19 @@ interface HTMLFieldSetElement extends HTMLElement { /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. */ - validationMessage: string; + readonly validationMessage: string; /** * Returns a ValidityState object that represents the validity states of an element. */ - validity: ValidityState; + readonly validity: ValidityState; /** * Returns whether an element will successfully validate based on forms validation rules and constraints. */ - willValidate: boolean; + readonly willValidate: boolean; /** * Returns whether a form will validate when it is submitted, without having to submit it. */ @@ -9558,7 +10454,7 @@ interface HTMLFormElement extends HTMLElement { /** * Retrieves a collection, in source order, of all controls in a given form. */ - elements: HTMLCollection; + readonly elements: HTMLCollection; /** * Sets or retrieves the MIME encoding for the form. */ @@ -9570,7 +10466,7 @@ interface HTMLFormElement extends HTMLElement { /** * Sets or retrieves the number of objects in a collection. */ - length: number; + readonly length: number; /** * Sets or retrieves how to send the form data to the server. */ @@ -9629,11 +10525,11 @@ interface HTMLFrameElement extends HTMLElement, GetSVGDocument { /** * Retrieves the document object of the page or frame. */ - contentDocument: Document; + readonly contentDocument: Document; /** * Retrieves the object of the specified. */ - contentWindow: Window; + readonly contentWindow: Window; /** * Sets or retrieves whether to display a border for the frame. */ @@ -9674,10 +10570,6 @@ interface HTMLFrameElement extends HTMLElement, GetSVGDocument { * Sets or retrieves whether the frame can be scrolled. */ scrolling: string; - /** - * Sets the value indicating whether the source file of a frame or iframe has specific security restrictions applied. - */ - security: any; /** * Sets or retrieves a URL to be loaded by the object. */ @@ -9709,10 +10601,10 @@ interface HTMLFrameElement extends HTMLElement, GetSVGDocument { addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "ariarequest", listener: (ev: AriaRequestEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -9720,9 +10612,9 @@ interface HTMLFrameElement extends HTMLElement, GetSVGDocument { addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "command", listener: (ev: CommandEvent) => any, useCapture?: boolean): void; addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; @@ -9734,11 +10626,12 @@ interface HTMLFrameElement extends HTMLElement, GetSVGDocument { addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -9755,8 +10648,8 @@ interface HTMLFrameElement extends HTMLElement, GetSVGDocument { addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -9866,10 +10759,10 @@ interface HTMLFrameSetElement extends HTMLElement { addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "ariarequest", listener: (ev: AriaRequestEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforeprint", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "beforeunload", listener: (ev: BeforeUnloadEvent) => any, useCapture?: boolean): void; addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; @@ -9880,9 +10773,9 @@ interface HTMLFrameSetElement extends HTMLElement { addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "command", listener: (ev: CommandEvent) => any, useCapture?: boolean): void; addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; @@ -9894,7 +10787,7 @@ interface HTMLFrameSetElement extends HTMLElement { addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; @@ -9902,6 +10795,7 @@ interface HTMLFrameSetElement extends HTMLElement { addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; addEventListener(type: "hashchange", listener: (ev: HashChangeEvent) => any, useCapture?: boolean): void; addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -9919,13 +10813,13 @@ interface HTMLFrameSetElement extends HTMLElement { addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; addEventListener(type: "offline", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "online", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "orientationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "pagehide", listener: (ev: PageTransitionEvent) => any, useCapture?: boolean): void; addEventListener(type: "pageshow", listener: (ev: PageTransitionEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -10004,7 +10898,6 @@ interface HTMLHeadingElement extends HTMLElement { * Sets or retrieves a value that indicates the table alignment. */ align: string; - clear: string; } declare var HTMLHeadingElement: { @@ -10037,11 +10930,11 @@ interface HTMLIFrameElement extends HTMLElement, GetSVGDocument { /** * Retrieves the document object of the page or frame. */ - contentDocument: Document; + readonly contentDocument: Document; /** * Retrieves the object of the specified. */ - contentWindow: Window; + readonly contentWindow: Window; /** * Sets or retrieves whether to display a border for the frame. */ @@ -10082,15 +10975,11 @@ interface HTMLIFrameElement extends HTMLElement, GetSVGDocument { * Raised when the object has been completely received from the server. */ onload: (ev: Event) => any; - sandbox: DOMSettableTokenList; + readonly sandbox: DOMSettableTokenList; /** * Sets or retrieves whether the frame can be scrolled. */ scrolling: string; - /** - * Sets the value indicating whether the source file of a frame or iframe has specific security restrictions applied. - */ - security: any; /** * Sets or retrieves a URL to be loaded by the object. */ @@ -10126,10 +11015,10 @@ interface HTMLIFrameElement extends HTMLElement, GetSVGDocument { addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "ariarequest", listener: (ev: AriaRequestEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -10137,9 +11026,9 @@ interface HTMLIFrameElement extends HTMLElement, GetSVGDocument { addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "command", listener: (ev: CommandEvent) => any, useCapture?: boolean): void; addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; @@ -10151,11 +11040,12 @@ interface HTMLIFrameElement extends HTMLElement, GetSVGDocument { addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -10172,8 +11062,8 @@ interface HTMLIFrameElement extends HTMLElement, GetSVGDocument { addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -10230,9 +11120,9 @@ interface HTMLImageElement extends HTMLElement { /** * Retrieves whether the object is fully loaded. */ - complete: boolean; + readonly complete: boolean; crossOrigin: string; - currentSrc: string; + readonly currentSrc: string; /** * Sets or retrieves the height of the object. */ @@ -10249,6 +11139,7 @@ interface HTMLImageElement extends HTMLElement { * Sets or retrieves a Uniform Resource Identifier (URI) to a long description of the object. */ longDesc: string; + lowsrc: string; /** * Gets or sets whether the DLNA PlayTo device is available. */ @@ -10261,7 +11152,7 @@ interface HTMLImageElement extends HTMLElement { /** * Gets the source associated with the media element for use by the PlayToManager. */ - msPlayToSource: any; + readonly msPlayToSource: any; /** * Sets or retrieves the name of the object. */ @@ -10269,11 +11160,12 @@ interface HTMLImageElement extends HTMLElement { /** * The original height of the image resource before sizing. */ - naturalHeight: number; + readonly naturalHeight: number; /** * The original width of the image resource before sizing. */ - naturalWidth: number; + readonly naturalWidth: number; + sizes: string; /** * The address or URL of the a media resource that is to be considered. */ @@ -10291,8 +11183,8 @@ interface HTMLImageElement extends HTMLElement { * Sets or retrieves the width of the object. */ width: number; - x: number; - y: number; + readonly x: number; + readonly y: number; msGetAsCastingSource(): any; } @@ -10334,7 +11226,7 @@ interface HTMLInputElement extends HTMLElement { /** * Retrieves whether the object is fully loaded. */ - complete: boolean; + readonly complete: boolean; /** * Sets or retrieves the state of the check box or radio button. */ @@ -10347,11 +11239,11 @@ interface HTMLInputElement extends HTMLElement { /** * Returns a FileList object on a file type input object. */ - files: FileList; + readonly files: FileList; /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * Overrides the action attribute (where the data on a form is sent) on the parent form element. */ @@ -10384,7 +11276,7 @@ interface HTMLInputElement extends HTMLElement { /** * Specifies the ID of a pre-defined datalist of options for an input element. */ - list: HTMLElement; + readonly list: HTMLElement; /** * Defines the maximum acceptable value for an input element with type="number".When used with the min and step attributes, lets you control the range and increment (such as only even numbers) that the user can enter into an input field. */ @@ -10418,6 +11310,7 @@ interface HTMLInputElement extends HTMLElement { * When present, marks an element that can't be submitted without a value. */ required: boolean; + selectionDirection: string; /** * Gets or sets the end position or offset of a text selection. */ @@ -10447,11 +11340,11 @@ interface HTMLInputElement extends HTMLElement { /** * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. */ - validationMessage: string; + readonly validationMessage: string; /** * Returns a ValidityState object that represents the validity states of an element. */ - validity: ValidityState; + readonly validity: ValidityState; /** * Returns the value of the data at the cursor's current position. */ @@ -10465,6 +11358,7 @@ interface HTMLInputElement extends HTMLElement { * Sets or retrieves the vertical margin for the object. */ vspace: number; + webkitdirectory: boolean; /** * Sets or retrieves the width of the object. */ @@ -10472,15 +11366,12 @@ interface HTMLInputElement extends HTMLElement { /** * Returns whether an element will successfully validate based on forms validation rules and constraints. */ - willValidate: boolean; + readonly willValidate: boolean; + minLength: number; /** * Returns whether a form will validate when it is submitted, without having to submit it. */ checkValidity(): boolean; - /** - * Creates a TextRange object for the element. - */ - createTextRange(): TextRange; /** * Makes the selection equal to the current object. */ @@ -10495,7 +11386,7 @@ interface HTMLInputElement extends HTMLElement { * @param start The offset into the text field for the start of the selection. * @param end The offset into the text field for the end of the selection. */ - setSelectionRange(start: number, end: number): void; + setSelectionRange(start?: number, end?: number, direction?: string): void; /** * Decrements a range input control's value by the value given by the Step attribute. If the optional parameter is used, it will decrement the input control's step value multiplied by the parameter's value. * @param n Value to decrement the value by. @@ -10513,23 +11404,6 @@ declare var HTMLInputElement: { new(): HTMLInputElement; } -interface HTMLIsIndexElement extends HTMLElement { - /** - * Sets or retrieves the URL to which the form content is sent for processing. - */ - action: string; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - form: HTMLFormElement; - prompt: string; -} - -declare var HTMLIsIndexElement: { - prototype: HTMLIsIndexElement; - new(): HTMLIsIndexElement; -} - interface HTMLLIElement extends HTMLElement { type: string; /** @@ -10547,7 +11421,7 @@ interface HTMLLabelElement extends HTMLElement { /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * Sets or retrieves the object to which the given label object is assigned. */ @@ -10567,7 +11441,7 @@ interface HTMLLegendElement extends HTMLElement { /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; } declare var HTMLLegendElement: { @@ -10609,6 +11483,7 @@ interface HTMLLinkElement extends HTMLElement, LinkStyle { * Sets or retrieves the MIME type of the object. */ type: string; + import?: Document; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -10621,7 +11496,7 @@ interface HTMLMapElement extends HTMLElement { /** * Retrieves a collection of the area objects defined for the given map object. */ - areas: HTMLAreasCollection; + readonly areas: HTMLAreasCollection; /** * Sets or retrieves the name of the object. */ @@ -10673,10 +11548,10 @@ interface HTMLMarqueeElement extends HTMLElement { addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "ariarequest", listener: (ev: AriaRequestEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "bounce", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -10685,9 +11560,9 @@ interface HTMLMarqueeElement extends HTMLElement { addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "command", listener: (ev: CommandEvent) => any, useCapture?: boolean): void; addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; @@ -10699,12 +11574,13 @@ interface HTMLMarqueeElement extends HTMLElement { addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "finish", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -10720,8 +11596,8 @@ interface HTMLMarqueeElement extends HTMLElement { addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -10767,7 +11643,7 @@ interface HTMLMediaElement extends HTMLElement { /** * Returns an AudioTrackList object with the audio tracks for a given video element. */ - audioTracks: AudioTrackList; + readonly audioTracks: AudioTrackList; /** * Gets or sets a value that indicates whether to start playing the media automatically. */ @@ -10775,15 +11651,16 @@ interface HTMLMediaElement extends HTMLElement { /** * Gets a collection of buffered time ranges. */ - buffered: TimeRanges; + readonly buffered: TimeRanges; /** * Gets or sets a flag that indicates whether the client provides a set of controls for the media (in case the developer does not include controls for the player). */ controls: boolean; + crossOrigin: string; /** * Gets the address or URL of the current media resource that is selected by IHTMLMediaElement. */ - currentSrc: string; + readonly currentSrc: string; /** * Gets or sets the current playback position, in seconds. */ @@ -10796,19 +11673,20 @@ interface HTMLMediaElement extends HTMLElement { /** * Returns the duration in seconds of the current media resource. A NaN value is returned if duration is not available, or Infinity if the media resource is streaming. */ - duration: number; + readonly duration: number; /** * Gets information about whether the playback has ended or not. */ - ended: boolean; + readonly ended: boolean; /** * Returns an object representing the current error state of the audio or video element. */ - error: MediaError; + readonly error: MediaError; /** * Gets or sets a flag to specify whether playback should restart after it completes. */ loop: boolean; + readonly mediaKeys: MediaKeys | null; /** * Specifies the purpose of the audio or video media, such as background audio or alerts. */ @@ -10817,11 +11695,11 @@ interface HTMLMediaElement extends HTMLElement { * Specifies the output device id that the audio will be sent to. */ msAudioDeviceType: string; - msGraphicsTrustStatus: MSGraphicsTrust; + readonly msGraphicsTrustStatus: MSGraphicsTrust; /** * Gets the MSMediaKeys object, which is used for decrypting media data, that is associated with this media element. */ - msKeys: MSMediaKeys; + readonly msKeys: MSMediaKeys; /** * Gets or sets whether the DLNA PlayTo device is available. */ @@ -10837,7 +11715,7 @@ interface HTMLMediaElement extends HTMLElement { /** * Gets the source associated with the media element for use by the PlayToManager. */ - msPlayToSource: any; + readonly msPlayToSource: any; /** * Specifies whether or not to enable low-latency playback on the media element. */ @@ -10849,12 +11727,13 @@ interface HTMLMediaElement extends HTMLElement { /** * Gets the current network activity for the element. */ - networkState: number; + readonly networkState: number; + onencrypted: (ev: MediaEncryptedEvent) => any; onmsneedkey: (ev: MSMediaKeyNeededEvent) => any; /** * Gets a flag that specifies whether playback is paused. */ - paused: boolean; + readonly paused: boolean; /** * Gets or sets the current rate of speed for the media resource to play. This speed is expressed as a multiple of the normal speed of the media resource. */ @@ -10862,26 +11741,27 @@ interface HTMLMediaElement extends HTMLElement { /** * Gets TimeRanges for the current media resource that has been played. */ - played: TimeRanges; + readonly played: TimeRanges; /** * Gets or sets the current playback position, in seconds. */ preload: string; - readyState: any; + readyState: number; /** * Returns a TimeRanges object that represents the ranges of the current media resource that can be seeked. */ - seekable: TimeRanges; + readonly seekable: TimeRanges; /** * Gets a flag that indicates whether the the client is currently moving to a new playback position in the media resource. */ - seeking: boolean; + readonly seeking: boolean; /** * The address or URL of the a media resource that is to be considered. */ src: string; - textTracks: TextTrackList; - videoTracks: VideoTrackList; + srcObject: MediaStream | null; + readonly textTracks: TextTrackList; + readonly videoTracks: VideoTrackList; /** * Gets or sets the volume level for audio portions of the media element. */ @@ -10917,15 +11797,16 @@ interface HTMLMediaElement extends HTMLElement { * Loads and starts playback of a media resource. */ play(): void; - HAVE_CURRENT_DATA: number; - HAVE_ENOUGH_DATA: number; - HAVE_FUTURE_DATA: number; - HAVE_METADATA: number; - HAVE_NOTHING: number; - NETWORK_EMPTY: number; - NETWORK_IDLE: number; - NETWORK_LOADING: number; - NETWORK_NO_SOURCE: number; + setMediaKeys(mediaKeys: MediaKeys | null): PromiseLike; + readonly HAVE_CURRENT_DATA: number; + readonly HAVE_ENOUGH_DATA: number; + readonly HAVE_FUTURE_DATA: number; + readonly HAVE_METADATA: number; + readonly HAVE_NOTHING: number; + readonly NETWORK_EMPTY: number; + readonly NETWORK_IDLE: number; + readonly NETWORK_LOADING: number; + readonly NETWORK_NO_SOURCE: number; addEventListener(type: "MSContentZoom", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; @@ -10949,10 +11830,10 @@ interface HTMLMediaElement extends HTMLElement { addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "ariarequest", listener: (ev: AriaRequestEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -10960,9 +11841,9 @@ interface HTMLMediaElement extends HTMLElement { addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "command", listener: (ev: CommandEvent) => any, useCapture?: boolean): void; addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; @@ -10974,11 +11855,13 @@ interface HTMLMediaElement extends HTMLElement { addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "encrypted", listener: (ev: MediaEncryptedEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -10994,9 +11877,9 @@ interface HTMLMediaElement extends HTMLElement { addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; addEventListener(type: "msneedkey", listener: (ev: MSMediaKeyNeededEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -11035,15 +11918,15 @@ interface HTMLMediaElement extends HTMLElement { declare var HTMLMediaElement: { prototype: HTMLMediaElement; new(): HTMLMediaElement; - HAVE_CURRENT_DATA: number; - HAVE_ENOUGH_DATA: number; - HAVE_FUTURE_DATA: number; - HAVE_METADATA: number; - HAVE_NOTHING: number; - NETWORK_EMPTY: number; - NETWORK_IDLE: number; - NETWORK_LOADING: number; - NETWORK_NO_SOURCE: number; + readonly HAVE_CURRENT_DATA: number; + readonly HAVE_ENOUGH_DATA: number; + readonly HAVE_FUTURE_DATA: number; + readonly HAVE_METADATA: number; + readonly HAVE_NOTHING: number; + readonly NETWORK_EMPTY: number; + readonly NETWORK_IDLE: number; + readonly NETWORK_LOADING: number; + readonly NETWORK_NO_SOURCE: number; } interface HTMLMenuElement extends HTMLElement { @@ -11088,6 +11971,20 @@ declare var HTMLMetaElement: { new(): HTMLMetaElement; } +interface HTMLMeterElement extends HTMLElement { + high: number; + low: number; + max: number; + min: number; + optimum: number; + value: number; +} + +declare var HTMLMeterElement: { + prototype: HTMLMeterElement; + new(): HTMLMeterElement; +} + interface HTMLModElement extends HTMLElement { /** * Sets or retrieves reference information about the object. @@ -11104,15 +12001,6 @@ declare var HTMLModElement: { new(): HTMLModElement; } -interface HTMLNextIdElement extends HTMLElement { - n: string; -} - -declare var HTMLNextIdElement: { - prototype: HTMLNextIdElement; - new(): HTMLNextIdElement; -} - interface HTMLOListElement extends HTMLElement { compact: boolean; /** @@ -11131,7 +12019,7 @@ interface HTMLObjectElement extends HTMLElement, GetSVGDocument { /** * Retrieves a string of the URL where the object tag can be found. This is often the href of the document that the object is in, or the value set by a base element. */ - BaseHref: string; + readonly BaseHref: string; align: string; /** * Sets or retrieves a text alternative to the graphic. @@ -11161,7 +12049,7 @@ interface HTMLObjectElement extends HTMLElement, GetSVGDocument { /** * Retrieves the document object of the page or frame. */ - contentDocument: Document; + readonly contentDocument: Document; /** * Sets or retrieves the URL that references the data of the object. */ @@ -11170,7 +12058,7 @@ interface HTMLObjectElement extends HTMLElement, GetSVGDocument { /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * Sets or retrieves the height of the object. */ @@ -11191,7 +12079,7 @@ interface HTMLObjectElement extends HTMLElement, GetSVGDocument { /** * Gets the source associated with the media element for use by the PlayToManager. */ - msPlayToSource: any; + readonly msPlayToSource: any; /** * Sets or retrieves the name of the object. */ @@ -11199,8 +12087,8 @@ interface HTMLObjectElement extends HTMLElement, GetSVGDocument { /** * Retrieves the contained object. */ - object: any; - readyState: number; + readonly object: any; + readonly readyState: number; /** * Sets or retrieves a message to be displayed while an object is loading. */ @@ -11216,11 +12104,11 @@ interface HTMLObjectElement extends HTMLElement, GetSVGDocument { /** * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. */ - validationMessage: string; + readonly validationMessage: string; /** * Returns a ValidityState object that represents the validity states of an element. */ - validity: ValidityState; + readonly validity: ValidityState; vspace: number; /** * Sets or retrieves the width of the object. @@ -11229,7 +12117,7 @@ interface HTMLObjectElement extends HTMLElement, GetSVGDocument { /** * Returns whether an element will successfully validate based on forms validation rules and constraints. */ - willValidate: boolean; + readonly willValidate: boolean; /** * Returns whether a form will validate when it is submitted, without having to submit it. */ @@ -11256,11 +12144,11 @@ interface HTMLOptGroupElement extends HTMLElement { /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * Sets or retrieves the ordinal position of an option in a list box. */ - index: number; + readonly index: number; /** * Sets or retrieves a value that you can use to implement your own label functionality for the object. */ @@ -11272,7 +12160,7 @@ interface HTMLOptGroupElement extends HTMLElement { /** * Sets or retrieves the text string specified by the option tag. */ - text: string; + readonly text: string; /** * Sets or retrieves the value which is returned to the server when the form control is submitted. */ @@ -11293,11 +12181,11 @@ interface HTMLOptionElement extends HTMLElement { /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * Sets or retrieves the ordinal position of an option in a list box. */ - index: number; + readonly index: number; /** * Sets or retrieves a value that you can use to implement your own label functionality for the object. */ @@ -11322,6 +12210,18 @@ declare var HTMLOptionElement: { create(): HTMLOptionElement; } +interface HTMLOptionsCollection extends HTMLCollection { + length: number; + selectedIndex: number; + add(element: HTMLOptionElement | HTMLOptGroupElement, before?: HTMLElement | number): void; + remove(index: number): void; +} + +declare var HTMLOptionsCollection: { + prototype: HTMLOptionsCollection; + new(): HTMLOptionsCollection; +} + interface HTMLParagraphElement extends HTMLElement { /** * Sets or retrieves how the object is aligned with adjacent text. @@ -11359,28 +12259,15 @@ declare var HTMLParamElement: { new(): HTMLParamElement; } -interface HTMLPhraseElement extends HTMLElement { - /** - * Sets or retrieves reference information about the object. - */ - cite: string; - /** - * Sets or retrieves the date and time of a modification to the object. - */ - dateTime: string; +interface HTMLPictureElement extends HTMLElement { } -declare var HTMLPhraseElement: { - prototype: HTMLPhraseElement; - new(): HTMLPhraseElement; +declare var HTMLPictureElement: { + prototype: HTMLPictureElement; + new(): HTMLPictureElement; } interface HTMLPreElement extends HTMLElement { - /** - * Indicates a citation by rendering text in italic type. - */ - cite: string; - clear: string; /** * Sets or gets a value that you can use to implement your own width functionality for the object. */ @@ -11396,7 +12283,7 @@ interface HTMLProgressElement extends HTMLElement { /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * Defines the maximum, or "done" value for a progress element. */ @@ -11404,7 +12291,7 @@ interface HTMLProgressElement extends HTMLElement { /** * Returns the quotient of value/max when the value attribute is set (determinate progress bar), or -1 when the value attribute is missing (indeterminate progress bar). */ - position: number; + readonly position: number; /** * Sets or gets the current value of a progress element. The value must be a non-negative number between 0 and the max value. */ @@ -11421,10 +12308,6 @@ interface HTMLQuoteElement extends HTMLElement { * Sets or retrieves reference information about the object. */ cite: string; - /** - * Sets or retrieves the date and time of a modification to the object. - */ - dateTime: string; } declare var HTMLQuoteElement: { @@ -11478,7 +12361,7 @@ interface HTMLSelectElement extends HTMLElement { /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * Sets or retrieves the number of objects in a collection. */ @@ -11491,7 +12374,7 @@ interface HTMLSelectElement extends HTMLElement { * Sets or retrieves the name of the object. */ name: string; - options: HTMLSelectElement; + options: HTMLCollectionOf; /** * When present, marks an element that can't be submitted without a value. */ @@ -11500,6 +12383,7 @@ interface HTMLSelectElement extends HTMLElement { * Sets or retrieves the index of the selected option in a select object. */ selectedIndex: number; + selectedOptions: HTMLCollectionOf; /** * Sets or retrieves the number of rows in the list box. */ @@ -11507,15 +12391,15 @@ interface HTMLSelectElement extends HTMLElement { /** * Retrieves the type of select control based on the value of the MULTIPLE attribute. */ - type: string; + readonly type: string; /** * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. */ - validationMessage: string; + readonly validationMessage: string; /** * Returns a ValidityState object that represents the validity states of an element. */ - validity: ValidityState; + readonly validity: ValidityState; /** * Sets or retrieves the value which is returned to the server when the form control is submitted. */ @@ -11523,7 +12407,7 @@ interface HTMLSelectElement extends HTMLElement { /** * Returns whether an element will successfully validate based on forms validation rules and constraints. */ - willValidate: boolean; + readonly willValidate: boolean; /** * Adds an element to the areas, controlRange, or options collection. * @param element Variant of type Number that specifies the index position in the collection where the element is placed. If no value is given, the method places the element at the end of the collection. @@ -11569,10 +12453,12 @@ interface HTMLSourceElement extends HTMLElement { */ media: string; msKeySystem: string; + sizes: string; /** * The address or URL of the a media resource that is to be considered. */ src: string; + srcset: string; /** * Gets or sets the MIME type of a media resource. */ @@ -11593,6 +12479,7 @@ declare var HTMLSpanElement: { } interface HTMLStyleElement extends HTMLElement, LinkStyle { + disabled: boolean; /** * Sets or retrieves the media type. */ @@ -11642,7 +12529,7 @@ interface HTMLTableCellElement extends HTMLElement, HTMLTableAlignment { /** * Retrieves the position of the object in the cells collection of a row. */ - cellIndex: number; + readonly cellIndex: number; /** * Sets or retrieves the number columns in the table that the object should span. */ @@ -11749,7 +12636,7 @@ interface HTMLTableElement extends HTMLElement { /** * Sets or retrieves the number of horizontal rows contained in the object. */ - rows: HTMLCollection; + rows: HTMLCollectionOf; /** * Sets or retrieves which dividing lines (inner borders) are displayed. */ @@ -11761,7 +12648,7 @@ interface HTMLTableElement extends HTMLElement { /** * Retrieves a collection of all tBody objects in the table. Objects in this collection are in source order. */ - tBodies: HTMLCollection; + tBodies: HTMLCollectionOf; /** * Retrieves the tFoot object of the table. */ @@ -11777,19 +12664,19 @@ interface HTMLTableElement extends HTMLElement { /** * Creates an empty caption element in the table. */ - createCaption(): HTMLElement; + createCaption(): HTMLTableCaptionElement; /** * Creates an empty tBody element in the table. */ - createTBody(): HTMLElement; + createTBody(): HTMLTableSectionElement; /** * Creates an empty tFoot element in the table. */ - createTFoot(): HTMLElement; + createTFoot(): HTMLTableSectionElement; /** * Returns the tHead element object if successful, or null otherwise. */ - createTHead(): HTMLElement; + createTHead(): HTMLTableSectionElement; /** * Deletes the caption element and its contents from the table. */ @@ -11811,7 +12698,7 @@ interface HTMLTableElement extends HTMLElement { * Creates a new row (tr) in the table, and adds the row to the rows collection. * @param index Number that specifies where to insert the row in the rows collection. The default value is -1, which appends the new row to the end of the rows collection. */ - insertRow(index?: number): HTMLElement; + insertRow(index?: number): HTMLTableRowElement; } declare var HTMLTableElement: { @@ -11840,7 +12727,7 @@ interface HTMLTableRowElement extends HTMLElement, HTMLTableAlignment { /** * Retrieves a collection of all cells in the table row. */ - cells: HTMLCollection; + cells: HTMLCollectionOf; /** * Sets or retrieves the height of the object. */ @@ -11848,11 +12735,11 @@ interface HTMLTableRowElement extends HTMLElement, HTMLTableAlignment { /** * Retrieves the position of the object in the rows collection for the table. */ - rowIndex: number; + readonly rowIndex: number; /** * Retrieves the position of the object in the collection. */ - sectionRowIndex: number; + readonly sectionRowIndex: number; /** * Removes the specified cell from the table row, as well as from the cells collection. * @param index Number that specifies the zero-based position of the cell to remove from the table row. If no value is provided, the last cell in the cells collection is deleted. @@ -11862,7 +12749,7 @@ interface HTMLTableRowElement extends HTMLElement, HTMLTableAlignment { * Creates a new cell in the table row, and adds the cell to the cells collection. * @param index Number that specifies where to insert the cell in the tr. The default value is -1, which appends the new cell to the end of the cells collection. */ - insertCell(index?: number): HTMLElement; + insertCell(index?: number): HTMLTableDataCellElement; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -11879,7 +12766,7 @@ interface HTMLTableSectionElement extends HTMLElement, HTMLTableAlignment { /** * Sets or retrieves the number of horizontal rows contained in the object. */ - rows: HTMLCollection; + rows: HTMLCollectionOf; /** * Removes the specified row (tr) from the element and from the rows collection. * @param index Number that specifies the zero-based position in the rows collection of the row to remove. @@ -11889,7 +12776,7 @@ interface HTMLTableSectionElement extends HTMLElement, HTMLTableAlignment { * Creates a new row (tr) in the table, and adds the row to the rows collection. * @param index Number that specifies where to insert the row in the rows collection. The default value is -1, which appends the new row to the end of the rows collection. */ - insertRow(index?: number): HTMLElement; + insertRow(index?: number): HTMLTableRowElement; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -11898,6 +12785,15 @@ declare var HTMLTableSectionElement: { new(): HTMLTableSectionElement; } +interface HTMLTemplateElement extends HTMLElement { + readonly content: DocumentFragment; +} + +declare var HTMLTemplateElement: { + prototype: HTMLTemplateElement; + new(): HTMLTemplateElement; +} + interface HTMLTextAreaElement extends HTMLElement { /** * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing. @@ -11915,7 +12811,7 @@ interface HTMLTextAreaElement extends HTMLElement { /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * Sets or retrieves the maximum number of characters that the user can enter in a text control. */ @@ -11955,15 +12851,15 @@ interface HTMLTextAreaElement extends HTMLElement { /** * Retrieves the type of control. */ - type: string; + readonly type: string; /** * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. */ - validationMessage: string; + readonly validationMessage: string; /** * Returns a ValidityState object that represents the validity states of an element. */ - validity: ValidityState; + readonly validity: ValidityState; /** * Retrieves or sets the text in the entry field of the textArea element. */ @@ -11971,19 +12867,16 @@ interface HTMLTextAreaElement extends HTMLElement { /** * Returns whether an element will successfully validate based on forms validation rules and constraints. */ - willValidate: boolean; + readonly willValidate: boolean; /** * Sets or retrieves how to handle wordwrapping in the object. */ wrap: string; + minLength: number; /** * Returns whether a form will validate when it is submitted, without having to submit it. */ checkValidity(): boolean; - /** - * Creates a TextRange object for the element. - */ - createTextRange(): TextRange; /** * Highlights the input area of a form element. */ @@ -12022,23 +12915,23 @@ interface HTMLTrackElement extends HTMLElement { default: boolean; kind: string; label: string; - readyState: number; + readonly readyState: number; src: string; srclang: string; - track: TextTrack; - ERROR: number; - LOADED: number; - LOADING: number; - NONE: number; + readonly track: TextTrack; + readonly ERROR: number; + readonly LOADED: number; + readonly LOADING: number; + readonly NONE: number; } declare var HTMLTrackElement: { prototype: HTMLTrackElement; new(): HTMLTrackElement; - ERROR: number; - LOADED: number; - LOADING: number; - NONE: number; + readonly ERROR: number; + readonly LOADED: number; + readonly LOADING: number; + readonly NONE: number; } interface HTMLUListElement extends HTMLElement { @@ -12065,8 +12958,8 @@ interface HTMLVideoElement extends HTMLMediaElement { */ height: number; msHorizontalMirror: boolean; - msIsLayoutOptimalForPlayback: boolean; - msIsStereo3D: boolean; + readonly msIsLayoutOptimalForPlayback: boolean; + readonly msIsStereo3D: boolean; msStereo3DPackingMode: string; msStereo3DRenderMode: string; msZoom: boolean; @@ -12080,13 +12973,13 @@ interface HTMLVideoElement extends HTMLMediaElement { /** * Gets the intrinsic height of a video in CSS pixels, or zero if the dimensions are not known. */ - videoHeight: number; + readonly videoHeight: number; /** * Gets the intrinsic width of a video in CSS pixels, or zero if the dimensions are not known. */ - videoWidth: number; - webkitDisplayingFullscreen: boolean; - webkitSupportsFullscreen: boolean; + readonly videoWidth: number; + readonly webkitDisplayingFullscreen: boolean; + readonly webkitSupportsFullscreen: boolean; /** * Gets or sets the width of the video element. */ @@ -12125,10 +13018,10 @@ interface HTMLVideoElement extends HTMLMediaElement { addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "ariarequest", listener: (ev: AriaRequestEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -12136,9 +13029,9 @@ interface HTMLVideoElement extends HTMLMediaElement { addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "command", listener: (ev: CommandEvent) => any, useCapture?: boolean): void; addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; @@ -12150,11 +13043,13 @@ interface HTMLVideoElement extends HTMLMediaElement { addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "encrypted", listener: (ev: MediaEncryptedEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -12170,9 +13065,9 @@ interface HTMLVideoElement extends HTMLMediaElement { addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; addEventListener(type: "msneedkey", listener: (ev: MSMediaKeyNeededEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -12214,8 +13109,8 @@ declare var HTMLVideoElement: { } interface HashChangeEvent extends Event { - newURL: string; - oldURL: string; + readonly newURL: string | null; + readonly oldURL: string | null; } declare var HashChangeEvent: { @@ -12224,8 +13119,8 @@ declare var HashChangeEvent: { } interface History { - length: number; - state: any; + readonly length: number; + readonly state: any; back(distance?: any): void; forward(distance?: any): void; go(delta?: any): void; @@ -12239,31 +13134,31 @@ declare var History: { } interface IDBCursor { - direction: string; - key: any; - primaryKey: any; - source: any; + readonly direction: string; + key: IDBKeyRange | IDBValidKey; + readonly primaryKey: any; + source: IDBObjectStore | IDBIndex; advance(count: number): void; - continue(key?: any): void; + continue(key?: IDBKeyRange | IDBValidKey): void; delete(): IDBRequest; update(value: any): IDBRequest; - NEXT: string; - NEXT_NO_DUPLICATE: string; - PREV: string; - PREV_NO_DUPLICATE: string; + readonly NEXT: string; + readonly NEXT_NO_DUPLICATE: string; + readonly PREV: string; + readonly PREV_NO_DUPLICATE: string; } declare var IDBCursor: { prototype: IDBCursor; new(): IDBCursor; - NEXT: string; - NEXT_NO_DUPLICATE: string; - PREV: string; - PREV_NO_DUPLICATE: string; + readonly NEXT: string; + readonly NEXT_NO_DUPLICATE: string; + readonly PREV: string; + readonly PREV_NO_DUPLICATE: string; } interface IDBCursorWithValue extends IDBCursor { - value: any; + readonly value: any; } declare var IDBCursorWithValue: { @@ -12272,15 +13167,17 @@ declare var IDBCursorWithValue: { } interface IDBDatabase extends EventTarget { - name: string; - objectStoreNames: DOMStringList; + readonly name: string; + readonly objectStoreNames: DOMStringList; onabort: (ev: Event) => any; onerror: (ev: Event) => any; - version: string; + version: number; + onversionchange: (ev: IDBVersionChangeEvent) => any; close(): void; - createObjectStore(name: string, optionalParameters?: any): IDBObjectStore; + createObjectStore(name: string, optionalParameters?: IDBObjectStoreParameters): IDBObjectStore; deleteObjectStore(name: string): void; - transaction(storeNames: any, mode?: string): IDBTransaction; + transaction(storeNames: string | string[], mode?: string): IDBTransaction; + addEventListener(type: "versionchange", listener: (ev: IDBVersionChangeEvent) => any, useCapture?: boolean): void; addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; @@ -12303,15 +13200,16 @@ declare var IDBFactory: { } interface IDBIndex { - keyPath: string; - name: string; - objectStore: IDBObjectStore; - unique: boolean; - count(key?: any): IDBRequest; - get(key: any): IDBRequest; - getKey(key: any): IDBRequest; - openCursor(range?: IDBKeyRange, direction?: string): IDBRequest; - openKeyCursor(range?: IDBKeyRange, direction?: string): IDBRequest; + keyPath: string | string[]; + readonly name: string; + readonly objectStore: IDBObjectStore; + readonly unique: boolean; + multiEntry: boolean; + count(key?: IDBKeyRange | IDBValidKey): IDBRequest; + get(key: IDBKeyRange | IDBValidKey): IDBRequest; + getKey(key: IDBKeyRange | IDBValidKey): IDBRequest; + openCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; + openKeyCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; } declare var IDBIndex: { @@ -12320,36 +13218,37 @@ declare var IDBIndex: { } interface IDBKeyRange { - lower: any; - lowerOpen: boolean; - upper: any; - upperOpen: boolean; + readonly lower: any; + readonly lowerOpen: boolean; + readonly upper: any; + readonly upperOpen: boolean; } declare var IDBKeyRange: { prototype: IDBKeyRange; new(): IDBKeyRange; bound(lower: any, upper: any, lowerOpen?: boolean, upperOpen?: boolean): IDBKeyRange; - lowerBound(bound: any, open?: boolean): IDBKeyRange; + lowerBound(lower: any, open?: boolean): IDBKeyRange; only(value: any): IDBKeyRange; - upperBound(bound: any, open?: boolean): IDBKeyRange; + upperBound(upper: any, open?: boolean): IDBKeyRange; } interface IDBObjectStore { - indexNames: DOMStringList; - keyPath: string; - name: string; - transaction: IDBTransaction; - add(value: any, key?: any): IDBRequest; + readonly indexNames: DOMStringList; + keyPath: string | string[]; + readonly name: string; + readonly transaction: IDBTransaction; + autoIncrement: boolean; + add(value: any, key?: IDBKeyRange | IDBValidKey): IDBRequest; clear(): IDBRequest; - count(key?: any): IDBRequest; - createIndex(name: string, keyPath: string, optionalParameters?: any): IDBIndex; - delete(key: any): IDBRequest; + count(key?: IDBKeyRange | IDBValidKey): IDBRequest; + createIndex(name: string, keyPath: string | string[], optionalParameters?: IDBIndexParameters): IDBIndex; + delete(key: IDBKeyRange | IDBValidKey): IDBRequest; deleteIndex(indexName: string): void; get(key: any): IDBRequest; index(name: string): IDBIndex; - openCursor(range?: any, direction?: string): IDBRequest; - put(value: any, key?: any): IDBRequest; + openCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; + put(value: any, key?: IDBKeyRange | IDBValidKey): IDBRequest; } declare var IDBObjectStore: { @@ -12373,13 +13272,13 @@ declare var IDBOpenDBRequest: { } interface IDBRequest extends EventTarget { - error: DOMError; + readonly error: DOMError; onerror: (ev: Event) => any; onsuccess: (ev: Event) => any; - readyState: string; - result: any; - source: any; - transaction: IDBTransaction; + readonly readyState: string; + readonly result: any; + source: IDBObjectStore | IDBIndex | IDBCursor; + readonly transaction: IDBTransaction; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "success", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; @@ -12391,17 +13290,17 @@ declare var IDBRequest: { } interface IDBTransaction extends EventTarget { - db: IDBDatabase; - error: DOMError; - mode: string; + readonly db: IDBDatabase; + readonly error: DOMError; + readonly mode: string; onabort: (ev: Event) => any; oncomplete: (ev: Event) => any; onerror: (ev: Event) => any; abort(): void; objectStore(name: string): IDBObjectStore; - READ_ONLY: string; - READ_WRITE: string; - VERSION_CHANGE: string; + readonly READ_ONLY: string; + readonly READ_WRITE: string; + readonly VERSION_CHANGE: string; addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "complete", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; @@ -12411,14 +13310,14 @@ interface IDBTransaction extends EventTarget { declare var IDBTransaction: { prototype: IDBTransaction; new(): IDBTransaction; - READ_ONLY: string; - READ_WRITE: string; - VERSION_CHANGE: string; + readonly READ_ONLY: string; + readonly READ_WRITE: string; + readonly VERSION_CHANGE: string; } interface IDBVersionChangeEvent extends Event { - newVersion: number; - oldVersion: number; + readonly newVersion: number | null; + readonly oldVersion: number; } declare var IDBVersionChangeEvent: { @@ -12427,9 +13326,9 @@ declare var IDBVersionChangeEvent: { } interface ImageData { - data: number[]; - height: number; - width: number; + data: Uint8ClampedArray; + readonly height: number; + readonly width: number; } declare var ImageData: { @@ -12439,37 +13338,47 @@ declare var ImageData: { } interface KeyboardEvent extends UIEvent { - altKey: boolean; - char: string; - charCode: number; - ctrlKey: boolean; - key: string; - keyCode: number; - locale: string; - location: number; - metaKey: boolean; - repeat: boolean; - shiftKey: boolean; - which: number; + readonly altKey: boolean; + readonly char: string | null; + readonly charCode: number; + readonly ctrlKey: boolean; + readonly key: string; + readonly keyCode: number; + readonly locale: string; + readonly location: number; + readonly metaKey: boolean; + readonly repeat: boolean; + readonly shiftKey: boolean; + readonly which: number; getModifierState(keyArg: string): boolean; initKeyboardEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, keyArg: string, locationArg: number, modifiersListArg: string, repeat: boolean, locale: string): void; - DOM_KEY_LOCATION_JOYSTICK: number; - DOM_KEY_LOCATION_LEFT: number; - DOM_KEY_LOCATION_MOBILE: number; - DOM_KEY_LOCATION_NUMPAD: number; - DOM_KEY_LOCATION_RIGHT: number; - DOM_KEY_LOCATION_STANDARD: number; + readonly DOM_KEY_LOCATION_JOYSTICK: number; + readonly DOM_KEY_LOCATION_LEFT: number; + readonly DOM_KEY_LOCATION_MOBILE: number; + readonly DOM_KEY_LOCATION_NUMPAD: number; + readonly DOM_KEY_LOCATION_RIGHT: number; + readonly DOM_KEY_LOCATION_STANDARD: number; } declare var KeyboardEvent: { prototype: KeyboardEvent; new(typeArg: string, eventInitDict?: KeyboardEventInit): KeyboardEvent; - DOM_KEY_LOCATION_JOYSTICK: number; - DOM_KEY_LOCATION_LEFT: number; - DOM_KEY_LOCATION_MOBILE: number; - DOM_KEY_LOCATION_NUMPAD: number; - DOM_KEY_LOCATION_RIGHT: number; - DOM_KEY_LOCATION_STANDARD: number; + readonly DOM_KEY_LOCATION_JOYSTICK: number; + readonly DOM_KEY_LOCATION_LEFT: number; + readonly DOM_KEY_LOCATION_MOBILE: number; + readonly DOM_KEY_LOCATION_NUMPAD: number; + readonly DOM_KEY_LOCATION_RIGHT: number; + readonly DOM_KEY_LOCATION_STANDARD: number; +} + +interface ListeningStateChangedEvent extends Event { + readonly label: string; + readonly state: string; +} + +declare var ListeningStateChangedEvent: { + prototype: ListeningStateChangedEvent; + new(): ListeningStateChangedEvent; } interface Location { @@ -12477,7 +13386,7 @@ interface Location { host: string; hostname: string; href: string; - origin: string; + readonly origin: string; pathname: string; port: string; protocol: string; @@ -12494,7 +13403,7 @@ declare var Location: { } interface LongRunningScriptDetectedEvent extends Event { - executionTime: number; + readonly executionTime: number; stopPageScriptExecution: boolean; } @@ -12513,29 +13422,29 @@ interface MSApp { execAsyncAtPriority(asynchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): void; execAtPriority(synchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): any; getCurrentPriority(): string; - getHtmlPrintDocumentSourceAsync(htmlDoc: any): any; + getHtmlPrintDocumentSourceAsync(htmlDoc: any): PromiseLike; getViewId(view: any): any; isTaskScheduledAtPriorityOrHigher(priority: string): boolean; pageHandlesAllApplicationActivations(enabled: boolean): void; suppressSubdownloadCredentialPrompts(suppress: boolean): void; terminateApp(exceptionObject: any): void; - CURRENT: string; - HIGH: string; - IDLE: string; - NORMAL: string; + readonly CURRENT: string; + readonly HIGH: string; + readonly IDLE: string; + readonly NORMAL: string; } declare var MSApp: MSApp; interface MSAppAsyncOperation extends EventTarget { - error: DOMError; + readonly error: DOMError; oncomplete: (ev: Event) => any; onerror: (ev: Event) => any; - readyState: number; - result: any; + readonly readyState: number; + readonly result: any; start(): void; - COMPLETED: number; - ERROR: number; - STARTED: number; + readonly COMPLETED: number; + readonly ERROR: number; + readonly STARTED: number; addEventListener(type: "complete", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; @@ -12544,9 +13453,19 @@ interface MSAppAsyncOperation extends EventTarget { declare var MSAppAsyncOperation: { prototype: MSAppAsyncOperation; new(): MSAppAsyncOperation; - COMPLETED: number; - ERROR: number; - STARTED: number; + readonly COMPLETED: number; + readonly ERROR: number; + readonly STARTED: number; +} + +interface MSAssertion { + readonly id: string; + readonly type: string; +} + +declare var MSAssertion: { + prototype: MSAssertion; + new(): MSAssertion; } interface MSBlobBuilder { @@ -12559,44 +13478,46 @@ declare var MSBlobBuilder: { new(): MSBlobBuilder; } -interface MSCSSMatrix { - a: number; - b: number; - c: number; - d: number; - e: number; - f: number; - m11: number; - m12: number; - m13: number; - m14: number; - m21: number; - m22: number; - m23: number; - m24: number; - m31: number; - m32: number; - m33: number; - m34: number; - m41: number; - m42: number; - m43: number; - m44: number; - inverse(): MSCSSMatrix; - multiply(secondMatrix: MSCSSMatrix): MSCSSMatrix; - rotate(angleX: number, angleY?: number, angleZ?: number): MSCSSMatrix; - rotateAxisAngle(x: number, y: number, z: number, angle: number): MSCSSMatrix; - scale(scaleX: number, scaleY?: number, scaleZ?: number): MSCSSMatrix; - setMatrixValue(value: string): void; - skewX(angle: number): MSCSSMatrix; - skewY(angle: number): MSCSSMatrix; - toString(): string; - translate(x: number, y: number, z?: number): MSCSSMatrix; +interface MSCredentials { + getAssertion(challenge: string, filter?: MSCredentialFilter, params?: MSSignatureParameters): PromiseLike; + makeCredential(accountInfo: MSAccountInfo, params: MSCredentialParameters[], challenge?: string): PromiseLike; } -declare var MSCSSMatrix: { - prototype: MSCSSMatrix; - new(text?: string): MSCSSMatrix; +declare var MSCredentials: { + prototype: MSCredentials; + new(): MSCredentials; +} + +interface MSFIDOCredentialAssertion extends MSAssertion { + readonly algorithm: string | Algorithm; + readonly attestation: any; + readonly publicKey: string; + readonly transportHints: string[]; +} + +declare var MSFIDOCredentialAssertion: { + prototype: MSFIDOCredentialAssertion; + new(): MSFIDOCredentialAssertion; +} + +interface MSFIDOSignature { + readonly authnrData: string; + readonly clientData: string; + readonly signature: string; +} + +declare var MSFIDOSignature: { + prototype: MSFIDOSignature; + new(): MSFIDOSignature; +} + +interface MSFIDOSignatureAssertion extends MSAssertion { + readonly signature: MSFIDOSignature; +} + +declare var MSFIDOSignatureAssertion: { + prototype: MSFIDOSignatureAssertion; + new(): MSFIDOSignatureAssertion; } interface MSGesture { @@ -12611,44 +13532,44 @@ declare var MSGesture: { } interface MSGestureEvent extends UIEvent { - clientX: number; - clientY: number; - expansion: number; - gestureObject: any; - hwTimestamp: number; - offsetX: number; - offsetY: number; - rotation: number; - scale: number; - screenX: number; - screenY: number; - translationX: number; - translationY: number; - velocityAngular: number; - velocityExpansion: number; - velocityX: number; - velocityY: number; + readonly clientX: number; + readonly clientY: number; + readonly expansion: number; + readonly gestureObject: any; + readonly hwTimestamp: number; + readonly offsetX: number; + readonly offsetY: number; + readonly rotation: number; + readonly scale: number; + readonly screenX: number; + readonly screenY: number; + readonly translationX: number; + readonly translationY: number; + readonly velocityAngular: number; + readonly velocityExpansion: number; + readonly velocityX: number; + readonly velocityY: number; initGestureEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, offsetXArg: number, offsetYArg: number, translationXArg: number, translationYArg: number, scaleArg: number, expansionArg: number, rotationArg: number, velocityXArg: number, velocityYArg: number, velocityExpansionArg: number, velocityAngularArg: number, hwTimestampArg: number): void; - MSGESTURE_FLAG_BEGIN: number; - MSGESTURE_FLAG_CANCEL: number; - MSGESTURE_FLAG_END: number; - MSGESTURE_FLAG_INERTIA: number; - MSGESTURE_FLAG_NONE: number; + readonly MSGESTURE_FLAG_BEGIN: number; + readonly MSGESTURE_FLAG_CANCEL: number; + readonly MSGESTURE_FLAG_END: number; + readonly MSGESTURE_FLAG_INERTIA: number; + readonly MSGESTURE_FLAG_NONE: number; } declare var MSGestureEvent: { prototype: MSGestureEvent; new(): MSGestureEvent; - MSGESTURE_FLAG_BEGIN: number; - MSGESTURE_FLAG_CANCEL: number; - MSGESTURE_FLAG_END: number; - MSGESTURE_FLAG_INERTIA: number; - MSGESTURE_FLAG_NONE: number; + readonly MSGESTURE_FLAG_BEGIN: number; + readonly MSGESTURE_FLAG_CANCEL: number; + readonly MSGESTURE_FLAG_END: number; + readonly MSGESTURE_FLAG_INERTIA: number; + readonly MSGESTURE_FLAG_NONE: number; } interface MSGraphicsTrust { - constrictionActive: boolean; - status: string; + readonly constrictionActive: boolean; + readonly status: string; } declare var MSGraphicsTrust: { @@ -12657,12 +13578,12 @@ declare var MSGraphicsTrust: { } interface MSHTMLWebViewElement extends HTMLElement { - canGoBack: boolean; - canGoForward: boolean; - containsFullScreenElement: boolean; - documentTitle: string; + readonly canGoBack: boolean; + readonly canGoForward: boolean; + readonly containsFullScreenElement: boolean; + readonly documentTitle: string; height: number; - settings: MSWebViewSettings; + readonly settings: MSWebViewSettings; src: string; width: number; addWebAllowedObject(name: string, applicationObject: any): void; @@ -12688,12 +13609,12 @@ declare var MSHTMLWebViewElement: { } interface MSInputMethodContext extends EventTarget { - compositionEndOffset: number; - compositionStartOffset: number; + readonly compositionEndOffset: number; + readonly compositionStartOffset: number; oncandidatewindowhide: (ev: Event) => any; oncandidatewindowshow: (ev: Event) => any; oncandidatewindowupdate: (ev: Event) => any; - target: HTMLElement; + readonly target: HTMLElement; getCandidateWindowClientRect(): ClientRect; getCompositionAlternatives(): string[]; hasComposition(): boolean; @@ -12710,59 +13631,59 @@ declare var MSInputMethodContext: { } interface MSManipulationEvent extends UIEvent { - currentState: number; - inertiaDestinationX: number; - inertiaDestinationY: number; - lastState: number; + readonly currentState: number; + readonly inertiaDestinationX: number; + readonly inertiaDestinationY: number; + readonly lastState: number; initMSManipulationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, lastState: number, currentState: number): void; - MS_MANIPULATION_STATE_ACTIVE: number; - MS_MANIPULATION_STATE_CANCELLED: number; - MS_MANIPULATION_STATE_COMMITTED: number; - MS_MANIPULATION_STATE_DRAGGING: number; - MS_MANIPULATION_STATE_INERTIA: number; - MS_MANIPULATION_STATE_PRESELECT: number; - MS_MANIPULATION_STATE_SELECTING: number; - MS_MANIPULATION_STATE_STOPPED: number; + readonly MS_MANIPULATION_STATE_ACTIVE: number; + readonly MS_MANIPULATION_STATE_CANCELLED: number; + readonly MS_MANIPULATION_STATE_COMMITTED: number; + readonly MS_MANIPULATION_STATE_DRAGGING: number; + readonly MS_MANIPULATION_STATE_INERTIA: number; + readonly MS_MANIPULATION_STATE_PRESELECT: number; + readonly MS_MANIPULATION_STATE_SELECTING: number; + readonly MS_MANIPULATION_STATE_STOPPED: number; } declare var MSManipulationEvent: { prototype: MSManipulationEvent; new(): MSManipulationEvent; - MS_MANIPULATION_STATE_ACTIVE: number; - MS_MANIPULATION_STATE_CANCELLED: number; - MS_MANIPULATION_STATE_COMMITTED: number; - MS_MANIPULATION_STATE_DRAGGING: number; - MS_MANIPULATION_STATE_INERTIA: number; - MS_MANIPULATION_STATE_PRESELECT: number; - MS_MANIPULATION_STATE_SELECTING: number; - MS_MANIPULATION_STATE_STOPPED: number; + readonly MS_MANIPULATION_STATE_ACTIVE: number; + readonly MS_MANIPULATION_STATE_CANCELLED: number; + readonly MS_MANIPULATION_STATE_COMMITTED: number; + readonly MS_MANIPULATION_STATE_DRAGGING: number; + readonly MS_MANIPULATION_STATE_INERTIA: number; + readonly MS_MANIPULATION_STATE_PRESELECT: number; + readonly MS_MANIPULATION_STATE_SELECTING: number; + readonly MS_MANIPULATION_STATE_STOPPED: number; } interface MSMediaKeyError { - code: number; - systemCode: number; - MS_MEDIA_KEYERR_CLIENT: number; - MS_MEDIA_KEYERR_DOMAIN: number; - MS_MEDIA_KEYERR_HARDWARECHANGE: number; - MS_MEDIA_KEYERR_OUTPUT: number; - MS_MEDIA_KEYERR_SERVICE: number; - MS_MEDIA_KEYERR_UNKNOWN: number; + readonly code: number; + readonly systemCode: number; + readonly MS_MEDIA_KEYERR_CLIENT: number; + readonly MS_MEDIA_KEYERR_DOMAIN: number; + readonly MS_MEDIA_KEYERR_HARDWARECHANGE: number; + readonly MS_MEDIA_KEYERR_OUTPUT: number; + readonly MS_MEDIA_KEYERR_SERVICE: number; + readonly MS_MEDIA_KEYERR_UNKNOWN: number; } declare var MSMediaKeyError: { prototype: MSMediaKeyError; new(): MSMediaKeyError; - MS_MEDIA_KEYERR_CLIENT: number; - MS_MEDIA_KEYERR_DOMAIN: number; - MS_MEDIA_KEYERR_HARDWARECHANGE: number; - MS_MEDIA_KEYERR_OUTPUT: number; - MS_MEDIA_KEYERR_SERVICE: number; - MS_MEDIA_KEYERR_UNKNOWN: number; + readonly MS_MEDIA_KEYERR_CLIENT: number; + readonly MS_MEDIA_KEYERR_DOMAIN: number; + readonly MS_MEDIA_KEYERR_HARDWARECHANGE: number; + readonly MS_MEDIA_KEYERR_OUTPUT: number; + readonly MS_MEDIA_KEYERR_SERVICE: number; + readonly MS_MEDIA_KEYERR_UNKNOWN: number; } interface MSMediaKeyMessageEvent extends Event { - destinationURL: string; - message: Uint8Array; + readonly destinationURL: string | null; + readonly message: Uint8Array; } declare var MSMediaKeyMessageEvent: { @@ -12771,7 +13692,7 @@ declare var MSMediaKeyMessageEvent: { } interface MSMediaKeyNeededEvent extends Event { - initData: Uint8Array; + readonly initData: Uint8Array | null; } declare var MSMediaKeyNeededEvent: { @@ -12780,9 +13701,9 @@ declare var MSMediaKeyNeededEvent: { } interface MSMediaKeySession extends EventTarget { - error: MSMediaKeyError; - keySystem: string; - sessionId: string; + readonly error: MSMediaKeyError | null; + readonly keySystem: string; + readonly sessionId: string; close(): void; update(key: Uint8Array): void; } @@ -12793,7 +13714,7 @@ declare var MSMediaKeySession: { } interface MSMediaKeys { - keySystem: string; + readonly keySystem: string; createSession(type: string, initData: Uint8Array, cdmData?: Uint8Array): MSMediaKeySession; } @@ -12801,40 +13722,22 @@ declare var MSMediaKeys: { prototype: MSMediaKeys; new(keySystem: string): MSMediaKeys; isTypeSupported(keySystem: string, type?: string): boolean; -} - -interface MSMimeTypesCollection { - length: number; -} - -declare var MSMimeTypesCollection: { - prototype: MSMimeTypesCollection; - new(): MSMimeTypesCollection; -} - -interface MSPluginsCollection { - length: number; - refresh(reload?: boolean): void; -} - -declare var MSPluginsCollection: { - prototype: MSPluginsCollection; - new(): MSPluginsCollection; + isTypeSupportedWithFeatures(keySystem: string, type?: string): string; } interface MSPointerEvent extends MouseEvent { - currentPoint: any; - height: number; - hwTimestamp: number; - intermediatePoints: any; - isPrimary: boolean; - pointerId: number; - pointerType: any; - pressure: number; - rotation: number; - tiltX: number; - tiltY: number; - width: number; + readonly currentPoint: any; + readonly height: number; + readonly hwTimestamp: number; + readonly intermediatePoints: any; + readonly isPrimary: boolean; + readonly pointerId: number; + readonly pointerType: any; + readonly pressure: number; + readonly rotation: number; + readonly tiltX: number; + readonly tiltY: number; + readonly width: number; getCurrentPoint(element: Element): void; getIntermediatePoints(element: Element): void; initPointerEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, offsetXArg: number, offsetYArg: number, widthArg: number, heightArg: number, pressure: number, rotation: number, tiltX: number, tiltY: number, pointerIdArg: number, pointerType: any, hwTimestampArg: number, isPrimary: boolean): void; @@ -12846,7 +13749,7 @@ declare var MSPointerEvent: { } interface MSRangeCollection { - length: number; + readonly length: number; item(index: number): Range; [index: number]: Range; } @@ -12857,8 +13760,8 @@ declare var MSRangeCollection: { } interface MSSiteModeEvent extends Event { - actionURL: string; - buttonID: number; + readonly actionURL: string; + readonly buttonID: number; } declare var MSSiteModeEvent: { @@ -12867,7 +13770,7 @@ declare var MSSiteModeEvent: { } interface MSStream { - type: string; + readonly type: string; msClose(): void; msDetachStream(): any; } @@ -12878,7 +13781,7 @@ declare var MSStream: { } interface MSStreamReader extends EventTarget, MSBaseReader { - error: DOMError; + readonly error: DOMError; readAsArrayBuffer(stream: MSStream, size?: number): void; readAsBinaryString(stream: MSStream, size?: number): void; readAsBlob(stream: MSStream, size?: number): void; @@ -12893,20 +13796,20 @@ declare var MSStreamReader: { } interface MSWebViewAsyncOperation extends EventTarget { - error: DOMError; + readonly error: DOMError; oncomplete: (ev: Event) => any; onerror: (ev: Event) => any; - readyState: number; - result: any; - target: MSHTMLWebViewElement; - type: number; + readonly readyState: number; + readonly result: any; + readonly target: MSHTMLWebViewElement; + readonly type: number; start(): void; - COMPLETED: number; - ERROR: number; - STARTED: number; - TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number; - TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number; - TYPE_INVOKE_SCRIPT: number; + readonly COMPLETED: number; + readonly ERROR: number; + readonly STARTED: number; + readonly TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number; + readonly TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number; + readonly TYPE_INVOKE_SCRIPT: number; addEventListener(type: "complete", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; @@ -12915,12 +13818,12 @@ interface MSWebViewAsyncOperation extends EventTarget { declare var MSWebViewAsyncOperation: { prototype: MSWebViewAsyncOperation; new(): MSWebViewAsyncOperation; - COMPLETED: number; - ERROR: number; - STARTED: number; - TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number; - TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number; - TYPE_INVOKE_SCRIPT: number; + readonly COMPLETED: number; + readonly ERROR: number; + readonly STARTED: number; + readonly TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number; + readonly TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number; + readonly TYPE_INVOKE_SCRIPT: number; } interface MSWebViewSettings { @@ -12933,6 +13836,32 @@ declare var MSWebViewSettings: { new(): MSWebViewSettings; } +interface MediaDeviceInfo { + readonly deviceId: string; + readonly groupId: string; + readonly kind: string; + readonly label: string; +} + +declare var MediaDeviceInfo: { + prototype: MediaDeviceInfo; + new(): MediaDeviceInfo; +} + +interface MediaDevices extends EventTarget { + ondevicechange: (ev: Event) => any; + enumerateDevices(): any; + getSupportedConstraints(): MediaTrackSupportedConstraints; + getUserMedia(constraints: MediaStreamConstraints): PromiseLike; + addEventListener(type: "devicechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MediaDevices: { + prototype: MediaDevices; + new(): MediaDevices; +} + interface MediaElementAudioSourceNode extends AudioNode { } @@ -12941,28 +13870,98 @@ declare var MediaElementAudioSourceNode: { new(): MediaElementAudioSourceNode; } +interface MediaEncryptedEvent extends Event { + readonly initData: ArrayBuffer | null; + readonly initDataType: string; +} + +declare var MediaEncryptedEvent: { + prototype: MediaEncryptedEvent; + new(type: string, eventInitDict?: MediaEncryptedEventInit): MediaEncryptedEvent; +} + interface MediaError { - code: number; - msExtendedCode: number; - MEDIA_ERR_ABORTED: number; - MEDIA_ERR_DECODE: number; - MEDIA_ERR_NETWORK: number; - MEDIA_ERR_SRC_NOT_SUPPORTED: number; - MS_MEDIA_ERR_ENCRYPTED: number; + readonly code: number; + readonly msExtendedCode: number; + readonly MEDIA_ERR_ABORTED: number; + readonly MEDIA_ERR_DECODE: number; + readonly MEDIA_ERR_NETWORK: number; + readonly MEDIA_ERR_SRC_NOT_SUPPORTED: number; + readonly MS_MEDIA_ERR_ENCRYPTED: number; } declare var MediaError: { prototype: MediaError; new(): MediaError; - MEDIA_ERR_ABORTED: number; - MEDIA_ERR_DECODE: number; - MEDIA_ERR_NETWORK: number; - MEDIA_ERR_SRC_NOT_SUPPORTED: number; - MS_MEDIA_ERR_ENCRYPTED: number; + readonly MEDIA_ERR_ABORTED: number; + readonly MEDIA_ERR_DECODE: number; + readonly MEDIA_ERR_NETWORK: number; + readonly MEDIA_ERR_SRC_NOT_SUPPORTED: number; + readonly MS_MEDIA_ERR_ENCRYPTED: number; +} + +interface MediaKeyMessageEvent extends Event { + readonly message: ArrayBuffer; + readonly messageType: string; +} + +declare var MediaKeyMessageEvent: { + prototype: MediaKeyMessageEvent; + new(type: string, eventInitDict?: MediaKeyMessageEventInit): MediaKeyMessageEvent; +} + +interface MediaKeySession extends EventTarget { + readonly closed: PromiseLike; + readonly expiration: number; + readonly keyStatuses: MediaKeyStatusMap; + readonly sessionId: string; + close(): PromiseLike; + generateRequest(initDataType: string, initData: any): PromiseLike; + load(sessionId: string): PromiseLike; + remove(): PromiseLike; + update(response: any): PromiseLike; +} + +declare var MediaKeySession: { + prototype: MediaKeySession; + new(): MediaKeySession; +} + +interface MediaKeyStatusMap { + readonly size: number; + forEach(callback: ForEachCallback): void; + get(keyId: any): string; + has(keyId: any): boolean; +} + +declare var MediaKeyStatusMap: { + prototype: MediaKeyStatusMap; + new(): MediaKeyStatusMap; +} + +interface MediaKeySystemAccess { + readonly keySystem: string; + createMediaKeys(): PromiseLike; + getConfiguration(): MediaKeySystemConfiguration; +} + +declare var MediaKeySystemAccess: { + prototype: MediaKeySystemAccess; + new(): MediaKeySystemAccess; +} + +interface MediaKeys { + createSession(sessionType?: string): MediaKeySession; + setServerCertificate(serverCertificate: any): PromiseLike; +} + +declare var MediaKeys: { + prototype: MediaKeys; + new(): MediaKeys; } interface MediaList { - length: number; + readonly length: number; mediaText: string; appendMedium(newMedium: string): void; deleteMedium(oldMedium: string): void; @@ -12977,8 +13976,8 @@ declare var MediaList: { } interface MediaQueryList { - matches: boolean; - media: string; + readonly matches: boolean; + readonly media: string; addListener(listener: MediaQueryListListener): void; removeListener(listener: MediaQueryListListener): void; } @@ -12989,10 +13988,10 @@ declare var MediaQueryList: { } interface MediaSource extends EventTarget { - activeSourceBuffers: SourceBufferList; + readonly activeSourceBuffers: SourceBufferList; duration: number; - readyState: number; - sourceBuffers: SourceBufferList; + readonly readyState: string; + readonly sourceBuffers: SourceBufferList; addSourceBuffer(type: string): SourceBuffer; endOfStream(error?: number): void; removeSourceBuffer(sourceBuffer: SourceBuffer): void; @@ -13004,9 +14003,104 @@ declare var MediaSource: { isTypeSupported(type: string): boolean; } +interface MediaStream extends EventTarget { + readonly active: boolean; + readonly id: string; + onactive: (ev: Event) => any; + onaddtrack: (ev: TrackEvent) => any; + oninactive: (ev: Event) => any; + onremovetrack: (ev: TrackEvent) => any; + addTrack(track: MediaStreamTrack): void; + clone(): MediaStream; + getAudioTracks(): MediaStreamTrack[]; + getTrackById(trackId: string): MediaStreamTrack | null; + getTracks(): MediaStreamTrack[]; + getVideoTracks(): MediaStreamTrack[]; + removeTrack(track: MediaStreamTrack): void; + stop(): void; + addEventListener(type: "active", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "addtrack", listener: (ev: TrackEvent) => any, useCapture?: boolean): void; + addEventListener(type: "inactive", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "removetrack", listener: (ev: TrackEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MediaStream: { + prototype: MediaStream; + new(streamOrTracks?: MediaStream | MediaStreamTrack[]): MediaStream; +} + +interface MediaStreamAudioSourceNode extends AudioNode { +} + +declare var MediaStreamAudioSourceNode: { + prototype: MediaStreamAudioSourceNode; + new(): MediaStreamAudioSourceNode; +} + +interface MediaStreamError { + readonly constraintName: string | null; + readonly message: string | null; + readonly name: string; +} + +declare var MediaStreamError: { + prototype: MediaStreamError; + new(): MediaStreamError; +} + +interface MediaStreamErrorEvent extends Event { + readonly error: MediaStreamError | null; +} + +declare var MediaStreamErrorEvent: { + prototype: MediaStreamErrorEvent; + new(type: string, eventInitDict?: MediaStreamErrorEventInit): MediaStreamErrorEvent; +} + +interface MediaStreamTrack extends EventTarget { + enabled: boolean; + readonly id: string; + readonly kind: string; + readonly label: string; + readonly muted: boolean; + onended: (ev: MediaStreamErrorEvent) => any; + onmute: (ev: Event) => any; + onoverconstrained: (ev: MediaStreamErrorEvent) => any; + onunmute: (ev: Event) => any; + readonly readonly: boolean; + readonly readyState: string; + readonly remote: boolean; + applyConstraints(constraints: MediaTrackConstraints): PromiseLike; + clone(): MediaStreamTrack; + getCapabilities(): MediaTrackCapabilities; + getConstraints(): MediaTrackConstraints; + getSettings(): MediaTrackSettings; + stop(): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mute", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "overconstrained", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "unmute", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MediaStreamTrack: { + prototype: MediaStreamTrack; + new(): MediaStreamTrack; +} + +interface MediaStreamTrackEvent extends Event { + readonly track: MediaStreamTrack; +} + +declare var MediaStreamTrackEvent: { + prototype: MediaStreamTrackEvent; + new(type: string, eventInitDict?: MediaStreamTrackEventInit): MediaStreamTrackEvent; +} + interface MessageChannel { - port1: MessagePort; - port2: MessagePort; + readonly port1: MessagePort; + readonly port2: MessagePort; } declare var MessageChannel: { @@ -13015,10 +14109,10 @@ declare var MessageChannel: { } interface MessageEvent extends Event { - data: any; - origin: string; - ports: any; - source: Window; + readonly data: any; + readonly origin: string; + readonly ports: any; + readonly source: Window; initMessageEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, dataArg: any, originArg: string, lastEventIdArg: string, sourceArg: Window): void; } @@ -13042,10 +14136,10 @@ declare var MessagePort: { } interface MimeType { - description: string; - enabledPlugin: Plugin; - suffixes: string; - type: string; + readonly description: string; + readonly enabledPlugin: Plugin; + readonly suffixes: string; + readonly type: string; } declare var MimeType: { @@ -13054,7 +14148,7 @@ declare var MimeType: { } interface MimeTypeArray { - length: number; + readonly length: number; item(index: number): Plugin; namedItem(type: string): Plugin; [index: number]: Plugin; @@ -13066,30 +14160,30 @@ declare var MimeTypeArray: { } interface MouseEvent extends UIEvent { - altKey: boolean; - button: number; - buttons: number; - clientX: number; - clientY: number; - ctrlKey: boolean; - fromElement: Element; - layerX: number; - layerY: number; - metaKey: boolean; - movementX: number; - movementY: number; - offsetX: number; - offsetY: number; - pageX: number; - pageY: number; - relatedTarget: EventTarget; - screenX: number; - screenY: number; - shiftKey: boolean; - toElement: Element; - which: number; - x: number; - y: number; + readonly altKey: boolean; + readonly button: number; + readonly buttons: number; + readonly clientX: number; + readonly clientY: number; + readonly ctrlKey: boolean; + readonly fromElement: Element; + readonly layerX: number; + readonly layerY: number; + readonly metaKey: boolean; + readonly movementX: number; + readonly movementY: number; + readonly offsetX: number; + readonly offsetY: number; + readonly pageX: number; + readonly pageY: number; + readonly relatedTarget: EventTarget; + readonly screenX: number; + readonly screenY: number; + readonly shiftKey: boolean; + readonly toElement: Element; + readonly which: number; + readonly x: number; + readonly y: number; getModifierState(keyArg: string): boolean; initMouseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget): void; } @@ -13099,36 +14193,24 @@ declare var MouseEvent: { new(typeArg: string, eventInitDict?: MouseEventInit): MouseEvent; } -interface MouseWheelEvent extends MouseEvent { - wheelDelta: number; - wheelDeltaX: number; - wheelDeltaY: number; - initMouseWheelEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, buttonArg: number, relatedTargetArg: EventTarget, modifiersListArg: string, wheelDeltaArg: number): void; -} - -declare var MouseWheelEvent: { - prototype: MouseWheelEvent; - new(): MouseWheelEvent; -} - interface MutationEvent extends Event { - attrChange: number; - attrName: string; - newValue: string; - prevValue: string; - relatedNode: Node; + readonly attrChange: number; + readonly attrName: string; + readonly newValue: string; + readonly prevValue: string; + readonly relatedNode: Node; initMutationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, relatedNodeArg: Node, prevValueArg: string, newValueArg: string, attrNameArg: string, attrChangeArg: number): void; - ADDITION: number; - MODIFICATION: number; - REMOVAL: number; + readonly ADDITION: number; + readonly MODIFICATION: number; + readonly REMOVAL: number; } declare var MutationEvent: { prototype: MutationEvent; new(): MutationEvent; - ADDITION: number; - MODIFICATION: number; - REMOVAL: number; + readonly ADDITION: number; + readonly MODIFICATION: number; + readonly REMOVAL: number; } interface MutationObserver { @@ -13143,15 +14225,15 @@ declare var MutationObserver: { } interface MutationRecord { - addedNodes: NodeList; - attributeName: string; - attributeNamespace: string; - nextSibling: Node; - oldValue: string; - previousSibling: Node; - removedNodes: NodeList; - target: Node; - type: string; + readonly addedNodes: NodeList; + readonly attributeName: string | null; + readonly attributeNamespace: string | null; + readonly nextSibling: Node | null; + readonly oldValue: string | null; + readonly previousSibling: Node | null; + readonly removedNodes: NodeList; + readonly target: Node; + readonly type: string; } declare var MutationRecord: { @@ -13160,12 +14242,12 @@ declare var MutationRecord: { } interface NamedNodeMap { - length: number; + readonly length: number; getNamedItem(name: string): Attr; - getNamedItemNS(namespaceURI: string, localName: string): Attr; + getNamedItemNS(namespaceURI: string | null, localName: string | null): Attr; item(index: number): Attr; removeNamedItem(name: string): Attr; - removeNamedItemNS(namespaceURI: string, localName: string): Attr; + removeNamedItemNS(namespaceURI: string | null, localName: string | null): Attr; setNamedItem(arg: Attr): Attr; setNamedItemNS(arg: Attr): Attr; [index: number]: Attr; @@ -13177,8 +14259,8 @@ declare var NamedNodeMap: { } interface NavigationCompletedEvent extends NavigationEvent { - isSuccess: boolean; - webErrorStatus: number; + readonly isSuccess: boolean; + readonly webErrorStatus: number; } declare var NavigationCompletedEvent: { @@ -13187,7 +14269,7 @@ declare var NavigationCompletedEvent: { } interface NavigationEvent extends Event { - uri: string; + readonly uri: string; } declare var NavigationEvent: { @@ -13196,7 +14278,7 @@ declare var NavigationEvent: { } interface NavigationEventWithReferrer extends NavigationEvent { - referer: string; + readonly referer: string; } declare var NavigationEventWithReferrer: { @@ -13204,27 +14286,23 @@ declare var NavigationEventWithReferrer: { new(): NavigationEventWithReferrer; } -interface Navigator extends Object, NavigatorID, NavigatorOnLine, NavigatorContentUtils, NavigatorStorageUtils, NavigatorGeolocation, MSNavigatorDoNotTrack, MSFileSaver { - appCodeName: string; - appMinorVersion: string; - browserLanguage: string; - connectionSpeed: number; - cookieEnabled: boolean; - cpuClass: string; - language: string; - maxTouchPoints: number; - mimeTypes: MSMimeTypesCollection; - msManipulationViewsEnabled: boolean; - msMaxTouchPoints: number; - msPointerEnabled: boolean; - plugins: MSPluginsCollection; - pointerEnabled: boolean; - systemLanguage: string; - userLanguage: string; - webdriver: boolean; +interface Navigator extends Object, NavigatorID, NavigatorOnLine, NavigatorContentUtils, NavigatorStorageUtils, NavigatorGeolocation, MSNavigatorDoNotTrack, MSFileSaver, NavigatorUserMedia { + readonly appCodeName: string; + readonly cookieEnabled: boolean; + readonly language: string; + readonly maxTouchPoints: number; + readonly mimeTypes: MimeTypeArray; + readonly msManipulationViewsEnabled: boolean; + readonly msMaxTouchPoints: number; + readonly msPointerEnabled: boolean; + readonly plugins: PluginArray; + readonly pointerEnabled: boolean; + readonly webdriver: boolean; getGamepads(): Gamepad[]; javaEnabled(): boolean; msLaunchUri(uri: string, successCallback?: MSLaunchUriCallback, noHandlerCallback?: MSLaunchUriCallback): void; + requestMediaKeySystemAccess(keySystem: string, supportedConfigurations: MediaKeySystemConfiguration[]): PromiseLike; + vibrate(pattern: number | number[]): boolean; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -13234,78 +14312,79 @@ declare var Navigator: { } interface Node extends EventTarget { - attributes: NamedNodeMap; - baseURI: string; - childNodes: NodeList; - firstChild: Node; - lastChild: Node; - localName: string; - namespaceURI: string; - nextSibling: Node; - nodeName: string; - nodeType: number; - nodeValue: string; - ownerDocument: Document; - parentElement: HTMLElement; - parentNode: Node; - prefix: string; - previousSibling: Node; - textContent: string; + readonly attributes: NamedNodeMap; + readonly baseURI: string | null; + readonly childNodes: NodeList; + readonly firstChild: Node; + readonly lastChild: Node; + readonly localName: string | null; + readonly namespaceURI: string | null; + readonly nextSibling: Node; + readonly nodeName: string; + readonly nodeType: number; + nodeValue: string | null; + readonly ownerDocument: Document; + readonly parentElement: HTMLElement; + readonly parentNode: Node; + readonly previousSibling: Node; + textContent: string | null; appendChild(newChild: Node): Node; cloneNode(deep?: boolean): Node; compareDocumentPosition(other: Node): number; + contains(child: Node): boolean; hasAttributes(): boolean; hasChildNodes(): boolean; - insertBefore(newChild: Node, refChild?: Node): Node; - isDefaultNamespace(namespaceURI: string): boolean; + insertBefore(newChild: Node, refChild: Node): Node; + isDefaultNamespace(namespaceURI: string | null): boolean; isEqualNode(arg: Node): boolean; isSameNode(other: Node): boolean; - lookupNamespaceURI(prefix: string): string; - lookupPrefix(namespaceURI: string): string; + lookupNamespaceURI(prefix: string | null): string | null; + lookupPrefix(namespaceURI: string | null): string | null; normalize(): void; removeChild(oldChild: Node): Node; replaceChild(newChild: Node, oldChild: Node): Node; - ATTRIBUTE_NODE: number; - CDATA_SECTION_NODE: number; - COMMENT_NODE: number; - DOCUMENT_FRAGMENT_NODE: number; - DOCUMENT_NODE: number; - DOCUMENT_POSITION_CONTAINED_BY: number; - DOCUMENT_POSITION_CONTAINS: number; - DOCUMENT_POSITION_DISCONNECTED: number; - DOCUMENT_POSITION_FOLLOWING: number; - DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number; - DOCUMENT_POSITION_PRECEDING: number; - DOCUMENT_TYPE_NODE: number; - ELEMENT_NODE: number; - ENTITY_NODE: number; - ENTITY_REFERENCE_NODE: number; - NOTATION_NODE: number; - PROCESSING_INSTRUCTION_NODE: number; - TEXT_NODE: number; + contains(node: Node): boolean; + readonly ATTRIBUTE_NODE: number; + readonly CDATA_SECTION_NODE: number; + readonly COMMENT_NODE: number; + readonly DOCUMENT_FRAGMENT_NODE: number; + readonly DOCUMENT_NODE: number; + readonly DOCUMENT_POSITION_CONTAINED_BY: number; + readonly DOCUMENT_POSITION_CONTAINS: number; + readonly DOCUMENT_POSITION_DISCONNECTED: number; + readonly DOCUMENT_POSITION_FOLLOWING: number; + readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number; + readonly DOCUMENT_POSITION_PRECEDING: number; + readonly DOCUMENT_TYPE_NODE: number; + readonly ELEMENT_NODE: number; + readonly ENTITY_NODE: number; + readonly ENTITY_REFERENCE_NODE: number; + readonly NOTATION_NODE: number; + readonly PROCESSING_INSTRUCTION_NODE: number; + readonly TEXT_NODE: number; } declare var Node: { prototype: Node; new(): Node; - ATTRIBUTE_NODE: number; - CDATA_SECTION_NODE: number; - COMMENT_NODE: number; - DOCUMENT_FRAGMENT_NODE: number; - DOCUMENT_NODE: number; - DOCUMENT_POSITION_CONTAINED_BY: number; - DOCUMENT_POSITION_CONTAINS: number; - DOCUMENT_POSITION_DISCONNECTED: number; - DOCUMENT_POSITION_FOLLOWING: number; - DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number; - DOCUMENT_POSITION_PRECEDING: number; - DOCUMENT_TYPE_NODE: number; - ELEMENT_NODE: number; - ENTITY_NODE: number; - ENTITY_REFERENCE_NODE: number; - NOTATION_NODE: number; - PROCESSING_INSTRUCTION_NODE: number; - TEXT_NODE: number; + readonly ATTRIBUTE_NODE: number; + readonly CDATA_SECTION_NODE: number; + readonly COMMENT_NODE: number; + readonly DOCUMENT_FRAGMENT_NODE: number; + readonly DOCUMENT_NODE: number; + readonly DOCUMENT_POSITION_CONTAINED_BY: number; + readonly DOCUMENT_POSITION_CONTAINS: number; + readonly DOCUMENT_POSITION_DISCONNECTED: number; + readonly DOCUMENT_POSITION_FOLLOWING: number; + readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number; + readonly DOCUMENT_POSITION_PRECEDING: number; + readonly DOCUMENT_TYPE_NODE: number; + readonly ELEMENT_NODE: number; + readonly ENTITY_NODE: number; + readonly ENTITY_REFERENCE_NODE: number; + readonly NOTATION_NODE: number; + readonly PROCESSING_INSTRUCTION_NODE: number; + readonly TEXT_NODE: number; } interface NodeFilter { @@ -13313,29 +14392,29 @@ interface NodeFilter { } declare var NodeFilter: { - FILTER_ACCEPT: number; - FILTER_REJECT: number; - FILTER_SKIP: number; - SHOW_ALL: number; - SHOW_ATTRIBUTE: number; - SHOW_CDATA_SECTION: number; - SHOW_COMMENT: number; - SHOW_DOCUMENT: number; - SHOW_DOCUMENT_FRAGMENT: number; - SHOW_DOCUMENT_TYPE: number; - SHOW_ELEMENT: number; - SHOW_ENTITY: number; - SHOW_ENTITY_REFERENCE: number; - SHOW_NOTATION: number; - SHOW_PROCESSING_INSTRUCTION: number; - SHOW_TEXT: number; + readonly FILTER_ACCEPT: number; + readonly FILTER_REJECT: number; + readonly FILTER_SKIP: number; + readonly SHOW_ALL: number; + readonly SHOW_ATTRIBUTE: number; + readonly SHOW_CDATA_SECTION: number; + readonly SHOW_COMMENT: number; + readonly SHOW_DOCUMENT: number; + readonly SHOW_DOCUMENT_FRAGMENT: number; + readonly SHOW_DOCUMENT_TYPE: number; + readonly SHOW_ELEMENT: number; + readonly SHOW_ENTITY: number; + readonly SHOW_ENTITY_REFERENCE: number; + readonly SHOW_NOTATION: number; + readonly SHOW_PROCESSING_INSTRUCTION: number; + readonly SHOW_TEXT: number; } interface NodeIterator { - expandEntityReferences: boolean; - filter: NodeFilter; - root: Node; - whatToShow: number; + readonly expandEntityReferences: boolean; + readonly filter: NodeFilter; + readonly root: Node; + readonly whatToShow: number; detach(): void; nextNode(): Node; previousNode(): Node; @@ -13347,7 +14426,7 @@ declare var NodeIterator: { } interface NodeList { - length: number; + readonly length: number; item(index: number): Node; [index: number]: Node; } @@ -13366,13 +14445,13 @@ declare var OES_element_index_uint: { } interface OES_standard_derivatives { - FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number; + readonly FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number; } declare var OES_standard_derivatives: { prototype: OES_standard_derivatives; new(): OES_standard_derivatives; - FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number; + readonly FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number; } interface OES_texture_float { @@ -13392,7 +14471,7 @@ declare var OES_texture_float_linear: { } interface OfflineAudioCompletionEvent extends Event { - renderedBuffer: AudioBuffer; + readonly renderedBuffer: AudioBuffer; } declare var OfflineAudioCompletionEvent: { @@ -13402,7 +14481,7 @@ declare var OfflineAudioCompletionEvent: { interface OfflineAudioContext extends AudioContext { oncomplete: (ev: Event) => any; - startRendering(): void; + startRendering(): PromiseLike; addEventListener(type: "complete", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -13413,14 +14492,14 @@ declare var OfflineAudioContext: { } interface OscillatorNode extends AudioNode { - detune: AudioParam; - frequency: AudioParam; - onended: (ev: Event) => any; + readonly detune: AudioParam; + readonly frequency: AudioParam; + onended: (ev: MediaStreamErrorEvent) => any; type: string; setPeriodicWave(periodicWave: PeriodicWave): void; start(when?: number): void; stop(when?: number): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -13429,8 +14508,25 @@ declare var OscillatorNode: { new(): OscillatorNode; } +interface OverflowEvent extends UIEvent { + readonly horizontalOverflow: boolean; + readonly orient: number; + readonly verticalOverflow: boolean; + readonly BOTH: number; + readonly HORIZONTAL: number; + readonly VERTICAL: number; +} + +declare var OverflowEvent: { + prototype: OverflowEvent; + new(): OverflowEvent; + readonly BOTH: number; + readonly HORIZONTAL: number; + readonly VERTICAL: number; +} + interface PageTransitionEvent extends Event { - persisted: boolean; + readonly persisted: boolean; } declare var PageTransitionEvent: { @@ -13458,24 +14554,24 @@ declare var PannerNode: { } interface PerfWidgetExternal { - activeNetworkRequestCount: number; - averageFrameTime: number; - averagePaintTime: number; - extraInformationEnabled: boolean; - independentRenderingEnabled: boolean; - irDisablingContentString: string; - irStatusAvailable: boolean; - maxCpuSpeed: number; - paintRequestsPerSecond: number; - performanceCounter: number; - performanceCounterFrequency: number; + readonly activeNetworkRequestCount: number; + readonly averageFrameTime: number; + readonly averagePaintTime: number; + readonly extraInformationEnabled: boolean; + readonly independentRenderingEnabled: boolean; + readonly irDisablingContentString: string; + readonly irStatusAvailable: boolean; + readonly maxCpuSpeed: number; + readonly paintRequestsPerSecond: number; + readonly performanceCounter: number; + readonly performanceCounterFrequency: number; addEventListener(eventType: string, callback: Function): void; getMemoryUsage(): number; getProcessCpuUsage(): number; - getRecentCpuUsage(last: number): any; - getRecentFrames(last: number): any; - getRecentMemoryUsage(last: number): any; - getRecentPaintRequests(last: number): any; + getRecentCpuUsage(last: number | null): any; + getRecentFrames(last: number | null): any; + getRecentMemoryUsage(last: number | null): any; + getRecentPaintRequests(last: number | null): any; removeEventListener(eventType: string, callback: Function): void; repositionWindow(x: number, y: number): void; resizeWindow(width: number, height: number): void; @@ -13487,8 +14583,8 @@ declare var PerfWidgetExternal: { } interface Performance { - navigation: PerformanceNavigation; - timing: PerformanceTiming; + readonly navigation: PerformanceNavigation; + readonly timing: PerformanceTiming; clearMarks(markName?: string): void; clearMeasures(measureName?: string): void; clearResourceTimings(): void; @@ -13510,10 +14606,10 @@ declare var Performance: { } interface PerformanceEntry { - duration: number; - entryType: string; - name: string; - startTime: number; + readonly duration: number; + readonly entryType: string; + readonly name: string; + readonly startTime: number; } declare var PerformanceEntry: { @@ -13538,47 +14634,47 @@ declare var PerformanceMeasure: { } interface PerformanceNavigation { - redirectCount: number; - type: number; + readonly redirectCount: number; + readonly type: number; toJSON(): any; - TYPE_BACK_FORWARD: number; - TYPE_NAVIGATE: number; - TYPE_RELOAD: number; - TYPE_RESERVED: number; + readonly TYPE_BACK_FORWARD: number; + readonly TYPE_NAVIGATE: number; + readonly TYPE_RELOAD: number; + readonly TYPE_RESERVED: number; } declare var PerformanceNavigation: { prototype: PerformanceNavigation; new(): PerformanceNavigation; - TYPE_BACK_FORWARD: number; - TYPE_NAVIGATE: number; - TYPE_RELOAD: number; - TYPE_RESERVED: number; + readonly TYPE_BACK_FORWARD: number; + readonly TYPE_NAVIGATE: number; + readonly TYPE_RELOAD: number; + readonly TYPE_RESERVED: number; } interface PerformanceNavigationTiming extends PerformanceEntry { - connectEnd: number; - connectStart: number; - domComplete: number; - domContentLoadedEventEnd: number; - domContentLoadedEventStart: number; - domInteractive: number; - domLoading: number; - domainLookupEnd: number; - domainLookupStart: number; - fetchStart: number; - loadEventEnd: number; - loadEventStart: number; - navigationStart: number; - redirectCount: number; - redirectEnd: number; - redirectStart: number; - requestStart: number; - responseEnd: number; - responseStart: number; - type: string; - unloadEventEnd: number; - unloadEventStart: number; + readonly connectEnd: number; + readonly connectStart: number; + readonly domComplete: number; + readonly domContentLoadedEventEnd: number; + readonly domContentLoadedEventStart: number; + readonly domInteractive: number; + readonly domLoading: number; + readonly domainLookupEnd: number; + readonly domainLookupStart: number; + readonly fetchStart: number; + readonly loadEventEnd: number; + readonly loadEventStart: number; + readonly navigationStart: number; + readonly redirectCount: number; + readonly redirectEnd: number; + readonly redirectStart: number; + readonly requestStart: number; + readonly responseEnd: number; + readonly responseStart: number; + readonly type: string; + readonly unloadEventEnd: number; + readonly unloadEventStart: number; } declare var PerformanceNavigationTiming: { @@ -13587,17 +14683,17 @@ declare var PerformanceNavigationTiming: { } interface PerformanceResourceTiming extends PerformanceEntry { - connectEnd: number; - connectStart: number; - domainLookupEnd: number; - domainLookupStart: number; - fetchStart: number; - initiatorType: string; - redirectEnd: number; - redirectStart: number; - requestStart: number; - responseEnd: number; - responseStart: number; + readonly connectEnd: number; + readonly connectStart: number; + readonly domainLookupEnd: number; + readonly domainLookupStart: number; + readonly fetchStart: number; + readonly initiatorType: string; + readonly redirectEnd: number; + readonly redirectStart: number; + readonly requestStart: number; + readonly responseEnd: number; + readonly responseStart: number; } declare var PerformanceResourceTiming: { @@ -13606,27 +14702,27 @@ declare var PerformanceResourceTiming: { } interface PerformanceTiming { - connectEnd: number; - connectStart: number; - domComplete: number; - domContentLoadedEventEnd: number; - domContentLoadedEventStart: number; - domInteractive: number; - domLoading: number; - domainLookupEnd: number; - domainLookupStart: number; - fetchStart: number; - loadEventEnd: number; - loadEventStart: number; - msFirstPaint: number; - navigationStart: number; - redirectEnd: number; - redirectStart: number; - requestStart: number; - responseEnd: number; - responseStart: number; - unloadEventEnd: number; - unloadEventStart: number; + readonly connectEnd: number; + readonly connectStart: number; + readonly domComplete: number; + readonly domContentLoadedEventEnd: number; + readonly domContentLoadedEventStart: number; + readonly domInteractive: number; + readonly domLoading: number; + readonly domainLookupEnd: number; + readonly domainLookupStart: number; + readonly fetchStart: number; + readonly loadEventEnd: number; + readonly loadEventStart: number; + readonly msFirstPaint: number; + readonly navigationStart: number; + readonly redirectEnd: number; + readonly redirectStart: number; + readonly requestStart: number; + readonly responseEnd: number; + readonly responseStart: number; + readonly unloadEventEnd: number; + readonly unloadEventStart: number; toJSON(): any; } @@ -13644,7 +14740,7 @@ declare var PeriodicWave: { } interface PermissionRequest extends DeferredPermissionRequest { - state: string; + readonly state: string; defer(): void; } @@ -13654,7 +14750,7 @@ declare var PermissionRequest: { } interface PermissionRequestedEvent extends Event { - permissionRequest: PermissionRequest; + readonly permissionRequest: PermissionRequest; } declare var PermissionRequestedEvent: { @@ -13663,11 +14759,11 @@ declare var PermissionRequestedEvent: { } interface Plugin { - description: string; - filename: string; - length: number; - name: string; - version: string; + readonly description: string; + readonly filename: string; + readonly length: number; + readonly name: string; + readonly version: string; item(index: number): MimeType; namedItem(type: string): MimeType; [index: number]: MimeType; @@ -13679,7 +14775,7 @@ declare var Plugin: { } interface PluginArray { - length: number; + readonly length: number; item(index: number): Plugin; namedItem(name: string): Plugin; refresh(reload?: boolean): void; @@ -13692,18 +14788,18 @@ declare var PluginArray: { } interface PointerEvent extends MouseEvent { - currentPoint: any; - height: number; - hwTimestamp: number; - intermediatePoints: any; - isPrimary: boolean; - pointerId: number; - pointerType: any; - pressure: number; - rotation: number; - tiltX: number; - tiltY: number; - width: number; + readonly currentPoint: any; + readonly height: number; + readonly hwTimestamp: number; + readonly intermediatePoints: any; + readonly isPrimary: boolean; + readonly pointerId: number; + readonly pointerType: any; + readonly pressure: number; + readonly rotation: number; + readonly tiltX: number; + readonly tiltY: number; + readonly width: number; getCurrentPoint(element: Element): void; getIntermediatePoints(element: Element): void; initPointerEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, offsetXArg: number, offsetYArg: number, widthArg: number, heightArg: number, pressure: number, rotation: number, tiltX: number, tiltY: number, pointerIdArg: number, pointerType: any, hwTimestampArg: number, isPrimary: boolean): void; @@ -13715,7 +14811,7 @@ declare var PointerEvent: { } interface PopStateEvent extends Event { - state: any; + readonly state: any; initPopStateEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, stateArg: any): void; } @@ -13725,8 +14821,8 @@ declare var PopStateEvent: { } interface Position { - coords: Coordinates; - timestamp: number; + readonly coords: Coordinates; + readonly timestamp: number; } declare var Position: { @@ -13735,24 +14831,24 @@ declare var Position: { } interface PositionError { - code: number; - message: string; + readonly code: number; + readonly message: string; toString(): string; - PERMISSION_DENIED: number; - POSITION_UNAVAILABLE: number; - TIMEOUT: number; + readonly PERMISSION_DENIED: number; + readonly POSITION_UNAVAILABLE: number; + readonly TIMEOUT: number; } declare var PositionError: { prototype: PositionError; new(): PositionError; - PERMISSION_DENIED: number; - POSITION_UNAVAILABLE: number; - TIMEOUT: number; + readonly PERMISSION_DENIED: number; + readonly POSITION_UNAVAILABLE: number; + readonly TIMEOUT: number; } interface ProcessingInstruction extends CharacterData { - target: string; + readonly target: string; } declare var ProcessingInstruction: { @@ -13761,9 +14857,9 @@ declare var ProcessingInstruction: { } interface ProgressEvent extends Event { - lengthComputable: boolean; - loaded: number; - total: number; + readonly lengthComputable: boolean; + readonly loaded: number; + readonly total: number; initProgressEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, lengthComputableArg: boolean, loadedArg: number, totalArg: number): void; } @@ -13772,13 +14868,210 @@ declare var ProgressEvent: { new(type: string, eventInitDict?: ProgressEventInit): ProgressEvent; } +interface RTCDTMFToneChangeEvent extends Event { + readonly tone: string; +} + +declare var RTCDTMFToneChangeEvent: { + prototype: RTCDTMFToneChangeEvent; + new(type: string, eventInitDict: RTCDTMFToneChangeEventInit): RTCDTMFToneChangeEvent; +} + +interface RTCDtlsTransport extends RTCStatsProvider { + ondtlsstatechange: ((ev: RTCDtlsTransportStateChangedEvent) => any) | null; + onerror: ((ev: Event) => any) | null; + readonly state: string; + readonly transport: RTCIceTransport; + getLocalParameters(): RTCDtlsParameters; + getRemoteCertificates(): ArrayBuffer[]; + getRemoteParameters(): RTCDtlsParameters | null; + start(remoteParameters: RTCDtlsParameters): void; + stop(): void; + addEventListener(type: "dtlsstatechange", listener: (ev: RTCDtlsTransportStateChangedEvent) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCDtlsTransport: { + prototype: RTCDtlsTransport; + new(transport: RTCIceTransport): RTCDtlsTransport; +} + +interface RTCDtlsTransportStateChangedEvent extends Event { + readonly state: string; +} + +declare var RTCDtlsTransportStateChangedEvent: { + prototype: RTCDtlsTransportStateChangedEvent; + new(): RTCDtlsTransportStateChangedEvent; +} + +interface RTCDtmfSender extends EventTarget { + readonly canInsertDTMF: boolean; + readonly duration: number; + readonly interToneGap: number; + ontonechange: (ev: RTCDTMFToneChangeEvent) => any; + readonly sender: RTCRtpSender; + readonly toneBuffer: string; + insertDTMF(tones: string, duration?: number, interToneGap?: number): void; + addEventListener(type: "tonechange", listener: (ev: RTCDTMFToneChangeEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCDtmfSender: { + prototype: RTCDtmfSender; + new(sender: RTCRtpSender): RTCDtmfSender; +} + +interface RTCIceCandidatePairChangedEvent extends Event { + readonly pair: RTCIceCandidatePair; +} + +declare var RTCIceCandidatePairChangedEvent: { + prototype: RTCIceCandidatePairChangedEvent; + new(): RTCIceCandidatePairChangedEvent; +} + +interface RTCIceGatherer extends RTCStatsProvider { + readonly component: string; + onerror: ((ev: Event) => any) | null; + onlocalcandidate: ((ev: RTCIceGathererEvent) => any) | null; + createAssociatedGatherer(): RTCIceGatherer; + getLocalCandidates(): RTCIceCandidate[]; + getLocalParameters(): RTCIceParameters; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "localcandidate", listener: (ev: RTCIceGathererEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCIceGatherer: { + prototype: RTCIceGatherer; + new(options: RTCIceGatherOptions): RTCIceGatherer; +} + +interface RTCIceGathererEvent extends Event { + readonly candidate: RTCIceCandidate | RTCIceCandidateComplete; +} + +declare var RTCIceGathererEvent: { + prototype: RTCIceGathererEvent; + new(): RTCIceGathererEvent; +} + +interface RTCIceTransport extends RTCStatsProvider { + readonly component: string; + readonly iceGatherer: RTCIceGatherer | null; + oncandidatepairchange: ((ev: RTCIceCandidatePairChangedEvent) => any) | null; + onicestatechange: ((ev: RTCIceTransportStateChangedEvent) => any) | null; + readonly role: string; + readonly state: string; + addRemoteCandidate(remoteCandidate: RTCIceCandidate | RTCIceCandidateComplete): void; + createAssociatedTransport(): RTCIceTransport; + getNominatedCandidatePair(): RTCIceCandidatePair | null; + getRemoteCandidates(): RTCIceCandidate[]; + getRemoteParameters(): RTCIceParameters | null; + setRemoteCandidates(remoteCandidates: RTCIceCandidate[]): void; + start(gatherer: RTCIceGatherer, remoteParameters: RTCIceParameters, role?: string): void; + stop(): void; + addEventListener(type: "candidatepairchange", listener: (ev: RTCIceCandidatePairChangedEvent) => any, useCapture?: boolean): void; + addEventListener(type: "icestatechange", listener: (ev: RTCIceTransportStateChangedEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCIceTransport: { + prototype: RTCIceTransport; + new(): RTCIceTransport; +} + +interface RTCIceTransportStateChangedEvent extends Event { + readonly state: string; +} + +declare var RTCIceTransportStateChangedEvent: { + prototype: RTCIceTransportStateChangedEvent; + new(): RTCIceTransportStateChangedEvent; +} + +interface RTCRtpReceiver extends RTCStatsProvider { + onerror: ((ev: Event) => any) | null; + readonly rtcpTransport: RTCDtlsTransport; + readonly track: MediaStreamTrack | null; + readonly transport: RTCDtlsTransport | RTCSrtpSdesTransport; + getContributingSources(): RTCRtpContributingSource[]; + receive(parameters: RTCRtpParameters): void; + requestSendCSRC(csrc: number): void; + setTransport(transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): void; + stop(): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCRtpReceiver: { + prototype: RTCRtpReceiver; + new(transport: RTCDtlsTransport | RTCSrtpSdesTransport, kind: string, rtcpTransport?: RTCDtlsTransport): RTCRtpReceiver; + getCapabilities(kind?: string): RTCRtpCapabilities; +} + +interface RTCRtpSender extends RTCStatsProvider { + onerror: ((ev: Event) => any) | null; + onssrcconflict: ((ev: RTCSsrcConflictEvent) => any) | null; + readonly rtcpTransport: RTCDtlsTransport; + readonly track: MediaStreamTrack; + readonly transport: RTCDtlsTransport | RTCSrtpSdesTransport; + send(parameters: RTCRtpParameters): void; + setTrack(track: MediaStreamTrack): void; + setTransport(transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): void; + stop(): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ssrcconflict", listener: (ev: RTCSsrcConflictEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCRtpSender: { + prototype: RTCRtpSender; + new(track: MediaStreamTrack, transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): RTCRtpSender; + getCapabilities(kind?: string): RTCRtpCapabilities; +} + +interface RTCSrtpSdesTransport extends EventTarget { + onerror: ((ev: Event) => any) | null; + readonly transport: RTCIceTransport; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCSrtpSdesTransport: { + prototype: RTCSrtpSdesTransport; + new(transport: RTCIceTransport, encryptParameters: RTCSrtpSdesParameters, decryptParameters: RTCSrtpSdesParameters): RTCSrtpSdesTransport; + getLocalParameters(): RTCSrtpSdesParameters[]; +} + +interface RTCSsrcConflictEvent extends Event { + readonly ssrc: number; +} + +declare var RTCSsrcConflictEvent: { + prototype: RTCSsrcConflictEvent; + new(): RTCSsrcConflictEvent; +} + +interface RTCStatsProvider extends EventTarget { + getStats(): PromiseLike; + msGetStats(): PromiseLike; +} + +declare var RTCStatsProvider: { + prototype: RTCStatsProvider; + new(): RTCStatsProvider; +} + interface Range { - collapsed: boolean; - commonAncestorContainer: Node; - endContainer: Node; - endOffset: number; - startContainer: Node; - startOffset: number; + readonly collapsed: boolean; + readonly commonAncestorContainer: Node; + readonly endContainer: Node; + readonly endOffset: number; + readonly startContainer: Node; + readonly startOffset: number; cloneContents(): DocumentFragment; cloneRange(): Range; collapse(toStart: boolean): void; @@ -13801,23 +15094,23 @@ interface Range { setStartBefore(refNode: Node): void; surroundContents(newParent: Node): void; toString(): string; - END_TO_END: number; - END_TO_START: number; - START_TO_END: number; - START_TO_START: number; + readonly END_TO_END: number; + readonly END_TO_START: number; + readonly START_TO_END: number; + readonly START_TO_START: number; } declare var Range: { prototype: Range; new(): Range; - END_TO_END: number; - END_TO_START: number; - START_TO_END: number; - START_TO_START: number; + readonly END_TO_END: number; + readonly END_TO_START: number; + readonly START_TO_END: number; + readonly START_TO_START: number; } interface SVGAElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference { - target: SVGAnimatedString; + readonly target: SVGAnimatedString; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -13827,32 +15120,32 @@ declare var SVGAElement: { } interface SVGAngle { - unitType: number; + readonly unitType: number; value: number; valueAsString: string; valueInSpecifiedUnits: number; convertToSpecifiedUnits(unitType: number): void; newValueSpecifiedUnits(unitType: number, valueInSpecifiedUnits: number): void; - SVG_ANGLETYPE_DEG: number; - SVG_ANGLETYPE_GRAD: number; - SVG_ANGLETYPE_RAD: number; - SVG_ANGLETYPE_UNKNOWN: number; - SVG_ANGLETYPE_UNSPECIFIED: number; + readonly SVG_ANGLETYPE_DEG: number; + readonly SVG_ANGLETYPE_GRAD: number; + readonly SVG_ANGLETYPE_RAD: number; + readonly SVG_ANGLETYPE_UNKNOWN: number; + readonly SVG_ANGLETYPE_UNSPECIFIED: number; } declare var SVGAngle: { prototype: SVGAngle; new(): SVGAngle; - SVG_ANGLETYPE_DEG: number; - SVG_ANGLETYPE_GRAD: number; - SVG_ANGLETYPE_RAD: number; - SVG_ANGLETYPE_UNKNOWN: number; - SVG_ANGLETYPE_UNSPECIFIED: number; + readonly SVG_ANGLETYPE_DEG: number; + readonly SVG_ANGLETYPE_GRAD: number; + readonly SVG_ANGLETYPE_RAD: number; + readonly SVG_ANGLETYPE_UNKNOWN: number; + readonly SVG_ANGLETYPE_UNSPECIFIED: number; } interface SVGAnimatedAngle { - animVal: SVGAngle; - baseVal: SVGAngle; + readonly animVal: SVGAngle; + readonly baseVal: SVGAngle; } declare var SVGAnimatedAngle: { @@ -13861,7 +15154,7 @@ declare var SVGAnimatedAngle: { } interface SVGAnimatedBoolean { - animVal: boolean; + readonly animVal: boolean; baseVal: boolean; } @@ -13871,7 +15164,7 @@ declare var SVGAnimatedBoolean: { } interface SVGAnimatedEnumeration { - animVal: number; + readonly animVal: number; baseVal: number; } @@ -13881,7 +15174,7 @@ declare var SVGAnimatedEnumeration: { } interface SVGAnimatedInteger { - animVal: number; + readonly animVal: number; baseVal: number; } @@ -13891,8 +15184,8 @@ declare var SVGAnimatedInteger: { } interface SVGAnimatedLength { - animVal: SVGLength; - baseVal: SVGLength; + readonly animVal: SVGLength; + readonly baseVal: SVGLength; } declare var SVGAnimatedLength: { @@ -13901,8 +15194,8 @@ declare var SVGAnimatedLength: { } interface SVGAnimatedLengthList { - animVal: SVGLengthList; - baseVal: SVGLengthList; + readonly animVal: SVGLengthList; + readonly baseVal: SVGLengthList; } declare var SVGAnimatedLengthList: { @@ -13911,7 +15204,7 @@ declare var SVGAnimatedLengthList: { } interface SVGAnimatedNumber { - animVal: number; + readonly animVal: number; baseVal: number; } @@ -13921,8 +15214,8 @@ declare var SVGAnimatedNumber: { } interface SVGAnimatedNumberList { - animVal: SVGNumberList; - baseVal: SVGNumberList; + readonly animVal: SVGNumberList; + readonly baseVal: SVGNumberList; } declare var SVGAnimatedNumberList: { @@ -13931,8 +15224,8 @@ declare var SVGAnimatedNumberList: { } interface SVGAnimatedPreserveAspectRatio { - animVal: SVGPreserveAspectRatio; - baseVal: SVGPreserveAspectRatio; + readonly animVal: SVGPreserveAspectRatio; + readonly baseVal: SVGPreserveAspectRatio; } declare var SVGAnimatedPreserveAspectRatio: { @@ -13941,8 +15234,8 @@ declare var SVGAnimatedPreserveAspectRatio: { } interface SVGAnimatedRect { - animVal: SVGRect; - baseVal: SVGRect; + readonly animVal: SVGRect; + readonly baseVal: SVGRect; } declare var SVGAnimatedRect: { @@ -13951,7 +15244,7 @@ declare var SVGAnimatedRect: { } interface SVGAnimatedString { - animVal: string; + readonly animVal: string; baseVal: string; } @@ -13961,8 +15254,8 @@ declare var SVGAnimatedString: { } interface SVGAnimatedTransformList { - animVal: SVGTransformList; - baseVal: SVGTransformList; + readonly animVal: SVGTransformList; + readonly baseVal: SVGTransformList; } declare var SVGAnimatedTransformList: { @@ -13971,9 +15264,9 @@ declare var SVGAnimatedTransformList: { } interface SVGCircleElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - cx: SVGAnimatedLength; - cy: SVGAnimatedLength; - r: SVGAnimatedLength; + readonly cx: SVGAnimatedLength; + readonly cy: SVGAnimatedLength; + readonly r: SVGAnimatedLength; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -13983,7 +15276,7 @@ declare var SVGCircleElement: { } interface SVGClipPathElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGUnitTypes { - clipPathUnits: SVGAnimatedEnumeration; + readonly clipPathUnits: SVGAnimatedEnumeration; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -13993,30 +15286,30 @@ declare var SVGClipPathElement: { } interface SVGComponentTransferFunctionElement extends SVGElement { - amplitude: SVGAnimatedNumber; - exponent: SVGAnimatedNumber; - intercept: SVGAnimatedNumber; - offset: SVGAnimatedNumber; - slope: SVGAnimatedNumber; - tableValues: SVGAnimatedNumberList; - type: SVGAnimatedEnumeration; - SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number; - SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number; - SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number; - SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number; - SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number; - SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number; + readonly amplitude: SVGAnimatedNumber; + readonly exponent: SVGAnimatedNumber; + readonly intercept: SVGAnimatedNumber; + readonly offset: SVGAnimatedNumber; + readonly slope: SVGAnimatedNumber; + readonly tableValues: SVGAnimatedNumberList; + readonly type: SVGAnimatedEnumeration; + readonly SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number; } declare var SVGComponentTransferFunctionElement: { prototype: SVGComponentTransferFunctionElement; new(): SVGComponentTransferFunctionElement; - SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number; - SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number; - SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number; - SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number; - SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number; - SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number; } interface SVGDefsElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { @@ -14038,7 +15331,6 @@ declare var SVGDescElement: { } interface SVGElement extends Element { - id: string; onclick: (ev: MouseEvent) => any; ondblclick: (ev: MouseEvent) => any; onfocusin: (ev: FocusEvent) => any; @@ -14049,8 +15341,8 @@ interface SVGElement extends Element { onmouseout: (ev: MouseEvent) => any; onmouseover: (ev: MouseEvent) => any; onmouseup: (ev: MouseEvent) => any; - ownerSVGElement: SVGSVGElement; - viewportElement: SVGElement; + readonly ownerSVGElement: SVGSVGElement; + readonly viewportElement: SVGElement; xmlbase: string; className: any; addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; @@ -14108,14 +15400,14 @@ declare var SVGElement: { } interface SVGElementInstance extends EventTarget { - childNodes: SVGElementInstanceList; - correspondingElement: SVGElement; - correspondingUseElement: SVGUseElement; - firstChild: SVGElementInstance; - lastChild: SVGElementInstance; - nextSibling: SVGElementInstance; - parentNode: SVGElementInstance; - previousSibling: SVGElementInstance; + readonly childNodes: SVGElementInstanceList; + readonly correspondingElement: SVGElement; + readonly correspondingUseElement: SVGUseElement; + readonly firstChild: SVGElementInstance; + readonly lastChild: SVGElementInstance; + readonly nextSibling: SVGElementInstance; + readonly parentNode: SVGElementInstance; + readonly previousSibling: SVGElementInstance; } declare var SVGElementInstance: { @@ -14124,7 +15416,7 @@ declare var SVGElementInstance: { } interface SVGElementInstanceList { - length: number; + readonly length: number; item(index: number): SVGElementInstance; } @@ -14134,10 +15426,10 @@ declare var SVGElementInstanceList: { } interface SVGEllipseElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - cx: SVGAnimatedLength; - cy: SVGAnimatedLength; - rx: SVGAnimatedLength; - ry: SVGAnimatedLength; + readonly cx: SVGAnimatedLength; + readonly cy: SVGAnimatedLength; + readonly rx: SVGAnimatedLength; + readonly ry: SVGAnimatedLength; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -14147,75 +15439,75 @@ declare var SVGEllipseElement: { } interface SVGFEBlendElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in1: SVGAnimatedString; - in2: SVGAnimatedString; - mode: SVGAnimatedEnumeration; - SVG_FEBLEND_MODE_COLOR: number; - SVG_FEBLEND_MODE_COLOR_BURN: number; - SVG_FEBLEND_MODE_COLOR_DODGE: number; - SVG_FEBLEND_MODE_DARKEN: number; - SVG_FEBLEND_MODE_DIFFERENCE: number; - SVG_FEBLEND_MODE_EXCLUSION: number; - SVG_FEBLEND_MODE_HARD_LIGHT: number; - SVG_FEBLEND_MODE_HUE: number; - SVG_FEBLEND_MODE_LIGHTEN: number; - SVG_FEBLEND_MODE_LUMINOSITY: number; - SVG_FEBLEND_MODE_MULTIPLY: number; - SVG_FEBLEND_MODE_NORMAL: number; - SVG_FEBLEND_MODE_OVERLAY: number; - SVG_FEBLEND_MODE_SATURATION: number; - SVG_FEBLEND_MODE_SCREEN: number; - SVG_FEBLEND_MODE_SOFT_LIGHT: number; - SVG_FEBLEND_MODE_UNKNOWN: number; + readonly in1: SVGAnimatedString; + readonly in2: SVGAnimatedString; + readonly mode: SVGAnimatedEnumeration; + readonly SVG_FEBLEND_MODE_COLOR: number; + readonly SVG_FEBLEND_MODE_COLOR_BURN: number; + readonly SVG_FEBLEND_MODE_COLOR_DODGE: number; + readonly SVG_FEBLEND_MODE_DARKEN: number; + readonly SVG_FEBLEND_MODE_DIFFERENCE: number; + readonly SVG_FEBLEND_MODE_EXCLUSION: number; + readonly SVG_FEBLEND_MODE_HARD_LIGHT: number; + readonly SVG_FEBLEND_MODE_HUE: number; + readonly SVG_FEBLEND_MODE_LIGHTEN: number; + readonly SVG_FEBLEND_MODE_LUMINOSITY: number; + readonly SVG_FEBLEND_MODE_MULTIPLY: number; + readonly SVG_FEBLEND_MODE_NORMAL: number; + readonly SVG_FEBLEND_MODE_OVERLAY: number; + readonly SVG_FEBLEND_MODE_SATURATION: number; + readonly SVG_FEBLEND_MODE_SCREEN: number; + readonly SVG_FEBLEND_MODE_SOFT_LIGHT: number; + readonly SVG_FEBLEND_MODE_UNKNOWN: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGFEBlendElement: { prototype: SVGFEBlendElement; new(): SVGFEBlendElement; - SVG_FEBLEND_MODE_COLOR: number; - SVG_FEBLEND_MODE_COLOR_BURN: number; - SVG_FEBLEND_MODE_COLOR_DODGE: number; - SVG_FEBLEND_MODE_DARKEN: number; - SVG_FEBLEND_MODE_DIFFERENCE: number; - SVG_FEBLEND_MODE_EXCLUSION: number; - SVG_FEBLEND_MODE_HARD_LIGHT: number; - SVG_FEBLEND_MODE_HUE: number; - SVG_FEBLEND_MODE_LIGHTEN: number; - SVG_FEBLEND_MODE_LUMINOSITY: number; - SVG_FEBLEND_MODE_MULTIPLY: number; - SVG_FEBLEND_MODE_NORMAL: number; - SVG_FEBLEND_MODE_OVERLAY: number; - SVG_FEBLEND_MODE_SATURATION: number; - SVG_FEBLEND_MODE_SCREEN: number; - SVG_FEBLEND_MODE_SOFT_LIGHT: number; - SVG_FEBLEND_MODE_UNKNOWN: number; + readonly SVG_FEBLEND_MODE_COLOR: number; + readonly SVG_FEBLEND_MODE_COLOR_BURN: number; + readonly SVG_FEBLEND_MODE_COLOR_DODGE: number; + readonly SVG_FEBLEND_MODE_DARKEN: number; + readonly SVG_FEBLEND_MODE_DIFFERENCE: number; + readonly SVG_FEBLEND_MODE_EXCLUSION: number; + readonly SVG_FEBLEND_MODE_HARD_LIGHT: number; + readonly SVG_FEBLEND_MODE_HUE: number; + readonly SVG_FEBLEND_MODE_LIGHTEN: number; + readonly SVG_FEBLEND_MODE_LUMINOSITY: number; + readonly SVG_FEBLEND_MODE_MULTIPLY: number; + readonly SVG_FEBLEND_MODE_NORMAL: number; + readonly SVG_FEBLEND_MODE_OVERLAY: number; + readonly SVG_FEBLEND_MODE_SATURATION: number; + readonly SVG_FEBLEND_MODE_SCREEN: number; + readonly SVG_FEBLEND_MODE_SOFT_LIGHT: number; + readonly SVG_FEBLEND_MODE_UNKNOWN: number; } interface SVGFEColorMatrixElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in1: SVGAnimatedString; - type: SVGAnimatedEnumeration; - values: SVGAnimatedNumberList; - SVG_FECOLORMATRIX_TYPE_HUEROTATE: number; - SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number; - SVG_FECOLORMATRIX_TYPE_MATRIX: number; - SVG_FECOLORMATRIX_TYPE_SATURATE: number; - SVG_FECOLORMATRIX_TYPE_UNKNOWN: number; + readonly in1: SVGAnimatedString; + readonly type: SVGAnimatedEnumeration; + readonly values: SVGAnimatedNumberList; + readonly SVG_FECOLORMATRIX_TYPE_HUEROTATE: number; + readonly SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number; + readonly SVG_FECOLORMATRIX_TYPE_MATRIX: number; + readonly SVG_FECOLORMATRIX_TYPE_SATURATE: number; + readonly SVG_FECOLORMATRIX_TYPE_UNKNOWN: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGFEColorMatrixElement: { prototype: SVGFEColorMatrixElement; new(): SVGFEColorMatrixElement; - SVG_FECOLORMATRIX_TYPE_HUEROTATE: number; - SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number; - SVG_FECOLORMATRIX_TYPE_MATRIX: number; - SVG_FECOLORMATRIX_TYPE_SATURATE: number; - SVG_FECOLORMATRIX_TYPE_UNKNOWN: number; + readonly SVG_FECOLORMATRIX_TYPE_HUEROTATE: number; + readonly SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number; + readonly SVG_FECOLORMATRIX_TYPE_MATRIX: number; + readonly SVG_FECOLORMATRIX_TYPE_SATURATE: number; + readonly SVG_FECOLORMATRIX_TYPE_UNKNOWN: number; } interface SVGFEComponentTransferElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in1: SVGAnimatedString; + readonly in1: SVGAnimatedString; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -14225,70 +15517,70 @@ declare var SVGFEComponentTransferElement: { } interface SVGFECompositeElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in1: SVGAnimatedString; - in2: SVGAnimatedString; - k1: SVGAnimatedNumber; - k2: SVGAnimatedNumber; - k3: SVGAnimatedNumber; - k4: SVGAnimatedNumber; - operator: SVGAnimatedEnumeration; - SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number; - SVG_FECOMPOSITE_OPERATOR_ATOP: number; - SVG_FECOMPOSITE_OPERATOR_IN: number; - SVG_FECOMPOSITE_OPERATOR_OUT: number; - SVG_FECOMPOSITE_OPERATOR_OVER: number; - SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number; - SVG_FECOMPOSITE_OPERATOR_XOR: number; + readonly in1: SVGAnimatedString; + readonly in2: SVGAnimatedString; + readonly k1: SVGAnimatedNumber; + readonly k2: SVGAnimatedNumber; + readonly k3: SVGAnimatedNumber; + readonly k4: SVGAnimatedNumber; + readonly operator: SVGAnimatedEnumeration; + readonly SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number; + readonly SVG_FECOMPOSITE_OPERATOR_ATOP: number; + readonly SVG_FECOMPOSITE_OPERATOR_IN: number; + readonly SVG_FECOMPOSITE_OPERATOR_OUT: number; + readonly SVG_FECOMPOSITE_OPERATOR_OVER: number; + readonly SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number; + readonly SVG_FECOMPOSITE_OPERATOR_XOR: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGFECompositeElement: { prototype: SVGFECompositeElement; new(): SVGFECompositeElement; - SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number; - SVG_FECOMPOSITE_OPERATOR_ATOP: number; - SVG_FECOMPOSITE_OPERATOR_IN: number; - SVG_FECOMPOSITE_OPERATOR_OUT: number; - SVG_FECOMPOSITE_OPERATOR_OVER: number; - SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number; - SVG_FECOMPOSITE_OPERATOR_XOR: number; + readonly SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number; + readonly SVG_FECOMPOSITE_OPERATOR_ATOP: number; + readonly SVG_FECOMPOSITE_OPERATOR_IN: number; + readonly SVG_FECOMPOSITE_OPERATOR_OUT: number; + readonly SVG_FECOMPOSITE_OPERATOR_OVER: number; + readonly SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number; + readonly SVG_FECOMPOSITE_OPERATOR_XOR: number; } interface SVGFEConvolveMatrixElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - bias: SVGAnimatedNumber; - divisor: SVGAnimatedNumber; - edgeMode: SVGAnimatedEnumeration; - in1: SVGAnimatedString; - kernelMatrix: SVGAnimatedNumberList; - kernelUnitLengthX: SVGAnimatedNumber; - kernelUnitLengthY: SVGAnimatedNumber; - orderX: SVGAnimatedInteger; - orderY: SVGAnimatedInteger; - preserveAlpha: SVGAnimatedBoolean; - targetX: SVGAnimatedInteger; - targetY: SVGAnimatedInteger; - SVG_EDGEMODE_DUPLICATE: number; - SVG_EDGEMODE_NONE: number; - SVG_EDGEMODE_UNKNOWN: number; - SVG_EDGEMODE_WRAP: number; + readonly bias: SVGAnimatedNumber; + readonly divisor: SVGAnimatedNumber; + readonly edgeMode: SVGAnimatedEnumeration; + readonly in1: SVGAnimatedString; + readonly kernelMatrix: SVGAnimatedNumberList; + readonly kernelUnitLengthX: SVGAnimatedNumber; + readonly kernelUnitLengthY: SVGAnimatedNumber; + readonly orderX: SVGAnimatedInteger; + readonly orderY: SVGAnimatedInteger; + readonly preserveAlpha: SVGAnimatedBoolean; + readonly targetX: SVGAnimatedInteger; + readonly targetY: SVGAnimatedInteger; + readonly SVG_EDGEMODE_DUPLICATE: number; + readonly SVG_EDGEMODE_NONE: number; + readonly SVG_EDGEMODE_UNKNOWN: number; + readonly SVG_EDGEMODE_WRAP: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGFEConvolveMatrixElement: { prototype: SVGFEConvolveMatrixElement; new(): SVGFEConvolveMatrixElement; - SVG_EDGEMODE_DUPLICATE: number; - SVG_EDGEMODE_NONE: number; - SVG_EDGEMODE_UNKNOWN: number; - SVG_EDGEMODE_WRAP: number; + readonly SVG_EDGEMODE_DUPLICATE: number; + readonly SVG_EDGEMODE_NONE: number; + readonly SVG_EDGEMODE_UNKNOWN: number; + readonly SVG_EDGEMODE_WRAP: number; } interface SVGFEDiffuseLightingElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - diffuseConstant: SVGAnimatedNumber; - in1: SVGAnimatedString; - kernelUnitLengthX: SVGAnimatedNumber; - kernelUnitLengthY: SVGAnimatedNumber; - surfaceScale: SVGAnimatedNumber; + readonly diffuseConstant: SVGAnimatedNumber; + readonly in1: SVGAnimatedString; + readonly kernelUnitLengthX: SVGAnimatedNumber; + readonly kernelUnitLengthY: SVGAnimatedNumber; + readonly surfaceScale: SVGAnimatedNumber; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -14298,32 +15590,32 @@ declare var SVGFEDiffuseLightingElement: { } interface SVGFEDisplacementMapElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in1: SVGAnimatedString; - in2: SVGAnimatedString; - scale: SVGAnimatedNumber; - xChannelSelector: SVGAnimatedEnumeration; - yChannelSelector: SVGAnimatedEnumeration; - SVG_CHANNEL_A: number; - SVG_CHANNEL_B: number; - SVG_CHANNEL_G: number; - SVG_CHANNEL_R: number; - SVG_CHANNEL_UNKNOWN: number; + readonly in1: SVGAnimatedString; + readonly in2: SVGAnimatedString; + readonly scale: SVGAnimatedNumber; + readonly xChannelSelector: SVGAnimatedEnumeration; + readonly yChannelSelector: SVGAnimatedEnumeration; + readonly SVG_CHANNEL_A: number; + readonly SVG_CHANNEL_B: number; + readonly SVG_CHANNEL_G: number; + readonly SVG_CHANNEL_R: number; + readonly SVG_CHANNEL_UNKNOWN: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGFEDisplacementMapElement: { prototype: SVGFEDisplacementMapElement; new(): SVGFEDisplacementMapElement; - SVG_CHANNEL_A: number; - SVG_CHANNEL_B: number; - SVG_CHANNEL_G: number; - SVG_CHANNEL_R: number; - SVG_CHANNEL_UNKNOWN: number; + readonly SVG_CHANNEL_A: number; + readonly SVG_CHANNEL_B: number; + readonly SVG_CHANNEL_G: number; + readonly SVG_CHANNEL_R: number; + readonly SVG_CHANNEL_UNKNOWN: number; } interface SVGFEDistantLightElement extends SVGElement { - azimuth: SVGAnimatedNumber; - elevation: SVGAnimatedNumber; + readonly azimuth: SVGAnimatedNumber; + readonly elevation: SVGAnimatedNumber; } declare var SVGFEDistantLightElement: { @@ -14373,9 +15665,9 @@ declare var SVGFEFuncRElement: { } interface SVGFEGaussianBlurElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in1: SVGAnimatedString; - stdDeviationX: SVGAnimatedNumber; - stdDeviationY: SVGAnimatedNumber; + readonly in1: SVGAnimatedString; + readonly stdDeviationX: SVGAnimatedNumber; + readonly stdDeviationY: SVGAnimatedNumber; setStdDeviation(stdDeviationX: number, stdDeviationY: number): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -14386,7 +15678,7 @@ declare var SVGFEGaussianBlurElement: { } interface SVGFEImageElement extends SVGElement, SVGFilterPrimitiveStandardAttributes, SVGLangSpace, SVGURIReference, SVGExternalResourcesRequired { - preserveAspectRatio: SVGAnimatedPreserveAspectRatio; + readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -14405,7 +15697,7 @@ declare var SVGFEMergeElement: { } interface SVGFEMergeNodeElement extends SVGElement { - in1: SVGAnimatedString; + readonly in1: SVGAnimatedString; } declare var SVGFEMergeNodeElement: { @@ -14414,28 +15706,28 @@ declare var SVGFEMergeNodeElement: { } interface SVGFEMorphologyElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in1: SVGAnimatedString; - operator: SVGAnimatedEnumeration; - radiusX: SVGAnimatedNumber; - radiusY: SVGAnimatedNumber; - SVG_MORPHOLOGY_OPERATOR_DILATE: number; - SVG_MORPHOLOGY_OPERATOR_ERODE: number; - SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number; + readonly in1: SVGAnimatedString; + readonly operator: SVGAnimatedEnumeration; + readonly radiusX: SVGAnimatedNumber; + readonly radiusY: SVGAnimatedNumber; + readonly SVG_MORPHOLOGY_OPERATOR_DILATE: number; + readonly SVG_MORPHOLOGY_OPERATOR_ERODE: number; + readonly SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGFEMorphologyElement: { prototype: SVGFEMorphologyElement; new(): SVGFEMorphologyElement; - SVG_MORPHOLOGY_OPERATOR_DILATE: number; - SVG_MORPHOLOGY_OPERATOR_ERODE: number; - SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number; + readonly SVG_MORPHOLOGY_OPERATOR_DILATE: number; + readonly SVG_MORPHOLOGY_OPERATOR_ERODE: number; + readonly SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number; } interface SVGFEOffsetElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - dx: SVGAnimatedNumber; - dy: SVGAnimatedNumber; - in1: SVGAnimatedString; + readonly dx: SVGAnimatedNumber; + readonly dy: SVGAnimatedNumber; + readonly in1: SVGAnimatedString; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -14445,9 +15737,9 @@ declare var SVGFEOffsetElement: { } interface SVGFEPointLightElement extends SVGElement { - x: SVGAnimatedNumber; - y: SVGAnimatedNumber; - z: SVGAnimatedNumber; + readonly x: SVGAnimatedNumber; + readonly y: SVGAnimatedNumber; + readonly z: SVGAnimatedNumber; } declare var SVGFEPointLightElement: { @@ -14456,12 +15748,12 @@ declare var SVGFEPointLightElement: { } interface SVGFESpecularLightingElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in1: SVGAnimatedString; - kernelUnitLengthX: SVGAnimatedNumber; - kernelUnitLengthY: SVGAnimatedNumber; - specularConstant: SVGAnimatedNumber; - specularExponent: SVGAnimatedNumber; - surfaceScale: SVGAnimatedNumber; + readonly in1: SVGAnimatedString; + readonly kernelUnitLengthX: SVGAnimatedNumber; + readonly kernelUnitLengthY: SVGAnimatedNumber; + readonly specularConstant: SVGAnimatedNumber; + readonly specularExponent: SVGAnimatedNumber; + readonly surfaceScale: SVGAnimatedNumber; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -14471,14 +15763,14 @@ declare var SVGFESpecularLightingElement: { } interface SVGFESpotLightElement extends SVGElement { - limitingConeAngle: SVGAnimatedNumber; - pointsAtX: SVGAnimatedNumber; - pointsAtY: SVGAnimatedNumber; - pointsAtZ: SVGAnimatedNumber; - specularExponent: SVGAnimatedNumber; - x: SVGAnimatedNumber; - y: SVGAnimatedNumber; - z: SVGAnimatedNumber; + readonly limitingConeAngle: SVGAnimatedNumber; + readonly pointsAtX: SVGAnimatedNumber; + readonly pointsAtY: SVGAnimatedNumber; + readonly pointsAtZ: SVGAnimatedNumber; + readonly specularExponent: SVGAnimatedNumber; + readonly x: SVGAnimatedNumber; + readonly y: SVGAnimatedNumber; + readonly z: SVGAnimatedNumber; } declare var SVGFESpotLightElement: { @@ -14487,7 +15779,7 @@ declare var SVGFESpotLightElement: { } interface SVGFETileElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in1: SVGAnimatedString; + readonly in1: SVGAnimatedString; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -14497,41 +15789,41 @@ declare var SVGFETileElement: { } interface SVGFETurbulenceElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - baseFrequencyX: SVGAnimatedNumber; - baseFrequencyY: SVGAnimatedNumber; - numOctaves: SVGAnimatedInteger; - seed: SVGAnimatedNumber; - stitchTiles: SVGAnimatedEnumeration; - type: SVGAnimatedEnumeration; - SVG_STITCHTYPE_NOSTITCH: number; - SVG_STITCHTYPE_STITCH: number; - SVG_STITCHTYPE_UNKNOWN: number; - SVG_TURBULENCE_TYPE_FRACTALNOISE: number; - SVG_TURBULENCE_TYPE_TURBULENCE: number; - SVG_TURBULENCE_TYPE_UNKNOWN: number; + readonly baseFrequencyX: SVGAnimatedNumber; + readonly baseFrequencyY: SVGAnimatedNumber; + readonly numOctaves: SVGAnimatedInteger; + readonly seed: SVGAnimatedNumber; + readonly stitchTiles: SVGAnimatedEnumeration; + readonly type: SVGAnimatedEnumeration; + readonly SVG_STITCHTYPE_NOSTITCH: number; + readonly SVG_STITCHTYPE_STITCH: number; + readonly SVG_STITCHTYPE_UNKNOWN: number; + readonly SVG_TURBULENCE_TYPE_FRACTALNOISE: number; + readonly SVG_TURBULENCE_TYPE_TURBULENCE: number; + readonly SVG_TURBULENCE_TYPE_UNKNOWN: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGFETurbulenceElement: { prototype: SVGFETurbulenceElement; new(): SVGFETurbulenceElement; - SVG_STITCHTYPE_NOSTITCH: number; - SVG_STITCHTYPE_STITCH: number; - SVG_STITCHTYPE_UNKNOWN: number; - SVG_TURBULENCE_TYPE_FRACTALNOISE: number; - SVG_TURBULENCE_TYPE_TURBULENCE: number; - SVG_TURBULENCE_TYPE_UNKNOWN: number; + readonly SVG_STITCHTYPE_NOSTITCH: number; + readonly SVG_STITCHTYPE_STITCH: number; + readonly SVG_STITCHTYPE_UNKNOWN: number; + readonly SVG_TURBULENCE_TYPE_FRACTALNOISE: number; + readonly SVG_TURBULENCE_TYPE_TURBULENCE: number; + readonly SVG_TURBULENCE_TYPE_UNKNOWN: number; } interface SVGFilterElement extends SVGElement, SVGUnitTypes, SVGStylable, SVGLangSpace, SVGURIReference, SVGExternalResourcesRequired { - filterResX: SVGAnimatedInteger; - filterResY: SVGAnimatedInteger; - filterUnits: SVGAnimatedEnumeration; - height: SVGAnimatedLength; - primitiveUnits: SVGAnimatedEnumeration; - width: SVGAnimatedLength; - x: SVGAnimatedLength; - y: SVGAnimatedLength; + readonly filterResX: SVGAnimatedInteger; + readonly filterResY: SVGAnimatedInteger; + readonly filterUnits: SVGAnimatedEnumeration; + readonly height: SVGAnimatedLength; + readonly primitiveUnits: SVGAnimatedEnumeration; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; setFilterRes(filterResX: number, filterResY: number): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -14542,10 +15834,10 @@ declare var SVGFilterElement: { } interface SVGForeignObjectElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - height: SVGAnimatedLength; - width: SVGAnimatedLength; - x: SVGAnimatedLength; - y: SVGAnimatedLength; + readonly height: SVGAnimatedLength; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -14564,31 +15856,31 @@ declare var SVGGElement: { } interface SVGGradientElement extends SVGElement, SVGStylable, SVGExternalResourcesRequired, SVGURIReference, SVGUnitTypes { - gradientTransform: SVGAnimatedTransformList; - gradientUnits: SVGAnimatedEnumeration; - spreadMethod: SVGAnimatedEnumeration; - SVG_SPREADMETHOD_PAD: number; - SVG_SPREADMETHOD_REFLECT: number; - SVG_SPREADMETHOD_REPEAT: number; - SVG_SPREADMETHOD_UNKNOWN: number; + readonly gradientTransform: SVGAnimatedTransformList; + readonly gradientUnits: SVGAnimatedEnumeration; + readonly spreadMethod: SVGAnimatedEnumeration; + readonly SVG_SPREADMETHOD_PAD: number; + readonly SVG_SPREADMETHOD_REFLECT: number; + readonly SVG_SPREADMETHOD_REPEAT: number; + readonly SVG_SPREADMETHOD_UNKNOWN: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGGradientElement: { prototype: SVGGradientElement; new(): SVGGradientElement; - SVG_SPREADMETHOD_PAD: number; - SVG_SPREADMETHOD_REFLECT: number; - SVG_SPREADMETHOD_REPEAT: number; - SVG_SPREADMETHOD_UNKNOWN: number; + readonly SVG_SPREADMETHOD_PAD: number; + readonly SVG_SPREADMETHOD_REFLECT: number; + readonly SVG_SPREADMETHOD_REPEAT: number; + readonly SVG_SPREADMETHOD_UNKNOWN: number; } interface SVGImageElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference { - height: SVGAnimatedLength; - preserveAspectRatio: SVGAnimatedPreserveAspectRatio; - width: SVGAnimatedLength; - x: SVGAnimatedLength; - y: SVGAnimatedLength; + readonly height: SVGAnimatedLength; + readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -14598,43 +15890,43 @@ declare var SVGImageElement: { } interface SVGLength { - unitType: number; + readonly unitType: number; value: number; valueAsString: string; valueInSpecifiedUnits: number; convertToSpecifiedUnits(unitType: number): void; newValueSpecifiedUnits(unitType: number, valueInSpecifiedUnits: number): void; - SVG_LENGTHTYPE_CM: number; - SVG_LENGTHTYPE_EMS: number; - SVG_LENGTHTYPE_EXS: number; - SVG_LENGTHTYPE_IN: number; - SVG_LENGTHTYPE_MM: number; - SVG_LENGTHTYPE_NUMBER: number; - SVG_LENGTHTYPE_PC: number; - SVG_LENGTHTYPE_PERCENTAGE: number; - SVG_LENGTHTYPE_PT: number; - SVG_LENGTHTYPE_PX: number; - SVG_LENGTHTYPE_UNKNOWN: number; + readonly SVG_LENGTHTYPE_CM: number; + readonly SVG_LENGTHTYPE_EMS: number; + readonly SVG_LENGTHTYPE_EXS: number; + readonly SVG_LENGTHTYPE_IN: number; + readonly SVG_LENGTHTYPE_MM: number; + readonly SVG_LENGTHTYPE_NUMBER: number; + readonly SVG_LENGTHTYPE_PC: number; + readonly SVG_LENGTHTYPE_PERCENTAGE: number; + readonly SVG_LENGTHTYPE_PT: number; + readonly SVG_LENGTHTYPE_PX: number; + readonly SVG_LENGTHTYPE_UNKNOWN: number; } declare var SVGLength: { prototype: SVGLength; new(): SVGLength; - SVG_LENGTHTYPE_CM: number; - SVG_LENGTHTYPE_EMS: number; - SVG_LENGTHTYPE_EXS: number; - SVG_LENGTHTYPE_IN: number; - SVG_LENGTHTYPE_MM: number; - SVG_LENGTHTYPE_NUMBER: number; - SVG_LENGTHTYPE_PC: number; - SVG_LENGTHTYPE_PERCENTAGE: number; - SVG_LENGTHTYPE_PT: number; - SVG_LENGTHTYPE_PX: number; - SVG_LENGTHTYPE_UNKNOWN: number; + readonly SVG_LENGTHTYPE_CM: number; + readonly SVG_LENGTHTYPE_EMS: number; + readonly SVG_LENGTHTYPE_EXS: number; + readonly SVG_LENGTHTYPE_IN: number; + readonly SVG_LENGTHTYPE_MM: number; + readonly SVG_LENGTHTYPE_NUMBER: number; + readonly SVG_LENGTHTYPE_PC: number; + readonly SVG_LENGTHTYPE_PERCENTAGE: number; + readonly SVG_LENGTHTYPE_PT: number; + readonly SVG_LENGTHTYPE_PX: number; + readonly SVG_LENGTHTYPE_UNKNOWN: number; } interface SVGLengthList { - numberOfItems: number; + readonly numberOfItems: number; appendItem(newItem: SVGLength): SVGLength; clear(): void; getItem(index: number): SVGLength; @@ -14650,10 +15942,10 @@ declare var SVGLengthList: { } interface SVGLineElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - x1: SVGAnimatedLength; - x2: SVGAnimatedLength; - y1: SVGAnimatedLength; - y2: SVGAnimatedLength; + readonly x1: SVGAnimatedLength; + readonly x2: SVGAnimatedLength; + readonly y1: SVGAnimatedLength; + readonly y2: SVGAnimatedLength; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -14663,10 +15955,10 @@ declare var SVGLineElement: { } interface SVGLinearGradientElement extends SVGGradientElement { - x1: SVGAnimatedLength; - x2: SVGAnimatedLength; - y1: SVGAnimatedLength; - y2: SVGAnimatedLength; + readonly x1: SVGAnimatedLength; + readonly x2: SVGAnimatedLength; + readonly y1: SVGAnimatedLength; + readonly y2: SVGAnimatedLength; } declare var SVGLinearGradientElement: { @@ -14675,42 +15967,42 @@ declare var SVGLinearGradientElement: { } interface SVGMarkerElement extends SVGElement, SVGStylable, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox { - markerHeight: SVGAnimatedLength; - markerUnits: SVGAnimatedEnumeration; - markerWidth: SVGAnimatedLength; - orientAngle: SVGAnimatedAngle; - orientType: SVGAnimatedEnumeration; - refX: SVGAnimatedLength; - refY: SVGAnimatedLength; + readonly markerHeight: SVGAnimatedLength; + readonly markerUnits: SVGAnimatedEnumeration; + readonly markerWidth: SVGAnimatedLength; + readonly orientAngle: SVGAnimatedAngle; + readonly orientType: SVGAnimatedEnumeration; + readonly refX: SVGAnimatedLength; + readonly refY: SVGAnimatedLength; setOrientToAngle(angle: SVGAngle): void; setOrientToAuto(): void; - SVG_MARKERUNITS_STROKEWIDTH: number; - SVG_MARKERUNITS_UNKNOWN: number; - SVG_MARKERUNITS_USERSPACEONUSE: number; - SVG_MARKER_ORIENT_ANGLE: number; - SVG_MARKER_ORIENT_AUTO: number; - SVG_MARKER_ORIENT_UNKNOWN: number; + readonly SVG_MARKERUNITS_STROKEWIDTH: number; + readonly SVG_MARKERUNITS_UNKNOWN: number; + readonly SVG_MARKERUNITS_USERSPACEONUSE: number; + readonly SVG_MARKER_ORIENT_ANGLE: number; + readonly SVG_MARKER_ORIENT_AUTO: number; + readonly SVG_MARKER_ORIENT_UNKNOWN: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGMarkerElement: { prototype: SVGMarkerElement; new(): SVGMarkerElement; - SVG_MARKERUNITS_STROKEWIDTH: number; - SVG_MARKERUNITS_UNKNOWN: number; - SVG_MARKERUNITS_USERSPACEONUSE: number; - SVG_MARKER_ORIENT_ANGLE: number; - SVG_MARKER_ORIENT_AUTO: number; - SVG_MARKER_ORIENT_UNKNOWN: number; + readonly SVG_MARKERUNITS_STROKEWIDTH: number; + readonly SVG_MARKERUNITS_UNKNOWN: number; + readonly SVG_MARKERUNITS_USERSPACEONUSE: number; + readonly SVG_MARKER_ORIENT_ANGLE: number; + readonly SVG_MARKER_ORIENT_AUTO: number; + readonly SVG_MARKER_ORIENT_UNKNOWN: number; } interface SVGMaskElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGUnitTypes { - height: SVGAnimatedLength; - maskContentUnits: SVGAnimatedEnumeration; - maskUnits: SVGAnimatedEnumeration; - width: SVGAnimatedLength; - x: SVGAnimatedLength; - y: SVGAnimatedLength; + readonly height: SVGAnimatedLength; + readonly maskContentUnits: SVGAnimatedEnumeration; + readonly maskUnits: SVGAnimatedEnumeration; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -14762,7 +16054,7 @@ declare var SVGNumber: { } interface SVGNumberList { - numberOfItems: number; + readonly numberOfItems: number; appendItem(newItem: SVGNumber): SVGNumber; clear(): void; getItem(index: number): SVGNumber; @@ -14809,53 +16101,53 @@ declare var SVGPathElement: { } interface SVGPathSeg { - pathSegType: number; - pathSegTypeAsLetter: string; - PATHSEG_ARC_ABS: number; - PATHSEG_ARC_REL: number; - PATHSEG_CLOSEPATH: number; - PATHSEG_CURVETO_CUBIC_ABS: number; - PATHSEG_CURVETO_CUBIC_REL: number; - PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number; - PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number; - PATHSEG_CURVETO_QUADRATIC_ABS: number; - PATHSEG_CURVETO_QUADRATIC_REL: number; - PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number; - PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number; - PATHSEG_LINETO_ABS: number; - PATHSEG_LINETO_HORIZONTAL_ABS: number; - PATHSEG_LINETO_HORIZONTAL_REL: number; - PATHSEG_LINETO_REL: number; - PATHSEG_LINETO_VERTICAL_ABS: number; - PATHSEG_LINETO_VERTICAL_REL: number; - PATHSEG_MOVETO_ABS: number; - PATHSEG_MOVETO_REL: number; - PATHSEG_UNKNOWN: number; + readonly pathSegType: number; + readonly pathSegTypeAsLetter: string; + readonly PATHSEG_ARC_ABS: number; + readonly PATHSEG_ARC_REL: number; + readonly PATHSEG_CLOSEPATH: number; + readonly PATHSEG_CURVETO_CUBIC_ABS: number; + readonly PATHSEG_CURVETO_CUBIC_REL: number; + readonly PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number; + readonly PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number; + readonly PATHSEG_CURVETO_QUADRATIC_ABS: number; + readonly PATHSEG_CURVETO_QUADRATIC_REL: number; + readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number; + readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number; + readonly PATHSEG_LINETO_ABS: number; + readonly PATHSEG_LINETO_HORIZONTAL_ABS: number; + readonly PATHSEG_LINETO_HORIZONTAL_REL: number; + readonly PATHSEG_LINETO_REL: number; + readonly PATHSEG_LINETO_VERTICAL_ABS: number; + readonly PATHSEG_LINETO_VERTICAL_REL: number; + readonly PATHSEG_MOVETO_ABS: number; + readonly PATHSEG_MOVETO_REL: number; + readonly PATHSEG_UNKNOWN: number; } declare var SVGPathSeg: { prototype: SVGPathSeg; new(): SVGPathSeg; - PATHSEG_ARC_ABS: number; - PATHSEG_ARC_REL: number; - PATHSEG_CLOSEPATH: number; - PATHSEG_CURVETO_CUBIC_ABS: number; - PATHSEG_CURVETO_CUBIC_REL: number; - PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number; - PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number; - PATHSEG_CURVETO_QUADRATIC_ABS: number; - PATHSEG_CURVETO_QUADRATIC_REL: number; - PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number; - PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number; - PATHSEG_LINETO_ABS: number; - PATHSEG_LINETO_HORIZONTAL_ABS: number; - PATHSEG_LINETO_HORIZONTAL_REL: number; - PATHSEG_LINETO_REL: number; - PATHSEG_LINETO_VERTICAL_ABS: number; - PATHSEG_LINETO_VERTICAL_REL: number; - PATHSEG_MOVETO_ABS: number; - PATHSEG_MOVETO_REL: number; - PATHSEG_UNKNOWN: number; + readonly PATHSEG_ARC_ABS: number; + readonly PATHSEG_ARC_REL: number; + readonly PATHSEG_CLOSEPATH: number; + readonly PATHSEG_CURVETO_CUBIC_ABS: number; + readonly PATHSEG_CURVETO_CUBIC_REL: number; + readonly PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number; + readonly PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number; + readonly PATHSEG_CURVETO_QUADRATIC_ABS: number; + readonly PATHSEG_CURVETO_QUADRATIC_REL: number; + readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number; + readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number; + readonly PATHSEG_LINETO_ABS: number; + readonly PATHSEG_LINETO_HORIZONTAL_ABS: number; + readonly PATHSEG_LINETO_HORIZONTAL_REL: number; + readonly PATHSEG_LINETO_REL: number; + readonly PATHSEG_LINETO_VERTICAL_ABS: number; + readonly PATHSEG_LINETO_VERTICAL_REL: number; + readonly PATHSEG_MOVETO_ABS: number; + readonly PATHSEG_MOVETO_REL: number; + readonly PATHSEG_UNKNOWN: number; } interface SVGPathSegArcAbs extends SVGPathSeg { @@ -15049,7 +16341,7 @@ declare var SVGPathSegLinetoVerticalRel: { } interface SVGPathSegList { - numberOfItems: number; + readonly numberOfItems: number; appendItem(newItem: SVGPathSeg): SVGPathSeg; clear(): void; getItem(index: number): SVGPathSeg; @@ -15085,13 +16377,13 @@ declare var SVGPathSegMovetoRel: { } interface SVGPatternElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox, SVGURIReference, SVGUnitTypes { - height: SVGAnimatedLength; - patternContentUnits: SVGAnimatedEnumeration; - patternTransform: SVGAnimatedTransformList; - patternUnits: SVGAnimatedEnumeration; - width: SVGAnimatedLength; - x: SVGAnimatedLength; - y: SVGAnimatedLength; + readonly height: SVGAnimatedLength; + readonly patternContentUnits: SVGAnimatedEnumeration; + readonly patternTransform: SVGAnimatedTransformList; + readonly patternUnits: SVGAnimatedEnumeration; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -15112,7 +16404,7 @@ declare var SVGPoint: { } interface SVGPointList { - numberOfItems: number; + readonly numberOfItems: number; appendItem(newItem: SVGPoint): SVGPoint; clear(): void; getItem(index: number): SVGPoint; @@ -15148,47 +16440,47 @@ declare var SVGPolylineElement: { interface SVGPreserveAspectRatio { align: number; meetOrSlice: number; - SVG_MEETORSLICE_MEET: number; - SVG_MEETORSLICE_SLICE: number; - SVG_MEETORSLICE_UNKNOWN: number; - SVG_PRESERVEASPECTRATIO_NONE: number; - SVG_PRESERVEASPECTRATIO_UNKNOWN: number; - SVG_PRESERVEASPECTRATIO_XMAXYMAX: number; - SVG_PRESERVEASPECTRATIO_XMAXYMID: number; - SVG_PRESERVEASPECTRATIO_XMAXYMIN: number; - SVG_PRESERVEASPECTRATIO_XMIDYMAX: number; - SVG_PRESERVEASPECTRATIO_XMIDYMID: number; - SVG_PRESERVEASPECTRATIO_XMIDYMIN: number; - SVG_PRESERVEASPECTRATIO_XMINYMAX: number; - SVG_PRESERVEASPECTRATIO_XMINYMID: number; - SVG_PRESERVEASPECTRATIO_XMINYMIN: number; + readonly SVG_MEETORSLICE_MEET: number; + readonly SVG_MEETORSLICE_SLICE: number; + readonly SVG_MEETORSLICE_UNKNOWN: number; + readonly SVG_PRESERVEASPECTRATIO_NONE: number; + readonly SVG_PRESERVEASPECTRATIO_UNKNOWN: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMIN: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMIN: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMIN: number; } declare var SVGPreserveAspectRatio: { prototype: SVGPreserveAspectRatio; new(): SVGPreserveAspectRatio; - SVG_MEETORSLICE_MEET: number; - SVG_MEETORSLICE_SLICE: number; - SVG_MEETORSLICE_UNKNOWN: number; - SVG_PRESERVEASPECTRATIO_NONE: number; - SVG_PRESERVEASPECTRATIO_UNKNOWN: number; - SVG_PRESERVEASPECTRATIO_XMAXYMAX: number; - SVG_PRESERVEASPECTRATIO_XMAXYMID: number; - SVG_PRESERVEASPECTRATIO_XMAXYMIN: number; - SVG_PRESERVEASPECTRATIO_XMIDYMAX: number; - SVG_PRESERVEASPECTRATIO_XMIDYMID: number; - SVG_PRESERVEASPECTRATIO_XMIDYMIN: number; - SVG_PRESERVEASPECTRATIO_XMINYMAX: number; - SVG_PRESERVEASPECTRATIO_XMINYMID: number; - SVG_PRESERVEASPECTRATIO_XMINYMIN: number; + readonly SVG_MEETORSLICE_MEET: number; + readonly SVG_MEETORSLICE_SLICE: number; + readonly SVG_MEETORSLICE_UNKNOWN: number; + readonly SVG_PRESERVEASPECTRATIO_NONE: number; + readonly SVG_PRESERVEASPECTRATIO_UNKNOWN: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMIN: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMIN: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMIN: number; } interface SVGRadialGradientElement extends SVGGradientElement { - cx: SVGAnimatedLength; - cy: SVGAnimatedLength; - fx: SVGAnimatedLength; - fy: SVGAnimatedLength; - r: SVGAnimatedLength; + readonly cx: SVGAnimatedLength; + readonly cy: SVGAnimatedLength; + readonly fx: SVGAnimatedLength; + readonly fy: SVGAnimatedLength; + readonly r: SVGAnimatedLength; } declare var SVGRadialGradientElement: { @@ -15209,12 +16501,12 @@ declare var SVGRect: { } interface SVGRectElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - height: SVGAnimatedLength; - rx: SVGAnimatedLength; - ry: SVGAnimatedLength; - width: SVGAnimatedLength; - x: SVGAnimatedLength; - y: SVGAnimatedLength; + readonly height: SVGAnimatedLength; + readonly rx: SVGAnimatedLength; + readonly ry: SVGAnimatedLength; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -15227,22 +16519,22 @@ interface SVGSVGElement extends SVGElement, DocumentEvent, SVGLocatable, SVGTest contentScriptType: string; contentStyleType: string; currentScale: number; - currentTranslate: SVGPoint; - height: SVGAnimatedLength; + readonly currentTranslate: SVGPoint; + readonly height: SVGAnimatedLength; onabort: (ev: Event) => any; onerror: (ev: Event) => any; onresize: (ev: UIEvent) => any; onscroll: (ev: UIEvent) => any; onunload: (ev: Event) => any; onzoom: (ev: SVGZoomEvent) => any; - pixelUnitToMillimeterX: number; - pixelUnitToMillimeterY: number; - screenPixelToMillimeterX: number; - screenPixelToMillimeterY: number; - viewport: SVGRect; - width: SVGAnimatedLength; - x: SVGAnimatedLength; - y: SVGAnimatedLength; + readonly pixelUnitToMillimeterX: number; + readonly pixelUnitToMillimeterY: number; + readonly screenPixelToMillimeterX: number; + readonly screenPixelToMillimeterY: number; + readonly viewport: SVGRect; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; checkEnclosure(element: SVGElement, rect: SVGRect): boolean; checkIntersection(element: SVGElement, rect: SVGRect): boolean; createSVGAngle(): SVGAngle; @@ -15258,8 +16550,8 @@ interface SVGSVGElement extends SVGElement, DocumentEvent, SVGLocatable, SVGTest getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration; getCurrentTime(): number; getElementById(elementId: string): Element; - getEnclosureList(rect: SVGRect, referenceElement: SVGElement): NodeList; - getIntersectionList(rect: SVGRect, referenceElement: SVGElement): NodeList; + getEnclosureList(rect: SVGRect, referenceElement: SVGElement): NodeListOf; + getIntersectionList(rect: SVGRect, referenceElement: SVGElement): NodeListOf; pauseAnimations(): void; setCurrentTime(seconds: number): void; suspendRedraw(maxWaitMilliseconds: number): number; @@ -15337,7 +16629,7 @@ declare var SVGScriptElement: { } interface SVGStopElement extends SVGElement, SVGStylable { - offset: SVGAnimatedNumber; + readonly offset: SVGAnimatedNumber; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -15347,7 +16639,7 @@ declare var SVGStopElement: { } interface SVGStringList { - numberOfItems: number; + readonly numberOfItems: number; appendItem(newItem: string): string; clear(): void; getItem(index: number): string; @@ -15363,6 +16655,7 @@ declare var SVGStringList: { } interface SVGStyleElement extends SVGElement, SVGLangSpace { + disabled: boolean; media: string; title: string; type: string; @@ -15401,8 +16694,8 @@ declare var SVGTSpanElement: { } interface SVGTextContentElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - lengthAdjust: SVGAnimatedEnumeration; - textLength: SVGAnimatedLength; + readonly lengthAdjust: SVGAnimatedEnumeration; + readonly textLength: SVGAnimatedLength; getCharNumAtPosition(point: SVGPoint): number; getComputedTextLength(): number; getEndPositionOfChar(charnum: number): SVGPoint; @@ -15412,18 +16705,18 @@ interface SVGTextContentElement extends SVGElement, SVGStylable, SVGTests, SVGLa getStartPositionOfChar(charnum: number): SVGPoint; getSubStringLength(charnum: number, nchars: number): number; selectSubString(charnum: number, nchars: number): void; - LENGTHADJUST_SPACING: number; - LENGTHADJUST_SPACINGANDGLYPHS: number; - LENGTHADJUST_UNKNOWN: number; + readonly LENGTHADJUST_SPACING: number; + readonly LENGTHADJUST_SPACINGANDGLYPHS: number; + readonly LENGTHADJUST_UNKNOWN: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGTextContentElement: { prototype: SVGTextContentElement; new(): SVGTextContentElement; - LENGTHADJUST_SPACING: number; - LENGTHADJUST_SPACINGANDGLYPHS: number; - LENGTHADJUST_UNKNOWN: number; + readonly LENGTHADJUST_SPACING: number; + readonly LENGTHADJUST_SPACINGANDGLYPHS: number; + readonly LENGTHADJUST_UNKNOWN: number; } interface SVGTextElement extends SVGTextPositioningElement, SVGTransformable { @@ -15436,35 +16729,35 @@ declare var SVGTextElement: { } interface SVGTextPathElement extends SVGTextContentElement, SVGURIReference { - method: SVGAnimatedEnumeration; - spacing: SVGAnimatedEnumeration; - startOffset: SVGAnimatedLength; - TEXTPATH_METHODTYPE_ALIGN: number; - TEXTPATH_METHODTYPE_STRETCH: number; - TEXTPATH_METHODTYPE_UNKNOWN: number; - TEXTPATH_SPACINGTYPE_AUTO: number; - TEXTPATH_SPACINGTYPE_EXACT: number; - TEXTPATH_SPACINGTYPE_UNKNOWN: number; + readonly method: SVGAnimatedEnumeration; + readonly spacing: SVGAnimatedEnumeration; + readonly startOffset: SVGAnimatedLength; + readonly TEXTPATH_METHODTYPE_ALIGN: number; + readonly TEXTPATH_METHODTYPE_STRETCH: number; + readonly TEXTPATH_METHODTYPE_UNKNOWN: number; + readonly TEXTPATH_SPACINGTYPE_AUTO: number; + readonly TEXTPATH_SPACINGTYPE_EXACT: number; + readonly TEXTPATH_SPACINGTYPE_UNKNOWN: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGTextPathElement: { prototype: SVGTextPathElement; new(): SVGTextPathElement; - TEXTPATH_METHODTYPE_ALIGN: number; - TEXTPATH_METHODTYPE_STRETCH: number; - TEXTPATH_METHODTYPE_UNKNOWN: number; - TEXTPATH_SPACINGTYPE_AUTO: number; - TEXTPATH_SPACINGTYPE_EXACT: number; - TEXTPATH_SPACINGTYPE_UNKNOWN: number; + readonly TEXTPATH_METHODTYPE_ALIGN: number; + readonly TEXTPATH_METHODTYPE_STRETCH: number; + readonly TEXTPATH_METHODTYPE_UNKNOWN: number; + readonly TEXTPATH_SPACINGTYPE_AUTO: number; + readonly TEXTPATH_SPACINGTYPE_EXACT: number; + readonly TEXTPATH_SPACINGTYPE_UNKNOWN: number; } interface SVGTextPositioningElement extends SVGTextContentElement { - dx: SVGAnimatedLengthList; - dy: SVGAnimatedLengthList; - rotate: SVGAnimatedNumberList; - x: SVGAnimatedLengthList; - y: SVGAnimatedLengthList; + readonly dx: SVGAnimatedLengthList; + readonly dy: SVGAnimatedLengthList; + readonly rotate: SVGAnimatedNumberList; + readonly x: SVGAnimatedLengthList; + readonly y: SVGAnimatedLengthList; } declare var SVGTextPositioningElement: { @@ -15482,38 +16775,38 @@ declare var SVGTitleElement: { } interface SVGTransform { - angle: number; - matrix: SVGMatrix; - type: number; + readonly angle: number; + readonly matrix: SVGMatrix; + readonly type: number; setMatrix(matrix: SVGMatrix): void; setRotate(angle: number, cx: number, cy: number): void; setScale(sx: number, sy: number): void; setSkewX(angle: number): void; setSkewY(angle: number): void; setTranslate(tx: number, ty: number): void; - SVG_TRANSFORM_MATRIX: number; - SVG_TRANSFORM_ROTATE: number; - SVG_TRANSFORM_SCALE: number; - SVG_TRANSFORM_SKEWX: number; - SVG_TRANSFORM_SKEWY: number; - SVG_TRANSFORM_TRANSLATE: number; - SVG_TRANSFORM_UNKNOWN: number; + readonly SVG_TRANSFORM_MATRIX: number; + readonly SVG_TRANSFORM_ROTATE: number; + readonly SVG_TRANSFORM_SCALE: number; + readonly SVG_TRANSFORM_SKEWX: number; + readonly SVG_TRANSFORM_SKEWY: number; + readonly SVG_TRANSFORM_TRANSLATE: number; + readonly SVG_TRANSFORM_UNKNOWN: number; } declare var SVGTransform: { prototype: SVGTransform; new(): SVGTransform; - SVG_TRANSFORM_MATRIX: number; - SVG_TRANSFORM_ROTATE: number; - SVG_TRANSFORM_SCALE: number; - SVG_TRANSFORM_SKEWX: number; - SVG_TRANSFORM_SKEWY: number; - SVG_TRANSFORM_TRANSLATE: number; - SVG_TRANSFORM_UNKNOWN: number; + readonly SVG_TRANSFORM_MATRIX: number; + readonly SVG_TRANSFORM_ROTATE: number; + readonly SVG_TRANSFORM_SCALE: number; + readonly SVG_TRANSFORM_SKEWX: number; + readonly SVG_TRANSFORM_SKEWY: number; + readonly SVG_TRANSFORM_TRANSLATE: number; + readonly SVG_TRANSFORM_UNKNOWN: number; } interface SVGTransformList { - numberOfItems: number; + readonly numberOfItems: number; appendItem(newItem: SVGTransform): SVGTransform; clear(): void; consolidate(): SVGTransform; @@ -15531,19 +16824,19 @@ declare var SVGTransformList: { } interface SVGUnitTypes { - SVG_UNIT_TYPE_OBJECTBOUNDINGBOX: number; - SVG_UNIT_TYPE_UNKNOWN: number; - SVG_UNIT_TYPE_USERSPACEONUSE: number; + readonly SVG_UNIT_TYPE_OBJECTBOUNDINGBOX: number; + readonly SVG_UNIT_TYPE_UNKNOWN: number; + readonly SVG_UNIT_TYPE_USERSPACEONUSE: number; } declare var SVGUnitTypes: SVGUnitTypes; interface SVGUseElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference { - animatedInstanceRoot: SVGElementInstance; - height: SVGAnimatedLength; - instanceRoot: SVGElementInstance; - width: SVGAnimatedLength; - x: SVGAnimatedLength; - y: SVGAnimatedLength; + readonly animatedInstanceRoot: SVGElementInstance; + readonly height: SVGAnimatedLength; + readonly instanceRoot: SVGElementInstance; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -15553,7 +16846,7 @@ declare var SVGUseElement: { } interface SVGViewElement extends SVGElement, SVGExternalResourcesRequired, SVGFitToViewBox, SVGZoomAndPan { - viewTarget: SVGStringList; + readonly viewTarget: SVGStringList; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -15563,18 +16856,21 @@ declare var SVGViewElement: { } interface SVGZoomAndPan { - SVG_ZOOMANDPAN_DISABLE: number; - SVG_ZOOMANDPAN_MAGNIFY: number; - SVG_ZOOMANDPAN_UNKNOWN: number; + readonly zoomAndPan: number; +} + +declare var SVGZoomAndPan: { + readonly SVG_ZOOMANDPAN_DISABLE: number; + readonly SVG_ZOOMANDPAN_MAGNIFY: number; + readonly SVG_ZOOMANDPAN_UNKNOWN: number; } -declare var SVGZoomAndPan: SVGZoomAndPan; interface SVGZoomEvent extends UIEvent { - newScale: number; - newTranslate: SVGPoint; - previousScale: number; - previousTranslate: SVGPoint; - zoomRectScreen: SVGRect; + readonly newScale: number; + readonly newTranslate: SVGPoint; + readonly previousScale: number; + readonly previousTranslate: SVGPoint; + readonly zoomRectScreen: SVGRect; } declare var SVGZoomEvent: { @@ -15583,22 +16879,22 @@ declare var SVGZoomEvent: { } interface Screen extends EventTarget { - availHeight: number; - availWidth: number; + readonly availHeight: number; + readonly availWidth: number; bufferDepth: number; - colorDepth: number; - deviceXDPI: number; - deviceYDPI: number; - fontSmoothingEnabled: boolean; - height: number; - logicalXDPI: number; - logicalYDPI: number; - msOrientation: string; + readonly colorDepth: number; + readonly deviceXDPI: number; + readonly deviceYDPI: number; + readonly fontSmoothingEnabled: boolean; + readonly height: number; + readonly logicalXDPI: number; + readonly logicalYDPI: number; + readonly msOrientation: string; onmsorientationchange: (ev: Event) => any; - pixelDepth: number; - systemXDPI: number; - systemYDPI: number; - width: number; + readonly pixelDepth: number; + readonly systemXDPI: number; + readonly systemYDPI: number; + readonly width: number; msLockOrientation(orientations: string | string[]): boolean; msUnlockOrientation(): void; addEventListener(type: "MSOrientationChange", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -15611,8 +16907,8 @@ declare var Screen: { } interface ScriptNotifyEvent extends Event { - callingUri: string; - value: string; + readonly callingUri: string; + readonly value: string; } declare var ScriptNotifyEvent: { @@ -15621,7 +16917,7 @@ declare var ScriptNotifyEvent: { } interface ScriptProcessorNode extends AudioNode { - bufferSize: number; + readonly bufferSize: number; onaudioprocess: (ev: AudioProcessingEvent) => any; addEventListener(type: "audioprocess", listener: (ev: AudioProcessingEvent) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; @@ -15633,13 +16929,13 @@ declare var ScriptProcessorNode: { } interface Selection { - anchorNode: Node; - anchorOffset: number; - focusNode: Node; - focusOffset: number; - isCollapsed: boolean; - rangeCount: number; - type: string; + readonly anchorNode: Node; + readonly anchorOffset: number; + readonly focusNode: Node; + readonly focusOffset: number; + readonly isCollapsed: boolean; + readonly rangeCount: number; + readonly type: string; addRange(range: Range): void; collapse(parentNode: Node, offset: number): void; collapseToEnd(): void; @@ -15664,12 +16960,12 @@ declare var Selection: { interface SourceBuffer extends EventTarget { appendWindowEnd: number; appendWindowStart: number; - audioTracks: AudioTrackList; - buffered: TimeRanges; + readonly audioTracks: AudioTrackList; + readonly buffered: TimeRanges; mode: string; timestampOffset: number; - updating: boolean; - videoTracks: VideoTrackList; + readonly updating: boolean; + readonly videoTracks: VideoTrackList; abort(): void; appendBuffer(data: ArrayBuffer | ArrayBufferView): void; appendStream(stream: MSStream, maxSize?: number): void; @@ -15682,7 +16978,7 @@ declare var SourceBuffer: { } interface SourceBufferList extends EventTarget { - length: number; + readonly length: number; item(index: number): SourceBuffer; [index: number]: SourceBuffer; } @@ -15693,7 +16989,7 @@ declare var SourceBufferList: { } interface StereoPannerNode extends AudioNode { - pan: AudioParam; + readonly pan: AudioParam; } declare var StereoPannerNode: { @@ -15702,9 +16998,9 @@ declare var StereoPannerNode: { } interface Storage { - length: number; + readonly length: number; clear(): void; - getItem(key: string): any; + getItem(key: string): string; key(index: number): string; removeItem(key: string): void; setItem(key: string, data: string): void; @@ -15718,21 +17014,20 @@ declare var Storage: { } interface StorageEvent extends Event { - key: string; - newValue: any; - oldValue: any; - storageArea: Storage; - url: string; - initStorageEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, keyArg: string, oldValueArg: any, newValueArg: any, urlArg: string, storageAreaArg: Storage): void; + readonly url: string; + key?: string; + oldValue?: string; + newValue?: string; + storageArea?: Storage; } declare var StorageEvent: { prototype: StorageEvent; - new(): StorageEvent; + new (type: string, eventInitDict?: StorageEventInit): StorageEvent; } interface StyleMedia { - type: string; + readonly type: string; matchMedium(mediaquery: string): boolean; } @@ -15743,12 +17038,12 @@ declare var StyleMedia: { interface StyleSheet { disabled: boolean; - href: string; - media: MediaList; - ownerNode: Node; - parentStyleSheet: StyleSheet; - title: string; - type: string; + readonly href: string; + readonly media: MediaList; + readonly ownerNode: Node; + readonly parentStyleSheet: StyleSheet; + readonly title: string; + readonly type: string; } declare var StyleSheet: { @@ -15757,7 +17052,7 @@ declare var StyleSheet: { } interface StyleSheetList { - length: number; + readonly length: number; item(index?: number): StyleSheet; [index: number]: StyleSheet; } @@ -15768,7 +17063,7 @@ declare var StyleSheetList: { } interface StyleSheetPageList { - length: number; + readonly length: number; item(index: number): CSSPageRule; [index: number]: CSSPageRule; } @@ -15779,18 +17074,18 @@ declare var StyleSheetPageList: { } interface SubtleCrypto { - decrypt(algorithm: string | Algorithm, key: CryptoKey, data: ArrayBufferView): any; - deriveBits(algorithm: string | Algorithm, baseKey: CryptoKey, length: number): any; - deriveKey(algorithm: string | Algorithm, baseKey: CryptoKey, derivedKeyType: string | Algorithm, extractable: boolean, keyUsages: string[]): any; - digest(algorithm: string | Algorithm, data: ArrayBufferView): any; - encrypt(algorithm: string | Algorithm, key: CryptoKey, data: ArrayBufferView): any; - exportKey(format: string, key: CryptoKey): any; - generateKey(algorithm: string | Algorithm, extractable: boolean, keyUsages: string[]): any; - importKey(format: string, keyData: ArrayBufferView, algorithm: string | Algorithm, extractable: boolean, keyUsages: string[]): any; - sign(algorithm: string | Algorithm, key: CryptoKey, data: ArrayBufferView): any; - unwrapKey(format: string, wrappedKey: ArrayBufferView, unwrappingKey: CryptoKey, unwrapAlgorithm: string | Algorithm, unwrappedKeyAlgorithm: string | Algorithm, extractable: boolean, keyUsages: string[]): any; - verify(algorithm: string | Algorithm, key: CryptoKey, signature: ArrayBufferView, data: ArrayBufferView): any; - wrapKey(format: string, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: string | Algorithm): any; + decrypt(algorithm: string | Algorithm, key: CryptoKey, data: ArrayBufferView): PromiseLike; + deriveBits(algorithm: string | Algorithm, baseKey: CryptoKey, length: number): PromiseLike; + deriveKey(algorithm: string | Algorithm, baseKey: CryptoKey, derivedKeyType: string | Algorithm, extractable: boolean, keyUsages: string[]): PromiseLike; + digest(algorithm: string | Algorithm, data: ArrayBufferView): PromiseLike; + encrypt(algorithm: string | Algorithm, key: CryptoKey, data: ArrayBufferView): PromiseLike; + exportKey(format: string, key: CryptoKey): PromiseLike; + generateKey(algorithm: string | Algorithm, extractable: boolean, keyUsages: string[]): PromiseLike; + importKey(format: string, keyData: ArrayBufferView, algorithm: string | Algorithm | null, extractable: boolean, keyUsages: string[]): PromiseLike; + sign(algorithm: string | Algorithm, key: CryptoKey, data: ArrayBufferView): PromiseLike; + unwrapKey(format: string, wrappedKey: ArrayBufferView, unwrappingKey: CryptoKey, unwrapAlgorithm: string | Algorithm, unwrappedKeyAlgorithm: string | Algorithm | null, extractable: boolean, keyUsages: string[]): PromiseLike; + verify(algorithm: string | Algorithm, key: CryptoKey, signature: ArrayBufferView, data: ArrayBufferView): PromiseLike; + wrapKey(format: string, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: string | Algorithm): PromiseLike; } declare var SubtleCrypto: { @@ -15799,8 +17094,7 @@ declare var SubtleCrypto: { } interface Text extends CharacterData { - wholeText: string; - replaceWholeText(content: string): Text; + readonly wholeText: string; splitText(offset: number): Text; } @@ -15810,39 +17104,39 @@ declare var Text: { } interface TextEvent extends UIEvent { - data: string; - inputMethod: number; - locale: string; + readonly data: string; + readonly inputMethod: number; + readonly locale: string; initTextEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, dataArg: string, inputMethod: number, locale: string): void; - DOM_INPUT_METHOD_DROP: number; - DOM_INPUT_METHOD_HANDWRITING: number; - DOM_INPUT_METHOD_IME: number; - DOM_INPUT_METHOD_KEYBOARD: number; - DOM_INPUT_METHOD_MULTIMODAL: number; - DOM_INPUT_METHOD_OPTION: number; - DOM_INPUT_METHOD_PASTE: number; - DOM_INPUT_METHOD_SCRIPT: number; - DOM_INPUT_METHOD_UNKNOWN: number; - DOM_INPUT_METHOD_VOICE: number; + readonly DOM_INPUT_METHOD_DROP: number; + readonly DOM_INPUT_METHOD_HANDWRITING: number; + readonly DOM_INPUT_METHOD_IME: number; + readonly DOM_INPUT_METHOD_KEYBOARD: number; + readonly DOM_INPUT_METHOD_MULTIMODAL: number; + readonly DOM_INPUT_METHOD_OPTION: number; + readonly DOM_INPUT_METHOD_PASTE: number; + readonly DOM_INPUT_METHOD_SCRIPT: number; + readonly DOM_INPUT_METHOD_UNKNOWN: number; + readonly DOM_INPUT_METHOD_VOICE: number; } declare var TextEvent: { prototype: TextEvent; new(): TextEvent; - DOM_INPUT_METHOD_DROP: number; - DOM_INPUT_METHOD_HANDWRITING: number; - DOM_INPUT_METHOD_IME: number; - DOM_INPUT_METHOD_KEYBOARD: number; - DOM_INPUT_METHOD_MULTIMODAL: number; - DOM_INPUT_METHOD_OPTION: number; - DOM_INPUT_METHOD_PASTE: number; - DOM_INPUT_METHOD_SCRIPT: number; - DOM_INPUT_METHOD_UNKNOWN: number; - DOM_INPUT_METHOD_VOICE: number; + readonly DOM_INPUT_METHOD_DROP: number; + readonly DOM_INPUT_METHOD_HANDWRITING: number; + readonly DOM_INPUT_METHOD_IME: number; + readonly DOM_INPUT_METHOD_KEYBOARD: number; + readonly DOM_INPUT_METHOD_MULTIMODAL: number; + readonly DOM_INPUT_METHOD_OPTION: number; + readonly DOM_INPUT_METHOD_PASTE: number; + readonly DOM_INPUT_METHOD_SCRIPT: number; + readonly DOM_INPUT_METHOD_UNKNOWN: number; + readonly DOM_INPUT_METHOD_VOICE: number; } interface TextMetrics { - width: number; + readonly width: number; } declare var TextMetrics: { @@ -15850,83 +17144,27 @@ declare var TextMetrics: { new(): TextMetrics; } -interface TextRange { - boundingHeight: number; - boundingLeft: number; - boundingTop: number; - boundingWidth: number; - htmlText: string; - offsetLeft: number; - offsetTop: number; - text: string; - collapse(start?: boolean): void; - compareEndPoints(how: string, sourceRange: TextRange): number; - duplicate(): TextRange; - execCommand(cmdID: string, showUI?: boolean, value?: any): boolean; - execCommandShowHelp(cmdID: string): boolean; - expand(Unit: string): boolean; - findText(string: string, count?: number, flags?: number): boolean; - getBookmark(): string; - getBoundingClientRect(): ClientRect; - getClientRects(): ClientRectList; - inRange(range: TextRange): boolean; - isEqual(range: TextRange): boolean; - move(unit: string, count?: number): number; - moveEnd(unit: string, count?: number): number; - moveStart(unit: string, count?: number): number; - moveToBookmark(bookmark: string): boolean; - moveToElementText(element: Element): void; - moveToPoint(x: number, y: number): void; - parentElement(): Element; - pasteHTML(html: string): void; - queryCommandEnabled(cmdID: string): boolean; - queryCommandIndeterm(cmdID: string): boolean; - queryCommandState(cmdID: string): boolean; - queryCommandSupported(cmdID: string): boolean; - queryCommandText(cmdID: string): string; - queryCommandValue(cmdID: string): any; - scrollIntoView(fStart?: boolean): void; - select(): void; - setEndPoint(how: string, SourceRange: TextRange): void; -} - -declare var TextRange: { - prototype: TextRange; - new(): TextRange; -} - -interface TextRangeCollection { - length: number; - item(index: number): TextRange; - [index: number]: TextRange; -} - -declare var TextRangeCollection: { - prototype: TextRangeCollection; - new(): TextRangeCollection; -} - interface TextTrack extends EventTarget { - activeCues: TextTrackCueList; - cues: TextTrackCueList; - inBandMetadataTrackDispatchType: string; - kind: string; - label: string; - language: string; + readonly activeCues: TextTrackCueList; + readonly cues: TextTrackCueList; + readonly inBandMetadataTrackDispatchType: string; + readonly kind: string; + readonly label: string; + readonly language: string; mode: any; oncuechange: (ev: Event) => any; onerror: (ev: Event) => any; onload: (ev: Event) => any; - readyState: number; + readonly readyState: number; addCue(cue: TextTrackCue): void; removeCue(cue: TextTrackCue): void; - DISABLED: number; - ERROR: number; - HIDDEN: number; - LOADED: number; - LOADING: number; - NONE: number; - SHOWING: number; + readonly DISABLED: number; + readonly ERROR: number; + readonly HIDDEN: number; + readonly LOADED: number; + readonly LOADING: number; + readonly NONE: number; + readonly SHOWING: number; addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -15936,13 +17174,13 @@ interface TextTrack extends EventTarget { declare var TextTrack: { prototype: TextTrack; new(): TextTrack; - DISABLED: number; - ERROR: number; - HIDDEN: number; - LOADED: number; - LOADING: number; - NONE: number; - SHOWING: number; + readonly DISABLED: number; + readonly ERROR: number; + readonly HIDDEN: number; + readonly LOADED: number; + readonly LOADING: number; + readonly NONE: number; + readonly SHOWING: number; } interface TextTrackCue extends EventTarget { @@ -15953,7 +17191,7 @@ interface TextTrackCue extends EventTarget { pauseOnExit: boolean; startTime: number; text: string; - track: TextTrack; + readonly track: TextTrack; getCueAsHTML(): DocumentFragment; addEventListener(type: "enter", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "exit", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -15966,7 +17204,7 @@ declare var TextTrackCue: { } interface TextTrackCueList { - length: number; + readonly length: number; getCueById(id: string): TextTrackCue; item(index: number): TextTrackCue; [index: number]: TextTrackCue; @@ -15978,8 +17216,8 @@ declare var TextTrackCueList: { } interface TextTrackList extends EventTarget { - length: number; - onaddtrack: (ev: TrackEvent) => any; + readonly length: number; + onaddtrack: ((ev: TrackEvent) => any) | null; item(index: number): TextTrack; addEventListener(type: "addtrack", listener: (ev: TrackEvent) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; @@ -15992,7 +17230,7 @@ declare var TextTrackList: { } interface TimeRanges { - length: number; + readonly length: number; end(index: number): number; start(index: number): number; } @@ -16003,14 +17241,14 @@ declare var TimeRanges: { } interface Touch { - clientX: number; - clientY: number; - identifier: number; - pageX: number; - pageY: number; - screenX: number; - screenY: number; - target: EventTarget; + readonly clientX: number; + readonly clientY: number; + readonly identifier: number; + readonly pageX: number; + readonly pageY: number; + readonly screenX: number; + readonly screenY: number; + readonly target: EventTarget; } declare var Touch: { @@ -16019,13 +17257,13 @@ declare var Touch: { } interface TouchEvent extends UIEvent { - altKey: boolean; - changedTouches: TouchList; - ctrlKey: boolean; - metaKey: boolean; - shiftKey: boolean; - targetTouches: TouchList; - touches: TouchList; + readonly altKey: boolean; + readonly changedTouches: TouchList; + readonly ctrlKey: boolean; + readonly metaKey: boolean; + readonly shiftKey: boolean; + readonly targetTouches: TouchList; + readonly touches: TouchList; } declare var TouchEvent: { @@ -16034,8 +17272,8 @@ declare var TouchEvent: { } interface TouchList { - length: number; - item(index: number): Touch; + readonly length: number; + item(index: number): Touch | null; [index: number]: Touch; } @@ -16045,7 +17283,7 @@ declare var TouchList: { } interface TrackEvent extends Event { - track: any; + readonly track: any; } declare var TrackEvent: { @@ -16054,8 +17292,8 @@ declare var TrackEvent: { } interface TransitionEvent extends Event { - elapsedTime: number; - propertyName: string; + readonly elapsedTime: number; + readonly propertyName: string; initTransitionEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, propertyNameArg: string, elapsedTimeArg: number): void; } @@ -16066,10 +17304,10 @@ declare var TransitionEvent: { interface TreeWalker { currentNode: Node; - expandEntityReferences: boolean; - filter: NodeFilter; - root: Node; - whatToShow: number; + readonly expandEntityReferences: boolean; + readonly filter: NodeFilter; + readonly root: Node; + readonly whatToShow: number; firstChild(): Node; lastChild(): Node; nextNode(): Node; @@ -16085,8 +17323,8 @@ declare var TreeWalker: { } interface UIEvent extends Event { - detail: number; - view: Window; + readonly detail: number; + readonly view: Window; initUIEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number): void; } @@ -16096,13 +17334,29 @@ declare var UIEvent: { } interface URL { + hash: string; + host: string; + hostname: string; + href: string; + readonly origin: string; + password: string; + pathname: string; + port: string; + protocol: string; + search: string; + username: string; + toString(): string; +} + +declare var URL: { + prototype: URL; + new(url: string, base?: string): URL; createObjectURL(object: any, options?: ObjectURLOptions): string; revokeObjectURL(url: string): void; } -declare var URL: URL; interface UnviewableContentIdentifiedEvent extends NavigationEventWithReferrer { - mediaType: string; + readonly mediaType: string; } declare var UnviewableContentIdentifiedEvent: { @@ -16111,16 +17365,16 @@ declare var UnviewableContentIdentifiedEvent: { } interface ValidityState { - badInput: boolean; - customError: boolean; - patternMismatch: boolean; - rangeOverflow: boolean; - rangeUnderflow: boolean; - stepMismatch: boolean; - tooLong: boolean; - typeMismatch: boolean; - valid: boolean; - valueMissing: boolean; + readonly badInput: boolean; + readonly customError: boolean; + readonly patternMismatch: boolean; + readonly rangeOverflow: boolean; + readonly rangeUnderflow: boolean; + readonly stepMismatch: boolean; + readonly tooLong: boolean; + readonly typeMismatch: boolean; + readonly valid: boolean; + readonly valueMissing: boolean; } declare var ValidityState: { @@ -16129,11 +17383,11 @@ declare var ValidityState: { } interface VideoPlaybackQuality { - corruptedVideoFrames: number; - creationTime: number; - droppedVideoFrames: number; - totalFrameDelay: number; - totalVideoFrames: number; + readonly corruptedVideoFrames: number; + readonly creationTime: number; + readonly droppedVideoFrames: number; + readonly totalFrameDelay: number; + readonly totalVideoFrames: number; } declare var VideoPlaybackQuality: { @@ -16142,12 +17396,12 @@ declare var VideoPlaybackQuality: { } interface VideoTrack { - id: string; + readonly id: string; kind: string; - label: string; + readonly label: string; language: string; selected: boolean; - sourceBuffer: SourceBuffer; + readonly sourceBuffer: SourceBuffer; } declare var VideoTrack: { @@ -16156,12 +17410,12 @@ declare var VideoTrack: { } interface VideoTrackList extends EventTarget { - length: number; + readonly length: number; onaddtrack: (ev: TrackEvent) => any; onchange: (ev: Event) => any; onremovetrack: (ev: TrackEvent) => any; - selectedIndex: number; - getTrackById(id: string): VideoTrack; + readonly selectedIndex: number; + getTrackById(id: string): VideoTrack | null; item(index: number): VideoTrack; addEventListener(type: "addtrack", listener: (ev: TrackEvent) => any, useCapture?: boolean): void; addEventListener(type: "change", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -16176,45 +17430,45 @@ declare var VideoTrackList: { } interface WEBGL_compressed_texture_s3tc { - COMPRESSED_RGBA_S3TC_DXT1_EXT: number; - COMPRESSED_RGBA_S3TC_DXT3_EXT: number; - COMPRESSED_RGBA_S3TC_DXT5_EXT: number; - COMPRESSED_RGB_S3TC_DXT1_EXT: number; + readonly COMPRESSED_RGBA_S3TC_DXT1_EXT: number; + readonly COMPRESSED_RGBA_S3TC_DXT3_EXT: number; + readonly COMPRESSED_RGBA_S3TC_DXT5_EXT: number; + readonly COMPRESSED_RGB_S3TC_DXT1_EXT: number; } declare var WEBGL_compressed_texture_s3tc: { prototype: WEBGL_compressed_texture_s3tc; new(): WEBGL_compressed_texture_s3tc; - COMPRESSED_RGBA_S3TC_DXT1_EXT: number; - COMPRESSED_RGBA_S3TC_DXT3_EXT: number; - COMPRESSED_RGBA_S3TC_DXT5_EXT: number; - COMPRESSED_RGB_S3TC_DXT1_EXT: number; + readonly COMPRESSED_RGBA_S3TC_DXT1_EXT: number; + readonly COMPRESSED_RGBA_S3TC_DXT3_EXT: number; + readonly COMPRESSED_RGBA_S3TC_DXT5_EXT: number; + readonly COMPRESSED_RGB_S3TC_DXT1_EXT: number; } interface WEBGL_debug_renderer_info { - UNMASKED_RENDERER_WEBGL: number; - UNMASKED_VENDOR_WEBGL: number; + readonly UNMASKED_RENDERER_WEBGL: number; + readonly UNMASKED_VENDOR_WEBGL: number; } declare var WEBGL_debug_renderer_info: { prototype: WEBGL_debug_renderer_info; new(): WEBGL_debug_renderer_info; - UNMASKED_RENDERER_WEBGL: number; - UNMASKED_VENDOR_WEBGL: number; + readonly UNMASKED_RENDERER_WEBGL: number; + readonly UNMASKED_VENDOR_WEBGL: number; } interface WEBGL_depth_texture { - UNSIGNED_INT_24_8_WEBGL: number; + readonly UNSIGNED_INT_24_8_WEBGL: number; } declare var WEBGL_depth_texture: { prototype: WEBGL_depth_texture; new(): WEBGL_depth_texture; - UNSIGNED_INT_24_8_WEBGL: number; + readonly UNSIGNED_INT_24_8_WEBGL: number; } interface WaveShaperNode extends AudioNode { - curve: Float32Array; + curve: Float32Array | null; oversample: string; } @@ -16224,9 +17478,9 @@ declare var WaveShaperNode: { } interface WebGLActiveInfo { - name: string; - size: number; - type: number; + readonly name: string; + readonly size: number; + readonly type: number; } declare var WebGLActiveInfo: { @@ -16243,12 +17497,12 @@ declare var WebGLBuffer: { } interface WebGLContextEvent extends Event { - statusMessage: string; + readonly statusMessage: string; } declare var WebGLContextEvent: { prototype: WebGLContextEvent; - new(): WebGLContextEvent; + new(type: string, eventInitDict?: WebGLContextEventInit): WebGLContextEvent; } interface WebGLFramebuffer extends WebGLObject { @@ -16284,16 +17538,16 @@ declare var WebGLRenderbuffer: { } interface WebGLRenderingContext { - canvas: HTMLCanvasElement; - drawingBufferHeight: number; - drawingBufferWidth: number; + readonly canvas: HTMLCanvasElement; + readonly drawingBufferHeight: number; + readonly drawingBufferWidth: number; activeTexture(texture: number): void; - attachShader(program: WebGLProgram, shader: WebGLShader): void; - bindAttribLocation(program: WebGLProgram, index: number, name: string): void; - bindBuffer(target: number, buffer: WebGLBuffer): void; - bindFramebuffer(target: number, framebuffer: WebGLFramebuffer): void; - bindRenderbuffer(target: number, renderbuffer: WebGLRenderbuffer): void; - bindTexture(target: number, texture: WebGLTexture): void; + attachShader(program: WebGLProgram | null, shader: WebGLShader | null): void; + bindAttribLocation(program: WebGLProgram | null, index: number, name: string): void; + bindBuffer(target: number, buffer: WebGLBuffer | null): void; + bindFramebuffer(target: number, framebuffer: WebGLFramebuffer | null): void; + bindRenderbuffer(target: number, renderbuffer: WebGLRenderbuffer | null): void; + bindTexture(target: number, texture: WebGLTexture | null): void; blendColor(red: number, green: number, blue: number, alpha: number): void; blendEquation(mode: number): void; blendEquationSeparate(modeRGB: number, modeAlpha: number): void; @@ -16307,28 +17561,28 @@ interface WebGLRenderingContext { clearDepth(depth: number): void; clearStencil(s: number): void; colorMask(red: boolean, green: boolean, blue: boolean, alpha: boolean): void; - compileShader(shader: WebGLShader): void; + compileShader(shader: WebGLShader | null): void; compressedTexImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, data: ArrayBufferView): void; compressedTexSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, data: ArrayBufferView): void; copyTexImage2D(target: number, level: number, internalformat: number, x: number, y: number, width: number, height: number, border: number): void; copyTexSubImage2D(target: number, level: number, xoffset: number, yoffset: number, x: number, y: number, width: number, height: number): void; - createBuffer(): WebGLBuffer; - createFramebuffer(): WebGLFramebuffer; - createProgram(): WebGLProgram; - createRenderbuffer(): WebGLRenderbuffer; - createShader(type: number): WebGLShader; - createTexture(): WebGLTexture; + createBuffer(): WebGLBuffer | null; + createFramebuffer(): WebGLFramebuffer | null; + createProgram(): WebGLProgram | null; + createRenderbuffer(): WebGLRenderbuffer | null; + createShader(type: number): WebGLShader | null; + createTexture(): WebGLTexture | null; cullFace(mode: number): void; - deleteBuffer(buffer: WebGLBuffer): void; - deleteFramebuffer(framebuffer: WebGLFramebuffer): void; - deleteProgram(program: WebGLProgram): void; - deleteRenderbuffer(renderbuffer: WebGLRenderbuffer): void; - deleteShader(shader: WebGLShader): void; - deleteTexture(texture: WebGLTexture): void; + deleteBuffer(buffer: WebGLBuffer | null): void; + deleteFramebuffer(framebuffer: WebGLFramebuffer | null): void; + deleteProgram(program: WebGLProgram | null): void; + deleteRenderbuffer(renderbuffer: WebGLRenderbuffer | null): void; + deleteShader(shader: WebGLShader | null): void; + deleteTexture(texture: WebGLTexture | null): void; depthFunc(func: number): void; depthMask(flag: boolean): void; depthRange(zNear: number, zFar: number): void; - detachShader(program: WebGLProgram, shader: WebGLShader): void; + detachShader(program: WebGLProgram | null, shader: WebGLShader | null): void; disable(cap: number): void; disableVertexAttribArray(index: number): void; drawArrays(mode: number, first: number, count: number): void; @@ -16337,51 +17591,51 @@ interface WebGLRenderingContext { enableVertexAttribArray(index: number): void; finish(): void; flush(): void; - framebufferRenderbuffer(target: number, attachment: number, renderbuffertarget: number, renderbuffer: WebGLRenderbuffer): void; - framebufferTexture2D(target: number, attachment: number, textarget: number, texture: WebGLTexture, level: number): void; + framebufferRenderbuffer(target: number, attachment: number, renderbuffertarget: number, renderbuffer: WebGLRenderbuffer | null): void; + framebufferTexture2D(target: number, attachment: number, textarget: number, texture: WebGLTexture | null, level: number): void; frontFace(mode: number): void; generateMipmap(target: number): void; - getActiveAttrib(program: WebGLProgram, index: number): WebGLActiveInfo; - getActiveUniform(program: WebGLProgram, index: number): WebGLActiveInfo; - getAttachedShaders(program: WebGLProgram): WebGLShader[]; - getAttribLocation(program: WebGLProgram, name: string): number; + getActiveAttrib(program: WebGLProgram | null, index: number): WebGLActiveInfo | null; + getActiveUniform(program: WebGLProgram | null, index: number): WebGLActiveInfo | null; + getAttachedShaders(program: WebGLProgram | null): WebGLShader[] | null; + getAttribLocation(program: WebGLProgram | null, name: string): number; getBufferParameter(target: number, pname: number): any; getContextAttributes(): WebGLContextAttributes; getError(): number; getExtension(name: string): any; getFramebufferAttachmentParameter(target: number, attachment: number, pname: number): any; getParameter(pname: number): any; - getProgramInfoLog(program: WebGLProgram): string; - getProgramParameter(program: WebGLProgram, pname: number): any; + getProgramInfoLog(program: WebGLProgram | null): string | null; + getProgramParameter(program: WebGLProgram | null, pname: number): any; getRenderbufferParameter(target: number, pname: number): any; - getShaderInfoLog(shader: WebGLShader): string; - getShaderParameter(shader: WebGLShader, pname: number): any; - getShaderPrecisionFormat(shadertype: number, precisiontype: number): WebGLShaderPrecisionFormat; - getShaderSource(shader: WebGLShader): string; - getSupportedExtensions(): string[]; + getShaderInfoLog(shader: WebGLShader | null): string | null; + getShaderParameter(shader: WebGLShader | null, pname: number): any; + getShaderPrecisionFormat(shadertype: number, precisiontype: number): WebGLShaderPrecisionFormat | null; + getShaderSource(shader: WebGLShader | null): string | null; + getSupportedExtensions(): string[] | null; getTexParameter(target: number, pname: number): any; - getUniform(program: WebGLProgram, location: WebGLUniformLocation): any; - getUniformLocation(program: WebGLProgram, name: string): WebGLUniformLocation; + getUniform(program: WebGLProgram | null, location: WebGLUniformLocation | null): any; + getUniformLocation(program: WebGLProgram | null, name: string): WebGLUniformLocation | null; getVertexAttrib(index: number, pname: number): any; getVertexAttribOffset(index: number, pname: number): number; hint(target: number, mode: number): void; - isBuffer(buffer: WebGLBuffer): boolean; + isBuffer(buffer: WebGLBuffer | null): boolean; isContextLost(): boolean; isEnabled(cap: number): boolean; - isFramebuffer(framebuffer: WebGLFramebuffer): boolean; - isProgram(program: WebGLProgram): boolean; - isRenderbuffer(renderbuffer: WebGLRenderbuffer): boolean; - isShader(shader: WebGLShader): boolean; - isTexture(texture: WebGLTexture): boolean; + isFramebuffer(framebuffer: WebGLFramebuffer | null): boolean; + isProgram(program: WebGLProgram | null): boolean; + isRenderbuffer(renderbuffer: WebGLRenderbuffer | null): boolean; + isShader(shader: WebGLShader | null): boolean; + isTexture(texture: WebGLTexture | null): boolean; lineWidth(width: number): void; - linkProgram(program: WebGLProgram): void; + linkProgram(program: WebGLProgram | null): void; pixelStorei(pname: number, param: number): void; polygonOffset(factor: number, units: number): void; - readPixels(x: number, y: number, width: number, height: number, format: number, type: number, pixels: ArrayBufferView): void; + readPixels(x: number, y: number, width: number, height: number, format: number, type: number, pixels: ArrayBufferView | null): void; renderbufferStorage(target: number, internalformat: number, width: number, height: number): void; sampleCoverage(value: number, invert: boolean): void; scissor(x: number, y: number, width: number, height: number): void; - shaderSource(shader: WebGLShader, source: string): void; + shaderSource(shader: WebGLShader | null, source: string): void; stencilFunc(func: number, ref: number, mask: number): void; stencilFuncSeparate(face: number, func: number, ref: number, mask: number): void; stencilMask(mask: number): void; @@ -16400,636 +17654,636 @@ interface WebGLRenderingContext { texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, canvas: HTMLCanvasElement): void; texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, video: HTMLVideoElement): void; texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, pixels: ImageData): void; - uniform1f(location: WebGLUniformLocation, x: number): void; - uniform1fv(location: WebGLUniformLocation, v: Float32Array): void; - uniform1i(location: WebGLUniformLocation, x: number): void; - uniform1iv(location: WebGLUniformLocation, v: Int32Array): void; - uniform2f(location: WebGLUniformLocation, x: number, y: number): void; - uniform2fv(location: WebGLUniformLocation, v: Float32Array): void; - uniform2i(location: WebGLUniformLocation, x: number, y: number): void; - uniform2iv(location: WebGLUniformLocation, v: Int32Array): void; - uniform3f(location: WebGLUniformLocation, x: number, y: number, z: number): void; - uniform3fv(location: WebGLUniformLocation, v: Float32Array): void; - uniform3i(location: WebGLUniformLocation, x: number, y: number, z: number): void; - uniform3iv(location: WebGLUniformLocation, v: Int32Array): void; - uniform4f(location: WebGLUniformLocation, x: number, y: number, z: number, w: number): void; - uniform4fv(location: WebGLUniformLocation, v: Float32Array): void; - uniform4i(location: WebGLUniformLocation, x: number, y: number, z: number, w: number): void; - uniform4iv(location: WebGLUniformLocation, v: Int32Array): void; - uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void; - uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void; - uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void; - useProgram(program: WebGLProgram): void; - validateProgram(program: WebGLProgram): void; + uniform1f(location: WebGLUniformLocation | null, x: number): void; + uniform1fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; + uniform1i(location: WebGLUniformLocation | null, x: number): void; + uniform1iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; + uniform2f(location: WebGLUniformLocation | null, x: number, y: number): void; + uniform2fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; + uniform2i(location: WebGLUniformLocation | null, x: number, y: number): void; + uniform2iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; + uniform3f(location: WebGLUniformLocation | null, x: number, y: number, z: number): void; + uniform3fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; + uniform3i(location: WebGLUniformLocation | null, x: number, y: number, z: number): void; + uniform3iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; + uniform4f(location: WebGLUniformLocation | null, x: number, y: number, z: number, w: number): void; + uniform4fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; + uniform4i(location: WebGLUniformLocation | null, x: number, y: number, z: number, w: number): void; + uniform4iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; + uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void; + uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void; + uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void; + useProgram(program: WebGLProgram | null): void; + validateProgram(program: WebGLProgram | null): void; vertexAttrib1f(indx: number, x: number): void; - vertexAttrib1fv(indx: number, values: Float32Array): void; + vertexAttrib1fv(indx: number, values: Float32Array | number[]): void; vertexAttrib2f(indx: number, x: number, y: number): void; - vertexAttrib2fv(indx: number, values: Float32Array): void; + vertexAttrib2fv(indx: number, values: Float32Array | number[]): void; vertexAttrib3f(indx: number, x: number, y: number, z: number): void; - vertexAttrib3fv(indx: number, values: Float32Array): void; + vertexAttrib3fv(indx: number, values: Float32Array | number[]): void; vertexAttrib4f(indx: number, x: number, y: number, z: number, w: number): void; - vertexAttrib4fv(indx: number, values: Float32Array): void; + vertexAttrib4fv(indx: number, values: Float32Array | number[]): void; vertexAttribPointer(indx: number, size: number, type: number, normalized: boolean, stride: number, offset: number): void; viewport(x: number, y: number, width: number, height: number): void; - ACTIVE_ATTRIBUTES: number; - ACTIVE_TEXTURE: number; - ACTIVE_UNIFORMS: number; - ALIASED_LINE_WIDTH_RANGE: number; - ALIASED_POINT_SIZE_RANGE: number; - ALPHA: number; - ALPHA_BITS: number; - ALWAYS: number; - ARRAY_BUFFER: number; - ARRAY_BUFFER_BINDING: number; - ATTACHED_SHADERS: number; - BACK: number; - BLEND: number; - BLEND_COLOR: number; - BLEND_DST_ALPHA: number; - BLEND_DST_RGB: number; - BLEND_EQUATION: number; - BLEND_EQUATION_ALPHA: number; - BLEND_EQUATION_RGB: number; - BLEND_SRC_ALPHA: number; - BLEND_SRC_RGB: number; - BLUE_BITS: number; - BOOL: number; - BOOL_VEC2: number; - BOOL_VEC3: number; - BOOL_VEC4: number; - BROWSER_DEFAULT_WEBGL: number; - BUFFER_SIZE: number; - BUFFER_USAGE: number; - BYTE: number; - CCW: number; - CLAMP_TO_EDGE: number; - COLOR_ATTACHMENT0: number; - COLOR_BUFFER_BIT: number; - COLOR_CLEAR_VALUE: number; - COLOR_WRITEMASK: number; - COMPILE_STATUS: number; - COMPRESSED_TEXTURE_FORMATS: number; - CONSTANT_ALPHA: number; - CONSTANT_COLOR: number; - CONTEXT_LOST_WEBGL: number; - CULL_FACE: number; - CULL_FACE_MODE: number; - CURRENT_PROGRAM: number; - CURRENT_VERTEX_ATTRIB: number; - CW: number; - DECR: number; - DECR_WRAP: number; - DELETE_STATUS: number; - DEPTH_ATTACHMENT: number; - DEPTH_BITS: number; - DEPTH_BUFFER_BIT: number; - DEPTH_CLEAR_VALUE: number; - DEPTH_COMPONENT: number; - DEPTH_COMPONENT16: number; - DEPTH_FUNC: number; - DEPTH_RANGE: number; - DEPTH_STENCIL: number; - DEPTH_STENCIL_ATTACHMENT: number; - DEPTH_TEST: number; - DEPTH_WRITEMASK: number; - DITHER: number; - DONT_CARE: number; - DST_ALPHA: number; - DST_COLOR: number; - DYNAMIC_DRAW: number; - ELEMENT_ARRAY_BUFFER: number; - ELEMENT_ARRAY_BUFFER_BINDING: number; - EQUAL: number; - FASTEST: number; - FLOAT: number; - FLOAT_MAT2: number; - FLOAT_MAT3: number; - FLOAT_MAT4: number; - FLOAT_VEC2: number; - FLOAT_VEC3: number; - FLOAT_VEC4: number; - FRAGMENT_SHADER: number; - FRAMEBUFFER: number; - FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number; - FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number; - FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number; - FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number; - FRAMEBUFFER_BINDING: number; - FRAMEBUFFER_COMPLETE: number; - FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number; - FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number; - FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number; - FRAMEBUFFER_UNSUPPORTED: number; - FRONT: number; - FRONT_AND_BACK: number; - FRONT_FACE: number; - FUNC_ADD: number; - FUNC_REVERSE_SUBTRACT: number; - FUNC_SUBTRACT: number; - GENERATE_MIPMAP_HINT: number; - GEQUAL: number; - GREATER: number; - GREEN_BITS: number; - HIGH_FLOAT: number; - HIGH_INT: number; - IMPLEMENTATION_COLOR_READ_FORMAT: number; - IMPLEMENTATION_COLOR_READ_TYPE: number; - INCR: number; - INCR_WRAP: number; - INT: number; - INT_VEC2: number; - INT_VEC3: number; - INT_VEC4: number; - INVALID_ENUM: number; - INVALID_FRAMEBUFFER_OPERATION: number; - INVALID_OPERATION: number; - INVALID_VALUE: number; - INVERT: number; - KEEP: number; - LEQUAL: number; - LESS: number; - LINEAR: number; - LINEAR_MIPMAP_LINEAR: number; - LINEAR_MIPMAP_NEAREST: number; - LINES: number; - LINE_LOOP: number; - LINE_STRIP: number; - LINE_WIDTH: number; - LINK_STATUS: number; - LOW_FLOAT: number; - LOW_INT: number; - LUMINANCE: number; - LUMINANCE_ALPHA: number; - MAX_COMBINED_TEXTURE_IMAGE_UNITS: number; - MAX_CUBE_MAP_TEXTURE_SIZE: number; - MAX_FRAGMENT_UNIFORM_VECTORS: number; - MAX_RENDERBUFFER_SIZE: number; - MAX_TEXTURE_IMAGE_UNITS: number; - MAX_TEXTURE_SIZE: number; - MAX_VARYING_VECTORS: number; - MAX_VERTEX_ATTRIBS: number; - MAX_VERTEX_TEXTURE_IMAGE_UNITS: number; - MAX_VERTEX_UNIFORM_VECTORS: number; - MAX_VIEWPORT_DIMS: number; - MEDIUM_FLOAT: number; - MEDIUM_INT: number; - MIRRORED_REPEAT: number; - NEAREST: number; - NEAREST_MIPMAP_LINEAR: number; - NEAREST_MIPMAP_NEAREST: number; - NEVER: number; - NICEST: number; - NONE: number; - NOTEQUAL: number; - NO_ERROR: number; - ONE: number; - ONE_MINUS_CONSTANT_ALPHA: number; - ONE_MINUS_CONSTANT_COLOR: number; - ONE_MINUS_DST_ALPHA: number; - ONE_MINUS_DST_COLOR: number; - ONE_MINUS_SRC_ALPHA: number; - ONE_MINUS_SRC_COLOR: number; - OUT_OF_MEMORY: number; - PACK_ALIGNMENT: number; - POINTS: number; - POLYGON_OFFSET_FACTOR: number; - POLYGON_OFFSET_FILL: number; - POLYGON_OFFSET_UNITS: number; - RED_BITS: number; - RENDERBUFFER: number; - RENDERBUFFER_ALPHA_SIZE: number; - RENDERBUFFER_BINDING: number; - RENDERBUFFER_BLUE_SIZE: number; - RENDERBUFFER_DEPTH_SIZE: number; - RENDERBUFFER_GREEN_SIZE: number; - RENDERBUFFER_HEIGHT: number; - RENDERBUFFER_INTERNAL_FORMAT: number; - RENDERBUFFER_RED_SIZE: number; - RENDERBUFFER_STENCIL_SIZE: number; - RENDERBUFFER_WIDTH: number; - RENDERER: number; - REPEAT: number; - REPLACE: number; - RGB: number; - RGB565: number; - RGB5_A1: number; - RGBA: number; - RGBA4: number; - SAMPLER_2D: number; - SAMPLER_CUBE: number; - SAMPLES: number; - SAMPLE_ALPHA_TO_COVERAGE: number; - SAMPLE_BUFFERS: number; - SAMPLE_COVERAGE: number; - SAMPLE_COVERAGE_INVERT: number; - SAMPLE_COVERAGE_VALUE: number; - SCISSOR_BOX: number; - SCISSOR_TEST: number; - SHADER_TYPE: number; - SHADING_LANGUAGE_VERSION: number; - SHORT: number; - SRC_ALPHA: number; - SRC_ALPHA_SATURATE: number; - SRC_COLOR: number; - STATIC_DRAW: number; - STENCIL_ATTACHMENT: number; - STENCIL_BACK_FAIL: number; - STENCIL_BACK_FUNC: number; - STENCIL_BACK_PASS_DEPTH_FAIL: number; - STENCIL_BACK_PASS_DEPTH_PASS: number; - STENCIL_BACK_REF: number; - STENCIL_BACK_VALUE_MASK: number; - STENCIL_BACK_WRITEMASK: number; - STENCIL_BITS: number; - STENCIL_BUFFER_BIT: number; - STENCIL_CLEAR_VALUE: number; - STENCIL_FAIL: number; - STENCIL_FUNC: number; - STENCIL_INDEX: number; - STENCIL_INDEX8: number; - STENCIL_PASS_DEPTH_FAIL: number; - STENCIL_PASS_DEPTH_PASS: number; - STENCIL_REF: number; - STENCIL_TEST: number; - STENCIL_VALUE_MASK: number; - STENCIL_WRITEMASK: number; - STREAM_DRAW: number; - SUBPIXEL_BITS: number; - TEXTURE: number; - TEXTURE0: number; - TEXTURE1: number; - TEXTURE10: number; - TEXTURE11: number; - TEXTURE12: number; - TEXTURE13: number; - TEXTURE14: number; - TEXTURE15: number; - TEXTURE16: number; - TEXTURE17: number; - TEXTURE18: number; - TEXTURE19: number; - TEXTURE2: number; - TEXTURE20: number; - TEXTURE21: number; - TEXTURE22: number; - TEXTURE23: number; - TEXTURE24: number; - TEXTURE25: number; - TEXTURE26: number; - TEXTURE27: number; - TEXTURE28: number; - TEXTURE29: number; - TEXTURE3: number; - TEXTURE30: number; - TEXTURE31: number; - TEXTURE4: number; - TEXTURE5: number; - TEXTURE6: number; - TEXTURE7: number; - TEXTURE8: number; - TEXTURE9: number; - TEXTURE_2D: number; - TEXTURE_BINDING_2D: number; - TEXTURE_BINDING_CUBE_MAP: number; - TEXTURE_CUBE_MAP: number; - TEXTURE_CUBE_MAP_NEGATIVE_X: number; - TEXTURE_CUBE_MAP_NEGATIVE_Y: number; - TEXTURE_CUBE_MAP_NEGATIVE_Z: number; - TEXTURE_CUBE_MAP_POSITIVE_X: number; - TEXTURE_CUBE_MAP_POSITIVE_Y: number; - TEXTURE_CUBE_MAP_POSITIVE_Z: number; - TEXTURE_MAG_FILTER: number; - TEXTURE_MIN_FILTER: number; - TEXTURE_WRAP_S: number; - TEXTURE_WRAP_T: number; - TRIANGLES: number; - TRIANGLE_FAN: number; - TRIANGLE_STRIP: number; - UNPACK_ALIGNMENT: number; - UNPACK_COLORSPACE_CONVERSION_WEBGL: number; - UNPACK_FLIP_Y_WEBGL: number; - UNPACK_PREMULTIPLY_ALPHA_WEBGL: number; - UNSIGNED_BYTE: number; - UNSIGNED_INT: number; - UNSIGNED_SHORT: number; - UNSIGNED_SHORT_4_4_4_4: number; - UNSIGNED_SHORT_5_5_5_1: number; - UNSIGNED_SHORT_5_6_5: number; - VALIDATE_STATUS: number; - VENDOR: number; - VERSION: number; - VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number; - VERTEX_ATTRIB_ARRAY_ENABLED: number; - VERTEX_ATTRIB_ARRAY_NORMALIZED: number; - VERTEX_ATTRIB_ARRAY_POINTER: number; - VERTEX_ATTRIB_ARRAY_SIZE: number; - VERTEX_ATTRIB_ARRAY_STRIDE: number; - VERTEX_ATTRIB_ARRAY_TYPE: number; - VERTEX_SHADER: number; - VIEWPORT: number; - ZERO: number; + readonly ACTIVE_ATTRIBUTES: number; + readonly ACTIVE_TEXTURE: number; + readonly ACTIVE_UNIFORMS: number; + readonly ALIASED_LINE_WIDTH_RANGE: number; + readonly ALIASED_POINT_SIZE_RANGE: number; + readonly ALPHA: number; + readonly ALPHA_BITS: number; + readonly ALWAYS: number; + readonly ARRAY_BUFFER: number; + readonly ARRAY_BUFFER_BINDING: number; + readonly ATTACHED_SHADERS: number; + readonly BACK: number; + readonly BLEND: number; + readonly BLEND_COLOR: number; + readonly BLEND_DST_ALPHA: number; + readonly BLEND_DST_RGB: number; + readonly BLEND_EQUATION: number; + readonly BLEND_EQUATION_ALPHA: number; + readonly BLEND_EQUATION_RGB: number; + readonly BLEND_SRC_ALPHA: number; + readonly BLEND_SRC_RGB: number; + readonly BLUE_BITS: number; + readonly BOOL: number; + readonly BOOL_VEC2: number; + readonly BOOL_VEC3: number; + readonly BOOL_VEC4: number; + readonly BROWSER_DEFAULT_WEBGL: number; + readonly BUFFER_SIZE: number; + readonly BUFFER_USAGE: number; + readonly BYTE: number; + readonly CCW: number; + readonly CLAMP_TO_EDGE: number; + readonly COLOR_ATTACHMENT0: number; + readonly COLOR_BUFFER_BIT: number; + readonly COLOR_CLEAR_VALUE: number; + readonly COLOR_WRITEMASK: number; + readonly COMPILE_STATUS: number; + readonly COMPRESSED_TEXTURE_FORMATS: number; + readonly CONSTANT_ALPHA: number; + readonly CONSTANT_COLOR: number; + readonly CONTEXT_LOST_WEBGL: number; + readonly CULL_FACE: number; + readonly CULL_FACE_MODE: number; + readonly CURRENT_PROGRAM: number; + readonly CURRENT_VERTEX_ATTRIB: number; + readonly CW: number; + readonly DECR: number; + readonly DECR_WRAP: number; + readonly DELETE_STATUS: number; + readonly DEPTH_ATTACHMENT: number; + readonly DEPTH_BITS: number; + readonly DEPTH_BUFFER_BIT: number; + readonly DEPTH_CLEAR_VALUE: number; + readonly DEPTH_COMPONENT: number; + readonly DEPTH_COMPONENT16: number; + readonly DEPTH_FUNC: number; + readonly DEPTH_RANGE: number; + readonly DEPTH_STENCIL: number; + readonly DEPTH_STENCIL_ATTACHMENT: number; + readonly DEPTH_TEST: number; + readonly DEPTH_WRITEMASK: number; + readonly DITHER: number; + readonly DONT_CARE: number; + readonly DST_ALPHA: number; + readonly DST_COLOR: number; + readonly DYNAMIC_DRAW: number; + readonly ELEMENT_ARRAY_BUFFER: number; + readonly ELEMENT_ARRAY_BUFFER_BINDING: number; + readonly EQUAL: number; + readonly FASTEST: number; + readonly FLOAT: number; + readonly FLOAT_MAT2: number; + readonly FLOAT_MAT3: number; + readonly FLOAT_MAT4: number; + readonly FLOAT_VEC2: number; + readonly FLOAT_VEC3: number; + readonly FLOAT_VEC4: number; + readonly FRAGMENT_SHADER: number; + readonly FRAMEBUFFER: number; + readonly FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number; + readonly FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number; + readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number; + readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number; + readonly FRAMEBUFFER_BINDING: number; + readonly FRAMEBUFFER_COMPLETE: number; + readonly FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number; + readonly FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number; + readonly FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number; + readonly FRAMEBUFFER_UNSUPPORTED: number; + readonly FRONT: number; + readonly FRONT_AND_BACK: number; + readonly FRONT_FACE: number; + readonly FUNC_ADD: number; + readonly FUNC_REVERSE_SUBTRACT: number; + readonly FUNC_SUBTRACT: number; + readonly GENERATE_MIPMAP_HINT: number; + readonly GEQUAL: number; + readonly GREATER: number; + readonly GREEN_BITS: number; + readonly HIGH_FLOAT: number; + readonly HIGH_INT: number; + readonly IMPLEMENTATION_COLOR_READ_FORMAT: number; + readonly IMPLEMENTATION_COLOR_READ_TYPE: number; + readonly INCR: number; + readonly INCR_WRAP: number; + readonly INT: number; + readonly INT_VEC2: number; + readonly INT_VEC3: number; + readonly INT_VEC4: number; + readonly INVALID_ENUM: number; + readonly INVALID_FRAMEBUFFER_OPERATION: number; + readonly INVALID_OPERATION: number; + readonly INVALID_VALUE: number; + readonly INVERT: number; + readonly KEEP: number; + readonly LEQUAL: number; + readonly LESS: number; + readonly LINEAR: number; + readonly LINEAR_MIPMAP_LINEAR: number; + readonly LINEAR_MIPMAP_NEAREST: number; + readonly LINES: number; + readonly LINE_LOOP: number; + readonly LINE_STRIP: number; + readonly LINE_WIDTH: number; + readonly LINK_STATUS: number; + readonly LOW_FLOAT: number; + readonly LOW_INT: number; + readonly LUMINANCE: number; + readonly LUMINANCE_ALPHA: number; + readonly MAX_COMBINED_TEXTURE_IMAGE_UNITS: number; + readonly MAX_CUBE_MAP_TEXTURE_SIZE: number; + readonly MAX_FRAGMENT_UNIFORM_VECTORS: number; + readonly MAX_RENDERBUFFER_SIZE: number; + readonly MAX_TEXTURE_IMAGE_UNITS: number; + readonly MAX_TEXTURE_SIZE: number; + readonly MAX_VARYING_VECTORS: number; + readonly MAX_VERTEX_ATTRIBS: number; + readonly MAX_VERTEX_TEXTURE_IMAGE_UNITS: number; + readonly MAX_VERTEX_UNIFORM_VECTORS: number; + readonly MAX_VIEWPORT_DIMS: number; + readonly MEDIUM_FLOAT: number; + readonly MEDIUM_INT: number; + readonly MIRRORED_REPEAT: number; + readonly NEAREST: number; + readonly NEAREST_MIPMAP_LINEAR: number; + readonly NEAREST_MIPMAP_NEAREST: number; + readonly NEVER: number; + readonly NICEST: number; + readonly NONE: number; + readonly NOTEQUAL: number; + readonly NO_ERROR: number; + readonly ONE: number; + readonly ONE_MINUS_CONSTANT_ALPHA: number; + readonly ONE_MINUS_CONSTANT_COLOR: number; + readonly ONE_MINUS_DST_ALPHA: number; + readonly ONE_MINUS_DST_COLOR: number; + readonly ONE_MINUS_SRC_ALPHA: number; + readonly ONE_MINUS_SRC_COLOR: number; + readonly OUT_OF_MEMORY: number; + readonly PACK_ALIGNMENT: number; + readonly POINTS: number; + readonly POLYGON_OFFSET_FACTOR: number; + readonly POLYGON_OFFSET_FILL: number; + readonly POLYGON_OFFSET_UNITS: number; + readonly RED_BITS: number; + readonly RENDERBUFFER: number; + readonly RENDERBUFFER_ALPHA_SIZE: number; + readonly RENDERBUFFER_BINDING: number; + readonly RENDERBUFFER_BLUE_SIZE: number; + readonly RENDERBUFFER_DEPTH_SIZE: number; + readonly RENDERBUFFER_GREEN_SIZE: number; + readonly RENDERBUFFER_HEIGHT: number; + readonly RENDERBUFFER_INTERNAL_FORMAT: number; + readonly RENDERBUFFER_RED_SIZE: number; + readonly RENDERBUFFER_STENCIL_SIZE: number; + readonly RENDERBUFFER_WIDTH: number; + readonly RENDERER: number; + readonly REPEAT: number; + readonly REPLACE: number; + readonly RGB: number; + readonly RGB565: number; + readonly RGB5_A1: number; + readonly RGBA: number; + readonly RGBA4: number; + readonly SAMPLER_2D: number; + readonly SAMPLER_CUBE: number; + readonly SAMPLES: number; + readonly SAMPLE_ALPHA_TO_COVERAGE: number; + readonly SAMPLE_BUFFERS: number; + readonly SAMPLE_COVERAGE: number; + readonly SAMPLE_COVERAGE_INVERT: number; + readonly SAMPLE_COVERAGE_VALUE: number; + readonly SCISSOR_BOX: number; + readonly SCISSOR_TEST: number; + readonly SHADER_TYPE: number; + readonly SHADING_LANGUAGE_VERSION: number; + readonly SHORT: number; + readonly SRC_ALPHA: number; + readonly SRC_ALPHA_SATURATE: number; + readonly SRC_COLOR: number; + readonly STATIC_DRAW: number; + readonly STENCIL_ATTACHMENT: number; + readonly STENCIL_BACK_FAIL: number; + readonly STENCIL_BACK_FUNC: number; + readonly STENCIL_BACK_PASS_DEPTH_FAIL: number; + readonly STENCIL_BACK_PASS_DEPTH_PASS: number; + readonly STENCIL_BACK_REF: number; + readonly STENCIL_BACK_VALUE_MASK: number; + readonly STENCIL_BACK_WRITEMASK: number; + readonly STENCIL_BITS: number; + readonly STENCIL_BUFFER_BIT: number; + readonly STENCIL_CLEAR_VALUE: number; + readonly STENCIL_FAIL: number; + readonly STENCIL_FUNC: number; + readonly STENCIL_INDEX: number; + readonly STENCIL_INDEX8: number; + readonly STENCIL_PASS_DEPTH_FAIL: number; + readonly STENCIL_PASS_DEPTH_PASS: number; + readonly STENCIL_REF: number; + readonly STENCIL_TEST: number; + readonly STENCIL_VALUE_MASK: number; + readonly STENCIL_WRITEMASK: number; + readonly STREAM_DRAW: number; + readonly SUBPIXEL_BITS: number; + readonly TEXTURE: number; + readonly TEXTURE0: number; + readonly TEXTURE1: number; + readonly TEXTURE10: number; + readonly TEXTURE11: number; + readonly TEXTURE12: number; + readonly TEXTURE13: number; + readonly TEXTURE14: number; + readonly TEXTURE15: number; + readonly TEXTURE16: number; + readonly TEXTURE17: number; + readonly TEXTURE18: number; + readonly TEXTURE19: number; + readonly TEXTURE2: number; + readonly TEXTURE20: number; + readonly TEXTURE21: number; + readonly TEXTURE22: number; + readonly TEXTURE23: number; + readonly TEXTURE24: number; + readonly TEXTURE25: number; + readonly TEXTURE26: number; + readonly TEXTURE27: number; + readonly TEXTURE28: number; + readonly TEXTURE29: number; + readonly TEXTURE3: number; + readonly TEXTURE30: number; + readonly TEXTURE31: number; + readonly TEXTURE4: number; + readonly TEXTURE5: number; + readonly TEXTURE6: number; + readonly TEXTURE7: number; + readonly TEXTURE8: number; + readonly TEXTURE9: number; + readonly TEXTURE_2D: number; + readonly TEXTURE_BINDING_2D: number; + readonly TEXTURE_BINDING_CUBE_MAP: number; + readonly TEXTURE_CUBE_MAP: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_X: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_Y: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_Z: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_X: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_Y: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_Z: number; + readonly TEXTURE_MAG_FILTER: number; + readonly TEXTURE_MIN_FILTER: number; + readonly TEXTURE_WRAP_S: number; + readonly TEXTURE_WRAP_T: number; + readonly TRIANGLES: number; + readonly TRIANGLE_FAN: number; + readonly TRIANGLE_STRIP: number; + readonly UNPACK_ALIGNMENT: number; + readonly UNPACK_COLORSPACE_CONVERSION_WEBGL: number; + readonly UNPACK_FLIP_Y_WEBGL: number; + readonly UNPACK_PREMULTIPLY_ALPHA_WEBGL: number; + readonly UNSIGNED_BYTE: number; + readonly UNSIGNED_INT: number; + readonly UNSIGNED_SHORT: number; + readonly UNSIGNED_SHORT_4_4_4_4: number; + readonly UNSIGNED_SHORT_5_5_5_1: number; + readonly UNSIGNED_SHORT_5_6_5: number; + readonly VALIDATE_STATUS: number; + readonly VENDOR: number; + readonly VERSION: number; + readonly VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number; + readonly VERTEX_ATTRIB_ARRAY_ENABLED: number; + readonly VERTEX_ATTRIB_ARRAY_NORMALIZED: number; + readonly VERTEX_ATTRIB_ARRAY_POINTER: number; + readonly VERTEX_ATTRIB_ARRAY_SIZE: number; + readonly VERTEX_ATTRIB_ARRAY_STRIDE: number; + readonly VERTEX_ATTRIB_ARRAY_TYPE: number; + readonly VERTEX_SHADER: number; + readonly VIEWPORT: number; + readonly ZERO: number; } declare var WebGLRenderingContext: { prototype: WebGLRenderingContext; new(): WebGLRenderingContext; - ACTIVE_ATTRIBUTES: number; - ACTIVE_TEXTURE: number; - ACTIVE_UNIFORMS: number; - ALIASED_LINE_WIDTH_RANGE: number; - ALIASED_POINT_SIZE_RANGE: number; - ALPHA: number; - ALPHA_BITS: number; - ALWAYS: number; - ARRAY_BUFFER: number; - ARRAY_BUFFER_BINDING: number; - ATTACHED_SHADERS: number; - BACK: number; - BLEND: number; - BLEND_COLOR: number; - BLEND_DST_ALPHA: number; - BLEND_DST_RGB: number; - BLEND_EQUATION: number; - BLEND_EQUATION_ALPHA: number; - BLEND_EQUATION_RGB: number; - BLEND_SRC_ALPHA: number; - BLEND_SRC_RGB: number; - BLUE_BITS: number; - BOOL: number; - BOOL_VEC2: number; - BOOL_VEC3: number; - BOOL_VEC4: number; - BROWSER_DEFAULT_WEBGL: number; - BUFFER_SIZE: number; - BUFFER_USAGE: number; - BYTE: number; - CCW: number; - CLAMP_TO_EDGE: number; - COLOR_ATTACHMENT0: number; - COLOR_BUFFER_BIT: number; - COLOR_CLEAR_VALUE: number; - COLOR_WRITEMASK: number; - COMPILE_STATUS: number; - COMPRESSED_TEXTURE_FORMATS: number; - CONSTANT_ALPHA: number; - CONSTANT_COLOR: number; - CONTEXT_LOST_WEBGL: number; - CULL_FACE: number; - CULL_FACE_MODE: number; - CURRENT_PROGRAM: number; - CURRENT_VERTEX_ATTRIB: number; - CW: number; - DECR: number; - DECR_WRAP: number; - DELETE_STATUS: number; - DEPTH_ATTACHMENT: number; - DEPTH_BITS: number; - DEPTH_BUFFER_BIT: number; - DEPTH_CLEAR_VALUE: number; - DEPTH_COMPONENT: number; - DEPTH_COMPONENT16: number; - DEPTH_FUNC: number; - DEPTH_RANGE: number; - DEPTH_STENCIL: number; - DEPTH_STENCIL_ATTACHMENT: number; - DEPTH_TEST: number; - DEPTH_WRITEMASK: number; - DITHER: number; - DONT_CARE: number; - DST_ALPHA: number; - DST_COLOR: number; - DYNAMIC_DRAW: number; - ELEMENT_ARRAY_BUFFER: number; - ELEMENT_ARRAY_BUFFER_BINDING: number; - EQUAL: number; - FASTEST: number; - FLOAT: number; - FLOAT_MAT2: number; - FLOAT_MAT3: number; - FLOAT_MAT4: number; - FLOAT_VEC2: number; - FLOAT_VEC3: number; - FLOAT_VEC4: number; - FRAGMENT_SHADER: number; - FRAMEBUFFER: number; - FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number; - FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number; - FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number; - FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number; - FRAMEBUFFER_BINDING: number; - FRAMEBUFFER_COMPLETE: number; - FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number; - FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number; - FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number; - FRAMEBUFFER_UNSUPPORTED: number; - FRONT: number; - FRONT_AND_BACK: number; - FRONT_FACE: number; - FUNC_ADD: number; - FUNC_REVERSE_SUBTRACT: number; - FUNC_SUBTRACT: number; - GENERATE_MIPMAP_HINT: number; - GEQUAL: number; - GREATER: number; - GREEN_BITS: number; - HIGH_FLOAT: number; - HIGH_INT: number; - IMPLEMENTATION_COLOR_READ_FORMAT: number; - IMPLEMENTATION_COLOR_READ_TYPE: number; - INCR: number; - INCR_WRAP: number; - INT: number; - INT_VEC2: number; - INT_VEC3: number; - INT_VEC4: number; - INVALID_ENUM: number; - INVALID_FRAMEBUFFER_OPERATION: number; - INVALID_OPERATION: number; - INVALID_VALUE: number; - INVERT: number; - KEEP: number; - LEQUAL: number; - LESS: number; - LINEAR: number; - LINEAR_MIPMAP_LINEAR: number; - LINEAR_MIPMAP_NEAREST: number; - LINES: number; - LINE_LOOP: number; - LINE_STRIP: number; - LINE_WIDTH: number; - LINK_STATUS: number; - LOW_FLOAT: number; - LOW_INT: number; - LUMINANCE: number; - LUMINANCE_ALPHA: number; - MAX_COMBINED_TEXTURE_IMAGE_UNITS: number; - MAX_CUBE_MAP_TEXTURE_SIZE: number; - MAX_FRAGMENT_UNIFORM_VECTORS: number; - MAX_RENDERBUFFER_SIZE: number; - MAX_TEXTURE_IMAGE_UNITS: number; - MAX_TEXTURE_SIZE: number; - MAX_VARYING_VECTORS: number; - MAX_VERTEX_ATTRIBS: number; - MAX_VERTEX_TEXTURE_IMAGE_UNITS: number; - MAX_VERTEX_UNIFORM_VECTORS: number; - MAX_VIEWPORT_DIMS: number; - MEDIUM_FLOAT: number; - MEDIUM_INT: number; - MIRRORED_REPEAT: number; - NEAREST: number; - NEAREST_MIPMAP_LINEAR: number; - NEAREST_MIPMAP_NEAREST: number; - NEVER: number; - NICEST: number; - NONE: number; - NOTEQUAL: number; - NO_ERROR: number; - ONE: number; - ONE_MINUS_CONSTANT_ALPHA: number; - ONE_MINUS_CONSTANT_COLOR: number; - ONE_MINUS_DST_ALPHA: number; - ONE_MINUS_DST_COLOR: number; - ONE_MINUS_SRC_ALPHA: number; - ONE_MINUS_SRC_COLOR: number; - OUT_OF_MEMORY: number; - PACK_ALIGNMENT: number; - POINTS: number; - POLYGON_OFFSET_FACTOR: number; - POLYGON_OFFSET_FILL: number; - POLYGON_OFFSET_UNITS: number; - RED_BITS: number; - RENDERBUFFER: number; - RENDERBUFFER_ALPHA_SIZE: number; - RENDERBUFFER_BINDING: number; - RENDERBUFFER_BLUE_SIZE: number; - RENDERBUFFER_DEPTH_SIZE: number; - RENDERBUFFER_GREEN_SIZE: number; - RENDERBUFFER_HEIGHT: number; - RENDERBUFFER_INTERNAL_FORMAT: number; - RENDERBUFFER_RED_SIZE: number; - RENDERBUFFER_STENCIL_SIZE: number; - RENDERBUFFER_WIDTH: number; - RENDERER: number; - REPEAT: number; - REPLACE: number; - RGB: number; - RGB565: number; - RGB5_A1: number; - RGBA: number; - RGBA4: number; - SAMPLER_2D: number; - SAMPLER_CUBE: number; - SAMPLES: number; - SAMPLE_ALPHA_TO_COVERAGE: number; - SAMPLE_BUFFERS: number; - SAMPLE_COVERAGE: number; - SAMPLE_COVERAGE_INVERT: number; - SAMPLE_COVERAGE_VALUE: number; - SCISSOR_BOX: number; - SCISSOR_TEST: number; - SHADER_TYPE: number; - SHADING_LANGUAGE_VERSION: number; - SHORT: number; - SRC_ALPHA: number; - SRC_ALPHA_SATURATE: number; - SRC_COLOR: number; - STATIC_DRAW: number; - STENCIL_ATTACHMENT: number; - STENCIL_BACK_FAIL: number; - STENCIL_BACK_FUNC: number; - STENCIL_BACK_PASS_DEPTH_FAIL: number; - STENCIL_BACK_PASS_DEPTH_PASS: number; - STENCIL_BACK_REF: number; - STENCIL_BACK_VALUE_MASK: number; - STENCIL_BACK_WRITEMASK: number; - STENCIL_BITS: number; - STENCIL_BUFFER_BIT: number; - STENCIL_CLEAR_VALUE: number; - STENCIL_FAIL: number; - STENCIL_FUNC: number; - STENCIL_INDEX: number; - STENCIL_INDEX8: number; - STENCIL_PASS_DEPTH_FAIL: number; - STENCIL_PASS_DEPTH_PASS: number; - STENCIL_REF: number; - STENCIL_TEST: number; - STENCIL_VALUE_MASK: number; - STENCIL_WRITEMASK: number; - STREAM_DRAW: number; - SUBPIXEL_BITS: number; - TEXTURE: number; - TEXTURE0: number; - TEXTURE1: number; - TEXTURE10: number; - TEXTURE11: number; - TEXTURE12: number; - TEXTURE13: number; - TEXTURE14: number; - TEXTURE15: number; - TEXTURE16: number; - TEXTURE17: number; - TEXTURE18: number; - TEXTURE19: number; - TEXTURE2: number; - TEXTURE20: number; - TEXTURE21: number; - TEXTURE22: number; - TEXTURE23: number; - TEXTURE24: number; - TEXTURE25: number; - TEXTURE26: number; - TEXTURE27: number; - TEXTURE28: number; - TEXTURE29: number; - TEXTURE3: number; - TEXTURE30: number; - TEXTURE31: number; - TEXTURE4: number; - TEXTURE5: number; - TEXTURE6: number; - TEXTURE7: number; - TEXTURE8: number; - TEXTURE9: number; - TEXTURE_2D: number; - TEXTURE_BINDING_2D: number; - TEXTURE_BINDING_CUBE_MAP: number; - TEXTURE_CUBE_MAP: number; - TEXTURE_CUBE_MAP_NEGATIVE_X: number; - TEXTURE_CUBE_MAP_NEGATIVE_Y: number; - TEXTURE_CUBE_MAP_NEGATIVE_Z: number; - TEXTURE_CUBE_MAP_POSITIVE_X: number; - TEXTURE_CUBE_MAP_POSITIVE_Y: number; - TEXTURE_CUBE_MAP_POSITIVE_Z: number; - TEXTURE_MAG_FILTER: number; - TEXTURE_MIN_FILTER: number; - TEXTURE_WRAP_S: number; - TEXTURE_WRAP_T: number; - TRIANGLES: number; - TRIANGLE_FAN: number; - TRIANGLE_STRIP: number; - UNPACK_ALIGNMENT: number; - UNPACK_COLORSPACE_CONVERSION_WEBGL: number; - UNPACK_FLIP_Y_WEBGL: number; - UNPACK_PREMULTIPLY_ALPHA_WEBGL: number; - UNSIGNED_BYTE: number; - UNSIGNED_INT: number; - UNSIGNED_SHORT: number; - UNSIGNED_SHORT_4_4_4_4: number; - UNSIGNED_SHORT_5_5_5_1: number; - UNSIGNED_SHORT_5_6_5: number; - VALIDATE_STATUS: number; - VENDOR: number; - VERSION: number; - VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number; - VERTEX_ATTRIB_ARRAY_ENABLED: number; - VERTEX_ATTRIB_ARRAY_NORMALIZED: number; - VERTEX_ATTRIB_ARRAY_POINTER: number; - VERTEX_ATTRIB_ARRAY_SIZE: number; - VERTEX_ATTRIB_ARRAY_STRIDE: number; - VERTEX_ATTRIB_ARRAY_TYPE: number; - VERTEX_SHADER: number; - VIEWPORT: number; - ZERO: number; + readonly ACTIVE_ATTRIBUTES: number; + readonly ACTIVE_TEXTURE: number; + readonly ACTIVE_UNIFORMS: number; + readonly ALIASED_LINE_WIDTH_RANGE: number; + readonly ALIASED_POINT_SIZE_RANGE: number; + readonly ALPHA: number; + readonly ALPHA_BITS: number; + readonly ALWAYS: number; + readonly ARRAY_BUFFER: number; + readonly ARRAY_BUFFER_BINDING: number; + readonly ATTACHED_SHADERS: number; + readonly BACK: number; + readonly BLEND: number; + readonly BLEND_COLOR: number; + readonly BLEND_DST_ALPHA: number; + readonly BLEND_DST_RGB: number; + readonly BLEND_EQUATION: number; + readonly BLEND_EQUATION_ALPHA: number; + readonly BLEND_EQUATION_RGB: number; + readonly BLEND_SRC_ALPHA: number; + readonly BLEND_SRC_RGB: number; + readonly BLUE_BITS: number; + readonly BOOL: number; + readonly BOOL_VEC2: number; + readonly BOOL_VEC3: number; + readonly BOOL_VEC4: number; + readonly BROWSER_DEFAULT_WEBGL: number; + readonly BUFFER_SIZE: number; + readonly BUFFER_USAGE: number; + readonly BYTE: number; + readonly CCW: number; + readonly CLAMP_TO_EDGE: number; + readonly COLOR_ATTACHMENT0: number; + readonly COLOR_BUFFER_BIT: number; + readonly COLOR_CLEAR_VALUE: number; + readonly COLOR_WRITEMASK: number; + readonly COMPILE_STATUS: number; + readonly COMPRESSED_TEXTURE_FORMATS: number; + readonly CONSTANT_ALPHA: number; + readonly CONSTANT_COLOR: number; + readonly CONTEXT_LOST_WEBGL: number; + readonly CULL_FACE: number; + readonly CULL_FACE_MODE: number; + readonly CURRENT_PROGRAM: number; + readonly CURRENT_VERTEX_ATTRIB: number; + readonly CW: number; + readonly DECR: number; + readonly DECR_WRAP: number; + readonly DELETE_STATUS: number; + readonly DEPTH_ATTACHMENT: number; + readonly DEPTH_BITS: number; + readonly DEPTH_BUFFER_BIT: number; + readonly DEPTH_CLEAR_VALUE: number; + readonly DEPTH_COMPONENT: number; + readonly DEPTH_COMPONENT16: number; + readonly DEPTH_FUNC: number; + readonly DEPTH_RANGE: number; + readonly DEPTH_STENCIL: number; + readonly DEPTH_STENCIL_ATTACHMENT: number; + readonly DEPTH_TEST: number; + readonly DEPTH_WRITEMASK: number; + readonly DITHER: number; + readonly DONT_CARE: number; + readonly DST_ALPHA: number; + readonly DST_COLOR: number; + readonly DYNAMIC_DRAW: number; + readonly ELEMENT_ARRAY_BUFFER: number; + readonly ELEMENT_ARRAY_BUFFER_BINDING: number; + readonly EQUAL: number; + readonly FASTEST: number; + readonly FLOAT: number; + readonly FLOAT_MAT2: number; + readonly FLOAT_MAT3: number; + readonly FLOAT_MAT4: number; + readonly FLOAT_VEC2: number; + readonly FLOAT_VEC3: number; + readonly FLOAT_VEC4: number; + readonly FRAGMENT_SHADER: number; + readonly FRAMEBUFFER: number; + readonly FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number; + readonly FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number; + readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number; + readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number; + readonly FRAMEBUFFER_BINDING: number; + readonly FRAMEBUFFER_COMPLETE: number; + readonly FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number; + readonly FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number; + readonly FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number; + readonly FRAMEBUFFER_UNSUPPORTED: number; + readonly FRONT: number; + readonly FRONT_AND_BACK: number; + readonly FRONT_FACE: number; + readonly FUNC_ADD: number; + readonly FUNC_REVERSE_SUBTRACT: number; + readonly FUNC_SUBTRACT: number; + readonly GENERATE_MIPMAP_HINT: number; + readonly GEQUAL: number; + readonly GREATER: number; + readonly GREEN_BITS: number; + readonly HIGH_FLOAT: number; + readonly HIGH_INT: number; + readonly IMPLEMENTATION_COLOR_READ_FORMAT: number; + readonly IMPLEMENTATION_COLOR_READ_TYPE: number; + readonly INCR: number; + readonly INCR_WRAP: number; + readonly INT: number; + readonly INT_VEC2: number; + readonly INT_VEC3: number; + readonly INT_VEC4: number; + readonly INVALID_ENUM: number; + readonly INVALID_FRAMEBUFFER_OPERATION: number; + readonly INVALID_OPERATION: number; + readonly INVALID_VALUE: number; + readonly INVERT: number; + readonly KEEP: number; + readonly LEQUAL: number; + readonly LESS: number; + readonly LINEAR: number; + readonly LINEAR_MIPMAP_LINEAR: number; + readonly LINEAR_MIPMAP_NEAREST: number; + readonly LINES: number; + readonly LINE_LOOP: number; + readonly LINE_STRIP: number; + readonly LINE_WIDTH: number; + readonly LINK_STATUS: number; + readonly LOW_FLOAT: number; + readonly LOW_INT: number; + readonly LUMINANCE: number; + readonly LUMINANCE_ALPHA: number; + readonly MAX_COMBINED_TEXTURE_IMAGE_UNITS: number; + readonly MAX_CUBE_MAP_TEXTURE_SIZE: number; + readonly MAX_FRAGMENT_UNIFORM_VECTORS: number; + readonly MAX_RENDERBUFFER_SIZE: number; + readonly MAX_TEXTURE_IMAGE_UNITS: number; + readonly MAX_TEXTURE_SIZE: number; + readonly MAX_VARYING_VECTORS: number; + readonly MAX_VERTEX_ATTRIBS: number; + readonly MAX_VERTEX_TEXTURE_IMAGE_UNITS: number; + readonly MAX_VERTEX_UNIFORM_VECTORS: number; + readonly MAX_VIEWPORT_DIMS: number; + readonly MEDIUM_FLOAT: number; + readonly MEDIUM_INT: number; + readonly MIRRORED_REPEAT: number; + readonly NEAREST: number; + readonly NEAREST_MIPMAP_LINEAR: number; + readonly NEAREST_MIPMAP_NEAREST: number; + readonly NEVER: number; + readonly NICEST: number; + readonly NONE: number; + readonly NOTEQUAL: number; + readonly NO_ERROR: number; + readonly ONE: number; + readonly ONE_MINUS_CONSTANT_ALPHA: number; + readonly ONE_MINUS_CONSTANT_COLOR: number; + readonly ONE_MINUS_DST_ALPHA: number; + readonly ONE_MINUS_DST_COLOR: number; + readonly ONE_MINUS_SRC_ALPHA: number; + readonly ONE_MINUS_SRC_COLOR: number; + readonly OUT_OF_MEMORY: number; + readonly PACK_ALIGNMENT: number; + readonly POINTS: number; + readonly POLYGON_OFFSET_FACTOR: number; + readonly POLYGON_OFFSET_FILL: number; + readonly POLYGON_OFFSET_UNITS: number; + readonly RED_BITS: number; + readonly RENDERBUFFER: number; + readonly RENDERBUFFER_ALPHA_SIZE: number; + readonly RENDERBUFFER_BINDING: number; + readonly RENDERBUFFER_BLUE_SIZE: number; + readonly RENDERBUFFER_DEPTH_SIZE: number; + readonly RENDERBUFFER_GREEN_SIZE: number; + readonly RENDERBUFFER_HEIGHT: number; + readonly RENDERBUFFER_INTERNAL_FORMAT: number; + readonly RENDERBUFFER_RED_SIZE: number; + readonly RENDERBUFFER_STENCIL_SIZE: number; + readonly RENDERBUFFER_WIDTH: number; + readonly RENDERER: number; + readonly REPEAT: number; + readonly REPLACE: number; + readonly RGB: number; + readonly RGB565: number; + readonly RGB5_A1: number; + readonly RGBA: number; + readonly RGBA4: number; + readonly SAMPLER_2D: number; + readonly SAMPLER_CUBE: number; + readonly SAMPLES: number; + readonly SAMPLE_ALPHA_TO_COVERAGE: number; + readonly SAMPLE_BUFFERS: number; + readonly SAMPLE_COVERAGE: number; + readonly SAMPLE_COVERAGE_INVERT: number; + readonly SAMPLE_COVERAGE_VALUE: number; + readonly SCISSOR_BOX: number; + readonly SCISSOR_TEST: number; + readonly SHADER_TYPE: number; + readonly SHADING_LANGUAGE_VERSION: number; + readonly SHORT: number; + readonly SRC_ALPHA: number; + readonly SRC_ALPHA_SATURATE: number; + readonly SRC_COLOR: number; + readonly STATIC_DRAW: number; + readonly STENCIL_ATTACHMENT: number; + readonly STENCIL_BACK_FAIL: number; + readonly STENCIL_BACK_FUNC: number; + readonly STENCIL_BACK_PASS_DEPTH_FAIL: number; + readonly STENCIL_BACK_PASS_DEPTH_PASS: number; + readonly STENCIL_BACK_REF: number; + readonly STENCIL_BACK_VALUE_MASK: number; + readonly STENCIL_BACK_WRITEMASK: number; + readonly STENCIL_BITS: number; + readonly STENCIL_BUFFER_BIT: number; + readonly STENCIL_CLEAR_VALUE: number; + readonly STENCIL_FAIL: number; + readonly STENCIL_FUNC: number; + readonly STENCIL_INDEX: number; + readonly STENCIL_INDEX8: number; + readonly STENCIL_PASS_DEPTH_FAIL: number; + readonly STENCIL_PASS_DEPTH_PASS: number; + readonly STENCIL_REF: number; + readonly STENCIL_TEST: number; + readonly STENCIL_VALUE_MASK: number; + readonly STENCIL_WRITEMASK: number; + readonly STREAM_DRAW: number; + readonly SUBPIXEL_BITS: number; + readonly TEXTURE: number; + readonly TEXTURE0: number; + readonly TEXTURE1: number; + readonly TEXTURE10: number; + readonly TEXTURE11: number; + readonly TEXTURE12: number; + readonly TEXTURE13: number; + readonly TEXTURE14: number; + readonly TEXTURE15: number; + readonly TEXTURE16: number; + readonly TEXTURE17: number; + readonly TEXTURE18: number; + readonly TEXTURE19: number; + readonly TEXTURE2: number; + readonly TEXTURE20: number; + readonly TEXTURE21: number; + readonly TEXTURE22: number; + readonly TEXTURE23: number; + readonly TEXTURE24: number; + readonly TEXTURE25: number; + readonly TEXTURE26: number; + readonly TEXTURE27: number; + readonly TEXTURE28: number; + readonly TEXTURE29: number; + readonly TEXTURE3: number; + readonly TEXTURE30: number; + readonly TEXTURE31: number; + readonly TEXTURE4: number; + readonly TEXTURE5: number; + readonly TEXTURE6: number; + readonly TEXTURE7: number; + readonly TEXTURE8: number; + readonly TEXTURE9: number; + readonly TEXTURE_2D: number; + readonly TEXTURE_BINDING_2D: number; + readonly TEXTURE_BINDING_CUBE_MAP: number; + readonly TEXTURE_CUBE_MAP: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_X: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_Y: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_Z: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_X: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_Y: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_Z: number; + readonly TEXTURE_MAG_FILTER: number; + readonly TEXTURE_MIN_FILTER: number; + readonly TEXTURE_WRAP_S: number; + readonly TEXTURE_WRAP_T: number; + readonly TRIANGLES: number; + readonly TRIANGLE_FAN: number; + readonly TRIANGLE_STRIP: number; + readonly UNPACK_ALIGNMENT: number; + readonly UNPACK_COLORSPACE_CONVERSION_WEBGL: number; + readonly UNPACK_FLIP_Y_WEBGL: number; + readonly UNPACK_PREMULTIPLY_ALPHA_WEBGL: number; + readonly UNSIGNED_BYTE: number; + readonly UNSIGNED_INT: number; + readonly UNSIGNED_SHORT: number; + readonly UNSIGNED_SHORT_4_4_4_4: number; + readonly UNSIGNED_SHORT_5_5_5_1: number; + readonly UNSIGNED_SHORT_5_6_5: number; + readonly VALIDATE_STATUS: number; + readonly VENDOR: number; + readonly VERSION: number; + readonly VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number; + readonly VERTEX_ATTRIB_ARRAY_ENABLED: number; + readonly VERTEX_ATTRIB_ARRAY_NORMALIZED: number; + readonly VERTEX_ATTRIB_ARRAY_POINTER: number; + readonly VERTEX_ATTRIB_ARRAY_SIZE: number; + readonly VERTEX_ATTRIB_ARRAY_STRIDE: number; + readonly VERTEX_ATTRIB_ARRAY_TYPE: number; + readonly VERTEX_SHADER: number; + readonly VIEWPORT: number; + readonly ZERO: number; } interface WebGLShader extends WebGLObject { @@ -17041,9 +18295,9 @@ declare var WebGLShader: { } interface WebGLShaderPrecisionFormat { - precision: number; - rangeMax: number; - rangeMin: number; + readonly precision: number; + readonly rangeMax: number; + readonly rangeMin: number; } declare var WebGLShaderPrecisionFormat: { @@ -17119,21 +18373,21 @@ declare var WebKitPoint: { interface WebSocket extends EventTarget { binaryType: string; - bufferedAmount: number; - extensions: string; + readonly bufferedAmount: number; + readonly extensions: string; onclose: (ev: CloseEvent) => any; onerror: (ev: Event) => any; onmessage: (ev: MessageEvent) => any; onopen: (ev: Event) => any; - protocol: string; - readyState: number; - url: string; + readonly protocol: string; + readonly readyState: number; + readonly url: string; close(code?: number, reason?: string): void; send(data: any): void; - CLOSED: number; - CLOSING: number; - CONNECTING: number; - OPEN: number; + readonly CLOSED: number; + readonly CLOSING: number; + readonly CONNECTING: number; + readonly OPEN: number; addEventListener(type: "close", listener: (ev: CloseEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "message", listener: (ev: MessageEvent) => any, useCapture?: boolean): void; @@ -17144,56 +18398,58 @@ interface WebSocket extends EventTarget { declare var WebSocket: { prototype: WebSocket; new(url: string, protocols?: string | string[]): WebSocket; - CLOSED: number; - CLOSING: number; - CONNECTING: number; - OPEN: number; + readonly CLOSED: number; + readonly CLOSING: number; + readonly CONNECTING: number; + readonly OPEN: number; } interface WheelEvent extends MouseEvent { - deltaMode: number; - deltaX: number; - deltaY: number; - deltaZ: number; + readonly deltaMode: number; + readonly deltaX: number; + readonly deltaY: number; + readonly deltaZ: number; + readonly wheelDelta: number; + readonly wheelDeltaX: number; + readonly wheelDeltaY: number; getCurrentPoint(element: Element): void; initWheelEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, buttonArg: number, relatedTargetArg: EventTarget, modifiersListArg: string, deltaXArg: number, deltaYArg: number, deltaZArg: number, deltaMode: number): void; - DOM_DELTA_LINE: number; - DOM_DELTA_PAGE: number; - DOM_DELTA_PIXEL: number; + readonly DOM_DELTA_LINE: number; + readonly DOM_DELTA_PAGE: number; + readonly DOM_DELTA_PIXEL: number; } declare var WheelEvent: { prototype: WheelEvent; new(typeArg: string, eventInitDict?: WheelEventInit): WheelEvent; - DOM_DELTA_LINE: number; - DOM_DELTA_PAGE: number; - DOM_DELTA_PIXEL: number; + readonly DOM_DELTA_LINE: number; + readonly DOM_DELTA_PAGE: number; + readonly DOM_DELTA_PIXEL: number; } interface Window extends EventTarget, WindowTimers, WindowSessionStorage, WindowLocalStorage, WindowConsole, GlobalEventHandlers, IDBEnvironment, WindowBase64 { - animationStartTime: number; - applicationCache: ApplicationCache; - clientInformation: Navigator; - closed: boolean; - crypto: Crypto; + readonly applicationCache: ApplicationCache; + readonly clientInformation: Navigator; + readonly closed: boolean; + readonly crypto: Crypto; defaultStatus: string; - devicePixelRatio: number; - doNotTrack: string; - document: Document; + readonly devicePixelRatio: number; + readonly doNotTrack: string; + readonly document: Document; event: Event; - external: External; - frameElement: Element; - frames: Window; - history: History; - innerHeight: number; - innerWidth: number; - length: number; - location: Location; - locationbar: BarProp; - menubar: BarProp; - msAnimationStartTime: number; + readonly external: External; + readonly frameElement: Element; + readonly frames: Window; + readonly history: History; + readonly innerHeight: number; + readonly innerWidth: number; + readonly length: number; + readonly location: Location; + readonly locationbar: BarProp; + readonly menubar: BarProp; + readonly msCredentials: MSCredentials; name: string; - navigator: Navigator; + readonly navigator: Navigator; offscreenBuffering: string | boolean; onabort: (ev: Event) => any; onafterprint: (ev: Event) => any; @@ -17207,6 +18463,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window oncompassneedscalibration: (ev: Event) => any; oncontextmenu: (ev: PointerEvent) => any; ondblclick: (ev: MouseEvent) => any; + ondevicelight: (ev: DeviceLightEvent) => any; ondevicemotion: (ev: DeviceMotionEvent) => any; ondeviceorientation: (ev: DeviceOrientationEvent) => any; ondrag: (ev: DragEvent) => any; @@ -17218,11 +18475,12 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window ondrop: (ev: DragEvent) => any; ondurationchange: (ev: Event) => any; onemptied: (ev: Event) => any; - onended: (ev: Event) => any; + onended: (ev: MediaStreamErrorEvent) => any; onerror: ErrorEventHandler; onfocus: (ev: FocusEvent) => any; onhashchange: (ev: HashChangeEvent) => any; oninput: (ev: Event) => any; + oninvalid: (ev: Event) => any; onkeydown: (ev: KeyboardEvent) => any; onkeypress: (ev: KeyboardEvent) => any; onkeyup: (ev: KeyboardEvent) => any; @@ -17238,7 +18496,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window onmouseout: (ev: MouseEvent) => any; onmouseover: (ev: MouseEvent) => any; onmouseup: (ev: MouseEvent) => any; - onmousewheel: (ev: MouseWheelEvent) => any; + onmousewheel: (ev: WheelEvent) => any; onmsgesturechange: (ev: MSGestureEvent) => any; onmsgesturedoubletap: (ev: MSGestureEvent) => any; onmsgestureend: (ev: MSGestureEvent) => any; @@ -17277,38 +18535,38 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window onsubmit: (ev: Event) => any; onsuspend: (ev: Event) => any; ontimeupdate: (ev: Event) => any; - ontouchcancel: any; - ontouchend: any; - ontouchmove: any; - ontouchstart: any; + ontouchcancel: (ev: TouchEvent) => any; + ontouchend: (ev: TouchEvent) => any; + ontouchmove: (ev: TouchEvent) => any; + ontouchstart: (ev: TouchEvent) => any; onunload: (ev: Event) => any; onvolumechange: (ev: Event) => any; onwaiting: (ev: Event) => any; - opener: Window; + readonly opener: Window; orientation: string | number; - outerHeight: number; - outerWidth: number; - pageXOffset: number; - pageYOffset: number; - parent: Window; - performance: Performance; - personalbar: BarProp; - screen: Screen; - screenLeft: number; - screenTop: number; - screenX: number; - screenY: number; - scrollX: number; - scrollY: number; - scrollbars: BarProp; - self: Window; + readonly outerHeight: number; + readonly outerWidth: number; + readonly pageXOffset: number; + readonly pageYOffset: number; + readonly parent: Window; + readonly performance: Performance; + readonly personalbar: BarProp; + readonly screen: Screen; + readonly screenLeft: number; + readonly screenTop: number; + readonly screenX: number; + readonly screenY: number; + readonly scrollX: number; + readonly scrollY: number; + readonly scrollbars: BarProp; + readonly self: Window; status: string; - statusbar: BarProp; - styleMedia: StyleMedia; - toolbar: BarProp; - top: Window; - window: Window; - URL: URL; + readonly statusbar: BarProp; + readonly styleMedia: StyleMedia; + readonly toolbar: BarProp; + readonly top: Window; + readonly window: Window; + URL: typeof URL; alert(message?: any): void; blur(): void; cancelAnimationFrame(handle: number): void; @@ -17322,14 +18580,11 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window matchMedia(mediaQuery: string): MediaQueryList; moveBy(x?: number, y?: number): void; moveTo(x?: number, y?: number): void; - msCancelRequestAnimationFrame(handle: number): void; - msMatchMedia(mediaQuery: string): MediaQueryList; - msRequestAnimationFrame(callback: FrameRequestCallback): number; msWriteProfilerMark(profilerMarkName: string): void; - open(url?: string, target?: string, features?: string, replace?: boolean): any; - postMessage(message: any, targetOrigin: string, ports?: any): void; + open(url?: string, target?: string, features?: string, replace?: boolean): Window; + postMessage(message: any, targetOrigin: string, transfer?: any[]): void; print(): void; - prompt(message?: string, _default?: string): string; + prompt(message?: string, _default?: string): string | null; releaseEvents(): void; requestAnimationFrame(callback: FrameRequestCallback): number; resizeBy(x?: number, y?: number): void; @@ -17337,8 +18592,10 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window scroll(x?: number, y?: number): void; scrollBy(x?: number, y?: number): void; scrollTo(x?: number, y?: number): void; + webkitCancelAnimationFrame(handle: number): void; webkitConvertPointFromNodeToPage(node: Node, pt: WebKitPoint): WebKitPoint; webkitConvertPointFromPageToNode(node: Node, pt: WebKitPoint): WebKitPoint; + webkitRequestAnimationFrame(callback: FrameRequestCallback): number; addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; addEventListener(type: "MSGestureEnd", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; @@ -17366,6 +18623,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window addEventListener(type: "compassneedscalibration", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "devicelight", listener: (ev: DeviceLightEvent) => any, useCapture?: boolean): void; addEventListener(type: "devicemotion", listener: (ev: DeviceMotionEvent) => any, useCapture?: boolean): void; addEventListener(type: "deviceorientation", listener: (ev: DeviceOrientationEvent) => any, useCapture?: boolean): void; addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; @@ -17377,10 +18635,11 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "hashchange", listener: (ev: HashChangeEvent) => any, useCapture?: boolean): void; addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -17396,7 +18655,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; addEventListener(type: "offline", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "online", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "orientationchange", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -17466,20 +18725,19 @@ declare var XMLDocument: { interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget { msCaching: string; onreadystatechange: (ev: ProgressEvent) => any; - readyState: number; - response: any; - responseBody: any; - responseText: string; + readonly readyState: number; + readonly response: any; + readonly responseText: string; responseType: string; - responseXML: any; - status: number; - statusText: string; + readonly responseXML: any; + readonly status: number; + readonly statusText: string; timeout: number; - upload: XMLHttpRequestUpload; + readonly upload: XMLHttpRequestUpload; withCredentials: boolean; abort(): void; getAllResponseHeaders(): string; - getResponseHeader(header: string): string; + getResponseHeader(header: string): string | null; msCachingEnabled(): boolean; open(method: string, url: string, async?: boolean, user?: string, password?: string): void; overrideMimeType(mime: string): void; @@ -17487,11 +18745,11 @@ interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget { send(data?: string): void; send(data?: any): void; setRequestHeader(header: string, value: string): void; - DONE: number; - HEADERS_RECEIVED: number; - LOADING: number; - OPENED: number; - UNSENT: number; + readonly DONE: number; + readonly HEADERS_RECEIVED: number; + readonly LOADING: number; + readonly OPENED: number; + readonly UNSENT: number; addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -17506,11 +18764,11 @@ interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget { declare var XMLHttpRequest: { prototype: XMLHttpRequest; new(): XMLHttpRequest; - DONE: number; - HEADERS_RECEIVED: number; - LOADING: number; - OPENED: number; - UNSENT: number; + readonly DONE: number; + readonly HEADERS_RECEIVED: number; + readonly LOADING: number; + readonly OPENED: number; + readonly UNSENT: number; create(): XMLHttpRequest; } @@ -17562,40 +18820,40 @@ declare var XPathNSResolver: { } interface XPathResult { - booleanValue: boolean; - invalidIteratorState: boolean; - numberValue: number; - resultType: number; - singleNodeValue: Node; - snapshotLength: number; - stringValue: string; + readonly booleanValue: boolean; + readonly invalidIteratorState: boolean; + readonly numberValue: number; + readonly resultType: number; + readonly singleNodeValue: Node; + readonly snapshotLength: number; + readonly stringValue: string; iterateNext(): Node; snapshotItem(index: number): Node; - ANY_TYPE: number; - ANY_UNORDERED_NODE_TYPE: number; - BOOLEAN_TYPE: number; - FIRST_ORDERED_NODE_TYPE: number; - NUMBER_TYPE: number; - ORDERED_NODE_ITERATOR_TYPE: number; - ORDERED_NODE_SNAPSHOT_TYPE: number; - STRING_TYPE: number; - UNORDERED_NODE_ITERATOR_TYPE: number; - UNORDERED_NODE_SNAPSHOT_TYPE: number; + readonly ANY_TYPE: number; + readonly ANY_UNORDERED_NODE_TYPE: number; + readonly BOOLEAN_TYPE: number; + readonly FIRST_ORDERED_NODE_TYPE: number; + readonly NUMBER_TYPE: number; + readonly ORDERED_NODE_ITERATOR_TYPE: number; + readonly ORDERED_NODE_SNAPSHOT_TYPE: number; + readonly STRING_TYPE: number; + readonly UNORDERED_NODE_ITERATOR_TYPE: number; + readonly UNORDERED_NODE_SNAPSHOT_TYPE: number; } declare var XPathResult: { prototype: XPathResult; new(): XPathResult; - ANY_TYPE: number; - ANY_UNORDERED_NODE_TYPE: number; - BOOLEAN_TYPE: number; - FIRST_ORDERED_NODE_TYPE: number; - NUMBER_TYPE: number; - ORDERED_NODE_ITERATOR_TYPE: number; - ORDERED_NODE_SNAPSHOT_TYPE: number; - STRING_TYPE: number; - UNORDERED_NODE_ITERATOR_TYPE: number; - UNORDERED_NODE_SNAPSHOT_TYPE: number; + readonly ANY_TYPE: number; + readonly ANY_UNORDERED_NODE_TYPE: number; + readonly BOOLEAN_TYPE: number; + readonly FIRST_ORDERED_NODE_TYPE: number; + readonly NUMBER_TYPE: number; + readonly ORDERED_NODE_ITERATOR_TYPE: number; + readonly ORDERED_NODE_SNAPSHOT_TYPE: number; + readonly STRING_TYPE: number; + readonly UNORDERED_NODE_ITERATOR_TYPE: number; + readonly UNORDERED_NODE_SNAPSHOT_TYPE: number; } interface XSLTProcessor { @@ -17620,6 +18878,18 @@ interface AbstractWorker { addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } +interface CanvasPathMethods { + arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void; + arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void; + bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void; + closePath(): void; + ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void; + lineTo(x: number, y: number): void; + moveTo(x: number, y: number): void; + quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void; + rect(x: number, y: number, w: number, h: number): void; +} + interface ChildNode { remove(): void; } @@ -17642,6 +18912,7 @@ interface DocumentEvent { createEvent(eventInterface:"CommandEvent"): CommandEvent; createEvent(eventInterface:"CompositionEvent"): CompositionEvent; createEvent(eventInterface:"CustomEvent"): CustomEvent; + createEvent(eventInterface:"DeviceLightEvent"): DeviceLightEvent; createEvent(eventInterface:"DeviceMotionEvent"): DeviceMotionEvent; createEvent(eventInterface:"DeviceOrientationEvent"): DeviceOrientationEvent; createEvent(eventInterface:"DragEvent"): DragEvent; @@ -17653,6 +18924,7 @@ interface DocumentEvent { createEvent(eventInterface:"HashChangeEvent"): HashChangeEvent; createEvent(eventInterface:"IDBVersionChangeEvent"): IDBVersionChangeEvent; createEvent(eventInterface:"KeyboardEvent"): KeyboardEvent; + createEvent(eventInterface:"ListeningStateChangedEvent"): ListeningStateChangedEvent; createEvent(eventInterface:"LongRunningScriptDetectedEvent"): LongRunningScriptDetectedEvent; createEvent(eventInterface:"MSGestureEvent"): MSGestureEvent; createEvent(eventInterface:"MSManipulationEvent"): MSManipulationEvent; @@ -17660,21 +18932,31 @@ interface DocumentEvent { createEvent(eventInterface:"MSMediaKeyNeededEvent"): MSMediaKeyNeededEvent; createEvent(eventInterface:"MSPointerEvent"): MSPointerEvent; createEvent(eventInterface:"MSSiteModeEvent"): MSSiteModeEvent; + createEvent(eventInterface:"MediaEncryptedEvent"): MediaEncryptedEvent; + createEvent(eventInterface:"MediaKeyMessageEvent"): MediaKeyMessageEvent; + createEvent(eventInterface:"MediaStreamErrorEvent"): MediaStreamErrorEvent; + createEvent(eventInterface:"MediaStreamTrackEvent"): MediaStreamTrackEvent; createEvent(eventInterface:"MessageEvent"): MessageEvent; createEvent(eventInterface:"MouseEvent"): MouseEvent; createEvent(eventInterface:"MouseEvents"): MouseEvent; - createEvent(eventInterface:"MouseWheelEvent"): MouseWheelEvent; createEvent(eventInterface:"MutationEvent"): MutationEvent; createEvent(eventInterface:"MutationEvents"): MutationEvent; createEvent(eventInterface:"NavigationCompletedEvent"): NavigationCompletedEvent; createEvent(eventInterface:"NavigationEvent"): NavigationEvent; createEvent(eventInterface:"NavigationEventWithReferrer"): NavigationEventWithReferrer; createEvent(eventInterface:"OfflineAudioCompletionEvent"): OfflineAudioCompletionEvent; + createEvent(eventInterface:"OverflowEvent"): OverflowEvent; createEvent(eventInterface:"PageTransitionEvent"): PageTransitionEvent; createEvent(eventInterface:"PermissionRequestedEvent"): PermissionRequestedEvent; createEvent(eventInterface:"PointerEvent"): PointerEvent; createEvent(eventInterface:"PopStateEvent"): PopStateEvent; createEvent(eventInterface:"ProgressEvent"): ProgressEvent; + createEvent(eventInterface:"RTCDTMFToneChangeEvent"): RTCDTMFToneChangeEvent; + createEvent(eventInterface:"RTCDtlsTransportStateChangedEvent"): RTCDtlsTransportStateChangedEvent; + createEvent(eventInterface:"RTCIceCandidatePairChangedEvent"): RTCIceCandidatePairChangedEvent; + createEvent(eventInterface:"RTCIceGathererEvent"): RTCIceGathererEvent; + createEvent(eventInterface:"RTCIceTransportStateChangedEvent"): RTCIceTransportStateChangedEvent; + createEvent(eventInterface:"RTCSsrcConflictEvent"): RTCSsrcConflictEvent; createEvent(eventInterface:"SVGZoomEvent"): SVGZoomEvent; createEvent(eventInterface:"SVGZoomEvents"): SVGZoomEvent; createEvent(eventInterface:"ScriptNotifyEvent"): ScriptNotifyEvent; @@ -17692,11 +18974,11 @@ interface DocumentEvent { } interface ElementTraversal { - childElementCount: number; - firstElementChild: Element; - lastElementChild: Element; - nextElementSibling: Element; - previousElementSibling: Element; + readonly childElementCount: number; + readonly firstElementChild: Element; + readonly lastElementChild: Element; + readonly nextElementSibling: Element; + readonly previousElementSibling: Element; } interface GetSVGDocument { @@ -17741,12 +19023,11 @@ interface HTMLTableAlignment { } interface IDBEnvironment { - indexedDB: IDBFactory; - msIndexedDB: IDBFactory; + readonly indexedDB: IDBFactory; } interface LinkStyle { - sheet: StyleSheet; + readonly sheet: StyleSheet; } interface MSBaseReader { @@ -17756,12 +19037,12 @@ interface MSBaseReader { onloadend: (ev: ProgressEvent) => any; onloadstart: (ev: Event) => any; onprogress: (ev: ProgressEvent) => any; - readyState: number; - result: any; + readonly readyState: number; + readonly result: any; abort(): void; - DONE: number; - EMPTY: number; - LOADING: number; + readonly DONE: number; + readonly EMPTY: number; + readonly LOADING: number; addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -17789,27 +19070,32 @@ interface NavigatorContentUtils { } interface NavigatorGeolocation { - geolocation: Geolocation; + readonly geolocation: Geolocation; } interface NavigatorID { - appName: string; - appVersion: string; - platform: string; - product: string; - productSub: string; - userAgent: string; - vendor: string; - vendorSub: string; + readonly appName: string; + readonly appVersion: string; + readonly platform: string; + readonly product: string; + readonly productSub: string; + readonly userAgent: string; + readonly vendor: string; + readonly vendorSub: string; } interface NavigatorOnLine { - onLine: boolean; + readonly onLine: boolean; } interface NavigatorStorageUtils { } +interface NavigatorUserMedia { + readonly mediaDevices: MediaDevices; + getUserMedia(constraints: MediaStreamConstraints, successCallback: NavigatorUserMediaSuccessCallback, errorCallback: NavigatorUserMediaErrorCallback): void; +} + interface NodeSelector { querySelector(selectors: string): Element; querySelectorAll(selectors: string): NodeListOf; @@ -17820,29 +19106,29 @@ interface RandomSource { } interface SVGAnimatedPathData { - pathSegList: SVGPathSegList; + readonly pathSegList: SVGPathSegList; } interface SVGAnimatedPoints { - animatedPoints: SVGPointList; - points: SVGPointList; + readonly animatedPoints: SVGPointList; + readonly points: SVGPointList; } interface SVGExternalResourcesRequired { - externalResourcesRequired: SVGAnimatedBoolean; + readonly externalResourcesRequired: SVGAnimatedBoolean; } interface SVGFilterPrimitiveStandardAttributes extends SVGStylable { - height: SVGAnimatedLength; - result: SVGAnimatedString; - width: SVGAnimatedLength; - x: SVGAnimatedLength; - y: SVGAnimatedLength; + readonly height: SVGAnimatedLength; + readonly result: SVGAnimatedString; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; } interface SVGFitToViewBox { - preserveAspectRatio: SVGAnimatedPreserveAspectRatio; - viewBox: SVGAnimatedRect; + readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio; + readonly viewBox: SVGAnimatedRect; } interface SVGLangSpace { @@ -17851,8 +19137,8 @@ interface SVGLangSpace { } interface SVGLocatable { - farthestViewportElement: SVGElement; - nearestViewportElement: SVGElement; + readonly farthestViewportElement: SVGElement; + readonly nearestViewportElement: SVGElement; getBBox(): SVGRect; getCTM(): SVGMatrix; getScreenCTM(): SVGMatrix; @@ -17861,22 +19147,22 @@ interface SVGLocatable { interface SVGStylable { className: any; - style: CSSStyleDeclaration; + readonly style: CSSStyleDeclaration; } interface SVGTests { - requiredExtensions: SVGStringList; - requiredFeatures: SVGStringList; - systemLanguage: SVGStringList; + readonly requiredExtensions: SVGStringList; + readonly requiredFeatures: SVGStringList; + readonly systemLanguage: SVGStringList; hasExtension(extension: string): boolean; } interface SVGTransformable extends SVGLocatable { - transform: SVGAnimatedTransformList; + readonly transform: SVGAnimatedTransformList; } interface SVGURIReference { - href: SVGAnimatedString; + readonly href: SVGAnimatedString; } interface WindowBase64 { @@ -17885,15 +19171,15 @@ interface WindowBase64 { } interface WindowConsole { - console: Console; + readonly console: Console; } interface WindowLocalStorage { - localStorage: Storage; + readonly localStorage: Storage; } interface WindowSessionStorage { - sessionStorage: Storage; + readonly sessionStorage: Storage; } interface WindowTimers extends Object, WindowTimersExtension { @@ -17905,8 +19191,6 @@ interface WindowTimers extends Object, WindowTimersExtension { interface WindowTimersExtension { clearImmediate(handle: number): void; - msClearImmediate(handle: number): void; - msSetImmediate(expression: any, ...args: any[]): number; setImmediate(expression: any, ...args: any[]): number; } @@ -17928,12 +19212,26 @@ interface XMLHttpRequestEventTarget { addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } +interface StorageEventInit extends EventInit { + key?: string; + oldValue?: string; + newValue?: string; + url: string; + storageArea?: Storage; +} + interface NodeListOf extends NodeList { length: number; item(index: number): TNode; [index: number]: TNode; } +interface HTMLCollectionOf extends HTMLCollection { + item(index: number): T; + namedItem(name: string): T; + [index: number]: T; +} + interface BlobPropertyBag { type?: string; endings?: string; @@ -17963,6 +19261,14 @@ interface ProgressEventInit extends EventInit { total?: number; } +interface ClipboardEventInit extends EventInit { + data?: string; + dataType?: string; +} + +interface IDBArrayKey extends Array { +} + declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject; interface ErrorEventHandler { @@ -17996,15 +19302,23 @@ interface DecodeSuccessCallback { (decodedData: AudioBuffer): void; } interface DecodeErrorCallback { - (): void; + (error: DOMException): void; } interface FunctionStringCallback { (data: string): void; } +interface NavigatorUserMediaSuccessCallback { + (stream: MediaStream): void; +} +interface NavigatorUserMediaErrorCallback { + (error: MediaStreamError): void; +} +interface ForEachCallback { + (keyId: any, status: string): void; +} declare var Audio: {new(src?: string): HTMLAudioElement; }; declare var Image: {new(width?: number, height?: number): HTMLImageElement; }; declare var Option: {new(text?: string, value?: string, defaultSelected?: boolean, selected?: boolean): HTMLOptionElement; }; -declare var animationStartTime: number; declare var applicationCache: ApplicationCache; declare var clientInformation: Navigator; declare var closed: boolean; @@ -18024,7 +19338,7 @@ declare var length: number; declare var location: Location; declare var locationbar: BarProp; declare var menubar: BarProp; -declare var msAnimationStartTime: number; +declare var msCredentials: MSCredentials; declare var name: string; declare var navigator: Navigator; declare var offscreenBuffering: string | boolean; @@ -18040,6 +19354,7 @@ declare var onclick: (ev: MouseEvent) => any; declare var oncompassneedscalibration: (ev: Event) => any; declare var oncontextmenu: (ev: PointerEvent) => any; declare var ondblclick: (ev: MouseEvent) => any; +declare var ondevicelight: (ev: DeviceLightEvent) => any; declare var ondevicemotion: (ev: DeviceMotionEvent) => any; declare var ondeviceorientation: (ev: DeviceOrientationEvent) => any; declare var ondrag: (ev: DragEvent) => any; @@ -18051,11 +19366,12 @@ declare var ondragstart: (ev: DragEvent) => any; declare var ondrop: (ev: DragEvent) => any; declare var ondurationchange: (ev: Event) => any; declare var onemptied: (ev: Event) => any; -declare var onended: (ev: Event) => any; +declare var onended: (ev: MediaStreamErrorEvent) => any; declare var onerror: ErrorEventHandler; declare var onfocus: (ev: FocusEvent) => any; declare var onhashchange: (ev: HashChangeEvent) => any; declare var oninput: (ev: Event) => any; +declare var oninvalid: (ev: Event) => any; declare var onkeydown: (ev: KeyboardEvent) => any; declare var onkeypress: (ev: KeyboardEvent) => any; declare var onkeyup: (ev: KeyboardEvent) => any; @@ -18071,7 +19387,7 @@ declare var onmousemove: (ev: MouseEvent) => any; declare var onmouseout: (ev: MouseEvent) => any; declare var onmouseover: (ev: MouseEvent) => any; declare var onmouseup: (ev: MouseEvent) => any; -declare var onmousewheel: (ev: MouseWheelEvent) => any; +declare var onmousewheel: (ev: WheelEvent) => any; declare var onmsgesturechange: (ev: MSGestureEvent) => any; declare var onmsgesturedoubletap: (ev: MSGestureEvent) => any; declare var onmsgestureend: (ev: MSGestureEvent) => any; @@ -18110,10 +19426,10 @@ declare var onstorage: (ev: StorageEvent) => any; declare var onsubmit: (ev: Event) => any; declare var onsuspend: (ev: Event) => any; declare var ontimeupdate: (ev: Event) => any; -declare var ontouchcancel: any; -declare var ontouchend: any; -declare var ontouchmove: any; -declare var ontouchstart: any; +declare var ontouchcancel: (ev: TouchEvent) => any; +declare var ontouchend: (ev: TouchEvent) => any; +declare var ontouchmove: (ev: TouchEvent) => any; +declare var ontouchstart: (ev: TouchEvent) => any; declare var onunload: (ev: Event) => any; declare var onvolumechange: (ev: Event) => any; declare var onwaiting: (ev: Event) => any; @@ -18141,7 +19457,6 @@ declare var styleMedia: StyleMedia; declare var toolbar: BarProp; declare var top: Window; declare var window: Window; -declare var URL: URL; declare function alert(message?: any): void; declare function blur(): void; declare function cancelAnimationFrame(handle: number): void; @@ -18155,14 +19470,11 @@ declare function getSelection(): Selection; declare function matchMedia(mediaQuery: string): MediaQueryList; declare function moveBy(x?: number, y?: number): void; declare function moveTo(x?: number, y?: number): void; -declare function msCancelRequestAnimationFrame(handle: number): void; -declare function msMatchMedia(mediaQuery: string): MediaQueryList; -declare function msRequestAnimationFrame(callback: FrameRequestCallback): number; declare function msWriteProfilerMark(profilerMarkName: string): void; -declare function open(url?: string, target?: string, features?: string, replace?: boolean): any; -declare function postMessage(message: any, targetOrigin: string, ports?: any): void; +declare function open(url?: string, target?: string, features?: string, replace?: boolean): Window; +declare function postMessage(message: any, targetOrigin: string, transfer?: any[]): void; declare function print(): void; -declare function prompt(message?: string, _default?: string): string; +declare function prompt(message?: string, _default?: string): string | null; declare function releaseEvents(): void; declare function requestAnimationFrame(callback: FrameRequestCallback): number; declare function resizeBy(x?: number, y?: number): void; @@ -18170,19 +19482,19 @@ declare function resizeTo(x?: number, y?: number): void; declare function scroll(x?: number, y?: number): void; declare function scrollBy(x?: number, y?: number): void; declare function scrollTo(x?: number, y?: number): void; +declare function webkitCancelAnimationFrame(handle: number): void; declare function webkitConvertPointFromNodeToPage(node: Node, pt: WebKitPoint): WebKitPoint; declare function webkitConvertPointFromPageToNode(node: Node, pt: WebKitPoint): WebKitPoint; +declare function webkitRequestAnimationFrame(callback: FrameRequestCallback): number; declare function toString(): string; -declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +declare function addEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; declare function dispatchEvent(evt: Event): boolean; -declare function removeEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +declare function removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; declare function clearInterval(handle: number): void; declare function clearTimeout(handle: number): void; declare function setInterval(handler: any, timeout?: any, ...args: any[]): number; declare function setTimeout(handler: any, timeout?: any, ...args: any[]): number; declare function clearImmediate(handle: number): void; -declare function msClearImmediate(handle: number): void; -declare function msSetImmediate(expression: any, ...args: any[]): number; declare function setImmediate(expression: any, ...args: any[]): number; declare var sessionStorage: Storage; declare var localStorage: Storage; @@ -18197,7 +19509,6 @@ declare var onpointerover: (ev: PointerEvent) => any; declare var onpointerup: (ev: PointerEvent) => any; declare var onwheel: (ev: WheelEvent) => any; declare var indexedDB: IDBFactory; -declare var msIndexedDB: IDBFactory; declare function atob(encodedString: string): string; declare function btoa(rawString: string): string; declare function addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; @@ -18227,6 +19538,7 @@ declare function addEventListener(type: "click", listener: (ev: MouseEvent) => a declare function addEventListener(type: "compassneedscalibration", listener: (ev: Event) => any, useCapture?: boolean): void; declare function addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "devicelight", listener: (ev: DeviceLightEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "devicemotion", listener: (ev: DeviceMotionEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "deviceorientation", listener: (ev: DeviceOrientationEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; @@ -18238,10 +19550,11 @@ declare function addEventListener(type: "dragstart", listener: (ev: DragEvent) = declare function addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; declare function addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "hashchange", listener: (ev: HashChangeEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; declare function addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -18257,7 +19570,7 @@ declare function addEventListener(type: "mousemove", listener: (ev: MouseEvent) declare function addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "offline", listener: (ev: Event) => any, useCapture?: boolean): void; declare function addEventListener(type: "online", listener: (ev: Event) => any, useCapture?: boolean): void; declare function addEventListener(type: "orientationchange", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -18293,18 +19606,39 @@ declare function addEventListener(type: "unload", listener: (ev: Event) => any, declare function addEventListener(type: "volumechange", listener: (ev: Event) => any, useCapture?: boolean): void; declare function addEventListener(type: "waiting", listener: (ev: Event) => any, useCapture?: boolean): void; declare function addEventListener(type: "wheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;interface DOMTokenList { - [Symbol.iterator](): IterableIterator; -} - -interface NodeList { - [Symbol.iterator](): IterableIterator -} - -interface NodeListOf { - [Symbol.iterator](): IterableIterator -} - +declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +type AAGUID = string; +type AlgorithmIdentifier = string | Algorithm; +type ConstrainBoolean = boolean | ConstrainBooleanParameters; +type ConstrainDOMString = string | string[] | ConstrainDOMStringParameters; +type ConstrainDouble = number | ConstrainDoubleRange; +type ConstrainLong = number | ConstrainLongRange; +type CryptoOperationData = ArrayBufferView; +type GLbitfield = number; +type GLboolean = boolean; +type GLbyte = number; +type GLclampf = number; +type GLenum = number; +type GLfloat = number; +type GLint = number; +type GLintptr = number; +type GLshort = number; +type GLsizei = number; +type GLsizeiptr = number; +type GLubyte = number; +type GLuint = number; +type GLushort = number; +type IDBKeyPath = string; +type KeyFormat = string; +type KeyType = string; +type KeyUsage = string; +type MSInboundPayload = MSVideoRecvPayload | MSAudioRecvPayload; +type MSLocalClientEvent = MSLocalClientEventBase | MSAudioLocalClientEvent; +type MSOutboundPayload = MSVideoSendPayload | MSAudioSendPayload; +type RTCIceGatherCandidate = RTCIceCandidate | RTCIceCandidateComplete; +type RTCTransport = RTCDtlsTransport | RTCSrtpSdesTransport; +type payloadtype = number; +type IDBValidKey = number | string | Date | IDBArrayKey; ///////////////////////////// /// WorkerGlobalScope APIs ///////////////////////////// @@ -18588,3 +19922,16 @@ interface VBArrayConstructor { } declare var VBArray: VBArrayConstructor; +/// + +interface DOMTokenList { + [Symbol.iterator](): IterableIterator; +} + +interface NodeList { + [Symbol.iterator](): IterableIterator +} + +interface NodeListOf { + [Symbol.iterator](): IterableIterator +} diff --git a/lib/lib.scriptHost.d.ts b/lib/lib.scriptHost.d.ts index 12e04fb4144..d4c6131fd93 100644 --- a/lib/lib.scriptHost.d.ts +++ b/lib/lib.scriptHost.d.ts @@ -13,7 +13,7 @@ See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ -/// +/// ///////////////////////////// diff --git a/lib/lib.scripthost.d.ts b/lib/lib.scripthost.d.ts new file mode 100644 index 00000000000..d4c6131fd93 --- /dev/null +++ b/lib/lib.scripthost.d.ts @@ -0,0 +1,294 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ + +/// + + +///////////////////////////// +/// Windows Script Host APIS +///////////////////////////// + + +interface ActiveXObject { + new (s: string): any; +} +declare var ActiveXObject: ActiveXObject; + +interface ITextWriter { + Write(s: string): void; + WriteLine(s: string): void; + Close(): void; +} + +interface TextStreamBase { + /** + * The column number of the current character position in an input stream. + */ + Column: number; + + /** + * The current line number in an input stream. + */ + Line: number; + + /** + * Closes a text stream. + * It is not necessary to close standard streams; they close automatically when the process ends. If + * you close a standard stream, be aware that any other pointers to that standard stream become invalid. + */ + Close(): void; +} + +interface TextStreamWriter extends TextStreamBase { + /** + * Sends a string to an output stream. + */ + Write(s: string): void; + + /** + * Sends a specified number of blank lines (newline characters) to an output stream. + */ + WriteBlankLines(intLines: number): void; + + /** + * Sends a string followed by a newline character to an output stream. + */ + WriteLine(s: string): void; +} + +interface TextStreamReader extends TextStreamBase { + /** + * Returns a specified number of characters from an input stream, starting at the current pointer position. + * Does not return until the ENTER key is pressed. + * Can only be used on a stream in reading mode; causes an error in writing or appending mode. + */ + Read(characters: number): string; + + /** + * Returns all characters from an input stream. + * Can only be used on a stream in reading mode; causes an error in writing or appending mode. + */ + ReadAll(): string; + + /** + * Returns an entire line from an input stream. + * Although this method extracts the newline character, it does not add it to the returned string. + * Can only be used on a stream in reading mode; causes an error in writing or appending mode. + */ + ReadLine(): string; + + /** + * Skips a specified number of characters when reading from an input text stream. + * Can only be used on a stream in reading mode; causes an error in writing or appending mode. + * @param characters Positive number of characters to skip forward. (Backward skipping is not supported.) + */ + Skip(characters: number): void; + + /** + * Skips the next line when reading from an input text stream. + * Can only be used on a stream in reading mode, not writing or appending mode. + */ + SkipLine(): void; + + /** + * Indicates whether the stream pointer position is at the end of a line. + */ + AtEndOfLine: boolean; + + /** + * Indicates whether the stream pointer position is at the end of a stream. + */ + AtEndOfStream: boolean; +} + +declare var WScript: { + /** + * Outputs text to either a message box (under WScript.exe) or the command console window followed by + * a newline (under CScript.exe). + */ + Echo(s: any): void; + + /** + * Exposes the write-only error output stream for the current script. + * Can be accessed only while using CScript.exe. + */ + StdErr: TextStreamWriter; + + /** + * Exposes the write-only output stream for the current script. + * Can be accessed only while using CScript.exe. + */ + StdOut: TextStreamWriter; + Arguments: { length: number; Item(n: number): string; }; + + /** + * The full path of the currently running script. + */ + ScriptFullName: string; + + /** + * Forces the script to stop immediately, with an optional exit code. + */ + Quit(exitCode?: number): number; + + /** + * The Windows Script Host build version number. + */ + BuildVersion: number; + + /** + * Fully qualified path of the host executable. + */ + FullName: string; + + /** + * Gets/sets the script mode - interactive(true) or batch(false). + */ + Interactive: boolean; + + /** + * The name of the host executable (WScript.exe or CScript.exe). + */ + Name: string; + + /** + * Path of the directory containing the host executable. + */ + Path: string; + + /** + * The filename of the currently running script. + */ + ScriptName: string; + + /** + * Exposes the read-only input stream for the current script. + * Can be accessed only while using CScript.exe. + */ + StdIn: TextStreamReader; + + /** + * Windows Script Host version + */ + Version: string; + + /** + * Connects a COM object's event sources to functions named with a given prefix, in the form prefix_event. + */ + ConnectObject(objEventSource: any, strPrefix: string): void; + + /** + * Creates a COM object. + * @param strProgiID + * @param strPrefix Function names in the form prefix_event will be bound to this object's COM events. + */ + CreateObject(strProgID: string, strPrefix?: string): any; + + /** + * Disconnects a COM object from its event sources. + */ + DisconnectObject(obj: any): void; + + /** + * Retrieves an existing object with the specified ProgID from memory, or creates a new one from a file. + * @param strPathname Fully qualified path to the file containing the object persisted to disk. + * For objects in memory, pass a zero-length string. + * @param strProgID + * @param strPrefix Function names in the form prefix_event will be bound to this object's COM events. + */ + GetObject(strPathname: string, strProgID?: string, strPrefix?: string): any; + + /** + * Suspends script execution for a specified length of time, then continues execution. + * @param intTime Interval (in milliseconds) to suspend script execution. + */ + Sleep(intTime: number): void; +}; + +/** + * Allows enumerating over a COM collection, which may not have indexed item access. + */ +interface Enumerator { + /** + * Returns true if the current item is the last one in the collection, or the collection is empty, + * or the current item is undefined. + */ + atEnd(): boolean; + + /** + * Returns the current item in the collection + */ + item(): T; + + /** + * Resets the current item in the collection to the first item. If there are no items in the collection, + * the current item is set to undefined. + */ + moveFirst(): void; + + /** + * Moves the current item to the next item in the collection. If the enumerator is at the end of + * the collection or the collection is empty, the current item is set to undefined. + */ + moveNext(): void; +} + +interface EnumeratorConstructor { + new (collection: any): Enumerator; + new (collection: any): Enumerator; +} + +declare var Enumerator: EnumeratorConstructor; + +/** + * Enables reading from a COM safe array, which might have an alternate lower bound, or multiple dimensions. + */ +interface VBArray { + /** + * Returns the number of dimensions (1-based). + */ + dimensions(): number; + + /** + * Takes an index for each dimension in the array, and returns the item at the corresponding location. + */ + getItem(dimension1Index: number, ...dimensionNIndexes: number[]): T; + + /** + * Returns the smallest available index for a given dimension. + * @param dimension 1-based dimension (defaults to 1) + */ + lbound(dimension?: number): number; + + /** + * Returns the largest available index for a given dimension. + * @param dimension 1-based dimension (defaults to 1) + */ + ubound(dimension?: number): number; + + /** + * Returns a Javascript array with all the elements in the VBArray. If there are multiple dimensions, + * each successive dimension is appended to the end of the array. + * Example: [[1,2,3],[4,5,6]] becomes [1,2,3,4,5,6] + */ + toArray(): T[]; +} + +interface VBArrayConstructor { + new (safeArray: any): VBArray; + new (safeArray: any): VBArray; +} + +declare var VBArray: VBArrayConstructor; diff --git a/lib/lib.webworker.d.ts b/lib/lib.webworker.d.ts index 7ce06a6b4ac..cf5ce7e81d8 100644 --- a/lib/lib.webworker.d.ts +++ b/lib/lib.webworker.d.ts @@ -13,208 +13,7 @@ See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ -/// -///////////////////////////// -/// ECMAScript Internationalization API -///////////////////////////// - -declare module Intl { - interface CollatorOptions { - usage?: string; - localeMatcher?: string; - numeric?: boolean; - caseFirst?: string; - sensitivity?: string; - ignorePunctuation?: boolean; - } - - interface ResolvedCollatorOptions { - locale: string; - usage: string; - sensitivity: string; - ignorePunctuation: boolean; - collation: string; - caseFirst: string; - numeric: boolean; - } - - interface Collator { - compare(x: string, y: string): number; - resolvedOptions(): ResolvedCollatorOptions; - } - var Collator: { - new (locales?: string[], options?: CollatorOptions): Collator; - new (locale?: string, options?: CollatorOptions): Collator; - (locales?: string[], options?: CollatorOptions): Collator; - (locale?: string, options?: CollatorOptions): Collator; - supportedLocalesOf(locales: string[], options?: CollatorOptions): string[]; - supportedLocalesOf(locale: string, options?: CollatorOptions): string[]; - } - - interface NumberFormatOptions { - localeMatcher?: string; - style?: string; - currency?: string; - currencyDisplay?: string; - useGrouping?: boolean; - minimumIntegerDigits?: number; - minimumFractionDigits?: number; - maximumFractionDigits?: number; - minimumSignificantDigits?: number; - maximumSignificantDigits?: number; - } - - interface ResolvedNumberFormatOptions { - locale: string; - numberingSystem: string; - style: string; - currency?: string; - currencyDisplay?: string; - minimumIntegerDigits: number; - minimumFractionDigits: number; - maximumFractionDigits: number; - minimumSignificantDigits?: number; - maximumSignificantDigits?: number; - useGrouping: boolean; - } - - interface NumberFormat { - format(value: number): string; - resolvedOptions(): ResolvedNumberFormatOptions; - } - var NumberFormat: { - new (locales?: string[], options?: NumberFormatOptions): NumberFormat; - new (locale?: string, options?: NumberFormatOptions): NumberFormat; - (locales?: string[], options?: NumberFormatOptions): NumberFormat; - (locale?: string, options?: NumberFormatOptions): NumberFormat; - supportedLocalesOf(locales: string[], options?: NumberFormatOptions): string[]; - supportedLocalesOf(locale: string, options?: NumberFormatOptions): string[]; - } - - interface DateTimeFormatOptions { - localeMatcher?: string; - weekday?: string; - era?: string; - year?: string; - month?: string; - day?: string; - hour?: string; - minute?: string; - second?: string; - timeZoneName?: string; - formatMatcher?: string; - hour12?: boolean; - timeZone?: string; - } - - interface ResolvedDateTimeFormatOptions { - locale: string; - calendar: string; - numberingSystem: string; - timeZone: string; - hour12?: boolean; - weekday?: string; - era?: string; - year?: string; - month?: string; - day?: string; - hour?: string; - minute?: string; - second?: string; - timeZoneName?: string; - } - - interface DateTimeFormat { - format(date?: Date | number): string; - resolvedOptions(): ResolvedDateTimeFormatOptions; - } - var DateTimeFormat: { - new (locales?: string[], options?: DateTimeFormatOptions): DateTimeFormat; - new (locale?: string, options?: DateTimeFormatOptions): DateTimeFormat; - (locales?: string[], options?: DateTimeFormatOptions): DateTimeFormat; - (locale?: string, options?: DateTimeFormatOptions): DateTimeFormat; - supportedLocalesOf(locales: string[], options?: DateTimeFormatOptions): string[]; - supportedLocalesOf(locale: string, options?: DateTimeFormatOptions): string[]; - } -} - -interface String { - /** - * Determines whether two strings are equivalent in the current locale. - * @param that String to compare to target string - * @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. This parameter must conform to BCP 47 standards; see the Intl.Collator object for details. - * @param options An object that contains one or more properties that specify comparison options. see the Intl.Collator object for details. - */ - localeCompare(that: string, locales: string[], options?: Intl.CollatorOptions): number; - - /** - * Determines whether two strings are equivalent in the current locale. - * @param that String to compare to target string - * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. This parameter must conform to BCP 47 standards; see the Intl.Collator object for details. - * @param options An object that contains one or more properties that specify comparison options. see the Intl.Collator object for details. - */ - localeCompare(that: string, locale: string, options?: Intl.CollatorOptions): number; -} - -interface Number { - /** - * Converts a number to a string by using the current or specified locale. - * @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleString(locales?: string[], options?: Intl.NumberFormatOptions): string; - - /** - * Converts a number to a string by using the current or specified locale. - * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleString(locale?: string, options?: Intl.NumberFormatOptions): string; -} - -interface Date { - /** - * Converts a date and time to a string by using the current or specified locale. - * @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleString(locales?: string[], options?: Intl.DateTimeFormatOptions): string; - /** - * Converts a date to a string by using the current or specified locale. - * @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleDateString(locales?: string[], options?: Intl.DateTimeFormatOptions): string; - - /** - * Converts a time to a string by using the current or specified locale. - * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleTimeString(locale?: string[], options?: Intl.DateTimeFormatOptions): string; - - /** - * Converts a date and time to a string by using the current or specified locale. - * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleString(locale?: string, options?: Intl.DateTimeFormatOptions): string; - - /** - * Converts a date to a string by using the current or specified locale. - * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleDateString(locale?: string, options?: Intl.DateTimeFormatOptions): string; - - /** - * Converts a time to a string by using the current or specified locale. - * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleTimeString(locale?: string, options?: Intl.DateTimeFormatOptions): string; -} - +/// ///////////////////////////// /// IE Worker APIs @@ -225,15 +24,27 @@ interface EventInit { cancelable?: boolean; } +interface IDBIndexParameters { + multiEntry?: boolean; + unique?: boolean; +} + +interface IDBObjectStoreParameters { + autoIncrement?: boolean; + keyPath?: IDBKeyPath; +} + interface EventListener { (evt: Event): void; } interface AudioBuffer { - duration: number; - length: number; - numberOfChannels: number; - sampleRate: number; + readonly duration: number; + readonly length: number; + readonly numberOfChannels: number; + readonly sampleRate: number; + copyFromChannel(destination: Float32Array, channelNumber: number, startInChannel?: number): void; + copyToChannel(source: Float32Array, channelNumber: number, startInChannel?: number): void; getChannelData(channel: number): Float32Array; } @@ -243,8 +54,8 @@ declare var AudioBuffer: { } interface Blob { - size: number; - type: string; + readonly size: number; + readonly type: string; msClose(): void; msDetachStream(): any; slice(start?: number, end?: number, contentType?: string): Blob; @@ -256,9 +67,9 @@ declare var Blob: { } interface CloseEvent extends Event { - code: number; - reason: string; - wasClean: boolean; + readonly code: number; + readonly reason: string; + readonly wasClean: boolean; initCloseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, wasCleanArg: boolean, codeArg: number, reasonArg: string): void; } @@ -275,6 +86,7 @@ interface Console { dir(value?: any, ...optionalParams: any[]): void; dirxml(value: any): void; error(message?: any, ...optionalParams: any[]): void; + exception(message?: string, ...optionalParams: any[]): void; group(groupTitle?: string): void; groupCollapsed(groupTitle?: string): void; groupEnd(): void; @@ -284,9 +96,10 @@ interface Console { profile(reportName?: string): void; profileEnd(): void; select(element: any): void; + table(...data: any[]): void; time(timerName?: string): void; timeEnd(timerName?: string): void; - trace(): void; + trace(message?: any, ...optionalParams: any[]): void; warn(message?: any, ...optionalParams: any[]): void; } @@ -296,13 +109,13 @@ declare var Console: { } interface Coordinates { - accuracy: number; - altitude: number; - altitudeAccuracy: number; - heading: number; - latitude: number; - longitude: number; - speed: number; + readonly accuracy: number; + readonly altitude: number | null; + readonly altitudeAccuracy: number | null; + readonly heading: number | null; + readonly latitude: number; + readonly longitude: number; + readonly speed: number | null; } declare var Coordinates: { @@ -311,7 +124,7 @@ declare var Coordinates: { } interface DOMError { - name: string; + readonly name: string; toString(): string; } @@ -321,75 +134,75 @@ declare var DOMError: { } interface DOMException { - code: number; - message: string; - name: string; + readonly code: number; + readonly message: string; + readonly name: string; toString(): string; - ABORT_ERR: number; - DATA_CLONE_ERR: number; - DOMSTRING_SIZE_ERR: number; - HIERARCHY_REQUEST_ERR: number; - INDEX_SIZE_ERR: number; - INUSE_ATTRIBUTE_ERR: number; - INVALID_ACCESS_ERR: number; - INVALID_CHARACTER_ERR: number; - INVALID_MODIFICATION_ERR: number; - INVALID_NODE_TYPE_ERR: number; - INVALID_STATE_ERR: number; - NAMESPACE_ERR: number; - NETWORK_ERR: number; - NOT_FOUND_ERR: number; - NOT_SUPPORTED_ERR: number; - NO_DATA_ALLOWED_ERR: number; - NO_MODIFICATION_ALLOWED_ERR: number; - PARSE_ERR: number; - QUOTA_EXCEEDED_ERR: number; - SECURITY_ERR: number; - SERIALIZE_ERR: number; - SYNTAX_ERR: number; - TIMEOUT_ERR: number; - TYPE_MISMATCH_ERR: number; - URL_MISMATCH_ERR: number; - VALIDATION_ERR: number; - WRONG_DOCUMENT_ERR: number; + readonly ABORT_ERR: number; + readonly DATA_CLONE_ERR: number; + readonly DOMSTRING_SIZE_ERR: number; + readonly HIERARCHY_REQUEST_ERR: number; + readonly INDEX_SIZE_ERR: number; + readonly INUSE_ATTRIBUTE_ERR: number; + readonly INVALID_ACCESS_ERR: number; + readonly INVALID_CHARACTER_ERR: number; + readonly INVALID_MODIFICATION_ERR: number; + readonly INVALID_NODE_TYPE_ERR: number; + readonly INVALID_STATE_ERR: number; + readonly NAMESPACE_ERR: number; + readonly NETWORK_ERR: number; + readonly NOT_FOUND_ERR: number; + readonly NOT_SUPPORTED_ERR: number; + readonly NO_DATA_ALLOWED_ERR: number; + readonly NO_MODIFICATION_ALLOWED_ERR: number; + readonly PARSE_ERR: number; + readonly QUOTA_EXCEEDED_ERR: number; + readonly SECURITY_ERR: number; + readonly SERIALIZE_ERR: number; + readonly SYNTAX_ERR: number; + readonly TIMEOUT_ERR: number; + readonly TYPE_MISMATCH_ERR: number; + readonly URL_MISMATCH_ERR: number; + readonly VALIDATION_ERR: number; + readonly WRONG_DOCUMENT_ERR: number; } declare var DOMException: { prototype: DOMException; new(): DOMException; - ABORT_ERR: number; - DATA_CLONE_ERR: number; - DOMSTRING_SIZE_ERR: number; - HIERARCHY_REQUEST_ERR: number; - INDEX_SIZE_ERR: number; - INUSE_ATTRIBUTE_ERR: number; - INVALID_ACCESS_ERR: number; - INVALID_CHARACTER_ERR: number; - INVALID_MODIFICATION_ERR: number; - INVALID_NODE_TYPE_ERR: number; - INVALID_STATE_ERR: number; - NAMESPACE_ERR: number; - NETWORK_ERR: number; - NOT_FOUND_ERR: number; - NOT_SUPPORTED_ERR: number; - NO_DATA_ALLOWED_ERR: number; - NO_MODIFICATION_ALLOWED_ERR: number; - PARSE_ERR: number; - QUOTA_EXCEEDED_ERR: number; - SECURITY_ERR: number; - SERIALIZE_ERR: number; - SYNTAX_ERR: number; - TIMEOUT_ERR: number; - TYPE_MISMATCH_ERR: number; - URL_MISMATCH_ERR: number; - VALIDATION_ERR: number; - WRONG_DOCUMENT_ERR: number; + readonly ABORT_ERR: number; + readonly DATA_CLONE_ERR: number; + readonly DOMSTRING_SIZE_ERR: number; + readonly HIERARCHY_REQUEST_ERR: number; + readonly INDEX_SIZE_ERR: number; + readonly INUSE_ATTRIBUTE_ERR: number; + readonly INVALID_ACCESS_ERR: number; + readonly INVALID_CHARACTER_ERR: number; + readonly INVALID_MODIFICATION_ERR: number; + readonly INVALID_NODE_TYPE_ERR: number; + readonly INVALID_STATE_ERR: number; + readonly NAMESPACE_ERR: number; + readonly NETWORK_ERR: number; + readonly NOT_FOUND_ERR: number; + readonly NOT_SUPPORTED_ERR: number; + readonly NO_DATA_ALLOWED_ERR: number; + readonly NO_MODIFICATION_ALLOWED_ERR: number; + readonly PARSE_ERR: number; + readonly QUOTA_EXCEEDED_ERR: number; + readonly SECURITY_ERR: number; + readonly SERIALIZE_ERR: number; + readonly SYNTAX_ERR: number; + readonly TIMEOUT_ERR: number; + readonly TYPE_MISMATCH_ERR: number; + readonly URL_MISMATCH_ERR: number; + readonly VALIDATION_ERR: number; + readonly WRONG_DOCUMENT_ERR: number; } interface DOMStringList { - length: number; + readonly length: number; contains(str: string): boolean; - item(index: number): string; + item(index: number): string | null; [index: number]: string; } @@ -399,11 +212,11 @@ declare var DOMStringList: { } interface ErrorEvent extends Event { - colno: number; - error: any; - filename: string; - lineno: number; - message: string; + readonly colno: number; + readonly error: any; + readonly filename: string; + readonly lineno: number; + readonly message: string; initErrorEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, messageArg: string, filenameArg: string, linenoArg: number): void; } @@ -413,39 +226,39 @@ declare var ErrorEvent: { } interface Event { - bubbles: boolean; + readonly bubbles: boolean; cancelBubble: boolean; - cancelable: boolean; - currentTarget: EventTarget; - defaultPrevented: boolean; - eventPhase: number; - isTrusted: boolean; + readonly cancelable: boolean; + readonly currentTarget: EventTarget; + readonly defaultPrevented: boolean; + readonly eventPhase: number; + readonly isTrusted: boolean; returnValue: boolean; - srcElement: any; - target: EventTarget; - timeStamp: number; - type: string; + readonly srcElement: any; + readonly target: EventTarget; + readonly timeStamp: number; + readonly type: string; initEvent(eventTypeArg: string, canBubbleArg: boolean, cancelableArg: boolean): void; preventDefault(): void; stopImmediatePropagation(): void; stopPropagation(): void; - AT_TARGET: number; - BUBBLING_PHASE: number; - CAPTURING_PHASE: number; + readonly AT_TARGET: number; + readonly BUBBLING_PHASE: number; + readonly CAPTURING_PHASE: number; } declare var Event: { prototype: Event; new(type: string, eventInitDict?: EventInit): Event; - AT_TARGET: number; - BUBBLING_PHASE: number; - CAPTURING_PHASE: number; + readonly AT_TARGET: number; + readonly BUBBLING_PHASE: number; + readonly CAPTURING_PHASE: number; } interface EventTarget { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + addEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; dispatchEvent(evt: Event): boolean; - removeEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var EventTarget: { @@ -454,8 +267,9 @@ declare var EventTarget: { } interface File extends Blob { - lastModifiedDate: any; - name: string; + readonly lastModifiedDate: any; + readonly name: string; + readonly webkitRelativePath: string; } declare var File: { @@ -464,7 +278,7 @@ declare var File: { } interface FileList { - length: number; + readonly length: number; item(index: number): File; [index: number]: File; } @@ -475,7 +289,7 @@ declare var FileList: { } interface FileReader extends EventTarget, MSBaseReader { - error: DOMError; + readonly error: DOMError; readAsArrayBuffer(blob: Blob): void; readAsBinaryString(blob: Blob): void; readAsDataURL(blob: Blob): void; @@ -489,31 +303,31 @@ declare var FileReader: { } interface IDBCursor { - direction: string; - key: any; - primaryKey: any; - source: any; + readonly direction: string; + key: IDBKeyRange | IDBValidKey; + readonly primaryKey: any; + source: IDBObjectStore | IDBIndex; advance(count: number): void; - continue(key?: any): void; + continue(key?: IDBKeyRange | IDBValidKey): void; delete(): IDBRequest; update(value: any): IDBRequest; - NEXT: string; - NEXT_NO_DUPLICATE: string; - PREV: string; - PREV_NO_DUPLICATE: string; + readonly NEXT: string; + readonly NEXT_NO_DUPLICATE: string; + readonly PREV: string; + readonly PREV_NO_DUPLICATE: string; } declare var IDBCursor: { prototype: IDBCursor; new(): IDBCursor; - NEXT: string; - NEXT_NO_DUPLICATE: string; - PREV: string; - PREV_NO_DUPLICATE: string; + readonly NEXT: string; + readonly NEXT_NO_DUPLICATE: string; + readonly PREV: string; + readonly PREV_NO_DUPLICATE: string; } interface IDBCursorWithValue extends IDBCursor { - value: any; + readonly value: any; } declare var IDBCursorWithValue: { @@ -522,15 +336,17 @@ declare var IDBCursorWithValue: { } interface IDBDatabase extends EventTarget { - name: string; - objectStoreNames: DOMStringList; + readonly name: string; + readonly objectStoreNames: DOMStringList; onabort: (ev: Event) => any; onerror: (ev: Event) => any; - version: string; + version: number; + onversionchange: (ev: IDBVersionChangeEvent) => any; close(): void; - createObjectStore(name: string, optionalParameters?: any): IDBObjectStore; + createObjectStore(name: string, optionalParameters?: IDBObjectStoreParameters): IDBObjectStore; deleteObjectStore(name: string): void; - transaction(storeNames: any, mode?: string): IDBTransaction; + transaction(storeNames: string | string[], mode?: string): IDBTransaction; + addEventListener(type: "versionchange", listener: (ev: IDBVersionChangeEvent) => any, useCapture?: boolean): void; addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; @@ -553,15 +369,16 @@ declare var IDBFactory: { } interface IDBIndex { - keyPath: string; - name: string; - objectStore: IDBObjectStore; - unique: boolean; - count(key?: any): IDBRequest; - get(key: any): IDBRequest; - getKey(key: any): IDBRequest; - openCursor(range?: IDBKeyRange, direction?: string): IDBRequest; - openKeyCursor(range?: IDBKeyRange, direction?: string): IDBRequest; + keyPath: string | string[]; + readonly name: string; + readonly objectStore: IDBObjectStore; + readonly unique: boolean; + multiEntry: boolean; + count(key?: IDBKeyRange | IDBValidKey): IDBRequest; + get(key: IDBKeyRange | IDBValidKey): IDBRequest; + getKey(key: IDBKeyRange | IDBValidKey): IDBRequest; + openCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; + openKeyCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; } declare var IDBIndex: { @@ -570,36 +387,37 @@ declare var IDBIndex: { } interface IDBKeyRange { - lower: any; - lowerOpen: boolean; - upper: any; - upperOpen: boolean; + readonly lower: any; + readonly lowerOpen: boolean; + readonly upper: any; + readonly upperOpen: boolean; } declare var IDBKeyRange: { prototype: IDBKeyRange; new(): IDBKeyRange; bound(lower: any, upper: any, lowerOpen?: boolean, upperOpen?: boolean): IDBKeyRange; - lowerBound(bound: any, open?: boolean): IDBKeyRange; + lowerBound(lower: any, open?: boolean): IDBKeyRange; only(value: any): IDBKeyRange; - upperBound(bound: any, open?: boolean): IDBKeyRange; + upperBound(upper: any, open?: boolean): IDBKeyRange; } interface IDBObjectStore { - indexNames: DOMStringList; - keyPath: string; - name: string; - transaction: IDBTransaction; - add(value: any, key?: any): IDBRequest; + readonly indexNames: DOMStringList; + keyPath: string | string[]; + readonly name: string; + readonly transaction: IDBTransaction; + autoIncrement: boolean; + add(value: any, key?: IDBKeyRange | IDBValidKey): IDBRequest; clear(): IDBRequest; - count(key?: any): IDBRequest; - createIndex(name: string, keyPath: string, optionalParameters?: any): IDBIndex; - delete(key: any): IDBRequest; + count(key?: IDBKeyRange | IDBValidKey): IDBRequest; + createIndex(name: string, keyPath: string | string[], optionalParameters?: IDBIndexParameters): IDBIndex; + delete(key: IDBKeyRange | IDBValidKey): IDBRequest; deleteIndex(indexName: string): void; get(key: any): IDBRequest; index(name: string): IDBIndex; - openCursor(range?: any, direction?: string): IDBRequest; - put(value: any, key?: any): IDBRequest; + openCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; + put(value: any, key?: IDBKeyRange | IDBValidKey): IDBRequest; } declare var IDBObjectStore: { @@ -623,13 +441,13 @@ declare var IDBOpenDBRequest: { } interface IDBRequest extends EventTarget { - error: DOMError; + readonly error: DOMError; onerror: (ev: Event) => any; onsuccess: (ev: Event) => any; - readyState: string; - result: any; - source: any; - transaction: IDBTransaction; + readonly readyState: string; + readonly result: any; + source: IDBObjectStore | IDBIndex | IDBCursor; + readonly transaction: IDBTransaction; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "success", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; @@ -641,17 +459,17 @@ declare var IDBRequest: { } interface IDBTransaction extends EventTarget { - db: IDBDatabase; - error: DOMError; - mode: string; + readonly db: IDBDatabase; + readonly error: DOMError; + readonly mode: string; onabort: (ev: Event) => any; oncomplete: (ev: Event) => any; onerror: (ev: Event) => any; abort(): void; objectStore(name: string): IDBObjectStore; - READ_ONLY: string; - READ_WRITE: string; - VERSION_CHANGE: string; + readonly READ_ONLY: string; + readonly READ_WRITE: string; + readonly VERSION_CHANGE: string; addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "complete", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; @@ -661,14 +479,14 @@ interface IDBTransaction extends EventTarget { declare var IDBTransaction: { prototype: IDBTransaction; new(): IDBTransaction; - READ_ONLY: string; - READ_WRITE: string; - VERSION_CHANGE: string; + readonly READ_ONLY: string; + readonly READ_WRITE: string; + readonly VERSION_CHANGE: string; } interface IDBVersionChangeEvent extends Event { - newVersion: number; - oldVersion: number; + readonly newVersion: number | null; + readonly oldVersion: number; } declare var IDBVersionChangeEvent: { @@ -677,9 +495,9 @@ declare var IDBVersionChangeEvent: { } interface ImageData { - data: number[]; - height: number; - width: number; + data: Uint8ClampedArray; + readonly height: number; + readonly width: number; } declare var ImageData: { @@ -698,29 +516,29 @@ interface MSApp { execAsyncAtPriority(asynchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): void; execAtPriority(synchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): any; getCurrentPriority(): string; - getHtmlPrintDocumentSourceAsync(htmlDoc: any): any; + getHtmlPrintDocumentSourceAsync(htmlDoc: any): PromiseLike; getViewId(view: any): any; isTaskScheduledAtPriorityOrHigher(priority: string): boolean; pageHandlesAllApplicationActivations(enabled: boolean): void; suppressSubdownloadCredentialPrompts(suppress: boolean): void; terminateApp(exceptionObject: any): void; - CURRENT: string; - HIGH: string; - IDLE: string; - NORMAL: string; + readonly CURRENT: string; + readonly HIGH: string; + readonly IDLE: string; + readonly NORMAL: string; } declare var MSApp: MSApp; interface MSAppAsyncOperation extends EventTarget { - error: DOMError; + readonly error: DOMError; oncomplete: (ev: Event) => any; onerror: (ev: Event) => any; - readyState: number; - result: any; + readonly readyState: number; + readonly result: any; start(): void; - COMPLETED: number; - ERROR: number; - STARTED: number; + readonly COMPLETED: number; + readonly ERROR: number; + readonly STARTED: number; addEventListener(type: "complete", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; @@ -729,9 +547,9 @@ interface MSAppAsyncOperation extends EventTarget { declare var MSAppAsyncOperation: { prototype: MSAppAsyncOperation; new(): MSAppAsyncOperation; - COMPLETED: number; - ERROR: number; - STARTED: number; + readonly COMPLETED: number; + readonly ERROR: number; + readonly STARTED: number; } interface MSBlobBuilder { @@ -745,7 +563,7 @@ declare var MSBlobBuilder: { } interface MSStream { - type: string; + readonly type: string; msClose(): void; msDetachStream(): any; } @@ -756,7 +574,7 @@ declare var MSStream: { } interface MSStreamReader extends EventTarget, MSBaseReader { - error: DOMError; + readonly error: DOMError; readAsArrayBuffer(stream: MSStream, size?: number): void; readAsBinaryString(stream: MSStream, size?: number): void; readAsBlob(stream: MSStream, size?: number): void; @@ -771,8 +589,8 @@ declare var MSStreamReader: { } interface MediaQueryList { - matches: boolean; - media: string; + readonly matches: boolean; + readonly media: string; addListener(listener: MediaQueryListListener): void; removeListener(listener: MediaQueryListListener): void; } @@ -783,8 +601,8 @@ declare var MediaQueryList: { } interface MessageChannel { - port1: MessagePort; - port2: MessagePort; + readonly port1: MessagePort; + readonly port2: MessagePort; } declare var MessageChannel: { @@ -793,10 +611,10 @@ declare var MessageChannel: { } interface MessageEvent extends Event { - data: any; - origin: string; - ports: any; - source: any; + readonly data: any; + readonly origin: string; + readonly ports: any; + readonly source: any; initMessageEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, dataArg: any, originArg: string, lastEventIdArg: string, sourceArg: any): void; } @@ -820,8 +638,8 @@ declare var MessagePort: { } interface Position { - coords: Coordinates; - timestamp: number; + readonly coords: Coordinates; + readonly timestamp: number; } declare var Position: { @@ -830,26 +648,26 @@ declare var Position: { } interface PositionError { - code: number; - message: string; + readonly code: number; + readonly message: string; toString(): string; - PERMISSION_DENIED: number; - POSITION_UNAVAILABLE: number; - TIMEOUT: number; + readonly PERMISSION_DENIED: number; + readonly POSITION_UNAVAILABLE: number; + readonly TIMEOUT: number; } declare var PositionError: { prototype: PositionError; new(): PositionError; - PERMISSION_DENIED: number; - POSITION_UNAVAILABLE: number; - TIMEOUT: number; + readonly PERMISSION_DENIED: number; + readonly POSITION_UNAVAILABLE: number; + readonly TIMEOUT: number; } interface ProgressEvent extends Event { - lengthComputable: boolean; - loaded: number; - total: number; + readonly lengthComputable: boolean; + readonly loaded: number; + readonly total: number; initProgressEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, lengthComputableArg: boolean, loadedArg: number, totalArg: number): void; } @@ -860,21 +678,21 @@ declare var ProgressEvent: { interface WebSocket extends EventTarget { binaryType: string; - bufferedAmount: number; - extensions: string; + readonly bufferedAmount: number; + readonly extensions: string; onclose: (ev: CloseEvent) => any; onerror: (ev: Event) => any; onmessage: (ev: MessageEvent) => any; onopen: (ev: Event) => any; - protocol: string; - readyState: number; - url: string; + readonly protocol: string; + readonly readyState: number; + readonly url: string; close(code?: number, reason?: string): void; send(data: any): void; - CLOSED: number; - CLOSING: number; - CONNECTING: number; - OPEN: number; + readonly CLOSED: number; + readonly CLOSING: number; + readonly CONNECTING: number; + readonly OPEN: number; addEventListener(type: "close", listener: (ev: CloseEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "message", listener: (ev: MessageEvent) => any, useCapture?: boolean): void; @@ -885,10 +703,10 @@ interface WebSocket extends EventTarget { declare var WebSocket: { prototype: WebSocket; new(url: string, protocols?: string | string[]): WebSocket; - CLOSED: number; - CLOSING: number; - CONNECTING: number; - OPEN: number; + readonly CLOSED: number; + readonly CLOSING: number; + readonly CONNECTING: number; + readonly OPEN: number; } interface Worker extends EventTarget, AbstractWorker { @@ -908,31 +726,30 @@ declare var Worker: { interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget { msCaching: string; onreadystatechange: (ev: ProgressEvent) => any; - readyState: number; - response: any; - responseBody: any; - responseText: string; + readonly readyState: number; + readonly response: any; + readonly responseText: string; responseType: string; - responseXML: any; - status: number; - statusText: string; + readonly responseXML: any; + readonly status: number; + readonly statusText: string; timeout: number; - upload: XMLHttpRequestUpload; + readonly upload: XMLHttpRequestUpload; withCredentials: boolean; abort(): void; getAllResponseHeaders(): string; - getResponseHeader(header: string): string; + getResponseHeader(header: string): string | null; msCachingEnabled(): boolean; open(method: string, url: string, async?: boolean, user?: string, password?: string): void; overrideMimeType(mime: string): void; send(data?: string): void; send(data?: any): void; setRequestHeader(header: string, value: string): void; - DONE: number; - HEADERS_RECEIVED: number; - LOADING: number; - OPENED: number; - UNSENT: number; + readonly DONE: number; + readonly HEADERS_RECEIVED: number; + readonly LOADING: number; + readonly OPENED: number; + readonly UNSENT: number; addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -947,11 +764,11 @@ interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget { declare var XMLHttpRequest: { prototype: XMLHttpRequest; new(): XMLHttpRequest; - DONE: number; - HEADERS_RECEIVED: number; - LOADING: number; - OPENED: number; - UNSENT: number; + readonly DONE: number; + readonly HEADERS_RECEIVED: number; + readonly LOADING: number; + readonly OPENED: number; + readonly UNSENT: number; create(): XMLHttpRequest; } @@ -977,12 +794,12 @@ interface MSBaseReader { onloadend: (ev: ProgressEvent) => any; onloadstart: (ev: Event) => any; onprogress: (ev: ProgressEvent) => any; - readyState: number; - result: any; + readonly readyState: number; + readonly result: any; abort(): void; - DONE: number; - EMPTY: number; - LOADING: number; + readonly DONE: number; + readonly EMPTY: number; + readonly LOADING: number; addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -993,18 +810,18 @@ interface MSBaseReader { } interface NavigatorID { - appName: string; - appVersion: string; - platform: string; - product: string; - productSub: string; - userAgent: string; - vendor: string; - vendorSub: string; + readonly appName: string; + readonly appVersion: string; + readonly platform: string; + readonly product: string; + readonly productSub: string; + readonly userAgent: string; + readonly vendor: string; + readonly vendorSub: string; } interface NavigatorOnLine { - onLine: boolean; + readonly onLine: boolean; } interface WindowBase64 { @@ -1013,7 +830,7 @@ interface WindowBase64 { } interface WindowConsole { - console: Console; + readonly console: Console; } interface XMLHttpRequestEventTarget { @@ -1047,9 +864,9 @@ declare var FileReaderSync: { } interface WorkerGlobalScope extends EventTarget, WorkerUtils, DedicatedWorkerGlobalScope, WindowConsole { - location: WorkerLocation; + readonly location: WorkerLocation; onerror: (ev: Event) => any; - self: WorkerGlobalScope; + readonly self: WorkerGlobalScope; close(): void; msWriteProfilerMark(profilerMarkName: string): void; toString(): string; @@ -1064,14 +881,14 @@ declare var WorkerGlobalScope: { } interface WorkerLocation { - hash: string; - host: string; - hostname: string; - href: string; - pathname: string; - port: string; - protocol: string; - search: string; + readonly hash: string; + readonly host: string; + readonly hostname: string; + readonly href: string; + readonly pathname: string; + readonly port: string; + readonly protocol: string; + readonly search: string; toString(): string; } @@ -1097,9 +914,9 @@ interface DedicatedWorkerGlobalScope { } interface WorkerUtils extends Object, WindowBase64 { - indexedDB: IDBFactory; - msIndexedDB: IDBFactory; - navigator: WorkerNavigator; + readonly indexedDB: IDBFactory; + readonly msIndexedDB: IDBFactory; + readonly navigator: WorkerNavigator; clearImmediate(handle: number): void; clearInterval(handle: number): void; clearTimeout(handle: number): void; @@ -1138,6 +955,9 @@ interface ProgressEventInit extends EventInit { total?: number; } +interface IDBArrayKey extends Array { +} + declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject; interface ErrorEventHandler { @@ -1165,7 +985,7 @@ interface DecodeSuccessCallback { (decodedData: AudioBuffer): void; } interface DecodeErrorCallback { - (): void; + (error: DOMException): void; } interface FunctionStringCallback { (data: string): void; @@ -1176,9 +996,9 @@ declare var self: WorkerGlobalScope; declare function close(): void; declare function msWriteProfilerMark(profilerMarkName: string): void; declare function toString(): string; -declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +declare function addEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; declare function dispatchEvent(evt: Event): boolean; -declare function removeEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +declare function removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; declare var indexedDB: IDBFactory; declare var msIndexedDB: IDBFactory; declare var navigator: WorkerNavigator; @@ -1196,4 +1016,6 @@ declare function postMessage(data: any): void; declare var console: Console; declare function addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "message", listener: (ev: MessageEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; \ No newline at end of file +declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +type IDBKeyPath = string; +type IDBValidKey = number | string | Date | IDBArrayKey; \ No newline at end of file diff --git a/lib/tsc.js b/lib/tsc.js index 87a413af729..8dba7a921dc 100644 --- a/lib/tsc.js +++ b/lib/tsc.js @@ -19,7 +19,7 @@ var ts; function OperationCanceledException() { } return OperationCanceledException; - })(); + }()); ts.OperationCanceledException = OperationCanceledException; (function (ExitStatus) { ExitStatus[ExitStatus["Success"] = 0] = "Success"; @@ -46,6 +46,21 @@ var ts; DiagnosticCategory[DiagnosticCategory["Message"] = 2] = "Message"; })(ts.DiagnosticCategory || (ts.DiagnosticCategory = {})); var DiagnosticCategory = ts.DiagnosticCategory; + (function (ModuleResolutionKind) { + ModuleResolutionKind[ModuleResolutionKind["Classic"] = 1] = "Classic"; + ModuleResolutionKind[ModuleResolutionKind["NodeJs"] = 2] = "NodeJs"; + })(ts.ModuleResolutionKind || (ts.ModuleResolutionKind = {})); + var ModuleResolutionKind = ts.ModuleResolutionKind; + (function (ModuleKind) { + ModuleKind[ModuleKind["None"] = 0] = "None"; + ModuleKind[ModuleKind["CommonJS"] = 1] = "CommonJS"; + ModuleKind[ModuleKind["AMD"] = 2] = "AMD"; + ModuleKind[ModuleKind["UMD"] = 3] = "UMD"; + ModuleKind[ModuleKind["System"] = 4] = "System"; + ModuleKind[ModuleKind["ES6"] = 5] = "ES6"; + ModuleKind[ModuleKind["ES2015"] = 5] = "ES2015"; + })(ts.ModuleKind || (ts.ModuleKind = {})); + var ModuleKind = ts.ModuleKind; })(ts || (ts = {})); var ts; (function (ts) { @@ -104,11 +119,11 @@ var ts; return undefined; } ts.forEach = forEach; - function contains(array, value) { + function contains(array, value, areEqual) { if (array) { for (var _i = 0, array_1 = array; _i < array_1.length; _i++) { var v = array_1[_i]; - if (v === value) { + if (areEqual ? areEqual(v, value) : v === value) { return true; } } @@ -174,13 +189,13 @@ var ts; return array1.concat(array2); } ts.concatenate = concatenate; - function deduplicate(array) { + function deduplicate(array, areEqual) { var result; if (array) { result = []; for (var _i = 0, array_5 = array; _i < array_5.length; _i++) { var item = array_5[_i]; - if (!contains(result, item)) { + if (!contains(result, item, areEqual)) { result.push(item); } } @@ -247,9 +262,17 @@ var ts; var count = array.length; if (count > 0) { var pos = 0; - var result = arguments.length <= 2 ? array[pos++] : initial; + var result = void 0; + if (arguments.length <= 2) { + result = array[pos]; + pos++; + } + else { + result = initial; + } while (pos < count) { - result = f(result, array[pos++]); + result = f(result, array[pos]); + pos++; } return result; } @@ -261,9 +284,17 @@ var ts; if (array) { var pos = array.length - 1; if (pos >= 0) { - var result = arguments.length <= 2 ? array[pos--] : initial; + var result = void 0; + if (arguments.length <= 2) { + result = array[pos]; + pos--; + } + else { + result = initial; + } while (pos >= 0) { - result = f(result, array[pos--]); + result = f(result, array[pos]); + pos--; } return result; } @@ -276,6 +307,14 @@ var ts; return hasOwnProperty.call(map, key); } ts.hasProperty = hasProperty; + function getKeys(map) { + var keys = []; + for (var key in map) { + keys.push(key); + } + return keys; + } + ts.getKeys = getKeys; function getProperty(map, key) { return hasOwnProperty.call(map, key) ? map[key] : undefined; } @@ -346,6 +385,22 @@ var ts; return result; } ts.arrayToMap = arrayToMap; + function reduceProperties(map, callback, initial) { + var result = initial; + if (map) { + for (var key in map) { + if (hasProperty(map, key)) { + result = callback(result, map[key], String(key)); + } + } + } + return result; + } + ts.reduceProperties = reduceProperties; + function isArray(value) { + return Array.isArray ? Array.isArray(value) : value instanceof Array; + } + ts.isArray = isArray; function memoize(callback) { var value; return function () { @@ -390,6 +445,14 @@ var ts; }; } ts.createFileDiagnostic = createFileDiagnostic; + function formatMessage(dummy, message) { + var text = getLocaleSpecificMessage(message); + if (arguments.length > 2) { + text = formatStringFromArgs(text, arguments, 2); + } + return text; + } + ts.formatMessage = formatMessage; function createCompilerDiagnostic(message) { var text = getLocaleSpecificMessage(message); if (arguments.length > 1) { @@ -616,7 +679,8 @@ var ts; if (directoryComponents.length > 1 && lastOrUndefined(directoryComponents) === "") { directoryComponents.length--; } - for (var joinStartIndex = 0; joinStartIndex < pathComponents.length && joinStartIndex < directoryComponents.length; joinStartIndex++) { + var joinStartIndex; + for (joinStartIndex = 0; joinStartIndex < pathComponents.length && joinStartIndex < directoryComponents.length; joinStartIndex++) { if (getCanonicalFileName(directoryComponents[joinStartIndex]) !== getCanonicalFileName(pathComponents[joinStartIndex])) { break; } @@ -639,7 +703,7 @@ var ts; } ts.getRelativePathToDirectoryOrUrl = getRelativePathToDirectoryOrUrl; function getBaseFileName(path) { - if (!path) { + if (path === undefined) { return undefined; } var i = path.lastIndexOf(ts.directorySeparator); @@ -664,14 +728,39 @@ var ts; return pathLen > extLen && path.substr(pathLen - extLen, extLen) === extension; } ts.fileExtensionIs = fileExtensionIs; - ts.supportedExtensions = [".ts", ".tsx", ".d.ts"]; - ts.supportedJsExtensions = ts.supportedExtensions.concat(".js", ".jsx"); - function isSupportedSourceFileName(fileName) { + function ensureScriptKind(fileName, scriptKind) { + return (scriptKind || getScriptKindFromFileName(fileName)) || 3; + } + ts.ensureScriptKind = ensureScriptKind; + function getScriptKindFromFileName(fileName) { + var ext = fileName.substr(fileName.lastIndexOf(".")); + switch (ext.toLowerCase()) { + case ".js": + return 1; + case ".jsx": + return 2; + case ".ts": + return 3; + case ".tsx": + return 4; + default: + return 0; + } + } + ts.getScriptKindFromFileName = getScriptKindFromFileName; + ts.supportedTypeScriptExtensions = [".ts", ".tsx", ".d.ts"]; + ts.supportedJavascriptExtensions = [".js", ".jsx"]; + var allSupportedExtensions = ts.supportedTypeScriptExtensions.concat(ts.supportedJavascriptExtensions); + function getSupportedExtensions(options) { + return options && options.allowJs ? allSupportedExtensions : ts.supportedTypeScriptExtensions; + } + ts.getSupportedExtensions = getSupportedExtensions; + function isSupportedSourceFileName(fileName, compilerOptions) { if (!fileName) { return false; } - for (var _i = 0, supportedExtensions_1 = ts.supportedExtensions; _i < supportedExtensions_1.length; _i++) { - var extension = supportedExtensions_1[_i]; + for (var _i = 0, _a = getSupportedExtensions(compilerOptions); _i < _a.length; _i++) { + var extension = _a[_i]; if (fileExtensionIs(fileName, extension)) { return true; } @@ -690,22 +779,6 @@ var ts; return path; } ts.removeFileExtension = removeFileExtension; - var backslashOrDoubleQuote = /[\"\\]/g; - var escapedCharsRegExp = /[\u0000-\u001f\t\v\f\b\r\n\u2028\u2029\u0085]/g; - var escapedCharsMap = { - "\0": "\\0", - "\t": "\\t", - "\v": "\\v", - "\f": "\\f", - "\b": "\\b", - "\r": "\\r", - "\n": "\\n", - "\\": "\\\\", - "\"": "\\\"", - "\u2028": "\\u2028", - "\u2029": "\\u2029", - "\u0085": "\\u0085" - }; function Symbol(flags, name) { this.flags = flags; this.name = name; @@ -764,6 +837,12 @@ var ts; return copiedList; } ts.copyListRemovingItem = copyListRemovingItem; + function createGetCanonicalFileName(useCaseSensitivefileNames) { + return useCaseSensitivefileNames + ? (function (fileName) { return fileName; }) + : (function (fileName) { return fileName.toLowerCase(); }); + } + ts.createGetCanonicalFileName = createGetCanonicalFileName; })(ts || (ts = {})); var ts; (function (ts) { @@ -902,72 +981,73 @@ var ts; var _fs = require("fs"); var _path = require("path"); var _os = require("os"); - var _tty = require("tty"); - function createWatchedFileSet(interval, chunkSize) { - if (interval === void 0) { interval = 2500; } - if (chunkSize === void 0) { chunkSize = 30; } - var watchedFiles = []; - var nextFileToCheck = 0; - var watchTimer; - function getModifiedTime(fileName) { - return _fs.statSync(fileName).mtime; + var _crypto = require("crypto"); + var useNonPollingWatchers = process.env["TSC_NONPOLLING_WATCHER"]; + function createWatchedFileSet() { + var dirWatchers = {}; + var fileWatcherCallbacks = {}; + return { addFile: addFile, removeFile: removeFile }; + function reduceDirWatcherRefCountForFile(fileName) { + var dirName = ts.getDirectoryPath(fileName); + if (ts.hasProperty(dirWatchers, dirName)) { + var watcher = dirWatchers[dirName]; + watcher.referenceCount -= 1; + if (watcher.referenceCount <= 0) { + watcher.close(); + delete dirWatchers[dirName]; + } + } } - function poll(checkedIndex) { - var watchedFile = watchedFiles[checkedIndex]; - if (!watchedFile) { + function addDirWatcher(dirPath) { + if (ts.hasProperty(dirWatchers, dirPath)) { + var watcher_1 = dirWatchers[dirPath]; + watcher_1.referenceCount += 1; return; } - _fs.stat(watchedFile.fileName, function (err, stats) { - if (err) { - watchedFile.callback(watchedFile.fileName); - } - else if (watchedFile.mtime.getTime() !== stats.mtime.getTime()) { - watchedFile.mtime = getModifiedTime(watchedFile.fileName); - watchedFile.callback(watchedFile.fileName, watchedFile.mtime.getTime() === 0); - } - }); + var watcher = _fs.watch(dirPath, { persistent: true }, function (eventName, relativeFileName) { return fileEventHandler(eventName, relativeFileName, dirPath); }); + watcher.referenceCount = 1; + dirWatchers[dirPath] = watcher; + return; } - function startWatchTimer() { - watchTimer = setInterval(function () { - var count = 0; - var nextToCheck = nextFileToCheck; - var firstCheck = -1; - while ((count < chunkSize) && (nextToCheck !== firstCheck)) { - poll(nextToCheck); - if (firstCheck < 0) { - firstCheck = nextToCheck; - } - nextToCheck++; - if (nextToCheck === watchedFiles.length) { - nextToCheck = 0; - } - count++; - } - nextFileToCheck = nextToCheck; - }, interval); + function addFileWatcherCallback(filePath, callback) { + if (ts.hasProperty(fileWatcherCallbacks, filePath)) { + fileWatcherCallbacks[filePath].push(callback); + } + else { + fileWatcherCallbacks[filePath] = [callback]; + } } function addFile(fileName, callback) { - var file = { - fileName: fileName, - callback: callback, - mtime: getModifiedTime(fileName) - }; - watchedFiles.push(file); - if (watchedFiles.length === 1) { - startWatchTimer(); + addFileWatcherCallback(fileName, callback); + addDirWatcher(ts.getDirectoryPath(fileName)); + return { fileName: fileName, callback: callback }; + } + function removeFile(watchedFile) { + removeFileWatcherCallback(watchedFile.fileName, watchedFile.callback); + reduceDirWatcherRefCountForFile(watchedFile.fileName); + } + function removeFileWatcherCallback(filePath, callback) { + if (ts.hasProperty(fileWatcherCallbacks, filePath)) { + var newCallbacks = ts.copyListRemovingItem(callback, fileWatcherCallbacks[filePath]); + if (newCallbacks.length === 0) { + delete fileWatcherCallbacks[filePath]; + } + else { + fileWatcherCallbacks[filePath] = newCallbacks; + } } - return file; } - function removeFile(file) { - watchedFiles = ts.copyListRemovingItem(file, watchedFiles); + function fileEventHandler(eventName, relativeFileName, baseDirPath) { + var fileName = typeof relativeFileName !== "string" + ? undefined + : ts.getNormalizedAbsolutePath(relativeFileName, baseDirPath); + if ((eventName === "change" || eventName === "rename") && ts.hasProperty(fileWatcherCallbacks, fileName)) { + for (var _i = 0, _a = fileWatcherCallbacks[fileName]; _i < _a.length; _i++) { + var fileCallback = _a[_i]; + fileCallback(fileName); + } + } } - return { - getModifiedTime: getModifiedTime, - poll: poll, - startWatchTimer: startWatchTimer, - addFile: addFile, - removeFile: removeFile - }; } var watchedFileSet = createWatchedFileSet(); function isNode4OrLater() { @@ -976,7 +1056,7 @@ var ts; var platform = _os.platform(); var useCaseSensitiveFileNames = platform !== "win32" && platform !== "win64" && platform !== "darwin"; function readFile(fileName, encoding) { - if (!_fs.existsSync(fileName)) { + if (!fileExists(fileName)) { return undefined; } var buffer = _fs.readFileSync(fileName); @@ -1014,7 +1094,25 @@ var ts; } } function getCanonicalPath(path) { - return useCaseSensitiveFileNames ? path.toLowerCase() : path; + return useCaseSensitiveFileNames ? path : path.toLowerCase(); + } + function fileSystemEntryExists(path, entryKind) { + try { + var stat = _fs.statSync(path); + switch (entryKind) { + case 0: return stat.isFile(); + case 1: return stat.isDirectory(); + } + } + catch (e) { + return false; + } + } + function fileExists(path) { + return fileSystemEntryExists(path, 0); + } + function directoryExists(path) { + return fileSystemEntryExists(path, 1); } function readDirectory(path, extension, exclude) { var result = []; @@ -1026,6 +1124,9 @@ var ts; var directories = []; for (var _i = 0, files_2 = files; _i < files_2.length; _i++) { var current = files_2[_i]; + if (current === "." || current === "..") { + continue; + } var name_3 = ts.combinePaths(path, current); if (!ts.contains(exclude, getCanonicalPath(name_3))) { var stat = _fs.statSync(name_3); @@ -1055,18 +1156,36 @@ var ts; readFile: readFile, writeFile: writeFile, watchFile: function (fileName, callback) { - if (isNode4OrLater()) { - return _fs.watch(fileName, function (eventName, relativeFileName) { return callback(fileName); }); + if (useNonPollingWatchers) { + var watchedFile_1 = watchedFileSet.addFile(fileName, callback); + return { + close: function () { return watchedFileSet.removeFile(watchedFile_1); } + }; + } + else { + _fs.watchFile(fileName, { persistent: true, interval: 250 }, fileChanged); + return { + close: function () { return _fs.unwatchFile(fileName, fileChanged); } + }; + } + function fileChanged(curr, prev) { + if (+curr.mtime <= +prev.mtime) { + return; + } + callback(fileName); } - var watchedFile = watchedFileSet.addFile(fileName, callback); - return { - close: function () { return watchedFileSet.removeFile(watchedFile); } - }; }, - watchDirectory: function (path, callback, recursive) { - return _fs.watch(path, { persistent: true, recursive: !!recursive }, function (eventName, relativeFileName) { + watchDirectory: function (directoryName, callback, recursive) { + var options; + if (isNode4OrLater() && (process.platform === "win32" || process.platform === "darwin")) { + options = { persistent: true, recursive: !!recursive }; + } + else { + options = { persistent: true }; + } + return _fs.watch(directoryName, options, function (eventName, relativeFileName) { if (eventName === "rename") { - callback(!relativeFileName ? relativeFileName : ts.normalizePath(ts.combinePaths(path, relativeFileName))); + callback(!relativeFileName ? relativeFileName : ts.normalizePath(ts.combinePaths(directoryName, relativeFileName))); } ; }); @@ -1074,12 +1193,8 @@ var ts; resolvePath: function (path) { return _path.resolve(path); }, - fileExists: function (path) { - return _fs.existsSync(path); - }, - directoryExists: function (path) { - return _fs.existsSync(path) && _fs.statSync(path).isDirectory(); - }, + fileExists: fileExists, + directoryExists: directoryExists, createDirectory: function (directoryName) { if (!this.directoryExists(directoryName)) { _fs.mkdirSync(directoryName); @@ -1092,6 +1207,19 @@ var ts; return process.cwd(); }, readDirectory: readDirectory, + getModifiedTime: function (path) { + try { + return _fs.statSync(path).mtime; + } + catch (e) { + return undefined; + } + }, + createHash: function (data) { + var hash = _crypto.createHash("md5"); + hash.update(data); + return hash.digest("hex"); + }, getMemoryUsage: function () { if (global.gc) { global.gc(); @@ -1100,10 +1228,43 @@ var ts; }, exit: function (exitCode) { process.exit(exitCode); + }, + realpath: function (path) { + return _fs.realpathSync(path); } }; } - if (typeof WScript !== "undefined" && typeof ActiveXObject === "function") { + function getChakraSystem() { + var realpath = ChakraHost.realpath && (function (path) { return ChakraHost.realpath(path); }); + return { + newLine: ChakraHost.newLine || "\r\n", + args: ChakraHost.args, + useCaseSensitiveFileNames: !!ChakraHost.useCaseSensitiveFileNames, + write: ChakraHost.echo, + readFile: function (path, encoding) { + return ChakraHost.readFile(path); + }, + writeFile: function (path, data, writeByteOrderMark) { + if (writeByteOrderMark) { + data = "\uFEFF" + data; + } + ChakraHost.writeFile(path, data); + }, + resolvePath: ChakraHost.resolvePath, + fileExists: ChakraHost.fileExists, + directoryExists: ChakraHost.directoryExists, + createDirectory: ChakraHost.createDirectory, + getExecutingFilePath: function () { return ChakraHost.executingFile; }, + getCurrentDirectory: function () { return ChakraHost.currentDirectory; }, + readDirectory: ChakraHost.readDirectory, + exit: ChakraHost.quit, + realpath: realpath + }; + } + if (typeof ChakraHost !== "undefined") { + return getChakraSystem(); + } + else if (typeof WScript !== "undefined" && typeof ActiveXObject === "function") { return getWScriptSystem(); } else if (typeof process !== "undefined" && process.nextTick && !process.browser && typeof require !== "undefined") { @@ -1134,6 +1295,7 @@ var ts; An_index_signature_must_have_a_type_annotation: { code: 1021, category: ts.DiagnosticCategory.Error, key: "An_index_signature_must_have_a_type_annotation_1021", message: "An index signature must have a type annotation." }, An_index_signature_parameter_must_have_a_type_annotation: { code: 1022, category: ts.DiagnosticCategory.Error, key: "An_index_signature_parameter_must_have_a_type_annotation_1022", message: "An index signature parameter must have a type annotation." }, An_index_signature_parameter_type_must_be_string_or_number: { code: 1023, category: ts.DiagnosticCategory.Error, key: "An_index_signature_parameter_type_must_be_string_or_number_1023", message: "An index signature parameter type must be 'string' or 'number'." }, + readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature: { code: 1024, category: ts.DiagnosticCategory.Error, key: "readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature_1024", message: "'readonly' modifier can only appear on a property declaration or index signature." }, Accessibility_modifier_already_seen: { code: 1028, category: ts.DiagnosticCategory.Error, key: "Accessibility_modifier_already_seen_1028", message: "Accessibility modifier already seen." }, _0_modifier_must_precede_1_modifier: { code: 1029, category: ts.DiagnosticCategory.Error, key: "_0_modifier_must_precede_1_modifier_1029", message: "'{0}' modifier must precede '{1}' modifier." }, _0_modifier_already_seen: { code: 1030, category: ts.DiagnosticCategory.Error, key: "_0_modifier_already_seen_1030", message: "'{0}' modifier already seen." }, @@ -1147,7 +1309,7 @@ var ts; _0_modifier_cannot_be_used_with_a_class_declaration: { code: 1041, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_be_used_with_a_class_declaration_1041", message: "'{0}' modifier cannot be used with a class declaration." }, _0_modifier_cannot_be_used_here: { code: 1042, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_be_used_here_1042", message: "'{0}' modifier cannot be used here." }, _0_modifier_cannot_appear_on_a_data_property: { code: 1043, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_appear_on_a_data_property_1043", message: "'{0}' modifier cannot appear on a data property." }, - _0_modifier_cannot_appear_on_a_module_element: { code: 1044, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_appear_on_a_module_element_1044", message: "'{0}' modifier cannot appear on a module element." }, + _0_modifier_cannot_appear_on_a_module_or_namespace_element: { code: 1044, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_appear_on_a_module_or_namespace_element_1044", message: "'{0}' modifier cannot appear on a module or namespace element." }, A_0_modifier_cannot_be_used_with_an_interface_declaration: { code: 1045, category: ts.DiagnosticCategory.Error, key: "A_0_modifier_cannot_be_used_with_an_interface_declaration_1045", message: "A '{0}' modifier cannot be used with an interface declaration." }, A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file: { code: 1046, category: ts.DiagnosticCategory.Error, key: "A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file_1046", message: "A 'declare' modifier is required for a top level declaration in a .d.ts file." }, A_rest_parameter_cannot_be_optional: { code: 1047, category: ts.DiagnosticCategory.Error, key: "A_rest_parameter_cannot_be_optional_1047", message: "A rest parameter cannot be optional." }, @@ -1166,8 +1328,11 @@ var ts; Enum_member_must_have_initializer: { code: 1061, category: ts.DiagnosticCategory.Error, key: "Enum_member_must_have_initializer_1061", message: "Enum member must have initializer." }, _0_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method: { code: 1062, category: ts.DiagnosticCategory.Error, key: "_0_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method_1062", message: "{0} is referenced directly or indirectly in the fulfillment callback of its own 'then' method." }, An_export_assignment_cannot_be_used_in_a_namespace: { code: 1063, category: ts.DiagnosticCategory.Error, key: "An_export_assignment_cannot_be_used_in_a_namespace_1063", message: "An export assignment cannot be used in a namespace." }, + The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type: { code: 1064, category: ts.DiagnosticCategory.Error, key: "The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_1064", message: "The return type of an async function or method must be the global Promise type." }, In_ambient_enum_declarations_member_initializer_must_be_constant_expression: { code: 1066, category: ts.DiagnosticCategory.Error, key: "In_ambient_enum_declarations_member_initializer_must_be_constant_expression_1066", message: "In ambient enum declarations member initializer must be constant expression." }, Unexpected_token_A_constructor_method_accessor_or_property_was_expected: { code: 1068, category: ts.DiagnosticCategory.Error, key: "Unexpected_token_A_constructor_method_accessor_or_property_was_expected_1068", message: "Unexpected token. A constructor, method, accessor, or property was expected." }, + _0_modifier_cannot_appear_on_a_type_member: { code: 1070, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_appear_on_a_type_member_1070", message: "'{0}' modifier cannot appear on a type member." }, + _0_modifier_cannot_appear_on_an_index_signature: { code: 1071, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_appear_on_an_index_signature_1071", message: "'{0}' modifier cannot appear on an index signature." }, A_0_modifier_cannot_be_used_with_an_import_declaration: { code: 1079, category: ts.DiagnosticCategory.Error, key: "A_0_modifier_cannot_be_used_with_an_import_declaration_1079", message: "A '{0}' modifier cannot be used with an import declaration." }, Invalid_reference_directive_syntax: { code: 1084, category: ts.DiagnosticCategory.Error, key: "Invalid_reference_directive_syntax_1084", message: "Invalid 'reference' directive syntax." }, Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher: { code: 1085, category: ts.DiagnosticCategory.Error, key: "Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_1085", message: "Octal literals are not available when targeting ECMAScript 5 and higher." }, @@ -1192,7 +1357,6 @@ var ts; A_return_statement_can_only_be_used_within_a_function_body: { code: 1108, category: ts.DiagnosticCategory.Error, key: "A_return_statement_can_only_be_used_within_a_function_body_1108", message: "A 'return' statement can only be used within a function body." }, Expression_expected: { code: 1109, category: ts.DiagnosticCategory.Error, key: "Expression_expected_1109", message: "Expression expected." }, Type_expected: { code: 1110, category: ts.DiagnosticCategory.Error, key: "Type_expected_1110", message: "Type expected." }, - A_class_member_cannot_be_declared_optional: { code: 1112, category: ts.DiagnosticCategory.Error, key: "A_class_member_cannot_be_declared_optional_1112", message: "A class member cannot be declared optional." }, A_default_clause_cannot_appear_more_than_once_in_a_switch_statement: { code: 1113, category: ts.DiagnosticCategory.Error, key: "A_default_clause_cannot_appear_more_than_once_in_a_switch_statement_1113", message: "A 'default' clause cannot appear more than once in a 'switch' statement." }, Duplicate_label_0: { code: 1114, category: ts.DiagnosticCategory.Error, key: "Duplicate_label_0_1114", message: "Duplicate label '{0}'" }, A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement: { code: 1115, category: ts.DiagnosticCategory.Error, key: "A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement_1115", message: "A 'continue' statement can only jump to a label of an enclosing iteration statement." }, @@ -1223,10 +1387,9 @@ var ts; String_literal_expected: { code: 1141, category: ts.DiagnosticCategory.Error, key: "String_literal_expected_1141", message: "String literal expected." }, Line_break_not_permitted_here: { code: 1142, category: ts.DiagnosticCategory.Error, key: "Line_break_not_permitted_here_1142", message: "Line break not permitted here." }, or_expected: { code: 1144, category: ts.DiagnosticCategory.Error, key: "or_expected_1144", message: "'{' or ';' expected." }, - Modifiers_not_permitted_on_index_signature_members: { code: 1145, category: ts.DiagnosticCategory.Error, key: "Modifiers_not_permitted_on_index_signature_members_1145", message: "Modifiers not permitted on index signature members." }, Declaration_expected: { code: 1146, category: ts.DiagnosticCategory.Error, key: "Declaration_expected_1146", message: "Declaration expected." }, Import_declarations_in_a_namespace_cannot_reference_a_module: { code: 1147, category: ts.DiagnosticCategory.Error, key: "Import_declarations_in_a_namespace_cannot_reference_a_module_1147", message: "Import declarations in a namespace cannot reference a module." }, - Cannot_compile_modules_unless_the_module_flag_is_provided: { code: 1148, category: ts.DiagnosticCategory.Error, key: "Cannot_compile_modules_unless_the_module_flag_is_provided_1148", message: "Cannot compile modules unless the '--module' flag is provided." }, + Cannot_compile_modules_unless_the_module_flag_is_provided_with_a_valid_module_type_Consider_setting_the_module_compiler_option_in_a_tsconfig_json_file: { code: 1148, category: ts.DiagnosticCategory.Error, key: "Cannot_compile_modules_unless_the_module_flag_is_provided_with_a_valid_module_type_Consider_setting__1148", message: "Cannot compile modules unless the '--module' flag is provided with a valid module type. Consider setting the 'module' compiler option in a 'tsconfig.json' file." }, File_name_0_differs_from_already_included_file_name_1_only_in_casing: { code: 1149, category: ts.DiagnosticCategory.Error, key: "File_name_0_differs_from_already_included_file_name_1_only_in_casing_1149", message: "File name '{0}' differs from already included file name '{1}' only in casing" }, new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead: { code: 1150, category: ts.DiagnosticCategory.Error, key: "new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead_1150", message: "'new T[]' cannot be used to create an array. Use 'new Array()' instead." }, const_declarations_must_be_initialized: { code: 1155, category: ts.DiagnosticCategory.Error, key: "const_declarations_must_be_initialized_1155", message: "'const' declarations must be initialized" }, @@ -1286,7 +1449,7 @@ var ts; Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode: { code: 1214, category: ts.DiagnosticCategory.Error, key: "Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode_1214", message: "Identifier expected. '{0}' is a reserved word in strict mode. Modules are automatically in strict mode." }, Invalid_use_of_0_Modules_are_automatically_in_strict_mode: { code: 1215, category: ts.DiagnosticCategory.Error, key: "Invalid_use_of_0_Modules_are_automatically_in_strict_mode_1215", message: "Invalid use of '{0}'. Modules are automatically in strict mode." }, Export_assignment_is_not_supported_when_module_flag_is_system: { code: 1218, category: ts.DiagnosticCategory.Error, key: "Export_assignment_is_not_supported_when_module_flag_is_system_1218", message: "Export assignment is not supported when '--module' flag is 'system'." }, - Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Specify_experimentalDecorators_to_remove_this_warning: { code: 1219, category: ts.DiagnosticCategory.Error, key: "Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Speci_1219", message: "Experimental support for decorators is a feature that is subject to change in a future release. Specify '--experimentalDecorators' to remove this warning." }, + Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning: { code: 1219, category: ts.DiagnosticCategory.Error, key: "Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_t_1219", message: "Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning." }, Generators_are_only_available_when_targeting_ECMAScript_6_or_higher: { code: 1220, category: ts.DiagnosticCategory.Error, key: "Generators_are_only_available_when_targeting_ECMAScript_6_or_higher_1220", message: "Generators are only available when targeting ECMAScript 6 or higher." }, Generators_are_not_allowed_in_an_ambient_context: { code: 1221, category: ts.DiagnosticCategory.Error, key: "Generators_are_not_allowed_in_an_ambient_context_1221", message: "Generators are not allowed in an ambient context." }, An_overload_signature_cannot_be_declared_as_a_generator: { code: 1222, category: ts.DiagnosticCategory.Error, key: "An_overload_signature_cannot_be_declared_as_a_generator_1222", message: "An overload signature cannot be declared as a generator." }, @@ -1309,15 +1472,25 @@ var ts; Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression: { code: 1239, category: ts.DiagnosticCategory.Error, key: "Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression_1239", message: "Unable to resolve signature of parameter decorator when called as an expression." }, Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression: { code: 1240, category: ts.DiagnosticCategory.Error, key: "Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression_1240", message: "Unable to resolve signature of property decorator when called as an expression." }, Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression: { code: 1241, category: ts.DiagnosticCategory.Error, key: "Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression_1241", message: "Unable to resolve signature of method decorator when called as an expression." }, - abstract_modifier_can_only_appear_on_a_class_or_method_declaration: { code: 1242, category: ts.DiagnosticCategory.Error, key: "abstract_modifier_can_only_appear_on_a_class_or_method_declaration_1242", message: "'abstract' modifier can only appear on a class or method declaration." }, + abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration: { code: 1242, category: ts.DiagnosticCategory.Error, key: "abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration_1242", message: "'abstract' modifier can only appear on a class, method, or property declaration." }, _0_modifier_cannot_be_used_with_1_modifier: { code: 1243, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_be_used_with_1_modifier_1243", message: "'{0}' modifier cannot be used with '{1}' modifier." }, Abstract_methods_can_only_appear_within_an_abstract_class: { code: 1244, category: ts.DiagnosticCategory.Error, key: "Abstract_methods_can_only_appear_within_an_abstract_class_1244", message: "Abstract methods can only appear within an abstract class." }, Method_0_cannot_have_an_implementation_because_it_is_marked_abstract: { code: 1245, category: ts.DiagnosticCategory.Error, key: "Method_0_cannot_have_an_implementation_because_it_is_marked_abstract_1245", message: "Method '{0}' cannot have an implementation because it is marked abstract." }, + An_interface_property_cannot_have_an_initializer: { code: 1246, category: ts.DiagnosticCategory.Error, key: "An_interface_property_cannot_have_an_initializer_1246", message: "An interface property cannot have an initializer." }, + A_type_literal_property_cannot_have_an_initializer: { code: 1247, category: ts.DiagnosticCategory.Error, key: "A_type_literal_property_cannot_have_an_initializer_1247", message: "A type literal property cannot have an initializer." }, + A_class_member_cannot_have_the_0_keyword: { code: 1248, category: ts.DiagnosticCategory.Error, key: "A_class_member_cannot_have_the_0_keyword_1248", message: "A class member cannot have the '{0}' keyword." }, + A_decorator_can_only_decorate_a_method_implementation_not_an_overload: { code: 1249, category: ts.DiagnosticCategory.Error, key: "A_decorator_can_only_decorate_a_method_implementation_not_an_overload_1249", message: "A decorator can only decorate a method implementation, not an overload." }, + Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5: { code: 1250, category: ts.DiagnosticCategory.Error, key: "Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_1250", message: "Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'." }, + Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Class_definitions_are_automatically_in_strict_mode: { code: 1251, category: ts.DiagnosticCategory.Error, key: "Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Class_d_1251", message: "Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. Class definitions are automatically in strict mode." }, + Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Modules_are_automatically_in_strict_mode: { code: 1252, category: ts.DiagnosticCategory.Error, key: "Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Modules_1252", message: "Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. Modules are automatically in strict mode." }, with_statements_are_not_allowed_in_an_async_function_block: { code: 1300, category: ts.DiagnosticCategory.Error, key: "with_statements_are_not_allowed_in_an_async_function_block_1300", message: "'with' statements are not allowed in an async function block." }, await_expression_is_only_allowed_within_an_async_function: { code: 1308, category: ts.DiagnosticCategory.Error, key: "await_expression_is_only_allowed_within_an_async_function_1308", message: "'await' expression is only allowed within an async function." }, Async_functions_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1311, category: ts.DiagnosticCategory.Error, key: "Async_functions_are_only_available_when_targeting_ECMAScript_6_and_higher_1311", message: "Async functions are only available when targeting ECMAScript 6 and higher." }, can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment: { code: 1312, category: ts.DiagnosticCategory.Error, key: "can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment_1312", message: "'=' can only be used in an object literal property inside a destructuring assignment." }, The_body_of_an_if_statement_cannot_be_the_empty_statement: { code: 1313, category: ts.DiagnosticCategory.Error, key: "The_body_of_an_if_statement_cannot_be_the_empty_statement_1313", message: "The body of an 'if' statement cannot be the empty statement." }, + Global_module_exports_may_only_appear_in_module_files: { code: 1314, category: ts.DiagnosticCategory.Error, key: "Global_module_exports_may_only_appear_in_module_files_1314", message: "Global module exports may only appear in module files." }, + Global_module_exports_may_only_appear_in_declaration_files: { code: 1315, category: ts.DiagnosticCategory.Error, key: "Global_module_exports_may_only_appear_in_declaration_files_1315", message: "Global module exports may only appear in declaration files." }, + Global_module_exports_may_only_appear_at_top_level: { code: 1316, category: ts.DiagnosticCategory.Error, key: "Global_module_exports_may_only_appear_at_top_level_1316", message: "Global module exports may only appear at top level." }, Duplicate_identifier_0: { code: 2300, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_0_2300", message: "Duplicate identifier '{0}'." }, Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: ts.DiagnosticCategory.Error, key: "Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301", message: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, Static_members_cannot_reference_class_type_parameters: { code: 2302, category: ts.DiagnosticCategory.Error, key: "Static_members_cannot_reference_class_type_parameters_2302", message: "Static members cannot reference class type parameters." }, @@ -1326,11 +1499,12 @@ var ts; Module_0_has_no_exported_member_1: { code: 2305, category: ts.DiagnosticCategory.Error, key: "Module_0_has_no_exported_member_1_2305", message: "Module '{0}' has no exported member '{1}'." }, File_0_is_not_a_module: { code: 2306, category: ts.DiagnosticCategory.Error, key: "File_0_is_not_a_module_2306", message: "File '{0}' is not a module." }, Cannot_find_module_0: { code: 2307, category: ts.DiagnosticCategory.Error, key: "Cannot_find_module_0_2307", message: "Cannot find module '{0}'." }, + Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambiguity: { code: 2308, category: ts.DiagnosticCategory.Error, key: "Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambig_2308", message: "Module {0} has already exported a member named '{1}'. Consider explicitly re-exporting to resolve the ambiguity." }, An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements: { code: 2309, category: ts.DiagnosticCategory.Error, key: "An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements_2309", message: "An export assignment cannot be used in a module with other exported elements." }, Type_0_recursively_references_itself_as_a_base_type: { code: 2310, category: ts.DiagnosticCategory.Error, key: "Type_0_recursively_references_itself_as_a_base_type_2310", message: "Type '{0}' recursively references itself as a base type." }, A_class_may_only_extend_another_class: { code: 2311, category: ts.DiagnosticCategory.Error, key: "A_class_may_only_extend_another_class_2311", message: "A class may only extend another class." }, An_interface_may_only_extend_a_class_or_another_interface: { code: 2312, category: ts.DiagnosticCategory.Error, key: "An_interface_may_only_extend_a_class_or_another_interface_2312", message: "An interface may only extend a class or another interface." }, - Constraint_of_a_type_parameter_cannot_reference_any_type_parameter_from_the_same_type_parameter_list: { code: 2313, category: ts.DiagnosticCategory.Error, key: "Constraint_of_a_type_parameter_cannot_reference_any_type_parameter_from_the_same_type_parameter_list_2313", message: "Constraint of a type parameter cannot reference any type parameter from the same type parameter list." }, + Type_parameter_0_has_a_circular_constraint: { code: 2313, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_has_a_circular_constraint_2313", message: "Type parameter '{0}' has a circular constraint." }, Generic_type_0_requires_1_type_argument_s: { code: 2314, category: ts.DiagnosticCategory.Error, key: "Generic_type_0_requires_1_type_argument_s_2314", message: "Generic type '{0}' requires {1} type argument(s)." }, Type_0_is_not_generic: { code: 2315, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_generic_2315", message: "Type '{0}' is not generic." }, Global_type_0_must_be_a_class_or_interface_type: { code: 2316, category: ts.DiagnosticCategory.Error, key: "Global_type_0_must_be_a_class_or_interface_type_2316", message: "Global type '{0}' must be a class or interface type." }, @@ -1340,6 +1514,7 @@ var ts; Interface_0_cannot_simultaneously_extend_types_1_and_2: { code: 2320, category: ts.DiagnosticCategory.Error, key: "Interface_0_cannot_simultaneously_extend_types_1_and_2_2320", message: "Interface '{0}' cannot simultaneously extend types '{1}' and '{2}'." }, Excessive_stack_depth_comparing_types_0_and_1: { code: 2321, category: ts.DiagnosticCategory.Error, key: "Excessive_stack_depth_comparing_types_0_and_1_2321", message: "Excessive stack depth comparing types '{0}' and '{1}'." }, Type_0_is_not_assignable_to_type_1: { code: 2322, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_assignable_to_type_1_2322", message: "Type '{0}' is not assignable to type '{1}'." }, + Cannot_redeclare_exported_variable_0: { code: 2323, category: ts.DiagnosticCategory.Error, key: "Cannot_redeclare_exported_variable_0_2323", message: "Cannot redeclare exported variable '{0}'." }, Property_0_is_missing_in_type_1: { code: 2324, category: ts.DiagnosticCategory.Error, key: "Property_0_is_missing_in_type_1_2324", message: "Property '{0}' is missing in type '{1}'." }, Property_0_is_private_in_type_1_but_not_in_type_2: { code: 2325, category: ts.DiagnosticCategory.Error, key: "Property_0_is_private_in_type_1_but_not_in_type_2_2325", message: "Property '{0}' is private in type '{1}' but not in type '{2}'." }, Types_of_property_0_are_incompatible: { code: 2326, category: ts.DiagnosticCategory.Error, key: "Types_of_property_0_are_incompatible_2326", message: "Types of property '{0}' are incompatible." }, @@ -1367,7 +1542,7 @@ var ts; Cannot_invoke_an_expression_whose_type_lacks_a_call_signature: { code: 2349, category: ts.DiagnosticCategory.Error, key: "Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_2349", message: "Cannot invoke an expression whose type lacks a call signature." }, Only_a_void_function_can_be_called_with_the_new_keyword: { code: 2350, category: ts.DiagnosticCategory.Error, key: "Only_a_void_function_can_be_called_with_the_new_keyword_2350", message: "Only a void function can be called with the 'new' keyword." }, Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature: { code: 2351, category: ts.DiagnosticCategory.Error, key: "Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature_2351", message: "Cannot use 'new' with an expression whose type lacks a call or construct signature." }, - Neither_type_0_nor_type_1_is_assignable_to_the_other: { code: 2352, category: ts.DiagnosticCategory.Error, key: "Neither_type_0_nor_type_1_is_assignable_to_the_other_2352", message: "Neither type '{0}' nor type '{1}' is assignable to the other." }, + Type_0_cannot_be_converted_to_type_1: { code: 2352, category: ts.DiagnosticCategory.Error, key: "Type_0_cannot_be_converted_to_type_1_2352", message: "Type '{0}' cannot be converted to type '{1}'." }, Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1: { code: 2353, category: ts.DiagnosticCategory.Error, key: "Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1_2353", message: "Object literal may only specify known properties, and '{0}' does not exist in type '{1}'." }, No_best_common_type_exists_among_return_expressions: { code: 2354, category: ts.DiagnosticCategory.Error, key: "No_best_common_type_exists_among_return_expressions_2354", message: "No best common type exists among return expressions." }, A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value: { code: 2355, category: ts.DiagnosticCategory.Error, key: "A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_2355", message: "A function whose declared type is neither 'void' nor 'any' must return a value." }, @@ -1381,6 +1556,7 @@ var ts; The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2363, category: ts.DiagnosticCategory.Error, key: "The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type_2363", message: "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, Invalid_left_hand_side_of_assignment_expression: { code: 2364, category: ts.DiagnosticCategory.Error, key: "Invalid_left_hand_side_of_assignment_expression_2364", message: "Invalid left-hand side of assignment expression." }, Operator_0_cannot_be_applied_to_types_1_and_2: { code: 2365, category: ts.DiagnosticCategory.Error, key: "Operator_0_cannot_be_applied_to_types_1_and_2_2365", message: "Operator '{0}' cannot be applied to types '{1}' and '{2}'." }, + Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined: { code: 2366, category: ts.DiagnosticCategory.Error, key: "Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined_2366", message: "Function lacks ending return statement and return type does not include 'undefined'." }, Type_parameter_name_cannot_be_0: { code: 2368, category: ts.DiagnosticCategory.Error, key: "Type_parameter_name_cannot_be_0_2368", message: "Type parameter name cannot be '{0}'" }, A_parameter_property_is_only_allowed_in_a_constructor_implementation: { code: 2369, category: ts.DiagnosticCategory.Error, key: "A_parameter_property_is_only_allowed_in_a_constructor_implementation_2369", message: "A parameter property is only allowed in a constructor implementation." }, A_rest_parameter_must_be_of_an_array_type: { code: 2370, category: ts.DiagnosticCategory.Error, key: "A_rest_parameter_must_be_of_an_array_type_2370", message: "A rest parameter must be of an array type." }, @@ -1396,7 +1572,7 @@ var ts; get_and_set_accessor_must_have_the_same_type: { code: 2380, category: ts.DiagnosticCategory.Error, key: "get_and_set_accessor_must_have_the_same_type_2380", message: "'get' and 'set' accessor must have the same type." }, A_signature_with_an_implementation_cannot_use_a_string_literal_type: { code: 2381, category: ts.DiagnosticCategory.Error, key: "A_signature_with_an_implementation_cannot_use_a_string_literal_type_2381", message: "A signature with an implementation cannot use a string literal type." }, Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature: { code: 2382, category: ts.DiagnosticCategory.Error, key: "Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature_2382", message: "Specialized overload signature is not assignable to any non-specialized signature." }, - Overload_signatures_must_all_be_exported_or_not_exported: { code: 2383, category: ts.DiagnosticCategory.Error, key: "Overload_signatures_must_all_be_exported_or_not_exported_2383", message: "Overload signatures must all be exported or not exported." }, + Overload_signatures_must_all_be_exported_or_non_exported: { code: 2383, category: ts.DiagnosticCategory.Error, key: "Overload_signatures_must_all_be_exported_or_non_exported_2383", message: "Overload signatures must all be exported or non-exported." }, Overload_signatures_must_all_be_ambient_or_non_ambient: { code: 2384, category: ts.DiagnosticCategory.Error, key: "Overload_signatures_must_all_be_ambient_or_non_ambient_2384", message: "Overload signatures must all be ambient or non-ambient." }, Overload_signatures_must_all_be_public_private_or_protected: { code: 2385, category: ts.DiagnosticCategory.Error, key: "Overload_signatures_must_all_be_public_private_or_protected_2385", message: "Overload signatures must all be public, private or protected." }, Overload_signatures_must_all_be_optional_or_required: { code: 2386, category: ts.DiagnosticCategory.Error, key: "Overload_signatures_must_all_be_optional_or_required_2386", message: "Overload signatures must all be optional or required." }, @@ -1410,6 +1586,7 @@ var ts; Overload_signature_is_not_compatible_with_function_implementation: { code: 2394, category: ts.DiagnosticCategory.Error, key: "Overload_signature_is_not_compatible_with_function_implementation_2394", message: "Overload signature is not compatible with function implementation." }, Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local: { code: 2395, category: ts.DiagnosticCategory.Error, key: "Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local_2395", message: "Individual declarations in merged declaration '{0}' must be all exported or all local." }, Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters: { code: 2396, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters_2396", message: "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters." }, + Declaration_name_conflicts_with_built_in_global_identifier_0: { code: 2397, category: ts.DiagnosticCategory.Error, key: "Declaration_name_conflicts_with_built_in_global_identifier_0_2397", message: "Declaration name conflicts with built-in global identifier '{0}'." }, Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference: { code: 2399, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference_2399", message: "Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference." }, Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference: { code: 2400, category: ts.DiagnosticCategory.Error, key: "Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference_2400", message: "Expression resolves to variable declaration '_this' that compiler uses to capture 'this' reference." }, Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference: { code: 2401, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference_2401", message: "Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference." }, @@ -1428,7 +1605,6 @@ var ts; Class_name_cannot_be_0: { code: 2414, category: ts.DiagnosticCategory.Error, key: "Class_name_cannot_be_0_2414", message: "Class name cannot be '{0}'" }, Class_0_incorrectly_extends_base_class_1: { code: 2415, category: ts.DiagnosticCategory.Error, key: "Class_0_incorrectly_extends_base_class_1_2415", message: "Class '{0}' incorrectly extends base class '{1}'." }, Class_static_side_0_incorrectly_extends_base_class_static_side_1: { code: 2417, category: ts.DiagnosticCategory.Error, key: "Class_static_side_0_incorrectly_extends_base_class_static_side_1_2417", message: "Class static side '{0}' incorrectly extends base class static side '{1}'." }, - Type_name_0_in_extends_clause_does_not_reference_constructor_function_for_0: { code: 2419, category: ts.DiagnosticCategory.Error, key: "Type_name_0_in_extends_clause_does_not_reference_constructor_function_for_0_2419", message: "Type name '{0}' in extends clause does not reference constructor function for '{0}'." }, Class_0_incorrectly_implements_interface_1: { code: 2420, category: ts.DiagnosticCategory.Error, key: "Class_0_incorrectly_implements_interface_1_2420", message: "Class '{0}' incorrectly implements interface '{1}'." }, A_class_may_only_implement_another_class_or_interface: { code: 2422, category: ts.DiagnosticCategory.Error, key: "A_class_may_only_implement_another_class_or_interface_2422", message: "A class may only implement another class or interface." }, Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor: { code: 2423, category: ts.DiagnosticCategory.Error, key: "Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_access_2423", message: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor." }, @@ -1436,7 +1612,7 @@ var ts; Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 2425, category: ts.DiagnosticCategory.Error, key: "Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_functi_2425", message: "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function." }, Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 2426, category: ts.DiagnosticCategory.Error, key: "Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_functi_2426", message: "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function." }, Interface_name_cannot_be_0: { code: 2427, category: ts.DiagnosticCategory.Error, key: "Interface_name_cannot_be_0_2427", message: "Interface name cannot be '{0}'" }, - All_declarations_of_an_interface_must_have_identical_type_parameters: { code: 2428, category: ts.DiagnosticCategory.Error, key: "All_declarations_of_an_interface_must_have_identical_type_parameters_2428", message: "All declarations of an interface must have identical type parameters." }, + All_declarations_of_0_must_have_identical_type_parameters: { code: 2428, category: ts.DiagnosticCategory.Error, key: "All_declarations_of_0_must_have_identical_type_parameters_2428", message: "All declarations of '{0}' must have identical type parameters." }, Interface_0_incorrectly_extends_interface_1: { code: 2430, category: ts.DiagnosticCategory.Error, key: "Interface_0_incorrectly_extends_interface_1_2430", message: "Interface '{0}' incorrectly extends interface '{1}'." }, Enum_name_cannot_be_0: { code: 2431, category: ts.DiagnosticCategory.Error, key: "Enum_name_cannot_be_0_2431", message: "Enum name cannot be '{0}'" }, In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element: { code: 2432, category: ts.DiagnosticCategory.Error, key: "In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enu_2432", message: "In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element." }, @@ -1456,11 +1632,12 @@ var ts; Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1: { code: 2446, category: ts.DiagnosticCategory.Error, key: "Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1_2446", message: "Property '{0}' is protected and only accessible through an instance of class '{1}'." }, The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead: { code: 2447, category: ts.DiagnosticCategory.Error, key: "The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead_2447", message: "The '{0}' operator is not allowed for boolean types. Consider using '{1}' instead." }, Block_scoped_variable_0_used_before_its_declaration: { code: 2448, category: ts.DiagnosticCategory.Error, key: "Block_scoped_variable_0_used_before_its_declaration_2448", message: "Block-scoped variable '{0}' used before its declaration." }, - The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant: { code: 2449, category: ts.DiagnosticCategory.Error, key: "The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant_2449", message: "The operand of an increment or decrement operator cannot be a constant." }, - Left_hand_side_of_assignment_expression_cannot_be_a_constant: { code: 2450, category: ts.DiagnosticCategory.Error, key: "Left_hand_side_of_assignment_expression_cannot_be_a_constant_2450", message: "Left-hand side of assignment expression cannot be a constant." }, + The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant_or_a_read_only_property: { code: 2449, category: ts.DiagnosticCategory.Error, key: "The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant_or_a_read_only_property_2449", message: "The operand of an increment or decrement operator cannot be a constant or a read-only property." }, + Left_hand_side_of_assignment_expression_cannot_be_a_constant_or_a_read_only_property: { code: 2450, category: ts.DiagnosticCategory.Error, key: "Left_hand_side_of_assignment_expression_cannot_be_a_constant_or_a_read_only_property_2450", message: "Left-hand side of assignment expression cannot be a constant or a read-only property." }, Cannot_redeclare_block_scoped_variable_0: { code: 2451, category: ts.DiagnosticCategory.Error, key: "Cannot_redeclare_block_scoped_variable_0_2451", message: "Cannot redeclare block-scoped variable '{0}'." }, An_enum_member_cannot_have_a_numeric_name: { code: 2452, category: ts.DiagnosticCategory.Error, key: "An_enum_member_cannot_have_a_numeric_name_2452", message: "An enum member cannot have a numeric name." }, The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly: { code: 2453, category: ts.DiagnosticCategory.Error, key: "The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_typ_2453", message: "The type argument for type parameter '{0}' cannot be inferred from the usage. Consider specifying the type arguments explicitly." }, + Variable_0_is_used_before_being_assigned: { code: 2454, category: ts.DiagnosticCategory.Error, key: "Variable_0_is_used_before_being_assigned_2454", message: "Variable '{0}' is used before being assigned." }, Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0: { code: 2455, category: ts.DiagnosticCategory.Error, key: "Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0_2455", message: "Type argument candidate '{1}' is not a valid type argument because it is not a supertype of candidate '{0}'." }, Type_alias_0_circularly_references_itself: { code: 2456, category: ts.DiagnosticCategory.Error, key: "Type_alias_0_circularly_references_itself_2456", message: "Type alias '{0}' circularly references itself." }, Type_alias_name_cannot_be_0: { code: 2457, category: ts.DiagnosticCategory.Error, key: "Type_alias_name_cannot_be_0_2457", message: "Type alias name cannot be '{0}'" }, @@ -1490,8 +1667,8 @@ var ts; Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1: { code: 2481, category: ts.DiagnosticCategory.Error, key: "Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1_2481", message: "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'." }, The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation: { code: 2483, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation_2483", message: "The left-hand side of a 'for...of' statement cannot use a type annotation." }, Export_declaration_conflicts_with_exported_declaration_of_0: { code: 2484, category: ts.DiagnosticCategory.Error, key: "Export_declaration_conflicts_with_exported_declaration_of_0_2484", message: "Export declaration conflicts with exported declaration of '{0}'" }, - The_left_hand_side_of_a_for_of_statement_cannot_be_a_previously_defined_constant: { code: 2485, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_of_statement_cannot_be_a_previously_defined_constant_2485", message: "The left-hand side of a 'for...of' statement cannot be a previously defined constant." }, - The_left_hand_side_of_a_for_in_statement_cannot_be_a_previously_defined_constant: { code: 2486, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_in_statement_cannot_be_a_previously_defined_constant_2486", message: "The left-hand side of a 'for...in' statement cannot be a previously defined constant." }, + The_left_hand_side_of_a_for_of_statement_cannot_be_a_constant_or_a_read_only_property: { code: 2485, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_of_statement_cannot_be_a_constant_or_a_read_only_property_2485", message: "The left-hand side of a 'for...of' statement cannot be a constant or a read-only property." }, + The_left_hand_side_of_a_for_in_statement_cannot_be_a_constant_or_a_read_only_property: { code: 2486, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_in_statement_cannot_be_a_constant_or_a_read_only_property_2486", message: "The left-hand side of a 'for...in' statement cannot be a constant or a read-only property." }, Invalid_left_hand_side_in_for_of_statement: { code: 2487, category: ts.DiagnosticCategory.Error, key: "Invalid_left_hand_side_in_for_of_statement_2487", message: "Invalid left-hand side in 'for...of' statement." }, Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator: { code: 2488, category: ts.DiagnosticCategory.Error, key: "Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator_2488", message: "Type must have a '[Symbol.iterator]()' method that returns an iterator." }, An_iterator_must_have_a_next_method: { code: 2489, category: ts.DiagnosticCategory.Error, key: "An_iterator_must_have_a_next_method_2489", message: "An iterator must have a 'next()' method." }, @@ -1517,12 +1694,13 @@ var ts; Base_constructor_return_type_0_is_not_a_class_or_interface_type: { code: 2509, category: ts.DiagnosticCategory.Error, key: "Base_constructor_return_type_0_is_not_a_class_or_interface_type_2509", message: "Base constructor return type '{0}' is not a class or interface type." }, Base_constructors_must_all_have_the_same_return_type: { code: 2510, category: ts.DiagnosticCategory.Error, key: "Base_constructors_must_all_have_the_same_return_type_2510", message: "Base constructors must all have the same return type." }, Cannot_create_an_instance_of_the_abstract_class_0: { code: 2511, category: ts.DiagnosticCategory.Error, key: "Cannot_create_an_instance_of_the_abstract_class_0_2511", message: "Cannot create an instance of the abstract class '{0}'." }, - Overload_signatures_must_all_be_abstract_or_not_abstract: { code: 2512, category: ts.DiagnosticCategory.Error, key: "Overload_signatures_must_all_be_abstract_or_not_abstract_2512", message: "Overload signatures must all be abstract or not abstract." }, + Overload_signatures_must_all_be_abstract_or_non_abstract: { code: 2512, category: ts.DiagnosticCategory.Error, key: "Overload_signatures_must_all_be_abstract_or_non_abstract_2512", message: "Overload signatures must all be abstract or non-abstract." }, Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression: { code: 2513, category: ts.DiagnosticCategory.Error, key: "Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression_2513", message: "Abstract method '{0}' in class '{1}' cannot be accessed via super expression." }, Classes_containing_abstract_methods_must_be_marked_abstract: { code: 2514, category: ts.DiagnosticCategory.Error, key: "Classes_containing_abstract_methods_must_be_marked_abstract_2514", message: "Classes containing abstract methods must be marked abstract." }, Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2: { code: 2515, category: ts.DiagnosticCategory.Error, key: "Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2_2515", message: "Non-abstract class '{0}' does not implement inherited abstract member '{1}' from class '{2}'." }, All_declarations_of_an_abstract_method_must_be_consecutive: { code: 2516, category: ts.DiagnosticCategory.Error, key: "All_declarations_of_an_abstract_method_must_be_consecutive_2516", message: "All declarations of an abstract method must be consecutive." }, Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type: { code: 2517, category: ts.DiagnosticCategory.Error, key: "Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type_2517", message: "Cannot assign an abstract constructor type to a non-abstract constructor type." }, + A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard: { code: 2518, category: ts.DiagnosticCategory.Error, key: "A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard_2518", message: "A 'this'-based type guard is not compatible with a parameter-based type guard." }, Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions: { code: 2520, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions_2520", message: "Duplicate identifier '{0}'. Compiler uses declaration '{1}' to support async functions." }, Expression_resolves_to_variable_declaration_0_that_compiler_uses_to_support_async_functions: { code: 2521, category: ts.DiagnosticCategory.Error, key: "Expression_resolves_to_variable_declaration_0_that_compiler_uses_to_support_async_functions_2521", message: "Expression resolves to variable declaration '{0}' that compiler uses to support async functions." }, The_arguments_object_cannot_be_referenced_in_an_async_arrow_function_Consider_using_a_standard_async_function_expression: { code: 2522, category: ts.DiagnosticCategory.Error, key: "The_arguments_object_cannot_be_referenced_in_an_async_arrow_function_Consider_using_a_standard_async_2522", message: "The 'arguments' object cannot be referenced in an async arrow function. Consider using a standard async function expression." }, @@ -1532,7 +1710,13 @@ var ts; A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface: { code: 2526, category: ts.DiagnosticCategory.Error, key: "A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface_2526", message: "A 'this' type is available only in a non-static member of a class or interface." }, The_inferred_type_of_0_references_an_inaccessible_this_type_A_type_annotation_is_necessary: { code: 2527, category: ts.DiagnosticCategory.Error, key: "The_inferred_type_of_0_references_an_inaccessible_this_type_A_type_annotation_is_necessary_2527", message: "The inferred type of '{0}' references an inaccessible 'this' type. A type annotation is necessary." }, A_module_cannot_have_multiple_default_exports: { code: 2528, category: ts.DiagnosticCategory.Error, key: "A_module_cannot_have_multiple_default_exports_2528", message: "A module cannot have multiple default exports." }, - JSX_element_attributes_type_0_must_be_an_object_type: { code: 2600, category: ts.DiagnosticCategory.Error, key: "JSX_element_attributes_type_0_must_be_an_object_type_2600", message: "JSX element attributes type '{0}' must be an object type." }, + Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions: { code: 2529, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_func_2529", message: "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of a module containing async functions." }, + Property_0_is_incompatible_with_index_signature: { code: 2530, category: ts.DiagnosticCategory.Error, key: "Property_0_is_incompatible_with_index_signature_2530", message: "Property '{0}' is incompatible with index signature." }, + Object_is_possibly_null: { code: 2531, category: ts.DiagnosticCategory.Error, key: "Object_is_possibly_null_2531", message: "Object is possibly 'null'." }, + Object_is_possibly_undefined: { code: 2532, category: ts.DiagnosticCategory.Error, key: "Object_is_possibly_undefined_2532", message: "Object is possibly 'undefined'." }, + Object_is_possibly_null_or_undefined: { code: 2533, category: ts.DiagnosticCategory.Error, key: "Object_is_possibly_null_or_undefined_2533", message: "Object is possibly 'null' or 'undefined'." }, + A_function_returning_never_cannot_have_a_reachable_end_point: { code: 2534, category: ts.DiagnosticCategory.Error, key: "A_function_returning_never_cannot_have_a_reachable_end_point_2534", message: "A function returning 'never' cannot have a reachable end point." }, + JSX_element_attributes_type_0_may_not_be_a_union_type: { code: 2600, category: ts.DiagnosticCategory.Error, key: "JSX_element_attributes_type_0_may_not_be_a_union_type_2600", message: "JSX element attributes type '{0}' may not be a union type." }, The_return_type_of_a_JSX_element_constructor_must_return_an_object_type: { code: 2601, category: ts.DiagnosticCategory.Error, key: "The_return_type_of_a_JSX_element_constructor_must_return_an_object_type_2601", message: "The return type of a JSX element constructor must return an object type." }, JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist: { code: 2602, category: ts.DiagnosticCategory.Error, key: "JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist_2602", message: "JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist." }, Property_0_in_type_1_is_not_assignable_to_type_2: { code: 2603, category: ts.DiagnosticCategory.Error, key: "Property_0_in_type_1_is_not_assignable_to_type_2_2603", message: "Property '{0}' in type '{1}' is not assignable to type '{2}'" }, @@ -1548,6 +1732,33 @@ var ts; Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_package_author_to_update_the_package_definition: { code: 2654, category: ts.DiagnosticCategory.Error, key: "Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_pack_2654", message: "Exported external package typings file cannot contain tripleslash references. Please contact the package author to update the package definition." }, Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_the_package_definition: { code: 2656, category: ts.DiagnosticCategory.Error, key: "Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_2656", message: "Exported external package typings file '{0}' is not a module. Please contact the package author to update the package definition." }, JSX_expressions_must_have_one_parent_element: { code: 2657, category: ts.DiagnosticCategory.Error, key: "JSX_expressions_must_have_one_parent_element_2657", message: "JSX expressions must have one parent element" }, + Type_0_provides_no_match_for_the_signature_1: { code: 2658, category: ts.DiagnosticCategory.Error, key: "Type_0_provides_no_match_for_the_signature_1_2658", message: "Type '{0}' provides no match for the signature '{1}'" }, + super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher: { code: 2659, category: ts.DiagnosticCategory.Error, key: "super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_highe_2659", message: "'super' is only allowed in members of object literal expressions when option 'target' is 'ES2015' or higher." }, + super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions: { code: 2660, category: ts.DiagnosticCategory.Error, key: "super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions_2660", message: "'super' can only be referenced in members of derived classes or object literal expressions." }, + Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module: { code: 2661, category: ts.DiagnosticCategory.Error, key: "Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module_2661", message: "Cannot export '{0}'. Only local declarations can be exported from a module." }, + Cannot_find_name_0_Did_you_mean_the_static_member_1_0: { code: 2662, category: ts.DiagnosticCategory.Error, key: "Cannot_find_name_0_Did_you_mean_the_static_member_1_0_2662", message: "Cannot find name '{0}'. Did you mean the static member '{1}.{0}'?" }, + Cannot_find_name_0_Did_you_mean_the_instance_member_this_0: { code: 2663, category: ts.DiagnosticCategory.Error, key: "Cannot_find_name_0_Did_you_mean_the_instance_member_this_0_2663", message: "Cannot find name '{0}'. Did you mean the instance member 'this.{0}'?" }, + Invalid_module_name_in_augmentation_module_0_cannot_be_found: { code: 2664, category: ts.DiagnosticCategory.Error, key: "Invalid_module_name_in_augmentation_module_0_cannot_be_found_2664", message: "Invalid module name in augmentation, module '{0}' cannot be found." }, + Exports_and_export_assignments_are_not_permitted_in_module_augmentations: { code: 2666, category: ts.DiagnosticCategory.Error, key: "Exports_and_export_assignments_are_not_permitted_in_module_augmentations_2666", message: "Exports and export assignments are not permitted in module augmentations." }, + Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module: { code: 2667, category: ts.DiagnosticCategory.Error, key: "Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_mod_2667", message: "Imports are not permitted in module augmentations. Consider moving them to the enclosing external module." }, + export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always_visible: { code: 2668, category: ts.DiagnosticCategory.Error, key: "export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always__2668", message: "'export' modifier cannot be applied to ambient modules and module augmentations since they are always visible." }, + Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_declarations: { code: 2669, category: ts.DiagnosticCategory.Error, key: "Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_2669", message: "Augmentations for the global scope can only be directly nested in external modules or ambient module declarations." }, + Augmentations_for_the_global_scope_should_have_declare_modifier_unless_they_appear_in_already_ambient_context: { code: 2670, category: ts.DiagnosticCategory.Error, key: "Augmentations_for_the_global_scope_should_have_declare_modifier_unless_they_appear_in_already_ambien_2670", message: "Augmentations for the global scope should have 'declare' modifier unless they appear in already ambient context." }, + Cannot_augment_module_0_because_it_resolves_to_a_non_module_entity: { code: 2671, category: ts.DiagnosticCategory.Error, key: "Cannot_augment_module_0_because_it_resolves_to_a_non_module_entity_2671", message: "Cannot augment module '{0}' because it resolves to a non-module entity." }, + Cannot_assign_a_0_constructor_type_to_a_1_constructor_type: { code: 2672, category: ts.DiagnosticCategory.Error, key: "Cannot_assign_a_0_constructor_type_to_a_1_constructor_type_2672", message: "Cannot assign a '{0}' constructor type to a '{1}' constructor type." }, + Constructor_of_class_0_is_private_and_only_accessible_within_the_class_declaration: { code: 2673, category: ts.DiagnosticCategory.Error, key: "Constructor_of_class_0_is_private_and_only_accessible_within_the_class_declaration_2673", message: "Constructor of class '{0}' is private and only accessible within the class declaration." }, + Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration: { code: 2674, category: ts.DiagnosticCategory.Error, key: "Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration_2674", message: "Constructor of class '{0}' is protected and only accessible within the class declaration." }, + Cannot_extend_a_class_0_Class_constructor_is_marked_as_private: { code: 2675, category: ts.DiagnosticCategory.Error, key: "Cannot_extend_a_class_0_Class_constructor_is_marked_as_private_2675", message: "Cannot extend a class '{0}'. Class constructor is marked as private." }, + Accessors_must_both_be_abstract_or_non_abstract: { code: 2676, category: ts.DiagnosticCategory.Error, key: "Accessors_must_both_be_abstract_or_non_abstract_2676", message: "Accessors must both be abstract or non-abstract." }, + A_type_predicate_s_type_must_be_assignable_to_its_parameter_s_type: { code: 2677, category: ts.DiagnosticCategory.Error, key: "A_type_predicate_s_type_must_be_assignable_to_its_parameter_s_type_2677", message: "A type predicate's type must be assignable to its parameter's type." }, + Type_0_is_not_comparable_to_type_1: { code: 2678, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_comparable_to_type_1_2678", message: "Type '{0}' is not comparable to type '{1}'." }, + A_function_that_is_called_with_the_new_keyword_cannot_have_a_this_type_that_is_void: { code: 2679, category: ts.DiagnosticCategory.Error, key: "A_function_that_is_called_with_the_new_keyword_cannot_have_a_this_type_that_is_void_2679", message: "A function that is called with the 'new' keyword cannot have a 'this' type that is 'void'." }, + A_this_parameter_must_be_the_first_parameter: { code: 2680, category: ts.DiagnosticCategory.Error, key: "A_this_parameter_must_be_the_first_parameter_2680", message: "A 'this' parameter must be the first parameter." }, + A_constructor_cannot_have_a_this_parameter: { code: 2681, category: ts.DiagnosticCategory.Error, key: "A_constructor_cannot_have_a_this_parameter_2681", message: "A constructor cannot have a 'this' parameter." }, + get_and_set_accessor_must_have_the_same_this_type: { code: 2682, category: ts.DiagnosticCategory.Error, key: "get_and_set_accessor_must_have_the_same_this_type_2682", message: "'get' and 'set' accessor must have the same 'this' type." }, + this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation: { code: 2683, category: ts.DiagnosticCategory.Error, key: "this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_2683", message: "'this' implicitly has type 'any' because it does not have a type annotation." }, + The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1: { code: 2684, category: ts.DiagnosticCategory.Error, key: "The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1_2684", message: "The 'this' context of type '{0}' is not assignable to method's 'this' of type '{1}'." }, + The_this_types_of_each_signature_are_incompatible: { code: 2685, category: ts.DiagnosticCategory.Error, key: "The_this_types_of_each_signature_are_incompatible_2685", message: "The 'this' types of each signature are incompatible." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import_declaration_0_is_using_private_name_1_4000", message: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", message: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", message: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, @@ -1618,6 +1829,7 @@ var ts; Parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4078, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_exported_function_has_or_is_using_private_name_1_4078", message: "Parameter '{0}' of exported function has or is using private name '{1}'." }, Exported_type_alias_0_has_or_is_using_private_name_1: { code: 4081, category: ts.DiagnosticCategory.Error, key: "Exported_type_alias_0_has_or_is_using_private_name_1_4081", message: "Exported type alias '{0}' has or is using private name '{1}'." }, Default_export_of_the_module_has_or_is_using_private_name_0: { code: 4082, category: ts.DiagnosticCategory.Error, key: "Default_export_of_the_module_has_or_is_using_private_name_0_4082", message: "Default export of the module has or is using private name '{0}'." }, + Conflicting_library_definitions_for_0_found_at_1_and_2_Copy_the_correct_file_to_the_typings_folder_to_resolve_this_conflict: { code: 4090, category: ts.DiagnosticCategory.Message, key: "Conflicting_library_definitions_for_0_found_at_1_and_2_Copy_the_correct_file_to_the_typings_folder_t_4090", message: "Conflicting library definitions for '{0}' found at '{1}' and '{2}'. Copy the correct file to the 'typings' folder to resolve this conflict." }, The_current_host_does_not_support_the_0_option: { code: 5001, category: ts.DiagnosticCategory.Error, key: "The_current_host_does_not_support_the_0_option_5001", message: "The current host does not support the '{0}' option." }, Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: ts.DiagnosticCategory.Error, key: "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", message: "Cannot find the common subdirectory path for the input files." }, Cannot_read_file_0_Colon_1: { code: 5012, category: ts.DiagnosticCategory.Error, key: "Cannot_read_file_0_Colon_1_5012", message: "Cannot read file '{0}': {1}" }, @@ -1632,17 +1844,28 @@ var ts; Option_0_cannot_be_specified_without_specifying_option_1: { code: 5052, category: ts.DiagnosticCategory.Error, key: "Option_0_cannot_be_specified_without_specifying_option_1_5052", message: "Option '{0}' cannot be specified without specifying option '{1}'." }, Option_0_cannot_be_specified_with_option_1: { code: 5053, category: ts.DiagnosticCategory.Error, key: "Option_0_cannot_be_specified_with_option_1_5053", message: "Option '{0}' cannot be specified with option '{1}'." }, A_tsconfig_json_file_is_already_defined_at_Colon_0: { code: 5054, category: ts.DiagnosticCategory.Error, key: "A_tsconfig_json_file_is_already_defined_at_Colon_0_5054", message: "A 'tsconfig.json' file is already defined at: '{0}'." }, + Cannot_write_file_0_because_it_would_overwrite_input_file: { code: 5055, category: ts.DiagnosticCategory.Error, key: "Cannot_write_file_0_because_it_would_overwrite_input_file_5055", message: "Cannot write file '{0}' because it would overwrite input file." }, + Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files: { code: 5056, category: ts.DiagnosticCategory.Error, key: "Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files_5056", message: "Cannot write file '{0}' because it would be overwritten by multiple input files." }, + Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0: { code: 5057, category: ts.DiagnosticCategory.Error, key: "Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0_5057", message: "Cannot find a tsconfig.json file at the specified directory: '{0}'" }, + The_specified_path_does_not_exist_Colon_0: { code: 5058, category: ts.DiagnosticCategory.Error, key: "The_specified_path_does_not_exist_Colon_0_5058", message: "The specified path does not exist: '{0}'" }, + Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier: { code: 5059, category: ts.DiagnosticCategory.Error, key: "Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier_5059", message: "Invalid value for '--reactNamespace'. '{0}' is not a valid identifier." }, + Option_paths_cannot_be_used_without_specifying_baseUrl_option: { code: 5060, category: ts.DiagnosticCategory.Error, key: "Option_paths_cannot_be_used_without_specifying_baseUrl_option_5060", message: "Option 'paths' cannot be used without specifying '--baseUrl' option." }, + Pattern_0_can_have_at_most_one_Asterisk_character: { code: 5061, category: ts.DiagnosticCategory.Error, key: "Pattern_0_can_have_at_most_one_Asterisk_character_5061", message: "Pattern '{0}' can have at most one '*' character" }, + Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character: { code: 5062, category: ts.DiagnosticCategory.Error, key: "Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character_5062", message: "Substitution '{0}' in pattern '{1}' in can have at most one '*' character" }, + Substututions_for_pattern_0_should_be_an_array: { code: 5063, category: ts.DiagnosticCategory.Error, key: "Substututions_for_pattern_0_should_be_an_array_5063", message: "Substututions for pattern '{0}' should be an array." }, + Substitution_0_for_pattern_1_has_incorrect_type_expected_string_got_2: { code: 5064, category: ts.DiagnosticCategory.Error, key: "Substitution_0_for_pattern_1_has_incorrect_type_expected_string_got_2_5064", message: "Substitution '{0}' for pattern '{1}' has incorrect type, expected 'string', got '{2}'." }, Concatenate_and_emit_output_to_single_file: { code: 6001, category: ts.DiagnosticCategory.Message, key: "Concatenate_and_emit_output_to_single_file_6001", message: "Concatenate and emit output to single file." }, Generates_corresponding_d_ts_file: { code: 6002, category: ts.DiagnosticCategory.Message, key: "Generates_corresponding_d_ts_file_6002", message: "Generates corresponding '.d.ts' file." }, - Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { code: 6003, category: ts.DiagnosticCategory.Message, key: "Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations_6003", message: "Specifies the location where debugger should locate map files instead of generated locations." }, - Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations: { code: 6004, category: ts.DiagnosticCategory.Message, key: "Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations_6004", message: "Specifies the location where debugger should locate TypeScript files instead of source locations." }, + Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { code: 6003, category: ts.DiagnosticCategory.Message, key: "Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations_6003", message: "Specify the location where debugger should locate map files instead of generated locations." }, + Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations: { code: 6004, category: ts.DiagnosticCategory.Message, key: "Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations_6004", message: "Specify the location where debugger should locate TypeScript files instead of source locations." }, Watch_input_files: { code: 6005, category: ts.DiagnosticCategory.Message, key: "Watch_input_files_6005", message: "Watch input files." }, Redirect_output_structure_to_the_directory: { code: 6006, category: ts.DiagnosticCategory.Message, key: "Redirect_output_structure_to_the_directory_6006", message: "Redirect output structure to the directory." }, Do_not_erase_const_enum_declarations_in_generated_code: { code: 6007, category: ts.DiagnosticCategory.Message, key: "Do_not_erase_const_enum_declarations_in_generated_code_6007", message: "Do not erase const enum declarations in generated code." }, Do_not_emit_outputs_if_any_errors_were_reported: { code: 6008, category: ts.DiagnosticCategory.Message, key: "Do_not_emit_outputs_if_any_errors_were_reported_6008", message: "Do not emit outputs if any errors were reported." }, Do_not_emit_comments_to_output: { code: 6009, category: ts.DiagnosticCategory.Message, key: "Do_not_emit_comments_to_output_6009", message: "Do not emit comments to output." }, Do_not_emit_outputs: { code: 6010, category: ts.DiagnosticCategory.Message, key: "Do_not_emit_outputs_6010", message: "Do not emit outputs." }, - Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015_experimental: { code: 6015, category: ts.DiagnosticCategory.Message, key: "Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015_experimental_6015", message: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES2015' (experimental)" }, + Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typechecking: { code: 6011, category: ts.DiagnosticCategory.Message, key: "Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typech_6011", message: "Allow default imports from modules with no default export. This does not affect code emit, just typechecking." }, + Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015: { code: 6015, category: ts.DiagnosticCategory.Message, key: "Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015_6015", message: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES2015'" }, Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015: { code: 6016, category: ts.DiagnosticCategory.Message, key: "Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015_6016", message: "Specify module code generation: 'commonjs', 'amd', 'system', 'umd' or 'es2015'" }, Print_this_message: { code: 6017, category: ts.DiagnosticCategory.Message, key: "Print_this_message_6017", message: "Print this message." }, Print_the_compiler_s_version: { code: 6019, category: ts.DiagnosticCategory.Message, key: "Print_the_compiler_s_version_6019", message: "Print the compiler's version." }, @@ -1664,8 +1887,7 @@ var ts; Generates_corresponding_map_file: { code: 6043, category: ts.DiagnosticCategory.Message, key: "Generates_corresponding_map_file_6043", message: "Generates corresponding '.map' file." }, Compiler_option_0_expects_an_argument: { code: 6044, category: ts.DiagnosticCategory.Error, key: "Compiler_option_0_expects_an_argument_6044", message: "Compiler option '{0}' expects an argument." }, Unterminated_quoted_string_in_response_file_0: { code: 6045, category: ts.DiagnosticCategory.Error, key: "Unterminated_quoted_string_in_response_file_0_6045", message: "Unterminated quoted string in response file '{0}'." }, - Argument_for_module_option_must_be_commonjs_amd_system_umd_or_es2015: { code: 6046, category: ts.DiagnosticCategory.Error, key: "Argument_for_module_option_must_be_commonjs_amd_system_umd_or_es2015_6046", message: "Argument for '--module' option must be 'commonjs', 'amd', 'system', 'umd', or 'es2015'." }, - Argument_for_target_option_must_be_ES3_ES5_or_ES2015: { code: 6047, category: ts.DiagnosticCategory.Error, key: "Argument_for_target_option_must_be_ES3_ES5_or_ES2015_6047", message: "Argument for '--target' option must be 'ES3', 'ES5', or 'ES2015'." }, + Argument_for_0_option_must_be_Colon_1: { code: 6046, category: ts.DiagnosticCategory.Error, key: "Argument_for_0_option_must_be_Colon_1_6046", message: "Argument for '{0}' option must be: {1}" }, Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: { code: 6048, category: ts.DiagnosticCategory.Error, key: "Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1_6048", message: "Locale must be of the form or -. For example '{0}' or '{1}'." }, Unsupported_locale_0: { code: 6049, category: ts.DiagnosticCategory.Error, key: "Unsupported_locale_0_6049", message: "Unsupported locale '{0}'." }, Unable_to_open_file_0: { code: 6050, category: ts.DiagnosticCategory.Error, key: "Unable_to_open_file_0_6050", message: "Unable to open file '{0}'." }, @@ -1675,16 +1897,15 @@ var ts; File_0_has_unsupported_extension_The_only_supported_extensions_are_1: { code: 6054, category: ts.DiagnosticCategory.Error, key: "File_0_has_unsupported_extension_The_only_supported_extensions_are_1_6054", message: "File '{0}' has unsupported extension. The only supported extensions are {1}." }, Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures: { code: 6055, category: ts.DiagnosticCategory.Message, key: "Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures_6055", message: "Suppress noImplicitAny errors for indexing objects lacking index signatures." }, Do_not_emit_declarations_for_code_that_has_an_internal_annotation: { code: 6056, category: ts.DiagnosticCategory.Message, key: "Do_not_emit_declarations_for_code_that_has_an_internal_annotation_6056", message: "Do not emit declarations for code that has an '@internal' annotation." }, - Specifies_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir: { code: 6058, category: ts.DiagnosticCategory.Message, key: "Specifies_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDi_6058", message: "Specifies the root directory of input files. Use to control the output directory structure with --outDir." }, + Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir: { code: 6058, category: ts.DiagnosticCategory.Message, key: "Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir_6058", message: "Specify the root directory of input files. Use to control the output directory structure with --outDir." }, File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files: { code: 6059, category: ts.DiagnosticCategory.Error, key: "File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files_6059", message: "File '{0}' is not under 'rootDir' '{1}'. 'rootDir' is expected to contain all source files." }, - Specifies_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix: { code: 6060, category: ts.DiagnosticCategory.Message, key: "Specifies_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix_6060", message: "Specifies the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix)." }, + Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix: { code: 6060, category: ts.DiagnosticCategory.Message, key: "Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix_6060", message: "Specify the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix)." }, NEWLINE: { code: 6061, category: ts.DiagnosticCategory.Message, key: "NEWLINE_6061", message: "NEWLINE" }, - Argument_for_newLine_option_must_be_CRLF_or_LF: { code: 6062, category: ts.DiagnosticCategory.Error, key: "Argument_for_newLine_option_must_be_CRLF_or_LF_6062", message: "Argument for '--newLine' option must be 'CRLF' or 'LF'." }, - Argument_for_moduleResolution_option_must_be_node_or_classic: { code: 6063, category: ts.DiagnosticCategory.Error, key: "Argument_for_moduleResolution_option_must_be_node_or_classic_6063", message: "Argument for '--moduleResolution' option must be 'node' or 'classic'." }, + Option_0_can_only_be_specified_in_tsconfig_json_file: { code: 6064, category: ts.DiagnosticCategory.Error, key: "Option_0_can_only_be_specified_in_tsconfig_json_file_6064", message: "Option '{0}' can only be specified in 'tsconfig.json' file." }, Enables_experimental_support_for_ES7_decorators: { code: 6065, category: ts.DiagnosticCategory.Message, key: "Enables_experimental_support_for_ES7_decorators_6065", message: "Enables experimental support for ES7 decorators." }, Enables_experimental_support_for_emitting_type_metadata_for_decorators: { code: 6066, category: ts.DiagnosticCategory.Message, key: "Enables_experimental_support_for_emitting_type_metadata_for_decorators_6066", message: "Enables experimental support for emitting type metadata for decorators." }, Enables_experimental_support_for_ES7_async_functions: { code: 6068, category: ts.DiagnosticCategory.Message, key: "Enables_experimental_support_for_ES7_async_functions_6068", message: "Enables experimental support for ES7 async functions." }, - Specifies_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6: { code: 6069, category: ts.DiagnosticCategory.Message, key: "Specifies_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6_6069", message: "Specifies module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6)." }, + Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6: { code: 6069, category: ts.DiagnosticCategory.Message, key: "Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6_6069", message: "Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6)." }, Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file: { code: 6070, category: ts.DiagnosticCategory.Message, key: "Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file_6070", message: "Initializes a TypeScript project and creates a tsconfig.json file." }, Successfully_created_a_tsconfig_json_file: { code: 6071, category: ts.DiagnosticCategory.Message, key: "Successfully_created_a_tsconfig_json_file_6071", message: "Successfully created a tsconfig.json file." }, Suppress_excess_property_checks_for_object_literals: { code: 6072, category: ts.DiagnosticCategory.Message, key: "Suppress_excess_property_checks_for_object_literals_6072", message: "Suppress excess property checks for object literals." }, @@ -1694,9 +1915,57 @@ var ts; Report_errors_for_fallthrough_cases_in_switch_statement: { code: 6076, category: ts.DiagnosticCategory.Message, key: "Report_errors_for_fallthrough_cases_in_switch_statement_6076", message: "Report errors for fallthrough cases in switch statement." }, Do_not_report_errors_on_unreachable_code: { code: 6077, category: ts.DiagnosticCategory.Message, key: "Do_not_report_errors_on_unreachable_code_6077", message: "Do not report errors on unreachable code." }, Disallow_inconsistently_cased_references_to_the_same_file: { code: 6078, category: ts.DiagnosticCategory.Message, key: "Disallow_inconsistently_cased_references_to_the_same_file_6078", message: "Disallow inconsistently-cased references to the same file." }, + Specify_library_files_to_be_included_in_the_compilation_Colon: { code: 6079, category: ts.DiagnosticCategory.Message, key: "Specify_library_files_to_be_included_in_the_compilation_Colon_6079", message: "Specify library files to be included in the compilation: " }, Specify_JSX_code_generation_Colon_preserve_or_react: { code: 6080, category: ts.DiagnosticCategory.Message, key: "Specify_JSX_code_generation_Colon_preserve_or_react_6080", message: "Specify JSX code generation: 'preserve' or 'react'" }, - Argument_for_jsx_must_be_preserve_or_react: { code: 6081, category: ts.DiagnosticCategory.Message, key: "Argument_for_jsx_must_be_preserve_or_react_6081", message: "Argument for '--jsx' must be 'preserve' or 'react'." }, Only_amd_and_system_modules_are_supported_alongside_0: { code: 6082, category: ts.DiagnosticCategory.Error, key: "Only_amd_and_system_modules_are_supported_alongside_0_6082", message: "Only 'amd' and 'system' modules are supported alongside --{0}." }, + Base_directory_to_resolve_non_absolute_module_names: { code: 6083, category: ts.DiagnosticCategory.Message, key: "Base_directory_to_resolve_non_absolute_module_names_6083", message: "Base directory to resolve non-absolute module names." }, + Specify_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit: { code: 6084, category: ts.DiagnosticCategory.Message, key: "Specify_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit_6084", message: "Specify the object invoked for createElement and __spread when targeting 'react' JSX emit" }, + Enable_tracing_of_the_name_resolution_process: { code: 6085, category: ts.DiagnosticCategory.Message, key: "Enable_tracing_of_the_name_resolution_process_6085", message: "Enable tracing of the name resolution process." }, + Resolving_module_0_from_1: { code: 6086, category: ts.DiagnosticCategory.Message, key: "Resolving_module_0_from_1_6086", message: "======== Resolving module '{0}' from '{1}'. ========" }, + Explicitly_specified_module_resolution_kind_Colon_0: { code: 6087, category: ts.DiagnosticCategory.Message, key: "Explicitly_specified_module_resolution_kind_Colon_0_6087", message: "Explicitly specified module resolution kind: '{0}'." }, + Module_resolution_kind_is_not_specified_using_0: { code: 6088, category: ts.DiagnosticCategory.Message, key: "Module_resolution_kind_is_not_specified_using_0_6088", message: "Module resolution kind is not specified, using '{0}'." }, + Module_name_0_was_successfully_resolved_to_1: { code: 6089, category: ts.DiagnosticCategory.Message, key: "Module_name_0_was_successfully_resolved_to_1_6089", message: "======== Module name '{0}' was successfully resolved to '{1}'. ========" }, + Module_name_0_was_not_resolved: { code: 6090, category: ts.DiagnosticCategory.Message, key: "Module_name_0_was_not_resolved_6090", message: "======== Module name '{0}' was not resolved. ========" }, + paths_option_is_specified_looking_for_a_pattern_to_match_module_name_0: { code: 6091, category: ts.DiagnosticCategory.Message, key: "paths_option_is_specified_looking_for_a_pattern_to_match_module_name_0_6091", message: "'paths' option is specified, looking for a pattern to match module name '{0}'." }, + Module_name_0_matched_pattern_1: { code: 6092, category: ts.DiagnosticCategory.Message, key: "Module_name_0_matched_pattern_1_6092", message: "Module name '{0}', matched pattern '{1}'." }, + Trying_substitution_0_candidate_module_location_Colon_1: { code: 6093, category: ts.DiagnosticCategory.Message, key: "Trying_substitution_0_candidate_module_location_Colon_1_6093", message: "Trying substitution '{0}', candidate module location: '{1}'." }, + Resolving_module_name_0_relative_to_base_url_1_2: { code: 6094, category: ts.DiagnosticCategory.Message, key: "Resolving_module_name_0_relative_to_base_url_1_2_6094", message: "Resolving module name '{0}' relative to base url '{1}' - '{2}'." }, + Loading_module_as_file_Slash_folder_candidate_module_location_0: { code: 6095, category: ts.DiagnosticCategory.Message, key: "Loading_module_as_file_Slash_folder_candidate_module_location_0_6095", message: "Loading module as file / folder, candidate module location '{0}'." }, + File_0_does_not_exist: { code: 6096, category: ts.DiagnosticCategory.Message, key: "File_0_does_not_exist_6096", message: "File '{0}' does not exist." }, + File_0_exist_use_it_as_a_name_resolution_result: { code: 6097, category: ts.DiagnosticCategory.Message, key: "File_0_exist_use_it_as_a_name_resolution_result_6097", message: "File '{0}' exist - use it as a name resolution result." }, + Loading_module_0_from_node_modules_folder: { code: 6098, category: ts.DiagnosticCategory.Message, key: "Loading_module_0_from_node_modules_folder_6098", message: "Loading module '{0}' from 'node_modules' folder." }, + Found_package_json_at_0: { code: 6099, category: ts.DiagnosticCategory.Message, key: "Found_package_json_at_0_6099", message: "Found 'package.json' at '{0}'." }, + package_json_does_not_have_types_field: { code: 6100, category: ts.DiagnosticCategory.Message, key: "package_json_does_not_have_types_field_6100", message: "'package.json' does not have 'types' field." }, + package_json_has_0_field_1_that_references_2: { code: 6101, category: ts.DiagnosticCategory.Message, key: "package_json_has_0_field_1_that_references_2_6101", message: "'package.json' has '{0}' field '{1}' that references '{2}'." }, + Allow_javascript_files_to_be_compiled: { code: 6102, category: ts.DiagnosticCategory.Message, key: "Allow_javascript_files_to_be_compiled_6102", message: "Allow javascript files to be compiled." }, + Option_0_should_have_array_of_strings_as_a_value: { code: 6103, category: ts.DiagnosticCategory.Error, key: "Option_0_should_have_array_of_strings_as_a_value_6103", message: "Option '{0}' should have array of strings as a value." }, + Checking_if_0_is_the_longest_matching_prefix_for_1_2: { code: 6104, category: ts.DiagnosticCategory.Message, key: "Checking_if_0_is_the_longest_matching_prefix_for_1_2_6104", message: "Checking if '{0}' is the longest matching prefix for '{1}' - '{2}'." }, + Expected_type_of_0_field_in_package_json_to_be_string_got_1: { code: 6105, category: ts.DiagnosticCategory.Message, key: "Expected_type_of_0_field_in_package_json_to_be_string_got_1_6105", message: "Expected type of '{0}' field in 'package.json' to be 'string', got '{1}'." }, + baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1: { code: 6106, category: ts.DiagnosticCategory.Message, key: "baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1_6106", message: "'baseUrl' option is set to '{0}', using this value to resolve non-relative module name '{1}'" }, + rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0: { code: 6107, category: ts.DiagnosticCategory.Message, key: "rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0_6107", message: "'rootDirs' option is set, using it to resolve relative module name '{0}'" }, + Longest_matching_prefix_for_0_is_1: { code: 6108, category: ts.DiagnosticCategory.Message, key: "Longest_matching_prefix_for_0_is_1_6108", message: "Longest matching prefix for '{0}' is '{1}'" }, + Loading_0_from_the_root_dir_1_candidate_location_2: { code: 6109, category: ts.DiagnosticCategory.Message, key: "Loading_0_from_the_root_dir_1_candidate_location_2_6109", message: "Loading '{0}' from the root dir '{1}', candidate location '{2}'" }, + Trying_other_entries_in_rootDirs: { code: 6110, category: ts.DiagnosticCategory.Message, key: "Trying_other_entries_in_rootDirs_6110", message: "Trying other entries in 'rootDirs'" }, + Module_resolution_using_rootDirs_has_failed: { code: 6111, category: ts.DiagnosticCategory.Message, key: "Module_resolution_using_rootDirs_has_failed_6111", message: "Module resolution using 'rootDirs' has failed" }, + Do_not_emit_use_strict_directives_in_module_output: { code: 6112, category: ts.DiagnosticCategory.Message, key: "Do_not_emit_use_strict_directives_in_module_output_6112", message: "Do not emit 'use strict' directives in module output." }, + Enable_strict_null_checks: { code: 6113, category: ts.DiagnosticCategory.Message, key: "Enable_strict_null_checks_6113", message: "Enable strict null checks." }, + Unknown_option_excludes_Did_you_mean_exclude: { code: 6114, category: ts.DiagnosticCategory.Error, key: "Unknown_option_excludes_Did_you_mean_exclude_6114", message: "Unknown option 'excludes'. Did you mean 'exclude'?" }, + Raise_error_on_this_expressions_with_an_implied_any_type: { code: 6115, category: ts.DiagnosticCategory.Message, key: "Raise_error_on_this_expressions_with_an_implied_any_type_6115", message: "Raise error on 'this' expressions with an implied 'any' type." }, + Resolving_type_reference_directive_0_containing_file_1_root_directory_2: { code: 6116, category: ts.DiagnosticCategory.Message, key: "Resolving_type_reference_directive_0_containing_file_1_root_directory_2_6116", message: "======== Resolving type reference directive '{0}', containing file '{1}', root directory '{2}'. ========" }, + Resolving_using_primary_search_paths: { code: 6117, category: ts.DiagnosticCategory.Message, key: "Resolving_using_primary_search_paths_6117", message: "Resolving using primary search paths..." }, + Resolving_from_node_modules_folder: { code: 6118, category: ts.DiagnosticCategory.Message, key: "Resolving_from_node_modules_folder_6118", message: "Resolving from node_modules folder..." }, + Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2: { code: 6119, category: ts.DiagnosticCategory.Message, key: "Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2_6119", message: "======== Type reference directive '{0}' was successfully resolved to '{1}', primary: {2}. ========" }, + Type_reference_directive_0_was_not_resolved: { code: 6120, category: ts.DiagnosticCategory.Message, key: "Type_reference_directive_0_was_not_resolved_6120", message: "======== Type reference directive '{0}' was not resolved. ========" }, + Resolving_with_primary_search_path_0: { code: 6121, category: ts.DiagnosticCategory.Message, key: "Resolving_with_primary_search_path_0_6121", message: "Resolving with primary search path '{0}'" }, + Root_directory_cannot_be_determined_skipping_primary_search_paths: { code: 6122, category: ts.DiagnosticCategory.Message, key: "Root_directory_cannot_be_determined_skipping_primary_search_paths_6122", message: "Root directory cannot be determined, skipping primary search paths." }, + Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set: { code: 6123, category: ts.DiagnosticCategory.Message, key: "Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set_6123", message: "======== Resolving type reference directive '{0}', containing file '{1}', root directory not set. ========" }, + Type_declaration_files_to_be_included_in_compilation: { code: 6124, category: ts.DiagnosticCategory.Message, key: "Type_declaration_files_to_be_included_in_compilation_6124", message: "Type declaration files to be included in compilation." }, + Looking_up_in_node_modules_folder_initial_location_0: { code: 6125, category: ts.DiagnosticCategory.Message, key: "Looking_up_in_node_modules_folder_initial_location_0_6125", message: "Looking up in 'node_modules' folder, initial location '{0}'" }, + Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_modules_folder: { code: 6126, category: ts.DiagnosticCategory.Message, key: "Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_mod_6126", message: "Containing file is not specified and root directory cannot be determined, skipping lookup in 'node_modules' folder." }, + Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1: { code: 6127, category: ts.DiagnosticCategory.Message, key: "Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1_6127", message: "======== Resolving type reference directive '{0}', containing file not set, root directory '{1}'. ========" }, + Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set: { code: 6128, category: ts.DiagnosticCategory.Message, key: "Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set_6128", message: "======== Resolving type reference directive '{0}', containing file not set, root directory not set. ========" }, + The_config_file_0_found_doesn_t_contain_any_source_files: { code: 6129, category: ts.DiagnosticCategory.Error, key: "The_config_file_0_found_doesn_t_contain_any_source_files_6129", message: "The config file '{0}' found doesn't contain any source files." }, + Resolving_real_path_for_0_result_1: { code: 6130, category: ts.DiagnosticCategory.Message, key: "Resolving_real_path_for_0_result_1_6130", message: "Resolving real path for '{0}', result '{1}'" }, Variable_0_implicitly_has_an_1_type: { code: 7005, category: ts.DiagnosticCategory.Error, key: "Variable_0_implicitly_has_an_1_type_7005", message: "Variable '{0}' implicitly has an '{1}' type." }, Parameter_0_implicitly_has_an_1_type: { code: 7006, category: ts.DiagnosticCategory.Error, key: "Parameter_0_implicitly_has_an_1_type_7006", message: "Parameter '{0}' implicitly has an '{1}' type." }, Member_0_implicitly_has_an_1_type: { code: 7008, category: ts.DiagnosticCategory.Error, key: "Member_0_implicitly_has_an_1_type_7008", message: "Member '{0}' implicitly has an '{1}' type." }, @@ -1704,6 +1973,7 @@ var ts; _0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type: { code: 7010, category: ts.DiagnosticCategory.Error, key: "_0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type_7010", message: "'{0}', which lacks return-type annotation, implicitly has an '{1}' return type." }, Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type: { code: 7011, category: ts.DiagnosticCategory.Error, key: "Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type_7011", message: "Function expression, which lacks return-type annotation, implicitly has an '{0}' return type." }, Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7013, category: ts.DiagnosticCategory.Error, key: "Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type_7013", message: "Construct signature, which lacks return-type annotation, implicitly has an 'any' return type." }, + Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number: { code: 7015, category: ts.DiagnosticCategory.Error, key: "Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number_7015", message: "Element implicitly has an 'any' type because index expression is not of type 'number'." }, Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_type_annotation: { code: 7016, category: ts.DiagnosticCategory.Error, key: "Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_type_annotation_7016", message: "Property '{0}' implicitly has type 'any', because its 'set' accessor lacks a type annotation." }, Index_signature_of_object_type_implicitly_has_an_any_type: { code: 7017, category: ts.DiagnosticCategory.Error, key: "Index_signature_of_object_type_implicitly_has_an_any_type_7017", message: "Index signature of object type implicitly has an 'any' type." }, Object_literal_s_property_0_implicitly_has_an_1_type: { code: 7018, category: ts.DiagnosticCategory.Error, key: "Object_literal_s_property_0_implicitly_has_an_1_type_7018", message: "Object literal's property '{0}' implicitly has an '{1}' type." }, @@ -1718,6 +1988,7 @@ var ts; Unused_label: { code: 7028, category: ts.DiagnosticCategory.Error, key: "Unused_label_7028", message: "Unused label." }, Fallthrough_case_in_switch: { code: 7029, category: ts.DiagnosticCategory.Error, key: "Fallthrough_case_in_switch_7029", message: "Fallthrough case in switch." }, Not_all_code_paths_return_a_value: { code: 7030, category: ts.DiagnosticCategory.Error, key: "Not_all_code_paths_return_a_value_7030", message: "Not all code paths return a value." }, + Binding_element_0_implicitly_has_an_1_type: { code: 7031, category: ts.DiagnosticCategory.Error, key: "Binding_element_0_implicitly_has_an_1_type_7031", message: "Binding element '{0}' implicitly has an '{1}' type." }, You_cannot_rename_this_element: { code: 8000, category: ts.DiagnosticCategory.Error, key: "You_cannot_rename_this_element_8000", message: "You cannot rename this element." }, You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: { code: 8001, category: ts.DiagnosticCategory.Error, key: "You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library_8001", message: "You cannot rename elements that are defined in the standard TypeScript library." }, import_can_only_be_used_in_a_ts_file: { code: 8002, category: ts.DiagnosticCategory.Error, key: "import_can_only_be_used_in_a_ts_file_8002", message: "'import ... =' can only be used in a .ts file." }, @@ -1734,7 +2005,6 @@ var ts; property_declarations_can_only_be_used_in_a_ts_file: { code: 8014, category: ts.DiagnosticCategory.Error, key: "property_declarations_can_only_be_used_in_a_ts_file_8014", message: "'property declarations' can only be used in a .ts file." }, enum_declarations_can_only_be_used_in_a_ts_file: { code: 8015, category: ts.DiagnosticCategory.Error, key: "enum_declarations_can_only_be_used_in_a_ts_file_8015", message: "'enum declarations' can only be used in a .ts file." }, type_assertion_expressions_can_only_be_used_in_a_ts_file: { code: 8016, category: ts.DiagnosticCategory.Error, key: "type_assertion_expressions_can_only_be_used_in_a_ts_file_8016", message: "'type assertion expressions' can only be used in a .ts file." }, - decorators_can_only_be_used_in_a_ts_file: { code: 8017, category: ts.DiagnosticCategory.Error, key: "decorators_can_only_be_used_in_a_ts_file_8017", message: "'decorators' can only be used in a .ts file." }, Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_class_extends_clauses: { code: 9002, category: ts.DiagnosticCategory.Error, key: "Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_clas_9002", message: "Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses." }, class_expressions_are_not_currently_supported: { code: 9003, category: ts.DiagnosticCategory.Error, key: "class_expressions_are_not_currently_supported_9003", message: "'class' expressions are not currently supported." }, JSX_attributes_must_only_be_assigned_a_non_empty_expression: { code: 17000, category: ts.DiagnosticCategory.Error, key: "JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000", message: "JSX attributes must only be assigned a non-empty 'expression'." }, @@ -1744,7 +2014,10 @@ var ts; Cannot_use_JSX_unless_the_jsx_flag_is_provided: { code: 17004, category: ts.DiagnosticCategory.Error, key: "Cannot_use_JSX_unless_the_jsx_flag_is_provided_17004", message: "Cannot use JSX unless the '--jsx' flag is provided." }, A_constructor_cannot_contain_a_super_call_when_its_class_extends_null: { code: 17005, category: ts.DiagnosticCategory.Error, key: "A_constructor_cannot_contain_a_super_call_when_its_class_extends_null_17005", message: "A constructor cannot contain a 'super' call when its class extends 'null'" }, An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: { code: 17006, category: ts.DiagnosticCategory.Error, key: "An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_ex_17006", message: "An unary expression with the '{0}' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses." }, - A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: { code: 17007, category: ts.DiagnosticCategory.Error, key: "A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Con_17007", message: "A type assertion expression is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses." } + A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: { code: 17007, category: ts.DiagnosticCategory.Error, key: "A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Con_17007", message: "A type assertion expression is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses." }, + JSX_element_0_has_no_corresponding_closing_tag: { code: 17008, category: ts.DiagnosticCategory.Error, key: "JSX_element_0_has_no_corresponding_closing_tag_17008", message: "JSX element '{0}' has no corresponding closing tag." }, + super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class: { code: 17009, category: ts.DiagnosticCategory.Error, key: "super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class_17009", message: "'super' must be called before accessing 'this' in the constructor of a derived class." }, + Unknown_typing_option_0: { code: 17010, category: ts.DiagnosticCategory.Error, key: "Unknown_typing_option_0_17010", message: "Unknown typing option '{0}'." } }; })(ts || (ts = {})); var ts; @@ -1777,7 +2050,7 @@ var ts; "false": 84, "finally": 85, "for": 86, - "from": 133, + "from": 136, "function": 87, "get": 123, "if": 88, @@ -1790,27 +2063,31 @@ var ts; "let": 108, "module": 125, "namespace": 126, + "never": 127, "new": 92, "null": 93, - "number": 128, + "number": 130, "package": 109, "private": 110, "protected": 111, "public": 112, - "require": 127, + "readonly": 128, + "require": 129, + "global": 137, "return": 94, - "set": 129, + "set": 131, "static": 113, - "string": 130, + "string": 132, "super": 95, "switch": 96, - "symbol": 131, + "symbol": 133, "this": 97, "throw": 98, "true": 99, "try": 100, - "type": 132, + "type": 134, "typeof": 101, + "undefined": 135, "var": 102, "void": 103, "while": 104, @@ -1818,7 +2095,7 @@ var ts; "yield": 114, "async": 118, "await": 119, - "of": 134, + "of": 138, "{": 15, "}": 16, "(": 17, @@ -1934,7 +2211,8 @@ var ts; var pos = 0; var lineStart = 0; while (pos < text.length) { - var ch = text.charCodeAt(pos++); + var ch = text.charCodeAt(pos); + pos++; switch (ch) { case 13: if (text.charCodeAt(pos) === 10) { @@ -2037,6 +2315,9 @@ var ts; } ts.couldStartTrivia = couldStartTrivia; function skipTrivia(text, pos, stopAfterLineBreak) { + if (!(pos >= 0)) { + return pos; + } while (true) { var ch = text.charCodeAt(pos); switch (ch) { @@ -2254,6 +2535,18 @@ var ts; ch > 127 && isUnicodeIdentifierPart(ch, languageVersion); } ts.isIdentifierPart = isIdentifierPart; + function isIdentifier(name, languageVersion) { + if (!isIdentifierStart(name.charCodeAt(0), languageVersion)) { + return false; + } + for (var i = 1, n = name.length; i < n; i++) { + if (!isIdentifierPart(name.charCodeAt(i), languageVersion)) { + return false; + } + } + return true; + } + ts.isIdentifier = isIdentifier; function createScanner(languageVersion, skipTrivia, languageVariant, text, onError, start, length) { if (languageVariant === void 0) { languageVariant = 0; } var pos; @@ -2284,6 +2577,7 @@ var ts; scanJsxIdentifier: scanJsxIdentifier, reScanJsxToken: reScanJsxToken, scanJsxToken: scanJsxToken, + scanJSDocToken: scanJSDocToken, scan: scan, setText: setText, setScriptTarget: setScriptTarget, @@ -2291,7 +2585,8 @@ var ts; setOnError: setOnError, setTextPos: setTextPos, tryScan: tryScan, - lookAhead: lookAhead + lookAhead: lookAhead, + scanRange: scanRange }; function error(message, length) { if (onError) { @@ -2363,7 +2658,8 @@ var ts; return value; } function scanString() { - var quote = text.charCodeAt(pos++); + var quote = text.charCodeAt(pos); + pos++; var result = ""; var start = pos; while (true) { @@ -2450,7 +2746,8 @@ var ts; error(ts.Diagnostics.Unexpected_end_of_text); return ""; } - var ch = text.charCodeAt(pos++); + var ch = text.charCodeAt(pos); + pos++; switch (ch) { case 48: return "\0"; @@ -2659,7 +2956,8 @@ var ts; } return pos += 2, token = 31; } - return pos++, token = 49; + pos++; + return token = 49; case 34: case 39: tokenValue = scanString(); @@ -2670,7 +2968,8 @@ var ts; if (text.charCodeAt(pos + 1) === 61) { return pos += 2, token = 62; } - return pos++, token = 40; + pos++; + return token = 40; case 38: if (text.charCodeAt(pos + 1) === 38) { return pos += 2, token = 51; @@ -2678,11 +2977,14 @@ var ts; if (text.charCodeAt(pos + 1) === 61) { return pos += 2, token = 66; } - return pos++, token = 46; + pos++; + return token = 46; case 40: - return pos++, token = 17; + pos++; + return token = 17; case 41: - return pos++, token = 18; + pos++; + return token = 18; case 42: if (text.charCodeAt(pos + 1) === 61) { return pos += 2, token = 59; @@ -2693,7 +2995,8 @@ var ts; } return pos += 2, token = 38; } - return pos++, token = 37; + pos++; + return token = 37; case 43: if (text.charCodeAt(pos + 1) === 43) { return pos += 2, token = 41; @@ -2701,9 +3004,11 @@ var ts; if (text.charCodeAt(pos + 1) === 61) { return pos += 2, token = 57; } - return pos++, token = 35; + pos++; + return token = 35; case 44: - return pos++, token = 24; + pos++; + return token = 24; case 45: if (text.charCodeAt(pos + 1) === 45) { return pos += 2, token = 42; @@ -2711,7 +3016,8 @@ var ts; if (text.charCodeAt(pos + 1) === 61) { return pos += 2, token = 58; } - return pos++, token = 36; + pos++; + return token = 36; case 46: if (isDigit(text.charCodeAt(pos + 1))) { tokenValue = scanNumber(); @@ -2720,7 +3026,8 @@ var ts; if (text.charCodeAt(pos + 1) === 46 && text.charCodeAt(pos + 2) === 46) { return pos += 3, token = 22; } - return pos++, token = 21; + pos++; + return token = 21; case 47: if (text.charCodeAt(pos + 1) === 47) { pos += 2; @@ -2766,7 +3073,8 @@ var ts; if (text.charCodeAt(pos + 1) === 61) { return pos += 2, token = 61; } - return pos++, token = 39; + pos++; + return token = 39; case 48: if (pos + 2 < end && (text.charCodeAt(pos + 1) === 88 || text.charCodeAt(pos + 1) === 120)) { pos += 2; @@ -2814,9 +3122,11 @@ var ts; tokenValue = scanNumber(); return token = 8; case 58: - return pos++, token = 54; + pos++; + return token = 54; case 59: - return pos++, token = 23; + pos++; + return token = 23; case 60: if (isConflictMarkerTrivia(text, pos)) { pos = scanConflictMarkerTrivia(text, pos, error); @@ -2841,7 +3151,8 @@ var ts; text.charCodeAt(pos + 2) !== 42) { return pos += 2, token = 26; } - return pos++, token = 25; + pos++; + return token = 25; case 61: if (isConflictMarkerTrivia(text, pos)) { pos = scanConflictMarkerTrivia(text, pos, error); @@ -2861,7 +3172,8 @@ var ts; if (text.charCodeAt(pos + 1) === 62) { return pos += 2, token = 34; } - return pos++, token = 56; + pos++; + return token = 56; case 62: if (isConflictMarkerTrivia(text, pos)) { pos = scanConflictMarkerTrivia(text, pos, error); @@ -2872,20 +3184,26 @@ var ts; return token = 7; } } - return pos++, token = 27; + pos++; + return token = 27; case 63: - return pos++, token = 53; + pos++; + return token = 53; case 91: - return pos++, token = 19; + pos++; + return token = 19; case 93: - return pos++, token = 20; + pos++; + return token = 20; case 94: if (text.charCodeAt(pos + 1) === 61) { return pos += 2, token = 68; } - return pos++, token = 48; + pos++; + return token = 48; case 123: - return pos++, token = 15; + pos++; + return token = 15; case 124: if (text.charCodeAt(pos + 1) === 124) { return pos += 2, token = 52; @@ -2893,13 +3211,17 @@ var ts; if (text.charCodeAt(pos + 1) === 61) { return pos += 2, token = 67; } - return pos++, token = 47; + pos++; + return token = 47; case 125: - return pos++, token = 16; + pos++; + return token = 16; case 126: - return pos++, token = 50; + pos++; + return token = 50; case 64: - return pos++, token = 55; + pos++; + return token = 55; case 92: var cookedChar = peekUnicodeEscape(); if (cookedChar >= 0 && isIdentifierStart(cookedChar, languageVersion)) { @@ -2908,7 +3230,8 @@ var ts; return token = getIdentifierToken(); } error(ts.Diagnostics.Invalid_character); - return pos++, token = 0; + pos++; + return token = 0; default: if (isIdentifierStart(ch, languageVersion)) { pos++; @@ -2930,7 +3253,8 @@ var ts; continue; } error(ts.Diagnostics.Invalid_character); - return pos++, token = 0; + pos++; + return token = 0; } } } @@ -2946,10 +3270,12 @@ var ts; if (text.charCodeAt(pos + 1) === 61) { return pos += 2, token = 64; } - return pos++, token = 44; + pos++; + return token = 44; } if (text.charCodeAt(pos) === 61) { - return pos++, token = 29; + pos++; + return token = 29; } } return token; @@ -3032,7 +3358,7 @@ var ts; break; } } - return token = 236; + return token = 244; } function scanJsxIdentifier() { if (tokenIsIdentifierOrKeyword(token)) { @@ -3050,6 +3376,54 @@ var ts; } return token; } + function scanJSDocToken() { + if (pos >= end) { + return token = 1; + } + startPos = pos; + var ch = text.charCodeAt(pos); + while (pos < end) { + ch = text.charCodeAt(pos); + if (isWhiteSpace(ch)) { + pos++; + } + else { + break; + } + } + tokenPos = pos; + switch (ch) { + case 64: + return pos += 1, token = 55; + case 10: + case 13: + return pos += 1, token = 4; + case 42: + return pos += 1, token = 37; + case 123: + return pos += 1, token = 15; + case 125: + return pos += 1, token = 16; + case 91: + return pos += 1, token = 19; + case 93: + return pos += 1, token = 20; + case 61: + return pos += 1, token = 56; + case 44: + return pos += 1, token = 24; + } + if (isIdentifierStart(ch, 2)) { + pos++; + while (isIdentifierPart(text.charCodeAt(pos), 2) && pos < end) { + pos++; + } + return token = 69; + } + else { + return pos += 1, token = 0; + } + } function speculationHelper(callback, isLookahead) { var savePos = pos; var saveStartPos = startPos; @@ -3068,6 +3442,29 @@ var ts; } return result; } + function scanRange(start, length, callback) { + var saveEnd = end; + var savePos = pos; + var saveStartPos = startPos; + var saveTokenPos = tokenPos; + var saveToken = token; + var savePrecedingLineBreak = precedingLineBreak; + var saveTokenValue = tokenValue; + var saveHasExtendedUnicodeEscape = hasExtendedUnicodeEscape; + var saveTokenIsUnterminated = tokenIsUnterminated; + setText(text, start, length); + var result = callback(); + end = saveEnd; + pos = savePos; + startPos = saveStartPos; + tokenPos = saveTokenPos; + token = saveToken; + precedingLineBreak = savePrecedingLineBreak; + tokenValue = saveTokenValue; + hasExtendedUnicodeEscape = saveHasExtendedUnicodeEscape; + tokenIsUnterminated = saveTokenIsUnterminated; + return result; + } function lookAhead(callback) { return speculationHelper(callback, true); } @@ -3120,10 +3517,10 @@ var ts; var stringWriters = []; function getSingleLineStringWriter() { if (stringWriters.length === 0) { - var str = ""; - var writeText = function (text) { return str += text; }; + var str_1 = ""; + var writeText = function (text) { return str_1 += text; }; return { - string: function () { return str; }, + string: function () { return str_1; }, writeKeyword: writeText, writeOperator: writeText, writePunctuation: writeText, @@ -3131,10 +3528,10 @@ var ts; writeStringLiteral: writeText, writeParameter: writeText, writeSymbol: writeText, - writeLine: function () { return str += " "; }, + writeLine: function () { return str_1 += " "; }, increaseIndent: function () { }, decreaseIndent: function () { }, - clear: function () { return str = ""; }, + clear: function () { return str_1 = ""; }, trackSymbol: function () { }, reportInaccessibleThisError: function () { } }; @@ -3151,6 +3548,24 @@ var ts; return node.end - node.pos; } ts.getFullWidth = getFullWidth; + function mapIsEqualTo(map1, map2) { + if (!map1 || !map2) { + return map1 === map2; + } + return containsAll(map1, map2) && containsAll(map2, map1); + } + ts.mapIsEqualTo = mapIsEqualTo; + function containsAll(map, other) { + for (var key in map) { + if (!ts.hasProperty(map, key)) { + continue; + } + if (!ts.hasProperty(other, key) || map[key] !== other[key]) { + return false; + } + } + return true; + } function arrayIsEqualTo(array1, array2, equaler) { if (!array1 || !array2) { return array1 === array2; @@ -3158,7 +3573,7 @@ var ts; if (array1.length !== array2.length) { return false; } - for (var i = 0; i < array1.length; ++i) { + for (var i = 0; i < array1.length; i++) { var equals = equaler ? equaler(array1[i], array2[i]) : array1[i] === array2[i]; if (!equals) { return false; @@ -3182,28 +3597,72 @@ var ts; sourceFile.resolvedModules[moduleNameText] = resolvedModule; } ts.setResolvedModule = setResolvedModule; + function setResolvedTypeReferenceDirective(sourceFile, typeReferenceDirectiveName, resolvedTypeReferenceDirective) { + if (!sourceFile.resolvedTypeReferenceDirectiveNames) { + sourceFile.resolvedTypeReferenceDirectiveNames = {}; + } + sourceFile.resolvedTypeReferenceDirectiveNames[typeReferenceDirectiveName] = resolvedTypeReferenceDirective; + } + ts.setResolvedTypeReferenceDirective = setResolvedTypeReferenceDirective; + function moduleResolutionIsEqualTo(oldResolution, newResolution) { + return oldResolution.resolvedFileName === newResolution.resolvedFileName && oldResolution.isExternalLibraryImport === newResolution.isExternalLibraryImport; + } + ts.moduleResolutionIsEqualTo = moduleResolutionIsEqualTo; + function typeDirectiveIsEqualTo(oldResolution, newResolution) { + return oldResolution.resolvedFileName === newResolution.resolvedFileName && oldResolution.primary === newResolution.primary; + } + ts.typeDirectiveIsEqualTo = typeDirectiveIsEqualTo; + function hasChangesInResolutions(names, newResolutions, oldResolutions, comparer) { + if (names.length !== newResolutions.length) { + return false; + } + for (var i = 0; i < names.length; i++) { + var newResolution = newResolutions[i]; + var oldResolution = oldResolutions && ts.hasProperty(oldResolutions, names[i]) ? oldResolutions[names[i]] : undefined; + var changed = oldResolution + ? !newResolution || !comparer(oldResolution, newResolution) + : newResolution; + if (changed) { + return true; + } + } + return false; + } + ts.hasChangesInResolutions = hasChangesInResolutions; function containsParseError(node) { aggregateChildData(node); - return (node.parserContextFlags & 64) !== 0; + return (node.flags & 268435456) !== 0; } ts.containsParseError = containsParseError; function aggregateChildData(node) { - if (!(node.parserContextFlags & 128)) { - var thisNodeOrAnySubNodesHasError = ((node.parserContextFlags & 16) !== 0) || + if (!(node.flags & 536870912)) { + var thisNodeOrAnySubNodesHasError = ((node.flags & 67108864) !== 0) || ts.forEachChild(node, containsParseError); if (thisNodeOrAnySubNodesHasError) { - node.parserContextFlags |= 64; + node.flags |= 268435456; } - node.parserContextFlags |= 128; + node.flags |= 536870912; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 248) { + while (node && node.kind !== 256) { node = node.parent; } return node; } ts.getSourceFileOfNode = getSourceFileOfNode; + function isStatementWithLocals(node) { + switch (node.kind) { + case 199: + case 227: + case 206: + case 207: + case 208: + return true; + } + return false; + } + ts.isStatementWithLocals = isStatementWithLocals; function getStartPositionOfLine(line, sourceFile) { ts.Debug.assert(line >= 0); return ts.getLineStarts(sourceFile)[line]; @@ -3219,6 +3678,25 @@ var ts; return node.pos; } ts.getStartPosOfNode = getStartPosOfNode; + function getEndLinePosition(line, sourceFile) { + ts.Debug.assert(line >= 0); + var lineStarts = ts.getLineStarts(sourceFile); + var lineIndex = line; + var sourceText = sourceFile.text; + if (lineIndex + 1 === lineStarts.length) { + return sourceText.length - 1; + } + else { + var start = lineStarts[lineIndex]; + var pos = lineStarts[lineIndex + 1] - 1; + ts.Debug.assert(ts.isLineBreak(sourceText.charCodeAt(pos))); + while (start <= pos && ts.isLineBreak(sourceText.charCodeAt(pos))) { + pos--; + } + return pos; + } + } + ts.getEndLinePosition = getEndLinePosition; function nodeIsMissing(node) { if (!node) { return true; @@ -3278,10 +3756,39 @@ var ts; } ts.makeIdentifierFromModuleName = makeIdentifierFromModuleName; function isBlockOrCatchScoped(declaration) { - return (getCombinedNodeFlags(declaration) & 24576) !== 0 || + return (getCombinedNodeFlags(declaration) & 3072) !== 0 || isCatchClauseVariableDeclaration(declaration); } ts.isBlockOrCatchScoped = isBlockOrCatchScoped; + function isAmbientModule(node) { + return node && node.kind === 225 && + (node.name.kind === 9 || isGlobalScopeAugmentation(node)); + } + ts.isAmbientModule = isAmbientModule; + function isBlockScopedContainerTopLevel(node) { + return node.kind === 256 || + node.kind === 225 || + isFunctionLike(node) || + isFunctionBlock(node); + } + ts.isBlockScopedContainerTopLevel = isBlockScopedContainerTopLevel; + function isGlobalScopeAugmentation(module) { + return !!(module.flags & 131072); + } + ts.isGlobalScopeAugmentation = isGlobalScopeAugmentation; + function isExternalModuleAugmentation(node) { + if (!node || !isAmbientModule(node)) { + return false; + } + switch (node.parent.kind) { + case 256: + return ts.isExternalModule(node.parent); + case 226: + return isAmbientModule(node.parent.parent) && !ts.isExternalModule(node.parent.parent.parent); + } + return false; + } + ts.isExternalModuleAugmentation = isExternalModuleAugmentation; function getEnclosingBlockScopeContainer(node) { var current = node.parent; while (current) { @@ -3289,15 +3796,15 @@ var ts; return current; } switch (current.kind) { - case 248: - case 220: - case 244: - case 218: - case 199: - case 200: - case 201: + case 256: + case 227: + case 252: + case 225: + case 206: + case 207: + case 208: return current; - case 192: + case 199: if (!isFunctionLike(current.parent)) { return current; } @@ -3308,9 +3815,9 @@ var ts; ts.getEnclosingBlockScopeContainer = getEnclosingBlockScopeContainer; function isCatchClauseVariableDeclaration(declaration) { return declaration && - declaration.kind === 211 && + declaration.kind === 218 && declaration.parent && - declaration.parent.kind === 244; + declaration.parent.kind === 252; } ts.isCatchClauseVariableDeclaration = isCatchClauseVariableDeclaration; function declarationNameToString(name) { @@ -3343,27 +3850,44 @@ var ts; return ts.createTextSpanFromBounds(start, scanner.getTextPos()); } ts.getSpanOfTokenAtPosition = getSpanOfTokenAtPosition; + function getErrorSpanForArrowFunction(sourceFile, node) { + var pos = ts.skipTrivia(sourceFile.text, node.pos); + if (node.body && node.body.kind === 199) { + var startLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.pos).line; + var endLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.end).line; + if (startLine < endLine) { + return ts.createTextSpan(pos, getEndLinePosition(startLine, sourceFile) - pos + 1); + } + } + return ts.createTextSpanFromBounds(pos, node.end); + } function getErrorSpanForNode(sourceFile, node) { var errorNode = node; switch (node.kind) { - case 248: + case 256: var pos_1 = ts.skipTrivia(sourceFile.text, 0, false); if (pos_1 === sourceFile.text.length) { return ts.createTextSpan(0, 0); } return getSpanOfTokenAtPosition(sourceFile, pos_1); - case 211: - case 163: - case 214: - case 186: - case 215: case 218: - case 217: - case 247: - case 213: - case 173: + case 169: + case 221: + case 192: + case 222: + case 225: + case 224: + case 255: + case 220: + case 179: + case 147: + case 149: + case 150: + case 223: errorNode = node.name; break; + case 180: + return getErrorSpanForArrowFunction(sourceFile, node); } if (errorNode === undefined) { return getSpanOfTokenAtPosition(sourceFile, node.pos); @@ -3374,24 +3898,20 @@ var ts; return ts.createTextSpanFromBounds(pos, errorNode.end); } ts.getErrorSpanForNode = getErrorSpanForNode; - function isExternalModule(file) { - return file.externalModuleIndicator !== undefined; - } - ts.isExternalModule = isExternalModule; function isExternalOrCommonJsModule(file) { return (file.externalModuleIndicator || file.commonJsModuleIndicator) !== undefined; } ts.isExternalOrCommonJsModule = isExternalOrCommonJsModule; function isDeclarationFile(file) { - return (file.flags & 4096) !== 0; + return file.isDeclarationFile; } ts.isDeclarationFile = isDeclarationFile; function isConstEnumDeclaration(node) { - return node.kind === 217 && isConst(node); + return node.kind === 224 && isConst(node); } ts.isConstEnumDeclaration = isConstEnumDeclaration; function walkUpBindingElementsAndPatterns(node) { - while (node && (node.kind === 163 || isBindingPattern(node))) { + while (node && (node.kind === 169 || isBindingPattern(node))) { node = node.parent; } return node; @@ -3399,29 +3919,33 @@ var ts; function getCombinedNodeFlags(node) { node = walkUpBindingElementsAndPatterns(node); var flags = node.flags; - if (node.kind === 211) { + if (node.kind === 218) { node = node.parent; } - if (node && node.kind === 212) { + if (node && node.kind === 219) { flags |= node.flags; node = node.parent; } - if (node && node.kind === 193) { + if (node && node.kind === 200) { flags |= node.flags; } return flags; } ts.getCombinedNodeFlags = getCombinedNodeFlags; function isConst(node) { - return !!(getCombinedNodeFlags(node) & 16384); + return !!(getCombinedNodeFlags(node) & 2048); } ts.isConst = isConst; function isLet(node) { - return !!(getCombinedNodeFlags(node) & 8192); + return !!(getCombinedNodeFlags(node) & 1024); } ts.isLet = isLet; + function isSuperCallExpression(n) { + return n.kind === 174 && n.expression.kind === 95; + } + ts.isSuperCallExpression = isSuperCallExpression; function isPrologueDirective(node) { - return node.kind === 195 && node.expression.kind === 9; + return node.kind === 202 && node.expression.kind === 9; } ts.isPrologueDirective = isPrologueDirective; function getLeadingCommentRangesOfNode(node, sourceFileOfNode) { @@ -3437,7 +3961,7 @@ var ts; } ts.getJsDocComments = getJsDocComments; function getJsDocCommentsFromText(node, text) { - var commentRanges = (node.kind === 138 || node.kind === 137) ? + var commentRanges = (node.kind === 142 || node.kind === 141) ? ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) : getLeadingCommentRangesOfNodeFromText(node, text); return ts.filter(commentRanges, isJsDocComment); @@ -3449,71 +3973,72 @@ var ts; } ts.getJsDocCommentsFromText = getJsDocCommentsFromText; ts.fullTripleSlashReferencePathRegEx = /^(\/\/\/\s*/; + ts.fullTripleSlashReferenceTypeReferenceDirectiveRegEx = /^(\/\/\/\s*/; ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*/; function isTypeNode(node) { - if (151 <= node.kind && node.kind <= 160) { + if (154 <= node.kind && node.kind <= 166) { return true; } switch (node.kind) { case 117: - case 128: case 130: + case 132: case 120: - case 131: + case 133: + case 135: + case 127: return true; case 103: - return node.parent.kind !== 177; - case 9: - return node.parent.kind === 138; - case 188: + return node.parent.kind !== 183; + case 194: return !isExpressionWithTypeArgumentsInClassExtendsClause(node); case 69: - if (node.parent.kind === 135 && node.parent.right === node) { + if (node.parent.kind === 139 && node.parent.right === node) { node = node.parent; } - else if (node.parent.kind === 166 && node.parent.name === node) { + else if (node.parent.kind === 172 && node.parent.name === node) { node = node.parent; } - ts.Debug.assert(node.kind === 69 || node.kind === 135 || node.kind === 166, "'node' was expected to be a qualified name, identifier or property access in 'isTypeNode'."); - case 135: - case 166: + ts.Debug.assert(node.kind === 69 || node.kind === 139 || node.kind === 172, "'node' was expected to be a qualified name, identifier or property access in 'isTypeNode'."); + case 139: + case 172: case 97: var parent_1 = node.parent; - if (parent_1.kind === 154) { + if (parent_1.kind === 158) { return false; } - if (151 <= parent_1.kind && parent_1.kind <= 160) { + if (154 <= parent_1.kind && parent_1.kind <= 166) { return true; } switch (parent_1.kind) { - case 188: + case 194: return !isExpressionWithTypeArgumentsInClassExtendsClause(parent_1); - case 137: - return node === parent_1.constraint; case 141: - case 140: - case 138: - case 211: - return node === parent_1.type; - case 213: - case 173: - case 174: - case 144: - case 143: - case 142: + return node === parent_1.constraint; case 145: - case 146: + case 144: + case 142: + case 218: return node === parent_1.type; - case 147: + case 220: + case 179: + case 180: case 148: + case 147: + case 146: case 149: + case 150: return node === parent_1.type; - case 171: + case 151: + case 152: + case 153: return node === parent_1.type; - case 168: - case 169: + case 177: + return node === parent_1.type; + case 174: + case 175: return parent_1.typeArguments && ts.indexOf(parent_1.typeArguments, node) >= 0; - case 170: + case 176: return false; } } @@ -3524,23 +4049,23 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 204: + case 211: return visitor(node); - case 220: - case 192: - case 196: - case 197: - case 198: + case 227: case 199: - case 200: - case 201: + case 203: + case 204: case 205: case 206: - case 241: - case 242: case 207: - case 209: - case 244: + case 208: + case 212: + case 213: + case 249: + case 250: + case 214: + case 216: + case 252: return ts.forEachChild(node, traverse); } } @@ -3550,23 +4075,23 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 184: + case 190: visitor(node); var operand = node.expression; if (operand) { traverse(operand); } - case 217: - case 215: - case 218: - case 216: - case 214: - case 186: + case 224: + case 222: + case 225: + case 223: + case 221: + case 192: return; default: if (isFunctionLike(node)) { var name_5 = node.name; - if (name_5 && name_5.kind === 136) { + if (name_5 && name_5.kind === 140) { traverse(name_5.expression); return; } @@ -3581,14 +4106,14 @@ var ts; function isVariableLike(node) { if (node) { switch (node.kind) { - case 163: - case 247: - case 138: - case 245: - case 141: - case 140: - case 246: - case 211: + case 169: + case 255: + case 142: + case 253: + case 145: + case 144: + case 254: + case 218: return true; } } @@ -3596,11 +4121,11 @@ var ts; } ts.isVariableLike = isVariableLike; function isAccessor(node) { - return node && (node.kind === 145 || node.kind === 146); + return node && (node.kind === 149 || node.kind === 150); } ts.isAccessor = isAccessor; function isClassLike(node) { - return node && (node.kind === 214 || node.kind === 186); + return node && (node.kind === 221 || node.kind === 192); } ts.isClassLike = isClassLike; function isFunctionLike(node) { @@ -3609,32 +4134,32 @@ var ts; ts.isFunctionLike = isFunctionLike; function isFunctionLikeKind(kind) { switch (kind) { - case 144: - case 173: - case 213: - case 174: - case 143: - case 142: - case 145: - case 146: - case 147: case 148: + case 179: + case 220: + case 180: + case 147: + case 146: case 149: + case 150: + case 151: case 152: case 153: + case 156: + case 157: return true; } } ts.isFunctionLikeKind = isFunctionLikeKind; function introducesArgumentsExoticObject(node) { switch (node.kind) { - case 143: - case 142: - case 144: - case 145: + case 147: case 146: - case 213: - case 173: + case 148: + case 149: + case 150: + case 220: + case 179: return true; } return false; @@ -3642,26 +4167,34 @@ var ts; ts.introducesArgumentsExoticObject = introducesArgumentsExoticObject; function isIterationStatement(node, lookInLabeledStatements) { switch (node.kind) { - case 199: - case 200: - case 201: - case 197: - case 198: - return true; + case 206: case 207: + case 208: + case 204: + case 205: + return true; + case 214: return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); } return false; } ts.isIterationStatement = isIterationStatement; function isFunctionBlock(node) { - return node && node.kind === 192 && isFunctionLike(node.parent); + return node && node.kind === 199 && isFunctionLike(node.parent); } ts.isFunctionBlock = isFunctionBlock; function isObjectLiteralMethod(node) { - return node && node.kind === 143 && node.parent.kind === 165; + return node && node.kind === 147 && node.parent.kind === 171; } ts.isObjectLiteralMethod = isObjectLiteralMethod; + function isIdentifierTypePredicate(predicate) { + return predicate && predicate.kind === 1; + } + ts.isIdentifierTypePredicate = isIdentifierTypePredicate; + function isThisTypePredicate(predicate) { + return predicate && predicate.kind === 0; + } + ts.isThisTypePredicate = isThisTypePredicate; function getContainingFunction(node) { while (true) { node = node.parent; @@ -3671,6 +4204,15 @@ var ts; } } ts.getContainingFunction = getContainingFunction; + function getContainingFunctionOrModule(node) { + while (true) { + node = node.parent; + if (isFunctionLike(node) || node.kind === 225 || node.kind === 256) { + return node; + } + } + } + ts.getContainingFunctionOrModule = getContainingFunctionOrModule; function getContainingClass(node) { while (true) { node = node.parent; @@ -3687,91 +4229,95 @@ var ts; return undefined; } switch (node.kind) { - case 136: + case 140: if (isClassLike(node.parent.parent)) { return node; } node = node.parent; break; - case 139: - if (node.parent.kind === 138 && isClassElement(node.parent.parent)) { + case 143: + if (node.parent.kind === 142 && isClassElement(node.parent.parent)) { node = node.parent.parent; } else if (isClassElement(node.parent)) { node = node.parent; } break; - case 174: + case 180: if (!includeArrowFunctions) { continue; } - case 213: - case 173: - case 218: - case 141: - case 140: - case 143: - case 142: - case 144: + case 220: + case 179: + case 225: case 145: - case 146: + case 144: case 147: + case 146: case 148: case 149: - case 217: - case 248: + case 150: + case 151: + case 152: + case 153: + case 224: + case 256: return node; } } } ts.getThisContainer = getThisContainer; - function getSuperContainer(node, includeFunctions) { + function getSuperContainer(node, stopOnFunctions) { while (true) { node = node.parent; - if (!node) + if (!node) { return node; + } switch (node.kind) { - case 136: - if (isClassLike(node.parent.parent)) { - return node; - } + case 140: node = node.parent; break; - case 139: - if (node.parent.kind === 138 && isClassElement(node.parent.parent)) { + case 220: + case 179: + case 180: + if (!stopOnFunctions) { + continue; + } + case 145: + case 144: + case 147: + case 146: + case 148: + case 149: + case 150: + return node; + case 143: + if (node.parent.kind === 142 && isClassElement(node.parent.parent)) { node = node.parent.parent; } else if (isClassElement(node.parent)) { node = node.parent; } break; - case 213: - case 173: - case 174: - if (!includeFunctions) { - continue; - } - case 141: - case 140: - case 143: - case 142: - case 144: - case 145: - case 146: - return node; } } } ts.getSuperContainer = getSuperContainer; + function isSuperPropertyOrElementAccess(node) { + return (node.kind === 172 + || node.kind === 173) + && node.expression.kind === 95; + } + ts.isSuperPropertyOrElementAccess = isSuperPropertyOrElementAccess; function getEntityNameFromTypeNode(node) { if (node) { switch (node.kind) { - case 151: + case 155: return node.typeName; - case 188: + case 194: return node.expression; case 69: - case 135: + case 139: return node; } } @@ -3779,7 +4325,7 @@ var ts; } ts.getEntityNameFromTypeNode = getEntityNameFromTypeNode; function getInvokedExpression(node) { - if (node.kind === 170) { + if (node.kind === 176) { return node.tag; } return node.expression; @@ -3787,114 +4333,93 @@ var ts; ts.getInvokedExpression = getInvokedExpression; function nodeCanBeDecorated(node) { switch (node.kind) { - case 214: + case 221: return true; - case 141: - return node.parent.kind === 214; - case 138: - return node.parent.body && node.parent.parent.kind === 214; case 145: - case 146: - case 143: - return node.body && node.parent.kind === 214; + return node.parent.kind === 221; + case 149: + case 150: + case 147: + return node.body !== undefined + && node.parent.kind === 221; + case 142: + return node.parent.body !== undefined + && (node.parent.kind === 148 + || node.parent.kind === 147 + || node.parent.kind === 150) + && node.parent.parent.kind === 221; } return false; } ts.nodeCanBeDecorated = nodeCanBeDecorated; function nodeIsDecorated(node) { - switch (node.kind) { - case 214: - if (node.decorators) { - return true; - } - return false; - case 141: - case 138: - if (node.decorators) { - return true; - } - return false; - case 145: - if (node.body && node.decorators) { - return true; - } - return false; - case 143: - case 146: - if (node.body && node.decorators) { - return true; - } - return false; - } - return false; + return node.decorators !== undefined + && nodeCanBeDecorated(node); } ts.nodeIsDecorated = nodeIsDecorated; - function childIsDecorated(node) { - switch (node.kind) { - case 214: - return ts.forEach(node.members, nodeOrChildIsDecorated); - case 143: - case 146: - return ts.forEach(node.parameters, nodeIsDecorated); - } - return false; - } - ts.childIsDecorated = childIsDecorated; - function nodeOrChildIsDecorated(node) { - return nodeIsDecorated(node) || childIsDecorated(node); - } - ts.nodeOrChildIsDecorated = nodeOrChildIsDecorated; function isPropertyAccessExpression(node) { - return node.kind === 166; + return node.kind === 172; } ts.isPropertyAccessExpression = isPropertyAccessExpression; function isElementAccessExpression(node) { - return node.kind === 167; + return node.kind === 173; } ts.isElementAccessExpression = isElementAccessExpression; + function isJSXTagName(node) { + var parent = node.parent; + if (parent.kind === 243 || + parent.kind === 242 || + parent.kind === 245) { + return parent.tagName === node; + } + return false; + } + ts.isJSXTagName = isJSXTagName; function isExpression(node) { switch (node.kind) { + case 97: case 95: case 93: case 99: case 84: case 10: - case 164: - case 165: - case 166: - case 167: - case 168: - case 169: case 170: - case 189: case 171: case 172: case 173: - case 186: case 174: - case 177: case 175: case 176: + case 195: + case 177: + case 196: + case 178: case 179: + case 192: case 180: + case 183: case 181: case 182: case 185: - case 183: - case 11: + case 186: case 187: - case 233: - case 234: + case 188: + case 191: + case 189: + case 11: + case 193: + case 241: + case 242: + case 190: case 184: - case 178: return true; - case 135: - while (node.parent.kind === 135) { + case 139: + while (node.parent.kind === 139) { node = node.parent; } - return node.parent.kind === 154; + return node.parent.kind === 158 || isJSXTagName(node); case 69: - if (node.parent.kind === 154) { + if (node.parent.kind === 158 || isJSXTagName(node)) { return true; } case 8: @@ -3902,47 +4427,47 @@ var ts; case 97: var parent_2 = node.parent; switch (parent_2.kind) { - case 211: - case 138: - case 141: - case 140: - case 247: - case 245: - case 163: + case 218: + case 142: + case 145: + case 144: + case 255: + case 253: + case 169: return parent_2.initializer === node; - case 195: - case 196: - case 197: - case 198: + case 202: + case 203: case 204: case 205: - case 206: - case 241: - case 208: - case 206: + case 211: + case 212: + case 213: + case 249: + case 215: + case 213: return parent_2.expression === node; - case 199: + case 206: var forStatement = parent_2; - return (forStatement.initializer === node && forStatement.initializer.kind !== 212) || + return (forStatement.initializer === node && forStatement.initializer.kind !== 219) || forStatement.condition === node || forStatement.incrementor === node; - case 200: - case 201: + case 207: + case 208: var forInStatement = parent_2; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 212) || + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 219) || forInStatement.expression === node; - case 171: - case 189: + case 177: + case 195: return node === parent_2.expression; - case 190: + case 197: return node === parent_2.expression; - case 136: + case 140: return node === parent_2.expression; - case 139: - case 240: - case 239: + case 143: + case 248: + case 247: return true; - case 188: + case 194: return parent_2.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent_2); default: if (isExpression(parent_2)) { @@ -3964,7 +4489,7 @@ var ts; } ts.isInstantiatedModule = isInstantiatedModule; function isExternalModuleImportEqualsDeclaration(node) { - return node.kind === 221 && node.moduleReference.kind === 232; + return node.kind === 229 && node.moduleReference.kind === 240; } ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration; function getExternalModuleImportEqualsDeclarationExpression(node) { @@ -3973,7 +4498,7 @@ var ts; } ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression; function isInternalModuleImportEqualsDeclaration(node) { - return node.kind === 221 && node.moduleReference.kind !== 232; + return node.kind === 229 && node.moduleReference.kind !== 240; } ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration; function isSourceFileJavaScript(file) { @@ -3981,61 +4506,88 @@ var ts; } ts.isSourceFileJavaScript = isSourceFileJavaScript; function isInJavaScriptFile(node) { - return node && !!(node.parserContextFlags & 32); + return node && !!(node.flags & 134217728); } ts.isInJavaScriptFile = isInJavaScriptFile; - function isRequireCall(expression) { - return expression.kind === 168 && + function isRequireCall(expression, checkArgumentIsStringLiteral) { + var isRequire = expression.kind === 174 && expression.expression.kind === 69 && expression.expression.text === "require" && - expression.arguments.length === 1 && - expression.arguments[0].kind === 9; + expression.arguments.length === 1; + return isRequire && (!checkArgumentIsStringLiteral || expression.arguments[0].kind === 9); } ts.isRequireCall = isRequireCall; - function isExportsPropertyAssignment(expression) { - return isInJavaScriptFile(expression) && - (expression.kind === 181) && - (expression.operatorToken.kind === 56) && - (expression.left.kind === 166) && - (expression.left.expression.kind === 69) && - ((expression.left.expression).text === "exports"); + function isSingleOrDoubleQuote(charCode) { + return charCode === 39 || charCode === 34; } - ts.isExportsPropertyAssignment = isExportsPropertyAssignment; - function isModuleExportsAssignment(expression) { - return isInJavaScriptFile(expression) && - (expression.kind === 181) && - (expression.operatorToken.kind === 56) && - (expression.left.kind === 166) && - (expression.left.expression.kind === 69) && - ((expression.left.expression).text === "module") && - (expression.left.name.text === "exports"); + ts.isSingleOrDoubleQuote = isSingleOrDoubleQuote; + function getSpecialPropertyAssignmentKind(expression) { + if (!isInJavaScriptFile(expression)) { + return 0; + } + if (expression.kind !== 187) { + return 0; + } + var expr = expression; + if (expr.operatorToken.kind !== 56 || expr.left.kind !== 172) { + return 0; + } + var lhs = expr.left; + if (lhs.expression.kind === 69) { + var lhsId = lhs.expression; + if (lhsId.text === "exports") { + return 1; + } + else if (lhsId.text === "module" && lhs.name.text === "exports") { + return 2; + } + } + else if (lhs.expression.kind === 97) { + return 4; + } + else if (lhs.expression.kind === 172) { + var innerPropertyAccess = lhs.expression; + if (innerPropertyAccess.expression.kind === 69) { + var innerPropertyAccessIdentifier = innerPropertyAccess.expression; + if (innerPropertyAccessIdentifier.text === "module" && innerPropertyAccess.name.text === "exports") { + return 1; + } + if (innerPropertyAccess.name.text === "prototype") { + return 3; + } + } + } + return 0; } - ts.isModuleExportsAssignment = isModuleExportsAssignment; + ts.getSpecialPropertyAssignmentKind = getSpecialPropertyAssignmentKind; function getExternalModuleName(node) { - if (node.kind === 222) { + if (node.kind === 230) { return node.moduleSpecifier; } - if (node.kind === 221) { + if (node.kind === 229) { var reference = node.moduleReference; - if (reference.kind === 232) { + if (reference.kind === 240) { return reference.expression; } } - if (node.kind === 228) { + if (node.kind === 236) { return node.moduleSpecifier; } + if (node.kind === 225 && node.name.kind === 9) { + return node.name; + } } ts.getExternalModuleName = getExternalModuleName; function hasQuestionToken(node) { if (node) { switch (node.kind) { - case 138: - case 143: case 142: - case 246: - case 245: - case 141: - case 140: + case 147: + case 146: + case 254: + case 253: + case 145: + case 144: return node.questionToken !== undefined; } } @@ -4043,71 +4595,110 @@ var ts; } ts.hasQuestionToken = hasQuestionToken; function isJSDocConstructSignature(node) { - return node.kind === 261 && + return node.kind === 269 && node.parameters.length > 0 && - node.parameters[0].type.kind === 263; + node.parameters[0].type.kind === 271; } ts.isJSDocConstructSignature = isJSDocConstructSignature; - function getJSDocTag(node, kind) { - if (node && node.jsDocComment) { - for (var _i = 0, _a = node.jsDocComment.tags; _i < _a.length; _i++) { - var tag = _a[_i]; - if (tag.kind === kind) { - return tag; - } + function getJSDocTag(node, kind, checkParentVariableStatement) { + if (!node) { + return undefined; + } + var jsDocComment = getJSDocComment(node, checkParentVariableStatement); + if (!jsDocComment) { + return undefined; + } + for (var _i = 0, _a = jsDocComment.tags; _i < _a.length; _i++) { + var tag = _a[_i]; + if (tag.kind === kind) { + return tag; } } } + function getJSDocComment(node, checkParentVariableStatement) { + if (node.jsDocComment) { + return node.jsDocComment; + } + if (checkParentVariableStatement) { + var isInitializerOfVariableDeclarationInStatement = node.parent.kind === 218 && + node.parent.initializer === node && + node.parent.parent.parent.kind === 200; + var variableStatementNode = isInitializerOfVariableDeclarationInStatement ? node.parent.parent.parent : undefined; + if (variableStatementNode) { + return variableStatementNode.jsDocComment; + } + var parent_3 = node.parent; + var isSourceOfAssignmentExpressionStatement = parent_3 && parent_3.parent && + parent_3.kind === 187 && + parent_3.operatorToken.kind === 56 && + parent_3.parent.kind === 202; + if (isSourceOfAssignmentExpressionStatement) { + return parent_3.parent.jsDocComment; + } + var isPropertyAssignmentExpression = parent_3 && parent_3.kind === 253; + if (isPropertyAssignmentExpression) { + return parent_3.jsDocComment; + } + } + return undefined; + } function getJSDocTypeTag(node) { - return getJSDocTag(node, 269); + return getJSDocTag(node, 277, false); } ts.getJSDocTypeTag = getJSDocTypeTag; function getJSDocReturnTag(node) { - return getJSDocTag(node, 268); + return getJSDocTag(node, 276, true); } ts.getJSDocReturnTag = getJSDocReturnTag; function getJSDocTemplateTag(node) { - return getJSDocTag(node, 270); + return getJSDocTag(node, 278, false); } ts.getJSDocTemplateTag = getJSDocTemplateTag; function getCorrespondingJSDocParameterTag(parameter) { if (parameter.name && parameter.name.kind === 69) { var parameterName = parameter.name.text; - var docComment = parameter.parent.jsDocComment; - if (docComment) { - return ts.forEach(docComment.tags, function (t) { - if (t.kind === 267) { - var parameterTag = t; + var jsDocComment = getJSDocComment(parameter.parent, true); + if (jsDocComment) { + for (var _i = 0, _a = jsDocComment.tags; _i < _a.length; _i++) { + var tag = _a[_i]; + if (tag.kind === 275) { + var parameterTag = tag; var name_6 = parameterTag.preParameterName || parameterTag.postParameterName; if (name_6.text === parameterName) { - return t; + return parameterTag; } } - }); + } } } + return undefined; } ts.getCorrespondingJSDocParameterTag = getCorrespondingJSDocParameterTag; function hasRestParameter(s) { return isRestParameter(ts.lastOrUndefined(s.parameters)); } ts.hasRestParameter = hasRestParameter; + function hasDeclaredRestParameter(s) { + return isDeclaredRestParam(ts.lastOrUndefined(s.parameters)); + } + ts.hasDeclaredRestParameter = hasDeclaredRestParameter; function isRestParameter(node) { - if (node) { - if (node.parserContextFlags & 32) { - if (node.type && node.type.kind === 262) { - return true; - } - var paramTag = getCorrespondingJSDocParameterTag(node); - if (paramTag && paramTag.typeExpression) { - return paramTag.typeExpression.type.kind === 262; - } + if (node && (node.flags & 134217728)) { + if (node.type && node.type.kind === 270) { + return true; + } + var paramTag = getCorrespondingJSDocParameterTag(node); + if (paramTag && paramTag.typeExpression) { + return paramTag.typeExpression.type.kind === 270; } - return node.dotDotDotToken !== undefined; } - return false; + return isDeclaredRestParam(node); } ts.isRestParameter = isRestParameter; + function isDeclaredRestParam(node) { + return node && node.dotDotDotToken !== undefined; + } + ts.isDeclaredRestParam = isDeclaredRestParam; function isLiteralKind(kind) { return 8 <= kind && kind <= 11; } @@ -4121,9 +4712,31 @@ var ts; } ts.isTemplateLiteralKind = isTemplateLiteralKind; function isBindingPattern(node) { - return !!node && (node.kind === 162 || node.kind === 161); + return !!node && (node.kind === 168 || node.kind === 167); } ts.isBindingPattern = isBindingPattern; + function isAssignmentTarget(node) { + while (node.parent.kind === 178) { + node = node.parent; + } + while (true) { + var parent_4 = node.parent; + if (parent_4.kind === 170 || parent_4.kind === 191) { + node = parent_4; + continue; + } + if (parent_4.kind === 253 || parent_4.kind === 254) { + node = parent_4.parent; + continue; + } + return parent_4.kind === 187 && + parent_4.operatorToken.kind === 56 && + parent_4.left === node || + (parent_4.kind === 207 || parent_4.kind === 208) && + parent_4.initializer === node; + } + } + ts.isAssignmentTarget = isAssignmentTarget; function isNodeDescendentOf(node, ancestor) { while (node) { if (node === ancestor) @@ -4135,7 +4748,7 @@ var ts; ts.isNodeDescendentOf = isNodeDescendentOf; function isInAmbientContext(node) { while (node) { - if (node.flags & (4 | 4096)) { + if (node.flags & 2 || (node.kind === 256 && node.isDeclarationFile)) { return true; } node = node.parent; @@ -4145,34 +4758,34 @@ var ts; ts.isInAmbientContext = isInAmbientContext; function isDeclaration(node) { switch (node.kind) { - case 174: - case 163: - case 214: - case 186: - case 144: - case 217: - case 247: - case 230: - case 213: - case 173: - case 145: - case 223: + case 180: + case 169: case 221: - case 226: - case 215: - case 143: - case 142: - case 218: + case 192: + case 148: case 224: - case 138: - case 245: - case 141: - case 140: + case 255: + case 238: + case 220: + case 179: + case 149: + case 231: + case 229: + case 234: + case 222: + case 147: case 146: - case 246: - case 216: - case 137: - case 211: + case 225: + case 232: + case 142: + case 253: + case 145: + case 144: + case 150: + case 254: + case 223: + case 141: + case 218: return true; } return false; @@ -4180,25 +4793,25 @@ var ts; ts.isDeclaration = isDeclaration; function isStatement(n) { switch (n.kind) { - case 203: - case 202: case 210: - case 197: - case 195: - case 194: - case 200: - case 201: - case 199: - case 196: - case 207: - case 204: - case 206: - case 208: case 209: - case 193: - case 198: + case 217: + case 204: + case 202: + case 201: + case 207: + case 208: + case 206: + case 203: + case 214: + case 211: + case 213: + case 215: + case 216: + case 200: case 205: - case 227: + case 212: + case 235: return true; default: return false; @@ -4207,13 +4820,13 @@ var ts; ts.isStatement = isStatement; function isClassElement(n) { switch (n.kind) { - case 144: - case 141: - case 143: + case 148: case 145: - case 146: - case 142: + case 147: case 149: + case 150: + case 146: + case 153: return true; default: return false; @@ -4225,7 +4838,7 @@ var ts; return false; } var parent = name.parent; - if (parent.kind === 226 || parent.kind === 230) { + if (parent.kind === 234 || parent.kind === 238) { if (parent.propertyName) { return true; } @@ -4236,43 +4849,50 @@ var ts; return false; } ts.isDeclarationName = isDeclarationName; + function isLiteralComputedPropertyDeclarationName(node) { + return (node.kind === 9 || node.kind === 8) && + node.parent.kind === 140 && + isDeclaration(node.parent.parent); + } + ts.isLiteralComputedPropertyDeclarationName = isLiteralComputedPropertyDeclarationName; function isIdentifierName(node) { var parent = node.parent; switch (parent.kind) { - case 141: - case 140: - case 143: - case 142: case 145: + case 144: + case 147: case 146: - case 247: - case 245: - case 166: + case 149: + case 150: + case 255: + case 253: + case 172: return parent.name === node; - case 135: + case 139: if (parent.right === node) { - while (parent.kind === 135) { + while (parent.kind === 139) { parent = parent.parent; } - return parent.kind === 154; + return parent.kind === 158; } return false; - case 163: - case 226: + case 169: + case 234: return parent.propertyName === node; - case 230: + case 238: return true; } return false; } ts.isIdentifierName = isIdentifierName; function isAliasSymbolDeclaration(node) { - return node.kind === 221 || - node.kind === 223 && !!node.name || - node.kind === 224 || - node.kind === 226 || - node.kind === 230 || - node.kind === 227 && node.expression.kind === 69; + return node.kind === 229 || + node.kind === 228 || + node.kind === 231 && !!node.name || + node.kind === 232 || + node.kind === 234 || + node.kind === 238 || + node.kind === 235 && node.expression.kind === 69; } ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration; function getClassExtendsHeritageClauseElement(node) { @@ -4329,32 +4949,32 @@ var ts; }; } else { - var matchResult = ts.fullTripleSlashReferencePathRegEx.exec(comment); - if (matchResult) { + var refMatchResult = ts.fullTripleSlashReferencePathRegEx.exec(comment); + var refLibResult = !refMatchResult && ts.fullTripleSlashReferenceTypeReferenceDirectiveRegEx.exec(comment); + if (refMatchResult || refLibResult) { var start = commentRange.pos; var end = commentRange.end; return { fileReference: { pos: start, end: end, - fileName: matchResult[3] + fileName: (refMatchResult || refLibResult)[3] }, - isNoDefaultLib: false - }; - } - else { - return { - diagnosticMessage: ts.Diagnostics.Invalid_reference_directive_syntax, - isNoDefaultLib: false + isNoDefaultLib: false, + isTypeReferenceDirective: !!refLibResult }; } + return { + diagnosticMessage: ts.Diagnostics.Invalid_reference_directive_syntax, + isNoDefaultLib: false + }; } } return undefined; } ts.getFileReferenceFromReferencePath = getFileReferenceFromReferencePath; function isKeyword(token) { - return 70 <= token && token <= 134; + return 70 <= token && token <= 138; } ts.isKeyword = isKeyword; function isTrivia(token) { @@ -4374,7 +4994,7 @@ var ts; } ts.hasDynamicName = hasDynamicName; function isDynamicName(name) { - return name.kind === 136 && + return name.kind === 140 && !isStringOrNumericLiteral(name.expression.kind) && !isWellKnownSymbolSyntactically(name.expression); } @@ -4387,12 +5007,15 @@ var ts; if (name.kind === 69 || name.kind === 9 || name.kind === 8) { return name.text; } - if (name.kind === 136) { + if (name.kind === 140) { var nameExpression = name.expression; if (isWellKnownSymbolSyntactically(nameExpression)) { var rightHandSideName = nameExpression.name.text; return getPropertyNameForKnownSymbolName(rightHandSideName); } + else if (nameExpression.kind === 9 || nameExpression.kind === 8) { + return nameExpression.text; + } } return undefined; } @@ -4405,7 +5028,7 @@ var ts; return node.kind === 69 && node.text === "Symbol"; } ts.isESSymbolIdentifier = isESSymbolIdentifier; - function isModifier(token) { + function isModifierKind(token) { switch (token) { case 115: case 118: @@ -4416,44 +5039,62 @@ var ts; case 112: case 110: case 111: + case 128: case 113: return true; } return false; } - ts.isModifier = isModifier; + ts.isModifierKind = isModifierKind; function isParameterDeclaration(node) { var root = getRootDeclaration(node); - return root.kind === 138; + return root.kind === 142; } ts.isParameterDeclaration = isParameterDeclaration; function getRootDeclaration(node) { - while (node.kind === 163) { + while (node.kind === 169) { node = node.parent.parent; } return node; } ts.getRootDeclaration = getRootDeclaration; function nodeStartsNewLexicalEnvironment(n) { - return isFunctionLike(n) || n.kind === 218 || n.kind === 248; + return isFunctionLike(n) || n.kind === 225 || n.kind === 256; } ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; - function cloneEntityName(node) { - if (node.kind === 69) { - var clone_1 = createSynthesizedNode(69); - clone_1.text = node.text; - return clone_1; + function cloneNode(node, location, flags, parent) { + var clone = location !== undefined + ? ts.createNode(node.kind, location.pos, location.end) + : createSynthesizedNode(node.kind); + for (var key in node) { + if (clone.hasOwnProperty(key) || !node.hasOwnProperty(key)) { + continue; + } + clone[key] = node[key]; } - else { - var clone_2 = createSynthesizedNode(135); - clone_2.left = cloneEntityName(node.left); - clone_2.left.parent = clone_2; - clone_2.right = cloneEntityName(node.right); - clone_2.right.parent = clone_2; - return clone_2; + if (flags !== undefined) { + clone.flags = flags; } + if (parent !== undefined) { + clone.parent = parent; + } + return clone; + } + ts.cloneNode = cloneNode; + function cloneEntityName(node, parent) { + var clone = cloneNode(node, node, node.flags, parent); + if (isQualifiedName(clone)) { + var left = clone.left, right = clone.right; + clone.left = cloneEntityName(left, clone); + clone.right = cloneNode(right, right, right.flags, parent); + } + return clone; } ts.cloneEntityName = cloneEntityName; + function isQualifiedName(node) { + return node.kind === 139; + } + ts.isQualifiedName = isQualifiedName; function nodeIsSynthesized(node) { return node.pos === -1; } @@ -4656,8 +5297,8 @@ var ts; writeTextOfNode: writeTextOfNode, writeLiteral: writeLiteral, writeLine: writeLine, - increaseIndent: function () { return indent++; }, - decreaseIndent: function () { return indent--; }, + increaseIndent: function () { indent++; }, + decreaseIndent: function () { indent--; }, getIndent: function () { return indent; }, getTextPos: function () { return output.length; }, getLine: function () { return lineCount + 1; }, @@ -4668,8 +5309,10 @@ var ts; } ts.createTextWriter = createTextWriter; function getExternalModuleNameFromPath(host, fileName) { - var dir = host.getCurrentDirectory(); - var relativePath = ts.getRelativePathToDirectoryOrUrl(dir, fileName, dir, function (f) { return host.getCanonicalFileName(f); }, false); + var getCanonicalFileName = function (f) { return host.getCanonicalFileName(f); }; + var dir = ts.toPath(host.getCommonSourceDirectory(), host.getCurrentDirectory(), getCanonicalFileName); + var filePath = ts.getNormalizedAbsolutePath(fileName, host.getCurrentDirectory()); + var relativePath = ts.getRelativePathToDirectoryOrUrl(dir, filePath, dir, getCanonicalFileName, false); return ts.removeFileExtension(relativePath); } ts.getExternalModuleNameFromPath = getExternalModuleNameFromPath; @@ -4685,16 +5328,91 @@ var ts; return emitOutputFilePathWithoutExtension + extension; } ts.getOwnEmitOutputFilePath = getOwnEmitOutputFilePath; + function getDeclarationEmitOutputFilePath(sourceFile, host) { + var options = host.getCompilerOptions(); + var outputDir = options.declarationDir || options.outDir; + if (options.declaration) { + var path = outputDir + ? getSourceFilePathInNewDir(sourceFile, host, outputDir) + : sourceFile.fileName; + return ts.removeFileExtension(path) + ".d.ts"; + } + } + ts.getDeclarationEmitOutputFilePath = getDeclarationEmitOutputFilePath; + function getEmitScriptTarget(compilerOptions) { + return compilerOptions.target || 0; + } + ts.getEmitScriptTarget = getEmitScriptTarget; + function getEmitModuleKind(compilerOptions) { + return typeof compilerOptions.module === "number" ? + compilerOptions.module : + getEmitScriptTarget(compilerOptions) === 2 ? ts.ModuleKind.ES6 : ts.ModuleKind.CommonJS; + } + ts.getEmitModuleKind = getEmitModuleKind; + function forEachExpectedEmitFile(host, action, targetSourceFile) { + var options = host.getCompilerOptions(); + if (options.outFile || options.out) { + onBundledEmit(host); + } + else { + var sourceFiles = targetSourceFile === undefined ? host.getSourceFiles() : [targetSourceFile]; + for (var _i = 0, sourceFiles_1 = sourceFiles; _i < sourceFiles_1.length; _i++) { + var sourceFile = sourceFiles_1[_i]; + if (!isDeclarationFile(sourceFile)) { + onSingleFileEmit(host, sourceFile); + } + } + } + function onSingleFileEmit(host, sourceFile) { + var extension = ".js"; + if (options.jsx === 1) { + if (isSourceFileJavaScript(sourceFile)) { + if (ts.fileExtensionIs(sourceFile.fileName, ".jsx")) { + extension = ".jsx"; + } + } + else if (sourceFile.languageVariant === 1) { + extension = ".jsx"; + } + } + var jsFilePath = getOwnEmitOutputFilePath(sourceFile, host, extension); + var emitFileNames = { + jsFilePath: jsFilePath, + sourceMapFilePath: getSourceMapFilePath(jsFilePath, options), + declarationFilePath: !isSourceFileJavaScript(sourceFile) ? getDeclarationEmitOutputFilePath(sourceFile, host) : undefined + }; + action(emitFileNames, [sourceFile], false); + } + function onBundledEmit(host) { + var bundledSources = ts.filter(host.getSourceFiles(), function (sourceFile) { + return !isDeclarationFile(sourceFile) + && (!ts.isExternalModule(sourceFile) || !!getEmitModuleKind(options)); + }); + if (bundledSources.length) { + var jsFilePath = options.outFile || options.out; + var emitFileNames = { + jsFilePath: jsFilePath, + sourceMapFilePath: getSourceMapFilePath(jsFilePath, options), + declarationFilePath: options.declaration ? ts.removeFileExtension(jsFilePath) + ".d.ts" : undefined + }; + action(emitFileNames, bundledSources, true); + } + } + function getSourceMapFilePath(jsFilePath, options) { + return options.sourceMap ? jsFilePath + ".map" : undefined; + } + } + ts.forEachExpectedEmitFile = forEachExpectedEmitFile; function getSourceFilePathInNewDir(sourceFile, host, newDirPath) { var sourceFilePath = ts.getNormalizedAbsolutePath(sourceFile.fileName, host.getCurrentDirectory()); sourceFilePath = sourceFilePath.replace(host.getCommonSourceDirectory(), ""); return ts.combinePaths(newDirPath, sourceFilePath); } ts.getSourceFilePathInNewDir = getSourceFilePathInNewDir; - function writeFile(host, diagnostics, fileName, data, writeByteOrderMark) { + function writeFile(host, diagnostics, fileName, data, writeByteOrderMark, sourceFiles) { host.writeFile(fileName, data, writeByteOrderMark, function (hostErrorMessage) { - diagnostics.push(ts.createCompilerDiagnostic(ts.Diagnostics.Could_not_write_file_0_Colon_1, fileName, hostErrorMessage)); - }); + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Could_not_write_file_0_Colon_1, fileName, hostErrorMessage)); + }, sourceFiles); } ts.writeFile = writeFile; function getLineOfLocalPosition(currentSourceFile, pos) { @@ -4707,26 +5425,21 @@ var ts; ts.getLineOfLocalPositionFromLineMap = getLineOfLocalPositionFromLineMap; function getFirstConstructorWithBody(node) { return ts.forEach(node.members, function (member) { - if (member.kind === 144 && nodeIsPresent(member.body)) { + if (member.kind === 148 && nodeIsPresent(member.body)) { return member; } }); } ts.getFirstConstructorWithBody = getFirstConstructorWithBody; function getSetAccessorTypeAnnotationNode(accessor) { - return accessor && accessor.parameters.length > 0 && accessor.parameters[0].type; + if (accessor && accessor.parameters.length > 0) { + var hasThis = accessor.parameters.length === 2 && + accessor.parameters[0].name.kind === 69 && + accessor.parameters[0].name.originalKeywordKind === 97; + return accessor.parameters[hasThis ? 1 : 0].type; + } } ts.getSetAccessorTypeAnnotationNode = getSetAccessorTypeAnnotationNode; - function shouldEmitToOwnFile(sourceFile, compilerOptions) { - if (!isDeclarationFile(sourceFile)) { - if ((isExternalModule(sourceFile) || !(compilerOptions.outFile || compilerOptions.out))) { - return compilerOptions.isolatedModules || !ts.fileExtensionIs(sourceFile.fileName, ".js"); - } - return false; - } - return false; - } - ts.shouldEmitToOwnFile = shouldEmitToOwnFile; function getAllAccessorDeclarations(declarations, accessor) { var firstAccessor; var secondAccessor; @@ -4734,10 +5447,10 @@ var ts; var setAccessor; if (hasDynamicName(accessor)) { firstAccessor = accessor; - if (accessor.kind === 145) { + if (accessor.kind === 149) { getAccessor = accessor; } - else if (accessor.kind === 146) { + else if (accessor.kind === 150) { setAccessor = accessor; } else { @@ -4746,8 +5459,8 @@ var ts; } else { ts.forEach(declarations, function (member) { - if ((member.kind === 145 || member.kind === 146) - && (member.flags & 64) === (accessor.flags & 64)) { + if ((member.kind === 149 || member.kind === 150) + && (member.flags & 32) === (accessor.flags & 32)) { var memberName = getPropertyNameForPropertyNameNode(member.name); var accessorName = getPropertyNameForPropertyNameNode(accessor.name); if (memberName === accessorName) { @@ -4757,10 +5470,10 @@ var ts; else if (!secondAccessor) { secondAccessor = member; } - if (member.kind === 145 && !getAccessor) { + if (member.kind === 149 && !getAccessor) { getAccessor = member; } - if (member.kind === 146 && !setAccessor) { + if (member.kind === 150 && !setAccessor) { setAccessor = member; } } @@ -4815,7 +5528,7 @@ var ts; } if (leadingComments) { var detachedComments = []; - var lastComment; + var lastComment = void 0; for (var _i = 0, leadingComments_1 = leadingComments; _i < leadingComments_1.length; _i++) { var comment = leadingComments_1[_i]; if (lastComment) { @@ -4849,7 +5562,7 @@ var ts; if (text.charCodeAt(comment.pos + 1) === 42) { var firstCommentLineAndCharacter = ts.computeLineAndCharacterOfPosition(lineMap, comment.pos); var lineCount = lineMap.length; - var firstCommentLineIndent; + var firstCommentLineIndent = void 0; for (var pos = comment.pos, currentLine = firstCommentLineAndCharacter.line; pos < comment.end; currentLine++) { var nextLineStart = (currentLine + 1) === lineCount ? text.length + 1 @@ -4909,16 +5622,17 @@ var ts; } function modifierToFlag(token) { switch (token) { - case 113: return 64; - case 112: return 8; - case 111: return 32; - case 110: return 16; + case 113: return 32; + case 112: return 4; + case 111: return 16; + case 110: return 8; case 115: return 128; - case 82: return 2; - case 122: return 4; - case 74: return 16384; + case 82: return 1; + case 122: return 2; + case 74: return 2048; case 77: return 512; case 118: return 256; + case 128: return 64; } return 0; } @@ -4926,24 +5640,25 @@ var ts; function isLeftHandSideExpression(expr) { if (expr) { switch (expr.kind) { - case 166: - case 167: - case 169: - case 168: - case 233: - case 234: - case 170: - case 164: case 172: - case 165: - case 186: case 173: + case 175: + case 174: + case 196: + case 241: + case 242: + case 176: + case 170: + case 178: + case 171: + case 192: + case 179: case 69: case 10: case 8: case 9: case 11: - case 183: + case 189: case 84: case 93: case 97: @@ -4960,7 +5675,7 @@ var ts; } ts.isAssignmentOperator = isAssignmentOperator; function isExpressionWithTypeArgumentsInClassExtendsClause(node) { - return node.kind === 188 && + return node.kind === 194 && node.parent.token === 83 && isClassLike(node.parent.parent); } @@ -4981,16 +5696,16 @@ var ts; } } function isRightSideOfQualifiedNameOrPropertyAccess(node) { - return (node.parent.kind === 135 && node.parent.right === node) || - (node.parent.kind === 166 && node.parent.name === node); + return (node.parent.kind === 139 && node.parent.right === node) || + (node.parent.kind === 172 && node.parent.name === node); } ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess; function isEmptyObjectLiteralOrArrayLiteral(expression) { var kind = expression.kind; - if (kind === 165) { + if (kind === 171) { return expression.properties.length === 0; } - if (kind === 164) { + if (kind === 170) { return expression.elements.length === 0; } return false; @@ -5001,13 +5716,9 @@ var ts; } ts.getLocalSymbolForExportDefault = getLocalSymbolForExportDefault; function hasJavaScriptFileExtension(fileName) { - return ts.fileExtensionIs(fileName, ".js") || ts.fileExtensionIs(fileName, ".jsx"); + return ts.forEach(ts.supportedJavascriptExtensions, function (extension) { return ts.fileExtensionIs(fileName, extension); }); } ts.hasJavaScriptFileExtension = hasJavaScriptFileExtension; - function allowsJsxExpressions(fileName) { - return ts.fileExtensionIs(fileName, ".tsx") || ts.fileExtensionIs(fileName, ".jsx"); - } - ts.allowsJsxExpressions = allowsJsxExpressions; function getExpandedCharCodes(input) { var output = []; var length = input.length; @@ -5037,6 +5748,39 @@ var ts; } return output; } + ts.stringify = typeof JSON !== "undefined" && JSON.stringify + ? JSON.stringify + : stringifyFallback; + function stringifyFallback(value) { + return value === undefined ? undefined : stringifyValue(value); + } + function stringifyValue(value) { + return typeof value === "string" ? "\"" + escapeString(value) + "\"" + : typeof value === "number" ? isFinite(value) ? String(value) : "null" + : typeof value === "boolean" ? value ? "true" : "false" + : typeof value === "object" && value ? ts.isArray(value) ? cycleCheck(stringifyArray, value) : cycleCheck(stringifyObject, value) + : "null"; + } + function cycleCheck(cb, value) { + ts.Debug.assert(!value.hasOwnProperty("__cycle"), "Converting circular structure to JSON"); + value.__cycle = true; + var result = cb(value); + delete value.__cycle; + return result; + } + function stringifyArray(value) { + return "[" + ts.reduceLeft(value, stringifyElement, "") + "]"; + } + function stringifyElement(memo, value) { + return (memo ? memo + "," : memo) + stringifyValue(value); + } + function stringifyObject(value) { + return "{" + ts.reduceProperties(value, stringifyProperty, "") + "}"; + } + function stringifyProperty(memo, value, key) { + return value === undefined || typeof value === "function" || key === "__cycle" ? memo + : (memo ? memo + "," : memo) + ("\"" + escapeString(key) + "\":" + stringifyValue(value)); + } var base64Digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; function convertToBase64(input) { var result = ""; @@ -5082,6 +5826,10 @@ var ts; return carriageReturnLineFeed; } ts.getNewLineCharacter = getNewLineCharacter; + function isWatchSet(options) { + return options.watch && options.hasOwnProperty("watch"); + } + ts.isWatchSet = isWatchSet; })(ts || (ts = {})); var ts; (function (ts) { @@ -5205,15 +5953,28 @@ var ts; } ts.collapseTextChangeRangesAcrossMultipleVersions = collapseTextChangeRangesAcrossMultipleVersions; function getTypeParameterOwner(d) { - if (d && d.kind === 137) { + if (d && d.kind === 141) { for (var current = d; current; current = current.parent) { - if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 215) { + if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 222) { return current; } } } } ts.getTypeParameterOwner = getTypeParameterOwner; + function isParameterPropertyDeclaration(node) { + return node.flags & 92 && node.parent.kind === 148 && ts.isClassLike(node.parent.parent); + } + ts.isParameterPropertyDeclaration = isParameterPropertyDeclaration; + function startsWith(str, prefix) { + return str.lastIndexOf(prefix, 0) === 0; + } + ts.startsWith = startsWith; + function endsWith(str, suffix) { + var expectedPos = str.length - suffix.length; + return str.indexOf(suffix, expectedPos) === expectedPos; + } + ts.endsWith = endsWith; })(ts || (ts = {})); var ts; (function (ts) { @@ -5221,7 +5982,7 @@ var ts; var NodeConstructor; var SourceFileConstructor; function createNode(kind, pos, end) { - if (kind === 248) { + if (kind === 256) { return new (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor()))(kind, pos, end); } else { @@ -5257,26 +6018,26 @@ var ts; var visitNodes = cbNodeArray ? visitNodeArray : visitEachNode; var cbNodes = cbNodeArray || cbNode; switch (node.kind) { - case 135: + case 139: return visitNode(cbNode, node.left) || visitNode(cbNode, node.right); - case 137: + case 141: return visitNode(cbNode, node.name) || visitNode(cbNode, node.constraint) || visitNode(cbNode, node.expression); - case 246: + case 254: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.equalsToken) || visitNode(cbNode, node.objectAssignmentInitializer); - case 138: - case 141: - case 140: - case 245: - case 211: - case 163: + case 142: + case 145: + case 144: + case 253: + case 218: + case 169: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.propertyName) || @@ -5285,24 +6046,24 @@ var ts; visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.type) || visitNode(cbNode, node.initializer); + case 156: + case 157: + case 151: case 152: case 153: - case 147: - case 148: - case 149: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type); - case 143: - case 142: - case 144: - case 145: + case 147: case 146: - case 173: - case 213: - case 174: + case 148: + case 149: + case 150: + case 179: + case 220: + case 180: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.asteriskToken) || @@ -5313,302 +6074,310 @@ var ts; visitNode(cbNode, node.type) || visitNode(cbNode, node.equalsGreaterThanToken) || visitNode(cbNode, node.body); - case 151: + case 155: return visitNode(cbNode, node.typeName) || visitNodes(cbNodes, node.typeArguments); - case 150: + case 154: return visitNode(cbNode, node.parameterName) || visitNode(cbNode, node.type); - case 154: - return visitNode(cbNode, node.exprName); - case 155: - return visitNodes(cbNodes, node.members); - case 156: - return visitNode(cbNode, node.elementType); - case 157: - return visitNodes(cbNodes, node.elementTypes); case 158: + return visitNode(cbNode, node.exprName); case 159: - return visitNodes(cbNodes, node.types); + return visitNodes(cbNodes, node.members); case 160: - return visitNode(cbNode, node.type); + return visitNode(cbNode, node.elementType); case 161: + return visitNodes(cbNodes, node.elementTypes); case 162: - return visitNodes(cbNodes, node.elements); + case 163: + return visitNodes(cbNodes, node.types); case 164: + return visitNode(cbNode, node.type); + case 167: + case 168: return visitNodes(cbNodes, node.elements); - case 165: + case 170: + return visitNodes(cbNodes, node.elements); + case 171: return visitNodes(cbNodes, node.properties); - case 166: + case 172: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.dotToken) || visitNode(cbNode, node.name); - case 167: + case 173: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.argumentExpression); - case 168: - case 169: + case 174: + case 175: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments) || visitNodes(cbNodes, node.arguments); - case 170: + case 176: return visitNode(cbNode, node.tag) || visitNode(cbNode, node.template); - case 171: - return visitNode(cbNode, node.type) || - visitNode(cbNode, node.expression); - case 172: - return visitNode(cbNode, node.expression); - case 175: - return visitNode(cbNode, node.expression); - case 176: - return visitNode(cbNode, node.expression); case 177: - return visitNode(cbNode, node.expression); - case 179: - return visitNode(cbNode, node.operand); - case 184: - return visitNode(cbNode, node.asteriskToken) || + return visitNode(cbNode, node.type) || visitNode(cbNode, node.expression); case 178: return visitNode(cbNode, node.expression); - case 180: - return visitNode(cbNode, node.operand); case 181: + return visitNode(cbNode, node.expression); + case 182: + return visitNode(cbNode, node.expression); + case 183: + return visitNode(cbNode, node.expression); + case 185: + return visitNode(cbNode, node.operand); + case 190: + return visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.expression); + case 184: + return visitNode(cbNode, node.expression); + case 186: + return visitNode(cbNode, node.operand); + case 187: return visitNode(cbNode, node.left) || visitNode(cbNode, node.operatorToken) || visitNode(cbNode, node.right); - case 189: + case 195: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.type); - case 182: + case 196: + return visitNode(cbNode, node.expression); + case 188: return visitNode(cbNode, node.condition) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.whenTrue) || visitNode(cbNode, node.colonToken) || visitNode(cbNode, node.whenFalse); - case 185: + case 191: return visitNode(cbNode, node.expression); - case 192: - case 219: + case 199: + case 226: return visitNodes(cbNodes, node.statements); - case 248: + case 256: return visitNodes(cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); - case 193: + case 200: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.declarationList); - case 212: + case 219: return visitNodes(cbNodes, node.declarations); - case 195: + case 202: return visitNode(cbNode, node.expression); - case 196: + case 203: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.thenStatement) || visitNode(cbNode, node.elseStatement); - case 197: + case 204: return visitNode(cbNode, node.statement) || visitNode(cbNode, node.expression); - case 198: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 199: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.condition) || - visitNode(cbNode, node.incrementor) || - visitNode(cbNode, node.statement); - case 200: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 201: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 202: - case 203: - return visitNode(cbNode, node.label); - case 204: - return visitNode(cbNode, node.expression); case 205: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); case 206: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.caseBlock); - case 220: - return visitNodes(cbNodes, node.clauses); - case 241: - return visitNode(cbNode, node.expression) || - visitNodes(cbNodes, node.statements); - case 242: - return visitNodes(cbNodes, node.statements); + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.condition) || + visitNode(cbNode, node.incrementor) || + visitNode(cbNode, node.statement); case 207: - return visitNode(cbNode, node.label) || + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); case 208: - return visitNode(cbNode, node.expression); + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); case 209: + case 210: + return visitNode(cbNode, node.label); + case 211: + return visitNode(cbNode, node.expression); + case 212: + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + case 213: + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.caseBlock); + case 227: + return visitNodes(cbNodes, node.clauses); + case 249: + return visitNode(cbNode, node.expression) || + visitNodes(cbNodes, node.statements); + case 250: + return visitNodes(cbNodes, node.statements); + case 214: + return visitNode(cbNode, node.label) || + visitNode(cbNode, node.statement); + case 215: + return visitNode(cbNode, node.expression); + case 216: return visitNode(cbNode, node.tryBlock) || visitNode(cbNode, node.catchClause) || visitNode(cbNode, node.finallyBlock); - case 244: + case 252: return visitNode(cbNode, node.variableDeclaration) || visitNode(cbNode, node.block); - case 139: + case 143: return visitNode(cbNode, node.expression); - case 214: - case 186: + case 221: + case 192: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.heritageClauses) || visitNodes(cbNodes, node.members); - case 215: + case 222: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.heritageClauses) || visitNodes(cbNodes, node.members); - case 216: + case 223: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNode(cbNode, node.type); - case 217: + case 224: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.members); - case 247: + case 255: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 218: + case 225: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.body); - case 221: + case 229: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); - case 222: + case 230: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.importClause) || visitNode(cbNode, node.moduleSpecifier); - case 223: + case 231: return visitNode(cbNode, node.name) || visitNode(cbNode, node.namedBindings); - case 224: - return visitNode(cbNode, node.name); - case 225: - case 229: - return visitNodes(cbNodes, node.elements); case 228: + return visitNode(cbNode, node.name); + case 232: + return visitNode(cbNode, node.name); + case 233: + case 237: + return visitNodes(cbNodes, node.elements); + case 236: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.exportClause) || visitNode(cbNode, node.moduleSpecifier); - case 226: - case 230: + case 234: + case 238: return visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.name); - case 227: + case 235: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.expression); - case 183: + case 189: return visitNode(cbNode, node.head) || visitNodes(cbNodes, node.templateSpans); - case 190: + case 197: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal); - case 136: + case 140: return visitNode(cbNode, node.expression); - case 243: + case 251: return visitNodes(cbNodes, node.types); - case 188: + case 194: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments); - case 232: + case 240: return visitNode(cbNode, node.expression); - case 231: + case 239: return visitNodes(cbNodes, node.decorators); - case 233: + case 241: return visitNode(cbNode, node.openingElement) || visitNodes(cbNodes, node.children) || visitNode(cbNode, node.closingElement); - case 234: - case 235: + case 242: + case 243: return visitNode(cbNode, node.tagName) || visitNodes(cbNodes, node.attributes); - case 238: + case 246: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 239: + case 247: return visitNode(cbNode, node.expression); - case 240: + case 248: return visitNode(cbNode, node.expression); - case 237: + case 245: return visitNode(cbNode, node.tagName); - case 249: - return visitNode(cbNode, node.type); - case 253: - return visitNodes(cbNodes, node.types); - case 254: - return visitNodes(cbNodes, node.types); - case 252: - return visitNode(cbNode, node.elementType); - case 256: - return visitNode(cbNode, node.type); - case 255: - return visitNode(cbNode, node.type); case 257: - return visitNodes(cbNodes, node.members); - case 259: - return visitNode(cbNode, node.name) || - visitNodes(cbNodes, node.typeArguments); - case 260: return visitNode(cbNode, node.type); case 261: - return visitNodes(cbNodes, node.parameters) || - visitNode(cbNode, node.type); + return visitNodes(cbNodes, node.types); case 262: + return visitNodes(cbNodes, node.types); + case 260: + return visitNode(cbNode, node.elementType); + case 264: return visitNode(cbNode, node.type); case 263: return visitNode(cbNode, node.type); - case 264: + case 265: + return visitNodes(cbNodes, node.members); + case 267: + return visitNode(cbNode, node.name) || + visitNodes(cbNodes, node.typeArguments); + case 268: return visitNode(cbNode, node.type); - case 258: + case 269: + return visitNodes(cbNodes, node.parameters) || + visitNode(cbNode, node.type); + case 270: + return visitNode(cbNode, node.type); + case 271: + return visitNode(cbNode, node.type); + case 272: + return visitNode(cbNode, node.type); + case 266: return visitNode(cbNode, node.name) || visitNode(cbNode, node.type); - case 265: + case 273: return visitNodes(cbNodes, node.tags); - case 267: + case 275: return visitNode(cbNode, node.preParameterName) || visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.postParameterName); - case 268: + case 276: return visitNode(cbNode, node.typeExpression); - case 269: + case 277: return visitNode(cbNode, node.typeExpression); - case 270: + case 278: return visitNodes(cbNodes, node.typeParameters); } } ts.forEachChild = forEachChild; - function createSourceFile(fileName, sourceText, languageVersion, setParentNodes) { + function createSourceFile(fileName, sourceText, languageVersion, setParentNodes, scriptKind) { if (setParentNodes === void 0) { setParentNodes = false; } var start = new Date().getTime(); - var result = Parser.parseSourceFile(fileName, sourceText, languageVersion, undefined, setParentNodes); + var result = Parser.parseSourceFile(fileName, sourceText, languageVersion, undefined, setParentNodes, scriptKind); ts.parseTime += new Date().getTime() - start; return result; } ts.createSourceFile = createSourceFile; + function isExternalModule(file) { + return file.externalModuleIndicator !== undefined; + } + ts.isExternalModule = isExternalModule; function updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks) { return IncrementalParser.updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks); } @@ -5624,7 +6393,7 @@ var ts; var Parser; (function (Parser) { var scanner = ts.createScanner(2, true); - var disallowInAndDecoratorContext = 1 | 4; + var disallowInAndDecoratorContext = 4194304 | 16777216; var NodeConstructor; var SourceFileConstructor; var sourceFile; @@ -5638,15 +6407,18 @@ var ts; var parsingContext; var contextFlags; var parseErrorBeforeNextFinishedNode = false; - function parseSourceFile(fileName, _sourceText, languageVersion, _syntaxCursor, setParentNodes) { - var isJavaScriptFile = ts.hasJavaScriptFileExtension(fileName) || _sourceText.lastIndexOf("// @language=javascript", 0) === 0; - initializeState(fileName, _sourceText, languageVersion, isJavaScriptFile, _syntaxCursor); - var result = parseSourceFileWorker(fileName, languageVersion, setParentNodes); + function parseSourceFile(fileName, _sourceText, languageVersion, _syntaxCursor, setParentNodes, scriptKind) { + scriptKind = ts.ensureScriptKind(fileName, scriptKind); + initializeState(fileName, _sourceText, languageVersion, _syntaxCursor, scriptKind); + var result = parseSourceFileWorker(fileName, languageVersion, setParentNodes, scriptKind); clearState(); return result; } Parser.parseSourceFile = parseSourceFile; - function initializeState(fileName, _sourceText, languageVersion, isJavaScriptFile, _syntaxCursor) { + function getLanguageVariant(scriptKind) { + return scriptKind === 4 || scriptKind === 2 || scriptKind === 1 ? 1 : 0; + } + function initializeState(fileName, _sourceText, languageVersion, _syntaxCursor, scriptKind) { NodeConstructor = ts.objectAllocator.getNodeConstructor(); SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor(); sourceText = _sourceText; @@ -5656,12 +6428,12 @@ var ts; identifiers = {}; identifierCount = 0; nodeCount = 0; - contextFlags = isJavaScriptFile ? 32 : 0; + contextFlags = scriptKind === 1 || scriptKind === 2 ? 134217728 : 0; parseErrorBeforeNextFinishedNode = false; scanner.setText(sourceText); scanner.setOnError(scanError); scanner.setScriptTarget(languageVersion); - scanner.setLanguageVariant(ts.allowsJsxExpressions(fileName) ? 1 : 0); + scanner.setLanguageVariant(getLanguageVariant(scriptKind)); } function clearState() { scanner.setText(""); @@ -5672,11 +6444,9 @@ var ts; syntaxCursor = undefined; sourceText = undefined; } - function parseSourceFileWorker(fileName, languageVersion, setParentNodes) { - sourceFile = createSourceFile(fileName, languageVersion); - if (contextFlags & 32) { - sourceFile.parserContextFlags = 32; - } + function parseSourceFileWorker(fileName, languageVersion, setParentNodes, scriptKind) { + sourceFile = createSourceFile(fileName, languageVersion, scriptKind); + sourceFile.flags = contextFlags; token = nextToken(); processReferenceComments(sourceFile); sourceFile.statements = parseList(0, parseStatement); @@ -5690,35 +6460,22 @@ var ts; if (setParentNodes) { fixupParentReferences(sourceFile); } - if (ts.isSourceFileJavaScript(sourceFile)) { - addJSDocComments(); - } return sourceFile; } - function addJSDocComments() { - forEachChild(sourceFile, visit); - return; - function visit(node) { - switch (node.kind) { - case 193: - case 213: - case 138: - addJSDocComment(node); - } - forEachChild(node, visit); - } - } function addJSDocComment(node) { - var comments = ts.getLeadingCommentRangesOfNode(node, sourceFile); - if (comments) { - for (var _i = 0, comments_1 = comments; _i < comments_1.length; _i++) { - var comment = comments_1[_i]; - var jsDocComment = JSDocParser.parseJSDocComment(node, comment.pos, comment.end - comment.pos); - if (jsDocComment) { - node.jsDocComment = jsDocComment; + if (contextFlags & 134217728) { + var comments = ts.getLeadingCommentRangesOfNode(node, sourceFile); + if (comments) { + for (var _i = 0, comments_1 = comments; _i < comments_1.length; _i++) { + var comment = comments_1[_i]; + var jsDocComment = JSDocParser.parseJSDocComment(node, comment.pos, comment.end - comment.pos); + if (jsDocComment) { + node.jsDocComment = jsDocComment; + } } } } + return node; } function fixupParentReferences(sourceFile) { var parent = sourceFile; @@ -5735,15 +6492,16 @@ var ts; } } Parser.fixupParentReferences = fixupParentReferences; - function createSourceFile(fileName, languageVersion) { - var sourceFile = new SourceFileConstructor(248, 0, sourceText.length); + function createSourceFile(fileName, languageVersion, scriptKind) { + var sourceFile = new SourceFileConstructor(256, 0, sourceText.length); nodeCount++; sourceFile.text = sourceText; sourceFile.bindDiagnostics = []; sourceFile.languageVersion = languageVersion; sourceFile.fileName = ts.normalizePath(fileName); - sourceFile.flags = ts.fileExtensionIs(sourceFile.fileName, ".d.ts") ? 4096 : 0; - sourceFile.languageVariant = ts.allowsJsxExpressions(sourceFile.fileName) ? 1 : 0; + sourceFile.languageVariant = getLanguageVariant(scriptKind); + sourceFile.isDeclarationFile = ts.fileExtensionIs(sourceFile.fileName, ".d.ts"); + sourceFile.scriptKind = scriptKind; return sourceFile; } function setContextFlag(val, flag) { @@ -5755,16 +6513,16 @@ var ts; } } function setDisallowInContext(val) { - setContextFlag(val, 1); + setContextFlag(val, 4194304); } function setYieldContext(val) { - setContextFlag(val, 2); + setContextFlag(val, 8388608); } function setDecoratorContext(val) { - setContextFlag(val, 4); + setContextFlag(val, 16777216); } function setAwaitContext(val) { - setContextFlag(val, 8); + setContextFlag(val, 33554432); } function doOutsideOfContext(context, func) { var contextFlagsToClear = context & contextFlags; @@ -5787,46 +6545,40 @@ var ts; return func(); } function allowInAnd(func) { - return doOutsideOfContext(1, func); + return doOutsideOfContext(4194304, func); } function disallowInAnd(func) { - return doInsideOfContext(1, func); + return doInsideOfContext(4194304, func); } function doInYieldContext(func) { - return doInsideOfContext(2, func); - } - function doOutsideOfYieldContext(func) { - return doOutsideOfContext(2, func); + return doInsideOfContext(8388608, func); } function doInDecoratorContext(func) { - return doInsideOfContext(4, func); + return doInsideOfContext(16777216, func); } function doInAwaitContext(func) { - return doInsideOfContext(8, func); + return doInsideOfContext(33554432, func); } function doOutsideOfAwaitContext(func) { - return doOutsideOfContext(8, func); + return doOutsideOfContext(33554432, func); } function doInYieldAndAwaitContext(func) { - return doInsideOfContext(2 | 8, func); - } - function doOutsideOfYieldAndAwaitContext(func) { - return doOutsideOfContext(2 | 8, func); + return doInsideOfContext(8388608 | 33554432, func); } function inContext(flags) { return (contextFlags & flags) !== 0; } function inYieldContext() { - return inContext(2); + return inContext(8388608); } function inDisallowInContext() { - return inContext(1); + return inContext(4194304); } function inDecoratorContext() { - return inContext(4); + return inContext(16777216); } function inAwaitContext() { - return inContext(8); + return inContext(33554432); } function parseErrorAtCurrentToken(message, arg0) { var start = scanner.getTokenPos(); @@ -5853,9 +6605,6 @@ var ts; function nextToken() { return token = scanner.scan(); } - function getTokenPos(pos) { - return ts.skipTrivia(sourceText, pos); - } function reScanGreaterToken() { return token = scanner.reScanGreaterToken(); } @@ -5970,11 +6719,11 @@ var ts; function finishNode(node, end) { node.end = end === undefined ? scanner.getStartPos() : end; if (contextFlags) { - node.parserContextFlags = contextFlags; + node.flags |= contextFlags; } if (parseErrorBeforeNextFinishedNode) { parseErrorBeforeNextFinishedNode = false; - node.parserContextFlags |= 16; + node.flags |= 67108864; } return node; } @@ -6036,7 +6785,7 @@ var ts; return token === 9 || token === 8 || ts.tokenIsIdentifierOrKeyword(token); } function parseComputedPropertyName() { - var node = createNode(136); + var node = createNode(140); parseExpected(19); node.expression = allowInAnd(parseExpression); parseExpected(20); @@ -6045,6 +6794,13 @@ var ts; function parseContextualModifier(t) { return token === t && tryParse(nextTokenCanFollowModifier); } + function nextTokenIsOnSameLineAndCanFollowModifier() { + nextToken(); + if (scanner.hasPrecedingLineBreak()) { + return false; + } + return canFollowModifier(); + } function nextTokenCanFollowModifier() { if (token === 74) { return nextToken() === 81; @@ -6054,7 +6810,7 @@ var ts; if (token === 77) { return lookAhead(nextTokenIsClassOrFunction); } - return token !== 37 && token !== 15 && canFollowModifier(); + return token !== 37 && token !== 116 && token !== 15 && canFollowModifier(); } if (token === 77) { return nextTokenIsClassOrFunction(); @@ -6063,14 +6819,10 @@ var ts; nextToken(); return canFollowModifier(); } - nextToken(); - if (scanner.hasPrecedingLineBreak()) { - return false; - } - return canFollowModifier(); + return nextTokenIsOnSameLineAndCanFollowModifier(); } function parseAnyContextualModifier() { - return ts.isModifier(token) && tryParse(nextTokenCanFollowModifier); + return ts.isModifierKind(token) && tryParse(nextTokenCanFollowModifier); } function canFollowModifier() { return token === 19 @@ -6095,7 +6847,7 @@ var ts; case 2: return token === 71 || token === 77; case 4: - return isStartOfTypeMember(); + return lookAhead(isTypeMemberStart); case 5: return lookAhead(isClassMemberStart) || (token === 23 && !inErrorRecovery); case 6: @@ -6285,7 +7037,7 @@ var ts; if (ts.containsParseError(node)) { return undefined; } - var nodeContextFlags = node.parserContextFlags & 31; + var nodeContextFlags = node.flags & 197132288; if (nodeContextFlags !== contextFlags) { return undefined; } @@ -6332,14 +7084,14 @@ var ts; function isReusableClassMember(node) { if (node) { switch (node.kind) { - case 144: + case 148: + case 153: case 149: + case 150: case 145: - case 146: - case 141: - case 191: + case 198: return true; - case 143: + case 147: var methodDeclaration = node; var nameIsConstructor = methodDeclaration.name.kind === 69 && methodDeclaration.name.originalKeywordKind === 121; @@ -6351,8 +7103,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 241: - case 242: + case 249: + case 250: return true; } } @@ -6361,65 +7113,65 @@ var ts; function isReusableStatement(node) { if (node) { switch (node.kind) { - case 213: - case 193: - case 192: - case 196: - case 195: - case 208: - case 204: - case 206: + case 220: + case 200: + case 199: case 203: case 202: - case 200: - case 201: - case 199: - case 198: - case 205: - case 194: + case 215: + case 211: + case 213: + case 210: case 209: case 207: - case 197: - case 210: - case 222: - case 221: - case 228: - case 227: - case 218: - case 214: - case 215: - case 217: + case 208: + case 206: + case 205: + case 212: + case 201: case 216: + case 214: + case 204: + case 217: + case 230: + case 229: + case 236: + case 235: + case 225: + case 221: + case 222: + case 224: + case 223: return true; } } return false; } function isReusableEnumMember(node) { - return node.kind === 247; + return node.kind === 255; } function isReusableTypeMember(node) { if (node) { switch (node.kind) { - case 148: - case 142: - case 149: - case 140: - case 147: + case 152: + case 146: + case 153: + case 144: + case 151: return true; } } return false; } function isReusableVariableDeclaration(node) { - if (node.kind !== 211) { + if (node.kind !== 218) { return false; } var variableDeclarator = node; return variableDeclarator.initializer === undefined; } function isReusableParameter(node) { - if (node.kind !== 138) { + if (node.kind !== 142) { return false; } var parameter = node; @@ -6464,7 +7216,7 @@ var ts; } } ; - function parseDelimitedList(kind, parseElement, considerSemicolonAsDelimeter) { + function parseDelimitedList(kind, parseElement, considerSemicolonAsDelimiter) { var saveParsingContext = parsingContext; parsingContext |= 1 << kind; var result = []; @@ -6482,7 +7234,7 @@ var ts; break; } parseExpected(24); - if (considerSemicolonAsDelimeter && token === 23 && !scanner.hasPrecedingLineBreak()) { + if (considerSemicolonAsDelimiter && token === 23 && !scanner.hasPrecedingLineBreak()) { nextToken(); } continue; @@ -6519,7 +7271,7 @@ var ts; function parseEntityName(allowReservedWords, diagnosticMessage) { var entity = parseIdentifier(diagnosticMessage); while (parseOptional(21)) { - var node = createNode(135, entity.pos); + var node = createNode(139, entity.pos); node.left = entity; node.right = parseRightSideOfDot(allowReservedWords); entity = finishNode(node); @@ -6536,8 +7288,8 @@ var ts; return allowIdentifierNames ? parseIdentifierName() : parseIdentifier(); } function parseTemplateExpression() { - var template = createNode(183); - template.head = parseLiteralNode(); + var template = createNode(189); + template.head = parseTemplateLiteralFragment(); ts.Debug.assert(template.head.kind === 12, "Template head has wrong token kind"); var templateSpans = []; templateSpans.pos = getNodePos(); @@ -6549,12 +7301,12 @@ var ts; return finishNode(template); } function parseTemplateSpan() { - var span = createNode(190); + var span = createNode(197); span.expression = allowInAnd(parseExpression); var literal; if (token === 16) { reScanTemplateToken(); - literal = parseLiteralNode(); + literal = parseTemplateLiteralFragment(); } else { literal = parseExpectedToken(14, false, ts.Diagnostics._0_expected, ts.tokenToString(16)); @@ -6562,8 +7314,17 @@ var ts; span.literal = literal; return finishNode(span); } + function parseStringLiteralTypeNode() { + return parseLiteralLikeNode(166, true); + } function parseLiteralNode(internName) { - var node = createNode(token); + return parseLiteralLikeNode(token, internName); + } + function parseTemplateLiteralFragment() { + return parseLiteralLikeNode(token, false); + } + function parseLiteralLikeNode(kind, internName) { + var node = createNode(kind); var text = scanner.getTokenValue(); node.text = internName ? internIdentifier(text) : text; if (scanner.hasExtendedUnicodeEscape()) { @@ -6578,34 +7339,39 @@ var ts; if (node.kind === 8 && sourceText.charCodeAt(tokenPos) === 48 && ts.isOctalDigit(sourceText.charCodeAt(tokenPos + 1))) { - node.flags |= 32768; + node.isOctalLiteral = true; } return node; } - function parseTypeReferenceOrTypePredicate() { + function parseTypeReference() { var typeName = parseEntityName(false, ts.Diagnostics.Type_expected); - if (typeName.kind === 69 && token === 124 && !scanner.hasPrecedingLineBreak()) { - nextToken(); - var node_1 = createNode(150, typeName.pos); - node_1.parameterName = typeName; - node_1.type = parseType(); - return finishNode(node_1); - } - var node = createNode(151, typeName.pos); + var node = createNode(155, typeName.pos); node.typeName = typeName; if (!scanner.hasPrecedingLineBreak() && token === 25) { node.typeArguments = parseBracketedList(18, parseType, 25, 27); } return finishNode(node); } + function parseThisTypePredicate(lhs) { + nextToken(); + var node = createNode(154, lhs.pos); + node.parameterName = lhs; + node.type = parseType(); + return finishNode(node); + } + function parseThisTypeNode() { + var node = createNode(165); + nextToken(); + return finishNode(node); + } function parseTypeQuery() { - var node = createNode(154); + var node = createNode(158); parseExpected(101); node.exprName = parseEntityName(true); return finishNode(node); } function parseTypeParameter() { - var node = createNode(137); + var node = createNode(141); node.name = parseIdentifier(); if (parseOptional(83)) { if (isStartOfType() || !isStartOfExpression()) { @@ -6629,7 +7395,7 @@ var ts; return undefined; } function isStartOfParameter() { - return token === 22 || isIdentifierOrPattern() || ts.isModifier(token) || token === 55; + return token === 22 || isIdentifierOrPattern() || ts.isModifierKind(token) || token === 55 || token === 97; } function setModifiers(node, modifiers) { if (modifiers) { @@ -6638,18 +7404,23 @@ var ts; } } function parseParameter() { - var node = createNode(138); + var node = createNode(142); + if (token === 97) { + node.name = createIdentifier(true, undefined); + node.type = parseParameterType(); + return finishNode(node); + } node.decorators = parseDecorators(); setModifiers(node, parseModifiers()); node.dotDotDotToken = parseOptionalToken(22); node.name = parseIdentifierOrPattern(); - if (ts.getFullWidth(node.name) === 0 && node.flags === 0 && ts.isModifier(token)) { + if (ts.getFullWidth(node.name) === 0 && node.flags === 0 && ts.isModifierKind(token)) { nextToken(); } node.questionToken = parseOptionalToken(53); node.type = parseParameterType(); node.initializer = parseBindingElementInitializer(true); - return finishNode(node); + return addJSDocComment(finishNode(node)); } function parseBindingElementInitializer(inParameter) { return inParameter ? parseParameterInitializer() : parseNonParameterInitializer(); @@ -6663,10 +7434,10 @@ var ts; signature.parameters = parseParameterList(yieldContext, awaitContext, requireCompleteParameterList); if (returnTokenRequired) { parseExpected(returnToken); - signature.type = parseType(); + signature.type = parseTypeOrTypePredicate(); } else if (parseOptional(returnToken)) { - signature.type = parseType(); + signature.type = parseTypeOrTypePredicate(); } } function parseParameterList(yieldContext, awaitContext, requireCompleteParameterList) { @@ -6693,7 +7464,7 @@ var ts; } function parseSignatureMember(kind) { var node = createNode(kind); - if (kind === 148) { + if (kind === 152) { parseExpected(92); } fillSignature(54, false, false, false, node); @@ -6711,7 +7482,7 @@ var ts; if (token === 22 || token === 20) { return true; } - if (ts.isModifier(token)) { + if (ts.isModifierKind(token)) { nextToken(); if (isIdentifier()) { return true; @@ -6733,7 +7504,7 @@ var ts; return token === 54 || token === 24 || token === 20; } function parseIndexSignatureDeclaration(fullStart, decorators, modifiers) { - var node = createNode(149, fullStart); + var node = createNode(153, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.parameters = parseBracketedList(16, parseParameter, 19, 20); @@ -6741,12 +7512,12 @@ var ts; parseTypeMemberSemicolon(); return finishNode(node); } - function parsePropertyOrMethodSignature() { - var fullStart = scanner.getStartPos(); + function parsePropertyOrMethodSignature(fullStart, modifiers) { var name = parsePropertyName(); var questionToken = parseOptionalToken(53); if (token === 17 || token === 25) { - var method = createNode(142, fullStart); + var method = createNode(146, fullStart); + setModifiers(method, modifiers); method.name = name; method.questionToken = questionToken; fillSignature(54, false, false, false, method); @@ -6754,86 +7525,63 @@ var ts; return finishNode(method); } else { - var property = createNode(140, fullStart); + var property = createNode(144, fullStart); + setModifiers(property, modifiers); property.name = name; property.questionToken = questionToken; property.type = parseTypeAnnotation(); + if (token === 56) { + property.initializer = parseNonParameterInitializer(); + } parseTypeMemberSemicolon(); return finishNode(property); } } - function isStartOfTypeMember() { - switch (token) { - case 17: - case 25: - case 19: - return true; - default: - if (ts.isModifier(token)) { - var result = lookAhead(isStartOfIndexSignatureDeclaration); - if (result) { - return result; - } - } - return isLiteralPropertyName() && lookAhead(isTypeMemberWithLiteralPropertyName); + function isTypeMemberStart() { + var idToken; + if (token === 17 || token === 25) { + return true; } - } - function isStartOfIndexSignatureDeclaration() { - while (ts.isModifier(token)) { + while (ts.isModifierKind(token)) { + idToken = token; nextToken(); } - return isIndexSignature(); - } - function isTypeMemberWithLiteralPropertyName() { - nextToken(); - return token === 17 || - token === 25 || - token === 53 || - token === 54 || - canParseSemicolon(); + if (token === 19) { + return true; + } + if (isLiteralPropertyName()) { + idToken = token; + nextToken(); + } + if (idToken) { + return token === 17 || + token === 25 || + token === 53 || + token === 54 || + canParseSemicolon(); + } + return false; } function parseTypeMember() { - switch (token) { - case 17: - case 25: - return parseSignatureMember(147); - case 19: - return isIndexSignature() - ? parseIndexSignatureDeclaration(scanner.getStartPos(), undefined, undefined) - : parsePropertyOrMethodSignature(); - case 92: - if (lookAhead(isStartOfConstructSignature)) { - return parseSignatureMember(148); - } - case 9: - case 8: - return parsePropertyOrMethodSignature(); - default: - if (ts.isModifier(token)) { - var result = tryParse(parseIndexSignatureWithModifiers); - if (result) { - return result; - } - } - if (ts.tokenIsIdentifierOrKeyword(token)) { - return parsePropertyOrMethodSignature(); - } + if (token === 17 || token === 25) { + return parseSignatureMember(151); } - } - function parseIndexSignatureWithModifiers() { - var fullStart = scanner.getStartPos(); - var decorators = parseDecorators(); + if (token === 92 && lookAhead(isStartOfConstructSignature)) { + return parseSignatureMember(152); + } + var fullStart = getNodePos(); var modifiers = parseModifiers(); - return isIndexSignature() - ? parseIndexSignatureDeclaration(fullStart, decorators, modifiers) - : undefined; + if (isIndexSignature()) { + return parseIndexSignatureDeclaration(fullStart, undefined, modifiers); + } + return parsePropertyOrMethodSignature(fullStart, modifiers); } function isStartOfConstructSignature() { nextToken(); return token === 17 || token === 25; } function parseTypeLiteral() { - var node = createNode(155); + var node = createNode(159); node.members = parseObjectTypeMembers(); return finishNode(node); } @@ -6849,12 +7597,12 @@ var ts; return members; } function parseTupleType() { - var node = createNode(157); + var node = createNode(161); node.elementTypes = parseBracketedList(19, parseType, 19, 20); return finishNode(node); } function parseParenthesizedType() { - var node = createNode(160); + var node = createNode(164); parseExpected(17); node.type = parseType(); parseExpected(18); @@ -6862,7 +7610,7 @@ var ts; } function parseFunctionOrConstructorType(kind) { var node = createNode(kind); - if (kind === 153) { + if (kind === 157) { parseExpected(92); } fillSignature(34, false, false, false, node); @@ -6875,17 +7623,28 @@ var ts; function parseNonArrayType() { switch (token) { case 117: + case 132: case 130: - case 128: case 120: - case 131: + case 133: + case 135: + case 127: var node = tryParse(parseKeywordAndNoDot); - return node || parseTypeReferenceOrTypePredicate(); + return node || parseTypeReference(); case 9: - return parseLiteralNode(true); + return parseStringLiteralTypeNode(); case 103: - case 97: + case 93: return parseTokenNode(); + case 97: { + var thisKeyword = parseThisTypeNode(); + if (token === 124 && !scanner.hasPrecedingLineBreak()) { + return parseThisTypePredicate(thisKeyword); + } + else { + return thisKeyword; + } + } case 101: return parseTypeQuery(); case 15: @@ -6895,19 +7654,22 @@ var ts; case 17: return parseParenthesizedType(); default: - return parseTypeReferenceOrTypePredicate(); + return parseTypeReference(); } } function isStartOfType() { switch (token) { case 117: + case 132: case 130: - case 128: case 120: - case 131: + case 133: case 103: + case 135: + case 93: case 97: case 101: + case 127: case 15: case 19: case 25: @@ -6928,7 +7690,7 @@ var ts; var type = parseNonArrayType(); while (!scanner.hasPrecedingLineBreak() && parseOptional(19)) { parseExpected(20); - var node = createNode(156, type.pos); + var node = createNode(160, type.pos); node.elementType = type; type = finishNode(node); } @@ -6950,10 +7712,10 @@ var ts; return type; } function parseIntersectionTypeOrHigher() { - return parseUnionOrIntersectionType(159, parseArrayTypeOrHigher, 46); + return parseUnionOrIntersectionType(163, parseArrayTypeOrHigher, 46); } function parseUnionTypeOrHigher() { - return parseUnionOrIntersectionType(158, parseIntersectionTypeOrHigher, 47); + return parseUnionOrIntersectionType(162, parseIntersectionTypeOrHigher, 47); } function isStartOfFunctionType() { if (token === 25) { @@ -6961,16 +7723,29 @@ var ts; } return token === 17 && lookAhead(isUnambiguouslyStartOfFunctionType); } + function skipParameterStart() { + if (ts.isModifierKind(token)) { + parseModifiers(); + } + if (isIdentifier() || token === 97) { + nextToken(); + return true; + } + if (token === 19 || token === 15) { + var previousErrorCount = parseDiagnostics.length; + parseIdentifierOrPattern(); + return previousErrorCount === parseDiagnostics.length; + } + return false; + } function isUnambiguouslyStartOfFunctionType() { nextToken(); if (token === 18 || token === 22) { return true; } - if (isIdentifier() || ts.isModifier(token)) { - nextToken(); + if (skipParameterStart()) { if (token === 54 || token === 24 || - token === 53 || token === 56 || - isIdentifier() || ts.isModifier(token)) { + token === 53 || token === 56) { return true; } if (token === 18) { @@ -6982,15 +7757,35 @@ var ts; } return false; } + function parseTypeOrTypePredicate() { + var typePredicateVariable = isIdentifier() && tryParse(parseTypePredicatePrefix); + var type = parseType(); + if (typePredicateVariable) { + var node = createNode(154, typePredicateVariable.pos); + node.parameterName = typePredicateVariable; + node.type = type; + return finishNode(node); + } + else { + return type; + } + } + function parseTypePredicatePrefix() { + var id = parseIdentifier(); + if (token === 124 && !scanner.hasPrecedingLineBreak()) { + nextToken(); + return id; + } + } function parseType() { - return doOutsideOfContext(10, parseTypeWorker); + return doOutsideOfContext(41943040, parseTypeWorker); } function parseTypeWorker() { if (isStartOfFunctionType()) { - return parseFunctionOrConstructorType(152); + return parseFunctionOrConstructorType(156); } if (token === 92) { - return parseFunctionOrConstructorType(153); + return parseFunctionOrConstructorType(157); } return parseUnionTypeOrHigher(); } @@ -7054,9 +7849,6 @@ var ts; token !== 55 && isStartOfExpression(); } - function allowInAndParseExpression() { - return allowInAnd(parseExpression); - } function parseExpression() { var saveDecoratorContext = inDecoratorContext(); if (saveDecoratorContext) { @@ -7085,7 +7877,7 @@ var ts; if (isYieldExpression()) { return parseYieldExpression(); } - var arrowExpression = tryParseParenthesizedArrowFunctionExpression(); + var arrowExpression = tryParseParenthesizedArrowFunctionExpression() || tryParseAsyncSimpleArrowFunctionExpression(); if (arrowExpression) { return arrowExpression; } @@ -7112,7 +7904,7 @@ var ts; return !scanner.hasPrecedingLineBreak() && isIdentifier(); } function parseYieldExpression() { - var node = createNode(184); + var node = createNode(190); nextToken(); if (!scanner.hasPrecedingLineBreak() && (token === 37 || isStartOfExpression())) { @@ -7124,17 +7916,24 @@ var ts; return finishNode(node); } } - function parseSimpleArrowFunctionExpression(identifier) { + function parseSimpleArrowFunctionExpression(identifier, asyncModifier) { ts.Debug.assert(token === 34, "parseSimpleArrowFunctionExpression should only have been called if we had a =>"); - var node = createNode(174, identifier.pos); - var parameter = createNode(138, identifier.pos); + var node; + if (asyncModifier) { + node = createNode(180, asyncModifier.pos); + setModifiers(node, asyncModifier); + } + else { + node = createNode(180, identifier.pos); + } + var parameter = createNode(142, identifier.pos); parameter.name = identifier; finishNode(parameter); node.parameters = [parameter]; node.parameters.pos = parameter.pos; node.parameters.end = parameter.end; node.equalsGreaterThanToken = parseExpectedToken(34, false, ts.Diagnostics._0_expected, "=>"); - node.body = parseArrowFunctionExpressionBody(false); + node.body = parseArrowFunctionExpressionBody(!!asyncModifier); return finishNode(node); } function tryParseParenthesizedArrowFunctionExpression() { @@ -7237,8 +8036,32 @@ var ts; function parsePossibleParenthesizedArrowFunctionExpressionHead() { return parseParenthesizedArrowFunctionExpressionHead(false); } + function tryParseAsyncSimpleArrowFunctionExpression() { + if (token === 118) { + var isUnParenthesizedAsyncArrowFunction = lookAhead(isUnParenthesizedAsyncArrowFunctionWorker); + if (isUnParenthesizedAsyncArrowFunction === 1) { + var asyncModifier = parseModifiersForArrowFunction(); + var expr = parseBinaryExpressionOrHigher(0); + return parseSimpleArrowFunctionExpression(expr, asyncModifier); + } + } + return undefined; + } + function isUnParenthesizedAsyncArrowFunctionWorker() { + if (token === 118) { + nextToken(); + if (scanner.hasPrecedingLineBreak() || token === 34) { + return 0; + } + var expr = parseBinaryExpressionOrHigher(0); + if (!scanner.hasPrecedingLineBreak() && expr.kind === 69 && token === 34) { + return 1; + } + } + return 0; + } function parseParenthesizedArrowFunctionExpressionHead(allowAmbiguity) { - var node = createNode(174); + var node = createNode(180); setModifiers(node, parseModifiersForArrowFunction()); var isAsync = !!(node.flags & 256); fillSignature(54, false, isAsync, !allowAmbiguity, node); @@ -7270,7 +8093,7 @@ var ts; if (!questionToken) { return leftOperand; } - var node = createNode(182, leftOperand.pos); + var node = createNode(188, leftOperand.pos); node.condition = leftOperand; node.questionToken = questionToken; node.whenTrue = doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher); @@ -7283,7 +8106,7 @@ var ts; return parseBinaryExpressionRest(precedence, leftOperand); } function isInOrOfKeyword(t) { - return t === 90 || t === 134; + return t === 90 || t === 138; } function parseBinaryExpressionRest(precedence, leftOperand) { while (true) { @@ -7361,39 +8184,39 @@ var ts; return -1; } function makeBinaryExpression(left, operatorToken, right) { - var node = createNode(181, left.pos); + var node = createNode(187, left.pos); node.left = left; node.operatorToken = operatorToken; node.right = right; return finishNode(node); } function makeAsExpression(left, right) { - var node = createNode(189, left.pos); + var node = createNode(195, left.pos); node.expression = left; node.type = right; return finishNode(node); } function parsePrefixUnaryExpression() { - var node = createNode(179); + var node = createNode(185); node.operator = token; nextToken(); node.operand = parseSimpleUnaryExpression(); return finishNode(node); } function parseDeleteExpression() { - var node = createNode(175); + var node = createNode(181); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); } function parseTypeOfExpression() { - var node = createNode(176); + var node = createNode(182); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); } function parseVoidExpression() { - var node = createNode(177); + var node = createNode(183); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); @@ -7408,7 +8231,7 @@ var ts; return false; } function parseAwaitExpression() { - var node = createNode(178); + var node = createNode(184); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); @@ -7427,7 +8250,7 @@ var ts; var simpleUnaryExpression = parseSimpleUnaryExpression(); if (token === 38) { var start = ts.skipTrivia(sourceText, simpleUnaryExpression.pos); - if (simpleUnaryExpression.kind === 171) { + if (simpleUnaryExpression.kind === 177) { parseErrorAtPosition(start, simpleUnaryExpression.end - start, 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 { @@ -7475,7 +8298,7 @@ var ts; } function parseIncrementExpression() { if (token === 41 || token === 42) { - var node = createNode(179); + var node = createNode(185); node.operator = token; nextToken(); node.operand = parseLeftHandSideExpressionOrHigher(); @@ -7487,7 +8310,7 @@ var ts; var expression = parseLeftHandSideExpressionOrHigher(); ts.Debug.assert(ts.isLeftHandSideExpression(expression)); if ((token === 41 || token === 42) && !scanner.hasPrecedingLineBreak()) { - var node = createNode(180, expression.pos); + var node = createNode(186, expression.pos); node.operand = expression; node.operator = token; nextToken(); @@ -7510,31 +8333,44 @@ var ts; if (token === 17 || token === 21 || token === 19) { return expression; } - var node = createNode(166, expression.pos); + var node = createNode(172, expression.pos); node.expression = expression; node.dotToken = parseExpectedToken(21, false, ts.Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access); node.name = parseRightSideOfDot(true); return finishNode(node); } + function tagNamesAreEquivalent(lhs, rhs) { + if (lhs.kind !== rhs.kind) { + return false; + } + if (lhs.kind === 69) { + return lhs.text === rhs.text; + } + return lhs.right.text === rhs.right.text && + tagNamesAreEquivalent(lhs.left, rhs.left); + } function parseJsxElementOrSelfClosingElement(inExpressionContext) { var opening = parseJsxOpeningOrSelfClosingElement(inExpressionContext); var result; - if (opening.kind === 235) { - var node = createNode(233, opening.pos); + if (opening.kind === 243) { + var node = createNode(241, opening.pos); node.openingElement = opening; node.children = parseJsxChildren(node.openingElement.tagName); node.closingElement = parseJsxClosingElement(inExpressionContext); + if (!tagNamesAreEquivalent(node.openingElement.tagName, node.closingElement.tagName)) { + parseErrorAtPosition(node.closingElement.pos, node.closingElement.end - node.closingElement.pos, ts.Diagnostics.Expected_corresponding_JSX_closing_tag_for_0, ts.getTextOfNodeFromSourceText(sourceText, node.openingElement.tagName)); + } result = finishNode(node); } else { - ts.Debug.assert(opening.kind === 234); + ts.Debug.assert(opening.kind === 242); result = opening; } if (inExpressionContext && token === 25) { var invalidElement = tryParse(function () { return parseJsxElementOrSelfClosingElement(true); }); if (invalidElement) { parseErrorAtCurrentToken(ts.Diagnostics.JSX_expressions_must_have_one_parent_element); - var badNode = createNode(181, result.pos); + var badNode = createNode(187, result.pos); badNode.end = invalidElement.end; badNode.left = result; badNode.right = invalidElement; @@ -7546,13 +8382,13 @@ var ts; return result; } function parseJsxText() { - var node = createNode(236, scanner.getStartPos()); + var node = createNode(244, scanner.getStartPos()); token = scanner.scanJsxToken(); return finishNode(node); } function parseJsxChild() { switch (token) { - case 236: + case 244: return parseJsxText(); case 15: return parseJsxExpression(false); @@ -7572,7 +8408,7 @@ var ts; break; } else if (token === 1) { - parseErrorAtCurrentToken(ts.Diagnostics.Expected_corresponding_JSX_closing_tag_for_0, ts.getTextOfNodeFromSourceText(sourceText, openingTagName)); + parseErrorAtPosition(openingTagName.pos, openingTagName.end - openingTagName.pos, ts.Diagnostics.JSX_element_0_has_no_corresponding_closing_tag, ts.getTextOfNodeFromSourceText(sourceText, openingTagName)); break; } result.push(parseJsxChild()); @@ -7588,7 +8424,7 @@ var ts; var attributes = parseList(13, parseJsxAttribute); var node; if (token === 27) { - node = createNode(235, fullStart); + node = createNode(243, fullStart); scanJsxText(); } else { @@ -7600,7 +8436,7 @@ var ts; parseExpected(27, undefined, false); scanJsxText(); } - node = createNode(234, fullStart); + node = createNode(242, fullStart); } node.tagName = tagName; node.attributes = attributes; @@ -7611,7 +8447,7 @@ var ts; var elementName = parseIdentifierName(); while (parseOptional(21)) { scanJsxIdentifier(); - var node = createNode(135, elementName.pos); + var node = createNode(139, elementName.pos); node.left = elementName; node.right = parseIdentifierName(); elementName = finishNode(node); @@ -7619,10 +8455,10 @@ var ts; return elementName; } function parseJsxExpression(inExpressionContext) { - var node = createNode(240); + var node = createNode(248); parseExpected(15); if (token !== 16) { - node.expression = parseExpression(); + node.expression = parseAssignmentExpressionOrHigher(); } if (inExpressionContext) { parseExpected(16); @@ -7638,7 +8474,7 @@ var ts; return parseJsxSpreadAttribute(); } scanJsxIdentifier(); - var node = createNode(238); + var node = createNode(246); node.name = parseIdentifierName(); if (parseOptional(56)) { switch (token) { @@ -7653,7 +8489,7 @@ var ts; return finishNode(node); } function parseJsxSpreadAttribute() { - var node = createNode(239); + var node = createNode(247); parseExpected(15); parseExpected(22); node.expression = parseExpression(); @@ -7661,7 +8497,7 @@ var ts; return finishNode(node); } function parseJsxClosingElement(inExpressionContext) { - var node = createNode(237); + var node = createNode(245); parseExpected(26); node.tagName = parseJsxElementName(); if (inExpressionContext) { @@ -7674,7 +8510,7 @@ var ts; return finishNode(node); } function parseTypeAssertion() { - var node = createNode(171); + var node = createNode(177); parseExpected(25); node.type = parseType(); parseExpected(27); @@ -7685,15 +8521,22 @@ var ts; while (true) { var dotToken = parseOptionalToken(21); if (dotToken) { - var propertyAccess = createNode(166, expression.pos); + var propertyAccess = createNode(172, expression.pos); propertyAccess.expression = expression; propertyAccess.dotToken = dotToken; propertyAccess.name = parseRightSideOfDot(true); expression = finishNode(propertyAccess); continue; } + if (token === 49 && !scanner.hasPrecedingLineBreak()) { + nextToken(); + var nonNullExpression = createNode(196, expression.pos); + nonNullExpression.expression = expression; + expression = finishNode(nonNullExpression); + continue; + } if (!inDecoratorContext() && parseOptional(19)) { - var indexedAccess = createNode(167, expression.pos); + var indexedAccess = createNode(173, expression.pos); indexedAccess.expression = expression; if (token !== 20) { indexedAccess.argumentExpression = allowInAnd(parseExpression); @@ -7707,7 +8550,7 @@ var ts; continue; } if (token === 11 || token === 12) { - var tagExpression = createNode(170, expression.pos); + var tagExpression = createNode(176, expression.pos); tagExpression.tag = expression; tagExpression.template = token === 11 ? parseLiteralNode() @@ -7726,7 +8569,7 @@ var ts; if (!typeArguments) { return expression; } - var callExpr = createNode(168, expression.pos); + var callExpr = createNode(174, expression.pos); callExpr.expression = expression; callExpr.typeArguments = typeArguments; callExpr.arguments = parseArgumentList(); @@ -7734,7 +8577,7 @@ var ts; continue; } else if (token === 17) { - var callExpr = createNode(168, expression.pos); + var callExpr = createNode(174, expression.pos); callExpr.expression = expression; callExpr.arguments = parseArgumentList(); expression = finishNode(callExpr); @@ -7829,41 +8672,42 @@ var ts; return parseIdentifier(ts.Diagnostics.Expression_expected); } function parseParenthesizedExpression() { - var node = createNode(172); + var node = createNode(178); parseExpected(17); node.expression = allowInAnd(parseExpression); parseExpected(18); return finishNode(node); } function parseSpreadElement() { - var node = createNode(185); + var node = createNode(191); parseExpected(22); node.expression = parseAssignmentExpressionOrHigher(); return finishNode(node); } function parseArgumentOrArrayLiteralElement() { return token === 22 ? parseSpreadElement() : - token === 24 ? createNode(187) : + token === 24 ? createNode(193) : parseAssignmentExpressionOrHigher(); } function parseArgumentExpression() { return doOutsideOfContext(disallowInAndDecoratorContext, parseArgumentOrArrayLiteralElement); } function parseArrayLiteralExpression() { - var node = createNode(164); + var node = createNode(170); parseExpected(19); - if (scanner.hasPrecedingLineBreak()) - node.flags |= 1024; + if (scanner.hasPrecedingLineBreak()) { + node.multiLine = true; + } node.elements = parseDelimitedList(15, parseArgumentOrArrayLiteralElement); parseExpected(20); return finishNode(node); } function tryParseAccessorDeclaration(fullStart, decorators, modifiers) { if (parseContextualModifier(123)) { - return parseAccessorDeclaration(145, fullStart, decorators, modifiers); + return addJSDocComment(parseAccessorDeclaration(149, fullStart, decorators, modifiers)); } - else if (parseContextualModifier(129)) { - return parseAccessorDeclaration(146, fullStart, decorators, modifiers); + else if (parseContextualModifier(131)) { + return parseAccessorDeclaration(150, fullStart, decorators, modifiers); } return undefined; } @@ -7877,7 +8721,6 @@ var ts; } var asteriskToken = parseOptionalToken(37); var tokenIsIdentifier = isIdentifier(); - var nameToken = token; var propertyName = parsePropertyName(); var questionToken = parseOptionalToken(53); if (asteriskToken || token === 17 || token === 25) { @@ -7885,7 +8728,7 @@ var ts; } var isShorthandPropertyAssignment = tokenIsIdentifier && (token === 24 || token === 16 || token === 56); if (isShorthandPropertyAssignment) { - var shorthandDeclaration = createNode(246, fullStart); + var shorthandDeclaration = createNode(254, fullStart); shorthandDeclaration.name = propertyName; shorthandDeclaration.questionToken = questionToken; var equalsToken = parseOptionalToken(56); @@ -7893,22 +8736,23 @@ var ts; shorthandDeclaration.equalsToken = equalsToken; shorthandDeclaration.objectAssignmentInitializer = allowInAnd(parseAssignmentExpressionOrHigher); } - return finishNode(shorthandDeclaration); + return addJSDocComment(finishNode(shorthandDeclaration)); } else { - var propertyAssignment = createNode(245, fullStart); + var propertyAssignment = createNode(253, fullStart); + propertyAssignment.modifiers = modifiers; propertyAssignment.name = propertyName; propertyAssignment.questionToken = questionToken; parseExpected(54); propertyAssignment.initializer = allowInAnd(parseAssignmentExpressionOrHigher); - return finishNode(propertyAssignment); + return addJSDocComment(finishNode(propertyAssignment)); } } function parseObjectLiteralExpression() { - var node = createNode(165); + var node = createNode(171); parseExpected(15); if (scanner.hasPrecedingLineBreak()) { - node.flags |= 1024; + node.multiLine = true; } node.properties = parseDelimitedList(12, parseObjectLiteralElement, true); parseExpected(16); @@ -7919,7 +8763,7 @@ var ts; if (saveDecoratorContext) { setDecoratorContext(false); } - var node = createNode(173); + var node = createNode(179); setModifiers(node, parseModifiers()); parseExpected(87); node.asteriskToken = parseOptionalToken(37); @@ -7935,13 +8779,13 @@ var ts; if (saveDecoratorContext) { setDecoratorContext(true); } - return finishNode(node); + return addJSDocComment(finishNode(node)); } function parseOptionalIdentifier() { return isIdentifier() ? parseIdentifier() : undefined; } function parseNewExpression() { - var node = createNode(169); + var node = createNode(175); parseExpected(92); node.expression = parseMemberExpressionOrHigher(); node.typeArguments = tryParse(parseTypeArgumentsInExpression); @@ -7951,7 +8795,7 @@ var ts; return finishNode(node); } function parseBlock(ignoreMissingOpenBrace, diagnosticMessage) { - var node = createNode(192); + var node = createNode(199); if (parseExpected(15, diagnosticMessage) || ignoreMissingOpenBrace) { node.statements = parseList(1, parseStatement); parseExpected(16); @@ -7979,12 +8823,12 @@ var ts; return block; } function parseEmptyStatement() { - var node = createNode(194); + var node = createNode(201); parseExpected(23); return finishNode(node); } function parseIfStatement() { - var node = createNode(196); + var node = createNode(203); parseExpected(88); parseExpected(17); node.expression = allowInAnd(parseExpression); @@ -7994,7 +8838,7 @@ var ts; return finishNode(node); } function parseDoStatement() { - var node = createNode(197); + var node = createNode(204); parseExpected(79); node.statement = parseStatement(); parseExpected(104); @@ -8005,7 +8849,7 @@ var ts; return finishNode(node); } function parseWhileStatement() { - var node = createNode(198); + var node = createNode(205); parseExpected(104); parseExpected(17); node.expression = allowInAnd(parseExpression); @@ -8028,21 +8872,21 @@ var ts; } var forOrForInOrForOfStatement; if (parseOptional(90)) { - var forInStatement = createNode(200, pos); + var forInStatement = createNode(207, pos); forInStatement.initializer = initializer; forInStatement.expression = allowInAnd(parseExpression); parseExpected(18); forOrForInOrForOfStatement = forInStatement; } - else if (parseOptional(134)) { - var forOfStatement = createNode(201, pos); + else if (parseOptional(138)) { + var forOfStatement = createNode(208, pos); forOfStatement.initializer = initializer; forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher); parseExpected(18); forOrForInOrForOfStatement = forOfStatement; } else { - var forStatement = createNode(199, pos); + var forStatement = createNode(206, pos); forStatement.initializer = initializer; parseExpected(23); if (token !== 23 && token !== 18) { @@ -8060,7 +8904,7 @@ var ts; } function parseBreakOrContinueStatement(kind) { var node = createNode(kind); - parseExpected(kind === 203 ? 70 : 75); + parseExpected(kind === 210 ? 70 : 75); if (!canParseSemicolon()) { node.label = parseIdentifier(); } @@ -8068,7 +8912,7 @@ var ts; return finishNode(node); } function parseReturnStatement() { - var node = createNode(204); + var node = createNode(211); parseExpected(94); if (!canParseSemicolon()) { node.expression = allowInAnd(parseExpression); @@ -8077,7 +8921,7 @@ var ts; return finishNode(node); } function parseWithStatement() { - var node = createNode(205); + var node = createNode(212); parseExpected(105); parseExpected(17); node.expression = allowInAnd(parseExpression); @@ -8086,7 +8930,7 @@ var ts; return finishNode(node); } function parseCaseClause() { - var node = createNode(241); + var node = createNode(249); parseExpected(71); node.expression = allowInAnd(parseExpression); parseExpected(54); @@ -8094,7 +8938,7 @@ var ts; return finishNode(node); } function parseDefaultClause() { - var node = createNode(242); + var node = createNode(250); parseExpected(77); parseExpected(54); node.statements = parseList(3, parseStatement); @@ -8104,12 +8948,12 @@ var ts; return token === 71 ? parseCaseClause() : parseDefaultClause(); } function parseSwitchStatement() { - var node = createNode(206); + var node = createNode(213); parseExpected(96); parseExpected(17); node.expression = allowInAnd(parseExpression); parseExpected(18); - var caseBlock = createNode(220, scanner.getStartPos()); + var caseBlock = createNode(227, scanner.getStartPos()); parseExpected(15); caseBlock.clauses = parseList(2, parseCaseOrDefaultClause); parseExpected(16); @@ -8117,14 +8961,14 @@ var ts; return finishNode(node); } function parseThrowStatement() { - var node = createNode(208); + var node = createNode(215); parseExpected(98); node.expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression); parseSemicolon(); return finishNode(node); } function parseTryStatement() { - var node = createNode(209); + var node = createNode(216); parseExpected(100); node.tryBlock = parseBlock(false); node.catchClause = token === 72 ? parseCatchClause() : undefined; @@ -8135,7 +8979,7 @@ var ts; return finishNode(node); } function parseCatchClause() { - var result = createNode(244); + var result = createNode(252); parseExpected(72); if (parseExpected(17)) { result.variableDeclaration = parseVariableDeclaration(); @@ -8145,7 +8989,7 @@ var ts; return finishNode(result); } function parseDebuggerStatement() { - var node = createNode(210); + var node = createNode(217); parseExpected(76); parseSemicolon(); return finishNode(node); @@ -8154,16 +8998,16 @@ var ts; var fullStart = scanner.getStartPos(); var expression = allowInAnd(parseExpression); if (expression.kind === 69 && parseOptional(54)) { - var labeledStatement = createNode(207, fullStart); + var labeledStatement = createNode(214, fullStart); labeledStatement.label = expression; labeledStatement.statement = parseStatement(); - return finishNode(labeledStatement); + return addJSDocComment(finishNode(labeledStatement)); } else { - var expressionStatement = createNode(195, fullStart); + var expressionStatement = createNode(202, fullStart); expressionStatement.expression = expression; parseSemicolon(); - return finishNode(expressionStatement); + return addJSDocComment(finishNode(expressionStatement)); } } function nextTokenIsIdentifierOrKeywordOnSameLine() { @@ -8189,7 +9033,7 @@ var ts; case 81: return true; case 107: - case 132: + case 134: return nextTokenIsIdentifierOnSameLine(); case 125: case 126: @@ -8200,11 +9044,15 @@ var ts; case 110: case 111: case 112: + case 128: nextToken(); if (scanner.hasPrecedingLineBreak()) { return false; } continue; + case 137: + nextToken(); + return token === 15 || token === 69 || token === 82; case 89: nextToken(); return token === 9 || token === 37 || @@ -8212,7 +9060,8 @@ var ts; case 82: nextToken(); if (token === 56 || token === 37 || - token === 15 || token === 77) { + token === 15 || token === 77 || + token === 116) { return true; } continue; @@ -8261,12 +9110,14 @@ var ts; case 107: case 125: case 126: - case 132: + case 134: + case 137: return true; case 112: case 110: case 111: case 113: + case 128: return isStartOfDeclaration() || !lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine); default: return isStartOfExpression(); @@ -8305,9 +9156,9 @@ var ts; case 86: return parseForOrForInOrForOfStatement(); case 75: - return parseBreakOrContinueStatement(202); + return parseBreakOrContinueStatement(209); case 70: - return parseBreakOrContinueStatement(203); + return parseBreakOrContinueStatement(210); case 94: return parseReturnStatement(); case 105: @@ -8326,7 +9177,7 @@ var ts; return parseDeclaration(); case 118: case 107: - case 132: + case 134: case 125: case 126: case 122: @@ -8339,6 +9190,8 @@ var ts; case 112: case 115: case 113: + case 128: + case 137: if (isStartOfDeclaration()) { return parseDeclaration(); } @@ -8361,10 +9214,11 @@ var ts; return parseClassDeclaration(fullStart, decorators, modifiers); case 107: return parseInterfaceDeclaration(fullStart, decorators, modifiers); - case 132: + case 134: return parseTypeAliasDeclaration(fullStart, decorators, modifiers); case 81: return parseEnumDeclaration(fullStart, decorators, modifiers); + case 137: case 125: case 126: return parseModuleDeclaration(fullStart, decorators, modifiers); @@ -8372,12 +9226,18 @@ var ts; return parseImportDeclarationOrImportEqualsDeclaration(fullStart, decorators, modifiers); case 82: nextToken(); - return token === 77 || token === 56 ? - parseExportAssignment(fullStart, decorators, modifiers) : - parseExportDeclaration(fullStart, decorators, modifiers); + switch (token) { + case 77: + case 56: + return parseExportAssignment(fullStart, decorators, modifiers); + case 116: + return parseGlobalModuleExportDeclaration(fullStart, decorators, modifiers); + default: + return parseExportDeclaration(fullStart, decorators, modifiers); + } default: if (decorators || modifiers) { - var node = createMissingNode(231, true, ts.Diagnostics.Declaration_expected); + var node = createMissingNode(239, true, ts.Diagnostics.Declaration_expected); node.pos = fullStart; node.decorators = decorators; setModifiers(node, modifiers); @@ -8398,16 +9258,16 @@ var ts; } function parseArrayBindingElement() { if (token === 24) { - return createNode(187); + return createNode(193); } - var node = createNode(163); + var node = createNode(169); node.dotDotDotToken = parseOptionalToken(22); node.name = parseIdentifierOrPattern(); node.initializer = parseBindingElementInitializer(false); return finishNode(node); } function parseObjectBindingElement() { - var node = createNode(163); + var node = createNode(169); var tokenIsIdentifier = isIdentifier(); var propertyName = parsePropertyName(); if (tokenIsIdentifier && token !== 54) { @@ -8422,14 +9282,14 @@ var ts; return finishNode(node); } function parseObjectBindingPattern() { - var node = createNode(161); + var node = createNode(167); parseExpected(15); node.elements = parseDelimitedList(9, parseObjectBindingElement); parseExpected(16); return finishNode(node); } function parseArrayBindingPattern() { - var node = createNode(162); + var node = createNode(168); parseExpected(19); node.elements = parseDelimitedList(10, parseArrayBindingElement); parseExpected(20); @@ -8448,7 +9308,7 @@ var ts; return parseIdentifier(); } function parseVariableDeclaration() { - var node = createNode(211); + var node = createNode(218); node.name = parseIdentifierOrPattern(); node.type = parseTypeAnnotation(); if (!isInOrOfKeyword(token)) { @@ -8457,21 +9317,21 @@ var ts; return finishNode(node); } function parseVariableDeclarationList(inForStatementInitializer) { - var node = createNode(212); + var node = createNode(219); switch (token) { case 102: break; case 108: - node.flags |= 8192; + node.flags |= 1024; break; case 74: - node.flags |= 16384; + node.flags |= 2048; break; default: ts.Debug.fail(); } nextToken(); - if (token === 134 && lookAhead(canFollowContextualOfKeyword)) { + if (token === 138 && lookAhead(canFollowContextualOfKeyword)) { node.declarations = createMissingList(); } else { @@ -8486,15 +9346,15 @@ var ts; return nextTokenIsIdentifier() && nextToken() === 18; } function parseVariableStatement(fullStart, decorators, modifiers) { - var node = createNode(193, fullStart); + var node = createNode(200, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.declarationList = parseVariableDeclarationList(false); parseSemicolon(); - return finishNode(node); + return addJSDocComment(finishNode(node)); } function parseFunctionDeclaration(fullStart, decorators, modifiers) { - var node = createNode(213, fullStart); + var node = createNode(220, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(87); @@ -8504,19 +9364,19 @@ var ts; var isAsync = !!(node.flags & 256); fillSignature(54, isGenerator, isAsync, false, node); node.body = parseFunctionBlockOrSemicolon(isGenerator, isAsync, ts.Diagnostics.or_expected); - return finishNode(node); + return addJSDocComment(finishNode(node)); } function parseConstructorDeclaration(pos, decorators, modifiers) { - var node = createNode(144, pos); + var node = createNode(148, pos); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(121); fillSignature(54, false, false, false, node); node.body = parseFunctionBlockOrSemicolon(false, false, ts.Diagnostics.or_expected); - return finishNode(node); + return addJSDocComment(finishNode(node)); } function parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, name, questionToken, diagnosticMessage) { - var method = createNode(143, fullStart); + var method = createNode(147, fullStart); method.decorators = decorators; setModifiers(method, modifiers); method.asteriskToken = asteriskToken; @@ -8526,18 +9386,18 @@ var ts; var isAsync = !!(method.flags & 256); fillSignature(54, isGenerator, isAsync, false, method); method.body = parseFunctionBlockOrSemicolon(isGenerator, isAsync, diagnosticMessage); - return finishNode(method); + return addJSDocComment(finishNode(method)); } function parsePropertyDeclaration(fullStart, decorators, modifiers, name, questionToken) { - var property = createNode(141, fullStart); + var property = createNode(145, fullStart); property.decorators = decorators; setModifiers(property, modifiers); property.name = name; property.questionToken = questionToken; property.type = parseTypeAnnotation(); - property.initializer = modifiers && modifiers.flags & 64 + property.initializer = modifiers && modifiers.flags & 32 ? allowInAnd(parseNonParameterInitializer) - : doOutsideOfContext(2 | 1, parseNonParameterInitializer); + : doOutsideOfContext(8388608 | 4194304, parseNonParameterInitializer); parseSemicolon(); return finishNode(property); } @@ -8570,6 +9430,7 @@ var ts; case 110: case 111: case 113: + case 128: return true; default: return false; @@ -8580,7 +9441,7 @@ var ts; if (token === 55) { return true; } - while (ts.isModifier(token)) { + while (ts.isModifierKind(token)) { idToken = token; if (isClassMemberModifier(idToken)) { return true; @@ -8598,7 +9459,7 @@ var ts; return true; } if (idToken !== undefined) { - if (!ts.isKeyword(idToken) || idToken === 129 || idToken === 123) { + if (!ts.isKeyword(idToken) || idToken === 131 || idToken === 123) { return true; } switch (token) { @@ -8623,9 +9484,9 @@ var ts; } if (!decorators) { decorators = []; - decorators.pos = scanner.getStartPos(); + decorators.pos = decoratorStart; } - var decorator = createNode(139, decoratorStart); + var decorator = createNode(143, decoratorStart); decorator.expression = doInDecoratorContext(parseLeftHandSideExpressionOrHigher); decorators.push(finishNode(decorator)); } @@ -8634,14 +9495,21 @@ var ts; } return decorators; } - function parseModifiers() { + function parseModifiers(permitInvalidConstAsModifier) { var flags = 0; var modifiers; while (true) { var modifierStart = scanner.getStartPos(); var modifierKind = token; - if (!parseAnyContextualModifier()) { - break; + if (token === 74 && permitInvalidConstAsModifier) { + if (!tryParse(nextTokenIsOnSameLineAndCanFollowModifier)) { + break; + } + } + else { + if (!parseAnyContextualModifier()) { + break; + } } if (!modifiers) { modifiers = []; @@ -8674,13 +9542,13 @@ var ts; } function parseClassElement() { if (token === 23) { - var result = createNode(191); + var result = createNode(198); nextToken(); return finishNode(result); } var fullStart = getNodePos(); var decorators = parseDecorators(); - var modifiers = parseModifiers(); + var modifiers = parseModifiers(true); var accessor = tryParseAccessorDeclaration(fullStart, decorators, modifiers); if (accessor) { return accessor; @@ -8705,10 +9573,10 @@ var ts; ts.Debug.fail("Should not have attempted to parse class member declaration."); } function parseClassExpression() { - return parseClassDeclarationOrExpression(scanner.getStartPos(), undefined, undefined, 186); + return parseClassDeclarationOrExpression(scanner.getStartPos(), undefined, undefined, 192); } function parseClassDeclaration(fullStart, decorators, modifiers) { - return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 214); + return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 221); } function parseClassDeclarationOrExpression(fullStart, decorators, modifiers, kind) { var node = createNode(kind, fullStart); @@ -8741,12 +9609,9 @@ var ts; } return undefined; } - function parseHeritageClausesWorker() { - return parseList(20, parseHeritageClause); - } function parseHeritageClause() { if (token === 83 || token === 106) { - var node = createNode(243); + var node = createNode(251); node.token = token; nextToken(); node.types = parseDelimitedList(7, parseExpressionWithTypeArguments); @@ -8755,7 +9620,7 @@ var ts; return undefined; } function parseExpressionWithTypeArguments() { - var node = createNode(188); + var node = createNode(194); node.expression = parseLeftHandSideExpressionOrHigher(); if (token === 25) { node.typeArguments = parseBracketedList(18, parseType, 25, 27); @@ -8769,7 +9634,7 @@ var ts; return parseList(5, parseClassElement); } function parseInterfaceDeclaration(fullStart, decorators, modifiers) { - var node = createNode(215, fullStart); + var node = createNode(222, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(107); @@ -8780,10 +9645,10 @@ var ts; return finishNode(node); } function parseTypeAliasDeclaration(fullStart, decorators, modifiers) { - var node = createNode(216, fullStart); + var node = createNode(223, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - parseExpected(132); + parseExpected(134); node.name = parseIdentifier(); node.typeParameters = parseTypeParameters(); parseExpected(56); @@ -8792,13 +9657,13 @@ var ts; return finishNode(node); } function parseEnumMember() { - var node = createNode(247, scanner.getStartPos()); + var node = createNode(255, scanner.getStartPos()); node.name = parsePropertyName(); node.initializer = allowInAnd(parseNonParameterInitializer); return finishNode(node); } function parseEnumDeclaration(fullStart, decorators, modifiers) { - var node = createNode(217, fullStart); + var node = createNode(224, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(81); @@ -8813,7 +9678,7 @@ var ts; return finishNode(node); } function parseModuleBlock() { - var node = createNode(219, scanner.getStartPos()); + var node = createNode(226, scanner.getStartPos()); if (parseExpected(15)) { node.statements = parseList(1, parseStatement); parseExpected(16); @@ -8824,29 +9689,38 @@ var ts; return finishNode(node); } function parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags) { - var node = createNode(218, fullStart); - var namespaceFlag = flags & 65536; + var node = createNode(225, fullStart); + var namespaceFlag = flags & 4096; node.decorators = decorators; setModifiers(node, modifiers); node.flags |= flags; node.name = parseIdentifier(); node.body = parseOptional(21) - ? parseModuleOrNamespaceDeclaration(getNodePos(), undefined, undefined, 2 | namespaceFlag) + ? parseModuleOrNamespaceDeclaration(getNodePos(), undefined, undefined, 1 | namespaceFlag) : parseModuleBlock(); return finishNode(node); } function parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers) { - var node = createNode(218, fullStart); + var node = createNode(225, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - node.name = parseLiteralNode(true); + if (token === 137) { + node.name = parseIdentifier(); + node.flags |= 131072; + } + else { + node.name = parseLiteralNode(true); + } node.body = parseModuleBlock(); return finishNode(node); } function parseModuleDeclaration(fullStart, decorators, modifiers) { var flags = modifiers ? modifiers.flags : 0; - if (parseOptional(126)) { - flags |= 65536; + if (token === 137) { + return parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers); + } + else if (parseOptional(126)) { + flags |= 4096; } else { parseExpected(125); @@ -8857,7 +9731,7 @@ var ts; return parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags); } function isExternalModuleReference() { - return token === 127 && + return token === 129 && lookAhead(nextTokenIsOpenParen); } function nextTokenIsOpenParen() { @@ -8866,10 +9740,15 @@ var ts; function nextTokenIsSlash() { return nextToken() === 39; } - function nextTokenIsCommaOrFromKeyword() { - nextToken(); - return token === 24 || - token === 133; + function parseGlobalModuleExportDeclaration(fullStart, decorators, modifiers) { + var exportDeclaration = createNode(228, fullStart); + exportDeclaration.decorators = decorators; + exportDeclaration.modifiers = modifiers; + parseExpected(116); + parseExpected(126); + exportDeclaration.name = parseIdentifier(); + parseExpected(23); + return finishNode(exportDeclaration); } function parseImportDeclarationOrImportEqualsDeclaration(fullStart, decorators, modifiers) { parseExpected(89); @@ -8877,8 +9756,8 @@ var ts; var identifier; if (isIdentifier()) { identifier = parseIdentifier(); - if (token !== 24 && token !== 133) { - var importEqualsDeclaration = createNode(221, fullStart); + if (token !== 24 && token !== 136) { + var importEqualsDeclaration = createNode(229, fullStart); importEqualsDeclaration.decorators = decorators; setModifiers(importEqualsDeclaration, modifiers); importEqualsDeclaration.name = identifier; @@ -8888,27 +9767,27 @@ var ts; return finishNode(importEqualsDeclaration); } } - var importDeclaration = createNode(222, fullStart); + var importDeclaration = createNode(230, fullStart); importDeclaration.decorators = decorators; setModifiers(importDeclaration, modifiers); if (identifier || token === 37 || token === 15) { importDeclaration.importClause = parseImportClause(identifier, afterImportPos); - parseExpected(133); + parseExpected(136); } importDeclaration.moduleSpecifier = parseModuleSpecifier(); parseSemicolon(); return finishNode(importDeclaration); } function parseImportClause(identifier, fullStart) { - var importClause = createNode(223, fullStart); + var importClause = createNode(231, fullStart); if (identifier) { importClause.name = identifier; } if (!importClause.name || parseOptional(24)) { - importClause.namedBindings = token === 37 ? parseNamespaceImport() : parseNamedImportsOrExports(225); + importClause.namedBindings = token === 37 ? parseNamespaceImport() : parseNamedImportsOrExports(233); } return finishNode(importClause); } @@ -8918,22 +9797,25 @@ var ts; : parseEntityName(false); } function parseExternalModuleReference() { - var node = createNode(232); - parseExpected(127); + var node = createNode(240); + parseExpected(129); parseExpected(17); node.expression = parseModuleSpecifier(); parseExpected(18); return finishNode(node); } function parseModuleSpecifier() { - var result = parseExpression(); - if (result.kind === 9) { + if (token === 9) { + var result = parseLiteralNode(); internIdentifier(result.text); + return result; + } + else { + return parseExpression(); } - return result; } function parseNamespaceImport() { - var namespaceImport = createNode(224); + var namespaceImport = createNode(232); parseExpected(37); parseExpected(116); namespaceImport.name = parseIdentifier(); @@ -8941,14 +9823,14 @@ var ts; } function parseNamedImportsOrExports(kind) { var node = createNode(kind); - node.elements = parseBracketedList(21, kind === 225 ? parseImportSpecifier : parseExportSpecifier, 15, 16); + node.elements = parseBracketedList(21, kind === 233 ? parseImportSpecifier : parseExportSpecifier, 15, 16); return finishNode(node); } function parseExportSpecifier() { - return parseImportOrExportSpecifier(230); + return parseImportOrExportSpecifier(238); } function parseImportSpecifier() { - return parseImportOrExportSpecifier(226); + return parseImportOrExportSpecifier(234); } function parseImportOrExportSpecifier(kind) { var node = createNode(kind); @@ -8967,23 +9849,23 @@ var ts; else { node.name = identifierName; } - if (kind === 226 && checkIdentifierIsKeyword) { + if (kind === 234 && checkIdentifierIsKeyword) { parseErrorAtPosition(checkIdentifierStart, checkIdentifierEnd - checkIdentifierStart, ts.Diagnostics.Identifier_expected); } return finishNode(node); } function parseExportDeclaration(fullStart, decorators, modifiers) { - var node = createNode(228, fullStart); + var node = createNode(236, fullStart); node.decorators = decorators; setModifiers(node, modifiers); if (parseOptional(37)) { - parseExpected(133); + parseExpected(136); node.moduleSpecifier = parseModuleSpecifier(); } else { - node.exportClause = parseNamedImportsOrExports(229); - if (token === 133 || (token === 9 && !scanner.hasPrecedingLineBreak())) { - parseExpected(133); + node.exportClause = parseNamedImportsOrExports(237); + if (token === 136 || (token === 9 && !scanner.hasPrecedingLineBreak())) { + parseExpected(136); node.moduleSpecifier = parseModuleSpecifier(); } } @@ -8991,7 +9873,7 @@ var ts; return finishNode(node); } function parseExportAssignment(fullStart, decorators, modifiers) { - var node = createNode(227, fullStart); + var node = createNode(235, fullStart); node.decorators = decorators; setModifiers(node, modifiers); if (parseOptional(56)) { @@ -9007,15 +9889,18 @@ var ts; function processReferenceComments(sourceFile) { var triviaScanner = ts.createScanner(sourceFile.languageVersion, false, 0, sourceText); var referencedFiles = []; + var typeReferenceDirectives = []; var amdDependencies = []; var amdModuleName; while (true) { var kind = triviaScanner.scan(); - if (kind === 5 || kind === 4 || kind === 3) { - continue; - } if (kind !== 2) { - break; + if (ts.isTrivia(kind)) { + continue; + } + else { + break; + } } var range = { pos: triviaScanner.getTokenPos(), end: triviaScanner.getTextPos(), kind: triviaScanner.getToken() }; var comment = sourceText.substring(range.pos, range.end); @@ -9025,7 +9910,12 @@ var ts; sourceFile.hasNoDefaultLib = referencePathMatchResult.isNoDefaultLib; var diagnosticMessage = referencePathMatchResult.diagnosticMessage; if (fileReference) { - referencedFiles.push(fileReference); + if (referencePathMatchResult.isTypeReferenceDirective) { + typeReferenceDirectives.push(fileReference); + } + else { + referencedFiles.push(fileReference); + } } if (diagnosticMessage) { parseDiagnostics.push(ts.createFileDiagnostic(sourceFile, range.pos, range.end - range.pos, diagnosticMessage)); @@ -9055,16 +9945,17 @@ var ts; } } sourceFile.referencedFiles = referencedFiles; + sourceFile.typeReferenceDirectives = typeReferenceDirectives; sourceFile.amdDependencies = amdDependencies; sourceFile.moduleName = amdModuleName; } function setExternalModuleIndicator(sourceFile) { sourceFile.externalModuleIndicator = ts.forEach(sourceFile.statements, function (node) { - return node.flags & 2 - || node.kind === 221 && node.moduleReference.kind === 232 - || node.kind === 222 - || node.kind === 227 - || node.kind === 228 + return node.flags & 1 + || node.kind === 229 && node.moduleReference.kind === 240 + || node.kind === 230 + || node.kind === 235 + || node.kind === 236 ? node : undefined; }); @@ -9089,17 +9980,17 @@ var ts; } JSDocParser.isJSDocType = isJSDocType; function parseJSDocTypeExpressionForTests(content, start, length) { - initializeState("file.js", content, 2, true, undefined); - var jsDocTypeExpression = parseJSDocTypeExpression(start, length); + initializeState("file.js", content, 2, undefined, 1); + scanner.setText(content, start, length); + token = scanner.scan(); + var jsDocTypeExpression = parseJSDocTypeExpression(); var diagnostics = parseDiagnostics; clearState(); return jsDocTypeExpression ? { jsDocTypeExpression: jsDocTypeExpression, diagnostics: diagnostics } : undefined; } JSDocParser.parseJSDocTypeExpressionForTests = parseJSDocTypeExpressionForTests; - function parseJSDocTypeExpression(start, length) { - scanner.setText(sourceText, start, length); - token = nextToken(); - var result = createNode(249); + function parseJSDocTypeExpression() { + var result = createNode(257, scanner.getTokenPos()); parseExpected(15); result.type = parseJSDocTopLevelType(); parseExpected(16); @@ -9110,12 +10001,12 @@ var ts; function parseJSDocTopLevelType() { var type = parseJSDocType(); if (token === 47) { - var unionType = createNode(253, type.pos); + var unionType = createNode(261, type.pos); unionType.types = parseJSDocTypeList(type); type = finishNode(unionType); } if (token === 56) { - var optionalType = createNode(260, type.pos); + var optionalType = createNode(268, type.pos); nextToken(); optionalType.type = type; type = finishNode(optionalType); @@ -9126,20 +10017,20 @@ var ts; var type = parseBasicTypeExpression(); while (true) { if (token === 19) { - var arrayType = createNode(252, type.pos); + var arrayType = createNode(260, type.pos); arrayType.elementType = type; nextToken(); parseExpected(20); type = finishNode(arrayType); } else if (token === 53) { - var nullableType = createNode(255, type.pos); + var nullableType = createNode(263, type.pos); nullableType.type = type; nextToken(); type = finishNode(nullableType); } else if (token === 49) { - var nonNullableType = createNode(256, type.pos); + var nonNullableType = createNode(264, type.pos); nonNullableType.type = type; nextToken(); type = finishNode(nonNullableType); @@ -9173,37 +10064,37 @@ var ts; case 97: return parseJSDocThisType(); case 117: + case 132: case 130: - case 128: case 120: - case 131: + case 133: case 103: return parseTokenNode(); } return parseJSDocTypeReference(); } function parseJSDocThisType() { - var result = createNode(264); + var result = createNode(272); nextToken(); parseExpected(54); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocConstructorType() { - var result = createNode(263); + var result = createNode(271); nextToken(); parseExpected(54); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocVariadicType() { - var result = createNode(262); + var result = createNode(270); nextToken(); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocFunctionType() { - var result = createNode(261); + var result = createNode(269); nextToken(); parseExpected(17); result.parameters = parseDelimitedList(22, parseJSDocParameter); @@ -9216,26 +10107,28 @@ var ts; return finishNode(result); } function parseJSDocParameter() { - var parameter = createNode(138); + var parameter = createNode(142); parameter.type = parseJSDocType(); + if (parseOptional(56)) { + parameter.questionToken = createNode(56); + } return finishNode(parameter); } - function parseJSDocOptionalType(type) { - var result = createNode(260, type.pos); - nextToken(); - result.type = type; - return finishNode(result); - } function parseJSDocTypeReference() { - var result = createNode(259); + var result = createNode(267); result.name = parseSimplePropertyName(); - while (parseOptional(21)) { - if (token === 25) { - result.typeArguments = parseTypeArguments(); - break; - } - else { - result.name = parseQualifiedName(result.name); + if (token === 25) { + result.typeArguments = parseTypeArguments(); + } + else { + while (parseOptional(21)) { + if (token === 25) { + result.typeArguments = parseTypeArguments(); + break; + } + else { + result.name = parseQualifiedName(result.name); + } } } return finishNode(result); @@ -9256,13 +10149,13 @@ var ts; } } function parseQualifiedName(left) { - var result = createNode(135, left.pos); + var result = createNode(139, left.pos); result.left = left; result.right = parseIdentifierName(); return finishNode(result); } function parseJSDocRecordType() { - var result = createNode(257); + var result = createNode(265); nextToken(); result.members = parseDelimitedList(24, parseJSDocRecordMember); checkForTrailingComma(result.members); @@ -9270,7 +10163,7 @@ var ts; return finishNode(result); } function parseJSDocRecordMember() { - var result = createNode(258); + var result = createNode(266); result.name = parseSimplePropertyName(); if (token === 54) { nextToken(); @@ -9279,13 +10172,13 @@ var ts; return finishNode(result); } function parseJSDocNonNullableType() { - var result = createNode(256); + var result = createNode(264); nextToken(); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocTupleType() { - var result = createNode(254); + var result = createNode(262); nextToken(); result.types = parseDelimitedList(25, parseJSDocType); checkForTrailingComma(result.types); @@ -9299,7 +10192,7 @@ var ts; } } function parseJSDocUnionType() { - var result = createNode(253); + var result = createNode(261); nextToken(); result.types = parseJSDocTypeList(parseJSDocType()); parseExpected(18); @@ -9317,7 +10210,7 @@ var ts; return types; } function parseJSDocAllType() { - var result = createNode(250); + var result = createNode(258); nextToken(); return finishNode(result); } @@ -9330,29 +10223,35 @@ var ts; token === 27 || token === 56 || token === 47) { - var result = createNode(251, pos); + var result = createNode(259, pos); return finishNode(result); } else { - var result = createNode(255, pos); + var result = createNode(263, pos); result.type = parseJSDocType(); return finishNode(result); } } function parseIsolatedJSDocComment(content, start, length) { - initializeState("file.js", content, 2, true, undefined); - var jsDocComment = parseJSDocComment(undefined, start, length); + initializeState("file.js", content, 2, undefined, 1); + sourceFile = { languageVariant: 0, text: content }; + var jsDocComment = parseJSDocCommentWorker(start, length); var diagnostics = parseDiagnostics; clearState(); return jsDocComment ? { jsDocComment: jsDocComment, diagnostics: diagnostics } : undefined; } JSDocParser.parseIsolatedJSDocComment = parseIsolatedJSDocComment; function parseJSDocComment(parent, start, length) { + var saveToken = token; + var saveParseDiagnosticsLength = parseDiagnostics.length; + var saveParseErrorBeforeNextFinishedNode = parseErrorBeforeNextFinishedNode; var comment = parseJSDocCommentWorker(start, length); if (comment) { - fixupParentReferences(comment); comment.parent = parent; } + token = saveToken; + parseDiagnostics.length = saveParseDiagnosticsLength; + parseErrorBeforeNextFinishedNode = saveParseErrorBeforeNextFinishedNode; return comment; } JSDocParser.parseJSDocComment = parseJSDocComment; @@ -9365,60 +10264,64 @@ var ts; ts.Debug.assert(start <= end); ts.Debug.assert(end <= content.length); var tags; - var pos; - if (length >= "/** */".length) { - if (content.charCodeAt(start) === 47 && - content.charCodeAt(start + 1) === 42 && - content.charCodeAt(start + 2) === 42 && - content.charCodeAt(start + 3) !== 42) { + var result; + if (content.charCodeAt(start) === 47 && + content.charCodeAt(start + 1) === 42 && + content.charCodeAt(start + 2) === 42 && + content.charCodeAt(start + 3) !== 42) { + scanner.scanRange(start + 3, length - 5, function () { var canParseTag = true; var seenAsterisk = true; - for (pos = start + "/**".length; pos < end;) { - var ch = content.charCodeAt(pos); - pos++; - if (ch === 64 && canParseTag) { - parseTag(); - canParseTag = false; - continue; - } - if (ts.isLineBreak(ch)) { - canParseTag = true; - seenAsterisk = false; - continue; - } - if (ts.isWhiteSpace(ch)) { - continue; - } - if (ch === 42) { - if (seenAsterisk) { + nextJSDocToken(); + while (token !== 1) { + switch (token) { + case 55: + if (canParseTag) { + parseTag(); + } + seenAsterisk = false; + break; + case 4: + canParseTag = true; + seenAsterisk = false; + break; + case 37: + if (seenAsterisk) { + canParseTag = false; + } + seenAsterisk = true; + break; + case 69: canParseTag = false; - } - seenAsterisk = true; - continue; + break; + case 1: + break; } - canParseTag = false; + nextJSDocToken(); } - } + result = createJSDocComment(); + }); } - return createJSDocComment(); + return result; function createJSDocComment() { if (!tags) { return undefined; } - var result = createNode(265, start); + var result = createNode(273, start); result.tags = tags; return finishNode(result, end); } function skipWhitespace() { - while (pos < end && ts.isWhiteSpace(content.charCodeAt(pos))) { - pos++; + while (token === 5 || token === 4) { + nextJSDocToken(); } } function parseTag() { - ts.Debug.assert(content.charCodeAt(pos - 1) === 64); - var atToken = createNode(55, pos - 1); - atToken.end = pos; - var tagName = scanIdentifier(); + ts.Debug.assert(token === 55); + var atToken = createNode(55, scanner.getTokenPos()); + atToken.end = scanner.getTextPos(); + nextJSDocToken(); + var tagName = parseJSDocIdentifierName(); if (!tagName) { return; } @@ -9442,10 +10345,10 @@ var ts; return undefined; } function handleUnknownTag(atToken, tagName) { - var result = createNode(266, atToken.pos); + var result = createNode(274, atToken.pos); result.atToken = atToken; result.tagName = tagName; - return finishNode(result, pos); + return finishNode(result); } function addTag(tag) { if (tag) { @@ -9458,12 +10361,10 @@ var ts; } } function tryParseTypeExpression() { - skipWhitespace(); - if (content.charCodeAt(pos) !== 123) { + if (token !== 15) { return undefined; } - var typeExpression = parseJSDocTypeExpression(pos, end - pos); - pos = typeExpression.end; + var typeExpression = parseJSDocTypeExpression(); return typeExpression; } function handleParamTag(atToken, tagName) { @@ -9471,17 +10372,20 @@ var ts; skipWhitespace(); var name; var isBracketed; - if (content.charCodeAt(pos) === 91) { - pos++; - skipWhitespace(); - name = scanIdentifier(); + if (parseOptionalToken(19)) { + name = parseJSDocIdentifierName(); isBracketed = true; + if (parseOptionalToken(56)) { + parseExpression(); + } + parseExpected(20); } - else { - name = scanIdentifier(); + else if (ts.tokenIsIdentifierOrKeyword(token)) { + name = parseJSDocIdentifierName(); } if (!name) { - parseErrorAtPosition(pos, 0, ts.Diagnostics.Identifier_expected); + parseErrorAtPosition(scanner.getStartPos(), 0, ts.Diagnostics.Identifier_expected); + return undefined; } var preName, postName; if (typeExpression) { @@ -9493,84 +10397,84 @@ var ts; if (!typeExpression) { typeExpression = tryParseTypeExpression(); } - var result = createNode(267, atToken.pos); + var result = createNode(275, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.preParameterName = preName; result.typeExpression = typeExpression; result.postParameterName = postName; result.isBracketed = isBracketed; - return finishNode(result, pos); + return finishNode(result); } function handleReturnTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 268; })) { - parseErrorAtPosition(tagName.pos, pos - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); + if (ts.forEach(tags, function (t) { return t.kind === 276; })) { + parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } - var result = createNode(268, atToken.pos); + var result = createNode(276, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); - return finishNode(result, pos); + return finishNode(result); } function handleTypeTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 269; })) { - parseErrorAtPosition(tagName.pos, pos - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); + if (ts.forEach(tags, function (t) { return t.kind === 277; })) { + parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } - var result = createNode(269, atToken.pos); + var result = createNode(277, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); - return finishNode(result, pos); + return finishNode(result); } function handleTemplateTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 270; })) { - parseErrorAtPosition(tagName.pos, pos - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); + if (ts.forEach(tags, function (t) { return t.kind === 278; })) { + parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } var typeParameters = []; - typeParameters.pos = pos; + typeParameters.pos = scanner.getStartPos(); while (true) { - skipWhitespace(); - var startPos = pos; - var name_8 = scanIdentifier(); + var name_8 = parseJSDocIdentifierName(); if (!name_8) { - parseErrorAtPosition(startPos, 0, ts.Diagnostics.Identifier_expected); + parseErrorAtPosition(scanner.getStartPos(), 0, ts.Diagnostics.Identifier_expected); return undefined; } - var typeParameter = createNode(137, name_8.pos); + var typeParameter = createNode(141, name_8.pos); typeParameter.name = name_8; - finishNode(typeParameter, pos); + finishNode(typeParameter); typeParameters.push(typeParameter); - skipWhitespace(); - if (content.charCodeAt(pos) !== 44) { + if (token === 24) { + nextJSDocToken(); + } + else { break; } - pos++; } - typeParameters.end = pos; - var result = createNode(270, atToken.pos); + var result = createNode(278, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeParameters = typeParameters; - return finishNode(result, pos); + finishNode(result); + typeParameters.end = result.end; + return result; } - function scanIdentifier() { - var startPos = pos; - for (; pos < end; pos++) { - var ch = content.charCodeAt(pos); - if (pos === startPos && ts.isIdentifierStart(ch, 2)) { - continue; - } - else if (pos > startPos && ts.isIdentifierPart(ch, 2)) { - continue; - } - break; - } - if (startPos === pos) { + function nextJSDocToken() { + return token = scanner.scanJSDocToken(); + } + function parseJSDocIdentifierName() { + return createJSDocIdentifier(ts.tokenIsIdentifierOrKeyword(token)); + } + function createJSDocIdentifier(isIdentifier) { + if (!isIdentifier) { + parseErrorAtCurrentToken(ts.Diagnostics.Identifier_expected); return undefined; } - var result = createNode(69, startPos); - result.text = content.substring(startPos, pos); - return finishNode(result, pos); + var pos = scanner.getTokenPos(); + var end = scanner.getTextPos(); + var result = createNode(69, pos); + result.text = content.substring(pos, end); + finishNode(result, end); + nextJSDocToken(); + return result; } } JSDocParser.parseJSDocCommentWorker = parseJSDocCommentWorker; @@ -9585,7 +10489,7 @@ var ts; return sourceFile; } if (sourceFile.statements.length === 0) { - return Parser.parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, undefined, true); + return Parser.parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, undefined, true, sourceFile.scriptKind); } var incrementalSourceFile = sourceFile; ts.Debug.assert(!incrementalSourceFile.hasBeenIncrementallyParsed); @@ -9599,7 +10503,7 @@ var ts; ts.Debug.assert(ts.textSpanEnd(ts.textChangeRangeNewSpan(changeRange)) === ts.textSpanEnd(ts.textChangeRangeNewSpan(textChangeRange))); var delta = ts.textChangeRangeNewSpan(changeRange).length - changeRange.span.length; updateTokenPositionsAndMarkElements(incrementalSourceFile, changeRange.span.start, ts.textSpanEnd(changeRange.span), ts.textSpanEnd(ts.textChangeRangeNewSpan(changeRange)), delta, oldText, newText, aggressiveChecks); - var result = Parser.parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, syntaxCursor, true); + var result = Parser.parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, syntaxCursor, true, sourceFile.scriptKind); return result; } IncrementalParser.updateSourceFile = updateSourceFile; @@ -9668,12 +10572,12 @@ var ts; } function checkNodePositions(node, aggressiveChecks) { if (aggressiveChecks) { - var pos = node.pos; + var pos_2 = node.pos; forEachChild(node, function (child) { - ts.Debug.assert(child.pos >= pos); - pos = child.end; + ts.Debug.assert(child.pos >= pos_2); + pos_2 = child.end; }); - ts.Debug.assert(pos <= node.end); + ts.Debug.assert(pos_2 <= node.end); } } function updateTokenPositionsAndMarkElements(sourceFile, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta, oldText, newText, aggressiveChecks) { @@ -9861,40 +10765,33 @@ var ts; var ts; (function (ts) { ts.bindTime = 0; - function or(state1, state2) { - return (state1 | state2) & 2 - ? 2 - : (state1 & state2) & 8 - ? 8 - : 4; - } function getModuleInstanceState(node) { - if (node.kind === 215 || node.kind === 216) { + if (node.kind === 222 || node.kind === 223) { return 0; } else if (ts.isConstEnumDeclaration(node)) { return 2; } - else if ((node.kind === 222 || node.kind === 221) && !(node.flags & 2)) { + else if ((node.kind === 230 || node.kind === 229) && !(node.flags & 1)) { return 0; } - else if (node.kind === 219) { - var state = 0; + else if (node.kind === 226) { + var state_1 = 0; ts.forEachChild(node, function (n) { switch (getModuleInstanceState(n)) { case 0: return false; case 2: - state = 2; + state_1 = 2; return false; case 1: - state = 1; + state_1 = 1; return true; } }); - return state; + return state_1; } - else if (node.kind === 218) { + else if (node.kind === 225) { return getModuleInstanceState(node.body); } else { @@ -9912,40 +10809,64 @@ var ts; function createBinder() { var file; var options; + var languageVersion; var parent; var container; var blockScopeContainer; var lastContainer; var seenThisKeyword; var hasExplicitReturn; - var currentReachabilityState; - var labelStack; - var labelIndexMap; - var implicitLabels; + var currentFlow; + var currentBreakTarget; + var currentContinueTarget; + var currentTrueTarget; + var currentFalseTarget; + var preSwitchCaseFlow; + var activeLabels; + var hasClassExtends; + var hasAsyncFunctions; + var hasDecorators; + var hasParameterDecorators; + var hasJsxSpreadAttribute; var inStrictMode; var symbolCount = 0; var Symbol; var classifiableNames; + var unreachableFlow = { flags: 1 }; + var reportedUnreachableFlow = { flags: 1 }; function bindSourceFile(f, opts) { file = f; options = opts; + languageVersion = ts.getEmitScriptTarget(options); inStrictMode = !!file.externalModuleIndicator; classifiableNames = {}; + symbolCount = 0; Symbol = ts.objectAllocator.getSymbolConstructor(); if (!file.locals) { bind(file); file.symbolCount = symbolCount; file.classifiableNames = classifiableNames; } + file = undefined; + options = undefined; + languageVersion = undefined; parent = undefined; container = undefined; blockScopeContainer = undefined; lastContainer = undefined; seenThisKeyword = false; hasExplicitReturn = false; - labelStack = undefined; - labelIndexMap = undefined; - implicitLabels = undefined; + currentFlow = undefined; + currentBreakTarget = undefined; + currentContinueTarget = undefined; + currentTrueTarget = undefined; + currentFalseTarget = undefined; + activeLabels = undefined; + hasClassExtends = false; + hasAsyncFunctions = false; + hasDecorators = false; + hasParameterDecorators = false; + hasJsxSpreadAttribute = false; } return bindSourceFile; function createSymbol(flags, name) { @@ -9965,16 +10886,20 @@ var ts; if (symbolFlags & 6240 && !symbol.members) { symbol.members = {}; } - if (symbolFlags & 107455 && !symbol.valueDeclaration) { - symbol.valueDeclaration = node; + if (symbolFlags & 107455) { + var valueDeclaration = symbol.valueDeclaration; + if (!valueDeclaration || + (valueDeclaration.kind !== node.kind && valueDeclaration.kind === 225)) { + symbol.valueDeclaration = node; + } } } function getDeclarationName(node) { if (node.name) { - if (node.kind === 218 && node.name.kind === 9) { - return "\"" + node.name.text + "\""; + if (ts.isAmbientModule(node)) { + return ts.isGlobalScopeAugmentation(node) ? "__global" : "\"" + node.name.text + "\""; } - if (node.name.kind === 136) { + if (node.name.kind === 140) { var nameExpression = node.name.expression; if (ts.isStringOrNumericLiteral(nameExpression.kind)) { return nameExpression.text; @@ -9985,25 +10910,42 @@ var ts; return node.name.text; } switch (node.kind) { - case 144: - return "__constructor"; - case 152: - case 147: - return "__call"; - case 153: case 148: + return "__constructor"; + case 156: + case 151: + return "__call"; + case 157: + case 152: return "__new"; - case 149: + case 153: return "__index"; - case 228: + case 236: return "__export"; - case 227: + case 235: return node.isExportEquals ? "export=" : "default"; - case 181: - return "export="; - case 213: - case 214: + case 187: + switch (ts.getSpecialPropertyAssignmentKind(node)) { + case 2: + return "export="; + case 1: + case 4: + return node.left.name.text; + case 3: + return node.left.expression.name.text; + } + ts.Debug.fail("Unknown binary declaration kind"); + break; + case 220: + case 221: return node.flags & 512 ? "default" : undefined; + case 269: + return ts.isJSDocConstructSignature(node) ? "__new" : "__call"; + case 142: + ts.Debug.assert(node.parent.kind === 269); + var functionType = node.parent; + var index = ts.indexOf(functionType.parameters, node); + return "p" + index; } } function getDisplayName(node) { @@ -10025,18 +10967,18 @@ var ts; if (node.name) { node.name.parent = node; } - var message = symbol.flags & 2 + var message_1 = symbol.flags & 2 ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0; ts.forEach(symbol.declarations, function (declaration) { if (declaration.flags & 512) { - message = ts.Diagnostics.A_module_cannot_have_multiple_default_exports; + message_1 = ts.Diagnostics.A_module_cannot_have_multiple_default_exports; } }); ts.forEach(symbol.declarations, function (declaration) { - file.bindDiagnostics.push(ts.createDiagnosticForNode(declaration.name || declaration, message, getDisplayName(declaration))); + file.bindDiagnostics.push(ts.createDiagnosticForNode(declaration.name || declaration, message_1, getDisplayName(declaration))); }); - file.bindDiagnostics.push(ts.createDiagnosticForNode(node.name || node, message, getDisplayName(node))); + file.bindDiagnostics.push(ts.createDiagnosticForNode(node.name || node, message_1, getDisplayName(node))); symbol = createSymbol(0, name); } } @@ -10048,9 +10990,9 @@ var ts; return symbol; } function declareModuleMember(node, symbolFlags, symbolExcludes) { - var hasExportModifier = ts.getCombinedNodeFlags(node) & 2; + var hasExportModifier = ts.getCombinedNodeFlags(node) & 1; if (symbolFlags & 8388608) { - if (node.kind === 230 || (node.kind === 221 && hasExportModifier)) { + if (node.kind === 238 || (node.kind === 229 && hasExportModifier)) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); } else { @@ -10058,7 +11000,7 @@ var ts; } } else { - if (hasExportModifier || container.flags & 131072) { + if (!ts.isAmbientModule(node) && (hasExportModifier || container.flags & 8192)) { var exportKind = (symbolFlags & 107455 ? 1048576 : 0) | (symbolFlags & 793056 ? 2097152 : 0) | (symbolFlags & 1536 ? 4194304 : 0); @@ -10089,45 +11031,68 @@ var ts; blockScopeContainer = node; blockScopeContainer.locals = undefined; } - var savedReachabilityState; - var savedLabelStack; - var savedLabels; - var savedImplicitLabels; var savedHasExplicitReturn; + var savedCurrentFlow; + var savedBreakTarget; + var savedContinueTarget; + var savedActiveLabels; var kind = node.kind; var flags = node.flags; - flags &= ~1572864; - if (kind === 215) { + flags &= ~98304; + flags &= ~3932160; + if (kind === 222) { seenThisKeyword = false; } - var saveState = kind === 248 || kind === 219 || ts.isFunctionLikeKind(kind); + var saveState = kind === 256 || kind === 226 || ts.isFunctionLikeKind(kind); if (saveState) { - savedReachabilityState = currentReachabilityState; - savedLabelStack = labelStack; - savedLabels = labelIndexMap; - savedImplicitLabels = implicitLabels; savedHasExplicitReturn = hasExplicitReturn; - currentReachabilityState = 2; + savedCurrentFlow = currentFlow; + savedBreakTarget = currentBreakTarget; + savedContinueTarget = currentContinueTarget; + savedActiveLabels = activeLabels; hasExplicitReturn = false; - labelStack = labelIndexMap = implicitLabels = undefined; + currentFlow = { flags: 2 }; + currentBreakTarget = undefined; + currentContinueTarget = undefined; + activeLabels = undefined; + } + if (ts.isInJavaScriptFile(node) && node.jsDocComment) { + bind(node.jsDocComment); } bindReachableStatement(node); - if (currentReachabilityState === 2 && ts.isFunctionLikeKind(kind) && ts.nodeIsPresent(node.body)) { - flags |= 524288; + if (!(currentFlow.flags & 1) && ts.isFunctionLikeKind(kind) && ts.nodeIsPresent(node.body)) { + flags |= 32768; if (hasExplicitReturn) { - flags |= 1048576; + flags |= 65536; } } - if (kind === 215) { - flags = seenThisKeyword ? flags | 262144 : flags & ~262144; + if (kind === 222) { + flags = seenThisKeyword ? flags | 16384 : flags & ~16384; + } + if (kind === 256) { + if (hasClassExtends) { + flags |= 262144; + } + if (hasDecorators) { + flags |= 524288; + } + if (hasParameterDecorators) { + flags |= 1048576; + } + if (hasAsyncFunctions) { + flags |= 2097152; + } + if (hasJsxSpreadAttribute) { + flags |= 1073741824; + } } node.flags = flags; if (saveState) { hasExplicitReturn = savedHasExplicitReturn; - currentReachabilityState = savedReachabilityState; - labelStack = savedLabelStack; - labelIndexMap = savedLabels; - implicitLabels = savedImplicitLabels; + currentFlow = savedCurrentFlow; + currentBreakTarget = savedBreakTarget; + currentContinueTarget = savedContinueTarget; + activeLabels = savedActiveLabels; } container = saveContainer; parent = saveParent; @@ -10139,185 +11104,562 @@ var ts; return; } switch (node.kind) { - case 198: + case 205: bindWhileStatement(node); break; - case 197: + case 204: bindDoStatement(node); break; - case 199: + case 206: bindForStatement(node); break; - case 200: - case 201: + case 207: + case 208: bindForInOrForOfStatement(node); break; - case 196: + case 203: bindIfStatement(node); break; - case 204: - case 208: + case 211: + case 215: bindReturnOrThrow(node); break; - case 203: - case 202: + case 210: + case 209: bindBreakOrContinueStatement(node); break; - case 209: + case 216: bindTryStatement(node); break; - case 206: + case 213: bindSwitchStatement(node); break; - case 220: + case 227: bindCaseBlock(node); break; - case 207: + case 214: bindLabeledStatement(node); break; + case 185: + bindPrefixUnaryExpressionFlow(node); + break; + case 187: + bindBinaryExpressionFlow(node); + break; + case 181: + bindDeleteExpressionFlow(node); + break; + case 188: + bindConditionalExpressionFlow(node); + break; + case 218: + bindVariableDeclarationFlow(node); + break; default: ts.forEachChild(node, bind); break; } } - function bindWhileStatement(n) { - var preWhileState = n.expression.kind === 84 ? 4 : currentReachabilityState; - var postWhileState = n.expression.kind === 99 ? 4 : currentReachabilityState; - bind(n.expression); - currentReachabilityState = preWhileState; - var postWhileLabel = pushImplicitLabel(); - bind(n.statement); - popImplicitLabel(postWhileLabel, postWhileState); + function isNarrowableReference(expr) { + return expr.kind === 69 || + expr.kind === 97 || + expr.kind === 172 && isNarrowableReference(expr.expression); } - function bindDoStatement(n) { - var preDoState = currentReachabilityState; - var postDoLabel = pushImplicitLabel(); - bind(n.statement); - var postDoState = n.expression.kind === 99 ? 4 : preDoState; - popImplicitLabel(postDoLabel, postDoState); - bind(n.expression); - } - function bindForStatement(n) { - var preForState = currentReachabilityState; - var postForLabel = pushImplicitLabel(); - bind(n.initializer); - bind(n.condition); - bind(n.incrementor); - bind(n.statement); - var isInfiniteLoop = (!n.condition || n.condition.kind === 99); - var postForState = isInfiniteLoop ? 4 : preForState; - popImplicitLabel(postForLabel, postForState); - } - function bindForInOrForOfStatement(n) { - var preStatementState = currentReachabilityState; - var postStatementLabel = pushImplicitLabel(); - bind(n.initializer); - bind(n.expression); - bind(n.statement); - popImplicitLabel(postStatementLabel, preStatementState); - } - function bindIfStatement(n) { - var ifTrueState = n.expression.kind === 84 ? 4 : currentReachabilityState; - var ifFalseState = n.expression.kind === 99 ? 4 : currentReachabilityState; - currentReachabilityState = ifTrueState; - bind(n.expression); - bind(n.thenStatement); - if (n.elseStatement) { - var preElseState = currentReachabilityState; - currentReachabilityState = ifFalseState; - bind(n.elseStatement); - currentReachabilityState = or(currentReachabilityState, preElseState); + function isNarrowingExpression(expr) { + switch (expr.kind) { + case 69: + case 97: + case 172: + return isNarrowableReference(expr); + case 174: + return true; + case 178: + return isNarrowingExpression(expr.expression); + case 187: + return isNarrowingBinaryExpression(expr); + case 185: + return expr.operator === 49 && isNarrowingExpression(expr.operand); } - else { - currentReachabilityState = or(currentReachabilityState, ifFalseState); + return false; + } + function isNarrowingBinaryExpression(expr) { + switch (expr.operatorToken.kind) { + case 56: + return isNarrowableReference(expr.left); + case 30: + case 31: + case 32: + case 33: + if (isNarrowingExpression(expr.left) && (expr.right.kind === 93 || expr.right.kind === 69)) { + return true; + } + if (expr.left.kind === 182 && isNarrowingExpression(expr.left.expression) && expr.right.kind === 9) { + return true; + } + return false; + case 91: + return isNarrowingExpression(expr.left); + case 24: + return isNarrowingExpression(expr.right); + } + return false; + } + function createBranchLabel() { + return { + flags: 4, + antecedents: undefined + }; + } + function createLoopLabel() { + return { + flags: 8, + antecedents: undefined + }; + } + function setFlowNodeReferenced(flow) { + flow.flags |= flow.flags & 128 ? 256 : 128; + } + function addAntecedent(label, antecedent) { + if (!(antecedent.flags & 1) && !ts.contains(label.antecedents, antecedent)) { + (label.antecedents || (label.antecedents = [])).push(antecedent); + setFlowNodeReferenced(antecedent); } } - function bindReturnOrThrow(n) { - bind(n.expression); - if (n.kind === 204) { - hasExplicitReturn = true; + function createFlowCondition(flags, antecedent, expression) { + if (antecedent.flags & 1) { + return antecedent; } - currentReachabilityState = 4; - } - function bindBreakOrContinueStatement(n) { - bind(n.label); - var isValidJump = jumpToLabel(n.label, n.kind === 203 ? currentReachabilityState : 4); - if (isValidJump) { - currentReachabilityState = 4; + if (!expression) { + return flags & 32 ? antecedent : unreachableFlow; } + if (expression.kind === 99 && flags & 64 || + expression.kind === 84 && flags & 32) { + return unreachableFlow; + } + if (!isNarrowingExpression(expression)) { + return antecedent; + } + setFlowNodeReferenced(antecedent); + return { + flags: flags, + antecedent: antecedent, + expression: expression + }; } - function bindTryStatement(n) { - var preTryState = currentReachabilityState; - bind(n.tryBlock); - var postTryState = currentReachabilityState; - currentReachabilityState = preTryState; - bind(n.catchClause); - var postCatchState = currentReachabilityState; - currentReachabilityState = preTryState; - bind(n.finallyBlock); - currentReachabilityState = or(postTryState, postCatchState); + function createFlowAssignment(antecedent, node) { + setFlowNodeReferenced(antecedent); + return { + flags: 16, + antecedent: antecedent, + node: node + }; } - function bindSwitchStatement(n) { - var preSwitchState = currentReachabilityState; - var postSwitchLabel = pushImplicitLabel(); - bind(n.expression); - bind(n.caseBlock); - var hasDefault = ts.forEach(n.caseBlock.clauses, function (c) { return c.kind === 242; }); - var postSwitchState = hasDefault && currentReachabilityState !== 2 ? 4 : preSwitchState; - popImplicitLabel(postSwitchLabel, postSwitchState); + function finishFlowLabel(flow) { + var antecedents = flow.antecedents; + if (!antecedents) { + return unreachableFlow; + } + if (antecedents.length === 1) { + return antecedents[0]; + } + return flow; } - function bindCaseBlock(n) { - var startState = currentReachabilityState; - for (var _i = 0, _a = n.clauses; _i < _a.length; _i++) { - var clause = _a[_i]; - currentReachabilityState = startState; - bind(clause); - if (clause.statements.length && currentReachabilityState === 2 && options.noFallthroughCasesInSwitch) { - errorOnFirstToken(clause, ts.Diagnostics.Fallthrough_case_in_switch); + function isStatementCondition(node) { + var parent = node.parent; + switch (parent.kind) { + case 203: + case 205: + case 204: + return parent.expression === node; + case 206: + case 188: + return parent.condition === node; + } + return false; + } + function isLogicalExpression(node) { + while (true) { + if (node.kind === 178) { + node = node.expression; + } + else if (node.kind === 185 && node.operator === 49) { + node = node.operand; + } + else { + return node.kind === 187 && (node.operatorToken.kind === 51 || + node.operatorToken.kind === 52); } } } - function bindLabeledStatement(n) { - bind(n.label); - var ok = pushNamedLabel(n.label); - bind(n.statement); - if (ok) { - popNamedLabel(n.label, currentReachabilityState); + function isTopLevelLogicalExpression(node) { + while (node.parent.kind === 178 || + node.parent.kind === 185 && + node.parent.operator === 49) { + node = node.parent; + } + return !isStatementCondition(node) && !isLogicalExpression(node.parent); + } + function bindCondition(node, trueTarget, falseTarget) { + var saveTrueTarget = currentTrueTarget; + var saveFalseTarget = currentFalseTarget; + currentTrueTarget = trueTarget; + currentFalseTarget = falseTarget; + bind(node); + currentTrueTarget = saveTrueTarget; + currentFalseTarget = saveFalseTarget; + if (!node || !isLogicalExpression(node)) { + addAntecedent(trueTarget, createFlowCondition(32, currentFlow, node)); + addAntecedent(falseTarget, createFlowCondition(64, currentFlow, node)); + } + } + function bindIterativeStatement(node, breakTarget, continueTarget) { + var saveBreakTarget = currentBreakTarget; + var saveContinueTarget = currentContinueTarget; + currentBreakTarget = breakTarget; + currentContinueTarget = continueTarget; + bind(node); + currentBreakTarget = saveBreakTarget; + currentContinueTarget = saveContinueTarget; + } + function bindWhileStatement(node) { + var preWhileLabel = createLoopLabel(); + var preBodyLabel = createBranchLabel(); + var postWhileLabel = createBranchLabel(); + addAntecedent(preWhileLabel, currentFlow); + currentFlow = preWhileLabel; + bindCondition(node.expression, preBodyLabel, postWhileLabel); + currentFlow = finishFlowLabel(preBodyLabel); + bindIterativeStatement(node.statement, postWhileLabel, preWhileLabel); + addAntecedent(preWhileLabel, currentFlow); + currentFlow = finishFlowLabel(postWhileLabel); + } + function bindDoStatement(node) { + var preDoLabel = createLoopLabel(); + var preConditionLabel = createBranchLabel(); + var postDoLabel = createBranchLabel(); + addAntecedent(preDoLabel, currentFlow); + currentFlow = preDoLabel; + bindIterativeStatement(node.statement, postDoLabel, preConditionLabel); + addAntecedent(preConditionLabel, currentFlow); + currentFlow = finishFlowLabel(preConditionLabel); + bindCondition(node.expression, preDoLabel, postDoLabel); + currentFlow = finishFlowLabel(postDoLabel); + } + function bindForStatement(node) { + var preLoopLabel = createLoopLabel(); + var preBodyLabel = createBranchLabel(); + var postLoopLabel = createBranchLabel(); + bind(node.initializer); + addAntecedent(preLoopLabel, currentFlow); + currentFlow = preLoopLabel; + bindCondition(node.condition, preBodyLabel, postLoopLabel); + currentFlow = finishFlowLabel(preBodyLabel); + bindIterativeStatement(node.statement, postLoopLabel, preLoopLabel); + bind(node.incrementor); + addAntecedent(preLoopLabel, currentFlow); + currentFlow = finishFlowLabel(postLoopLabel); + } + function bindForInOrForOfStatement(node) { + var preLoopLabel = createLoopLabel(); + var postLoopLabel = createBranchLabel(); + addAntecedent(preLoopLabel, currentFlow); + currentFlow = preLoopLabel; + bind(node.expression); + addAntecedent(postLoopLabel, currentFlow); + bind(node.initializer); + if (node.initializer.kind !== 219) { + bindAssignmentTargetFlow(node.initializer); + } + bindIterativeStatement(node.statement, postLoopLabel, preLoopLabel); + addAntecedent(preLoopLabel, currentFlow); + currentFlow = finishFlowLabel(postLoopLabel); + } + function bindIfStatement(node) { + var thenLabel = createBranchLabel(); + var elseLabel = createBranchLabel(); + var postIfLabel = createBranchLabel(); + bindCondition(node.expression, thenLabel, elseLabel); + currentFlow = finishFlowLabel(thenLabel); + bind(node.thenStatement); + addAntecedent(postIfLabel, currentFlow); + currentFlow = finishFlowLabel(elseLabel); + bind(node.elseStatement); + addAntecedent(postIfLabel, currentFlow); + currentFlow = finishFlowLabel(postIfLabel); + } + function bindReturnOrThrow(node) { + bind(node.expression); + if (node.kind === 211) { + hasExplicitReturn = true; + } + currentFlow = unreachableFlow; + } + function findActiveLabel(name) { + if (activeLabels) { + for (var _i = 0, activeLabels_1 = activeLabels; _i < activeLabels_1.length; _i++) { + var label = activeLabels_1[_i]; + if (label.name === name) { + return label; + } + } + } + return undefined; + } + function bindbreakOrContinueFlow(node, breakTarget, continueTarget) { + var flowLabel = node.kind === 210 ? breakTarget : continueTarget; + if (flowLabel) { + addAntecedent(flowLabel, currentFlow); + currentFlow = unreachableFlow; + } + } + function bindBreakOrContinueStatement(node) { + bind(node.label); + if (node.label) { + var activeLabel = findActiveLabel(node.label.text); + if (activeLabel) { + activeLabel.referenced = true; + bindbreakOrContinueFlow(node, activeLabel.breakTarget, activeLabel.continueTarget); + } + } + else { + bindbreakOrContinueFlow(node, currentBreakTarget, currentContinueTarget); + } + } + function bindTryStatement(node) { + var postFinallyLabel = createBranchLabel(); + var preTryFlow = currentFlow; + bind(node.tryBlock); + addAntecedent(postFinallyLabel, currentFlow); + if (node.catchClause) { + currentFlow = preTryFlow; + bind(node.catchClause); + addAntecedent(postFinallyLabel, currentFlow); + } + if (node.finallyBlock) { + currentFlow = preTryFlow; + bind(node.finallyBlock); + } + currentFlow = finishFlowLabel(postFinallyLabel); + } + function bindSwitchStatement(node) { + var postSwitchLabel = createBranchLabel(); + bind(node.expression); + var saveBreakTarget = currentBreakTarget; + var savePreSwitchCaseFlow = preSwitchCaseFlow; + currentBreakTarget = postSwitchLabel; + preSwitchCaseFlow = currentFlow; + bind(node.caseBlock); + addAntecedent(postSwitchLabel, currentFlow); + var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 250; }); + if (!hasDefault) { + addAntecedent(postSwitchLabel, preSwitchCaseFlow); + } + currentBreakTarget = saveBreakTarget; + preSwitchCaseFlow = savePreSwitchCaseFlow; + currentFlow = finishFlowLabel(postSwitchLabel); + } + function bindCaseBlock(node) { + var clauses = node.clauses; + for (var i = 0; i < clauses.length; i++) { + var clause = clauses[i]; + if (clause.statements.length) { + if (currentFlow.flags & 1) { + currentFlow = preSwitchCaseFlow; + } + else { + var preCaseLabel = createBranchLabel(); + addAntecedent(preCaseLabel, preSwitchCaseFlow); + addAntecedent(preCaseLabel, currentFlow); + currentFlow = finishFlowLabel(preCaseLabel); + } + bind(clause); + if (!(currentFlow.flags & 1) && i !== clauses.length - 1 && options.noFallthroughCasesInSwitch) { + errorOnFirstToken(clause, ts.Diagnostics.Fallthrough_case_in_switch); + } + } + else { + bind(clause); + } + } + } + function pushActiveLabel(name, breakTarget, continueTarget) { + var activeLabel = { + name: name, + breakTarget: breakTarget, + continueTarget: continueTarget, + referenced: false + }; + (activeLabels || (activeLabels = [])).push(activeLabel); + return activeLabel; + } + function popActiveLabel() { + activeLabels.pop(); + } + function bindLabeledStatement(node) { + var preStatementLabel = createLoopLabel(); + var postStatementLabel = createBranchLabel(); + bind(node.label); + addAntecedent(preStatementLabel, currentFlow); + var activeLabel = pushActiveLabel(node.label.text, postStatementLabel, preStatementLabel); + bind(node.statement); + popActiveLabel(); + if (!activeLabel.referenced && !options.allowUnusedLabels) { + file.bindDiagnostics.push(ts.createDiagnosticForNode(node.label, ts.Diagnostics.Unused_label)); + } + addAntecedent(postStatementLabel, currentFlow); + currentFlow = finishFlowLabel(postStatementLabel); + } + function bindDestructuringTargetFlow(node) { + if (node.kind === 187 && node.operatorToken.kind === 56) { + bindAssignmentTargetFlow(node.left); + } + else { + bindAssignmentTargetFlow(node); + } + } + function bindAssignmentTargetFlow(node) { + if (isNarrowableReference(node)) { + currentFlow = createFlowAssignment(currentFlow, node); + } + else if (node.kind === 170) { + for (var _i = 0, _a = node.elements; _i < _a.length; _i++) { + var e = _a[_i]; + if (e.kind === 191) { + bindAssignmentTargetFlow(e.expression); + } + else { + bindDestructuringTargetFlow(e); + } + } + } + else if (node.kind === 171) { + for (var _b = 0, _c = node.properties; _b < _c.length; _b++) { + var p = _c[_b]; + if (p.kind === 253) { + bindDestructuringTargetFlow(p.initializer); + } + else if (p.kind === 254) { + bindAssignmentTargetFlow(p.name); + } + } + } + } + function bindLogicalExpression(node, trueTarget, falseTarget) { + var preRightLabel = createBranchLabel(); + if (node.operatorToken.kind === 51) { + bindCondition(node.left, preRightLabel, falseTarget); + } + else { + bindCondition(node.left, trueTarget, preRightLabel); + } + currentFlow = finishFlowLabel(preRightLabel); + bind(node.operatorToken); + bindCondition(node.right, trueTarget, falseTarget); + } + function bindPrefixUnaryExpressionFlow(node) { + if (node.operator === 49) { + var saveTrueTarget = currentTrueTarget; + currentTrueTarget = currentFalseTarget; + currentFalseTarget = saveTrueTarget; + ts.forEachChild(node, bind); + currentFalseTarget = currentTrueTarget; + currentTrueTarget = saveTrueTarget; + } + else { + ts.forEachChild(node, bind); + } + } + function bindBinaryExpressionFlow(node) { + var operator = node.operatorToken.kind; + if (operator === 51 || operator === 52) { + if (isTopLevelLogicalExpression(node)) { + var postExpressionLabel = createBranchLabel(); + bindLogicalExpression(node, postExpressionLabel, postExpressionLabel); + currentFlow = finishFlowLabel(postExpressionLabel); + } + else { + bindLogicalExpression(node, currentTrueTarget, currentFalseTarget); + } + } + else { + ts.forEachChild(node, bind); + if (operator === 56 && !ts.isAssignmentTarget(node)) { + bindAssignmentTargetFlow(node.left); + } + } + } + function bindDeleteExpressionFlow(node) { + ts.forEachChild(node, bind); + if (node.expression.kind === 172) { + bindAssignmentTargetFlow(node.expression); + } + } + function bindConditionalExpressionFlow(node) { + var trueLabel = createBranchLabel(); + var falseLabel = createBranchLabel(); + var postExpressionLabel = createBranchLabel(); + bindCondition(node.condition, trueLabel, falseLabel); + currentFlow = finishFlowLabel(trueLabel); + bind(node.whenTrue); + addAntecedent(postExpressionLabel, currentFlow); + currentFlow = finishFlowLabel(falseLabel); + bind(node.whenFalse); + addAntecedent(postExpressionLabel, currentFlow); + currentFlow = finishFlowLabel(postExpressionLabel); + } + function bindInitializedVariableFlow(node) { + var name = node.name; + if (ts.isBindingPattern(name)) { + for (var _i = 0, _a = name.elements; _i < _a.length; _i++) { + var child = _a[_i]; + bindInitializedVariableFlow(child); + } + } + else { + currentFlow = createFlowAssignment(currentFlow, node); + } + } + function bindVariableDeclarationFlow(node) { + ts.forEachChild(node, bind); + if (node.initializer || node.parent.parent.kind === 207 || node.parent.parent.kind === 208) { + bindInitializedVariableFlow(node); } } function getContainerFlags(node) { switch (node.kind) { - case 186: - case 214: - case 215: - case 217: - case 155: - case 165: + case 192: + case 221: + case 222: + case 224: + case 171: + case 159: + case 265: return 1; - case 147: - case 148: - case 149: - case 143: - case 142: - case 213: - case 144: - case 145: - case 146: + case 151: case 152: case 153: - case 173: - case 174: - case 218: - case 248: - case 216: - return 5; - case 244: - case 199: - case 200: - case 201: + case 147: + case 146: case 220: + case 148: + case 149: + case 150: + case 156: + case 269: + case 157: + case 179: + case 180: + case 225: + case 256: + case 223: + return 5; + case 252: + case 206: + case 207: + case 208: + case 227: return 2; - case 192: + case 199: return ts.isFunctionLike(node.parent) ? 0 : 2; } return 0; @@ -10333,38 +11675,40 @@ var ts; } function declareSymbolAndAddToSymbolTableWorker(node, symbolFlags, symbolExcludes) { switch (container.kind) { - case 218: + case 225: return declareModuleMember(node, symbolFlags, symbolExcludes); - case 248: + case 256: return declareSourceFileMember(node, symbolFlags, symbolExcludes); - case 186: - case 214: + case 192: + case 221: return declareClassMember(node, symbolFlags, symbolExcludes); - case 217: + case 224: return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); - case 155: - case 165: - case 215: + case 159: + case 171: + case 222: + case 265: return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); + case 156: + case 157: + case 151: case 152: case 153: case 147: + case 146: case 148: case 149: - case 143: - case 142: - case 144: - case 145: - case 146: - case 213: - case 173: - case 174: - case 216: + case 150: + case 220: + case 179: + case 180: + case 269: + case 223: return declareSymbol(container.locals, undefined, node, symbolFlags, symbolExcludes); } } function declareClassMember(node, symbolFlags, symbolExcludes) { - return node.flags & 64 + return node.flags & 32 ? declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes) : declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); } @@ -10374,11 +11718,11 @@ var ts; : declareSymbol(file.locals, undefined, node, symbolFlags, symbolExcludes); } function hasExportDeclarations(node) { - var body = node.kind === 248 ? node : node.body; - if (body.kind === 248 || body.kind === 219) { + var body = node.kind === 256 ? node : node.body; + if (body.kind === 256 || body.kind === 226) { for (var _i = 0, _a = body.statements; _i < _a.length; _i++) { var stat = _a[_i]; - if (stat.kind === 228 || stat.kind === 227) { + if (stat.kind === 236 || stat.kind === 235) { return true; } } @@ -10387,16 +11731,24 @@ var ts; } function setExportContextFlag(node) { if (ts.isInAmbientContext(node) && !hasExportDeclarations(node)) { - node.flags |= 131072; + node.flags |= 8192; } else { - node.flags &= ~131072; + node.flags &= ~8192; } } function bindModuleDeclaration(node) { setExportContextFlag(node); - if (node.name.kind === 9) { - declareSymbolAndAddToSymbolTable(node, 512, 106639); + if (ts.isAmbientModule(node)) { + if (node.flags & 1) { + errorOnFirstToken(node, ts.Diagnostics.export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always_visible); + } + if (ts.isExternalModuleAugmentation(node)) { + declareSymbolAndAddToSymbolTable(node, 1024, 0); + } + else { + declareSymbolAndAddToSymbolTable(node, 512, 106639); + } } else { var state = getModuleInstanceState(node); @@ -10437,7 +11789,7 @@ var ts; continue; } var identifier = prop.name; - var currentKind = prop.kind === 245 || prop.kind === 246 || prop.kind === 143 + var currentKind = prop.kind === 253 || prop.kind === 254 || prop.kind === 147 ? 1 : 2; var existingKind = seen[identifier.text]; @@ -10459,10 +11811,10 @@ var ts; } function bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) { switch (blockScopeContainer.kind) { - case 218: + case 225: declareModuleMember(node, symbolFlags, symbolExcludes); break; - case 248: + case 256: if (ts.isExternalModule(container)) { declareModuleMember(node, symbolFlags, symbolExcludes); break; @@ -10482,7 +11834,8 @@ var ts; if (inStrictMode && node.originalKeywordKind >= 106 && node.originalKeywordKind <= 114 && - !ts.isIdentifierName(node)) { + !ts.isIdentifierName(node) && + !ts.isInAmbientContext(node)) { if (!file.parseDiagnostics.length) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, getStrictModeIdentifierMessage(node), ts.declarationNameToString(node))); } @@ -10540,8 +11893,27 @@ var ts; checkStrictModeEvalOrArguments(node, node.name); } } + function getStrictModeBlockScopeFunctionDeclarationMessage(node) { + if (ts.getContainingClass(node)) { + return ts.Diagnostics.Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Class_definitions_are_automatically_in_strict_mode; + } + if (file.externalModuleIndicator) { + return ts.Diagnostics.Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Modules_are_automatically_in_strict_mode; + } + return ts.Diagnostics.Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5; + } + function checkStrictModeFunctionDeclaration(node) { + if (languageVersion < 2) { + if (blockScopeContainer.kind !== 256 && + blockScopeContainer.kind !== 225 && + !ts.isFunctionLike(blockScopeContainer)) { + var errorSpan = ts.getErrorSpanForNode(file, node); + file.bindDiagnostics.push(ts.createFileDiagnostic(file, errorSpan.start, errorSpan.length, getStrictModeBlockScopeFunctionDeclarationMessage(node))); + } + } + } function checkStrictModeNumericLiteral(node) { - if (inStrictMode && node.flags & 32768) { + if (inStrictMode && node.isOctalLiteral) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Octal_literals_are_not_allowed_in_strict_mode)); } } @@ -10584,17 +11956,17 @@ var ts; } function updateStrictMode(node) { switch (node.kind) { - case 248: - case 219: + case 256: + case 226: updateStrictModeStatementList(node.statements); return; - case 192: + case 199: if (ts.isFunctionLike(node.parent)) { updateStrictModeStatementList(node.statements); } return; - case 214: - case 186: + case 221: + case 192: inStrictMode = true; return; } @@ -10613,111 +11985,150 @@ var ts; } function isUseStrictPrologueDirective(node) { var nodeText = ts.getTextOfNodeFromSourceText(file.text, node.expression); - return nodeText === "\"use strict\"" || nodeText === "'use strict'"; + return nodeText === '"use strict"' || nodeText === "'use strict'"; } function bindWorker(node) { switch (node.kind) { case 69: + case 97: + if (currentFlow && (ts.isExpression(node) || parent.kind === 254)) { + node.flowNode = currentFlow; + } return checkStrictModeIdentifier(node); - case 181: + case 172: + if (currentFlow && isNarrowableReference(node)) { + node.flowNode = currentFlow; + } + break; + case 187: if (ts.isInJavaScriptFile(node)) { - if (ts.isExportsPropertyAssignment(node)) { - bindExportsPropertyAssignment(node); - } - else if (ts.isModuleExportsAssignment(node)) { - bindModuleExportsAssignment(node); + var specialKind = ts.getSpecialPropertyAssignmentKind(node); + switch (specialKind) { + case 1: + bindExportsPropertyAssignment(node); + break; + case 2: + bindModuleExportsAssignment(node); + break; + case 3: + bindPrototypePropertyAssignment(node); + break; + case 4: + bindThisPropertyAssignment(node); + break; + case 0: + break; + default: + ts.Debug.fail("Unknown special property assignment kind"); } } return checkStrictModeBinaryExpression(node); - case 244: + case 252: return checkStrictModeCatchClause(node); - case 175: + case 181: return checkStrictModeDeleteExpression(node); case 8: return checkStrictModeNumericLiteral(node); - case 180: + case 186: return checkStrictModePostfixUnaryExpression(node); - case 179: + case 185: return checkStrictModePrefixUnaryExpression(node); - case 205: + case 212: return checkStrictModeWithStatement(node); - case 97: + case 165: seenThisKeyword = true; return; - case 137: - return declareSymbolAndAddToSymbolTable(node, 262144, 530912); - case 138: - return bindParameter(node); - case 211: - case 163: - return bindVariableDeclarationOrBindingElement(node); + case 154: + return checkTypePredicate(node); case 141: - case 140: - return bindPropertyOrMethodOrAccessor(node, 4 | (node.questionToken ? 536870912 : 0), 107455); - case 245: - case 246: - return bindPropertyOrMethodOrAccessor(node, 4, 107455); - case 247: - return bindPropertyOrMethodOrAccessor(node, 8, 107455); - case 147: - case 148: - case 149: - return declareSymbolAndAddToSymbolTable(node, 131072, 0); - case 143: + return declareSymbolAndAddToSymbolTable(node, 262144, 530912); case 142: - return bindPropertyOrMethodOrAccessor(node, 8192 | (node.questionToken ? 536870912 : 0), ts.isObjectLiteralMethod(node) ? 107455 : 99263); - case 213: - checkStrictModeFunctionName(node); - return declareSymbolAndAddToSymbolTable(node, 16, 106927); - case 144: - return declareSymbolAndAddToSymbolTable(node, 16384, 0); + return bindParameter(node); + case 218: + case 169: + return bindVariableDeclarationOrBindingElement(node); case 145: - return bindPropertyOrMethodOrAccessor(node, 32768, 41919); - case 146: - return bindPropertyOrMethodOrAccessor(node, 65536, 74687); + case 144: + case 266: + return bindPropertyOrMethodOrAccessor(node, 4 | (node.questionToken ? 536870912 : 0), 107455); + case 253: + case 254: + return bindPropertyOrMethodOrAccessor(node, 4, 107455); + case 255: + return bindPropertyOrMethodOrAccessor(node, 8, 107455); + case 247: + hasJsxSpreadAttribute = true; + return; + case 151: case 152: case 153: + return declareSymbolAndAddToSymbolTable(node, 131072, 0); + case 147: + case 146: + return bindPropertyOrMethodOrAccessor(node, 8192 | (node.questionToken ? 536870912 : 0), ts.isObjectLiteralMethod(node) ? 107455 : 99263); + case 220: + return bindFunctionDeclaration(node); + case 148: + return declareSymbolAndAddToSymbolTable(node, 16384, 0); + case 149: + return bindPropertyOrMethodOrAccessor(node, 32768, 41919); + case 150: + return bindPropertyOrMethodOrAccessor(node, 65536, 74687); + case 156: + case 157: + case 269: return bindFunctionOrConstructorType(node); - case 155: + case 159: + case 265: return bindAnonymousDeclaration(node, 2048, "__type"); - case 165: + case 171: return bindObjectLiteralExpression(node); - case 173: + case 179: + case 180: + return bindFunctionExpression(node); case 174: - checkStrictModeFunctionName(node); - var bindingName = node.name ? node.name.text : "__function"; - return bindAnonymousDeclaration(node, 16, bindingName); - case 168: if (ts.isInJavaScriptFile(node)) { bindCallExpression(node); } break; - case 186: - case 214: - return bindClassLikeDeclaration(node); - case 215: - return bindBlockScopedDeclaration(node, 64, 792960); - case 216: - return bindBlockScopedDeclaration(node, 524288, 793056); - case 217: - return bindEnumDeclaration(node); - case 218: - return bindModuleDeclaration(node); + case 192: case 221: - case 224: - case 226: - case 230: - return declareSymbolAndAddToSymbolTable(node, 8388608, 8388608); + return bindClassLikeDeclaration(node); + case 222: + return bindBlockScopedDeclaration(node, 64, 792960); case 223: - return bindImportClause(node); + return bindBlockScopedDeclaration(node, 524288, 793056); + case 224: + return bindEnumDeclaration(node); + case 225: + return bindModuleDeclaration(node); + case 229: + case 232: + case 234: + case 238: + return declareSymbolAndAddToSymbolTable(node, 8388608, 8388608); case 228: + return bindGlobalModuleExportDeclaration(node); + case 231: + return bindImportClause(node); + case 236: return bindExportDeclaration(node); - case 227: + case 235: return bindExportAssignment(node); - case 248: + case 256: return bindSourceFileIfExternalModule(); } } + function checkTypePredicate(node) { + var parameterName = node.parameterName, type = node.type; + if (parameterName && parameterName.kind === 69) { + checkStrictModeIdentifier(parameterName); + } + if (parameterName && parameterName.kind === 165) { + seenThisKeyword = true; + } + bind(type); + } function bindSourceFileIfExternalModule() { setExportContextFlag(file); if (ts.isExternalModule(file)) { @@ -10728,17 +12139,39 @@ var ts; bindAnonymousDeclaration(file, 512, "\"" + ts.removeFileExtension(file.fileName) + "\""); } function bindExportAssignment(node) { - var boundExpression = node.kind === 227 ? node.expression : node.right; + var boundExpression = node.kind === 235 ? node.expression : node.right; if (!container.symbol || !container.symbol.exports) { bindAnonymousDeclaration(node, 8388608, getDeclarationName(node)); } - else if (boundExpression.kind === 69) { + else if (boundExpression.kind === 69 && node.kind === 235) { declareSymbol(container.symbol.exports, container.symbol, node, 8388608, 107455 | 8388608); } else { declareSymbol(container.symbol.exports, container.symbol, node, 4, 107455 | 8388608); } } + function bindGlobalModuleExportDeclaration(node) { + if (node.modifiers && node.modifiers.length) { + file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Modifiers_cannot_appear_here)); + } + if (node.parent.kind !== 256) { + file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_at_top_level)); + return; + } + else { + var parent_5 = node.parent; + if (!ts.isExternalModule(parent_5)) { + file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_in_module_files)); + return; + } + if (!parent_5.isDeclarationFile) { + file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_in_declaration_files)); + return; + } + } + file.symbol.globalExports = file.symbol.globalExports || {}; + declareSymbol(file.symbol.globalExports, file.symbol, node, 8388608, 8388608); + } function bindExportDeclaration(node) { if (!container.symbol || !container.symbol.exports) { bindAnonymousDeclaration(node, 1073741824, getDeclarationName(node)); @@ -10764,15 +12197,45 @@ var ts; } function bindModuleExportsAssignment(node) { setCommonJsModuleIndicator(node); - bindExportAssignment(node); + declareSymbol(file.symbol.exports, file.symbol, node, 4 | 7340032 | 512, 0); + } + function bindThisPropertyAssignment(node) { + if (container.kind === 179 || container.kind === 220) { + container.symbol.members = container.symbol.members || {}; + declareSymbol(container.symbol.members, container.symbol, node, 4, 107455 & ~4); + } + } + function bindPrototypePropertyAssignment(node) { + var leftSideOfAssignment = node.left; + var classPrototype = leftSideOfAssignment.expression; + var constructorFunction = classPrototype.expression; + leftSideOfAssignment.parent = node; + constructorFunction.parent = classPrototype; + classPrototype.parent = leftSideOfAssignment; + var funcSymbol = container.locals[constructorFunction.text]; + if (!funcSymbol || !(funcSymbol.flags & 16)) { + return; + } + if (!funcSymbol.members) { + funcSymbol.members = {}; + } + declareSymbol(funcSymbol.members, funcSymbol, leftSideOfAssignment, 4, 107455); } function bindCallExpression(node) { - if (!file.commonJsModuleIndicator && ts.isRequireCall(node)) { + if (!file.commonJsModuleIndicator && ts.isRequireCall(node, false)) { setCommonJsModuleIndicator(node); } } function bindClassLikeDeclaration(node) { - if (node.kind === 214) { + if (!ts.isDeclarationFile(file) && !ts.isInAmbientContext(node)) { + if (ts.getClassExtendsHeritageClauseElement(node) !== undefined) { + hasClassExtends = true; + } + if (ts.nodeIsDecorated(node)) { + hasDecorators = true; + } + } + if (node.kind === 221) { bindBlockScopedDeclaration(node, 32, 899519); } else { @@ -10815,6 +12278,12 @@ var ts; } } function bindParameter(node) { + if (!ts.isDeclarationFile(file) && + !ts.isInAmbientContext(node) && + ts.nodeIsDecorated(node)) { + hasDecorators = true; + hasParameterDecorators = true; + } if (inStrictMode) { checkStrictModeEvalOrArguments(node, node.name); } @@ -10824,106 +12293,75 @@ var ts; else { declareSymbolAndAddToSymbolTable(node, 1, 107455); } - if (node.flags & 56 && - node.parent.kind === 144 && - ts.isClassLike(node.parent.parent)) { + if (ts.isParameterPropertyDeclaration(node)) { var classDeclaration = node.parent.parent; declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, 4, 107455); } } + function bindFunctionDeclaration(node) { + if (!ts.isDeclarationFile(file) && !ts.isInAmbientContext(node)) { + if (ts.isAsyncFunctionLike(node)) { + hasAsyncFunctions = true; + } + } + checkStrictModeFunctionName(node); + if (inStrictMode) { + checkStrictModeFunctionDeclaration(node); + return bindBlockScopedDeclaration(node, 16, 106927); + } + else { + return declareSymbolAndAddToSymbolTable(node, 16, 106927); + } + } + function bindFunctionExpression(node) { + if (!ts.isDeclarationFile(file) && !ts.isInAmbientContext(node)) { + if (ts.isAsyncFunctionLike(node)) { + hasAsyncFunctions = true; + } + } + checkStrictModeFunctionName(node); + var bindingName = node.name ? node.name.text : "__function"; + return bindAnonymousDeclaration(node, 16, bindingName); + } function bindPropertyOrMethodOrAccessor(node, symbolFlags, symbolExcludes) { + if (!ts.isDeclarationFile(file) && !ts.isInAmbientContext(node)) { + if (ts.isAsyncFunctionLike(node)) { + hasAsyncFunctions = true; + } + if (ts.nodeIsDecorated(node)) { + hasDecorators = true; + } + } return ts.hasDynamicName(node) ? bindAnonymousDeclaration(node, symbolFlags, "__computed") : declareSymbolAndAddToSymbolTable(node, symbolFlags, symbolExcludes); } - function pushNamedLabel(name) { - initializeReachabilityStateIfNecessary(); - if (ts.hasProperty(labelIndexMap, name.text)) { - return false; - } - labelIndexMap[name.text] = labelStack.push(1) - 1; - return true; - } - function pushImplicitLabel() { - initializeReachabilityStateIfNecessary(); - var index = labelStack.push(1) - 1; - implicitLabels.push(index); - return index; - } - function popNamedLabel(label, outerState) { - var index = labelIndexMap[label.text]; - ts.Debug.assert(index !== undefined); - ts.Debug.assert(labelStack.length == index + 1); - labelIndexMap[label.text] = undefined; - setCurrentStateAtLabel(labelStack.pop(), outerState, label); - } - function popImplicitLabel(implicitLabelIndex, outerState) { - if (labelStack.length !== implicitLabelIndex + 1) { - ts.Debug.assert(false, "Label stack: " + labelStack.length + ", index:" + implicitLabelIndex); - } - var i = implicitLabels.pop(); - if (implicitLabelIndex !== i) { - ts.Debug.assert(false, "i: " + i + ", index: " + implicitLabelIndex); - } - setCurrentStateAtLabel(labelStack.pop(), outerState, undefined); - } - function setCurrentStateAtLabel(innerMergedState, outerState, label) { - if (innerMergedState === 1) { - if (label && !options.allowUnusedLabels) { - file.bindDiagnostics.push(ts.createDiagnosticForNode(label, ts.Diagnostics.Unused_label)); - } - currentReachabilityState = outerState; - } - else { - currentReachabilityState = or(innerMergedState, outerState); - } - } - function jumpToLabel(label, outerState) { - initializeReachabilityStateIfNecessary(); - var index = label ? labelIndexMap[label.text] : ts.lastOrUndefined(implicitLabels); - if (index === undefined) { - return false; - } - var stateAtLabel = labelStack[index]; - labelStack[index] = stateAtLabel === 1 ? outerState : or(stateAtLabel, outerState); - return true; + function shouldReportErrorOnModuleDeclaration(node) { + var instanceState = getModuleInstanceState(node); + return instanceState === 1 || (instanceState === 2 && options.preserveConstEnums); } function checkUnreachable(node) { - switch (currentReachabilityState) { - case 4: - var reportError = (ts.isStatement(node) && node.kind !== 194) || - node.kind === 214 || - (node.kind === 218 && shouldReportErrorOnModuleDeclaration(node)) || - (node.kind === 217 && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums)); - if (reportError) { - currentReachabilityState = 8; - var reportUnreachableCode = !options.allowUnreachableCode && - !ts.isInAmbientContext(node) && - (node.kind !== 193 || - ts.getCombinedNodeFlags(node.declarationList) & 24576 || - ts.forEach(node.declarationList.declarations, function (d) { return d.initializer; })); - if (reportUnreachableCode) { - errorOnFirstToken(node, ts.Diagnostics.Unreachable_code_detected); - } + if (!(currentFlow.flags & 1)) { + return false; + } + if (currentFlow === unreachableFlow) { + var reportError = (ts.isStatement(node) && node.kind !== 201) || + node.kind === 221 || + (node.kind === 225 && shouldReportErrorOnModuleDeclaration(node)) || + (node.kind === 224 && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums)); + if (reportError) { + currentFlow = reportedUnreachableFlow; + var reportUnreachableCode = !options.allowUnreachableCode && + !ts.isInAmbientContext(node) && + (node.kind !== 200 || + ts.getCombinedNodeFlags(node.declarationList) & 3072 || + ts.forEach(node.declarationList.declarations, function (d) { return d.initializer; })); + if (reportUnreachableCode) { + errorOnFirstToken(node, ts.Diagnostics.Unreachable_code_detected); } - case 8: - return true; - default: - return false; + } } - function shouldReportErrorOnModuleDeclaration(node) { - var instanceState = getModuleInstanceState(node); - return instanceState === 1 || (instanceState === 2 && options.preserveConstEnums); - } - } - function initializeReachabilityStateIfNecessary() { - if (labelIndexMap) { - return; - } - currentReachabilityState = 2; - labelIndexMap = {}; - labelStack = []; - implicitLabels = []; + return true; } } })(ts || (ts = {})); @@ -10932,16 +12370,20 @@ var ts; var nextSymbolId = 1; var nextNodeId = 1; var nextMergeId = 1; + var nextFlowId = 1; function getNodeId(node) { - if (!node.id) - node.id = nextNodeId++; + if (!node.id) { + node.id = nextNodeId; + nextNodeId++; + } return node.id; } ts.getNodeId = getNodeId; ts.checkTime = 0; function getSymbolId(symbol) { if (!symbol.id) { - symbol.id = nextSymbolId++; + symbol.id = nextSymbolId; + nextSymbolId++; } return symbol.id; } @@ -10957,9 +12399,12 @@ var ts; var emptySymbols = {}; var compilerOptions = host.getCompilerOptions(); var languageVersion = compilerOptions.target || 0; - var modulekind = compilerOptions.module ? compilerOptions.module : languageVersion === 2 ? 5 : 0; + var modulekind = ts.getEmitModuleKind(compilerOptions); + var allowSyntheticDefaultImports = typeof compilerOptions.allowSyntheticDefaultImports !== "undefined" ? compilerOptions.allowSyntheticDefaultImports : modulekind === ts.ModuleKind.System; + var strictNullChecks = compilerOptions.strictNullChecks; var emitResolver = createResolver(); var undefinedSymbol = createSymbol(4 | 67108864, "undefined"); + undefinedSymbol.declarations = []; var argumentsSymbol = createSymbol(4 | 67108864, "arguments"); var checker = { getNodeCount: function () { return ts.sum(host.getSourceFiles(), "nodeCount"); }, @@ -10968,9 +12413,11 @@ var ts; getTypeCount: function () { return typeCount; }, isUndefinedSymbol: function (symbol) { return symbol === undefinedSymbol; }, isArgumentsSymbol: function (symbol) { return symbol === argumentsSymbol; }, + isUnknownSymbol: function (symbol) { return symbol === unknownSymbol; }, getDiagnostics: getDiagnostics, getGlobalDiagnostics: getGlobalDiagnostics, - getTypeOfSymbolAtLocation: getNarrowedTypeOfSymbol, + getTypeOfSymbolAtLocation: getTypeOfSymbolAtLocation, + getSymbolsOfParameterPropertyDeclaration: getSymbolsOfParameterPropertyDeclaration, getDeclaredTypeOfSymbol: getDeclaredTypeOfSymbol, getPropertiesOfType: getPropertiesOfType, getPropertyOfType: getPropertyOfType, @@ -10978,16 +12425,19 @@ var ts; getIndexTypeOfType: getIndexTypeOfType, getBaseTypes: getBaseTypes, getReturnTypeOfSignature: getReturnTypeOfSignature, + getNonNullableType: getNonNullableType, getSymbolsInScope: getSymbolsInScope, getSymbolAtLocation: getSymbolAtLocation, getShorthandAssignmentValueSymbol: getShorthandAssignmentValueSymbol, + getExportSpecifierLocalTargetSymbol: getExportSpecifierLocalTargetSymbol, getTypeAtLocation: getTypeOfNode, + getPropertySymbolOfDestructuringAssignment: getPropertySymbolOfDestructuringAssignment, typeToString: typeToString, getSymbolDisplayBuilder: getSymbolDisplayBuilder, symbolToString: symbolToString, getAugmentedPropertiesOfType: getAugmentedPropertiesOfType, getRootSymbols: getRootSymbols, - getContextualType: getApparentTypeOfContextualType, + getContextualType: getContextualType, getFullyQualifiedName: getFullyQualifiedName, getResolvedSignature: getResolvedSignature, getConstantValue: getConstantValue, @@ -11003,42 +12453,45 @@ var ts; }; var unknownSymbol = createSymbol(4 | 67108864, "unknown"); var resolvingSymbol = createSymbol(67108864, "__resolving__"); + var nullableWideningFlags = strictNullChecks ? 0 : 2097152; var anyType = createIntrinsicType(1, "any"); var stringType = createIntrinsicType(2, "string"); var numberType = createIntrinsicType(4, "number"); var booleanType = createIntrinsicType(8, "boolean"); var esSymbolType = createIntrinsicType(16777216, "symbol"); var voidType = createIntrinsicType(16, "void"); - var undefinedType = createIntrinsicType(32 | 2097152, "undefined"); - var nullType = createIntrinsicType(64 | 2097152, "null"); + var undefinedType = createIntrinsicType(32 | nullableWideningFlags, "undefined"); + var nullType = createIntrinsicType(64 | nullableWideningFlags, "null"); + var emptyArrayElementType = createIntrinsicType(32 | 2097152, "undefined"); var unknownType = createIntrinsicType(1, "unknown"); - var circularType = createIntrinsicType(1, "__circular__"); + var neverType = createIntrinsicType(134217728, "never"); var emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); var emptyGenericType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); emptyGenericType.instantiations = {}; var anyFunctionType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); anyFunctionType.flags |= 8388608; var noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); - var anySignature = createSignature(undefined, undefined, emptyArray, anyType, undefined, 0, false, false); - var unknownSignature = createSignature(undefined, undefined, emptyArray, unknownType, undefined, 0, false, false); + var anySignature = createSignature(undefined, undefined, undefined, emptyArray, anyType, undefined, 0, false, false); + var unknownSignature = createSignature(undefined, undefined, undefined, emptyArray, unknownType, undefined, 0, false, false); + var enumNumberIndexInfo = createIndexInfo(stringType, true); var globals = {}; - var globalESSymbolConstructorSymbol; + var getGlobalESSymbolConstructorSymbol; var getGlobalPromiseConstructorSymbol; var globalObjectType; var globalFunctionType; var globalArrayType; + var globalReadonlyArrayType; var globalStringType; var globalNumberType; var globalBooleanType; var globalRegExpType; - var globalTemplateStringsArrayType; - var globalESSymbolType; - var jsxElementType; - var jsxIntrinsicElementsType; - var globalIterableType; - var globalIteratorType; - var globalIterableIteratorType; var anyArrayType; + var anyReadonlyArrayType; + var getGlobalTemplateStringsArrayType; + var getGlobalESSymbolType; + var getGlobalIterableType; + var getGlobalIteratorType; + var getGlobalIterableIteratorType; var getGlobalClassDecoratorType; var getGlobalParameterDecoratorType; var getGlobalPropertyDecoratorType; @@ -11051,53 +12504,74 @@ var ts; var getGlobalPromiseConstructorLikeType; var getGlobalThenableType; var jsxElementClassType; + var deferredNodes; + var flowLoopStart = 0; + var flowLoopCount = 0; + var visitedFlowCount = 0; var tupleTypes = {}; var unionTypes = {}; var intersectionTypes = {}; var stringLiteralTypes = {}; - var emitExtends = false; - var emitDecorate = false; - var emitParam = false; - var emitAwaiter = false; - var emitGenerator = false; var resolutionTargets = []; var resolutionResults = []; var resolutionPropertyNames = []; var mergedSymbols = []; var symbolLinks = []; var nodeLinks = []; + var flowLoopCaches = []; + var flowLoopNodes = []; + var flowLoopKeys = []; + var flowLoopTypes = []; + var visitedFlowNodes = []; + var visitedFlowTypes = []; var potentialThisCollisions = []; var awaitedTypeStack = []; var diagnostics = ts.createDiagnosticCollection(); - var primitiveTypeInfo = { - "string": { - type: stringType, - flags: 258 - }, - "number": { - type: numberType, - flags: 132 - }, - "boolean": { - type: booleanType, - flags: 8 - }, - "symbol": { - type: esSymbolType, - flags: 16777216 - } + var typeofEQFacts = { + "string": 1, + "number": 2, + "boolean": 4, + "symbol": 8, + "undefined": 16384, + "object": 16, + "function": 32 }; + var typeofNEFacts = { + "string": 128, + "number": 256, + "boolean": 512, + "symbol": 1024, + "undefined": 131072, + "object": 2048, + "function": 4096 + }; + var typeofTypesByName = { + "string": stringType, + "number": numberType, + "boolean": booleanType, + "symbol": esSymbolType, + "undefined": undefinedType + }; + var jsxElementType; + var jsxTypes = {}; var JsxNames = { JSX: "JSX", IntrinsicElements: "IntrinsicElements", ElementClass: "ElementClass", ElementAttributesPropertyNameContainer: "ElementAttributesProperty", - Element: "Element" + Element: "Element", + IntrinsicAttributes: "IntrinsicAttributes", + IntrinsicClassAttributes: "IntrinsicClassAttributes" }; var subtypeRelation = {}; var assignableRelation = {}; + var comparableRelation = {}; var identityRelation = {}; var _displayBuilder; + var builtinGlobals = (_a = {}, + _a[undefinedSymbol.name] = undefinedSymbol, + _a + ); initializeTypeChecker(); return checker; function getEmitResolver(sourceFile, cancellationToken) { @@ -11151,8 +12625,10 @@ var ts; return result; } function recordMergedSymbol(target, source) { - if (!source.mergeId) - source.mergeId = nextMergeId++; + if (!source.mergeId) { + source.mergeId = nextMergeId; + nextMergeId++; + } mergedSymbols[source.mergeId] = target; } function cloneSymbol(symbol) { @@ -11176,8 +12652,11 @@ var ts; target.constEnumOnlyModule = false; } target.flags |= source.flags; - if (!target.valueDeclaration && source.valueDeclaration) + if (source.valueDeclaration && + (!target.valueDeclaration || + (target.valueDeclaration.kind === 225 && source.valueDeclaration.kind !== 225))) { target.valueDeclaration = source.valueDeclaration; + } ts.forEach(source.declarations, function (node) { target.declarations.push(node); }); @@ -11194,13 +12673,13 @@ var ts; recordMergedSymbol(target, source); } else { - var message = target.flags & 2 || source.flags & 2 + var message_2 = target.flags & 2 || source.flags & 2 ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0; ts.forEach(source.declarations, function (node) { - error(node.name ? node.name : node, message, symbolToString(source)); + error(node.name ? node.name : node, message_2, symbolToString(source)); }); ts.forEach(target.declarations, function (node) { - error(node.name ? node.name : node, message, symbolToString(source)); + error(node.name ? node.name : node, message_2, symbolToString(source)); }); } } @@ -11229,6 +12708,48 @@ var ts; } } } + function mergeModuleAugmentation(moduleName) { + var moduleAugmentation = moduleName.parent; + if (moduleAugmentation.symbol.declarations[0] !== moduleAugmentation) { + ts.Debug.assert(moduleAugmentation.symbol.declarations.length > 1); + return; + } + if (ts.isGlobalScopeAugmentation(moduleAugmentation)) { + mergeSymbolTable(globals, moduleAugmentation.symbol.exports); + } + else { + var moduleNotFoundError = !ts.isInAmbientContext(moduleName.parent.parent) + ? ts.Diagnostics.Invalid_module_name_in_augmentation_module_0_cannot_be_found + : undefined; + var mainModule = resolveExternalModuleNameWorker(moduleName, moduleName, moduleNotFoundError); + if (!mainModule) { + return; + } + mainModule = resolveExternalModuleSymbol(mainModule); + if (mainModule.flags & 1536) { + mainModule = mainModule.flags & 33554432 ? mainModule : cloneSymbol(mainModule); + mergeSymbol(mainModule, moduleAugmentation.symbol); + } + else { + error(moduleName, ts.Diagnostics.Cannot_augment_module_0_because_it_resolves_to_a_non_module_entity, moduleName.text); + } + } + } + function addToSymbolTable(target, source, message) { + for (var id in source) { + if (ts.hasProperty(source, id)) { + if (ts.hasProperty(target, id)) { + ts.forEach(target[id].declarations, addDeclarationDiagnostic(id, message)); + } + else { + target[id] = source[id]; + } + } + } + function addDeclarationDiagnostic(id, message) { + return function (declaration) { return diagnostics.add(ts.createDiagnosticForNode(declaration, message, id)); }; + } + } function getSymbolLinks(symbol) { if (symbol.flags & 67108864) return symbol; @@ -11239,11 +12760,8 @@ var ts; var nodeId = getNodeId(node); return nodeLinks[nodeId] || (nodeLinks[nodeId] = {}); } - function getSourceFile(node) { - return ts.getAncestor(node, 248); - } function isGlobalSourceFile(node) { - return node.kind === 248 && !ts.isExternalOrCommonJsModule(node); + return node.kind === 256 && !ts.isExternalOrCommonJsModule(node); } function getSymbol(symbols, name, meaning) { if (meaning && ts.hasProperty(symbols, name)) { @@ -11260,6 +12778,16 @@ var ts; } } } + function getSymbolsOfParameterPropertyDeclaration(parameter, parameterName) { + var constructorDeclaration = parameter.parent; + var classDeclaration = parameter.parent.parent; + var parameterSymbol = getSymbol(constructorDeclaration.locals, parameterName, 107455); + var propertySymbol = getSymbol(classDeclaration.symbol.members, parameterName, 107455); + if (parameterSymbol && propertySymbol) { + return [parameterSymbol, propertySymbol]; + } + ts.Debug.fail("There should exist two symbols, one as property declaration and one as parameter declaration"); + } function isBlockScopedNameDeclaredBeforeUse(declaration, usage) { var declarationFile = ts.getSourceFileOfNode(declaration); var useFile = ts.getSourceFileOfNode(usage); @@ -11271,21 +12799,29 @@ var ts; return ts.indexOf(sourceFiles, declarationFile) <= ts.indexOf(sourceFiles, useFile); } if (declaration.pos <= usage.pos) { - return declaration.kind !== 211 || + return declaration.kind !== 218 || !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage); } return isUsedInFunctionOrNonStaticProperty(declaration, usage); function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage) { var container = ts.getEnclosingBlockScopeContainer(declaration); - if (declaration.parent.parent.kind === 193 || - declaration.parent.parent.kind === 199) { - return isSameScopeDescendentOf(usage, declaration, container); + switch (declaration.parent.parent.kind) { + case 200: + case 206: + case 208: + if (isSameScopeDescendentOf(usage, declaration, container)) { + return true; + } + break; } - else if (declaration.parent.parent.kind === 201 || - declaration.parent.parent.kind === 200) { - var expression = declaration.parent.parent.expression; - return isSameScopeDescendentOf(usage, expression, container); + switch (declaration.parent.parent.kind) { + case 207: + case 208: + if (isSameScopeDescendentOf(usage, declaration.parent.parent.expression, container)) { + return true; + } } + return false; } function isUsedInFunctionOrNonStaticProperty(declaration, usage) { var container = ts.getEnclosingBlockScopeContainer(declaration); @@ -11298,8 +12834,8 @@ var ts; return true; } var initializerOfNonStaticProperty = current.parent && - current.parent.kind === 141 && - (current.parent.flags & 64) === 0 && + current.parent.kind === 145 && + (current.parent.flags & 32) === 0 && current.parent.initializer === current; if (initializerOfNonStaticProperty) { return true; @@ -11318,23 +12854,37 @@ var ts; loop: while (location) { if (location.locals && !isGlobalSourceFile(location)) { if (result = getSymbol(location.locals, name, meaning)) { - if (!(meaning & 793056) || - !(result.flags & (793056 & ~262144)) || - !ts.isFunctionLike(location) || - lastLocation === location.body) { + var useResult = true; + if (ts.isFunctionLike(location) && lastLocation && lastLocation !== location.body) { + if (meaning & result.flags & 793056 && lastLocation.kind !== 273) { + useResult = result.flags & 262144 + ? lastLocation === location.type || + lastLocation.kind === 142 || + lastLocation.kind === 141 + : false; + } + if (meaning & 107455 && result.flags & 1) { + useResult = + lastLocation.kind === 142 || + (lastLocation === location.type && + result.valueDeclaration.kind === 142); + } + } + if (useResult) { break loop; } - result = undefined; + else { + result = undefined; + } } } switch (location.kind) { - case 248: + case 256: if (!ts.isExternalOrCommonJsModule(location)) break; - case 218: + case 225: var moduleExports = getSymbolOfNode(location).exports; - if (location.kind === 248 || - (location.kind === 218 && location.name.kind === 9)) { + if (location.kind === 256 || ts.isAmbientModule(location)) { if (result = moduleExports["default"]) { var localSymbol = ts.getLocalSymbolForExportDefault(result); if (localSymbol && (result.flags & meaning) && localSymbol.name === name) { @@ -11344,7 +12894,7 @@ var ts; } if (ts.hasProperty(moduleExports, name) && moduleExports[name].flags === 8388608 && - ts.getDeclarationOfKind(moduleExports[name], 230)) { + ts.getDeclarationOfKind(moduleExports[name], 238)) { break; } } @@ -11352,14 +12902,14 @@ var ts; break loop; } break; - case 217: + case 224: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8)) { break loop; } break; - case 141: - case 140: - if (ts.isClassLike(location.parent) && !(location.flags & 64)) { + case 145: + case 144: + if (ts.isClassLike(location.parent) && !(location.flags & 32)) { var ctor = findConstructorDeclaration(location.parent); if (ctor && ctor.locals) { if (getSymbol(ctor.locals, name, meaning & 107455)) { @@ -11368,17 +12918,17 @@ var ts; } } break; - case 214: - case 186: - case 215: + case 221: + case 192: + case 222: if (result = getSymbol(getSymbolOfNode(location).members, name, meaning & 793056)) { - if (lastLocation && lastLocation.flags & 64) { + if (lastLocation && lastLocation.flags & 32) { error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters); return undefined; } break loop; } - if (location.kind === 186 && meaning & 32) { + if (location.kind === 192 && meaning & 32) { var className = location.name; if (className && name === className.text) { result = location.symbol; @@ -11386,28 +12936,28 @@ var ts; } } break; - case 136: + case 140: grandparent = location.parent.parent; - if (ts.isClassLike(grandparent) || grandparent.kind === 215) { + if (ts.isClassLike(grandparent) || grandparent.kind === 222) { if (result = getSymbol(getSymbolOfNode(grandparent).members, name, meaning & 793056)) { error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); return undefined; } } break; - case 143: - case 142: - case 144: - case 145: + case 147: case 146: - case 213: - case 174: + case 148: + case 149: + case 150: + case 220: + case 180: if (meaning & 3 && name === "arguments") { result = argumentsSymbol; break loop; } break; - case 173: + case 179: if (meaning & 3 && name === "arguments") { result = argumentsSymbol; break loop; @@ -11420,8 +12970,8 @@ var ts; } } break; - case 139: - if (location.parent && location.parent.kind === 138) { + case 143: + if (location.parent && location.parent.kind === 142) { location = location.parent; } if (location.parent && ts.isClassElement(location.parent)) { @@ -11437,7 +12987,9 @@ var ts; } if (!result) { if (nameNotFoundMessage) { - error(errorLocation, nameNotFoundMessage, typeof nameArg === "string" ? nameArg : ts.declarationNameToString(nameArg)); + if (!checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg)) { + error(errorLocation, nameNotFoundMessage, typeof nameArg === "string" ? nameArg : ts.declarationNameToString(nameArg)); + } } return undefined; } @@ -11456,11 +13008,40 @@ var ts; } return result; } + function checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) { + if (!errorLocation || (errorLocation.kind === 69 && (isTypeReferenceIdentifier(errorLocation)) || isInTypeQuery(errorLocation))) { + return false; + } + var container = ts.getThisContainer(errorLocation, true); + var location = container; + while (location) { + if (ts.isClassLike(location.parent)) { + var classSymbol = getSymbolOfNode(location.parent); + if (!classSymbol) { + break; + } + var constructorType = getTypeOfSymbol(classSymbol); + if (getPropertyOfType(constructorType, name)) { + error(errorLocation, ts.Diagnostics.Cannot_find_name_0_Did_you_mean_the_static_member_1_0, typeof nameArg === "string" ? nameArg : ts.declarationNameToString(nameArg), symbolToString(classSymbol)); + return true; + } + if (location === container && !(location.flags & 32)) { + var instanceType = getDeclaredTypeOfSymbol(classSymbol).thisType; + if (getPropertyOfType(instanceType, name)) { + error(errorLocation, ts.Diagnostics.Cannot_find_name_0_Did_you_mean_the_instance_member_this_0, typeof nameArg === "string" ? nameArg : ts.declarationNameToString(nameArg)); + return true; + } + } + } + location = location.parent; + } + return false; + } function checkResolvedBlockScopedVariable(result, errorLocation) { ts.Debug.assert((result.flags & 2) !== 0); var declaration = ts.forEach(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) ? d : undefined; }); ts.Debug.assert(declaration !== undefined, "Block-scoped variable declaration is undefined"); - if (!isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 211), errorLocation)) { + if (!isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 218), errorLocation)) { error(errorLocation, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, ts.declarationNameToString(declaration.name)); } } @@ -11477,10 +13058,10 @@ var ts; } function getAnyImportSyntax(node) { if (ts.isAliasSymbolDeclaration(node)) { - if (node.kind === 221) { + if (node.kind === 229) { return node; } - while (node && node.kind !== 222) { + while (node && node.kind !== 230) { node = node.parent; } return node; @@ -11490,7 +13071,7 @@ var ts; return ts.forEach(symbol.declarations, function (d) { return ts.isAliasSymbolDeclaration(d) ? d : undefined; }); } function getTargetOfImportEqualsDeclaration(node) { - if (node.moduleReference.kind === 232) { + if (node.moduleReference.kind === 240) { return resolveExternalModuleSymbol(resolveExternalModuleName(node, ts.getExternalModuleImportEqualsDeclarationExpression(node))); } return getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference, node); @@ -11498,10 +13079,15 @@ var ts; function getTargetOfImportClause(node) { var moduleSymbol = resolveExternalModuleName(node, node.parent.moduleSpecifier); if (moduleSymbol) { - var exportDefaultSymbol = resolveSymbol(moduleSymbol.exports["default"]); - if (!exportDefaultSymbol) { + var exportDefaultSymbol = moduleSymbol.exports["export="] ? + getPropertyOfType(getTypeOfSymbol(moduleSymbol.exports["export="]), "default") : + resolveSymbol(moduleSymbol.exports["default"]); + if (!exportDefaultSymbol && !allowSyntheticDefaultImports) { error(node.name, ts.Diagnostics.Module_0_has_no_default_export, symbolToString(moduleSymbol)); } + else if (!exportDefaultSymbol && allowSyntheticDefaultImports) { + return resolveExternalModuleSymbol(moduleSymbol) || resolveSymbol(moduleSymbol); + } return exportDefaultSymbol; } } @@ -11509,14 +13095,6 @@ var ts; var moduleSpecifier = node.parent.parent.moduleSpecifier; return resolveESModuleSymbol(resolveExternalModuleName(node, moduleSpecifier), moduleSpecifier); } - function getMemberOfModuleVariable(moduleSymbol, name) { - if (moduleSymbol.flags & 3) { - var typeAnnotation = moduleSymbol.valueDeclaration.type; - if (typeAnnotation) { - return getPropertyOfType(getTypeFromTypeNode(typeAnnotation), name); - } - } - } function combineValueAndTypeSymbols(valueSymbol, typeSymbol) { if (valueSymbol.flags & (793056 | 1536)) { return valueSymbol; @@ -11554,8 +13132,15 @@ var ts; if (targetSymbol) { var name_9 = specifier.propertyName || specifier.name; if (name_9.text) { + var symbolFromVariable = void 0; + if (moduleSymbol && moduleSymbol.exports && moduleSymbol.exports["export="]) { + symbolFromVariable = getPropertyOfType(getTypeOfSymbol(targetSymbol), name_9.text); + } + else { + symbolFromVariable = getPropertyOfVariable(targetSymbol, name_9.text); + } + symbolFromVariable = resolveSymbol(symbolFromVariable); var symbolFromModule = getExportOfModule(targetSymbol, name_9.text); - var symbolFromVariable = getPropertyOfVariable(targetSymbol, name_9.text); var symbol = symbolFromModule && symbolFromVariable ? combineValueAndTypeSymbols(symbolFromVariable, symbolFromModule) : symbolFromModule || symbolFromVariable; @@ -11569,6 +13154,9 @@ var ts; function getTargetOfImportSpecifier(node) { return getExternalModuleMember(node.parent.parent.parent, node); } + function getTargetOfGlobalModuleExportDeclaration(node) { + return resolveExternalModuleSymbol(node.parent.symbol); + } function getTargetOfExportSpecifier(node) { return node.parent.parent.moduleSpecifier ? getExternalModuleMember(node.parent.parent, node) : @@ -11579,18 +13167,20 @@ var ts; } function getTargetOfAliasDeclaration(node) { switch (node.kind) { - case 221: + case 229: return getTargetOfImportEqualsDeclaration(node); - case 223: + case 231: return getTargetOfImportClause(node); - case 224: + case 232: return getTargetOfNamespaceImport(node); - case 226: + case 234: return getTargetOfImportSpecifier(node); - case 230: + case 238: return getTargetOfExportSpecifier(node); - case 227: + case 235: return getTargetOfExportAssignment(node); + case 228: + return getTargetOfGlobalModuleExportDeclaration(node); } } function resolveSymbol(symbol) { @@ -11619,8 +13209,8 @@ var ts; var symbol = getSymbolOfNode(node); var target = resolveAlias(symbol); if (target) { - var markAlias = (target === unknownSymbol && compilerOptions.isolatedModules) || - (target !== unknownSymbol && (target.flags & 107455) && !isConstEnumOrConstEnumOnlyModule(target)); + var markAlias = target === unknownSymbol || + ((target.flags & 107455) && !isConstEnumOrConstEnumOnlyModule(target)); if (markAlias) { markAliasSymbolAsReferenced(symbol); } @@ -11631,10 +13221,10 @@ var ts; if (!links.referenced) { links.referenced = true; var node = getDeclarationOfAliasSymbol(symbol); - if (node.kind === 227) { + if (node.kind === 235) { checkExpressionCached(node.expression); } - else if (node.kind === 230) { + else if (node.kind === 238) { checkExpressionCached(node.propertyName || node.name); } else if (ts.isInternalModuleImportEqualsDeclaration(node)) { @@ -11644,17 +13234,17 @@ var ts; } function getSymbolOfPartOfRightHandSideOfImportEquals(entityName, importDeclaration) { if (!importDeclaration) { - importDeclaration = ts.getAncestor(entityName, 221); + importDeclaration = ts.getAncestor(entityName, 229); ts.Debug.assert(importDeclaration !== undefined); } if (entityName.kind === 69 && ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { entityName = entityName.parent; } - if (entityName.kind === 69 || entityName.parent.kind === 135) { + if (entityName.kind === 69 || entityName.parent.kind === 139) { return resolveEntityName(entityName, 1536); } else { - ts.Debug.assert(entityName.parent.kind === 221); + ts.Debug.assert(entityName.parent.kind === 229); return resolveEntityName(entityName, 107455 | 793056 | 1536); } } @@ -11673,9 +13263,9 @@ var ts; return undefined; } } - else if (name.kind === 135 || name.kind === 166) { - var left = name.kind === 135 ? name.left : name.expression; - var right = name.kind === 135 ? name.right : name.name; + else if (name.kind === 139 || name.kind === 172) { + var left = name.kind === 139 ? name.left : name.expression; + var right = name.kind === 139 ? name.right : name.name; var namespace = resolveEntityName(left, 1536, ignoreErrors); if (!namespace || namespace === unknownSymbol || ts.nodeIsMissing(right)) { return undefined; @@ -11695,38 +13285,42 @@ var ts; return symbol.flags & meaning ? symbol : resolveAlias(symbol); } function resolveExternalModuleName(location, moduleReferenceExpression) { + return resolveExternalModuleNameWorker(location, moduleReferenceExpression, ts.Diagnostics.Cannot_find_module_0); + } + function resolveExternalModuleNameWorker(location, moduleReferenceExpression, moduleNotFoundError) { if (moduleReferenceExpression.kind !== 9) { return; } var moduleReferenceLiteral = moduleReferenceExpression; - var searchPath = ts.getDirectoryPath(getSourceFile(location).fileName); var moduleName = ts.escapeIdentifier(moduleReferenceLiteral.text); if (moduleName === undefined) { return; } - if (moduleName.indexOf("!") >= 0) { - moduleName = moduleName.substr(0, moduleName.indexOf("!")); - } var isRelative = ts.isExternalModuleNameRelative(moduleName); if (!isRelative) { - var symbol = getSymbol(globals, "\"" + moduleName + "\"", 512); + var symbol = getSymbol(globals, '"' + moduleName + '"', 512); if (symbol) { - return symbol; + return getMergedSymbol(symbol); } } - var resolvedModule = ts.getResolvedModule(getSourceFile(location), moduleReferenceLiteral.text); + var resolvedModule = ts.getResolvedModule(ts.getSourceFileOfNode(location), moduleReferenceLiteral.text); var sourceFile = resolvedModule && host.getSourceFile(resolvedModule.resolvedFileName); if (sourceFile) { if (sourceFile.symbol) { - return sourceFile.symbol; + return getMergedSymbol(sourceFile.symbol); } - error(moduleReferenceLiteral, ts.Diagnostics.File_0_is_not_a_module, sourceFile.fileName); - return; + if (moduleNotFoundError) { + error(moduleReferenceLiteral, ts.Diagnostics.File_0_is_not_a_module, sourceFile.fileName); + } + return undefined; } - error(moduleReferenceLiteral, ts.Diagnostics.Cannot_find_module_0, moduleName); + if (moduleNotFoundError) { + error(moduleReferenceLiteral, moduleNotFoundError, moduleName); + } + return undefined; } function resolveExternalModuleSymbol(moduleSymbol) { - return moduleSymbol && resolveSymbol(moduleSymbol.exports["export="]) || moduleSymbol; + return moduleSymbol && getMergedSymbol(resolveSymbol(moduleSymbol.exports["export="])) || moduleSymbol; } function resolveESModuleSymbol(moduleSymbol, moduleReferenceExpression) { var symbol = resolveExternalModuleSymbol(moduleSymbol); @@ -11736,8 +13330,8 @@ var ts; } return symbol; } - function getExportAssignmentSymbol(moduleSymbol) { - return moduleSymbol.exports["export="]; + function hasExportAssignmentSymbol(moduleSymbol) { + return moduleSymbol.exports["export="] !== undefined; } function getExportsOfModuleAsArray(moduleSymbol) { return symbolsToArray(getExportsOfModule(moduleSymbol)); @@ -11749,35 +13343,58 @@ var ts; var links = getSymbolLinks(moduleSymbol); return links.resolvedExports || (links.resolvedExports = getExportsForModule(moduleSymbol)); } - function extendExportSymbols(target, source) { + function extendExportSymbols(target, source, lookupTable, exportNode) { for (var id in source) { if (id !== "default" && !ts.hasProperty(target, id)) { target[id] = source[id]; + if (lookupTable && exportNode) { + lookupTable[id] = { + specifierText: ts.getTextOfNode(exportNode.moduleSpecifier) + }; + } + } + else if (lookupTable && exportNode && id !== "default" && ts.hasProperty(target, id) && resolveSymbol(target[id]) !== resolveSymbol(source[id])) { + if (!lookupTable[id].exportsWithDuplicate) { + lookupTable[id].exportsWithDuplicate = [exportNode]; + } + else { + lookupTable[id].exportsWithDuplicate.push(exportNode); + } } } } function getExportsForModule(moduleSymbol) { - var result; var visitedSymbols = []; - visit(moduleSymbol); - return result || moduleSymbol.exports; + return visit(moduleSymbol) || moduleSymbol.exports; function visit(symbol) { - if (symbol && symbol.flags & 1952 && !ts.contains(visitedSymbols, symbol)) { - visitedSymbols.push(symbol); - if (symbol !== moduleSymbol) { - if (!result) { - result = cloneSymbolTable(moduleSymbol.exports); - } - extendExportSymbols(result, symbol.exports); - } - var exportStars = symbol.exports["__export"]; - if (exportStars) { - for (var _i = 0, _a = exportStars.declarations; _i < _a.length; _i++) { - var node = _a[_i]; - visit(resolveExternalModuleName(node, node.moduleSpecifier)); - } - } + if (!(symbol && symbol.flags & 1952 && !ts.contains(visitedSymbols, symbol))) { + return; } + visitedSymbols.push(symbol); + var symbols = cloneSymbolTable(symbol.exports); + var exportStars = symbol.exports["__export"]; + if (exportStars) { + var nestedSymbols = {}; + var lookupTable = {}; + for (var _i = 0, _a = exportStars.declarations; _i < _a.length; _i++) { + var node = _a[_i]; + var resolvedModule = resolveExternalModuleName(node, node.moduleSpecifier); + var exportedSymbols = visit(resolvedModule); + extendExportSymbols(nestedSymbols, exportedSymbols, lookupTable, node); + } + for (var id in lookupTable) { + var exportsWithDuplicate = lookupTable[id].exportsWithDuplicate; + if (id === "export=" || !(exportsWithDuplicate && exportsWithDuplicate.length) || ts.hasProperty(symbols, id)) { + continue; + } + for (var _b = 0, exportsWithDuplicate_1 = exportsWithDuplicate; _b < exportsWithDuplicate_1.length; _b++) { + var node = exportsWithDuplicate_1[_b]; + diagnostics.add(ts.createDiagnosticForNode(node, ts.Diagnostics.Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambiguity, lookupTable[id].specifierText, id)); + } + } + extendExportSymbols(symbols, nestedSymbols); + } + return symbols; } } function getMergedSymbol(symbol) { @@ -11811,14 +13428,15 @@ var ts; var members = node.members; for (var _i = 0, members_1 = members; _i < members_1.length; _i++) { var member = members_1[_i]; - if (member.kind === 144 && ts.nodeIsPresent(member.body)) { + if (member.kind === 148 && ts.nodeIsPresent(member.body)) { return member; } } } function createType(flags) { var result = new Type(checker, flags); - result.id = typeCount++; + result.id = typeCount; + typeCount++; return result; } function createIntrinsicType(kind, intrinsicName) { @@ -11853,19 +13471,19 @@ var ts; } return result || emptyArray; } - function setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexType, numberIndexType) { + function setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo) { type.members = members; type.properties = getNamedMembers(members); type.callSignatures = callSignatures; type.constructSignatures = constructSignatures; - if (stringIndexType) - type.stringIndexType = stringIndexType; - if (numberIndexType) - type.numberIndexType = numberIndexType; + if (stringIndexInfo) + type.stringIndexInfo = stringIndexInfo; + if (numberIndexInfo) + type.numberIndexInfo = numberIndexInfo; return type; } - function createAnonymousType(symbol, members, callSignatures, constructSignatures, stringIndexType, numberIndexType) { - return setObjectTypeMembers(createObjectType(65536, symbol), members, callSignatures, constructSignatures, stringIndexType, numberIndexType); + function createAnonymousType(symbol, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo) { + return setObjectTypeMembers(createObjectType(65536, symbol), members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo); } function forEachSymbolTableInScope(enclosingDeclaration, callback) { var result; @@ -11876,21 +13494,15 @@ var ts; } } switch (location_1.kind) { - case 248: + case 256: if (!ts.isExternalOrCommonJsModule(location_1)) { break; } - case 218: + case 225: if (result = callback(getSymbolOfNode(location_1).exports)) { return result; } break; - case 214: - case 215: - if (result = callback(getSymbolOfNode(location_1).members)) { - return result; - } - break; } } return callback(globals); @@ -11919,7 +13531,7 @@ var ts; return ts.forEachValue(symbols, function (symbolFromSymbolTable) { if (symbolFromSymbolTable.flags & 8388608 && symbolFromSymbolTable.name !== "export=" - && !ts.getDeclarationOfKind(symbolFromSymbolTable, 230)) { + && !ts.getDeclarationOfKind(symbolFromSymbolTable, 238)) { if (!useOnlyExternalAliasing || ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); @@ -11935,7 +13547,9 @@ var ts; }); } if (symbol) { - return forEachSymbolTableInScope(enclosingDeclaration, getAccessibleSymbolChainFromSymbolTable); + if (!(isPropertyOrMethodDeclarationSymbol(symbol))) { + return forEachSymbolTableInScope(enclosingDeclaration, getAccessibleSymbolChainFromSymbolTable); + } } } function needsQualification(symbol, enclosingDeclaration, meaning) { @@ -11948,7 +13562,7 @@ var ts; if (symbolFromSymbolTable === symbol) { return true; } - symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608 && !ts.getDeclarationOfKind(symbolFromSymbolTable, 230)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; + symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608 && !ts.getDeclarationOfKind(symbolFromSymbolTable, 238)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; if (symbolFromSymbolTable.flags & meaning) { qualify = true; return true; @@ -11957,6 +13571,24 @@ var ts; }); return qualify; } + function isPropertyOrMethodDeclarationSymbol(symbol) { + if (symbol.declarations && symbol.declarations.length) { + for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { + var declaration = _a[_i]; + switch (declaration.kind) { + case 145: + case 147: + case 149: + case 150: + continue; + default: + return false; + } + } + return true; + } + return false; + } function isSymbolAccessible(symbol, enclosingDeclaration, meaning) { if (symbol && enclosingDeclaration && !(symbol.flags & 262144)) { var initialSymbol = symbol; @@ -12003,8 +13635,7 @@ var ts; } } function hasExternalModuleSymbol(declaration) { - return (declaration.kind === 218 && declaration.name.kind === 9) || - (declaration.kind === 248 && ts.isExternalOrCommonJsModule(declaration)); + return ts.isAmbientModule(declaration) || (declaration.kind === 256 && ts.isExternalOrCommonJsModule(declaration)); } function hasVisibleDeclarations(symbol) { var aliasesToMakeVisible; @@ -12016,7 +13647,7 @@ var ts; if (!isDeclarationVisible(declaration)) { var anyImportSyntax = getAnyImportSyntax(declaration); if (anyImportSyntax && - !(anyImportSyntax.flags & 2) && + !(anyImportSyntax.flags & 1) && isDeclarationVisible(anyImportSyntax.parent)) { getNodeLinks(declaration).isVisible = true; if (aliasesToMakeVisible) { @@ -12036,11 +13667,11 @@ var ts; } function isEntityNameVisible(entityName, enclosingDeclaration) { var meaning; - if (entityName.parent.kind === 154) { + if (entityName.parent.kind === 158 || ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) { meaning = 107455 | 1048576; } - else if (entityName.kind === 135 || entityName.kind === 166 || - entityName.parent.kind === 221) { + else if (entityName.kind === 139 || entityName.kind === 172 || + entityName.parent.kind === 229) { meaning = 1536; } else { @@ -12070,9 +13701,9 @@ var ts; ts.releaseStringWriter(writer); return result; } - function signatureToString(signature, enclosingDeclaration, flags) { + function signatureToString(signature, enclosingDeclaration, flags, kind) { var writer = ts.getSingleLineStringWriter(); - getSymbolDisplayBuilder().buildSignatureDisplay(signature, writer, enclosingDeclaration, flags); + getSymbolDisplayBuilder().buildSignatureDisplay(signature, writer, enclosingDeclaration, flags, kind); var result = writer.string(); ts.releaseStringWriter(writer); return result; @@ -12088,18 +13719,39 @@ var ts; } return result; } + function typePredicateToString(typePredicate, enclosingDeclaration, flags) { + var writer = ts.getSingleLineStringWriter(); + getSymbolDisplayBuilder().buildTypePredicateDisplay(typePredicate, writer, enclosingDeclaration, flags); + var result = writer.string(); + ts.releaseStringWriter(writer); + return result; + } + function visibilityToString(flags) { + if (flags === 8) { + return "private"; + } + if (flags === 16) { + return "protected"; + } + return "public"; + } function getTypeAliasForTypeLiteral(type) { if (type.symbol && type.symbol.flags & 2048) { var node = type.symbol.declarations[0].parent; - while (node.kind === 160) { + while (node.kind === 164) { node = node.parent; } - if (node.kind === 216) { + if (node.kind === 223) { return getSymbolOfNode(node); } } return undefined; } + function isTopLevelInExternalModuleAugmentation(node) { + return node && node.parent && + node.parent.kind === 226 && + ts.isExternalModuleAugmentation(node.parent.parent); + } function getSymbolDisplayBuilder() { function getNameOfSymbol(symbol) { if (symbol.declarations && symbol.declarations.length) { @@ -12108,10 +13760,10 @@ var ts; return ts.declarationNameToString(declaration.name); } switch (declaration.kind) { - case 186: + case 192: return "(Anonymous class)"; - case 173: - case 174: + case 179: + case 180: return "(Anonymous function)"; } } @@ -12120,6 +13772,25 @@ var ts; function appendSymbolNameOnly(symbol, writer) { writer.writeSymbol(getNameOfSymbol(symbol), symbol); } + function appendPropertyOrElementAccessForSymbol(symbol, writer) { + var symbolName = getNameOfSymbol(symbol); + var firstChar = symbolName.charCodeAt(0); + var needsElementAccess = !ts.isIdentifierStart(firstChar, languageVersion); + if (needsElementAccess) { + writePunctuation(writer, 19); + if (ts.isSingleOrDoubleQuote(firstChar)) { + writer.writeStringLiteral(symbolName); + } + else { + writer.writeSymbol(symbolName, symbol); + } + writePunctuation(writer, 20); + } + else { + writePunctuation(writer, 21); + writer.writeSymbol(symbolName, symbol); + } + } function buildSymbolDisplay(symbol, writer, enclosingDeclaration, meaning, flags, typeFlags) { var parentSymbol; function appendParentTypeArgumentsAndSymbolName(symbol) { @@ -12132,10 +13803,12 @@ var ts; buildTypeParameterDisplayFromSymbol(parentSymbol, writer, enclosingDeclaration); } } - writePunctuation(writer, 21); + appendPropertyOrElementAccessForSymbol(symbol, writer); + } + else { + appendSymbolNameOnly(symbol, writer); } parentSymbol = symbol; - appendSymbolNameOnly(symbol, writer); } writer.trackSymbol(symbol, enclosingDeclaration, meaning); function walkSymbol(symbol, meaning) { @@ -12175,7 +13848,7 @@ var ts; var inObjectTypeLiteral = false; return writeType(type, globalFlags); function writeType(type, flags) { - if (type.flags & 16777343) { + if (type.flags & 150995071) { writer.writeKeyword(!(globalFlags & 16) && isTypeAny(type) ? "any" : type.intrinsicName); @@ -12230,11 +13903,13 @@ var ts; } if (pos < end) { writePunctuation(writer, 25); - writeType(typeArguments[pos++], 0); + writeType(typeArguments[pos], 256); + pos++; while (pos < end) { writePunctuation(writer, 24); writeSpace(writer); - writeType(typeArguments[pos++], 0); + writeType(typeArguments[pos], 0); + pos++; } writePunctuation(writer, 27); } @@ -12253,12 +13928,12 @@ var ts; var length_1 = outerTypeParameters.length; while (i < length_1) { var start = i; - var parent_3 = getParentSymbolOfTypeParameter(outerTypeParameters[i]); + var parent_6 = getParentSymbolOfTypeParameter(outerTypeParameters[i]); do { i++; - } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent_3); + } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent_6); if (!ts.rangeEquals(outerTypeParameters, typeArguments, start, i)) { - writeSymbolTypeReference(parent_3, typeArguments, start, i, flags); + writeSymbolTypeReference(parent_6, typeArguments, start, i, flags); writePunctuation(writer, 21); } } @@ -12285,10 +13960,10 @@ var ts; var symbol = type.symbol; if (symbol) { if (symbol.flags & (32 | 384 | 512)) { - writeTypeofSymbol(type, flags); + writeTypeOfSymbol(type, flags); } else if (shouldWriteTypeOfFunctionSymbol()) { - writeTypeofSymbol(type, flags); + writeTypeOfSymbol(type, flags); } else if (ts.contains(symbolStack, symbol)) { var typeAlias = getTypeAliasForTypeLiteral(type); @@ -12313,11 +13988,11 @@ var ts; } function shouldWriteTypeOfFunctionSymbol() { var isStaticMethodSymbol = !!(symbol.flags & 8192 && - ts.forEach(symbol.declarations, function (declaration) { return declaration.flags & 64; })); + ts.forEach(symbol.declarations, function (declaration) { return declaration.flags & 32; })); var isNonLocalFunctionSymbol = !!(symbol.flags & 16) && (symbol.parent || ts.forEach(symbol.declarations, function (declaration) { - return declaration.parent.kind === 248 || declaration.parent.kind === 219; + return declaration.parent.kind === 256 || declaration.parent.kind === 226; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { return !!(flags & 2) || @@ -12325,33 +14000,66 @@ var ts; } } } - function writeTypeofSymbol(type, typeFormatFlags) { + function writeTypeOfSymbol(type, typeFormatFlags) { writeKeyword(writer, 101); writeSpace(writer); buildSymbolDisplay(type.symbol, writer, enclosingDeclaration, 107455, 0, typeFormatFlags); } - function getIndexerParameterName(type, indexKind, fallbackName) { - var declaration = getIndexDeclarationOfSymbol(type.symbol, indexKind); - if (!declaration) { - return fallbackName; + function writeIndexSignature(info, keyword) { + if (info) { + if (info.isReadonly) { + writeKeyword(writer, 128); + writeSpace(writer); + } + writePunctuation(writer, 19); + writer.writeParameter(info.declaration ? ts.declarationNameToString(info.declaration.parameters[0].name) : "x"); + writePunctuation(writer, 54); + writeSpace(writer); + writeKeyword(writer, keyword); + writePunctuation(writer, 20); + writePunctuation(writer, 54); + writeSpace(writer); + writeType(info.type, 0); + writePunctuation(writer, 23); + writer.writeLine(); } - ts.Debug.assert(declaration.parameters.length !== 0); - return ts.declarationNameToString(declaration.parameters[0].name); + } + function writePropertyWithModifiers(prop) { + if (isReadonlySymbol(prop)) { + writeKeyword(writer, 128); + writeSpace(writer); + } + buildSymbolDisplay(prop, writer); + if (prop.flags & 536870912) { + writePunctuation(writer, 53); + } + } + function shouldAddParenthesisAroundFunctionType(callSignature, flags) { + if (flags & 64) { + return true; + } + else if (flags & 256) { + var typeParameters = callSignature.target && (flags & 32) ? + callSignature.target.typeParameters : callSignature.typeParameters; + return typeParameters && typeParameters.length !== 0; + } + return false; } function writeLiteralType(type, flags) { var resolved = resolveStructuredTypeMembers(type); - if (!resolved.properties.length && !resolved.stringIndexType && !resolved.numberIndexType) { + if (!resolved.properties.length && !resolved.stringIndexInfo && !resolved.numberIndexInfo) { if (!resolved.callSignatures.length && !resolved.constructSignatures.length) { writePunctuation(writer, 15); writePunctuation(writer, 16); return; } if (resolved.callSignatures.length === 1 && !resolved.constructSignatures.length) { - if (flags & 64) { + var parenthesizeSignature = shouldAddParenthesisAroundFunctionType(resolved.callSignatures[0], flags); + if (parenthesizeSignature) { writePunctuation(writer, 17); } - buildSignatureDisplay(resolved.callSignatures[0], writer, enclosingDeclaration, globalFlagsToPass | 8, symbolStack); - if (flags & 64) { + buildSignatureDisplay(resolved.callSignatures[0], writer, enclosingDeclaration, globalFlagsToPass | 8, undefined, symbolStack); + if (parenthesizeSignature) { writePunctuation(writer, 18); } return; @@ -12362,7 +14070,7 @@ var ts; } writeKeyword(writer, 92); writeSpace(writer); - buildSignatureDisplay(resolved.constructSignatures[0], writer, enclosingDeclaration, globalFlagsToPass | 8, symbolStack); + buildSignatureDisplay(resolved.constructSignatures[0], writer, enclosingDeclaration, globalFlagsToPass | 8, undefined, symbolStack); if (flags & 64) { writePunctuation(writer, 18); } @@ -12376,44 +14084,18 @@ var ts; writer.increaseIndent(); for (var _i = 0, _a = resolved.callSignatures; _i < _a.length; _i++) { var signature = _a[_i]; - buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, symbolStack); + buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, undefined, symbolStack); writePunctuation(writer, 23); writer.writeLine(); } for (var _b = 0, _c = resolved.constructSignatures; _b < _c.length; _b++) { var signature = _c[_b]; - writeKeyword(writer, 92); - writeSpace(writer); - buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, symbolStack); - writePunctuation(writer, 23); - writer.writeLine(); - } - if (resolved.stringIndexType) { - writePunctuation(writer, 19); - writer.writeParameter(getIndexerParameterName(resolved, 0, "x")); - writePunctuation(writer, 54); - writeSpace(writer); - writeKeyword(writer, 130); - writePunctuation(writer, 20); - writePunctuation(writer, 54); - writeSpace(writer); - writeType(resolved.stringIndexType, 0); - writePunctuation(writer, 23); - writer.writeLine(); - } - if (resolved.numberIndexType) { - writePunctuation(writer, 19); - writer.writeParameter(getIndexerParameterName(resolved, 1, "x")); - writePunctuation(writer, 54); - writeSpace(writer); - writeKeyword(writer, 128); - writePunctuation(writer, 20); - writePunctuation(writer, 54); - writeSpace(writer); - writeType(resolved.numberIndexType, 0); + buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, 1, symbolStack); writePunctuation(writer, 23); writer.writeLine(); } + writeIndexSignature(resolved.stringIndexInfo, 132); + writeIndexSignature(resolved.numberIndexInfo, 130); for (var _d = 0, _e = resolved.properties; _d < _e.length; _d++) { var p = _e[_d]; var t = getTypeOfSymbol(p); @@ -12421,20 +14103,14 @@ var ts; var signatures = getSignaturesOfType(t, 0); for (var _f = 0, signatures_1 = signatures; _f < signatures_1.length; _f++) { var signature = signatures_1[_f]; - buildSymbolDisplay(p, writer); - if (p.flags & 536870912) { - writePunctuation(writer, 53); - } - buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, symbolStack); + writePropertyWithModifiers(p); + buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, undefined, symbolStack); writePunctuation(writer, 23); writer.writeLine(); } } else { - buildSymbolDisplay(p, writer); - if (p.flags & 536870912) { - writePunctuation(writer, 53); - } + writePropertyWithModifiers(p); writePunctuation(writer, 54); writeSpace(writer); writeType(t, 0); @@ -12447,10 +14123,10 @@ var ts; inObjectTypeLiteral = saveInObjectTypeLiteral; } } - function buildTypeParameterDisplayFromSymbol(symbol, writer, enclosingDeclaraiton, flags) { + function buildTypeParameterDisplayFromSymbol(symbol, writer, enclosingDeclaration, flags) { var targetSymbol = getTargetSymbol(symbol); if (targetSymbol.flags & 32 || targetSymbol.flags & 64 || targetSymbol.flags & 524288) { - buildDisplayForTypeParametersAndDelimiters(getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol), writer, enclosingDeclaraiton, flags); + buildDisplayForTypeParametersAndDelimiters(getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol), writer, enclosingDeclaration, flags); } } function buildTypeParameterDisplay(tp, writer, enclosingDeclaration, flags, symbolStack) { @@ -12468,7 +14144,12 @@ var ts; if (ts.isRestParameter(parameterNode)) { writePunctuation(writer, 22); } - appendSymbolNameOnly(p, writer); + if (ts.isBindingPattern(parameterNode.name)) { + buildBindingPatternDisplay(parameterNode.name, writer, enclosingDeclaration, flags, symbolStack); + } + else { + appendSymbolNameOnly(p, writer); + } if (isOptionalParameter(parameterNode)) { writePunctuation(writer, 53); } @@ -12476,36 +14157,83 @@ var ts; writeSpace(writer); buildTypeDisplay(getTypeOfSymbol(p), writer, enclosingDeclaration, flags, symbolStack); } + function buildBindingPatternDisplay(bindingPattern, writer, enclosingDeclaration, flags, symbolStack) { + if (bindingPattern.kind === 167) { + writePunctuation(writer, 15); + buildDisplayForCommaSeparatedList(bindingPattern.elements, writer, function (e) { return buildBindingElementDisplay(e, writer, enclosingDeclaration, flags, symbolStack); }); + writePunctuation(writer, 16); + } + else if (bindingPattern.kind === 168) { + writePunctuation(writer, 19); + var elements = bindingPattern.elements; + buildDisplayForCommaSeparatedList(elements, writer, function (e) { return buildBindingElementDisplay(e, writer, enclosingDeclaration, flags, symbolStack); }); + if (elements && elements.hasTrailingComma) { + writePunctuation(writer, 24); + } + writePunctuation(writer, 20); + } + } + function buildBindingElementDisplay(bindingElement, writer, enclosingDeclaration, flags, symbolStack) { + if (bindingElement.kind === 193) { + return; + } + ts.Debug.assert(bindingElement.kind === 169); + if (bindingElement.propertyName) { + writer.writeSymbol(ts.getTextOfNode(bindingElement.propertyName), bindingElement.symbol); + writePunctuation(writer, 54); + writeSpace(writer); + } + if (ts.isBindingPattern(bindingElement.name)) { + buildBindingPatternDisplay(bindingElement.name, writer, enclosingDeclaration, flags, symbolStack); + } + else { + if (bindingElement.dotDotDotToken) { + writePunctuation(writer, 22); + } + appendSymbolNameOnly(bindingElement.symbol, writer); + } + } function buildDisplayForTypeParametersAndDelimiters(typeParameters, writer, enclosingDeclaration, flags, symbolStack) { if (typeParameters && typeParameters.length) { writePunctuation(writer, 25); - for (var i = 0; i < typeParameters.length; i++) { - if (i > 0) { - writePunctuation(writer, 24); - writeSpace(writer); - } - buildTypeParameterDisplay(typeParameters[i], writer, enclosingDeclaration, flags, symbolStack); - } + buildDisplayForCommaSeparatedList(typeParameters, writer, function (p) { return buildTypeParameterDisplay(p, writer, enclosingDeclaration, flags, symbolStack); }); writePunctuation(writer, 27); } } + function buildDisplayForCommaSeparatedList(list, writer, action) { + for (var i = 0; i < list.length; i++) { + if (i > 0) { + writePunctuation(writer, 24); + writeSpace(writer); + } + action(list[i]); + } + } function buildDisplayForTypeArgumentsAndDelimiters(typeParameters, mapper, writer, enclosingDeclaration, flags, symbolStack) { if (typeParameters && typeParameters.length) { writePunctuation(writer, 25); + var flags_1 = 256; for (var i = 0; i < typeParameters.length; i++) { if (i > 0) { writePunctuation(writer, 24); writeSpace(writer); + flags_1 = 0; } - buildTypeDisplay(mapper(typeParameters[i]), writer, enclosingDeclaration, 0); + buildTypeDisplay(mapper(typeParameters[i]), writer, enclosingDeclaration, flags_1); } writePunctuation(writer, 27); } } - function buildDisplayForParametersAndDelimiters(parameters, writer, enclosingDeclaration, flags, symbolStack) { + function buildDisplayForParametersAndDelimiters(thisType, parameters, writer, enclosingDeclaration, flags, symbolStack) { writePunctuation(writer, 17); + if (thisType) { + writeKeyword(writer, 97); + writePunctuation(writer, 54); + writeSpace(writer); + buildTypeDisplay(thisType, writer, enclosingDeclaration, flags, symbolStack); + } for (var i = 0; i < parameters.length; i++) { - if (i > 0) { + if (i > 0 || thisType) { writePunctuation(writer, 24); writeSpace(writer); } @@ -12513,6 +14241,18 @@ var ts; } writePunctuation(writer, 18); } + function buildTypePredicateDisplay(predicate, writer, enclosingDeclaration, flags, symbolStack) { + if (ts.isIdentifierTypePredicate(predicate)) { + writer.writeParameter(predicate.parameterName); + } + else { + writeKeyword(writer, 97); + } + writeSpace(writer); + writeKeyword(writer, 124); + writeSpace(writer); + buildTypeDisplay(predicate.type, writer, enclosingDeclaration, flags, symbolStack); + } function buildReturnTypeDisplay(signature, writer, enclosingDeclaration, flags, symbolStack) { if (flags & 8) { writeSpace(writer); @@ -12522,33 +14262,33 @@ var ts; writePunctuation(writer, 54); } writeSpace(writer); - var returnType; if (signature.typePredicate) { - writer.writeParameter(signature.typePredicate.parameterName); - writeSpace(writer); - writeKeyword(writer, 124); - writeSpace(writer); - returnType = signature.typePredicate.type; + buildTypePredicateDisplay(signature.typePredicate, writer, enclosingDeclaration, flags, symbolStack); } else { - returnType = getReturnTypeOfSignature(signature); + var returnType = getReturnTypeOfSignature(signature); + buildTypeDisplay(returnType, writer, enclosingDeclaration, flags, symbolStack); } - buildTypeDisplay(returnType, writer, enclosingDeclaration, flags, symbolStack); } - function buildSignatureDisplay(signature, writer, enclosingDeclaration, flags, symbolStack) { + function buildSignatureDisplay(signature, writer, enclosingDeclaration, flags, kind, symbolStack) { + if (kind === 1) { + writeKeyword(writer, 92); + writeSpace(writer); + } if (signature.target && (flags & 32)) { buildDisplayForTypeArgumentsAndDelimiters(signature.target.typeParameters, signature.mapper, writer, enclosingDeclaration); } else { buildDisplayForTypeParametersAndDelimiters(signature.typeParameters, writer, enclosingDeclaration, flags, symbolStack); } - buildDisplayForParametersAndDelimiters(signature.parameters, writer, enclosingDeclaration, flags, symbolStack); + buildDisplayForParametersAndDelimiters(signature.thisType, signature.parameters, writer, enclosingDeclaration, flags, symbolStack); buildReturnTypeDisplay(signature, writer, enclosingDeclaration, flags, symbolStack); } return _displayBuilder || (_displayBuilder = { buildSymbolDisplay: buildSymbolDisplay, buildTypeDisplay: buildTypeDisplay, buildTypeParameterDisplay: buildTypeParameterDisplay, + buildTypePredicateDisplay: buildTypePredicateDisplay, buildParameterDisplay: buildParameterDisplay, buildDisplayForParametersAndDelimiters: buildDisplayForParametersAndDelimiters, buildDisplayForTypeParametersAndDelimiters: buildDisplayForTypeParametersAndDelimiters, @@ -12558,114 +14298,6 @@ var ts; }); } function isDeclarationVisible(node) { - function getContainingExternalModule(node) { - for (; node; node = node.parent) { - if (node.kind === 218) { - if (node.name.kind === 9) { - return node; - } - } - else if (node.kind === 248) { - return ts.isExternalOrCommonJsModule(node) ? node : undefined; - } - } - ts.Debug.fail("getContainingModule cant reach here"); - } - function isUsedInExportAssignment(node) { - var externalModule = getContainingExternalModule(node); - var exportAssignmentSymbol; - var resolvedExportSymbol; - if (externalModule) { - var externalModuleSymbol = getSymbolOfNode(externalModule); - exportAssignmentSymbol = getExportAssignmentSymbol(externalModuleSymbol); - var symbolOfNode = getSymbolOfNode(node); - if (isSymbolUsedInExportAssignment(symbolOfNode)) { - return true; - } - if (symbolOfNode.flags & 8388608) { - return isSymbolUsedInExportAssignment(resolveAlias(symbolOfNode)); - } - } - function isSymbolUsedInExportAssignment(symbol) { - if (exportAssignmentSymbol === symbol) { - return true; - } - if (exportAssignmentSymbol && !!(exportAssignmentSymbol.flags & 8388608)) { - resolvedExportSymbol = resolvedExportSymbol || resolveAlias(exportAssignmentSymbol); - if (resolvedExportSymbol === symbol) { - return true; - } - return ts.forEach(resolvedExportSymbol.declarations, function (current) { - while (current) { - if (current === node) { - return true; - } - current = current.parent; - } - }); - } - } - } - function determineIfDeclarationIsVisible() { - switch (node.kind) { - case 163: - return isDeclarationVisible(node.parent.parent); - case 211: - if (ts.isBindingPattern(node.name) && - !node.name.elements.length) { - return false; - } - case 218: - case 214: - case 215: - case 216: - case 213: - case 217: - case 221: - var parent_4 = getDeclarationContainer(node); - if (!(ts.getCombinedNodeFlags(node) & 2) && - !(node.kind !== 221 && parent_4.kind !== 248 && ts.isInAmbientContext(parent_4))) { - return isGlobalSourceFile(parent_4); - } - return isDeclarationVisible(parent_4); - case 141: - case 140: - case 145: - case 146: - case 143: - case 142: - if (node.flags & (16 | 32)) { - return false; - } - case 144: - case 148: - case 147: - case 149: - case 138: - case 219: - case 152: - case 153: - case 155: - case 151: - case 156: - case 157: - case 158: - case 159: - case 160: - return isDeclarationVisible(node.parent); - case 223: - case 224: - case 226: - return false; - case 137: - case 248: - return true; - case 227: - return false; - default: - ts.Debug.fail("isDeclarationVisible unknown: SyntaxKind: " + node.kind); - } - } if (node) { var links = getNodeLinks(node); if (links.isVisible === undefined) { @@ -12673,13 +14305,77 @@ var ts; } return links.isVisible; } + return false; + function determineIfDeclarationIsVisible() { + switch (node.kind) { + case 169: + return isDeclarationVisible(node.parent.parent); + case 218: + if (ts.isBindingPattern(node.name) && + !node.name.elements.length) { + return false; + } + case 225: + case 221: + case 222: + case 223: + case 220: + case 224: + case 229: + if (ts.isExternalModuleAugmentation(node)) { + return true; + } + var parent_7 = getDeclarationContainer(node); + if (!(ts.getCombinedNodeFlags(node) & 1) && + !(node.kind !== 229 && parent_7.kind !== 256 && ts.isInAmbientContext(parent_7))) { + return isGlobalSourceFile(parent_7); + } + return isDeclarationVisible(parent_7); + case 145: + case 144: + case 149: + case 150: + case 147: + case 146: + if (node.flags & (8 | 16)) { + return false; + } + case 148: + case 152: + case 151: + case 153: + case 142: + case 226: + case 156: + case 157: + case 159: + case 155: + case 160: + case 161: + case 162: + case 163: + case 164: + return isDeclarationVisible(node.parent); + case 231: + case 232: + case 234: + return false; + case 141: + case 256: + return true; + case 235: + return false; + default: + return false; + } + } } function collectLinkedAliases(node) { var exportSymbol; - if (node.parent && node.parent.kind === 227) { + if (node.parent && node.parent.kind === 235) { exportSymbol = resolveName(node.parent, node.text, 107455 | 793056 | 1536 | 8388608, ts.Diagnostics.Cannot_find_name_0, node); } - else if (node.parent.kind === 230) { + else if (node.parent.kind === 238) { var exportSpecifier = node.parent; exportSymbol = exportSpecifier.parent.parent.moduleSpecifier ? getExternalModuleMember(exportSpecifier.parent.parent, exportSpecifier) : @@ -12700,8 +14396,10 @@ var ts; if (ts.isInternalModuleImportEqualsDeclaration(declaration)) { var internalModuleReference = declaration.moduleReference; var firstIdentifier = getFirstIdentifier(internalModuleReference); - var importSymbol = resolveName(declaration, firstIdentifier.text, 107455 | 793056 | 1536, ts.Diagnostics.Cannot_find_name_0, firstIdentifier); - buildVisibleNodeList(importSymbol.declarations); + var importSymbol = resolveName(declaration, firstIdentifier.text, 107455 | 793056 | 1536, undefined, undefined); + if (importSymbol) { + buildVisibleNodeList(importSymbol.declarations); + } } }); } @@ -12754,10 +14452,23 @@ var ts; } function getDeclarationContainer(node) { node = ts.getRootDeclaration(node); - return node.kind === 211 ? node.parent.parent.parent : node.parent; + while (node) { + switch (node.kind) { + case 218: + case 219: + case 234: + case 233: + case 232: + case 231: + node = node.parent; + break; + default: + return node.parent; + } + } } function getTypeOfPrototypeProperty(prototype) { - var classType = getDeclaredTypeOfSymbol(prototype.parent); + var classType = getDeclaredTypeOfSymbol(getParentOfSymbol(prototype)); return classType.typeParameters ? createTypeReference(classType, ts.map(classType.typeParameters, function (_) { return anyType; })) : classType; } function getTypeOfPropertyOfType(type, name) { @@ -12778,7 +14489,7 @@ var ts; case 9: case 8: return name.text; - case 136: + case 140: if (ts.isStringOrNumericLiteral(name.expression.kind)) { return name.expression.text; } @@ -12786,7 +14497,7 @@ var ts; return undefined; } function isComputedNonLiteralName(name) { - return name.kind === 136 && !ts.isStringOrNumericLiteral(name.expression.kind); + return name.kind === 140 && !ts.isStringOrNumericLiteral(name.expression.kind); } function getTypeForBindingElement(declaration) { var pattern = declaration.parent; @@ -12801,11 +14512,14 @@ var ts; return parentType; } var type; - if (pattern.kind === 161) { + if (pattern.kind === 167) { var name_10 = declaration.propertyName || declaration.name; if (isComputedNonLiteralName(name_10)) { return anyType; } + if (declaration.initializer) { + getContextualType(declaration.initializer); + } var text = getTextOfPropertyName(name_10); type = getTypeOfPropertyOfType(parentType, text) || isNumericLiteralName(text) && getIndexTypeOfType(parentType, 1) || @@ -12836,38 +14550,84 @@ var ts; type = createArrayType(elementType); } } + if (strictNullChecks && declaration.initializer && !(getNullableKind(checkExpressionCached(declaration.initializer)) & 32)) { + type = getTypeWithFacts(type, 131072); + } return type; } - function getTypeForVariableLikeDeclaration(declaration) { - if (declaration.parent.parent.kind === 200) { - return anyType; + function getTypeForVariableLikeDeclarationFromJSDocComment(declaration) { + var jsDocType = getJSDocTypeForVariableLikeDeclarationFromJSDocComment(declaration); + if (jsDocType) { + return getTypeFromTypeNode(jsDocType); } - if (declaration.parent.parent.kind === 201) { + } + function getJSDocTypeForVariableLikeDeclarationFromJSDocComment(declaration) { + var typeTag = ts.getJSDocTypeTag(declaration); + if (typeTag && typeTag.typeExpression) { + return typeTag.typeExpression.type; + } + if (declaration.kind === 218 && + declaration.parent.kind === 219 && + declaration.parent.parent.kind === 200) { + var annotation = ts.getJSDocTypeTag(declaration.parent.parent); + if (annotation && annotation.typeExpression) { + return annotation.typeExpression.type; + } + } + else if (declaration.kind === 142) { + var paramTag = ts.getCorrespondingJSDocParameterTag(declaration); + if (paramTag && paramTag.typeExpression) { + return paramTag.typeExpression.type; + } + } + return undefined; + } + function addOptionality(type, optional) { + return strictNullChecks && optional ? addNullableKind(type, 32) : type; + } + function getTypeForVariableLikeDeclaration(declaration) { + if (declaration.flags & 134217728) { + var type = getTypeForVariableLikeDeclarationFromJSDocComment(declaration); + if (type && type !== unknownType) { + return type; + } + } + if (declaration.parent.parent.kind === 207) { + return stringType; + } + if (declaration.parent.parent.kind === 208) { return checkRightHandSideOfForOf(declaration.parent.parent.expression) || anyType; } if (ts.isBindingPattern(declaration.parent)) { return getTypeForBindingElement(declaration); } if (declaration.type) { - return getTypeFromTypeNode(declaration.type); + return addOptionality(getTypeFromTypeNode(declaration.type), !!declaration.questionToken); } - if (declaration.kind === 138) { + if (declaration.kind === 142) { var func = declaration.parent; - if (func.kind === 146 && !ts.hasDynamicName(func)) { - var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 145); + if (func.kind === 150 && !ts.hasDynamicName(func)) { + var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 149); if (getter) { - return getReturnTypeOfSignature(getSignatureFromDeclaration(getter)); + var signature = getSignatureFromDeclaration(getter); + var thisParameter = getAccessorThisParameter(func); + if (thisParameter && declaration === thisParameter) { + return signature.thisType; + } + return getReturnTypeOfSignature(signature); } } - var type = getContextuallyTypedParameterType(declaration); + var type = declaration.symbol.name === "this" + ? getContextuallyTypedThisType(func) + : getContextuallyTypedParameterType(declaration); if (type) { - return type; + return addOptionality(type, !!declaration.questionToken); } } if (declaration.initializer) { - return checkExpressionCached(declaration.initializer); + return addOptionality(checkExpressionCached(declaration.initializer), !!declaration.questionToken); } - if (declaration.kind === 246) { + if (declaration.kind === 254) { return checkIdentifier(declaration.name); } if (ts.isBindingPattern(declaration.name)) { @@ -12877,11 +14637,16 @@ var ts; } function getTypeFromBindingElement(element, includePatternInType) { if (element.initializer) { - return getWidenedType(checkExpressionCached(element.initializer)); + var type = checkExpressionCached(element.initializer); + reportErrorsFromWidening(element, type); + return getWidenedType(type); } if (ts.isBindingPattern(element.name)) { return getTypeFromBindingPattern(element.name, includePatternInType); } + if (compilerOptions.noImplicitAny && !declarationBelongsToPrivateAmbientMember(element)) { + reportImplicitAnyError(element, anyType); + } return anyType; } function getTypeFromObjectBindingPattern(pattern, includePatternInType) { @@ -12914,7 +14679,7 @@ var ts; if (elements.length === 0 || elements[elements.length - 1].dotDotDotToken) { return languageVersion >= 2 ? createIterableType(anyType) : anyArrayType; } - var elementTypes = ts.map(elements, function (e) { return e.kind === 187 ? anyType : getTypeFromBindingElement(e, includePatternInType); }); + var elementTypes = ts.map(elements, function (e) { return e.kind === 193 ? anyType : getTypeFromBindingElement(e, includePatternInType); }); if (includePatternInType) { var result = createNewTupleType(elementTypes); result.pattern = pattern; @@ -12923,7 +14688,7 @@ var ts; return createTupleType(elementTypes); } function getTypeFromBindingPattern(pattern, includePatternInType) { - return pattern.kind === 161 + return pattern.kind === 167 ? getTypeFromObjectBindingPattern(pattern, includePatternInType) : getTypeFromArrayBindingPattern(pattern, includePatternInType); } @@ -12933,17 +14698,24 @@ var ts; if (reportErrors) { reportErrorsFromWidening(declaration, type); } - return declaration.kind !== 245 ? getWidenedType(type) : type; + if (declaration.kind === 253) { + return type; + } + return getWidenedType(type); } type = declaration.dotDotDotToken ? anyArrayType : anyType; if (reportErrors && compilerOptions.noImplicitAny) { - var root = ts.getRootDeclaration(declaration); - if (!isPrivateWithinAmbient(root) && !(root.kind === 138 && isPrivateWithinAmbient(root.parent))) { + if (!declarationBelongsToPrivateAmbientMember(declaration)) { reportImplicitAnyError(declaration, type); } } return type; } + function declarationBelongsToPrivateAmbientMember(declaration) { + var root = ts.getRootDeclaration(declaration); + var memberDeclaration = root.kind === 142 ? root.parent : root; + return isPrivateWithinAmbient(memberDeclaration); + } function getTypeOfVariableOrParameterOrProperty(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { @@ -12951,17 +14723,19 @@ var ts; return links.type = getTypeOfPrototypeProperty(symbol); } var declaration = symbol.valueDeclaration; - if (declaration.parent.kind === 244) { + if (declaration.parent.kind === 252) { return links.type = anyType; } - if (declaration.kind === 227) { + if (declaration.kind === 235) { return links.type = checkExpression(declaration.expression); } - if (declaration.kind === 181) { - return links.type = checkExpression(declaration.right); + if (declaration.kind === 187) { + return links.type = getUnionType(ts.map(symbol.declarations, function (decl) { return checkExpressionCached(decl.right); })); } - if (declaration.kind === 166) { - return checkExpressionCached(declaration.parent.right); + if (declaration.kind === 172) { + if (declaration.parent.kind === 187) { + return links.type = checkExpressionCached(declaration.parent.right); + } } if (!pushTypeResolution(symbol, 0)) { return unknownType; @@ -12985,7 +14759,7 @@ var ts; } function getAnnotatedAccessorType(accessor) { if (accessor) { - if (accessor.kind === 145) { + if (accessor.kind === 149) { return accessor.type && getTypeFromTypeNode(accessor.type); } else { @@ -12995,15 +14769,30 @@ var ts; } return undefined; } + function getAnnotatedAccessorThisType(accessor) { + if (accessor) { + var parameter = getAccessorThisParameter(accessor); + if (parameter && parameter.type) { + return getTypeFromTypeNode(accessor.parameters[0].type); + } + } + return undefined; + } function getTypeOfAccessors(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { + var getter = ts.getDeclarationOfKind(symbol, 149); + var setter = ts.getDeclarationOfKind(symbol, 150); + if (getter && getter.flags & 134217728) { + var jsDocType = getTypeForVariableLikeDeclarationFromJSDocComment(getter); + if (jsDocType) { + return links.type = jsDocType; + } + } if (!pushTypeResolution(symbol, 0)) { return unknownType; } - var getter = ts.getDeclarationOfKind(symbol, 145); - var setter = ts.getDeclarationOfKind(symbol, 146); - var type; + var type = void 0; var getterReturnType = getAnnotatedAccessorType(getter); if (getterReturnType) { type = getterReturnType; @@ -13028,7 +14817,7 @@ var ts; if (!popTypeResolution()) { type = anyType; if (compilerOptions.noImplicitAny) { - var getter_1 = ts.getDeclarationOfKind(symbol, 145); + var getter_1 = ts.getDeclarationOfKind(symbol, 149); error(getter_1, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol)); } } @@ -13039,7 +14828,9 @@ var ts; function getTypeOfFuncClassEnumModule(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { - links.type = createObjectType(65536, symbol); + var type = createObjectType(65536, symbol); + links.type = strictNullChecks && symbol.flags & 536870912 ? + addNullableKind(type, 32) : type; } return links.type; } @@ -13117,9 +14908,9 @@ var ts; if (!node) { return typeParameters; } - if (node.kind === 214 || node.kind === 186 || - node.kind === 213 || node.kind === 173 || - node.kind === 143 || node.kind === 174) { + if (node.kind === 221 || node.kind === 192 || + node.kind === 220 || node.kind === 179 || + node.kind === 147 || node.kind === 180) { var declarations = node.typeParameters; if (declarations) { return appendTypeParameters(appendOuterTypeParameters(typeParameters, node), declarations); @@ -13128,15 +14919,15 @@ var ts; } } function getOuterTypeParametersOfClassOrInterface(symbol) { - var declaration = symbol.flags & 32 ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 215); + var declaration = symbol.flags & 32 ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 222); return appendOuterTypeParameters(undefined, declaration); } function getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol) { var result; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var node = _a[_i]; - if (node.kind === 215 || node.kind === 214 || - node.kind === 186 || node.kind === 216) { + if (node.kind === 222 || node.kind === 221 || + node.kind === 192 || node.kind === 223) { var declaration = node; if (declaration.typeParameters) { result = appendTypeParameters(result, declaration.typeParameters); @@ -13161,8 +14952,8 @@ var ts; function getInstantiatedConstructorsForTypeArguments(type, typeArgumentNodes) { var signatures = getConstructorsForTypeArguments(type, typeArgumentNodes); if (typeArgumentNodes) { - var typeArguments = ts.map(typeArgumentNodes, getTypeFromTypeNode); - signatures = ts.map(signatures, function (sig) { return getSignatureInstantiation(sig, typeArguments); }); + var typeArguments_1 = ts.map(typeArgumentNodes, getTypeFromTypeNode); + signatures = ts.map(signatures, function (sig) { return getSignatureInstantiation(sig, typeArguments_1); }); } return signatures; } @@ -13191,9 +14982,6 @@ var ts; } return type.resolvedBaseConstructorType; } - function hasClassBaseType(type) { - return !!ts.forEach(getBaseTypes(type), function (t) { return !!(t.symbol.flags & 32); }); - } function getBaseTypes(type) { var isClass = type.symbol.flags & 32; var isInterface = type.symbol.flags & 64; @@ -13262,7 +15050,7 @@ var ts; type.resolvedBaseTypes = type.resolvedBaseTypes || emptyArray; for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 215 && ts.getInterfaceBaseTypeNodes(declaration)) { + if (declaration.kind === 222 && ts.getInterfaceBaseTypeNodes(declaration)) { for (var _b = 0, _c = ts.getInterfaceBaseTypeNodes(declaration); _b < _c.length; _b++) { var node = _c[_b]; var baseType = getTypeFromTypeNode(node); @@ -13291,8 +15079,8 @@ var ts; function isIndependentInterface(symbol) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 215) { - if (declaration.flags & 262144) { + if (declaration.kind === 222) { + if (declaration.flags & 16384) { return false; } var baseTypeNodes = ts.getInterfaceBaseTypeNodes(declaration); @@ -13340,7 +15128,7 @@ var ts; if (!pushTypeResolution(symbol, 2)) { return unknownType; } - var declaration = ts.getDeclarationOfKind(symbol, 216); + var declaration = ts.getDeclarationOfKind(symbol, 223); var type = getTypeFromTypeNode(declaration.type); if (popTypeResolution()) { links.typeParameters = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol); @@ -13371,7 +15159,7 @@ var ts; if (!links.declaredType) { var type = createType(512); type.symbol = symbol; - if (!ts.getDeclarationOfKind(symbol, 137).constraint) { + if (!ts.getDeclarationOfKind(symbol, 141).constraint) { type.constraint = noConstraintType; } links.declaredType = type; @@ -13418,16 +15206,19 @@ var ts; function isIndependentType(node) { switch (node.kind) { case 117: + case 132: case 130: - case 128: case 120: - case 131: + case 133: case 103: - case 9: + case 135: + case 93: + case 127: + case 166: return true; - case 156: + case 160: return isIndependentType(node.elementType); - case 151: + case 155: return isIndependentTypeReference(node); } return false; @@ -13436,7 +15227,7 @@ var ts; return node.type && isIndependentType(node.type) || !node.type && !node.initializer; } function isIndependentFunctionLikeDeclaration(node) { - if (node.kind !== 144 && (!node.type || !isIndependentType(node.type))) { + if (node.kind !== 148 && (!node.type || !isIndependentType(node.type))) { return false; } for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) { @@ -13452,12 +15243,12 @@ var ts; var declaration = symbol.declarations[0]; if (declaration) { switch (declaration.kind) { - case 141: - case 140: - return isIndependentVariableLikeDeclaration(declaration); - case 143: - case 142: + case 145: case 144: + return isIndependentVariableLikeDeclaration(declaration); + case 147: + case 146: + case 148: return isIndependentFunctionLikeDeclaration(declaration); } } @@ -13488,22 +15279,14 @@ var ts; } } } - function addInheritedSignatures(signatures, baseSignatures) { - if (baseSignatures) { - for (var _i = 0, baseSignatures_1 = baseSignatures; _i < baseSignatures_1.length; _i++) { - var signature = baseSignatures_1[_i]; - signatures.push(signature); - } - } - } function resolveDeclaredMembers(type) { if (!type.declaredProperties) { var symbol = type.symbol; type.declaredProperties = getNamedMembers(symbol.members); type.declaredCallSignatures = getSignaturesOfSymbol(symbol.members["__call"]); type.declaredConstructSignatures = getSignaturesOfSymbol(symbol.members["__new"]); - type.declaredStringIndexType = getIndexTypeOfSymbol(symbol, 0); - type.declaredNumberIndexType = getIndexTypeOfSymbol(symbol, 1); + type.declaredStringIndexInfo = getIndexInfoOfSymbol(symbol, 0); + type.declaredNumberIndexInfo = getIndexInfoOfSymbol(symbol, 1); } return type; } @@ -13518,15 +15301,15 @@ var ts; var members = source.symbol.members; var callSignatures = source.declaredCallSignatures; var constructSignatures = source.declaredConstructSignatures; - var stringIndexType = source.declaredStringIndexType; - var numberIndexType = source.declaredNumberIndexType; + var stringIndexInfo = source.declaredStringIndexInfo; + var numberIndexInfo = source.declaredNumberIndexInfo; if (!ts.rangeEquals(typeParameters, typeArguments, 0, typeParameters.length)) { mapper = createTypeMapper(typeParameters, typeArguments); members = createInstantiatedSymbolTable(source.declaredProperties, mapper, typeParameters.length === 1); callSignatures = instantiateList(source.declaredCallSignatures, mapper, instantiateSignature); constructSignatures = instantiateList(source.declaredConstructSignatures, mapper, instantiateSignature); - stringIndexType = instantiateType(source.declaredStringIndexType, mapper); - numberIndexType = instantiateType(source.declaredNumberIndexType, mapper); + stringIndexInfo = instantiateIndexInfo(source.declaredStringIndexInfo, mapper); + numberIndexInfo = instantiateIndexInfo(source.declaredNumberIndexInfo, mapper); } var baseTypes = getBaseTypes(source); if (baseTypes.length) { @@ -13540,11 +15323,11 @@ var ts; addInheritedMembers(members, getPropertiesOfObjectType(instantiatedBaseType)); callSignatures = ts.concatenate(callSignatures, getSignaturesOfType(instantiatedBaseType, 0)); constructSignatures = ts.concatenate(constructSignatures, getSignaturesOfType(instantiatedBaseType, 1)); - stringIndexType = stringIndexType || getIndexTypeOfType(instantiatedBaseType, 0); - numberIndexType = numberIndexType || getIndexTypeOfType(instantiatedBaseType, 1); + stringIndexInfo = stringIndexInfo || getIndexInfoOfType(instantiatedBaseType, 0); + numberIndexInfo = numberIndexInfo || getIndexInfoOfType(instantiatedBaseType, 1); } } - setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexType, numberIndexType); + setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo); } function resolveClassOrInterfaceMembers(type) { resolveObjectTypeMembers(type, resolveDeclaredMembers(type), emptyArray, emptyArray); @@ -13556,11 +15339,12 @@ var ts; type.typeArguments : ts.concatenate(type.typeArguments, [type]); resolveObjectTypeMembers(type, source, typeParameters, typeArguments); } - function createSignature(declaration, typeParameters, parameters, resolvedReturnType, typePredicate, minArgumentCount, hasRestParameter, hasStringLiterals) { + function createSignature(declaration, typeParameters, thisType, parameters, resolvedReturnType, typePredicate, minArgumentCount, hasRestParameter, hasStringLiterals) { var sig = new Signature(checker); sig.declaration = declaration; sig.typeParameters = typeParameters; sig.parameters = parameters; + sig.thisType = thisType; sig.resolvedReturnType = resolvedReturnType; sig.typePredicate = typePredicate; sig.minArgumentCount = minArgumentCount; @@ -13569,20 +15353,20 @@ var ts; return sig; } function cloneSignature(sig) { - return createSignature(sig.declaration, sig.typeParameters, sig.parameters, sig.resolvedReturnType, sig.typePredicate, sig.minArgumentCount, sig.hasRestParameter, sig.hasStringLiterals); + return createSignature(sig.declaration, sig.typeParameters, sig.thisType, sig.parameters, sig.resolvedReturnType, sig.typePredicate, sig.minArgumentCount, sig.hasRestParameter, sig.hasStringLiterals); } function getDefaultConstructSignatures(classType) { - if (!hasClassBaseType(classType)) { - return [createSignature(undefined, classType.localTypeParameters, emptyArray, classType, undefined, 0, false, false)]; - } var baseConstructorType = getBaseConstructorTypeOfClass(classType); var baseSignatures = getSignaturesOfType(baseConstructorType, 1); + if (baseSignatures.length === 0) { + return [createSignature(undefined, classType.localTypeParameters, undefined, emptyArray, classType, undefined, 0, false, false)]; + } var baseTypeNode = getBaseTypeNodeOfClass(classType); var typeArguments = ts.map(baseTypeNode.typeArguments, getTypeFromTypeNode); var typeArgCount = typeArguments ? typeArguments.length : 0; var result = []; - for (var _i = 0, baseSignatures_2 = baseSignatures; _i < baseSignatures_2.length; _i++) { - var baseSig = baseSignatures_2[_i]; + for (var _i = 0, baseSignatures_1 = baseSignatures; _i < baseSignatures_1.length; _i++) { + var baseSig = baseSignatures_1[_i]; var typeParamCount = baseSig.typeParameters ? baseSig.typeParameters.length : 0; if (typeParamCount === typeArgCount) { var sig = typeParamCount ? getSignatureInstantiation(baseSig, typeArguments) : cloneSignature(baseSig); @@ -13607,12 +15391,12 @@ var ts; var arrayType = resolveStructuredTypeMembers(createTypeFromGenericGlobalType(globalArrayType, [arrayElementType, type])); var members = createTupleTypeMemberSymbols(type.elementTypes); addInheritedMembers(members, arrayType.properties); - setObjectTypeMembers(type, members, arrayType.callSignatures, arrayType.constructSignatures, arrayType.stringIndexType, arrayType.numberIndexType); + setObjectTypeMembers(type, members, arrayType.callSignatures, arrayType.constructSignatures, arrayType.stringIndexInfo, arrayType.numberIndexInfo); } - function findMatchingSignature(signatureList, signature, partialMatch, ignoreReturnTypes) { + function findMatchingSignature(signatureList, signature, partialMatch, ignoreThisTypes, ignoreReturnTypes) { for (var _i = 0, signatureList_1 = signatureList; _i < signatureList_1.length; _i++) { var s = signatureList_1[_i]; - if (compareSignatures(s, signature, partialMatch, ignoreReturnTypes, compareTypes)) { + if (compareSignaturesIdentical(s, signature, partialMatch, ignoreThisTypes, ignoreReturnTypes, compareTypesIdentical)) { return s; } } @@ -13623,7 +15407,7 @@ var ts; return undefined; } for (var i = 1; i < signatureLists.length; i++) { - if (!findMatchingSignature(signatureLists[i], signature, false, false)) { + if (!findMatchingSignature(signatureLists[i], signature, false, false, false)) { return undefined; } } @@ -13631,7 +15415,7 @@ var ts; } var result = undefined; for (var i = 0; i < signatureLists.length; i++) { - var match = i === listIndex ? signature : findMatchingSignature(signatureLists[i], signature, true, true); + var match = i === listIndex ? signature : findMatchingSignature(signatureLists[i], signature, true, true, true); if (!match) { return undefined; } @@ -13647,12 +15431,15 @@ var ts; for (var i = 0; i < signatureLists.length; i++) { for (var _i = 0, _a = signatureLists[i]; _i < _a.length; _i++) { var signature = _a[_i]; - if (!result || !findMatchingSignature(result, signature, false, true)) { + if (!result || !findMatchingSignature(result, signature, false, true, true)) { var unionSignatures = findMatchingSignatures(signatureLists, signature, i); if (unionSignatures) { var s = signature; if (unionSignatures.length > 1) { s = cloneSignature(signature); + if (ts.forEach(unionSignatures, function (sig) { return sig.thisType; })) { + s.thisType = getUnionType(ts.map(unionSignatures, function (sig) { return sig.thisType || anyType; })); + } s.resolvedReturnType = undefined; s.unionSignatures = unionSignatures; } @@ -13663,73 +15450,71 @@ var ts; } return result || emptyArray; } - function getUnionIndexType(types, kind) { + function getUnionIndexInfo(types, kind) { var indexTypes = []; + var isAnyReadonly = false; for (var _i = 0, types_1 = types; _i < types_1.length; _i++) { var type = types_1[_i]; - var indexType = getIndexTypeOfType(type, kind); - if (!indexType) { + var indexInfo = getIndexInfoOfType(type, kind); + if (!indexInfo) { return undefined; } - indexTypes.push(indexType); + indexTypes.push(indexInfo.type); + isAnyReadonly = isAnyReadonly || indexInfo.isReadonly; } - return getUnionType(indexTypes); + return createIndexInfo(getUnionType(indexTypes), isAnyReadonly); } function resolveUnionTypeMembers(type) { var callSignatures = getUnionSignatures(type.types, 0); var constructSignatures = getUnionSignatures(type.types, 1); - var stringIndexType = getUnionIndexType(type.types, 0); - var numberIndexType = getUnionIndexType(type.types, 1); - setObjectTypeMembers(type, emptySymbols, callSignatures, constructSignatures, stringIndexType, numberIndexType); + var stringIndexInfo = getUnionIndexInfo(type.types, 0); + var numberIndexInfo = getUnionIndexInfo(type.types, 1); + setObjectTypeMembers(type, emptySymbols, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo); } function intersectTypes(type1, type2) { return !type1 ? type2 : !type2 ? type1 : getIntersectionType([type1, type2]); } + function intersectIndexInfos(info1, info2) { + return !info1 ? info2 : !info2 ? info1 : createIndexInfo(getIntersectionType([info1.type, info2.type]), info1.isReadonly && info2.isReadonly); + } function resolveIntersectionTypeMembers(type) { var callSignatures = emptyArray; var constructSignatures = emptyArray; - var stringIndexType = undefined; - var numberIndexType = undefined; + var stringIndexInfo = undefined; + var numberIndexInfo = undefined; for (var _i = 0, _a = type.types; _i < _a.length; _i++) { var t = _a[_i]; callSignatures = ts.concatenate(callSignatures, getSignaturesOfType(t, 0)); constructSignatures = ts.concatenate(constructSignatures, getSignaturesOfType(t, 1)); - stringIndexType = intersectTypes(stringIndexType, getIndexTypeOfType(t, 0)); - numberIndexType = intersectTypes(numberIndexType, getIndexTypeOfType(t, 1)); + stringIndexInfo = intersectIndexInfos(stringIndexInfo, getIndexInfoOfType(t, 0)); + numberIndexInfo = intersectIndexInfos(numberIndexInfo, getIndexInfoOfType(t, 1)); } - setObjectTypeMembers(type, emptySymbols, callSignatures, constructSignatures, stringIndexType, numberIndexType); + setObjectTypeMembers(type, emptySymbols, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo); } function resolveAnonymousTypeMembers(type) { var symbol = type.symbol; - var members; - var callSignatures; - var constructSignatures; - var stringIndexType; - var numberIndexType; if (type.target) { - members = createInstantiatedSymbolTable(getPropertiesOfObjectType(type.target), type.mapper, false); - callSignatures = instantiateList(getSignaturesOfType(type.target, 0), type.mapper, instantiateSignature); - constructSignatures = instantiateList(getSignaturesOfType(type.target, 1), type.mapper, instantiateSignature); - stringIndexType = instantiateType(getIndexTypeOfType(type.target, 0), type.mapper); - numberIndexType = instantiateType(getIndexTypeOfType(type.target, 1), type.mapper); + var members = createInstantiatedSymbolTable(getPropertiesOfObjectType(type.target), type.mapper, false); + var callSignatures = instantiateList(getSignaturesOfType(type.target, 0), type.mapper, instantiateSignature); + var constructSignatures = instantiateList(getSignaturesOfType(type.target, 1), type.mapper, instantiateSignature); + var stringIndexInfo = instantiateIndexInfo(getIndexInfoOfType(type.target, 0), type.mapper); + var numberIndexInfo = instantiateIndexInfo(getIndexInfoOfType(type.target, 1), type.mapper); + setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo); } else if (symbol.flags & 2048) { - members = symbol.members; - callSignatures = getSignaturesOfSymbol(members["__call"]); - constructSignatures = getSignaturesOfSymbol(members["__new"]); - stringIndexType = getIndexTypeOfSymbol(symbol, 0); - numberIndexType = getIndexTypeOfSymbol(symbol, 1); + var members = symbol.members; + var callSignatures = getSignaturesOfSymbol(members["__call"]); + var constructSignatures = getSignaturesOfSymbol(members["__new"]); + var stringIndexInfo = getIndexInfoOfSymbol(symbol, 0); + var numberIndexInfo = getIndexInfoOfSymbol(symbol, 1); + setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo); } else { - members = emptySymbols; - callSignatures = emptyArray; - constructSignatures = emptyArray; + var members = emptySymbols; + var constructSignatures = emptyArray; if (symbol.flags & 1952) { members = getExportsOfSymbol(symbol); } - if (symbol.flags & (16 | 8192)) { - callSignatures = getSignaturesOfSymbol(symbol); - } if (symbol.flags & 32) { var classType = getDeclaredTypeOfClassOrInterface(symbol); constructSignatures = getSignaturesOfSymbol(symbol.members["__constructor"]); @@ -13742,10 +15527,12 @@ var ts; addInheritedMembers(members, getPropertiesOfObjectType(baseConstructorType)); } } - stringIndexType = undefined; - numberIndexType = (symbol.flags & 384) ? stringType : undefined; + var numberIndexInfo = symbol.flags & 384 ? enumNumberIndexInfo : undefined; + setObjectTypeMembers(type, members, emptyArray, constructSignatures, undefined, numberIndexInfo); + if (symbol.flags & (16 | 8192)) { + type.callSignatures = getSignaturesOfSymbol(symbol); + } } - setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexType, numberIndexType); } function resolveStructuredTypeMembers(type) { if (!type.members) { @@ -13828,19 +15615,21 @@ var ts; type = globalBooleanType; } else if (type.flags & 16777216) { - type = globalESSymbolType; + type = getGlobalESSymbolType(); } return type; } function createUnionOrIntersectionProperty(containingType, name) { var types = containingType.types; var props; + var commonFlags = (containingType.flags & 32768) ? 536870912 : 0; for (var _i = 0, types_2 = types; _i < types_2.length; _i++) { var current = types_2[_i]; var type = getApparentType(current); if (type !== unknownType) { var prop = getPropertyOfType(type, name); - if (prop && !(getDeclarationFlagsFromSymbol(prop) & (16 | 32))) { + if (prop && !(getDeclarationFlagsFromSymbol(prop) & (8 | 16))) { + commonFlags &= prop.flags; if (!props) { props = [prop]; } @@ -13868,7 +15657,10 @@ var ts; } propTypes.push(getTypeOfSymbol(prop)); } - var result = createSymbol(4 | 67108864 | 268435456, name); + var result = createSymbol(4 | + 67108864 | + 268435456 | + commonFlags, name); result.containingType = containingType; result.declarations = declarations; result.type = containingType.flags & 16384 ? getUnionType(propTypes) : getIntersectionType(propTypes); @@ -13918,31 +15710,46 @@ var ts; function getSignaturesOfType(type, kind) { return getSignaturesOfStructuredType(getApparentType(type), kind); } - function typeHasConstructSignatures(type) { - var apparentType = getApparentType(type); - if (apparentType.flags & (80896 | 16384)) { - var resolved = resolveStructuredTypeMembers(type); - return resolved.constructSignatures.length > 0; - } - return false; - } - function typeHasCallOrConstructSignatures(type) { - var apparentType = getApparentType(type); - if (apparentType.flags & 130048) { - var resolved = resolveStructuredTypeMembers(type); - return resolved.callSignatures.length > 0 || resolved.constructSignatures.length > 0; - } - return false; - } - function getIndexTypeOfStructuredType(type, kind) { + function getIndexInfoOfStructuredType(type, kind) { if (type.flags & 130048) { var resolved = resolveStructuredTypeMembers(type); - return kind === 0 ? resolved.stringIndexType : resolved.numberIndexType; + return kind === 0 ? resolved.stringIndexInfo : resolved.numberIndexInfo; } } + function getIndexTypeOfStructuredType(type, kind) { + var info = getIndexInfoOfStructuredType(type, kind); + return info && info.type; + } + function getIndexInfoOfType(type, kind) { + return getIndexInfoOfStructuredType(getApparentType(type), kind); + } function getIndexTypeOfType(type, kind) { return getIndexTypeOfStructuredType(getApparentType(type), kind); } + function getImplicitIndexTypeOfType(type, kind) { + if (isObjectLiteralType(type)) { + var propTypes = []; + for (var _i = 0, _a = getPropertiesOfType(type); _i < _a.length; _i++) { + var prop = _a[_i]; + if (kind === 0 || isNumericLiteralName(prop.name)) { + propTypes.push(getTypeOfSymbol(prop)); + } + } + if (propTypes.length) { + return getUnionType(propTypes); + } + } + return undefined; + } + function getTypeParametersFromJSDocTemplate(declaration) { + if (declaration.flags & 134217728) { + var templateTag = ts.getJSDocTemplateTag(declaration); + if (templateTag) { + return getTypeParametersFromDeclaration(templateTag.typeParameters); + } + } + return undefined; + } function getTypeParametersFromDeclaration(typeParameterDeclarations) { var result = []; ts.forEach(typeParameterDeclarations, function (node) { @@ -13963,6 +15770,20 @@ var ts; return result; } function isOptionalParameter(node) { + if (node.flags & 134217728) { + if (node.type && node.type.kind === 268) { + return true; + } + var paramTag = ts.getCorrespondingJSDocParameterTag(node); + if (paramTag) { + if (paramTag.isBracketed) { + return true; + } + if (paramTag.typeExpression) { + return paramTag.typeExpression.type.kind === 268; + } + } + } if (ts.hasQuestionToken(node)) { return true; } @@ -13975,64 +15796,109 @@ var ts; } return false; } + function createTypePredicateFromTypePredicateNode(node) { + if (node.parameterName.kind === 69) { + var parameterName = node.parameterName; + return { + kind: 1, + parameterName: parameterName ? parameterName.text : undefined, + parameterIndex: parameterName ? getTypePredicateParameterIndex(node.parent.parameters, parameterName) : undefined, + type: getTypeFromTypeNode(node.type) + }; + } + else { + return { + kind: 0, + type: getTypeFromTypeNode(node.type) + }; + } + } function getSignatureFromDeclaration(declaration) { var links = getNodeLinks(declaration); if (!links.resolvedSignature) { - var classType = declaration.kind === 144 ? - getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol)) - : undefined; - var typeParameters = classType ? classType.localTypeParameters : - declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : undefined; var parameters = []; var hasStringLiterals = false; var minArgumentCount = -1; - for (var i = 0, n = declaration.parameters.length; i < n; i++) { + var thisType = undefined; + var hasThisParameter = void 0; + var isJSConstructSignature = ts.isJSDocConstructSignature(declaration); + for (var i = isJSConstructSignature ? 1 : 0, n = declaration.parameters.length; i < n; i++) { var param = declaration.parameters[i]; - parameters.push(param.symbol); - if (param.type && param.type.kind === 9) { + var paramSymbol = param.symbol; + if (paramSymbol && !!(paramSymbol.flags & 4) && !ts.isBindingPattern(param.name)) { + var resolvedSymbol = resolveName(param, paramSymbol.name, 107455, undefined, undefined); + paramSymbol = resolvedSymbol; + } + if (i === 0 && paramSymbol.name === "this") { + hasThisParameter = true; + thisType = param.type ? getTypeFromTypeNode(param.type) : unknownType; + } + else { + parameters.push(paramSymbol); + } + if (param.type && param.type.kind === 166) { hasStringLiterals = true; } if (param.initializer || param.questionToken || param.dotDotDotToken) { if (minArgumentCount < 0) { - minArgumentCount = i; + minArgumentCount = i - (hasThisParameter ? 1 : 0); } } else { minArgumentCount = -1; } } + if ((declaration.kind === 149 || declaration.kind === 150) && + !ts.hasDynamicName(declaration) && + (!hasThisParameter || thisType === unknownType)) { + var otherKind = declaration.kind === 149 ? 150 : 149; + var setter = ts.getDeclarationOfKind(declaration.symbol, otherKind); + thisType = getAnnotatedAccessorThisType(setter); + } if (minArgumentCount < 0) { - minArgumentCount = declaration.parameters.length; + minArgumentCount = declaration.parameters.length - (hasThisParameter ? 1 : 0); } - var returnType; - var typePredicate; - if (classType) { - returnType = classType; + if (isJSConstructSignature) { + minArgumentCount--; } - else if (declaration.type) { - returnType = getTypeFromTypeNode(declaration.type); - if (declaration.type.kind === 150) { - var typePredicateNode = declaration.type; - typePredicate = { - parameterName: typePredicateNode.parameterName ? typePredicateNode.parameterName.text : undefined, - parameterIndex: typePredicateNode.parameterName ? getTypePredicateParameterIndex(declaration.parameters, typePredicateNode.parameterName) : undefined, - type: getTypeFromTypeNode(typePredicateNode.type) - }; - } - } - else { - if (declaration.kind === 145 && !ts.hasDynamicName(declaration)) { - var setter = ts.getDeclarationOfKind(declaration.symbol, 146); - returnType = getAnnotatedAccessorType(setter); - } - if (!returnType && ts.nodeIsMissing(declaration.body)) { - returnType = anyType; - } - } - links.resolvedSignature = createSignature(declaration, typeParameters, parameters, returnType, typePredicate, minArgumentCount, ts.hasRestParameter(declaration), hasStringLiterals); + var classType = declaration.kind === 148 ? + getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol)) + : undefined; + var typeParameters = classType ? classType.localTypeParameters : + declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : + getTypeParametersFromJSDocTemplate(declaration); + var returnType = getSignatureReturnTypeFromDeclaration(declaration, minArgumentCount, isJSConstructSignature, classType); + var typePredicate = declaration.type && declaration.type.kind === 154 ? + createTypePredicateFromTypePredicateNode(declaration.type) : + undefined; + links.resolvedSignature = createSignature(declaration, typeParameters, thisType, parameters, returnType, typePredicate, minArgumentCount, ts.hasRestParameter(declaration), hasStringLiterals); } return links.resolvedSignature; } + function getSignatureReturnTypeFromDeclaration(declaration, minArgumentCount, isJSConstructSignature, classType) { + if (isJSConstructSignature) { + return getTypeFromTypeNode(declaration.parameters[0].type); + } + else if (classType) { + return classType; + } + else if (declaration.type) { + return getTypeFromTypeNode(declaration.type); + } + if (declaration.flags & 134217728) { + var type = getReturnTypeFromJSDocComment(declaration); + if (type && type !== unknownType) { + return type; + } + } + if (declaration.kind === 149 && !ts.hasDynamicName(declaration)) { + var setter = ts.getDeclarationOfKind(declaration.symbol, 150); + return getAnnotatedAccessorType(setter); + } + if (ts.nodeIsMissing(declaration.body)) { + return anyType; + } + } function getSignaturesOfSymbol(symbol) { if (!symbol) return emptyArray; @@ -14040,19 +15906,20 @@ var ts; for (var i = 0, len = symbol.declarations.length; i < len; i++) { var node = symbol.declarations[i]; switch (node.kind) { + case 156: + case 157: + case 220: + case 147: + case 146: + case 148: + case 151: case 152: case 153: - case 213: - case 143: - case 142: - case 144: - case 147: - case 148: case 149: - case 145: - case 146: - case 173: - case 174: + case 150: + case 179: + case 180: + case 269: if (i > 0 && node.body) { var previous = symbol.declarations[i - 1]; if (node.parent === previous.parent && node.kind === previous.kind && node.pos === previous.end) { @@ -14079,7 +15946,7 @@ var ts; if (!pushTypeResolution(signature, 3)) { return unknownType; } - var type; + var type = void 0; if (signature.target) { type = instantiateType(getReturnTypeOfSignature(signature.target), signature.mapper); } @@ -14121,18 +15988,13 @@ var ts; if (!signature.typeParameters) return signature; if (!signature.erasedSignatureCache) { - if (signature.target) { - signature.erasedSignatureCache = instantiateSignature(getErasedSignature(signature.target), signature.mapper); - } - else { - signature.erasedSignatureCache = instantiateSignature(signature, createTypeEraser(signature.typeParameters), true); - } + signature.erasedSignatureCache = instantiateSignature(signature, createTypeEraser(signature.typeParameters), true); } return signature.erasedSignatureCache; } function getOrCreateTypeFromSignature(signature) { if (!signature.isolatedSignatureType) { - var isConstructor = signature.declaration.kind === 144 || signature.declaration.kind === 148; + var isConstructor = signature.declaration.kind === 148 || signature.declaration.kind === 152; var type = createObjectType(65536 | 262144); type.members = emptySymbols; type.properties = emptyArray; @@ -14146,7 +16008,7 @@ var ts; return symbol.members["__index"]; } function getIndexDeclarationOfSymbol(symbol, kind) { - var syntaxKind = kind === 1 ? 128 : 130; + var syntaxKind = kind === 1 ? 130 : 132; var indexSymbol = getIndexSymbol(symbol); if (indexSymbol) { for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { @@ -14162,26 +16024,51 @@ var ts; } return undefined; } - function getIndexTypeOfSymbol(symbol, kind) { - var declaration = getIndexDeclarationOfSymbol(symbol, kind); - return declaration - ? declaration.type ? getTypeFromTypeNode(declaration.type) : anyType - : undefined; + function createIndexInfo(type, isReadonly, declaration) { + return { type: type, isReadonly: isReadonly, declaration: declaration }; } - function getConstraintOfTypeParameter(type) { - if (!type.constraint) { - if (type.target) { - var targetConstraint = getConstraintOfTypeParameter(type.target); - type.constraint = targetConstraint ? instantiateType(targetConstraint, type.mapper) : noConstraintType; + function getIndexInfoOfSymbol(symbol, kind) { + var declaration = getIndexDeclarationOfSymbol(symbol, kind); + if (declaration) { + return createIndexInfo(declaration.type ? getTypeFromTypeNode(declaration.type) : anyType, (declaration.flags & 64) !== 0, declaration); + } + return undefined; + } + function getConstraintDeclaration(type) { + return ts.getDeclarationOfKind(type.symbol, 141).constraint; + } + function hasConstraintReferenceTo(type, target) { + var checked; + while (type && !(type.flags & 33554432) && type.flags & 512 && !ts.contains(checked, type)) { + if (type === target) { + return true; + } + (checked || (checked = [])).push(type); + var constraintDeclaration = getConstraintDeclaration(type); + type = constraintDeclaration && getTypeFromTypeNode(constraintDeclaration); + } + return false; + } + function getConstraintOfTypeParameter(typeParameter) { + if (!typeParameter.constraint) { + if (typeParameter.target) { + var targetConstraint = getConstraintOfTypeParameter(typeParameter.target); + typeParameter.constraint = targetConstraint ? instantiateType(targetConstraint, typeParameter.mapper) : noConstraintType; } else { - type.constraint = getTypeFromTypeNode(ts.getDeclarationOfKind(type.symbol, 137).constraint); + var constraintDeclaration = getConstraintDeclaration(typeParameter); + var constraint = getTypeFromTypeNode(constraintDeclaration); + if (hasConstraintReferenceTo(constraint, typeParameter)) { + error(constraintDeclaration, ts.Diagnostics.Type_parameter_0_has_a_circular_constraint, typeToString(typeParameter)); + constraint = unknownType; + } + typeParameter.constraint = constraint; } } - return type.constraint === noConstraintType ? undefined : type.constraint; + return typeParameter.constraint === noConstraintType ? undefined : typeParameter.constraint; } function getParentSymbolOfTypeParameter(typeParameter) { - return getSymbolOfNode(ts.getDeclarationOfKind(typeParameter.symbol, 137).parent); + return getSymbolOfNode(ts.getDeclarationOfKind(typeParameter.symbol, 141).parent); } function getTypeListId(types) { if (types) { @@ -14203,11 +16090,13 @@ var ts; } return ""; } - function getPropagatingFlagsOfTypes(types) { + function getPropagatingFlagsOfTypes(types, excludeKinds) { var result = 0; for (var _i = 0, types_3 = types; _i < types_3.length; _i++) { var type = types_3[_i]; - result |= type.flags; + if (!(type.flags & excludeKinds)) { + result |= type.flags; + } } return result & 14680064; } @@ -14215,49 +16104,16 @@ var ts; var id = getTypeListId(typeArguments); var type = target.instantiations[id]; if (!type) { - var flags = 4096 | (typeArguments ? getPropagatingFlagsOfTypes(typeArguments) : 0); + var propagatedFlags = typeArguments ? getPropagatingFlagsOfTypes(typeArguments, 0) : 0; + var flags = 4096 | propagatedFlags; type = target.instantiations[id] = createObjectType(flags, target.symbol); type.target = target; type.typeArguments = typeArguments; } return type; } - function isTypeParameterReferenceIllegalInConstraint(typeReferenceNode, typeParameterSymbol) { - var links = getNodeLinks(typeReferenceNode); - if (links.isIllegalTypeReferenceInConstraint !== undefined) { - return links.isIllegalTypeReferenceInConstraint; - } - var currentNode = typeReferenceNode; - while (!ts.forEach(typeParameterSymbol.declarations, function (d) { return d.parent === currentNode.parent; })) { - currentNode = currentNode.parent; - } - links.isIllegalTypeReferenceInConstraint = currentNode.kind === 137; - return links.isIllegalTypeReferenceInConstraint; - } - function checkTypeParameterHasIllegalReferencesInConstraint(typeParameter) { - var typeParameterSymbol; - function check(n) { - if (n.kind === 151 && n.typeName.kind === 69) { - var links = getNodeLinks(n); - if (links.isIllegalTypeReferenceInConstraint === undefined) { - var symbol = resolveName(typeParameter, n.typeName.text, 793056, undefined, undefined); - if (symbol && (symbol.flags & 262144)) { - links.isIllegalTypeReferenceInConstraint = ts.forEach(symbol.declarations, function (d) { return d.parent === typeParameter.parent; }); - } - } - if (links.isIllegalTypeReferenceInConstraint) { - error(typeParameter, ts.Diagnostics.Constraint_of_a_type_parameter_cannot_reference_any_type_parameter_from_the_same_type_parameter_list); - } - } - ts.forEachChild(n, check); - } - if (typeParameter.constraint) { - typeParameterSymbol = getSymbolOfNode(typeParameter); - check(typeParameter.constraint); - } - } function getTypeFromClassOrInterfaceReference(node, symbol) { - var type = getDeclaredTypeOfSymbol(symbol); + var type = getDeclaredTypeOfSymbol(getMergedSymbol(symbol)); var typeParameters = type.localTypeParameters; if (typeParameters) { if (!node.typeArguments || node.typeArguments.length !== typeParameters.length) { @@ -14292,26 +16148,68 @@ var ts; return type; } function getTypeFromNonGenericTypeReference(node, symbol) { - if (symbol.flags & 262144 && isTypeParameterReferenceIllegalInConstraint(node, symbol)) { - return unknownType; - } if (node.typeArguments) { error(node, ts.Diagnostics.Type_0_is_not_generic, symbolToString(symbol)); return unknownType; } return getDeclaredTypeOfSymbol(symbol); } + function getTypeReferenceName(node) { + switch (node.kind) { + case 155: + return node.typeName; + case 267: + return node.name; + case 194: + if (ts.isSupportedExpressionWithTypeArguments(node)) { + return node.expression; + } + } + return undefined; + } + function resolveTypeReferenceName(node, typeReferenceName) { + if (!typeReferenceName) { + return unknownSymbol; + } + return resolveEntityName(typeReferenceName, 793056) || unknownSymbol; + } + function getTypeReferenceType(node, symbol) { + if (symbol === unknownSymbol) { + return unknownType; + } + if (symbol.flags & (32 | 64)) { + return getTypeFromClassOrInterfaceReference(node, symbol); + } + if (symbol.flags & 524288) { + return getTypeFromTypeAliasReference(node, symbol); + } + if (symbol.flags & 107455 && node.kind === 267) { + return getTypeOfSymbol(symbol); + } + return getTypeFromNonGenericTypeReference(node, symbol); + } function getTypeFromTypeReference(node) { var links = getNodeLinks(node); if (!links.resolvedType) { - var typeNameOrExpression = node.kind === 151 ? node.typeName : - ts.isSupportedExpressionWithTypeArguments(node) ? node.expression : - undefined; - var symbol = typeNameOrExpression && resolveEntityName(typeNameOrExpression, 793056) || unknownSymbol; - var type = symbol === unknownSymbol ? unknownType : - symbol.flags & (32 | 64) ? getTypeFromClassOrInterfaceReference(node, symbol) : - symbol.flags & 524288 ? getTypeFromTypeAliasReference(node, symbol) : - getTypeFromNonGenericTypeReference(node, symbol); + var symbol = void 0; + var type = void 0; + if (node.kind === 267) { + var typeReferenceName = getTypeReferenceName(node); + symbol = resolveTypeReferenceName(node, typeReferenceName); + type = getTypeReferenceType(node, symbol); + links.resolvedSymbol = symbol; + links.resolvedType = type; + } + else { + var typeNameOrExpression = node.kind === 155 ? node.typeName : + ts.isSupportedExpressionWithTypeArguments(node) ? node.expression : + undefined; + symbol = typeNameOrExpression && resolveEntityName(typeNameOrExpression, 793056) || unknownSymbol; + type = symbol === unknownSymbol ? unknownType : + symbol.flags & (32 | 64) ? getTypeFromClassOrInterfaceReference(node, symbol) : + symbol.flags & 524288 ? getTypeFromTypeAliasReference(node, symbol) : + getTypeFromNonGenericTypeReference(node, symbol); + } links.resolvedSymbol = symbol; links.resolvedType = type; } @@ -14330,9 +16228,9 @@ var ts; for (var _i = 0, declarations_3 = declarations; _i < declarations_3.length; _i++) { var declaration = declarations_3[_i]; switch (declaration.kind) { - case 214: - case 215: - case 217: + case 221: + case 222: + case 224: return declaration; } } @@ -14364,18 +16262,11 @@ var ts; if (arity === void 0) { arity = 0; } return getTypeOfGlobalSymbol(getGlobalTypeSymbol(name), arity); } - function tryGetGlobalType(name, arity) { - if (arity === void 0) { arity = 0; } - return getTypeOfGlobalSymbol(getGlobalSymbol(name, 793056, undefined), arity); - } function getExportedTypeFromNamespace(namespace, name) { var namespaceSymbol = getGlobalSymbol(namespace, 1536, undefined); var typeSymbol = namespaceSymbol && getSymbol(namespaceSymbol.exports, name, 793056); return typeSymbol && getDeclaredTypeOfSymbol(typeSymbol); } - function getGlobalESSymbolConstructorSymbol() { - return globalESSymbolConstructorSymbol || (globalESSymbolConstructorSymbol = getGlobalValueSymbol("Symbol")); - } function createTypedPropertyDescriptorType(propertyType) { var globalTypedPropertyDescriptorType = getGlobalTypedPropertyDescriptorType(); return globalTypedPropertyDescriptorType !== emptyGenericType @@ -14386,10 +16277,10 @@ var ts; return genericGlobalType !== emptyGenericType ? createTypeReference(genericGlobalType, typeArguments) : emptyObjectType; } function createIterableType(elementType) { - return createTypeFromGenericGlobalType(globalIterableType, [elementType]); + return createTypeFromGenericGlobalType(getGlobalIterableType(), [elementType]); } function createIterableIteratorType(elementType) { - return createTypeFromGenericGlobalType(globalIterableIteratorType, [elementType]); + return createTypeFromGenericGlobalType(getGlobalIterableIteratorType(), [elementType]); } function createArrayType(elementType) { return createTypeFromGenericGlobalType(globalArrayType, [elementType]); @@ -14406,7 +16297,8 @@ var ts; return tupleTypes[id] || (tupleTypes[id] = createNewTupleType(elementTypes)); } function createNewTupleType(elementTypes) { - var type = createObjectType(8192 | getPropagatingFlagsOfTypes(elementTypes)); + var propagatedFlags = getPropagatingFlagsOfTypes(elementTypes, 0); + var type = createObjectType(8192 | propagatedFlags); type.elementTypes = elementTypes; return type; } @@ -14421,7 +16313,15 @@ var ts; if (type.flags & typeSetKind) { addTypesToSet(typeSet, type.types, typeSetKind); } - else if (!ts.contains(typeSet, type)) { + else if (type.flags & (1 | 32 | 64)) { + if (type.flags & 1) + typeSet.containsAny = true; + if (type.flags & 32) + typeSet.containsUndefined = true; + if (type.flags & 64) + typeSet.containsNull = true; + } + else if (type !== neverType && !ts.contains(typeSet, type)) { typeSet.push(type); } } @@ -14448,47 +16348,40 @@ var ts; } } } - function containsTypeAny(types) { - for (var _i = 0, types_5 = types; _i < types_5.length; _i++) { - var type = types_5[_i]; - if (isTypeAny(type)) { - return true; - } - } - return false; - } - function removeAllButLast(types, typeToRemove) { - var i = types.length; - while (i > 0 && types.length > 1) { - i--; - if (types[i] === typeToRemove) { - types.splice(i, 1); - } - } - } function getUnionType(types, noSubtypeReduction) { if (types.length === 0) { - return emptyObjectType; + return neverType; + } + if (types.length === 1) { + return types[0]; } var typeSet = []; addTypesToSet(typeSet, types, 16384); - if (containsTypeAny(typeSet)) { + if (typeSet.containsAny) { return anyType; } - if (noSubtypeReduction) { - removeAllButLast(typeSet, undefinedType); - removeAllButLast(typeSet, nullType); + if (strictNullChecks) { + if (typeSet.containsNull) + typeSet.push(nullType); + if (typeSet.containsUndefined) + typeSet.push(undefinedType); } - else { + if (!noSubtypeReduction) { removeSubtypes(typeSet); } - if (typeSet.length === 1) { + if (typeSet.length === 0) { + return typeSet.containsNull ? nullType : + typeSet.containsUndefined ? undefinedType : + neverType; + } + else if (typeSet.length === 1) { return typeSet[0]; } var id = getTypeListId(typeSet); var type = unionTypes[id]; if (!type) { - type = unionTypes[id] = createObjectType(16384 | getPropagatingFlagsOfTypes(typeSet)); + var propagatedFlags = getPropagatingFlagsOfTypes(typeSet, 96); + type = unionTypes[id] = createObjectType(16384 | propagatedFlags); type.types = typeSet; } return type; @@ -14506,16 +16399,23 @@ var ts; } var typeSet = []; addTypesToSet(typeSet, types, 32768); - if (containsTypeAny(typeSet)) { + if (typeSet.containsAny) { return anyType; } + if (strictNullChecks) { + if (typeSet.containsNull) + typeSet.push(nullType); + if (typeSet.containsUndefined) + typeSet.push(undefinedType); + } if (typeSet.length === 1) { return typeSet[0]; } var id = getTypeListId(typeSet); var type = intersectionTypes[id]; if (!type) { - type = intersectionTypes[id] = createObjectType(32768 | getPropagatingFlagsOfTypes(typeSet)); + var propagatedFlags = getPropagatingFlagsOfTypes(typeSet, 96); + type = intersectionTypes[id] = createObjectType(32768 | propagatedFlags); type.types = typeSet; } return type; @@ -14534,8 +16434,7 @@ var ts; } return links.resolvedType; } - function getStringLiteralType(node) { - var text = node.text; + function getStringLiteralTypeForText(text) { if (ts.hasProperty(stringLiteralTypes, text)) { return stringLiteralTypes[text]; } @@ -14543,19 +16442,35 @@ var ts; type.text = text; return type; } - function getTypeFromStringLiteral(node) { + function getTypeFromStringLiteralTypeNode(node) { var links = getNodeLinks(node); if (!links.resolvedType) { - links.resolvedType = getStringLiteralType(node); + links.resolvedType = getStringLiteralTypeForText(ts.unescapeIdentifier(node.text)); + } + return links.resolvedType; + } + function getTypeFromJSDocVariadicType(node) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + var type = getTypeFromTypeNode(node.type); + links.resolvedType = type ? createArrayType(type) : unknownType; + } + return links.resolvedType; + } + function getTypeFromJSDocTupleType(node) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + var types = ts.map(node.types, getTypeFromTypeNode); + links.resolvedType = createTupleType(types); } return links.resolvedType; } function getThisType(node) { var container = ts.getThisContainer(node, false); var parent = container && container.parent; - if (parent && (ts.isClassLike(parent) || parent.kind === 215)) { - if (!(container.flags & 64) && - (container.kind !== 144 || ts.isNodeDescendentOf(node, container.body))) { + if (parent && (ts.isClassLike(parent) || parent.kind === 222)) { + if (!(container.flags & 32) && + (container.kind !== 148 || ts.isNodeDescendentOf(node, container.body))) { return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent)).thisType; } } @@ -14572,47 +16487,70 @@ var ts; function getTypeFromTypeNode(node) { switch (node.kind) { case 117: + case 258: + case 259: return anyType; - case 130: + case 132: return stringType; - case 128: + case 130: return numberType; case 120: return booleanType; - case 131: + case 133: return esSymbolType; case 103: return voidType; + case 135: + return undefinedType; + case 93: + return nullType; + case 127: + return neverType; + case 165: case 97: return getTypeFromThisTypeNode(node); - case 9: - return getTypeFromStringLiteral(node); - case 151: - return getTypeFromTypeReference(node); - case 150: - return booleanType; - case 188: + case 166: + return getTypeFromStringLiteralTypeNode(node); + case 155: + case 267: return getTypeFromTypeReference(node); case 154: - return getTypeFromTypeQueryNode(node); - case 156: - return getTypeFromArrayTypeNode(node); - case 157: - return getTypeFromTupleTypeNode(node); + return booleanType; + case 194: + return getTypeFromTypeReference(node); case 158: - return getTypeFromUnionTypeNode(node); - case 159: - return getTypeFromIntersectionTypeNode(node); + return getTypeFromTypeQueryNode(node); case 160: + case 260: + return getTypeFromArrayTypeNode(node); + case 161: + return getTypeFromTupleTypeNode(node); + case 162: + case 261: + return getTypeFromUnionTypeNode(node); + case 163: + return getTypeFromIntersectionTypeNode(node); + case 164: + case 263: + case 264: + case 271: + case 272: + case 268: return getTypeFromTypeNode(node.type); - case 152: - case 153: - case 155: + case 156: + case 157: + case 159: + case 269: + case 265: return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); case 69: - case 135: + case 139: var symbol = getSymbolAtLocation(node); return symbol && getDeclaredTypeOfSymbol(symbol); + case 262: + return getTypeFromJSDocTupleType(node); + case 270: + return getTypeFromJSDocVariadicType(node); default: return unknownType; } @@ -14634,87 +16572,90 @@ var ts; function createBinaryTypeMapper(source1, target1, source2, target2) { return function (t) { return t === source1 ? target1 : t === source2 ? target2 : t; }; } - function createTypeMapper(sources, targets) { - switch (sources.length) { - case 1: return createUnaryTypeMapper(sources[0], targets[0]); - case 2: return createBinaryTypeMapper(sources[0], targets[0], sources[1], targets[1]); - } + function createArrayTypeMapper(sources, targets) { return function (t) { for (var i = 0; i < sources.length; i++) { if (t === sources[i]) { - return targets[i]; + return targets ? targets[i] : anyType; } } return t; }; } - function createUnaryTypeEraser(source) { - return function (t) { return t === source ? anyType : t; }; - } - function createBinaryTypeEraser(source1, source2) { - return function (t) { return t === source1 || t === source2 ? anyType : t; }; + function createTypeMapper(sources, targets) { + var count = sources.length; + var mapper = count == 1 ? createUnaryTypeMapper(sources[0], targets ? targets[0] : anyType) : + count == 2 ? createBinaryTypeMapper(sources[0], targets ? targets[0] : anyType, sources[1], targets ? targets[1] : anyType) : + createArrayTypeMapper(sources, targets); + mapper.mappedTypes = sources; + return mapper; } function createTypeEraser(sources) { - switch (sources.length) { - case 1: return createUnaryTypeEraser(sources[0]); - case 2: return createBinaryTypeEraser(sources[0], sources[1]); - } - return function (t) { - for (var _i = 0, sources_1 = sources; _i < sources_1.length; _i++) { - var source = sources_1[_i]; - if (t === source) { - return anyType; - } - } - return t; - }; + return createTypeMapper(sources, undefined); } - function createInferenceMapper(context) { - var mapper = function (t) { - for (var i = 0; i < context.typeParameters.length; i++) { - if (t === context.typeParameters[i]) { - context.inferences[i].isFixed = true; - return getInferredType(context, i); + function getInferenceMapper(context) { + if (!context.mapper) { + var mapper = function (t) { + var typeParameters = context.typeParameters; + for (var i = 0; i < typeParameters.length; i++) { + if (t === typeParameters[i]) { + context.inferences[i].isFixed = true; + return getInferredType(context, i); + } } - } - return t; - }; - mapper.context = context; - return mapper; + return t; + }; + mapper.mappedTypes = context.typeParameters; + mapper.context = context; + context.mapper = mapper; + } + return context.mapper; } function identityMapper(type) { return type; } function combineTypeMappers(mapper1, mapper2) { - return function (t) { return instantiateType(mapper1(t), mapper2); }; + var mapper = function (t) { return instantiateType(mapper1(t), mapper2); }; + mapper.mappedTypes = mapper1.mappedTypes; + return mapper; } - function instantiateTypeParameter(typeParameter, mapper) { + function cloneTypeParameter(typeParameter) { var result = createType(512); result.symbol = typeParameter.symbol; - if (typeParameter.constraint) { - result.constraint = instantiateType(typeParameter.constraint, mapper); + result.target = typeParameter; + return result; + } + function cloneTypePredicate(predicate, mapper) { + if (ts.isIdentifierTypePredicate(predicate)) { + return { + kind: 1, + parameterName: predicate.parameterName, + parameterIndex: predicate.parameterIndex, + type: instantiateType(predicate.type, mapper) + }; } else { - result.target = typeParameter; - result.mapper = mapper; + return { + kind: 0, + type: instantiateType(predicate.type, mapper) + }; } - return result; } function instantiateSignature(signature, mapper, eraseTypeParameters) { var freshTypeParameters; var freshTypePredicate; if (signature.typeParameters && !eraseTypeParameters) { - freshTypeParameters = instantiateList(signature.typeParameters, mapper, instantiateTypeParameter); + freshTypeParameters = ts.map(signature.typeParameters, cloneTypeParameter); mapper = combineTypeMappers(createTypeMapper(signature.typeParameters, freshTypeParameters), mapper); + for (var _i = 0, freshTypeParameters_1 = freshTypeParameters; _i < freshTypeParameters_1.length; _i++) { + var tp = freshTypeParameters_1[_i]; + tp.mapper = mapper; + } } if (signature.typePredicate) { - freshTypePredicate = { - parameterName: signature.typePredicate.parameterName, - parameterIndex: signature.typePredicate.parameterIndex, - type: instantiateType(signature.typePredicate.type, mapper) - }; + freshTypePredicate = cloneTypePredicate(signature.typePredicate, mapper); } - var result = createSignature(signature.declaration, freshTypeParameters, instantiateList(signature.parameters, mapper, instantiateSymbol), instantiateType(signature.resolvedReturnType, mapper), freshTypePredicate, signature.minArgumentCount, signature.hasRestParameter, signature.hasStringLiterals); + var result = createSignature(signature.declaration, freshTypeParameters, signature.thisType && instantiateType(signature.thisType, mapper), instantiateList(signature.parameters, mapper, instantiateSymbol), instantiateType(signature.resolvedReturnType, mapper), freshTypePredicate, signature.minArgumentCount, signature.hasRestParameter, signature.hasStringLiterals); result.target = signature; result.mapper = mapper; return result; @@ -14751,13 +16692,61 @@ var ts; mapper.instantiations[type.id] = result; return result; } + function isSymbolInScopeOfMappedTypeParameter(symbol, mapper) { + var mappedTypes = mapper.mappedTypes; + var node = symbol.declarations[0].parent; + while (node) { + switch (node.kind) { + case 156: + case 157: + case 220: + case 147: + case 146: + case 148: + case 151: + case 152: + case 153: + case 149: + case 150: + case 179: + case 180: + case 221: + case 192: + case 222: + case 223: + var declaration = node; + if (declaration.typeParameters) { + for (var _i = 0, _a = declaration.typeParameters; _i < _a.length; _i++) { + var d = _a[_i]; + if (ts.contains(mappedTypes, getDeclaredTypeOfTypeParameter(getSymbolOfNode(d)))) { + return true; + } + } + } + if (ts.isClassLike(node) || node.kind === 222) { + var thisType = getDeclaredTypeOfClassOrInterface(getSymbolOfNode(node)).thisType; + if (thisType && ts.contains(mappedTypes, thisType)) { + return true; + } + } + break; + case 225: + case 256: + return false; + } + node = node.parent; + } + return false; + } function instantiateType(type, mapper) { if (type && mapper !== identityMapper) { if (type.flags & 512) { return mapper(type); } if (type.flags & 65536) { - return type.symbol && type.symbol.flags & (16 | 8192 | 32 | 2048 | 4096) ? + return type.symbol && + type.symbol.flags & (16 | 8192 | 32 | 2048 | 4096) && + (type.flags & 131072 || isSymbolInScopeOfMappedTypeParameter(type.symbol, mapper)) ? instantiateAnonymousType(type, mapper) : type; } if (type.flags & 4096) { @@ -14775,34 +16764,42 @@ var ts; } return type; } + function instantiateIndexInfo(info, mapper) { + return info && createIndexInfo(instantiateType(info.type, mapper), info.isReadonly, info.declaration); + } function isContextSensitive(node) { - ts.Debug.assert(node.kind !== 143 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 147 || ts.isObjectLiteralMethod(node)); switch (node.kind) { - case 173: - case 174: + case 179: + case 180: return isContextSensitiveFunctionLikeDeclaration(node); - case 165: + case 171: return ts.forEach(node.properties, isContextSensitive); - case 164: + case 170: return ts.forEach(node.elements, isContextSensitive); - case 182: + case 188: return isContextSensitive(node.whenTrue) || isContextSensitive(node.whenFalse); - case 181: + case 187: return node.operatorToken.kind === 52 && (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 245: + case 253: return isContextSensitive(node.initializer); - case 143: - case 142: + case 147: + case 146: return isContextSensitiveFunctionLikeDeclaration(node); - case 172: + case 178: return isContextSensitive(node.expression); } return false; } function isContextSensitiveFunctionLikeDeclaration(node) { - return !node.typeParameters && node.parameters.length && !ts.forEach(node.parameters, function (p) { return p.type; }); + var areAllParametersUntyped = !ts.forEach(node.parameters, function (p) { return p.type; }); + var isNullaryArrow = node.kind === 180 && !node.parameters.length; + return !node.typeParameters && areAllParametersUntyped && !isNullaryArrow; + } + function isContextSensitiveFunctionOrObjectLiteralMethod(func) { + return (isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) && isContextSensitiveFunctionLikeDeclaration(func); } function getTypeWithoutSignatures(type) { if (type.flags & 80896) { @@ -14821,25 +16818,151 @@ var ts; function isTypeIdenticalTo(source, target) { return checkTypeRelatedTo(source, target, identityRelation, undefined); } - function compareTypes(source, target) { + function compareTypesIdentical(source, target) { return checkTypeRelatedTo(source, target, identityRelation, undefined) ? -1 : 0; } + function compareTypesAssignable(source, target) { + return checkTypeRelatedTo(source, target, assignableRelation, undefined) ? -1 : 0; + } function isTypeSubtypeOf(source, target) { return checkTypeSubtypeOf(source, target, undefined); } function isTypeAssignableTo(source, target) { return checkTypeAssignableTo(source, target, undefined); } + function isTypeComparableTo(source, target) { + return checkTypeComparableTo(source, target, undefined); + } function checkTypeSubtypeOf(source, target, errorNode, headMessage, containingMessageChain) { return checkTypeRelatedTo(source, target, subtypeRelation, errorNode, headMessage, containingMessageChain); } function checkTypeAssignableTo(source, target, errorNode, headMessage, containingMessageChain) { return checkTypeRelatedTo(source, target, assignableRelation, errorNode, headMessage, containingMessageChain); } - function isSignatureAssignableTo(source, target) { - var sourceType = getOrCreateTypeFromSignature(source); - var targetType = getOrCreateTypeFromSignature(target); - return checkTypeRelatedTo(sourceType, targetType, assignableRelation, undefined); + function checkTypeComparableTo(source, target, errorNode, headMessage, containingMessageChain) { + return checkTypeRelatedTo(source, target, comparableRelation, errorNode, headMessage, containingMessageChain); + } + function isSignatureAssignableTo(source, target, ignoreReturnTypes) { + return compareSignaturesRelated(source, target, ignoreReturnTypes, false, undefined, compareTypesAssignable) !== 0; + } + function compareSignaturesRelated(source, target, ignoreReturnTypes, reportErrors, errorReporter, compareTypes) { + if (source === target) { + return -1; + } + if (!target.hasRestParameter && source.minArgumentCount > target.parameters.length) { + return 0; + } + source = getErasedSignature(source); + target = getErasedSignature(target); + var result = -1; + if (source.thisType && target.thisType && source.thisType !== voidType) { + var related = compareTypes(source.thisType, target.thisType, false) + || compareTypes(target.thisType, source.thisType, reportErrors); + if (!related) { + if (reportErrors) { + errorReporter(ts.Diagnostics.The_this_types_of_each_signature_are_incompatible); + } + return 0; + } + result &= related; + } + var sourceMax = getNumNonRestParameters(source); + var targetMax = getNumNonRestParameters(target); + var checkCount = getNumParametersToCheckForSignatureRelatability(source, sourceMax, target, targetMax); + var sourceParams = source.parameters; + var targetParams = target.parameters; + for (var i = 0; i < checkCount; i++) { + var s = i < sourceMax ? getTypeOfParameter(sourceParams[i]) : getRestTypeOfSignature(source); + var t = i < targetMax ? getTypeOfParameter(targetParams[i]) : getRestTypeOfSignature(target); + var related = compareTypes(s, t, false) || compareTypes(t, s, reportErrors); + if (!related) { + if (reportErrors) { + errorReporter(ts.Diagnostics.Types_of_parameters_0_and_1_are_incompatible, sourceParams[i < sourceMax ? i : sourceMax].name, targetParams[i < targetMax ? i : targetMax].name); + } + return 0; + } + result &= related; + } + if (!ignoreReturnTypes) { + var targetReturnType = getReturnTypeOfSignature(target); + if (targetReturnType === voidType) { + return result; + } + var sourceReturnType = getReturnTypeOfSignature(source); + if (target.typePredicate) { + if (source.typePredicate) { + result &= compareTypePredicateRelatedTo(source.typePredicate, target.typePredicate, reportErrors, errorReporter, compareTypes); + } + else if (ts.isIdentifierTypePredicate(target.typePredicate)) { + if (reportErrors) { + errorReporter(ts.Diagnostics.Signature_0_must_have_a_type_predicate, signatureToString(source)); + } + return 0; + } + } + else { + result &= compareTypes(sourceReturnType, targetReturnType, reportErrors); + } + } + return result; + } + function compareTypePredicateRelatedTo(source, target, reportErrors, errorReporter, compareTypes) { + if (source.kind !== target.kind) { + if (reportErrors) { + errorReporter(ts.Diagnostics.A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard); + errorReporter(ts.Diagnostics.Type_predicate_0_is_not_assignable_to_1, typePredicateToString(source), typePredicateToString(target)); + } + return 0; + } + if (source.kind === 1) { + var sourceIdentifierPredicate = source; + var targetIdentifierPredicate = target; + if (sourceIdentifierPredicate.parameterIndex !== targetIdentifierPredicate.parameterIndex) { + if (reportErrors) { + errorReporter(ts.Diagnostics.Parameter_0_is_not_in_the_same_position_as_parameter_1, sourceIdentifierPredicate.parameterName, targetIdentifierPredicate.parameterName); + errorReporter(ts.Diagnostics.Type_predicate_0_is_not_assignable_to_1, typePredicateToString(source), typePredicateToString(target)); + } + return 0; + } + } + var related = compareTypes(source.type, target.type, reportErrors); + if (related === 0 && reportErrors) { + errorReporter(ts.Diagnostics.Type_predicate_0_is_not_assignable_to_1, typePredicateToString(source), typePredicateToString(target)); + } + return related; + } + function isImplementationCompatibleWithOverload(implementation, overload) { + var erasedSource = getErasedSignature(implementation); + var erasedTarget = getErasedSignature(overload); + var sourceReturnType = getReturnTypeOfSignature(erasedSource); + var targetReturnType = getReturnTypeOfSignature(erasedTarget); + if (targetReturnType === voidType + || checkTypeRelatedTo(targetReturnType, sourceReturnType, assignableRelation, undefined) + || checkTypeRelatedTo(sourceReturnType, targetReturnType, assignableRelation, undefined)) { + return isSignatureAssignableTo(erasedSource, erasedTarget, true); + } + return false; + } + function getNumNonRestParameters(signature) { + var numParams = signature.parameters.length; + return signature.hasRestParameter ? + numParams - 1 : + numParams; + } + function getNumParametersToCheckForSignatureRelatability(source, sourceNonRestParamCount, target, targetNonRestParamCount) { + if (source.hasRestParameter === target.hasRestParameter) { + if (source.hasRestParameter) { + return Math.max(sourceNonRestParamCount, targetNonRestParamCount) + 1; + } + else { + return Math.min(sourceNonRestParamCount, targetNonRestParamCount); + } + } + else { + return source.hasRestParameter ? + targetNonRestParamCount : + sourceNonRestParamCount; + } } function checkTypeRelatedTo(source, target, relation, errorNode, headMessage, containingMessageChain) { var errorInfo; @@ -14849,18 +16972,12 @@ var ts; var expandingFlags; var depth = 0; var overflow = false; - var elaborateErrors = false; ts.Debug.assert(relation !== identityRelation || !errorNode, "no error reporting in identity checking"); - var result = isRelatedTo(source, target, errorNode !== undefined, headMessage); + var result = isRelatedTo(source, target, !!errorNode, headMessage); if (overflow) { error(errorNode, ts.Diagnostics.Excessive_stack_depth_comparing_types_0_and_1, typeToString(source), typeToString(target)); } else if (errorInfo) { - if (errorInfo.next === undefined) { - errorInfo = undefined; - elaborateErrors = true; - isRelatedTo(source, target, errorNode !== undefined, headMessage); - } if (containingMessageChain) { errorInfo = ts.concatenateDiagnosticMessageChains(containingMessageChain, errorInfo); } @@ -14868,6 +16985,7 @@ var ts; } return result !== 0; function reportError(message, arg0, arg1, arg2) { + ts.Debug.assert(!!errorNode); errorInfo = ts.chainDiagnosticMessages(errorInfo, message, arg0, arg1, arg2); } function reportRelationError(message, source, target) { @@ -14877,7 +16995,12 @@ var ts; sourceType = typeToString(source, undefined, 128); targetType = typeToString(target, undefined, 128); } - reportError(message || ts.Diagnostics.Type_0_is_not_assignable_to_type_1, sourceType, targetType); + if (!message) { + message = relation === comparableRelation ? + ts.Diagnostics.Type_0_is_not_comparable_to_type_1 : + ts.Diagnostics.Type_0_is_not_assignable_to_type_1; + } + reportError(message, sourceType, targetType); } function isRelatedTo(source, target, reportErrors, headMessage) { var result; @@ -14886,21 +17009,35 @@ var ts; if (relation === identityRelation) { return isIdenticalTo(source, target); } - if (isTypeAny(target)) - return -1; - if (source === undefinedType) - return -1; - if (source === nullType && target !== undefinedType) - return -1; - if (source.flags & 128 && target === numberType) - return -1; - if (source.flags & 256 && target === stringType) - return -1; - if (relation === assignableRelation) { - if (isTypeAny(source)) + if (!(target.flags & 134217728)) { + if (target.flags & 1) return -1; - if (source === numberType && target.flags & 128) + if (source.flags & 32) { + if (!strictNullChecks || target.flags & (32 | 16) || source === emptyArrayElementType) + return -1; + } + if (source.flags & 64) { + if (!strictNullChecks || target.flags & 64) + return -1; + } + if (source.flags & 128 && target === numberType) return -1; + if (source.flags & 128 && target.flags & 128) { + if (result = enumRelatedTo(source, target, reportErrors)) { + return result; + } + } + if (source.flags & 256 && target === stringType) + return -1; + if (relation === assignableRelation || relation === comparableRelation) { + if (source.flags & (1 | 134217728)) + return -1; + if (source === numberType && target.flags & 128) + return -1; + } + if (source.flags & 8 && target.flags & 8) { + return -1; + } } if (source.flags & 1048576) { if (hasExcessProperties(source, target, reportErrors)) { @@ -14915,23 +17052,30 @@ var ts; } var saveErrorInfo = errorInfo; if (source.flags & 16384) { - if (result = eachTypeRelatedToType(source, target, reportErrors)) { + if (relation === comparableRelation) { + result = someTypeRelatedToType(source, target, reportErrors); + } + else { + result = eachTypeRelatedToType(source, target, reportErrors); + } + if (result) { return result; } } else if (target.flags & 32768) { - if (result = typeRelatedToEachType(source, target, reportErrors)) { + result = typeRelatedToEachType(source, target, reportErrors); + if (result) { return result; } } else { if (source.flags & 32768) { - if (result = someTypeRelatedToType(source, target, reportErrors && !(target.flags & 16384))) { + if (result = someTypeRelatedToType(source, target, false)) { return result; } } if (target.flags & 16384) { - if (result = typeRelatedToSomeType(source, target, reportErrors)) { + if (result = typeRelatedToSomeType(source, target, reportErrors && !(source.flags & 16777726))) { return result; } } @@ -14941,6 +17085,7 @@ var ts; if (!constraint || constraint.flags & 1) { constraint = emptyObjectType; } + constraint = getTypeWithThisArgument(constraint, source); var reportConstraintErrors = reportErrors && constraint !== emptyObjectType; if (result = isRelatedTo(constraint, target, reportConstraintErrors)) { errorInfo = saveErrorInfo; @@ -14953,10 +17098,10 @@ var ts; return result; } } - var apparentType = getApparentType(source); - if (apparentType.flags & (80896 | 32768) && target.flags & 80896) { - var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo; - if (result = objectTypeRelatedTo(apparentType, source, target, reportStructuralErrors)) { + var apparentSource = getApparentType(source); + if (apparentSource.flags & (80896 | 32768) && target.flags & 80896) { + var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo && !(source.flags & 16777726); + if (result = objectTypeRelatedTo(apparentSource, source, target, reportStructuralErrors)) { errorInfo = saveErrorInfo; return result; } @@ -14977,13 +17122,10 @@ var ts; } return objectTypeRelatedTo(source, source, target, false); } - if (source.flags & 512 && target.flags & 512) { - return typeParameterIdenticalTo(source, target); - } if (source.flags & 16384 && target.flags & 16384 || source.flags & 32768 && target.flags & 32768) { - if (result = eachTypeRelatedToSomeType(source, target)) { - if (result &= eachTypeRelatedToSomeType(target, source)) { + if (result = eachTypeRelatedToSomeType(source, target, false)) { + if (result &= eachTypeRelatedToSomeType(target, source, false)) { return result; } } @@ -14993,8 +17135,9 @@ var ts; function isKnownProperty(type, name) { if (type.flags & 80896) { var resolved = resolveStructuredTypeMembers(type); - if (relation === assignableRelation && (type === globalObjectType || resolved.properties.length === 0) || - resolved.stringIndexType || resolved.numberIndexType || getPropertyOfType(type, name)) { + if ((relation === assignableRelation || relation === comparableRelation) && + (type === globalObjectType || isEmptyObjectType(resolved)) || + resolved.stringIndexInfo || resolved.numberIndexInfo || getPropertyOfType(type, name)) { return true; } } @@ -15008,12 +17151,20 @@ var ts; } return false; } + function isEmptyObjectType(t) { + return t.properties.length === 0 && + t.callSignatures.length === 0 && + t.constructSignatures.length === 0 && + !t.stringIndexInfo && + !t.numberIndexInfo; + } function hasExcessProperties(source, target, reportErrors) { - if (!(target.flags & 67108864) && someConstituentTypeHasKind(target, 80896)) { + if (!(target.flags & 67108864) && maybeTypeOfKind(target, 80896)) { for (var _i = 0, _a = getPropertiesOfObjectType(source); _i < _a.length; _i++) { var prop = _a[_i]; if (!isKnownProperty(target, prop.name)) { if (reportErrors) { + ts.Debug.assert(!!errorNode); errorNode = prop.valueDeclaration; reportError(ts.Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1, symbolToString(prop), typeToString(target)); } @@ -15023,7 +17174,7 @@ var ts; } return false; } - function eachTypeRelatedToSomeType(source, target) { + function eachTypeRelatedToSomeType(source, target, reportErrors) { var result = -1; var sourceTypes = source.types; for (var _i = 0, sourceTypes_1 = sourceTypes; _i < sourceTypes_1.length; _i++) { @@ -15038,7 +17189,15 @@ var ts; } function typeRelatedToSomeType(source, target, reportErrors) { var targetTypes = target.types; - for (var i = 0, len = targetTypes.length; i < len; i++) { + var len = targetTypes.length; + while (len >= 2 && targetTypes[len - 1].flags & 96) { + var related = isRelatedTo(source, targetTypes[len - 1], false); + if (related) { + return related; + } + len--; + } + for (var i = 0; i < len; i++) { var related = isRelatedTo(source, targetTypes[i], reportErrors && i === len - 1); if (related) { return related; @@ -15061,7 +17220,15 @@ var ts; } function someTypeRelatedToType(source, target, reportErrors) { var sourceTypes = source.types; - for (var i = 0, len = sourceTypes.length; i < len; i++) { + var len = sourceTypes.length; + while (len >= 2 && sourceTypes[len - 1].flags & 96) { + var related = isRelatedTo(sourceTypes[len - 1], target, false); + if (related) { + return related; + } + len--; + } + for (var i = 0; i < len; i++) { var related = isRelatedTo(sourceTypes[i], target, reportErrors && i === len - 1); if (related) { return related; @@ -15088,8 +17255,9 @@ var ts; if (sources.length !== targets.length && relation === identityRelation) { return 0; } + var length = sources.length <= targets.length ? sources.length : targets.length; var result = -1; - for (var i = 0; i < targets.length; i++) { + for (var i = 0; i < length; i++) { var related = isRelatedTo(sources[i], targets[i], reportErrors); if (!related) { return 0; @@ -15098,23 +17266,17 @@ var ts; } return result; } - function typeParameterIdenticalTo(source, target) { - if (source.constraint === target.constraint) { - return -1; - } - if (source.constraint === noConstraintType || target.constraint === noConstraintType) { - return 0; - } - return isIdenticalTo(source.constraint, target.constraint); - } - function objectTypeRelatedTo(apparentSource, originalSource, target, reportErrors) { + function objectTypeRelatedTo(source, originalSource, target, reportErrors) { if (overflow) { return 0; } - var id = relation !== identityRelation || apparentSource.id < target.id ? apparentSource.id + "," + target.id : target.id + "," + apparentSource.id; + var id = relation !== identityRelation || source.id < target.id ? source.id + "," + target.id : target.id + "," + source.id; var related = relation[id]; if (related !== undefined) { - if (!elaborateErrors || (related === 3)) { + if (reportErrors && related === 2) { + relation[id] = 3; + } + else { return related === 1 ? -1 : 0; } } @@ -15135,13 +17297,13 @@ var ts; maybeStack = []; expandingFlags = 0; } - sourceStack[depth] = apparentSource; + sourceStack[depth] = source; targetStack[depth] = target; maybeStack[depth] = {}; maybeStack[depth][id] = 1; depth++; var saveExpandingFlags = expandingFlags; - if (!(expandingFlags & 1) && isDeeplyNestedGeneric(apparentSource, sourceStack, depth)) + if (!(expandingFlags & 1) && isDeeplyNestedGeneric(source, sourceStack, depth)) expandingFlags |= 1; if (!(expandingFlags & 2) && isDeeplyNestedGeneric(target, targetStack, depth)) expandingFlags |= 2; @@ -15150,15 +17312,15 @@ var ts; result = 1; } else { - result = propertiesRelatedTo(apparentSource, target, reportErrors); + result = propertiesRelatedTo(source, target, reportErrors); if (result) { - result &= signaturesRelatedTo(apparentSource, target, 0, reportErrors); + result &= signaturesRelatedTo(source, target, 0, reportErrors); if (result) { - result &= signaturesRelatedTo(apparentSource, target, 1, reportErrors); + result &= signaturesRelatedTo(source, target, 1, reportErrors); if (result) { - result &= stringIndexTypesRelatedTo(apparentSource, originalSource, target, reportErrors); + result &= indexTypesRelatedTo(source, originalSource, target, 0, reportErrors); if (result) { - result &= numberIndexTypesRelatedTo(apparentSource, originalSource, target, reportErrors); + result &= indexTypesRelatedTo(source, originalSource, target, 1, reportErrors); } } } @@ -15198,23 +17360,23 @@ var ts; else if (!(targetProp.flags & 134217728)) { var sourcePropFlags = getDeclarationFlagsFromSymbol(sourceProp); var targetPropFlags = getDeclarationFlagsFromSymbol(targetProp); - if (sourcePropFlags & 16 || targetPropFlags & 16) { + if (sourcePropFlags & 8 || targetPropFlags & 8) { if (sourceProp.valueDeclaration !== targetProp.valueDeclaration) { if (reportErrors) { - if (sourcePropFlags & 16 && targetPropFlags & 16) { + if (sourcePropFlags & 8 && targetPropFlags & 8) { reportError(ts.Diagnostics.Types_have_separate_declarations_of_a_private_property_0, symbolToString(targetProp)); } else { - reportError(ts.Diagnostics.Property_0_is_private_in_type_1_but_not_in_type_2, symbolToString(targetProp), typeToString(sourcePropFlags & 16 ? source : target), typeToString(sourcePropFlags & 16 ? target : source)); + reportError(ts.Diagnostics.Property_0_is_private_in_type_1_but_not_in_type_2, symbolToString(targetProp), typeToString(sourcePropFlags & 8 ? source : target), typeToString(sourcePropFlags & 8 ? target : source)); } } return 0; } } - else if (targetPropFlags & 32) { + else if (targetPropFlags & 16) { var sourceDeclaredInClass = sourceProp.parent && sourceProp.parent.flags & 32; - var sourceClass = sourceDeclaredInClass ? getDeclaredTypeOfSymbol(sourceProp.parent) : undefined; - var targetClass = getDeclaredTypeOfSymbol(targetProp.parent); + var sourceClass = sourceDeclaredInClass ? getDeclaredTypeOfSymbol(getParentOfSymbol(sourceProp)) : undefined; + var targetClass = getDeclaredTypeOfSymbol(getParentOfSymbol(targetProp)); if (!sourceClass || !hasBaseType(sourceClass, targetClass)) { if (reportErrors) { reportError(ts.Diagnostics.Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2, symbolToString(targetProp), typeToString(sourceClass || source), typeToString(targetClass)); @@ -15222,7 +17384,7 @@ var ts; return 0; } } - else if (sourcePropFlags & 32) { + else if (sourcePropFlags & 16) { if (reportErrors) { reportError(ts.Diagnostics.Property_0_is_protected_in_type_1_but_public_in_type_2, symbolToString(targetProp), typeToString(source), typeToString(target)); } @@ -15280,140 +17442,41 @@ var ts; } var sourceSignatures = getSignaturesOfType(source, kind); var targetSignatures = getSignaturesOfType(target, kind); + if (kind === 1 && sourceSignatures.length && targetSignatures.length) { + if (isAbstractConstructorType(source) && !isAbstractConstructorType(target)) { + if (reportErrors) { + reportError(ts.Diagnostics.Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type); + } + return 0; + } + if (!constructorVisibilitiesAreCompatible(sourceSignatures[0], targetSignatures[0], reportErrors)) { + return 0; + } + } var result = -1; var saveErrorInfo = errorInfo; - if (kind === 1) { - var sourceSig = sourceSignatures[0]; - var targetSig = targetSignatures[0]; - result &= abstractSignatureRelatedTo(source, sourceSig, target, targetSig); - if (result !== -1) { - return result; - } - } outer: for (var _i = 0, targetSignatures_1 = targetSignatures; _i < targetSignatures_1.length; _i++) { var t = targetSignatures_1[_i]; - if (!t.hasStringLiterals || target.flags & 262144) { - var localErrors = reportErrors; - var checkedAbstractAssignability = false; - for (var _a = 0, sourceSignatures_1 = sourceSignatures; _a < sourceSignatures_1.length; _a++) { - var s = sourceSignatures_1[_a]; - if (!s.hasStringLiterals || source.flags & 262144) { - var related = signatureRelatedTo(s, t, localErrors); - if (related) { - result &= related; - errorInfo = saveErrorInfo; - continue outer; - } - localErrors = false; - } + var shouldElaborateErrors = reportErrors; + for (var _a = 0, sourceSignatures_1 = sourceSignatures; _a < sourceSignatures_1.length; _a++) { + var s = sourceSignatures_1[_a]; + var related = signatureRelatedTo(s, t, shouldElaborateErrors); + if (related) { + result &= related; + errorInfo = saveErrorInfo; + continue outer; } - return 0; + shouldElaborateErrors = false; } + if (shouldElaborateErrors) { + reportError(ts.Diagnostics.Type_0_provides_no_match_for_the_signature_1, typeToString(source), signatureToString(t, undefined, undefined, kind)); + } + return 0; } return result; - function abstractSignatureRelatedTo(source, sourceSig, target, targetSig) { - if (sourceSig && targetSig) { - var sourceDecl = source.symbol && getClassLikeDeclarationOfSymbol(source.symbol); - var targetDecl = target.symbol && getClassLikeDeclarationOfSymbol(target.symbol); - if (!sourceDecl) { - return -1; - } - var sourceErasedSignature = getErasedSignature(sourceSig); - var targetErasedSignature = getErasedSignature(targetSig); - var sourceReturnType = sourceErasedSignature && getReturnTypeOfSignature(sourceErasedSignature); - var targetReturnType = targetErasedSignature && getReturnTypeOfSignature(targetErasedSignature); - var sourceReturnDecl = sourceReturnType && sourceReturnType.symbol && getClassLikeDeclarationOfSymbol(sourceReturnType.symbol); - var targetReturnDecl = targetReturnType && targetReturnType.symbol && getClassLikeDeclarationOfSymbol(targetReturnType.symbol); - var sourceIsAbstract = sourceReturnDecl && sourceReturnDecl.flags & 128; - var targetIsAbstract = targetReturnDecl && targetReturnDecl.flags & 128; - if (sourceIsAbstract && !(targetIsAbstract && targetDecl)) { - if (reportErrors) { - reportError(ts.Diagnostics.Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type); - } - return 0; - } - } - return -1; - } } function signatureRelatedTo(source, target, reportErrors) { - if (source === target) { - return -1; - } - if (!target.hasRestParameter && source.minArgumentCount > target.parameters.length) { - return 0; - } - var sourceMax = source.parameters.length; - var targetMax = target.parameters.length; - var checkCount; - if (source.hasRestParameter && target.hasRestParameter) { - checkCount = sourceMax > targetMax ? sourceMax : targetMax; - sourceMax--; - targetMax--; - } - else if (source.hasRestParameter) { - sourceMax--; - checkCount = targetMax; - } - else if (target.hasRestParameter) { - targetMax--; - checkCount = sourceMax; - } - else { - checkCount = sourceMax < targetMax ? sourceMax : targetMax; - } - source = getErasedSignature(source); - target = getErasedSignature(target); - var result = -1; - for (var i = 0; i < checkCount; i++) { - var s = i < sourceMax ? getTypeOfSymbol(source.parameters[i]) : getRestTypeOfSignature(source); - var t = i < targetMax ? getTypeOfSymbol(target.parameters[i]) : getRestTypeOfSignature(target); - var saveErrorInfo = errorInfo; - var related = isRelatedTo(s, t, reportErrors); - if (!related) { - related = isRelatedTo(t, s, false); - if (!related) { - if (reportErrors) { - reportError(ts.Diagnostics.Types_of_parameters_0_and_1_are_incompatible, source.parameters[i < sourceMax ? i : sourceMax].name, target.parameters[i < targetMax ? i : targetMax].name); - } - return 0; - } - errorInfo = saveErrorInfo; - } - result &= related; - } - if (source.typePredicate && target.typePredicate) { - var hasDifferentParameterIndex = source.typePredicate.parameterIndex !== target.typePredicate.parameterIndex; - var hasDifferentTypes; - if (hasDifferentParameterIndex || - (hasDifferentTypes = !isTypeIdenticalTo(source.typePredicate.type, target.typePredicate.type))) { - if (reportErrors) { - var sourceParamText = source.typePredicate.parameterName; - var targetParamText = target.typePredicate.parameterName; - var sourceTypeText = typeToString(source.typePredicate.type); - var targetTypeText = typeToString(target.typePredicate.type); - if (hasDifferentParameterIndex) { - reportError(ts.Diagnostics.Parameter_0_is_not_in_the_same_position_as_parameter_1, sourceParamText, targetParamText); - } - else if (hasDifferentTypes) { - reportError(ts.Diagnostics.Type_0_is_not_assignable_to_type_1, sourceTypeText, targetTypeText); - } - reportError(ts.Diagnostics.Type_predicate_0_is_not_assignable_to_1, sourceParamText + " is " + sourceTypeText, targetParamText + " is " + targetTypeText); - } - return 0; - } - } - else if (!source.typePredicate && target.typePredicate) { - if (reportErrors) { - reportError(ts.Diagnostics.Signature_0_must_have_a_type_predicate, signatureToString(source)); - } - return 0; - } - var targetReturnType = getReturnTypeOfSignature(target); - if (targetReturnType === voidType) - return result; - var sourceReturnType = getReturnTypeOfSignature(source); - return result & isRelatedTo(sourceReturnType, targetReturnType, reportErrors); + return compareSignaturesRelated(source, target, false, reportErrors, reportError, isRelatedTo); } function signaturesIdenticalTo(source, target, kind) { var sourceSignatures = getSignaturesOfType(source, kind); @@ -15422,8 +17485,8 @@ var ts; return 0; } var result = -1; - for (var i = 0, len = sourceSignatures.length; i < len; ++i) { - var related = compareSignatures(sourceSignatures[i], targetSignatures[i], false, false, isRelatedTo); + for (var i = 0, len = sourceSignatures.length; i < len; i++) { + var related = compareSignaturesIdentical(sourceSignatures[i], targetSignatures[i], false, false, false, isRelatedTo); if (!related) { return 0; } @@ -15431,78 +17494,125 @@ var ts; } return result; } - function stringIndexTypesRelatedTo(source, originalSource, target, reportErrors) { - if (relation === identityRelation) { - return indexTypesIdenticalTo(0, source, target); - } - var targetType = getIndexTypeOfType(target, 0); - if (targetType) { - if ((targetType.flags & 1) && !(originalSource.flags & 16777726)) { - return -1; - } - var sourceType = getIndexTypeOfType(source, 0); - if (!sourceType) { - if (reportErrors) { - reportError(ts.Diagnostics.Index_signature_is_missing_in_type_0, typeToString(source)); + function eachPropertyRelatedTo(source, target, kind, reportErrors) { + var result = -1; + for (var _i = 0, _a = getPropertiesOfObjectType(source); _i < _a.length; _i++) { + var prop = _a[_i]; + if (kind === 0 || isNumericLiteralName(prop.name)) { + var related = isRelatedTo(getTypeOfSymbol(prop), target, reportErrors); + if (!related) { + if (reportErrors) { + reportError(ts.Diagnostics.Property_0_is_incompatible_with_index_signature, symbolToString(prop)); + } + return 0; } - return 0; + result &= related; } - var related = isRelatedTo(sourceType, targetType, reportErrors); - if (!related) { - if (reportErrors) { - reportError(ts.Diagnostics.Index_signatures_are_incompatible); - } - return 0; - } - return related; } - return -1; + return result; } - function numberIndexTypesRelatedTo(source, originalSource, target, reportErrors) { - if (relation === identityRelation) { - return indexTypesIdenticalTo(1, source, target); + function indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors) { + var related = isRelatedTo(sourceInfo.type, targetInfo.type, reportErrors); + if (!related && reportErrors) { + reportError(ts.Diagnostics.Index_signatures_are_incompatible); } - var targetType = getIndexTypeOfType(target, 1); - if (targetType) { - if ((targetType.flags & 1) && !(originalSource.flags & 16777726)) { - return -1; - } - var sourceStringType = getIndexTypeOfType(source, 0); - var sourceNumberType = getIndexTypeOfType(source, 1); - if (!(sourceStringType || sourceNumberType)) { - if (reportErrors) { - reportError(ts.Diagnostics.Index_signature_is_missing_in_type_0, typeToString(source)); - } - return 0; - } - var related; - if (sourceStringType && sourceNumberType) { - related = isRelatedTo(sourceStringType, targetType, false) || isRelatedTo(sourceNumberType, targetType, reportErrors); - } - else { - related = isRelatedTo(sourceStringType || sourceNumberType, targetType, reportErrors); - } - if (!related) { - if (reportErrors) { - reportError(ts.Diagnostics.Index_signatures_are_incompatible); - } - return 0; - } - return related; - } - return -1; + return related; } - function indexTypesIdenticalTo(indexKind, source, target) { - var targetType = getIndexTypeOfType(target, indexKind); - var sourceType = getIndexTypeOfType(source, indexKind); - if (!sourceType && !targetType) { + function indexTypesRelatedTo(source, originalSource, target, kind, reportErrors) { + if (relation === identityRelation) { + return indexTypesIdenticalTo(source, target, kind); + } + var targetInfo = getIndexInfoOfType(target, kind); + if (!targetInfo || ((targetInfo.type.flags & 1) && !(originalSource.flags & 16777726))) { return -1; } - if (sourceType && targetType) { - return isRelatedTo(sourceType, targetType); + var sourceInfo = getIndexInfoOfType(source, kind) || + kind === 1 && getIndexInfoOfType(source, 0); + if (sourceInfo) { + return indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors); + } + if (isObjectLiteralType(source)) { + var related = -1; + if (kind === 0) { + var sourceNumberInfo = getIndexInfoOfType(source, 1); + if (sourceNumberInfo) { + related = indexInfoRelatedTo(sourceNumberInfo, targetInfo, reportErrors); + } + } + if (related) { + related &= eachPropertyRelatedTo(source, targetInfo.type, kind, reportErrors); + } + return related; + } + if (reportErrors) { + reportError(ts.Diagnostics.Index_signature_is_missing_in_type_0, typeToString(source)); } return 0; } + function indexTypesIdenticalTo(source, target, indexKind) { + var targetInfo = getIndexInfoOfType(target, indexKind); + var sourceInfo = getIndexInfoOfType(source, indexKind); + if (!sourceInfo && !targetInfo) { + return -1; + } + if (sourceInfo && targetInfo && sourceInfo.isReadonly === targetInfo.isReadonly) { + return isRelatedTo(sourceInfo.type, targetInfo.type); + } + return 0; + } + function enumRelatedTo(source, target, reportErrors) { + if (source.symbol.name !== target.symbol.name || + source.symbol.flags & 128 || + target.symbol.flags & 128) { + return 0; + } + var targetEnumType = getTypeOfSymbol(target.symbol); + for (var _i = 0, _a = getPropertiesOfType(getTypeOfSymbol(source.symbol)); _i < _a.length; _i++) { + var property = _a[_i]; + if (property.flags & 8) { + var targetProperty = getPropertyOfType(targetEnumType, property.name); + if (!targetProperty || !(targetProperty.flags & 8)) { + if (reportErrors) { + reportError(ts.Diagnostics.Property_0_is_missing_in_type_1, property.name, typeToString(target, undefined, 128)); + } + return 0; + } + } + } + return -1; + } + function constructorVisibilitiesAreCompatible(sourceSignature, targetSignature, reportErrors) { + if (!sourceSignature.declaration || !targetSignature.declaration) { + return true; + } + var sourceAccessibility = sourceSignature.declaration.flags & (8 | 16); + var targetAccessibility = targetSignature.declaration.flags & (8 | 16); + if (targetAccessibility === 8) { + return true; + } + if (targetAccessibility === 16 && sourceAccessibility !== 8) { + return true; + } + if (targetAccessibility !== 16 && !sourceAccessibility) { + return true; + } + if (reportErrors) { + reportError(ts.Diagnostics.Cannot_assign_a_0_constructor_type_to_a_1_constructor_type, visibilityToString(sourceAccessibility), visibilityToString(targetAccessibility)); + } + return false; + } + } + function isAbstractConstructorType(type) { + if (type.flags & 65536) { + var symbol = type.symbol; + if (symbol && symbol.flags & 32) { + var declaration = getClassLikeDeclarationOfSymbol(symbol); + if (declaration && declaration.flags & 128) { + return true; + } + } + } + return false; } function isDeeplyNestedGeneric(type, stack, depth) { if (type.flags & (4096 | 131072) && depth >= 5) { @@ -15520,14 +17630,14 @@ var ts; return false; } function isPropertyIdenticalTo(sourceProp, targetProp) { - return compareProperties(sourceProp, targetProp, compareTypes) !== 0; + return compareProperties(sourceProp, targetProp, compareTypesIdentical) !== 0; } function compareProperties(sourceProp, targetProp, compareTypes) { if (sourceProp === targetProp) { return -1; } - var sourcePropAccessibility = getDeclarationFlagsFromSymbol(sourceProp) & (16 | 32); - var targetPropAccessibility = getDeclarationFlagsFromSymbol(targetProp) & (16 | 32); + var sourcePropAccessibility = getDeclarationFlagsFromSymbol(sourceProp) & (8 | 16); + var targetPropAccessibility = getDeclarationFlagsFromSymbol(targetProp) & (8 | 16); if (sourcePropAccessibility !== targetPropAccessibility) { return 0; } @@ -15541,6 +17651,9 @@ var ts; return 0; } } + if (isReadonlySymbol(sourceProp) !== isReadonlySymbol(targetProp)) { + return 0; + } return compareTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp)); } function isMatchingSignature(source, target, partialMatch) { @@ -15555,35 +17668,30 @@ var ts; } return false; } - function compareSignatures(source, target, partialMatch, ignoreReturnTypes, compareTypes) { + function compareSignaturesIdentical(source, target, partialMatch, ignoreThisTypes, ignoreReturnTypes, compareTypes) { if (source === target) { return -1; } if (!(isMatchingSignature(source, target, partialMatch))) { return 0; } - var result = -1; - if (source.typeParameters && target.typeParameters) { - if (source.typeParameters.length !== target.typeParameters.length) { - return 0; - } - for (var i = 0, len = source.typeParameters.length; i < len; ++i) { - var related = compareTypes(source.typeParameters[i], target.typeParameters[i]); - if (!related) { - return 0; - } - result &= related; - } - } - else if (source.typeParameters || target.typeParameters) { + if ((source.typeParameters ? source.typeParameters.length : 0) !== (target.typeParameters ? target.typeParameters.length : 0)) { return 0; } source = getErasedSignature(source); target = getErasedSignature(target); + var result = -1; + if (!ignoreThisTypes && source.thisType && target.thisType) { + var related = compareTypes(source.thisType, target.thisType); + if (!related) { + return 0; + } + result &= related; + } var targetLen = target.parameters.length; for (var i = 0; i < targetLen; i++) { - var s = isRestParameterIndex(source, i) ? getRestTypeOfSignature(source) : getTypeOfSymbol(source.parameters[i]); - var t = isRestParameterIndex(target, i) ? getRestTypeOfSignature(target) : getTypeOfSymbol(target.parameters[i]); + var s = isRestParameterIndex(source, i) ? getRestTypeOfSignature(source) : getTypeOfParameter(source.parameters[i]); + var t = isRestParameterIndex(target, i) ? getRestTypeOfSignature(target) : getTypeOfParameter(target.parameters[i]); var related = compareTypes(s, t); if (!related) { return 0; @@ -15599,15 +17707,31 @@ var ts; return signature.hasRestParameter && parameterIndex >= signature.parameters.length - 1; } function isSupertypeOfEach(candidate, types) { - for (var _i = 0, types_6 = types; _i < types_6.length; _i++) { - var type = types_6[_i]; - if (candidate !== type && !isTypeSubtypeOf(type, candidate)) + for (var _i = 0, types_5 = types; _i < types_5.length; _i++) { + var t = types_5[_i]; + if (candidate !== t && !isTypeSubtypeOf(t, candidate)) return false; } return true; } + function getCombinedFlagsOfTypes(types) { + var flags = 0; + for (var _i = 0, types_6 = types; _i < types_6.length; _i++) { + var t = types_6[_i]; + flags |= t.flags; + } + return flags; + } function getCommonSupertype(types) { - return ts.forEach(types, function (t) { return isSupertypeOfEach(t, types) ? t : undefined; }); + if (!strictNullChecks) { + return ts.forEach(types, function (t) { return isSupertypeOfEach(t, types) ? t : undefined; }); + } + var primaryTypes = ts.filter(types, function (t) { return !(t.flags & 96); }); + if (!primaryTypes.length) { + return getUnionType(types); + } + var supertype = ts.forEach(primaryTypes, function (t) { return isSupertypeOfEach(t, primaryTypes) ? t : undefined; }); + return supertype && addNullableKind(supertype, getCombinedFlagsOfTypes(types) & 96); } function reportNoCommonSupertypeError(types, errorLocation, errorMessageChainHead) { var bestSupertype; @@ -15640,7 +17764,8 @@ var ts; return type.flags & 4096 && type.target === globalArrayType; } function isArrayLikeType(type) { - return !(type.flags & (32 | 64)) && isTypeAssignableTo(type, anyArrayType); + return type.flags & 4096 && (type.target === globalArrayType || type.target === globalReadonlyArrayType) || + !(type.flags & 96) && isTypeAssignableTo(type, anyReadonlyArrayType); } function isTupleLikeType(type) { return !!getPropertyOfType(type, "0"); @@ -15651,6 +17776,37 @@ var ts; function isTupleType(type) { return !!(type.flags & 8192); } + function getNullableKind(type) { + var flags = type.flags; + if (flags & 16384) { + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var t = _a[_i]; + flags |= t.flags; + } + } + return flags & 96; + } + function addNullableKind(type, kind) { + if ((getNullableKind(type) & kind) !== kind) { + var types = [type]; + if (kind & 32) { + types.push(undefinedType); + } + if (kind & 64) { + types.push(nullType); + } + type = getUnionType(types); + } + return type; + } + function getNonNullableType(type) { + return strictNullChecks ? getTypeWithFacts(type, 524288) : type; + } + function isObjectLiteralType(type) { + return type.symbol && (type.symbol.flags & (4096 | 2048)) !== 0 && + getSignaturesOfType(type, 0).length === 0 && + getSignaturesOfType(type, 1).length === 0; + } function getRegularTypeOfObjectLiteral(type) { if (type.flags & 1048576) { var regularType = type.regularType; @@ -15661,8 +17817,8 @@ var ts; regularType.properties = type.properties; regularType.callSignatures = type.callSignatures; regularType.constructSignatures = type.constructSignatures; - regularType.stringIndexType = type.stringIndexType; - regularType.numberIndexType = type.numberIndexType; + regularType.stringIndexInfo = type.stringIndexInfo; + regularType.numberIndexInfo = type.numberIndexInfo; type.regularType = regularType; } return regularType; @@ -15687,24 +17843,23 @@ var ts; } members[p.name] = p; }); - var stringIndexType = getIndexTypeOfType(type, 0); - var numberIndexType = getIndexTypeOfType(type, 1); - if (stringIndexType) - stringIndexType = getWidenedType(stringIndexType); - if (numberIndexType) - numberIndexType = getWidenedType(numberIndexType); - return createAnonymousType(type.symbol, members, emptyArray, emptyArray, stringIndexType, numberIndexType); + var stringIndexInfo = getIndexInfoOfType(type, 0); + var numberIndexInfo = getIndexInfoOfType(type, 1); + return createAnonymousType(type.symbol, members, emptyArray, emptyArray, stringIndexInfo && createIndexInfo(getWidenedType(stringIndexInfo.type), stringIndexInfo.isReadonly), numberIndexInfo && createIndexInfo(getWidenedType(numberIndexInfo.type), numberIndexInfo.isReadonly)); + } + function getWidenedConstituentType(type) { + return type.flags & 96 ? type : getWidenedType(type); } function getWidenedType(type) { if (type.flags & 6291456) { - if (type.flags & (32 | 64)) { + if (type.flags & 96) { return anyType; } if (type.flags & 524288) { return getWidenedTypeOfObjectLiteral(type); } if (type.flags & 16384) { - return getUnionType(ts.map(type.types, getWidenedType), true); + return getUnionType(ts.map(type.types, getWidenedConstituentType), true); } if (isArrayType(type)) { return createArrayType(getWidenedType(type.typeArguments[0])); @@ -15754,22 +17909,25 @@ var ts; var typeAsString = typeToString(getWidenedType(type)); var diagnostic; switch (declaration.kind) { - case 141: - case 140: + case 145: + case 144: diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type; break; - case 138: + case 142: diagnostic = declaration.dotDotDotToken ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; break; - case 213: - case 143: - case 142: - case 145: + case 169: + diagnostic = ts.Diagnostics.Binding_element_0_implicitly_has_an_1_type; + break; + case 220: + case 147: case 146: - case 173: - case 174: + case 149: + case 150: + case 179: + case 180: if (!declaration.name) { error(declaration, ts.Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString); return; @@ -15793,35 +17951,23 @@ var ts; var targetMax = target.parameters.length; var count; if (source.hasRestParameter && target.hasRestParameter) { - count = sourceMax > targetMax ? sourceMax : targetMax; - sourceMax--; - targetMax--; + count = Math.max(sourceMax, targetMax); } else if (source.hasRestParameter) { - sourceMax--; count = targetMax; } else if (target.hasRestParameter) { - targetMax--; count = sourceMax; } else { - count = sourceMax < targetMax ? sourceMax : targetMax; + count = Math.min(sourceMax, targetMax); } for (var i = 0; i < count; i++) { - var s = i < sourceMax ? getTypeOfSymbol(source.parameters[i]) : getRestTypeOfSignature(source); - var t = i < targetMax ? getTypeOfSymbol(target.parameters[i]) : getRestTypeOfSignature(target); - callback(s, t); + callback(getTypeAtPosition(source, i), getTypeAtPosition(target, i)); } } function createInferenceContext(typeParameters, inferUnionTypes) { - var inferences = []; - for (var _i = 0, typeParameters_1 = typeParameters; _i < typeParameters_1.length; _i++) { - var unused = typeParameters_1[_i]; - inferences.push({ - primary: undefined, secondary: undefined, isFixed: false - }); - } + var inferences = ts.map(typeParameters, createTypeInferencesObject); return { typeParameters: typeParameters, inferUnionTypes: inferUnionTypes, @@ -15829,11 +17975,19 @@ var ts; inferredTypes: new Array(typeParameters.length) }; } + function createTypeInferencesObject() { + return { + primary: undefined, + secondary: undefined, + isFixed: false + }; + } function inferTypes(context, source, target) { var sourceStack; var targetStack; var depth = 0; var inferiority = 0; + var visited = {}; inferFromTypes(source, target); function isInProcess(source, target) { for (var i = 0; i < depth; i++) { @@ -15844,6 +17998,21 @@ var ts; return false; } function inferFromTypes(source, target) { + if (source.flags & 16384 && target.flags & 16384 || + source.flags & 32768 && target.flags & 32768) { + var matchingTypes = void 0; + for (var _i = 0, _a = target.types; _i < _a.length; _i++) { + var t = _a[_i]; + if (typeIdenticalToSomeType(t, source.types)) { + (matchingTypes || (matchingTypes = [])).push(t); + inferFromTypes(t, t); + } + } + if (matchingTypes) { + source = removeTypesFromUnionOrIntersection(source, matchingTypes); + target = removeTypesFromUnionOrIntersection(target, matchingTypes); + } + } if (target.flags & 512) { if (source.flags & 8388608) { return; @@ -15882,9 +18051,9 @@ var ts; else if (target.flags & 49152) { var targetTypes = target.types; var typeParameterCount = 0; - var typeParameter; - for (var _i = 0, targetTypes_2 = targetTypes; _i < targetTypes_2.length; _i++) { - var t = targetTypes_2[_i]; + var typeParameter = void 0; + for (var _b = 0, targetTypes_2 = targetTypes; _b < targetTypes_2.length; _b++) { + var t = targetTypes_2[_b]; if (t.flags & 512 && ts.contains(context.typeParameters, t)) { typeParameter = t; typeParameterCount++; @@ -15901,21 +18070,27 @@ var ts; } else if (source.flags & 49152) { var sourceTypes = source.types; - for (var _a = 0, sourceTypes_3 = sourceTypes; _a < sourceTypes_3.length; _a++) { - var sourceType = sourceTypes_3[_a]; + for (var _c = 0, sourceTypes_3 = sourceTypes; _c < sourceTypes_3.length; _c++) { + var sourceType = sourceTypes_3[_c]; inferFromTypes(sourceType, target); } } else { source = getApparentType(source); - if (source.flags & 80896 && (target.flags & (4096 | 8192) || - (target.flags & 65536) && target.symbol && target.symbol.flags & (8192 | 2048 | 32))) { + if (source.flags & 80896 && (target.flags & 4096 && target.typeArguments || + target.flags & 8192 || + target.flags & 65536 && target.symbol && target.symbol.flags & (8192 | 2048 | 32))) { if (isInProcess(source, target)) { return; } if (isDeeplyNestedGeneric(source, sourceStack, depth) && isDeeplyNestedGeneric(target, targetStack, depth)) { return; } + var key = source.id + "," + target.id; + if (ts.hasProperty(visited, key)) { + return; + } + visited[key] = true; if (depth === 0) { sourceStack = []; targetStack = []; @@ -15926,9 +18101,7 @@ var ts; inferFromProperties(source, target); inferFromSignatures(source, target, 0); inferFromSignatures(source, target, 1); - inferFromIndexTypes(source, target, 0, 0); - inferFromIndexTypes(source, target, 1, 1); - inferFromIndexTypes(source, target, 0, 1); + inferFromIndexTypes(source, target); depth--; } } @@ -15955,25 +18128,52 @@ var ts; } function inferFromSignature(source, target) { forEachMatchingParameterType(source, target, inferFromTypes); - if (source.typePredicate && target.typePredicate) { - if (target.typePredicate.parameterIndex === source.typePredicate.parameterIndex) { - inferFromTypes(source.typePredicate.type, target.typePredicate.type); - } + if (source.typePredicate && target.typePredicate && source.typePredicate.kind === target.typePredicate.kind) { + inferFromTypes(source.typePredicate.type, target.typePredicate.type); } else { inferFromTypes(getReturnTypeOfSignature(source), getReturnTypeOfSignature(target)); } } - function inferFromIndexTypes(source, target, sourceKind, targetKind) { - var targetIndexType = getIndexTypeOfType(target, targetKind); - if (targetIndexType) { - var sourceIndexType = getIndexTypeOfType(source, sourceKind); + function inferFromIndexTypes(source, target) { + var targetStringIndexType = getIndexTypeOfType(target, 0); + if (targetStringIndexType) { + var sourceIndexType = getIndexTypeOfType(source, 0) || + getImplicitIndexTypeOfType(source, 0); if (sourceIndexType) { - inferFromTypes(sourceIndexType, targetIndexType); + inferFromTypes(sourceIndexType, targetStringIndexType); + } + } + var targetNumberIndexType = getIndexTypeOfType(target, 1); + if (targetNumberIndexType) { + var sourceIndexType = getIndexTypeOfType(source, 1) || + getIndexTypeOfType(source, 0) || + getImplicitIndexTypeOfType(source, 1); + if (sourceIndexType) { + inferFromTypes(sourceIndexType, targetNumberIndexType); } } } } + function typeIdenticalToSomeType(type, types) { + for (var _i = 0, types_7 = types; _i < types_7.length; _i++) { + var t = types_7[_i]; + if (isTypeIdenticalTo(t, type)) { + return true; + } + } + return false; + } + function removeTypesFromUnionOrIntersection(type, typesToRemove) { + var reducedTypes = []; + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var t = _a[_i]; + if (!typeIdenticalToSomeType(t, typesToRemove)) { + reducedTypes.push(t); + } + } + return type.flags & 16384 ? getUnionType(reducedTypes, true) : getIntersectionType(reducedTypes); + } function getInferenceCandidates(context, index) { var inferences = context.inferences[index]; return inferences.primary || inferences.secondary || emptyArray; @@ -15992,14 +18192,19 @@ var ts; inferredType = emptyObjectType; inferenceSucceeded = true; } + context.inferredTypes[index] = inferredType; if (inferenceSucceeded) { var constraint = getConstraintOfTypeParameter(context.typeParameters[index]); - inferredType = constraint && !isTypeAssignableTo(inferredType, constraint) ? constraint : inferredType; + if (constraint) { + var instantiatedConstraint = instantiateType(constraint, getInferenceMapper(context)); + if (!isTypeAssignableTo(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) { + context.inferredTypes[index] = inferredType = instantiatedConstraint; + } + } } else if (context.failedTypeParameterIndex === undefined || context.failedTypeParameterIndex > index) { context.failedTypeParameterIndex = index; } - context.inferredTypes[index] = inferredType; } return inferredType; } @@ -16009,23 +18214,20 @@ var ts; } return context.inferredTypes; } - function hasAncestor(node, kind) { - return ts.getAncestor(node, kind) !== undefined; - } function getResolvedSymbol(node) { var links = getNodeLinks(node); if (!links.resolvedSymbol) { - links.resolvedSymbol = (!ts.nodeIsMissing(node) && resolveName(node, node.text, 107455 | 1048576, ts.Diagnostics.Cannot_find_name_0, node)) || unknownSymbol; + links.resolvedSymbol = !ts.nodeIsMissing(node) && resolveName(node, node.text, 107455 | 1048576, ts.Diagnostics.Cannot_find_name_0, node) || unknownSymbol; } return links.resolvedSymbol; } function isInTypeQuery(node) { while (node) { switch (node.kind) { - case 154: + case 158: return true; case 69: - case 135: + case 139: node = node.parent; continue; default: @@ -16034,212 +18236,460 @@ var ts; } ts.Debug.fail("should not get here"); } - function removeTypesFromUnionType(type, typeKind, isOfTypeKind, allowEmptyUnionResult) { - if (type.flags & 16384) { - var types = type.types; - if (ts.forEach(types, function (t) { return !!(t.flags & typeKind) === isOfTypeKind; })) { - var narrowedType = getUnionType(ts.filter(types, function (t) { return !(t.flags & typeKind) === isOfTypeKind; })); - if (allowEmptyUnionResult || narrowedType !== emptyObjectType) { - return narrowedType; - } + function getFlowCacheKey(node) { + if (node.kind === 69) { + var symbol = getResolvedSymbol(node); + return symbol !== unknownSymbol ? "" + getSymbolId(symbol) : undefined; + } + if (node.kind === 97) { + return "0"; + } + if (node.kind === 172) { + var key = getFlowCacheKey(node.expression); + return key && key + "." + node.name.text; + } + return undefined; + } + function isNullOrUndefinedLiteral(node) { + return node.kind === 93 || + node.kind === 69 && getResolvedSymbol(node) === undefinedSymbol; + } + function getLeftmostIdentifierOrThis(node) { + switch (node.kind) { + case 69: + case 97: + return node; + case 172: + return getLeftmostIdentifierOrThis(node.expression); + } + return undefined; + } + function isMatchingReference(source, target) { + if (source.kind === target.kind) { + switch (source.kind) { + case 69: + return getResolvedSymbol(source) === getResolvedSymbol(target); + case 97: + return true; + case 172: + return source.name.text === target.name.text && + isMatchingReference(source.expression, target.expression); } } - else if (allowEmptyUnionResult && !!(type.flags & typeKind) === isOfTypeKind) { - return getUnionType(emptyArray); - } - return type; + return false; } - function hasInitializer(node) { - return !!(node.initializer || ts.isBindingPattern(node.parent) && hasInitializer(node.parent.parent)); - } - function isVariableAssignedWithin(symbol, node) { - var links = getNodeLinks(node); - if (links.assignmentChecks) { - var cachedResult = links.assignmentChecks[symbol.id]; - if (cachedResult !== undefined) { - return cachedResult; + function containsMatchingReference(source, target) { + while (source.kind === 172) { + source = source.expression; + if (isMatchingReference(source, target)) { + return true; } } - else { - links.assignmentChecks = {}; - } - return links.assignmentChecks[symbol.id] = isAssignedIn(node); - function isAssignedInBinaryExpression(node) { - if (node.operatorToken.kind >= 56 && node.operatorToken.kind <= 68) { - var n = node.left; - while (n.kind === 172) { - n = n.expression; - } - if (n.kind === 69 && getResolvedSymbol(n) === symbol) { + return false; + } + function isOrContainsMatchingReference(source, target) { + return isMatchingReference(source, target) || containsMatchingReference(source, target); + } + function hasMatchingArgument(callExpression, reference) { + if (callExpression.arguments) { + for (var _i = 0, _a = callExpression.arguments; _i < _a.length; _i++) { + var argument = _a[_i]; + if (isOrContainsMatchingReference(reference, argument)) { return true; } } - return ts.forEachChild(node, isAssignedIn); } - function isAssignedInVariableDeclaration(node) { - if (!ts.isBindingPattern(node.name) && getSymbolOfNode(node) === symbol && hasInitializer(node)) { + if (callExpression.expression.kind === 172 && + isOrContainsMatchingReference(reference, callExpression.expression.expression)) { + return true; + } + return false; + } + function getFlowNodeId(flow) { + if (!flow.id) { + flow.id = nextFlowId; + nextFlowId++; + } + return flow.id; + } + function typeMaybeAssignableTo(source, target) { + if (!(source.flags & 16384)) { + return isTypeAssignableTo(source, target); + } + for (var _i = 0, _a = source.types; _i < _a.length; _i++) { + var t = _a[_i]; + if (isTypeAssignableTo(t, target)) { return true; } - return ts.forEachChild(node, isAssignedIn); - } - function isAssignedIn(node) { - switch (node.kind) { - case 181: - return isAssignedInBinaryExpression(node); - case 211: - case 163: - return isAssignedInVariableDeclaration(node); - case 161: - case 162: - case 164: - case 165: - case 166: - case 167: - case 168: - case 169: - case 171: - case 189: - case 172: - case 179: - case 175: - case 178: - case 176: - case 177: - case 180: - case 184: - case 182: - case 185: - case 192: - case 193: - case 195: - case 196: - case 197: - case 198: - case 199: - case 200: - case 201: - case 204: - case 205: - case 206: - case 241: - case 242: - case 207: - case 208: - case 209: - case 244: - case 233: - case 234: - case 238: - case 239: - case 235: - case 240: - return ts.forEachChild(node, isAssignedIn); - } - return false; } + return false; } - function getNarrowedTypeOfSymbol(symbol, node) { - var type = getTypeOfSymbol(symbol); - if (node && symbol.flags & 3) { - if (isTypeAny(type) || type.flags & (80896 | 16384 | 512)) { - loop: while (node.parent) { - var child = node; - node = node.parent; - var narrowedType = type; - switch (node.kind) { - case 196: - if (child !== node.expression) { - narrowedType = narrowType(type, node.expression, child === node.thenStatement); - } - break; - case 182: - if (child !== node.condition) { - narrowedType = narrowType(type, node.condition, child === node.whenTrue); - } - break; - case 181: - if (child === node.right) { - if (node.operatorToken.kind === 51) { - narrowedType = narrowType(type, node.left, true); - } - else if (node.operatorToken.kind === 52) { - narrowedType = narrowType(type, node.left, false); - } - } - break; - case 248: - case 218: - case 213: - case 143: - case 142: - case 145: - case 146: - case 144: - break loop; - } - if (narrowedType !== type) { - if (isVariableAssignedWithin(symbol, node)) { - break; - } - type = narrowedType; + function getAssignmentReducedType(declaredType, assignedType) { + if (declaredType !== assignedType && declaredType.flags & 16384) { + var reducedTypes = ts.filter(declaredType.types, function (t) { return typeMaybeAssignableTo(assignedType, t); }); + if (reducedTypes.length) { + return reducedTypes.length === 1 ? reducedTypes[0] : getUnionType(reducedTypes); + } + } + return declaredType; + } + function getTypeFacts(type) { + var flags = type.flags; + if (flags & 258) { + return strictNullChecks ? 4079361 : 4194049; + } + if (flags & 132) { + return strictNullChecks ? 4079234 : 4193922; + } + if (flags & 8) { + return strictNullChecks ? 4078980 : 4193668; + } + if (flags & 80896) { + var resolved = resolveStructuredTypeMembers(type); + return resolved.callSignatures.length || resolved.constructSignatures.length || isTypeSubtypeOf(type, globalFunctionType) ? + strictNullChecks ? 1970144 : 4181984 : + strictNullChecks ? 1972176 : 4184016; + } + if (flags & (16 | 32)) { + return 2457472; + } + if (flags & 64) { + return 2340752; + } + if (flags & 16777216) { + return strictNullChecks ? 1981320 : 4193160; + } + if (flags & 512) { + var constraint = getConstraintOfTypeParameter(type); + return constraint ? getTypeFacts(constraint) : 4194303; + } + if (flags & 32768) { + return ts.reduceLeft(type.types, function (flags, type) { return flags |= getTypeFacts(type); }, 0); + } + return 4194303; + } + function getTypeWithFacts(type, include) { + if (!(type.flags & 16384)) { + return getTypeFacts(type) & include ? type : neverType; + } + var firstType; + var types; + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var t = _a[_i]; + if (getTypeFacts(t) & include) { + if (!firstType) { + firstType = t; + } + else { + if (!types) { + types = [firstType]; } + types.push(t); } } } + return firstType ? types ? getUnionType(types, true) : firstType : neverType; + } + function getTypeWithDefault(type, defaultExpression) { + if (defaultExpression) { + var defaultType = checkExpression(defaultExpression); + return getUnionType([getTypeWithFacts(type, 131072), defaultType]); + } return type; - function narrowTypeByEquality(type, expr, assumeTrue) { - if (expr.left.kind !== 176 || expr.right.kind !== 9) { + } + function getTypeOfDestructuredProperty(type, name) { + var text = getTextOfPropertyName(name); + return getTypeOfPropertyOfType(type, text) || + isNumericLiteralName(text) && getIndexTypeOfType(type, 1) || + getIndexTypeOfType(type, 0) || + unknownType; + } + function getTypeOfDestructuredArrayElement(type, index) { + return isTupleLikeType(type) && getTypeOfPropertyOfType(type, "" + index) || + checkIteratedTypeOrElementType(type, undefined, false) || + unknownType; + } + function getTypeOfDestructuredSpreadElement(type) { + return createArrayType(checkIteratedTypeOrElementType(type, undefined, false) || unknownType); + } + function getAssignedTypeOfBinaryExpression(node) { + return node.parent.kind === 170 || node.parent.kind === 253 ? + getTypeWithDefault(getAssignedType(node), node.right) : + checkExpression(node.right); + } + function getAssignedTypeOfArrayLiteralElement(node, element) { + return getTypeOfDestructuredArrayElement(getAssignedType(node), ts.indexOf(node.elements, element)); + } + function getAssignedTypeOfSpreadElement(node) { + return getTypeOfDestructuredSpreadElement(getAssignedType(node.parent)); + } + function getAssignedTypeOfPropertyAssignment(node) { + return getTypeOfDestructuredProperty(getAssignedType(node.parent), node.name); + } + function getAssignedTypeOfShorthandPropertyAssignment(node) { + return getTypeWithDefault(getAssignedTypeOfPropertyAssignment(node), node.objectAssignmentInitializer); + } + function getAssignedType(node) { + var parent = node.parent; + switch (parent.kind) { + case 207: + return stringType; + case 208: + return checkRightHandSideOfForOf(parent.expression) || unknownType; + case 187: + return getAssignedTypeOfBinaryExpression(parent); + case 181: + return undefinedType; + case 170: + return getAssignedTypeOfArrayLiteralElement(parent, node); + case 191: + return getAssignedTypeOfSpreadElement(parent); + case 253: + return getAssignedTypeOfPropertyAssignment(parent); + case 254: + return getAssignedTypeOfShorthandPropertyAssignment(parent); + } + return unknownType; + } + function getInitialTypeOfBindingElement(node) { + var pattern = node.parent; + var parentType = getInitialType(pattern.parent); + var type = pattern.kind === 167 ? + getTypeOfDestructuredProperty(parentType, node.propertyName || node.name) : + !node.dotDotDotToken ? + getTypeOfDestructuredArrayElement(parentType, ts.indexOf(pattern.elements, node)) : + getTypeOfDestructuredSpreadElement(parentType); + return getTypeWithDefault(type, node.initializer); + } + function getTypeOfInitializer(node) { + var links = getNodeLinks(node); + return links.resolvedType || checkExpression(node); + } + function getInitialTypeOfVariableDeclaration(node) { + if (node.initializer) { + return getTypeOfInitializer(node.initializer); + } + if (node.parent.parent.kind === 207) { + return stringType; + } + if (node.parent.parent.kind === 208) { + return checkRightHandSideOfForOf(node.parent.parent.expression) || unknownType; + } + return unknownType; + } + function getInitialType(node) { + return node.kind === 218 ? + getInitialTypeOfVariableDeclaration(node) : + getInitialTypeOfBindingElement(node); + } + function getFlowTypeOfReference(reference, declaredType, assumeInitialized) { + var key; + if (!reference.flowNode || assumeInitialized && !(declaredType.flags & 97793)) { + return declaredType; + } + var initialType = assumeInitialized ? declaredType : addNullableKind(declaredType, 32); + var visitedFlowStart = visitedFlowCount; + var result = getTypeAtFlowNode(reference.flowNode); + visitedFlowCount = visitedFlowStart; + if (reference.parent.kind === 196 && getTypeWithFacts(result, 524288) === neverType) { + return declaredType; + } + return result; + function getTypeAtFlowNode(flow) { + while (true) { + if (flow.flags & 256) { + for (var i = visitedFlowStart; i < visitedFlowCount; i++) { + if (visitedFlowNodes[i] === flow) { + return visitedFlowTypes[i]; + } + } + } + var type = void 0; + if (flow.flags & 16) { + type = getTypeAtFlowAssignment(flow); + if (!type) { + flow = flow.antecedent; + continue; + } + } + else if (flow.flags & 96) { + type = getTypeAtFlowCondition(flow); + } + else if (flow.flags & 12) { + if (flow.antecedents.length === 1) { + flow = flow.antecedents[0]; + continue; + } + type = flow.flags & 4 ? + getTypeAtFlowBranchLabel(flow) : + getTypeAtFlowLoopLabel(flow); + } + else if (flow.flags & 1) { + type = declaredType; + } + else { + type = initialType; + } + if (flow.flags & 256) { + visitedFlowNodes[visitedFlowCount] = flow; + visitedFlowTypes[visitedFlowCount] = type; + visitedFlowCount++; + } return type; } - var left = expr.left; - var right = expr.right; - if (left.expression.kind !== 69 || getResolvedSymbol(left.expression) !== symbol) { - return type; + } + function getTypeAtFlowAssignment(flow) { + var node = flow.node; + if ((node.kind === 218 || node.kind === 169) && + reference.kind === 69 && + getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(reference)) === getSymbolOfNode(node)) { + return declaredType.flags & 16384 ? + getAssignmentReducedType(declaredType, getInitialType(node)) : + declaredType; } - var typeInfo = primitiveTypeInfo[right.text]; - if (expr.operatorToken.kind === 33) { + if (isMatchingReference(reference, node)) { + return declaredType.flags & 16384 ? + getAssignmentReducedType(declaredType, getAssignedType(node)) : + declaredType; + } + if (containsMatchingReference(reference, node)) { + return declaredType; + } + return undefined; + } + function getTypeAtFlowCondition(flow) { + var type = getTypeAtFlowNode(flow.antecedent); + if (type !== neverType) { + var assumeTrue = (flow.flags & 32) !== 0; + type = narrowType(type, flow.expression, assumeTrue); + if (type === neverType) { + type = narrowType(declaredType, flow.expression, assumeTrue); + } + } + return type; + } + function getTypeAtFlowBranchLabel(flow) { + var antecedentTypes = []; + for (var _i = 0, _a = flow.antecedents; _i < _a.length; _i++) { + var antecedent = _a[_i]; + var type = getTypeAtFlowNode(antecedent); + if (type === declaredType && declaredType === initialType) { + return type; + } + if (!ts.contains(antecedentTypes, type)) { + antecedentTypes.push(type); + } + } + return getUnionType(antecedentTypes); + } + function getTypeAtFlowLoopLabel(flow) { + var id = getFlowNodeId(flow); + var cache = flowLoopCaches[id] || (flowLoopCaches[id] = {}); + if (!key) { + key = getFlowCacheKey(reference); + } + if (cache[key]) { + return cache[key]; + } + for (var i = flowLoopStart; i < flowLoopCount; i++) { + if (flowLoopNodes[i] === flow && flowLoopKeys[i] === key) { + return getUnionType(flowLoopTypes[i]); + } + } + var antecedentTypes = []; + flowLoopNodes[flowLoopCount] = flow; + flowLoopKeys[flowLoopCount] = key; + flowLoopTypes[flowLoopCount] = antecedentTypes; + for (var _i = 0, _a = flow.antecedents; _i < _a.length; _i++) { + var antecedent = _a[_i]; + flowLoopCount++; + var type = getTypeAtFlowNode(antecedent); + flowLoopCount--; + if (cache[key]) { + return cache[key]; + } + if (!ts.contains(antecedentTypes, type)) { + antecedentTypes.push(type); + } + if (type === declaredType) { + break; + } + } + return cache[key] = getUnionType(antecedentTypes); + } + function narrowTypeByTruthiness(type, expr, assumeTrue) { + return isMatchingReference(reference, expr) ? getTypeWithFacts(type, assumeTrue ? 1048576 : 2097152) : type; + } + function narrowTypeByBinaryExpression(type, expr, assumeTrue) { + switch (expr.operatorToken.kind) { + case 56: + return narrowTypeByTruthiness(type, expr.left, assumeTrue); + case 30: + case 31: + case 32: + case 33: + if (isNullOrUndefinedLiteral(expr.right)) { + return narrowTypeByNullCheck(type, expr, assumeTrue); + } + if (expr.left.kind === 182 && expr.right.kind === 9) { + return narrowTypeByTypeof(type, expr, assumeTrue); + } + break; + case 91: + return narrowTypeByInstanceof(type, expr, assumeTrue); + case 24: + return narrowType(type, expr.right, assumeTrue); + } + return type; + } + function narrowTypeByNullCheck(type, expr, assumeTrue) { + var operator = expr.operatorToken.kind; + if (operator === 31 || operator === 33) { assumeTrue = !assumeTrue; } - if (assumeTrue) { - if (!typeInfo) { - return removeTypesFromUnionType(type, 258 | 132 | 8 | 16777216, true, false); - } - if (isTypeSubtypeOf(typeInfo.type, type)) { - return typeInfo.type; - } - return removeTypesFromUnionType(type, typeInfo.flags, false, false); + if (!strictNullChecks || !isMatchingReference(reference, expr.left)) { + return type; } - else { - if (typeInfo) { - return removeTypesFromUnionType(type, typeInfo.flags, true, false); + var doubleEquals = operator === 30 || operator === 31; + var facts = doubleEquals ? + assumeTrue ? 65536 : 524288 : + expr.right.kind === 93 ? + assumeTrue ? 32768 : 262144 : + assumeTrue ? 16384 : 131072; + return getTypeWithFacts(type, facts); + } + function narrowTypeByTypeof(type, expr, assumeTrue) { + var left = expr.left; + var right = expr.right; + if (!isMatchingReference(reference, left.expression)) { + if (containsMatchingReference(reference, left.expression)) { + return declaredType; } return type; } - } - function narrowTypeByAnd(type, expr, assumeTrue) { - if (assumeTrue) { - return narrowType(narrowType(type, expr.left, true), expr.right, true); + if (expr.operatorToken.kind === 31 || + expr.operatorToken.kind === 33) { + assumeTrue = !assumeTrue; } - else { - return getUnionType([ - narrowType(type, expr.left, false), - narrowType(narrowType(type, expr.left, true), expr.right, false) - ]); - } - } - function narrowTypeByOr(type, expr, assumeTrue) { - if (assumeTrue) { - return getUnionType([ - narrowType(type, expr.left, true), - narrowType(narrowType(type, expr.left, false), expr.right, true) - ]); - } - else { - return narrowType(narrowType(type, expr.left, false), expr.right, false); + if (assumeTrue && !(type.flags & 16384)) { + var targetType = ts.getProperty(typeofTypesByName, right.text); + if (targetType && isTypeSubtypeOf(targetType, type)) { + return targetType; + } } + var facts = assumeTrue ? + ts.getProperty(typeofEQFacts, right.text) || 64 : + ts.getProperty(typeofNEFacts, right.text) || 8192; + return getTypeWithFacts(type, facts); } function narrowTypeByInstanceof(type, expr, assumeTrue) { - if (isTypeAny(type) || expr.left.kind !== 69 || getResolvedSymbol(expr.left) !== symbol) { + if (!isMatchingReference(reference, expr.left)) { + if (containsMatchingReference(reference, expr.left)) { + return declaredType; + } + return type; + } + if (isTypeAny(type)) { return type; } var rightType = checkExpression(expr.right); @@ -16255,7 +18705,7 @@ var ts; } } if (!targetType) { - var constructSignatures; + var constructSignatures = void 0; if (rightType.flags & 2048) { constructSignatures = resolveDeclaredMembers(rightType).declaredConstructSignatures; } @@ -16267,68 +18717,75 @@ var ts; } } if (targetType) { - if (!assumeTrue) { - if (type.flags & 16384) { - return getUnionType(ts.filter(type.types, function (t) { return !isTypeSubtypeOf(t, targetType); })); - } - return type; - } - return getNarrowedType(type, targetType); + return getNarrowedType(type, targetType, assumeTrue); } return type; } - function getNarrowedType(originalType, narrowedTypeCandidate) { - if (originalType.flags & 16384) { - var assignableConstituents = ts.filter(originalType.types, function (t) { return isTypeAssignableTo(t, narrowedTypeCandidate); }); + function getNarrowedType(type, candidate, assumeTrue) { + if (!assumeTrue) { + return type.flags & 16384 ? + getUnionType(ts.filter(type.types, function (t) { return !isTypeSubtypeOf(t, candidate); })) : + type; + } + if (type.flags & 16384) { + var assignableConstituents = ts.filter(type.types, function (t) { return isTypeAssignableTo(t, candidate); }); if (assignableConstituents.length) { return getUnionType(assignableConstituents); } } - if (isTypeAssignableTo(narrowedTypeCandidate, originalType)) { - return narrowedTypeCandidate; - } - return originalType; + var targetType = type.flags & 512 ? getApparentType(type) : type; + return isTypeAssignableTo(candidate, targetType) ? candidate : + isTypeAssignableTo(type, candidate) ? type : + neverType; } - function narrowTypeByTypePredicate(type, expr, assumeTrue) { - if (type.flags & 1) { + function narrowTypeByTypePredicate(type, callExpression, assumeTrue) { + if (type.flags & 1 || !hasMatchingArgument(callExpression, reference)) { return type; } - var signature = getResolvedSignature(expr); - if (signature.typePredicate && - expr.arguments[signature.typePredicate.parameterIndex] && - getSymbolAtLocation(expr.arguments[signature.typePredicate.parameterIndex]) === symbol) { - if (!assumeTrue) { - if (type.flags & 16384) { - return getUnionType(ts.filter(type.types, function (t) { return !isTypeSubtypeOf(t, signature.typePredicate.type); })); + var signature = getResolvedSignature(callExpression); + var predicate = signature.typePredicate; + if (!predicate) { + return type; + } + if (ts.isIdentifierTypePredicate(predicate)) { + var predicateArgument = callExpression.arguments[predicate.parameterIndex]; + if (predicateArgument) { + if (isMatchingReference(reference, predicateArgument)) { + return getNarrowedType(type, predicate.type, assumeTrue); + } + if (containsMatchingReference(reference, predicateArgument)) { + return declaredType; + } + } + } + else { + var invokedExpression = skipParenthesizedNodes(callExpression.expression); + if (invokedExpression.kind === 173 || invokedExpression.kind === 172) { + var accessExpression = invokedExpression; + var possibleReference = skipParenthesizedNodes(accessExpression.expression); + if (isMatchingReference(reference, possibleReference)) { + return getNarrowedType(type, predicate.type, assumeTrue); + } + if (containsMatchingReference(reference, possibleReference)) { + return declaredType; } - return type; } - return getNarrowedType(type, signature.typePredicate.type); } return type; } function narrowType(type, expr, assumeTrue) { switch (expr.kind) { - case 168: - return narrowTypeByTypePredicate(type, expr, assumeTrue); + case 69: + case 97: case 172: + return narrowTypeByTruthiness(type, expr, assumeTrue); + case 174: + return narrowTypeByTypePredicate(type, expr, assumeTrue); + case 178: return narrowType(type, expr.expression, assumeTrue); - case 181: - var operator = expr.operatorToken.kind; - if (operator === 32 || operator === 33) { - return narrowTypeByEquality(type, expr, assumeTrue); - } - else if (operator === 51) { - return narrowTypeByAnd(type, expr, assumeTrue); - } - else if (operator === 52) { - return narrowTypeByOr(type, expr, assumeTrue); - } - else if (operator === 91) { - return narrowTypeByInstanceof(type, expr, assumeTrue); - } - break; - case 179: + case 187: + return narrowTypeByBinaryExpression(type, expr, assumeTrue); + case 185: if (expr.operator === 49) { return narrowType(type, expr.operand, !assumeTrue); } @@ -16337,27 +18794,74 @@ var ts; return type; } } + function getTypeOfSymbolAtLocation(symbol, location) { + if (location.kind === 69) { + if (ts.isRightSideOfQualifiedNameOrPropertyAccess(location)) { + location = location.parent; + } + if (ts.isExpression(location) && !ts.isAssignmentTarget(location)) { + var type = checkExpression(location); + if (getExportSymbolOfValueSymbolIfExported(getNodeLinks(location).resolvedSymbol) === symbol) { + return type; + } + } + } + return getTypeOfSymbol(symbol); + } + function skipParenthesizedNodes(expression) { + while (expression.kind === 178) { + expression = expression.expression; + } + return expression; + } function checkIdentifier(node) { var symbol = getResolvedSymbol(node); if (symbol === argumentsSymbol) { var container = ts.getContainingFunction(node); - if (container.kind === 174) { + if (container.kind === 180) { if (languageVersion < 2) { error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression); } } - if (node.parserContextFlags & 8) { - getNodeLinks(container).flags |= 4096; - getNodeLinks(node).flags |= 2048; + if (node.flags & 33554432) { + getNodeLinks(container).flags |= 8192; } } if (symbol.flags & 8388608 && !isInTypeQuery(node) && !isConstEnumOrConstEnumOnlyModule(resolveAlias(symbol))) { markAliasSymbolAsReferenced(symbol); } + var localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol); + if (languageVersion === 2 + && localOrExportSymbol.flags & 32 + && localOrExportSymbol.valueDeclaration.kind === 221 + && ts.nodeIsDecorated(localOrExportSymbol.valueDeclaration)) { + var container = ts.getContainingClass(node); + while (container !== undefined) { + if (container === localOrExportSymbol.valueDeclaration && container.name !== node) { + getNodeLinks(container).flags |= 524288; + getNodeLinks(node).flags |= 1048576; + break; + } + container = ts.getContainingClass(container); + } + } checkCollisionWithCapturedSuperVariable(node, node); checkCollisionWithCapturedThisVariable(node, node); - checkBlockScopedBindingCapturedInLoop(node, symbol); - return getNarrowedTypeOfSymbol(getExportSymbolOfValueSymbolIfExported(symbol), node); + checkNestedBlockScopedBinding(node, symbol); + var type = getTypeOfSymbol(localOrExportSymbol); + if (!(localOrExportSymbol.flags & 3) || ts.isAssignmentTarget(node)) { + return type; + } + var declaration = localOrExportSymbol.valueDeclaration; + var assumeInitialized = !strictNullChecks || (type.flags & 1) !== 0 || !declaration || + ts.getRootDeclaration(declaration).kind === 142 || ts.isInAmbientContext(declaration) || + ts.getContainingFunctionOrModule(declaration) !== ts.getContainingFunctionOrModule(node); + var flowType = getFlowTypeOfReference(node, type, assumeInitialized); + if (!assumeInitialized && !(getNullableKind(type) & 32) && getNullableKind(flowType) & 32) { + error(node, ts.Diagnostics.Variable_0_is_used_before_being_assigned, symbolToString(symbol)); + return type; + } + return flowType; } function isInsideFunction(node, threshold) { var current = node; @@ -16369,42 +18873,67 @@ var ts; } return false; } - function checkBlockScopedBindingCapturedInLoop(node, symbol) { + function checkNestedBlockScopedBinding(node, symbol) { if (languageVersion >= 2 || (symbol.flags & (2 | 32)) === 0 || - symbol.valueDeclaration.parent.kind === 244) { + symbol.valueDeclaration.parent.kind === 252) { return; } - var container; - if (symbol.flags & 32) { - container = getClassLikeDeclarationOfSymbol(symbol).parent; - } - else { - container = symbol.valueDeclaration; - while (container.kind !== 212) { - container = container.parent; - } - container = container.parent; - if (container.kind === 193) { - container = container.parent; - } - } - var inFunction = isInsideFunction(node.parent, container); + var container = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration); + var usedInFunction = isInsideFunction(node.parent, container); var current = container; + var containedInIterationStatement = false; while (current && !ts.nodeStartsNewLexicalEnvironment(current)) { if (ts.isIterationStatement(current, false)) { - if (inFunction) { - getNodeLinks(current).flags |= 65536; - } - getNodeLinks(symbol.valueDeclaration).flags |= 16384; + containedInIterationStatement = true; break; } current = current.parent; } + if (containedInIterationStatement) { + if (usedInFunction) { + getNodeLinks(current).flags |= 65536; + } + if (container.kind === 206 && + ts.getAncestor(symbol.valueDeclaration, 219).parent === container && + isAssignedInBodyOfForStatement(node, container)) { + getNodeLinks(symbol.valueDeclaration).flags |= 2097152; + } + getNodeLinks(symbol.valueDeclaration).flags |= 262144; + } + if (usedInFunction) { + getNodeLinks(symbol.valueDeclaration).flags |= 131072; + } + } + function isAssignedInBodyOfForStatement(node, container) { + var current = node; + while (current.parent.kind === 178) { + current = current.parent; + } + var isAssigned = false; + if (ts.isAssignmentTarget(current)) { + isAssigned = true; + } + else if ((current.parent.kind === 185 || current.parent.kind === 186)) { + var expr = current.parent; + isAssigned = expr.operator === 41 || expr.operator === 42; + } + if (!isAssigned) { + return false; + } + while (current !== container) { + if (current === container.statement) { + return true; + } + else { + current = current.parent; + } + } + return false; } function captureLexicalThis(node, container) { getNodeLinks(node).flags |= 2; - if (container.kind === 141 || container.kind === 144) { + if (container.kind === 145 || container.kind === 148) { var classNode = container.parent; getNodeLinks(classNode).flags |= 4; } @@ -16412,98 +18941,194 @@ var ts; getNodeLinks(container).flags |= 4; } } + function findFirstSuperCall(n) { + if (ts.isSuperCallExpression(n)) { + return n; + } + else if (ts.isFunctionLike(n)) { + return undefined; + } + return ts.forEachChild(n, findFirstSuperCall); + } + function getSuperCallInConstructor(constructor) { + var links = getNodeLinks(constructor); + if (links.hasSuperCall === undefined) { + links.superCall = findFirstSuperCall(constructor.body); + links.hasSuperCall = links.superCall ? true : false; + } + return links.superCall; + } + function classDeclarationExtendsNull(classDecl) { + var classSymbol = getSymbolOfNode(classDecl); + var classInstanceType = getDeclaredTypeOfSymbol(classSymbol); + var baseConstructorType = getBaseConstructorTypeOfClass(classInstanceType); + return baseConstructorType === nullType; + } function checkThisExpression(node) { var container = ts.getThisContainer(node, true); var needToCaptureLexicalThis = false; - if (container.kind === 174) { + if (container.kind === 148) { + var containingClassDecl = container.parent; + var baseTypeNode = ts.getClassExtendsHeritageClauseElement(containingClassDecl); + if (baseTypeNode && !classDeclarationExtendsNull(containingClassDecl)) { + var superCall = getSuperCallInConstructor(container); + if (!superCall || superCall.end > node.pos) { + error(node, ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class); + } + } + } + if (container.kind === 180) { container = ts.getThisContainer(container, false); needToCaptureLexicalThis = (languageVersion < 2); } switch (container.kind) { - case 218: + case 225: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body); break; - case 217: + case 224: error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location); break; - case 144: + case 148: if (isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_constructor_arguments); } break; - case 141: - case 140: - if (container.flags & 64) { + case 145: + case 144: + if (container.flags & 32) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_static_property_initializer); } break; - case 136: + case 140: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_computed_property_name); break; } if (needToCaptureLexicalThis) { captureLexicalThis(node, container); } + if (ts.isFunctionLike(container)) { + if (container.kind === 179 && + ts.isInJavaScriptFile(container.parent) && + ts.getSpecialPropertyAssignmentKind(container.parent) === 3) { + var className = container.parent + .left + .expression + .expression; + var classSymbol = checkExpression(className).symbol; + if (classSymbol && classSymbol.members && (classSymbol.flags & 16)) { + return getInferredClassType(classSymbol); + } + } + var type = getContextuallyTypedThisType(container); + if (type) { + return type; + } + var signature = getSignatureFromDeclaration(container); + if (signature.thisType) { + return signature.thisType; + } + } if (ts.isClassLike(container.parent)) { var symbol = getSymbolOfNode(container.parent); - return container.flags & 64 ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol).thisType; + var type = container.flags & 32 ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol).thisType; + return getFlowTypeOfReference(node, type, true); + } + if (ts.isInJavaScriptFile(node)) { + var type = getTypeForThisExpressionFromJSDoc(container); + if (type && type !== unknownType) { + return type; + } + } + if (compilerOptions.noImplicitThis) { + error(node, ts.Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation); } return anyType; } + function getTypeForThisExpressionFromJSDoc(node) { + var typeTag = ts.getJSDocTypeTag(node); + if (typeTag && typeTag.typeExpression && typeTag.typeExpression.type && typeTag.typeExpression.type.kind === 269) { + var jsDocFunctionType = typeTag.typeExpression.type; + if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].type.kind === 272) { + return getTypeFromTypeNode(jsDocFunctionType.parameters[0].type); + } + } + } function isInConstructorArgumentInitializer(node, constructorDecl) { for (var n = node; n && n !== constructorDecl; n = n.parent) { - if (n.kind === 138) { + if (n.kind === 142) { return true; } } return false; } function checkSuperExpression(node) { - var isCallExpression = node.parent.kind === 168 && node.parent.expression === node; - var classDeclaration = ts.getContainingClass(node); - var classType = classDeclaration && getDeclaredTypeOfSymbol(getSymbolOfNode(classDeclaration)); - var baseClassType = classType && getBaseTypes(classType)[0]; + var isCallExpression = node.parent.kind === 174 && node.parent.expression === node; var container = ts.getSuperContainer(node, true); var needToCaptureLexicalThis = false; if (!isCallExpression) { - while (container && container.kind === 174) { + while (container && container.kind === 180) { container = ts.getSuperContainer(container, true); needToCaptureLexicalThis = languageVersion < 2; } } var canUseSuperExpression = isLegalUsageOfSuperExpression(container); var nodeCheckFlag = 0; - if (canUseSuperExpression) { - if ((container.flags & 64) || isCallExpression) { - nodeCheckFlag = 512; - } - else { - nodeCheckFlag = 256; - } - getNodeLinks(node).flags |= nodeCheckFlag; - if (needToCaptureLexicalThis) { - captureLexicalThis(node.parent, container); - } - } - if (!baseClassType) { - if (!classDeclaration || !ts.getClassExtendsHeritageClauseElement(classDeclaration)) { - error(node, ts.Diagnostics.super_can_only_be_referenced_in_a_derived_class); - } - return unknownType; - } if (!canUseSuperExpression) { - if (container && container.kind === 136) { + var current = node; + while (current && current !== container && current.kind !== 140) { + current = current.parent; + } + if (current && current.kind === 140) { error(node, ts.Diagnostics.super_cannot_be_referenced_in_a_computed_property_name); } else if (isCallExpression) { error(node, ts.Diagnostics.Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors); } + else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 171)) { + error(node, ts.Diagnostics.super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions); + } else { error(node, ts.Diagnostics.super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class); } return unknownType; } - if (container.kind === 144 && isInConstructorArgumentInitializer(node, container)) { + if ((container.flags & 32) || isCallExpression) { + nodeCheckFlag = 512; + } + else { + nodeCheckFlag = 256; + } + getNodeLinks(node).flags |= nodeCheckFlag; + if (container.kind === 147 && container.flags & 256) { + if (ts.isSuperPropertyOrElementAccess(node.parent) && ts.isAssignmentTarget(node.parent)) { + getNodeLinks(container).flags |= 4096; + } + else { + getNodeLinks(container).flags |= 2048; + } + } + if (needToCaptureLexicalThis) { + captureLexicalThis(node.parent, container); + } + if (container.parent.kind === 171) { + if (languageVersion < 2) { + error(node, ts.Diagnostics.super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher); + return unknownType; + } + else { + return anyType; + } + } + var classLikeDeclaration = container.parent; + var classType = getDeclaredTypeOfSymbol(getSymbolOfNode(classLikeDeclaration)); + var baseClassType = classType && getBaseTypes(classType)[0]; + if (!baseClassType) { + if (!ts.getClassExtendsHeritageClauseElement(classLikeDeclaration)) { + error(node, ts.Diagnostics.super_can_only_be_referenced_in_a_derived_class); + } + return unknownType; + } + if (container.kind === 148 && isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.super_cannot_be_referenced_in_constructor_arguments); return unknownType; } @@ -16515,59 +19140,98 @@ var ts; return false; } if (isCallExpression) { - return container.kind === 144; + return container.kind === 148; } else { - if (container && ts.isClassLike(container.parent)) { - if (container.flags & 64) { - return container.kind === 143 || - container.kind === 142 || - container.kind === 145 || - container.kind === 146; + if (ts.isClassLike(container.parent) || container.parent.kind === 171) { + if (container.flags & 32) { + return container.kind === 147 || + container.kind === 146 || + container.kind === 149 || + container.kind === 150; } else { - return container.kind === 143 || - container.kind === 142 || - container.kind === 145 || + return container.kind === 147 || container.kind === 146 || - container.kind === 141 || - container.kind === 140 || - container.kind === 144; + container.kind === 149 || + container.kind === 150 || + container.kind === 145 || + container.kind === 144 || + container.kind === 148; } } } return false; } } + function getContextuallyTypedThisType(func) { + if (isContextSensitiveFunctionOrObjectLiteralMethod(func) && func.kind !== 180) { + var contextualSignature = getContextualSignature(func); + if (contextualSignature) { + return contextualSignature.thisType; + } + } + return undefined; + } function getContextuallyTypedParameterType(parameter) { var func = parameter.parent; - if (isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) { - if (isContextSensitive(func)) { - var contextualSignature = getContextualSignature(func); - if (contextualSignature) { - var funcHasRestParameters = ts.hasRestParameter(func); - var len = func.parameters.length - (funcHasRestParameters ? 1 : 0); - var indexOfParameter = ts.indexOf(func.parameters, parameter); - if (indexOfParameter < len) { - return getTypeAtPosition(contextualSignature, indexOfParameter); - } - if (funcHasRestParameters && - indexOfParameter === (func.parameters.length - 1) && - isRestParameterIndex(contextualSignature, func.parameters.length - 1)) { - return getTypeOfSymbol(ts.lastOrUndefined(contextualSignature.parameters)); + if (isContextSensitiveFunctionOrObjectLiteralMethod(func)) { + var iife = getImmediatelyInvokedFunctionExpression(func); + if (iife) { + var indexOfParameter = ts.indexOf(func.parameters, parameter); + if (iife.arguments && indexOfParameter < iife.arguments.length) { + if (parameter.dotDotDotToken) { + var restTypes = []; + for (var i = indexOfParameter; i < iife.arguments.length; i++) { + restTypes.push(getTypeOfExpression(iife.arguments[i])); + } + return createArrayType(getUnionType(restTypes)); } + var links = getNodeLinks(iife); + var cached = links.resolvedSignature; + links.resolvedSignature = anySignature; + var type = checkExpression(iife.arguments[indexOfParameter]); + links.resolvedSignature = cached; + return type; + } + } + var contextualSignature = getContextualSignature(func); + if (contextualSignature) { + var funcHasRestParameters = ts.hasRestParameter(func); + var len = func.parameters.length - (funcHasRestParameters ? 1 : 0); + var indexOfParameter = ts.indexOf(func.parameters, parameter); + if (indexOfParameter < len) { + return getTypeAtPosition(contextualSignature, indexOfParameter); + } + if (funcHasRestParameters && + indexOfParameter === (func.parameters.length - 1) && + isRestParameterIndex(contextualSignature, func.parameters.length - 1)) { + return getTypeOfSymbol(ts.lastOrUndefined(contextualSignature.parameters)); } } } return undefined; } + function getImmediatelyInvokedFunctionExpression(func) { + if (isFunctionExpressionOrArrowFunction(func)) { + var prev = func; + var parent_8 = func.parent; + while (parent_8.kind === 178) { + prev = parent_8; + parent_8 = parent_8.parent; + } + if (parent_8.kind === 174 && parent_8.expression === prev) { + return parent_8; + } + } + } function getContextualTypeForInitializerExpression(node) { var declaration = node.parent; if (node === declaration.initializer) { if (declaration.type) { return getTypeFromTypeNode(declaration.type); } - if (declaration.kind === 138) { + if (declaration.kind === 142) { var type = getContextuallyTypedParameterType(declaration); if (type) { return type; @@ -16576,6 +19240,18 @@ var ts; if (ts.isBindingPattern(declaration.name)) { return getTypeFromBindingPattern(declaration.name, true); } + if (ts.isBindingPattern(declaration.parent)) { + var parentDeclaration = declaration.parent.parent; + var name_11 = declaration.propertyName || declaration.name; + if (ts.isVariableLike(parentDeclaration) && + parentDeclaration.type && + !ts.isBindingPattern(name_11)) { + var text = getTextOfPropertyName(name_11); + if (text) { + return getTypeOfPropertyOfType(getTypeFromTypeNode(parentDeclaration.type), text); + } + } + } } return undefined; } @@ -16600,7 +19276,7 @@ var ts; } function isInParameterInitializerBeforeContainingFunction(node) { while (node.parent && !ts.isFunctionLike(node.parent)) { - if (node.parent.kind === 138 && node.parent.initializer === node) { + if (node.parent.kind === 142 && node.parent.initializer === node) { return true; } node = node.parent; @@ -16609,8 +19285,8 @@ var ts; } function getContextualReturnType(functionDecl) { if (functionDecl.type || - functionDecl.kind === 144 || - functionDecl.kind === 145 && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(functionDecl.symbol, 146))) { + functionDecl.kind === 148 || + functionDecl.kind === 149 && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(functionDecl.symbol, 150))) { return getReturnTypeOfSignature(getSignatureFromDeclaration(functionDecl)); } var signature = getContextualSignatureForFunctionLikeDeclaration(functionDecl); @@ -16623,13 +19299,13 @@ var ts; var args = getEffectiveCallArguments(callTarget); var argIndex = ts.indexOf(args, arg); if (argIndex >= 0) { - var signature = getResolvedSignature(callTarget); + var signature = getResolvedOrAnySignature(callTarget); return getTypeAtPosition(signature, argIndex); } return undefined; } function getContextualTypeForSubstitutionExpression(template, substitutionExpression) { - if (template.parent.kind === 170) { + if (template.parent.kind === 176) { return getContextualTypeForArgument(template.parent, substitutionExpression); } return undefined; @@ -16649,6 +19325,11 @@ var ts; } return type; } + else if (operator === 51 || operator === 24) { + if (node === binaryExpression.right) { + return getContextualType(binaryExpression); + } + } return undefined; } function applyToContextualType(type, mapper) { @@ -16658,8 +19339,8 @@ var ts; var types = type.types; var mappedType; var mappedTypes; - for (var _i = 0, types_7 = types; _i < types_7.length; _i++) { - var current = types_7[_i]; + for (var _i = 0, types_8 = types; _i < types_8.length; _i++) { + var current = types_8[_i]; var t = mapper(current); if (t) { if (!mappedType) { @@ -16690,9 +19371,6 @@ var ts; function contextualTypeIsTupleLikeType(type) { return !!(type.flags & 16384 ? ts.forEach(type.types, isTupleLikeType) : isTupleLikeType(type)); } - function contextualTypeHasIndexSignature(type, kind) { - return !!(type.flags & 16384 ? ts.forEach(type.types, function (t) { return getIndexTypeOfStructuredType(t, kind); }) : getIndexTypeOfStructuredType(type, kind)); - } function getContextualTypeForObjectLiteralMethod(node) { ts.Debug.assert(ts.isObjectLiteralMethod(node)); if (isInsideWithStatementBody(node)) { @@ -16731,21 +19409,20 @@ var ts; var conditional = node.parent; return node === conditional.whenTrue || node === conditional.whenFalse ? getContextualType(conditional) : undefined; } - function getContextualTypeForJsxExpression(expr) { - if (expr.parent.kind === 238) { - var attrib = expr.parent; - var attrsType = getJsxElementAttributesType(attrib.parent); + function getContextualTypeForJsxAttribute(attribute) { + var kind = attribute.kind; + var jsxElement = attribute.parent; + var attrsType = getJsxElementAttributesType(jsxElement); + if (attribute.kind === 246) { if (!attrsType || isTypeAny(attrsType)) { return undefined; } - else { - return getTypeOfPropertyOfType(attrsType, attrib.name.text); - } + return getTypeOfPropertyOfType(attrsType, attribute.name.text); } - if (expr.kind === 239) { - return getJsxElementAttributesType(expr.parent); + else if (attribute.kind === 247) { + return attrsType; } - return undefined; + ts.Debug.fail("Expected JsxAttribute or JsxSpreadAttribute, got ts.SyntaxKind[" + kind + "]"); } function getApparentTypeOfContextualType(node) { var type = getContextualType(node); @@ -16760,39 +19437,41 @@ var ts; } var parent = node.parent; switch (parent.kind) { - case 211: - case 138: - case 141: - case 140: - case 163: - return getContextualTypeForInitializerExpression(node); - case 174: - case 204: - return getContextualTypeForReturnExpression(node); - case 184: - return getContextualTypeForYieldOperand(parent); - case 168: + case 218: + case 142: + case 145: + case 144: case 169: - return getContextualTypeForArgument(parent, node); - case 171: - case 189: - return getTypeFromTypeNode(parent.type); - case 181: - return getContextualTypeForBinaryOperand(node); - case 245: - return getContextualTypeForObjectLiteralElement(parent); - case 164: - return getContextualTypeForElementExpression(node); - case 182: - return getContextualTypeForConditionalOperand(node); + return getContextualTypeForInitializerExpression(node); + case 180: + case 211: + return getContextualTypeForReturnExpression(node); case 190: - ts.Debug.assert(parent.parent.kind === 183); + return getContextualTypeForYieldOperand(parent); + case 174: + case 175: + return getContextualTypeForArgument(parent, node); + case 177: + case 195: + return getTypeFromTypeNode(parent.type); + case 187: + return getContextualTypeForBinaryOperand(node); + case 253: + return getContextualTypeForObjectLiteralElement(parent); + case 170: + return getContextualTypeForElementExpression(node); + case 188: + return getContextualTypeForConditionalOperand(node); + case 197: + ts.Debug.assert(parent.parent.kind === 189); return getContextualTypeForSubstitutionExpression(parent.parent, node); - case 172: + case 178: return getContextualType(parent); - case 240: - case 239: - return getContextualTypeForJsxExpression(parent); + case 248: + return getContextualType(parent); + case 246: + case 247: + return getContextualTypeForJsxAttribute(parent); } return undefined; } @@ -16806,18 +19485,21 @@ var ts; } } function isFunctionExpressionOrArrowFunction(node) { - return node.kind === 173 || node.kind === 174; + return node.kind === 179 || node.kind === 180; } function getContextualSignatureForFunctionLikeDeclaration(node) { return isFunctionExpressionOrArrowFunction(node) || ts.isObjectLiteralMethod(node) ? getContextualSignature(node) : undefined; } + function getContextualTypeForFunctionLikeDeclaration(node) { + return ts.isObjectLiteralMethod(node) ? + getContextualTypeForObjectLiteralMethod(node) : + getApparentTypeOfContextualType(node); + } function getContextualSignature(node) { - ts.Debug.assert(node.kind !== 143 || ts.isObjectLiteralMethod(node)); - var type = ts.isObjectLiteralMethod(node) - ? getContextualTypeForObjectLiteralMethod(node) - : getApparentTypeOfContextualType(node); + ts.Debug.assert(node.kind !== 147 || ts.isObjectLiteralMethod(node)); + var type = getContextualTypeForFunctionLikeDeclaration(node); if (!type) { return undefined; } @@ -16826,14 +19508,14 @@ var ts; } var signatureList; var types = type.types; - for (var _i = 0, types_8 = types; _i < types_8.length; _i++) { - var current = types_8[_i]; + for (var _i = 0, types_9 = types; _i < types_9.length; _i++) { + var current = types_9[_i]; var signature = getNonGenericSignature(current); if (signature) { if (!signatureList) { signatureList = [signature]; } - else if (!compareSignatures(signatureList[0], signature, false, true, compareTypes)) { + else if (!compareSignaturesIdentical(signatureList[0], signature, false, true, true, compareTypesIdentical)) { return undefined; } else { @@ -16852,35 +19534,22 @@ var ts; function isInferentialContext(mapper) { return mapper && mapper.context; } - function isAssignmentTarget(node) { - var parent = node.parent; - if (parent.kind === 181 && parent.operatorToken.kind === 56 && parent.left === node) { - return true; - } - if (parent.kind === 245) { - return isAssignmentTarget(parent.parent); - } - if (parent.kind === 164) { - return isAssignmentTarget(parent); - } - return false; - } function checkSpreadElementExpression(node, contextualMapper) { var arrayOrIterableType = checkExpressionCached(node.expression, contextualMapper); return checkIteratedTypeOrElementType(arrayOrIterableType, node.expression, false); } function hasDefaultValue(node) { - return (node.kind === 163 && !!node.initializer) || - (node.kind === 181 && node.operatorToken.kind === 56); + return (node.kind === 169 && !!node.initializer) || + (node.kind === 187 && node.operatorToken.kind === 56); } function checkArrayLiteral(node, contextualMapper) { var elements = node.elements; var hasSpreadElement = false; var elementTypes = []; - var inDestructuringPattern = isAssignmentTarget(node); + var inDestructuringPattern = ts.isAssignmentTarget(node); for (var _i = 0, elements_1 = elements; _i < elements_1.length; _i++) { var e = elements_1[_i]; - if (inDestructuringPattern && e.kind === 185) { + if (inDestructuringPattern && e.kind === 191) { var restArrayType = checkExpression(e.expression, contextualMapper); var restElementType = getIndexTypeOfType(restArrayType, 1) || (languageVersion >= 2 ? getElementTypeOfIterable(restArrayType, undefined) : undefined); @@ -16892,7 +19561,7 @@ var ts; var type = checkExpression(e, contextualMapper); elementTypes.push(type); } - hasSpreadElement = hasSpreadElement || e.kind === 185; + hasSpreadElement = hasSpreadElement || e.kind === 191; } if (!hasSpreadElement) { if (inDestructuringPattern && elementTypes.length) { @@ -16903,7 +19572,7 @@ var ts; var contextualType = getApparentTypeOfContextualType(node); if (contextualType && contextualTypeIsTupleLikeType(contextualType)) { var pattern = contextualType.pattern; - if (pattern && (pattern.kind === 162 || pattern.kind === 164)) { + if (pattern && (pattern.kind === 168 || pattern.kind === 170)) { var patternElements = pattern.elements; for (var i = elementTypes.length; i < patternElements.length; i++) { var patternElement = patternElements[i]; @@ -16911,7 +19580,7 @@ var ts; elementTypes.push(contextualType.elementTypes[i]); } else { - if (patternElement.kind !== 187) { + if (patternElement.kind !== 193) { error(patternElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); } elementTypes.push(unknownType); @@ -16923,16 +19592,16 @@ var ts; } } } - return createArrayType(elementTypes.length ? getUnionType(elementTypes) : undefinedType); + return createArrayType(elementTypes.length ? getUnionType(elementTypes) : emptyArrayElementType); } function isNumericName(name) { - return name.kind === 136 ? isNumericComputedName(name) : isNumericLiteralName(name.text); + return name.kind === 140 ? isNumericComputedName(name) : isNumericLiteralName(name.text); } function isNumericComputedName(name) { return isTypeAnyOrAllConstituentTypesHaveKind(checkComputedPropertyName(name), 132); } function isTypeAnyOrAllConstituentTypesHaveKind(type, kind) { - return isTypeAny(type) || allConstituentTypesHaveKind(type, kind); + return isTypeAny(type) || isTypeOfKind(type, kind); } function isNumericLiteralName(name) { return (+name).toString() === name; @@ -16950,38 +19619,50 @@ var ts; } return links.resolvedType; } + function getObjectLiteralIndexInfo(node, properties, kind) { + var propTypes = []; + for (var i = 0; i < properties.length; i++) { + if (kind === 0 || isNumericName(node.properties[i].name)) { + propTypes.push(getTypeOfSymbol(properties[i])); + } + } + var unionType = propTypes.length ? getUnionType(propTypes) : undefinedType; + return createIndexInfo(unionType, false); + } function checkObjectLiteral(node, contextualMapper) { - var inDestructuringPattern = isAssignmentTarget(node); + var inDestructuringPattern = ts.isAssignmentTarget(node); checkGrammarObjectLiteralExpression(node, inDestructuringPattern); var propertiesTable = {}; var propertiesArray = []; var contextualType = getApparentTypeOfContextualType(node); var contextualTypeHasPattern = contextualType && contextualType.pattern && - (contextualType.pattern.kind === 161 || contextualType.pattern.kind === 165); + (contextualType.pattern.kind === 167 || contextualType.pattern.kind === 171); var typeFlags = 0; var patternWithComputedProperties = false; + var hasComputedStringProperty = false; + var hasComputedNumberProperty = false; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var memberDecl = _a[_i]; var member = memberDecl.symbol; - if (memberDecl.kind === 245 || - memberDecl.kind === 246 || + if (memberDecl.kind === 253 || + memberDecl.kind === 254 || ts.isObjectLiteralMethod(memberDecl)) { var type = void 0; - if (memberDecl.kind === 245) { + if (memberDecl.kind === 253) { type = checkPropertyAssignment(memberDecl, contextualMapper); } - else if (memberDecl.kind === 143) { + else if (memberDecl.kind === 147) { type = checkObjectLiteralMethod(memberDecl, contextualMapper); } else { - ts.Debug.assert(memberDecl.kind === 246); + ts.Debug.assert(memberDecl.kind === 254); type = checkExpression(memberDecl.name, contextualMapper); } typeFlags |= type.flags; var prop = createSymbol(4 | 67108864 | member.flags, member.name); if (inDestructuringPattern) { - var isOptional = (memberDecl.kind === 245 && hasDefaultValue(memberDecl.initializer)) || - (memberDecl.kind === 246 && memberDecl.objectAssignmentInitializer); + var isOptional = (memberDecl.kind === 253 && hasDefaultValue(memberDecl.initializer)) || + (memberDecl.kind === 254 && memberDecl.objectAssignmentInitializer); if (isOptional) { prop.flags |= 536870912; } @@ -17008,10 +19689,18 @@ var ts; member = prop; } else { - ts.Debug.assert(memberDecl.kind === 145 || memberDecl.kind === 146); + ts.Debug.assert(memberDecl.kind === 149 || memberDecl.kind === 150); checkAccessorDeclaration(memberDecl); } - if (!ts.hasDynamicName(memberDecl)) { + if (ts.hasDynamicName(memberDecl)) { + if (isNumericName(memberDecl.name)) { + hasComputedNumberProperty = true; + } + else { + hasComputedStringProperty = true; + } + } + else { propertiesTable[member.name] = member; } propertiesArray.push(member); @@ -17028,66 +19717,38 @@ var ts; } } } - var stringIndexType = getIndexType(0); - var numberIndexType = getIndexType(1); - var result = createAnonymousType(node.symbol, propertiesTable, emptyArray, emptyArray, stringIndexType, numberIndexType); + var stringIndexInfo = hasComputedStringProperty ? getObjectLiteralIndexInfo(node, propertiesArray, 0) : undefined; + var numberIndexInfo = hasComputedNumberProperty ? getObjectLiteralIndexInfo(node, propertiesArray, 1) : undefined; + var result = createAnonymousType(node.symbol, propertiesTable, emptyArray, emptyArray, stringIndexInfo, numberIndexInfo); var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 1048576; result.flags |= 524288 | 4194304 | freshObjectLiteralFlag | (typeFlags & 14680064) | (patternWithComputedProperties ? 67108864 : 0); if (inDestructuringPattern) { result.pattern = node; } return result; - function getIndexType(kind) { - if (contextualType && contextualTypeHasIndexSignature(contextualType, kind)) { - var propTypes = []; - for (var i = 0; i < propertiesArray.length; i++) { - var propertyDecl = node.properties[i]; - if (kind === 0 || isNumericName(propertyDecl.name)) { - var type = getTypeOfSymbol(propertiesArray[i]); - if (!ts.contains(propTypes, type)) { - propTypes.push(type); - } - } - } - var result_1 = propTypes.length ? getUnionType(propTypes) : undefinedType; - typeFlags |= result_1.flags; - return result_1; - } - return undefined; - } } function checkJsxSelfClosingElement(node) { checkJsxOpeningLikeElement(node); return jsxElementType || anyType; } - function tagNamesAreEquivalent(lhs, rhs) { - if (lhs.kind !== rhs.kind) { - return false; - } - if (lhs.kind === 69) { - return lhs.text === rhs.text; - } - return lhs.right.text === rhs.right.text && - tagNamesAreEquivalent(lhs.left, rhs.left); - } function checkJsxElement(node) { checkJsxOpeningLikeElement(node.openingElement); - if (!tagNamesAreEquivalent(node.openingElement.tagName, node.closingElement.tagName)) { - error(node.closingElement, ts.Diagnostics.Expected_corresponding_JSX_closing_tag_for_0, ts.getTextOfNode(node.openingElement.tagName)); + if (isJsxIntrinsicIdentifier(node.closingElement.tagName)) { + getIntrinsicTagSymbol(node.closingElement); } else { - getJsxElementTagSymbol(node.closingElement); + checkExpression(node.closingElement.tagName); } for (var _i = 0, _a = node.children; _i < _a.length; _i++) { var child = _a[_i]; switch (child.kind) { - case 240: + case 248: checkJsxExpression(child); break; - case 233: + case 241: checkJsxElement(child); break; - case 234: + case 242: checkJsxSelfClosingElement(child); break; } @@ -17098,7 +19759,7 @@ var ts; return name.indexOf("-") < 0; } function isJsxIntrinsicIdentifier(tagName) { - if (tagName.kind === 135) { + if (tagName.kind === 139) { return false; } else { @@ -17155,74 +19816,41 @@ var ts; } return type; } - function getJsxIntrinsicElementsType() { - if (!jsxIntrinsicElementsType) { - jsxIntrinsicElementsType = getExportedTypeFromNamespace(JsxNames.JSX, JsxNames.IntrinsicElements) || unknownType; + function getJsxType(name) { + if (jsxTypes[name] === undefined) { + return jsxTypes[name] = getExportedTypeFromNamespace(JsxNames.JSX, name) || unknownType; } - return jsxIntrinsicElementsType; + return jsxTypes[name]; } - function getJsxElementTagSymbol(node) { - var flags = 8; + function getIntrinsicTagSymbol(node) { var links = getNodeLinks(node); if (!links.resolvedSymbol) { - if (isJsxIntrinsicIdentifier(node.tagName)) { - links.resolvedSymbol = lookupIntrinsicTag(node); - } - else { - links.resolvedSymbol = lookupClassTag(node); - } - } - return links.resolvedSymbol; - function lookupIntrinsicTag(node) { - var intrinsicElementsType = getJsxIntrinsicElementsType(); + var intrinsicElementsType = getJsxType(JsxNames.IntrinsicElements); if (intrinsicElementsType !== unknownType) { var intrinsicProp = getPropertyOfType(intrinsicElementsType, node.tagName.text); if (intrinsicProp) { links.jsxFlags |= 1; - return intrinsicProp; + return links.resolvedSymbol = intrinsicProp; } var indexSignatureType = getIndexTypeOfType(intrinsicElementsType, 0); if (indexSignatureType) { links.jsxFlags |= 2; - return intrinsicElementsType.symbol; + return links.resolvedSymbol = intrinsicElementsType.symbol; } error(node, ts.Diagnostics.Property_0_does_not_exist_on_type_1, node.tagName.text, "JSX." + JsxNames.IntrinsicElements); - return unknownSymbol; + return links.resolvedSymbol = unknownSymbol; } else { if (compilerOptions.noImplicitAny) { error(node, ts.Diagnostics.JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists, JsxNames.IntrinsicElements); } + return links.resolvedSymbol = unknownSymbol; } } - function lookupClassTag(node) { - var valueSymbol = resolveJsxTagName(node); - if (valueSymbol && valueSymbol !== unknownSymbol) { - links.jsxFlags |= 4; - if (valueSymbol.flags & 8388608) { - markAliasSymbolAsReferenced(valueSymbol); - } - } - return valueSymbol || unknownSymbol; - } - function resolveJsxTagName(node) { - if (node.tagName.kind === 69) { - var tag = node.tagName; - var sym = getResolvedSymbol(tag); - return sym.exportSymbol || sym; - } - else { - return checkQualifiedName(node.tagName).symbol; - } - } + return links.resolvedSymbol; } - function getJsxElementInstanceType(node) { - ts.Debug.assert(!!(getNodeLinks(node).jsxFlags & 4), "Should not call getJsxElementInstanceType on non-class Element"); - var classSymbol = getJsxElementTagSymbol(node); - if (classSymbol === unknownSymbol) { - return anyType; - } - var valueType = getTypeOfSymbol(classSymbol); + function getJsxElementInstanceType(node, valueType) { + ts.Debug.assert(!(valueType.flags & 16384)); if (isTypeAny(valueType)) { return anyType; } @@ -17234,12 +19862,7 @@ var ts; return unknownType; } } - var returnType = getUnionType(signatures.map(getReturnTypeOfSignature)); - var elemClassType = getJsxGlobalElementClassType(); - if (elemClassType) { - checkTypeRelatedTo(returnType, elemClassType, assignableRelation, node, ts.Diagnostics.JSX_element_type_0_is_not_a_constructor_function_for_JSX_elements); - } - return returnType; + return getUnionType(signatures.map(getReturnTypeOfSignature)); } function getJsxElementPropertiesName() { var jsxNamespace = getGlobalSymbol(JsxNames.JSX, 1536, undefined); @@ -17262,47 +19885,97 @@ var ts; return undefined; } } + function getResolvedJsxType(node, elemType, elemClassType) { + if (!elemType) { + elemType = checkExpression(node.tagName); + } + if (elemType.flags & 16384) { + var types = elemType.types; + return getUnionType(types.map(function (type) { + return getResolvedJsxType(node, type, elemClassType); + })); + } + var elemInstanceType = getJsxElementInstanceType(node, elemType); + if (!elemClassType || !isTypeAssignableTo(elemInstanceType, elemClassType)) { + if (jsxElementType) { + var callSignatures = elemType && getSignaturesOfType(elemType, 0); + var callSignature = callSignatures && callSignatures.length > 0 && callSignatures[0]; + var callReturnType = callSignature && getReturnTypeOfSignature(callSignature); + var paramType = callReturnType && (callSignature.parameters.length === 0 ? emptyObjectType : getTypeOfSymbol(callSignature.parameters[0])); + if (callReturnType && isTypeAssignableTo(callReturnType, jsxElementType)) { + var intrinsicAttributes = getJsxType(JsxNames.IntrinsicAttributes); + if (intrinsicAttributes !== unknownType) { + paramType = intersectTypes(intrinsicAttributes, paramType); + } + return paramType; + } + } + } + if (elemClassType) { + checkTypeRelatedTo(elemInstanceType, elemClassType, assignableRelation, node, ts.Diagnostics.JSX_element_type_0_is_not_a_constructor_function_for_JSX_elements); + } + if (isTypeAny(elemInstanceType)) { + return elemInstanceType; + } + var propsName = getJsxElementPropertiesName(); + if (propsName === undefined) { + return anyType; + } + else if (propsName === "") { + return elemInstanceType; + } + else { + var attributesType = getTypeOfPropertyOfType(elemInstanceType, propsName); + if (!attributesType) { + return emptyObjectType; + } + else if (isTypeAny(attributesType) || (attributesType === unknownType)) { + return attributesType; + } + else if (attributesType.flags & 16384) { + error(node.tagName, ts.Diagnostics.JSX_element_attributes_type_0_may_not_be_a_union_type, typeToString(attributesType)); + return anyType; + } + else { + var apparentAttributesType = attributesType; + var intrinsicClassAttribs = getJsxType(JsxNames.IntrinsicClassAttributes); + if (intrinsicClassAttribs !== unknownType) { + var typeParams = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(intrinsicClassAttribs.symbol); + if (typeParams) { + if (typeParams.length === 1) { + apparentAttributesType = intersectTypes(createTypeReference(intrinsicClassAttribs, [elemInstanceType]), apparentAttributesType); + } + } + else { + apparentAttributesType = intersectTypes(attributesType, intrinsicClassAttribs); + } + } + var intrinsicAttribs = getJsxType(JsxNames.IntrinsicAttributes); + if (intrinsicAttribs !== unknownType) { + apparentAttributesType = intersectTypes(intrinsicAttribs, apparentAttributesType); + } + return apparentAttributesType; + } + } + } function getJsxElementAttributesType(node) { var links = getNodeLinks(node); if (!links.resolvedJsxType) { - var sym = getJsxElementTagSymbol(node); - if (links.jsxFlags & 4) { - var elemInstanceType = getJsxElementInstanceType(node); - if (isTypeAny(elemInstanceType)) { - return links.resolvedJsxType = elemInstanceType; + if (isJsxIntrinsicIdentifier(node.tagName)) { + var symbol = getIntrinsicTagSymbol(node); + if (links.jsxFlags & 1) { + return links.resolvedJsxType = getTypeOfSymbol(symbol); } - var propsName = getJsxElementPropertiesName(); - if (propsName === undefined) { - return links.resolvedJsxType = anyType; - } - else if (propsName === "") { - return links.resolvedJsxType = elemInstanceType; + else if (links.jsxFlags & 2) { + return links.resolvedJsxType = getIndexInfoOfSymbol(symbol, 0).type; } else { - var attributesType = getTypeOfPropertyOfType(elemInstanceType, propsName); - if (!attributesType) { - return links.resolvedJsxType = emptyObjectType; - } - else if (isTypeAny(attributesType) || (attributesType === unknownType)) { - return links.resolvedJsxType = attributesType; - } - else if (!(attributesType.flags & 80896)) { - error(node.tagName, ts.Diagnostics.JSX_element_attributes_type_0_must_be_an_object_type, typeToString(attributesType)); - return links.resolvedJsxType = anyType; - } - else { - return links.resolvedJsxType = attributesType; - } + return links.resolvedJsxType = unknownType; } } - else if (links.jsxFlags & 1) { - return links.resolvedJsxType = getTypeOfSymbol(sym); - } - else if (links.jsxFlags & 2) { - return links.resolvedJsxType = getIndexTypeOfSymbol(sym, 0); - } else { - return links.resolvedJsxType = anyType; + var elemClassType = getJsxGlobalElementClassType(); + return links.resolvedJsxType = getResolvedJsxType(node, undefined, elemClassType); } } return links.resolvedJsxType; @@ -17319,7 +19992,7 @@ var ts; return jsxElementClassType; } function getJsxIntrinsicTagNames() { - var intrinsics = getJsxIntrinsicElementsType(); + var intrinsics = getJsxType(JsxNames.IntrinsicElements); return intrinsics ? getPropertiesOfType(intrinsics) : emptyArray; } function checkJsxPreconditions(errorNode) { @@ -17335,21 +20008,21 @@ var ts; function checkJsxOpeningLikeElement(node) { checkGrammarJsxElement(node); checkJsxPreconditions(node); - if (compilerOptions.jsx === 2) { - var reactSym = resolveName(node.tagName, "React", 107455, ts.Diagnostics.Cannot_find_name_0, "React"); - if (reactSym) { - getSymbolLinks(reactSym).referenced = true; - } + var reactRefErr = compilerOptions.jsx === 2 ? ts.Diagnostics.Cannot_find_name_0 : undefined; + var reactNamespace = compilerOptions.reactNamespace ? compilerOptions.reactNamespace : "React"; + var reactSym = resolveName(node.tagName, reactNamespace, 107455, reactRefErr, reactNamespace); + if (reactSym) { + getSymbolLinks(reactSym).referenced = true; } var targetAttributesType = getJsxElementAttributesType(node); var nameTable = {}; var sawSpreadedAny = false; for (var i = node.attributes.length - 1; i >= 0; i--) { - if (node.attributes[i].kind === 238) { + if (node.attributes[i].kind === 246) { checkJsxAttribute((node.attributes[i]), targetAttributesType, nameTable); } else { - ts.Debug.assert(node.attributes[i].kind === 239); + ts.Debug.assert(node.attributes[i].kind === 247); var spreadType = checkJsxSpreadAttribute((node.attributes[i]), targetAttributesType, nameTable); if (isTypeAny(spreadType)) { sawSpreadedAny = true; @@ -17375,19 +20048,19 @@ var ts; } } function getDeclarationKindFromSymbol(s) { - return s.valueDeclaration ? s.valueDeclaration.kind : 141; + return s.valueDeclaration ? s.valueDeclaration.kind : 145; } function getDeclarationFlagsFromSymbol(s) { - return s.valueDeclaration ? ts.getCombinedNodeFlags(s.valueDeclaration) : s.flags & 134217728 ? 8 | 64 : 0; + return s.valueDeclaration ? ts.getCombinedNodeFlags(s.valueDeclaration) : s.flags & 134217728 ? 4 | 32 : 0; } function checkClassPropertyAccess(node, left, type, prop) { var flags = getDeclarationFlagsFromSymbol(prop); - var declaringClass = getDeclaredTypeOfSymbol(prop.parent); + var declaringClass = getDeclaredTypeOfSymbol(getParentOfSymbol(prop)); + var errorNode = node.kind === 172 || node.kind === 218 ? + node.name : + node.right; if (left.kind === 95) { - var errorNode = node.kind === 166 ? - node.name : - node.right; - if (getDeclarationKindFromSymbol(prop) !== 143) { + if (languageVersion < 2 && getDeclarationKindFromSymbol(prop) !== 147) { error(errorNode, ts.Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword); return false; } @@ -17396,14 +20069,13 @@ var ts; return false; } } - if (!(flags & (16 | 32))) { + if (!(flags & (8 | 16))) { return true; } - var enclosingClassDeclaration = ts.getContainingClass(node); - var enclosingClass = enclosingClassDeclaration ? getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingClassDeclaration)) : undefined; - if (flags & 16) { - if (declaringClass !== enclosingClass) { - error(node, ts.Diagnostics.Property_0_is_private_and_only_accessible_within_class_1, symbolToString(prop), typeToString(declaringClass)); + if (flags & 8) { + var declaringClassDeclaration = getClassLikeDeclarationOfSymbol(getParentOfSymbol(prop)); + if (!isNodeWithinClass(node, declaringClassDeclaration)) { + error(errorNode, ts.Diagnostics.Property_0_is_private_and_only_accessible_within_class_1, symbolToString(prop), typeToString(declaringClass)); return false; } return true; @@ -17411,22 +20083,40 @@ var ts; if (left.kind === 95) { return true; } - if (!enclosingClass || !hasBaseType(enclosingClass, declaringClass)) { - error(node, ts.Diagnostics.Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses, symbolToString(prop), typeToString(declaringClass)); + var enclosingClass = forEachEnclosingClass(node, function (enclosingDeclaration) { + var enclosingClass = getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingDeclaration)); + return hasBaseType(enclosingClass, declaringClass) ? enclosingClass : undefined; + }); + if (!enclosingClass) { + error(errorNode, ts.Diagnostics.Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses, symbolToString(prop), typeToString(declaringClass)); return false; } - if (flags & 64) { + if (flags & 32) { return true; } if (type.flags & 33554432) { type = getConstraintOfTypeParameter(type); } if (!(getTargetType(type).flags & (1024 | 2048) && hasBaseType(type, enclosingClass))) { - error(node, ts.Diagnostics.Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1, symbolToString(prop), typeToString(enclosingClass)); + error(errorNode, ts.Diagnostics.Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1, symbolToString(prop), typeToString(enclosingClass)); return false; } return true; } + function checkNonNullExpression(node) { + var type = checkExpression(node); + if (strictNullChecks) { + var kind = getNullableKind(type); + if (kind) { + error(node, kind & 32 ? kind & 64 ? + ts.Diagnostics.Object_is_possibly_null_or_undefined : + ts.Diagnostics.Object_is_possibly_undefined : + ts.Diagnostics.Object_is_possibly_null); + } + return getNonNullableType(type); + } + return type; + } function checkPropertyAccessExpression(node) { return checkPropertyAccessExpressionOrQualifiedName(node, node.expression, node.name); } @@ -17434,7 +20124,7 @@ var ts; return checkPropertyAccessExpressionOrQualifiedName(node, node.left, node.right); } function checkPropertyAccessExpressionOrQualifiedName(node, left, right) { - var type = checkExpression(left); + var type = checkNonNullExpression(left); if (isTypeAny(type)) { return type; } @@ -17453,10 +20143,29 @@ var ts; if (prop.parent && prop.parent.flags & 32) { checkClassPropertyAccess(node, left, apparentType, prop); } - return getTypeOfSymbol(prop); + var propType = getTypeOfSymbol(prop); + if (node.kind !== 172 || ts.isAssignmentTarget(node) || + !(propType.flags & 16384) && !(prop.flags & (3 | 4 | 98304))) { + return propType; + } + var leftmostNode = getLeftmostIdentifierOrThis(node); + if (!leftmostNode) { + return propType; + } + if (leftmostNode.kind === 69) { + var leftmostSymbol = getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(leftmostNode)); + if (!leftmostSymbol) { + return propType; + } + var declaration = leftmostSymbol.valueDeclaration; + if (!declaration || declaration.kind !== 218 && declaration.kind !== 142 && declaration.kind !== 169) { + return propType; + } + } + return getFlowTypeOfReference(node, propType, true); } function isValidPropertyAccess(node, propertyName) { - var left = node.kind === 166 + var left = node.kind === 172 ? node.expression : node.left; var type = checkExpression(left); @@ -17468,10 +20177,47 @@ var ts; } return true; } + function getForInVariableSymbol(node) { + var initializer = node.initializer; + if (initializer.kind === 219) { + var variable = initializer.declarations[0]; + if (variable && !ts.isBindingPattern(variable.name)) { + return getSymbolOfNode(variable); + } + } + else if (initializer.kind === 69) { + return getResolvedSymbol(initializer); + } + return undefined; + } + function hasNumericPropertyNames(type) { + return getIndexTypeOfType(type, 1) && !getIndexTypeOfType(type, 0); + } + function isForInVariableForNumericPropertyNames(expr) { + var e = skipParenthesizedNodes(expr); + if (e.kind === 69) { + var symbol = getResolvedSymbol(e); + if (symbol.flags & 3) { + var child = expr; + var node = expr.parent; + while (node) { + if (node.kind === 207 && + child === node.statement && + getForInVariableSymbol(node) === symbol && + hasNumericPropertyNames(checkExpression(node.expression))) { + return true; + } + child = node; + node = node.parent; + } + } + } + return false; + } function checkIndexedAccess(node) { if (!node.argumentExpression) { - var sourceFile = getSourceFile(node); - if (node.parent.kind === 169 && node.parent.expression === node) { + var sourceFile = ts.getSourceFileOfNode(node); + if (node.parent.kind === 175 && node.parent.expression === node) { var start = ts.skipTrivia(sourceFile.text, node.expression.end); var end = node.end; grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead); @@ -17482,7 +20228,7 @@ var ts; grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.Expression_expected); } } - var objectType = getApparentType(checkExpression(node.expression)); + var objectType = getApparentType(checkNonNullExpression(node.expression)); var indexType = node.argumentExpression ? checkExpression(node.argumentExpression) : unknownType; if (objectType === unknownType) { return unknownType; @@ -17494,32 +20240,36 @@ var ts; return unknownType; } if (node.argumentExpression) { - var name_11 = getPropertyNameForIndexedAccess(node.argumentExpression, indexType); - if (name_11 !== undefined) { - var prop = getPropertyOfType(objectType, name_11); + var name_12 = getPropertyNameForIndexedAccess(node.argumentExpression, indexType); + if (name_12 !== undefined) { + var prop = getPropertyOfType(objectType, name_12); if (prop) { getNodeLinks(node).resolvedSymbol = prop; return getTypeOfSymbol(prop); } else if (isConstEnum) { - error(node.argumentExpression, ts.Diagnostics.Property_0_does_not_exist_on_const_enum_1, name_11, symbolToString(objectType.symbol)); + error(node.argumentExpression, ts.Diagnostics.Property_0_does_not_exist_on_const_enum_1, name_12, symbolToString(objectType.symbol)); return unknownType; } } } if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, 258 | 132 | 16777216)) { - if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, 132)) { - var numberIndexType = getIndexTypeOfType(objectType, 1); - if (numberIndexType) { - return numberIndexType; + if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, 132) || isForInVariableForNumericPropertyNames(node.argumentExpression)) { + var numberIndexInfo = getIndexInfoOfType(objectType, 1); + if (numberIndexInfo) { + getNodeLinks(node).resolvedIndexInfo = numberIndexInfo; + return numberIndexInfo.type; } } - var stringIndexType = getIndexTypeOfType(objectType, 0); - if (stringIndexType) { - return stringIndexType; + var stringIndexInfo = getIndexInfoOfType(objectType, 0); + if (stringIndexInfo) { + getNodeLinks(node).resolvedIndexInfo = stringIndexInfo; + return stringIndexInfo.type; } if (compilerOptions.noImplicitAny && !compilerOptions.suppressImplicitAnyIndexErrors && !isTypeAny(objectType)) { - error(node, ts.Diagnostics.Index_signature_of_object_type_implicitly_has_an_any_type); + error(node, getIndexTypeOfType(objectType, 1) ? + ts.Diagnostics.Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number : + ts.Diagnostics.Index_signature_of_object_type_implicitly_has_an_any_type); } return anyType; } @@ -17530,7 +20280,7 @@ var ts; if (indexArgumentExpression.kind === 9 || indexArgumentExpression.kind === 8) { return indexArgumentExpression.text; } - if (indexArgumentExpression.kind === 167 || indexArgumentExpression.kind === 166) { + if (indexArgumentExpression.kind === 173 || indexArgumentExpression.kind === 172) { var value = getConstantValue(indexArgumentExpression); if (value !== undefined) { return value.toString(); @@ -17573,10 +20323,10 @@ var ts; return true; } function resolveUntypedCall(node) { - if (node.kind === 170) { + if (node.kind === 176) { checkExpression(node.template); } - else if (node.kind !== 139) { + else if (node.kind !== 143) { ts.forEach(node.arguments, function (argument) { checkExpression(argument); }); @@ -17598,19 +20348,19 @@ var ts; for (var _i = 0, signatures_2 = signatures; _i < signatures_2.length; _i++) { var signature = signatures_2[_i]; var symbol = signature.declaration && getSymbolOfNode(signature.declaration); - var parent_5 = signature.declaration && signature.declaration.parent; + var parent_9 = signature.declaration && signature.declaration.parent; if (!lastSymbol || symbol === lastSymbol) { - if (lastParent && parent_5 === lastParent) { + if (lastParent && parent_9 === lastParent) { index++; } else { - lastParent = parent_5; + lastParent = parent_9; index = cutoffIndex; } } else { index = cutoffIndex = result.length; - lastParent = parent_5; + lastParent = parent_9; } lastSymbol = symbol; if (signature.hasStringLiterals) { @@ -17627,7 +20377,7 @@ var ts; function getSpreadArgumentIndex(args) { for (var i = 0; i < args.length; i++) { var arg = args[i]; - if (arg && arg.kind === 185) { + if (arg && arg.kind === 191) { return i; } } @@ -17639,11 +20389,11 @@ var ts; var callIsIncomplete; var isDecorator; var spreadArgIndex = -1; - if (node.kind === 170) { + if (node.kind === 176) { var tagExpression = node; adjustedArgCount = args.length; typeArguments = undefined; - if (tagExpression.template.kind === 183) { + if (tagExpression.template.kind === 189) { var templateExpression = tagExpression.template; var lastSpan = ts.lastOrUndefined(templateExpression.templateSpans); ts.Debug.assert(lastSpan !== undefined); @@ -17655,7 +20405,7 @@ var ts; callIsIncomplete = !!templateLiteral.isUnterminated; } } - else if (node.kind === 139) { + else if (node.kind === 143) { isDecorator = true; typeArguments = undefined; adjustedArgCount = getEffectiveArgumentCount(node, undefined, signature); @@ -17663,7 +20413,7 @@ var ts; else { var callExpression = node; if (!callExpression.arguments) { - ts.Debug.assert(callExpression.kind === 169); + ts.Debug.assert(callExpression.kind === 175); return signature.minArgumentCount === 0; } adjustedArgCount = callExpression.arguments.hasTrailingComma ? args.length + 1 : args.length; @@ -17689,7 +20439,7 @@ var ts; if (type.flags & 80896) { var resolved = resolveStructuredTypeMembers(type); if (resolved.callSignatures.length === 1 && resolved.constructSignatures.length === 0 && - resolved.properties.length === 0 && !resolved.stringIndexType && !resolved.numberIndexType) { + resolved.properties.length === 0 && !resolved.stringIndexInfo && !resolved.numberIndexInfo) { return resolved.callSignatures[0]; } } @@ -17704,7 +20454,7 @@ var ts; } function inferTypeArguments(node, signature, args, excludeArgument, context) { var typeParameters = signature.typeParameters; - var inferenceMapper = createInferenceMapper(context); + var inferenceMapper = getInferenceMapper(context); for (var i = 0; i < typeParameters.length; i++) { if (!context.inferences[i].isFixed) { context.inferredTypes[i] = undefined; @@ -17713,10 +20463,15 @@ var ts; if (context.failedTypeParameterIndex !== undefined && !context.inferences[context.failedTypeParameterIndex].isFixed) { context.failedTypeParameterIndex = undefined; } + if (signature.thisType) { + var thisArgumentNode = getThisArgumentOfCall(node); + var thisArgumentType = thisArgumentNode ? checkExpression(thisArgumentNode) : voidType; + inferTypes(context, thisArgumentType, signature.thisType); + } var argCount = getEffectiveArgumentCount(node, args, signature); for (var i = 0; i < argCount; i++) { var arg = getEffectiveArgument(node, args, i); - if (arg === undefined || arg.kind !== 187) { + if (arg === undefined || arg.kind !== 193) { var paramType = getTypeAtPosition(signature, i); var argType = getEffectiveArgumentType(node, i, arg); if (argType === undefined) { @@ -17737,13 +20492,11 @@ var ts; } getInferredTypes(context); } - function checkTypeArguments(signature, typeArguments, typeArgumentResultTypes, reportErrors, headMessage) { + function checkTypeArguments(signature, typeArgumentNodes, typeArgumentTypes, reportErrors, headMessage) { var typeParameters = signature.typeParameters; var typeArgumentsAreAssignable = true; + var mapper; for (var i = 0; i < typeParameters.length; i++) { - var typeArgNode = typeArguments[i]; - var typeArgument = getTypeFromTypeNode(typeArgNode); - typeArgumentResultTypes[i] = typeArgument; if (typeArgumentsAreAssignable) { var constraint = getConstraintOfTypeParameter(typeParameters[i]); if (constraint) { @@ -17753,26 +20506,39 @@ var ts; errorInfo = ts.chainDiagnosticMessages(errorInfo, typeArgumentHeadMessage); typeArgumentHeadMessage = headMessage; } - typeArgumentsAreAssignable = checkTypeAssignableTo(typeArgument, constraint, reportErrors ? typeArgNode : undefined, typeArgumentHeadMessage, errorInfo); + if (!mapper) { + mapper = createTypeMapper(typeParameters, typeArgumentTypes); + } + var typeArgument = typeArgumentTypes[i]; + typeArgumentsAreAssignable = checkTypeAssignableTo(typeArgument, getTypeWithThisArgument(instantiateType(constraint, mapper), typeArgument), reportErrors ? typeArgumentNodes[i] : undefined, typeArgumentHeadMessage, errorInfo); } } } return typeArgumentsAreAssignable; } function checkApplicableSignature(node, args, signature, relation, excludeArgument, reportErrors) { + if (signature.thisType && signature.thisType !== voidType && node.kind !== 175) { + var thisArgumentNode = getThisArgumentOfCall(node); + var thisArgumentType = thisArgumentNode ? checkExpression(thisArgumentNode) : voidType; + var errorNode = reportErrors ? (thisArgumentNode || node) : undefined; + var headMessage_1 = ts.Diagnostics.The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1; + if (!checkTypeRelatedTo(thisArgumentType, signature.thisType, relation, errorNode, headMessage_1)) { + return false; + } + } + var headMessage = ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1; var argCount = getEffectiveArgumentCount(node, args, signature); for (var i = 0; i < argCount; i++) { var arg = getEffectiveArgument(node, args, i); - if (arg === undefined || arg.kind !== 187) { + if (arg === undefined || arg.kind !== 193) { var paramType = getTypeAtPosition(signature, i); var argType = getEffectiveArgumentType(node, i, arg); if (argType === undefined) { argType = arg.kind === 9 && !reportErrors - ? getStringLiteralType(arg) + ? getStringLiteralTypeForText(arg.text) : checkExpressionWithContextualType(arg, paramType, excludeArgument && excludeArgument[i] ? identityMapper : undefined); } var errorNode = reportErrors ? getEffectiveArgumentErrorNode(node, i, arg) : undefined; - var headMessage = ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1; if (!checkTypeRelatedTo(argType, paramType, relation, errorNode, headMessage)) { return false; } @@ -17780,18 +20546,29 @@ var ts; } return true; } + function getThisArgumentOfCall(node) { + if (node.kind === 174) { + var callee = node.expression; + if (callee.kind === 172) { + return callee.expression; + } + else if (callee.kind === 173) { + return callee.expression; + } + } + } function getEffectiveCallArguments(node) { var args; - if (node.kind === 170) { + if (node.kind === 176) { var template = node.template; args = [undefined]; - if (template.kind === 183) { + if (template.kind === 189) { ts.forEach(template.templateSpans, function (span) { args.push(span.expression); }); } } - else if (node.kind === 139) { + else if (node.kind === 143) { return undefined; } else { @@ -17800,21 +20577,21 @@ var ts; return args; } function getEffectiveArgumentCount(node, args, signature) { - if (node.kind === 139) { + if (node.kind === 143) { switch (node.parent.kind) { - case 214: - case 186: + case 221: + case 192: return 1; - case 141: - return 2; - case 143: case 145: - case 146: + return 2; + case 147: + case 149: + case 150: if (languageVersion === 0) { return 2; } return signature.parameters.length >= 3 ? 3 : 2; - case 138: + case 142: return 3; } } @@ -17823,50 +20600,50 @@ var ts; } } function getEffectiveDecoratorFirstArgumentType(node) { - if (node.kind === 214) { + if (node.kind === 221) { var classSymbol = getSymbolOfNode(node); return getTypeOfSymbol(classSymbol); } - if (node.kind === 138) { + if (node.kind === 142) { node = node.parent; - if (node.kind === 144) { + if (node.kind === 148) { var classSymbol = getSymbolOfNode(node); return getTypeOfSymbol(classSymbol); } } - if (node.kind === 141 || - node.kind === 143 || - node.kind === 145 || - node.kind === 146) { + if (node.kind === 145 || + node.kind === 147 || + node.kind === 149 || + node.kind === 150) { return getParentTypeOfClassElement(node); } ts.Debug.fail("Unsupported decorator target."); return unknownType; } function getEffectiveDecoratorSecondArgumentType(node) { - if (node.kind === 214) { + if (node.kind === 221) { ts.Debug.fail("Class decorators should not have a second synthetic argument."); return unknownType; } - if (node.kind === 138) { + if (node.kind === 142) { node = node.parent; - if (node.kind === 144) { + if (node.kind === 148) { return anyType; } } - if (node.kind === 141 || - node.kind === 143 || - node.kind === 145 || - node.kind === 146) { + if (node.kind === 145 || + node.kind === 147 || + node.kind === 149 || + node.kind === 150) { var element = node; switch (element.name.kind) { case 69: case 8: case 9: - return getStringLiteralType(element.name); - case 136: + return getStringLiteralTypeForText(element.name.text); + case 140: var nameType = checkComputedPropertyName(element.name); - if (allConstituentTypesHaveKind(nameType, 16777216)) { + if (isTypeOfKind(nameType, 16777216)) { return nameType; } else { @@ -17881,20 +20658,20 @@ var ts; return unknownType; } function getEffectiveDecoratorThirdArgumentType(node) { - if (node.kind === 214) { + if (node.kind === 221) { ts.Debug.fail("Class decorators should not have a third synthetic argument."); return unknownType; } - if (node.kind === 138) { + if (node.kind === 142) { return numberType; } - if (node.kind === 141) { + if (node.kind === 145) { ts.Debug.fail("Property decorators should not have a third synthetic argument."); return unknownType; } - if (node.kind === 143 || - node.kind === 145 || - node.kind === 146) { + if (node.kind === 147 || + node.kind === 149 || + node.kind === 150) { var propertyType = getTypeOfNode(node); return createTypedPropertyDescriptorType(propertyType); } @@ -17915,26 +20692,26 @@ var ts; return unknownType; } function getEffectiveArgumentType(node, argIndex, arg) { - if (node.kind === 139) { + if (node.kind === 143) { return getEffectiveDecoratorArgumentType(node, argIndex); } - else if (argIndex === 0 && node.kind === 170) { - return globalTemplateStringsArrayType; + else if (argIndex === 0 && node.kind === 176) { + return getGlobalTemplateStringsArrayType(); } return undefined; } function getEffectiveArgument(node, args, argIndex) { - if (node.kind === 139 || - (argIndex === 0 && node.kind === 170)) { + if (node.kind === 143 || + (argIndex === 0 && node.kind === 176)) { return undefined; } return args[argIndex]; } function getEffectiveArgumentErrorNode(node, argIndex, arg) { - if (node.kind === 139) { + if (node.kind === 143) { return node.expression; } - else if (argIndex === 0 && node.kind === 170) { + else if (argIndex === 0 && node.kind === 176) { return node.template; } else { @@ -17942,8 +20719,8 @@ var ts; } } function resolveCall(node, signatures, candidatesOutArray, headMessage) { - var isTaggedTemplate = node.kind === 170; - var isDecorator = node.kind === 139; + var isTaggedTemplate = node.kind === 176; + var isDecorator = node.kind === 143; var typeArguments; if (!isTaggedTemplate && !isDecorator) { typeArguments = node.typeArguments; @@ -17990,7 +20767,8 @@ var ts; } else if (candidateForTypeArgumentError) { if (!isTaggedTemplate && !isDecorator && typeArguments) { - checkTypeArguments(candidateForTypeArgumentError, node.typeArguments, [], true, headMessage); + var typeArguments_2 = node.typeArguments; + checkTypeArguments(candidateForTypeArgumentError, typeArguments_2, ts.map(typeArguments_2, getTypeFromTypeNode), true, headMessage); } else { ts.Debug.assert(resultOfFailedInference.failedTypeParameterIndex >= 0); @@ -18042,7 +20820,7 @@ var ts; if (candidate.typeParameters) { var typeArgumentTypes = void 0; if (typeArguments) { - typeArgumentTypes = new Array(candidate.typeParameters.length); + typeArgumentTypes = ts.map(typeArguments, getTypeFromTypeNode); typeArgumentsAreValid = checkTypeArguments(candidate, typeArguments, typeArgumentTypes, false); } else { @@ -18089,12 +20867,14 @@ var ts; var superType = checkSuperExpression(node.expression); if (superType !== unknownType) { var baseTypeNode = ts.getClassExtendsHeritageClauseElement(ts.getContainingClass(node)); - var baseConstructors = getInstantiatedConstructorsForTypeArguments(superType, baseTypeNode.typeArguments); - return resolveCall(node, baseConstructors, candidatesOutArray); + if (baseTypeNode) { + var baseConstructors = getInstantiatedConstructorsForTypeArguments(superType, baseTypeNode.typeArguments); + return resolveCall(node, baseConstructors, candidatesOutArray); + } } return resolveUntypedCall(node); } - var funcType = checkExpression(node.expression); + var funcType = checkNonNullExpression(node.expression); var apparentType = getApparentType(funcType); if (apparentType === unknownType) { return resolveErrorCall(node); @@ -18125,7 +20905,7 @@ var ts; error(node.arguments[spreadIndex], ts.Diagnostics.Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_5_and_higher); } } - var expressionType = checkExpression(node.expression); + var expressionType = checkNonNullExpression(node.expression); expressionType = getApparentType(expressionType); if (expressionType === unknownType) { return resolveErrorCall(node); @@ -18143,6 +20923,9 @@ var ts; } var constructSignatures = getSignaturesOfType(expressionType, 1); if (constructSignatures.length) { + if (!isConstructorAccessible(node, constructSignatures[0])) { + return resolveErrorCall(node); + } return resolveCall(node, constructSignatures, candidatesOutArray); } var callSignatures = getSignaturesOfType(expressionType, 0); @@ -18151,11 +20934,36 @@ var ts; if (getReturnTypeOfSignature(signature) !== voidType) { error(node, ts.Diagnostics.Only_a_void_function_can_be_called_with_the_new_keyword); } + if (signature.thisType === voidType) { + error(node, ts.Diagnostics.A_function_that_is_called_with_the_new_keyword_cannot_have_a_this_type_that_is_void); + } return signature; } error(node, ts.Diagnostics.Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature); return resolveErrorCall(node); } + function isConstructorAccessible(node, signature) { + if (!signature || !signature.declaration) { + return true; + } + var declaration = signature.declaration; + var flags = declaration.flags; + if (!(flags & (8 | 16))) { + return true; + } + var declaringClassDeclaration = getClassLikeDeclarationOfSymbol(declaration.parent.symbol); + var declaringClass = getDeclaredTypeOfSymbol(declaration.parent.symbol); + if (!isNodeWithinClass(node, declaringClassDeclaration)) { + if (flags & 8) { + error(node, ts.Diagnostics.Constructor_of_class_0_is_private_and_only_accessible_within_the_class_declaration, typeToString(declaringClass)); + } + if (flags & 16) { + error(node, ts.Diagnostics.Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration, typeToString(declaringClass)); + } + return false; + } + return true; + } function resolveTaggedTemplateExpression(node, candidatesOutArray) { var tagType = checkExpression(node.tag); var apparentType = getApparentType(tagType); @@ -18174,16 +20982,16 @@ var ts; } function getDiagnosticHeadMessageForDecoratorResolution(node) { switch (node.parent.kind) { - case 214: - case 186: + case 221: + case 192: return ts.Diagnostics.Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression; - case 138: + case 142: return ts.Diagnostics.Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression; - case 141: - return ts.Diagnostics.Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression; - case 143: case 145: - case 146: + return ts.Diagnostics.Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression; + case 147: + case 149: + case 150: return ts.Diagnostics.Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression; } } @@ -18199,7 +21007,7 @@ var ts; } var headMessage = getDiagnosticHeadMessageForDecoratorResolution(node); if (!callSignatures.length) { - var errorInfo; + var errorInfo = void 0; errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature); errorInfo = ts.chainDiagnosticMessages(errorInfo, headMessage); diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(node, errorInfo)); @@ -18207,27 +21015,39 @@ var ts; } return resolveCall(node, callSignatures, candidatesOutArray, headMessage); } + function resolveSignature(node, candidatesOutArray) { + switch (node.kind) { + case 174: + return resolveCallExpression(node, candidatesOutArray); + case 175: + return resolveNewExpression(node, candidatesOutArray); + case 176: + return resolveTaggedTemplateExpression(node, candidatesOutArray); + case 143: + return resolveDecorator(node, candidatesOutArray); + } + ts.Debug.fail("Branch in 'resolveSignature' should be unreachable."); + } function getResolvedSignature(node, candidatesOutArray) { var links = getNodeLinks(node); - if (!links.resolvedSignature || candidatesOutArray) { - links.resolvedSignature = anySignature; - if (node.kind === 168) { - links.resolvedSignature = resolveCallExpression(node, candidatesOutArray); - } - else if (node.kind === 169) { - links.resolvedSignature = resolveNewExpression(node, candidatesOutArray); - } - else if (node.kind === 170) { - links.resolvedSignature = resolveTaggedTemplateExpression(node, candidatesOutArray); - } - else if (node.kind === 139) { - links.resolvedSignature = resolveDecorator(node, candidatesOutArray); - } - else { - ts.Debug.fail("Branch in 'getResolvedSignature' should be unreachable."); - } + var cached = links.resolvedSignature; + if (cached && cached !== anySignature && !candidatesOutArray) { + return cached; } - return links.resolvedSignature; + links.resolvedSignature = anySignature; + var result = resolveSignature(node, candidatesOutArray); + links.resolvedSignature = flowLoopStart === flowLoopCount ? result : cached; + return result; + } + function getResolvedOrAnySignature(node) { + return getNodeLinks(node).resolvedSignature === anySignature ? anySignature : getResolvedSignature(node); + } + function getInferredClassType(symbol) { + var links = getSymbolLinks(symbol); + if (!links.inferredClassType) { + links.inferredClassType = createAnonymousType(undefined, symbol.members, emptyArray, emptyArray, undefined, undefined); + } + return links.inferredClassType; } function checkCallExpression(node) { checkGrammarTypeArguments(node, node.typeArguments) || checkGrammarArguments(node, node.arguments); @@ -18235,19 +21055,24 @@ var ts; if (node.expression.kind === 95) { return voidType; } - if (node.kind === 169) { + if (node.kind === 175) { var declaration = signature.declaration; if (declaration && - declaration.kind !== 144 && declaration.kind !== 148 && - declaration.kind !== 153) { - if (compilerOptions.noImplicitAny) { + declaration.kind !== 152 && + declaration.kind !== 157 && + !ts.isJSDocConstructSignature(declaration)) { + var funcSymbol = checkExpression(node.expression).symbol; + if (funcSymbol && funcSymbol.members && (funcSymbol.flags & 16)) { + return getInferredClassType(funcSymbol); + } + else if (compilerOptions.noImplicitAny) { error(node, ts.Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type); } return anyType; } } - if (ts.isInJavaScriptFile(node) && ts.isRequireCall(node)) { + if (ts.isInJavaScriptFile(node) && ts.isRequireCall(node, true)) { return resolveExternalModuleTypeByLiteral(node.arguments[0]); } return getReturnTypeOfSignature(signature); @@ -18260,18 +21085,29 @@ var ts; var targetType = getTypeFromTypeNode(node.type); if (produceDiagnostics && targetType !== unknownType) { var widenedType = getWidenedType(exprType); - var bothAreStringLike = someConstituentTypeHasKind(targetType, 258) && - someConstituentTypeHasKind(widenedType, 258); - if (!bothAreStringLike && !(isTypeAssignableTo(targetType, widenedType))) { - checkTypeAssignableTo(exprType, targetType, node, ts.Diagnostics.Neither_type_0_nor_type_1_is_assignable_to_the_other); + if (!isTypeComparableTo(targetType, widenedType)) { + checkTypeComparableTo(exprType, targetType, node, ts.Diagnostics.Type_0_cannot_be_converted_to_type_1); } } return targetType; } + function checkNonNullAssertion(node) { + return getNonNullableType(checkExpression(node.expression)); + } + function getTypeOfParameter(symbol) { + var type = getTypeOfSymbol(symbol); + if (strictNullChecks) { + var declaration = symbol.valueDeclaration; + if (declaration && declaration.initializer) { + return addNullableKind(type, 32); + } + } + return type; + } function getTypeAtPosition(signature, pos) { return signature.hasRestParameter ? - pos < signature.parameters.length - 1 ? getTypeOfSymbol(signature.parameters[pos]) : getRestTypeOfSignature(signature) : - pos < signature.parameters.length ? getTypeOfSymbol(signature.parameters[pos]) : anyType; + pos < signature.parameters.length - 1 ? getTypeOfParameter(signature.parameters[pos]) : getRestTypeOfSignature(signature) : + pos < signature.parameters.length ? getTypeOfParameter(signature.parameters[pos]) : anyType; } function assignContextualParameterTypes(signature, context, mapper) { var len = signature.parameters.length - (signature.hasRestParameter ? 1 : 0); @@ -18290,7 +21126,7 @@ var ts; if (ts.isBindingPattern(node.name)) { for (var _i = 0, _a = node.name.elements; _i < _a.length; _i++) { var element = _a[_i]; - if (element.kind !== 187) { + if (element.kind !== 193) { if (element.name.kind === 69) { getSymbolLinks(getSymbolOfNode(element)).type = getTypeForBindingElement(element); } @@ -18303,12 +21139,24 @@ var ts; var links = getSymbolLinks(parameter); if (!links.type) { links.type = instantiateType(contextualType, mapper); + if (links.type === emptyObjectType && + (parameter.valueDeclaration.name.kind === 167 || + parameter.valueDeclaration.name.kind === 168)) { + links.type = getTypeFromBindingPattern(parameter.valueDeclaration.name); + } assignBindingElementTypes(parameter.valueDeclaration); } else if (isInferentialContext(mapper)) { inferTypes(mapper.context, links.type, instantiateType(contextualType, mapper)); } } + function getReturnTypeFromJSDocComment(func) { + var returnTag = ts.getJSDocReturnTag(func); + if (returnTag && returnTag.typeExpression) { + return getTypeFromTypeNode(returnTag.typeExpression.type); + } + return undefined; + } function createPromiseType(promisedType) { var globalPromiseType = getGlobalPromiseType(); if (globalPromiseType !== emptyGenericType) { @@ -18324,14 +21172,14 @@ var ts; } var isAsync = ts.isAsyncFunctionLike(func); var type; - if (func.body.kind !== 192) { + if (func.body.kind !== 199) { type = checkExpressionCached(func.body, contextualMapper); if (isAsync) { type = checkAwaitedType(type, func, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member); } } else { - var types; + var types = void 0; var funcIsGenerator = !!func.asteriskToken; if (funcIsGenerator) { types = checkAndAggregateYieldOperandTypes(func.body, contextualMapper); @@ -18344,7 +21192,11 @@ var ts; } } else { - types = checkAndAggregateReturnExpressionTypes(func.body, contextualMapper, isAsync); + var hasImplicitReturn = !!(func.flags & 32768); + types = checkAndAggregateReturnExpressionTypes(func.body, contextualMapper, isAsync, hasImplicitReturn); + if (!types) { + return neverType; + } if (types.length === 0) { if (isAsync) { var promiseType = createPromiseType(voidType); @@ -18354,9 +21206,7 @@ var ts; } return promiseType; } - else { - return voidType; - } + return voidType; } } type = contextualSignature ? getUnionType(types) : getCommonSupertype(types); @@ -18367,7 +21217,7 @@ var ts; } else { error(func, ts.Diagnostics.No_best_common_type_exists_among_return_expressions); - return unknownType; + return getUnionType(types); } } if (funcIsGenerator) { @@ -18406,8 +21256,9 @@ var ts; }); return aggregatedTypes; } - function checkAndAggregateReturnExpressionTypes(body, contextualMapper, isAsync) { + function checkAndAggregateReturnExpressionTypes(body, contextualMapper, isAsync, hasImplicitReturn) { var aggregatedTypes = []; + var hasOmittedExpressions = false; ts.forEachReturnStatement(body, function (returnStatement) { var expr = returnStatement.expression; if (expr) { @@ -18415,45 +21266,67 @@ var ts; if (isAsync) { type = checkAwaitedType(type, body.parent, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member); } - if (!ts.contains(aggregatedTypes, type)) { + if (type !== neverType && !ts.contains(aggregatedTypes, type)) { aggregatedTypes.push(type); } } + else { + hasOmittedExpressions = true; + } }); + if (aggregatedTypes.length === 0 && !hasOmittedExpressions && !hasImplicitReturn) { + return undefined; + } + if (strictNullChecks && aggregatedTypes.length && (hasOmittedExpressions || hasImplicitReturn)) { + if (!ts.contains(aggregatedTypes, undefinedType)) { + aggregatedTypes.push(undefinedType); + } + } return aggregatedTypes; } function checkAllCodePathsInNonVoidFunctionReturnOrThrow(func, returnType) { if (!produceDiagnostics) { return; } - if (returnType === voidType || isTypeAny(returnType)) { + if (returnType && maybeTypeOfKind(returnType, 1 | 16)) { return; } - if (ts.nodeIsMissing(func.body) || func.body.kind !== 192 || !(func.flags & 524288)) { + if (ts.nodeIsMissing(func.body) || func.body.kind !== 199 || !(func.flags & 32768)) { return; } - if (func.flags & 1048576) { - if (compilerOptions.noImplicitReturns) { - error(func.type, ts.Diagnostics.Not_all_code_paths_return_a_value); - } + var hasExplicitReturn = func.flags & 65536; + if (returnType === neverType) { + error(func.type, ts.Diagnostics.A_function_returning_never_cannot_have_a_reachable_end_point); } - else { + else if (returnType && !hasExplicitReturn) { error(func.type, ts.Diagnostics.A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value); } + else if (returnType && strictNullChecks && !isTypeAssignableTo(undefinedType, returnType)) { + error(func.type, ts.Diagnostics.Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined); + } + else if (compilerOptions.noImplicitReturns) { + if (!returnType) { + if (!hasExplicitReturn) { + return; + } + var inferredReturnType = getReturnTypeOfSignature(getSignatureFromDeclaration(func)); + if (isUnwrappedReturnTypeVoidOrAny(func, inferredReturnType)) { + return; + } + } + error(func.type || func, ts.Diagnostics.Not_all_code_paths_return_a_value); + } } function checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper) { - ts.Debug.assert(node.kind !== 143 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 147 || ts.isObjectLiteralMethod(node)); var hasGrammarError = checkGrammarFunctionLikeDeclaration(node); - if (!hasGrammarError && node.kind === 173) { + if (!hasGrammarError && node.kind === 179) { checkGrammarForGenerator(node); } if (contextualMapper === identityMapper && isContextSensitive(node)) { + checkNodeDeferred(node); return anyFunctionType; } - var isAsync = ts.isAsyncFunctionLike(node); - if (isAsync) { - emitAwaiter = true; - } var links = getNodeLinks(node); var type = getTypeOfSymbol(node.symbol); var contextSensitive = isContextSensitive(node); @@ -18477,48 +21350,41 @@ var ts; } if (!contextChecked) { checkSignatureDeclaration(node); + checkNodeDeferred(node); } } } - if (produceDiagnostics && node.kind !== 143 && node.kind !== 142) { + if (produceDiagnostics && node.kind !== 147 && node.kind !== 146) { checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); } return type; } - function checkFunctionExpressionOrObjectLiteralMethodBody(node) { - ts.Debug.assert(node.kind !== 143 || ts.isObjectLiteralMethod(node)); + function checkFunctionExpressionOrObjectLiteralMethodDeferred(node) { + ts.Debug.assert(node.kind !== 147 || ts.isObjectLiteralMethod(node)); var isAsync = ts.isAsyncFunctionLike(node); - if (isAsync) { - emitAwaiter = true; - } - var returnType = node.type && getTypeFromTypeNode(node.type); - var promisedType; - if (returnType && isAsync) { - promisedType = checkAsyncFunctionReturnType(node); - } - if (returnType && !node.asteriskToken) { - checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, isAsync ? promisedType : returnType); + var returnOrPromisedType = node.type && (isAsync ? checkAsyncFunctionReturnType(node) : getTypeFromTypeNode(node.type)); + if (!node.asteriskToken) { + checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnOrPromisedType); } if (node.body) { if (!node.type) { getReturnTypeOfSignature(getSignatureFromDeclaration(node)); } - if (node.body.kind === 192) { + if (node.body.kind === 199) { checkSourceElement(node.body); } else { var exprType = checkExpression(node.body); - if (returnType) { + if (returnOrPromisedType) { if (isAsync) { var awaitedType = checkAwaitedType(exprType, node.body, ts.Diagnostics.Expression_body_for_async_arrow_function_does_not_have_a_valid_callable_then_member); - checkTypeAssignableTo(awaitedType, promisedType, node.body); + checkTypeAssignableTo(awaitedType, returnOrPromisedType, node.body); } else { - checkTypeAssignableTo(exprType, returnType, node.body); + checkTypeAssignableTo(exprType, returnOrPromisedType, node.body); } } - checkFunctionAndClassExpressionBodies(node.body); } } } @@ -18529,59 +21395,62 @@ var ts; } return true; } - function checkReferenceExpression(n, invalidReferenceMessage, constantVariableMessage) { - function findSymbol(n) { - var symbol = getNodeLinks(n).resolvedSymbol; - return symbol && getExportSymbolOfValueSymbolIfExported(symbol); + function isReadonlySymbol(symbol) { + return symbol.flags & 4 && (getDeclarationFlagsFromSymbol(symbol) & 64) !== 0 || + symbol.flags & 3 && (getDeclarationFlagsFromSymbol(symbol) & 2048) !== 0 || + symbol.flags & 98304 && !(symbol.flags & 65536) || + (symbol.flags & 8) !== 0; + } + function isReferenceToReadonlyEntity(expr, symbol) { + if (isReadonlySymbol(symbol)) { + if (symbol.flags & 4 && + (expr.kind === 172 || expr.kind === 173) && + expr.expression.kind === 97) { + var func = ts.getContainingFunction(expr); + return !(func && func.kind === 148 && func.parent === symbol.valueDeclaration.parent); + } + return true; } - function isReferenceOrErrorExpression(n) { - switch (n.kind) { - case 69: { - var symbol = findSymbol(n); - return !symbol || symbol === unknownSymbol || symbol === argumentsSymbol || (symbol.flags & 3) !== 0; + return false; + } + function isReferenceThroughNamespaceImport(expr) { + if (expr.kind === 172 || expr.kind === 173) { + var node = skipParenthesizedNodes(expr.expression); + if (node.kind === 69) { + var symbol = getNodeLinks(node).resolvedSymbol; + if (symbol.flags & 8388608) { + var declaration = getDeclarationOfAliasSymbol(symbol); + return declaration && declaration.kind === 232; } - case 166: { - var symbol = findSymbol(n); - return !symbol || symbol === unknownSymbol || (symbol.flags & ~8) !== 0; - } - case 167: - return true; - case 172: - return isReferenceOrErrorExpression(n.expression); - default: - return false; } } - function isConstVariableReference(n) { - switch (n.kind) { - case 69: - case 166: { - var symbol = findSymbol(n); - return symbol && (symbol.flags & 3) !== 0 && (getDeclarationFlagsFromSymbol(symbol) & 16384) !== 0; - } - case 167: { - var index = n.argumentExpression; - var symbol = findSymbol(n.expression); - if (symbol && index && index.kind === 9) { - var name_12 = index.text; - var prop = getPropertyOfType(getTypeOfSymbol(symbol), name_12); - return prop && (prop.flags & 3) !== 0 && (getDeclarationFlagsFromSymbol(prop) & 16384) !== 0; - } + return false; + } + function checkReferenceExpression(expr, invalidReferenceMessage, constantVariableMessage) { + var node = skipParenthesizedNodes(expr); + if (node.kind !== 69 && node.kind !== 172 && node.kind !== 173) { + error(expr, invalidReferenceMessage); + return false; + } + var links = getNodeLinks(node); + var symbol = getExportSymbolOfValueSymbolIfExported(links.resolvedSymbol); + if (symbol) { + if (symbol !== unknownSymbol && symbol !== argumentsSymbol) { + if (node.kind === 69 && !(symbol.flags & 3)) { + error(expr, invalidReferenceMessage); return false; } - case 172: - return isConstVariableReference(n.expression); - default: + if (isReferenceToReadonlyEntity(node, symbol) || isReferenceThroughNamespaceImport(node)) { + error(expr, constantVariableMessage); return false; + } } } - if (!isReferenceOrErrorExpression(n)) { - error(n, invalidReferenceMessage); - return false; - } - if (isConstVariableReference(n)) { - error(n, constantVariableMessage); - return false; + else if (node.kind === 173) { + if (links.resolvedIndexInfo && links.resolvedIndexInfo.isReadonly) { + error(expr, constantVariableMessage); + return false; + } } return true; } @@ -18599,7 +21468,7 @@ var ts; } function checkAwaitExpression(node) { if (produceDiagnostics) { - if (!(node.parserContextFlags & 8)) { + if (!(node.flags & 33554432)) { grammarErrorOnFirstToken(node, ts.Diagnostics.await_expression_is_only_allowed_within_an_async_function); } if (isInParameterInitializerBeforeContainingFunction(node)) { @@ -18615,7 +21484,7 @@ var ts; case 35: case 36: case 50: - if (someConstituentTypeHasKind(operandType, 16777216)) { + if (maybeTypeOfKind(operandType, 16777216)) { error(node.operand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(node.operator)); } return numberType; @@ -18623,9 +21492,9 @@ var ts; return booleanType; case 41: case 42: - var ok = checkArithmeticOperandType(node.operand, operandType, ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); + var ok = checkArithmeticOperandType(node.operand, getNonNullableType(operandType), ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); if (ok) { - checkReferenceExpression(node.operand, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant); + checkReferenceExpression(node.operand, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant_or_a_read_only_property); } return numberType; } @@ -18633,42 +21502,50 @@ var ts; } function checkPostfixUnaryExpression(node) { var operandType = checkExpression(node.operand); - var ok = checkArithmeticOperandType(node.operand, operandType, ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); + var ok = checkArithmeticOperandType(node.operand, getNonNullableType(operandType), ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); if (ok) { - checkReferenceExpression(node.operand, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant); + checkReferenceExpression(node.operand, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant_or_a_read_only_property); } return numberType; } - function someConstituentTypeHasKind(type, kind) { - if (type.flags & kind) { - return true; - } - if (type.flags & 49152) { - var types = type.types; - for (var _i = 0, types_9 = types; _i < types_9.length; _i++) { - var current = types_9[_i]; - if (current.flags & kind) { - return true; - } - } - return false; - } - return false; - } - function allConstituentTypesHaveKind(type, kind) { + function maybeTypeOfKind(type, kind) { if (type.flags & kind) { return true; } if (type.flags & 49152) { var types = type.types; for (var _i = 0, types_10 = types; _i < types_10.length; _i++) { - var current = types_10[_i]; - if (!(current.flags & kind)) { + var t = types_10[_i]; + if (maybeTypeOfKind(t, kind)) { + return true; + } + } + } + return false; + } + function isTypeOfKind(type, kind) { + if (type.flags & kind) { + return true; + } + if (type.flags & 16384) { + var types = type.types; + for (var _i = 0, types_11 = types; _i < types_11.length; _i++) { + var t = types_11[_i]; + if (!isTypeOfKind(t, kind)) { return false; } } return true; } + if (type.flags & 32768) { + var types = type.types; + for (var _a = 0, types_12 = types; _a < types_12.length; _a++) { + var t = types_12[_a]; + if (isTypeOfKind(t, kind)) { + return true; + } + } + } return false; } function isConstEnumObjectType(type) { @@ -18678,7 +21555,7 @@ var ts; return (symbol.flags & 128) !== 0; } function checkInstanceOfExpression(left, right, leftType, rightType) { - if (allConstituentTypesHaveKind(leftType, 16777726)) { + if (isTypeOfKind(leftType, 16777726)) { error(left, ts.Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); } if (!(isTypeAny(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) { @@ -18699,84 +21576,92 @@ var ts; var properties = node.properties; for (var _i = 0, properties_3 = properties; _i < properties_3.length; _i++) { var p = properties_3[_i]; - if (p.kind === 245 || p.kind === 246) { - var name_13 = p.name; - if (name_13.kind === 136) { - checkComputedPropertyName(name_13); - } - if (isComputedNonLiteralName(name_13)) { - continue; - } - var text = getTextOfPropertyName(name_13); - var type = isTypeAny(sourceType) - ? sourceType - : getTypeOfPropertyOfType(sourceType, text) || - isNumericLiteralName(text) && getIndexTypeOfType(sourceType, 1) || - getIndexTypeOfType(sourceType, 0); - if (type) { - if (p.kind === 246) { - checkDestructuringAssignment(p, type); - } - else { - checkDestructuringAssignment(p.initializer, type); - } + checkObjectLiteralDestructuringPropertyAssignment(sourceType, p, contextualMapper); + } + return sourceType; + } + function checkObjectLiteralDestructuringPropertyAssignment(objectLiteralType, property, contextualMapper) { + if (property.kind === 253 || property.kind === 254) { + var name_13 = property.name; + if (name_13.kind === 140) { + checkComputedPropertyName(name_13); + } + if (isComputedNonLiteralName(name_13)) { + return undefined; + } + var text = getTextOfPropertyName(name_13); + var type = isTypeAny(objectLiteralType) + ? objectLiteralType + : getTypeOfPropertyOfType(objectLiteralType, text) || + isNumericLiteralName(text) && getIndexTypeOfType(objectLiteralType, 1) || + getIndexTypeOfType(objectLiteralType, 0); + if (type) { + if (property.kind === 254) { + return checkDestructuringAssignment(property, type); } else { - error(name_13, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(sourceType), ts.declarationNameToString(name_13)); + return checkDestructuringAssignment(property.initializer, type); } } else { - error(p, ts.Diagnostics.Property_assignment_expected); + error(name_13, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(objectLiteralType), ts.declarationNameToString(name_13)); } } - return sourceType; + else { + error(property, ts.Diagnostics.Property_assignment_expected); + } } function checkArrayLiteralAssignment(node, sourceType, contextualMapper) { var elementType = checkIteratedTypeOrElementType(sourceType, node, false) || unknownType; var elements = node.elements; for (var i = 0; i < elements.length; i++) { - var e = elements[i]; - if (e.kind !== 187) { - if (e.kind !== 185) { - var propName = "" + i; - var type = isTypeAny(sourceType) - ? sourceType - : isTupleLikeType(sourceType) - ? getTypeOfPropertyOfType(sourceType, propName) - : elementType; - if (type) { - checkDestructuringAssignment(e, type, contextualMapper); - } - else { - if (isTupleType(sourceType)) { - error(e, ts.Diagnostics.Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2, typeToString(sourceType), sourceType.elementTypes.length, elements.length); - } - else { - error(e, ts.Diagnostics.Type_0_has_no_property_1, typeToString(sourceType), propName); - } - } + checkArrayLiteralDestructuringElementAssignment(node, sourceType, i, elementType, contextualMapper); + } + return sourceType; + } + function checkArrayLiteralDestructuringElementAssignment(node, sourceType, elementIndex, elementType, contextualMapper) { + var elements = node.elements; + var element = elements[elementIndex]; + if (element.kind !== 193) { + if (element.kind !== 191) { + var propName = "" + elementIndex; + var type = isTypeAny(sourceType) + ? sourceType + : isTupleLikeType(sourceType) + ? getTypeOfPropertyOfType(sourceType, propName) + : elementType; + if (type) { + return checkDestructuringAssignment(element, type, contextualMapper); } else { - if (i < elements.length - 1) { - error(e, ts.Diagnostics.A_rest_element_must_be_last_in_an_array_destructuring_pattern); + if (isTupleType(sourceType)) { + error(element, ts.Diagnostics.Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2, typeToString(sourceType), sourceType.elementTypes.length, elements.length); } else { - var restExpression = e.expression; - if (restExpression.kind === 181 && restExpression.operatorToken.kind === 56) { - error(restExpression.operatorToken, ts.Diagnostics.A_rest_element_cannot_have_an_initializer); - } - else { - checkDestructuringAssignment(restExpression, createArrayType(elementType), contextualMapper); - } + error(element, ts.Diagnostics.Type_0_has_no_property_1, typeToString(sourceType), propName); + } + } + } + else { + if (elementIndex < elements.length - 1) { + error(element, ts.Diagnostics.A_rest_element_must_be_last_in_an_array_destructuring_pattern); + } + else { + var restExpression = element.expression; + if (restExpression.kind === 187 && restExpression.operatorToken.kind === 56) { + error(restExpression.operatorToken, ts.Diagnostics.A_rest_element_cannot_have_an_initializer); + } + else { + return checkDestructuringAssignment(restExpression, createArrayType(elementType), contextualMapper); } } } } - return sourceType; + return undefined; } function checkDestructuringAssignment(exprOrAssignment, sourceType, contextualMapper) { var target; - if (exprOrAssignment.kind === 246) { + if (exprOrAssignment.kind === 254) { var prop = exprOrAssignment; if (prop.objectAssignmentInitializer) { checkBinaryLikeExpression(prop.name, prop.equalsToken, prop.objectAssignmentInitializer, contextualMapper); @@ -18786,31 +21671,34 @@ var ts; else { target = exprOrAssignment; } - if (target.kind === 181 && target.operatorToken.kind === 56) { + if (target.kind === 187 && target.operatorToken.kind === 56) { checkBinaryExpression(target, contextualMapper); target = target.left; } - if (target.kind === 165) { + if (target.kind === 171) { return checkObjectLiteralAssignment(target, sourceType, contextualMapper); } - if (target.kind === 164) { + if (target.kind === 170) { return checkArrayLiteralAssignment(target, sourceType, contextualMapper); } return checkReferenceAssignment(target, sourceType, contextualMapper); } function checkReferenceAssignment(target, sourceType, contextualMapper) { var targetType = checkExpression(target, contextualMapper); - if (checkReferenceExpression(target, ts.Diagnostics.Invalid_left_hand_side_of_assignment_expression, ts.Diagnostics.Left_hand_side_of_assignment_expression_cannot_be_a_constant)) { + if (checkReferenceExpression(target, ts.Diagnostics.Invalid_left_hand_side_of_assignment_expression, ts.Diagnostics.Left_hand_side_of_assignment_expression_cannot_be_a_constant_or_a_read_only_property)) { checkTypeAssignableTo(sourceType, targetType, target, undefined); } return sourceType; } + function isTypeEqualityComparableTo(source, target) { + return (target.flags & 96) !== 0 || isTypeComparableTo(source, target); + } function checkBinaryExpression(node, contextualMapper) { return checkBinaryLikeExpression(node.left, node.operatorToken, node.right, contextualMapper, node); } function checkBinaryLikeExpression(left, operatorToken, right, contextualMapper, errorNode) { var operator = operatorToken.kind; - if (operator === 56 && (left.kind === 165 || left.kind === 164)) { + if (operator === 56 && (left.kind === 171 || left.kind === 170)) { return checkDestructuringAssignment(left, checkExpression(right, contextualMapper), contextualMapper); } var leftType = checkExpression(left, contextualMapper); @@ -18838,11 +21726,13 @@ var ts; case 68: case 46: case 66: - if (leftType.flags & (32 | 64)) + if (leftType.flags & 96) leftType = rightType; - if (rightType.flags & (32 | 64)) + if (rightType.flags & 96) rightType = leftType; - var suggestedOperator; + leftType = getNonNullableType(leftType); + rightType = getNonNullableType(rightType); + var suggestedOperator = void 0; if ((leftType.flags & 8) && (rightType.flags & 8) && (suggestedOperator = getSuggestedBooleanOperator(operatorToken.kind)) !== undefined) { @@ -18858,16 +21748,18 @@ var ts; return numberType; case 35: case 57: - if (leftType.flags & (32 | 64)) + if (leftType.flags & 96) leftType = rightType; - if (rightType.flags & (32 | 64)) + if (rightType.flags & 96) rightType = leftType; - var resultType; - if (allConstituentTypesHaveKind(leftType, 132) && allConstituentTypesHaveKind(rightType, 132)) { + leftType = getNonNullableType(leftType); + rightType = getNonNullableType(rightType); + var resultType = void 0; + if (isTypeOfKind(leftType, 132) && isTypeOfKind(rightType, 132)) { resultType = numberType; } else { - if (allConstituentTypesHaveKind(leftType, 258) || allConstituentTypesHaveKind(rightType, 258)) { + if (isTypeOfKind(leftType, 258) || isTypeOfKind(rightType, 258)) { resultType = stringType; } else if (isTypeAny(leftType) || isTypeAny(rightType)) { @@ -18889,17 +21781,17 @@ var ts; case 27: case 28: case 29: - if (!checkForDisallowedESSymbolOperand(operator)) { - return booleanType; + if (checkForDisallowedESSymbolOperand(operator)) { + if (!isTypeComparableTo(leftType, rightType) && !isTypeComparableTo(rightType, leftType)) { + reportOperatorError(); + } } + return booleanType; case 30: case 31: case 32: case 33: - if (someConstituentTypeHasKind(leftType, 258) && someConstituentTypeHasKind(rightType, 258)) { - return booleanType; - } - if (!isTypeAssignableTo(leftType, rightType) && !isTypeAssignableTo(rightType, leftType)) { + if (!isTypeEqualityComparableTo(leftType, rightType) && !isTypeEqualityComparableTo(rightType, leftType)) { reportOperatorError(); } return booleanType; @@ -18908,9 +21800,9 @@ var ts; case 90: return checkInExpression(left, right, leftType, rightType); case 51: - return rightType; + return addNullableKind(rightType, getNullableKind(leftType)); case 52: - return getUnionType([leftType, rightType]); + return getUnionType([getNonNullableType(leftType), rightType]); case 56: checkAssignmentOperator(rightType); return getRegularTypeOfObjectLiteral(rightType); @@ -18918,8 +21810,8 @@ var ts; return rightType; } function checkForDisallowedESSymbolOperand(operator) { - var offendingSymbolOperand = someConstituentTypeHasKind(leftType, 16777216) ? left : - someConstituentTypeHasKind(rightType, 16777216) ? right : + var offendingSymbolOperand = maybeTypeOfKind(leftType, 16777216) ? left : + maybeTypeOfKind(rightType, 16777216) ? right : undefined; if (offendingSymbolOperand) { error(offendingSymbolOperand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(operator)); @@ -18944,7 +21836,7 @@ var ts; } function checkAssignmentOperator(valueType) { if (produceDiagnostics && operator >= 56 && operator <= 68) { - var ok = checkReferenceExpression(left, ts.Diagnostics.Invalid_left_hand_side_of_assignment_expression, ts.Diagnostics.Left_hand_side_of_assignment_expression_cannot_be_a_constant); + var ok = checkReferenceExpression(left, ts.Diagnostics.Invalid_left_hand_side_of_assignment_expression, ts.Diagnostics.Left_hand_side_of_assignment_expression_cannot_be_a_constant_or_a_read_only_property); if (ok) { checkTypeAssignableTo(valueType, leftType, left, undefined); } @@ -18971,7 +21863,7 @@ var ts; } function checkYieldExpression(node) { if (produceDiagnostics) { - if (!(node.parserContextFlags & 2) || isYieldExpressionInClass(node)) { + if (!(node.flags & 8388608) || isYieldExpressionInClass(node)) { grammarErrorOnFirstToken(node, ts.Diagnostics.A_yield_expression_is_only_allowed_in_a_generator_body); } if (isInParameterInitializerBeforeContainingFunction(node)) { @@ -18982,7 +21874,7 @@ var ts; var func = ts.getContainingFunction(node); if (func && func.asteriskToken) { var expressionType = checkExpressionCached(node.expression, undefined); - var expressionElementType; + var expressionElementType = void 0; var nodeIsYieldStar = !!node.asteriskToken; if (nodeIsYieldStar) { expressionElementType = checkElementTypeOfIterable(expressionType, node.expression); @@ -19009,7 +21901,7 @@ var ts; function checkStringLiteralExpression(node) { var contextualType = getContextualType(node); if (contextualType && contextualTypeIsStringLiteralType(contextualType)) { - return getStringLiteralType(node); + return getStringLiteralTypeForText(node.text); } return stringType; } @@ -19029,19 +21921,22 @@ var ts; function checkExpressionCached(node, contextualMapper) { var links = getNodeLinks(node); if (!links.resolvedType) { + var saveFlowLoopStart = flowLoopStart; + flowLoopStart = flowLoopCount; links.resolvedType = checkExpression(node, contextualMapper); + flowLoopStart = saveFlowLoopStart; } return links.resolvedType; } function checkPropertyAssignment(node, contextualMapper) { - if (node.name.kind === 136) { + if (node.name.kind === 140) { checkComputedPropertyName(node.name); } return checkExpression(node.initializer, contextualMapper); } function checkObjectLiteralMethod(node, contextualMapper) { checkGrammarMethod(node); - if (node.name.kind === 136) { + if (node.name.kind === 140) { checkComputedPropertyName(node.name); } var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); @@ -19064,7 +21959,7 @@ var ts; } function checkExpression(node, contextualMapper) { var type; - if (node.kind === 135) { + if (node.kind === 139) { type = checkQualifiedName(node); } else { @@ -19072,9 +21967,9 @@ var ts; type = instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, contextualMapper); } if (isConstEnumObjectType(type)) { - var ok = (node.parent.kind === 166 && node.parent.expression === node) || - (node.parent.kind === 167 && node.parent.expression === node) || - ((node.kind === 69 || node.kind === 135) && isInRightSideOfImportOrExportAssignment(node)); + var ok = (node.parent.kind === 172 && node.parent.expression === node) || + (node.parent.kind === 173 && node.parent.expression === node) || + ((node.kind === 69 || node.kind === 139) && isInRightSideOfImportOrExportAssignment(node)); if (!ok) { error(node, ts.Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment); } @@ -19100,7 +21995,7 @@ var ts; return booleanType; case 8: return checkNumericLiteral(node); - case 183: + case 189: return checkTemplateExpression(node); case 9: return checkStringLiteralExpression(node); @@ -19108,58 +22003,60 @@ var ts; return stringType; case 10: return globalRegExpType; - case 164: - return checkArrayLiteral(node, contextualMapper); - case 165: - return checkObjectLiteral(node, contextualMapper); - case 166: - return checkPropertyAccessExpression(node); - case 167: - return checkIndexedAccess(node); - case 168: - case 169: - return checkCallExpression(node); case 170: - return checkTaggedTemplateExpression(node); - case 172: - return checkExpression(node.expression, contextualMapper); - case 186: - return checkClassExpression(node); - case 173: - case 174: - return checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); - case 176: - return checkTypeOfExpression(node); + return checkArrayLiteral(node, contextualMapper); case 171: - case 189: - return checkAssertion(node); + return checkObjectLiteral(node, contextualMapper); + case 172: + return checkPropertyAccessExpression(node); + case 173: + return checkIndexedAccess(node); + case 174: case 175: - return checkDeleteExpression(node); - case 177: - return checkVoidExpression(node); + return checkCallExpression(node); + case 176: + return checkTaggedTemplateExpression(node); case 178: - return checkAwaitExpression(node); + return checkExpression(node.expression, contextualMapper); + case 192: + return checkClassExpression(node); case 179: - return checkPrefixUnaryExpression(node); case 180: - return checkPostfixUnaryExpression(node); - case 181: - return checkBinaryExpression(node, contextualMapper); + return checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); case 182: - return checkConditionalExpression(node, contextualMapper); - case 185: - return checkSpreadElementExpression(node, contextualMapper); - case 187: - return undefinedType; + return checkTypeOfExpression(node); + case 177: + case 195: + return checkAssertion(node); + case 196: + return checkNonNullAssertion(node); + case 181: + return checkDeleteExpression(node); + case 183: + return checkVoidExpression(node); case 184: + return checkAwaitExpression(node); + case 185: + return checkPrefixUnaryExpression(node); + case 186: + return checkPostfixUnaryExpression(node); + case 187: + return checkBinaryExpression(node, contextualMapper); + case 188: + return checkConditionalExpression(node, contextualMapper); + case 191: + return checkSpreadElementExpression(node, contextualMapper); + case 193: + return undefinedType; + case 190: return checkYieldExpression(node); - case 240: + case 248: return checkJsxExpression(node); - case 233: + case 241: return checkJsxElement(node); - case 234: + case 242: return checkJsxSelfClosingElement(node); - case 235: + case 243: ts.Debug.fail("Shouldn't ever directly check a JsxOpeningElement"); } return unknownType; @@ -19169,8 +22066,8 @@ var ts; grammarErrorOnFirstToken(node.expression, ts.Diagnostics.Type_expected); } checkSourceElement(node.constraint); + getConstraintOfTypeParameter(getDeclaredTypeOfTypeParameter(getSymbolOfNode(node))); if (produceDiagnostics) { - checkTypeParameterHasIllegalReferencesInConstraint(node); checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_parameter_name_cannot_be_0); } } @@ -19178,15 +22075,23 @@ var ts; checkGrammarDecorators(node) || checkGrammarModifiers(node); checkVariableLikeDeclaration(node); var func = ts.getContainingFunction(node); - if (node.flags & 56) { + if (node.flags & 92) { func = ts.getContainingFunction(node); - if (!(func.kind === 144 && ts.nodeIsPresent(func.body))) { + if (!(func.kind === 148 && ts.nodeIsPresent(func.body))) { error(node, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); } } if (node.questionToken && ts.isBindingPattern(node.name) && func.body) { error(node, ts.Diagnostics.A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature); } + if (node.name.text === "this") { + if (ts.indexOf(func.parameters, node) !== 0) { + error(node, ts.Diagnostics.A_this_parameter_must_be_the_first_parameter); + } + if (func.kind === 148 || func.kind === 152 || func.kind === 157) { + error(node, ts.Diagnostics.A_constructor_cannot_have_a_this_parameter); + } + } if (node.dotDotDotToken && !ts.isBindingPattern(node.name) && !isArrayType(getTypeOfSymbol(node.symbol))) { error(node, ts.Diagnostics.A_rest_parameter_must_be_of_an_array_type); } @@ -19195,9 +22100,9 @@ var ts; if (!node.asteriskToken || !node.body) { return false; } - return node.kind === 143 || - node.kind === 213 || - node.kind === 173; + return node.kind === 147 || + node.kind === 220 || + node.kind === 179; } function getTypePredicateParameterIndex(parameterList, parameter) { if (parameterList) { @@ -19211,90 +22116,99 @@ var ts; } return -1; } - function isInLegalTypePredicatePosition(node) { - switch (node.parent.kind) { - case 174: - case 147: - case 213: - case 173: - case 152: - case 143: - case 142: - return node === node.parent.type; + function checkTypePredicate(node) { + var parent = getTypePredicateParent(node); + if (!parent) { + error(node, ts.Diagnostics.A_type_predicate_is_only_allowed_in_return_type_position_for_functions_and_methods); + return; + } + var typePredicate = getSignatureFromDeclaration(parent).typePredicate; + if (!typePredicate) { + return; + } + var parameterName = node.parameterName; + if (ts.isThisTypePredicate(typePredicate)) { + getTypeFromThisTypeNode(parameterName); + } + else { + if (typePredicate.parameterIndex >= 0) { + if (parent.parameters[typePredicate.parameterIndex].dotDotDotToken) { + error(parameterName, ts.Diagnostics.A_type_predicate_cannot_reference_a_rest_parameter); + } + else { + var leadingError = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.A_type_predicate_s_type_must_be_assignable_to_its_parameter_s_type); + checkTypeAssignableTo(typePredicate.type, getTypeOfNode(parent.parameters[typePredicate.parameterIndex]), node.type, undefined, leadingError); + } + } + else if (parameterName) { + var hasReportedError = false; + for (var _i = 0, _a = parent.parameters; _i < _a.length; _i++) { + var name_14 = _a[_i].name; + if (ts.isBindingPattern(name_14) && + checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_14, parameterName, typePredicate.parameterName)) { + hasReportedError = true; + break; + } + } + if (!hasReportedError) { + error(node.parameterName, ts.Diagnostics.Cannot_find_parameter_0, typePredicate.parameterName); + } + } + } + } + function getTypePredicateParent(node) { + switch (node.parent.kind) { + case 180: + case 151: + case 220: + case 179: + case 156: + case 147: + case 146: + var parent_10 = node.parent; + if (node === parent_10.type) { + return parent_10; + } + } + } + function checkIfTypePredicateVariableIsDeclaredInBindingPattern(pattern, predicateVariableNode, predicateVariableName) { + for (var _i = 0, _a = pattern.elements; _i < _a.length; _i++) { + var name_15 = _a[_i].name; + if (name_15.kind === 69 && + name_15.text === predicateVariableName) { + error(predicateVariableNode, ts.Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, predicateVariableName); + return true; + } + else if (name_15.kind === 168 || + name_15.kind === 167) { + if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_15, predicateVariableNode, predicateVariableName)) { + return true; + } + } } - return false; } function checkSignatureDeclaration(node) { - if (node.kind === 149) { + if (node.kind === 153) { checkGrammarIndexSignature(node); } - else if (node.kind === 152 || node.kind === 213 || node.kind === 153 || - node.kind === 147 || node.kind === 144 || - node.kind === 148) { + else if (node.kind === 156 || node.kind === 220 || node.kind === 157 || + node.kind === 151 || node.kind === 148 || + node.kind === 152) { checkGrammarFunctionLikeDeclaration(node); } checkTypeParameters(node.typeParameters); ts.forEach(node.parameters, checkParameter); if (node.type) { - if (node.type.kind === 150) { - var typePredicate = getSignatureFromDeclaration(node).typePredicate; - var typePredicateNode = node.type; - if (isInLegalTypePredicatePosition(typePredicateNode)) { - if (typePredicate.parameterIndex >= 0) { - if (node.parameters[typePredicate.parameterIndex].dotDotDotToken) { - error(typePredicateNode.parameterName, ts.Diagnostics.A_type_predicate_cannot_reference_a_rest_parameter); - } - else { - checkTypeAssignableTo(typePredicate.type, getTypeOfNode(node.parameters[typePredicate.parameterIndex]), typePredicateNode.type); - } - } - else if (typePredicateNode.parameterName) { - var hasReportedError = false; - for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) { - var param = _a[_i]; - if (hasReportedError) { - break; - } - if (param.name.kind === 161 || - param.name.kind === 162) { - (function checkBindingPattern(pattern) { - for (var _i = 0, _a = pattern.elements; _i < _a.length; _i++) { - var element = _a[_i]; - if (element.name.kind === 69 && - element.name.text === typePredicate.parameterName) { - error(typePredicateNode.parameterName, ts.Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, typePredicate.parameterName); - hasReportedError = true; - break; - } - else if (element.name.kind === 162 || - element.name.kind === 161) { - checkBindingPattern(element.name); - } - } - })(param.name); - } - } - if (!hasReportedError) { - error(typePredicateNode.parameterName, ts.Diagnostics.Cannot_find_parameter_0, typePredicate.parameterName); - } - } - } - else { - error(typePredicateNode, ts.Diagnostics.A_type_predicate_is_only_allowed_in_return_type_position_for_functions_and_methods); - } - } - else { - checkSourceElement(node.type); - } + checkSourceElement(node.type); } if (produceDiagnostics) { checkCollisionWithArgumentsInGeneratedCode(node); if (compilerOptions.noImplicitAny && !node.type) { switch (node.kind) { - case 148: + case 152: error(node, ts.Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; - case 147: + case 151: error(node, ts.Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; } @@ -19311,12 +22225,14 @@ var ts; checkTypeAssignableTo(iterableIteratorInstantiation, returnType, node.type); } } + else if (ts.isAsyncFunctionLike(node)) { + checkAsyncFunctionReturnType(node); + } } } - checkSpecializedSignatureDeclaration(node); } function checkTypeForDuplicateIndexSignatures(node) { - if (node.kind === 215) { + if (node.kind === 222) { var nodeSymbol = getSymbolOfNode(node); if (nodeSymbol.declarations.length > 0 && nodeSymbol.declarations[0] !== node) { return; @@ -19331,7 +22247,7 @@ var ts; var declaration = decl; if (declaration.parameters.length === 1 && declaration.parameters[0].type) { switch (declaration.parameters[0].type.kind) { - case 130: + case 132: if (!seenStringIndexer) { seenStringIndexer = true; } @@ -19339,7 +22255,7 @@ var ts; error(declaration, ts.Diagnostics.Duplicate_string_index_signature); } break; - case 128: + case 130: if (!seenNumericIndexer) { seenNumericIndexer = true; } @@ -19358,7 +22274,7 @@ var ts; } function checkMethodDeclaration(node) { checkGrammarMethod(node) || checkGrammarComputedPropertyName(node.name); - checkFunctionLikeDeclaration(node); + checkFunctionOrMethodDeclaration(node); if (node.flags & 128 && node.body) { error(node, ts.Diagnostics.Method_0_cannot_have_an_implementation_because_it_is_marked_abstract, ts.declarationNameToString(node.name)); } @@ -19378,14 +22294,11 @@ var ts; if (!produceDiagnostics) { return; } - function isSuperCallExpression(n) { - return n.kind === 168 && n.expression.kind === 95; - } function containsSuperCallAsComputedPropertyName(n) { return n.name && containsSuperCall(n.name); } function containsSuperCall(n) { - if (isSuperCallExpression(n)) { + if (ts.isSuperCallExpression(n)) { return true; } else if (ts.isFunctionLike(n)) { @@ -19400,32 +22313,31 @@ var ts; if (n.kind === 97) { error(n, ts.Diagnostics.this_cannot_be_referenced_in_current_location); } - else if (n.kind !== 173 && n.kind !== 213) { + else if (n.kind !== 179 && n.kind !== 220) { ts.forEachChild(n, markThisReferencesAsErrors); } } function isInstancePropertyWithInitializer(n) { - return n.kind === 141 && - !(n.flags & 64) && + return n.kind === 145 && + !(n.flags & 32) && !!n.initializer; } var containingClassDecl = node.parent; if (ts.getClassExtendsHeritageClauseElement(containingClassDecl)) { - var containingClassSymbol = getSymbolOfNode(containingClassDecl); - var containingClassInstanceType = getDeclaredTypeOfSymbol(containingClassSymbol); - var baseConstructorType = getBaseConstructorTypeOfClass(containingClassInstanceType); - if (containsSuperCall(node.body)) { - if (baseConstructorType === nullType) { - error(node, ts.Diagnostics.A_constructor_cannot_contain_a_super_call_when_its_class_extends_null); + var classExtendsNull = classDeclarationExtendsNull(containingClassDecl); + var superCall = getSuperCallInConstructor(node); + if (superCall) { + if (classExtendsNull) { + error(superCall, ts.Diagnostics.A_constructor_cannot_contain_a_super_call_when_its_class_extends_null); } var superCallShouldBeFirst = ts.forEach(node.parent.members, isInstancePropertyWithInitializer) || - ts.forEach(node.parameters, function (p) { return p.flags & (8 | 16 | 32); }); + ts.forEach(node.parameters, function (p) { return p.flags & 92; }); if (superCallShouldBeFirst) { var statements = node.body.statements; - var superCallStatement; + var superCallStatement = void 0; for (var _i = 0, statements_2 = statements; _i < statements_2.length; _i++) { var statement = statements_2[_i]; - if (statement.kind === 195 && isSuperCallExpression(statement.expression)) { + if (statement.kind === 202 && ts.isSuperCallExpression(statement.expression)) { superCallStatement = statement; break; } @@ -19436,12 +22348,9 @@ var ts; if (!superCallStatement) { error(node, ts.Diagnostics.A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties); } - else { - markThisReferencesAsErrors(superCallStatement.expression); - } } } - else if (baseConstructorType !== nullType) { + else if (!classExtendsNull) { error(node, ts.Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call); } } @@ -19449,9 +22358,11 @@ var ts; function checkAccessorDeclaration(node) { if (produceDiagnostics) { checkGrammarFunctionLikeDeclaration(node) || checkGrammarAccessor(node) || checkGrammarComputedPropertyName(node.name); - if (node.kind === 145) { - if (!ts.isInAmbientContext(node) && ts.nodeIsPresent(node.body) && (node.flags & 524288)) { - if (node.flags & 1048576) { + checkDecorators(node); + checkSignatureDeclaration(node); + if (node.kind === 149) { + if (!ts.isInAmbientContext(node) && ts.nodeIsPresent(node.body) && (node.flags & 32768)) { + if (node.flags & 65536) { if (compilerOptions.noImplicitReturns) { error(node.name, ts.Diagnostics.Not_all_code_paths_return_a_value); } @@ -19461,36 +22372,58 @@ var ts; } } } + if (node.name.kind === 140) { + checkComputedPropertyName(node.name); + } if (!ts.hasDynamicName(node)) { - var otherKind = node.kind === 145 ? 146 : 145; + var otherKind = node.kind === 149 ? 150 : 149; var otherAccessor = ts.getDeclarationOfKind(node.symbol, otherKind); if (otherAccessor) { - if (((node.flags & 56) !== (otherAccessor.flags & 56))) { + if (((node.flags & 28) !== (otherAccessor.flags & 28))) { error(node.name, ts.Diagnostics.Getter_and_setter_accessors_do_not_agree_in_visibility); } - var currentAccessorType = getAnnotatedAccessorType(node); - var otherAccessorType = getAnnotatedAccessorType(otherAccessor); - if (currentAccessorType && otherAccessorType) { - if (!isTypeIdenticalTo(currentAccessorType, otherAccessorType)) { - error(node, ts.Diagnostics.get_and_set_accessor_must_have_the_same_type); - } + if (((node.flags & 128) !== (otherAccessor.flags & 128))) { + error(node.name, ts.Diagnostics.Accessors_must_both_be_abstract_or_non_abstract); } + checkAccessorDeclarationTypesIdentical(node, otherAccessor, getAnnotatedAccessorType, ts.Diagnostics.get_and_set_accessor_must_have_the_same_type); + checkAccessorDeclarationTypesIdentical(node, otherAccessor, getAnnotatedAccessorThisType, ts.Diagnostics.get_and_set_accessor_must_have_the_same_this_type); } } getTypeOfAccessors(getSymbolOfNode(node)); } - checkFunctionLikeDeclaration(node); + if (node.parent.kind !== 171) { + checkSourceElement(node.body); + } + else { + checkNodeDeferred(node); + } + } + function checkAccessorDeclarationTypesIdentical(first, second, getAnnotatedType, message) { + var firstType = getAnnotatedType(first); + var secondType = getAnnotatedType(second); + if (firstType && secondType && !isTypeIdenticalTo(firstType, secondType)) { + error(first, message); + } + } + function checkAccessorDeferred(node) { + checkSourceElement(node.body); } function checkMissingDeclaration(node) { checkDecorators(node); } - function checkTypeArgumentConstraints(typeParameters, typeArguments) { + function checkTypeArgumentConstraints(typeParameters, typeArgumentNodes) { + var typeArguments; + var mapper; var result = true; for (var i = 0; i < typeParameters.length; i++) { var constraint = getConstraintOfTypeParameter(typeParameters[i]); if (constraint) { + if (!typeArguments) { + typeArguments = ts.map(typeArgumentNodes, getTypeFromTypeNode); + mapper = createTypeMapper(typeParameters, typeArguments); + } var typeArgument = typeArguments[i]; - result = result && checkTypeAssignableTo(getTypeFromTypeNode(typeArgument), constraint, typeArgument, ts.Diagnostics.Type_0_does_not_satisfy_the_constraint_1); + result = result && checkTypeAssignableTo(typeArgument, getTypeWithThisArgument(instantiateType(constraint, mapper), typeArgument), typeArgumentNodes[i], ts.Diagnostics.Type_0_does_not_satisfy_the_constraint_1); } } return result; @@ -19532,49 +22465,18 @@ var ts; ts.forEach(node.types, checkSourceElement); } function isPrivateWithinAmbient(node) { - return (node.flags & 16) && ts.isInAmbientContext(node); - } - function checkSpecializedSignatureDeclaration(signatureDeclarationNode) { - if (!produceDiagnostics) { - return; - } - var signature = getSignatureFromDeclaration(signatureDeclarationNode); - if (!signature.hasStringLiterals) { - return; - } - if (ts.nodeIsPresent(signatureDeclarationNode.body)) { - error(signatureDeclarationNode, ts.Diagnostics.A_signature_with_an_implementation_cannot_use_a_string_literal_type); - return; - } - var signaturesToCheck; - if (!signatureDeclarationNode.name && signatureDeclarationNode.parent && signatureDeclarationNode.parent.kind === 215) { - ts.Debug.assert(signatureDeclarationNode.kind === 147 || signatureDeclarationNode.kind === 148); - var signatureKind = signatureDeclarationNode.kind === 147 ? 0 : 1; - var containingSymbol = getSymbolOfNode(signatureDeclarationNode.parent); - var containingType = getDeclaredTypeOfSymbol(containingSymbol); - signaturesToCheck = getSignaturesOfType(containingType, signatureKind); - } - else { - signaturesToCheck = getSignaturesOfSymbol(getSymbolOfNode(signatureDeclarationNode)); - } - for (var _i = 0, signaturesToCheck_1 = signaturesToCheck; _i < signaturesToCheck_1.length; _i++) { - var otherSignature = signaturesToCheck_1[_i]; - if (!otherSignature.hasStringLiterals && isSignatureAssignableTo(signature, otherSignature)) { - return; - } - } - error(signatureDeclarationNode, ts.Diagnostics.Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature); + return (node.flags & 8) && ts.isInAmbientContext(node); } function getEffectiveDeclarationFlags(n, flagsToCheck) { var flags = ts.getCombinedNodeFlags(n); - if (n.parent.kind !== 215 && - n.parent.kind !== 214 && - n.parent.kind !== 186 && + if (n.parent.kind !== 222 && + n.parent.kind !== 221 && + n.parent.kind !== 192 && ts.isInAmbientContext(n)) { - if (!(flags & 4)) { - flags |= 2; + if (!(flags & 2)) { + flags |= 1; } - flags |= 4; + flags |= 2; } return flags & flagsToCheck; } @@ -19589,36 +22491,36 @@ var ts; function checkFlagAgreementBetweenOverloads(overloads, implementation, flagsToCheck, someOverloadFlags, allOverloadFlags) { var someButNotAllOverloadFlags = someOverloadFlags ^ allOverloadFlags; if (someButNotAllOverloadFlags !== 0) { - var canonicalFlags = getEffectiveDeclarationFlags(getCanonicalOverload(overloads, implementation), flagsToCheck); + var canonicalFlags_1 = getEffectiveDeclarationFlags(getCanonicalOverload(overloads, implementation), flagsToCheck); ts.forEach(overloads, function (o) { - var deviation = getEffectiveDeclarationFlags(o, flagsToCheck) ^ canonicalFlags; - if (deviation & 2) { - error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_exported_or_not_exported); + var deviation = getEffectiveDeclarationFlags(o, flagsToCheck) ^ canonicalFlags_1; + if (deviation & 1) { + error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_exported_or_non_exported); } - else if (deviation & 4) { + else if (deviation & 2) { error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_ambient_or_non_ambient); } - else if (deviation & (16 | 32)) { - error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_public_private_or_protected); + else if (deviation & (8 | 16)) { + error(o.name || o, ts.Diagnostics.Overload_signatures_must_all_be_public_private_or_protected); } else if (deviation & 128) { - error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_abstract_or_not_abstract); + error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_abstract_or_non_abstract); } }); } } function checkQuestionTokenAgreementBetweenOverloads(overloads, implementation, someHaveQuestionToken, allHaveQuestionToken) { if (someHaveQuestionToken !== allHaveQuestionToken) { - var canonicalHasQuestionToken = ts.hasQuestionToken(getCanonicalOverload(overloads, implementation)); + var canonicalHasQuestionToken_1 = ts.hasQuestionToken(getCanonicalOverload(overloads, implementation)); ts.forEach(overloads, function (o) { - var deviation = ts.hasQuestionToken(o) !== canonicalHasQuestionToken; + var deviation = ts.hasQuestionToken(o) !== canonicalHasQuestionToken_1; if (deviation) { error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_optional_or_required); } }); } } - var flagsToCheck = 2 | 4 | 16 | 32 | 128; + var flagsToCheck = 1 | 2 | 8 | 16 | 128; var someNodeFlags = 0; var allNodeFlags = flagsToCheck; var someHaveQuestionToken = false; @@ -19642,14 +22544,16 @@ var ts; seen = c === node; } }); - if (subsequentNode) { + if (subsequentNode && subsequentNode.pos === node.end) { if (subsequentNode.kind === node.kind) { var errorNode_1 = subsequentNode.name || subsequentNode; if (node.name && subsequentNode.name && node.name.text === subsequentNode.name.text) { - ts.Debug.assert(node.kind === 143 || node.kind === 142); - ts.Debug.assert((node.flags & 64) !== (subsequentNode.flags & 64)); - var diagnostic = node.flags & 64 ? ts.Diagnostics.Function_overload_must_be_static : ts.Diagnostics.Function_overload_must_not_be_static; - error(errorNode_1, diagnostic); + var reportError = (node.kind === 147 || node.kind === 146) && + (node.flags & 32) !== (subsequentNode.flags & 32); + if (reportError) { + var diagnostic = node.flags & 32 ? ts.Diagnostics.Function_overload_must_be_static : ts.Diagnostics.Function_overload_must_not_be_static; + error(errorNode_1, diagnostic); + } return; } else if (ts.nodeIsPresent(subsequentNode.body)) { @@ -19678,11 +22582,11 @@ var ts; var current = declarations_4[_i]; var node = current; var inAmbientContext = ts.isInAmbientContext(node); - var inAmbientContextOrInterface = node.parent.kind === 215 || node.parent.kind === 155 || inAmbientContext; + var inAmbientContextOrInterface = node.parent.kind === 222 || node.parent.kind === 159 || inAmbientContext; if (inAmbientContextOrInterface) { previousDeclaration = undefined; } - if (node.kind === 213 || node.kind === 143 || node.kind === 142 || node.kind === 144) { + if (node.kind === 220 || node.kind === 147 || node.kind === 146 || node.kind === 148) { var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; allNodeFlags &= currentNodeFlags; @@ -19724,7 +22628,7 @@ var ts; }); } if (!isExportSymbolInsideModule && lastSeenNonAmbientDeclaration && !lastSeenNonAmbientDeclaration.body && - !(lastSeenNonAmbientDeclaration.flags & 128)) { + !(lastSeenNonAmbientDeclaration.flags & 128) && !lastSeenNonAmbientDeclaration.questionToken) { reportImplementationExpectedError(lastSeenNonAmbientDeclaration); } if (hasOverloads) { @@ -19733,13 +22637,11 @@ var ts; if (bodyDeclaration) { var signatures = getSignaturesOfSymbol(symbol); var bodySignature = getSignatureFromDeclaration(bodyDeclaration); - if (!bodySignature.hasStringLiterals) { - for (var _a = 0, signatures_3 = signatures; _a < signatures_3.length; _a++) { - var signature = signatures_3[_a]; - if (!signature.hasStringLiterals && !isSignatureAssignableTo(bodySignature, signature)) { - error(signature.declaration, ts.Diagnostics.Overload_signature_is_not_compatible_with_function_implementation); - break; - } + for (var _a = 0, signatures_3 = signatures; _a < signatures_3.length; _a++) { + var signature = signatures_3[_a]; + if (!isImplementationCompatibleWithOverload(bodySignature, signature)) { + error(signature.declaration, ts.Diagnostics.Overload_signature_is_not_compatible_with_function_implementation); + break; } } } @@ -19765,8 +22667,8 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var d = _a[_i]; var declarationSpaces = getDeclarationSpaces(d); - var effectiveDeclarationFlags = getEffectiveDeclarationFlags(d, 2 | 512); - if (effectiveDeclarationFlags & 2) { + var effectiveDeclarationFlags = getEffectiveDeclarationFlags(d, 1 | 512); + if (effectiveDeclarationFlags & 1) { if (effectiveDeclarationFlags & 512) { defaultExportedDeclarationSpaces |= declarationSpaces; } @@ -19795,20 +22697,20 @@ var ts; } function getDeclarationSpaces(d) { switch (d.kind) { - case 215: + case 222: return 2097152; - case 218: - return d.name.kind === 9 || ts.getModuleInstanceState(d) !== 0 + case 225: + return ts.isAmbientModule(d) || ts.getModuleInstanceState(d) !== 0 ? 4194304 | 1048576 : 4194304; - case 214: - case 217: - return 2097152 | 1048576; case 221: - var result = 0; + case 224: + return 2097152 | 1048576; + case 229: + var result_1 = 0; var target = resolveAlias(getSymbolOfNode(d)); - ts.forEach(target.declarations, function (d) { result |= getDeclarationSpaces(d); }); - return result; + ts.forEach(target.declarations, function (d) { result_1 |= getDeclarationSpaces(d); }); + return result_1; default: return 1048576; } @@ -19846,7 +22748,7 @@ var ts; if (thenSignatures.length === 0) { return undefined; } - var onfulfilledParameterType = getUnionType(ts.map(thenSignatures, getTypeOfFirstParameterOfSignature)); + var onfulfilledParameterType = getTypeWithFacts(getUnionType(ts.map(thenSignatures, getTypeOfFirstParameterOfSignature)), 131072); if (onfulfilledParameterType.flags & 1) { return undefined; } @@ -19880,7 +22782,7 @@ var ts; return checkNonThenableType(type, location, message); } else { - if (type.id === promisedType.id || awaitedTypeStack.indexOf(promisedType.id) >= 0) { + if (type.id === promisedType.id || ts.indexOf(awaitedTypeStack, promisedType.id) >= 0) { if (location) { error(location, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method, symbolToString(type.symbol)); } @@ -19894,7 +22796,23 @@ var ts; } } } + function checkCorrectPromiseType(returnType, location) { + if (returnType === unknownType) { + return unknownType; + } + var globalPromiseType = getGlobalPromiseType(); + if (globalPromiseType === emptyGenericType + || globalPromiseType === getTargetType(returnType)) { + return checkAwaitedType(returnType, location, ts.Diagnostics.An_async_function_or_method_must_have_a_valid_awaitable_return_type); + } + error(location, ts.Diagnostics.The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type); + return unknownType; + } function checkAsyncFunctionReturnType(node) { + if (languageVersion >= 2) { + var returnType = getTypeFromTypeNode(node.type); + return checkCorrectPromiseType(returnType, node.type); + } var globalPromiseConstructorLikeType = getGlobalPromiseConstructorLikeType(); if (globalPromiseConstructorLikeType === emptyObjectType) { return unknownType; @@ -19911,15 +22829,16 @@ var ts; error(node, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type, typeName); return unknownType; } + checkReturnTypeAnnotationAsExpression(node); var promiseConstructorType = getTypeOfSymbol(promiseConstructor); if (!checkTypeAssignableTo(promiseConstructorType, globalPromiseConstructorLikeType, node, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type)) { return unknownType; } var promiseName = ts.getEntityNameFromTypeNode(node.type); - var root = getFirstIdentifier(promiseName); - var rootSymbol = getSymbol(node.locals, root.text, 107455); + var promiseNameOrNamespaceRoot = getFirstIdentifier(promiseName); + var rootSymbol = getSymbol(node.locals, promiseNameOrNamespaceRoot.text, 107455); if (rootSymbol) { - error(rootSymbol.valueDeclaration, ts.Diagnostics.Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions, root.text, getFullyQualifiedName(promiseConstructor)); + error(rootSymbol.valueDeclaration, ts.Diagnostics.Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions, promiseNameOrNamespaceRoot.text, getFullyQualifiedName(promiseConstructor)); return unknownType; } return checkAwaitedType(promiseType, node, ts.Diagnostics.An_async_function_or_method_must_have_a_valid_awaitable_return_type); @@ -19934,22 +22853,22 @@ var ts; var headMessage = getDiagnosticHeadMessageForDecoratorResolution(node); var errorInfo; switch (node.parent.kind) { - case 214: + case 221: var classSymbol = getSymbolOfNode(node.parent); var classConstructorType = getTypeOfSymbol(classSymbol); expectedReturnType = getUnionType([classConstructorType, voidType]); break; - case 138: + case 142: expectedReturnType = voidType; errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any); break; - case 141: + case 145: expectedReturnType = voidType; errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.The_return_type_of_a_property_decorator_function_must_be_either_void_or_any); break; - case 143: - case 145: - case 146: + case 147: + case 149: + case 150: var methodType = getTypeOfNode(node.parent); var descriptorType = createTypedPropertyDescriptorType(methodType); expectedReturnType = getUnionType([descriptorType, voidType]); @@ -19958,9 +22877,9 @@ var ts; checkTypeAssignableTo(returnType, expectedReturnType, node, headMessage, errorInfo); } function checkTypeNodeAsExpression(node) { - if (node && node.kind === 151) { + if (node && node.kind === 155) { var root = getFirstIdentifier(node.typeName); - var meaning = root.parent.kind === 151 ? 793056 : 1536; + var meaning = root.parent.kind === 155 ? 793056 : 1536; var rootSymbol = resolveName(root, root.text, meaning | 8388608, undefined, undefined); if (rootSymbol && rootSymbol.flags & 8388608) { var aliasTarget = resolveAlias(rootSymbol); @@ -19971,23 +22890,10 @@ var ts; } } function checkTypeAnnotationAsExpression(node) { - switch (node.kind) { - case 141: - checkTypeNodeAsExpression(node.type); - break; - case 138: - checkTypeNodeAsExpression(node.type); - break; - case 143: - checkTypeNodeAsExpression(node.type); - break; - case 145: - checkTypeNodeAsExpression(node.type); - break; - case 146: - checkTypeNodeAsExpression(ts.getSetAccessorTypeAnnotationNode(node)); - break; - } + checkTypeNodeAsExpression(node.type); + } + function checkReturnTypeAnnotationAsExpression(node) { + checkTypeNodeAsExpression(node.type); } function checkParameterTypeAnnotationsAsExpressions(node) { for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) { @@ -20003,54 +22909,51 @@ var ts; return; } if (!compilerOptions.experimentalDecorators) { - error(node, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Specify_experimentalDecorators_to_remove_this_warning); + error(node, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning); } if (compilerOptions.emitDecoratorMetadata) { switch (node.kind) { - case 214: + case 221: var constructor = ts.getFirstConstructorWithBody(node); if (constructor) { checkParameterTypeAnnotationsAsExpressions(constructor); } break; - case 143: + case 147: + case 149: + case 150: checkParameterTypeAnnotationsAsExpressions(node); - case 146: + checkReturnTypeAnnotationAsExpression(node); + break; case 145: - case 141: - case 138: + case 142: checkTypeAnnotationAsExpression(node); break; } } - emitDecorate = true; - if (node.kind === 138) { - emitParam = true; - } ts.forEach(node.decorators, checkDecorator); } function checkFunctionDeclaration(node) { if (produceDiagnostics) { - checkFunctionLikeDeclaration(node) || checkGrammarForGenerator(node); + checkFunctionOrMethodDeclaration(node) || checkGrammarForGenerator(node); checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); + checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); } } - function checkFunctionLikeDeclaration(node) { + function checkFunctionOrMethodDeclaration(node) { checkDecorators(node); checkSignatureDeclaration(node); var isAsync = ts.isAsyncFunctionLike(node); - if (isAsync) { - emitAwaiter = true; - } - if (node.name && node.name.kind === 136) { + if (node.name && node.name.kind === 140) { checkComputedPropertyName(node.name); } if (!ts.hasDynamicName(node)) { var symbol = getSymbolOfNode(node); var localSymbol = node.localSymbol || symbol; - var firstDeclaration = ts.getDeclarationOfKind(localSymbol, node.kind); + var firstDeclaration = ts.forEach(localSymbol.declarations, function (declaration) { return declaration.kind === node.kind && !ts.isSourceFileJavaScript(ts.getSourceFileOfNode(declaration)) ? + declaration : undefined; }); if (node === firstDeclaration) { checkFunctionOrConstructorSymbol(localSymbol); } @@ -20061,13 +22964,9 @@ var ts; } } checkSourceElement(node.body); - if (node.type && !isAccessor(node.kind) && !node.asteriskToken) { - var returnType = getTypeFromTypeNode(node.type); - var promisedType; - if (isAsync) { - promisedType = checkAsyncFunctionReturnType(node); - } - checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, isAsync ? promisedType : returnType); + if (!node.asteriskToken) { + var returnOrPromisedType = node.type && (isAsync ? checkAsyncFunctionReturnType(node) : getTypeFromTypeNode(node.type)); + checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnOrPromisedType); } if (produceDiagnostics && !node.type) { if (compilerOptions.noImplicitAny && ts.nodeIsMissing(node.body) && !isPrivateWithinAmbient(node)) { @@ -20079,16 +22978,13 @@ var ts; } } function checkBlock(node) { - if (node.kind === 192) { + if (node.kind === 199) { checkGrammarStatementInAmbientContext(node); } ts.forEach(node.statements, checkSourceElement); - if (ts.isFunctionBlock(node) || node.kind === 219) { - checkFunctionAndClassExpressionBodies(node); - } } function checkCollisionWithArgumentsInGeneratedCode(node) { - if (!ts.hasRestParameter(node) || ts.isInAmbientContext(node) || ts.nodeIsMissing(node.body)) { + if (!ts.hasDeclaredRestParameter(node) || ts.isInAmbientContext(node) || ts.nodeIsMissing(node.body)) { return; } ts.forEach(node.parameters, function (p) { @@ -20101,19 +22997,19 @@ var ts; if (!(identifier && identifier.text === name)) { return false; } - if (node.kind === 141 || - node.kind === 140 || - node.kind === 143 || - node.kind === 142 || - node.kind === 145 || - node.kind === 146) { + if (node.kind === 145 || + node.kind === 144 || + node.kind === 147 || + node.kind === 146 || + node.kind === 149 || + node.kind === 150) { return false; } if (ts.isInAmbientContext(node)) { return false; } var root = ts.getRootDeclaration(node); - if (root.kind === 138 && ts.nodeIsMissing(root.parent.body)) { + if (root.kind === 142 && ts.nodeIsMissing(root.parent.body)) { return false; } return true; @@ -20161,19 +23057,31 @@ var ts; if (!needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) { return; } - if (node.kind === 218 && ts.getModuleInstanceState(node) !== 1) { + if (node.kind === 225 && ts.getModuleInstanceState(node) !== 1) { return; } var parent = getDeclarationContainer(node); - if (parent.kind === 248 && ts.isExternalOrCommonJsModule(parent)) { + if (parent.kind === 256 && ts.isExternalOrCommonJsModule(parent)) { error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } } - function checkVarDeclaredNamesNotShadowed(node) { - if ((ts.getCombinedNodeFlags(node) & 24576) !== 0 || ts.isParameterDeclaration(node)) { + function checkCollisionWithGlobalPromiseInGeneratedCode(node, name) { + if (!needCollisionCheckForIdentifier(node, name, "Promise")) { return; } - if (node.kind === 211 && !node.initializer) { + if (node.kind === 225 && ts.getModuleInstanceState(node) !== 1) { + return; + } + var parent = getDeclarationContainer(node); + if (parent.kind === 256 && ts.isExternalOrCommonJsModule(parent) && parent.flags & 2097152) { + error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions, ts.declarationNameToString(name), ts.declarationNameToString(name)); + } + } + function checkVarDeclaredNamesNotShadowed(node) { + if ((ts.getCombinedNodeFlags(node) & 3072) !== 0 || ts.isParameterDeclaration(node)) { + return; + } + if (node.kind === 218 && !node.initializer) { return; } var symbol = getSymbolOfNode(node); @@ -20182,74 +23090,103 @@ var ts; if (localDeclarationSymbol && localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2) { - if (getDeclarationFlagsFromSymbol(localDeclarationSymbol) & 24576) { - var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 212); - var container = varDeclList.parent.kind === 193 && varDeclList.parent.parent + if (getDeclarationFlagsFromSymbol(localDeclarationSymbol) & 3072) { + var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 219); + var container = varDeclList.parent.kind === 200 && varDeclList.parent.parent ? varDeclList.parent.parent : undefined; var namesShareScope = container && - (container.kind === 192 && ts.isFunctionLike(container.parent) || - container.kind === 219 || - container.kind === 218 || - container.kind === 248); + (container.kind === 199 && ts.isFunctionLike(container.parent) || + container.kind === 226 || + container.kind === 225 || + container.kind === 256); if (!namesShareScope) { - var name_14 = symbolToString(localDeclarationSymbol); - error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name_14, name_14); + var name_16 = symbolToString(localDeclarationSymbol); + error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name_16, name_16); } } } } } function checkParameterInitializer(node) { - if (ts.getRootDeclaration(node).kind !== 138) { + if (ts.getRootDeclaration(node).kind !== 142) { return; } var func = ts.getContainingFunction(node); visit(node.initializer); function visit(n) { - if (n.kind === 69) { - var referencedSymbol = getNodeLinks(n).resolvedSymbol; - if (referencedSymbol && referencedSymbol !== unknownSymbol && getSymbol(func.locals, referencedSymbol.name, 107455) === referencedSymbol) { - if (referencedSymbol.valueDeclaration.kind === 138) { - if (referencedSymbol.valueDeclaration === node) { - error(n, ts.Diagnostics.Parameter_0_cannot_be_referenced_in_its_initializer, ts.declarationNameToString(node.name)); + if (ts.isTypeNode(n) || ts.isDeclarationName(n)) { + return; + } + if (n.kind === 172) { + return visit(n.expression); + } + else if (n.kind === 69) { + var symbol = resolveName(n, n.text, 107455 | 8388608, undefined, undefined); + if (!symbol || symbol === unknownSymbol || !symbol.valueDeclaration) { + return; + } + if (symbol.valueDeclaration === node) { + error(n, ts.Diagnostics.Parameter_0_cannot_be_referenced_in_its_initializer, ts.declarationNameToString(node.name)); + return; + } + var enclosingContainer = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration); + if (enclosingContainer === func) { + if (symbol.valueDeclaration.kind === 142) { + if (symbol.valueDeclaration.pos < node.pos) { return; } - if (referencedSymbol.valueDeclaration.pos < node.pos) { - return; + var current = n; + while (current !== node.initializer) { + if (ts.isFunctionLike(current.parent)) { + return; + } + if (current.parent.kind === 145 && + !(current.parent.flags & 32) && + ts.isClassLike(current.parent.parent)) { + return; + } + current = current.parent; } } error(n, ts.Diagnostics.Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it, ts.declarationNameToString(node.name), ts.declarationNameToString(n)); } } else { - ts.forEachChild(n, visit); + return ts.forEachChild(n, visit); } } } function checkVariableLikeDeclaration(node) { checkDecorators(node); checkSourceElement(node.type); - if (node.name.kind === 136) { + if (node.name.kind === 140) { checkComputedPropertyName(node.name); if (node.initializer) { checkExpressionCached(node.initializer); } } - if (node.kind === 163) { - if (node.propertyName && node.propertyName.kind === 136) { + if (node.kind === 169) { + if (node.propertyName && node.propertyName.kind === 140) { checkComputedPropertyName(node.propertyName); } + var parent_11 = node.parent.parent; + var parentType = getTypeForBindingElementParent(parent_11); + var name_17 = node.propertyName || node.name; + var property = getPropertyOfType(parentType, getTextOfPropertyName(name_17)); + if (parent_11.initializer && property && getParentOfSymbol(property)) { + checkClassPropertyAccess(parent_11, parent_11.initializer, parentType, property); + } } if (ts.isBindingPattern(node.name)) { ts.forEach(node.name.elements, checkSourceElement); } - if (node.initializer && ts.getRootDeclaration(node).kind === 138 && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { + if (node.initializer && ts.getRootDeclaration(node).kind === 142 && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { error(node, ts.Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation); return; } if (ts.isBindingPattern(node.name)) { - if (node.initializer) { + if (node.initializer && node.parent.parent.kind !== 207) { checkTypeAssignableTo(checkExpressionCached(node.initializer), getWidenedTypeForVariableLikeDeclaration(node), node, undefined); checkParameterInitializer(node); } @@ -20258,7 +23195,7 @@ var ts; var symbol = getSymbolOfNode(node); var type = getTypeOfVariableOrParameterOrProperty(symbol); if (node === symbol.valueDeclaration) { - if (node.initializer) { + if (node.initializer && node.parent.parent.kind !== 207) { checkTypeAssignableTo(checkExpressionCached(node.initializer), type, node, undefined); checkParameterInitializer(node); } @@ -20272,14 +23209,15 @@ var ts; checkTypeAssignableTo(checkExpressionCached(node.initializer), declarationType, node, undefined); } } - if (node.kind !== 141 && node.kind !== 140) { + if (node.kind !== 145 && node.kind !== 144) { checkExportsOnMergedDeclarations(node); - if (node.kind === 211 || node.kind === 163) { + if (node.kind === 218 || node.kind === 169) { checkVarDeclaredNamesNotShadowed(node); } checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); + checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); } } function checkVariableDeclaration(node) { @@ -20295,7 +23233,7 @@ var ts; ts.forEach(node.declarationList.declarations, checkSourceElement); } function checkGrammarDisallowedModifiersOnObjectLiteralExpressionMethod(node) { - if (node.modifiers && node.parent.kind === 165) { + if (node.modifiers && node.parent.kind === 171) { if (ts.isAsyncFunctionLike(node)) { if (node.modifiers.length > 1) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); @@ -20314,7 +23252,7 @@ var ts; checkGrammarStatementInAmbientContext(node); checkExpression(node.expression); checkSourceElement(node.thenStatement); - if (node.thenStatement.kind === 194) { + if (node.thenStatement.kind === 201) { error(node.thenStatement, ts.Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement); } checkSourceElement(node.elseStatement); @@ -20331,12 +23269,12 @@ var ts; } function checkForStatement(node) { if (!checkGrammarStatementInAmbientContext(node)) { - if (node.initializer && node.initializer.kind === 212) { + if (node.initializer && node.initializer.kind === 219) { checkGrammarVariableDeclarationList(node.initializer); } } if (node.initializer) { - if (node.initializer.kind === 212) { + if (node.initializer.kind === 219) { ts.forEach(node.initializer.declarations, checkVariableDeclaration); } else { @@ -20351,18 +23289,18 @@ var ts; } function checkForOfStatement(node) { checkGrammarForInOrForOfStatement(node); - if (node.initializer.kind === 212) { + if (node.initializer.kind === 219) { checkForInOrForOfVariableDeclaration(node); } else { var varExpr = node.initializer; var iteratedType = checkRightHandSideOfForOf(node.expression); - if (varExpr.kind === 164 || varExpr.kind === 165) { + if (varExpr.kind === 170 || varExpr.kind === 171) { checkDestructuringAssignment(varExpr, iteratedType || unknownType); } else { var leftType = checkExpression(varExpr); - checkReferenceExpression(varExpr, ts.Diagnostics.Invalid_left_hand_side_in_for_of_statement, ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_be_a_previously_defined_constant); + checkReferenceExpression(varExpr, ts.Diagnostics.Invalid_left_hand_side_in_for_of_statement, ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_be_a_constant_or_a_read_only_property); if (iteratedType) { checkTypeAssignableTo(iteratedType, leftType, varExpr, undefined); } @@ -20372,7 +23310,7 @@ var ts; } function checkForInStatement(node) { checkGrammarForInOrForOfStatement(node); - if (node.initializer.kind === 212) { + if (node.initializer.kind === 219) { var variable = node.initializer.declarations[0]; if (variable && ts.isBindingPattern(variable.name)) { error(variable.name, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); @@ -20382,17 +23320,17 @@ var ts; else { var varExpr = node.initializer; var leftType = checkExpression(varExpr); - if (varExpr.kind === 164 || varExpr.kind === 165) { + if (varExpr.kind === 170 || varExpr.kind === 171) { error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); } else if (!isTypeAnyOrAllConstituentTypesHaveKind(leftType, 258)) { error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any); } else { - checkReferenceExpression(varExpr, ts.Diagnostics.Invalid_left_hand_side_in_for_in_statement, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_previously_defined_constant); + checkReferenceExpression(varExpr, ts.Diagnostics.Invalid_left_hand_side_in_for_in_statement, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_constant_or_a_read_only_property); } } - var rightType = checkExpression(node.expression); + var rightType = checkNonNullExpression(node.expression); if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 80896 | 512)) { error(node.expression, ts.Diagnostics.The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter); } @@ -20406,7 +23344,7 @@ var ts; } } function checkRightHandSideOfForOf(rhsExpression) { - var expressionType = getTypeOfExpression(rhsExpression); + var expressionType = checkNonNullExpression(rhsExpression); return checkIteratedTypeOrElementType(expressionType, rhsExpression, true); } function checkIteratedTypeOrElementType(inputType, errorNode, allowStringInput) { @@ -20425,7 +23363,9 @@ var ts; return indexType; } } - error(errorNode, ts.Diagnostics.Type_0_is_not_an_array_type, typeToString(inputType)); + if (errorNode) { + error(errorNode, ts.Diagnostics.Type_0_is_not_an_array_type, typeToString(inputType)); + } return unknownType; } function checkElementTypeOfIterable(iterable, errorNode) { @@ -20441,7 +23381,7 @@ var ts; } var typeAsIterable = type; if (!typeAsIterable.iterableElementType) { - if ((type.flags & 4096) && type.target === globalIterableType) { + if ((type.flags & 4096) && type.target === getGlobalIterableType()) { typeAsIterable.iterableElementType = type.typeArguments[0]; } else { @@ -20467,7 +23407,7 @@ var ts; } var typeAsIterator = type; if (!typeAsIterator.iteratorElementType) { - if ((type.flags & 4096) && type.target === globalIteratorType) { + if ((type.flags & 4096) && type.target === getGlobalIteratorType()) { typeAsIterator.iteratorElementType = type.typeArguments[0]; } else { @@ -20502,7 +23442,7 @@ var ts; if (isTypeAny(type)) { return undefined; } - if ((type.flags & 4096) && type.target === globalIterableIteratorType) { + if ((type.flags & 4096) && type.target === getGlobalIterableIteratorType()) { return type.typeArguments[0]; } return getElementTypeOfIterable(type, undefined) || @@ -20510,7 +23450,13 @@ var ts; } function checkElementTypeOfArrayOrString(arrayOrStringType, errorNode) { ts.Debug.assert(languageVersion < 2); - var arrayType = removeTypesFromUnionType(arrayOrStringType, 258, true, true); + var arrayType = arrayOrStringType; + if (arrayOrStringType.flags & 16384) { + arrayType = getUnionType(ts.filter(arrayOrStringType.types, function (t) { return !(t.flags & 258); })); + } + else if (arrayOrStringType.flags & 258) { + arrayType = neverType; + } var hasStringConstituent = arrayOrStringType !== arrayType; var reportedError = false; if (hasStringConstituent) { @@ -20518,7 +23464,7 @@ var ts; error(errorNode, ts.Diagnostics.Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher); reportedError = true; } - if (arrayType === emptyObjectType) { + if (arrayType === neverType) { return stringType; } } @@ -20543,8 +23489,12 @@ var ts; function checkBreakOrContinueStatement(node) { checkGrammarStatementInAmbientContext(node) || checkGrammarBreakOrContinueStatement(node); } - function isGetAccessorWithAnnotatatedSetAccessor(node) { - return !!(node.kind === 145 && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 146))); + function isGetAccessorWithAnnotatedSetAccessor(node) { + return !!(node.kind === 149 && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 150))); + } + function isUnwrappedReturnTypeVoidOrAny(func, returnType) { + var unwrappedReturnType = ts.isAsyncFunctionLike(func) ? getPromisedType(returnType) : returnType; + return maybeTypeOfKind(unwrappedReturnType, 16 | 1); } function checkReturnStatement(node) { if (!checkGrammarStatementInAmbientContext(node)) { @@ -20553,41 +23503,46 @@ var ts; grammarErrorOnFirstToken(node, ts.Diagnostics.A_return_statement_can_only_be_used_within_a_function_body); } } - if (node.expression) { - var func = ts.getContainingFunction(node); - if (func) { - var signature = getSignatureFromDeclaration(func); - var returnType = getReturnTypeOfSignature(signature); - var exprType = checkExpressionCached(node.expression); + var func = ts.getContainingFunction(node); + if (func) { + var signature = getSignatureFromDeclaration(func); + var returnType = getReturnTypeOfSignature(signature); + if (strictNullChecks || node.expression || returnType === neverType) { + var exprType = node.expression ? checkExpressionCached(node.expression) : undefinedType; if (func.asteriskToken) { return; } - if (func.kind === 146) { - error(node.expression, ts.Diagnostics.Setters_cannot_return_a_value); + if (func.kind === 150) { + if (node.expression) { + error(node.expression, ts.Diagnostics.Setters_cannot_return_a_value); + } } - else if (func.kind === 144) { - if (!checkTypeAssignableTo(exprType, returnType, node.expression)) { + else if (func.kind === 148) { + if (node.expression && !checkTypeAssignableTo(exprType, returnType, node.expression)) { error(node.expression, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); } } - else if (func.type || isGetAccessorWithAnnotatatedSetAccessor(func) || signature.typePredicate) { + else if (func.type || isGetAccessorWithAnnotatedSetAccessor(func)) { if (ts.isAsyncFunctionLike(func)) { var promisedType = getPromisedType(returnType); - var awaitedType = checkAwaitedType(exprType, node.expression, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member); + var awaitedType = checkAwaitedType(exprType, node.expression || node, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member); if (promisedType) { - checkTypeAssignableTo(awaitedType, promisedType, node.expression); + checkTypeAssignableTo(awaitedType, promisedType, node.expression || node); } } else { - checkTypeAssignableTo(exprType, returnType, node.expression); + checkTypeAssignableTo(exprType, returnType, node.expression || node); } } } + else if (func.kind !== 148 && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(func, returnType)) { + error(node, ts.Diagnostics.Not_all_code_paths_return_a_value); + } } } function checkWithStatement(node) { if (!checkGrammarStatementInAmbientContext(node)) { - if (node.parserContextFlags & 8) { + if (node.flags & 33554432) { grammarErrorOnFirstToken(node, ts.Diagnostics.with_statements_are_not_allowed_in_an_async_function_block); } } @@ -20599,9 +23554,8 @@ var ts; var firstDefaultClause; var hasDuplicateDefaultClause = false; var expressionType = checkExpression(node.expression); - var expressionTypeIsStringLike = someConstituentTypeHasKind(expressionType, 258); ts.forEach(node.caseBlock.clauses, function (clause) { - if (clause.kind === 242 && !hasDuplicateDefaultClause) { + if (clause.kind === 250 && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -20613,14 +23567,11 @@ var ts; hasDuplicateDefaultClause = true; } } - if (produceDiagnostics && clause.kind === 241) { + if (produceDiagnostics && clause.kind === 249) { var caseClause = clause; var caseType = checkExpression(caseClause.expression); - if (expressionTypeIsStringLike && someConstituentTypeHasKind(caseType, 258)) { - return; - } - if (!isTypeAssignableTo(expressionType, caseType)) { - checkTypeAssignableTo(caseType, expressionType, caseClause.expression, undefined); + if (!isTypeComparableTo(expressionType, caseType)) { + checkTypeComparableTo(caseType, expressionType, caseClause.expression, undefined); } } ts.forEach(clause.statements, checkSourceElement); @@ -20633,7 +23584,7 @@ var ts; if (ts.isFunctionLike(current)) { break; } - if (current.kind === 207 && current.label.text === node.label.text) { + if (current.kind === 214 && current.label.text === node.label.text) { var sourceFile = ts.getSourceFileOfNode(node); grammarErrorOnNode(node.label, ts.Diagnostics.Duplicate_label_0, ts.getTextOfNodeFromSourceText(sourceFile.text, node.label)); break; @@ -20700,7 +23651,7 @@ var ts; var classDeclaration = type.symbol.valueDeclaration; for (var _i = 0, _a = classDeclaration.members; _i < _a.length; _i++) { var member = _a[_i]; - if (!(member.flags & 64) && ts.hasDynamicName(member)) { + if (!(member.flags & 32) && ts.hasDynamicName(member)) { var propType = getTypeOfSymbol(member.symbol); checkIndexConstraintForProperty(member.symbol, propType, type, declaredStringIndexer, stringIndexType, 0); checkIndexConstraintForProperty(member.symbol, propType, type, declaredNumberIndexer, numberIndexType, 1); @@ -20727,7 +23678,7 @@ var ts; return; } var errorNode; - if (prop.valueDeclaration.name.kind === 136 || prop.parent === containingType.symbol) { + if (prop.valueDeclaration.name.kind === 140 || prop.parent === containingType.symbol) { errorNode = prop.valueDeclaration; } else if (indexDeclaration) { @@ -20771,10 +23722,31 @@ var ts; } } } + function checkTypeParameterListsIdentical(node, symbol) { + if (symbol.declarations.length === 1) { + return; + } + var firstDecl; + for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { + var declaration = _a[_i]; + if (declaration.kind === 221 || declaration.kind === 222) { + if (!firstDecl) { + firstDecl = declaration; + } + else if (!areTypeParametersIdentical(firstDecl.typeParameters, node.typeParameters)) { + error(node.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_type_parameters, node.name.text); + } + } + } + } function checkClassExpression(node) { checkClassLikeDeclaration(node); + checkNodeDeferred(node); return getTypeOfSymbol(getSymbolOfNode(node)); } + function checkClassExpressionDeferred(node) { + ts.forEach(node.members, checkSourceElement); + } function checkClassDeclaration(node) { if (!node.name && !(node.flags & 512)) { grammarErrorOnFirstToken(node, ts.Diagnostics.A_class_declaration_without_the_default_modifier_must_have_a_name); @@ -20789,6 +23761,7 @@ var ts; checkTypeNameIsReserved(node.name, ts.Diagnostics.Class_name_cannot_be_0); checkCollisionWithCapturedThisVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); + checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); } checkTypeParameters(node.typeParameters); checkExportsOnMergedDeclarations(node); @@ -20796,13 +23769,14 @@ var ts; var type = getDeclaredTypeOfSymbol(symbol); var typeWithThis = getTypeWithThisArgument(type); var staticType = getTypeOfSymbol(symbol); + checkTypeParameterListsIdentical(node, symbol); var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { - emitExtends = emitExtends || !ts.isInAmbientContext(node); var baseTypes = getBaseTypes(type); if (baseTypes.length && produceDiagnostics) { - var baseType = baseTypes[0]; + var baseType_1 = baseTypes[0]; var staticBaseType = getBaseConstructorTypeOfClass(type); + checkBaseTypeAccessibility(staticBaseType, baseTypeNode); checkSourceElement(baseTypeNode.expression); if (baseTypeNode.typeArguments) { ts.forEach(baseTypeNode.typeArguments, checkSourceElement); @@ -20813,15 +23787,15 @@ var ts; } } } - checkTypeAssignableTo(typeWithThis, getTypeWithThisArgument(baseType, type.thisType), node.name || node, ts.Diagnostics.Class_0_incorrectly_extends_base_class_1); + checkTypeAssignableTo(typeWithThis, getTypeWithThisArgument(baseType_1, type.thisType), node.name || node, ts.Diagnostics.Class_0_incorrectly_extends_base_class_1); checkTypeAssignableTo(staticType, getTypeWithoutSignatures(staticBaseType), node.name || node, ts.Diagnostics.Class_static_side_0_incorrectly_extends_base_class_static_side_1); if (!(staticBaseType.symbol && staticBaseType.symbol.flags & 32)) { var constructors = getInstantiatedConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments); - if (ts.forEach(constructors, function (sig) { return getReturnTypeOfSignature(sig) !== baseType; })) { + if (ts.forEach(constructors, function (sig) { return getReturnTypeOfSignature(sig) !== baseType_1; })) { error(baseTypeNode.expression, ts.Diagnostics.Base_constructors_must_all_have_the_same_return_type); } } - checkKindsOfPropertyMemberOverrides(type, baseType); + checkKindsOfPropertyMemberOverrides(type, baseType_1); } } var implementedTypeNodes = ts.getClassImplementsHeritageClauseElements(node); @@ -20851,6 +23825,18 @@ var ts; checkTypeForDuplicateIndexSignatures(node); } } + function checkBaseTypeAccessibility(type, node) { + var signatures = getSignaturesOfType(type, 1); + if (signatures.length) { + var declaration = signatures[0].declaration; + if (declaration && declaration.flags & 8) { + var typeClassDeclaration = getClassLikeDeclarationOfSymbol(type.symbol); + if (!isNodeWithinClass(node, typeClassDeclaration)) { + error(node, ts.Diagnostics.Cannot_extend_a_class_0_Class_constructor_is_marked_as_private, node.expression.text); + } + } + } + } function getTargetSymbol(s) { return s.flags & 16777216 ? getSymbolLinks(s).target : s; } @@ -20872,7 +23858,7 @@ var ts; if (derived === base) { var derivedClassDecl = getClassLikeDeclarationOfSymbol(type.symbol); if (baseDeclarationFlags & 128 && (!derivedClassDecl || !(derivedClassDecl.flags & 128))) { - if (derivedClassDecl.kind === 186) { + if (derivedClassDecl.kind === 192) { error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType)); } else { @@ -20882,10 +23868,10 @@ var ts; } else { var derivedDeclarationFlags = getDeclarationFlagsFromSymbol(derived); - if ((baseDeclarationFlags & 16) || (derivedDeclarationFlags & 16)) { + if ((baseDeclarationFlags & 8) || (derivedDeclarationFlags & 8)) { continue; } - if ((baseDeclarationFlags & 64) !== (derivedDeclarationFlags & 64)) { + if ((baseDeclarationFlags & 32) !== (derivedDeclarationFlags & 32)) { continue; } if ((base.flags & derived.flags & 8192) || ((base.flags & 98308) && (derived.flags & 98308))) { @@ -20916,7 +23902,7 @@ var ts; } } function isAccessor(kind) { - return kind === 145 || kind === 146; + return kind === 149 || kind === 150; } function areTypeParametersIdentical(list1, list2) { if (!list1 && !list2) { @@ -20982,12 +23968,8 @@ var ts; checkTypeNameIsReserved(node.name, ts.Diagnostics.Interface_name_cannot_be_0); checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); - var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 215); - if (symbol.declarations.length > 1) { - if (node !== firstInterfaceDecl && !areTypeParametersIdentical(firstInterfaceDecl.typeParameters, node.typeParameters)) { - error(node.name, ts.Diagnostics.All_declarations_of_an_interface_must_have_identical_type_parameters); - } - } + checkTypeParameterListsIdentical(node, symbol); + var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 222); if (node === firstInterfaceDecl) { var type = getDeclaredTypeOfSymbol(symbol); var typeWithThis = getTypeWithThisArgument(type); @@ -21018,7 +24000,7 @@ var ts; } function computeEnumMemberValues(node) { var nodeLinks = getNodeLinks(node); - if (!(nodeLinks.flags & 8192)) { + if (!(nodeLinks.flags & 16384)) { var enumSymbol = getSymbolOfNode(node); var enumType = getDeclaredTypeOfSymbol(enumSymbol); var autoValue = 0; @@ -21047,10 +24029,11 @@ var ts; error(member.name, ts.Diagnostics.Enum_member_must_have_initializer); } if (autoValue !== undefined) { - getNodeLinks(member).enumMemberValue = autoValue++; + getNodeLinks(member).enumMemberValue = autoValue; + autoValue++; } } - nodeLinks.flags |= 8192; + nodeLinks.flags |= 16384; } function computeConstantValueForEnumMemberInitializer(initializer, enumType, enumIsConst, ambient) { var reportError = true; @@ -21079,7 +24062,7 @@ var ts; return value; function evalConstant(e) { switch (e.kind) { - case 179: + case 185: var value_1 = evalConstant(e.operand); if (value_1 === undefined) { return undefined; @@ -21090,7 +24073,7 @@ var ts; case 50: return ~value_1; } return undefined; - case 181: + case 187: var left = evalConstant(e.left); if (left === undefined) { return undefined; @@ -21115,22 +24098,22 @@ var ts; return undefined; case 8: return +e.text; - case 172: + case 178: return evalConstant(e.expression); case 69: - case 167: - case 166: + case 173: + case 172: var member = initializer.parent; var currentType = getTypeOfSymbol(getSymbolOfNode(member.parent)); var enumType_1; - var propertyName; + var propertyName = void 0; if (e.kind === 69) { enumType_1 = currentType; propertyName = e.text; } else { - var expression; - if (e.kind === 167) { + var expression = void 0; + if (e.kind === 173) { if (e.argumentExpression === undefined || e.argumentExpression.kind !== 9) { return undefined; @@ -21147,7 +24130,7 @@ var ts; if (current.kind === 69) { break; } - else if (current.kind === 166) { + else if (current.kind === 172) { current = current.expression; } else { @@ -21188,6 +24171,7 @@ var ts; checkTypeNameIsReserved(node.name, ts.Diagnostics.Enum_name_cannot_be_0); checkCollisionWithCapturedThisVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); + checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); checkExportsOnMergedDeclarations(node); computeEnumMemberValues(node); var enumIsConst = ts.isConst(node); @@ -21204,9 +24188,9 @@ var ts; } }); } - var seenEnumMissingInitialInitializer = false; + var seenEnumMissingInitialInitializer_1 = false; ts.forEach(enumSymbol.declarations, function (declaration) { - if (declaration.kind !== 217) { + if (declaration.kind !== 224) { return false; } var enumDeclaration = declaration; @@ -21215,11 +24199,11 @@ var ts; } var firstEnumMember = enumDeclaration.members[0]; if (!firstEnumMember.initializer) { - if (seenEnumMissingInitialInitializer) { + if (seenEnumMissingInitialInitializer_1) { error(firstEnumMember.name, ts.Diagnostics.In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element); } else { - seenEnumMissingInitialInitializer = true; + seenEnumMissingInitialInitializer_1 = true; } } }); @@ -21229,8 +24213,8 @@ var ts; var declarations = symbol.declarations; for (var _i = 0, declarations_5 = declarations; _i < declarations_5.length; _i++) { var declaration = declarations_5[_i]; - if ((declaration.kind === 214 || - (declaration.kind === 213 && ts.nodeIsPresent(declaration.body))) && + if ((declaration.kind === 221 || + (declaration.kind === 220 && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { return declaration; } @@ -21252,7 +24236,12 @@ var ts; } function checkModuleDeclaration(node) { if (produceDiagnostics) { - var isAmbientExternalModule = node.name.kind === 9; + var isGlobalAugmentation = ts.isGlobalScopeAugmentation(node); + var inAmbientContext = ts.isInAmbientContext(node); + if (isGlobalAugmentation && !inAmbientContext) { + error(node.name, ts.Diagnostics.Augmentations_for_the_global_scope_should_have_declare_modifier_unless_they_appear_in_already_ambient_context); + } + var isAmbientExternalModule = ts.isAmbientModule(node); var contextErrorMessage = isAmbientExternalModule ? ts.Diagnostics.An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file : ts.Diagnostics.A_namespace_declaration_is_only_allowed_in_a_namespace_or_module; @@ -21260,17 +24249,18 @@ var ts; return; } if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node)) { - if (!ts.isInAmbientContext(node) && node.name.kind === 9) { + if (!inAmbientContext && node.name.kind === 9) { grammarErrorOnNode(node.name, ts.Diagnostics.Only_ambient_modules_can_use_quoted_names); } } checkCollisionWithCapturedThisVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); + checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); if (symbol.flags & 512 && symbol.declarations.length > 1 - && !ts.isInAmbientContext(node) + && !inAmbientContext && ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums || compilerOptions.isolatedModules)) { var firstNonAmbientClassOrFunc = getFirstNonAmbientClassOrFunctionDeclaration(symbol); if (firstNonAmbientClassOrFunc) { @@ -21281,29 +24271,93 @@ var ts; error(node.name, ts.Diagnostics.A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged); } } - var mergedClass = ts.getDeclarationOfKind(symbol, 214); + var mergedClass = ts.getDeclarationOfKind(symbol, 221); if (mergedClass && inSameLexicalScope(node, mergedClass)) { getNodeLinks(node).flags |= 32768; } } if (isAmbientExternalModule) { - if (!isGlobalSourceFile(node.parent)) { - error(node.name, ts.Diagnostics.Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces); + if (ts.isExternalModuleAugmentation(node)) { + var checkBody = isGlobalAugmentation || (getSymbolOfNode(node).flags & 33554432); + if (checkBody) { + for (var _i = 0, _a = node.body.statements; _i < _a.length; _i++) { + var statement = _a[_i]; + checkModuleAugmentationElement(statement, isGlobalAugmentation); + } + } } - if (ts.isExternalModuleNameRelative(node.name.text)) { - error(node.name, ts.Diagnostics.Ambient_module_declaration_cannot_specify_relative_module_name); + else if (isGlobalSourceFile(node.parent)) { + if (isGlobalAugmentation) { + error(node.name, ts.Diagnostics.Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_declarations); + } + else if (ts.isExternalModuleNameRelative(node.name.text)) { + error(node.name, ts.Diagnostics.Ambient_module_declaration_cannot_specify_relative_module_name); + } + } + else { + if (isGlobalAugmentation) { + error(node.name, ts.Diagnostics.Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_declarations); + } + else { + error(node.name, ts.Diagnostics.Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces); + } } } } checkSourceElement(node.body); } + function checkModuleAugmentationElement(node, isGlobalAugmentation) { + switch (node.kind) { + case 200: + for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { + var decl = _a[_i]; + checkModuleAugmentationElement(decl, isGlobalAugmentation); + } + break; + case 235: + case 236: + grammarErrorOnFirstToken(node, ts.Diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations); + break; + case 229: + case 230: + grammarErrorOnFirstToken(node, ts.Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module); + break; + case 169: + case 218: + var name_18 = node.name; + if (ts.isBindingPattern(name_18)) { + for (var _b = 0, _c = name_18.elements; _b < _c.length; _b++) { + var el = _c[_b]; + checkModuleAugmentationElement(el, isGlobalAugmentation); + } + break; + } + case 221: + case 224: + case 220: + case 222: + case 225: + case 223: + if (isGlobalAugmentation) { + return; + } + var symbol = getSymbolOfNode(node); + if (symbol) { + var reportError = !(symbol.flags & 33554432); + if (!reportError) { + reportError = ts.isExternalModuleAugmentation(symbol.parent.declarations[0]); + } + } + break; + } + } function getFirstIdentifier(node) { while (true) { - if (node.kind === 135) { + if (node.kind === 139) { node = node.left; } - else if (node.kind === 166) { + else if (node.kind === 172) { node = node.expression; } else { @@ -21319,16 +24373,18 @@ var ts; error(moduleName, ts.Diagnostics.String_literal_expected); return false; } - var inAmbientExternalModule = node.parent.kind === 219 && node.parent.parent.name.kind === 9; - if (node.parent.kind !== 248 && !inAmbientExternalModule) { - error(moduleName, node.kind === 228 ? + var inAmbientExternalModule = node.parent.kind === 226 && ts.isAmbientModule(node.parent.parent); + if (node.parent.kind !== 256 && !inAmbientExternalModule) { + error(moduleName, node.kind === 236 ? ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace : ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module); return false; } if (inAmbientExternalModule && ts.isExternalModuleNameRelative(moduleName.text)) { - error(node, ts.Diagnostics.Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relative_module_name); - return false; + if (!isTopLevelInExternalModuleAugmentation(node)) { + error(node, ts.Diagnostics.Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relative_module_name); + return false; + } } return true; } @@ -21336,11 +24392,11 @@ var ts; var symbol = getSymbolOfNode(node); var target = resolveAlias(symbol); if (target !== unknownSymbol) { - var excludedMeanings = (symbol.flags & 107455 ? 107455 : 0) | + var excludedMeanings = (symbol.flags & (107455 | 1048576) ? 107455 : 0) | (symbol.flags & 793056 ? 793056 : 0) | (symbol.flags & 1536 ? 1536 : 0); if (target.flags & excludedMeanings) { - var message = node.kind === 230 ? + var message = node.kind === 238 ? ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0; error(node, message, symbolToString(symbol)); @@ -21350,13 +24406,14 @@ var ts; function checkImportBinding(node) { checkCollisionWithCapturedThisVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); + checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); checkAliasSymbol(node); } function checkImportDeclaration(node) { if (checkGrammarModuleElementContext(node, ts.Diagnostics.An_import_declaration_can_only_be_used_in_a_namespace_or_module)) { return; } - if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && (node.flags & 1022)) { + if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && (node.flags & 1023)) { grammarErrorOnFirstToken(node, ts.Diagnostics.An_import_declaration_cannot_have_modifiers); } if (checkExternalImportOrExportDeclaration(node)) { @@ -21366,7 +24423,7 @@ var ts; checkImportBinding(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 224) { + if (importClause.namedBindings.kind === 232) { checkImportBinding(importClause.namedBindings); } else { @@ -21383,7 +24440,7 @@ var ts; checkGrammarDecorators(node) || checkGrammarModifiers(node); if (ts.isInternalModuleImportEqualsDeclaration(node) || checkExternalImportOrExportDeclaration(node)) { checkImportBinding(node); - if (node.flags & 2) { + if (node.flags & 1) { markExportAsReferenced(node); } if (ts.isInternalModuleImportEqualsDeclaration(node)) { @@ -21401,7 +24458,7 @@ var ts; } } else { - if (modulekind === 5 && !ts.isInAmbientContext(node)) { + if (modulekind === ts.ModuleKind.ES6 && !ts.isInAmbientContext(node)) { grammarErrorOnNode(node, ts.Diagnostics.Import_assignment_cannot_be_used_when_targeting_ECMAScript_6_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead); } } @@ -21411,46 +24468,53 @@ var ts; if (checkGrammarModuleElementContext(node, ts.Diagnostics.An_export_declaration_can_only_be_used_in_a_module)) { return; } - if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && (node.flags & 1022)) { + if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && (node.flags & 1023)) { grammarErrorOnFirstToken(node, ts.Diagnostics.An_export_declaration_cannot_have_modifiers); } if (!node.moduleSpecifier || checkExternalImportOrExportDeclaration(node)) { if (node.exportClause) { ts.forEach(node.exportClause.elements, checkExportSpecifier); - var inAmbientExternalModule = node.parent.kind === 219 && node.parent.parent.name.kind === 9; - if (node.parent.kind !== 248 && !inAmbientExternalModule) { + var inAmbientExternalModule = node.parent.kind === 226 && ts.isAmbientModule(node.parent.parent); + if (node.parent.kind !== 256 && !inAmbientExternalModule) { error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace); } } else { var moduleSymbol = resolveExternalModuleName(node, node.moduleSpecifier); - if (moduleSymbol && moduleSymbol.exports["export="]) { + if (moduleSymbol && hasExportAssignmentSymbol(moduleSymbol)) { error(node.moduleSpecifier, ts.Diagnostics.Module_0_uses_export_and_cannot_be_used_with_export_Asterisk, symbolToString(moduleSymbol)); } } } } function checkGrammarModuleElementContext(node, errorMessage) { - if (node.parent.kind !== 248 && node.parent.kind !== 219 && node.parent.kind !== 218) { + if (node.parent.kind !== 256 && node.parent.kind !== 226 && node.parent.kind !== 225) { return grammarErrorOnFirstToken(node, errorMessage); } } function checkExportSpecifier(node) { checkAliasSymbol(node); if (!node.parent.parent.moduleSpecifier) { - markExportAsReferenced(node); + var exportedName = node.propertyName || node.name; + var symbol = resolveName(exportedName, exportedName.text, 107455 | 793056 | 1536 | 8388608, undefined, undefined); + if (symbol && (symbol === undefinedSymbol || isGlobalSourceFile(getDeclarationContainer(symbol.declarations[0])))) { + error(exportedName, ts.Diagnostics.Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module, exportedName.text); + } + else { + markExportAsReferenced(node); + } } } function checkExportAssignment(node) { if (checkGrammarModuleElementContext(node, ts.Diagnostics.An_export_assignment_can_only_be_used_in_a_module)) { return; } - var container = node.parent.kind === 248 ? node.parent : node.parent.parent; - if (container.kind === 218 && container.name.kind === 69) { + var container = node.parent.kind === 256 ? node.parent : node.parent.parent; + if (container.kind === 225 && !ts.isAmbientModule(container)) { error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); return; } - if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && (node.flags & 1022)) { + if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && (node.flags & 1023)) { grammarErrorOnFirstToken(node, ts.Diagnostics.An_export_assignment_cannot_have_modifiers); } if (node.expression.kind === 69) { @@ -21461,23 +24525,14 @@ var ts; } checkExternalModuleExports(container); if (node.isExportEquals && !ts.isInAmbientContext(node)) { - if (modulekind === 5) { + if (modulekind === ts.ModuleKind.ES6) { grammarErrorOnNode(node, ts.Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_6_modules_Consider_using_export_default_or_another_module_format_instead); } - else if (modulekind === 4) { + else if (modulekind === ts.ModuleKind.System) { grammarErrorOnNode(node, ts.Diagnostics.Export_assignment_is_not_supported_when_module_flag_is_system); } } } - function getModuleStatements(node) { - if (node.kind === 248) { - return node.statements; - } - if (node.kind === 218 && node.body.kind === 219) { - return node.body.statements; - } - return emptyArray; - } function hasExportedMembers(moduleSymbol) { for (var id in moduleSymbol.exports) { if (id !== "export=") { @@ -21493,14 +24548,36 @@ var ts; var exportEqualsSymbol = moduleSymbol.exports["export="]; if (exportEqualsSymbol && hasExportedMembers(moduleSymbol)) { var declaration = getDeclarationOfAliasSymbol(exportEqualsSymbol) || exportEqualsSymbol.valueDeclaration; - error(declaration, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements); + if (!isTopLevelInExternalModuleAugmentation(declaration)) { + error(declaration, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements); + } + } + var exports = getExportsOfModule(moduleSymbol); + for (var id in exports) { + if (id === "__export") { + continue; + } + var _a = exports[id], declarations = _a.declarations, flags = _a.flags; + if (flags & (1536 | 64 | 384)) { + continue; + } + var exportedDeclarationsCount = ts.countWhere(declarations, isNotOverload); + if (flags & 524288 && exportedDeclarationsCount <= 2) { + continue; + } + if (exportedDeclarationsCount > 1) { + for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) { + var declaration = declarations_6[_i]; + if (isNotOverload(declaration)) { + diagnostics.add(ts.createDiagnosticForNode(declaration, ts.Diagnostics.Cannot_redeclare_exported_variable_0, id)); + } + } + } } links.exportsChecked = true; } - } - function checkTypePredicate(node) { - if (!isInLegalTypePredicatePosition(node)) { - error(node, ts.Diagnostics.A_type_predicate_is_only_allowed_in_return_type_position_for_functions_and_methods); + function isNotOverload(declaration) { + return declaration.kind !== 220 || !!declaration.body; } } function checkSourceElement(node) { @@ -21510,217 +24587,144 @@ var ts; var kind = node.kind; if (cancellationToken) { switch (kind) { - case 218: - case 214: - case 215: - case 213: + case 225: + case 221: + case 222: + case 220: cancellationToken.throwIfCancellationRequested(); } } switch (kind) { - case 137: - return checkTypeParameter(node); - case 138: - return checkParameter(node); case 141: - case 140: - return checkPropertyDeclaration(node); - case 152: - case 153: - case 147: - case 148: - return checkSignatureDeclaration(node); - case 149: - return checkSignatureDeclaration(node); - case 143: + return checkTypeParameter(node); case 142: - return checkMethodDeclaration(node); - case 144: - return checkConstructorDeclaration(node); + return checkParameter(node); case 145: - case 146: - return checkAccessorDeclaration(node); - case 151: - return checkTypeReferenceNode(node); - case 150: - return checkTypePredicate(node); - case 154: - return checkTypeQuery(node); - case 155: - return checkTypeLiteral(node); + case 144: + return checkPropertyDeclaration(node); case 156: - return checkArrayType(node); case 157: - return checkTupleType(node); + case 151: + case 152: + return checkSignatureDeclaration(node); + case 153: + return checkSignatureDeclaration(node); + case 147: + case 146: + return checkMethodDeclaration(node); + case 148: + return checkConstructorDeclaration(node); + case 149: + case 150: + return checkAccessorDeclaration(node); + case 155: + return checkTypeReferenceNode(node); + case 154: + return checkTypePredicate(node); case 158: + return checkTypeQuery(node); case 159: - return checkUnionOrIntersectionType(node); + return checkTypeLiteral(node); case 160: - return checkSourceElement(node.type); - case 213: - return checkFunctionDeclaration(node); - case 192: - case 219: - return checkBlock(node); - case 193: - return checkVariableStatement(node); - case 195: - return checkExpressionStatement(node); - case 196: - return checkIfStatement(node); - case 197: - return checkDoStatement(node); - case 198: - return checkWhileStatement(node); - case 199: - return checkForStatement(node); - case 200: - return checkForInStatement(node); - case 201: - return checkForOfStatement(node); - case 202: - case 203: - return checkBreakOrContinueStatement(node); - case 204: - return checkReturnStatement(node); - case 205: - return checkWithStatement(node); - case 206: - return checkSwitchStatement(node); - case 207: - return checkLabeledStatement(node); - case 208: - return checkThrowStatement(node); - case 209: - return checkTryStatement(node); - case 211: - return checkVariableDeclaration(node); + return checkArrayType(node); + case 161: + return checkTupleType(node); + case 162: case 163: - return checkBindingElement(node); - case 214: - return checkClassDeclaration(node); - case 215: - return checkInterfaceDeclaration(node); - case 216: - return checkTypeAliasDeclaration(node); - case 217: - return checkEnumDeclaration(node); - case 218: - return checkModuleDeclaration(node); - case 222: - return checkImportDeclaration(node); - case 221: - return checkImportEqualsDeclaration(node); - case 228: - return checkExportDeclaration(node); - case 227: - return checkExportAssignment(node); - case 194: - checkGrammarStatementInAmbientContext(node); - return; + return checkUnionOrIntersectionType(node); + case 164: + return checkSourceElement(node.type); + case 220: + return checkFunctionDeclaration(node); + case 199: + case 226: + return checkBlock(node); + case 200: + return checkVariableStatement(node); + case 202: + return checkExpressionStatement(node); + case 203: + return checkIfStatement(node); + case 204: + return checkDoStatement(node); + case 205: + return checkWhileStatement(node); + case 206: + return checkForStatement(node); + case 207: + return checkForInStatement(node); + case 208: + return checkForOfStatement(node); + case 209: case 210: + return checkBreakOrContinueStatement(node); + case 211: + return checkReturnStatement(node); + case 212: + return checkWithStatement(node); + case 213: + return checkSwitchStatement(node); + case 214: + return checkLabeledStatement(node); + case 215: + return checkThrowStatement(node); + case 216: + return checkTryStatement(node); + case 218: + return checkVariableDeclaration(node); + case 169: + return checkBindingElement(node); + case 221: + return checkClassDeclaration(node); + case 222: + return checkInterfaceDeclaration(node); + case 223: + return checkTypeAliasDeclaration(node); + case 224: + return checkEnumDeclaration(node); + case 225: + return checkModuleDeclaration(node); + case 230: + return checkImportDeclaration(node); + case 229: + return checkImportEqualsDeclaration(node); + case 236: + return checkExportDeclaration(node); + case 235: + return checkExportAssignment(node); + case 201: checkGrammarStatementInAmbientContext(node); return; - case 231: + case 217: + checkGrammarStatementInAmbientContext(node); + return; + case 239: return checkMissingDeclaration(node); } } - function checkFunctionAndClassExpressionBodies(node) { - switch (node.kind) { - case 173: - case 174: - ts.forEach(node.parameters, checkFunctionAndClassExpressionBodies); - checkFunctionExpressionOrObjectLiteralMethodBody(node); - break; - case 186: - ts.forEach(node.members, checkSourceElement); - ts.forEachChild(node, checkFunctionAndClassExpressionBodies); - break; - case 143: - case 142: - ts.forEach(node.decorators, checkFunctionAndClassExpressionBodies); - ts.forEach(node.parameters, checkFunctionAndClassExpressionBodies); - if (ts.isObjectLiteralMethod(node)) { - checkFunctionExpressionOrObjectLiteralMethodBody(node); - } - break; - case 144: - case 145: - case 146: - case 213: - ts.forEach(node.parameters, checkFunctionAndClassExpressionBodies); - break; - case 205: - checkFunctionAndClassExpressionBodies(node.expression); - break; - case 139: - case 138: - case 141: - case 140: - case 161: - case 162: - case 163: - case 164: - case 165: - case 245: - case 166: - case 167: - case 168: - case 169: - case 170: - case 183: - case 190: - case 171: - case 189: - case 172: - case 176: - case 177: - case 178: - case 175: - case 179: - case 180: - case 181: - case 182: - case 185: - case 184: - case 192: - case 219: - case 193: - case 195: - case 196: - case 197: - case 198: - case 199: - case 200: - case 201: - case 202: - case 203: - case 204: - case 206: - case 220: - case 241: - case 242: - case 207: - case 208: - case 209: - case 244: - case 211: - case 212: - case 214: - case 243: - case 188: - case 217: - case 247: - case 227: - case 248: - case 240: - case 233: - case 234: - case 238: - case 239: - case 235: - ts.forEachChild(node, checkFunctionAndClassExpressionBodies); - break; + function checkNodeDeferred(node) { + if (deferredNodes) { + deferredNodes.push(node); + } + } + function checkDeferredNodes() { + for (var _i = 0, deferredNodes_1 = deferredNodes; _i < deferredNodes_1.length; _i++) { + var node = deferredNodes_1[_i]; + switch (node.kind) { + case 179: + case 180: + case 147: + case 146: + checkFunctionExpressionOrObjectLiteralMethodDeferred(node); + break; + case 149: + case 150: + checkAccessorDeferred(node); + break; + case 192: + checkClassExpressionDeferred(node); + break; + } } } function checkSourceFile(node) { @@ -21737,12 +24741,11 @@ var ts; } } checkGrammarSourceFile(node); - emitExtends = false; - emitDecorate = false; - emitParam = false; potentialThisCollisions.length = 0; + deferredNodes = []; ts.forEach(node.statements, checkSourceElement); - checkFunctionAndClassExpressionBodies(node); + checkDeferredNodes(); + deferredNodes = undefined; if (ts.isExternalOrCommonJsModule(node)) { checkExternalModuleExports(node); } @@ -21750,21 +24753,6 @@ var ts; ts.forEach(potentialThisCollisions, checkIfThisIsCapturedInEnclosingScope); potentialThisCollisions.length = 0; } - if (emitExtends) { - links.flags |= 8; - } - if (emitDecorate) { - links.flags |= 16; - } - if (emitParam) { - links.flags |= 32; - } - if (emitAwaiter) { - links.flags |= 64; - } - if (emitGenerator || (emitAwaiter && languageVersion < 2)) { - links.flags |= 128; - } links.flags |= 1; } } @@ -21798,7 +24786,7 @@ var ts; function isInsideWithStatementBody(node) { if (node) { while (node.parent) { - if (node.parent.kind === 205 && node.parent.statement === node) { + if (node.parent.kind === 212 && node.parent.statement === node) { return true; } node = node.parent; @@ -21820,28 +24808,28 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 248: + case 256: if (!ts.isExternalOrCommonJsModule(location)) { break; } - case 218: + case 225: copySymbols(getSymbolOfNode(location).exports, meaning & 8914931); break; - case 217: + case 224: copySymbols(getSymbolOfNode(location).exports, meaning & 8); break; - case 186: + case 192: var className = location.name; if (className) { copySymbol(location.symbol, meaning); } - case 214: - case 215: - if (!(memberFlags & 64)) { + case 221: + case 222: + if (!(memberFlags & 32)) { copySymbols(getSymbolOfNode(location).members, meaning & 793056); } break; - case 173: + case 179: var funcName = location.name; if (funcName) { copySymbol(location.symbol, meaning); @@ -21880,36 +24868,50 @@ var ts; } function isTypeDeclaration(node) { switch (node.kind) { - case 137: - case 214: - case 215: - case 216: - case 217: + case 141: + case 221: + case 222: + case 223: + case 224: return true; } } function isTypeReferenceIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 135) { + while (node.parent && node.parent.kind === 139) { node = node.parent; } - return node.parent && node.parent.kind === 151; + return node.parent && node.parent.kind === 155; } function isHeritageClauseElementIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 166) { + while (node.parent && node.parent.kind === 172) { node = node.parent; } - return node.parent && node.parent.kind === 188; + return node.parent && node.parent.kind === 194; + } + function forEachEnclosingClass(node, callback) { + var result; + while (true) { + node = ts.getContainingClass(node); + if (!node) + break; + if (result = callback(node)) + break; + } + return result; + } + function isNodeWithinClass(node, classDeclaration) { + return !!forEachEnclosingClass(node, function (n) { return n === classDeclaration; }); } function getLeftSideOfImportEqualsOrExportAssignment(nodeOnRightSide) { - while (nodeOnRightSide.parent.kind === 135) { + while (nodeOnRightSide.parent.kind === 139) { nodeOnRightSide = nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 221) { + if (nodeOnRightSide.parent.kind === 229) { return nodeOnRightSide.parent.moduleReference === nodeOnRightSide && nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 227) { + if (nodeOnRightSide.parent.kind === 235) { return nodeOnRightSide.parent.expression === nodeOnRightSide && nodeOnRightSide.parent; } return undefined; @@ -21921,10 +24923,22 @@ var ts; if (ts.isDeclarationName(entityName)) { return getSymbolOfNode(entityName.parent); } - if (entityName.parent.kind === 227) { + if (ts.isInJavaScriptFile(entityName) && entityName.parent.kind === 172) { + var specialPropertyAssignmentKind = ts.getSpecialPropertyAssignmentKind(entityName.parent.parent); + switch (specialPropertyAssignmentKind) { + case 1: + case 3: + return getSymbolOfNode(entityName.parent); + case 4: + case 2: + return getSymbolOfNode(entityName.parent.parent); + default: + } + } + if (entityName.parent.kind === 235) { return resolveEntityName(entityName, 107455 | 793056 | 1536 | 8388608); } - if (entityName.kind !== 166) { + if (entityName.kind !== 172) { if (isInRightSideOfImportOrExportAssignment(entityName)) { return getSymbolOfPartOfRightHandSideOfImportEquals(entityName); } @@ -21934,7 +24948,7 @@ var ts; } if (isHeritageClauseElementIdentifier(entityName)) { var meaning = 0; - if (entityName.parent.kind === 188) { + if (entityName.parent.kind === 194) { meaning = 793056; if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) { meaning |= 107455; @@ -21946,27 +24960,25 @@ var ts; meaning |= 8388608; return resolveEntityName(entityName, meaning); } - else if ((entityName.parent.kind === 235) || - (entityName.parent.kind === 234) || - (entityName.parent.kind === 237)) { - return getJsxElementTagSymbol(entityName.parent); - } else if (ts.isExpression(entityName)) { if (ts.nodeIsMissing(entityName)) { return undefined; } if (entityName.kind === 69) { + if (ts.isJSXTagName(entityName) && isJsxIntrinsicIdentifier(entityName)) { + return getIntrinsicTagSymbol(entityName.parent); + } var meaning = 107455 | 8388608; return resolveEntityName(entityName, meaning); } - else if (entityName.kind === 166) { + else if (entityName.kind === 172) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkPropertyAccessExpression(entityName); } return getNodeLinks(entityName).resolvedSymbol; } - else if (entityName.kind === 135) { + else if (entityName.kind === 139) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkQualifiedName(entityName); @@ -21975,33 +24987,39 @@ var ts; } } else if (isTypeReferenceIdentifier(entityName)) { - var meaning = entityName.parent.kind === 151 ? 793056 : 1536; + var meaning = entityName.parent.kind === 155 ? 793056 : 1536; meaning |= 8388608; return resolveEntityName(entityName, meaning); } - else if (entityName.parent.kind === 238) { + else if (entityName.parent.kind === 246) { return getJsxAttributePropertySymbol(entityName.parent); } - if (entityName.parent.kind === 150) { + if (entityName.parent.kind === 154) { return resolveEntityName(entityName, 1); } return undefined; } function getSymbolAtLocation(node) { + if (node.kind === 256) { + return ts.isExternalModule(node) ? getMergedSymbol(node.symbol) : undefined; + } if (isInsideWithStatementBody(node)) { return undefined; } if (ts.isDeclarationName(node)) { return getSymbolOfNode(node.parent); } + else if (ts.isLiteralComputedPropertyDeclarationName(node)) { + return getSymbolOfNode(node.parent.parent); + } if (node.kind === 69) { if (isInRightSideOfImportOrExportAssignment(node)) { - return node.parent.kind === 227 + return node.parent.kind === 235 ? getSymbolOfEntityNameOrPropertyAccessExpression(node) : getSymbolOfPartOfRightHandSideOfImportEquals(node); } - else if (node.parent.kind === 163 && - node.parent.parent.kind === 161 && + else if (node.parent.kind === 169 && + node.parent.parent.kind === 167 && node === node.parent.propertyName) { var typeOfPattern = getTypeOfNode(node.parent.parent); var propertyDeclaration = typeOfPattern && getPropertyOfType(typeOfPattern, node.text); @@ -22012,28 +25030,30 @@ var ts; } switch (node.kind) { case 69: - case 166: - case 135: + case 172: + case 139: return getSymbolOfEntityNameOrPropertyAccessExpression(node); case 97: case 95: var type = ts.isExpression(node) ? checkExpression(node) : getTypeFromTypeNode(node); return type.symbol; + case 165: + return getTypeFromTypeNode(node).symbol; case 121: var constructorDeclaration = node.parent; - if (constructorDeclaration && constructorDeclaration.kind === 144) { + if (constructorDeclaration && constructorDeclaration.kind === 148) { return constructorDeclaration.parent.symbol; } return undefined; case 9: if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || - ((node.parent.kind === 222 || node.parent.kind === 228) && + ((node.parent.kind === 230 || node.parent.kind === 236) && node.parent.moduleSpecifier === node)) { return resolveExternalModuleName(node, node); } case 8: - if (node.parent.kind === 167 && node.parent.argumentExpression === node) { + if (node.parent.kind === 173 && node.parent.argumentExpression === node) { var objectType = checkExpression(node.parent.expression); if (objectType === unknownType) return undefined; @@ -22047,11 +25067,16 @@ var ts; return undefined; } function getShorthandAssignmentValueSymbol(location) { - if (location && location.kind === 246) { - return resolveEntityName(location.name, 107455); + if (location && location.kind === 254) { + return resolveEntityName(location.name, 107455 | 8388608); } return undefined; } + function getExportSpecifierLocalTargetSymbol(node) { + return node.parent.parent.moduleSpecifier ? + getExternalModuleMember(node.parent.parent, node) : + resolveEntityName(node.propertyName || node.name, 107455 | 793056 | 1536 | 8388608); + } function getTypeOfNode(node) { if (isInsideWithStatementBody(node)) { return unknownType; @@ -22091,6 +25116,29 @@ var ts; } return unknownType; } + function getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr) { + ts.Debug.assert(expr.kind === 171 || expr.kind === 170); + if (expr.parent.kind === 208) { + var iteratedType = checkRightHandSideOfForOf(expr.parent.expression); + return checkDestructuringAssignment(expr, iteratedType || unknownType); + } + if (expr.parent.kind === 187) { + var iteratedType = checkExpression(expr.parent.right); + return checkDestructuringAssignment(expr, iteratedType || unknownType); + } + if (expr.parent.kind === 253) { + var typeOfParentObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent.parent); + return checkObjectLiteralDestructuringPropertyAssignment(typeOfParentObjectLiteral || unknownType, expr.parent); + } + ts.Debug.assert(expr.parent.kind === 170); + var typeOfArrayLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent); + var elementType = checkIteratedTypeOrElementType(typeOfArrayLiteral || unknownType, expr.parent, false) || unknownType; + return checkArrayLiteralDestructuringElementAssignment(expr.parent, typeOfArrayLiteral, ts.indexOf(expr.parent.elements, expr), elementType || unknownType); + } + function getPropertySymbolOfDestructuringAssignment(location) { + var typeOfObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(location.parent.parent); + return typeOfObjectLiteral && getPropertyOfType(typeOfObjectLiteral, location.text); + } function getTypeOfExpression(expr) { if (ts.isRightSideOfQualifiedNameOrPropertyAccess(expr)) { expr = expr.parent; @@ -22099,7 +25147,7 @@ var ts; } function getParentTypeOfClassElement(node) { var classSymbol = getSymbolOfNode(node.parent); - return node.flags & 64 + return node.flags & 32 ? getTypeOfSymbol(classSymbol) : getDeclaredTypeOfSymbol(classSymbol); } @@ -22117,18 +25165,22 @@ var ts; } function getRootSymbols(symbol) { if (symbol.flags & 268435456) { - var symbols = []; - var name_15 = symbol.name; + var symbols_3 = []; + var name_19 = symbol.name; ts.forEach(getSymbolLinks(symbol).containingType.types, function (t) { - var symbol = getPropertyOfType(t, name_15); + var symbol = getPropertyOfType(t, name_19); if (symbol) { - symbols.push(symbol); + symbols_3.push(symbol); } }); - return symbols; + return symbols_3; } else if (symbol.flags & 67108864) { - var target = getSymbolLinks(symbol).target; + var target = void 0; + var next = symbol; + while (next = getSymbolLinks(next).target) { + target = next; + } if (target) { return [target]; } @@ -22138,6 +25190,25 @@ var ts; function isArgumentsLocalBinding(node) { return getReferencedValueSymbol(node) === argumentsSymbol; } + function moduleExportsSomeValue(moduleReferenceExpression) { + var moduleSymbol = resolveExternalModuleName(moduleReferenceExpression.parent, moduleReferenceExpression); + if (!moduleSymbol) { + return true; + } + var hasExportAssignment = hasExportAssignmentSymbol(moduleSymbol); + moduleSymbol = resolveExternalModuleSymbol(moduleSymbol); + var symbolLinks = getSymbolLinks(moduleSymbol); + if (symbolLinks.exportsSomeValue === undefined) { + symbolLinks.exportsSomeValue = hasExportAssignment + ? !!(moduleSymbol.flags & 107455) + : ts.forEachValue(getExportsOfModule(moduleSymbol), isValue); + } + return symbolLinks.exportsSomeValue; + function isValue(s) { + s = resolveSymbol(s); + return s && !!(s.flags & 107455); + } + } function getReferencedExportContainer(node) { var symbol = getReferencedValueSymbol(node); if (symbol) { @@ -22150,11 +25221,11 @@ var ts; } var parentSymbol = getParentOfSymbol(symbol); if (parentSymbol) { - if (parentSymbol.flags & 512 && parentSymbol.valueDeclaration.kind === 248) { + if (parentSymbol.flags & 512 && parentSymbol.valueDeclaration.kind === 256) { return parentSymbol.valueDeclaration; } for (var n = node.parent; n; n = n.parent) { - if ((n.kind === 218 || n.kind === 217) && getSymbolOfNode(n) === parentSymbol) { + if ((n.kind === 225 || n.kind === 224) && getSymbolOfNode(n) === parentSymbol) { return n; } } @@ -22165,54 +25236,56 @@ var ts; var symbol = getReferencedValueSymbol(node); return symbol && symbol.flags & 8388608 ? getDeclarationOfAliasSymbol(symbol) : undefined; } - function isStatementWithLocals(node) { - switch (node.kind) { - case 192: - case 220: - case 199: - case 200: - case 201: - return true; - } - return false; - } - function isNestedRedeclarationSymbol(symbol) { + function isSymbolOfDeclarationWithCollidingName(symbol) { if (symbol.flags & 418) { var links = getSymbolLinks(symbol); - if (links.isNestedRedeclaration === undefined) { + if (links.isDeclarationWithCollidingName === undefined) { var container = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration); - links.isNestedRedeclaration = isStatementWithLocals(container) && - !!resolveName(container.parent, symbol.name, 107455, undefined, undefined); + if (ts.isStatementWithLocals(container)) { + var nodeLinks_1 = getNodeLinks(symbol.valueDeclaration); + if (!!resolveName(container.parent, symbol.name, 107455, undefined, undefined)) { + links.isDeclarationWithCollidingName = true; + } + else if (nodeLinks_1.flags & 131072) { + var isDeclaredInLoop = nodeLinks_1.flags & 262144; + var inLoopInitializer = ts.isIterationStatement(container, false); + var inLoopBodyBlock = container.kind === 199 && ts.isIterationStatement(container.parent, false); + links.isDeclarationWithCollidingName = !ts.isBlockScopedContainerTopLevel(container) && (!isDeclaredInLoop || (!inLoopInitializer && !inLoopBodyBlock)); + } + else { + links.isDeclarationWithCollidingName = false; + } + } } - return links.isNestedRedeclaration; + return links.isDeclarationWithCollidingName; } return false; } - function getReferencedNestedRedeclaration(node) { + function getReferencedDeclarationWithCollidingName(node) { var symbol = getReferencedValueSymbol(node); - return symbol && isNestedRedeclarationSymbol(symbol) ? symbol.valueDeclaration : undefined; + return symbol && isSymbolOfDeclarationWithCollidingName(symbol) ? symbol.valueDeclaration : undefined; } - function isNestedRedeclaration(node) { - return isNestedRedeclarationSymbol(getSymbolOfNode(node)); + function isDeclarationWithCollidingName(node) { + return isSymbolOfDeclarationWithCollidingName(getSymbolOfNode(node)); } function isValueAliasDeclaration(node) { switch (node.kind) { - case 221: - case 223: - case 224: - case 226: - case 230: + case 229: + case 231: + case 232: + case 234: + case 238: return isAliasResolvedToValue(getSymbolOfNode(node)); - case 228: + case 236: var exportClause = node.exportClause; return exportClause && ts.forEach(exportClause.elements, isValueAliasDeclaration); - case 227: + case 235: return node.expression && node.expression.kind === 69 ? isAliasResolvedToValue(getSymbolOfNode(node)) : true; } return false; } function isTopLevelValueImportEqualsWithEntityName(node) { - if (node.parent.kind !== 248 || !ts.isInternalModuleImportEqualsDeclaration(node)) { + if (node.parent.kind !== 256 || !ts.isInternalModuleImportEqualsDeclaration(node)) { return false; } var isValue = isAliasResolvedToValue(getSymbolOfNode(node)); @@ -22220,12 +25293,10 @@ var ts; } function isAliasResolvedToValue(symbol) { var target = resolveAlias(symbol); - if (target === unknownSymbol && compilerOptions.isolatedModules) { + if (target === unknownSymbol) { return true; } - return target !== unknownSymbol && - target && - target.flags & 107455 && + return target.flags & 107455 && (compilerOptions.preserveConstEnums || !isConstEnumOrConstEnumOnlyModule(target)); } function isConstEnumOrConstEnumOnlyModule(s) { @@ -22260,7 +25331,7 @@ var ts; return getNodeLinks(node).enumMemberValue; } function getConstantValue(node) { - if (node.kind === 247) { + if (node.kind === 255) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; @@ -22291,22 +25362,22 @@ var ts; else if (type.flags & 1) { return ts.TypeReferenceSerializationKind.ObjectType; } - else if (allConstituentTypesHaveKind(type, 16)) { + else if (isTypeOfKind(type, 16)) { return ts.TypeReferenceSerializationKind.VoidType; } - else if (allConstituentTypesHaveKind(type, 8)) { + else if (isTypeOfKind(type, 8)) { return ts.TypeReferenceSerializationKind.BooleanType; } - else if (allConstituentTypesHaveKind(type, 132)) { + else if (isTypeOfKind(type, 132)) { return ts.TypeReferenceSerializationKind.NumberLikeType; } - else if (allConstituentTypesHaveKind(type, 258)) { + else if (isTypeOfKind(type, 258)) { return ts.TypeReferenceSerializationKind.StringLikeType; } - else if (allConstituentTypesHaveKind(type, 8192)) { + else if (isTypeOfKind(type, 8192)) { return ts.TypeReferenceSerializationKind.ArrayLikeType; } - else if (allConstituentTypesHaveKind(type, 16777216)) { + else if (isTypeOfKind(type, 16777216)) { return ts.TypeReferenceSerializationKind.ESSymbolType; } else if (isFunctionType(type)) { @@ -22331,9 +25402,15 @@ var ts; getSymbolDisplayBuilder().buildTypeDisplay(getReturnTypeOfSignature(signature), writer, enclosingDeclaration, flags); } function writeTypeOfExpression(expr, enclosingDeclaration, flags, writer) { - var type = getTypeOfExpression(expr); + var type = getWidenedType(getTypeOfExpression(expr)); getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags); } + function writeBaseConstructorTypeOfClass(node, enclosingDeclaration, flags, writer) { + var classType = getDeclaredTypeOfSymbol(getSymbolOfNode(node)); + resolveBaseTypesOfClass(classType); + var baseType = classType.resolvedBaseTypes.length ? classType.resolvedBaseTypes[0] : unknownType; + getSymbolDisplayBuilder().buildTypeDisplay(baseType, writer, enclosingDeclaration, flags); + } function hasGlobalName(name) { return ts.hasProperty(globals, name); } @@ -22346,23 +25423,28 @@ var ts; var symbol = getReferencedValueSymbol(reference); return symbol && getExportSymbolOfValueSymbolIfExported(symbol).valueDeclaration; } - function instantiateSingleCallFunctionType(functionType, typeArguments) { - if (functionType === unknownType) { - return unknownType; - } - var signature = getSingleCallSignature(functionType); - if (!signature) { - return unknownType; - } - var instantiatedSignature = getSignatureInstantiation(signature, typeArguments); - return getOrCreateTypeFromSignature(instantiatedSignature); - } function createResolver() { + var resolvedTypeReferenceDirectives = host.getResolvedTypeReferenceDirectives(); + var fileToDirective; + if (resolvedTypeReferenceDirectives) { + fileToDirective = ts.createFileMap(); + for (var key in resolvedTypeReferenceDirectives) { + if (!ts.hasProperty(resolvedTypeReferenceDirectives, key)) { + continue; + } + var resolvedDirective = resolvedTypeReferenceDirectives[key]; + if (!resolvedDirective) { + continue; + } + var file = host.getSourceFile(resolvedDirective.resolvedFileName); + fileToDirective.set(file.path, key); + } + } return { getReferencedExportContainer: getReferencedExportContainer, getReferencedImportDeclaration: getReferencedImportDeclaration, - getReferencedNestedRedeclaration: getReferencedNestedRedeclaration, - isNestedRedeclaration: isNestedRedeclaration, + getReferencedDeclarationWithCollidingName: getReferencedDeclarationWithCollidingName, + isDeclarationWithCollidingName: isDeclarationWithCollidingName, isValueAliasDeclaration: isValueAliasDeclaration, hasGlobalName: hasGlobalName, isReferencedAliasDeclaration: isReferencedAliasDeclaration, @@ -22373,6 +25455,7 @@ var ts; writeTypeOfDeclaration: writeTypeOfDeclaration, writeReturnTypeOfSignatureDeclaration: writeReturnTypeOfSignatureDeclaration, writeTypeOfExpression: writeTypeOfExpression, + writeBaseConstructorTypeOfClass: writeBaseConstructorTypeOfClass, isSymbolAccessible: isSymbolAccessible, isEntityNameVisible: isEntityNameVisible, getConstantValue: getConstantValue, @@ -22380,31 +25463,106 @@ var ts; getReferencedValueDeclaration: getReferencedValueDeclaration, getTypeReferenceSerializationKind: getTypeReferenceSerializationKind, isOptionalParameter: isOptionalParameter, + moduleExportsSomeValue: moduleExportsSomeValue, isArgumentsLocalBinding: isArgumentsLocalBinding, - getExternalModuleFileFromDeclaration: getExternalModuleFileFromDeclaration + getExternalModuleFileFromDeclaration: getExternalModuleFileFromDeclaration, + getTypeReferenceDirectivesForEntityName: getTypeReferenceDirectivesForEntityName, + getTypeReferenceDirectivesForSymbol: getTypeReferenceDirectivesForSymbol }; + function getTypeReferenceDirectivesForEntityName(node) { + if (!fileToDirective) { + return undefined; + } + var meaning = (node.kind === 172) || (node.kind === 69 && isInTypeQuery(node)) + ? 107455 | 1048576 + : 793056 | 1536; + var symbol = resolveEntityName(node, meaning, true); + return symbol && symbol !== unknownSymbol ? getTypeReferenceDirectivesForSymbol(symbol, meaning) : undefined; + } + function getTypeReferenceDirectivesForSymbol(symbol, meaning) { + if (!fileToDirective) { + return undefined; + } + if (!isSymbolFromTypeDeclarationFile(symbol)) { + return undefined; + } + var typeReferenceDirectives; + for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { + var decl = _a[_i]; + if (decl.symbol && decl.symbol.flags & meaning) { + var file = ts.getSourceFileOfNode(decl); + var typeReferenceDirective = fileToDirective.get(file.path); + if (typeReferenceDirective) { + (typeReferenceDirectives || (typeReferenceDirectives = [])).push(typeReferenceDirective); + } + } + } + return typeReferenceDirectives; + } + function isSymbolFromTypeDeclarationFile(symbol) { + if (!symbol.declarations) { + return false; + } + var current = symbol; + while (true) { + var parent_12 = getParentOfSymbol(current); + if (parent_12) { + current = parent_12; + } + else { + break; + } + } + if (current.valueDeclaration && current.valueDeclaration.kind === 256 && current.flags & 512) { + return false; + } + for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { + var decl = _a[_i]; + var file = ts.getSourceFileOfNode(decl); + if (fileToDirective.contains(file.path)) { + return true; + } + } + return false; + } } function getExternalModuleFileFromDeclaration(declaration) { var specifier = ts.getExternalModuleName(declaration); - var moduleSymbol = getSymbolAtLocation(specifier); + var moduleSymbol = resolveExternalModuleNameWorker(specifier, specifier, undefined); if (!moduleSymbol) { return undefined; } - return ts.getDeclarationOfKind(moduleSymbol, 248); + return ts.getDeclarationOfKind(moduleSymbol, 256); } function initializeTypeChecker() { ts.forEach(host.getSourceFiles(), function (file) { ts.bindSourceFile(file, compilerOptions); }); + var augmentations; ts.forEach(host.getSourceFiles(), function (file) { if (!ts.isExternalOrCommonJsModule(file)) { mergeSymbolTable(globals, file.locals); } + if (file.moduleAugmentations.length) { + (augmentations || (augmentations = [])).push(file.moduleAugmentations); + } + if (file.wasReferenced && file.symbol && file.symbol.globalExports) { + mergeSymbolTable(globals, file.symbol.globalExports); + } }); + if (augmentations) { + for (var _i = 0, augmentations_1 = augmentations; _i < augmentations_1.length; _i++) { + var list = augmentations_1[_i]; + for (var _a = 0, list_2 = list; _a < list_2.length; _a++) { + var augmentation = list_2[_a]; + mergeModuleAugmentation(augmentation); + } + } + } + addToSymbolTable(globals, builtinGlobals, ts.Diagnostics.Declaration_name_conflicts_with_built_in_global_identifier_0); getSymbolLinks(undefinedSymbol).type = undefinedType; getSymbolLinks(argumentsSymbol).type = getGlobalType("IArguments"); getSymbolLinks(unknownSymbol).type = unknownType; - globals[undefinedSymbol.name] = undefinedSymbol; globalArrayType = getGlobalType("Array", 1); globalObjectType = getGlobalType("Object"); globalFunctionType = getGlobalType("Function"); @@ -22418,6 +25576,7 @@ var ts; getGlobalMethodDecoratorType = ts.memoize(function () { return getGlobalType("MethodDecorator"); }); getGlobalParameterDecoratorType = ts.memoize(function () { return getGlobalType("ParameterDecorator"); }); getGlobalTypedPropertyDescriptorType = ts.memoize(function () { return getGlobalType("TypedPropertyDescriptor", 1); }); + getGlobalESSymbolConstructorSymbol = ts.memoize(function () { return getGlobalValueSymbol("Symbol"); }); getGlobalPromiseType = ts.memoize(function () { return getGlobalType("Promise", 1); }); tryGetGlobalPromiseType = ts.memoize(function () { return getGlobalSymbol("Promise", 793056, undefined) && getGlobalPromiseType(); }); getGlobalPromiseLikeType = ts.memoize(function () { return getGlobalType("PromiseLike", 1); }); @@ -22425,23 +25584,23 @@ var ts; getGlobalPromiseConstructorSymbol = ts.memoize(function () { return getGlobalValueSymbol("Promise"); }); getGlobalPromiseConstructorLikeType = ts.memoize(function () { return getGlobalType("PromiseConstructorLike"); }); getGlobalThenableType = ts.memoize(createThenableType); + getGlobalTemplateStringsArrayType = ts.memoize(function () { return getGlobalType("TemplateStringsArray"); }); if (languageVersion >= 2) { - globalTemplateStringsArrayType = getGlobalType("TemplateStringsArray"); - globalESSymbolType = getGlobalType("Symbol"); - globalESSymbolConstructorSymbol = getGlobalValueSymbol("Symbol"); - globalIterableType = getGlobalType("Iterable", 1); - globalIteratorType = getGlobalType("Iterator", 1); - globalIterableIteratorType = getGlobalType("IterableIterator", 1); + getGlobalESSymbolType = ts.memoize(function () { return getGlobalType("Symbol"); }); + getGlobalIterableType = ts.memoize(function () { return getGlobalType("Iterable", 1); }); + getGlobalIteratorType = ts.memoize(function () { return getGlobalType("Iterator", 1); }); + getGlobalIterableIteratorType = ts.memoize(function () { return getGlobalType("IterableIterator", 1); }); } else { - globalTemplateStringsArrayType = unknownType; - globalESSymbolType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); - globalESSymbolConstructorSymbol = undefined; - globalIterableType = emptyGenericType; - globalIteratorType = emptyGenericType; - globalIterableIteratorType = emptyGenericType; + getGlobalESSymbolType = ts.memoize(function () { return emptyObjectType; }); + getGlobalIterableType = ts.memoize(function () { return emptyGenericType; }); + getGlobalIteratorType = ts.memoize(function () { return emptyGenericType; }); + getGlobalIterableIteratorType = ts.memoize(function () { return emptyGenericType; }); } anyArrayType = createArrayType(anyType); + var symbol = getGlobalSymbol("ReadonlyArray", 793056, undefined); + globalReadonlyArrayType = symbol && getTypeOfGlobalSymbol(symbol, 1); + anyReadonlyArrayType = globalReadonlyArrayType ? createTypeFromGenericGlobalType(globalReadonlyArrayType, [anyType]) : anyArrayType; } function createInstantiatedPromiseLikeType() { var promiseLikeType = getGlobalPromiseLikeType(); @@ -22465,9 +25624,14 @@ var ts; return false; } if (!ts.nodeCanBeDecorated(node)) { - return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_are_not_valid_here); + if (node.kind === 147 && !ts.nodeIsPresent(node.body)) { + return grammarErrorOnFirstToken(node, ts.Diagnostics.A_decorator_can_only_decorate_a_method_implementation_not_an_overload); + } + else { + return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_are_not_valid_here); + } } - else if (node.kind === 145 || node.kind === 146) { + else if (node.kind === 149 || node.kind === 150) { var accessors = ts.getAllAccessorDeclarations(node.parent.members, node); if (accessors.firstAccessor.decorators && node === accessors.secondAccessor) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name); @@ -22477,38 +25641,38 @@ var ts; } function checkGrammarModifiers(node) { switch (node.kind) { - case 145: - case 146: - case 144: - case 141: - case 140: - case 143: - case 142: case 149: - case 218: - case 222: - case 221: - case 228: - case 227: - case 138: + case 150: + case 148: + case 145: + case 144: + case 147: + case 146: + case 153: + case 225: + case 230: + case 229: + case 236: + case 235: + case 142: break; - case 213: + case 220: if (node.modifiers && (node.modifiers.length > 1 || node.modifiers[0].kind !== 118) && - node.parent.kind !== 219 && node.parent.kind !== 248) { + node.parent.kind !== 226 && node.parent.kind !== 256) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); } break; - case 214: - case 215: - case 193: - case 216: - if (node.modifiers && node.parent.kind !== 219 && node.parent.kind !== 248) { + case 221: + case 222: + case 200: + case 223: + if (node.modifiers && node.parent.kind !== 226 && node.parent.kind !== 256) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); } break; - case 217: + case 224: if (node.modifiers && (node.modifiers.length > 1 || node.modifiers[0].kind !== 74) && - node.parent.kind !== 219 && node.parent.kind !== 248) { + node.parent.kind !== 226 && node.parent.kind !== 256) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); } break; @@ -22518,37 +25682,48 @@ var ts; if (!node.modifiers) { return; } - var lastStatic, lastPrivate, lastProtected, lastDeclare, lastAsync; + var lastStatic, lastPrivate, lastProtected, lastDeclare, lastAsync, lastReadonly; var flags = 0; for (var _i = 0, _a = node.modifiers; _i < _a.length; _i++) { var modifier = _a[_i]; + if (modifier.kind !== 128) { + if (node.kind === 144 || node.kind === 146) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_type_member, ts.tokenToString(modifier.kind)); + } + if (node.kind === 153) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_an_index_signature, ts.tokenToString(modifier.kind)); + } + } switch (modifier.kind) { + case 74: + if (node.kind !== 224 && node.parent.kind === 221) { + return grammarErrorOnNode(node, ts.Diagnostics.A_class_member_cannot_have_the_0_keyword, ts.tokenToString(74)); + } + break; case 112: case 111: case 110: - var text = void 0; - if (modifier.kind === 112) { - text = "public"; - } - else if (modifier.kind === 111) { - text = "protected"; + var text = visibilityToString(ts.modifierToFlag(modifier.kind)); + if (modifier.kind === 111) { lastProtected = modifier; } - else { - text = "private"; + else if (modifier.kind === 110) { lastPrivate = modifier; } - if (flags & 56) { + if (flags & 28) { return grammarErrorOnNode(modifier, ts.Diagnostics.Accessibility_modifier_already_seen); } - else if (flags & 64) { + else if (flags & 32) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "static"); } + else if (flags & 64) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "readonly"); + } else if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "async"); } - else if (node.parent.kind === 219 || node.parent.kind === 248) { - return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, text); + else if (node.parent.kind === 226 || node.parent.kind === 256) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, text); } else if (flags & 128) { if (modifier.kind === 110) { @@ -22561,29 +25736,42 @@ var ts; flags |= ts.modifierToFlag(modifier.kind); break; case 113: - if (flags & 64) { + if (flags & 32) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "static"); } + else if (flags & 64) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "readonly"); + } else if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "async"); } - else if (node.parent.kind === 219 || node.parent.kind === 248) { - return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, "static"); + else if (node.parent.kind === 226 || node.parent.kind === 256) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, "static"); } - else if (node.kind === 138) { + else if (node.kind === 142) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static"); } else if (flags & 128) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "static", "abstract"); } - flags |= 64; + flags |= 32; lastStatic = modifier; break; + case 128: + if (flags & 64) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "readonly"); + } + else if (node.kind !== 145 && node.kind !== 144 && node.kind !== 153 && node.kind !== 142) { + return grammarErrorOnNode(modifier, ts.Diagnostics.readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature); + } + flags |= 64; + lastReadonly = modifier; + break; case 82: - if (flags & 2) { + if (flags & 1) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "export"); } - else if (flags & 4) { + else if (flags & 2) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "declare"); } else if (flags & 128) { @@ -22592,48 +25780,51 @@ var ts; else if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "async"); } - else if (node.parent.kind === 214) { + else if (node.parent.kind === 221) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export"); } - else if (node.kind === 138) { + else if (node.kind === 142) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export"); } - flags |= 2; + flags |= 1; break; case 122: - if (flags & 4) { + if (flags & 2) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "declare"); } else if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } - else if (node.parent.kind === 214) { + else if (node.parent.kind === 221) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare"); } - else if (node.kind === 138) { + else if (node.kind === 142) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); } - else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 219) { + else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 226) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); } - flags |= 4; + flags |= 2; lastDeclare = modifier; break; case 115: if (flags & 128) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "abstract"); } - if (node.kind !== 214) { - if (node.kind !== 143) { - return grammarErrorOnNode(modifier, ts.Diagnostics.abstract_modifier_can_only_appear_on_a_class_or_method_declaration); + if (node.kind !== 221) { + if (node.kind !== 147 && + node.kind !== 145 && + node.kind !== 149 && + node.kind !== 150) { + return grammarErrorOnNode(modifier, ts.Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration); } - if (!(node.parent.kind === 214 && node.parent.flags & 128)) { + if (!(node.parent.kind === 221 && node.parent.flags & 128)) { return grammarErrorOnNode(modifier, ts.Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class); } - if (flags & 64) { + if (flags & 32) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "static", "abstract"); } - if (flags & 16) { + if (flags & 8) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "private", "abstract"); } } @@ -22643,10 +25834,10 @@ var ts; if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "async"); } - else if (flags & 4 || ts.isInAmbientContext(node.parent)) { + else if (flags & 2 || ts.isInAmbientContext(node.parent)) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } - else if (node.kind === 138) { + else if (node.kind === 142) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "async"); } flags |= 256; @@ -22654,28 +25845,25 @@ var ts; break; } } - if (node.kind === 144) { - if (flags & 64) { + if (node.kind === 148) { + if (flags & 32) { return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static"); } if (flags & 128) { return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "abstract"); } - else if (flags & 32) { - return grammarErrorOnNode(lastProtected, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "protected"); - } - else if (flags & 16) { - return grammarErrorOnNode(lastPrivate, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "private"); - } else if (flags & 256) { return grammarErrorOnNode(lastAsync, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "async"); } + else if (flags & 64) { + return grammarErrorOnNode(lastReadonly, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "readonly"); + } return; } - else if ((node.kind === 222 || node.kind === 221) && flags & 4) { + else if ((node.kind === 230 || node.kind === 229) && flags & 2) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare"); } - else if (node.kind === 138 && (flags & 56) && ts.isBindingPattern(node.name)) { + else if (node.kind === 142 && (flags & 92) && ts.isBindingPattern(node.name)) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_may_not_be_a_binding_pattern); } if (flags & 256) { @@ -22687,10 +25875,10 @@ var ts; return grammarErrorOnNode(asyncModifier, ts.Diagnostics.Async_functions_are_only_available_when_targeting_ECMAScript_6_and_higher); } switch (node.kind) { - case 143: - case 213: - case 173: - case 174: + case 147: + case 220: + case 179: + case 180: if (!node.asteriskToken) { return false; } @@ -22755,7 +25943,7 @@ var ts; checkGrammarParameterList(node.parameters) || checkGrammarArrowFunction(node, file); } function checkGrammarArrowFunction(node, file) { - if (node.kind === 174) { + if (node.kind === 180) { var arrowFunction = node; var startLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.pos).line; var endLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.end).line; @@ -22778,7 +25966,7 @@ var ts; if (parameter.dotDotDotToken) { return grammarErrorOnNode(parameter.dotDotDotToken, ts.Diagnostics.An_index_signature_cannot_have_a_rest_parameter); } - if (parameter.flags & 1022) { + if (parameter.flags & 1023) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_cannot_have_an_accessibility_modifier); } if (parameter.questionToken) { @@ -22790,20 +25978,15 @@ var ts; if (!parameter.type) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_must_have_a_type_annotation); } - if (parameter.type.kind !== 130 && parameter.type.kind !== 128) { + if (parameter.type.kind !== 132 && parameter.type.kind !== 130) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_must_be_string_or_number); } if (!node.type) { return grammarErrorOnNode(node, ts.Diagnostics.An_index_signature_must_have_a_type_annotation); } } - function checkGrammarForIndexSignatureModifier(node) { - if (node.flags & 1022) { - grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_not_permitted_on_index_signature_members); - } - } function checkGrammarIndexSignature(node) { - return checkGrammarDecorators(node) || checkGrammarModifiers(node) || checkGrammarIndexSignatureParameters(node) || checkGrammarForIndexSignatureModifier(node); + return checkGrammarDecorators(node) || checkGrammarModifiers(node) || checkGrammarIndexSignatureParameters(node); } function checkGrammarForAtLeastOneTypeArgument(node, typeArguments) { if (typeArguments && typeArguments.length === 0) { @@ -22822,7 +26005,7 @@ var ts; var sourceFile = ts.getSourceFileOfNode(node); for (var _i = 0, args_1 = args; _i < args_1.length; _i++) { var arg = args_1[_i]; - if (arg.kind === 187) { + if (arg.kind === 193) { return grammarErrorAtPos(sourceFile, arg.pos, 0, ts.Diagnostics.Argument_expression_expected); } } @@ -22893,19 +26076,19 @@ var ts; return false; } function checkGrammarComputedPropertyName(node) { - if (node.kind !== 136) { + if (node.kind !== 140) { return false; } var computedPropertyName = node; - if (computedPropertyName.expression.kind === 181 && computedPropertyName.expression.operatorToken.kind === 24) { + if (computedPropertyName.expression.kind === 187 && computedPropertyName.expression.operatorToken.kind === 24) { return grammarErrorOnNode(computedPropertyName.expression, ts.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name); } } function checkGrammarForGenerator(node) { if (node.asteriskToken) { - ts.Debug.assert(node.kind === 213 || - node.kind === 173 || - node.kind === 143); + ts.Debug.assert(node.kind === 220 || + node.kind === 179 || + node.kind === 147); if (ts.isInAmbientContext(node)) { return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_not_allowed_in_an_ambient_context); } @@ -22926,78 +26109,87 @@ var ts; var seen = {}; var Property = 1; var GetAccessor = 2; - var SetAccesor = 4; - var GetOrSetAccessor = GetAccessor | SetAccesor; - for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { - var prop = _a[_i]; - var name_16 = prop.name; - if (prop.kind === 187 || - name_16.kind === 136) { - checkGrammarComputedPropertyName(name_16); - continue; + var SetAccessor = 4; + var GetOrSetAccessor = GetAccessor | SetAccessor; + var _loop_1 = function(prop) { + var name_20 = prop.name; + if (prop.kind === 193 || + name_20.kind === 140) { + checkGrammarComputedPropertyName(name_20); + return "continue"; } - if (prop.kind === 246 && !inDestructuring && prop.objectAssignmentInitializer) { - return grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment); + if (prop.kind === 254 && !inDestructuring && prop.objectAssignmentInitializer) { + return { value: grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment) }; } + ts.forEach(prop.modifiers, function (mod) { + if (mod.kind !== 118 || prop.kind !== 147) { + grammarErrorOnNode(mod, ts.Diagnostics._0_modifier_cannot_be_used_here, ts.getTextOfNode(mod)); + } + }); var currentKind = void 0; - if (prop.kind === 245 || prop.kind === 246) { + if (prop.kind === 253 || prop.kind === 254) { checkGrammarForInvalidQuestionMark(prop, prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); - if (name_16.kind === 8) { - checkGrammarNumericLiteral(name_16); + if (name_20.kind === 8) { + checkGrammarNumericLiteral(name_20); } currentKind = Property; } - else if (prop.kind === 143) { + else if (prop.kind === 147) { currentKind = Property; } - else if (prop.kind === 145) { + else if (prop.kind === 149) { currentKind = GetAccessor; } - else if (prop.kind === 146) { - currentKind = SetAccesor; + else if (prop.kind === 150) { + currentKind = SetAccessor; } else { ts.Debug.fail("Unexpected syntax kind:" + prop.kind); } - if (!ts.hasProperty(seen, name_16.text)) { - seen[name_16.text] = currentKind; + if (!ts.hasProperty(seen, name_20.text)) { + seen[name_20.text] = currentKind; } else { - var existingKind = seen[name_16.text]; + var existingKind = seen[name_20.text]; if (currentKind === Property && existingKind === Property) { - continue; + return "continue"; } else if ((currentKind & GetOrSetAccessor) && (existingKind & GetOrSetAccessor)) { if (existingKind !== GetOrSetAccessor && currentKind !== existingKind) { - seen[name_16.text] = currentKind | existingKind; + seen[name_20.text] = currentKind | existingKind; } else { - return grammarErrorOnNode(name_16, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name); + return { value: grammarErrorOnNode(name_20, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name) }; } } else { - return grammarErrorOnNode(name_16, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name); + return { value: grammarErrorOnNode(name_20, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name) }; } } + }; + for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { + var prop = _a[_i]; + var state_2 = _loop_1(prop); + if (typeof state_2 === "object") return state_2.value; } } function checkGrammarJsxElement(node) { var seen = {}; for (var _i = 0, _a = node.attributes; _i < _a.length; _i++) { var attr = _a[_i]; - if (attr.kind === 239) { + if (attr.kind === 247) { continue; } var jsxAttr = attr; - var name_17 = jsxAttr.name; - if (!ts.hasProperty(seen, name_17.text)) { - seen[name_17.text] = true; + var name_21 = jsxAttr.name; + if (!ts.hasProperty(seen, name_21.text)) { + seen[name_21.text] = true; } else { - return grammarErrorOnNode(name_17, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); + return grammarErrorOnNode(name_21, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); } var initializer = jsxAttr.initializer; - if (initializer && initializer.kind === 240 && !initializer.expression) { + if (initializer && initializer.kind === 248 && !initializer.expression) { return grammarErrorOnNode(jsxAttr.initializer, ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression); } } @@ -23006,24 +26198,28 @@ var ts; if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { return true; } - if (forInOrOfStatement.initializer.kind === 212) { + if (forInOrOfStatement.initializer.kind === 219) { var variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { - if (variableList.declarations.length > 1) { - var diagnostic = forInOrOfStatement.kind === 200 + var declarations = variableList.declarations; + if (!declarations.length) { + return false; + } + if (declarations.length > 1) { + var diagnostic = forInOrOfStatement.kind === 207 ? ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement : ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement; return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic); } - var firstDeclaration = variableList.declarations[0]; + var firstDeclaration = declarations[0]; if (firstDeclaration.initializer) { - var diagnostic = forInOrOfStatement.kind === 200 + var diagnostic = forInOrOfStatement.kind === 207 ? ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer : ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; return grammarErrorOnNode(firstDeclaration.name, diagnostic); } if (firstDeclaration.type) { - var diagnostic = forInOrOfStatement.kind === 200 + var diagnostic = forInOrOfStatement.kind === 207 ? ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation : ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation; return grammarErrorOnNode(firstDeclaration, diagnostic); @@ -23040,30 +26236,26 @@ var ts; else if (ts.isInAmbientContext(accessor)) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_be_declared_in_an_ambient_context); } - else if (accessor.body === undefined) { + else if (accessor.body === undefined && !(accessor.flags & 128)) { return grammarErrorAtPos(ts.getSourceFileOfNode(accessor), accessor.end - 1, ";".length, ts.Diagnostics._0_expected, "{"); } else if (accessor.typeParameters) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters); } - else if (kind === 145 && accessor.parameters.length) { - return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_get_accessor_cannot_have_parameters); + else if (!doesAccessorHaveCorrectParameterCount(accessor)) { + return grammarErrorOnNode(accessor.name, kind === 149 ? + ts.Diagnostics.A_get_accessor_cannot_have_parameters : + ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter); } - else if (kind === 146) { + else if (kind === 150) { if (accessor.type) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation); } - else if (accessor.parameters.length !== 1) { - return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter); - } else { var parameter = accessor.parameters[0]; if (parameter.dotDotDotToken) { return grammarErrorOnNode(parameter.dotDotDotToken, ts.Diagnostics.A_set_accessor_cannot_have_rest_parameter); } - else if (parameter.flags & 1022) { - return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); - } else if (parameter.questionToken) { return grammarErrorOnNode(parameter.questionToken, ts.Diagnostics.A_set_accessor_cannot_have_an_optional_parameter); } @@ -23073,6 +26265,16 @@ var ts; } } } + function doesAccessorHaveCorrectParameterCount(accessor) { + return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 149 ? 0 : 1); + } + function getAccessorThisParameter(accessor) { + if (accessor.parameters.length === (accessor.kind === 149 ? 1 : 2) && + accessor.parameters[0].name.kind === 69 && + accessor.parameters[0].name.originalKeywordKind === 97) { + return accessor.parameters[0]; + } + } function checkGrammarForNonSymbolComputedProperty(node, message) { if (ts.isDynamicName(node)) { return grammarErrorOnNode(node, message); @@ -23084,18 +26286,15 @@ var ts; checkGrammarForGenerator(node)) { return true; } - if (node.parent.kind === 165) { - if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional)) { + if (node.parent.kind === 171) { + if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional)) { return true; } else if (node.body === undefined) { - return grammarErrorAtPos(getSourceFile(node), node.end - 1, ";".length, ts.Diagnostics._0_expected, "{"); + return grammarErrorAtPos(ts.getSourceFileOfNode(node), node.end - 1, ";".length, ts.Diagnostics._0_expected, "{"); } } if (ts.isClassLike(node.parent)) { - if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional)) { - return true; - } if (ts.isInAmbientContext(node)) { return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_symbol); } @@ -23103,10 +26302,10 @@ var ts; return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol); } } - else if (node.parent.kind === 215) { + else if (node.parent.kind === 222) { return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol); } - else if (node.parent.kind === 155) { + else if (node.parent.kind === 159) { return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol); } } @@ -23117,9 +26316,9 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); } switch (current.kind) { - case 207: + case 214: if (node.label && current.label.text === node.label.text) { - var isMisplacedContinueLabel = node.kind === 202 + var isMisplacedContinueLabel = node.kind === 209 && !ts.isIterationStatement(current.statement, true); if (isMisplacedContinueLabel) { return grammarErrorOnNode(node, ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement); @@ -23127,8 +26326,8 @@ var ts; return false; } break; - case 206: - if (node.kind === 203 && !node.label) { + case 213: + if (node.kind === 210 && !node.label) { return false; } break; @@ -23141,13 +26340,13 @@ var ts; current = current.parent; } if (node.label) { - var message = node.kind === 203 + var message = node.kind === 210 ? ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement : ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); } else { - var message = node.kind === 203 + var message = node.kind === 210 ? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement : ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); @@ -23159,7 +26358,7 @@ var ts; if (node !== ts.lastOrUndefined(elements)) { return grammarErrorOnNode(node, ts.Diagnostics.A_rest_element_must_be_last_in_an_array_destructuring_pattern); } - if (node.name.kind === 162 || node.name.kind === 161) { + if (node.name.kind === 168 || node.name.kind === 167) { return grammarErrorOnNode(node.name, ts.Diagnostics.A_rest_element_cannot_contain_a_binding_pattern); } if (node.initializer) { @@ -23168,7 +26367,7 @@ var ts; } } function checkGrammarVariableDeclaration(node) { - if (node.parent.parent.kind !== 200 && node.parent.parent.kind !== 201) { + if (node.parent.parent.kind !== 207 && node.parent.parent.kind !== 208) { if (ts.isInAmbientContext(node)) { if (node.initializer) { var equalsTokenLength = "=".length; @@ -23184,12 +26383,12 @@ var ts; } } } - var checkLetConstNames = languageVersion >= 2 && (ts.isLet(node) || ts.isConst(node)); + var checkLetConstNames = (ts.isLet(node) || ts.isConst(node)); return checkLetConstNames && checkGrammarNameInLetOrConstDeclarations(node.name); } function checkGrammarNameInLetOrConstDeclarations(name) { if (name.kind === 69) { - if (name.text === "let") { + if (name.originalKeywordKind === 108) { return grammarErrorOnNode(name, ts.Diagnostics.let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations); } } @@ -23197,7 +26396,7 @@ var ts; var elements = name.elements; for (var _i = 0, elements_2 = elements; _i < elements_2.length; _i++) { var element = elements_2[_i]; - if (element.kind !== 187) { + if (element.kind !== 193) { checkGrammarNameInLetOrConstDeclarations(element.name); } } @@ -23214,15 +26413,15 @@ var ts; } function allowLetAndConstDeclarations(parent) { switch (parent.kind) { - case 196: - case 197: - case 198: + case 203: + case 204: case 205: - case 199: - case 200: - case 201: - return false; + case 212: + case 206: case 207: + case 208: + return false; + case 214: return allowLetAndConstDeclarations(parent.parent); } return true; @@ -23237,18 +26436,6 @@ var ts; } } } - function isIntegerLiteral(expression) { - if (expression.kind === 179) { - var unaryExpression = expression; - if (unaryExpression.operator === 35 || unaryExpression.operator === 36) { - expression = unaryExpression.operand; - } - } - if (expression.kind === 8) { - return /^[0-9]+([eE]\+?[0-9]+)?$/.test(expression.text); - } - return false; - } function hasParseDiagnostics(sourceFile) { return sourceFile.parseDiagnostics.length > 0; } @@ -23273,10 +26460,6 @@ var ts; return true; } } - function isEvalOrArgumentsIdentifier(node) { - return node.kind === 69 && - (node.text === "eval" || node.text === "arguments"); - } function checkGrammarConstructorTypeParameters(node) { if (node.typeParameters) { return grammarErrorAtPos(ts.getSourceFileOfNode(node), node.typeParameters.pos, node.typeParameters.end - node.typeParameters.pos, ts.Diagnostics.Type_parameters_cannot_appear_on_a_constructor_declaration); @@ -23289,34 +26472,39 @@ var ts; } function checkGrammarProperty(node) { if (ts.isClassLike(node.parent)) { - if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional) || - checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol)) { + if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol)) { return true; } } - else if (node.parent.kind === 215) { + else if (node.parent.kind === 222) { if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol)) { return true; } + if (node.initializer) { + return grammarErrorOnNode(node.initializer, ts.Diagnostics.An_interface_property_cannot_have_an_initializer); + } } - else if (node.parent.kind === 155) { + else if (node.parent.kind === 159) { if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol)) { return true; } + if (node.initializer) { + return grammarErrorOnNode(node.initializer, ts.Diagnostics.A_type_literal_property_cannot_have_an_initializer); + } } if (ts.isInAmbientContext(node) && node.initializer) { return grammarErrorOnFirstToken(node.initializer, ts.Diagnostics.Initializers_are_not_allowed_in_ambient_contexts); } } function checkGrammarTopLevelElementForRequiredDeclareModifier(node) { - if (node.kind === 215 || - node.kind === 216 || - node.kind === 222 || - node.kind === 221 || - node.kind === 228 || - node.kind === 227 || - (node.flags & 4) || - (node.flags & (2 | 512))) { + if (node.kind === 222 || + node.kind === 223 || + node.kind === 230 || + node.kind === 229 || + node.kind === 236 || + node.kind === 235 || + (node.flags & 2) || + (node.flags & (1 | 512))) { return false; } return grammarErrorOnFirstToken(node, ts.Diagnostics.A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file); @@ -23324,7 +26512,7 @@ var ts; function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) { for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { var decl = _a[_i]; - if (ts.isDeclaration(decl) || decl.kind === 193) { + if (ts.isDeclaration(decl) || decl.kind === 200) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { return true; } @@ -23343,7 +26531,7 @@ var ts; if (!links.hasReportedStatementInAmbientContext && ts.isFunctionLike(node.parent)) { return getNodeLinks(node).hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts); } - if (node.parent.kind === 192 || node.parent.kind === 219 || node.parent.kind === 248) { + if (node.parent.kind === 199 || node.parent.kind === 226 || node.parent.kind === 256) { var links_1 = getNodeLinks(node.parent); if (!links_1.hasReportedStatementInAmbientContext) { return links_1.hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.Statements_are_not_allowed_in_ambient_contexts); @@ -23354,7 +26542,7 @@ var ts; } } function checkGrammarNumericLiteral(node) { - if (node.flags & 32768 && languageVersion >= 1) { + if (node.isOctalLiteral && languageVersion >= 1) { return grammarErrorOnNode(node, ts.Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher); } } @@ -23366,19 +26554,287 @@ var ts; return true; } } + var _a; } ts.createTypeChecker = createTypeChecker; })(ts || (ts = {})); var ts; +(function (ts) { + var nullSourceMapWriter; + var defaultLastEncodedSourceMapSpan = { + emittedLine: 1, + emittedColumn: 1, + sourceLine: 1, + sourceColumn: 1, + sourceIndex: 0 + }; + function getNullSourceMapWriter() { + if (nullSourceMapWriter === undefined) { + nullSourceMapWriter = { + getSourceMapData: function () { return undefined; }, + setSourceFile: function (sourceFile) { }, + emitStart: function (range) { }, + emitEnd: function (range, stopOverridingSpan) { }, + emitPos: function (pos) { }, + changeEmitSourcePos: function () { }, + getText: function () { return undefined; }, + getSourceMappingURL: function () { return undefined; }, + initialize: function (filePath, sourceMapFilePath, sourceFiles, isBundledEmit) { }, + reset: function () { } + }; + } + return nullSourceMapWriter; + } + ts.getNullSourceMapWriter = getNullSourceMapWriter; + function createSourceMapWriter(host, writer) { + var compilerOptions = host.getCompilerOptions(); + var currentSourceFile; + var sourceMapDir; + var stopOverridingSpan = false; + var modifyLastSourcePos = false; + var sourceMapSourceIndex; + var lastRecordedSourceMapSpan; + var lastEncodedSourceMapSpan; + var lastEncodedNameIndex; + var sourceMapData; + return { + getSourceMapData: function () { return sourceMapData; }, + setSourceFile: setSourceFile, + emitPos: emitPos, + emitStart: emitStart, + emitEnd: emitEnd, + changeEmitSourcePos: changeEmitSourcePos, + getText: getText, + getSourceMappingURL: getSourceMappingURL, + initialize: initialize, + reset: reset + }; + function initialize(filePath, sourceMapFilePath, sourceFiles, isBundledEmit) { + if (sourceMapData) { + reset(); + } + currentSourceFile = undefined; + sourceMapSourceIndex = -1; + lastRecordedSourceMapSpan = undefined; + lastEncodedSourceMapSpan = defaultLastEncodedSourceMapSpan; + lastEncodedNameIndex = 0; + sourceMapData = { + sourceMapFilePath: sourceMapFilePath, + jsSourceMappingURL: !compilerOptions.inlineSourceMap ? ts.getBaseFileName(ts.normalizeSlashes(sourceMapFilePath)) : undefined, + sourceMapFile: ts.getBaseFileName(ts.normalizeSlashes(filePath)), + sourceMapSourceRoot: compilerOptions.sourceRoot || "", + sourceMapSources: [], + inputSourceFileNames: [], + sourceMapNames: [], + sourceMapMappings: "", + sourceMapSourcesContent: compilerOptions.inlineSources ? [] : undefined, + sourceMapDecodedMappings: [] + }; + sourceMapData.sourceMapSourceRoot = ts.normalizeSlashes(sourceMapData.sourceMapSourceRoot); + if (sourceMapData.sourceMapSourceRoot.length && sourceMapData.sourceMapSourceRoot.charCodeAt(sourceMapData.sourceMapSourceRoot.length - 1) !== 47) { + sourceMapData.sourceMapSourceRoot += ts.directorySeparator; + } + if (compilerOptions.mapRoot) { + sourceMapDir = ts.normalizeSlashes(compilerOptions.mapRoot); + if (!isBundledEmit) { + ts.Debug.assert(sourceFiles.length === 1); + sourceMapDir = ts.getDirectoryPath(ts.getSourceFilePathInNewDir(sourceFiles[0], host, sourceMapDir)); + } + if (!ts.isRootedDiskPath(sourceMapDir) && !ts.isUrl(sourceMapDir)) { + sourceMapDir = ts.combinePaths(host.getCommonSourceDirectory(), sourceMapDir); + sourceMapData.jsSourceMappingURL = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizePath(filePath)), ts.combinePaths(sourceMapDir, sourceMapData.jsSourceMappingURL), host.getCurrentDirectory(), host.getCanonicalFileName, true); + } + else { + sourceMapData.jsSourceMappingURL = ts.combinePaths(sourceMapDir, sourceMapData.jsSourceMappingURL); + } + } + else { + sourceMapDir = ts.getDirectoryPath(ts.normalizePath(filePath)); + } + } + function reset() { + currentSourceFile = undefined; + sourceMapDir = undefined; + sourceMapSourceIndex = undefined; + lastRecordedSourceMapSpan = undefined; + lastEncodedSourceMapSpan = undefined; + lastEncodedNameIndex = undefined; + sourceMapData = undefined; + } + function updateLastEncodedAndRecordedSpans() { + if (modifyLastSourcePos) { + modifyLastSourcePos = false; + lastRecordedSourceMapSpan.emittedLine = lastEncodedSourceMapSpan.emittedLine; + lastRecordedSourceMapSpan.emittedColumn = lastEncodedSourceMapSpan.emittedColumn; + sourceMapData.sourceMapDecodedMappings.pop(); + lastEncodedSourceMapSpan = sourceMapData.sourceMapDecodedMappings.length ? + sourceMapData.sourceMapDecodedMappings[sourceMapData.sourceMapDecodedMappings.length - 1] : + defaultLastEncodedSourceMapSpan; + var sourceMapMappings = sourceMapData.sourceMapMappings; + var lenthToSet = sourceMapMappings.length - 1; + for (; lenthToSet >= 0; lenthToSet--) { + var currentChar = sourceMapMappings.charAt(lenthToSet); + if (currentChar === ",") { + break; + } + if (currentChar === ";" && lenthToSet !== 0 && sourceMapMappings.charAt(lenthToSet - 1) !== ";") { + break; + } + } + sourceMapData.sourceMapMappings = sourceMapMappings.substr(0, Math.max(0, lenthToSet)); + } + } + function encodeLastRecordedSourceMapSpan() { + if (!lastRecordedSourceMapSpan || lastRecordedSourceMapSpan === lastEncodedSourceMapSpan) { + return; + } + var prevEncodedEmittedColumn = lastEncodedSourceMapSpan.emittedColumn; + if (lastEncodedSourceMapSpan.emittedLine === lastRecordedSourceMapSpan.emittedLine) { + if (sourceMapData.sourceMapMappings) { + sourceMapData.sourceMapMappings += ","; + } + } + else { + for (var encodedLine = lastEncodedSourceMapSpan.emittedLine; encodedLine < lastRecordedSourceMapSpan.emittedLine; encodedLine++) { + sourceMapData.sourceMapMappings += ";"; + } + prevEncodedEmittedColumn = 1; + } + sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.emittedColumn - prevEncodedEmittedColumn); + sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceIndex - lastEncodedSourceMapSpan.sourceIndex); + sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceLine - lastEncodedSourceMapSpan.sourceLine); + sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceColumn - lastEncodedSourceMapSpan.sourceColumn); + if (lastRecordedSourceMapSpan.nameIndex >= 0) { + ts.Debug.assert(false, "We do not support name index right now, Make sure to update updateLastEncodedAndRecordedSpans when we start using this"); + sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.nameIndex - lastEncodedNameIndex); + lastEncodedNameIndex = lastRecordedSourceMapSpan.nameIndex; + } + lastEncodedSourceMapSpan = lastRecordedSourceMapSpan; + sourceMapData.sourceMapDecodedMappings.push(lastEncodedSourceMapSpan); + } + function emitPos(pos) { + if (pos === -1) { + return; + } + var sourceLinePos = ts.getLineAndCharacterOfPosition(currentSourceFile, pos); + sourceLinePos.line++; + sourceLinePos.character++; + var emittedLine = writer.getLine(); + var emittedColumn = writer.getColumn(); + if (!lastRecordedSourceMapSpan || + lastRecordedSourceMapSpan.emittedLine !== emittedLine || + lastRecordedSourceMapSpan.emittedColumn !== emittedColumn || + (lastRecordedSourceMapSpan.sourceIndex === sourceMapSourceIndex && + (lastRecordedSourceMapSpan.sourceLine > sourceLinePos.line || + (lastRecordedSourceMapSpan.sourceLine === sourceLinePos.line && lastRecordedSourceMapSpan.sourceColumn > sourceLinePos.character)))) { + encodeLastRecordedSourceMapSpan(); + lastRecordedSourceMapSpan = { + emittedLine: emittedLine, + emittedColumn: emittedColumn, + sourceLine: sourceLinePos.line, + sourceColumn: sourceLinePos.character, + sourceIndex: sourceMapSourceIndex + }; + stopOverridingSpan = false; + } + else if (!stopOverridingSpan) { + lastRecordedSourceMapSpan.sourceLine = sourceLinePos.line; + lastRecordedSourceMapSpan.sourceColumn = sourceLinePos.character; + lastRecordedSourceMapSpan.sourceIndex = sourceMapSourceIndex; + } + updateLastEncodedAndRecordedSpans(); + } + function getStartPos(range) { + var rangeHasDecorators = !!range.decorators; + return range.pos !== -1 ? ts.skipTrivia(currentSourceFile.text, rangeHasDecorators ? range.decorators.end : range.pos) : -1; + } + function emitStart(range) { + emitPos(getStartPos(range)); + } + function emitEnd(range, stopOverridingEnd) { + emitPos(range.end); + stopOverridingSpan = stopOverridingEnd; + } + function changeEmitSourcePos() { + ts.Debug.assert(!modifyLastSourcePos); + modifyLastSourcePos = true; + } + function setSourceFile(sourceFile) { + currentSourceFile = sourceFile; + var sourcesDirectoryPath = compilerOptions.sourceRoot ? host.getCommonSourceDirectory() : sourceMapDir; + var source = ts.getRelativePathToDirectoryOrUrl(sourcesDirectoryPath, currentSourceFile.fileName, host.getCurrentDirectory(), host.getCanonicalFileName, true); + sourceMapSourceIndex = ts.indexOf(sourceMapData.sourceMapSources, source); + if (sourceMapSourceIndex === -1) { + sourceMapSourceIndex = sourceMapData.sourceMapSources.length; + sourceMapData.sourceMapSources.push(source); + sourceMapData.inputSourceFileNames.push(sourceFile.fileName); + if (compilerOptions.inlineSources) { + sourceMapData.sourceMapSourcesContent.push(sourceFile.text); + } + } + } + function getText() { + encodeLastRecordedSourceMapSpan(); + return ts.stringify({ + version: 3, + file: sourceMapData.sourceMapFile, + sourceRoot: sourceMapData.sourceMapSourceRoot, + sources: sourceMapData.sourceMapSources, + names: sourceMapData.sourceMapNames, + mappings: sourceMapData.sourceMapMappings, + sourcesContent: sourceMapData.sourceMapSourcesContent + }); + } + function getSourceMappingURL() { + if (compilerOptions.inlineSourceMap) { + var base64SourceMapText = ts.convertToBase64(getText()); + return sourceMapData.jsSourceMappingURL = "data:application/json;base64," + base64SourceMapText; + } + else { + return sourceMapData.jsSourceMappingURL; + } + } + } + ts.createSourceMapWriter = createSourceMapWriter; + var base64Chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + function base64FormatEncode(inValue) { + if (inValue < 64) { + return base64Chars.charAt(inValue); + } + throw TypeError(inValue + ": not a 64 based value"); + } + function base64VLQFormatEncode(inValue) { + if (inValue < 0) { + inValue = ((-inValue) << 1) + 1; + } + else { + inValue = inValue << 1; + } + var encodedStr = ""; + do { + var currentDigit = inValue & 31; + inValue = inValue >> 5; + if (inValue > 0) { + currentDigit = currentDigit | 32; + } + encodedStr = encodedStr + base64FormatEncode(currentDigit); + } while (inValue > 0); + return encodedStr; + } +})(ts || (ts = {})); +var ts; (function (ts) { function getDeclarationDiagnostics(host, resolver, targetSourceFile) { - var diagnostics = []; - var jsFilePath = ts.getOwnEmitOutputFilePath(targetSourceFile, host, ".js"); - emitDeclarations(host, resolver, diagnostics, jsFilePath, targetSourceFile); - return diagnostics; + var declarationDiagnostics = ts.createDiagnosticCollection(); + ts.forEachExpectedEmitFile(host, getDeclarationDiagnosticsFromFile, targetSourceFile); + return declarationDiagnostics.getDiagnostics(targetSourceFile ? targetSourceFile.fileName : undefined); + function getDeclarationDiagnosticsFromFile(_a, sources, isBundledEmit) { + var declarationFilePath = _a.declarationFilePath; + emitDeclarations(host, resolver, declarationDiagnostics, declarationFilePath, sources, isBundledEmit); + } } ts.getDeclarationDiagnostics = getDeclarationDiagnostics; - function emitDeclarations(host, resolver, diagnostics, jsFilePath, root) { + function emitDeclarations(host, resolver, emitterDiagnostics, declarationFilePath, sourceFiles, isBundledEmit) { var newLine = host.getNewLine(); var compilerOptions = host.getCompilerOptions(); var write; @@ -23386,8 +26842,10 @@ var ts; var increaseIndent; var decreaseIndent; var writeTextOfNode; - var writer = createAndSetNewTextWriterWithSymbolWriter(); + var writer; + createAndSetNewTextWriterWithSymbolWriter(); var enclosingDeclaration; + var resultHasExternalModuleIndicator; var currentText; var currentLineMap; var currentIdentifiers; @@ -23396,95 +26854,82 @@ var ts; var errorNameNode; var emitJsDocComments = compilerOptions.removeComments ? function (declaration) { } : writeJsDocComments; var emit = compilerOptions.stripInternal ? stripInternal : emitNode; - var noDeclare = !root; + var noDeclare; var moduleElementDeclarationEmitInfo = []; var asynchronousSubModuleDeclarationEmitInfo; - var referencePathsOutput = ""; - if (root) { + var referencesOutput = ""; + var usedTypeDirectiveReferences; + var emittedReferencedFiles = []; + var addedGlobalFileReference = false; + var allSourcesModuleElementDeclarationEmitInfo = []; + ts.forEach(sourceFiles, function (sourceFile) { + if (ts.isSourceFileJavaScript(sourceFile)) { + return; + } if (!compilerOptions.noResolve) { - var addedGlobalFileReference = false; - ts.forEach(root.referencedFiles, function (fileReference) { - var referencedFile = ts.tryResolveScriptReference(host, root, fileReference); - if (referencedFile && ((referencedFile.flags & 4096) || - ts.shouldEmitToOwnFile(referencedFile, compilerOptions) || - !addedGlobalFileReference)) { - writeReferencePath(referencedFile); - if (!ts.isExternalModuleOrDeclarationFile(referencedFile)) { + ts.forEach(sourceFile.referencedFiles, function (fileReference) { + var referencedFile = ts.tryResolveScriptReference(host, sourceFile, fileReference); + if (referencedFile && !ts.contains(emittedReferencedFiles, referencedFile)) { + if (writeReferencePath(referencedFile, !isBundledEmit && !addedGlobalFileReference)) { addedGlobalFileReference = true; } + emittedReferencedFiles.push(referencedFile); } }); } - emitSourceFile(root); + resultHasExternalModuleIndicator = false; + if (!isBundledEmit || !ts.isExternalModule(sourceFile)) { + noDeclare = false; + emitSourceFile(sourceFile); + } + else if (ts.isExternalModule(sourceFile)) { + noDeclare = true; + write("declare module \"" + ts.getResolvedExternalModuleName(host, sourceFile) + "\" {"); + writeLine(); + increaseIndent(); + emitSourceFile(sourceFile); + decreaseIndent(); + write("}"); + writeLine(); + } if (moduleElementDeclarationEmitInfo.length) { var oldWriter = writer; ts.forEach(moduleElementDeclarationEmitInfo, function (aliasEmitInfo) { - if (aliasEmitInfo.isVisible) { - ts.Debug.assert(aliasEmitInfo.node.kind === 222); + if (aliasEmitInfo.isVisible && !aliasEmitInfo.asynchronousOutput) { + ts.Debug.assert(aliasEmitInfo.node.kind === 230); createAndSetNewTextWriterWithSymbolWriter(); - ts.Debug.assert(aliasEmitInfo.indent === 0); + ts.Debug.assert(aliasEmitInfo.indent === 0 || (aliasEmitInfo.indent === 1 && isBundledEmit)); + for (var i = 0; i < aliasEmitInfo.indent; i++) { + increaseIndent(); + } writeImportDeclaration(aliasEmitInfo.node); aliasEmitInfo.asynchronousOutput = writer.getText(); + for (var i = 0; i < aliasEmitInfo.indent; i++) { + decreaseIndent(); + } } }); setWriter(oldWriter); + allSourcesModuleElementDeclarationEmitInfo = allSourcesModuleElementDeclarationEmitInfo.concat(moduleElementDeclarationEmitInfo); + moduleElementDeclarationEmitInfo = []; } - } - else { - var emittedReferencedFiles = []; - var prevModuleElementDeclarationEmitInfo = []; - ts.forEach(host.getSourceFiles(), function (sourceFile) { - if (!ts.isDeclarationFile(sourceFile)) { - if (!compilerOptions.noResolve) { - ts.forEach(sourceFile.referencedFiles, function (fileReference) { - var referencedFile = ts.tryResolveScriptReference(host, sourceFile, fileReference); - if (referencedFile && (ts.isDeclarationFile(referencedFile) && - !ts.contains(emittedReferencedFiles, referencedFile))) { - writeReferencePath(referencedFile); - emittedReferencedFiles.push(referencedFile); - } - }); - } + if (!isBundledEmit && ts.isExternalModule(sourceFile) && sourceFile.moduleAugmentations.length && !resultHasExternalModuleIndicator) { + write("export {};"); + writeLine(); + } + }); + if (usedTypeDirectiveReferences) { + for (var directive in usedTypeDirectiveReferences) { + if (ts.hasProperty(usedTypeDirectiveReferences, directive)) { + referencesOutput += "/// " + newLine; } - if (!ts.isExternalModuleOrDeclarationFile(sourceFile)) { - noDeclare = false; - emitSourceFile(sourceFile); - } - else if (ts.isExternalModule(sourceFile)) { - noDeclare = true; - write("declare module \"" + ts.getResolvedExternalModuleName(host, sourceFile) + "\" {"); - writeLine(); - increaseIndent(); - emitSourceFile(sourceFile); - decreaseIndent(); - write("}"); - writeLine(); - if (moduleElementDeclarationEmitInfo.length) { - var oldWriter = writer; - ts.forEach(moduleElementDeclarationEmitInfo, function (aliasEmitInfo) { - if (aliasEmitInfo.isVisible && !aliasEmitInfo.asynchronousOutput) { - ts.Debug.assert(aliasEmitInfo.node.kind === 222); - createAndSetNewTextWriterWithSymbolWriter(); - ts.Debug.assert(aliasEmitInfo.indent === 1); - increaseIndent(); - writeImportDeclaration(aliasEmitInfo.node); - aliasEmitInfo.asynchronousOutput = writer.getText(); - decreaseIndent(); - } - }); - setWriter(oldWriter); - } - prevModuleElementDeclarationEmitInfo = prevModuleElementDeclarationEmitInfo.concat(moduleElementDeclarationEmitInfo); - moduleElementDeclarationEmitInfo = []; - } - }); - moduleElementDeclarationEmitInfo = moduleElementDeclarationEmitInfo.concat(prevModuleElementDeclarationEmitInfo); + } } return { reportedDeclarationError: reportedDeclarationError, - moduleElementDeclarationEmitInfo: moduleElementDeclarationEmitInfo, + moduleElementDeclarationEmitInfo: allSourcesModuleElementDeclarationEmitInfo, synchronousDeclarationOutput: writer.getText(), - referencePathsOutput: referencePathsOutput + referencesOutput: referencesOutput }; function hasInternalAnnotation(range) { var comment = currentText.substring(range.pos, range.end); @@ -23511,7 +26956,6 @@ var ts; writer.writeParameter = writer.write; writer.writeSymbol = writer.write; setWriter(writer); - return writer; } function setWriter(newWriter) { writer = newWriter; @@ -23525,10 +26969,10 @@ var ts; var oldWriter = writer; ts.forEach(nodes, function (declaration) { var nodeToCheck; - if (declaration.kind === 211) { + if (declaration.kind === 218) { nodeToCheck = declaration.parent.parent; } - else if (declaration.kind === 225 || declaration.kind === 226 || declaration.kind === 223) { + else if (declaration.kind === 233 || declaration.kind === 234 || declaration.kind === 231) { ts.Debug.fail("We should be getting ImportDeclaration instead to write"); } else { @@ -23539,7 +26983,7 @@ var ts; moduleElementEmitInfo = ts.forEach(asynchronousSubModuleDeclarationEmitInfo, function (declEmitInfo) { return declEmitInfo.node === nodeToCheck ? declEmitInfo : undefined; }); } if (moduleElementEmitInfo) { - if (moduleElementEmitInfo.node.kind === 222) { + if (moduleElementEmitInfo.node.kind === 230) { moduleElementEmitInfo.isVisible = true; } else { @@ -23547,12 +26991,12 @@ var ts; for (var declarationIndent = moduleElementEmitInfo.indent; declarationIndent; declarationIndent--) { increaseIndent(); } - if (nodeToCheck.kind === 218) { + if (nodeToCheck.kind === 225) { ts.Debug.assert(asynchronousSubModuleDeclarationEmitInfo === undefined); asynchronousSubModuleDeclarationEmitInfo = []; } writeModuleElement(nodeToCheck); - if (nodeToCheck.kind === 218) { + if (nodeToCheck.kind === 225) { moduleElementEmitInfo.subModuleElementDeclarationEmitInfo = asynchronousSubModuleDeclarationEmitInfo; asynchronousSubModuleDeclarationEmitInfo = undefined; } @@ -23562,31 +27006,47 @@ var ts; }); setWriter(oldWriter); } - function handleSymbolAccessibilityError(symbolAccesibilityResult) { - if (symbolAccesibilityResult.accessibility === 0) { - if (symbolAccesibilityResult && symbolAccesibilityResult.aliasesToMakeVisible) { - writeAsynchronousModuleElements(symbolAccesibilityResult.aliasesToMakeVisible); + function recordTypeReferenceDirectivesIfNecessary(typeReferenceDirectives) { + if (!typeReferenceDirectives) { + return; + } + if (!usedTypeDirectiveReferences) { + usedTypeDirectiveReferences = {}; + } + for (var _i = 0, typeReferenceDirectives_1 = typeReferenceDirectives; _i < typeReferenceDirectives_1.length; _i++) { + var directive = typeReferenceDirectives_1[_i]; + if (!ts.hasProperty(usedTypeDirectiveReferences, directive)) { + usedTypeDirectiveReferences[directive] = directive; + } + } + } + function handleSymbolAccessibilityError(symbolAccessibilityResult) { + if (symbolAccessibilityResult.accessibility === 0) { + if (symbolAccessibilityResult && symbolAccessibilityResult.aliasesToMakeVisible) { + writeAsynchronousModuleElements(symbolAccessibilityResult.aliasesToMakeVisible); } } else { reportedDeclarationError = true; - var errorInfo = writer.getSymbolAccessibilityDiagnostic(symbolAccesibilityResult); + var errorInfo = writer.getSymbolAccessibilityDiagnostic(symbolAccessibilityResult); if (errorInfo) { if (errorInfo.typeName) { - diagnostics.push(ts.createDiagnosticForNode(symbolAccesibilityResult.errorNode || errorInfo.errorNode, errorInfo.diagnosticMessage, ts.getTextOfNodeFromSourceText(currentText, errorInfo.typeName), symbolAccesibilityResult.errorSymbolName, symbolAccesibilityResult.errorModuleName)); + emitterDiagnostics.add(ts.createDiagnosticForNode(symbolAccessibilityResult.errorNode || errorInfo.errorNode, errorInfo.diagnosticMessage, ts.getTextOfNodeFromSourceText(currentText, errorInfo.typeName), symbolAccessibilityResult.errorSymbolName, symbolAccessibilityResult.errorModuleName)); } else { - diagnostics.push(ts.createDiagnosticForNode(symbolAccesibilityResult.errorNode || errorInfo.errorNode, errorInfo.diagnosticMessage, symbolAccesibilityResult.errorSymbolName, symbolAccesibilityResult.errorModuleName)); + emitterDiagnostics.add(ts.createDiagnosticForNode(symbolAccessibilityResult.errorNode || errorInfo.errorNode, errorInfo.diagnosticMessage, symbolAccessibilityResult.errorSymbolName, symbolAccessibilityResult.errorModuleName)); } } } } function trackSymbol(symbol, enclosingDeclaration, meaning) { handleSymbolAccessibilityError(resolver.isSymbolAccessible(symbol, enclosingDeclaration, meaning)); + recordTypeReferenceDirectivesIfNecessary(resolver.getTypeReferenceDirectivesForSymbol(symbol, meaning)); } function reportInaccessibleThisError() { if (errorNameNode) { - diagnostics.push(ts.createDiagnosticForNode(errorNameNode, ts.Diagnostics.The_inferred_type_of_0_references_an_inaccessible_this_type_A_type_annotation_is_necessary, ts.declarationNameToString(errorNameNode))); + reportedDeclarationError = true; + emitterDiagnostics.add(ts.createDiagnosticForNode(errorNameNode, ts.Diagnostics.The_inferred_type_of_0_references_an_inaccessible_this_type_A_type_annotation_is_necessary, ts.declarationNameToString(errorNameNode))); } } function writeTypeOfDeclaration(declaration, type, getSymbolAccessibilityDiagnostic) { @@ -23649,40 +27109,43 @@ var ts; function emitType(type) { switch (type.kind) { case 117: + case 132: case 130: - case 128: case 120: - case 131: + case 133: case 103: - case 97: - case 9: + case 135: + case 93: + case 127: + case 165: + case 166: return writeTextOfNode(currentText, type); - case 188: + case 194: return emitExpressionWithTypeArguments(type); - case 151: - return emitTypeReference(type); - case 154: - return emitTypeQuery(type); - case 156: - return emitArrayType(type); - case 157: - return emitTupleType(type); - case 158: - return emitUnionType(type); - case 159: - return emitIntersectionType(type); - case 160: - return emitParenType(type); - case 152: - case 153: - return emitSignatureDeclarationWithJsDocComments(type); case 155: + return emitTypeReference(type); + case 158: + return emitTypeQuery(type); + case 160: + return emitArrayType(type); + case 161: + return emitTupleType(type); + case 162: + return emitUnionType(type); + case 163: + return emitIntersectionType(type); + case 164: + return emitParenType(type); + case 156: + case 157: + return emitSignatureDeclarationWithJsDocComments(type); + case 159: return emitTypeLiteral(type); case 69: return emitEntityName(type); - case 135: + case 139: return emitEntityName(type); - case 150: + case 154: return emitTypePredicate(type); } function writeEntityName(entityName) { @@ -23690,21 +27153,22 @@ var ts; writeTextOfNode(currentText, entityName); } else { - var left = entityName.kind === 135 ? entityName.left : entityName.expression; - var right = entityName.kind === 135 ? entityName.right : entityName.name; + var left = entityName.kind === 139 ? entityName.left : entityName.expression; + var right = entityName.kind === 139 ? entityName.right : entityName.name; writeEntityName(left); write("."); writeTextOfNode(currentText, right); } } function emitEntityName(entityName) { - var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 221 ? entityName.parent : enclosingDeclaration); + var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 229 ? entityName.parent : enclosingDeclaration); handleSymbolAccessibilityError(visibilityResult); + recordTypeReferenceDirectivesIfNecessary(resolver.getTypeReferenceDirectivesForEntityName(entityName)); writeEntityName(entityName); } function emitExpressionWithTypeArguments(node) { if (ts.isSupportedExpressionWithTypeArguments(node)) { - ts.Debug.assert(node.expression.kind === 69 || node.expression.kind === 166); + ts.Debug.assert(node.expression.kind === 69 || node.expression.kind === 172); emitEntityName(node.expression); if (node.typeArguments) { write("<"); @@ -23777,9 +27241,10 @@ var ts; } var count = 0; while (true) { - var name_18 = baseName + "_" + (++count); - if (!ts.hasProperty(currentIdentifiers, name_18)) { - return name_18; + count++; + var name_22 = baseName + "_" + count; + if (!ts.hasProperty(currentIdentifiers, name_22)) { + return name_22; } } } @@ -23790,7 +27255,10 @@ var ts; } else { var tempVarName = getExportDefaultTempVariableName(); - write("declare var "); + if (!noDeclare) { + write("declare "); + } + write("var "); write(tempVarName); write(": "); writer.getSymbolAccessibilityDiagnostic = getDefaultExportAccessibilityDiagnostic; @@ -23820,10 +27288,10 @@ var ts; if (isModuleElementVisible) { writeModuleElement(node); } - else if (node.kind === 221 || - (node.parent.kind === 248 && isCurrentFileExternalModule)) { - var isVisible; - if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 248) { + else if (node.kind === 229 || + (node.parent.kind === 256 && isCurrentFileExternalModule)) { + var isVisible = void 0; + if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 256) { asynchronousSubModuleDeclarationEmitInfo.push({ node: node, outputPos: writer.getTextPos(), @@ -23832,7 +27300,7 @@ var ts; }); } else { - if (node.kind === 222) { + if (node.kind === 230) { var importDeclaration = node; if (importDeclaration.importClause) { isVisible = (importDeclaration.importClause.name && resolver.isDeclarationVisible(importDeclaration.importClause)) || @@ -23850,58 +27318,61 @@ var ts; } function writeModuleElement(node) { switch (node.kind) { - case 213: + case 220: return writeFunctionDeclaration(node); - case 193: + case 200: return writeVariableStatement(node); - case 215: - return writeInterfaceDeclaration(node); - case 214: - return writeClassDeclaration(node); - case 216: - return writeTypeAliasDeclaration(node); - case 217: - return writeEnumDeclaration(node); - case 218: - return writeModuleDeclaration(node); - case 221: - return writeImportEqualsDeclaration(node); case 222: + return writeInterfaceDeclaration(node); + case 221: + return writeClassDeclaration(node); + case 223: + return writeTypeAliasDeclaration(node); + case 224: + return writeEnumDeclaration(node); + case 225: + return writeModuleDeclaration(node); + case 229: + return writeImportEqualsDeclaration(node); + case 230: return writeImportDeclaration(node); default: ts.Debug.fail("Unknown symbol kind"); } } function emitModuleElementDeclarationFlags(node) { - if (node.parent.kind === 248) { - if (node.flags & 2) { + if (node.parent.kind === 256) { + if (node.flags & 1) { write("export "); } if (node.flags & 512) { write("default "); } - else if (node.kind !== 215 && !noDeclare) { + else if (node.kind !== 222 && !noDeclare) { write("declare "); } } } - function emitClassMemberDeclarationFlags(node) { - if (node.flags & 16) { + function emitClassMemberDeclarationFlags(flags) { + if (flags & 8) { write("private "); } - else if (node.flags & 32) { + else if (flags & 16) { write("protected "); } - if (node.flags & 64) { + if (flags & 32) { write("static "); } - if (node.flags & 128) { + if (flags & 64) { + write("readonly "); + } + if (flags & 128) { write("abstract "); } } function writeImportEqualsDeclaration(node) { emitJsDocComments(node); - if (node.flags & 2) { + if (node.flags & 1) { write("export "); } write("import "); @@ -23913,11 +27384,11 @@ var ts; } else { write("require("); - writeTextOfNode(currentText, ts.getExternalModuleImportEqualsDeclarationExpression(node)); + emitExternalModuleSpecifier(node); write(");"); } writer.writeLine(); - function getImportEntityNameVisibilityError(symbolAccesibilityResult) { + function getImportEntityNameVisibilityError(symbolAccessibilityResult) { return { diagnosticMessage: ts.Diagnostics.Import_declaration_0_is_using_private_name_1, errorNode: node, @@ -23927,7 +27398,7 @@ var ts; } function isVisibleNamedBinding(namedBindings) { if (namedBindings) { - if (namedBindings.kind === 224) { + if (namedBindings.kind === 232) { return resolver.isDeclarationVisible(namedBindings); } else { @@ -23936,11 +27407,8 @@ var ts; } } function writeImportDeclaration(node) { - if (!node.importClause && !(node.flags & 2)) { - return; - } emitJsDocComments(node); - if (node.flags & 2) { + if (node.flags & 1) { write("export "); } write("import "); @@ -23953,7 +27421,7 @@ var ts; if (currentWriterPos !== writer.getTextPos()) { write(", "); } - if (node.importClause.namedBindings.kind === 224) { + if (node.importClause.namedBindings.kind === 232) { write("* as "); writeTextOfNode(currentText, node.importClause.namedBindings.name); } @@ -23965,17 +27433,30 @@ var ts; } write(" from "); } - emitExternalModuleSpecifier(node.moduleSpecifier); + emitExternalModuleSpecifier(node); write(";"); writer.writeLine(); } - function emitExternalModuleSpecifier(moduleSpecifier) { - if (moduleSpecifier.kind === 9 && (!root) && (compilerOptions.out || compilerOptions.outFile)) { - var moduleName = ts.getExternalModuleNameFromDeclaration(host, resolver, moduleSpecifier.parent); + function emitExternalModuleSpecifier(parent) { + resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || parent.kind !== 225; + var moduleSpecifier; + if (parent.kind === 229) { + var node = parent; + moduleSpecifier = ts.getExternalModuleImportEqualsDeclarationExpression(node); + } + else if (parent.kind === 225) { + moduleSpecifier = parent.name; + } + else { + var node = parent; + moduleSpecifier = node.moduleSpecifier; + } + if (moduleSpecifier.kind === 9 && isBundledEmit && (compilerOptions.out || compilerOptions.outFile)) { + var moduleName = ts.getExternalModuleNameFromDeclaration(host, resolver, parent); if (moduleName) { - write("\""); + write('"'); write(moduleName); - write("\""); + write('"'); return; } } @@ -24006,7 +27487,7 @@ var ts; } if (node.moduleSpecifier) { write(" from "); - emitExternalModuleSpecifier(node.moduleSpecifier); + emitExternalModuleSpecifier(node); } write(";"); writer.writeLine(); @@ -24014,14 +27495,24 @@ var ts; function writeModuleDeclaration(node) { emitJsDocComments(node); emitModuleElementDeclarationFlags(node); - if (node.flags & 65536) { - write("namespace "); + if (ts.isGlobalScopeAugmentation(node)) { + write("global "); } else { - write("module "); + if (node.flags & 4096) { + write("namespace "); + } + else { + write("module "); + } + if (ts.isExternalModuleAugmentation(node)) { + emitExternalModuleSpecifier(node); + } + else { + writeTextOfNode(currentText, node.name); + } } - writeTextOfNode(currentText, node.name); - while (node.body.kind !== 219) { + while (node.body.kind !== 226) { node = node.body; write("."); writeTextOfNode(currentText, node.name); @@ -24050,7 +27541,7 @@ var ts; write(";"); writeLine(); enclosingDeclaration = prevEnclosingDeclaration; - function getTypeAliasDeclarationVisibilityError(symbolAccesibilityResult) { + function getTypeAliasDeclarationVisibilityError(symbolAccessibilityResult) { return { diagnosticMessage: ts.Diagnostics.Exported_type_alias_0_has_or_is_using_private_name_1, errorNode: node.type, @@ -24086,7 +27577,7 @@ var ts; writeLine(); } function isPrivateMethodTypeParameter(node) { - return node.parent.kind === 143 && (node.parent.flags & 16); + return node.parent.kind === 147 && (node.parent.flags & 8); } function emitTypeParameters(typeParameters) { function emitTypeParameter(node) { @@ -24096,49 +27587,49 @@ var ts; writeTextOfNode(currentText, node.name); if (node.constraint && !isPrivateMethodTypeParameter(node)) { write(" extends "); - if (node.parent.kind === 152 || - node.parent.kind === 153 || - (node.parent.parent && node.parent.parent.kind === 155)) { - ts.Debug.assert(node.parent.kind === 143 || - node.parent.kind === 142 || - node.parent.kind === 152 || - node.parent.kind === 153 || - node.parent.kind === 147 || - node.parent.kind === 148); + if (node.parent.kind === 156 || + node.parent.kind === 157 || + (node.parent.parent && node.parent.parent.kind === 159)) { + ts.Debug.assert(node.parent.kind === 147 || + node.parent.kind === 146 || + node.parent.kind === 156 || + node.parent.kind === 157 || + node.parent.kind === 151 || + node.parent.kind === 152); emitType(node.constraint); } else { emitTypeWithNewGetSymbolAccessibilityDiagnostic(node.constraint, getTypeParameterConstraintVisibilityError); } } - function getTypeParameterConstraintVisibilityError(symbolAccesibilityResult) { + function getTypeParameterConstraintVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; switch (node.parent.kind) { - case 214: + case 221: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; - case 215: + case 222: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; - case 148: + case 152: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 147: + case 151: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 143: - case 142: - if (node.parent.flags & 64) { + case 147: + case 146: + if (node.parent.flags & 32) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 214) { + else if (node.parent.parent.kind === 221) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } break; - case 213: + case 220: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; default: @@ -24169,9 +27660,13 @@ var ts; else if (!isImplementsList && node.expression.kind === 93) { write("null"); } - function getHeritageClauseVisibilityError(symbolAccesibilityResult) { + else { + writer.getSymbolAccessibilityDiagnostic = getHeritageClauseVisibilityError; + resolver.writeBaseConstructorTypeOfClass(enclosingDeclaration, enclosingDeclaration, 2, writer); + } + function getHeritageClauseVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; - if (node.parent.parent.kind === 214) { + if (node.parent.parent.kind === 221) { diagnosticMessage = isImplementsList ? ts.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 : ts.Diagnostics.Extends_clause_of_exported_class_0_has_or_is_using_private_name_1; @@ -24191,7 +27686,7 @@ var ts; function emitParameterProperties(constructorDeclaration) { if (constructorDeclaration) { ts.forEach(constructorDeclaration.parameters, function (param) { - if (param.flags & 56) { + if (param.flags & 92) { emitPropertyDeclaration(param); } }); @@ -24245,61 +27740,61 @@ var ts; return; } emitJsDocComments(node); - emitClassMemberDeclarationFlags(node); + emitClassMemberDeclarationFlags(node.flags); emitVariableDeclaration(node); write(";"); writeLine(); } function emitVariableDeclaration(node) { - if (node.kind !== 211 || resolver.isDeclarationVisible(node)) { + if (node.kind !== 218 || resolver.isDeclarationVisible(node)) { if (ts.isBindingPattern(node.name)) { emitBindingPattern(node.name); } else { writeTextOfNode(currentText, node.name); - if ((node.kind === 141 || node.kind === 140) && ts.hasQuestionToken(node)) { + if ((node.kind === 145 || node.kind === 144 || node.kind === 142) && ts.hasQuestionToken(node)) { write("?"); } - if ((node.kind === 141 || node.kind === 140) && node.parent.kind === 155) { + if ((node.kind === 145 || node.kind === 144) && node.parent.kind === 159) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } - else if (!(node.flags & 16)) { + else if (!(node.flags & 8)) { writeTypeOfDeclaration(node, node.type, getVariableDeclarationTypeVisibilityError); } } } - function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult) { - if (node.kind === 211) { - return symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? + function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { + if (node.kind === 218) { + return symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Exported_variable_0_has_or_is_using_private_name_1; } - else if (node.kind === 141 || node.kind === 140) { - if (node.flags & 64) { - return symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? + else if (node.kind === 145 || node.kind === 144) { + if (node.flags & 32) { + return symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.kind === 214) { - return symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? + else if (node.parent.kind === 221) { + return symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_private_name_1; } else { - return symbolAccesibilityResult.errorModuleName ? + return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_private_name_1; } } } - function getVariableDeclarationTypeVisibilityError(symbolAccesibilityResult) { - var diagnosticMessage = getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult); + function getVariableDeclarationTypeVisibilityError(symbolAccessibilityResult) { + var diagnosticMessage = getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult); return diagnosticMessage !== undefined ? { diagnosticMessage: diagnosticMessage, errorNode: node, @@ -24310,15 +27805,15 @@ var ts; var elements = []; for (var _i = 0, _a = bindingPattern.elements; _i < _a.length; _i++) { var element = _a[_i]; - if (element.kind !== 187) { + if (element.kind !== 193) { elements.push(element); } } emitCommaList(elements, emitBindingElement); } function emitBindingElement(bindingElement) { - function getBindingElementTypeVisibilityError(symbolAccesibilityResult) { - var diagnosticMessage = getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult); + function getBindingElementTypeVisibilityError(symbolAccessibilityResult) { + var diagnosticMessage = getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult); return diagnosticMessage !== undefined ? { diagnosticMessage: diagnosticMessage, errorNode: bindingElement, @@ -24370,13 +27865,13 @@ var ts; if (node === accessors.firstAccessor) { emitJsDocComments(accessors.getAccessor); emitJsDocComments(accessors.setAccessor); - emitClassMemberDeclarationFlags(node); + emitClassMemberDeclarationFlags(node.flags | (accessors.setAccessor ? 0 : 64)); writeTextOfNode(currentText, node.name); - if (!(node.flags & 16)) { + if (!(node.flags & 8)) { accessorWithTypeAnnotation = node; var type = getTypeAnnotationFromAccessor(node); if (!type) { - var anotherAccessor = node.kind === 145 ? accessors.setAccessor : accessors.getAccessor; + var anotherAccessor = node.kind === 149 ? accessors.setAccessor : accessors.getAccessor; type = getTypeAnnotationFromAccessor(anotherAccessor); if (type) { accessorWithTypeAnnotation = anotherAccessor; @@ -24389,23 +27884,23 @@ var ts; } function getTypeAnnotationFromAccessor(accessor) { if (accessor) { - return accessor.kind === 145 + return accessor.kind === 149 ? accessor.type : accessor.parameters.length > 0 ? accessor.parameters[0].type : undefined; } } - function getAccessorDeclarationTypeVisibilityError(symbolAccesibilityResult) { + function getAccessorDeclarationTypeVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; - if (accessorWithTypeAnnotation.kind === 146) { - if (accessorWithTypeAnnotation.parent.flags & 64) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + if (accessorWithTypeAnnotation.kind === 150) { + if (accessorWithTypeAnnotation.parent.flags & 32) { + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1; } else { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1; } @@ -24416,16 +27911,16 @@ var ts; }; } else { - if (accessorWithTypeAnnotation.flags & 64) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? + if (accessorWithTypeAnnotation.flags & 32) { + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0; } else { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0; @@ -24444,17 +27939,17 @@ var ts; } if (!resolver.isImplementationOfOverload(node)) { emitJsDocComments(node); - if (node.kind === 213) { + if (node.kind === 220) { emitModuleElementDeclarationFlags(node); } - else if (node.kind === 143) { - emitClassMemberDeclarationFlags(node); + else if (node.kind === 147 || node.kind === 148) { + emitClassMemberDeclarationFlags(node.flags); } - if (node.kind === 213) { + if (node.kind === 220) { write("function "); writeTextOfNode(currentText, node.name); } - else if (node.kind === 144) { + else if (node.kind === 148) { write("constructor"); } else { @@ -24471,33 +27966,42 @@ var ts; emitSignatureDeclaration(node); } function emitSignatureDeclaration(node) { - if (node.kind === 148 || node.kind === 153) { - write("new "); - } - emitTypeParameters(node.typeParameters); - if (node.kind === 149) { + var prevEnclosingDeclaration = enclosingDeclaration; + enclosingDeclaration = node; + var closeParenthesizedFunctionType = false; + if (node.kind === 153) { + emitClassMemberDeclarationFlags(node.flags); write("["); } else { + if (node.kind === 152 || node.kind === 157) { + write("new "); + } + else if (node.kind === 156) { + var currentOutput = writer.getText(); + if (node.typeParameters && currentOutput.charAt(currentOutput.length - 1) === "<") { + closeParenthesizedFunctionType = true; + write("("); + } + } + emitTypeParameters(node.typeParameters); write("("); } - var prevEnclosingDeclaration = enclosingDeclaration; - enclosingDeclaration = node; emitCommaList(node.parameters, emitParameterDeclaration); - if (node.kind === 149) { + if (node.kind === 153) { write("]"); } else { write(")"); } - var isFunctionTypeOrConstructorType = node.kind === 152 || node.kind === 153; - if (isFunctionTypeOrConstructorType || node.parent.kind === 155) { + var isFunctionTypeOrConstructorType = node.kind === 156 || node.kind === 157; + if (isFunctionTypeOrConstructorType || node.parent.kind === 159) { if (node.type) { write(isFunctionTypeOrConstructorType ? " => " : ": "); emitType(node.type); } } - else if (node.kind !== 144 && !(node.flags & 16)) { + else if (node.kind !== 148 && !(node.flags & 8)) { writeReturnTypeAtSignature(node, getReturnTypeVisibilityError); } enclosingDeclaration = prevEnclosingDeclaration; @@ -24505,49 +28009,52 @@ var ts; write(";"); writeLine(); } - function getReturnTypeVisibilityError(symbolAccesibilityResult) { + else if (closeParenthesizedFunctionType) { + write(")"); + } + function getReturnTypeVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; switch (node.kind) { - case 148: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + case 152: + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 147: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + case 151: + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 149: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + case 153: + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 143: - case 142: - if (node.flags & 64) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? + case 147: + case 146: + if (node.flags & 32) { + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0; } - else if (node.parent.kind === 214) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? + else if (node.parent.kind === 221) { + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0; } else { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; - case 213: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? + case 220: + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_private_name_0; @@ -24577,62 +28084,62 @@ var ts; write("?"); } decreaseIndent(); - if (node.parent.kind === 152 || - node.parent.kind === 153 || - node.parent.parent.kind === 155) { + if (node.parent.kind === 156 || + node.parent.kind === 157 || + node.parent.parent.kind === 159) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } - else if (!(node.parent.flags & 16)) { + else if (!(node.parent.flags & 8)) { writeTypeOfDeclaration(node, node.type, getParameterDeclarationTypeVisibilityError); } - function getParameterDeclarationTypeVisibilityError(symbolAccesibilityResult) { - var diagnosticMessage = getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult); + function getParameterDeclarationTypeVisibilityError(symbolAccessibilityResult) { + var diagnosticMessage = getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult); return diagnosticMessage !== undefined ? { diagnosticMessage: diagnosticMessage, errorNode: node, typeName: node.name } : undefined; } - function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult) { + function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { switch (node.parent.kind) { - case 144: - return symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? + case 148: + return symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1; - case 148: - return symbolAccesibilityResult.errorModuleName ? + case 152: + return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; - case 147: - return symbolAccesibilityResult.errorModuleName ? + case 151: + return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; - case 143: - case 142: - if (node.parent.flags & 64) { - return symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? + case 147: + case 146: + if (node.parent.flags & 32) { + return symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 214) { - return symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? + else if (node.parent.parent.kind === 221) { + return symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { - return symbolAccesibilityResult.errorModuleName ? + return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } - case 213: - return symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? + case 220: + return symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1; @@ -24641,12 +28148,12 @@ var ts; } } function emitBindingPattern(bindingPattern) { - if (bindingPattern.kind === 161) { + if (bindingPattern.kind === 167) { write("{"); emitCommaList(bindingPattern.elements, emitBindingElement); write("}"); } - else if (bindingPattern.kind === 162) { + else if (bindingPattern.kind === 168) { write("["); var elements = bindingPattern.elements; emitCommaList(elements, emitBindingElement); @@ -24657,18 +28164,10 @@ var ts; } } function emitBindingElement(bindingElement) { - function getBindingElementTypeVisibilityError(symbolAccesibilityResult) { - var diagnosticMessage = getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult); - return diagnosticMessage !== undefined ? { - diagnosticMessage: diagnosticMessage, - errorNode: bindingElement, - typeName: bindingElement.name - } : undefined; - } - if (bindingElement.kind === 187) { + if (bindingElement.kind === 193) { write(" "); } - else if (bindingElement.kind === 163) { + else if (bindingElement.kind === 169) { if (bindingElement.propertyName) { writeTextOfNode(currentText, bindingElement.propertyName); write(": "); @@ -24690,59 +28189,75 @@ var ts; } function emitNode(node) { switch (node.kind) { - case 213: - case 218: - case 221: - case 215: - case 214: - case 216: - case 217: - return emitModuleElement(node, isModuleElementVisible(node)); - case 193: - return emitModuleElement(node, isVariableStatementVisible(node)); + case 220: + case 225: + case 229: case 222: + case 221: + case 223: + case 224: + return emitModuleElement(node, isModuleElementVisible(node)); + case 200: + return emitModuleElement(node, isVariableStatementVisible(node)); + case 230: return emitModuleElement(node, !node.importClause); - case 228: + case 236: return emitExportDeclaration(node); - case 144: - case 143: - case 142: - return writeFunctionDeclaration(node); case 148: case 147: - case 149: - return emitSignatureDeclarationWithJsDocComments(node); - case 145: case 146: + return writeFunctionDeclaration(node); + case 152: + case 151: + case 153: + return emitSignatureDeclarationWithJsDocComments(node); + case 149: + case 150: return emitAccessorDeclaration(node); - case 141: - case 140: + case 145: + case 144: return emitPropertyDeclaration(node); - case 247: + case 255: return emitEnumMemberDeclaration(node); - case 227: + case 235: return emitExportAssignment(node); - case 248: + case 256: return emitSourceFile(node); } } - function writeReferencePath(referencedFile) { - var declFileName = referencedFile.flags & 4096 - ? referencedFile.fileName - : ts.shouldEmitToOwnFile(referencedFile, compilerOptions) - ? ts.getOwnEmitOutputFilePath(referencedFile, host, ".d.ts") - : ts.removeFileExtension(compilerOptions.outFile || compilerOptions.out) + ".d.ts"; - declFileName = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizeSlashes(jsFilePath)), declFileName, host.getCurrentDirectory(), host.getCanonicalFileName, false); - referencePathsOutput += "/// " + newLine; + function writeReferencePath(referencedFile, addBundledFileReference) { + var declFileName; + var addedBundledEmitReference = false; + if (ts.isDeclarationFile(referencedFile)) { + declFileName = referencedFile.fileName; + } + else { + ts.forEachExpectedEmitFile(host, getDeclFileName, referencedFile); + } + if (declFileName) { + declFileName = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizeSlashes(declarationFilePath)), declFileName, host.getCurrentDirectory(), host.getCanonicalFileName, false); + referencesOutput += "/// " + newLine; + } + return addedBundledEmitReference; + function getDeclFileName(emitFileNames, sourceFiles, isBundledEmit) { + if (isBundledEmit && !addBundledFileReference) { + return; + } + ts.Debug.assert(!!emitFileNames.declarationFilePath || ts.isSourceFileJavaScript(referencedFile), "Declaration file is not present only for javascript files"); + declFileName = emitFileNames.declarationFilePath || emitFileNames.jsFilePath; + addedBundledEmitReference = isBundledEmit; + } } } - function writeDeclarationFile(jsFilePath, sourceFile, host, resolver, diagnostics) { - var emitDeclarationResult = emitDeclarations(host, resolver, diagnostics, jsFilePath, sourceFile); - if (!emitDeclarationResult.reportedDeclarationError) { - var declarationOutput = emitDeclarationResult.referencePathsOutput + function writeDeclarationFile(declarationFilePath, sourceFiles, isBundledEmit, host, resolver, emitterDiagnostics) { + var emitDeclarationResult = emitDeclarations(host, resolver, emitterDiagnostics, declarationFilePath, sourceFiles, isBundledEmit); + var emitSkipped = emitDeclarationResult.reportedDeclarationError || host.isEmitBlocked(declarationFilePath) || host.getCompilerOptions().noEmit; + if (!emitSkipped) { + var declarationOutput = emitDeclarationResult.referencesOutput + getDeclarationOutput(emitDeclarationResult.synchronousDeclarationOutput, emitDeclarationResult.moduleElementDeclarationEmitInfo); - ts.writeFile(host, diagnostics, ts.removeFileExtension(jsFilePath) + ".d.ts", declarationOutput, host.getCompilerOptions().emitBOM); + ts.writeFile(host, emitterDiagnostics, declarationFilePath, declarationOutput, host.getCompilerOptions().emitBOM, sourceFiles); } + return emitSkipped; function getDeclarationOutput(synchronousDeclarationOutput, moduleElementDeclarationEmitInfo) { var appliedSyncOutputPos = 0; var declarationOutput = ""; @@ -24761,10 +28276,6 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { - function isExternalModuleOrDeclarationFile(sourceFile) { - return ts.isExternalModule(sourceFile) || ts.isDeclarationFile(sourceFile); - } - ts.isExternalModuleOrDeclarationFile = isExternalModuleOrDeclarationFile; function getResolvedExternalModuleName(host, file) { return file.moduleName || ts.getExternalModuleNameFromPath(host, file.fileName); } @@ -25034,46 +28545,25 @@ var ts; }; function emitFiles(resolver, host, targetSourceFile) { var extendsHelper = "\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};"; + var assignHelper = "\nvar __assign = (this && this.__assign) || Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n};"; var decorateHelper = "\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};"; var metadataHelper = "\nvar __metadata = (this && this.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};"; var paramHelper = "\nvar __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n};"; - var awaiterHelper = "\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promise, generator) {\n return new Promise(function (resolve, reject) {\n generator = generator.call(thisArg, _arguments);\n function cast(value) { return value instanceof Promise && value.constructor === Promise ? value : new Promise(function (resolve) { resolve(value); }); }\n function onfulfill(value) { try { step(\"next\", value); } catch (e) { reject(e); } }\n function onreject(value) { try { step(\"throw\", value); } catch (e) { reject(e); } }\n function step(verb, value) {\n var result = generator[verb](value);\n result.done ? resolve(result.value) : cast(result.value).then(onfulfill, onreject);\n }\n step(\"next\", void 0);\n });\n};"; + var awaiterHelper = "\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator.throw(value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments)).next());\n });\n};"; var compilerOptions = host.getCompilerOptions(); - var languageVersion = compilerOptions.target || 0; - var modulekind = compilerOptions.module ? compilerOptions.module : languageVersion === 2 ? 5 : 0; + var languageVersion = ts.getEmitScriptTarget(compilerOptions); + var modulekind = ts.getEmitModuleKind(compilerOptions); var sourceMapDataList = compilerOptions.sourceMap || compilerOptions.inlineSourceMap ? [] : undefined; - var diagnostics = []; + var emittedFilesList = compilerOptions.listEmittedFiles ? [] : undefined; + var emitterDiagnostics = ts.createDiagnosticCollection(); + var emitSkipped = false; var newLine = host.getNewLine(); - var jsxDesugaring = host.getCompilerOptions().jsx !== 1; - var shouldEmitJsx = function (s) { return (s.languageVariant === 1 && !jsxDesugaring); }; - var outFile = compilerOptions.outFile || compilerOptions.out; var emitJavaScript = createFileEmitter(); - if (targetSourceFile === undefined) { - if (outFile) { - emitFile(outFile); - } - else { - ts.forEach(host.getSourceFiles(), function (sourceFile) { - if (ts.shouldEmitToOwnFile(sourceFile, compilerOptions)) { - var jsFilePath = ts.getOwnEmitOutputFilePath(sourceFile, host, shouldEmitJsx(sourceFile) ? ".jsx" : ".js"); - emitFile(jsFilePath, sourceFile); - } - }); - } - } - else { - if (ts.shouldEmitToOwnFile(targetSourceFile, compilerOptions)) { - var jsFilePath = ts.getOwnEmitOutputFilePath(targetSourceFile, host, shouldEmitJsx(targetSourceFile) ? ".jsx" : ".js"); - emitFile(jsFilePath, targetSourceFile); - } - else if (!ts.isDeclarationFile(targetSourceFile) && outFile) { - emitFile(outFile); - } - } - diagnostics = ts.sortAndDeduplicateDiagnostics(diagnostics); + ts.forEachExpectedEmitFile(host, emitFile, targetSourceFile); return { - emitSkipped: false, - diagnostics: diagnostics, + emitSkipped: emitSkipped, + diagnostics: emitterDiagnostics.getDiagnostics(), + emittedFiles: emittedFilesList, sourceMaps: sourceMapDataList }; function isUniqueLocalName(name, container) { @@ -25120,6 +28610,8 @@ var ts; function createFileEmitter() { var writer = ts.createTextWriter(newLine); var write = writer.write, writeTextOfNode = writer.writeTextOfNode, writeLine = writer.writeLine, increaseIndent = writer.increaseIndent, decreaseIndent = writer.decreaseIndent; + var sourceMap = compilerOptions.sourceMap || compilerOptions.inlineSourceMap ? ts.createSourceMapWriter(host, writer) : ts.getNullSourceMapWriter(); + var setSourceFile = sourceMap.setSourceFile, emitStart = sourceMap.emitStart, emitEnd = sourceMap.emitEnd, emitPos = sourceMap.emitPos; var currentSourceFile; var currentText; var currentLineMap; @@ -25128,106 +28620,104 @@ var ts; var isEs6Module; var isCurrentFileExternalModule; var exportFunctionForFile; + var contextObjectForFile; var generatedNameSet; var nodeToGeneratedName; var computedPropertyNamesToGeneratedNames; + var decoratedClassAliases; var convertedLoopState; var extendsEmitted; + var assignEmitted; var decorateEmitted; var paramEmitted; var awaiterEmitted; - var tempFlags; + var tempFlags = 0; var tempVariables; var tempParameters; var externalImports; var exportSpecifiers; var exportEquals; - var hasExportStars; - var writeEmittedFiles = writeJavaScriptFile; + var hasExportStarsToExportValues; var detachedCommentsInfo; - var writeComment = ts.writeCommentRange; - var emit = emitNodeWithCommentsAndWithoutSourcemap; - var emitStart = function (node) { }; - var emitEnd = function (node) { }; - var emitToken = emitTokenText; - var scopeEmitStart = function (scopeDeclaration, scopeName) { }; - var scopeEmitEnd = function () { }; var sourceMapData; - var root; + var isOwnFileEmit; var emitLeadingCommentsOfPosition = compilerOptions.removeComments ? function (pos) { } : emitLeadingCommentsOfPositionWorker; + var setSourceMapWriterEmit = compilerOptions.sourceMap || compilerOptions.inlineSourceMap ? changeSourceMapEmit : function (writer) { }; var moduleEmitDelegates = (_a = {}, - _a[5] = emitES6Module, - _a[2] = emitAMDModule, - _a[4] = emitSystemModule, - _a[3] = emitUMDModule, - _a[1] = emitCommonJSModule, + _a[ts.ModuleKind.ES6] = emitES6Module, + _a[ts.ModuleKind.AMD] = emitAMDModule, + _a[ts.ModuleKind.System] = emitSystemModule, + _a[ts.ModuleKind.UMD] = emitUMDModule, + _a[ts.ModuleKind.CommonJS] = emitCommonJSModule, _a ); var bundleEmitDelegates = (_b = {}, - _b[5] = function () { }, - _b[2] = emitAMDModule, - _b[4] = emitSystemModule, - _b[3] = function () { }, - _b[1] = function () { }, + _b[ts.ModuleKind.ES6] = function () { }, + _b[ts.ModuleKind.AMD] = emitAMDModule, + _b[ts.ModuleKind.System] = emitSystemModule, + _b[ts.ModuleKind.UMD] = function () { }, + _b[ts.ModuleKind.CommonJS] = function () { }, _b ); return doEmit; - function doEmit(jsFilePath, rootFile) { + function doEmit(jsFilePath, sourceMapFilePath, sourceFiles, isBundledEmit) { + sourceMap.initialize(jsFilePath, sourceMapFilePath, sourceFiles, isBundledEmit); + generatedNameSet = {}; + nodeToGeneratedName = []; + decoratedClassAliases = []; + isOwnFileEmit = !isBundledEmit; + if (isBundledEmit && modulekind) { + ts.forEach(sourceFiles, emitEmitHelpers); + } + ts.forEach(sourceFiles, emitSourceFile); + writeLine(); + var sourceMappingURL = sourceMap.getSourceMappingURL(); + if (sourceMappingURL) { + write("//# sourceMappingURL=" + sourceMappingURL); + } + writeEmittedFiles(writer.getText(), jsFilePath, sourceMapFilePath, compilerOptions.emitBOM, sourceFiles); + sourceMap.reset(); writer.reset(); currentSourceFile = undefined; currentText = undefined; currentLineMap = undefined; exportFunctionForFile = undefined; - generatedNameSet = {}; - nodeToGeneratedName = []; + contextObjectForFile = undefined; + generatedNameSet = undefined; + nodeToGeneratedName = undefined; + decoratedClassAliases = undefined; computedPropertyNamesToGeneratedNames = undefined; convertedLoopState = undefined; extendsEmitted = false; decorateEmitted = false; paramEmitted = false; awaiterEmitted = false; + assignEmitted = false; tempFlags = 0; tempVariables = undefined; tempParameters = undefined; externalImports = undefined; exportSpecifiers = undefined; exportEquals = undefined; - hasExportStars = undefined; + hasExportStarsToExportValues = undefined; detachedCommentsInfo = undefined; sourceMapData = undefined; isEs6Module = false; renamedDependencies = undefined; isCurrentFileExternalModule = false; - root = rootFile; - if (compilerOptions.sourceMap || compilerOptions.inlineSourceMap) { - initializeEmitterWithSourceMaps(jsFilePath, root); - } - if (root) { - emitSourceFile(root); - } - else { - if (modulekind) { - ts.forEach(host.getSourceFiles(), emitEmitHelpers); - } - ts.forEach(host.getSourceFiles(), function (sourceFile) { - if ((!isExternalModuleOrDeclarationFile(sourceFile)) || (modulekind && ts.isExternalModule(sourceFile))) { - emitSourceFile(sourceFile); - } - }); - } - writeLine(); - writeEmittedFiles(writer.getText(), jsFilePath, compilerOptions.emitBOM); } function emitSourceFile(sourceFile) { currentSourceFile = sourceFile; currentText = sourceFile.text; currentLineMap = ts.getLineStarts(sourceFile); exportFunctionForFile = undefined; + contextObjectForFile = undefined; isEs6Module = sourceFile.symbol && sourceFile.symbol.exports && !!sourceFile.symbol.exports["___esModule"]; renamedDependencies = sourceFile.renamedDependencies; currentFileIdentifiers = sourceFile.identifiers; isCurrentFileExternalModule = ts.isExternalModule(sourceFile); - emit(sourceFile); + setSourceFile(sourceFile); + emitNodeWithCommentsAndWithoutSourcemap(sourceFile); } function isUniqueName(name) { return !resolver.hasGlobalName(name) && @@ -25236,19 +28726,19 @@ var ts; } function makeTempVariableName(flags) { if (flags && !(tempFlags & flags)) { - var name_19 = flags === 268435456 ? "_i" : "_n"; - if (isUniqueName(name_19)) { + var name_23 = flags === 268435456 ? "_i" : "_n"; + if (isUniqueName(name_23)) { tempFlags |= flags; - return name_19; + return name_23; } } while (true) { var count = tempFlags & 268435455; tempFlags++; if (count !== 8 && count !== 13) { - var name_20 = count < 26 ? "_" + String.fromCharCode(97 + count) : "_" + (count - 26); - if (isUniqueName(name_20)) { - return name_20; + var name_24 = count < 26 ? "_" + String.fromCharCode(97 + count) : "_" + (count - 26); + if (isUniqueName(name_24)) { + return name_24; } } } @@ -25286,17 +28776,17 @@ var ts; switch (node.kind) { case 69: return makeUniqueName(node.text); - case 218: - case 217: + case 225: + case 224: return generateNameForModuleOrEnum(node); - case 222: - case 228: + case 230: + case 236: return generateNameForImportOrExportDeclaration(node); - case 213: - case 214: - case 227: + case 220: + case 221: + case 235: return generateNameForExportDefault(); - case 186: + case 192: return generateNameForClassExpression(); } } @@ -25304,289 +28794,14 @@ var ts; var id = ts.getNodeId(node); return nodeToGeneratedName[id] || (nodeToGeneratedName[id] = ts.unescapeIdentifier(generateNameForNode(node))); } - function initializeEmitterWithSourceMaps(jsFilePath, root) { - var sourceMapDir; - var sourceMapSourceIndex = -1; - var sourceMapNameIndexMap = {}; - var sourceMapNameIndices = []; - function getSourceMapNameIndex() { - return sourceMapNameIndices.length ? ts.lastOrUndefined(sourceMapNameIndices) : -1; + function writeEmittedFiles(emitOutput, jsFilePath, sourceMapFilePath, writeByteOrderMark, sourceFiles) { + if (compilerOptions.sourceMap && !compilerOptions.inlineSourceMap) { + ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap.getText(), false, sourceFiles); } - var lastRecordedSourceMapSpan; - var lastEncodedSourceMapSpan = { - emittedLine: 1, - emittedColumn: 1, - sourceLine: 1, - sourceColumn: 1, - sourceIndex: 0 - }; - var lastEncodedNameIndex = 0; - function encodeLastRecordedSourceMapSpan() { - if (!lastRecordedSourceMapSpan || lastRecordedSourceMapSpan === lastEncodedSourceMapSpan) { - return; - } - var prevEncodedEmittedColumn = lastEncodedSourceMapSpan.emittedColumn; - if (lastEncodedSourceMapSpan.emittedLine === lastRecordedSourceMapSpan.emittedLine) { - if (sourceMapData.sourceMapMappings) { - sourceMapData.sourceMapMappings += ","; - } - } - else { - for (var encodedLine = lastEncodedSourceMapSpan.emittedLine; encodedLine < lastRecordedSourceMapSpan.emittedLine; encodedLine++) { - sourceMapData.sourceMapMappings += ";"; - } - prevEncodedEmittedColumn = 1; - } - sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.emittedColumn - prevEncodedEmittedColumn); - sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceIndex - lastEncodedSourceMapSpan.sourceIndex); - sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceLine - lastEncodedSourceMapSpan.sourceLine); - sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceColumn - lastEncodedSourceMapSpan.sourceColumn); - if (lastRecordedSourceMapSpan.nameIndex >= 0) { - sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.nameIndex - lastEncodedNameIndex); - lastEncodedNameIndex = lastRecordedSourceMapSpan.nameIndex; - } - lastEncodedSourceMapSpan = lastRecordedSourceMapSpan; - sourceMapData.sourceMapDecodedMappings.push(lastEncodedSourceMapSpan); - function base64VLQFormatEncode(inValue) { - function base64FormatEncode(inValue) { - if (inValue < 64) { - return "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(inValue); - } - throw TypeError(inValue + ": not a 64 based value"); - } - if (inValue < 0) { - inValue = ((-inValue) << 1) + 1; - } - else { - inValue = inValue << 1; - } - var encodedStr = ""; - do { - var currentDigit = inValue & 31; - inValue = inValue >> 5; - if (inValue > 0) { - currentDigit = currentDigit | 32; - } - encodedStr = encodedStr + base64FormatEncode(currentDigit); - } while (inValue > 0); - return encodedStr; - } + if (sourceMapDataList) { + sourceMapDataList.push(sourceMap.getSourceMapData()); } - function recordSourceMapSpan(pos) { - var sourceLinePos = ts.computeLineAndCharacterOfPosition(currentLineMap, pos); - sourceLinePos.line++; - sourceLinePos.character++; - var emittedLine = writer.getLine(); - var emittedColumn = writer.getColumn(); - if (!lastRecordedSourceMapSpan || - lastRecordedSourceMapSpan.emittedLine !== emittedLine || - lastRecordedSourceMapSpan.emittedColumn !== emittedColumn || - (lastRecordedSourceMapSpan.sourceIndex === sourceMapSourceIndex && - (lastRecordedSourceMapSpan.sourceLine > sourceLinePos.line || - (lastRecordedSourceMapSpan.sourceLine === sourceLinePos.line && lastRecordedSourceMapSpan.sourceColumn > sourceLinePos.character)))) { - encodeLastRecordedSourceMapSpan(); - lastRecordedSourceMapSpan = { - emittedLine: emittedLine, - emittedColumn: emittedColumn, - sourceLine: sourceLinePos.line, - sourceColumn: sourceLinePos.character, - nameIndex: getSourceMapNameIndex(), - sourceIndex: sourceMapSourceIndex - }; - } - else { - lastRecordedSourceMapSpan.sourceLine = sourceLinePos.line; - lastRecordedSourceMapSpan.sourceColumn = sourceLinePos.character; - lastRecordedSourceMapSpan.sourceIndex = sourceMapSourceIndex; - } - } - function recordEmitNodeStartSpan(node) { - recordSourceMapSpan(ts.skipTrivia(currentText, node.pos)); - } - function recordEmitNodeEndSpan(node) { - recordSourceMapSpan(node.end); - } - function writeTextWithSpanRecord(tokenKind, startPos, emitFn) { - var tokenStartPos = ts.skipTrivia(currentText, startPos); - recordSourceMapSpan(tokenStartPos); - var tokenEndPos = emitTokenText(tokenKind, tokenStartPos, emitFn); - recordSourceMapSpan(tokenEndPos); - return tokenEndPos; - } - function recordNewSourceFileStart(node) { - var sourcesDirectoryPath = compilerOptions.sourceRoot ? host.getCommonSourceDirectory() : sourceMapDir; - sourceMapData.sourceMapSources.push(ts.getRelativePathToDirectoryOrUrl(sourcesDirectoryPath, node.fileName, host.getCurrentDirectory(), host.getCanonicalFileName, true)); - sourceMapSourceIndex = sourceMapData.sourceMapSources.length - 1; - sourceMapData.inputSourceFileNames.push(node.fileName); - if (compilerOptions.inlineSources) { - if (!sourceMapData.sourceMapSourcesContent) { - sourceMapData.sourceMapSourcesContent = []; - } - sourceMapData.sourceMapSourcesContent.push(node.text); - } - } - function recordScopeNameOfNode(node, scopeName) { - function recordScopeNameIndex(scopeNameIndex) { - sourceMapNameIndices.push(scopeNameIndex); - } - function recordScopeNameStart(scopeName) { - var scopeNameIndex = -1; - if (scopeName) { - var parentIndex = getSourceMapNameIndex(); - if (parentIndex !== -1) { - var name_21 = node.name; - if (!name_21 || name_21.kind !== 136) { - scopeName = "." + scopeName; - } - scopeName = sourceMapData.sourceMapNames[parentIndex] + scopeName; - } - scopeNameIndex = ts.getProperty(sourceMapNameIndexMap, scopeName); - if (scopeNameIndex === undefined) { - scopeNameIndex = sourceMapData.sourceMapNames.length; - sourceMapData.sourceMapNames.push(scopeName); - sourceMapNameIndexMap[scopeName] = scopeNameIndex; - } - } - recordScopeNameIndex(scopeNameIndex); - } - if (scopeName) { - recordScopeNameStart(scopeName); - } - else if (node.kind === 213 || - node.kind === 173 || - node.kind === 143 || - node.kind === 142 || - node.kind === 145 || - node.kind === 146 || - node.kind === 218 || - node.kind === 214 || - node.kind === 217) { - if (node.name) { - var name_22 = node.name; - scopeName = name_22.kind === 136 - ? ts.getTextOfNode(name_22) - : node.name.text; - } - recordScopeNameStart(scopeName); - } - else { - recordScopeNameIndex(getSourceMapNameIndex()); - } - } - function recordScopeNameEnd() { - sourceMapNameIndices.pop(); - } - ; - function writeCommentRangeWithMap(currentText, currentLineMap, writer, comment, newLine) { - recordSourceMapSpan(comment.pos); - ts.writeCommentRange(currentText, currentLineMap, writer, comment, newLine); - recordSourceMapSpan(comment.end); - } - function serializeSourceMapContents(version, file, sourceRoot, sources, names, mappings, sourcesContent) { - if (typeof JSON !== "undefined") { - var map_1 = { - version: version, - file: file, - sourceRoot: sourceRoot, - sources: sources, - names: names, - mappings: mappings - }; - if (sourcesContent !== undefined) { - map_1.sourcesContent = sourcesContent; - } - return JSON.stringify(map_1); - } - return "{\"version\":" + version + ",\"file\":\"" + ts.escapeString(file) + "\",\"sourceRoot\":\"" + ts.escapeString(sourceRoot) + "\",\"sources\":[" + serializeStringArray(sources) + "],\"names\":[" + serializeStringArray(names) + "],\"mappings\":\"" + ts.escapeString(mappings) + "\" " + (sourcesContent !== undefined ? ",\"sourcesContent\":[" + serializeStringArray(sourcesContent) + "]" : "") + "}"; - function serializeStringArray(list) { - var output = ""; - for (var i = 0, n = list.length; i < n; i++) { - if (i) { - output += ","; - } - output += "\"" + ts.escapeString(list[i]) + "\""; - } - return output; - } - } - function writeJavaScriptAndSourceMapFile(emitOutput, jsFilePath, writeByteOrderMark) { - encodeLastRecordedSourceMapSpan(); - var sourceMapText = serializeSourceMapContents(3, sourceMapData.sourceMapFile, sourceMapData.sourceMapSourceRoot, sourceMapData.sourceMapSources, sourceMapData.sourceMapNames, sourceMapData.sourceMapMappings, sourceMapData.sourceMapSourcesContent); - sourceMapDataList.push(sourceMapData); - var sourceMapUrl; - if (compilerOptions.inlineSourceMap) { - var base64SourceMapText = ts.convertToBase64(sourceMapText); - sourceMapUrl = "//# sourceMappingURL=data:application/json;base64," + base64SourceMapText; - } - else { - ts.writeFile(host, diagnostics, sourceMapData.sourceMapFilePath, sourceMapText, false); - sourceMapUrl = "//# sourceMappingURL=" + sourceMapData.jsSourceMappingURL; - } - writeJavaScriptFile(emitOutput + sourceMapUrl, jsFilePath, writeByteOrderMark); - } - var sourceMapJsFile = ts.getBaseFileName(ts.normalizeSlashes(jsFilePath)); - sourceMapData = { - sourceMapFilePath: jsFilePath + ".map", - jsSourceMappingURL: sourceMapJsFile + ".map", - sourceMapFile: sourceMapJsFile, - sourceMapSourceRoot: compilerOptions.sourceRoot || "", - sourceMapSources: [], - inputSourceFileNames: [], - sourceMapNames: [], - sourceMapMappings: "", - sourceMapSourcesContent: undefined, - sourceMapDecodedMappings: [] - }; - sourceMapData.sourceMapSourceRoot = ts.normalizeSlashes(sourceMapData.sourceMapSourceRoot); - if (sourceMapData.sourceMapSourceRoot.length && sourceMapData.sourceMapSourceRoot.charCodeAt(sourceMapData.sourceMapSourceRoot.length - 1) !== 47) { - sourceMapData.sourceMapSourceRoot += ts.directorySeparator; - } - if (compilerOptions.mapRoot) { - sourceMapDir = ts.normalizeSlashes(compilerOptions.mapRoot); - if (root) { - sourceMapDir = ts.getDirectoryPath(ts.getSourceFilePathInNewDir(root, host, sourceMapDir)); - } - if (!ts.isRootedDiskPath(sourceMapDir) && !ts.isUrl(sourceMapDir)) { - sourceMapDir = ts.combinePaths(host.getCommonSourceDirectory(), sourceMapDir); - sourceMapData.jsSourceMappingURL = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizePath(jsFilePath)), ts.combinePaths(sourceMapDir, sourceMapData.jsSourceMappingURL), host.getCurrentDirectory(), host.getCanonicalFileName, true); - } - else { - sourceMapData.jsSourceMappingURL = ts.combinePaths(sourceMapDir, sourceMapData.jsSourceMappingURL); - } - } - else { - sourceMapDir = ts.getDirectoryPath(ts.normalizePath(jsFilePath)); - } - function emitNodeWithSourceMap(node) { - if (node) { - if (ts.nodeIsSynthesized(node)) { - return emitNodeWithoutSourceMap(node); - } - if (node.kind !== 248) { - recordEmitNodeStartSpan(node); - emitNodeWithoutSourceMap(node); - recordEmitNodeEndSpan(node); - } - else { - recordNewSourceFileStart(node); - emitNodeWithoutSourceMap(node); - } - } - } - function emitNodeWithCommentsAndWithSourcemap(node) { - emitNodeConsideringCommentsOption(node, emitNodeWithSourceMap); - } - writeEmittedFiles = writeJavaScriptAndSourceMapFile; - emit = emitNodeWithCommentsAndWithSourcemap; - emitStart = recordEmitNodeStartSpan; - emitEnd = recordEmitNodeEndSpan; - emitToken = writeTextWithSpanRecord; - scopeEmitStart = recordScopeNameOfNode; - scopeEmitEnd = recordScopeNameEnd; - writeComment = writeCommentRangeWithMap; - } - function writeJavaScriptFile(emitOutput, jsFilePath, writeByteOrderMark) { - ts.writeFile(host, diagnostics, jsFilePath, emitOutput, writeByteOrderMark); + ts.writeFile(host, emitterDiagnostics, jsFilePath, emitOutput, writeByteOrderMark, sourceFiles); } function createTempVariable(flags) { var result = ts.createSynthesizedNode(69); @@ -25617,7 +28832,9 @@ var ts; write(";"); } } - function emitTokenText(tokenKind, startPos, emitFn) { + function emitToken(tokenKind, startPos, emitFn) { + var tokenStartPos = ts.skipTrivia(currentText, startPos); + emitPos(tokenStartPos); var tokenString = ts.tokenToString(tokenKind); if (emitFn) { emitFn(); @@ -25625,7 +28842,9 @@ var ts; else { write(tokenString); } - return startPos + tokenString.length; + var tokenEndPos = tokenStartPos + tokenString.length; + emitPos(tokenEndPos); + return tokenEndPos; } function emitOptional(prefix, node) { if (node) { @@ -25642,11 +28861,6 @@ var ts; write(")"); } } - function emitTrailingCommaIfPresent(nodeList) { - if (nodeList.hasTrailingComma) { - write(","); - } - } function emitLinePreservingList(parent, nodes, allowTrailingComma, spacesBetweenBraces) { ts.Debug.assert(nodes.length > 0); increaseIndent(); @@ -25752,14 +28966,14 @@ var ts; } function getLiteralText(node) { if (languageVersion < 2 && (ts.isTemplateLiteralKind(node.kind) || node.hasExtendedUnicodeEscape)) { - return getQuotedEscapedLiteralText("\"", node.text, "\""); + return getQuotedEscapedLiteralText('"', node.text, '"'); } if (node.parent) { return ts.getTextOfNodeFromSourceText(currentText, node); } switch (node.kind) { case 9: - return getQuotedEscapedLiteralText("\"", node.text, "\""); + return getQuotedEscapedLiteralText('"', node.text, '"'); case 11: return getQuotedEscapedLiteralText("`", node.text, "`"); case 12: @@ -25812,10 +29026,10 @@ var ts; emitParenthesizedIf(node.tag, needsParenthesisForPropertyAccessOrInvocation(node.tag)); write("("); emit(tempVariable); - if (node.template.kind === 183) { + if (node.template.kind === 189) { ts.forEach(node.template.templateSpans, function (templateSpan) { write(", "); - var needsParens = templateSpan.expression.kind === 181 + var needsParens = templateSpan.expression.kind === 187 && templateSpan.expression.operatorToken.kind === 24; emitParenthesizedIf(templateSpan.expression, needsParens); }); @@ -25839,7 +29053,7 @@ var ts; } for (var i = 0, n = node.templateSpans.length; i < n; i++) { var templateSpan = node.templateSpans[i]; - var needsParens = templateSpan.expression.kind !== 172 + var needsParens = templateSpan.expression.kind !== 178 && comparePrecedenceToBinaryPlus(templateSpan.expression) !== 1; if (i > 0 || headEmitted) { write(" + "); @@ -25859,11 +29073,11 @@ var ts; } function templateNeedsParens(template, parent) { switch (parent.kind) { - case 168: - case 169: + case 174: + case 175: return parent.expression === template; - case 170: - case 172: + case 176: + case 178: return false; default: return comparePrecedenceToBinaryPlus(parent) !== -1; @@ -25871,7 +29085,7 @@ var ts; } function comparePrecedenceToBinaryPlus(expression) { switch (expression.kind) { - case 181: + case 187: switch (expression.operatorToken.kind) { case 37: case 39: @@ -25883,8 +29097,8 @@ var ts; default: return -1; } - case 184: - case 182: + case 190: + case 188: return -1; default: return 1; @@ -25898,22 +29112,22 @@ var ts; function jsxEmitReact(node) { function emitTagName(name) { if (name.kind === 69 && ts.isIntrinsicJsxName(name.text)) { - write("\""); + write('"'); emit(name); - write("\""); + write('"'); } else { emit(name); } } function emitAttributeName(name) { - if (/[A-Za-z_]+[\w*]/.test(name.text)) { - write("\""); + if (/^[A-Za-z_]\w*$/.test(name.text)) { emit(name); - write("\""); } else { + write('"'); emit(name); + write('"'); } } function emitJsxAttribute(node) { @@ -25928,7 +29142,7 @@ var ts; } function emitJsxElement(openingNode, children) { var syntheticReactRef = ts.createSynthesizedNode(69); - syntheticReactRef.text = "React"; + syntheticReactRef.text = compilerOptions.reactNamespace ? compilerOptions.reactNamespace : "React"; syntheticReactRef.parent = openingNode; emitLeadingComments(openingNode); emitExpressionIdentifier(syntheticReactRef); @@ -25940,37 +29154,36 @@ var ts; } else { var attrs = openingNode.attributes; - if (ts.forEach(attrs, function (attr) { return attr.kind === 239; })) { - emitExpressionIdentifier(syntheticReactRef); - write(".__spread("); + if (ts.forEach(attrs, function (attr) { return attr.kind === 247; })) { + write("__assign("); var haveOpenedObjectLiteral = false; - for (var i_1 = 0; i_1 < attrs.length; i_1++) { - if (attrs[i_1].kind === 239) { - if (i_1 === 0) { + for (var i = 0; i < attrs.length; i++) { + if (attrs[i].kind === 247) { + if (i === 0) { write("{}, "); } if (haveOpenedObjectLiteral) { write("}"); haveOpenedObjectLiteral = false; } - if (i_1 > 0) { + if (i > 0) { write(", "); } - emit(attrs[i_1].expression); + emit(attrs[i].expression); } else { - ts.Debug.assert(attrs[i_1].kind === 238); + ts.Debug.assert(attrs[i].kind === 246); if (haveOpenedObjectLiteral) { write(", "); } else { haveOpenedObjectLiteral = true; - if (i_1 > 0) { + if (i > 0) { write(", "); } write("{"); } - emitJsxAttribute(attrs[i_1]); + emitJsxAttribute(attrs[i]); } } if (haveOpenedObjectLiteral) @@ -25979,7 +29192,7 @@ var ts; } else { write("{"); - for (var i = 0; i < attrs.length; i++) { + for (var i = 0, n = attrs.length; i < n; i++) { if (i > 0) { write(", "); } @@ -25989,32 +29202,52 @@ var ts; } } if (children) { - for (var i = 0; i < children.length; i++) { - if (children[i].kind === 240 && !(children[i].expression)) { - continue; - } - if (children[i].kind === 236) { - var text = getTextToEmit(children[i]); - if (text !== undefined) { - write(", \""); - write(text); - write("\""); + var firstChild = void 0; + var multipleEmittableChildren = false; + for (var i = 0, n = children.length; i < n; i++) { + var jsxChild = children[i]; + if (isJsxChildEmittable(jsxChild)) { + if (!firstChild) { + write(", "); + firstChild = jsxChild; + } + else { + if (!multipleEmittableChildren) { + multipleEmittableChildren = true; + increaseIndent(); + writeLine(); + emit(firstChild); + } + write(", "); + writeLine(); + emit(jsxChild); } } + } + if (multipleEmittableChildren) { + decreaseIndent(); + } + else if (firstChild) { + if (firstChild.kind !== 241 && firstChild.kind !== 242) { + emit(firstChild); + } else { - write(", "); - emit(children[i]); + increaseIndent(); + writeLine(); + emit(firstChild); + writeLine(); + decreaseIndent(); } } } write(")"); emitTrailingComments(openingNode); } - if (node.kind === 233) { + if (node.kind === 241) { emitJsxElement(node.openingElement, node.children); } else { - ts.Debug.assert(node.kind === 234); + ts.Debug.assert(node.kind === 242); emitJsxElement(node); } } @@ -26036,11 +29269,11 @@ var ts; if (i > 0) { write(" "); } - if (attribs[i].kind === 239) { + if (attribs[i].kind === 247) { emitJsxSpreadAttribute(attribs[i]); } else { - ts.Debug.assert(attribs[i].kind === 238); + ts.Debug.assert(attribs[i].kind === 246); emitJsxAttribute(attribs[i]); } } @@ -26048,11 +29281,11 @@ var ts; function emitJsxOpeningOrSelfClosingElement(node) { write("<"); emit(node.tagName); - if (node.attributes.length > 0 || (node.kind === 234)) { + if (node.attributes.length > 0 || (node.kind === 242)) { write(" "); } emitAttributes(node.attributes); - if (node.kind === 234) { + if (node.kind === 242) { write("/>"); } else { @@ -26071,20 +29304,20 @@ var ts; } emitJsxClosingElement(node.closingElement); } - if (node.kind === 233) { + if (node.kind === 241) { emitJsxElement(node); } else { - ts.Debug.assert(node.kind === 234); + ts.Debug.assert(node.kind === 242); emitJsxOpeningOrSelfClosingElement(node); } } function emitExpressionForPropertyName(node) { - ts.Debug.assert(node.kind !== 163); + ts.Debug.assert(node.kind !== 169); if (node.kind === 9) { emitLiteral(node); } - else if (node.kind === 136) { + else if (node.kind === 140) { if (ts.nodeIsDecorated(node.parent)) { if (!computedPropertyNamesToGeneratedNames) { computedPropertyNamesToGeneratedNames = []; @@ -26102,87 +29335,86 @@ var ts; emit(node.expression); } else { - write("\""); + write('"'); if (node.kind === 8) { write(node.text); } else { writeTextOfNode(currentText, node); } - write("\""); + write('"'); } } function isExpressionIdentifier(node) { var parent = node.parent; switch (parent.kind) { - case 164: - case 189: - case 181: - case 168: - case 241: - case 136: - case 182: - case 139: - case 175: - case 197: - case 167: - case 227: + case 170: case 195: + case 184: + case 187: + case 174: + case 249: + case 140: case 188: - case 199: - case 200: - case 201: - case 196: - case 234: + case 143: + case 181: + case 204: + case 173: case 235: - case 239: - case 240: + case 202: + case 194: + case 206: + case 207: + case 208: + case 203: + case 245: + case 242: + case 243: + case 247: + case 248: + case 175: + case 196: + case 178: + case 186: + case 185: + case 211: + case 254: + case 191: + case 213: + case 176: + case 197: + case 215: + case 177: + case 182: + case 183: + case 205: + case 212: + case 190: + return true; case 169: + case 255: + case 142: + case 253: + case 145: + case 218: + return parent.initializer === node; case 172: + return parent.expression === node; case 180: case 179: - case 204: - case 246: - case 185: - case 206: - case 170: - case 190: - case 208: - case 171: - case 176: - case 177: - case 198: - case 205: - case 184: - return true; - case 163: - case 247: - case 138: - case 245: - case 141: - case 211: - return parent.initializer === node; - case 166: - return parent.expression === node; - case 174: - case 173: return parent.body === node; - case 221: + case 229: return parent.moduleReference === node; - case 135: + case 139: return parent.left === node; } return false; } function emitExpressionIdentifier(node) { - if (resolver.getNodeCheckFlags(node) & 2048) { - write("_arguments"); - return; - } var container = resolver.getReferencedExportContainer(node); if (container) { - if (container.kind === 248) { - if (modulekind !== 5 && modulekind !== 4) { + if (container.kind === 256) { + if (modulekind !== ts.ModuleKind.ES6 && modulekind !== ts.ModuleKind.System) { write("exports."); } } @@ -26192,20 +29424,20 @@ var ts; } } else { - if (modulekind !== 5) { + if (modulekind !== ts.ModuleKind.ES6) { var declaration = resolver.getReferencedImportDeclaration(node); if (declaration) { - if (declaration.kind === 223) { + if (declaration.kind === 231) { write(getGeneratedNameForNode(declaration.parent)); - write(languageVersion === 0 ? "[\"default\"]" : ".default"); + write(languageVersion === 0 ? '["default"]' : ".default"); return; } - else if (declaration.kind === 226) { + else if (declaration.kind === 234) { write(getGeneratedNameForNode(declaration.parent.parent.parent)); - var name_23 = declaration.propertyName || declaration.name; - var identifier = ts.getTextOfNodeFromSourceText(currentText, name_23); + var name_25 = declaration.propertyName || declaration.name; + var identifier = ts.getTextOfNodeFromSourceText(currentText, name_25); if (languageVersion === 0 && identifier === "default") { - write("[\"default\"]"); + write('["default"]'); } else { write("."); @@ -26215,13 +29447,23 @@ var ts; } } } - if (languageVersion !== 2) { - var declaration = resolver.getReferencedNestedRedeclaration(node); + if (languageVersion < 2) { + var declaration = resolver.getReferencedDeclarationWithCollidingName(node); if (declaration) { write(getGeneratedNameForNode(declaration.name)); return; } } + else if (resolver.getNodeCheckFlags(node) & 1048576) { + var declaration = resolver.getReferencedValueDeclaration(node); + if (declaration) { + var classAlias = decoratedClassAliases[ts.getNodeId(declaration)]; + if (classAlias !== undefined) { + write(classAlias); + return; + } + } + } } if (ts.nodeIsSynthesized(node)) { write(node.text); @@ -26230,15 +29472,15 @@ var ts; writeTextOfNode(currentText, node); } } - function isNameOfNestedRedeclaration(node) { + function isNameOfNestedBlockScopedRedeclarationOrCapturedBinding(node) { if (languageVersion < 2) { - var parent_6 = node.parent; - switch (parent_6.kind) { - case 163: - case 214: - case 217: - case 211: - return parent_6.name === node && resolver.isNestedRedeclaration(parent_6); + var parent_13 = node.parent; + switch (parent_13.kind) { + case 169: + case 221: + case 224: + case 218: + return parent_13.name === node && resolver.isDeclarationWithCollidingName(parent_13); } } return false; @@ -26246,8 +29488,8 @@ var ts; function emitIdentifier(node) { if (convertedLoopState) { if (node.text == "arguments" && resolver.isArgumentsLocalBinding(node)) { - var name_24 = convertedLoopState.argumentsName || (convertedLoopState.argumentsName = makeUniqueName("arguments")); - write(name_24); + var name_26 = convertedLoopState.argumentsName || (convertedLoopState.argumentsName = makeUniqueName("arguments")); + write(name_26); return; } } @@ -26257,7 +29499,7 @@ var ts; else if (isExpressionIdentifier(node)) { emitExpressionIdentifier(node); } - else if (isNameOfNestedRedeclaration(node)) { + else if (isNameOfNestedBlockScopedRedeclarationOrCapturedBinding(node)) { write(getGeneratedNameForNode(node)); } else if (ts.nodeIsSynthesized(node)) { @@ -26271,6 +29513,9 @@ var ts; if (resolver.getNodeCheckFlags(node) & 2) { write("_this"); } + else if (convertedLoopState) { + write(convertedLoopState.thisName || (convertedLoopState.thisName = makeUniqueName("this"))); + } else { write("this"); } @@ -26344,10 +29589,10 @@ var ts; } } function needsParenthesisForAwaitExpressionAsYield(node) { - if (node.parent.kind === 181 && !ts.isAssignmentOperator(node.parent.operatorToken.kind)) { + if (node.parent.kind === 187 && !ts.isAssignmentOperator(node.parent.operatorToken.kind)) { return true; } - else if (node.parent.kind === 182 && node.parent.condition === node) { + else if (node.parent.kind === 188 && node.parent.condition === node) { return true; } return false; @@ -26355,11 +29600,11 @@ var ts; function needsParenthesisForPropertyAccessOrInvocation(node) { switch (node.kind) { case 69: - case 164: - case 166: - case 167: - case 168: + case 170: case 172: + case 173: + case 174: + case 178: return false; } return true; @@ -26376,17 +29621,17 @@ var ts; write(", "); } var e = elements[pos]; - if (e.kind === 185) { + if (e.kind === 191) { e = e.expression; emitParenthesizedIf(e, group === 0 && needsParenthesisForPropertyAccessOrInvocation(e)); pos++; - if (pos === length && group === 0 && needsUniqueCopy && e.kind !== 164) { + if (pos === length && group === 0 && needsUniqueCopy && e.kind !== 170) { write(".slice()"); } } else { var i = pos; - while (i < length && elements[i].kind !== 185) { + while (i < length && elements[i].kind !== 191) { i++; } write("["); @@ -26409,7 +29654,7 @@ var ts; } } function isSpreadElementExpression(node) { - return node.kind === 185; + return node.kind === 191; } function emitArrayLiteral(node) { var elements = node.elements; @@ -26422,7 +29667,7 @@ var ts; write("]"); } else { - emitListWithSpread(elements, true, (node.flags & 1024) !== 0, elements.hasTrailingComma, true); + emitListWithSpread(elements, true, node.multiLine, elements.hasTrailingComma, true); } } function emitObjectLiteralBody(node, numElements) { @@ -26437,7 +29682,7 @@ var ts; emitLinePreservingList(node, properties, languageVersion >= 1, true); } else { - var multiLine = (node.flags & 1024) !== 0; + var multiLine = node.multiLine; if (!multiLine) { write(" "); } @@ -26456,7 +29701,7 @@ var ts; write("}"); } function emitDownlevelObjectLiteralWithComputedProperties(node, firstComputedPropertyIndex) { - var multiLine = (node.flags & 1024) !== 0; + var multiLine = node.multiLine; var properties = node.properties; write("("); if (multiLine) { @@ -26470,7 +29715,7 @@ var ts; writeComma(); var property = properties[i]; emitStart(property); - if (property.kind === 145 || property.kind === 146) { + if (property.kind === 149 || property.kind === 150) { var accessors = ts.getAllAccessorDeclarations(node.properties, property); if (property !== accessors.firstAccessor) { continue; @@ -26478,7 +29723,7 @@ var ts; write("Object.defineProperty("); emit(tempVar); write(", "); - emitStart(node.name); + emitStart(property.name); emitExpressionForPropertyName(property.name); emitEnd(property.name); write(", {"); @@ -26521,13 +29766,13 @@ var ts; emitMemberAccessForPropertyName(property.name); emitEnd(property.name); write(" = "); - if (property.kind === 245) { + if (property.kind === 253) { emit(property.initializer); } - else if (property.kind === 246) { + else if (property.kind === 254) { emitExpressionIdentifier(property.name); } - else if (property.kind === 143) { + else if (property.kind === 147) { emitFunctionDeclaration(property); } else { @@ -26559,7 +29804,7 @@ var ts; var numProperties = properties.length; var numInitialNonComputedProperties = numProperties; for (var i = 0, n = properties.length; i < n; i++) { - if (properties[i].name.kind === 136) { + if (properties[i].name.kind === 140) { numInitialNonComputedProperties = i; break; } @@ -26573,35 +29818,37 @@ var ts; emitObjectLiteralBody(node, properties.length); } function createBinaryExpression(left, operator, right, startsOnNewLine) { - var result = ts.createSynthesizedNode(181, startsOnNewLine); + var result = ts.createSynthesizedNode(187, startsOnNewLine); result.operatorToken = ts.createSynthesizedNode(operator); result.left = left; result.right = right; return result; } function createPropertyAccessExpression(expression, name) { - var result = ts.createSynthesizedNode(166); + var result = ts.createSynthesizedNode(172); result.expression = parenthesizeForAccess(expression); result.dotToken = ts.createSynthesizedNode(21); result.name = name; return result; } function createElementAccessExpression(expression, argumentExpression) { - var result = ts.createSynthesizedNode(167); + var result = ts.createSynthesizedNode(173); result.expression = parenthesizeForAccess(expression); result.argumentExpression = argumentExpression; return result; } function parenthesizeForAccess(expr) { - while (expr.kind === 171 || expr.kind === 189) { + while (expr.kind === 177 || + expr.kind === 195 || + expr.kind === 196) { expr = expr.expression; } if (ts.isLeftHandSideExpression(expr) && - expr.kind !== 169 && + expr.kind !== 175 && expr.kind !== 8) { return expr; } - var node = ts.createSynthesizedNode(172); + var node = ts.createSynthesizedNode(178); node.expression = expr; return node; } @@ -26628,11 +29875,15 @@ var ts; } function isNamespaceExportReference(node) { var container = resolver.getReferencedExportContainer(node); - return container && container.kind !== 248; + return container && container.kind !== 256; + } + function isImportedReference(node) { + var declaration = resolver.getReferencedImportDeclaration(node); + return declaration && (declaration.kind === 231 || declaration.kind === 234); } function emitShorthandPropertyAssignment(node) { writeTextOfNode(currentText, node.name); - if (modulekind !== 5 || isNamespaceExportReference(node.name)) { + if (languageVersion < 2 || (modulekind !== ts.ModuleKind.ES6 && isImportedReference(node.name)) || isNamespaceExportReference(node.name)) { write(": "); emit(node.name); } @@ -26646,7 +29897,7 @@ var ts; if (constantValue !== undefined) { write(constantValue.toString()); if (!compilerOptions.removeComments) { - var propertyName = node.kind === 166 ? ts.declarationNameToString(node.name) : ts.getTextOfNode(node.argumentExpression); + var propertyName = node.kind === 172 ? ts.declarationNameToString(node.name) : ts.getTextOfNode(node.argumentExpression); write(" /* " + propertyName + " */"); } return true; @@ -26657,7 +29908,7 @@ var ts; if (compilerOptions.isolatedModules) { return undefined; } - return node.kind === 166 || node.kind === 167 + return node.kind === 172 || node.kind === 173 ? resolver.getConstantValue(node) : undefined; } @@ -26680,6 +29931,14 @@ var ts; if (tryEmitConstantValue(node)) { return; } + if (languageVersion === 2 && + node.expression.kind === 95 && + isInAsyncMethodWithSuperInES6(node)) { + var name_27 = ts.createSynthesizedNode(9); + name_27.text = node.name.text; + emitSuperAccessInAsyncMethod(node.expression, name_27); + return; + } emit(node.expression); var indentedBeforeDot = indentIfOnDifferentLines(node, node.expression, node.dotToken); var shouldEmitSpace = false; @@ -26737,25 +29996,37 @@ var ts; } emitExpressionIdentifier(node); break; - case 135: + case 139: emitQualifiedNameAsExpression(node, useFallback); break; + default: + emitNodeWithoutSourceMap(node); + break; } } function emitIndexedAccess(node) { if (tryEmitConstantValue(node)) { return; } + if (languageVersion === 2 && + node.expression.kind === 95 && + isInAsyncMethodWithSuperInES6(node)) { + emitSuperAccessInAsyncMethod(node.expression, node.argumentExpression); + return; + } emit(node.expression); write("["); emit(node.argumentExpression); write("]"); } function hasSpreadElement(elements) { - return ts.forEach(elements, function (e) { return e.kind === 185; }); + return ts.forEach(elements, function (e) { return e.kind === 191; }); } function skipParentheses(node) { - while (node.kind === 172 || node.kind === 171 || node.kind === 189) { + while (node.kind === 178 || + node.kind === 177 || + node.kind === 195 || + node.kind === 196) { node = node.expression; } return node; @@ -26776,12 +30047,12 @@ var ts; function emitCallWithSpread(node) { var target; var expr = skipParentheses(node.expression); - if (expr.kind === 166) { + if (expr.kind === 172) { target = emitCallTarget(expr.expression); write("."); emit(expr.name); } - else if (expr.kind === 167) { + else if (expr.kind === 173) { target = emitCallTarget(expr.expression); write("["); emit(expr.argumentExpression); @@ -26810,23 +30081,42 @@ var ts; emitListWithSpread(node.arguments, false, false, false, true); write(")"); } + function isInAsyncMethodWithSuperInES6(node) { + if (languageVersion === 2) { + var container = ts.getSuperContainer(node, false); + if (container && resolver.getNodeCheckFlags(container) & (2048 | 4096)) { + return true; + } + } + return false; + } + function emitSuperAccessInAsyncMethod(superNode, argumentExpression) { + var container = ts.getSuperContainer(superNode, false); + var isSuperBinding = resolver.getNodeCheckFlags(container) & 4096; + write("_super("); + emit(argumentExpression); + write(isSuperBinding ? ").value" : ")"); + } function emitCallExpression(node) { if (languageVersion < 2 && hasSpreadElement(node.arguments)) { emitCallWithSpread(node); return; } + var expression = node.expression; var superCall = false; - if (node.expression.kind === 95) { - emitSuper(node.expression); + var isAsyncMethodWithSuper = false; + if (expression.kind === 95) { + emitSuper(expression); superCall = true; } else { - emit(node.expression); - superCall = node.expression.kind === 166 && node.expression.expression.kind === 95; + superCall = ts.isSuperPropertyOrElementAccess(expression); + isAsyncMethodWithSuper = superCall && isInAsyncMethodWithSuperInES6(node); + emit(expression); } - if (superCall && languageVersion < 2) { + if (superCall && (languageVersion < 2 || isAsyncMethodWithSuper)) { write(".call("); - emitThis(node.expression); + emitThis(expression); if (node.arguments.length) { write(", "); emitCommaList(node.arguments); @@ -26873,21 +30163,25 @@ var ts; } } function emitParenExpression(node) { - if (!ts.nodeIsSynthesized(node) && node.parent.kind !== 174) { - if (node.expression.kind === 171 || node.expression.kind === 189) { + if (!ts.nodeIsSynthesized(node) && node.parent.kind !== 180) { + if (node.expression.kind === 177 || + node.expression.kind === 195 || + node.expression.kind === 196) { var operand = node.expression.expression; - while (operand.kind === 171 || operand.kind === 189) { + while (operand.kind === 177 || + operand.kind === 195 || + operand.kind === 196) { operand = operand.expression; } - if (operand.kind !== 179 && - operand.kind !== 177 && - operand.kind !== 176 && + if (operand.kind !== 185 && + operand.kind !== 183 && + operand.kind !== 182 && + operand.kind !== 181 && + operand.kind !== 186 && operand.kind !== 175 && - operand.kind !== 180 && - operand.kind !== 169 && - !(operand.kind === 168 && node.parent.kind === 169) && - !(operand.kind === 173 && node.parent.kind === 168) && - !(operand.kind === 8 && node.parent.kind === 166)) { + !(operand.kind === 174 && node.parent.kind === 175) && + !(operand.kind === 179 && node.parent.kind === 174) && + !(operand.kind === 8 && node.parent.kind === 172)) { emit(operand); return; } @@ -26916,21 +30210,22 @@ var ts; if (!isCurrentFileSystemExternalModule() || node.kind !== 69 || ts.nodeIsSynthesized(node)) { return false; } - var isVariableDeclarationOrBindingElement = node.parent && (node.parent.kind === 211 || node.parent.kind === 163); + var isVariableDeclarationOrBindingElement = node.parent && (node.parent.kind === 218 || node.parent.kind === 169); var targetDeclaration = isVariableDeclarationOrBindingElement ? node.parent : resolver.getReferencedValueDeclaration(node); return isSourceFileLevelDeclarationInSystemJsModule(targetDeclaration, true); } function emitPrefixUnaryExpression(node) { - var exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.operand); + var exportChanged = (node.operator === 41 || node.operator === 42) && + isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.operand); if (exportChanged) { write(exportFunctionForFile + "(\""); emitNodeWithoutSourceMap(node.operand); write("\", "); } write(ts.tokenToString(node.operator)); - if (node.operand.kind === 179) { + if (node.operand.kind === 185) { var operand = node.operand; if (node.operator === 35 && (operand.operator === 35 || operand.operator === 41)) { write(" "); @@ -26971,12 +30266,12 @@ var ts; if (!node || !isCurrentFileSystemExternalModule()) { return false; } - var current = node; + var current = ts.getRootDeclaration(node).parent; while (current) { - if (current.kind === 248) { - return !isExported || ((ts.getCombinedNodeFlags(node) & 2) !== 0); + if (current.kind === 256) { + return !isExported || ((ts.getCombinedNodeFlags(node) & 1) !== 0); } - else if (ts.isFunctionLike(current) || current.kind === 219) { + else if (ts.isDeclaration(current)) { return false; } else { @@ -26987,19 +30282,19 @@ var ts; function emitExponentiationOperator(node) { var leftHandSideExpression = node.left; if (node.operatorToken.kind === 60) { - var synthesizedLHS; + var synthesizedLHS = void 0; var shouldEmitParentheses = false; if (ts.isElementAccessExpression(leftHandSideExpression)) { shouldEmitParentheses = true; write("("); - synthesizedLHS = ts.createSynthesizedNode(167, false); + synthesizedLHS = ts.createSynthesizedNode(173, false); var identifier = emitTempVariableAssignment(leftHandSideExpression.expression, false, false); synthesizedLHS.expression = identifier; if (leftHandSideExpression.argumentExpression.kind !== 8 && leftHandSideExpression.argumentExpression.kind !== 9) { var tempArgumentExpression = createAndRecordTempVariable(268435456); synthesizedLHS.argumentExpression = tempArgumentExpression; - emitAssignment(tempArgumentExpression, leftHandSideExpression.argumentExpression, true); + emitAssignment(tempArgumentExpression, leftHandSideExpression.argumentExpression, true, leftHandSideExpression.expression); } else { synthesizedLHS.argumentExpression = leftHandSideExpression.argumentExpression; @@ -27009,7 +30304,7 @@ var ts; else if (ts.isPropertyAccessExpression(leftHandSideExpression)) { shouldEmitParentheses = true; write("("); - synthesizedLHS = ts.createSynthesizedNode(166, false); + synthesizedLHS = ts.createSynthesizedNode(172, false); var identifier = emitTempVariableAssignment(leftHandSideExpression.expression, false, false); synthesizedLHS.expression = identifier; synthesizedLHS.dotToken = leftHandSideExpression.dotToken; @@ -27037,8 +30332,8 @@ var ts; } function emitBinaryExpression(node) { if (languageVersion < 2 && node.operatorToken.kind === 56 && - (node.left.kind === 165 || node.left.kind === 164)) { - emitDestructuring(node, node.parent.kind === 195); + (node.left.kind === 171 || node.left.kind === 170)) { + emitDestructuring(node, node.parent.kind === 202); } else { var exportChanged = node.operatorToken.kind >= 56 && @@ -27090,7 +30385,7 @@ var ts; } } function isSingleLineEmptyBlock(node) { - if (node && node.kind === 192) { + if (node && node.kind === 199) { var block = node; return block.statements.length === 0 && nodeEndIsOnSameLineAsNodeStart(block, block); } @@ -27104,22 +30399,20 @@ var ts; } emitToken(15, node.pos); increaseIndent(); - scopeEmitStart(node.parent); - if (node.kind === 219) { - ts.Debug.assert(node.parent.kind === 218); + if (node.kind === 226) { + ts.Debug.assert(node.parent.kind === 225); emitCaptureThisForNodeIfNecessary(node.parent); } emitLines(node.statements); - if (node.kind === 219) { + if (node.kind === 226) { emitTempDeclarations(true); } decreaseIndent(); writeLine(); emitToken(16, node.statements.end); - scopeEmitEnd(); } function emitEmbeddedStatement(node) { - if (node.kind === 192) { + if (node.kind === 199) { write(" "); emit(node); } @@ -27131,7 +30424,7 @@ var ts; } } function emitExpressionStatement(node) { - emitParenthesizedIf(node.expression, node.expression.kind === 174); + emitParenthesizedIf(node.expression, node.expression.kind === 180); write(";"); } function emitIfStatement(node) { @@ -27144,7 +30437,7 @@ var ts; if (node.elseStatement) { writeLine(); emitToken(80, node.thenStatement.end); - if (node.elseStatement.kind === 196) { + if (node.elseStatement.kind === 203) { write(" "); emit(node.elseStatement); } @@ -27164,7 +30457,7 @@ var ts; else { emitNormalLoopBody(node, true); } - if (node.statement.kind === 192) { + if (node.statement.kind === 199) { write(" "); } else { @@ -27188,42 +30481,31 @@ var ts; emitNormalLoopBody(node, true); } } - function tryEmitStartOfVariableDeclarationList(decl, startPos) { + function tryEmitStartOfVariableDeclarationList(decl) { if (shouldHoistVariable(decl, true)) { return false; } - if (convertedLoopState && (ts.getCombinedNodeFlags(decl) & 24576) === 0) { + if (convertedLoopState && (ts.getCombinedNodeFlags(decl) & 3072) === 0) { for (var _a = 0, _b = decl.declarations; _a < _b.length; _a++) { var varDecl = _b[_a]; hoistVariableDeclarationFromLoop(convertedLoopState, varDecl); } return false; } - var tokenKind = 102; + emitStart(decl); if (decl && languageVersion >= 2) { if (ts.isLet(decl)) { - tokenKind = 108; + write("let "); } else if (ts.isConst(decl)) { - tokenKind = 74; + write("const "); + } + else { + write("var "); } - } - if (startPos !== undefined) { - emitToken(tokenKind, startPos); - write(" "); } else { - switch (tokenKind) { - case 102: - write("var "); - break; - case 108: - write("let "); - break; - case 74: - write("const "); - break; - } + write("var "); } return true; } @@ -27255,7 +30537,7 @@ var ts; } else { var loop = convertLoopBody(node); - if (node.parent.kind === 207) { + if (node.parent.kind === 214) { emitLabelAndColon(node.parent); } loopEmitter(node, loop); @@ -27265,49 +30547,67 @@ var ts; var functionName = makeUniqueName("_loop"); var loopInitializer; switch (node.kind) { - case 199: - case 200: - case 201: - if (node.initializer.kind === 212) { + case 206: + case 207: + case 208: + var initializer = node.initializer; + if (initializer && initializer.kind === 219) { loopInitializer = node.initializer; } break; } var loopParameters; - if (loopInitializer && (ts.getCombinedNodeFlags(loopInitializer) & 24576)) { + var loopOutParameters; + if (loopInitializer && (ts.getCombinedNodeFlags(loopInitializer) & 3072)) { loopParameters = []; for (var _a = 0, _b = loopInitializer.declarations; _a < _b.length; _a++) { var varDeclaration = _b[_a]; - collectNames(varDeclaration.name); + processVariableDeclaration(varDeclaration.name); } } - var bodyIsBlock = node.statement.kind === 192; + var bodyIsBlock = node.statement.kind === 199; var paramList = loopParameters ? loopParameters.join(", ") : ""; writeLine(); write("var " + functionName + " = function(" + paramList + ")"); - if (!bodyIsBlock) { - write(" {"); - writeLine(); - increaseIndent(); - } var convertedOuterLoopState = convertedLoopState; - convertedLoopState = {}; + convertedLoopState = { loopOutParameters: loopOutParameters }; if (convertedOuterLoopState) { if (convertedOuterLoopState.argumentsName) { convertedLoopState.argumentsName = convertedOuterLoopState.argumentsName; } + if (convertedOuterLoopState.thisName) { + convertedLoopState.thisName = convertedOuterLoopState.thisName; + } if (convertedOuterLoopState.hoistedLocalVariables) { convertedLoopState.hoistedLocalVariables = convertedOuterLoopState.hoistedLocalVariables; } } - emitEmbeddedStatement(node.statement); - if (!bodyIsBlock) { - decreaseIndent(); - writeLine(); - write("}"); - } - write(";"); + write(" {"); writeLine(); + increaseIndent(); + if (bodyIsBlock) { + emitLines(node.statement.statements); + } + else { + emit(node.statement); + } + writeLine(); + copyLoopOutParameters(convertedLoopState, 1, true); + decreaseIndent(); + writeLine(); + write("};"); + writeLine(); + if (loopOutParameters) { + write("var "); + for (var i = 0; i < loopOutParameters.length; i++) { + if (i !== 0) { + write(", "); + } + write(loopOutParameters[i].outParamName); + } + write(";"); + writeLine(); + } if (convertedLoopState.argumentsName) { if (convertedOuterLoopState) { convertedOuterLoopState.argumentsName = convertedLoopState.argumentsName; @@ -27317,13 +30617,22 @@ var ts; writeLine(); } } + if (convertedLoopState.thisName) { + if (convertedOuterLoopState) { + convertedOuterLoopState.thisName = convertedLoopState.thisName; + } + else { + write("var " + convertedLoopState.thisName + " = this;"); + writeLine(); + } + } if (convertedLoopState.hoistedLocalVariables) { if (convertedOuterLoopState) { convertedOuterLoopState.hoistedLocalVariables = convertedLoopState.hoistedLocalVariables; } else { write("var "); - var seen; + var seen = void 0; for (var _c = 0, _d = convertedLoopState.hoistedLocalVariables; _c < _d.length; _c++) { var id = _d[_c]; if (!seen) { @@ -27344,15 +30653,21 @@ var ts; var currentLoopState = convertedLoopState; convertedLoopState = convertedOuterLoopState; return { functionName: functionName, paramList: paramList, state: currentLoopState }; - function collectNames(name) { + function processVariableDeclaration(name) { if (name.kind === 69) { - var nameText = isNameOfNestedRedeclaration(name) ? getGeneratedNameForNode(name) : name.text; + var nameText = isNameOfNestedBlockScopedRedeclarationOrCapturedBinding(name) + ? getGeneratedNameForNode(name) + : name.text; loopParameters.push(nameText); + if (resolver.getNodeCheckFlags(name.parent) & 2097152) { + var reassignedVariable = { originalName: name, outParamName: makeUniqueName("out_" + nameText) }; + (loopOutParameters || (loopOutParameters = [])).push(reassignedVariable); + } } else { for (var _a = 0, _b = name.elements; _a < _b.length; _a++) { var element = _b[_a]; - collectNames(element.name); + processVariableDeclaration(element.name); } } } @@ -27366,7 +30681,7 @@ var ts; if (emitAsEmbeddedStatement) { emitEmbeddedStatement(node.statement); } - else if (node.statement.kind === 192) { + else if (node.statement.kind === 199) { emitLines(node.statement.statements); } else { @@ -27377,13 +30692,35 @@ var ts; convertedLoopState.allowedNonLabeledJumps = saveAllowedNonLabeledJumps; } } + function copyLoopOutParameters(state, copyDirection, emitAsStatements) { + if (state.loopOutParameters) { + for (var _a = 0, _b = state.loopOutParameters; _a < _b.length; _a++) { + var outParam = _b[_a]; + if (copyDirection === 0) { + emitIdentifier(outParam.originalName); + write(" = " + outParam.outParamName); + } + else { + write(outParam.outParamName + " = "); + emitIdentifier(outParam.originalName); + } + if (emitAsStatements) { + write(";"); + writeLine(); + } + else { + write(", "); + } + } + } + } function emitConvertedLoopCall(loop, emitAsBlock) { if (emitAsBlock) { write(" {"); writeLine(); increaseIndent(); } - var isSimpleLoop = !loop.state.nonLocalJumps && + var isSimpleLoop = !(loop.state.nonLocalJumps & ~4) && !loop.state.labeledNonLocalBreaks && !loop.state.labeledNonLocalContinues; var loopResult = makeUniqueName("state"); @@ -27391,6 +30728,8 @@ var ts; write("var " + loopResult + " = "); } write(loop.functionName + "(" + loop.paramList + ");"); + writeLine(); + copyLoopOutParameters(loop.state, 0, true); if (!isSimpleLoop) { writeLine(); if (loop.state.nonLocalJumps & 8) { @@ -27400,7 +30739,7 @@ var ts; convertedLoopState.nonLocalJumps |= 8; } else { - write("return " + loopResult + ".value"); + write("return " + loopResult + ".value;"); } writeLine(); } @@ -27408,10 +30747,6 @@ var ts; write("if (" + loopResult + " === \"break\") break;"); writeLine(); } - if (loop.state.nonLocalJumps & 4) { - write("if (" + loopResult + " === \"continue\") continue;"); - writeLine(); - } emitDispatchTableForLabeledJumps(loopResult, loop.state, convertedLoopState); } if (emitAsBlock) { @@ -27462,9 +30797,9 @@ var ts; var endPos = emitToken(86, node.pos); write(" "); endPos = emitToken(17, endPos); - if (node.initializer && node.initializer.kind === 212) { + if (node.initializer && node.initializer.kind === 219) { var variableDeclarationList = node.initializer; - var startIsEmitted = tryEmitStartOfVariableDeclarationList(variableDeclarationList, endPos); + var startIsEmitted = tryEmitStartOfVariableDeclarationList(variableDeclarationList); if (startIsEmitted) { emitCommaList(variableDeclarationList.declarations); } @@ -27488,7 +30823,7 @@ var ts; } } function emitForInOrForOfStatement(node) { - if (languageVersion < 2 && node.kind === 201) { + if (languageVersion < 2 && node.kind === 208) { emitLoop(node, emitDownLevelForOfStatementWorker); } else { @@ -27499,17 +30834,17 @@ var ts; var endPos = emitToken(86, node.pos); write(" "); endPos = emitToken(17, endPos); - if (node.initializer.kind === 212) { + if (node.initializer.kind === 219) { var variableDeclarationList = node.initializer; if (variableDeclarationList.declarations.length >= 1) { - tryEmitStartOfVariableDeclarationList(variableDeclarationList, endPos); + tryEmitStartOfVariableDeclarationList(variableDeclarationList); emit(variableDeclarationList.declarations[0]); } } else { emit(node.initializer); } - if (node.kind === 200) { + if (node.kind === 207) { write(" in "); } else { @@ -27524,9 +30859,6 @@ var ts; emitNormalLoopBody(node, true); } } - function emitDownLevelForOfStatement(node) { - emitLoop(node, emitDownLevelForOfStatementWorker); - } function emitDownLevelForOfStatementWorker(node, loop) { var endPos = emitToken(86, node.pos); write(" "); @@ -27548,24 +30880,24 @@ var ts; emitNodeWithoutSourceMap(node.expression); emitEnd(node.expression); write("; "); - emitStart(node.initializer); + emitStart(node.expression); emitNodeWithoutSourceMap(counter); write(" < "); emitNodeWithCommentsAndWithoutSourcemap(rhsReference); write(".length"); - emitEnd(node.initializer); + emitEnd(node.expression); write("; "); - emitStart(node.initializer); + emitStart(node.expression); emitNodeWithoutSourceMap(counter); write("++"); - emitEnd(node.initializer); + emitEnd(node.expression); emitToken(18, node.expression.end); write(" {"); writeLine(); increaseIndent(); var rhsIterationValue = createElementAccessExpression(rhsReference, counter); emitStart(node.initializer); - if (node.initializer.kind === 212) { + if (node.initializer.kind === 219) { write("var "); var variableDeclarationList = node.initializer; if (variableDeclarationList.declarations.length > 0) { @@ -27587,7 +30919,7 @@ var ts; } else { var assignmentExpression = createBinaryExpression(node.initializer, 56, rhsIterationValue, false); - if (node.initializer.kind === 164 || node.initializer.kind === 165) { + if (node.initializer.kind === 170 || node.initializer.kind === 171) { emitDestructuring(assignmentExpression, true, undefined); } else { @@ -27609,23 +30941,25 @@ var ts; } function emitBreakOrContinueStatement(node) { if (convertedLoopState) { - var jump = node.kind === 203 ? 2 : 4; + var jump = node.kind === 210 ? 2 : 4; var canUseBreakOrContinue = (node.label && convertedLoopState.labels && convertedLoopState.labels[node.label.text]) || (!node.label && (convertedLoopState.allowedNonLabeledJumps & jump)); if (!canUseBreakOrContinue) { + write("return "); + copyLoopOutParameters(convertedLoopState, 1, false); if (!node.label) { - if (node.kind === 203) { + if (node.kind === 210) { convertedLoopState.nonLocalJumps |= 2; - write("return \"break\";"); + write("\"break\";"); } else { convertedLoopState.nonLocalJumps |= 4; - write("return \"continue\";"); + write("\"continue\";"); } } else { - var labelMarker; - if (node.kind === 203) { + var labelMarker = void 0; + if (node.kind === 210) { labelMarker = "break-" + node.label.text; setLabeledJump(convertedLoopState, true, node.label.text, labelMarker); } @@ -27633,12 +30967,12 @@ var ts; labelMarker = "continue-" + node.label.text; setLabeledJump(convertedLoopState, false, node.label.text, labelMarker); } - write("return \"" + labelMarker + "\";"); + write("\"" + labelMarker + "\";"); } return; } } - emitToken(node.kind === 203 ? 70 : 75, node.pos); + emitToken(node.kind === 210 ? 70 : 75, node.pos); emitOptional(" ", node.label); write(";"); } @@ -27703,7 +31037,7 @@ var ts; ts.getLineOfLocalPositionFromLineMap(currentLineMap, ts.skipTrivia(currentText, node2.pos)); } function emitCaseOrDefaultClause(node) { - if (node.kind === 241) { + if (node.kind === 249) { write("case "); emit(node.expression); write(":"); @@ -27772,7 +31106,7 @@ var ts; function getContainingModule(node) { do { node = node.parent; - } while (node && node.kind !== 218); + } while (node && node.kind !== 225); return node; } function emitContainingModuleName(node) { @@ -27781,13 +31115,13 @@ var ts; } function emitModuleMemberName(node) { emitStart(node.name); - if (ts.getCombinedNodeFlags(node) & 2) { + if (ts.getCombinedNodeFlags(node) & 1) { var container = getContainingModule(node); if (container) { write(getGeneratedNameForNode(container)); write("."); } - else if (modulekind !== 5 && modulekind !== 4) { + else if (modulekind !== ts.ModuleKind.ES6 && modulekind !== ts.ModuleKind.System) { write("exports."); } } @@ -27797,20 +31131,20 @@ var ts; function createVoidZero() { var zero = ts.createSynthesizedNode(8); zero.text = "0"; - var result = ts.createSynthesizedNode(177); + var result = ts.createSynthesizedNode(183); result.expression = zero; return result; } function emitEs6ExportDefaultCompat(node) { - if (node.parent.kind === 248) { - ts.Debug.assert(!!(node.flags & 512) || node.kind === 227); - if (modulekind === 1 || modulekind === 2 || modulekind === 3) { + if (node.parent.kind === 256) { + ts.Debug.assert(!!(node.flags & 512) || node.kind === 235); + if (modulekind === ts.ModuleKind.CommonJS || modulekind === ts.ModuleKind.AMD || modulekind === ts.ModuleKind.UMD) { if (!isEs6Module) { - if (languageVersion === 1) { - write("Object.defineProperty(exports, \"__esModule\", { value: true });"); + if (languageVersion !== 0) { + write('Object.defineProperty(exports, "__esModule", { value: true });'); writeLine(); } - else if (languageVersion === 0) { + else { write("exports.__esModule = true;"); writeLine(); } @@ -27819,10 +31153,10 @@ var ts; } } function emitExportMemberAssignment(node) { - if (node.flags & 2) { + if (node.flags & 1) { writeLine(); emitStart(node); - if (modulekind === 4 && node.parent === currentSourceFile) { + if (modulekind === ts.ModuleKind.System && node.parent === currentSourceFile) { write(exportFunctionForFile + "(\""); if (node.flags & 512) { write("default"); @@ -27838,7 +31172,7 @@ var ts; if (node.flags & 512) { emitEs6ExportDefaultCompat(node); if (languageVersion === 0) { - write("exports[\"default\"]"); + write('exports["default"]'); } else { write("exports.default"); @@ -27855,7 +31189,7 @@ var ts; } } function emitExportMemberAssignments(name) { - if (modulekind === 4) { + if (modulekind === ts.ModuleKind.System) { return; } if (!exportEquals && exportSpecifiers && ts.hasProperty(exportSpecifiers, name.text)) { @@ -27874,7 +31208,7 @@ var ts; } } function emitExportSpecifierInSystemModule(specifier) { - ts.Debug.assert(modulekind === 4); + ts.Debug.assert(modulekind === ts.ModuleKind.System); if (!resolver.getReferencedValueDeclaration(specifier.propertyName || specifier.name) && !resolver.isValueAliasDeclaration(specifier)) { return; } @@ -27888,7 +31222,7 @@ var ts; emitEnd(specifier.name); write(";"); } - function emitAssignment(name, value, shouldEmitCommaBeforeAssignment) { + function emitAssignment(name, value, shouldEmitCommaBeforeAssignment, nodeForSourceMap) { if (shouldEmitCommaBeforeAssignment) { write(", "); } @@ -27898,63 +31232,75 @@ var ts; emitNodeWithCommentsAndWithoutSourcemap(name); write("\", "); } - var isVariableDeclarationOrBindingElement = name.parent && (name.parent.kind === 211 || name.parent.kind === 163); - if (isVariableDeclarationOrBindingElement) { - emitModuleMemberName(name.parent); - } - else { - emit(name); - } - write(" = "); - emit(value); + var isVariableDeclarationOrBindingElement = name.parent && (name.parent.kind === 218 || name.parent.kind === 169); + emitStart(isFirstVariableDeclaration(nodeForSourceMap) ? nodeForSourceMap.parent : nodeForSourceMap); + withTemporaryNoSourceMap(function () { + if (isVariableDeclarationOrBindingElement) { + emitModuleMemberName(name.parent); + } + else { + emit(name); + } + write(" = "); + emit(value); + }); + emitEnd(nodeForSourceMap, true); if (exportChanged) { write(")"); } } - function emitTempVariableAssignment(expression, canDefineTempVariablesInPlace, shouldEmitCommaBeforeAssignment) { + function emitTempVariableAssignment(expression, canDefineTempVariablesInPlace, shouldEmitCommaBeforeAssignment, sourceMapNode) { var identifier = createTempVariable(0); if (!canDefineTempVariablesInPlace) { recordTempDeclaration(identifier); } - emitAssignment(identifier, expression, shouldEmitCommaBeforeAssignment); + emitAssignment(identifier, expression, shouldEmitCommaBeforeAssignment, sourceMapNode || expression.parent); return identifier; } + function isFirstVariableDeclaration(root) { + return root.kind === 218 && + root.parent.kind === 219 && + root.parent.declarations[0] === root; + } function emitDestructuring(root, isAssignmentExpressionStatement, value) { var emitCount = 0; var canDefineTempVariablesInPlace = false; - if (root.kind === 211) { - var isExported = ts.getCombinedNodeFlags(root) & 2; + if (root.kind === 218) { + var isExported = ts.getCombinedNodeFlags(root) & 1; var isSourceLevelForSystemModuleKind = shouldHoistDeclarationInSystemJsModule(root); canDefineTempVariablesInPlace = !isExported && !isSourceLevelForSystemModuleKind; } - else if (root.kind === 138) { + else if (root.kind === 142) { canDefineTempVariablesInPlace = true; } - if (root.kind === 181) { + if (root.kind === 187) { emitAssignmentExpression(root); } else { ts.Debug.assert(!isAssignmentExpressionStatement); + if (isFirstVariableDeclaration(root)) { + sourceMap.changeEmitSourcePos(); + } emitBindingElement(root, value); } - function ensureIdentifier(expr, reuseIdentifierExpressions) { + function ensureIdentifier(expr, reuseIdentifierExpressions, sourceMapNode) { if (expr.kind === 69 && reuseIdentifierExpressions) { return expr; } - var identifier = emitTempVariableAssignment(expr, canDefineTempVariablesInPlace, emitCount > 0); + var identifier = emitTempVariableAssignment(expr, canDefineTempVariablesInPlace, emitCount > 0, sourceMapNode); emitCount++; return identifier; } - function createDefaultValueCheck(value, defaultValue) { - value = ensureIdentifier(value, true); - var equals = ts.createSynthesizedNode(181); + function createDefaultValueCheck(value, defaultValue, sourceMapNode) { + value = ensureIdentifier(value, true, sourceMapNode); + var equals = ts.createSynthesizedNode(187); equals.left = value; equals.operatorToken = ts.createSynthesizedNode(32); equals.right = createVoidZero(); return createConditionalExpression(equals, defaultValue, value); } function createConditionalExpression(condition, whenTrue, whenFalse) { - var cond = ts.createSynthesizedNode(182); + var cond = ts.createSynthesizedNode(188); cond.condition = condition; cond.questionToken = ts.createSynthesizedNode(53); cond.whenTrue = whenTrue; @@ -27969,20 +31315,20 @@ var ts; } function createPropertyAccessForDestructuringProperty(object, propName) { var index; - var nameIsComputed = propName.kind === 136; + var nameIsComputed = propName.kind === 140; if (nameIsComputed) { - index = ensureIdentifier(propName.expression, false); + index = ensureIdentifier(propName.expression, false, propName); } else { index = ts.createSynthesizedNode(propName.kind); - index.text = propName.text; + index.text = ts.unescapeIdentifier(propName.text); } return !nameIsComputed && index.kind === 69 ? createPropertyAccessExpression(object, index) : createElementAccessExpression(object, index); } function createSliceCall(value, sliceIndex) { - var call = ts.createSynthesizedNode(168); + var call = ts.createSynthesizedNode(174); var sliceIdentifier = ts.createSynthesizedNode(69); sliceIdentifier.text = "slice"; call.expression = createPropertyAccessExpression(value, sliceIdentifier); @@ -27990,56 +31336,56 @@ var ts; call.arguments[0] = createNumericLiteral(sliceIndex); return call; } - function emitObjectLiteralAssignment(target, value) { + function emitObjectLiteralAssignment(target, value, sourceMapNode) { var properties = target.properties; if (properties.length !== 1) { - value = ensureIdentifier(value, true); + value = ensureIdentifier(value, true, sourceMapNode); } for (var _a = 0, properties_5 = properties; _a < properties_5.length; _a++) { var p = properties_5[_a]; - if (p.kind === 245 || p.kind === 246) { + if (p.kind === 253 || p.kind === 254) { var propName = p.name; - var target_1 = p.kind === 246 ? p : p.initializer || propName; - emitDestructuringAssignment(target_1, createPropertyAccessForDestructuringProperty(value, propName)); + var target_1 = p.kind === 254 ? p : p.initializer || propName; + emitDestructuringAssignment(target_1, createPropertyAccessForDestructuringProperty(value, propName), p); } } } - function emitArrayLiteralAssignment(target, value) { + function emitArrayLiteralAssignment(target, value, sourceMapNode) { var elements = target.elements; if (elements.length !== 1) { - value = ensureIdentifier(value, true); + value = ensureIdentifier(value, true, sourceMapNode); } for (var i = 0; i < elements.length; i++) { var e = elements[i]; - if (e.kind !== 187) { - if (e.kind !== 185) { - emitDestructuringAssignment(e, createElementAccessExpression(value, createNumericLiteral(i))); + if (e.kind !== 193) { + if (e.kind !== 191) { + emitDestructuringAssignment(e, createElementAccessExpression(value, createNumericLiteral(i)), e); } else if (i === elements.length - 1) { - emitDestructuringAssignment(e.expression, createSliceCall(value, i)); + emitDestructuringAssignment(e.expression, createSliceCall(value, i), e); } } } } - function emitDestructuringAssignment(target, value) { - if (target.kind === 246) { + function emitDestructuringAssignment(target, value, sourceMapNode) { + if (target.kind === 254) { if (target.objectAssignmentInitializer) { - value = createDefaultValueCheck(value, target.objectAssignmentInitializer); + value = createDefaultValueCheck(value, target.objectAssignmentInitializer, sourceMapNode); } target = target.name; } - else if (target.kind === 181 && target.operatorToken.kind === 56) { - value = createDefaultValueCheck(value, target.right); + else if (target.kind === 187 && target.operatorToken.kind === 56) { + value = createDefaultValueCheck(value, target.right, sourceMapNode); target = target.left; } - if (target.kind === 165) { - emitObjectLiteralAssignment(target, value); + if (target.kind === 171) { + emitObjectLiteralAssignment(target, value, sourceMapNode); } - else if (target.kind === 164) { - emitArrayLiteralAssignment(target, value); + else if (target.kind === 170) { + emitArrayLiteralAssignment(target, value, sourceMapNode); } else { - emitAssignment(target, value, emitCount > 0); + emitAssignment(target, value, emitCount > 0, sourceMapNode); emitCount++; } } @@ -28050,24 +31396,24 @@ var ts; emit(value); } else if (isAssignmentExpressionStatement) { - emitDestructuringAssignment(target, value); + emitDestructuringAssignment(target, value, ts.nodeIsSynthesized(root) ? target : root); } else { - if (root.parent.kind !== 172) { + if (root.parent.kind !== 178) { write("("); } - value = ensureIdentifier(value, true); - emitDestructuringAssignment(target, value); + value = ensureIdentifier(value, true, root); + emitDestructuringAssignment(target, value, root); write(", "); emit(value); - if (root.parent.kind !== 172) { + if (root.parent.kind !== 178) { write(")"); } } } function emitBindingElement(target, value) { if (target.initializer) { - value = value ? createDefaultValueCheck(value, target.initializer) : target.initializer; + value = value ? createDefaultValueCheck(value, target.initializer, target) : target.initializer; } else if (!value) { value = createVoidZero(); @@ -28077,15 +31423,15 @@ var ts; var elements = pattern.elements; var numElements = elements.length; if (numElements !== 1) { - value = ensureIdentifier(value, numElements !== 0); + value = ensureIdentifier(value, numElements !== 0, target); } for (var i = 0; i < numElements; i++) { var element = elements[i]; - if (pattern.kind === 161) { + if (pattern.kind === 167) { var propName = element.propertyName || element.name; emitBindingElement(element, createPropertyAccessForDestructuringProperty(value, propName)); } - else if (element.kind !== 187) { + else if (element.kind !== 193) { if (!element.dotDotDotToken) { emitBindingElement(element, createElementAccessExpression(value, createNumericLiteral(i))); } @@ -28096,29 +31442,49 @@ var ts; } } else { - emitAssignment(target.name, value, emitCount > 0); + emitAssignment(target.name, value, emitCount > 0, target); emitCount++; } } } function emitVariableDeclaration(node) { if (ts.isBindingPattern(node.name)) { - if (languageVersion < 2) { - emitDestructuring(node, false); - } - else { + var isExported = ts.getCombinedNodeFlags(node) & 1; + if (languageVersion >= 2 && (!isExported || modulekind === ts.ModuleKind.ES6)) { + var isTopLevelDeclarationInSystemModule = modulekind === ts.ModuleKind.System && + shouldHoistVariable(node, true); + if (isTopLevelDeclarationInSystemModule) { + write("("); + } emit(node.name); emitOptional(" = ", node.initializer); + if (isTopLevelDeclarationInSystemModule) { + write(")"); + } + } + else { + emitDestructuring(node, false); } } else { var initializer = node.initializer; - if (!initializer && languageVersion < 2) { - var isLetDefinedInLoop = (resolver.getNodeCheckFlags(node) & 16384) && - (getCombinedFlagsForIdentifier(node.name) & 8192); - if (isLetDefinedInLoop && - node.parent.parent.kind !== 200 && - node.parent.parent.kind !== 201) { + if (!initializer && + languageVersion < 2 && + node.name.kind === 69) { + var container = ts.getEnclosingBlockScopeContainer(node); + var flags = resolver.getNodeCheckFlags(node); + var isCapturedInFunction = flags & 131072; + var isDeclaredInLoop = flags & 262144; + var emittedAsTopLevel = ts.isBlockScopedContainerTopLevel(container) || + (isCapturedInFunction && isDeclaredInLoop && container.kind === 199 && ts.isIterationStatement(container.parent, false)); + var emittedAsNestedLetDeclaration = ts.getCombinedNodeFlags(node) & 1024 && + !emittedAsTopLevel; + var emitExplicitInitializer = emittedAsNestedLetDeclaration && + container.kind !== 207 && + container.kind !== 208 && + (!resolver.isDeclarationWithCollidingName(node) || + (isDeclaredInLoop && !isCapturedInFunction && !ts.isIterationStatement(container, false))); + if (emitExplicitInitializer) { initializer = createVoidZero(); } } @@ -28136,7 +31502,7 @@ var ts; } } function emitExportVariableAssignments(node) { - if (node.kind === 187) { + if (node.kind === 193) { return; } var name = node.name; @@ -28147,20 +31513,14 @@ var ts; ts.forEach(name.elements, emitExportVariableAssignments); } } - function getCombinedFlagsForIdentifier(node) { - if (!node.parent || (node.parent.kind !== 211 && node.parent.kind !== 163)) { - return 0; - } - return ts.getCombinedNodeFlags(node.parent); - } function isES6ExportedDeclaration(node) { - return !!(node.flags & 2) && - modulekind === 5 && - node.parent.kind === 248; + return !!(node.flags & 1) && + modulekind === ts.ModuleKind.ES6 && + node.parent.kind === 256; } function emitVariableStatement(node) { var startIsEmitted = false; - if (node.flags & 2) { + if (node.flags & 1) { if (isES6ExportedDeclaration(node)) { write("export "); startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList); @@ -28179,12 +31539,12 @@ var ts; write(";"); } } - if (modulekind !== 5 && node.parent === currentSourceFile) { + if (modulekind !== ts.ModuleKind.ES6 && node.parent === currentSourceFile) { ts.forEach(node.declarationList.declarations, emitExportVariableAssignments); } } function shouldEmitLeadingAndTrailingCommentsForVariableStatement(node) { - if (!(node.flags & 2)) { + if (!(node.flags & 1)) { return true; } if (isES6ExportedDeclaration(node)) { @@ -28201,12 +31561,12 @@ var ts; function emitParameter(node) { if (languageVersion < 2) { if (ts.isBindingPattern(node.name)) { - var name_25 = createTempVariable(0); + var name_28 = createTempVariable(0); if (!tempParameters) { tempParameters = []; } - tempParameters.push(name_25); - emit(name_25); + tempParameters.push(name_28); + emit(name_28); } else { emit(node.name); @@ -28222,7 +31582,7 @@ var ts; } function emitDefaultValueAssignments(node) { if (languageVersion < 2) { - var tempIndex = 0; + var tempIndex_1 = 0; ts.forEach(node.parameters, function (parameter) { if (parameter.dotDotDotToken) { return; @@ -28234,15 +31594,15 @@ var ts; writeLine(); write("var "); if (hasBindingElements) { - emitDestructuring(parameter, false, tempParameters[tempIndex]); + emitDestructuring(parameter, false, tempParameters[tempIndex_1]); } else { - emit(tempParameters[tempIndex]); + emit(tempParameters[tempIndex_1]); write(" = "); emit(initializer); } write(";"); - tempIndex++; + tempIndex_1++; } } else if (initializer) { @@ -28264,7 +31624,7 @@ var ts; } } function emitRestParameter(node) { - if (languageVersion < 2 && ts.hasRestParameter(node)) { + if (languageVersion < 2 && ts.hasDeclaredRestParameter(node)) { var restIndex = node.parameters.length - 1; var restParam = node.parameters[restIndex]; if (ts.isBindingPattern(restParam.name)) { @@ -28305,12 +31665,12 @@ var ts; } } function emitAccessor(node) { - write(node.kind === 145 ? "get " : "set "); + write(node.kind === 149 ? "get " : "set "); emit(node.name); emitSignatureAndBody(node); } function shouldEmitAsArrowFunction(node) { - return node.kind === 174 && languageVersion >= 2; + return node.kind === 180 && languageVersion >= 2; } function emitDeclarationName(node) { if (node.name) { @@ -28321,20 +31681,24 @@ var ts; } } function shouldEmitFunctionName(node) { - if (node.kind === 173) { + if (node.kind === 179) { return !!node.name; } - if (node.kind === 213) { - return !!node.name || languageVersion < 2; + if (node.kind === 220) { + return !!node.name || modulekind !== ts.ModuleKind.ES6; } } function emitFunctionDeclaration(node) { if (ts.nodeIsMissing(node.body)) { return emitCommentsOnNotEmittedNode(node); } - if (node.kind !== 143 && node.kind !== 142 && - node.parent && node.parent.kind !== 245 && - node.parent.kind !== 168) { + var kind = node.kind, parent = node.parent; + if (kind !== 147 && + kind !== 146 && + parent && + parent.kind !== 253 && + parent.kind !== 174 && + parent.kind !== 170) { emitLeadingComments(node); } emitStart(node); @@ -28355,11 +31719,13 @@ var ts; emitDeclarationName(node); } emitSignatureAndBody(node); - if (modulekind !== 5 && node.kind === 213 && node.parent === currentSourceFile && node.name) { + if (modulekind !== ts.ModuleKind.ES6 && kind === 220 && parent === currentSourceFile && node.name) { emitExportMemberAssignments(node.name); } emitEnd(node); - if (node.kind !== 143 && node.kind !== 142) { + if (kind !== 147 && + kind !== 146 && + kind !== 180) { emitTrailingComments(node); } } @@ -28376,8 +31742,9 @@ var ts; write("("); if (node) { var parameters = node.parameters; - var omitCount = languageVersion < 2 && ts.hasRestParameter(node) ? 1 : 0; - emitList(parameters, 0, parameters.length - omitCount, false, false); + var skipCount = node.parameters.length && node.parameters[0].name.text === "this" ? 1 : 0; + var omitCount = languageVersion < 2 && ts.hasDeclaredRestParameter(node) ? 1 : 0; + emitList(parameters, skipCount, parameters.length - omitCount - skipCount, false, false); } write(")"); decreaseIndent(); @@ -28391,34 +31758,36 @@ var ts; } function emitAsyncFunctionBodyForES6(node) { var promiseConstructor = ts.getEntityNameFromTypeNode(node.type); - var isArrowFunction = node.kind === 174; - var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 4096) !== 0; + var isArrowFunction = node.kind === 180; + var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 8192) !== 0; if (!isArrowFunction) { write(" {"); increaseIndent(); writeLine(); + if (resolver.getNodeCheckFlags(node) & 4096) { + writeLines("\nconst _super = (function (geti, seti) {\n const cache = Object.create(null);\n return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });\n})(name => super[name], (name, value) => super[name] = value);"); + writeLine(); + } + else if (resolver.getNodeCheckFlags(node) & 2048) { + write("const _super = name => super[name];"); + writeLine(); + } write("return"); } write(" __awaiter(this"); if (hasLexicalArguments) { - write(", arguments"); + write(", arguments, "); } else { - write(", void 0"); + write(", void 0, "); } - if (promiseConstructor) { - write(", "); - emitNodeWithoutSourceMap(promiseConstructor); + if (languageVersion >= 2 || !promiseConstructor) { + write("void 0"); } else { - write(", Promise"); - } - if (hasLexicalArguments) { - write(", function* (_arguments)"); - } - else { - write(", function* ()"); + emitEntityNameAsExpression(promiseConstructor, false); } + write(", function* ()"); emitFunctionBody(node); write(")"); if (!isArrowFunction) { @@ -28433,7 +31802,7 @@ var ts; write(" { }"); } else { - if (node.body.kind === 192) { + if (node.body.kind === 199) { emitBlockFunctionBody(node, node.body); } else { @@ -28458,7 +31827,7 @@ var ts; emitSignatureParameters(node); } var isAsync = ts.isAsyncFunctionLike(node); - if (isAsync && languageVersion === 2) { + if (isAsync) { emitAsyncFunctionBodyForES6(node); } else { @@ -28485,14 +31854,13 @@ var ts; } write(" "); var current = body; - while (current.kind === 171) { + while (current.kind === 177) { current = current.expression; } - emitParenthesizedIf(body, current.kind === 165); + emitParenthesizedIf(body, current.kind === 171); } function emitDownLevelExpressionFunctionBody(node, body) { write(" {"); - scopeEmitStart(node); increaseIndent(); var outPos = writer.getTextPos(); emitDetachedCommentsAndUpdateCommentsInfo(node.body); @@ -28513,8 +31881,10 @@ var ts; increaseIndent(); writeLine(); emitLeadingComments(node.body); + emitStart(body); write("return "); emit(body); + emitEnd(body); write(";"); emitTrailingComments(node.body); emitTempDeclarations(true); @@ -28524,11 +31894,9 @@ var ts; emitStart(node.body); write("}"); emitEnd(node.body); - scopeEmitEnd(); } function emitBlockFunctionBody(node, body) { write(" {"); - scopeEmitStart(node); var initialTextPos = writer.getTextPos(); increaseIndent(); emitDetachedCommentsAndUpdateCommentsInfo(body.statements); @@ -28555,25 +31923,23 @@ var ts; decreaseIndent(); } emitToken(16, body.statements.end); - scopeEmitEnd(); } - function findInitialSuperCall(ctor) { - if (ctor.body) { - var statement = ctor.body.statements[0]; - if (statement && statement.kind === 195) { - var expr = statement.expression; - if (expr && expr.kind === 168) { - var func = expr.expression; - if (func && func.kind === 95) { - return statement; - } - } - } + function getSuperCallAtGivenIndex(ctor, index) { + if (!ctor.body) { + return undefined; + } + var statements = ctor.body.statements; + if (!statements || index >= statements.length) { + return undefined; + } + var statement = statements[index]; + if (statement.kind === 202) { + return ts.isSuperCallExpression(statement.expression) ? statement : undefined; } } function emitParameterPropertyAssignments(node) { ts.forEach(node.parameters, function (param) { - if (param.flags & 56) { + if (param.flags & 92) { writeLine(); emitStart(param); emitStart(param.name); @@ -28593,7 +31959,7 @@ var ts; emitNodeWithCommentsAndWithoutSourcemap(memberName); write("]"); } - else if (memberName.kind === 136) { + else if (memberName.kind === 140) { emitComputedPropertyName(memberName); } else { @@ -28605,7 +31971,7 @@ var ts; var properties = []; for (var _a = 0, _b = node.members; _a < _b.length; _a++) { var member = _b[_a]; - if (member.kind === 141 && isStatic === ((member.flags & 64) !== 0) && member.initializer) { + if (member.kind === 145 && isStatic === ((member.flags & 32) !== 0) && member.initializer) { properties.push(member); } } @@ -28626,7 +31992,7 @@ var ts; emit(receiver); } else { - if (property.flags & 64) { + if (property.flags & 32) { emitDeclarationName(node); } else { @@ -28645,11 +32011,11 @@ var ts; } function emitMemberFunctionsForES5AndLower(node) { ts.forEach(node.members, function (member) { - if (member.kind === 191) { + if (member.kind === 198) { writeLine(); write(";"); } - else if (member.kind === 143 || node.kind === 142) { + else if (member.kind === 147 || node.kind === 146) { if (!member.body) { return emitCommentsOnNotEmittedNode(member); } @@ -28666,7 +32032,7 @@ var ts; write(";"); emitTrailingComments(member); } - else if (member.kind === 145 || member.kind === 146) { + else if (member.kind === 149 || member.kind === 150) { var accessors = ts.getAllAccessorDeclarations(node.members, member); if (member === accessors.firstAccessor) { writeLine(); @@ -28716,22 +32082,22 @@ var ts; function emitMemberFunctionsForES6AndHigher(node) { for (var _a = 0, _b = node.members; _a < _b.length; _a++) { var member = _b[_a]; - if ((member.kind === 143 || node.kind === 142) && !member.body) { + if ((member.kind === 147 || node.kind === 146) && !member.body) { emitCommentsOnNotEmittedNode(member); } - else if (member.kind === 143 || - member.kind === 145 || - member.kind === 146) { + else if (member.kind === 147 || + member.kind === 149 || + member.kind === 150) { writeLine(); emitLeadingComments(member); emitStart(member); - if (member.flags & 64) { + if (member.flags & 32) { write("static "); } - if (member.kind === 145) { + if (member.kind === 149) { write("get "); } - else if (member.kind === 146) { + else if (member.kind === 150) { write("set "); } if (member.asteriskToken) { @@ -28742,7 +32108,7 @@ var ts; emitEnd(member); emitTrailingComments(member); } - else if (member.kind === 191) { + else if (member.kind === 198) { writeLine(); write(";"); } @@ -28767,10 +32133,10 @@ var ts; function emitConstructorWorker(node, baseTypeElement) { var hasInstancePropertyWithInitializer = false; ts.forEach(node.members, function (member) { - if (member.kind === 144 && !member.body) { + if (member.kind === 148 && !member.body) { emitCommentsOnNotEmittedNode(member); } - if (member.kind === 141 && member.initializer && (member.flags & 64) === 0) { + if (member.kind === 145 && member.initializer && (member.flags & 32) === 0) { hasInstancePropertyWithInitializer = true; } }); @@ -28803,7 +32169,6 @@ var ts; } var startIndex = 0; write(" {"); - scopeEmitStart(node, "constructor"); increaseIndent(); if (ctor) { startIndex = emitDirectivePrologues(ctor.body.statements, true); @@ -28815,7 +32180,7 @@ var ts; emitDefaultValueAssignments(ctor); emitRestParameter(ctor); if (baseTypeElement) { - superCall = findInitialSuperCall(ctor); + superCall = getSuperCallAtGivenIndex(ctor, startIndex); if (superCall) { writeLine(); emit(superCall); @@ -28851,7 +32216,6 @@ var ts; } decreaseIndent(); emitToken(16, ctor ? ctor.body.statements.end : node.members.end); - scopeEmitEnd(); emitEnd(ctor || node); if (ctor) { emitTrailingComments(ctor); @@ -28870,19 +32234,33 @@ var ts; else { emitClassLikeDeclarationForES6AndHigher(node); } - if (modulekind !== 5 && node.parent === currentSourceFile && node.name) { + if (modulekind !== ts.ModuleKind.ES6 && node.parent === currentSourceFile && node.name) { emitExportMemberAssignments(node.name); } } function emitClassLikeDeclarationForES6AndHigher(node) { - var thisNodeIsDecorated = ts.nodeIsDecorated(node); - if (node.kind === 214) { - if (thisNodeIsDecorated) { + var decoratedClassAlias; + var isHoistedDeclarationInSystemModule = shouldHoistDeclarationInSystemJsModule(node); + var isDecorated = ts.nodeIsDecorated(node); + var rewriteAsClassExpression = isDecorated || isHoistedDeclarationInSystemModule; + if (node.kind === 221) { + if (rewriteAsClassExpression) { + if (isDecorated && resolver.getNodeCheckFlags(node) & 524288) { + decoratedClassAlias = ts.unescapeIdentifier(makeUniqueName(node.name ? node.name.text : "default")); + decoratedClassAliases[ts.getNodeId(node)] = decoratedClassAlias; + write("let " + decoratedClassAlias + ";"); + writeLine(); + } if (isES6ExportedDeclaration(node) && !(node.flags & 512)) { write("export "); } - write("let "); + if (!isHoistedDeclarationInSystemModule) { + write("let "); + } emitDeclarationName(node); + if (decoratedClassAlias !== undefined) { + write(" = " + decoratedClassAlias); + } write(" = "); } else if (isES6ExportedDeclaration(node)) { @@ -28893,7 +32271,7 @@ var ts; } } var staticProperties = getInitializedProperties(node, true); - var isClassExpressionWithStaticProperties = staticProperties.length > 0 && node.kind === 186; + var isClassExpressionWithStaticProperties = staticProperties.length > 0 && node.kind === 192; var tempVariable; if (isClassExpressionWithStaticProperties) { tempVariable = createAndRecordTempVariable(0); @@ -28903,7 +32281,7 @@ var ts; write(" = "); } write("class"); - if ((node.name || (node.flags & 512 && staticProperties.length > 0)) && !thisNodeIsDecorated) { + if (node.name || (node.flags & 512 && (staticProperties.length > 0 || modulekind !== ts.ModuleKind.ES6) && !rewriteAsClassExpression)) { write(" "); emitDeclarationName(node); } @@ -28914,15 +32292,14 @@ var ts; } write(" {"); increaseIndent(); - scopeEmitStart(node); writeLine(); emitConstructor(node, baseTypeNode); emitMemberFunctionsForES6AndHigher(node); decreaseIndent(); writeLine(); emitToken(16, node.members.end); - scopeEmitEnd(); - if (thisNodeIsDecorated) { + if (rewriteAsClassExpression) { + decoratedClassAliases[ts.getNodeId(node)] = undefined; write(";"); } if (isClassExpressionWithStaticProperties) { @@ -28941,26 +32318,36 @@ var ts; else { writeLine(); emitPropertyDeclarations(node, staticProperties); - emitDecoratorsOfClass(node); + emitDecoratorsOfClass(node, decoratedClassAlias); } - if (!isES6ExportedDeclaration(node) && (node.flags & 2)) { - writeLine(); - emitStart(node); - emitModuleMemberName(node); - write(" = "); - emitDeclarationName(node); - emitEnd(node); - write(";"); + if (!(node.flags & 1)) { + return; } - else if (isES6ExportedDeclaration(node) && (node.flags & 512) && thisNodeIsDecorated) { - writeLine(); - write("export default "); - emitDeclarationName(node); - write(";"); + if (modulekind !== ts.ModuleKind.ES6) { + emitExportMemberAssignment(node); + } + else { + if (node.flags & 512) { + if (isDecorated) { + writeLine(); + write("export default "); + emitDeclarationName(node); + write(";"); + } + } + else if (node.parent.kind !== 256) { + writeLine(); + emitStart(node); + emitModuleMemberName(node); + write(" = "); + emitDeclarationName(node); + emitEnd(node); + write(";"); + } } } function emitClassLikeDeclarationBelowES6(node) { - if (node.kind === 214) { + if (node.kind === 221) { if (!shouldHoistDeclarationInSystemJsModule(node)) { write("var "); } @@ -28984,7 +32371,6 @@ var ts; tempParameters = undefined; computedPropertyNamesToGeneratedNames = undefined; increaseIndent(); - scopeEmitStart(node); if (baseTypeNode) { writeLine(); emitStart(baseTypeNode); @@ -28998,7 +32384,7 @@ var ts; emitMemberFunctionsForES5AndLower(node); emitPropertyDeclarations(node, getInitializedProperties(node, true)); writeLine(); - emitDecoratorsOfClass(node); + emitDecoratorsOfClass(node, undefined); writeLine(); emitToken(16, node.members.end, function () { write("return "); @@ -29015,73 +32401,71 @@ var ts; decreaseIndent(); writeLine(); emitToken(16, node.members.end); - scopeEmitEnd(); emitStart(node); - write(")("); + write("("); if (baseTypeNode) { emit(baseTypeNode.expression); } - write(")"); - if (node.kind === 214) { + write("))"); + if (node.kind === 221) { write(";"); } emitEnd(node); - if (node.kind === 214) { + if (node.kind === 221) { emitExportMemberAssignment(node); } } function emitClassMemberPrefix(node, member) { emitDeclarationName(node); - if (!(member.flags & 64)) { + if (!(member.flags & 32)) { write(".prototype"); } } - function emitDecoratorsOfClass(node) { + function emitDecoratorsOfClass(node, decoratedClassAlias) { emitDecoratorsOfMembers(node, 0); - emitDecoratorsOfMembers(node, 64); - emitDecoratorsOfConstructor(node); + emitDecoratorsOfMembers(node, 32); + emitDecoratorsOfConstructor(node, decoratedClassAlias); } - function emitDecoratorsOfConstructor(node) { + function emitDecoratorsOfConstructor(node, decoratedClassAlias) { var decorators = node.decorators; var constructor = ts.getFirstConstructorWithBody(node); - var hasDecoratedParameters = constructor && ts.forEach(constructor.parameters, ts.nodeIsDecorated); - if (!decorators && !hasDecoratedParameters) { + var firstParameterDecorator = constructor && ts.forEach(constructor.parameters, function (parameter) { return parameter.decorators; }); + if (!decorators && !firstParameterDecorator) { return; } writeLine(); - emitStart(node); + emitStart(node.decorators || firstParameterDecorator); emitDeclarationName(node); + if (decoratedClassAlias !== undefined) { + write(" = " + decoratedClassAlias); + } write(" = __decorate(["); increaseIndent(); writeLine(); var decoratorCount = decorators ? decorators.length : 0; - var argumentsWritten = emitList(decorators, 0, decoratorCount, true, false, false, true, function (decorator) { - emitStart(decorator); - emit(decorator.expression); - emitEnd(decorator); - }); - argumentsWritten += emitDecoratorsOfParameters(constructor, argumentsWritten > 0); + var argumentsWritten = emitList(decorators, 0, decoratorCount, true, false, false, true, function (decorator) { return emit(decorator.expression); }); + if (firstParameterDecorator) { + argumentsWritten += emitDecoratorsOfParameters(constructor, argumentsWritten > 0); + } emitSerializedTypeMetadata(node, argumentsWritten >= 0); decreaseIndent(); writeLine(); write("], "); emitDeclarationName(node); - write(");"); - emitEnd(node); + write(")"); + emitEnd(node.decorators || firstParameterDecorator); + write(";"); writeLine(); } function emitDecoratorsOfMembers(node, staticFlag) { for (var _a = 0, _b = node.members; _a < _b.length; _a++) { var member = _b[_a]; - if ((member.flags & 64) !== staticFlag) { + if ((member.flags & 32) !== staticFlag) { continue; } if (!ts.nodeCanBeDecorated(member)) { continue; } - if (!ts.nodeOrChildIsDecorated(member)) { - continue; - } var decorators = void 0; var functionLikeMember = void 0; if (ts.isAccessor(member)) { @@ -29097,107 +32481,106 @@ var ts; } else { decorators = member.decorators; - if (member.kind === 143) { + if (member.kind === 147) { functionLikeMember = member; } } + var firstParameterDecorator = functionLikeMember && ts.forEach(functionLikeMember.parameters, function (parameter) { return parameter.decorators; }); + if (!decorators && !firstParameterDecorator) { + continue; + } writeLine(); - emitStart(member); + emitStart(decorators || firstParameterDecorator); write("__decorate(["); increaseIndent(); writeLine(); var decoratorCount = decorators ? decorators.length : 0; - var argumentsWritten = emitList(decorators, 0, decoratorCount, true, false, false, true, function (decorator) { - emitStart(decorator); - emit(decorator.expression); - emitEnd(decorator); - }); - argumentsWritten += emitDecoratorsOfParameters(functionLikeMember, argumentsWritten > 0); + var argumentsWritten = emitList(decorators, 0, decoratorCount, true, false, false, true, function (decorator) { return emit(decorator.expression); }); + if (firstParameterDecorator) { + argumentsWritten += emitDecoratorsOfParameters(functionLikeMember, argumentsWritten > 0); + } emitSerializedTypeMetadata(member, argumentsWritten > 0); decreaseIndent(); writeLine(); write("], "); - emitStart(member.name); emitClassMemberPrefix(node, member); write(", "); emitExpressionForPropertyName(member.name); - emitEnd(member.name); if (languageVersion > 0) { - if (member.kind !== 141) { + if (member.kind !== 145) { write(", null"); } else { write(", void 0"); } } - write(");"); - emitEnd(member); + write(")"); + emitEnd(decorators || firstParameterDecorator); + write(";"); writeLine(); } } function emitDecoratorsOfParameters(node, leadingComma) { var argumentsWritten = 0; if (node) { - var parameterIndex = 0; + var parameterIndex_1 = 0; for (var _a = 0, _b = node.parameters; _a < _b.length; _a++) { var parameter = _b[_a]; if (ts.nodeIsDecorated(parameter)) { var decorators = parameter.decorators; argumentsWritten += emitList(decorators, 0, decorators.length, true, false, leadingComma, true, function (decorator) { - emitStart(decorator); - write("__param(" + parameterIndex + ", "); + write("__param(" + parameterIndex_1 + ", "); emit(decorator.expression); write(")"); - emitEnd(decorator); }); leadingComma = true; } - ++parameterIndex; + parameterIndex_1++; } } return argumentsWritten; } function shouldEmitTypeMetadata(node) { switch (node.kind) { - case 143: + case 147: + case 149: + case 150: case 145: - case 146: - case 141: return true; } return false; } function shouldEmitReturnTypeMetadata(node) { switch (node.kind) { - case 143: + case 147: return true; } return false; } function shouldEmitParamTypesMetadata(node) { switch (node.kind) { - case 214: - case 143: - case 146: + case 221: + case 147: + case 150: return true; } return false; } function emitSerializedTypeOfNode(node) { switch (node.kind) { - case 214: + case 221: write("Function"); return; - case 141: - emitSerializedTypeNode(node.type); - return; - case 138: - emitSerializedTypeNode(node.type); - return; case 145: emitSerializedTypeNode(node.type); return; - case 146: + case 142: + emitSerializedTypeNode(node.type); + return; + case 149: + emitSerializedTypeNode(node.type); + return; + case 150: emitSerializedTypeNode(ts.getSetAccessorTypeAnnotationNode(node)); return; } @@ -29213,39 +32596,40 @@ var ts; case 103: write("void 0"); return; - case 160: + case 164: emitSerializedTypeNode(node.type); return; - case 152: - case 153: - write("Function"); - return; case 156: case 157: + write("Function"); + return; + case 160: + case 161: write("Array"); return; - case 150: + case 154: case 120: write("Boolean"); return; - case 130: - case 9: + case 132: + case 166: write("String"); return; - case 128: + case 130: write("Number"); return; - case 131: + case 133: write("Symbol"); return; - case 151: + case 155: emitSerializedTypeReferenceNode(node); return; - case 154: - case 155: case 158: case 159: + case 162: + case 163: case 117: + case 165: break; default: ts.Debug.fail("Cannot serialize unexpected type node."); @@ -29259,8 +32643,7 @@ var ts; while (ts.isDeclaration(location) || ts.isTypeNode(location)) { location = location.parent; } - var typeName = ts.cloneEntityName(node.typeName); - typeName.parent = location; + var typeName = ts.cloneEntityName(node.typeName, location); var result = resolver.getTypeReferenceSerializationKind(typeName); switch (result) { case ts.TypeReferenceSerializationKind.Unknown: @@ -29309,8 +32692,8 @@ var ts; } function emitSerializedParameterTypesOfNode(node) { if (node) { - var valueDeclaration; - if (node.kind === 214) { + var valueDeclaration = void 0; + if (node.kind === 221) { valueDeclaration = ts.getFirstConstructorWithBody(node); } else if (ts.isFunctionLike(node) && ts.nodeIsPresent(node.body)) { @@ -29326,10 +32709,10 @@ var ts; } if (parameters[i].dotDotDotToken) { var parameterType = parameters[i].type; - if (parameterType.kind === 156) { + if (parameterType.kind === 160) { parameterType = parameterType.elementType; } - else if (parameterType.kind === 151 && parameterType.typeArguments && parameterType.typeArguments.length === 1) { + else if (parameterType.kind === 155 && parameterType.typeArguments && parameterType.typeArguments.length === 1) { parameterType = parameterType.typeArguments[0]; } else { @@ -29400,9 +32783,10 @@ var ts; return; } if (!shouldHoistDeclarationInSystemJsModule(node)) { - if (!(node.flags & 2) || isES6ExportedDeclaration(node)) { + var isES6ExportedEnum = isES6ExportedDeclaration(node); + if (!(node.flags & 1) || (isES6ExportedEnum && isFirstDeclarationOfKind(node, node.symbol && node.symbol.declarations, 224))) { emitStart(node); - if (isES6ExportedDeclaration(node)) { + if (isES6ExportedEnum) { write("export "); } write("var "); @@ -29419,19 +32803,17 @@ var ts; emitEnd(node.name); write(") {"); increaseIndent(); - scopeEmitStart(node); emitLines(node.members); decreaseIndent(); writeLine(); emitToken(16, node.members.end); - scopeEmitEnd(); write(")("); emitModuleMemberName(node); write(" || ("); emitModuleMemberName(node); write(" = {}));"); emitEnd(node); - if (!isES6ExportedDeclaration(node) && node.flags & 2 && !shouldHoistDeclarationInSystemJsModule(node)) { + if (!isES6ExportedDeclaration(node) && node.flags & 1 && !shouldHoistDeclarationInSystemJsModule(node)) { writeLine(); emitStart(node); write("var "); @@ -29441,8 +32823,8 @@ var ts; emitEnd(node); write(";"); } - if (modulekind !== 5 && node.parent === currentSourceFile) { - if (modulekind === 4 && (node.flags & 2)) { + if (modulekind !== ts.ModuleKind.ES6 && node.parent === currentSourceFile) { + if (modulekind === ts.ModuleKind.System && (node.flags & 1)) { writeLine(); write(exportFunctionForFile + "(\""); emitDeclarationName(node); @@ -29482,7 +32864,7 @@ var ts; } } function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { - if (moduleDeclaration.body.kind === 218) { + if (moduleDeclaration.body.kind === 225) { var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); return recursiveInnerModule || moduleDeclaration.body; } @@ -29493,6 +32875,9 @@ var ts; function isModuleMergedWithES6Class(node) { return languageVersion === 2 && !!(resolver.getNodeCheckFlags(node) & 32768); } + function isFirstDeclarationOfKind(node, declarations, kind) { + return !ts.forEach(declarations, function (declaration) { return declaration.kind === kind && declaration.pos < node.pos; }); + } function emitModuleDeclaration(node) { var shouldEmit = shouldEmitModuleDeclaration(node); if (!shouldEmit) { @@ -29501,15 +32886,18 @@ var ts; var hoistedInDeclarationScope = shouldHoistDeclarationInSystemJsModule(node); var emitVarForModule = !hoistedInDeclarationScope && !isModuleMergedWithES6Class(node); if (emitVarForModule) { - emitStart(node); - if (isES6ExportedDeclaration(node)) { - write("export "); + var isES6ExportedNamespace = isES6ExportedDeclaration(node); + if (!isES6ExportedNamespace || isFirstDeclarationOfKind(node, node.symbol && node.symbol.declarations, 225)) { + emitStart(node); + if (isES6ExportedNamespace) { + write("export "); + } + write("var "); + emit(node.name); + write(";"); + emitEnd(node); + writeLine(); } - write("var "); - emit(node.name); - write(";"); - emitEnd(node); - writeLine(); } emitStart(node); write("(function ("); @@ -29517,7 +32905,7 @@ var ts; write(getGeneratedNameForNode(node)); emitEnd(node.name); write(") "); - if (node.body.kind === 219) { + if (node.body.kind === 226) { var saveConvertedLoopState = convertedLoopState; var saveTempFlags = tempFlags; var saveTempVariables = tempVariables; @@ -29533,7 +32921,6 @@ var ts; else { write("{"); increaseIndent(); - scopeEmitStart(node); emitCaptureThisForNodeIfNecessary(node); writeLine(); emit(node.body); @@ -29541,10 +32928,9 @@ var ts; writeLine(); var moduleBlock = getInnerMostModuleDeclarationFromDottedModule(node).body; emitToken(16, moduleBlock.statements.end); - scopeEmitEnd(); } write(")("); - if ((node.flags & 2) && !isES6ExportedDeclaration(node)) { + if ((node.flags & 1) && !isES6ExportedDeclaration(node)) { emit(node.name); write(" = "); } @@ -29554,7 +32940,7 @@ var ts; write(" = {}));"); emitEnd(node); if (!isES6ExportedDeclaration(node) && node.name.kind === 69 && node.parent === currentSourceFile) { - if (modulekind === 4 && (node.flags & 2)) { + if (modulekind === ts.ModuleKind.System && (node.flags & 1)) { writeLine(); write(exportFunctionForFile + "(\""); emitDeclarationName(node); @@ -29590,16 +32976,16 @@ var ts; } } function getNamespaceDeclarationNode(node) { - if (node.kind === 221) { + if (node.kind === 229) { return node; } var importClause = node.importClause; - if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 224) { + if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 232) { return importClause.namedBindings; } } function isDefaultImport(node) { - return node.kind === 222 && node.importClause && !!node.importClause.name; + return node.kind === 230 && node.importClause && !!node.importClause.name; } function emitExportImportAssignments(node) { if (ts.isAliasSymbolDeclaration(node) && resolver.isValueAliasDeclaration(node)) { @@ -29608,7 +32994,7 @@ var ts; ts.forEachChild(node, emitExportImportAssignments); } function emitImportDeclaration(node) { - if (modulekind !== 5) { + if (modulekind !== ts.ModuleKind.ES6) { return emitExternalImportDeclaration(node); } if (node.importClause) { @@ -29626,7 +33012,7 @@ var ts; if (shouldEmitNamedBindings) { emitLeadingComments(node.importClause.namedBindings); emitStart(node.importClause.namedBindings); - if (node.importClause.namedBindings.kind === 224) { + if (node.importClause.namedBindings.kind === 232) { write("* as "); emit(node.importClause.namedBindings.name); } @@ -29652,21 +33038,24 @@ var ts; } function emitExternalImportDeclaration(node) { if (ts.contains(externalImports, node)) { - var isExportedImport = node.kind === 221 && (node.flags & 2) !== 0; + var isExportedImport = node.kind === 229 && (node.flags & 1) !== 0; var namespaceDeclaration = getNamespaceDeclarationNode(node); - if (modulekind !== 2) { + var varOrConst = (languageVersion <= 1) ? "var " : "const "; + if (modulekind !== ts.ModuleKind.AMD) { emitLeadingComments(node); emitStart(node); if (namespaceDeclaration && !isDefaultImport(node)) { - if (!isExportedImport) - write("var "); + if (!isExportedImport) { + write(varOrConst); + } + ; emitModuleMemberName(namespaceDeclaration); write(" = "); } else { - var isNakedImport = 222 && !node.importClause; + var isNakedImport = 230 && !node.importClause; if (!isNakedImport) { - write("var "); + write(varOrConst); write(getGeneratedNameForNode(node)); write(" = "); } @@ -29691,7 +33080,7 @@ var ts; write(";"); } else if (namespaceDeclaration && isDefaultImport(node)) { - write("var "); + write(varOrConst); emitModuleMemberName(namespaceDeclaration); write(" = "); write(getGeneratedNameForNode(node)); @@ -29718,7 +33107,7 @@ var ts; write("export "); write("var "); } - else if (!(node.flags & 2)) { + else if (!(node.flags & 1)) { write("var "); } } @@ -29740,13 +33129,13 @@ var ts; } } function emitExportDeclaration(node) { - ts.Debug.assert(modulekind !== 4); - if (modulekind !== 5) { + ts.Debug.assert(modulekind !== ts.ModuleKind.System); + if (modulekind !== ts.ModuleKind.ES6) { if (node.moduleSpecifier && (!node.exportClause || resolver.isValueAliasDeclaration(node))) { emitStart(node); var generatedName = getGeneratedNameForNode(node); if (node.exportClause) { - if (modulekind !== 2) { + if (modulekind !== ts.ModuleKind.AMD) { write("var "); write(generatedName); write(" = "); @@ -29771,15 +33160,17 @@ var ts; } } else { - writeLine(); - write("__export("); - if (modulekind !== 2) { - emitRequire(ts.getExternalModuleName(node)); + if (hasExportStarsToExportValues && resolver.moduleExportsSomeValue(node.moduleSpecifier)) { + writeLine(); + write("__export("); + if (modulekind !== ts.ModuleKind.AMD) { + emitRequire(ts.getExternalModuleName(node)); + } + else { + write(generatedName); + } + write(");"); } - else { - write(generatedName); - } - write(");"); } emitEnd(node); } @@ -29804,7 +33195,7 @@ var ts; } } function emitExportOrImportSpecifierList(specifiers, shouldEmit) { - ts.Debug.assert(modulekind === 5); + ts.Debug.assert(modulekind === ts.ModuleKind.ES6); var needsComma = false; for (var _a = 0, specifiers_1 = specifiers; _a < specifiers_1.length; _a++) { var specifier = specifiers_1[_a]; @@ -29823,14 +33214,14 @@ var ts; } function emitExportAssignment(node) { if (!node.isExportEquals && resolver.isValueAliasDeclaration(node)) { - if (modulekind === 5) { + if (modulekind === ts.ModuleKind.ES6) { writeLine(); emitStart(node); write("export default "); var expression = node.expression; emit(expression); - if (expression.kind !== 213 && - expression.kind !== 214) { + if (expression.kind !== 220 && + expression.kind !== 221) { write(";"); } emitEnd(node); @@ -29838,7 +33229,7 @@ var ts; else { writeLine(); emitStart(node); - if (modulekind === 4) { + if (modulekind === ts.ModuleKind.System) { write(exportFunctionForFile + "(\"default\","); emit(node.expression); write(")"); @@ -29847,7 +33238,7 @@ var ts; emitEs6ExportDefaultCompat(node); emitContainingModuleName(node); if (languageVersion === 0) { - write("[\"default\"] = "); + write('["default"] = '); } else { write(".default = "); @@ -29863,26 +33254,28 @@ var ts; externalImports = []; exportSpecifiers = {}; exportEquals = undefined; - hasExportStars = false; + hasExportStarsToExportValues = false; for (var _a = 0, _b = sourceFile.statements; _a < _b.length; _a++) { var node = _b[_a]; switch (node.kind) { - case 222: + case 230: if (!node.importClause || resolver.isReferencedAliasDeclaration(node.importClause, true)) { externalImports.push(node); } break; - case 221: - if (node.moduleReference.kind === 232 && resolver.isReferencedAliasDeclaration(node)) { + case 229: + if (node.moduleReference.kind === 240 && resolver.isReferencedAliasDeclaration(node)) { externalImports.push(node); } break; - case 228: + case 236: if (node.moduleSpecifier) { if (!node.exportClause) { - externalImports.push(node); - hasExportStars = true; + if (resolver.moduleExportsSomeValue(node.moduleSpecifier)) { + externalImports.push(node); + hasExportStarsToExportValues = true; + } } else if (resolver.isValueAliasDeclaration(node)) { externalImports.push(node); @@ -29891,12 +33284,12 @@ var ts; else { for (var _c = 0, _d = node.exportClause.elements; _c < _d.length; _c++) { var specifier = _d[_c]; - var name_26 = (specifier.propertyName || specifier.name).text; - (exportSpecifiers[name_26] || (exportSpecifiers[name_26] = [])).push(specifier); + var name_29 = (specifier.propertyName || specifier.name).text; + (exportSpecifiers[name_29] || (exportSpecifiers[name_29] = [])).push(specifier); } } break; - case 227: + case 235: if (node.isExportEquals && !exportEquals) { exportEquals = node; } @@ -29905,7 +33298,7 @@ var ts; } } function emitExportStarHelper() { - if (hasExportStars) { + if (hasExportStarsToExportValues) { writeLine(); write("function __export(m) {"); increaseIndent(); @@ -29921,14 +33314,20 @@ var ts; if (namespaceDeclaration && !isDefaultImport(node)) { return ts.getTextOfNodeFromSourceText(currentText, namespaceDeclaration.name); } - if (node.kind === 222 && node.importClause) { + if (node.kind === 230 && node.importClause) { return getGeneratedNameForNode(node); } - if (node.kind === 228 && node.moduleSpecifier) { + if (node.kind === 236 && node.moduleSpecifier) { return getGeneratedNameForNode(node); } } - function getExternalModuleNameText(importNode) { + function getExternalModuleNameText(importNode, emitRelativePathAsModuleName) { + if (emitRelativePathAsModuleName) { + var name_30 = getExternalModuleNameFromDeclaration(host, resolver, importNode); + if (name_30) { + return "\"" + name_30 + "\""; + } + } var moduleName = ts.getExternalModuleName(importNode); if (moduleName.kind === 9) { return tryRenameExternalModule(moduleName) || getLiteralText(moduleName); @@ -29943,8 +33342,8 @@ var ts; var started = false; for (var _a = 0, externalImports_1 = externalImports; _a < externalImports_1.length; _a++) { var importNode = externalImports_1[_a]; - var skipNode = importNode.kind === 228 || - (importNode.kind === 222 && !importNode.importClause); + var skipNode = importNode.kind === 236 || + (importNode.kind === 230 && !importNode.importClause); if (skipNode) { continue; } @@ -29962,14 +33361,14 @@ var ts; } } function emitLocalStorageForExportedNamesIfNecessary(exportedDeclarations) { - if (!hasExportStars) { + if (!hasExportStarsToExportValues) { return undefined; } if (!exportedDeclarations && ts.isEmpty(exportSpecifiers)) { var hasExportDeclarationWithExportClause = false; for (var _a = 0, externalImports_2 = externalImports; _a < externalImports_2.length; _a++) { var externalImport = externalImports_2[_a]; - if (externalImport.kind === 228 && externalImport.exportClause) { + if (externalImport.kind === 236 && externalImport.exportClause) { hasExportDeclarationWithExportClause = true; break; } @@ -29984,7 +33383,7 @@ var ts; increaseIndent(); var started = false; if (exportedDeclarations) { - for (var i = 0; i < exportedDeclarations.length; ++i) { + for (var i = 0; i < exportedDeclarations.length; i++) { writeExportedName(exportedDeclarations[i]); } } @@ -29998,7 +33397,7 @@ var ts; } for (var _d = 0, externalImports_3 = externalImports; _d < externalImports_3.length; _d++) { var externalImport = externalImports_3[_d]; - if (externalImport.kind !== 228) { + if (externalImport.kind !== 236) { continue; } var exportDecl = externalImport; @@ -30070,13 +33469,13 @@ var ts; writeLine(); write("var "); var seen = {}; - for (var i = 0; i < hoistedVars.length; ++i) { + for (var i = 0; i < hoistedVars.length; i++) { var local = hoistedVars[i]; - var name_27 = local.kind === 69 + var name_31 = local.kind === 69 ? local : local.name; - if (name_27) { - var text = ts.unescapeIdentifier(name_27.text); + if (name_31) { + var text = ts.unescapeIdentifier(name_31.text); if (ts.hasProperty(seen, text)) { continue; } @@ -30087,14 +33486,14 @@ var ts; if (i !== 0) { write(", "); } - if (local.kind === 214 || local.kind === 218 || local.kind === 217) { + if (local.kind === 221 || local.kind === 225 || local.kind === 224) { emitDeclarationName(local); } else { emit(local); } var flags = ts.getCombinedNodeFlags(local.kind === 69 ? local.parent : local); - if (flags & 2) { + if (flags & 1) { if (!exportedDeclarations) { exportedDeclarations = []; } @@ -30108,7 +33507,7 @@ var ts; var f = hoistedFunctionDeclarations_1[_a]; writeLine(); emit(f); - if (f.flags & 2) { + if (f.flags & 1) { if (!exportedDeclarations) { exportedDeclarations = []; } @@ -30118,24 +33517,24 @@ var ts; } return exportedDeclarations; function visit(node) { - if (node.flags & 4) { + if (node.flags & 2) { return; } - if (node.kind === 213) { + if (node.kind === 220) { if (!hoistedFunctionDeclarations) { hoistedFunctionDeclarations = []; } hoistedFunctionDeclarations.push(node); return; } - if (node.kind === 214) { + if (node.kind === 221) { if (!hoistedVars) { hoistedVars = []; } hoistedVars.push(node); return; } - if (node.kind === 217) { + if (node.kind === 224) { if (shouldEmitEnumDeclaration(node)) { if (!hoistedVars) { hoistedVars = []; @@ -30144,7 +33543,7 @@ var ts; } return; } - if (node.kind === 218) { + if (node.kind === 225) { if (shouldEmitModuleDeclaration(node)) { if (!hoistedVars) { hoistedVars = []; @@ -30153,17 +33552,17 @@ var ts; } return; } - if (node.kind === 211 || node.kind === 163) { + if (node.kind === 218 || node.kind === 169) { if (shouldHoistVariable(node, false)) { - var name_28 = node.name; - if (name_28.kind === 69) { + var name_32 = node.name; + if (name_32.kind === 69) { if (!hoistedVars) { hoistedVars = []; } - hoistedVars.push(name_28); + hoistedVars.push(name_32); } else { - ts.forEachChild(name_28, visit); + ts.forEachChild(name_32, visit); } } return; @@ -30188,11 +33587,11 @@ var ts; if (checkIfSourceFileLevelDecl && !shouldHoistDeclarationInSystemJsModule(node)) { return false; } - return (ts.getCombinedNodeFlags(node) & 24576) === 0 || - ts.getEnclosingBlockScopeContainer(node).kind === 248; + return (ts.getCombinedNodeFlags(node) & 3072) === 0 || + ts.getEnclosingBlockScopeContainer(node).kind === 256; } function isCurrentFileSystemExternalModule() { - return modulekind === 4 && isCurrentFileExternalModule; + return modulekind === ts.ModuleKind.System && isCurrentFileExternalModule; } function emitSystemModuleBody(node, dependencyGroups, startIndex) { emitVariableDeclarationsForImports(); @@ -30213,7 +33612,7 @@ var ts; } function emitSetters(exportStarFunction, dependencyGroups) { write("setters:["); - for (var i = 0; i < dependencyGroups.length; ++i) { + for (var i = 0; i < dependencyGroups.length; i++) { if (i !== 0) { write(","); } @@ -30227,29 +33626,29 @@ var ts; var entry = group_1[_a]; var importVariableName = getLocalNameForExternalImport(entry) || ""; switch (entry.kind) { - case 222: + case 230: if (!entry.importClause) { break; } - case 221: + case 229: ts.Debug.assert(importVariableName !== ""); writeLine(); write(importVariableName + " = " + parameterName + ";"); writeLine(); break; - case 228: + case 236: ts.Debug.assert(importVariableName !== ""); if (entry.exportClause) { writeLine(); write(exportFunctionForFile + "({"); writeLine(); increaseIndent(); - for (var i_2 = 0, len = entry.exportClause.elements.length; i_2 < len; ++i_2) { - if (i_2 !== 0) { + for (var i_1 = 0, len = entry.exportClause.elements.length; i_1 < len; i_1++) { + if (i_1 !== 0) { write(","); writeLine(); } - var e = entry.exportClause.elements[i_2]; + var e = entry.exportClause.elements[i_1]; write("\""); emitNodeWithCommentsAndWithoutSourcemap(e.name); write("\": " + parameterName + "[\""); @@ -30278,13 +33677,13 @@ var ts; write("execute: function() {"); increaseIndent(); writeLine(); - for (var i = startIndex; i < node.statements.length; ++i) { + for (var i = startIndex; i < node.statements.length; i++) { var statement = node.statements[i]; switch (statement.kind) { - case 213: - case 222: + case 220: + case 230: continue; - case 228: + case 236: if (!statement.moduleSpecifier) { for (var _a = 0, _b = statement.exportClause.elements; _a < _b.length; _a++) { var element = _b[_a]; @@ -30292,7 +33691,7 @@ var ts; } } continue; - case 221: + case 229: if (!ts.isInternalModuleImportEqualsDeclaration(statement)) { continue; } @@ -30315,38 +33714,40 @@ var ts; collectExternalModuleInfo(node); ts.Debug.assert(!exportFunctionForFile); exportFunctionForFile = makeUniqueName("exports"); + contextObjectForFile = makeUniqueName("context"); writeLine(); write("System.register("); writeModuleName(node, emitRelativePathAsModuleName); write("["); var groupIndices = {}; var dependencyGroups = []; - for (var i = 0; i < externalImports.length; ++i) { - var text = getExternalModuleNameText(externalImports[i]); - if (ts.hasProperty(groupIndices, text)) { - var groupIndex = groupIndices[text]; + for (var i = 0; i < externalImports.length; i++) { + var text = getExternalModuleNameText(externalImports[i], emitRelativePathAsModuleName); + if (text === undefined) { + continue; + } + var key = text.substr(1, text.length - 2); + if (ts.hasProperty(groupIndices, key)) { + var groupIndex = groupIndices[key]; dependencyGroups[groupIndex].push(externalImports[i]); continue; } else { - groupIndices[text] = dependencyGroups.length; + groupIndices[key] = dependencyGroups.length; dependencyGroups.push([externalImports[i]]); } if (i !== 0) { write(", "); } - if (emitRelativePathAsModuleName) { - var name_29 = getExternalModuleNameFromDeclaration(host, resolver, externalImports[i]); - if (name_29) { - text = "\"" + name_29 + "\""; - } - } write(text); } - write("], function(" + exportFunctionForFile + ") {"); + write("], function(" + exportFunctionForFile + ", " + contextObjectForFile + ") {"); writeLine(); increaseIndent(); - var startIndex = emitDirectivePrologues(node.statements, true); + var startIndex = emitDirectivePrologues(node.statements, true, !compilerOptions.noImplicitUseStrict); + writeLine(); + write("var __moduleName = " + contextObjectForFile + " && " + contextObjectForFile + ".id;"); + writeLine(); emitEmitHelpers(node); emitCaptureThisForNodeIfNecessary(node); emitSystemModuleBody(node, dependencyGroups, startIndex); @@ -30361,22 +33762,16 @@ var ts; for (var _a = 0, _b = node.amdDependencies; _a < _b.length; _a++) { var amdDependency = _b[_a]; if (amdDependency.name) { - aliasedModuleNames.push("\"" + amdDependency.path + "\""); + aliasedModuleNames.push('"' + amdDependency.path + '"'); importAliasNames.push(amdDependency.name); } else { - unaliasedModuleNames.push("\"" + amdDependency.path + "\""); + unaliasedModuleNames.push('"' + amdDependency.path + '"'); } } for (var _c = 0, externalImports_4 = externalImports; _c < externalImports_4.length; _c++) { var importNode = externalImports_4[_c]; - var externalModuleName = getExternalModuleNameText(importNode); - if (emitRelativePathAsModuleName) { - var name_30 = getExternalModuleNameFromDeclaration(host, resolver, importNode); - if (name_30) { - externalModuleName = "\"" + name_30 + "\""; - } - } + var externalModuleName = getExternalModuleNameText(importNode, emitRelativePathAsModuleName); var importAliasName = getLocalNameForExternalImport(importNode); if (includeNonAmdDependencies && importAliasName) { aliasedModuleNames.push(externalModuleName); @@ -30396,7 +33791,7 @@ var ts; } function emitAMDDependencyList(_a) { var aliasedModuleNames = _a.aliasedModuleNames, unaliasedModuleNames = _a.unaliasedModuleNames; - write("[\"require\", \"exports\""); + write('["require", "exports"'); if (aliasedModuleNames.length) { write(", "); write(aliasedModuleNames.join(", ")); @@ -30424,25 +33819,25 @@ var ts; writeModuleName(node, emitRelativePathAsModuleName); emitAMDDependencies(node, true, emitRelativePathAsModuleName); increaseIndent(); - var startIndex = emitDirectivePrologues(node.statements, true); + var startIndex = emitDirectivePrologues(node.statements, true, !compilerOptions.noImplicitUseStrict); emitExportStarHelper(); emitCaptureThisForNodeIfNecessary(node); emitLinesStartingAt(node.statements, startIndex); - emitTempDeclarations(true); emitExportEquals(true); + emitTempDeclarations(true); decreaseIndent(); writeLine(); write("});"); } function emitCommonJSModule(node) { - var startIndex = emitDirectivePrologues(node.statements, false); + var startIndex = emitDirectivePrologues(node.statements, false, !compilerOptions.noImplicitUseStrict); emitEmitHelpers(node); collectExternalModuleInfo(node); emitExportStarHelper(); emitCaptureThisForNodeIfNecessary(node); emitLinesStartingAt(node.statements, startIndex); - emitTempDeclarations(true); emitExportEquals(false); + emitTempDeclarations(true); } function emitUMDModule(node) { emitEmitHelpers(node); @@ -30454,12 +33849,12 @@ var ts; writeLines(" }\n})("); emitAMDFactoryHeader(dependencyNames); increaseIndent(); - var startIndex = emitDirectivePrologues(node.statements, true); + var startIndex = emitDirectivePrologues(node.statements, true, !compilerOptions.noImplicitUseStrict); emitExportStarHelper(); emitCaptureThisForNodeIfNecessary(node); emitLinesStartingAt(node.statements, startIndex); - emitTempDeclarations(true); emitExportEquals(true); + emitTempDeclarations(true); decreaseIndent(); writeLine(); write("});"); @@ -30468,7 +33863,7 @@ var ts; externalImports = undefined; exportSpecifiers = undefined; exportEquals = undefined; - hasExportStars = false; + hasExportStarsToExportValues = false; var startIndex = emitDirectivePrologues(node.statements, false); emitEmitHelpers(node); emitCaptureThisForNodeIfNecessary(node); @@ -30524,7 +33919,8 @@ var ts; if (result) { result = result.replace(/&(\w+);/g, function (s, m) { if (entities[m] !== undefined) { - return String.fromCharCode(entities[m]); + var ch = String.fromCharCode(entities[m]); + return ch === '"' ? "\\\"" : ch; } else { return s; @@ -30533,6 +33929,16 @@ var ts; } return result; } + function isJsxChildEmittable(child) { + if (child.kind === 248) { + return !!child.expression; + } + else if (child.kind === 244) { + return !!getTextToEmit(child); + } + return true; + } + ; function getTextToEmit(node) { switch (compilerOptions.jsx) { case 2: @@ -30551,9 +33957,9 @@ var ts; function emitJsxText(node) { switch (compilerOptions.jsx) { case 2: - write("\""); + write('"'); write(trimReactWhitespaceAndApplyEntities(node)); - write("\""); + write('"'); break; case 1: default: @@ -30576,23 +33982,40 @@ var ts; } } } - function emitDirectivePrologues(statements, startWithNewLine) { - for (var i = 0; i < statements.length; ++i) { + function isUseStrictPrologue(node) { + return node.expression.text === "use strict"; + } + function ensureUseStrictPrologue(startWithNewLine, writeUseStrict) { + if (writeUseStrict) { + if (startWithNewLine) { + writeLine(); + } + write("\"use strict\";"); + } + } + function emitDirectivePrologues(statements, startWithNewLine, ensureUseStrict) { + var foundUseStrict = false; + for (var i = 0; i < statements.length; i++) { if (ts.isPrologueDirective(statements[i])) { + if (isUseStrictPrologue(statements[i])) { + foundUseStrict = true; + } if (startWithNewLine || i > 0) { writeLine(); } emit(statements[i]); } else { + ensureUseStrictPrologue(startWithNewLine || i > 0, !foundUseStrict && ensureUseStrict); return i; } } + ensureUseStrictPrologue(startWithNewLine, !foundUseStrict && ensureUseStrict); return statements.length; } function writeLines(text) { var lines = text.split(/\r\n|\r|\n/g); - for (var i = 0; i < lines.length; ++i) { + for (var i = 0; i < lines.length; i++) { var line = lines[i]; if (line.length) { writeLine(); @@ -30602,22 +34025,26 @@ var ts; } function emitEmitHelpers(node) { if (!compilerOptions.noEmitHelpers) { - if ((languageVersion < 2) && (!extendsEmitted && resolver.getNodeCheckFlags(node) & 8)) { + if (languageVersion < 2 && !extendsEmitted && node.flags & 262144) { writeLines(extendsHelper); extendsEmitted = true; } - if (!decorateEmitted && resolver.getNodeCheckFlags(node) & 16) { + if (compilerOptions.jsx !== 1 && !assignEmitted && (node.flags & 1073741824)) { + writeLines(assignHelper); + assignEmitted = true; + } + if (!decorateEmitted && node.flags & 524288) { writeLines(decorateHelper); if (compilerOptions.emitDecoratorMetadata) { writeLines(metadataHelper); } decorateEmitted = true; } - if (!paramEmitted && resolver.getNodeCheckFlags(node) & 32) { + if (!paramEmitted && node.flags & 1048576) { writeLines(paramHelper); paramEmitted = true; } - if (!awaiterEmitted && resolver.getNodeCheckFlags(node) & 64) { + if (!awaiterEmitted && node.flags & 2097152) { writeLines(awaiterHelper); awaiterEmitted = true; } @@ -30628,8 +34055,8 @@ var ts; emitShebang(); emitDetachedCommentsAndUpdateCommentsInfo(node); if (ts.isExternalModule(node) || compilerOptions.isolatedModules) { - if (root || (!ts.isExternalModule(node) && compilerOptions.isolatedModules)) { - var emitModule = moduleEmitDelegates[modulekind] || moduleEmitDelegates[1]; + if (isOwnFileEmit || (!ts.isExternalModule(node) && compilerOptions.isolatedModules)) { + var emitModule = moduleEmitDelegates[modulekind] || moduleEmitDelegates[ts.ModuleKind.CommonJS]; emitModule(node); } else { @@ -30641,7 +34068,7 @@ var ts; externalImports = undefined; exportSpecifiers = undefined; exportEquals = undefined; - hasExportStars = false; + hasExportStarsToExportValues = false; emitEmitHelpers(node); emitCaptureThisForNodeIfNecessary(node); emitLinesStartingAt(node.statements, startIndex); @@ -30649,12 +34076,15 @@ var ts; } emitLeadingComments(node.endOfFileToken); } + function emit(node) { + emitNodeConsideringCommentsOption(node, emitNodeWithSourceMap); + } function emitNodeWithCommentsAndWithoutSourcemap(node) { emitNodeConsideringCommentsOption(node, emitNodeWithoutSourceMap); } function emitNodeConsideringCommentsOption(node, emitNodeConsideringSourcemap) { if (node) { - if (node.flags & 4) { + if (node.flags & 2) { return emitCommentsOnNotEmittedNode(node); } if (isSpecializedCommentHandling(node)) { @@ -30670,37 +34100,57 @@ var ts; } } } + function emitNodeWithSourceMap(node) { + if (node) { + emitStart(node); + emitNodeWithoutSourceMap(node); + emitEnd(node); + } + } function emitNodeWithoutSourceMap(node) { if (node) { emitJavaScriptWorker(node); } } + function changeSourceMapEmit(writer) { + sourceMap = writer; + emitStart = writer.emitStart; + emitEnd = writer.emitEnd; + emitPos = writer.emitPos; + setSourceFile = writer.setSourceFile; + } + function withTemporaryNoSourceMap(callback) { + var prevSourceMap = sourceMap; + setSourceMapWriterEmit(ts.getNullSourceMapWriter()); + callback(); + setSourceMapWriterEmit(prevSourceMap); + } function isSpecializedCommentHandling(node) { switch (node.kind) { - case 215: - case 213: case 222: - case 221: - case 216: - case 227: + case 220: + case 230: + case 229: + case 223: + case 235: return true; } } function shouldEmitLeadingAndTrailingComments(node) { switch (node.kind) { - case 193: + case 200: return shouldEmitLeadingAndTrailingCommentsForVariableStatement(node); - case 218: + case 225: return shouldEmitModuleDeclaration(node); - case 217: + case 224: return shouldEmitEnumDeclaration(node); } ts.Debug.assert(!isSpecializedCommentHandling(node)); - if (node.kind !== 192 && + if (node.kind !== 199 && node.parent && - node.parent.kind === 174 && + node.parent.kind === 180 && node.parent.body === node && - compilerOptions.target <= 1) { + languageVersion <= 1) { return false; } return true; @@ -30709,13 +34159,13 @@ var ts; switch (node.kind) { case 69: return emitIdentifier(node); - case 138: - return emitParameter(node); - case 143: case 142: - return emitMethod(node); - case 145: + return emitParameter(node); + case 147: case 146: + return emitMethod(node); + case 149: + case 150: return emitAccessor(node); case 97: return emitThis(node); @@ -30735,142 +34185,142 @@ var ts; case 13: case 14: return emitLiteral(node); - case 183: - return emitTemplateExpression(node); - case 190: - return emitTemplateSpan(node); - case 233: - case 234: - return emitJsxElement(node); - case 236: - return emitJsxText(node); - case 240: - return emitJsxExpression(node); - case 135: - return emitQualifiedName(node); - case 161: - return emitObjectBindingPattern(node); - case 162: - return emitArrayBindingPattern(node); - case 163: - return emitBindingElement(node); - case 164: - return emitArrayLiteral(node); - case 165: - return emitObjectLiteral(node); - case 245: - return emitPropertyAssignment(node); - case 246: - return emitShorthandPropertyAssignment(node); - case 136: - return emitComputedPropertyName(node); - case 166: - return emitPropertyAccess(node); - case 167: - return emitIndexedAccess(node); - case 168: - return emitCallExpression(node); - case 169: - return emitNewExpression(node); - case 170: - return emitTaggedTemplateExpression(node); - case 171: - return emit(node.expression); case 189: - return emit(node.expression); - case 172: - return emitParenExpression(node); - case 213: - case 173: - case 174: - return emitFunctionDeclaration(node); - case 175: - return emitDeleteExpression(node); - case 176: - return emitTypeOfExpression(node); - case 177: - return emitVoidExpression(node); - case 178: - return emitAwaitExpression(node); - case 179: - return emitPrefixUnaryExpression(node); - case 180: - return emitPostfixUnaryExpression(node); - case 181: - return emitBinaryExpression(node); - case 182: - return emitConditionalExpression(node); - case 185: - return emitSpreadElementExpression(node); - case 184: - return emitYieldExpression(node); - case 187: - return; - case 192: - case 219: - return emitBlock(node); - case 193: - return emitVariableStatement(node); - case 194: - return write(";"); - case 195: - return emitExpressionStatement(node); - case 196: - return emitIfStatement(node); + return emitTemplateExpression(node); case 197: - return emitDoStatement(node); - case 198: - return emitWhileStatement(node); - case 199: - return emitForStatement(node); - case 201: - case 200: - return emitForInOrForOfStatement(node); - case 202: - case 203: - return emitBreakOrContinueStatement(node); - case 204: - return emitReturnStatement(node); - case 205: - return emitWithStatement(node); - case 206: - return emitSwitchStatement(node); + return emitTemplateSpan(node); case 241: case 242: - return emitCaseOrDefaultClause(node); - case 207: - return emitLabeledStatement(node); - case 208: - return emitThrowStatement(node); - case 209: - return emitTryStatement(node); + return emitJsxElement(node); case 244: - return emitCatchClause(node); - case 210: - return emitDebuggerStatement(node); - case 211: - return emitVariableDeclaration(node); - case 186: - return emitClassExpression(node); - case 214: - return emitClassDeclaration(node); - case 215: - return emitInterfaceDeclaration(node); - case 217: - return emitEnumDeclaration(node); - case 247: - return emitEnumMember(node); - case 218: - return emitModuleDeclaration(node); - case 222: - return emitImportDeclaration(node); - case 221: - return emitImportEqualsDeclaration(node); - case 228: - return emitExportDeclaration(node); - case 227: - return emitExportAssignment(node); + return emitJsxText(node); case 248: + return emitJsxExpression(node); + case 139: + return emitQualifiedName(node); + case 167: + return emitObjectBindingPattern(node); + case 168: + return emitArrayBindingPattern(node); + case 169: + return emitBindingElement(node); + case 170: + return emitArrayLiteral(node); + case 171: + return emitObjectLiteral(node); + case 253: + return emitPropertyAssignment(node); + case 254: + return emitShorthandPropertyAssignment(node); + case 140: + return emitComputedPropertyName(node); + case 172: + return emitPropertyAccess(node); + case 173: + return emitIndexedAccess(node); + case 174: + return emitCallExpression(node); + case 175: + return emitNewExpression(node); + case 176: + return emitTaggedTemplateExpression(node); + case 177: + case 195: + case 196: + return emit(node.expression); + case 178: + return emitParenExpression(node); + case 220: + case 179: + case 180: + return emitFunctionDeclaration(node); + case 181: + return emitDeleteExpression(node); + case 182: + return emitTypeOfExpression(node); + case 183: + return emitVoidExpression(node); + case 184: + return emitAwaitExpression(node); + case 185: + return emitPrefixUnaryExpression(node); + case 186: + return emitPostfixUnaryExpression(node); + case 187: + return emitBinaryExpression(node); + case 188: + return emitConditionalExpression(node); + case 191: + return emitSpreadElementExpression(node); + case 190: + return emitYieldExpression(node); + case 193: + return; + case 199: + case 226: + return emitBlock(node); + case 200: + return emitVariableStatement(node); + case 201: + return write(";"); + case 202: + return emitExpressionStatement(node); + case 203: + return emitIfStatement(node); + case 204: + return emitDoStatement(node); + case 205: + return emitWhileStatement(node); + case 206: + return emitForStatement(node); + case 208: + case 207: + return emitForInOrForOfStatement(node); + case 209: + case 210: + return emitBreakOrContinueStatement(node); + case 211: + return emitReturnStatement(node); + case 212: + return emitWithStatement(node); + case 213: + return emitSwitchStatement(node); + case 249: + case 250: + return emitCaseOrDefaultClause(node); + case 214: + return emitLabeledStatement(node); + case 215: + return emitThrowStatement(node); + case 216: + return emitTryStatement(node); + case 252: + return emitCatchClause(node); + case 217: + return emitDebuggerStatement(node); + case 218: + return emitVariableDeclaration(node); + case 192: + return emitClassExpression(node); + case 221: + return emitClassDeclaration(node); + case 222: + return emitInterfaceDeclaration(node); + case 224: + return emitEnumDeclaration(node); + case 255: + return emitEnumMember(node); + case 225: + return emitModuleDeclaration(node); + case 230: + return emitImportDeclaration(node); + case 229: + return emitImportEqualsDeclaration(node); + case 236: + return emitExportDeclaration(node); + case 235: + return emitExportAssignment(node); + case 256: return emitSourceFileNode(node); } } @@ -30900,7 +34350,7 @@ var ts; } function getLeadingCommentsToEmit(node) { if (node.parent) { - if (node.parent.kind === 248 || node.pos !== node.parent.pos) { + if (node.parent.kind === 256 || node.pos !== node.parent.pos) { if (hasDetachedComments(node.pos)) { return getLeadingCommentsWithoutDetachedComments(); } @@ -30912,7 +34362,7 @@ var ts; } function getTrailingCommentsToEmit(node) { if (node.parent) { - if (node.parent.kind === 248 || node.end !== node.parent.end) { + if (node.parent.kind === 256 || node.end !== node.parent.end) { return ts.getTrailingCommentRanges(currentText, node.end); } } @@ -30978,18 +34428,39 @@ var ts; } } } + function writeComment(text, lineMap, writer, comment, newLine) { + emitPos(comment.pos); + ts.writeCommentRange(text, lineMap, writer, comment, newLine); + emitPos(comment.end); + } function emitShebang() { var shebang = ts.getShebang(currentText); if (shebang) { write(shebang); + writeLine(); } } var _a, _b; } - function emitFile(jsFilePath, sourceFile) { - emitJavaScript(jsFilePath, sourceFile); - if (compilerOptions.declaration) { - ts.writeDeclarationFile(jsFilePath, sourceFile, host, resolver, diagnostics); + function emitFile(_a, sourceFiles, isBundledEmit) { + var jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath; + if (!host.isEmitBlocked(jsFilePath) && !compilerOptions.noEmit) { + emitJavaScript(jsFilePath, sourceMapFilePath, sourceFiles, isBundledEmit); + } + else { + emitSkipped = true; + } + if (declarationFilePath) { + emitSkipped = ts.writeDeclarationFile(declarationFilePath, sourceFiles, isBundledEmit, host, resolver, emitterDiagnostics) || emitSkipped; + } + if (!emitSkipped && emittedFilesList) { + emittedFilesList.push(jsFilePath); + if (sourceMapFilePath) { + emittedFilesList.push(sourceMapFilePath); + } + if (declarationFilePath) { + emittedFilesList.push(declarationFilePath); + } } } } @@ -31002,11 +34473,16 @@ var ts; ts.ioReadTime = 0; ts.ioWriteTime = 0; var emptyArray = []; - ts.version = "1.8.0"; - function findConfigFile(searchPath) { - var fileName = "tsconfig.json"; + var defaultLibrarySearchPaths = [ + "types/", + "node_modules/", + "node_modules/@types/", + ]; + ts.version = "1.9.0"; + function findConfigFile(searchPath, fileExists) { while (true) { - if (ts.sys.fileExists(fileName)) { + var fileName = ts.combinePaths(searchPath, "tsconfig.json"); + if (fileExists(fileName)) { return fileName; } var parentPath = ts.getDirectoryPath(searchPath); @@ -31014,7 +34490,6 @@ var ts; break; } searchPath = parentPath; - fileName = "../" + fileName; } return undefined; } @@ -31025,86 +34500,491 @@ var ts; return ts.normalizePath(referencedFileName); } ts.resolveTripleslashReference = resolveTripleslashReference; - function resolveModuleName(moduleName, containingFile, compilerOptions, host) { - var moduleResolution = compilerOptions.moduleResolution !== undefined - ? compilerOptions.moduleResolution - : compilerOptions.module === 1 ? 2 : 1; - switch (moduleResolution) { - case 2: return nodeModuleNameResolver(moduleName, containingFile, host); - case 1: return classicNameResolver(moduleName, containingFile, compilerOptions, host); - } - } - ts.resolveModuleName = resolveModuleName; - function nodeModuleNameResolver(moduleName, containingFile, host) { - var containingDirectory = ts.getDirectoryPath(containingFile); - if (ts.getRootLength(moduleName) !== 0 || nameStartsWithDotSlashOrDotDotSlash(moduleName)) { - var failedLookupLocations = []; - var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); - var resolvedFileName = loadNodeModuleFromFile(ts.supportedJsExtensions, candidate, failedLookupLocations, host); - if (resolvedFileName) { - return { resolvedModule: { resolvedFileName: resolvedFileName }, failedLookupLocations: failedLookupLocations }; + function computeCommonSourceDirectoryOfFilenames(fileNames, currentDirectory, getCanonicalFileName) { + var commonPathComponents; + var failed = ts.forEach(fileNames, function (sourceFile) { + var sourcePathComponents = ts.getNormalizedPathComponents(sourceFile, currentDirectory); + sourcePathComponents.pop(); + if (!commonPathComponents) { + commonPathComponents = sourcePathComponents; + return; + } + for (var i = 0, n = Math.min(commonPathComponents.length, sourcePathComponents.length); i < n; i++) { + if (getCanonicalFileName(commonPathComponents[i]) !== getCanonicalFileName(sourcePathComponents[i])) { + if (i === 0) { + return true; + } + commonPathComponents.length = i; + break; + } + } + if (sourcePathComponents.length < commonPathComponents.length) { + commonPathComponents.length = sourcePathComponents.length; + } + }); + if (failed) { + return ""; + } + if (!commonPathComponents) { + return currentDirectory; + } + return ts.getNormalizedPathFromPathComponents(commonPathComponents); + } + ts.computeCommonSourceDirectoryOfFilenames = computeCommonSourceDirectoryOfFilenames; + function trace(host, message) { + host.trace(ts.formatMessage.apply(undefined, arguments)); + } + function isTraceEnabled(compilerOptions, host) { + return compilerOptions.traceResolution && host.trace !== undefined; + } + function hasZeroOrOneAsteriskCharacter(str) { + var seenAsterisk = false; + for (var i = 0; i < str.length; i++) { + if (str.charCodeAt(i) === 42) { + if (!seenAsterisk) { + seenAsterisk = true; + } + else { + return false; + } + } + } + return true; + } + function createResolvedModule(resolvedFileName, isExternalLibraryImport, failedLookupLocations) { + return { resolvedModule: resolvedFileName ? { resolvedFileName: resolvedFileName, isExternalLibraryImport: isExternalLibraryImport } : undefined, failedLookupLocations: failedLookupLocations }; + } + function moduleHasNonRelativeName(moduleName) { + if (ts.isRootedDiskPath(moduleName)) { + return false; + } + var i = moduleName.lastIndexOf("./", 1); + var startsWithDotSlashOrDotDotSlash = i === 0 || (i === 1 && moduleName.charCodeAt(0) === 46); + return !startsWithDotSlashOrDotDotSlash; + } + function tryReadTypesSection(packageJsonPath, baseDirectory, state) { + var jsonContent; + try { + var jsonText = state.host.readFile(packageJsonPath); + jsonContent = jsonText ? JSON.parse(jsonText) : {}; + } + catch (e) { + jsonContent = {}; + } + var typesFile; + var fieldName; + if (jsonContent.typings) { + if (typeof jsonContent.typings === "string") { + fieldName = "typings"; + typesFile = jsonContent.typings; + } + else { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Expected_type_of_0_field_in_package_json_to_be_string_got_1, "typings", typeof jsonContent.typings); + } + } + } + if (!typesFile && jsonContent.types) { + if (typeof jsonContent.types === "string") { + fieldName = "types"; + typesFile = jsonContent.types; + } + else { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Expected_type_of_0_field_in_package_json_to_be_string_got_1, "types", typeof jsonContent.types); + } + } + } + if (typesFile) { + var typesFilePath = ts.normalizePath(ts.combinePaths(baseDirectory, typesFile)); + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.package_json_has_0_field_1_that_references_2, fieldName, typesFile, typesFilePath); + } + return typesFilePath; + } + return undefined; + } + var typeReferenceExtensions = [".d.ts"]; + function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFile, options, host) { + var traceEnabled = isTraceEnabled(options, host); + var moduleResolutionState = { + compilerOptions: options, + host: host, + skipTsx: true, + traceEnabled: traceEnabled + }; + var rootDir = options.typesRoot || (options.configFilePath ? ts.getDirectoryPath(options.configFilePath) : undefined); + if (traceEnabled) { + if (containingFile === undefined) { + if (rootDir === undefined) { + trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set, typeReferenceDirectiveName); + } + else { + trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1, typeReferenceDirectiveName, rootDir); + } + } + else { + if (rootDir === undefined) { + trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set, typeReferenceDirectiveName, containingFile); + } + else { + trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_1_root_directory_2, typeReferenceDirectiveName, containingFile, rootDir); + } + } + } + var failedLookupLocations = []; + if (rootDir !== undefined) { + var effectivePrimarySearchPaths = options.typesSearchPaths || defaultLibrarySearchPaths; + for (var _i = 0, effectivePrimarySearchPaths_1 = effectivePrimarySearchPaths; _i < effectivePrimarySearchPaths_1.length; _i++) { + var searchPath = effectivePrimarySearchPaths_1[_i]; + var primaryPath = ts.combinePaths(rootDir, searchPath); + if (traceEnabled) { + trace(host, ts.Diagnostics.Resolving_with_primary_search_path_0, primaryPath); + } + var candidate = ts.combinePaths(primaryPath, typeReferenceDirectiveName); + var candidateDirectory = ts.getDirectoryPath(candidate); + var resolvedFile_1 = loadNodeModuleFromDirectory(typeReferenceExtensions, candidate, failedLookupLocations, !directoryProbablyExists(candidateDirectory, host), moduleResolutionState); + if (resolvedFile_1) { + if (traceEnabled) { + trace(host, ts.Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2, typeReferenceDirectiveName, resolvedFile_1, true); + } + return { + resolvedTypeReferenceDirective: { primary: true, resolvedFileName: resolvedFile_1 }, + failedLookupLocations: failedLookupLocations + }; + } } - resolvedFileName = loadNodeModuleFromDirectory(ts.supportedJsExtensions, candidate, failedLookupLocations, host); - return resolvedFileName - ? { resolvedModule: { resolvedFileName: resolvedFileName }, failedLookupLocations: failedLookupLocations } - : { resolvedModule: undefined, failedLookupLocations: failedLookupLocations }; } else { - return loadModuleFromNodeModules(moduleName, containingDirectory, host); + if (traceEnabled) { + trace(host, ts.Diagnostics.Root_directory_cannot_be_determined_skipping_primary_search_paths); + } + } + var resolvedFile; + var initialLocationForSecondaryLookup; + if (containingFile) { + initialLocationForSecondaryLookup = ts.getDirectoryPath(containingFile); + } + else { + initialLocationForSecondaryLookup = rootDir; + } + if (initialLocationForSecondaryLookup !== undefined) { + if (traceEnabled) { + trace(host, ts.Diagnostics.Looking_up_in_node_modules_folder_initial_location_0, initialLocationForSecondaryLookup); + } + resolvedFile = loadModuleFromNodeModules(typeReferenceDirectiveName, initialLocationForSecondaryLookup, failedLookupLocations, moduleResolutionState); + if (traceEnabled) { + if (resolvedFile) { + trace(host, ts.Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2, typeReferenceDirectiveName, resolvedFile, false); + } + else { + trace(host, ts.Diagnostics.Type_reference_directive_0_was_not_resolved, typeReferenceDirectiveName); + } + } + } + else { + if (traceEnabled) { + trace(host, ts.Diagnostics.Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_modules_folder); + } + } + return { + resolvedTypeReferenceDirective: resolvedFile + ? { primary: false, resolvedFileName: resolvedFile } + : undefined, + failedLookupLocations: failedLookupLocations + }; + } + ts.resolveTypeReferenceDirective = resolveTypeReferenceDirective; + function resolveModuleName(moduleName, containingFile, compilerOptions, host) { + var traceEnabled = isTraceEnabled(compilerOptions, host); + if (traceEnabled) { + trace(host, ts.Diagnostics.Resolving_module_0_from_1, moduleName, containingFile); + } + var moduleResolution = compilerOptions.moduleResolution; + if (moduleResolution === undefined) { + moduleResolution = ts.getEmitModuleKind(compilerOptions) === ts.ModuleKind.CommonJS ? ts.ModuleResolutionKind.NodeJs : ts.ModuleResolutionKind.Classic; + if (traceEnabled) { + trace(host, ts.Diagnostics.Module_resolution_kind_is_not_specified_using_0, ts.ModuleResolutionKind[moduleResolution]); + } + } + else { + if (traceEnabled) { + trace(host, ts.Diagnostics.Explicitly_specified_module_resolution_kind_Colon_0, ts.ModuleResolutionKind[moduleResolution]); + } + } + var result; + switch (moduleResolution) { + case ts.ModuleResolutionKind.NodeJs: + result = nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host); + break; + case ts.ModuleResolutionKind.Classic: + result = classicNameResolver(moduleName, containingFile, compilerOptions, host); + break; + } + if (traceEnabled) { + if (result.resolvedModule) { + trace(host, ts.Diagnostics.Module_name_0_was_successfully_resolved_to_1, moduleName, result.resolvedModule.resolvedFileName); + } + else { + trace(host, ts.Diagnostics.Module_name_0_was_not_resolved, moduleName); + } + } + return result; + } + ts.resolveModuleName = resolveModuleName; + function tryLoadModuleUsingOptionalResolutionSettings(moduleName, containingDirectory, loader, failedLookupLocations, supportedExtensions, state) { + if (moduleHasNonRelativeName(moduleName)) { + return tryLoadModuleUsingBaseUrl(moduleName, loader, failedLookupLocations, supportedExtensions, state); + } + else { + return tryLoadModuleUsingRootDirs(moduleName, containingDirectory, loader, failedLookupLocations, supportedExtensions, state); } } + function tryLoadModuleUsingRootDirs(moduleName, containingDirectory, loader, failedLookupLocations, supportedExtensions, state) { + if (!state.compilerOptions.rootDirs) { + return undefined; + } + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0, moduleName); + } + var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); + var matchedRootDir; + var matchedNormalizedPrefix; + for (var _i = 0, _a = state.compilerOptions.rootDirs; _i < _a.length; _i++) { + var rootDir = _a[_i]; + var normalizedRoot = ts.normalizePath(rootDir); + if (!ts.endsWith(normalizedRoot, ts.directorySeparator)) { + normalizedRoot += ts.directorySeparator; + } + var isLongestMatchingPrefix = ts.startsWith(candidate, normalizedRoot) && + (matchedNormalizedPrefix === undefined || matchedNormalizedPrefix.length < normalizedRoot.length); + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Checking_if_0_is_the_longest_matching_prefix_for_1_2, normalizedRoot, candidate, isLongestMatchingPrefix); + } + if (isLongestMatchingPrefix) { + matchedNormalizedPrefix = normalizedRoot; + matchedRootDir = rootDir; + } + } + if (matchedNormalizedPrefix) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Longest_matching_prefix_for_0_is_1, candidate, matchedNormalizedPrefix); + } + var suffix = candidate.substr(matchedNormalizedPrefix.length); + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Loading_0_from_the_root_dir_1_candidate_location_2, suffix, matchedNormalizedPrefix, candidate); + } + var resolvedFileName = loader(candidate, supportedExtensions, failedLookupLocations, !directoryProbablyExists(containingDirectory, state.host), state); + if (resolvedFileName) { + return resolvedFileName; + } + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Trying_other_entries_in_rootDirs); + } + for (var _b = 0, _c = state.compilerOptions.rootDirs; _b < _c.length; _b++) { + var rootDir = _c[_b]; + if (rootDir === matchedRootDir) { + continue; + } + var candidate_1 = ts.combinePaths(ts.normalizePath(rootDir), suffix); + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Loading_0_from_the_root_dir_1_candidate_location_2, suffix, rootDir, candidate_1); + } + var baseDirectory = ts.getDirectoryPath(candidate_1); + var resolvedFileName_1 = loader(candidate_1, supportedExtensions, failedLookupLocations, !directoryProbablyExists(baseDirectory, state.host), state); + if (resolvedFileName_1) { + return resolvedFileName_1; + } + } + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Module_resolution_using_rootDirs_has_failed); + } + } + return undefined; + } + function tryLoadModuleUsingBaseUrl(moduleName, loader, failedLookupLocations, supportedExtensions, state) { + if (!state.compilerOptions.baseUrl) { + return undefined; + } + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1, state.compilerOptions.baseUrl, moduleName); + } + var longestMatchPrefixLength = -1; + var matchedPattern; + var matchedStar; + if (state.compilerOptions.paths) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.paths_option_is_specified_looking_for_a_pattern_to_match_module_name_0, moduleName); + } + for (var key in state.compilerOptions.paths) { + var pattern = key; + var indexOfStar = pattern.indexOf("*"); + if (indexOfStar !== -1) { + var prefix = pattern.substr(0, indexOfStar); + var suffix = pattern.substr(indexOfStar + 1); + if (moduleName.length >= prefix.length + suffix.length && + ts.startsWith(moduleName, prefix) && + ts.endsWith(moduleName, suffix)) { + if (prefix.length > longestMatchPrefixLength) { + longestMatchPrefixLength = prefix.length; + matchedPattern = pattern; + matchedStar = moduleName.substr(prefix.length, moduleName.length - suffix.length); + } + } + } + else if (pattern === moduleName) { + matchedPattern = pattern; + matchedStar = undefined; + break; + } + } + } + if (matchedPattern) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Module_name_0_matched_pattern_1, moduleName, matchedPattern); + } + for (var _i = 0, _a = state.compilerOptions.paths[matchedPattern]; _i < _a.length; _i++) { + var subst = _a[_i]; + var path = matchedStar ? subst.replace("\*", matchedStar) : subst; + var candidate = ts.normalizePath(ts.combinePaths(state.compilerOptions.baseUrl, path)); + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Trying_substitution_0_candidate_module_location_Colon_1, subst, path); + } + var resolvedFileName = loader(candidate, supportedExtensions, failedLookupLocations, !directoryProbablyExists(ts.getDirectoryPath(candidate), state.host), state); + if (resolvedFileName) { + return resolvedFileName; + } + } + return undefined; + } + else { + var candidate = ts.normalizePath(ts.combinePaths(state.compilerOptions.baseUrl, moduleName)); + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Resolving_module_name_0_relative_to_base_url_1_2, moduleName, state.compilerOptions.baseUrl, candidate); + } + return loader(candidate, supportedExtensions, failedLookupLocations, !directoryProbablyExists(ts.getDirectoryPath(candidate), state.host), state); + } + } + function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host) { + var containingDirectory = ts.getDirectoryPath(containingFile); + var supportedExtensions = ts.getSupportedExtensions(compilerOptions); + var traceEnabled = isTraceEnabled(compilerOptions, host); + var failedLookupLocations = []; + var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled, skipTsx: false }; + var resolvedFileName = tryLoadModuleUsingOptionalResolutionSettings(moduleName, containingDirectory, nodeLoadModuleByRelativeName, failedLookupLocations, supportedExtensions, state); + var isExternalLibraryImport = false; + if (!resolvedFileName) { + if (moduleHasNonRelativeName(moduleName)) { + if (traceEnabled) { + trace(host, ts.Diagnostics.Loading_module_0_from_node_modules_folder, moduleName); + } + resolvedFileName = loadModuleFromNodeModules(moduleName, containingDirectory, failedLookupLocations, state); + isExternalLibraryImport = resolvedFileName !== undefined; + } + else { + var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); + resolvedFileName = nodeLoadModuleByRelativeName(candidate, supportedExtensions, failedLookupLocations, false, state); + } + } + if (resolvedFileName && host.realpath) { + var originalFileName = resolvedFileName; + resolvedFileName = ts.normalizePath(host.realpath(resolvedFileName)); + if (traceEnabled) { + trace(host, ts.Diagnostics.Resolving_real_path_for_0_result_1, originalFileName, resolvedFileName); + } + } + return createResolvedModule(resolvedFileName, isExternalLibraryImport, failedLookupLocations); + } ts.nodeModuleNameResolver = nodeModuleNameResolver; - function loadNodeModuleFromFile(extensions, candidate, failedLookupLocation, host) { + function nodeLoadModuleByRelativeName(candidate, supportedExtensions, failedLookupLocations, onlyRecordFailures, state) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Loading_module_as_file_Slash_folder_candidate_module_location_0, candidate); + } + var resolvedFileName = loadModuleFromFile(candidate, supportedExtensions, failedLookupLocations, onlyRecordFailures, state); + return resolvedFileName || loadNodeModuleFromDirectory(supportedExtensions, candidate, failedLookupLocations, onlyRecordFailures, state); + } + function directoryProbablyExists(directoryName, host) { + return !host.directoryExists || host.directoryExists(directoryName); + } + ts.directoryProbablyExists = directoryProbablyExists; + function loadModuleFromFile(candidate, extensions, failedLookupLocation, onlyRecordFailures, state) { + if (!onlyRecordFailures) { + var directory = ts.getDirectoryPath(candidate); + if (directory) { + onlyRecordFailures = !directoryProbablyExists(directory, state.host); + } + } return ts.forEach(extensions, tryLoad); function tryLoad(ext) { + if (ext === ".tsx" && state.skipTsx) { + return undefined; + } var fileName = ts.fileExtensionIs(candidate, ext) ? candidate : candidate + ext; - if (host.fileExists(fileName)) { + if (!onlyRecordFailures && state.host.fileExists(fileName)) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.File_0_exist_use_it_as_a_name_resolution_result, fileName); + } return fileName; } else { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.File_0_does_not_exist, fileName); + } failedLookupLocation.push(fileName); return undefined; } } } - function loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocation, host) { + function loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocation, onlyRecordFailures, state) { var packageJsonPath = ts.combinePaths(candidate, "package.json"); - if (host.fileExists(packageJsonPath)) { - var jsonContent; - try { - var jsonText = host.readFile(packageJsonPath); - jsonContent = jsonText ? JSON.parse(jsonText) : { typings: undefined }; + var directoryExists = !onlyRecordFailures && directoryProbablyExists(candidate, state.host); + if (directoryExists && state.host.fileExists(packageJsonPath)) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Found_package_json_at_0, packageJsonPath); } - catch (e) { - jsonContent = { typings: undefined }; - } - if (jsonContent.typings) { - var result = loadNodeModuleFromFile(extensions, ts.normalizePath(ts.combinePaths(candidate, jsonContent.typings)), failedLookupLocation, host); + var typesFile = tryReadTypesSection(packageJsonPath, candidate, state); + if (typesFile) { + var result = loadModuleFromFile(typesFile, extensions, failedLookupLocation, !directoryProbablyExists(ts.getDirectoryPath(typesFile), state.host), state); if (result) { return result; } } + else { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.package_json_does_not_have_types_field); + } + } } else { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.File_0_does_not_exist, packageJsonPath); + } failedLookupLocation.push(packageJsonPath); } - return loadNodeModuleFromFile(extensions, ts.combinePaths(candidate, "index"), failedLookupLocation, host); + return loadModuleFromFile(ts.combinePaths(candidate, "index"), extensions, failedLookupLocation, !directoryExists, state); } - function loadModuleFromNodeModules(moduleName, directory, host) { - var failedLookupLocations = []; + function loadModuleFromNodeModulesFolder(moduleName, directory, failedLookupLocations, state) { + var nodeModulesFolder = ts.combinePaths(directory, "node_modules"); + var nodeModulesFolderExists = directoryProbablyExists(nodeModulesFolder, state.host); + var candidate = ts.normalizePath(ts.combinePaths(nodeModulesFolder, moduleName)); + var result = loadModuleFromFile(candidate, ts.supportedTypeScriptExtensions, failedLookupLocations, !nodeModulesFolderExists, state); + if (result) { + return result; + } + result = loadNodeModuleFromDirectory(ts.supportedTypeScriptExtensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state); + if (result) { + return result; + } + } + function loadModuleFromNodeModules(moduleName, directory, failedLookupLocations, state) { directory = ts.normalizeSlashes(directory); while (true) { var baseName = ts.getBaseFileName(directory); if (baseName !== "node_modules") { - var nodeModulesFolder = ts.combinePaths(directory, "node_modules"); - var candidate = ts.normalizePath(ts.combinePaths(nodeModulesFolder, moduleName)); - var result = loadNodeModuleFromFile(ts.supportedExtensions, candidate, failedLookupLocations, host); + var result = loadModuleFromNodeModulesFolder(moduleName, directory, failedLookupLocations, state) || + loadModuleFromNodeModulesFolder(ts.combinePaths("@types", moduleName), directory, failedLookupLocations, state); if (result) { - return { resolvedModule: { resolvedFileName: result, isExternalLibraryImport: true }, failedLookupLocations: failedLookupLocations }; - } - result = loadNodeModuleFromDirectory(ts.supportedExtensions, candidate, failedLookupLocations, host); - if (result) { - return { resolvedModule: { resolvedFileName: result, isExternalLibraryImport: true }, failedLookupLocations: failedLookupLocations }; + return result; } } var parentPath = ts.getDirectoryPath(directory); @@ -31113,43 +34993,36 @@ var ts; } directory = parentPath; } - return { resolvedModule: undefined, failedLookupLocations: failedLookupLocations }; - } - function nameStartsWithDotSlashOrDotDotSlash(name) { - var i = name.lastIndexOf("./", 1); - return i === 0 || (i === 1 && name.charCodeAt(0) === 46); + return undefined; } function classicNameResolver(moduleName, containingFile, compilerOptions, host) { - if (moduleName.indexOf("!") != -1) { - return { resolvedModule: undefined, failedLookupLocations: [] }; - } - var searchPath = ts.getDirectoryPath(containingFile); - var searchName; + var traceEnabled = isTraceEnabled(compilerOptions, host); + var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled, skipTsx: !compilerOptions.jsx }; var failedLookupLocations = []; + var supportedExtensions = ts.getSupportedExtensions(compilerOptions); + var containingDirectory = ts.getDirectoryPath(containingFile); + var resolvedFileName = tryLoadModuleUsingOptionalResolutionSettings(moduleName, containingDirectory, loadModuleFromFile, failedLookupLocations, supportedExtensions, state); + if (resolvedFileName) { + return createResolvedModule(resolvedFileName, false, failedLookupLocations); + } var referencedSourceFile; - var extensions = compilerOptions.allowNonTsExtensions ? ts.supportedJsExtensions : ts.supportedExtensions; - while (true) { - searchName = ts.normalizePath(ts.combinePaths(searchPath, moduleName)); - referencedSourceFile = ts.forEach(extensions, function (extension) { - if (extension === ".tsx" && !compilerOptions.jsx) { - return undefined; + if (moduleHasNonRelativeName(moduleName)) { + while (true) { + var searchName = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); + referencedSourceFile = loadModuleFromFile(searchName, supportedExtensions, failedLookupLocations, false, state); + if (referencedSourceFile) { + break; } - var candidate = searchName + extension; - if (host.fileExists(candidate)) { - return candidate; + var parentPath = ts.getDirectoryPath(containingDirectory); + if (parentPath === containingDirectory) { + break; } - else { - failedLookupLocations.push(candidate); - } - }); - if (referencedSourceFile) { - break; + containingDirectory = parentPath; } - var parentPath = ts.getDirectoryPath(searchPath); - if (parentPath === searchPath) { - break; - } - searchPath = parentPath; + } + else { + var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); + referencedSourceFile = loadModuleFromFile(candidate, supportedExtensions, failedLookupLocations, false, state); } return referencedSourceFile ? { resolvedModule: { resolvedFileName: referencedSourceFile }, failedLookupLocations: failedLookupLocations } @@ -31157,7 +35030,7 @@ var ts; } ts.classicNameResolver = classicNameResolver; ts.defaultInitCompilerOptions = { - module: 1, + module: ts.ModuleKind.CommonJS, target: 1, noImplicitAny: false, sourceMap: false @@ -31202,11 +35075,39 @@ var ts; ts.sys.createDirectory(directoryPath); } } + var outputFingerprints; + function writeFileIfUpdated(fileName, data, writeByteOrderMark) { + if (!outputFingerprints) { + outputFingerprints = {}; + } + var hash = ts.sys.createHash(data); + var mtimeBefore = ts.sys.getModifiedTime(fileName); + if (mtimeBefore && ts.hasProperty(outputFingerprints, fileName)) { + var fingerprint = outputFingerprints[fileName]; + if (fingerprint.byteOrderMark === writeByteOrderMark && + fingerprint.hash === hash && + fingerprint.mtime.getTime() === mtimeBefore.getTime()) { + return; + } + } + ts.sys.writeFile(fileName, data, writeByteOrderMark); + var mtimeAfter = ts.sys.getModifiedTime(fileName); + outputFingerprints[fileName] = { + hash: hash, + byteOrderMark: writeByteOrderMark, + mtime: mtimeAfter + }; + } function writeFile(fileName, data, writeByteOrderMark, onError) { try { var start = new Date().getTime(); ensureDirectoriesExist(ts.getDirectoryPath(ts.normalizePath(fileName))); - ts.sys.writeFile(fileName, data, writeByteOrderMark); + if (ts.isWatchSet(options) && ts.sys.createHash && ts.sys.getModifiedTime) { + writeFileIfUpdated(fileName, data, writeByteOrderMark); + } + else { + ts.sys.writeFile(fileName, data, writeByteOrderMark); + } ts.ioWriteTime += new Date().getTime() - start; } catch (e) { @@ -31215,24 +35116,32 @@ var ts; } } } + function getDefaultLibLocation() { + return ts.getDirectoryPath(ts.normalizePath(ts.sys.getExecutingFilePath())); + } var newLine = ts.getNewLineCharacter(options); + var realpath = ts.sys.realpath && (function (path) { return ts.sys.realpath(path); }); return { getSourceFile: getSourceFile, - getDefaultLibFileName: function (options) { return ts.combinePaths(ts.getDirectoryPath(ts.normalizePath(ts.sys.getExecutingFilePath())), ts.getDefaultLibFileName(options)); }, + getDefaultLibLocation: getDefaultLibLocation, + getDefaultLibFileName: function (options) { return ts.combinePaths(getDefaultLibLocation(), ts.getDefaultLibFileName(options)); }, writeFile: writeFile, getCurrentDirectory: ts.memoize(function () { return ts.sys.getCurrentDirectory(); }), useCaseSensitiveFileNames: function () { return ts.sys.useCaseSensitiveFileNames; }, getCanonicalFileName: getCanonicalFileName, getNewLine: function () { return newLine; }, fileExists: function (fileName) { return ts.sys.fileExists(fileName); }, - readFile: function (fileName) { return ts.sys.readFile(fileName); } + readFile: function (fileName) { return ts.sys.readFile(fileName); }, + trace: function (s) { return ts.sys.write(s + newLine); }, + directoryExists: function (directoryName) { return ts.sys.directoryExists(directoryName); }, + realpath: realpath }; } ts.createCompilerHost = createCompilerHost; function getPreEmitDiagnostics(program, sourceFile, cancellationToken) { var diagnostics = program.getOptionsDiagnostics(cancellationToken).concat(program.getSyntacticDiagnostics(sourceFile, cancellationToken), program.getGlobalDiagnostics(cancellationToken), program.getSemanticDiagnostics(sourceFile, cancellationToken)); if (program.getCompilerOptions().declaration) { - diagnostics.concat(program.getDeclarationDiagnostics(sourceFile, cancellationToken)); + diagnostics = diagnostics.concat(program.getDeclarationDiagnostics(sourceFile, cancellationToken)); } return ts.sortAndDeduplicateDiagnostics(diagnostics); } @@ -31260,46 +35169,85 @@ var ts; } } ts.flattenDiagnosticMessageText = flattenDiagnosticMessageText; + function loadWithLocalCache(names, containingFile, loader) { + if (names.length === 0) { + return []; + } + var resolutions = []; + var cache = {}; + for (var _i = 0, names_1 = names; _i < names_1.length; _i++) { + var name_33 = names_1[_i]; + var result = void 0; + if (ts.hasProperty(cache, name_33)) { + result = cache[name_33]; + } + else { + result = loader(name_33, containingFile); + cache[name_33] = result; + } + resolutions.push(result); + } + return resolutions; + } function createProgram(rootNames, options, host, oldProgram) { var program; var files = []; - var fileProcessingDiagnostics = ts.createDiagnosticCollection(); - var programDiagnostics = ts.createDiagnosticCollection(); var commonSourceDirectory; var diagnosticsProducingTypeChecker; var noDiagnosticsTypeChecker; var classifiableNames; - var skipDefaultLib = options.noLib; + var resolvedTypeReferenceDirectives = {}; + var fileProcessingDiagnostics = ts.createDiagnosticCollection(); var start = new Date().getTime(); host = host || createCompilerHost(options); + var skipDefaultLib = options.noLib; + var programDiagnostics = ts.createDiagnosticCollection(); var currentDirectory = host.getCurrentDirectory(); - var resolveModuleNamesWorker = host.resolveModuleNames - ? (function (moduleNames, containingFile) { return host.resolveModuleNames(moduleNames, containingFile); }) - : (function (moduleNames, containingFile) { return ts.map(moduleNames, function (moduleName) { return resolveModuleName(moduleName, containingFile, options, host).resolvedModule; }); }); + var supportedExtensions = ts.getSupportedExtensions(options); + var hasEmitBlockingDiagnostics = ts.createFileMap(getCanonicalFileName); + var resolveModuleNamesWorker; + if (host.resolveModuleNames) { + resolveModuleNamesWorker = function (moduleNames, containingFile) { return host.resolveModuleNames(moduleNames, containingFile); }; + } + else { + var loader_1 = function (moduleName, containingFile) { return resolveModuleName(moduleName, containingFile, options, host).resolvedModule; }; + resolveModuleNamesWorker = function (moduleNames, containingFile) { return loadWithLocalCache(moduleNames, containingFile, loader_1); }; + } + var resolveTypeReferenceDirectiveNamesWorker; + if (host.resolveTypeReferenceDirectives) { + resolveTypeReferenceDirectiveNamesWorker = function (typeDirectiveNames, containingFile) { return host.resolveTypeReferenceDirectives(typeDirectiveNames, containingFile); }; + } + else { + var loader_2 = function (typesRef, containingFile) { return resolveTypeReferenceDirective(typesRef, containingFile, options, host).resolvedTypeReferenceDirective; }; + resolveTypeReferenceDirectiveNamesWorker = function (typeReferenceDirectiveNames, containingFile) { return loadWithLocalCache(typeReferenceDirectiveNames, containingFile, loader_2); }; + } var filesByName = ts.createFileMap(); var filesByNameIgnoreCase = host.useCaseSensitiveFileNames() ? ts.createFileMap(function (fileName) { return fileName.toLowerCase(); }) : undefined; - if (oldProgram) { - var oldOptions = oldProgram.getCompilerOptions(); - if ((oldOptions.module !== options.module) || - (oldOptions.noResolve !== options.noResolve) || - (oldOptions.target !== options.target) || - (oldOptions.noLib !== options.noLib) || - (oldOptions.jsx !== options.jsx)) { - oldProgram = undefined; - } - } if (!tryReuseStructureFromOldProgram()) { + if (options.types && options.types.length) { + var resolutions = resolveTypeReferenceDirectiveNamesWorker(options.types, undefined); + for (var i = 0; i < options.types.length; i++) { + processTypeReferenceDirective(options.types[i], resolutions[i]); + } + } ts.forEach(rootNames, function (name) { return processRootFile(name, false); }); if (!skipDefaultLib) { - processRootFile(host.getDefaultLibFileName(options), true); + if (!options.lib) { + processRootFile(host.getDefaultLibFileName(options), true); + } + else { + var libDirectory_1 = host.getDefaultLibLocation ? host.getDefaultLibLocation() : ts.getDirectoryPath(host.getDefaultLibFileName(options)); + ts.forEach(options.lib, function (libFileName) { + processRootFile(ts.combinePaths(libDirectory_1, libFileName), true); + }); + } } } - verifyCompilerOptions(); oldProgram = undefined; - ts.programTime += new Date().getTime() - start; program = { getRootFileNames: function () { return rootNames; }, getSourceFile: getSourceFile, + getSourceFileByPath: getSourceFileByPath, getSourceFiles: function () { return files; }, getCompilerOptions: function () { return options; }, getSyntacticDiagnostics: getSyntacticDiagnostics, @@ -31310,16 +35258,33 @@ var ts; getTypeChecker: getTypeChecker, getClassifiableNames: getClassifiableNames, getDiagnosticsProducingTypeChecker: getDiagnosticsProducingTypeChecker, - getCommonSourceDirectory: function () { return commonSourceDirectory; }, + getCommonSourceDirectory: getCommonSourceDirectory, emit: emit, getCurrentDirectory: function () { return currentDirectory; }, getNodeCount: function () { return getDiagnosticsProducingTypeChecker().getNodeCount(); }, getIdentifierCount: function () { return getDiagnosticsProducingTypeChecker().getIdentifierCount(); }, getSymbolCount: function () { return getDiagnosticsProducingTypeChecker().getSymbolCount(); }, getTypeCount: function () { return getDiagnosticsProducingTypeChecker().getTypeCount(); }, - getFileProcessingDiagnostics: function () { return fileProcessingDiagnostics; } + getFileProcessingDiagnostics: function () { return fileProcessingDiagnostics; }, + getResolvedTypeReferenceDirectives: function () { return resolvedTypeReferenceDirectives; } }; + verifyCompilerOptions(); + ts.programTime += new Date().getTime() - start; return program; + function getCommonSourceDirectory() { + if (typeof commonSourceDirectory === "undefined") { + if (options.rootDir && checkSourceFilesBelongToPath(files, options.rootDir)) { + commonSourceDirectory = ts.getNormalizedAbsolutePath(options.rootDir, currentDirectory); + } + else { + commonSourceDirectory = computeCommonSourceDirectory(files); + } + if (commonSourceDirectory && commonSourceDirectory[commonSourceDirectory.length - 1] !== ts.directorySeparator) { + commonSourceDirectory += ts.directorySeparator; + } + } + return commonSourceDirectory; + } function getClassifiableNames() { if (!classifiableNames) { getTypeChecker(); @@ -31335,17 +35300,38 @@ var ts; if (!oldProgram) { return false; } + var oldOptions = oldProgram.getCompilerOptions(); + if ((oldOptions.module !== options.module) || + (oldOptions.noResolve !== options.noResolve) || + (oldOptions.target !== options.target) || + (oldOptions.noLib !== options.noLib) || + (oldOptions.jsx !== options.jsx) || + (oldOptions.allowJs !== options.allowJs) || + (oldOptions.rootDir !== options.rootDir) || + (oldOptions.typesSearchPaths !== options.typesSearchPaths) || + (oldOptions.configFilePath !== options.configFilePath) || + (oldOptions.baseUrl !== options.baseUrl) || + (oldOptions.typesRoot !== options.typesRoot) || + !ts.arrayIsEqualTo(oldOptions.rootDirs, options.rootDirs) || + !ts.mapIsEqualTo(oldOptions.paths, options.paths)) { + return false; + } ts.Debug.assert(!oldProgram.structureIsReused); var oldRootNames = oldProgram.getRootFileNames(); if (!ts.arrayIsEqualTo(oldRootNames, rootNames)) { return false; } + if (!ts.arrayIsEqualTo(options.types, oldOptions.types)) { + return false; + } var newSourceFiles = []; var filePaths = []; var modifiedSourceFiles = []; for (var _i = 0, _a = oldProgram.getSourceFiles(); _i < _a.length; _i++) { var oldSourceFile = _a[_i]; - var newSourceFile = host.getSourceFile(oldSourceFile.fileName, options.target); + var newSourceFile = host.getSourceFileByPath + ? host.getSourceFileByPath(oldSourceFile.fileName, oldSourceFile.path, options.target) + : host.getSourceFile(oldSourceFile.fileName, options.target); if (!newSourceFile) { return false; } @@ -31362,23 +35348,31 @@ var ts; if (!ts.arrayIsEqualTo(oldSourceFile.imports, newSourceFile.imports, moduleNameIsEqualTo)) { return false; } + if (!ts.arrayIsEqualTo(oldSourceFile.moduleAugmentations, newSourceFile.moduleAugmentations, moduleNameIsEqualTo)) { + return false; + } + if (!ts.arrayIsEqualTo(oldSourceFile.typeReferenceDirectives, newSourceFile.typeReferenceDirectives, fileReferenceIsEqualTo)) { + return false; + } + var newSourceFilePath = ts.getNormalizedAbsolutePath(newSourceFile.fileName, currentDirectory); if (resolveModuleNamesWorker) { - var moduleNames = ts.map(newSourceFile.imports, function (name) { return name.text; }); - var resolutions = resolveModuleNamesWorker(moduleNames, ts.getNormalizedAbsolutePath(newSourceFile.fileName, currentDirectory)); - for (var i = 0; i < moduleNames.length; ++i) { - var newResolution = resolutions[i]; - var oldResolution = ts.getResolvedModule(oldSourceFile, moduleNames[i]); - var resolutionChanged = oldResolution - ? !newResolution || - oldResolution.resolvedFileName !== newResolution.resolvedFileName || - !!oldResolution.isExternalLibraryImport !== !!newResolution.isExternalLibraryImport - : newResolution; - if (resolutionChanged) { - return false; - } + var moduleNames = ts.map(ts.concatenate(newSourceFile.imports, newSourceFile.moduleAugmentations), getTextOfLiteral); + var resolutions = resolveModuleNamesWorker(moduleNames, newSourceFilePath); + var resolutionsChanged = ts.hasChangesInResolutions(moduleNames, resolutions, oldSourceFile.resolvedModules, ts.moduleResolutionIsEqualTo); + if (resolutionsChanged) { + return false; + } + } + if (resolveTypeReferenceDirectiveNamesWorker) { + var typesReferenceDirectives = ts.map(newSourceFile.typeReferenceDirectives, function (x) { return x.fileName; }); + var resolutions = resolveTypeReferenceDirectiveNamesWorker(typesReferenceDirectives, newSourceFilePath); + var resolutionsChanged = ts.hasChangesInResolutions(typesReferenceDirectives, resolutions, oldSourceFile.resolvedTypeReferenceDirectiveNames, ts.typeDirectiveIsEqualTo); + if (resolutionsChanged) { + return false; } } newSourceFile.resolvedModules = oldSourceFile.resolvedModules; + newSourceFile.resolvedTypeReferenceDirectiveNames = oldSourceFile.resolvedTypeReferenceDirectiveNames; modifiedSourceFiles.push(newSourceFile); } else { @@ -31386,7 +35380,7 @@ var ts; } newSourceFiles.push(newSourceFile); } - for (var i = 0, len = newSourceFiles.length; i < len; ++i) { + for (var i = 0, len = newSourceFiles.length; i < len; i++) { filesByName.set(filePaths[i], newSourceFiles[i]); } files = newSourceFiles; @@ -31395,6 +35389,7 @@ var ts; var modifiedFile = modifiedSourceFiles_1[_b]; fileProcessingDiagnostics.reattachFileDiagnostics(modifiedFile); } + resolvedTypeReferenceDirectives = oldProgram.getResolvedTypeReferenceDirectives(); oldProgram.structureIsReused = true; return true; } @@ -31406,8 +35401,10 @@ var ts; getCurrentDirectory: function () { return currentDirectory; }, getNewLine: function () { return host.getNewLine(); }, getSourceFile: program.getSourceFile, + getSourceFileByPath: program.getSourceFileByPath, getSourceFiles: program.getSourceFiles, - writeFile: writeFileCallback || (function (fileName, data, writeByteOrderMark, onError) { return host.writeFile(fileName, data, writeByteOrderMark, onError); }) + writeFile: writeFileCallback || (function (fileName, data, writeByteOrderMark, onError, sourceFiles) { return host.writeFile(fileName, data, writeByteOrderMark, onError, sourceFiles); }), + isEmitBlocked: isEmitBlocked }; } function getDiagnosticsProducingTypeChecker() { @@ -31420,9 +35417,27 @@ var ts; var _this = this; return runWithCancellationToken(function () { return emitWorker(_this, sourceFile, writeFileCallback, cancellationToken); }); } + function isEmitBlocked(emitFileName) { + return hasEmitBlockingDiagnostics.contains(ts.toPath(emitFileName, currentDirectory, getCanonicalFileName)); + } function emitWorker(program, sourceFile, writeFileCallback, cancellationToken) { - if (options.noEmitOnError && getPreEmitDiagnostics(program, undefined, cancellationToken).length > 0) { - return { diagnostics: [], sourceMaps: undefined, emitSkipped: true }; + var declarationDiagnostics = []; + if (options.noEmit) { + return { diagnostics: declarationDiagnostics, sourceMaps: undefined, emittedFiles: undefined, emitSkipped: true }; + } + if (options.noEmitOnError) { + var diagnostics = program.getOptionsDiagnostics(cancellationToken).concat(program.getSyntacticDiagnostics(sourceFile, cancellationToken), program.getGlobalDiagnostics(cancellationToken), program.getSemanticDiagnostics(sourceFile, cancellationToken)); + if (diagnostics.length === 0 && program.getCompilerOptions().declaration) { + declarationDiagnostics = program.getDeclarationDiagnostics(undefined, cancellationToken); + } + if (diagnostics.length > 0 || declarationDiagnostics.length > 0) { + return { + diagnostics: ts.concatenate(diagnostics, declarationDiagnostics), + sourceMaps: undefined, + emittedFiles: undefined, + emitSkipped: true + }; + } } var emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver((options.outFile || options.out) ? undefined : sourceFile); var start = new Date().getTime(); @@ -31431,7 +35446,10 @@ var ts; return emitResult; } function getSourceFile(fileName) { - return filesByName.get(ts.toPath(fileName, currentDirectory, getCanonicalFileName)); + return getSourceFileByPath(ts.toPath(fileName, currentDirectory, getCanonicalFileName)); + } + function getSourceFileByPath(path) { + return filesByName.get(path); } function getDiagnosticsHelper(sourceFile, getDiagnostics, cancellationToken) { if (sourceFile) { @@ -31453,7 +35471,13 @@ var ts; return getDiagnosticsHelper(sourceFile, getSemanticDiagnosticsForFile, cancellationToken); } function getDeclarationDiagnostics(sourceFile, cancellationToken) { - return getDiagnosticsHelper(sourceFile, getDeclarationDiagnosticsForFile, cancellationToken); + var options = program.getCompilerOptions(); + if (!sourceFile || options.out || options.outFile) { + return getDeclarationDiagnosticsWorker(sourceFile, cancellationToken); + } + else { + return getDiagnosticsHelper(sourceFile, getDeclarationDiagnosticsForFile, cancellationToken); + } } function getSyntacticDiagnosticsForFile(sourceFile, cancellationToken) { return sourceFile.parseDiagnostics; @@ -31475,21 +35499,176 @@ var ts; var typeChecker = getDiagnosticsProducingTypeChecker(); ts.Debug.assert(!!sourceFile.bindDiagnostics); var bindDiagnostics = sourceFile.bindDiagnostics; - var checkDiagnostics = typeChecker.getDiagnostics(sourceFile, cancellationToken); + var checkDiagnostics = ts.isSourceFileJavaScript(sourceFile) ? + getJavaScriptSemanticDiagnosticsForFile(sourceFile, cancellationToken) : + typeChecker.getDiagnostics(sourceFile, cancellationToken); var fileProcessingDiagnosticsInFile = fileProcessingDiagnostics.getDiagnostics(sourceFile.fileName); var programDiagnosticsInFile = programDiagnostics.getDiagnostics(sourceFile.fileName); return bindDiagnostics.concat(checkDiagnostics).concat(fileProcessingDiagnosticsInFile).concat(programDiagnosticsInFile); }); } - function getDeclarationDiagnosticsForFile(sourceFile, cancellationToken) { + function getJavaScriptSemanticDiagnosticsForFile(sourceFile, cancellationToken) { return runWithCancellationToken(function () { - if (!ts.isDeclarationFile(sourceFile)) { - var resolver = getDiagnosticsProducingTypeChecker().getEmitResolver(sourceFile, cancellationToken); - var writeFile_1 = function () { }; - return ts.getDeclarationDiagnostics(getEmitHost(writeFile_1), resolver, sourceFile); + var diagnostics = []; + walk(sourceFile); + return diagnostics; + function walk(node) { + if (!node) { + return false; + } + switch (node.kind) { + case 229: + diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_a_ts_file)); + return true; + case 235: + if (node.isExportEquals) { + diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.export_can_only_be_used_in_a_ts_file)); + return true; + } + break; + case 221: + var classDeclaration = node; + if (checkModifiers(classDeclaration.modifiers) || + checkTypeParameters(classDeclaration.typeParameters)) { + return true; + } + break; + case 251: + var heritageClause = node; + if (heritageClause.token === 106) { + diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_a_ts_file)); + return true; + } + break; + case 222: + diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.interface_declarations_can_only_be_used_in_a_ts_file)); + return true; + case 225: + diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.module_declarations_can_only_be_used_in_a_ts_file)); + return true; + case 223: + diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.type_aliases_can_only_be_used_in_a_ts_file)); + return true; + case 147: + case 146: + case 148: + case 149: + case 150: + case 179: + case 220: + case 180: + case 220: + var functionDeclaration = node; + if (checkModifiers(functionDeclaration.modifiers) || + checkTypeParameters(functionDeclaration.typeParameters) || + checkTypeAnnotation(functionDeclaration.type)) { + return true; + } + break; + case 200: + var variableStatement = node; + if (checkModifiers(variableStatement.modifiers)) { + return true; + } + break; + case 218: + var variableDeclaration = node; + if (checkTypeAnnotation(variableDeclaration.type)) { + return true; + } + break; + case 174: + case 175: + var expression = node; + if (expression.typeArguments && expression.typeArguments.length > 0) { + var start_2 = expression.typeArguments.pos; + diagnostics.push(ts.createFileDiagnostic(sourceFile, start_2, expression.typeArguments.end - start_2, ts.Diagnostics.type_arguments_can_only_be_used_in_a_ts_file)); + return true; + } + break; + case 142: + var parameter = node; + if (parameter.modifiers) { + var start_3 = parameter.modifiers.pos; + diagnostics.push(ts.createFileDiagnostic(sourceFile, start_3, parameter.modifiers.end - start_3, ts.Diagnostics.parameter_modifiers_can_only_be_used_in_a_ts_file)); + return true; + } + if (parameter.questionToken) { + diagnostics.push(ts.createDiagnosticForNode(parameter.questionToken, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, "?")); + return true; + } + if (parameter.type) { + diagnostics.push(ts.createDiagnosticForNode(parameter.type, ts.Diagnostics.types_can_only_be_used_in_a_ts_file)); + return true; + } + break; + case 145: + diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.property_declarations_can_only_be_used_in_a_ts_file)); + return true; + case 224: + diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.enum_declarations_can_only_be_used_in_a_ts_file)); + return true; + case 177: + var typeAssertionExpression = node; + diagnostics.push(ts.createDiagnosticForNode(typeAssertionExpression.type, ts.Diagnostics.type_assertion_expressions_can_only_be_used_in_a_ts_file)); + return true; + case 143: + if (!options.experimentalDecorators) { + diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning)); + } + return true; + } + return ts.forEachChild(node, walk); + } + function checkTypeParameters(typeParameters) { + if (typeParameters) { + var start_4 = typeParameters.pos; + diagnostics.push(ts.createFileDiagnostic(sourceFile, start_4, typeParameters.end - start_4, ts.Diagnostics.type_parameter_declarations_can_only_be_used_in_a_ts_file)); + return true; + } + return false; + } + function checkTypeAnnotation(type) { + if (type) { + diagnostics.push(ts.createDiagnosticForNode(type, ts.Diagnostics.types_can_only_be_used_in_a_ts_file)); + return true; + } + return false; + } + function checkModifiers(modifiers) { + if (modifiers) { + for (var _i = 0, modifiers_1 = modifiers; _i < modifiers_1.length; _i++) { + var modifier = modifiers_1[_i]; + switch (modifier.kind) { + case 112: + case 110: + case 111: + case 128: + case 122: + diagnostics.push(ts.createDiagnosticForNode(modifier, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, ts.tokenToString(modifier.kind))); + return true; + case 113: + case 82: + case 74: + case 77: + case 115: + } + } + } + return false; } }); } + function getDeclarationDiagnosticsWorker(sourceFile, cancellationToken) { + return runWithCancellationToken(function () { + var resolver = getDiagnosticsProducingTypeChecker().getEmitResolver(sourceFile, cancellationToken); + var writeFile = function () { }; + return ts.getDeclarationDiagnostics(getEmitHost(writeFile), resolver, sourceFile); + }); + } + function getDeclarationDiagnosticsForFile(sourceFile, cancellationToken) { + return ts.isDeclarationFile(sourceFile) ? [] : getDeclarationDiagnosticsWorker(sourceFile, cancellationToken); + } function getOptionsDiagnostics() { var allDiagnostics = []; ts.addRange(allDiagnostics, fileProcessingDiagnostics.getGlobalDiagnostics()); @@ -31505,7 +35684,7 @@ var ts; return ts.getBaseFileName(fileName).indexOf(".") >= 0; } function processRootFile(fileName, isDefaultLib) { - processSourceFile(ts.normalizePath(fileName), isDefaultLib); + processSourceFile(ts.normalizePath(fileName), isDefaultLib, true); } function fileReferenceIsEqualTo(a, b) { return a.fileName === b.fileName; @@ -31513,63 +35692,76 @@ var ts; function moduleNameIsEqualTo(a, b) { return a.text === b.text; } + function getTextOfLiteral(literal) { + return literal.text; + } function collectExternalModuleReferences(file) { if (file.imports) { return; } var isJavaScriptFile = ts.isSourceFileJavaScript(file); + var isExternalModuleFile = ts.isExternalModule(file); var imports; + var moduleAugmentations; for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { var node = _a[_i]; - collect(node, true, false); + collectModuleReferences(node, false); + if (isJavaScriptFile) { + collectRequireCalls(node); + } } file.imports = imports || emptyArray; + file.moduleAugmentations = moduleAugmentations || emptyArray; return; - function collect(node, allowRelativeModuleNames, collectOnlyRequireCalls) { - if (!collectOnlyRequireCalls) { - switch (node.kind) { - case 222: - case 221: - case 228: - var moduleNameExpr = ts.getExternalModuleName(node); - if (!moduleNameExpr || moduleNameExpr.kind !== 9) { - break; - } - if (!moduleNameExpr.text) { - break; - } - if (allowRelativeModuleNames || !ts.isExternalModuleNameRelative(moduleNameExpr.text)) { - (imports || (imports = [])).push(moduleNameExpr); - } + function collectModuleReferences(node, inAmbientModule) { + switch (node.kind) { + case 230: + case 229: + case 236: + var moduleNameExpr = ts.getExternalModuleName(node); + if (!moduleNameExpr || moduleNameExpr.kind !== 9) { break; - case 218: - if (node.name.kind === 9 && (node.flags & 4 || ts.isDeclarationFile(file))) { - ts.forEachChild(node.body, function (node) { - collect(node, false, collectOnlyRequireCalls); - }); - } + } + if (!moduleNameExpr.text) { break; - } + } + if (!inAmbientModule || !ts.isExternalModuleNameRelative(moduleNameExpr.text)) { + (imports || (imports = [])).push(moduleNameExpr); + } + break; + case 225: + if (ts.isAmbientModule(node) && (inAmbientModule || node.flags & 2 || ts.isDeclarationFile(file))) { + var moduleName = node.name; + if (isExternalModuleFile || (inAmbientModule && !ts.isExternalModuleNameRelative(moduleName.text))) { + (moduleAugmentations || (moduleAugmentations = [])).push(moduleName); + } + else if (!inAmbientModule) { + for (var _i = 0, _a = node.body.statements; _i < _a.length; _i++) { + var statement = _a[_i]; + collectModuleReferences(statement, true); + } + } + } } - if (isJavaScriptFile) { - if (ts.isRequireCall(node)) { - (imports || (imports = [])).push(node.arguments[0]); - } - else { - ts.forEachChild(node, function (node) { return collect(node, allowRelativeModuleNames, true); }); - } + } + function collectRequireCalls(node) { + if (ts.isRequireCall(node, true)) { + (imports || (imports = [])).push(node.arguments[0]); + } + else { + ts.forEachChild(node, collectRequireCalls); } } } - function processSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd) { + function processSourceFile(fileName, isDefaultLib, isReference, refFile, refPos, refEnd) { var diagnosticArgument; var diagnostic; if (hasExtension(fileName)) { - if (!options.allowNonTsExtensions && !ts.forEach(ts.supportedExtensions, function (extension) { return ts.fileExtensionIs(host.getCanonicalFileName(fileName), extension); })) { + if (!options.allowNonTsExtensions && !ts.forEach(supportedExtensions, function (extension) { return ts.fileExtensionIs(host.getCanonicalFileName(fileName), extension); })) { diagnostic = ts.Diagnostics.File_0_has_unsupported_extension_The_only_supported_extensions_are_1; - diagnosticArgument = [fileName, "'" + ts.supportedExtensions.join("', '") + "'"]; + diagnosticArgument = [fileName, "'" + supportedExtensions.join("', '") + "'"]; } - else if (!findSourceFile(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName), isDefaultLib, refFile, refPos, refEnd)) { + else if (!findSourceFile(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName), isDefaultLib, isReference, refFile, refPos, refEnd)) { diagnostic = ts.Diagnostics.File_0_not_found; diagnosticArgument = [fileName]; } @@ -31579,13 +35771,13 @@ var ts; } } else { - var nonTsFile = options.allowNonTsExtensions && findSourceFile(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName), isDefaultLib, refFile, refPos, refEnd); + var nonTsFile = options.allowNonTsExtensions && findSourceFile(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName), isDefaultLib, isReference, refFile, refPos, refEnd); if (!nonTsFile) { if (options.allowNonTsExtensions) { diagnostic = ts.Diagnostics.File_0_not_found; diagnosticArgument = [fileName]; } - else if (!ts.forEach(ts.supportedExtensions, function (extension) { return findSourceFile(fileName + extension, ts.toPath(fileName + extension, currentDirectory, getCanonicalFileName), isDefaultLib, refFile, refPos, refEnd); })) { + else if (!ts.forEach(supportedExtensions, function (extension) { return findSourceFile(fileName + extension, ts.toPath(fileName + extension, currentDirectory, getCanonicalFileName), isDefaultLib, isReference, refFile, refPos, refEnd); })) { diagnostic = ts.Diagnostics.File_0_not_found; fileName += ".ts"; diagnosticArgument = [fileName]; @@ -31609,12 +35801,15 @@ var ts; fileProcessingDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, existingFileName)); } } - function findSourceFile(fileName, normalizedAbsolutePath, isDefaultLib, refFile, refPos, refEnd) { - if (filesByName.contains(normalizedAbsolutePath)) { - var file_1 = filesByName.get(normalizedAbsolutePath); - if (file_1 && options.forceConsistentCasingInFileNames && ts.getNormalizedAbsolutePath(file_1.fileName, currentDirectory) !== normalizedAbsolutePath) { + function findSourceFile(fileName, path, isDefaultLib, isReference, refFile, refPos, refEnd) { + if (filesByName.contains(path)) { + var file_1 = filesByName.get(path); + if (file_1 && options.forceConsistentCasingInFileNames && ts.getNormalizedAbsolutePath(file_1.fileName, currentDirectory) !== ts.getNormalizedAbsolutePath(fileName, currentDirectory)) { reportFileNamesDifferOnlyInCasingError(fileName, file_1.fileName, refFile, refPos, refEnd); } + if (file_1) { + file_1.wasReferenced = file_1.wasReferenced || isReference; + } return file_1; } var file = host.getSourceFile(fileName, options.target, function (hostErrorMessage) { @@ -31625,22 +35820,24 @@ var ts; fileProcessingDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage)); } }); - filesByName.set(normalizedAbsolutePath, file); + filesByName.set(path, file); if (file) { - file.path = normalizedAbsolutePath; + file.wasReferenced = file.wasReferenced || isReference; + file.path = path; if (host.useCaseSensitiveFileNames()) { - var existingFile = filesByNameIgnoreCase.get(normalizedAbsolutePath); + var existingFile = filesByNameIgnoreCase.get(path); if (existingFile) { reportFileNamesDifferOnlyInCasingError(fileName, existingFile.fileName, refFile, refPos, refEnd); } else { - filesByNameIgnoreCase.set(normalizedAbsolutePath, file); + filesByNameIgnoreCase.set(path, file); } } skipDefaultLib = skipDefaultLib || file.hasNoDefaultLib; var basePath = ts.getDirectoryPath(fileName); if (!options.noResolve) { - processReferencedFiles(file, basePath); + processReferencedFiles(file, basePath, isDefaultLib); + processTypeReferenceDirectives(file); } processImportedModules(file, basePath); if (isDefaultLib) { @@ -31652,30 +35849,85 @@ var ts; } return file; } - function processReferencedFiles(file, basePath) { + function processReferencedFiles(file, basePath, isDefaultLib) { ts.forEach(file.referencedFiles, function (ref) { var referencedFileName = resolveTripleslashReference(ref.fileName, file.fileName); - processSourceFile(referencedFileName, false, file, ref.pos, ref.end); + processSourceFile(referencedFileName, isDefaultLib, true, file, ref.pos, ref.end); }); } + function processTypeReferenceDirectives(file) { + var typeDirectives = ts.map(file.typeReferenceDirectives, function (l) { return l.fileName; }); + var resolutions = resolveTypeReferenceDirectiveNamesWorker(typeDirectives, file.fileName); + for (var i = 0; i < typeDirectives.length; i++) { + var ref = file.typeReferenceDirectives[i]; + var resolvedTypeReferenceDirective = resolutions[i]; + ts.setResolvedTypeReferenceDirective(file, ref.fileName, resolvedTypeReferenceDirective); + processTypeReferenceDirective(ref.fileName, resolvedTypeReferenceDirective, file, ref.pos, ref.end); + } + } + function processTypeReferenceDirective(typeReferenceDirective, resolvedTypeReferenceDirective, refFile, refPos, refEnd) { + var previousResolution = resolvedTypeReferenceDirectives[typeReferenceDirective]; + if (previousResolution && previousResolution.primary) { + return; + } + var saveResolution = true; + if (resolvedTypeReferenceDirective) { + if (resolvedTypeReferenceDirective.primary) { + processSourceFile(resolvedTypeReferenceDirective.resolvedFileName, false, true, refFile, refPos, refEnd); + } + else { + if (previousResolution) { + var otherFileText = host.readFile(resolvedTypeReferenceDirective.resolvedFileName); + if (otherFileText !== getSourceFile(previousResolution.resolvedFileName).text) { + fileProcessingDiagnostics.add(createDiagnostic(refFile, refPos, refEnd, ts.Diagnostics.Conflicting_library_definitions_for_0_found_at_1_and_2_Copy_the_correct_file_to_the_typings_folder_to_resolve_this_conflict, typeReferenceDirective, resolvedTypeReferenceDirective.resolvedFileName, previousResolution.resolvedFileName)); + } + saveResolution = false; + } + else { + processSourceFile(resolvedTypeReferenceDirective.resolvedFileName, false, true, refFile, refPos, refEnd); + } + } + } + else { + fileProcessingDiagnostics.add(createDiagnostic(refFile, refPos, refEnd, ts.Diagnostics.Cannot_find_name_0, typeReferenceDirective)); + } + if (saveResolution) { + resolvedTypeReferenceDirectives[typeReferenceDirective] = resolvedTypeReferenceDirective; + } + } + function createDiagnostic(refFile, refPos, refEnd, message) { + var args = []; + for (var _i = 4; _i < arguments.length; _i++) { + args[_i - 4] = arguments[_i]; + } + if (refFile === undefined || refPos === undefined || refEnd === undefined) { + return ts.createCompilerDiagnostic.apply(void 0, [message].concat(args)); + } + else { + return ts.createFileDiagnostic.apply(void 0, [refFile, refPos, refEnd - refPos, message].concat(args)); + } + } function getCanonicalFileName(fileName) { return host.getCanonicalFileName(fileName); } function processImportedModules(file, basePath) { collectExternalModuleReferences(file); - if (file.imports.length) { + if (file.imports.length || file.moduleAugmentations.length) { file.resolvedModules = {}; - var moduleNames = ts.map(file.imports, function (name) { return name.text; }); + var moduleNames = ts.map(ts.concatenate(file.imports, file.moduleAugmentations), getTextOfLiteral); var resolutions = resolveModuleNamesWorker(moduleNames, ts.getNormalizedAbsolutePath(file.fileName, currentDirectory)); - for (var i = 0; i < file.imports.length; ++i) { + for (var i = 0; i < moduleNames.length; i++) { var resolution = resolutions[i]; ts.setResolvedModule(file, moduleNames[i], resolution); - if (resolution && !options.noResolve) { - var importedFile = findSourceFile(resolution.resolvedFileName, ts.toPath(resolution.resolvedFileName, currentDirectory, getCanonicalFileName), false, file, ts.skipTrivia(file.text, file.imports[i].pos), file.imports[i].end); + var shouldAddFile = resolution && + !options.noResolve && + i < file.imports.length; + if (shouldAddFile) { + var importedFile = findSourceFile(resolution.resolvedFileName, ts.toPath(resolution.resolvedFileName, currentDirectory, getCanonicalFileName), false, false, file, ts.skipTrivia(file.text, file.imports[i].pos), file.imports[i].end); if (importedFile && resolution.isExternalLibraryImport) { - if (!ts.isExternalModule(importedFile)) { - var start_2 = ts.getTokenPosOfNode(file.imports[i], file); - fileProcessingDiagnostics.add(ts.createFileDiagnostic(file, start_2, file.imports[i].end - start_2, ts.Diagnostics.Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_the_package_definition, importedFile.fileName)); + if (!ts.isExternalModule(importedFile) && importedFile.statements.length) { + var start_5 = ts.getTokenPosOfNode(file.imports[i], file); + fileProcessingDiagnostics.add(ts.createFileDiagnostic(file, start_5, file.imports[i].end - start_5, ts.Diagnostics.Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_the_package_definition, importedFile.fileName)); } else if (importedFile.referencedFiles.length) { var firstRef = importedFile.referencedFiles[0]; @@ -31691,42 +35943,21 @@ var ts; return; } function computeCommonSourceDirectory(sourceFiles) { - var commonPathComponents; - ts.forEach(files, function (sourceFile) { - if (ts.isDeclarationFile(sourceFile)) { - return; + var fileNames = []; + for (var _i = 0, sourceFiles_2 = sourceFiles; _i < sourceFiles_2.length; _i++) { + var file = sourceFiles_2[_i]; + if (!file.isDeclarationFile) { + fileNames.push(file.fileName); } - var sourcePathComponents = ts.getNormalizedPathComponents(sourceFile.fileName, currentDirectory); - sourcePathComponents.pop(); - if (!commonPathComponents) { - commonPathComponents = sourcePathComponents; - return; - } - for (var i = 0, n = Math.min(commonPathComponents.length, sourcePathComponents.length); i < n; i++) { - if (commonPathComponents[i] !== sourcePathComponents[i]) { - if (i === 0) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files)); - return; - } - commonPathComponents.length = i; - break; - } - } - if (sourcePathComponents.length < commonPathComponents.length) { - commonPathComponents.length = sourcePathComponents.length; - } - }); - if (!commonPathComponents) { - return currentDirectory; } - return ts.getNormalizedPathFromPathComponents(commonPathComponents); + return computeCommonSourceDirectoryOfFilenames(fileNames, currentDirectory, getCanonicalFileName); } function checkSourceFilesBelongToPath(sourceFiles, rootDirectory) { var allFilesBelongToPath = true; if (sourceFiles) { var absoluteRootDirectoryPath = host.getCanonicalFileName(ts.getNormalizedAbsolutePath(rootDirectory, currentDirectory)); - for (var _i = 0, sourceFiles_1 = sourceFiles; _i < sourceFiles_1.length; _i++) { - var sourceFile = sourceFiles_1[_i]; + for (var _i = 0, sourceFiles_3 = sourceFiles; _i < sourceFiles_3.length; _i++) { + var sourceFile = sourceFiles_3[_i]; if (!ts.isDeclarationFile(sourceFile)) { var absoluteSourceFilePath = host.getCanonicalFileName(ts.getNormalizedAbsolutePath(sourceFile.fileName, currentDirectory)); if (absoluteSourceFilePath.indexOf(absoluteRootDirectoryPath) !== 0) { @@ -31760,14 +35991,44 @@ var ts; if (options.mapRoot) { programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "mapRoot", "inlineSourceMap")); } - if (options.sourceRoot) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceRoot", "inlineSourceMap")); + } + if (options.paths && options.baseUrl === undefined) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_paths_cannot_be_used_without_specifying_baseUrl_option)); + } + if (options.paths) { + for (var key in options.paths) { + if (!ts.hasProperty(options.paths, key)) { + continue; + } + if (!hasZeroOrOneAsteriskCharacter(key)) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Pattern_0_can_have_at_most_one_Asterisk_character, key)); + } + if (ts.isArray(options.paths[key])) { + for (var _i = 0, _a = options.paths[key]; _i < _a.length; _i++) { + var subst = _a[_i]; + var typeOfSubst = typeof subst; + if (typeOfSubst === "string") { + if (!hasZeroOrOneAsteriskCharacter(subst)) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character, subst, key)); + } + } + else { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Substitution_0_for_pattern_1_has_incorrect_type_expected_string_got_2, subst, key, typeOfSubst)); + } + } + } + else { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Substututions_for_pattern_0_should_be_an_array, key)); + } } } if (options.inlineSources) { if (!options.sourceMap && !options.inlineSourceMap) { programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_inlineSources_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided)); } + if (options.sourceRoot) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceRoot", "inlineSources")); + } } if (options.out && options.outFile) { programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "outFile")); @@ -31776,16 +36037,26 @@ var ts; if (options.mapRoot) { programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "mapRoot", "sourceMap")); } - if (options.sourceRoot) { + if (options.sourceRoot && !options.inlineSourceMap) { programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "sourceRoot", "sourceMap")); } - return; + } + if (options.declarationDir) { + if (!options.declaration) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "declarationDir", "declaration")); + } + if (options.out || options.outFile) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "declarationDir", options.out ? "out" : "outFile")); + } + } + if (options.lib && options.noLib) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "lib", "noLib")); } var languageVersion = options.target || 0; var outFile = options.outFile || options.out; var firstExternalModuleSourceFile = ts.forEach(files, function (f) { return ts.isExternalModule(f) ? f : undefined; }); if (options.isolatedModules) { - if (!options.module && languageVersion < 2) { + if (options.module === ts.ModuleKind.None && languageVersion < 2) { programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES2015_or_higher)); } var firstNonExternalModuleSourceFile = ts.forEach(files, function (f) { return !ts.isExternalModule(f) && !ts.isDeclarationFile(f) ? f : undefined; }); @@ -31794,47 +36065,60 @@ var ts; programDiagnostics.add(ts.createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided)); } } - else if (firstExternalModuleSourceFile && languageVersion < 2 && !options.module) { + else if (firstExternalModuleSourceFile && languageVersion < 2 && options.module === ts.ModuleKind.None) { var span = ts.getErrorSpanForNode(firstExternalModuleSourceFile, firstExternalModuleSourceFile.externalModuleIndicator); - programDiagnostics.add(ts.createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_modules_unless_the_module_flag_is_provided)); + programDiagnostics.add(ts.createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_modules_unless_the_module_flag_is_provided_with_a_valid_module_type_Consider_setting_the_module_compiler_option_in_a_tsconfig_json_file)); } - if (options.module === 5 && languageVersion < 2) { + if (options.module === ts.ModuleKind.ES6 && languageVersion < 2) { programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_compile_modules_into_es2015_when_targeting_ES5_or_lower)); } - if (outFile && options.module && !(options.module === 2 || options.module === 4)) { + if (outFile && options.module && !(options.module === ts.ModuleKind.AMD || options.module === ts.ModuleKind.System)) { programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Only_amd_and_system_modules_are_supported_alongside_0, options.out ? "out" : "outFile")); } if (options.outDir || options.sourceRoot || options.mapRoot) { - if (options.rootDir && checkSourceFilesBelongToPath(files, options.rootDir)) { - commonSourceDirectory = ts.getNormalizedAbsolutePath(options.rootDir, currentDirectory); - } - else { - commonSourceDirectory = computeCommonSourceDirectory(files); - } - if (commonSourceDirectory && commonSourceDirectory[commonSourceDirectory.length - 1] !== ts.directorySeparator) { - commonSourceDirectory += ts.directorySeparator; + var dir = getCommonSourceDirectory(); + if (options.outDir && dir === "" && ts.forEach(files, function (file) { return ts.getRootLength(file.fileName) > 1; })) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files)); } } - if (options.noEmit) { - if (options.out) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "out")); - } - if (options.outFile) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outFile")); - } - if (options.outDir) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outDir")); - } - if (options.declaration) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "declaration")); - } + if (!options.noEmit && options.allowJs && options.declaration) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "allowJs", "declaration")); } if (options.emitDecoratorMetadata && !options.experimentalDecorators) { programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators")); } + if (options.reactNamespace && !ts.isIdentifier(options.reactNamespace, languageVersion)) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier, options.reactNamespace)); + } + if (!options.noEmit && !options.suppressOutputPathCheck) { + var emitHost = getEmitHost(); + var emitFilesSeen_1 = ts.createFileMap(!host.useCaseSensitiveFileNames() ? function (key) { return key.toLocaleLowerCase(); } : undefined); + ts.forEachExpectedEmitFile(emitHost, function (emitFileNames, sourceFiles, isBundledEmit) { + verifyEmitFilePath(emitFileNames.jsFilePath, emitFilesSeen_1); + verifyEmitFilePath(emitFileNames.declarationFilePath, emitFilesSeen_1); + }); + } + function verifyEmitFilePath(emitFileName, emitFilesSeen) { + if (emitFileName) { + var emitFilePath = ts.toPath(emitFileName, currentDirectory, getCanonicalFileName); + if (filesByName.contains(emitFilePath)) { + createEmitBlockingDiagnostics(emitFileName, emitFilePath, ts.Diagnostics.Cannot_write_file_0_because_it_would_overwrite_input_file); + } + if (emitFilesSeen.contains(emitFilePath)) { + createEmitBlockingDiagnostics(emitFileName, emitFilePath, ts.Diagnostics.Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files); + } + else { + emitFilesSeen.set(emitFilePath, true); + } + } + } + } + function createEmitBlockingDiagnostics(emitFileName, emitFilePath, message) { + hasEmitBlockingDiagnostics.set(ts.toPath(emitFileName, currentDirectory, getCanonicalFileName), true); + programDiagnostics.add(ts.createCompilerDiagnostic(message, emitFileName)); } } ts.createProgram = createProgram; @@ -31852,6 +36136,12 @@ var ts; type: "boolean", description: ts.Diagnostics.Generates_corresponding_d_ts_file }, + { + name: "declarationDir", + type: "string", + isFilePath: true, + paramType: ts.Diagnostics.DIRECTORY + }, { name: "diagnostics", type: "boolean" @@ -31886,8 +36176,12 @@ var ts; "react": 2 }, paramType: ts.Diagnostics.KIND, - description: ts.Diagnostics.Specify_JSX_code_generation_Colon_preserve_or_react, - error: ts.Diagnostics.Argument_for_jsx_must_be_preserve_or_react + description: ts.Diagnostics.Specify_JSX_code_generation_Colon_preserve_or_react + }, + { + name: "reactNamespace", + type: "string", + description: ts.Diagnostics.Specify_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit }, { name: "listFiles", @@ -31901,23 +36195,23 @@ var ts; name: "mapRoot", type: "string", isFilePath: true, - description: ts.Diagnostics.Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations, + description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations, paramType: ts.Diagnostics.LOCATION }, { name: "module", shortName: "m", type: { - "commonjs": 1, - "amd": 2, - "system": 4, - "umd": 3, - "es6": 5, - "es2015": 5 + "none": ts.ModuleKind.None, + "commonjs": ts.ModuleKind.CommonJS, + "amd": ts.ModuleKind.AMD, + "system": ts.ModuleKind.System, + "umd": ts.ModuleKind.UMD, + "es6": ts.ModuleKind.ES6, + "es2015": ts.ModuleKind.ES2015 }, description: ts.Diagnostics.Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015, - paramType: ts.Diagnostics.KIND, - error: ts.Diagnostics.Argument_for_module_option_must_be_commonjs_amd_system_umd_or_es2015 + paramType: ts.Diagnostics.KIND }, { name: "newLine", @@ -31925,9 +36219,8 @@ var ts; "crlf": 0, "lf": 1 }, - description: ts.Diagnostics.Specifies_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix, - paramType: ts.Diagnostics.NEWLINE, - error: ts.Diagnostics.Argument_for_newLine_option_must_be_CRLF_or_LF + description: ts.Diagnostics.Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix, + paramType: ts.Diagnostics.NEWLINE }, { name: "noEmit", @@ -31948,6 +36241,11 @@ var ts; type: "boolean", description: ts.Diagnostics.Raise_error_on_expressions_and_declarations_with_an_implied_any_type }, + { + name: "noImplicitThis", + type: "boolean", + description: ts.Diagnostics.Raise_error_on_this_expressions_with_an_implied_any_type + }, { name: "noLib", type: "boolean" @@ -31987,7 +36285,6 @@ var ts; }, { name: "pretty", - paramType: ts.Diagnostics.KIND, description: ts.Diagnostics.Stylize_errors_and_messages_using_color_and_context_experimental, type: "boolean" }, @@ -32008,8 +36305,8 @@ var ts; name: "rootDir", type: "string", isFilePath: true, - description: ts.Diagnostics.Specifies_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir, - paramType: ts.Diagnostics.LOCATION + paramType: ts.Diagnostics.LOCATION, + description: ts.Diagnostics.Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir }, { name: "isolatedModules", @@ -32024,7 +36321,7 @@ var ts; name: "sourceRoot", type: "string", isFilePath: true, - description: ts.Diagnostics.Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations, + description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations, paramType: ts.Diagnostics.LOCATION }, { @@ -32053,9 +36350,8 @@ var ts; "es6": 2, "es2015": 2 }, - description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015_experimental, - paramType: ts.Diagnostics.VERSION, - error: ts.Diagnostics.Argument_for_target_option_must_be_ES3_ES5_or_ES2015 + description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015, + paramType: ts.Diagnostics.VERSION }, { name: "version", @@ -32083,11 +36379,10 @@ var ts; { name: "moduleResolution", type: { - "node": 2, - "classic": 1 + "node": ts.ModuleResolutionKind.NodeJs, + "classic": ts.ModuleResolutionKind.Classic }, - description: ts.Diagnostics.Specifies_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6, - error: ts.Diagnostics.Argument_for_moduleResolution_option_must_be_node_or_classic + description: ts.Diagnostics.Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6 }, { name: "allowUnusedLabels", @@ -32113,6 +36408,131 @@ var ts; name: "forceConsistentCasingInFileNames", type: "boolean", description: ts.Diagnostics.Disallow_inconsistently_cased_references_to_the_same_file + }, + { + name: "baseUrl", + type: "string", + isFilePath: true, + description: ts.Diagnostics.Base_directory_to_resolve_non_absolute_module_names + }, + { + name: "paths", + type: "object", + isTSConfigOnly: true + }, + { + name: "rootDirs", + type: "list", + isTSConfigOnly: true, + element: { + name: "rootDirs", + type: "string", + isFilePath: true + } + }, + { + name: "typesSearchPaths", + type: "list", + isTSConfigOnly: true, + element: { + name: "typesSearchPaths", + type: "string", + isFilePath: true + } + }, + { + name: "typesRoot", + type: "string" + }, + { + name: "types", + type: "list", + element: { + name: "types", + type: "string" + }, + description: ts.Diagnostics.Type_declaration_files_to_be_included_in_compilation + }, + { + name: "traceResolution", + type: "boolean", + description: ts.Diagnostics.Enable_tracing_of_the_name_resolution_process + }, + { + name: "allowJs", + type: "boolean", + description: ts.Diagnostics.Allow_javascript_files_to_be_compiled + }, + { + name: "allowSyntheticDefaultImports", + type: "boolean", + description: ts.Diagnostics.Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typechecking + }, + { + name: "noImplicitUseStrict", + type: "boolean", + description: ts.Diagnostics.Do_not_emit_use_strict_directives_in_module_output + }, + { + name: "listEmittedFiles", + type: "boolean" + }, + { + name: "lib", + type: "list", + element: { + name: "lib", + type: { + "es5": "lib.es5.d.ts", + "es6": "lib.es2015.d.ts", + "es2015": "lib.es2015.d.ts", + "es7": "lib.es2016.d.ts", + "es2016": "lib.es2016.d.ts", + "es2017": "lib.es2017.d.ts", + "dom": "lib.dom.d.ts", + "webworker": "lib.webworker.d.ts", + "scripthost": "lib.scripthost.d.ts", + "es2015.core": "lib.es2015.core.d.ts", + "es2015.collection": "lib.es2015.collection.d.ts", + "es2015.generator": "lib.es2015.generator.d.ts", + "es2015.iterable": "lib.es2015.iterable.d.ts", + "es2015.promise": "lib.es2015.promise.d.ts", + "es2015.proxy": "lib.es2015.proxy.d.ts", + "es2015.reflect": "lib.es2015.reflect.d.ts", + "es2015.symbol": "lib.es2015.symbol.d.ts", + "es2015.symbol.wellknown": "lib.es2015.symbol.wellknown.d.ts", + "es2016.array.include": "lib.es2016.array.include.d.ts", + "es2017.object": "lib.es2017.object.d.ts" + } + }, + description: ts.Diagnostics.Specify_library_files_to_be_included_in_the_compilation_Colon + }, + { + name: "strictNullChecks", + type: "boolean", + description: ts.Diagnostics.Enable_strict_null_checks + } + ]; + ts.typingOptionDeclarations = [ + { + name: "enableAutoDiscovery", + type: "boolean" + }, + { + name: "include", + type: "list", + element: { + name: "include", + type: "string" + } + }, + { + name: "exclude", + type: "list", + element: { + name: "exclude", + type: "string" + } } ]; var optionNameMapCache; @@ -32132,6 +36552,37 @@ var ts; return optionNameMapCache; } ts.getOptionNameMap = getOptionNameMap; + function createCompilerDiagnosticForInvalidCustomType(opt) { + var namesOfType = []; + ts.forEachKey(opt.type, function (key) { + namesOfType.push(" '" + key + "'"); + }); + return ts.createCompilerDiagnostic(ts.Diagnostics.Argument_for_0_option_must_be_Colon_1, "--" + opt.name, namesOfType); + } + ts.createCompilerDiagnosticForInvalidCustomType = createCompilerDiagnosticForInvalidCustomType; + function parseCustomTypeOption(opt, value, errors) { + var key = trimString((value || "")).toLowerCase(); + var map = opt.type; + if (ts.hasProperty(map, key)) { + return map[key]; + } + else { + errors.push(createCompilerDiagnosticForInvalidCustomType(opt)); + } + } + ts.parseCustomTypeOption = parseCustomTypeOption; + function parseListTypeOption(opt, value, errors) { + var values = trimString((value || "")).split(","); + switch (opt.element.type) { + case "number": + return ts.map(values, parseInt); + case "string": + return ts.map(values, function (v) { return v || ""; }); + default: + return ts.filter(ts.map(values, function (v) { return parseCustomTypeOption(opt.element, v, errors); }), function (v) { return !!v; }); + } + } + ts.parseListTypeOption = parseListTypeOption; function parseCommandLine(commandLine, readFile) { var options = {}; var fileNames = []; @@ -32146,7 +36597,8 @@ var ts; function parseStrings(args) { var i = 0; while (i < args.length) { - var s = args[i++]; + var s = args[i]; + i++; if (s.charCodeAt(0) === 64) { parseResponseFile(s.slice(1)); } @@ -32157,28 +36609,34 @@ var ts; } if (ts.hasProperty(optionNameMap, s)) { var opt = optionNameMap[s]; - if (!args[i] && opt.type !== "boolean") { - errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_expects_an_argument, opt.name)); + if (opt.isTSConfigOnly) { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_can_only_be_specified_in_tsconfig_json_file, opt.name)); } - switch (opt.type) { - case "number": - options[opt.name] = parseInt(args[i++]); - break; - case "boolean": - options[opt.name] = true; - break; - case "string": - options[opt.name] = args[i++] || ""; - break; - default: - var map_2 = opt.type; - var key = (args[i++] || "").toLowerCase(); - if (ts.hasProperty(map_2, key)) { - options[opt.name] = map_2[key]; - } - else { - errors.push(ts.createCompilerDiagnostic(opt.error)); - } + else { + if (!args[i] && opt.type !== "boolean") { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_expects_an_argument, opt.name)); + } + switch (opt.type) { + case "number": + options[opt.name] = parseInt(args[i]); + i++; + break; + case "boolean": + options[opt.name] = true; + break; + case "string": + options[opt.name] = args[i] || ""; + i++; + break; + case "list": + options[opt.name] = parseListTypeOption(opt, args[i], errors); + i++; + break; + default: + options[opt.name] = parseCustomTypeOption(opt, args[i], errors); + i++; + break; + } } } else { @@ -32264,17 +36722,26 @@ var ts; } return output; } - function parseJsonConfigFileContent(json, host, basePath) { - var _a = convertCompilerOptionsFromJson(json["compilerOptions"], basePath), options = _a.options, errors = _a.errors; + var IgnoreFileNamePattern = /(\.min\.js$)|([\\/]\.[\w.])/; + function parseJsonConfigFileContent(json, host, basePath, existingOptions, configFileName) { + if (existingOptions === void 0) { existingOptions = {}; } + var errors = []; + var compilerOptions = convertCompilerOptionsFromJsonWorker(json["compilerOptions"], basePath, errors, configFileName); + var options = ts.extend(existingOptions, compilerOptions); + var typingOptions = convertTypingOptionsFromJsonWorker(json["typingOptions"], basePath, errors, configFileName); + options.configFilePath = configFileName; + var fileNames = getFileNames(errors); return { options: options, - fileNames: getFileNames(), + fileNames: fileNames, + typingOptions: typingOptions, + raw: json, errors: errors }; - function getFileNames() { + function getFileNames(errors) { var fileNames = []; if (ts.hasProperty(json, "files")) { - if (json["files"] instanceof Array) { + if (ts.isArray(json["files"])) { fileNames = ts.map(json["files"], function (s) { return ts.combinePaths(basePath, s); }); } else { @@ -32282,73 +36749,128 @@ var ts; } } else { - var exclude = json["exclude"] instanceof Array ? ts.map(json["exclude"], ts.normalizeSlashes) : undefined; - var sysFiles = host.readDirectory(basePath, ".ts", exclude).concat(host.readDirectory(basePath, ".tsx", exclude)); - for (var i = 0; i < sysFiles.length; i++) { - var name_31 = sysFiles[i]; - if (ts.fileExtensionIs(name_31, ".d.ts")) { - var baseName = name_31.substr(0, name_31.length - ".d.ts".length); - if (!ts.contains(sysFiles, baseName + ".tsx") && !ts.contains(sysFiles, baseName + ".ts")) { - fileNames.push(name_31); + var filesSeen = {}; + var exclude = []; + if (ts.isArray(json["exclude"])) { + exclude = json["exclude"]; + } + else { + exclude = ["node_modules", "bower_components", "jspm_packages"]; + } + var outDir = json["compilerOptions"] && json["compilerOptions"]["outDir"]; + if (outDir) { + exclude.push(outDir); + } + exclude = ts.map(exclude, ts.normalizeSlashes); + var supportedExtensions = ts.getSupportedExtensions(options); + ts.Debug.assert(ts.indexOf(supportedExtensions, ".ts") < ts.indexOf(supportedExtensions, ".d.ts"), "Changed priority of extensions to pick"); + for (var _i = 0, supportedExtensions_1 = supportedExtensions; _i < supportedExtensions_1.length; _i++) { + var extension = supportedExtensions_1[_i]; + var filesInDirWithExtension = host.readDirectory(basePath, extension, exclude); + for (var _a = 0, filesInDirWithExtension_1 = filesInDirWithExtension; _a < filesInDirWithExtension_1.length; _a++) { + var fileName = filesInDirWithExtension_1[_a]; + if (extension === ".ts" && ts.fileExtensionIs(fileName, ".d.ts")) { + continue; } - } - else if (ts.fileExtensionIs(name_31, ".ts")) { - if (!ts.contains(sysFiles, name_31 + "x")) { - fileNames.push(name_31); + if (IgnoreFileNamePattern.test(fileName)) { + continue; } - } - else { - fileNames.push(name_31); + if (extension === ".d.ts" || (options.allowJs && ts.contains(ts.supportedJavascriptExtensions, extension))) { + var baseName = fileName.substr(0, fileName.length - extension.length); + if (ts.hasProperty(filesSeen, baseName + ".ts") || ts.hasProperty(filesSeen, baseName + ".tsx")) { + continue; + } + } + filesSeen[fileName] = true; + fileNames.push(fileName); } } } + if (ts.hasProperty(json, "excludes") && !ts.hasProperty(json, "exclude")) { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unknown_option_excludes_Did_you_mean_exclude)); + } return fileNames; } } ts.parseJsonConfigFileContent = parseJsonConfigFileContent; - function convertCompilerOptionsFromJson(jsonOptions, basePath) { - var options = {}; + function convertCompilerOptionsFromJson(jsonOptions, basePath, configFileName) { var errors = []; - if (!jsonOptions) { - return { options: options, errors: errors }; - } - var optionNameMap = ts.arrayToMap(ts.optionDeclarations, function (opt) { return opt.name; }); - for (var id in jsonOptions) { - if (ts.hasProperty(optionNameMap, id)) { - var opt = optionNameMap[id]; - var optType = opt.type; - var value = jsonOptions[id]; - var expectedType = typeof optType === "string" ? optType : "string"; - if (typeof value === expectedType) { - if (typeof optType !== "string") { - var key = value.toLowerCase(); - if (ts.hasProperty(optType, key)) { - value = optType[key]; - } - else { - errors.push(ts.createCompilerDiagnostic(opt.error)); - value = 0; - } - } - if (opt.isFilePath) { - value = ts.normalizePath(ts.combinePaths(basePath, value)); - if (value === "") { - value = "."; - } - } - options[opt.name] = value; - } - else { - errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, id, expectedType)); - } - } - else { - errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unknown_compiler_option_0, id)); - } - } + var options = convertCompilerOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName); return { options: options, errors: errors }; } ts.convertCompilerOptionsFromJson = convertCompilerOptionsFromJson; + function convertTypingOptionsFromJson(jsonOptions, basePath, configFileName) { + var errors = []; + var options = convertTypingOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName); + return { options: options, errors: errors }; + } + ts.convertTypingOptionsFromJson = convertTypingOptionsFromJson; + function convertCompilerOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName) { + var options = ts.getBaseFileName(configFileName) === "jsconfig.json" ? { allowJs: true } : {}; + convertOptionsFromJson(ts.optionDeclarations, jsonOptions, basePath, options, ts.Diagnostics.Unknown_compiler_option_0, errors); + return options; + } + function convertTypingOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName) { + var options = ts.getBaseFileName(configFileName) === "jsconfig.json" + ? { enableAutoDiscovery: true, include: [], exclude: [] } + : { enableAutoDiscovery: false, include: [], exclude: [] }; + convertOptionsFromJson(ts.typingOptionDeclarations, jsonOptions, basePath, options, ts.Diagnostics.Unknown_typing_option_0, errors); + return options; + } + function convertOptionsFromJson(optionDeclarations, jsonOptions, basePath, defaultOptions, diagnosticMessage, errors) { + if (!jsonOptions) { + return; + } + var optionNameMap = ts.arrayToMap(optionDeclarations, function (opt) { return opt.name; }); + for (var id in jsonOptions) { + if (ts.hasProperty(optionNameMap, id)) { + var opt = optionNameMap[id]; + defaultOptions[opt.name] = convertJsonOption(opt, jsonOptions[id], basePath, errors); + } + else { + errors.push(ts.createCompilerDiagnostic(diagnosticMessage, id)); + } + } + } + function convertJsonOption(opt, value, basePath, errors) { + var optType = opt.type; + var expectedType = typeof optType === "string" ? optType : "string"; + if (optType === "list" && ts.isArray(value)) { + return convertJsonOptionOfListType(opt, value, basePath, errors); + } + else if (typeof value === expectedType) { + if (typeof optType !== "string") { + return convertJsonOptionOfCustomType(opt, value, errors); + } + else { + if (opt.isFilePath) { + value = ts.normalizePath(ts.combinePaths(basePath, value)); + if (value === "") { + value = "."; + } + } + } + return value; + } + else { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, opt.name, expectedType)); + } + } + function convertJsonOptionOfCustomType(opt, value, errors) { + var key = value.toLowerCase(); + if (ts.hasProperty(opt.type, key)) { + return opt.type[key]; + } + else { + errors.push(createCompilerDiagnosticForInvalidCustomType(opt)); + } + } + function convertJsonOptionOfListType(option, values, basePath, errors) { + return ts.filter(ts.map(values, function (v) { return convertJsonOption(option.element, v, basePath, errors); }), function (v) { return !!v; }); + } + function trimString(s) { + return typeof s.trim === "function" ? s.trim() : s.replace(/^[\s]+|[\s]+$/g, ""); + } })(ts || (ts = {})); var ts; (function (ts) { @@ -32359,6 +36881,17 @@ var ts; reportDiagnostic(diagnostic, host); } } + function reportEmittedFiles(files, host) { + if (!files || files.length == 0) { + return; + } + var currentDir = ts.sys.getCurrentDirectory(); + for (var _i = 0, files_4 = files; _i < files_4.length; _i++) { + var file = files_4[_i]; + var filepath = ts.getNormalizedAbsolutePath(file, currentDir); + ts.sys.write("TSFILE: " + filepath + ts.sys.newLine); + } + } function validateLocaleAndSetLanguage(locale, errors) { var matchResult = /^([a-z]+)([_\-]([a-z]+))?$/.exec(locale.toLowerCase()); if (!matchResult) { @@ -32367,10 +36900,8 @@ var ts; } var language = matchResult[1]; var territory = matchResult[3]; - if (!trySetLanguageAndTerritory(language, territory, errors) && - !trySetLanguageAndTerritory(language, undefined, errors)) { - errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unsupported_locale_0, locale)); - return false; + if (!trySetLanguageAndTerritory(language, territory, errors)) { + trySetLanguageAndTerritory(language, undefined, errors); } return true; } @@ -32437,7 +36968,7 @@ var ts; var gutterStyleSequence = "\u001b[100;30m"; var gutterSeparator = " "; var resetEscapeSequence = "\u001b[0m"; - var elipsis = "..."; + var ellipsis = "..."; var categoryFormatMap = (_a = {}, _a[ts.DiagnosticCategory.Warning] = yellowForegroundEscapeSequence, _a[ts.DiagnosticCategory.Error] = redForegroundEscapeSequence, @@ -32458,12 +36989,12 @@ var ts; var hasMoreThanFiveLines = (lastLine - firstLine) >= 4; var gutterWidth = (lastLine + 1 + "").length; if (hasMoreThanFiveLines) { - gutterWidth = Math.max(elipsis.length, gutterWidth); + gutterWidth = Math.max(ellipsis.length, gutterWidth); } output += ts.sys.newLine; for (var i = firstLine; i <= lastLine; i++) { if (hasMoreThanFiveLines && firstLine + 1 < i && i < lastLine - 1) { - output += formatAndReset(padLeft(elipsis, gutterWidth), gutterStyleSequence) + gutterSeparator + ts.sys.newLine; + output += formatAndReset(padLeft(ellipsis, gutterWidth), gutterStyleSequence) + gutterSeparator + ts.sys.newLine; i = lastLine - 1; } var lineStart = ts.getPositionOfLineAndCharacter(file, i, 0); @@ -32562,7 +37093,7 @@ var ts; return ts.sys.exit(ts.ExitStatus.Success); } if (commandLine.options.version) { - reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.Version_0, ts.version), undefined); + printVersion(); return ts.sys.exit(ts.ExitStatus.Success); } if (commandLine.options.help) { @@ -32575,22 +37106,36 @@ var ts; reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.The_current_host_does_not_support_the_0_option, "--project"), undefined); return ts.sys.exit(ts.ExitStatus.DiagnosticsPresent_OutputsSkipped); } - configFileName = ts.normalizePath(ts.combinePaths(commandLine.options.project, "tsconfig.json")); if (commandLine.fileNames.length !== 0) { reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.Option_project_cannot_be_mixed_with_source_files_on_a_command_line), undefined); return ts.sys.exit(ts.ExitStatus.DiagnosticsPresent_OutputsSkipped); } + var fileOrDirectory = ts.normalizePath(commandLine.options.project); + if (!fileOrDirectory || ts.sys.directoryExists(fileOrDirectory)) { + configFileName = ts.combinePaths(fileOrDirectory, "tsconfig.json"); + if (!ts.sys.fileExists(configFileName)) { + reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0, commandLine.options.project), undefined); + return ts.sys.exit(ts.ExitStatus.DiagnosticsPresent_OutputsSkipped); + } + } + else { + configFileName = fileOrDirectory; + if (!ts.sys.fileExists(configFileName)) { + reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.The_specified_path_does_not_exist_Colon_0, commandLine.options.project), undefined); + return ts.sys.exit(ts.ExitStatus.DiagnosticsPresent_OutputsSkipped); + } + } } else if (commandLine.fileNames.length === 0 && isJSONSupported()) { var searchPath = ts.normalizePath(ts.sys.getCurrentDirectory()); - configFileName = ts.findConfigFile(searchPath); + configFileName = ts.findConfigFile(searchPath, ts.sys.fileExists); } if (commandLine.fileNames.length === 0 && !configFileName) { printVersion(); printHelp(); return ts.sys.exit(ts.ExitStatus.Success); } - if (commandLine.options.watch && commandLine.options.hasOwnProperty("watch")) { + if (ts.isWatchSet(commandLine.options)) { if (!ts.sys.watchFile) { reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.The_current_host_does_not_support_the_0_option, "--watch"), undefined); return ts.sys.exit(ts.ExitStatus.DiagnosticsPresent_OutputsSkipped); @@ -32629,12 +37174,23 @@ var ts; ts.sys.exit(ts.ExitStatus.DiagnosticsPresent_OutputsSkipped); return; } - var configParseResult = ts.parseJsonConfigFileContent(configObject, ts.sys, ts.getDirectoryPath(configFileName)); + var configParseResult = ts.parseJsonConfigFileContent(configObject, ts.sys, ts.getNormalizedAbsolutePath(ts.getDirectoryPath(configFileName), ts.sys.getCurrentDirectory()), commandLine.options, configFileName); if (configParseResult.errors.length > 0) { reportDiagnostics(configParseResult.errors, undefined); ts.sys.exit(ts.ExitStatus.DiagnosticsPresent_OutputsSkipped); return; } + if (ts.isWatchSet(configParseResult.options)) { + if (!ts.sys.watchFile) { + reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.The_current_host_does_not_support_the_0_option, "--watch"), undefined); + ts.sys.exit(ts.ExitStatus.DiagnosticsPresent_OutputsSkipped); + } + if (!directoryWatcher && ts.sys.watchDirectory && configFileName) { + var directory = ts.getDirectoryPath(configFileName); + directoryWatcher = ts.sys.watchDirectory(directory == "" ? "." : directory, watchedDirectoryChanged, true); + } + ; + } return configParseResult; } function performCompilation() { @@ -32642,7 +37198,7 @@ var ts; if (configFileName) { var configParseResult = parseConfigFile(); rootFileNames = configParseResult.fileNames; - compilerOptions = ts.extend(commandLine.options, configParseResult.options); + compilerOptions = configParseResult.options; } else { rootFileNames = commandLine.fileNames; @@ -32659,7 +37215,7 @@ var ts; } cachedExistingFiles = {}; var compileResult = compile(rootFileNames, compilerOptions, compilerHost); - if (!compilerOptions.watch) { + if (!ts.isWatchSet(compilerOptions)) { return ts.sys.exit(compileResult.exitStatus); } setCachedProgram(compileResult.program); @@ -32679,16 +37235,16 @@ var ts; } } var sourceFile = hostGetSourceFile(fileName, languageVersion, onError); - if (sourceFile && compilerOptions.watch) { + if (sourceFile && ts.isWatchSet(compilerOptions) && ts.sys.watchFile) { sourceFile.fileWatcher = ts.sys.watchFile(sourceFile.fileName, function (fileName, removed) { return sourceFileChanged(sourceFile, removed); }); } return sourceFile; } function setCachedProgram(program) { if (cachedProgram) { - var newSourceFiles = program ? program.getSourceFiles() : undefined; + var newSourceFiles_1 = program ? program.getSourceFiles() : undefined; ts.forEach(cachedProgram.getSourceFiles(), function (sourceFile) { - if (!(newSourceFiles && ts.contains(newSourceFiles, sourceFile))) { + if (!(newSourceFiles_1 && ts.contains(newSourceFiles_1, sourceFile))) { if (sourceFile.fileWatcher) { sourceFile.fileWatcher.close(); sourceFile.fileWatcher = undefined; @@ -32715,7 +37271,7 @@ var ts; startTimerForRecompilation(); } function watchedDirectoryChanged(fileName) { - if (fileName && !ts.isSupportedSourceFileName(fileName)) { + if (fileName && !ts.isSupportedSourceFileName(fileName, compilerOptions)) { return; } startTimerForHandlingDirectoryChanges(); @@ -32791,18 +37347,14 @@ var ts; diagnostics = program.getSemanticDiagnostics(); } } - reportDiagnostics(diagnostics, compilerHost); - if (compilerOptions.noEmit) { - return diagnostics.length - ? ts.ExitStatus.DiagnosticsPresent_OutputsSkipped - : ts.ExitStatus.Success; - } var emitOutput = program.emit(); - reportDiagnostics(emitOutput.diagnostics, compilerHost); - if (emitOutput.emitSkipped) { + diagnostics = diagnostics.concat(emitOutput.diagnostics); + reportDiagnostics(ts.sortAndDeduplicateDiagnostics(diagnostics), compilerHost); + reportEmittedFiles(emitOutput.emittedFiles, compilerHost); + if (emitOutput.emitSkipped && diagnostics.length > 0) { return ts.ExitStatus.DiagnosticsPresent_OutputsSkipped; } - if (diagnostics.length > 0 || emitOutput.diagnostics.length > 0) { + else if (diagnostics.length > 0) { return ts.ExitStatus.DiagnosticsPresent_OutputsGenerated; } return ts.ExitStatus.Success; @@ -32831,10 +37383,11 @@ var ts; marginLength = 0; var usageColumn = []; var descriptionColumn = []; - for (var i = 0; i < optsList.length; i++) { + var optionsDescriptionMap = {}; + var _loop_2 = function(i) { var option = optsList[i]; if (!option.description) { - continue; + return "continue"; } var usageText_1 = " "; if (option.shortName) { @@ -32845,8 +37398,24 @@ var ts; usageText_1 += "--" + option.name; usageText_1 += getParamType(option); usageColumn.push(usageText_1); - descriptionColumn.push(getDiagnosticText(option.description)); + var description = void 0; + if (option.name === "lib") { + description = getDiagnosticText(option.description); + var options_1 = []; + var element = option.element; + ts.forEachKey(element.type, function (key) { + options_1.push("'" + key + "'"); + }); + optionsDescriptionMap[description] = options_1; + } + else { + description = getDiagnosticText(option.description); + } + descriptionColumn.push(description); marginLength = Math.max(usageText_1.length, marginLength); + }; + for (var i = 0; i < optsList.length; i++) { + _loop_2(i); } var usageText = " @<" + getDiagnosticText(ts.Diagnostics.file) + ">"; usageColumn.push(usageText); @@ -32855,7 +37424,16 @@ var ts; for (var i = 0; i < usageColumn.length; i++) { var usage = usageColumn[i]; var description = descriptionColumn[i]; + var kindsList = optionsDescriptionMap[description]; output += usage + makePadding(marginLength - usage.length + 2) + description + ts.sys.newLine; + if (kindsList) { + output += makePadding(marginLength + 4); + for (var _i = 0, kindsList_1 = kindsList; _i < kindsList_1.length; _i++) { + var kind = kindsList_1[_i]; + output += kind + " "; + } + output += ts.sys.newLine; + } } ts.sys.write(output); return; @@ -32878,12 +37456,17 @@ var ts; else { var compilerOptions = ts.extend(options, ts.defaultInitCompilerOptions); var configurations = { - compilerOptions: serializeCompilerOptions(compilerOptions), - exclude: ["node_modules"] + compilerOptions: serializeCompilerOptions(compilerOptions) }; if (fileNames && fileNames.length) { configurations.files = fileNames; } + else { + configurations.exclude = ["node_modules"]; + if (compilerOptions.outDir) { + configurations.exclude.push(compilerOptions.outDir); + } + } ts.sys.writeFile(file, JSON.stringify(configurations, undefined, 4)); reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.Successfully_created_a_tsconfig_json_file), undefined); } @@ -32891,10 +37474,10 @@ var ts; function serializeCompilerOptions(options) { var result = {}; var optionsNameMap = ts.getOptionNameMap().optionNameMap; - for (var name_32 in options) { - if (ts.hasProperty(options, name_32)) { - var value = options[name_32]; - switch (name_32) { + for (var name_34 in options) { + if (ts.hasProperty(options, name_34)) { + var value = options[name_34]; + switch (name_34) { case "init": case "watch": case "version": @@ -32902,17 +37485,17 @@ var ts; case "project": break; default: - var optionDefinition = optionsNameMap[name_32.toLowerCase()]; + var optionDefinition = optionsNameMap[name_34.toLowerCase()]; if (optionDefinition) { if (typeof optionDefinition.type === "string") { - result[name_32] = value; + result[name_34] = value; } else { var typeMap = optionDefinition.type; for (var key in typeMap) { if (ts.hasProperty(typeMap, key)) { if (typeMap[key] === value) - result[name_32] = key; + result[name_34] = key; } } } diff --git a/lib/tsserver.js b/lib/tsserver.js index 9f0c1674080..ecb7bfb5509 100644 --- a/lib/tsserver.js +++ b/lib/tsserver.js @@ -13,13 +13,18 @@ See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; var ts; (function (ts) { var OperationCanceledException = (function () { function OperationCanceledException() { } return OperationCanceledException; - })(); + }()); ts.OperationCanceledException = OperationCanceledException; (function (ExitStatus) { ExitStatus[ExitStatus["Success"] = 0] = "Success"; @@ -46,6 +51,21 @@ var ts; DiagnosticCategory[DiagnosticCategory["Message"] = 2] = "Message"; })(ts.DiagnosticCategory || (ts.DiagnosticCategory = {})); var DiagnosticCategory = ts.DiagnosticCategory; + (function (ModuleResolutionKind) { + ModuleResolutionKind[ModuleResolutionKind["Classic"] = 1] = "Classic"; + ModuleResolutionKind[ModuleResolutionKind["NodeJs"] = 2] = "NodeJs"; + })(ts.ModuleResolutionKind || (ts.ModuleResolutionKind = {})); + var ModuleResolutionKind = ts.ModuleResolutionKind; + (function (ModuleKind) { + ModuleKind[ModuleKind["None"] = 0] = "None"; + ModuleKind[ModuleKind["CommonJS"] = 1] = "CommonJS"; + ModuleKind[ModuleKind["AMD"] = 2] = "AMD"; + ModuleKind[ModuleKind["UMD"] = 3] = "UMD"; + ModuleKind[ModuleKind["System"] = 4] = "System"; + ModuleKind[ModuleKind["ES6"] = 5] = "ES6"; + ModuleKind[ModuleKind["ES2015"] = 5] = "ES2015"; + })(ts.ModuleKind || (ts.ModuleKind = {})); + var ModuleKind = ts.ModuleKind; })(ts || (ts = {})); var ts; (function (ts) { @@ -104,11 +124,11 @@ var ts; return undefined; } ts.forEach = forEach; - function contains(array, value) { + function contains(array, value, areEqual) { if (array) { for (var _i = 0, array_1 = array; _i < array_1.length; _i++) { var v = array_1[_i]; - if (v === value) { + if (areEqual ? areEqual(v, value) : v === value) { return true; } } @@ -174,13 +194,13 @@ var ts; return array1.concat(array2); } ts.concatenate = concatenate; - function deduplicate(array) { + function deduplicate(array, areEqual) { var result; if (array) { result = []; for (var _i = 0, array_5 = array; _i < array_5.length; _i++) { var item = array_5[_i]; - if (!contains(result, item)) { + if (!contains(result, item, areEqual)) { result.push(item); } } @@ -247,9 +267,17 @@ var ts; var count = array.length; if (count > 0) { var pos = 0; - var result = arguments.length <= 2 ? array[pos++] : initial; + var result = void 0; + if (arguments.length <= 2) { + result = array[pos]; + pos++; + } + else { + result = initial; + } while (pos < count) { - result = f(result, array[pos++]); + result = f(result, array[pos]); + pos++; } return result; } @@ -261,9 +289,17 @@ var ts; if (array) { var pos = array.length - 1; if (pos >= 0) { - var result = arguments.length <= 2 ? array[pos--] : initial; + var result = void 0; + if (arguments.length <= 2) { + result = array[pos]; + pos--; + } + else { + result = initial; + } while (pos >= 0) { - result = f(result, array[pos--]); + result = f(result, array[pos]); + pos--; } return result; } @@ -276,6 +312,14 @@ var ts; return hasOwnProperty.call(map, key); } ts.hasProperty = hasProperty; + function getKeys(map) { + var keys = []; + for (var key in map) { + keys.push(key); + } + return keys; + } + ts.getKeys = getKeys; function getProperty(map, key) { return hasOwnProperty.call(map, key) ? map[key] : undefined; } @@ -346,6 +390,22 @@ var ts; return result; } ts.arrayToMap = arrayToMap; + function reduceProperties(map, callback, initial) { + var result = initial; + if (map) { + for (var key in map) { + if (hasProperty(map, key)) { + result = callback(result, map[key], String(key)); + } + } + } + return result; + } + ts.reduceProperties = reduceProperties; + function isArray(value) { + return Array.isArray ? Array.isArray(value) : value instanceof Array; + } + ts.isArray = isArray; function memoize(callback) { var value; return function () { @@ -390,6 +450,14 @@ var ts; }; } ts.createFileDiagnostic = createFileDiagnostic; + function formatMessage(dummy, message) { + var text = getLocaleSpecificMessage(message); + if (arguments.length > 2) { + text = formatStringFromArgs(text, arguments, 2); + } + return text; + } + ts.formatMessage = formatMessage; function createCompilerDiagnostic(message) { var text = getLocaleSpecificMessage(message); if (arguments.length > 1) { @@ -616,7 +684,8 @@ var ts; if (directoryComponents.length > 1 && lastOrUndefined(directoryComponents) === "") { directoryComponents.length--; } - for (var joinStartIndex = 0; joinStartIndex < pathComponents.length && joinStartIndex < directoryComponents.length; joinStartIndex++) { + var joinStartIndex; + for (joinStartIndex = 0; joinStartIndex < pathComponents.length && joinStartIndex < directoryComponents.length; joinStartIndex++) { if (getCanonicalFileName(directoryComponents[joinStartIndex]) !== getCanonicalFileName(pathComponents[joinStartIndex])) { break; } @@ -639,7 +708,7 @@ var ts; } ts.getRelativePathToDirectoryOrUrl = getRelativePathToDirectoryOrUrl; function getBaseFileName(path) { - if (!path) { + if (path === undefined) { return undefined; } var i = path.lastIndexOf(ts.directorySeparator); @@ -664,14 +733,39 @@ var ts; return pathLen > extLen && path.substr(pathLen - extLen, extLen) === extension; } ts.fileExtensionIs = fileExtensionIs; - ts.supportedExtensions = [".ts", ".tsx", ".d.ts"]; - ts.supportedJsExtensions = ts.supportedExtensions.concat(".js", ".jsx"); - function isSupportedSourceFileName(fileName) { + function ensureScriptKind(fileName, scriptKind) { + return (scriptKind || getScriptKindFromFileName(fileName)) || 3; + } + ts.ensureScriptKind = ensureScriptKind; + function getScriptKindFromFileName(fileName) { + var ext = fileName.substr(fileName.lastIndexOf(".")); + switch (ext.toLowerCase()) { + case ".js": + return 1; + case ".jsx": + return 2; + case ".ts": + return 3; + case ".tsx": + return 4; + default: + return 0; + } + } + ts.getScriptKindFromFileName = getScriptKindFromFileName; + ts.supportedTypeScriptExtensions = [".ts", ".tsx", ".d.ts"]; + ts.supportedJavascriptExtensions = [".js", ".jsx"]; + var allSupportedExtensions = ts.supportedTypeScriptExtensions.concat(ts.supportedJavascriptExtensions); + function getSupportedExtensions(options) { + return options && options.allowJs ? allSupportedExtensions : ts.supportedTypeScriptExtensions; + } + ts.getSupportedExtensions = getSupportedExtensions; + function isSupportedSourceFileName(fileName, compilerOptions) { if (!fileName) { return false; } - for (var _i = 0, supportedExtensions_1 = ts.supportedExtensions; _i < supportedExtensions_1.length; _i++) { - var extension = supportedExtensions_1[_i]; + for (var _i = 0, _a = getSupportedExtensions(compilerOptions); _i < _a.length; _i++) { + var extension = _a[_i]; if (fileExtensionIs(fileName, extension)) { return true; } @@ -690,22 +784,6 @@ var ts; return path; } ts.removeFileExtension = removeFileExtension; - var backslashOrDoubleQuote = /[\"\\]/g; - var escapedCharsRegExp = /[\u0000-\u001f\t\v\f\b\r\n\u2028\u2029\u0085]/g; - var escapedCharsMap = { - "\0": "\\0", - "\t": "\\t", - "\v": "\\v", - "\f": "\\f", - "\b": "\\b", - "\r": "\\r", - "\n": "\\n", - "\\": "\\\\", - "\"": "\\\"", - "\u2028": "\\u2028", - "\u2029": "\\u2029", - "\u0085": "\\u0085" - }; function Symbol(flags, name) { this.flags = flags; this.name = name; @@ -764,6 +842,12 @@ var ts; return copiedList; } ts.copyListRemovingItem = copyListRemovingItem; + function createGetCanonicalFileName(useCaseSensitivefileNames) { + return useCaseSensitivefileNames + ? (function (fileName) { return fileName; }) + : (function (fileName) { return fileName.toLowerCase(); }); + } + ts.createGetCanonicalFileName = createGetCanonicalFileName; })(ts || (ts = {})); var ts; (function (ts) { @@ -902,72 +986,73 @@ var ts; var _fs = require("fs"); var _path = require("path"); var _os = require("os"); - var _tty = require("tty"); - function createWatchedFileSet(interval, chunkSize) { - if (interval === void 0) { interval = 2500; } - if (chunkSize === void 0) { chunkSize = 30; } - var watchedFiles = []; - var nextFileToCheck = 0; - var watchTimer; - function getModifiedTime(fileName) { - return _fs.statSync(fileName).mtime; + var _crypto = require("crypto"); + var useNonPollingWatchers = process.env["TSC_NONPOLLING_WATCHER"]; + function createWatchedFileSet() { + var dirWatchers = {}; + var fileWatcherCallbacks = {}; + return { addFile: addFile, removeFile: removeFile }; + function reduceDirWatcherRefCountForFile(fileName) { + var dirName = ts.getDirectoryPath(fileName); + if (ts.hasProperty(dirWatchers, dirName)) { + var watcher = dirWatchers[dirName]; + watcher.referenceCount -= 1; + if (watcher.referenceCount <= 0) { + watcher.close(); + delete dirWatchers[dirName]; + } + } } - function poll(checkedIndex) { - var watchedFile = watchedFiles[checkedIndex]; - if (!watchedFile) { + function addDirWatcher(dirPath) { + if (ts.hasProperty(dirWatchers, dirPath)) { + var watcher_1 = dirWatchers[dirPath]; + watcher_1.referenceCount += 1; return; } - _fs.stat(watchedFile.fileName, function (err, stats) { - if (err) { - watchedFile.callback(watchedFile.fileName); - } - else if (watchedFile.mtime.getTime() !== stats.mtime.getTime()) { - watchedFile.mtime = getModifiedTime(watchedFile.fileName); - watchedFile.callback(watchedFile.fileName, watchedFile.mtime.getTime() === 0); - } - }); + var watcher = _fs.watch(dirPath, { persistent: true }, function (eventName, relativeFileName) { return fileEventHandler(eventName, relativeFileName, dirPath); }); + watcher.referenceCount = 1; + dirWatchers[dirPath] = watcher; + return; } - function startWatchTimer() { - watchTimer = setInterval(function () { - var count = 0; - var nextToCheck = nextFileToCheck; - var firstCheck = -1; - while ((count < chunkSize) && (nextToCheck !== firstCheck)) { - poll(nextToCheck); - if (firstCheck < 0) { - firstCheck = nextToCheck; - } - nextToCheck++; - if (nextToCheck === watchedFiles.length) { - nextToCheck = 0; - } - count++; - } - nextFileToCheck = nextToCheck; - }, interval); + function addFileWatcherCallback(filePath, callback) { + if (ts.hasProperty(fileWatcherCallbacks, filePath)) { + fileWatcherCallbacks[filePath].push(callback); + } + else { + fileWatcherCallbacks[filePath] = [callback]; + } } function addFile(fileName, callback) { - var file = { - fileName: fileName, - callback: callback, - mtime: getModifiedTime(fileName) - }; - watchedFiles.push(file); - if (watchedFiles.length === 1) { - startWatchTimer(); + addFileWatcherCallback(fileName, callback); + addDirWatcher(ts.getDirectoryPath(fileName)); + return { fileName: fileName, callback: callback }; + } + function removeFile(watchedFile) { + removeFileWatcherCallback(watchedFile.fileName, watchedFile.callback); + reduceDirWatcherRefCountForFile(watchedFile.fileName); + } + function removeFileWatcherCallback(filePath, callback) { + if (ts.hasProperty(fileWatcherCallbacks, filePath)) { + var newCallbacks = ts.copyListRemovingItem(callback, fileWatcherCallbacks[filePath]); + if (newCallbacks.length === 0) { + delete fileWatcherCallbacks[filePath]; + } + else { + fileWatcherCallbacks[filePath] = newCallbacks; + } } - return file; } - function removeFile(file) { - watchedFiles = ts.copyListRemovingItem(file, watchedFiles); + function fileEventHandler(eventName, relativeFileName, baseDirPath) { + var fileName = typeof relativeFileName !== "string" + ? undefined + : ts.getNormalizedAbsolutePath(relativeFileName, baseDirPath); + if ((eventName === "change" || eventName === "rename") && ts.hasProperty(fileWatcherCallbacks, fileName)) { + for (var _i = 0, _a = fileWatcherCallbacks[fileName]; _i < _a.length; _i++) { + var fileCallback = _a[_i]; + fileCallback(fileName); + } + } } - return { - getModifiedTime: getModifiedTime, - poll: poll, - startWatchTimer: startWatchTimer, - addFile: addFile, - removeFile: removeFile - }; } var watchedFileSet = createWatchedFileSet(); function isNode4OrLater() { @@ -976,7 +1061,7 @@ var ts; var platform = _os.platform(); var useCaseSensitiveFileNames = platform !== "win32" && platform !== "win64" && platform !== "darwin"; function readFile(fileName, encoding) { - if (!_fs.existsSync(fileName)) { + if (!fileExists(fileName)) { return undefined; } var buffer = _fs.readFileSync(fileName); @@ -1014,7 +1099,25 @@ var ts; } } function getCanonicalPath(path) { - return useCaseSensitiveFileNames ? path.toLowerCase() : path; + return useCaseSensitiveFileNames ? path : path.toLowerCase(); + } + function fileSystemEntryExists(path, entryKind) { + try { + var stat = _fs.statSync(path); + switch (entryKind) { + case 0: return stat.isFile(); + case 1: return stat.isDirectory(); + } + } + catch (e) { + return false; + } + } + function fileExists(path) { + return fileSystemEntryExists(path, 0); + } + function directoryExists(path) { + return fileSystemEntryExists(path, 1); } function readDirectory(path, extension, exclude) { var result = []; @@ -1026,6 +1129,9 @@ var ts; var directories = []; for (var _i = 0, files_2 = files; _i < files_2.length; _i++) { var current = files_2[_i]; + if (current === "." || current === "..") { + continue; + } var name_3 = ts.combinePaths(path, current); if (!ts.contains(exclude, getCanonicalPath(name_3))) { var stat = _fs.statSync(name_3); @@ -1055,18 +1161,36 @@ var ts; readFile: readFile, writeFile: writeFile, watchFile: function (fileName, callback) { - if (isNode4OrLater()) { - return _fs.watch(fileName, function (eventName, relativeFileName) { return callback(fileName); }); + if (useNonPollingWatchers) { + var watchedFile_1 = watchedFileSet.addFile(fileName, callback); + return { + close: function () { return watchedFileSet.removeFile(watchedFile_1); } + }; + } + else { + _fs.watchFile(fileName, { persistent: true, interval: 250 }, fileChanged); + return { + close: function () { return _fs.unwatchFile(fileName, fileChanged); } + }; + } + function fileChanged(curr, prev) { + if (+curr.mtime <= +prev.mtime) { + return; + } + callback(fileName); } - var watchedFile = watchedFileSet.addFile(fileName, callback); - return { - close: function () { return watchedFileSet.removeFile(watchedFile); } - }; }, - watchDirectory: function (path, callback, recursive) { - return _fs.watch(path, { persistent: true, recursive: !!recursive }, function (eventName, relativeFileName) { + watchDirectory: function (directoryName, callback, recursive) { + var options; + if (isNode4OrLater() && (process.platform === "win32" || process.platform === "darwin")) { + options = { persistent: true, recursive: !!recursive }; + } + else { + options = { persistent: true }; + } + return _fs.watch(directoryName, options, function (eventName, relativeFileName) { if (eventName === "rename") { - callback(!relativeFileName ? relativeFileName : ts.normalizePath(ts.combinePaths(path, relativeFileName))); + callback(!relativeFileName ? relativeFileName : ts.normalizePath(ts.combinePaths(directoryName, relativeFileName))); } ; }); @@ -1074,12 +1198,8 @@ var ts; resolvePath: function (path) { return _path.resolve(path); }, - fileExists: function (path) { - return _fs.existsSync(path); - }, - directoryExists: function (path) { - return _fs.existsSync(path) && _fs.statSync(path).isDirectory(); - }, + fileExists: fileExists, + directoryExists: directoryExists, createDirectory: function (directoryName) { if (!this.directoryExists(directoryName)) { _fs.mkdirSync(directoryName); @@ -1092,6 +1212,19 @@ var ts; return process.cwd(); }, readDirectory: readDirectory, + getModifiedTime: function (path) { + try { + return _fs.statSync(path).mtime; + } + catch (e) { + return undefined; + } + }, + createHash: function (data) { + var hash = _crypto.createHash("md5"); + hash.update(data); + return hash.digest("hex"); + }, getMemoryUsage: function () { if (global.gc) { global.gc(); @@ -1100,10 +1233,43 @@ var ts; }, exit: function (exitCode) { process.exit(exitCode); + }, + realpath: function (path) { + return _fs.realpathSync(path); } }; } - if (typeof WScript !== "undefined" && typeof ActiveXObject === "function") { + function getChakraSystem() { + var realpath = ChakraHost.realpath && (function (path) { return ChakraHost.realpath(path); }); + return { + newLine: ChakraHost.newLine || "\r\n", + args: ChakraHost.args, + useCaseSensitiveFileNames: !!ChakraHost.useCaseSensitiveFileNames, + write: ChakraHost.echo, + readFile: function (path, encoding) { + return ChakraHost.readFile(path); + }, + writeFile: function (path, data, writeByteOrderMark) { + if (writeByteOrderMark) { + data = "\uFEFF" + data; + } + ChakraHost.writeFile(path, data); + }, + resolvePath: ChakraHost.resolvePath, + fileExists: ChakraHost.fileExists, + directoryExists: ChakraHost.directoryExists, + createDirectory: ChakraHost.createDirectory, + getExecutingFilePath: function () { return ChakraHost.executingFile; }, + getCurrentDirectory: function () { return ChakraHost.currentDirectory; }, + readDirectory: ChakraHost.readDirectory, + exit: ChakraHost.quit, + realpath: realpath + }; + } + if (typeof ChakraHost !== "undefined") { + return getChakraSystem(); + } + else if (typeof WScript !== "undefined" && typeof ActiveXObject === "function") { return getWScriptSystem(); } else if (typeof process !== "undefined" && process.nextTick && !process.browser && typeof require !== "undefined") { @@ -1134,6 +1300,7 @@ var ts; An_index_signature_must_have_a_type_annotation: { code: 1021, category: ts.DiagnosticCategory.Error, key: "An_index_signature_must_have_a_type_annotation_1021", message: "An index signature must have a type annotation." }, An_index_signature_parameter_must_have_a_type_annotation: { code: 1022, category: ts.DiagnosticCategory.Error, key: "An_index_signature_parameter_must_have_a_type_annotation_1022", message: "An index signature parameter must have a type annotation." }, An_index_signature_parameter_type_must_be_string_or_number: { code: 1023, category: ts.DiagnosticCategory.Error, key: "An_index_signature_parameter_type_must_be_string_or_number_1023", message: "An index signature parameter type must be 'string' or 'number'." }, + readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature: { code: 1024, category: ts.DiagnosticCategory.Error, key: "readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature_1024", message: "'readonly' modifier can only appear on a property declaration or index signature." }, Accessibility_modifier_already_seen: { code: 1028, category: ts.DiagnosticCategory.Error, key: "Accessibility_modifier_already_seen_1028", message: "Accessibility modifier already seen." }, _0_modifier_must_precede_1_modifier: { code: 1029, category: ts.DiagnosticCategory.Error, key: "_0_modifier_must_precede_1_modifier_1029", message: "'{0}' modifier must precede '{1}' modifier." }, _0_modifier_already_seen: { code: 1030, category: ts.DiagnosticCategory.Error, key: "_0_modifier_already_seen_1030", message: "'{0}' modifier already seen." }, @@ -1147,7 +1314,7 @@ var ts; _0_modifier_cannot_be_used_with_a_class_declaration: { code: 1041, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_be_used_with_a_class_declaration_1041", message: "'{0}' modifier cannot be used with a class declaration." }, _0_modifier_cannot_be_used_here: { code: 1042, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_be_used_here_1042", message: "'{0}' modifier cannot be used here." }, _0_modifier_cannot_appear_on_a_data_property: { code: 1043, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_appear_on_a_data_property_1043", message: "'{0}' modifier cannot appear on a data property." }, - _0_modifier_cannot_appear_on_a_module_element: { code: 1044, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_appear_on_a_module_element_1044", message: "'{0}' modifier cannot appear on a module element." }, + _0_modifier_cannot_appear_on_a_module_or_namespace_element: { code: 1044, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_appear_on_a_module_or_namespace_element_1044", message: "'{0}' modifier cannot appear on a module or namespace element." }, A_0_modifier_cannot_be_used_with_an_interface_declaration: { code: 1045, category: ts.DiagnosticCategory.Error, key: "A_0_modifier_cannot_be_used_with_an_interface_declaration_1045", message: "A '{0}' modifier cannot be used with an interface declaration." }, A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file: { code: 1046, category: ts.DiagnosticCategory.Error, key: "A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file_1046", message: "A 'declare' modifier is required for a top level declaration in a .d.ts file." }, A_rest_parameter_cannot_be_optional: { code: 1047, category: ts.DiagnosticCategory.Error, key: "A_rest_parameter_cannot_be_optional_1047", message: "A rest parameter cannot be optional." }, @@ -1166,8 +1333,11 @@ var ts; Enum_member_must_have_initializer: { code: 1061, category: ts.DiagnosticCategory.Error, key: "Enum_member_must_have_initializer_1061", message: "Enum member must have initializer." }, _0_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method: { code: 1062, category: ts.DiagnosticCategory.Error, key: "_0_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method_1062", message: "{0} is referenced directly or indirectly in the fulfillment callback of its own 'then' method." }, An_export_assignment_cannot_be_used_in_a_namespace: { code: 1063, category: ts.DiagnosticCategory.Error, key: "An_export_assignment_cannot_be_used_in_a_namespace_1063", message: "An export assignment cannot be used in a namespace." }, + The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type: { code: 1064, category: ts.DiagnosticCategory.Error, key: "The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_1064", message: "The return type of an async function or method must be the global Promise type." }, In_ambient_enum_declarations_member_initializer_must_be_constant_expression: { code: 1066, category: ts.DiagnosticCategory.Error, key: "In_ambient_enum_declarations_member_initializer_must_be_constant_expression_1066", message: "In ambient enum declarations member initializer must be constant expression." }, Unexpected_token_A_constructor_method_accessor_or_property_was_expected: { code: 1068, category: ts.DiagnosticCategory.Error, key: "Unexpected_token_A_constructor_method_accessor_or_property_was_expected_1068", message: "Unexpected token. A constructor, method, accessor, or property was expected." }, + _0_modifier_cannot_appear_on_a_type_member: { code: 1070, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_appear_on_a_type_member_1070", message: "'{0}' modifier cannot appear on a type member." }, + _0_modifier_cannot_appear_on_an_index_signature: { code: 1071, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_appear_on_an_index_signature_1071", message: "'{0}' modifier cannot appear on an index signature." }, A_0_modifier_cannot_be_used_with_an_import_declaration: { code: 1079, category: ts.DiagnosticCategory.Error, key: "A_0_modifier_cannot_be_used_with_an_import_declaration_1079", message: "A '{0}' modifier cannot be used with an import declaration." }, Invalid_reference_directive_syntax: { code: 1084, category: ts.DiagnosticCategory.Error, key: "Invalid_reference_directive_syntax_1084", message: "Invalid 'reference' directive syntax." }, Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher: { code: 1085, category: ts.DiagnosticCategory.Error, key: "Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_1085", message: "Octal literals are not available when targeting ECMAScript 5 and higher." }, @@ -1192,7 +1362,6 @@ var ts; A_return_statement_can_only_be_used_within_a_function_body: { code: 1108, category: ts.DiagnosticCategory.Error, key: "A_return_statement_can_only_be_used_within_a_function_body_1108", message: "A 'return' statement can only be used within a function body." }, Expression_expected: { code: 1109, category: ts.DiagnosticCategory.Error, key: "Expression_expected_1109", message: "Expression expected." }, Type_expected: { code: 1110, category: ts.DiagnosticCategory.Error, key: "Type_expected_1110", message: "Type expected." }, - A_class_member_cannot_be_declared_optional: { code: 1112, category: ts.DiagnosticCategory.Error, key: "A_class_member_cannot_be_declared_optional_1112", message: "A class member cannot be declared optional." }, A_default_clause_cannot_appear_more_than_once_in_a_switch_statement: { code: 1113, category: ts.DiagnosticCategory.Error, key: "A_default_clause_cannot_appear_more_than_once_in_a_switch_statement_1113", message: "A 'default' clause cannot appear more than once in a 'switch' statement." }, Duplicate_label_0: { code: 1114, category: ts.DiagnosticCategory.Error, key: "Duplicate_label_0_1114", message: "Duplicate label '{0}'" }, A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement: { code: 1115, category: ts.DiagnosticCategory.Error, key: "A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement_1115", message: "A 'continue' statement can only jump to a label of an enclosing iteration statement." }, @@ -1223,10 +1392,9 @@ var ts; String_literal_expected: { code: 1141, category: ts.DiagnosticCategory.Error, key: "String_literal_expected_1141", message: "String literal expected." }, Line_break_not_permitted_here: { code: 1142, category: ts.DiagnosticCategory.Error, key: "Line_break_not_permitted_here_1142", message: "Line break not permitted here." }, or_expected: { code: 1144, category: ts.DiagnosticCategory.Error, key: "or_expected_1144", message: "'{' or ';' expected." }, - Modifiers_not_permitted_on_index_signature_members: { code: 1145, category: ts.DiagnosticCategory.Error, key: "Modifiers_not_permitted_on_index_signature_members_1145", message: "Modifiers not permitted on index signature members." }, Declaration_expected: { code: 1146, category: ts.DiagnosticCategory.Error, key: "Declaration_expected_1146", message: "Declaration expected." }, Import_declarations_in_a_namespace_cannot_reference_a_module: { code: 1147, category: ts.DiagnosticCategory.Error, key: "Import_declarations_in_a_namespace_cannot_reference_a_module_1147", message: "Import declarations in a namespace cannot reference a module." }, - Cannot_compile_modules_unless_the_module_flag_is_provided: { code: 1148, category: ts.DiagnosticCategory.Error, key: "Cannot_compile_modules_unless_the_module_flag_is_provided_1148", message: "Cannot compile modules unless the '--module' flag is provided." }, + Cannot_compile_modules_unless_the_module_flag_is_provided_with_a_valid_module_type_Consider_setting_the_module_compiler_option_in_a_tsconfig_json_file: { code: 1148, category: ts.DiagnosticCategory.Error, key: "Cannot_compile_modules_unless_the_module_flag_is_provided_with_a_valid_module_type_Consider_setting__1148", message: "Cannot compile modules unless the '--module' flag is provided with a valid module type. Consider setting the 'module' compiler option in a 'tsconfig.json' file." }, File_name_0_differs_from_already_included_file_name_1_only_in_casing: { code: 1149, category: ts.DiagnosticCategory.Error, key: "File_name_0_differs_from_already_included_file_name_1_only_in_casing_1149", message: "File name '{0}' differs from already included file name '{1}' only in casing" }, new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead: { code: 1150, category: ts.DiagnosticCategory.Error, key: "new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead_1150", message: "'new T[]' cannot be used to create an array. Use 'new Array()' instead." }, const_declarations_must_be_initialized: { code: 1155, category: ts.DiagnosticCategory.Error, key: "const_declarations_must_be_initialized_1155", message: "'const' declarations must be initialized" }, @@ -1286,7 +1454,7 @@ var ts; Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode: { code: 1214, category: ts.DiagnosticCategory.Error, key: "Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode_1214", message: "Identifier expected. '{0}' is a reserved word in strict mode. Modules are automatically in strict mode." }, Invalid_use_of_0_Modules_are_automatically_in_strict_mode: { code: 1215, category: ts.DiagnosticCategory.Error, key: "Invalid_use_of_0_Modules_are_automatically_in_strict_mode_1215", message: "Invalid use of '{0}'. Modules are automatically in strict mode." }, Export_assignment_is_not_supported_when_module_flag_is_system: { code: 1218, category: ts.DiagnosticCategory.Error, key: "Export_assignment_is_not_supported_when_module_flag_is_system_1218", message: "Export assignment is not supported when '--module' flag is 'system'." }, - Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Specify_experimentalDecorators_to_remove_this_warning: { code: 1219, category: ts.DiagnosticCategory.Error, key: "Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Speci_1219", message: "Experimental support for decorators is a feature that is subject to change in a future release. Specify '--experimentalDecorators' to remove this warning." }, + Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning: { code: 1219, category: ts.DiagnosticCategory.Error, key: "Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_t_1219", message: "Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning." }, Generators_are_only_available_when_targeting_ECMAScript_6_or_higher: { code: 1220, category: ts.DiagnosticCategory.Error, key: "Generators_are_only_available_when_targeting_ECMAScript_6_or_higher_1220", message: "Generators are only available when targeting ECMAScript 6 or higher." }, Generators_are_not_allowed_in_an_ambient_context: { code: 1221, category: ts.DiagnosticCategory.Error, key: "Generators_are_not_allowed_in_an_ambient_context_1221", message: "Generators are not allowed in an ambient context." }, An_overload_signature_cannot_be_declared_as_a_generator: { code: 1222, category: ts.DiagnosticCategory.Error, key: "An_overload_signature_cannot_be_declared_as_a_generator_1222", message: "An overload signature cannot be declared as a generator." }, @@ -1309,15 +1477,25 @@ var ts; Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression: { code: 1239, category: ts.DiagnosticCategory.Error, key: "Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression_1239", message: "Unable to resolve signature of parameter decorator when called as an expression." }, Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression: { code: 1240, category: ts.DiagnosticCategory.Error, key: "Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression_1240", message: "Unable to resolve signature of property decorator when called as an expression." }, Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression: { code: 1241, category: ts.DiagnosticCategory.Error, key: "Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression_1241", message: "Unable to resolve signature of method decorator when called as an expression." }, - abstract_modifier_can_only_appear_on_a_class_or_method_declaration: { code: 1242, category: ts.DiagnosticCategory.Error, key: "abstract_modifier_can_only_appear_on_a_class_or_method_declaration_1242", message: "'abstract' modifier can only appear on a class or method declaration." }, + abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration: { code: 1242, category: ts.DiagnosticCategory.Error, key: "abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration_1242", message: "'abstract' modifier can only appear on a class, method, or property declaration." }, _0_modifier_cannot_be_used_with_1_modifier: { code: 1243, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_be_used_with_1_modifier_1243", message: "'{0}' modifier cannot be used with '{1}' modifier." }, Abstract_methods_can_only_appear_within_an_abstract_class: { code: 1244, category: ts.DiagnosticCategory.Error, key: "Abstract_methods_can_only_appear_within_an_abstract_class_1244", message: "Abstract methods can only appear within an abstract class." }, Method_0_cannot_have_an_implementation_because_it_is_marked_abstract: { code: 1245, category: ts.DiagnosticCategory.Error, key: "Method_0_cannot_have_an_implementation_because_it_is_marked_abstract_1245", message: "Method '{0}' cannot have an implementation because it is marked abstract." }, + An_interface_property_cannot_have_an_initializer: { code: 1246, category: ts.DiagnosticCategory.Error, key: "An_interface_property_cannot_have_an_initializer_1246", message: "An interface property cannot have an initializer." }, + A_type_literal_property_cannot_have_an_initializer: { code: 1247, category: ts.DiagnosticCategory.Error, key: "A_type_literal_property_cannot_have_an_initializer_1247", message: "A type literal property cannot have an initializer." }, + A_class_member_cannot_have_the_0_keyword: { code: 1248, category: ts.DiagnosticCategory.Error, key: "A_class_member_cannot_have_the_0_keyword_1248", message: "A class member cannot have the '{0}' keyword." }, + A_decorator_can_only_decorate_a_method_implementation_not_an_overload: { code: 1249, category: ts.DiagnosticCategory.Error, key: "A_decorator_can_only_decorate_a_method_implementation_not_an_overload_1249", message: "A decorator can only decorate a method implementation, not an overload." }, + Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5: { code: 1250, category: ts.DiagnosticCategory.Error, key: "Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_1250", message: "Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'." }, + Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Class_definitions_are_automatically_in_strict_mode: { code: 1251, category: ts.DiagnosticCategory.Error, key: "Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Class_d_1251", message: "Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. Class definitions are automatically in strict mode." }, + Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Modules_are_automatically_in_strict_mode: { code: 1252, category: ts.DiagnosticCategory.Error, key: "Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Modules_1252", message: "Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. Modules are automatically in strict mode." }, with_statements_are_not_allowed_in_an_async_function_block: { code: 1300, category: ts.DiagnosticCategory.Error, key: "with_statements_are_not_allowed_in_an_async_function_block_1300", message: "'with' statements are not allowed in an async function block." }, await_expression_is_only_allowed_within_an_async_function: { code: 1308, category: ts.DiagnosticCategory.Error, key: "await_expression_is_only_allowed_within_an_async_function_1308", message: "'await' expression is only allowed within an async function." }, Async_functions_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1311, category: ts.DiagnosticCategory.Error, key: "Async_functions_are_only_available_when_targeting_ECMAScript_6_and_higher_1311", message: "Async functions are only available when targeting ECMAScript 6 and higher." }, can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment: { code: 1312, category: ts.DiagnosticCategory.Error, key: "can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment_1312", message: "'=' can only be used in an object literal property inside a destructuring assignment." }, The_body_of_an_if_statement_cannot_be_the_empty_statement: { code: 1313, category: ts.DiagnosticCategory.Error, key: "The_body_of_an_if_statement_cannot_be_the_empty_statement_1313", message: "The body of an 'if' statement cannot be the empty statement." }, + Global_module_exports_may_only_appear_in_module_files: { code: 1314, category: ts.DiagnosticCategory.Error, key: "Global_module_exports_may_only_appear_in_module_files_1314", message: "Global module exports may only appear in module files." }, + Global_module_exports_may_only_appear_in_declaration_files: { code: 1315, category: ts.DiagnosticCategory.Error, key: "Global_module_exports_may_only_appear_in_declaration_files_1315", message: "Global module exports may only appear in declaration files." }, + Global_module_exports_may_only_appear_at_top_level: { code: 1316, category: ts.DiagnosticCategory.Error, key: "Global_module_exports_may_only_appear_at_top_level_1316", message: "Global module exports may only appear at top level." }, Duplicate_identifier_0: { code: 2300, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_0_2300", message: "Duplicate identifier '{0}'." }, Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: ts.DiagnosticCategory.Error, key: "Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301", message: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, Static_members_cannot_reference_class_type_parameters: { code: 2302, category: ts.DiagnosticCategory.Error, key: "Static_members_cannot_reference_class_type_parameters_2302", message: "Static members cannot reference class type parameters." }, @@ -1326,11 +1504,12 @@ var ts; Module_0_has_no_exported_member_1: { code: 2305, category: ts.DiagnosticCategory.Error, key: "Module_0_has_no_exported_member_1_2305", message: "Module '{0}' has no exported member '{1}'." }, File_0_is_not_a_module: { code: 2306, category: ts.DiagnosticCategory.Error, key: "File_0_is_not_a_module_2306", message: "File '{0}' is not a module." }, Cannot_find_module_0: { code: 2307, category: ts.DiagnosticCategory.Error, key: "Cannot_find_module_0_2307", message: "Cannot find module '{0}'." }, + Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambiguity: { code: 2308, category: ts.DiagnosticCategory.Error, key: "Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambig_2308", message: "Module {0} has already exported a member named '{1}'. Consider explicitly re-exporting to resolve the ambiguity." }, An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements: { code: 2309, category: ts.DiagnosticCategory.Error, key: "An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements_2309", message: "An export assignment cannot be used in a module with other exported elements." }, Type_0_recursively_references_itself_as_a_base_type: { code: 2310, category: ts.DiagnosticCategory.Error, key: "Type_0_recursively_references_itself_as_a_base_type_2310", message: "Type '{0}' recursively references itself as a base type." }, A_class_may_only_extend_another_class: { code: 2311, category: ts.DiagnosticCategory.Error, key: "A_class_may_only_extend_another_class_2311", message: "A class may only extend another class." }, An_interface_may_only_extend_a_class_or_another_interface: { code: 2312, category: ts.DiagnosticCategory.Error, key: "An_interface_may_only_extend_a_class_or_another_interface_2312", message: "An interface may only extend a class or another interface." }, - Constraint_of_a_type_parameter_cannot_reference_any_type_parameter_from_the_same_type_parameter_list: { code: 2313, category: ts.DiagnosticCategory.Error, key: "Constraint_of_a_type_parameter_cannot_reference_any_type_parameter_from_the_same_type_parameter_list_2313", message: "Constraint of a type parameter cannot reference any type parameter from the same type parameter list." }, + Type_parameter_0_has_a_circular_constraint: { code: 2313, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_has_a_circular_constraint_2313", message: "Type parameter '{0}' has a circular constraint." }, Generic_type_0_requires_1_type_argument_s: { code: 2314, category: ts.DiagnosticCategory.Error, key: "Generic_type_0_requires_1_type_argument_s_2314", message: "Generic type '{0}' requires {1} type argument(s)." }, Type_0_is_not_generic: { code: 2315, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_generic_2315", message: "Type '{0}' is not generic." }, Global_type_0_must_be_a_class_or_interface_type: { code: 2316, category: ts.DiagnosticCategory.Error, key: "Global_type_0_must_be_a_class_or_interface_type_2316", message: "Global type '{0}' must be a class or interface type." }, @@ -1340,6 +1519,7 @@ var ts; Interface_0_cannot_simultaneously_extend_types_1_and_2: { code: 2320, category: ts.DiagnosticCategory.Error, key: "Interface_0_cannot_simultaneously_extend_types_1_and_2_2320", message: "Interface '{0}' cannot simultaneously extend types '{1}' and '{2}'." }, Excessive_stack_depth_comparing_types_0_and_1: { code: 2321, category: ts.DiagnosticCategory.Error, key: "Excessive_stack_depth_comparing_types_0_and_1_2321", message: "Excessive stack depth comparing types '{0}' and '{1}'." }, Type_0_is_not_assignable_to_type_1: { code: 2322, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_assignable_to_type_1_2322", message: "Type '{0}' is not assignable to type '{1}'." }, + Cannot_redeclare_exported_variable_0: { code: 2323, category: ts.DiagnosticCategory.Error, key: "Cannot_redeclare_exported_variable_0_2323", message: "Cannot redeclare exported variable '{0}'." }, Property_0_is_missing_in_type_1: { code: 2324, category: ts.DiagnosticCategory.Error, key: "Property_0_is_missing_in_type_1_2324", message: "Property '{0}' is missing in type '{1}'." }, Property_0_is_private_in_type_1_but_not_in_type_2: { code: 2325, category: ts.DiagnosticCategory.Error, key: "Property_0_is_private_in_type_1_but_not_in_type_2_2325", message: "Property '{0}' is private in type '{1}' but not in type '{2}'." }, Types_of_property_0_are_incompatible: { code: 2326, category: ts.DiagnosticCategory.Error, key: "Types_of_property_0_are_incompatible_2326", message: "Types of property '{0}' are incompatible." }, @@ -1367,7 +1547,7 @@ var ts; Cannot_invoke_an_expression_whose_type_lacks_a_call_signature: { code: 2349, category: ts.DiagnosticCategory.Error, key: "Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_2349", message: "Cannot invoke an expression whose type lacks a call signature." }, Only_a_void_function_can_be_called_with_the_new_keyword: { code: 2350, category: ts.DiagnosticCategory.Error, key: "Only_a_void_function_can_be_called_with_the_new_keyword_2350", message: "Only a void function can be called with the 'new' keyword." }, Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature: { code: 2351, category: ts.DiagnosticCategory.Error, key: "Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature_2351", message: "Cannot use 'new' with an expression whose type lacks a call or construct signature." }, - Neither_type_0_nor_type_1_is_assignable_to_the_other: { code: 2352, category: ts.DiagnosticCategory.Error, key: "Neither_type_0_nor_type_1_is_assignable_to_the_other_2352", message: "Neither type '{0}' nor type '{1}' is assignable to the other." }, + Type_0_cannot_be_converted_to_type_1: { code: 2352, category: ts.DiagnosticCategory.Error, key: "Type_0_cannot_be_converted_to_type_1_2352", message: "Type '{0}' cannot be converted to type '{1}'." }, Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1: { code: 2353, category: ts.DiagnosticCategory.Error, key: "Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1_2353", message: "Object literal may only specify known properties, and '{0}' does not exist in type '{1}'." }, No_best_common_type_exists_among_return_expressions: { code: 2354, category: ts.DiagnosticCategory.Error, key: "No_best_common_type_exists_among_return_expressions_2354", message: "No best common type exists among return expressions." }, A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value: { code: 2355, category: ts.DiagnosticCategory.Error, key: "A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_2355", message: "A function whose declared type is neither 'void' nor 'any' must return a value." }, @@ -1381,6 +1561,7 @@ var ts; The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2363, category: ts.DiagnosticCategory.Error, key: "The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type_2363", message: "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, Invalid_left_hand_side_of_assignment_expression: { code: 2364, category: ts.DiagnosticCategory.Error, key: "Invalid_left_hand_side_of_assignment_expression_2364", message: "Invalid left-hand side of assignment expression." }, Operator_0_cannot_be_applied_to_types_1_and_2: { code: 2365, category: ts.DiagnosticCategory.Error, key: "Operator_0_cannot_be_applied_to_types_1_and_2_2365", message: "Operator '{0}' cannot be applied to types '{1}' and '{2}'." }, + Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined: { code: 2366, category: ts.DiagnosticCategory.Error, key: "Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined_2366", message: "Function lacks ending return statement and return type does not include 'undefined'." }, Type_parameter_name_cannot_be_0: { code: 2368, category: ts.DiagnosticCategory.Error, key: "Type_parameter_name_cannot_be_0_2368", message: "Type parameter name cannot be '{0}'" }, A_parameter_property_is_only_allowed_in_a_constructor_implementation: { code: 2369, category: ts.DiagnosticCategory.Error, key: "A_parameter_property_is_only_allowed_in_a_constructor_implementation_2369", message: "A parameter property is only allowed in a constructor implementation." }, A_rest_parameter_must_be_of_an_array_type: { code: 2370, category: ts.DiagnosticCategory.Error, key: "A_rest_parameter_must_be_of_an_array_type_2370", message: "A rest parameter must be of an array type." }, @@ -1396,7 +1577,7 @@ var ts; get_and_set_accessor_must_have_the_same_type: { code: 2380, category: ts.DiagnosticCategory.Error, key: "get_and_set_accessor_must_have_the_same_type_2380", message: "'get' and 'set' accessor must have the same type." }, A_signature_with_an_implementation_cannot_use_a_string_literal_type: { code: 2381, category: ts.DiagnosticCategory.Error, key: "A_signature_with_an_implementation_cannot_use_a_string_literal_type_2381", message: "A signature with an implementation cannot use a string literal type." }, Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature: { code: 2382, category: ts.DiagnosticCategory.Error, key: "Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature_2382", message: "Specialized overload signature is not assignable to any non-specialized signature." }, - Overload_signatures_must_all_be_exported_or_not_exported: { code: 2383, category: ts.DiagnosticCategory.Error, key: "Overload_signatures_must_all_be_exported_or_not_exported_2383", message: "Overload signatures must all be exported or not exported." }, + Overload_signatures_must_all_be_exported_or_non_exported: { code: 2383, category: ts.DiagnosticCategory.Error, key: "Overload_signatures_must_all_be_exported_or_non_exported_2383", message: "Overload signatures must all be exported or non-exported." }, Overload_signatures_must_all_be_ambient_or_non_ambient: { code: 2384, category: ts.DiagnosticCategory.Error, key: "Overload_signatures_must_all_be_ambient_or_non_ambient_2384", message: "Overload signatures must all be ambient or non-ambient." }, Overload_signatures_must_all_be_public_private_or_protected: { code: 2385, category: ts.DiagnosticCategory.Error, key: "Overload_signatures_must_all_be_public_private_or_protected_2385", message: "Overload signatures must all be public, private or protected." }, Overload_signatures_must_all_be_optional_or_required: { code: 2386, category: ts.DiagnosticCategory.Error, key: "Overload_signatures_must_all_be_optional_or_required_2386", message: "Overload signatures must all be optional or required." }, @@ -1410,6 +1591,7 @@ var ts; Overload_signature_is_not_compatible_with_function_implementation: { code: 2394, category: ts.DiagnosticCategory.Error, key: "Overload_signature_is_not_compatible_with_function_implementation_2394", message: "Overload signature is not compatible with function implementation." }, Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local: { code: 2395, category: ts.DiagnosticCategory.Error, key: "Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local_2395", message: "Individual declarations in merged declaration '{0}' must be all exported or all local." }, Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters: { code: 2396, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters_2396", message: "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters." }, + Declaration_name_conflicts_with_built_in_global_identifier_0: { code: 2397, category: ts.DiagnosticCategory.Error, key: "Declaration_name_conflicts_with_built_in_global_identifier_0_2397", message: "Declaration name conflicts with built-in global identifier '{0}'." }, Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference: { code: 2399, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference_2399", message: "Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference." }, Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference: { code: 2400, category: ts.DiagnosticCategory.Error, key: "Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference_2400", message: "Expression resolves to variable declaration '_this' that compiler uses to capture 'this' reference." }, Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference: { code: 2401, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference_2401", message: "Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference." }, @@ -1428,7 +1610,6 @@ var ts; Class_name_cannot_be_0: { code: 2414, category: ts.DiagnosticCategory.Error, key: "Class_name_cannot_be_0_2414", message: "Class name cannot be '{0}'" }, Class_0_incorrectly_extends_base_class_1: { code: 2415, category: ts.DiagnosticCategory.Error, key: "Class_0_incorrectly_extends_base_class_1_2415", message: "Class '{0}' incorrectly extends base class '{1}'." }, Class_static_side_0_incorrectly_extends_base_class_static_side_1: { code: 2417, category: ts.DiagnosticCategory.Error, key: "Class_static_side_0_incorrectly_extends_base_class_static_side_1_2417", message: "Class static side '{0}' incorrectly extends base class static side '{1}'." }, - Type_name_0_in_extends_clause_does_not_reference_constructor_function_for_0: { code: 2419, category: ts.DiagnosticCategory.Error, key: "Type_name_0_in_extends_clause_does_not_reference_constructor_function_for_0_2419", message: "Type name '{0}' in extends clause does not reference constructor function for '{0}'." }, Class_0_incorrectly_implements_interface_1: { code: 2420, category: ts.DiagnosticCategory.Error, key: "Class_0_incorrectly_implements_interface_1_2420", message: "Class '{0}' incorrectly implements interface '{1}'." }, A_class_may_only_implement_another_class_or_interface: { code: 2422, category: ts.DiagnosticCategory.Error, key: "A_class_may_only_implement_another_class_or_interface_2422", message: "A class may only implement another class or interface." }, Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor: { code: 2423, category: ts.DiagnosticCategory.Error, key: "Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_access_2423", message: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor." }, @@ -1436,7 +1617,7 @@ var ts; Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 2425, category: ts.DiagnosticCategory.Error, key: "Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_functi_2425", message: "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function." }, Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 2426, category: ts.DiagnosticCategory.Error, key: "Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_functi_2426", message: "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function." }, Interface_name_cannot_be_0: { code: 2427, category: ts.DiagnosticCategory.Error, key: "Interface_name_cannot_be_0_2427", message: "Interface name cannot be '{0}'" }, - All_declarations_of_an_interface_must_have_identical_type_parameters: { code: 2428, category: ts.DiagnosticCategory.Error, key: "All_declarations_of_an_interface_must_have_identical_type_parameters_2428", message: "All declarations of an interface must have identical type parameters." }, + All_declarations_of_0_must_have_identical_type_parameters: { code: 2428, category: ts.DiagnosticCategory.Error, key: "All_declarations_of_0_must_have_identical_type_parameters_2428", message: "All declarations of '{0}' must have identical type parameters." }, Interface_0_incorrectly_extends_interface_1: { code: 2430, category: ts.DiagnosticCategory.Error, key: "Interface_0_incorrectly_extends_interface_1_2430", message: "Interface '{0}' incorrectly extends interface '{1}'." }, Enum_name_cannot_be_0: { code: 2431, category: ts.DiagnosticCategory.Error, key: "Enum_name_cannot_be_0_2431", message: "Enum name cannot be '{0}'" }, In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element: { code: 2432, category: ts.DiagnosticCategory.Error, key: "In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enu_2432", message: "In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element." }, @@ -1456,11 +1637,12 @@ var ts; Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1: { code: 2446, category: ts.DiagnosticCategory.Error, key: "Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1_2446", message: "Property '{0}' is protected and only accessible through an instance of class '{1}'." }, The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead: { code: 2447, category: ts.DiagnosticCategory.Error, key: "The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead_2447", message: "The '{0}' operator is not allowed for boolean types. Consider using '{1}' instead." }, Block_scoped_variable_0_used_before_its_declaration: { code: 2448, category: ts.DiagnosticCategory.Error, key: "Block_scoped_variable_0_used_before_its_declaration_2448", message: "Block-scoped variable '{0}' used before its declaration." }, - The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant: { code: 2449, category: ts.DiagnosticCategory.Error, key: "The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant_2449", message: "The operand of an increment or decrement operator cannot be a constant." }, - Left_hand_side_of_assignment_expression_cannot_be_a_constant: { code: 2450, category: ts.DiagnosticCategory.Error, key: "Left_hand_side_of_assignment_expression_cannot_be_a_constant_2450", message: "Left-hand side of assignment expression cannot be a constant." }, + The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant_or_a_read_only_property: { code: 2449, category: ts.DiagnosticCategory.Error, key: "The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant_or_a_read_only_property_2449", message: "The operand of an increment or decrement operator cannot be a constant or a read-only property." }, + Left_hand_side_of_assignment_expression_cannot_be_a_constant_or_a_read_only_property: { code: 2450, category: ts.DiagnosticCategory.Error, key: "Left_hand_side_of_assignment_expression_cannot_be_a_constant_or_a_read_only_property_2450", message: "Left-hand side of assignment expression cannot be a constant or a read-only property." }, Cannot_redeclare_block_scoped_variable_0: { code: 2451, category: ts.DiagnosticCategory.Error, key: "Cannot_redeclare_block_scoped_variable_0_2451", message: "Cannot redeclare block-scoped variable '{0}'." }, An_enum_member_cannot_have_a_numeric_name: { code: 2452, category: ts.DiagnosticCategory.Error, key: "An_enum_member_cannot_have_a_numeric_name_2452", message: "An enum member cannot have a numeric name." }, The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly: { code: 2453, category: ts.DiagnosticCategory.Error, key: "The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_typ_2453", message: "The type argument for type parameter '{0}' cannot be inferred from the usage. Consider specifying the type arguments explicitly." }, + Variable_0_is_used_before_being_assigned: { code: 2454, category: ts.DiagnosticCategory.Error, key: "Variable_0_is_used_before_being_assigned_2454", message: "Variable '{0}' is used before being assigned." }, Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0: { code: 2455, category: ts.DiagnosticCategory.Error, key: "Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0_2455", message: "Type argument candidate '{1}' is not a valid type argument because it is not a supertype of candidate '{0}'." }, Type_alias_0_circularly_references_itself: { code: 2456, category: ts.DiagnosticCategory.Error, key: "Type_alias_0_circularly_references_itself_2456", message: "Type alias '{0}' circularly references itself." }, Type_alias_name_cannot_be_0: { code: 2457, category: ts.DiagnosticCategory.Error, key: "Type_alias_name_cannot_be_0_2457", message: "Type alias name cannot be '{0}'" }, @@ -1490,8 +1672,8 @@ var ts; Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1: { code: 2481, category: ts.DiagnosticCategory.Error, key: "Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1_2481", message: "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'." }, The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation: { code: 2483, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation_2483", message: "The left-hand side of a 'for...of' statement cannot use a type annotation." }, Export_declaration_conflicts_with_exported_declaration_of_0: { code: 2484, category: ts.DiagnosticCategory.Error, key: "Export_declaration_conflicts_with_exported_declaration_of_0_2484", message: "Export declaration conflicts with exported declaration of '{0}'" }, - The_left_hand_side_of_a_for_of_statement_cannot_be_a_previously_defined_constant: { code: 2485, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_of_statement_cannot_be_a_previously_defined_constant_2485", message: "The left-hand side of a 'for...of' statement cannot be a previously defined constant." }, - The_left_hand_side_of_a_for_in_statement_cannot_be_a_previously_defined_constant: { code: 2486, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_in_statement_cannot_be_a_previously_defined_constant_2486", message: "The left-hand side of a 'for...in' statement cannot be a previously defined constant." }, + The_left_hand_side_of_a_for_of_statement_cannot_be_a_constant_or_a_read_only_property: { code: 2485, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_of_statement_cannot_be_a_constant_or_a_read_only_property_2485", message: "The left-hand side of a 'for...of' statement cannot be a constant or a read-only property." }, + The_left_hand_side_of_a_for_in_statement_cannot_be_a_constant_or_a_read_only_property: { code: 2486, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_in_statement_cannot_be_a_constant_or_a_read_only_property_2486", message: "The left-hand side of a 'for...in' statement cannot be a constant or a read-only property." }, Invalid_left_hand_side_in_for_of_statement: { code: 2487, category: ts.DiagnosticCategory.Error, key: "Invalid_left_hand_side_in_for_of_statement_2487", message: "Invalid left-hand side in 'for...of' statement." }, Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator: { code: 2488, category: ts.DiagnosticCategory.Error, key: "Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator_2488", message: "Type must have a '[Symbol.iterator]()' method that returns an iterator." }, An_iterator_must_have_a_next_method: { code: 2489, category: ts.DiagnosticCategory.Error, key: "An_iterator_must_have_a_next_method_2489", message: "An iterator must have a 'next()' method." }, @@ -1517,12 +1699,13 @@ var ts; Base_constructor_return_type_0_is_not_a_class_or_interface_type: { code: 2509, category: ts.DiagnosticCategory.Error, key: "Base_constructor_return_type_0_is_not_a_class_or_interface_type_2509", message: "Base constructor return type '{0}' is not a class or interface type." }, Base_constructors_must_all_have_the_same_return_type: { code: 2510, category: ts.DiagnosticCategory.Error, key: "Base_constructors_must_all_have_the_same_return_type_2510", message: "Base constructors must all have the same return type." }, Cannot_create_an_instance_of_the_abstract_class_0: { code: 2511, category: ts.DiagnosticCategory.Error, key: "Cannot_create_an_instance_of_the_abstract_class_0_2511", message: "Cannot create an instance of the abstract class '{0}'." }, - Overload_signatures_must_all_be_abstract_or_not_abstract: { code: 2512, category: ts.DiagnosticCategory.Error, key: "Overload_signatures_must_all_be_abstract_or_not_abstract_2512", message: "Overload signatures must all be abstract or not abstract." }, + Overload_signatures_must_all_be_abstract_or_non_abstract: { code: 2512, category: ts.DiagnosticCategory.Error, key: "Overload_signatures_must_all_be_abstract_or_non_abstract_2512", message: "Overload signatures must all be abstract or non-abstract." }, Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression: { code: 2513, category: ts.DiagnosticCategory.Error, key: "Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression_2513", message: "Abstract method '{0}' in class '{1}' cannot be accessed via super expression." }, Classes_containing_abstract_methods_must_be_marked_abstract: { code: 2514, category: ts.DiagnosticCategory.Error, key: "Classes_containing_abstract_methods_must_be_marked_abstract_2514", message: "Classes containing abstract methods must be marked abstract." }, Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2: { code: 2515, category: ts.DiagnosticCategory.Error, key: "Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2_2515", message: "Non-abstract class '{0}' does not implement inherited abstract member '{1}' from class '{2}'." }, All_declarations_of_an_abstract_method_must_be_consecutive: { code: 2516, category: ts.DiagnosticCategory.Error, key: "All_declarations_of_an_abstract_method_must_be_consecutive_2516", message: "All declarations of an abstract method must be consecutive." }, Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type: { code: 2517, category: ts.DiagnosticCategory.Error, key: "Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type_2517", message: "Cannot assign an abstract constructor type to a non-abstract constructor type." }, + A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard: { code: 2518, category: ts.DiagnosticCategory.Error, key: "A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard_2518", message: "A 'this'-based type guard is not compatible with a parameter-based type guard." }, Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions: { code: 2520, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions_2520", message: "Duplicate identifier '{0}'. Compiler uses declaration '{1}' to support async functions." }, Expression_resolves_to_variable_declaration_0_that_compiler_uses_to_support_async_functions: { code: 2521, category: ts.DiagnosticCategory.Error, key: "Expression_resolves_to_variable_declaration_0_that_compiler_uses_to_support_async_functions_2521", message: "Expression resolves to variable declaration '{0}' that compiler uses to support async functions." }, The_arguments_object_cannot_be_referenced_in_an_async_arrow_function_Consider_using_a_standard_async_function_expression: { code: 2522, category: ts.DiagnosticCategory.Error, key: "The_arguments_object_cannot_be_referenced_in_an_async_arrow_function_Consider_using_a_standard_async_2522", message: "The 'arguments' object cannot be referenced in an async arrow function. Consider using a standard async function expression." }, @@ -1532,7 +1715,13 @@ var ts; A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface: { code: 2526, category: ts.DiagnosticCategory.Error, key: "A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface_2526", message: "A 'this' type is available only in a non-static member of a class or interface." }, The_inferred_type_of_0_references_an_inaccessible_this_type_A_type_annotation_is_necessary: { code: 2527, category: ts.DiagnosticCategory.Error, key: "The_inferred_type_of_0_references_an_inaccessible_this_type_A_type_annotation_is_necessary_2527", message: "The inferred type of '{0}' references an inaccessible 'this' type. A type annotation is necessary." }, A_module_cannot_have_multiple_default_exports: { code: 2528, category: ts.DiagnosticCategory.Error, key: "A_module_cannot_have_multiple_default_exports_2528", message: "A module cannot have multiple default exports." }, - JSX_element_attributes_type_0_must_be_an_object_type: { code: 2600, category: ts.DiagnosticCategory.Error, key: "JSX_element_attributes_type_0_must_be_an_object_type_2600", message: "JSX element attributes type '{0}' must be an object type." }, + Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions: { code: 2529, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_func_2529", message: "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of a module containing async functions." }, + Property_0_is_incompatible_with_index_signature: { code: 2530, category: ts.DiagnosticCategory.Error, key: "Property_0_is_incompatible_with_index_signature_2530", message: "Property '{0}' is incompatible with index signature." }, + Object_is_possibly_null: { code: 2531, category: ts.DiagnosticCategory.Error, key: "Object_is_possibly_null_2531", message: "Object is possibly 'null'." }, + Object_is_possibly_undefined: { code: 2532, category: ts.DiagnosticCategory.Error, key: "Object_is_possibly_undefined_2532", message: "Object is possibly 'undefined'." }, + Object_is_possibly_null_or_undefined: { code: 2533, category: ts.DiagnosticCategory.Error, key: "Object_is_possibly_null_or_undefined_2533", message: "Object is possibly 'null' or 'undefined'." }, + A_function_returning_never_cannot_have_a_reachable_end_point: { code: 2534, category: ts.DiagnosticCategory.Error, key: "A_function_returning_never_cannot_have_a_reachable_end_point_2534", message: "A function returning 'never' cannot have a reachable end point." }, + JSX_element_attributes_type_0_may_not_be_a_union_type: { code: 2600, category: ts.DiagnosticCategory.Error, key: "JSX_element_attributes_type_0_may_not_be_a_union_type_2600", message: "JSX element attributes type '{0}' may not be a union type." }, The_return_type_of_a_JSX_element_constructor_must_return_an_object_type: { code: 2601, category: ts.DiagnosticCategory.Error, key: "The_return_type_of_a_JSX_element_constructor_must_return_an_object_type_2601", message: "The return type of a JSX element constructor must return an object type." }, JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist: { code: 2602, category: ts.DiagnosticCategory.Error, key: "JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist_2602", message: "JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist." }, Property_0_in_type_1_is_not_assignable_to_type_2: { code: 2603, category: ts.DiagnosticCategory.Error, key: "Property_0_in_type_1_is_not_assignable_to_type_2_2603", message: "Property '{0}' in type '{1}' is not assignable to type '{2}'" }, @@ -1548,6 +1737,33 @@ var ts; Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_package_author_to_update_the_package_definition: { code: 2654, category: ts.DiagnosticCategory.Error, key: "Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_pack_2654", message: "Exported external package typings file cannot contain tripleslash references. Please contact the package author to update the package definition." }, Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_the_package_definition: { code: 2656, category: ts.DiagnosticCategory.Error, key: "Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_2656", message: "Exported external package typings file '{0}' is not a module. Please contact the package author to update the package definition." }, JSX_expressions_must_have_one_parent_element: { code: 2657, category: ts.DiagnosticCategory.Error, key: "JSX_expressions_must_have_one_parent_element_2657", message: "JSX expressions must have one parent element" }, + Type_0_provides_no_match_for_the_signature_1: { code: 2658, category: ts.DiagnosticCategory.Error, key: "Type_0_provides_no_match_for_the_signature_1_2658", message: "Type '{0}' provides no match for the signature '{1}'" }, + super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher: { code: 2659, category: ts.DiagnosticCategory.Error, key: "super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_highe_2659", message: "'super' is only allowed in members of object literal expressions when option 'target' is 'ES2015' or higher." }, + super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions: { code: 2660, category: ts.DiagnosticCategory.Error, key: "super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions_2660", message: "'super' can only be referenced in members of derived classes or object literal expressions." }, + Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module: { code: 2661, category: ts.DiagnosticCategory.Error, key: "Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module_2661", message: "Cannot export '{0}'. Only local declarations can be exported from a module." }, + Cannot_find_name_0_Did_you_mean_the_static_member_1_0: { code: 2662, category: ts.DiagnosticCategory.Error, key: "Cannot_find_name_0_Did_you_mean_the_static_member_1_0_2662", message: "Cannot find name '{0}'. Did you mean the static member '{1}.{0}'?" }, + Cannot_find_name_0_Did_you_mean_the_instance_member_this_0: { code: 2663, category: ts.DiagnosticCategory.Error, key: "Cannot_find_name_0_Did_you_mean_the_instance_member_this_0_2663", message: "Cannot find name '{0}'. Did you mean the instance member 'this.{0}'?" }, + Invalid_module_name_in_augmentation_module_0_cannot_be_found: { code: 2664, category: ts.DiagnosticCategory.Error, key: "Invalid_module_name_in_augmentation_module_0_cannot_be_found_2664", message: "Invalid module name in augmentation, module '{0}' cannot be found." }, + Exports_and_export_assignments_are_not_permitted_in_module_augmentations: { code: 2666, category: ts.DiagnosticCategory.Error, key: "Exports_and_export_assignments_are_not_permitted_in_module_augmentations_2666", message: "Exports and export assignments are not permitted in module augmentations." }, + Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module: { code: 2667, category: ts.DiagnosticCategory.Error, key: "Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_mod_2667", message: "Imports are not permitted in module augmentations. Consider moving them to the enclosing external module." }, + export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always_visible: { code: 2668, category: ts.DiagnosticCategory.Error, key: "export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always__2668", message: "'export' modifier cannot be applied to ambient modules and module augmentations since they are always visible." }, + Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_declarations: { code: 2669, category: ts.DiagnosticCategory.Error, key: "Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_2669", message: "Augmentations for the global scope can only be directly nested in external modules or ambient module declarations." }, + Augmentations_for_the_global_scope_should_have_declare_modifier_unless_they_appear_in_already_ambient_context: { code: 2670, category: ts.DiagnosticCategory.Error, key: "Augmentations_for_the_global_scope_should_have_declare_modifier_unless_they_appear_in_already_ambien_2670", message: "Augmentations for the global scope should have 'declare' modifier unless they appear in already ambient context." }, + Cannot_augment_module_0_because_it_resolves_to_a_non_module_entity: { code: 2671, category: ts.DiagnosticCategory.Error, key: "Cannot_augment_module_0_because_it_resolves_to_a_non_module_entity_2671", message: "Cannot augment module '{0}' because it resolves to a non-module entity." }, + Cannot_assign_a_0_constructor_type_to_a_1_constructor_type: { code: 2672, category: ts.DiagnosticCategory.Error, key: "Cannot_assign_a_0_constructor_type_to_a_1_constructor_type_2672", message: "Cannot assign a '{0}' constructor type to a '{1}' constructor type." }, + Constructor_of_class_0_is_private_and_only_accessible_within_the_class_declaration: { code: 2673, category: ts.DiagnosticCategory.Error, key: "Constructor_of_class_0_is_private_and_only_accessible_within_the_class_declaration_2673", message: "Constructor of class '{0}' is private and only accessible within the class declaration." }, + Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration: { code: 2674, category: ts.DiagnosticCategory.Error, key: "Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration_2674", message: "Constructor of class '{0}' is protected and only accessible within the class declaration." }, + Cannot_extend_a_class_0_Class_constructor_is_marked_as_private: { code: 2675, category: ts.DiagnosticCategory.Error, key: "Cannot_extend_a_class_0_Class_constructor_is_marked_as_private_2675", message: "Cannot extend a class '{0}'. Class constructor is marked as private." }, + Accessors_must_both_be_abstract_or_non_abstract: { code: 2676, category: ts.DiagnosticCategory.Error, key: "Accessors_must_both_be_abstract_or_non_abstract_2676", message: "Accessors must both be abstract or non-abstract." }, + A_type_predicate_s_type_must_be_assignable_to_its_parameter_s_type: { code: 2677, category: ts.DiagnosticCategory.Error, key: "A_type_predicate_s_type_must_be_assignable_to_its_parameter_s_type_2677", message: "A type predicate's type must be assignable to its parameter's type." }, + Type_0_is_not_comparable_to_type_1: { code: 2678, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_comparable_to_type_1_2678", message: "Type '{0}' is not comparable to type '{1}'." }, + A_function_that_is_called_with_the_new_keyword_cannot_have_a_this_type_that_is_void: { code: 2679, category: ts.DiagnosticCategory.Error, key: "A_function_that_is_called_with_the_new_keyword_cannot_have_a_this_type_that_is_void_2679", message: "A function that is called with the 'new' keyword cannot have a 'this' type that is 'void'." }, + A_this_parameter_must_be_the_first_parameter: { code: 2680, category: ts.DiagnosticCategory.Error, key: "A_this_parameter_must_be_the_first_parameter_2680", message: "A 'this' parameter must be the first parameter." }, + A_constructor_cannot_have_a_this_parameter: { code: 2681, category: ts.DiagnosticCategory.Error, key: "A_constructor_cannot_have_a_this_parameter_2681", message: "A constructor cannot have a 'this' parameter." }, + get_and_set_accessor_must_have_the_same_this_type: { code: 2682, category: ts.DiagnosticCategory.Error, key: "get_and_set_accessor_must_have_the_same_this_type_2682", message: "'get' and 'set' accessor must have the same 'this' type." }, + this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation: { code: 2683, category: ts.DiagnosticCategory.Error, key: "this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_2683", message: "'this' implicitly has type 'any' because it does not have a type annotation." }, + The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1: { code: 2684, category: ts.DiagnosticCategory.Error, key: "The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1_2684", message: "The 'this' context of type '{0}' is not assignable to method's 'this' of type '{1}'." }, + The_this_types_of_each_signature_are_incompatible: { code: 2685, category: ts.DiagnosticCategory.Error, key: "The_this_types_of_each_signature_are_incompatible_2685", message: "The 'this' types of each signature are incompatible." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import_declaration_0_is_using_private_name_1_4000", message: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", message: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", message: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, @@ -1618,6 +1834,7 @@ var ts; Parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4078, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_exported_function_has_or_is_using_private_name_1_4078", message: "Parameter '{0}' of exported function has or is using private name '{1}'." }, Exported_type_alias_0_has_or_is_using_private_name_1: { code: 4081, category: ts.DiagnosticCategory.Error, key: "Exported_type_alias_0_has_or_is_using_private_name_1_4081", message: "Exported type alias '{0}' has or is using private name '{1}'." }, Default_export_of_the_module_has_or_is_using_private_name_0: { code: 4082, category: ts.DiagnosticCategory.Error, key: "Default_export_of_the_module_has_or_is_using_private_name_0_4082", message: "Default export of the module has or is using private name '{0}'." }, + Conflicting_library_definitions_for_0_found_at_1_and_2_Copy_the_correct_file_to_the_typings_folder_to_resolve_this_conflict: { code: 4090, category: ts.DiagnosticCategory.Message, key: "Conflicting_library_definitions_for_0_found_at_1_and_2_Copy_the_correct_file_to_the_typings_folder_t_4090", message: "Conflicting library definitions for '{0}' found at '{1}' and '{2}'. Copy the correct file to the 'typings' folder to resolve this conflict." }, The_current_host_does_not_support_the_0_option: { code: 5001, category: ts.DiagnosticCategory.Error, key: "The_current_host_does_not_support_the_0_option_5001", message: "The current host does not support the '{0}' option." }, Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: ts.DiagnosticCategory.Error, key: "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", message: "Cannot find the common subdirectory path for the input files." }, Cannot_read_file_0_Colon_1: { code: 5012, category: ts.DiagnosticCategory.Error, key: "Cannot_read_file_0_Colon_1_5012", message: "Cannot read file '{0}': {1}" }, @@ -1632,17 +1849,28 @@ var ts; Option_0_cannot_be_specified_without_specifying_option_1: { code: 5052, category: ts.DiagnosticCategory.Error, key: "Option_0_cannot_be_specified_without_specifying_option_1_5052", message: "Option '{0}' cannot be specified without specifying option '{1}'." }, Option_0_cannot_be_specified_with_option_1: { code: 5053, category: ts.DiagnosticCategory.Error, key: "Option_0_cannot_be_specified_with_option_1_5053", message: "Option '{0}' cannot be specified with option '{1}'." }, A_tsconfig_json_file_is_already_defined_at_Colon_0: { code: 5054, category: ts.DiagnosticCategory.Error, key: "A_tsconfig_json_file_is_already_defined_at_Colon_0_5054", message: "A 'tsconfig.json' file is already defined at: '{0}'." }, + Cannot_write_file_0_because_it_would_overwrite_input_file: { code: 5055, category: ts.DiagnosticCategory.Error, key: "Cannot_write_file_0_because_it_would_overwrite_input_file_5055", message: "Cannot write file '{0}' because it would overwrite input file." }, + Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files: { code: 5056, category: ts.DiagnosticCategory.Error, key: "Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files_5056", message: "Cannot write file '{0}' because it would be overwritten by multiple input files." }, + Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0: { code: 5057, category: ts.DiagnosticCategory.Error, key: "Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0_5057", message: "Cannot find a tsconfig.json file at the specified directory: '{0}'" }, + The_specified_path_does_not_exist_Colon_0: { code: 5058, category: ts.DiagnosticCategory.Error, key: "The_specified_path_does_not_exist_Colon_0_5058", message: "The specified path does not exist: '{0}'" }, + Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier: { code: 5059, category: ts.DiagnosticCategory.Error, key: "Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier_5059", message: "Invalid value for '--reactNamespace'. '{0}' is not a valid identifier." }, + Option_paths_cannot_be_used_without_specifying_baseUrl_option: { code: 5060, category: ts.DiagnosticCategory.Error, key: "Option_paths_cannot_be_used_without_specifying_baseUrl_option_5060", message: "Option 'paths' cannot be used without specifying '--baseUrl' option." }, + Pattern_0_can_have_at_most_one_Asterisk_character: { code: 5061, category: ts.DiagnosticCategory.Error, key: "Pattern_0_can_have_at_most_one_Asterisk_character_5061", message: "Pattern '{0}' can have at most one '*' character" }, + Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character: { code: 5062, category: ts.DiagnosticCategory.Error, key: "Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character_5062", message: "Substitution '{0}' in pattern '{1}' in can have at most one '*' character" }, + Substututions_for_pattern_0_should_be_an_array: { code: 5063, category: ts.DiagnosticCategory.Error, key: "Substututions_for_pattern_0_should_be_an_array_5063", message: "Substututions for pattern '{0}' should be an array." }, + Substitution_0_for_pattern_1_has_incorrect_type_expected_string_got_2: { code: 5064, category: ts.DiagnosticCategory.Error, key: "Substitution_0_for_pattern_1_has_incorrect_type_expected_string_got_2_5064", message: "Substitution '{0}' for pattern '{1}' has incorrect type, expected 'string', got '{2}'." }, Concatenate_and_emit_output_to_single_file: { code: 6001, category: ts.DiagnosticCategory.Message, key: "Concatenate_and_emit_output_to_single_file_6001", message: "Concatenate and emit output to single file." }, Generates_corresponding_d_ts_file: { code: 6002, category: ts.DiagnosticCategory.Message, key: "Generates_corresponding_d_ts_file_6002", message: "Generates corresponding '.d.ts' file." }, - Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { code: 6003, category: ts.DiagnosticCategory.Message, key: "Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations_6003", message: "Specifies the location where debugger should locate map files instead of generated locations." }, - Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations: { code: 6004, category: ts.DiagnosticCategory.Message, key: "Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations_6004", message: "Specifies the location where debugger should locate TypeScript files instead of source locations." }, + Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { code: 6003, category: ts.DiagnosticCategory.Message, key: "Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations_6003", message: "Specify the location where debugger should locate map files instead of generated locations." }, + Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations: { code: 6004, category: ts.DiagnosticCategory.Message, key: "Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations_6004", message: "Specify the location where debugger should locate TypeScript files instead of source locations." }, Watch_input_files: { code: 6005, category: ts.DiagnosticCategory.Message, key: "Watch_input_files_6005", message: "Watch input files." }, Redirect_output_structure_to_the_directory: { code: 6006, category: ts.DiagnosticCategory.Message, key: "Redirect_output_structure_to_the_directory_6006", message: "Redirect output structure to the directory." }, Do_not_erase_const_enum_declarations_in_generated_code: { code: 6007, category: ts.DiagnosticCategory.Message, key: "Do_not_erase_const_enum_declarations_in_generated_code_6007", message: "Do not erase const enum declarations in generated code." }, Do_not_emit_outputs_if_any_errors_were_reported: { code: 6008, category: ts.DiagnosticCategory.Message, key: "Do_not_emit_outputs_if_any_errors_were_reported_6008", message: "Do not emit outputs if any errors were reported." }, Do_not_emit_comments_to_output: { code: 6009, category: ts.DiagnosticCategory.Message, key: "Do_not_emit_comments_to_output_6009", message: "Do not emit comments to output." }, Do_not_emit_outputs: { code: 6010, category: ts.DiagnosticCategory.Message, key: "Do_not_emit_outputs_6010", message: "Do not emit outputs." }, - Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015_experimental: { code: 6015, category: ts.DiagnosticCategory.Message, key: "Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015_experimental_6015", message: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES2015' (experimental)" }, + Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typechecking: { code: 6011, category: ts.DiagnosticCategory.Message, key: "Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typech_6011", message: "Allow default imports from modules with no default export. This does not affect code emit, just typechecking." }, + Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015: { code: 6015, category: ts.DiagnosticCategory.Message, key: "Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015_6015", message: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES2015'" }, Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015: { code: 6016, category: ts.DiagnosticCategory.Message, key: "Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015_6016", message: "Specify module code generation: 'commonjs', 'amd', 'system', 'umd' or 'es2015'" }, Print_this_message: { code: 6017, category: ts.DiagnosticCategory.Message, key: "Print_this_message_6017", message: "Print this message." }, Print_the_compiler_s_version: { code: 6019, category: ts.DiagnosticCategory.Message, key: "Print_the_compiler_s_version_6019", message: "Print the compiler's version." }, @@ -1664,8 +1892,7 @@ var ts; Generates_corresponding_map_file: { code: 6043, category: ts.DiagnosticCategory.Message, key: "Generates_corresponding_map_file_6043", message: "Generates corresponding '.map' file." }, Compiler_option_0_expects_an_argument: { code: 6044, category: ts.DiagnosticCategory.Error, key: "Compiler_option_0_expects_an_argument_6044", message: "Compiler option '{0}' expects an argument." }, Unterminated_quoted_string_in_response_file_0: { code: 6045, category: ts.DiagnosticCategory.Error, key: "Unterminated_quoted_string_in_response_file_0_6045", message: "Unterminated quoted string in response file '{0}'." }, - Argument_for_module_option_must_be_commonjs_amd_system_umd_or_es2015: { code: 6046, category: ts.DiagnosticCategory.Error, key: "Argument_for_module_option_must_be_commonjs_amd_system_umd_or_es2015_6046", message: "Argument for '--module' option must be 'commonjs', 'amd', 'system', 'umd', or 'es2015'." }, - Argument_for_target_option_must_be_ES3_ES5_or_ES2015: { code: 6047, category: ts.DiagnosticCategory.Error, key: "Argument_for_target_option_must_be_ES3_ES5_or_ES2015_6047", message: "Argument for '--target' option must be 'ES3', 'ES5', or 'ES2015'." }, + Argument_for_0_option_must_be_Colon_1: { code: 6046, category: ts.DiagnosticCategory.Error, key: "Argument_for_0_option_must_be_Colon_1_6046", message: "Argument for '{0}' option must be: {1}" }, Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: { code: 6048, category: ts.DiagnosticCategory.Error, key: "Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1_6048", message: "Locale must be of the form or -. For example '{0}' or '{1}'." }, Unsupported_locale_0: { code: 6049, category: ts.DiagnosticCategory.Error, key: "Unsupported_locale_0_6049", message: "Unsupported locale '{0}'." }, Unable_to_open_file_0: { code: 6050, category: ts.DiagnosticCategory.Error, key: "Unable_to_open_file_0_6050", message: "Unable to open file '{0}'." }, @@ -1675,16 +1902,15 @@ var ts; File_0_has_unsupported_extension_The_only_supported_extensions_are_1: { code: 6054, category: ts.DiagnosticCategory.Error, key: "File_0_has_unsupported_extension_The_only_supported_extensions_are_1_6054", message: "File '{0}' has unsupported extension. The only supported extensions are {1}." }, Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures: { code: 6055, category: ts.DiagnosticCategory.Message, key: "Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures_6055", message: "Suppress noImplicitAny errors for indexing objects lacking index signatures." }, Do_not_emit_declarations_for_code_that_has_an_internal_annotation: { code: 6056, category: ts.DiagnosticCategory.Message, key: "Do_not_emit_declarations_for_code_that_has_an_internal_annotation_6056", message: "Do not emit declarations for code that has an '@internal' annotation." }, - Specifies_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir: { code: 6058, category: ts.DiagnosticCategory.Message, key: "Specifies_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDi_6058", message: "Specifies the root directory of input files. Use to control the output directory structure with --outDir." }, + Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir: { code: 6058, category: ts.DiagnosticCategory.Message, key: "Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir_6058", message: "Specify the root directory of input files. Use to control the output directory structure with --outDir." }, File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files: { code: 6059, category: ts.DiagnosticCategory.Error, key: "File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files_6059", message: "File '{0}' is not under 'rootDir' '{1}'. 'rootDir' is expected to contain all source files." }, - Specifies_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix: { code: 6060, category: ts.DiagnosticCategory.Message, key: "Specifies_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix_6060", message: "Specifies the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix)." }, + Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix: { code: 6060, category: ts.DiagnosticCategory.Message, key: "Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix_6060", message: "Specify the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix)." }, NEWLINE: { code: 6061, category: ts.DiagnosticCategory.Message, key: "NEWLINE_6061", message: "NEWLINE" }, - Argument_for_newLine_option_must_be_CRLF_or_LF: { code: 6062, category: ts.DiagnosticCategory.Error, key: "Argument_for_newLine_option_must_be_CRLF_or_LF_6062", message: "Argument for '--newLine' option must be 'CRLF' or 'LF'." }, - Argument_for_moduleResolution_option_must_be_node_or_classic: { code: 6063, category: ts.DiagnosticCategory.Error, key: "Argument_for_moduleResolution_option_must_be_node_or_classic_6063", message: "Argument for '--moduleResolution' option must be 'node' or 'classic'." }, + Option_0_can_only_be_specified_in_tsconfig_json_file: { code: 6064, category: ts.DiagnosticCategory.Error, key: "Option_0_can_only_be_specified_in_tsconfig_json_file_6064", message: "Option '{0}' can only be specified in 'tsconfig.json' file." }, Enables_experimental_support_for_ES7_decorators: { code: 6065, category: ts.DiagnosticCategory.Message, key: "Enables_experimental_support_for_ES7_decorators_6065", message: "Enables experimental support for ES7 decorators." }, Enables_experimental_support_for_emitting_type_metadata_for_decorators: { code: 6066, category: ts.DiagnosticCategory.Message, key: "Enables_experimental_support_for_emitting_type_metadata_for_decorators_6066", message: "Enables experimental support for emitting type metadata for decorators." }, Enables_experimental_support_for_ES7_async_functions: { code: 6068, category: ts.DiagnosticCategory.Message, key: "Enables_experimental_support_for_ES7_async_functions_6068", message: "Enables experimental support for ES7 async functions." }, - Specifies_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6: { code: 6069, category: ts.DiagnosticCategory.Message, key: "Specifies_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6_6069", message: "Specifies module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6)." }, + Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6: { code: 6069, category: ts.DiagnosticCategory.Message, key: "Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6_6069", message: "Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6)." }, Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file: { code: 6070, category: ts.DiagnosticCategory.Message, key: "Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file_6070", message: "Initializes a TypeScript project and creates a tsconfig.json file." }, Successfully_created_a_tsconfig_json_file: { code: 6071, category: ts.DiagnosticCategory.Message, key: "Successfully_created_a_tsconfig_json_file_6071", message: "Successfully created a tsconfig.json file." }, Suppress_excess_property_checks_for_object_literals: { code: 6072, category: ts.DiagnosticCategory.Message, key: "Suppress_excess_property_checks_for_object_literals_6072", message: "Suppress excess property checks for object literals." }, @@ -1694,9 +1920,57 @@ var ts; Report_errors_for_fallthrough_cases_in_switch_statement: { code: 6076, category: ts.DiagnosticCategory.Message, key: "Report_errors_for_fallthrough_cases_in_switch_statement_6076", message: "Report errors for fallthrough cases in switch statement." }, Do_not_report_errors_on_unreachable_code: { code: 6077, category: ts.DiagnosticCategory.Message, key: "Do_not_report_errors_on_unreachable_code_6077", message: "Do not report errors on unreachable code." }, Disallow_inconsistently_cased_references_to_the_same_file: { code: 6078, category: ts.DiagnosticCategory.Message, key: "Disallow_inconsistently_cased_references_to_the_same_file_6078", message: "Disallow inconsistently-cased references to the same file." }, + Specify_library_files_to_be_included_in_the_compilation_Colon: { code: 6079, category: ts.DiagnosticCategory.Message, key: "Specify_library_files_to_be_included_in_the_compilation_Colon_6079", message: "Specify library files to be included in the compilation: " }, Specify_JSX_code_generation_Colon_preserve_or_react: { code: 6080, category: ts.DiagnosticCategory.Message, key: "Specify_JSX_code_generation_Colon_preserve_or_react_6080", message: "Specify JSX code generation: 'preserve' or 'react'" }, - Argument_for_jsx_must_be_preserve_or_react: { code: 6081, category: ts.DiagnosticCategory.Message, key: "Argument_for_jsx_must_be_preserve_or_react_6081", message: "Argument for '--jsx' must be 'preserve' or 'react'." }, Only_amd_and_system_modules_are_supported_alongside_0: { code: 6082, category: ts.DiagnosticCategory.Error, key: "Only_amd_and_system_modules_are_supported_alongside_0_6082", message: "Only 'amd' and 'system' modules are supported alongside --{0}." }, + Base_directory_to_resolve_non_absolute_module_names: { code: 6083, category: ts.DiagnosticCategory.Message, key: "Base_directory_to_resolve_non_absolute_module_names_6083", message: "Base directory to resolve non-absolute module names." }, + Specify_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit: { code: 6084, category: ts.DiagnosticCategory.Message, key: "Specify_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit_6084", message: "Specify the object invoked for createElement and __spread when targeting 'react' JSX emit" }, + Enable_tracing_of_the_name_resolution_process: { code: 6085, category: ts.DiagnosticCategory.Message, key: "Enable_tracing_of_the_name_resolution_process_6085", message: "Enable tracing of the name resolution process." }, + Resolving_module_0_from_1: { code: 6086, category: ts.DiagnosticCategory.Message, key: "Resolving_module_0_from_1_6086", message: "======== Resolving module '{0}' from '{1}'. ========" }, + Explicitly_specified_module_resolution_kind_Colon_0: { code: 6087, category: ts.DiagnosticCategory.Message, key: "Explicitly_specified_module_resolution_kind_Colon_0_6087", message: "Explicitly specified module resolution kind: '{0}'." }, + Module_resolution_kind_is_not_specified_using_0: { code: 6088, category: ts.DiagnosticCategory.Message, key: "Module_resolution_kind_is_not_specified_using_0_6088", message: "Module resolution kind is not specified, using '{0}'." }, + Module_name_0_was_successfully_resolved_to_1: { code: 6089, category: ts.DiagnosticCategory.Message, key: "Module_name_0_was_successfully_resolved_to_1_6089", message: "======== Module name '{0}' was successfully resolved to '{1}'. ========" }, + Module_name_0_was_not_resolved: { code: 6090, category: ts.DiagnosticCategory.Message, key: "Module_name_0_was_not_resolved_6090", message: "======== Module name '{0}' was not resolved. ========" }, + paths_option_is_specified_looking_for_a_pattern_to_match_module_name_0: { code: 6091, category: ts.DiagnosticCategory.Message, key: "paths_option_is_specified_looking_for_a_pattern_to_match_module_name_0_6091", message: "'paths' option is specified, looking for a pattern to match module name '{0}'." }, + Module_name_0_matched_pattern_1: { code: 6092, category: ts.DiagnosticCategory.Message, key: "Module_name_0_matched_pattern_1_6092", message: "Module name '{0}', matched pattern '{1}'." }, + Trying_substitution_0_candidate_module_location_Colon_1: { code: 6093, category: ts.DiagnosticCategory.Message, key: "Trying_substitution_0_candidate_module_location_Colon_1_6093", message: "Trying substitution '{0}', candidate module location: '{1}'." }, + Resolving_module_name_0_relative_to_base_url_1_2: { code: 6094, category: ts.DiagnosticCategory.Message, key: "Resolving_module_name_0_relative_to_base_url_1_2_6094", message: "Resolving module name '{0}' relative to base url '{1}' - '{2}'." }, + Loading_module_as_file_Slash_folder_candidate_module_location_0: { code: 6095, category: ts.DiagnosticCategory.Message, key: "Loading_module_as_file_Slash_folder_candidate_module_location_0_6095", message: "Loading module as file / folder, candidate module location '{0}'." }, + File_0_does_not_exist: { code: 6096, category: ts.DiagnosticCategory.Message, key: "File_0_does_not_exist_6096", message: "File '{0}' does not exist." }, + File_0_exist_use_it_as_a_name_resolution_result: { code: 6097, category: ts.DiagnosticCategory.Message, key: "File_0_exist_use_it_as_a_name_resolution_result_6097", message: "File '{0}' exist - use it as a name resolution result." }, + Loading_module_0_from_node_modules_folder: { code: 6098, category: ts.DiagnosticCategory.Message, key: "Loading_module_0_from_node_modules_folder_6098", message: "Loading module '{0}' from 'node_modules' folder." }, + Found_package_json_at_0: { code: 6099, category: ts.DiagnosticCategory.Message, key: "Found_package_json_at_0_6099", message: "Found 'package.json' at '{0}'." }, + package_json_does_not_have_types_field: { code: 6100, category: ts.DiagnosticCategory.Message, key: "package_json_does_not_have_types_field_6100", message: "'package.json' does not have 'types' field." }, + package_json_has_0_field_1_that_references_2: { code: 6101, category: ts.DiagnosticCategory.Message, key: "package_json_has_0_field_1_that_references_2_6101", message: "'package.json' has '{0}' field '{1}' that references '{2}'." }, + Allow_javascript_files_to_be_compiled: { code: 6102, category: ts.DiagnosticCategory.Message, key: "Allow_javascript_files_to_be_compiled_6102", message: "Allow javascript files to be compiled." }, + Option_0_should_have_array_of_strings_as_a_value: { code: 6103, category: ts.DiagnosticCategory.Error, key: "Option_0_should_have_array_of_strings_as_a_value_6103", message: "Option '{0}' should have array of strings as a value." }, + Checking_if_0_is_the_longest_matching_prefix_for_1_2: { code: 6104, category: ts.DiagnosticCategory.Message, key: "Checking_if_0_is_the_longest_matching_prefix_for_1_2_6104", message: "Checking if '{0}' is the longest matching prefix for '{1}' - '{2}'." }, + Expected_type_of_0_field_in_package_json_to_be_string_got_1: { code: 6105, category: ts.DiagnosticCategory.Message, key: "Expected_type_of_0_field_in_package_json_to_be_string_got_1_6105", message: "Expected type of '{0}' field in 'package.json' to be 'string', got '{1}'." }, + baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1: { code: 6106, category: ts.DiagnosticCategory.Message, key: "baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1_6106", message: "'baseUrl' option is set to '{0}', using this value to resolve non-relative module name '{1}'" }, + rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0: { code: 6107, category: ts.DiagnosticCategory.Message, key: "rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0_6107", message: "'rootDirs' option is set, using it to resolve relative module name '{0}'" }, + Longest_matching_prefix_for_0_is_1: { code: 6108, category: ts.DiagnosticCategory.Message, key: "Longest_matching_prefix_for_0_is_1_6108", message: "Longest matching prefix for '{0}' is '{1}'" }, + Loading_0_from_the_root_dir_1_candidate_location_2: { code: 6109, category: ts.DiagnosticCategory.Message, key: "Loading_0_from_the_root_dir_1_candidate_location_2_6109", message: "Loading '{0}' from the root dir '{1}', candidate location '{2}'" }, + Trying_other_entries_in_rootDirs: { code: 6110, category: ts.DiagnosticCategory.Message, key: "Trying_other_entries_in_rootDirs_6110", message: "Trying other entries in 'rootDirs'" }, + Module_resolution_using_rootDirs_has_failed: { code: 6111, category: ts.DiagnosticCategory.Message, key: "Module_resolution_using_rootDirs_has_failed_6111", message: "Module resolution using 'rootDirs' has failed" }, + Do_not_emit_use_strict_directives_in_module_output: { code: 6112, category: ts.DiagnosticCategory.Message, key: "Do_not_emit_use_strict_directives_in_module_output_6112", message: "Do not emit 'use strict' directives in module output." }, + Enable_strict_null_checks: { code: 6113, category: ts.DiagnosticCategory.Message, key: "Enable_strict_null_checks_6113", message: "Enable strict null checks." }, + Unknown_option_excludes_Did_you_mean_exclude: { code: 6114, category: ts.DiagnosticCategory.Error, key: "Unknown_option_excludes_Did_you_mean_exclude_6114", message: "Unknown option 'excludes'. Did you mean 'exclude'?" }, + Raise_error_on_this_expressions_with_an_implied_any_type: { code: 6115, category: ts.DiagnosticCategory.Message, key: "Raise_error_on_this_expressions_with_an_implied_any_type_6115", message: "Raise error on 'this' expressions with an implied 'any' type." }, + Resolving_type_reference_directive_0_containing_file_1_root_directory_2: { code: 6116, category: ts.DiagnosticCategory.Message, key: "Resolving_type_reference_directive_0_containing_file_1_root_directory_2_6116", message: "======== Resolving type reference directive '{0}', containing file '{1}', root directory '{2}'. ========" }, + Resolving_using_primary_search_paths: { code: 6117, category: ts.DiagnosticCategory.Message, key: "Resolving_using_primary_search_paths_6117", message: "Resolving using primary search paths..." }, + Resolving_from_node_modules_folder: { code: 6118, category: ts.DiagnosticCategory.Message, key: "Resolving_from_node_modules_folder_6118", message: "Resolving from node_modules folder..." }, + Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2: { code: 6119, category: ts.DiagnosticCategory.Message, key: "Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2_6119", message: "======== Type reference directive '{0}' was successfully resolved to '{1}', primary: {2}. ========" }, + Type_reference_directive_0_was_not_resolved: { code: 6120, category: ts.DiagnosticCategory.Message, key: "Type_reference_directive_0_was_not_resolved_6120", message: "======== Type reference directive '{0}' was not resolved. ========" }, + Resolving_with_primary_search_path_0: { code: 6121, category: ts.DiagnosticCategory.Message, key: "Resolving_with_primary_search_path_0_6121", message: "Resolving with primary search path '{0}'" }, + Root_directory_cannot_be_determined_skipping_primary_search_paths: { code: 6122, category: ts.DiagnosticCategory.Message, key: "Root_directory_cannot_be_determined_skipping_primary_search_paths_6122", message: "Root directory cannot be determined, skipping primary search paths." }, + Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set: { code: 6123, category: ts.DiagnosticCategory.Message, key: "Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set_6123", message: "======== Resolving type reference directive '{0}', containing file '{1}', root directory not set. ========" }, + Type_declaration_files_to_be_included_in_compilation: { code: 6124, category: ts.DiagnosticCategory.Message, key: "Type_declaration_files_to_be_included_in_compilation_6124", message: "Type declaration files to be included in compilation." }, + Looking_up_in_node_modules_folder_initial_location_0: { code: 6125, category: ts.DiagnosticCategory.Message, key: "Looking_up_in_node_modules_folder_initial_location_0_6125", message: "Looking up in 'node_modules' folder, initial location '{0}'" }, + Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_modules_folder: { code: 6126, category: ts.DiagnosticCategory.Message, key: "Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_mod_6126", message: "Containing file is not specified and root directory cannot be determined, skipping lookup in 'node_modules' folder." }, + Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1: { code: 6127, category: ts.DiagnosticCategory.Message, key: "Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1_6127", message: "======== Resolving type reference directive '{0}', containing file not set, root directory '{1}'. ========" }, + Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set: { code: 6128, category: ts.DiagnosticCategory.Message, key: "Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set_6128", message: "======== Resolving type reference directive '{0}', containing file not set, root directory not set. ========" }, + The_config_file_0_found_doesn_t_contain_any_source_files: { code: 6129, category: ts.DiagnosticCategory.Error, key: "The_config_file_0_found_doesn_t_contain_any_source_files_6129", message: "The config file '{0}' found doesn't contain any source files." }, + Resolving_real_path_for_0_result_1: { code: 6130, category: ts.DiagnosticCategory.Message, key: "Resolving_real_path_for_0_result_1_6130", message: "Resolving real path for '{0}', result '{1}'" }, Variable_0_implicitly_has_an_1_type: { code: 7005, category: ts.DiagnosticCategory.Error, key: "Variable_0_implicitly_has_an_1_type_7005", message: "Variable '{0}' implicitly has an '{1}' type." }, Parameter_0_implicitly_has_an_1_type: { code: 7006, category: ts.DiagnosticCategory.Error, key: "Parameter_0_implicitly_has_an_1_type_7006", message: "Parameter '{0}' implicitly has an '{1}' type." }, Member_0_implicitly_has_an_1_type: { code: 7008, category: ts.DiagnosticCategory.Error, key: "Member_0_implicitly_has_an_1_type_7008", message: "Member '{0}' implicitly has an '{1}' type." }, @@ -1704,6 +1978,7 @@ var ts; _0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type: { code: 7010, category: ts.DiagnosticCategory.Error, key: "_0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type_7010", message: "'{0}', which lacks return-type annotation, implicitly has an '{1}' return type." }, Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type: { code: 7011, category: ts.DiagnosticCategory.Error, key: "Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type_7011", message: "Function expression, which lacks return-type annotation, implicitly has an '{0}' return type." }, Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7013, category: ts.DiagnosticCategory.Error, key: "Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type_7013", message: "Construct signature, which lacks return-type annotation, implicitly has an 'any' return type." }, + Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number: { code: 7015, category: ts.DiagnosticCategory.Error, key: "Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number_7015", message: "Element implicitly has an 'any' type because index expression is not of type 'number'." }, Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_type_annotation: { code: 7016, category: ts.DiagnosticCategory.Error, key: "Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_type_annotation_7016", message: "Property '{0}' implicitly has type 'any', because its 'set' accessor lacks a type annotation." }, Index_signature_of_object_type_implicitly_has_an_any_type: { code: 7017, category: ts.DiagnosticCategory.Error, key: "Index_signature_of_object_type_implicitly_has_an_any_type_7017", message: "Index signature of object type implicitly has an 'any' type." }, Object_literal_s_property_0_implicitly_has_an_1_type: { code: 7018, category: ts.DiagnosticCategory.Error, key: "Object_literal_s_property_0_implicitly_has_an_1_type_7018", message: "Object literal's property '{0}' implicitly has an '{1}' type." }, @@ -1718,6 +1993,7 @@ var ts; Unused_label: { code: 7028, category: ts.DiagnosticCategory.Error, key: "Unused_label_7028", message: "Unused label." }, Fallthrough_case_in_switch: { code: 7029, category: ts.DiagnosticCategory.Error, key: "Fallthrough_case_in_switch_7029", message: "Fallthrough case in switch." }, Not_all_code_paths_return_a_value: { code: 7030, category: ts.DiagnosticCategory.Error, key: "Not_all_code_paths_return_a_value_7030", message: "Not all code paths return a value." }, + Binding_element_0_implicitly_has_an_1_type: { code: 7031, category: ts.DiagnosticCategory.Error, key: "Binding_element_0_implicitly_has_an_1_type_7031", message: "Binding element '{0}' implicitly has an '{1}' type." }, You_cannot_rename_this_element: { code: 8000, category: ts.DiagnosticCategory.Error, key: "You_cannot_rename_this_element_8000", message: "You cannot rename this element." }, You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: { code: 8001, category: ts.DiagnosticCategory.Error, key: "You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library_8001", message: "You cannot rename elements that are defined in the standard TypeScript library." }, import_can_only_be_used_in_a_ts_file: { code: 8002, category: ts.DiagnosticCategory.Error, key: "import_can_only_be_used_in_a_ts_file_8002", message: "'import ... =' can only be used in a .ts file." }, @@ -1734,7 +2010,6 @@ var ts; property_declarations_can_only_be_used_in_a_ts_file: { code: 8014, category: ts.DiagnosticCategory.Error, key: "property_declarations_can_only_be_used_in_a_ts_file_8014", message: "'property declarations' can only be used in a .ts file." }, enum_declarations_can_only_be_used_in_a_ts_file: { code: 8015, category: ts.DiagnosticCategory.Error, key: "enum_declarations_can_only_be_used_in_a_ts_file_8015", message: "'enum declarations' can only be used in a .ts file." }, type_assertion_expressions_can_only_be_used_in_a_ts_file: { code: 8016, category: ts.DiagnosticCategory.Error, key: "type_assertion_expressions_can_only_be_used_in_a_ts_file_8016", message: "'type assertion expressions' can only be used in a .ts file." }, - decorators_can_only_be_used_in_a_ts_file: { code: 8017, category: ts.DiagnosticCategory.Error, key: "decorators_can_only_be_used_in_a_ts_file_8017", message: "'decorators' can only be used in a .ts file." }, Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_class_extends_clauses: { code: 9002, category: ts.DiagnosticCategory.Error, key: "Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_clas_9002", message: "Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses." }, class_expressions_are_not_currently_supported: { code: 9003, category: ts.DiagnosticCategory.Error, key: "class_expressions_are_not_currently_supported_9003", message: "'class' expressions are not currently supported." }, JSX_attributes_must_only_be_assigned_a_non_empty_expression: { code: 17000, category: ts.DiagnosticCategory.Error, key: "JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000", message: "JSX attributes must only be assigned a non-empty 'expression'." }, @@ -1744,7 +2019,10 @@ var ts; Cannot_use_JSX_unless_the_jsx_flag_is_provided: { code: 17004, category: ts.DiagnosticCategory.Error, key: "Cannot_use_JSX_unless_the_jsx_flag_is_provided_17004", message: "Cannot use JSX unless the '--jsx' flag is provided." }, A_constructor_cannot_contain_a_super_call_when_its_class_extends_null: { code: 17005, category: ts.DiagnosticCategory.Error, key: "A_constructor_cannot_contain_a_super_call_when_its_class_extends_null_17005", message: "A constructor cannot contain a 'super' call when its class extends 'null'" }, An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: { code: 17006, category: ts.DiagnosticCategory.Error, key: "An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_ex_17006", message: "An unary expression with the '{0}' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses." }, - A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: { code: 17007, category: ts.DiagnosticCategory.Error, key: "A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Con_17007", message: "A type assertion expression is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses." } + A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: { code: 17007, category: ts.DiagnosticCategory.Error, key: "A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Con_17007", message: "A type assertion expression is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses." }, + JSX_element_0_has_no_corresponding_closing_tag: { code: 17008, category: ts.DiagnosticCategory.Error, key: "JSX_element_0_has_no_corresponding_closing_tag_17008", message: "JSX element '{0}' has no corresponding closing tag." }, + super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class: { code: 17009, category: ts.DiagnosticCategory.Error, key: "super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class_17009", message: "'super' must be called before accessing 'this' in the constructor of a derived class." }, + Unknown_typing_option_0: { code: 17010, category: ts.DiagnosticCategory.Error, key: "Unknown_typing_option_0_17010", message: "Unknown typing option '{0}'." } }; })(ts || (ts = {})); var ts; @@ -1777,7 +2055,7 @@ var ts; "false": 84, "finally": 85, "for": 86, - "from": 133, + "from": 136, "function": 87, "get": 123, "if": 88, @@ -1790,27 +2068,31 @@ var ts; "let": 108, "module": 125, "namespace": 126, + "never": 127, "new": 92, "null": 93, - "number": 128, + "number": 130, "package": 109, "private": 110, "protected": 111, "public": 112, - "require": 127, + "readonly": 128, + "require": 129, + "global": 137, "return": 94, - "set": 129, + "set": 131, "static": 113, - "string": 130, + "string": 132, "super": 95, "switch": 96, - "symbol": 131, + "symbol": 133, "this": 97, "throw": 98, "true": 99, "try": 100, - "type": 132, + "type": 134, "typeof": 101, + "undefined": 135, "var": 102, "void": 103, "while": 104, @@ -1818,7 +2100,7 @@ var ts; "yield": 114, "async": 118, "await": 119, - "of": 134, + "of": 138, "{": 15, "}": 16, "(": 17, @@ -1934,7 +2216,8 @@ var ts; var pos = 0; var lineStart = 0; while (pos < text.length) { - var ch = text.charCodeAt(pos++); + var ch = text.charCodeAt(pos); + pos++; switch (ch) { case 13: if (text.charCodeAt(pos) === 10) { @@ -2037,6 +2320,9 @@ var ts; } ts.couldStartTrivia = couldStartTrivia; function skipTrivia(text, pos, stopAfterLineBreak) { + if (!(pos >= 0)) { + return pos; + } while (true) { var ch = text.charCodeAt(pos); switch (ch) { @@ -2254,6 +2540,18 @@ var ts; ch > 127 && isUnicodeIdentifierPart(ch, languageVersion); } ts.isIdentifierPart = isIdentifierPart; + function isIdentifier(name, languageVersion) { + if (!isIdentifierStart(name.charCodeAt(0), languageVersion)) { + return false; + } + for (var i = 1, n = name.length; i < n; i++) { + if (!isIdentifierPart(name.charCodeAt(i), languageVersion)) { + return false; + } + } + return true; + } + ts.isIdentifier = isIdentifier; function createScanner(languageVersion, skipTrivia, languageVariant, text, onError, start, length) { if (languageVariant === void 0) { languageVariant = 0; } var pos; @@ -2284,6 +2582,7 @@ var ts; scanJsxIdentifier: scanJsxIdentifier, reScanJsxToken: reScanJsxToken, scanJsxToken: scanJsxToken, + scanJSDocToken: scanJSDocToken, scan: scan, setText: setText, setScriptTarget: setScriptTarget, @@ -2291,7 +2590,8 @@ var ts; setOnError: setOnError, setTextPos: setTextPos, tryScan: tryScan, - lookAhead: lookAhead + lookAhead: lookAhead, + scanRange: scanRange }; function error(message, length) { if (onError) { @@ -2363,7 +2663,8 @@ var ts; return value; } function scanString() { - var quote = text.charCodeAt(pos++); + var quote = text.charCodeAt(pos); + pos++; var result = ""; var start = pos; while (true) { @@ -2450,7 +2751,8 @@ var ts; error(ts.Diagnostics.Unexpected_end_of_text); return ""; } - var ch = text.charCodeAt(pos++); + var ch = text.charCodeAt(pos); + pos++; switch (ch) { case 48: return "\0"; @@ -2659,7 +2961,8 @@ var ts; } return pos += 2, token = 31; } - return pos++, token = 49; + pos++; + return token = 49; case 34: case 39: tokenValue = scanString(); @@ -2670,7 +2973,8 @@ var ts; if (text.charCodeAt(pos + 1) === 61) { return pos += 2, token = 62; } - return pos++, token = 40; + pos++; + return token = 40; case 38: if (text.charCodeAt(pos + 1) === 38) { return pos += 2, token = 51; @@ -2678,11 +2982,14 @@ var ts; if (text.charCodeAt(pos + 1) === 61) { return pos += 2, token = 66; } - return pos++, token = 46; + pos++; + return token = 46; case 40: - return pos++, token = 17; + pos++; + return token = 17; case 41: - return pos++, token = 18; + pos++; + return token = 18; case 42: if (text.charCodeAt(pos + 1) === 61) { return pos += 2, token = 59; @@ -2693,7 +3000,8 @@ var ts; } return pos += 2, token = 38; } - return pos++, token = 37; + pos++; + return token = 37; case 43: if (text.charCodeAt(pos + 1) === 43) { return pos += 2, token = 41; @@ -2701,9 +3009,11 @@ var ts; if (text.charCodeAt(pos + 1) === 61) { return pos += 2, token = 57; } - return pos++, token = 35; + pos++; + return token = 35; case 44: - return pos++, token = 24; + pos++; + return token = 24; case 45: if (text.charCodeAt(pos + 1) === 45) { return pos += 2, token = 42; @@ -2711,7 +3021,8 @@ var ts; if (text.charCodeAt(pos + 1) === 61) { return pos += 2, token = 58; } - return pos++, token = 36; + pos++; + return token = 36; case 46: if (isDigit(text.charCodeAt(pos + 1))) { tokenValue = scanNumber(); @@ -2720,7 +3031,8 @@ var ts; if (text.charCodeAt(pos + 1) === 46 && text.charCodeAt(pos + 2) === 46) { return pos += 3, token = 22; } - return pos++, token = 21; + pos++; + return token = 21; case 47: if (text.charCodeAt(pos + 1) === 47) { pos += 2; @@ -2766,7 +3078,8 @@ var ts; if (text.charCodeAt(pos + 1) === 61) { return pos += 2, token = 61; } - return pos++, token = 39; + pos++; + return token = 39; case 48: if (pos + 2 < end && (text.charCodeAt(pos + 1) === 88 || text.charCodeAt(pos + 1) === 120)) { pos += 2; @@ -2814,9 +3127,11 @@ var ts; tokenValue = scanNumber(); return token = 8; case 58: - return pos++, token = 54; + pos++; + return token = 54; case 59: - return pos++, token = 23; + pos++; + return token = 23; case 60: if (isConflictMarkerTrivia(text, pos)) { pos = scanConflictMarkerTrivia(text, pos, error); @@ -2841,7 +3156,8 @@ var ts; text.charCodeAt(pos + 2) !== 42) { return pos += 2, token = 26; } - return pos++, token = 25; + pos++; + return token = 25; case 61: if (isConflictMarkerTrivia(text, pos)) { pos = scanConflictMarkerTrivia(text, pos, error); @@ -2861,7 +3177,8 @@ var ts; if (text.charCodeAt(pos + 1) === 62) { return pos += 2, token = 34; } - return pos++, token = 56; + pos++; + return token = 56; case 62: if (isConflictMarkerTrivia(text, pos)) { pos = scanConflictMarkerTrivia(text, pos, error); @@ -2872,20 +3189,26 @@ var ts; return token = 7; } } - return pos++, token = 27; + pos++; + return token = 27; case 63: - return pos++, token = 53; + pos++; + return token = 53; case 91: - return pos++, token = 19; + pos++; + return token = 19; case 93: - return pos++, token = 20; + pos++; + return token = 20; case 94: if (text.charCodeAt(pos + 1) === 61) { return pos += 2, token = 68; } - return pos++, token = 48; + pos++; + return token = 48; case 123: - return pos++, token = 15; + pos++; + return token = 15; case 124: if (text.charCodeAt(pos + 1) === 124) { return pos += 2, token = 52; @@ -2893,13 +3216,17 @@ var ts; if (text.charCodeAt(pos + 1) === 61) { return pos += 2, token = 67; } - return pos++, token = 47; + pos++; + return token = 47; case 125: - return pos++, token = 16; + pos++; + return token = 16; case 126: - return pos++, token = 50; + pos++; + return token = 50; case 64: - return pos++, token = 55; + pos++; + return token = 55; case 92: var cookedChar = peekUnicodeEscape(); if (cookedChar >= 0 && isIdentifierStart(cookedChar, languageVersion)) { @@ -2908,7 +3235,8 @@ var ts; return token = getIdentifierToken(); } error(ts.Diagnostics.Invalid_character); - return pos++, token = 0; + pos++; + return token = 0; default: if (isIdentifierStart(ch, languageVersion)) { pos++; @@ -2930,7 +3258,8 @@ var ts; continue; } error(ts.Diagnostics.Invalid_character); - return pos++, token = 0; + pos++; + return token = 0; } } } @@ -2946,10 +3275,12 @@ var ts; if (text.charCodeAt(pos + 1) === 61) { return pos += 2, token = 64; } - return pos++, token = 44; + pos++; + return token = 44; } if (text.charCodeAt(pos) === 61) { - return pos++, token = 29; + pos++; + return token = 29; } } return token; @@ -3032,7 +3363,7 @@ var ts; break; } } - return token = 236; + return token = 244; } function scanJsxIdentifier() { if (tokenIsIdentifierOrKeyword(token)) { @@ -3050,6 +3381,54 @@ var ts; } return token; } + function scanJSDocToken() { + if (pos >= end) { + return token = 1; + } + startPos = pos; + var ch = text.charCodeAt(pos); + while (pos < end) { + ch = text.charCodeAt(pos); + if (isWhiteSpace(ch)) { + pos++; + } + else { + break; + } + } + tokenPos = pos; + switch (ch) { + case 64: + return pos += 1, token = 55; + case 10: + case 13: + return pos += 1, token = 4; + case 42: + return pos += 1, token = 37; + case 123: + return pos += 1, token = 15; + case 125: + return pos += 1, token = 16; + case 91: + return pos += 1, token = 19; + case 93: + return pos += 1, token = 20; + case 61: + return pos += 1, token = 56; + case 44: + return pos += 1, token = 24; + } + if (isIdentifierStart(ch, 2)) { + pos++; + while (isIdentifierPart(text.charCodeAt(pos), 2) && pos < end) { + pos++; + } + return token = 69; + } + else { + return pos += 1, token = 0; + } + } function speculationHelper(callback, isLookahead) { var savePos = pos; var saveStartPos = startPos; @@ -3068,6 +3447,29 @@ var ts; } return result; } + function scanRange(start, length, callback) { + var saveEnd = end; + var savePos = pos; + var saveStartPos = startPos; + var saveTokenPos = tokenPos; + var saveToken = token; + var savePrecedingLineBreak = precedingLineBreak; + var saveTokenValue = tokenValue; + var saveHasExtendedUnicodeEscape = hasExtendedUnicodeEscape; + var saveTokenIsUnterminated = tokenIsUnterminated; + setText(text, start, length); + var result = callback(); + end = saveEnd; + pos = savePos; + startPos = saveStartPos; + tokenPos = saveTokenPos; + token = saveToken; + precedingLineBreak = savePrecedingLineBreak; + tokenValue = saveTokenValue; + hasExtendedUnicodeEscape = saveHasExtendedUnicodeEscape; + tokenIsUnterminated = saveTokenIsUnterminated; + return result; + } function lookAhead(callback) { return speculationHelper(callback, true); } @@ -3115,6 +3517,12 @@ var ts; type: "boolean", description: ts.Diagnostics.Generates_corresponding_d_ts_file }, + { + name: "declarationDir", + type: "string", + isFilePath: true, + paramType: ts.Diagnostics.DIRECTORY + }, { name: "diagnostics", type: "boolean" @@ -3149,8 +3557,12 @@ var ts; "react": 2 }, paramType: ts.Diagnostics.KIND, - description: ts.Diagnostics.Specify_JSX_code_generation_Colon_preserve_or_react, - error: ts.Diagnostics.Argument_for_jsx_must_be_preserve_or_react + description: ts.Diagnostics.Specify_JSX_code_generation_Colon_preserve_or_react + }, + { + name: "reactNamespace", + type: "string", + description: ts.Diagnostics.Specify_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit }, { name: "listFiles", @@ -3164,23 +3576,23 @@ var ts; name: "mapRoot", type: "string", isFilePath: true, - description: ts.Diagnostics.Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations, + description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations, paramType: ts.Diagnostics.LOCATION }, { name: "module", shortName: "m", type: { - "commonjs": 1, - "amd": 2, - "system": 4, - "umd": 3, - "es6": 5, - "es2015": 5 + "none": ts.ModuleKind.None, + "commonjs": ts.ModuleKind.CommonJS, + "amd": ts.ModuleKind.AMD, + "system": ts.ModuleKind.System, + "umd": ts.ModuleKind.UMD, + "es6": ts.ModuleKind.ES6, + "es2015": ts.ModuleKind.ES2015 }, description: ts.Diagnostics.Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015, - paramType: ts.Diagnostics.KIND, - error: ts.Diagnostics.Argument_for_module_option_must_be_commonjs_amd_system_umd_or_es2015 + paramType: ts.Diagnostics.KIND }, { name: "newLine", @@ -3188,9 +3600,8 @@ var ts; "crlf": 0, "lf": 1 }, - description: ts.Diagnostics.Specifies_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix, - paramType: ts.Diagnostics.NEWLINE, - error: ts.Diagnostics.Argument_for_newLine_option_must_be_CRLF_or_LF + description: ts.Diagnostics.Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix, + paramType: ts.Diagnostics.NEWLINE }, { name: "noEmit", @@ -3211,6 +3622,11 @@ var ts; type: "boolean", description: ts.Diagnostics.Raise_error_on_expressions_and_declarations_with_an_implied_any_type }, + { + name: "noImplicitThis", + type: "boolean", + description: ts.Diagnostics.Raise_error_on_this_expressions_with_an_implied_any_type + }, { name: "noLib", type: "boolean" @@ -3250,7 +3666,6 @@ var ts; }, { name: "pretty", - paramType: ts.Diagnostics.KIND, description: ts.Diagnostics.Stylize_errors_and_messages_using_color_and_context_experimental, type: "boolean" }, @@ -3271,8 +3686,8 @@ var ts; name: "rootDir", type: "string", isFilePath: true, - description: ts.Diagnostics.Specifies_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir, - paramType: ts.Diagnostics.LOCATION + paramType: ts.Diagnostics.LOCATION, + description: ts.Diagnostics.Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir }, { name: "isolatedModules", @@ -3287,7 +3702,7 @@ var ts; name: "sourceRoot", type: "string", isFilePath: true, - description: ts.Diagnostics.Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations, + description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations, paramType: ts.Diagnostics.LOCATION }, { @@ -3316,9 +3731,8 @@ var ts; "es6": 2, "es2015": 2 }, - description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015_experimental, - paramType: ts.Diagnostics.VERSION, - error: ts.Diagnostics.Argument_for_target_option_must_be_ES3_ES5_or_ES2015 + description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015, + paramType: ts.Diagnostics.VERSION }, { name: "version", @@ -3346,11 +3760,10 @@ var ts; { name: "moduleResolution", type: { - "node": 2, - "classic": 1 + "node": ts.ModuleResolutionKind.NodeJs, + "classic": ts.ModuleResolutionKind.Classic }, - description: ts.Diagnostics.Specifies_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6, - error: ts.Diagnostics.Argument_for_moduleResolution_option_must_be_node_or_classic + description: ts.Diagnostics.Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6 }, { name: "allowUnusedLabels", @@ -3376,6 +3789,131 @@ var ts; name: "forceConsistentCasingInFileNames", type: "boolean", description: ts.Diagnostics.Disallow_inconsistently_cased_references_to_the_same_file + }, + { + name: "baseUrl", + type: "string", + isFilePath: true, + description: ts.Diagnostics.Base_directory_to_resolve_non_absolute_module_names + }, + { + name: "paths", + type: "object", + isTSConfigOnly: true + }, + { + name: "rootDirs", + type: "list", + isTSConfigOnly: true, + element: { + name: "rootDirs", + type: "string", + isFilePath: true + } + }, + { + name: "typesSearchPaths", + type: "list", + isTSConfigOnly: true, + element: { + name: "typesSearchPaths", + type: "string", + isFilePath: true + } + }, + { + name: "typesRoot", + type: "string" + }, + { + name: "types", + type: "list", + element: { + name: "types", + type: "string" + }, + description: ts.Diagnostics.Type_declaration_files_to_be_included_in_compilation + }, + { + name: "traceResolution", + type: "boolean", + description: ts.Diagnostics.Enable_tracing_of_the_name_resolution_process + }, + { + name: "allowJs", + type: "boolean", + description: ts.Diagnostics.Allow_javascript_files_to_be_compiled + }, + { + name: "allowSyntheticDefaultImports", + type: "boolean", + description: ts.Diagnostics.Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typechecking + }, + { + name: "noImplicitUseStrict", + type: "boolean", + description: ts.Diagnostics.Do_not_emit_use_strict_directives_in_module_output + }, + { + name: "listEmittedFiles", + type: "boolean" + }, + { + name: "lib", + type: "list", + element: { + name: "lib", + type: { + "es5": "lib.es5.d.ts", + "es6": "lib.es2015.d.ts", + "es2015": "lib.es2015.d.ts", + "es7": "lib.es2016.d.ts", + "es2016": "lib.es2016.d.ts", + "es2017": "lib.es2017.d.ts", + "dom": "lib.dom.d.ts", + "webworker": "lib.webworker.d.ts", + "scripthost": "lib.scripthost.d.ts", + "es2015.core": "lib.es2015.core.d.ts", + "es2015.collection": "lib.es2015.collection.d.ts", + "es2015.generator": "lib.es2015.generator.d.ts", + "es2015.iterable": "lib.es2015.iterable.d.ts", + "es2015.promise": "lib.es2015.promise.d.ts", + "es2015.proxy": "lib.es2015.proxy.d.ts", + "es2015.reflect": "lib.es2015.reflect.d.ts", + "es2015.symbol": "lib.es2015.symbol.d.ts", + "es2015.symbol.wellknown": "lib.es2015.symbol.wellknown.d.ts", + "es2016.array.include": "lib.es2016.array.include.d.ts", + "es2017.object": "lib.es2017.object.d.ts" + } + }, + description: ts.Diagnostics.Specify_library_files_to_be_included_in_the_compilation_Colon + }, + { + name: "strictNullChecks", + type: "boolean", + description: ts.Diagnostics.Enable_strict_null_checks + } + ]; + ts.typingOptionDeclarations = [ + { + name: "enableAutoDiscovery", + type: "boolean" + }, + { + name: "include", + type: "list", + element: { + name: "include", + type: "string" + } + }, + { + name: "exclude", + type: "list", + element: { + name: "exclude", + type: "string" + } } ]; var optionNameMapCache; @@ -3395,6 +3933,37 @@ var ts; return optionNameMapCache; } ts.getOptionNameMap = getOptionNameMap; + function createCompilerDiagnosticForInvalidCustomType(opt) { + var namesOfType = []; + ts.forEachKey(opt.type, function (key) { + namesOfType.push(" '" + key + "'"); + }); + return ts.createCompilerDiagnostic(ts.Diagnostics.Argument_for_0_option_must_be_Colon_1, "--" + opt.name, namesOfType); + } + ts.createCompilerDiagnosticForInvalidCustomType = createCompilerDiagnosticForInvalidCustomType; + function parseCustomTypeOption(opt, value, errors) { + var key = trimString((value || "")).toLowerCase(); + var map = opt.type; + if (ts.hasProperty(map, key)) { + return map[key]; + } + else { + errors.push(createCompilerDiagnosticForInvalidCustomType(opt)); + } + } + ts.parseCustomTypeOption = parseCustomTypeOption; + function parseListTypeOption(opt, value, errors) { + var values = trimString((value || "")).split(","); + switch (opt.element.type) { + case "number": + return ts.map(values, parseInt); + case "string": + return ts.map(values, function (v) { return v || ""; }); + default: + return ts.filter(ts.map(values, function (v) { return parseCustomTypeOption(opt.element, v, errors); }), function (v) { return !!v; }); + } + } + ts.parseListTypeOption = parseListTypeOption; function parseCommandLine(commandLine, readFile) { var options = {}; var fileNames = []; @@ -3409,7 +3978,8 @@ var ts; function parseStrings(args) { var i = 0; while (i < args.length) { - var s = args[i++]; + var s = args[i]; + i++; if (s.charCodeAt(0) === 64) { parseResponseFile(s.slice(1)); } @@ -3420,28 +3990,34 @@ var ts; } if (ts.hasProperty(optionNameMap, s)) { var opt = optionNameMap[s]; - if (!args[i] && opt.type !== "boolean") { - errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_expects_an_argument, opt.name)); + if (opt.isTSConfigOnly) { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_can_only_be_specified_in_tsconfig_json_file, opt.name)); } - switch (opt.type) { - case "number": - options[opt.name] = parseInt(args[i++]); - break; - case "boolean": - options[opt.name] = true; - break; - case "string": - options[opt.name] = args[i++] || ""; - break; - default: - var map_1 = opt.type; - var key = (args[i++] || "").toLowerCase(); - if (ts.hasProperty(map_1, key)) { - options[opt.name] = map_1[key]; - } - else { - errors.push(ts.createCompilerDiagnostic(opt.error)); - } + else { + if (!args[i] && opt.type !== "boolean") { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_expects_an_argument, opt.name)); + } + switch (opt.type) { + case "number": + options[opt.name] = parseInt(args[i]); + i++; + break; + case "boolean": + options[opt.name] = true; + break; + case "string": + options[opt.name] = args[i] || ""; + i++; + break; + case "list": + options[opt.name] = parseListTypeOption(opt, args[i], errors); + i++; + break; + default: + options[opt.name] = parseCustomTypeOption(opt, args[i], errors); + i++; + break; + } } } else { @@ -3527,17 +4103,26 @@ var ts; } return output; } - function parseJsonConfigFileContent(json, host, basePath) { - var _a = convertCompilerOptionsFromJson(json["compilerOptions"], basePath), options = _a.options, errors = _a.errors; + var IgnoreFileNamePattern = /(\.min\.js$)|([\\/]\.[\w.])/; + function parseJsonConfigFileContent(json, host, basePath, existingOptions, configFileName) { + if (existingOptions === void 0) { existingOptions = {}; } + var errors = []; + var compilerOptions = convertCompilerOptionsFromJsonWorker(json["compilerOptions"], basePath, errors, configFileName); + var options = ts.extend(existingOptions, compilerOptions); + var typingOptions = convertTypingOptionsFromJsonWorker(json["typingOptions"], basePath, errors, configFileName); + options.configFilePath = configFileName; + var fileNames = getFileNames(errors); return { options: options, - fileNames: getFileNames(), + fileNames: fileNames, + typingOptions: typingOptions, + raw: json, errors: errors }; - function getFileNames() { + function getFileNames(errors) { var fileNames = []; if (ts.hasProperty(json, "files")) { - if (json["files"] instanceof Array) { + if (ts.isArray(json["files"])) { fileNames = ts.map(json["files"], function (s) { return ts.combinePaths(basePath, s); }); } else { @@ -3545,73 +4130,128 @@ var ts; } } else { - var exclude = json["exclude"] instanceof Array ? ts.map(json["exclude"], ts.normalizeSlashes) : undefined; - var sysFiles = host.readDirectory(basePath, ".ts", exclude).concat(host.readDirectory(basePath, ".tsx", exclude)); - for (var i = 0; i < sysFiles.length; i++) { - var name_5 = sysFiles[i]; - if (ts.fileExtensionIs(name_5, ".d.ts")) { - var baseName = name_5.substr(0, name_5.length - ".d.ts".length); - if (!ts.contains(sysFiles, baseName + ".tsx") && !ts.contains(sysFiles, baseName + ".ts")) { - fileNames.push(name_5); + var filesSeen = {}; + var exclude = []; + if (ts.isArray(json["exclude"])) { + exclude = json["exclude"]; + } + else { + exclude = ["node_modules", "bower_components", "jspm_packages"]; + } + var outDir = json["compilerOptions"] && json["compilerOptions"]["outDir"]; + if (outDir) { + exclude.push(outDir); + } + exclude = ts.map(exclude, ts.normalizeSlashes); + var supportedExtensions = ts.getSupportedExtensions(options); + ts.Debug.assert(ts.indexOf(supportedExtensions, ".ts") < ts.indexOf(supportedExtensions, ".d.ts"), "Changed priority of extensions to pick"); + for (var _i = 0, supportedExtensions_1 = supportedExtensions; _i < supportedExtensions_1.length; _i++) { + var extension = supportedExtensions_1[_i]; + var filesInDirWithExtension = host.readDirectory(basePath, extension, exclude); + for (var _a = 0, filesInDirWithExtension_1 = filesInDirWithExtension; _a < filesInDirWithExtension_1.length; _a++) { + var fileName = filesInDirWithExtension_1[_a]; + if (extension === ".ts" && ts.fileExtensionIs(fileName, ".d.ts")) { + continue; } - } - else if (ts.fileExtensionIs(name_5, ".ts")) { - if (!ts.contains(sysFiles, name_5 + "x")) { - fileNames.push(name_5); + if (IgnoreFileNamePattern.test(fileName)) { + continue; } - } - else { - fileNames.push(name_5); + if (extension === ".d.ts" || (options.allowJs && ts.contains(ts.supportedJavascriptExtensions, extension))) { + var baseName = fileName.substr(0, fileName.length - extension.length); + if (ts.hasProperty(filesSeen, baseName + ".ts") || ts.hasProperty(filesSeen, baseName + ".tsx")) { + continue; + } + } + filesSeen[fileName] = true; + fileNames.push(fileName); } } } + if (ts.hasProperty(json, "excludes") && !ts.hasProperty(json, "exclude")) { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unknown_option_excludes_Did_you_mean_exclude)); + } return fileNames; } } ts.parseJsonConfigFileContent = parseJsonConfigFileContent; - function convertCompilerOptionsFromJson(jsonOptions, basePath) { - var options = {}; + function convertCompilerOptionsFromJson(jsonOptions, basePath, configFileName) { var errors = []; - if (!jsonOptions) { - return { options: options, errors: errors }; - } - var optionNameMap = ts.arrayToMap(ts.optionDeclarations, function (opt) { return opt.name; }); - for (var id in jsonOptions) { - if (ts.hasProperty(optionNameMap, id)) { - var opt = optionNameMap[id]; - var optType = opt.type; - var value = jsonOptions[id]; - var expectedType = typeof optType === "string" ? optType : "string"; - if (typeof value === expectedType) { - if (typeof optType !== "string") { - var key = value.toLowerCase(); - if (ts.hasProperty(optType, key)) { - value = optType[key]; - } - else { - errors.push(ts.createCompilerDiagnostic(opt.error)); - value = 0; - } - } - if (opt.isFilePath) { - value = ts.normalizePath(ts.combinePaths(basePath, value)); - if (value === "") { - value = "."; - } - } - options[opt.name] = value; - } - else { - errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, id, expectedType)); - } - } - else { - errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unknown_compiler_option_0, id)); - } - } + var options = convertCompilerOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName); return { options: options, errors: errors }; } ts.convertCompilerOptionsFromJson = convertCompilerOptionsFromJson; + function convertTypingOptionsFromJson(jsonOptions, basePath, configFileName) { + var errors = []; + var options = convertTypingOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName); + return { options: options, errors: errors }; + } + ts.convertTypingOptionsFromJson = convertTypingOptionsFromJson; + function convertCompilerOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName) { + var options = ts.getBaseFileName(configFileName) === "jsconfig.json" ? { allowJs: true } : {}; + convertOptionsFromJson(ts.optionDeclarations, jsonOptions, basePath, options, ts.Diagnostics.Unknown_compiler_option_0, errors); + return options; + } + function convertTypingOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName) { + var options = ts.getBaseFileName(configFileName) === "jsconfig.json" + ? { enableAutoDiscovery: true, include: [], exclude: [] } + : { enableAutoDiscovery: false, include: [], exclude: [] }; + convertOptionsFromJson(ts.typingOptionDeclarations, jsonOptions, basePath, options, ts.Diagnostics.Unknown_typing_option_0, errors); + return options; + } + function convertOptionsFromJson(optionDeclarations, jsonOptions, basePath, defaultOptions, diagnosticMessage, errors) { + if (!jsonOptions) { + return; + } + var optionNameMap = ts.arrayToMap(optionDeclarations, function (opt) { return opt.name; }); + for (var id in jsonOptions) { + if (ts.hasProperty(optionNameMap, id)) { + var opt = optionNameMap[id]; + defaultOptions[opt.name] = convertJsonOption(opt, jsonOptions[id], basePath, errors); + } + else { + errors.push(ts.createCompilerDiagnostic(diagnosticMessage, id)); + } + } + } + function convertJsonOption(opt, value, basePath, errors) { + var optType = opt.type; + var expectedType = typeof optType === "string" ? optType : "string"; + if (optType === "list" && ts.isArray(value)) { + return convertJsonOptionOfListType(opt, value, basePath, errors); + } + else if (typeof value === expectedType) { + if (typeof optType !== "string") { + return convertJsonOptionOfCustomType(opt, value, errors); + } + else { + if (opt.isFilePath) { + value = ts.normalizePath(ts.combinePaths(basePath, value)); + if (value === "") { + value = "."; + } + } + } + return value; + } + else { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, opt.name, expectedType)); + } + } + function convertJsonOptionOfCustomType(opt, value, errors) { + var key = value.toLowerCase(); + if (ts.hasProperty(opt.type, key)) { + return opt.type[key]; + } + else { + errors.push(createCompilerDiagnosticForInvalidCustomType(opt)); + } + } + function convertJsonOptionOfListType(option, values, basePath, errors) { + return ts.filter(ts.map(values, function (v) { return convertJsonOption(option.element, v, basePath, errors); }), function (v) { return !!v; }); + } + function trimString(s) { + return typeof s.trim === "function" ? s.trim() : s.replace(/^[\s]+|[\s]+$/g, ""); + } })(ts || (ts = {})); var ts; (function (ts) { @@ -3631,10 +4271,10 @@ var ts; var stringWriters = []; function getSingleLineStringWriter() { if (stringWriters.length === 0) { - var str = ""; - var writeText = function (text) { return str += text; }; + var str_1 = ""; + var writeText = function (text) { return str_1 += text; }; return { - string: function () { return str; }, + string: function () { return str_1; }, writeKeyword: writeText, writeOperator: writeText, writePunctuation: writeText, @@ -3642,10 +4282,10 @@ var ts; writeStringLiteral: writeText, writeParameter: writeText, writeSymbol: writeText, - writeLine: function () { return str += " "; }, + writeLine: function () { return str_1 += " "; }, increaseIndent: function () { }, decreaseIndent: function () { }, - clear: function () { return str = ""; }, + clear: function () { return str_1 = ""; }, trackSymbol: function () { }, reportInaccessibleThisError: function () { } }; @@ -3662,6 +4302,24 @@ var ts; return node.end - node.pos; } ts.getFullWidth = getFullWidth; + function mapIsEqualTo(map1, map2) { + if (!map1 || !map2) { + return map1 === map2; + } + return containsAll(map1, map2) && containsAll(map2, map1); + } + ts.mapIsEqualTo = mapIsEqualTo; + function containsAll(map, other) { + for (var key in map) { + if (!ts.hasProperty(map, key)) { + continue; + } + if (!ts.hasProperty(other, key) || map[key] !== other[key]) { + return false; + } + } + return true; + } function arrayIsEqualTo(array1, array2, equaler) { if (!array1 || !array2) { return array1 === array2; @@ -3669,7 +4327,7 @@ var ts; if (array1.length !== array2.length) { return false; } - for (var i = 0; i < array1.length; ++i) { + for (var i = 0; i < array1.length; i++) { var equals = equaler ? equaler(array1[i], array2[i]) : array1[i] === array2[i]; if (!equals) { return false; @@ -3693,28 +4351,72 @@ var ts; sourceFile.resolvedModules[moduleNameText] = resolvedModule; } ts.setResolvedModule = setResolvedModule; + function setResolvedTypeReferenceDirective(sourceFile, typeReferenceDirectiveName, resolvedTypeReferenceDirective) { + if (!sourceFile.resolvedTypeReferenceDirectiveNames) { + sourceFile.resolvedTypeReferenceDirectiveNames = {}; + } + sourceFile.resolvedTypeReferenceDirectiveNames[typeReferenceDirectiveName] = resolvedTypeReferenceDirective; + } + ts.setResolvedTypeReferenceDirective = setResolvedTypeReferenceDirective; + function moduleResolutionIsEqualTo(oldResolution, newResolution) { + return oldResolution.resolvedFileName === newResolution.resolvedFileName && oldResolution.isExternalLibraryImport === newResolution.isExternalLibraryImport; + } + ts.moduleResolutionIsEqualTo = moduleResolutionIsEqualTo; + function typeDirectiveIsEqualTo(oldResolution, newResolution) { + return oldResolution.resolvedFileName === newResolution.resolvedFileName && oldResolution.primary === newResolution.primary; + } + ts.typeDirectiveIsEqualTo = typeDirectiveIsEqualTo; + function hasChangesInResolutions(names, newResolutions, oldResolutions, comparer) { + if (names.length !== newResolutions.length) { + return false; + } + for (var i = 0; i < names.length; i++) { + var newResolution = newResolutions[i]; + var oldResolution = oldResolutions && ts.hasProperty(oldResolutions, names[i]) ? oldResolutions[names[i]] : undefined; + var changed = oldResolution + ? !newResolution || !comparer(oldResolution, newResolution) + : newResolution; + if (changed) { + return true; + } + } + return false; + } + ts.hasChangesInResolutions = hasChangesInResolutions; function containsParseError(node) { aggregateChildData(node); - return (node.parserContextFlags & 64) !== 0; + return (node.flags & 268435456) !== 0; } ts.containsParseError = containsParseError; function aggregateChildData(node) { - if (!(node.parserContextFlags & 128)) { - var thisNodeOrAnySubNodesHasError = ((node.parserContextFlags & 16) !== 0) || + if (!(node.flags & 536870912)) { + var thisNodeOrAnySubNodesHasError = ((node.flags & 67108864) !== 0) || ts.forEachChild(node, containsParseError); if (thisNodeOrAnySubNodesHasError) { - node.parserContextFlags |= 64; + node.flags |= 268435456; } - node.parserContextFlags |= 128; + node.flags |= 536870912; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 248) { + while (node && node.kind !== 256) { node = node.parent; } return node; } ts.getSourceFileOfNode = getSourceFileOfNode; + function isStatementWithLocals(node) { + switch (node.kind) { + case 199: + case 227: + case 206: + case 207: + case 208: + return true; + } + return false; + } + ts.isStatementWithLocals = isStatementWithLocals; function getStartPositionOfLine(line, sourceFile) { ts.Debug.assert(line >= 0); return ts.getLineStarts(sourceFile)[line]; @@ -3730,6 +4432,25 @@ var ts; return node.pos; } ts.getStartPosOfNode = getStartPosOfNode; + function getEndLinePosition(line, sourceFile) { + ts.Debug.assert(line >= 0); + var lineStarts = ts.getLineStarts(sourceFile); + var lineIndex = line; + var sourceText = sourceFile.text; + if (lineIndex + 1 === lineStarts.length) { + return sourceText.length - 1; + } + else { + var start = lineStarts[lineIndex]; + var pos = lineStarts[lineIndex + 1] - 1; + ts.Debug.assert(ts.isLineBreak(sourceText.charCodeAt(pos))); + while (start <= pos && ts.isLineBreak(sourceText.charCodeAt(pos))) { + pos--; + } + return pos; + } + } + ts.getEndLinePosition = getEndLinePosition; function nodeIsMissing(node) { if (!node) { return true; @@ -3789,10 +4510,39 @@ var ts; } ts.makeIdentifierFromModuleName = makeIdentifierFromModuleName; function isBlockOrCatchScoped(declaration) { - return (getCombinedNodeFlags(declaration) & 24576) !== 0 || + return (getCombinedNodeFlags(declaration) & 3072) !== 0 || isCatchClauseVariableDeclaration(declaration); } ts.isBlockOrCatchScoped = isBlockOrCatchScoped; + function isAmbientModule(node) { + return node && node.kind === 225 && + (node.name.kind === 9 || isGlobalScopeAugmentation(node)); + } + ts.isAmbientModule = isAmbientModule; + function isBlockScopedContainerTopLevel(node) { + return node.kind === 256 || + node.kind === 225 || + isFunctionLike(node) || + isFunctionBlock(node); + } + ts.isBlockScopedContainerTopLevel = isBlockScopedContainerTopLevel; + function isGlobalScopeAugmentation(module) { + return !!(module.flags & 131072); + } + ts.isGlobalScopeAugmentation = isGlobalScopeAugmentation; + function isExternalModuleAugmentation(node) { + if (!node || !isAmbientModule(node)) { + return false; + } + switch (node.parent.kind) { + case 256: + return ts.isExternalModule(node.parent); + case 226: + return isAmbientModule(node.parent.parent) && !ts.isExternalModule(node.parent.parent.parent); + } + return false; + } + ts.isExternalModuleAugmentation = isExternalModuleAugmentation; function getEnclosingBlockScopeContainer(node) { var current = node.parent; while (current) { @@ -3800,15 +4550,15 @@ var ts; return current; } switch (current.kind) { - case 248: - case 220: - case 244: - case 218: - case 199: - case 200: - case 201: + case 256: + case 227: + case 252: + case 225: + case 206: + case 207: + case 208: return current; - case 192: + case 199: if (!isFunctionLike(current.parent)) { return current; } @@ -3819,9 +4569,9 @@ var ts; ts.getEnclosingBlockScopeContainer = getEnclosingBlockScopeContainer; function isCatchClauseVariableDeclaration(declaration) { return declaration && - declaration.kind === 211 && + declaration.kind === 218 && declaration.parent && - declaration.parent.kind === 244; + declaration.parent.kind === 252; } ts.isCatchClauseVariableDeclaration = isCatchClauseVariableDeclaration; function declarationNameToString(name) { @@ -3854,27 +4604,44 @@ var ts; return ts.createTextSpanFromBounds(start, scanner.getTextPos()); } ts.getSpanOfTokenAtPosition = getSpanOfTokenAtPosition; + function getErrorSpanForArrowFunction(sourceFile, node) { + var pos = ts.skipTrivia(sourceFile.text, node.pos); + if (node.body && node.body.kind === 199) { + var startLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.pos).line; + var endLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.end).line; + if (startLine < endLine) { + return ts.createTextSpan(pos, getEndLinePosition(startLine, sourceFile) - pos + 1); + } + } + return ts.createTextSpanFromBounds(pos, node.end); + } function getErrorSpanForNode(sourceFile, node) { var errorNode = node; switch (node.kind) { - case 248: + case 256: var pos_1 = ts.skipTrivia(sourceFile.text, 0, false); if (pos_1 === sourceFile.text.length) { return ts.createTextSpan(0, 0); } return getSpanOfTokenAtPosition(sourceFile, pos_1); - case 211: - case 163: - case 214: - case 186: - case 215: case 218: - case 217: - case 247: - case 213: - case 173: + case 169: + case 221: + case 192: + case 222: + case 225: + case 224: + case 255: + case 220: + case 179: + case 147: + case 149: + case 150: + case 223: errorNode = node.name; break; + case 180: + return getErrorSpanForArrowFunction(sourceFile, node); } if (errorNode === undefined) { return getSpanOfTokenAtPosition(sourceFile, node.pos); @@ -3885,24 +4652,20 @@ var ts; return ts.createTextSpanFromBounds(pos, errorNode.end); } ts.getErrorSpanForNode = getErrorSpanForNode; - function isExternalModule(file) { - return file.externalModuleIndicator !== undefined; - } - ts.isExternalModule = isExternalModule; function isExternalOrCommonJsModule(file) { return (file.externalModuleIndicator || file.commonJsModuleIndicator) !== undefined; } ts.isExternalOrCommonJsModule = isExternalOrCommonJsModule; function isDeclarationFile(file) { - return (file.flags & 4096) !== 0; + return file.isDeclarationFile; } ts.isDeclarationFile = isDeclarationFile; function isConstEnumDeclaration(node) { - return node.kind === 217 && isConst(node); + return node.kind === 224 && isConst(node); } ts.isConstEnumDeclaration = isConstEnumDeclaration; function walkUpBindingElementsAndPatterns(node) { - while (node && (node.kind === 163 || isBindingPattern(node))) { + while (node && (node.kind === 169 || isBindingPattern(node))) { node = node.parent; } return node; @@ -3910,29 +4673,33 @@ var ts; function getCombinedNodeFlags(node) { node = walkUpBindingElementsAndPatterns(node); var flags = node.flags; - if (node.kind === 211) { + if (node.kind === 218) { node = node.parent; } - if (node && node.kind === 212) { + if (node && node.kind === 219) { flags |= node.flags; node = node.parent; } - if (node && node.kind === 193) { + if (node && node.kind === 200) { flags |= node.flags; } return flags; } ts.getCombinedNodeFlags = getCombinedNodeFlags; function isConst(node) { - return !!(getCombinedNodeFlags(node) & 16384); + return !!(getCombinedNodeFlags(node) & 2048); } ts.isConst = isConst; function isLet(node) { - return !!(getCombinedNodeFlags(node) & 8192); + return !!(getCombinedNodeFlags(node) & 1024); } ts.isLet = isLet; + function isSuperCallExpression(n) { + return n.kind === 174 && n.expression.kind === 95; + } + ts.isSuperCallExpression = isSuperCallExpression; function isPrologueDirective(node) { - return node.kind === 195 && node.expression.kind === 9; + return node.kind === 202 && node.expression.kind === 9; } ts.isPrologueDirective = isPrologueDirective; function getLeadingCommentRangesOfNode(node, sourceFileOfNode) { @@ -3948,7 +4715,7 @@ var ts; } ts.getJsDocComments = getJsDocComments; function getJsDocCommentsFromText(node, text) { - var commentRanges = (node.kind === 138 || node.kind === 137) ? + var commentRanges = (node.kind === 142 || node.kind === 141) ? ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) : getLeadingCommentRangesOfNodeFromText(node, text); return ts.filter(commentRanges, isJsDocComment); @@ -3960,71 +4727,72 @@ var ts; } ts.getJsDocCommentsFromText = getJsDocCommentsFromText; ts.fullTripleSlashReferencePathRegEx = /^(\/\/\/\s*/; + ts.fullTripleSlashReferenceTypeReferenceDirectiveRegEx = /^(\/\/\/\s*/; ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*/; function isTypeNode(node) { - if (151 <= node.kind && node.kind <= 160) { + if (154 <= node.kind && node.kind <= 166) { return true; } switch (node.kind) { case 117: - case 128: case 130: + case 132: case 120: - case 131: + case 133: + case 135: + case 127: return true; case 103: - return node.parent.kind !== 177; - case 9: - return node.parent.kind === 138; - case 188: + return node.parent.kind !== 183; + case 194: return !isExpressionWithTypeArgumentsInClassExtendsClause(node); case 69: - if (node.parent.kind === 135 && node.parent.right === node) { + if (node.parent.kind === 139 && node.parent.right === node) { node = node.parent; } - else if (node.parent.kind === 166 && node.parent.name === node) { + else if (node.parent.kind === 172 && node.parent.name === node) { node = node.parent; } - ts.Debug.assert(node.kind === 69 || node.kind === 135 || node.kind === 166, "'node' was expected to be a qualified name, identifier or property access in 'isTypeNode'."); - case 135: - case 166: + ts.Debug.assert(node.kind === 69 || node.kind === 139 || node.kind === 172, "'node' was expected to be a qualified name, identifier or property access in 'isTypeNode'."); + case 139: + case 172: case 97: var parent_1 = node.parent; - if (parent_1.kind === 154) { + if (parent_1.kind === 158) { return false; } - if (151 <= parent_1.kind && parent_1.kind <= 160) { + if (154 <= parent_1.kind && parent_1.kind <= 166) { return true; } switch (parent_1.kind) { - case 188: + case 194: return !isExpressionWithTypeArgumentsInClassExtendsClause(parent_1); - case 137: - return node === parent_1.constraint; case 141: - case 140: - case 138: - case 211: - return node === parent_1.type; - case 213: - case 173: - case 174: - case 144: - case 143: - case 142: + return node === parent_1.constraint; case 145: - case 146: + case 144: + case 142: + case 218: return node === parent_1.type; - case 147: + case 220: + case 179: + case 180: case 148: + case 147: + case 146: case 149: + case 150: return node === parent_1.type; - case 171: + case 151: + case 152: + case 153: return node === parent_1.type; - case 168: - case 169: + case 177: + return node === parent_1.type; + case 174: + case 175: return parent_1.typeArguments && ts.indexOf(parent_1.typeArguments, node) >= 0; - case 170: + case 176: return false; } } @@ -4035,23 +4803,23 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 204: + case 211: return visitor(node); - case 220: - case 192: - case 196: - case 197: - case 198: + case 227: case 199: - case 200: - case 201: + case 203: + case 204: case 205: case 206: - case 241: - case 242: case 207: - case 209: - case 244: + case 208: + case 212: + case 213: + case 249: + case 250: + case 214: + case 216: + case 252: return ts.forEachChild(node, traverse); } } @@ -4061,24 +4829,24 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 184: + case 190: visitor(node); var operand = node.expression; if (operand) { traverse(operand); } - case 217: - case 215: - case 218: - case 216: - case 214: - case 186: + case 224: + case 222: + case 225: + case 223: + case 221: + case 192: return; default: if (isFunctionLike(node)) { - var name_6 = node.name; - if (name_6 && name_6.kind === 136) { - traverse(name_6.expression); + var name_5 = node.name; + if (name_5 && name_5.kind === 140) { + traverse(name_5.expression); return; } } @@ -4092,14 +4860,14 @@ var ts; function isVariableLike(node) { if (node) { switch (node.kind) { - case 163: - case 247: - case 138: - case 245: - case 141: - case 140: - case 246: - case 211: + case 169: + case 255: + case 142: + case 253: + case 145: + case 144: + case 254: + case 218: return true; } } @@ -4107,11 +4875,11 @@ var ts; } ts.isVariableLike = isVariableLike; function isAccessor(node) { - return node && (node.kind === 145 || node.kind === 146); + return node && (node.kind === 149 || node.kind === 150); } ts.isAccessor = isAccessor; function isClassLike(node) { - return node && (node.kind === 214 || node.kind === 186); + return node && (node.kind === 221 || node.kind === 192); } ts.isClassLike = isClassLike; function isFunctionLike(node) { @@ -4120,32 +4888,32 @@ var ts; ts.isFunctionLike = isFunctionLike; function isFunctionLikeKind(kind) { switch (kind) { - case 144: - case 173: - case 213: - case 174: - case 143: - case 142: - case 145: - case 146: - case 147: case 148: + case 179: + case 220: + case 180: + case 147: + case 146: case 149: + case 150: + case 151: case 152: case 153: + case 156: + case 157: return true; } } ts.isFunctionLikeKind = isFunctionLikeKind; function introducesArgumentsExoticObject(node) { switch (node.kind) { - case 143: - case 142: - case 144: - case 145: + case 147: case 146: - case 213: - case 173: + case 148: + case 149: + case 150: + case 220: + case 179: return true; } return false; @@ -4153,26 +4921,34 @@ var ts; ts.introducesArgumentsExoticObject = introducesArgumentsExoticObject; function isIterationStatement(node, lookInLabeledStatements) { switch (node.kind) { - case 199: - case 200: - case 201: - case 197: - case 198: - return true; + case 206: case 207: + case 208: + case 204: + case 205: + return true; + case 214: return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); } return false; } ts.isIterationStatement = isIterationStatement; function isFunctionBlock(node) { - return node && node.kind === 192 && isFunctionLike(node.parent); + return node && node.kind === 199 && isFunctionLike(node.parent); } ts.isFunctionBlock = isFunctionBlock; function isObjectLiteralMethod(node) { - return node && node.kind === 143 && node.parent.kind === 165; + return node && node.kind === 147 && node.parent.kind === 171; } ts.isObjectLiteralMethod = isObjectLiteralMethod; + function isIdentifierTypePredicate(predicate) { + return predicate && predicate.kind === 1; + } + ts.isIdentifierTypePredicate = isIdentifierTypePredicate; + function isThisTypePredicate(predicate) { + return predicate && predicate.kind === 0; + } + ts.isThisTypePredicate = isThisTypePredicate; function getContainingFunction(node) { while (true) { node = node.parent; @@ -4182,6 +4958,15 @@ var ts; } } ts.getContainingFunction = getContainingFunction; + function getContainingFunctionOrModule(node) { + while (true) { + node = node.parent; + if (isFunctionLike(node) || node.kind === 225 || node.kind === 256) { + return node; + } + } + } + ts.getContainingFunctionOrModule = getContainingFunctionOrModule; function getContainingClass(node) { while (true) { node = node.parent; @@ -4198,91 +4983,95 @@ var ts; return undefined; } switch (node.kind) { - case 136: + case 140: if (isClassLike(node.parent.parent)) { return node; } node = node.parent; break; - case 139: - if (node.parent.kind === 138 && isClassElement(node.parent.parent)) { + case 143: + if (node.parent.kind === 142 && isClassElement(node.parent.parent)) { node = node.parent.parent; } else if (isClassElement(node.parent)) { node = node.parent; } break; - case 174: + case 180: if (!includeArrowFunctions) { continue; } - case 213: - case 173: - case 218: - case 141: - case 140: - case 143: - case 142: - case 144: + case 220: + case 179: + case 225: case 145: - case 146: + case 144: case 147: + case 146: case 148: case 149: - case 217: - case 248: + case 150: + case 151: + case 152: + case 153: + case 224: + case 256: return node; } } } ts.getThisContainer = getThisContainer; - function getSuperContainer(node, includeFunctions) { + function getSuperContainer(node, stopOnFunctions) { while (true) { node = node.parent; - if (!node) + if (!node) { return node; + } switch (node.kind) { - case 136: - if (isClassLike(node.parent.parent)) { - return node; - } + case 140: node = node.parent; break; - case 139: - if (node.parent.kind === 138 && isClassElement(node.parent.parent)) { + case 220: + case 179: + case 180: + if (!stopOnFunctions) { + continue; + } + case 145: + case 144: + case 147: + case 146: + case 148: + case 149: + case 150: + return node; + case 143: + if (node.parent.kind === 142 && isClassElement(node.parent.parent)) { node = node.parent.parent; } else if (isClassElement(node.parent)) { node = node.parent; } break; - case 213: - case 173: - case 174: - if (!includeFunctions) { - continue; - } - case 141: - case 140: - case 143: - case 142: - case 144: - case 145: - case 146: - return node; } } } ts.getSuperContainer = getSuperContainer; + function isSuperPropertyOrElementAccess(node) { + return (node.kind === 172 + || node.kind === 173) + && node.expression.kind === 95; + } + ts.isSuperPropertyOrElementAccess = isSuperPropertyOrElementAccess; function getEntityNameFromTypeNode(node) { if (node) { switch (node.kind) { - case 151: + case 155: return node.typeName; - case 188: + case 194: return node.expression; case 69: - case 135: + case 139: return node; } } @@ -4290,7 +5079,7 @@ var ts; } ts.getEntityNameFromTypeNode = getEntityNameFromTypeNode; function getInvokedExpression(node) { - if (node.kind === 170) { + if (node.kind === 176) { return node.tag; } return node.expression; @@ -4298,114 +5087,93 @@ var ts; ts.getInvokedExpression = getInvokedExpression; function nodeCanBeDecorated(node) { switch (node.kind) { - case 214: + case 221: return true; - case 141: - return node.parent.kind === 214; - case 138: - return node.parent.body && node.parent.parent.kind === 214; case 145: - case 146: - case 143: - return node.body && node.parent.kind === 214; + return node.parent.kind === 221; + case 149: + case 150: + case 147: + return node.body !== undefined + && node.parent.kind === 221; + case 142: + return node.parent.body !== undefined + && (node.parent.kind === 148 + || node.parent.kind === 147 + || node.parent.kind === 150) + && node.parent.parent.kind === 221; } return false; } ts.nodeCanBeDecorated = nodeCanBeDecorated; function nodeIsDecorated(node) { - switch (node.kind) { - case 214: - if (node.decorators) { - return true; - } - return false; - case 141: - case 138: - if (node.decorators) { - return true; - } - return false; - case 145: - if (node.body && node.decorators) { - return true; - } - return false; - case 143: - case 146: - if (node.body && node.decorators) { - return true; - } - return false; - } - return false; + return node.decorators !== undefined + && nodeCanBeDecorated(node); } ts.nodeIsDecorated = nodeIsDecorated; - function childIsDecorated(node) { - switch (node.kind) { - case 214: - return ts.forEach(node.members, nodeOrChildIsDecorated); - case 143: - case 146: - return ts.forEach(node.parameters, nodeIsDecorated); - } - return false; - } - ts.childIsDecorated = childIsDecorated; - function nodeOrChildIsDecorated(node) { - return nodeIsDecorated(node) || childIsDecorated(node); - } - ts.nodeOrChildIsDecorated = nodeOrChildIsDecorated; function isPropertyAccessExpression(node) { - return node.kind === 166; + return node.kind === 172; } ts.isPropertyAccessExpression = isPropertyAccessExpression; function isElementAccessExpression(node) { - return node.kind === 167; + return node.kind === 173; } ts.isElementAccessExpression = isElementAccessExpression; + function isJSXTagName(node) { + var parent = node.parent; + if (parent.kind === 243 || + parent.kind === 242 || + parent.kind === 245) { + return parent.tagName === node; + } + return false; + } + ts.isJSXTagName = isJSXTagName; function isExpression(node) { switch (node.kind) { + case 97: case 95: case 93: case 99: case 84: case 10: - case 164: - case 165: - case 166: - case 167: - case 168: - case 169: case 170: - case 189: case 171: case 172: case 173: - case 186: case 174: - case 177: case 175: case 176: + case 195: + case 177: + case 196: + case 178: case 179: + case 192: case 180: + case 183: case 181: case 182: case 185: - case 183: - case 11: + case 186: case 187: - case 233: - case 234: + case 188: + case 191: + case 189: + case 11: + case 193: + case 241: + case 242: + case 190: case 184: - case 178: return true; - case 135: - while (node.parent.kind === 135) { + case 139: + while (node.parent.kind === 139) { node = node.parent; } - return node.parent.kind === 154; + return node.parent.kind === 158 || isJSXTagName(node); case 69: - if (node.parent.kind === 154) { + if (node.parent.kind === 158 || isJSXTagName(node)) { return true; } case 8: @@ -4413,47 +5181,47 @@ var ts; case 97: var parent_2 = node.parent; switch (parent_2.kind) { - case 211: - case 138: - case 141: - case 140: - case 247: - case 245: - case 163: + case 218: + case 142: + case 145: + case 144: + case 255: + case 253: + case 169: return parent_2.initializer === node; - case 195: - case 196: - case 197: - case 198: + case 202: + case 203: case 204: case 205: - case 206: - case 241: - case 208: - case 206: + case 211: + case 212: + case 213: + case 249: + case 215: + case 213: return parent_2.expression === node; - case 199: + case 206: var forStatement = parent_2; - return (forStatement.initializer === node && forStatement.initializer.kind !== 212) || + return (forStatement.initializer === node && forStatement.initializer.kind !== 219) || forStatement.condition === node || forStatement.incrementor === node; - case 200: - case 201: + case 207: + case 208: var forInStatement = parent_2; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 212) || + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 219) || forInStatement.expression === node; - case 171: - case 189: + case 177: + case 195: return node === parent_2.expression; - case 190: + case 197: return node === parent_2.expression; - case 136: + case 140: return node === parent_2.expression; - case 139: - case 240: - case 239: + case 143: + case 248: + case 247: return true; - case 188: + case 194: return parent_2.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent_2); default: if (isExpression(parent_2)) { @@ -4475,7 +5243,7 @@ var ts; } ts.isInstantiatedModule = isInstantiatedModule; function isExternalModuleImportEqualsDeclaration(node) { - return node.kind === 221 && node.moduleReference.kind === 232; + return node.kind === 229 && node.moduleReference.kind === 240; } ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration; function getExternalModuleImportEqualsDeclarationExpression(node) { @@ -4484,7 +5252,7 @@ var ts; } ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression; function isInternalModuleImportEqualsDeclaration(node) { - return node.kind === 221 && node.moduleReference.kind !== 232; + return node.kind === 229 && node.moduleReference.kind !== 240; } ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration; function isSourceFileJavaScript(file) { @@ -4492,61 +5260,88 @@ var ts; } ts.isSourceFileJavaScript = isSourceFileJavaScript; function isInJavaScriptFile(node) { - return node && !!(node.parserContextFlags & 32); + return node && !!(node.flags & 134217728); } ts.isInJavaScriptFile = isInJavaScriptFile; - function isRequireCall(expression) { - return expression.kind === 168 && + function isRequireCall(expression, checkArgumentIsStringLiteral) { + var isRequire = expression.kind === 174 && expression.expression.kind === 69 && expression.expression.text === "require" && - expression.arguments.length === 1 && - expression.arguments[0].kind === 9; + expression.arguments.length === 1; + return isRequire && (!checkArgumentIsStringLiteral || expression.arguments[0].kind === 9); } ts.isRequireCall = isRequireCall; - function isExportsPropertyAssignment(expression) { - return isInJavaScriptFile(expression) && - (expression.kind === 181) && - (expression.operatorToken.kind === 56) && - (expression.left.kind === 166) && - (expression.left.expression.kind === 69) && - ((expression.left.expression).text === "exports"); + function isSingleOrDoubleQuote(charCode) { + return charCode === 39 || charCode === 34; } - ts.isExportsPropertyAssignment = isExportsPropertyAssignment; - function isModuleExportsAssignment(expression) { - return isInJavaScriptFile(expression) && - (expression.kind === 181) && - (expression.operatorToken.kind === 56) && - (expression.left.kind === 166) && - (expression.left.expression.kind === 69) && - ((expression.left.expression).text === "module") && - (expression.left.name.text === "exports"); + ts.isSingleOrDoubleQuote = isSingleOrDoubleQuote; + function getSpecialPropertyAssignmentKind(expression) { + if (!isInJavaScriptFile(expression)) { + return 0; + } + if (expression.kind !== 187) { + return 0; + } + var expr = expression; + if (expr.operatorToken.kind !== 56 || expr.left.kind !== 172) { + return 0; + } + var lhs = expr.left; + if (lhs.expression.kind === 69) { + var lhsId = lhs.expression; + if (lhsId.text === "exports") { + return 1; + } + else if (lhsId.text === "module" && lhs.name.text === "exports") { + return 2; + } + } + else if (lhs.expression.kind === 97) { + return 4; + } + else if (lhs.expression.kind === 172) { + var innerPropertyAccess = lhs.expression; + if (innerPropertyAccess.expression.kind === 69) { + var innerPropertyAccessIdentifier = innerPropertyAccess.expression; + if (innerPropertyAccessIdentifier.text === "module" && innerPropertyAccess.name.text === "exports") { + return 1; + } + if (innerPropertyAccess.name.text === "prototype") { + return 3; + } + } + } + return 0; } - ts.isModuleExportsAssignment = isModuleExportsAssignment; + ts.getSpecialPropertyAssignmentKind = getSpecialPropertyAssignmentKind; function getExternalModuleName(node) { - if (node.kind === 222) { + if (node.kind === 230) { return node.moduleSpecifier; } - if (node.kind === 221) { + if (node.kind === 229) { var reference = node.moduleReference; - if (reference.kind === 232) { + if (reference.kind === 240) { return reference.expression; } } - if (node.kind === 228) { + if (node.kind === 236) { return node.moduleSpecifier; } + if (node.kind === 225 && node.name.kind === 9) { + return node.name; + } } ts.getExternalModuleName = getExternalModuleName; function hasQuestionToken(node) { if (node) { switch (node.kind) { - case 138: - case 143: case 142: - case 246: - case 245: - case 141: - case 140: + case 147: + case 146: + case 254: + case 253: + case 145: + case 144: return node.questionToken !== undefined; } } @@ -4554,71 +5349,110 @@ var ts; } ts.hasQuestionToken = hasQuestionToken; function isJSDocConstructSignature(node) { - return node.kind === 261 && + return node.kind === 269 && node.parameters.length > 0 && - node.parameters[0].type.kind === 263; + node.parameters[0].type.kind === 271; } ts.isJSDocConstructSignature = isJSDocConstructSignature; - function getJSDocTag(node, kind) { - if (node && node.jsDocComment) { - for (var _i = 0, _a = node.jsDocComment.tags; _i < _a.length; _i++) { - var tag = _a[_i]; - if (tag.kind === kind) { - return tag; - } + function getJSDocTag(node, kind, checkParentVariableStatement) { + if (!node) { + return undefined; + } + var jsDocComment = getJSDocComment(node, checkParentVariableStatement); + if (!jsDocComment) { + return undefined; + } + for (var _i = 0, _a = jsDocComment.tags; _i < _a.length; _i++) { + var tag = _a[_i]; + if (tag.kind === kind) { + return tag; } } } + function getJSDocComment(node, checkParentVariableStatement) { + if (node.jsDocComment) { + return node.jsDocComment; + } + if (checkParentVariableStatement) { + var isInitializerOfVariableDeclarationInStatement = node.parent.kind === 218 && + node.parent.initializer === node && + node.parent.parent.parent.kind === 200; + var variableStatementNode = isInitializerOfVariableDeclarationInStatement ? node.parent.parent.parent : undefined; + if (variableStatementNode) { + return variableStatementNode.jsDocComment; + } + var parent_3 = node.parent; + var isSourceOfAssignmentExpressionStatement = parent_3 && parent_3.parent && + parent_3.kind === 187 && + parent_3.operatorToken.kind === 56 && + parent_3.parent.kind === 202; + if (isSourceOfAssignmentExpressionStatement) { + return parent_3.parent.jsDocComment; + } + var isPropertyAssignmentExpression = parent_3 && parent_3.kind === 253; + if (isPropertyAssignmentExpression) { + return parent_3.jsDocComment; + } + } + return undefined; + } function getJSDocTypeTag(node) { - return getJSDocTag(node, 269); + return getJSDocTag(node, 277, false); } ts.getJSDocTypeTag = getJSDocTypeTag; function getJSDocReturnTag(node) { - return getJSDocTag(node, 268); + return getJSDocTag(node, 276, true); } ts.getJSDocReturnTag = getJSDocReturnTag; function getJSDocTemplateTag(node) { - return getJSDocTag(node, 270); + return getJSDocTag(node, 278, false); } ts.getJSDocTemplateTag = getJSDocTemplateTag; function getCorrespondingJSDocParameterTag(parameter) { if (parameter.name && parameter.name.kind === 69) { var parameterName = parameter.name.text; - var docComment = parameter.parent.jsDocComment; - if (docComment) { - return ts.forEach(docComment.tags, function (t) { - if (t.kind === 267) { - var parameterTag = t; - var name_7 = parameterTag.preParameterName || parameterTag.postParameterName; - if (name_7.text === parameterName) { - return t; + var jsDocComment = getJSDocComment(parameter.parent, true); + if (jsDocComment) { + for (var _i = 0, _a = jsDocComment.tags; _i < _a.length; _i++) { + var tag = _a[_i]; + if (tag.kind === 275) { + var parameterTag = tag; + var name_6 = parameterTag.preParameterName || parameterTag.postParameterName; + if (name_6.text === parameterName) { + return parameterTag; } } - }); + } } } + return undefined; } ts.getCorrespondingJSDocParameterTag = getCorrespondingJSDocParameterTag; function hasRestParameter(s) { return isRestParameter(ts.lastOrUndefined(s.parameters)); } ts.hasRestParameter = hasRestParameter; + function hasDeclaredRestParameter(s) { + return isDeclaredRestParam(ts.lastOrUndefined(s.parameters)); + } + ts.hasDeclaredRestParameter = hasDeclaredRestParameter; function isRestParameter(node) { - if (node) { - if (node.parserContextFlags & 32) { - if (node.type && node.type.kind === 262) { - return true; - } - var paramTag = getCorrespondingJSDocParameterTag(node); - if (paramTag && paramTag.typeExpression) { - return paramTag.typeExpression.type.kind === 262; - } + if (node && (node.flags & 134217728)) { + if (node.type && node.type.kind === 270) { + return true; + } + var paramTag = getCorrespondingJSDocParameterTag(node); + if (paramTag && paramTag.typeExpression) { + return paramTag.typeExpression.type.kind === 270; } - return node.dotDotDotToken !== undefined; } - return false; + return isDeclaredRestParam(node); } ts.isRestParameter = isRestParameter; + function isDeclaredRestParam(node) { + return node && node.dotDotDotToken !== undefined; + } + ts.isDeclaredRestParam = isDeclaredRestParam; function isLiteralKind(kind) { return 8 <= kind && kind <= 11; } @@ -4632,9 +5466,31 @@ var ts; } ts.isTemplateLiteralKind = isTemplateLiteralKind; function isBindingPattern(node) { - return !!node && (node.kind === 162 || node.kind === 161); + return !!node && (node.kind === 168 || node.kind === 167); } ts.isBindingPattern = isBindingPattern; + function isAssignmentTarget(node) { + while (node.parent.kind === 178) { + node = node.parent; + } + while (true) { + var parent_4 = node.parent; + if (parent_4.kind === 170 || parent_4.kind === 191) { + node = parent_4; + continue; + } + if (parent_4.kind === 253 || parent_4.kind === 254) { + node = parent_4.parent; + continue; + } + return parent_4.kind === 187 && + parent_4.operatorToken.kind === 56 && + parent_4.left === node || + (parent_4.kind === 207 || parent_4.kind === 208) && + parent_4.initializer === node; + } + } + ts.isAssignmentTarget = isAssignmentTarget; function isNodeDescendentOf(node, ancestor) { while (node) { if (node === ancestor) @@ -4646,7 +5502,7 @@ var ts; ts.isNodeDescendentOf = isNodeDescendentOf; function isInAmbientContext(node) { while (node) { - if (node.flags & (4 | 4096)) { + if (node.flags & 2 || (node.kind === 256 && node.isDeclarationFile)) { return true; } node = node.parent; @@ -4656,34 +5512,34 @@ var ts; ts.isInAmbientContext = isInAmbientContext; function isDeclaration(node) { switch (node.kind) { - case 174: - case 163: - case 214: - case 186: - case 144: - case 217: - case 247: - case 230: - case 213: - case 173: - case 145: - case 223: + case 180: + case 169: case 221: - case 226: - case 215: - case 143: - case 142: - case 218: + case 192: + case 148: case 224: - case 138: - case 245: - case 141: - case 140: + case 255: + case 238: + case 220: + case 179: + case 149: + case 231: + case 229: + case 234: + case 222: + case 147: case 146: - case 246: - case 216: - case 137: - case 211: + case 225: + case 232: + case 142: + case 253: + case 145: + case 144: + case 150: + case 254: + case 223: + case 141: + case 218: return true; } return false; @@ -4691,25 +5547,25 @@ var ts; ts.isDeclaration = isDeclaration; function isStatement(n) { switch (n.kind) { - case 203: - case 202: case 210: - case 197: - case 195: - case 194: - case 200: - case 201: - case 199: - case 196: - case 207: - case 204: - case 206: - case 208: case 209: - case 193: - case 198: + case 217: + case 204: + case 202: + case 201: + case 207: + case 208: + case 206: + case 203: + case 214: + case 211: + case 213: + case 215: + case 216: + case 200: case 205: - case 227: + case 212: + case 235: return true; default: return false; @@ -4718,13 +5574,13 @@ var ts; ts.isStatement = isStatement; function isClassElement(n) { switch (n.kind) { - case 144: - case 141: - case 143: + case 148: case 145: - case 146: - case 142: + case 147: case 149: + case 150: + case 146: + case 153: return true; default: return false; @@ -4736,7 +5592,7 @@ var ts; return false; } var parent = name.parent; - if (parent.kind === 226 || parent.kind === 230) { + if (parent.kind === 234 || parent.kind === 238) { if (parent.propertyName) { return true; } @@ -4747,43 +5603,50 @@ var ts; return false; } ts.isDeclarationName = isDeclarationName; + function isLiteralComputedPropertyDeclarationName(node) { + return (node.kind === 9 || node.kind === 8) && + node.parent.kind === 140 && + isDeclaration(node.parent.parent); + } + ts.isLiteralComputedPropertyDeclarationName = isLiteralComputedPropertyDeclarationName; function isIdentifierName(node) { var parent = node.parent; switch (parent.kind) { - case 141: - case 140: - case 143: - case 142: case 145: + case 144: + case 147: case 146: - case 247: - case 245: - case 166: + case 149: + case 150: + case 255: + case 253: + case 172: return parent.name === node; - case 135: + case 139: if (parent.right === node) { - while (parent.kind === 135) { + while (parent.kind === 139) { parent = parent.parent; } - return parent.kind === 154; + return parent.kind === 158; } return false; - case 163: - case 226: + case 169: + case 234: return parent.propertyName === node; - case 230: + case 238: return true; } return false; } ts.isIdentifierName = isIdentifierName; function isAliasSymbolDeclaration(node) { - return node.kind === 221 || - node.kind === 223 && !!node.name || - node.kind === 224 || - node.kind === 226 || - node.kind === 230 || - node.kind === 227 && node.expression.kind === 69; + return node.kind === 229 || + node.kind === 228 || + node.kind === 231 && !!node.name || + node.kind === 232 || + node.kind === 234 || + node.kind === 238 || + node.kind === 235 && node.expression.kind === 69; } ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration; function getClassExtendsHeritageClauseElement(node) { @@ -4840,32 +5703,32 @@ var ts; }; } else { - var matchResult = ts.fullTripleSlashReferencePathRegEx.exec(comment); - if (matchResult) { + var refMatchResult = ts.fullTripleSlashReferencePathRegEx.exec(comment); + var refLibResult = !refMatchResult && ts.fullTripleSlashReferenceTypeReferenceDirectiveRegEx.exec(comment); + if (refMatchResult || refLibResult) { var start = commentRange.pos; var end = commentRange.end; return { fileReference: { pos: start, end: end, - fileName: matchResult[3] + fileName: (refMatchResult || refLibResult)[3] }, - isNoDefaultLib: false - }; - } - else { - return { - diagnosticMessage: ts.Diagnostics.Invalid_reference_directive_syntax, - isNoDefaultLib: false + isNoDefaultLib: false, + isTypeReferenceDirective: !!refLibResult }; } + return { + diagnosticMessage: ts.Diagnostics.Invalid_reference_directive_syntax, + isNoDefaultLib: false + }; } } return undefined; } ts.getFileReferenceFromReferencePath = getFileReferenceFromReferencePath; function isKeyword(token) { - return 70 <= token && token <= 134; + return 70 <= token && token <= 138; } ts.isKeyword = isKeyword; function isTrivia(token) { @@ -4885,7 +5748,7 @@ var ts; } ts.hasDynamicName = hasDynamicName; function isDynamicName(name) { - return name.kind === 136 && + return name.kind === 140 && !isStringOrNumericLiteral(name.expression.kind) && !isWellKnownSymbolSyntactically(name.expression); } @@ -4898,12 +5761,15 @@ var ts; if (name.kind === 69 || name.kind === 9 || name.kind === 8) { return name.text; } - if (name.kind === 136) { + if (name.kind === 140) { var nameExpression = name.expression; if (isWellKnownSymbolSyntactically(nameExpression)) { var rightHandSideName = nameExpression.name.text; return getPropertyNameForKnownSymbolName(rightHandSideName); } + else if (nameExpression.kind === 9 || nameExpression.kind === 8) { + return nameExpression.text; + } } return undefined; } @@ -4916,7 +5782,7 @@ var ts; return node.kind === 69 && node.text === "Symbol"; } ts.isESSymbolIdentifier = isESSymbolIdentifier; - function isModifier(token) { + function isModifierKind(token) { switch (token) { case 115: case 118: @@ -4927,44 +5793,62 @@ var ts; case 112: case 110: case 111: + case 128: case 113: return true; } return false; } - ts.isModifier = isModifier; + ts.isModifierKind = isModifierKind; function isParameterDeclaration(node) { var root = getRootDeclaration(node); - return root.kind === 138; + return root.kind === 142; } ts.isParameterDeclaration = isParameterDeclaration; function getRootDeclaration(node) { - while (node.kind === 163) { + while (node.kind === 169) { node = node.parent.parent; } return node; } ts.getRootDeclaration = getRootDeclaration; function nodeStartsNewLexicalEnvironment(n) { - return isFunctionLike(n) || n.kind === 218 || n.kind === 248; + return isFunctionLike(n) || n.kind === 225 || n.kind === 256; } ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; - function cloneEntityName(node) { - if (node.kind === 69) { - var clone_1 = createSynthesizedNode(69); - clone_1.text = node.text; - return clone_1; + function cloneNode(node, location, flags, parent) { + var clone = location !== undefined + ? ts.createNode(node.kind, location.pos, location.end) + : createSynthesizedNode(node.kind); + for (var key in node) { + if (clone.hasOwnProperty(key) || !node.hasOwnProperty(key)) { + continue; + } + clone[key] = node[key]; } - else { - var clone_2 = createSynthesizedNode(135); - clone_2.left = cloneEntityName(node.left); - clone_2.left.parent = clone_2; - clone_2.right = cloneEntityName(node.right); - clone_2.right.parent = clone_2; - return clone_2; + if (flags !== undefined) { + clone.flags = flags; } + if (parent !== undefined) { + clone.parent = parent; + } + return clone; + } + ts.cloneNode = cloneNode; + function cloneEntityName(node, parent) { + var clone = cloneNode(node, node, node.flags, parent); + if (isQualifiedName(clone)) { + var left = clone.left, right = clone.right; + clone.left = cloneEntityName(left, clone); + clone.right = cloneNode(right, right, right.flags, parent); + } + return clone; } ts.cloneEntityName = cloneEntityName; + function isQualifiedName(node) { + return node.kind === 139; + } + ts.isQualifiedName = isQualifiedName; function nodeIsSynthesized(node) { return node.pos === -1; } @@ -5167,8 +6051,8 @@ var ts; writeTextOfNode: writeTextOfNode, writeLiteral: writeLiteral, writeLine: writeLine, - increaseIndent: function () { return indent++; }, - decreaseIndent: function () { return indent--; }, + increaseIndent: function () { indent++; }, + decreaseIndent: function () { indent--; }, getIndent: function () { return indent; }, getTextPos: function () { return output.length; }, getLine: function () { return lineCount + 1; }, @@ -5179,8 +6063,10 @@ var ts; } ts.createTextWriter = createTextWriter; function getExternalModuleNameFromPath(host, fileName) { - var dir = host.getCurrentDirectory(); - var relativePath = ts.getRelativePathToDirectoryOrUrl(dir, fileName, dir, function (f) { return host.getCanonicalFileName(f); }, false); + var getCanonicalFileName = function (f) { return host.getCanonicalFileName(f); }; + var dir = ts.toPath(host.getCommonSourceDirectory(), host.getCurrentDirectory(), getCanonicalFileName); + var filePath = ts.getNormalizedAbsolutePath(fileName, host.getCurrentDirectory()); + var relativePath = ts.getRelativePathToDirectoryOrUrl(dir, filePath, dir, getCanonicalFileName, false); return ts.removeFileExtension(relativePath); } ts.getExternalModuleNameFromPath = getExternalModuleNameFromPath; @@ -5196,16 +6082,91 @@ var ts; return emitOutputFilePathWithoutExtension + extension; } ts.getOwnEmitOutputFilePath = getOwnEmitOutputFilePath; + function getDeclarationEmitOutputFilePath(sourceFile, host) { + var options = host.getCompilerOptions(); + var outputDir = options.declarationDir || options.outDir; + if (options.declaration) { + var path = outputDir + ? getSourceFilePathInNewDir(sourceFile, host, outputDir) + : sourceFile.fileName; + return ts.removeFileExtension(path) + ".d.ts"; + } + } + ts.getDeclarationEmitOutputFilePath = getDeclarationEmitOutputFilePath; + function getEmitScriptTarget(compilerOptions) { + return compilerOptions.target || 0; + } + ts.getEmitScriptTarget = getEmitScriptTarget; + function getEmitModuleKind(compilerOptions) { + return typeof compilerOptions.module === "number" ? + compilerOptions.module : + getEmitScriptTarget(compilerOptions) === 2 ? ts.ModuleKind.ES6 : ts.ModuleKind.CommonJS; + } + ts.getEmitModuleKind = getEmitModuleKind; + function forEachExpectedEmitFile(host, action, targetSourceFile) { + var options = host.getCompilerOptions(); + if (options.outFile || options.out) { + onBundledEmit(host); + } + else { + var sourceFiles = targetSourceFile === undefined ? host.getSourceFiles() : [targetSourceFile]; + for (var _i = 0, sourceFiles_1 = sourceFiles; _i < sourceFiles_1.length; _i++) { + var sourceFile = sourceFiles_1[_i]; + if (!isDeclarationFile(sourceFile)) { + onSingleFileEmit(host, sourceFile); + } + } + } + function onSingleFileEmit(host, sourceFile) { + var extension = ".js"; + if (options.jsx === 1) { + if (isSourceFileJavaScript(sourceFile)) { + if (ts.fileExtensionIs(sourceFile.fileName, ".jsx")) { + extension = ".jsx"; + } + } + else if (sourceFile.languageVariant === 1) { + extension = ".jsx"; + } + } + var jsFilePath = getOwnEmitOutputFilePath(sourceFile, host, extension); + var emitFileNames = { + jsFilePath: jsFilePath, + sourceMapFilePath: getSourceMapFilePath(jsFilePath, options), + declarationFilePath: !isSourceFileJavaScript(sourceFile) ? getDeclarationEmitOutputFilePath(sourceFile, host) : undefined + }; + action(emitFileNames, [sourceFile], false); + } + function onBundledEmit(host) { + var bundledSources = ts.filter(host.getSourceFiles(), function (sourceFile) { + return !isDeclarationFile(sourceFile) + && (!ts.isExternalModule(sourceFile) || !!getEmitModuleKind(options)); + }); + if (bundledSources.length) { + var jsFilePath = options.outFile || options.out; + var emitFileNames = { + jsFilePath: jsFilePath, + sourceMapFilePath: getSourceMapFilePath(jsFilePath, options), + declarationFilePath: options.declaration ? ts.removeFileExtension(jsFilePath) + ".d.ts" : undefined + }; + action(emitFileNames, bundledSources, true); + } + } + function getSourceMapFilePath(jsFilePath, options) { + return options.sourceMap ? jsFilePath + ".map" : undefined; + } + } + ts.forEachExpectedEmitFile = forEachExpectedEmitFile; function getSourceFilePathInNewDir(sourceFile, host, newDirPath) { var sourceFilePath = ts.getNormalizedAbsolutePath(sourceFile.fileName, host.getCurrentDirectory()); sourceFilePath = sourceFilePath.replace(host.getCommonSourceDirectory(), ""); return ts.combinePaths(newDirPath, sourceFilePath); } ts.getSourceFilePathInNewDir = getSourceFilePathInNewDir; - function writeFile(host, diagnostics, fileName, data, writeByteOrderMark) { + function writeFile(host, diagnostics, fileName, data, writeByteOrderMark, sourceFiles) { host.writeFile(fileName, data, writeByteOrderMark, function (hostErrorMessage) { - diagnostics.push(ts.createCompilerDiagnostic(ts.Diagnostics.Could_not_write_file_0_Colon_1, fileName, hostErrorMessage)); - }); + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Could_not_write_file_0_Colon_1, fileName, hostErrorMessage)); + }, sourceFiles); } ts.writeFile = writeFile; function getLineOfLocalPosition(currentSourceFile, pos) { @@ -5218,26 +6179,21 @@ var ts; ts.getLineOfLocalPositionFromLineMap = getLineOfLocalPositionFromLineMap; function getFirstConstructorWithBody(node) { return ts.forEach(node.members, function (member) { - if (member.kind === 144 && nodeIsPresent(member.body)) { + if (member.kind === 148 && nodeIsPresent(member.body)) { return member; } }); } ts.getFirstConstructorWithBody = getFirstConstructorWithBody; function getSetAccessorTypeAnnotationNode(accessor) { - return accessor && accessor.parameters.length > 0 && accessor.parameters[0].type; + if (accessor && accessor.parameters.length > 0) { + var hasThis = accessor.parameters.length === 2 && + accessor.parameters[0].name.kind === 69 && + accessor.parameters[0].name.originalKeywordKind === 97; + return accessor.parameters[hasThis ? 1 : 0].type; + } } ts.getSetAccessorTypeAnnotationNode = getSetAccessorTypeAnnotationNode; - function shouldEmitToOwnFile(sourceFile, compilerOptions) { - if (!isDeclarationFile(sourceFile)) { - if ((isExternalModule(sourceFile) || !(compilerOptions.outFile || compilerOptions.out))) { - return compilerOptions.isolatedModules || !ts.fileExtensionIs(sourceFile.fileName, ".js"); - } - return false; - } - return false; - } - ts.shouldEmitToOwnFile = shouldEmitToOwnFile; function getAllAccessorDeclarations(declarations, accessor) { var firstAccessor; var secondAccessor; @@ -5245,10 +6201,10 @@ var ts; var setAccessor; if (hasDynamicName(accessor)) { firstAccessor = accessor; - if (accessor.kind === 145) { + if (accessor.kind === 149) { getAccessor = accessor; } - else if (accessor.kind === 146) { + else if (accessor.kind === 150) { setAccessor = accessor; } else { @@ -5257,8 +6213,8 @@ var ts; } else { ts.forEach(declarations, function (member) { - if ((member.kind === 145 || member.kind === 146) - && (member.flags & 64) === (accessor.flags & 64)) { + if ((member.kind === 149 || member.kind === 150) + && (member.flags & 32) === (accessor.flags & 32)) { var memberName = getPropertyNameForPropertyNameNode(member.name); var accessorName = getPropertyNameForPropertyNameNode(accessor.name); if (memberName === accessorName) { @@ -5268,10 +6224,10 @@ var ts; else if (!secondAccessor) { secondAccessor = member; } - if (member.kind === 145 && !getAccessor) { + if (member.kind === 149 && !getAccessor) { getAccessor = member; } - if (member.kind === 146 && !setAccessor) { + if (member.kind === 150 && !setAccessor) { setAccessor = member; } } @@ -5326,7 +6282,7 @@ var ts; } if (leadingComments) { var detachedComments = []; - var lastComment; + var lastComment = void 0; for (var _i = 0, leadingComments_1 = leadingComments; _i < leadingComments_1.length; _i++) { var comment = leadingComments_1[_i]; if (lastComment) { @@ -5360,7 +6316,7 @@ var ts; if (text.charCodeAt(comment.pos + 1) === 42) { var firstCommentLineAndCharacter = ts.computeLineAndCharacterOfPosition(lineMap, comment.pos); var lineCount = lineMap.length; - var firstCommentLineIndent; + var firstCommentLineIndent = void 0; for (var pos = comment.pos, currentLine = firstCommentLineAndCharacter.line; pos < comment.end; currentLine++) { var nextLineStart = (currentLine + 1) === lineCount ? text.length + 1 @@ -5420,16 +6376,17 @@ var ts; } function modifierToFlag(token) { switch (token) { - case 113: return 64; - case 112: return 8; - case 111: return 32; - case 110: return 16; + case 113: return 32; + case 112: return 4; + case 111: return 16; + case 110: return 8; case 115: return 128; - case 82: return 2; - case 122: return 4; - case 74: return 16384; + case 82: return 1; + case 122: return 2; + case 74: return 2048; case 77: return 512; case 118: return 256; + case 128: return 64; } return 0; } @@ -5437,24 +6394,25 @@ var ts; function isLeftHandSideExpression(expr) { if (expr) { switch (expr.kind) { - case 166: - case 167: - case 169: - case 168: - case 233: - case 234: - case 170: - case 164: case 172: - case 165: - case 186: case 173: + case 175: + case 174: + case 196: + case 241: + case 242: + case 176: + case 170: + case 178: + case 171: + case 192: + case 179: case 69: case 10: case 8: case 9: case 11: - case 183: + case 189: case 84: case 93: case 97: @@ -5471,7 +6429,7 @@ var ts; } ts.isAssignmentOperator = isAssignmentOperator; function isExpressionWithTypeArgumentsInClassExtendsClause(node) { - return node.kind === 188 && + return node.kind === 194 && node.parent.token === 83 && isClassLike(node.parent.parent); } @@ -5492,16 +6450,16 @@ var ts; } } function isRightSideOfQualifiedNameOrPropertyAccess(node) { - return (node.parent.kind === 135 && node.parent.right === node) || - (node.parent.kind === 166 && node.parent.name === node); + return (node.parent.kind === 139 && node.parent.right === node) || + (node.parent.kind === 172 && node.parent.name === node); } ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess; function isEmptyObjectLiteralOrArrayLiteral(expression) { var kind = expression.kind; - if (kind === 165) { + if (kind === 171) { return expression.properties.length === 0; } - if (kind === 164) { + if (kind === 170) { return expression.elements.length === 0; } return false; @@ -5512,13 +6470,9 @@ var ts; } ts.getLocalSymbolForExportDefault = getLocalSymbolForExportDefault; function hasJavaScriptFileExtension(fileName) { - return ts.fileExtensionIs(fileName, ".js") || ts.fileExtensionIs(fileName, ".jsx"); + return ts.forEach(ts.supportedJavascriptExtensions, function (extension) { return ts.fileExtensionIs(fileName, extension); }); } ts.hasJavaScriptFileExtension = hasJavaScriptFileExtension; - function allowsJsxExpressions(fileName) { - return ts.fileExtensionIs(fileName, ".tsx") || ts.fileExtensionIs(fileName, ".jsx"); - } - ts.allowsJsxExpressions = allowsJsxExpressions; function getExpandedCharCodes(input) { var output = []; var length = input.length; @@ -5548,6 +6502,39 @@ var ts; } return output; } + ts.stringify = typeof JSON !== "undefined" && JSON.stringify + ? JSON.stringify + : stringifyFallback; + function stringifyFallback(value) { + return value === undefined ? undefined : stringifyValue(value); + } + function stringifyValue(value) { + return typeof value === "string" ? "\"" + escapeString(value) + "\"" + : typeof value === "number" ? isFinite(value) ? String(value) : "null" + : typeof value === "boolean" ? value ? "true" : "false" + : typeof value === "object" && value ? ts.isArray(value) ? cycleCheck(stringifyArray, value) : cycleCheck(stringifyObject, value) + : "null"; + } + function cycleCheck(cb, value) { + ts.Debug.assert(!value.hasOwnProperty("__cycle"), "Converting circular structure to JSON"); + value.__cycle = true; + var result = cb(value); + delete value.__cycle; + return result; + } + function stringifyArray(value) { + return "[" + ts.reduceLeft(value, stringifyElement, "") + "]"; + } + function stringifyElement(memo, value) { + return (memo ? memo + "," : memo) + stringifyValue(value); + } + function stringifyObject(value) { + return "{" + ts.reduceProperties(value, stringifyProperty, "") + "}"; + } + function stringifyProperty(memo, value, key) { + return value === undefined || typeof value === "function" || key === "__cycle" ? memo + : (memo ? memo + "," : memo) + ("\"" + escapeString(key) + "\":" + stringifyValue(value)); + } var base64Digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; function convertToBase64(input) { var result = ""; @@ -5593,6 +6580,10 @@ var ts; return carriageReturnLineFeed; } ts.getNewLineCharacter = getNewLineCharacter; + function isWatchSet(options) { + return options.watch && options.hasOwnProperty("watch"); + } + ts.isWatchSet = isWatchSet; })(ts || (ts = {})); var ts; (function (ts) { @@ -5716,15 +6707,28 @@ var ts; } ts.collapseTextChangeRangesAcrossMultipleVersions = collapseTextChangeRangesAcrossMultipleVersions; function getTypeParameterOwner(d) { - if (d && d.kind === 137) { + if (d && d.kind === 141) { for (var current = d; current; current = current.parent) { - if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 215) { + if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 222) { return current; } } } } ts.getTypeParameterOwner = getTypeParameterOwner; + function isParameterPropertyDeclaration(node) { + return node.flags & 92 && node.parent.kind === 148 && ts.isClassLike(node.parent.parent); + } + ts.isParameterPropertyDeclaration = isParameterPropertyDeclaration; + function startsWith(str, prefix) { + return str.lastIndexOf(prefix, 0) === 0; + } + ts.startsWith = startsWith; + function endsWith(str, suffix) { + var expectedPos = str.length - suffix.length; + return str.indexOf(suffix, expectedPos) === expectedPos; + } + ts.endsWith = endsWith; })(ts || (ts = {})); var ts; (function (ts) { @@ -5732,7 +6736,7 @@ var ts; var NodeConstructor; var SourceFileConstructor; function createNode(kind, pos, end) { - if (kind === 248) { + if (kind === 256) { return new (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor()))(kind, pos, end); } else { @@ -5768,26 +6772,26 @@ var ts; var visitNodes = cbNodeArray ? visitNodeArray : visitEachNode; var cbNodes = cbNodeArray || cbNode; switch (node.kind) { - case 135: + case 139: return visitNode(cbNode, node.left) || visitNode(cbNode, node.right); - case 137: + case 141: return visitNode(cbNode, node.name) || visitNode(cbNode, node.constraint) || visitNode(cbNode, node.expression); - case 246: + case 254: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.equalsToken) || visitNode(cbNode, node.objectAssignmentInitializer); - case 138: - case 141: - case 140: - case 245: - case 211: - case 163: + case 142: + case 145: + case 144: + case 253: + case 218: + case 169: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.propertyName) || @@ -5796,24 +6800,24 @@ var ts; visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.type) || visitNode(cbNode, node.initializer); + case 156: + case 157: + case 151: case 152: case 153: - case 147: - case 148: - case 149: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type); - case 143: - case 142: - case 144: - case 145: + case 147: case 146: - case 173: - case 213: - case 174: + case 148: + case 149: + case 150: + case 179: + case 220: + case 180: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.asteriskToken) || @@ -5824,302 +6828,310 @@ var ts; visitNode(cbNode, node.type) || visitNode(cbNode, node.equalsGreaterThanToken) || visitNode(cbNode, node.body); - case 151: + case 155: return visitNode(cbNode, node.typeName) || visitNodes(cbNodes, node.typeArguments); - case 150: + case 154: return visitNode(cbNode, node.parameterName) || visitNode(cbNode, node.type); - case 154: - return visitNode(cbNode, node.exprName); - case 155: - return visitNodes(cbNodes, node.members); - case 156: - return visitNode(cbNode, node.elementType); - case 157: - return visitNodes(cbNodes, node.elementTypes); case 158: + return visitNode(cbNode, node.exprName); case 159: - return visitNodes(cbNodes, node.types); + return visitNodes(cbNodes, node.members); case 160: - return visitNode(cbNode, node.type); + return visitNode(cbNode, node.elementType); case 161: + return visitNodes(cbNodes, node.elementTypes); case 162: - return visitNodes(cbNodes, node.elements); + case 163: + return visitNodes(cbNodes, node.types); case 164: + return visitNode(cbNode, node.type); + case 167: + case 168: return visitNodes(cbNodes, node.elements); - case 165: + case 170: + return visitNodes(cbNodes, node.elements); + case 171: return visitNodes(cbNodes, node.properties); - case 166: + case 172: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.dotToken) || visitNode(cbNode, node.name); - case 167: + case 173: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.argumentExpression); - case 168: - case 169: + case 174: + case 175: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments) || visitNodes(cbNodes, node.arguments); - case 170: + case 176: return visitNode(cbNode, node.tag) || visitNode(cbNode, node.template); - case 171: - return visitNode(cbNode, node.type) || - visitNode(cbNode, node.expression); - case 172: - return visitNode(cbNode, node.expression); - case 175: - return visitNode(cbNode, node.expression); - case 176: - return visitNode(cbNode, node.expression); case 177: - return visitNode(cbNode, node.expression); - case 179: - return visitNode(cbNode, node.operand); - case 184: - return visitNode(cbNode, node.asteriskToken) || + return visitNode(cbNode, node.type) || visitNode(cbNode, node.expression); case 178: return visitNode(cbNode, node.expression); - case 180: - return visitNode(cbNode, node.operand); case 181: + return visitNode(cbNode, node.expression); + case 182: + return visitNode(cbNode, node.expression); + case 183: + return visitNode(cbNode, node.expression); + case 185: + return visitNode(cbNode, node.operand); + case 190: + return visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.expression); + case 184: + return visitNode(cbNode, node.expression); + case 186: + return visitNode(cbNode, node.operand); + case 187: return visitNode(cbNode, node.left) || visitNode(cbNode, node.operatorToken) || visitNode(cbNode, node.right); - case 189: + case 195: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.type); - case 182: + case 196: + return visitNode(cbNode, node.expression); + case 188: return visitNode(cbNode, node.condition) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.whenTrue) || visitNode(cbNode, node.colonToken) || visitNode(cbNode, node.whenFalse); - case 185: + case 191: return visitNode(cbNode, node.expression); - case 192: - case 219: + case 199: + case 226: return visitNodes(cbNodes, node.statements); - case 248: + case 256: return visitNodes(cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); - case 193: + case 200: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.declarationList); - case 212: + case 219: return visitNodes(cbNodes, node.declarations); - case 195: + case 202: return visitNode(cbNode, node.expression); - case 196: + case 203: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.thenStatement) || visitNode(cbNode, node.elseStatement); - case 197: + case 204: return visitNode(cbNode, node.statement) || visitNode(cbNode, node.expression); - case 198: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 199: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.condition) || - visitNode(cbNode, node.incrementor) || - visitNode(cbNode, node.statement); - case 200: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 201: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 202: - case 203: - return visitNode(cbNode, node.label); - case 204: - return visitNode(cbNode, node.expression); case 205: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); case 206: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.caseBlock); - case 220: - return visitNodes(cbNodes, node.clauses); - case 241: - return visitNode(cbNode, node.expression) || - visitNodes(cbNodes, node.statements); - case 242: - return visitNodes(cbNodes, node.statements); + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.condition) || + visitNode(cbNode, node.incrementor) || + visitNode(cbNode, node.statement); case 207: - return visitNode(cbNode, node.label) || + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); case 208: - return visitNode(cbNode, node.expression); + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); case 209: + case 210: + return visitNode(cbNode, node.label); + case 211: + return visitNode(cbNode, node.expression); + case 212: + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + case 213: + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.caseBlock); + case 227: + return visitNodes(cbNodes, node.clauses); + case 249: + return visitNode(cbNode, node.expression) || + visitNodes(cbNodes, node.statements); + case 250: + return visitNodes(cbNodes, node.statements); + case 214: + return visitNode(cbNode, node.label) || + visitNode(cbNode, node.statement); + case 215: + return visitNode(cbNode, node.expression); + case 216: return visitNode(cbNode, node.tryBlock) || visitNode(cbNode, node.catchClause) || visitNode(cbNode, node.finallyBlock); - case 244: + case 252: return visitNode(cbNode, node.variableDeclaration) || visitNode(cbNode, node.block); - case 139: + case 143: return visitNode(cbNode, node.expression); - case 214: - case 186: + case 221: + case 192: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.heritageClauses) || visitNodes(cbNodes, node.members); - case 215: + case 222: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.heritageClauses) || visitNodes(cbNodes, node.members); - case 216: + case 223: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNode(cbNode, node.type); - case 217: + case 224: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.members); - case 247: + case 255: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 218: + case 225: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.body); - case 221: + case 229: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); - case 222: + case 230: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.importClause) || visitNode(cbNode, node.moduleSpecifier); - case 223: + case 231: return visitNode(cbNode, node.name) || visitNode(cbNode, node.namedBindings); - case 224: - return visitNode(cbNode, node.name); - case 225: - case 229: - return visitNodes(cbNodes, node.elements); case 228: + return visitNode(cbNode, node.name); + case 232: + return visitNode(cbNode, node.name); + case 233: + case 237: + return visitNodes(cbNodes, node.elements); + case 236: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.exportClause) || visitNode(cbNode, node.moduleSpecifier); - case 226: - case 230: + case 234: + case 238: return visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.name); - case 227: + case 235: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.expression); - case 183: + case 189: return visitNode(cbNode, node.head) || visitNodes(cbNodes, node.templateSpans); - case 190: + case 197: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal); - case 136: + case 140: return visitNode(cbNode, node.expression); - case 243: + case 251: return visitNodes(cbNodes, node.types); - case 188: + case 194: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments); - case 232: + case 240: return visitNode(cbNode, node.expression); - case 231: + case 239: return visitNodes(cbNodes, node.decorators); - case 233: + case 241: return visitNode(cbNode, node.openingElement) || visitNodes(cbNodes, node.children) || visitNode(cbNode, node.closingElement); - case 234: - case 235: + case 242: + case 243: return visitNode(cbNode, node.tagName) || visitNodes(cbNodes, node.attributes); - case 238: + case 246: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 239: + case 247: return visitNode(cbNode, node.expression); - case 240: + case 248: return visitNode(cbNode, node.expression); - case 237: + case 245: return visitNode(cbNode, node.tagName); - case 249: - return visitNode(cbNode, node.type); - case 253: - return visitNodes(cbNodes, node.types); - case 254: - return visitNodes(cbNodes, node.types); - case 252: - return visitNode(cbNode, node.elementType); - case 256: - return visitNode(cbNode, node.type); - case 255: - return visitNode(cbNode, node.type); case 257: - return visitNodes(cbNodes, node.members); - case 259: - return visitNode(cbNode, node.name) || - visitNodes(cbNodes, node.typeArguments); - case 260: return visitNode(cbNode, node.type); case 261: - return visitNodes(cbNodes, node.parameters) || - visitNode(cbNode, node.type); + return visitNodes(cbNodes, node.types); case 262: + return visitNodes(cbNodes, node.types); + case 260: + return visitNode(cbNode, node.elementType); + case 264: return visitNode(cbNode, node.type); case 263: return visitNode(cbNode, node.type); - case 264: + case 265: + return visitNodes(cbNodes, node.members); + case 267: + return visitNode(cbNode, node.name) || + visitNodes(cbNodes, node.typeArguments); + case 268: return visitNode(cbNode, node.type); - case 258: + case 269: + return visitNodes(cbNodes, node.parameters) || + visitNode(cbNode, node.type); + case 270: + return visitNode(cbNode, node.type); + case 271: + return visitNode(cbNode, node.type); + case 272: + return visitNode(cbNode, node.type); + case 266: return visitNode(cbNode, node.name) || visitNode(cbNode, node.type); - case 265: + case 273: return visitNodes(cbNodes, node.tags); - case 267: + case 275: return visitNode(cbNode, node.preParameterName) || visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.postParameterName); - case 268: + case 276: return visitNode(cbNode, node.typeExpression); - case 269: + case 277: return visitNode(cbNode, node.typeExpression); - case 270: + case 278: return visitNodes(cbNodes, node.typeParameters); } } ts.forEachChild = forEachChild; - function createSourceFile(fileName, sourceText, languageVersion, setParentNodes) { + function createSourceFile(fileName, sourceText, languageVersion, setParentNodes, scriptKind) { if (setParentNodes === void 0) { setParentNodes = false; } var start = new Date().getTime(); - var result = Parser.parseSourceFile(fileName, sourceText, languageVersion, undefined, setParentNodes); + var result = Parser.parseSourceFile(fileName, sourceText, languageVersion, undefined, setParentNodes, scriptKind); ts.parseTime += new Date().getTime() - start; return result; } ts.createSourceFile = createSourceFile; + function isExternalModule(file) { + return file.externalModuleIndicator !== undefined; + } + ts.isExternalModule = isExternalModule; function updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks) { return IncrementalParser.updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks); } @@ -6135,7 +7147,7 @@ var ts; var Parser; (function (Parser) { var scanner = ts.createScanner(2, true); - var disallowInAndDecoratorContext = 1 | 4; + var disallowInAndDecoratorContext = 4194304 | 16777216; var NodeConstructor; var SourceFileConstructor; var sourceFile; @@ -6149,15 +7161,18 @@ var ts; var parsingContext; var contextFlags; var parseErrorBeforeNextFinishedNode = false; - function parseSourceFile(fileName, _sourceText, languageVersion, _syntaxCursor, setParentNodes) { - var isJavaScriptFile = ts.hasJavaScriptFileExtension(fileName) || _sourceText.lastIndexOf("// @language=javascript", 0) === 0; - initializeState(fileName, _sourceText, languageVersion, isJavaScriptFile, _syntaxCursor); - var result = parseSourceFileWorker(fileName, languageVersion, setParentNodes); + function parseSourceFile(fileName, _sourceText, languageVersion, _syntaxCursor, setParentNodes, scriptKind) { + scriptKind = ts.ensureScriptKind(fileName, scriptKind); + initializeState(fileName, _sourceText, languageVersion, _syntaxCursor, scriptKind); + var result = parseSourceFileWorker(fileName, languageVersion, setParentNodes, scriptKind); clearState(); return result; } Parser.parseSourceFile = parseSourceFile; - function initializeState(fileName, _sourceText, languageVersion, isJavaScriptFile, _syntaxCursor) { + function getLanguageVariant(scriptKind) { + return scriptKind === 4 || scriptKind === 2 || scriptKind === 1 ? 1 : 0; + } + function initializeState(fileName, _sourceText, languageVersion, _syntaxCursor, scriptKind) { NodeConstructor = ts.objectAllocator.getNodeConstructor(); SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor(); sourceText = _sourceText; @@ -6167,12 +7182,12 @@ var ts; identifiers = {}; identifierCount = 0; nodeCount = 0; - contextFlags = isJavaScriptFile ? 32 : 0; + contextFlags = scriptKind === 1 || scriptKind === 2 ? 134217728 : 0; parseErrorBeforeNextFinishedNode = false; scanner.setText(sourceText); scanner.setOnError(scanError); scanner.setScriptTarget(languageVersion); - scanner.setLanguageVariant(ts.allowsJsxExpressions(fileName) ? 1 : 0); + scanner.setLanguageVariant(getLanguageVariant(scriptKind)); } function clearState() { scanner.setText(""); @@ -6183,11 +7198,9 @@ var ts; syntaxCursor = undefined; sourceText = undefined; } - function parseSourceFileWorker(fileName, languageVersion, setParentNodes) { - sourceFile = createSourceFile(fileName, languageVersion); - if (contextFlags & 32) { - sourceFile.parserContextFlags = 32; - } + function parseSourceFileWorker(fileName, languageVersion, setParentNodes, scriptKind) { + sourceFile = createSourceFile(fileName, languageVersion, scriptKind); + sourceFile.flags = contextFlags; token = nextToken(); processReferenceComments(sourceFile); sourceFile.statements = parseList(0, parseStatement); @@ -6201,35 +7214,22 @@ var ts; if (setParentNodes) { fixupParentReferences(sourceFile); } - if (ts.isSourceFileJavaScript(sourceFile)) { - addJSDocComments(); - } return sourceFile; } - function addJSDocComments() { - forEachChild(sourceFile, visit); - return; - function visit(node) { - switch (node.kind) { - case 193: - case 213: - case 138: - addJSDocComment(node); - } - forEachChild(node, visit); - } - } function addJSDocComment(node) { - var comments = ts.getLeadingCommentRangesOfNode(node, sourceFile); - if (comments) { - for (var _i = 0, comments_1 = comments; _i < comments_1.length; _i++) { - var comment = comments_1[_i]; - var jsDocComment = JSDocParser.parseJSDocComment(node, comment.pos, comment.end - comment.pos); - if (jsDocComment) { - node.jsDocComment = jsDocComment; + if (contextFlags & 134217728) { + var comments = ts.getLeadingCommentRangesOfNode(node, sourceFile); + if (comments) { + for (var _i = 0, comments_1 = comments; _i < comments_1.length; _i++) { + var comment = comments_1[_i]; + var jsDocComment = JSDocParser.parseJSDocComment(node, comment.pos, comment.end - comment.pos); + if (jsDocComment) { + node.jsDocComment = jsDocComment; + } } } } + return node; } function fixupParentReferences(sourceFile) { var parent = sourceFile; @@ -6246,15 +7246,16 @@ var ts; } } Parser.fixupParentReferences = fixupParentReferences; - function createSourceFile(fileName, languageVersion) { - var sourceFile = new SourceFileConstructor(248, 0, sourceText.length); + function createSourceFile(fileName, languageVersion, scriptKind) { + var sourceFile = new SourceFileConstructor(256, 0, sourceText.length); nodeCount++; sourceFile.text = sourceText; sourceFile.bindDiagnostics = []; sourceFile.languageVersion = languageVersion; sourceFile.fileName = ts.normalizePath(fileName); - sourceFile.flags = ts.fileExtensionIs(sourceFile.fileName, ".d.ts") ? 4096 : 0; - sourceFile.languageVariant = ts.allowsJsxExpressions(sourceFile.fileName) ? 1 : 0; + sourceFile.languageVariant = getLanguageVariant(scriptKind); + sourceFile.isDeclarationFile = ts.fileExtensionIs(sourceFile.fileName, ".d.ts"); + sourceFile.scriptKind = scriptKind; return sourceFile; } function setContextFlag(val, flag) { @@ -6266,16 +7267,16 @@ var ts; } } function setDisallowInContext(val) { - setContextFlag(val, 1); + setContextFlag(val, 4194304); } function setYieldContext(val) { - setContextFlag(val, 2); + setContextFlag(val, 8388608); } function setDecoratorContext(val) { - setContextFlag(val, 4); + setContextFlag(val, 16777216); } function setAwaitContext(val) { - setContextFlag(val, 8); + setContextFlag(val, 33554432); } function doOutsideOfContext(context, func) { var contextFlagsToClear = context & contextFlags; @@ -6298,46 +7299,40 @@ var ts; return func(); } function allowInAnd(func) { - return doOutsideOfContext(1, func); + return doOutsideOfContext(4194304, func); } function disallowInAnd(func) { - return doInsideOfContext(1, func); + return doInsideOfContext(4194304, func); } function doInYieldContext(func) { - return doInsideOfContext(2, func); - } - function doOutsideOfYieldContext(func) { - return doOutsideOfContext(2, func); + return doInsideOfContext(8388608, func); } function doInDecoratorContext(func) { - return doInsideOfContext(4, func); + return doInsideOfContext(16777216, func); } function doInAwaitContext(func) { - return doInsideOfContext(8, func); + return doInsideOfContext(33554432, func); } function doOutsideOfAwaitContext(func) { - return doOutsideOfContext(8, func); + return doOutsideOfContext(33554432, func); } function doInYieldAndAwaitContext(func) { - return doInsideOfContext(2 | 8, func); - } - function doOutsideOfYieldAndAwaitContext(func) { - return doOutsideOfContext(2 | 8, func); + return doInsideOfContext(8388608 | 33554432, func); } function inContext(flags) { return (contextFlags & flags) !== 0; } function inYieldContext() { - return inContext(2); + return inContext(8388608); } function inDisallowInContext() { - return inContext(1); + return inContext(4194304); } function inDecoratorContext() { - return inContext(4); + return inContext(16777216); } function inAwaitContext() { - return inContext(8); + return inContext(33554432); } function parseErrorAtCurrentToken(message, arg0) { var start = scanner.getTokenPos(); @@ -6364,9 +7359,6 @@ var ts; function nextToken() { return token = scanner.scan(); } - function getTokenPos(pos) { - return ts.skipTrivia(sourceText, pos); - } function reScanGreaterToken() { return token = scanner.reScanGreaterToken(); } @@ -6481,11 +7473,11 @@ var ts; function finishNode(node, end) { node.end = end === undefined ? scanner.getStartPos() : end; if (contextFlags) { - node.parserContextFlags = contextFlags; + node.flags |= contextFlags; } if (parseErrorBeforeNextFinishedNode) { parseErrorBeforeNextFinishedNode = false; - node.parserContextFlags |= 16; + node.flags |= 67108864; } return node; } @@ -6547,7 +7539,7 @@ var ts; return token === 9 || token === 8 || ts.tokenIsIdentifierOrKeyword(token); } function parseComputedPropertyName() { - var node = createNode(136); + var node = createNode(140); parseExpected(19); node.expression = allowInAnd(parseExpression); parseExpected(20); @@ -6556,6 +7548,13 @@ var ts; function parseContextualModifier(t) { return token === t && tryParse(nextTokenCanFollowModifier); } + function nextTokenIsOnSameLineAndCanFollowModifier() { + nextToken(); + if (scanner.hasPrecedingLineBreak()) { + return false; + } + return canFollowModifier(); + } function nextTokenCanFollowModifier() { if (token === 74) { return nextToken() === 81; @@ -6565,7 +7564,7 @@ var ts; if (token === 77) { return lookAhead(nextTokenIsClassOrFunction); } - return token !== 37 && token !== 15 && canFollowModifier(); + return token !== 37 && token !== 116 && token !== 15 && canFollowModifier(); } if (token === 77) { return nextTokenIsClassOrFunction(); @@ -6574,14 +7573,10 @@ var ts; nextToken(); return canFollowModifier(); } - nextToken(); - if (scanner.hasPrecedingLineBreak()) { - return false; - } - return canFollowModifier(); + return nextTokenIsOnSameLineAndCanFollowModifier(); } function parseAnyContextualModifier() { - return ts.isModifier(token) && tryParse(nextTokenCanFollowModifier); + return ts.isModifierKind(token) && tryParse(nextTokenCanFollowModifier); } function canFollowModifier() { return token === 19 @@ -6606,7 +7601,7 @@ var ts; case 2: return token === 71 || token === 77; case 4: - return isStartOfTypeMember(); + return lookAhead(isTypeMemberStart); case 5: return lookAhead(isClassMemberStart) || (token === 23 && !inErrorRecovery); case 6: @@ -6796,7 +7791,7 @@ var ts; if (ts.containsParseError(node)) { return undefined; } - var nodeContextFlags = node.parserContextFlags & 31; + var nodeContextFlags = node.flags & 197132288; if (nodeContextFlags !== contextFlags) { return undefined; } @@ -6843,14 +7838,14 @@ var ts; function isReusableClassMember(node) { if (node) { switch (node.kind) { - case 144: + case 148: + case 153: case 149: + case 150: case 145: - case 146: - case 141: - case 191: + case 198: return true; - case 143: + case 147: var methodDeclaration = node; var nameIsConstructor = methodDeclaration.name.kind === 69 && methodDeclaration.name.originalKeywordKind === 121; @@ -6862,8 +7857,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 241: - case 242: + case 249: + case 250: return true; } } @@ -6872,65 +7867,65 @@ var ts; function isReusableStatement(node) { if (node) { switch (node.kind) { - case 213: - case 193: - case 192: - case 196: - case 195: - case 208: - case 204: - case 206: + case 220: + case 200: + case 199: case 203: case 202: - case 200: - case 201: - case 199: - case 198: - case 205: - case 194: + case 215: + case 211: + case 213: + case 210: case 209: case 207: - case 197: - case 210: - case 222: - case 221: - case 228: - case 227: - case 218: - case 214: - case 215: - case 217: + case 208: + case 206: + case 205: + case 212: + case 201: case 216: + case 214: + case 204: + case 217: + case 230: + case 229: + case 236: + case 235: + case 225: + case 221: + case 222: + case 224: + case 223: return true; } } return false; } function isReusableEnumMember(node) { - return node.kind === 247; + return node.kind === 255; } function isReusableTypeMember(node) { if (node) { switch (node.kind) { - case 148: - case 142: - case 149: - case 140: - case 147: + case 152: + case 146: + case 153: + case 144: + case 151: return true; } } return false; } function isReusableVariableDeclaration(node) { - if (node.kind !== 211) { + if (node.kind !== 218) { return false; } var variableDeclarator = node; return variableDeclarator.initializer === undefined; } function isReusableParameter(node) { - if (node.kind !== 138) { + if (node.kind !== 142) { return false; } var parameter = node; @@ -6975,7 +7970,7 @@ var ts; } } ; - function parseDelimitedList(kind, parseElement, considerSemicolonAsDelimeter) { + function parseDelimitedList(kind, parseElement, considerSemicolonAsDelimiter) { var saveParsingContext = parsingContext; parsingContext |= 1 << kind; var result = []; @@ -6993,7 +7988,7 @@ var ts; break; } parseExpected(24); - if (considerSemicolonAsDelimeter && token === 23 && !scanner.hasPrecedingLineBreak()) { + if (considerSemicolonAsDelimiter && token === 23 && !scanner.hasPrecedingLineBreak()) { nextToken(); } continue; @@ -7030,7 +8025,7 @@ var ts; function parseEntityName(allowReservedWords, diagnosticMessage) { var entity = parseIdentifier(diagnosticMessage); while (parseOptional(21)) { - var node = createNode(135, entity.pos); + var node = createNode(139, entity.pos); node.left = entity; node.right = parseRightSideOfDot(allowReservedWords); entity = finishNode(node); @@ -7047,8 +8042,8 @@ var ts; return allowIdentifierNames ? parseIdentifierName() : parseIdentifier(); } function parseTemplateExpression() { - var template = createNode(183); - template.head = parseLiteralNode(); + var template = createNode(189); + template.head = parseTemplateLiteralFragment(); ts.Debug.assert(template.head.kind === 12, "Template head has wrong token kind"); var templateSpans = []; templateSpans.pos = getNodePos(); @@ -7060,12 +8055,12 @@ var ts; return finishNode(template); } function parseTemplateSpan() { - var span = createNode(190); + var span = createNode(197); span.expression = allowInAnd(parseExpression); var literal; if (token === 16) { reScanTemplateToken(); - literal = parseLiteralNode(); + literal = parseTemplateLiteralFragment(); } else { literal = parseExpectedToken(14, false, ts.Diagnostics._0_expected, ts.tokenToString(16)); @@ -7073,8 +8068,17 @@ var ts; span.literal = literal; return finishNode(span); } + function parseStringLiteralTypeNode() { + return parseLiteralLikeNode(166, true); + } function parseLiteralNode(internName) { - var node = createNode(token); + return parseLiteralLikeNode(token, internName); + } + function parseTemplateLiteralFragment() { + return parseLiteralLikeNode(token, false); + } + function parseLiteralLikeNode(kind, internName) { + var node = createNode(kind); var text = scanner.getTokenValue(); node.text = internName ? internIdentifier(text) : text; if (scanner.hasExtendedUnicodeEscape()) { @@ -7089,34 +8093,39 @@ var ts; if (node.kind === 8 && sourceText.charCodeAt(tokenPos) === 48 && ts.isOctalDigit(sourceText.charCodeAt(tokenPos + 1))) { - node.flags |= 32768; + node.isOctalLiteral = true; } return node; } - function parseTypeReferenceOrTypePredicate() { + function parseTypeReference() { var typeName = parseEntityName(false, ts.Diagnostics.Type_expected); - if (typeName.kind === 69 && token === 124 && !scanner.hasPrecedingLineBreak()) { - nextToken(); - var node_1 = createNode(150, typeName.pos); - node_1.parameterName = typeName; - node_1.type = parseType(); - return finishNode(node_1); - } - var node = createNode(151, typeName.pos); + var node = createNode(155, typeName.pos); node.typeName = typeName; if (!scanner.hasPrecedingLineBreak() && token === 25) { node.typeArguments = parseBracketedList(18, parseType, 25, 27); } return finishNode(node); } + function parseThisTypePredicate(lhs) { + nextToken(); + var node = createNode(154, lhs.pos); + node.parameterName = lhs; + node.type = parseType(); + return finishNode(node); + } + function parseThisTypeNode() { + var node = createNode(165); + nextToken(); + return finishNode(node); + } function parseTypeQuery() { - var node = createNode(154); + var node = createNode(158); parseExpected(101); node.exprName = parseEntityName(true); return finishNode(node); } function parseTypeParameter() { - var node = createNode(137); + var node = createNode(141); node.name = parseIdentifier(); if (parseOptional(83)) { if (isStartOfType() || !isStartOfExpression()) { @@ -7140,7 +8149,7 @@ var ts; return undefined; } function isStartOfParameter() { - return token === 22 || isIdentifierOrPattern() || ts.isModifier(token) || token === 55; + return token === 22 || isIdentifierOrPattern() || ts.isModifierKind(token) || token === 55 || token === 97; } function setModifiers(node, modifiers) { if (modifiers) { @@ -7149,18 +8158,23 @@ var ts; } } function parseParameter() { - var node = createNode(138); + var node = createNode(142); + if (token === 97) { + node.name = createIdentifier(true, undefined); + node.type = parseParameterType(); + return finishNode(node); + } node.decorators = parseDecorators(); setModifiers(node, parseModifiers()); node.dotDotDotToken = parseOptionalToken(22); node.name = parseIdentifierOrPattern(); - if (ts.getFullWidth(node.name) === 0 && node.flags === 0 && ts.isModifier(token)) { + if (ts.getFullWidth(node.name) === 0 && node.flags === 0 && ts.isModifierKind(token)) { nextToken(); } node.questionToken = parseOptionalToken(53); node.type = parseParameterType(); node.initializer = parseBindingElementInitializer(true); - return finishNode(node); + return addJSDocComment(finishNode(node)); } function parseBindingElementInitializer(inParameter) { return inParameter ? parseParameterInitializer() : parseNonParameterInitializer(); @@ -7174,10 +8188,10 @@ var ts; signature.parameters = parseParameterList(yieldContext, awaitContext, requireCompleteParameterList); if (returnTokenRequired) { parseExpected(returnToken); - signature.type = parseType(); + signature.type = parseTypeOrTypePredicate(); } else if (parseOptional(returnToken)) { - signature.type = parseType(); + signature.type = parseTypeOrTypePredicate(); } } function parseParameterList(yieldContext, awaitContext, requireCompleteParameterList) { @@ -7204,7 +8218,7 @@ var ts; } function parseSignatureMember(kind) { var node = createNode(kind); - if (kind === 148) { + if (kind === 152) { parseExpected(92); } fillSignature(54, false, false, false, node); @@ -7222,7 +8236,7 @@ var ts; if (token === 22 || token === 20) { return true; } - if (ts.isModifier(token)) { + if (ts.isModifierKind(token)) { nextToken(); if (isIdentifier()) { return true; @@ -7244,7 +8258,7 @@ var ts; return token === 54 || token === 24 || token === 20; } function parseIndexSignatureDeclaration(fullStart, decorators, modifiers) { - var node = createNode(149, fullStart); + var node = createNode(153, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.parameters = parseBracketedList(16, parseParameter, 19, 20); @@ -7252,12 +8266,12 @@ var ts; parseTypeMemberSemicolon(); return finishNode(node); } - function parsePropertyOrMethodSignature() { - var fullStart = scanner.getStartPos(); + function parsePropertyOrMethodSignature(fullStart, modifiers) { var name = parsePropertyName(); var questionToken = parseOptionalToken(53); if (token === 17 || token === 25) { - var method = createNode(142, fullStart); + var method = createNode(146, fullStart); + setModifiers(method, modifiers); method.name = name; method.questionToken = questionToken; fillSignature(54, false, false, false, method); @@ -7265,86 +8279,63 @@ var ts; return finishNode(method); } else { - var property = createNode(140, fullStart); + var property = createNode(144, fullStart); + setModifiers(property, modifiers); property.name = name; property.questionToken = questionToken; property.type = parseTypeAnnotation(); + if (token === 56) { + property.initializer = parseNonParameterInitializer(); + } parseTypeMemberSemicolon(); return finishNode(property); } } - function isStartOfTypeMember() { - switch (token) { - case 17: - case 25: - case 19: - return true; - default: - if (ts.isModifier(token)) { - var result = lookAhead(isStartOfIndexSignatureDeclaration); - if (result) { - return result; - } - } - return isLiteralPropertyName() && lookAhead(isTypeMemberWithLiteralPropertyName); + function isTypeMemberStart() { + var idToken; + if (token === 17 || token === 25) { + return true; } - } - function isStartOfIndexSignatureDeclaration() { - while (ts.isModifier(token)) { + while (ts.isModifierKind(token)) { + idToken = token; nextToken(); } - return isIndexSignature(); - } - function isTypeMemberWithLiteralPropertyName() { - nextToken(); - return token === 17 || - token === 25 || - token === 53 || - token === 54 || - canParseSemicolon(); + if (token === 19) { + return true; + } + if (isLiteralPropertyName()) { + idToken = token; + nextToken(); + } + if (idToken) { + return token === 17 || + token === 25 || + token === 53 || + token === 54 || + canParseSemicolon(); + } + return false; } function parseTypeMember() { - switch (token) { - case 17: - case 25: - return parseSignatureMember(147); - case 19: - return isIndexSignature() - ? parseIndexSignatureDeclaration(scanner.getStartPos(), undefined, undefined) - : parsePropertyOrMethodSignature(); - case 92: - if (lookAhead(isStartOfConstructSignature)) { - return parseSignatureMember(148); - } - case 9: - case 8: - return parsePropertyOrMethodSignature(); - default: - if (ts.isModifier(token)) { - var result = tryParse(parseIndexSignatureWithModifiers); - if (result) { - return result; - } - } - if (ts.tokenIsIdentifierOrKeyword(token)) { - return parsePropertyOrMethodSignature(); - } + if (token === 17 || token === 25) { + return parseSignatureMember(151); } - } - function parseIndexSignatureWithModifiers() { - var fullStart = scanner.getStartPos(); - var decorators = parseDecorators(); + if (token === 92 && lookAhead(isStartOfConstructSignature)) { + return parseSignatureMember(152); + } + var fullStart = getNodePos(); var modifiers = parseModifiers(); - return isIndexSignature() - ? parseIndexSignatureDeclaration(fullStart, decorators, modifiers) - : undefined; + if (isIndexSignature()) { + return parseIndexSignatureDeclaration(fullStart, undefined, modifiers); + } + return parsePropertyOrMethodSignature(fullStart, modifiers); } function isStartOfConstructSignature() { nextToken(); return token === 17 || token === 25; } function parseTypeLiteral() { - var node = createNode(155); + var node = createNode(159); node.members = parseObjectTypeMembers(); return finishNode(node); } @@ -7360,12 +8351,12 @@ var ts; return members; } function parseTupleType() { - var node = createNode(157); + var node = createNode(161); node.elementTypes = parseBracketedList(19, parseType, 19, 20); return finishNode(node); } function parseParenthesizedType() { - var node = createNode(160); + var node = createNode(164); parseExpected(17); node.type = parseType(); parseExpected(18); @@ -7373,7 +8364,7 @@ var ts; } function parseFunctionOrConstructorType(kind) { var node = createNode(kind); - if (kind === 153) { + if (kind === 157) { parseExpected(92); } fillSignature(34, false, false, false, node); @@ -7386,17 +8377,28 @@ var ts; function parseNonArrayType() { switch (token) { case 117: + case 132: case 130: - case 128: case 120: - case 131: + case 133: + case 135: + case 127: var node = tryParse(parseKeywordAndNoDot); - return node || parseTypeReferenceOrTypePredicate(); + return node || parseTypeReference(); case 9: - return parseLiteralNode(true); + return parseStringLiteralTypeNode(); case 103: - case 97: + case 93: return parseTokenNode(); + case 97: { + var thisKeyword = parseThisTypeNode(); + if (token === 124 && !scanner.hasPrecedingLineBreak()) { + return parseThisTypePredicate(thisKeyword); + } + else { + return thisKeyword; + } + } case 101: return parseTypeQuery(); case 15: @@ -7406,19 +8408,22 @@ var ts; case 17: return parseParenthesizedType(); default: - return parseTypeReferenceOrTypePredicate(); + return parseTypeReference(); } } function isStartOfType() { switch (token) { case 117: + case 132: case 130: - case 128: case 120: - case 131: + case 133: case 103: + case 135: + case 93: case 97: case 101: + case 127: case 15: case 19: case 25: @@ -7439,7 +8444,7 @@ var ts; var type = parseNonArrayType(); while (!scanner.hasPrecedingLineBreak() && parseOptional(19)) { parseExpected(20); - var node = createNode(156, type.pos); + var node = createNode(160, type.pos); node.elementType = type; type = finishNode(node); } @@ -7461,10 +8466,10 @@ var ts; return type; } function parseIntersectionTypeOrHigher() { - return parseUnionOrIntersectionType(159, parseArrayTypeOrHigher, 46); + return parseUnionOrIntersectionType(163, parseArrayTypeOrHigher, 46); } function parseUnionTypeOrHigher() { - return parseUnionOrIntersectionType(158, parseIntersectionTypeOrHigher, 47); + return parseUnionOrIntersectionType(162, parseIntersectionTypeOrHigher, 47); } function isStartOfFunctionType() { if (token === 25) { @@ -7472,16 +8477,29 @@ var ts; } return token === 17 && lookAhead(isUnambiguouslyStartOfFunctionType); } + function skipParameterStart() { + if (ts.isModifierKind(token)) { + parseModifiers(); + } + if (isIdentifier() || token === 97) { + nextToken(); + return true; + } + if (token === 19 || token === 15) { + var previousErrorCount = parseDiagnostics.length; + parseIdentifierOrPattern(); + return previousErrorCount === parseDiagnostics.length; + } + return false; + } function isUnambiguouslyStartOfFunctionType() { nextToken(); if (token === 18 || token === 22) { return true; } - if (isIdentifier() || ts.isModifier(token)) { - nextToken(); + if (skipParameterStart()) { if (token === 54 || token === 24 || - token === 53 || token === 56 || - isIdentifier() || ts.isModifier(token)) { + token === 53 || token === 56) { return true; } if (token === 18) { @@ -7493,15 +8511,35 @@ var ts; } return false; } + function parseTypeOrTypePredicate() { + var typePredicateVariable = isIdentifier() && tryParse(parseTypePredicatePrefix); + var type = parseType(); + if (typePredicateVariable) { + var node = createNode(154, typePredicateVariable.pos); + node.parameterName = typePredicateVariable; + node.type = type; + return finishNode(node); + } + else { + return type; + } + } + function parseTypePredicatePrefix() { + var id = parseIdentifier(); + if (token === 124 && !scanner.hasPrecedingLineBreak()) { + nextToken(); + return id; + } + } function parseType() { - return doOutsideOfContext(10, parseTypeWorker); + return doOutsideOfContext(41943040, parseTypeWorker); } function parseTypeWorker() { if (isStartOfFunctionType()) { - return parseFunctionOrConstructorType(152); + return parseFunctionOrConstructorType(156); } if (token === 92) { - return parseFunctionOrConstructorType(153); + return parseFunctionOrConstructorType(157); } return parseUnionTypeOrHigher(); } @@ -7565,9 +8603,6 @@ var ts; token !== 55 && isStartOfExpression(); } - function allowInAndParseExpression() { - return allowInAnd(parseExpression); - } function parseExpression() { var saveDecoratorContext = inDecoratorContext(); if (saveDecoratorContext) { @@ -7596,7 +8631,7 @@ var ts; if (isYieldExpression()) { return parseYieldExpression(); } - var arrowExpression = tryParseParenthesizedArrowFunctionExpression(); + var arrowExpression = tryParseParenthesizedArrowFunctionExpression() || tryParseAsyncSimpleArrowFunctionExpression(); if (arrowExpression) { return arrowExpression; } @@ -7623,7 +8658,7 @@ var ts; return !scanner.hasPrecedingLineBreak() && isIdentifier(); } function parseYieldExpression() { - var node = createNode(184); + var node = createNode(190); nextToken(); if (!scanner.hasPrecedingLineBreak() && (token === 37 || isStartOfExpression())) { @@ -7635,17 +8670,24 @@ var ts; return finishNode(node); } } - function parseSimpleArrowFunctionExpression(identifier) { + function parseSimpleArrowFunctionExpression(identifier, asyncModifier) { ts.Debug.assert(token === 34, "parseSimpleArrowFunctionExpression should only have been called if we had a =>"); - var node = createNode(174, identifier.pos); - var parameter = createNode(138, identifier.pos); + var node; + if (asyncModifier) { + node = createNode(180, asyncModifier.pos); + setModifiers(node, asyncModifier); + } + else { + node = createNode(180, identifier.pos); + } + var parameter = createNode(142, identifier.pos); parameter.name = identifier; finishNode(parameter); node.parameters = [parameter]; node.parameters.pos = parameter.pos; node.parameters.end = parameter.end; node.equalsGreaterThanToken = parseExpectedToken(34, false, ts.Diagnostics._0_expected, "=>"); - node.body = parseArrowFunctionExpressionBody(false); + node.body = parseArrowFunctionExpressionBody(!!asyncModifier); return finishNode(node); } function tryParseParenthesizedArrowFunctionExpression() { @@ -7748,8 +8790,32 @@ var ts; function parsePossibleParenthesizedArrowFunctionExpressionHead() { return parseParenthesizedArrowFunctionExpressionHead(false); } + function tryParseAsyncSimpleArrowFunctionExpression() { + if (token === 118) { + var isUnParenthesizedAsyncArrowFunction = lookAhead(isUnParenthesizedAsyncArrowFunctionWorker); + if (isUnParenthesizedAsyncArrowFunction === 1) { + var asyncModifier = parseModifiersForArrowFunction(); + var expr = parseBinaryExpressionOrHigher(0); + return parseSimpleArrowFunctionExpression(expr, asyncModifier); + } + } + return undefined; + } + function isUnParenthesizedAsyncArrowFunctionWorker() { + if (token === 118) { + nextToken(); + if (scanner.hasPrecedingLineBreak() || token === 34) { + return 0; + } + var expr = parseBinaryExpressionOrHigher(0); + if (!scanner.hasPrecedingLineBreak() && expr.kind === 69 && token === 34) { + return 1; + } + } + return 0; + } function parseParenthesizedArrowFunctionExpressionHead(allowAmbiguity) { - var node = createNode(174); + var node = createNode(180); setModifiers(node, parseModifiersForArrowFunction()); var isAsync = !!(node.flags & 256); fillSignature(54, false, isAsync, !allowAmbiguity, node); @@ -7781,7 +8847,7 @@ var ts; if (!questionToken) { return leftOperand; } - var node = createNode(182, leftOperand.pos); + var node = createNode(188, leftOperand.pos); node.condition = leftOperand; node.questionToken = questionToken; node.whenTrue = doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher); @@ -7794,7 +8860,7 @@ var ts; return parseBinaryExpressionRest(precedence, leftOperand); } function isInOrOfKeyword(t) { - return t === 90 || t === 134; + return t === 90 || t === 138; } function parseBinaryExpressionRest(precedence, leftOperand) { while (true) { @@ -7872,39 +8938,39 @@ var ts; return -1; } function makeBinaryExpression(left, operatorToken, right) { - var node = createNode(181, left.pos); + var node = createNode(187, left.pos); node.left = left; node.operatorToken = operatorToken; node.right = right; return finishNode(node); } function makeAsExpression(left, right) { - var node = createNode(189, left.pos); + var node = createNode(195, left.pos); node.expression = left; node.type = right; return finishNode(node); } function parsePrefixUnaryExpression() { - var node = createNode(179); + var node = createNode(185); node.operator = token; nextToken(); node.operand = parseSimpleUnaryExpression(); return finishNode(node); } function parseDeleteExpression() { - var node = createNode(175); + var node = createNode(181); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); } function parseTypeOfExpression() { - var node = createNode(176); + var node = createNode(182); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); } function parseVoidExpression() { - var node = createNode(177); + var node = createNode(183); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); @@ -7919,7 +8985,7 @@ var ts; return false; } function parseAwaitExpression() { - var node = createNode(178); + var node = createNode(184); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); @@ -7938,7 +9004,7 @@ var ts; var simpleUnaryExpression = parseSimpleUnaryExpression(); if (token === 38) { var start = ts.skipTrivia(sourceText, simpleUnaryExpression.pos); - if (simpleUnaryExpression.kind === 171) { + if (simpleUnaryExpression.kind === 177) { parseErrorAtPosition(start, simpleUnaryExpression.end - start, 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 { @@ -7986,7 +9052,7 @@ var ts; } function parseIncrementExpression() { if (token === 41 || token === 42) { - var node = createNode(179); + var node = createNode(185); node.operator = token; nextToken(); node.operand = parseLeftHandSideExpressionOrHigher(); @@ -7998,7 +9064,7 @@ var ts; var expression = parseLeftHandSideExpressionOrHigher(); ts.Debug.assert(ts.isLeftHandSideExpression(expression)); if ((token === 41 || token === 42) && !scanner.hasPrecedingLineBreak()) { - var node = createNode(180, expression.pos); + var node = createNode(186, expression.pos); node.operand = expression; node.operator = token; nextToken(); @@ -8021,31 +9087,44 @@ var ts; if (token === 17 || token === 21 || token === 19) { return expression; } - var node = createNode(166, expression.pos); + var node = createNode(172, expression.pos); node.expression = expression; node.dotToken = parseExpectedToken(21, false, ts.Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access); node.name = parseRightSideOfDot(true); return finishNode(node); } + function tagNamesAreEquivalent(lhs, rhs) { + if (lhs.kind !== rhs.kind) { + return false; + } + if (lhs.kind === 69) { + return lhs.text === rhs.text; + } + return lhs.right.text === rhs.right.text && + tagNamesAreEquivalent(lhs.left, rhs.left); + } function parseJsxElementOrSelfClosingElement(inExpressionContext) { var opening = parseJsxOpeningOrSelfClosingElement(inExpressionContext); var result; - if (opening.kind === 235) { - var node = createNode(233, opening.pos); + if (opening.kind === 243) { + var node = createNode(241, opening.pos); node.openingElement = opening; node.children = parseJsxChildren(node.openingElement.tagName); node.closingElement = parseJsxClosingElement(inExpressionContext); + if (!tagNamesAreEquivalent(node.openingElement.tagName, node.closingElement.tagName)) { + parseErrorAtPosition(node.closingElement.pos, node.closingElement.end - node.closingElement.pos, ts.Diagnostics.Expected_corresponding_JSX_closing_tag_for_0, ts.getTextOfNodeFromSourceText(sourceText, node.openingElement.tagName)); + } result = finishNode(node); } else { - ts.Debug.assert(opening.kind === 234); + ts.Debug.assert(opening.kind === 242); result = opening; } if (inExpressionContext && token === 25) { var invalidElement = tryParse(function () { return parseJsxElementOrSelfClosingElement(true); }); if (invalidElement) { parseErrorAtCurrentToken(ts.Diagnostics.JSX_expressions_must_have_one_parent_element); - var badNode = createNode(181, result.pos); + var badNode = createNode(187, result.pos); badNode.end = invalidElement.end; badNode.left = result; badNode.right = invalidElement; @@ -8057,13 +9136,13 @@ var ts; return result; } function parseJsxText() { - var node = createNode(236, scanner.getStartPos()); + var node = createNode(244, scanner.getStartPos()); token = scanner.scanJsxToken(); return finishNode(node); } function parseJsxChild() { switch (token) { - case 236: + case 244: return parseJsxText(); case 15: return parseJsxExpression(false); @@ -8083,7 +9162,7 @@ var ts; break; } else if (token === 1) { - parseErrorAtCurrentToken(ts.Diagnostics.Expected_corresponding_JSX_closing_tag_for_0, ts.getTextOfNodeFromSourceText(sourceText, openingTagName)); + parseErrorAtPosition(openingTagName.pos, openingTagName.end - openingTagName.pos, ts.Diagnostics.JSX_element_0_has_no_corresponding_closing_tag, ts.getTextOfNodeFromSourceText(sourceText, openingTagName)); break; } result.push(parseJsxChild()); @@ -8099,7 +9178,7 @@ var ts; var attributes = parseList(13, parseJsxAttribute); var node; if (token === 27) { - node = createNode(235, fullStart); + node = createNode(243, fullStart); scanJsxText(); } else { @@ -8111,7 +9190,7 @@ var ts; parseExpected(27, undefined, false); scanJsxText(); } - node = createNode(234, fullStart); + node = createNode(242, fullStart); } node.tagName = tagName; node.attributes = attributes; @@ -8122,7 +9201,7 @@ var ts; var elementName = parseIdentifierName(); while (parseOptional(21)) { scanJsxIdentifier(); - var node = createNode(135, elementName.pos); + var node = createNode(139, elementName.pos); node.left = elementName; node.right = parseIdentifierName(); elementName = finishNode(node); @@ -8130,10 +9209,10 @@ var ts; return elementName; } function parseJsxExpression(inExpressionContext) { - var node = createNode(240); + var node = createNode(248); parseExpected(15); if (token !== 16) { - node.expression = parseExpression(); + node.expression = parseAssignmentExpressionOrHigher(); } if (inExpressionContext) { parseExpected(16); @@ -8149,7 +9228,7 @@ var ts; return parseJsxSpreadAttribute(); } scanJsxIdentifier(); - var node = createNode(238); + var node = createNode(246); node.name = parseIdentifierName(); if (parseOptional(56)) { switch (token) { @@ -8164,7 +9243,7 @@ var ts; return finishNode(node); } function parseJsxSpreadAttribute() { - var node = createNode(239); + var node = createNode(247); parseExpected(15); parseExpected(22); node.expression = parseExpression(); @@ -8172,7 +9251,7 @@ var ts; return finishNode(node); } function parseJsxClosingElement(inExpressionContext) { - var node = createNode(237); + var node = createNode(245); parseExpected(26); node.tagName = parseJsxElementName(); if (inExpressionContext) { @@ -8185,7 +9264,7 @@ var ts; return finishNode(node); } function parseTypeAssertion() { - var node = createNode(171); + var node = createNode(177); parseExpected(25); node.type = parseType(); parseExpected(27); @@ -8196,15 +9275,22 @@ var ts; while (true) { var dotToken = parseOptionalToken(21); if (dotToken) { - var propertyAccess = createNode(166, expression.pos); + var propertyAccess = createNode(172, expression.pos); propertyAccess.expression = expression; propertyAccess.dotToken = dotToken; propertyAccess.name = parseRightSideOfDot(true); expression = finishNode(propertyAccess); continue; } + if (token === 49 && !scanner.hasPrecedingLineBreak()) { + nextToken(); + var nonNullExpression = createNode(196, expression.pos); + nonNullExpression.expression = expression; + expression = finishNode(nonNullExpression); + continue; + } if (!inDecoratorContext() && parseOptional(19)) { - var indexedAccess = createNode(167, expression.pos); + var indexedAccess = createNode(173, expression.pos); indexedAccess.expression = expression; if (token !== 20) { indexedAccess.argumentExpression = allowInAnd(parseExpression); @@ -8218,7 +9304,7 @@ var ts; continue; } if (token === 11 || token === 12) { - var tagExpression = createNode(170, expression.pos); + var tagExpression = createNode(176, expression.pos); tagExpression.tag = expression; tagExpression.template = token === 11 ? parseLiteralNode() @@ -8237,7 +9323,7 @@ var ts; if (!typeArguments) { return expression; } - var callExpr = createNode(168, expression.pos); + var callExpr = createNode(174, expression.pos); callExpr.expression = expression; callExpr.typeArguments = typeArguments; callExpr.arguments = parseArgumentList(); @@ -8245,7 +9331,7 @@ var ts; continue; } else if (token === 17) { - var callExpr = createNode(168, expression.pos); + var callExpr = createNode(174, expression.pos); callExpr.expression = expression; callExpr.arguments = parseArgumentList(); expression = finishNode(callExpr); @@ -8340,41 +9426,42 @@ var ts; return parseIdentifier(ts.Diagnostics.Expression_expected); } function parseParenthesizedExpression() { - var node = createNode(172); + var node = createNode(178); parseExpected(17); node.expression = allowInAnd(parseExpression); parseExpected(18); return finishNode(node); } function parseSpreadElement() { - var node = createNode(185); + var node = createNode(191); parseExpected(22); node.expression = parseAssignmentExpressionOrHigher(); return finishNode(node); } function parseArgumentOrArrayLiteralElement() { return token === 22 ? parseSpreadElement() : - token === 24 ? createNode(187) : + token === 24 ? createNode(193) : parseAssignmentExpressionOrHigher(); } function parseArgumentExpression() { return doOutsideOfContext(disallowInAndDecoratorContext, parseArgumentOrArrayLiteralElement); } function parseArrayLiteralExpression() { - var node = createNode(164); + var node = createNode(170); parseExpected(19); - if (scanner.hasPrecedingLineBreak()) - node.flags |= 1024; + if (scanner.hasPrecedingLineBreak()) { + node.multiLine = true; + } node.elements = parseDelimitedList(15, parseArgumentOrArrayLiteralElement); parseExpected(20); return finishNode(node); } function tryParseAccessorDeclaration(fullStart, decorators, modifiers) { if (parseContextualModifier(123)) { - return parseAccessorDeclaration(145, fullStart, decorators, modifiers); + return addJSDocComment(parseAccessorDeclaration(149, fullStart, decorators, modifiers)); } - else if (parseContextualModifier(129)) { - return parseAccessorDeclaration(146, fullStart, decorators, modifiers); + else if (parseContextualModifier(131)) { + return parseAccessorDeclaration(150, fullStart, decorators, modifiers); } return undefined; } @@ -8388,7 +9475,6 @@ var ts; } var asteriskToken = parseOptionalToken(37); var tokenIsIdentifier = isIdentifier(); - var nameToken = token; var propertyName = parsePropertyName(); var questionToken = parseOptionalToken(53); if (asteriskToken || token === 17 || token === 25) { @@ -8396,7 +9482,7 @@ var ts; } var isShorthandPropertyAssignment = tokenIsIdentifier && (token === 24 || token === 16 || token === 56); if (isShorthandPropertyAssignment) { - var shorthandDeclaration = createNode(246, fullStart); + var shorthandDeclaration = createNode(254, fullStart); shorthandDeclaration.name = propertyName; shorthandDeclaration.questionToken = questionToken; var equalsToken = parseOptionalToken(56); @@ -8404,22 +9490,23 @@ var ts; shorthandDeclaration.equalsToken = equalsToken; shorthandDeclaration.objectAssignmentInitializer = allowInAnd(parseAssignmentExpressionOrHigher); } - return finishNode(shorthandDeclaration); + return addJSDocComment(finishNode(shorthandDeclaration)); } else { - var propertyAssignment = createNode(245, fullStart); + var propertyAssignment = createNode(253, fullStart); + propertyAssignment.modifiers = modifiers; propertyAssignment.name = propertyName; propertyAssignment.questionToken = questionToken; parseExpected(54); propertyAssignment.initializer = allowInAnd(parseAssignmentExpressionOrHigher); - return finishNode(propertyAssignment); + return addJSDocComment(finishNode(propertyAssignment)); } } function parseObjectLiteralExpression() { - var node = createNode(165); + var node = createNode(171); parseExpected(15); if (scanner.hasPrecedingLineBreak()) { - node.flags |= 1024; + node.multiLine = true; } node.properties = parseDelimitedList(12, parseObjectLiteralElement, true); parseExpected(16); @@ -8430,7 +9517,7 @@ var ts; if (saveDecoratorContext) { setDecoratorContext(false); } - var node = createNode(173); + var node = createNode(179); setModifiers(node, parseModifiers()); parseExpected(87); node.asteriskToken = parseOptionalToken(37); @@ -8446,13 +9533,13 @@ var ts; if (saveDecoratorContext) { setDecoratorContext(true); } - return finishNode(node); + return addJSDocComment(finishNode(node)); } function parseOptionalIdentifier() { return isIdentifier() ? parseIdentifier() : undefined; } function parseNewExpression() { - var node = createNode(169); + var node = createNode(175); parseExpected(92); node.expression = parseMemberExpressionOrHigher(); node.typeArguments = tryParse(parseTypeArgumentsInExpression); @@ -8462,7 +9549,7 @@ var ts; return finishNode(node); } function parseBlock(ignoreMissingOpenBrace, diagnosticMessage) { - var node = createNode(192); + var node = createNode(199); if (parseExpected(15, diagnosticMessage) || ignoreMissingOpenBrace) { node.statements = parseList(1, parseStatement); parseExpected(16); @@ -8490,12 +9577,12 @@ var ts; return block; } function parseEmptyStatement() { - var node = createNode(194); + var node = createNode(201); parseExpected(23); return finishNode(node); } function parseIfStatement() { - var node = createNode(196); + var node = createNode(203); parseExpected(88); parseExpected(17); node.expression = allowInAnd(parseExpression); @@ -8505,7 +9592,7 @@ var ts; return finishNode(node); } function parseDoStatement() { - var node = createNode(197); + var node = createNode(204); parseExpected(79); node.statement = parseStatement(); parseExpected(104); @@ -8516,7 +9603,7 @@ var ts; return finishNode(node); } function parseWhileStatement() { - var node = createNode(198); + var node = createNode(205); parseExpected(104); parseExpected(17); node.expression = allowInAnd(parseExpression); @@ -8539,21 +9626,21 @@ var ts; } var forOrForInOrForOfStatement; if (parseOptional(90)) { - var forInStatement = createNode(200, pos); + var forInStatement = createNode(207, pos); forInStatement.initializer = initializer; forInStatement.expression = allowInAnd(parseExpression); parseExpected(18); forOrForInOrForOfStatement = forInStatement; } - else if (parseOptional(134)) { - var forOfStatement = createNode(201, pos); + else if (parseOptional(138)) { + var forOfStatement = createNode(208, pos); forOfStatement.initializer = initializer; forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher); parseExpected(18); forOrForInOrForOfStatement = forOfStatement; } else { - var forStatement = createNode(199, pos); + var forStatement = createNode(206, pos); forStatement.initializer = initializer; parseExpected(23); if (token !== 23 && token !== 18) { @@ -8571,7 +9658,7 @@ var ts; } function parseBreakOrContinueStatement(kind) { var node = createNode(kind); - parseExpected(kind === 203 ? 70 : 75); + parseExpected(kind === 210 ? 70 : 75); if (!canParseSemicolon()) { node.label = parseIdentifier(); } @@ -8579,7 +9666,7 @@ var ts; return finishNode(node); } function parseReturnStatement() { - var node = createNode(204); + var node = createNode(211); parseExpected(94); if (!canParseSemicolon()) { node.expression = allowInAnd(parseExpression); @@ -8588,7 +9675,7 @@ var ts; return finishNode(node); } function parseWithStatement() { - var node = createNode(205); + var node = createNode(212); parseExpected(105); parseExpected(17); node.expression = allowInAnd(parseExpression); @@ -8597,7 +9684,7 @@ var ts; return finishNode(node); } function parseCaseClause() { - var node = createNode(241); + var node = createNode(249); parseExpected(71); node.expression = allowInAnd(parseExpression); parseExpected(54); @@ -8605,7 +9692,7 @@ var ts; return finishNode(node); } function parseDefaultClause() { - var node = createNode(242); + var node = createNode(250); parseExpected(77); parseExpected(54); node.statements = parseList(3, parseStatement); @@ -8615,12 +9702,12 @@ var ts; return token === 71 ? parseCaseClause() : parseDefaultClause(); } function parseSwitchStatement() { - var node = createNode(206); + var node = createNode(213); parseExpected(96); parseExpected(17); node.expression = allowInAnd(parseExpression); parseExpected(18); - var caseBlock = createNode(220, scanner.getStartPos()); + var caseBlock = createNode(227, scanner.getStartPos()); parseExpected(15); caseBlock.clauses = parseList(2, parseCaseOrDefaultClause); parseExpected(16); @@ -8628,14 +9715,14 @@ var ts; return finishNode(node); } function parseThrowStatement() { - var node = createNode(208); + var node = createNode(215); parseExpected(98); node.expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression); parseSemicolon(); return finishNode(node); } function parseTryStatement() { - var node = createNode(209); + var node = createNode(216); parseExpected(100); node.tryBlock = parseBlock(false); node.catchClause = token === 72 ? parseCatchClause() : undefined; @@ -8646,7 +9733,7 @@ var ts; return finishNode(node); } function parseCatchClause() { - var result = createNode(244); + var result = createNode(252); parseExpected(72); if (parseExpected(17)) { result.variableDeclaration = parseVariableDeclaration(); @@ -8656,7 +9743,7 @@ var ts; return finishNode(result); } function parseDebuggerStatement() { - var node = createNode(210); + var node = createNode(217); parseExpected(76); parseSemicolon(); return finishNode(node); @@ -8665,16 +9752,16 @@ var ts; var fullStart = scanner.getStartPos(); var expression = allowInAnd(parseExpression); if (expression.kind === 69 && parseOptional(54)) { - var labeledStatement = createNode(207, fullStart); + var labeledStatement = createNode(214, fullStart); labeledStatement.label = expression; labeledStatement.statement = parseStatement(); - return finishNode(labeledStatement); + return addJSDocComment(finishNode(labeledStatement)); } else { - var expressionStatement = createNode(195, fullStart); + var expressionStatement = createNode(202, fullStart); expressionStatement.expression = expression; parseSemicolon(); - return finishNode(expressionStatement); + return addJSDocComment(finishNode(expressionStatement)); } } function nextTokenIsIdentifierOrKeywordOnSameLine() { @@ -8700,7 +9787,7 @@ var ts; case 81: return true; case 107: - case 132: + case 134: return nextTokenIsIdentifierOnSameLine(); case 125: case 126: @@ -8711,11 +9798,15 @@ var ts; case 110: case 111: case 112: + case 128: nextToken(); if (scanner.hasPrecedingLineBreak()) { return false; } continue; + case 137: + nextToken(); + return token === 15 || token === 69 || token === 82; case 89: nextToken(); return token === 9 || token === 37 || @@ -8723,7 +9814,8 @@ var ts; case 82: nextToken(); if (token === 56 || token === 37 || - token === 15 || token === 77) { + token === 15 || token === 77 || + token === 116) { return true; } continue; @@ -8772,12 +9864,14 @@ var ts; case 107: case 125: case 126: - case 132: + case 134: + case 137: return true; case 112: case 110: case 111: case 113: + case 128: return isStartOfDeclaration() || !lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine); default: return isStartOfExpression(); @@ -8816,9 +9910,9 @@ var ts; case 86: return parseForOrForInOrForOfStatement(); case 75: - return parseBreakOrContinueStatement(202); + return parseBreakOrContinueStatement(209); case 70: - return parseBreakOrContinueStatement(203); + return parseBreakOrContinueStatement(210); case 94: return parseReturnStatement(); case 105: @@ -8837,7 +9931,7 @@ var ts; return parseDeclaration(); case 118: case 107: - case 132: + case 134: case 125: case 126: case 122: @@ -8850,6 +9944,8 @@ var ts; case 112: case 115: case 113: + case 128: + case 137: if (isStartOfDeclaration()) { return parseDeclaration(); } @@ -8872,10 +9968,11 @@ var ts; return parseClassDeclaration(fullStart, decorators, modifiers); case 107: return parseInterfaceDeclaration(fullStart, decorators, modifiers); - case 132: + case 134: return parseTypeAliasDeclaration(fullStart, decorators, modifiers); case 81: return parseEnumDeclaration(fullStart, decorators, modifiers); + case 137: case 125: case 126: return parseModuleDeclaration(fullStart, decorators, modifiers); @@ -8883,12 +9980,18 @@ var ts; return parseImportDeclarationOrImportEqualsDeclaration(fullStart, decorators, modifiers); case 82: nextToken(); - return token === 77 || token === 56 ? - parseExportAssignment(fullStart, decorators, modifiers) : - parseExportDeclaration(fullStart, decorators, modifiers); + switch (token) { + case 77: + case 56: + return parseExportAssignment(fullStart, decorators, modifiers); + case 116: + return parseGlobalModuleExportDeclaration(fullStart, decorators, modifiers); + default: + return parseExportDeclaration(fullStart, decorators, modifiers); + } default: if (decorators || modifiers) { - var node = createMissingNode(231, true, ts.Diagnostics.Declaration_expected); + var node = createMissingNode(239, true, ts.Diagnostics.Declaration_expected); node.pos = fullStart; node.decorators = decorators; setModifiers(node, modifiers); @@ -8909,16 +10012,16 @@ var ts; } function parseArrayBindingElement() { if (token === 24) { - return createNode(187); + return createNode(193); } - var node = createNode(163); + var node = createNode(169); node.dotDotDotToken = parseOptionalToken(22); node.name = parseIdentifierOrPattern(); node.initializer = parseBindingElementInitializer(false); return finishNode(node); } function parseObjectBindingElement() { - var node = createNode(163); + var node = createNode(169); var tokenIsIdentifier = isIdentifier(); var propertyName = parsePropertyName(); if (tokenIsIdentifier && token !== 54) { @@ -8933,14 +10036,14 @@ var ts; return finishNode(node); } function parseObjectBindingPattern() { - var node = createNode(161); + var node = createNode(167); parseExpected(15); node.elements = parseDelimitedList(9, parseObjectBindingElement); parseExpected(16); return finishNode(node); } function parseArrayBindingPattern() { - var node = createNode(162); + var node = createNode(168); parseExpected(19); node.elements = parseDelimitedList(10, parseArrayBindingElement); parseExpected(20); @@ -8959,7 +10062,7 @@ var ts; return parseIdentifier(); } function parseVariableDeclaration() { - var node = createNode(211); + var node = createNode(218); node.name = parseIdentifierOrPattern(); node.type = parseTypeAnnotation(); if (!isInOrOfKeyword(token)) { @@ -8968,21 +10071,21 @@ var ts; return finishNode(node); } function parseVariableDeclarationList(inForStatementInitializer) { - var node = createNode(212); + var node = createNode(219); switch (token) { case 102: break; case 108: - node.flags |= 8192; + node.flags |= 1024; break; case 74: - node.flags |= 16384; + node.flags |= 2048; break; default: ts.Debug.fail(); } nextToken(); - if (token === 134 && lookAhead(canFollowContextualOfKeyword)) { + if (token === 138 && lookAhead(canFollowContextualOfKeyword)) { node.declarations = createMissingList(); } else { @@ -8997,15 +10100,15 @@ var ts; return nextTokenIsIdentifier() && nextToken() === 18; } function parseVariableStatement(fullStart, decorators, modifiers) { - var node = createNode(193, fullStart); + var node = createNode(200, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.declarationList = parseVariableDeclarationList(false); parseSemicolon(); - return finishNode(node); + return addJSDocComment(finishNode(node)); } function parseFunctionDeclaration(fullStart, decorators, modifiers) { - var node = createNode(213, fullStart); + var node = createNode(220, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(87); @@ -9015,19 +10118,19 @@ var ts; var isAsync = !!(node.flags & 256); fillSignature(54, isGenerator, isAsync, false, node); node.body = parseFunctionBlockOrSemicolon(isGenerator, isAsync, ts.Diagnostics.or_expected); - return finishNode(node); + return addJSDocComment(finishNode(node)); } function parseConstructorDeclaration(pos, decorators, modifiers) { - var node = createNode(144, pos); + var node = createNode(148, pos); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(121); fillSignature(54, false, false, false, node); node.body = parseFunctionBlockOrSemicolon(false, false, ts.Diagnostics.or_expected); - return finishNode(node); + return addJSDocComment(finishNode(node)); } function parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, name, questionToken, diagnosticMessage) { - var method = createNode(143, fullStart); + var method = createNode(147, fullStart); method.decorators = decorators; setModifiers(method, modifiers); method.asteriskToken = asteriskToken; @@ -9037,18 +10140,18 @@ var ts; var isAsync = !!(method.flags & 256); fillSignature(54, isGenerator, isAsync, false, method); method.body = parseFunctionBlockOrSemicolon(isGenerator, isAsync, diagnosticMessage); - return finishNode(method); + return addJSDocComment(finishNode(method)); } function parsePropertyDeclaration(fullStart, decorators, modifiers, name, questionToken) { - var property = createNode(141, fullStart); + var property = createNode(145, fullStart); property.decorators = decorators; setModifiers(property, modifiers); property.name = name; property.questionToken = questionToken; property.type = parseTypeAnnotation(); - property.initializer = modifiers && modifiers.flags & 64 + property.initializer = modifiers && modifiers.flags & 32 ? allowInAnd(parseNonParameterInitializer) - : doOutsideOfContext(2 | 1, parseNonParameterInitializer); + : doOutsideOfContext(8388608 | 4194304, parseNonParameterInitializer); parseSemicolon(); return finishNode(property); } @@ -9081,6 +10184,7 @@ var ts; case 110: case 111: case 113: + case 128: return true; default: return false; @@ -9091,7 +10195,7 @@ var ts; if (token === 55) { return true; } - while (ts.isModifier(token)) { + while (ts.isModifierKind(token)) { idToken = token; if (isClassMemberModifier(idToken)) { return true; @@ -9109,7 +10213,7 @@ var ts; return true; } if (idToken !== undefined) { - if (!ts.isKeyword(idToken) || idToken === 129 || idToken === 123) { + if (!ts.isKeyword(idToken) || idToken === 131 || idToken === 123) { return true; } switch (token) { @@ -9134,9 +10238,9 @@ var ts; } if (!decorators) { decorators = []; - decorators.pos = scanner.getStartPos(); + decorators.pos = decoratorStart; } - var decorator = createNode(139, decoratorStart); + var decorator = createNode(143, decoratorStart); decorator.expression = doInDecoratorContext(parseLeftHandSideExpressionOrHigher); decorators.push(finishNode(decorator)); } @@ -9145,14 +10249,21 @@ var ts; } return decorators; } - function parseModifiers() { + function parseModifiers(permitInvalidConstAsModifier) { var flags = 0; var modifiers; while (true) { var modifierStart = scanner.getStartPos(); var modifierKind = token; - if (!parseAnyContextualModifier()) { - break; + if (token === 74 && permitInvalidConstAsModifier) { + if (!tryParse(nextTokenIsOnSameLineAndCanFollowModifier)) { + break; + } + } + else { + if (!parseAnyContextualModifier()) { + break; + } } if (!modifiers) { modifiers = []; @@ -9185,13 +10296,13 @@ var ts; } function parseClassElement() { if (token === 23) { - var result = createNode(191); + var result = createNode(198); nextToken(); return finishNode(result); } var fullStart = getNodePos(); var decorators = parseDecorators(); - var modifiers = parseModifiers(); + var modifiers = parseModifiers(true); var accessor = tryParseAccessorDeclaration(fullStart, decorators, modifiers); if (accessor) { return accessor; @@ -9210,16 +10321,16 @@ var ts; return parsePropertyOrMethodDeclaration(fullStart, decorators, modifiers); } if (decorators || modifiers) { - var name_8 = createMissingNode(69, true, ts.Diagnostics.Declaration_expected); - return parsePropertyDeclaration(fullStart, decorators, modifiers, name_8, undefined); + var name_7 = createMissingNode(69, true, ts.Diagnostics.Declaration_expected); + return parsePropertyDeclaration(fullStart, decorators, modifiers, name_7, undefined); } ts.Debug.fail("Should not have attempted to parse class member declaration."); } function parseClassExpression() { - return parseClassDeclarationOrExpression(scanner.getStartPos(), undefined, undefined, 186); + return parseClassDeclarationOrExpression(scanner.getStartPos(), undefined, undefined, 192); } function parseClassDeclaration(fullStart, decorators, modifiers) { - return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 214); + return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 221); } function parseClassDeclarationOrExpression(fullStart, decorators, modifiers, kind) { var node = createNode(kind, fullStart); @@ -9252,12 +10363,9 @@ var ts; } return undefined; } - function parseHeritageClausesWorker() { - return parseList(20, parseHeritageClause); - } function parseHeritageClause() { if (token === 83 || token === 106) { - var node = createNode(243); + var node = createNode(251); node.token = token; nextToken(); node.types = parseDelimitedList(7, parseExpressionWithTypeArguments); @@ -9266,7 +10374,7 @@ var ts; return undefined; } function parseExpressionWithTypeArguments() { - var node = createNode(188); + var node = createNode(194); node.expression = parseLeftHandSideExpressionOrHigher(); if (token === 25) { node.typeArguments = parseBracketedList(18, parseType, 25, 27); @@ -9280,7 +10388,7 @@ var ts; return parseList(5, parseClassElement); } function parseInterfaceDeclaration(fullStart, decorators, modifiers) { - var node = createNode(215, fullStart); + var node = createNode(222, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(107); @@ -9291,10 +10399,10 @@ var ts; return finishNode(node); } function parseTypeAliasDeclaration(fullStart, decorators, modifiers) { - var node = createNode(216, fullStart); + var node = createNode(223, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - parseExpected(132); + parseExpected(134); node.name = parseIdentifier(); node.typeParameters = parseTypeParameters(); parseExpected(56); @@ -9303,13 +10411,13 @@ var ts; return finishNode(node); } function parseEnumMember() { - var node = createNode(247, scanner.getStartPos()); + var node = createNode(255, scanner.getStartPos()); node.name = parsePropertyName(); node.initializer = allowInAnd(parseNonParameterInitializer); return finishNode(node); } function parseEnumDeclaration(fullStart, decorators, modifiers) { - var node = createNode(217, fullStart); + var node = createNode(224, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(81); @@ -9324,7 +10432,7 @@ var ts; return finishNode(node); } function parseModuleBlock() { - var node = createNode(219, scanner.getStartPos()); + var node = createNode(226, scanner.getStartPos()); if (parseExpected(15)) { node.statements = parseList(1, parseStatement); parseExpected(16); @@ -9335,29 +10443,38 @@ var ts; return finishNode(node); } function parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags) { - var node = createNode(218, fullStart); - var namespaceFlag = flags & 65536; + var node = createNode(225, fullStart); + var namespaceFlag = flags & 4096; node.decorators = decorators; setModifiers(node, modifiers); node.flags |= flags; node.name = parseIdentifier(); node.body = parseOptional(21) - ? parseModuleOrNamespaceDeclaration(getNodePos(), undefined, undefined, 2 | namespaceFlag) + ? parseModuleOrNamespaceDeclaration(getNodePos(), undefined, undefined, 1 | namespaceFlag) : parseModuleBlock(); return finishNode(node); } function parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers) { - var node = createNode(218, fullStart); + var node = createNode(225, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - node.name = parseLiteralNode(true); + if (token === 137) { + node.name = parseIdentifier(); + node.flags |= 131072; + } + else { + node.name = parseLiteralNode(true); + } node.body = parseModuleBlock(); return finishNode(node); } function parseModuleDeclaration(fullStart, decorators, modifiers) { var flags = modifiers ? modifiers.flags : 0; - if (parseOptional(126)) { - flags |= 65536; + if (token === 137) { + return parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers); + } + else if (parseOptional(126)) { + flags |= 4096; } else { parseExpected(125); @@ -9368,7 +10485,7 @@ var ts; return parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags); } function isExternalModuleReference() { - return token === 127 && + return token === 129 && lookAhead(nextTokenIsOpenParen); } function nextTokenIsOpenParen() { @@ -9377,10 +10494,15 @@ var ts; function nextTokenIsSlash() { return nextToken() === 39; } - function nextTokenIsCommaOrFromKeyword() { - nextToken(); - return token === 24 || - token === 133; + function parseGlobalModuleExportDeclaration(fullStart, decorators, modifiers) { + var exportDeclaration = createNode(228, fullStart); + exportDeclaration.decorators = decorators; + exportDeclaration.modifiers = modifiers; + parseExpected(116); + parseExpected(126); + exportDeclaration.name = parseIdentifier(); + parseExpected(23); + return finishNode(exportDeclaration); } function parseImportDeclarationOrImportEqualsDeclaration(fullStart, decorators, modifiers) { parseExpected(89); @@ -9388,8 +10510,8 @@ var ts; var identifier; if (isIdentifier()) { identifier = parseIdentifier(); - if (token !== 24 && token !== 133) { - var importEqualsDeclaration = createNode(221, fullStart); + if (token !== 24 && token !== 136) { + var importEqualsDeclaration = createNode(229, fullStart); importEqualsDeclaration.decorators = decorators; setModifiers(importEqualsDeclaration, modifiers); importEqualsDeclaration.name = identifier; @@ -9399,27 +10521,27 @@ var ts; return finishNode(importEqualsDeclaration); } } - var importDeclaration = createNode(222, fullStart); + var importDeclaration = createNode(230, fullStart); importDeclaration.decorators = decorators; setModifiers(importDeclaration, modifiers); if (identifier || token === 37 || token === 15) { importDeclaration.importClause = parseImportClause(identifier, afterImportPos); - parseExpected(133); + parseExpected(136); } importDeclaration.moduleSpecifier = parseModuleSpecifier(); parseSemicolon(); return finishNode(importDeclaration); } function parseImportClause(identifier, fullStart) { - var importClause = createNode(223, fullStart); + var importClause = createNode(231, fullStart); if (identifier) { importClause.name = identifier; } if (!importClause.name || parseOptional(24)) { - importClause.namedBindings = token === 37 ? parseNamespaceImport() : parseNamedImportsOrExports(225); + importClause.namedBindings = token === 37 ? parseNamespaceImport() : parseNamedImportsOrExports(233); } return finishNode(importClause); } @@ -9429,22 +10551,25 @@ var ts; : parseEntityName(false); } function parseExternalModuleReference() { - var node = createNode(232); - parseExpected(127); + var node = createNode(240); + parseExpected(129); parseExpected(17); node.expression = parseModuleSpecifier(); parseExpected(18); return finishNode(node); } function parseModuleSpecifier() { - var result = parseExpression(); - if (result.kind === 9) { + if (token === 9) { + var result = parseLiteralNode(); internIdentifier(result.text); + return result; + } + else { + return parseExpression(); } - return result; } function parseNamespaceImport() { - var namespaceImport = createNode(224); + var namespaceImport = createNode(232); parseExpected(37); parseExpected(116); namespaceImport.name = parseIdentifier(); @@ -9452,14 +10577,14 @@ var ts; } function parseNamedImportsOrExports(kind) { var node = createNode(kind); - node.elements = parseBracketedList(21, kind === 225 ? parseImportSpecifier : parseExportSpecifier, 15, 16); + node.elements = parseBracketedList(21, kind === 233 ? parseImportSpecifier : parseExportSpecifier, 15, 16); return finishNode(node); } function parseExportSpecifier() { - return parseImportOrExportSpecifier(230); + return parseImportOrExportSpecifier(238); } function parseImportSpecifier() { - return parseImportOrExportSpecifier(226); + return parseImportOrExportSpecifier(234); } function parseImportOrExportSpecifier(kind) { var node = createNode(kind); @@ -9478,23 +10603,23 @@ var ts; else { node.name = identifierName; } - if (kind === 226 && checkIdentifierIsKeyword) { + if (kind === 234 && checkIdentifierIsKeyword) { parseErrorAtPosition(checkIdentifierStart, checkIdentifierEnd - checkIdentifierStart, ts.Diagnostics.Identifier_expected); } return finishNode(node); } function parseExportDeclaration(fullStart, decorators, modifiers) { - var node = createNode(228, fullStart); + var node = createNode(236, fullStart); node.decorators = decorators; setModifiers(node, modifiers); if (parseOptional(37)) { - parseExpected(133); + parseExpected(136); node.moduleSpecifier = parseModuleSpecifier(); } else { - node.exportClause = parseNamedImportsOrExports(229); - if (token === 133 || (token === 9 && !scanner.hasPrecedingLineBreak())) { - parseExpected(133); + node.exportClause = parseNamedImportsOrExports(237); + if (token === 136 || (token === 9 && !scanner.hasPrecedingLineBreak())) { + parseExpected(136); node.moduleSpecifier = parseModuleSpecifier(); } } @@ -9502,7 +10627,7 @@ var ts; return finishNode(node); } function parseExportAssignment(fullStart, decorators, modifiers) { - var node = createNode(227, fullStart); + var node = createNode(235, fullStart); node.decorators = decorators; setModifiers(node, modifiers); if (parseOptional(56)) { @@ -9518,15 +10643,18 @@ var ts; function processReferenceComments(sourceFile) { var triviaScanner = ts.createScanner(sourceFile.languageVersion, false, 0, sourceText); var referencedFiles = []; + var typeReferenceDirectives = []; var amdDependencies = []; var amdModuleName; while (true) { var kind = triviaScanner.scan(); - if (kind === 5 || kind === 4 || kind === 3) { - continue; - } if (kind !== 2) { - break; + if (ts.isTrivia(kind)) { + continue; + } + else { + break; + } } var range = { pos: triviaScanner.getTokenPos(), end: triviaScanner.getTextPos(), kind: triviaScanner.getToken() }; var comment = sourceText.substring(range.pos, range.end); @@ -9536,7 +10664,12 @@ var ts; sourceFile.hasNoDefaultLib = referencePathMatchResult.isNoDefaultLib; var diagnosticMessage = referencePathMatchResult.diagnosticMessage; if (fileReference) { - referencedFiles.push(fileReference); + if (referencePathMatchResult.isTypeReferenceDirective) { + typeReferenceDirectives.push(fileReference); + } + else { + referencedFiles.push(fileReference); + } } if (diagnosticMessage) { parseDiagnostics.push(ts.createFileDiagnostic(sourceFile, range.pos, range.end - range.pos, diagnosticMessage)); @@ -9566,16 +10699,17 @@ var ts; } } sourceFile.referencedFiles = referencedFiles; + sourceFile.typeReferenceDirectives = typeReferenceDirectives; sourceFile.amdDependencies = amdDependencies; sourceFile.moduleName = amdModuleName; } function setExternalModuleIndicator(sourceFile) { sourceFile.externalModuleIndicator = ts.forEach(sourceFile.statements, function (node) { - return node.flags & 2 - || node.kind === 221 && node.moduleReference.kind === 232 - || node.kind === 222 - || node.kind === 227 - || node.kind === 228 + return node.flags & 1 + || node.kind === 229 && node.moduleReference.kind === 240 + || node.kind === 230 + || node.kind === 235 + || node.kind === 236 ? node : undefined; }); @@ -9600,17 +10734,17 @@ var ts; } JSDocParser.isJSDocType = isJSDocType; function parseJSDocTypeExpressionForTests(content, start, length) { - initializeState("file.js", content, 2, true, undefined); - var jsDocTypeExpression = parseJSDocTypeExpression(start, length); + initializeState("file.js", content, 2, undefined, 1); + scanner.setText(content, start, length); + token = scanner.scan(); + var jsDocTypeExpression = parseJSDocTypeExpression(); var diagnostics = parseDiagnostics; clearState(); return jsDocTypeExpression ? { jsDocTypeExpression: jsDocTypeExpression, diagnostics: diagnostics } : undefined; } JSDocParser.parseJSDocTypeExpressionForTests = parseJSDocTypeExpressionForTests; - function parseJSDocTypeExpression(start, length) { - scanner.setText(sourceText, start, length); - token = nextToken(); - var result = createNode(249); + function parseJSDocTypeExpression() { + var result = createNode(257, scanner.getTokenPos()); parseExpected(15); result.type = parseJSDocTopLevelType(); parseExpected(16); @@ -9621,12 +10755,12 @@ var ts; function parseJSDocTopLevelType() { var type = parseJSDocType(); if (token === 47) { - var unionType = createNode(253, type.pos); + var unionType = createNode(261, type.pos); unionType.types = parseJSDocTypeList(type); type = finishNode(unionType); } if (token === 56) { - var optionalType = createNode(260, type.pos); + var optionalType = createNode(268, type.pos); nextToken(); optionalType.type = type; type = finishNode(optionalType); @@ -9637,20 +10771,20 @@ var ts; var type = parseBasicTypeExpression(); while (true) { if (token === 19) { - var arrayType = createNode(252, type.pos); + var arrayType = createNode(260, type.pos); arrayType.elementType = type; nextToken(); parseExpected(20); type = finishNode(arrayType); } else if (token === 53) { - var nullableType = createNode(255, type.pos); + var nullableType = createNode(263, type.pos); nullableType.type = type; nextToken(); type = finishNode(nullableType); } else if (token === 49) { - var nonNullableType = createNode(256, type.pos); + var nonNullableType = createNode(264, type.pos); nonNullableType.type = type; nextToken(); type = finishNode(nonNullableType); @@ -9684,37 +10818,37 @@ var ts; case 97: return parseJSDocThisType(); case 117: + case 132: case 130: - case 128: case 120: - case 131: + case 133: case 103: return parseTokenNode(); } return parseJSDocTypeReference(); } function parseJSDocThisType() { - var result = createNode(264); + var result = createNode(272); nextToken(); parseExpected(54); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocConstructorType() { - var result = createNode(263); + var result = createNode(271); nextToken(); parseExpected(54); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocVariadicType() { - var result = createNode(262); + var result = createNode(270); nextToken(); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocFunctionType() { - var result = createNode(261); + var result = createNode(269); nextToken(); parseExpected(17); result.parameters = parseDelimitedList(22, parseJSDocParameter); @@ -9727,26 +10861,28 @@ var ts; return finishNode(result); } function parseJSDocParameter() { - var parameter = createNode(138); + var parameter = createNode(142); parameter.type = parseJSDocType(); + if (parseOptional(56)) { + parameter.questionToken = createNode(56); + } return finishNode(parameter); } - function parseJSDocOptionalType(type) { - var result = createNode(260, type.pos); - nextToken(); - result.type = type; - return finishNode(result); - } function parseJSDocTypeReference() { - var result = createNode(259); + var result = createNode(267); result.name = parseSimplePropertyName(); - while (parseOptional(21)) { - if (token === 25) { - result.typeArguments = parseTypeArguments(); - break; - } - else { - result.name = parseQualifiedName(result.name); + if (token === 25) { + result.typeArguments = parseTypeArguments(); + } + else { + while (parseOptional(21)) { + if (token === 25) { + result.typeArguments = parseTypeArguments(); + break; + } + else { + result.name = parseQualifiedName(result.name); + } } } return finishNode(result); @@ -9767,13 +10903,13 @@ var ts; } } function parseQualifiedName(left) { - var result = createNode(135, left.pos); + var result = createNode(139, left.pos); result.left = left; result.right = parseIdentifierName(); return finishNode(result); } function parseJSDocRecordType() { - var result = createNode(257); + var result = createNode(265); nextToken(); result.members = parseDelimitedList(24, parseJSDocRecordMember); checkForTrailingComma(result.members); @@ -9781,7 +10917,7 @@ var ts; return finishNode(result); } function parseJSDocRecordMember() { - var result = createNode(258); + var result = createNode(266); result.name = parseSimplePropertyName(); if (token === 54) { nextToken(); @@ -9790,13 +10926,13 @@ var ts; return finishNode(result); } function parseJSDocNonNullableType() { - var result = createNode(256); + var result = createNode(264); nextToken(); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocTupleType() { - var result = createNode(254); + var result = createNode(262); nextToken(); result.types = parseDelimitedList(25, parseJSDocType); checkForTrailingComma(result.types); @@ -9810,7 +10946,7 @@ var ts; } } function parseJSDocUnionType() { - var result = createNode(253); + var result = createNode(261); nextToken(); result.types = parseJSDocTypeList(parseJSDocType()); parseExpected(18); @@ -9828,7 +10964,7 @@ var ts; return types; } function parseJSDocAllType() { - var result = createNode(250); + var result = createNode(258); nextToken(); return finishNode(result); } @@ -9841,29 +10977,35 @@ var ts; token === 27 || token === 56 || token === 47) { - var result = createNode(251, pos); + var result = createNode(259, pos); return finishNode(result); } else { - var result = createNode(255, pos); + var result = createNode(263, pos); result.type = parseJSDocType(); return finishNode(result); } } function parseIsolatedJSDocComment(content, start, length) { - initializeState("file.js", content, 2, true, undefined); - var jsDocComment = parseJSDocComment(undefined, start, length); + initializeState("file.js", content, 2, undefined, 1); + sourceFile = { languageVariant: 0, text: content }; + var jsDocComment = parseJSDocCommentWorker(start, length); var diagnostics = parseDiagnostics; clearState(); return jsDocComment ? { jsDocComment: jsDocComment, diagnostics: diagnostics } : undefined; } JSDocParser.parseIsolatedJSDocComment = parseIsolatedJSDocComment; function parseJSDocComment(parent, start, length) { + var saveToken = token; + var saveParseDiagnosticsLength = parseDiagnostics.length; + var saveParseErrorBeforeNextFinishedNode = parseErrorBeforeNextFinishedNode; var comment = parseJSDocCommentWorker(start, length); if (comment) { - fixupParentReferences(comment); comment.parent = parent; } + token = saveToken; + parseDiagnostics.length = saveParseDiagnosticsLength; + parseErrorBeforeNextFinishedNode = saveParseErrorBeforeNextFinishedNode; return comment; } JSDocParser.parseJSDocComment = parseJSDocComment; @@ -9876,60 +11018,64 @@ var ts; ts.Debug.assert(start <= end); ts.Debug.assert(end <= content.length); var tags; - var pos; - if (length >= "/** */".length) { - if (content.charCodeAt(start) === 47 && - content.charCodeAt(start + 1) === 42 && - content.charCodeAt(start + 2) === 42 && - content.charCodeAt(start + 3) !== 42) { + var result; + if (content.charCodeAt(start) === 47 && + content.charCodeAt(start + 1) === 42 && + content.charCodeAt(start + 2) === 42 && + content.charCodeAt(start + 3) !== 42) { + scanner.scanRange(start + 3, length - 5, function () { var canParseTag = true; var seenAsterisk = true; - for (pos = start + "/**".length; pos < end;) { - var ch = content.charCodeAt(pos); - pos++; - if (ch === 64 && canParseTag) { - parseTag(); - canParseTag = false; - continue; - } - if (ts.isLineBreak(ch)) { - canParseTag = true; - seenAsterisk = false; - continue; - } - if (ts.isWhiteSpace(ch)) { - continue; - } - if (ch === 42) { - if (seenAsterisk) { + nextJSDocToken(); + while (token !== 1) { + switch (token) { + case 55: + if (canParseTag) { + parseTag(); + } + seenAsterisk = false; + break; + case 4: + canParseTag = true; + seenAsterisk = false; + break; + case 37: + if (seenAsterisk) { + canParseTag = false; + } + seenAsterisk = true; + break; + case 69: canParseTag = false; - } - seenAsterisk = true; - continue; + break; + case 1: + break; } - canParseTag = false; + nextJSDocToken(); } - } + result = createJSDocComment(); + }); } - return createJSDocComment(); + return result; function createJSDocComment() { if (!tags) { return undefined; } - var result = createNode(265, start); + var result = createNode(273, start); result.tags = tags; return finishNode(result, end); } function skipWhitespace() { - while (pos < end && ts.isWhiteSpace(content.charCodeAt(pos))) { - pos++; + while (token === 5 || token === 4) { + nextJSDocToken(); } } function parseTag() { - ts.Debug.assert(content.charCodeAt(pos - 1) === 64); - var atToken = createNode(55, pos - 1); - atToken.end = pos; - var tagName = scanIdentifier(); + ts.Debug.assert(token === 55); + var atToken = createNode(55, scanner.getTokenPos()); + atToken.end = scanner.getTextPos(); + nextJSDocToken(); + var tagName = parseJSDocIdentifierName(); if (!tagName) { return; } @@ -9953,10 +11099,10 @@ var ts; return undefined; } function handleUnknownTag(atToken, tagName) { - var result = createNode(266, atToken.pos); + var result = createNode(274, atToken.pos); result.atToken = atToken; result.tagName = tagName; - return finishNode(result, pos); + return finishNode(result); } function addTag(tag) { if (tag) { @@ -9969,12 +11115,10 @@ var ts; } } function tryParseTypeExpression() { - skipWhitespace(); - if (content.charCodeAt(pos) !== 123) { + if (token !== 15) { return undefined; } - var typeExpression = parseJSDocTypeExpression(pos, end - pos); - pos = typeExpression.end; + var typeExpression = parseJSDocTypeExpression(); return typeExpression; } function handleParamTag(atToken, tagName) { @@ -9982,17 +11126,20 @@ var ts; skipWhitespace(); var name; var isBracketed; - if (content.charCodeAt(pos) === 91) { - pos++; - skipWhitespace(); - name = scanIdentifier(); + if (parseOptionalToken(19)) { + name = parseJSDocIdentifierName(); isBracketed = true; + if (parseOptionalToken(56)) { + parseExpression(); + } + parseExpected(20); } - else { - name = scanIdentifier(); + else if (ts.tokenIsIdentifierOrKeyword(token)) { + name = parseJSDocIdentifierName(); } if (!name) { - parseErrorAtPosition(pos, 0, ts.Diagnostics.Identifier_expected); + parseErrorAtPosition(scanner.getStartPos(), 0, ts.Diagnostics.Identifier_expected); + return undefined; } var preName, postName; if (typeExpression) { @@ -10004,84 +11151,84 @@ var ts; if (!typeExpression) { typeExpression = tryParseTypeExpression(); } - var result = createNode(267, atToken.pos); + var result = createNode(275, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.preParameterName = preName; result.typeExpression = typeExpression; result.postParameterName = postName; result.isBracketed = isBracketed; - return finishNode(result, pos); + return finishNode(result); } function handleReturnTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 268; })) { - parseErrorAtPosition(tagName.pos, pos - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); + if (ts.forEach(tags, function (t) { return t.kind === 276; })) { + parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } - var result = createNode(268, atToken.pos); + var result = createNode(276, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); - return finishNode(result, pos); + return finishNode(result); } function handleTypeTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 269; })) { - parseErrorAtPosition(tagName.pos, pos - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); + if (ts.forEach(tags, function (t) { return t.kind === 277; })) { + parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } - var result = createNode(269, atToken.pos); + var result = createNode(277, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); - return finishNode(result, pos); + return finishNode(result); } function handleTemplateTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 270; })) { - parseErrorAtPosition(tagName.pos, pos - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); + if (ts.forEach(tags, function (t) { return t.kind === 278; })) { + parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } var typeParameters = []; - typeParameters.pos = pos; + typeParameters.pos = scanner.getStartPos(); while (true) { - skipWhitespace(); - var startPos = pos; - var name_9 = scanIdentifier(); - if (!name_9) { - parseErrorAtPosition(startPos, 0, ts.Diagnostics.Identifier_expected); + var name_8 = parseJSDocIdentifierName(); + if (!name_8) { + parseErrorAtPosition(scanner.getStartPos(), 0, ts.Diagnostics.Identifier_expected); return undefined; } - var typeParameter = createNode(137, name_9.pos); - typeParameter.name = name_9; - finishNode(typeParameter, pos); + var typeParameter = createNode(141, name_8.pos); + typeParameter.name = name_8; + finishNode(typeParameter); typeParameters.push(typeParameter); - skipWhitespace(); - if (content.charCodeAt(pos) !== 44) { + if (token === 24) { + nextJSDocToken(); + } + else { break; } - pos++; } - typeParameters.end = pos; - var result = createNode(270, atToken.pos); + var result = createNode(278, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeParameters = typeParameters; - return finishNode(result, pos); + finishNode(result); + typeParameters.end = result.end; + return result; } - function scanIdentifier() { - var startPos = pos; - for (; pos < end; pos++) { - var ch = content.charCodeAt(pos); - if (pos === startPos && ts.isIdentifierStart(ch, 2)) { - continue; - } - else if (pos > startPos && ts.isIdentifierPart(ch, 2)) { - continue; - } - break; - } - if (startPos === pos) { + function nextJSDocToken() { + return token = scanner.scanJSDocToken(); + } + function parseJSDocIdentifierName() { + return createJSDocIdentifier(ts.tokenIsIdentifierOrKeyword(token)); + } + function createJSDocIdentifier(isIdentifier) { + if (!isIdentifier) { + parseErrorAtCurrentToken(ts.Diagnostics.Identifier_expected); return undefined; } - var result = createNode(69, startPos); - result.text = content.substring(startPos, pos); - return finishNode(result, pos); + var pos = scanner.getTokenPos(); + var end = scanner.getTextPos(); + var result = createNode(69, pos); + result.text = content.substring(pos, end); + finishNode(result, end); + nextJSDocToken(); + return result; } } JSDocParser.parseJSDocCommentWorker = parseJSDocCommentWorker; @@ -10096,7 +11243,7 @@ var ts; return sourceFile; } if (sourceFile.statements.length === 0) { - return Parser.parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, undefined, true); + return Parser.parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, undefined, true, sourceFile.scriptKind); } var incrementalSourceFile = sourceFile; ts.Debug.assert(!incrementalSourceFile.hasBeenIncrementallyParsed); @@ -10110,7 +11257,7 @@ var ts; ts.Debug.assert(ts.textSpanEnd(ts.textChangeRangeNewSpan(changeRange)) === ts.textSpanEnd(ts.textChangeRangeNewSpan(textChangeRange))); var delta = ts.textChangeRangeNewSpan(changeRange).length - changeRange.span.length; updateTokenPositionsAndMarkElements(incrementalSourceFile, changeRange.span.start, ts.textSpanEnd(changeRange.span), ts.textSpanEnd(ts.textChangeRangeNewSpan(changeRange)), delta, oldText, newText, aggressiveChecks); - var result = Parser.parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, syntaxCursor, true); + var result = Parser.parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, syntaxCursor, true, sourceFile.scriptKind); return result; } IncrementalParser.updateSourceFile = updateSourceFile; @@ -10179,12 +11326,12 @@ var ts; } function checkNodePositions(node, aggressiveChecks) { if (aggressiveChecks) { - var pos = node.pos; + var pos_2 = node.pos; forEachChild(node, function (child) { - ts.Debug.assert(child.pos >= pos); - pos = child.end; + ts.Debug.assert(child.pos >= pos_2); + pos_2 = child.end; }); - ts.Debug.assert(pos <= node.end); + ts.Debug.assert(pos_2 <= node.end); } } function updateTokenPositionsAndMarkElements(sourceFile, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta, oldText, newText, aggressiveChecks) { @@ -10372,40 +11519,33 @@ var ts; var ts; (function (ts) { ts.bindTime = 0; - function or(state1, state2) { - return (state1 | state2) & 2 - ? 2 - : (state1 & state2) & 8 - ? 8 - : 4; - } function getModuleInstanceState(node) { - if (node.kind === 215 || node.kind === 216) { + if (node.kind === 222 || node.kind === 223) { return 0; } else if (ts.isConstEnumDeclaration(node)) { return 2; } - else if ((node.kind === 222 || node.kind === 221) && !(node.flags & 2)) { + else if ((node.kind === 230 || node.kind === 229) && !(node.flags & 1)) { return 0; } - else if (node.kind === 219) { - var state = 0; + else if (node.kind === 226) { + var state_1 = 0; ts.forEachChild(node, function (n) { switch (getModuleInstanceState(n)) { case 0: return false; case 2: - state = 2; + state_1 = 2; return false; case 1: - state = 1; + state_1 = 1; return true; } }); - return state; + return state_1; } - else if (node.kind === 218) { + else if (node.kind === 225) { return getModuleInstanceState(node.body); } else { @@ -10423,40 +11563,64 @@ var ts; function createBinder() { var file; var options; + var languageVersion; var parent; var container; var blockScopeContainer; var lastContainer; var seenThisKeyword; var hasExplicitReturn; - var currentReachabilityState; - var labelStack; - var labelIndexMap; - var implicitLabels; + var currentFlow; + var currentBreakTarget; + var currentContinueTarget; + var currentTrueTarget; + var currentFalseTarget; + var preSwitchCaseFlow; + var activeLabels; + var hasClassExtends; + var hasAsyncFunctions; + var hasDecorators; + var hasParameterDecorators; + var hasJsxSpreadAttribute; var inStrictMode; var symbolCount = 0; var Symbol; var classifiableNames; + var unreachableFlow = { flags: 1 }; + var reportedUnreachableFlow = { flags: 1 }; function bindSourceFile(f, opts) { file = f; options = opts; + languageVersion = ts.getEmitScriptTarget(options); inStrictMode = !!file.externalModuleIndicator; classifiableNames = {}; + symbolCount = 0; Symbol = ts.objectAllocator.getSymbolConstructor(); if (!file.locals) { bind(file); file.symbolCount = symbolCount; file.classifiableNames = classifiableNames; } + file = undefined; + options = undefined; + languageVersion = undefined; parent = undefined; container = undefined; blockScopeContainer = undefined; lastContainer = undefined; seenThisKeyword = false; hasExplicitReturn = false; - labelStack = undefined; - labelIndexMap = undefined; - implicitLabels = undefined; + currentFlow = undefined; + currentBreakTarget = undefined; + currentContinueTarget = undefined; + currentTrueTarget = undefined; + currentFalseTarget = undefined; + activeLabels = undefined; + hasClassExtends = false; + hasAsyncFunctions = false; + hasDecorators = false; + hasParameterDecorators = false; + hasJsxSpreadAttribute = false; } return bindSourceFile; function createSymbol(flags, name) { @@ -10476,16 +11640,20 @@ var ts; if (symbolFlags & 6240 && !symbol.members) { symbol.members = {}; } - if (symbolFlags & 107455 && !symbol.valueDeclaration) { - symbol.valueDeclaration = node; + if (symbolFlags & 107455) { + var valueDeclaration = symbol.valueDeclaration; + if (!valueDeclaration || + (valueDeclaration.kind !== node.kind && valueDeclaration.kind === 225)) { + symbol.valueDeclaration = node; + } } } function getDeclarationName(node) { if (node.name) { - if (node.kind === 218 && node.name.kind === 9) { - return "\"" + node.name.text + "\""; + if (ts.isAmbientModule(node)) { + return ts.isGlobalScopeAugmentation(node) ? "__global" : "\"" + node.name.text + "\""; } - if (node.name.kind === 136) { + if (node.name.kind === 140) { var nameExpression = node.name.expression; if (ts.isStringOrNumericLiteral(nameExpression.kind)) { return nameExpression.text; @@ -10496,25 +11664,42 @@ var ts; return node.name.text; } switch (node.kind) { - case 144: - return "__constructor"; - case 152: - case 147: - return "__call"; - case 153: case 148: + return "__constructor"; + case 156: + case 151: + return "__call"; + case 157: + case 152: return "__new"; - case 149: + case 153: return "__index"; - case 228: + case 236: return "__export"; - case 227: + case 235: return node.isExportEquals ? "export=" : "default"; - case 181: - return "export="; - case 213: - case 214: + case 187: + switch (ts.getSpecialPropertyAssignmentKind(node)) { + case 2: + return "export="; + case 1: + case 4: + return node.left.name.text; + case 3: + return node.left.expression.name.text; + } + ts.Debug.fail("Unknown binary declaration kind"); + break; + case 220: + case 221: return node.flags & 512 ? "default" : undefined; + case 269: + return ts.isJSDocConstructSignature(node) ? "__new" : "__call"; + case 142: + ts.Debug.assert(node.parent.kind === 269); + var functionType = node.parent; + var index = ts.indexOf(functionType.parameters, node); + return "p" + index; } } function getDisplayName(node) { @@ -10536,18 +11721,18 @@ var ts; if (node.name) { node.name.parent = node; } - var message = symbol.flags & 2 + var message_1 = symbol.flags & 2 ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0; ts.forEach(symbol.declarations, function (declaration) { if (declaration.flags & 512) { - message = ts.Diagnostics.A_module_cannot_have_multiple_default_exports; + message_1 = ts.Diagnostics.A_module_cannot_have_multiple_default_exports; } }); ts.forEach(symbol.declarations, function (declaration) { - file.bindDiagnostics.push(ts.createDiagnosticForNode(declaration.name || declaration, message, getDisplayName(declaration))); + file.bindDiagnostics.push(ts.createDiagnosticForNode(declaration.name || declaration, message_1, getDisplayName(declaration))); }); - file.bindDiagnostics.push(ts.createDiagnosticForNode(node.name || node, message, getDisplayName(node))); + file.bindDiagnostics.push(ts.createDiagnosticForNode(node.name || node, message_1, getDisplayName(node))); symbol = createSymbol(0, name); } } @@ -10559,9 +11744,9 @@ var ts; return symbol; } function declareModuleMember(node, symbolFlags, symbolExcludes) { - var hasExportModifier = ts.getCombinedNodeFlags(node) & 2; + var hasExportModifier = ts.getCombinedNodeFlags(node) & 1; if (symbolFlags & 8388608) { - if (node.kind === 230 || (node.kind === 221 && hasExportModifier)) { + if (node.kind === 238 || (node.kind === 229 && hasExportModifier)) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); } else { @@ -10569,7 +11754,7 @@ var ts; } } else { - if (hasExportModifier || container.flags & 131072) { + if (!ts.isAmbientModule(node) && (hasExportModifier || container.flags & 8192)) { var exportKind = (symbolFlags & 107455 ? 1048576 : 0) | (symbolFlags & 793056 ? 2097152 : 0) | (symbolFlags & 1536 ? 4194304 : 0); @@ -10600,45 +11785,68 @@ var ts; blockScopeContainer = node; blockScopeContainer.locals = undefined; } - var savedReachabilityState; - var savedLabelStack; - var savedLabels; - var savedImplicitLabels; var savedHasExplicitReturn; + var savedCurrentFlow; + var savedBreakTarget; + var savedContinueTarget; + var savedActiveLabels; var kind = node.kind; var flags = node.flags; - flags &= ~1572864; - if (kind === 215) { + flags &= ~98304; + flags &= ~3932160; + if (kind === 222) { seenThisKeyword = false; } - var saveState = kind === 248 || kind === 219 || ts.isFunctionLikeKind(kind); + var saveState = kind === 256 || kind === 226 || ts.isFunctionLikeKind(kind); if (saveState) { - savedReachabilityState = currentReachabilityState; - savedLabelStack = labelStack; - savedLabels = labelIndexMap; - savedImplicitLabels = implicitLabels; savedHasExplicitReturn = hasExplicitReturn; - currentReachabilityState = 2; + savedCurrentFlow = currentFlow; + savedBreakTarget = currentBreakTarget; + savedContinueTarget = currentContinueTarget; + savedActiveLabels = activeLabels; hasExplicitReturn = false; - labelStack = labelIndexMap = implicitLabels = undefined; + currentFlow = { flags: 2 }; + currentBreakTarget = undefined; + currentContinueTarget = undefined; + activeLabels = undefined; + } + if (ts.isInJavaScriptFile(node) && node.jsDocComment) { + bind(node.jsDocComment); } bindReachableStatement(node); - if (currentReachabilityState === 2 && ts.isFunctionLikeKind(kind) && ts.nodeIsPresent(node.body)) { - flags |= 524288; + if (!(currentFlow.flags & 1) && ts.isFunctionLikeKind(kind) && ts.nodeIsPresent(node.body)) { + flags |= 32768; if (hasExplicitReturn) { - flags |= 1048576; + flags |= 65536; } } - if (kind === 215) { - flags = seenThisKeyword ? flags | 262144 : flags & ~262144; + if (kind === 222) { + flags = seenThisKeyword ? flags | 16384 : flags & ~16384; + } + if (kind === 256) { + if (hasClassExtends) { + flags |= 262144; + } + if (hasDecorators) { + flags |= 524288; + } + if (hasParameterDecorators) { + flags |= 1048576; + } + if (hasAsyncFunctions) { + flags |= 2097152; + } + if (hasJsxSpreadAttribute) { + flags |= 1073741824; + } } node.flags = flags; if (saveState) { hasExplicitReturn = savedHasExplicitReturn; - currentReachabilityState = savedReachabilityState; - labelStack = savedLabelStack; - labelIndexMap = savedLabels; - implicitLabels = savedImplicitLabels; + currentFlow = savedCurrentFlow; + currentBreakTarget = savedBreakTarget; + currentContinueTarget = savedContinueTarget; + activeLabels = savedActiveLabels; } container = saveContainer; parent = saveParent; @@ -10650,185 +11858,562 @@ var ts; return; } switch (node.kind) { - case 198: + case 205: bindWhileStatement(node); break; - case 197: + case 204: bindDoStatement(node); break; - case 199: + case 206: bindForStatement(node); break; - case 200: - case 201: + case 207: + case 208: bindForInOrForOfStatement(node); break; - case 196: + case 203: bindIfStatement(node); break; - case 204: - case 208: + case 211: + case 215: bindReturnOrThrow(node); break; - case 203: - case 202: + case 210: + case 209: bindBreakOrContinueStatement(node); break; - case 209: + case 216: bindTryStatement(node); break; - case 206: + case 213: bindSwitchStatement(node); break; - case 220: + case 227: bindCaseBlock(node); break; - case 207: + case 214: bindLabeledStatement(node); break; + case 185: + bindPrefixUnaryExpressionFlow(node); + break; + case 187: + bindBinaryExpressionFlow(node); + break; + case 181: + bindDeleteExpressionFlow(node); + break; + case 188: + bindConditionalExpressionFlow(node); + break; + case 218: + bindVariableDeclarationFlow(node); + break; default: ts.forEachChild(node, bind); break; } } - function bindWhileStatement(n) { - var preWhileState = n.expression.kind === 84 ? 4 : currentReachabilityState; - var postWhileState = n.expression.kind === 99 ? 4 : currentReachabilityState; - bind(n.expression); - currentReachabilityState = preWhileState; - var postWhileLabel = pushImplicitLabel(); - bind(n.statement); - popImplicitLabel(postWhileLabel, postWhileState); + function isNarrowableReference(expr) { + return expr.kind === 69 || + expr.kind === 97 || + expr.kind === 172 && isNarrowableReference(expr.expression); } - function bindDoStatement(n) { - var preDoState = currentReachabilityState; - var postDoLabel = pushImplicitLabel(); - bind(n.statement); - var postDoState = n.expression.kind === 99 ? 4 : preDoState; - popImplicitLabel(postDoLabel, postDoState); - bind(n.expression); - } - function bindForStatement(n) { - var preForState = currentReachabilityState; - var postForLabel = pushImplicitLabel(); - bind(n.initializer); - bind(n.condition); - bind(n.incrementor); - bind(n.statement); - var isInfiniteLoop = (!n.condition || n.condition.kind === 99); - var postForState = isInfiniteLoop ? 4 : preForState; - popImplicitLabel(postForLabel, postForState); - } - function bindForInOrForOfStatement(n) { - var preStatementState = currentReachabilityState; - var postStatementLabel = pushImplicitLabel(); - bind(n.initializer); - bind(n.expression); - bind(n.statement); - popImplicitLabel(postStatementLabel, preStatementState); - } - function bindIfStatement(n) { - var ifTrueState = n.expression.kind === 84 ? 4 : currentReachabilityState; - var ifFalseState = n.expression.kind === 99 ? 4 : currentReachabilityState; - currentReachabilityState = ifTrueState; - bind(n.expression); - bind(n.thenStatement); - if (n.elseStatement) { - var preElseState = currentReachabilityState; - currentReachabilityState = ifFalseState; - bind(n.elseStatement); - currentReachabilityState = or(currentReachabilityState, preElseState); + function isNarrowingExpression(expr) { + switch (expr.kind) { + case 69: + case 97: + case 172: + return isNarrowableReference(expr); + case 174: + return true; + case 178: + return isNarrowingExpression(expr.expression); + case 187: + return isNarrowingBinaryExpression(expr); + case 185: + return expr.operator === 49 && isNarrowingExpression(expr.operand); } - else { - currentReachabilityState = or(currentReachabilityState, ifFalseState); + return false; + } + function isNarrowingBinaryExpression(expr) { + switch (expr.operatorToken.kind) { + case 56: + return isNarrowableReference(expr.left); + case 30: + case 31: + case 32: + case 33: + if (isNarrowingExpression(expr.left) && (expr.right.kind === 93 || expr.right.kind === 69)) { + return true; + } + if (expr.left.kind === 182 && isNarrowingExpression(expr.left.expression) && expr.right.kind === 9) { + return true; + } + return false; + case 91: + return isNarrowingExpression(expr.left); + case 24: + return isNarrowingExpression(expr.right); + } + return false; + } + function createBranchLabel() { + return { + flags: 4, + antecedents: undefined + }; + } + function createLoopLabel() { + return { + flags: 8, + antecedents: undefined + }; + } + function setFlowNodeReferenced(flow) { + flow.flags |= flow.flags & 128 ? 256 : 128; + } + function addAntecedent(label, antecedent) { + if (!(antecedent.flags & 1) && !ts.contains(label.antecedents, antecedent)) { + (label.antecedents || (label.antecedents = [])).push(antecedent); + setFlowNodeReferenced(antecedent); } } - function bindReturnOrThrow(n) { - bind(n.expression); - if (n.kind === 204) { - hasExplicitReturn = true; + function createFlowCondition(flags, antecedent, expression) { + if (antecedent.flags & 1) { + return antecedent; } - currentReachabilityState = 4; - } - function bindBreakOrContinueStatement(n) { - bind(n.label); - var isValidJump = jumpToLabel(n.label, n.kind === 203 ? currentReachabilityState : 4); - if (isValidJump) { - currentReachabilityState = 4; + if (!expression) { + return flags & 32 ? antecedent : unreachableFlow; } + if (expression.kind === 99 && flags & 64 || + expression.kind === 84 && flags & 32) { + return unreachableFlow; + } + if (!isNarrowingExpression(expression)) { + return antecedent; + } + setFlowNodeReferenced(antecedent); + return { + flags: flags, + antecedent: antecedent, + expression: expression + }; } - function bindTryStatement(n) { - var preTryState = currentReachabilityState; - bind(n.tryBlock); - var postTryState = currentReachabilityState; - currentReachabilityState = preTryState; - bind(n.catchClause); - var postCatchState = currentReachabilityState; - currentReachabilityState = preTryState; - bind(n.finallyBlock); - currentReachabilityState = or(postTryState, postCatchState); + function createFlowAssignment(antecedent, node) { + setFlowNodeReferenced(antecedent); + return { + flags: 16, + antecedent: antecedent, + node: node + }; } - function bindSwitchStatement(n) { - var preSwitchState = currentReachabilityState; - var postSwitchLabel = pushImplicitLabel(); - bind(n.expression); - bind(n.caseBlock); - var hasDefault = ts.forEach(n.caseBlock.clauses, function (c) { return c.kind === 242; }); - var postSwitchState = hasDefault && currentReachabilityState !== 2 ? 4 : preSwitchState; - popImplicitLabel(postSwitchLabel, postSwitchState); + function finishFlowLabel(flow) { + var antecedents = flow.antecedents; + if (!antecedents) { + return unreachableFlow; + } + if (antecedents.length === 1) { + return antecedents[0]; + } + return flow; } - function bindCaseBlock(n) { - var startState = currentReachabilityState; - for (var _i = 0, _a = n.clauses; _i < _a.length; _i++) { - var clause = _a[_i]; - currentReachabilityState = startState; - bind(clause); - if (clause.statements.length && currentReachabilityState === 2 && options.noFallthroughCasesInSwitch) { - errorOnFirstToken(clause, ts.Diagnostics.Fallthrough_case_in_switch); + function isStatementCondition(node) { + var parent = node.parent; + switch (parent.kind) { + case 203: + case 205: + case 204: + return parent.expression === node; + case 206: + case 188: + return parent.condition === node; + } + return false; + } + function isLogicalExpression(node) { + while (true) { + if (node.kind === 178) { + node = node.expression; + } + else if (node.kind === 185 && node.operator === 49) { + node = node.operand; + } + else { + return node.kind === 187 && (node.operatorToken.kind === 51 || + node.operatorToken.kind === 52); } } } - function bindLabeledStatement(n) { - bind(n.label); - var ok = pushNamedLabel(n.label); - bind(n.statement); - if (ok) { - popNamedLabel(n.label, currentReachabilityState); + function isTopLevelLogicalExpression(node) { + while (node.parent.kind === 178 || + node.parent.kind === 185 && + node.parent.operator === 49) { + node = node.parent; + } + return !isStatementCondition(node) && !isLogicalExpression(node.parent); + } + function bindCondition(node, trueTarget, falseTarget) { + var saveTrueTarget = currentTrueTarget; + var saveFalseTarget = currentFalseTarget; + currentTrueTarget = trueTarget; + currentFalseTarget = falseTarget; + bind(node); + currentTrueTarget = saveTrueTarget; + currentFalseTarget = saveFalseTarget; + if (!node || !isLogicalExpression(node)) { + addAntecedent(trueTarget, createFlowCondition(32, currentFlow, node)); + addAntecedent(falseTarget, createFlowCondition(64, currentFlow, node)); + } + } + function bindIterativeStatement(node, breakTarget, continueTarget) { + var saveBreakTarget = currentBreakTarget; + var saveContinueTarget = currentContinueTarget; + currentBreakTarget = breakTarget; + currentContinueTarget = continueTarget; + bind(node); + currentBreakTarget = saveBreakTarget; + currentContinueTarget = saveContinueTarget; + } + function bindWhileStatement(node) { + var preWhileLabel = createLoopLabel(); + var preBodyLabel = createBranchLabel(); + var postWhileLabel = createBranchLabel(); + addAntecedent(preWhileLabel, currentFlow); + currentFlow = preWhileLabel; + bindCondition(node.expression, preBodyLabel, postWhileLabel); + currentFlow = finishFlowLabel(preBodyLabel); + bindIterativeStatement(node.statement, postWhileLabel, preWhileLabel); + addAntecedent(preWhileLabel, currentFlow); + currentFlow = finishFlowLabel(postWhileLabel); + } + function bindDoStatement(node) { + var preDoLabel = createLoopLabel(); + var preConditionLabel = createBranchLabel(); + var postDoLabel = createBranchLabel(); + addAntecedent(preDoLabel, currentFlow); + currentFlow = preDoLabel; + bindIterativeStatement(node.statement, postDoLabel, preConditionLabel); + addAntecedent(preConditionLabel, currentFlow); + currentFlow = finishFlowLabel(preConditionLabel); + bindCondition(node.expression, preDoLabel, postDoLabel); + currentFlow = finishFlowLabel(postDoLabel); + } + function bindForStatement(node) { + var preLoopLabel = createLoopLabel(); + var preBodyLabel = createBranchLabel(); + var postLoopLabel = createBranchLabel(); + bind(node.initializer); + addAntecedent(preLoopLabel, currentFlow); + currentFlow = preLoopLabel; + bindCondition(node.condition, preBodyLabel, postLoopLabel); + currentFlow = finishFlowLabel(preBodyLabel); + bindIterativeStatement(node.statement, postLoopLabel, preLoopLabel); + bind(node.incrementor); + addAntecedent(preLoopLabel, currentFlow); + currentFlow = finishFlowLabel(postLoopLabel); + } + function bindForInOrForOfStatement(node) { + var preLoopLabel = createLoopLabel(); + var postLoopLabel = createBranchLabel(); + addAntecedent(preLoopLabel, currentFlow); + currentFlow = preLoopLabel; + bind(node.expression); + addAntecedent(postLoopLabel, currentFlow); + bind(node.initializer); + if (node.initializer.kind !== 219) { + bindAssignmentTargetFlow(node.initializer); + } + bindIterativeStatement(node.statement, postLoopLabel, preLoopLabel); + addAntecedent(preLoopLabel, currentFlow); + currentFlow = finishFlowLabel(postLoopLabel); + } + function bindIfStatement(node) { + var thenLabel = createBranchLabel(); + var elseLabel = createBranchLabel(); + var postIfLabel = createBranchLabel(); + bindCondition(node.expression, thenLabel, elseLabel); + currentFlow = finishFlowLabel(thenLabel); + bind(node.thenStatement); + addAntecedent(postIfLabel, currentFlow); + currentFlow = finishFlowLabel(elseLabel); + bind(node.elseStatement); + addAntecedent(postIfLabel, currentFlow); + currentFlow = finishFlowLabel(postIfLabel); + } + function bindReturnOrThrow(node) { + bind(node.expression); + if (node.kind === 211) { + hasExplicitReturn = true; + } + currentFlow = unreachableFlow; + } + function findActiveLabel(name) { + if (activeLabels) { + for (var _i = 0, activeLabels_1 = activeLabels; _i < activeLabels_1.length; _i++) { + var label = activeLabels_1[_i]; + if (label.name === name) { + return label; + } + } + } + return undefined; + } + function bindbreakOrContinueFlow(node, breakTarget, continueTarget) { + var flowLabel = node.kind === 210 ? breakTarget : continueTarget; + if (flowLabel) { + addAntecedent(flowLabel, currentFlow); + currentFlow = unreachableFlow; + } + } + function bindBreakOrContinueStatement(node) { + bind(node.label); + if (node.label) { + var activeLabel = findActiveLabel(node.label.text); + if (activeLabel) { + activeLabel.referenced = true; + bindbreakOrContinueFlow(node, activeLabel.breakTarget, activeLabel.continueTarget); + } + } + else { + bindbreakOrContinueFlow(node, currentBreakTarget, currentContinueTarget); + } + } + function bindTryStatement(node) { + var postFinallyLabel = createBranchLabel(); + var preTryFlow = currentFlow; + bind(node.tryBlock); + addAntecedent(postFinallyLabel, currentFlow); + if (node.catchClause) { + currentFlow = preTryFlow; + bind(node.catchClause); + addAntecedent(postFinallyLabel, currentFlow); + } + if (node.finallyBlock) { + currentFlow = preTryFlow; + bind(node.finallyBlock); + } + currentFlow = finishFlowLabel(postFinallyLabel); + } + function bindSwitchStatement(node) { + var postSwitchLabel = createBranchLabel(); + bind(node.expression); + var saveBreakTarget = currentBreakTarget; + var savePreSwitchCaseFlow = preSwitchCaseFlow; + currentBreakTarget = postSwitchLabel; + preSwitchCaseFlow = currentFlow; + bind(node.caseBlock); + addAntecedent(postSwitchLabel, currentFlow); + var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 250; }); + if (!hasDefault) { + addAntecedent(postSwitchLabel, preSwitchCaseFlow); + } + currentBreakTarget = saveBreakTarget; + preSwitchCaseFlow = savePreSwitchCaseFlow; + currentFlow = finishFlowLabel(postSwitchLabel); + } + function bindCaseBlock(node) { + var clauses = node.clauses; + for (var i = 0; i < clauses.length; i++) { + var clause = clauses[i]; + if (clause.statements.length) { + if (currentFlow.flags & 1) { + currentFlow = preSwitchCaseFlow; + } + else { + var preCaseLabel = createBranchLabel(); + addAntecedent(preCaseLabel, preSwitchCaseFlow); + addAntecedent(preCaseLabel, currentFlow); + currentFlow = finishFlowLabel(preCaseLabel); + } + bind(clause); + if (!(currentFlow.flags & 1) && i !== clauses.length - 1 && options.noFallthroughCasesInSwitch) { + errorOnFirstToken(clause, ts.Diagnostics.Fallthrough_case_in_switch); + } + } + else { + bind(clause); + } + } + } + function pushActiveLabel(name, breakTarget, continueTarget) { + var activeLabel = { + name: name, + breakTarget: breakTarget, + continueTarget: continueTarget, + referenced: false + }; + (activeLabels || (activeLabels = [])).push(activeLabel); + return activeLabel; + } + function popActiveLabel() { + activeLabels.pop(); + } + function bindLabeledStatement(node) { + var preStatementLabel = createLoopLabel(); + var postStatementLabel = createBranchLabel(); + bind(node.label); + addAntecedent(preStatementLabel, currentFlow); + var activeLabel = pushActiveLabel(node.label.text, postStatementLabel, preStatementLabel); + bind(node.statement); + popActiveLabel(); + if (!activeLabel.referenced && !options.allowUnusedLabels) { + file.bindDiagnostics.push(ts.createDiagnosticForNode(node.label, ts.Diagnostics.Unused_label)); + } + addAntecedent(postStatementLabel, currentFlow); + currentFlow = finishFlowLabel(postStatementLabel); + } + function bindDestructuringTargetFlow(node) { + if (node.kind === 187 && node.operatorToken.kind === 56) { + bindAssignmentTargetFlow(node.left); + } + else { + bindAssignmentTargetFlow(node); + } + } + function bindAssignmentTargetFlow(node) { + if (isNarrowableReference(node)) { + currentFlow = createFlowAssignment(currentFlow, node); + } + else if (node.kind === 170) { + for (var _i = 0, _a = node.elements; _i < _a.length; _i++) { + var e = _a[_i]; + if (e.kind === 191) { + bindAssignmentTargetFlow(e.expression); + } + else { + bindDestructuringTargetFlow(e); + } + } + } + else if (node.kind === 171) { + for (var _b = 0, _c = node.properties; _b < _c.length; _b++) { + var p = _c[_b]; + if (p.kind === 253) { + bindDestructuringTargetFlow(p.initializer); + } + else if (p.kind === 254) { + bindAssignmentTargetFlow(p.name); + } + } + } + } + function bindLogicalExpression(node, trueTarget, falseTarget) { + var preRightLabel = createBranchLabel(); + if (node.operatorToken.kind === 51) { + bindCondition(node.left, preRightLabel, falseTarget); + } + else { + bindCondition(node.left, trueTarget, preRightLabel); + } + currentFlow = finishFlowLabel(preRightLabel); + bind(node.operatorToken); + bindCondition(node.right, trueTarget, falseTarget); + } + function bindPrefixUnaryExpressionFlow(node) { + if (node.operator === 49) { + var saveTrueTarget = currentTrueTarget; + currentTrueTarget = currentFalseTarget; + currentFalseTarget = saveTrueTarget; + ts.forEachChild(node, bind); + currentFalseTarget = currentTrueTarget; + currentTrueTarget = saveTrueTarget; + } + else { + ts.forEachChild(node, bind); + } + } + function bindBinaryExpressionFlow(node) { + var operator = node.operatorToken.kind; + if (operator === 51 || operator === 52) { + if (isTopLevelLogicalExpression(node)) { + var postExpressionLabel = createBranchLabel(); + bindLogicalExpression(node, postExpressionLabel, postExpressionLabel); + currentFlow = finishFlowLabel(postExpressionLabel); + } + else { + bindLogicalExpression(node, currentTrueTarget, currentFalseTarget); + } + } + else { + ts.forEachChild(node, bind); + if (operator === 56 && !ts.isAssignmentTarget(node)) { + bindAssignmentTargetFlow(node.left); + } + } + } + function bindDeleteExpressionFlow(node) { + ts.forEachChild(node, bind); + if (node.expression.kind === 172) { + bindAssignmentTargetFlow(node.expression); + } + } + function bindConditionalExpressionFlow(node) { + var trueLabel = createBranchLabel(); + var falseLabel = createBranchLabel(); + var postExpressionLabel = createBranchLabel(); + bindCondition(node.condition, trueLabel, falseLabel); + currentFlow = finishFlowLabel(trueLabel); + bind(node.whenTrue); + addAntecedent(postExpressionLabel, currentFlow); + currentFlow = finishFlowLabel(falseLabel); + bind(node.whenFalse); + addAntecedent(postExpressionLabel, currentFlow); + currentFlow = finishFlowLabel(postExpressionLabel); + } + function bindInitializedVariableFlow(node) { + var name = node.name; + if (ts.isBindingPattern(name)) { + for (var _i = 0, _a = name.elements; _i < _a.length; _i++) { + var child = _a[_i]; + bindInitializedVariableFlow(child); + } + } + else { + currentFlow = createFlowAssignment(currentFlow, node); + } + } + function bindVariableDeclarationFlow(node) { + ts.forEachChild(node, bind); + if (node.initializer || node.parent.parent.kind === 207 || node.parent.parent.kind === 208) { + bindInitializedVariableFlow(node); } } function getContainerFlags(node) { switch (node.kind) { - case 186: - case 214: - case 215: - case 217: - case 155: - case 165: + case 192: + case 221: + case 222: + case 224: + case 171: + case 159: + case 265: return 1; - case 147: - case 148: - case 149: - case 143: - case 142: - case 213: - case 144: - case 145: - case 146: + case 151: case 152: case 153: - case 173: - case 174: - case 218: - case 248: - case 216: - return 5; - case 244: - case 199: - case 200: - case 201: + case 147: + case 146: case 220: + case 148: + case 149: + case 150: + case 156: + case 269: + case 157: + case 179: + case 180: + case 225: + case 256: + case 223: + return 5; + case 252: + case 206: + case 207: + case 208: + case 227: return 2; - case 192: + case 199: return ts.isFunctionLike(node.parent) ? 0 : 2; } return 0; @@ -10844,38 +12429,40 @@ var ts; } function declareSymbolAndAddToSymbolTableWorker(node, symbolFlags, symbolExcludes) { switch (container.kind) { - case 218: + case 225: return declareModuleMember(node, symbolFlags, symbolExcludes); - case 248: + case 256: return declareSourceFileMember(node, symbolFlags, symbolExcludes); - case 186: - case 214: + case 192: + case 221: return declareClassMember(node, symbolFlags, symbolExcludes); - case 217: + case 224: return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); - case 155: - case 165: - case 215: + case 159: + case 171: + case 222: + case 265: return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); + case 156: + case 157: + case 151: case 152: case 153: case 147: + case 146: case 148: case 149: - case 143: - case 142: - case 144: - case 145: - case 146: - case 213: - case 173: - case 174: - case 216: + case 150: + case 220: + case 179: + case 180: + case 269: + case 223: return declareSymbol(container.locals, undefined, node, symbolFlags, symbolExcludes); } } function declareClassMember(node, symbolFlags, symbolExcludes) { - return node.flags & 64 + return node.flags & 32 ? declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes) : declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); } @@ -10885,11 +12472,11 @@ var ts; : declareSymbol(file.locals, undefined, node, symbolFlags, symbolExcludes); } function hasExportDeclarations(node) { - var body = node.kind === 248 ? node : node.body; - if (body.kind === 248 || body.kind === 219) { + var body = node.kind === 256 ? node : node.body; + if (body.kind === 256 || body.kind === 226) { for (var _i = 0, _a = body.statements; _i < _a.length; _i++) { var stat = _a[_i]; - if (stat.kind === 228 || stat.kind === 227) { + if (stat.kind === 236 || stat.kind === 235) { return true; } } @@ -10898,16 +12485,24 @@ var ts; } function setExportContextFlag(node) { if (ts.isInAmbientContext(node) && !hasExportDeclarations(node)) { - node.flags |= 131072; + node.flags |= 8192; } else { - node.flags &= ~131072; + node.flags &= ~8192; } } function bindModuleDeclaration(node) { setExportContextFlag(node); - if (node.name.kind === 9) { - declareSymbolAndAddToSymbolTable(node, 512, 106639); + if (ts.isAmbientModule(node)) { + if (node.flags & 1) { + errorOnFirstToken(node, ts.Diagnostics.export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always_visible); + } + if (ts.isExternalModuleAugmentation(node)) { + declareSymbolAndAddToSymbolTable(node, 1024, 0); + } + else { + declareSymbolAndAddToSymbolTable(node, 512, 106639); + } } else { var state = getModuleInstanceState(node); @@ -10948,7 +12543,7 @@ var ts; continue; } var identifier = prop.name; - var currentKind = prop.kind === 245 || prop.kind === 246 || prop.kind === 143 + var currentKind = prop.kind === 253 || prop.kind === 254 || prop.kind === 147 ? 1 : 2; var existingKind = seen[identifier.text]; @@ -10970,10 +12565,10 @@ var ts; } function bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) { switch (blockScopeContainer.kind) { - case 218: + case 225: declareModuleMember(node, symbolFlags, symbolExcludes); break; - case 248: + case 256: if (ts.isExternalModule(container)) { declareModuleMember(node, symbolFlags, symbolExcludes); break; @@ -10993,7 +12588,8 @@ var ts; if (inStrictMode && node.originalKeywordKind >= 106 && node.originalKeywordKind <= 114 && - !ts.isIdentifierName(node)) { + !ts.isIdentifierName(node) && + !ts.isInAmbientContext(node)) { if (!file.parseDiagnostics.length) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, getStrictModeIdentifierMessage(node), ts.declarationNameToString(node))); } @@ -11051,8 +12647,27 @@ var ts; checkStrictModeEvalOrArguments(node, node.name); } } + function getStrictModeBlockScopeFunctionDeclarationMessage(node) { + if (ts.getContainingClass(node)) { + return ts.Diagnostics.Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Class_definitions_are_automatically_in_strict_mode; + } + if (file.externalModuleIndicator) { + return ts.Diagnostics.Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Modules_are_automatically_in_strict_mode; + } + return ts.Diagnostics.Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5; + } + function checkStrictModeFunctionDeclaration(node) { + if (languageVersion < 2) { + if (blockScopeContainer.kind !== 256 && + blockScopeContainer.kind !== 225 && + !ts.isFunctionLike(blockScopeContainer)) { + var errorSpan = ts.getErrorSpanForNode(file, node); + file.bindDiagnostics.push(ts.createFileDiagnostic(file, errorSpan.start, errorSpan.length, getStrictModeBlockScopeFunctionDeclarationMessage(node))); + } + } + } function checkStrictModeNumericLiteral(node) { - if (inStrictMode && node.flags & 32768) { + if (inStrictMode && node.isOctalLiteral) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Octal_literals_are_not_allowed_in_strict_mode)); } } @@ -11095,17 +12710,17 @@ var ts; } function updateStrictMode(node) { switch (node.kind) { - case 248: - case 219: + case 256: + case 226: updateStrictModeStatementList(node.statements); return; - case 192: + case 199: if (ts.isFunctionLike(node.parent)) { updateStrictModeStatementList(node.statements); } return; - case 214: - case 186: + case 221: + case 192: inStrictMode = true; return; } @@ -11124,111 +12739,150 @@ var ts; } function isUseStrictPrologueDirective(node) { var nodeText = ts.getTextOfNodeFromSourceText(file.text, node.expression); - return nodeText === "\"use strict\"" || nodeText === "'use strict'"; + return nodeText === '"use strict"' || nodeText === "'use strict'"; } function bindWorker(node) { switch (node.kind) { case 69: + case 97: + if (currentFlow && (ts.isExpression(node) || parent.kind === 254)) { + node.flowNode = currentFlow; + } return checkStrictModeIdentifier(node); - case 181: + case 172: + if (currentFlow && isNarrowableReference(node)) { + node.flowNode = currentFlow; + } + break; + case 187: if (ts.isInJavaScriptFile(node)) { - if (ts.isExportsPropertyAssignment(node)) { - bindExportsPropertyAssignment(node); - } - else if (ts.isModuleExportsAssignment(node)) { - bindModuleExportsAssignment(node); + var specialKind = ts.getSpecialPropertyAssignmentKind(node); + switch (specialKind) { + case 1: + bindExportsPropertyAssignment(node); + break; + case 2: + bindModuleExportsAssignment(node); + break; + case 3: + bindPrototypePropertyAssignment(node); + break; + case 4: + bindThisPropertyAssignment(node); + break; + case 0: + break; + default: + ts.Debug.fail("Unknown special property assignment kind"); } } return checkStrictModeBinaryExpression(node); - case 244: + case 252: return checkStrictModeCatchClause(node); - case 175: + case 181: return checkStrictModeDeleteExpression(node); case 8: return checkStrictModeNumericLiteral(node); - case 180: + case 186: return checkStrictModePostfixUnaryExpression(node); - case 179: + case 185: return checkStrictModePrefixUnaryExpression(node); - case 205: + case 212: return checkStrictModeWithStatement(node); - case 97: + case 165: seenThisKeyword = true; return; - case 137: - return declareSymbolAndAddToSymbolTable(node, 262144, 530912); - case 138: - return bindParameter(node); - case 211: - case 163: - return bindVariableDeclarationOrBindingElement(node); + case 154: + return checkTypePredicate(node); case 141: - case 140: - return bindPropertyOrMethodOrAccessor(node, 4 | (node.questionToken ? 536870912 : 0), 107455); - case 245: - case 246: - return bindPropertyOrMethodOrAccessor(node, 4, 107455); - case 247: - return bindPropertyOrMethodOrAccessor(node, 8, 107455); - case 147: - case 148: - case 149: - return declareSymbolAndAddToSymbolTable(node, 131072, 0); - case 143: + return declareSymbolAndAddToSymbolTable(node, 262144, 530912); case 142: - return bindPropertyOrMethodOrAccessor(node, 8192 | (node.questionToken ? 536870912 : 0), ts.isObjectLiteralMethod(node) ? 107455 : 99263); - case 213: - checkStrictModeFunctionName(node); - return declareSymbolAndAddToSymbolTable(node, 16, 106927); - case 144: - return declareSymbolAndAddToSymbolTable(node, 16384, 0); + return bindParameter(node); + case 218: + case 169: + return bindVariableDeclarationOrBindingElement(node); case 145: - return bindPropertyOrMethodOrAccessor(node, 32768, 41919); - case 146: - return bindPropertyOrMethodOrAccessor(node, 65536, 74687); + case 144: + case 266: + return bindPropertyOrMethodOrAccessor(node, 4 | (node.questionToken ? 536870912 : 0), 107455); + case 253: + case 254: + return bindPropertyOrMethodOrAccessor(node, 4, 107455); + case 255: + return bindPropertyOrMethodOrAccessor(node, 8, 107455); + case 247: + hasJsxSpreadAttribute = true; + return; + case 151: case 152: case 153: + return declareSymbolAndAddToSymbolTable(node, 131072, 0); + case 147: + case 146: + return bindPropertyOrMethodOrAccessor(node, 8192 | (node.questionToken ? 536870912 : 0), ts.isObjectLiteralMethod(node) ? 107455 : 99263); + case 220: + return bindFunctionDeclaration(node); + case 148: + return declareSymbolAndAddToSymbolTable(node, 16384, 0); + case 149: + return bindPropertyOrMethodOrAccessor(node, 32768, 41919); + case 150: + return bindPropertyOrMethodOrAccessor(node, 65536, 74687); + case 156: + case 157: + case 269: return bindFunctionOrConstructorType(node); - case 155: + case 159: + case 265: return bindAnonymousDeclaration(node, 2048, "__type"); - case 165: + case 171: return bindObjectLiteralExpression(node); - case 173: + case 179: + case 180: + return bindFunctionExpression(node); case 174: - checkStrictModeFunctionName(node); - var bindingName = node.name ? node.name.text : "__function"; - return bindAnonymousDeclaration(node, 16, bindingName); - case 168: if (ts.isInJavaScriptFile(node)) { bindCallExpression(node); } break; - case 186: - case 214: - return bindClassLikeDeclaration(node); - case 215: - return bindBlockScopedDeclaration(node, 64, 792960); - case 216: - return bindBlockScopedDeclaration(node, 524288, 793056); - case 217: - return bindEnumDeclaration(node); - case 218: - return bindModuleDeclaration(node); + case 192: case 221: - case 224: - case 226: - case 230: - return declareSymbolAndAddToSymbolTable(node, 8388608, 8388608); + return bindClassLikeDeclaration(node); + case 222: + return bindBlockScopedDeclaration(node, 64, 792960); case 223: - return bindImportClause(node); + return bindBlockScopedDeclaration(node, 524288, 793056); + case 224: + return bindEnumDeclaration(node); + case 225: + return bindModuleDeclaration(node); + case 229: + case 232: + case 234: + case 238: + return declareSymbolAndAddToSymbolTable(node, 8388608, 8388608); case 228: + return bindGlobalModuleExportDeclaration(node); + case 231: + return bindImportClause(node); + case 236: return bindExportDeclaration(node); - case 227: + case 235: return bindExportAssignment(node); - case 248: + case 256: return bindSourceFileIfExternalModule(); } } + function checkTypePredicate(node) { + var parameterName = node.parameterName, type = node.type; + if (parameterName && parameterName.kind === 69) { + checkStrictModeIdentifier(parameterName); + } + if (parameterName && parameterName.kind === 165) { + seenThisKeyword = true; + } + bind(type); + } function bindSourceFileIfExternalModule() { setExportContextFlag(file); if (ts.isExternalModule(file)) { @@ -11239,17 +12893,39 @@ var ts; bindAnonymousDeclaration(file, 512, "\"" + ts.removeFileExtension(file.fileName) + "\""); } function bindExportAssignment(node) { - var boundExpression = node.kind === 227 ? node.expression : node.right; + var boundExpression = node.kind === 235 ? node.expression : node.right; if (!container.symbol || !container.symbol.exports) { bindAnonymousDeclaration(node, 8388608, getDeclarationName(node)); } - else if (boundExpression.kind === 69) { + else if (boundExpression.kind === 69 && node.kind === 235) { declareSymbol(container.symbol.exports, container.symbol, node, 8388608, 107455 | 8388608); } else { declareSymbol(container.symbol.exports, container.symbol, node, 4, 107455 | 8388608); } } + function bindGlobalModuleExportDeclaration(node) { + if (node.modifiers && node.modifiers.length) { + file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Modifiers_cannot_appear_here)); + } + if (node.parent.kind !== 256) { + file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_at_top_level)); + return; + } + else { + var parent_5 = node.parent; + if (!ts.isExternalModule(parent_5)) { + file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_in_module_files)); + return; + } + if (!parent_5.isDeclarationFile) { + file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_in_declaration_files)); + return; + } + } + file.symbol.globalExports = file.symbol.globalExports || {}; + declareSymbol(file.symbol.globalExports, file.symbol, node, 8388608, 8388608); + } function bindExportDeclaration(node) { if (!container.symbol || !container.symbol.exports) { bindAnonymousDeclaration(node, 1073741824, getDeclarationName(node)); @@ -11275,15 +12951,45 @@ var ts; } function bindModuleExportsAssignment(node) { setCommonJsModuleIndicator(node); - bindExportAssignment(node); + declareSymbol(file.symbol.exports, file.symbol, node, 4 | 7340032 | 512, 0); + } + function bindThisPropertyAssignment(node) { + if (container.kind === 179 || container.kind === 220) { + container.symbol.members = container.symbol.members || {}; + declareSymbol(container.symbol.members, container.symbol, node, 4, 107455 & ~4); + } + } + function bindPrototypePropertyAssignment(node) { + var leftSideOfAssignment = node.left; + var classPrototype = leftSideOfAssignment.expression; + var constructorFunction = classPrototype.expression; + leftSideOfAssignment.parent = node; + constructorFunction.parent = classPrototype; + classPrototype.parent = leftSideOfAssignment; + var funcSymbol = container.locals[constructorFunction.text]; + if (!funcSymbol || !(funcSymbol.flags & 16)) { + return; + } + if (!funcSymbol.members) { + funcSymbol.members = {}; + } + declareSymbol(funcSymbol.members, funcSymbol, leftSideOfAssignment, 4, 107455); } function bindCallExpression(node) { - if (!file.commonJsModuleIndicator && ts.isRequireCall(node)) { + if (!file.commonJsModuleIndicator && ts.isRequireCall(node, false)) { setCommonJsModuleIndicator(node); } } function bindClassLikeDeclaration(node) { - if (node.kind === 214) { + if (!ts.isDeclarationFile(file) && !ts.isInAmbientContext(node)) { + if (ts.getClassExtendsHeritageClauseElement(node) !== undefined) { + hasClassExtends = true; + } + if (ts.nodeIsDecorated(node)) { + hasDecorators = true; + } + } + if (node.kind === 221) { bindBlockScopedDeclaration(node, 32, 899519); } else { @@ -11326,6 +13032,12 @@ var ts; } } function bindParameter(node) { + if (!ts.isDeclarationFile(file) && + !ts.isInAmbientContext(node) && + ts.nodeIsDecorated(node)) { + hasDecorators = true; + hasParameterDecorators = true; + } if (inStrictMode) { checkStrictModeEvalOrArguments(node, node.name); } @@ -11335,106 +13047,75 @@ var ts; else { declareSymbolAndAddToSymbolTable(node, 1, 107455); } - if (node.flags & 56 && - node.parent.kind === 144 && - ts.isClassLike(node.parent.parent)) { + if (ts.isParameterPropertyDeclaration(node)) { var classDeclaration = node.parent.parent; declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, 4, 107455); } } + function bindFunctionDeclaration(node) { + if (!ts.isDeclarationFile(file) && !ts.isInAmbientContext(node)) { + if (ts.isAsyncFunctionLike(node)) { + hasAsyncFunctions = true; + } + } + checkStrictModeFunctionName(node); + if (inStrictMode) { + checkStrictModeFunctionDeclaration(node); + return bindBlockScopedDeclaration(node, 16, 106927); + } + else { + return declareSymbolAndAddToSymbolTable(node, 16, 106927); + } + } + function bindFunctionExpression(node) { + if (!ts.isDeclarationFile(file) && !ts.isInAmbientContext(node)) { + if (ts.isAsyncFunctionLike(node)) { + hasAsyncFunctions = true; + } + } + checkStrictModeFunctionName(node); + var bindingName = node.name ? node.name.text : "__function"; + return bindAnonymousDeclaration(node, 16, bindingName); + } function bindPropertyOrMethodOrAccessor(node, symbolFlags, symbolExcludes) { + if (!ts.isDeclarationFile(file) && !ts.isInAmbientContext(node)) { + if (ts.isAsyncFunctionLike(node)) { + hasAsyncFunctions = true; + } + if (ts.nodeIsDecorated(node)) { + hasDecorators = true; + } + } return ts.hasDynamicName(node) ? bindAnonymousDeclaration(node, symbolFlags, "__computed") : declareSymbolAndAddToSymbolTable(node, symbolFlags, symbolExcludes); } - function pushNamedLabel(name) { - initializeReachabilityStateIfNecessary(); - if (ts.hasProperty(labelIndexMap, name.text)) { - return false; - } - labelIndexMap[name.text] = labelStack.push(1) - 1; - return true; - } - function pushImplicitLabel() { - initializeReachabilityStateIfNecessary(); - var index = labelStack.push(1) - 1; - implicitLabels.push(index); - return index; - } - function popNamedLabel(label, outerState) { - var index = labelIndexMap[label.text]; - ts.Debug.assert(index !== undefined); - ts.Debug.assert(labelStack.length == index + 1); - labelIndexMap[label.text] = undefined; - setCurrentStateAtLabel(labelStack.pop(), outerState, label); - } - function popImplicitLabel(implicitLabelIndex, outerState) { - if (labelStack.length !== implicitLabelIndex + 1) { - ts.Debug.assert(false, "Label stack: " + labelStack.length + ", index:" + implicitLabelIndex); - } - var i = implicitLabels.pop(); - if (implicitLabelIndex !== i) { - ts.Debug.assert(false, "i: " + i + ", index: " + implicitLabelIndex); - } - setCurrentStateAtLabel(labelStack.pop(), outerState, undefined); - } - function setCurrentStateAtLabel(innerMergedState, outerState, label) { - if (innerMergedState === 1) { - if (label && !options.allowUnusedLabels) { - file.bindDiagnostics.push(ts.createDiagnosticForNode(label, ts.Diagnostics.Unused_label)); - } - currentReachabilityState = outerState; - } - else { - currentReachabilityState = or(innerMergedState, outerState); - } - } - function jumpToLabel(label, outerState) { - initializeReachabilityStateIfNecessary(); - var index = label ? labelIndexMap[label.text] : ts.lastOrUndefined(implicitLabels); - if (index === undefined) { - return false; - } - var stateAtLabel = labelStack[index]; - labelStack[index] = stateAtLabel === 1 ? outerState : or(stateAtLabel, outerState); - return true; + function shouldReportErrorOnModuleDeclaration(node) { + var instanceState = getModuleInstanceState(node); + return instanceState === 1 || (instanceState === 2 && options.preserveConstEnums); } function checkUnreachable(node) { - switch (currentReachabilityState) { - case 4: - var reportError = (ts.isStatement(node) && node.kind !== 194) || - node.kind === 214 || - (node.kind === 218 && shouldReportErrorOnModuleDeclaration(node)) || - (node.kind === 217 && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums)); - if (reportError) { - currentReachabilityState = 8; - var reportUnreachableCode = !options.allowUnreachableCode && - !ts.isInAmbientContext(node) && - (node.kind !== 193 || - ts.getCombinedNodeFlags(node.declarationList) & 24576 || - ts.forEach(node.declarationList.declarations, function (d) { return d.initializer; })); - if (reportUnreachableCode) { - errorOnFirstToken(node, ts.Diagnostics.Unreachable_code_detected); - } + if (!(currentFlow.flags & 1)) { + return false; + } + if (currentFlow === unreachableFlow) { + var reportError = (ts.isStatement(node) && node.kind !== 201) || + node.kind === 221 || + (node.kind === 225 && shouldReportErrorOnModuleDeclaration(node)) || + (node.kind === 224 && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums)); + if (reportError) { + currentFlow = reportedUnreachableFlow; + var reportUnreachableCode = !options.allowUnreachableCode && + !ts.isInAmbientContext(node) && + (node.kind !== 200 || + ts.getCombinedNodeFlags(node.declarationList) & 3072 || + ts.forEach(node.declarationList.declarations, function (d) { return d.initializer; })); + if (reportUnreachableCode) { + errorOnFirstToken(node, ts.Diagnostics.Unreachable_code_detected); } - case 8: - return true; - default: - return false; + } } - function shouldReportErrorOnModuleDeclaration(node) { - var instanceState = getModuleInstanceState(node); - return instanceState === 1 || (instanceState === 2 && options.preserveConstEnums); - } - } - function initializeReachabilityStateIfNecessary() { - if (labelIndexMap) { - return; - } - currentReachabilityState = 2; - labelIndexMap = {}; - labelStack = []; - implicitLabels = []; + return true; } } })(ts || (ts = {})); @@ -11443,16 +13124,20 @@ var ts; var nextSymbolId = 1; var nextNodeId = 1; var nextMergeId = 1; + var nextFlowId = 1; function getNodeId(node) { - if (!node.id) - node.id = nextNodeId++; + if (!node.id) { + node.id = nextNodeId; + nextNodeId++; + } return node.id; } ts.getNodeId = getNodeId; ts.checkTime = 0; function getSymbolId(symbol) { if (!symbol.id) { - symbol.id = nextSymbolId++; + symbol.id = nextSymbolId; + nextSymbolId++; } return symbol.id; } @@ -11468,9 +13153,12 @@ var ts; var emptySymbols = {}; var compilerOptions = host.getCompilerOptions(); var languageVersion = compilerOptions.target || 0; - var modulekind = compilerOptions.module ? compilerOptions.module : languageVersion === 2 ? 5 : 0; + var modulekind = ts.getEmitModuleKind(compilerOptions); + var allowSyntheticDefaultImports = typeof compilerOptions.allowSyntheticDefaultImports !== "undefined" ? compilerOptions.allowSyntheticDefaultImports : modulekind === ts.ModuleKind.System; + var strictNullChecks = compilerOptions.strictNullChecks; var emitResolver = createResolver(); var undefinedSymbol = createSymbol(4 | 67108864, "undefined"); + undefinedSymbol.declarations = []; var argumentsSymbol = createSymbol(4 | 67108864, "arguments"); var checker = { getNodeCount: function () { return ts.sum(host.getSourceFiles(), "nodeCount"); }, @@ -11479,9 +13167,11 @@ var ts; getTypeCount: function () { return typeCount; }, isUndefinedSymbol: function (symbol) { return symbol === undefinedSymbol; }, isArgumentsSymbol: function (symbol) { return symbol === argumentsSymbol; }, + isUnknownSymbol: function (symbol) { return symbol === unknownSymbol; }, getDiagnostics: getDiagnostics, getGlobalDiagnostics: getGlobalDiagnostics, - getTypeOfSymbolAtLocation: getNarrowedTypeOfSymbol, + getTypeOfSymbolAtLocation: getTypeOfSymbolAtLocation, + getSymbolsOfParameterPropertyDeclaration: getSymbolsOfParameterPropertyDeclaration, getDeclaredTypeOfSymbol: getDeclaredTypeOfSymbol, getPropertiesOfType: getPropertiesOfType, getPropertyOfType: getPropertyOfType, @@ -11489,16 +13179,19 @@ var ts; getIndexTypeOfType: getIndexTypeOfType, getBaseTypes: getBaseTypes, getReturnTypeOfSignature: getReturnTypeOfSignature, + getNonNullableType: getNonNullableType, getSymbolsInScope: getSymbolsInScope, getSymbolAtLocation: getSymbolAtLocation, getShorthandAssignmentValueSymbol: getShorthandAssignmentValueSymbol, + getExportSpecifierLocalTargetSymbol: getExportSpecifierLocalTargetSymbol, getTypeAtLocation: getTypeOfNode, + getPropertySymbolOfDestructuringAssignment: getPropertySymbolOfDestructuringAssignment, typeToString: typeToString, getSymbolDisplayBuilder: getSymbolDisplayBuilder, symbolToString: symbolToString, getAugmentedPropertiesOfType: getAugmentedPropertiesOfType, getRootSymbols: getRootSymbols, - getContextualType: getApparentTypeOfContextualType, + getContextualType: getContextualType, getFullyQualifiedName: getFullyQualifiedName, getResolvedSignature: getResolvedSignature, getConstantValue: getConstantValue, @@ -11514,42 +13207,45 @@ var ts; }; var unknownSymbol = createSymbol(4 | 67108864, "unknown"); var resolvingSymbol = createSymbol(67108864, "__resolving__"); + var nullableWideningFlags = strictNullChecks ? 0 : 2097152; var anyType = createIntrinsicType(1, "any"); var stringType = createIntrinsicType(2, "string"); var numberType = createIntrinsicType(4, "number"); var booleanType = createIntrinsicType(8, "boolean"); var esSymbolType = createIntrinsicType(16777216, "symbol"); var voidType = createIntrinsicType(16, "void"); - var undefinedType = createIntrinsicType(32 | 2097152, "undefined"); - var nullType = createIntrinsicType(64 | 2097152, "null"); + var undefinedType = createIntrinsicType(32 | nullableWideningFlags, "undefined"); + var nullType = createIntrinsicType(64 | nullableWideningFlags, "null"); + var emptyArrayElementType = createIntrinsicType(32 | 2097152, "undefined"); var unknownType = createIntrinsicType(1, "unknown"); - var circularType = createIntrinsicType(1, "__circular__"); + var neverType = createIntrinsicType(134217728, "never"); var emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); var emptyGenericType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); emptyGenericType.instantiations = {}; var anyFunctionType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); anyFunctionType.flags |= 8388608; var noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); - var anySignature = createSignature(undefined, undefined, emptyArray, anyType, undefined, 0, false, false); - var unknownSignature = createSignature(undefined, undefined, emptyArray, unknownType, undefined, 0, false, false); + var anySignature = createSignature(undefined, undefined, undefined, emptyArray, anyType, undefined, 0, false, false); + var unknownSignature = createSignature(undefined, undefined, undefined, emptyArray, unknownType, undefined, 0, false, false); + var enumNumberIndexInfo = createIndexInfo(stringType, true); var globals = {}; - var globalESSymbolConstructorSymbol; + var getGlobalESSymbolConstructorSymbol; var getGlobalPromiseConstructorSymbol; var globalObjectType; var globalFunctionType; var globalArrayType; + var globalReadonlyArrayType; var globalStringType; var globalNumberType; var globalBooleanType; var globalRegExpType; - var globalTemplateStringsArrayType; - var globalESSymbolType; - var jsxElementType; - var jsxIntrinsicElementsType; - var globalIterableType; - var globalIteratorType; - var globalIterableIteratorType; var anyArrayType; + var anyReadonlyArrayType; + var getGlobalTemplateStringsArrayType; + var getGlobalESSymbolType; + var getGlobalIterableType; + var getGlobalIteratorType; + var getGlobalIterableIteratorType; var getGlobalClassDecoratorType; var getGlobalParameterDecoratorType; var getGlobalPropertyDecoratorType; @@ -11562,53 +13258,74 @@ var ts; var getGlobalPromiseConstructorLikeType; var getGlobalThenableType; var jsxElementClassType; + var deferredNodes; + var flowLoopStart = 0; + var flowLoopCount = 0; + var visitedFlowCount = 0; var tupleTypes = {}; var unionTypes = {}; var intersectionTypes = {}; var stringLiteralTypes = {}; - var emitExtends = false; - var emitDecorate = false; - var emitParam = false; - var emitAwaiter = false; - var emitGenerator = false; var resolutionTargets = []; var resolutionResults = []; var resolutionPropertyNames = []; var mergedSymbols = []; var symbolLinks = []; var nodeLinks = []; + var flowLoopCaches = []; + var flowLoopNodes = []; + var flowLoopKeys = []; + var flowLoopTypes = []; + var visitedFlowNodes = []; + var visitedFlowTypes = []; var potentialThisCollisions = []; var awaitedTypeStack = []; var diagnostics = ts.createDiagnosticCollection(); - var primitiveTypeInfo = { - "string": { - type: stringType, - flags: 258 - }, - "number": { - type: numberType, - flags: 132 - }, - "boolean": { - type: booleanType, - flags: 8 - }, - "symbol": { - type: esSymbolType, - flags: 16777216 - } + var typeofEQFacts = { + "string": 1, + "number": 2, + "boolean": 4, + "symbol": 8, + "undefined": 16384, + "object": 16, + "function": 32 }; + var typeofNEFacts = { + "string": 128, + "number": 256, + "boolean": 512, + "symbol": 1024, + "undefined": 131072, + "object": 2048, + "function": 4096 + }; + var typeofTypesByName = { + "string": stringType, + "number": numberType, + "boolean": booleanType, + "symbol": esSymbolType, + "undefined": undefinedType + }; + var jsxElementType; + var jsxTypes = {}; var JsxNames = { JSX: "JSX", IntrinsicElements: "IntrinsicElements", ElementClass: "ElementClass", ElementAttributesPropertyNameContainer: "ElementAttributesProperty", - Element: "Element" + Element: "Element", + IntrinsicAttributes: "IntrinsicAttributes", + IntrinsicClassAttributes: "IntrinsicClassAttributes" }; var subtypeRelation = {}; var assignableRelation = {}; + var comparableRelation = {}; var identityRelation = {}; var _displayBuilder; + var builtinGlobals = (_a = {}, + _a[undefinedSymbol.name] = undefinedSymbol, + _a + ); initializeTypeChecker(); return checker; function getEmitResolver(sourceFile, cancellationToken) { @@ -11662,8 +13379,10 @@ var ts; return result; } function recordMergedSymbol(target, source) { - if (!source.mergeId) - source.mergeId = nextMergeId++; + if (!source.mergeId) { + source.mergeId = nextMergeId; + nextMergeId++; + } mergedSymbols[source.mergeId] = target; } function cloneSymbol(symbol) { @@ -11687,8 +13406,11 @@ var ts; target.constEnumOnlyModule = false; } target.flags |= source.flags; - if (!target.valueDeclaration && source.valueDeclaration) + if (source.valueDeclaration && + (!target.valueDeclaration || + (target.valueDeclaration.kind === 225 && source.valueDeclaration.kind !== 225))) { target.valueDeclaration = source.valueDeclaration; + } ts.forEach(source.declarations, function (node) { target.declarations.push(node); }); @@ -11705,13 +13427,13 @@ var ts; recordMergedSymbol(target, source); } else { - var message = target.flags & 2 || source.flags & 2 + var message_2 = target.flags & 2 || source.flags & 2 ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0; ts.forEach(source.declarations, function (node) { - error(node.name ? node.name : node, message, symbolToString(source)); + error(node.name ? node.name : node, message_2, symbolToString(source)); }); ts.forEach(target.declarations, function (node) { - error(node.name ? node.name : node, message, symbolToString(source)); + error(node.name ? node.name : node, message_2, symbolToString(source)); }); } } @@ -11740,6 +13462,48 @@ var ts; } } } + function mergeModuleAugmentation(moduleName) { + var moduleAugmentation = moduleName.parent; + if (moduleAugmentation.symbol.declarations[0] !== moduleAugmentation) { + ts.Debug.assert(moduleAugmentation.symbol.declarations.length > 1); + return; + } + if (ts.isGlobalScopeAugmentation(moduleAugmentation)) { + mergeSymbolTable(globals, moduleAugmentation.symbol.exports); + } + else { + var moduleNotFoundError = !ts.isInAmbientContext(moduleName.parent.parent) + ? ts.Diagnostics.Invalid_module_name_in_augmentation_module_0_cannot_be_found + : undefined; + var mainModule = resolveExternalModuleNameWorker(moduleName, moduleName, moduleNotFoundError); + if (!mainModule) { + return; + } + mainModule = resolveExternalModuleSymbol(mainModule); + if (mainModule.flags & 1536) { + mainModule = mainModule.flags & 33554432 ? mainModule : cloneSymbol(mainModule); + mergeSymbol(mainModule, moduleAugmentation.symbol); + } + else { + error(moduleName, ts.Diagnostics.Cannot_augment_module_0_because_it_resolves_to_a_non_module_entity, moduleName.text); + } + } + } + function addToSymbolTable(target, source, message) { + for (var id in source) { + if (ts.hasProperty(source, id)) { + if (ts.hasProperty(target, id)) { + ts.forEach(target[id].declarations, addDeclarationDiagnostic(id, message)); + } + else { + target[id] = source[id]; + } + } + } + function addDeclarationDiagnostic(id, message) { + return function (declaration) { return diagnostics.add(ts.createDiagnosticForNode(declaration, message, id)); }; + } + } function getSymbolLinks(symbol) { if (symbol.flags & 67108864) return symbol; @@ -11750,11 +13514,8 @@ var ts; var nodeId = getNodeId(node); return nodeLinks[nodeId] || (nodeLinks[nodeId] = {}); } - function getSourceFile(node) { - return ts.getAncestor(node, 248); - } function isGlobalSourceFile(node) { - return node.kind === 248 && !ts.isExternalOrCommonJsModule(node); + return node.kind === 256 && !ts.isExternalOrCommonJsModule(node); } function getSymbol(symbols, name, meaning) { if (meaning && ts.hasProperty(symbols, name)) { @@ -11771,6 +13532,16 @@ var ts; } } } + function getSymbolsOfParameterPropertyDeclaration(parameter, parameterName) { + var constructorDeclaration = parameter.parent; + var classDeclaration = parameter.parent.parent; + var parameterSymbol = getSymbol(constructorDeclaration.locals, parameterName, 107455); + var propertySymbol = getSymbol(classDeclaration.symbol.members, parameterName, 107455); + if (parameterSymbol && propertySymbol) { + return [parameterSymbol, propertySymbol]; + } + ts.Debug.fail("There should exist two symbols, one as property declaration and one as parameter declaration"); + } function isBlockScopedNameDeclaredBeforeUse(declaration, usage) { var declarationFile = ts.getSourceFileOfNode(declaration); var useFile = ts.getSourceFileOfNode(usage); @@ -11782,21 +13553,29 @@ var ts; return ts.indexOf(sourceFiles, declarationFile) <= ts.indexOf(sourceFiles, useFile); } if (declaration.pos <= usage.pos) { - return declaration.kind !== 211 || + return declaration.kind !== 218 || !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage); } return isUsedInFunctionOrNonStaticProperty(declaration, usage); function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage) { var container = ts.getEnclosingBlockScopeContainer(declaration); - if (declaration.parent.parent.kind === 193 || - declaration.parent.parent.kind === 199) { - return isSameScopeDescendentOf(usage, declaration, container); + switch (declaration.parent.parent.kind) { + case 200: + case 206: + case 208: + if (isSameScopeDescendentOf(usage, declaration, container)) { + return true; + } + break; } - else if (declaration.parent.parent.kind === 201 || - declaration.parent.parent.kind === 200) { - var expression = declaration.parent.parent.expression; - return isSameScopeDescendentOf(usage, expression, container); + switch (declaration.parent.parent.kind) { + case 207: + case 208: + if (isSameScopeDescendentOf(usage, declaration.parent.parent.expression, container)) { + return true; + } } + return false; } function isUsedInFunctionOrNonStaticProperty(declaration, usage) { var container = ts.getEnclosingBlockScopeContainer(declaration); @@ -11809,8 +13588,8 @@ var ts; return true; } var initializerOfNonStaticProperty = current.parent && - current.parent.kind === 141 && - (current.parent.flags & 64) === 0 && + current.parent.kind === 145 && + (current.parent.flags & 32) === 0 && current.parent.initializer === current; if (initializerOfNonStaticProperty) { return true; @@ -11829,23 +13608,37 @@ var ts; loop: while (location) { if (location.locals && !isGlobalSourceFile(location)) { if (result = getSymbol(location.locals, name, meaning)) { - if (!(meaning & 793056) || - !(result.flags & (793056 & ~262144)) || - !ts.isFunctionLike(location) || - lastLocation === location.body) { + var useResult = true; + if (ts.isFunctionLike(location) && lastLocation && lastLocation !== location.body) { + if (meaning & result.flags & 793056 && lastLocation.kind !== 273) { + useResult = result.flags & 262144 + ? lastLocation === location.type || + lastLocation.kind === 142 || + lastLocation.kind === 141 + : false; + } + if (meaning & 107455 && result.flags & 1) { + useResult = + lastLocation.kind === 142 || + (lastLocation === location.type && + result.valueDeclaration.kind === 142); + } + } + if (useResult) { break loop; } - result = undefined; + else { + result = undefined; + } } } switch (location.kind) { - case 248: + case 256: if (!ts.isExternalOrCommonJsModule(location)) break; - case 218: + case 225: var moduleExports = getSymbolOfNode(location).exports; - if (location.kind === 248 || - (location.kind === 218 && location.name.kind === 9)) { + if (location.kind === 256 || ts.isAmbientModule(location)) { if (result = moduleExports["default"]) { var localSymbol = ts.getLocalSymbolForExportDefault(result); if (localSymbol && (result.flags & meaning) && localSymbol.name === name) { @@ -11855,7 +13648,7 @@ var ts; } if (ts.hasProperty(moduleExports, name) && moduleExports[name].flags === 8388608 && - ts.getDeclarationOfKind(moduleExports[name], 230)) { + ts.getDeclarationOfKind(moduleExports[name], 238)) { break; } } @@ -11863,14 +13656,14 @@ var ts; break loop; } break; - case 217: + case 224: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8)) { break loop; } break; - case 141: - case 140: - if (ts.isClassLike(location.parent) && !(location.flags & 64)) { + case 145: + case 144: + if (ts.isClassLike(location.parent) && !(location.flags & 32)) { var ctor = findConstructorDeclaration(location.parent); if (ctor && ctor.locals) { if (getSymbol(ctor.locals, name, meaning & 107455)) { @@ -11879,17 +13672,17 @@ var ts; } } break; - case 214: - case 186: - case 215: + case 221: + case 192: + case 222: if (result = getSymbol(getSymbolOfNode(location).members, name, meaning & 793056)) { - if (lastLocation && lastLocation.flags & 64) { + if (lastLocation && lastLocation.flags & 32) { error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters); return undefined; } break loop; } - if (location.kind === 186 && meaning & 32) { + if (location.kind === 192 && meaning & 32) { var className = location.name; if (className && name === className.text) { result = location.symbol; @@ -11897,28 +13690,28 @@ var ts; } } break; - case 136: + case 140: grandparent = location.parent.parent; - if (ts.isClassLike(grandparent) || grandparent.kind === 215) { + if (ts.isClassLike(grandparent) || grandparent.kind === 222) { if (result = getSymbol(getSymbolOfNode(grandparent).members, name, meaning & 793056)) { error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); return undefined; } } break; - case 143: - case 142: - case 144: - case 145: + case 147: case 146: - case 213: - case 174: + case 148: + case 149: + case 150: + case 220: + case 180: if (meaning & 3 && name === "arguments") { result = argumentsSymbol; break loop; } break; - case 173: + case 179: if (meaning & 3 && name === "arguments") { result = argumentsSymbol; break loop; @@ -11931,8 +13724,8 @@ var ts; } } break; - case 139: - if (location.parent && location.parent.kind === 138) { + case 143: + if (location.parent && location.parent.kind === 142) { location = location.parent; } if (location.parent && ts.isClassElement(location.parent)) { @@ -11948,7 +13741,9 @@ var ts; } if (!result) { if (nameNotFoundMessage) { - error(errorLocation, nameNotFoundMessage, typeof nameArg === "string" ? nameArg : ts.declarationNameToString(nameArg)); + if (!checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg)) { + error(errorLocation, nameNotFoundMessage, typeof nameArg === "string" ? nameArg : ts.declarationNameToString(nameArg)); + } } return undefined; } @@ -11967,11 +13762,40 @@ var ts; } return result; } + function checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) { + if (!errorLocation || (errorLocation.kind === 69 && (isTypeReferenceIdentifier(errorLocation)) || isInTypeQuery(errorLocation))) { + return false; + } + var container = ts.getThisContainer(errorLocation, true); + var location = container; + while (location) { + if (ts.isClassLike(location.parent)) { + var classSymbol = getSymbolOfNode(location.parent); + if (!classSymbol) { + break; + } + var constructorType = getTypeOfSymbol(classSymbol); + if (getPropertyOfType(constructorType, name)) { + error(errorLocation, ts.Diagnostics.Cannot_find_name_0_Did_you_mean_the_static_member_1_0, typeof nameArg === "string" ? nameArg : ts.declarationNameToString(nameArg), symbolToString(classSymbol)); + return true; + } + if (location === container && !(location.flags & 32)) { + var instanceType = getDeclaredTypeOfSymbol(classSymbol).thisType; + if (getPropertyOfType(instanceType, name)) { + error(errorLocation, ts.Diagnostics.Cannot_find_name_0_Did_you_mean_the_instance_member_this_0, typeof nameArg === "string" ? nameArg : ts.declarationNameToString(nameArg)); + return true; + } + } + } + location = location.parent; + } + return false; + } function checkResolvedBlockScopedVariable(result, errorLocation) { ts.Debug.assert((result.flags & 2) !== 0); var declaration = ts.forEach(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) ? d : undefined; }); ts.Debug.assert(declaration !== undefined, "Block-scoped variable declaration is undefined"); - if (!isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 211), errorLocation)) { + if (!isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 218), errorLocation)) { error(errorLocation, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, ts.declarationNameToString(declaration.name)); } } @@ -11988,10 +13812,10 @@ var ts; } function getAnyImportSyntax(node) { if (ts.isAliasSymbolDeclaration(node)) { - if (node.kind === 221) { + if (node.kind === 229) { return node; } - while (node && node.kind !== 222) { + while (node && node.kind !== 230) { node = node.parent; } return node; @@ -12001,7 +13825,7 @@ var ts; return ts.forEach(symbol.declarations, function (d) { return ts.isAliasSymbolDeclaration(d) ? d : undefined; }); } function getTargetOfImportEqualsDeclaration(node) { - if (node.moduleReference.kind === 232) { + if (node.moduleReference.kind === 240) { return resolveExternalModuleSymbol(resolveExternalModuleName(node, ts.getExternalModuleImportEqualsDeclarationExpression(node))); } return getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference, node); @@ -12009,10 +13833,15 @@ var ts; function getTargetOfImportClause(node) { var moduleSymbol = resolveExternalModuleName(node, node.parent.moduleSpecifier); if (moduleSymbol) { - var exportDefaultSymbol = resolveSymbol(moduleSymbol.exports["default"]); - if (!exportDefaultSymbol) { + var exportDefaultSymbol = moduleSymbol.exports["export="] ? + getPropertyOfType(getTypeOfSymbol(moduleSymbol.exports["export="]), "default") : + resolveSymbol(moduleSymbol.exports["default"]); + if (!exportDefaultSymbol && !allowSyntheticDefaultImports) { error(node.name, ts.Diagnostics.Module_0_has_no_default_export, symbolToString(moduleSymbol)); } + else if (!exportDefaultSymbol && allowSyntheticDefaultImports) { + return resolveExternalModuleSymbol(moduleSymbol) || resolveSymbol(moduleSymbol); + } return exportDefaultSymbol; } } @@ -12020,14 +13849,6 @@ var ts; var moduleSpecifier = node.parent.parent.moduleSpecifier; return resolveESModuleSymbol(resolveExternalModuleName(node, moduleSpecifier), moduleSpecifier); } - function getMemberOfModuleVariable(moduleSymbol, name) { - if (moduleSymbol.flags & 3) { - var typeAnnotation = moduleSymbol.valueDeclaration.type; - if (typeAnnotation) { - return getPropertyOfType(getTypeFromTypeNode(typeAnnotation), name); - } - } - } function combineValueAndTypeSymbols(valueSymbol, typeSymbol) { if (valueSymbol.flags & (793056 | 1536)) { return valueSymbol; @@ -12063,15 +13884,22 @@ var ts; var moduleSymbol = resolveExternalModuleName(node, node.moduleSpecifier); var targetSymbol = resolveESModuleSymbol(moduleSymbol, node.moduleSpecifier); if (targetSymbol) { - var name_10 = specifier.propertyName || specifier.name; - if (name_10.text) { - var symbolFromModule = getExportOfModule(targetSymbol, name_10.text); - var symbolFromVariable = getPropertyOfVariable(targetSymbol, name_10.text); + var name_9 = specifier.propertyName || specifier.name; + if (name_9.text) { + var symbolFromVariable = void 0; + if (moduleSymbol && moduleSymbol.exports && moduleSymbol.exports["export="]) { + symbolFromVariable = getPropertyOfType(getTypeOfSymbol(targetSymbol), name_9.text); + } + else { + symbolFromVariable = getPropertyOfVariable(targetSymbol, name_9.text); + } + symbolFromVariable = resolveSymbol(symbolFromVariable); + var symbolFromModule = getExportOfModule(targetSymbol, name_9.text); var symbol = symbolFromModule && symbolFromVariable ? combineValueAndTypeSymbols(symbolFromVariable, symbolFromModule) : symbolFromModule || symbolFromVariable; if (!symbol) { - error(name_10, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(moduleSymbol), ts.declarationNameToString(name_10)); + error(name_9, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(moduleSymbol), ts.declarationNameToString(name_9)); } return symbol; } @@ -12080,6 +13908,9 @@ var ts; function getTargetOfImportSpecifier(node) { return getExternalModuleMember(node.parent.parent.parent, node); } + function getTargetOfGlobalModuleExportDeclaration(node) { + return resolveExternalModuleSymbol(node.parent.symbol); + } function getTargetOfExportSpecifier(node) { return node.parent.parent.moduleSpecifier ? getExternalModuleMember(node.parent.parent, node) : @@ -12090,18 +13921,20 @@ var ts; } function getTargetOfAliasDeclaration(node) { switch (node.kind) { - case 221: + case 229: return getTargetOfImportEqualsDeclaration(node); - case 223: + case 231: return getTargetOfImportClause(node); - case 224: + case 232: return getTargetOfNamespaceImport(node); - case 226: + case 234: return getTargetOfImportSpecifier(node); - case 230: + case 238: return getTargetOfExportSpecifier(node); - case 227: + case 235: return getTargetOfExportAssignment(node); + case 228: + return getTargetOfGlobalModuleExportDeclaration(node); } } function resolveSymbol(symbol) { @@ -12130,8 +13963,8 @@ var ts; var symbol = getSymbolOfNode(node); var target = resolveAlias(symbol); if (target) { - var markAlias = (target === unknownSymbol && compilerOptions.isolatedModules) || - (target !== unknownSymbol && (target.flags & 107455) && !isConstEnumOrConstEnumOnlyModule(target)); + var markAlias = target === unknownSymbol || + ((target.flags & 107455) && !isConstEnumOrConstEnumOnlyModule(target)); if (markAlias) { markAliasSymbolAsReferenced(symbol); } @@ -12142,10 +13975,10 @@ var ts; if (!links.referenced) { links.referenced = true; var node = getDeclarationOfAliasSymbol(symbol); - if (node.kind === 227) { + if (node.kind === 235) { checkExpressionCached(node.expression); } - else if (node.kind === 230) { + else if (node.kind === 238) { checkExpressionCached(node.propertyName || node.name); } else if (ts.isInternalModuleImportEqualsDeclaration(node)) { @@ -12155,17 +13988,17 @@ var ts; } function getSymbolOfPartOfRightHandSideOfImportEquals(entityName, importDeclaration) { if (!importDeclaration) { - importDeclaration = ts.getAncestor(entityName, 221); + importDeclaration = ts.getAncestor(entityName, 229); ts.Debug.assert(importDeclaration !== undefined); } if (entityName.kind === 69 && ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { entityName = entityName.parent; } - if (entityName.kind === 69 || entityName.parent.kind === 135) { + if (entityName.kind === 69 || entityName.parent.kind === 139) { return resolveEntityName(entityName, 1536); } else { - ts.Debug.assert(entityName.parent.kind === 221); + ts.Debug.assert(entityName.parent.kind === 229); return resolveEntityName(entityName, 107455 | 793056 | 1536); } } @@ -12184,9 +14017,9 @@ var ts; return undefined; } } - else if (name.kind === 135 || name.kind === 166) { - var left = name.kind === 135 ? name.left : name.expression; - var right = name.kind === 135 ? name.right : name.name; + else if (name.kind === 139 || name.kind === 172) { + var left = name.kind === 139 ? name.left : name.expression; + var right = name.kind === 139 ? name.right : name.name; var namespace = resolveEntityName(left, 1536, ignoreErrors); if (!namespace || namespace === unknownSymbol || ts.nodeIsMissing(right)) { return undefined; @@ -12206,38 +14039,42 @@ var ts; return symbol.flags & meaning ? symbol : resolveAlias(symbol); } function resolveExternalModuleName(location, moduleReferenceExpression) { + return resolveExternalModuleNameWorker(location, moduleReferenceExpression, ts.Diagnostics.Cannot_find_module_0); + } + function resolveExternalModuleNameWorker(location, moduleReferenceExpression, moduleNotFoundError) { if (moduleReferenceExpression.kind !== 9) { return; } var moduleReferenceLiteral = moduleReferenceExpression; - var searchPath = ts.getDirectoryPath(getSourceFile(location).fileName); var moduleName = ts.escapeIdentifier(moduleReferenceLiteral.text); if (moduleName === undefined) { return; } - if (moduleName.indexOf("!") >= 0) { - moduleName = moduleName.substr(0, moduleName.indexOf("!")); - } var isRelative = ts.isExternalModuleNameRelative(moduleName); if (!isRelative) { - var symbol = getSymbol(globals, "\"" + moduleName + "\"", 512); + var symbol = getSymbol(globals, '"' + moduleName + '"', 512); if (symbol) { - return symbol; + return getMergedSymbol(symbol); } } - var resolvedModule = ts.getResolvedModule(getSourceFile(location), moduleReferenceLiteral.text); + var resolvedModule = ts.getResolvedModule(ts.getSourceFileOfNode(location), moduleReferenceLiteral.text); var sourceFile = resolvedModule && host.getSourceFile(resolvedModule.resolvedFileName); if (sourceFile) { if (sourceFile.symbol) { - return sourceFile.symbol; + return getMergedSymbol(sourceFile.symbol); } - error(moduleReferenceLiteral, ts.Diagnostics.File_0_is_not_a_module, sourceFile.fileName); - return; + if (moduleNotFoundError) { + error(moduleReferenceLiteral, ts.Diagnostics.File_0_is_not_a_module, sourceFile.fileName); + } + return undefined; } - error(moduleReferenceLiteral, ts.Diagnostics.Cannot_find_module_0, moduleName); + if (moduleNotFoundError) { + error(moduleReferenceLiteral, moduleNotFoundError, moduleName); + } + return undefined; } function resolveExternalModuleSymbol(moduleSymbol) { - return moduleSymbol && resolveSymbol(moduleSymbol.exports["export="]) || moduleSymbol; + return moduleSymbol && getMergedSymbol(resolveSymbol(moduleSymbol.exports["export="])) || moduleSymbol; } function resolveESModuleSymbol(moduleSymbol, moduleReferenceExpression) { var symbol = resolveExternalModuleSymbol(moduleSymbol); @@ -12247,8 +14084,8 @@ var ts; } return symbol; } - function getExportAssignmentSymbol(moduleSymbol) { - return moduleSymbol.exports["export="]; + function hasExportAssignmentSymbol(moduleSymbol) { + return moduleSymbol.exports["export="] !== undefined; } function getExportsOfModuleAsArray(moduleSymbol) { return symbolsToArray(getExportsOfModule(moduleSymbol)); @@ -12260,35 +14097,58 @@ var ts; var links = getSymbolLinks(moduleSymbol); return links.resolvedExports || (links.resolvedExports = getExportsForModule(moduleSymbol)); } - function extendExportSymbols(target, source) { + function extendExportSymbols(target, source, lookupTable, exportNode) { for (var id in source) { if (id !== "default" && !ts.hasProperty(target, id)) { target[id] = source[id]; + if (lookupTable && exportNode) { + lookupTable[id] = { + specifierText: ts.getTextOfNode(exportNode.moduleSpecifier) + }; + } + } + else if (lookupTable && exportNode && id !== "default" && ts.hasProperty(target, id) && resolveSymbol(target[id]) !== resolveSymbol(source[id])) { + if (!lookupTable[id].exportsWithDuplicate) { + lookupTable[id].exportsWithDuplicate = [exportNode]; + } + else { + lookupTable[id].exportsWithDuplicate.push(exportNode); + } } } } function getExportsForModule(moduleSymbol) { - var result; var visitedSymbols = []; - visit(moduleSymbol); - return result || moduleSymbol.exports; + return visit(moduleSymbol) || moduleSymbol.exports; function visit(symbol) { - if (symbol && symbol.flags & 1952 && !ts.contains(visitedSymbols, symbol)) { - visitedSymbols.push(symbol); - if (symbol !== moduleSymbol) { - if (!result) { - result = cloneSymbolTable(moduleSymbol.exports); - } - extendExportSymbols(result, symbol.exports); - } - var exportStars = symbol.exports["__export"]; - if (exportStars) { - for (var _i = 0, _a = exportStars.declarations; _i < _a.length; _i++) { - var node = _a[_i]; - visit(resolveExternalModuleName(node, node.moduleSpecifier)); - } - } + if (!(symbol && symbol.flags & 1952 && !ts.contains(visitedSymbols, symbol))) { + return; } + visitedSymbols.push(symbol); + var symbols = cloneSymbolTable(symbol.exports); + var exportStars = symbol.exports["__export"]; + if (exportStars) { + var nestedSymbols = {}; + var lookupTable = {}; + for (var _i = 0, _a = exportStars.declarations; _i < _a.length; _i++) { + var node = _a[_i]; + var resolvedModule = resolveExternalModuleName(node, node.moduleSpecifier); + var exportedSymbols = visit(resolvedModule); + extendExportSymbols(nestedSymbols, exportedSymbols, lookupTable, node); + } + for (var id in lookupTable) { + var exportsWithDuplicate = lookupTable[id].exportsWithDuplicate; + if (id === "export=" || !(exportsWithDuplicate && exportsWithDuplicate.length) || ts.hasProperty(symbols, id)) { + continue; + } + for (var _b = 0, exportsWithDuplicate_1 = exportsWithDuplicate; _b < exportsWithDuplicate_1.length; _b++) { + var node = exportsWithDuplicate_1[_b]; + diagnostics.add(ts.createDiagnosticForNode(node, ts.Diagnostics.Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambiguity, lookupTable[id].specifierText, id)); + } + } + extendExportSymbols(symbols, nestedSymbols); + } + return symbols; } } function getMergedSymbol(symbol) { @@ -12322,14 +14182,15 @@ var ts; var members = node.members; for (var _i = 0, members_1 = members; _i < members_1.length; _i++) { var member = members_1[_i]; - if (member.kind === 144 && ts.nodeIsPresent(member.body)) { + if (member.kind === 148 && ts.nodeIsPresent(member.body)) { return member; } } } function createType(flags) { var result = new Type(checker, flags); - result.id = typeCount++; + result.id = typeCount; + typeCount++; return result; } function createIntrinsicType(kind, intrinsicName) { @@ -12364,19 +14225,19 @@ var ts; } return result || emptyArray; } - function setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexType, numberIndexType) { + function setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo) { type.members = members; type.properties = getNamedMembers(members); type.callSignatures = callSignatures; type.constructSignatures = constructSignatures; - if (stringIndexType) - type.stringIndexType = stringIndexType; - if (numberIndexType) - type.numberIndexType = numberIndexType; + if (stringIndexInfo) + type.stringIndexInfo = stringIndexInfo; + if (numberIndexInfo) + type.numberIndexInfo = numberIndexInfo; return type; } - function createAnonymousType(symbol, members, callSignatures, constructSignatures, stringIndexType, numberIndexType) { - return setObjectTypeMembers(createObjectType(65536, symbol), members, callSignatures, constructSignatures, stringIndexType, numberIndexType); + function createAnonymousType(symbol, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo) { + return setObjectTypeMembers(createObjectType(65536, symbol), members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo); } function forEachSymbolTableInScope(enclosingDeclaration, callback) { var result; @@ -12387,21 +14248,15 @@ var ts; } } switch (location_1.kind) { - case 248: + case 256: if (!ts.isExternalOrCommonJsModule(location_1)) { break; } - case 218: + case 225: if (result = callback(getSymbolOfNode(location_1).exports)) { return result; } break; - case 214: - case 215: - if (result = callback(getSymbolOfNode(location_1).members)) { - return result; - } - break; } } return callback(globals); @@ -12430,7 +14285,7 @@ var ts; return ts.forEachValue(symbols, function (symbolFromSymbolTable) { if (symbolFromSymbolTable.flags & 8388608 && symbolFromSymbolTable.name !== "export=" - && !ts.getDeclarationOfKind(symbolFromSymbolTable, 230)) { + && !ts.getDeclarationOfKind(symbolFromSymbolTable, 238)) { if (!useOnlyExternalAliasing || ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); @@ -12446,7 +14301,9 @@ var ts; }); } if (symbol) { - return forEachSymbolTableInScope(enclosingDeclaration, getAccessibleSymbolChainFromSymbolTable); + if (!(isPropertyOrMethodDeclarationSymbol(symbol))) { + return forEachSymbolTableInScope(enclosingDeclaration, getAccessibleSymbolChainFromSymbolTable); + } } } function needsQualification(symbol, enclosingDeclaration, meaning) { @@ -12459,7 +14316,7 @@ var ts; if (symbolFromSymbolTable === symbol) { return true; } - symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608 && !ts.getDeclarationOfKind(symbolFromSymbolTable, 230)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; + symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608 && !ts.getDeclarationOfKind(symbolFromSymbolTable, 238)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; if (symbolFromSymbolTable.flags & meaning) { qualify = true; return true; @@ -12468,6 +14325,24 @@ var ts; }); return qualify; } + function isPropertyOrMethodDeclarationSymbol(symbol) { + if (symbol.declarations && symbol.declarations.length) { + for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { + var declaration = _a[_i]; + switch (declaration.kind) { + case 145: + case 147: + case 149: + case 150: + continue; + default: + return false; + } + } + return true; + } + return false; + } function isSymbolAccessible(symbol, enclosingDeclaration, meaning) { if (symbol && enclosingDeclaration && !(symbol.flags & 262144)) { var initialSymbol = symbol; @@ -12514,8 +14389,7 @@ var ts; } } function hasExternalModuleSymbol(declaration) { - return (declaration.kind === 218 && declaration.name.kind === 9) || - (declaration.kind === 248 && ts.isExternalOrCommonJsModule(declaration)); + return ts.isAmbientModule(declaration) || (declaration.kind === 256 && ts.isExternalOrCommonJsModule(declaration)); } function hasVisibleDeclarations(symbol) { var aliasesToMakeVisible; @@ -12527,7 +14401,7 @@ var ts; if (!isDeclarationVisible(declaration)) { var anyImportSyntax = getAnyImportSyntax(declaration); if (anyImportSyntax && - !(anyImportSyntax.flags & 2) && + !(anyImportSyntax.flags & 1) && isDeclarationVisible(anyImportSyntax.parent)) { getNodeLinks(declaration).isVisible = true; if (aliasesToMakeVisible) { @@ -12547,11 +14421,11 @@ var ts; } function isEntityNameVisible(entityName, enclosingDeclaration) { var meaning; - if (entityName.parent.kind === 154) { + if (entityName.parent.kind === 158 || ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) { meaning = 107455 | 1048576; } - else if (entityName.kind === 135 || entityName.kind === 166 || - entityName.parent.kind === 221) { + else if (entityName.kind === 139 || entityName.kind === 172 || + entityName.parent.kind === 229) { meaning = 1536; } else { @@ -12581,9 +14455,9 @@ var ts; ts.releaseStringWriter(writer); return result; } - function signatureToString(signature, enclosingDeclaration, flags) { + function signatureToString(signature, enclosingDeclaration, flags, kind) { var writer = ts.getSingleLineStringWriter(); - getSymbolDisplayBuilder().buildSignatureDisplay(signature, writer, enclosingDeclaration, flags); + getSymbolDisplayBuilder().buildSignatureDisplay(signature, writer, enclosingDeclaration, flags, kind); var result = writer.string(); ts.releaseStringWriter(writer); return result; @@ -12599,18 +14473,39 @@ var ts; } return result; } + function typePredicateToString(typePredicate, enclosingDeclaration, flags) { + var writer = ts.getSingleLineStringWriter(); + getSymbolDisplayBuilder().buildTypePredicateDisplay(typePredicate, writer, enclosingDeclaration, flags); + var result = writer.string(); + ts.releaseStringWriter(writer); + return result; + } + function visibilityToString(flags) { + if (flags === 8) { + return "private"; + } + if (flags === 16) { + return "protected"; + } + return "public"; + } function getTypeAliasForTypeLiteral(type) { if (type.symbol && type.symbol.flags & 2048) { var node = type.symbol.declarations[0].parent; - while (node.kind === 160) { + while (node.kind === 164) { node = node.parent; } - if (node.kind === 216) { + if (node.kind === 223) { return getSymbolOfNode(node); } } return undefined; } + function isTopLevelInExternalModuleAugmentation(node) { + return node && node.parent && + node.parent.kind === 226 && + ts.isExternalModuleAugmentation(node.parent.parent); + } function getSymbolDisplayBuilder() { function getNameOfSymbol(symbol) { if (symbol.declarations && symbol.declarations.length) { @@ -12619,10 +14514,10 @@ var ts; return ts.declarationNameToString(declaration.name); } switch (declaration.kind) { - case 186: + case 192: return "(Anonymous class)"; - case 173: - case 174: + case 179: + case 180: return "(Anonymous function)"; } } @@ -12631,6 +14526,25 @@ var ts; function appendSymbolNameOnly(symbol, writer) { writer.writeSymbol(getNameOfSymbol(symbol), symbol); } + function appendPropertyOrElementAccessForSymbol(symbol, writer) { + var symbolName = getNameOfSymbol(symbol); + var firstChar = symbolName.charCodeAt(0); + var needsElementAccess = !ts.isIdentifierStart(firstChar, languageVersion); + if (needsElementAccess) { + writePunctuation(writer, 19); + if (ts.isSingleOrDoubleQuote(firstChar)) { + writer.writeStringLiteral(symbolName); + } + else { + writer.writeSymbol(symbolName, symbol); + } + writePunctuation(writer, 20); + } + else { + writePunctuation(writer, 21); + writer.writeSymbol(symbolName, symbol); + } + } function buildSymbolDisplay(symbol, writer, enclosingDeclaration, meaning, flags, typeFlags) { var parentSymbol; function appendParentTypeArgumentsAndSymbolName(symbol) { @@ -12643,10 +14557,12 @@ var ts; buildTypeParameterDisplayFromSymbol(parentSymbol, writer, enclosingDeclaration); } } - writePunctuation(writer, 21); + appendPropertyOrElementAccessForSymbol(symbol, writer); + } + else { + appendSymbolNameOnly(symbol, writer); } parentSymbol = symbol; - appendSymbolNameOnly(symbol, writer); } writer.trackSymbol(symbol, enclosingDeclaration, meaning); function walkSymbol(symbol, meaning) { @@ -12686,7 +14602,7 @@ var ts; var inObjectTypeLiteral = false; return writeType(type, globalFlags); function writeType(type, flags) { - if (type.flags & 16777343) { + if (type.flags & 150995071) { writer.writeKeyword(!(globalFlags & 16) && isTypeAny(type) ? "any" : type.intrinsicName); @@ -12741,11 +14657,13 @@ var ts; } if (pos < end) { writePunctuation(writer, 25); - writeType(typeArguments[pos++], 0); + writeType(typeArguments[pos], 256); + pos++; while (pos < end) { writePunctuation(writer, 24); writeSpace(writer); - writeType(typeArguments[pos++], 0); + writeType(typeArguments[pos], 0); + pos++; } writePunctuation(writer, 27); } @@ -12764,12 +14682,12 @@ var ts; var length_1 = outerTypeParameters.length; while (i < length_1) { var start = i; - var parent_3 = getParentSymbolOfTypeParameter(outerTypeParameters[i]); + var parent_6 = getParentSymbolOfTypeParameter(outerTypeParameters[i]); do { i++; - } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent_3); + } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent_6); if (!ts.rangeEquals(outerTypeParameters, typeArguments, start, i)) { - writeSymbolTypeReference(parent_3, typeArguments, start, i, flags); + writeSymbolTypeReference(parent_6, typeArguments, start, i, flags); writePunctuation(writer, 21); } } @@ -12796,10 +14714,10 @@ var ts; var symbol = type.symbol; if (symbol) { if (symbol.flags & (32 | 384 | 512)) { - writeTypeofSymbol(type, flags); + writeTypeOfSymbol(type, flags); } else if (shouldWriteTypeOfFunctionSymbol()) { - writeTypeofSymbol(type, flags); + writeTypeOfSymbol(type, flags); } else if (ts.contains(symbolStack, symbol)) { var typeAlias = getTypeAliasForTypeLiteral(type); @@ -12824,11 +14742,11 @@ var ts; } function shouldWriteTypeOfFunctionSymbol() { var isStaticMethodSymbol = !!(symbol.flags & 8192 && - ts.forEach(symbol.declarations, function (declaration) { return declaration.flags & 64; })); + ts.forEach(symbol.declarations, function (declaration) { return declaration.flags & 32; })); var isNonLocalFunctionSymbol = !!(symbol.flags & 16) && (symbol.parent || ts.forEach(symbol.declarations, function (declaration) { - return declaration.parent.kind === 248 || declaration.parent.kind === 219; + return declaration.parent.kind === 256 || declaration.parent.kind === 226; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { return !!(flags & 2) || @@ -12836,33 +14754,66 @@ var ts; } } } - function writeTypeofSymbol(type, typeFormatFlags) { + function writeTypeOfSymbol(type, typeFormatFlags) { writeKeyword(writer, 101); writeSpace(writer); buildSymbolDisplay(type.symbol, writer, enclosingDeclaration, 107455, 0, typeFormatFlags); } - function getIndexerParameterName(type, indexKind, fallbackName) { - var declaration = getIndexDeclarationOfSymbol(type.symbol, indexKind); - if (!declaration) { - return fallbackName; + function writeIndexSignature(info, keyword) { + if (info) { + if (info.isReadonly) { + writeKeyword(writer, 128); + writeSpace(writer); + } + writePunctuation(writer, 19); + writer.writeParameter(info.declaration ? ts.declarationNameToString(info.declaration.parameters[0].name) : "x"); + writePunctuation(writer, 54); + writeSpace(writer); + writeKeyword(writer, keyword); + writePunctuation(writer, 20); + writePunctuation(writer, 54); + writeSpace(writer); + writeType(info.type, 0); + writePunctuation(writer, 23); + writer.writeLine(); } - ts.Debug.assert(declaration.parameters.length !== 0); - return ts.declarationNameToString(declaration.parameters[0].name); + } + function writePropertyWithModifiers(prop) { + if (isReadonlySymbol(prop)) { + writeKeyword(writer, 128); + writeSpace(writer); + } + buildSymbolDisplay(prop, writer); + if (prop.flags & 536870912) { + writePunctuation(writer, 53); + } + } + function shouldAddParenthesisAroundFunctionType(callSignature, flags) { + if (flags & 64) { + return true; + } + else if (flags & 256) { + var typeParameters = callSignature.target && (flags & 32) ? + callSignature.target.typeParameters : callSignature.typeParameters; + return typeParameters && typeParameters.length !== 0; + } + return false; } function writeLiteralType(type, flags) { var resolved = resolveStructuredTypeMembers(type); - if (!resolved.properties.length && !resolved.stringIndexType && !resolved.numberIndexType) { + if (!resolved.properties.length && !resolved.stringIndexInfo && !resolved.numberIndexInfo) { if (!resolved.callSignatures.length && !resolved.constructSignatures.length) { writePunctuation(writer, 15); writePunctuation(writer, 16); return; } if (resolved.callSignatures.length === 1 && !resolved.constructSignatures.length) { - if (flags & 64) { + var parenthesizeSignature = shouldAddParenthesisAroundFunctionType(resolved.callSignatures[0], flags); + if (parenthesizeSignature) { writePunctuation(writer, 17); } - buildSignatureDisplay(resolved.callSignatures[0], writer, enclosingDeclaration, globalFlagsToPass | 8, symbolStack); - if (flags & 64) { + buildSignatureDisplay(resolved.callSignatures[0], writer, enclosingDeclaration, globalFlagsToPass | 8, undefined, symbolStack); + if (parenthesizeSignature) { writePunctuation(writer, 18); } return; @@ -12873,7 +14824,7 @@ var ts; } writeKeyword(writer, 92); writeSpace(writer); - buildSignatureDisplay(resolved.constructSignatures[0], writer, enclosingDeclaration, globalFlagsToPass | 8, symbolStack); + buildSignatureDisplay(resolved.constructSignatures[0], writer, enclosingDeclaration, globalFlagsToPass | 8, undefined, symbolStack); if (flags & 64) { writePunctuation(writer, 18); } @@ -12887,44 +14838,18 @@ var ts; writer.increaseIndent(); for (var _i = 0, _a = resolved.callSignatures; _i < _a.length; _i++) { var signature = _a[_i]; - buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, symbolStack); + buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, undefined, symbolStack); writePunctuation(writer, 23); writer.writeLine(); } for (var _b = 0, _c = resolved.constructSignatures; _b < _c.length; _b++) { var signature = _c[_b]; - writeKeyword(writer, 92); - writeSpace(writer); - buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, symbolStack); - writePunctuation(writer, 23); - writer.writeLine(); - } - if (resolved.stringIndexType) { - writePunctuation(writer, 19); - writer.writeParameter(getIndexerParameterName(resolved, 0, "x")); - writePunctuation(writer, 54); - writeSpace(writer); - writeKeyword(writer, 130); - writePunctuation(writer, 20); - writePunctuation(writer, 54); - writeSpace(writer); - writeType(resolved.stringIndexType, 0); - writePunctuation(writer, 23); - writer.writeLine(); - } - if (resolved.numberIndexType) { - writePunctuation(writer, 19); - writer.writeParameter(getIndexerParameterName(resolved, 1, "x")); - writePunctuation(writer, 54); - writeSpace(writer); - writeKeyword(writer, 128); - writePunctuation(writer, 20); - writePunctuation(writer, 54); - writeSpace(writer); - writeType(resolved.numberIndexType, 0); + buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, 1, symbolStack); writePunctuation(writer, 23); writer.writeLine(); } + writeIndexSignature(resolved.stringIndexInfo, 132); + writeIndexSignature(resolved.numberIndexInfo, 130); for (var _d = 0, _e = resolved.properties; _d < _e.length; _d++) { var p = _e[_d]; var t = getTypeOfSymbol(p); @@ -12932,20 +14857,14 @@ var ts; var signatures = getSignaturesOfType(t, 0); for (var _f = 0, signatures_1 = signatures; _f < signatures_1.length; _f++) { var signature = signatures_1[_f]; - buildSymbolDisplay(p, writer); - if (p.flags & 536870912) { - writePunctuation(writer, 53); - } - buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, symbolStack); + writePropertyWithModifiers(p); + buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, undefined, symbolStack); writePunctuation(writer, 23); writer.writeLine(); } } else { - buildSymbolDisplay(p, writer); - if (p.flags & 536870912) { - writePunctuation(writer, 53); - } + writePropertyWithModifiers(p); writePunctuation(writer, 54); writeSpace(writer); writeType(t, 0); @@ -12958,10 +14877,10 @@ var ts; inObjectTypeLiteral = saveInObjectTypeLiteral; } } - function buildTypeParameterDisplayFromSymbol(symbol, writer, enclosingDeclaraiton, flags) { + function buildTypeParameterDisplayFromSymbol(symbol, writer, enclosingDeclaration, flags) { var targetSymbol = getTargetSymbol(symbol); if (targetSymbol.flags & 32 || targetSymbol.flags & 64 || targetSymbol.flags & 524288) { - buildDisplayForTypeParametersAndDelimiters(getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol), writer, enclosingDeclaraiton, flags); + buildDisplayForTypeParametersAndDelimiters(getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol), writer, enclosingDeclaration, flags); } } function buildTypeParameterDisplay(tp, writer, enclosingDeclaration, flags, symbolStack) { @@ -12979,7 +14898,12 @@ var ts; if (ts.isRestParameter(parameterNode)) { writePunctuation(writer, 22); } - appendSymbolNameOnly(p, writer); + if (ts.isBindingPattern(parameterNode.name)) { + buildBindingPatternDisplay(parameterNode.name, writer, enclosingDeclaration, flags, symbolStack); + } + else { + appendSymbolNameOnly(p, writer); + } if (isOptionalParameter(parameterNode)) { writePunctuation(writer, 53); } @@ -12987,36 +14911,83 @@ var ts; writeSpace(writer); buildTypeDisplay(getTypeOfSymbol(p), writer, enclosingDeclaration, flags, symbolStack); } + function buildBindingPatternDisplay(bindingPattern, writer, enclosingDeclaration, flags, symbolStack) { + if (bindingPattern.kind === 167) { + writePunctuation(writer, 15); + buildDisplayForCommaSeparatedList(bindingPattern.elements, writer, function (e) { return buildBindingElementDisplay(e, writer, enclosingDeclaration, flags, symbolStack); }); + writePunctuation(writer, 16); + } + else if (bindingPattern.kind === 168) { + writePunctuation(writer, 19); + var elements = bindingPattern.elements; + buildDisplayForCommaSeparatedList(elements, writer, function (e) { return buildBindingElementDisplay(e, writer, enclosingDeclaration, flags, symbolStack); }); + if (elements && elements.hasTrailingComma) { + writePunctuation(writer, 24); + } + writePunctuation(writer, 20); + } + } + function buildBindingElementDisplay(bindingElement, writer, enclosingDeclaration, flags, symbolStack) { + if (bindingElement.kind === 193) { + return; + } + ts.Debug.assert(bindingElement.kind === 169); + if (bindingElement.propertyName) { + writer.writeSymbol(ts.getTextOfNode(bindingElement.propertyName), bindingElement.symbol); + writePunctuation(writer, 54); + writeSpace(writer); + } + if (ts.isBindingPattern(bindingElement.name)) { + buildBindingPatternDisplay(bindingElement.name, writer, enclosingDeclaration, flags, symbolStack); + } + else { + if (bindingElement.dotDotDotToken) { + writePunctuation(writer, 22); + } + appendSymbolNameOnly(bindingElement.symbol, writer); + } + } function buildDisplayForTypeParametersAndDelimiters(typeParameters, writer, enclosingDeclaration, flags, symbolStack) { if (typeParameters && typeParameters.length) { writePunctuation(writer, 25); - for (var i = 0; i < typeParameters.length; i++) { - if (i > 0) { - writePunctuation(writer, 24); - writeSpace(writer); - } - buildTypeParameterDisplay(typeParameters[i], writer, enclosingDeclaration, flags, symbolStack); - } + buildDisplayForCommaSeparatedList(typeParameters, writer, function (p) { return buildTypeParameterDisplay(p, writer, enclosingDeclaration, flags, symbolStack); }); writePunctuation(writer, 27); } } + function buildDisplayForCommaSeparatedList(list, writer, action) { + for (var i = 0; i < list.length; i++) { + if (i > 0) { + writePunctuation(writer, 24); + writeSpace(writer); + } + action(list[i]); + } + } function buildDisplayForTypeArgumentsAndDelimiters(typeParameters, mapper, writer, enclosingDeclaration, flags, symbolStack) { if (typeParameters && typeParameters.length) { writePunctuation(writer, 25); + var flags_1 = 256; for (var i = 0; i < typeParameters.length; i++) { if (i > 0) { writePunctuation(writer, 24); writeSpace(writer); + flags_1 = 0; } - buildTypeDisplay(mapper(typeParameters[i]), writer, enclosingDeclaration, 0); + buildTypeDisplay(mapper(typeParameters[i]), writer, enclosingDeclaration, flags_1); } writePunctuation(writer, 27); } } - function buildDisplayForParametersAndDelimiters(parameters, writer, enclosingDeclaration, flags, symbolStack) { + function buildDisplayForParametersAndDelimiters(thisType, parameters, writer, enclosingDeclaration, flags, symbolStack) { writePunctuation(writer, 17); + if (thisType) { + writeKeyword(writer, 97); + writePunctuation(writer, 54); + writeSpace(writer); + buildTypeDisplay(thisType, writer, enclosingDeclaration, flags, symbolStack); + } for (var i = 0; i < parameters.length; i++) { - if (i > 0) { + if (i > 0 || thisType) { writePunctuation(writer, 24); writeSpace(writer); } @@ -13024,6 +14995,18 @@ var ts; } writePunctuation(writer, 18); } + function buildTypePredicateDisplay(predicate, writer, enclosingDeclaration, flags, symbolStack) { + if (ts.isIdentifierTypePredicate(predicate)) { + writer.writeParameter(predicate.parameterName); + } + else { + writeKeyword(writer, 97); + } + writeSpace(writer); + writeKeyword(writer, 124); + writeSpace(writer); + buildTypeDisplay(predicate.type, writer, enclosingDeclaration, flags, symbolStack); + } function buildReturnTypeDisplay(signature, writer, enclosingDeclaration, flags, symbolStack) { if (flags & 8) { writeSpace(writer); @@ -13033,33 +15016,33 @@ var ts; writePunctuation(writer, 54); } writeSpace(writer); - var returnType; if (signature.typePredicate) { - writer.writeParameter(signature.typePredicate.parameterName); - writeSpace(writer); - writeKeyword(writer, 124); - writeSpace(writer); - returnType = signature.typePredicate.type; + buildTypePredicateDisplay(signature.typePredicate, writer, enclosingDeclaration, flags, symbolStack); } else { - returnType = getReturnTypeOfSignature(signature); + var returnType = getReturnTypeOfSignature(signature); + buildTypeDisplay(returnType, writer, enclosingDeclaration, flags, symbolStack); } - buildTypeDisplay(returnType, writer, enclosingDeclaration, flags, symbolStack); } - function buildSignatureDisplay(signature, writer, enclosingDeclaration, flags, symbolStack) { + function buildSignatureDisplay(signature, writer, enclosingDeclaration, flags, kind, symbolStack) { + if (kind === 1) { + writeKeyword(writer, 92); + writeSpace(writer); + } if (signature.target && (flags & 32)) { buildDisplayForTypeArgumentsAndDelimiters(signature.target.typeParameters, signature.mapper, writer, enclosingDeclaration); } else { buildDisplayForTypeParametersAndDelimiters(signature.typeParameters, writer, enclosingDeclaration, flags, symbolStack); } - buildDisplayForParametersAndDelimiters(signature.parameters, writer, enclosingDeclaration, flags, symbolStack); + buildDisplayForParametersAndDelimiters(signature.thisType, signature.parameters, writer, enclosingDeclaration, flags, symbolStack); buildReturnTypeDisplay(signature, writer, enclosingDeclaration, flags, symbolStack); } return _displayBuilder || (_displayBuilder = { buildSymbolDisplay: buildSymbolDisplay, buildTypeDisplay: buildTypeDisplay, buildTypeParameterDisplay: buildTypeParameterDisplay, + buildTypePredicateDisplay: buildTypePredicateDisplay, buildParameterDisplay: buildParameterDisplay, buildDisplayForParametersAndDelimiters: buildDisplayForParametersAndDelimiters, buildDisplayForTypeParametersAndDelimiters: buildDisplayForTypeParametersAndDelimiters, @@ -13069,114 +15052,6 @@ var ts; }); } function isDeclarationVisible(node) { - function getContainingExternalModule(node) { - for (; node; node = node.parent) { - if (node.kind === 218) { - if (node.name.kind === 9) { - return node; - } - } - else if (node.kind === 248) { - return ts.isExternalOrCommonJsModule(node) ? node : undefined; - } - } - ts.Debug.fail("getContainingModule cant reach here"); - } - function isUsedInExportAssignment(node) { - var externalModule = getContainingExternalModule(node); - var exportAssignmentSymbol; - var resolvedExportSymbol; - if (externalModule) { - var externalModuleSymbol = getSymbolOfNode(externalModule); - exportAssignmentSymbol = getExportAssignmentSymbol(externalModuleSymbol); - var symbolOfNode = getSymbolOfNode(node); - if (isSymbolUsedInExportAssignment(symbolOfNode)) { - return true; - } - if (symbolOfNode.flags & 8388608) { - return isSymbolUsedInExportAssignment(resolveAlias(symbolOfNode)); - } - } - function isSymbolUsedInExportAssignment(symbol) { - if (exportAssignmentSymbol === symbol) { - return true; - } - if (exportAssignmentSymbol && !!(exportAssignmentSymbol.flags & 8388608)) { - resolvedExportSymbol = resolvedExportSymbol || resolveAlias(exportAssignmentSymbol); - if (resolvedExportSymbol === symbol) { - return true; - } - return ts.forEach(resolvedExportSymbol.declarations, function (current) { - while (current) { - if (current === node) { - return true; - } - current = current.parent; - } - }); - } - } - } - function determineIfDeclarationIsVisible() { - switch (node.kind) { - case 163: - return isDeclarationVisible(node.parent.parent); - case 211: - if (ts.isBindingPattern(node.name) && - !node.name.elements.length) { - return false; - } - case 218: - case 214: - case 215: - case 216: - case 213: - case 217: - case 221: - var parent_4 = getDeclarationContainer(node); - if (!(ts.getCombinedNodeFlags(node) & 2) && - !(node.kind !== 221 && parent_4.kind !== 248 && ts.isInAmbientContext(parent_4))) { - return isGlobalSourceFile(parent_4); - } - return isDeclarationVisible(parent_4); - case 141: - case 140: - case 145: - case 146: - case 143: - case 142: - if (node.flags & (16 | 32)) { - return false; - } - case 144: - case 148: - case 147: - case 149: - case 138: - case 219: - case 152: - case 153: - case 155: - case 151: - case 156: - case 157: - case 158: - case 159: - case 160: - return isDeclarationVisible(node.parent); - case 223: - case 224: - case 226: - return false; - case 137: - case 248: - return true; - case 227: - return false; - default: - ts.Debug.fail("isDeclarationVisible unknown: SyntaxKind: " + node.kind); - } - } if (node) { var links = getNodeLinks(node); if (links.isVisible === undefined) { @@ -13184,13 +15059,77 @@ var ts; } return links.isVisible; } + return false; + function determineIfDeclarationIsVisible() { + switch (node.kind) { + case 169: + return isDeclarationVisible(node.parent.parent); + case 218: + if (ts.isBindingPattern(node.name) && + !node.name.elements.length) { + return false; + } + case 225: + case 221: + case 222: + case 223: + case 220: + case 224: + case 229: + if (ts.isExternalModuleAugmentation(node)) { + return true; + } + var parent_7 = getDeclarationContainer(node); + if (!(ts.getCombinedNodeFlags(node) & 1) && + !(node.kind !== 229 && parent_7.kind !== 256 && ts.isInAmbientContext(parent_7))) { + return isGlobalSourceFile(parent_7); + } + return isDeclarationVisible(parent_7); + case 145: + case 144: + case 149: + case 150: + case 147: + case 146: + if (node.flags & (8 | 16)) { + return false; + } + case 148: + case 152: + case 151: + case 153: + case 142: + case 226: + case 156: + case 157: + case 159: + case 155: + case 160: + case 161: + case 162: + case 163: + case 164: + return isDeclarationVisible(node.parent); + case 231: + case 232: + case 234: + return false; + case 141: + case 256: + return true; + case 235: + return false; + default: + return false; + } + } } function collectLinkedAliases(node) { var exportSymbol; - if (node.parent && node.parent.kind === 227) { + if (node.parent && node.parent.kind === 235) { exportSymbol = resolveName(node.parent, node.text, 107455 | 793056 | 1536 | 8388608, ts.Diagnostics.Cannot_find_name_0, node); } - else if (node.parent.kind === 230) { + else if (node.parent.kind === 238) { var exportSpecifier = node.parent; exportSymbol = exportSpecifier.parent.parent.moduleSpecifier ? getExternalModuleMember(exportSpecifier.parent.parent, exportSpecifier) : @@ -13211,8 +15150,10 @@ var ts; if (ts.isInternalModuleImportEqualsDeclaration(declaration)) { var internalModuleReference = declaration.moduleReference; var firstIdentifier = getFirstIdentifier(internalModuleReference); - var importSymbol = resolveName(declaration, firstIdentifier.text, 107455 | 793056 | 1536, ts.Diagnostics.Cannot_find_name_0, firstIdentifier); - buildVisibleNodeList(importSymbol.declarations); + var importSymbol = resolveName(declaration, firstIdentifier.text, 107455 | 793056 | 1536, undefined, undefined); + if (importSymbol) { + buildVisibleNodeList(importSymbol.declarations); + } } }); } @@ -13265,10 +15206,23 @@ var ts; } function getDeclarationContainer(node) { node = ts.getRootDeclaration(node); - return node.kind === 211 ? node.parent.parent.parent : node.parent; + while (node) { + switch (node.kind) { + case 218: + case 219: + case 234: + case 233: + case 232: + case 231: + node = node.parent; + break; + default: + return node.parent; + } + } } function getTypeOfPrototypeProperty(prototype) { - var classType = getDeclaredTypeOfSymbol(prototype.parent); + var classType = getDeclaredTypeOfSymbol(getParentOfSymbol(prototype)); return classType.typeParameters ? createTypeReference(classType, ts.map(classType.typeParameters, function (_) { return anyType; })) : classType; } function getTypeOfPropertyOfType(type, name) { @@ -13289,7 +15243,7 @@ var ts; case 9: case 8: return name.text; - case 136: + case 140: if (ts.isStringOrNumericLiteral(name.expression.kind)) { return name.expression.text; } @@ -13297,7 +15251,7 @@ var ts; return undefined; } function isComputedNonLiteralName(name) { - return name.kind === 136 && !ts.isStringOrNumericLiteral(name.expression.kind); + return name.kind === 140 && !ts.isStringOrNumericLiteral(name.expression.kind); } function getTypeForBindingElement(declaration) { var pattern = declaration.parent; @@ -13312,17 +15266,20 @@ var ts; return parentType; } var type; - if (pattern.kind === 161) { - var name_11 = declaration.propertyName || declaration.name; - if (isComputedNonLiteralName(name_11)) { + if (pattern.kind === 167) { + var name_10 = declaration.propertyName || declaration.name; + if (isComputedNonLiteralName(name_10)) { return anyType; } - var text = getTextOfPropertyName(name_11); + if (declaration.initializer) { + getContextualType(declaration.initializer); + } + var text = getTextOfPropertyName(name_10); type = getTypeOfPropertyOfType(parentType, text) || isNumericLiteralName(text) && getIndexTypeOfType(parentType, 1) || getIndexTypeOfType(parentType, 0); if (!type) { - error(name_11, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(name_11)); + error(name_10, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(name_10)); return unknownType; } } @@ -13347,38 +15304,84 @@ var ts; type = createArrayType(elementType); } } + if (strictNullChecks && declaration.initializer && !(getNullableKind(checkExpressionCached(declaration.initializer)) & 32)) { + type = getTypeWithFacts(type, 131072); + } return type; } - function getTypeForVariableLikeDeclaration(declaration) { - if (declaration.parent.parent.kind === 200) { - return anyType; + function getTypeForVariableLikeDeclarationFromJSDocComment(declaration) { + var jsDocType = getJSDocTypeForVariableLikeDeclarationFromJSDocComment(declaration); + if (jsDocType) { + return getTypeFromTypeNode(jsDocType); } - if (declaration.parent.parent.kind === 201) { + } + function getJSDocTypeForVariableLikeDeclarationFromJSDocComment(declaration) { + var typeTag = ts.getJSDocTypeTag(declaration); + if (typeTag && typeTag.typeExpression) { + return typeTag.typeExpression.type; + } + if (declaration.kind === 218 && + declaration.parent.kind === 219 && + declaration.parent.parent.kind === 200) { + var annotation = ts.getJSDocTypeTag(declaration.parent.parent); + if (annotation && annotation.typeExpression) { + return annotation.typeExpression.type; + } + } + else if (declaration.kind === 142) { + var paramTag = ts.getCorrespondingJSDocParameterTag(declaration); + if (paramTag && paramTag.typeExpression) { + return paramTag.typeExpression.type; + } + } + return undefined; + } + function addOptionality(type, optional) { + return strictNullChecks && optional ? addNullableKind(type, 32) : type; + } + function getTypeForVariableLikeDeclaration(declaration) { + if (declaration.flags & 134217728) { + var type = getTypeForVariableLikeDeclarationFromJSDocComment(declaration); + if (type && type !== unknownType) { + return type; + } + } + if (declaration.parent.parent.kind === 207) { + return stringType; + } + if (declaration.parent.parent.kind === 208) { return checkRightHandSideOfForOf(declaration.parent.parent.expression) || anyType; } if (ts.isBindingPattern(declaration.parent)) { return getTypeForBindingElement(declaration); } if (declaration.type) { - return getTypeFromTypeNode(declaration.type); + return addOptionality(getTypeFromTypeNode(declaration.type), !!declaration.questionToken); } - if (declaration.kind === 138) { + if (declaration.kind === 142) { var func = declaration.parent; - if (func.kind === 146 && !ts.hasDynamicName(func)) { - var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 145); + if (func.kind === 150 && !ts.hasDynamicName(func)) { + var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 149); if (getter) { - return getReturnTypeOfSignature(getSignatureFromDeclaration(getter)); + var signature = getSignatureFromDeclaration(getter); + var thisParameter = getAccessorThisParameter(func); + if (thisParameter && declaration === thisParameter) { + return signature.thisType; + } + return getReturnTypeOfSignature(signature); } } - var type = getContextuallyTypedParameterType(declaration); + var type = declaration.symbol.name === "this" + ? getContextuallyTypedThisType(func) + : getContextuallyTypedParameterType(declaration); if (type) { - return type; + return addOptionality(type, !!declaration.questionToken); } } if (declaration.initializer) { - return checkExpressionCached(declaration.initializer); + return addOptionality(checkExpressionCached(declaration.initializer), !!declaration.questionToken); } - if (declaration.kind === 246) { + if (declaration.kind === 254) { return checkIdentifier(declaration.name); } if (ts.isBindingPattern(declaration.name)) { @@ -13388,11 +15391,16 @@ var ts; } function getTypeFromBindingElement(element, includePatternInType) { if (element.initializer) { - return getWidenedType(checkExpressionCached(element.initializer)); + var type = checkExpressionCached(element.initializer); + reportErrorsFromWidening(element, type); + return getWidenedType(type); } if (ts.isBindingPattern(element.name)) { return getTypeFromBindingPattern(element.name, includePatternInType); } + if (compilerOptions.noImplicitAny && !declarationBelongsToPrivateAmbientMember(element)) { + reportImplicitAnyError(element, anyType); + } return anyType; } function getTypeFromObjectBindingPattern(pattern, includePatternInType) { @@ -13425,7 +15433,7 @@ var ts; if (elements.length === 0 || elements[elements.length - 1].dotDotDotToken) { return languageVersion >= 2 ? createIterableType(anyType) : anyArrayType; } - var elementTypes = ts.map(elements, function (e) { return e.kind === 187 ? anyType : getTypeFromBindingElement(e, includePatternInType); }); + var elementTypes = ts.map(elements, function (e) { return e.kind === 193 ? anyType : getTypeFromBindingElement(e, includePatternInType); }); if (includePatternInType) { var result = createNewTupleType(elementTypes); result.pattern = pattern; @@ -13434,7 +15442,7 @@ var ts; return createTupleType(elementTypes); } function getTypeFromBindingPattern(pattern, includePatternInType) { - return pattern.kind === 161 + return pattern.kind === 167 ? getTypeFromObjectBindingPattern(pattern, includePatternInType) : getTypeFromArrayBindingPattern(pattern, includePatternInType); } @@ -13444,17 +15452,24 @@ var ts; if (reportErrors) { reportErrorsFromWidening(declaration, type); } - return declaration.kind !== 245 ? getWidenedType(type) : type; + if (declaration.kind === 253) { + return type; + } + return getWidenedType(type); } type = declaration.dotDotDotToken ? anyArrayType : anyType; if (reportErrors && compilerOptions.noImplicitAny) { - var root = ts.getRootDeclaration(declaration); - if (!isPrivateWithinAmbient(root) && !(root.kind === 138 && isPrivateWithinAmbient(root.parent))) { + if (!declarationBelongsToPrivateAmbientMember(declaration)) { reportImplicitAnyError(declaration, type); } } return type; } + function declarationBelongsToPrivateAmbientMember(declaration) { + var root = ts.getRootDeclaration(declaration); + var memberDeclaration = root.kind === 142 ? root.parent : root; + return isPrivateWithinAmbient(memberDeclaration); + } function getTypeOfVariableOrParameterOrProperty(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { @@ -13462,17 +15477,19 @@ var ts; return links.type = getTypeOfPrototypeProperty(symbol); } var declaration = symbol.valueDeclaration; - if (declaration.parent.kind === 244) { + if (declaration.parent.kind === 252) { return links.type = anyType; } - if (declaration.kind === 227) { + if (declaration.kind === 235) { return links.type = checkExpression(declaration.expression); } - if (declaration.kind === 181) { - return links.type = checkExpression(declaration.right); + if (declaration.kind === 187) { + return links.type = getUnionType(ts.map(symbol.declarations, function (decl) { return checkExpressionCached(decl.right); })); } - if (declaration.kind === 166) { - return checkExpressionCached(declaration.parent.right); + if (declaration.kind === 172) { + if (declaration.parent.kind === 187) { + return links.type = checkExpressionCached(declaration.parent.right); + } } if (!pushTypeResolution(symbol, 0)) { return unknownType; @@ -13496,7 +15513,7 @@ var ts; } function getAnnotatedAccessorType(accessor) { if (accessor) { - if (accessor.kind === 145) { + if (accessor.kind === 149) { return accessor.type && getTypeFromTypeNode(accessor.type); } else { @@ -13506,15 +15523,30 @@ var ts; } return undefined; } + function getAnnotatedAccessorThisType(accessor) { + if (accessor) { + var parameter = getAccessorThisParameter(accessor); + if (parameter && parameter.type) { + return getTypeFromTypeNode(accessor.parameters[0].type); + } + } + return undefined; + } function getTypeOfAccessors(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { + var getter = ts.getDeclarationOfKind(symbol, 149); + var setter = ts.getDeclarationOfKind(symbol, 150); + if (getter && getter.flags & 134217728) { + var jsDocType = getTypeForVariableLikeDeclarationFromJSDocComment(getter); + if (jsDocType) { + return links.type = jsDocType; + } + } if (!pushTypeResolution(symbol, 0)) { return unknownType; } - var getter = ts.getDeclarationOfKind(symbol, 145); - var setter = ts.getDeclarationOfKind(symbol, 146); - var type; + var type = void 0; var getterReturnType = getAnnotatedAccessorType(getter); if (getterReturnType) { type = getterReturnType; @@ -13539,7 +15571,7 @@ var ts; if (!popTypeResolution()) { type = anyType; if (compilerOptions.noImplicitAny) { - var getter_1 = ts.getDeclarationOfKind(symbol, 145); + var getter_1 = ts.getDeclarationOfKind(symbol, 149); error(getter_1, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol)); } } @@ -13550,7 +15582,9 @@ var ts; function getTypeOfFuncClassEnumModule(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { - links.type = createObjectType(65536, symbol); + var type = createObjectType(65536, symbol); + links.type = strictNullChecks && symbol.flags & 536870912 ? + addNullableKind(type, 32) : type; } return links.type; } @@ -13628,9 +15662,9 @@ var ts; if (!node) { return typeParameters; } - if (node.kind === 214 || node.kind === 186 || - node.kind === 213 || node.kind === 173 || - node.kind === 143 || node.kind === 174) { + if (node.kind === 221 || node.kind === 192 || + node.kind === 220 || node.kind === 179 || + node.kind === 147 || node.kind === 180) { var declarations = node.typeParameters; if (declarations) { return appendTypeParameters(appendOuterTypeParameters(typeParameters, node), declarations); @@ -13639,15 +15673,15 @@ var ts; } } function getOuterTypeParametersOfClassOrInterface(symbol) { - var declaration = symbol.flags & 32 ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 215); + var declaration = symbol.flags & 32 ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 222); return appendOuterTypeParameters(undefined, declaration); } function getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol) { var result; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var node = _a[_i]; - if (node.kind === 215 || node.kind === 214 || - node.kind === 186 || node.kind === 216) { + if (node.kind === 222 || node.kind === 221 || + node.kind === 192 || node.kind === 223) { var declaration = node; if (declaration.typeParameters) { result = appendTypeParameters(result, declaration.typeParameters); @@ -13672,8 +15706,8 @@ var ts; function getInstantiatedConstructorsForTypeArguments(type, typeArgumentNodes) { var signatures = getConstructorsForTypeArguments(type, typeArgumentNodes); if (typeArgumentNodes) { - var typeArguments = ts.map(typeArgumentNodes, getTypeFromTypeNode); - signatures = ts.map(signatures, function (sig) { return getSignatureInstantiation(sig, typeArguments); }); + var typeArguments_1 = ts.map(typeArgumentNodes, getTypeFromTypeNode); + signatures = ts.map(signatures, function (sig) { return getSignatureInstantiation(sig, typeArguments_1); }); } return signatures; } @@ -13702,9 +15736,6 @@ var ts; } return type.resolvedBaseConstructorType; } - function hasClassBaseType(type) { - return !!ts.forEach(getBaseTypes(type), function (t) { return !!(t.symbol.flags & 32); }); - } function getBaseTypes(type) { var isClass = type.symbol.flags & 32; var isInterface = type.symbol.flags & 64; @@ -13773,7 +15804,7 @@ var ts; type.resolvedBaseTypes = type.resolvedBaseTypes || emptyArray; for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 215 && ts.getInterfaceBaseTypeNodes(declaration)) { + if (declaration.kind === 222 && ts.getInterfaceBaseTypeNodes(declaration)) { for (var _b = 0, _c = ts.getInterfaceBaseTypeNodes(declaration); _b < _c.length; _b++) { var node = _c[_b]; var baseType = getTypeFromTypeNode(node); @@ -13802,8 +15833,8 @@ var ts; function isIndependentInterface(symbol) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 215) { - if (declaration.flags & 262144) { + if (declaration.kind === 222) { + if (declaration.flags & 16384) { return false; } var baseTypeNodes = ts.getInterfaceBaseTypeNodes(declaration); @@ -13851,7 +15882,7 @@ var ts; if (!pushTypeResolution(symbol, 2)) { return unknownType; } - var declaration = ts.getDeclarationOfKind(symbol, 216); + var declaration = ts.getDeclarationOfKind(symbol, 223); var type = getTypeFromTypeNode(declaration.type); if (popTypeResolution()) { links.typeParameters = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol); @@ -13882,7 +15913,7 @@ var ts; if (!links.declaredType) { var type = createType(512); type.symbol = symbol; - if (!ts.getDeclarationOfKind(symbol, 137).constraint) { + if (!ts.getDeclarationOfKind(symbol, 141).constraint) { type.constraint = noConstraintType; } links.declaredType = type; @@ -13929,16 +15960,19 @@ var ts; function isIndependentType(node) { switch (node.kind) { case 117: + case 132: case 130: - case 128: case 120: - case 131: + case 133: case 103: - case 9: + case 135: + case 93: + case 127: + case 166: return true; - case 156: + case 160: return isIndependentType(node.elementType); - case 151: + case 155: return isIndependentTypeReference(node); } return false; @@ -13947,7 +15981,7 @@ var ts; return node.type && isIndependentType(node.type) || !node.type && !node.initializer; } function isIndependentFunctionLikeDeclaration(node) { - if (node.kind !== 144 && (!node.type || !isIndependentType(node.type))) { + if (node.kind !== 148 && (!node.type || !isIndependentType(node.type))) { return false; } for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) { @@ -13963,12 +15997,12 @@ var ts; var declaration = symbol.declarations[0]; if (declaration) { switch (declaration.kind) { - case 141: - case 140: - return isIndependentVariableLikeDeclaration(declaration); - case 143: - case 142: + case 145: case 144: + return isIndependentVariableLikeDeclaration(declaration); + case 147: + case 146: + case 148: return isIndependentFunctionLikeDeclaration(declaration); } } @@ -13999,22 +16033,14 @@ var ts; } } } - function addInheritedSignatures(signatures, baseSignatures) { - if (baseSignatures) { - for (var _i = 0, baseSignatures_1 = baseSignatures; _i < baseSignatures_1.length; _i++) { - var signature = baseSignatures_1[_i]; - signatures.push(signature); - } - } - } function resolveDeclaredMembers(type) { if (!type.declaredProperties) { var symbol = type.symbol; type.declaredProperties = getNamedMembers(symbol.members); type.declaredCallSignatures = getSignaturesOfSymbol(symbol.members["__call"]); type.declaredConstructSignatures = getSignaturesOfSymbol(symbol.members["__new"]); - type.declaredStringIndexType = getIndexTypeOfSymbol(symbol, 0); - type.declaredNumberIndexType = getIndexTypeOfSymbol(symbol, 1); + type.declaredStringIndexInfo = getIndexInfoOfSymbol(symbol, 0); + type.declaredNumberIndexInfo = getIndexInfoOfSymbol(symbol, 1); } return type; } @@ -14029,15 +16055,15 @@ var ts; var members = source.symbol.members; var callSignatures = source.declaredCallSignatures; var constructSignatures = source.declaredConstructSignatures; - var stringIndexType = source.declaredStringIndexType; - var numberIndexType = source.declaredNumberIndexType; + var stringIndexInfo = source.declaredStringIndexInfo; + var numberIndexInfo = source.declaredNumberIndexInfo; if (!ts.rangeEquals(typeParameters, typeArguments, 0, typeParameters.length)) { mapper = createTypeMapper(typeParameters, typeArguments); members = createInstantiatedSymbolTable(source.declaredProperties, mapper, typeParameters.length === 1); callSignatures = instantiateList(source.declaredCallSignatures, mapper, instantiateSignature); constructSignatures = instantiateList(source.declaredConstructSignatures, mapper, instantiateSignature); - stringIndexType = instantiateType(source.declaredStringIndexType, mapper); - numberIndexType = instantiateType(source.declaredNumberIndexType, mapper); + stringIndexInfo = instantiateIndexInfo(source.declaredStringIndexInfo, mapper); + numberIndexInfo = instantiateIndexInfo(source.declaredNumberIndexInfo, mapper); } var baseTypes = getBaseTypes(source); if (baseTypes.length) { @@ -14051,11 +16077,11 @@ var ts; addInheritedMembers(members, getPropertiesOfObjectType(instantiatedBaseType)); callSignatures = ts.concatenate(callSignatures, getSignaturesOfType(instantiatedBaseType, 0)); constructSignatures = ts.concatenate(constructSignatures, getSignaturesOfType(instantiatedBaseType, 1)); - stringIndexType = stringIndexType || getIndexTypeOfType(instantiatedBaseType, 0); - numberIndexType = numberIndexType || getIndexTypeOfType(instantiatedBaseType, 1); + stringIndexInfo = stringIndexInfo || getIndexInfoOfType(instantiatedBaseType, 0); + numberIndexInfo = numberIndexInfo || getIndexInfoOfType(instantiatedBaseType, 1); } } - setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexType, numberIndexType); + setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo); } function resolveClassOrInterfaceMembers(type) { resolveObjectTypeMembers(type, resolveDeclaredMembers(type), emptyArray, emptyArray); @@ -14067,11 +16093,12 @@ var ts; type.typeArguments : ts.concatenate(type.typeArguments, [type]); resolveObjectTypeMembers(type, source, typeParameters, typeArguments); } - function createSignature(declaration, typeParameters, parameters, resolvedReturnType, typePredicate, minArgumentCount, hasRestParameter, hasStringLiterals) { + function createSignature(declaration, typeParameters, thisType, parameters, resolvedReturnType, typePredicate, minArgumentCount, hasRestParameter, hasStringLiterals) { var sig = new Signature(checker); sig.declaration = declaration; sig.typeParameters = typeParameters; sig.parameters = parameters; + sig.thisType = thisType; sig.resolvedReturnType = resolvedReturnType; sig.typePredicate = typePredicate; sig.minArgumentCount = minArgumentCount; @@ -14080,20 +16107,20 @@ var ts; return sig; } function cloneSignature(sig) { - return createSignature(sig.declaration, sig.typeParameters, sig.parameters, sig.resolvedReturnType, sig.typePredicate, sig.minArgumentCount, sig.hasRestParameter, sig.hasStringLiterals); + return createSignature(sig.declaration, sig.typeParameters, sig.thisType, sig.parameters, sig.resolvedReturnType, sig.typePredicate, sig.minArgumentCount, sig.hasRestParameter, sig.hasStringLiterals); } function getDefaultConstructSignatures(classType) { - if (!hasClassBaseType(classType)) { - return [createSignature(undefined, classType.localTypeParameters, emptyArray, classType, undefined, 0, false, false)]; - } var baseConstructorType = getBaseConstructorTypeOfClass(classType); var baseSignatures = getSignaturesOfType(baseConstructorType, 1); + if (baseSignatures.length === 0) { + return [createSignature(undefined, classType.localTypeParameters, undefined, emptyArray, classType, undefined, 0, false, false)]; + } var baseTypeNode = getBaseTypeNodeOfClass(classType); var typeArguments = ts.map(baseTypeNode.typeArguments, getTypeFromTypeNode); var typeArgCount = typeArguments ? typeArguments.length : 0; var result = []; - for (var _i = 0, baseSignatures_2 = baseSignatures; _i < baseSignatures_2.length; _i++) { - var baseSig = baseSignatures_2[_i]; + for (var _i = 0, baseSignatures_1 = baseSignatures; _i < baseSignatures_1.length; _i++) { + var baseSig = baseSignatures_1[_i]; var typeParamCount = baseSig.typeParameters ? baseSig.typeParameters.length : 0; if (typeParamCount === typeArgCount) { var sig = typeParamCount ? getSignatureInstantiation(baseSig, typeArguments) : cloneSignature(baseSig); @@ -14118,12 +16145,12 @@ var ts; var arrayType = resolveStructuredTypeMembers(createTypeFromGenericGlobalType(globalArrayType, [arrayElementType, type])); var members = createTupleTypeMemberSymbols(type.elementTypes); addInheritedMembers(members, arrayType.properties); - setObjectTypeMembers(type, members, arrayType.callSignatures, arrayType.constructSignatures, arrayType.stringIndexType, arrayType.numberIndexType); + setObjectTypeMembers(type, members, arrayType.callSignatures, arrayType.constructSignatures, arrayType.stringIndexInfo, arrayType.numberIndexInfo); } - function findMatchingSignature(signatureList, signature, partialMatch, ignoreReturnTypes) { + function findMatchingSignature(signatureList, signature, partialMatch, ignoreThisTypes, ignoreReturnTypes) { for (var _i = 0, signatureList_1 = signatureList; _i < signatureList_1.length; _i++) { var s = signatureList_1[_i]; - if (compareSignatures(s, signature, partialMatch, ignoreReturnTypes, compareTypes)) { + if (compareSignaturesIdentical(s, signature, partialMatch, ignoreThisTypes, ignoreReturnTypes, compareTypesIdentical)) { return s; } } @@ -14134,7 +16161,7 @@ var ts; return undefined; } for (var i = 1; i < signatureLists.length; i++) { - if (!findMatchingSignature(signatureLists[i], signature, false, false)) { + if (!findMatchingSignature(signatureLists[i], signature, false, false, false)) { return undefined; } } @@ -14142,7 +16169,7 @@ var ts; } var result = undefined; for (var i = 0; i < signatureLists.length; i++) { - var match = i === listIndex ? signature : findMatchingSignature(signatureLists[i], signature, true, true); + var match = i === listIndex ? signature : findMatchingSignature(signatureLists[i], signature, true, true, true); if (!match) { return undefined; } @@ -14158,12 +16185,15 @@ var ts; for (var i = 0; i < signatureLists.length; i++) { for (var _i = 0, _a = signatureLists[i]; _i < _a.length; _i++) { var signature = _a[_i]; - if (!result || !findMatchingSignature(result, signature, false, true)) { + if (!result || !findMatchingSignature(result, signature, false, true, true)) { var unionSignatures = findMatchingSignatures(signatureLists, signature, i); if (unionSignatures) { var s = signature; if (unionSignatures.length > 1) { s = cloneSignature(signature); + if (ts.forEach(unionSignatures, function (sig) { return sig.thisType; })) { + s.thisType = getUnionType(ts.map(unionSignatures, function (sig) { return sig.thisType || anyType; })); + } s.resolvedReturnType = undefined; s.unionSignatures = unionSignatures; } @@ -14174,73 +16204,71 @@ var ts; } return result || emptyArray; } - function getUnionIndexType(types, kind) { + function getUnionIndexInfo(types, kind) { var indexTypes = []; + var isAnyReadonly = false; for (var _i = 0, types_1 = types; _i < types_1.length; _i++) { var type = types_1[_i]; - var indexType = getIndexTypeOfType(type, kind); - if (!indexType) { + var indexInfo = getIndexInfoOfType(type, kind); + if (!indexInfo) { return undefined; } - indexTypes.push(indexType); + indexTypes.push(indexInfo.type); + isAnyReadonly = isAnyReadonly || indexInfo.isReadonly; } - return getUnionType(indexTypes); + return createIndexInfo(getUnionType(indexTypes), isAnyReadonly); } function resolveUnionTypeMembers(type) { var callSignatures = getUnionSignatures(type.types, 0); var constructSignatures = getUnionSignatures(type.types, 1); - var stringIndexType = getUnionIndexType(type.types, 0); - var numberIndexType = getUnionIndexType(type.types, 1); - setObjectTypeMembers(type, emptySymbols, callSignatures, constructSignatures, stringIndexType, numberIndexType); + var stringIndexInfo = getUnionIndexInfo(type.types, 0); + var numberIndexInfo = getUnionIndexInfo(type.types, 1); + setObjectTypeMembers(type, emptySymbols, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo); } function intersectTypes(type1, type2) { return !type1 ? type2 : !type2 ? type1 : getIntersectionType([type1, type2]); } + function intersectIndexInfos(info1, info2) { + return !info1 ? info2 : !info2 ? info1 : createIndexInfo(getIntersectionType([info1.type, info2.type]), info1.isReadonly && info2.isReadonly); + } function resolveIntersectionTypeMembers(type) { var callSignatures = emptyArray; var constructSignatures = emptyArray; - var stringIndexType = undefined; - var numberIndexType = undefined; + var stringIndexInfo = undefined; + var numberIndexInfo = undefined; for (var _i = 0, _a = type.types; _i < _a.length; _i++) { var t = _a[_i]; callSignatures = ts.concatenate(callSignatures, getSignaturesOfType(t, 0)); constructSignatures = ts.concatenate(constructSignatures, getSignaturesOfType(t, 1)); - stringIndexType = intersectTypes(stringIndexType, getIndexTypeOfType(t, 0)); - numberIndexType = intersectTypes(numberIndexType, getIndexTypeOfType(t, 1)); + stringIndexInfo = intersectIndexInfos(stringIndexInfo, getIndexInfoOfType(t, 0)); + numberIndexInfo = intersectIndexInfos(numberIndexInfo, getIndexInfoOfType(t, 1)); } - setObjectTypeMembers(type, emptySymbols, callSignatures, constructSignatures, stringIndexType, numberIndexType); + setObjectTypeMembers(type, emptySymbols, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo); } function resolveAnonymousTypeMembers(type) { var symbol = type.symbol; - var members; - var callSignatures; - var constructSignatures; - var stringIndexType; - var numberIndexType; if (type.target) { - members = createInstantiatedSymbolTable(getPropertiesOfObjectType(type.target), type.mapper, false); - callSignatures = instantiateList(getSignaturesOfType(type.target, 0), type.mapper, instantiateSignature); - constructSignatures = instantiateList(getSignaturesOfType(type.target, 1), type.mapper, instantiateSignature); - stringIndexType = instantiateType(getIndexTypeOfType(type.target, 0), type.mapper); - numberIndexType = instantiateType(getIndexTypeOfType(type.target, 1), type.mapper); + var members = createInstantiatedSymbolTable(getPropertiesOfObjectType(type.target), type.mapper, false); + var callSignatures = instantiateList(getSignaturesOfType(type.target, 0), type.mapper, instantiateSignature); + var constructSignatures = instantiateList(getSignaturesOfType(type.target, 1), type.mapper, instantiateSignature); + var stringIndexInfo = instantiateIndexInfo(getIndexInfoOfType(type.target, 0), type.mapper); + var numberIndexInfo = instantiateIndexInfo(getIndexInfoOfType(type.target, 1), type.mapper); + setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo); } else if (symbol.flags & 2048) { - members = symbol.members; - callSignatures = getSignaturesOfSymbol(members["__call"]); - constructSignatures = getSignaturesOfSymbol(members["__new"]); - stringIndexType = getIndexTypeOfSymbol(symbol, 0); - numberIndexType = getIndexTypeOfSymbol(symbol, 1); + var members = symbol.members; + var callSignatures = getSignaturesOfSymbol(members["__call"]); + var constructSignatures = getSignaturesOfSymbol(members["__new"]); + var stringIndexInfo = getIndexInfoOfSymbol(symbol, 0); + var numberIndexInfo = getIndexInfoOfSymbol(symbol, 1); + setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo); } else { - members = emptySymbols; - callSignatures = emptyArray; - constructSignatures = emptyArray; + var members = emptySymbols; + var constructSignatures = emptyArray; if (symbol.flags & 1952) { members = getExportsOfSymbol(symbol); } - if (symbol.flags & (16 | 8192)) { - callSignatures = getSignaturesOfSymbol(symbol); - } if (symbol.flags & 32) { var classType = getDeclaredTypeOfClassOrInterface(symbol); constructSignatures = getSignaturesOfSymbol(symbol.members["__constructor"]); @@ -14253,10 +16281,12 @@ var ts; addInheritedMembers(members, getPropertiesOfObjectType(baseConstructorType)); } } - stringIndexType = undefined; - numberIndexType = (symbol.flags & 384) ? stringType : undefined; + var numberIndexInfo = symbol.flags & 384 ? enumNumberIndexInfo : undefined; + setObjectTypeMembers(type, members, emptyArray, constructSignatures, undefined, numberIndexInfo); + if (symbol.flags & (16 | 8192)) { + type.callSignatures = getSignaturesOfSymbol(symbol); + } } - setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexType, numberIndexType); } function resolveStructuredTypeMembers(type) { if (!type.members) { @@ -14339,19 +16369,21 @@ var ts; type = globalBooleanType; } else if (type.flags & 16777216) { - type = globalESSymbolType; + type = getGlobalESSymbolType(); } return type; } function createUnionOrIntersectionProperty(containingType, name) { var types = containingType.types; var props; + var commonFlags = (containingType.flags & 32768) ? 536870912 : 0; for (var _i = 0, types_2 = types; _i < types_2.length; _i++) { var current = types_2[_i]; var type = getApparentType(current); if (type !== unknownType) { var prop = getPropertyOfType(type, name); - if (prop && !(getDeclarationFlagsFromSymbol(prop) & (16 | 32))) { + if (prop && !(getDeclarationFlagsFromSymbol(prop) & (8 | 16))) { + commonFlags &= prop.flags; if (!props) { props = [prop]; } @@ -14379,7 +16411,10 @@ var ts; } propTypes.push(getTypeOfSymbol(prop)); } - var result = createSymbol(4 | 67108864 | 268435456, name); + var result = createSymbol(4 | + 67108864 | + 268435456 | + commonFlags, name); result.containingType = containingType; result.declarations = declarations; result.type = containingType.flags & 16384 ? getUnionType(propTypes) : getIntersectionType(propTypes); @@ -14429,31 +16464,46 @@ var ts; function getSignaturesOfType(type, kind) { return getSignaturesOfStructuredType(getApparentType(type), kind); } - function typeHasConstructSignatures(type) { - var apparentType = getApparentType(type); - if (apparentType.flags & (80896 | 16384)) { - var resolved = resolveStructuredTypeMembers(type); - return resolved.constructSignatures.length > 0; - } - return false; - } - function typeHasCallOrConstructSignatures(type) { - var apparentType = getApparentType(type); - if (apparentType.flags & 130048) { - var resolved = resolveStructuredTypeMembers(type); - return resolved.callSignatures.length > 0 || resolved.constructSignatures.length > 0; - } - return false; - } - function getIndexTypeOfStructuredType(type, kind) { + function getIndexInfoOfStructuredType(type, kind) { if (type.flags & 130048) { var resolved = resolveStructuredTypeMembers(type); - return kind === 0 ? resolved.stringIndexType : resolved.numberIndexType; + return kind === 0 ? resolved.stringIndexInfo : resolved.numberIndexInfo; } } + function getIndexTypeOfStructuredType(type, kind) { + var info = getIndexInfoOfStructuredType(type, kind); + return info && info.type; + } + function getIndexInfoOfType(type, kind) { + return getIndexInfoOfStructuredType(getApparentType(type), kind); + } function getIndexTypeOfType(type, kind) { return getIndexTypeOfStructuredType(getApparentType(type), kind); } + function getImplicitIndexTypeOfType(type, kind) { + if (isObjectLiteralType(type)) { + var propTypes = []; + for (var _i = 0, _a = getPropertiesOfType(type); _i < _a.length; _i++) { + var prop = _a[_i]; + if (kind === 0 || isNumericLiteralName(prop.name)) { + propTypes.push(getTypeOfSymbol(prop)); + } + } + if (propTypes.length) { + return getUnionType(propTypes); + } + } + return undefined; + } + function getTypeParametersFromJSDocTemplate(declaration) { + if (declaration.flags & 134217728) { + var templateTag = ts.getJSDocTemplateTag(declaration); + if (templateTag) { + return getTypeParametersFromDeclaration(templateTag.typeParameters); + } + } + return undefined; + } function getTypeParametersFromDeclaration(typeParameterDeclarations) { var result = []; ts.forEach(typeParameterDeclarations, function (node) { @@ -14474,6 +16524,20 @@ var ts; return result; } function isOptionalParameter(node) { + if (node.flags & 134217728) { + if (node.type && node.type.kind === 268) { + return true; + } + var paramTag = ts.getCorrespondingJSDocParameterTag(node); + if (paramTag) { + if (paramTag.isBracketed) { + return true; + } + if (paramTag.typeExpression) { + return paramTag.typeExpression.type.kind === 268; + } + } + } if (ts.hasQuestionToken(node)) { return true; } @@ -14486,64 +16550,109 @@ var ts; } return false; } + function createTypePredicateFromTypePredicateNode(node) { + if (node.parameterName.kind === 69) { + var parameterName = node.parameterName; + return { + kind: 1, + parameterName: parameterName ? parameterName.text : undefined, + parameterIndex: parameterName ? getTypePredicateParameterIndex(node.parent.parameters, parameterName) : undefined, + type: getTypeFromTypeNode(node.type) + }; + } + else { + return { + kind: 0, + type: getTypeFromTypeNode(node.type) + }; + } + } function getSignatureFromDeclaration(declaration) { var links = getNodeLinks(declaration); if (!links.resolvedSignature) { - var classType = declaration.kind === 144 ? - getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol)) - : undefined; - var typeParameters = classType ? classType.localTypeParameters : - declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : undefined; var parameters = []; var hasStringLiterals = false; var minArgumentCount = -1; - for (var i = 0, n = declaration.parameters.length; i < n; i++) { + var thisType = undefined; + var hasThisParameter = void 0; + var isJSConstructSignature = ts.isJSDocConstructSignature(declaration); + for (var i = isJSConstructSignature ? 1 : 0, n = declaration.parameters.length; i < n; i++) { var param = declaration.parameters[i]; - parameters.push(param.symbol); - if (param.type && param.type.kind === 9) { + var paramSymbol = param.symbol; + if (paramSymbol && !!(paramSymbol.flags & 4) && !ts.isBindingPattern(param.name)) { + var resolvedSymbol = resolveName(param, paramSymbol.name, 107455, undefined, undefined); + paramSymbol = resolvedSymbol; + } + if (i === 0 && paramSymbol.name === "this") { + hasThisParameter = true; + thisType = param.type ? getTypeFromTypeNode(param.type) : unknownType; + } + else { + parameters.push(paramSymbol); + } + if (param.type && param.type.kind === 166) { hasStringLiterals = true; } if (param.initializer || param.questionToken || param.dotDotDotToken) { if (minArgumentCount < 0) { - minArgumentCount = i; + minArgumentCount = i - (hasThisParameter ? 1 : 0); } } else { minArgumentCount = -1; } } + if ((declaration.kind === 149 || declaration.kind === 150) && + !ts.hasDynamicName(declaration) && + (!hasThisParameter || thisType === unknownType)) { + var otherKind = declaration.kind === 149 ? 150 : 149; + var setter = ts.getDeclarationOfKind(declaration.symbol, otherKind); + thisType = getAnnotatedAccessorThisType(setter); + } if (minArgumentCount < 0) { - minArgumentCount = declaration.parameters.length; + minArgumentCount = declaration.parameters.length - (hasThisParameter ? 1 : 0); } - var returnType; - var typePredicate; - if (classType) { - returnType = classType; + if (isJSConstructSignature) { + minArgumentCount--; } - else if (declaration.type) { - returnType = getTypeFromTypeNode(declaration.type); - if (declaration.type.kind === 150) { - var typePredicateNode = declaration.type; - typePredicate = { - parameterName: typePredicateNode.parameterName ? typePredicateNode.parameterName.text : undefined, - parameterIndex: typePredicateNode.parameterName ? getTypePredicateParameterIndex(declaration.parameters, typePredicateNode.parameterName) : undefined, - type: getTypeFromTypeNode(typePredicateNode.type) - }; - } - } - else { - if (declaration.kind === 145 && !ts.hasDynamicName(declaration)) { - var setter = ts.getDeclarationOfKind(declaration.symbol, 146); - returnType = getAnnotatedAccessorType(setter); - } - if (!returnType && ts.nodeIsMissing(declaration.body)) { - returnType = anyType; - } - } - links.resolvedSignature = createSignature(declaration, typeParameters, parameters, returnType, typePredicate, minArgumentCount, ts.hasRestParameter(declaration), hasStringLiterals); + var classType = declaration.kind === 148 ? + getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol)) + : undefined; + var typeParameters = classType ? classType.localTypeParameters : + declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : + getTypeParametersFromJSDocTemplate(declaration); + var returnType = getSignatureReturnTypeFromDeclaration(declaration, minArgumentCount, isJSConstructSignature, classType); + var typePredicate = declaration.type && declaration.type.kind === 154 ? + createTypePredicateFromTypePredicateNode(declaration.type) : + undefined; + links.resolvedSignature = createSignature(declaration, typeParameters, thisType, parameters, returnType, typePredicate, minArgumentCount, ts.hasRestParameter(declaration), hasStringLiterals); } return links.resolvedSignature; } + function getSignatureReturnTypeFromDeclaration(declaration, minArgumentCount, isJSConstructSignature, classType) { + if (isJSConstructSignature) { + return getTypeFromTypeNode(declaration.parameters[0].type); + } + else if (classType) { + return classType; + } + else if (declaration.type) { + return getTypeFromTypeNode(declaration.type); + } + if (declaration.flags & 134217728) { + var type = getReturnTypeFromJSDocComment(declaration); + if (type && type !== unknownType) { + return type; + } + } + if (declaration.kind === 149 && !ts.hasDynamicName(declaration)) { + var setter = ts.getDeclarationOfKind(declaration.symbol, 150); + return getAnnotatedAccessorType(setter); + } + if (ts.nodeIsMissing(declaration.body)) { + return anyType; + } + } function getSignaturesOfSymbol(symbol) { if (!symbol) return emptyArray; @@ -14551,19 +16660,20 @@ var ts; for (var i = 0, len = symbol.declarations.length; i < len; i++) { var node = symbol.declarations[i]; switch (node.kind) { + case 156: + case 157: + case 220: + case 147: + case 146: + case 148: + case 151: case 152: case 153: - case 213: - case 143: - case 142: - case 144: - case 147: - case 148: case 149: - case 145: - case 146: - case 173: - case 174: + case 150: + case 179: + case 180: + case 269: if (i > 0 && node.body) { var previous = symbol.declarations[i - 1]; if (node.parent === previous.parent && node.kind === previous.kind && node.pos === previous.end) { @@ -14590,7 +16700,7 @@ var ts; if (!pushTypeResolution(signature, 3)) { return unknownType; } - var type; + var type = void 0; if (signature.target) { type = instantiateType(getReturnTypeOfSignature(signature.target), signature.mapper); } @@ -14632,18 +16742,13 @@ var ts; if (!signature.typeParameters) return signature; if (!signature.erasedSignatureCache) { - if (signature.target) { - signature.erasedSignatureCache = instantiateSignature(getErasedSignature(signature.target), signature.mapper); - } - else { - signature.erasedSignatureCache = instantiateSignature(signature, createTypeEraser(signature.typeParameters), true); - } + signature.erasedSignatureCache = instantiateSignature(signature, createTypeEraser(signature.typeParameters), true); } return signature.erasedSignatureCache; } function getOrCreateTypeFromSignature(signature) { if (!signature.isolatedSignatureType) { - var isConstructor = signature.declaration.kind === 144 || signature.declaration.kind === 148; + var isConstructor = signature.declaration.kind === 148 || signature.declaration.kind === 152; var type = createObjectType(65536 | 262144); type.members = emptySymbols; type.properties = emptyArray; @@ -14657,7 +16762,7 @@ var ts; return symbol.members["__index"]; } function getIndexDeclarationOfSymbol(symbol, kind) { - var syntaxKind = kind === 1 ? 128 : 130; + var syntaxKind = kind === 1 ? 130 : 132; var indexSymbol = getIndexSymbol(symbol); if (indexSymbol) { for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { @@ -14673,26 +16778,51 @@ var ts; } return undefined; } - function getIndexTypeOfSymbol(symbol, kind) { - var declaration = getIndexDeclarationOfSymbol(symbol, kind); - return declaration - ? declaration.type ? getTypeFromTypeNode(declaration.type) : anyType - : undefined; + function createIndexInfo(type, isReadonly, declaration) { + return { type: type, isReadonly: isReadonly, declaration: declaration }; } - function getConstraintOfTypeParameter(type) { - if (!type.constraint) { - if (type.target) { - var targetConstraint = getConstraintOfTypeParameter(type.target); - type.constraint = targetConstraint ? instantiateType(targetConstraint, type.mapper) : noConstraintType; + function getIndexInfoOfSymbol(symbol, kind) { + var declaration = getIndexDeclarationOfSymbol(symbol, kind); + if (declaration) { + return createIndexInfo(declaration.type ? getTypeFromTypeNode(declaration.type) : anyType, (declaration.flags & 64) !== 0, declaration); + } + return undefined; + } + function getConstraintDeclaration(type) { + return ts.getDeclarationOfKind(type.symbol, 141).constraint; + } + function hasConstraintReferenceTo(type, target) { + var checked; + while (type && !(type.flags & 33554432) && type.flags & 512 && !ts.contains(checked, type)) { + if (type === target) { + return true; + } + (checked || (checked = [])).push(type); + var constraintDeclaration = getConstraintDeclaration(type); + type = constraintDeclaration && getTypeFromTypeNode(constraintDeclaration); + } + return false; + } + function getConstraintOfTypeParameter(typeParameter) { + if (!typeParameter.constraint) { + if (typeParameter.target) { + var targetConstraint = getConstraintOfTypeParameter(typeParameter.target); + typeParameter.constraint = targetConstraint ? instantiateType(targetConstraint, typeParameter.mapper) : noConstraintType; } else { - type.constraint = getTypeFromTypeNode(ts.getDeclarationOfKind(type.symbol, 137).constraint); + var constraintDeclaration = getConstraintDeclaration(typeParameter); + var constraint = getTypeFromTypeNode(constraintDeclaration); + if (hasConstraintReferenceTo(constraint, typeParameter)) { + error(constraintDeclaration, ts.Diagnostics.Type_parameter_0_has_a_circular_constraint, typeToString(typeParameter)); + constraint = unknownType; + } + typeParameter.constraint = constraint; } } - return type.constraint === noConstraintType ? undefined : type.constraint; + return typeParameter.constraint === noConstraintType ? undefined : typeParameter.constraint; } function getParentSymbolOfTypeParameter(typeParameter) { - return getSymbolOfNode(ts.getDeclarationOfKind(typeParameter.symbol, 137).parent); + return getSymbolOfNode(ts.getDeclarationOfKind(typeParameter.symbol, 141).parent); } function getTypeListId(types) { if (types) { @@ -14714,11 +16844,13 @@ var ts; } return ""; } - function getPropagatingFlagsOfTypes(types) { + function getPropagatingFlagsOfTypes(types, excludeKinds) { var result = 0; for (var _i = 0, types_3 = types; _i < types_3.length; _i++) { var type = types_3[_i]; - result |= type.flags; + if (!(type.flags & excludeKinds)) { + result |= type.flags; + } } return result & 14680064; } @@ -14726,49 +16858,16 @@ var ts; var id = getTypeListId(typeArguments); var type = target.instantiations[id]; if (!type) { - var flags = 4096 | (typeArguments ? getPropagatingFlagsOfTypes(typeArguments) : 0); + var propagatedFlags = typeArguments ? getPropagatingFlagsOfTypes(typeArguments, 0) : 0; + var flags = 4096 | propagatedFlags; type = target.instantiations[id] = createObjectType(flags, target.symbol); type.target = target; type.typeArguments = typeArguments; } return type; } - function isTypeParameterReferenceIllegalInConstraint(typeReferenceNode, typeParameterSymbol) { - var links = getNodeLinks(typeReferenceNode); - if (links.isIllegalTypeReferenceInConstraint !== undefined) { - return links.isIllegalTypeReferenceInConstraint; - } - var currentNode = typeReferenceNode; - while (!ts.forEach(typeParameterSymbol.declarations, function (d) { return d.parent === currentNode.parent; })) { - currentNode = currentNode.parent; - } - links.isIllegalTypeReferenceInConstraint = currentNode.kind === 137; - return links.isIllegalTypeReferenceInConstraint; - } - function checkTypeParameterHasIllegalReferencesInConstraint(typeParameter) { - var typeParameterSymbol; - function check(n) { - if (n.kind === 151 && n.typeName.kind === 69) { - var links = getNodeLinks(n); - if (links.isIllegalTypeReferenceInConstraint === undefined) { - var symbol = resolveName(typeParameter, n.typeName.text, 793056, undefined, undefined); - if (symbol && (symbol.flags & 262144)) { - links.isIllegalTypeReferenceInConstraint = ts.forEach(symbol.declarations, function (d) { return d.parent === typeParameter.parent; }); - } - } - if (links.isIllegalTypeReferenceInConstraint) { - error(typeParameter, ts.Diagnostics.Constraint_of_a_type_parameter_cannot_reference_any_type_parameter_from_the_same_type_parameter_list); - } - } - ts.forEachChild(n, check); - } - if (typeParameter.constraint) { - typeParameterSymbol = getSymbolOfNode(typeParameter); - check(typeParameter.constraint); - } - } function getTypeFromClassOrInterfaceReference(node, symbol) { - var type = getDeclaredTypeOfSymbol(symbol); + var type = getDeclaredTypeOfSymbol(getMergedSymbol(symbol)); var typeParameters = type.localTypeParameters; if (typeParameters) { if (!node.typeArguments || node.typeArguments.length !== typeParameters.length) { @@ -14803,26 +16902,68 @@ var ts; return type; } function getTypeFromNonGenericTypeReference(node, symbol) { - if (symbol.flags & 262144 && isTypeParameterReferenceIllegalInConstraint(node, symbol)) { - return unknownType; - } if (node.typeArguments) { error(node, ts.Diagnostics.Type_0_is_not_generic, symbolToString(symbol)); return unknownType; } return getDeclaredTypeOfSymbol(symbol); } + function getTypeReferenceName(node) { + switch (node.kind) { + case 155: + return node.typeName; + case 267: + return node.name; + case 194: + if (ts.isSupportedExpressionWithTypeArguments(node)) { + return node.expression; + } + } + return undefined; + } + function resolveTypeReferenceName(node, typeReferenceName) { + if (!typeReferenceName) { + return unknownSymbol; + } + return resolveEntityName(typeReferenceName, 793056) || unknownSymbol; + } + function getTypeReferenceType(node, symbol) { + if (symbol === unknownSymbol) { + return unknownType; + } + if (symbol.flags & (32 | 64)) { + return getTypeFromClassOrInterfaceReference(node, symbol); + } + if (symbol.flags & 524288) { + return getTypeFromTypeAliasReference(node, symbol); + } + if (symbol.flags & 107455 && node.kind === 267) { + return getTypeOfSymbol(symbol); + } + return getTypeFromNonGenericTypeReference(node, symbol); + } function getTypeFromTypeReference(node) { var links = getNodeLinks(node); if (!links.resolvedType) { - var typeNameOrExpression = node.kind === 151 ? node.typeName : - ts.isSupportedExpressionWithTypeArguments(node) ? node.expression : - undefined; - var symbol = typeNameOrExpression && resolveEntityName(typeNameOrExpression, 793056) || unknownSymbol; - var type = symbol === unknownSymbol ? unknownType : - symbol.flags & (32 | 64) ? getTypeFromClassOrInterfaceReference(node, symbol) : - symbol.flags & 524288 ? getTypeFromTypeAliasReference(node, symbol) : - getTypeFromNonGenericTypeReference(node, symbol); + var symbol = void 0; + var type = void 0; + if (node.kind === 267) { + var typeReferenceName = getTypeReferenceName(node); + symbol = resolveTypeReferenceName(node, typeReferenceName); + type = getTypeReferenceType(node, symbol); + links.resolvedSymbol = symbol; + links.resolvedType = type; + } + else { + var typeNameOrExpression = node.kind === 155 ? node.typeName : + ts.isSupportedExpressionWithTypeArguments(node) ? node.expression : + undefined; + symbol = typeNameOrExpression && resolveEntityName(typeNameOrExpression, 793056) || unknownSymbol; + type = symbol === unknownSymbol ? unknownType : + symbol.flags & (32 | 64) ? getTypeFromClassOrInterfaceReference(node, symbol) : + symbol.flags & 524288 ? getTypeFromTypeAliasReference(node, symbol) : + getTypeFromNonGenericTypeReference(node, symbol); + } links.resolvedSymbol = symbol; links.resolvedType = type; } @@ -14841,9 +16982,9 @@ var ts; for (var _i = 0, declarations_3 = declarations; _i < declarations_3.length; _i++) { var declaration = declarations_3[_i]; switch (declaration.kind) { - case 214: - case 215: - case 217: + case 221: + case 222: + case 224: return declaration; } } @@ -14875,18 +17016,11 @@ var ts; if (arity === void 0) { arity = 0; } return getTypeOfGlobalSymbol(getGlobalTypeSymbol(name), arity); } - function tryGetGlobalType(name, arity) { - if (arity === void 0) { arity = 0; } - return getTypeOfGlobalSymbol(getGlobalSymbol(name, 793056, undefined), arity); - } function getExportedTypeFromNamespace(namespace, name) { var namespaceSymbol = getGlobalSymbol(namespace, 1536, undefined); var typeSymbol = namespaceSymbol && getSymbol(namespaceSymbol.exports, name, 793056); return typeSymbol && getDeclaredTypeOfSymbol(typeSymbol); } - function getGlobalESSymbolConstructorSymbol() { - return globalESSymbolConstructorSymbol || (globalESSymbolConstructorSymbol = getGlobalValueSymbol("Symbol")); - } function createTypedPropertyDescriptorType(propertyType) { var globalTypedPropertyDescriptorType = getGlobalTypedPropertyDescriptorType(); return globalTypedPropertyDescriptorType !== emptyGenericType @@ -14897,10 +17031,10 @@ var ts; return genericGlobalType !== emptyGenericType ? createTypeReference(genericGlobalType, typeArguments) : emptyObjectType; } function createIterableType(elementType) { - return createTypeFromGenericGlobalType(globalIterableType, [elementType]); + return createTypeFromGenericGlobalType(getGlobalIterableType(), [elementType]); } function createIterableIteratorType(elementType) { - return createTypeFromGenericGlobalType(globalIterableIteratorType, [elementType]); + return createTypeFromGenericGlobalType(getGlobalIterableIteratorType(), [elementType]); } function createArrayType(elementType) { return createTypeFromGenericGlobalType(globalArrayType, [elementType]); @@ -14917,7 +17051,8 @@ var ts; return tupleTypes[id] || (tupleTypes[id] = createNewTupleType(elementTypes)); } function createNewTupleType(elementTypes) { - var type = createObjectType(8192 | getPropagatingFlagsOfTypes(elementTypes)); + var propagatedFlags = getPropagatingFlagsOfTypes(elementTypes, 0); + var type = createObjectType(8192 | propagatedFlags); type.elementTypes = elementTypes; return type; } @@ -14932,7 +17067,15 @@ var ts; if (type.flags & typeSetKind) { addTypesToSet(typeSet, type.types, typeSetKind); } - else if (!ts.contains(typeSet, type)) { + else if (type.flags & (1 | 32 | 64)) { + if (type.flags & 1) + typeSet.containsAny = true; + if (type.flags & 32) + typeSet.containsUndefined = true; + if (type.flags & 64) + typeSet.containsNull = true; + } + else if (type !== neverType && !ts.contains(typeSet, type)) { typeSet.push(type); } } @@ -14959,47 +17102,40 @@ var ts; } } } - function containsTypeAny(types) { - for (var _i = 0, types_5 = types; _i < types_5.length; _i++) { - var type = types_5[_i]; - if (isTypeAny(type)) { - return true; - } - } - return false; - } - function removeAllButLast(types, typeToRemove) { - var i = types.length; - while (i > 0 && types.length > 1) { - i--; - if (types[i] === typeToRemove) { - types.splice(i, 1); - } - } - } function getUnionType(types, noSubtypeReduction) { if (types.length === 0) { - return emptyObjectType; + return neverType; + } + if (types.length === 1) { + return types[0]; } var typeSet = []; addTypesToSet(typeSet, types, 16384); - if (containsTypeAny(typeSet)) { + if (typeSet.containsAny) { return anyType; } - if (noSubtypeReduction) { - removeAllButLast(typeSet, undefinedType); - removeAllButLast(typeSet, nullType); + if (strictNullChecks) { + if (typeSet.containsNull) + typeSet.push(nullType); + if (typeSet.containsUndefined) + typeSet.push(undefinedType); } - else { + if (!noSubtypeReduction) { removeSubtypes(typeSet); } - if (typeSet.length === 1) { + if (typeSet.length === 0) { + return typeSet.containsNull ? nullType : + typeSet.containsUndefined ? undefinedType : + neverType; + } + else if (typeSet.length === 1) { return typeSet[0]; } var id = getTypeListId(typeSet); var type = unionTypes[id]; if (!type) { - type = unionTypes[id] = createObjectType(16384 | getPropagatingFlagsOfTypes(typeSet)); + var propagatedFlags = getPropagatingFlagsOfTypes(typeSet, 96); + type = unionTypes[id] = createObjectType(16384 | propagatedFlags); type.types = typeSet; } return type; @@ -15017,16 +17153,23 @@ var ts; } var typeSet = []; addTypesToSet(typeSet, types, 32768); - if (containsTypeAny(typeSet)) { + if (typeSet.containsAny) { return anyType; } + if (strictNullChecks) { + if (typeSet.containsNull) + typeSet.push(nullType); + if (typeSet.containsUndefined) + typeSet.push(undefinedType); + } if (typeSet.length === 1) { return typeSet[0]; } var id = getTypeListId(typeSet); var type = intersectionTypes[id]; if (!type) { - type = intersectionTypes[id] = createObjectType(32768 | getPropagatingFlagsOfTypes(typeSet)); + var propagatedFlags = getPropagatingFlagsOfTypes(typeSet, 96); + type = intersectionTypes[id] = createObjectType(32768 | propagatedFlags); type.types = typeSet; } return type; @@ -15045,8 +17188,7 @@ var ts; } return links.resolvedType; } - function getStringLiteralType(node) { - var text = node.text; + function getStringLiteralTypeForText(text) { if (ts.hasProperty(stringLiteralTypes, text)) { return stringLiteralTypes[text]; } @@ -15054,19 +17196,35 @@ var ts; type.text = text; return type; } - function getTypeFromStringLiteral(node) { + function getTypeFromStringLiteralTypeNode(node) { var links = getNodeLinks(node); if (!links.resolvedType) { - links.resolvedType = getStringLiteralType(node); + links.resolvedType = getStringLiteralTypeForText(ts.unescapeIdentifier(node.text)); + } + return links.resolvedType; + } + function getTypeFromJSDocVariadicType(node) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + var type = getTypeFromTypeNode(node.type); + links.resolvedType = type ? createArrayType(type) : unknownType; + } + return links.resolvedType; + } + function getTypeFromJSDocTupleType(node) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + var types = ts.map(node.types, getTypeFromTypeNode); + links.resolvedType = createTupleType(types); } return links.resolvedType; } function getThisType(node) { var container = ts.getThisContainer(node, false); var parent = container && container.parent; - if (parent && (ts.isClassLike(parent) || parent.kind === 215)) { - if (!(container.flags & 64) && - (container.kind !== 144 || ts.isNodeDescendentOf(node, container.body))) { + if (parent && (ts.isClassLike(parent) || parent.kind === 222)) { + if (!(container.flags & 32) && + (container.kind !== 148 || ts.isNodeDescendentOf(node, container.body))) { return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent)).thisType; } } @@ -15083,47 +17241,70 @@ var ts; function getTypeFromTypeNode(node) { switch (node.kind) { case 117: + case 258: + case 259: return anyType; - case 130: + case 132: return stringType; - case 128: + case 130: return numberType; case 120: return booleanType; - case 131: + case 133: return esSymbolType; case 103: return voidType; + case 135: + return undefinedType; + case 93: + return nullType; + case 127: + return neverType; + case 165: case 97: return getTypeFromThisTypeNode(node); - case 9: - return getTypeFromStringLiteral(node); - case 151: - return getTypeFromTypeReference(node); - case 150: - return booleanType; - case 188: + case 166: + return getTypeFromStringLiteralTypeNode(node); + case 155: + case 267: return getTypeFromTypeReference(node); case 154: - return getTypeFromTypeQueryNode(node); - case 156: - return getTypeFromArrayTypeNode(node); - case 157: - return getTypeFromTupleTypeNode(node); + return booleanType; + case 194: + return getTypeFromTypeReference(node); case 158: - return getTypeFromUnionTypeNode(node); - case 159: - return getTypeFromIntersectionTypeNode(node); + return getTypeFromTypeQueryNode(node); case 160: + case 260: + return getTypeFromArrayTypeNode(node); + case 161: + return getTypeFromTupleTypeNode(node); + case 162: + case 261: + return getTypeFromUnionTypeNode(node); + case 163: + return getTypeFromIntersectionTypeNode(node); + case 164: + case 263: + case 264: + case 271: + case 272: + case 268: return getTypeFromTypeNode(node.type); - case 152: - case 153: - case 155: + case 156: + case 157: + case 159: + case 269: + case 265: return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); case 69: - case 135: + case 139: var symbol = getSymbolAtLocation(node); return symbol && getDeclaredTypeOfSymbol(symbol); + case 262: + return getTypeFromJSDocTupleType(node); + case 270: + return getTypeFromJSDocVariadicType(node); default: return unknownType; } @@ -15145,87 +17326,90 @@ var ts; function createBinaryTypeMapper(source1, target1, source2, target2) { return function (t) { return t === source1 ? target1 : t === source2 ? target2 : t; }; } - function createTypeMapper(sources, targets) { - switch (sources.length) { - case 1: return createUnaryTypeMapper(sources[0], targets[0]); - case 2: return createBinaryTypeMapper(sources[0], targets[0], sources[1], targets[1]); - } + function createArrayTypeMapper(sources, targets) { return function (t) { for (var i = 0; i < sources.length; i++) { if (t === sources[i]) { - return targets[i]; + return targets ? targets[i] : anyType; } } return t; }; } - function createUnaryTypeEraser(source) { - return function (t) { return t === source ? anyType : t; }; - } - function createBinaryTypeEraser(source1, source2) { - return function (t) { return t === source1 || t === source2 ? anyType : t; }; + function createTypeMapper(sources, targets) { + var count = sources.length; + var mapper = count == 1 ? createUnaryTypeMapper(sources[0], targets ? targets[0] : anyType) : + count == 2 ? createBinaryTypeMapper(sources[0], targets ? targets[0] : anyType, sources[1], targets ? targets[1] : anyType) : + createArrayTypeMapper(sources, targets); + mapper.mappedTypes = sources; + return mapper; } function createTypeEraser(sources) { - switch (sources.length) { - case 1: return createUnaryTypeEraser(sources[0]); - case 2: return createBinaryTypeEraser(sources[0], sources[1]); - } - return function (t) { - for (var _i = 0, sources_1 = sources; _i < sources_1.length; _i++) { - var source = sources_1[_i]; - if (t === source) { - return anyType; - } - } - return t; - }; + return createTypeMapper(sources, undefined); } - function createInferenceMapper(context) { - var mapper = function (t) { - for (var i = 0; i < context.typeParameters.length; i++) { - if (t === context.typeParameters[i]) { - context.inferences[i].isFixed = true; - return getInferredType(context, i); + function getInferenceMapper(context) { + if (!context.mapper) { + var mapper = function (t) { + var typeParameters = context.typeParameters; + for (var i = 0; i < typeParameters.length; i++) { + if (t === typeParameters[i]) { + context.inferences[i].isFixed = true; + return getInferredType(context, i); + } } - } - return t; - }; - mapper.context = context; - return mapper; + return t; + }; + mapper.mappedTypes = context.typeParameters; + mapper.context = context; + context.mapper = mapper; + } + return context.mapper; } function identityMapper(type) { return type; } function combineTypeMappers(mapper1, mapper2) { - return function (t) { return instantiateType(mapper1(t), mapper2); }; + var mapper = function (t) { return instantiateType(mapper1(t), mapper2); }; + mapper.mappedTypes = mapper1.mappedTypes; + return mapper; } - function instantiateTypeParameter(typeParameter, mapper) { + function cloneTypeParameter(typeParameter) { var result = createType(512); result.symbol = typeParameter.symbol; - if (typeParameter.constraint) { - result.constraint = instantiateType(typeParameter.constraint, mapper); + result.target = typeParameter; + return result; + } + function cloneTypePredicate(predicate, mapper) { + if (ts.isIdentifierTypePredicate(predicate)) { + return { + kind: 1, + parameterName: predicate.parameterName, + parameterIndex: predicate.parameterIndex, + type: instantiateType(predicate.type, mapper) + }; } else { - result.target = typeParameter; - result.mapper = mapper; + return { + kind: 0, + type: instantiateType(predicate.type, mapper) + }; } - return result; } function instantiateSignature(signature, mapper, eraseTypeParameters) { var freshTypeParameters; var freshTypePredicate; if (signature.typeParameters && !eraseTypeParameters) { - freshTypeParameters = instantiateList(signature.typeParameters, mapper, instantiateTypeParameter); + freshTypeParameters = ts.map(signature.typeParameters, cloneTypeParameter); mapper = combineTypeMappers(createTypeMapper(signature.typeParameters, freshTypeParameters), mapper); + for (var _i = 0, freshTypeParameters_1 = freshTypeParameters; _i < freshTypeParameters_1.length; _i++) { + var tp = freshTypeParameters_1[_i]; + tp.mapper = mapper; + } } if (signature.typePredicate) { - freshTypePredicate = { - parameterName: signature.typePredicate.parameterName, - parameterIndex: signature.typePredicate.parameterIndex, - type: instantiateType(signature.typePredicate.type, mapper) - }; + freshTypePredicate = cloneTypePredicate(signature.typePredicate, mapper); } - var result = createSignature(signature.declaration, freshTypeParameters, instantiateList(signature.parameters, mapper, instantiateSymbol), instantiateType(signature.resolvedReturnType, mapper), freshTypePredicate, signature.minArgumentCount, signature.hasRestParameter, signature.hasStringLiterals); + var result = createSignature(signature.declaration, freshTypeParameters, signature.thisType && instantiateType(signature.thisType, mapper), instantiateList(signature.parameters, mapper, instantiateSymbol), instantiateType(signature.resolvedReturnType, mapper), freshTypePredicate, signature.minArgumentCount, signature.hasRestParameter, signature.hasStringLiterals); result.target = signature; result.mapper = mapper; return result; @@ -15262,13 +17446,61 @@ var ts; mapper.instantiations[type.id] = result; return result; } + function isSymbolInScopeOfMappedTypeParameter(symbol, mapper) { + var mappedTypes = mapper.mappedTypes; + var node = symbol.declarations[0].parent; + while (node) { + switch (node.kind) { + case 156: + case 157: + case 220: + case 147: + case 146: + case 148: + case 151: + case 152: + case 153: + case 149: + case 150: + case 179: + case 180: + case 221: + case 192: + case 222: + case 223: + var declaration = node; + if (declaration.typeParameters) { + for (var _i = 0, _a = declaration.typeParameters; _i < _a.length; _i++) { + var d = _a[_i]; + if (ts.contains(mappedTypes, getDeclaredTypeOfTypeParameter(getSymbolOfNode(d)))) { + return true; + } + } + } + if (ts.isClassLike(node) || node.kind === 222) { + var thisType = getDeclaredTypeOfClassOrInterface(getSymbolOfNode(node)).thisType; + if (thisType && ts.contains(mappedTypes, thisType)) { + return true; + } + } + break; + case 225: + case 256: + return false; + } + node = node.parent; + } + return false; + } function instantiateType(type, mapper) { if (type && mapper !== identityMapper) { if (type.flags & 512) { return mapper(type); } if (type.flags & 65536) { - return type.symbol && type.symbol.flags & (16 | 8192 | 32 | 2048 | 4096) ? + return type.symbol && + type.symbol.flags & (16 | 8192 | 32 | 2048 | 4096) && + (type.flags & 131072 || isSymbolInScopeOfMappedTypeParameter(type.symbol, mapper)) ? instantiateAnonymousType(type, mapper) : type; } if (type.flags & 4096) { @@ -15286,34 +17518,42 @@ var ts; } return type; } + function instantiateIndexInfo(info, mapper) { + return info && createIndexInfo(instantiateType(info.type, mapper), info.isReadonly, info.declaration); + } function isContextSensitive(node) { - ts.Debug.assert(node.kind !== 143 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 147 || ts.isObjectLiteralMethod(node)); switch (node.kind) { - case 173: - case 174: + case 179: + case 180: return isContextSensitiveFunctionLikeDeclaration(node); - case 165: + case 171: return ts.forEach(node.properties, isContextSensitive); - case 164: + case 170: return ts.forEach(node.elements, isContextSensitive); - case 182: + case 188: return isContextSensitive(node.whenTrue) || isContextSensitive(node.whenFalse); - case 181: + case 187: return node.operatorToken.kind === 52 && (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 245: + case 253: return isContextSensitive(node.initializer); - case 143: - case 142: + case 147: + case 146: return isContextSensitiveFunctionLikeDeclaration(node); - case 172: + case 178: return isContextSensitive(node.expression); } return false; } function isContextSensitiveFunctionLikeDeclaration(node) { - return !node.typeParameters && node.parameters.length && !ts.forEach(node.parameters, function (p) { return p.type; }); + var areAllParametersUntyped = !ts.forEach(node.parameters, function (p) { return p.type; }); + var isNullaryArrow = node.kind === 180 && !node.parameters.length; + return !node.typeParameters && areAllParametersUntyped && !isNullaryArrow; + } + function isContextSensitiveFunctionOrObjectLiteralMethod(func) { + return (isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) && isContextSensitiveFunctionLikeDeclaration(func); } function getTypeWithoutSignatures(type) { if (type.flags & 80896) { @@ -15332,25 +17572,151 @@ var ts; function isTypeIdenticalTo(source, target) { return checkTypeRelatedTo(source, target, identityRelation, undefined); } - function compareTypes(source, target) { + function compareTypesIdentical(source, target) { return checkTypeRelatedTo(source, target, identityRelation, undefined) ? -1 : 0; } + function compareTypesAssignable(source, target) { + return checkTypeRelatedTo(source, target, assignableRelation, undefined) ? -1 : 0; + } function isTypeSubtypeOf(source, target) { return checkTypeSubtypeOf(source, target, undefined); } function isTypeAssignableTo(source, target) { return checkTypeAssignableTo(source, target, undefined); } + function isTypeComparableTo(source, target) { + return checkTypeComparableTo(source, target, undefined); + } function checkTypeSubtypeOf(source, target, errorNode, headMessage, containingMessageChain) { return checkTypeRelatedTo(source, target, subtypeRelation, errorNode, headMessage, containingMessageChain); } function checkTypeAssignableTo(source, target, errorNode, headMessage, containingMessageChain) { return checkTypeRelatedTo(source, target, assignableRelation, errorNode, headMessage, containingMessageChain); } - function isSignatureAssignableTo(source, target) { - var sourceType = getOrCreateTypeFromSignature(source); - var targetType = getOrCreateTypeFromSignature(target); - return checkTypeRelatedTo(sourceType, targetType, assignableRelation, undefined); + function checkTypeComparableTo(source, target, errorNode, headMessage, containingMessageChain) { + return checkTypeRelatedTo(source, target, comparableRelation, errorNode, headMessage, containingMessageChain); + } + function isSignatureAssignableTo(source, target, ignoreReturnTypes) { + return compareSignaturesRelated(source, target, ignoreReturnTypes, false, undefined, compareTypesAssignable) !== 0; + } + function compareSignaturesRelated(source, target, ignoreReturnTypes, reportErrors, errorReporter, compareTypes) { + if (source === target) { + return -1; + } + if (!target.hasRestParameter && source.minArgumentCount > target.parameters.length) { + return 0; + } + source = getErasedSignature(source); + target = getErasedSignature(target); + var result = -1; + if (source.thisType && target.thisType && source.thisType !== voidType) { + var related = compareTypes(source.thisType, target.thisType, false) + || compareTypes(target.thisType, source.thisType, reportErrors); + if (!related) { + if (reportErrors) { + errorReporter(ts.Diagnostics.The_this_types_of_each_signature_are_incompatible); + } + return 0; + } + result &= related; + } + var sourceMax = getNumNonRestParameters(source); + var targetMax = getNumNonRestParameters(target); + var checkCount = getNumParametersToCheckForSignatureRelatability(source, sourceMax, target, targetMax); + var sourceParams = source.parameters; + var targetParams = target.parameters; + for (var i = 0; i < checkCount; i++) { + var s = i < sourceMax ? getTypeOfParameter(sourceParams[i]) : getRestTypeOfSignature(source); + var t = i < targetMax ? getTypeOfParameter(targetParams[i]) : getRestTypeOfSignature(target); + var related = compareTypes(s, t, false) || compareTypes(t, s, reportErrors); + if (!related) { + if (reportErrors) { + errorReporter(ts.Diagnostics.Types_of_parameters_0_and_1_are_incompatible, sourceParams[i < sourceMax ? i : sourceMax].name, targetParams[i < targetMax ? i : targetMax].name); + } + return 0; + } + result &= related; + } + if (!ignoreReturnTypes) { + var targetReturnType = getReturnTypeOfSignature(target); + if (targetReturnType === voidType) { + return result; + } + var sourceReturnType = getReturnTypeOfSignature(source); + if (target.typePredicate) { + if (source.typePredicate) { + result &= compareTypePredicateRelatedTo(source.typePredicate, target.typePredicate, reportErrors, errorReporter, compareTypes); + } + else if (ts.isIdentifierTypePredicate(target.typePredicate)) { + if (reportErrors) { + errorReporter(ts.Diagnostics.Signature_0_must_have_a_type_predicate, signatureToString(source)); + } + return 0; + } + } + else { + result &= compareTypes(sourceReturnType, targetReturnType, reportErrors); + } + } + return result; + } + function compareTypePredicateRelatedTo(source, target, reportErrors, errorReporter, compareTypes) { + if (source.kind !== target.kind) { + if (reportErrors) { + errorReporter(ts.Diagnostics.A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard); + errorReporter(ts.Diagnostics.Type_predicate_0_is_not_assignable_to_1, typePredicateToString(source), typePredicateToString(target)); + } + return 0; + } + if (source.kind === 1) { + var sourceIdentifierPredicate = source; + var targetIdentifierPredicate = target; + if (sourceIdentifierPredicate.parameterIndex !== targetIdentifierPredicate.parameterIndex) { + if (reportErrors) { + errorReporter(ts.Diagnostics.Parameter_0_is_not_in_the_same_position_as_parameter_1, sourceIdentifierPredicate.parameterName, targetIdentifierPredicate.parameterName); + errorReporter(ts.Diagnostics.Type_predicate_0_is_not_assignable_to_1, typePredicateToString(source), typePredicateToString(target)); + } + return 0; + } + } + var related = compareTypes(source.type, target.type, reportErrors); + if (related === 0 && reportErrors) { + errorReporter(ts.Diagnostics.Type_predicate_0_is_not_assignable_to_1, typePredicateToString(source), typePredicateToString(target)); + } + return related; + } + function isImplementationCompatibleWithOverload(implementation, overload) { + var erasedSource = getErasedSignature(implementation); + var erasedTarget = getErasedSignature(overload); + var sourceReturnType = getReturnTypeOfSignature(erasedSource); + var targetReturnType = getReturnTypeOfSignature(erasedTarget); + if (targetReturnType === voidType + || checkTypeRelatedTo(targetReturnType, sourceReturnType, assignableRelation, undefined) + || checkTypeRelatedTo(sourceReturnType, targetReturnType, assignableRelation, undefined)) { + return isSignatureAssignableTo(erasedSource, erasedTarget, true); + } + return false; + } + function getNumNonRestParameters(signature) { + var numParams = signature.parameters.length; + return signature.hasRestParameter ? + numParams - 1 : + numParams; + } + function getNumParametersToCheckForSignatureRelatability(source, sourceNonRestParamCount, target, targetNonRestParamCount) { + if (source.hasRestParameter === target.hasRestParameter) { + if (source.hasRestParameter) { + return Math.max(sourceNonRestParamCount, targetNonRestParamCount) + 1; + } + else { + return Math.min(sourceNonRestParamCount, targetNonRestParamCount); + } + } + else { + return source.hasRestParameter ? + targetNonRestParamCount : + sourceNonRestParamCount; + } } function checkTypeRelatedTo(source, target, relation, errorNode, headMessage, containingMessageChain) { var errorInfo; @@ -15360,18 +17726,12 @@ var ts; var expandingFlags; var depth = 0; var overflow = false; - var elaborateErrors = false; ts.Debug.assert(relation !== identityRelation || !errorNode, "no error reporting in identity checking"); - var result = isRelatedTo(source, target, errorNode !== undefined, headMessage); + var result = isRelatedTo(source, target, !!errorNode, headMessage); if (overflow) { error(errorNode, ts.Diagnostics.Excessive_stack_depth_comparing_types_0_and_1, typeToString(source), typeToString(target)); } else if (errorInfo) { - if (errorInfo.next === undefined) { - errorInfo = undefined; - elaborateErrors = true; - isRelatedTo(source, target, errorNode !== undefined, headMessage); - } if (containingMessageChain) { errorInfo = ts.concatenateDiagnosticMessageChains(containingMessageChain, errorInfo); } @@ -15379,6 +17739,7 @@ var ts; } return result !== 0; function reportError(message, arg0, arg1, arg2) { + ts.Debug.assert(!!errorNode); errorInfo = ts.chainDiagnosticMessages(errorInfo, message, arg0, arg1, arg2); } function reportRelationError(message, source, target) { @@ -15388,7 +17749,12 @@ var ts; sourceType = typeToString(source, undefined, 128); targetType = typeToString(target, undefined, 128); } - reportError(message || ts.Diagnostics.Type_0_is_not_assignable_to_type_1, sourceType, targetType); + if (!message) { + message = relation === comparableRelation ? + ts.Diagnostics.Type_0_is_not_comparable_to_type_1 : + ts.Diagnostics.Type_0_is_not_assignable_to_type_1; + } + reportError(message, sourceType, targetType); } function isRelatedTo(source, target, reportErrors, headMessage) { var result; @@ -15397,21 +17763,35 @@ var ts; if (relation === identityRelation) { return isIdenticalTo(source, target); } - if (isTypeAny(target)) - return -1; - if (source === undefinedType) - return -1; - if (source === nullType && target !== undefinedType) - return -1; - if (source.flags & 128 && target === numberType) - return -1; - if (source.flags & 256 && target === stringType) - return -1; - if (relation === assignableRelation) { - if (isTypeAny(source)) + if (!(target.flags & 134217728)) { + if (target.flags & 1) return -1; - if (source === numberType && target.flags & 128) + if (source.flags & 32) { + if (!strictNullChecks || target.flags & (32 | 16) || source === emptyArrayElementType) + return -1; + } + if (source.flags & 64) { + if (!strictNullChecks || target.flags & 64) + return -1; + } + if (source.flags & 128 && target === numberType) return -1; + if (source.flags & 128 && target.flags & 128) { + if (result = enumRelatedTo(source, target, reportErrors)) { + return result; + } + } + if (source.flags & 256 && target === stringType) + return -1; + if (relation === assignableRelation || relation === comparableRelation) { + if (source.flags & (1 | 134217728)) + return -1; + if (source === numberType && target.flags & 128) + return -1; + } + if (source.flags & 8 && target.flags & 8) { + return -1; + } } if (source.flags & 1048576) { if (hasExcessProperties(source, target, reportErrors)) { @@ -15426,23 +17806,30 @@ var ts; } var saveErrorInfo = errorInfo; if (source.flags & 16384) { - if (result = eachTypeRelatedToType(source, target, reportErrors)) { + if (relation === comparableRelation) { + result = someTypeRelatedToType(source, target, reportErrors); + } + else { + result = eachTypeRelatedToType(source, target, reportErrors); + } + if (result) { return result; } } else if (target.flags & 32768) { - if (result = typeRelatedToEachType(source, target, reportErrors)) { + result = typeRelatedToEachType(source, target, reportErrors); + if (result) { return result; } } else { if (source.flags & 32768) { - if (result = someTypeRelatedToType(source, target, reportErrors && !(target.flags & 16384))) { + if (result = someTypeRelatedToType(source, target, false)) { return result; } } if (target.flags & 16384) { - if (result = typeRelatedToSomeType(source, target, reportErrors)) { + if (result = typeRelatedToSomeType(source, target, reportErrors && !(source.flags & 16777726))) { return result; } } @@ -15452,6 +17839,7 @@ var ts; if (!constraint || constraint.flags & 1) { constraint = emptyObjectType; } + constraint = getTypeWithThisArgument(constraint, source); var reportConstraintErrors = reportErrors && constraint !== emptyObjectType; if (result = isRelatedTo(constraint, target, reportConstraintErrors)) { errorInfo = saveErrorInfo; @@ -15464,10 +17852,10 @@ var ts; return result; } } - var apparentType = getApparentType(source); - if (apparentType.flags & (80896 | 32768) && target.flags & 80896) { - var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo; - if (result = objectTypeRelatedTo(apparentType, source, target, reportStructuralErrors)) { + var apparentSource = getApparentType(source); + if (apparentSource.flags & (80896 | 32768) && target.flags & 80896) { + var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo && !(source.flags & 16777726); + if (result = objectTypeRelatedTo(apparentSource, source, target, reportStructuralErrors)) { errorInfo = saveErrorInfo; return result; } @@ -15488,13 +17876,10 @@ var ts; } return objectTypeRelatedTo(source, source, target, false); } - if (source.flags & 512 && target.flags & 512) { - return typeParameterIdenticalTo(source, target); - } if (source.flags & 16384 && target.flags & 16384 || source.flags & 32768 && target.flags & 32768) { - if (result = eachTypeRelatedToSomeType(source, target)) { - if (result &= eachTypeRelatedToSomeType(target, source)) { + if (result = eachTypeRelatedToSomeType(source, target, false)) { + if (result &= eachTypeRelatedToSomeType(target, source, false)) { return result; } } @@ -15504,8 +17889,9 @@ var ts; function isKnownProperty(type, name) { if (type.flags & 80896) { var resolved = resolveStructuredTypeMembers(type); - if (relation === assignableRelation && (type === globalObjectType || resolved.properties.length === 0) || - resolved.stringIndexType || resolved.numberIndexType || getPropertyOfType(type, name)) { + if ((relation === assignableRelation || relation === comparableRelation) && + (type === globalObjectType || isEmptyObjectType(resolved)) || + resolved.stringIndexInfo || resolved.numberIndexInfo || getPropertyOfType(type, name)) { return true; } } @@ -15519,12 +17905,20 @@ var ts; } return false; } + function isEmptyObjectType(t) { + return t.properties.length === 0 && + t.callSignatures.length === 0 && + t.constructSignatures.length === 0 && + !t.stringIndexInfo && + !t.numberIndexInfo; + } function hasExcessProperties(source, target, reportErrors) { - if (!(target.flags & 67108864) && someConstituentTypeHasKind(target, 80896)) { + if (!(target.flags & 67108864) && maybeTypeOfKind(target, 80896)) { for (var _i = 0, _a = getPropertiesOfObjectType(source); _i < _a.length; _i++) { var prop = _a[_i]; if (!isKnownProperty(target, prop.name)) { if (reportErrors) { + ts.Debug.assert(!!errorNode); errorNode = prop.valueDeclaration; reportError(ts.Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1, symbolToString(prop), typeToString(target)); } @@ -15534,7 +17928,7 @@ var ts; } return false; } - function eachTypeRelatedToSomeType(source, target) { + function eachTypeRelatedToSomeType(source, target, reportErrors) { var result = -1; var sourceTypes = source.types; for (var _i = 0, sourceTypes_1 = sourceTypes; _i < sourceTypes_1.length; _i++) { @@ -15549,7 +17943,15 @@ var ts; } function typeRelatedToSomeType(source, target, reportErrors) { var targetTypes = target.types; - for (var i = 0, len = targetTypes.length; i < len; i++) { + var len = targetTypes.length; + while (len >= 2 && targetTypes[len - 1].flags & 96) { + var related = isRelatedTo(source, targetTypes[len - 1], false); + if (related) { + return related; + } + len--; + } + for (var i = 0; i < len; i++) { var related = isRelatedTo(source, targetTypes[i], reportErrors && i === len - 1); if (related) { return related; @@ -15572,7 +17974,15 @@ var ts; } function someTypeRelatedToType(source, target, reportErrors) { var sourceTypes = source.types; - for (var i = 0, len = sourceTypes.length; i < len; i++) { + var len = sourceTypes.length; + while (len >= 2 && sourceTypes[len - 1].flags & 96) { + var related = isRelatedTo(sourceTypes[len - 1], target, false); + if (related) { + return related; + } + len--; + } + for (var i = 0; i < len; i++) { var related = isRelatedTo(sourceTypes[i], target, reportErrors && i === len - 1); if (related) { return related; @@ -15599,8 +18009,9 @@ var ts; if (sources.length !== targets.length && relation === identityRelation) { return 0; } + var length = sources.length <= targets.length ? sources.length : targets.length; var result = -1; - for (var i = 0; i < targets.length; i++) { + for (var i = 0; i < length; i++) { var related = isRelatedTo(sources[i], targets[i], reportErrors); if (!related) { return 0; @@ -15609,23 +18020,17 @@ var ts; } return result; } - function typeParameterIdenticalTo(source, target) { - if (source.constraint === target.constraint) { - return -1; - } - if (source.constraint === noConstraintType || target.constraint === noConstraintType) { - return 0; - } - return isIdenticalTo(source.constraint, target.constraint); - } - function objectTypeRelatedTo(apparentSource, originalSource, target, reportErrors) { + function objectTypeRelatedTo(source, originalSource, target, reportErrors) { if (overflow) { return 0; } - var id = relation !== identityRelation || apparentSource.id < target.id ? apparentSource.id + "," + target.id : target.id + "," + apparentSource.id; + var id = relation !== identityRelation || source.id < target.id ? source.id + "," + target.id : target.id + "," + source.id; var related = relation[id]; if (related !== undefined) { - if (!elaborateErrors || (related === 3)) { + if (reportErrors && related === 2) { + relation[id] = 3; + } + else { return related === 1 ? -1 : 0; } } @@ -15646,13 +18051,13 @@ var ts; maybeStack = []; expandingFlags = 0; } - sourceStack[depth] = apparentSource; + sourceStack[depth] = source; targetStack[depth] = target; maybeStack[depth] = {}; maybeStack[depth][id] = 1; depth++; var saveExpandingFlags = expandingFlags; - if (!(expandingFlags & 1) && isDeeplyNestedGeneric(apparentSource, sourceStack, depth)) + if (!(expandingFlags & 1) && isDeeplyNestedGeneric(source, sourceStack, depth)) expandingFlags |= 1; if (!(expandingFlags & 2) && isDeeplyNestedGeneric(target, targetStack, depth)) expandingFlags |= 2; @@ -15661,15 +18066,15 @@ var ts; result = 1; } else { - result = propertiesRelatedTo(apparentSource, target, reportErrors); + result = propertiesRelatedTo(source, target, reportErrors); if (result) { - result &= signaturesRelatedTo(apparentSource, target, 0, reportErrors); + result &= signaturesRelatedTo(source, target, 0, reportErrors); if (result) { - result &= signaturesRelatedTo(apparentSource, target, 1, reportErrors); + result &= signaturesRelatedTo(source, target, 1, reportErrors); if (result) { - result &= stringIndexTypesRelatedTo(apparentSource, originalSource, target, reportErrors); + result &= indexTypesRelatedTo(source, originalSource, target, 0, reportErrors); if (result) { - result &= numberIndexTypesRelatedTo(apparentSource, originalSource, target, reportErrors); + result &= indexTypesRelatedTo(source, originalSource, target, 1, reportErrors); } } } @@ -15709,23 +18114,23 @@ var ts; else if (!(targetProp.flags & 134217728)) { var sourcePropFlags = getDeclarationFlagsFromSymbol(sourceProp); var targetPropFlags = getDeclarationFlagsFromSymbol(targetProp); - if (sourcePropFlags & 16 || targetPropFlags & 16) { + if (sourcePropFlags & 8 || targetPropFlags & 8) { if (sourceProp.valueDeclaration !== targetProp.valueDeclaration) { if (reportErrors) { - if (sourcePropFlags & 16 && targetPropFlags & 16) { + if (sourcePropFlags & 8 && targetPropFlags & 8) { reportError(ts.Diagnostics.Types_have_separate_declarations_of_a_private_property_0, symbolToString(targetProp)); } else { - reportError(ts.Diagnostics.Property_0_is_private_in_type_1_but_not_in_type_2, symbolToString(targetProp), typeToString(sourcePropFlags & 16 ? source : target), typeToString(sourcePropFlags & 16 ? target : source)); + reportError(ts.Diagnostics.Property_0_is_private_in_type_1_but_not_in_type_2, symbolToString(targetProp), typeToString(sourcePropFlags & 8 ? source : target), typeToString(sourcePropFlags & 8 ? target : source)); } } return 0; } } - else if (targetPropFlags & 32) { + else if (targetPropFlags & 16) { var sourceDeclaredInClass = sourceProp.parent && sourceProp.parent.flags & 32; - var sourceClass = sourceDeclaredInClass ? getDeclaredTypeOfSymbol(sourceProp.parent) : undefined; - var targetClass = getDeclaredTypeOfSymbol(targetProp.parent); + var sourceClass = sourceDeclaredInClass ? getDeclaredTypeOfSymbol(getParentOfSymbol(sourceProp)) : undefined; + var targetClass = getDeclaredTypeOfSymbol(getParentOfSymbol(targetProp)); if (!sourceClass || !hasBaseType(sourceClass, targetClass)) { if (reportErrors) { reportError(ts.Diagnostics.Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2, symbolToString(targetProp), typeToString(sourceClass || source), typeToString(targetClass)); @@ -15733,7 +18138,7 @@ var ts; return 0; } } - else if (sourcePropFlags & 32) { + else if (sourcePropFlags & 16) { if (reportErrors) { reportError(ts.Diagnostics.Property_0_is_protected_in_type_1_but_public_in_type_2, symbolToString(targetProp), typeToString(source), typeToString(target)); } @@ -15791,140 +18196,41 @@ var ts; } var sourceSignatures = getSignaturesOfType(source, kind); var targetSignatures = getSignaturesOfType(target, kind); + if (kind === 1 && sourceSignatures.length && targetSignatures.length) { + if (isAbstractConstructorType(source) && !isAbstractConstructorType(target)) { + if (reportErrors) { + reportError(ts.Diagnostics.Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type); + } + return 0; + } + if (!constructorVisibilitiesAreCompatible(sourceSignatures[0], targetSignatures[0], reportErrors)) { + return 0; + } + } var result = -1; var saveErrorInfo = errorInfo; - if (kind === 1) { - var sourceSig = sourceSignatures[0]; - var targetSig = targetSignatures[0]; - result &= abstractSignatureRelatedTo(source, sourceSig, target, targetSig); - if (result !== -1) { - return result; - } - } outer: for (var _i = 0, targetSignatures_1 = targetSignatures; _i < targetSignatures_1.length; _i++) { var t = targetSignatures_1[_i]; - if (!t.hasStringLiterals || target.flags & 262144) { - var localErrors = reportErrors; - var checkedAbstractAssignability = false; - for (var _a = 0, sourceSignatures_1 = sourceSignatures; _a < sourceSignatures_1.length; _a++) { - var s = sourceSignatures_1[_a]; - if (!s.hasStringLiterals || source.flags & 262144) { - var related = signatureRelatedTo(s, t, localErrors); - if (related) { - result &= related; - errorInfo = saveErrorInfo; - continue outer; - } - localErrors = false; - } + var shouldElaborateErrors = reportErrors; + for (var _a = 0, sourceSignatures_1 = sourceSignatures; _a < sourceSignatures_1.length; _a++) { + var s = sourceSignatures_1[_a]; + var related = signatureRelatedTo(s, t, shouldElaborateErrors); + if (related) { + result &= related; + errorInfo = saveErrorInfo; + continue outer; } - return 0; + shouldElaborateErrors = false; } + if (shouldElaborateErrors) { + reportError(ts.Diagnostics.Type_0_provides_no_match_for_the_signature_1, typeToString(source), signatureToString(t, undefined, undefined, kind)); + } + return 0; } return result; - function abstractSignatureRelatedTo(source, sourceSig, target, targetSig) { - if (sourceSig && targetSig) { - var sourceDecl = source.symbol && getClassLikeDeclarationOfSymbol(source.symbol); - var targetDecl = target.symbol && getClassLikeDeclarationOfSymbol(target.symbol); - if (!sourceDecl) { - return -1; - } - var sourceErasedSignature = getErasedSignature(sourceSig); - var targetErasedSignature = getErasedSignature(targetSig); - var sourceReturnType = sourceErasedSignature && getReturnTypeOfSignature(sourceErasedSignature); - var targetReturnType = targetErasedSignature && getReturnTypeOfSignature(targetErasedSignature); - var sourceReturnDecl = sourceReturnType && sourceReturnType.symbol && getClassLikeDeclarationOfSymbol(sourceReturnType.symbol); - var targetReturnDecl = targetReturnType && targetReturnType.symbol && getClassLikeDeclarationOfSymbol(targetReturnType.symbol); - var sourceIsAbstract = sourceReturnDecl && sourceReturnDecl.flags & 128; - var targetIsAbstract = targetReturnDecl && targetReturnDecl.flags & 128; - if (sourceIsAbstract && !(targetIsAbstract && targetDecl)) { - if (reportErrors) { - reportError(ts.Diagnostics.Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type); - } - return 0; - } - } - return -1; - } } function signatureRelatedTo(source, target, reportErrors) { - if (source === target) { - return -1; - } - if (!target.hasRestParameter && source.minArgumentCount > target.parameters.length) { - return 0; - } - var sourceMax = source.parameters.length; - var targetMax = target.parameters.length; - var checkCount; - if (source.hasRestParameter && target.hasRestParameter) { - checkCount = sourceMax > targetMax ? sourceMax : targetMax; - sourceMax--; - targetMax--; - } - else if (source.hasRestParameter) { - sourceMax--; - checkCount = targetMax; - } - else if (target.hasRestParameter) { - targetMax--; - checkCount = sourceMax; - } - else { - checkCount = sourceMax < targetMax ? sourceMax : targetMax; - } - source = getErasedSignature(source); - target = getErasedSignature(target); - var result = -1; - for (var i = 0; i < checkCount; i++) { - var s = i < sourceMax ? getTypeOfSymbol(source.parameters[i]) : getRestTypeOfSignature(source); - var t = i < targetMax ? getTypeOfSymbol(target.parameters[i]) : getRestTypeOfSignature(target); - var saveErrorInfo = errorInfo; - var related = isRelatedTo(s, t, reportErrors); - if (!related) { - related = isRelatedTo(t, s, false); - if (!related) { - if (reportErrors) { - reportError(ts.Diagnostics.Types_of_parameters_0_and_1_are_incompatible, source.parameters[i < sourceMax ? i : sourceMax].name, target.parameters[i < targetMax ? i : targetMax].name); - } - return 0; - } - errorInfo = saveErrorInfo; - } - result &= related; - } - if (source.typePredicate && target.typePredicate) { - var hasDifferentParameterIndex = source.typePredicate.parameterIndex !== target.typePredicate.parameterIndex; - var hasDifferentTypes; - if (hasDifferentParameterIndex || - (hasDifferentTypes = !isTypeIdenticalTo(source.typePredicate.type, target.typePredicate.type))) { - if (reportErrors) { - var sourceParamText = source.typePredicate.parameterName; - var targetParamText = target.typePredicate.parameterName; - var sourceTypeText = typeToString(source.typePredicate.type); - var targetTypeText = typeToString(target.typePredicate.type); - if (hasDifferentParameterIndex) { - reportError(ts.Diagnostics.Parameter_0_is_not_in_the_same_position_as_parameter_1, sourceParamText, targetParamText); - } - else if (hasDifferentTypes) { - reportError(ts.Diagnostics.Type_0_is_not_assignable_to_type_1, sourceTypeText, targetTypeText); - } - reportError(ts.Diagnostics.Type_predicate_0_is_not_assignable_to_1, sourceParamText + " is " + sourceTypeText, targetParamText + " is " + targetTypeText); - } - return 0; - } - } - else if (!source.typePredicate && target.typePredicate) { - if (reportErrors) { - reportError(ts.Diagnostics.Signature_0_must_have_a_type_predicate, signatureToString(source)); - } - return 0; - } - var targetReturnType = getReturnTypeOfSignature(target); - if (targetReturnType === voidType) - return result; - var sourceReturnType = getReturnTypeOfSignature(source); - return result & isRelatedTo(sourceReturnType, targetReturnType, reportErrors); + return compareSignaturesRelated(source, target, false, reportErrors, reportError, isRelatedTo); } function signaturesIdenticalTo(source, target, kind) { var sourceSignatures = getSignaturesOfType(source, kind); @@ -15933,8 +18239,8 @@ var ts; return 0; } var result = -1; - for (var i = 0, len = sourceSignatures.length; i < len; ++i) { - var related = compareSignatures(sourceSignatures[i], targetSignatures[i], false, false, isRelatedTo); + for (var i = 0, len = sourceSignatures.length; i < len; i++) { + var related = compareSignaturesIdentical(sourceSignatures[i], targetSignatures[i], false, false, false, isRelatedTo); if (!related) { return 0; } @@ -15942,78 +18248,125 @@ var ts; } return result; } - function stringIndexTypesRelatedTo(source, originalSource, target, reportErrors) { - if (relation === identityRelation) { - return indexTypesIdenticalTo(0, source, target); - } - var targetType = getIndexTypeOfType(target, 0); - if (targetType) { - if ((targetType.flags & 1) && !(originalSource.flags & 16777726)) { - return -1; - } - var sourceType = getIndexTypeOfType(source, 0); - if (!sourceType) { - if (reportErrors) { - reportError(ts.Diagnostics.Index_signature_is_missing_in_type_0, typeToString(source)); + function eachPropertyRelatedTo(source, target, kind, reportErrors) { + var result = -1; + for (var _i = 0, _a = getPropertiesOfObjectType(source); _i < _a.length; _i++) { + var prop = _a[_i]; + if (kind === 0 || isNumericLiteralName(prop.name)) { + var related = isRelatedTo(getTypeOfSymbol(prop), target, reportErrors); + if (!related) { + if (reportErrors) { + reportError(ts.Diagnostics.Property_0_is_incompatible_with_index_signature, symbolToString(prop)); + } + return 0; } - return 0; + result &= related; } - var related = isRelatedTo(sourceType, targetType, reportErrors); - if (!related) { - if (reportErrors) { - reportError(ts.Diagnostics.Index_signatures_are_incompatible); - } - return 0; - } - return related; } - return -1; + return result; } - function numberIndexTypesRelatedTo(source, originalSource, target, reportErrors) { - if (relation === identityRelation) { - return indexTypesIdenticalTo(1, source, target); + function indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors) { + var related = isRelatedTo(sourceInfo.type, targetInfo.type, reportErrors); + if (!related && reportErrors) { + reportError(ts.Diagnostics.Index_signatures_are_incompatible); } - var targetType = getIndexTypeOfType(target, 1); - if (targetType) { - if ((targetType.flags & 1) && !(originalSource.flags & 16777726)) { - return -1; - } - var sourceStringType = getIndexTypeOfType(source, 0); - var sourceNumberType = getIndexTypeOfType(source, 1); - if (!(sourceStringType || sourceNumberType)) { - if (reportErrors) { - reportError(ts.Diagnostics.Index_signature_is_missing_in_type_0, typeToString(source)); - } - return 0; - } - var related; - if (sourceStringType && sourceNumberType) { - related = isRelatedTo(sourceStringType, targetType, false) || isRelatedTo(sourceNumberType, targetType, reportErrors); - } - else { - related = isRelatedTo(sourceStringType || sourceNumberType, targetType, reportErrors); - } - if (!related) { - if (reportErrors) { - reportError(ts.Diagnostics.Index_signatures_are_incompatible); - } - return 0; - } - return related; - } - return -1; + return related; } - function indexTypesIdenticalTo(indexKind, source, target) { - var targetType = getIndexTypeOfType(target, indexKind); - var sourceType = getIndexTypeOfType(source, indexKind); - if (!sourceType && !targetType) { + function indexTypesRelatedTo(source, originalSource, target, kind, reportErrors) { + if (relation === identityRelation) { + return indexTypesIdenticalTo(source, target, kind); + } + var targetInfo = getIndexInfoOfType(target, kind); + if (!targetInfo || ((targetInfo.type.flags & 1) && !(originalSource.flags & 16777726))) { return -1; } - if (sourceType && targetType) { - return isRelatedTo(sourceType, targetType); + var sourceInfo = getIndexInfoOfType(source, kind) || + kind === 1 && getIndexInfoOfType(source, 0); + if (sourceInfo) { + return indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors); + } + if (isObjectLiteralType(source)) { + var related = -1; + if (kind === 0) { + var sourceNumberInfo = getIndexInfoOfType(source, 1); + if (sourceNumberInfo) { + related = indexInfoRelatedTo(sourceNumberInfo, targetInfo, reportErrors); + } + } + if (related) { + related &= eachPropertyRelatedTo(source, targetInfo.type, kind, reportErrors); + } + return related; + } + if (reportErrors) { + reportError(ts.Diagnostics.Index_signature_is_missing_in_type_0, typeToString(source)); } return 0; } + function indexTypesIdenticalTo(source, target, indexKind) { + var targetInfo = getIndexInfoOfType(target, indexKind); + var sourceInfo = getIndexInfoOfType(source, indexKind); + if (!sourceInfo && !targetInfo) { + return -1; + } + if (sourceInfo && targetInfo && sourceInfo.isReadonly === targetInfo.isReadonly) { + return isRelatedTo(sourceInfo.type, targetInfo.type); + } + return 0; + } + function enumRelatedTo(source, target, reportErrors) { + if (source.symbol.name !== target.symbol.name || + source.symbol.flags & 128 || + target.symbol.flags & 128) { + return 0; + } + var targetEnumType = getTypeOfSymbol(target.symbol); + for (var _i = 0, _a = getPropertiesOfType(getTypeOfSymbol(source.symbol)); _i < _a.length; _i++) { + var property = _a[_i]; + if (property.flags & 8) { + var targetProperty = getPropertyOfType(targetEnumType, property.name); + if (!targetProperty || !(targetProperty.flags & 8)) { + if (reportErrors) { + reportError(ts.Diagnostics.Property_0_is_missing_in_type_1, property.name, typeToString(target, undefined, 128)); + } + return 0; + } + } + } + return -1; + } + function constructorVisibilitiesAreCompatible(sourceSignature, targetSignature, reportErrors) { + if (!sourceSignature.declaration || !targetSignature.declaration) { + return true; + } + var sourceAccessibility = sourceSignature.declaration.flags & (8 | 16); + var targetAccessibility = targetSignature.declaration.flags & (8 | 16); + if (targetAccessibility === 8) { + return true; + } + if (targetAccessibility === 16 && sourceAccessibility !== 8) { + return true; + } + if (targetAccessibility !== 16 && !sourceAccessibility) { + return true; + } + if (reportErrors) { + reportError(ts.Diagnostics.Cannot_assign_a_0_constructor_type_to_a_1_constructor_type, visibilityToString(sourceAccessibility), visibilityToString(targetAccessibility)); + } + return false; + } + } + function isAbstractConstructorType(type) { + if (type.flags & 65536) { + var symbol = type.symbol; + if (symbol && symbol.flags & 32) { + var declaration = getClassLikeDeclarationOfSymbol(symbol); + if (declaration && declaration.flags & 128) { + return true; + } + } + } + return false; } function isDeeplyNestedGeneric(type, stack, depth) { if (type.flags & (4096 | 131072) && depth >= 5) { @@ -16031,14 +18384,14 @@ var ts; return false; } function isPropertyIdenticalTo(sourceProp, targetProp) { - return compareProperties(sourceProp, targetProp, compareTypes) !== 0; + return compareProperties(sourceProp, targetProp, compareTypesIdentical) !== 0; } function compareProperties(sourceProp, targetProp, compareTypes) { if (sourceProp === targetProp) { return -1; } - var sourcePropAccessibility = getDeclarationFlagsFromSymbol(sourceProp) & (16 | 32); - var targetPropAccessibility = getDeclarationFlagsFromSymbol(targetProp) & (16 | 32); + var sourcePropAccessibility = getDeclarationFlagsFromSymbol(sourceProp) & (8 | 16); + var targetPropAccessibility = getDeclarationFlagsFromSymbol(targetProp) & (8 | 16); if (sourcePropAccessibility !== targetPropAccessibility) { return 0; } @@ -16052,6 +18405,9 @@ var ts; return 0; } } + if (isReadonlySymbol(sourceProp) !== isReadonlySymbol(targetProp)) { + return 0; + } return compareTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp)); } function isMatchingSignature(source, target, partialMatch) { @@ -16066,35 +18422,30 @@ var ts; } return false; } - function compareSignatures(source, target, partialMatch, ignoreReturnTypes, compareTypes) { + function compareSignaturesIdentical(source, target, partialMatch, ignoreThisTypes, ignoreReturnTypes, compareTypes) { if (source === target) { return -1; } if (!(isMatchingSignature(source, target, partialMatch))) { return 0; } - var result = -1; - if (source.typeParameters && target.typeParameters) { - if (source.typeParameters.length !== target.typeParameters.length) { - return 0; - } - for (var i = 0, len = source.typeParameters.length; i < len; ++i) { - var related = compareTypes(source.typeParameters[i], target.typeParameters[i]); - if (!related) { - return 0; - } - result &= related; - } - } - else if (source.typeParameters || target.typeParameters) { + if ((source.typeParameters ? source.typeParameters.length : 0) !== (target.typeParameters ? target.typeParameters.length : 0)) { return 0; } source = getErasedSignature(source); target = getErasedSignature(target); + var result = -1; + if (!ignoreThisTypes && source.thisType && target.thisType) { + var related = compareTypes(source.thisType, target.thisType); + if (!related) { + return 0; + } + result &= related; + } var targetLen = target.parameters.length; for (var i = 0; i < targetLen; i++) { - var s = isRestParameterIndex(source, i) ? getRestTypeOfSignature(source) : getTypeOfSymbol(source.parameters[i]); - var t = isRestParameterIndex(target, i) ? getRestTypeOfSignature(target) : getTypeOfSymbol(target.parameters[i]); + var s = isRestParameterIndex(source, i) ? getRestTypeOfSignature(source) : getTypeOfParameter(source.parameters[i]); + var t = isRestParameterIndex(target, i) ? getRestTypeOfSignature(target) : getTypeOfParameter(target.parameters[i]); var related = compareTypes(s, t); if (!related) { return 0; @@ -16110,15 +18461,31 @@ var ts; return signature.hasRestParameter && parameterIndex >= signature.parameters.length - 1; } function isSupertypeOfEach(candidate, types) { - for (var _i = 0, types_6 = types; _i < types_6.length; _i++) { - var type = types_6[_i]; - if (candidate !== type && !isTypeSubtypeOf(type, candidate)) + for (var _i = 0, types_5 = types; _i < types_5.length; _i++) { + var t = types_5[_i]; + if (candidate !== t && !isTypeSubtypeOf(t, candidate)) return false; } return true; } + function getCombinedFlagsOfTypes(types) { + var flags = 0; + for (var _i = 0, types_6 = types; _i < types_6.length; _i++) { + var t = types_6[_i]; + flags |= t.flags; + } + return flags; + } function getCommonSupertype(types) { - return ts.forEach(types, function (t) { return isSupertypeOfEach(t, types) ? t : undefined; }); + if (!strictNullChecks) { + return ts.forEach(types, function (t) { return isSupertypeOfEach(t, types) ? t : undefined; }); + } + var primaryTypes = ts.filter(types, function (t) { return !(t.flags & 96); }); + if (!primaryTypes.length) { + return getUnionType(types); + } + var supertype = ts.forEach(primaryTypes, function (t) { return isSupertypeOfEach(t, primaryTypes) ? t : undefined; }); + return supertype && addNullableKind(supertype, getCombinedFlagsOfTypes(types) & 96); } function reportNoCommonSupertypeError(types, errorLocation, errorMessageChainHead) { var bestSupertype; @@ -16151,7 +18518,8 @@ var ts; return type.flags & 4096 && type.target === globalArrayType; } function isArrayLikeType(type) { - return !(type.flags & (32 | 64)) && isTypeAssignableTo(type, anyArrayType); + return type.flags & 4096 && (type.target === globalArrayType || type.target === globalReadonlyArrayType) || + !(type.flags & 96) && isTypeAssignableTo(type, anyReadonlyArrayType); } function isTupleLikeType(type) { return !!getPropertyOfType(type, "0"); @@ -16162,6 +18530,37 @@ var ts; function isTupleType(type) { return !!(type.flags & 8192); } + function getNullableKind(type) { + var flags = type.flags; + if (flags & 16384) { + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var t = _a[_i]; + flags |= t.flags; + } + } + return flags & 96; + } + function addNullableKind(type, kind) { + if ((getNullableKind(type) & kind) !== kind) { + var types = [type]; + if (kind & 32) { + types.push(undefinedType); + } + if (kind & 64) { + types.push(nullType); + } + type = getUnionType(types); + } + return type; + } + function getNonNullableType(type) { + return strictNullChecks ? getTypeWithFacts(type, 524288) : type; + } + function isObjectLiteralType(type) { + return type.symbol && (type.symbol.flags & (4096 | 2048)) !== 0 && + getSignaturesOfType(type, 0).length === 0 && + getSignaturesOfType(type, 1).length === 0; + } function getRegularTypeOfObjectLiteral(type) { if (type.flags & 1048576) { var regularType = type.regularType; @@ -16172,8 +18571,8 @@ var ts; regularType.properties = type.properties; regularType.callSignatures = type.callSignatures; regularType.constructSignatures = type.constructSignatures; - regularType.stringIndexType = type.stringIndexType; - regularType.numberIndexType = type.numberIndexType; + regularType.stringIndexInfo = type.stringIndexInfo; + regularType.numberIndexInfo = type.numberIndexInfo; type.regularType = regularType; } return regularType; @@ -16198,24 +18597,23 @@ var ts; } members[p.name] = p; }); - var stringIndexType = getIndexTypeOfType(type, 0); - var numberIndexType = getIndexTypeOfType(type, 1); - if (stringIndexType) - stringIndexType = getWidenedType(stringIndexType); - if (numberIndexType) - numberIndexType = getWidenedType(numberIndexType); - return createAnonymousType(type.symbol, members, emptyArray, emptyArray, stringIndexType, numberIndexType); + var stringIndexInfo = getIndexInfoOfType(type, 0); + var numberIndexInfo = getIndexInfoOfType(type, 1); + return createAnonymousType(type.symbol, members, emptyArray, emptyArray, stringIndexInfo && createIndexInfo(getWidenedType(stringIndexInfo.type), stringIndexInfo.isReadonly), numberIndexInfo && createIndexInfo(getWidenedType(numberIndexInfo.type), numberIndexInfo.isReadonly)); + } + function getWidenedConstituentType(type) { + return type.flags & 96 ? type : getWidenedType(type); } function getWidenedType(type) { if (type.flags & 6291456) { - if (type.flags & (32 | 64)) { + if (type.flags & 96) { return anyType; } if (type.flags & 524288) { return getWidenedTypeOfObjectLiteral(type); } if (type.flags & 16384) { - return getUnionType(ts.map(type.types, getWidenedType), true); + return getUnionType(ts.map(type.types, getWidenedConstituentType), true); } if (isArrayType(type)) { return createArrayType(getWidenedType(type.typeArguments[0])); @@ -16265,22 +18663,25 @@ var ts; var typeAsString = typeToString(getWidenedType(type)); var diagnostic; switch (declaration.kind) { - case 141: - case 140: + case 145: + case 144: diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type; break; - case 138: + case 142: diagnostic = declaration.dotDotDotToken ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; break; - case 213: - case 143: - case 142: - case 145: + case 169: + diagnostic = ts.Diagnostics.Binding_element_0_implicitly_has_an_1_type; + break; + case 220: + case 147: case 146: - case 173: - case 174: + case 149: + case 150: + case 179: + case 180: if (!declaration.name) { error(declaration, ts.Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString); return; @@ -16304,35 +18705,23 @@ var ts; var targetMax = target.parameters.length; var count; if (source.hasRestParameter && target.hasRestParameter) { - count = sourceMax > targetMax ? sourceMax : targetMax; - sourceMax--; - targetMax--; + count = Math.max(sourceMax, targetMax); } else if (source.hasRestParameter) { - sourceMax--; count = targetMax; } else if (target.hasRestParameter) { - targetMax--; count = sourceMax; } else { - count = sourceMax < targetMax ? sourceMax : targetMax; + count = Math.min(sourceMax, targetMax); } for (var i = 0; i < count; i++) { - var s = i < sourceMax ? getTypeOfSymbol(source.parameters[i]) : getRestTypeOfSignature(source); - var t = i < targetMax ? getTypeOfSymbol(target.parameters[i]) : getRestTypeOfSignature(target); - callback(s, t); + callback(getTypeAtPosition(source, i), getTypeAtPosition(target, i)); } } function createInferenceContext(typeParameters, inferUnionTypes) { - var inferences = []; - for (var _i = 0, typeParameters_1 = typeParameters; _i < typeParameters_1.length; _i++) { - var unused = typeParameters_1[_i]; - inferences.push({ - primary: undefined, secondary: undefined, isFixed: false - }); - } + var inferences = ts.map(typeParameters, createTypeInferencesObject); return { typeParameters: typeParameters, inferUnionTypes: inferUnionTypes, @@ -16340,11 +18729,19 @@ var ts; inferredTypes: new Array(typeParameters.length) }; } + function createTypeInferencesObject() { + return { + primary: undefined, + secondary: undefined, + isFixed: false + }; + } function inferTypes(context, source, target) { var sourceStack; var targetStack; var depth = 0; var inferiority = 0; + var visited = {}; inferFromTypes(source, target); function isInProcess(source, target) { for (var i = 0; i < depth; i++) { @@ -16355,6 +18752,21 @@ var ts; return false; } function inferFromTypes(source, target) { + if (source.flags & 16384 && target.flags & 16384 || + source.flags & 32768 && target.flags & 32768) { + var matchingTypes = void 0; + for (var _i = 0, _a = target.types; _i < _a.length; _i++) { + var t = _a[_i]; + if (typeIdenticalToSomeType(t, source.types)) { + (matchingTypes || (matchingTypes = [])).push(t); + inferFromTypes(t, t); + } + } + if (matchingTypes) { + source = removeTypesFromUnionOrIntersection(source, matchingTypes); + target = removeTypesFromUnionOrIntersection(target, matchingTypes); + } + } if (target.flags & 512) { if (source.flags & 8388608) { return; @@ -16393,9 +18805,9 @@ var ts; else if (target.flags & 49152) { var targetTypes = target.types; var typeParameterCount = 0; - var typeParameter; - for (var _i = 0, targetTypes_2 = targetTypes; _i < targetTypes_2.length; _i++) { - var t = targetTypes_2[_i]; + var typeParameter = void 0; + for (var _b = 0, targetTypes_2 = targetTypes; _b < targetTypes_2.length; _b++) { + var t = targetTypes_2[_b]; if (t.flags & 512 && ts.contains(context.typeParameters, t)) { typeParameter = t; typeParameterCount++; @@ -16412,21 +18824,27 @@ var ts; } else if (source.flags & 49152) { var sourceTypes = source.types; - for (var _a = 0, sourceTypes_3 = sourceTypes; _a < sourceTypes_3.length; _a++) { - var sourceType = sourceTypes_3[_a]; + for (var _c = 0, sourceTypes_3 = sourceTypes; _c < sourceTypes_3.length; _c++) { + var sourceType = sourceTypes_3[_c]; inferFromTypes(sourceType, target); } } else { source = getApparentType(source); - if (source.flags & 80896 && (target.flags & (4096 | 8192) || - (target.flags & 65536) && target.symbol && target.symbol.flags & (8192 | 2048 | 32))) { + if (source.flags & 80896 && (target.flags & 4096 && target.typeArguments || + target.flags & 8192 || + target.flags & 65536 && target.symbol && target.symbol.flags & (8192 | 2048 | 32))) { if (isInProcess(source, target)) { return; } if (isDeeplyNestedGeneric(source, sourceStack, depth) && isDeeplyNestedGeneric(target, targetStack, depth)) { return; } + var key = source.id + "," + target.id; + if (ts.hasProperty(visited, key)) { + return; + } + visited[key] = true; if (depth === 0) { sourceStack = []; targetStack = []; @@ -16437,9 +18855,7 @@ var ts; inferFromProperties(source, target); inferFromSignatures(source, target, 0); inferFromSignatures(source, target, 1); - inferFromIndexTypes(source, target, 0, 0); - inferFromIndexTypes(source, target, 1, 1); - inferFromIndexTypes(source, target, 0, 1); + inferFromIndexTypes(source, target); depth--; } } @@ -16466,25 +18882,52 @@ var ts; } function inferFromSignature(source, target) { forEachMatchingParameterType(source, target, inferFromTypes); - if (source.typePredicate && target.typePredicate) { - if (target.typePredicate.parameterIndex === source.typePredicate.parameterIndex) { - inferFromTypes(source.typePredicate.type, target.typePredicate.type); - } + if (source.typePredicate && target.typePredicate && source.typePredicate.kind === target.typePredicate.kind) { + inferFromTypes(source.typePredicate.type, target.typePredicate.type); } else { inferFromTypes(getReturnTypeOfSignature(source), getReturnTypeOfSignature(target)); } } - function inferFromIndexTypes(source, target, sourceKind, targetKind) { - var targetIndexType = getIndexTypeOfType(target, targetKind); - if (targetIndexType) { - var sourceIndexType = getIndexTypeOfType(source, sourceKind); + function inferFromIndexTypes(source, target) { + var targetStringIndexType = getIndexTypeOfType(target, 0); + if (targetStringIndexType) { + var sourceIndexType = getIndexTypeOfType(source, 0) || + getImplicitIndexTypeOfType(source, 0); if (sourceIndexType) { - inferFromTypes(sourceIndexType, targetIndexType); + inferFromTypes(sourceIndexType, targetStringIndexType); + } + } + var targetNumberIndexType = getIndexTypeOfType(target, 1); + if (targetNumberIndexType) { + var sourceIndexType = getIndexTypeOfType(source, 1) || + getIndexTypeOfType(source, 0) || + getImplicitIndexTypeOfType(source, 1); + if (sourceIndexType) { + inferFromTypes(sourceIndexType, targetNumberIndexType); } } } } + function typeIdenticalToSomeType(type, types) { + for (var _i = 0, types_7 = types; _i < types_7.length; _i++) { + var t = types_7[_i]; + if (isTypeIdenticalTo(t, type)) { + return true; + } + } + return false; + } + function removeTypesFromUnionOrIntersection(type, typesToRemove) { + var reducedTypes = []; + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var t = _a[_i]; + if (!typeIdenticalToSomeType(t, typesToRemove)) { + reducedTypes.push(t); + } + } + return type.flags & 16384 ? getUnionType(reducedTypes, true) : getIntersectionType(reducedTypes); + } function getInferenceCandidates(context, index) { var inferences = context.inferences[index]; return inferences.primary || inferences.secondary || emptyArray; @@ -16503,14 +18946,19 @@ var ts; inferredType = emptyObjectType; inferenceSucceeded = true; } + context.inferredTypes[index] = inferredType; if (inferenceSucceeded) { var constraint = getConstraintOfTypeParameter(context.typeParameters[index]); - inferredType = constraint && !isTypeAssignableTo(inferredType, constraint) ? constraint : inferredType; + if (constraint) { + var instantiatedConstraint = instantiateType(constraint, getInferenceMapper(context)); + if (!isTypeAssignableTo(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) { + context.inferredTypes[index] = inferredType = instantiatedConstraint; + } + } } else if (context.failedTypeParameterIndex === undefined || context.failedTypeParameterIndex > index) { context.failedTypeParameterIndex = index; } - context.inferredTypes[index] = inferredType; } return inferredType; } @@ -16520,23 +18968,20 @@ var ts; } return context.inferredTypes; } - function hasAncestor(node, kind) { - return ts.getAncestor(node, kind) !== undefined; - } function getResolvedSymbol(node) { var links = getNodeLinks(node); if (!links.resolvedSymbol) { - links.resolvedSymbol = (!ts.nodeIsMissing(node) && resolveName(node, node.text, 107455 | 1048576, ts.Diagnostics.Cannot_find_name_0, node)) || unknownSymbol; + links.resolvedSymbol = !ts.nodeIsMissing(node) && resolveName(node, node.text, 107455 | 1048576, ts.Diagnostics.Cannot_find_name_0, node) || unknownSymbol; } return links.resolvedSymbol; } function isInTypeQuery(node) { while (node) { switch (node.kind) { - case 154: + case 158: return true; case 69: - case 135: + case 139: node = node.parent; continue; default: @@ -16545,212 +18990,460 @@ var ts; } ts.Debug.fail("should not get here"); } - function removeTypesFromUnionType(type, typeKind, isOfTypeKind, allowEmptyUnionResult) { - if (type.flags & 16384) { - var types = type.types; - if (ts.forEach(types, function (t) { return !!(t.flags & typeKind) === isOfTypeKind; })) { - var narrowedType = getUnionType(ts.filter(types, function (t) { return !(t.flags & typeKind) === isOfTypeKind; })); - if (allowEmptyUnionResult || narrowedType !== emptyObjectType) { - return narrowedType; - } + function getFlowCacheKey(node) { + if (node.kind === 69) { + var symbol = getResolvedSymbol(node); + return symbol !== unknownSymbol ? "" + getSymbolId(symbol) : undefined; + } + if (node.kind === 97) { + return "0"; + } + if (node.kind === 172) { + var key = getFlowCacheKey(node.expression); + return key && key + "." + node.name.text; + } + return undefined; + } + function isNullOrUndefinedLiteral(node) { + return node.kind === 93 || + node.kind === 69 && getResolvedSymbol(node) === undefinedSymbol; + } + function getLeftmostIdentifierOrThis(node) { + switch (node.kind) { + case 69: + case 97: + return node; + case 172: + return getLeftmostIdentifierOrThis(node.expression); + } + return undefined; + } + function isMatchingReference(source, target) { + if (source.kind === target.kind) { + switch (source.kind) { + case 69: + return getResolvedSymbol(source) === getResolvedSymbol(target); + case 97: + return true; + case 172: + return source.name.text === target.name.text && + isMatchingReference(source.expression, target.expression); } } - else if (allowEmptyUnionResult && !!(type.flags & typeKind) === isOfTypeKind) { - return getUnionType(emptyArray); - } - return type; + return false; } - function hasInitializer(node) { - return !!(node.initializer || ts.isBindingPattern(node.parent) && hasInitializer(node.parent.parent)); - } - function isVariableAssignedWithin(symbol, node) { - var links = getNodeLinks(node); - if (links.assignmentChecks) { - var cachedResult = links.assignmentChecks[symbol.id]; - if (cachedResult !== undefined) { - return cachedResult; + function containsMatchingReference(source, target) { + while (source.kind === 172) { + source = source.expression; + if (isMatchingReference(source, target)) { + return true; } } - else { - links.assignmentChecks = {}; - } - return links.assignmentChecks[symbol.id] = isAssignedIn(node); - function isAssignedInBinaryExpression(node) { - if (node.operatorToken.kind >= 56 && node.operatorToken.kind <= 68) { - var n = node.left; - while (n.kind === 172) { - n = n.expression; - } - if (n.kind === 69 && getResolvedSymbol(n) === symbol) { + return false; + } + function isOrContainsMatchingReference(source, target) { + return isMatchingReference(source, target) || containsMatchingReference(source, target); + } + function hasMatchingArgument(callExpression, reference) { + if (callExpression.arguments) { + for (var _i = 0, _a = callExpression.arguments; _i < _a.length; _i++) { + var argument = _a[_i]; + if (isOrContainsMatchingReference(reference, argument)) { return true; } } - return ts.forEachChild(node, isAssignedIn); } - function isAssignedInVariableDeclaration(node) { - if (!ts.isBindingPattern(node.name) && getSymbolOfNode(node) === symbol && hasInitializer(node)) { + if (callExpression.expression.kind === 172 && + isOrContainsMatchingReference(reference, callExpression.expression.expression)) { + return true; + } + return false; + } + function getFlowNodeId(flow) { + if (!flow.id) { + flow.id = nextFlowId; + nextFlowId++; + } + return flow.id; + } + function typeMaybeAssignableTo(source, target) { + if (!(source.flags & 16384)) { + return isTypeAssignableTo(source, target); + } + for (var _i = 0, _a = source.types; _i < _a.length; _i++) { + var t = _a[_i]; + if (isTypeAssignableTo(t, target)) { return true; } - return ts.forEachChild(node, isAssignedIn); - } - function isAssignedIn(node) { - switch (node.kind) { - case 181: - return isAssignedInBinaryExpression(node); - case 211: - case 163: - return isAssignedInVariableDeclaration(node); - case 161: - case 162: - case 164: - case 165: - case 166: - case 167: - case 168: - case 169: - case 171: - case 189: - case 172: - case 179: - case 175: - case 178: - case 176: - case 177: - case 180: - case 184: - case 182: - case 185: - case 192: - case 193: - case 195: - case 196: - case 197: - case 198: - case 199: - case 200: - case 201: - case 204: - case 205: - case 206: - case 241: - case 242: - case 207: - case 208: - case 209: - case 244: - case 233: - case 234: - case 238: - case 239: - case 235: - case 240: - return ts.forEachChild(node, isAssignedIn); - } - return false; } + return false; } - function getNarrowedTypeOfSymbol(symbol, node) { - var type = getTypeOfSymbol(symbol); - if (node && symbol.flags & 3) { - if (isTypeAny(type) || type.flags & (80896 | 16384 | 512)) { - loop: while (node.parent) { - var child = node; - node = node.parent; - var narrowedType = type; - switch (node.kind) { - case 196: - if (child !== node.expression) { - narrowedType = narrowType(type, node.expression, child === node.thenStatement); - } - break; - case 182: - if (child !== node.condition) { - narrowedType = narrowType(type, node.condition, child === node.whenTrue); - } - break; - case 181: - if (child === node.right) { - if (node.operatorToken.kind === 51) { - narrowedType = narrowType(type, node.left, true); - } - else if (node.operatorToken.kind === 52) { - narrowedType = narrowType(type, node.left, false); - } - } - break; - case 248: - case 218: - case 213: - case 143: - case 142: - case 145: - case 146: - case 144: - break loop; - } - if (narrowedType !== type) { - if (isVariableAssignedWithin(symbol, node)) { - break; - } - type = narrowedType; + function getAssignmentReducedType(declaredType, assignedType) { + if (declaredType !== assignedType && declaredType.flags & 16384) { + var reducedTypes = ts.filter(declaredType.types, function (t) { return typeMaybeAssignableTo(assignedType, t); }); + if (reducedTypes.length) { + return reducedTypes.length === 1 ? reducedTypes[0] : getUnionType(reducedTypes); + } + } + return declaredType; + } + function getTypeFacts(type) { + var flags = type.flags; + if (flags & 258) { + return strictNullChecks ? 4079361 : 4194049; + } + if (flags & 132) { + return strictNullChecks ? 4079234 : 4193922; + } + if (flags & 8) { + return strictNullChecks ? 4078980 : 4193668; + } + if (flags & 80896) { + var resolved = resolveStructuredTypeMembers(type); + return resolved.callSignatures.length || resolved.constructSignatures.length || isTypeSubtypeOf(type, globalFunctionType) ? + strictNullChecks ? 1970144 : 4181984 : + strictNullChecks ? 1972176 : 4184016; + } + if (flags & (16 | 32)) { + return 2457472; + } + if (flags & 64) { + return 2340752; + } + if (flags & 16777216) { + return strictNullChecks ? 1981320 : 4193160; + } + if (flags & 512) { + var constraint = getConstraintOfTypeParameter(type); + return constraint ? getTypeFacts(constraint) : 4194303; + } + if (flags & 32768) { + return ts.reduceLeft(type.types, function (flags, type) { return flags |= getTypeFacts(type); }, 0); + } + return 4194303; + } + function getTypeWithFacts(type, include) { + if (!(type.flags & 16384)) { + return getTypeFacts(type) & include ? type : neverType; + } + var firstType; + var types; + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var t = _a[_i]; + if (getTypeFacts(t) & include) { + if (!firstType) { + firstType = t; + } + else { + if (!types) { + types = [firstType]; } + types.push(t); } } } + return firstType ? types ? getUnionType(types, true) : firstType : neverType; + } + function getTypeWithDefault(type, defaultExpression) { + if (defaultExpression) { + var defaultType = checkExpression(defaultExpression); + return getUnionType([getTypeWithFacts(type, 131072), defaultType]); + } return type; - function narrowTypeByEquality(type, expr, assumeTrue) { - if (expr.left.kind !== 176 || expr.right.kind !== 9) { + } + function getTypeOfDestructuredProperty(type, name) { + var text = getTextOfPropertyName(name); + return getTypeOfPropertyOfType(type, text) || + isNumericLiteralName(text) && getIndexTypeOfType(type, 1) || + getIndexTypeOfType(type, 0) || + unknownType; + } + function getTypeOfDestructuredArrayElement(type, index) { + return isTupleLikeType(type) && getTypeOfPropertyOfType(type, "" + index) || + checkIteratedTypeOrElementType(type, undefined, false) || + unknownType; + } + function getTypeOfDestructuredSpreadElement(type) { + return createArrayType(checkIteratedTypeOrElementType(type, undefined, false) || unknownType); + } + function getAssignedTypeOfBinaryExpression(node) { + return node.parent.kind === 170 || node.parent.kind === 253 ? + getTypeWithDefault(getAssignedType(node), node.right) : + checkExpression(node.right); + } + function getAssignedTypeOfArrayLiteralElement(node, element) { + return getTypeOfDestructuredArrayElement(getAssignedType(node), ts.indexOf(node.elements, element)); + } + function getAssignedTypeOfSpreadElement(node) { + return getTypeOfDestructuredSpreadElement(getAssignedType(node.parent)); + } + function getAssignedTypeOfPropertyAssignment(node) { + return getTypeOfDestructuredProperty(getAssignedType(node.parent), node.name); + } + function getAssignedTypeOfShorthandPropertyAssignment(node) { + return getTypeWithDefault(getAssignedTypeOfPropertyAssignment(node), node.objectAssignmentInitializer); + } + function getAssignedType(node) { + var parent = node.parent; + switch (parent.kind) { + case 207: + return stringType; + case 208: + return checkRightHandSideOfForOf(parent.expression) || unknownType; + case 187: + return getAssignedTypeOfBinaryExpression(parent); + case 181: + return undefinedType; + case 170: + return getAssignedTypeOfArrayLiteralElement(parent, node); + case 191: + return getAssignedTypeOfSpreadElement(parent); + case 253: + return getAssignedTypeOfPropertyAssignment(parent); + case 254: + return getAssignedTypeOfShorthandPropertyAssignment(parent); + } + return unknownType; + } + function getInitialTypeOfBindingElement(node) { + var pattern = node.parent; + var parentType = getInitialType(pattern.parent); + var type = pattern.kind === 167 ? + getTypeOfDestructuredProperty(parentType, node.propertyName || node.name) : + !node.dotDotDotToken ? + getTypeOfDestructuredArrayElement(parentType, ts.indexOf(pattern.elements, node)) : + getTypeOfDestructuredSpreadElement(parentType); + return getTypeWithDefault(type, node.initializer); + } + function getTypeOfInitializer(node) { + var links = getNodeLinks(node); + return links.resolvedType || checkExpression(node); + } + function getInitialTypeOfVariableDeclaration(node) { + if (node.initializer) { + return getTypeOfInitializer(node.initializer); + } + if (node.parent.parent.kind === 207) { + return stringType; + } + if (node.parent.parent.kind === 208) { + return checkRightHandSideOfForOf(node.parent.parent.expression) || unknownType; + } + return unknownType; + } + function getInitialType(node) { + return node.kind === 218 ? + getInitialTypeOfVariableDeclaration(node) : + getInitialTypeOfBindingElement(node); + } + function getFlowTypeOfReference(reference, declaredType, assumeInitialized) { + var key; + if (!reference.flowNode || assumeInitialized && !(declaredType.flags & 97793)) { + return declaredType; + } + var initialType = assumeInitialized ? declaredType : addNullableKind(declaredType, 32); + var visitedFlowStart = visitedFlowCount; + var result = getTypeAtFlowNode(reference.flowNode); + visitedFlowCount = visitedFlowStart; + if (reference.parent.kind === 196 && getTypeWithFacts(result, 524288) === neverType) { + return declaredType; + } + return result; + function getTypeAtFlowNode(flow) { + while (true) { + if (flow.flags & 256) { + for (var i = visitedFlowStart; i < visitedFlowCount; i++) { + if (visitedFlowNodes[i] === flow) { + return visitedFlowTypes[i]; + } + } + } + var type = void 0; + if (flow.flags & 16) { + type = getTypeAtFlowAssignment(flow); + if (!type) { + flow = flow.antecedent; + continue; + } + } + else if (flow.flags & 96) { + type = getTypeAtFlowCondition(flow); + } + else if (flow.flags & 12) { + if (flow.antecedents.length === 1) { + flow = flow.antecedents[0]; + continue; + } + type = flow.flags & 4 ? + getTypeAtFlowBranchLabel(flow) : + getTypeAtFlowLoopLabel(flow); + } + else if (flow.flags & 1) { + type = declaredType; + } + else { + type = initialType; + } + if (flow.flags & 256) { + visitedFlowNodes[visitedFlowCount] = flow; + visitedFlowTypes[visitedFlowCount] = type; + visitedFlowCount++; + } return type; } - var left = expr.left; - var right = expr.right; - if (left.expression.kind !== 69 || getResolvedSymbol(left.expression) !== symbol) { - return type; + } + function getTypeAtFlowAssignment(flow) { + var node = flow.node; + if ((node.kind === 218 || node.kind === 169) && + reference.kind === 69 && + getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(reference)) === getSymbolOfNode(node)) { + return declaredType.flags & 16384 ? + getAssignmentReducedType(declaredType, getInitialType(node)) : + declaredType; } - var typeInfo = primitiveTypeInfo[right.text]; - if (expr.operatorToken.kind === 33) { + if (isMatchingReference(reference, node)) { + return declaredType.flags & 16384 ? + getAssignmentReducedType(declaredType, getAssignedType(node)) : + declaredType; + } + if (containsMatchingReference(reference, node)) { + return declaredType; + } + return undefined; + } + function getTypeAtFlowCondition(flow) { + var type = getTypeAtFlowNode(flow.antecedent); + if (type !== neverType) { + var assumeTrue = (flow.flags & 32) !== 0; + type = narrowType(type, flow.expression, assumeTrue); + if (type === neverType) { + type = narrowType(declaredType, flow.expression, assumeTrue); + } + } + return type; + } + function getTypeAtFlowBranchLabel(flow) { + var antecedentTypes = []; + for (var _i = 0, _a = flow.antecedents; _i < _a.length; _i++) { + var antecedent = _a[_i]; + var type = getTypeAtFlowNode(antecedent); + if (type === declaredType && declaredType === initialType) { + return type; + } + if (!ts.contains(antecedentTypes, type)) { + antecedentTypes.push(type); + } + } + return getUnionType(antecedentTypes); + } + function getTypeAtFlowLoopLabel(flow) { + var id = getFlowNodeId(flow); + var cache = flowLoopCaches[id] || (flowLoopCaches[id] = {}); + if (!key) { + key = getFlowCacheKey(reference); + } + if (cache[key]) { + return cache[key]; + } + for (var i = flowLoopStart; i < flowLoopCount; i++) { + if (flowLoopNodes[i] === flow && flowLoopKeys[i] === key) { + return getUnionType(flowLoopTypes[i]); + } + } + var antecedentTypes = []; + flowLoopNodes[flowLoopCount] = flow; + flowLoopKeys[flowLoopCount] = key; + flowLoopTypes[flowLoopCount] = antecedentTypes; + for (var _i = 0, _a = flow.antecedents; _i < _a.length; _i++) { + var antecedent = _a[_i]; + flowLoopCount++; + var type = getTypeAtFlowNode(antecedent); + flowLoopCount--; + if (cache[key]) { + return cache[key]; + } + if (!ts.contains(antecedentTypes, type)) { + antecedentTypes.push(type); + } + if (type === declaredType) { + break; + } + } + return cache[key] = getUnionType(antecedentTypes); + } + function narrowTypeByTruthiness(type, expr, assumeTrue) { + return isMatchingReference(reference, expr) ? getTypeWithFacts(type, assumeTrue ? 1048576 : 2097152) : type; + } + function narrowTypeByBinaryExpression(type, expr, assumeTrue) { + switch (expr.operatorToken.kind) { + case 56: + return narrowTypeByTruthiness(type, expr.left, assumeTrue); + case 30: + case 31: + case 32: + case 33: + if (isNullOrUndefinedLiteral(expr.right)) { + return narrowTypeByNullCheck(type, expr, assumeTrue); + } + if (expr.left.kind === 182 && expr.right.kind === 9) { + return narrowTypeByTypeof(type, expr, assumeTrue); + } + break; + case 91: + return narrowTypeByInstanceof(type, expr, assumeTrue); + case 24: + return narrowType(type, expr.right, assumeTrue); + } + return type; + } + function narrowTypeByNullCheck(type, expr, assumeTrue) { + var operator = expr.operatorToken.kind; + if (operator === 31 || operator === 33) { assumeTrue = !assumeTrue; } - if (assumeTrue) { - if (!typeInfo) { - return removeTypesFromUnionType(type, 258 | 132 | 8 | 16777216, true, false); - } - if (isTypeSubtypeOf(typeInfo.type, type)) { - return typeInfo.type; - } - return removeTypesFromUnionType(type, typeInfo.flags, false, false); + if (!strictNullChecks || !isMatchingReference(reference, expr.left)) { + return type; } - else { - if (typeInfo) { - return removeTypesFromUnionType(type, typeInfo.flags, true, false); + var doubleEquals = operator === 30 || operator === 31; + var facts = doubleEquals ? + assumeTrue ? 65536 : 524288 : + expr.right.kind === 93 ? + assumeTrue ? 32768 : 262144 : + assumeTrue ? 16384 : 131072; + return getTypeWithFacts(type, facts); + } + function narrowTypeByTypeof(type, expr, assumeTrue) { + var left = expr.left; + var right = expr.right; + if (!isMatchingReference(reference, left.expression)) { + if (containsMatchingReference(reference, left.expression)) { + return declaredType; } return type; } - } - function narrowTypeByAnd(type, expr, assumeTrue) { - if (assumeTrue) { - return narrowType(narrowType(type, expr.left, true), expr.right, true); + if (expr.operatorToken.kind === 31 || + expr.operatorToken.kind === 33) { + assumeTrue = !assumeTrue; } - else { - return getUnionType([ - narrowType(type, expr.left, false), - narrowType(narrowType(type, expr.left, true), expr.right, false) - ]); - } - } - function narrowTypeByOr(type, expr, assumeTrue) { - if (assumeTrue) { - return getUnionType([ - narrowType(type, expr.left, true), - narrowType(narrowType(type, expr.left, false), expr.right, true) - ]); - } - else { - return narrowType(narrowType(type, expr.left, false), expr.right, false); + if (assumeTrue && !(type.flags & 16384)) { + var targetType = ts.getProperty(typeofTypesByName, right.text); + if (targetType && isTypeSubtypeOf(targetType, type)) { + return targetType; + } } + var facts = assumeTrue ? + ts.getProperty(typeofEQFacts, right.text) || 64 : + ts.getProperty(typeofNEFacts, right.text) || 8192; + return getTypeWithFacts(type, facts); } function narrowTypeByInstanceof(type, expr, assumeTrue) { - if (isTypeAny(type) || expr.left.kind !== 69 || getResolvedSymbol(expr.left) !== symbol) { + if (!isMatchingReference(reference, expr.left)) { + if (containsMatchingReference(reference, expr.left)) { + return declaredType; + } + return type; + } + if (isTypeAny(type)) { return type; } var rightType = checkExpression(expr.right); @@ -16766,7 +19459,7 @@ var ts; } } if (!targetType) { - var constructSignatures; + var constructSignatures = void 0; if (rightType.flags & 2048) { constructSignatures = resolveDeclaredMembers(rightType).declaredConstructSignatures; } @@ -16778,68 +19471,75 @@ var ts; } } if (targetType) { - if (!assumeTrue) { - if (type.flags & 16384) { - return getUnionType(ts.filter(type.types, function (t) { return !isTypeSubtypeOf(t, targetType); })); - } - return type; - } - return getNarrowedType(type, targetType); + return getNarrowedType(type, targetType, assumeTrue); } return type; } - function getNarrowedType(originalType, narrowedTypeCandidate) { - if (originalType.flags & 16384) { - var assignableConstituents = ts.filter(originalType.types, function (t) { return isTypeAssignableTo(t, narrowedTypeCandidate); }); + function getNarrowedType(type, candidate, assumeTrue) { + if (!assumeTrue) { + return type.flags & 16384 ? + getUnionType(ts.filter(type.types, function (t) { return !isTypeSubtypeOf(t, candidate); })) : + type; + } + if (type.flags & 16384) { + var assignableConstituents = ts.filter(type.types, function (t) { return isTypeAssignableTo(t, candidate); }); if (assignableConstituents.length) { return getUnionType(assignableConstituents); } } - if (isTypeAssignableTo(narrowedTypeCandidate, originalType)) { - return narrowedTypeCandidate; - } - return originalType; + var targetType = type.flags & 512 ? getApparentType(type) : type; + return isTypeAssignableTo(candidate, targetType) ? candidate : + isTypeAssignableTo(type, candidate) ? type : + neverType; } - function narrowTypeByTypePredicate(type, expr, assumeTrue) { - if (type.flags & 1) { + function narrowTypeByTypePredicate(type, callExpression, assumeTrue) { + if (type.flags & 1 || !hasMatchingArgument(callExpression, reference)) { return type; } - var signature = getResolvedSignature(expr); - if (signature.typePredicate && - expr.arguments[signature.typePredicate.parameterIndex] && - getSymbolAtLocation(expr.arguments[signature.typePredicate.parameterIndex]) === symbol) { - if (!assumeTrue) { - if (type.flags & 16384) { - return getUnionType(ts.filter(type.types, function (t) { return !isTypeSubtypeOf(t, signature.typePredicate.type); })); + var signature = getResolvedSignature(callExpression); + var predicate = signature.typePredicate; + if (!predicate) { + return type; + } + if (ts.isIdentifierTypePredicate(predicate)) { + var predicateArgument = callExpression.arguments[predicate.parameterIndex]; + if (predicateArgument) { + if (isMatchingReference(reference, predicateArgument)) { + return getNarrowedType(type, predicate.type, assumeTrue); + } + if (containsMatchingReference(reference, predicateArgument)) { + return declaredType; + } + } + } + else { + var invokedExpression = skipParenthesizedNodes(callExpression.expression); + if (invokedExpression.kind === 173 || invokedExpression.kind === 172) { + var accessExpression = invokedExpression; + var possibleReference = skipParenthesizedNodes(accessExpression.expression); + if (isMatchingReference(reference, possibleReference)) { + return getNarrowedType(type, predicate.type, assumeTrue); + } + if (containsMatchingReference(reference, possibleReference)) { + return declaredType; } - return type; } - return getNarrowedType(type, signature.typePredicate.type); } return type; } function narrowType(type, expr, assumeTrue) { switch (expr.kind) { - case 168: - return narrowTypeByTypePredicate(type, expr, assumeTrue); + case 69: + case 97: case 172: + return narrowTypeByTruthiness(type, expr, assumeTrue); + case 174: + return narrowTypeByTypePredicate(type, expr, assumeTrue); + case 178: return narrowType(type, expr.expression, assumeTrue); - case 181: - var operator = expr.operatorToken.kind; - if (operator === 32 || operator === 33) { - return narrowTypeByEquality(type, expr, assumeTrue); - } - else if (operator === 51) { - return narrowTypeByAnd(type, expr, assumeTrue); - } - else if (operator === 52) { - return narrowTypeByOr(type, expr, assumeTrue); - } - else if (operator === 91) { - return narrowTypeByInstanceof(type, expr, assumeTrue); - } - break; - case 179: + case 187: + return narrowTypeByBinaryExpression(type, expr, assumeTrue); + case 185: if (expr.operator === 49) { return narrowType(type, expr.operand, !assumeTrue); } @@ -16848,27 +19548,74 @@ var ts; return type; } } + function getTypeOfSymbolAtLocation(symbol, location) { + if (location.kind === 69) { + if (ts.isRightSideOfQualifiedNameOrPropertyAccess(location)) { + location = location.parent; + } + if (ts.isExpression(location) && !ts.isAssignmentTarget(location)) { + var type = checkExpression(location); + if (getExportSymbolOfValueSymbolIfExported(getNodeLinks(location).resolvedSymbol) === symbol) { + return type; + } + } + } + return getTypeOfSymbol(symbol); + } + function skipParenthesizedNodes(expression) { + while (expression.kind === 178) { + expression = expression.expression; + } + return expression; + } function checkIdentifier(node) { var symbol = getResolvedSymbol(node); if (symbol === argumentsSymbol) { var container = ts.getContainingFunction(node); - if (container.kind === 174) { + if (container.kind === 180) { if (languageVersion < 2) { error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression); } } - if (node.parserContextFlags & 8) { - getNodeLinks(container).flags |= 4096; - getNodeLinks(node).flags |= 2048; + if (node.flags & 33554432) { + getNodeLinks(container).flags |= 8192; } } if (symbol.flags & 8388608 && !isInTypeQuery(node) && !isConstEnumOrConstEnumOnlyModule(resolveAlias(symbol))) { markAliasSymbolAsReferenced(symbol); } + var localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol); + if (languageVersion === 2 + && localOrExportSymbol.flags & 32 + && localOrExportSymbol.valueDeclaration.kind === 221 + && ts.nodeIsDecorated(localOrExportSymbol.valueDeclaration)) { + var container = ts.getContainingClass(node); + while (container !== undefined) { + if (container === localOrExportSymbol.valueDeclaration && container.name !== node) { + getNodeLinks(container).flags |= 524288; + getNodeLinks(node).flags |= 1048576; + break; + } + container = ts.getContainingClass(container); + } + } checkCollisionWithCapturedSuperVariable(node, node); checkCollisionWithCapturedThisVariable(node, node); - checkBlockScopedBindingCapturedInLoop(node, symbol); - return getNarrowedTypeOfSymbol(getExportSymbolOfValueSymbolIfExported(symbol), node); + checkNestedBlockScopedBinding(node, symbol); + var type = getTypeOfSymbol(localOrExportSymbol); + if (!(localOrExportSymbol.flags & 3) || ts.isAssignmentTarget(node)) { + return type; + } + var declaration = localOrExportSymbol.valueDeclaration; + var assumeInitialized = !strictNullChecks || (type.flags & 1) !== 0 || !declaration || + ts.getRootDeclaration(declaration).kind === 142 || ts.isInAmbientContext(declaration) || + ts.getContainingFunctionOrModule(declaration) !== ts.getContainingFunctionOrModule(node); + var flowType = getFlowTypeOfReference(node, type, assumeInitialized); + if (!assumeInitialized && !(getNullableKind(type) & 32) && getNullableKind(flowType) & 32) { + error(node, ts.Diagnostics.Variable_0_is_used_before_being_assigned, symbolToString(symbol)); + return type; + } + return flowType; } function isInsideFunction(node, threshold) { var current = node; @@ -16880,42 +19627,67 @@ var ts; } return false; } - function checkBlockScopedBindingCapturedInLoop(node, symbol) { + function checkNestedBlockScopedBinding(node, symbol) { if (languageVersion >= 2 || (symbol.flags & (2 | 32)) === 0 || - symbol.valueDeclaration.parent.kind === 244) { + symbol.valueDeclaration.parent.kind === 252) { return; } - var container; - if (symbol.flags & 32) { - container = getClassLikeDeclarationOfSymbol(symbol).parent; - } - else { - container = symbol.valueDeclaration; - while (container.kind !== 212) { - container = container.parent; - } - container = container.parent; - if (container.kind === 193) { - container = container.parent; - } - } - var inFunction = isInsideFunction(node.parent, container); + var container = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration); + var usedInFunction = isInsideFunction(node.parent, container); var current = container; + var containedInIterationStatement = false; while (current && !ts.nodeStartsNewLexicalEnvironment(current)) { if (ts.isIterationStatement(current, false)) { - if (inFunction) { - getNodeLinks(current).flags |= 65536; - } - getNodeLinks(symbol.valueDeclaration).flags |= 16384; + containedInIterationStatement = true; break; } current = current.parent; } + if (containedInIterationStatement) { + if (usedInFunction) { + getNodeLinks(current).flags |= 65536; + } + if (container.kind === 206 && + ts.getAncestor(symbol.valueDeclaration, 219).parent === container && + isAssignedInBodyOfForStatement(node, container)) { + getNodeLinks(symbol.valueDeclaration).flags |= 2097152; + } + getNodeLinks(symbol.valueDeclaration).flags |= 262144; + } + if (usedInFunction) { + getNodeLinks(symbol.valueDeclaration).flags |= 131072; + } + } + function isAssignedInBodyOfForStatement(node, container) { + var current = node; + while (current.parent.kind === 178) { + current = current.parent; + } + var isAssigned = false; + if (ts.isAssignmentTarget(current)) { + isAssigned = true; + } + else if ((current.parent.kind === 185 || current.parent.kind === 186)) { + var expr = current.parent; + isAssigned = expr.operator === 41 || expr.operator === 42; + } + if (!isAssigned) { + return false; + } + while (current !== container) { + if (current === container.statement) { + return true; + } + else { + current = current.parent; + } + } + return false; } function captureLexicalThis(node, container) { getNodeLinks(node).flags |= 2; - if (container.kind === 141 || container.kind === 144) { + if (container.kind === 145 || container.kind === 148) { var classNode = container.parent; getNodeLinks(classNode).flags |= 4; } @@ -16923,98 +19695,194 @@ var ts; getNodeLinks(container).flags |= 4; } } + function findFirstSuperCall(n) { + if (ts.isSuperCallExpression(n)) { + return n; + } + else if (ts.isFunctionLike(n)) { + return undefined; + } + return ts.forEachChild(n, findFirstSuperCall); + } + function getSuperCallInConstructor(constructor) { + var links = getNodeLinks(constructor); + if (links.hasSuperCall === undefined) { + links.superCall = findFirstSuperCall(constructor.body); + links.hasSuperCall = links.superCall ? true : false; + } + return links.superCall; + } + function classDeclarationExtendsNull(classDecl) { + var classSymbol = getSymbolOfNode(classDecl); + var classInstanceType = getDeclaredTypeOfSymbol(classSymbol); + var baseConstructorType = getBaseConstructorTypeOfClass(classInstanceType); + return baseConstructorType === nullType; + } function checkThisExpression(node) { var container = ts.getThisContainer(node, true); var needToCaptureLexicalThis = false; - if (container.kind === 174) { + if (container.kind === 148) { + var containingClassDecl = container.parent; + var baseTypeNode = ts.getClassExtendsHeritageClauseElement(containingClassDecl); + if (baseTypeNode && !classDeclarationExtendsNull(containingClassDecl)) { + var superCall = getSuperCallInConstructor(container); + if (!superCall || superCall.end > node.pos) { + error(node, ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class); + } + } + } + if (container.kind === 180) { container = ts.getThisContainer(container, false); needToCaptureLexicalThis = (languageVersion < 2); } switch (container.kind) { - case 218: + case 225: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body); break; - case 217: + case 224: error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location); break; - case 144: + case 148: if (isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_constructor_arguments); } break; - case 141: - case 140: - if (container.flags & 64) { + case 145: + case 144: + if (container.flags & 32) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_static_property_initializer); } break; - case 136: + case 140: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_computed_property_name); break; } if (needToCaptureLexicalThis) { captureLexicalThis(node, container); } + if (ts.isFunctionLike(container)) { + if (container.kind === 179 && + ts.isInJavaScriptFile(container.parent) && + ts.getSpecialPropertyAssignmentKind(container.parent) === 3) { + var className = container.parent + .left + .expression + .expression; + var classSymbol = checkExpression(className).symbol; + if (classSymbol && classSymbol.members && (classSymbol.flags & 16)) { + return getInferredClassType(classSymbol); + } + } + var type = getContextuallyTypedThisType(container); + if (type) { + return type; + } + var signature = getSignatureFromDeclaration(container); + if (signature.thisType) { + return signature.thisType; + } + } if (ts.isClassLike(container.parent)) { var symbol = getSymbolOfNode(container.parent); - return container.flags & 64 ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol).thisType; + var type = container.flags & 32 ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol).thisType; + return getFlowTypeOfReference(node, type, true); + } + if (ts.isInJavaScriptFile(node)) { + var type = getTypeForThisExpressionFromJSDoc(container); + if (type && type !== unknownType) { + return type; + } + } + if (compilerOptions.noImplicitThis) { + error(node, ts.Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation); } return anyType; } + function getTypeForThisExpressionFromJSDoc(node) { + var typeTag = ts.getJSDocTypeTag(node); + if (typeTag && typeTag.typeExpression && typeTag.typeExpression.type && typeTag.typeExpression.type.kind === 269) { + var jsDocFunctionType = typeTag.typeExpression.type; + if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].type.kind === 272) { + return getTypeFromTypeNode(jsDocFunctionType.parameters[0].type); + } + } + } function isInConstructorArgumentInitializer(node, constructorDecl) { for (var n = node; n && n !== constructorDecl; n = n.parent) { - if (n.kind === 138) { + if (n.kind === 142) { return true; } } return false; } function checkSuperExpression(node) { - var isCallExpression = node.parent.kind === 168 && node.parent.expression === node; - var classDeclaration = ts.getContainingClass(node); - var classType = classDeclaration && getDeclaredTypeOfSymbol(getSymbolOfNode(classDeclaration)); - var baseClassType = classType && getBaseTypes(classType)[0]; + var isCallExpression = node.parent.kind === 174 && node.parent.expression === node; var container = ts.getSuperContainer(node, true); var needToCaptureLexicalThis = false; if (!isCallExpression) { - while (container && container.kind === 174) { + while (container && container.kind === 180) { container = ts.getSuperContainer(container, true); needToCaptureLexicalThis = languageVersion < 2; } } var canUseSuperExpression = isLegalUsageOfSuperExpression(container); var nodeCheckFlag = 0; - if (canUseSuperExpression) { - if ((container.flags & 64) || isCallExpression) { - nodeCheckFlag = 512; - } - else { - nodeCheckFlag = 256; - } - getNodeLinks(node).flags |= nodeCheckFlag; - if (needToCaptureLexicalThis) { - captureLexicalThis(node.parent, container); - } - } - if (!baseClassType) { - if (!classDeclaration || !ts.getClassExtendsHeritageClauseElement(classDeclaration)) { - error(node, ts.Diagnostics.super_can_only_be_referenced_in_a_derived_class); - } - return unknownType; - } if (!canUseSuperExpression) { - if (container && container.kind === 136) { + var current = node; + while (current && current !== container && current.kind !== 140) { + current = current.parent; + } + if (current && current.kind === 140) { error(node, ts.Diagnostics.super_cannot_be_referenced_in_a_computed_property_name); } else if (isCallExpression) { error(node, ts.Diagnostics.Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors); } + else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 171)) { + error(node, ts.Diagnostics.super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions); + } else { error(node, ts.Diagnostics.super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class); } return unknownType; } - if (container.kind === 144 && isInConstructorArgumentInitializer(node, container)) { + if ((container.flags & 32) || isCallExpression) { + nodeCheckFlag = 512; + } + else { + nodeCheckFlag = 256; + } + getNodeLinks(node).flags |= nodeCheckFlag; + if (container.kind === 147 && container.flags & 256) { + if (ts.isSuperPropertyOrElementAccess(node.parent) && ts.isAssignmentTarget(node.parent)) { + getNodeLinks(container).flags |= 4096; + } + else { + getNodeLinks(container).flags |= 2048; + } + } + if (needToCaptureLexicalThis) { + captureLexicalThis(node.parent, container); + } + if (container.parent.kind === 171) { + if (languageVersion < 2) { + error(node, ts.Diagnostics.super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher); + return unknownType; + } + else { + return anyType; + } + } + var classLikeDeclaration = container.parent; + var classType = getDeclaredTypeOfSymbol(getSymbolOfNode(classLikeDeclaration)); + var baseClassType = classType && getBaseTypes(classType)[0]; + if (!baseClassType) { + if (!ts.getClassExtendsHeritageClauseElement(classLikeDeclaration)) { + error(node, ts.Diagnostics.super_can_only_be_referenced_in_a_derived_class); + } + return unknownType; + } + if (container.kind === 148 && isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.super_cannot_be_referenced_in_constructor_arguments); return unknownType; } @@ -17026,59 +19894,98 @@ var ts; return false; } if (isCallExpression) { - return container.kind === 144; + return container.kind === 148; } else { - if (container && ts.isClassLike(container.parent)) { - if (container.flags & 64) { - return container.kind === 143 || - container.kind === 142 || - container.kind === 145 || - container.kind === 146; + if (ts.isClassLike(container.parent) || container.parent.kind === 171) { + if (container.flags & 32) { + return container.kind === 147 || + container.kind === 146 || + container.kind === 149 || + container.kind === 150; } else { - return container.kind === 143 || - container.kind === 142 || - container.kind === 145 || + return container.kind === 147 || container.kind === 146 || - container.kind === 141 || - container.kind === 140 || - container.kind === 144; + container.kind === 149 || + container.kind === 150 || + container.kind === 145 || + container.kind === 144 || + container.kind === 148; } } } return false; } } + function getContextuallyTypedThisType(func) { + if (isContextSensitiveFunctionOrObjectLiteralMethod(func) && func.kind !== 180) { + var contextualSignature = getContextualSignature(func); + if (contextualSignature) { + return contextualSignature.thisType; + } + } + return undefined; + } function getContextuallyTypedParameterType(parameter) { var func = parameter.parent; - if (isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) { - if (isContextSensitive(func)) { - var contextualSignature = getContextualSignature(func); - if (contextualSignature) { - var funcHasRestParameters = ts.hasRestParameter(func); - var len = func.parameters.length - (funcHasRestParameters ? 1 : 0); - var indexOfParameter = ts.indexOf(func.parameters, parameter); - if (indexOfParameter < len) { - return getTypeAtPosition(contextualSignature, indexOfParameter); - } - if (funcHasRestParameters && - indexOfParameter === (func.parameters.length - 1) && - isRestParameterIndex(contextualSignature, func.parameters.length - 1)) { - return getTypeOfSymbol(ts.lastOrUndefined(contextualSignature.parameters)); + if (isContextSensitiveFunctionOrObjectLiteralMethod(func)) { + var iife = getImmediatelyInvokedFunctionExpression(func); + if (iife) { + var indexOfParameter = ts.indexOf(func.parameters, parameter); + if (iife.arguments && indexOfParameter < iife.arguments.length) { + if (parameter.dotDotDotToken) { + var restTypes = []; + for (var i = indexOfParameter; i < iife.arguments.length; i++) { + restTypes.push(getTypeOfExpression(iife.arguments[i])); + } + return createArrayType(getUnionType(restTypes)); } + var links = getNodeLinks(iife); + var cached = links.resolvedSignature; + links.resolvedSignature = anySignature; + var type = checkExpression(iife.arguments[indexOfParameter]); + links.resolvedSignature = cached; + return type; + } + } + var contextualSignature = getContextualSignature(func); + if (contextualSignature) { + var funcHasRestParameters = ts.hasRestParameter(func); + var len = func.parameters.length - (funcHasRestParameters ? 1 : 0); + var indexOfParameter = ts.indexOf(func.parameters, parameter); + if (indexOfParameter < len) { + return getTypeAtPosition(contextualSignature, indexOfParameter); + } + if (funcHasRestParameters && + indexOfParameter === (func.parameters.length - 1) && + isRestParameterIndex(contextualSignature, func.parameters.length - 1)) { + return getTypeOfSymbol(ts.lastOrUndefined(contextualSignature.parameters)); } } } return undefined; } + function getImmediatelyInvokedFunctionExpression(func) { + if (isFunctionExpressionOrArrowFunction(func)) { + var prev = func; + var parent_8 = func.parent; + while (parent_8.kind === 178) { + prev = parent_8; + parent_8 = parent_8.parent; + } + if (parent_8.kind === 174 && parent_8.expression === prev) { + return parent_8; + } + } + } function getContextualTypeForInitializerExpression(node) { var declaration = node.parent; if (node === declaration.initializer) { if (declaration.type) { return getTypeFromTypeNode(declaration.type); } - if (declaration.kind === 138) { + if (declaration.kind === 142) { var type = getContextuallyTypedParameterType(declaration); if (type) { return type; @@ -17087,6 +19994,18 @@ var ts; if (ts.isBindingPattern(declaration.name)) { return getTypeFromBindingPattern(declaration.name, true); } + if (ts.isBindingPattern(declaration.parent)) { + var parentDeclaration = declaration.parent.parent; + var name_11 = declaration.propertyName || declaration.name; + if (ts.isVariableLike(parentDeclaration) && + parentDeclaration.type && + !ts.isBindingPattern(name_11)) { + var text = getTextOfPropertyName(name_11); + if (text) { + return getTypeOfPropertyOfType(getTypeFromTypeNode(parentDeclaration.type), text); + } + } + } } return undefined; } @@ -17111,7 +20030,7 @@ var ts; } function isInParameterInitializerBeforeContainingFunction(node) { while (node.parent && !ts.isFunctionLike(node.parent)) { - if (node.parent.kind === 138 && node.parent.initializer === node) { + if (node.parent.kind === 142 && node.parent.initializer === node) { return true; } node = node.parent; @@ -17120,8 +20039,8 @@ var ts; } function getContextualReturnType(functionDecl) { if (functionDecl.type || - functionDecl.kind === 144 || - functionDecl.kind === 145 && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(functionDecl.symbol, 146))) { + functionDecl.kind === 148 || + functionDecl.kind === 149 && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(functionDecl.symbol, 150))) { return getReturnTypeOfSignature(getSignatureFromDeclaration(functionDecl)); } var signature = getContextualSignatureForFunctionLikeDeclaration(functionDecl); @@ -17134,13 +20053,13 @@ var ts; var args = getEffectiveCallArguments(callTarget); var argIndex = ts.indexOf(args, arg); if (argIndex >= 0) { - var signature = getResolvedSignature(callTarget); + var signature = getResolvedOrAnySignature(callTarget); return getTypeAtPosition(signature, argIndex); } return undefined; } function getContextualTypeForSubstitutionExpression(template, substitutionExpression) { - if (template.parent.kind === 170) { + if (template.parent.kind === 176) { return getContextualTypeForArgument(template.parent, substitutionExpression); } return undefined; @@ -17160,6 +20079,11 @@ var ts; } return type; } + else if (operator === 51 || operator === 24) { + if (node === binaryExpression.right) { + return getContextualType(binaryExpression); + } + } return undefined; } function applyToContextualType(type, mapper) { @@ -17169,8 +20093,8 @@ var ts; var types = type.types; var mappedType; var mappedTypes; - for (var _i = 0, types_7 = types; _i < types_7.length; _i++) { - var current = types_7[_i]; + for (var _i = 0, types_8 = types; _i < types_8.length; _i++) { + var current = types_8[_i]; var t = mapper(current); if (t) { if (!mappedType) { @@ -17201,9 +20125,6 @@ var ts; function contextualTypeIsTupleLikeType(type) { return !!(type.flags & 16384 ? ts.forEach(type.types, isTupleLikeType) : isTupleLikeType(type)); } - function contextualTypeHasIndexSignature(type, kind) { - return !!(type.flags & 16384 ? ts.forEach(type.types, function (t) { return getIndexTypeOfStructuredType(t, kind); }) : getIndexTypeOfStructuredType(type, kind)); - } function getContextualTypeForObjectLiteralMethod(node) { ts.Debug.assert(ts.isObjectLiteralMethod(node)); if (isInsideWithStatementBody(node)) { @@ -17242,21 +20163,20 @@ var ts; var conditional = node.parent; return node === conditional.whenTrue || node === conditional.whenFalse ? getContextualType(conditional) : undefined; } - function getContextualTypeForJsxExpression(expr) { - if (expr.parent.kind === 238) { - var attrib = expr.parent; - var attrsType = getJsxElementAttributesType(attrib.parent); + function getContextualTypeForJsxAttribute(attribute) { + var kind = attribute.kind; + var jsxElement = attribute.parent; + var attrsType = getJsxElementAttributesType(jsxElement); + if (attribute.kind === 246) { if (!attrsType || isTypeAny(attrsType)) { return undefined; } - else { - return getTypeOfPropertyOfType(attrsType, attrib.name.text); - } + return getTypeOfPropertyOfType(attrsType, attribute.name.text); } - if (expr.kind === 239) { - return getJsxElementAttributesType(expr.parent); + else if (attribute.kind === 247) { + return attrsType; } - return undefined; + ts.Debug.fail("Expected JsxAttribute or JsxSpreadAttribute, got ts.SyntaxKind[" + kind + "]"); } function getApparentTypeOfContextualType(node) { var type = getContextualType(node); @@ -17271,39 +20191,41 @@ var ts; } var parent = node.parent; switch (parent.kind) { - case 211: - case 138: - case 141: - case 140: - case 163: - return getContextualTypeForInitializerExpression(node); - case 174: - case 204: - return getContextualTypeForReturnExpression(node); - case 184: - return getContextualTypeForYieldOperand(parent); - case 168: + case 218: + case 142: + case 145: + case 144: case 169: - return getContextualTypeForArgument(parent, node); - case 171: - case 189: - return getTypeFromTypeNode(parent.type); - case 181: - return getContextualTypeForBinaryOperand(node); - case 245: - return getContextualTypeForObjectLiteralElement(parent); - case 164: - return getContextualTypeForElementExpression(node); - case 182: - return getContextualTypeForConditionalOperand(node); + return getContextualTypeForInitializerExpression(node); + case 180: + case 211: + return getContextualTypeForReturnExpression(node); case 190: - ts.Debug.assert(parent.parent.kind === 183); + return getContextualTypeForYieldOperand(parent); + case 174: + case 175: + return getContextualTypeForArgument(parent, node); + case 177: + case 195: + return getTypeFromTypeNode(parent.type); + case 187: + return getContextualTypeForBinaryOperand(node); + case 253: + return getContextualTypeForObjectLiteralElement(parent); + case 170: + return getContextualTypeForElementExpression(node); + case 188: + return getContextualTypeForConditionalOperand(node); + case 197: + ts.Debug.assert(parent.parent.kind === 189); return getContextualTypeForSubstitutionExpression(parent.parent, node); - case 172: + case 178: return getContextualType(parent); - case 240: - case 239: - return getContextualTypeForJsxExpression(parent); + case 248: + return getContextualType(parent); + case 246: + case 247: + return getContextualTypeForJsxAttribute(parent); } return undefined; } @@ -17317,18 +20239,21 @@ var ts; } } function isFunctionExpressionOrArrowFunction(node) { - return node.kind === 173 || node.kind === 174; + return node.kind === 179 || node.kind === 180; } function getContextualSignatureForFunctionLikeDeclaration(node) { return isFunctionExpressionOrArrowFunction(node) || ts.isObjectLiteralMethod(node) ? getContextualSignature(node) : undefined; } + function getContextualTypeForFunctionLikeDeclaration(node) { + return ts.isObjectLiteralMethod(node) ? + getContextualTypeForObjectLiteralMethod(node) : + getApparentTypeOfContextualType(node); + } function getContextualSignature(node) { - ts.Debug.assert(node.kind !== 143 || ts.isObjectLiteralMethod(node)); - var type = ts.isObjectLiteralMethod(node) - ? getContextualTypeForObjectLiteralMethod(node) - : getApparentTypeOfContextualType(node); + ts.Debug.assert(node.kind !== 147 || ts.isObjectLiteralMethod(node)); + var type = getContextualTypeForFunctionLikeDeclaration(node); if (!type) { return undefined; } @@ -17337,14 +20262,14 @@ var ts; } var signatureList; var types = type.types; - for (var _i = 0, types_8 = types; _i < types_8.length; _i++) { - var current = types_8[_i]; + for (var _i = 0, types_9 = types; _i < types_9.length; _i++) { + var current = types_9[_i]; var signature = getNonGenericSignature(current); if (signature) { if (!signatureList) { signatureList = [signature]; } - else if (!compareSignatures(signatureList[0], signature, false, true, compareTypes)) { + else if (!compareSignaturesIdentical(signatureList[0], signature, false, true, true, compareTypesIdentical)) { return undefined; } else { @@ -17363,35 +20288,22 @@ var ts; function isInferentialContext(mapper) { return mapper && mapper.context; } - function isAssignmentTarget(node) { - var parent = node.parent; - if (parent.kind === 181 && parent.operatorToken.kind === 56 && parent.left === node) { - return true; - } - if (parent.kind === 245) { - return isAssignmentTarget(parent.parent); - } - if (parent.kind === 164) { - return isAssignmentTarget(parent); - } - return false; - } function checkSpreadElementExpression(node, contextualMapper) { var arrayOrIterableType = checkExpressionCached(node.expression, contextualMapper); return checkIteratedTypeOrElementType(arrayOrIterableType, node.expression, false); } function hasDefaultValue(node) { - return (node.kind === 163 && !!node.initializer) || - (node.kind === 181 && node.operatorToken.kind === 56); + return (node.kind === 169 && !!node.initializer) || + (node.kind === 187 && node.operatorToken.kind === 56); } function checkArrayLiteral(node, contextualMapper) { var elements = node.elements; var hasSpreadElement = false; var elementTypes = []; - var inDestructuringPattern = isAssignmentTarget(node); + var inDestructuringPattern = ts.isAssignmentTarget(node); for (var _i = 0, elements_1 = elements; _i < elements_1.length; _i++) { var e = elements_1[_i]; - if (inDestructuringPattern && e.kind === 185) { + if (inDestructuringPattern && e.kind === 191) { var restArrayType = checkExpression(e.expression, contextualMapper); var restElementType = getIndexTypeOfType(restArrayType, 1) || (languageVersion >= 2 ? getElementTypeOfIterable(restArrayType, undefined) : undefined); @@ -17403,7 +20315,7 @@ var ts; var type = checkExpression(e, contextualMapper); elementTypes.push(type); } - hasSpreadElement = hasSpreadElement || e.kind === 185; + hasSpreadElement = hasSpreadElement || e.kind === 191; } if (!hasSpreadElement) { if (inDestructuringPattern && elementTypes.length) { @@ -17414,7 +20326,7 @@ var ts; var contextualType = getApparentTypeOfContextualType(node); if (contextualType && contextualTypeIsTupleLikeType(contextualType)) { var pattern = contextualType.pattern; - if (pattern && (pattern.kind === 162 || pattern.kind === 164)) { + if (pattern && (pattern.kind === 168 || pattern.kind === 170)) { var patternElements = pattern.elements; for (var i = elementTypes.length; i < patternElements.length; i++) { var patternElement = patternElements[i]; @@ -17422,7 +20334,7 @@ var ts; elementTypes.push(contextualType.elementTypes[i]); } else { - if (patternElement.kind !== 187) { + if (patternElement.kind !== 193) { error(patternElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); } elementTypes.push(unknownType); @@ -17434,16 +20346,16 @@ var ts; } } } - return createArrayType(elementTypes.length ? getUnionType(elementTypes) : undefinedType); + return createArrayType(elementTypes.length ? getUnionType(elementTypes) : emptyArrayElementType); } function isNumericName(name) { - return name.kind === 136 ? isNumericComputedName(name) : isNumericLiteralName(name.text); + return name.kind === 140 ? isNumericComputedName(name) : isNumericLiteralName(name.text); } function isNumericComputedName(name) { return isTypeAnyOrAllConstituentTypesHaveKind(checkComputedPropertyName(name), 132); } function isTypeAnyOrAllConstituentTypesHaveKind(type, kind) { - return isTypeAny(type) || allConstituentTypesHaveKind(type, kind); + return isTypeAny(type) || isTypeOfKind(type, kind); } function isNumericLiteralName(name) { return (+name).toString() === name; @@ -17461,38 +20373,50 @@ var ts; } return links.resolvedType; } + function getObjectLiteralIndexInfo(node, properties, kind) { + var propTypes = []; + for (var i = 0; i < properties.length; i++) { + if (kind === 0 || isNumericName(node.properties[i].name)) { + propTypes.push(getTypeOfSymbol(properties[i])); + } + } + var unionType = propTypes.length ? getUnionType(propTypes) : undefinedType; + return createIndexInfo(unionType, false); + } function checkObjectLiteral(node, contextualMapper) { - var inDestructuringPattern = isAssignmentTarget(node); + var inDestructuringPattern = ts.isAssignmentTarget(node); checkGrammarObjectLiteralExpression(node, inDestructuringPattern); var propertiesTable = {}; var propertiesArray = []; var contextualType = getApparentTypeOfContextualType(node); var contextualTypeHasPattern = contextualType && contextualType.pattern && - (contextualType.pattern.kind === 161 || contextualType.pattern.kind === 165); + (contextualType.pattern.kind === 167 || contextualType.pattern.kind === 171); var typeFlags = 0; var patternWithComputedProperties = false; + var hasComputedStringProperty = false; + var hasComputedNumberProperty = false; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var memberDecl = _a[_i]; var member = memberDecl.symbol; - if (memberDecl.kind === 245 || - memberDecl.kind === 246 || + if (memberDecl.kind === 253 || + memberDecl.kind === 254 || ts.isObjectLiteralMethod(memberDecl)) { var type = void 0; - if (memberDecl.kind === 245) { + if (memberDecl.kind === 253) { type = checkPropertyAssignment(memberDecl, contextualMapper); } - else if (memberDecl.kind === 143) { + else if (memberDecl.kind === 147) { type = checkObjectLiteralMethod(memberDecl, contextualMapper); } else { - ts.Debug.assert(memberDecl.kind === 246); + ts.Debug.assert(memberDecl.kind === 254); type = checkExpression(memberDecl.name, contextualMapper); } typeFlags |= type.flags; var prop = createSymbol(4 | 67108864 | member.flags, member.name); if (inDestructuringPattern) { - var isOptional = (memberDecl.kind === 245 && hasDefaultValue(memberDecl.initializer)) || - (memberDecl.kind === 246 && memberDecl.objectAssignmentInitializer); + var isOptional = (memberDecl.kind === 253 && hasDefaultValue(memberDecl.initializer)) || + (memberDecl.kind === 254 && memberDecl.objectAssignmentInitializer); if (isOptional) { prop.flags |= 536870912; } @@ -17519,10 +20443,18 @@ var ts; member = prop; } else { - ts.Debug.assert(memberDecl.kind === 145 || memberDecl.kind === 146); + ts.Debug.assert(memberDecl.kind === 149 || memberDecl.kind === 150); checkAccessorDeclaration(memberDecl); } - if (!ts.hasDynamicName(memberDecl)) { + if (ts.hasDynamicName(memberDecl)) { + if (isNumericName(memberDecl.name)) { + hasComputedNumberProperty = true; + } + else { + hasComputedStringProperty = true; + } + } + else { propertiesTable[member.name] = member; } propertiesArray.push(member); @@ -17539,66 +20471,38 @@ var ts; } } } - var stringIndexType = getIndexType(0); - var numberIndexType = getIndexType(1); - var result = createAnonymousType(node.symbol, propertiesTable, emptyArray, emptyArray, stringIndexType, numberIndexType); + var stringIndexInfo = hasComputedStringProperty ? getObjectLiteralIndexInfo(node, propertiesArray, 0) : undefined; + var numberIndexInfo = hasComputedNumberProperty ? getObjectLiteralIndexInfo(node, propertiesArray, 1) : undefined; + var result = createAnonymousType(node.symbol, propertiesTable, emptyArray, emptyArray, stringIndexInfo, numberIndexInfo); var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 1048576; result.flags |= 524288 | 4194304 | freshObjectLiteralFlag | (typeFlags & 14680064) | (patternWithComputedProperties ? 67108864 : 0); if (inDestructuringPattern) { result.pattern = node; } return result; - function getIndexType(kind) { - if (contextualType && contextualTypeHasIndexSignature(contextualType, kind)) { - var propTypes = []; - for (var i = 0; i < propertiesArray.length; i++) { - var propertyDecl = node.properties[i]; - if (kind === 0 || isNumericName(propertyDecl.name)) { - var type = getTypeOfSymbol(propertiesArray[i]); - if (!ts.contains(propTypes, type)) { - propTypes.push(type); - } - } - } - var result_1 = propTypes.length ? getUnionType(propTypes) : undefinedType; - typeFlags |= result_1.flags; - return result_1; - } - return undefined; - } } function checkJsxSelfClosingElement(node) { checkJsxOpeningLikeElement(node); return jsxElementType || anyType; } - function tagNamesAreEquivalent(lhs, rhs) { - if (lhs.kind !== rhs.kind) { - return false; - } - if (lhs.kind === 69) { - return lhs.text === rhs.text; - } - return lhs.right.text === rhs.right.text && - tagNamesAreEquivalent(lhs.left, rhs.left); - } function checkJsxElement(node) { checkJsxOpeningLikeElement(node.openingElement); - if (!tagNamesAreEquivalent(node.openingElement.tagName, node.closingElement.tagName)) { - error(node.closingElement, ts.Diagnostics.Expected_corresponding_JSX_closing_tag_for_0, ts.getTextOfNode(node.openingElement.tagName)); + if (isJsxIntrinsicIdentifier(node.closingElement.tagName)) { + getIntrinsicTagSymbol(node.closingElement); } else { - getJsxElementTagSymbol(node.closingElement); + checkExpression(node.closingElement.tagName); } for (var _i = 0, _a = node.children; _i < _a.length; _i++) { var child = _a[_i]; switch (child.kind) { - case 240: + case 248: checkJsxExpression(child); break; - case 233: + case 241: checkJsxElement(child); break; - case 234: + case 242: checkJsxSelfClosingElement(child); break; } @@ -17609,7 +20513,7 @@ var ts; return name.indexOf("-") < 0; } function isJsxIntrinsicIdentifier(tagName) { - if (tagName.kind === 135) { + if (tagName.kind === 139) { return false; } else { @@ -17666,74 +20570,41 @@ var ts; } return type; } - function getJsxIntrinsicElementsType() { - if (!jsxIntrinsicElementsType) { - jsxIntrinsicElementsType = getExportedTypeFromNamespace(JsxNames.JSX, JsxNames.IntrinsicElements) || unknownType; + function getJsxType(name) { + if (jsxTypes[name] === undefined) { + return jsxTypes[name] = getExportedTypeFromNamespace(JsxNames.JSX, name) || unknownType; } - return jsxIntrinsicElementsType; + return jsxTypes[name]; } - function getJsxElementTagSymbol(node) { - var flags = 8; + function getIntrinsicTagSymbol(node) { var links = getNodeLinks(node); if (!links.resolvedSymbol) { - if (isJsxIntrinsicIdentifier(node.tagName)) { - links.resolvedSymbol = lookupIntrinsicTag(node); - } - else { - links.resolvedSymbol = lookupClassTag(node); - } - } - return links.resolvedSymbol; - function lookupIntrinsicTag(node) { - var intrinsicElementsType = getJsxIntrinsicElementsType(); + var intrinsicElementsType = getJsxType(JsxNames.IntrinsicElements); if (intrinsicElementsType !== unknownType) { var intrinsicProp = getPropertyOfType(intrinsicElementsType, node.tagName.text); if (intrinsicProp) { links.jsxFlags |= 1; - return intrinsicProp; + return links.resolvedSymbol = intrinsicProp; } var indexSignatureType = getIndexTypeOfType(intrinsicElementsType, 0); if (indexSignatureType) { links.jsxFlags |= 2; - return intrinsicElementsType.symbol; + return links.resolvedSymbol = intrinsicElementsType.symbol; } error(node, ts.Diagnostics.Property_0_does_not_exist_on_type_1, node.tagName.text, "JSX." + JsxNames.IntrinsicElements); - return unknownSymbol; + return links.resolvedSymbol = unknownSymbol; } else { if (compilerOptions.noImplicitAny) { error(node, ts.Diagnostics.JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists, JsxNames.IntrinsicElements); } + return links.resolvedSymbol = unknownSymbol; } } - function lookupClassTag(node) { - var valueSymbol = resolveJsxTagName(node); - if (valueSymbol && valueSymbol !== unknownSymbol) { - links.jsxFlags |= 4; - if (valueSymbol.flags & 8388608) { - markAliasSymbolAsReferenced(valueSymbol); - } - } - return valueSymbol || unknownSymbol; - } - function resolveJsxTagName(node) { - if (node.tagName.kind === 69) { - var tag = node.tagName; - var sym = getResolvedSymbol(tag); - return sym.exportSymbol || sym; - } - else { - return checkQualifiedName(node.tagName).symbol; - } - } + return links.resolvedSymbol; } - function getJsxElementInstanceType(node) { - ts.Debug.assert(!!(getNodeLinks(node).jsxFlags & 4), "Should not call getJsxElementInstanceType on non-class Element"); - var classSymbol = getJsxElementTagSymbol(node); - if (classSymbol === unknownSymbol) { - return anyType; - } - var valueType = getTypeOfSymbol(classSymbol); + function getJsxElementInstanceType(node, valueType) { + ts.Debug.assert(!(valueType.flags & 16384)); if (isTypeAny(valueType)) { return anyType; } @@ -17745,12 +20616,7 @@ var ts; return unknownType; } } - var returnType = getUnionType(signatures.map(getReturnTypeOfSignature)); - var elemClassType = getJsxGlobalElementClassType(); - if (elemClassType) { - checkTypeRelatedTo(returnType, elemClassType, assignableRelation, node, ts.Diagnostics.JSX_element_type_0_is_not_a_constructor_function_for_JSX_elements); - } - return returnType; + return getUnionType(signatures.map(getReturnTypeOfSignature)); } function getJsxElementPropertiesName() { var jsxNamespace = getGlobalSymbol(JsxNames.JSX, 1536, undefined); @@ -17773,47 +20639,97 @@ var ts; return undefined; } } + function getResolvedJsxType(node, elemType, elemClassType) { + if (!elemType) { + elemType = checkExpression(node.tagName); + } + if (elemType.flags & 16384) { + var types = elemType.types; + return getUnionType(types.map(function (type) { + return getResolvedJsxType(node, type, elemClassType); + })); + } + var elemInstanceType = getJsxElementInstanceType(node, elemType); + if (!elemClassType || !isTypeAssignableTo(elemInstanceType, elemClassType)) { + if (jsxElementType) { + var callSignatures = elemType && getSignaturesOfType(elemType, 0); + var callSignature = callSignatures && callSignatures.length > 0 && callSignatures[0]; + var callReturnType = callSignature && getReturnTypeOfSignature(callSignature); + var paramType = callReturnType && (callSignature.parameters.length === 0 ? emptyObjectType : getTypeOfSymbol(callSignature.parameters[0])); + if (callReturnType && isTypeAssignableTo(callReturnType, jsxElementType)) { + var intrinsicAttributes = getJsxType(JsxNames.IntrinsicAttributes); + if (intrinsicAttributes !== unknownType) { + paramType = intersectTypes(intrinsicAttributes, paramType); + } + return paramType; + } + } + } + if (elemClassType) { + checkTypeRelatedTo(elemInstanceType, elemClassType, assignableRelation, node, ts.Diagnostics.JSX_element_type_0_is_not_a_constructor_function_for_JSX_elements); + } + if (isTypeAny(elemInstanceType)) { + return elemInstanceType; + } + var propsName = getJsxElementPropertiesName(); + if (propsName === undefined) { + return anyType; + } + else if (propsName === "") { + return elemInstanceType; + } + else { + var attributesType = getTypeOfPropertyOfType(elemInstanceType, propsName); + if (!attributesType) { + return emptyObjectType; + } + else if (isTypeAny(attributesType) || (attributesType === unknownType)) { + return attributesType; + } + else if (attributesType.flags & 16384) { + error(node.tagName, ts.Diagnostics.JSX_element_attributes_type_0_may_not_be_a_union_type, typeToString(attributesType)); + return anyType; + } + else { + var apparentAttributesType = attributesType; + var intrinsicClassAttribs = getJsxType(JsxNames.IntrinsicClassAttributes); + if (intrinsicClassAttribs !== unknownType) { + var typeParams = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(intrinsicClassAttribs.symbol); + if (typeParams) { + if (typeParams.length === 1) { + apparentAttributesType = intersectTypes(createTypeReference(intrinsicClassAttribs, [elemInstanceType]), apparentAttributesType); + } + } + else { + apparentAttributesType = intersectTypes(attributesType, intrinsicClassAttribs); + } + } + var intrinsicAttribs = getJsxType(JsxNames.IntrinsicAttributes); + if (intrinsicAttribs !== unknownType) { + apparentAttributesType = intersectTypes(intrinsicAttribs, apparentAttributesType); + } + return apparentAttributesType; + } + } + } function getJsxElementAttributesType(node) { var links = getNodeLinks(node); if (!links.resolvedJsxType) { - var sym = getJsxElementTagSymbol(node); - if (links.jsxFlags & 4) { - var elemInstanceType = getJsxElementInstanceType(node); - if (isTypeAny(elemInstanceType)) { - return links.resolvedJsxType = elemInstanceType; + if (isJsxIntrinsicIdentifier(node.tagName)) { + var symbol = getIntrinsicTagSymbol(node); + if (links.jsxFlags & 1) { + return links.resolvedJsxType = getTypeOfSymbol(symbol); } - var propsName = getJsxElementPropertiesName(); - if (propsName === undefined) { - return links.resolvedJsxType = anyType; - } - else if (propsName === "") { - return links.resolvedJsxType = elemInstanceType; + else if (links.jsxFlags & 2) { + return links.resolvedJsxType = getIndexInfoOfSymbol(symbol, 0).type; } else { - var attributesType = getTypeOfPropertyOfType(elemInstanceType, propsName); - if (!attributesType) { - return links.resolvedJsxType = emptyObjectType; - } - else if (isTypeAny(attributesType) || (attributesType === unknownType)) { - return links.resolvedJsxType = attributesType; - } - else if (!(attributesType.flags & 80896)) { - error(node.tagName, ts.Diagnostics.JSX_element_attributes_type_0_must_be_an_object_type, typeToString(attributesType)); - return links.resolvedJsxType = anyType; - } - else { - return links.resolvedJsxType = attributesType; - } + return links.resolvedJsxType = unknownType; } } - else if (links.jsxFlags & 1) { - return links.resolvedJsxType = getTypeOfSymbol(sym); - } - else if (links.jsxFlags & 2) { - return links.resolvedJsxType = getIndexTypeOfSymbol(sym, 0); - } else { - return links.resolvedJsxType = anyType; + var elemClassType = getJsxGlobalElementClassType(); + return links.resolvedJsxType = getResolvedJsxType(node, undefined, elemClassType); } } return links.resolvedJsxType; @@ -17830,7 +20746,7 @@ var ts; return jsxElementClassType; } function getJsxIntrinsicTagNames() { - var intrinsics = getJsxIntrinsicElementsType(); + var intrinsics = getJsxType(JsxNames.IntrinsicElements); return intrinsics ? getPropertiesOfType(intrinsics) : emptyArray; } function checkJsxPreconditions(errorNode) { @@ -17846,21 +20762,21 @@ var ts; function checkJsxOpeningLikeElement(node) { checkGrammarJsxElement(node); checkJsxPreconditions(node); - if (compilerOptions.jsx === 2) { - var reactSym = resolveName(node.tagName, "React", 107455, ts.Diagnostics.Cannot_find_name_0, "React"); - if (reactSym) { - getSymbolLinks(reactSym).referenced = true; - } + var reactRefErr = compilerOptions.jsx === 2 ? ts.Diagnostics.Cannot_find_name_0 : undefined; + var reactNamespace = compilerOptions.reactNamespace ? compilerOptions.reactNamespace : "React"; + var reactSym = resolveName(node.tagName, reactNamespace, 107455, reactRefErr, reactNamespace); + if (reactSym) { + getSymbolLinks(reactSym).referenced = true; } var targetAttributesType = getJsxElementAttributesType(node); var nameTable = {}; var sawSpreadedAny = false; for (var i = node.attributes.length - 1; i >= 0; i--) { - if (node.attributes[i].kind === 238) { + if (node.attributes[i].kind === 246) { checkJsxAttribute((node.attributes[i]), targetAttributesType, nameTable); } else { - ts.Debug.assert(node.attributes[i].kind === 239); + ts.Debug.assert(node.attributes[i].kind === 247); var spreadType = checkJsxSpreadAttribute((node.attributes[i]), targetAttributesType, nameTable); if (isTypeAny(spreadType)) { sawSpreadedAny = true; @@ -17886,19 +20802,19 @@ var ts; } } function getDeclarationKindFromSymbol(s) { - return s.valueDeclaration ? s.valueDeclaration.kind : 141; + return s.valueDeclaration ? s.valueDeclaration.kind : 145; } function getDeclarationFlagsFromSymbol(s) { - return s.valueDeclaration ? ts.getCombinedNodeFlags(s.valueDeclaration) : s.flags & 134217728 ? 8 | 64 : 0; + return s.valueDeclaration ? ts.getCombinedNodeFlags(s.valueDeclaration) : s.flags & 134217728 ? 4 | 32 : 0; } function checkClassPropertyAccess(node, left, type, prop) { var flags = getDeclarationFlagsFromSymbol(prop); - var declaringClass = getDeclaredTypeOfSymbol(prop.parent); + var declaringClass = getDeclaredTypeOfSymbol(getParentOfSymbol(prop)); + var errorNode = node.kind === 172 || node.kind === 218 ? + node.name : + node.right; if (left.kind === 95) { - var errorNode = node.kind === 166 ? - node.name : - node.right; - if (getDeclarationKindFromSymbol(prop) !== 143) { + if (languageVersion < 2 && getDeclarationKindFromSymbol(prop) !== 147) { error(errorNode, ts.Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword); return false; } @@ -17907,14 +20823,13 @@ var ts; return false; } } - if (!(flags & (16 | 32))) { + if (!(flags & (8 | 16))) { return true; } - var enclosingClassDeclaration = ts.getContainingClass(node); - var enclosingClass = enclosingClassDeclaration ? getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingClassDeclaration)) : undefined; - if (flags & 16) { - if (declaringClass !== enclosingClass) { - error(node, ts.Diagnostics.Property_0_is_private_and_only_accessible_within_class_1, symbolToString(prop), typeToString(declaringClass)); + if (flags & 8) { + var declaringClassDeclaration = getClassLikeDeclarationOfSymbol(getParentOfSymbol(prop)); + if (!isNodeWithinClass(node, declaringClassDeclaration)) { + error(errorNode, ts.Diagnostics.Property_0_is_private_and_only_accessible_within_class_1, symbolToString(prop), typeToString(declaringClass)); return false; } return true; @@ -17922,22 +20837,40 @@ var ts; if (left.kind === 95) { return true; } - if (!enclosingClass || !hasBaseType(enclosingClass, declaringClass)) { - error(node, ts.Diagnostics.Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses, symbolToString(prop), typeToString(declaringClass)); + var enclosingClass = forEachEnclosingClass(node, function (enclosingDeclaration) { + var enclosingClass = getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingDeclaration)); + return hasBaseType(enclosingClass, declaringClass) ? enclosingClass : undefined; + }); + if (!enclosingClass) { + error(errorNode, ts.Diagnostics.Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses, symbolToString(prop), typeToString(declaringClass)); return false; } - if (flags & 64) { + if (flags & 32) { return true; } if (type.flags & 33554432) { type = getConstraintOfTypeParameter(type); } if (!(getTargetType(type).flags & (1024 | 2048) && hasBaseType(type, enclosingClass))) { - error(node, ts.Diagnostics.Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1, symbolToString(prop), typeToString(enclosingClass)); + error(errorNode, ts.Diagnostics.Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1, symbolToString(prop), typeToString(enclosingClass)); return false; } return true; } + function checkNonNullExpression(node) { + var type = checkExpression(node); + if (strictNullChecks) { + var kind = getNullableKind(type); + if (kind) { + error(node, kind & 32 ? kind & 64 ? + ts.Diagnostics.Object_is_possibly_null_or_undefined : + ts.Diagnostics.Object_is_possibly_undefined : + ts.Diagnostics.Object_is_possibly_null); + } + return getNonNullableType(type); + } + return type; + } function checkPropertyAccessExpression(node) { return checkPropertyAccessExpressionOrQualifiedName(node, node.expression, node.name); } @@ -17945,7 +20878,7 @@ var ts; return checkPropertyAccessExpressionOrQualifiedName(node, node.left, node.right); } function checkPropertyAccessExpressionOrQualifiedName(node, left, right) { - var type = checkExpression(left); + var type = checkNonNullExpression(left); if (isTypeAny(type)) { return type; } @@ -17964,10 +20897,29 @@ var ts; if (prop.parent && prop.parent.flags & 32) { checkClassPropertyAccess(node, left, apparentType, prop); } - return getTypeOfSymbol(prop); + var propType = getTypeOfSymbol(prop); + if (node.kind !== 172 || ts.isAssignmentTarget(node) || + !(propType.flags & 16384) && !(prop.flags & (3 | 4 | 98304))) { + return propType; + } + var leftmostNode = getLeftmostIdentifierOrThis(node); + if (!leftmostNode) { + return propType; + } + if (leftmostNode.kind === 69) { + var leftmostSymbol = getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(leftmostNode)); + if (!leftmostSymbol) { + return propType; + } + var declaration = leftmostSymbol.valueDeclaration; + if (!declaration || declaration.kind !== 218 && declaration.kind !== 142 && declaration.kind !== 169) { + return propType; + } + } + return getFlowTypeOfReference(node, propType, true); } function isValidPropertyAccess(node, propertyName) { - var left = node.kind === 166 + var left = node.kind === 172 ? node.expression : node.left; var type = checkExpression(left); @@ -17979,10 +20931,47 @@ var ts; } return true; } + function getForInVariableSymbol(node) { + var initializer = node.initializer; + if (initializer.kind === 219) { + var variable = initializer.declarations[0]; + if (variable && !ts.isBindingPattern(variable.name)) { + return getSymbolOfNode(variable); + } + } + else if (initializer.kind === 69) { + return getResolvedSymbol(initializer); + } + return undefined; + } + function hasNumericPropertyNames(type) { + return getIndexTypeOfType(type, 1) && !getIndexTypeOfType(type, 0); + } + function isForInVariableForNumericPropertyNames(expr) { + var e = skipParenthesizedNodes(expr); + if (e.kind === 69) { + var symbol = getResolvedSymbol(e); + if (symbol.flags & 3) { + var child = expr; + var node = expr.parent; + while (node) { + if (node.kind === 207 && + child === node.statement && + getForInVariableSymbol(node) === symbol && + hasNumericPropertyNames(checkExpression(node.expression))) { + return true; + } + child = node; + node = node.parent; + } + } + } + return false; + } function checkIndexedAccess(node) { if (!node.argumentExpression) { - var sourceFile = getSourceFile(node); - if (node.parent.kind === 169 && node.parent.expression === node) { + var sourceFile = ts.getSourceFileOfNode(node); + if (node.parent.kind === 175 && node.parent.expression === node) { var start = ts.skipTrivia(sourceFile.text, node.expression.end); var end = node.end; grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead); @@ -17993,7 +20982,7 @@ var ts; grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.Expression_expected); } } - var objectType = getApparentType(checkExpression(node.expression)); + var objectType = getApparentType(checkNonNullExpression(node.expression)); var indexType = node.argumentExpression ? checkExpression(node.argumentExpression) : unknownType; if (objectType === unknownType) { return unknownType; @@ -18019,18 +21008,22 @@ var ts; } } if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, 258 | 132 | 16777216)) { - if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, 132)) { - var numberIndexType = getIndexTypeOfType(objectType, 1); - if (numberIndexType) { - return numberIndexType; + if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, 132) || isForInVariableForNumericPropertyNames(node.argumentExpression)) { + var numberIndexInfo = getIndexInfoOfType(objectType, 1); + if (numberIndexInfo) { + getNodeLinks(node).resolvedIndexInfo = numberIndexInfo; + return numberIndexInfo.type; } } - var stringIndexType = getIndexTypeOfType(objectType, 0); - if (stringIndexType) { - return stringIndexType; + var stringIndexInfo = getIndexInfoOfType(objectType, 0); + if (stringIndexInfo) { + getNodeLinks(node).resolvedIndexInfo = stringIndexInfo; + return stringIndexInfo.type; } if (compilerOptions.noImplicitAny && !compilerOptions.suppressImplicitAnyIndexErrors && !isTypeAny(objectType)) { - error(node, ts.Diagnostics.Index_signature_of_object_type_implicitly_has_an_any_type); + error(node, getIndexTypeOfType(objectType, 1) ? + ts.Diagnostics.Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number : + ts.Diagnostics.Index_signature_of_object_type_implicitly_has_an_any_type); } return anyType; } @@ -18041,7 +21034,7 @@ var ts; if (indexArgumentExpression.kind === 9 || indexArgumentExpression.kind === 8) { return indexArgumentExpression.text; } - if (indexArgumentExpression.kind === 167 || indexArgumentExpression.kind === 166) { + if (indexArgumentExpression.kind === 173 || indexArgumentExpression.kind === 172) { var value = getConstantValue(indexArgumentExpression); if (value !== undefined) { return value.toString(); @@ -18084,10 +21077,10 @@ var ts; return true; } function resolveUntypedCall(node) { - if (node.kind === 170) { + if (node.kind === 176) { checkExpression(node.template); } - else if (node.kind !== 139) { + else if (node.kind !== 143) { ts.forEach(node.arguments, function (argument) { checkExpression(argument); }); @@ -18109,19 +21102,19 @@ var ts; for (var _i = 0, signatures_2 = signatures; _i < signatures_2.length; _i++) { var signature = signatures_2[_i]; var symbol = signature.declaration && getSymbolOfNode(signature.declaration); - var parent_5 = signature.declaration && signature.declaration.parent; + var parent_9 = signature.declaration && signature.declaration.parent; if (!lastSymbol || symbol === lastSymbol) { - if (lastParent && parent_5 === lastParent) { + if (lastParent && parent_9 === lastParent) { index++; } else { - lastParent = parent_5; + lastParent = parent_9; index = cutoffIndex; } } else { index = cutoffIndex = result.length; - lastParent = parent_5; + lastParent = parent_9; } lastSymbol = symbol; if (signature.hasStringLiterals) { @@ -18138,7 +21131,7 @@ var ts; function getSpreadArgumentIndex(args) { for (var i = 0; i < args.length; i++) { var arg = args[i]; - if (arg && arg.kind === 185) { + if (arg && arg.kind === 191) { return i; } } @@ -18150,11 +21143,11 @@ var ts; var callIsIncomplete; var isDecorator; var spreadArgIndex = -1; - if (node.kind === 170) { + if (node.kind === 176) { var tagExpression = node; adjustedArgCount = args.length; typeArguments = undefined; - if (tagExpression.template.kind === 183) { + if (tagExpression.template.kind === 189) { var templateExpression = tagExpression.template; var lastSpan = ts.lastOrUndefined(templateExpression.templateSpans); ts.Debug.assert(lastSpan !== undefined); @@ -18166,7 +21159,7 @@ var ts; callIsIncomplete = !!templateLiteral.isUnterminated; } } - else if (node.kind === 139) { + else if (node.kind === 143) { isDecorator = true; typeArguments = undefined; adjustedArgCount = getEffectiveArgumentCount(node, undefined, signature); @@ -18174,7 +21167,7 @@ var ts; else { var callExpression = node; if (!callExpression.arguments) { - ts.Debug.assert(callExpression.kind === 169); + ts.Debug.assert(callExpression.kind === 175); return signature.minArgumentCount === 0; } adjustedArgCount = callExpression.arguments.hasTrailingComma ? args.length + 1 : args.length; @@ -18200,7 +21193,7 @@ var ts; if (type.flags & 80896) { var resolved = resolveStructuredTypeMembers(type); if (resolved.callSignatures.length === 1 && resolved.constructSignatures.length === 0 && - resolved.properties.length === 0 && !resolved.stringIndexType && !resolved.numberIndexType) { + resolved.properties.length === 0 && !resolved.stringIndexInfo && !resolved.numberIndexInfo) { return resolved.callSignatures[0]; } } @@ -18215,7 +21208,7 @@ var ts; } function inferTypeArguments(node, signature, args, excludeArgument, context) { var typeParameters = signature.typeParameters; - var inferenceMapper = createInferenceMapper(context); + var inferenceMapper = getInferenceMapper(context); for (var i = 0; i < typeParameters.length; i++) { if (!context.inferences[i].isFixed) { context.inferredTypes[i] = undefined; @@ -18224,10 +21217,15 @@ var ts; if (context.failedTypeParameterIndex !== undefined && !context.inferences[context.failedTypeParameterIndex].isFixed) { context.failedTypeParameterIndex = undefined; } + if (signature.thisType) { + var thisArgumentNode = getThisArgumentOfCall(node); + var thisArgumentType = thisArgumentNode ? checkExpression(thisArgumentNode) : voidType; + inferTypes(context, thisArgumentType, signature.thisType); + } var argCount = getEffectiveArgumentCount(node, args, signature); for (var i = 0; i < argCount; i++) { var arg = getEffectiveArgument(node, args, i); - if (arg === undefined || arg.kind !== 187) { + if (arg === undefined || arg.kind !== 193) { var paramType = getTypeAtPosition(signature, i); var argType = getEffectiveArgumentType(node, i, arg); if (argType === undefined) { @@ -18248,13 +21246,11 @@ var ts; } getInferredTypes(context); } - function checkTypeArguments(signature, typeArguments, typeArgumentResultTypes, reportErrors, headMessage) { + function checkTypeArguments(signature, typeArgumentNodes, typeArgumentTypes, reportErrors, headMessage) { var typeParameters = signature.typeParameters; var typeArgumentsAreAssignable = true; + var mapper; for (var i = 0; i < typeParameters.length; i++) { - var typeArgNode = typeArguments[i]; - var typeArgument = getTypeFromTypeNode(typeArgNode); - typeArgumentResultTypes[i] = typeArgument; if (typeArgumentsAreAssignable) { var constraint = getConstraintOfTypeParameter(typeParameters[i]); if (constraint) { @@ -18264,26 +21260,39 @@ var ts; errorInfo = ts.chainDiagnosticMessages(errorInfo, typeArgumentHeadMessage); typeArgumentHeadMessage = headMessage; } - typeArgumentsAreAssignable = checkTypeAssignableTo(typeArgument, constraint, reportErrors ? typeArgNode : undefined, typeArgumentHeadMessage, errorInfo); + if (!mapper) { + mapper = createTypeMapper(typeParameters, typeArgumentTypes); + } + var typeArgument = typeArgumentTypes[i]; + typeArgumentsAreAssignable = checkTypeAssignableTo(typeArgument, getTypeWithThisArgument(instantiateType(constraint, mapper), typeArgument), reportErrors ? typeArgumentNodes[i] : undefined, typeArgumentHeadMessage, errorInfo); } } } return typeArgumentsAreAssignable; } function checkApplicableSignature(node, args, signature, relation, excludeArgument, reportErrors) { + if (signature.thisType && signature.thisType !== voidType && node.kind !== 175) { + var thisArgumentNode = getThisArgumentOfCall(node); + var thisArgumentType = thisArgumentNode ? checkExpression(thisArgumentNode) : voidType; + var errorNode = reportErrors ? (thisArgumentNode || node) : undefined; + var headMessage_1 = ts.Diagnostics.The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1; + if (!checkTypeRelatedTo(thisArgumentType, signature.thisType, relation, errorNode, headMessage_1)) { + return false; + } + } + var headMessage = ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1; var argCount = getEffectiveArgumentCount(node, args, signature); for (var i = 0; i < argCount; i++) { var arg = getEffectiveArgument(node, args, i); - if (arg === undefined || arg.kind !== 187) { + if (arg === undefined || arg.kind !== 193) { var paramType = getTypeAtPosition(signature, i); var argType = getEffectiveArgumentType(node, i, arg); if (argType === undefined) { argType = arg.kind === 9 && !reportErrors - ? getStringLiteralType(arg) + ? getStringLiteralTypeForText(arg.text) : checkExpressionWithContextualType(arg, paramType, excludeArgument && excludeArgument[i] ? identityMapper : undefined); } var errorNode = reportErrors ? getEffectiveArgumentErrorNode(node, i, arg) : undefined; - var headMessage = ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1; if (!checkTypeRelatedTo(argType, paramType, relation, errorNode, headMessage)) { return false; } @@ -18291,18 +21300,29 @@ var ts; } return true; } + function getThisArgumentOfCall(node) { + if (node.kind === 174) { + var callee = node.expression; + if (callee.kind === 172) { + return callee.expression; + } + else if (callee.kind === 173) { + return callee.expression; + } + } + } function getEffectiveCallArguments(node) { var args; - if (node.kind === 170) { + if (node.kind === 176) { var template = node.template; args = [undefined]; - if (template.kind === 183) { + if (template.kind === 189) { ts.forEach(template.templateSpans, function (span) { args.push(span.expression); }); } } - else if (node.kind === 139) { + else if (node.kind === 143) { return undefined; } else { @@ -18311,21 +21331,21 @@ var ts; return args; } function getEffectiveArgumentCount(node, args, signature) { - if (node.kind === 139) { + if (node.kind === 143) { switch (node.parent.kind) { - case 214: - case 186: + case 221: + case 192: return 1; - case 141: - return 2; - case 143: case 145: - case 146: + return 2; + case 147: + case 149: + case 150: if (languageVersion === 0) { return 2; } return signature.parameters.length >= 3 ? 3 : 2; - case 138: + case 142: return 3; } } @@ -18334,50 +21354,50 @@ var ts; } } function getEffectiveDecoratorFirstArgumentType(node) { - if (node.kind === 214) { + if (node.kind === 221) { var classSymbol = getSymbolOfNode(node); return getTypeOfSymbol(classSymbol); } - if (node.kind === 138) { + if (node.kind === 142) { node = node.parent; - if (node.kind === 144) { + if (node.kind === 148) { var classSymbol = getSymbolOfNode(node); return getTypeOfSymbol(classSymbol); } } - if (node.kind === 141 || - node.kind === 143 || - node.kind === 145 || - node.kind === 146) { + if (node.kind === 145 || + node.kind === 147 || + node.kind === 149 || + node.kind === 150) { return getParentTypeOfClassElement(node); } ts.Debug.fail("Unsupported decorator target."); return unknownType; } function getEffectiveDecoratorSecondArgumentType(node) { - if (node.kind === 214) { + if (node.kind === 221) { ts.Debug.fail("Class decorators should not have a second synthetic argument."); return unknownType; } - if (node.kind === 138) { + if (node.kind === 142) { node = node.parent; - if (node.kind === 144) { + if (node.kind === 148) { return anyType; } } - if (node.kind === 141 || - node.kind === 143 || - node.kind === 145 || - node.kind === 146) { + if (node.kind === 145 || + node.kind === 147 || + node.kind === 149 || + node.kind === 150) { var element = node; switch (element.name.kind) { case 69: case 8: case 9: - return getStringLiteralType(element.name); - case 136: + return getStringLiteralTypeForText(element.name.text); + case 140: var nameType = checkComputedPropertyName(element.name); - if (allConstituentTypesHaveKind(nameType, 16777216)) { + if (isTypeOfKind(nameType, 16777216)) { return nameType; } else { @@ -18392,20 +21412,20 @@ var ts; return unknownType; } function getEffectiveDecoratorThirdArgumentType(node) { - if (node.kind === 214) { + if (node.kind === 221) { ts.Debug.fail("Class decorators should not have a third synthetic argument."); return unknownType; } - if (node.kind === 138) { + if (node.kind === 142) { return numberType; } - if (node.kind === 141) { + if (node.kind === 145) { ts.Debug.fail("Property decorators should not have a third synthetic argument."); return unknownType; } - if (node.kind === 143 || - node.kind === 145 || - node.kind === 146) { + if (node.kind === 147 || + node.kind === 149 || + node.kind === 150) { var propertyType = getTypeOfNode(node); return createTypedPropertyDescriptorType(propertyType); } @@ -18426,26 +21446,26 @@ var ts; return unknownType; } function getEffectiveArgumentType(node, argIndex, arg) { - if (node.kind === 139) { + if (node.kind === 143) { return getEffectiveDecoratorArgumentType(node, argIndex); } - else if (argIndex === 0 && node.kind === 170) { - return globalTemplateStringsArrayType; + else if (argIndex === 0 && node.kind === 176) { + return getGlobalTemplateStringsArrayType(); } return undefined; } function getEffectiveArgument(node, args, argIndex) { - if (node.kind === 139 || - (argIndex === 0 && node.kind === 170)) { + if (node.kind === 143 || + (argIndex === 0 && node.kind === 176)) { return undefined; } return args[argIndex]; } function getEffectiveArgumentErrorNode(node, argIndex, arg) { - if (node.kind === 139) { + if (node.kind === 143) { return node.expression; } - else if (argIndex === 0 && node.kind === 170) { + else if (argIndex === 0 && node.kind === 176) { return node.template; } else { @@ -18453,8 +21473,8 @@ var ts; } } function resolveCall(node, signatures, candidatesOutArray, headMessage) { - var isTaggedTemplate = node.kind === 170; - var isDecorator = node.kind === 139; + var isTaggedTemplate = node.kind === 176; + var isDecorator = node.kind === 143; var typeArguments; if (!isTaggedTemplate && !isDecorator) { typeArguments = node.typeArguments; @@ -18501,7 +21521,8 @@ var ts; } else if (candidateForTypeArgumentError) { if (!isTaggedTemplate && !isDecorator && typeArguments) { - checkTypeArguments(candidateForTypeArgumentError, node.typeArguments, [], true, headMessage); + var typeArguments_2 = node.typeArguments; + checkTypeArguments(candidateForTypeArgumentError, typeArguments_2, ts.map(typeArguments_2, getTypeFromTypeNode), true, headMessage); } else { ts.Debug.assert(resultOfFailedInference.failedTypeParameterIndex >= 0); @@ -18553,7 +21574,7 @@ var ts; if (candidate.typeParameters) { var typeArgumentTypes = void 0; if (typeArguments) { - typeArgumentTypes = new Array(candidate.typeParameters.length); + typeArgumentTypes = ts.map(typeArguments, getTypeFromTypeNode); typeArgumentsAreValid = checkTypeArguments(candidate, typeArguments, typeArgumentTypes, false); } else { @@ -18600,12 +21621,14 @@ var ts; var superType = checkSuperExpression(node.expression); if (superType !== unknownType) { var baseTypeNode = ts.getClassExtendsHeritageClauseElement(ts.getContainingClass(node)); - var baseConstructors = getInstantiatedConstructorsForTypeArguments(superType, baseTypeNode.typeArguments); - return resolveCall(node, baseConstructors, candidatesOutArray); + if (baseTypeNode) { + var baseConstructors = getInstantiatedConstructorsForTypeArguments(superType, baseTypeNode.typeArguments); + return resolveCall(node, baseConstructors, candidatesOutArray); + } } return resolveUntypedCall(node); } - var funcType = checkExpression(node.expression); + var funcType = checkNonNullExpression(node.expression); var apparentType = getApparentType(funcType); if (apparentType === unknownType) { return resolveErrorCall(node); @@ -18636,7 +21659,7 @@ var ts; error(node.arguments[spreadIndex], ts.Diagnostics.Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_5_and_higher); } } - var expressionType = checkExpression(node.expression); + var expressionType = checkNonNullExpression(node.expression); expressionType = getApparentType(expressionType); if (expressionType === unknownType) { return resolveErrorCall(node); @@ -18654,6 +21677,9 @@ var ts; } var constructSignatures = getSignaturesOfType(expressionType, 1); if (constructSignatures.length) { + if (!isConstructorAccessible(node, constructSignatures[0])) { + return resolveErrorCall(node); + } return resolveCall(node, constructSignatures, candidatesOutArray); } var callSignatures = getSignaturesOfType(expressionType, 0); @@ -18662,11 +21688,36 @@ var ts; if (getReturnTypeOfSignature(signature) !== voidType) { error(node, ts.Diagnostics.Only_a_void_function_can_be_called_with_the_new_keyword); } + if (signature.thisType === voidType) { + error(node, ts.Diagnostics.A_function_that_is_called_with_the_new_keyword_cannot_have_a_this_type_that_is_void); + } return signature; } error(node, ts.Diagnostics.Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature); return resolveErrorCall(node); } + function isConstructorAccessible(node, signature) { + if (!signature || !signature.declaration) { + return true; + } + var declaration = signature.declaration; + var flags = declaration.flags; + if (!(flags & (8 | 16))) { + return true; + } + var declaringClassDeclaration = getClassLikeDeclarationOfSymbol(declaration.parent.symbol); + var declaringClass = getDeclaredTypeOfSymbol(declaration.parent.symbol); + if (!isNodeWithinClass(node, declaringClassDeclaration)) { + if (flags & 8) { + error(node, ts.Diagnostics.Constructor_of_class_0_is_private_and_only_accessible_within_the_class_declaration, typeToString(declaringClass)); + } + if (flags & 16) { + error(node, ts.Diagnostics.Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration, typeToString(declaringClass)); + } + return false; + } + return true; + } function resolveTaggedTemplateExpression(node, candidatesOutArray) { var tagType = checkExpression(node.tag); var apparentType = getApparentType(tagType); @@ -18685,16 +21736,16 @@ var ts; } function getDiagnosticHeadMessageForDecoratorResolution(node) { switch (node.parent.kind) { - case 214: - case 186: + case 221: + case 192: return ts.Diagnostics.Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression; - case 138: + case 142: return ts.Diagnostics.Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression; - case 141: - return ts.Diagnostics.Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression; - case 143: case 145: - case 146: + return ts.Diagnostics.Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression; + case 147: + case 149: + case 150: return ts.Diagnostics.Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression; } } @@ -18710,7 +21761,7 @@ var ts; } var headMessage = getDiagnosticHeadMessageForDecoratorResolution(node); if (!callSignatures.length) { - var errorInfo; + var errorInfo = void 0; errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature); errorInfo = ts.chainDiagnosticMessages(errorInfo, headMessage); diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(node, errorInfo)); @@ -18718,27 +21769,39 @@ var ts; } return resolveCall(node, callSignatures, candidatesOutArray, headMessage); } + function resolveSignature(node, candidatesOutArray) { + switch (node.kind) { + case 174: + return resolveCallExpression(node, candidatesOutArray); + case 175: + return resolveNewExpression(node, candidatesOutArray); + case 176: + return resolveTaggedTemplateExpression(node, candidatesOutArray); + case 143: + return resolveDecorator(node, candidatesOutArray); + } + ts.Debug.fail("Branch in 'resolveSignature' should be unreachable."); + } function getResolvedSignature(node, candidatesOutArray) { var links = getNodeLinks(node); - if (!links.resolvedSignature || candidatesOutArray) { - links.resolvedSignature = anySignature; - if (node.kind === 168) { - links.resolvedSignature = resolveCallExpression(node, candidatesOutArray); - } - else if (node.kind === 169) { - links.resolvedSignature = resolveNewExpression(node, candidatesOutArray); - } - else if (node.kind === 170) { - links.resolvedSignature = resolveTaggedTemplateExpression(node, candidatesOutArray); - } - else if (node.kind === 139) { - links.resolvedSignature = resolveDecorator(node, candidatesOutArray); - } - else { - ts.Debug.fail("Branch in 'getResolvedSignature' should be unreachable."); - } + var cached = links.resolvedSignature; + if (cached && cached !== anySignature && !candidatesOutArray) { + return cached; } - return links.resolvedSignature; + links.resolvedSignature = anySignature; + var result = resolveSignature(node, candidatesOutArray); + links.resolvedSignature = flowLoopStart === flowLoopCount ? result : cached; + return result; + } + function getResolvedOrAnySignature(node) { + return getNodeLinks(node).resolvedSignature === anySignature ? anySignature : getResolvedSignature(node); + } + function getInferredClassType(symbol) { + var links = getSymbolLinks(symbol); + if (!links.inferredClassType) { + links.inferredClassType = createAnonymousType(undefined, symbol.members, emptyArray, emptyArray, undefined, undefined); + } + return links.inferredClassType; } function checkCallExpression(node) { checkGrammarTypeArguments(node, node.typeArguments) || checkGrammarArguments(node, node.arguments); @@ -18746,19 +21809,24 @@ var ts; if (node.expression.kind === 95) { return voidType; } - if (node.kind === 169) { + if (node.kind === 175) { var declaration = signature.declaration; if (declaration && - declaration.kind !== 144 && declaration.kind !== 148 && - declaration.kind !== 153) { - if (compilerOptions.noImplicitAny) { + declaration.kind !== 152 && + declaration.kind !== 157 && + !ts.isJSDocConstructSignature(declaration)) { + var funcSymbol = checkExpression(node.expression).symbol; + if (funcSymbol && funcSymbol.members && (funcSymbol.flags & 16)) { + return getInferredClassType(funcSymbol); + } + else if (compilerOptions.noImplicitAny) { error(node, ts.Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type); } return anyType; } } - if (ts.isInJavaScriptFile(node) && ts.isRequireCall(node)) { + if (ts.isInJavaScriptFile(node) && ts.isRequireCall(node, true)) { return resolveExternalModuleTypeByLiteral(node.arguments[0]); } return getReturnTypeOfSignature(signature); @@ -18771,18 +21839,29 @@ var ts; var targetType = getTypeFromTypeNode(node.type); if (produceDiagnostics && targetType !== unknownType) { var widenedType = getWidenedType(exprType); - var bothAreStringLike = someConstituentTypeHasKind(targetType, 258) && - someConstituentTypeHasKind(widenedType, 258); - if (!bothAreStringLike && !(isTypeAssignableTo(targetType, widenedType))) { - checkTypeAssignableTo(exprType, targetType, node, ts.Diagnostics.Neither_type_0_nor_type_1_is_assignable_to_the_other); + if (!isTypeComparableTo(targetType, widenedType)) { + checkTypeComparableTo(exprType, targetType, node, ts.Diagnostics.Type_0_cannot_be_converted_to_type_1); } } return targetType; } + function checkNonNullAssertion(node) { + return getNonNullableType(checkExpression(node.expression)); + } + function getTypeOfParameter(symbol) { + var type = getTypeOfSymbol(symbol); + if (strictNullChecks) { + var declaration = symbol.valueDeclaration; + if (declaration && declaration.initializer) { + return addNullableKind(type, 32); + } + } + return type; + } function getTypeAtPosition(signature, pos) { return signature.hasRestParameter ? - pos < signature.parameters.length - 1 ? getTypeOfSymbol(signature.parameters[pos]) : getRestTypeOfSignature(signature) : - pos < signature.parameters.length ? getTypeOfSymbol(signature.parameters[pos]) : anyType; + pos < signature.parameters.length - 1 ? getTypeOfParameter(signature.parameters[pos]) : getRestTypeOfSignature(signature) : + pos < signature.parameters.length ? getTypeOfParameter(signature.parameters[pos]) : anyType; } function assignContextualParameterTypes(signature, context, mapper) { var len = signature.parameters.length - (signature.hasRestParameter ? 1 : 0); @@ -18801,7 +21880,7 @@ var ts; if (ts.isBindingPattern(node.name)) { for (var _i = 0, _a = node.name.elements; _i < _a.length; _i++) { var element = _a[_i]; - if (element.kind !== 187) { + if (element.kind !== 193) { if (element.name.kind === 69) { getSymbolLinks(getSymbolOfNode(element)).type = getTypeForBindingElement(element); } @@ -18814,12 +21893,24 @@ var ts; var links = getSymbolLinks(parameter); if (!links.type) { links.type = instantiateType(contextualType, mapper); + if (links.type === emptyObjectType && + (parameter.valueDeclaration.name.kind === 167 || + parameter.valueDeclaration.name.kind === 168)) { + links.type = getTypeFromBindingPattern(parameter.valueDeclaration.name); + } assignBindingElementTypes(parameter.valueDeclaration); } else if (isInferentialContext(mapper)) { inferTypes(mapper.context, links.type, instantiateType(contextualType, mapper)); } } + function getReturnTypeFromJSDocComment(func) { + var returnTag = ts.getJSDocReturnTag(func); + if (returnTag && returnTag.typeExpression) { + return getTypeFromTypeNode(returnTag.typeExpression.type); + } + return undefined; + } function createPromiseType(promisedType) { var globalPromiseType = getGlobalPromiseType(); if (globalPromiseType !== emptyGenericType) { @@ -18835,14 +21926,14 @@ var ts; } var isAsync = ts.isAsyncFunctionLike(func); var type; - if (func.body.kind !== 192) { + if (func.body.kind !== 199) { type = checkExpressionCached(func.body, contextualMapper); if (isAsync) { type = checkAwaitedType(type, func, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member); } } else { - var types; + var types = void 0; var funcIsGenerator = !!func.asteriskToken; if (funcIsGenerator) { types = checkAndAggregateYieldOperandTypes(func.body, contextualMapper); @@ -18855,7 +21946,11 @@ var ts; } } else { - types = checkAndAggregateReturnExpressionTypes(func.body, contextualMapper, isAsync); + var hasImplicitReturn = !!(func.flags & 32768); + types = checkAndAggregateReturnExpressionTypes(func.body, contextualMapper, isAsync, hasImplicitReturn); + if (!types) { + return neverType; + } if (types.length === 0) { if (isAsync) { var promiseType = createPromiseType(voidType); @@ -18865,9 +21960,7 @@ var ts; } return promiseType; } - else { - return voidType; - } + return voidType; } } type = contextualSignature ? getUnionType(types) : getCommonSupertype(types); @@ -18878,7 +21971,7 @@ var ts; } else { error(func, ts.Diagnostics.No_best_common_type_exists_among_return_expressions); - return unknownType; + return getUnionType(types); } } if (funcIsGenerator) { @@ -18917,8 +22010,9 @@ var ts; }); return aggregatedTypes; } - function checkAndAggregateReturnExpressionTypes(body, contextualMapper, isAsync) { + function checkAndAggregateReturnExpressionTypes(body, contextualMapper, isAsync, hasImplicitReturn) { var aggregatedTypes = []; + var hasOmittedExpressions = false; ts.forEachReturnStatement(body, function (returnStatement) { var expr = returnStatement.expression; if (expr) { @@ -18926,45 +22020,67 @@ var ts; if (isAsync) { type = checkAwaitedType(type, body.parent, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member); } - if (!ts.contains(aggregatedTypes, type)) { + if (type !== neverType && !ts.contains(aggregatedTypes, type)) { aggregatedTypes.push(type); } } + else { + hasOmittedExpressions = true; + } }); + if (aggregatedTypes.length === 0 && !hasOmittedExpressions && !hasImplicitReturn) { + return undefined; + } + if (strictNullChecks && aggregatedTypes.length && (hasOmittedExpressions || hasImplicitReturn)) { + if (!ts.contains(aggregatedTypes, undefinedType)) { + aggregatedTypes.push(undefinedType); + } + } return aggregatedTypes; } function checkAllCodePathsInNonVoidFunctionReturnOrThrow(func, returnType) { if (!produceDiagnostics) { return; } - if (returnType === voidType || isTypeAny(returnType)) { + if (returnType && maybeTypeOfKind(returnType, 1 | 16)) { return; } - if (ts.nodeIsMissing(func.body) || func.body.kind !== 192 || !(func.flags & 524288)) { + if (ts.nodeIsMissing(func.body) || func.body.kind !== 199 || !(func.flags & 32768)) { return; } - if (func.flags & 1048576) { - if (compilerOptions.noImplicitReturns) { - error(func.type, ts.Diagnostics.Not_all_code_paths_return_a_value); - } + var hasExplicitReturn = func.flags & 65536; + if (returnType === neverType) { + error(func.type, ts.Diagnostics.A_function_returning_never_cannot_have_a_reachable_end_point); } - else { + else if (returnType && !hasExplicitReturn) { error(func.type, ts.Diagnostics.A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value); } + else if (returnType && strictNullChecks && !isTypeAssignableTo(undefinedType, returnType)) { + error(func.type, ts.Diagnostics.Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined); + } + else if (compilerOptions.noImplicitReturns) { + if (!returnType) { + if (!hasExplicitReturn) { + return; + } + var inferredReturnType = getReturnTypeOfSignature(getSignatureFromDeclaration(func)); + if (isUnwrappedReturnTypeVoidOrAny(func, inferredReturnType)) { + return; + } + } + error(func.type || func, ts.Diagnostics.Not_all_code_paths_return_a_value); + } } function checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper) { - ts.Debug.assert(node.kind !== 143 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 147 || ts.isObjectLiteralMethod(node)); var hasGrammarError = checkGrammarFunctionLikeDeclaration(node); - if (!hasGrammarError && node.kind === 173) { + if (!hasGrammarError && node.kind === 179) { checkGrammarForGenerator(node); } if (contextualMapper === identityMapper && isContextSensitive(node)) { + checkNodeDeferred(node); return anyFunctionType; } - var isAsync = ts.isAsyncFunctionLike(node); - if (isAsync) { - emitAwaiter = true; - } var links = getNodeLinks(node); var type = getTypeOfSymbol(node.symbol); var contextSensitive = isContextSensitive(node); @@ -18988,48 +22104,41 @@ var ts; } if (!contextChecked) { checkSignatureDeclaration(node); + checkNodeDeferred(node); } } } - if (produceDiagnostics && node.kind !== 143 && node.kind !== 142) { + if (produceDiagnostics && node.kind !== 147 && node.kind !== 146) { checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); } return type; } - function checkFunctionExpressionOrObjectLiteralMethodBody(node) { - ts.Debug.assert(node.kind !== 143 || ts.isObjectLiteralMethod(node)); + function checkFunctionExpressionOrObjectLiteralMethodDeferred(node) { + ts.Debug.assert(node.kind !== 147 || ts.isObjectLiteralMethod(node)); var isAsync = ts.isAsyncFunctionLike(node); - if (isAsync) { - emitAwaiter = true; - } - var returnType = node.type && getTypeFromTypeNode(node.type); - var promisedType; - if (returnType && isAsync) { - promisedType = checkAsyncFunctionReturnType(node); - } - if (returnType && !node.asteriskToken) { - checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, isAsync ? promisedType : returnType); + var returnOrPromisedType = node.type && (isAsync ? checkAsyncFunctionReturnType(node) : getTypeFromTypeNode(node.type)); + if (!node.asteriskToken) { + checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnOrPromisedType); } if (node.body) { if (!node.type) { getReturnTypeOfSignature(getSignatureFromDeclaration(node)); } - if (node.body.kind === 192) { + if (node.body.kind === 199) { checkSourceElement(node.body); } else { var exprType = checkExpression(node.body); - if (returnType) { + if (returnOrPromisedType) { if (isAsync) { var awaitedType = checkAwaitedType(exprType, node.body, ts.Diagnostics.Expression_body_for_async_arrow_function_does_not_have_a_valid_callable_then_member); - checkTypeAssignableTo(awaitedType, promisedType, node.body); + checkTypeAssignableTo(awaitedType, returnOrPromisedType, node.body); } else { - checkTypeAssignableTo(exprType, returnType, node.body); + checkTypeAssignableTo(exprType, returnOrPromisedType, node.body); } } - checkFunctionAndClassExpressionBodies(node.body); } } } @@ -19040,59 +22149,62 @@ var ts; } return true; } - function checkReferenceExpression(n, invalidReferenceMessage, constantVariableMessage) { - function findSymbol(n) { - var symbol = getNodeLinks(n).resolvedSymbol; - return symbol && getExportSymbolOfValueSymbolIfExported(symbol); + function isReadonlySymbol(symbol) { + return symbol.flags & 4 && (getDeclarationFlagsFromSymbol(symbol) & 64) !== 0 || + symbol.flags & 3 && (getDeclarationFlagsFromSymbol(symbol) & 2048) !== 0 || + symbol.flags & 98304 && !(symbol.flags & 65536) || + (symbol.flags & 8) !== 0; + } + function isReferenceToReadonlyEntity(expr, symbol) { + if (isReadonlySymbol(symbol)) { + if (symbol.flags & 4 && + (expr.kind === 172 || expr.kind === 173) && + expr.expression.kind === 97) { + var func = ts.getContainingFunction(expr); + return !(func && func.kind === 148 && func.parent === symbol.valueDeclaration.parent); + } + return true; } - function isReferenceOrErrorExpression(n) { - switch (n.kind) { - case 69: { - var symbol = findSymbol(n); - return !symbol || symbol === unknownSymbol || symbol === argumentsSymbol || (symbol.flags & 3) !== 0; + return false; + } + function isReferenceThroughNamespaceImport(expr) { + if (expr.kind === 172 || expr.kind === 173) { + var node = skipParenthesizedNodes(expr.expression); + if (node.kind === 69) { + var symbol = getNodeLinks(node).resolvedSymbol; + if (symbol.flags & 8388608) { + var declaration = getDeclarationOfAliasSymbol(symbol); + return declaration && declaration.kind === 232; } - case 166: { - var symbol = findSymbol(n); - return !symbol || symbol === unknownSymbol || (symbol.flags & ~8) !== 0; - } - case 167: - return true; - case 172: - return isReferenceOrErrorExpression(n.expression); - default: - return false; } } - function isConstVariableReference(n) { - switch (n.kind) { - case 69: - case 166: { - var symbol = findSymbol(n); - return symbol && (symbol.flags & 3) !== 0 && (getDeclarationFlagsFromSymbol(symbol) & 16384) !== 0; - } - case 167: { - var index = n.argumentExpression; - var symbol = findSymbol(n.expression); - if (symbol && index && index.kind === 9) { - var name_13 = index.text; - var prop = getPropertyOfType(getTypeOfSymbol(symbol), name_13); - return prop && (prop.flags & 3) !== 0 && (getDeclarationFlagsFromSymbol(prop) & 16384) !== 0; - } + return false; + } + function checkReferenceExpression(expr, invalidReferenceMessage, constantVariableMessage) { + var node = skipParenthesizedNodes(expr); + if (node.kind !== 69 && node.kind !== 172 && node.kind !== 173) { + error(expr, invalidReferenceMessage); + return false; + } + var links = getNodeLinks(node); + var symbol = getExportSymbolOfValueSymbolIfExported(links.resolvedSymbol); + if (symbol) { + if (symbol !== unknownSymbol && symbol !== argumentsSymbol) { + if (node.kind === 69 && !(symbol.flags & 3)) { + error(expr, invalidReferenceMessage); return false; } - case 172: - return isConstVariableReference(n.expression); - default: + if (isReferenceToReadonlyEntity(node, symbol) || isReferenceThroughNamespaceImport(node)) { + error(expr, constantVariableMessage); return false; + } } } - if (!isReferenceOrErrorExpression(n)) { - error(n, invalidReferenceMessage); - return false; - } - if (isConstVariableReference(n)) { - error(n, constantVariableMessage); - return false; + else if (node.kind === 173) { + if (links.resolvedIndexInfo && links.resolvedIndexInfo.isReadonly) { + error(expr, constantVariableMessage); + return false; + } } return true; } @@ -19110,7 +22222,7 @@ var ts; } function checkAwaitExpression(node) { if (produceDiagnostics) { - if (!(node.parserContextFlags & 8)) { + if (!(node.flags & 33554432)) { grammarErrorOnFirstToken(node, ts.Diagnostics.await_expression_is_only_allowed_within_an_async_function); } if (isInParameterInitializerBeforeContainingFunction(node)) { @@ -19126,7 +22238,7 @@ var ts; case 35: case 36: case 50: - if (someConstituentTypeHasKind(operandType, 16777216)) { + if (maybeTypeOfKind(operandType, 16777216)) { error(node.operand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(node.operator)); } return numberType; @@ -19134,9 +22246,9 @@ var ts; return booleanType; case 41: case 42: - var ok = checkArithmeticOperandType(node.operand, operandType, ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); + var ok = checkArithmeticOperandType(node.operand, getNonNullableType(operandType), ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); if (ok) { - checkReferenceExpression(node.operand, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant); + checkReferenceExpression(node.operand, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant_or_a_read_only_property); } return numberType; } @@ -19144,42 +22256,50 @@ var ts; } function checkPostfixUnaryExpression(node) { var operandType = checkExpression(node.operand); - var ok = checkArithmeticOperandType(node.operand, operandType, ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); + var ok = checkArithmeticOperandType(node.operand, getNonNullableType(operandType), ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); if (ok) { - checkReferenceExpression(node.operand, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant); + checkReferenceExpression(node.operand, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant_or_a_read_only_property); } return numberType; } - function someConstituentTypeHasKind(type, kind) { - if (type.flags & kind) { - return true; - } - if (type.flags & 49152) { - var types = type.types; - for (var _i = 0, types_9 = types; _i < types_9.length; _i++) { - var current = types_9[_i]; - if (current.flags & kind) { - return true; - } - } - return false; - } - return false; - } - function allConstituentTypesHaveKind(type, kind) { + function maybeTypeOfKind(type, kind) { if (type.flags & kind) { return true; } if (type.flags & 49152) { var types = type.types; for (var _i = 0, types_10 = types; _i < types_10.length; _i++) { - var current = types_10[_i]; - if (!(current.flags & kind)) { + var t = types_10[_i]; + if (maybeTypeOfKind(t, kind)) { + return true; + } + } + } + return false; + } + function isTypeOfKind(type, kind) { + if (type.flags & kind) { + return true; + } + if (type.flags & 16384) { + var types = type.types; + for (var _i = 0, types_11 = types; _i < types_11.length; _i++) { + var t = types_11[_i]; + if (!isTypeOfKind(t, kind)) { return false; } } return true; } + if (type.flags & 32768) { + var types = type.types; + for (var _a = 0, types_12 = types; _a < types_12.length; _a++) { + var t = types_12[_a]; + if (isTypeOfKind(t, kind)) { + return true; + } + } + } return false; } function isConstEnumObjectType(type) { @@ -19189,7 +22309,7 @@ var ts; return (symbol.flags & 128) !== 0; } function checkInstanceOfExpression(left, right, leftType, rightType) { - if (allConstituentTypesHaveKind(leftType, 16777726)) { + if (isTypeOfKind(leftType, 16777726)) { error(left, ts.Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); } if (!(isTypeAny(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) { @@ -19210,84 +22330,92 @@ var ts; var properties = node.properties; for (var _i = 0, properties_3 = properties; _i < properties_3.length; _i++) { var p = properties_3[_i]; - if (p.kind === 245 || p.kind === 246) { - var name_14 = p.name; - if (name_14.kind === 136) { - checkComputedPropertyName(name_14); - } - if (isComputedNonLiteralName(name_14)) { - continue; - } - var text = getTextOfPropertyName(name_14); - var type = isTypeAny(sourceType) - ? sourceType - : getTypeOfPropertyOfType(sourceType, text) || - isNumericLiteralName(text) && getIndexTypeOfType(sourceType, 1) || - getIndexTypeOfType(sourceType, 0); - if (type) { - if (p.kind === 246) { - checkDestructuringAssignment(p, type); - } - else { - checkDestructuringAssignment(p.initializer, type); - } + checkObjectLiteralDestructuringPropertyAssignment(sourceType, p, contextualMapper); + } + return sourceType; + } + function checkObjectLiteralDestructuringPropertyAssignment(objectLiteralType, property, contextualMapper) { + if (property.kind === 253 || property.kind === 254) { + var name_13 = property.name; + if (name_13.kind === 140) { + checkComputedPropertyName(name_13); + } + if (isComputedNonLiteralName(name_13)) { + return undefined; + } + var text = getTextOfPropertyName(name_13); + var type = isTypeAny(objectLiteralType) + ? objectLiteralType + : getTypeOfPropertyOfType(objectLiteralType, text) || + isNumericLiteralName(text) && getIndexTypeOfType(objectLiteralType, 1) || + getIndexTypeOfType(objectLiteralType, 0); + if (type) { + if (property.kind === 254) { + return checkDestructuringAssignment(property, type); } else { - error(name_14, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(sourceType), ts.declarationNameToString(name_14)); + return checkDestructuringAssignment(property.initializer, type); } } else { - error(p, ts.Diagnostics.Property_assignment_expected); + error(name_13, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(objectLiteralType), ts.declarationNameToString(name_13)); } } - return sourceType; + else { + error(property, ts.Diagnostics.Property_assignment_expected); + } } function checkArrayLiteralAssignment(node, sourceType, contextualMapper) { var elementType = checkIteratedTypeOrElementType(sourceType, node, false) || unknownType; var elements = node.elements; for (var i = 0; i < elements.length; i++) { - var e = elements[i]; - if (e.kind !== 187) { - if (e.kind !== 185) { - var propName = "" + i; - var type = isTypeAny(sourceType) - ? sourceType - : isTupleLikeType(sourceType) - ? getTypeOfPropertyOfType(sourceType, propName) - : elementType; - if (type) { - checkDestructuringAssignment(e, type, contextualMapper); - } - else { - if (isTupleType(sourceType)) { - error(e, ts.Diagnostics.Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2, typeToString(sourceType), sourceType.elementTypes.length, elements.length); - } - else { - error(e, ts.Diagnostics.Type_0_has_no_property_1, typeToString(sourceType), propName); - } - } + checkArrayLiteralDestructuringElementAssignment(node, sourceType, i, elementType, contextualMapper); + } + return sourceType; + } + function checkArrayLiteralDestructuringElementAssignment(node, sourceType, elementIndex, elementType, contextualMapper) { + var elements = node.elements; + var element = elements[elementIndex]; + if (element.kind !== 193) { + if (element.kind !== 191) { + var propName = "" + elementIndex; + var type = isTypeAny(sourceType) + ? sourceType + : isTupleLikeType(sourceType) + ? getTypeOfPropertyOfType(sourceType, propName) + : elementType; + if (type) { + return checkDestructuringAssignment(element, type, contextualMapper); } else { - if (i < elements.length - 1) { - error(e, ts.Diagnostics.A_rest_element_must_be_last_in_an_array_destructuring_pattern); + if (isTupleType(sourceType)) { + error(element, ts.Diagnostics.Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2, typeToString(sourceType), sourceType.elementTypes.length, elements.length); } else { - var restExpression = e.expression; - if (restExpression.kind === 181 && restExpression.operatorToken.kind === 56) { - error(restExpression.operatorToken, ts.Diagnostics.A_rest_element_cannot_have_an_initializer); - } - else { - checkDestructuringAssignment(restExpression, createArrayType(elementType), contextualMapper); - } + error(element, ts.Diagnostics.Type_0_has_no_property_1, typeToString(sourceType), propName); + } + } + } + else { + if (elementIndex < elements.length - 1) { + error(element, ts.Diagnostics.A_rest_element_must_be_last_in_an_array_destructuring_pattern); + } + else { + var restExpression = element.expression; + if (restExpression.kind === 187 && restExpression.operatorToken.kind === 56) { + error(restExpression.operatorToken, ts.Diagnostics.A_rest_element_cannot_have_an_initializer); + } + else { + return checkDestructuringAssignment(restExpression, createArrayType(elementType), contextualMapper); } } } } - return sourceType; + return undefined; } function checkDestructuringAssignment(exprOrAssignment, sourceType, contextualMapper) { var target; - if (exprOrAssignment.kind === 246) { + if (exprOrAssignment.kind === 254) { var prop = exprOrAssignment; if (prop.objectAssignmentInitializer) { checkBinaryLikeExpression(prop.name, prop.equalsToken, prop.objectAssignmentInitializer, contextualMapper); @@ -19297,31 +22425,34 @@ var ts; else { target = exprOrAssignment; } - if (target.kind === 181 && target.operatorToken.kind === 56) { + if (target.kind === 187 && target.operatorToken.kind === 56) { checkBinaryExpression(target, contextualMapper); target = target.left; } - if (target.kind === 165) { + if (target.kind === 171) { return checkObjectLiteralAssignment(target, sourceType, contextualMapper); } - if (target.kind === 164) { + if (target.kind === 170) { return checkArrayLiteralAssignment(target, sourceType, contextualMapper); } return checkReferenceAssignment(target, sourceType, contextualMapper); } function checkReferenceAssignment(target, sourceType, contextualMapper) { var targetType = checkExpression(target, contextualMapper); - if (checkReferenceExpression(target, ts.Diagnostics.Invalid_left_hand_side_of_assignment_expression, ts.Diagnostics.Left_hand_side_of_assignment_expression_cannot_be_a_constant)) { + if (checkReferenceExpression(target, ts.Diagnostics.Invalid_left_hand_side_of_assignment_expression, ts.Diagnostics.Left_hand_side_of_assignment_expression_cannot_be_a_constant_or_a_read_only_property)) { checkTypeAssignableTo(sourceType, targetType, target, undefined); } return sourceType; } + function isTypeEqualityComparableTo(source, target) { + return (target.flags & 96) !== 0 || isTypeComparableTo(source, target); + } function checkBinaryExpression(node, contextualMapper) { return checkBinaryLikeExpression(node.left, node.operatorToken, node.right, contextualMapper, node); } function checkBinaryLikeExpression(left, operatorToken, right, contextualMapper, errorNode) { var operator = operatorToken.kind; - if (operator === 56 && (left.kind === 165 || left.kind === 164)) { + if (operator === 56 && (left.kind === 171 || left.kind === 170)) { return checkDestructuringAssignment(left, checkExpression(right, contextualMapper), contextualMapper); } var leftType = checkExpression(left, contextualMapper); @@ -19349,11 +22480,13 @@ var ts; case 68: case 46: case 66: - if (leftType.flags & (32 | 64)) + if (leftType.flags & 96) leftType = rightType; - if (rightType.flags & (32 | 64)) + if (rightType.flags & 96) rightType = leftType; - var suggestedOperator; + leftType = getNonNullableType(leftType); + rightType = getNonNullableType(rightType); + var suggestedOperator = void 0; if ((leftType.flags & 8) && (rightType.flags & 8) && (suggestedOperator = getSuggestedBooleanOperator(operatorToken.kind)) !== undefined) { @@ -19369,16 +22502,18 @@ var ts; return numberType; case 35: case 57: - if (leftType.flags & (32 | 64)) + if (leftType.flags & 96) leftType = rightType; - if (rightType.flags & (32 | 64)) + if (rightType.flags & 96) rightType = leftType; - var resultType; - if (allConstituentTypesHaveKind(leftType, 132) && allConstituentTypesHaveKind(rightType, 132)) { + leftType = getNonNullableType(leftType); + rightType = getNonNullableType(rightType); + var resultType = void 0; + if (isTypeOfKind(leftType, 132) && isTypeOfKind(rightType, 132)) { resultType = numberType; } else { - if (allConstituentTypesHaveKind(leftType, 258) || allConstituentTypesHaveKind(rightType, 258)) { + if (isTypeOfKind(leftType, 258) || isTypeOfKind(rightType, 258)) { resultType = stringType; } else if (isTypeAny(leftType) || isTypeAny(rightType)) { @@ -19400,17 +22535,17 @@ var ts; case 27: case 28: case 29: - if (!checkForDisallowedESSymbolOperand(operator)) { - return booleanType; + if (checkForDisallowedESSymbolOperand(operator)) { + if (!isTypeComparableTo(leftType, rightType) && !isTypeComparableTo(rightType, leftType)) { + reportOperatorError(); + } } + return booleanType; case 30: case 31: case 32: case 33: - if (someConstituentTypeHasKind(leftType, 258) && someConstituentTypeHasKind(rightType, 258)) { - return booleanType; - } - if (!isTypeAssignableTo(leftType, rightType) && !isTypeAssignableTo(rightType, leftType)) { + if (!isTypeEqualityComparableTo(leftType, rightType) && !isTypeEqualityComparableTo(rightType, leftType)) { reportOperatorError(); } return booleanType; @@ -19419,9 +22554,9 @@ var ts; case 90: return checkInExpression(left, right, leftType, rightType); case 51: - return rightType; + return addNullableKind(rightType, getNullableKind(leftType)); case 52: - return getUnionType([leftType, rightType]); + return getUnionType([getNonNullableType(leftType), rightType]); case 56: checkAssignmentOperator(rightType); return getRegularTypeOfObjectLiteral(rightType); @@ -19429,8 +22564,8 @@ var ts; return rightType; } function checkForDisallowedESSymbolOperand(operator) { - var offendingSymbolOperand = someConstituentTypeHasKind(leftType, 16777216) ? left : - someConstituentTypeHasKind(rightType, 16777216) ? right : + var offendingSymbolOperand = maybeTypeOfKind(leftType, 16777216) ? left : + maybeTypeOfKind(rightType, 16777216) ? right : undefined; if (offendingSymbolOperand) { error(offendingSymbolOperand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(operator)); @@ -19455,7 +22590,7 @@ var ts; } function checkAssignmentOperator(valueType) { if (produceDiagnostics && operator >= 56 && operator <= 68) { - var ok = checkReferenceExpression(left, ts.Diagnostics.Invalid_left_hand_side_of_assignment_expression, ts.Diagnostics.Left_hand_side_of_assignment_expression_cannot_be_a_constant); + var ok = checkReferenceExpression(left, ts.Diagnostics.Invalid_left_hand_side_of_assignment_expression, ts.Diagnostics.Left_hand_side_of_assignment_expression_cannot_be_a_constant_or_a_read_only_property); if (ok) { checkTypeAssignableTo(valueType, leftType, left, undefined); } @@ -19482,7 +22617,7 @@ var ts; } function checkYieldExpression(node) { if (produceDiagnostics) { - if (!(node.parserContextFlags & 2) || isYieldExpressionInClass(node)) { + if (!(node.flags & 8388608) || isYieldExpressionInClass(node)) { grammarErrorOnFirstToken(node, ts.Diagnostics.A_yield_expression_is_only_allowed_in_a_generator_body); } if (isInParameterInitializerBeforeContainingFunction(node)) { @@ -19493,7 +22628,7 @@ var ts; var func = ts.getContainingFunction(node); if (func && func.asteriskToken) { var expressionType = checkExpressionCached(node.expression, undefined); - var expressionElementType; + var expressionElementType = void 0; var nodeIsYieldStar = !!node.asteriskToken; if (nodeIsYieldStar) { expressionElementType = checkElementTypeOfIterable(expressionType, node.expression); @@ -19520,7 +22655,7 @@ var ts; function checkStringLiteralExpression(node) { var contextualType = getContextualType(node); if (contextualType && contextualTypeIsStringLiteralType(contextualType)) { - return getStringLiteralType(node); + return getStringLiteralTypeForText(node.text); } return stringType; } @@ -19540,19 +22675,22 @@ var ts; function checkExpressionCached(node, contextualMapper) { var links = getNodeLinks(node); if (!links.resolvedType) { + var saveFlowLoopStart = flowLoopStart; + flowLoopStart = flowLoopCount; links.resolvedType = checkExpression(node, contextualMapper); + flowLoopStart = saveFlowLoopStart; } return links.resolvedType; } function checkPropertyAssignment(node, contextualMapper) { - if (node.name.kind === 136) { + if (node.name.kind === 140) { checkComputedPropertyName(node.name); } return checkExpression(node.initializer, contextualMapper); } function checkObjectLiteralMethod(node, contextualMapper) { checkGrammarMethod(node); - if (node.name.kind === 136) { + if (node.name.kind === 140) { checkComputedPropertyName(node.name); } var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); @@ -19575,7 +22713,7 @@ var ts; } function checkExpression(node, contextualMapper) { var type; - if (node.kind === 135) { + if (node.kind === 139) { type = checkQualifiedName(node); } else { @@ -19583,9 +22721,9 @@ var ts; type = instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, contextualMapper); } if (isConstEnumObjectType(type)) { - var ok = (node.parent.kind === 166 && node.parent.expression === node) || - (node.parent.kind === 167 && node.parent.expression === node) || - ((node.kind === 69 || node.kind === 135) && isInRightSideOfImportOrExportAssignment(node)); + var ok = (node.parent.kind === 172 && node.parent.expression === node) || + (node.parent.kind === 173 && node.parent.expression === node) || + ((node.kind === 69 || node.kind === 139) && isInRightSideOfImportOrExportAssignment(node)); if (!ok) { error(node, ts.Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment); } @@ -19611,7 +22749,7 @@ var ts; return booleanType; case 8: return checkNumericLiteral(node); - case 183: + case 189: return checkTemplateExpression(node); case 9: return checkStringLiteralExpression(node); @@ -19619,58 +22757,60 @@ var ts; return stringType; case 10: return globalRegExpType; - case 164: - return checkArrayLiteral(node, contextualMapper); - case 165: - return checkObjectLiteral(node, contextualMapper); - case 166: - return checkPropertyAccessExpression(node); - case 167: - return checkIndexedAccess(node); - case 168: - case 169: - return checkCallExpression(node); case 170: - return checkTaggedTemplateExpression(node); - case 172: - return checkExpression(node.expression, contextualMapper); - case 186: - return checkClassExpression(node); - case 173: - case 174: - return checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); - case 176: - return checkTypeOfExpression(node); + return checkArrayLiteral(node, contextualMapper); case 171: - case 189: - return checkAssertion(node); + return checkObjectLiteral(node, contextualMapper); + case 172: + return checkPropertyAccessExpression(node); + case 173: + return checkIndexedAccess(node); + case 174: case 175: - return checkDeleteExpression(node); - case 177: - return checkVoidExpression(node); + return checkCallExpression(node); + case 176: + return checkTaggedTemplateExpression(node); case 178: - return checkAwaitExpression(node); + return checkExpression(node.expression, contextualMapper); + case 192: + return checkClassExpression(node); case 179: - return checkPrefixUnaryExpression(node); case 180: - return checkPostfixUnaryExpression(node); - case 181: - return checkBinaryExpression(node, contextualMapper); + return checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); case 182: - return checkConditionalExpression(node, contextualMapper); - case 185: - return checkSpreadElementExpression(node, contextualMapper); - case 187: - return undefinedType; + return checkTypeOfExpression(node); + case 177: + case 195: + return checkAssertion(node); + case 196: + return checkNonNullAssertion(node); + case 181: + return checkDeleteExpression(node); + case 183: + return checkVoidExpression(node); case 184: + return checkAwaitExpression(node); + case 185: + return checkPrefixUnaryExpression(node); + case 186: + return checkPostfixUnaryExpression(node); + case 187: + return checkBinaryExpression(node, contextualMapper); + case 188: + return checkConditionalExpression(node, contextualMapper); + case 191: + return checkSpreadElementExpression(node, contextualMapper); + case 193: + return undefinedType; + case 190: return checkYieldExpression(node); - case 240: + case 248: return checkJsxExpression(node); - case 233: + case 241: return checkJsxElement(node); - case 234: + case 242: return checkJsxSelfClosingElement(node); - case 235: + case 243: ts.Debug.fail("Shouldn't ever directly check a JsxOpeningElement"); } return unknownType; @@ -19680,8 +22820,8 @@ var ts; grammarErrorOnFirstToken(node.expression, ts.Diagnostics.Type_expected); } checkSourceElement(node.constraint); + getConstraintOfTypeParameter(getDeclaredTypeOfTypeParameter(getSymbolOfNode(node))); if (produceDiagnostics) { - checkTypeParameterHasIllegalReferencesInConstraint(node); checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_parameter_name_cannot_be_0); } } @@ -19689,15 +22829,23 @@ var ts; checkGrammarDecorators(node) || checkGrammarModifiers(node); checkVariableLikeDeclaration(node); var func = ts.getContainingFunction(node); - if (node.flags & 56) { + if (node.flags & 92) { func = ts.getContainingFunction(node); - if (!(func.kind === 144 && ts.nodeIsPresent(func.body))) { + if (!(func.kind === 148 && ts.nodeIsPresent(func.body))) { error(node, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); } } if (node.questionToken && ts.isBindingPattern(node.name) && func.body) { error(node, ts.Diagnostics.A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature); } + if (node.name.text === "this") { + if (ts.indexOf(func.parameters, node) !== 0) { + error(node, ts.Diagnostics.A_this_parameter_must_be_the_first_parameter); + } + if (func.kind === 148 || func.kind === 152 || func.kind === 157) { + error(node, ts.Diagnostics.A_constructor_cannot_have_a_this_parameter); + } + } if (node.dotDotDotToken && !ts.isBindingPattern(node.name) && !isArrayType(getTypeOfSymbol(node.symbol))) { error(node, ts.Diagnostics.A_rest_parameter_must_be_of_an_array_type); } @@ -19706,9 +22854,9 @@ var ts; if (!node.asteriskToken || !node.body) { return false; } - return node.kind === 143 || - node.kind === 213 || - node.kind === 173; + return node.kind === 147 || + node.kind === 220 || + node.kind === 179; } function getTypePredicateParameterIndex(parameterList, parameter) { if (parameterList) { @@ -19722,90 +22870,99 @@ var ts; } return -1; } - function isInLegalTypePredicatePosition(node) { - switch (node.parent.kind) { - case 174: - case 147: - case 213: - case 173: - case 152: - case 143: - case 142: - return node === node.parent.type; + function checkTypePredicate(node) { + var parent = getTypePredicateParent(node); + if (!parent) { + error(node, ts.Diagnostics.A_type_predicate_is_only_allowed_in_return_type_position_for_functions_and_methods); + return; + } + var typePredicate = getSignatureFromDeclaration(parent).typePredicate; + if (!typePredicate) { + return; + } + var parameterName = node.parameterName; + if (ts.isThisTypePredicate(typePredicate)) { + getTypeFromThisTypeNode(parameterName); + } + else { + if (typePredicate.parameterIndex >= 0) { + if (parent.parameters[typePredicate.parameterIndex].dotDotDotToken) { + error(parameterName, ts.Diagnostics.A_type_predicate_cannot_reference_a_rest_parameter); + } + else { + var leadingError = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.A_type_predicate_s_type_must_be_assignable_to_its_parameter_s_type); + checkTypeAssignableTo(typePredicate.type, getTypeOfNode(parent.parameters[typePredicate.parameterIndex]), node.type, undefined, leadingError); + } + } + else if (parameterName) { + var hasReportedError = false; + for (var _i = 0, _a = parent.parameters; _i < _a.length; _i++) { + var name_14 = _a[_i].name; + if (ts.isBindingPattern(name_14) && + checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_14, parameterName, typePredicate.parameterName)) { + hasReportedError = true; + break; + } + } + if (!hasReportedError) { + error(node.parameterName, ts.Diagnostics.Cannot_find_parameter_0, typePredicate.parameterName); + } + } + } + } + function getTypePredicateParent(node) { + switch (node.parent.kind) { + case 180: + case 151: + case 220: + case 179: + case 156: + case 147: + case 146: + var parent_10 = node.parent; + if (node === parent_10.type) { + return parent_10; + } + } + } + function checkIfTypePredicateVariableIsDeclaredInBindingPattern(pattern, predicateVariableNode, predicateVariableName) { + for (var _i = 0, _a = pattern.elements; _i < _a.length; _i++) { + var name_15 = _a[_i].name; + if (name_15.kind === 69 && + name_15.text === predicateVariableName) { + error(predicateVariableNode, ts.Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, predicateVariableName); + return true; + } + else if (name_15.kind === 168 || + name_15.kind === 167) { + if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_15, predicateVariableNode, predicateVariableName)) { + return true; + } + } } - return false; } function checkSignatureDeclaration(node) { - if (node.kind === 149) { + if (node.kind === 153) { checkGrammarIndexSignature(node); } - else if (node.kind === 152 || node.kind === 213 || node.kind === 153 || - node.kind === 147 || node.kind === 144 || - node.kind === 148) { + else if (node.kind === 156 || node.kind === 220 || node.kind === 157 || + node.kind === 151 || node.kind === 148 || + node.kind === 152) { checkGrammarFunctionLikeDeclaration(node); } checkTypeParameters(node.typeParameters); ts.forEach(node.parameters, checkParameter); if (node.type) { - if (node.type.kind === 150) { - var typePredicate = getSignatureFromDeclaration(node).typePredicate; - var typePredicateNode = node.type; - if (isInLegalTypePredicatePosition(typePredicateNode)) { - if (typePredicate.parameterIndex >= 0) { - if (node.parameters[typePredicate.parameterIndex].dotDotDotToken) { - error(typePredicateNode.parameterName, ts.Diagnostics.A_type_predicate_cannot_reference_a_rest_parameter); - } - else { - checkTypeAssignableTo(typePredicate.type, getTypeOfNode(node.parameters[typePredicate.parameterIndex]), typePredicateNode.type); - } - } - else if (typePredicateNode.parameterName) { - var hasReportedError = false; - for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) { - var param = _a[_i]; - if (hasReportedError) { - break; - } - if (param.name.kind === 161 || - param.name.kind === 162) { - (function checkBindingPattern(pattern) { - for (var _i = 0, _a = pattern.elements; _i < _a.length; _i++) { - var element = _a[_i]; - if (element.name.kind === 69 && - element.name.text === typePredicate.parameterName) { - error(typePredicateNode.parameterName, ts.Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, typePredicate.parameterName); - hasReportedError = true; - break; - } - else if (element.name.kind === 162 || - element.name.kind === 161) { - checkBindingPattern(element.name); - } - } - })(param.name); - } - } - if (!hasReportedError) { - error(typePredicateNode.parameterName, ts.Diagnostics.Cannot_find_parameter_0, typePredicate.parameterName); - } - } - } - else { - error(typePredicateNode, ts.Diagnostics.A_type_predicate_is_only_allowed_in_return_type_position_for_functions_and_methods); - } - } - else { - checkSourceElement(node.type); - } + checkSourceElement(node.type); } if (produceDiagnostics) { checkCollisionWithArgumentsInGeneratedCode(node); if (compilerOptions.noImplicitAny && !node.type) { switch (node.kind) { - case 148: + case 152: error(node, ts.Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; - case 147: + case 151: error(node, ts.Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; } @@ -19822,12 +22979,14 @@ var ts; checkTypeAssignableTo(iterableIteratorInstantiation, returnType, node.type); } } + else if (ts.isAsyncFunctionLike(node)) { + checkAsyncFunctionReturnType(node); + } } } - checkSpecializedSignatureDeclaration(node); } function checkTypeForDuplicateIndexSignatures(node) { - if (node.kind === 215) { + if (node.kind === 222) { var nodeSymbol = getSymbolOfNode(node); if (nodeSymbol.declarations.length > 0 && nodeSymbol.declarations[0] !== node) { return; @@ -19842,7 +23001,7 @@ var ts; var declaration = decl; if (declaration.parameters.length === 1 && declaration.parameters[0].type) { switch (declaration.parameters[0].type.kind) { - case 130: + case 132: if (!seenStringIndexer) { seenStringIndexer = true; } @@ -19850,7 +23009,7 @@ var ts; error(declaration, ts.Diagnostics.Duplicate_string_index_signature); } break; - case 128: + case 130: if (!seenNumericIndexer) { seenNumericIndexer = true; } @@ -19869,7 +23028,7 @@ var ts; } function checkMethodDeclaration(node) { checkGrammarMethod(node) || checkGrammarComputedPropertyName(node.name); - checkFunctionLikeDeclaration(node); + checkFunctionOrMethodDeclaration(node); if (node.flags & 128 && node.body) { error(node, ts.Diagnostics.Method_0_cannot_have_an_implementation_because_it_is_marked_abstract, ts.declarationNameToString(node.name)); } @@ -19889,14 +23048,11 @@ var ts; if (!produceDiagnostics) { return; } - function isSuperCallExpression(n) { - return n.kind === 168 && n.expression.kind === 95; - } function containsSuperCallAsComputedPropertyName(n) { return n.name && containsSuperCall(n.name); } function containsSuperCall(n) { - if (isSuperCallExpression(n)) { + if (ts.isSuperCallExpression(n)) { return true; } else if (ts.isFunctionLike(n)) { @@ -19911,32 +23067,31 @@ var ts; if (n.kind === 97) { error(n, ts.Diagnostics.this_cannot_be_referenced_in_current_location); } - else if (n.kind !== 173 && n.kind !== 213) { + else if (n.kind !== 179 && n.kind !== 220) { ts.forEachChild(n, markThisReferencesAsErrors); } } function isInstancePropertyWithInitializer(n) { - return n.kind === 141 && - !(n.flags & 64) && + return n.kind === 145 && + !(n.flags & 32) && !!n.initializer; } var containingClassDecl = node.parent; if (ts.getClassExtendsHeritageClauseElement(containingClassDecl)) { - var containingClassSymbol = getSymbolOfNode(containingClassDecl); - var containingClassInstanceType = getDeclaredTypeOfSymbol(containingClassSymbol); - var baseConstructorType = getBaseConstructorTypeOfClass(containingClassInstanceType); - if (containsSuperCall(node.body)) { - if (baseConstructorType === nullType) { - error(node, ts.Diagnostics.A_constructor_cannot_contain_a_super_call_when_its_class_extends_null); + var classExtendsNull = classDeclarationExtendsNull(containingClassDecl); + var superCall = getSuperCallInConstructor(node); + if (superCall) { + if (classExtendsNull) { + error(superCall, ts.Diagnostics.A_constructor_cannot_contain_a_super_call_when_its_class_extends_null); } var superCallShouldBeFirst = ts.forEach(node.parent.members, isInstancePropertyWithInitializer) || - ts.forEach(node.parameters, function (p) { return p.flags & (8 | 16 | 32); }); + ts.forEach(node.parameters, function (p) { return p.flags & 92; }); if (superCallShouldBeFirst) { var statements = node.body.statements; - var superCallStatement; + var superCallStatement = void 0; for (var _i = 0, statements_2 = statements; _i < statements_2.length; _i++) { var statement = statements_2[_i]; - if (statement.kind === 195 && isSuperCallExpression(statement.expression)) { + if (statement.kind === 202 && ts.isSuperCallExpression(statement.expression)) { superCallStatement = statement; break; } @@ -19947,12 +23102,9 @@ var ts; if (!superCallStatement) { error(node, ts.Diagnostics.A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties); } - else { - markThisReferencesAsErrors(superCallStatement.expression); - } } } - else if (baseConstructorType !== nullType) { + else if (!classExtendsNull) { error(node, ts.Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call); } } @@ -19960,9 +23112,11 @@ var ts; function checkAccessorDeclaration(node) { if (produceDiagnostics) { checkGrammarFunctionLikeDeclaration(node) || checkGrammarAccessor(node) || checkGrammarComputedPropertyName(node.name); - if (node.kind === 145) { - if (!ts.isInAmbientContext(node) && ts.nodeIsPresent(node.body) && (node.flags & 524288)) { - if (node.flags & 1048576) { + checkDecorators(node); + checkSignatureDeclaration(node); + if (node.kind === 149) { + if (!ts.isInAmbientContext(node) && ts.nodeIsPresent(node.body) && (node.flags & 32768)) { + if (node.flags & 65536) { if (compilerOptions.noImplicitReturns) { error(node.name, ts.Diagnostics.Not_all_code_paths_return_a_value); } @@ -19972,36 +23126,58 @@ var ts; } } } + if (node.name.kind === 140) { + checkComputedPropertyName(node.name); + } if (!ts.hasDynamicName(node)) { - var otherKind = node.kind === 145 ? 146 : 145; + var otherKind = node.kind === 149 ? 150 : 149; var otherAccessor = ts.getDeclarationOfKind(node.symbol, otherKind); if (otherAccessor) { - if (((node.flags & 56) !== (otherAccessor.flags & 56))) { + if (((node.flags & 28) !== (otherAccessor.flags & 28))) { error(node.name, ts.Diagnostics.Getter_and_setter_accessors_do_not_agree_in_visibility); } - var currentAccessorType = getAnnotatedAccessorType(node); - var otherAccessorType = getAnnotatedAccessorType(otherAccessor); - if (currentAccessorType && otherAccessorType) { - if (!isTypeIdenticalTo(currentAccessorType, otherAccessorType)) { - error(node, ts.Diagnostics.get_and_set_accessor_must_have_the_same_type); - } + if (((node.flags & 128) !== (otherAccessor.flags & 128))) { + error(node.name, ts.Diagnostics.Accessors_must_both_be_abstract_or_non_abstract); } + checkAccessorDeclarationTypesIdentical(node, otherAccessor, getAnnotatedAccessorType, ts.Diagnostics.get_and_set_accessor_must_have_the_same_type); + checkAccessorDeclarationTypesIdentical(node, otherAccessor, getAnnotatedAccessorThisType, ts.Diagnostics.get_and_set_accessor_must_have_the_same_this_type); } } getTypeOfAccessors(getSymbolOfNode(node)); } - checkFunctionLikeDeclaration(node); + if (node.parent.kind !== 171) { + checkSourceElement(node.body); + } + else { + checkNodeDeferred(node); + } + } + function checkAccessorDeclarationTypesIdentical(first, second, getAnnotatedType, message) { + var firstType = getAnnotatedType(first); + var secondType = getAnnotatedType(second); + if (firstType && secondType && !isTypeIdenticalTo(firstType, secondType)) { + error(first, message); + } + } + function checkAccessorDeferred(node) { + checkSourceElement(node.body); } function checkMissingDeclaration(node) { checkDecorators(node); } - function checkTypeArgumentConstraints(typeParameters, typeArguments) { + function checkTypeArgumentConstraints(typeParameters, typeArgumentNodes) { + var typeArguments; + var mapper; var result = true; for (var i = 0; i < typeParameters.length; i++) { var constraint = getConstraintOfTypeParameter(typeParameters[i]); if (constraint) { + if (!typeArguments) { + typeArguments = ts.map(typeArgumentNodes, getTypeFromTypeNode); + mapper = createTypeMapper(typeParameters, typeArguments); + } var typeArgument = typeArguments[i]; - result = result && checkTypeAssignableTo(getTypeFromTypeNode(typeArgument), constraint, typeArgument, ts.Diagnostics.Type_0_does_not_satisfy_the_constraint_1); + result = result && checkTypeAssignableTo(typeArgument, getTypeWithThisArgument(instantiateType(constraint, mapper), typeArgument), typeArgumentNodes[i], ts.Diagnostics.Type_0_does_not_satisfy_the_constraint_1); } } return result; @@ -20043,49 +23219,18 @@ var ts; ts.forEach(node.types, checkSourceElement); } function isPrivateWithinAmbient(node) { - return (node.flags & 16) && ts.isInAmbientContext(node); - } - function checkSpecializedSignatureDeclaration(signatureDeclarationNode) { - if (!produceDiagnostics) { - return; - } - var signature = getSignatureFromDeclaration(signatureDeclarationNode); - if (!signature.hasStringLiterals) { - return; - } - if (ts.nodeIsPresent(signatureDeclarationNode.body)) { - error(signatureDeclarationNode, ts.Diagnostics.A_signature_with_an_implementation_cannot_use_a_string_literal_type); - return; - } - var signaturesToCheck; - if (!signatureDeclarationNode.name && signatureDeclarationNode.parent && signatureDeclarationNode.parent.kind === 215) { - ts.Debug.assert(signatureDeclarationNode.kind === 147 || signatureDeclarationNode.kind === 148); - var signatureKind = signatureDeclarationNode.kind === 147 ? 0 : 1; - var containingSymbol = getSymbolOfNode(signatureDeclarationNode.parent); - var containingType = getDeclaredTypeOfSymbol(containingSymbol); - signaturesToCheck = getSignaturesOfType(containingType, signatureKind); - } - else { - signaturesToCheck = getSignaturesOfSymbol(getSymbolOfNode(signatureDeclarationNode)); - } - for (var _i = 0, signaturesToCheck_1 = signaturesToCheck; _i < signaturesToCheck_1.length; _i++) { - var otherSignature = signaturesToCheck_1[_i]; - if (!otherSignature.hasStringLiterals && isSignatureAssignableTo(signature, otherSignature)) { - return; - } - } - error(signatureDeclarationNode, ts.Diagnostics.Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature); + return (node.flags & 8) && ts.isInAmbientContext(node); } function getEffectiveDeclarationFlags(n, flagsToCheck) { var flags = ts.getCombinedNodeFlags(n); - if (n.parent.kind !== 215 && - n.parent.kind !== 214 && - n.parent.kind !== 186 && + if (n.parent.kind !== 222 && + n.parent.kind !== 221 && + n.parent.kind !== 192 && ts.isInAmbientContext(n)) { - if (!(flags & 4)) { - flags |= 2; + if (!(flags & 2)) { + flags |= 1; } - flags |= 4; + flags |= 2; } return flags & flagsToCheck; } @@ -20100,36 +23245,36 @@ var ts; function checkFlagAgreementBetweenOverloads(overloads, implementation, flagsToCheck, someOverloadFlags, allOverloadFlags) { var someButNotAllOverloadFlags = someOverloadFlags ^ allOverloadFlags; if (someButNotAllOverloadFlags !== 0) { - var canonicalFlags = getEffectiveDeclarationFlags(getCanonicalOverload(overloads, implementation), flagsToCheck); + var canonicalFlags_1 = getEffectiveDeclarationFlags(getCanonicalOverload(overloads, implementation), flagsToCheck); ts.forEach(overloads, function (o) { - var deviation = getEffectiveDeclarationFlags(o, flagsToCheck) ^ canonicalFlags; - if (deviation & 2) { - error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_exported_or_not_exported); + var deviation = getEffectiveDeclarationFlags(o, flagsToCheck) ^ canonicalFlags_1; + if (deviation & 1) { + error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_exported_or_non_exported); } - else if (deviation & 4) { + else if (deviation & 2) { error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_ambient_or_non_ambient); } - else if (deviation & (16 | 32)) { - error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_public_private_or_protected); + else if (deviation & (8 | 16)) { + error(o.name || o, ts.Diagnostics.Overload_signatures_must_all_be_public_private_or_protected); } else if (deviation & 128) { - error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_abstract_or_not_abstract); + error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_abstract_or_non_abstract); } }); } } function checkQuestionTokenAgreementBetweenOverloads(overloads, implementation, someHaveQuestionToken, allHaveQuestionToken) { if (someHaveQuestionToken !== allHaveQuestionToken) { - var canonicalHasQuestionToken = ts.hasQuestionToken(getCanonicalOverload(overloads, implementation)); + var canonicalHasQuestionToken_1 = ts.hasQuestionToken(getCanonicalOverload(overloads, implementation)); ts.forEach(overloads, function (o) { - var deviation = ts.hasQuestionToken(o) !== canonicalHasQuestionToken; + var deviation = ts.hasQuestionToken(o) !== canonicalHasQuestionToken_1; if (deviation) { error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_optional_or_required); } }); } } - var flagsToCheck = 2 | 4 | 16 | 32 | 128; + var flagsToCheck = 1 | 2 | 8 | 16 | 128; var someNodeFlags = 0; var allNodeFlags = flagsToCheck; var someHaveQuestionToken = false; @@ -20153,14 +23298,16 @@ var ts; seen = c === node; } }); - if (subsequentNode) { + if (subsequentNode && subsequentNode.pos === node.end) { if (subsequentNode.kind === node.kind) { var errorNode_1 = subsequentNode.name || subsequentNode; if (node.name && subsequentNode.name && node.name.text === subsequentNode.name.text) { - ts.Debug.assert(node.kind === 143 || node.kind === 142); - ts.Debug.assert((node.flags & 64) !== (subsequentNode.flags & 64)); - var diagnostic = node.flags & 64 ? ts.Diagnostics.Function_overload_must_be_static : ts.Diagnostics.Function_overload_must_not_be_static; - error(errorNode_1, diagnostic); + var reportError = (node.kind === 147 || node.kind === 146) && + (node.flags & 32) !== (subsequentNode.flags & 32); + if (reportError) { + var diagnostic = node.flags & 32 ? ts.Diagnostics.Function_overload_must_be_static : ts.Diagnostics.Function_overload_must_not_be_static; + error(errorNode_1, diagnostic); + } return; } else if (ts.nodeIsPresent(subsequentNode.body)) { @@ -20189,11 +23336,11 @@ var ts; var current = declarations_4[_i]; var node = current; var inAmbientContext = ts.isInAmbientContext(node); - var inAmbientContextOrInterface = node.parent.kind === 215 || node.parent.kind === 155 || inAmbientContext; + var inAmbientContextOrInterface = node.parent.kind === 222 || node.parent.kind === 159 || inAmbientContext; if (inAmbientContextOrInterface) { previousDeclaration = undefined; } - if (node.kind === 213 || node.kind === 143 || node.kind === 142 || node.kind === 144) { + if (node.kind === 220 || node.kind === 147 || node.kind === 146 || node.kind === 148) { var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; allNodeFlags &= currentNodeFlags; @@ -20235,7 +23382,7 @@ var ts; }); } if (!isExportSymbolInsideModule && lastSeenNonAmbientDeclaration && !lastSeenNonAmbientDeclaration.body && - !(lastSeenNonAmbientDeclaration.flags & 128)) { + !(lastSeenNonAmbientDeclaration.flags & 128) && !lastSeenNonAmbientDeclaration.questionToken) { reportImplementationExpectedError(lastSeenNonAmbientDeclaration); } if (hasOverloads) { @@ -20244,13 +23391,11 @@ var ts; if (bodyDeclaration) { var signatures = getSignaturesOfSymbol(symbol); var bodySignature = getSignatureFromDeclaration(bodyDeclaration); - if (!bodySignature.hasStringLiterals) { - for (var _a = 0, signatures_3 = signatures; _a < signatures_3.length; _a++) { - var signature = signatures_3[_a]; - if (!signature.hasStringLiterals && !isSignatureAssignableTo(bodySignature, signature)) { - error(signature.declaration, ts.Diagnostics.Overload_signature_is_not_compatible_with_function_implementation); - break; - } + for (var _a = 0, signatures_3 = signatures; _a < signatures_3.length; _a++) { + var signature = signatures_3[_a]; + if (!isImplementationCompatibleWithOverload(bodySignature, signature)) { + error(signature.declaration, ts.Diagnostics.Overload_signature_is_not_compatible_with_function_implementation); + break; } } } @@ -20276,8 +23421,8 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var d = _a[_i]; var declarationSpaces = getDeclarationSpaces(d); - var effectiveDeclarationFlags = getEffectiveDeclarationFlags(d, 2 | 512); - if (effectiveDeclarationFlags & 2) { + var effectiveDeclarationFlags = getEffectiveDeclarationFlags(d, 1 | 512); + if (effectiveDeclarationFlags & 1) { if (effectiveDeclarationFlags & 512) { defaultExportedDeclarationSpaces |= declarationSpaces; } @@ -20306,20 +23451,20 @@ var ts; } function getDeclarationSpaces(d) { switch (d.kind) { - case 215: + case 222: return 2097152; - case 218: - return d.name.kind === 9 || ts.getModuleInstanceState(d) !== 0 + case 225: + return ts.isAmbientModule(d) || ts.getModuleInstanceState(d) !== 0 ? 4194304 | 1048576 : 4194304; - case 214: - case 217: - return 2097152 | 1048576; case 221: - var result = 0; + case 224: + return 2097152 | 1048576; + case 229: + var result_1 = 0; var target = resolveAlias(getSymbolOfNode(d)); - ts.forEach(target.declarations, function (d) { result |= getDeclarationSpaces(d); }); - return result; + ts.forEach(target.declarations, function (d) { result_1 |= getDeclarationSpaces(d); }); + return result_1; default: return 1048576; } @@ -20357,7 +23502,7 @@ var ts; if (thenSignatures.length === 0) { return undefined; } - var onfulfilledParameterType = getUnionType(ts.map(thenSignatures, getTypeOfFirstParameterOfSignature)); + var onfulfilledParameterType = getTypeWithFacts(getUnionType(ts.map(thenSignatures, getTypeOfFirstParameterOfSignature)), 131072); if (onfulfilledParameterType.flags & 1) { return undefined; } @@ -20391,7 +23536,7 @@ var ts; return checkNonThenableType(type, location, message); } else { - if (type.id === promisedType.id || awaitedTypeStack.indexOf(promisedType.id) >= 0) { + if (type.id === promisedType.id || ts.indexOf(awaitedTypeStack, promisedType.id) >= 0) { if (location) { error(location, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method, symbolToString(type.symbol)); } @@ -20405,7 +23550,23 @@ var ts; } } } + function checkCorrectPromiseType(returnType, location) { + if (returnType === unknownType) { + return unknownType; + } + var globalPromiseType = getGlobalPromiseType(); + if (globalPromiseType === emptyGenericType + || globalPromiseType === getTargetType(returnType)) { + return checkAwaitedType(returnType, location, ts.Diagnostics.An_async_function_or_method_must_have_a_valid_awaitable_return_type); + } + error(location, ts.Diagnostics.The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type); + return unknownType; + } function checkAsyncFunctionReturnType(node) { + if (languageVersion >= 2) { + var returnType = getTypeFromTypeNode(node.type); + return checkCorrectPromiseType(returnType, node.type); + } var globalPromiseConstructorLikeType = getGlobalPromiseConstructorLikeType(); if (globalPromiseConstructorLikeType === emptyObjectType) { return unknownType; @@ -20422,15 +23583,16 @@ var ts; error(node, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type, typeName); return unknownType; } + checkReturnTypeAnnotationAsExpression(node); var promiseConstructorType = getTypeOfSymbol(promiseConstructor); if (!checkTypeAssignableTo(promiseConstructorType, globalPromiseConstructorLikeType, node, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type)) { return unknownType; } var promiseName = ts.getEntityNameFromTypeNode(node.type); - var root = getFirstIdentifier(promiseName); - var rootSymbol = getSymbol(node.locals, root.text, 107455); + var promiseNameOrNamespaceRoot = getFirstIdentifier(promiseName); + var rootSymbol = getSymbol(node.locals, promiseNameOrNamespaceRoot.text, 107455); if (rootSymbol) { - error(rootSymbol.valueDeclaration, ts.Diagnostics.Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions, root.text, getFullyQualifiedName(promiseConstructor)); + error(rootSymbol.valueDeclaration, ts.Diagnostics.Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions, promiseNameOrNamespaceRoot.text, getFullyQualifiedName(promiseConstructor)); return unknownType; } return checkAwaitedType(promiseType, node, ts.Diagnostics.An_async_function_or_method_must_have_a_valid_awaitable_return_type); @@ -20445,22 +23607,22 @@ var ts; var headMessage = getDiagnosticHeadMessageForDecoratorResolution(node); var errorInfo; switch (node.parent.kind) { - case 214: + case 221: var classSymbol = getSymbolOfNode(node.parent); var classConstructorType = getTypeOfSymbol(classSymbol); expectedReturnType = getUnionType([classConstructorType, voidType]); break; - case 138: + case 142: expectedReturnType = voidType; errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any); break; - case 141: + case 145: expectedReturnType = voidType; errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.The_return_type_of_a_property_decorator_function_must_be_either_void_or_any); break; - case 143: - case 145: - case 146: + case 147: + case 149: + case 150: var methodType = getTypeOfNode(node.parent); var descriptorType = createTypedPropertyDescriptorType(methodType); expectedReturnType = getUnionType([descriptorType, voidType]); @@ -20469,9 +23631,9 @@ var ts; checkTypeAssignableTo(returnType, expectedReturnType, node, headMessage, errorInfo); } function checkTypeNodeAsExpression(node) { - if (node && node.kind === 151) { + if (node && node.kind === 155) { var root = getFirstIdentifier(node.typeName); - var meaning = root.parent.kind === 151 ? 793056 : 1536; + var meaning = root.parent.kind === 155 ? 793056 : 1536; var rootSymbol = resolveName(root, root.text, meaning | 8388608, undefined, undefined); if (rootSymbol && rootSymbol.flags & 8388608) { var aliasTarget = resolveAlias(rootSymbol); @@ -20482,23 +23644,10 @@ var ts; } } function checkTypeAnnotationAsExpression(node) { - switch (node.kind) { - case 141: - checkTypeNodeAsExpression(node.type); - break; - case 138: - checkTypeNodeAsExpression(node.type); - break; - case 143: - checkTypeNodeAsExpression(node.type); - break; - case 145: - checkTypeNodeAsExpression(node.type); - break; - case 146: - checkTypeNodeAsExpression(ts.getSetAccessorTypeAnnotationNode(node)); - break; - } + checkTypeNodeAsExpression(node.type); + } + function checkReturnTypeAnnotationAsExpression(node) { + checkTypeNodeAsExpression(node.type); } function checkParameterTypeAnnotationsAsExpressions(node) { for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) { @@ -20514,54 +23663,51 @@ var ts; return; } if (!compilerOptions.experimentalDecorators) { - error(node, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Specify_experimentalDecorators_to_remove_this_warning); + error(node, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning); } if (compilerOptions.emitDecoratorMetadata) { switch (node.kind) { - case 214: + case 221: var constructor = ts.getFirstConstructorWithBody(node); if (constructor) { checkParameterTypeAnnotationsAsExpressions(constructor); } break; - case 143: + case 147: + case 149: + case 150: checkParameterTypeAnnotationsAsExpressions(node); - case 146: + checkReturnTypeAnnotationAsExpression(node); + break; case 145: - case 141: - case 138: + case 142: checkTypeAnnotationAsExpression(node); break; } } - emitDecorate = true; - if (node.kind === 138) { - emitParam = true; - } ts.forEach(node.decorators, checkDecorator); } function checkFunctionDeclaration(node) { if (produceDiagnostics) { - checkFunctionLikeDeclaration(node) || checkGrammarForGenerator(node); + checkFunctionOrMethodDeclaration(node) || checkGrammarForGenerator(node); checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); + checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); } } - function checkFunctionLikeDeclaration(node) { + function checkFunctionOrMethodDeclaration(node) { checkDecorators(node); checkSignatureDeclaration(node); var isAsync = ts.isAsyncFunctionLike(node); - if (isAsync) { - emitAwaiter = true; - } - if (node.name && node.name.kind === 136) { + if (node.name && node.name.kind === 140) { checkComputedPropertyName(node.name); } if (!ts.hasDynamicName(node)) { var symbol = getSymbolOfNode(node); var localSymbol = node.localSymbol || symbol; - var firstDeclaration = ts.getDeclarationOfKind(localSymbol, node.kind); + var firstDeclaration = ts.forEach(localSymbol.declarations, function (declaration) { return declaration.kind === node.kind && !ts.isSourceFileJavaScript(ts.getSourceFileOfNode(declaration)) ? + declaration : undefined; }); if (node === firstDeclaration) { checkFunctionOrConstructorSymbol(localSymbol); } @@ -20572,13 +23718,9 @@ var ts; } } checkSourceElement(node.body); - if (node.type && !isAccessor(node.kind) && !node.asteriskToken) { - var returnType = getTypeFromTypeNode(node.type); - var promisedType; - if (isAsync) { - promisedType = checkAsyncFunctionReturnType(node); - } - checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, isAsync ? promisedType : returnType); + if (!node.asteriskToken) { + var returnOrPromisedType = node.type && (isAsync ? checkAsyncFunctionReturnType(node) : getTypeFromTypeNode(node.type)); + checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnOrPromisedType); } if (produceDiagnostics && !node.type) { if (compilerOptions.noImplicitAny && ts.nodeIsMissing(node.body) && !isPrivateWithinAmbient(node)) { @@ -20590,16 +23732,13 @@ var ts; } } function checkBlock(node) { - if (node.kind === 192) { + if (node.kind === 199) { checkGrammarStatementInAmbientContext(node); } ts.forEach(node.statements, checkSourceElement); - if (ts.isFunctionBlock(node) || node.kind === 219) { - checkFunctionAndClassExpressionBodies(node); - } } function checkCollisionWithArgumentsInGeneratedCode(node) { - if (!ts.hasRestParameter(node) || ts.isInAmbientContext(node) || ts.nodeIsMissing(node.body)) { + if (!ts.hasDeclaredRestParameter(node) || ts.isInAmbientContext(node) || ts.nodeIsMissing(node.body)) { return; } ts.forEach(node.parameters, function (p) { @@ -20612,19 +23751,19 @@ var ts; if (!(identifier && identifier.text === name)) { return false; } - if (node.kind === 141 || - node.kind === 140 || - node.kind === 143 || - node.kind === 142 || - node.kind === 145 || - node.kind === 146) { + if (node.kind === 145 || + node.kind === 144 || + node.kind === 147 || + node.kind === 146 || + node.kind === 149 || + node.kind === 150) { return false; } if (ts.isInAmbientContext(node)) { return false; } var root = ts.getRootDeclaration(node); - if (root.kind === 138 && ts.nodeIsMissing(root.parent.body)) { + if (root.kind === 142 && ts.nodeIsMissing(root.parent.body)) { return false; } return true; @@ -20672,19 +23811,31 @@ var ts; if (!needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) { return; } - if (node.kind === 218 && ts.getModuleInstanceState(node) !== 1) { + if (node.kind === 225 && ts.getModuleInstanceState(node) !== 1) { return; } var parent = getDeclarationContainer(node); - if (parent.kind === 248 && ts.isExternalOrCommonJsModule(parent)) { + if (parent.kind === 256 && ts.isExternalOrCommonJsModule(parent)) { error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } } - function checkVarDeclaredNamesNotShadowed(node) { - if ((ts.getCombinedNodeFlags(node) & 24576) !== 0 || ts.isParameterDeclaration(node)) { + function checkCollisionWithGlobalPromiseInGeneratedCode(node, name) { + if (!needCollisionCheckForIdentifier(node, name, "Promise")) { return; } - if (node.kind === 211 && !node.initializer) { + if (node.kind === 225 && ts.getModuleInstanceState(node) !== 1) { + return; + } + var parent = getDeclarationContainer(node); + if (parent.kind === 256 && ts.isExternalOrCommonJsModule(parent) && parent.flags & 2097152) { + error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions, ts.declarationNameToString(name), ts.declarationNameToString(name)); + } + } + function checkVarDeclaredNamesNotShadowed(node) { + if ((ts.getCombinedNodeFlags(node) & 3072) !== 0 || ts.isParameterDeclaration(node)) { + return; + } + if (node.kind === 218 && !node.initializer) { return; } var symbol = getSymbolOfNode(node); @@ -20693,74 +23844,103 @@ var ts; if (localDeclarationSymbol && localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2) { - if (getDeclarationFlagsFromSymbol(localDeclarationSymbol) & 24576) { - var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 212); - var container = varDeclList.parent.kind === 193 && varDeclList.parent.parent + if (getDeclarationFlagsFromSymbol(localDeclarationSymbol) & 3072) { + var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 219); + var container = varDeclList.parent.kind === 200 && varDeclList.parent.parent ? varDeclList.parent.parent : undefined; var namesShareScope = container && - (container.kind === 192 && ts.isFunctionLike(container.parent) || - container.kind === 219 || - container.kind === 218 || - container.kind === 248); + (container.kind === 199 && ts.isFunctionLike(container.parent) || + container.kind === 226 || + container.kind === 225 || + container.kind === 256); if (!namesShareScope) { - var name_15 = symbolToString(localDeclarationSymbol); - error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name_15, name_15); + var name_16 = symbolToString(localDeclarationSymbol); + error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name_16, name_16); } } } } } function checkParameterInitializer(node) { - if (ts.getRootDeclaration(node).kind !== 138) { + if (ts.getRootDeclaration(node).kind !== 142) { return; } var func = ts.getContainingFunction(node); visit(node.initializer); function visit(n) { - if (n.kind === 69) { - var referencedSymbol = getNodeLinks(n).resolvedSymbol; - if (referencedSymbol && referencedSymbol !== unknownSymbol && getSymbol(func.locals, referencedSymbol.name, 107455) === referencedSymbol) { - if (referencedSymbol.valueDeclaration.kind === 138) { - if (referencedSymbol.valueDeclaration === node) { - error(n, ts.Diagnostics.Parameter_0_cannot_be_referenced_in_its_initializer, ts.declarationNameToString(node.name)); + if (ts.isTypeNode(n) || ts.isDeclarationName(n)) { + return; + } + if (n.kind === 172) { + return visit(n.expression); + } + else if (n.kind === 69) { + var symbol = resolveName(n, n.text, 107455 | 8388608, undefined, undefined); + if (!symbol || symbol === unknownSymbol || !symbol.valueDeclaration) { + return; + } + if (symbol.valueDeclaration === node) { + error(n, ts.Diagnostics.Parameter_0_cannot_be_referenced_in_its_initializer, ts.declarationNameToString(node.name)); + return; + } + var enclosingContainer = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration); + if (enclosingContainer === func) { + if (symbol.valueDeclaration.kind === 142) { + if (symbol.valueDeclaration.pos < node.pos) { return; } - if (referencedSymbol.valueDeclaration.pos < node.pos) { - return; + var current = n; + while (current !== node.initializer) { + if (ts.isFunctionLike(current.parent)) { + return; + } + if (current.parent.kind === 145 && + !(current.parent.flags & 32) && + ts.isClassLike(current.parent.parent)) { + return; + } + current = current.parent; } } error(n, ts.Diagnostics.Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it, ts.declarationNameToString(node.name), ts.declarationNameToString(n)); } } else { - ts.forEachChild(n, visit); + return ts.forEachChild(n, visit); } } } function checkVariableLikeDeclaration(node) { checkDecorators(node); checkSourceElement(node.type); - if (node.name.kind === 136) { + if (node.name.kind === 140) { checkComputedPropertyName(node.name); if (node.initializer) { checkExpressionCached(node.initializer); } } - if (node.kind === 163) { - if (node.propertyName && node.propertyName.kind === 136) { + if (node.kind === 169) { + if (node.propertyName && node.propertyName.kind === 140) { checkComputedPropertyName(node.propertyName); } + var parent_11 = node.parent.parent; + var parentType = getTypeForBindingElementParent(parent_11); + var name_17 = node.propertyName || node.name; + var property = getPropertyOfType(parentType, getTextOfPropertyName(name_17)); + if (parent_11.initializer && property && getParentOfSymbol(property)) { + checkClassPropertyAccess(parent_11, parent_11.initializer, parentType, property); + } } if (ts.isBindingPattern(node.name)) { ts.forEach(node.name.elements, checkSourceElement); } - if (node.initializer && ts.getRootDeclaration(node).kind === 138 && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { + if (node.initializer && ts.getRootDeclaration(node).kind === 142 && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { error(node, ts.Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation); return; } if (ts.isBindingPattern(node.name)) { - if (node.initializer) { + if (node.initializer && node.parent.parent.kind !== 207) { checkTypeAssignableTo(checkExpressionCached(node.initializer), getWidenedTypeForVariableLikeDeclaration(node), node, undefined); checkParameterInitializer(node); } @@ -20769,7 +23949,7 @@ var ts; var symbol = getSymbolOfNode(node); var type = getTypeOfVariableOrParameterOrProperty(symbol); if (node === symbol.valueDeclaration) { - if (node.initializer) { + if (node.initializer && node.parent.parent.kind !== 207) { checkTypeAssignableTo(checkExpressionCached(node.initializer), type, node, undefined); checkParameterInitializer(node); } @@ -20783,14 +23963,15 @@ var ts; checkTypeAssignableTo(checkExpressionCached(node.initializer), declarationType, node, undefined); } } - if (node.kind !== 141 && node.kind !== 140) { + if (node.kind !== 145 && node.kind !== 144) { checkExportsOnMergedDeclarations(node); - if (node.kind === 211 || node.kind === 163) { + if (node.kind === 218 || node.kind === 169) { checkVarDeclaredNamesNotShadowed(node); } checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); + checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); } } function checkVariableDeclaration(node) { @@ -20806,7 +23987,7 @@ var ts; ts.forEach(node.declarationList.declarations, checkSourceElement); } function checkGrammarDisallowedModifiersOnObjectLiteralExpressionMethod(node) { - if (node.modifiers && node.parent.kind === 165) { + if (node.modifiers && node.parent.kind === 171) { if (ts.isAsyncFunctionLike(node)) { if (node.modifiers.length > 1) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); @@ -20825,7 +24006,7 @@ var ts; checkGrammarStatementInAmbientContext(node); checkExpression(node.expression); checkSourceElement(node.thenStatement); - if (node.thenStatement.kind === 194) { + if (node.thenStatement.kind === 201) { error(node.thenStatement, ts.Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement); } checkSourceElement(node.elseStatement); @@ -20842,12 +24023,12 @@ var ts; } function checkForStatement(node) { if (!checkGrammarStatementInAmbientContext(node)) { - if (node.initializer && node.initializer.kind === 212) { + if (node.initializer && node.initializer.kind === 219) { checkGrammarVariableDeclarationList(node.initializer); } } if (node.initializer) { - if (node.initializer.kind === 212) { + if (node.initializer.kind === 219) { ts.forEach(node.initializer.declarations, checkVariableDeclaration); } else { @@ -20862,18 +24043,18 @@ var ts; } function checkForOfStatement(node) { checkGrammarForInOrForOfStatement(node); - if (node.initializer.kind === 212) { + if (node.initializer.kind === 219) { checkForInOrForOfVariableDeclaration(node); } else { var varExpr = node.initializer; var iteratedType = checkRightHandSideOfForOf(node.expression); - if (varExpr.kind === 164 || varExpr.kind === 165) { + if (varExpr.kind === 170 || varExpr.kind === 171) { checkDestructuringAssignment(varExpr, iteratedType || unknownType); } else { var leftType = checkExpression(varExpr); - checkReferenceExpression(varExpr, ts.Diagnostics.Invalid_left_hand_side_in_for_of_statement, ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_be_a_previously_defined_constant); + checkReferenceExpression(varExpr, ts.Diagnostics.Invalid_left_hand_side_in_for_of_statement, ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_be_a_constant_or_a_read_only_property); if (iteratedType) { checkTypeAssignableTo(iteratedType, leftType, varExpr, undefined); } @@ -20883,7 +24064,7 @@ var ts; } function checkForInStatement(node) { checkGrammarForInOrForOfStatement(node); - if (node.initializer.kind === 212) { + if (node.initializer.kind === 219) { var variable = node.initializer.declarations[0]; if (variable && ts.isBindingPattern(variable.name)) { error(variable.name, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); @@ -20893,17 +24074,17 @@ var ts; else { var varExpr = node.initializer; var leftType = checkExpression(varExpr); - if (varExpr.kind === 164 || varExpr.kind === 165) { + if (varExpr.kind === 170 || varExpr.kind === 171) { error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); } else if (!isTypeAnyOrAllConstituentTypesHaveKind(leftType, 258)) { error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any); } else { - checkReferenceExpression(varExpr, ts.Diagnostics.Invalid_left_hand_side_in_for_in_statement, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_previously_defined_constant); + checkReferenceExpression(varExpr, ts.Diagnostics.Invalid_left_hand_side_in_for_in_statement, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_constant_or_a_read_only_property); } } - var rightType = checkExpression(node.expression); + var rightType = checkNonNullExpression(node.expression); if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 80896 | 512)) { error(node.expression, ts.Diagnostics.The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter); } @@ -20917,7 +24098,7 @@ var ts; } } function checkRightHandSideOfForOf(rhsExpression) { - var expressionType = getTypeOfExpression(rhsExpression); + var expressionType = checkNonNullExpression(rhsExpression); return checkIteratedTypeOrElementType(expressionType, rhsExpression, true); } function checkIteratedTypeOrElementType(inputType, errorNode, allowStringInput) { @@ -20936,7 +24117,9 @@ var ts; return indexType; } } - error(errorNode, ts.Diagnostics.Type_0_is_not_an_array_type, typeToString(inputType)); + if (errorNode) { + error(errorNode, ts.Diagnostics.Type_0_is_not_an_array_type, typeToString(inputType)); + } return unknownType; } function checkElementTypeOfIterable(iterable, errorNode) { @@ -20952,7 +24135,7 @@ var ts; } var typeAsIterable = type; if (!typeAsIterable.iterableElementType) { - if ((type.flags & 4096) && type.target === globalIterableType) { + if ((type.flags & 4096) && type.target === getGlobalIterableType()) { typeAsIterable.iterableElementType = type.typeArguments[0]; } else { @@ -20978,7 +24161,7 @@ var ts; } var typeAsIterator = type; if (!typeAsIterator.iteratorElementType) { - if ((type.flags & 4096) && type.target === globalIteratorType) { + if ((type.flags & 4096) && type.target === getGlobalIteratorType()) { typeAsIterator.iteratorElementType = type.typeArguments[0]; } else { @@ -21013,7 +24196,7 @@ var ts; if (isTypeAny(type)) { return undefined; } - if ((type.flags & 4096) && type.target === globalIterableIteratorType) { + if ((type.flags & 4096) && type.target === getGlobalIterableIteratorType()) { return type.typeArguments[0]; } return getElementTypeOfIterable(type, undefined) || @@ -21021,7 +24204,13 @@ var ts; } function checkElementTypeOfArrayOrString(arrayOrStringType, errorNode) { ts.Debug.assert(languageVersion < 2); - var arrayType = removeTypesFromUnionType(arrayOrStringType, 258, true, true); + var arrayType = arrayOrStringType; + if (arrayOrStringType.flags & 16384) { + arrayType = getUnionType(ts.filter(arrayOrStringType.types, function (t) { return !(t.flags & 258); })); + } + else if (arrayOrStringType.flags & 258) { + arrayType = neverType; + } var hasStringConstituent = arrayOrStringType !== arrayType; var reportedError = false; if (hasStringConstituent) { @@ -21029,7 +24218,7 @@ var ts; error(errorNode, ts.Diagnostics.Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher); reportedError = true; } - if (arrayType === emptyObjectType) { + if (arrayType === neverType) { return stringType; } } @@ -21054,8 +24243,12 @@ var ts; function checkBreakOrContinueStatement(node) { checkGrammarStatementInAmbientContext(node) || checkGrammarBreakOrContinueStatement(node); } - function isGetAccessorWithAnnotatatedSetAccessor(node) { - return !!(node.kind === 145 && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 146))); + function isGetAccessorWithAnnotatedSetAccessor(node) { + return !!(node.kind === 149 && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 150))); + } + function isUnwrappedReturnTypeVoidOrAny(func, returnType) { + var unwrappedReturnType = ts.isAsyncFunctionLike(func) ? getPromisedType(returnType) : returnType; + return maybeTypeOfKind(unwrappedReturnType, 16 | 1); } function checkReturnStatement(node) { if (!checkGrammarStatementInAmbientContext(node)) { @@ -21064,41 +24257,46 @@ var ts; grammarErrorOnFirstToken(node, ts.Diagnostics.A_return_statement_can_only_be_used_within_a_function_body); } } - if (node.expression) { - var func = ts.getContainingFunction(node); - if (func) { - var signature = getSignatureFromDeclaration(func); - var returnType = getReturnTypeOfSignature(signature); - var exprType = checkExpressionCached(node.expression); + var func = ts.getContainingFunction(node); + if (func) { + var signature = getSignatureFromDeclaration(func); + var returnType = getReturnTypeOfSignature(signature); + if (strictNullChecks || node.expression || returnType === neverType) { + var exprType = node.expression ? checkExpressionCached(node.expression) : undefinedType; if (func.asteriskToken) { return; } - if (func.kind === 146) { - error(node.expression, ts.Diagnostics.Setters_cannot_return_a_value); + if (func.kind === 150) { + if (node.expression) { + error(node.expression, ts.Diagnostics.Setters_cannot_return_a_value); + } } - else if (func.kind === 144) { - if (!checkTypeAssignableTo(exprType, returnType, node.expression)) { + else if (func.kind === 148) { + if (node.expression && !checkTypeAssignableTo(exprType, returnType, node.expression)) { error(node.expression, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); } } - else if (func.type || isGetAccessorWithAnnotatatedSetAccessor(func) || signature.typePredicate) { + else if (func.type || isGetAccessorWithAnnotatedSetAccessor(func)) { if (ts.isAsyncFunctionLike(func)) { var promisedType = getPromisedType(returnType); - var awaitedType = checkAwaitedType(exprType, node.expression, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member); + var awaitedType = checkAwaitedType(exprType, node.expression || node, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member); if (promisedType) { - checkTypeAssignableTo(awaitedType, promisedType, node.expression); + checkTypeAssignableTo(awaitedType, promisedType, node.expression || node); } } else { - checkTypeAssignableTo(exprType, returnType, node.expression); + checkTypeAssignableTo(exprType, returnType, node.expression || node); } } } + else if (func.kind !== 148 && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(func, returnType)) { + error(node, ts.Diagnostics.Not_all_code_paths_return_a_value); + } } } function checkWithStatement(node) { if (!checkGrammarStatementInAmbientContext(node)) { - if (node.parserContextFlags & 8) { + if (node.flags & 33554432) { grammarErrorOnFirstToken(node, ts.Diagnostics.with_statements_are_not_allowed_in_an_async_function_block); } } @@ -21110,9 +24308,8 @@ var ts; var firstDefaultClause; var hasDuplicateDefaultClause = false; var expressionType = checkExpression(node.expression); - var expressionTypeIsStringLike = someConstituentTypeHasKind(expressionType, 258); ts.forEach(node.caseBlock.clauses, function (clause) { - if (clause.kind === 242 && !hasDuplicateDefaultClause) { + if (clause.kind === 250 && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -21124,14 +24321,11 @@ var ts; hasDuplicateDefaultClause = true; } } - if (produceDiagnostics && clause.kind === 241) { + if (produceDiagnostics && clause.kind === 249) { var caseClause = clause; var caseType = checkExpression(caseClause.expression); - if (expressionTypeIsStringLike && someConstituentTypeHasKind(caseType, 258)) { - return; - } - if (!isTypeAssignableTo(expressionType, caseType)) { - checkTypeAssignableTo(caseType, expressionType, caseClause.expression, undefined); + if (!isTypeComparableTo(expressionType, caseType)) { + checkTypeComparableTo(caseType, expressionType, caseClause.expression, undefined); } } ts.forEach(clause.statements, checkSourceElement); @@ -21144,7 +24338,7 @@ var ts; if (ts.isFunctionLike(current)) { break; } - if (current.kind === 207 && current.label.text === node.label.text) { + if (current.kind === 214 && current.label.text === node.label.text) { var sourceFile = ts.getSourceFileOfNode(node); grammarErrorOnNode(node.label, ts.Diagnostics.Duplicate_label_0, ts.getTextOfNodeFromSourceText(sourceFile.text, node.label)); break; @@ -21211,7 +24405,7 @@ var ts; var classDeclaration = type.symbol.valueDeclaration; for (var _i = 0, _a = classDeclaration.members; _i < _a.length; _i++) { var member = _a[_i]; - if (!(member.flags & 64) && ts.hasDynamicName(member)) { + if (!(member.flags & 32) && ts.hasDynamicName(member)) { var propType = getTypeOfSymbol(member.symbol); checkIndexConstraintForProperty(member.symbol, propType, type, declaredStringIndexer, stringIndexType, 0); checkIndexConstraintForProperty(member.symbol, propType, type, declaredNumberIndexer, numberIndexType, 1); @@ -21238,7 +24432,7 @@ var ts; return; } var errorNode; - if (prop.valueDeclaration.name.kind === 136 || prop.parent === containingType.symbol) { + if (prop.valueDeclaration.name.kind === 140 || prop.parent === containingType.symbol) { errorNode = prop.valueDeclaration; } else if (indexDeclaration) { @@ -21282,10 +24476,31 @@ var ts; } } } + function checkTypeParameterListsIdentical(node, symbol) { + if (symbol.declarations.length === 1) { + return; + } + var firstDecl; + for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { + var declaration = _a[_i]; + if (declaration.kind === 221 || declaration.kind === 222) { + if (!firstDecl) { + firstDecl = declaration; + } + else if (!areTypeParametersIdentical(firstDecl.typeParameters, node.typeParameters)) { + error(node.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_type_parameters, node.name.text); + } + } + } + } function checkClassExpression(node) { checkClassLikeDeclaration(node); + checkNodeDeferred(node); return getTypeOfSymbol(getSymbolOfNode(node)); } + function checkClassExpressionDeferred(node) { + ts.forEach(node.members, checkSourceElement); + } function checkClassDeclaration(node) { if (!node.name && !(node.flags & 512)) { grammarErrorOnFirstToken(node, ts.Diagnostics.A_class_declaration_without_the_default_modifier_must_have_a_name); @@ -21300,6 +24515,7 @@ var ts; checkTypeNameIsReserved(node.name, ts.Diagnostics.Class_name_cannot_be_0); checkCollisionWithCapturedThisVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); + checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); } checkTypeParameters(node.typeParameters); checkExportsOnMergedDeclarations(node); @@ -21307,13 +24523,14 @@ var ts; var type = getDeclaredTypeOfSymbol(symbol); var typeWithThis = getTypeWithThisArgument(type); var staticType = getTypeOfSymbol(symbol); + checkTypeParameterListsIdentical(node, symbol); var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { - emitExtends = emitExtends || !ts.isInAmbientContext(node); var baseTypes = getBaseTypes(type); if (baseTypes.length && produceDiagnostics) { - var baseType = baseTypes[0]; + var baseType_1 = baseTypes[0]; var staticBaseType = getBaseConstructorTypeOfClass(type); + checkBaseTypeAccessibility(staticBaseType, baseTypeNode); checkSourceElement(baseTypeNode.expression); if (baseTypeNode.typeArguments) { ts.forEach(baseTypeNode.typeArguments, checkSourceElement); @@ -21324,15 +24541,15 @@ var ts; } } } - checkTypeAssignableTo(typeWithThis, getTypeWithThisArgument(baseType, type.thisType), node.name || node, ts.Diagnostics.Class_0_incorrectly_extends_base_class_1); + checkTypeAssignableTo(typeWithThis, getTypeWithThisArgument(baseType_1, type.thisType), node.name || node, ts.Diagnostics.Class_0_incorrectly_extends_base_class_1); checkTypeAssignableTo(staticType, getTypeWithoutSignatures(staticBaseType), node.name || node, ts.Diagnostics.Class_static_side_0_incorrectly_extends_base_class_static_side_1); if (!(staticBaseType.symbol && staticBaseType.symbol.flags & 32)) { var constructors = getInstantiatedConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments); - if (ts.forEach(constructors, function (sig) { return getReturnTypeOfSignature(sig) !== baseType; })) { + if (ts.forEach(constructors, function (sig) { return getReturnTypeOfSignature(sig) !== baseType_1; })) { error(baseTypeNode.expression, ts.Diagnostics.Base_constructors_must_all_have_the_same_return_type); } } - checkKindsOfPropertyMemberOverrides(type, baseType); + checkKindsOfPropertyMemberOverrides(type, baseType_1); } } var implementedTypeNodes = ts.getClassImplementsHeritageClauseElements(node); @@ -21362,6 +24579,18 @@ var ts; checkTypeForDuplicateIndexSignatures(node); } } + function checkBaseTypeAccessibility(type, node) { + var signatures = getSignaturesOfType(type, 1); + if (signatures.length) { + var declaration = signatures[0].declaration; + if (declaration && declaration.flags & 8) { + var typeClassDeclaration = getClassLikeDeclarationOfSymbol(type.symbol); + if (!isNodeWithinClass(node, typeClassDeclaration)) { + error(node, ts.Diagnostics.Cannot_extend_a_class_0_Class_constructor_is_marked_as_private, node.expression.text); + } + } + } + } function getTargetSymbol(s) { return s.flags & 16777216 ? getSymbolLinks(s).target : s; } @@ -21383,7 +24612,7 @@ var ts; if (derived === base) { var derivedClassDecl = getClassLikeDeclarationOfSymbol(type.symbol); if (baseDeclarationFlags & 128 && (!derivedClassDecl || !(derivedClassDecl.flags & 128))) { - if (derivedClassDecl.kind === 186) { + if (derivedClassDecl.kind === 192) { error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType)); } else { @@ -21393,10 +24622,10 @@ var ts; } else { var derivedDeclarationFlags = getDeclarationFlagsFromSymbol(derived); - if ((baseDeclarationFlags & 16) || (derivedDeclarationFlags & 16)) { + if ((baseDeclarationFlags & 8) || (derivedDeclarationFlags & 8)) { continue; } - if ((baseDeclarationFlags & 64) !== (derivedDeclarationFlags & 64)) { + if ((baseDeclarationFlags & 32) !== (derivedDeclarationFlags & 32)) { continue; } if ((base.flags & derived.flags & 8192) || ((base.flags & 98308) && (derived.flags & 98308))) { @@ -21427,7 +24656,7 @@ var ts; } } function isAccessor(kind) { - return kind === 145 || kind === 146; + return kind === 149 || kind === 150; } function areTypeParametersIdentical(list1, list2) { if (!list1 && !list2) { @@ -21493,12 +24722,8 @@ var ts; checkTypeNameIsReserved(node.name, ts.Diagnostics.Interface_name_cannot_be_0); checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); - var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 215); - if (symbol.declarations.length > 1) { - if (node !== firstInterfaceDecl && !areTypeParametersIdentical(firstInterfaceDecl.typeParameters, node.typeParameters)) { - error(node.name, ts.Diagnostics.All_declarations_of_an_interface_must_have_identical_type_parameters); - } - } + checkTypeParameterListsIdentical(node, symbol); + var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 222); if (node === firstInterfaceDecl) { var type = getDeclaredTypeOfSymbol(symbol); var typeWithThis = getTypeWithThisArgument(type); @@ -21529,7 +24754,7 @@ var ts; } function computeEnumMemberValues(node) { var nodeLinks = getNodeLinks(node); - if (!(nodeLinks.flags & 8192)) { + if (!(nodeLinks.flags & 16384)) { var enumSymbol = getSymbolOfNode(node); var enumType = getDeclaredTypeOfSymbol(enumSymbol); var autoValue = 0; @@ -21558,10 +24783,11 @@ var ts; error(member.name, ts.Diagnostics.Enum_member_must_have_initializer); } if (autoValue !== undefined) { - getNodeLinks(member).enumMemberValue = autoValue++; + getNodeLinks(member).enumMemberValue = autoValue; + autoValue++; } } - nodeLinks.flags |= 8192; + nodeLinks.flags |= 16384; } function computeConstantValueForEnumMemberInitializer(initializer, enumType, enumIsConst, ambient) { var reportError = true; @@ -21590,7 +24816,7 @@ var ts; return value; function evalConstant(e) { switch (e.kind) { - case 179: + case 185: var value_1 = evalConstant(e.operand); if (value_1 === undefined) { return undefined; @@ -21601,7 +24827,7 @@ var ts; case 50: return ~value_1; } return undefined; - case 181: + case 187: var left = evalConstant(e.left); if (left === undefined) { return undefined; @@ -21626,22 +24852,22 @@ var ts; return undefined; case 8: return +e.text; - case 172: + case 178: return evalConstant(e.expression); case 69: - case 167: - case 166: + case 173: + case 172: var member = initializer.parent; var currentType = getTypeOfSymbol(getSymbolOfNode(member.parent)); var enumType_1; - var propertyName; + var propertyName = void 0; if (e.kind === 69) { enumType_1 = currentType; propertyName = e.text; } else { - var expression; - if (e.kind === 167) { + var expression = void 0; + if (e.kind === 173) { if (e.argumentExpression === undefined || e.argumentExpression.kind !== 9) { return undefined; @@ -21658,7 +24884,7 @@ var ts; if (current.kind === 69) { break; } - else if (current.kind === 166) { + else if (current.kind === 172) { current = current.expression; } else { @@ -21699,6 +24925,7 @@ var ts; checkTypeNameIsReserved(node.name, ts.Diagnostics.Enum_name_cannot_be_0); checkCollisionWithCapturedThisVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); + checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); checkExportsOnMergedDeclarations(node); computeEnumMemberValues(node); var enumIsConst = ts.isConst(node); @@ -21715,9 +24942,9 @@ var ts; } }); } - var seenEnumMissingInitialInitializer = false; + var seenEnumMissingInitialInitializer_1 = false; ts.forEach(enumSymbol.declarations, function (declaration) { - if (declaration.kind !== 217) { + if (declaration.kind !== 224) { return false; } var enumDeclaration = declaration; @@ -21726,11 +24953,11 @@ var ts; } var firstEnumMember = enumDeclaration.members[0]; if (!firstEnumMember.initializer) { - if (seenEnumMissingInitialInitializer) { + if (seenEnumMissingInitialInitializer_1) { error(firstEnumMember.name, ts.Diagnostics.In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element); } else { - seenEnumMissingInitialInitializer = true; + seenEnumMissingInitialInitializer_1 = true; } } }); @@ -21740,8 +24967,8 @@ var ts; var declarations = symbol.declarations; for (var _i = 0, declarations_5 = declarations; _i < declarations_5.length; _i++) { var declaration = declarations_5[_i]; - if ((declaration.kind === 214 || - (declaration.kind === 213 && ts.nodeIsPresent(declaration.body))) && + if ((declaration.kind === 221 || + (declaration.kind === 220 && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { return declaration; } @@ -21763,7 +24990,12 @@ var ts; } function checkModuleDeclaration(node) { if (produceDiagnostics) { - var isAmbientExternalModule = node.name.kind === 9; + var isGlobalAugmentation = ts.isGlobalScopeAugmentation(node); + var inAmbientContext = ts.isInAmbientContext(node); + if (isGlobalAugmentation && !inAmbientContext) { + error(node.name, ts.Diagnostics.Augmentations_for_the_global_scope_should_have_declare_modifier_unless_they_appear_in_already_ambient_context); + } + var isAmbientExternalModule = ts.isAmbientModule(node); var contextErrorMessage = isAmbientExternalModule ? ts.Diagnostics.An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file : ts.Diagnostics.A_namespace_declaration_is_only_allowed_in_a_namespace_or_module; @@ -21771,17 +25003,18 @@ var ts; return; } if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node)) { - if (!ts.isInAmbientContext(node) && node.name.kind === 9) { + if (!inAmbientContext && node.name.kind === 9) { grammarErrorOnNode(node.name, ts.Diagnostics.Only_ambient_modules_can_use_quoted_names); } } checkCollisionWithCapturedThisVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); + checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); if (symbol.flags & 512 && symbol.declarations.length > 1 - && !ts.isInAmbientContext(node) + && !inAmbientContext && ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums || compilerOptions.isolatedModules)) { var firstNonAmbientClassOrFunc = getFirstNonAmbientClassOrFunctionDeclaration(symbol); if (firstNonAmbientClassOrFunc) { @@ -21792,29 +25025,93 @@ var ts; error(node.name, ts.Diagnostics.A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged); } } - var mergedClass = ts.getDeclarationOfKind(symbol, 214); + var mergedClass = ts.getDeclarationOfKind(symbol, 221); if (mergedClass && inSameLexicalScope(node, mergedClass)) { getNodeLinks(node).flags |= 32768; } } if (isAmbientExternalModule) { - if (!isGlobalSourceFile(node.parent)) { - error(node.name, ts.Diagnostics.Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces); + if (ts.isExternalModuleAugmentation(node)) { + var checkBody = isGlobalAugmentation || (getSymbolOfNode(node).flags & 33554432); + if (checkBody) { + for (var _i = 0, _a = node.body.statements; _i < _a.length; _i++) { + var statement = _a[_i]; + checkModuleAugmentationElement(statement, isGlobalAugmentation); + } + } } - if (ts.isExternalModuleNameRelative(node.name.text)) { - error(node.name, ts.Diagnostics.Ambient_module_declaration_cannot_specify_relative_module_name); + else if (isGlobalSourceFile(node.parent)) { + if (isGlobalAugmentation) { + error(node.name, ts.Diagnostics.Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_declarations); + } + else if (ts.isExternalModuleNameRelative(node.name.text)) { + error(node.name, ts.Diagnostics.Ambient_module_declaration_cannot_specify_relative_module_name); + } + } + else { + if (isGlobalAugmentation) { + error(node.name, ts.Diagnostics.Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_declarations); + } + else { + error(node.name, ts.Diagnostics.Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces); + } } } } checkSourceElement(node.body); } + function checkModuleAugmentationElement(node, isGlobalAugmentation) { + switch (node.kind) { + case 200: + for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { + var decl = _a[_i]; + checkModuleAugmentationElement(decl, isGlobalAugmentation); + } + break; + case 235: + case 236: + grammarErrorOnFirstToken(node, ts.Diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations); + break; + case 229: + case 230: + grammarErrorOnFirstToken(node, ts.Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module); + break; + case 169: + case 218: + var name_18 = node.name; + if (ts.isBindingPattern(name_18)) { + for (var _b = 0, _c = name_18.elements; _b < _c.length; _b++) { + var el = _c[_b]; + checkModuleAugmentationElement(el, isGlobalAugmentation); + } + break; + } + case 221: + case 224: + case 220: + case 222: + case 225: + case 223: + if (isGlobalAugmentation) { + return; + } + var symbol = getSymbolOfNode(node); + if (symbol) { + var reportError = !(symbol.flags & 33554432); + if (!reportError) { + reportError = ts.isExternalModuleAugmentation(symbol.parent.declarations[0]); + } + } + break; + } + } function getFirstIdentifier(node) { while (true) { - if (node.kind === 135) { + if (node.kind === 139) { node = node.left; } - else if (node.kind === 166) { + else if (node.kind === 172) { node = node.expression; } else { @@ -21830,16 +25127,18 @@ var ts; error(moduleName, ts.Diagnostics.String_literal_expected); return false; } - var inAmbientExternalModule = node.parent.kind === 219 && node.parent.parent.name.kind === 9; - if (node.parent.kind !== 248 && !inAmbientExternalModule) { - error(moduleName, node.kind === 228 ? + var inAmbientExternalModule = node.parent.kind === 226 && ts.isAmbientModule(node.parent.parent); + if (node.parent.kind !== 256 && !inAmbientExternalModule) { + error(moduleName, node.kind === 236 ? ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace : ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module); return false; } if (inAmbientExternalModule && ts.isExternalModuleNameRelative(moduleName.text)) { - error(node, ts.Diagnostics.Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relative_module_name); - return false; + if (!isTopLevelInExternalModuleAugmentation(node)) { + error(node, ts.Diagnostics.Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relative_module_name); + return false; + } } return true; } @@ -21847,11 +25146,11 @@ var ts; var symbol = getSymbolOfNode(node); var target = resolveAlias(symbol); if (target !== unknownSymbol) { - var excludedMeanings = (symbol.flags & 107455 ? 107455 : 0) | + var excludedMeanings = (symbol.flags & (107455 | 1048576) ? 107455 : 0) | (symbol.flags & 793056 ? 793056 : 0) | (symbol.flags & 1536 ? 1536 : 0); if (target.flags & excludedMeanings) { - var message = node.kind === 230 ? + var message = node.kind === 238 ? ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0; error(node, message, symbolToString(symbol)); @@ -21861,13 +25160,14 @@ var ts; function checkImportBinding(node) { checkCollisionWithCapturedThisVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); + checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); checkAliasSymbol(node); } function checkImportDeclaration(node) { if (checkGrammarModuleElementContext(node, ts.Diagnostics.An_import_declaration_can_only_be_used_in_a_namespace_or_module)) { return; } - if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && (node.flags & 1022)) { + if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && (node.flags & 1023)) { grammarErrorOnFirstToken(node, ts.Diagnostics.An_import_declaration_cannot_have_modifiers); } if (checkExternalImportOrExportDeclaration(node)) { @@ -21877,7 +25177,7 @@ var ts; checkImportBinding(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 224) { + if (importClause.namedBindings.kind === 232) { checkImportBinding(importClause.namedBindings); } else { @@ -21894,7 +25194,7 @@ var ts; checkGrammarDecorators(node) || checkGrammarModifiers(node); if (ts.isInternalModuleImportEqualsDeclaration(node) || checkExternalImportOrExportDeclaration(node)) { checkImportBinding(node); - if (node.flags & 2) { + if (node.flags & 1) { markExportAsReferenced(node); } if (ts.isInternalModuleImportEqualsDeclaration(node)) { @@ -21912,7 +25212,7 @@ var ts; } } else { - if (modulekind === 5 && !ts.isInAmbientContext(node)) { + if (modulekind === ts.ModuleKind.ES6 && !ts.isInAmbientContext(node)) { grammarErrorOnNode(node, ts.Diagnostics.Import_assignment_cannot_be_used_when_targeting_ECMAScript_6_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead); } } @@ -21922,46 +25222,53 @@ var ts; if (checkGrammarModuleElementContext(node, ts.Diagnostics.An_export_declaration_can_only_be_used_in_a_module)) { return; } - if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && (node.flags & 1022)) { + if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && (node.flags & 1023)) { grammarErrorOnFirstToken(node, ts.Diagnostics.An_export_declaration_cannot_have_modifiers); } if (!node.moduleSpecifier || checkExternalImportOrExportDeclaration(node)) { if (node.exportClause) { ts.forEach(node.exportClause.elements, checkExportSpecifier); - var inAmbientExternalModule = node.parent.kind === 219 && node.parent.parent.name.kind === 9; - if (node.parent.kind !== 248 && !inAmbientExternalModule) { + var inAmbientExternalModule = node.parent.kind === 226 && ts.isAmbientModule(node.parent.parent); + if (node.parent.kind !== 256 && !inAmbientExternalModule) { error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace); } } else { var moduleSymbol = resolveExternalModuleName(node, node.moduleSpecifier); - if (moduleSymbol && moduleSymbol.exports["export="]) { + if (moduleSymbol && hasExportAssignmentSymbol(moduleSymbol)) { error(node.moduleSpecifier, ts.Diagnostics.Module_0_uses_export_and_cannot_be_used_with_export_Asterisk, symbolToString(moduleSymbol)); } } } } function checkGrammarModuleElementContext(node, errorMessage) { - if (node.parent.kind !== 248 && node.parent.kind !== 219 && node.parent.kind !== 218) { + if (node.parent.kind !== 256 && node.parent.kind !== 226 && node.parent.kind !== 225) { return grammarErrorOnFirstToken(node, errorMessage); } } function checkExportSpecifier(node) { checkAliasSymbol(node); if (!node.parent.parent.moduleSpecifier) { - markExportAsReferenced(node); + var exportedName = node.propertyName || node.name; + var symbol = resolveName(exportedName, exportedName.text, 107455 | 793056 | 1536 | 8388608, undefined, undefined); + if (symbol && (symbol === undefinedSymbol || isGlobalSourceFile(getDeclarationContainer(symbol.declarations[0])))) { + error(exportedName, ts.Diagnostics.Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module, exportedName.text); + } + else { + markExportAsReferenced(node); + } } } function checkExportAssignment(node) { if (checkGrammarModuleElementContext(node, ts.Diagnostics.An_export_assignment_can_only_be_used_in_a_module)) { return; } - var container = node.parent.kind === 248 ? node.parent : node.parent.parent; - if (container.kind === 218 && container.name.kind === 69) { + var container = node.parent.kind === 256 ? node.parent : node.parent.parent; + if (container.kind === 225 && !ts.isAmbientModule(container)) { error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); return; } - if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && (node.flags & 1022)) { + if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && (node.flags & 1023)) { grammarErrorOnFirstToken(node, ts.Diagnostics.An_export_assignment_cannot_have_modifiers); } if (node.expression.kind === 69) { @@ -21972,23 +25279,14 @@ var ts; } checkExternalModuleExports(container); if (node.isExportEquals && !ts.isInAmbientContext(node)) { - if (modulekind === 5) { + if (modulekind === ts.ModuleKind.ES6) { grammarErrorOnNode(node, ts.Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_6_modules_Consider_using_export_default_or_another_module_format_instead); } - else if (modulekind === 4) { + else if (modulekind === ts.ModuleKind.System) { grammarErrorOnNode(node, ts.Diagnostics.Export_assignment_is_not_supported_when_module_flag_is_system); } } } - function getModuleStatements(node) { - if (node.kind === 248) { - return node.statements; - } - if (node.kind === 218 && node.body.kind === 219) { - return node.body.statements; - } - return emptyArray; - } function hasExportedMembers(moduleSymbol) { for (var id in moduleSymbol.exports) { if (id !== "export=") { @@ -22004,14 +25302,36 @@ var ts; var exportEqualsSymbol = moduleSymbol.exports["export="]; if (exportEqualsSymbol && hasExportedMembers(moduleSymbol)) { var declaration = getDeclarationOfAliasSymbol(exportEqualsSymbol) || exportEqualsSymbol.valueDeclaration; - error(declaration, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements); + if (!isTopLevelInExternalModuleAugmentation(declaration)) { + error(declaration, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements); + } + } + var exports_2 = getExportsOfModule(moduleSymbol); + for (var id in exports_2) { + if (id === "__export") { + continue; + } + var _a = exports_2[id], declarations = _a.declarations, flags = _a.flags; + if (flags & (1536 | 64 | 384)) { + continue; + } + var exportedDeclarationsCount = ts.countWhere(declarations, isNotOverload); + if (flags & 524288 && exportedDeclarationsCount <= 2) { + continue; + } + if (exportedDeclarationsCount > 1) { + for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) { + var declaration = declarations_6[_i]; + if (isNotOverload(declaration)) { + diagnostics.add(ts.createDiagnosticForNode(declaration, ts.Diagnostics.Cannot_redeclare_exported_variable_0, id)); + } + } + } } links.exportsChecked = true; } - } - function checkTypePredicate(node) { - if (!isInLegalTypePredicatePosition(node)) { - error(node, ts.Diagnostics.A_type_predicate_is_only_allowed_in_return_type_position_for_functions_and_methods); + function isNotOverload(declaration) { + return declaration.kind !== 220 || !!declaration.body; } } function checkSourceElement(node) { @@ -22021,217 +25341,144 @@ var ts; var kind = node.kind; if (cancellationToken) { switch (kind) { - case 218: - case 214: - case 215: - case 213: + case 225: + case 221: + case 222: + case 220: cancellationToken.throwIfCancellationRequested(); } } switch (kind) { - case 137: - return checkTypeParameter(node); - case 138: - return checkParameter(node); case 141: - case 140: - return checkPropertyDeclaration(node); - case 152: - case 153: - case 147: - case 148: - return checkSignatureDeclaration(node); - case 149: - return checkSignatureDeclaration(node); - case 143: + return checkTypeParameter(node); case 142: - return checkMethodDeclaration(node); - case 144: - return checkConstructorDeclaration(node); + return checkParameter(node); case 145: - case 146: - return checkAccessorDeclaration(node); - case 151: - return checkTypeReferenceNode(node); - case 150: - return checkTypePredicate(node); - case 154: - return checkTypeQuery(node); - case 155: - return checkTypeLiteral(node); + case 144: + return checkPropertyDeclaration(node); case 156: - return checkArrayType(node); case 157: - return checkTupleType(node); + case 151: + case 152: + return checkSignatureDeclaration(node); + case 153: + return checkSignatureDeclaration(node); + case 147: + case 146: + return checkMethodDeclaration(node); + case 148: + return checkConstructorDeclaration(node); + case 149: + case 150: + return checkAccessorDeclaration(node); + case 155: + return checkTypeReferenceNode(node); + case 154: + return checkTypePredicate(node); case 158: + return checkTypeQuery(node); case 159: - return checkUnionOrIntersectionType(node); + return checkTypeLiteral(node); case 160: - return checkSourceElement(node.type); - case 213: - return checkFunctionDeclaration(node); - case 192: - case 219: - return checkBlock(node); - case 193: - return checkVariableStatement(node); - case 195: - return checkExpressionStatement(node); - case 196: - return checkIfStatement(node); - case 197: - return checkDoStatement(node); - case 198: - return checkWhileStatement(node); - case 199: - return checkForStatement(node); - case 200: - return checkForInStatement(node); - case 201: - return checkForOfStatement(node); - case 202: - case 203: - return checkBreakOrContinueStatement(node); - case 204: - return checkReturnStatement(node); - case 205: - return checkWithStatement(node); - case 206: - return checkSwitchStatement(node); - case 207: - return checkLabeledStatement(node); - case 208: - return checkThrowStatement(node); - case 209: - return checkTryStatement(node); - case 211: - return checkVariableDeclaration(node); + return checkArrayType(node); + case 161: + return checkTupleType(node); + case 162: case 163: - return checkBindingElement(node); - case 214: - return checkClassDeclaration(node); - case 215: - return checkInterfaceDeclaration(node); - case 216: - return checkTypeAliasDeclaration(node); - case 217: - return checkEnumDeclaration(node); - case 218: - return checkModuleDeclaration(node); - case 222: - return checkImportDeclaration(node); - case 221: - return checkImportEqualsDeclaration(node); - case 228: - return checkExportDeclaration(node); - case 227: - return checkExportAssignment(node); - case 194: - checkGrammarStatementInAmbientContext(node); - return; + return checkUnionOrIntersectionType(node); + case 164: + return checkSourceElement(node.type); + case 220: + return checkFunctionDeclaration(node); + case 199: + case 226: + return checkBlock(node); + case 200: + return checkVariableStatement(node); + case 202: + return checkExpressionStatement(node); + case 203: + return checkIfStatement(node); + case 204: + return checkDoStatement(node); + case 205: + return checkWhileStatement(node); + case 206: + return checkForStatement(node); + case 207: + return checkForInStatement(node); + case 208: + return checkForOfStatement(node); + case 209: case 210: + return checkBreakOrContinueStatement(node); + case 211: + return checkReturnStatement(node); + case 212: + return checkWithStatement(node); + case 213: + return checkSwitchStatement(node); + case 214: + return checkLabeledStatement(node); + case 215: + return checkThrowStatement(node); + case 216: + return checkTryStatement(node); + case 218: + return checkVariableDeclaration(node); + case 169: + return checkBindingElement(node); + case 221: + return checkClassDeclaration(node); + case 222: + return checkInterfaceDeclaration(node); + case 223: + return checkTypeAliasDeclaration(node); + case 224: + return checkEnumDeclaration(node); + case 225: + return checkModuleDeclaration(node); + case 230: + return checkImportDeclaration(node); + case 229: + return checkImportEqualsDeclaration(node); + case 236: + return checkExportDeclaration(node); + case 235: + return checkExportAssignment(node); + case 201: checkGrammarStatementInAmbientContext(node); return; - case 231: + case 217: + checkGrammarStatementInAmbientContext(node); + return; + case 239: return checkMissingDeclaration(node); } } - function checkFunctionAndClassExpressionBodies(node) { - switch (node.kind) { - case 173: - case 174: - ts.forEach(node.parameters, checkFunctionAndClassExpressionBodies); - checkFunctionExpressionOrObjectLiteralMethodBody(node); - break; - case 186: - ts.forEach(node.members, checkSourceElement); - ts.forEachChild(node, checkFunctionAndClassExpressionBodies); - break; - case 143: - case 142: - ts.forEach(node.decorators, checkFunctionAndClassExpressionBodies); - ts.forEach(node.parameters, checkFunctionAndClassExpressionBodies); - if (ts.isObjectLiteralMethod(node)) { - checkFunctionExpressionOrObjectLiteralMethodBody(node); - } - break; - case 144: - case 145: - case 146: - case 213: - ts.forEach(node.parameters, checkFunctionAndClassExpressionBodies); - break; - case 205: - checkFunctionAndClassExpressionBodies(node.expression); - break; - case 139: - case 138: - case 141: - case 140: - case 161: - case 162: - case 163: - case 164: - case 165: - case 245: - case 166: - case 167: - case 168: - case 169: - case 170: - case 183: - case 190: - case 171: - case 189: - case 172: - case 176: - case 177: - case 178: - case 175: - case 179: - case 180: - case 181: - case 182: - case 185: - case 184: - case 192: - case 219: - case 193: - case 195: - case 196: - case 197: - case 198: - case 199: - case 200: - case 201: - case 202: - case 203: - case 204: - case 206: - case 220: - case 241: - case 242: - case 207: - case 208: - case 209: - case 244: - case 211: - case 212: - case 214: - case 243: - case 188: - case 217: - case 247: - case 227: - case 248: - case 240: - case 233: - case 234: - case 238: - case 239: - case 235: - ts.forEachChild(node, checkFunctionAndClassExpressionBodies); - break; + function checkNodeDeferred(node) { + if (deferredNodes) { + deferredNodes.push(node); + } + } + function checkDeferredNodes() { + for (var _i = 0, deferredNodes_1 = deferredNodes; _i < deferredNodes_1.length; _i++) { + var node = deferredNodes_1[_i]; + switch (node.kind) { + case 179: + case 180: + case 147: + case 146: + checkFunctionExpressionOrObjectLiteralMethodDeferred(node); + break; + case 149: + case 150: + checkAccessorDeferred(node); + break; + case 192: + checkClassExpressionDeferred(node); + break; + } } } function checkSourceFile(node) { @@ -22248,12 +25495,11 @@ var ts; } } checkGrammarSourceFile(node); - emitExtends = false; - emitDecorate = false; - emitParam = false; potentialThisCollisions.length = 0; + deferredNodes = []; ts.forEach(node.statements, checkSourceElement); - checkFunctionAndClassExpressionBodies(node); + checkDeferredNodes(); + deferredNodes = undefined; if (ts.isExternalOrCommonJsModule(node)) { checkExternalModuleExports(node); } @@ -22261,21 +25507,6 @@ var ts; ts.forEach(potentialThisCollisions, checkIfThisIsCapturedInEnclosingScope); potentialThisCollisions.length = 0; } - if (emitExtends) { - links.flags |= 8; - } - if (emitDecorate) { - links.flags |= 16; - } - if (emitParam) { - links.flags |= 32; - } - if (emitAwaiter) { - links.flags |= 64; - } - if (emitGenerator || (emitAwaiter && languageVersion < 2)) { - links.flags |= 128; - } links.flags |= 1; } } @@ -22309,7 +25540,7 @@ var ts; function isInsideWithStatementBody(node) { if (node) { while (node.parent) { - if (node.parent.kind === 205 && node.parent.statement === node) { + if (node.parent.kind === 212 && node.parent.statement === node) { return true; } node = node.parent; @@ -22331,28 +25562,28 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 248: + case 256: if (!ts.isExternalOrCommonJsModule(location)) { break; } - case 218: + case 225: copySymbols(getSymbolOfNode(location).exports, meaning & 8914931); break; - case 217: + case 224: copySymbols(getSymbolOfNode(location).exports, meaning & 8); break; - case 186: + case 192: var className = location.name; if (className) { copySymbol(location.symbol, meaning); } - case 214: - case 215: - if (!(memberFlags & 64)) { + case 221: + case 222: + if (!(memberFlags & 32)) { copySymbols(getSymbolOfNode(location).members, meaning & 793056); } break; - case 173: + case 179: var funcName = location.name; if (funcName) { copySymbol(location.symbol, meaning); @@ -22391,36 +25622,50 @@ var ts; } function isTypeDeclaration(node) { switch (node.kind) { - case 137: - case 214: - case 215: - case 216: - case 217: + case 141: + case 221: + case 222: + case 223: + case 224: return true; } } function isTypeReferenceIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 135) { + while (node.parent && node.parent.kind === 139) { node = node.parent; } - return node.parent && node.parent.kind === 151; + return node.parent && node.parent.kind === 155; } function isHeritageClauseElementIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 166) { + while (node.parent && node.parent.kind === 172) { node = node.parent; } - return node.parent && node.parent.kind === 188; + return node.parent && node.parent.kind === 194; + } + function forEachEnclosingClass(node, callback) { + var result; + while (true) { + node = ts.getContainingClass(node); + if (!node) + break; + if (result = callback(node)) + break; + } + return result; + } + function isNodeWithinClass(node, classDeclaration) { + return !!forEachEnclosingClass(node, function (n) { return n === classDeclaration; }); } function getLeftSideOfImportEqualsOrExportAssignment(nodeOnRightSide) { - while (nodeOnRightSide.parent.kind === 135) { + while (nodeOnRightSide.parent.kind === 139) { nodeOnRightSide = nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 221) { + if (nodeOnRightSide.parent.kind === 229) { return nodeOnRightSide.parent.moduleReference === nodeOnRightSide && nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 227) { + if (nodeOnRightSide.parent.kind === 235) { return nodeOnRightSide.parent.expression === nodeOnRightSide && nodeOnRightSide.parent; } return undefined; @@ -22432,10 +25677,22 @@ var ts; if (ts.isDeclarationName(entityName)) { return getSymbolOfNode(entityName.parent); } - if (entityName.parent.kind === 227) { + if (ts.isInJavaScriptFile(entityName) && entityName.parent.kind === 172) { + var specialPropertyAssignmentKind = ts.getSpecialPropertyAssignmentKind(entityName.parent.parent); + switch (specialPropertyAssignmentKind) { + case 1: + case 3: + return getSymbolOfNode(entityName.parent); + case 4: + case 2: + return getSymbolOfNode(entityName.parent.parent); + default: + } + } + if (entityName.parent.kind === 235) { return resolveEntityName(entityName, 107455 | 793056 | 1536 | 8388608); } - if (entityName.kind !== 166) { + if (entityName.kind !== 172) { if (isInRightSideOfImportOrExportAssignment(entityName)) { return getSymbolOfPartOfRightHandSideOfImportEquals(entityName); } @@ -22445,7 +25702,7 @@ var ts; } if (isHeritageClauseElementIdentifier(entityName)) { var meaning = 0; - if (entityName.parent.kind === 188) { + if (entityName.parent.kind === 194) { meaning = 793056; if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) { meaning |= 107455; @@ -22457,27 +25714,25 @@ var ts; meaning |= 8388608; return resolveEntityName(entityName, meaning); } - else if ((entityName.parent.kind === 235) || - (entityName.parent.kind === 234) || - (entityName.parent.kind === 237)) { - return getJsxElementTagSymbol(entityName.parent); - } else if (ts.isExpression(entityName)) { if (ts.nodeIsMissing(entityName)) { return undefined; } if (entityName.kind === 69) { + if (ts.isJSXTagName(entityName) && isJsxIntrinsicIdentifier(entityName)) { + return getIntrinsicTagSymbol(entityName.parent); + } var meaning = 107455 | 8388608; return resolveEntityName(entityName, meaning); } - else if (entityName.kind === 166) { + else if (entityName.kind === 172) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkPropertyAccessExpression(entityName); } return getNodeLinks(entityName).resolvedSymbol; } - else if (entityName.kind === 135) { + else if (entityName.kind === 139) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkQualifiedName(entityName); @@ -22486,33 +25741,39 @@ var ts; } } else if (isTypeReferenceIdentifier(entityName)) { - var meaning = entityName.parent.kind === 151 ? 793056 : 1536; + var meaning = entityName.parent.kind === 155 ? 793056 : 1536; meaning |= 8388608; return resolveEntityName(entityName, meaning); } - else if (entityName.parent.kind === 238) { + else if (entityName.parent.kind === 246) { return getJsxAttributePropertySymbol(entityName.parent); } - if (entityName.parent.kind === 150) { + if (entityName.parent.kind === 154) { return resolveEntityName(entityName, 1); } return undefined; } function getSymbolAtLocation(node) { + if (node.kind === 256) { + return ts.isExternalModule(node) ? getMergedSymbol(node.symbol) : undefined; + } if (isInsideWithStatementBody(node)) { return undefined; } if (ts.isDeclarationName(node)) { return getSymbolOfNode(node.parent); } + else if (ts.isLiteralComputedPropertyDeclarationName(node)) { + return getSymbolOfNode(node.parent.parent); + } if (node.kind === 69) { if (isInRightSideOfImportOrExportAssignment(node)) { - return node.parent.kind === 227 + return node.parent.kind === 235 ? getSymbolOfEntityNameOrPropertyAccessExpression(node) : getSymbolOfPartOfRightHandSideOfImportEquals(node); } - else if (node.parent.kind === 163 && - node.parent.parent.kind === 161 && + else if (node.parent.kind === 169 && + node.parent.parent.kind === 167 && node === node.parent.propertyName) { var typeOfPattern = getTypeOfNode(node.parent.parent); var propertyDeclaration = typeOfPattern && getPropertyOfType(typeOfPattern, node.text); @@ -22523,28 +25784,30 @@ var ts; } switch (node.kind) { case 69: - case 166: - case 135: + case 172: + case 139: return getSymbolOfEntityNameOrPropertyAccessExpression(node); case 97: case 95: var type = ts.isExpression(node) ? checkExpression(node) : getTypeFromTypeNode(node); return type.symbol; + case 165: + return getTypeFromTypeNode(node).symbol; case 121: var constructorDeclaration = node.parent; - if (constructorDeclaration && constructorDeclaration.kind === 144) { + if (constructorDeclaration && constructorDeclaration.kind === 148) { return constructorDeclaration.parent.symbol; } return undefined; case 9: if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || - ((node.parent.kind === 222 || node.parent.kind === 228) && + ((node.parent.kind === 230 || node.parent.kind === 236) && node.parent.moduleSpecifier === node)) { return resolveExternalModuleName(node, node); } case 8: - if (node.parent.kind === 167 && node.parent.argumentExpression === node) { + if (node.parent.kind === 173 && node.parent.argumentExpression === node) { var objectType = checkExpression(node.parent.expression); if (objectType === unknownType) return undefined; @@ -22558,11 +25821,16 @@ var ts; return undefined; } function getShorthandAssignmentValueSymbol(location) { - if (location && location.kind === 246) { - return resolveEntityName(location.name, 107455); + if (location && location.kind === 254) { + return resolveEntityName(location.name, 107455 | 8388608); } return undefined; } + function getExportSpecifierLocalTargetSymbol(node) { + return node.parent.parent.moduleSpecifier ? + getExternalModuleMember(node.parent.parent, node) : + resolveEntityName(node.propertyName || node.name, 107455 | 793056 | 1536 | 8388608); + } function getTypeOfNode(node) { if (isInsideWithStatementBody(node)) { return unknownType; @@ -22602,6 +25870,29 @@ var ts; } return unknownType; } + function getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr) { + ts.Debug.assert(expr.kind === 171 || expr.kind === 170); + if (expr.parent.kind === 208) { + var iteratedType = checkRightHandSideOfForOf(expr.parent.expression); + return checkDestructuringAssignment(expr, iteratedType || unknownType); + } + if (expr.parent.kind === 187) { + var iteratedType = checkExpression(expr.parent.right); + return checkDestructuringAssignment(expr, iteratedType || unknownType); + } + if (expr.parent.kind === 253) { + var typeOfParentObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent.parent); + return checkObjectLiteralDestructuringPropertyAssignment(typeOfParentObjectLiteral || unknownType, expr.parent); + } + ts.Debug.assert(expr.parent.kind === 170); + var typeOfArrayLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent); + var elementType = checkIteratedTypeOrElementType(typeOfArrayLiteral || unknownType, expr.parent, false) || unknownType; + return checkArrayLiteralDestructuringElementAssignment(expr.parent, typeOfArrayLiteral, ts.indexOf(expr.parent.elements, expr), elementType || unknownType); + } + function getPropertySymbolOfDestructuringAssignment(location) { + var typeOfObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(location.parent.parent); + return typeOfObjectLiteral && getPropertyOfType(typeOfObjectLiteral, location.text); + } function getTypeOfExpression(expr) { if (ts.isRightSideOfQualifiedNameOrPropertyAccess(expr)) { expr = expr.parent; @@ -22610,7 +25901,7 @@ var ts; } function getParentTypeOfClassElement(node) { var classSymbol = getSymbolOfNode(node.parent); - return node.flags & 64 + return node.flags & 32 ? getTypeOfSymbol(classSymbol) : getDeclaredTypeOfSymbol(classSymbol); } @@ -22628,18 +25919,22 @@ var ts; } function getRootSymbols(symbol) { if (symbol.flags & 268435456) { - var symbols = []; - var name_16 = symbol.name; + var symbols_3 = []; + var name_19 = symbol.name; ts.forEach(getSymbolLinks(symbol).containingType.types, function (t) { - var symbol = getPropertyOfType(t, name_16); + var symbol = getPropertyOfType(t, name_19); if (symbol) { - symbols.push(symbol); + symbols_3.push(symbol); } }); - return symbols; + return symbols_3; } else if (symbol.flags & 67108864) { - var target = getSymbolLinks(symbol).target; + var target = void 0; + var next = symbol; + while (next = getSymbolLinks(next).target) { + target = next; + } if (target) { return [target]; } @@ -22649,6 +25944,25 @@ var ts; function isArgumentsLocalBinding(node) { return getReferencedValueSymbol(node) === argumentsSymbol; } + function moduleExportsSomeValue(moduleReferenceExpression) { + var moduleSymbol = resolveExternalModuleName(moduleReferenceExpression.parent, moduleReferenceExpression); + if (!moduleSymbol) { + return true; + } + var hasExportAssignment = hasExportAssignmentSymbol(moduleSymbol); + moduleSymbol = resolveExternalModuleSymbol(moduleSymbol); + var symbolLinks = getSymbolLinks(moduleSymbol); + if (symbolLinks.exportsSomeValue === undefined) { + symbolLinks.exportsSomeValue = hasExportAssignment + ? !!(moduleSymbol.flags & 107455) + : ts.forEachValue(getExportsOfModule(moduleSymbol), isValue); + } + return symbolLinks.exportsSomeValue; + function isValue(s) { + s = resolveSymbol(s); + return s && !!(s.flags & 107455); + } + } function getReferencedExportContainer(node) { var symbol = getReferencedValueSymbol(node); if (symbol) { @@ -22661,11 +25975,11 @@ var ts; } var parentSymbol = getParentOfSymbol(symbol); if (parentSymbol) { - if (parentSymbol.flags & 512 && parentSymbol.valueDeclaration.kind === 248) { + if (parentSymbol.flags & 512 && parentSymbol.valueDeclaration.kind === 256) { return parentSymbol.valueDeclaration; } for (var n = node.parent; n; n = n.parent) { - if ((n.kind === 218 || n.kind === 217) && getSymbolOfNode(n) === parentSymbol) { + if ((n.kind === 225 || n.kind === 224) && getSymbolOfNode(n) === parentSymbol) { return n; } } @@ -22676,54 +25990,56 @@ var ts; var symbol = getReferencedValueSymbol(node); return symbol && symbol.flags & 8388608 ? getDeclarationOfAliasSymbol(symbol) : undefined; } - function isStatementWithLocals(node) { - switch (node.kind) { - case 192: - case 220: - case 199: - case 200: - case 201: - return true; - } - return false; - } - function isNestedRedeclarationSymbol(symbol) { + function isSymbolOfDeclarationWithCollidingName(symbol) { if (symbol.flags & 418) { var links = getSymbolLinks(symbol); - if (links.isNestedRedeclaration === undefined) { + if (links.isDeclarationWithCollidingName === undefined) { var container = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration); - links.isNestedRedeclaration = isStatementWithLocals(container) && - !!resolveName(container.parent, symbol.name, 107455, undefined, undefined); + if (ts.isStatementWithLocals(container)) { + var nodeLinks_1 = getNodeLinks(symbol.valueDeclaration); + if (!!resolveName(container.parent, symbol.name, 107455, undefined, undefined)) { + links.isDeclarationWithCollidingName = true; + } + else if (nodeLinks_1.flags & 131072) { + var isDeclaredInLoop = nodeLinks_1.flags & 262144; + var inLoopInitializer = ts.isIterationStatement(container, false); + var inLoopBodyBlock = container.kind === 199 && ts.isIterationStatement(container.parent, false); + links.isDeclarationWithCollidingName = !ts.isBlockScopedContainerTopLevel(container) && (!isDeclaredInLoop || (!inLoopInitializer && !inLoopBodyBlock)); + } + else { + links.isDeclarationWithCollidingName = false; + } + } } - return links.isNestedRedeclaration; + return links.isDeclarationWithCollidingName; } return false; } - function getReferencedNestedRedeclaration(node) { + function getReferencedDeclarationWithCollidingName(node) { var symbol = getReferencedValueSymbol(node); - return symbol && isNestedRedeclarationSymbol(symbol) ? symbol.valueDeclaration : undefined; + return symbol && isSymbolOfDeclarationWithCollidingName(symbol) ? symbol.valueDeclaration : undefined; } - function isNestedRedeclaration(node) { - return isNestedRedeclarationSymbol(getSymbolOfNode(node)); + function isDeclarationWithCollidingName(node) { + return isSymbolOfDeclarationWithCollidingName(getSymbolOfNode(node)); } function isValueAliasDeclaration(node) { switch (node.kind) { - case 221: - case 223: - case 224: - case 226: - case 230: + case 229: + case 231: + case 232: + case 234: + case 238: return isAliasResolvedToValue(getSymbolOfNode(node)); - case 228: + case 236: var exportClause = node.exportClause; return exportClause && ts.forEach(exportClause.elements, isValueAliasDeclaration); - case 227: + case 235: return node.expression && node.expression.kind === 69 ? isAliasResolvedToValue(getSymbolOfNode(node)) : true; } return false; } function isTopLevelValueImportEqualsWithEntityName(node) { - if (node.parent.kind !== 248 || !ts.isInternalModuleImportEqualsDeclaration(node)) { + if (node.parent.kind !== 256 || !ts.isInternalModuleImportEqualsDeclaration(node)) { return false; } var isValue = isAliasResolvedToValue(getSymbolOfNode(node)); @@ -22731,12 +26047,10 @@ var ts; } function isAliasResolvedToValue(symbol) { var target = resolveAlias(symbol); - if (target === unknownSymbol && compilerOptions.isolatedModules) { + if (target === unknownSymbol) { return true; } - return target !== unknownSymbol && - target && - target.flags & 107455 && + return target.flags & 107455 && (compilerOptions.preserveConstEnums || !isConstEnumOrConstEnumOnlyModule(target)); } function isConstEnumOrConstEnumOnlyModule(s) { @@ -22771,7 +26085,7 @@ var ts; return getNodeLinks(node).enumMemberValue; } function getConstantValue(node) { - if (node.kind === 247) { + if (node.kind === 255) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; @@ -22802,22 +26116,22 @@ var ts; else if (type.flags & 1) { return ts.TypeReferenceSerializationKind.ObjectType; } - else if (allConstituentTypesHaveKind(type, 16)) { + else if (isTypeOfKind(type, 16)) { return ts.TypeReferenceSerializationKind.VoidType; } - else if (allConstituentTypesHaveKind(type, 8)) { + else if (isTypeOfKind(type, 8)) { return ts.TypeReferenceSerializationKind.BooleanType; } - else if (allConstituentTypesHaveKind(type, 132)) { + else if (isTypeOfKind(type, 132)) { return ts.TypeReferenceSerializationKind.NumberLikeType; } - else if (allConstituentTypesHaveKind(type, 258)) { + else if (isTypeOfKind(type, 258)) { return ts.TypeReferenceSerializationKind.StringLikeType; } - else if (allConstituentTypesHaveKind(type, 8192)) { + else if (isTypeOfKind(type, 8192)) { return ts.TypeReferenceSerializationKind.ArrayLikeType; } - else if (allConstituentTypesHaveKind(type, 16777216)) { + else if (isTypeOfKind(type, 16777216)) { return ts.TypeReferenceSerializationKind.ESSymbolType; } else if (isFunctionType(type)) { @@ -22842,9 +26156,15 @@ var ts; getSymbolDisplayBuilder().buildTypeDisplay(getReturnTypeOfSignature(signature), writer, enclosingDeclaration, flags); } function writeTypeOfExpression(expr, enclosingDeclaration, flags, writer) { - var type = getTypeOfExpression(expr); + var type = getWidenedType(getTypeOfExpression(expr)); getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags); } + function writeBaseConstructorTypeOfClass(node, enclosingDeclaration, flags, writer) { + var classType = getDeclaredTypeOfSymbol(getSymbolOfNode(node)); + resolveBaseTypesOfClass(classType); + var baseType = classType.resolvedBaseTypes.length ? classType.resolvedBaseTypes[0] : unknownType; + getSymbolDisplayBuilder().buildTypeDisplay(baseType, writer, enclosingDeclaration, flags); + } function hasGlobalName(name) { return ts.hasProperty(globals, name); } @@ -22857,23 +26177,28 @@ var ts; var symbol = getReferencedValueSymbol(reference); return symbol && getExportSymbolOfValueSymbolIfExported(symbol).valueDeclaration; } - function instantiateSingleCallFunctionType(functionType, typeArguments) { - if (functionType === unknownType) { - return unknownType; - } - var signature = getSingleCallSignature(functionType); - if (!signature) { - return unknownType; - } - var instantiatedSignature = getSignatureInstantiation(signature, typeArguments); - return getOrCreateTypeFromSignature(instantiatedSignature); - } function createResolver() { + var resolvedTypeReferenceDirectives = host.getResolvedTypeReferenceDirectives(); + var fileToDirective; + if (resolvedTypeReferenceDirectives) { + fileToDirective = ts.createFileMap(); + for (var key in resolvedTypeReferenceDirectives) { + if (!ts.hasProperty(resolvedTypeReferenceDirectives, key)) { + continue; + } + var resolvedDirective = resolvedTypeReferenceDirectives[key]; + if (!resolvedDirective) { + continue; + } + var file = host.getSourceFile(resolvedDirective.resolvedFileName); + fileToDirective.set(file.path, key); + } + } return { getReferencedExportContainer: getReferencedExportContainer, getReferencedImportDeclaration: getReferencedImportDeclaration, - getReferencedNestedRedeclaration: getReferencedNestedRedeclaration, - isNestedRedeclaration: isNestedRedeclaration, + getReferencedDeclarationWithCollidingName: getReferencedDeclarationWithCollidingName, + isDeclarationWithCollidingName: isDeclarationWithCollidingName, isValueAliasDeclaration: isValueAliasDeclaration, hasGlobalName: hasGlobalName, isReferencedAliasDeclaration: isReferencedAliasDeclaration, @@ -22884,6 +26209,7 @@ var ts; writeTypeOfDeclaration: writeTypeOfDeclaration, writeReturnTypeOfSignatureDeclaration: writeReturnTypeOfSignatureDeclaration, writeTypeOfExpression: writeTypeOfExpression, + writeBaseConstructorTypeOfClass: writeBaseConstructorTypeOfClass, isSymbolAccessible: isSymbolAccessible, isEntityNameVisible: isEntityNameVisible, getConstantValue: getConstantValue, @@ -22891,31 +26217,106 @@ var ts; getReferencedValueDeclaration: getReferencedValueDeclaration, getTypeReferenceSerializationKind: getTypeReferenceSerializationKind, isOptionalParameter: isOptionalParameter, + moduleExportsSomeValue: moduleExportsSomeValue, isArgumentsLocalBinding: isArgumentsLocalBinding, - getExternalModuleFileFromDeclaration: getExternalModuleFileFromDeclaration + getExternalModuleFileFromDeclaration: getExternalModuleFileFromDeclaration, + getTypeReferenceDirectivesForEntityName: getTypeReferenceDirectivesForEntityName, + getTypeReferenceDirectivesForSymbol: getTypeReferenceDirectivesForSymbol }; + function getTypeReferenceDirectivesForEntityName(node) { + if (!fileToDirective) { + return undefined; + } + var meaning = (node.kind === 172) || (node.kind === 69 && isInTypeQuery(node)) + ? 107455 | 1048576 + : 793056 | 1536; + var symbol = resolveEntityName(node, meaning, true); + return symbol && symbol !== unknownSymbol ? getTypeReferenceDirectivesForSymbol(symbol, meaning) : undefined; + } + function getTypeReferenceDirectivesForSymbol(symbol, meaning) { + if (!fileToDirective) { + return undefined; + } + if (!isSymbolFromTypeDeclarationFile(symbol)) { + return undefined; + } + var typeReferenceDirectives; + for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { + var decl = _a[_i]; + if (decl.symbol && decl.symbol.flags & meaning) { + var file = ts.getSourceFileOfNode(decl); + var typeReferenceDirective = fileToDirective.get(file.path); + if (typeReferenceDirective) { + (typeReferenceDirectives || (typeReferenceDirectives = [])).push(typeReferenceDirective); + } + } + } + return typeReferenceDirectives; + } + function isSymbolFromTypeDeclarationFile(symbol) { + if (!symbol.declarations) { + return false; + } + var current = symbol; + while (true) { + var parent_12 = getParentOfSymbol(current); + if (parent_12) { + current = parent_12; + } + else { + break; + } + } + if (current.valueDeclaration && current.valueDeclaration.kind === 256 && current.flags & 512) { + return false; + } + for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { + var decl = _a[_i]; + var file = ts.getSourceFileOfNode(decl); + if (fileToDirective.contains(file.path)) { + return true; + } + } + return false; + } } function getExternalModuleFileFromDeclaration(declaration) { var specifier = ts.getExternalModuleName(declaration); - var moduleSymbol = getSymbolAtLocation(specifier); + var moduleSymbol = resolveExternalModuleNameWorker(specifier, specifier, undefined); if (!moduleSymbol) { return undefined; } - return ts.getDeclarationOfKind(moduleSymbol, 248); + return ts.getDeclarationOfKind(moduleSymbol, 256); } function initializeTypeChecker() { ts.forEach(host.getSourceFiles(), function (file) { ts.bindSourceFile(file, compilerOptions); }); + var augmentations; ts.forEach(host.getSourceFiles(), function (file) { if (!ts.isExternalOrCommonJsModule(file)) { mergeSymbolTable(globals, file.locals); } + if (file.moduleAugmentations.length) { + (augmentations || (augmentations = [])).push(file.moduleAugmentations); + } + if (file.wasReferenced && file.symbol && file.symbol.globalExports) { + mergeSymbolTable(globals, file.symbol.globalExports); + } }); + if (augmentations) { + for (var _i = 0, augmentations_1 = augmentations; _i < augmentations_1.length; _i++) { + var list = augmentations_1[_i]; + for (var _a = 0, list_2 = list; _a < list_2.length; _a++) { + var augmentation = list_2[_a]; + mergeModuleAugmentation(augmentation); + } + } + } + addToSymbolTable(globals, builtinGlobals, ts.Diagnostics.Declaration_name_conflicts_with_built_in_global_identifier_0); getSymbolLinks(undefinedSymbol).type = undefinedType; getSymbolLinks(argumentsSymbol).type = getGlobalType("IArguments"); getSymbolLinks(unknownSymbol).type = unknownType; - globals[undefinedSymbol.name] = undefinedSymbol; globalArrayType = getGlobalType("Array", 1); globalObjectType = getGlobalType("Object"); globalFunctionType = getGlobalType("Function"); @@ -22929,6 +26330,7 @@ var ts; getGlobalMethodDecoratorType = ts.memoize(function () { return getGlobalType("MethodDecorator"); }); getGlobalParameterDecoratorType = ts.memoize(function () { return getGlobalType("ParameterDecorator"); }); getGlobalTypedPropertyDescriptorType = ts.memoize(function () { return getGlobalType("TypedPropertyDescriptor", 1); }); + getGlobalESSymbolConstructorSymbol = ts.memoize(function () { return getGlobalValueSymbol("Symbol"); }); getGlobalPromiseType = ts.memoize(function () { return getGlobalType("Promise", 1); }); tryGetGlobalPromiseType = ts.memoize(function () { return getGlobalSymbol("Promise", 793056, undefined) && getGlobalPromiseType(); }); getGlobalPromiseLikeType = ts.memoize(function () { return getGlobalType("PromiseLike", 1); }); @@ -22936,23 +26338,23 @@ var ts; getGlobalPromiseConstructorSymbol = ts.memoize(function () { return getGlobalValueSymbol("Promise"); }); getGlobalPromiseConstructorLikeType = ts.memoize(function () { return getGlobalType("PromiseConstructorLike"); }); getGlobalThenableType = ts.memoize(createThenableType); + getGlobalTemplateStringsArrayType = ts.memoize(function () { return getGlobalType("TemplateStringsArray"); }); if (languageVersion >= 2) { - globalTemplateStringsArrayType = getGlobalType("TemplateStringsArray"); - globalESSymbolType = getGlobalType("Symbol"); - globalESSymbolConstructorSymbol = getGlobalValueSymbol("Symbol"); - globalIterableType = getGlobalType("Iterable", 1); - globalIteratorType = getGlobalType("Iterator", 1); - globalIterableIteratorType = getGlobalType("IterableIterator", 1); + getGlobalESSymbolType = ts.memoize(function () { return getGlobalType("Symbol"); }); + getGlobalIterableType = ts.memoize(function () { return getGlobalType("Iterable", 1); }); + getGlobalIteratorType = ts.memoize(function () { return getGlobalType("Iterator", 1); }); + getGlobalIterableIteratorType = ts.memoize(function () { return getGlobalType("IterableIterator", 1); }); } else { - globalTemplateStringsArrayType = unknownType; - globalESSymbolType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); - globalESSymbolConstructorSymbol = undefined; - globalIterableType = emptyGenericType; - globalIteratorType = emptyGenericType; - globalIterableIteratorType = emptyGenericType; + getGlobalESSymbolType = ts.memoize(function () { return emptyObjectType; }); + getGlobalIterableType = ts.memoize(function () { return emptyGenericType; }); + getGlobalIteratorType = ts.memoize(function () { return emptyGenericType; }); + getGlobalIterableIteratorType = ts.memoize(function () { return emptyGenericType; }); } anyArrayType = createArrayType(anyType); + var symbol = getGlobalSymbol("ReadonlyArray", 793056, undefined); + globalReadonlyArrayType = symbol && getTypeOfGlobalSymbol(symbol, 1); + anyReadonlyArrayType = globalReadonlyArrayType ? createTypeFromGenericGlobalType(globalReadonlyArrayType, [anyType]) : anyArrayType; } function createInstantiatedPromiseLikeType() { var promiseLikeType = getGlobalPromiseLikeType(); @@ -22976,9 +26378,14 @@ var ts; return false; } if (!ts.nodeCanBeDecorated(node)) { - return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_are_not_valid_here); + if (node.kind === 147 && !ts.nodeIsPresent(node.body)) { + return grammarErrorOnFirstToken(node, ts.Diagnostics.A_decorator_can_only_decorate_a_method_implementation_not_an_overload); + } + else { + return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_are_not_valid_here); + } } - else if (node.kind === 145 || node.kind === 146) { + else if (node.kind === 149 || node.kind === 150) { var accessors = ts.getAllAccessorDeclarations(node.parent.members, node); if (accessors.firstAccessor.decorators && node === accessors.secondAccessor) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name); @@ -22988,38 +26395,38 @@ var ts; } function checkGrammarModifiers(node) { switch (node.kind) { - case 145: - case 146: - case 144: - case 141: - case 140: - case 143: - case 142: case 149: - case 218: - case 222: - case 221: - case 228: - case 227: - case 138: + case 150: + case 148: + case 145: + case 144: + case 147: + case 146: + case 153: + case 225: + case 230: + case 229: + case 236: + case 235: + case 142: break; - case 213: + case 220: if (node.modifiers && (node.modifiers.length > 1 || node.modifiers[0].kind !== 118) && - node.parent.kind !== 219 && node.parent.kind !== 248) { + node.parent.kind !== 226 && node.parent.kind !== 256) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); } break; - case 214: - case 215: - case 193: - case 216: - if (node.modifiers && node.parent.kind !== 219 && node.parent.kind !== 248) { + case 221: + case 222: + case 200: + case 223: + if (node.modifiers && node.parent.kind !== 226 && node.parent.kind !== 256) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); } break; - case 217: + case 224: if (node.modifiers && (node.modifiers.length > 1 || node.modifiers[0].kind !== 74) && - node.parent.kind !== 219 && node.parent.kind !== 248) { + node.parent.kind !== 226 && node.parent.kind !== 256) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); } break; @@ -23029,37 +26436,48 @@ var ts; if (!node.modifiers) { return; } - var lastStatic, lastPrivate, lastProtected, lastDeclare, lastAsync; + var lastStatic, lastPrivate, lastProtected, lastDeclare, lastAsync, lastReadonly; var flags = 0; for (var _i = 0, _a = node.modifiers; _i < _a.length; _i++) { var modifier = _a[_i]; + if (modifier.kind !== 128) { + if (node.kind === 144 || node.kind === 146) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_type_member, ts.tokenToString(modifier.kind)); + } + if (node.kind === 153) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_an_index_signature, ts.tokenToString(modifier.kind)); + } + } switch (modifier.kind) { + case 74: + if (node.kind !== 224 && node.parent.kind === 221) { + return grammarErrorOnNode(node, ts.Diagnostics.A_class_member_cannot_have_the_0_keyword, ts.tokenToString(74)); + } + break; case 112: case 111: case 110: - var text = void 0; - if (modifier.kind === 112) { - text = "public"; - } - else if (modifier.kind === 111) { - text = "protected"; + var text = visibilityToString(ts.modifierToFlag(modifier.kind)); + if (modifier.kind === 111) { lastProtected = modifier; } - else { - text = "private"; + else if (modifier.kind === 110) { lastPrivate = modifier; } - if (flags & 56) { + if (flags & 28) { return grammarErrorOnNode(modifier, ts.Diagnostics.Accessibility_modifier_already_seen); } - else if (flags & 64) { + else if (flags & 32) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "static"); } + else if (flags & 64) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "readonly"); + } else if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "async"); } - else if (node.parent.kind === 219 || node.parent.kind === 248) { - return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, text); + else if (node.parent.kind === 226 || node.parent.kind === 256) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, text); } else if (flags & 128) { if (modifier.kind === 110) { @@ -23072,29 +26490,42 @@ var ts; flags |= ts.modifierToFlag(modifier.kind); break; case 113: - if (flags & 64) { + if (flags & 32) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "static"); } + else if (flags & 64) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "readonly"); + } else if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "async"); } - else if (node.parent.kind === 219 || node.parent.kind === 248) { - return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, "static"); + else if (node.parent.kind === 226 || node.parent.kind === 256) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, "static"); } - else if (node.kind === 138) { + else if (node.kind === 142) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static"); } else if (flags & 128) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "static", "abstract"); } - flags |= 64; + flags |= 32; lastStatic = modifier; break; + case 128: + if (flags & 64) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "readonly"); + } + else if (node.kind !== 145 && node.kind !== 144 && node.kind !== 153 && node.kind !== 142) { + return grammarErrorOnNode(modifier, ts.Diagnostics.readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature); + } + flags |= 64; + lastReadonly = modifier; + break; case 82: - if (flags & 2) { + if (flags & 1) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "export"); } - else if (flags & 4) { + else if (flags & 2) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "declare"); } else if (flags & 128) { @@ -23103,48 +26534,51 @@ var ts; else if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "async"); } - else if (node.parent.kind === 214) { + else if (node.parent.kind === 221) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export"); } - else if (node.kind === 138) { + else if (node.kind === 142) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export"); } - flags |= 2; + flags |= 1; break; case 122: - if (flags & 4) { + if (flags & 2) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "declare"); } else if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } - else if (node.parent.kind === 214) { + else if (node.parent.kind === 221) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare"); } - else if (node.kind === 138) { + else if (node.kind === 142) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); } - else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 219) { + else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 226) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); } - flags |= 4; + flags |= 2; lastDeclare = modifier; break; case 115: if (flags & 128) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "abstract"); } - if (node.kind !== 214) { - if (node.kind !== 143) { - return grammarErrorOnNode(modifier, ts.Diagnostics.abstract_modifier_can_only_appear_on_a_class_or_method_declaration); + if (node.kind !== 221) { + if (node.kind !== 147 && + node.kind !== 145 && + node.kind !== 149 && + node.kind !== 150) { + return grammarErrorOnNode(modifier, ts.Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration); } - if (!(node.parent.kind === 214 && node.parent.flags & 128)) { + if (!(node.parent.kind === 221 && node.parent.flags & 128)) { return grammarErrorOnNode(modifier, ts.Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class); } - if (flags & 64) { + if (flags & 32) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "static", "abstract"); } - if (flags & 16) { + if (flags & 8) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "private", "abstract"); } } @@ -23154,10 +26588,10 @@ var ts; if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "async"); } - else if (flags & 4 || ts.isInAmbientContext(node.parent)) { + else if (flags & 2 || ts.isInAmbientContext(node.parent)) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } - else if (node.kind === 138) { + else if (node.kind === 142) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "async"); } flags |= 256; @@ -23165,28 +26599,25 @@ var ts; break; } } - if (node.kind === 144) { - if (flags & 64) { + if (node.kind === 148) { + if (flags & 32) { return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static"); } if (flags & 128) { return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "abstract"); } - else if (flags & 32) { - return grammarErrorOnNode(lastProtected, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "protected"); - } - else if (flags & 16) { - return grammarErrorOnNode(lastPrivate, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "private"); - } else if (flags & 256) { return grammarErrorOnNode(lastAsync, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "async"); } + else if (flags & 64) { + return grammarErrorOnNode(lastReadonly, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "readonly"); + } return; } - else if ((node.kind === 222 || node.kind === 221) && flags & 4) { + else if ((node.kind === 230 || node.kind === 229) && flags & 2) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare"); } - else if (node.kind === 138 && (flags & 56) && ts.isBindingPattern(node.name)) { + else if (node.kind === 142 && (flags & 92) && ts.isBindingPattern(node.name)) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_may_not_be_a_binding_pattern); } if (flags & 256) { @@ -23198,10 +26629,10 @@ var ts; return grammarErrorOnNode(asyncModifier, ts.Diagnostics.Async_functions_are_only_available_when_targeting_ECMAScript_6_and_higher); } switch (node.kind) { - case 143: - case 213: - case 173: - case 174: + case 147: + case 220: + case 179: + case 180: if (!node.asteriskToken) { return false; } @@ -23266,7 +26697,7 @@ var ts; checkGrammarParameterList(node.parameters) || checkGrammarArrowFunction(node, file); } function checkGrammarArrowFunction(node, file) { - if (node.kind === 174) { + if (node.kind === 180) { var arrowFunction = node; var startLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.pos).line; var endLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.end).line; @@ -23289,7 +26720,7 @@ var ts; if (parameter.dotDotDotToken) { return grammarErrorOnNode(parameter.dotDotDotToken, ts.Diagnostics.An_index_signature_cannot_have_a_rest_parameter); } - if (parameter.flags & 1022) { + if (parameter.flags & 1023) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_cannot_have_an_accessibility_modifier); } if (parameter.questionToken) { @@ -23301,20 +26732,15 @@ var ts; if (!parameter.type) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_must_have_a_type_annotation); } - if (parameter.type.kind !== 130 && parameter.type.kind !== 128) { + if (parameter.type.kind !== 132 && parameter.type.kind !== 130) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_must_be_string_or_number); } if (!node.type) { return grammarErrorOnNode(node, ts.Diagnostics.An_index_signature_must_have_a_type_annotation); } } - function checkGrammarForIndexSignatureModifier(node) { - if (node.flags & 1022) { - grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_not_permitted_on_index_signature_members); - } - } function checkGrammarIndexSignature(node) { - return checkGrammarDecorators(node) || checkGrammarModifiers(node) || checkGrammarIndexSignatureParameters(node) || checkGrammarForIndexSignatureModifier(node); + return checkGrammarDecorators(node) || checkGrammarModifiers(node) || checkGrammarIndexSignatureParameters(node); } function checkGrammarForAtLeastOneTypeArgument(node, typeArguments) { if (typeArguments && typeArguments.length === 0) { @@ -23333,7 +26759,7 @@ var ts; var sourceFile = ts.getSourceFileOfNode(node); for (var _i = 0, args_1 = args; _i < args_1.length; _i++) { var arg = args_1[_i]; - if (arg.kind === 187) { + if (arg.kind === 193) { return grammarErrorAtPos(sourceFile, arg.pos, 0, ts.Diagnostics.Argument_expression_expected); } } @@ -23404,19 +26830,19 @@ var ts; return false; } function checkGrammarComputedPropertyName(node) { - if (node.kind !== 136) { + if (node.kind !== 140) { return false; } var computedPropertyName = node; - if (computedPropertyName.expression.kind === 181 && computedPropertyName.expression.operatorToken.kind === 24) { + if (computedPropertyName.expression.kind === 187 && computedPropertyName.expression.operatorToken.kind === 24) { return grammarErrorOnNode(computedPropertyName.expression, ts.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name); } } function checkGrammarForGenerator(node) { if (node.asteriskToken) { - ts.Debug.assert(node.kind === 213 || - node.kind === 173 || - node.kind === 143); + ts.Debug.assert(node.kind === 220 || + node.kind === 179 || + node.kind === 147); if (ts.isInAmbientContext(node)) { return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_not_allowed_in_an_ambient_context); } @@ -23437,78 +26863,87 @@ var ts; var seen = {}; var Property = 1; var GetAccessor = 2; - var SetAccesor = 4; - var GetOrSetAccessor = GetAccessor | SetAccesor; - for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { - var prop = _a[_i]; - var name_17 = prop.name; - if (prop.kind === 187 || - name_17.kind === 136) { - checkGrammarComputedPropertyName(name_17); - continue; + var SetAccessor = 4; + var GetOrSetAccessor = GetAccessor | SetAccessor; + var _loop_1 = function(prop) { + var name_20 = prop.name; + if (prop.kind === 193 || + name_20.kind === 140) { + checkGrammarComputedPropertyName(name_20); + return "continue"; } - if (prop.kind === 246 && !inDestructuring && prop.objectAssignmentInitializer) { - return grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment); + if (prop.kind === 254 && !inDestructuring && prop.objectAssignmentInitializer) { + return { value: grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment) }; } + ts.forEach(prop.modifiers, function (mod) { + if (mod.kind !== 118 || prop.kind !== 147) { + grammarErrorOnNode(mod, ts.Diagnostics._0_modifier_cannot_be_used_here, ts.getTextOfNode(mod)); + } + }); var currentKind = void 0; - if (prop.kind === 245 || prop.kind === 246) { + if (prop.kind === 253 || prop.kind === 254) { checkGrammarForInvalidQuestionMark(prop, prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); - if (name_17.kind === 8) { - checkGrammarNumericLiteral(name_17); + if (name_20.kind === 8) { + checkGrammarNumericLiteral(name_20); } currentKind = Property; } - else if (prop.kind === 143) { + else if (prop.kind === 147) { currentKind = Property; } - else if (prop.kind === 145) { + else if (prop.kind === 149) { currentKind = GetAccessor; } - else if (prop.kind === 146) { - currentKind = SetAccesor; + else if (prop.kind === 150) { + currentKind = SetAccessor; } else { ts.Debug.fail("Unexpected syntax kind:" + prop.kind); } - if (!ts.hasProperty(seen, name_17.text)) { - seen[name_17.text] = currentKind; + if (!ts.hasProperty(seen, name_20.text)) { + seen[name_20.text] = currentKind; } else { - var existingKind = seen[name_17.text]; + var existingKind = seen[name_20.text]; if (currentKind === Property && existingKind === Property) { - continue; + return "continue"; } else if ((currentKind & GetOrSetAccessor) && (existingKind & GetOrSetAccessor)) { if (existingKind !== GetOrSetAccessor && currentKind !== existingKind) { - seen[name_17.text] = currentKind | existingKind; + seen[name_20.text] = currentKind | existingKind; } else { - return grammarErrorOnNode(name_17, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name); + return { value: grammarErrorOnNode(name_20, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name) }; } } else { - return grammarErrorOnNode(name_17, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name); + return { value: grammarErrorOnNode(name_20, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name) }; } } + }; + for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { + var prop = _a[_i]; + var state_2 = _loop_1(prop); + if (typeof state_2 === "object") return state_2.value; } } function checkGrammarJsxElement(node) { var seen = {}; for (var _i = 0, _a = node.attributes; _i < _a.length; _i++) { var attr = _a[_i]; - if (attr.kind === 239) { + if (attr.kind === 247) { continue; } var jsxAttr = attr; - var name_18 = jsxAttr.name; - if (!ts.hasProperty(seen, name_18.text)) { - seen[name_18.text] = true; + var name_21 = jsxAttr.name; + if (!ts.hasProperty(seen, name_21.text)) { + seen[name_21.text] = true; } else { - return grammarErrorOnNode(name_18, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); + return grammarErrorOnNode(name_21, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); } var initializer = jsxAttr.initializer; - if (initializer && initializer.kind === 240 && !initializer.expression) { + if (initializer && initializer.kind === 248 && !initializer.expression) { return grammarErrorOnNode(jsxAttr.initializer, ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression); } } @@ -23517,24 +26952,28 @@ var ts; if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { return true; } - if (forInOrOfStatement.initializer.kind === 212) { + if (forInOrOfStatement.initializer.kind === 219) { var variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { - if (variableList.declarations.length > 1) { - var diagnostic = forInOrOfStatement.kind === 200 + var declarations = variableList.declarations; + if (!declarations.length) { + return false; + } + if (declarations.length > 1) { + var diagnostic = forInOrOfStatement.kind === 207 ? ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement : ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement; return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic); } - var firstDeclaration = variableList.declarations[0]; + var firstDeclaration = declarations[0]; if (firstDeclaration.initializer) { - var diagnostic = forInOrOfStatement.kind === 200 + var diagnostic = forInOrOfStatement.kind === 207 ? ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer : ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; return grammarErrorOnNode(firstDeclaration.name, diagnostic); } if (firstDeclaration.type) { - var diagnostic = forInOrOfStatement.kind === 200 + var diagnostic = forInOrOfStatement.kind === 207 ? ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation : ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation; return grammarErrorOnNode(firstDeclaration, diagnostic); @@ -23551,30 +26990,26 @@ var ts; else if (ts.isInAmbientContext(accessor)) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_be_declared_in_an_ambient_context); } - else if (accessor.body === undefined) { + else if (accessor.body === undefined && !(accessor.flags & 128)) { return grammarErrorAtPos(ts.getSourceFileOfNode(accessor), accessor.end - 1, ";".length, ts.Diagnostics._0_expected, "{"); } else if (accessor.typeParameters) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters); } - else if (kind === 145 && accessor.parameters.length) { - return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_get_accessor_cannot_have_parameters); + else if (!doesAccessorHaveCorrectParameterCount(accessor)) { + return grammarErrorOnNode(accessor.name, kind === 149 ? + ts.Diagnostics.A_get_accessor_cannot_have_parameters : + ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter); } - else if (kind === 146) { + else if (kind === 150) { if (accessor.type) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation); } - else if (accessor.parameters.length !== 1) { - return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter); - } else { var parameter = accessor.parameters[0]; if (parameter.dotDotDotToken) { return grammarErrorOnNode(parameter.dotDotDotToken, ts.Diagnostics.A_set_accessor_cannot_have_rest_parameter); } - else if (parameter.flags & 1022) { - return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); - } else if (parameter.questionToken) { return grammarErrorOnNode(parameter.questionToken, ts.Diagnostics.A_set_accessor_cannot_have_an_optional_parameter); } @@ -23584,6 +27019,16 @@ var ts; } } } + function doesAccessorHaveCorrectParameterCount(accessor) { + return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 149 ? 0 : 1); + } + function getAccessorThisParameter(accessor) { + if (accessor.parameters.length === (accessor.kind === 149 ? 1 : 2) && + accessor.parameters[0].name.kind === 69 && + accessor.parameters[0].name.originalKeywordKind === 97) { + return accessor.parameters[0]; + } + } function checkGrammarForNonSymbolComputedProperty(node, message) { if (ts.isDynamicName(node)) { return grammarErrorOnNode(node, message); @@ -23595,18 +27040,15 @@ var ts; checkGrammarForGenerator(node)) { return true; } - if (node.parent.kind === 165) { - if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional)) { + if (node.parent.kind === 171) { + if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional)) { return true; } else if (node.body === undefined) { - return grammarErrorAtPos(getSourceFile(node), node.end - 1, ";".length, ts.Diagnostics._0_expected, "{"); + return grammarErrorAtPos(ts.getSourceFileOfNode(node), node.end - 1, ";".length, ts.Diagnostics._0_expected, "{"); } } if (ts.isClassLike(node.parent)) { - if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional)) { - return true; - } if (ts.isInAmbientContext(node)) { return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_symbol); } @@ -23614,10 +27056,10 @@ var ts; return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol); } } - else if (node.parent.kind === 215) { + else if (node.parent.kind === 222) { return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol); } - else if (node.parent.kind === 155) { + else if (node.parent.kind === 159) { return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol); } } @@ -23628,9 +27070,9 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); } switch (current.kind) { - case 207: + case 214: if (node.label && current.label.text === node.label.text) { - var isMisplacedContinueLabel = node.kind === 202 + var isMisplacedContinueLabel = node.kind === 209 && !ts.isIterationStatement(current.statement, true); if (isMisplacedContinueLabel) { return grammarErrorOnNode(node, ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement); @@ -23638,8 +27080,8 @@ var ts; return false; } break; - case 206: - if (node.kind === 203 && !node.label) { + case 213: + if (node.kind === 210 && !node.label) { return false; } break; @@ -23652,13 +27094,13 @@ var ts; current = current.parent; } if (node.label) { - var message = node.kind === 203 + var message = node.kind === 210 ? ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement : ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); } else { - var message = node.kind === 203 + var message = node.kind === 210 ? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement : ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); @@ -23670,7 +27112,7 @@ var ts; if (node !== ts.lastOrUndefined(elements)) { return grammarErrorOnNode(node, ts.Diagnostics.A_rest_element_must_be_last_in_an_array_destructuring_pattern); } - if (node.name.kind === 162 || node.name.kind === 161) { + if (node.name.kind === 168 || node.name.kind === 167) { return grammarErrorOnNode(node.name, ts.Diagnostics.A_rest_element_cannot_contain_a_binding_pattern); } if (node.initializer) { @@ -23679,7 +27121,7 @@ var ts; } } function checkGrammarVariableDeclaration(node) { - if (node.parent.parent.kind !== 200 && node.parent.parent.kind !== 201) { + if (node.parent.parent.kind !== 207 && node.parent.parent.kind !== 208) { if (ts.isInAmbientContext(node)) { if (node.initializer) { var equalsTokenLength = "=".length; @@ -23695,12 +27137,12 @@ var ts; } } } - var checkLetConstNames = languageVersion >= 2 && (ts.isLet(node) || ts.isConst(node)); + var checkLetConstNames = (ts.isLet(node) || ts.isConst(node)); return checkLetConstNames && checkGrammarNameInLetOrConstDeclarations(node.name); } function checkGrammarNameInLetOrConstDeclarations(name) { if (name.kind === 69) { - if (name.text === "let") { + if (name.originalKeywordKind === 108) { return grammarErrorOnNode(name, ts.Diagnostics.let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations); } } @@ -23708,7 +27150,7 @@ var ts; var elements = name.elements; for (var _i = 0, elements_2 = elements; _i < elements_2.length; _i++) { var element = elements_2[_i]; - if (element.kind !== 187) { + if (element.kind !== 193) { checkGrammarNameInLetOrConstDeclarations(element.name); } } @@ -23725,15 +27167,15 @@ var ts; } function allowLetAndConstDeclarations(parent) { switch (parent.kind) { - case 196: - case 197: - case 198: + case 203: + case 204: case 205: - case 199: - case 200: - case 201: - return false; + case 212: + case 206: case 207: + case 208: + return false; + case 214: return allowLetAndConstDeclarations(parent.parent); } return true; @@ -23748,18 +27190,6 @@ var ts; } } } - function isIntegerLiteral(expression) { - if (expression.kind === 179) { - var unaryExpression = expression; - if (unaryExpression.operator === 35 || unaryExpression.operator === 36) { - expression = unaryExpression.operand; - } - } - if (expression.kind === 8) { - return /^[0-9]+([eE]\+?[0-9]+)?$/.test(expression.text); - } - return false; - } function hasParseDiagnostics(sourceFile) { return sourceFile.parseDiagnostics.length > 0; } @@ -23784,10 +27214,6 @@ var ts; return true; } } - function isEvalOrArgumentsIdentifier(node) { - return node.kind === 69 && - (node.text === "eval" || node.text === "arguments"); - } function checkGrammarConstructorTypeParameters(node) { if (node.typeParameters) { return grammarErrorAtPos(ts.getSourceFileOfNode(node), node.typeParameters.pos, node.typeParameters.end - node.typeParameters.pos, ts.Diagnostics.Type_parameters_cannot_appear_on_a_constructor_declaration); @@ -23800,34 +27226,39 @@ var ts; } function checkGrammarProperty(node) { if (ts.isClassLike(node.parent)) { - if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional) || - checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol)) { + if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol)) { return true; } } - else if (node.parent.kind === 215) { + else if (node.parent.kind === 222) { if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol)) { return true; } + if (node.initializer) { + return grammarErrorOnNode(node.initializer, ts.Diagnostics.An_interface_property_cannot_have_an_initializer); + } } - else if (node.parent.kind === 155) { + else if (node.parent.kind === 159) { if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol)) { return true; } + if (node.initializer) { + return grammarErrorOnNode(node.initializer, ts.Diagnostics.A_type_literal_property_cannot_have_an_initializer); + } } if (ts.isInAmbientContext(node) && node.initializer) { return grammarErrorOnFirstToken(node.initializer, ts.Diagnostics.Initializers_are_not_allowed_in_ambient_contexts); } } function checkGrammarTopLevelElementForRequiredDeclareModifier(node) { - if (node.kind === 215 || - node.kind === 216 || - node.kind === 222 || - node.kind === 221 || - node.kind === 228 || - node.kind === 227 || - (node.flags & 4) || - (node.flags & (2 | 512))) { + if (node.kind === 222 || + node.kind === 223 || + node.kind === 230 || + node.kind === 229 || + node.kind === 236 || + node.kind === 235 || + (node.flags & 2) || + (node.flags & (1 | 512))) { return false; } return grammarErrorOnFirstToken(node, ts.Diagnostics.A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file); @@ -23835,7 +27266,7 @@ var ts; function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) { for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { var decl = _a[_i]; - if (ts.isDeclaration(decl) || decl.kind === 193) { + if (ts.isDeclaration(decl) || decl.kind === 200) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { return true; } @@ -23854,7 +27285,7 @@ var ts; if (!links.hasReportedStatementInAmbientContext && ts.isFunctionLike(node.parent)) { return getNodeLinks(node).hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts); } - if (node.parent.kind === 192 || node.parent.kind === 219 || node.parent.kind === 248) { + if (node.parent.kind === 199 || node.parent.kind === 226 || node.parent.kind === 256) { var links_1 = getNodeLinks(node.parent); if (!links_1.hasReportedStatementInAmbientContext) { return links_1.hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.Statements_are_not_allowed_in_ambient_contexts); @@ -23865,7 +27296,7 @@ var ts; } } function checkGrammarNumericLiteral(node) { - if (node.flags & 32768 && languageVersion >= 1) { + if (node.isOctalLiteral && languageVersion >= 1) { return grammarErrorOnNode(node, ts.Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher); } } @@ -23877,19 +27308,287 @@ var ts; return true; } } + var _a; } ts.createTypeChecker = createTypeChecker; })(ts || (ts = {})); var ts; +(function (ts) { + var nullSourceMapWriter; + var defaultLastEncodedSourceMapSpan = { + emittedLine: 1, + emittedColumn: 1, + sourceLine: 1, + sourceColumn: 1, + sourceIndex: 0 + }; + function getNullSourceMapWriter() { + if (nullSourceMapWriter === undefined) { + nullSourceMapWriter = { + getSourceMapData: function () { return undefined; }, + setSourceFile: function (sourceFile) { }, + emitStart: function (range) { }, + emitEnd: function (range, stopOverridingSpan) { }, + emitPos: function (pos) { }, + changeEmitSourcePos: function () { }, + getText: function () { return undefined; }, + getSourceMappingURL: function () { return undefined; }, + initialize: function (filePath, sourceMapFilePath, sourceFiles, isBundledEmit) { }, + reset: function () { } + }; + } + return nullSourceMapWriter; + } + ts.getNullSourceMapWriter = getNullSourceMapWriter; + function createSourceMapWriter(host, writer) { + var compilerOptions = host.getCompilerOptions(); + var currentSourceFile; + var sourceMapDir; + var stopOverridingSpan = false; + var modifyLastSourcePos = false; + var sourceMapSourceIndex; + var lastRecordedSourceMapSpan; + var lastEncodedSourceMapSpan; + var lastEncodedNameIndex; + var sourceMapData; + return { + getSourceMapData: function () { return sourceMapData; }, + setSourceFile: setSourceFile, + emitPos: emitPos, + emitStart: emitStart, + emitEnd: emitEnd, + changeEmitSourcePos: changeEmitSourcePos, + getText: getText, + getSourceMappingURL: getSourceMappingURL, + initialize: initialize, + reset: reset + }; + function initialize(filePath, sourceMapFilePath, sourceFiles, isBundledEmit) { + if (sourceMapData) { + reset(); + } + currentSourceFile = undefined; + sourceMapSourceIndex = -1; + lastRecordedSourceMapSpan = undefined; + lastEncodedSourceMapSpan = defaultLastEncodedSourceMapSpan; + lastEncodedNameIndex = 0; + sourceMapData = { + sourceMapFilePath: sourceMapFilePath, + jsSourceMappingURL: !compilerOptions.inlineSourceMap ? ts.getBaseFileName(ts.normalizeSlashes(sourceMapFilePath)) : undefined, + sourceMapFile: ts.getBaseFileName(ts.normalizeSlashes(filePath)), + sourceMapSourceRoot: compilerOptions.sourceRoot || "", + sourceMapSources: [], + inputSourceFileNames: [], + sourceMapNames: [], + sourceMapMappings: "", + sourceMapSourcesContent: compilerOptions.inlineSources ? [] : undefined, + sourceMapDecodedMappings: [] + }; + sourceMapData.sourceMapSourceRoot = ts.normalizeSlashes(sourceMapData.sourceMapSourceRoot); + if (sourceMapData.sourceMapSourceRoot.length && sourceMapData.sourceMapSourceRoot.charCodeAt(sourceMapData.sourceMapSourceRoot.length - 1) !== 47) { + sourceMapData.sourceMapSourceRoot += ts.directorySeparator; + } + if (compilerOptions.mapRoot) { + sourceMapDir = ts.normalizeSlashes(compilerOptions.mapRoot); + if (!isBundledEmit) { + ts.Debug.assert(sourceFiles.length === 1); + sourceMapDir = ts.getDirectoryPath(ts.getSourceFilePathInNewDir(sourceFiles[0], host, sourceMapDir)); + } + if (!ts.isRootedDiskPath(sourceMapDir) && !ts.isUrl(sourceMapDir)) { + sourceMapDir = ts.combinePaths(host.getCommonSourceDirectory(), sourceMapDir); + sourceMapData.jsSourceMappingURL = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizePath(filePath)), ts.combinePaths(sourceMapDir, sourceMapData.jsSourceMappingURL), host.getCurrentDirectory(), host.getCanonicalFileName, true); + } + else { + sourceMapData.jsSourceMappingURL = ts.combinePaths(sourceMapDir, sourceMapData.jsSourceMappingURL); + } + } + else { + sourceMapDir = ts.getDirectoryPath(ts.normalizePath(filePath)); + } + } + function reset() { + currentSourceFile = undefined; + sourceMapDir = undefined; + sourceMapSourceIndex = undefined; + lastRecordedSourceMapSpan = undefined; + lastEncodedSourceMapSpan = undefined; + lastEncodedNameIndex = undefined; + sourceMapData = undefined; + } + function updateLastEncodedAndRecordedSpans() { + if (modifyLastSourcePos) { + modifyLastSourcePos = false; + lastRecordedSourceMapSpan.emittedLine = lastEncodedSourceMapSpan.emittedLine; + lastRecordedSourceMapSpan.emittedColumn = lastEncodedSourceMapSpan.emittedColumn; + sourceMapData.sourceMapDecodedMappings.pop(); + lastEncodedSourceMapSpan = sourceMapData.sourceMapDecodedMappings.length ? + sourceMapData.sourceMapDecodedMappings[sourceMapData.sourceMapDecodedMappings.length - 1] : + defaultLastEncodedSourceMapSpan; + var sourceMapMappings = sourceMapData.sourceMapMappings; + var lenthToSet = sourceMapMappings.length - 1; + for (; lenthToSet >= 0; lenthToSet--) { + var currentChar = sourceMapMappings.charAt(lenthToSet); + if (currentChar === ",") { + break; + } + if (currentChar === ";" && lenthToSet !== 0 && sourceMapMappings.charAt(lenthToSet - 1) !== ";") { + break; + } + } + sourceMapData.sourceMapMappings = sourceMapMappings.substr(0, Math.max(0, lenthToSet)); + } + } + function encodeLastRecordedSourceMapSpan() { + if (!lastRecordedSourceMapSpan || lastRecordedSourceMapSpan === lastEncodedSourceMapSpan) { + return; + } + var prevEncodedEmittedColumn = lastEncodedSourceMapSpan.emittedColumn; + if (lastEncodedSourceMapSpan.emittedLine === lastRecordedSourceMapSpan.emittedLine) { + if (sourceMapData.sourceMapMappings) { + sourceMapData.sourceMapMappings += ","; + } + } + else { + for (var encodedLine = lastEncodedSourceMapSpan.emittedLine; encodedLine < lastRecordedSourceMapSpan.emittedLine; encodedLine++) { + sourceMapData.sourceMapMappings += ";"; + } + prevEncodedEmittedColumn = 1; + } + sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.emittedColumn - prevEncodedEmittedColumn); + sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceIndex - lastEncodedSourceMapSpan.sourceIndex); + sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceLine - lastEncodedSourceMapSpan.sourceLine); + sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceColumn - lastEncodedSourceMapSpan.sourceColumn); + if (lastRecordedSourceMapSpan.nameIndex >= 0) { + ts.Debug.assert(false, "We do not support name index right now, Make sure to update updateLastEncodedAndRecordedSpans when we start using this"); + sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.nameIndex - lastEncodedNameIndex); + lastEncodedNameIndex = lastRecordedSourceMapSpan.nameIndex; + } + lastEncodedSourceMapSpan = lastRecordedSourceMapSpan; + sourceMapData.sourceMapDecodedMappings.push(lastEncodedSourceMapSpan); + } + function emitPos(pos) { + if (pos === -1) { + return; + } + var sourceLinePos = ts.getLineAndCharacterOfPosition(currentSourceFile, pos); + sourceLinePos.line++; + sourceLinePos.character++; + var emittedLine = writer.getLine(); + var emittedColumn = writer.getColumn(); + if (!lastRecordedSourceMapSpan || + lastRecordedSourceMapSpan.emittedLine !== emittedLine || + lastRecordedSourceMapSpan.emittedColumn !== emittedColumn || + (lastRecordedSourceMapSpan.sourceIndex === sourceMapSourceIndex && + (lastRecordedSourceMapSpan.sourceLine > sourceLinePos.line || + (lastRecordedSourceMapSpan.sourceLine === sourceLinePos.line && lastRecordedSourceMapSpan.sourceColumn > sourceLinePos.character)))) { + encodeLastRecordedSourceMapSpan(); + lastRecordedSourceMapSpan = { + emittedLine: emittedLine, + emittedColumn: emittedColumn, + sourceLine: sourceLinePos.line, + sourceColumn: sourceLinePos.character, + sourceIndex: sourceMapSourceIndex + }; + stopOverridingSpan = false; + } + else if (!stopOverridingSpan) { + lastRecordedSourceMapSpan.sourceLine = sourceLinePos.line; + lastRecordedSourceMapSpan.sourceColumn = sourceLinePos.character; + lastRecordedSourceMapSpan.sourceIndex = sourceMapSourceIndex; + } + updateLastEncodedAndRecordedSpans(); + } + function getStartPos(range) { + var rangeHasDecorators = !!range.decorators; + return range.pos !== -1 ? ts.skipTrivia(currentSourceFile.text, rangeHasDecorators ? range.decorators.end : range.pos) : -1; + } + function emitStart(range) { + emitPos(getStartPos(range)); + } + function emitEnd(range, stopOverridingEnd) { + emitPos(range.end); + stopOverridingSpan = stopOverridingEnd; + } + function changeEmitSourcePos() { + ts.Debug.assert(!modifyLastSourcePos); + modifyLastSourcePos = true; + } + function setSourceFile(sourceFile) { + currentSourceFile = sourceFile; + var sourcesDirectoryPath = compilerOptions.sourceRoot ? host.getCommonSourceDirectory() : sourceMapDir; + var source = ts.getRelativePathToDirectoryOrUrl(sourcesDirectoryPath, currentSourceFile.fileName, host.getCurrentDirectory(), host.getCanonicalFileName, true); + sourceMapSourceIndex = ts.indexOf(sourceMapData.sourceMapSources, source); + if (sourceMapSourceIndex === -1) { + sourceMapSourceIndex = sourceMapData.sourceMapSources.length; + sourceMapData.sourceMapSources.push(source); + sourceMapData.inputSourceFileNames.push(sourceFile.fileName); + if (compilerOptions.inlineSources) { + sourceMapData.sourceMapSourcesContent.push(sourceFile.text); + } + } + } + function getText() { + encodeLastRecordedSourceMapSpan(); + return ts.stringify({ + version: 3, + file: sourceMapData.sourceMapFile, + sourceRoot: sourceMapData.sourceMapSourceRoot, + sources: sourceMapData.sourceMapSources, + names: sourceMapData.sourceMapNames, + mappings: sourceMapData.sourceMapMappings, + sourcesContent: sourceMapData.sourceMapSourcesContent + }); + } + function getSourceMappingURL() { + if (compilerOptions.inlineSourceMap) { + var base64SourceMapText = ts.convertToBase64(getText()); + return sourceMapData.jsSourceMappingURL = "data:application/json;base64," + base64SourceMapText; + } + else { + return sourceMapData.jsSourceMappingURL; + } + } + } + ts.createSourceMapWriter = createSourceMapWriter; + var base64Chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + function base64FormatEncode(inValue) { + if (inValue < 64) { + return base64Chars.charAt(inValue); + } + throw TypeError(inValue + ": not a 64 based value"); + } + function base64VLQFormatEncode(inValue) { + if (inValue < 0) { + inValue = ((-inValue) << 1) + 1; + } + else { + inValue = inValue << 1; + } + var encodedStr = ""; + do { + var currentDigit = inValue & 31; + inValue = inValue >> 5; + if (inValue > 0) { + currentDigit = currentDigit | 32; + } + encodedStr = encodedStr + base64FormatEncode(currentDigit); + } while (inValue > 0); + return encodedStr; + } +})(ts || (ts = {})); +var ts; (function (ts) { function getDeclarationDiagnostics(host, resolver, targetSourceFile) { - var diagnostics = []; - var jsFilePath = ts.getOwnEmitOutputFilePath(targetSourceFile, host, ".js"); - emitDeclarations(host, resolver, diagnostics, jsFilePath, targetSourceFile); - return diagnostics; + var declarationDiagnostics = ts.createDiagnosticCollection(); + ts.forEachExpectedEmitFile(host, getDeclarationDiagnosticsFromFile, targetSourceFile); + return declarationDiagnostics.getDiagnostics(targetSourceFile ? targetSourceFile.fileName : undefined); + function getDeclarationDiagnosticsFromFile(_a, sources, isBundledEmit) { + var declarationFilePath = _a.declarationFilePath; + emitDeclarations(host, resolver, declarationDiagnostics, declarationFilePath, sources, isBundledEmit); + } } ts.getDeclarationDiagnostics = getDeclarationDiagnostics; - function emitDeclarations(host, resolver, diagnostics, jsFilePath, root) { + function emitDeclarations(host, resolver, emitterDiagnostics, declarationFilePath, sourceFiles, isBundledEmit) { var newLine = host.getNewLine(); var compilerOptions = host.getCompilerOptions(); var write; @@ -23897,8 +27596,10 @@ var ts; var increaseIndent; var decreaseIndent; var writeTextOfNode; - var writer = createAndSetNewTextWriterWithSymbolWriter(); + var writer; + createAndSetNewTextWriterWithSymbolWriter(); var enclosingDeclaration; + var resultHasExternalModuleIndicator; var currentText; var currentLineMap; var currentIdentifiers; @@ -23907,95 +27608,82 @@ var ts; var errorNameNode; var emitJsDocComments = compilerOptions.removeComments ? function (declaration) { } : writeJsDocComments; var emit = compilerOptions.stripInternal ? stripInternal : emitNode; - var noDeclare = !root; + var noDeclare; var moduleElementDeclarationEmitInfo = []; var asynchronousSubModuleDeclarationEmitInfo; - var referencePathsOutput = ""; - if (root) { + var referencesOutput = ""; + var usedTypeDirectiveReferences; + var emittedReferencedFiles = []; + var addedGlobalFileReference = false; + var allSourcesModuleElementDeclarationEmitInfo = []; + ts.forEach(sourceFiles, function (sourceFile) { + if (ts.isSourceFileJavaScript(sourceFile)) { + return; + } if (!compilerOptions.noResolve) { - var addedGlobalFileReference = false; - ts.forEach(root.referencedFiles, function (fileReference) { - var referencedFile = ts.tryResolveScriptReference(host, root, fileReference); - if (referencedFile && ((referencedFile.flags & 4096) || - ts.shouldEmitToOwnFile(referencedFile, compilerOptions) || - !addedGlobalFileReference)) { - writeReferencePath(referencedFile); - if (!ts.isExternalModuleOrDeclarationFile(referencedFile)) { + ts.forEach(sourceFile.referencedFiles, function (fileReference) { + var referencedFile = ts.tryResolveScriptReference(host, sourceFile, fileReference); + if (referencedFile && !ts.contains(emittedReferencedFiles, referencedFile)) { + if (writeReferencePath(referencedFile, !isBundledEmit && !addedGlobalFileReference)) { addedGlobalFileReference = true; } + emittedReferencedFiles.push(referencedFile); } }); } - emitSourceFile(root); + resultHasExternalModuleIndicator = false; + if (!isBundledEmit || !ts.isExternalModule(sourceFile)) { + noDeclare = false; + emitSourceFile(sourceFile); + } + else if (ts.isExternalModule(sourceFile)) { + noDeclare = true; + write("declare module \"" + ts.getResolvedExternalModuleName(host, sourceFile) + "\" {"); + writeLine(); + increaseIndent(); + emitSourceFile(sourceFile); + decreaseIndent(); + write("}"); + writeLine(); + } if (moduleElementDeclarationEmitInfo.length) { var oldWriter = writer; ts.forEach(moduleElementDeclarationEmitInfo, function (aliasEmitInfo) { - if (aliasEmitInfo.isVisible) { - ts.Debug.assert(aliasEmitInfo.node.kind === 222); + if (aliasEmitInfo.isVisible && !aliasEmitInfo.asynchronousOutput) { + ts.Debug.assert(aliasEmitInfo.node.kind === 230); createAndSetNewTextWriterWithSymbolWriter(); - ts.Debug.assert(aliasEmitInfo.indent === 0); + ts.Debug.assert(aliasEmitInfo.indent === 0 || (aliasEmitInfo.indent === 1 && isBundledEmit)); + for (var i = 0; i < aliasEmitInfo.indent; i++) { + increaseIndent(); + } writeImportDeclaration(aliasEmitInfo.node); aliasEmitInfo.asynchronousOutput = writer.getText(); + for (var i = 0; i < aliasEmitInfo.indent; i++) { + decreaseIndent(); + } } }); setWriter(oldWriter); + allSourcesModuleElementDeclarationEmitInfo = allSourcesModuleElementDeclarationEmitInfo.concat(moduleElementDeclarationEmitInfo); + moduleElementDeclarationEmitInfo = []; } - } - else { - var emittedReferencedFiles = []; - var prevModuleElementDeclarationEmitInfo = []; - ts.forEach(host.getSourceFiles(), function (sourceFile) { - if (!ts.isDeclarationFile(sourceFile)) { - if (!compilerOptions.noResolve) { - ts.forEach(sourceFile.referencedFiles, function (fileReference) { - var referencedFile = ts.tryResolveScriptReference(host, sourceFile, fileReference); - if (referencedFile && (ts.isDeclarationFile(referencedFile) && - !ts.contains(emittedReferencedFiles, referencedFile))) { - writeReferencePath(referencedFile); - emittedReferencedFiles.push(referencedFile); - } - }); - } + if (!isBundledEmit && ts.isExternalModule(sourceFile) && sourceFile.moduleAugmentations.length && !resultHasExternalModuleIndicator) { + write("export {};"); + writeLine(); + } + }); + if (usedTypeDirectiveReferences) { + for (var directive in usedTypeDirectiveReferences) { + if (ts.hasProperty(usedTypeDirectiveReferences, directive)) { + referencesOutput += "/// " + newLine; } - if (!ts.isExternalModuleOrDeclarationFile(sourceFile)) { - noDeclare = false; - emitSourceFile(sourceFile); - } - else if (ts.isExternalModule(sourceFile)) { - noDeclare = true; - write("declare module \"" + ts.getResolvedExternalModuleName(host, sourceFile) + "\" {"); - writeLine(); - increaseIndent(); - emitSourceFile(sourceFile); - decreaseIndent(); - write("}"); - writeLine(); - if (moduleElementDeclarationEmitInfo.length) { - var oldWriter = writer; - ts.forEach(moduleElementDeclarationEmitInfo, function (aliasEmitInfo) { - if (aliasEmitInfo.isVisible && !aliasEmitInfo.asynchronousOutput) { - ts.Debug.assert(aliasEmitInfo.node.kind === 222); - createAndSetNewTextWriterWithSymbolWriter(); - ts.Debug.assert(aliasEmitInfo.indent === 1); - increaseIndent(); - writeImportDeclaration(aliasEmitInfo.node); - aliasEmitInfo.asynchronousOutput = writer.getText(); - decreaseIndent(); - } - }); - setWriter(oldWriter); - } - prevModuleElementDeclarationEmitInfo = prevModuleElementDeclarationEmitInfo.concat(moduleElementDeclarationEmitInfo); - moduleElementDeclarationEmitInfo = []; - } - }); - moduleElementDeclarationEmitInfo = moduleElementDeclarationEmitInfo.concat(prevModuleElementDeclarationEmitInfo); + } } return { reportedDeclarationError: reportedDeclarationError, - moduleElementDeclarationEmitInfo: moduleElementDeclarationEmitInfo, + moduleElementDeclarationEmitInfo: allSourcesModuleElementDeclarationEmitInfo, synchronousDeclarationOutput: writer.getText(), - referencePathsOutput: referencePathsOutput + referencesOutput: referencesOutput }; function hasInternalAnnotation(range) { var comment = currentText.substring(range.pos, range.end); @@ -24022,7 +27710,6 @@ var ts; writer.writeParameter = writer.write; writer.writeSymbol = writer.write; setWriter(writer); - return writer; } function setWriter(newWriter) { writer = newWriter; @@ -24036,10 +27723,10 @@ var ts; var oldWriter = writer; ts.forEach(nodes, function (declaration) { var nodeToCheck; - if (declaration.kind === 211) { + if (declaration.kind === 218) { nodeToCheck = declaration.parent.parent; } - else if (declaration.kind === 225 || declaration.kind === 226 || declaration.kind === 223) { + else if (declaration.kind === 233 || declaration.kind === 234 || declaration.kind === 231) { ts.Debug.fail("We should be getting ImportDeclaration instead to write"); } else { @@ -24050,7 +27737,7 @@ var ts; moduleElementEmitInfo = ts.forEach(asynchronousSubModuleDeclarationEmitInfo, function (declEmitInfo) { return declEmitInfo.node === nodeToCheck ? declEmitInfo : undefined; }); } if (moduleElementEmitInfo) { - if (moduleElementEmitInfo.node.kind === 222) { + if (moduleElementEmitInfo.node.kind === 230) { moduleElementEmitInfo.isVisible = true; } else { @@ -24058,12 +27745,12 @@ var ts; for (var declarationIndent = moduleElementEmitInfo.indent; declarationIndent; declarationIndent--) { increaseIndent(); } - if (nodeToCheck.kind === 218) { + if (nodeToCheck.kind === 225) { ts.Debug.assert(asynchronousSubModuleDeclarationEmitInfo === undefined); asynchronousSubModuleDeclarationEmitInfo = []; } writeModuleElement(nodeToCheck); - if (nodeToCheck.kind === 218) { + if (nodeToCheck.kind === 225) { moduleElementEmitInfo.subModuleElementDeclarationEmitInfo = asynchronousSubModuleDeclarationEmitInfo; asynchronousSubModuleDeclarationEmitInfo = undefined; } @@ -24073,31 +27760,47 @@ var ts; }); setWriter(oldWriter); } - function handleSymbolAccessibilityError(symbolAccesibilityResult) { - if (symbolAccesibilityResult.accessibility === 0) { - if (symbolAccesibilityResult && symbolAccesibilityResult.aliasesToMakeVisible) { - writeAsynchronousModuleElements(symbolAccesibilityResult.aliasesToMakeVisible); + function recordTypeReferenceDirectivesIfNecessary(typeReferenceDirectives) { + if (!typeReferenceDirectives) { + return; + } + if (!usedTypeDirectiveReferences) { + usedTypeDirectiveReferences = {}; + } + for (var _i = 0, typeReferenceDirectives_1 = typeReferenceDirectives; _i < typeReferenceDirectives_1.length; _i++) { + var directive = typeReferenceDirectives_1[_i]; + if (!ts.hasProperty(usedTypeDirectiveReferences, directive)) { + usedTypeDirectiveReferences[directive] = directive; + } + } + } + function handleSymbolAccessibilityError(symbolAccessibilityResult) { + if (symbolAccessibilityResult.accessibility === 0) { + if (symbolAccessibilityResult && symbolAccessibilityResult.aliasesToMakeVisible) { + writeAsynchronousModuleElements(symbolAccessibilityResult.aliasesToMakeVisible); } } else { reportedDeclarationError = true; - var errorInfo = writer.getSymbolAccessibilityDiagnostic(symbolAccesibilityResult); + var errorInfo = writer.getSymbolAccessibilityDiagnostic(symbolAccessibilityResult); if (errorInfo) { if (errorInfo.typeName) { - diagnostics.push(ts.createDiagnosticForNode(symbolAccesibilityResult.errorNode || errorInfo.errorNode, errorInfo.diagnosticMessage, ts.getTextOfNodeFromSourceText(currentText, errorInfo.typeName), symbolAccesibilityResult.errorSymbolName, symbolAccesibilityResult.errorModuleName)); + emitterDiagnostics.add(ts.createDiagnosticForNode(symbolAccessibilityResult.errorNode || errorInfo.errorNode, errorInfo.diagnosticMessage, ts.getTextOfNodeFromSourceText(currentText, errorInfo.typeName), symbolAccessibilityResult.errorSymbolName, symbolAccessibilityResult.errorModuleName)); } else { - diagnostics.push(ts.createDiagnosticForNode(symbolAccesibilityResult.errorNode || errorInfo.errorNode, errorInfo.diagnosticMessage, symbolAccesibilityResult.errorSymbolName, symbolAccesibilityResult.errorModuleName)); + emitterDiagnostics.add(ts.createDiagnosticForNode(symbolAccessibilityResult.errorNode || errorInfo.errorNode, errorInfo.diagnosticMessage, symbolAccessibilityResult.errorSymbolName, symbolAccessibilityResult.errorModuleName)); } } } } function trackSymbol(symbol, enclosingDeclaration, meaning) { handleSymbolAccessibilityError(resolver.isSymbolAccessible(symbol, enclosingDeclaration, meaning)); + recordTypeReferenceDirectivesIfNecessary(resolver.getTypeReferenceDirectivesForSymbol(symbol, meaning)); } function reportInaccessibleThisError() { if (errorNameNode) { - diagnostics.push(ts.createDiagnosticForNode(errorNameNode, ts.Diagnostics.The_inferred_type_of_0_references_an_inaccessible_this_type_A_type_annotation_is_necessary, ts.declarationNameToString(errorNameNode))); + reportedDeclarationError = true; + emitterDiagnostics.add(ts.createDiagnosticForNode(errorNameNode, ts.Diagnostics.The_inferred_type_of_0_references_an_inaccessible_this_type_A_type_annotation_is_necessary, ts.declarationNameToString(errorNameNode))); } } function writeTypeOfDeclaration(declaration, type, getSymbolAccessibilityDiagnostic) { @@ -24160,40 +27863,43 @@ var ts; function emitType(type) { switch (type.kind) { case 117: + case 132: case 130: - case 128: case 120: - case 131: + case 133: case 103: - case 97: - case 9: + case 135: + case 93: + case 127: + case 165: + case 166: return writeTextOfNode(currentText, type); - case 188: + case 194: return emitExpressionWithTypeArguments(type); - case 151: - return emitTypeReference(type); - case 154: - return emitTypeQuery(type); - case 156: - return emitArrayType(type); - case 157: - return emitTupleType(type); - case 158: - return emitUnionType(type); - case 159: - return emitIntersectionType(type); - case 160: - return emitParenType(type); - case 152: - case 153: - return emitSignatureDeclarationWithJsDocComments(type); case 155: + return emitTypeReference(type); + case 158: + return emitTypeQuery(type); + case 160: + return emitArrayType(type); + case 161: + return emitTupleType(type); + case 162: + return emitUnionType(type); + case 163: + return emitIntersectionType(type); + case 164: + return emitParenType(type); + case 156: + case 157: + return emitSignatureDeclarationWithJsDocComments(type); + case 159: return emitTypeLiteral(type); case 69: return emitEntityName(type); - case 135: + case 139: return emitEntityName(type); - case 150: + case 154: return emitTypePredicate(type); } function writeEntityName(entityName) { @@ -24201,21 +27907,22 @@ var ts; writeTextOfNode(currentText, entityName); } else { - var left = entityName.kind === 135 ? entityName.left : entityName.expression; - var right = entityName.kind === 135 ? entityName.right : entityName.name; + var left = entityName.kind === 139 ? entityName.left : entityName.expression; + var right = entityName.kind === 139 ? entityName.right : entityName.name; writeEntityName(left); write("."); writeTextOfNode(currentText, right); } } function emitEntityName(entityName) { - var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 221 ? entityName.parent : enclosingDeclaration); + var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 229 ? entityName.parent : enclosingDeclaration); handleSymbolAccessibilityError(visibilityResult); + recordTypeReferenceDirectivesIfNecessary(resolver.getTypeReferenceDirectivesForEntityName(entityName)); writeEntityName(entityName); } function emitExpressionWithTypeArguments(node) { if (ts.isSupportedExpressionWithTypeArguments(node)) { - ts.Debug.assert(node.expression.kind === 69 || node.expression.kind === 166); + ts.Debug.assert(node.expression.kind === 69 || node.expression.kind === 172); emitEntityName(node.expression); if (node.typeArguments) { write("<"); @@ -24288,9 +27995,10 @@ var ts; } var count = 0; while (true) { - var name_19 = baseName + "_" + (++count); - if (!ts.hasProperty(currentIdentifiers, name_19)) { - return name_19; + count++; + var name_22 = baseName + "_" + count; + if (!ts.hasProperty(currentIdentifiers, name_22)) { + return name_22; } } } @@ -24301,7 +28009,10 @@ var ts; } else { var tempVarName = getExportDefaultTempVariableName(); - write("declare var "); + if (!noDeclare) { + write("declare "); + } + write("var "); write(tempVarName); write(": "); writer.getSymbolAccessibilityDiagnostic = getDefaultExportAccessibilityDiagnostic; @@ -24331,10 +28042,10 @@ var ts; if (isModuleElementVisible) { writeModuleElement(node); } - else if (node.kind === 221 || - (node.parent.kind === 248 && isCurrentFileExternalModule)) { - var isVisible; - if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 248) { + else if (node.kind === 229 || + (node.parent.kind === 256 && isCurrentFileExternalModule)) { + var isVisible = void 0; + if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 256) { asynchronousSubModuleDeclarationEmitInfo.push({ node: node, outputPos: writer.getTextPos(), @@ -24343,7 +28054,7 @@ var ts; }); } else { - if (node.kind === 222) { + if (node.kind === 230) { var importDeclaration = node; if (importDeclaration.importClause) { isVisible = (importDeclaration.importClause.name && resolver.isDeclarationVisible(importDeclaration.importClause)) || @@ -24361,58 +28072,61 @@ var ts; } function writeModuleElement(node) { switch (node.kind) { - case 213: + case 220: return writeFunctionDeclaration(node); - case 193: + case 200: return writeVariableStatement(node); - case 215: - return writeInterfaceDeclaration(node); - case 214: - return writeClassDeclaration(node); - case 216: - return writeTypeAliasDeclaration(node); - case 217: - return writeEnumDeclaration(node); - case 218: - return writeModuleDeclaration(node); - case 221: - return writeImportEqualsDeclaration(node); case 222: + return writeInterfaceDeclaration(node); + case 221: + return writeClassDeclaration(node); + case 223: + return writeTypeAliasDeclaration(node); + case 224: + return writeEnumDeclaration(node); + case 225: + return writeModuleDeclaration(node); + case 229: + return writeImportEqualsDeclaration(node); + case 230: return writeImportDeclaration(node); default: ts.Debug.fail("Unknown symbol kind"); } } function emitModuleElementDeclarationFlags(node) { - if (node.parent.kind === 248) { - if (node.flags & 2) { + if (node.parent.kind === 256) { + if (node.flags & 1) { write("export "); } if (node.flags & 512) { write("default "); } - else if (node.kind !== 215 && !noDeclare) { + else if (node.kind !== 222 && !noDeclare) { write("declare "); } } } - function emitClassMemberDeclarationFlags(node) { - if (node.flags & 16) { + function emitClassMemberDeclarationFlags(flags) { + if (flags & 8) { write("private "); } - else if (node.flags & 32) { + else if (flags & 16) { write("protected "); } - if (node.flags & 64) { + if (flags & 32) { write("static "); } - if (node.flags & 128) { + if (flags & 64) { + write("readonly "); + } + if (flags & 128) { write("abstract "); } } function writeImportEqualsDeclaration(node) { emitJsDocComments(node); - if (node.flags & 2) { + if (node.flags & 1) { write("export "); } write("import "); @@ -24424,11 +28138,11 @@ var ts; } else { write("require("); - writeTextOfNode(currentText, ts.getExternalModuleImportEqualsDeclarationExpression(node)); + emitExternalModuleSpecifier(node); write(");"); } writer.writeLine(); - function getImportEntityNameVisibilityError(symbolAccesibilityResult) { + function getImportEntityNameVisibilityError(symbolAccessibilityResult) { return { diagnosticMessage: ts.Diagnostics.Import_declaration_0_is_using_private_name_1, errorNode: node, @@ -24438,7 +28152,7 @@ var ts; } function isVisibleNamedBinding(namedBindings) { if (namedBindings) { - if (namedBindings.kind === 224) { + if (namedBindings.kind === 232) { return resolver.isDeclarationVisible(namedBindings); } else { @@ -24447,11 +28161,8 @@ var ts; } } function writeImportDeclaration(node) { - if (!node.importClause && !(node.flags & 2)) { - return; - } emitJsDocComments(node); - if (node.flags & 2) { + if (node.flags & 1) { write("export "); } write("import "); @@ -24464,7 +28175,7 @@ var ts; if (currentWriterPos !== writer.getTextPos()) { write(", "); } - if (node.importClause.namedBindings.kind === 224) { + if (node.importClause.namedBindings.kind === 232) { write("* as "); writeTextOfNode(currentText, node.importClause.namedBindings.name); } @@ -24476,17 +28187,30 @@ var ts; } write(" from "); } - emitExternalModuleSpecifier(node.moduleSpecifier); + emitExternalModuleSpecifier(node); write(";"); writer.writeLine(); } - function emitExternalModuleSpecifier(moduleSpecifier) { - if (moduleSpecifier.kind === 9 && (!root) && (compilerOptions.out || compilerOptions.outFile)) { - var moduleName = ts.getExternalModuleNameFromDeclaration(host, resolver, moduleSpecifier.parent); + function emitExternalModuleSpecifier(parent) { + resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || parent.kind !== 225; + var moduleSpecifier; + if (parent.kind === 229) { + var node = parent; + moduleSpecifier = ts.getExternalModuleImportEqualsDeclarationExpression(node); + } + else if (parent.kind === 225) { + moduleSpecifier = parent.name; + } + else { + var node = parent; + moduleSpecifier = node.moduleSpecifier; + } + if (moduleSpecifier.kind === 9 && isBundledEmit && (compilerOptions.out || compilerOptions.outFile)) { + var moduleName = ts.getExternalModuleNameFromDeclaration(host, resolver, parent); if (moduleName) { - write("\""); + write('"'); write(moduleName); - write("\""); + write('"'); return; } } @@ -24517,7 +28241,7 @@ var ts; } if (node.moduleSpecifier) { write(" from "); - emitExternalModuleSpecifier(node.moduleSpecifier); + emitExternalModuleSpecifier(node); } write(";"); writer.writeLine(); @@ -24525,14 +28249,24 @@ var ts; function writeModuleDeclaration(node) { emitJsDocComments(node); emitModuleElementDeclarationFlags(node); - if (node.flags & 65536) { - write("namespace "); + if (ts.isGlobalScopeAugmentation(node)) { + write("global "); } else { - write("module "); + if (node.flags & 4096) { + write("namespace "); + } + else { + write("module "); + } + if (ts.isExternalModuleAugmentation(node)) { + emitExternalModuleSpecifier(node); + } + else { + writeTextOfNode(currentText, node.name); + } } - writeTextOfNode(currentText, node.name); - while (node.body.kind !== 219) { + while (node.body.kind !== 226) { node = node.body; write("."); writeTextOfNode(currentText, node.name); @@ -24561,7 +28295,7 @@ var ts; write(";"); writeLine(); enclosingDeclaration = prevEnclosingDeclaration; - function getTypeAliasDeclarationVisibilityError(symbolAccesibilityResult) { + function getTypeAliasDeclarationVisibilityError(symbolAccessibilityResult) { return { diagnosticMessage: ts.Diagnostics.Exported_type_alias_0_has_or_is_using_private_name_1, errorNode: node.type, @@ -24597,7 +28331,7 @@ var ts; writeLine(); } function isPrivateMethodTypeParameter(node) { - return node.parent.kind === 143 && (node.parent.flags & 16); + return node.parent.kind === 147 && (node.parent.flags & 8); } function emitTypeParameters(typeParameters) { function emitTypeParameter(node) { @@ -24607,49 +28341,49 @@ var ts; writeTextOfNode(currentText, node.name); if (node.constraint && !isPrivateMethodTypeParameter(node)) { write(" extends "); - if (node.parent.kind === 152 || - node.parent.kind === 153 || - (node.parent.parent && node.parent.parent.kind === 155)) { - ts.Debug.assert(node.parent.kind === 143 || - node.parent.kind === 142 || - node.parent.kind === 152 || - node.parent.kind === 153 || - node.parent.kind === 147 || - node.parent.kind === 148); + if (node.parent.kind === 156 || + node.parent.kind === 157 || + (node.parent.parent && node.parent.parent.kind === 159)) { + ts.Debug.assert(node.parent.kind === 147 || + node.parent.kind === 146 || + node.parent.kind === 156 || + node.parent.kind === 157 || + node.parent.kind === 151 || + node.parent.kind === 152); emitType(node.constraint); } else { emitTypeWithNewGetSymbolAccessibilityDiagnostic(node.constraint, getTypeParameterConstraintVisibilityError); } } - function getTypeParameterConstraintVisibilityError(symbolAccesibilityResult) { + function getTypeParameterConstraintVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; switch (node.parent.kind) { - case 214: + case 221: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; - case 215: + case 222: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; - case 148: + case 152: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 147: + case 151: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 143: - case 142: - if (node.parent.flags & 64) { + case 147: + case 146: + if (node.parent.flags & 32) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 214) { + else if (node.parent.parent.kind === 221) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } break; - case 213: + case 220: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; default: @@ -24680,9 +28414,13 @@ var ts; else if (!isImplementsList && node.expression.kind === 93) { write("null"); } - function getHeritageClauseVisibilityError(symbolAccesibilityResult) { + else { + writer.getSymbolAccessibilityDiagnostic = getHeritageClauseVisibilityError; + resolver.writeBaseConstructorTypeOfClass(enclosingDeclaration, enclosingDeclaration, 2, writer); + } + function getHeritageClauseVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; - if (node.parent.parent.kind === 214) { + if (node.parent.parent.kind === 221) { diagnosticMessage = isImplementsList ? ts.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 : ts.Diagnostics.Extends_clause_of_exported_class_0_has_or_is_using_private_name_1; @@ -24702,7 +28440,7 @@ var ts; function emitParameterProperties(constructorDeclaration) { if (constructorDeclaration) { ts.forEach(constructorDeclaration.parameters, function (param) { - if (param.flags & 56) { + if (param.flags & 92) { emitPropertyDeclaration(param); } }); @@ -24756,61 +28494,61 @@ var ts; return; } emitJsDocComments(node); - emitClassMemberDeclarationFlags(node); + emitClassMemberDeclarationFlags(node.flags); emitVariableDeclaration(node); write(";"); writeLine(); } function emitVariableDeclaration(node) { - if (node.kind !== 211 || resolver.isDeclarationVisible(node)) { + if (node.kind !== 218 || resolver.isDeclarationVisible(node)) { if (ts.isBindingPattern(node.name)) { emitBindingPattern(node.name); } else { writeTextOfNode(currentText, node.name); - if ((node.kind === 141 || node.kind === 140) && ts.hasQuestionToken(node)) { + if ((node.kind === 145 || node.kind === 144 || node.kind === 142) && ts.hasQuestionToken(node)) { write("?"); } - if ((node.kind === 141 || node.kind === 140) && node.parent.kind === 155) { + if ((node.kind === 145 || node.kind === 144) && node.parent.kind === 159) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } - else if (!(node.flags & 16)) { + else if (!(node.flags & 8)) { writeTypeOfDeclaration(node, node.type, getVariableDeclarationTypeVisibilityError); } } } - function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult) { - if (node.kind === 211) { - return symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? + function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { + if (node.kind === 218) { + return symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Exported_variable_0_has_or_is_using_private_name_1; } - else if (node.kind === 141 || node.kind === 140) { - if (node.flags & 64) { - return symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? + else if (node.kind === 145 || node.kind === 144) { + if (node.flags & 32) { + return symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.kind === 214) { - return symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? + else if (node.parent.kind === 221) { + return symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_private_name_1; } else { - return symbolAccesibilityResult.errorModuleName ? + return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_private_name_1; } } } - function getVariableDeclarationTypeVisibilityError(symbolAccesibilityResult) { - var diagnosticMessage = getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult); + function getVariableDeclarationTypeVisibilityError(symbolAccessibilityResult) { + var diagnosticMessage = getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult); return diagnosticMessage !== undefined ? { diagnosticMessage: diagnosticMessage, errorNode: node, @@ -24821,15 +28559,15 @@ var ts; var elements = []; for (var _i = 0, _a = bindingPattern.elements; _i < _a.length; _i++) { var element = _a[_i]; - if (element.kind !== 187) { + if (element.kind !== 193) { elements.push(element); } } emitCommaList(elements, emitBindingElement); } function emitBindingElement(bindingElement) { - function getBindingElementTypeVisibilityError(symbolAccesibilityResult) { - var diagnosticMessage = getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult); + function getBindingElementTypeVisibilityError(symbolAccessibilityResult) { + var diagnosticMessage = getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult); return diagnosticMessage !== undefined ? { diagnosticMessage: diagnosticMessage, errorNode: bindingElement, @@ -24881,13 +28619,13 @@ var ts; if (node === accessors.firstAccessor) { emitJsDocComments(accessors.getAccessor); emitJsDocComments(accessors.setAccessor); - emitClassMemberDeclarationFlags(node); + emitClassMemberDeclarationFlags(node.flags | (accessors.setAccessor ? 0 : 64)); writeTextOfNode(currentText, node.name); - if (!(node.flags & 16)) { + if (!(node.flags & 8)) { accessorWithTypeAnnotation = node; var type = getTypeAnnotationFromAccessor(node); if (!type) { - var anotherAccessor = node.kind === 145 ? accessors.setAccessor : accessors.getAccessor; + var anotherAccessor = node.kind === 149 ? accessors.setAccessor : accessors.getAccessor; type = getTypeAnnotationFromAccessor(anotherAccessor); if (type) { accessorWithTypeAnnotation = anotherAccessor; @@ -24900,23 +28638,23 @@ var ts; } function getTypeAnnotationFromAccessor(accessor) { if (accessor) { - return accessor.kind === 145 + return accessor.kind === 149 ? accessor.type : accessor.parameters.length > 0 ? accessor.parameters[0].type : undefined; } } - function getAccessorDeclarationTypeVisibilityError(symbolAccesibilityResult) { + function getAccessorDeclarationTypeVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; - if (accessorWithTypeAnnotation.kind === 146) { - if (accessorWithTypeAnnotation.parent.flags & 64) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + if (accessorWithTypeAnnotation.kind === 150) { + if (accessorWithTypeAnnotation.parent.flags & 32) { + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1; } else { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1; } @@ -24927,16 +28665,16 @@ var ts; }; } else { - if (accessorWithTypeAnnotation.flags & 64) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? + if (accessorWithTypeAnnotation.flags & 32) { + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0; } else { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0; @@ -24955,17 +28693,17 @@ var ts; } if (!resolver.isImplementationOfOverload(node)) { emitJsDocComments(node); - if (node.kind === 213) { + if (node.kind === 220) { emitModuleElementDeclarationFlags(node); } - else if (node.kind === 143) { - emitClassMemberDeclarationFlags(node); + else if (node.kind === 147 || node.kind === 148) { + emitClassMemberDeclarationFlags(node.flags); } - if (node.kind === 213) { + if (node.kind === 220) { write("function "); writeTextOfNode(currentText, node.name); } - else if (node.kind === 144) { + else if (node.kind === 148) { write("constructor"); } else { @@ -24982,33 +28720,42 @@ var ts; emitSignatureDeclaration(node); } function emitSignatureDeclaration(node) { - if (node.kind === 148 || node.kind === 153) { - write("new "); - } - emitTypeParameters(node.typeParameters); - if (node.kind === 149) { + var prevEnclosingDeclaration = enclosingDeclaration; + enclosingDeclaration = node; + var closeParenthesizedFunctionType = false; + if (node.kind === 153) { + emitClassMemberDeclarationFlags(node.flags); write("["); } else { + if (node.kind === 152 || node.kind === 157) { + write("new "); + } + else if (node.kind === 156) { + var currentOutput = writer.getText(); + if (node.typeParameters && currentOutput.charAt(currentOutput.length - 1) === "<") { + closeParenthesizedFunctionType = true; + write("("); + } + } + emitTypeParameters(node.typeParameters); write("("); } - var prevEnclosingDeclaration = enclosingDeclaration; - enclosingDeclaration = node; emitCommaList(node.parameters, emitParameterDeclaration); - if (node.kind === 149) { + if (node.kind === 153) { write("]"); } else { write(")"); } - var isFunctionTypeOrConstructorType = node.kind === 152 || node.kind === 153; - if (isFunctionTypeOrConstructorType || node.parent.kind === 155) { + var isFunctionTypeOrConstructorType = node.kind === 156 || node.kind === 157; + if (isFunctionTypeOrConstructorType || node.parent.kind === 159) { if (node.type) { write(isFunctionTypeOrConstructorType ? " => " : ": "); emitType(node.type); } } - else if (node.kind !== 144 && !(node.flags & 16)) { + else if (node.kind !== 148 && !(node.flags & 8)) { writeReturnTypeAtSignature(node, getReturnTypeVisibilityError); } enclosingDeclaration = prevEnclosingDeclaration; @@ -25016,49 +28763,52 @@ var ts; write(";"); writeLine(); } - function getReturnTypeVisibilityError(symbolAccesibilityResult) { + else if (closeParenthesizedFunctionType) { + write(")"); + } + function getReturnTypeVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; switch (node.kind) { - case 148: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + case 152: + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 147: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + case 151: + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 149: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + case 153: + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 143: - case 142: - if (node.flags & 64) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? + case 147: + case 146: + if (node.flags & 32) { + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0; } - else if (node.parent.kind === 214) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? + else if (node.parent.kind === 221) { + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0; } else { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; - case 213: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? + case 220: + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_private_name_0; @@ -25088,62 +28838,62 @@ var ts; write("?"); } decreaseIndent(); - if (node.parent.kind === 152 || - node.parent.kind === 153 || - node.parent.parent.kind === 155) { + if (node.parent.kind === 156 || + node.parent.kind === 157 || + node.parent.parent.kind === 159) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } - else if (!(node.parent.flags & 16)) { + else if (!(node.parent.flags & 8)) { writeTypeOfDeclaration(node, node.type, getParameterDeclarationTypeVisibilityError); } - function getParameterDeclarationTypeVisibilityError(symbolAccesibilityResult) { - var diagnosticMessage = getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult); + function getParameterDeclarationTypeVisibilityError(symbolAccessibilityResult) { + var diagnosticMessage = getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult); return diagnosticMessage !== undefined ? { diagnosticMessage: diagnosticMessage, errorNode: node, typeName: node.name } : undefined; } - function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult) { + function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { switch (node.parent.kind) { - case 144: - return symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? + case 148: + return symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1; - case 148: - return symbolAccesibilityResult.errorModuleName ? + case 152: + return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; - case 147: - return symbolAccesibilityResult.errorModuleName ? + case 151: + return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; - case 143: - case 142: - if (node.parent.flags & 64) { - return symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? + case 147: + case 146: + if (node.parent.flags & 32) { + return symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 214) { - return symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? + else if (node.parent.parent.kind === 221) { + return symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { - return symbolAccesibilityResult.errorModuleName ? + return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } - case 213: - return symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? + case 220: + return symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1; @@ -25152,12 +28902,12 @@ var ts; } } function emitBindingPattern(bindingPattern) { - if (bindingPattern.kind === 161) { + if (bindingPattern.kind === 167) { write("{"); emitCommaList(bindingPattern.elements, emitBindingElement); write("}"); } - else if (bindingPattern.kind === 162) { + else if (bindingPattern.kind === 168) { write("["); var elements = bindingPattern.elements; emitCommaList(elements, emitBindingElement); @@ -25168,18 +28918,10 @@ var ts; } } function emitBindingElement(bindingElement) { - function getBindingElementTypeVisibilityError(symbolAccesibilityResult) { - var diagnosticMessage = getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult); - return diagnosticMessage !== undefined ? { - diagnosticMessage: diagnosticMessage, - errorNode: bindingElement, - typeName: bindingElement.name - } : undefined; - } - if (bindingElement.kind === 187) { + if (bindingElement.kind === 193) { write(" "); } - else if (bindingElement.kind === 163) { + else if (bindingElement.kind === 169) { if (bindingElement.propertyName) { writeTextOfNode(currentText, bindingElement.propertyName); write(": "); @@ -25201,59 +28943,75 @@ var ts; } function emitNode(node) { switch (node.kind) { - case 213: - case 218: - case 221: - case 215: - case 214: - case 216: - case 217: - return emitModuleElement(node, isModuleElementVisible(node)); - case 193: - return emitModuleElement(node, isVariableStatementVisible(node)); + case 220: + case 225: + case 229: case 222: + case 221: + case 223: + case 224: + return emitModuleElement(node, isModuleElementVisible(node)); + case 200: + return emitModuleElement(node, isVariableStatementVisible(node)); + case 230: return emitModuleElement(node, !node.importClause); - case 228: + case 236: return emitExportDeclaration(node); - case 144: - case 143: - case 142: - return writeFunctionDeclaration(node); case 148: case 147: - case 149: - return emitSignatureDeclarationWithJsDocComments(node); - case 145: case 146: + return writeFunctionDeclaration(node); + case 152: + case 151: + case 153: + return emitSignatureDeclarationWithJsDocComments(node); + case 149: + case 150: return emitAccessorDeclaration(node); - case 141: - case 140: + case 145: + case 144: return emitPropertyDeclaration(node); - case 247: + case 255: return emitEnumMemberDeclaration(node); - case 227: + case 235: return emitExportAssignment(node); - case 248: + case 256: return emitSourceFile(node); } } - function writeReferencePath(referencedFile) { - var declFileName = referencedFile.flags & 4096 - ? referencedFile.fileName - : ts.shouldEmitToOwnFile(referencedFile, compilerOptions) - ? ts.getOwnEmitOutputFilePath(referencedFile, host, ".d.ts") - : ts.removeFileExtension(compilerOptions.outFile || compilerOptions.out) + ".d.ts"; - declFileName = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizeSlashes(jsFilePath)), declFileName, host.getCurrentDirectory(), host.getCanonicalFileName, false); - referencePathsOutput += "/// " + newLine; + function writeReferencePath(referencedFile, addBundledFileReference) { + var declFileName; + var addedBundledEmitReference = false; + if (ts.isDeclarationFile(referencedFile)) { + declFileName = referencedFile.fileName; + } + else { + ts.forEachExpectedEmitFile(host, getDeclFileName, referencedFile); + } + if (declFileName) { + declFileName = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizeSlashes(declarationFilePath)), declFileName, host.getCurrentDirectory(), host.getCanonicalFileName, false); + referencesOutput += "/// " + newLine; + } + return addedBundledEmitReference; + function getDeclFileName(emitFileNames, sourceFiles, isBundledEmit) { + if (isBundledEmit && !addBundledFileReference) { + return; + } + ts.Debug.assert(!!emitFileNames.declarationFilePath || ts.isSourceFileJavaScript(referencedFile), "Declaration file is not present only for javascript files"); + declFileName = emitFileNames.declarationFilePath || emitFileNames.jsFilePath; + addedBundledEmitReference = isBundledEmit; + } } } - function writeDeclarationFile(jsFilePath, sourceFile, host, resolver, diagnostics) { - var emitDeclarationResult = emitDeclarations(host, resolver, diagnostics, jsFilePath, sourceFile); - if (!emitDeclarationResult.reportedDeclarationError) { - var declarationOutput = emitDeclarationResult.referencePathsOutput + function writeDeclarationFile(declarationFilePath, sourceFiles, isBundledEmit, host, resolver, emitterDiagnostics) { + var emitDeclarationResult = emitDeclarations(host, resolver, emitterDiagnostics, declarationFilePath, sourceFiles, isBundledEmit); + var emitSkipped = emitDeclarationResult.reportedDeclarationError || host.isEmitBlocked(declarationFilePath) || host.getCompilerOptions().noEmit; + if (!emitSkipped) { + var declarationOutput = emitDeclarationResult.referencesOutput + getDeclarationOutput(emitDeclarationResult.synchronousDeclarationOutput, emitDeclarationResult.moduleElementDeclarationEmitInfo); - ts.writeFile(host, diagnostics, ts.removeFileExtension(jsFilePath) + ".d.ts", declarationOutput, host.getCompilerOptions().emitBOM); + ts.writeFile(host, emitterDiagnostics, declarationFilePath, declarationOutput, host.getCompilerOptions().emitBOM, sourceFiles); } + return emitSkipped; function getDeclarationOutput(synchronousDeclarationOutput, moduleElementDeclarationEmitInfo) { var appliedSyncOutputPos = 0; var declarationOutput = ""; @@ -25272,10 +29030,6 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { - function isExternalModuleOrDeclarationFile(sourceFile) { - return ts.isExternalModule(sourceFile) || ts.isDeclarationFile(sourceFile); - } - ts.isExternalModuleOrDeclarationFile = isExternalModuleOrDeclarationFile; function getResolvedExternalModuleName(host, file) { return file.moduleName || ts.getExternalModuleNameFromPath(host, file.fileName); } @@ -25545,46 +29299,25 @@ var ts; }; function emitFiles(resolver, host, targetSourceFile) { var extendsHelper = "\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};"; + var assignHelper = "\nvar __assign = (this && this.__assign) || Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n};"; var decorateHelper = "\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};"; var metadataHelper = "\nvar __metadata = (this && this.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};"; var paramHelper = "\nvar __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n};"; - var awaiterHelper = "\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promise, generator) {\n return new Promise(function (resolve, reject) {\n generator = generator.call(thisArg, _arguments);\n function cast(value) { return value instanceof Promise && value.constructor === Promise ? value : new Promise(function (resolve) { resolve(value); }); }\n function onfulfill(value) { try { step(\"next\", value); } catch (e) { reject(e); } }\n function onreject(value) { try { step(\"throw\", value); } catch (e) { reject(e); } }\n function step(verb, value) {\n var result = generator[verb](value);\n result.done ? resolve(result.value) : cast(result.value).then(onfulfill, onreject);\n }\n step(\"next\", void 0);\n });\n};"; + var awaiterHelper = "\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator.throw(value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments)).next());\n });\n};"; var compilerOptions = host.getCompilerOptions(); - var languageVersion = compilerOptions.target || 0; - var modulekind = compilerOptions.module ? compilerOptions.module : languageVersion === 2 ? 5 : 0; + var languageVersion = ts.getEmitScriptTarget(compilerOptions); + var modulekind = ts.getEmitModuleKind(compilerOptions); var sourceMapDataList = compilerOptions.sourceMap || compilerOptions.inlineSourceMap ? [] : undefined; - var diagnostics = []; + var emittedFilesList = compilerOptions.listEmittedFiles ? [] : undefined; + var emitterDiagnostics = ts.createDiagnosticCollection(); + var emitSkipped = false; var newLine = host.getNewLine(); - var jsxDesugaring = host.getCompilerOptions().jsx !== 1; - var shouldEmitJsx = function (s) { return (s.languageVariant === 1 && !jsxDesugaring); }; - var outFile = compilerOptions.outFile || compilerOptions.out; var emitJavaScript = createFileEmitter(); - if (targetSourceFile === undefined) { - if (outFile) { - emitFile(outFile); - } - else { - ts.forEach(host.getSourceFiles(), function (sourceFile) { - if (ts.shouldEmitToOwnFile(sourceFile, compilerOptions)) { - var jsFilePath = ts.getOwnEmitOutputFilePath(sourceFile, host, shouldEmitJsx(sourceFile) ? ".jsx" : ".js"); - emitFile(jsFilePath, sourceFile); - } - }); - } - } - else { - if (ts.shouldEmitToOwnFile(targetSourceFile, compilerOptions)) { - var jsFilePath = ts.getOwnEmitOutputFilePath(targetSourceFile, host, shouldEmitJsx(targetSourceFile) ? ".jsx" : ".js"); - emitFile(jsFilePath, targetSourceFile); - } - else if (!ts.isDeclarationFile(targetSourceFile) && outFile) { - emitFile(outFile); - } - } - diagnostics = ts.sortAndDeduplicateDiagnostics(diagnostics); + ts.forEachExpectedEmitFile(host, emitFile, targetSourceFile); return { - emitSkipped: false, - diagnostics: diagnostics, + emitSkipped: emitSkipped, + diagnostics: emitterDiagnostics.getDiagnostics(), + emittedFiles: emittedFilesList, sourceMaps: sourceMapDataList }; function isUniqueLocalName(name, container) { @@ -25631,6 +29364,8 @@ var ts; function createFileEmitter() { var writer = ts.createTextWriter(newLine); var write = writer.write, writeTextOfNode = writer.writeTextOfNode, writeLine = writer.writeLine, increaseIndent = writer.increaseIndent, decreaseIndent = writer.decreaseIndent; + var sourceMap = compilerOptions.sourceMap || compilerOptions.inlineSourceMap ? ts.createSourceMapWriter(host, writer) : ts.getNullSourceMapWriter(); + var setSourceFile = sourceMap.setSourceFile, emitStart = sourceMap.emitStart, emitEnd = sourceMap.emitEnd, emitPos = sourceMap.emitPos; var currentSourceFile; var currentText; var currentLineMap; @@ -25639,106 +29374,104 @@ var ts; var isEs6Module; var isCurrentFileExternalModule; var exportFunctionForFile; + var contextObjectForFile; var generatedNameSet; var nodeToGeneratedName; var computedPropertyNamesToGeneratedNames; + var decoratedClassAliases; var convertedLoopState; var extendsEmitted; + var assignEmitted; var decorateEmitted; var paramEmitted; var awaiterEmitted; - var tempFlags; + var tempFlags = 0; var tempVariables; var tempParameters; var externalImports; var exportSpecifiers; var exportEquals; - var hasExportStars; - var writeEmittedFiles = writeJavaScriptFile; + var hasExportStarsToExportValues; var detachedCommentsInfo; - var writeComment = ts.writeCommentRange; - var emit = emitNodeWithCommentsAndWithoutSourcemap; - var emitStart = function (node) { }; - var emitEnd = function (node) { }; - var emitToken = emitTokenText; - var scopeEmitStart = function (scopeDeclaration, scopeName) { }; - var scopeEmitEnd = function () { }; var sourceMapData; - var root; + var isOwnFileEmit; var emitLeadingCommentsOfPosition = compilerOptions.removeComments ? function (pos) { } : emitLeadingCommentsOfPositionWorker; + var setSourceMapWriterEmit = compilerOptions.sourceMap || compilerOptions.inlineSourceMap ? changeSourceMapEmit : function (writer) { }; var moduleEmitDelegates = (_a = {}, - _a[5] = emitES6Module, - _a[2] = emitAMDModule, - _a[4] = emitSystemModule, - _a[3] = emitUMDModule, - _a[1] = emitCommonJSModule, + _a[ts.ModuleKind.ES6] = emitES6Module, + _a[ts.ModuleKind.AMD] = emitAMDModule, + _a[ts.ModuleKind.System] = emitSystemModule, + _a[ts.ModuleKind.UMD] = emitUMDModule, + _a[ts.ModuleKind.CommonJS] = emitCommonJSModule, _a ); var bundleEmitDelegates = (_b = {}, - _b[5] = function () { }, - _b[2] = emitAMDModule, - _b[4] = emitSystemModule, - _b[3] = function () { }, - _b[1] = function () { }, + _b[ts.ModuleKind.ES6] = function () { }, + _b[ts.ModuleKind.AMD] = emitAMDModule, + _b[ts.ModuleKind.System] = emitSystemModule, + _b[ts.ModuleKind.UMD] = function () { }, + _b[ts.ModuleKind.CommonJS] = function () { }, _b ); return doEmit; - function doEmit(jsFilePath, rootFile) { + function doEmit(jsFilePath, sourceMapFilePath, sourceFiles, isBundledEmit) { + sourceMap.initialize(jsFilePath, sourceMapFilePath, sourceFiles, isBundledEmit); + generatedNameSet = {}; + nodeToGeneratedName = []; + decoratedClassAliases = []; + isOwnFileEmit = !isBundledEmit; + if (isBundledEmit && modulekind) { + ts.forEach(sourceFiles, emitEmitHelpers); + } + ts.forEach(sourceFiles, emitSourceFile); + writeLine(); + var sourceMappingURL = sourceMap.getSourceMappingURL(); + if (sourceMappingURL) { + write("//# sourceMappingURL=" + sourceMappingURL); + } + writeEmittedFiles(writer.getText(), jsFilePath, sourceMapFilePath, compilerOptions.emitBOM, sourceFiles); + sourceMap.reset(); writer.reset(); currentSourceFile = undefined; currentText = undefined; currentLineMap = undefined; exportFunctionForFile = undefined; - generatedNameSet = {}; - nodeToGeneratedName = []; + contextObjectForFile = undefined; + generatedNameSet = undefined; + nodeToGeneratedName = undefined; + decoratedClassAliases = undefined; computedPropertyNamesToGeneratedNames = undefined; convertedLoopState = undefined; extendsEmitted = false; decorateEmitted = false; paramEmitted = false; awaiterEmitted = false; + assignEmitted = false; tempFlags = 0; tempVariables = undefined; tempParameters = undefined; externalImports = undefined; exportSpecifiers = undefined; exportEquals = undefined; - hasExportStars = undefined; + hasExportStarsToExportValues = undefined; detachedCommentsInfo = undefined; sourceMapData = undefined; isEs6Module = false; renamedDependencies = undefined; isCurrentFileExternalModule = false; - root = rootFile; - if (compilerOptions.sourceMap || compilerOptions.inlineSourceMap) { - initializeEmitterWithSourceMaps(jsFilePath, root); - } - if (root) { - emitSourceFile(root); - } - else { - if (modulekind) { - ts.forEach(host.getSourceFiles(), emitEmitHelpers); - } - ts.forEach(host.getSourceFiles(), function (sourceFile) { - if ((!isExternalModuleOrDeclarationFile(sourceFile)) || (modulekind && ts.isExternalModule(sourceFile))) { - emitSourceFile(sourceFile); - } - }); - } - writeLine(); - writeEmittedFiles(writer.getText(), jsFilePath, compilerOptions.emitBOM); } function emitSourceFile(sourceFile) { currentSourceFile = sourceFile; currentText = sourceFile.text; currentLineMap = ts.getLineStarts(sourceFile); exportFunctionForFile = undefined; + contextObjectForFile = undefined; isEs6Module = sourceFile.symbol && sourceFile.symbol.exports && !!sourceFile.symbol.exports["___esModule"]; renamedDependencies = sourceFile.renamedDependencies; currentFileIdentifiers = sourceFile.identifiers; isCurrentFileExternalModule = ts.isExternalModule(sourceFile); - emit(sourceFile); + setSourceFile(sourceFile); + emitNodeWithCommentsAndWithoutSourcemap(sourceFile); } function isUniqueName(name) { return !resolver.hasGlobalName(name) && @@ -25747,19 +29480,19 @@ var ts; } function makeTempVariableName(flags) { if (flags && !(tempFlags & flags)) { - var name_20 = flags === 268435456 ? "_i" : "_n"; - if (isUniqueName(name_20)) { + var name_23 = flags === 268435456 ? "_i" : "_n"; + if (isUniqueName(name_23)) { tempFlags |= flags; - return name_20; + return name_23; } } while (true) { var count = tempFlags & 268435455; tempFlags++; if (count !== 8 && count !== 13) { - var name_21 = count < 26 ? "_" + String.fromCharCode(97 + count) : "_" + (count - 26); - if (isUniqueName(name_21)) { - return name_21; + var name_24 = count < 26 ? "_" + String.fromCharCode(97 + count) : "_" + (count - 26); + if (isUniqueName(name_24)) { + return name_24; } } } @@ -25797,17 +29530,17 @@ var ts; switch (node.kind) { case 69: return makeUniqueName(node.text); - case 218: - case 217: + case 225: + case 224: return generateNameForModuleOrEnum(node); - case 222: - case 228: + case 230: + case 236: return generateNameForImportOrExportDeclaration(node); - case 213: - case 214: - case 227: + case 220: + case 221: + case 235: return generateNameForExportDefault(); - case 186: + case 192: return generateNameForClassExpression(); } } @@ -25815,289 +29548,14 @@ var ts; var id = ts.getNodeId(node); return nodeToGeneratedName[id] || (nodeToGeneratedName[id] = ts.unescapeIdentifier(generateNameForNode(node))); } - function initializeEmitterWithSourceMaps(jsFilePath, root) { - var sourceMapDir; - var sourceMapSourceIndex = -1; - var sourceMapNameIndexMap = {}; - var sourceMapNameIndices = []; - function getSourceMapNameIndex() { - return sourceMapNameIndices.length ? ts.lastOrUndefined(sourceMapNameIndices) : -1; + function writeEmittedFiles(emitOutput, jsFilePath, sourceMapFilePath, writeByteOrderMark, sourceFiles) { + if (compilerOptions.sourceMap && !compilerOptions.inlineSourceMap) { + ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap.getText(), false, sourceFiles); } - var lastRecordedSourceMapSpan; - var lastEncodedSourceMapSpan = { - emittedLine: 1, - emittedColumn: 1, - sourceLine: 1, - sourceColumn: 1, - sourceIndex: 0 - }; - var lastEncodedNameIndex = 0; - function encodeLastRecordedSourceMapSpan() { - if (!lastRecordedSourceMapSpan || lastRecordedSourceMapSpan === lastEncodedSourceMapSpan) { - return; - } - var prevEncodedEmittedColumn = lastEncodedSourceMapSpan.emittedColumn; - if (lastEncodedSourceMapSpan.emittedLine === lastRecordedSourceMapSpan.emittedLine) { - if (sourceMapData.sourceMapMappings) { - sourceMapData.sourceMapMappings += ","; - } - } - else { - for (var encodedLine = lastEncodedSourceMapSpan.emittedLine; encodedLine < lastRecordedSourceMapSpan.emittedLine; encodedLine++) { - sourceMapData.sourceMapMappings += ";"; - } - prevEncodedEmittedColumn = 1; - } - sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.emittedColumn - prevEncodedEmittedColumn); - sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceIndex - lastEncodedSourceMapSpan.sourceIndex); - sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceLine - lastEncodedSourceMapSpan.sourceLine); - sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceColumn - lastEncodedSourceMapSpan.sourceColumn); - if (lastRecordedSourceMapSpan.nameIndex >= 0) { - sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.nameIndex - lastEncodedNameIndex); - lastEncodedNameIndex = lastRecordedSourceMapSpan.nameIndex; - } - lastEncodedSourceMapSpan = lastRecordedSourceMapSpan; - sourceMapData.sourceMapDecodedMappings.push(lastEncodedSourceMapSpan); - function base64VLQFormatEncode(inValue) { - function base64FormatEncode(inValue) { - if (inValue < 64) { - return "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(inValue); - } - throw TypeError(inValue + ": not a 64 based value"); - } - if (inValue < 0) { - inValue = ((-inValue) << 1) + 1; - } - else { - inValue = inValue << 1; - } - var encodedStr = ""; - do { - var currentDigit = inValue & 31; - inValue = inValue >> 5; - if (inValue > 0) { - currentDigit = currentDigit | 32; - } - encodedStr = encodedStr + base64FormatEncode(currentDigit); - } while (inValue > 0); - return encodedStr; - } + if (sourceMapDataList) { + sourceMapDataList.push(sourceMap.getSourceMapData()); } - function recordSourceMapSpan(pos) { - var sourceLinePos = ts.computeLineAndCharacterOfPosition(currentLineMap, pos); - sourceLinePos.line++; - sourceLinePos.character++; - var emittedLine = writer.getLine(); - var emittedColumn = writer.getColumn(); - if (!lastRecordedSourceMapSpan || - lastRecordedSourceMapSpan.emittedLine !== emittedLine || - lastRecordedSourceMapSpan.emittedColumn !== emittedColumn || - (lastRecordedSourceMapSpan.sourceIndex === sourceMapSourceIndex && - (lastRecordedSourceMapSpan.sourceLine > sourceLinePos.line || - (lastRecordedSourceMapSpan.sourceLine === sourceLinePos.line && lastRecordedSourceMapSpan.sourceColumn > sourceLinePos.character)))) { - encodeLastRecordedSourceMapSpan(); - lastRecordedSourceMapSpan = { - emittedLine: emittedLine, - emittedColumn: emittedColumn, - sourceLine: sourceLinePos.line, - sourceColumn: sourceLinePos.character, - nameIndex: getSourceMapNameIndex(), - sourceIndex: sourceMapSourceIndex - }; - } - else { - lastRecordedSourceMapSpan.sourceLine = sourceLinePos.line; - lastRecordedSourceMapSpan.sourceColumn = sourceLinePos.character; - lastRecordedSourceMapSpan.sourceIndex = sourceMapSourceIndex; - } - } - function recordEmitNodeStartSpan(node) { - recordSourceMapSpan(ts.skipTrivia(currentText, node.pos)); - } - function recordEmitNodeEndSpan(node) { - recordSourceMapSpan(node.end); - } - function writeTextWithSpanRecord(tokenKind, startPos, emitFn) { - var tokenStartPos = ts.skipTrivia(currentText, startPos); - recordSourceMapSpan(tokenStartPos); - var tokenEndPos = emitTokenText(tokenKind, tokenStartPos, emitFn); - recordSourceMapSpan(tokenEndPos); - return tokenEndPos; - } - function recordNewSourceFileStart(node) { - var sourcesDirectoryPath = compilerOptions.sourceRoot ? host.getCommonSourceDirectory() : sourceMapDir; - sourceMapData.sourceMapSources.push(ts.getRelativePathToDirectoryOrUrl(sourcesDirectoryPath, node.fileName, host.getCurrentDirectory(), host.getCanonicalFileName, true)); - sourceMapSourceIndex = sourceMapData.sourceMapSources.length - 1; - sourceMapData.inputSourceFileNames.push(node.fileName); - if (compilerOptions.inlineSources) { - if (!sourceMapData.sourceMapSourcesContent) { - sourceMapData.sourceMapSourcesContent = []; - } - sourceMapData.sourceMapSourcesContent.push(node.text); - } - } - function recordScopeNameOfNode(node, scopeName) { - function recordScopeNameIndex(scopeNameIndex) { - sourceMapNameIndices.push(scopeNameIndex); - } - function recordScopeNameStart(scopeName) { - var scopeNameIndex = -1; - if (scopeName) { - var parentIndex = getSourceMapNameIndex(); - if (parentIndex !== -1) { - var name_22 = node.name; - if (!name_22 || name_22.kind !== 136) { - scopeName = "." + scopeName; - } - scopeName = sourceMapData.sourceMapNames[parentIndex] + scopeName; - } - scopeNameIndex = ts.getProperty(sourceMapNameIndexMap, scopeName); - if (scopeNameIndex === undefined) { - scopeNameIndex = sourceMapData.sourceMapNames.length; - sourceMapData.sourceMapNames.push(scopeName); - sourceMapNameIndexMap[scopeName] = scopeNameIndex; - } - } - recordScopeNameIndex(scopeNameIndex); - } - if (scopeName) { - recordScopeNameStart(scopeName); - } - else if (node.kind === 213 || - node.kind === 173 || - node.kind === 143 || - node.kind === 142 || - node.kind === 145 || - node.kind === 146 || - node.kind === 218 || - node.kind === 214 || - node.kind === 217) { - if (node.name) { - var name_23 = node.name; - scopeName = name_23.kind === 136 - ? ts.getTextOfNode(name_23) - : node.name.text; - } - recordScopeNameStart(scopeName); - } - else { - recordScopeNameIndex(getSourceMapNameIndex()); - } - } - function recordScopeNameEnd() { - sourceMapNameIndices.pop(); - } - ; - function writeCommentRangeWithMap(currentText, currentLineMap, writer, comment, newLine) { - recordSourceMapSpan(comment.pos); - ts.writeCommentRange(currentText, currentLineMap, writer, comment, newLine); - recordSourceMapSpan(comment.end); - } - function serializeSourceMapContents(version, file, sourceRoot, sources, names, mappings, sourcesContent) { - if (typeof JSON !== "undefined") { - var map_2 = { - version: version, - file: file, - sourceRoot: sourceRoot, - sources: sources, - names: names, - mappings: mappings - }; - if (sourcesContent !== undefined) { - map_2.sourcesContent = sourcesContent; - } - return JSON.stringify(map_2); - } - return "{\"version\":" + version + ",\"file\":\"" + ts.escapeString(file) + "\",\"sourceRoot\":\"" + ts.escapeString(sourceRoot) + "\",\"sources\":[" + serializeStringArray(sources) + "],\"names\":[" + serializeStringArray(names) + "],\"mappings\":\"" + ts.escapeString(mappings) + "\" " + (sourcesContent !== undefined ? ",\"sourcesContent\":[" + serializeStringArray(sourcesContent) + "]" : "") + "}"; - function serializeStringArray(list) { - var output = ""; - for (var i = 0, n = list.length; i < n; i++) { - if (i) { - output += ","; - } - output += "\"" + ts.escapeString(list[i]) + "\""; - } - return output; - } - } - function writeJavaScriptAndSourceMapFile(emitOutput, jsFilePath, writeByteOrderMark) { - encodeLastRecordedSourceMapSpan(); - var sourceMapText = serializeSourceMapContents(3, sourceMapData.sourceMapFile, sourceMapData.sourceMapSourceRoot, sourceMapData.sourceMapSources, sourceMapData.sourceMapNames, sourceMapData.sourceMapMappings, sourceMapData.sourceMapSourcesContent); - sourceMapDataList.push(sourceMapData); - var sourceMapUrl; - if (compilerOptions.inlineSourceMap) { - var base64SourceMapText = ts.convertToBase64(sourceMapText); - sourceMapUrl = "//# sourceMappingURL=data:application/json;base64," + base64SourceMapText; - } - else { - ts.writeFile(host, diagnostics, sourceMapData.sourceMapFilePath, sourceMapText, false); - sourceMapUrl = "//# sourceMappingURL=" + sourceMapData.jsSourceMappingURL; - } - writeJavaScriptFile(emitOutput + sourceMapUrl, jsFilePath, writeByteOrderMark); - } - var sourceMapJsFile = ts.getBaseFileName(ts.normalizeSlashes(jsFilePath)); - sourceMapData = { - sourceMapFilePath: jsFilePath + ".map", - jsSourceMappingURL: sourceMapJsFile + ".map", - sourceMapFile: sourceMapJsFile, - sourceMapSourceRoot: compilerOptions.sourceRoot || "", - sourceMapSources: [], - inputSourceFileNames: [], - sourceMapNames: [], - sourceMapMappings: "", - sourceMapSourcesContent: undefined, - sourceMapDecodedMappings: [] - }; - sourceMapData.sourceMapSourceRoot = ts.normalizeSlashes(sourceMapData.sourceMapSourceRoot); - if (sourceMapData.sourceMapSourceRoot.length && sourceMapData.sourceMapSourceRoot.charCodeAt(sourceMapData.sourceMapSourceRoot.length - 1) !== 47) { - sourceMapData.sourceMapSourceRoot += ts.directorySeparator; - } - if (compilerOptions.mapRoot) { - sourceMapDir = ts.normalizeSlashes(compilerOptions.mapRoot); - if (root) { - sourceMapDir = ts.getDirectoryPath(ts.getSourceFilePathInNewDir(root, host, sourceMapDir)); - } - if (!ts.isRootedDiskPath(sourceMapDir) && !ts.isUrl(sourceMapDir)) { - sourceMapDir = ts.combinePaths(host.getCommonSourceDirectory(), sourceMapDir); - sourceMapData.jsSourceMappingURL = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizePath(jsFilePath)), ts.combinePaths(sourceMapDir, sourceMapData.jsSourceMappingURL), host.getCurrentDirectory(), host.getCanonicalFileName, true); - } - else { - sourceMapData.jsSourceMappingURL = ts.combinePaths(sourceMapDir, sourceMapData.jsSourceMappingURL); - } - } - else { - sourceMapDir = ts.getDirectoryPath(ts.normalizePath(jsFilePath)); - } - function emitNodeWithSourceMap(node) { - if (node) { - if (ts.nodeIsSynthesized(node)) { - return emitNodeWithoutSourceMap(node); - } - if (node.kind !== 248) { - recordEmitNodeStartSpan(node); - emitNodeWithoutSourceMap(node); - recordEmitNodeEndSpan(node); - } - else { - recordNewSourceFileStart(node); - emitNodeWithoutSourceMap(node); - } - } - } - function emitNodeWithCommentsAndWithSourcemap(node) { - emitNodeConsideringCommentsOption(node, emitNodeWithSourceMap); - } - writeEmittedFiles = writeJavaScriptAndSourceMapFile; - emit = emitNodeWithCommentsAndWithSourcemap; - emitStart = recordEmitNodeStartSpan; - emitEnd = recordEmitNodeEndSpan; - emitToken = writeTextWithSpanRecord; - scopeEmitStart = recordScopeNameOfNode; - scopeEmitEnd = recordScopeNameEnd; - writeComment = writeCommentRangeWithMap; - } - function writeJavaScriptFile(emitOutput, jsFilePath, writeByteOrderMark) { - ts.writeFile(host, diagnostics, jsFilePath, emitOutput, writeByteOrderMark); + ts.writeFile(host, emitterDiagnostics, jsFilePath, emitOutput, writeByteOrderMark, sourceFiles); } function createTempVariable(flags) { var result = ts.createSynthesizedNode(69); @@ -26128,7 +29586,9 @@ var ts; write(";"); } } - function emitTokenText(tokenKind, startPos, emitFn) { + function emitToken(tokenKind, startPos, emitFn) { + var tokenStartPos = ts.skipTrivia(currentText, startPos); + emitPos(tokenStartPos); var tokenString = ts.tokenToString(tokenKind); if (emitFn) { emitFn(); @@ -26136,7 +29596,9 @@ var ts; else { write(tokenString); } - return startPos + tokenString.length; + var tokenEndPos = tokenStartPos + tokenString.length; + emitPos(tokenEndPos); + return tokenEndPos; } function emitOptional(prefix, node) { if (node) { @@ -26153,11 +29615,6 @@ var ts; write(")"); } } - function emitTrailingCommaIfPresent(nodeList) { - if (nodeList.hasTrailingComma) { - write(","); - } - } function emitLinePreservingList(parent, nodes, allowTrailingComma, spacesBetweenBraces) { ts.Debug.assert(nodes.length > 0); increaseIndent(); @@ -26263,14 +29720,14 @@ var ts; } function getLiteralText(node) { if (languageVersion < 2 && (ts.isTemplateLiteralKind(node.kind) || node.hasExtendedUnicodeEscape)) { - return getQuotedEscapedLiteralText("\"", node.text, "\""); + return getQuotedEscapedLiteralText('"', node.text, '"'); } if (node.parent) { return ts.getTextOfNodeFromSourceText(currentText, node); } switch (node.kind) { case 9: - return getQuotedEscapedLiteralText("\"", node.text, "\""); + return getQuotedEscapedLiteralText('"', node.text, '"'); case 11: return getQuotedEscapedLiteralText("`", node.text, "`"); case 12: @@ -26323,10 +29780,10 @@ var ts; emitParenthesizedIf(node.tag, needsParenthesisForPropertyAccessOrInvocation(node.tag)); write("("); emit(tempVariable); - if (node.template.kind === 183) { + if (node.template.kind === 189) { ts.forEach(node.template.templateSpans, function (templateSpan) { write(", "); - var needsParens = templateSpan.expression.kind === 181 + var needsParens = templateSpan.expression.kind === 187 && templateSpan.expression.operatorToken.kind === 24; emitParenthesizedIf(templateSpan.expression, needsParens); }); @@ -26350,7 +29807,7 @@ var ts; } for (var i = 0, n = node.templateSpans.length; i < n; i++) { var templateSpan = node.templateSpans[i]; - var needsParens = templateSpan.expression.kind !== 172 + var needsParens = templateSpan.expression.kind !== 178 && comparePrecedenceToBinaryPlus(templateSpan.expression) !== 1; if (i > 0 || headEmitted) { write(" + "); @@ -26370,11 +29827,11 @@ var ts; } function templateNeedsParens(template, parent) { switch (parent.kind) { - case 168: - case 169: + case 174: + case 175: return parent.expression === template; - case 170: - case 172: + case 176: + case 178: return false; default: return comparePrecedenceToBinaryPlus(parent) !== -1; @@ -26382,7 +29839,7 @@ var ts; } function comparePrecedenceToBinaryPlus(expression) { switch (expression.kind) { - case 181: + case 187: switch (expression.operatorToken.kind) { case 37: case 39: @@ -26394,8 +29851,8 @@ var ts; default: return -1; } - case 184: - case 182: + case 190: + case 188: return -1; default: return 1; @@ -26409,22 +29866,22 @@ var ts; function jsxEmitReact(node) { function emitTagName(name) { if (name.kind === 69 && ts.isIntrinsicJsxName(name.text)) { - write("\""); + write('"'); emit(name); - write("\""); + write('"'); } else { emit(name); } } function emitAttributeName(name) { - if (/[A-Za-z_]+[\w*]/.test(name.text)) { - write("\""); + if (/^[A-Za-z_]\w*$/.test(name.text)) { emit(name); - write("\""); } else { + write('"'); emit(name); + write('"'); } } function emitJsxAttribute(node) { @@ -26439,7 +29896,7 @@ var ts; } function emitJsxElement(openingNode, children) { var syntheticReactRef = ts.createSynthesizedNode(69); - syntheticReactRef.text = "React"; + syntheticReactRef.text = compilerOptions.reactNamespace ? compilerOptions.reactNamespace : "React"; syntheticReactRef.parent = openingNode; emitLeadingComments(openingNode); emitExpressionIdentifier(syntheticReactRef); @@ -26451,37 +29908,36 @@ var ts; } else { var attrs = openingNode.attributes; - if (ts.forEach(attrs, function (attr) { return attr.kind === 239; })) { - emitExpressionIdentifier(syntheticReactRef); - write(".__spread("); + if (ts.forEach(attrs, function (attr) { return attr.kind === 247; })) { + write("__assign("); var haveOpenedObjectLiteral = false; - for (var i_1 = 0; i_1 < attrs.length; i_1++) { - if (attrs[i_1].kind === 239) { - if (i_1 === 0) { + for (var i = 0; i < attrs.length; i++) { + if (attrs[i].kind === 247) { + if (i === 0) { write("{}, "); } if (haveOpenedObjectLiteral) { write("}"); haveOpenedObjectLiteral = false; } - if (i_1 > 0) { + if (i > 0) { write(", "); } - emit(attrs[i_1].expression); + emit(attrs[i].expression); } else { - ts.Debug.assert(attrs[i_1].kind === 238); + ts.Debug.assert(attrs[i].kind === 246); if (haveOpenedObjectLiteral) { write(", "); } else { haveOpenedObjectLiteral = true; - if (i_1 > 0) { + if (i > 0) { write(", "); } write("{"); } - emitJsxAttribute(attrs[i_1]); + emitJsxAttribute(attrs[i]); } } if (haveOpenedObjectLiteral) @@ -26490,7 +29946,7 @@ var ts; } else { write("{"); - for (var i = 0; i < attrs.length; i++) { + for (var i = 0, n = attrs.length; i < n; i++) { if (i > 0) { write(", "); } @@ -26500,32 +29956,52 @@ var ts; } } if (children) { - for (var i = 0; i < children.length; i++) { - if (children[i].kind === 240 && !(children[i].expression)) { - continue; - } - if (children[i].kind === 236) { - var text = getTextToEmit(children[i]); - if (text !== undefined) { - write(", \""); - write(text); - write("\""); + var firstChild = void 0; + var multipleEmittableChildren = false; + for (var i = 0, n = children.length; i < n; i++) { + var jsxChild = children[i]; + if (isJsxChildEmittable(jsxChild)) { + if (!firstChild) { + write(", "); + firstChild = jsxChild; + } + else { + if (!multipleEmittableChildren) { + multipleEmittableChildren = true; + increaseIndent(); + writeLine(); + emit(firstChild); + } + write(", "); + writeLine(); + emit(jsxChild); } } + } + if (multipleEmittableChildren) { + decreaseIndent(); + } + else if (firstChild) { + if (firstChild.kind !== 241 && firstChild.kind !== 242) { + emit(firstChild); + } else { - write(", "); - emit(children[i]); + increaseIndent(); + writeLine(); + emit(firstChild); + writeLine(); + decreaseIndent(); } } } write(")"); emitTrailingComments(openingNode); } - if (node.kind === 233) { + if (node.kind === 241) { emitJsxElement(node.openingElement, node.children); } else { - ts.Debug.assert(node.kind === 234); + ts.Debug.assert(node.kind === 242); emitJsxElement(node); } } @@ -26547,11 +30023,11 @@ var ts; if (i > 0) { write(" "); } - if (attribs[i].kind === 239) { + if (attribs[i].kind === 247) { emitJsxSpreadAttribute(attribs[i]); } else { - ts.Debug.assert(attribs[i].kind === 238); + ts.Debug.assert(attribs[i].kind === 246); emitJsxAttribute(attribs[i]); } } @@ -26559,11 +30035,11 @@ var ts; function emitJsxOpeningOrSelfClosingElement(node) { write("<"); emit(node.tagName); - if (node.attributes.length > 0 || (node.kind === 234)) { + if (node.attributes.length > 0 || (node.kind === 242)) { write(" "); } emitAttributes(node.attributes); - if (node.kind === 234) { + if (node.kind === 242) { write("/>"); } else { @@ -26582,20 +30058,20 @@ var ts; } emitJsxClosingElement(node.closingElement); } - if (node.kind === 233) { + if (node.kind === 241) { emitJsxElement(node); } else { - ts.Debug.assert(node.kind === 234); + ts.Debug.assert(node.kind === 242); emitJsxOpeningOrSelfClosingElement(node); } } function emitExpressionForPropertyName(node) { - ts.Debug.assert(node.kind !== 163); + ts.Debug.assert(node.kind !== 169); if (node.kind === 9) { emitLiteral(node); } - else if (node.kind === 136) { + else if (node.kind === 140) { if (ts.nodeIsDecorated(node.parent)) { if (!computedPropertyNamesToGeneratedNames) { computedPropertyNamesToGeneratedNames = []; @@ -26613,87 +30089,86 @@ var ts; emit(node.expression); } else { - write("\""); + write('"'); if (node.kind === 8) { write(node.text); } else { writeTextOfNode(currentText, node); } - write("\""); + write('"'); } } function isExpressionIdentifier(node) { var parent = node.parent; switch (parent.kind) { - case 164: - case 189: - case 181: - case 168: - case 241: - case 136: - case 182: - case 139: - case 175: - case 197: - case 167: - case 227: + case 170: case 195: + case 184: + case 187: + case 174: + case 249: + case 140: case 188: - case 199: - case 200: - case 201: - case 196: - case 234: + case 143: + case 181: + case 204: + case 173: case 235: - case 239: - case 240: + case 202: + case 194: + case 206: + case 207: + case 208: + case 203: + case 245: + case 242: + case 243: + case 247: + case 248: + case 175: + case 196: + case 178: + case 186: + case 185: + case 211: + case 254: + case 191: + case 213: + case 176: + case 197: + case 215: + case 177: + case 182: + case 183: + case 205: + case 212: + case 190: + return true; case 169: + case 255: + case 142: + case 253: + case 145: + case 218: + return parent.initializer === node; case 172: + return parent.expression === node; case 180: case 179: - case 204: - case 246: - case 185: - case 206: - case 170: - case 190: - case 208: - case 171: - case 176: - case 177: - case 198: - case 205: - case 184: - return true; - case 163: - case 247: - case 138: - case 245: - case 141: - case 211: - return parent.initializer === node; - case 166: - return parent.expression === node; - case 174: - case 173: return parent.body === node; - case 221: + case 229: return parent.moduleReference === node; - case 135: + case 139: return parent.left === node; } return false; } function emitExpressionIdentifier(node) { - if (resolver.getNodeCheckFlags(node) & 2048) { - write("_arguments"); - return; - } var container = resolver.getReferencedExportContainer(node); if (container) { - if (container.kind === 248) { - if (modulekind !== 5 && modulekind !== 4) { + if (container.kind === 256) { + if (modulekind !== ts.ModuleKind.ES6 && modulekind !== ts.ModuleKind.System) { write("exports."); } } @@ -26703,20 +30178,20 @@ var ts; } } else { - if (modulekind !== 5) { + if (modulekind !== ts.ModuleKind.ES6) { var declaration = resolver.getReferencedImportDeclaration(node); if (declaration) { - if (declaration.kind === 223) { + if (declaration.kind === 231) { write(getGeneratedNameForNode(declaration.parent)); - write(languageVersion === 0 ? "[\"default\"]" : ".default"); + write(languageVersion === 0 ? '["default"]' : ".default"); return; } - else if (declaration.kind === 226) { + else if (declaration.kind === 234) { write(getGeneratedNameForNode(declaration.parent.parent.parent)); - var name_24 = declaration.propertyName || declaration.name; - var identifier = ts.getTextOfNodeFromSourceText(currentText, name_24); + var name_25 = declaration.propertyName || declaration.name; + var identifier = ts.getTextOfNodeFromSourceText(currentText, name_25); if (languageVersion === 0 && identifier === "default") { - write("[\"default\"]"); + write('["default"]'); } else { write("."); @@ -26726,13 +30201,23 @@ var ts; } } } - if (languageVersion !== 2) { - var declaration = resolver.getReferencedNestedRedeclaration(node); + if (languageVersion < 2) { + var declaration = resolver.getReferencedDeclarationWithCollidingName(node); if (declaration) { write(getGeneratedNameForNode(declaration.name)); return; } } + else if (resolver.getNodeCheckFlags(node) & 1048576) { + var declaration = resolver.getReferencedValueDeclaration(node); + if (declaration) { + var classAlias = decoratedClassAliases[ts.getNodeId(declaration)]; + if (classAlias !== undefined) { + write(classAlias); + return; + } + } + } } if (ts.nodeIsSynthesized(node)) { write(node.text); @@ -26741,15 +30226,15 @@ var ts; writeTextOfNode(currentText, node); } } - function isNameOfNestedRedeclaration(node) { + function isNameOfNestedBlockScopedRedeclarationOrCapturedBinding(node) { if (languageVersion < 2) { - var parent_6 = node.parent; - switch (parent_6.kind) { - case 163: - case 214: - case 217: - case 211: - return parent_6.name === node && resolver.isNestedRedeclaration(parent_6); + var parent_13 = node.parent; + switch (parent_13.kind) { + case 169: + case 221: + case 224: + case 218: + return parent_13.name === node && resolver.isDeclarationWithCollidingName(parent_13); } } return false; @@ -26757,8 +30242,8 @@ var ts; function emitIdentifier(node) { if (convertedLoopState) { if (node.text == "arguments" && resolver.isArgumentsLocalBinding(node)) { - var name_25 = convertedLoopState.argumentsName || (convertedLoopState.argumentsName = makeUniqueName("arguments")); - write(name_25); + var name_26 = convertedLoopState.argumentsName || (convertedLoopState.argumentsName = makeUniqueName("arguments")); + write(name_26); return; } } @@ -26768,7 +30253,7 @@ var ts; else if (isExpressionIdentifier(node)) { emitExpressionIdentifier(node); } - else if (isNameOfNestedRedeclaration(node)) { + else if (isNameOfNestedBlockScopedRedeclarationOrCapturedBinding(node)) { write(getGeneratedNameForNode(node)); } else if (ts.nodeIsSynthesized(node)) { @@ -26782,6 +30267,9 @@ var ts; if (resolver.getNodeCheckFlags(node) & 2) { write("_this"); } + else if (convertedLoopState) { + write(convertedLoopState.thisName || (convertedLoopState.thisName = makeUniqueName("this"))); + } else { write("this"); } @@ -26855,10 +30343,10 @@ var ts; } } function needsParenthesisForAwaitExpressionAsYield(node) { - if (node.parent.kind === 181 && !ts.isAssignmentOperator(node.parent.operatorToken.kind)) { + if (node.parent.kind === 187 && !ts.isAssignmentOperator(node.parent.operatorToken.kind)) { return true; } - else if (node.parent.kind === 182 && node.parent.condition === node) { + else if (node.parent.kind === 188 && node.parent.condition === node) { return true; } return false; @@ -26866,11 +30354,11 @@ var ts; function needsParenthesisForPropertyAccessOrInvocation(node) { switch (node.kind) { case 69: - case 164: - case 166: - case 167: - case 168: + case 170: case 172: + case 173: + case 174: + case 178: return false; } return true; @@ -26887,17 +30375,17 @@ var ts; write(", "); } var e = elements[pos]; - if (e.kind === 185) { + if (e.kind === 191) { e = e.expression; emitParenthesizedIf(e, group === 0 && needsParenthesisForPropertyAccessOrInvocation(e)); pos++; - if (pos === length && group === 0 && needsUniqueCopy && e.kind !== 164) { + if (pos === length && group === 0 && needsUniqueCopy && e.kind !== 170) { write(".slice()"); } } else { var i = pos; - while (i < length && elements[i].kind !== 185) { + while (i < length && elements[i].kind !== 191) { i++; } write("["); @@ -26920,7 +30408,7 @@ var ts; } } function isSpreadElementExpression(node) { - return node.kind === 185; + return node.kind === 191; } function emitArrayLiteral(node) { var elements = node.elements; @@ -26933,7 +30421,7 @@ var ts; write("]"); } else { - emitListWithSpread(elements, true, (node.flags & 1024) !== 0, elements.hasTrailingComma, true); + emitListWithSpread(elements, true, node.multiLine, elements.hasTrailingComma, true); } } function emitObjectLiteralBody(node, numElements) { @@ -26948,7 +30436,7 @@ var ts; emitLinePreservingList(node, properties, languageVersion >= 1, true); } else { - var multiLine = (node.flags & 1024) !== 0; + var multiLine = node.multiLine; if (!multiLine) { write(" "); } @@ -26967,7 +30455,7 @@ var ts; write("}"); } function emitDownlevelObjectLiteralWithComputedProperties(node, firstComputedPropertyIndex) { - var multiLine = (node.flags & 1024) !== 0; + var multiLine = node.multiLine; var properties = node.properties; write("("); if (multiLine) { @@ -26981,7 +30469,7 @@ var ts; writeComma(); var property = properties[i]; emitStart(property); - if (property.kind === 145 || property.kind === 146) { + if (property.kind === 149 || property.kind === 150) { var accessors = ts.getAllAccessorDeclarations(node.properties, property); if (property !== accessors.firstAccessor) { continue; @@ -26989,7 +30477,7 @@ var ts; write("Object.defineProperty("); emit(tempVar); write(", "); - emitStart(node.name); + emitStart(property.name); emitExpressionForPropertyName(property.name); emitEnd(property.name); write(", {"); @@ -27032,13 +30520,13 @@ var ts; emitMemberAccessForPropertyName(property.name); emitEnd(property.name); write(" = "); - if (property.kind === 245) { + if (property.kind === 253) { emit(property.initializer); } - else if (property.kind === 246) { + else if (property.kind === 254) { emitExpressionIdentifier(property.name); } - else if (property.kind === 143) { + else if (property.kind === 147) { emitFunctionDeclaration(property); } else { @@ -27070,7 +30558,7 @@ var ts; var numProperties = properties.length; var numInitialNonComputedProperties = numProperties; for (var i = 0, n = properties.length; i < n; i++) { - if (properties[i].name.kind === 136) { + if (properties[i].name.kind === 140) { numInitialNonComputedProperties = i; break; } @@ -27084,35 +30572,37 @@ var ts; emitObjectLiteralBody(node, properties.length); } function createBinaryExpression(left, operator, right, startsOnNewLine) { - var result = ts.createSynthesizedNode(181, startsOnNewLine); + var result = ts.createSynthesizedNode(187, startsOnNewLine); result.operatorToken = ts.createSynthesizedNode(operator); result.left = left; result.right = right; return result; } function createPropertyAccessExpression(expression, name) { - var result = ts.createSynthesizedNode(166); + var result = ts.createSynthesizedNode(172); result.expression = parenthesizeForAccess(expression); result.dotToken = ts.createSynthesizedNode(21); result.name = name; return result; } function createElementAccessExpression(expression, argumentExpression) { - var result = ts.createSynthesizedNode(167); + var result = ts.createSynthesizedNode(173); result.expression = parenthesizeForAccess(expression); result.argumentExpression = argumentExpression; return result; } function parenthesizeForAccess(expr) { - while (expr.kind === 171 || expr.kind === 189) { + while (expr.kind === 177 || + expr.kind === 195 || + expr.kind === 196) { expr = expr.expression; } if (ts.isLeftHandSideExpression(expr) && - expr.kind !== 169 && + expr.kind !== 175 && expr.kind !== 8) { return expr; } - var node = ts.createSynthesizedNode(172); + var node = ts.createSynthesizedNode(178); node.expression = expr; return node; } @@ -27139,11 +30629,15 @@ var ts; } function isNamespaceExportReference(node) { var container = resolver.getReferencedExportContainer(node); - return container && container.kind !== 248; + return container && container.kind !== 256; + } + function isImportedReference(node) { + var declaration = resolver.getReferencedImportDeclaration(node); + return declaration && (declaration.kind === 231 || declaration.kind === 234); } function emitShorthandPropertyAssignment(node) { writeTextOfNode(currentText, node.name); - if (modulekind !== 5 || isNamespaceExportReference(node.name)) { + if (languageVersion < 2 || (modulekind !== ts.ModuleKind.ES6 && isImportedReference(node.name)) || isNamespaceExportReference(node.name)) { write(": "); emit(node.name); } @@ -27157,7 +30651,7 @@ var ts; if (constantValue !== undefined) { write(constantValue.toString()); if (!compilerOptions.removeComments) { - var propertyName = node.kind === 166 ? ts.declarationNameToString(node.name) : ts.getTextOfNode(node.argumentExpression); + var propertyName = node.kind === 172 ? ts.declarationNameToString(node.name) : ts.getTextOfNode(node.argumentExpression); write(" /* " + propertyName + " */"); } return true; @@ -27168,7 +30662,7 @@ var ts; if (compilerOptions.isolatedModules) { return undefined; } - return node.kind === 166 || node.kind === 167 + return node.kind === 172 || node.kind === 173 ? resolver.getConstantValue(node) : undefined; } @@ -27191,6 +30685,14 @@ var ts; if (tryEmitConstantValue(node)) { return; } + if (languageVersion === 2 && + node.expression.kind === 95 && + isInAsyncMethodWithSuperInES6(node)) { + var name_27 = ts.createSynthesizedNode(9); + name_27.text = node.name.text; + emitSuperAccessInAsyncMethod(node.expression, name_27); + return; + } emit(node.expression); var indentedBeforeDot = indentIfOnDifferentLines(node, node.expression, node.dotToken); var shouldEmitSpace = false; @@ -27248,25 +30750,37 @@ var ts; } emitExpressionIdentifier(node); break; - case 135: + case 139: emitQualifiedNameAsExpression(node, useFallback); break; + default: + emitNodeWithoutSourceMap(node); + break; } } function emitIndexedAccess(node) { if (tryEmitConstantValue(node)) { return; } + if (languageVersion === 2 && + node.expression.kind === 95 && + isInAsyncMethodWithSuperInES6(node)) { + emitSuperAccessInAsyncMethod(node.expression, node.argumentExpression); + return; + } emit(node.expression); write("["); emit(node.argumentExpression); write("]"); } function hasSpreadElement(elements) { - return ts.forEach(elements, function (e) { return e.kind === 185; }); + return ts.forEach(elements, function (e) { return e.kind === 191; }); } function skipParentheses(node) { - while (node.kind === 172 || node.kind === 171 || node.kind === 189) { + while (node.kind === 178 || + node.kind === 177 || + node.kind === 195 || + node.kind === 196) { node = node.expression; } return node; @@ -27287,12 +30801,12 @@ var ts; function emitCallWithSpread(node) { var target; var expr = skipParentheses(node.expression); - if (expr.kind === 166) { + if (expr.kind === 172) { target = emitCallTarget(expr.expression); write("."); emit(expr.name); } - else if (expr.kind === 167) { + else if (expr.kind === 173) { target = emitCallTarget(expr.expression); write("["); emit(expr.argumentExpression); @@ -27321,23 +30835,42 @@ var ts; emitListWithSpread(node.arguments, false, false, false, true); write(")"); } + function isInAsyncMethodWithSuperInES6(node) { + if (languageVersion === 2) { + var container = ts.getSuperContainer(node, false); + if (container && resolver.getNodeCheckFlags(container) & (2048 | 4096)) { + return true; + } + } + return false; + } + function emitSuperAccessInAsyncMethod(superNode, argumentExpression) { + var container = ts.getSuperContainer(superNode, false); + var isSuperBinding = resolver.getNodeCheckFlags(container) & 4096; + write("_super("); + emit(argumentExpression); + write(isSuperBinding ? ").value" : ")"); + } function emitCallExpression(node) { if (languageVersion < 2 && hasSpreadElement(node.arguments)) { emitCallWithSpread(node); return; } + var expression = node.expression; var superCall = false; - if (node.expression.kind === 95) { - emitSuper(node.expression); + var isAsyncMethodWithSuper = false; + if (expression.kind === 95) { + emitSuper(expression); superCall = true; } else { - emit(node.expression); - superCall = node.expression.kind === 166 && node.expression.expression.kind === 95; + superCall = ts.isSuperPropertyOrElementAccess(expression); + isAsyncMethodWithSuper = superCall && isInAsyncMethodWithSuperInES6(node); + emit(expression); } - if (superCall && languageVersion < 2) { + if (superCall && (languageVersion < 2 || isAsyncMethodWithSuper)) { write(".call("); - emitThis(node.expression); + emitThis(expression); if (node.arguments.length) { write(", "); emitCommaList(node.arguments); @@ -27384,21 +30917,25 @@ var ts; } } function emitParenExpression(node) { - if (!ts.nodeIsSynthesized(node) && node.parent.kind !== 174) { - if (node.expression.kind === 171 || node.expression.kind === 189) { + if (!ts.nodeIsSynthesized(node) && node.parent.kind !== 180) { + if (node.expression.kind === 177 || + node.expression.kind === 195 || + node.expression.kind === 196) { var operand = node.expression.expression; - while (operand.kind === 171 || operand.kind === 189) { + while (operand.kind === 177 || + operand.kind === 195 || + operand.kind === 196) { operand = operand.expression; } - if (operand.kind !== 179 && - operand.kind !== 177 && - operand.kind !== 176 && + if (operand.kind !== 185 && + operand.kind !== 183 && + operand.kind !== 182 && + operand.kind !== 181 && + operand.kind !== 186 && operand.kind !== 175 && - operand.kind !== 180 && - operand.kind !== 169 && - !(operand.kind === 168 && node.parent.kind === 169) && - !(operand.kind === 173 && node.parent.kind === 168) && - !(operand.kind === 8 && node.parent.kind === 166)) { + !(operand.kind === 174 && node.parent.kind === 175) && + !(operand.kind === 179 && node.parent.kind === 174) && + !(operand.kind === 8 && node.parent.kind === 172)) { emit(operand); return; } @@ -27427,21 +30964,22 @@ var ts; if (!isCurrentFileSystemExternalModule() || node.kind !== 69 || ts.nodeIsSynthesized(node)) { return false; } - var isVariableDeclarationOrBindingElement = node.parent && (node.parent.kind === 211 || node.parent.kind === 163); + var isVariableDeclarationOrBindingElement = node.parent && (node.parent.kind === 218 || node.parent.kind === 169); var targetDeclaration = isVariableDeclarationOrBindingElement ? node.parent : resolver.getReferencedValueDeclaration(node); return isSourceFileLevelDeclarationInSystemJsModule(targetDeclaration, true); } function emitPrefixUnaryExpression(node) { - var exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.operand); + var exportChanged = (node.operator === 41 || node.operator === 42) && + isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.operand); if (exportChanged) { write(exportFunctionForFile + "(\""); emitNodeWithoutSourceMap(node.operand); write("\", "); } write(ts.tokenToString(node.operator)); - if (node.operand.kind === 179) { + if (node.operand.kind === 185) { var operand = node.operand; if (node.operator === 35 && (operand.operator === 35 || operand.operator === 41)) { write(" "); @@ -27482,12 +31020,12 @@ var ts; if (!node || !isCurrentFileSystemExternalModule()) { return false; } - var current = node; + var current = ts.getRootDeclaration(node).parent; while (current) { - if (current.kind === 248) { - return !isExported || ((ts.getCombinedNodeFlags(node) & 2) !== 0); + if (current.kind === 256) { + return !isExported || ((ts.getCombinedNodeFlags(node) & 1) !== 0); } - else if (ts.isFunctionLike(current) || current.kind === 219) { + else if (ts.isDeclaration(current)) { return false; } else { @@ -27498,19 +31036,19 @@ var ts; function emitExponentiationOperator(node) { var leftHandSideExpression = node.left; if (node.operatorToken.kind === 60) { - var synthesizedLHS; + var synthesizedLHS = void 0; var shouldEmitParentheses = false; if (ts.isElementAccessExpression(leftHandSideExpression)) { shouldEmitParentheses = true; write("("); - synthesizedLHS = ts.createSynthesizedNode(167, false); + synthesizedLHS = ts.createSynthesizedNode(173, false); var identifier = emitTempVariableAssignment(leftHandSideExpression.expression, false, false); synthesizedLHS.expression = identifier; if (leftHandSideExpression.argumentExpression.kind !== 8 && leftHandSideExpression.argumentExpression.kind !== 9) { var tempArgumentExpression = createAndRecordTempVariable(268435456); synthesizedLHS.argumentExpression = tempArgumentExpression; - emitAssignment(tempArgumentExpression, leftHandSideExpression.argumentExpression, true); + emitAssignment(tempArgumentExpression, leftHandSideExpression.argumentExpression, true, leftHandSideExpression.expression); } else { synthesizedLHS.argumentExpression = leftHandSideExpression.argumentExpression; @@ -27520,7 +31058,7 @@ var ts; else if (ts.isPropertyAccessExpression(leftHandSideExpression)) { shouldEmitParentheses = true; write("("); - synthesizedLHS = ts.createSynthesizedNode(166, false); + synthesizedLHS = ts.createSynthesizedNode(172, false); var identifier = emitTempVariableAssignment(leftHandSideExpression.expression, false, false); synthesizedLHS.expression = identifier; synthesizedLHS.dotToken = leftHandSideExpression.dotToken; @@ -27548,8 +31086,8 @@ var ts; } function emitBinaryExpression(node) { if (languageVersion < 2 && node.operatorToken.kind === 56 && - (node.left.kind === 165 || node.left.kind === 164)) { - emitDestructuring(node, node.parent.kind === 195); + (node.left.kind === 171 || node.left.kind === 170)) { + emitDestructuring(node, node.parent.kind === 202); } else { var exportChanged = node.operatorToken.kind >= 56 && @@ -27601,7 +31139,7 @@ var ts; } } function isSingleLineEmptyBlock(node) { - if (node && node.kind === 192) { + if (node && node.kind === 199) { var block = node; return block.statements.length === 0 && nodeEndIsOnSameLineAsNodeStart(block, block); } @@ -27615,22 +31153,20 @@ var ts; } emitToken(15, node.pos); increaseIndent(); - scopeEmitStart(node.parent); - if (node.kind === 219) { - ts.Debug.assert(node.parent.kind === 218); + if (node.kind === 226) { + ts.Debug.assert(node.parent.kind === 225); emitCaptureThisForNodeIfNecessary(node.parent); } emitLines(node.statements); - if (node.kind === 219) { + if (node.kind === 226) { emitTempDeclarations(true); } decreaseIndent(); writeLine(); emitToken(16, node.statements.end); - scopeEmitEnd(); } function emitEmbeddedStatement(node) { - if (node.kind === 192) { + if (node.kind === 199) { write(" "); emit(node); } @@ -27642,7 +31178,7 @@ var ts; } } function emitExpressionStatement(node) { - emitParenthesizedIf(node.expression, node.expression.kind === 174); + emitParenthesizedIf(node.expression, node.expression.kind === 180); write(";"); } function emitIfStatement(node) { @@ -27655,7 +31191,7 @@ var ts; if (node.elseStatement) { writeLine(); emitToken(80, node.thenStatement.end); - if (node.elseStatement.kind === 196) { + if (node.elseStatement.kind === 203) { write(" "); emit(node.elseStatement); } @@ -27675,7 +31211,7 @@ var ts; else { emitNormalLoopBody(node, true); } - if (node.statement.kind === 192) { + if (node.statement.kind === 199) { write(" "); } else { @@ -27699,42 +31235,31 @@ var ts; emitNormalLoopBody(node, true); } } - function tryEmitStartOfVariableDeclarationList(decl, startPos) { + function tryEmitStartOfVariableDeclarationList(decl) { if (shouldHoistVariable(decl, true)) { return false; } - if (convertedLoopState && (ts.getCombinedNodeFlags(decl) & 24576) === 0) { + if (convertedLoopState && (ts.getCombinedNodeFlags(decl) & 3072) === 0) { for (var _a = 0, _b = decl.declarations; _a < _b.length; _a++) { var varDecl = _b[_a]; hoistVariableDeclarationFromLoop(convertedLoopState, varDecl); } return false; } - var tokenKind = 102; + emitStart(decl); if (decl && languageVersion >= 2) { if (ts.isLet(decl)) { - tokenKind = 108; + write("let "); } else if (ts.isConst(decl)) { - tokenKind = 74; + write("const "); + } + else { + write("var "); } - } - if (startPos !== undefined) { - emitToken(tokenKind, startPos); - write(" "); } else { - switch (tokenKind) { - case 102: - write("var "); - break; - case 108: - write("let "); - break; - case 74: - write("const "); - break; - } + write("var "); } return true; } @@ -27766,7 +31291,7 @@ var ts; } else { var loop = convertLoopBody(node); - if (node.parent.kind === 207) { + if (node.parent.kind === 214) { emitLabelAndColon(node.parent); } loopEmitter(node, loop); @@ -27776,49 +31301,67 @@ var ts; var functionName = makeUniqueName("_loop"); var loopInitializer; switch (node.kind) { - case 199: - case 200: - case 201: - if (node.initializer.kind === 212) { + case 206: + case 207: + case 208: + var initializer = node.initializer; + if (initializer && initializer.kind === 219) { loopInitializer = node.initializer; } break; } var loopParameters; - if (loopInitializer && (ts.getCombinedNodeFlags(loopInitializer) & 24576)) { + var loopOutParameters; + if (loopInitializer && (ts.getCombinedNodeFlags(loopInitializer) & 3072)) { loopParameters = []; for (var _a = 0, _b = loopInitializer.declarations; _a < _b.length; _a++) { var varDeclaration = _b[_a]; - collectNames(varDeclaration.name); + processVariableDeclaration(varDeclaration.name); } } - var bodyIsBlock = node.statement.kind === 192; + var bodyIsBlock = node.statement.kind === 199; var paramList = loopParameters ? loopParameters.join(", ") : ""; writeLine(); write("var " + functionName + " = function(" + paramList + ")"); - if (!bodyIsBlock) { - write(" {"); - writeLine(); - increaseIndent(); - } var convertedOuterLoopState = convertedLoopState; - convertedLoopState = {}; + convertedLoopState = { loopOutParameters: loopOutParameters }; if (convertedOuterLoopState) { if (convertedOuterLoopState.argumentsName) { convertedLoopState.argumentsName = convertedOuterLoopState.argumentsName; } + if (convertedOuterLoopState.thisName) { + convertedLoopState.thisName = convertedOuterLoopState.thisName; + } if (convertedOuterLoopState.hoistedLocalVariables) { convertedLoopState.hoistedLocalVariables = convertedOuterLoopState.hoistedLocalVariables; } } - emitEmbeddedStatement(node.statement); - if (!bodyIsBlock) { - decreaseIndent(); - writeLine(); - write("}"); - } - write(";"); + write(" {"); writeLine(); + increaseIndent(); + if (bodyIsBlock) { + emitLines(node.statement.statements); + } + else { + emit(node.statement); + } + writeLine(); + copyLoopOutParameters(convertedLoopState, 1, true); + decreaseIndent(); + writeLine(); + write("};"); + writeLine(); + if (loopOutParameters) { + write("var "); + for (var i = 0; i < loopOutParameters.length; i++) { + if (i !== 0) { + write(", "); + } + write(loopOutParameters[i].outParamName); + } + write(";"); + writeLine(); + } if (convertedLoopState.argumentsName) { if (convertedOuterLoopState) { convertedOuterLoopState.argumentsName = convertedLoopState.argumentsName; @@ -27828,13 +31371,22 @@ var ts; writeLine(); } } + if (convertedLoopState.thisName) { + if (convertedOuterLoopState) { + convertedOuterLoopState.thisName = convertedLoopState.thisName; + } + else { + write("var " + convertedLoopState.thisName + " = this;"); + writeLine(); + } + } if (convertedLoopState.hoistedLocalVariables) { if (convertedOuterLoopState) { convertedOuterLoopState.hoistedLocalVariables = convertedLoopState.hoistedLocalVariables; } else { write("var "); - var seen; + var seen = void 0; for (var _c = 0, _d = convertedLoopState.hoistedLocalVariables; _c < _d.length; _c++) { var id = _d[_c]; if (!seen) { @@ -27855,15 +31407,21 @@ var ts; var currentLoopState = convertedLoopState; convertedLoopState = convertedOuterLoopState; return { functionName: functionName, paramList: paramList, state: currentLoopState }; - function collectNames(name) { + function processVariableDeclaration(name) { if (name.kind === 69) { - var nameText = isNameOfNestedRedeclaration(name) ? getGeneratedNameForNode(name) : name.text; + var nameText = isNameOfNestedBlockScopedRedeclarationOrCapturedBinding(name) + ? getGeneratedNameForNode(name) + : name.text; loopParameters.push(nameText); + if (resolver.getNodeCheckFlags(name.parent) & 2097152) { + var reassignedVariable = { originalName: name, outParamName: makeUniqueName("out_" + nameText) }; + (loopOutParameters || (loopOutParameters = [])).push(reassignedVariable); + } } else { for (var _a = 0, _b = name.elements; _a < _b.length; _a++) { var element = _b[_a]; - collectNames(element.name); + processVariableDeclaration(element.name); } } } @@ -27877,7 +31435,7 @@ var ts; if (emitAsEmbeddedStatement) { emitEmbeddedStatement(node.statement); } - else if (node.statement.kind === 192) { + else if (node.statement.kind === 199) { emitLines(node.statement.statements); } else { @@ -27888,13 +31446,35 @@ var ts; convertedLoopState.allowedNonLabeledJumps = saveAllowedNonLabeledJumps; } } + function copyLoopOutParameters(state, copyDirection, emitAsStatements) { + if (state.loopOutParameters) { + for (var _a = 0, _b = state.loopOutParameters; _a < _b.length; _a++) { + var outParam = _b[_a]; + if (copyDirection === 0) { + emitIdentifier(outParam.originalName); + write(" = " + outParam.outParamName); + } + else { + write(outParam.outParamName + " = "); + emitIdentifier(outParam.originalName); + } + if (emitAsStatements) { + write(";"); + writeLine(); + } + else { + write(", "); + } + } + } + } function emitConvertedLoopCall(loop, emitAsBlock) { if (emitAsBlock) { write(" {"); writeLine(); increaseIndent(); } - var isSimpleLoop = !loop.state.nonLocalJumps && + var isSimpleLoop = !(loop.state.nonLocalJumps & ~4) && !loop.state.labeledNonLocalBreaks && !loop.state.labeledNonLocalContinues; var loopResult = makeUniqueName("state"); @@ -27902,6 +31482,8 @@ var ts; write("var " + loopResult + " = "); } write(loop.functionName + "(" + loop.paramList + ");"); + writeLine(); + copyLoopOutParameters(loop.state, 0, true); if (!isSimpleLoop) { writeLine(); if (loop.state.nonLocalJumps & 8) { @@ -27911,7 +31493,7 @@ var ts; convertedLoopState.nonLocalJumps |= 8; } else { - write("return " + loopResult + ".value"); + write("return " + loopResult + ".value;"); } writeLine(); } @@ -27919,10 +31501,6 @@ var ts; write("if (" + loopResult + " === \"break\") break;"); writeLine(); } - if (loop.state.nonLocalJumps & 4) { - write("if (" + loopResult + " === \"continue\") continue;"); - writeLine(); - } emitDispatchTableForLabeledJumps(loopResult, loop.state, convertedLoopState); } if (emitAsBlock) { @@ -27973,9 +31551,9 @@ var ts; var endPos = emitToken(86, node.pos); write(" "); endPos = emitToken(17, endPos); - if (node.initializer && node.initializer.kind === 212) { + if (node.initializer && node.initializer.kind === 219) { var variableDeclarationList = node.initializer; - var startIsEmitted = tryEmitStartOfVariableDeclarationList(variableDeclarationList, endPos); + var startIsEmitted = tryEmitStartOfVariableDeclarationList(variableDeclarationList); if (startIsEmitted) { emitCommaList(variableDeclarationList.declarations); } @@ -27999,7 +31577,7 @@ var ts; } } function emitForInOrForOfStatement(node) { - if (languageVersion < 2 && node.kind === 201) { + if (languageVersion < 2 && node.kind === 208) { emitLoop(node, emitDownLevelForOfStatementWorker); } else { @@ -28010,17 +31588,17 @@ var ts; var endPos = emitToken(86, node.pos); write(" "); endPos = emitToken(17, endPos); - if (node.initializer.kind === 212) { + if (node.initializer.kind === 219) { var variableDeclarationList = node.initializer; if (variableDeclarationList.declarations.length >= 1) { - tryEmitStartOfVariableDeclarationList(variableDeclarationList, endPos); + tryEmitStartOfVariableDeclarationList(variableDeclarationList); emit(variableDeclarationList.declarations[0]); } } else { emit(node.initializer); } - if (node.kind === 200) { + if (node.kind === 207) { write(" in "); } else { @@ -28035,9 +31613,6 @@ var ts; emitNormalLoopBody(node, true); } } - function emitDownLevelForOfStatement(node) { - emitLoop(node, emitDownLevelForOfStatementWorker); - } function emitDownLevelForOfStatementWorker(node, loop) { var endPos = emitToken(86, node.pos); write(" "); @@ -28059,24 +31634,24 @@ var ts; emitNodeWithoutSourceMap(node.expression); emitEnd(node.expression); write("; "); - emitStart(node.initializer); + emitStart(node.expression); emitNodeWithoutSourceMap(counter); write(" < "); emitNodeWithCommentsAndWithoutSourcemap(rhsReference); write(".length"); - emitEnd(node.initializer); + emitEnd(node.expression); write("; "); - emitStart(node.initializer); + emitStart(node.expression); emitNodeWithoutSourceMap(counter); write("++"); - emitEnd(node.initializer); + emitEnd(node.expression); emitToken(18, node.expression.end); write(" {"); writeLine(); increaseIndent(); var rhsIterationValue = createElementAccessExpression(rhsReference, counter); emitStart(node.initializer); - if (node.initializer.kind === 212) { + if (node.initializer.kind === 219) { write("var "); var variableDeclarationList = node.initializer; if (variableDeclarationList.declarations.length > 0) { @@ -28098,7 +31673,7 @@ var ts; } else { var assignmentExpression = createBinaryExpression(node.initializer, 56, rhsIterationValue, false); - if (node.initializer.kind === 164 || node.initializer.kind === 165) { + if (node.initializer.kind === 170 || node.initializer.kind === 171) { emitDestructuring(assignmentExpression, true, undefined); } else { @@ -28120,23 +31695,25 @@ var ts; } function emitBreakOrContinueStatement(node) { if (convertedLoopState) { - var jump = node.kind === 203 ? 2 : 4; + var jump = node.kind === 210 ? 2 : 4; var canUseBreakOrContinue = (node.label && convertedLoopState.labels && convertedLoopState.labels[node.label.text]) || (!node.label && (convertedLoopState.allowedNonLabeledJumps & jump)); if (!canUseBreakOrContinue) { + write("return "); + copyLoopOutParameters(convertedLoopState, 1, false); if (!node.label) { - if (node.kind === 203) { + if (node.kind === 210) { convertedLoopState.nonLocalJumps |= 2; - write("return \"break\";"); + write("\"break\";"); } else { convertedLoopState.nonLocalJumps |= 4; - write("return \"continue\";"); + write("\"continue\";"); } } else { - var labelMarker; - if (node.kind === 203) { + var labelMarker = void 0; + if (node.kind === 210) { labelMarker = "break-" + node.label.text; setLabeledJump(convertedLoopState, true, node.label.text, labelMarker); } @@ -28144,12 +31721,12 @@ var ts; labelMarker = "continue-" + node.label.text; setLabeledJump(convertedLoopState, false, node.label.text, labelMarker); } - write("return \"" + labelMarker + "\";"); + write("\"" + labelMarker + "\";"); } return; } } - emitToken(node.kind === 203 ? 70 : 75, node.pos); + emitToken(node.kind === 210 ? 70 : 75, node.pos); emitOptional(" ", node.label); write(";"); } @@ -28214,7 +31791,7 @@ var ts; ts.getLineOfLocalPositionFromLineMap(currentLineMap, ts.skipTrivia(currentText, node2.pos)); } function emitCaseOrDefaultClause(node) { - if (node.kind === 241) { + if (node.kind === 249) { write("case "); emit(node.expression); write(":"); @@ -28283,7 +31860,7 @@ var ts; function getContainingModule(node) { do { node = node.parent; - } while (node && node.kind !== 218); + } while (node && node.kind !== 225); return node; } function emitContainingModuleName(node) { @@ -28292,13 +31869,13 @@ var ts; } function emitModuleMemberName(node) { emitStart(node.name); - if (ts.getCombinedNodeFlags(node) & 2) { + if (ts.getCombinedNodeFlags(node) & 1) { var container = getContainingModule(node); if (container) { write(getGeneratedNameForNode(container)); write("."); } - else if (modulekind !== 5 && modulekind !== 4) { + else if (modulekind !== ts.ModuleKind.ES6 && modulekind !== ts.ModuleKind.System) { write("exports."); } } @@ -28308,20 +31885,20 @@ var ts; function createVoidZero() { var zero = ts.createSynthesizedNode(8); zero.text = "0"; - var result = ts.createSynthesizedNode(177); + var result = ts.createSynthesizedNode(183); result.expression = zero; return result; } function emitEs6ExportDefaultCompat(node) { - if (node.parent.kind === 248) { - ts.Debug.assert(!!(node.flags & 512) || node.kind === 227); - if (modulekind === 1 || modulekind === 2 || modulekind === 3) { + if (node.parent.kind === 256) { + ts.Debug.assert(!!(node.flags & 512) || node.kind === 235); + if (modulekind === ts.ModuleKind.CommonJS || modulekind === ts.ModuleKind.AMD || modulekind === ts.ModuleKind.UMD) { if (!isEs6Module) { - if (languageVersion === 1) { - write("Object.defineProperty(exports, \"__esModule\", { value: true });"); + if (languageVersion !== 0) { + write('Object.defineProperty(exports, "__esModule", { value: true });'); writeLine(); } - else if (languageVersion === 0) { + else { write("exports.__esModule = true;"); writeLine(); } @@ -28330,10 +31907,10 @@ var ts; } } function emitExportMemberAssignment(node) { - if (node.flags & 2) { + if (node.flags & 1) { writeLine(); emitStart(node); - if (modulekind === 4 && node.parent === currentSourceFile) { + if (modulekind === ts.ModuleKind.System && node.parent === currentSourceFile) { write(exportFunctionForFile + "(\""); if (node.flags & 512) { write("default"); @@ -28349,7 +31926,7 @@ var ts; if (node.flags & 512) { emitEs6ExportDefaultCompat(node); if (languageVersion === 0) { - write("exports[\"default\"]"); + write('exports["default"]'); } else { write("exports.default"); @@ -28366,7 +31943,7 @@ var ts; } } function emitExportMemberAssignments(name) { - if (modulekind === 4) { + if (modulekind === ts.ModuleKind.System) { return; } if (!exportEquals && exportSpecifiers && ts.hasProperty(exportSpecifiers, name.text)) { @@ -28385,7 +31962,7 @@ var ts; } } function emitExportSpecifierInSystemModule(specifier) { - ts.Debug.assert(modulekind === 4); + ts.Debug.assert(modulekind === ts.ModuleKind.System); if (!resolver.getReferencedValueDeclaration(specifier.propertyName || specifier.name) && !resolver.isValueAliasDeclaration(specifier)) { return; } @@ -28399,7 +31976,7 @@ var ts; emitEnd(specifier.name); write(";"); } - function emitAssignment(name, value, shouldEmitCommaBeforeAssignment) { + function emitAssignment(name, value, shouldEmitCommaBeforeAssignment, nodeForSourceMap) { if (shouldEmitCommaBeforeAssignment) { write(", "); } @@ -28409,63 +31986,75 @@ var ts; emitNodeWithCommentsAndWithoutSourcemap(name); write("\", "); } - var isVariableDeclarationOrBindingElement = name.parent && (name.parent.kind === 211 || name.parent.kind === 163); - if (isVariableDeclarationOrBindingElement) { - emitModuleMemberName(name.parent); - } - else { - emit(name); - } - write(" = "); - emit(value); + var isVariableDeclarationOrBindingElement = name.parent && (name.parent.kind === 218 || name.parent.kind === 169); + emitStart(isFirstVariableDeclaration(nodeForSourceMap) ? nodeForSourceMap.parent : nodeForSourceMap); + withTemporaryNoSourceMap(function () { + if (isVariableDeclarationOrBindingElement) { + emitModuleMemberName(name.parent); + } + else { + emit(name); + } + write(" = "); + emit(value); + }); + emitEnd(nodeForSourceMap, true); if (exportChanged) { write(")"); } } - function emitTempVariableAssignment(expression, canDefineTempVariablesInPlace, shouldEmitCommaBeforeAssignment) { + function emitTempVariableAssignment(expression, canDefineTempVariablesInPlace, shouldEmitCommaBeforeAssignment, sourceMapNode) { var identifier = createTempVariable(0); if (!canDefineTempVariablesInPlace) { recordTempDeclaration(identifier); } - emitAssignment(identifier, expression, shouldEmitCommaBeforeAssignment); + emitAssignment(identifier, expression, shouldEmitCommaBeforeAssignment, sourceMapNode || expression.parent); return identifier; } + function isFirstVariableDeclaration(root) { + return root.kind === 218 && + root.parent.kind === 219 && + root.parent.declarations[0] === root; + } function emitDestructuring(root, isAssignmentExpressionStatement, value) { var emitCount = 0; var canDefineTempVariablesInPlace = false; - if (root.kind === 211) { - var isExported = ts.getCombinedNodeFlags(root) & 2; + if (root.kind === 218) { + var isExported = ts.getCombinedNodeFlags(root) & 1; var isSourceLevelForSystemModuleKind = shouldHoistDeclarationInSystemJsModule(root); canDefineTempVariablesInPlace = !isExported && !isSourceLevelForSystemModuleKind; } - else if (root.kind === 138) { + else if (root.kind === 142) { canDefineTempVariablesInPlace = true; } - if (root.kind === 181) { + if (root.kind === 187) { emitAssignmentExpression(root); } else { ts.Debug.assert(!isAssignmentExpressionStatement); + if (isFirstVariableDeclaration(root)) { + sourceMap.changeEmitSourcePos(); + } emitBindingElement(root, value); } - function ensureIdentifier(expr, reuseIdentifierExpressions) { + function ensureIdentifier(expr, reuseIdentifierExpressions, sourceMapNode) { if (expr.kind === 69 && reuseIdentifierExpressions) { return expr; } - var identifier = emitTempVariableAssignment(expr, canDefineTempVariablesInPlace, emitCount > 0); + var identifier = emitTempVariableAssignment(expr, canDefineTempVariablesInPlace, emitCount > 0, sourceMapNode); emitCount++; return identifier; } - function createDefaultValueCheck(value, defaultValue) { - value = ensureIdentifier(value, true); - var equals = ts.createSynthesizedNode(181); + function createDefaultValueCheck(value, defaultValue, sourceMapNode) { + value = ensureIdentifier(value, true, sourceMapNode); + var equals = ts.createSynthesizedNode(187); equals.left = value; equals.operatorToken = ts.createSynthesizedNode(32); equals.right = createVoidZero(); return createConditionalExpression(equals, defaultValue, value); } function createConditionalExpression(condition, whenTrue, whenFalse) { - var cond = ts.createSynthesizedNode(182); + var cond = ts.createSynthesizedNode(188); cond.condition = condition; cond.questionToken = ts.createSynthesizedNode(53); cond.whenTrue = whenTrue; @@ -28480,20 +32069,20 @@ var ts; } function createPropertyAccessForDestructuringProperty(object, propName) { var index; - var nameIsComputed = propName.kind === 136; + var nameIsComputed = propName.kind === 140; if (nameIsComputed) { - index = ensureIdentifier(propName.expression, false); + index = ensureIdentifier(propName.expression, false, propName); } else { index = ts.createSynthesizedNode(propName.kind); - index.text = propName.text; + index.text = ts.unescapeIdentifier(propName.text); } return !nameIsComputed && index.kind === 69 ? createPropertyAccessExpression(object, index) : createElementAccessExpression(object, index); } function createSliceCall(value, sliceIndex) { - var call = ts.createSynthesizedNode(168); + var call = ts.createSynthesizedNode(174); var sliceIdentifier = ts.createSynthesizedNode(69); sliceIdentifier.text = "slice"; call.expression = createPropertyAccessExpression(value, sliceIdentifier); @@ -28501,56 +32090,56 @@ var ts; call.arguments[0] = createNumericLiteral(sliceIndex); return call; } - function emitObjectLiteralAssignment(target, value) { + function emitObjectLiteralAssignment(target, value, sourceMapNode) { var properties = target.properties; if (properties.length !== 1) { - value = ensureIdentifier(value, true); + value = ensureIdentifier(value, true, sourceMapNode); } for (var _a = 0, properties_5 = properties; _a < properties_5.length; _a++) { var p = properties_5[_a]; - if (p.kind === 245 || p.kind === 246) { + if (p.kind === 253 || p.kind === 254) { var propName = p.name; - var target_1 = p.kind === 246 ? p : p.initializer || propName; - emitDestructuringAssignment(target_1, createPropertyAccessForDestructuringProperty(value, propName)); + var target_1 = p.kind === 254 ? p : p.initializer || propName; + emitDestructuringAssignment(target_1, createPropertyAccessForDestructuringProperty(value, propName), p); } } } - function emitArrayLiteralAssignment(target, value) { + function emitArrayLiteralAssignment(target, value, sourceMapNode) { var elements = target.elements; if (elements.length !== 1) { - value = ensureIdentifier(value, true); + value = ensureIdentifier(value, true, sourceMapNode); } for (var i = 0; i < elements.length; i++) { var e = elements[i]; - if (e.kind !== 187) { - if (e.kind !== 185) { - emitDestructuringAssignment(e, createElementAccessExpression(value, createNumericLiteral(i))); + if (e.kind !== 193) { + if (e.kind !== 191) { + emitDestructuringAssignment(e, createElementAccessExpression(value, createNumericLiteral(i)), e); } else if (i === elements.length - 1) { - emitDestructuringAssignment(e.expression, createSliceCall(value, i)); + emitDestructuringAssignment(e.expression, createSliceCall(value, i), e); } } } } - function emitDestructuringAssignment(target, value) { - if (target.kind === 246) { + function emitDestructuringAssignment(target, value, sourceMapNode) { + if (target.kind === 254) { if (target.objectAssignmentInitializer) { - value = createDefaultValueCheck(value, target.objectAssignmentInitializer); + value = createDefaultValueCheck(value, target.objectAssignmentInitializer, sourceMapNode); } target = target.name; } - else if (target.kind === 181 && target.operatorToken.kind === 56) { - value = createDefaultValueCheck(value, target.right); + else if (target.kind === 187 && target.operatorToken.kind === 56) { + value = createDefaultValueCheck(value, target.right, sourceMapNode); target = target.left; } - if (target.kind === 165) { - emitObjectLiteralAssignment(target, value); + if (target.kind === 171) { + emitObjectLiteralAssignment(target, value, sourceMapNode); } - else if (target.kind === 164) { - emitArrayLiteralAssignment(target, value); + else if (target.kind === 170) { + emitArrayLiteralAssignment(target, value, sourceMapNode); } else { - emitAssignment(target, value, emitCount > 0); + emitAssignment(target, value, emitCount > 0, sourceMapNode); emitCount++; } } @@ -28561,24 +32150,24 @@ var ts; emit(value); } else if (isAssignmentExpressionStatement) { - emitDestructuringAssignment(target, value); + emitDestructuringAssignment(target, value, ts.nodeIsSynthesized(root) ? target : root); } else { - if (root.parent.kind !== 172) { + if (root.parent.kind !== 178) { write("("); } - value = ensureIdentifier(value, true); - emitDestructuringAssignment(target, value); + value = ensureIdentifier(value, true, root); + emitDestructuringAssignment(target, value, root); write(", "); emit(value); - if (root.parent.kind !== 172) { + if (root.parent.kind !== 178) { write(")"); } } } function emitBindingElement(target, value) { if (target.initializer) { - value = value ? createDefaultValueCheck(value, target.initializer) : target.initializer; + value = value ? createDefaultValueCheck(value, target.initializer, target) : target.initializer; } else if (!value) { value = createVoidZero(); @@ -28588,15 +32177,15 @@ var ts; var elements = pattern.elements; var numElements = elements.length; if (numElements !== 1) { - value = ensureIdentifier(value, numElements !== 0); + value = ensureIdentifier(value, numElements !== 0, target); } for (var i = 0; i < numElements; i++) { var element = elements[i]; - if (pattern.kind === 161) { + if (pattern.kind === 167) { var propName = element.propertyName || element.name; emitBindingElement(element, createPropertyAccessForDestructuringProperty(value, propName)); } - else if (element.kind !== 187) { + else if (element.kind !== 193) { if (!element.dotDotDotToken) { emitBindingElement(element, createElementAccessExpression(value, createNumericLiteral(i))); } @@ -28607,29 +32196,49 @@ var ts; } } else { - emitAssignment(target.name, value, emitCount > 0); + emitAssignment(target.name, value, emitCount > 0, target); emitCount++; } } } function emitVariableDeclaration(node) { if (ts.isBindingPattern(node.name)) { - if (languageVersion < 2) { - emitDestructuring(node, false); - } - else { + var isExported = ts.getCombinedNodeFlags(node) & 1; + if (languageVersion >= 2 && (!isExported || modulekind === ts.ModuleKind.ES6)) { + var isTopLevelDeclarationInSystemModule = modulekind === ts.ModuleKind.System && + shouldHoistVariable(node, true); + if (isTopLevelDeclarationInSystemModule) { + write("("); + } emit(node.name); emitOptional(" = ", node.initializer); + if (isTopLevelDeclarationInSystemModule) { + write(")"); + } + } + else { + emitDestructuring(node, false); } } else { var initializer = node.initializer; - if (!initializer && languageVersion < 2) { - var isLetDefinedInLoop = (resolver.getNodeCheckFlags(node) & 16384) && - (getCombinedFlagsForIdentifier(node.name) & 8192); - if (isLetDefinedInLoop && - node.parent.parent.kind !== 200 && - node.parent.parent.kind !== 201) { + if (!initializer && + languageVersion < 2 && + node.name.kind === 69) { + var container = ts.getEnclosingBlockScopeContainer(node); + var flags = resolver.getNodeCheckFlags(node); + var isCapturedInFunction = flags & 131072; + var isDeclaredInLoop = flags & 262144; + var emittedAsTopLevel = ts.isBlockScopedContainerTopLevel(container) || + (isCapturedInFunction && isDeclaredInLoop && container.kind === 199 && ts.isIterationStatement(container.parent, false)); + var emittedAsNestedLetDeclaration = ts.getCombinedNodeFlags(node) & 1024 && + !emittedAsTopLevel; + var emitExplicitInitializer = emittedAsNestedLetDeclaration && + container.kind !== 207 && + container.kind !== 208 && + (!resolver.isDeclarationWithCollidingName(node) || + (isDeclaredInLoop && !isCapturedInFunction && !ts.isIterationStatement(container, false))); + if (emitExplicitInitializer) { initializer = createVoidZero(); } } @@ -28647,7 +32256,7 @@ var ts; } } function emitExportVariableAssignments(node) { - if (node.kind === 187) { + if (node.kind === 193) { return; } var name = node.name; @@ -28658,20 +32267,14 @@ var ts; ts.forEach(name.elements, emitExportVariableAssignments); } } - function getCombinedFlagsForIdentifier(node) { - if (!node.parent || (node.parent.kind !== 211 && node.parent.kind !== 163)) { - return 0; - } - return ts.getCombinedNodeFlags(node.parent); - } function isES6ExportedDeclaration(node) { - return !!(node.flags & 2) && - modulekind === 5 && - node.parent.kind === 248; + return !!(node.flags & 1) && + modulekind === ts.ModuleKind.ES6 && + node.parent.kind === 256; } function emitVariableStatement(node) { var startIsEmitted = false; - if (node.flags & 2) { + if (node.flags & 1) { if (isES6ExportedDeclaration(node)) { write("export "); startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList); @@ -28690,12 +32293,12 @@ var ts; write(";"); } } - if (modulekind !== 5 && node.parent === currentSourceFile) { + if (modulekind !== ts.ModuleKind.ES6 && node.parent === currentSourceFile) { ts.forEach(node.declarationList.declarations, emitExportVariableAssignments); } } function shouldEmitLeadingAndTrailingCommentsForVariableStatement(node) { - if (!(node.flags & 2)) { + if (!(node.flags & 1)) { return true; } if (isES6ExportedDeclaration(node)) { @@ -28712,12 +32315,12 @@ var ts; function emitParameter(node) { if (languageVersion < 2) { if (ts.isBindingPattern(node.name)) { - var name_26 = createTempVariable(0); + var name_28 = createTempVariable(0); if (!tempParameters) { tempParameters = []; } - tempParameters.push(name_26); - emit(name_26); + tempParameters.push(name_28); + emit(name_28); } else { emit(node.name); @@ -28733,7 +32336,7 @@ var ts; } function emitDefaultValueAssignments(node) { if (languageVersion < 2) { - var tempIndex = 0; + var tempIndex_1 = 0; ts.forEach(node.parameters, function (parameter) { if (parameter.dotDotDotToken) { return; @@ -28745,15 +32348,15 @@ var ts; writeLine(); write("var "); if (hasBindingElements) { - emitDestructuring(parameter, false, tempParameters[tempIndex]); + emitDestructuring(parameter, false, tempParameters[tempIndex_1]); } else { - emit(tempParameters[tempIndex]); + emit(tempParameters[tempIndex_1]); write(" = "); emit(initializer); } write(";"); - tempIndex++; + tempIndex_1++; } } else if (initializer) { @@ -28775,7 +32378,7 @@ var ts; } } function emitRestParameter(node) { - if (languageVersion < 2 && ts.hasRestParameter(node)) { + if (languageVersion < 2 && ts.hasDeclaredRestParameter(node)) { var restIndex = node.parameters.length - 1; var restParam = node.parameters[restIndex]; if (ts.isBindingPattern(restParam.name)) { @@ -28816,12 +32419,12 @@ var ts; } } function emitAccessor(node) { - write(node.kind === 145 ? "get " : "set "); + write(node.kind === 149 ? "get " : "set "); emit(node.name); emitSignatureAndBody(node); } function shouldEmitAsArrowFunction(node) { - return node.kind === 174 && languageVersion >= 2; + return node.kind === 180 && languageVersion >= 2; } function emitDeclarationName(node) { if (node.name) { @@ -28832,20 +32435,24 @@ var ts; } } function shouldEmitFunctionName(node) { - if (node.kind === 173) { + if (node.kind === 179) { return !!node.name; } - if (node.kind === 213) { - return !!node.name || languageVersion < 2; + if (node.kind === 220) { + return !!node.name || modulekind !== ts.ModuleKind.ES6; } } function emitFunctionDeclaration(node) { if (ts.nodeIsMissing(node.body)) { return emitCommentsOnNotEmittedNode(node); } - if (node.kind !== 143 && node.kind !== 142 && - node.parent && node.parent.kind !== 245 && - node.parent.kind !== 168) { + var kind = node.kind, parent = node.parent; + if (kind !== 147 && + kind !== 146 && + parent && + parent.kind !== 253 && + parent.kind !== 174 && + parent.kind !== 170) { emitLeadingComments(node); } emitStart(node); @@ -28866,11 +32473,13 @@ var ts; emitDeclarationName(node); } emitSignatureAndBody(node); - if (modulekind !== 5 && node.kind === 213 && node.parent === currentSourceFile && node.name) { + if (modulekind !== ts.ModuleKind.ES6 && kind === 220 && parent === currentSourceFile && node.name) { emitExportMemberAssignments(node.name); } emitEnd(node); - if (node.kind !== 143 && node.kind !== 142) { + if (kind !== 147 && + kind !== 146 && + kind !== 180) { emitTrailingComments(node); } } @@ -28887,8 +32496,9 @@ var ts; write("("); if (node) { var parameters = node.parameters; - var omitCount = languageVersion < 2 && ts.hasRestParameter(node) ? 1 : 0; - emitList(parameters, 0, parameters.length - omitCount, false, false); + var skipCount = node.parameters.length && node.parameters[0].name.text === "this" ? 1 : 0; + var omitCount = languageVersion < 2 && ts.hasDeclaredRestParameter(node) ? 1 : 0; + emitList(parameters, skipCount, parameters.length - omitCount - skipCount, false, false); } write(")"); decreaseIndent(); @@ -28902,34 +32512,36 @@ var ts; } function emitAsyncFunctionBodyForES6(node) { var promiseConstructor = ts.getEntityNameFromTypeNode(node.type); - var isArrowFunction = node.kind === 174; - var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 4096) !== 0; + var isArrowFunction = node.kind === 180; + var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 8192) !== 0; if (!isArrowFunction) { write(" {"); increaseIndent(); writeLine(); + if (resolver.getNodeCheckFlags(node) & 4096) { + writeLines("\nconst _super = (function (geti, seti) {\n const cache = Object.create(null);\n return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });\n})(name => super[name], (name, value) => super[name] = value);"); + writeLine(); + } + else if (resolver.getNodeCheckFlags(node) & 2048) { + write("const _super = name => super[name];"); + writeLine(); + } write("return"); } write(" __awaiter(this"); if (hasLexicalArguments) { - write(", arguments"); + write(", arguments, "); } else { - write(", void 0"); + write(", void 0, "); } - if (promiseConstructor) { - write(", "); - emitNodeWithoutSourceMap(promiseConstructor); + if (languageVersion >= 2 || !promiseConstructor) { + write("void 0"); } else { - write(", Promise"); - } - if (hasLexicalArguments) { - write(", function* (_arguments)"); - } - else { - write(", function* ()"); + emitEntityNameAsExpression(promiseConstructor, false); } + write(", function* ()"); emitFunctionBody(node); write(")"); if (!isArrowFunction) { @@ -28944,7 +32556,7 @@ var ts; write(" { }"); } else { - if (node.body.kind === 192) { + if (node.body.kind === 199) { emitBlockFunctionBody(node, node.body); } else { @@ -28969,7 +32581,7 @@ var ts; emitSignatureParameters(node); } var isAsync = ts.isAsyncFunctionLike(node); - if (isAsync && languageVersion === 2) { + if (isAsync) { emitAsyncFunctionBodyForES6(node); } else { @@ -28996,14 +32608,13 @@ var ts; } write(" "); var current = body; - while (current.kind === 171) { + while (current.kind === 177) { current = current.expression; } - emitParenthesizedIf(body, current.kind === 165); + emitParenthesizedIf(body, current.kind === 171); } function emitDownLevelExpressionFunctionBody(node, body) { write(" {"); - scopeEmitStart(node); increaseIndent(); var outPos = writer.getTextPos(); emitDetachedCommentsAndUpdateCommentsInfo(node.body); @@ -29024,8 +32635,10 @@ var ts; increaseIndent(); writeLine(); emitLeadingComments(node.body); + emitStart(body); write("return "); emit(body); + emitEnd(body); write(";"); emitTrailingComments(node.body); emitTempDeclarations(true); @@ -29035,11 +32648,9 @@ var ts; emitStart(node.body); write("}"); emitEnd(node.body); - scopeEmitEnd(); } function emitBlockFunctionBody(node, body) { write(" {"); - scopeEmitStart(node); var initialTextPos = writer.getTextPos(); increaseIndent(); emitDetachedCommentsAndUpdateCommentsInfo(body.statements); @@ -29066,25 +32677,23 @@ var ts; decreaseIndent(); } emitToken(16, body.statements.end); - scopeEmitEnd(); } - function findInitialSuperCall(ctor) { - if (ctor.body) { - var statement = ctor.body.statements[0]; - if (statement && statement.kind === 195) { - var expr = statement.expression; - if (expr && expr.kind === 168) { - var func = expr.expression; - if (func && func.kind === 95) { - return statement; - } - } - } + function getSuperCallAtGivenIndex(ctor, index) { + if (!ctor.body) { + return undefined; + } + var statements = ctor.body.statements; + if (!statements || index >= statements.length) { + return undefined; + } + var statement = statements[index]; + if (statement.kind === 202) { + return ts.isSuperCallExpression(statement.expression) ? statement : undefined; } } function emitParameterPropertyAssignments(node) { ts.forEach(node.parameters, function (param) { - if (param.flags & 56) { + if (param.flags & 92) { writeLine(); emitStart(param); emitStart(param.name); @@ -29104,7 +32713,7 @@ var ts; emitNodeWithCommentsAndWithoutSourcemap(memberName); write("]"); } - else if (memberName.kind === 136) { + else if (memberName.kind === 140) { emitComputedPropertyName(memberName); } else { @@ -29116,7 +32725,7 @@ var ts; var properties = []; for (var _a = 0, _b = node.members; _a < _b.length; _a++) { var member = _b[_a]; - if (member.kind === 141 && isStatic === ((member.flags & 64) !== 0) && member.initializer) { + if (member.kind === 145 && isStatic === ((member.flags & 32) !== 0) && member.initializer) { properties.push(member); } } @@ -29137,7 +32746,7 @@ var ts; emit(receiver); } else { - if (property.flags & 64) { + if (property.flags & 32) { emitDeclarationName(node); } else { @@ -29156,11 +32765,11 @@ var ts; } function emitMemberFunctionsForES5AndLower(node) { ts.forEach(node.members, function (member) { - if (member.kind === 191) { + if (member.kind === 198) { writeLine(); write(";"); } - else if (member.kind === 143 || node.kind === 142) { + else if (member.kind === 147 || node.kind === 146) { if (!member.body) { return emitCommentsOnNotEmittedNode(member); } @@ -29177,7 +32786,7 @@ var ts; write(";"); emitTrailingComments(member); } - else if (member.kind === 145 || member.kind === 146) { + else if (member.kind === 149 || member.kind === 150) { var accessors = ts.getAllAccessorDeclarations(node.members, member); if (member === accessors.firstAccessor) { writeLine(); @@ -29227,22 +32836,22 @@ var ts; function emitMemberFunctionsForES6AndHigher(node) { for (var _a = 0, _b = node.members; _a < _b.length; _a++) { var member = _b[_a]; - if ((member.kind === 143 || node.kind === 142) && !member.body) { + if ((member.kind === 147 || node.kind === 146) && !member.body) { emitCommentsOnNotEmittedNode(member); } - else if (member.kind === 143 || - member.kind === 145 || - member.kind === 146) { + else if (member.kind === 147 || + member.kind === 149 || + member.kind === 150) { writeLine(); emitLeadingComments(member); emitStart(member); - if (member.flags & 64) { + if (member.flags & 32) { write("static "); } - if (member.kind === 145) { + if (member.kind === 149) { write("get "); } - else if (member.kind === 146) { + else if (member.kind === 150) { write("set "); } if (member.asteriskToken) { @@ -29253,7 +32862,7 @@ var ts; emitEnd(member); emitTrailingComments(member); } - else if (member.kind === 191) { + else if (member.kind === 198) { writeLine(); write(";"); } @@ -29278,10 +32887,10 @@ var ts; function emitConstructorWorker(node, baseTypeElement) { var hasInstancePropertyWithInitializer = false; ts.forEach(node.members, function (member) { - if (member.kind === 144 && !member.body) { + if (member.kind === 148 && !member.body) { emitCommentsOnNotEmittedNode(member); } - if (member.kind === 141 && member.initializer && (member.flags & 64) === 0) { + if (member.kind === 145 && member.initializer && (member.flags & 32) === 0) { hasInstancePropertyWithInitializer = true; } }); @@ -29314,7 +32923,6 @@ var ts; } var startIndex = 0; write(" {"); - scopeEmitStart(node, "constructor"); increaseIndent(); if (ctor) { startIndex = emitDirectivePrologues(ctor.body.statements, true); @@ -29326,7 +32934,7 @@ var ts; emitDefaultValueAssignments(ctor); emitRestParameter(ctor); if (baseTypeElement) { - superCall = findInitialSuperCall(ctor); + superCall = getSuperCallAtGivenIndex(ctor, startIndex); if (superCall) { writeLine(); emit(superCall); @@ -29362,7 +32970,6 @@ var ts; } decreaseIndent(); emitToken(16, ctor ? ctor.body.statements.end : node.members.end); - scopeEmitEnd(); emitEnd(ctor || node); if (ctor) { emitTrailingComments(ctor); @@ -29381,19 +32988,33 @@ var ts; else { emitClassLikeDeclarationForES6AndHigher(node); } - if (modulekind !== 5 && node.parent === currentSourceFile && node.name) { + if (modulekind !== ts.ModuleKind.ES6 && node.parent === currentSourceFile && node.name) { emitExportMemberAssignments(node.name); } } function emitClassLikeDeclarationForES6AndHigher(node) { - var thisNodeIsDecorated = ts.nodeIsDecorated(node); - if (node.kind === 214) { - if (thisNodeIsDecorated) { + var decoratedClassAlias; + var isHoistedDeclarationInSystemModule = shouldHoistDeclarationInSystemJsModule(node); + var isDecorated = ts.nodeIsDecorated(node); + var rewriteAsClassExpression = isDecorated || isHoistedDeclarationInSystemModule; + if (node.kind === 221) { + if (rewriteAsClassExpression) { + if (isDecorated && resolver.getNodeCheckFlags(node) & 524288) { + decoratedClassAlias = ts.unescapeIdentifier(makeUniqueName(node.name ? node.name.text : "default")); + decoratedClassAliases[ts.getNodeId(node)] = decoratedClassAlias; + write("let " + decoratedClassAlias + ";"); + writeLine(); + } if (isES6ExportedDeclaration(node) && !(node.flags & 512)) { write("export "); } - write("let "); + if (!isHoistedDeclarationInSystemModule) { + write("let "); + } emitDeclarationName(node); + if (decoratedClassAlias !== undefined) { + write(" = " + decoratedClassAlias); + } write(" = "); } else if (isES6ExportedDeclaration(node)) { @@ -29404,7 +33025,7 @@ var ts; } } var staticProperties = getInitializedProperties(node, true); - var isClassExpressionWithStaticProperties = staticProperties.length > 0 && node.kind === 186; + var isClassExpressionWithStaticProperties = staticProperties.length > 0 && node.kind === 192; var tempVariable; if (isClassExpressionWithStaticProperties) { tempVariable = createAndRecordTempVariable(0); @@ -29414,7 +33035,7 @@ var ts; write(" = "); } write("class"); - if ((node.name || (node.flags & 512 && staticProperties.length > 0)) && !thisNodeIsDecorated) { + if (node.name || (node.flags & 512 && (staticProperties.length > 0 || modulekind !== ts.ModuleKind.ES6) && !rewriteAsClassExpression)) { write(" "); emitDeclarationName(node); } @@ -29425,15 +33046,14 @@ var ts; } write(" {"); increaseIndent(); - scopeEmitStart(node); writeLine(); emitConstructor(node, baseTypeNode); emitMemberFunctionsForES6AndHigher(node); decreaseIndent(); writeLine(); emitToken(16, node.members.end); - scopeEmitEnd(); - if (thisNodeIsDecorated) { + if (rewriteAsClassExpression) { + decoratedClassAliases[ts.getNodeId(node)] = undefined; write(";"); } if (isClassExpressionWithStaticProperties) { @@ -29452,26 +33072,36 @@ var ts; else { writeLine(); emitPropertyDeclarations(node, staticProperties); - emitDecoratorsOfClass(node); + emitDecoratorsOfClass(node, decoratedClassAlias); } - if (!isES6ExportedDeclaration(node) && (node.flags & 2)) { - writeLine(); - emitStart(node); - emitModuleMemberName(node); - write(" = "); - emitDeclarationName(node); - emitEnd(node); - write(";"); + if (!(node.flags & 1)) { + return; } - else if (isES6ExportedDeclaration(node) && (node.flags & 512) && thisNodeIsDecorated) { - writeLine(); - write("export default "); - emitDeclarationName(node); - write(";"); + if (modulekind !== ts.ModuleKind.ES6) { + emitExportMemberAssignment(node); + } + else { + if (node.flags & 512) { + if (isDecorated) { + writeLine(); + write("export default "); + emitDeclarationName(node); + write(";"); + } + } + else if (node.parent.kind !== 256) { + writeLine(); + emitStart(node); + emitModuleMemberName(node); + write(" = "); + emitDeclarationName(node); + emitEnd(node); + write(";"); + } } } function emitClassLikeDeclarationBelowES6(node) { - if (node.kind === 214) { + if (node.kind === 221) { if (!shouldHoistDeclarationInSystemJsModule(node)) { write("var "); } @@ -29495,7 +33125,6 @@ var ts; tempParameters = undefined; computedPropertyNamesToGeneratedNames = undefined; increaseIndent(); - scopeEmitStart(node); if (baseTypeNode) { writeLine(); emitStart(baseTypeNode); @@ -29509,7 +33138,7 @@ var ts; emitMemberFunctionsForES5AndLower(node); emitPropertyDeclarations(node, getInitializedProperties(node, true)); writeLine(); - emitDecoratorsOfClass(node); + emitDecoratorsOfClass(node, undefined); writeLine(); emitToken(16, node.members.end, function () { write("return "); @@ -29526,73 +33155,71 @@ var ts; decreaseIndent(); writeLine(); emitToken(16, node.members.end); - scopeEmitEnd(); emitStart(node); - write(")("); + write("("); if (baseTypeNode) { emit(baseTypeNode.expression); } - write(")"); - if (node.kind === 214) { + write("))"); + if (node.kind === 221) { write(";"); } emitEnd(node); - if (node.kind === 214) { + if (node.kind === 221) { emitExportMemberAssignment(node); } } function emitClassMemberPrefix(node, member) { emitDeclarationName(node); - if (!(member.flags & 64)) { + if (!(member.flags & 32)) { write(".prototype"); } } - function emitDecoratorsOfClass(node) { + function emitDecoratorsOfClass(node, decoratedClassAlias) { emitDecoratorsOfMembers(node, 0); - emitDecoratorsOfMembers(node, 64); - emitDecoratorsOfConstructor(node); + emitDecoratorsOfMembers(node, 32); + emitDecoratorsOfConstructor(node, decoratedClassAlias); } - function emitDecoratorsOfConstructor(node) { + function emitDecoratorsOfConstructor(node, decoratedClassAlias) { var decorators = node.decorators; var constructor = ts.getFirstConstructorWithBody(node); - var hasDecoratedParameters = constructor && ts.forEach(constructor.parameters, ts.nodeIsDecorated); - if (!decorators && !hasDecoratedParameters) { + var firstParameterDecorator = constructor && ts.forEach(constructor.parameters, function (parameter) { return parameter.decorators; }); + if (!decorators && !firstParameterDecorator) { return; } writeLine(); - emitStart(node); + emitStart(node.decorators || firstParameterDecorator); emitDeclarationName(node); + if (decoratedClassAlias !== undefined) { + write(" = " + decoratedClassAlias); + } write(" = __decorate(["); increaseIndent(); writeLine(); var decoratorCount = decorators ? decorators.length : 0; - var argumentsWritten = emitList(decorators, 0, decoratorCount, true, false, false, true, function (decorator) { - emitStart(decorator); - emit(decorator.expression); - emitEnd(decorator); - }); - argumentsWritten += emitDecoratorsOfParameters(constructor, argumentsWritten > 0); + var argumentsWritten = emitList(decorators, 0, decoratorCount, true, false, false, true, function (decorator) { return emit(decorator.expression); }); + if (firstParameterDecorator) { + argumentsWritten += emitDecoratorsOfParameters(constructor, argumentsWritten > 0); + } emitSerializedTypeMetadata(node, argumentsWritten >= 0); decreaseIndent(); writeLine(); write("], "); emitDeclarationName(node); - write(");"); - emitEnd(node); + write(")"); + emitEnd(node.decorators || firstParameterDecorator); + write(";"); writeLine(); } function emitDecoratorsOfMembers(node, staticFlag) { for (var _a = 0, _b = node.members; _a < _b.length; _a++) { var member = _b[_a]; - if ((member.flags & 64) !== staticFlag) { + if ((member.flags & 32) !== staticFlag) { continue; } if (!ts.nodeCanBeDecorated(member)) { continue; } - if (!ts.nodeOrChildIsDecorated(member)) { - continue; - } var decorators = void 0; var functionLikeMember = void 0; if (ts.isAccessor(member)) { @@ -29608,107 +33235,106 @@ var ts; } else { decorators = member.decorators; - if (member.kind === 143) { + if (member.kind === 147) { functionLikeMember = member; } } + var firstParameterDecorator = functionLikeMember && ts.forEach(functionLikeMember.parameters, function (parameter) { return parameter.decorators; }); + if (!decorators && !firstParameterDecorator) { + continue; + } writeLine(); - emitStart(member); + emitStart(decorators || firstParameterDecorator); write("__decorate(["); increaseIndent(); writeLine(); var decoratorCount = decorators ? decorators.length : 0; - var argumentsWritten = emitList(decorators, 0, decoratorCount, true, false, false, true, function (decorator) { - emitStart(decorator); - emit(decorator.expression); - emitEnd(decorator); - }); - argumentsWritten += emitDecoratorsOfParameters(functionLikeMember, argumentsWritten > 0); + var argumentsWritten = emitList(decorators, 0, decoratorCount, true, false, false, true, function (decorator) { return emit(decorator.expression); }); + if (firstParameterDecorator) { + argumentsWritten += emitDecoratorsOfParameters(functionLikeMember, argumentsWritten > 0); + } emitSerializedTypeMetadata(member, argumentsWritten > 0); decreaseIndent(); writeLine(); write("], "); - emitStart(member.name); emitClassMemberPrefix(node, member); write(", "); emitExpressionForPropertyName(member.name); - emitEnd(member.name); if (languageVersion > 0) { - if (member.kind !== 141) { + if (member.kind !== 145) { write(", null"); } else { write(", void 0"); } } - write(");"); - emitEnd(member); + write(")"); + emitEnd(decorators || firstParameterDecorator); + write(";"); writeLine(); } } function emitDecoratorsOfParameters(node, leadingComma) { var argumentsWritten = 0; if (node) { - var parameterIndex = 0; + var parameterIndex_1 = 0; for (var _a = 0, _b = node.parameters; _a < _b.length; _a++) { var parameter = _b[_a]; if (ts.nodeIsDecorated(parameter)) { var decorators = parameter.decorators; argumentsWritten += emitList(decorators, 0, decorators.length, true, false, leadingComma, true, function (decorator) { - emitStart(decorator); - write("__param(" + parameterIndex + ", "); + write("__param(" + parameterIndex_1 + ", "); emit(decorator.expression); write(")"); - emitEnd(decorator); }); leadingComma = true; } - ++parameterIndex; + parameterIndex_1++; } } return argumentsWritten; } function shouldEmitTypeMetadata(node) { switch (node.kind) { - case 143: + case 147: + case 149: + case 150: case 145: - case 146: - case 141: return true; } return false; } function shouldEmitReturnTypeMetadata(node) { switch (node.kind) { - case 143: + case 147: return true; } return false; } function shouldEmitParamTypesMetadata(node) { switch (node.kind) { - case 214: - case 143: - case 146: + case 221: + case 147: + case 150: return true; } return false; } function emitSerializedTypeOfNode(node) { switch (node.kind) { - case 214: + case 221: write("Function"); return; - case 141: - emitSerializedTypeNode(node.type); - return; - case 138: - emitSerializedTypeNode(node.type); - return; case 145: emitSerializedTypeNode(node.type); return; - case 146: + case 142: + emitSerializedTypeNode(node.type); + return; + case 149: + emitSerializedTypeNode(node.type); + return; + case 150: emitSerializedTypeNode(ts.getSetAccessorTypeAnnotationNode(node)); return; } @@ -29724,39 +33350,40 @@ var ts; case 103: write("void 0"); return; - case 160: + case 164: emitSerializedTypeNode(node.type); return; - case 152: - case 153: - write("Function"); - return; case 156: case 157: + write("Function"); + return; + case 160: + case 161: write("Array"); return; - case 150: + case 154: case 120: write("Boolean"); return; - case 130: - case 9: + case 132: + case 166: write("String"); return; - case 128: + case 130: write("Number"); return; - case 131: + case 133: write("Symbol"); return; - case 151: + case 155: emitSerializedTypeReferenceNode(node); return; - case 154: - case 155: case 158: case 159: + case 162: + case 163: case 117: + case 165: break; default: ts.Debug.fail("Cannot serialize unexpected type node."); @@ -29770,8 +33397,7 @@ var ts; while (ts.isDeclaration(location) || ts.isTypeNode(location)) { location = location.parent; } - var typeName = ts.cloneEntityName(node.typeName); - typeName.parent = location; + var typeName = ts.cloneEntityName(node.typeName, location); var result = resolver.getTypeReferenceSerializationKind(typeName); switch (result) { case ts.TypeReferenceSerializationKind.Unknown: @@ -29820,8 +33446,8 @@ var ts; } function emitSerializedParameterTypesOfNode(node) { if (node) { - var valueDeclaration; - if (node.kind === 214) { + var valueDeclaration = void 0; + if (node.kind === 221) { valueDeclaration = ts.getFirstConstructorWithBody(node); } else if (ts.isFunctionLike(node) && ts.nodeIsPresent(node.body)) { @@ -29837,10 +33463,10 @@ var ts; } if (parameters[i].dotDotDotToken) { var parameterType = parameters[i].type; - if (parameterType.kind === 156) { + if (parameterType.kind === 160) { parameterType = parameterType.elementType; } - else if (parameterType.kind === 151 && parameterType.typeArguments && parameterType.typeArguments.length === 1) { + else if (parameterType.kind === 155 && parameterType.typeArguments && parameterType.typeArguments.length === 1) { parameterType = parameterType.typeArguments[0]; } else { @@ -29911,9 +33537,10 @@ var ts; return; } if (!shouldHoistDeclarationInSystemJsModule(node)) { - if (!(node.flags & 2) || isES6ExportedDeclaration(node)) { + var isES6ExportedEnum = isES6ExportedDeclaration(node); + if (!(node.flags & 1) || (isES6ExportedEnum && isFirstDeclarationOfKind(node, node.symbol && node.symbol.declarations, 224))) { emitStart(node); - if (isES6ExportedDeclaration(node)) { + if (isES6ExportedEnum) { write("export "); } write("var "); @@ -29930,19 +33557,17 @@ var ts; emitEnd(node.name); write(") {"); increaseIndent(); - scopeEmitStart(node); emitLines(node.members); decreaseIndent(); writeLine(); emitToken(16, node.members.end); - scopeEmitEnd(); write(")("); emitModuleMemberName(node); write(" || ("); emitModuleMemberName(node); write(" = {}));"); emitEnd(node); - if (!isES6ExportedDeclaration(node) && node.flags & 2 && !shouldHoistDeclarationInSystemJsModule(node)) { + if (!isES6ExportedDeclaration(node) && node.flags & 1 && !shouldHoistDeclarationInSystemJsModule(node)) { writeLine(); emitStart(node); write("var "); @@ -29952,8 +33577,8 @@ var ts; emitEnd(node); write(";"); } - if (modulekind !== 5 && node.parent === currentSourceFile) { - if (modulekind === 4 && (node.flags & 2)) { + if (modulekind !== ts.ModuleKind.ES6 && node.parent === currentSourceFile) { + if (modulekind === ts.ModuleKind.System && (node.flags & 1)) { writeLine(); write(exportFunctionForFile + "(\""); emitDeclarationName(node); @@ -29993,7 +33618,7 @@ var ts; } } function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { - if (moduleDeclaration.body.kind === 218) { + if (moduleDeclaration.body.kind === 225) { var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); return recursiveInnerModule || moduleDeclaration.body; } @@ -30004,6 +33629,9 @@ var ts; function isModuleMergedWithES6Class(node) { return languageVersion === 2 && !!(resolver.getNodeCheckFlags(node) & 32768); } + function isFirstDeclarationOfKind(node, declarations, kind) { + return !ts.forEach(declarations, function (declaration) { return declaration.kind === kind && declaration.pos < node.pos; }); + } function emitModuleDeclaration(node) { var shouldEmit = shouldEmitModuleDeclaration(node); if (!shouldEmit) { @@ -30012,15 +33640,18 @@ var ts; var hoistedInDeclarationScope = shouldHoistDeclarationInSystemJsModule(node); var emitVarForModule = !hoistedInDeclarationScope && !isModuleMergedWithES6Class(node); if (emitVarForModule) { - emitStart(node); - if (isES6ExportedDeclaration(node)) { - write("export "); + var isES6ExportedNamespace = isES6ExportedDeclaration(node); + if (!isES6ExportedNamespace || isFirstDeclarationOfKind(node, node.symbol && node.symbol.declarations, 225)) { + emitStart(node); + if (isES6ExportedNamespace) { + write("export "); + } + write("var "); + emit(node.name); + write(";"); + emitEnd(node); + writeLine(); } - write("var "); - emit(node.name); - write(";"); - emitEnd(node); - writeLine(); } emitStart(node); write("(function ("); @@ -30028,7 +33659,7 @@ var ts; write(getGeneratedNameForNode(node)); emitEnd(node.name); write(") "); - if (node.body.kind === 219) { + if (node.body.kind === 226) { var saveConvertedLoopState = convertedLoopState; var saveTempFlags = tempFlags; var saveTempVariables = tempVariables; @@ -30044,7 +33675,6 @@ var ts; else { write("{"); increaseIndent(); - scopeEmitStart(node); emitCaptureThisForNodeIfNecessary(node); writeLine(); emit(node.body); @@ -30052,10 +33682,9 @@ var ts; writeLine(); var moduleBlock = getInnerMostModuleDeclarationFromDottedModule(node).body; emitToken(16, moduleBlock.statements.end); - scopeEmitEnd(); } write(")("); - if ((node.flags & 2) && !isES6ExportedDeclaration(node)) { + if ((node.flags & 1) && !isES6ExportedDeclaration(node)) { emit(node.name); write(" = "); } @@ -30065,7 +33694,7 @@ var ts; write(" = {}));"); emitEnd(node); if (!isES6ExportedDeclaration(node) && node.name.kind === 69 && node.parent === currentSourceFile) { - if (modulekind === 4 && (node.flags & 2)) { + if (modulekind === ts.ModuleKind.System && (node.flags & 1)) { writeLine(); write(exportFunctionForFile + "(\""); emitDeclarationName(node); @@ -30101,16 +33730,16 @@ var ts; } } function getNamespaceDeclarationNode(node) { - if (node.kind === 221) { + if (node.kind === 229) { return node; } var importClause = node.importClause; - if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 224) { + if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 232) { return importClause.namedBindings; } } function isDefaultImport(node) { - return node.kind === 222 && node.importClause && !!node.importClause.name; + return node.kind === 230 && node.importClause && !!node.importClause.name; } function emitExportImportAssignments(node) { if (ts.isAliasSymbolDeclaration(node) && resolver.isValueAliasDeclaration(node)) { @@ -30119,7 +33748,7 @@ var ts; ts.forEachChild(node, emitExportImportAssignments); } function emitImportDeclaration(node) { - if (modulekind !== 5) { + if (modulekind !== ts.ModuleKind.ES6) { return emitExternalImportDeclaration(node); } if (node.importClause) { @@ -30137,7 +33766,7 @@ var ts; if (shouldEmitNamedBindings) { emitLeadingComments(node.importClause.namedBindings); emitStart(node.importClause.namedBindings); - if (node.importClause.namedBindings.kind === 224) { + if (node.importClause.namedBindings.kind === 232) { write("* as "); emit(node.importClause.namedBindings.name); } @@ -30163,21 +33792,24 @@ var ts; } function emitExternalImportDeclaration(node) { if (ts.contains(externalImports, node)) { - var isExportedImport = node.kind === 221 && (node.flags & 2) !== 0; + var isExportedImport = node.kind === 229 && (node.flags & 1) !== 0; var namespaceDeclaration = getNamespaceDeclarationNode(node); - if (modulekind !== 2) { + var varOrConst = (languageVersion <= 1) ? "var " : "const "; + if (modulekind !== ts.ModuleKind.AMD) { emitLeadingComments(node); emitStart(node); if (namespaceDeclaration && !isDefaultImport(node)) { - if (!isExportedImport) - write("var "); + if (!isExportedImport) { + write(varOrConst); + } + ; emitModuleMemberName(namespaceDeclaration); write(" = "); } else { - var isNakedImport = 222 && !node.importClause; + var isNakedImport = 230 && !node.importClause; if (!isNakedImport) { - write("var "); + write(varOrConst); write(getGeneratedNameForNode(node)); write(" = "); } @@ -30202,7 +33834,7 @@ var ts; write(";"); } else if (namespaceDeclaration && isDefaultImport(node)) { - write("var "); + write(varOrConst); emitModuleMemberName(namespaceDeclaration); write(" = "); write(getGeneratedNameForNode(node)); @@ -30229,7 +33861,7 @@ var ts; write("export "); write("var "); } - else if (!(node.flags & 2)) { + else if (!(node.flags & 1)) { write("var "); } } @@ -30251,13 +33883,13 @@ var ts; } } function emitExportDeclaration(node) { - ts.Debug.assert(modulekind !== 4); - if (modulekind !== 5) { + ts.Debug.assert(modulekind !== ts.ModuleKind.System); + if (modulekind !== ts.ModuleKind.ES6) { if (node.moduleSpecifier && (!node.exportClause || resolver.isValueAliasDeclaration(node))) { emitStart(node); var generatedName = getGeneratedNameForNode(node); if (node.exportClause) { - if (modulekind !== 2) { + if (modulekind !== ts.ModuleKind.AMD) { write("var "); write(generatedName); write(" = "); @@ -30282,15 +33914,17 @@ var ts; } } else { - writeLine(); - write("__export("); - if (modulekind !== 2) { - emitRequire(ts.getExternalModuleName(node)); + if (hasExportStarsToExportValues && resolver.moduleExportsSomeValue(node.moduleSpecifier)) { + writeLine(); + write("__export("); + if (modulekind !== ts.ModuleKind.AMD) { + emitRequire(ts.getExternalModuleName(node)); + } + else { + write(generatedName); + } + write(");"); } - else { - write(generatedName); - } - write(");"); } emitEnd(node); } @@ -30315,7 +33949,7 @@ var ts; } } function emitExportOrImportSpecifierList(specifiers, shouldEmit) { - ts.Debug.assert(modulekind === 5); + ts.Debug.assert(modulekind === ts.ModuleKind.ES6); var needsComma = false; for (var _a = 0, specifiers_1 = specifiers; _a < specifiers_1.length; _a++) { var specifier = specifiers_1[_a]; @@ -30334,14 +33968,14 @@ var ts; } function emitExportAssignment(node) { if (!node.isExportEquals && resolver.isValueAliasDeclaration(node)) { - if (modulekind === 5) { + if (modulekind === ts.ModuleKind.ES6) { writeLine(); emitStart(node); write("export default "); var expression = node.expression; emit(expression); - if (expression.kind !== 213 && - expression.kind !== 214) { + if (expression.kind !== 220 && + expression.kind !== 221) { write(";"); } emitEnd(node); @@ -30349,7 +33983,7 @@ var ts; else { writeLine(); emitStart(node); - if (modulekind === 4) { + if (modulekind === ts.ModuleKind.System) { write(exportFunctionForFile + "(\"default\","); emit(node.expression); write(")"); @@ -30358,7 +33992,7 @@ var ts; emitEs6ExportDefaultCompat(node); emitContainingModuleName(node); if (languageVersion === 0) { - write("[\"default\"] = "); + write('["default"] = '); } else { write(".default = "); @@ -30374,26 +34008,28 @@ var ts; externalImports = []; exportSpecifiers = {}; exportEquals = undefined; - hasExportStars = false; + hasExportStarsToExportValues = false; for (var _a = 0, _b = sourceFile.statements; _a < _b.length; _a++) { var node = _b[_a]; switch (node.kind) { - case 222: + case 230: if (!node.importClause || resolver.isReferencedAliasDeclaration(node.importClause, true)) { externalImports.push(node); } break; - case 221: - if (node.moduleReference.kind === 232 && resolver.isReferencedAliasDeclaration(node)) { + case 229: + if (node.moduleReference.kind === 240 && resolver.isReferencedAliasDeclaration(node)) { externalImports.push(node); } break; - case 228: + case 236: if (node.moduleSpecifier) { if (!node.exportClause) { - externalImports.push(node); - hasExportStars = true; + if (resolver.moduleExportsSomeValue(node.moduleSpecifier)) { + externalImports.push(node); + hasExportStarsToExportValues = true; + } } else if (resolver.isValueAliasDeclaration(node)) { externalImports.push(node); @@ -30402,12 +34038,12 @@ var ts; else { for (var _c = 0, _d = node.exportClause.elements; _c < _d.length; _c++) { var specifier = _d[_c]; - var name_27 = (specifier.propertyName || specifier.name).text; - (exportSpecifiers[name_27] || (exportSpecifiers[name_27] = [])).push(specifier); + var name_29 = (specifier.propertyName || specifier.name).text; + (exportSpecifiers[name_29] || (exportSpecifiers[name_29] = [])).push(specifier); } } break; - case 227: + case 235: if (node.isExportEquals && !exportEquals) { exportEquals = node; } @@ -30416,7 +34052,7 @@ var ts; } } function emitExportStarHelper() { - if (hasExportStars) { + if (hasExportStarsToExportValues) { writeLine(); write("function __export(m) {"); increaseIndent(); @@ -30432,14 +34068,20 @@ var ts; if (namespaceDeclaration && !isDefaultImport(node)) { return ts.getTextOfNodeFromSourceText(currentText, namespaceDeclaration.name); } - if (node.kind === 222 && node.importClause) { + if (node.kind === 230 && node.importClause) { return getGeneratedNameForNode(node); } - if (node.kind === 228 && node.moduleSpecifier) { + if (node.kind === 236 && node.moduleSpecifier) { return getGeneratedNameForNode(node); } } - function getExternalModuleNameText(importNode) { + function getExternalModuleNameText(importNode, emitRelativePathAsModuleName) { + if (emitRelativePathAsModuleName) { + var name_30 = getExternalModuleNameFromDeclaration(host, resolver, importNode); + if (name_30) { + return "\"" + name_30 + "\""; + } + } var moduleName = ts.getExternalModuleName(importNode); if (moduleName.kind === 9) { return tryRenameExternalModule(moduleName) || getLiteralText(moduleName); @@ -30454,8 +34096,8 @@ var ts; var started = false; for (var _a = 0, externalImports_1 = externalImports; _a < externalImports_1.length; _a++) { var importNode = externalImports_1[_a]; - var skipNode = importNode.kind === 228 || - (importNode.kind === 222 && !importNode.importClause); + var skipNode = importNode.kind === 236 || + (importNode.kind === 230 && !importNode.importClause); if (skipNode) { continue; } @@ -30473,14 +34115,14 @@ var ts; } } function emitLocalStorageForExportedNamesIfNecessary(exportedDeclarations) { - if (!hasExportStars) { + if (!hasExportStarsToExportValues) { return undefined; } if (!exportedDeclarations && ts.isEmpty(exportSpecifiers)) { var hasExportDeclarationWithExportClause = false; for (var _a = 0, externalImports_2 = externalImports; _a < externalImports_2.length; _a++) { var externalImport = externalImports_2[_a]; - if (externalImport.kind === 228 && externalImport.exportClause) { + if (externalImport.kind === 236 && externalImport.exportClause) { hasExportDeclarationWithExportClause = true; break; } @@ -30495,7 +34137,7 @@ var ts; increaseIndent(); var started = false; if (exportedDeclarations) { - for (var i = 0; i < exportedDeclarations.length; ++i) { + for (var i = 0; i < exportedDeclarations.length; i++) { writeExportedName(exportedDeclarations[i]); } } @@ -30509,7 +34151,7 @@ var ts; } for (var _d = 0, externalImports_3 = externalImports; _d < externalImports_3.length; _d++) { var externalImport = externalImports_3[_d]; - if (externalImport.kind !== 228) { + if (externalImport.kind !== 236) { continue; } var exportDecl = externalImport; @@ -30581,13 +34223,13 @@ var ts; writeLine(); write("var "); var seen = {}; - for (var i = 0; i < hoistedVars.length; ++i) { + for (var i = 0; i < hoistedVars.length; i++) { var local = hoistedVars[i]; - var name_28 = local.kind === 69 + var name_31 = local.kind === 69 ? local : local.name; - if (name_28) { - var text = ts.unescapeIdentifier(name_28.text); + if (name_31) { + var text = ts.unescapeIdentifier(name_31.text); if (ts.hasProperty(seen, text)) { continue; } @@ -30598,14 +34240,14 @@ var ts; if (i !== 0) { write(", "); } - if (local.kind === 214 || local.kind === 218 || local.kind === 217) { + if (local.kind === 221 || local.kind === 225 || local.kind === 224) { emitDeclarationName(local); } else { emit(local); } var flags = ts.getCombinedNodeFlags(local.kind === 69 ? local.parent : local); - if (flags & 2) { + if (flags & 1) { if (!exportedDeclarations) { exportedDeclarations = []; } @@ -30619,7 +34261,7 @@ var ts; var f = hoistedFunctionDeclarations_1[_a]; writeLine(); emit(f); - if (f.flags & 2) { + if (f.flags & 1) { if (!exportedDeclarations) { exportedDeclarations = []; } @@ -30629,24 +34271,24 @@ var ts; } return exportedDeclarations; function visit(node) { - if (node.flags & 4) { + if (node.flags & 2) { return; } - if (node.kind === 213) { + if (node.kind === 220) { if (!hoistedFunctionDeclarations) { hoistedFunctionDeclarations = []; } hoistedFunctionDeclarations.push(node); return; } - if (node.kind === 214) { + if (node.kind === 221) { if (!hoistedVars) { hoistedVars = []; } hoistedVars.push(node); return; } - if (node.kind === 217) { + if (node.kind === 224) { if (shouldEmitEnumDeclaration(node)) { if (!hoistedVars) { hoistedVars = []; @@ -30655,7 +34297,7 @@ var ts; } return; } - if (node.kind === 218) { + if (node.kind === 225) { if (shouldEmitModuleDeclaration(node)) { if (!hoistedVars) { hoistedVars = []; @@ -30664,17 +34306,17 @@ var ts; } return; } - if (node.kind === 211 || node.kind === 163) { + if (node.kind === 218 || node.kind === 169) { if (shouldHoistVariable(node, false)) { - var name_29 = node.name; - if (name_29.kind === 69) { + var name_32 = node.name; + if (name_32.kind === 69) { if (!hoistedVars) { hoistedVars = []; } - hoistedVars.push(name_29); + hoistedVars.push(name_32); } else { - ts.forEachChild(name_29, visit); + ts.forEachChild(name_32, visit); } } return; @@ -30699,11 +34341,11 @@ var ts; if (checkIfSourceFileLevelDecl && !shouldHoistDeclarationInSystemJsModule(node)) { return false; } - return (ts.getCombinedNodeFlags(node) & 24576) === 0 || - ts.getEnclosingBlockScopeContainer(node).kind === 248; + return (ts.getCombinedNodeFlags(node) & 3072) === 0 || + ts.getEnclosingBlockScopeContainer(node).kind === 256; } function isCurrentFileSystemExternalModule() { - return modulekind === 4 && isCurrentFileExternalModule; + return modulekind === ts.ModuleKind.System && isCurrentFileExternalModule; } function emitSystemModuleBody(node, dependencyGroups, startIndex) { emitVariableDeclarationsForImports(); @@ -30724,7 +34366,7 @@ var ts; } function emitSetters(exportStarFunction, dependencyGroups) { write("setters:["); - for (var i = 0; i < dependencyGroups.length; ++i) { + for (var i = 0; i < dependencyGroups.length; i++) { if (i !== 0) { write(","); } @@ -30738,29 +34380,29 @@ var ts; var entry = group_1[_a]; var importVariableName = getLocalNameForExternalImport(entry) || ""; switch (entry.kind) { - case 222: + case 230: if (!entry.importClause) { break; } - case 221: + case 229: ts.Debug.assert(importVariableName !== ""); writeLine(); write(importVariableName + " = " + parameterName + ";"); writeLine(); break; - case 228: + case 236: ts.Debug.assert(importVariableName !== ""); if (entry.exportClause) { writeLine(); write(exportFunctionForFile + "({"); writeLine(); increaseIndent(); - for (var i_2 = 0, len = entry.exportClause.elements.length; i_2 < len; ++i_2) { - if (i_2 !== 0) { + for (var i_1 = 0, len = entry.exportClause.elements.length; i_1 < len; i_1++) { + if (i_1 !== 0) { write(","); writeLine(); } - var e = entry.exportClause.elements[i_2]; + var e = entry.exportClause.elements[i_1]; write("\""); emitNodeWithCommentsAndWithoutSourcemap(e.name); write("\": " + parameterName + "[\""); @@ -30789,13 +34431,13 @@ var ts; write("execute: function() {"); increaseIndent(); writeLine(); - for (var i = startIndex; i < node.statements.length; ++i) { + for (var i = startIndex; i < node.statements.length; i++) { var statement = node.statements[i]; switch (statement.kind) { - case 213: - case 222: + case 220: + case 230: continue; - case 228: + case 236: if (!statement.moduleSpecifier) { for (var _a = 0, _b = statement.exportClause.elements; _a < _b.length; _a++) { var element = _b[_a]; @@ -30803,7 +34445,7 @@ var ts; } } continue; - case 221: + case 229: if (!ts.isInternalModuleImportEqualsDeclaration(statement)) { continue; } @@ -30826,38 +34468,40 @@ var ts; collectExternalModuleInfo(node); ts.Debug.assert(!exportFunctionForFile); exportFunctionForFile = makeUniqueName("exports"); + contextObjectForFile = makeUniqueName("context"); writeLine(); write("System.register("); writeModuleName(node, emitRelativePathAsModuleName); write("["); var groupIndices = {}; var dependencyGroups = []; - for (var i = 0; i < externalImports.length; ++i) { - var text = getExternalModuleNameText(externalImports[i]); - if (ts.hasProperty(groupIndices, text)) { - var groupIndex = groupIndices[text]; + for (var i = 0; i < externalImports.length; i++) { + var text = getExternalModuleNameText(externalImports[i], emitRelativePathAsModuleName); + if (text === undefined) { + continue; + } + var key = text.substr(1, text.length - 2); + if (ts.hasProperty(groupIndices, key)) { + var groupIndex = groupIndices[key]; dependencyGroups[groupIndex].push(externalImports[i]); continue; } else { - groupIndices[text] = dependencyGroups.length; + groupIndices[key] = dependencyGroups.length; dependencyGroups.push([externalImports[i]]); } if (i !== 0) { write(", "); } - if (emitRelativePathAsModuleName) { - var name_30 = getExternalModuleNameFromDeclaration(host, resolver, externalImports[i]); - if (name_30) { - text = "\"" + name_30 + "\""; - } - } write(text); } - write("], function(" + exportFunctionForFile + ") {"); + write("], function(" + exportFunctionForFile + ", " + contextObjectForFile + ") {"); writeLine(); increaseIndent(); - var startIndex = emitDirectivePrologues(node.statements, true); + var startIndex = emitDirectivePrologues(node.statements, true, !compilerOptions.noImplicitUseStrict); + writeLine(); + write("var __moduleName = " + contextObjectForFile + " && " + contextObjectForFile + ".id;"); + writeLine(); emitEmitHelpers(node); emitCaptureThisForNodeIfNecessary(node); emitSystemModuleBody(node, dependencyGroups, startIndex); @@ -30872,22 +34516,16 @@ var ts; for (var _a = 0, _b = node.amdDependencies; _a < _b.length; _a++) { var amdDependency = _b[_a]; if (amdDependency.name) { - aliasedModuleNames.push("\"" + amdDependency.path + "\""); + aliasedModuleNames.push('"' + amdDependency.path + '"'); importAliasNames.push(amdDependency.name); } else { - unaliasedModuleNames.push("\"" + amdDependency.path + "\""); + unaliasedModuleNames.push('"' + amdDependency.path + '"'); } } for (var _c = 0, externalImports_4 = externalImports; _c < externalImports_4.length; _c++) { var importNode = externalImports_4[_c]; - var externalModuleName = getExternalModuleNameText(importNode); - if (emitRelativePathAsModuleName) { - var name_31 = getExternalModuleNameFromDeclaration(host, resolver, importNode); - if (name_31) { - externalModuleName = "\"" + name_31 + "\""; - } - } + var externalModuleName = getExternalModuleNameText(importNode, emitRelativePathAsModuleName); var importAliasName = getLocalNameForExternalImport(importNode); if (includeNonAmdDependencies && importAliasName) { aliasedModuleNames.push(externalModuleName); @@ -30907,7 +34545,7 @@ var ts; } function emitAMDDependencyList(_a) { var aliasedModuleNames = _a.aliasedModuleNames, unaliasedModuleNames = _a.unaliasedModuleNames; - write("[\"require\", \"exports\""); + write('["require", "exports"'); if (aliasedModuleNames.length) { write(", "); write(aliasedModuleNames.join(", ")); @@ -30935,25 +34573,25 @@ var ts; writeModuleName(node, emitRelativePathAsModuleName); emitAMDDependencies(node, true, emitRelativePathAsModuleName); increaseIndent(); - var startIndex = emitDirectivePrologues(node.statements, true); + var startIndex = emitDirectivePrologues(node.statements, true, !compilerOptions.noImplicitUseStrict); emitExportStarHelper(); emitCaptureThisForNodeIfNecessary(node); emitLinesStartingAt(node.statements, startIndex); - emitTempDeclarations(true); emitExportEquals(true); + emitTempDeclarations(true); decreaseIndent(); writeLine(); write("});"); } function emitCommonJSModule(node) { - var startIndex = emitDirectivePrologues(node.statements, false); + var startIndex = emitDirectivePrologues(node.statements, false, !compilerOptions.noImplicitUseStrict); emitEmitHelpers(node); collectExternalModuleInfo(node); emitExportStarHelper(); emitCaptureThisForNodeIfNecessary(node); emitLinesStartingAt(node.statements, startIndex); - emitTempDeclarations(true); emitExportEquals(false); + emitTempDeclarations(true); } function emitUMDModule(node) { emitEmitHelpers(node); @@ -30965,12 +34603,12 @@ var ts; writeLines(" }\n})("); emitAMDFactoryHeader(dependencyNames); increaseIndent(); - var startIndex = emitDirectivePrologues(node.statements, true); + var startIndex = emitDirectivePrologues(node.statements, true, !compilerOptions.noImplicitUseStrict); emitExportStarHelper(); emitCaptureThisForNodeIfNecessary(node); emitLinesStartingAt(node.statements, startIndex); - emitTempDeclarations(true); emitExportEquals(true); + emitTempDeclarations(true); decreaseIndent(); writeLine(); write("});"); @@ -30979,7 +34617,7 @@ var ts; externalImports = undefined; exportSpecifiers = undefined; exportEquals = undefined; - hasExportStars = false; + hasExportStarsToExportValues = false; var startIndex = emitDirectivePrologues(node.statements, false); emitEmitHelpers(node); emitCaptureThisForNodeIfNecessary(node); @@ -31035,7 +34673,8 @@ var ts; if (result) { result = result.replace(/&(\w+);/g, function (s, m) { if (entities[m] !== undefined) { - return String.fromCharCode(entities[m]); + var ch = String.fromCharCode(entities[m]); + return ch === '"' ? "\\\"" : ch; } else { return s; @@ -31044,6 +34683,16 @@ var ts; } return result; } + function isJsxChildEmittable(child) { + if (child.kind === 248) { + return !!child.expression; + } + else if (child.kind === 244) { + return !!getTextToEmit(child); + } + return true; + } + ; function getTextToEmit(node) { switch (compilerOptions.jsx) { case 2: @@ -31062,9 +34711,9 @@ var ts; function emitJsxText(node) { switch (compilerOptions.jsx) { case 2: - write("\""); + write('"'); write(trimReactWhitespaceAndApplyEntities(node)); - write("\""); + write('"'); break; case 1: default: @@ -31087,23 +34736,40 @@ var ts; } } } - function emitDirectivePrologues(statements, startWithNewLine) { - for (var i = 0; i < statements.length; ++i) { + function isUseStrictPrologue(node) { + return node.expression.text === "use strict"; + } + function ensureUseStrictPrologue(startWithNewLine, writeUseStrict) { + if (writeUseStrict) { + if (startWithNewLine) { + writeLine(); + } + write("\"use strict\";"); + } + } + function emitDirectivePrologues(statements, startWithNewLine, ensureUseStrict) { + var foundUseStrict = false; + for (var i = 0; i < statements.length; i++) { if (ts.isPrologueDirective(statements[i])) { + if (isUseStrictPrologue(statements[i])) { + foundUseStrict = true; + } if (startWithNewLine || i > 0) { writeLine(); } emit(statements[i]); } else { + ensureUseStrictPrologue(startWithNewLine || i > 0, !foundUseStrict && ensureUseStrict); return i; } } + ensureUseStrictPrologue(startWithNewLine, !foundUseStrict && ensureUseStrict); return statements.length; } function writeLines(text) { var lines = text.split(/\r\n|\r|\n/g); - for (var i = 0; i < lines.length; ++i) { + for (var i = 0; i < lines.length; i++) { var line = lines[i]; if (line.length) { writeLine(); @@ -31113,22 +34779,26 @@ var ts; } function emitEmitHelpers(node) { if (!compilerOptions.noEmitHelpers) { - if ((languageVersion < 2) && (!extendsEmitted && resolver.getNodeCheckFlags(node) & 8)) { + if (languageVersion < 2 && !extendsEmitted && node.flags & 262144) { writeLines(extendsHelper); extendsEmitted = true; } - if (!decorateEmitted && resolver.getNodeCheckFlags(node) & 16) { + if (compilerOptions.jsx !== 1 && !assignEmitted && (node.flags & 1073741824)) { + writeLines(assignHelper); + assignEmitted = true; + } + if (!decorateEmitted && node.flags & 524288) { writeLines(decorateHelper); if (compilerOptions.emitDecoratorMetadata) { writeLines(metadataHelper); } decorateEmitted = true; } - if (!paramEmitted && resolver.getNodeCheckFlags(node) & 32) { + if (!paramEmitted && node.flags & 1048576) { writeLines(paramHelper); paramEmitted = true; } - if (!awaiterEmitted && resolver.getNodeCheckFlags(node) & 64) { + if (!awaiterEmitted && node.flags & 2097152) { writeLines(awaiterHelper); awaiterEmitted = true; } @@ -31139,8 +34809,8 @@ var ts; emitShebang(); emitDetachedCommentsAndUpdateCommentsInfo(node); if (ts.isExternalModule(node) || compilerOptions.isolatedModules) { - if (root || (!ts.isExternalModule(node) && compilerOptions.isolatedModules)) { - var emitModule = moduleEmitDelegates[modulekind] || moduleEmitDelegates[1]; + if (isOwnFileEmit || (!ts.isExternalModule(node) && compilerOptions.isolatedModules)) { + var emitModule = moduleEmitDelegates[modulekind] || moduleEmitDelegates[ts.ModuleKind.CommonJS]; emitModule(node); } else { @@ -31152,7 +34822,7 @@ var ts; externalImports = undefined; exportSpecifiers = undefined; exportEquals = undefined; - hasExportStars = false; + hasExportStarsToExportValues = false; emitEmitHelpers(node); emitCaptureThisForNodeIfNecessary(node); emitLinesStartingAt(node.statements, startIndex); @@ -31160,12 +34830,15 @@ var ts; } emitLeadingComments(node.endOfFileToken); } + function emit(node) { + emitNodeConsideringCommentsOption(node, emitNodeWithSourceMap); + } function emitNodeWithCommentsAndWithoutSourcemap(node) { emitNodeConsideringCommentsOption(node, emitNodeWithoutSourceMap); } function emitNodeConsideringCommentsOption(node, emitNodeConsideringSourcemap) { if (node) { - if (node.flags & 4) { + if (node.flags & 2) { return emitCommentsOnNotEmittedNode(node); } if (isSpecializedCommentHandling(node)) { @@ -31181,37 +34854,57 @@ var ts; } } } + function emitNodeWithSourceMap(node) { + if (node) { + emitStart(node); + emitNodeWithoutSourceMap(node); + emitEnd(node); + } + } function emitNodeWithoutSourceMap(node) { if (node) { emitJavaScriptWorker(node); } } + function changeSourceMapEmit(writer) { + sourceMap = writer; + emitStart = writer.emitStart; + emitEnd = writer.emitEnd; + emitPos = writer.emitPos; + setSourceFile = writer.setSourceFile; + } + function withTemporaryNoSourceMap(callback) { + var prevSourceMap = sourceMap; + setSourceMapWriterEmit(ts.getNullSourceMapWriter()); + callback(); + setSourceMapWriterEmit(prevSourceMap); + } function isSpecializedCommentHandling(node) { switch (node.kind) { - case 215: - case 213: case 222: - case 221: - case 216: - case 227: + case 220: + case 230: + case 229: + case 223: + case 235: return true; } } function shouldEmitLeadingAndTrailingComments(node) { switch (node.kind) { - case 193: + case 200: return shouldEmitLeadingAndTrailingCommentsForVariableStatement(node); - case 218: + case 225: return shouldEmitModuleDeclaration(node); - case 217: + case 224: return shouldEmitEnumDeclaration(node); } ts.Debug.assert(!isSpecializedCommentHandling(node)); - if (node.kind !== 192 && + if (node.kind !== 199 && node.parent && - node.parent.kind === 174 && + node.parent.kind === 180 && node.parent.body === node && - compilerOptions.target <= 1) { + languageVersion <= 1) { return false; } return true; @@ -31220,13 +34913,13 @@ var ts; switch (node.kind) { case 69: return emitIdentifier(node); - case 138: - return emitParameter(node); - case 143: case 142: - return emitMethod(node); - case 145: + return emitParameter(node); + case 147: case 146: + return emitMethod(node); + case 149: + case 150: return emitAccessor(node); case 97: return emitThis(node); @@ -31246,142 +34939,142 @@ var ts; case 13: case 14: return emitLiteral(node); - case 183: - return emitTemplateExpression(node); - case 190: - return emitTemplateSpan(node); - case 233: - case 234: - return emitJsxElement(node); - case 236: - return emitJsxText(node); - case 240: - return emitJsxExpression(node); - case 135: - return emitQualifiedName(node); - case 161: - return emitObjectBindingPattern(node); - case 162: - return emitArrayBindingPattern(node); - case 163: - return emitBindingElement(node); - case 164: - return emitArrayLiteral(node); - case 165: - return emitObjectLiteral(node); - case 245: - return emitPropertyAssignment(node); - case 246: - return emitShorthandPropertyAssignment(node); - case 136: - return emitComputedPropertyName(node); - case 166: - return emitPropertyAccess(node); - case 167: - return emitIndexedAccess(node); - case 168: - return emitCallExpression(node); - case 169: - return emitNewExpression(node); - case 170: - return emitTaggedTemplateExpression(node); - case 171: - return emit(node.expression); case 189: - return emit(node.expression); - case 172: - return emitParenExpression(node); - case 213: - case 173: - case 174: - return emitFunctionDeclaration(node); - case 175: - return emitDeleteExpression(node); - case 176: - return emitTypeOfExpression(node); - case 177: - return emitVoidExpression(node); - case 178: - return emitAwaitExpression(node); - case 179: - return emitPrefixUnaryExpression(node); - case 180: - return emitPostfixUnaryExpression(node); - case 181: - return emitBinaryExpression(node); - case 182: - return emitConditionalExpression(node); - case 185: - return emitSpreadElementExpression(node); - case 184: - return emitYieldExpression(node); - case 187: - return; - case 192: - case 219: - return emitBlock(node); - case 193: - return emitVariableStatement(node); - case 194: - return write(";"); - case 195: - return emitExpressionStatement(node); - case 196: - return emitIfStatement(node); + return emitTemplateExpression(node); case 197: - return emitDoStatement(node); - case 198: - return emitWhileStatement(node); - case 199: - return emitForStatement(node); - case 201: - case 200: - return emitForInOrForOfStatement(node); - case 202: - case 203: - return emitBreakOrContinueStatement(node); - case 204: - return emitReturnStatement(node); - case 205: - return emitWithStatement(node); - case 206: - return emitSwitchStatement(node); + return emitTemplateSpan(node); case 241: case 242: - return emitCaseOrDefaultClause(node); - case 207: - return emitLabeledStatement(node); - case 208: - return emitThrowStatement(node); - case 209: - return emitTryStatement(node); + return emitJsxElement(node); case 244: - return emitCatchClause(node); - case 210: - return emitDebuggerStatement(node); - case 211: - return emitVariableDeclaration(node); - case 186: - return emitClassExpression(node); - case 214: - return emitClassDeclaration(node); - case 215: - return emitInterfaceDeclaration(node); - case 217: - return emitEnumDeclaration(node); - case 247: - return emitEnumMember(node); - case 218: - return emitModuleDeclaration(node); - case 222: - return emitImportDeclaration(node); - case 221: - return emitImportEqualsDeclaration(node); - case 228: - return emitExportDeclaration(node); - case 227: - return emitExportAssignment(node); + return emitJsxText(node); case 248: + return emitJsxExpression(node); + case 139: + return emitQualifiedName(node); + case 167: + return emitObjectBindingPattern(node); + case 168: + return emitArrayBindingPattern(node); + case 169: + return emitBindingElement(node); + case 170: + return emitArrayLiteral(node); + case 171: + return emitObjectLiteral(node); + case 253: + return emitPropertyAssignment(node); + case 254: + return emitShorthandPropertyAssignment(node); + case 140: + return emitComputedPropertyName(node); + case 172: + return emitPropertyAccess(node); + case 173: + return emitIndexedAccess(node); + case 174: + return emitCallExpression(node); + case 175: + return emitNewExpression(node); + case 176: + return emitTaggedTemplateExpression(node); + case 177: + case 195: + case 196: + return emit(node.expression); + case 178: + return emitParenExpression(node); + case 220: + case 179: + case 180: + return emitFunctionDeclaration(node); + case 181: + return emitDeleteExpression(node); + case 182: + return emitTypeOfExpression(node); + case 183: + return emitVoidExpression(node); + case 184: + return emitAwaitExpression(node); + case 185: + return emitPrefixUnaryExpression(node); + case 186: + return emitPostfixUnaryExpression(node); + case 187: + return emitBinaryExpression(node); + case 188: + return emitConditionalExpression(node); + case 191: + return emitSpreadElementExpression(node); + case 190: + return emitYieldExpression(node); + case 193: + return; + case 199: + case 226: + return emitBlock(node); + case 200: + return emitVariableStatement(node); + case 201: + return write(";"); + case 202: + return emitExpressionStatement(node); + case 203: + return emitIfStatement(node); + case 204: + return emitDoStatement(node); + case 205: + return emitWhileStatement(node); + case 206: + return emitForStatement(node); + case 208: + case 207: + return emitForInOrForOfStatement(node); + case 209: + case 210: + return emitBreakOrContinueStatement(node); + case 211: + return emitReturnStatement(node); + case 212: + return emitWithStatement(node); + case 213: + return emitSwitchStatement(node); + case 249: + case 250: + return emitCaseOrDefaultClause(node); + case 214: + return emitLabeledStatement(node); + case 215: + return emitThrowStatement(node); + case 216: + return emitTryStatement(node); + case 252: + return emitCatchClause(node); + case 217: + return emitDebuggerStatement(node); + case 218: + return emitVariableDeclaration(node); + case 192: + return emitClassExpression(node); + case 221: + return emitClassDeclaration(node); + case 222: + return emitInterfaceDeclaration(node); + case 224: + return emitEnumDeclaration(node); + case 255: + return emitEnumMember(node); + case 225: + return emitModuleDeclaration(node); + case 230: + return emitImportDeclaration(node); + case 229: + return emitImportEqualsDeclaration(node); + case 236: + return emitExportDeclaration(node); + case 235: + return emitExportAssignment(node); + case 256: return emitSourceFileNode(node); } } @@ -31411,7 +35104,7 @@ var ts; } function getLeadingCommentsToEmit(node) { if (node.parent) { - if (node.parent.kind === 248 || node.pos !== node.parent.pos) { + if (node.parent.kind === 256 || node.pos !== node.parent.pos) { if (hasDetachedComments(node.pos)) { return getLeadingCommentsWithoutDetachedComments(); } @@ -31423,7 +35116,7 @@ var ts; } function getTrailingCommentsToEmit(node) { if (node.parent) { - if (node.parent.kind === 248 || node.end !== node.parent.end) { + if (node.parent.kind === 256 || node.end !== node.parent.end) { return ts.getTrailingCommentRanges(currentText, node.end); } } @@ -31489,18 +35182,39 @@ var ts; } } } + function writeComment(text, lineMap, writer, comment, newLine) { + emitPos(comment.pos); + ts.writeCommentRange(text, lineMap, writer, comment, newLine); + emitPos(comment.end); + } function emitShebang() { var shebang = ts.getShebang(currentText); if (shebang) { write(shebang); + writeLine(); } } var _a, _b; } - function emitFile(jsFilePath, sourceFile) { - emitJavaScript(jsFilePath, sourceFile); - if (compilerOptions.declaration) { - ts.writeDeclarationFile(jsFilePath, sourceFile, host, resolver, diagnostics); + function emitFile(_a, sourceFiles, isBundledEmit) { + var jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath; + if (!host.isEmitBlocked(jsFilePath) && !compilerOptions.noEmit) { + emitJavaScript(jsFilePath, sourceMapFilePath, sourceFiles, isBundledEmit); + } + else { + emitSkipped = true; + } + if (declarationFilePath) { + emitSkipped = ts.writeDeclarationFile(declarationFilePath, sourceFiles, isBundledEmit, host, resolver, emitterDiagnostics) || emitSkipped; + } + if (!emitSkipped && emittedFilesList) { + emittedFilesList.push(jsFilePath); + if (sourceMapFilePath) { + emittedFilesList.push(sourceMapFilePath); + } + if (declarationFilePath) { + emittedFilesList.push(declarationFilePath); + } } } } @@ -31513,11 +35227,16 @@ var ts; ts.ioReadTime = 0; ts.ioWriteTime = 0; var emptyArray = []; - ts.version = "1.8.0"; - function findConfigFile(searchPath) { - var fileName = "tsconfig.json"; + var defaultLibrarySearchPaths = [ + "types/", + "node_modules/", + "node_modules/@types/", + ]; + ts.version = "1.9.0"; + function findConfigFile(searchPath, fileExists) { while (true) { - if (ts.sys.fileExists(fileName)) { + var fileName = ts.combinePaths(searchPath, "tsconfig.json"); + if (fileExists(fileName)) { return fileName; } var parentPath = ts.getDirectoryPath(searchPath); @@ -31525,7 +35244,6 @@ var ts; break; } searchPath = parentPath; - fileName = "../" + fileName; } return undefined; } @@ -31536,86 +35254,491 @@ var ts; return ts.normalizePath(referencedFileName); } ts.resolveTripleslashReference = resolveTripleslashReference; - function resolveModuleName(moduleName, containingFile, compilerOptions, host) { - var moduleResolution = compilerOptions.moduleResolution !== undefined - ? compilerOptions.moduleResolution - : compilerOptions.module === 1 ? 2 : 1; - switch (moduleResolution) { - case 2: return nodeModuleNameResolver(moduleName, containingFile, host); - case 1: return classicNameResolver(moduleName, containingFile, compilerOptions, host); - } - } - ts.resolveModuleName = resolveModuleName; - function nodeModuleNameResolver(moduleName, containingFile, host) { - var containingDirectory = ts.getDirectoryPath(containingFile); - if (ts.getRootLength(moduleName) !== 0 || nameStartsWithDotSlashOrDotDotSlash(moduleName)) { - var failedLookupLocations = []; - var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); - var resolvedFileName = loadNodeModuleFromFile(ts.supportedJsExtensions, candidate, failedLookupLocations, host); - if (resolvedFileName) { - return { resolvedModule: { resolvedFileName: resolvedFileName }, failedLookupLocations: failedLookupLocations }; + function computeCommonSourceDirectoryOfFilenames(fileNames, currentDirectory, getCanonicalFileName) { + var commonPathComponents; + var failed = ts.forEach(fileNames, function (sourceFile) { + var sourcePathComponents = ts.getNormalizedPathComponents(sourceFile, currentDirectory); + sourcePathComponents.pop(); + if (!commonPathComponents) { + commonPathComponents = sourcePathComponents; + return; + } + for (var i = 0, n = Math.min(commonPathComponents.length, sourcePathComponents.length); i < n; i++) { + if (getCanonicalFileName(commonPathComponents[i]) !== getCanonicalFileName(sourcePathComponents[i])) { + if (i === 0) { + return true; + } + commonPathComponents.length = i; + break; + } + } + if (sourcePathComponents.length < commonPathComponents.length) { + commonPathComponents.length = sourcePathComponents.length; + } + }); + if (failed) { + return ""; + } + if (!commonPathComponents) { + return currentDirectory; + } + return ts.getNormalizedPathFromPathComponents(commonPathComponents); + } + ts.computeCommonSourceDirectoryOfFilenames = computeCommonSourceDirectoryOfFilenames; + function trace(host, message) { + host.trace(ts.formatMessage.apply(undefined, arguments)); + } + function isTraceEnabled(compilerOptions, host) { + return compilerOptions.traceResolution && host.trace !== undefined; + } + function hasZeroOrOneAsteriskCharacter(str) { + var seenAsterisk = false; + for (var i = 0; i < str.length; i++) { + if (str.charCodeAt(i) === 42) { + if (!seenAsterisk) { + seenAsterisk = true; + } + else { + return false; + } + } + } + return true; + } + function createResolvedModule(resolvedFileName, isExternalLibraryImport, failedLookupLocations) { + return { resolvedModule: resolvedFileName ? { resolvedFileName: resolvedFileName, isExternalLibraryImport: isExternalLibraryImport } : undefined, failedLookupLocations: failedLookupLocations }; + } + function moduleHasNonRelativeName(moduleName) { + if (ts.isRootedDiskPath(moduleName)) { + return false; + } + var i = moduleName.lastIndexOf("./", 1); + var startsWithDotSlashOrDotDotSlash = i === 0 || (i === 1 && moduleName.charCodeAt(0) === 46); + return !startsWithDotSlashOrDotDotSlash; + } + function tryReadTypesSection(packageJsonPath, baseDirectory, state) { + var jsonContent; + try { + var jsonText = state.host.readFile(packageJsonPath); + jsonContent = jsonText ? JSON.parse(jsonText) : {}; + } + catch (e) { + jsonContent = {}; + } + var typesFile; + var fieldName; + if (jsonContent.typings) { + if (typeof jsonContent.typings === "string") { + fieldName = "typings"; + typesFile = jsonContent.typings; + } + else { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Expected_type_of_0_field_in_package_json_to_be_string_got_1, "typings", typeof jsonContent.typings); + } + } + } + if (!typesFile && jsonContent.types) { + if (typeof jsonContent.types === "string") { + fieldName = "types"; + typesFile = jsonContent.types; + } + else { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Expected_type_of_0_field_in_package_json_to_be_string_got_1, "types", typeof jsonContent.types); + } + } + } + if (typesFile) { + var typesFilePath = ts.normalizePath(ts.combinePaths(baseDirectory, typesFile)); + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.package_json_has_0_field_1_that_references_2, fieldName, typesFile, typesFilePath); + } + return typesFilePath; + } + return undefined; + } + var typeReferenceExtensions = [".d.ts"]; + function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFile, options, host) { + var traceEnabled = isTraceEnabled(options, host); + var moduleResolutionState = { + compilerOptions: options, + host: host, + skipTsx: true, + traceEnabled: traceEnabled + }; + var rootDir = options.typesRoot || (options.configFilePath ? ts.getDirectoryPath(options.configFilePath) : undefined); + if (traceEnabled) { + if (containingFile === undefined) { + if (rootDir === undefined) { + trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set, typeReferenceDirectiveName); + } + else { + trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1, typeReferenceDirectiveName, rootDir); + } + } + else { + if (rootDir === undefined) { + trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set, typeReferenceDirectiveName, containingFile); + } + else { + trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_1_root_directory_2, typeReferenceDirectiveName, containingFile, rootDir); + } + } + } + var failedLookupLocations = []; + if (rootDir !== undefined) { + var effectivePrimarySearchPaths = options.typesSearchPaths || defaultLibrarySearchPaths; + for (var _i = 0, effectivePrimarySearchPaths_1 = effectivePrimarySearchPaths; _i < effectivePrimarySearchPaths_1.length; _i++) { + var searchPath = effectivePrimarySearchPaths_1[_i]; + var primaryPath = ts.combinePaths(rootDir, searchPath); + if (traceEnabled) { + trace(host, ts.Diagnostics.Resolving_with_primary_search_path_0, primaryPath); + } + var candidate = ts.combinePaths(primaryPath, typeReferenceDirectiveName); + var candidateDirectory = ts.getDirectoryPath(candidate); + var resolvedFile_1 = loadNodeModuleFromDirectory(typeReferenceExtensions, candidate, failedLookupLocations, !directoryProbablyExists(candidateDirectory, host), moduleResolutionState); + if (resolvedFile_1) { + if (traceEnabled) { + trace(host, ts.Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2, typeReferenceDirectiveName, resolvedFile_1, true); + } + return { + resolvedTypeReferenceDirective: { primary: true, resolvedFileName: resolvedFile_1 }, + failedLookupLocations: failedLookupLocations + }; + } } - resolvedFileName = loadNodeModuleFromDirectory(ts.supportedJsExtensions, candidate, failedLookupLocations, host); - return resolvedFileName - ? { resolvedModule: { resolvedFileName: resolvedFileName }, failedLookupLocations: failedLookupLocations } - : { resolvedModule: undefined, failedLookupLocations: failedLookupLocations }; } else { - return loadModuleFromNodeModules(moduleName, containingDirectory, host); + if (traceEnabled) { + trace(host, ts.Diagnostics.Root_directory_cannot_be_determined_skipping_primary_search_paths); + } + } + var resolvedFile; + var initialLocationForSecondaryLookup; + if (containingFile) { + initialLocationForSecondaryLookup = ts.getDirectoryPath(containingFile); + } + else { + initialLocationForSecondaryLookup = rootDir; + } + if (initialLocationForSecondaryLookup !== undefined) { + if (traceEnabled) { + trace(host, ts.Diagnostics.Looking_up_in_node_modules_folder_initial_location_0, initialLocationForSecondaryLookup); + } + resolvedFile = loadModuleFromNodeModules(typeReferenceDirectiveName, initialLocationForSecondaryLookup, failedLookupLocations, moduleResolutionState); + if (traceEnabled) { + if (resolvedFile) { + trace(host, ts.Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2, typeReferenceDirectiveName, resolvedFile, false); + } + else { + trace(host, ts.Diagnostics.Type_reference_directive_0_was_not_resolved, typeReferenceDirectiveName); + } + } + } + else { + if (traceEnabled) { + trace(host, ts.Diagnostics.Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_modules_folder); + } + } + return { + resolvedTypeReferenceDirective: resolvedFile + ? { primary: false, resolvedFileName: resolvedFile } + : undefined, + failedLookupLocations: failedLookupLocations + }; + } + ts.resolveTypeReferenceDirective = resolveTypeReferenceDirective; + function resolveModuleName(moduleName, containingFile, compilerOptions, host) { + var traceEnabled = isTraceEnabled(compilerOptions, host); + if (traceEnabled) { + trace(host, ts.Diagnostics.Resolving_module_0_from_1, moduleName, containingFile); + } + var moduleResolution = compilerOptions.moduleResolution; + if (moduleResolution === undefined) { + moduleResolution = ts.getEmitModuleKind(compilerOptions) === ts.ModuleKind.CommonJS ? ts.ModuleResolutionKind.NodeJs : ts.ModuleResolutionKind.Classic; + if (traceEnabled) { + trace(host, ts.Diagnostics.Module_resolution_kind_is_not_specified_using_0, ts.ModuleResolutionKind[moduleResolution]); + } + } + else { + if (traceEnabled) { + trace(host, ts.Diagnostics.Explicitly_specified_module_resolution_kind_Colon_0, ts.ModuleResolutionKind[moduleResolution]); + } + } + var result; + switch (moduleResolution) { + case ts.ModuleResolutionKind.NodeJs: + result = nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host); + break; + case ts.ModuleResolutionKind.Classic: + result = classicNameResolver(moduleName, containingFile, compilerOptions, host); + break; + } + if (traceEnabled) { + if (result.resolvedModule) { + trace(host, ts.Diagnostics.Module_name_0_was_successfully_resolved_to_1, moduleName, result.resolvedModule.resolvedFileName); + } + else { + trace(host, ts.Diagnostics.Module_name_0_was_not_resolved, moduleName); + } + } + return result; + } + ts.resolveModuleName = resolveModuleName; + function tryLoadModuleUsingOptionalResolutionSettings(moduleName, containingDirectory, loader, failedLookupLocations, supportedExtensions, state) { + if (moduleHasNonRelativeName(moduleName)) { + return tryLoadModuleUsingBaseUrl(moduleName, loader, failedLookupLocations, supportedExtensions, state); + } + else { + return tryLoadModuleUsingRootDirs(moduleName, containingDirectory, loader, failedLookupLocations, supportedExtensions, state); } } + function tryLoadModuleUsingRootDirs(moduleName, containingDirectory, loader, failedLookupLocations, supportedExtensions, state) { + if (!state.compilerOptions.rootDirs) { + return undefined; + } + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0, moduleName); + } + var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); + var matchedRootDir; + var matchedNormalizedPrefix; + for (var _i = 0, _a = state.compilerOptions.rootDirs; _i < _a.length; _i++) { + var rootDir = _a[_i]; + var normalizedRoot = ts.normalizePath(rootDir); + if (!ts.endsWith(normalizedRoot, ts.directorySeparator)) { + normalizedRoot += ts.directorySeparator; + } + var isLongestMatchingPrefix = ts.startsWith(candidate, normalizedRoot) && + (matchedNormalizedPrefix === undefined || matchedNormalizedPrefix.length < normalizedRoot.length); + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Checking_if_0_is_the_longest_matching_prefix_for_1_2, normalizedRoot, candidate, isLongestMatchingPrefix); + } + if (isLongestMatchingPrefix) { + matchedNormalizedPrefix = normalizedRoot; + matchedRootDir = rootDir; + } + } + if (matchedNormalizedPrefix) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Longest_matching_prefix_for_0_is_1, candidate, matchedNormalizedPrefix); + } + var suffix = candidate.substr(matchedNormalizedPrefix.length); + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Loading_0_from_the_root_dir_1_candidate_location_2, suffix, matchedNormalizedPrefix, candidate); + } + var resolvedFileName = loader(candidate, supportedExtensions, failedLookupLocations, !directoryProbablyExists(containingDirectory, state.host), state); + if (resolvedFileName) { + return resolvedFileName; + } + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Trying_other_entries_in_rootDirs); + } + for (var _b = 0, _c = state.compilerOptions.rootDirs; _b < _c.length; _b++) { + var rootDir = _c[_b]; + if (rootDir === matchedRootDir) { + continue; + } + var candidate_1 = ts.combinePaths(ts.normalizePath(rootDir), suffix); + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Loading_0_from_the_root_dir_1_candidate_location_2, suffix, rootDir, candidate_1); + } + var baseDirectory = ts.getDirectoryPath(candidate_1); + var resolvedFileName_1 = loader(candidate_1, supportedExtensions, failedLookupLocations, !directoryProbablyExists(baseDirectory, state.host), state); + if (resolvedFileName_1) { + return resolvedFileName_1; + } + } + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Module_resolution_using_rootDirs_has_failed); + } + } + return undefined; + } + function tryLoadModuleUsingBaseUrl(moduleName, loader, failedLookupLocations, supportedExtensions, state) { + if (!state.compilerOptions.baseUrl) { + return undefined; + } + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1, state.compilerOptions.baseUrl, moduleName); + } + var longestMatchPrefixLength = -1; + var matchedPattern; + var matchedStar; + if (state.compilerOptions.paths) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.paths_option_is_specified_looking_for_a_pattern_to_match_module_name_0, moduleName); + } + for (var key in state.compilerOptions.paths) { + var pattern = key; + var indexOfStar = pattern.indexOf("*"); + if (indexOfStar !== -1) { + var prefix = pattern.substr(0, indexOfStar); + var suffix = pattern.substr(indexOfStar + 1); + if (moduleName.length >= prefix.length + suffix.length && + ts.startsWith(moduleName, prefix) && + ts.endsWith(moduleName, suffix)) { + if (prefix.length > longestMatchPrefixLength) { + longestMatchPrefixLength = prefix.length; + matchedPattern = pattern; + matchedStar = moduleName.substr(prefix.length, moduleName.length - suffix.length); + } + } + } + else if (pattern === moduleName) { + matchedPattern = pattern; + matchedStar = undefined; + break; + } + } + } + if (matchedPattern) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Module_name_0_matched_pattern_1, moduleName, matchedPattern); + } + for (var _i = 0, _a = state.compilerOptions.paths[matchedPattern]; _i < _a.length; _i++) { + var subst = _a[_i]; + var path = matchedStar ? subst.replace("\*", matchedStar) : subst; + var candidate = ts.normalizePath(ts.combinePaths(state.compilerOptions.baseUrl, path)); + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Trying_substitution_0_candidate_module_location_Colon_1, subst, path); + } + var resolvedFileName = loader(candidate, supportedExtensions, failedLookupLocations, !directoryProbablyExists(ts.getDirectoryPath(candidate), state.host), state); + if (resolvedFileName) { + return resolvedFileName; + } + } + return undefined; + } + else { + var candidate = ts.normalizePath(ts.combinePaths(state.compilerOptions.baseUrl, moduleName)); + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Resolving_module_name_0_relative_to_base_url_1_2, moduleName, state.compilerOptions.baseUrl, candidate); + } + return loader(candidate, supportedExtensions, failedLookupLocations, !directoryProbablyExists(ts.getDirectoryPath(candidate), state.host), state); + } + } + function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host) { + var containingDirectory = ts.getDirectoryPath(containingFile); + var supportedExtensions = ts.getSupportedExtensions(compilerOptions); + var traceEnabled = isTraceEnabled(compilerOptions, host); + var failedLookupLocations = []; + var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled, skipTsx: false }; + var resolvedFileName = tryLoadModuleUsingOptionalResolutionSettings(moduleName, containingDirectory, nodeLoadModuleByRelativeName, failedLookupLocations, supportedExtensions, state); + var isExternalLibraryImport = false; + if (!resolvedFileName) { + if (moduleHasNonRelativeName(moduleName)) { + if (traceEnabled) { + trace(host, ts.Diagnostics.Loading_module_0_from_node_modules_folder, moduleName); + } + resolvedFileName = loadModuleFromNodeModules(moduleName, containingDirectory, failedLookupLocations, state); + isExternalLibraryImport = resolvedFileName !== undefined; + } + else { + var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); + resolvedFileName = nodeLoadModuleByRelativeName(candidate, supportedExtensions, failedLookupLocations, false, state); + } + } + if (resolvedFileName && host.realpath) { + var originalFileName = resolvedFileName; + resolvedFileName = ts.normalizePath(host.realpath(resolvedFileName)); + if (traceEnabled) { + trace(host, ts.Diagnostics.Resolving_real_path_for_0_result_1, originalFileName, resolvedFileName); + } + } + return createResolvedModule(resolvedFileName, isExternalLibraryImport, failedLookupLocations); + } ts.nodeModuleNameResolver = nodeModuleNameResolver; - function loadNodeModuleFromFile(extensions, candidate, failedLookupLocation, host) { + function nodeLoadModuleByRelativeName(candidate, supportedExtensions, failedLookupLocations, onlyRecordFailures, state) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Loading_module_as_file_Slash_folder_candidate_module_location_0, candidate); + } + var resolvedFileName = loadModuleFromFile(candidate, supportedExtensions, failedLookupLocations, onlyRecordFailures, state); + return resolvedFileName || loadNodeModuleFromDirectory(supportedExtensions, candidate, failedLookupLocations, onlyRecordFailures, state); + } + function directoryProbablyExists(directoryName, host) { + return !host.directoryExists || host.directoryExists(directoryName); + } + ts.directoryProbablyExists = directoryProbablyExists; + function loadModuleFromFile(candidate, extensions, failedLookupLocation, onlyRecordFailures, state) { + if (!onlyRecordFailures) { + var directory = ts.getDirectoryPath(candidate); + if (directory) { + onlyRecordFailures = !directoryProbablyExists(directory, state.host); + } + } return ts.forEach(extensions, tryLoad); function tryLoad(ext) { + if (ext === ".tsx" && state.skipTsx) { + return undefined; + } var fileName = ts.fileExtensionIs(candidate, ext) ? candidate : candidate + ext; - if (host.fileExists(fileName)) { + if (!onlyRecordFailures && state.host.fileExists(fileName)) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.File_0_exist_use_it_as_a_name_resolution_result, fileName); + } return fileName; } else { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.File_0_does_not_exist, fileName); + } failedLookupLocation.push(fileName); return undefined; } } } - function loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocation, host) { + function loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocation, onlyRecordFailures, state) { var packageJsonPath = ts.combinePaths(candidate, "package.json"); - if (host.fileExists(packageJsonPath)) { - var jsonContent; - try { - var jsonText = host.readFile(packageJsonPath); - jsonContent = jsonText ? JSON.parse(jsonText) : { typings: undefined }; + var directoryExists = !onlyRecordFailures && directoryProbablyExists(candidate, state.host); + if (directoryExists && state.host.fileExists(packageJsonPath)) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Found_package_json_at_0, packageJsonPath); } - catch (e) { - jsonContent = { typings: undefined }; - } - if (jsonContent.typings) { - var result = loadNodeModuleFromFile(extensions, ts.normalizePath(ts.combinePaths(candidate, jsonContent.typings)), failedLookupLocation, host); + var typesFile = tryReadTypesSection(packageJsonPath, candidate, state); + if (typesFile) { + var result = loadModuleFromFile(typesFile, extensions, failedLookupLocation, !directoryProbablyExists(ts.getDirectoryPath(typesFile), state.host), state); if (result) { return result; } } + else { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.package_json_does_not_have_types_field); + } + } } else { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.File_0_does_not_exist, packageJsonPath); + } failedLookupLocation.push(packageJsonPath); } - return loadNodeModuleFromFile(extensions, ts.combinePaths(candidate, "index"), failedLookupLocation, host); + return loadModuleFromFile(ts.combinePaths(candidate, "index"), extensions, failedLookupLocation, !directoryExists, state); } - function loadModuleFromNodeModules(moduleName, directory, host) { - var failedLookupLocations = []; + function loadModuleFromNodeModulesFolder(moduleName, directory, failedLookupLocations, state) { + var nodeModulesFolder = ts.combinePaths(directory, "node_modules"); + var nodeModulesFolderExists = directoryProbablyExists(nodeModulesFolder, state.host); + var candidate = ts.normalizePath(ts.combinePaths(nodeModulesFolder, moduleName)); + var result = loadModuleFromFile(candidate, ts.supportedTypeScriptExtensions, failedLookupLocations, !nodeModulesFolderExists, state); + if (result) { + return result; + } + result = loadNodeModuleFromDirectory(ts.supportedTypeScriptExtensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state); + if (result) { + return result; + } + } + function loadModuleFromNodeModules(moduleName, directory, failedLookupLocations, state) { directory = ts.normalizeSlashes(directory); while (true) { var baseName = ts.getBaseFileName(directory); if (baseName !== "node_modules") { - var nodeModulesFolder = ts.combinePaths(directory, "node_modules"); - var candidate = ts.normalizePath(ts.combinePaths(nodeModulesFolder, moduleName)); - var result = loadNodeModuleFromFile(ts.supportedExtensions, candidate, failedLookupLocations, host); + var result = loadModuleFromNodeModulesFolder(moduleName, directory, failedLookupLocations, state) || + loadModuleFromNodeModulesFolder(ts.combinePaths("@types", moduleName), directory, failedLookupLocations, state); if (result) { - return { resolvedModule: { resolvedFileName: result, isExternalLibraryImport: true }, failedLookupLocations: failedLookupLocations }; - } - result = loadNodeModuleFromDirectory(ts.supportedExtensions, candidate, failedLookupLocations, host); - if (result) { - return { resolvedModule: { resolvedFileName: result, isExternalLibraryImport: true }, failedLookupLocations: failedLookupLocations }; + return result; } } var parentPath = ts.getDirectoryPath(directory); @@ -31624,43 +35747,36 @@ var ts; } directory = parentPath; } - return { resolvedModule: undefined, failedLookupLocations: failedLookupLocations }; - } - function nameStartsWithDotSlashOrDotDotSlash(name) { - var i = name.lastIndexOf("./", 1); - return i === 0 || (i === 1 && name.charCodeAt(0) === 46); + return undefined; } function classicNameResolver(moduleName, containingFile, compilerOptions, host) { - if (moduleName.indexOf("!") != -1) { - return { resolvedModule: undefined, failedLookupLocations: [] }; - } - var searchPath = ts.getDirectoryPath(containingFile); - var searchName; + var traceEnabled = isTraceEnabled(compilerOptions, host); + var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled, skipTsx: !compilerOptions.jsx }; var failedLookupLocations = []; + var supportedExtensions = ts.getSupportedExtensions(compilerOptions); + var containingDirectory = ts.getDirectoryPath(containingFile); + var resolvedFileName = tryLoadModuleUsingOptionalResolutionSettings(moduleName, containingDirectory, loadModuleFromFile, failedLookupLocations, supportedExtensions, state); + if (resolvedFileName) { + return createResolvedModule(resolvedFileName, false, failedLookupLocations); + } var referencedSourceFile; - var extensions = compilerOptions.allowNonTsExtensions ? ts.supportedJsExtensions : ts.supportedExtensions; - while (true) { - searchName = ts.normalizePath(ts.combinePaths(searchPath, moduleName)); - referencedSourceFile = ts.forEach(extensions, function (extension) { - if (extension === ".tsx" && !compilerOptions.jsx) { - return undefined; + if (moduleHasNonRelativeName(moduleName)) { + while (true) { + var searchName = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); + referencedSourceFile = loadModuleFromFile(searchName, supportedExtensions, failedLookupLocations, false, state); + if (referencedSourceFile) { + break; } - var candidate = searchName + extension; - if (host.fileExists(candidate)) { - return candidate; + var parentPath = ts.getDirectoryPath(containingDirectory); + if (parentPath === containingDirectory) { + break; } - else { - failedLookupLocations.push(candidate); - } - }); - if (referencedSourceFile) { - break; + containingDirectory = parentPath; } - var parentPath = ts.getDirectoryPath(searchPath); - if (parentPath === searchPath) { - break; - } - searchPath = parentPath; + } + else { + var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); + referencedSourceFile = loadModuleFromFile(candidate, supportedExtensions, failedLookupLocations, false, state); } return referencedSourceFile ? { resolvedModule: { resolvedFileName: referencedSourceFile }, failedLookupLocations: failedLookupLocations } @@ -31668,7 +35784,7 @@ var ts; } ts.classicNameResolver = classicNameResolver; ts.defaultInitCompilerOptions = { - module: 1, + module: ts.ModuleKind.CommonJS, target: 1, noImplicitAny: false, sourceMap: false @@ -31713,11 +35829,39 @@ var ts; ts.sys.createDirectory(directoryPath); } } + var outputFingerprints; + function writeFileIfUpdated(fileName, data, writeByteOrderMark) { + if (!outputFingerprints) { + outputFingerprints = {}; + } + var hash = ts.sys.createHash(data); + var mtimeBefore = ts.sys.getModifiedTime(fileName); + if (mtimeBefore && ts.hasProperty(outputFingerprints, fileName)) { + var fingerprint = outputFingerprints[fileName]; + if (fingerprint.byteOrderMark === writeByteOrderMark && + fingerprint.hash === hash && + fingerprint.mtime.getTime() === mtimeBefore.getTime()) { + return; + } + } + ts.sys.writeFile(fileName, data, writeByteOrderMark); + var mtimeAfter = ts.sys.getModifiedTime(fileName); + outputFingerprints[fileName] = { + hash: hash, + byteOrderMark: writeByteOrderMark, + mtime: mtimeAfter + }; + } function writeFile(fileName, data, writeByteOrderMark, onError) { try { var start = new Date().getTime(); ensureDirectoriesExist(ts.getDirectoryPath(ts.normalizePath(fileName))); - ts.sys.writeFile(fileName, data, writeByteOrderMark); + if (ts.isWatchSet(options) && ts.sys.createHash && ts.sys.getModifiedTime) { + writeFileIfUpdated(fileName, data, writeByteOrderMark); + } + else { + ts.sys.writeFile(fileName, data, writeByteOrderMark); + } ts.ioWriteTime += new Date().getTime() - start; } catch (e) { @@ -31726,24 +35870,32 @@ var ts; } } } + function getDefaultLibLocation() { + return ts.getDirectoryPath(ts.normalizePath(ts.sys.getExecutingFilePath())); + } var newLine = ts.getNewLineCharacter(options); + var realpath = ts.sys.realpath && (function (path) { return ts.sys.realpath(path); }); return { getSourceFile: getSourceFile, - getDefaultLibFileName: function (options) { return ts.combinePaths(ts.getDirectoryPath(ts.normalizePath(ts.sys.getExecutingFilePath())), ts.getDefaultLibFileName(options)); }, + getDefaultLibLocation: getDefaultLibLocation, + getDefaultLibFileName: function (options) { return ts.combinePaths(getDefaultLibLocation(), ts.getDefaultLibFileName(options)); }, writeFile: writeFile, getCurrentDirectory: ts.memoize(function () { return ts.sys.getCurrentDirectory(); }), useCaseSensitiveFileNames: function () { return ts.sys.useCaseSensitiveFileNames; }, getCanonicalFileName: getCanonicalFileName, getNewLine: function () { return newLine; }, fileExists: function (fileName) { return ts.sys.fileExists(fileName); }, - readFile: function (fileName) { return ts.sys.readFile(fileName); } + readFile: function (fileName) { return ts.sys.readFile(fileName); }, + trace: function (s) { return ts.sys.write(s + newLine); }, + directoryExists: function (directoryName) { return ts.sys.directoryExists(directoryName); }, + realpath: realpath }; } ts.createCompilerHost = createCompilerHost; function getPreEmitDiagnostics(program, sourceFile, cancellationToken) { var diagnostics = program.getOptionsDiagnostics(cancellationToken).concat(program.getSyntacticDiagnostics(sourceFile, cancellationToken), program.getGlobalDiagnostics(cancellationToken), program.getSemanticDiagnostics(sourceFile, cancellationToken)); if (program.getCompilerOptions().declaration) { - diagnostics.concat(program.getDeclarationDiagnostics(sourceFile, cancellationToken)); + diagnostics = diagnostics.concat(program.getDeclarationDiagnostics(sourceFile, cancellationToken)); } return ts.sortAndDeduplicateDiagnostics(diagnostics); } @@ -31771,46 +35923,85 @@ var ts; } } ts.flattenDiagnosticMessageText = flattenDiagnosticMessageText; + function loadWithLocalCache(names, containingFile, loader) { + if (names.length === 0) { + return []; + } + var resolutions = []; + var cache = {}; + for (var _i = 0, names_1 = names; _i < names_1.length; _i++) { + var name_33 = names_1[_i]; + var result = void 0; + if (ts.hasProperty(cache, name_33)) { + result = cache[name_33]; + } + else { + result = loader(name_33, containingFile); + cache[name_33] = result; + } + resolutions.push(result); + } + return resolutions; + } function createProgram(rootNames, options, host, oldProgram) { var program; var files = []; - var fileProcessingDiagnostics = ts.createDiagnosticCollection(); - var programDiagnostics = ts.createDiagnosticCollection(); var commonSourceDirectory; var diagnosticsProducingTypeChecker; var noDiagnosticsTypeChecker; var classifiableNames; - var skipDefaultLib = options.noLib; + var resolvedTypeReferenceDirectives = {}; + var fileProcessingDiagnostics = ts.createDiagnosticCollection(); var start = new Date().getTime(); host = host || createCompilerHost(options); + var skipDefaultLib = options.noLib; + var programDiagnostics = ts.createDiagnosticCollection(); var currentDirectory = host.getCurrentDirectory(); - var resolveModuleNamesWorker = host.resolveModuleNames - ? (function (moduleNames, containingFile) { return host.resolveModuleNames(moduleNames, containingFile); }) - : (function (moduleNames, containingFile) { return ts.map(moduleNames, function (moduleName) { return resolveModuleName(moduleName, containingFile, options, host).resolvedModule; }); }); + var supportedExtensions = ts.getSupportedExtensions(options); + var hasEmitBlockingDiagnostics = ts.createFileMap(getCanonicalFileName); + var resolveModuleNamesWorker; + if (host.resolveModuleNames) { + resolveModuleNamesWorker = function (moduleNames, containingFile) { return host.resolveModuleNames(moduleNames, containingFile); }; + } + else { + var loader_1 = function (moduleName, containingFile) { return resolveModuleName(moduleName, containingFile, options, host).resolvedModule; }; + resolveModuleNamesWorker = function (moduleNames, containingFile) { return loadWithLocalCache(moduleNames, containingFile, loader_1); }; + } + var resolveTypeReferenceDirectiveNamesWorker; + if (host.resolveTypeReferenceDirectives) { + resolveTypeReferenceDirectiveNamesWorker = function (typeDirectiveNames, containingFile) { return host.resolveTypeReferenceDirectives(typeDirectiveNames, containingFile); }; + } + else { + var loader_2 = function (typesRef, containingFile) { return resolveTypeReferenceDirective(typesRef, containingFile, options, host).resolvedTypeReferenceDirective; }; + resolveTypeReferenceDirectiveNamesWorker = function (typeReferenceDirectiveNames, containingFile) { return loadWithLocalCache(typeReferenceDirectiveNames, containingFile, loader_2); }; + } var filesByName = ts.createFileMap(); var filesByNameIgnoreCase = host.useCaseSensitiveFileNames() ? ts.createFileMap(function (fileName) { return fileName.toLowerCase(); }) : undefined; - if (oldProgram) { - var oldOptions = oldProgram.getCompilerOptions(); - if ((oldOptions.module !== options.module) || - (oldOptions.noResolve !== options.noResolve) || - (oldOptions.target !== options.target) || - (oldOptions.noLib !== options.noLib) || - (oldOptions.jsx !== options.jsx)) { - oldProgram = undefined; - } - } if (!tryReuseStructureFromOldProgram()) { + if (options.types && options.types.length) { + var resolutions = resolveTypeReferenceDirectiveNamesWorker(options.types, undefined); + for (var i = 0; i < options.types.length; i++) { + processTypeReferenceDirective(options.types[i], resolutions[i]); + } + } ts.forEach(rootNames, function (name) { return processRootFile(name, false); }); if (!skipDefaultLib) { - processRootFile(host.getDefaultLibFileName(options), true); + if (!options.lib) { + processRootFile(host.getDefaultLibFileName(options), true); + } + else { + var libDirectory_1 = host.getDefaultLibLocation ? host.getDefaultLibLocation() : ts.getDirectoryPath(host.getDefaultLibFileName(options)); + ts.forEach(options.lib, function (libFileName) { + processRootFile(ts.combinePaths(libDirectory_1, libFileName), true); + }); + } } } - verifyCompilerOptions(); oldProgram = undefined; - ts.programTime += new Date().getTime() - start; program = { getRootFileNames: function () { return rootNames; }, getSourceFile: getSourceFile, + getSourceFileByPath: getSourceFileByPath, getSourceFiles: function () { return files; }, getCompilerOptions: function () { return options; }, getSyntacticDiagnostics: getSyntacticDiagnostics, @@ -31821,16 +36012,33 @@ var ts; getTypeChecker: getTypeChecker, getClassifiableNames: getClassifiableNames, getDiagnosticsProducingTypeChecker: getDiagnosticsProducingTypeChecker, - getCommonSourceDirectory: function () { return commonSourceDirectory; }, + getCommonSourceDirectory: getCommonSourceDirectory, emit: emit, getCurrentDirectory: function () { return currentDirectory; }, getNodeCount: function () { return getDiagnosticsProducingTypeChecker().getNodeCount(); }, getIdentifierCount: function () { return getDiagnosticsProducingTypeChecker().getIdentifierCount(); }, getSymbolCount: function () { return getDiagnosticsProducingTypeChecker().getSymbolCount(); }, getTypeCount: function () { return getDiagnosticsProducingTypeChecker().getTypeCount(); }, - getFileProcessingDiagnostics: function () { return fileProcessingDiagnostics; } + getFileProcessingDiagnostics: function () { return fileProcessingDiagnostics; }, + getResolvedTypeReferenceDirectives: function () { return resolvedTypeReferenceDirectives; } }; + verifyCompilerOptions(); + ts.programTime += new Date().getTime() - start; return program; + function getCommonSourceDirectory() { + if (typeof commonSourceDirectory === "undefined") { + if (options.rootDir && checkSourceFilesBelongToPath(files, options.rootDir)) { + commonSourceDirectory = ts.getNormalizedAbsolutePath(options.rootDir, currentDirectory); + } + else { + commonSourceDirectory = computeCommonSourceDirectory(files); + } + if (commonSourceDirectory && commonSourceDirectory[commonSourceDirectory.length - 1] !== ts.directorySeparator) { + commonSourceDirectory += ts.directorySeparator; + } + } + return commonSourceDirectory; + } function getClassifiableNames() { if (!classifiableNames) { getTypeChecker(); @@ -31846,17 +36054,38 @@ var ts; if (!oldProgram) { return false; } + var oldOptions = oldProgram.getCompilerOptions(); + if ((oldOptions.module !== options.module) || + (oldOptions.noResolve !== options.noResolve) || + (oldOptions.target !== options.target) || + (oldOptions.noLib !== options.noLib) || + (oldOptions.jsx !== options.jsx) || + (oldOptions.allowJs !== options.allowJs) || + (oldOptions.rootDir !== options.rootDir) || + (oldOptions.typesSearchPaths !== options.typesSearchPaths) || + (oldOptions.configFilePath !== options.configFilePath) || + (oldOptions.baseUrl !== options.baseUrl) || + (oldOptions.typesRoot !== options.typesRoot) || + !ts.arrayIsEqualTo(oldOptions.rootDirs, options.rootDirs) || + !ts.mapIsEqualTo(oldOptions.paths, options.paths)) { + return false; + } ts.Debug.assert(!oldProgram.structureIsReused); var oldRootNames = oldProgram.getRootFileNames(); if (!ts.arrayIsEqualTo(oldRootNames, rootNames)) { return false; } + if (!ts.arrayIsEqualTo(options.types, oldOptions.types)) { + return false; + } var newSourceFiles = []; var filePaths = []; var modifiedSourceFiles = []; for (var _i = 0, _a = oldProgram.getSourceFiles(); _i < _a.length; _i++) { var oldSourceFile = _a[_i]; - var newSourceFile = host.getSourceFile(oldSourceFile.fileName, options.target); + var newSourceFile = host.getSourceFileByPath + ? host.getSourceFileByPath(oldSourceFile.fileName, oldSourceFile.path, options.target) + : host.getSourceFile(oldSourceFile.fileName, options.target); if (!newSourceFile) { return false; } @@ -31873,23 +36102,31 @@ var ts; if (!ts.arrayIsEqualTo(oldSourceFile.imports, newSourceFile.imports, moduleNameIsEqualTo)) { return false; } + if (!ts.arrayIsEqualTo(oldSourceFile.moduleAugmentations, newSourceFile.moduleAugmentations, moduleNameIsEqualTo)) { + return false; + } + if (!ts.arrayIsEqualTo(oldSourceFile.typeReferenceDirectives, newSourceFile.typeReferenceDirectives, fileReferenceIsEqualTo)) { + return false; + } + var newSourceFilePath = ts.getNormalizedAbsolutePath(newSourceFile.fileName, currentDirectory); if (resolveModuleNamesWorker) { - var moduleNames = ts.map(newSourceFile.imports, function (name) { return name.text; }); - var resolutions = resolveModuleNamesWorker(moduleNames, ts.getNormalizedAbsolutePath(newSourceFile.fileName, currentDirectory)); - for (var i = 0; i < moduleNames.length; ++i) { - var newResolution = resolutions[i]; - var oldResolution = ts.getResolvedModule(oldSourceFile, moduleNames[i]); - var resolutionChanged = oldResolution - ? !newResolution || - oldResolution.resolvedFileName !== newResolution.resolvedFileName || - !!oldResolution.isExternalLibraryImport !== !!newResolution.isExternalLibraryImport - : newResolution; - if (resolutionChanged) { - return false; - } + var moduleNames = ts.map(ts.concatenate(newSourceFile.imports, newSourceFile.moduleAugmentations), getTextOfLiteral); + var resolutions = resolveModuleNamesWorker(moduleNames, newSourceFilePath); + var resolutionsChanged = ts.hasChangesInResolutions(moduleNames, resolutions, oldSourceFile.resolvedModules, ts.moduleResolutionIsEqualTo); + if (resolutionsChanged) { + return false; + } + } + if (resolveTypeReferenceDirectiveNamesWorker) { + var typesReferenceDirectives = ts.map(newSourceFile.typeReferenceDirectives, function (x) { return x.fileName; }); + var resolutions = resolveTypeReferenceDirectiveNamesWorker(typesReferenceDirectives, newSourceFilePath); + var resolutionsChanged = ts.hasChangesInResolutions(typesReferenceDirectives, resolutions, oldSourceFile.resolvedTypeReferenceDirectiveNames, ts.typeDirectiveIsEqualTo); + if (resolutionsChanged) { + return false; } } newSourceFile.resolvedModules = oldSourceFile.resolvedModules; + newSourceFile.resolvedTypeReferenceDirectiveNames = oldSourceFile.resolvedTypeReferenceDirectiveNames; modifiedSourceFiles.push(newSourceFile); } else { @@ -31897,7 +36134,7 @@ var ts; } newSourceFiles.push(newSourceFile); } - for (var i = 0, len = newSourceFiles.length; i < len; ++i) { + for (var i = 0, len = newSourceFiles.length; i < len; i++) { filesByName.set(filePaths[i], newSourceFiles[i]); } files = newSourceFiles; @@ -31906,6 +36143,7 @@ var ts; var modifiedFile = modifiedSourceFiles_1[_b]; fileProcessingDiagnostics.reattachFileDiagnostics(modifiedFile); } + resolvedTypeReferenceDirectives = oldProgram.getResolvedTypeReferenceDirectives(); oldProgram.structureIsReused = true; return true; } @@ -31917,8 +36155,10 @@ var ts; getCurrentDirectory: function () { return currentDirectory; }, getNewLine: function () { return host.getNewLine(); }, getSourceFile: program.getSourceFile, + getSourceFileByPath: program.getSourceFileByPath, getSourceFiles: program.getSourceFiles, - writeFile: writeFileCallback || (function (fileName, data, writeByteOrderMark, onError) { return host.writeFile(fileName, data, writeByteOrderMark, onError); }) + writeFile: writeFileCallback || (function (fileName, data, writeByteOrderMark, onError, sourceFiles) { return host.writeFile(fileName, data, writeByteOrderMark, onError, sourceFiles); }), + isEmitBlocked: isEmitBlocked }; } function getDiagnosticsProducingTypeChecker() { @@ -31931,9 +36171,27 @@ var ts; var _this = this; return runWithCancellationToken(function () { return emitWorker(_this, sourceFile, writeFileCallback, cancellationToken); }); } + function isEmitBlocked(emitFileName) { + return hasEmitBlockingDiagnostics.contains(ts.toPath(emitFileName, currentDirectory, getCanonicalFileName)); + } function emitWorker(program, sourceFile, writeFileCallback, cancellationToken) { - if (options.noEmitOnError && getPreEmitDiagnostics(program, undefined, cancellationToken).length > 0) { - return { diagnostics: [], sourceMaps: undefined, emitSkipped: true }; + var declarationDiagnostics = []; + if (options.noEmit) { + return { diagnostics: declarationDiagnostics, sourceMaps: undefined, emittedFiles: undefined, emitSkipped: true }; + } + if (options.noEmitOnError) { + var diagnostics = program.getOptionsDiagnostics(cancellationToken).concat(program.getSyntacticDiagnostics(sourceFile, cancellationToken), program.getGlobalDiagnostics(cancellationToken), program.getSemanticDiagnostics(sourceFile, cancellationToken)); + if (diagnostics.length === 0 && program.getCompilerOptions().declaration) { + declarationDiagnostics = program.getDeclarationDiagnostics(undefined, cancellationToken); + } + if (diagnostics.length > 0 || declarationDiagnostics.length > 0) { + return { + diagnostics: ts.concatenate(diagnostics, declarationDiagnostics), + sourceMaps: undefined, + emittedFiles: undefined, + emitSkipped: true + }; + } } var emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver((options.outFile || options.out) ? undefined : sourceFile); var start = new Date().getTime(); @@ -31942,7 +36200,10 @@ var ts; return emitResult; } function getSourceFile(fileName) { - return filesByName.get(ts.toPath(fileName, currentDirectory, getCanonicalFileName)); + return getSourceFileByPath(ts.toPath(fileName, currentDirectory, getCanonicalFileName)); + } + function getSourceFileByPath(path) { + return filesByName.get(path); } function getDiagnosticsHelper(sourceFile, getDiagnostics, cancellationToken) { if (sourceFile) { @@ -31964,7 +36225,13 @@ var ts; return getDiagnosticsHelper(sourceFile, getSemanticDiagnosticsForFile, cancellationToken); } function getDeclarationDiagnostics(sourceFile, cancellationToken) { - return getDiagnosticsHelper(sourceFile, getDeclarationDiagnosticsForFile, cancellationToken); + var options = program.getCompilerOptions(); + if (!sourceFile || options.out || options.outFile) { + return getDeclarationDiagnosticsWorker(sourceFile, cancellationToken); + } + else { + return getDiagnosticsHelper(sourceFile, getDeclarationDiagnosticsForFile, cancellationToken); + } } function getSyntacticDiagnosticsForFile(sourceFile, cancellationToken) { return sourceFile.parseDiagnostics; @@ -31986,21 +36253,176 @@ var ts; var typeChecker = getDiagnosticsProducingTypeChecker(); ts.Debug.assert(!!sourceFile.bindDiagnostics); var bindDiagnostics = sourceFile.bindDiagnostics; - var checkDiagnostics = typeChecker.getDiagnostics(sourceFile, cancellationToken); + var checkDiagnostics = ts.isSourceFileJavaScript(sourceFile) ? + getJavaScriptSemanticDiagnosticsForFile(sourceFile, cancellationToken) : + typeChecker.getDiagnostics(sourceFile, cancellationToken); var fileProcessingDiagnosticsInFile = fileProcessingDiagnostics.getDiagnostics(sourceFile.fileName); var programDiagnosticsInFile = programDiagnostics.getDiagnostics(sourceFile.fileName); return bindDiagnostics.concat(checkDiagnostics).concat(fileProcessingDiagnosticsInFile).concat(programDiagnosticsInFile); }); } - function getDeclarationDiagnosticsForFile(sourceFile, cancellationToken) { + function getJavaScriptSemanticDiagnosticsForFile(sourceFile, cancellationToken) { return runWithCancellationToken(function () { - if (!ts.isDeclarationFile(sourceFile)) { - var resolver = getDiagnosticsProducingTypeChecker().getEmitResolver(sourceFile, cancellationToken); - var writeFile_1 = function () { }; - return ts.getDeclarationDiagnostics(getEmitHost(writeFile_1), resolver, sourceFile); + var diagnostics = []; + walk(sourceFile); + return diagnostics; + function walk(node) { + if (!node) { + return false; + } + switch (node.kind) { + case 229: + diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_a_ts_file)); + return true; + case 235: + if (node.isExportEquals) { + diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.export_can_only_be_used_in_a_ts_file)); + return true; + } + break; + case 221: + var classDeclaration = node; + if (checkModifiers(classDeclaration.modifiers) || + checkTypeParameters(classDeclaration.typeParameters)) { + return true; + } + break; + case 251: + var heritageClause = node; + if (heritageClause.token === 106) { + diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_a_ts_file)); + return true; + } + break; + case 222: + diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.interface_declarations_can_only_be_used_in_a_ts_file)); + return true; + case 225: + diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.module_declarations_can_only_be_used_in_a_ts_file)); + return true; + case 223: + diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.type_aliases_can_only_be_used_in_a_ts_file)); + return true; + case 147: + case 146: + case 148: + case 149: + case 150: + case 179: + case 220: + case 180: + case 220: + var functionDeclaration = node; + if (checkModifiers(functionDeclaration.modifiers) || + checkTypeParameters(functionDeclaration.typeParameters) || + checkTypeAnnotation(functionDeclaration.type)) { + return true; + } + break; + case 200: + var variableStatement = node; + if (checkModifiers(variableStatement.modifiers)) { + return true; + } + break; + case 218: + var variableDeclaration = node; + if (checkTypeAnnotation(variableDeclaration.type)) { + return true; + } + break; + case 174: + case 175: + var expression = node; + if (expression.typeArguments && expression.typeArguments.length > 0) { + var start_2 = expression.typeArguments.pos; + diagnostics.push(ts.createFileDiagnostic(sourceFile, start_2, expression.typeArguments.end - start_2, ts.Diagnostics.type_arguments_can_only_be_used_in_a_ts_file)); + return true; + } + break; + case 142: + var parameter = node; + if (parameter.modifiers) { + var start_3 = parameter.modifiers.pos; + diagnostics.push(ts.createFileDiagnostic(sourceFile, start_3, parameter.modifiers.end - start_3, ts.Diagnostics.parameter_modifiers_can_only_be_used_in_a_ts_file)); + return true; + } + if (parameter.questionToken) { + diagnostics.push(ts.createDiagnosticForNode(parameter.questionToken, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, "?")); + return true; + } + if (parameter.type) { + diagnostics.push(ts.createDiagnosticForNode(parameter.type, ts.Diagnostics.types_can_only_be_used_in_a_ts_file)); + return true; + } + break; + case 145: + diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.property_declarations_can_only_be_used_in_a_ts_file)); + return true; + case 224: + diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.enum_declarations_can_only_be_used_in_a_ts_file)); + return true; + case 177: + var typeAssertionExpression = node; + diagnostics.push(ts.createDiagnosticForNode(typeAssertionExpression.type, ts.Diagnostics.type_assertion_expressions_can_only_be_used_in_a_ts_file)); + return true; + case 143: + if (!options.experimentalDecorators) { + diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning)); + } + return true; + } + return ts.forEachChild(node, walk); + } + function checkTypeParameters(typeParameters) { + if (typeParameters) { + var start_4 = typeParameters.pos; + diagnostics.push(ts.createFileDiagnostic(sourceFile, start_4, typeParameters.end - start_4, ts.Diagnostics.type_parameter_declarations_can_only_be_used_in_a_ts_file)); + return true; + } + return false; + } + function checkTypeAnnotation(type) { + if (type) { + diagnostics.push(ts.createDiagnosticForNode(type, ts.Diagnostics.types_can_only_be_used_in_a_ts_file)); + return true; + } + return false; + } + function checkModifiers(modifiers) { + if (modifiers) { + for (var _i = 0, modifiers_1 = modifiers; _i < modifiers_1.length; _i++) { + var modifier = modifiers_1[_i]; + switch (modifier.kind) { + case 112: + case 110: + case 111: + case 128: + case 122: + diagnostics.push(ts.createDiagnosticForNode(modifier, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, ts.tokenToString(modifier.kind))); + return true; + case 113: + case 82: + case 74: + case 77: + case 115: + } + } + } + return false; } }); } + function getDeclarationDiagnosticsWorker(sourceFile, cancellationToken) { + return runWithCancellationToken(function () { + var resolver = getDiagnosticsProducingTypeChecker().getEmitResolver(sourceFile, cancellationToken); + var writeFile = function () { }; + return ts.getDeclarationDiagnostics(getEmitHost(writeFile), resolver, sourceFile); + }); + } + function getDeclarationDiagnosticsForFile(sourceFile, cancellationToken) { + return ts.isDeclarationFile(sourceFile) ? [] : getDeclarationDiagnosticsWorker(sourceFile, cancellationToken); + } function getOptionsDiagnostics() { var allDiagnostics = []; ts.addRange(allDiagnostics, fileProcessingDiagnostics.getGlobalDiagnostics()); @@ -32016,7 +36438,7 @@ var ts; return ts.getBaseFileName(fileName).indexOf(".") >= 0; } function processRootFile(fileName, isDefaultLib) { - processSourceFile(ts.normalizePath(fileName), isDefaultLib); + processSourceFile(ts.normalizePath(fileName), isDefaultLib, true); } function fileReferenceIsEqualTo(a, b) { return a.fileName === b.fileName; @@ -32024,63 +36446,76 @@ var ts; function moduleNameIsEqualTo(a, b) { return a.text === b.text; } + function getTextOfLiteral(literal) { + return literal.text; + } function collectExternalModuleReferences(file) { if (file.imports) { return; } var isJavaScriptFile = ts.isSourceFileJavaScript(file); + var isExternalModuleFile = ts.isExternalModule(file); var imports; + var moduleAugmentations; for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { var node = _a[_i]; - collect(node, true, false); + collectModuleReferences(node, false); + if (isJavaScriptFile) { + collectRequireCalls(node); + } } file.imports = imports || emptyArray; + file.moduleAugmentations = moduleAugmentations || emptyArray; return; - function collect(node, allowRelativeModuleNames, collectOnlyRequireCalls) { - if (!collectOnlyRequireCalls) { - switch (node.kind) { - case 222: - case 221: - case 228: - var moduleNameExpr = ts.getExternalModuleName(node); - if (!moduleNameExpr || moduleNameExpr.kind !== 9) { - break; - } - if (!moduleNameExpr.text) { - break; - } - if (allowRelativeModuleNames || !ts.isExternalModuleNameRelative(moduleNameExpr.text)) { - (imports || (imports = [])).push(moduleNameExpr); - } + function collectModuleReferences(node, inAmbientModule) { + switch (node.kind) { + case 230: + case 229: + case 236: + var moduleNameExpr = ts.getExternalModuleName(node); + if (!moduleNameExpr || moduleNameExpr.kind !== 9) { break; - case 218: - if (node.name.kind === 9 && (node.flags & 4 || ts.isDeclarationFile(file))) { - ts.forEachChild(node.body, function (node) { - collect(node, false, collectOnlyRequireCalls); - }); - } + } + if (!moduleNameExpr.text) { break; - } + } + if (!inAmbientModule || !ts.isExternalModuleNameRelative(moduleNameExpr.text)) { + (imports || (imports = [])).push(moduleNameExpr); + } + break; + case 225: + if (ts.isAmbientModule(node) && (inAmbientModule || node.flags & 2 || ts.isDeclarationFile(file))) { + var moduleName = node.name; + if (isExternalModuleFile || (inAmbientModule && !ts.isExternalModuleNameRelative(moduleName.text))) { + (moduleAugmentations || (moduleAugmentations = [])).push(moduleName); + } + else if (!inAmbientModule) { + for (var _i = 0, _a = node.body.statements; _i < _a.length; _i++) { + var statement = _a[_i]; + collectModuleReferences(statement, true); + } + } + } } - if (isJavaScriptFile) { - if (ts.isRequireCall(node)) { - (imports || (imports = [])).push(node.arguments[0]); - } - else { - ts.forEachChild(node, function (node) { return collect(node, allowRelativeModuleNames, true); }); - } + } + function collectRequireCalls(node) { + if (ts.isRequireCall(node, true)) { + (imports || (imports = [])).push(node.arguments[0]); + } + else { + ts.forEachChild(node, collectRequireCalls); } } } - function processSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd) { + function processSourceFile(fileName, isDefaultLib, isReference, refFile, refPos, refEnd) { var diagnosticArgument; var diagnostic; if (hasExtension(fileName)) { - if (!options.allowNonTsExtensions && !ts.forEach(ts.supportedExtensions, function (extension) { return ts.fileExtensionIs(host.getCanonicalFileName(fileName), extension); })) { + if (!options.allowNonTsExtensions && !ts.forEach(supportedExtensions, function (extension) { return ts.fileExtensionIs(host.getCanonicalFileName(fileName), extension); })) { diagnostic = ts.Diagnostics.File_0_has_unsupported_extension_The_only_supported_extensions_are_1; - diagnosticArgument = [fileName, "'" + ts.supportedExtensions.join("', '") + "'"]; + diagnosticArgument = [fileName, "'" + supportedExtensions.join("', '") + "'"]; } - else if (!findSourceFile(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName), isDefaultLib, refFile, refPos, refEnd)) { + else if (!findSourceFile(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName), isDefaultLib, isReference, refFile, refPos, refEnd)) { diagnostic = ts.Diagnostics.File_0_not_found; diagnosticArgument = [fileName]; } @@ -32090,13 +36525,13 @@ var ts; } } else { - var nonTsFile = options.allowNonTsExtensions && findSourceFile(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName), isDefaultLib, refFile, refPos, refEnd); + var nonTsFile = options.allowNonTsExtensions && findSourceFile(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName), isDefaultLib, isReference, refFile, refPos, refEnd); if (!nonTsFile) { if (options.allowNonTsExtensions) { diagnostic = ts.Diagnostics.File_0_not_found; diagnosticArgument = [fileName]; } - else if (!ts.forEach(ts.supportedExtensions, function (extension) { return findSourceFile(fileName + extension, ts.toPath(fileName + extension, currentDirectory, getCanonicalFileName), isDefaultLib, refFile, refPos, refEnd); })) { + else if (!ts.forEach(supportedExtensions, function (extension) { return findSourceFile(fileName + extension, ts.toPath(fileName + extension, currentDirectory, getCanonicalFileName), isDefaultLib, isReference, refFile, refPos, refEnd); })) { diagnostic = ts.Diagnostics.File_0_not_found; fileName += ".ts"; diagnosticArgument = [fileName]; @@ -32120,12 +36555,15 @@ var ts; fileProcessingDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, existingFileName)); } } - function findSourceFile(fileName, normalizedAbsolutePath, isDefaultLib, refFile, refPos, refEnd) { - if (filesByName.contains(normalizedAbsolutePath)) { - var file_1 = filesByName.get(normalizedAbsolutePath); - if (file_1 && options.forceConsistentCasingInFileNames && ts.getNormalizedAbsolutePath(file_1.fileName, currentDirectory) !== normalizedAbsolutePath) { + function findSourceFile(fileName, path, isDefaultLib, isReference, refFile, refPos, refEnd) { + if (filesByName.contains(path)) { + var file_1 = filesByName.get(path); + if (file_1 && options.forceConsistentCasingInFileNames && ts.getNormalizedAbsolutePath(file_1.fileName, currentDirectory) !== ts.getNormalizedAbsolutePath(fileName, currentDirectory)) { reportFileNamesDifferOnlyInCasingError(fileName, file_1.fileName, refFile, refPos, refEnd); } + if (file_1) { + file_1.wasReferenced = file_1.wasReferenced || isReference; + } return file_1; } var file = host.getSourceFile(fileName, options.target, function (hostErrorMessage) { @@ -32136,22 +36574,24 @@ var ts; fileProcessingDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage)); } }); - filesByName.set(normalizedAbsolutePath, file); + filesByName.set(path, file); if (file) { - file.path = normalizedAbsolutePath; + file.wasReferenced = file.wasReferenced || isReference; + file.path = path; if (host.useCaseSensitiveFileNames()) { - var existingFile = filesByNameIgnoreCase.get(normalizedAbsolutePath); + var existingFile = filesByNameIgnoreCase.get(path); if (existingFile) { reportFileNamesDifferOnlyInCasingError(fileName, existingFile.fileName, refFile, refPos, refEnd); } else { - filesByNameIgnoreCase.set(normalizedAbsolutePath, file); + filesByNameIgnoreCase.set(path, file); } } skipDefaultLib = skipDefaultLib || file.hasNoDefaultLib; var basePath = ts.getDirectoryPath(fileName); if (!options.noResolve) { - processReferencedFiles(file, basePath); + processReferencedFiles(file, basePath, isDefaultLib); + processTypeReferenceDirectives(file); } processImportedModules(file, basePath); if (isDefaultLib) { @@ -32163,30 +36603,85 @@ var ts; } return file; } - function processReferencedFiles(file, basePath) { + function processReferencedFiles(file, basePath, isDefaultLib) { ts.forEach(file.referencedFiles, function (ref) { var referencedFileName = resolveTripleslashReference(ref.fileName, file.fileName); - processSourceFile(referencedFileName, false, file, ref.pos, ref.end); + processSourceFile(referencedFileName, isDefaultLib, true, file, ref.pos, ref.end); }); } + function processTypeReferenceDirectives(file) { + var typeDirectives = ts.map(file.typeReferenceDirectives, function (l) { return l.fileName; }); + var resolutions = resolveTypeReferenceDirectiveNamesWorker(typeDirectives, file.fileName); + for (var i = 0; i < typeDirectives.length; i++) { + var ref = file.typeReferenceDirectives[i]; + var resolvedTypeReferenceDirective = resolutions[i]; + ts.setResolvedTypeReferenceDirective(file, ref.fileName, resolvedTypeReferenceDirective); + processTypeReferenceDirective(ref.fileName, resolvedTypeReferenceDirective, file, ref.pos, ref.end); + } + } + function processTypeReferenceDirective(typeReferenceDirective, resolvedTypeReferenceDirective, refFile, refPos, refEnd) { + var previousResolution = resolvedTypeReferenceDirectives[typeReferenceDirective]; + if (previousResolution && previousResolution.primary) { + return; + } + var saveResolution = true; + if (resolvedTypeReferenceDirective) { + if (resolvedTypeReferenceDirective.primary) { + processSourceFile(resolvedTypeReferenceDirective.resolvedFileName, false, true, refFile, refPos, refEnd); + } + else { + if (previousResolution) { + var otherFileText = host.readFile(resolvedTypeReferenceDirective.resolvedFileName); + if (otherFileText !== getSourceFile(previousResolution.resolvedFileName).text) { + fileProcessingDiagnostics.add(createDiagnostic(refFile, refPos, refEnd, ts.Diagnostics.Conflicting_library_definitions_for_0_found_at_1_and_2_Copy_the_correct_file_to_the_typings_folder_to_resolve_this_conflict, typeReferenceDirective, resolvedTypeReferenceDirective.resolvedFileName, previousResolution.resolvedFileName)); + } + saveResolution = false; + } + else { + processSourceFile(resolvedTypeReferenceDirective.resolvedFileName, false, true, refFile, refPos, refEnd); + } + } + } + else { + fileProcessingDiagnostics.add(createDiagnostic(refFile, refPos, refEnd, ts.Diagnostics.Cannot_find_name_0, typeReferenceDirective)); + } + if (saveResolution) { + resolvedTypeReferenceDirectives[typeReferenceDirective] = resolvedTypeReferenceDirective; + } + } + function createDiagnostic(refFile, refPos, refEnd, message) { + var args = []; + for (var _i = 4; _i < arguments.length; _i++) { + args[_i - 4] = arguments[_i]; + } + if (refFile === undefined || refPos === undefined || refEnd === undefined) { + return ts.createCompilerDiagnostic.apply(void 0, [message].concat(args)); + } + else { + return ts.createFileDiagnostic.apply(void 0, [refFile, refPos, refEnd - refPos, message].concat(args)); + } + } function getCanonicalFileName(fileName) { return host.getCanonicalFileName(fileName); } function processImportedModules(file, basePath) { collectExternalModuleReferences(file); - if (file.imports.length) { + if (file.imports.length || file.moduleAugmentations.length) { file.resolvedModules = {}; - var moduleNames = ts.map(file.imports, function (name) { return name.text; }); + var moduleNames = ts.map(ts.concatenate(file.imports, file.moduleAugmentations), getTextOfLiteral); var resolutions = resolveModuleNamesWorker(moduleNames, ts.getNormalizedAbsolutePath(file.fileName, currentDirectory)); - for (var i = 0; i < file.imports.length; ++i) { + for (var i = 0; i < moduleNames.length; i++) { var resolution = resolutions[i]; ts.setResolvedModule(file, moduleNames[i], resolution); - if (resolution && !options.noResolve) { - var importedFile = findSourceFile(resolution.resolvedFileName, ts.toPath(resolution.resolvedFileName, currentDirectory, getCanonicalFileName), false, file, ts.skipTrivia(file.text, file.imports[i].pos), file.imports[i].end); + var shouldAddFile = resolution && + !options.noResolve && + i < file.imports.length; + if (shouldAddFile) { + var importedFile = findSourceFile(resolution.resolvedFileName, ts.toPath(resolution.resolvedFileName, currentDirectory, getCanonicalFileName), false, false, file, ts.skipTrivia(file.text, file.imports[i].pos), file.imports[i].end); if (importedFile && resolution.isExternalLibraryImport) { - if (!ts.isExternalModule(importedFile)) { - var start_2 = ts.getTokenPosOfNode(file.imports[i], file); - fileProcessingDiagnostics.add(ts.createFileDiagnostic(file, start_2, file.imports[i].end - start_2, ts.Diagnostics.Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_the_package_definition, importedFile.fileName)); + if (!ts.isExternalModule(importedFile) && importedFile.statements.length) { + var start_5 = ts.getTokenPosOfNode(file.imports[i], file); + fileProcessingDiagnostics.add(ts.createFileDiagnostic(file, start_5, file.imports[i].end - start_5, ts.Diagnostics.Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_the_package_definition, importedFile.fileName)); } else if (importedFile.referencedFiles.length) { var firstRef = importedFile.referencedFiles[0]; @@ -32202,42 +36697,21 @@ var ts; return; } function computeCommonSourceDirectory(sourceFiles) { - var commonPathComponents; - ts.forEach(files, function (sourceFile) { - if (ts.isDeclarationFile(sourceFile)) { - return; + var fileNames = []; + for (var _i = 0, sourceFiles_2 = sourceFiles; _i < sourceFiles_2.length; _i++) { + var file = sourceFiles_2[_i]; + if (!file.isDeclarationFile) { + fileNames.push(file.fileName); } - var sourcePathComponents = ts.getNormalizedPathComponents(sourceFile.fileName, currentDirectory); - sourcePathComponents.pop(); - if (!commonPathComponents) { - commonPathComponents = sourcePathComponents; - return; - } - for (var i = 0, n = Math.min(commonPathComponents.length, sourcePathComponents.length); i < n; i++) { - if (commonPathComponents[i] !== sourcePathComponents[i]) { - if (i === 0) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files)); - return; - } - commonPathComponents.length = i; - break; - } - } - if (sourcePathComponents.length < commonPathComponents.length) { - commonPathComponents.length = sourcePathComponents.length; - } - }); - if (!commonPathComponents) { - return currentDirectory; } - return ts.getNormalizedPathFromPathComponents(commonPathComponents); + return computeCommonSourceDirectoryOfFilenames(fileNames, currentDirectory, getCanonicalFileName); } function checkSourceFilesBelongToPath(sourceFiles, rootDirectory) { var allFilesBelongToPath = true; if (sourceFiles) { var absoluteRootDirectoryPath = host.getCanonicalFileName(ts.getNormalizedAbsolutePath(rootDirectory, currentDirectory)); - for (var _i = 0, sourceFiles_1 = sourceFiles; _i < sourceFiles_1.length; _i++) { - var sourceFile = sourceFiles_1[_i]; + for (var _i = 0, sourceFiles_3 = sourceFiles; _i < sourceFiles_3.length; _i++) { + var sourceFile = sourceFiles_3[_i]; if (!ts.isDeclarationFile(sourceFile)) { var absoluteSourceFilePath = host.getCanonicalFileName(ts.getNormalizedAbsolutePath(sourceFile.fileName, currentDirectory)); if (absoluteSourceFilePath.indexOf(absoluteRootDirectoryPath) !== 0) { @@ -32271,14 +36745,44 @@ var ts; if (options.mapRoot) { programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "mapRoot", "inlineSourceMap")); } - if (options.sourceRoot) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceRoot", "inlineSourceMap")); + } + if (options.paths && options.baseUrl === undefined) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_paths_cannot_be_used_without_specifying_baseUrl_option)); + } + if (options.paths) { + for (var key in options.paths) { + if (!ts.hasProperty(options.paths, key)) { + continue; + } + if (!hasZeroOrOneAsteriskCharacter(key)) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Pattern_0_can_have_at_most_one_Asterisk_character, key)); + } + if (ts.isArray(options.paths[key])) { + for (var _i = 0, _a = options.paths[key]; _i < _a.length; _i++) { + var subst = _a[_i]; + var typeOfSubst = typeof subst; + if (typeOfSubst === "string") { + if (!hasZeroOrOneAsteriskCharacter(subst)) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character, subst, key)); + } + } + else { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Substitution_0_for_pattern_1_has_incorrect_type_expected_string_got_2, subst, key, typeOfSubst)); + } + } + } + else { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Substututions_for_pattern_0_should_be_an_array, key)); + } } } if (options.inlineSources) { if (!options.sourceMap && !options.inlineSourceMap) { programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_inlineSources_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided)); } + if (options.sourceRoot) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceRoot", "inlineSources")); + } } if (options.out && options.outFile) { programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "outFile")); @@ -32287,16 +36791,26 @@ var ts; if (options.mapRoot) { programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "mapRoot", "sourceMap")); } - if (options.sourceRoot) { + if (options.sourceRoot && !options.inlineSourceMap) { programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "sourceRoot", "sourceMap")); } - return; + } + if (options.declarationDir) { + if (!options.declaration) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "declarationDir", "declaration")); + } + if (options.out || options.outFile) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "declarationDir", options.out ? "out" : "outFile")); + } + } + if (options.lib && options.noLib) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "lib", "noLib")); } var languageVersion = options.target || 0; var outFile = options.outFile || options.out; var firstExternalModuleSourceFile = ts.forEach(files, function (f) { return ts.isExternalModule(f) ? f : undefined; }); if (options.isolatedModules) { - if (!options.module && languageVersion < 2) { + if (options.module === ts.ModuleKind.None && languageVersion < 2) { programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES2015_or_higher)); } var firstNonExternalModuleSourceFile = ts.forEach(files, function (f) { return !ts.isExternalModule(f) && !ts.isDeclarationFile(f) ? f : undefined; }); @@ -32305,47 +36819,60 @@ var ts; programDiagnostics.add(ts.createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided)); } } - else if (firstExternalModuleSourceFile && languageVersion < 2 && !options.module) { + else if (firstExternalModuleSourceFile && languageVersion < 2 && options.module === ts.ModuleKind.None) { var span = ts.getErrorSpanForNode(firstExternalModuleSourceFile, firstExternalModuleSourceFile.externalModuleIndicator); - programDiagnostics.add(ts.createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_modules_unless_the_module_flag_is_provided)); + programDiagnostics.add(ts.createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_modules_unless_the_module_flag_is_provided_with_a_valid_module_type_Consider_setting_the_module_compiler_option_in_a_tsconfig_json_file)); } - if (options.module === 5 && languageVersion < 2) { + if (options.module === ts.ModuleKind.ES6 && languageVersion < 2) { programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_compile_modules_into_es2015_when_targeting_ES5_or_lower)); } - if (outFile && options.module && !(options.module === 2 || options.module === 4)) { + if (outFile && options.module && !(options.module === ts.ModuleKind.AMD || options.module === ts.ModuleKind.System)) { programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Only_amd_and_system_modules_are_supported_alongside_0, options.out ? "out" : "outFile")); } if (options.outDir || options.sourceRoot || options.mapRoot) { - if (options.rootDir && checkSourceFilesBelongToPath(files, options.rootDir)) { - commonSourceDirectory = ts.getNormalizedAbsolutePath(options.rootDir, currentDirectory); - } - else { - commonSourceDirectory = computeCommonSourceDirectory(files); - } - if (commonSourceDirectory && commonSourceDirectory[commonSourceDirectory.length - 1] !== ts.directorySeparator) { - commonSourceDirectory += ts.directorySeparator; + var dir = getCommonSourceDirectory(); + if (options.outDir && dir === "" && ts.forEach(files, function (file) { return ts.getRootLength(file.fileName) > 1; })) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files)); } } - if (options.noEmit) { - if (options.out) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "out")); - } - if (options.outFile) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outFile")); - } - if (options.outDir) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outDir")); - } - if (options.declaration) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "declaration")); - } + if (!options.noEmit && options.allowJs && options.declaration) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "allowJs", "declaration")); } if (options.emitDecoratorMetadata && !options.experimentalDecorators) { programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators")); } + if (options.reactNamespace && !ts.isIdentifier(options.reactNamespace, languageVersion)) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier, options.reactNamespace)); + } + if (!options.noEmit && !options.suppressOutputPathCheck) { + var emitHost = getEmitHost(); + var emitFilesSeen_1 = ts.createFileMap(!host.useCaseSensitiveFileNames() ? function (key) { return key.toLocaleLowerCase(); } : undefined); + ts.forEachExpectedEmitFile(emitHost, function (emitFileNames, sourceFiles, isBundledEmit) { + verifyEmitFilePath(emitFileNames.jsFilePath, emitFilesSeen_1); + verifyEmitFilePath(emitFileNames.declarationFilePath, emitFilesSeen_1); + }); + } + function verifyEmitFilePath(emitFileName, emitFilesSeen) { + if (emitFileName) { + var emitFilePath = ts.toPath(emitFileName, currentDirectory, getCanonicalFileName); + if (filesByName.contains(emitFilePath)) { + createEmitBlockingDiagnostics(emitFileName, emitFilePath, ts.Diagnostics.Cannot_write_file_0_because_it_would_overwrite_input_file); + } + if (emitFilesSeen.contains(emitFilePath)) { + createEmitBlockingDiagnostics(emitFileName, emitFilePath, ts.Diagnostics.Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files); + } + else { + emitFilesSeen.set(emitFilePath, true); + } + } + } + } + function createEmitBlockingDiagnostics(emitFileName, emitFilePath, message) { + hasEmitBlockingDiagnostics.set(ts.toPath(emitFileName, currentDirectory, getCanonicalFileName), true); + programDiagnostics.add(ts.createCompilerDiagnostic(message, emitFileName)); } } ts.createProgram = createProgram; @@ -32355,12 +36882,12 @@ var ts; var BreakpointResolver; (function (BreakpointResolver) { function spanInSourceFileAtLocation(sourceFile, position) { - if (sourceFile.flags & 4096) { + if (sourceFile.isDeclarationFile) { return undefined; } var tokenAtLocation = ts.getTokenAtPosition(sourceFile, position); var lineOfPosition = sourceFile.getLineAndCharacterOfPosition(position).line; - if (sourceFile.getLineAndCharacterOfPosition(tokenAtLocation.getStart()).line > lineOfPosition) { + if (sourceFile.getLineAndCharacterOfPosition(tokenAtLocation.getStart(sourceFile)).line > lineOfPosition) { tokenAtLocation = ts.findPrecedingToken(tokenAtLocation.pos, sourceFile); if (!tokenAtLocation || sourceFile.getLineAndCharacterOfPosition(tokenAtLocation.getEnd()).line !== lineOfPosition) { return undefined; @@ -32371,14 +36898,23 @@ var ts; } return spanInNode(tokenAtLocation); function textSpan(startNode, endNode) { - return ts.createTextSpanFromBounds(startNode.getStart(), (endNode || startNode).getEnd()); + var start = startNode.decorators ? + ts.skipTrivia(sourceFile.text, startNode.decorators.end) : + startNode.getStart(sourceFile); + return ts.createTextSpanFromBounds(start, (endNode || startNode).getEnd()); + } + function textSpanEndingAtNextToken(startNode, previousTokenToFindNextEndToken) { + return textSpan(startNode, ts.findNextToken(previousTokenToFindNextEndToken, previousTokenToFindNextEndToken.parent)); } function spanInNodeIfStartsOnSameLine(node, otherwiseOnNode) { - if (node && lineOfPosition === sourceFile.getLineAndCharacterOfPosition(node.getStart()).line) { + if (node && lineOfPosition === sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile)).line) { return spanInNode(node); } return spanInNode(otherwiseOnNode); } + function spanInNodeArray(nodeArray) { + return ts.createTextSpanFromBounds(ts.skipTrivia(sourceFile.text, nodeArray.pos), nodeArray.end); + } function spanInPreviousNode(node) { return spanInNode(ts.findPrecedingToken(node.pos, sourceFile)); } @@ -32387,99 +36923,90 @@ var ts; } function spanInNode(node) { if (node) { - if (ts.isExpression(node)) { - if (node.parent.kind === 197) { - return spanInPreviousNode(node); - } - if (node.parent.kind === 199) { - return textSpan(node); - } - if (node.parent.kind === 181 && node.parent.operatorToken.kind === 24) { - return textSpan(node); - } - if (node.parent.kind === 174 && node.parent.body === node) { - return textSpan(node); - } - } switch (node.kind) { - case 193: + case 200: return spanInVariableDeclaration(node.declarationList.declarations[0]); - case 211: - case 141: - case 140: - return spanInVariableDeclaration(node); - case 138: - return spanInParameterDeclaration(node); - case 213: - case 143: - case 142: + case 218: case 145: - case 146: case 144: - case 173: - case 174: + return spanInVariableDeclaration(node); + case 142: + return spanInParameterDeclaration(node); + case 220: + case 147: + case 146: + case 149: + case 150: + case 148: + case 179: + case 180: return spanInFunctionDeclaration(node); - case 192: + case 199: if (ts.isFunctionBlock(node)) { return spanInFunctionBlock(node); } - case 219: + case 226: return spanInBlock(node); - case 244: + case 252: return spanInBlock(node.block); - case 195: + case 202: return textSpan(node.expression); - case 204: + case 211: return textSpan(node.getChildAt(0), node.expression); - case 198: - return textSpan(node, ts.findNextToken(node.expression, node)); - case 197: + case 205: + return textSpanEndingAtNextToken(node, node.expression); + case 204: + return spanInNode(node.statement); + case 217: + return textSpan(node.getChildAt(0)); + case 203: + return textSpanEndingAtNextToken(node, node.expression); + case 214: return spanInNode(node.statement); case 210: - return textSpan(node.getChildAt(0)); - case 196: - return textSpan(node, ts.findNextToken(node.expression, node)); - case 207: - return spanInNode(node.statement); - case 203: - case 202: - return textSpan(node.getChildAt(0), node.label); - case 199: - return spanInForStatement(node); - case 200: - case 201: - return textSpan(node, ts.findNextToken(node.expression, node)); - case 206: - return textSpan(node, ts.findNextToken(node.expression, node)); - case 241: - case 242: - return spanInNode(node.statements[0]); case 209: - return spanInBlock(node.tryBlock); + return textSpan(node.getChildAt(0), node.label); + case 206: + return spanInForStatement(node); + case 207: + return textSpanEndingAtNextToken(node, node.expression); case 208: + return spanInInitializerOfForLike(node); + case 213: + return textSpanEndingAtNextToken(node, node.expression); + case 249: + case 250: + return spanInNode(node.statements[0]); + case 216: + return spanInBlock(node.tryBlock); + case 215: return textSpan(node, node.expression); - case 227: + case 235: return textSpan(node, node.expression); - case 221: + case 229: return textSpan(node, node.moduleReference); - case 222: + case 230: return textSpan(node, node.moduleSpecifier); - case 228: + case 236: return textSpan(node, node.moduleSpecifier); - case 218: + case 225: if (ts.getModuleInstanceState(node) !== 1) { return undefined; } - case 214: - case 217: - case 247: - case 168: + case 221: + case 224: + case 255: case 169: return textSpan(node); - case 205: + case 212: return spanInNode(node.statement); - case 215: - case 216: + case 143: + return spanInNodeArray(node.parent.decorators); + case 167: + case 168: + return spanInBindingPattern(node); + case 222: + case 223: return undefined; case 23: case 1: @@ -32490,6 +37017,8 @@ var ts; return spanInOpenBraceToken(node); case 16: return spanInCloseBraceToken(node); + case 20: + return spanInCloseBracketToken(node); case 17: return spanInOpenParenToken(node); case 18: @@ -32505,56 +37034,119 @@ var ts; case 72: case 85: return spanInNextNode(node); + case 138: + return spanInOfKeyword(node); default: - if (node.parent.kind === 245 && node.parent.name === node) { + if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node)) { + return spanInArrayLiteralOrObjectLiteralDestructuringPattern(node); + } + if ((node.kind === 69 || + node.kind == 191 || + node.kind === 253 || + node.kind === 254) && + ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent)) { + return textSpan(node); + } + if (node.kind === 187) { + var binaryExpression = node; + if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(binaryExpression.left)) { + return spanInArrayLiteralOrObjectLiteralDestructuringPattern(binaryExpression.left); + } + if (binaryExpression.operatorToken.kind === 56 && + ts.isArrayLiteralOrObjectLiteralDestructuringPattern(binaryExpression.parent)) { + return textSpan(node); + } + if (binaryExpression.operatorToken.kind === 24) { + return spanInNode(binaryExpression.left); + } + } + if (ts.isExpression(node)) { + switch (node.parent.kind) { + case 204: + return spanInPreviousNode(node); + case 143: + return spanInNode(node.parent); + case 206: + case 208: + return textSpan(node); + case 187: + if (node.parent.operatorToken.kind === 24) { + return textSpan(node); + } + break; + case 180: + if (node.parent.body === node) { + return textSpan(node); + } + break; + } + } + if (node.parent.kind === 253 && + node.parent.name === node && + !ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.parent)) { return spanInNode(node.parent.initializer); } - if (node.parent.kind === 171 && node.parent.type === node) { - return spanInNode(node.parent.expression); + if (node.parent.kind === 177 && node.parent.type === node) { + return spanInNextNode(node.parent.type); } if (ts.isFunctionLike(node.parent) && node.parent.type === node) { return spanInPreviousNode(node); } + if ((node.parent.kind === 218 || + node.parent.kind === 142)) { + var paramOrVarDecl = node.parent; + if (paramOrVarDecl.initializer === node || + paramOrVarDecl.type === node || + ts.isAssignmentOperator(node.kind)) { + return spanInPreviousNode(node); + } + } + if (node.parent.kind === 187) { + var binaryExpression = node.parent; + if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(binaryExpression.left) && + (binaryExpression.right === node || + binaryExpression.operatorToken === node)) { + return spanInPreviousNode(node); + } + } return spanInNode(node.parent); } } + function textSpanFromVariableDeclaration(variableDeclaration) { + var declarations = variableDeclaration.parent.declarations; + if (declarations && declarations[0] === variableDeclaration) { + return textSpan(ts.findPrecedingToken(variableDeclaration.pos, sourceFile, variableDeclaration.parent), variableDeclaration); + } + else { + return textSpan(variableDeclaration); + } + } function spanInVariableDeclaration(variableDeclaration) { - if (variableDeclaration.parent.parent.kind === 200 || - variableDeclaration.parent.parent.kind === 201) { + if (variableDeclaration.parent.parent.kind === 207) { return spanInNode(variableDeclaration.parent.parent); } - var isParentVariableStatement = variableDeclaration.parent.parent.kind === 193; - var isDeclarationOfForStatement = variableDeclaration.parent.parent.kind === 199 && ts.contains(variableDeclaration.parent.parent.initializer.declarations, variableDeclaration); - var declarations = isParentVariableStatement - ? variableDeclaration.parent.parent.declarationList.declarations - : isDeclarationOfForStatement - ? variableDeclaration.parent.parent.initializer.declarations - : undefined; - if (variableDeclaration.initializer || (variableDeclaration.flags & 2)) { - if (declarations && declarations[0] === variableDeclaration) { - if (isParentVariableStatement) { - return textSpan(variableDeclaration.parent, variableDeclaration); - } - else { - ts.Debug.assert(isDeclarationOfForStatement); - return textSpan(ts.findPrecedingToken(variableDeclaration.pos, sourceFile, variableDeclaration.parent), variableDeclaration); - } - } - else { - return textSpan(variableDeclaration); - } + if (ts.isBindingPattern(variableDeclaration.name)) { + return spanInBindingPattern(variableDeclaration.name); } - else if (declarations && declarations[0] !== variableDeclaration) { - var indexOfCurrentDeclaration = ts.indexOf(declarations, variableDeclaration); - return spanInVariableDeclaration(declarations[indexOfCurrentDeclaration - 1]); + if (variableDeclaration.initializer || + (variableDeclaration.flags & 1) || + variableDeclaration.parent.parent.kind === 208) { + return textSpanFromVariableDeclaration(variableDeclaration); + } + var declarations = variableDeclaration.parent.declarations; + if (declarations && declarations[0] !== variableDeclaration) { + return spanInNode(ts.findPrecedingToken(variableDeclaration.pos, sourceFile, variableDeclaration.parent)); } } function canHaveSpanInParameterDeclaration(parameter) { return !!parameter.initializer || parameter.dotDotDotToken !== undefined || - !!(parameter.flags & 8) || !!(parameter.flags & 16); + !!(parameter.flags & 4) || !!(parameter.flags & 8); } function spanInParameterDeclaration(parameter) { - if (canHaveSpanInParameterDeclaration(parameter)) { + if (ts.isBindingPattern(parameter.name)) { + return spanInBindingPattern(parameter.name); + } + else if (canHaveSpanInParameterDeclaration(parameter)) { return textSpan(parameter); } else { @@ -32569,8 +37161,8 @@ var ts; } } function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) { - return !!(functionDeclaration.flags & 2) || - (functionDeclaration.parent.kind === 214 && functionDeclaration.kind !== 144); + return !!(functionDeclaration.flags & 1) || + (functionDeclaration.parent.kind === 221 && functionDeclaration.kind !== 148); } function spanInFunctionDeclaration(functionDeclaration) { if (!functionDeclaration.body) { @@ -32590,31 +37182,34 @@ var ts; } function spanInBlock(block) { switch (block.parent.kind) { - case 218: + case 225: if (ts.getModuleInstanceState(block.parent) !== 1) { return undefined; } - case 198: - case 196: - case 200: - case 201: + case 205: + case 203: + case 207: return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]); - case 199: + case 206: + case 208: return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(block.pos, sourceFile, block.parent), block.statements[0]); } return spanInNode(block.statements[0]); } + function spanInInitializerOfForLike(forLikeStatement) { + if (forLikeStatement.initializer.kind === 219) { + var variableDeclarationList = forLikeStatement.initializer; + if (variableDeclarationList.declarations.length > 0) { + return spanInNode(variableDeclarationList.declarations[0]); + } + } + else { + return spanInNode(forLikeStatement.initializer); + } + } function spanInForStatement(forStatement) { if (forStatement.initializer) { - if (forStatement.initializer.kind === 212) { - var variableDeclarationList = forStatement.initializer; - if (variableDeclarationList.declarations.length > 0) { - return spanInNode(variableDeclarationList.declarations[0]); - } - } - else { - return spanInNode(forStatement.initializer); - } + return spanInInitializerOfForLike(forStatement); } if (forStatement.condition) { return textSpan(forStatement.condition); @@ -32623,84 +37218,142 @@ var ts; return textSpan(forStatement.incrementor); } } + function spanInBindingPattern(bindingPattern) { + var firstBindingElement = ts.forEach(bindingPattern.elements, function (element) { return element.kind !== 193 ? element : undefined; }); + if (firstBindingElement) { + return spanInNode(firstBindingElement); + } + if (bindingPattern.parent.kind === 169) { + return textSpan(bindingPattern.parent); + } + return textSpanFromVariableDeclaration(bindingPattern.parent); + } + function spanInArrayLiteralOrObjectLiteralDestructuringPattern(node) { + ts.Debug.assert(node.kind !== 168 && node.kind !== 167); + var elements = node.kind === 170 ? + node.elements : + node.properties; + var firstBindingElement = ts.forEach(elements, function (element) { return element.kind !== 193 ? element : undefined; }); + if (firstBindingElement) { + return spanInNode(firstBindingElement); + } + return textSpan(node.parent.kind === 187 ? node.parent : node); + } function spanInOpenBraceToken(node) { switch (node.parent.kind) { - case 217: + case 224: var enumDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), enumDeclaration.members.length ? enumDeclaration.members[0] : enumDeclaration.getLastToken(sourceFile)); - case 214: + case 221: var classDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile)); - case 220: + case 227: return spanInNodeIfStartsOnSameLine(node.parent.parent, node.parent.clauses[0]); } return spanInNode(node.parent); } function spanInCloseBraceToken(node) { switch (node.parent.kind) { - case 219: + case 226: if (ts.getModuleInstanceState(node.parent.parent) !== 1) { return undefined; } - case 217: - case 214: + case 224: + case 221: return textSpan(node); - case 192: + case 199: if (ts.isFunctionBlock(node.parent)) { return textSpan(node); } - case 244: + case 252: return spanInNode(ts.lastOrUndefined(node.parent.statements)); - case 220: + case 227: var caseBlock = node.parent; var lastClause = ts.lastOrUndefined(caseBlock.clauses); if (lastClause) { return spanInNode(ts.lastOrUndefined(lastClause.statements)); } return undefined; + case 167: + var bindingPattern = node.parent; + return spanInNode(ts.lastOrUndefined(bindingPattern.elements) || bindingPattern); default: + if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent)) { + var objectLiteral = node.parent; + return textSpan(ts.lastOrUndefined(objectLiteral.properties) || objectLiteral); + } + return spanInNode(node.parent); + } + } + function spanInCloseBracketToken(node) { + switch (node.parent.kind) { + case 168: + var bindingPattern = node.parent; + return textSpan(ts.lastOrUndefined(bindingPattern.elements) || bindingPattern); + default: + if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent)) { + var arrayLiteral = node.parent; + return textSpan(ts.lastOrUndefined(arrayLiteral.elements) || arrayLiteral); + } return spanInNode(node.parent); } } function spanInOpenParenToken(node) { - if (node.parent.kind === 197) { + if (node.parent.kind === 204 || + node.parent.kind === 174 || + node.parent.kind === 175) { return spanInPreviousNode(node); } + if (node.parent.kind === 178) { + return spanInNextNode(node); + } return spanInNode(node.parent); } function spanInCloseParenToken(node) { switch (node.parent.kind) { - case 173: - case 213: - case 174: - case 143: - case 142: - case 145: + case 179: + case 220: + case 180: + case 147: case 146: - case 144: - case 198: - case 197: - case 199: + case 149: + case 150: + case 148: + case 205: + case 204: + case 206: + case 208: + case 174: + case 175: + case 178: return spanInPreviousNode(node); default: return spanInNode(node.parent); } } function spanInColonToken(node) { - if (ts.isFunctionLike(node.parent) || node.parent.kind === 245) { + if (ts.isFunctionLike(node.parent) || + node.parent.kind === 253 || + node.parent.kind === 142) { return spanInPreviousNode(node); } return spanInNode(node.parent); } function spanInGreaterThanOrLessThanToken(node) { - if (node.parent.kind === 171) { - return spanInNode(node.parent.expression); + if (node.parent.kind === 177) { + return spanInNextNode(node); } return spanInNode(node.parent); } function spanInWhileKeyword(node) { - if (node.parent.kind === 197) { - return textSpan(node, ts.findNextToken(node.parent.expression, node.parent)); + if (node.parent.kind === 204) { + return textSpanEndingAtNextToken(node, node.parent.expression); + } + return spanInNode(node.parent); + } + function spanInOfKeyword(node) { + if (node.parent.kind === 208) { + return spanInNextNode(node); } return spanInNode(node.parent); } @@ -32777,7 +37430,7 @@ var ts; } } function autoCollapse(node) { - return ts.isFunctionBlock(node) && node.parent.kind !== 174; + return ts.isFunctionBlock(node) && node.parent.kind !== 180; } var depth = 0; var maxDepth = 20; @@ -32789,26 +37442,26 @@ var ts; addOutliningForLeadingCommentsForNode(n); } switch (n.kind) { - case 192: + case 199: if (!ts.isFunctionBlock(n)) { - var parent_7 = n.parent; + var parent_14 = n.parent; var openBrace = ts.findChildOfKind(n, 15, sourceFile); var closeBrace = ts.findChildOfKind(n, 16, sourceFile); - if (parent_7.kind === 197 || - parent_7.kind === 200 || - parent_7.kind === 201 || - parent_7.kind === 199 || - parent_7.kind === 196 || - parent_7.kind === 198 || - parent_7.kind === 205 || - parent_7.kind === 244) { - addOutliningSpan(parent_7, openBrace, closeBrace, autoCollapse(n)); + if (parent_14.kind === 204 || + parent_14.kind === 207 || + parent_14.kind === 208 || + parent_14.kind === 206 || + parent_14.kind === 203 || + parent_14.kind === 205 || + parent_14.kind === 212 || + parent_14.kind === 252) { + addOutliningSpan(parent_14, openBrace, closeBrace, autoCollapse(n)); break; } - if (parent_7.kind === 209) { - var tryStatement = parent_7; + if (parent_14.kind === 216) { + var tryStatement = parent_14; if (tryStatement.tryBlock === n) { - addOutliningSpan(parent_7, openBrace, closeBrace, autoCollapse(n)); + addOutliningSpan(parent_14, openBrace, closeBrace, autoCollapse(n)); break; } else if (tryStatement.finallyBlock === n) { @@ -32828,23 +37481,23 @@ var ts; }); break; } - case 219: { + case 226: { var openBrace = ts.findChildOfKind(n, 15, sourceFile); var closeBrace = ts.findChildOfKind(n, 16, sourceFile); addOutliningSpan(n.parent, openBrace, closeBrace, autoCollapse(n)); break; } - case 214: - case 215: - case 217: - case 165: - case 220: { + case 221: + case 222: + case 224: + case 171: + case 227: { var openBrace = ts.findChildOfKind(n, 15, sourceFile); var closeBrace = ts.findChildOfKind(n, 16, sourceFile); addOutliningSpan(n, openBrace, closeBrace, autoCollapse(n)); break; } - case 164: + case 170: var openBracket = ts.findChildOfKind(n, 19, sourceFile); var closeBracket = ts.findChildOfKind(n, 20, sourceFile); addOutliningSpan(n, openBracket, closeBracket, autoCollapse(n)); @@ -32871,28 +37524,28 @@ var ts; ts.forEach(program.getSourceFiles(), function (sourceFile) { cancellationToken.throwIfCancellationRequested(); var nameToDeclarations = sourceFile.getNamedDeclarations(); - for (var name_32 in nameToDeclarations) { - var declarations = ts.getProperty(nameToDeclarations, name_32); + for (var name_34 in nameToDeclarations) { + var declarations = ts.getProperty(nameToDeclarations, name_34); if (declarations) { - var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_32); + var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_34); if (!matches) { continue; } - for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) { - var declaration = declarations_6[_i]; + for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) { + var declaration = declarations_7[_i]; if (patternMatcher.patternContainsDots) { var containers = getContainers(declaration); if (!containers) { return undefined; } - matches = patternMatcher.getMatches(containers, name_32); + matches = patternMatcher.getMatches(containers, name_34); if (!matches) { continue; } } var fileName = sourceFile.fileName; var matchKind = bestMatchKind(matches); - rawItems.push({ name: name_32, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); + rawItems.push({ name: name_34, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); } } } @@ -32929,7 +37582,7 @@ var ts; if (text !== undefined) { containers.unshift(text); } - else if (declaration.name.kind === 136) { + else if (declaration.name.kind === 140) { return tryAddComputedPropertyName(declaration.name.expression, containers, true); } else { @@ -32946,7 +37599,7 @@ var ts; } return true; } - if (expression.kind === 166) { + if (expression.kind === 172) { var propertyAccess = expression; if (includeLastPortion) { containers.unshift(propertyAccess.name.text); @@ -32957,7 +37610,7 @@ var ts; } function getContainers(declaration) { var containers = []; - if (declaration.name.kind === 136) { + if (declaration.name.kind === 140) { if (!tryAddComputedPropertyName(declaration.name.expression, containers, false)) { return undefined; } @@ -33011,7 +37664,10 @@ var ts; (function (ts) { var NavigationBar; (function (NavigationBar) { - function getNavigationBarItems(sourceFile) { + function getNavigationBarItems(sourceFile, compilerOptions) { + if (ts.isSourceFileJavaScript(sourceFile)) { + return getJsNavigationBarItems(sourceFile, compilerOptions); + } var hasGlobalNode = false; return getItemsWorker(getTopLevelNodes(sourceFile), createTopLevelItem); function getIndent(node) { @@ -33019,14 +37675,14 @@ var ts; var current = node.parent; while (current) { switch (current.kind) { - case 218: + case 225: do { current = current.parent; - } while (current.kind === 218); - case 214: - case 217: - case 215: - case 213: + } while (current.kind === 225); + case 221: + case 224: + case 222: + case 220: indent++; } current = current.parent; @@ -33037,26 +37693,26 @@ var ts; var childNodes = []; function visit(node) { switch (node.kind) { - case 193: + case 200: ts.forEach(node.declarationList.declarations, visit); break; - case 161: - case 162: + case 167: + case 168: ts.forEach(node.elements, visit); break; - case 228: + case 236: if (node.exportClause) { ts.forEach(node.exportClause.elements, visit); } break; - case 222: + case 230: var importClause = node.importClause; if (importClause) { if (importClause.name) { childNodes.push(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 224) { + if (importClause.namedBindings.kind === 232) { childNodes.push(importClause.namedBindings); } else { @@ -33065,20 +37721,20 @@ var ts; } } break; - case 163: - case 211: + case 169: + case 218: if (ts.isBindingPattern(node.name)) { visit(node.name); break; } - case 214: - case 217: - case 215: - case 218: - case 213: case 221: - case 226: - case 230: + case 224: + case 222: + case 225: + case 220: + case 229: + case 234: + case 238: childNodes.push(node); break; } @@ -33113,17 +37769,31 @@ var ts; for (var _i = 0, nodes_4 = nodes; _i < nodes_4.length; _i++) { var node = nodes_4[_i]; switch (node.kind) { - case 214: - case 217: - case 215: + case 221: + topLevelNodes.push(node); + for (var _a = 0, _b = node.members; _a < _b.length; _a++) { + var member = _b[_a]; + if (member.kind === 147 || member.kind === 148) { + if (member.body) { + if (hasNamedFunctionDeclarations(member.body.statements)) { + topLevelNodes.push(member); + } + addTopLevelNodes(member.body.statements, topLevelNodes); + } + } + } + break; + case 224: + case 222: + case 223: topLevelNodes.push(node); break; - case 218: + case 225: var moduleDeclaration = node; topLevelNodes.push(node); addTopLevelNodes(getInnermostModule(moduleDeclaration).body.statements, topLevelNodes); break; - case 213: + case 220: var functionDeclaration = node; if (isTopLevelFunctionDeclaration(functionDeclaration)) { topLevelNodes.push(node); @@ -33133,15 +37803,31 @@ var ts; } } } + function hasNamedFunctionDeclarations(nodes) { + for (var _i = 0, nodes_5 = nodes; _i < nodes_5.length; _i++) { + var s = nodes_5[_i]; + if (s.kind === 220 && !isEmpty(s.name.text)) { + return true; + } + } + return false; + } function isTopLevelFunctionDeclaration(functionDeclaration) { - if (functionDeclaration.kind === 213) { - if (functionDeclaration.body && functionDeclaration.body.kind === 192) { - if (ts.forEach(functionDeclaration.body.statements, function (s) { return s.kind === 213 && !isEmpty(s.name.text); })) { + if (functionDeclaration.kind === 220) { + if (functionDeclaration.body && functionDeclaration.body.kind === 199) { + if (hasNamedFunctionDeclarations(functionDeclaration.body.statements)) { return true; } if (!ts.isFunctionBlock(functionDeclaration.parent)) { return true; } + else { + var grandParentKind = functionDeclaration.parent.parent.kind; + if (grandParentKind === 147 || + grandParentKind === 148) { + return true; + } + } } } return false; @@ -33149,8 +37835,8 @@ var ts; function getItemsWorker(nodes, createItem) { var items = []; var keyToItem = {}; - for (var _i = 0, nodes_5 = nodes; _i < nodes_5.length; _i++) { - var child = nodes_5[_i]; + for (var _i = 0, nodes_6 = nodes; _i < nodes_6.length; _i++) { + var child = nodes_6[_i]; var item = createItem(child); if (item !== undefined) { if (item.text.length > 0) { @@ -33189,42 +37875,42 @@ var ts; } function createChildItem(node) { switch (node.kind) { - case 138: + case 142: if (ts.isBindingPattern(node.name)) { break; } - if ((node.flags & 1022) === 0) { + if ((node.flags & 1023) === 0) { return undefined; } return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); - case 143: - case 142: - return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberFunctionElement); - case 145: - return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberGetAccessorElement); - case 146: - return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberSetAccessorElement); - case 149: - return createItem(node, "[]", ts.ScriptElementKind.indexSignatureElement); - case 247: - return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); case 147: - return createItem(node, "()", ts.ScriptElementKind.callSignatureElement); - case 148: - return createItem(node, "new()", ts.ScriptElementKind.constructSignatureElement); - case 141: - case 140: + case 146: + return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberFunctionElement); + case 149: + return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberGetAccessorElement); + case 150: + return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberSetAccessorElement); + case 153: + return createItem(node, "[]", ts.ScriptElementKind.indexSignatureElement); + case 255: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); - case 213: + case 151: + return createItem(node, "()", ts.ScriptElementKind.callSignatureElement); + case 152: + return createItem(node, "new()", ts.ScriptElementKind.constructSignatureElement); + case 145: + case 144: + return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); + case 220: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.functionElement); - case 211: - case 163: - var variableDeclarationNode; - var name_33; - if (node.kind === 163) { - name_33 = node.name; + case 218: + case 169: + var variableDeclarationNode = void 0; + var name_35; + if (node.kind === 169) { + name_35 = node.name; variableDeclarationNode = node; - while (variableDeclarationNode && variableDeclarationNode.kind !== 211) { + while (variableDeclarationNode && variableDeclarationNode.kind !== 218) { variableDeclarationNode = variableDeclarationNode.parent; } ts.Debug.assert(variableDeclarationNode !== undefined); @@ -33232,24 +37918,24 @@ var ts; else { ts.Debug.assert(!ts.isBindingPattern(node.name)); variableDeclarationNode = node; - name_33 = node.name; + name_35 = node.name; } if (ts.isConst(variableDeclarationNode)) { - return createItem(node, getTextOfNode(name_33), ts.ScriptElementKind.constElement); + return createItem(node, getTextOfNode(name_35), ts.ScriptElementKind.constElement); } else if (ts.isLet(variableDeclarationNode)) { - return createItem(node, getTextOfNode(name_33), ts.ScriptElementKind.letElement); + return createItem(node, getTextOfNode(name_35), ts.ScriptElementKind.letElement); } else { - return createItem(node, getTextOfNode(name_33), ts.ScriptElementKind.variableElement); + return createItem(node, getTextOfNode(name_35), ts.ScriptElementKind.variableElement); } - case 144: + case 148: return createItem(node, "constructor", ts.ScriptElementKind.constructorImplementationElement); - case 230: - case 226: - case 221: - case 223: - case 224: + case 238: + case 234: + case 229: + case 231: + case 232: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.alias); } return undefined; @@ -33279,27 +37965,32 @@ var ts; } function createTopLevelItem(node) { switch (node.kind) { - case 248: + case 256: return createSourceFileItem(node); - case 214: + case 221: return createClassItem(node); - case 217: + case 147: + case 148: + return createMemberFunctionLikeItem(node); + case 224: return createEnumItem(node); - case 215: - return createIterfaceItem(node); - case 218: + case 222: + return createInterfaceItem(node); + case 225: return createModuleItem(node); - case 213: + case 220: return createFunctionItem(node); + case 223: + return createTypeAliasItem(node); } return undefined; function getModuleName(moduleDeclaration) { - if (moduleDeclaration.name.kind === 9) { + if (ts.isAmbientModule(moduleDeclaration)) { return getTextOfNode(moduleDeclaration.name); } var result = []; result.push(moduleDeclaration.name.text); - while (moduleDeclaration.body && moduleDeclaration.body.kind === 218) { + while (moduleDeclaration.body && moduleDeclaration.body.kind === 225) { moduleDeclaration = moduleDeclaration.body; result.push(moduleDeclaration.name.text); } @@ -33311,12 +38002,32 @@ var ts; return getNavigationBarItem(moduleName, ts.ScriptElementKind.moduleElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } function createFunctionItem(node) { - if (node.body && node.body.kind === 192) { + if (node.body && node.body.kind === 199) { var childItems = getItemsWorker(sortNodes(node.body.statements), createChildItem); return getNavigationBarItem(!node.name ? "default" : node.name.text, ts.ScriptElementKind.functionElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } return undefined; } + function createTypeAliasItem(node) { + return getNavigationBarItem(node.name.text, ts.ScriptElementKind.typeElement, ts.getNodeModifiers(node), [getNodeSpan(node)], [], getIndent(node)); + } + function createMemberFunctionLikeItem(node) { + if (node.body && node.body.kind === 199) { + var childItems = getItemsWorker(sortNodes(node.body.statements), createChildItem); + var scriptElementKind = void 0; + var memberFunctionName = void 0; + if (node.kind === 147) { + memberFunctionName = ts.getPropertyNameForPropertyNameNode(node.name); + scriptElementKind = ts.ScriptElementKind.memberFunctionElement; + } + else { + memberFunctionName = "constructor"; + scriptElementKind = ts.ScriptElementKind.constructorImplementationElement; + } + return getNavigationBarItem(memberFunctionName, scriptElementKind, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); + } + return undefined; + } function createSourceFileItem(node) { var childItems = getItemsWorker(getChildNodes(node.statements), createChildItem); if (childItems === undefined || childItems.length === 0) { @@ -33332,7 +38043,7 @@ var ts; var childItems; if (node.members) { var constructor = ts.forEach(node.members, function (member) { - return member.kind === 144 && member; + return member.kind === 148 && member; }); var nodes = removeDynamicallyNamedProperties(node); if (constructor) { @@ -33347,25 +38058,25 @@ var ts; var childItems = getItemsWorker(sortNodes(removeComputedProperties(node)), createChildItem); return getNavigationBarItem(node.name.text, ts.ScriptElementKind.enumElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } - function createIterfaceItem(node) { + function createInterfaceItem(node) { var childItems = getItemsWorker(sortNodes(removeDynamicallyNamedProperties(node)), createChildItem); return getNavigationBarItem(node.name.text, ts.ScriptElementKind.interfaceElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } } function removeComputedProperties(node) { - return ts.filter(node.members, function (member) { return member.name === undefined || member.name.kind !== 136; }); + return ts.filter(node.members, function (member) { return member.name === undefined || member.name.kind !== 140; }); } function removeDynamicallyNamedProperties(node) { return ts.filter(node.members, function (member) { return !ts.hasDynamicName(member); }); } function getInnermostModule(node) { - while (node.body.kind === 218) { + while (node.body.kind === 225) { node = node.body; } return node; } function getNodeSpan(node) { - return node.kind === 248 + return node.kind === 256 ? ts.createTextSpanFromBounds(node.getFullStart(), node.getEnd()) : ts.createTextSpanFromBounds(node.getStart(), node.getEnd()); } @@ -33374,6 +38085,168 @@ var ts; } } NavigationBar.getNavigationBarItems = getNavigationBarItems; + function getJsNavigationBarItems(sourceFile, compilerOptions) { + var anonFnText = ""; + var anonClassText = ""; + var indent = 0; + var rootName = ts.isExternalModule(sourceFile) ? + "\"" + ts.escapeString(ts.getBaseFileName(ts.removeFileExtension(ts.normalizePath(sourceFile.fileName)))) + "\"" + : ""; + var sourceFileItem = getNavBarItem(rootName, ts.ScriptElementKind.moduleElement, [getNodeSpan(sourceFile)]); + var topItem = sourceFileItem; + ts.forEachChild(sourceFile, visitNode); + function visitNode(node) { + var newItem = createNavBarItem(node); + if (newItem) { + topItem.childItems.push(newItem); + } + if (newItem && (ts.isFunctionLike(node) || ts.isClassLike(node))) { + var lastTop = topItem; + indent++; + topItem = newItem; + ts.forEachChild(node, visitNode); + topItem = lastTop; + indent--; + if (newItem && newItem.text === anonFnText && newItem.childItems.length === 0) { + topItem.childItems.pop(); + } + } + else { + ts.forEachChild(node, visitNode); + } + } + function createNavBarItem(node) { + switch (node.kind) { + case 218: + if (node.parent.parent + .parent.kind !== 256) { + return undefined; + } + var varDecl = node; + if (varDecl.initializer && (varDecl.initializer.kind === 179 || + varDecl.initializer.kind === 180 || + varDecl.initializer.kind === 192)) { + return undefined; + } + case 220: + case 221: + case 148: + case 149: + case 150: + var name_36 = node.flags && (node.flags & 512) && !node.name ? "default" : + node.kind === 148 ? "constructor" : + ts.declarationNameToString(node.name); + return getNavBarItem(name_36, getScriptKindForElementKind(node.kind), [getNodeSpan(node)]); + case 179: + case 180: + case 192: + return getDefineModuleItem(node) || getFunctionOrClassExpressionItem(node); + case 147: + var methodDecl = node; + return getNavBarItem(ts.declarationNameToString(methodDecl.name), ts.ScriptElementKind.memberFunctionElement, [getNodeSpan(node)]); + case 235: + return getNavBarItem("default", ts.ScriptElementKind.variableElement, [getNodeSpan(node)]); + case 231: + if (!node.name) { + return undefined; + } + case 234: + case 232: + case 238: + if (node.kind === 238) { + if (!node.parent.parent.moduleSpecifier && !node.propertyName) { + return undefined; + } + } + var decl = node; + if (!decl.name) { + return undefined; + } + var declName = ts.declarationNameToString(decl.name); + return getNavBarItem(declName, ts.ScriptElementKind.constElement, [getNodeSpan(node)]); + default: + return undefined; + } + } + function getNavBarItem(text, kind, spans, kindModifiers) { + if (kindModifiers === void 0) { kindModifiers = ts.ScriptElementKindModifier.none; } + return { + text: text, kind: kind, kindModifiers: kindModifiers, spans: spans, childItems: [], indent: indent, bolded: false, grayed: false + }; + } + function getDefineModuleItem(node) { + if (node.kind !== 179 && node.kind !== 180) { + return undefined; + } + if (node.parent.kind !== 174) { + return undefined; + } + var callExpr = node.parent; + if (callExpr.expression.kind !== 69 || callExpr.expression.getText() !== "define") { + return undefined; + } + var defaultName = node.getSourceFile().fileName; + if (callExpr.arguments[0].kind === 9) { + defaultName = (callExpr.arguments[0]).text; + } + return getNavBarItem(defaultName, ts.ScriptElementKind.moduleElement, [getNodeSpan(node.parent)]); + } + function getFunctionOrClassExpressionItem(node) { + if (node.kind !== 179 && + node.kind !== 180 && + node.kind !== 192) { + return undefined; + } + var fnExpr = node; + var fnName; + if (fnExpr.name && ts.getFullWidth(fnExpr.name) > 0) { + fnName = ts.declarationNameToString(fnExpr.name); + } + else { + if (fnExpr.parent.kind === 218) { + fnName = ts.declarationNameToString(fnExpr.parent.name); + } + else if (fnExpr.parent.kind === 187 && + fnExpr.parent.operatorToken.kind === 56) { + fnName = fnExpr.parent.left.getText(); + } + else if (fnExpr.parent.kind === 253 && + fnExpr.parent.name) { + fnName = fnExpr.parent.name.getText(); + } + else { + fnName = node.kind === 192 ? anonClassText : anonFnText; + } + } + var scriptKind = node.kind === 192 ? ts.ScriptElementKind.classElement : ts.ScriptElementKind.functionElement; + return getNavBarItem(fnName, scriptKind, [getNodeSpan(node)]); + } + function getNodeSpan(node) { + return node.kind === 256 + ? ts.createTextSpanFromBounds(node.getFullStart(), node.getEnd()) + : ts.createTextSpanFromBounds(node.getStart(), node.getEnd()); + } + function getScriptKindForElementKind(kind) { + switch (kind) { + case 218: + return ts.ScriptElementKind.variableElement; + case 220: + return ts.ScriptElementKind.functionElement; + case 221: + return ts.ScriptElementKind.classElement; + case 148: + return ts.ScriptElementKind.constructorImplementationElement; + case 149: + return ts.ScriptElementKind.memberGetAccessorElement; + case 150: + return ts.ScriptElementKind.memberSetAccessorElement; + default: + return "unknown"; + } + } + return sourceFileItem.childItems; + } + NavigationBar.getJsNavigationBarItems = getJsNavigationBarItems; })(NavigationBar = ts.NavigationBar || (ts.NavigationBar = {})); })(ts || (ts = {})); var ts; @@ -33396,7 +38269,6 @@ var ts; function createPatternMatcher(pattern) { var stringToWordSpans = {}; pattern = pattern.trim(); - var fullPatternSegment = createSegment(pattern); var dotSeparatedSegments = pattern.split(".").map(function (p) { return createSegment(p.trim()); }); var invalidPattern = dotSeparatedSegments.length === 0 || ts.forEach(dotSeparatedSegments, segmentIsInvalid); return { @@ -33426,7 +38298,7 @@ var ts; return undefined; } var totalMatch = candidateMatch; - for (var i = dotSeparatedSegments.length - 2, j = candidateContainers.length - 1; i >= 0; i--, j--) { + for (var i = dotSeparatedSegments.length - 2, j = candidateContainers.length - 1; i >= 0; i -= 1, j -= 1) { var segment = dotSeparatedSegments[i]; var containerName = candidateContainers[j]; var containerMatch = matchSegment(containerName, segment); @@ -33593,33 +38465,6 @@ var ts; } } ts.createPatternMatcher = createPatternMatcher; - function patternMatchCompareTo(match1, match2) { - return compareType(match1, match2) || - compareCamelCase(match1, match2) || - compareCase(match1, match2) || - comparePunctuation(match1, match2); - } - function comparePunctuation(result1, result2) { - if (result1.punctuationStripped !== result2.punctuationStripped) { - return result1.punctuationStripped ? 1 : -1; - } - return 0; - } - function compareCase(result1, result2) { - if (result1.isCaseSensitive !== result2.isCaseSensitive) { - return result1.isCaseSensitive ? -1 : 1; - } - return 0; - } - function compareType(result1, result2) { - return result1.kind - result2.kind; - } - function compareCamelCase(result1, result2) { - if (result1.kind === PatternMatchKind.camelCase && result2.kind === PatternMatchKind.camelCase) { - return result2.camelCaseWeight - result1.camelCaseWeight; - } - return 0; - } function createSegment(text) { return { totalTextChunk: createTextChunk(text), @@ -33649,14 +38494,6 @@ var ts; var str = String.fromCharCode(ch); return str === str.toLowerCase(); } - function containsUpperCaseLetter(string) { - for (var i = 0, n = string.length; i < n; i++) { - if (isUpperCaseLetter(string.charCodeAt(i))) { - return true; - } - } - return false; - } function startsWith(string, search) { for (var i = 0, n = search.length; i < n; i++) { if (string.charCodeAt(i) !== search.charCodeAt(i)) { @@ -33705,9 +38542,10 @@ var ts; for (var i = 0; i < pattern.length; i++) { var ch = pattern.charCodeAt(i); if (isWordChar(ch)) { - if (wordLength++ === 0) { + if (wordLength === 0) { wordStart = i; } + wordLength++; } else { if (wordLength > 0) { @@ -33855,14 +38693,14 @@ var ts; } return createSignatureHelpItems(candidates, resolvedSignature, argumentInfo); function createJavaScriptSignatureHelpItems(argumentInfo) { - if (argumentInfo.invocation.kind !== 168) { + if (argumentInfo.invocation.kind !== 174) { return undefined; } var callExpression = argumentInfo.invocation; var expression = callExpression.expression; var name = expression.kind === 69 ? expression - : expression.kind === 166 + : expression.kind === 172 ? expression.name : undefined; if (!name || !name.text) { @@ -33874,8 +38712,8 @@ var ts; var nameToDeclarations = sourceFile_1.getNamedDeclarations(); var declarations = ts.getProperty(nameToDeclarations, name.text); if (declarations) { - for (var _b = 0, declarations_7 = declarations; _b < declarations_7.length; _b++) { - var declaration = declarations_7[_b]; + for (var _b = 0, declarations_8 = declarations; _b < declarations_8.length; _b++) { + var declaration = declarations_8[_b]; var symbol = declaration.symbol; if (symbol) { var type = typeChecker.getTypeOfSymbolAtLocation(symbol, declaration); @@ -33891,7 +38729,7 @@ var ts; } } function getImmediatelyContainingArgumentInfo(node) { - if (node.parent.kind === 168 || node.parent.kind === 169) { + if (node.parent.kind === 174 || node.parent.kind === 175) { var callExpression = node.parent; if (node.kind === 25 || node.kind === 17) { @@ -33922,23 +38760,23 @@ var ts; }; } } - else if (node.kind === 11 && node.parent.kind === 170) { + else if (node.kind === 11 && node.parent.kind === 176) { if (ts.isInsideTemplateLiteral(node, position)) { return getArgumentListInfoForTemplate(node.parent, 0); } } - else if (node.kind === 12 && node.parent.parent.kind === 170) { + else if (node.kind === 12 && node.parent.parent.kind === 176) { var templateExpression = node.parent; var tagExpression = templateExpression.parent; - ts.Debug.assert(templateExpression.kind === 183); + ts.Debug.assert(templateExpression.kind === 189); var argumentIndex = ts.isInsideTemplateLiteral(node, position) ? 0 : 1; return getArgumentListInfoForTemplate(tagExpression, argumentIndex); } - else if (node.parent.kind === 190 && node.parent.parent.parent.kind === 170) { + else if (node.parent.kind === 197 && node.parent.parent.parent.kind === 176) { var templateSpan = node.parent; var templateExpression = templateSpan.parent; var tagExpression = templateExpression.parent; - ts.Debug.assert(templateExpression.kind === 183); + ts.Debug.assert(templateExpression.kind === 189); if (node.kind === 14 && !ts.isInsideTemplateLiteral(node, position)) { return undefined; } @@ -34002,7 +38840,7 @@ var ts; var template = taggedTemplate.template; var applicableSpanStart = template.getStart(); var applicableSpanEnd = template.getEnd(); - if (template.kind === 183) { + if (template.kind === 189) { var lastSpan = ts.lastOrUndefined(template.templateSpans); if (lastSpan.literal.getFullWidth() === 0) { applicableSpanEnd = ts.skipTrivia(sourceFile.text, applicableSpanEnd, false); @@ -34011,7 +38849,7 @@ var ts; return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart); } function getContainingArgumentInfo(node) { - for (var n = node; n.kind !== 248; n = n.parent) { + for (var n = node; n.kind !== 256; n = n.parent) { if (ts.isFunctionBlock(n)) { return undefined; } @@ -34066,7 +38904,7 @@ var ts; signatureHelpParameters = typeParameters && typeParameters.length > 0 ? ts.map(typeParameters, createSignatureHelpParameterForTypeParameter) : emptyArray; suffixDisplayParts.push(ts.punctuationPart(27)); var parameterParts = ts.mapToDisplayParts(function (writer) { - return typeChecker.getSymbolDisplayBuilder().buildDisplayForParametersAndDelimiters(candidateSignature.parameters, writer, invocation); + return typeChecker.getSymbolDisplayBuilder().buildDisplayForParametersAndDelimiters(candidateSignature.thisType, candidateSignature.parameters, writer, invocation); }); ts.addRange(suffixDisplayParts, parameterParts); } @@ -34136,24 +38974,6 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { - function getEndLinePosition(line, sourceFile) { - ts.Debug.assert(line >= 0); - var lineStarts = sourceFile.getLineStarts(); - var lineIndex = line; - if (lineIndex + 1 === lineStarts.length) { - return sourceFile.text.length - 1; - } - else { - var start = lineStarts[lineIndex]; - var pos = lineStarts[lineIndex + 1] - 1; - ts.Debug.assert(ts.isLineBreak(sourceFile.text.charCodeAt(pos))); - while (start <= pos && ts.isLineBreak(sourceFile.text.charCodeAt(pos))) { - pos--; - } - return pos; - } - } - ts.getEndLinePosition = getEndLinePosition; function getLineStartPositionForPosition(position, sourceFile) { var lineStarts = sourceFile.getLineStarts(); var line = sourceFile.getLineAndCharacterOfPosition(position).line; @@ -34191,39 +39011,39 @@ var ts; return false; } switch (n.kind) { - case 214: - case 215: - case 217: - case 165: - case 161: - case 155: - case 192: - case 219: - case 220: + case 221: + case 222: + case 224: + case 171: + case 167: + case 159: + case 199: + case 226: + case 227: return nodeEndsWith(n, 16, sourceFile); - case 244: + case 252: return isCompletedNode(n.block, sourceFile); - case 169: + case 175: if (!n.arguments) { return true; } - case 168: - case 172: - case 160: - return nodeEndsWith(n, 18, sourceFile); - case 152: - case 153: - return isCompletedNode(n.type, sourceFile); - case 144: - case 145: - case 146: - case 213: - case 173: - case 143: - case 142: - case 148: - case 147: case 174: + case 178: + case 164: + return nodeEndsWith(n, 18, sourceFile); + case 156: + case 157: + return isCompletedNode(n.type, sourceFile); + case 148: + case 149: + case 150: + case 220: + case 179: + case 147: + case 146: + case 152: + case 151: + case 180: if (n.body) { return isCompletedNode(n.body, sourceFile); } @@ -34231,62 +39051,62 @@ var ts; return isCompletedNode(n.type, sourceFile); } return hasChildOfKind(n, 18, sourceFile); - case 218: + case 225: return n.body && isCompletedNode(n.body, sourceFile); - case 196: + case 203: if (n.elseStatement) { return isCompletedNode(n.elseStatement, sourceFile); } return isCompletedNode(n.thenStatement, sourceFile); - case 195: + case 202: return isCompletedNode(n.expression, sourceFile) || hasChildOfKind(n, 23); - case 164: - case 162: - case 167: - case 136: - case 157: + case 170: + case 168: + case 173: + case 140: + case 161: return nodeEndsWith(n, 20, sourceFile); - case 149: + case 153: if (n.type) { return isCompletedNode(n.type, sourceFile); } return hasChildOfKind(n, 20, sourceFile); - case 241: - case 242: + case 249: + case 250: return false; - case 199: - case 200: - case 201: - case 198: + case 206: + case 207: + case 208: + case 205: return isCompletedNode(n.statement, sourceFile); - case 197: + case 204: var hasWhileKeyword = findChildOfKind(n, 104, sourceFile); if (hasWhileKeyword) { return nodeEndsWith(n, 18, sourceFile); } return isCompletedNode(n.statement, sourceFile); - case 154: + case 158: return isCompletedNode(n.exprName, sourceFile); - case 176: - case 175: - case 177: - case 184: - case 185: + case 182: + case 181: + case 183: + case 190: + case 191: var unaryWordExpression = n; return isCompletedNode(unaryWordExpression.expression, sourceFile); - case 170: + case 176: return isCompletedNode(n.template, sourceFile); - case 183: + case 189: var lastSpan = ts.lastOrUndefined(n.templateSpans); return isCompletedNode(lastSpan, sourceFile); - case 190: + case 197: return ts.nodeIsPresent(n.literal); - case 179: + case 185: return isCompletedNode(n.operand, sourceFile); - case 181: + case 187: return isCompletedNode(n.right, sourceFile); - case 182: + case 188: return isCompletedNode(n.whenFalse, sourceFile); default: return true; @@ -34329,7 +39149,7 @@ var ts; ts.findChildOfKind = findChildOfKind; function findContainingList(node) { var syntaxList = ts.forEach(node.parent.getChildren(), function (c) { - if (c.kind === 271 && c.pos <= node.pos && c.end >= node.end) { + if (c.kind === 279 && c.pos <= node.pos && c.end >= node.end) { return c; } }); @@ -34409,7 +39229,7 @@ var ts; function findPrecedingToken(position, sourceFile, startNode) { return find(startNode || sourceFile); function findRightmostToken(n) { - if (isToken(n) || n.kind === 236) { + if (isToken(n) || n.kind === 244) { return n; } var children = n.getChildren(); @@ -34417,16 +39237,16 @@ var ts; return candidate && findRightmostToken(candidate); } function find(n) { - if (isToken(n) || n.kind === 236) { + if (isToken(n) || n.kind === 244) { return n; } var children = n.getChildren(); for (var i = 0, len = children.length; i < len; i++) { var child = children[i]; - if (position < child.end && (nodeHasTokens(child) || child.kind === 236)) { + if (position < child.end && (nodeHasTokens(child) || child.kind === 244)) { var start = child.getStart(sourceFile); var lookInPreviousChild = (start >= position) || - (child.kind === 236 && start === child.end); + (child.kind === 244 && start === child.end); if (lookInPreviousChild) { var candidate = findRightmostChildNodeWithTokens(children, i); return candidate && findRightmostToken(candidate); @@ -34436,7 +39256,7 @@ var ts; } } } - ts.Debug.assert(startNode !== undefined || n.kind === 248); + ts.Debug.assert(startNode !== undefined || n.kind === 256); if (children.length) { var candidate = findRightmostChildNodeWithTokens(children, children.length); return candidate && findRightmostToken(candidate); @@ -34453,16 +39273,41 @@ var ts; ts.findPrecedingToken = findPrecedingToken; function isInString(sourceFile, position) { var token = getTokenAtPosition(sourceFile, position); - return token && token.kind === 9 && position > token.getStart(); + return token && (token.kind === 9 || token.kind === 166) && position > token.getStart(sourceFile); } ts.isInString = isInString; function isInComment(sourceFile, position) { return isInCommentHelper(sourceFile, position, undefined); } ts.isInComment = isInComment; + function isInsideJsxElementOrAttribute(sourceFile, position) { + var token = getTokenAtPosition(sourceFile, position); + if (!token) { + return false; + } + if (token.kind === 25 && token.parent.kind === 244) { + return true; + } + if (token.kind === 25 && token.parent.kind === 248) { + return true; + } + if (token && token.kind === 16 && token.parent.kind === 248) { + return true; + } + if (token.kind === 25 && token.parent.kind === 245) { + return true; + } + return false; + } + ts.isInsideJsxElementOrAttribute = isInsideJsxElementOrAttribute; + function isInTemplateString(sourceFile, position) { + var token = getTokenAtPosition(sourceFile, position); + return ts.isTemplateLiteralKind(token.kind) && position > token.getStart(sourceFile); + } + ts.isInTemplateString = isInTemplateString; function isInCommentHelper(sourceFile, position, predicate) { var token = getTokenAtPosition(sourceFile, position); - if (token && position <= token.getStart()) { + if (token && position <= token.getStart(sourceFile)) { var commentRanges = ts.getLeadingCommentRanges(sourceFile.text, token.pos); return predicate ? ts.forEach(commentRanges, function (c) { return c.pos < position && @@ -34480,7 +39325,7 @@ var ts; return ts.forEach(commentRanges, jsDocPrefix); function jsDocPrefix(c) { var text = sourceFile.text; - return text.length >= c.pos + 3 && text[c.pos] === '/' && text[c.pos + 1] === '*' && text[c.pos + 2] === '*'; + return text.length >= c.pos + 3 && text[c.pos] === "/" && text[c.pos + 1] === "*" && text[c.pos + 2] === "*"; } } ts.hasDocComment = hasDocComment; @@ -34518,35 +39363,35 @@ var ts; function getNodeModifiers(node) { var flags = ts.getCombinedNodeFlags(node); var result = []; - if (flags & 16) - result.push(ts.ScriptElementKindModifier.privateMemberModifier); - if (flags & 32) - result.push(ts.ScriptElementKindModifier.protectedMemberModifier); if (flags & 8) + result.push(ts.ScriptElementKindModifier.privateMemberModifier); + if (flags & 16) + result.push(ts.ScriptElementKindModifier.protectedMemberModifier); + if (flags & 4) result.push(ts.ScriptElementKindModifier.publicMemberModifier); - if (flags & 64) + if (flags & 32) result.push(ts.ScriptElementKindModifier.staticModifier); if (flags & 128) result.push(ts.ScriptElementKindModifier.abstractModifier); - if (flags & 2) + if (flags & 1) result.push(ts.ScriptElementKindModifier.exportedModifier); if (ts.isInAmbientContext(node)) result.push(ts.ScriptElementKindModifier.ambientModifier); - return result.length > 0 ? result.join(',') : ts.ScriptElementKindModifier.none; + return result.length > 0 ? result.join(",") : ts.ScriptElementKindModifier.none; } ts.getNodeModifiers = getNodeModifiers; function getTypeArgumentOrTypeParameterList(node) { - if (node.kind === 151 || node.kind === 168) { + if (node.kind === 155 || node.kind === 174) { return node.typeArguments; } - if (ts.isFunctionLike(node) || node.kind === 214 || node.kind === 215) { + if (ts.isFunctionLike(node) || node.kind === 221 || node.kind === 222) { return node.typeParameters; } return undefined; } ts.getTypeArgumentOrTypeParameterList = getTypeArgumentOrTypeParameterList; function isToken(n) { - return n.kind >= 0 && n.kind <= 134; + return n.kind >= 0 && n.kind <= 138; } ts.isToken = isToken; function isWord(kind) { @@ -34562,6 +39407,7 @@ var ts; ts.isComment = isComment; function isStringOrRegularExpressionOrTemplateLiteral(kind) { if (kind === 9 + || kind === 166 || kind === 10 || ts.isTemplateLiteralKind(kind)) { return true; @@ -34604,11 +39450,30 @@ var ts; return true; } ts.compareDataObjects = compareDataObjects; + function isArrayLiteralOrObjectLiteralDestructuringPattern(node) { + if (node.kind === 170 || + node.kind === 171) { + if (node.parent.kind === 187 && + node.parent.left === node && + node.parent.operatorToken.kind === 56) { + return true; + } + if (node.parent.kind === 208 && + node.parent.initializer === node) { + return true; + } + if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 253 ? node.parent.parent : node.parent)) { + return true; + } + } + return false; + } + ts.isArrayLiteralOrObjectLiteralDestructuringPattern = isArrayLiteralOrObjectLiteralDestructuringPattern; })(ts || (ts = {})); var ts; (function (ts) { function isFirstDeclarationOfSymbolParameter(symbol) { - return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 138; + return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 142; } ts.isFirstDeclarationOfSymbolParameter = isFirstDeclarationOfSymbolParameter; var displayPartWriter = getDisplayPartWriter(); @@ -34782,6 +39647,10 @@ var ts; if (isImportOrExportSpecifierName(location)) { return location.getText(); } + else if (ts.isStringOrNumericLiteral(location.kind) && + location.parent.kind === 140) { + return location.text; + } var localExportDefaultSymbol = ts.getLocalSymbolForExportDefault(symbol); var name = typeChecker.symbolToString(localExportDefaultSymbol || symbol); return name; @@ -34789,7 +39658,7 @@ var ts; ts.getDeclaredName = getDeclaredName; function isImportOrExportSpecifierName(location) { return location.parent && - (location.parent.kind === 226 || location.parent.kind === 230) && + (location.parent.kind === 234 || location.parent.kind === 238) && location.parent.propertyName === location; } ts.isImportOrExportSpecifierName = isImportOrExportSpecifierName; @@ -34804,6 +39673,172 @@ var ts; return name; } ts.stripQuotes = stripQuotes; + function scriptKindIs(fileName, host) { + var scriptKinds = []; + for (var _i = 2; _i < arguments.length; _i++) { + scriptKinds[_i - 2] = arguments[_i]; + } + var scriptKind = getScriptKind(fileName, host); + return ts.forEach(scriptKinds, function (k) { return k === scriptKind; }); + } + ts.scriptKindIs = scriptKindIs; + function getScriptKind(fileName, host) { + var scriptKind; + if (host && host.getScriptKind) { + scriptKind = host.getScriptKind(fileName); + } + if (!scriptKind || scriptKind === 0) { + scriptKind = ts.getScriptKindFromFileName(fileName); + } + return ts.ensureScriptKind(fileName, scriptKind); + } + ts.getScriptKind = getScriptKind; +})(ts || (ts = {})); +var ts; +(function (ts) { + var JsTyping; + (function (JsTyping) { + ; + ; + var safeList; + function discoverTypings(host, fileNames, projectRootPath, safeListPath, packageNameToTypingLocation, typingOptions, compilerOptions) { + var inferredTypings = {}; + if (!typingOptions || !typingOptions.enableAutoDiscovery) { + return { cachedTypingPaths: [], newTypingNames: [], filesToWatch: [] }; + } + fileNames = ts.filter(ts.map(fileNames, ts.normalizePath), function (f) { return ts.scriptKindIs(f, undefined, 1, 2); }); + if (!safeList) { + var result = ts.readConfigFile(safeListPath, function (path) { return host.readFile(path); }); + if (result.config) { + safeList = result.config; + } + else { + safeList = {}; + } + ; + } + var filesToWatch = []; + var searchDirs = []; + var exclude = []; + mergeTypings(typingOptions.include); + exclude = typingOptions.exclude || []; + var possibleSearchDirs = ts.map(fileNames, ts.getDirectoryPath); + if (projectRootPath !== undefined) { + possibleSearchDirs.push(projectRootPath); + } + searchDirs = ts.deduplicate(possibleSearchDirs); + for (var _i = 0, searchDirs_1 = searchDirs; _i < searchDirs_1.length; _i++) { + var searchDir = searchDirs_1[_i]; + var packageJsonPath = ts.combinePaths(searchDir, "package.json"); + getTypingNamesFromJson(packageJsonPath, filesToWatch); + var bowerJsonPath = ts.combinePaths(searchDir, "bower.json"); + getTypingNamesFromJson(bowerJsonPath, filesToWatch); + var nodeModulesPath = ts.combinePaths(searchDir, "node_modules"); + getTypingNamesFromNodeModuleFolder(nodeModulesPath); + } + getTypingNamesFromSourceFileNames(fileNames); + for (var name_37 in packageNameToTypingLocation) { + if (ts.hasProperty(inferredTypings, name_37) && !inferredTypings[name_37]) { + inferredTypings[name_37] = packageNameToTypingLocation[name_37]; + } + } + for (var _a = 0, exclude_1 = exclude; _a < exclude_1.length; _a++) { + var excludeTypingName = exclude_1[_a]; + delete inferredTypings[excludeTypingName]; + } + var newTypingNames = []; + var cachedTypingPaths = []; + for (var typing in inferredTypings) { + if (inferredTypings[typing] !== undefined) { + cachedTypingPaths.push(inferredTypings[typing]); + } + else { + newTypingNames.push(typing); + } + } + return { cachedTypingPaths: cachedTypingPaths, newTypingNames: newTypingNames, filesToWatch: filesToWatch }; + function mergeTypings(typingNames) { + if (!typingNames) { + return; + } + for (var _i = 0, typingNames_1 = typingNames; _i < typingNames_1.length; _i++) { + var typing = typingNames_1[_i]; + if (!ts.hasProperty(inferredTypings, typing)) { + inferredTypings[typing] = undefined; + } + } + } + function getTypingNamesFromJson(jsonPath, filesToWatch) { + var result = ts.readConfigFile(jsonPath, function (path) { return host.readFile(path); }); + if (result.config) { + var jsonConfig = result.config; + filesToWatch.push(jsonPath); + if (jsonConfig.dependencies) { + mergeTypings(ts.getKeys(jsonConfig.dependencies)); + } + if (jsonConfig.devDependencies) { + mergeTypings(ts.getKeys(jsonConfig.devDependencies)); + } + if (jsonConfig.optionalDependencies) { + mergeTypings(ts.getKeys(jsonConfig.optionalDependencies)); + } + if (jsonConfig.peerDependencies) { + mergeTypings(ts.getKeys(jsonConfig.peerDependencies)); + } + } + } + function getTypingNamesFromSourceFileNames(fileNames) { + var jsFileNames = ts.filter(fileNames, ts.hasJavaScriptFileExtension); + var inferredTypingNames = ts.map(jsFileNames, function (f) { return ts.removeFileExtension(ts.getBaseFileName(f.toLowerCase())); }); + var cleanedTypingNames = ts.map(inferredTypingNames, function (f) { return f.replace(/((?:\.|-)min(?=\.|$))|((?:-|\.)\d+)/g, ""); }); + if (safeList === undefined) { + mergeTypings(cleanedTypingNames); + } + else { + mergeTypings(ts.filter(cleanedTypingNames, function (f) { return ts.hasProperty(safeList, f); })); + } + var hasJsxFile = ts.forEach(fileNames, function (f) { return ts.scriptKindIs(f, undefined, 2); }); + if (hasJsxFile) { + mergeTypings(["react"]); + } + } + function getTypingNamesFromNodeModuleFolder(nodeModulesPath) { + if (!host.directoryExists(nodeModulesPath)) { + return; + } + var typingNames = []; + var fileNames = host.readDirectory(nodeModulesPath, "*.json", undefined, 2); + for (var _i = 0, fileNames_1 = fileNames; _i < fileNames_1.length; _i++) { + var fileName = fileNames_1[_i]; + var normalizedFileName = ts.normalizePath(fileName); + if (ts.getBaseFileName(normalizedFileName) !== "package.json") { + continue; + } + var result = ts.readConfigFile(normalizedFileName, function (path) { return host.readFile(path); }); + if (!result.config) { + continue; + } + var packageJson = result.config; + if (packageJson._requiredBy && + ts.filter(packageJson._requiredBy, function (r) { return r[0] === "#" || r === "/"; }).length === 0) { + continue; + } + if (!packageJson.name) { + continue; + } + if (packageJson.typings) { + var absolutePath = ts.getNormalizedAbsolutePath(packageJson.typings, ts.getDirectoryPath(normalizedFileName)); + inferredTypings[packageJson.name] = absolutePath; + } + else { + typingNames.push(packageJson.name); + } + } + mergeTypings(typingNames); + } + } + JsTyping.discoverTypings = discoverTypings; + })(JsTyping = ts.JsTyping || (ts.JsTyping = {})); })(ts || (ts = {})); var ts; (function (ts) { @@ -34827,6 +39862,7 @@ var ts; advance: advance, readTokenInfo: readTokenInfo, isOnToken: isOnToken, + getCurrentLeadingTrivia: function () { return leadingTrivia; }, lastTrailingTriviaWasNewLine: function () { return wasNewLine; }, close: function () { ts.Debug.assert(scanner !== undefined); @@ -34890,10 +39926,10 @@ var ts; function shouldRescanJsxIdentifier(node) { if (node.parent) { switch (node.parent.kind) { - case 238: - case 235: - case 237: - case 234: + case 246: + case 243: + case 245: + case 242: return node.kind === 69; } } @@ -35081,7 +40117,7 @@ var ts; return false; }; return FormattingContext; - })(); + }()); formatting.FormattingContext = FormattingContext; })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); @@ -35102,7 +40138,7 @@ var ts; "flag=" + this.Flag + "]"; }; return Rule; - })(); + }()); formatting.Rule = Rule; })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); @@ -35132,7 +40168,7 @@ var ts; return new RuleDescriptor(left, right); }; return RuleDescriptor; - })(); + }()); formatting.RuleDescriptor = RuleDescriptor; })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); @@ -35159,7 +40195,7 @@ var ts; return result; }; return RuleOperation; - })(); + }()); formatting.RuleOperation = RuleOperation; })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); @@ -35192,7 +40228,7 @@ var ts; }; RuleOperationContext.Any = new RuleOperationContext(); return RuleOperationContext; - })(); + }()); formatting.RuleOperationContext = RuleOperationContext; })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); @@ -35204,21 +40240,21 @@ var ts; function Rules() { this.IgnoreBeforeComment = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.Comments), formatting.RuleOperation.create1(1)); this.IgnoreAfterLineComment = new formatting.Rule(formatting.RuleDescriptor.create3(2, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create1(1)); - this.NoSpaceBeforeSemicolon = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 23), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.NoSpaceBeforeColon = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 54), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8)); - this.NoSpaceBeforeQuestionMark = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 53), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8)); - this.SpaceAfterColon = new formatting.Rule(formatting.RuleDescriptor.create3(54, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 2)); - this.SpaceAfterQuestionMarkInConditionalOperator = new formatting.Rule(formatting.RuleDescriptor.create3(53, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsConditionalOperatorContext), 2)); - this.NoSpaceAfterQuestionMark = new formatting.Rule(formatting.RuleDescriptor.create3(53, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.SpaceAfterSemicolon = new formatting.Rule(formatting.RuleDescriptor.create3(23, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); - this.SpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(16, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsAfterCodeBlockContext), 2)); - this.SpaceBetweenCloseBraceAndElse = new formatting.Rule(formatting.RuleDescriptor.create1(16, 80), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); - this.SpaceBetweenCloseBraceAndWhile = new formatting.Rule(formatting.RuleDescriptor.create1(16, 104), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); - this.NoSpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(16, formatting.Shared.TokenRange.FromTokens([18, 20, 24, 23])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.NoSpaceBeforeDot = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 21), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.NoSpaceAfterDot = new formatting.Rule(formatting.RuleDescriptor.create3(21, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.NoSpaceBeforeOpenBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 19), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.NoSpaceAfterCloseBracket = new formatting.Rule(formatting.RuleDescriptor.create3(20, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBeforeBlockInFunctionDeclarationContext), 8)); + this.NoSpaceBeforeSemicolon = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 23), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); + this.NoSpaceBeforeColon = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 54), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotBinaryOpContext), 8)); + this.NoSpaceBeforeQuestionMark = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 53), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotBinaryOpContext), 8)); + this.SpaceAfterColon = new formatting.Rule(formatting.RuleDescriptor.create3(54, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotBinaryOpContext), 2)); + this.SpaceAfterQuestionMarkInConditionalOperator = new formatting.Rule(formatting.RuleDescriptor.create3(53, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsConditionalOperatorContext), 2)); + this.NoSpaceAfterQuestionMark = new formatting.Rule(formatting.RuleDescriptor.create3(53, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); + this.SpaceAfterSemicolon = new formatting.Rule(formatting.RuleDescriptor.create3(23, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); + this.SpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(16, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsAfterCodeBlockContext), 2)); + this.SpaceBetweenCloseBraceAndElse = new formatting.Rule(formatting.RuleDescriptor.create1(16, 80), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); + this.SpaceBetweenCloseBraceAndWhile = new formatting.Rule(formatting.RuleDescriptor.create1(16, 104), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); + this.NoSpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(16, formatting.Shared.TokenRange.FromTokens([18, 20, 24, 23])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); + this.NoSpaceBeforeDot = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 21), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); + this.NoSpaceAfterDot = new formatting.Rule(formatting.RuleDescriptor.create3(21, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); + this.NoSpaceBeforeOpenBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 19), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); + this.NoSpaceAfterCloseBracket = new formatting.Rule(formatting.RuleDescriptor.create3(20, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotBeforeBlockInFunctionDeclarationContext), 8)); this.FunctionOpenBraceLeftTokenRange = formatting.Shared.TokenRange.AnyIncludingMultilineComments; this.SpaceBeforeOpenBraceInFunction = new formatting.Rule(formatting.RuleDescriptor.create2(this.FunctionOpenBraceLeftTokenRange, 15), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext, Rules.IsBeforeBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2), 1); this.TypeScriptOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([69, 3, 73]); @@ -35227,178 +40263,179 @@ var ts; this.SpaceBeforeOpenBraceInControl = new formatting.Rule(formatting.RuleDescriptor.create2(this.ControlOpenBraceLeftTokenRange, 15), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2), 1); this.SpaceAfterOpenBrace = new formatting.Rule(formatting.RuleDescriptor.create3(15, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 2)); this.SpaceBeforeCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 2)); - this.NoSpaceBetweenEmptyBraceBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(15, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsObjectContext), 8)); + this.NoSpaceBetweenEmptyBraceBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(15, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsObjectContext), 8)); this.NewLineAfterOpenBraceInBlockContext = new formatting.Rule(formatting.RuleDescriptor.create3(15, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsMultilineBlockContext), 4)); this.NewLineBeforeCloseBraceInBlockContext = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.AnyIncludingMultilineComments, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsMultilineBlockContext), 4)); - this.NoSpaceAfterUnaryPrefixOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.UnaryPrefixOperators, formatting.Shared.TokenRange.UnaryPrefixExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8)); - this.NoSpaceAfterUnaryPreincrementOperator = new formatting.Rule(formatting.RuleDescriptor.create3(41, formatting.Shared.TokenRange.UnaryPreincrementExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.NoSpaceAfterUnaryPredecrementOperator = new formatting.Rule(formatting.RuleDescriptor.create3(42, formatting.Shared.TokenRange.UnaryPredecrementExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.NoSpaceBeforeUnaryPostincrementOperator = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.UnaryPostincrementExpressions, 41), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.NoSpaceBeforeUnaryPostdecrementOperator = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.UnaryPostdecrementExpressions, 42), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.SpaceAfterPostincrementWhenFollowedByAdd = new formatting.Rule(formatting.RuleDescriptor.create1(41, 35), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); - this.SpaceAfterAddWhenFollowedByUnaryPlus = new formatting.Rule(formatting.RuleDescriptor.create1(35, 35), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); - this.SpaceAfterAddWhenFollowedByPreincrement = new formatting.Rule(formatting.RuleDescriptor.create1(35, 41), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); - this.SpaceAfterPostdecrementWhenFollowedBySubtract = new formatting.Rule(formatting.RuleDescriptor.create1(42, 36), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); - this.SpaceAfterSubtractWhenFollowedByUnaryMinus = new formatting.Rule(formatting.RuleDescriptor.create1(36, 36), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); - this.SpaceAfterSubtractWhenFollowedByPredecrement = new formatting.Rule(formatting.RuleDescriptor.create1(36, 42), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); - this.NoSpaceBeforeComma = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 24), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.SpaceAfterCertainKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([102, 98, 92, 78, 94, 101, 119]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); - this.SpaceAfterLetConstInVariableDeclaration = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([108, 74]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsStartOfVariableDeclarationList), 2)); - this.NoSpaceBeforeOpenParenInFuncCall = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsFunctionCallOrNewContext, Rules.IsPreviousTokenNotComma), 8)); + this.NoSpaceAfterUnaryPrefixOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.UnaryPrefixOperators, formatting.Shared.TokenRange.UnaryPrefixExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotBinaryOpContext), 8)); + this.NoSpaceAfterUnaryPreincrementOperator = new formatting.Rule(formatting.RuleDescriptor.create3(41, formatting.Shared.TokenRange.UnaryPreincrementExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); + this.NoSpaceAfterUnaryPredecrementOperator = new formatting.Rule(formatting.RuleDescriptor.create3(42, formatting.Shared.TokenRange.UnaryPredecrementExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); + this.NoSpaceBeforeUnaryPostincrementOperator = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.UnaryPostincrementExpressions, 41), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); + this.NoSpaceBeforeUnaryPostdecrementOperator = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.UnaryPostdecrementExpressions, 42), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); + this.SpaceAfterPostincrementWhenFollowedByAdd = new formatting.Rule(formatting.RuleDescriptor.create1(41, 35), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2)); + this.SpaceAfterAddWhenFollowedByUnaryPlus = new formatting.Rule(formatting.RuleDescriptor.create1(35, 35), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2)); + this.SpaceAfterAddWhenFollowedByPreincrement = new formatting.Rule(formatting.RuleDescriptor.create1(35, 41), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2)); + this.SpaceAfterPostdecrementWhenFollowedBySubtract = new formatting.Rule(formatting.RuleDescriptor.create1(42, 36), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2)); + this.SpaceAfterSubtractWhenFollowedByUnaryMinus = new formatting.Rule(formatting.RuleDescriptor.create1(36, 36), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2)); + this.SpaceAfterSubtractWhenFollowedByPredecrement = new formatting.Rule(formatting.RuleDescriptor.create1(36, 42), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2)); + this.NoSpaceBeforeComma = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 24), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); + this.SpaceAfterCertainKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([102, 98, 92, 78, 94, 101, 119]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); + this.SpaceAfterLetConstInVariableDeclaration = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([108, 74]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsStartOfVariableDeclarationList), 2)); + this.NoSpaceBeforeOpenParenInFuncCall = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsFunctionCallOrNewContext, Rules.IsPreviousTokenNotComma), 8)); this.SpaceAfterFunctionInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create3(87, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2)); - this.NoSpaceBeforeOpenParenInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsFunctionDeclContext), 8)); - this.SpaceAfterVoidOperator = new formatting.Rule(formatting.RuleDescriptor.create3(103, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsVoidOpContext), 2)); - this.NoSpaceBetweenReturnAndSemicolon = new formatting.Rule(formatting.RuleDescriptor.create1(94, 23), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.SpaceBetweenStatements = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([18, 79, 80, 71]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotForContext), 2)); - this.SpaceAfterTryFinally = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([100, 85]), 15), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); - this.SpaceAfterGetSetInMember = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([123, 129]), 69), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2)); - this.SpaceBeforeBinaryKeywordOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.BinaryKeywordOperators), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); - this.SpaceAfterBinaryKeywordOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.BinaryKeywordOperators, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); - this.NoSpaceAfterConstructor = new formatting.Rule(formatting.RuleDescriptor.create1(121, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.NoSpaceAfterModuleImport = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([125, 127]), 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([115, 73, 122, 77, 81, 82, 83, 123, 106, 89, 107, 125, 126, 110, 112, 111, 129, 113, 132]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); - this.SpaceBeforeCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([83, 106])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.NoSpaceBeforeOpenParenInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsFunctionDeclContext), 8)); + this.SpaceAfterVoidOperator = new formatting.Rule(formatting.RuleDescriptor.create3(103, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsVoidOpContext), 2)); + this.NoSpaceBetweenReturnAndSemicolon = new formatting.Rule(formatting.RuleDescriptor.create1(94, 23), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); + this.SpaceBetweenStatements = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([18, 79, 80, 71]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotForContext), 2)); + this.SpaceAfterTryFinally = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([100, 85]), 15), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); + this.SpaceAfterGetSetInMember = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([123, 131]), 69), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2)); + this.SpaceBeforeBinaryKeywordOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.BinaryKeywordOperators), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2)); + this.SpaceAfterBinaryKeywordOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.BinaryKeywordOperators, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2)); + this.NoSpaceAfterConstructor = new formatting.Rule(formatting.RuleDescriptor.create1(121, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); + this.NoSpaceAfterModuleImport = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([125, 129]), 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); + this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([115, 73, 122, 77, 81, 82, 83, 123, 106, 89, 107, 125, 126, 110, 112, 111, 131, 113, 134]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); + this.SpaceBeforeCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([83, 106])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); this.SpaceAfterModuleName = new formatting.Rule(formatting.RuleDescriptor.create1(9, 15), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsModuleDeclContext), 2)); - this.SpaceAfterArrow = new formatting.Rule(formatting.RuleDescriptor.create3(34, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); - this.NoSpaceAfterEllipsis = new formatting.Rule(formatting.RuleDescriptor.create1(22, 69), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.NoSpaceAfterOptionalParameters = new formatting.Rule(formatting.RuleDescriptor.create3(53, formatting.Shared.TokenRange.FromTokens([18, 24])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8)); - this.NoSpaceBeforeOpenAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.TypeNames, 25), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8)); - this.NoSpaceBetweenCloseParenAndAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create1(18, 25), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8)); - this.NoSpaceAfterOpenAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create3(25, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8)); - this.NoSpaceBeforeCloseAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 27), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8)); - this.NoSpaceAfterCloseAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create3(27, formatting.Shared.TokenRange.FromTokens([17, 19, 27, 24])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8)); - this.NoSpaceAfterTypeAssertion = new formatting.Rule(formatting.RuleDescriptor.create3(27, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeAssertionContext), 8)); - this.NoSpaceBetweenEmptyInterfaceBraceBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(15, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsObjectTypeContext), 8)); - this.SpaceBeforeAt = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 55), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); - this.NoSpaceAfterAt = new formatting.Rule(formatting.RuleDescriptor.create3(55, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.SpaceAfterDecorator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([115, 69, 82, 77, 73, 113, 112, 110, 111, 123, 129, 19, 37])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsEndOfDecoratorContextOnSameLine), 2)); + this.SpaceBeforeArrow = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 34), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); + this.SpaceAfterArrow = new formatting.Rule(formatting.RuleDescriptor.create3(34, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); + this.NoSpaceAfterEllipsis = new formatting.Rule(formatting.RuleDescriptor.create1(22, 69), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); + this.NoSpaceAfterOptionalParameters = new formatting.Rule(formatting.RuleDescriptor.create3(53, formatting.Shared.TokenRange.FromTokens([18, 24])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotBinaryOpContext), 8)); + this.NoSpaceBeforeOpenAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.TypeNames, 25), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8)); + this.NoSpaceBetweenCloseParenAndAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create1(18, 25), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8)); + this.NoSpaceAfterOpenAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create3(25, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8)); + this.NoSpaceBeforeCloseAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 27), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8)); + this.NoSpaceAfterCloseAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create3(27, formatting.Shared.TokenRange.FromTokens([17, 19, 27, 24])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8)); + this.NoSpaceAfterTypeAssertion = new formatting.Rule(formatting.RuleDescriptor.create3(27, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeAssertionContext), 8)); + this.NoSpaceBetweenEmptyInterfaceBraceBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(15, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsObjectTypeContext), 8)); + this.SpaceBeforeAt = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 55), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); + this.NoSpaceAfterAt = new formatting.Rule(formatting.RuleDescriptor.create3(55, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); + this.SpaceAfterDecorator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([115, 69, 82, 77, 73, 113, 112, 110, 111, 123, 131, 19, 37])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsEndOfDecoratorContextOnSameLine), 2)); this.NoSpaceBetweenFunctionKeywordAndStar = new formatting.Rule(formatting.RuleDescriptor.create1(87, 37), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), 8)); this.SpaceAfterStarInGeneratorDeclaration = new formatting.Rule(formatting.RuleDescriptor.create3(37, formatting.Shared.TokenRange.FromTokens([69, 17])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), 2)); - this.NoSpaceBetweenYieldKeywordAndStar = new formatting.Rule(formatting.RuleDescriptor.create1(114, 37), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), 8)); - this.SpaceBetweenYieldOrYieldStarAndOperand = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([114, 37]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), 2)); - this.SpaceBetweenAsyncAndOpenParen = new formatting.Rule(formatting.RuleDescriptor.create1(118, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsArrowFunctionContext, Rules.IsSameLineTokenContext), 2)); - this.SpaceBetweenAsyncAndFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(118, 87), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); - this.SpaceBetweenTagAndTemplateString = new formatting.Rule(formatting.RuleDescriptor.create3(69, formatting.Shared.TokenRange.FromTokens([11, 12])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); - this.NoSpaceAfterTemplateHeadAndMiddle = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([12, 13]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.NoSpaceBeforeTemplateMiddleAndTail = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([13, 14])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.HighPriorityCommonRules = - [ - this.IgnoreBeforeComment, this.IgnoreAfterLineComment, - this.NoSpaceBeforeColon, this.SpaceAfterColon, this.NoSpaceBeforeQuestionMark, this.SpaceAfterQuestionMarkInConditionalOperator, - this.NoSpaceAfterQuestionMark, - this.NoSpaceBeforeDot, this.NoSpaceAfterDot, - this.NoSpaceAfterUnaryPrefixOperator, - this.NoSpaceAfterUnaryPreincrementOperator, this.NoSpaceAfterUnaryPredecrementOperator, - this.NoSpaceBeforeUnaryPostincrementOperator, this.NoSpaceBeforeUnaryPostdecrementOperator, - this.SpaceAfterPostincrementWhenFollowedByAdd, - this.SpaceAfterAddWhenFollowedByUnaryPlus, this.SpaceAfterAddWhenFollowedByPreincrement, - this.SpaceAfterPostdecrementWhenFollowedBySubtract, - this.SpaceAfterSubtractWhenFollowedByUnaryMinus, this.SpaceAfterSubtractWhenFollowedByPredecrement, - this.NoSpaceAfterCloseBrace, - this.SpaceAfterOpenBrace, this.SpaceBeforeCloseBrace, this.NewLineBeforeCloseBraceInBlockContext, - this.SpaceAfterCloseBrace, this.SpaceBetweenCloseBraceAndElse, this.SpaceBetweenCloseBraceAndWhile, this.NoSpaceBetweenEmptyBraceBrackets, - this.NoSpaceBetweenFunctionKeywordAndStar, this.SpaceAfterStarInGeneratorDeclaration, - this.SpaceAfterFunctionInFuncDecl, this.NewLineAfterOpenBraceInBlockContext, this.SpaceAfterGetSetInMember, - this.NoSpaceBetweenYieldKeywordAndStar, this.SpaceBetweenYieldOrYieldStarAndOperand, - this.NoSpaceBetweenReturnAndSemicolon, - this.SpaceAfterCertainKeywords, - this.SpaceAfterLetConstInVariableDeclaration, - this.NoSpaceBeforeOpenParenInFuncCall, - this.SpaceBeforeBinaryKeywordOperator, this.SpaceAfterBinaryKeywordOperator, - this.SpaceAfterVoidOperator, - this.SpaceBetweenAsyncAndOpenParen, this.SpaceBetweenAsyncAndFunctionKeyword, - this.SpaceBetweenTagAndTemplateString, this.NoSpaceAfterTemplateHeadAndMiddle, this.NoSpaceBeforeTemplateMiddleAndTail, - this.NoSpaceAfterConstructor, this.NoSpaceAfterModuleImport, - this.SpaceAfterCertainTypeScriptKeywords, this.SpaceBeforeCertainTypeScriptKeywords, - this.SpaceAfterModuleName, - this.SpaceAfterArrow, - this.NoSpaceAfterEllipsis, - this.NoSpaceAfterOptionalParameters, - this.NoSpaceBetweenEmptyInterfaceBraceBrackets, - this.NoSpaceBeforeOpenAngularBracket, - this.NoSpaceBetweenCloseParenAndAngularBracket, - this.NoSpaceAfterOpenAngularBracket, - this.NoSpaceBeforeCloseAngularBracket, - this.NoSpaceAfterCloseAngularBracket, - this.NoSpaceAfterTypeAssertion, - this.SpaceBeforeAt, - this.NoSpaceAfterAt, - this.SpaceAfterDecorator, - ]; - this.LowPriorityCommonRules = - [ - this.NoSpaceBeforeSemicolon, - this.SpaceBeforeOpenBraceInControl, this.SpaceBeforeOpenBraceInFunction, this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock, - this.NoSpaceBeforeComma, - this.NoSpaceBeforeOpenBracket, - this.NoSpaceAfterCloseBracket, - this.SpaceAfterSemicolon, - this.NoSpaceBeforeOpenParenInFuncDecl, - this.SpaceBetweenStatements, this.SpaceAfterTryFinally - ]; - this.SpaceAfterComma = new formatting.Rule(formatting.RuleDescriptor.create3(24, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); - this.NoSpaceAfterComma = new formatting.Rule(formatting.RuleDescriptor.create3(24, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.SpaceBeforeBinaryOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.BinaryOperators), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); - this.SpaceAfterBinaryOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.BinaryOperators, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); - this.NoSpaceBeforeBinaryOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.BinaryOperators), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 8)); - this.NoSpaceAfterBinaryOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.BinaryOperators, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 8)); + this.NoSpaceBetweenYieldKeywordAndStar = new formatting.Rule(formatting.RuleDescriptor.create1(114, 37), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), 8)); + this.SpaceBetweenYieldOrYieldStarAndOperand = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([114, 37]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), 2)); + this.SpaceBetweenAsyncAndOpenParen = new formatting.Rule(formatting.RuleDescriptor.create1(118, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsArrowFunctionContext, Rules.IsNonJsxSameLineTokenContext), 2)); + this.SpaceBetweenAsyncAndFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(118, 87), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); + this.NoSpaceBetweenTagAndTemplateString = new formatting.Rule(formatting.RuleDescriptor.create3(69, formatting.Shared.TokenRange.FromTokens([11, 12])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); + this.HighPriorityCommonRules = [ + this.IgnoreBeforeComment, this.IgnoreAfterLineComment, + this.NoSpaceBeforeColon, this.SpaceAfterColon, this.NoSpaceBeforeQuestionMark, this.SpaceAfterQuestionMarkInConditionalOperator, + this.NoSpaceAfterQuestionMark, + this.NoSpaceBeforeDot, this.NoSpaceAfterDot, + this.NoSpaceAfterUnaryPrefixOperator, + this.NoSpaceAfterUnaryPreincrementOperator, this.NoSpaceAfterUnaryPredecrementOperator, + this.NoSpaceBeforeUnaryPostincrementOperator, this.NoSpaceBeforeUnaryPostdecrementOperator, + this.SpaceAfterPostincrementWhenFollowedByAdd, + this.SpaceAfterAddWhenFollowedByUnaryPlus, this.SpaceAfterAddWhenFollowedByPreincrement, + this.SpaceAfterPostdecrementWhenFollowedBySubtract, + this.SpaceAfterSubtractWhenFollowedByUnaryMinus, this.SpaceAfterSubtractWhenFollowedByPredecrement, + this.NoSpaceAfterCloseBrace, + this.SpaceAfterOpenBrace, this.SpaceBeforeCloseBrace, this.NewLineBeforeCloseBraceInBlockContext, + this.SpaceAfterCloseBrace, this.SpaceBetweenCloseBraceAndElse, this.SpaceBetweenCloseBraceAndWhile, this.NoSpaceBetweenEmptyBraceBrackets, + this.NoSpaceBetweenFunctionKeywordAndStar, this.SpaceAfterStarInGeneratorDeclaration, + this.SpaceAfterFunctionInFuncDecl, this.NewLineAfterOpenBraceInBlockContext, this.SpaceAfterGetSetInMember, + this.NoSpaceBetweenYieldKeywordAndStar, this.SpaceBetweenYieldOrYieldStarAndOperand, + this.NoSpaceBetweenReturnAndSemicolon, + this.SpaceAfterCertainKeywords, + this.SpaceAfterLetConstInVariableDeclaration, + this.NoSpaceBeforeOpenParenInFuncCall, + this.SpaceBeforeBinaryKeywordOperator, this.SpaceAfterBinaryKeywordOperator, + this.SpaceAfterVoidOperator, + this.SpaceBetweenAsyncAndOpenParen, this.SpaceBetweenAsyncAndFunctionKeyword, + this.NoSpaceBetweenTagAndTemplateString, + this.NoSpaceAfterConstructor, this.NoSpaceAfterModuleImport, + this.SpaceAfterCertainTypeScriptKeywords, this.SpaceBeforeCertainTypeScriptKeywords, + this.SpaceAfterModuleName, + this.SpaceBeforeArrow, this.SpaceAfterArrow, + this.NoSpaceAfterEllipsis, + this.NoSpaceAfterOptionalParameters, + this.NoSpaceBetweenEmptyInterfaceBraceBrackets, + this.NoSpaceBeforeOpenAngularBracket, + this.NoSpaceBetweenCloseParenAndAngularBracket, + this.NoSpaceAfterOpenAngularBracket, + this.NoSpaceBeforeCloseAngularBracket, + this.NoSpaceAfterCloseAngularBracket, + this.NoSpaceAfterTypeAssertion, + this.SpaceBeforeAt, + this.NoSpaceAfterAt, + this.SpaceAfterDecorator, + ]; + this.LowPriorityCommonRules = [ + this.NoSpaceBeforeSemicolon, + this.SpaceBeforeOpenBraceInControl, this.SpaceBeforeOpenBraceInFunction, this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock, + this.NoSpaceBeforeComma, + this.NoSpaceBeforeOpenBracket, + this.NoSpaceAfterCloseBracket, + this.SpaceAfterSemicolon, + this.NoSpaceBeforeOpenParenInFuncDecl, + this.SpaceBetweenStatements, this.SpaceAfterTryFinally + ]; + this.SpaceAfterComma = new formatting.Rule(formatting.RuleDescriptor.create3(24, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNextTokenNotCloseBracket), 2)); + this.NoSpaceAfterComma = new formatting.Rule(formatting.RuleDescriptor.create3(24, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); + this.SpaceBeforeBinaryOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.BinaryOperators), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2)); + this.SpaceAfterBinaryOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.BinaryOperators, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2)); + this.NoSpaceBeforeBinaryOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.BinaryOperators), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 8)); + this.NoSpaceAfterBinaryOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.BinaryOperators, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 8)); this.SpaceAfterKeywordInControl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Keywords, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext), 2)); this.NoSpaceAfterKeywordInControl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Keywords, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext), 8)); this.NewLineBeforeOpenBraceInFunction = new formatting.Rule(formatting.RuleDescriptor.create2(this.FunctionOpenBraceLeftTokenRange, 15), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext, Rules.IsBeforeMultilineBlockContext), 4), 1); this.NewLineBeforeOpenBraceInTypeScriptDeclWithBlock = new formatting.Rule(formatting.RuleDescriptor.create2(this.TypeScriptOpenBraceLeftTokenRange, 15), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsTypeScriptDeclWithBlockContext, Rules.IsBeforeMultilineBlockContext), 4), 1); this.NewLineBeforeOpenBraceInControl = new formatting.Rule(formatting.RuleDescriptor.create2(this.ControlOpenBraceLeftTokenRange, 15), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext, Rules.IsBeforeMultilineBlockContext), 4), 1); - this.SpaceAfterSemicolonInFor = new formatting.Rule(formatting.RuleDescriptor.create3(23, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsForContext), 2)); - this.NoSpaceAfterSemicolonInFor = new formatting.Rule(formatting.RuleDescriptor.create3(23, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsForContext), 8)); - this.SpaceAfterOpenParen = new formatting.Rule(formatting.RuleDescriptor.create3(17, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); - this.SpaceBeforeCloseParen = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 18), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); - this.NoSpaceBetweenParens = new formatting.Rule(formatting.RuleDescriptor.create1(17, 18), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.NoSpaceAfterOpenParen = new formatting.Rule(formatting.RuleDescriptor.create3(17, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.NoSpaceBeforeCloseParen = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 18), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.SpaceAfterOpenBracket = new formatting.Rule(formatting.RuleDescriptor.create3(19, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); - this.SpaceBeforeCloseBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 20), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); - this.NoSpaceBetweenBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(19, 20), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.NoSpaceAfterOpenBracket = new formatting.Rule(formatting.RuleDescriptor.create3(19, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.NoSpaceBeforeCloseBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 20), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.SpaceAfterSemicolonInFor = new formatting.Rule(formatting.RuleDescriptor.create3(23, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsForContext), 2)); + this.NoSpaceAfterSemicolonInFor = new formatting.Rule(formatting.RuleDescriptor.create3(23, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsForContext), 8)); + this.SpaceAfterOpenParen = new formatting.Rule(formatting.RuleDescriptor.create3(17, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); + this.SpaceBeforeCloseParen = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 18), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); + this.NoSpaceBetweenParens = new formatting.Rule(formatting.RuleDescriptor.create1(17, 18), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); + this.NoSpaceAfterOpenParen = new formatting.Rule(formatting.RuleDescriptor.create3(17, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); + this.NoSpaceBeforeCloseParen = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 18), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); + this.SpaceAfterOpenBracket = new formatting.Rule(formatting.RuleDescriptor.create3(19, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); + this.SpaceBeforeCloseBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 20), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); + this.NoSpaceBetweenBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(19, 20), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); + this.NoSpaceAfterOpenBracket = new formatting.Rule(formatting.RuleDescriptor.create3(19, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); + this.NoSpaceBeforeCloseBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 20), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); + this.NoSpaceAfterTemplateHeadAndMiddle = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([12, 13]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); + this.SpaceAfterTemplateHeadAndMiddle = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([12, 13]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); + this.NoSpaceBeforeTemplateMiddleAndTail = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([13, 14])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); + this.SpaceBeforeTemplateMiddleAndTail = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([13, 14])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); this.SpaceAfterAnonymousFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(87, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2)); this.NoSpaceAfterAnonymousFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(87, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 8)); } Rules.prototype.getRuleName = function (rule) { var o = this; - for (var name_34 in o) { - if (o[name_34] === rule) { - return name_34; + for (var name_38 in o) { + if (o[name_38] === rule) { + return name_38; } } throw new Error("Unknown rule"); }; Rules.IsForContext = function (context) { - return context.contextNode.kind === 199; + return context.contextNode.kind === 206; }; Rules.IsNotForContext = function (context) { return !Rules.IsForContext(context); }; Rules.IsBinaryOpContext = function (context) { switch (context.contextNode.kind) { - case 181: - case 182: - case 189: - case 150: - case 158: - case 159: - return true; + case 187: + case 188: + case 195: + case 154: + case 162: case 163: - case 216: - case 221: - case 211: - case 138: - case 247: - case 141: - case 140: + return true; + case 169: + case 223: + case 229: + case 218: + case 142: + case 255: + case 145: + case 144: return context.currentTokenSpan.kind === 56 || context.nextTokenSpan.kind === 56; - case 200: + case 207: return context.currentTokenSpan.kind === 90 || context.nextTokenSpan.kind === 90; - case 201: - return context.currentTokenSpan.kind === 134 || context.nextTokenSpan.kind === 134; + case 208: + return context.currentTokenSpan.kind === 138 || context.nextTokenSpan.kind === 138; } return false; }; @@ -35406,7 +40443,7 @@ var ts; return !Rules.IsBinaryOpContext(context); }; Rules.IsConditionalOperatorContext = function (context) { - return context.contextNode.kind === 182; + return context.contextNode.kind === 188; }; Rules.IsSameLineTokenOrBeforeMultilineBlockContext = function (context) { return context.TokensAreOnSameLine() || Rules.IsBeforeMultilineBlockContext(context); @@ -35431,86 +40468,86 @@ var ts; return true; } switch (node.kind) { - case 192: - case 220: - case 165: - case 219: + case 199: + case 227: + case 171: + case 226: return true; } return false; }; Rules.IsFunctionDeclContext = function (context) { switch (context.contextNode.kind) { - case 213: - case 143: - case 142: - case 145: - case 146: + case 220: case 147: - case 173: - case 144: - case 174: - case 215: + case 146: + case 149: + case 150: + case 151: + case 179: + case 148: + case 180: + case 222: return true; } return false; }; Rules.IsFunctionDeclarationOrFunctionExpressionContext = function (context) { - return context.contextNode.kind === 213 || context.contextNode.kind === 173; + return context.contextNode.kind === 220 || context.contextNode.kind === 179; }; Rules.IsTypeScriptDeclWithBlockContext = function (context) { return Rules.NodeIsTypeScriptDeclWithBlockContext(context.contextNode); }; Rules.NodeIsTypeScriptDeclWithBlockContext = function (node) { switch (node.kind) { - case 214: - case 186: - case 215: - case 217: - case 155: - case 218: + case 221: + case 192: + case 222: + case 224: + case 159: + case 225: return true; } return false; }; Rules.IsAfterCodeBlockContext = function (context) { switch (context.currentTokenParent.kind) { - case 214: - case 218: - case 217: - case 192: - case 244: - case 219: - case 206: + case 221: + case 225: + case 224: + case 199: + case 252: + case 226: + case 213: return true; } return false; }; Rules.IsControlDeclContext = function (context) { switch (context.contextNode.kind) { - case 196: + case 203: + case 213: case 206: - case 199: - case 200: - case 201: - case 198: - case 209: - case 197: + case 207: + case 208: case 205: - case 244: + case 216: + case 204: + case 212: + case 252: return true; default: return false; } }; Rules.IsObjectContext = function (context) { - return context.contextNode.kind === 165; + return context.contextNode.kind === 171; }; Rules.IsFunctionCallContext = function (context) { - return context.contextNode.kind === 168; + return context.contextNode.kind === 174; }; Rules.IsNewContext = function (context) { - return context.contextNode.kind === 169; + return context.contextNode.kind === 175; }; Rules.IsFunctionCallOrNewContext = function (context) { return Rules.IsFunctionCallContext(context) || Rules.IsNewContext(context); @@ -35518,11 +40555,14 @@ var ts; Rules.IsPreviousTokenNotComma = function (context) { return context.currentTokenSpan.kind !== 24; }; - Rules.IsArrowFunctionContext = function (context) { - return context.contextNode.kind === 174; + Rules.IsNextTokenNotCloseBracket = function (context) { + return context.nextTokenSpan.kind !== 20; }; - Rules.IsSameLineTokenContext = function (context) { - return context.TokensAreOnSameLine(); + Rules.IsArrowFunctionContext = function (context) { + return context.contextNode.kind === 180; + }; + Rules.IsNonJsxSameLineTokenContext = function (context) { + return context.TokensAreOnSameLine() && context.contextNode.kind !== 244; }; Rules.IsNotBeforeBlockInFunctionDeclarationContext = function (context) { return !Rules.IsFunctionDeclContext(context) && !Rules.IsBeforeBlockContext(context); @@ -35537,41 +40577,41 @@ var ts; while (ts.isExpression(node)) { node = node.parent; } - return node.kind === 139; + return node.kind === 143; }; Rules.IsStartOfVariableDeclarationList = function (context) { - return context.currentTokenParent.kind === 212 && + return context.currentTokenParent.kind === 219 && context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos; }; Rules.IsNotFormatOnEnter = function (context) { return context.formattingRequestKind !== 2; }; Rules.IsModuleDeclContext = function (context) { - return context.contextNode.kind === 218; + return context.contextNode.kind === 225; }; Rules.IsObjectTypeContext = function (context) { - return context.contextNode.kind === 155; + return context.contextNode.kind === 159; }; Rules.IsTypeArgumentOrParameterOrAssertion = function (token, parent) { if (token.kind !== 25 && token.kind !== 27) { return false; } switch (parent.kind) { - case 151: - case 171: - case 214: - case 186: - case 215: - case 213: - case 173: - case 174: - case 143: - case 142: + case 155: + case 177: + case 221: + case 192: + case 222: + case 220: + case 179: + case 180: case 147: - case 148: - case 168: - case 169: - case 188: + case 146: + case 151: + case 152: + case 174: + case 175: + case 194: return true; default: return false; @@ -35582,16 +40622,16 @@ var ts; Rules.IsTypeArgumentOrParameterOrAssertion(context.nextTokenSpan, context.nextTokenParent); }; Rules.IsTypeAssertionContext = function (context) { - return context.contextNode.kind === 171; + return context.contextNode.kind === 177; }; Rules.IsVoidOpContext = function (context) { - return context.currentTokenSpan.kind === 103 && context.currentTokenParent.kind === 177; + return context.currentTokenSpan.kind === 103 && context.currentTokenParent.kind === 183; }; Rules.IsYieldOrYieldStarWithOperand = function (context) { - return context.contextNode.kind === 184 && context.contextNode.expression !== undefined; + return context.contextNode.kind === 190 && context.contextNode.expression !== undefined; }; return Rules; - })(); + }()); formatting.Rules = Rules; })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); @@ -35610,7 +40650,7 @@ var ts; return result; }; RulesMap.prototype.Initialize = function (rules) { - this.mapRowLength = 134 + 1; + this.mapRowLength = 138 + 1; this.map = new Array(this.mapRowLength * this.mapRowLength); var rulesBucketConstructionStateList = new Array(this.map.length); this.FillRules(rules, rulesBucketConstructionStateList); @@ -35655,7 +40695,7 @@ var ts; return null; }; return RulesMap; - })(); + }()); formatting.RulesMap = RulesMap; var MaskBitSize = 5; var Mask = 0x1f; @@ -35692,7 +40732,7 @@ var ts; this.rulesInsertionIndexBitmap = temp; }; return RulesBucketConstructionState; - })(); + }()); formatting.RulesBucketConstructionState = RulesBucketConstructionState; var RulesBucket = (function () { function RulesBucket() { @@ -35727,7 +40767,7 @@ var ts; state.IncreaseInsertionIndex(position); }; return RulesBucket; - })(); + }()); formatting.RulesBucket = RulesBucket; })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); @@ -35753,7 +40793,7 @@ var ts; return this.tokens.indexOf(token) >= 0; }; return TokenRangeAccess; - })(); + }()); Shared.TokenRangeAccess = TokenRangeAccess; var TokenValuesAccess = (function () { function TokenValuesAccess(tks) { @@ -35766,7 +40806,7 @@ var ts; return this.tokens.indexOf(token) >= 0; }; return TokenValuesAccess; - })(); + }()); Shared.TokenValuesAccess = TokenValuesAccess; var TokenSingleValueAccess = (function () { function TokenSingleValueAccess(token) { @@ -35779,14 +40819,14 @@ var ts; return tokenValue === this.token; }; return TokenSingleValueAccess; - })(); + }()); Shared.TokenSingleValueAccess = TokenSingleValueAccess; var TokenAllAccess = (function () { function TokenAllAccess() { } TokenAllAccess.prototype.GetTokens = function () { var result = []; - for (var token = 0; token <= 134; token++) { + for (var token = 0; token <= 138; token++) { result.push(token); } return result; @@ -35798,7 +40838,7 @@ var ts; return "[allTokens]"; }; return TokenAllAccess; - })(); + }()); Shared.TokenAllAccess = TokenAllAccess; var TokenRange = (function () { function TokenRange(tokenAccess) { @@ -35828,9 +40868,9 @@ var ts; }; TokenRange.Any = TokenRange.AllTokens(); TokenRange.AnyIncludingMultilineComments = TokenRange.FromTokens(TokenRange.Any.GetTokens().concat([3])); - TokenRange.Keywords = TokenRange.FromRange(70, 134); + TokenRange.Keywords = TokenRange.FromRange(70, 138); TokenRange.BinaryOperators = TokenRange.FromRange(25, 68); - TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([90, 91, 134, 116, 124]); + TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([90, 91, 138, 116, 124]); TokenRange.UnaryPrefixOperators = TokenRange.FromTokens([41, 42, 50, 49]); TokenRange.UnaryPrefixExpressions = TokenRange.FromTokens([8, 69, 17, 19, 15, 97, 92]); TokenRange.UnaryPreincrementExpressions = TokenRange.FromTokens([69, 17, 97, 92]); @@ -35838,9 +40878,9 @@ var ts; TokenRange.UnaryPredecrementExpressions = TokenRange.FromTokens([69, 17, 97, 92]); TokenRange.UnaryPostdecrementExpressions = TokenRange.FromTokens([69, 18, 20, 92]); TokenRange.Comments = TokenRange.FromTokens([2, 3]); - TokenRange.TypeNames = TokenRange.FromTokens([69, 128, 130, 120, 131, 103, 117]); + TokenRange.TypeNames = TokenRange.FromTokens([69, 130, 132, 120, 133, 103, 117]); return TokenRange; - })(); + }()); Shared.TokenRange = TokenRange; })(Shared = formatting.Shared || (formatting.Shared = {})); })(formatting = ts.formatting || (ts.formatting = {})); @@ -35911,6 +40951,14 @@ var ts; rules.push(this.globalRules.NoSpaceBeforeCloseBracket); rules.push(this.globalRules.NoSpaceBetweenBrackets); } + if (options.InsertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces) { + rules.push(this.globalRules.SpaceAfterTemplateHeadAndMiddle); + rules.push(this.globalRules.SpaceBeforeTemplateMiddleAndTail); + } + else { + rules.push(this.globalRules.NoSpaceAfterTemplateHeadAndMiddle); + rules.push(this.globalRules.NoSpaceBeforeTemplateMiddleAndTail); + } if (options.InsertSpaceAfterSemicolonInForStatements) { rules.push(this.globalRules.SpaceAfterSemicolonInFor); } @@ -35936,7 +40984,7 @@ var ts; return rules; }; return RulesProvider; - })(); + }()); formatting.RulesProvider = RulesProvider; })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); @@ -35949,9 +40997,13 @@ var ts; if (line === 0) { return []; } + var endOfFormatSpan = ts.getEndLinePosition(line, sourceFile); + while (ts.isWhiteSpace(sourceFile.text.charCodeAt(endOfFormatSpan)) && !ts.isLineBreak(sourceFile.text.charCodeAt(endOfFormatSpan))) { + endOfFormatSpan--; + } var span = { pos: ts.getStartPositionOfLine(line - 1, sourceFile), - end: ts.getEndLinePosition(line, sourceFile) + 1 + end: endOfFormatSpan + 1 }; return formatSpan(span, sourceFile, options, rulesProvider, 2); } @@ -36009,17 +41061,17 @@ var ts; } function isListElement(parent, node) { switch (parent.kind) { - case 214: - case 215: + case 221: + case 222: return ts.rangeContainsRange(parent.members, node); - case 218: + case 225: var body = parent.body; - return body && body.kind === 192 && ts.rangeContainsRange(body.statements, node); - case 248: - case 192: - case 219: + return body && body.kind === 199 && ts.rangeContainsRange(body.statements, node); + case 256: + case 199: + case 226: return ts.rangeContainsRange(parent.statements, node); - case 244: + case 252: return ts.rangeContainsRange(parent.block.statements, node); } return false; @@ -36083,17 +41135,17 @@ var ts; } function getOwnOrInheritedDelta(n, options, sourceFile) { var previousLine = -1; - var childKind = 0; + var child; while (n) { var line = sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)).line; if (previousLine !== -1 && line !== previousLine) { break; } - if (formatting.SmartIndenter.shouldIndentChildNode(n.kind, childKind)) { + if (formatting.SmartIndenter.shouldIndentChildNode(n, child)) { return options.IndentSize; } previousLine = line; - childKind = n.kind; + child = n; n = n.parent; } return 0; @@ -36121,10 +41173,18 @@ var ts; var delta = getOwnOrInheritedDelta(enclosingNode, options, sourceFile); processNode(enclosingNode, enclosingNode, startLine, undecoratedStartLine, initialIndentation, delta); } + if (!formattingScanner.isOnToken()) { + var leadingTrivia = formattingScanner.getCurrentLeadingTrivia(); + if (leadingTrivia) { + processTrivia(leadingTrivia, enclosingNode, enclosingNode, undefined); + trimTrailingWhitespacesForRemainingRange(); + } + } formattingScanner.close(); return edits; function tryComputeIndentationForListItem(startPos, endPos, parentStartLine, range, inheritedIndentation) { - if (ts.rangeOverlapsWithStartEnd(range, startPos, endPos)) { + if (ts.rangeOverlapsWithStartEnd(range, startPos, endPos) || + ts.rangeContainsStartEnd(range, startPos, endPos)) { if (inheritedIndentation !== -1) { return inheritedIndentation; } @@ -36141,33 +41201,20 @@ var ts; } function computeIndentation(node, startLine, inheritedIndentation, parent, parentDynamicIndentation, effectiveParentStartLine) { var indentation = inheritedIndentation; - if (indentation === -1) { - if (isSomeBlock(node.kind)) { - if (isSomeBlock(parent.kind) || - parent.kind === 248 || - parent.kind === 241 || - parent.kind === 242) { - indentation = parentDynamicIndentation.getIndentation() + parentDynamicIndentation.getDelta(); - } - else { - indentation = parentDynamicIndentation.getIndentation(); - } - } - else { - if (formatting.SmartIndenter.childStartsOnTheSameLineWithElseInIfStatement(parent, node, startLine, sourceFile)) { - indentation = parentDynamicIndentation.getIndentation(); - } - else { - indentation = parentDynamicIndentation.getIndentation() + parentDynamicIndentation.getDelta(); - } - } - } - var delta = formatting.SmartIndenter.shouldIndentChildNode(node.kind, 0) ? options.IndentSize : 0; + var delta = formatting.SmartIndenter.shouldIndentChildNode(node) ? options.IndentSize : 0; if (effectiveParentStartLine === startLine) { indentation = startLine === lastIndentedLine ? indentationOnLastIndentedLine : parentDynamicIndentation.getIndentation(); - delta = Math.min(options.IndentSize, parentDynamicIndentation.getDelta() + delta); + delta = Math.min(options.IndentSize, parentDynamicIndentation.getDelta(node) + delta); + } + else if (indentation === -1) { + if (formatting.SmartIndenter.childStartsOnTheSameLineWithElseInIfStatement(parent, node, startLine, sourceFile)) { + indentation = parentDynamicIndentation.getIndentation(); + } + else { + indentation = parentDynamicIndentation.getIndentation() + parentDynamicIndentation.getDelta(node); + } } return { indentation: indentation, @@ -36179,33 +41226,33 @@ var ts; return node.modifiers[0].kind; } switch (node.kind) { - case 214: return 73; - case 215: return 107; - case 213: return 87; - case 217: return 217; - case 145: return 123; - case 146: return 129; - case 143: + case 221: return 73; + case 222: return 107; + case 220: return 87; + case 224: return 224; + case 149: return 123; + case 150: return 131; + case 147: if (node.asteriskToken) { return 37; } - case 141: - case 138: + case 145: + case 142: return node.name.kind; } } function getDynamicIndentation(node, nodeStartLine, indentation, delta) { return { - getIndentationForComment: function (kind, tokenIndentation) { + getIndentationForComment: function (kind, tokenIndentation, container) { switch (kind) { case 16: case 20: case 18: - return indentation + delta; + return indentation + getEffectiveDelta(delta, container); } return tokenIndentation !== -1 ? tokenIndentation : indentation; }, - getIndentationForToken: function (line, kind) { + getIndentationForToken: function (line, kind, container) { if (nodeStartLine !== line && node.decorators) { if (kind === getFirstNonDecoratorTokenOfNode(node)) { return indentation; @@ -36223,20 +41270,20 @@ var ts; case 55: return indentation; default: - return nodeStartLine !== line ? indentation + delta : indentation; + return nodeStartLine !== line ? indentation + getEffectiveDelta(delta, container) : indentation; } }, getIndentation: function () { return indentation; }, - getDelta: function () { return delta; }, + getDelta: function (child) { return getEffectiveDelta(delta, child); }, recomputeIndentation: function (lineAdded) { - if (node.parent && formatting.SmartIndenter.shouldIndentChildNode(node.parent.kind, node.kind)) { + if (node.parent && formatting.SmartIndenter.shouldIndentChildNode(node.parent, node)) { if (lineAdded) { indentation += options.IndentSize; } else { indentation -= options.IndentSize; } - if (formatting.SmartIndenter.shouldIndentChildNode(node.kind, 0)) { + if (formatting.SmartIndenter.shouldIndentChildNode(node)) { delta = options.IndentSize; } else { @@ -36245,6 +41292,9 @@ var ts; } } }; + function getEffectiveDelta(delta, child) { + return formatting.SmartIndenter.nodeWillIndentChild(node, child, true) ? delta : 0; + } } function processNode(node, contextNode, nodeStartLine, undecoratedNodeStartLine, indentation, delta) { if (!ts.rangeOverlapsWithStartEnd(originalRange, node.getStart(sourceFile), node.getEnd())) { @@ -36264,7 +41314,7 @@ var ts; } consumeTokenAndAdvanceScanner(tokenInfo, node, nodeDynamicIndentation); } - function processChildNode(child, inheritedIndentation, parent, parentDynamicIndentation, parentStartLine, undecoratedParentStartLine, isListItem) { + function processChildNode(child, inheritedIndentation, parent, parentDynamicIndentation, parentStartLine, undecoratedParentStartLine, isListItem, isFirstListItem) { var childStartPos = child.getStart(sourceFile); var childStartLine = sourceFile.getLineAndCharacterOfPosition(childStartPos).line; var undecoratedChildStartLine = childStartLine; @@ -36297,13 +41347,16 @@ var ts; if (ts.isToken(child)) { var tokenInfo = formattingScanner.readTokenInfo(child); ts.Debug.assert(tokenInfo.token.end === child.end); - consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation); + consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation, child); return inheritedIndentation; } - var effectiveParentStartLine = child.kind === 139 ? childStartLine : undecoratedParentStartLine; + var effectiveParentStartLine = child.kind === 143 ? childStartLine : undecoratedParentStartLine; var childIndentation = computeIndentation(child, childStartLine, childIndentationAmount, node, parentDynamicIndentation, effectiveParentStartLine); processNode(child, childContextNode, childStartLine, undecoratedChildStartLine, childIndentation.indentation, childIndentation.delta); childContextNode = node; + if (isFirstListItem && parent.kind === 170 && inheritedIndentation === -1) { + inheritedIndentation = childIndentation.indentation; + } return inheritedIndentation; } function processChildNodes(nodes, parent, parentStartLine, parentDynamicIndentation) { @@ -36329,9 +41382,9 @@ var ts; } } var inheritedIndentation = -1; - for (var _i = 0, nodes_6 = nodes; _i < nodes_6.length; _i++) { - var child = nodes_6[_i]; - inheritedIndentation = processChildNode(child, inheritedIndentation, node, listDynamicIndentation, startLine, startLine, true); + for (var i = 0; i < nodes.length; i++) { + var child = nodes[i]; + inheritedIndentation = processChildNode(child, inheritedIndentation, node, listDynamicIndentation, startLine, startLine, true, i === 0); } if (listEndToken !== 0) { if (formattingScanner.isOnToken()) { @@ -36342,7 +41395,7 @@ var ts; } } } - function consumeTokenAndAdvanceScanner(currentTokenInfo, parent, dynamicIndentation) { + function consumeTokenAndAdvanceScanner(currentTokenInfo, parent, dynamicIndentation, container) { ts.Debug.assert(ts.rangeContainsRange(parent, currentTokenInfo.token)); var lastTriviaWasNewLine = formattingScanner.lastTrailingTriviaWasNewLine(); var indentToken = false; @@ -36374,26 +41427,26 @@ var ts; } if (indentToken) { var tokenIndentation = (isTokenInRange && !rangeContainsError(currentTokenInfo.token)) ? - dynamicIndentation.getIndentationForToken(tokenStart.line, currentTokenInfo.token.kind) : + dynamicIndentation.getIndentationForToken(tokenStart.line, currentTokenInfo.token.kind, container) : -1; + var indentNextTokenOrTrivia = true; if (currentTokenInfo.leadingTrivia) { - var commentIndentation = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind, tokenIndentation); - var indentNextTokenOrTrivia = true; + var commentIndentation = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind, tokenIndentation, container); for (var _i = 0, _a = currentTokenInfo.leadingTrivia; _i < _a.length; _i++) { var triviaItem = _a[_i]; - if (!ts.rangeContainsRange(originalRange, triviaItem)) { - continue; - } + var triviaInRange = ts.rangeContainsRange(originalRange, triviaItem); switch (triviaItem.kind) { case 3: - indentMultilineComment(triviaItem, commentIndentation, !indentNextTokenOrTrivia); + if (triviaInRange) { + indentMultilineComment(triviaItem, commentIndentation, !indentNextTokenOrTrivia); + } indentNextTokenOrTrivia = false; break; case 2: - if (indentNextTokenOrTrivia) { + if (indentNextTokenOrTrivia && triviaInRange) { insertIndentation(triviaItem.pos, commentIndentation, false); - indentNextTokenOrTrivia = false; } + indentNextTokenOrTrivia = false; break; case 4: indentNextTokenOrTrivia = true; @@ -36401,7 +41454,7 @@ var ts; } } } - if (tokenIndentation !== -1) { + if (tokenIndentation !== -1 && indentNextTokenOrTrivia) { insertIndentation(currentTokenInfo.token.pos, tokenIndentation, lineAdded); lastIndentedLine = tokenStart.line; indentationOnLastIndentedLine = tokenIndentation; @@ -36458,9 +41511,7 @@ var ts; dynamicIndentation.recomputeIndentation(true); } } - trimTrailingWhitespaces = - (rule.Operation.Action & (4 | 2)) && - rule.Flag !== 1; + trimTrailingWhitespaces = !(rule.Operation.Action & 8) && rule.Flag !== 1; } else { trimTrailingWhitespaces = true; @@ -36477,12 +41528,15 @@ var ts; } else { var tokenStart = sourceFile.getLineAndCharacterOfPosition(pos); - if (indentation !== tokenStart.character) { - var startLinePosition = ts.getStartPositionOfLine(tokenStart.line, sourceFile); + var startLinePosition = ts.getStartPositionOfLine(tokenStart.line, sourceFile); + if (indentation !== tokenStart.character || indentationIsDifferent(indentationString, startLinePosition)) { recordReplace(startLinePosition, tokenStart.character, indentationString); } } } + function indentationIsDifferent(indentationString, startLinePosition) { + return indentationString !== sourceFile.text.substr(startLinePosition, indentationString.length); + } function indentMultilineComment(commentRange, indentation, firstLineIsIndented) { var startLine = sourceFile.getLineAndCharacterOfPosition(commentRange.pos).line; var endLine = sourceFile.getLineAndCharacterOfPosition(commentRange.end).line; @@ -36536,16 +41590,29 @@ var ts; if (range && (ts.isComment(range.kind) || ts.isStringOrRegularExpressionOrTemplateLiteral(range.kind)) && range.pos <= lineEndPosition && range.end > lineEndPosition) { continue; } - var pos = lineEndPosition; - while (pos >= lineStartPosition && ts.isWhiteSpace(sourceFile.text.charCodeAt(pos))) { - pos--; - } - if (pos !== lineEndPosition) { - ts.Debug.assert(pos === lineStartPosition || !ts.isWhiteSpace(sourceFile.text.charCodeAt(pos))); - recordDelete(pos + 1, lineEndPosition - pos); + var whitespaceStart = getTrailingWhitespaceStartPosition(lineStartPosition, lineEndPosition); + if (whitespaceStart !== -1) { + ts.Debug.assert(whitespaceStart === lineStartPosition || !ts.isWhiteSpace(sourceFile.text.charCodeAt(whitespaceStart - 1))); + recordDelete(whitespaceStart, lineEndPosition + 1 - whitespaceStart); } } } + function getTrailingWhitespaceStartPosition(start, end) { + var pos = end; + while (pos >= start && ts.isWhiteSpace(sourceFile.text.charCodeAt(pos))) { + pos--; + } + if (pos !== end) { + return pos + 1; + } + return -1; + } + function trimTrailingWhitespacesForRemainingRange() { + var startPosition = previousRange ? previousRange.end : originalRange.pos; + var startLine = sourceFile.getLineAndCharacterOfPosition(startPosition).line; + var endLine = sourceFile.getLineAndCharacterOfPosition(originalRange.end).line; + trimTrailingWhitespacesForLines(startLine, endLine + 1, previousRange); + } function newTextChange(start, len, newText) { return { span: ts.createTextSpan(start, len), newText: newText }; } @@ -36592,20 +41659,20 @@ var ts; } function isSomeBlock(kind) { switch (kind) { - case 192: - case 219: + case 199: + case 226: return true; } return false; } function getOpenTokenForList(node, list) { switch (node.kind) { - case 144: - case 213: - case 173: - case 143: - case 142: - case 174: + case 148: + case 220: + case 179: + case 147: + case 146: + case 180: if (node.typeParameters === list) { return 25; } @@ -36613,8 +41680,8 @@ var ts; return 17; } break; - case 168: - case 169: + case 174: + case 175: if (node.typeArguments === list) { return 25; } @@ -36622,7 +41689,7 @@ var ts; return 17; } break; - case 151: + case 155: if (node.typeArguments === list) { return 25; } @@ -36650,7 +41717,7 @@ var ts; if (!options.ConvertTabsToSpaces) { var tabs = Math.floor(indentation / options.TabSize); var spaces = indentation - tabs * options.TabSize; - var tabString; + var tabString = void 0; if (!internedTabsIndentation) { internedTabsIndentation = []; } @@ -36663,7 +41730,7 @@ var ts; return spaces ? tabString + repeat(" ", spaces) : tabString; } else { - var spacesString; + var spacesString = void 0; var quotient = Math.floor(indentation / options.IndentSize); var remainder = indentation % options.IndentSize; if (!internedSpacesIndentation) { @@ -36723,7 +41790,7 @@ var ts; var lineStart = ts.getLineStartPositionForPosition(current_1, sourceFile); return SmartIndenter.findFirstNonWhitespaceColumn(lineStart, current_1, sourceFile, options); } - if (precedingToken.kind === 24 && precedingToken.parent.kind !== 181) { + if (precedingToken.kind === 24 && precedingToken.parent.kind !== 187) { var actualIndentation = getActualIndentationForListItemBeforeComma(precedingToken, sourceFile, options); if (actualIndentation !== -1) { return actualIndentation; @@ -36734,7 +41801,7 @@ var ts; var currentStart; var indentationDelta; while (current) { - if (ts.positionBelongsToNode(current, position, sourceFile) && shouldIndentChildNode(current.kind, previous ? previous.kind : 0)) { + if (ts.positionBelongsToNode(current, position, sourceFile) && shouldIndentChildNode(current, previous)) { currentStart = getStartLineAndCharacterForNode(current, sourceFile); if (nextTokenIsCurlyBraceOnSameLineAsCursor(precedingToken, current, lineAtPosition, sourceFile)) { indentationDelta = 0; @@ -36794,7 +41861,7 @@ var ts; return actualIndentation + indentationDelta; } } - if (shouldIndentChildNode(parent.kind, current.kind) && !parentAndChildShareLine) { + if (shouldIndentChildNode(parent, current) && !parentAndChildShareLine) { indentationDelta += options.IndentSize; } current = parent; @@ -36821,7 +41888,7 @@ var ts; } function getActualIndentationForNode(current, parent, currentLineAndChar, parentAndChildShareLine, sourceFile, options) { var useActualIndentation = (ts.isDeclaration(current) || ts.isStatement(current)) && - (parent.kind === 248 || !parentAndChildShareLine); + (parent.kind === 256 || !parentAndChildShareLine); if (!useActualIndentation) { return -1; } @@ -36845,7 +41912,7 @@ var ts; return sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)); } function childStartsOnTheSameLineWithElseInIfStatement(parent, child, childStartLine, sourceFile) { - if (parent.kind === 196 && parent.elseStatement === child) { + if (parent.kind === 203 && parent.elseStatement === child) { var elseKeyword = ts.findChildOfKind(parent, 80, sourceFile); ts.Debug.assert(elseKeyword !== undefined); var elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line; @@ -36857,23 +41924,23 @@ var ts; function getContainingList(node, sourceFile) { if (node.parent) { switch (node.parent.kind) { - case 151: + case 155: if (node.parent.typeArguments && ts.rangeContainsStartEnd(node.parent.typeArguments, node.getStart(sourceFile), node.getEnd())) { return node.parent.typeArguments; } break; - case 165: + case 171: return node.parent.properties; - case 164: + case 170: return node.parent.elements; - case 213: - case 173: - case 174: - case 143: - case 142: + case 220: + case 179: + case 180: case 147: - case 148: { + case 146: + case 151: + case 152: { var start = node.getStart(sourceFile); if (node.parent.typeParameters && ts.rangeContainsStartEnd(node.parent.typeParameters, start, node.getEnd())) { @@ -36884,8 +41951,8 @@ var ts; } break; } - case 169: - case 168: { + case 175: + case 174: { var start = node.getStart(sourceFile); if (node.parent.typeArguments && ts.rangeContainsStartEnd(node.parent.typeArguments, start, node.getEnd())) { @@ -36913,8 +41980,8 @@ var ts; if (node.kind === 18) { return -1; } - if (node.parent && (node.parent.kind === 168 || - node.parent.kind === 169) && + if (node.parent && (node.parent.kind === 174 || + node.parent.kind === 175) && node.parent.expression !== node) { var fullCallOrNewExpression = node.parent.expression; var startingExpression = getStartingExpression(fullCallOrNewExpression); @@ -36932,10 +41999,10 @@ var ts; function getStartingExpression(node) { while (true) { switch (node.kind) { - case 168: - case 169: - case 166: - case 167: + case 174: + case 175: + case 172: + case 173: node = node.expression; break; default: @@ -36989,82 +42056,82 @@ var ts; SmartIndenter.findFirstNonWhitespaceColumn = findFirstNonWhitespaceColumn; function nodeContentIsAlwaysIndented(kind) { switch (kind) { - case 195: - case 214: - case 186: - case 215: - case 217: - case 216: - case 164: + case 202: + case 221: case 192: - case 219: - case 165: - case 155: - case 157: - case 220: - case 242: - case 241: - case 172: - case 166: - case 168: - case 169: - case 193: - case 211: - case 227: - case 204: - case 182: - case 162: - case 161: - case 233: - case 234: - case 142: - case 147: - case 148: - case 138: - case 152: - case 153: - case 160: + case 222: + case 224: + case 223: case 170: + case 199: + case 226: + case 171: + case 159: + case 161: + case 227: + case 250: + case 249: case 178: + case 172: + case 174: + case 175: + case 200: + case 218: + case 235: + case 211: + case 188: + case 168: + case 167: + case 243: + case 242: + case 248: + case 146: + case 151: + case 152: + case 142: + case 156: + case 157: + case 164: + case 176: + case 184: + case 233: return true; } return false; } + function nodeWillIndentChild(parent, child, indentByDefault) { + var childKind = child ? child.kind : 0; + switch (parent.kind) { + case 204: + case 205: + case 207: + case 208: + case 206: + case 203: + case 220: + case 179: + case 147: + case 180: + case 148: + case 149: + case 150: + return childKind !== 199; + case 241: + return childKind !== 245; + } + return indentByDefault; + } + SmartIndenter.nodeWillIndentChild = nodeWillIndentChild; function shouldIndentChildNode(parent, child) { - if (nodeContentIsAlwaysIndented(parent)) { - return true; - } - switch (parent) { - case 197: - case 198: - case 200: - case 201: - case 199: - case 196: - case 213: - case 173: - case 143: - case 174: - case 144: - case 145: - case 146: - return child !== 192; - default: - return false; - } + return nodeContentIsAlwaysIndented(parent.kind) || nodeWillIndentChild(parent, child, false); } SmartIndenter.shouldIndentChildNode = shouldIndentChildNode; })(SmartIndenter = formatting.SmartIndenter || (formatting.SmartIndenter = {})); })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; var ts; (function (ts) { - ts.servicesVersion = "0.4"; + ts.servicesVersion = "0.5"; var ScriptSnapshot; (function (ScriptSnapshot) { var StringScriptSnapshot = (function () { @@ -37081,7 +42148,7 @@ var ts; return undefined; }; return StringScriptSnapshot; - })(); + }()); function fromString(text) { return new StringScriptSnapshot(text); } @@ -37174,13 +42241,13 @@ var ts; while (pos < end) { var token = scanner.scan(); var textPos = scanner.getTextPos(); - nodes.push(createNode(token, pos, textPos, 2048, this)); + nodes.push(createNode(token, pos, textPos, 0, this)); pos = textPos; } return pos; }; NodeObject.prototype.createSyntaxList = function (nodes) { - var list = createNode(271, nodes.pos, nodes.end, 2048, this); + var list = createNode(279, nodes.pos, nodes.end, 0, this); list._children = []; var pos = nodes.pos; for (var _i = 0, nodes_7 = nodes; _i < nodes_7.length; _i++) { @@ -37199,27 +42266,27 @@ var ts; NodeObject.prototype.createChildren = function (sourceFile) { var _this = this; var children; - if (this.kind >= 135) { + if (this.kind >= 139) { scanner.setText((sourceFile || this.getSourceFile()).text); children = []; - var pos = this.pos; + var pos_3 = this.pos; var processNode = function (node) { - if (pos < node.pos) { - pos = _this.addSyntheticNodes(children, pos, node.pos); + if (pos_3 < node.pos) { + pos_3 = _this.addSyntheticNodes(children, pos_3, node.pos); } children.push(node); - pos = node.end; + pos_3 = node.end; }; var processNodes = function (nodes) { - if (pos < nodes.pos) { - pos = _this.addSyntheticNodes(children, pos, nodes.pos); + if (pos_3 < nodes.pos) { + pos_3 = _this.addSyntheticNodes(children, pos_3, nodes.pos); } children.push(_this.createSyntaxList(nodes)); - pos = nodes.end; + pos_3 = nodes.end; }; ts.forEachChild(this, processNode, processNodes); - if (pos < this.end) { - this.addSyntheticNodes(children, pos, this.end); + if (pos_3 < this.end) { + this.addSyntheticNodes(children, pos_3, this.end); } scanner.setText(undefined); } @@ -37246,7 +42313,7 @@ var ts; return undefined; } var child = children[0]; - return child.kind < 135 ? child : child.getFirstToken(sourceFile); + return child.kind < 139 ? child : child.getFirstToken(sourceFile); }; NodeObject.prototype.getLastToken = function (sourceFile) { var children = this.getChildren(sourceFile); @@ -37254,10 +42321,10 @@ var ts; if (!child) { return undefined; } - return child.kind < 135 ? child : child.getLastToken(sourceFile); + return child.kind < 139 ? child : child.getLastToken(sourceFile); }; return NodeObject; - })(); + }()); var SymbolObject = (function () { function SymbolObject(flags, name) { this.flags = flags; @@ -37279,7 +42346,7 @@ var ts; return this.documentationComment; }; return SymbolObject; - })(); + }()); function getJsDocCommentsFromDeclarations(declarations, name, canUseParsedParamTagComments) { var documentationComment = []; var docComments = getJsDocCommentsSeparatedByNewLines(); @@ -37295,23 +42362,23 @@ var ts; var jsDocCommentParts = []; ts.forEach(declarations, function (declaration, indexOfDeclaration) { if (ts.indexOf(declarations, declaration) === indexOfDeclaration) { - var sourceFileOfDeclaration = ts.getSourceFileOfNode(declaration); - if (canUseParsedParamTagComments && declaration.kind === 138) { - ts.forEach(getJsDocCommentTextRange(declaration.parent, sourceFileOfDeclaration), function (jsDocCommentTextRange) { - var cleanedParamJsDocComment = getCleanedParamJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration); + var sourceFileOfDeclaration_1 = ts.getSourceFileOfNode(declaration); + if (canUseParsedParamTagComments && declaration.kind === 142) { + ts.forEach(getJsDocCommentTextRange(declaration.parent, sourceFileOfDeclaration_1), function (jsDocCommentTextRange) { + var cleanedParamJsDocComment = getCleanedParamJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration_1); if (cleanedParamJsDocComment) { ts.addRange(jsDocCommentParts, cleanedParamJsDocComment); } }); } - if (declaration.kind === 218 && declaration.body.kind === 218) { + if (declaration.kind === 225 && declaration.body.kind === 225) { return; } - while (declaration.kind === 218 && declaration.parent.kind === 218) { + while (declaration.kind === 225 && declaration.parent.kind === 225) { declaration = declaration.parent; } - ts.forEach(getJsDocCommentTextRange(declaration.kind === 211 ? declaration.parent.parent : declaration, sourceFileOfDeclaration), function (jsDocCommentTextRange) { - var cleanedJsDocComment = getCleanedJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration); + ts.forEach(getJsDocCommentTextRange(declaration.kind === 218 ? declaration.parent.parent : declaration, sourceFileOfDeclaration_1), function (jsDocCommentTextRange) { + var cleanedJsDocComment = getCleanedJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration_1); if (cleanedJsDocComment) { ts.addRange(jsDocCommentParts, cleanedJsDocComment); } @@ -37355,7 +42422,8 @@ var ts; return isName(pos, end, sourceFile, paramTag); } function pushDocCommentLineText(docComments, text, blankLineCount) { - while (blankLineCount--) { + while (blankLineCount) { + blankLineCount--; docComments.push(ts.textPart("")); } docComments.push(ts.textPart(text)); @@ -37551,8 +42619,11 @@ var ts; ? this.checker.getBaseTypes(this) : undefined; }; + TypeObject.prototype.getNonNullableType = function () { + return this.checker.getNonNullableType(this); + }; return TypeObject; - })(); + }()); var SignatureObject = (function () { function SignatureObject(checker) { this.checker = checker; @@ -37576,7 +42647,7 @@ var ts; return this.documentationComment; }; return SignatureObject; - })(); + }()); var SourceFileObject = (function (_super) { __extends(SourceFileObject, _super); function SourceFileObject(kind, pos, end) { @@ -37620,9 +42691,9 @@ var ts; if (result_2 !== undefined) { return result_2; } - if (declaration.name.kind === 136) { + if (declaration.name.kind === 140) { var expr = declaration.name.expression; - if (expr.kind === 166) { + if (expr.kind === 172) { return expr.name.text; } return getTextOfIdentifierOrLiteral(expr); @@ -37642,9 +42713,10 @@ var ts; } function visit(node) { switch (node.kind) { - case 213: - case 143: - case 142: + case 220: + case 179: + case 147: + case 146: var functionDeclaration = node; var declarationName = getDeclarationName(functionDeclaration); if (declarationName) { @@ -37661,62 +42733,56 @@ var ts; ts.forEachChild(node, visit); } break; - case 214: - case 215: - case 216: - case 217: - case 218: - case 221: - case 230: - case 226: case 221: + case 192: + case 222: case 223: case 224: - case 145: - case 146: - case 155: + case 225: + case 229: + case 238: + case 234: + case 229: + case 231: + case 232: + case 149: + case 150: + case 159: addDeclaration(node); - case 144: - case 193: - case 212: - case 161: - case 162: - case 219: ts.forEachChild(node, visit); break; - case 192: - if (ts.isFunctionBlock(node)) { - ts.forEachChild(node, visit); - } - break; - case 138: - if (!(node.flags & 56)) { + case 142: + if (!(node.flags & 92)) { break; } - case 211: - case 163: - if (ts.isBindingPattern(node.name)) { - ts.forEachChild(node.name, visit); + case 218: + case 169: { + var decl = node; + if (ts.isBindingPattern(decl.name)) { + ts.forEachChild(decl.name, visit); break; } - case 247: - case 141: - case 140: + if (decl.initializer) + visit(decl.initializer); + } + case 255: + case 145: + case 144: addDeclaration(node); break; - case 228: + case 236: if (node.exportClause) { ts.forEach(node.exportClause.elements, visit); } break; - case 222: + case 230: var importClause = node.importClause; if (importClause) { if (importClause.name) { addDeclaration(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 224) { + if (importClause.namedBindings.kind === 232) { addDeclaration(importClause.namedBindings); } else { @@ -37725,16 +42791,18 @@ var ts; } } break; + default: + ts.forEachChild(node, visit); } } }; return SourceFileObject; - })(NodeObject); + }(NodeObject)); var TextChange = (function () { function TextChange() { } return TextChange; - })(); + }()); ts.TextChange = TextChange; var HighlightSpanKind; (function (HighlightSpanKind) { @@ -37852,8 +42920,11 @@ var ts; ClassificationTypeNames.jsxOpenTagName = "jsx open tag name"; ClassificationTypeNames.jsxCloseTagName = "jsx close tag name"; ClassificationTypeNames.jsxSelfClosingTagName = "jsx self closing tag name"; + ClassificationTypeNames.jsxAttribute = "jsx attribute"; + ClassificationTypeNames.jsxText = "jsx text"; + ClassificationTypeNames.jsxAttributeStringLiteralValue = "jsx attribute string literal value"; return ClassificationTypeNames; - })(); + }()); ts.ClassificationTypeNames = ClassificationTypeNames; function displayPartsToString(displayParts) { if (displayParts) { @@ -37867,14 +42938,14 @@ var ts; return false; } return ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 173) { + if (declaration.kind === 179) { return true; } - if (declaration.kind !== 211 && declaration.kind !== 213) { + if (declaration.kind !== 218 && declaration.kind !== 220) { return false; } - for (var parent_8 = declaration.parent; !ts.isFunctionBlock(parent_8); parent_8 = parent_8.parent) { - if (parent_8.kind === 248 || parent_8.kind === 219) { + for (var parent_15 = declaration.parent; !ts.isFunctionBlock(parent_15); parent_15 = parent_15.parent) { + if (parent_15.kind === 256 || parent_15.kind === 226) { return false; } } @@ -37884,7 +42955,6 @@ var ts; function getDefaultCompilerOptions() { return { target: 1, - module: 0, jsx: 1 }; } @@ -37912,7 +42982,8 @@ var ts; entry = { hostFileName: fileName, version: this.host.getScriptVersion(fileName), - scriptSnapshot: scriptSnapshot + scriptSnapshot: scriptSnapshot, + scriptKind: ts.getScriptKind(fileName, this.host) }; } this.fileNameToEntry.set(path, entry); @@ -37926,10 +42997,12 @@ var ts; }; HostCache.prototype.getOrCreateEntry = function (fileName) { var path = ts.toPath(fileName, this.currentDirectory, this.getCanonicalFileName); - if (this.contains(path)) { - return this.getEntry(path); - } - return this.createEntry(fileName, path); + return this.getOrCreateEntryByPath(fileName, path); + }; + HostCache.prototype.getOrCreateEntryByPath = function (fileName, path) { + return this.contains(path) + ? this.getEntry(path) + : this.createEntry(fileName, path); }; HostCache.prototype.getRootFileNames = function () { var fileNames = []; @@ -37949,7 +43022,7 @@ var ts; return file && file.scriptSnapshot; }; return HostCache; - })(); + }()); var SyntaxTreeCache = (function () { function SyntaxTreeCache(host) { this.host = host; @@ -37959,10 +43032,11 @@ var ts; if (!scriptSnapshot) { throw new Error("Could not find file: '" + fileName + "'."); } + var scriptKind = ts.getScriptKind(fileName, this.host); var version = this.host.getScriptVersion(fileName); var sourceFile; if (this.currentFileName !== fileName) { - sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, 2, version, true); + sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, 2, version, true, scriptKind); } else if (this.currentFileVersion !== version) { var editRange = scriptSnapshot.getChangeRange(this.currentFileScriptSnapshot); @@ -37977,7 +43051,7 @@ var ts; return this.currentSourceFile; }; return SyntaxTreeCache; - })(); + }()); function setSourceFileFields(sourceFile, scriptSnapshot, version) { sourceFile.version = version; sourceFile.scriptSnapshot = scriptSnapshot; @@ -37985,6 +43059,7 @@ var ts; function transpileModule(input, transpileOptions) { var options = transpileOptions.compilerOptions ? ts.clone(transpileOptions.compilerOptions) : getDefaultCompilerOptions(); options.isolatedModules = true; + options.suppressOutputPathCheck = true; options.allowNonTsExtensions = true; options.noLib = true; options.noResolve = true; @@ -37998,14 +43073,14 @@ var ts; var outputText; var sourceMapText; var compilerHost = { - getSourceFile: function (fileName, target) { return fileName === ts.normalizeSlashes(inputFileName) ? sourceFile : undefined; }, + getSourceFile: function (fileName, target) { return fileName === ts.normalizePath(inputFileName) ? sourceFile : undefined; }, writeFile: function (name, text, writeByteOrderMark) { if (ts.fileExtensionIs(name, ".map")) { ts.Debug.assert(sourceMapText === undefined, "Unexpected multiple source map outputs for the file '" + name + "'"); sourceMapText = text; } else { - ts.Debug.assert(outputText === undefined, "Unexpected multiple outputs for the file: " + name); + ts.Debug.assert(outputText === undefined, "Unexpected multiple outputs for the file: '" + name + "'"); outputText = text; } }, @@ -38015,7 +43090,8 @@ var ts; getCurrentDirectory: function () { return ""; }, getNewLine: function () { return newLine; }, fileExists: function (fileName) { return fileName === inputFileName; }, - readFile: function (fileName) { return ""; } + readFile: function (fileName) { return ""; }, + directoryExists: function (directoryExists) { return true; } }; var program = ts.createProgram([inputFileName], options, compilerHost); var diagnostics; @@ -38035,11 +43111,10 @@ var ts; return output.outputText; } ts.transpile = transpile; - function createLanguageServiceSourceFile(fileName, scriptSnapshot, scriptTarget, version, setNodeParents) { + function createLanguageServiceSourceFile(fileName, scriptSnapshot, scriptTarget, version, setNodeParents, scriptKind) { var text = scriptSnapshot.getText(0, scriptSnapshot.getLength()); - var sourceFile = ts.createSourceFile(fileName, text, scriptTarget, setNodeParents); + var sourceFile = ts.createSourceFile(fileName, text, scriptTarget, setNodeParents, scriptKind); setSourceFileFields(sourceFile, scriptSnapshot, version); - sourceFile.nameTable = sourceFile.identifiers; return sourceFile; } ts.createLanguageServiceSourceFile = createLanguageServiceSourceFile; @@ -38048,7 +43123,7 @@ var ts; if (textChangeRange) { if (version !== sourceFile.version) { if (!ts.disableIncrementalParsing) { - var newText; + var newText = void 0; var prefix = textChangeRange.span.start !== 0 ? sourceFile.text.substr(0, textChangeRange.span.start) : ""; @@ -38079,24 +43154,17 @@ var ts; } } } - return createLanguageServiceSourceFile(sourceFile.fileName, scriptSnapshot, sourceFile.languageVersion, version, true); + return createLanguageServiceSourceFile(sourceFile.fileName, scriptSnapshot, sourceFile.languageVersion, version, true, sourceFile.scriptKind); } ts.updateLanguageServiceSourceFile = updateLanguageServiceSourceFile; - function createGetCanonicalFileName(useCaseSensitivefileNames) { - return useCaseSensitivefileNames - ? (function (fileName) { return fileName; }) - : (function (fileName) { return fileName.toLowerCase(); }); - } - ts.createGetCanonicalFileName = createGetCanonicalFileName; function createDocumentRegistry(useCaseSensitiveFileNames, currentDirectory) { if (currentDirectory === void 0) { currentDirectory = ""; } var buckets = {}; - var getCanonicalFileName = createGetCanonicalFileName(!!useCaseSensitiveFileNames); - function getKeyFromCompilationSettings(settings) { - return "_" + settings.target + "|" + settings.module + "|" + settings.noResolve + "|" + settings.jsx; + var getCanonicalFileName = ts.createGetCanonicalFileName(!!useCaseSensitiveFileNames); + function getKeyForCompilationSettings(settings) { + return ("_" + settings.target + "|" + settings.module + "|" + settings.noResolve + "|" + settings.jsx + "|" + settings.allowJs + "|" + settings.baseUrl + "|" + settings.typesRoot + "|" + settings.typesSearchPaths + "|" + JSON.stringify(settings.rootDirs) + "|" + JSON.stringify(settings.paths)); } - function getBucketForCompilationSettings(settings, createIfMissing) { - var key = getKeyFromCompilationSettings(settings); + function getBucketForCompilationSettings(key, createIfMissing) { var bucket = ts.lookUp(buckets, key); if (!bucket && createIfMissing) { buckets[key] = bucket = ts.createFileMap(); @@ -38104,7 +43172,7 @@ var ts; return bucket; } function reportStats() { - var bucketInfoArray = Object.keys(buckets).filter(function (name) { return name && name.charAt(0) === '_'; }).map(function (name) { + var bucketInfoArray = Object.keys(buckets).filter(function (name) { return name && name.charAt(0) === "_"; }).map(function (name) { var entries = ts.lookUp(buckets, name); var sourceFiles = []; entries.forEachValue(function (key, entry) { @@ -38120,21 +43188,30 @@ var ts; sourceFiles: sourceFiles }; }); - return JSON.stringify(bucketInfoArray, null, 2); + return JSON.stringify(bucketInfoArray, undefined, 2); } - function acquireDocument(fileName, compilationSettings, scriptSnapshot, version) { - return acquireOrUpdateDocument(fileName, compilationSettings, scriptSnapshot, version, true); - } - function updateDocument(fileName, compilationSettings, scriptSnapshot, version) { - return acquireOrUpdateDocument(fileName, compilationSettings, scriptSnapshot, version, false); - } - function acquireOrUpdateDocument(fileName, compilationSettings, scriptSnapshot, version, acquiring) { - var bucket = getBucketForCompilationSettings(compilationSettings, true); + function acquireDocument(fileName, compilationSettings, scriptSnapshot, version, scriptKind) { var path = ts.toPath(fileName, currentDirectory, getCanonicalFileName); + var key = getKeyForCompilationSettings(compilationSettings); + return acquireDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind); + } + function acquireDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind) { + return acquireOrUpdateDocument(fileName, path, compilationSettings, key, scriptSnapshot, version, true, scriptKind); + } + function updateDocument(fileName, compilationSettings, scriptSnapshot, version, scriptKind) { + var path = ts.toPath(fileName, currentDirectory, getCanonicalFileName); + var key = getKeyForCompilationSettings(compilationSettings); + return updateDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind); + } + function updateDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind) { + return acquireOrUpdateDocument(fileName, path, compilationSettings, key, scriptSnapshot, version, false, scriptKind); + } + function acquireOrUpdateDocument(fileName, path, compilationSettings, key, scriptSnapshot, version, acquiring, scriptKind) { + var bucket = getBucketForCompilationSettings(key, true); var entry = bucket.get(path); if (!entry) { ts.Debug.assert(acquiring, "How could we be trying to update a document that the registry doesn't have?"); - var sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, compilationSettings.target, version, false); + var sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, compilationSettings.target, version, false, scriptKind); entry = { sourceFile: sourceFile, languageServiceRefCount: 0, @@ -38153,9 +43230,13 @@ var ts; return entry.sourceFile; } function releaseDocument(fileName, compilationSettings) { - var bucket = getBucketForCompilationSettings(compilationSettings, false); - ts.Debug.assert(bucket !== undefined); var path = ts.toPath(fileName, currentDirectory, getCanonicalFileName); + var key = getKeyForCompilationSettings(compilationSettings); + return releaseDocumentWithKey(path, key); + } + function releaseDocumentWithKey(path, key) { + var bucket = getBucketForCompilationSettings(key, false); + ts.Debug.assert(bucket !== undefined); var entry = bucket.get(path); entry.languageServiceRefCount--; ts.Debug.assert(entry.languageServiceRefCount >= 0); @@ -38165,9 +43246,13 @@ var ts; } return { acquireDocument: acquireDocument, + acquireDocumentWithKey: acquireDocumentWithKey, updateDocument: updateDocument, + updateDocumentWithKey: updateDocumentWithKey, releaseDocument: releaseDocument, - reportStats: reportStats + releaseDocumentWithKey: releaseDocumentWithKey, + reportStats: reportStats, + getKeyForCompilationSettings: getKeyForCompilationSettings }; } ts.createDocumentRegistry = createDocumentRegistry; @@ -38175,9 +43260,22 @@ var ts; if (readImportFiles === void 0) { readImportFiles = true; } if (detectJavaScriptImports === void 0) { detectJavaScriptImports = false; } var referencedFiles = []; + var typeReferenceDirectives = []; var importedFiles = []; var ambientExternalModules; var isNoDefaultLib = false; + var braceNesting = 0; + var externalModule = false; + function nextToken() { + var token = scanner.scan(); + if (token === 15) { + braceNesting++; + } + else if (token === 16) { + braceNesting--; + } + return token; + } function processTripleSlashDirectives() { var commentRanges = ts.getLeadingCommentRanges(sourceText, 0); ts.forEach(commentRanges, function (commentRange) { @@ -38187,32 +43285,44 @@ var ts; isNoDefaultLib = referencePathMatchResult.isNoDefaultLib; var fileReference = referencePathMatchResult.fileReference; if (fileReference) { - referencedFiles.push(fileReference); + var collection = referencePathMatchResult.isTypeReferenceDirective + ? typeReferenceDirectives + : referencedFiles; + collection.push(fileReference); } } }); } + function getFileReference() { + var file = scanner.getTokenValue(); + var pos = scanner.getTokenPos(); + return { + fileName: file, + pos: pos, + end: pos + file.length + }; + } function recordAmbientExternalModule() { if (!ambientExternalModules) { ambientExternalModules = []; } - ambientExternalModules.push(scanner.getTokenValue()); + ambientExternalModules.push({ ref: getFileReference(), depth: braceNesting }); } function recordModuleName() { - var importPath = scanner.getTokenValue(); - var pos = scanner.getTokenPos(); - importedFiles.push({ - fileName: importPath, - pos: pos, - end: pos + importPath.length - }); + importedFiles.push(getFileReference()); + markAsExternalModuleIfTopLevel(); + } + function markAsExternalModuleIfTopLevel() { + if (braceNesting === 0) { + externalModule = true; + } } function tryConsumeDeclare() { var token = scanner.getToken(); if (token === 122) { - token = scanner.scan(); + token = nextToken(); if (token === 125) { - token = scanner.scan(); + token = nextToken(); if (token === 9) { recordAmbientExternalModule(); } @@ -38224,16 +43334,16 @@ var ts; function tryConsumeImport() { var token = scanner.getToken(); if (token === 89) { - token = scanner.scan(); + token = nextToken(); if (token === 9) { recordModuleName(); return true; } else { if (token === 69 || ts.isKeyword(token)) { - token = scanner.scan(); - if (token === 133) { - token = scanner.scan(); + token = nextToken(); + if (token === 136) { + token = nextToken(); if (token === 9) { recordModuleName(); return true; @@ -38245,21 +43355,21 @@ var ts; } } else if (token === 24) { - token = scanner.scan(); + token = nextToken(); } else { return true; } } if (token === 15) { - token = scanner.scan(); + token = nextToken(); while (token !== 16 && token !== 1) { - token = scanner.scan(); + token = nextToken(); } if (token === 16) { - token = scanner.scan(); - if (token === 133) { - token = scanner.scan(); + token = nextToken(); + if (token === 136) { + token = nextToken(); if (token === 9) { recordModuleName(); } @@ -38267,13 +43377,13 @@ var ts; } } else if (token === 37) { - token = scanner.scan(); + token = nextToken(); if (token === 116) { - token = scanner.scan(); + token = nextToken(); if (token === 69 || ts.isKeyword(token)) { - token = scanner.scan(); - if (token === 133) { - token = scanner.scan(); + token = nextToken(); + if (token === 136) { + token = nextToken(); if (token === 9) { recordModuleName(); } @@ -38289,16 +43399,17 @@ var ts; function tryConsumeExport() { var token = scanner.getToken(); if (token === 82) { - token = scanner.scan(); + markAsExternalModuleIfTopLevel(); + token = nextToken(); if (token === 15) { - token = scanner.scan(); + token = nextToken(); while (token !== 16 && token !== 1) { - token = scanner.scan(); + token = nextToken(); } if (token === 16) { - token = scanner.scan(); - if (token === 133) { - token = scanner.scan(); + token = nextToken(); + if (token === 136) { + token = nextToken(); if (token === 9) { recordModuleName(); } @@ -38306,18 +43417,18 @@ var ts; } } else if (token === 37) { - token = scanner.scan(); - if (token === 133) { - token = scanner.scan(); + token = nextToken(); + if (token === 136) { + token = nextToken(); if (token === 9) { recordModuleName(); } } } else if (token === 89) { - token = scanner.scan(); + token = nextToken(); if (token === 69 || ts.isKeyword(token)) { - token = scanner.scan(); + token = nextToken(); if (token === 56) { if (tryConsumeRequireCall(true)) { return true; @@ -38330,11 +43441,11 @@ var ts; return false; } function tryConsumeRequireCall(skipCurrentToken) { - var token = skipCurrentToken ? scanner.scan() : scanner.getToken(); - if (token === 127) { - token = scanner.scan(); + var token = skipCurrentToken ? nextToken() : scanner.getToken(); + if (token === 129) { + token = nextToken(); if (token === 17) { - token = scanner.scan(); + token = nextToken(); if (token === 9) { recordModuleName(); } @@ -38346,15 +43457,15 @@ var ts; function tryConsumeDefine() { var token = scanner.getToken(); if (token === 69 && scanner.getTokenValue() === "define") { - token = scanner.scan(); + token = nextToken(); if (token !== 17) { return true; } - token = scanner.scan(); + token = nextToken(); if (token === 9) { - token = scanner.scan(); + token = nextToken(); if (token === 24) { - token = scanner.scan(); + token = nextToken(); } else { return true; @@ -38363,14 +43474,14 @@ var ts; if (token !== 19) { return true; } - token = scanner.scan(); + token = nextToken(); var i = 0; while (token !== 20 && token !== 1) { if (token === 9) { recordModuleName(); i++; } - token = scanner.scan(); + token = nextToken(); } return true; } @@ -38378,7 +43489,7 @@ var ts; } function processImports() { scanner.setText(sourceText); - scanner.scan(); + nextToken(); while (true) { if (scanner.getToken() === 1) { break; @@ -38390,7 +43501,7 @@ var ts; continue; } else { - scanner.scan(); + nextToken(); } } scanner.setText(undefined); @@ -38399,12 +43510,38 @@ var ts; processImports(); } processTripleSlashDirectives(); - return { referencedFiles: referencedFiles, importedFiles: importedFiles, isLibFile: isNoDefaultLib, ambientExternalModules: ambientExternalModules }; + if (externalModule) { + if (ambientExternalModules) { + for (var _i = 0, ambientExternalModules_1 = ambientExternalModules; _i < ambientExternalModules_1.length; _i++) { + var decl = ambientExternalModules_1[_i]; + importedFiles.push(decl.ref); + } + } + return { referencedFiles: referencedFiles, typeReferenceDirectives: typeReferenceDirectives, importedFiles: importedFiles, isLibFile: isNoDefaultLib, ambientExternalModules: undefined }; + } + else { + var ambientModuleNames = void 0; + if (ambientExternalModules) { + for (var _a = 0, ambientExternalModules_2 = ambientExternalModules; _a < ambientExternalModules_2.length; _a++) { + var decl = ambientExternalModules_2[_a]; + if (decl.depth === 0) { + if (!ambientModuleNames) { + ambientModuleNames = []; + } + ambientModuleNames.push(decl.ref.fileName); + } + else { + importedFiles.push(decl.ref); + } + } + } + return { referencedFiles: referencedFiles, typeReferenceDirectives: typeReferenceDirectives, importedFiles: importedFiles, isLibFile: isNoDefaultLib, ambientExternalModules: ambientModuleNames }; + } } ts.preProcessFile = preProcessFile; function getTargetLabel(referenceNode, labelName) { while (referenceNode) { - if (referenceNode.kind === 207 && referenceNode.label.text === labelName) { + if (referenceNode.kind === 214 && referenceNode.label.text === labelName) { return referenceNode.label; } referenceNode = referenceNode.parent; @@ -38413,16 +43550,16 @@ var ts; } function isJumpStatementTarget(node) { return node.kind === 69 && - (node.parent.kind === 203 || node.parent.kind === 202) && + (node.parent.kind === 210 || node.parent.kind === 209) && node.parent.label === node; } function isLabelOfLabeledStatement(node) { return node.kind === 69 && - node.parent.kind === 207 && + node.parent.kind === 214 && node.parent.label === node; } function isLabeledBy(node, labelName) { - for (var owner = node.parent; owner.kind === 207; owner = owner.parent) { + for (var owner = node.parent; owner.kind === 214; owner = owner.parent) { if (owner.label.text === labelName) { return true; } @@ -38433,49 +43570,70 @@ var ts; return isLabelOfLabeledStatement(node) || isJumpStatementTarget(node); } function isRightSideOfQualifiedName(node) { - return node.parent.kind === 135 && node.parent.right === node; + return node.parent.kind === 139 && node.parent.right === node; } function isRightSideOfPropertyAccess(node) { - return node && node.parent && node.parent.kind === 166 && node.parent.name === node; + return node && node.parent && node.parent.kind === 172 && node.parent.name === node; } function isCallExpressionTarget(node) { if (isRightSideOfPropertyAccess(node)) { node = node.parent; } - return node && node.parent && node.parent.kind === 168 && node.parent.expression === node; + return node && node.parent && node.parent.kind === 174 && node.parent.expression === node; } function isNewExpressionTarget(node) { if (isRightSideOfPropertyAccess(node)) { node = node.parent; } - return node && node.parent && node.parent.kind === 169 && node.parent.expression === node; + return node && node.parent && node.parent.kind === 175 && node.parent.expression === node; } function isNameOfModuleDeclaration(node) { - return node.parent.kind === 218 && node.parent.name === node; + return node.parent.kind === 225 && node.parent.name === node; } function isNameOfFunctionDeclaration(node) { return node.kind === 69 && ts.isFunctionLike(node.parent) && node.parent.name === node; } - function isNameOfPropertyAssignment(node) { - return (node.kind === 69 || node.kind === 9 || node.kind === 8) && - (node.parent.kind === 245 || node.parent.kind === 246) && node.parent.name === node; + function isObjectLiteralPropertyDeclaration(node) { + switch (node.kind) { + case 253: + case 254: + case 147: + case 149: + case 150: + return true; + } + return false; + } + function getContainingObjectLiteralElement(node) { + switch (node.kind) { + case 9: + case 8: + if (node.parent.kind === 140) { + return isObjectLiteralPropertyDeclaration(node.parent.parent) ? node.parent.parent : undefined; + } + case 69: + return isObjectLiteralPropertyDeclaration(node.parent) && node.parent.name === node ? node.parent : undefined; + } + return undefined; } function isLiteralNameOfPropertyDeclarationOrIndexAccess(node) { if (node.kind === 9 || node.kind === 8) { switch (node.parent.kind) { - case 141: - case 140: - case 245: - case 247: - case 143: - case 142: case 145: + case 144: + case 253: + case 255: + case 147: case 146: - case 218: + case 149: + case 150: + case 225: return node.parent.name === node; - case 167: + case 173: return node.parent.argumentExpression === node; + case 140: + return true; } } return false; @@ -38512,7 +43670,7 @@ var ts; } } var keywordCompletions = []; - for (var i = 70; i <= 134; i++) { + for (var i = 70; i <= 138; i++) { keywordCompletions.push({ name: ts.tokenToString(i), kind: ScriptElementKind.keyword, @@ -38527,17 +43685,17 @@ var ts; return undefined; } switch (node.kind) { - case 248: - case 143: - case 142: - case 213: - case 173: - case 145: + case 256: + case 147: case 146: - case 214: - case 215: - case 217: - case 218: + case 220: + case 179: + case 149: + case 150: + case 221: + case 222: + case 224: + case 225: return node; } } @@ -38545,38 +43703,42 @@ var ts; ts.getContainerNode = getContainerNode; function getNodeKind(node) { switch (node.kind) { - case 218: return ScriptElementKind.moduleElement; - case 214: return ScriptElementKind.classElement; - case 215: return ScriptElementKind.interfaceElement; - case 216: return ScriptElementKind.typeElement; - case 217: return ScriptElementKind.enumElement; - case 211: + case 225: return ScriptElementKind.moduleElement; + case 221: + case 192: + return ScriptElementKind.classElement; + case 222: return ScriptElementKind.interfaceElement; + case 223: return ScriptElementKind.typeElement; + case 224: return ScriptElementKind.enumElement; + case 218: return ts.isConst(node) ? ScriptElementKind.constElement : ts.isLet(node) ? ScriptElementKind.letElement : ScriptElementKind.variableElement; - case 213: return ScriptElementKind.functionElement; - case 145: return ScriptElementKind.memberGetAccessorElement; - case 146: return ScriptElementKind.memberSetAccessorElement; - case 143: - case 142: + case 220: + case 179: + return ScriptElementKind.functionElement; + case 149: return ScriptElementKind.memberGetAccessorElement; + case 150: return ScriptElementKind.memberSetAccessorElement; + case 147: + case 146: return ScriptElementKind.memberFunctionElement; - case 141: - case 140: + case 145: + case 144: return ScriptElementKind.memberVariableElement; - case 149: return ScriptElementKind.indexSignatureElement; - case 148: return ScriptElementKind.constructSignatureElement; - case 147: return ScriptElementKind.callSignatureElement; - case 144: return ScriptElementKind.constructorImplementationElement; - case 137: return ScriptElementKind.typeParameterElement; - case 247: return ScriptElementKind.variableElement; - case 138: return (node.flags & 56) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; - case 221: - case 226: - case 223: - case 230: - case 224: + case 153: return ScriptElementKind.indexSignatureElement; + case 152: return ScriptElementKind.constructSignatureElement; + case 151: return ScriptElementKind.callSignatureElement; + case 148: return ScriptElementKind.constructorImplementationElement; + case 141: return ScriptElementKind.typeParameterElement; + case 255: return ScriptElementKind.variableElement; + case 142: return (node.flags & 92) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; + case 229: + case 234: + case 231: + case 238: + case 232: return ScriptElementKind.alias; } return ScriptElementKind.unknown; @@ -38595,7 +43757,7 @@ var ts; } }; return CancellationTokenObject; - })(); + }()); function createLanguageService(host, documentRegistry) { if (documentRegistry === void 0) { documentRegistry = createDocumentRegistry(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames(), host.getCurrentDirectory()); } var syntaxTreeCache = new SyntaxTreeCache(host); @@ -38613,7 +43775,7 @@ var ts; host.log(message); } } - var getCanonicalFileName = createGetCanonicalFileName(useCaseSensitivefileNames); + var getCanonicalFileName = ts.createGetCanonicalFileName(useCaseSensitivefileNames); function getValidSourceFile(fileName) { var sourceFile = program.getSourceFile(fileName); if (!sourceFile) { @@ -38648,9 +43810,11 @@ var ts; (oldSettings.target !== newSettings.target || oldSettings.module !== newSettings.module || oldSettings.noResolve !== newSettings.noResolve || - oldSettings.jsx !== newSettings.jsx); + oldSettings.jsx !== newSettings.jsx || + oldSettings.allowJs !== newSettings.allowJs); var compilerHost = { getSourceFile: getOrCreateSourceFile, + getSourceFileByPath: getOrCreateSourceFileByPath, getCancellationToken: function () { return cancellationToken; }, getCanonicalFileName: getCanonicalFileName, useCaseSensitiveFileNames: function () { return useCaseSensitivefileNames; }, @@ -38659,24 +43823,38 @@ var ts; writeFile: function (fileName, data, writeByteOrderMark) { }, getCurrentDirectory: function () { return currentDirectory; }, fileExists: function (fileName) { - ts.Debug.assert(!host.resolveModuleNames); + ts.Debug.assert(!host.resolveModuleNames || !host.resolveTypeReferenceDirectives); return hostCache.getOrCreateEntry(fileName) !== undefined; }, readFile: function (fileName) { var entry = hostCache.getOrCreateEntry(fileName); return entry && entry.scriptSnapshot.getText(0, entry.scriptSnapshot.getLength()); + }, + directoryExists: function (directoryName) { + ts.Debug.assert(!host.resolveModuleNames || !host.resolveTypeReferenceDirectives); + return ts.directoryProbablyExists(directoryName, host); } }; + if (host.trace) { + compilerHost.trace = function (message) { return host.trace(message); }; + } if (host.resolveModuleNames) { compilerHost.resolveModuleNames = function (moduleNames, containingFile) { return host.resolveModuleNames(moduleNames, containingFile); }; } + if (host.resolveTypeReferenceDirectives) { + compilerHost.resolveTypeReferenceDirectives = function (typeReferenceDirectiveNames, containingFile) { + return host.resolveTypeReferenceDirectives(typeReferenceDirectiveNames, containingFile); + }; + } + var documentRegistryBucketKey = documentRegistry.getKeyForCompilationSettings(newSettings); var newProgram = ts.createProgram(hostCache.getRootFileNames(), newSettings, compilerHost, program); if (program) { var oldSourceFiles = program.getSourceFiles(); + var oldSettingsKey = documentRegistry.getKeyForCompilationSettings(oldSettings); for (var _i = 0, oldSourceFiles_1 = oldSourceFiles; _i < oldSourceFiles_1.length; _i++) { var oldSourceFile = oldSourceFiles_1[_i]; if (!newProgram.getSourceFile(oldSourceFile.fileName) || changesInCompilationSettingsAffectSyntax) { - documentRegistry.releaseDocument(oldSourceFile.fileName, oldSettings); + documentRegistry.releaseDocumentWithKey(oldSourceFile.path, oldSettingsKey); } } } @@ -38685,22 +43863,29 @@ var ts; program.getTypeChecker(); return; function getOrCreateSourceFile(fileName) { + return getOrCreateSourceFileByPath(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName)); + } + function getOrCreateSourceFileByPath(fileName, path) { ts.Debug.assert(hostCache !== undefined); - var hostFileInformation = hostCache.getOrCreateEntry(fileName); + var hostFileInformation = hostCache.getOrCreateEntryByPath(fileName, path); if (!hostFileInformation) { return undefined; } if (!changesInCompilationSettingsAffectSyntax) { - var oldSourceFile = program && program.getSourceFile(fileName); + var oldSourceFile = program && program.getSourceFileByPath(path); if (oldSourceFile) { - return documentRegistry.updateDocument(fileName, newSettings, hostFileInformation.scriptSnapshot, hostFileInformation.version); + ts.Debug.assert(hostFileInformation.scriptKind === oldSourceFile.scriptKind, "Registered script kind (" + oldSourceFile.scriptKind + ") should match new script kind (" + hostFileInformation.scriptKind + ") for file: " + path); + return documentRegistry.updateDocumentWithKey(fileName, path, newSettings, documentRegistryBucketKey, hostFileInformation.scriptSnapshot, hostFileInformation.version, hostFileInformation.scriptKind); } } - return documentRegistry.acquireDocument(fileName, newSettings, hostFileInformation.scriptSnapshot, hostFileInformation.version); + return documentRegistry.acquireDocumentWithKey(fileName, path, newSettings, documentRegistryBucketKey, hostFileInformation.scriptSnapshot, hostFileInformation.version, hostFileInformation.scriptKind); } function sourceFileUpToDate(sourceFile) { + if (!sourceFile) { + return false; + } var path = sourceFile.path || ts.toPath(sourceFile.fileName, currentDirectory, getCanonicalFileName); - return sourceFile && sourceFile.version === hostCache.getVersion(path); + return sourceFile.version === hostCache.getVersion(path); } function programUpToDate() { if (!program) { @@ -38739,9 +43924,6 @@ var ts; function getSemanticDiagnostics(fileName) { synchronizeHostData(); var targetSourceFile = getValidSourceFile(fileName); - if (ts.isSourceFileJavaScript(targetSourceFile)) { - return getJavaScriptSemanticDiagnostics(targetSourceFile); - } var semanticDiagnostics = program.getSemanticDiagnostics(targetSourceFile, cancellationToken); if (!program.getCompilerOptions().declaration) { return semanticDiagnostics; @@ -38749,150 +43931,6 @@ var ts; var declarationDiagnostics = program.getDeclarationDiagnostics(targetSourceFile, cancellationToken); return ts.concatenate(semanticDiagnostics, declarationDiagnostics); } - function getJavaScriptSemanticDiagnostics(sourceFile) { - var diagnostics = []; - walk(sourceFile); - return diagnostics; - function walk(node) { - if (!node) { - return false; - } - switch (node.kind) { - case 221: - diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_a_ts_file)); - return true; - case 227: - diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.export_can_only_be_used_in_a_ts_file)); - return true; - case 214: - var classDeclaration = node; - if (checkModifiers(classDeclaration.modifiers) || - checkTypeParameters(classDeclaration.typeParameters)) { - return true; - } - break; - case 243: - var heritageClause = node; - if (heritageClause.token === 106) { - diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_a_ts_file)); - return true; - } - break; - case 215: - diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.interface_declarations_can_only_be_used_in_a_ts_file)); - return true; - case 218: - diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.module_declarations_can_only_be_used_in_a_ts_file)); - return true; - case 216: - diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.type_aliases_can_only_be_used_in_a_ts_file)); - return true; - case 143: - case 142: - case 144: - case 145: - case 146: - case 173: - case 213: - case 174: - case 213: - var functionDeclaration = node; - if (checkModifiers(functionDeclaration.modifiers) || - checkTypeParameters(functionDeclaration.typeParameters) || - checkTypeAnnotation(functionDeclaration.type)) { - return true; - } - break; - case 193: - var variableStatement = node; - if (checkModifiers(variableStatement.modifiers)) { - return true; - } - break; - case 211: - var variableDeclaration = node; - if (checkTypeAnnotation(variableDeclaration.type)) { - return true; - } - break; - case 168: - case 169: - var expression = node; - if (expression.typeArguments && expression.typeArguments.length > 0) { - var start = expression.typeArguments.pos; - diagnostics.push(ts.createFileDiagnostic(sourceFile, start, expression.typeArguments.end - start, ts.Diagnostics.type_arguments_can_only_be_used_in_a_ts_file)); - return true; - } - break; - case 138: - var parameter = node; - if (parameter.modifiers) { - var start = parameter.modifiers.pos; - diagnostics.push(ts.createFileDiagnostic(sourceFile, start, parameter.modifiers.end - start, ts.Diagnostics.parameter_modifiers_can_only_be_used_in_a_ts_file)); - return true; - } - if (parameter.questionToken) { - diagnostics.push(ts.createDiagnosticForNode(parameter.questionToken, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, '?')); - return true; - } - if (parameter.type) { - diagnostics.push(ts.createDiagnosticForNode(parameter.type, ts.Diagnostics.types_can_only_be_used_in_a_ts_file)); - return true; - } - break; - case 141: - diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.property_declarations_can_only_be_used_in_a_ts_file)); - return true; - case 217: - diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.enum_declarations_can_only_be_used_in_a_ts_file)); - return true; - case 171: - var typeAssertionExpression = node; - diagnostics.push(ts.createDiagnosticForNode(typeAssertionExpression.type, ts.Diagnostics.type_assertion_expressions_can_only_be_used_in_a_ts_file)); - return true; - case 139: - diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.decorators_can_only_be_used_in_a_ts_file)); - return true; - } - return ts.forEachChild(node, walk); - } - function checkTypeParameters(typeParameters) { - if (typeParameters) { - var start = typeParameters.pos; - diagnostics.push(ts.createFileDiagnostic(sourceFile, start, typeParameters.end - start, ts.Diagnostics.type_parameter_declarations_can_only_be_used_in_a_ts_file)); - return true; - } - return false; - } - function checkTypeAnnotation(type) { - if (type) { - diagnostics.push(ts.createDiagnosticForNode(type, ts.Diagnostics.types_can_only_be_used_in_a_ts_file)); - return true; - } - return false; - } - function checkModifiers(modifiers) { - if (modifiers) { - for (var _i = 0, modifiers_1 = modifiers; _i < modifiers_1.length; _i++) { - var modifier = modifiers_1[_i]; - switch (modifier.kind) { - case 112: - case 110: - case 111: - case 122: - diagnostics.push(ts.createDiagnosticForNode(modifier, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, ts.tokenToString(modifier.kind))); - return true; - case 113: - case 82: - case 74: - case 77: - case 115: - } - } - } - return false; - } - } function getCompilerOptionsDiagnostics() { synchronizeHostData(); return program.getOptionsDiagnostics(cancellationToken).concat(program.getGlobalDiagnostics(cancellationToken)); @@ -38916,20 +43954,14 @@ var ts; return undefined; } if (performCharacterChecks) { - if (!ts.isIdentifierStart(name.charCodeAt(0), target)) { + if (!ts.isIdentifier(name, target)) { return undefined; } - for (var i = 1, n = name.length; i < n; i++) { - if (!ts.isIdentifierPart(name.charCodeAt(i), target)) { - return undefined; - } - } } return name; } function getCompletionData(fileName, position) { var typeChecker = program.getTypeChecker(); - var syntacticStart = new Date().getTime(); var sourceFile = getValidSourceFile(fileName); var isJavaScriptFile = ts.isSourceFileJavaScript(sourceFile); var isJsDocTagName = false; @@ -38950,9 +43982,9 @@ var ts; isJsDocTagName = true; } switch (tag.kind) { - case 269: - case 267: - case 268: + case 277: + case 275: + case 276: var tagWithExpression = tag; if (tagWithExpression.typeExpression) { insideJsDocTagExpression = tagWithExpression.typeExpression.pos < position && position < tagWithExpression.typeExpression.end; @@ -38973,9 +44005,9 @@ var ts; log("getCompletionData: Get previous token 1: " + (new Date().getTime() - start)); var contextToken = previousToken; if (contextToken && position <= contextToken.end && ts.isWord(contextToken.kind)) { - var start_3 = new Date().getTime(); + var start_6 = new Date().getTime(); contextToken = ts.findPrecedingToken(contextToken.getFullStart(), sourceFile); - log("getCompletionData: Get previous token 2: " + (new Date().getTime() - start_3)); + log("getCompletionData: Get previous token 2: " + (new Date().getTime() - start_6)); } var node = currentToken; var isRightOfDot = false; @@ -38987,13 +44019,13 @@ var ts; log("Returning an empty list because completion was requested in an invalid position."); return undefined; } - var parent_9 = contextToken.parent, kind = contextToken.kind; + var parent_16 = contextToken.parent, kind = contextToken.kind; if (kind === 21) { - if (parent_9.kind === 166) { + if (parent_16.kind === 172) { node = contextToken.parent.expression; isRightOfDot = true; } - else if (parent_9.kind === 135) { + else if (parent_16.kind === 139) { node = contextToken.parent.left; isRightOfDot = true; } @@ -39006,8 +44038,9 @@ var ts; isRightOfOpenTag = true; location = contextToken; } - else if (kind === 39 && contextToken.parent.kind === 237) { + else if (kind === 39 && contextToken.parent.kind === 245) { isStartingCloseTag = true; + location = contextToken; } } } @@ -39021,7 +44054,7 @@ var ts; else if (isRightOfOpenTag) { var tagSymbols = typeChecker.getJsxIntrinsicTagNames(); if (tryGetGlobalSymbols()) { - symbols = tagSymbols.concat(symbols.filter(function (s) { return !!(s.flags & 107455); })); + symbols = tagSymbols.concat(symbols.filter(function (s) { return !!(s.flags & (107455 | 8388608)); })); } else { symbols = tagSymbols; @@ -39031,7 +44064,10 @@ var ts; } else if (isStartingCloseTag) { var tagName = contextToken.parent.parent.openingElement.tagName; - symbols = [typeChecker.getSymbolAtLocation(tagName)]; + var tagSymbol = typeChecker.getSymbolAtLocation(tagName); + if (!typeChecker.isUnknownSymbol(tagSymbol)) { + symbols = [tagSymbol]; + } isMemberCompletion = true; isNewIdentifierLocation = false; } @@ -39045,7 +44081,7 @@ var ts; function getTypeScriptMemberSymbols() { isMemberCompletion = true; isNewIdentifierLocation = false; - if (node.kind === 69 || node.kind === 135 || node.kind === 166) { + if (node.kind === 69 || node.kind === 139 || node.kind === 172) { var symbol = typeChecker.getSymbolAtLocation(node); if (symbol && symbol.flags & 8388608) { symbol = typeChecker.getAliasedSymbol(symbol); @@ -39090,8 +44126,8 @@ var ts; return tryGetImportOrExportClauseCompletionSymbols(namedImportsOrExports); } if (jsxContainer = tryGetContainingJsxElement(contextToken)) { - var attrsType; - if ((jsxContainer.kind === 234) || (jsxContainer.kind === 235)) { + var attrsType = void 0; + if ((jsxContainer.kind === 242) || (jsxContainer.kind === 243)) { attrsType = typeChecker.getJsxElementAttributesType(jsxContainer); if (attrsType) { symbols = filterJsxAttributes(typeChecker.getPropertiesOfType(attrsType), jsxContainer.attributes); @@ -39131,15 +44167,15 @@ var ts; return result; } function isInJsxText(contextToken) { - if (contextToken.kind === 236) { + if (contextToken.kind === 244) { return true; } if (contextToken.kind === 27 && contextToken.parent) { - if (contextToken.parent.kind === 235) { + if (contextToken.parent.kind === 243) { return true; } - if (contextToken.parent.kind === 237 || contextToken.parent.kind === 234) { - return contextToken.parent.parent && contextToken.parent.parent.kind === 233; + if (contextToken.parent.kind === 245 || contextToken.parent.kind === 242) { + return contextToken.parent.parent && contextToken.parent.parent.kind === 241; } } return false; @@ -39149,40 +44185,40 @@ var ts; var containingNodeKind = previousToken.parent.kind; switch (previousToken.kind) { case 24: - return containingNodeKind === 168 - || containingNodeKind === 144 - || containingNodeKind === 169 - || containingNodeKind === 164 - || containingNodeKind === 181 - || containingNodeKind === 152; + return containingNodeKind === 174 + || containingNodeKind === 148 + || containingNodeKind === 175 + || containingNodeKind === 170 + || containingNodeKind === 187 + || containingNodeKind === 156; case 17: - return containingNodeKind === 168 - || containingNodeKind === 144 - || containingNodeKind === 169 - || containingNodeKind === 172 - || containingNodeKind === 160; + return containingNodeKind === 174 + || containingNodeKind === 148 + || containingNodeKind === 175 + || containingNodeKind === 178 + || containingNodeKind === 164; case 19: - return containingNodeKind === 164 - || containingNodeKind === 149 - || containingNodeKind === 136; + return containingNodeKind === 170 + || containingNodeKind === 153 + || containingNodeKind === 140; case 125: case 126: return true; case 21: - return containingNodeKind === 218; + return containingNodeKind === 225; case 15: - return containingNodeKind === 214; + return containingNodeKind === 221; case 56: - return containingNodeKind === 211 - || containingNodeKind === 181; + return containingNodeKind === 218 + || containingNodeKind === 187; case 12: - return containingNodeKind === 183; + return containingNodeKind === 189; case 13: - return containingNodeKind === 190; + return containingNodeKind === 197; case 112: case 110: case 111: - return containingNodeKind === 141; + return containingNodeKind === 145; } switch (previousToken.getText()) { case "public": @@ -39195,11 +44231,12 @@ var ts; } function isInStringOrRegularExpressionOrTemplateLiteral(contextToken) { if (contextToken.kind === 9 + || contextToken.kind === 166 || contextToken.kind === 10 || ts.isTemplateLiteralKind(contextToken.kind)) { - var start_4 = contextToken.getStart(); + var start_7 = contextToken.getStart(); var end = contextToken.getEnd(); - if (start_4 < position && position < end) { + if (start_7 < position && position < end) { return true; } if (position === end) { @@ -39213,16 +44250,25 @@ var ts; isMemberCompletion = true; var typeForObject; var existingMembers; - if (objectLikeContainer.kind === 165) { + if (objectLikeContainer.kind === 171) { isNewIdentifierLocation = true; typeForObject = typeChecker.getContextualType(objectLikeContainer); existingMembers = objectLikeContainer.properties; } - else if (objectLikeContainer.kind === 161) { + else if (objectLikeContainer.kind === 167) { isNewIdentifierLocation = false; var rootDeclaration = ts.getRootDeclaration(objectLikeContainer.parent); if (ts.isVariableLike(rootDeclaration)) { - if (rootDeclaration.initializer || rootDeclaration.type) { + var canGetType = !!(rootDeclaration.initializer || rootDeclaration.type); + if (!canGetType && rootDeclaration.kind === 142) { + if (ts.isExpression(rootDeclaration.parent)) { + canGetType = !!typeChecker.getContextualType(rootDeclaration.parent); + } + else if (rootDeclaration.parent.kind === 147 || rootDeclaration.parent.kind === 150) { + canGetType = ts.isExpression(rootDeclaration.parent.parent) && !!typeChecker.getContextualType(rootDeclaration.parent.parent); + } + } + if (canGetType) { typeForObject = typeChecker.getTypeAtLocation(objectLikeContainer); existingMembers = objectLikeContainer.elements; } @@ -39244,9 +44290,9 @@ var ts; return true; } function tryGetImportOrExportClauseCompletionSymbols(namedImportsOrExports) { - var declarationKind = namedImportsOrExports.kind === 225 ? - 222 : - 228; + var declarationKind = namedImportsOrExports.kind === 233 ? + 230 : + 236; var importOrExportDeclaration = ts.getAncestor(namedImportsOrExports, declarationKind); var moduleSpecifier = importOrExportDeclaration.moduleSpecifier; if (!moduleSpecifier) { @@ -39267,9 +44313,9 @@ var ts; switch (contextToken.kind) { case 15: case 24: - var parent_10 = contextToken.parent; - if (parent_10 && (parent_10.kind === 165 || parent_10.kind === 161)) { - return parent_10; + var parent_17 = contextToken.parent; + if (parent_17 && (parent_17.kind === 171 || parent_17.kind === 167)) { + return parent_17; } break; } @@ -39282,8 +44328,8 @@ var ts; case 15: case 24: switch (contextToken.parent.kind) { - case 225: - case 229: + case 233: + case 237: return contextToken.parent; } } @@ -39292,34 +44338,34 @@ var ts; } function tryGetContainingJsxElement(contextToken) { if (contextToken) { - var parent_11 = contextToken.parent; + var parent_18 = contextToken.parent; switch (contextToken.kind) { case 26: case 39: case 69: - case 238: - case 239: - if (parent_11 && (parent_11.kind === 234 || parent_11.kind === 235)) { - return parent_11; + case 246: + case 247: + if (parent_18 && (parent_18.kind === 242 || parent_18.kind === 243)) { + return parent_18; } - else if (parent_11.kind === 238) { - return parent_11.parent; + else if (parent_18.kind === 246) { + return parent_18.parent; } break; case 9: - if (parent_11 && ((parent_11.kind === 238) || (parent_11.kind === 239))) { - return parent_11.parent; + if (parent_18 && ((parent_18.kind === 246) || (parent_18.kind === 247))) { + return parent_18.parent; } break; case 16: - if (parent_11 && - parent_11.kind === 240 && - parent_11.parent && - (parent_11.parent.kind === 238)) { - return parent_11.parent.parent; + if (parent_18 && + parent_18.kind === 248 && + parent_18.parent && + (parent_18.parent.kind === 246)) { + return parent_18.parent.parent; } - if (parent_11 && parent_11.kind === 239) { - return parent_11.parent; + if (parent_18 && parent_18.kind === 247) { + return parent_18.parent; } break; } @@ -39328,16 +44374,16 @@ var ts; } function isFunction(kind) { switch (kind) { - case 173: - case 174: - case 213: - case 143: - case 142: - case 145: - case 146: + case 179: + case 180: + case 220: case 147: - case 148: + case 146: case 149: + case 150: + case 151: + case 152: + case 153: return true; } return false; @@ -39346,66 +44392,66 @@ var ts; var containingNodeKind = contextToken.parent.kind; switch (contextToken.kind) { case 24: - return containingNodeKind === 211 || - containingNodeKind === 212 || - containingNodeKind === 193 || - containingNodeKind === 217 || + return containingNodeKind === 218 || + containingNodeKind === 219 || + containingNodeKind === 200 || + containingNodeKind === 224 || isFunction(containingNodeKind) || - containingNodeKind === 214 || - containingNodeKind === 186 || - containingNodeKind === 215 || - containingNodeKind === 162 || - containingNodeKind === 216; + containingNodeKind === 221 || + containingNodeKind === 192 || + containingNodeKind === 222 || + containingNodeKind === 168 || + containingNodeKind === 223; case 21: - return containingNodeKind === 162; + return containingNodeKind === 168; case 54: - return containingNodeKind === 163; + return containingNodeKind === 169; case 19: - return containingNodeKind === 162; + return containingNodeKind === 168; case 17: - return containingNodeKind === 244 || + return containingNodeKind === 252 || isFunction(containingNodeKind); case 15: - return containingNodeKind === 217 || - containingNodeKind === 215 || - containingNodeKind === 155; + return containingNodeKind === 224 || + containingNodeKind === 222 || + containingNodeKind === 159; case 23: - return containingNodeKind === 140 && + return containingNodeKind === 144 && contextToken.parent && contextToken.parent.parent && - (contextToken.parent.parent.kind === 215 || - contextToken.parent.parent.kind === 155); + (contextToken.parent.parent.kind === 222 || + contextToken.parent.parent.kind === 159); case 25: - return containingNodeKind === 214 || - containingNodeKind === 186 || - containingNodeKind === 215 || - containingNodeKind === 216 || + return containingNodeKind === 221 || + containingNodeKind === 192 || + containingNodeKind === 222 || + containingNodeKind === 223 || isFunction(containingNodeKind); case 113: - return containingNodeKind === 141; + return containingNodeKind === 145; case 22: - return containingNodeKind === 138 || + return containingNodeKind === 142 || (contextToken.parent && contextToken.parent.parent && - contextToken.parent.parent.kind === 162); + contextToken.parent.parent.kind === 168); case 112: case 110: case 111: - return containingNodeKind === 138; + return containingNodeKind === 142; case 116: - return containingNodeKind === 226 || - containingNodeKind === 230 || - containingNodeKind === 224; + return containingNodeKind === 234 || + containingNodeKind === 238 || + containingNodeKind === 232; case 73: case 81: case 107: case 87: case 102: case 123: - case 129: + case 131: case 89: case 108: case 74: case 114: - case 132: + case 134: return true; } switch (contextToken.getText()) { @@ -39436,19 +44482,19 @@ var ts; return false; } function filterNamedImportOrExportCompletionItems(exportsOfModule, namedImportsOrExports) { - var exisingImportsOrExports = {}; + var existingImportsOrExports = {}; for (var _i = 0, namedImportsOrExports_1 = namedImportsOrExports; _i < namedImportsOrExports_1.length; _i++) { var element = namedImportsOrExports_1[_i]; if (element.getStart() <= position && position <= element.getEnd()) { continue; } - var name_35 = element.propertyName || element.name; - exisingImportsOrExports[name_35.text] = true; + var name_39 = element.propertyName || element.name; + existingImportsOrExports[name_39.text] = true; } - if (ts.isEmpty(exisingImportsOrExports)) { - return exportsOfModule; + if (ts.isEmpty(existingImportsOrExports)) { + return ts.filter(exportsOfModule, function (e) { return e.name !== "default"; }); } - return ts.filter(exportsOfModule, function (e) { return !ts.lookUp(exisingImportsOrExports, e.name); }); + return ts.filter(exportsOfModule, function (e) { return e.name !== "default" && !ts.lookUp(existingImportsOrExports, e.name); }); } function filterObjectMembersList(contextualMemberSymbols, existingMembers) { if (!existingMembers || existingMembers.length === 0) { @@ -39457,16 +44503,17 @@ var ts; var existingMemberNames = {}; for (var _i = 0, existingMembers_1 = existingMembers; _i < existingMembers_1.length; _i++) { var m = existingMembers_1[_i]; - if (m.kind !== 245 && - m.kind !== 246 && - m.kind !== 163) { + if (m.kind !== 253 && + m.kind !== 254 && + m.kind !== 169 && + m.kind !== 147) { continue; } if (m.getStart() <= position && position <= m.getEnd()) { continue; } var existingName = void 0; - if (m.kind === 163 && m.propertyName) { + if (m.kind === 169 && m.propertyName) { if (m.propertyName.kind === 69) { existingName = m.propertyName.text; } @@ -39485,7 +44532,7 @@ var ts; if (attr.getStart() <= position && position <= attr.getEnd()) { continue; } - if (attr.kind === 238) { + if (attr.kind === 246) { seenNames[attr.name.text] = true; } } @@ -39498,19 +44545,31 @@ var ts; if (!completionData) { return undefined; } - var symbols = completionData.symbols, isMemberCompletion = completionData.isMemberCompletion, isNewIdentifierLocation = completionData.isNewIdentifierLocation, location = completionData.location, isRightOfDot = completionData.isRightOfDot, isJsDocTagName = completionData.isJsDocTagName; + var symbols = completionData.symbols, isMemberCompletion = completionData.isMemberCompletion, isNewIdentifierLocation = completionData.isNewIdentifierLocation, location = completionData.location, isJsDocTagName = completionData.isJsDocTagName; if (isJsDocTagName) { return { isMemberCompletion: false, isNewIdentifierLocation: false, entries: getAllJsDocCompletionEntries() }; } var sourceFile = getValidSourceFile(fileName); var entries = []; - if (isRightOfDot && ts.isSourceFileJavaScript(sourceFile)) { + if (ts.isSourceFileJavaScript(sourceFile)) { var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries); - ts.addRange(entries, getJavaScriptCompletionEntries(sourceFile, uniqueNames)); + ts.addRange(entries, getJavaScriptCompletionEntries(sourceFile, location.pos, uniqueNames)); } else { if (!symbols || symbols.length === 0) { - return undefined; + if (sourceFile.languageVariant === 1 && + location.parent && location.parent.kind === 245) { + var tagName = location.parent.parent.openingElement.tagName; + entries.push({ + name: tagName.text, + kind: undefined, + kindModifiers: undefined, + sortText: "0" + }); + } + else { + return undefined; + } } getCompletionEntriesFromSymbols(symbols, entries); } @@ -39518,14 +44577,17 @@ var ts; ts.addRange(entries, keywordCompletions); } return { isMemberCompletion: isMemberCompletion, isNewIdentifierLocation: isNewIdentifierLocation, entries: entries }; - function getJavaScriptCompletionEntries(sourceFile, uniqueNames) { + function getJavaScriptCompletionEntries(sourceFile, position, uniqueNames) { var entries = []; var target = program.getCompilerOptions().target; var nameTable = getNameTable(sourceFile); - for (var name_36 in nameTable) { - if (!uniqueNames[name_36]) { - uniqueNames[name_36] = name_36; - var displayName = getCompletionEntryDisplayName(name_36, target, true); + for (var name_40 in nameTable) { + if (nameTable[name_40] === position) { + continue; + } + if (!uniqueNames[name_40]) { + uniqueNames[name_40] = name_40; + var displayName = getCompletionEntryDisplayName(name_40, target, true); if (displayName) { var entry = { name: displayName, @@ -39565,8 +44627,8 @@ var ts; var start = new Date().getTime(); var uniqueNames = {}; if (symbols) { - for (var _i = 0, symbols_3 = symbols; _i < symbols_3.length; _i++) { - var symbol = symbols_3[_i]; + for (var _i = 0, symbols_4 = symbols; _i < symbols_4.length; _i++) { + var symbol = symbols_4[_i]; var entry = createCompletionEntry(symbol, location); if (entry) { var id = ts.escapeIdentifier(entry.name); @@ -39586,8 +44648,8 @@ var ts; var completionData = getCompletionData(fileName, position); if (completionData) { var symbols = completionData.symbols, location_2 = completionData.location; - var target = program.getCompilerOptions().target; - var symbol = ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(s, target, false, location_2) === entryName ? s : undefined; }); + var target_2 = program.getCompilerOptions().target; + var symbol = ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(s, target_2, false, location_2) === entryName ? s : undefined; }); if (symbol) { var _a = getSymbolDisplayPartsDocumentationAndSymbolKind(symbol, getValidSourceFile(fileName), location_2, location_2, 7), displayParts = _a.displayParts, documentation = _a.documentation, symbolKind = _a.symbolKind; return { @@ -39614,7 +44676,7 @@ var ts; function getSymbolKind(symbol, location) { var flags = symbol.getFlags(); if (flags & 32) - return ts.getDeclarationOfKind(symbol, 186) ? + return ts.getDeclarationOfKind(symbol, 192) ? ScriptElementKind.localClassElement : ScriptElementKind.classElement; if (flags & 384) return ScriptElementKind.enumElement; @@ -39645,6 +44707,9 @@ var ts; if (typeChecker.isArgumentsSymbol(symbol)) { return ScriptElementKind.localVariableElement; } + if (location.kind === 97 && ts.isExpression(location)) { + return ScriptElementKind.parameterElement; + } if (flags & 3) { if (ts.isFirstDeclarationOfSymbolParameter(symbol)) { return ScriptElementKind.parameterElement; @@ -39702,22 +44767,23 @@ var ts; var symbolFlags = symbol.flags; var symbolKind = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(symbol, symbolFlags, location); var hasAddedSymbolInfo; + var isThisExpression = location.kind === 97 && ts.isExpression(location); var type; if (symbolKind !== ScriptElementKind.unknown || symbolFlags & 32 || symbolFlags & 8388608) { if (symbolKind === ScriptElementKind.memberGetAccessorElement || symbolKind === ScriptElementKind.memberSetAccessorElement) { symbolKind = ScriptElementKind.memberVariableElement; } - var signature; - type = typeChecker.getTypeOfSymbolAtLocation(symbol, location); + var signature = void 0; + type = isThisExpression ? typeChecker.getTypeAtLocation(location) : typeChecker.getTypeOfSymbolAtLocation(symbol, location); if (type) { - if (location.parent && location.parent.kind === 166) { + if (location.parent && location.parent.kind === 172) { var right = location.parent.name; if (right === location || (right && right.getFullWidth() === 0)) { location = location.parent; } } - var callExpression; - if (location.kind === 168 || location.kind === 169) { + var callExpression = void 0; + if (location.kind === 174 || location.kind === 175) { callExpression = location; } else if (isCallExpressionTarget(location) || isNewExpressionTarget(location)) { @@ -39729,7 +44795,7 @@ var ts; if (!signature && candidateSignatures.length) { signature = candidateSignatures[0]; } - var useConstructSignatures = callExpression.kind === 169 || callExpression.expression.kind === 95; + var useConstructSignatures = callExpression.kind === 175 || callExpression.expression.kind === 95; var allSignatures = useConstructSignatures ? type.getConstructSignatures() : type.getCallSignatures(); if (!ts.contains(allSignatures, signature.target) && !ts.contains(allSignatures, signature)) { signature = allSignatures.length ? allSignatures[0] : undefined; @@ -39759,16 +44825,16 @@ var ts; case ScriptElementKind.letElement: case ScriptElementKind.parameterElement: case ScriptElementKind.localVariableElement: - displayParts.push(ts.punctuationPart(ts.SyntaxKind.ColonToken)); + displayParts.push(ts.punctuationPart(54)); displayParts.push(ts.spacePart()); if (useConstructSignatures) { - displayParts.push(ts.keywordPart(ts.SyntaxKind.NewKeyword)); + displayParts.push(ts.keywordPart(92)); displayParts.push(ts.spacePart()); } - if (!(type.flags & ts.TypeFlags.Anonymous)) { - ts.addRange(displayParts, ts.symbolToDisplayParts(typeChecker, type.symbol, enclosingDeclaration, undefined, ts.SymbolFormatFlags.WriteTypeParametersOrArguments)); + if (!(type.flags & 65536) && type.symbol) { + ts.addRange(displayParts, ts.symbolToDisplayParts(typeChecker, type.symbol, enclosingDeclaration, undefined, 1)); } - addSignatureDisplayParts(signature, allSignatures, ts.TypeFormatFlags.WriteArrowStyleSignature); + addSignatureDisplayParts(signature, allSignatures, 8); break; default: addSignatureDisplayParts(signature, allSignatures); @@ -39777,21 +44843,21 @@ var ts; } } else if ((isNameOfFunctionDeclaration(location) && !(symbol.flags & 98304)) || - (location.kind === 121 && location.parent.kind === 144)) { + (location.kind === 121 && location.parent.kind === 148)) { var functionDeclaration = location.parent; - var allSignatures = functionDeclaration.kind === 144 ? type.getConstructSignatures() : type.getCallSignatures(); + var allSignatures = functionDeclaration.kind === 148 ? type.getNonNullableType().getConstructSignatures() : type.getNonNullableType().getCallSignatures(); if (!typeChecker.isImplementationOfOverload(functionDeclaration)) { signature = typeChecker.getSignatureFromDeclaration(functionDeclaration); } else { signature = allSignatures[0]; } - if (functionDeclaration.kind === 144) { + if (functionDeclaration.kind === 148) { symbolKind = ScriptElementKind.constructorImplementationElement; addPrefixForAnyFunctionOrVar(type.symbol, symbolKind); } else { - addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 147 && + addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 151 && !(type.symbol.flags & 2048 || type.symbol.flags & 4096) ? type.symbol : symbol, symbolKind); } addSignatureDisplayParts(signature, allSignatures); @@ -39799,8 +44865,8 @@ var ts; } } } - if (symbolFlags & 32 && !hasAddedSymbolInfo) { - if (ts.getDeclarationOfKind(symbol, 186)) { + if (symbolFlags & 32 && !hasAddedSymbolInfo && !isThisExpression) { + if (ts.getDeclarationOfKind(symbol, 192)) { pushTypePart(ScriptElementKind.localClassElement); } else { @@ -39819,7 +44885,7 @@ var ts; } if (symbolFlags & 524288) { addNewLineIfDisplayPartsExist(); - displayParts.push(ts.keywordPart(132)); + displayParts.push(ts.keywordPart(134)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); writeTypeParametersOfSymbol(symbol, sourceFile); @@ -39840,7 +44906,7 @@ var ts; } if (symbolFlags & 1536) { addNewLineIfDisplayPartsExist(); - var declaration = ts.getDeclarationOfKind(symbol, 218); + var declaration = ts.getDeclarationOfKind(symbol, 225); var isNamespace = declaration && declaration.name && declaration.name.kind === 69; displayParts.push(ts.keywordPart(isNamespace ? 126 : 125)); displayParts.push(ts.spacePart()); @@ -39861,32 +44927,34 @@ var ts; writeTypeParametersOfSymbol(symbol.parent, enclosingDeclaration); } else { - var container = ts.getContainingFunction(location); - if (container) { - var signatureDeclaration = ts.getDeclarationOfKind(symbol, 137).parent; - var signature = typeChecker.getSignatureFromDeclaration(signatureDeclaration); - if (signatureDeclaration.kind === 148) { - displayParts.push(ts.keywordPart(92)); + var declaration = ts.getDeclarationOfKind(symbol, 141); + ts.Debug.assert(declaration !== undefined); + declaration = declaration.parent; + if (declaration) { + if (ts.isFunctionLikeKind(declaration.kind)) { + var signature = typeChecker.getSignatureFromDeclaration(declaration); + if (declaration.kind === 152) { + displayParts.push(ts.keywordPart(92)); + displayParts.push(ts.spacePart()); + } + else if (declaration.kind !== 151 && declaration.name) { + addFullSymbolName(declaration.symbol); + } + ts.addRange(displayParts, ts.signatureToDisplayParts(typeChecker, signature, sourceFile, 32)); + } + else { + displayParts.push(ts.keywordPart(134)); displayParts.push(ts.spacePart()); + addFullSymbolName(declaration.symbol); + writeTypeParametersOfSymbol(declaration.symbol, sourceFile); } - else if (signatureDeclaration.kind !== 147 && signatureDeclaration.name) { - addFullSymbolName(signatureDeclaration.symbol); - } - ts.addRange(displayParts, ts.signatureToDisplayParts(typeChecker, signature, sourceFile, 32)); - } - else { - var declaration = ts.getDeclarationOfKind(symbol, 137).parent; - displayParts.push(ts.keywordPart(132)); - displayParts.push(ts.spacePart()); - addFullSymbolName(declaration.symbol); - writeTypeParametersOfSymbol(declaration.symbol, sourceFile); } } } if (symbolFlags & 8) { addPrefixForAnyFunctionOrVar(symbol, "enum member"); var declaration = symbol.declarations[0]; - if (declaration.kind === 247) { + if (declaration.kind === 255) { var constantValue = typeChecker.getConstantValue(declaration); if (constantValue !== undefined) { displayParts.push(ts.spacePart()); @@ -39902,13 +44970,13 @@ var ts; displayParts.push(ts.spacePart()); addFullSymbolName(symbol); ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 221) { + if (declaration.kind === 229) { var importEqualsDeclaration = declaration; if (ts.isExternalModuleImportEqualsDeclaration(importEqualsDeclaration)) { displayParts.push(ts.spacePart()); displayParts.push(ts.operatorPart(56)); displayParts.push(ts.spacePart()); - displayParts.push(ts.keywordPart(127)); + displayParts.push(ts.keywordPart(129)); displayParts.push(ts.punctuationPart(17)); displayParts.push(ts.displayPart(ts.getTextOfNode(ts.getExternalModuleImportEqualsDeclarationExpression(importEqualsDeclaration)), SymbolDisplayPartKind.stringLiteral)); displayParts.push(ts.punctuationPart(18)); @@ -39929,10 +44997,17 @@ var ts; if (!hasAddedSymbolInfo) { if (symbolKind !== ScriptElementKind.unknown) { if (type) { - addPrefixForAnyFunctionOrVar(symbol, symbolKind); + if (isThisExpression) { + addNewLineIfDisplayPartsExist(); + displayParts.push(ts.keywordPart(97)); + } + else { + addPrefixForAnyFunctionOrVar(symbol, symbolKind); + } if (symbolKind === ScriptElementKind.memberVariableElement || symbolFlags & 3 || - symbolKind === ScriptElementKind.localVariableElement) { + symbolKind === ScriptElementKind.localVariableElement || + isThisExpression) { displayParts.push(ts.punctuationPart(54)); displayParts.push(ts.spacePart()); if (type.symbol && type.symbol.flags & 262144) { @@ -39951,7 +45026,7 @@ var ts; symbolFlags & 131072 || symbolFlags & 98304 || symbolKind === ScriptElementKind.memberFunctionElement) { - var allSignatures = type.getCallSignatures(); + var allSignatures = type.getNonNullableType().getCallSignatures(); addSignatureDisplayParts(allSignatures[0], allSignatures); } } @@ -40021,7 +45096,7 @@ var ts; synchronizeHostData(); var sourceFile = getValidSourceFile(fileName); var node = ts.getTouchingPropertyName(sourceFile, position); - if (!node) { + if (node === sourceFile) { return undefined; } if (isLabelName(node)) { @@ -40029,12 +45104,13 @@ var ts; } var typeChecker = program.getTypeChecker(); var symbol = typeChecker.getSymbolAtLocation(node); - if (!symbol) { + if (!symbol || typeChecker.isUnknownSymbol(symbol)) { switch (node.kind) { case 69: - case 166: - case 135: + case 172: + case 139: case 97: + case 165: case 95: var type = typeChecker.getTypeAtLocation(node); if (type) { @@ -40107,8 +45183,8 @@ var ts; var declarations = []; var definition; ts.forEach(signatureDeclarations, function (d) { - if ((selectConstructors && d.kind === 144) || - (!selectConstructors && (d.kind === 213 || d.kind === 143 || d.kind === 142))) { + if ((selectConstructors && d.kind === 148) || + (!selectConstructors && (d.kind === 220 || d.kind === 147 || d.kind === 146))) { declarations.push(d); if (d.body) definition = d; @@ -40125,11 +45201,46 @@ var ts; return false; } } + function findReferenceInPosition(refs, pos) { + for (var _i = 0, refs_1 = refs; _i < refs_1.length; _i++) { + var ref = refs_1[_i]; + if (ref.pos <= pos && pos < ref.end) { + return ref; + } + } + return undefined; + } + function getDefinitionInfoForFileReference(name, targetFileName) { + return { + fileName: targetFileName, + textSpan: ts.createTextSpanFromBounds(0, 0), + kind: ScriptElementKind.scriptElement, + name: name, + containerName: undefined, + containerKind: undefined + }; + } function getDefinitionAtPosition(fileName, position) { synchronizeHostData(); var sourceFile = getValidSourceFile(fileName); + var comment = findReferenceInPosition(sourceFile.referencedFiles, position); + if (comment) { + var referenceFile = ts.tryResolveScriptReference(program, sourceFile, comment); + if (referenceFile) { + return [getDefinitionInfoForFileReference(comment.fileName, referenceFile.fileName)]; + } + return undefined; + } + var typeReferenceDirective = findReferenceInPosition(sourceFile.typeReferenceDirectives, position); + if (typeReferenceDirective) { + var referenceFile = ts.lookUp(program.getResolvedTypeReferenceDirectives(), typeReferenceDirective.fileName); + if (referenceFile && referenceFile.resolvedFileName) { + return [getDefinitionInfoForFileReference(typeReferenceDirective.fileName, referenceFile.resolvedFileName)]; + } + return undefined; + } var node = ts.getTouchingPropertyName(sourceFile, position); - if (!node) { + if (node === sourceFile) { return undefined; } if (isJumpStatementTarget(node)) { @@ -40137,21 +45248,6 @@ var ts; var label = getTargetLabel(node.parent, node.text); return label ? [createDefinitionInfo(label, ScriptElementKind.label, labelName, undefined)] : undefined; } - var comment = ts.forEach(sourceFile.referencedFiles, function (r) { return (r.pos <= position && position < r.end) ? r : undefined; }); - if (comment) { - var referenceFile = ts.tryResolveScriptReference(program, sourceFile, comment); - if (referenceFile) { - return [{ - fileName: referenceFile.fileName, - textSpan: ts.createTextSpanFromBounds(0, 0), - kind: ScriptElementKind.scriptElement, - name: comment.fileName, - containerName: undefined, - containerKind: undefined - }]; - } - return undefined; - } var typeChecker = program.getTypeChecker(); var symbol = typeChecker.getSymbolAtLocation(node); if (!symbol) { @@ -40159,20 +45255,22 @@ var ts; } if (symbol.flags & 8388608) { var declaration = symbol.declarations[0]; - if (node.kind === 69 && node.parent === declaration) { + if (node.kind === 69 && + (node.parent === declaration || + (declaration.kind === 234 && declaration.parent && declaration.parent.kind === 233))) { symbol = typeChecker.getAliasedSymbol(symbol); } } - if (node.parent.kind === 246) { + if (node.parent.kind === 254) { var shorthandSymbol = typeChecker.getShorthandAssignmentValueSymbol(symbol.valueDeclaration); if (!shorthandSymbol) { return []; } var shorthandDeclarations = shorthandSymbol.getDeclarations(); - var shorthandSymbolKind = getSymbolKind(shorthandSymbol, node); - var shorthandSymbolName = typeChecker.symbolToString(shorthandSymbol); - var shorthandContainerName = typeChecker.symbolToString(symbol.parent, node); - return ts.map(shorthandDeclarations, function (declaration) { return createDefinitionInfo(declaration, shorthandSymbolKind, shorthandSymbolName, shorthandContainerName); }); + var shorthandSymbolKind_1 = getSymbolKind(shorthandSymbol, node); + var shorthandSymbolName_1 = typeChecker.symbolToString(shorthandSymbol); + var shorthandContainerName_1 = typeChecker.symbolToString(symbol.parent, node); + return ts.map(shorthandDeclarations, function (declaration) { return createDefinitionInfo(declaration, shorthandSymbolKind_1, shorthandSymbolName_1, shorthandContainerName_1); }); } return getDefinitionFromSymbol(symbol, node); } @@ -40180,7 +45278,7 @@ var ts; synchronizeHostData(); var sourceFile = getValidSourceFile(fileName); var node = ts.getTouchingPropertyName(sourceFile, position); - if (!node) { + if (node === sourceFile) { return undefined; } var typeChecker = program.getTypeChecker(); @@ -40193,13 +45291,13 @@ var ts; return undefined; } if (type.flags & 16384) { - var result = []; + var result_3 = []; ts.forEach(type.types, function (t) { if (t.symbol) { - ts.addRange(result, getDefinitionFromSymbol(t.symbol, node)); + ts.addRange(result_3, getDefinitionFromSymbol(t.symbol, node)); } }); - return result; + return result_3; } if (!type.symbol) { return undefined; @@ -40209,8 +45307,8 @@ var ts; function getOccurrencesAtPosition(fileName, position) { var results = getOccurrencesAtPositionCore(fileName, position); if (results) { - var sourceFile = getCanonicalFileName(ts.normalizeSlashes(fileName)); - results = ts.filter(results, function (r) { return getCanonicalFileName(ts.normalizeSlashes(r.fileName)) === sourceFile; }); + var sourceFile_2 = getCanonicalFileName(ts.normalizeSlashes(fileName)); + results = ts.filter(results, function (r) { return getCanonicalFileName(ts.normalizeSlashes(r.fileName)) === sourceFile_2; }); } return results; } @@ -40236,9 +45334,10 @@ var ts; function getSemanticDocumentHighlights(node) { if (node.kind === 69 || node.kind === 97 || + node.kind === 165 || node.kind === 95 || - isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || - isNameOfExternalModuleImportOrDeclaration(node)) { + node.kind === 9 || + isLiteralNameOfPropertyDeclarationOrIndexAccess(node)) { var referencedSymbols = getReferencedSymbolsForNode(node, sourceFilesToSearch, false, false); return convertReferencedSymbols(referencedSymbols); } @@ -40287,75 +45386,75 @@ var ts; switch (node.kind) { case 88: case 80: - if (hasKind(node.parent, 196)) { + if (hasKind(node.parent, 203)) { return getIfElseOccurrences(node.parent); } break; case 94: - if (hasKind(node.parent, 204)) { + if (hasKind(node.parent, 211)) { return getReturnOccurrences(node.parent); } break; case 98: - if (hasKind(node.parent, 208)) { + if (hasKind(node.parent, 215)) { return getThrowOccurrences(node.parent); } break; case 72: - if (hasKind(parent(parent(node)), 209)) { + if (hasKind(parent(parent(node)), 216)) { return getTryCatchFinallyOccurrences(node.parent.parent); } break; case 100: case 85: - if (hasKind(parent(node), 209)) { + if (hasKind(parent(node), 216)) { return getTryCatchFinallyOccurrences(node.parent); } break; case 96: - if (hasKind(node.parent, 206)) { + if (hasKind(node.parent, 213)) { return getSwitchCaseDefaultOccurrences(node.parent); } break; case 71: case 77: - if (hasKind(parent(parent(parent(node))), 206)) { + if (hasKind(parent(parent(parent(node))), 213)) { return getSwitchCaseDefaultOccurrences(node.parent.parent.parent); } break; case 70: case 75: - if (hasKind(node.parent, 203) || hasKind(node.parent, 202)) { + if (hasKind(node.parent, 210) || hasKind(node.parent, 209)) { return getBreakOrContinueStatementOccurrences(node.parent); } break; case 86: - if (hasKind(node.parent, 199) || - hasKind(node.parent, 200) || - hasKind(node.parent, 201)) { + if (hasKind(node.parent, 206) || + hasKind(node.parent, 207) || + hasKind(node.parent, 208)) { return getLoopBreakContinueOccurrences(node.parent); } break; case 104: case 79: - if (hasKind(node.parent, 198) || hasKind(node.parent, 197)) { + if (hasKind(node.parent, 205) || hasKind(node.parent, 204)) { return getLoopBreakContinueOccurrences(node.parent); } break; case 121: - if (hasKind(node.parent, 144)) { + if (hasKind(node.parent, 148)) { return getConstructorOccurrences(node.parent); } break; case 123: - case 129: - if (hasKind(node.parent, 145) || hasKind(node.parent, 146)) { + case 131: + if (hasKind(node.parent, 149) || hasKind(node.parent, 150)) { return getGetAndSetOccurrences(node.parent); } break; default: - if (ts.isModifier(node.kind) && node.parent && - (ts.isDeclaration(node.parent) || node.parent.kind === 193)) { + if (ts.isModifierKind(node.kind) && node.parent && + (ts.isDeclaration(node.parent) || node.parent.kind === 200)) { return getModifierOccurrences(node.kind, node.parent); } } @@ -40367,10 +45466,10 @@ var ts; aggregate(node); return statementAccumulator; function aggregate(node) { - if (node.kind === 208) { + if (node.kind === 215) { statementAccumulator.push(node); } - else if (node.kind === 209) { + else if (node.kind === 216) { var tryStatement = node; if (tryStatement.catchClause) { aggregate(tryStatement.catchClause); @@ -40390,17 +45489,17 @@ var ts; function getThrowStatementOwner(throwStatement) { var child = throwStatement; while (child.parent) { - var parent_12 = child.parent; - if (ts.isFunctionBlock(parent_12) || parent_12.kind === 248) { - return parent_12; + var parent_19 = child.parent; + if (ts.isFunctionBlock(parent_19) || parent_19.kind === 256) { + return parent_19; } - if (parent_12.kind === 209) { - var tryStatement = parent_12; + if (parent_19.kind === 216) { + var tryStatement = parent_19; if (tryStatement.tryBlock === child && tryStatement.catchClause) { return child; } } - child = parent_12; + child = parent_19; } return undefined; } @@ -40409,7 +45508,7 @@ var ts; aggregate(node); return statementAccumulator; function aggregate(node) { - if (node.kind === 203 || node.kind === 202) { + if (node.kind === 210 || node.kind === 209) { statementAccumulator.push(node); } else if (!ts.isFunctionLike(node)) { @@ -40422,23 +45521,23 @@ var ts; return actualOwner && actualOwner === owner; } function getBreakOrContinueOwner(statement) { - for (var node_2 = statement.parent; node_2; node_2 = node_2.parent) { - switch (node_2.kind) { - case 206: - if (statement.kind === 202) { + for (var node_1 = statement.parent; node_1; node_1 = node_1.parent) { + switch (node_1.kind) { + case 213: + if (statement.kind === 209) { continue; } - case 199: - case 200: - case 201: - case 198: - case 197: - if (!statement.label || isLabeledBy(node_2, statement.label.text)) { - return node_2; + case 206: + case 207: + case 208: + case 205: + case 204: + if (!statement.label || isLabeledBy(node_1, statement.label.text)) { + return node_1; } break; default: - if (ts.isFunctionLike(node_2)) { + if (ts.isFunctionLike(node_1)) { return undefined; } break; @@ -40449,24 +45548,24 @@ var ts; function getModifierOccurrences(modifier, declaration) { var container = declaration.parent; if (ts.isAccessibilityModifier(modifier)) { - if (!(container.kind === 214 || - container.kind === 186 || - (declaration.kind === 138 && hasKind(container, 144)))) { + if (!(container.kind === 221 || + container.kind === 192 || + (declaration.kind === 142 && hasKind(container, 148)))) { return undefined; } } else if (modifier === 113) { - if (!(container.kind === 214 || container.kind === 186)) { + if (!(container.kind === 221 || container.kind === 192)) { return undefined; } } else if (modifier === 82 || modifier === 122) { - if (!(container.kind === 219 || container.kind === 248)) { + if (!(container.kind === 226 || container.kind === 256)) { return undefined; } } else if (modifier === 115) { - if (!(container.kind === 214 || declaration.kind === 214)) { + if (!(container.kind === 221 || declaration.kind === 221)) { return undefined; } } @@ -40477,8 +45576,8 @@ var ts; var modifierFlag = getFlagFromModifier(modifier); var nodes; switch (container.kind) { - case 219: - case 248: + case 226: + case 256: if (modifierFlag & 128) { nodes = declaration.members.concat(declaration); } @@ -40486,15 +45585,15 @@ var ts; nodes = container.statements; } break; - case 144: + case 148: nodes = container.parameters.concat(container.parent.members); break; - case 214: - case 186: + case 221: + case 192: nodes = container.members; - if (modifierFlag & 56) { + if (modifierFlag & 28) { var constructor = ts.forEach(container.members, function (member) { - return member.kind === 144 && member; + return member.kind === 148 && member; }); if (constructor) { nodes = nodes.concat(constructor.parameters); @@ -40516,17 +45615,17 @@ var ts; function getFlagFromModifier(modifier) { switch (modifier) { case 112: - return 8; - case 110: - return 16; - case 111: - return 32; - case 113: - return 64; - case 82: - return 2; - case 122: return 4; + case 110: + return 8; + case 111: + return 16; + case 113: + return 32; + case 82: + return 1; + case 122: + return 2; case 115: return 128; default: @@ -40547,13 +45646,13 @@ var ts; } function getGetAndSetOccurrences(accessorDeclaration) { var keywords = []; - tryPushAccessorKeyword(accessorDeclaration.symbol, 145); - tryPushAccessorKeyword(accessorDeclaration.symbol, 146); + tryPushAccessorKeyword(accessorDeclaration.symbol, 149); + tryPushAccessorKeyword(accessorDeclaration.symbol, 150); return ts.map(keywords, getHighlightSpanForNode); function tryPushAccessorKeyword(accessorSymbol, accessorKind) { var accessor = ts.getDeclarationOfKind(accessorSymbol, accessorKind); if (accessor) { - ts.forEach(accessor.getChildren(), function (child) { return pushKeywordIf(keywords, child, 123, 129); }); + ts.forEach(accessor.getChildren(), function (child) { return pushKeywordIf(keywords, child, 123, 131); }); } } } @@ -40570,7 +45669,7 @@ var ts; function getLoopBreakContinueOccurrences(loopNode) { var keywords = []; if (pushKeywordIf(keywords, loopNode.getFirstToken(), 86, 104, 79)) { - if (loopNode.kind === 197) { + if (loopNode.kind === 204) { var loopTokens = loopNode.getChildren(); for (var i = loopTokens.length - 1; i >= 0; i--) { if (pushKeywordIf(keywords, loopTokens[i], 104)) { @@ -40591,13 +45690,13 @@ var ts; var owner = getBreakOrContinueOwner(breakOrContinueStatement); if (owner) { switch (owner.kind) { - case 199: - case 200: - case 201: - case 197: - case 198: - return getLoopBreakContinueOccurrences(owner); case 206: + case 207: + case 208: + case 204: + case 205: + return getLoopBreakContinueOccurrences(owner); + case 213: return getSwitchCaseDefaultOccurrences(owner); } } @@ -40647,7 +45746,7 @@ var ts; } function getReturnOccurrences(returnStatement) { var func = ts.getContainingFunction(returnStatement); - if (!(func && hasKind(func.body, 192))) { + if (!(func && hasKind(func.body, 199))) { return undefined; } var keywords = []; @@ -40661,7 +45760,7 @@ var ts; } function getIfElseOccurrences(ifStatement) { var keywords = []; - while (hasKind(ifStatement.parent, 196) && ifStatement.parent.elseStatement === ifStatement) { + while (hasKind(ifStatement.parent, 203) && ifStatement.parent.elseStatement === ifStatement) { ifStatement = ifStatement.parent; } while (ifStatement) { @@ -40672,7 +45771,7 @@ var ts; break; } } - if (!hasKind(ifStatement.elseStatement, 196)) { + if (!hasKind(ifStatement.elseStatement, 203)) { break; } ifStatement = ifStatement.elseStatement; @@ -40754,12 +45853,12 @@ var ts; synchronizeHostData(); var sourceFile = getValidSourceFile(fileName); var node = ts.getTouchingPropertyName(sourceFile, position); - if (!node) { + if (node === sourceFile) { return undefined; } if (node.kind !== 69 && - !isLiteralNameOfPropertyDeclarationOrIndexAccess(node) && - !isNameOfExternalModuleImportOrDeclaration(node)) { + node.kind !== 9 && + !isLiteralNameOfPropertyDeclarationOrIndexAccess(node)) { return undefined; } ts.Debug.assert(node.kind === 69 || node.kind === 8 || node.kind === 9); @@ -40776,13 +45875,16 @@ var ts; return getLabelReferencesInNode(node.parent, node); } } - if (node.kind === 97) { + if (node.kind === 97 || node.kind === 165) { return getReferencesForThisKeyword(node, sourceFiles); } if (node.kind === 95) { return getReferencesForSuperKeyword(node); } var symbol = typeChecker.getSymbolAtLocation(node); + if (!symbol && node.kind === 9) { + return getReferencesForStringLiteral(node, sourceFiles); + } if (!symbol) { return undefined; } @@ -40801,11 +45903,11 @@ var ts; } else { var internedName = getInternedName(symbol, node, declarations); - for (var _i = 0, sourceFiles_2 = sourceFiles; _i < sourceFiles_2.length; _i++) { - var sourceFile = sourceFiles_2[_i]; + for (var _i = 0, sourceFiles_4 = sourceFiles; _i < sourceFiles_4.length; _i++) { + var sourceFile = sourceFiles_4[_i]; cancellationToken.throwIfCancellationRequested(); var nameTable = getNameTable(sourceFile); - if (ts.lookUp(nameTable, internedName)) { + if (ts.lookUp(nameTable, internedName) !== undefined) { result = result || []; getReferencesInNode(sourceFile, symbol, declaredName, node, searchMeaning, findInStrings, findInComments, result, symbolToIndex); } @@ -40828,10 +45930,41 @@ var ts; textSpan: ts.createTextSpan(declarations[0].getStart(), 0) }; } - function isImportOrExportSpecifierImportSymbol(symbol) { - return (symbol.flags & 8388608) && ts.forEach(symbol.declarations, function (declaration) { - return declaration.kind === 226 || declaration.kind === 230; - }); + function getAliasSymbolForPropertyNameSymbol(symbol, location) { + if (symbol.flags & 8388608) { + var defaultImport = ts.getDeclarationOfKind(symbol, 231); + if (defaultImport) { + return typeChecker.getAliasedSymbol(symbol); + } + var importOrExportSpecifier = ts.forEach(symbol.declarations, function (declaration) { return (declaration.kind === 234 || + declaration.kind === 238) ? declaration : undefined; }); + if (importOrExportSpecifier && + (!importOrExportSpecifier.propertyName || + importOrExportSpecifier.propertyName === location)) { + return importOrExportSpecifier.kind === 234 ? + typeChecker.getAliasedSymbol(symbol) : + typeChecker.getExportSpecifierLocalTargetSymbol(importOrExportSpecifier); + } + } + return undefined; + } + function getPropertySymbolOfDestructuringAssignment(location) { + return ts.isArrayLiteralOrObjectLiteralDestructuringPattern(location.parent.parent) && + typeChecker.getPropertySymbolOfDestructuringAssignment(location); + } + function isObjectBindingPatternElementWithoutPropertyName(symbol) { + var bindingElement = ts.getDeclarationOfKind(symbol, 169); + return bindingElement && + bindingElement.parent.kind === 167 && + !bindingElement.propertyName; + } + function getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol) { + if (isObjectBindingPatternElementWithoutPropertyName(symbol)) { + var bindingElement = ts.getDeclarationOfKind(symbol, 169); + var typeOfPattern = typeChecker.getTypeAtLocation(bindingElement.parent); + return typeOfPattern && typeChecker.getPropertyOfType(typeOfPattern, bindingElement.name.text); + } + return undefined; } function getInternedName(symbol, location, declarations) { if (ts.isImportOrExportSpecifierName(location)) { @@ -40843,26 +45976,29 @@ var ts; } function getSymbolScope(symbol) { var valueDeclaration = symbol.valueDeclaration; - if (valueDeclaration && (valueDeclaration.kind === 173 || valueDeclaration.kind === 186)) { + if (valueDeclaration && (valueDeclaration.kind === 179 || valueDeclaration.kind === 192)) { return valueDeclaration; } if (symbol.flags & (4 | 8192)) { - var privateDeclaration = ts.forEach(symbol.getDeclarations(), function (d) { return (d.flags & 16) ? d : undefined; }); + var privateDeclaration = ts.forEach(symbol.getDeclarations(), function (d) { return (d.flags & 8) ? d : undefined; }); if (privateDeclaration) { - return ts.getAncestor(privateDeclaration, 214); + return ts.getAncestor(privateDeclaration, 221); } } if (symbol.flags & 8388608) { return undefined; } + if (isObjectBindingPatternElementWithoutPropertyName(symbol)) { + return undefined; + } if (symbol.parent || (symbol.flags & 268435456)) { return undefined; } - var scope = undefined; + var scope; var declarations = symbol.getDeclarations(); if (declarations) { - for (var _i = 0, declarations_8 = declarations; _i < declarations_8.length; _i++) { - var declaration = declarations_8[_i]; + for (var _i = 0, declarations_9 = declarations; _i < declarations_9.length; _i++) { + var declaration = declarations_9[_i]; var container = getContainerNode(declaration); if (!container) { return undefined; @@ -40870,7 +46006,7 @@ var ts; if (scope && scope !== container) { return undefined; } - if (container.kind === 248 && !ts.isExternalModule(container)) { + if (container.kind === 256 && !ts.isExternalModule(container)) { return undefined; } scope = container; @@ -40951,7 +46087,7 @@ var ts; var tripleSlashDirectivePrefixRegex = /^\/\/\/\s*= 0) { + else if (!(referenceSymbol.flags & 67108864) && searchSymbols_1.indexOf(shorthandValueSymbol) >= 0) { var referencedSymbol = getReferencedSymbol(shorthandValueSymbol); referencedSymbol.references.push(getReferenceEntryFromNode(referenceSymbolDeclaration.name)); } @@ -41015,15 +46151,15 @@ var ts; if (!searchSpaceNode) { return undefined; } - var staticFlag = 64; + var staticFlag = 32; switch (searchSpaceNode.kind) { - case 141: - case 140: - case 143: - case 142: - case 144: case 145: + case 144: + case 147: case 146: + case 148: + case 149: + case 150: staticFlag &= searchSpaceNode.flags; searchSpaceNode = searchSpaceNode.parent; break; @@ -41040,7 +46176,7 @@ var ts; return; } var container = ts.getSuperContainer(node, false); - if (container && (64 & container.flags) === staticFlag && container.parent.symbol === searchSpaceNode.symbol) { + if (container && (32 & container.flags) === staticFlag && container.parent.symbol === searchSpaceNode.symbol) { references.push(getReferenceEntryFromNode(node)); } }); @@ -41049,34 +46185,34 @@ var ts; } function getReferencesForThisKeyword(thisOrSuperKeyword, sourceFiles) { var searchSpaceNode = ts.getThisContainer(thisOrSuperKeyword, false); - var staticFlag = 64; + var staticFlag = 32; switch (searchSpaceNode.kind) { - case 143: - case 142: + case 147: + case 146: if (ts.isObjectLiteralMethod(searchSpaceNode)) { break; } - case 141: - case 140: - case 144: case 145: - case 146: + case 144: + case 148: + case 149: + case 150: staticFlag &= searchSpaceNode.flags; searchSpaceNode = searchSpaceNode.parent; break; - case 248: + case 256: if (ts.isExternalModule(searchSpaceNode)) { return undefined; } - case 213: - case 173: + case 220: + case 179: break; default: return undefined; } var references = []; var possiblePositions; - if (searchSpaceNode.kind === 248) { + if (searchSpaceNode.kind === 256) { ts.forEach(sourceFiles, function (sourceFile) { possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", sourceFile.getStart(), sourceFile.getEnd()); getThisReferencesInFile(sourceFile, sourceFile, possiblePositions, references); @@ -41102,31 +46238,31 @@ var ts; ts.forEach(possiblePositions, function (position) { cancellationToken.throwIfCancellationRequested(); var node = ts.getTouchingWord(sourceFile, position); - if (!node || node.kind !== 97) { + if (!node || (node.kind !== 97 && node.kind !== 165)) { return; } var container = ts.getThisContainer(node, false); switch (searchSpaceNode.kind) { - case 173: - case 213: + case 179: + case 220: if (searchSpaceNode.symbol === container.symbol) { result.push(getReferenceEntryFromNode(node)); } break; - case 143: - case 142: + case 147: + case 146: if (ts.isObjectLiteralMethod(searchSpaceNode) && searchSpaceNode.symbol === container.symbol) { result.push(getReferenceEntryFromNode(node)); } break; - case 186: - case 214: - if (container.parent && searchSpaceNode.symbol === container.parent.symbol && (container.flags & 64) === staticFlag) { + case 192: + case 221: + if (container.parent && searchSpaceNode.symbol === container.parent.symbol && (container.flags & 32) === staticFlag) { result.push(getReferenceEntryFromNode(node)); } break; - case 248: - if (container.kind === 248 && !ts.isExternalModule(container)) { + case 256: + if (container.kind === 256 && !ts.isExternalModule(container)) { result.push(getReferenceEntryFromNode(node)); } break; @@ -41134,13 +46270,59 @@ var ts; }); } } + function getReferencesForStringLiteral(node, sourceFiles) { + var typeChecker = program.getTypeChecker(); + var type = getStringLiteralTypeForNode(node, typeChecker); + if (!type) { + return undefined; + } + var references = []; + for (var _i = 0, sourceFiles_5 = sourceFiles; _i < sourceFiles_5.length; _i++) { + var sourceFile = sourceFiles_5[_i]; + var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, type.text, sourceFile.getStart(), sourceFile.getEnd()); + getReferencesForStringLiteralInFile(sourceFile, type, possiblePositions, references); + } + return [{ + definition: { + containerKind: "", + containerName: "", + fileName: node.getSourceFile().fileName, + kind: ScriptElementKind.variableElement, + name: type.text, + textSpan: ts.createTextSpanFromBounds(node.getStart(), node.getEnd()) + }, + references: references + }]; + function getReferencesForStringLiteralInFile(sourceFile, searchType, possiblePositions, references) { + for (var _i = 0, possiblePositions_1 = possiblePositions; _i < possiblePositions_1.length; _i++) { + var position = possiblePositions_1[_i]; + cancellationToken.throwIfCancellationRequested(); + var node_2 = ts.getTouchingWord(sourceFile, position); + if (!node_2 || node_2.kind !== 9) { + return; + } + var type_1 = getStringLiteralTypeForNode(node_2, typeChecker); + if (type_1 === searchType) { + references.push(getReferenceEntryFromNode(node_2)); + } + } + } + } function populateSearchSymbolSet(symbol, location) { var result = [symbol]; - if (isImportOrExportSpecifierImportSymbol(symbol)) { - result.push(typeChecker.getAliasedSymbol(symbol)); + var containingObjectLiteralElement = getContainingObjectLiteralElement(location); + if (containingObjectLiteralElement && containingObjectLiteralElement.kind !== 254) { + var propertySymbol = getPropertySymbolOfDestructuringAssignment(location); + if (propertySymbol) { + result.push(propertySymbol); + } } - if (isNameOfPropertyAssignment(location)) { - ts.forEach(getPropertySymbolsFromContextualType(location), function (contextualSymbol) { + var aliasSymbol = getAliasSymbolForPropertyNameSymbol(symbol, location); + if (aliasSymbol) { + result = result.concat(populateSearchSymbolSet(aliasSymbol, location)); + } + if (containingObjectLiteralElement) { + ts.forEach(getPropertySymbolsFromContextualType(containingObjectLiteralElement), function (contextualSymbol) { ts.addRange(result, typeChecker.getRootSymbols(contextualSymbol)); }); var shorthandValueSymbol = typeChecker.getShorthandAssignmentValueSymbol(location.parent); @@ -41148,24 +46330,38 @@ var ts; result.push(shorthandValueSymbol); } } + if (symbol.valueDeclaration && symbol.valueDeclaration.kind === 142 && + ts.isParameterPropertyDeclaration(symbol.valueDeclaration)) { + result = result.concat(typeChecker.getSymbolsOfParameterPropertyDeclaration(symbol.valueDeclaration, symbol.name)); + } + var bindingElementPropertySymbol = getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol); + if (bindingElementPropertySymbol) { + result.push(bindingElementPropertySymbol); + } ts.forEach(typeChecker.getRootSymbols(symbol), function (rootSymbol) { if (rootSymbol !== symbol) { result.push(rootSymbol); } if (rootSymbol.parent && rootSymbol.parent.flags & (32 | 64)) { - getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result); + getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result, {}); } }); return result; } - function getPropertySymbolsFromBaseTypes(symbol, propertyName, result) { - if (symbol && symbol.flags & (32 | 64)) { + function getPropertySymbolsFromBaseTypes(symbol, propertyName, result, previousIterationSymbolsCache) { + if (!symbol) { + return; + } + if (ts.hasProperty(previousIterationSymbolsCache, symbol.name)) { + return; + } + if (symbol.flags & (32 | 64)) { ts.forEach(symbol.getDeclarations(), function (declaration) { - if (declaration.kind === 214) { + if (ts.isClassLike(declaration)) { getPropertySymbolFromTypeReference(ts.getClassExtendsHeritageClauseElement(declaration)); ts.forEach(ts.getClassImplementsHeritageClauseElements(declaration), getPropertySymbolFromTypeReference); } - else if (declaration.kind === 215) { + else if (declaration.kind === 222) { ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), getPropertySymbolFromTypeReference); } }); @@ -41177,9 +46373,10 @@ var ts; if (type) { var propertySymbol = typeChecker.getPropertyOfType(type, propertyName); if (propertySymbol) { - result.push(propertySymbol); + result.push.apply(result, typeChecker.getRootSymbols(propertySymbol)); } - getPropertySymbolsFromBaseTypes(type.symbol, propertyName, result); + previousIterationSymbolsCache[symbol.name] = symbol; + getPropertySymbolsFromBaseTypes(type.symbol, propertyName, result, previousIterationSymbolsCache); } } } @@ -41188,68 +46385,78 @@ var ts; if (searchSymbols.indexOf(referenceSymbol) >= 0) { return referenceSymbol; } - if (isImportOrExportSpecifierImportSymbol(referenceSymbol)) { - var aliasedSymbol = typeChecker.getAliasedSymbol(referenceSymbol); - if (searchSymbols.indexOf(aliasedSymbol) >= 0) { - return aliasedSymbol; - } + var aliasSymbol = getAliasSymbolForPropertyNameSymbol(referenceSymbol, referenceLocation); + if (aliasSymbol) { + return getRelatedSymbol(searchSymbols, aliasSymbol, referenceLocation); } - if (isNameOfPropertyAssignment(referenceLocation)) { - return ts.forEach(getPropertySymbolsFromContextualType(referenceLocation), function (contextualSymbol) { + var containingObjectLiteralElement = getContainingObjectLiteralElement(referenceLocation); + if (containingObjectLiteralElement) { + var contextualSymbol = ts.forEach(getPropertySymbolsFromContextualType(containingObjectLiteralElement), function (contextualSymbol) { return ts.forEach(typeChecker.getRootSymbols(contextualSymbol), function (s) { return searchSymbols.indexOf(s) >= 0 ? s : undefined; }); }); + if (contextualSymbol) { + return contextualSymbol; + } + var propertySymbol = getPropertySymbolOfDestructuringAssignment(referenceLocation); + if (propertySymbol && searchSymbols.indexOf(propertySymbol) >= 0) { + return propertySymbol; + } + } + var bindingElementPropertySymbol = getPropertySymbolOfObjectBindingPatternWithoutPropertyName(referenceSymbol); + if (bindingElementPropertySymbol && searchSymbols.indexOf(bindingElementPropertySymbol) >= 0) { + return bindingElementPropertySymbol; } return ts.forEach(typeChecker.getRootSymbols(referenceSymbol), function (rootSymbol) { if (searchSymbols.indexOf(rootSymbol) >= 0) { return rootSymbol; } if (rootSymbol.parent && rootSymbol.parent.flags & (32 | 64)) { - var result_3 = []; - getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result_3); - return ts.forEach(result_3, function (s) { return searchSymbols.indexOf(s) >= 0 ? s : undefined; }); + var result_4 = []; + getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result_4, {}); + return ts.forEach(result_4, function (s) { return searchSymbols.indexOf(s) >= 0 ? s : undefined; }); } return undefined; }); } - function getPropertySymbolsFromContextualType(node) { - if (isNameOfPropertyAssignment(node)) { - var objectLiteral = node.parent.parent; - var contextualType = typeChecker.getContextualType(objectLiteral); - var name_37 = node.text; - if (contextualType) { - if (contextualType.flags & 16384) { - var unionProperty = contextualType.getProperty(name_37); - if (unionProperty) { - return [unionProperty]; - } - else { - var result_4 = []; - ts.forEach(contextualType.types, function (t) { - var symbol = t.getProperty(name_37); - if (symbol) { - result_4.push(symbol); - } - }); - return result_4; - } - } - else { - var symbol_1 = contextualType.getProperty(name_37); - if (symbol_1) { - return [symbol_1]; - } - } + function getNameFromObjectLiteralElement(node) { + if (node.name.kind === 140) { + var nameExpression = node.name.expression; + if (ts.isStringOrNumericLiteral(nameExpression.kind)) { + return nameExpression.text; } + return undefined; + } + return node.name.text; + } + function getPropertySymbolsFromContextualType(node) { + var objectLiteral = node.parent; + var contextualType = typeChecker.getContextualType(objectLiteral); + var name = getNameFromObjectLiteralElement(node); + if (name && contextualType) { + var result_5 = []; + var symbol_1 = contextualType.getProperty(name); + if (symbol_1) { + result_5.push(symbol_1); + } + if (contextualType.flags & 16384) { + ts.forEach(contextualType.types, function (t) { + var symbol = t.getProperty(name); + if (symbol) { + result_5.push(symbol); + } + }); + } + return result_5; } return undefined; } function getIntersectingMeaningFromDeclarations(meaning, declarations) { if (declarations) { - var lastIterationMeaning; + var lastIterationMeaning = void 0; do { lastIterationMeaning = meaning; - for (var _i = 0, declarations_9 = declarations; _i < declarations_9.length; _i++) { - var declaration = declarations_9[_i]; + for (var _i = 0, declarations_10 = declarations; _i < declarations_10.length; _i++) { + var declaration = declarations_10[_i]; var declarationMeaning = getMeaningFromDeclaration(declaration); if (declarationMeaning & meaning) { meaning |= declarationMeaning; @@ -41279,10 +46486,10 @@ var ts; } var parent = node.parent; if (parent) { - if (parent.kind === 180 || parent.kind === 179) { + if (parent.kind === 186 || parent.kind === 185) { return true; } - else if (parent.kind === 181 && parent.left === node) { + else if (parent.kind === 187 && parent.left === node) { var operator = parent.operatorToken.kind; return 56 <= operator && operator <= 68; } @@ -41293,9 +46500,6 @@ var ts; synchronizeHostData(); return ts.NavigateTo.getNavigateToItems(program, cancellationToken, searchValue, maxResultCount); } - function containErrors(diagnostics) { - return ts.forEach(diagnostics, function (diagnostic) { return diagnostic.category === ts.DiagnosticCategory.Error; }); - } function getEmitOutput(fileName) { synchronizeHostData(); var sourceFile = getValidSourceFile(fileName); @@ -41315,34 +46519,34 @@ var ts; } function getMeaningFromDeclaration(node) { switch (node.kind) { - case 138: - case 211: - case 163: - case 141: - case 140: - case 245: - case 246: - case 247: - case 143: case 142: - case 144: - case 145: - case 146: - case 213: - case 173: - case 174: - case 244: - return 1; - case 137: - case 215: - case 216: - case 155: - return 2; - case 214: - case 217: - return 1 | 2; case 218: - if (node.name.kind === 9) { + case 169: + case 145: + case 144: + case 253: + case 254: + case 255: + case 147: + case 146: + case 148: + case 149: + case 150: + case 220: + case 179: + case 180: + case 252: + return 1; + case 141: + case 222: + case 223: + case 159: + return 2; + case 221: + case 224: + return 1 | 2; + case 225: + if (ts.isAmbientModule(node)) { return 4 | 1; } else if (ts.getModuleInstanceState(node) === 1) { @@ -41351,14 +46555,14 @@ var ts; else { return 4; } - case 225: - case 226: - case 221: - case 222: - case 227: - case 228: + case 233: + case 234: + case 229: + case 230: + case 235: + case 236: return 1 | 2 | 4; - case 248: + case 256: return 4 | 1; } return 1 | 2 | 4; @@ -41367,9 +46571,10 @@ var ts; if (ts.isRightSideOfQualifiedNameOrPropertyAccess(node)) { node = node.parent; } - return node.parent.kind === 151 || - (node.parent.kind === 188 && !ts.isExpressionWithTypeArgumentsInClassExtendsClause(node.parent)) || - node.kind === 97 && !ts.isExpression(node); + return node.parent.kind === 155 || + (node.parent.kind === 194 && !ts.isExpressionWithTypeArgumentsInClassExtendsClause(node.parent)) || + (node.kind === 97 && !ts.isExpression(node)) || + node.kind === 165; } function isNamespaceReference(node) { return isQualifiedNameNamespaceReference(node) || isPropertyAccessNamespaceReference(node); @@ -41377,47 +46582,47 @@ var ts; function isPropertyAccessNamespaceReference(node) { var root = node; var isLastClause = true; - if (root.parent.kind === 166) { - while (root.parent && root.parent.kind === 166) { + if (root.parent.kind === 172) { + while (root.parent && root.parent.kind === 172) { root = root.parent; } isLastClause = root.name === node; } - if (!isLastClause && root.parent.kind === 188 && root.parent.parent.kind === 243) { + if (!isLastClause && root.parent.kind === 194 && root.parent.parent.kind === 251) { var decl = root.parent.parent.parent; - return (decl.kind === 214 && root.parent.parent.token === 106) || - (decl.kind === 215 && root.parent.parent.token === 83); + return (decl.kind === 221 && root.parent.parent.token === 106) || + (decl.kind === 222 && root.parent.parent.token === 83); } return false; } function isQualifiedNameNamespaceReference(node) { var root = node; var isLastClause = true; - if (root.parent.kind === 135) { - while (root.parent && root.parent.kind === 135) { + if (root.parent.kind === 139) { + while (root.parent && root.parent.kind === 139) { root = root.parent; } isLastClause = root.right === node; } - return root.parent.kind === 151 && !isLastClause; + return root.parent.kind === 155 && !isLastClause; } function isInRightSideOfImport(node) { - while (node.parent.kind === 135) { + while (node.parent.kind === 139) { node = node.parent; } return ts.isInternalModuleImportEqualsDeclaration(node.parent) && node.parent.moduleReference === node; } function getMeaningFromRightHandSideOfImportEquals(node) { ts.Debug.assert(node.kind === 69); - if (node.parent.kind === 135 && + if (node.parent.kind === 139 && node.parent.right === node && - node.parent.parent.kind === 221) { + node.parent.parent.kind === 229) { return 1 | 2 | 4; } return 4; } function getMeaningFromLocation(node) { - if (node.parent.kind === 227) { + if (node.parent.kind === 235) { return 1 | 2 | 4; } else if (isInRightSideOfImport(node)) { @@ -41441,24 +46646,26 @@ var ts; var sourceFile = getValidSourceFile(fileName); return ts.SignatureHelp.getSignatureHelpItems(program, sourceFile, position, cancellationToken); } - function getSourceFile(fileName) { + function getNonBoundSourceFile(fileName) { return syntaxTreeCache.getCurrentSourceFile(fileName); } function getNameOrDottedNameSpan(fileName, startPos, endPos) { var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); var node = ts.getTouchingPropertyName(sourceFile, startPos); - if (!node) { + if (node === sourceFile) { return; } switch (node.kind) { - case 166: - case 135: + case 172: + case 139: case 9: + case 166: case 84: case 99: case 93: case 95: case 97: + case 165: case 69: break; default: @@ -41470,7 +46677,7 @@ var ts; nodeForStartPos = nodeForStartPos.parent; } else if (isNameOfModuleDeclaration(nodeForStartPos)) { - if (nodeForStartPos.parent.parent.kind === 218 && + if (nodeForStartPos.parent.parent.kind === 225 && nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { nodeForStartPos = nodeForStartPos.parent.parent.name; } @@ -41490,17 +46697,17 @@ var ts; } function getNavigationBarItems(fileName) { var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); - return ts.NavigationBar.getNavigationBarItems(sourceFile); + return ts.NavigationBar.getNavigationBarItems(sourceFile, host.getCompilationSettings()); } function getSemanticClassifications(fileName, span) { return convertClassifications(getEncodedSemanticClassifications(fileName, span)); } function checkForClassificationCancellation(kind) { switch (kind) { - case 218: - case 214: - case 215: - case 213: + case 225: + case 221: + case 222: + case 220: cancellationToken.throwIfCancellationRequested(); } } @@ -41548,7 +46755,7 @@ var ts; return undefined; function hasValueSideModule(symbol) { return ts.forEach(symbol.declarations, function (declaration) { - return declaration.kind === 218 && + return declaration.kind === 225 && ts.getModuleInstanceState(declaration) === 1; }); } @@ -41595,6 +46802,9 @@ var ts; case 19: return ClassificationTypeNames.jsxOpenTagName; case 20: return ClassificationTypeNames.jsxCloseTagName; case 21: return ClassificationTypeNames.jsxSelfClosingTagName; + case 22: return ClassificationTypeNames.jsxAttribute; + case 23: return ClassificationTypeNames.jsxText; + case 24: return ClassificationTypeNames.jsxAttributeStringLiteralValue; } } function convertClassifications(classifications) { @@ -41684,16 +46894,16 @@ var ts; pushClassification(tag.tagName.pos, tag.tagName.end - tag.tagName.pos, 18); pos = tag.tagName.end; switch (tag.kind) { - case 267: + case 275: processJSDocParameterTag(tag); break; - case 270: + case 278: processJSDocTemplateTag(tag); break; - case 269: + case 277: processElement(tag.typeExpression); break; - case 268: + case 276: processElement(tag.typeExpression); break; } @@ -41728,7 +46938,8 @@ var ts; } } function classifyDisabledMergeCode(text, start, end) { - for (var i = start; i < end; i++) { + var i; + for (i = start; i < end; i++) { if (ts.isLineBreak(text.charCodeAt(i))) { break; } @@ -41748,19 +46959,49 @@ var ts; pushClassification(start, end - start, type); } } - function classifyToken(token) { - if (ts.nodeIsMissing(token)) { - return; + function tryClassifyNode(node) { + if (ts.nodeIsMissing(node)) { + return true; } - var tokenStart = classifyLeadingTriviaAndGetTokenStart(token); - var tokenWidth = token.end - tokenStart; + var classifiedElementName = tryClassifyJsxElementName(node); + if (!ts.isToken(node) && node.kind !== 244 && classifiedElementName === undefined) { + return false; + } + var tokenStart = node.kind === 244 ? node.pos : classifyLeadingTriviaAndGetTokenStart(node); + var tokenWidth = node.end - tokenStart; ts.Debug.assert(tokenWidth >= 0); if (tokenWidth > 0) { - var type = classifyTokenType(token.kind, token); + var type = classifiedElementName || classifyTokenType(node.kind, node); if (type) { pushClassification(tokenStart, tokenWidth, type); } } + return true; + } + function tryClassifyJsxElementName(token) { + switch (token.parent && token.parent.kind) { + case 243: + if (token.parent.tagName === token) { + return 19; + } + break; + case 245: + if (token.parent.tagName === token) { + return 20; + } + break; + case 242: + if (token.parent.tagName === token) { + return 21; + } + break; + case 246: + if (token.parent.name === token) { + return 22; + } + break; + } + return undefined; } function classifyTokenType(tokenKind, token) { if (ts.isKeyword(tokenKind)) { @@ -41774,16 +47015,17 @@ var ts; if (ts.isPunctuation(tokenKind)) { if (token) { if (tokenKind === 56) { - if (token.parent.kind === 211 || - token.parent.kind === 141 || - token.parent.kind === 138) { + if (token.parent.kind === 218 || + token.parent.kind === 145 || + token.parent.kind === 142 || + token.parent.kind === 246) { return 5; } } - if (token.parent.kind === 181 || - token.parent.kind === 179 || - token.parent.kind === 180 || - token.parent.kind === 182) { + if (token.parent.kind === 187 || + token.parent.kind === 185 || + token.parent.kind === 186 || + token.parent.kind === 188) { return 5; } } @@ -41792,8 +47034,8 @@ var ts; else if (tokenKind === 8) { return 4; } - else if (tokenKind === 9) { - return 6; + else if (tokenKind === 9 || tokenKind === 166) { + return token.parent.kind === 246 ? 24 : 6; } else if (tokenKind === 10) { return 6; @@ -41801,54 +47043,42 @@ var ts; else if (ts.isTemplateLiteralKind(tokenKind)) { return 6; } + else if (tokenKind === 244) { + return 23; + } else if (tokenKind === 69) { if (token) { switch (token.parent.kind) { - case 214: + case 221: if (token.parent.name === token) { return 11; } return; - case 137: + case 141: if (token.parent.name === token) { return 15; } return; - case 215: + case 222: if (token.parent.name === token) { return 13; } return; - case 217: + case 224: if (token.parent.name === token) { return 12; } return; - case 218: + case 225: if (token.parent.name === token) { return 14; } return; - case 138: + case 142: if (token.parent.name === token) { return 17; } return; - case 235: - if (token.parent.tagName === token) { - return 19; - } - return; - case 237: - if (token.parent.tagName === token) { - return 20; - } - return; - case 234: - if (token.parent.tagName === token) { - return 21; - } - return; } } return 2; @@ -41863,10 +47093,7 @@ var ts; var children = element.getChildren(sourceFile); for (var i = 0, n = children.length; i < n; i++) { var child = children[i]; - if (ts.isToken(child)) { - classifyToken(child); - } - else { + if (!tryClassifyNode(child)) { processElement(child); } } @@ -41948,7 +47175,6 @@ var ts; return []; } function getDocCommentTemplateAtPosition(fileName, position) { - var start = new Date().getTime(); var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); if (ts.isInString(sourceFile, position) || ts.isInComment(sourceFile, position) || ts.hasDocComment(sourceFile, position)) { return undefined; @@ -41961,16 +47187,16 @@ var ts; var commentOwner; findOwner: for (commentOwner = tokenAtPos; commentOwner; commentOwner = commentOwner.parent) { switch (commentOwner.kind) { - case 213: - case 143: - case 144: - case 214: - case 193: + case 220: + case 147: + case 148: + case 221: + case 200: break findOwner; - case 248: + case 256: return undefined; - case 218: - if (commentOwner.parent.kind === 218) { + case 225: + if (commentOwner.parent.kind === 225) { return undefined; } break findOwner; @@ -41983,7 +47209,7 @@ var ts; var posLineAndChar = sourceFile.getLineAndCharacterOfPosition(position); var lineStart = sourceFile.getLineStarts()[posLineAndChar.line]; var indentationStr = sourceFile.text.substr(lineStart, posLineAndChar.character); - var newLine = host.getNewLine ? host.getNewLine() : "\r\n"; + var newLine = ts.getNewLineOrDefaultFromHost(host); var docParams = ""; for (var i = 0, numParams = parameters.length; i < numParams; i++) { var currentName = parameters[i].name; @@ -42000,11 +47226,27 @@ var ts; (tokenStart === position ? newLine + indentationStr : ""); return { newText: result, caretOffset: preamble.length }; } + function isValidBraceCompletionAtPostion(fileName, position, openingBrace) { + if (openingBrace === 60) { + return false; + } + var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); + if (ts.isInString(sourceFile, position) || ts.isInComment(sourceFile, position)) { + return false; + } + if (ts.isInsideJsxElementOrAttribute(sourceFile, position)) { + return openingBrace === 123; + } + if (ts.isInTemplateString(sourceFile, position)) { + return false; + } + return true; + } function getParametersForJsDocOwningNode(commentOwner) { if (ts.isFunctionLike(commentOwner)) { return commentOwner.parameters; } - if (commentOwner.kind === 193) { + if (commentOwner.kind === 200) { var varStatement = commentOwner; var varDeclarations = varStatement.declarationList.declarations; if (varDeclarations.length === 1 && varDeclarations[0].initializer) { @@ -42014,17 +47256,17 @@ var ts; return emptyArray; } function getParametersFromRightHandSideOfAssignment(rightHandSide) { - while (rightHandSide.kind === 172) { + while (rightHandSide.kind === 178) { rightHandSide = rightHandSide.expression; } switch (rightHandSide.kind) { - case 173: - case 174: + case 179: + case 180: return rightHandSide.parameters; - case 186: + case 192: for (var _i = 0, _a = rightHandSide.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.kind === 144) { + if (member.kind === 148) { return member.parameters; } } @@ -42040,7 +47282,7 @@ var ts; var result = []; if (descriptors.length > 0) { var regExp = getTodoCommentsRegExp(); - var matchArray; + var matchArray = void 0; while (matchArray = regExp.exec(fileContents)) { cancellationToken.throwIfCancellationRequested(); var firstDescriptorCaptureIndex = 3; @@ -42076,8 +47318,8 @@ var ts; function getTodoCommentsRegExp() { var singleLineCommentStart = /(?:\/\/+\s*)/.source; var multiLineCommentStart = /(?:\/\*+\s*)/.source; - var anyNumberOfSpacesAndAsterixesAtStartOfLine = /(?:^(?:\s|\*)*)/.source; - var preamble = "(" + anyNumberOfSpacesAndAsterixesAtStartOfLine + "|" + singleLineCommentStart + "|" + multiLineCommentStart + ")"; + var anyNumberOfSpacesAndAsterisksAtStartOfLine = /(?:^(?:\s|\*)*)/.source; + var preamble = "(" + anyNumberOfSpacesAndAsterisksAtStartOfLine + "|" + singleLineCommentStart + "|" + multiLineCommentStart + ")"; var literals = "(?:" + ts.map(descriptors, function (d) { return "(" + escapeRegExp(d.text) + ")"; }).join("|") + ")"; var endOfLineOrEndOfComment = /(?:$|\*\/)/.source; var messageRemainder = /(?:.*?)/.source; @@ -42091,39 +47333,65 @@ var ts; (char >= 48 && char <= 57); } } + function getStringLiteralTypeForNode(node, typeChecker) { + var searchNode = node.parent.kind === 166 ? node.parent : node; + var type = typeChecker.getTypeAtLocation(searchNode); + if (type && type.flags & 256) { + return type; + } + return undefined; + } function getRenameInfo(fileName, position) { synchronizeHostData(); var sourceFile = getValidSourceFile(fileName); var typeChecker = program.getTypeChecker(); + var defaultLibFileName = host.getDefaultLibFileName(host.getCompilationSettings()); + var canonicalDefaultLibName = getCanonicalFileName(ts.normalizePath(defaultLibFileName)); var node = ts.getTouchingWord(sourceFile, position); - if (node && node.kind === 69) { - var symbol = typeChecker.getSymbolAtLocation(node); - if (symbol) { - var declarations = symbol.getDeclarations(); - if (declarations && declarations.length > 0) { - var defaultLibFileName = host.getDefaultLibFileName(host.getCompilationSettings()); - if (defaultLibFileName) { - for (var _i = 0, declarations_10 = declarations; _i < declarations_10.length; _i++) { - var current = declarations_10[_i]; - var sourceFile_2 = current.getSourceFile(); - var canonicalName = getCanonicalFileName(ts.normalizePath(sourceFile_2.fileName)); - if (sourceFile_2 && getCanonicalFileName(ts.normalizePath(sourceFile_2.fileName)) === getCanonicalFileName(ts.normalizePath(defaultLibFileName))) { - return getRenameInfoError(ts.getLocaleSpecificMessage(ts.Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library)); - } + if (node) { + if (node.kind === 69 || + node.kind === 9 || + isLiteralNameOfPropertyDeclarationOrIndexAccess(node)) { + var symbol = typeChecker.getSymbolAtLocation(node); + if (symbol) { + var declarations = symbol.getDeclarations(); + if (declarations && declarations.length > 0) { + if (ts.forEach(declarations, isDefinedInLibraryFile)) { + return getRenameInfoError(ts.getLocaleSpecificMessage(ts.Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library)); + } + var displayName = ts.stripQuotes(ts.getDeclaredName(typeChecker, symbol, node)); + var kind = getSymbolKind(symbol, node); + if (kind) { + return { + canRename: true, + kind: kind, + displayName: displayName, + localizedErrorMessage: undefined, + fullDisplayName: typeChecker.getFullyQualifiedName(symbol), + kindModifiers: getSymbolModifiers(symbol), + triggerSpan: createTriggerSpanForNode(node, sourceFile) + }; } } - var displayName = ts.stripQuotes(ts.getDeclaredName(typeChecker, symbol, node)); - var kind = getSymbolKind(symbol, node); - if (kind) { - return { - canRename: true, - localizedErrorMessage: undefined, - displayName: displayName, - fullDisplayName: typeChecker.getFullyQualifiedName(symbol), - kind: kind, - kindModifiers: getSymbolModifiers(symbol), - triggerSpan: ts.createTextSpan(node.getStart(), node.getWidth()) - }; + } + else if (node.kind === 9) { + var type = getStringLiteralTypeForNode(node, typeChecker); + if (type) { + if (isDefinedInLibraryFile(node)) { + return getRenameInfoError(ts.getLocaleSpecificMessage(ts.Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library)); + } + else { + var displayName = ts.stripQuotes(type.text); + return { + canRename: true, + kind: ScriptElementKind.variableElement, + displayName: displayName, + localizedErrorMessage: undefined, + fullDisplayName: displayName, + kindModifiers: ScriptElementKindModifier.none, + triggerSpan: createTriggerSpanForNode(node, sourceFile) + }; + } } } } @@ -42140,6 +47408,25 @@ var ts; triggerSpan: undefined }; } + function isDefinedInLibraryFile(declaration) { + if (defaultLibFileName) { + var sourceFile_3 = declaration.getSourceFile(); + var canonicalName = getCanonicalFileName(ts.normalizePath(sourceFile_3.fileName)); + if (canonicalName === canonicalDefaultLibName) { + return true; + } + } + return false; + } + function createTriggerSpanForNode(node, sourceFile) { + var start = node.getStart(sourceFile); + var width = node.getWidth(sourceFile); + if (node.kind === 9) { + start += 1; + width -= 2; + } + return ts.createTextSpan(start, width); + } } return { dispose: dispose, @@ -42175,8 +47462,9 @@ var ts; getFormattingEditsForDocument: getFormattingEditsForDocument, getFormattingEditsAfterKeystroke: getFormattingEditsAfterKeystroke, getDocCommentTemplateAtPosition: getDocCommentTemplateAtPosition, + isValidBraceCompletionAtPostion: isValidBraceCompletionAtPostion, getEmitOutput: getEmitOutput, - getSourceFile: getSourceFile, + getNonBoundSourceFile: getNonBoundSourceFile, getProgram: getProgram }; } @@ -42195,14 +47483,15 @@ var ts; function walk(node) { switch (node.kind) { case 69: - nameTable[node.text] = node.text; + nameTable[node.text] = nameTable[node.text] === undefined ? node.pos : -1; break; case 9: case 8: if (ts.isDeclarationName(node) || - node.parent.kind === 232 || - isArgumentOfElementAccessExpression(node)) { - nameTable[node.text] = node.text; + node.parent.kind === 240 || + isArgumentOfElementAccessExpression(node) || + ts.isLiteralComputedPropertyDeclarationName(node)) { + nameTable[node.text] = nameTable[node.text] === undefined ? node.pos : -1; } break; default: @@ -42213,7 +47502,7 @@ var ts; function isArgumentOfElementAccessExpression(node) { return node && node.parent && - node.parent.kind === 167 && + node.parent.kind === 173 && node.parent.argumentExpression === node; } function createClassifier() { @@ -42235,7 +47524,7 @@ var ts; function canFollow(keyword1, keyword2) { if (ts.isAccessibilityModifier(keyword1)) { if (keyword2 === 123 || - keyword2 === 129 || + keyword2 === 131 || keyword2 === 121 || keyword2 === 113) { return true; @@ -42301,7 +47590,7 @@ var ts; } switch (lexState) { case 3: - text = '"\\\n' + text; + text = "\"\\\n" + text; offset = 3; break; case 2: @@ -42351,10 +47640,10 @@ var ts; angleBracketStack--; } else if (token === 117 || + token === 132 || token === 130 || - token === 128 || token === 120 || - token === 131) { + token === 133) { if (angleBracketStack > 0 && !syntacticClassifierAbsent) { token = 69; } @@ -42395,7 +47684,7 @@ var ts; var end = scanner.getTextPos(); addResult(start, end, classFromKind(token)); if (end >= text.length) { - if (token === 9) { + if (token === 9 || token === 166) { var tokenText = scanner.getTokenText(); if (scanner.isUnterminated()) { var lastCharIndex = tokenText.length - 1; @@ -42509,7 +47798,7 @@ var ts; } } function isKeyword(token) { - return token >= 70 && token <= 134; + return token >= 70 && token <= 138; } function classFromKind(token) { if (isKeyword(token)) { @@ -42525,6 +47814,7 @@ var ts; case 8: return 4; case 9: + case 166: return 6; case 10: return 7; @@ -42632,6 +47922,13 @@ var ts; text: ts.flattenDiagnosticMessageText(diag.messageText, "\n") }; } + function formatConfigFileDiag(diag) { + return { + start: undefined, + end: undefined, + text: ts.flattenDiagnosticMessageText(diag.messageText, "\n") + }; + } function allEditsBeforePos(edits, pos) { for (var i = 0, len = edits.length; i < len; i++) { if (ts.textSpanEnd(edits[i].span) >= pos) { @@ -42681,9 +47978,6 @@ var ts; this.byteLength = byteLength; this.hrtime = hrtime; this.logger = logger; - this.pendingOperation = false; - this.fileHash = {}; - this.nextFileId = 1; this.changeSeq = 0; this.handlers = (_a = {}, _a[CommandNames.Exit] = function () { @@ -42708,7 +48002,22 @@ var ts; }, _a[CommandNames.Open] = function (request) { var openArgs = request.arguments; - _this.openClientFile(openArgs.file); + var scriptKind; + switch (openArgs.scriptKindName) { + case "TS": + scriptKind = 3; + break; + case "JS": + scriptKind = 1; + break; + case "TSX": + scriptKind = 4; + break; + case "JSX": + scriptKind = 2; + break; + } + _this.openClientFile(openArgs.file, openArgs.fileContent, scriptKind); return { responseRequired: false }; }, _a[CommandNames.Quickinfo] = function (request) { @@ -42729,7 +48038,9 @@ var ts; }, _a[CommandNames.CompletionDetails] = function (request) { var completionDetailsArgs = request.arguments; - return { response: _this.getCompletionEntryDetails(completionDetailsArgs.line, completionDetailsArgs.offset, completionDetailsArgs.entryNames, completionDetailsArgs.file), responseRequired: true }; + return { + response: _this.getCompletionEntryDetails(completionDetailsArgs.line, completionDetailsArgs.offset, completionDetailsArgs.entryNames, completionDetailsArgs.file), responseRequired: true + }; }, _a[CommandNames.SignatureHelp] = function (request) { var signatureHelpArgs = request.arguments; @@ -42757,7 +48068,7 @@ var ts; _a[CommandNames.Reload] = function (request) { var reloadArgs = request.arguments; _this.reload(reloadArgs.file, reloadArgs.tmpfile, request.seq); - return { responseRequired: false }; + return { response: { reloadFinished: true }, responseRequired: true }; }, _a[CommandNames.Saveto] = function (request) { var savetoArgs = request.arguments; @@ -42834,6 +48145,20 @@ var ts; this.sendLineToClient("Content-Length: " + (1 + this.byteLength(json, "utf8")) + "\r\n\r\n" + json); }; + Session.prototype.configFileDiagnosticEvent = function (triggerFile, configFile, diagnostics) { + var bakedDiags = ts.map(diagnostics, formatConfigFileDiag); + var ev = { + seq: 0, + type: "event", + event: "configFileDiag", + body: { + triggerFile: triggerFile, + configFile: configFile, + diagnostics: bakedDiags + } + }; + this.send(ev); + }; Session.prototype.event = function (info, eventName) { var ev = { seq: 0, @@ -42888,10 +48213,6 @@ var ts; this.logError(err, "syntactic check"); } }; - Session.prototype.errorCheck = function (file, project) { - this.syntacticCheck(file, project); - this.semanticCheck(file, project); - }; Session.prototype.reloadProjects = function () { this.projectService.reloadProjects(); }; @@ -42922,11 +48243,12 @@ var ts; var index = 0; var checkOne = function () { if (matchSeq(seq)) { - var checkSpec = checkList[index++]; - if (checkSpec.project.getSourceFileFromName(checkSpec.fileName, requireOpen)) { - _this.syntacticCheck(checkSpec.fileName, checkSpec.project); + var checkSpec_1 = checkList[index]; + index++; + if (checkSpec_1.project.getSourceFileFromName(checkSpec_1.fileName, requireOpen)) { + _this.syntacticCheck(checkSpec_1.fileName, checkSpec_1.project); _this.immediateId = setImmediate(function () { - _this.semanticCheck(checkSpec.fileName, checkSpec.project); + _this.semanticCheck(checkSpec_1.fileName, checkSpec_1.project); _this.immediateId = undefined; if (checkList.length > index) { _this.errorTimer = setTimeout(checkOne, followMs); @@ -43042,13 +48364,15 @@ var ts; }; Session.prototype.getRenameLocations = function (line, offset, fileName, findInComments, findInStrings) { var file = ts.normalizePath(fileName); - var project = this.projectService.getProjectForFile(file); - if (!project) { + var info = this.projectService.getScriptInfo(file); + var projects = this.projectService.findReferencingProjects(info); + if (!projects.length) { throw Errors.NoProject; } - var compilerService = project.compilerService; - var position = compilerService.host.lineOffsetToPosition(file, line, offset); - var renameInfo = compilerService.languageService.getRenameInfo(file, position); + var defaultProject = projects[0]; + var defaultProjectCompilerService = defaultProject.compilerService; + var position = defaultProjectCompilerService.host.lineOffsetToPosition(file, line, offset); + var renameInfo = defaultProjectCompilerService.languageService.getRenameInfo(file, position); if (!renameInfo) { return undefined; } @@ -43058,15 +48382,35 @@ var ts; locs: [] }; } - var renameLocations = compilerService.languageService.findRenameLocations(file, position, findInStrings, findInComments); - if (!renameLocations) { - return undefined; - } - var bakedRenameLocs = renameLocations.map(function (location) { return ({ - file: location.fileName, - start: compilerService.host.positionToLineOffset(location.fileName, location.textSpan.start), - end: compilerService.host.positionToLineOffset(location.fileName, ts.textSpanEnd(location.textSpan)) - }); }).sort(function (a, b) { + var fileSpans = server.combineProjectOutput(projects, function (project) { + var compilerService = project.compilerService; + var renameLocations = compilerService.languageService.findRenameLocations(file, position, findInStrings, findInComments); + if (!renameLocations) { + return []; + } + return renameLocations.map(function (location) { return ({ + file: location.fileName, + start: compilerService.host.positionToLineOffset(location.fileName, location.textSpan.start), + end: compilerService.host.positionToLineOffset(location.fileName, ts.textSpanEnd(location.textSpan)) + }); }); + }, compareRenameLocation, function (a, b) { return a.file === b.file && a.start.line === b.start.line && a.start.offset === b.start.offset; }); + var locs = fileSpans.reduce(function (accum, cur) { + var curFileAccum; + if (accum.length > 0) { + curFileAccum = accum[accum.length - 1]; + if (curFileAccum.file !== cur.file) { + curFileAccum = undefined; + } + } + if (!curFileAccum) { + curFileAccum = { file: cur.file, locs: [] }; + accum.push(curFileAccum); + } + curFileAccum.locs.push({ start: cur.start, end: cur.end }); + return accum; + }, []); + return { info: renameInfo, locs: locs }; + function compareRenameLocation(a, b) { if (a.file < b.file) { return -1; } @@ -43084,66 +48428,66 @@ var ts; return b.start.offset - a.start.offset; } } - }).reduce(function (accum, cur) { - var curFileAccum; - if (accum.length > 0) { - curFileAccum = accum[accum.length - 1]; - if (curFileAccum.file != cur.file) { - curFileAccum = undefined; - } - } - if (!curFileAccum) { - curFileAccum = { file: cur.file, locs: [] }; - accum.push(curFileAccum); - } - curFileAccum.locs.push({ start: cur.start, end: cur.end }); - return accum; - }, []); - return { info: renameInfo, locs: bakedRenameLocs }; + } }; Session.prototype.getReferences = function (line, offset, fileName) { var file = ts.normalizePath(fileName); - var project = this.projectService.getProjectForFile(file); - if (!project) { + var info = this.projectService.getScriptInfo(file); + var projects = this.projectService.findReferencingProjects(info); + if (!projects.length) { throw Errors.NoProject; } - var compilerService = project.compilerService; - var position = compilerService.host.lineOffsetToPosition(file, line, offset); - var references = compilerService.languageService.getReferencesAtPosition(file, position); - if (!references) { - return undefined; - } - var nameInfo = compilerService.languageService.getQuickInfoAtPosition(file, position); + var defaultProject = projects[0]; + var position = defaultProject.compilerService.host.lineOffsetToPosition(file, line, offset); + var nameInfo = defaultProject.compilerService.languageService.getQuickInfoAtPosition(file, position); if (!nameInfo) { return undefined; } var displayString = ts.displayPartsToString(nameInfo.displayParts); var nameSpan = nameInfo.textSpan; - var nameColStart = compilerService.host.positionToLineOffset(file, nameSpan.start).offset; - var nameText = compilerService.host.getScriptSnapshot(file).getText(nameSpan.start, ts.textSpanEnd(nameSpan)); - var bakedRefs = references.map(function (ref) { - var start = compilerService.host.positionToLineOffset(ref.fileName, ref.textSpan.start); - var refLineSpan = compilerService.host.lineToTextSpan(ref.fileName, start.line - 1); - var snap = compilerService.host.getScriptSnapshot(ref.fileName); - var lineText = snap.getText(refLineSpan.start, ts.textSpanEnd(refLineSpan)).replace(/\r|\n/g, ""); - return { - file: ref.fileName, - start: start, - lineText: lineText, - end: compilerService.host.positionToLineOffset(ref.fileName, ts.textSpanEnd(ref.textSpan)), - isWriteAccess: ref.isWriteAccess - }; - }).sort(compareFileStart); + var nameColStart = defaultProject.compilerService.host.positionToLineOffset(file, nameSpan.start).offset; + var nameText = defaultProject.compilerService.host.getScriptSnapshot(file).getText(nameSpan.start, ts.textSpanEnd(nameSpan)); + var refs = server.combineProjectOutput(projects, function (project) { + var compilerService = project.compilerService; + var references = compilerService.languageService.getReferencesAtPosition(file, position); + if (!references) { + return []; + } + return references.map(function (ref) { + var start = compilerService.host.positionToLineOffset(ref.fileName, ref.textSpan.start); + var refLineSpan = compilerService.host.lineToTextSpan(ref.fileName, start.line - 1); + var snap = compilerService.host.getScriptSnapshot(ref.fileName); + var lineText = snap.getText(refLineSpan.start, ts.textSpanEnd(refLineSpan)).replace(/\r|\n/g, ""); + return { + file: ref.fileName, + start: start, + lineText: lineText, + end: compilerService.host.positionToLineOffset(ref.fileName, ts.textSpanEnd(ref.textSpan)), + isWriteAccess: ref.isWriteAccess + }; + }); + }, compareFileStart, areReferencesResponseItemsForTheSameLocation); return { - refs: bakedRefs, + refs: refs, symbolName: nameText, symbolStartOffset: nameColStart, symbolDisplayString: displayString }; + function areReferencesResponseItemsForTheSameLocation(a, b) { + if (a && b) { + return a.file === b.file && + a.start === b.start && + a.end === b.end; + } + return false; + } }; - Session.prototype.openClientFile = function (fileName) { + Session.prototype.openClientFile = function (fileName, fileContent, scriptKind) { var file = ts.normalizePath(fileName); - this.projectService.openClientFile(file); + var _a = this.projectService.openClientFile(file, fileContent, scriptKind), configFileName = _a.configFileName, configFileErrors = _a.configFileErrors; + if (configFileErrors) { + this.configFileDiagnosticEvent(fileName, configFileName, configFileErrors); + } }; Session.prototype.getQuickInfo = function (line, offset, fileName) { var file = ts.normalizePath(fileName); @@ -43209,13 +48553,13 @@ var ts; var editorOptions = { IndentSize: formatOptions.IndentSize, TabSize: formatOptions.TabSize, - NewLineCharacter: "\n", + NewLineCharacter: formatOptions.NewLineCharacter, ConvertTabsToSpaces: formatOptions.ConvertTabsToSpaces, IndentStyle: ts.IndentStyle.Smart }; var preferredIndent = compilerService.languageService.getIndentationAtPosition(file, position, editorOptions); var hasIndent = 0; - var i, len; + var i = void 0, len = void 0; for (i = 0, len = lineText.length; i < len; i++) { if (lineText.charAt(i) == " ") { hasIndent++; @@ -43401,39 +48745,52 @@ var ts; }; Session.prototype.getNavigateToItems = function (searchValue, fileName, maxResultCount) { var file = ts.normalizePath(fileName); - var project = this.projectService.getProjectForFile(file); - if (!project) { + var info = this.projectService.getScriptInfo(file); + var projects = this.projectService.findReferencingProjects(info); + var defaultProject = projects[0]; + if (!defaultProject) { throw Errors.NoProject; } - var compilerService = project.compilerService; - var navItems = compilerService.languageService.getNavigateToItems(searchValue, maxResultCount); - if (!navItems) { - return undefined; + var allNavToItems = server.combineProjectOutput(projects, function (project) { + var compilerService = project.compilerService; + var navItems = compilerService.languageService.getNavigateToItems(searchValue, maxResultCount); + if (!navItems) { + return []; + } + return navItems.map(function (navItem) { + var start = compilerService.host.positionToLineOffset(navItem.fileName, navItem.textSpan.start); + var end = compilerService.host.positionToLineOffset(navItem.fileName, ts.textSpanEnd(navItem.textSpan)); + var bakedItem = { + name: navItem.name, + kind: navItem.kind, + file: navItem.fileName, + start: start, + end: end + }; + if (navItem.kindModifiers && (navItem.kindModifiers !== "")) { + bakedItem.kindModifiers = navItem.kindModifiers; + } + if (navItem.matchKind !== "none") { + bakedItem.matchKind = navItem.matchKind; + } + if (navItem.containerName && (navItem.containerName.length > 0)) { + bakedItem.containerName = navItem.containerName; + } + if (navItem.containerKind && (navItem.containerKind.length > 0)) { + bakedItem.containerKind = navItem.containerKind; + } + return bakedItem; + }); + }, undefined, areNavToItemsForTheSameLocation); + return allNavToItems; + function areNavToItemsForTheSameLocation(a, b) { + if (a && b) { + return a.file === b.file && + a.start === b.start && + a.end === b.end; + } + return false; } - return navItems.map(function (navItem) { - var start = compilerService.host.positionToLineOffset(navItem.fileName, navItem.textSpan.start); - var end = compilerService.host.positionToLineOffset(navItem.fileName, ts.textSpanEnd(navItem.textSpan)); - var bakedItem = { - name: navItem.name, - kind: navItem.kind, - file: navItem.fileName, - start: start, - end: end - }; - if (navItem.kindModifiers && (navItem.kindModifiers != "")) { - bakedItem.kindModifiers = navItem.kindModifiers; - } - if (navItem.matchKind !== "none") { - bakedItem.matchKind = navItem.matchKind; - } - if (navItem.containerName && (navItem.containerName.length > 0)) { - bakedItem.containerName = navItem.containerName; - } - if (navItem.containerKind && (navItem.containerKind.length > 0)) { - bakedItem.containerKind = navItem.containerKind; - } - return bakedItem; - }); }; Session.prototype.getBraceMatching = function (line, offset, fileName) { var file = ts.normalizePath(fileName); @@ -43454,7 +48811,7 @@ var ts; }; Session.prototype.getDiagnosticsForProject = function (delay, fileName) { var _this = this; - var _a = this.getProjectInfo(fileName, true), configFileName = _a.configFileName, fileNames = _a.fileNames; + var fileNames = this.getProjectInfo(fileName, true).fileNames; var fileNamesInProject = fileNames.filter(function (value, index, array) { return value.indexOf("lib.d.ts") < 0; }); var highPriorityFiles = []; var mediumPriorityFiles = []; @@ -43546,7 +48903,7 @@ var ts; } }; return Session; - })(); + }()); server.Session = Session; })(server = ts.server || (ts.server = {})); })(ts || (ts = {})); @@ -43572,7 +48929,7 @@ var ts; this.content = content; this.isOpen = isOpen; this.children = []; - this.formatCodeOptions = ts.clone(CompilerService.defaultFormatCodeOptions); + this.formatCodeOptions = ts.clone(CompilerService.getDefaultFormatCodeOptions(this.host)); this.path = ts.toPath(fileName, host.getCurrentDirectory(), ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames)); this.svc = ScriptVersionCache.fromString(host, content); } @@ -43608,7 +48965,7 @@ var ts; return this.snap().getChangeRange(oldSnapshot); }; return ScriptInfo; - })(); + }()); server.ScriptInfo = ScriptInfo; var LSHost = (function () { function LSHost(host, project) { @@ -43618,47 +48975,55 @@ var ts; this.roots = []; this.getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames); this.resolvedModuleNames = ts.createFileMap(); + this.resolvedTypeReferenceDirectives = ts.createFileMap(); this.filenameToScript = ts.createFileMap(); this.moduleResolutionHost = { fileExists: function (fileName) { return _this.fileExists(fileName); }, - readFile: function (fileName) { return _this.host.readFile(fileName); } + readFile: function (fileName) { return _this.host.readFile(fileName); }, + directoryExists: function (directoryName) { return _this.host.directoryExists(directoryName); } }; } - LSHost.prototype.resolveModuleNames = function (moduleNames, containingFile) { + LSHost.prototype.resolveNamesWithLocalCache = function (names, containingFile, cache, loader, getResult) { var path = ts.toPath(containingFile, this.host.getCurrentDirectory(), this.getCanonicalFileName); - var currentResolutionsInFile = this.resolvedModuleNames.get(path); + var currentResolutionsInFile = cache.get(path); var newResolutions = {}; var resolvedModules = []; var compilerOptions = this.getCompilationSettings(); - for (var _i = 0, moduleNames_1 = moduleNames; _i < moduleNames_1.length; _i++) { - var moduleName = moduleNames_1[_i]; - var resolution = ts.lookUp(newResolutions, moduleName); + for (var _i = 0, names_2 = names; _i < names_2.length; _i++) { + var name_41 = names_2[_i]; + var resolution = ts.lookUp(newResolutions, name_41); if (!resolution) { - var existingResolution = currentResolutionsInFile && ts.lookUp(currentResolutionsInFile, moduleName); + var existingResolution = currentResolutionsInFile && ts.lookUp(currentResolutionsInFile, name_41); if (moduleResolutionIsValid(existingResolution)) { resolution = existingResolution; } else { - resolution = ts.resolveModuleName(moduleName, containingFile, compilerOptions, this.moduleResolutionHost); + resolution = loader(name_41, containingFile, compilerOptions, this.moduleResolutionHost); resolution.lastCheckTime = Date.now(); - newResolutions[moduleName] = resolution; + newResolutions[name_41] = resolution; } } ts.Debug.assert(resolution !== undefined); - resolvedModules.push(resolution.resolvedModule); + resolvedModules.push(getResult(resolution)); } - this.resolvedModuleNames.set(path, newResolutions); + cache.set(path, newResolutions); return resolvedModules; function moduleResolutionIsValid(resolution) { if (!resolution) { return false; } - if (resolution.resolvedModule) { + if (getResult(resolution)) { return true; } return resolution.failedLookupLocations.length === 0; } }; + LSHost.prototype.resolveTypeReferenceDirectives = function (typeDirectiveNames, containingFile) { + return this.resolveNamesWithLocalCache(typeDirectiveNames, containingFile, this.resolvedTypeReferenceDirectives, ts.resolveTypeReferenceDirective, function (m) { return m.resolvedTypeReferenceDirective; }); + }; + LSHost.prototype.resolveModuleNames = function (moduleNames, containingFile) { + return this.resolveNamesWithLocalCache(moduleNames, containingFile, this.resolvedModuleNames, ts.resolveModuleName, function (m) { return m.resolvedModule; }); + }; LSHost.prototype.getDefaultLibFileName = function () { var nodeModuleBinDir = ts.getDirectoryPath(ts.normalizePath(this.host.getExecutingFilePath())); return ts.combinePaths(nodeModuleBinDir, ts.getDefaultLibFileName(this.compilationSettings)); @@ -43672,6 +49037,7 @@ var ts; LSHost.prototype.setCompilationSettings = function (opt) { this.compilationSettings = opt; this.resolvedModuleNames.clear(); + this.resolvedTypeReferenceDirectives.clear(); }; LSHost.prototype.lineAffectsRefs = function (filename, line) { var info = this.getScriptInfo(filename); @@ -43687,6 +49053,16 @@ var ts; LSHost.prototype.getScriptFileNames = function () { return this.roots.map(function (root) { return root.fileName; }); }; + LSHost.prototype.getScriptKind = function (fileName) { + var info = this.getScriptInfo(fileName); + if (!info) { + return undefined; + } + if (!info.scriptKind) { + info.scriptKind = ts.getScriptKindFromFileName(fileName); + } + return info.scriptKind; + }; LSHost.prototype.getScriptVersion = function (filename) { return this.getScriptInfo(filename).svc.latestVersion().toString(); }; @@ -43700,6 +49076,7 @@ var ts; if (!info.isOpen) { this.filenameToScript.remove(info.path); this.resolvedModuleNames.remove(info.path); + this.resolvedTypeReferenceDirectives.remove(info.path); } }; LSHost.prototype.getScriptInfo = function (filename) { @@ -43724,6 +49101,7 @@ var ts; this.filenameToScript.remove(info.path); this.roots = copyListRemovingItem(info, this.roots); this.resolvedModuleNames.remove(info.path); + this.resolvedTypeReferenceDirectives.remove(info.path); } }; LSHost.prototype.saveTo = function (filename, tmpfilename) { @@ -43748,12 +49126,10 @@ var ts; throw new Error("No script with name '" + filename + "'"); }; LSHost.prototype.resolvePath = function (path) { - var start = new Date().getTime(); var result = this.host.resolvePath(path); return result; }; LSHost.prototype.fileExists = function (path) { - var start = new Date().getTime(); var result = this.host.fileExists(path); return result; }; @@ -43790,32 +49166,8 @@ var ts; return { line: lineOffset.line, offset: lineOffset.offset + 1 }; }; return LSHost; - })(); + }()); server.LSHost = LSHost; - function getAbsolutePath(filename, directory) { - var rootLength = ts.getRootLength(filename); - if (rootLength > 0) { - return filename; - } - else { - var splitFilename = filename.split("/"); - var splitDir = directory.split("/"); - var i = 0; - var dirTail = 0; - var sflen = splitFilename.length; - while ((i < sflen) && (splitFilename[i].charAt(0) == ".")) { - var dots = splitFilename[i]; - if (dots == "..") { - dirTail++; - } - else if (dots != ".") { - return undefined; - } - i++; - } - return splitDir.slice(0, splitDir.length - dirTail).concat(splitFilename.slice(i)).join("/"); - } - } var Project = (function () { function Project(projectService, projectOptions) { this.projectService = projectService; @@ -43902,7 +49254,7 @@ var ts; } }; return Project; - })(); + }()); server.Project = Project; function copyListRemovingItem(item, list) { var copiedList = []; @@ -43913,6 +49265,11 @@ var ts; } return copiedList; } + function combineProjectOutput(projects, action, comparer, areEqual) { + var result = projects.reduce(function (previous, current) { return ts.concatenate(previous, action(current)); }, []).sort(comparer); + return projects.length > 1 ? ts.deduplicate(result, areEqual) : result; + } + server.combineProjectOutput = combineProjectOutput; var ProjectService = (function () { function ProjectService(host, psLogger, eventHandler) { this.host = host; @@ -43926,12 +49283,12 @@ var ts; this.openFileRootsConfigured = []; this.directoryWatchersForTsconfig = {}; this.directoryWatchersRefCount = {}; - this.timerForDetectingProjectFilelistChanges = {}; + this.timerForDetectingProjectFileListChanges = {}; this.addDefaultHostConfiguration(); } ProjectService.prototype.addDefaultHostConfiguration = function () { this.hostConfiguration = { - formatCodeOptions: ts.clone(CompilerService.defaultFormatCodeOptions), + formatCodeOptions: ts.clone(CompilerService.getDefaultFormatCodeOptions(this.host)), hostInfo: "Unknown host" }; }; @@ -43959,22 +49316,22 @@ var ts; } }; ProjectService.prototype.directoryWatchedForSourceFilesChanged = function (project, fileName) { - if (fileName && !ts.isSupportedSourceFileName(fileName)) { + if (fileName && !ts.isSupportedSourceFileName(fileName, project.projectOptions ? project.projectOptions.compilerOptions : undefined)) { return; } this.log("Detected source file changes: " + fileName); - this.startTimerForDetectingProjectFilelistChanges(project); + this.startTimerForDetectingProjectFileListChanges(project); }; - ProjectService.prototype.startTimerForDetectingProjectFilelistChanges = function (project) { + ProjectService.prototype.startTimerForDetectingProjectFileListChanges = function (project) { var _this = this; - if (this.timerForDetectingProjectFilelistChanges[project.projectFilename]) { - clearTimeout(this.timerForDetectingProjectFilelistChanges[project.projectFilename]); + if (this.timerForDetectingProjectFileListChanges[project.projectFilename]) { + this.host.clearTimeout(this.timerForDetectingProjectFileListChanges[project.projectFilename]); } - this.timerForDetectingProjectFilelistChanges[project.projectFilename] = setTimeout(function () { return _this.handleProjectFilelistChanges(project); }, 250); + this.timerForDetectingProjectFileListChanges[project.projectFilename] = this.host.setTimeout(function () { return _this.handleProjectFileListChanges(project); }, 250); }; - ProjectService.prototype.handleProjectFilelistChanges = function (project) { + ProjectService.prototype.handleProjectFileListChanges = function (project) { var _this = this; - var _a = this.configFileToProjectOptions(project.projectFilename), succeeded = _a.succeeded, projectOptions = _a.projectOptions, error = _a.error; + var projectOptions = this.configFileToProjectOptions(project.projectFilename).projectOptions; var newRootFiles = projectOptions.files.map((function (f) { return _this.getCanonicalFileName(f); })); var currentRootFiles = project.getRootFiles().map((function (f) { return _this.getCanonicalFileName(f); })); if (!ts.arrayIsEqualTo(currentRootFiles && currentRootFiles.sort(), newRootFiles && newRootFiles.sort())) { @@ -43989,7 +49346,7 @@ var ts; return; } this.log("Detected newly added tsconfig file: " + fileName); - var _a = this.configFileToProjectOptions(fileName), succeeded = _a.succeeded, projectOptions = _a.projectOptions, error = _a.error; + var projectOptions = this.configFileToProjectOptions(fileName).projectOptions; var rootFilesInTsconfig = projectOptions.files.map(function (f) { return _this.getCanonicalFileName(f); }); var openFileRoots = this.openFileRoots.map(function (s) { return _this.getCanonicalFileName(s.fileName); }); for (var _i = 0, openFileRoots_1 = openFileRoots; _i < openFileRoots_1.length; _i++) { @@ -44108,7 +49465,8 @@ var ts; else { for (var _i = 0, _a = project.directoriesWatchedForTsconfig; _i < _a.length; _i++) { var directory = _a[_i]; - if (!(--project.projectService.directoryWatchersRefCount[directory])) { + project.projectService.directoryWatchersRefCount[directory]--; + if (!project.projectService.directoryWatchersRefCount[directory]) { this.log("Close directory watcher for: " + directory); project.projectService.directoryWatchersForTsconfig[directory].close(); delete project.projectService.directoryWatchersForTsconfig[directory]; @@ -44117,8 +49475,8 @@ var ts; this.inferredProjects = copyListRemovingItem(project, this.inferredProjects); } var fileNames = project.getFileNames(); - for (var _b = 0, fileNames_1 = fileNames; _b < fileNames_1.length; _b++) { - var fileName = fileNames_1[_b]; + for (var _b = 0, fileNames_2 = fileNames; _b < fileNames_2.length; _b++) { + var fileName = fileNames_2[_b]; var info = this.getScriptInfo(fileName); if (info.defaultProject == project) { info.defaultProject = undefined; @@ -44234,6 +49592,7 @@ var ts; configuredProject.updateGraph(); if (configuredProject.getSourceFile(info)) { info.defaultProject = configuredProject; + referencingProjects.push(configuredProject); } } return referencingProjects; @@ -44308,14 +49667,14 @@ var ts; filename = ts.normalizePath(filename); return ts.lookUp(this.filenameToScriptInfo, filename); }; - ProjectService.prototype.openFile = function (fileName, openedByClient) { + ProjectService.prototype.openFile = function (fileName, openedByClient, fileContent, scriptKind) { var _this = this; fileName = ts.normalizePath(fileName); var info = ts.lookUp(this.filenameToScriptInfo, fileName); if (!info) { - var content; + var content = void 0; if (this.host.fileExists(fileName)) { - content = this.host.readFile(fileName); + content = fileContent || this.host.readFile(fileName); } if (!content) { if (openedByClient) { @@ -44324,6 +49683,7 @@ var ts; } if (content !== undefined) { info = new ScriptInfo(this.host, fileName, content, openedByClient); + info.scriptKind = scriptKind; info.setFormatOptions(this.getFormatCodeOptions()); this.filenameToScriptInfo[fileName] = info; if (!info.isOpen) { @@ -44332,6 +49692,9 @@ var ts; } } if (info) { + if (fileContent) { + info.svc.reload(fileContent); + } if (openedByClient) { info.isOpen = true; } @@ -44340,9 +49703,13 @@ var ts; }; ProjectService.prototype.findConfigFile = function (searchPath) { while (true) { - var fileName = ts.combinePaths(searchPath, "tsconfig.json"); - if (this.host.fileExists(fileName)) { - return fileName; + var tsconfigFileName = ts.combinePaths(searchPath, "tsconfig.json"); + if (this.host.fileExists(tsconfigFileName)) { + return tsconfigFileName; + } + var jsconfigFileName = ts.combinePaths(searchPath, "jsconfig.json"); + if (this.host.fileExists(jsconfigFileName)) { + return jsconfigFileName; } var parentPath = ts.getDirectoryPath(searchPath); if (parentPath === searchPath) { @@ -44352,12 +49719,12 @@ var ts; } return undefined; }; - ProjectService.prototype.openClientFile = function (fileName) { - this.openOrUpdateConfiguredProjectForFile(fileName); - var info = this.openFile(fileName, true); + ProjectService.prototype.openClientFile = function (fileName, fileContent, scriptKind) { + var _a = this.openOrUpdateConfiguredProjectForFile(fileName), configFileName = _a.configFileName, configFileErrors = _a.configFileErrors; + var info = this.openFile(fileName, true, fileContent, scriptKind); this.addOpenFile(info); this.printProjects(); - return info; + return { configFileName: configFileName, configFileErrors: configFileErrors }; }; ProjectService.prototype.openOrUpdateConfiguredProjectForFile = function (fileName) { var searchPath = ts.normalizePath(ts.getDirectoryPath(fileName)); @@ -44369,11 +49736,14 @@ var ts; if (!project) { var configResult = this.openConfigFile(configFileName, fileName); if (!configResult.success) { - this.log("Error opening config file " + configFileName + " " + configResult.errorMsg); + return { configFileName: configFileName, configFileErrors: configResult.errors }; } else { this.log("Opened configuration file " + configFileName, "Info"); this.configuredProjects.push(configResult.project); + if (configResult.errors && configResult.errors.length > 0) { + return { configFileName: configFileName, configFileErrors: configResult.errors }; + } } } else { @@ -44383,6 +49753,7 @@ var ts; else { this.log("No config files found."); } + return {}; }; ProjectService.prototype.closeClientFile = function (filename) { var info = ts.lookUp(this.filenameToScriptInfo, filename); @@ -44467,16 +49838,17 @@ var ts; var contents = this.host.readFile(configFilename); var rawConfig = ts.parseConfigFileTextToJson(configFilename, contents); if (rawConfig.error) { - return { succeeded: false, error: rawConfig.error }; + return { succeeded: false, errors: [rawConfig.error] }; } else { - var parsedCommandLine = ts.parseJsonConfigFileContent(rawConfig.config, this.host, dirPath); + var parsedCommandLine = ts.parseJsonConfigFileContent(rawConfig.config, this.host, dirPath, {}, configFilename); ts.Debug.assert(!!parsedCommandLine.fileNames); if (parsedCommandLine.errors && (parsedCommandLine.errors.length > 0)) { - return { succeeded: false, error: { errorMsg: "tsconfig option errors" } }; + return { succeeded: false, errors: parsedCommandLine.errors }; } else if (parsedCommandLine.fileNames.length === 0) { - return { succeeded: false, error: { errorMsg: "no files found" } }; + var error = ts.createCompilerDiagnostic(ts.Diagnostics.The_config_file_0_found_doesn_t_contain_any_source_files, configFilename); + return { succeeded: false, errors: [error] }; } else { var projectOptions = { @@ -44489,44 +49861,46 @@ var ts; }; ProjectService.prototype.openConfigFile = function (configFilename, clientFileName) { var _this = this; - var _a = this.configFileToProjectOptions(configFilename), succeeded = _a.succeeded, projectOptions = _a.projectOptions, error = _a.error; + var _a = this.configFileToProjectOptions(configFilename), succeeded = _a.succeeded, projectOptions = _a.projectOptions, errors = _a.errors; if (!succeeded) { - return error; + return { success: false, errors: errors }; } else { - var project = this.createProject(configFilename, projectOptions); + var project_1 = this.createProject(configFilename, projectOptions); + var errors_1; for (var _i = 0, _b = projectOptions.files; _i < _b.length; _i++) { var rootFilename = _b[_i]; if (this.host.fileExists(rootFilename)) { var info = this.openFile(rootFilename, clientFileName == rootFilename); - project.addRoot(info); + project_1.addRoot(info); } else { - return { errorMsg: "specified file " + rootFilename + " not found" }; + (errors_1 || (errors_1 = [])).push(ts.createCompilerDiagnostic(ts.Diagnostics.File_0_not_found, rootFilename)); } } - project.finishGraph(); - project.projectFileWatcher = this.host.watchFile(configFilename, function (_) { return _this.watchedProjectConfigFileChanged(project); }); + project_1.finishGraph(); + project_1.projectFileWatcher = this.host.watchFile(configFilename, function (_) { return _this.watchedProjectConfigFileChanged(project_1); }); this.log("Add recursive watcher for: " + ts.getDirectoryPath(configFilename)); - project.directoryWatcher = this.host.watchDirectory(ts.getDirectoryPath(configFilename), function (path) { return _this.directoryWatchedForSourceFilesChanged(project, path); }, true); - return { success: true, project: project }; + project_1.directoryWatcher = this.host.watchDirectory(ts.getDirectoryPath(configFilename), function (path) { return _this.directoryWatchedForSourceFilesChanged(project_1, path); }, true); + return { success: true, project: project_1, errors: errors_1 }; } }; ProjectService.prototype.updateConfiguredProject = function (project) { + var _this = this; if (!this.host.fileExists(project.projectFilename)) { this.log("Config file deleted"); this.removeProject(project); } else { - var _a = this.configFileToProjectOptions(project.projectFilename), succeeded = _a.succeeded, projectOptions = _a.projectOptions, error = _a.error; + var _a = this.configFileToProjectOptions(project.projectFilename), succeeded = _a.succeeded, projectOptions = _a.projectOptions, errors = _a.errors; if (!succeeded) { - return error; + return errors; } else { - var oldFileNames = project.compilerService.host.roots.map(function (info) { return info.fileName; }); - var newFileNames = projectOptions.files; - var fileNamesToRemove = oldFileNames.filter(function (f) { return newFileNames.indexOf(f) < 0; }); - var fileNamesToAdd = newFileNames.filter(function (f) { return oldFileNames.indexOf(f) < 0; }); + var oldFileNames_1 = project.compilerService.host.roots.map(function (info) { return info.fileName; }); + var newFileNames_1 = ts.filter(projectOptions.files, function (f) { return _this.host.fileExists(f); }); + var fileNamesToRemove = oldFileNames_1.filter(function (f) { return newFileNames_1.indexOf(f) < 0; }); + var fileNamesToAdd = newFileNames_1.filter(function (f) { return oldFileNames_1.indexOf(f) < 0; }); for (var _i = 0, fileNamesToRemove_1 = fileNamesToRemove; _i < fileNamesToRemove_1.length; _i++) { var fileName = fileNamesToRemove_1[_i]; var info = this.getScriptInfo(fileName); @@ -44568,7 +49942,7 @@ var ts; return project; }; return ProjectService; - })(); + }()); server.ProjectService = ProjectService; var CompilerService = (function () { function CompilerService(project, opt) { @@ -44581,6 +49955,7 @@ var ts; else { var defaultOpts = ts.getDefaultCompilerOptions(); defaultOpts.allowNonTsExtensions = true; + defaultOpts.allowJs = true; this.setCompilerOptions(defaultOpts); } this.languageService = ts.createLanguageService(this.host, this.documentRegistry); @@ -44591,27 +49966,30 @@ var ts; this.host.setCompilationSettings(opt); }; CompilerService.prototype.isExternalModule = function (filename) { - var sourceFile = this.languageService.getSourceFile(filename); + var sourceFile = this.languageService.getNonBoundSourceFile(filename); return ts.isExternalModule(sourceFile); }; - CompilerService.defaultFormatCodeOptions = { - IndentSize: 4, - TabSize: 4, - NewLineCharacter: ts.sys ? ts.sys.newLine : "\n", - ConvertTabsToSpaces: true, - IndentStyle: ts.IndentStyle.Smart, - InsertSpaceAfterCommaDelimiter: true, - InsertSpaceAfterSemicolonInForStatements: true, - InsertSpaceBeforeAndAfterBinaryOperators: true, - InsertSpaceAfterKeywordsInControlFlowStatements: true, - InsertSpaceAfterFunctionKeywordForAnonymousFunctions: false, - InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: false, - InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: false, - PlaceOpenBraceOnNewLineForFunctions: false, - PlaceOpenBraceOnNewLineForControlBlocks: false + CompilerService.getDefaultFormatCodeOptions = function (host) { + return ts.clone({ + IndentSize: 4, + TabSize: 4, + NewLineCharacter: host.newLine || "\n", + ConvertTabsToSpaces: true, + IndentStyle: ts.IndentStyle.Smart, + InsertSpaceAfterCommaDelimiter: true, + InsertSpaceAfterSemicolonInForStatements: true, + InsertSpaceBeforeAndAfterBinaryOperators: true, + InsertSpaceAfterKeywordsInControlFlowStatements: true, + InsertSpaceAfterFunctionKeywordForAnonymousFunctions: false, + InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: false, + InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: false, + InsertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: false, + PlaceOpenBraceOnNewLineForFunctions: false, + PlaceOpenBraceOnNewLineForControlBlocks: false + }); }; return CompilerService; - })(); + }()); server.CompilerService = CompilerService; (function (CharRangeSection) { CharRangeSection[CharRangeSection["PreStart"] = 0] = "PreStart"; @@ -44630,7 +50008,7 @@ var ts; BaseLineIndexWalker.prototype.leaf = function (rangeStart, rangeLength, ll) { }; return BaseLineIndexWalker; - })(); + }()); var EditWalker = (function (_super) { __extends(EditWalker, _super); function EditWalker() { @@ -44814,7 +50192,7 @@ var ts; } }; return EditWalker; - })(BaseLineIndexWalker); + }(BaseLineIndexWalker)); var TextChange = (function () { function TextChange(pos, deleteLen, insertedText) { this.pos = pos; @@ -44825,7 +50203,7 @@ var ts; return ts.createTextChangeRange(ts.createTextSpan(this.pos, this.deleteLen), this.insertedText ? this.insertedText.length : 0); }; return TextChange; - })(); + }()); server.TextChange = TextChange; var ScriptVersionCache = (function () { function ScriptVersionCache() { @@ -44853,6 +50231,9 @@ var ts; }; ScriptVersionCache.prototype.reloadFromFile = function (filename, cb) { var content = this.host.readFile(filename); + if (!content) { + content = ""; + } this.reload(content); if (cb) cb(); @@ -44929,7 +50310,7 @@ var ts; ScriptVersionCache.changeLengthThreshold = 256; ScriptVersionCache.maxVersions = 8; return ScriptVersionCache; - })(); + }()); server.ScriptVersionCache = ScriptVersionCache; var LineIndexSnapshot = (function () { function LineIndexSnapshot(version, cache) { @@ -44948,7 +50329,8 @@ var ts; var count = 1; var pos = 0; this.index.every(function (ll, s, len) { - starts[count++] = pos; + starts[count] = pos; + count++; pos += ll.text.length; return true; }, 0); @@ -44956,9 +50338,9 @@ var ts; }; LineIndexSnapshot.prototype.getLineMapper = function () { var _this = this; - return (function (line) { + return function (line) { return _this.index.lineNumberToInfo(line).offset; - }); + }; }; LineIndexSnapshot.prototype.getTextChangeRangeSinceVersion = function (scriptVersion) { if (this.version <= scriptVersion) { @@ -44973,7 +50355,7 @@ var ts; return this.getTextChangeRangeSinceVersion(oldSnap.version); }; return LineIndexSnapshot; - })(); + }()); server.LineIndexSnapshot = LineIndexSnapshot; var LineIndex = (function () { function LineIndex() { @@ -45055,7 +50437,7 @@ var ts; } } else { - var checkText; + var checkText = void 0; if (this.checkEdits) { checkText = editFlat(this.getText(0, this.root.charCount()), pos, deleteLength, newText); } @@ -45145,7 +50527,7 @@ var ts; return { lines: lines, lineMap: lineStarts }; }; return LineIndex; - })(); + }()); server.LineIndex = LineIndex; var LineNode = (function () { function LineNode() { @@ -45194,7 +50576,8 @@ var ts; while (adjustedStart >= childCharCount) { this.skipChild(adjustedStart, rangeLength, childIndex, walkFns, CharRangeSection.PreStart); adjustedStart -= childCharCount; - child = this.children[++childIndex]; + childIndex++; + child = this.children[childIndex]; childCharCount = child.charCount(); } if ((adjustedStart + rangeLength) <= childCharCount) { @@ -45207,14 +50590,16 @@ var ts; return; } var adjustedLength = rangeLength - (childCharCount - adjustedStart); - child = this.children[++childIndex]; + childIndex++; + child = this.children[childIndex]; childCharCount = child.charCount(); while (adjustedLength > childCharCount) { if (this.execWalk(0, childCharCount, walkFns, childIndex, CharRangeSection.Mid)) { return; } adjustedLength -= childCharCount; - child = this.children[++childIndex]; + childIndex++; + child = this.children[childIndex]; childCharCount = child.charCount(); } if (adjustedLength > 0) { @@ -45332,7 +50717,8 @@ var ts; if (childIndex < clen) { splitNode = new LineNode(); while (childIndex < clen) { - splitNode.add(this.children[childIndex++]); + splitNode.add(this.children[childIndex]); + childIndex++; } splitNode.updateCounts(); } @@ -45370,7 +50756,9 @@ var ts; var nodeIndex = 0; childIndex++; while ((childIndex < lineCollectionCapacity) && (nodeIndex < nodeCount)) { - this.children[childIndex++] = nodes[nodeIndex++]; + this.children[childIndex] = nodes[nodeIndex]; + childIndex++; + nodeIndex++; } var splitNodes = []; var splitNodeCount = 0; @@ -45383,7 +50771,8 @@ var ts; } var splitNode = splitNodes[0]; while (nodeIndex < nodeCount) { - splitNode.add(nodes[nodeIndex++]); + splitNode.add(nodes[nodeIndex]); + nodeIndex++; if (splitNode.children.length === lineCollectionCapacity) { splitNodeIndex++; splitNode = splitNodes[splitNodeIndex]; @@ -45416,7 +50805,7 @@ var ts; return this.totalLines; }; return LineNode; - })(); + }()); server.LineNode = LineNode; var LineLeaf = (function () { function LineLeaf(text) { @@ -45441,7 +50830,7 @@ var ts; return 1; }; return LineLeaf; - })(); + }()); server.LineLeaf = LineLeaf; })(server = ts.server || (ts.server = {})); })(ts || (ts = {})); @@ -45449,9 +50838,7 @@ var ts; (function (ts) { var server; (function (server) { - var nodeproto = require("_debugger"); var readline = require("readline"); - var path = require("path"); var fs = require("fs"); var rl = readline.createInterface({ input: process.stdin, @@ -45519,7 +50906,7 @@ var ts; } }; return Logger; - })(); + }()); var IOSession = (function (_super) { __extends(IOSession, _super); function IOSession(host, logger) { @@ -45541,7 +50928,7 @@ var ts; }); }; return IOSession; - })(server.Session); + }(server.Session)); function parseLoggingEnvironmentString(logEnvStr) { var logEnv = {}; var args = logEnvStr.split(" "); @@ -45579,6 +50966,73 @@ var ts; } return new Logger(fileName, detailLevel); } + function createPollingWatchedFileSet(interval, chunkSize) { + if (interval === void 0) { interval = 2500; } + if (chunkSize === void 0) { chunkSize = 30; } + var watchedFiles = []; + var nextFileToCheck = 0; + var watchTimer; + function getModifiedTime(fileName) { + return fs.statSync(fileName).mtime; + } + function poll(checkedIndex) { + var watchedFile = watchedFiles[checkedIndex]; + if (!watchedFile) { + return; + } + fs.stat(watchedFile.fileName, function (err, stats) { + if (err) { + watchedFile.callback(watchedFile.fileName); + } + else if (watchedFile.mtime.getTime() !== stats.mtime.getTime()) { + watchedFile.mtime = getModifiedTime(watchedFile.fileName); + watchedFile.callback(watchedFile.fileName, watchedFile.mtime.getTime() === 0); + } + }); + } + function startWatchTimer() { + watchTimer = setInterval(function () { + var count = 0; + var nextToCheck = nextFileToCheck; + var firstCheck = -1; + while ((count < chunkSize) && (nextToCheck !== firstCheck)) { + poll(nextToCheck); + if (firstCheck < 0) { + firstCheck = nextToCheck; + } + nextToCheck++; + if (nextToCheck === watchedFiles.length) { + nextToCheck = 0; + } + count++; + } + nextFileToCheck = nextToCheck; + }, interval); + } + function addFile(fileName, callback) { + var file = { + fileName: fileName, + callback: callback, + mtime: getModifiedTime(fileName) + }; + watchedFiles.push(file); + if (watchedFiles.length === 1) { + startWatchTimer(); + } + return file; + } + function removeFile(file) { + watchedFiles = ts.copyListRemovingItem(file, watchedFiles); + } + return { + getModifiedTime: getModifiedTime, + poll: poll, + startWatchTimer: startWatchTimer, + addFile: addFile, + removeFile: removeFile + }; + } + var pollingWatchedFileSet = createPollingWatchedFileSet(); var logger = createLoggerFromEnv(); var pending = []; var canWrite = true; @@ -45597,8 +51051,17 @@ var ts; writeMessage(pending.shift()); } } - ts.sys.write = function (s) { return writeMessage(s); }; - var ioSession = new IOSession(ts.sys, logger); + var sys = ts.sys; + sys.write = function (s) { return writeMessage(s); }; + sys.watchFile = function (fileName, callback) { + var watchedFile = pollingWatchedFileSet.addFile(fileName, callback); + return { + close: function () { return pollingWatchedFileSet.removeFile(watchedFile); } + }; + }; + sys.setTimeout = setTimeout; + sys.clearTimeout = clearTimeout; + var ioSession = new IOSession(sys, logger); process.on("uncaughtException", function (err) { ioSession.logError(err, "unknown"); }); @@ -45616,7 +51079,6 @@ var ts; var ScriptSnapshotShimAdapter = (function () { function ScriptSnapshotShimAdapter(scriptSnapshotShim) { this.scriptSnapshotShim = scriptSnapshotShim; - this.lineStartPositions = null; } ScriptSnapshotShimAdapter.prototype.getText = function (start, end) { return this.scriptSnapshotShim.getText(start, end); @@ -45639,7 +51101,7 @@ var ts; } }; return ScriptSnapshotShimAdapter; - })(); + }()); var LanguageServiceShimHostAdapter = (function () { function LanguageServiceShimHostAdapter(shimHost) { var _this = this; @@ -45655,6 +51117,15 @@ var ts; }); }; } + if ("directoryExists" in this.shimHost) { + this.directoryExists = function (directoryName) { return _this.shimHost.directoryExists(directoryName); }; + } + if ("getTypeReferenceDirectiveResolutionsForFile" in this.shimHost) { + this.resolveTypeReferenceDirectives = function (typeDirectiveNames, containingFile) { + var typeDirectivesForFile = JSON.parse(_this.shimHost.getTypeReferenceDirectiveResolutionsForFile(containingFile)); + return ts.map(typeDirectiveNames, function (name) { return ts.lookUp(typeDirectivesForFile, name); }); + }; + } } LanguageServiceShimHostAdapter.prototype.log = function (s) { if (this.loggingEnabled) { @@ -45690,12 +51161,17 @@ var ts; return this.files = JSON.parse(encoded); }; LanguageServiceShimHostAdapter.prototype.getScriptSnapshot = function (fileName) { - if (this.files && this.files.indexOf(fileName) < 0) { - return undefined; - } var scriptSnapshot = this.shimHost.getScriptSnapshot(fileName); return scriptSnapshot && new ScriptSnapshotShimAdapter(scriptSnapshot); }; + LanguageServiceShimHostAdapter.prototype.getScriptKind = function (fileName) { + if ("getScriptKind" in this.shimHost) { + return this.shimHost.getScriptKind(fileName); + } + else { + return 0; + } + }; LanguageServiceShimHostAdapter.prototype.getScriptVersion = function (fileName) { return this.shimHost.getScriptVersion(fileName); }; @@ -45720,15 +51196,10 @@ var ts; return this.shimHost.getCurrentDirectory(); }; LanguageServiceShimHostAdapter.prototype.getDefaultLibFileName = function (options) { - try { - return this.shimHost.getDefaultLibFileName(JSON.stringify(options)); - } - catch (e) { - return ""; - } + return this.shimHost.getDefaultLibFileName(JSON.stringify(options)); }; return LanguageServiceShimHostAdapter; - })(); + }()); ts.LanguageServiceShimHostAdapter = LanguageServiceShimHostAdapter; var ThrottledCancellationToken = (function () { function ThrottledCancellationToken(hostCancellationToken) { @@ -45745,18 +51216,25 @@ var ts; return false; }; return ThrottledCancellationToken; - })(); + }()); var CoreServicesShimHostAdapter = (function () { function CoreServicesShimHostAdapter(shimHost) { + var _this = this; this.shimHost = shimHost; + if ("directoryExists" in this.shimHost) { + this.directoryExists = function (directoryName) { return _this.shimHost.directoryExists(directoryName); }; + } + if ("realpath" in this.shimHost) { + this.realpath = function (path) { return _this.shimHost.realpath(path); }; + } } - CoreServicesShimHostAdapter.prototype.readDirectory = function (rootDir, extension, exclude) { + CoreServicesShimHostAdapter.prototype.readDirectory = function (rootDir, extension, exclude, depth) { var encoded; try { - encoded = this.shimHost.readDirectory(rootDir, extension, JSON.stringify(exclude)); + encoded = this.shimHost.readDirectory(rootDir, extension, JSON.stringify(exclude), depth); } catch (e) { - encoded = this.shimHost.readDirectory(rootDir, extension); + encoded = this.shimHost.readDirectory(rootDir, extension, JSON.stringify(exclude)); } return JSON.parse(encoded); }; @@ -45767,18 +51245,19 @@ var ts; return this.shimHost.readFile(fileName); }; return CoreServicesShimHostAdapter; - })(); + }()); ts.CoreServicesShimHostAdapter = CoreServicesShimHostAdapter; function simpleForwardCall(logger, actionDescription, action, logPerformance) { + var start; if (logPerformance) { logger.log(actionDescription); - var start = Date.now(); + start = Date.now(); } var result = action(); if (logPerformance) { var end = Date.now(); logger.log(actionDescription + " completed in " + (end - start) + " msec"); - if (typeof (result) === "string") { + if (typeof result === "string") { var str = result; if (str.length > 128) { str = str.substring(0, 128) + "..."; @@ -45811,7 +51290,7 @@ var ts; this.factory.unregisterShim(this); }; return ShimBase; - })(); + }()); function realizeDiagnostics(diagnostics, newLine) { return diagnostics.map(function (d) { return realizeDiagnostic(d, newLine); }); } @@ -45849,9 +51328,7 @@ var ts; _super.prototype.dispose.call(this, dummy); }; LanguageServiceShimObject.prototype.refresh = function (throwOnError) { - this.forwardJSONCall("refresh(" + throwOnError + ")", function () { - return null; - }); + this.forwardJSONCall("refresh(" + throwOnError + ")", function () { return null; }); }; LanguageServiceShimObject.prototype.cleanupSemanticCache = function () { var _this = this; @@ -45866,29 +51343,19 @@ var ts; }; LanguageServiceShimObject.prototype.getSyntacticClassifications = function (fileName, start, length) { var _this = this; - return this.forwardJSONCall("getSyntacticClassifications('" + fileName + "', " + start + ", " + length + ")", function () { - var classifications = _this.languageService.getSyntacticClassifications(fileName, ts.createTextSpan(start, length)); - return classifications; - }); + return this.forwardJSONCall("getSyntacticClassifications('" + fileName + "', " + start + ", " + length + ")", function () { return _this.languageService.getSyntacticClassifications(fileName, ts.createTextSpan(start, length)); }); }; LanguageServiceShimObject.prototype.getSemanticClassifications = function (fileName, start, length) { var _this = this; - return this.forwardJSONCall("getSemanticClassifications('" + fileName + "', " + start + ", " + length + ")", function () { - var classifications = _this.languageService.getSemanticClassifications(fileName, ts.createTextSpan(start, length)); - return classifications; - }); + return this.forwardJSONCall("getSemanticClassifications('" + fileName + "', " + start + ", " + length + ")", function () { return _this.languageService.getSemanticClassifications(fileName, ts.createTextSpan(start, length)); }); }; LanguageServiceShimObject.prototype.getEncodedSyntacticClassifications = function (fileName, start, length) { var _this = this; - return this.forwardJSONCall("getEncodedSyntacticClassifications('" + fileName + "', " + start + ", " + length + ")", function () { - return convertClassifications(_this.languageService.getEncodedSyntacticClassifications(fileName, ts.createTextSpan(start, length))); - }); + return this.forwardJSONCall("getEncodedSyntacticClassifications('" + fileName + "', " + start + ", " + length + ")", function () { return convertClassifications(_this.languageService.getEncodedSyntacticClassifications(fileName, ts.createTextSpan(start, length))); }); }; LanguageServiceShimObject.prototype.getEncodedSemanticClassifications = function (fileName, start, length) { var _this = this; - return this.forwardJSONCall("getEncodedSemanticClassifications('" + fileName + "', " + start + ", " + length + ")", function () { - return convertClassifications(_this.languageService.getEncodedSemanticClassifications(fileName, ts.createTextSpan(start, length))); - }); + return this.forwardJSONCall("getEncodedSemanticClassifications('" + fileName + "', " + start + ", " + length + ")", function () { return convertClassifications(_this.languageService.getEncodedSemanticClassifications(fileName, ts.createTextSpan(start, length))); }); }; LanguageServiceShimObject.prototype.getSyntacticDiagnostics = function (fileName) { var _this = this; @@ -45913,62 +51380,43 @@ var ts; }; LanguageServiceShimObject.prototype.getQuickInfoAtPosition = function (fileName, position) { var _this = this; - return this.forwardJSONCall("getQuickInfoAtPosition('" + fileName + "', " + position + ")", function () { - var quickInfo = _this.languageService.getQuickInfoAtPosition(fileName, position); - return quickInfo; - }); + return this.forwardJSONCall("getQuickInfoAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getQuickInfoAtPosition(fileName, position); }); }; LanguageServiceShimObject.prototype.getNameOrDottedNameSpan = function (fileName, startPos, endPos) { var _this = this; - return this.forwardJSONCall("getNameOrDottedNameSpan('" + fileName + "', " + startPos + ", " + endPos + ")", function () { - var spanInfo = _this.languageService.getNameOrDottedNameSpan(fileName, startPos, endPos); - return spanInfo; - }); + return this.forwardJSONCall("getNameOrDottedNameSpan('" + fileName + "', " + startPos + ", " + endPos + ")", function () { return _this.languageService.getNameOrDottedNameSpan(fileName, startPos, endPos); }); }; LanguageServiceShimObject.prototype.getBreakpointStatementAtPosition = function (fileName, position) { var _this = this; - return this.forwardJSONCall("getBreakpointStatementAtPosition('" + fileName + "', " + position + ")", function () { - var spanInfo = _this.languageService.getBreakpointStatementAtPosition(fileName, position); - return spanInfo; - }); + return this.forwardJSONCall("getBreakpointStatementAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getBreakpointStatementAtPosition(fileName, position); }); }; LanguageServiceShimObject.prototype.getSignatureHelpItems = function (fileName, position) { var _this = this; - return this.forwardJSONCall("getSignatureHelpItems('" + fileName + "', " + position + ")", function () { - var signatureInfo = _this.languageService.getSignatureHelpItems(fileName, position); - return signatureInfo; - }); + return this.forwardJSONCall("getSignatureHelpItems('" + fileName + "', " + position + ")", function () { return _this.languageService.getSignatureHelpItems(fileName, position); }); }; LanguageServiceShimObject.prototype.getDefinitionAtPosition = function (fileName, position) { var _this = this; - return this.forwardJSONCall("getDefinitionAtPosition('" + fileName + "', " + position + ")", function () { - return _this.languageService.getDefinitionAtPosition(fileName, position); - }); + return this.forwardJSONCall("getDefinitionAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getDefinitionAtPosition(fileName, position); }); }; LanguageServiceShimObject.prototype.getTypeDefinitionAtPosition = function (fileName, position) { var _this = this; - return this.forwardJSONCall("getTypeDefinitionAtPosition('" + fileName + "', " + position + ")", function () { - return _this.languageService.getTypeDefinitionAtPosition(fileName, position); - }); + return this.forwardJSONCall("getTypeDefinitionAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getTypeDefinitionAtPosition(fileName, position); }); }; LanguageServiceShimObject.prototype.getRenameInfo = function (fileName, position) { var _this = this; - return this.forwardJSONCall("getRenameInfo('" + fileName + "', " + position + ")", function () { - return _this.languageService.getRenameInfo(fileName, position); - }); + return this.forwardJSONCall("getRenameInfo('" + fileName + "', " + position + ")", function () { return _this.languageService.getRenameInfo(fileName, position); }); }; LanguageServiceShimObject.prototype.findRenameLocations = function (fileName, position, findInStrings, findInComments) { var _this = this; - return this.forwardJSONCall("findRenameLocations('" + fileName + "', " + position + ", " + findInStrings + ", " + findInComments + ")", function () { - return _this.languageService.findRenameLocations(fileName, position, findInStrings, findInComments); - }); + return this.forwardJSONCall("findRenameLocations('" + fileName + "', " + position + ", " + findInStrings + ", " + findInComments + ")", function () { return _this.languageService.findRenameLocations(fileName, position, findInStrings, findInComments); }); }; LanguageServiceShimObject.prototype.getBraceMatchingAtPosition = function (fileName, position) { var _this = this; - return this.forwardJSONCall("getBraceMatchingAtPosition('" + fileName + "', " + position + ")", function () { - var textRanges = _this.languageService.getBraceMatchingAtPosition(fileName, position); - return textRanges; - }); + return this.forwardJSONCall("getBraceMatchingAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getBraceMatchingAtPosition(fileName, position); }); + }; + LanguageServiceShimObject.prototype.isValidBraceCompletionAtPostion = function (fileName, position, openingBrace) { + var _this = this; + return this.forwardJSONCall("isValidBraceCompletionAtPostion('" + fileName + "', " + position + ", " + openingBrace + ")", function () { return _this.languageService.isValidBraceCompletionAtPostion(fileName, position, openingBrace); }); }; LanguageServiceShimObject.prototype.getIndentationAtPosition = function (fileName, position, options) { var _this = this; @@ -45979,21 +51427,15 @@ var ts; }; LanguageServiceShimObject.prototype.getReferencesAtPosition = function (fileName, position) { var _this = this; - return this.forwardJSONCall("getReferencesAtPosition('" + fileName + "', " + position + ")", function () { - return _this.languageService.getReferencesAtPosition(fileName, position); - }); + return this.forwardJSONCall("getReferencesAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getReferencesAtPosition(fileName, position); }); }; LanguageServiceShimObject.prototype.findReferences = function (fileName, position) { var _this = this; - return this.forwardJSONCall("findReferences('" + fileName + "', " + position + ")", function () { - return _this.languageService.findReferences(fileName, position); - }); + return this.forwardJSONCall("findReferences('" + fileName + "', " + position + ")", function () { return _this.languageService.findReferences(fileName, position); }); }; LanguageServiceShimObject.prototype.getOccurrencesAtPosition = function (fileName, position) { var _this = this; - return this.forwardJSONCall("getOccurrencesAtPosition('" + fileName + "', " + position + ")", function () { - return _this.languageService.getOccurrencesAtPosition(fileName, position); - }); + return this.forwardJSONCall("getOccurrencesAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getOccurrencesAtPosition(fileName, position); }); }; LanguageServiceShimObject.prototype.getDocumentHighlights = function (fileName, position, filesToSearch) { var _this = this; @@ -46005,40 +51447,31 @@ var ts; }; LanguageServiceShimObject.prototype.getCompletionsAtPosition = function (fileName, position) { var _this = this; - return this.forwardJSONCall("getCompletionsAtPosition('" + fileName + "', " + position + ")", function () { - var completion = _this.languageService.getCompletionsAtPosition(fileName, position); - return completion; - }); + return this.forwardJSONCall("getCompletionsAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getCompletionsAtPosition(fileName, position); }); }; LanguageServiceShimObject.prototype.getCompletionEntryDetails = function (fileName, position, entryName) { var _this = this; - return this.forwardJSONCall("getCompletionEntryDetails('" + fileName + "', " + position + ", " + entryName + ")", function () { - var details = _this.languageService.getCompletionEntryDetails(fileName, position, entryName); - return details; - }); + return this.forwardJSONCall("getCompletionEntryDetails('" + fileName + "', " + position + ", '" + entryName + "')", function () { return _this.languageService.getCompletionEntryDetails(fileName, position, entryName); }); }; LanguageServiceShimObject.prototype.getFormattingEditsForRange = function (fileName, start, end, options) { var _this = this; return this.forwardJSONCall("getFormattingEditsForRange('" + fileName + "', " + start + ", " + end + ")", function () { var localOptions = JSON.parse(options); - var edits = _this.languageService.getFormattingEditsForRange(fileName, start, end, localOptions); - return edits; + return _this.languageService.getFormattingEditsForRange(fileName, start, end, localOptions); }); }; LanguageServiceShimObject.prototype.getFormattingEditsForDocument = function (fileName, options) { var _this = this; return this.forwardJSONCall("getFormattingEditsForDocument('" + fileName + "')", function () { var localOptions = JSON.parse(options); - var edits = _this.languageService.getFormattingEditsForDocument(fileName, localOptions); - return edits; + return _this.languageService.getFormattingEditsForDocument(fileName, localOptions); }); }; LanguageServiceShimObject.prototype.getFormattingEditsAfterKeystroke = function (fileName, position, key, options) { var _this = this; return this.forwardJSONCall("getFormattingEditsAfterKeystroke('" + fileName + "', " + position + ", '" + key + "')", function () { var localOptions = JSON.parse(options); - var edits = _this.languageService.getFormattingEditsAfterKeystroke(fileName, position, key, localOptions); - return edits; + return _this.languageService.getFormattingEditsAfterKeystroke(fileName, position, key, localOptions); }); }; LanguageServiceShimObject.prototype.getDocCommentTemplateAtPosition = function (fileName, position) { @@ -46047,42 +51480,26 @@ var ts; }; LanguageServiceShimObject.prototype.getNavigateToItems = function (searchValue, maxResultCount) { var _this = this; - return this.forwardJSONCall("getNavigateToItems('" + searchValue + "', " + maxResultCount + ")", function () { - var items = _this.languageService.getNavigateToItems(searchValue, maxResultCount); - return items; - }); + return this.forwardJSONCall("getNavigateToItems('" + searchValue + "', " + maxResultCount + ")", function () { return _this.languageService.getNavigateToItems(searchValue, maxResultCount); }); }; LanguageServiceShimObject.prototype.getNavigationBarItems = function (fileName) { var _this = this; - return this.forwardJSONCall("getNavigationBarItems('" + fileName + "')", function () { - var items = _this.languageService.getNavigationBarItems(fileName); - return items; - }); + return this.forwardJSONCall("getNavigationBarItems('" + fileName + "')", function () { return _this.languageService.getNavigationBarItems(fileName); }); }; LanguageServiceShimObject.prototype.getOutliningSpans = function (fileName) { var _this = this; - return this.forwardJSONCall("getOutliningSpans('" + fileName + "')", function () { - var items = _this.languageService.getOutliningSpans(fileName); - return items; - }); + return this.forwardJSONCall("getOutliningSpans('" + fileName + "')", function () { return _this.languageService.getOutliningSpans(fileName); }); }; LanguageServiceShimObject.prototype.getTodoComments = function (fileName, descriptors) { var _this = this; - return this.forwardJSONCall("getTodoComments('" + fileName + "')", function () { - var items = _this.languageService.getTodoComments(fileName, JSON.parse(descriptors)); - return items; - }); + return this.forwardJSONCall("getTodoComments('" + fileName + "')", function () { return _this.languageService.getTodoComments(fileName, JSON.parse(descriptors)); }); }; LanguageServiceShimObject.prototype.getEmitOutput = function (fileName) { var _this = this; - return this.forwardJSONCall("getEmitOutput('" + fileName + "')", function () { - var output = _this.languageService.getEmitOutput(fileName); - output.emitOutputStatus = output.emitSkipped ? 1 : 0; - return output; - }); + return this.forwardJSONCall("getEmitOutput('" + fileName + "')", function () { return _this.languageService.getEmitOutput(fileName); }); }; return LanguageServiceShimObject; - })(ShimBase); + }(ShimBase)); function convertClassifications(classifications) { return { spans: classifications.spans.join(","), endOfLineState: classifications.endOfLineState }; } @@ -46100,17 +51517,17 @@ var ts; }; ClassifierShimObject.prototype.getClassificationsForLine = function (text, lexState, classifyKeywordsInGenerics) { var classification = this.classifier.getClassificationsForLine(text, lexState, classifyKeywordsInGenerics); - var items = classification.entries; var result = ""; - for (var i = 0; i < items.length; i++) { - result += items[i].length + "\n"; - result += items[i].classification + "\n"; + for (var _i = 0, _a = classification.entries; _i < _a.length; _i++) { + var item = _a[_i]; + result += item.length + "\n"; + result += item.classification + "\n"; } result += classification.finalLexState; return result; }; return ClassifierShimObject; - })(ShimBase); + }(ShimBase)); var CoreServicesShimObject = (function (_super) { __extends(CoreServicesShimObject, _super); function CoreServicesShimObject(factory, logger, host) { @@ -46133,32 +51550,46 @@ var ts; }; }); }; + CoreServicesShimObject.prototype.resolveTypeReferenceDirective = function (fileName, typeReferenceDirective, compilerOptionsJson) { + var _this = this; + return this.forwardJSONCall("resolveTypeReferenceDirective(" + fileName + ")", function () { + var compilerOptions = JSON.parse(compilerOptionsJson); + var result = ts.resolveTypeReferenceDirective(typeReferenceDirective, ts.normalizeSlashes(fileName), compilerOptions, _this.host); + return { + resolvedFileName: result.resolvedTypeReferenceDirective ? result.resolvedTypeReferenceDirective.resolvedFileName : undefined, + primary: result.resolvedTypeReferenceDirective ? result.resolvedTypeReferenceDirective.primary : true, + failedLookupLocations: result.failedLookupLocations + }; + }); + }; CoreServicesShimObject.prototype.getPreProcessedFileInfo = function (fileName, sourceTextSnapshot) { + var _this = this; return this.forwardJSONCall("getPreProcessedFileInfo('" + fileName + "')", function () { var result = ts.preProcessFile(sourceTextSnapshot.getText(0, sourceTextSnapshot.getLength()), true, true); - var convertResult = { - referencedFiles: [], - importedFiles: [], + return { + referencedFiles: _this.convertFileReferences(result.referencedFiles), + importedFiles: _this.convertFileReferences(result.importedFiles), ambientExternalModules: result.ambientExternalModules, - isLibFile: result.isLibFile + isLibFile: result.isLibFile, + typeReferenceDirectives: _this.convertFileReferences(result.typeReferenceDirectives) }; - ts.forEach(result.referencedFiles, function (refFile) { - convertResult.referencedFiles.push({ - path: ts.normalizePath(refFile.fileName), - position: refFile.pos, - length: refFile.end - refFile.pos - }); - }); - ts.forEach(result.importedFiles, function (importedFile) { - convertResult.importedFiles.push({ - path: ts.normalizeSlashes(importedFile.fileName), - position: importedFile.pos, - length: importedFile.end - importedFile.pos - }); - }); - return convertResult; }); }; + CoreServicesShimObject.prototype.convertFileReferences = function (refs) { + if (!refs) { + return undefined; + } + var result = []; + for (var _i = 0, refs_2 = refs; _i < refs_2.length; _i++) { + var ref = refs_2[_i]; + result.push({ + path: ts.normalizeSlashes(ref.fileName), + position: ref.pos, + length: ref.end - ref.pos + }); + } + return result; + }; CoreServicesShimObject.prototype.getTSConfigFileInfo = function (fileName, sourceTextSnapshot) { var _this = this; return this.forwardJSONCall("getTSConfigFileInfo('" + fileName + "')", function () { @@ -46167,25 +51598,36 @@ var ts; if (result.error) { return { options: {}, + typingOptions: {}, files: [], - errors: [realizeDiagnostic(result.error, '\r\n')] + raw: {}, + errors: [realizeDiagnostic(result.error, "\r\n")] }; } - var configFile = ts.parseJsonConfigFileContent(result.config, _this.host, ts.getDirectoryPath(ts.normalizeSlashes(fileName))); + var normalizedFileName = ts.normalizeSlashes(fileName); + var configFile = ts.parseJsonConfigFileContent(result.config, _this.host, ts.getDirectoryPath(normalizedFileName), {}, normalizedFileName); return { options: configFile.options, + typingOptions: configFile.typingOptions, files: configFile.fileNames, - errors: realizeDiagnostics(configFile.errors, '\r\n') + raw: configFile.raw, + errors: realizeDiagnostics(configFile.errors, "\r\n") }; }); }; CoreServicesShimObject.prototype.getDefaultCompilationSettings = function () { - return this.forwardJSONCall("getDefaultCompilationSettings()", function () { - return ts.getDefaultCompilerOptions(); + return this.forwardJSONCall("getDefaultCompilationSettings()", function () { return ts.getDefaultCompilerOptions(); }); + }; + CoreServicesShimObject.prototype.discoverTypings = function (discoverTypingsJson) { + var _this = this; + var getCanonicalFileName = ts.createGetCanonicalFileName(false); + return this.forwardJSONCall("discoverTypings()", function () { + var info = JSON.parse(discoverTypingsJson); + return ts.JsTyping.discoverTypings(_this.host, info.fileNames, ts.toPath(info.projectRootPath, info.projectRootPath, getCanonicalFileName), ts.toPath(info.safeListPath, info.safeListPath, getCanonicalFileName), info.packageNameToTypingLocation, info.typingOptions, info.compilerOptions); }); }; return CoreServicesShimObject; - })(ShimBase); + }(ShimBase)); var TypeScriptServicesFactory = (function () { function TypeScriptServicesFactory() { this._shims = []; @@ -46243,7 +51685,7 @@ var ts; throw new Error("Invalid operation"); }; return TypeScriptServicesFactory; - })(); + }()); ts.TypeScriptServicesFactory = TypeScriptServicesFactory; if (typeof module !== "undefined" && module.exports) { module.exports = ts; @@ -46256,4 +51698,4 @@ var TypeScript; Services.TypeScriptServicesFactory = ts.TypeScriptServicesFactory; })(Services = TypeScript.Services || (TypeScript.Services = {})); })(TypeScript || (TypeScript = {})); -var toolsVersion = "1.6"; +var toolsVersion = "1.9"; diff --git a/lib/tsserverlibrary.d.ts b/lib/tsserverlibrary.d.ts new file mode 100644 index 00000000000..0629ad983a3 --- /dev/null +++ b/lib/tsserverlibrary.d.ts @@ -0,0 +1,8618 @@ +/// +declare namespace ts { + interface Map { + [index: string]: T; + } + type Path = string & { + __pathBrand: any; + }; + interface FileMap { + get(fileName: Path): T; + set(fileName: Path, value: T): void; + contains(fileName: Path): boolean; + remove(fileName: Path): void; + forEachValue(f: (key: Path, v: T) => void): void; + clear(): void; + } + interface TextRange { + pos: number; + end: number; + } + const enum SyntaxKind { + Unknown = 0, + EndOfFileToken = 1, + SingleLineCommentTrivia = 2, + MultiLineCommentTrivia = 3, + NewLineTrivia = 4, + WhitespaceTrivia = 5, + ShebangTrivia = 6, + ConflictMarkerTrivia = 7, + NumericLiteral = 8, + StringLiteral = 9, + RegularExpressionLiteral = 10, + NoSubstitutionTemplateLiteral = 11, + TemplateHead = 12, + TemplateMiddle = 13, + TemplateTail = 14, + OpenBraceToken = 15, + CloseBraceToken = 16, + OpenParenToken = 17, + CloseParenToken = 18, + OpenBracketToken = 19, + CloseBracketToken = 20, + DotToken = 21, + DotDotDotToken = 22, + SemicolonToken = 23, + CommaToken = 24, + LessThanToken = 25, + LessThanSlashToken = 26, + GreaterThanToken = 27, + LessThanEqualsToken = 28, + GreaterThanEqualsToken = 29, + EqualsEqualsToken = 30, + ExclamationEqualsToken = 31, + EqualsEqualsEqualsToken = 32, + ExclamationEqualsEqualsToken = 33, + EqualsGreaterThanToken = 34, + PlusToken = 35, + MinusToken = 36, + AsteriskToken = 37, + AsteriskAsteriskToken = 38, + SlashToken = 39, + PercentToken = 40, + PlusPlusToken = 41, + MinusMinusToken = 42, + LessThanLessThanToken = 43, + GreaterThanGreaterThanToken = 44, + GreaterThanGreaterThanGreaterThanToken = 45, + AmpersandToken = 46, + BarToken = 47, + CaretToken = 48, + ExclamationToken = 49, + TildeToken = 50, + AmpersandAmpersandToken = 51, + BarBarToken = 52, + QuestionToken = 53, + ColonToken = 54, + AtToken = 55, + EqualsToken = 56, + PlusEqualsToken = 57, + MinusEqualsToken = 58, + AsteriskEqualsToken = 59, + AsteriskAsteriskEqualsToken = 60, + SlashEqualsToken = 61, + PercentEqualsToken = 62, + LessThanLessThanEqualsToken = 63, + GreaterThanGreaterThanEqualsToken = 64, + GreaterThanGreaterThanGreaterThanEqualsToken = 65, + AmpersandEqualsToken = 66, + BarEqualsToken = 67, + CaretEqualsToken = 68, + Identifier = 69, + BreakKeyword = 70, + CaseKeyword = 71, + CatchKeyword = 72, + ClassKeyword = 73, + ConstKeyword = 74, + ContinueKeyword = 75, + DebuggerKeyword = 76, + DefaultKeyword = 77, + DeleteKeyword = 78, + DoKeyword = 79, + ElseKeyword = 80, + EnumKeyword = 81, + ExportKeyword = 82, + ExtendsKeyword = 83, + FalseKeyword = 84, + FinallyKeyword = 85, + ForKeyword = 86, + FunctionKeyword = 87, + IfKeyword = 88, + ImportKeyword = 89, + InKeyword = 90, + InstanceOfKeyword = 91, + NewKeyword = 92, + NullKeyword = 93, + ReturnKeyword = 94, + SuperKeyword = 95, + SwitchKeyword = 96, + ThisKeyword = 97, + ThrowKeyword = 98, + TrueKeyword = 99, + TryKeyword = 100, + TypeOfKeyword = 101, + VarKeyword = 102, + VoidKeyword = 103, + WhileKeyword = 104, + WithKeyword = 105, + ImplementsKeyword = 106, + InterfaceKeyword = 107, + LetKeyword = 108, + PackageKeyword = 109, + PrivateKeyword = 110, + ProtectedKeyword = 111, + PublicKeyword = 112, + StaticKeyword = 113, + YieldKeyword = 114, + AbstractKeyword = 115, + AsKeyword = 116, + AnyKeyword = 117, + AsyncKeyword = 118, + AwaitKeyword = 119, + BooleanKeyword = 120, + ConstructorKeyword = 121, + DeclareKeyword = 122, + GetKeyword = 123, + IsKeyword = 124, + ModuleKeyword = 125, + NamespaceKeyword = 126, + NeverKeyword = 127, + ReadonlyKeyword = 128, + RequireKeyword = 129, + NumberKeyword = 130, + SetKeyword = 131, + StringKeyword = 132, + SymbolKeyword = 133, + TypeKeyword = 134, + UndefinedKeyword = 135, + FromKeyword = 136, + GlobalKeyword = 137, + OfKeyword = 138, + QualifiedName = 139, + ComputedPropertyName = 140, + TypeParameter = 141, + Parameter = 142, + Decorator = 143, + PropertySignature = 144, + PropertyDeclaration = 145, + MethodSignature = 146, + MethodDeclaration = 147, + Constructor = 148, + GetAccessor = 149, + SetAccessor = 150, + CallSignature = 151, + ConstructSignature = 152, + IndexSignature = 153, + TypePredicate = 154, + TypeReference = 155, + FunctionType = 156, + ConstructorType = 157, + TypeQuery = 158, + TypeLiteral = 159, + ArrayType = 160, + TupleType = 161, + UnionType = 162, + IntersectionType = 163, + ParenthesizedType = 164, + ThisType = 165, + StringLiteralType = 166, + ObjectBindingPattern = 167, + ArrayBindingPattern = 168, + BindingElement = 169, + ArrayLiteralExpression = 170, + ObjectLiteralExpression = 171, + PropertyAccessExpression = 172, + ElementAccessExpression = 173, + CallExpression = 174, + NewExpression = 175, + TaggedTemplateExpression = 176, + TypeAssertionExpression = 177, + ParenthesizedExpression = 178, + FunctionExpression = 179, + ArrowFunction = 180, + DeleteExpression = 181, + TypeOfExpression = 182, + VoidExpression = 183, + AwaitExpression = 184, + PrefixUnaryExpression = 185, + PostfixUnaryExpression = 186, + BinaryExpression = 187, + ConditionalExpression = 188, + TemplateExpression = 189, + YieldExpression = 190, + SpreadElementExpression = 191, + ClassExpression = 192, + OmittedExpression = 193, + ExpressionWithTypeArguments = 194, + AsExpression = 195, + NonNullExpression = 196, + TemplateSpan = 197, + SemicolonClassElement = 198, + Block = 199, + VariableStatement = 200, + EmptyStatement = 201, + ExpressionStatement = 202, + IfStatement = 203, + DoStatement = 204, + WhileStatement = 205, + ForStatement = 206, + ForInStatement = 207, + ForOfStatement = 208, + ContinueStatement = 209, + BreakStatement = 210, + ReturnStatement = 211, + WithStatement = 212, + SwitchStatement = 213, + LabeledStatement = 214, + ThrowStatement = 215, + TryStatement = 216, + DebuggerStatement = 217, + VariableDeclaration = 218, + VariableDeclarationList = 219, + FunctionDeclaration = 220, + ClassDeclaration = 221, + InterfaceDeclaration = 222, + TypeAliasDeclaration = 223, + EnumDeclaration = 224, + ModuleDeclaration = 225, + ModuleBlock = 226, + CaseBlock = 227, + GlobalModuleExportDeclaration = 228, + ImportEqualsDeclaration = 229, + ImportDeclaration = 230, + ImportClause = 231, + NamespaceImport = 232, + NamedImports = 233, + ImportSpecifier = 234, + ExportAssignment = 235, + ExportDeclaration = 236, + NamedExports = 237, + ExportSpecifier = 238, + MissingDeclaration = 239, + ExternalModuleReference = 240, + JsxElement = 241, + JsxSelfClosingElement = 242, + JsxOpeningElement = 243, + JsxText = 244, + JsxClosingElement = 245, + JsxAttribute = 246, + JsxSpreadAttribute = 247, + JsxExpression = 248, + CaseClause = 249, + DefaultClause = 250, + HeritageClause = 251, + CatchClause = 252, + PropertyAssignment = 253, + ShorthandPropertyAssignment = 254, + EnumMember = 255, + SourceFile = 256, + JSDocTypeExpression = 257, + JSDocAllType = 258, + JSDocUnknownType = 259, + JSDocArrayType = 260, + JSDocUnionType = 261, + JSDocTupleType = 262, + JSDocNullableType = 263, + JSDocNonNullableType = 264, + JSDocRecordType = 265, + JSDocRecordMember = 266, + JSDocTypeReference = 267, + JSDocOptionalType = 268, + JSDocFunctionType = 269, + JSDocVariadicType = 270, + JSDocConstructorType = 271, + JSDocThisType = 272, + JSDocComment = 273, + JSDocTag = 274, + JSDocParameterTag = 275, + JSDocReturnTag = 276, + JSDocTypeTag = 277, + JSDocTemplateTag = 278, + SyntaxList = 279, + Count = 280, + FirstAssignment = 56, + LastAssignment = 68, + FirstReservedWord = 70, + LastReservedWord = 105, + FirstKeyword = 70, + LastKeyword = 138, + FirstFutureReservedWord = 106, + LastFutureReservedWord = 114, + FirstTypeNode = 154, + LastTypeNode = 166, + FirstPunctuation = 15, + LastPunctuation = 68, + FirstToken = 0, + LastToken = 138, + FirstTriviaToken = 2, + LastTriviaToken = 7, + FirstLiteralToken = 8, + LastLiteralToken = 11, + FirstTemplateToken = 11, + LastTemplateToken = 14, + FirstBinaryOperator = 25, + LastBinaryOperator = 68, + FirstNode = 139, + } + const enum NodeFlags { + None = 0, + Export = 1, + Ambient = 2, + Public = 4, + Private = 8, + Protected = 16, + Static = 32, + Readonly = 64, + Abstract = 128, + Async = 256, + Default = 512, + Let = 1024, + Const = 2048, + Namespace = 4096, + ExportContext = 8192, + ContainsThis = 16384, + HasImplicitReturn = 32768, + HasExplicitReturn = 65536, + GlobalAugmentation = 131072, + HasClassExtends = 262144, + HasDecorators = 524288, + HasParamDecorators = 1048576, + HasAsyncFunctions = 2097152, + DisallowInContext = 4194304, + YieldContext = 8388608, + DecoratorContext = 16777216, + AwaitContext = 33554432, + ThisNodeHasError = 67108864, + JavaScriptFile = 134217728, + ThisNodeOrAnySubNodesHasError = 268435456, + HasAggregatedChildData = 536870912, + HasJsxSpreadAttribute = 1073741824, + Modifier = 1023, + AccessibilityModifier = 28, + ParameterPropertyModifier = 92, + BlockScoped = 3072, + ReachabilityCheckFlags = 98304, + EmitHelperFlags = 3932160, + ContextFlags = 197132288, + TypeExcludesFlags = 41943040, + } + const enum JsxFlags { + None = 0, + IntrinsicNamedElement = 1, + IntrinsicIndexedElement = 2, + IntrinsicElement = 3, + } + const enum RelationComparisonResult { + Succeeded = 1, + Failed = 2, + FailedAndReported = 3, + } + interface Node extends TextRange { + kind: SyntaxKind; + flags: NodeFlags; + decorators?: NodeArray; + modifiers?: ModifiersArray; + id?: number; + parent?: Node; + jsDocComment?: JSDocComment; + symbol?: Symbol; + locals?: SymbolTable; + nextContainer?: Node; + localSymbol?: Symbol; + flowNode?: FlowNode; + } + interface NodeArray extends Array, TextRange { + hasTrailingComma?: boolean; + } + interface ModifiersArray extends NodeArray { + flags: number; + } + interface Modifier extends Node { + } + interface Identifier extends PrimaryExpression { + text: string; + originalKeywordKind?: SyntaxKind; + } + interface QualifiedName extends Node { + left: EntityName; + right: Identifier; + } + type EntityName = Identifier | QualifiedName; + type PropertyName = Identifier | LiteralExpression | ComputedPropertyName; + type DeclarationName = Identifier | LiteralExpression | ComputedPropertyName | BindingPattern; + interface Declaration extends Node { + _declarationBrand: any; + name?: DeclarationName; + } + interface DeclarationStatement extends Declaration, Statement { + name?: Identifier; + } + interface ComputedPropertyName extends Node { + expression: Expression; + } + interface Decorator extends Node { + expression: LeftHandSideExpression; + } + interface TypeParameterDeclaration extends Declaration { + name: Identifier; + constraint?: TypeNode; + expression?: Expression; + } + interface SignatureDeclaration extends Declaration { + name?: PropertyName; + typeParameters?: NodeArray; + parameters: NodeArray; + type?: TypeNode; + } + interface CallSignatureDeclaration extends SignatureDeclaration, TypeElement { + } + interface ConstructSignatureDeclaration extends SignatureDeclaration, TypeElement { + } + interface VariableDeclaration extends Declaration { + parent?: VariableDeclarationList; + name: Identifier | BindingPattern; + type?: TypeNode; + initializer?: Expression; + } + interface VariableDeclarationList extends Node { + declarations: NodeArray; + } + interface ParameterDeclaration extends Declaration { + dotDotDotToken?: Node; + name: Identifier | BindingPattern; + questionToken?: Node; + type?: TypeNode; + initializer?: Expression; + } + interface BindingElement extends Declaration { + propertyName?: PropertyName; + dotDotDotToken?: Node; + name: Identifier | BindingPattern; + initializer?: Expression; + } + interface PropertySignature extends TypeElement { + name: PropertyName; + questionToken?: Node; + type?: TypeNode; + initializer?: Expression; + } + interface PropertyDeclaration extends ClassElement { + questionToken?: Node; + name: PropertyName; + type?: TypeNode; + initializer?: Expression; + } + interface ObjectLiteralElement extends Declaration { + _objectLiteralBrandBrand: any; + name?: PropertyName; + } + interface PropertyAssignment extends ObjectLiteralElement { + _propertyAssignmentBrand: any; + name: PropertyName; + questionToken?: Node; + initializer: Expression; + } + interface ShorthandPropertyAssignment extends ObjectLiteralElement { + name: Identifier; + questionToken?: Node; + equalsToken?: Node; + objectAssignmentInitializer?: Expression; + } + interface VariableLikeDeclaration extends Declaration { + propertyName?: PropertyName; + dotDotDotToken?: Node; + name: DeclarationName; + questionToken?: Node; + type?: TypeNode; + initializer?: Expression; + } + interface PropertyLikeDeclaration extends Declaration { + name: PropertyName; + } + interface BindingPattern extends Node { + elements: NodeArray; + } + interface ObjectBindingPattern extends BindingPattern { + } + interface ArrayBindingPattern extends BindingPattern { + } + interface FunctionLikeDeclaration extends SignatureDeclaration { + _functionLikeDeclarationBrand: any; + asteriskToken?: Node; + questionToken?: Node; + body?: Block | Expression; + } + interface FunctionDeclaration extends FunctionLikeDeclaration, DeclarationStatement { + name?: Identifier; + body?: FunctionBody; + } + interface MethodSignature extends SignatureDeclaration, TypeElement { + name: PropertyName; + } + interface MethodDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement { + name: PropertyName; + body?: FunctionBody; + } + interface ConstructorDeclaration extends FunctionLikeDeclaration, ClassElement { + body?: FunctionBody; + } + interface SemicolonClassElement extends ClassElement { + _semicolonClassElementBrand: any; + } + interface AccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement { + _accessorDeclarationBrand: any; + name: PropertyName; + body: FunctionBody; + } + interface GetAccessorDeclaration extends AccessorDeclaration { + } + interface SetAccessorDeclaration extends AccessorDeclaration { + } + interface IndexSignatureDeclaration extends SignatureDeclaration, ClassElement, TypeElement { + _indexSignatureDeclarationBrand: any; + } + interface TypeNode extends Node { + _typeNodeBrand: any; + } + interface ThisTypeNode extends TypeNode { + _thisTypeNodeBrand: any; + } + interface FunctionOrConstructorTypeNode extends TypeNode, SignatureDeclaration { + _functionOrConstructorTypeNodeBrand: any; + } + interface FunctionTypeNode extends FunctionOrConstructorTypeNode { + } + interface ConstructorTypeNode extends FunctionOrConstructorTypeNode { + } + interface TypeReferenceNode extends TypeNode { + typeName: EntityName; + typeArguments?: NodeArray; + } + interface TypePredicateNode extends TypeNode { + parameterName: Identifier | ThisTypeNode; + type: TypeNode; + } + interface TypeQueryNode extends TypeNode { + exprName: EntityName; + } + interface TypeLiteralNode extends TypeNode, Declaration { + members: NodeArray; + } + interface ArrayTypeNode extends TypeNode { + elementType: TypeNode; + } + interface TupleTypeNode extends TypeNode { + elementTypes: NodeArray; + } + interface UnionOrIntersectionTypeNode extends TypeNode { + types: NodeArray; + } + interface UnionTypeNode extends UnionOrIntersectionTypeNode { + } + interface IntersectionTypeNode extends UnionOrIntersectionTypeNode { + } + interface ParenthesizedTypeNode extends TypeNode { + type: TypeNode; + } + interface StringLiteralTypeNode extends LiteralLikeNode, TypeNode { + _stringLiteralTypeBrand: any; + } + interface StringLiteral extends LiteralExpression { + _stringLiteralBrand: any; + } + interface Expression extends Node { + _expressionBrand: any; + contextualType?: Type; + } + interface OmittedExpression extends Expression { + } + interface UnaryExpression extends Expression { + _unaryExpressionBrand: any; + } + interface IncrementExpression extends UnaryExpression { + _incrementExpressionBrand: any; + } + interface PrefixUnaryExpression extends IncrementExpression { + operator: SyntaxKind; + operand: UnaryExpression; + } + interface PostfixUnaryExpression extends IncrementExpression { + operand: LeftHandSideExpression; + operator: SyntaxKind; + } + interface PostfixExpression extends UnaryExpression { + _postfixExpressionBrand: any; + } + interface LeftHandSideExpression extends IncrementExpression { + _leftHandSideExpressionBrand: any; + } + interface MemberExpression extends LeftHandSideExpression { + _memberExpressionBrand: any; + } + interface PrimaryExpression extends MemberExpression { + _primaryExpressionBrand: any; + } + interface DeleteExpression extends UnaryExpression { + expression: UnaryExpression; + } + interface TypeOfExpression extends UnaryExpression { + expression: UnaryExpression; + } + interface VoidExpression extends UnaryExpression { + expression: UnaryExpression; + } + interface AwaitExpression extends UnaryExpression { + expression: UnaryExpression; + } + interface YieldExpression extends Expression { + asteriskToken?: Node; + expression?: Expression; + } + interface BinaryExpression extends Expression, Declaration { + left: Expression; + operatorToken: Node; + right: Expression; + } + interface ConditionalExpression extends Expression { + condition: Expression; + questionToken: Node; + whenTrue: Expression; + colonToken: Node; + whenFalse: Expression; + } + type FunctionBody = Block; + type ConciseBody = FunctionBody | Expression; + interface FunctionExpression extends PrimaryExpression, FunctionLikeDeclaration { + name?: Identifier; + body: FunctionBody; + } + interface ArrowFunction extends Expression, FunctionLikeDeclaration { + equalsGreaterThanToken: Node; + body: ConciseBody; + } + interface LiteralLikeNode extends Node { + text: string; + isUnterminated?: boolean; + hasExtendedUnicodeEscape?: boolean; + isOctalLiteral?: boolean; + } + interface LiteralExpression extends LiteralLikeNode, PrimaryExpression { + _literalExpressionBrand: any; + } + interface TemplateLiteralFragment extends LiteralLikeNode { + _templateLiteralFragmentBrand: any; + } + interface TemplateExpression extends PrimaryExpression { + head: TemplateLiteralFragment; + templateSpans: NodeArray; + } + interface TemplateSpan extends Node { + expression: Expression; + literal: TemplateLiteralFragment; + } + interface ParenthesizedExpression extends PrimaryExpression { + expression: Expression; + } + interface ArrayLiteralExpression extends PrimaryExpression { + elements: NodeArray; + multiLine?: boolean; + } + interface SpreadElementExpression extends Expression { + expression: Expression; + } + interface ObjectLiteralExpression extends PrimaryExpression, Declaration { + properties: NodeArray; + multiLine?: boolean; + } + interface PropertyAccessExpression extends MemberExpression, Declaration { + expression: LeftHandSideExpression; + dotToken: Node; + name: Identifier; + } + type IdentifierOrPropertyAccess = Identifier | PropertyAccessExpression; + interface ElementAccessExpression extends MemberExpression { + expression: LeftHandSideExpression; + argumentExpression?: Expression; + } + interface CallExpression extends LeftHandSideExpression, Declaration { + expression: LeftHandSideExpression; + typeArguments?: NodeArray; + arguments: NodeArray; + } + interface ExpressionWithTypeArguments extends TypeNode { + expression: LeftHandSideExpression; + typeArguments?: NodeArray; + } + interface NewExpression extends CallExpression, PrimaryExpression { + } + interface TaggedTemplateExpression extends MemberExpression { + tag: LeftHandSideExpression; + template: LiteralExpression | TemplateExpression; + } + type CallLikeExpression = CallExpression | NewExpression | TaggedTemplateExpression | Decorator; + interface AsExpression extends Expression { + expression: Expression; + type: TypeNode; + } + interface TypeAssertion extends UnaryExpression { + type: TypeNode; + expression: UnaryExpression; + } + type AssertionExpression = TypeAssertion | AsExpression; + interface NonNullExpression extends LeftHandSideExpression { + expression: Expression; + } + interface JsxElement extends PrimaryExpression { + openingElement: JsxOpeningElement; + children: NodeArray; + closingElement: JsxClosingElement; + } + interface JsxOpeningElement extends Expression { + _openingElementBrand?: any; + tagName: EntityName; + attributes: NodeArray; + } + interface JsxSelfClosingElement extends PrimaryExpression, JsxOpeningElement { + _selfClosingElementBrand?: any; + } + type JsxOpeningLikeElement = JsxSelfClosingElement | JsxOpeningElement; + interface JsxAttribute extends Node { + name: Identifier; + initializer?: Expression; + } + interface JsxSpreadAttribute extends Node { + expression: Expression; + } + interface JsxClosingElement extends Node { + tagName: EntityName; + } + interface JsxExpression extends Expression { + expression?: Expression; + } + interface JsxText extends Node { + _jsxTextExpressionBrand: any; + } + type JsxChild = JsxText | JsxExpression | JsxElement | JsxSelfClosingElement; + interface Statement extends Node { + _statementBrand: any; + } + interface EmptyStatement extends Statement { + } + interface DebuggerStatement extends Statement { + } + interface MissingDeclaration extends DeclarationStatement, ClassElement, ObjectLiteralElement, TypeElement { + name?: Identifier; + } + type BlockLike = SourceFile | Block | ModuleBlock | CaseClause; + interface Block extends Statement { + statements: NodeArray; + } + interface VariableStatement extends Statement { + declarationList: VariableDeclarationList; + } + interface ExpressionStatement extends Statement { + expression: Expression; + } + interface IfStatement extends Statement { + expression: Expression; + thenStatement: Statement; + elseStatement?: Statement; + } + interface IterationStatement extends Statement { + statement: Statement; + } + interface DoStatement extends IterationStatement { + expression: Expression; + } + interface WhileStatement extends IterationStatement { + expression: Expression; + } + interface ForStatement extends IterationStatement { + initializer?: VariableDeclarationList | Expression; + condition?: Expression; + incrementor?: Expression; + } + interface ForInStatement extends IterationStatement { + initializer: VariableDeclarationList | Expression; + expression: Expression; + } + interface ForOfStatement extends IterationStatement { + initializer: VariableDeclarationList | Expression; + expression: Expression; + } + interface BreakStatement extends Statement { + label?: Identifier; + } + interface ContinueStatement extends Statement { + label?: Identifier; + } + type BreakOrContinueStatement = BreakStatement | ContinueStatement; + interface ReturnStatement extends Statement { + expression?: Expression; + } + interface WithStatement extends Statement { + expression: Expression; + statement: Statement; + } + interface SwitchStatement extends Statement { + expression: Expression; + caseBlock: CaseBlock; + } + interface CaseBlock extends Node { + clauses: NodeArray; + } + interface CaseClause extends Node { + expression: Expression; + statements: NodeArray; + } + interface DefaultClause extends Node { + statements: NodeArray; + } + type CaseOrDefaultClause = CaseClause | DefaultClause; + interface LabeledStatement extends Statement { + label: Identifier; + statement: Statement; + } + interface ThrowStatement extends Statement { + expression: Expression; + } + interface TryStatement extends Statement { + tryBlock: Block; + catchClause?: CatchClause; + finallyBlock?: Block; + } + interface CatchClause extends Node { + variableDeclaration: VariableDeclaration; + block: Block; + } + type DeclarationWithTypeParameters = SignatureDeclaration | ClassLikeDeclaration | InterfaceDeclaration | TypeAliasDeclaration; + interface ClassLikeDeclaration extends Declaration { + name?: Identifier; + typeParameters?: NodeArray; + heritageClauses?: NodeArray; + members: NodeArray; + } + interface ClassDeclaration extends ClassLikeDeclaration, DeclarationStatement { + name?: Identifier; + } + interface ClassExpression extends ClassLikeDeclaration, PrimaryExpression { + } + interface ClassElement extends Declaration { + _classElementBrand: any; + name?: PropertyName; + } + interface TypeElement extends Declaration { + _typeElementBrand: any; + name?: PropertyName; + questionToken?: Node; + } + interface InterfaceDeclaration extends DeclarationStatement { + name: Identifier; + typeParameters?: NodeArray; + heritageClauses?: NodeArray; + members: NodeArray; + } + interface HeritageClause extends Node { + token: SyntaxKind; + types?: NodeArray; + } + interface TypeAliasDeclaration extends DeclarationStatement { + name: Identifier; + typeParameters?: NodeArray; + type: TypeNode; + } + interface EnumMember extends Declaration { + name: DeclarationName; + initializer?: Expression; + } + interface EnumDeclaration extends DeclarationStatement { + name: Identifier; + members: NodeArray; + } + type ModuleBody = ModuleBlock | ModuleDeclaration; + interface ModuleDeclaration extends DeclarationStatement { + name: Identifier | LiteralExpression; + body: ModuleBlock | ModuleDeclaration; + } + interface ModuleBlock extends Node, Statement { + statements: NodeArray; + } + interface ImportEqualsDeclaration extends DeclarationStatement { + name: Identifier; + moduleReference: EntityName | ExternalModuleReference; + } + interface ExternalModuleReference extends Node { + expression?: Expression; + } + interface ImportDeclaration extends Statement { + importClause?: ImportClause; + moduleSpecifier: Expression; + } + interface ImportClause extends Declaration { + name?: Identifier; + namedBindings?: NamespaceImport | NamedImports; + } + interface NamespaceImport extends Declaration { + name: Identifier; + } + interface GlobalModuleExportDeclaration extends DeclarationStatement { + name: Identifier; + moduleReference: LiteralLikeNode; + } + interface ExportDeclaration extends DeclarationStatement { + exportClause?: NamedExports; + moduleSpecifier?: Expression; + } + interface NamedImports extends Node { + elements: NodeArray; + } + interface NamedExports extends Node { + elements: NodeArray; + } + type NamedImportsOrExports = NamedImports | NamedExports; + interface ImportSpecifier extends Declaration { + propertyName?: Identifier; + name: Identifier; + } + interface ExportSpecifier extends Declaration { + propertyName?: Identifier; + name: Identifier; + } + type ImportOrExportSpecifier = ImportSpecifier | ExportSpecifier; + interface ExportAssignment extends DeclarationStatement { + isExportEquals?: boolean; + expression: Expression; + } + interface FileReference extends TextRange { + fileName: string; + } + interface CommentRange extends TextRange { + hasTrailingNewLine?: boolean; + kind: SyntaxKind; + } + interface JSDocTypeExpression extends Node { + type: JSDocType; + } + interface JSDocType extends TypeNode { + _jsDocTypeBrand: any; + } + interface JSDocAllType extends JSDocType { + _JSDocAllTypeBrand: any; + } + interface JSDocUnknownType extends JSDocType { + _JSDocUnknownTypeBrand: any; + } + interface JSDocArrayType extends JSDocType { + elementType: JSDocType; + } + interface JSDocUnionType extends JSDocType { + types: NodeArray; + } + interface JSDocTupleType extends JSDocType { + types: NodeArray; + } + interface JSDocNonNullableType extends JSDocType { + type: JSDocType; + } + interface JSDocNullableType extends JSDocType { + type: JSDocType; + } + interface JSDocRecordType extends JSDocType, TypeLiteralNode { + members: NodeArray; + } + interface JSDocTypeReference extends JSDocType { + name: EntityName; + typeArguments: NodeArray; + } + interface JSDocOptionalType extends JSDocType { + type: JSDocType; + } + interface JSDocFunctionType extends JSDocType, SignatureDeclaration { + parameters: NodeArray; + type: JSDocType; + } + interface JSDocVariadicType extends JSDocType { + type: JSDocType; + } + interface JSDocConstructorType extends JSDocType { + type: JSDocType; + } + interface JSDocThisType extends JSDocType { + type: JSDocType; + } + type JSDocTypeReferencingNode = JSDocThisType | JSDocConstructorType | JSDocVariadicType | JSDocOptionalType | JSDocNullableType | JSDocNonNullableType; + interface JSDocRecordMember extends PropertySignature { + name: Identifier | LiteralExpression; + type?: JSDocType; + } + interface JSDocComment extends Node { + tags: NodeArray; + } + interface JSDocTag extends Node { + atToken: Node; + tagName: Identifier; + } + interface JSDocTemplateTag extends JSDocTag { + typeParameters: NodeArray; + } + interface JSDocReturnTag extends JSDocTag { + typeExpression: JSDocTypeExpression; + } + interface JSDocTypeTag extends JSDocTag { + typeExpression: JSDocTypeExpression; + } + interface JSDocParameterTag extends JSDocTag { + preParameterName?: Identifier; + typeExpression?: JSDocTypeExpression; + postParameterName?: Identifier; + isBracketed: boolean; + } + const enum FlowFlags { + Unreachable = 1, + Start = 2, + BranchLabel = 4, + LoopLabel = 8, + Assignment = 16, + TrueCondition = 32, + FalseCondition = 64, + Referenced = 128, + Shared = 256, + Label = 12, + Condition = 96, + } + interface FlowNode { + flags: FlowFlags; + id?: number; + } + interface FlowLabel extends FlowNode { + antecedents: FlowNode[]; + } + interface FlowAssignment extends FlowNode { + node: Expression | VariableDeclaration | BindingElement; + antecedent: FlowNode; + } + interface FlowCondition extends FlowNode { + expression: Expression; + antecedent: FlowNode; + } + interface AmdDependency { + path: string; + name: string; + } + interface SourceFile extends Declaration { + statements: NodeArray; + endOfFileToken: Node; + fileName: string; + path: Path; + text: string; + amdDependencies: AmdDependency[]; + moduleName: string; + referencedFiles: FileReference[]; + typeReferenceDirectives: FileReference[]; + languageVariant: LanguageVariant; + isDeclarationFile: boolean; + renamedDependencies?: Map; + hasNoDefaultLib: boolean; + languageVersion: ScriptTarget; + scriptKind: ScriptKind; + externalModuleIndicator: Node; + commonJsModuleIndicator: Node; + wasReferenced?: boolean; + identifiers: Map; + nodeCount: number; + identifierCount: number; + symbolCount: number; + parseDiagnostics: Diagnostic[]; + bindDiagnostics: Diagnostic[]; + lineMap: number[]; + classifiableNames?: Map; + resolvedModules: Map; + resolvedTypeReferenceDirectiveNames: Map; + imports: LiteralExpression[]; + moduleAugmentations: LiteralExpression[]; + } + interface ScriptReferenceHost { + getCompilerOptions(): CompilerOptions; + getSourceFile(fileName: string): SourceFile; + getSourceFileByPath(path: Path): SourceFile; + getCurrentDirectory(): string; + } + interface ParseConfigHost { + readDirectory(rootDir: string, extension: string, exclude: string[]): string[]; + } + interface WriteFileCallback { + (fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void, sourceFiles?: SourceFile[]): void; + } + class OperationCanceledException { + } + interface CancellationToken { + isCancellationRequested(): boolean; + throwIfCancellationRequested(): void; + } + interface Program extends ScriptReferenceHost { + getRootFileNames(): string[]; + getSourceFiles(): SourceFile[]; + emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback, cancellationToken?: CancellationToken): EmitResult; + getOptionsDiagnostics(cancellationToken?: CancellationToken): Diagnostic[]; + getGlobalDiagnostics(cancellationToken?: CancellationToken): Diagnostic[]; + getSyntacticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[]; + getSemanticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[]; + getDeclarationDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[]; + getTypeChecker(): TypeChecker; + getCommonSourceDirectory(): string; + getDiagnosticsProducingTypeChecker(): TypeChecker; + getClassifiableNames(): Map; + getNodeCount(): number; + getIdentifierCount(): number; + getSymbolCount(): number; + getTypeCount(): number; + getFileProcessingDiagnostics(): DiagnosticCollection; + getResolvedTypeReferenceDirectives(): Map; + structureIsReused?: boolean; + } + interface SourceMapSpan { + emittedLine: number; + emittedColumn: number; + sourceLine: number; + sourceColumn: number; + nameIndex?: number; + sourceIndex: number; + } + interface SourceMapData { + sourceMapFilePath: string; + jsSourceMappingURL: string; + sourceMapFile: string; + sourceMapSourceRoot: string; + sourceMapSources: string[]; + sourceMapSourcesContent?: string[]; + inputSourceFileNames: string[]; + sourceMapNames?: string[]; + sourceMapMappings: string; + sourceMapDecodedMappings: SourceMapSpan[]; + } + enum ExitStatus { + Success = 0, + DiagnosticsPresent_OutputsSkipped = 1, + DiagnosticsPresent_OutputsGenerated = 2, + } + interface EmitResult { + emitSkipped: boolean; + diagnostics: Diagnostic[]; + emittedFiles: string[]; + sourceMaps: SourceMapData[]; + } + interface TypeCheckerHost { + getCompilerOptions(): CompilerOptions; + getSourceFiles(): SourceFile[]; + getSourceFile(fileName: string): SourceFile; + getResolvedTypeReferenceDirectives(): Map; + } + interface TypeChecker { + getTypeOfSymbolAtLocation(symbol: Symbol, node: Node): Type; + getDeclaredTypeOfSymbol(symbol: Symbol): Type; + getPropertiesOfType(type: Type): Symbol[]; + getPropertyOfType(type: Type, propertyName: string): Symbol; + getSignaturesOfType(type: Type, kind: SignatureKind): Signature[]; + getIndexTypeOfType(type: Type, kind: IndexKind): Type; + getBaseTypes(type: InterfaceType): ObjectType[]; + getReturnTypeOfSignature(signature: Signature): Type; + getNonNullableType(type: Type): Type; + getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[]; + getSymbolAtLocation(node: Node): Symbol; + getSymbolsOfParameterPropertyDeclaration(parameter: ParameterDeclaration, parameterName: string): Symbol[]; + getShorthandAssignmentValueSymbol(location: Node): Symbol; + getExportSpecifierLocalTargetSymbol(location: ExportSpecifier): Symbol; + getPropertySymbolOfDestructuringAssignment(location: Identifier): Symbol; + getTypeAtLocation(node: Node): Type; + typeToString(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string; + symbolToString(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): string; + getSymbolDisplayBuilder(): SymbolDisplayBuilder; + getFullyQualifiedName(symbol: Symbol): string; + getAugmentedPropertiesOfType(type: Type): Symbol[]; + getRootSymbols(symbol: Symbol): Symbol[]; + getContextualType(node: Expression): Type; + getResolvedSignature(node: CallLikeExpression, candidatesOutArray?: Signature[]): Signature; + getSignatureFromDeclaration(declaration: SignatureDeclaration): Signature; + isImplementationOfOverload(node: FunctionLikeDeclaration): boolean; + isUndefinedSymbol(symbol: Symbol): boolean; + isArgumentsSymbol(symbol: Symbol): boolean; + isUnknownSymbol(symbol: Symbol): boolean; + getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number; + isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName, propertyName: string): boolean; + getAliasedSymbol(symbol: Symbol): Symbol; + getExportsOfModule(moduleSymbol: Symbol): Symbol[]; + getJsxElementAttributesType(elementNode: JsxOpeningLikeElement): Type; + getJsxIntrinsicTagNames(): Symbol[]; + isOptionalParameter(node: ParameterDeclaration): boolean; + getDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[]; + getGlobalDiagnostics(): Diagnostic[]; + getEmitResolver(sourceFile?: SourceFile, cancellationToken?: CancellationToken): EmitResolver; + getNodeCount(): number; + getIdentifierCount(): number; + getSymbolCount(): number; + getTypeCount(): number; + } + interface SymbolDisplayBuilder { + buildTypeDisplay(type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; + buildSymbolDisplay(symbol: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags): void; + buildSignatureDisplay(signatures: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags, kind?: SignatureKind): 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(thisType: Type, parameters: Symbol[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; + buildDisplayForTypeParametersAndDelimiters(typeParameters: TypeParameter[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; + buildReturnTypeDisplay(signature: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; + } + interface SymbolWriter { + writeKeyword(text: string): void; + writeOperator(text: string): void; + writePunctuation(text: string): void; + writeSpace(text: string): void; + writeStringLiteral(text: string): void; + writeParameter(text: string): void; + writeSymbol(text: string, symbol: Symbol): void; + writeLine(): void; + increaseIndent(): void; + decreaseIndent(): void; + clear(): void; + trackSymbol(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): void; + reportInaccessibleThisError(): void; + } + const enum TypeFormatFlags { + None = 0, + WriteArrayAsGenericType = 1, + UseTypeOfFunction = 2, + NoTruncation = 4, + WriteArrowStyleSignature = 8, + WriteOwnNameForAnyLike = 16, + WriteTypeArgumentsOfSignature = 32, + InElementType = 64, + UseFullyQualifiedType = 128, + InFirstTypeArgument = 256, + } + const enum SymbolFormatFlags { + None = 0, + WriteTypeParametersOrArguments = 1, + UseOnlyExternalAliasing = 2, + } + const enum SymbolAccessibility { + Accessible = 0, + NotAccessible = 1, + CannotBeNamed = 2, + } + const enum TypePredicateKind { + This = 0, + Identifier = 1, + } + interface TypePredicateBase { + kind: TypePredicateKind; + type: Type; + } + interface ThisTypePredicate extends TypePredicateBase { + _thisTypePredicateBrand: any; + } + interface IdentifierTypePredicate extends TypePredicateBase { + parameterName: string; + parameterIndex: number; + } + type TypePredicate = IdentifierTypePredicate | ThisTypePredicate; + type AnyImportSyntax = ImportDeclaration | ImportEqualsDeclaration; + interface SymbolVisibilityResult { + accessibility: SymbolAccessibility; + aliasesToMakeVisible?: AnyImportSyntax[]; + errorSymbolName?: string; + errorNode?: Node; + } + interface SymbolAccessibilityResult extends SymbolVisibilityResult { + errorModuleName?: string; + } + enum TypeReferenceSerializationKind { + Unknown = 0, + TypeWithConstructSignatureAndValue = 1, + VoidType = 2, + NumberLikeType = 3, + StringLikeType = 4, + BooleanType = 5, + ArrayLikeType = 6, + ESSymbolType = 7, + TypeWithCallSignature = 8, + ObjectType = 9, + } + interface EmitResolver { + hasGlobalName(name: string): boolean; + getReferencedExportContainer(node: Identifier): SourceFile | ModuleDeclaration | EnumDeclaration; + getReferencedImportDeclaration(node: Identifier): Declaration; + getReferencedDeclarationWithCollidingName(node: Identifier): Declaration; + isDeclarationWithCollidingName(node: Declaration): boolean; + isValueAliasDeclaration(node: Node): boolean; + isReferencedAliasDeclaration(node: Node, checkChildren?: boolean): boolean; + isTopLevelValueImportEqualsWithEntityName(node: ImportEqualsDeclaration): boolean; + getNodeCheckFlags(node: Node): NodeCheckFlags; + isDeclarationVisible(node: Declaration): boolean; + collectLinkedAliases(node: Identifier): Node[]; + isImplementationOfOverload(node: FunctionLikeDeclaration): boolean; + writeTypeOfDeclaration(declaration: AccessorDeclaration | VariableLikeDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void; + writeReturnTypeOfSignatureDeclaration(signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void; + writeTypeOfExpression(expr: Expression, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void; + writeBaseConstructorTypeOfClass(node: ClassLikeDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void; + isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessibilityResult; + isEntityNameVisible(entityName: EntityName | Expression, enclosingDeclaration: Node): SymbolVisibilityResult; + getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number; + getReferencedValueDeclaration(reference: Identifier): Declaration; + getTypeReferenceSerializationKind(typeName: EntityName): TypeReferenceSerializationKind; + isOptionalParameter(node: ParameterDeclaration): boolean; + moduleExportsSomeValue(moduleReferenceExpression: Expression): boolean; + isArgumentsLocalBinding(node: Identifier): boolean; + getExternalModuleFileFromDeclaration(declaration: ImportEqualsDeclaration | ImportDeclaration | ExportDeclaration | ModuleDeclaration): SourceFile; + getTypeReferenceDirectivesForEntityName(name: EntityName | PropertyAccessExpression): string[]; + getTypeReferenceDirectivesForSymbol(symbol: Symbol, meaning?: SymbolFlags): string[]; + } + const enum SymbolFlags { + None = 0, + FunctionScopedVariable = 1, + BlockScopedVariable = 2, + Property = 4, + EnumMember = 8, + Function = 16, + Class = 32, + Interface = 64, + ConstEnum = 128, + RegularEnum = 256, + ValueModule = 512, + NamespaceModule = 1024, + TypeLiteral = 2048, + ObjectLiteral = 4096, + Method = 8192, + Constructor = 16384, + GetAccessor = 32768, + SetAccessor = 65536, + Signature = 131072, + TypeParameter = 262144, + TypeAlias = 524288, + ExportValue = 1048576, + ExportType = 2097152, + ExportNamespace = 4194304, + Alias = 8388608, + Instantiated = 16777216, + Merged = 33554432, + Transient = 67108864, + Prototype = 134217728, + SyntheticProperty = 268435456, + Optional = 536870912, + ExportStar = 1073741824, + Enum = 384, + Variable = 3, + Value = 107455, + Type = 793056, + Namespace = 1536, + Module = 1536, + Accessor = 98304, + FunctionScopedVariableExcludes = 107454, + BlockScopedVariableExcludes = 107455, + ParameterExcludes = 107455, + PropertyExcludes = 107455, + EnumMemberExcludes = 107455, + FunctionExcludes = 106927, + ClassExcludes = 899519, + InterfaceExcludes = 792960, + RegularEnumExcludes = 899327, + ConstEnumExcludes = 899967, + ValueModuleExcludes = 106639, + NamespaceModuleExcludes = 0, + MethodExcludes = 99263, + GetAccessorExcludes = 41919, + SetAccessorExcludes = 74687, + TypeParameterExcludes = 530912, + TypeAliasExcludes = 793056, + AliasExcludes = 8388608, + ModuleMember = 8914931, + ExportHasLocal = 944, + HasExports = 1952, + HasMembers = 6240, + BlockScoped = 418, + PropertyOrAccessor = 98308, + Export = 7340032, + Classifiable = 788448, + } + interface Symbol { + flags: SymbolFlags; + name: string; + declarations?: Declaration[]; + valueDeclaration?: Declaration; + members?: SymbolTable; + exports?: SymbolTable; + globalExports?: SymbolTable; + id?: number; + mergeId?: number; + parent?: Symbol; + exportSymbol?: Symbol; + constEnumOnlyModule?: boolean; + } + interface SymbolLinks { + target?: Symbol; + type?: Type; + declaredType?: Type; + typeParameters?: TypeParameter[]; + inferredClassType?: Type; + instantiations?: Map; + mapper?: TypeMapper; + referenced?: boolean; + containingType?: UnionOrIntersectionType; + resolvedExports?: SymbolTable; + exportsChecked?: boolean; + isDeclarationWithCollidingName?: boolean; + bindingElement?: BindingElement; + exportsSomeValue?: boolean; + } + interface TransientSymbol extends Symbol, SymbolLinks { + } + interface SymbolTable { + [index: string]: Symbol; + } + const enum NodeCheckFlags { + TypeChecked = 1, + LexicalThis = 2, + CaptureThis = 4, + SuperInstance = 256, + SuperStatic = 512, + ContextChecked = 1024, + AsyncMethodWithSuper = 2048, + AsyncMethodWithSuperBinding = 4096, + CaptureArguments = 8192, + EnumValuesComputed = 16384, + LexicalModuleMergesWithClass = 32768, + LoopWithCapturedBlockScopedBinding = 65536, + CapturedBlockScopedBinding = 131072, + BlockScopedBindingInLoop = 262144, + ClassWithBodyScopedClassBinding = 524288, + BodyScopedClassBinding = 1048576, + NeedsLoopOutParameter = 2097152, + } + interface NodeLinks { + resolvedType?: Type; + resolvedSignature?: Signature; + resolvedSymbol?: Symbol; + resolvedIndexInfo?: IndexInfo; + flags?: NodeCheckFlags; + enumMemberValue?: number; + isVisible?: boolean; + hasReportedStatementInAmbientContext?: boolean; + jsxFlags?: JsxFlags; + resolvedJsxType?: Type; + hasSuperCall?: boolean; + superCall?: ExpressionStatement; + } + const enum TypeFlags { + Any = 1, + String = 2, + Number = 4, + Boolean = 8, + Void = 16, + Undefined = 32, + Null = 64, + Enum = 128, + StringLiteral = 256, + TypeParameter = 512, + Class = 1024, + Interface = 2048, + Reference = 4096, + Tuple = 8192, + Union = 16384, + Intersection = 32768, + Anonymous = 65536, + Instantiated = 131072, + FromSignature = 262144, + ObjectLiteral = 524288, + FreshObjectLiteral = 1048576, + ContainsUndefinedOrNull = 2097152, + ContainsObjectLiteral = 4194304, + ContainsAnyFunctionType = 8388608, + ESSymbol = 16777216, + ThisType = 33554432, + ObjectLiteralPatternWithComputedProperties = 67108864, + Never = 134217728, + Nullable = 96, + Intrinsic = 150995071, + Primitive = 16777726, + StringLike = 258, + NumberLike = 132, + ObjectType = 80896, + UnionOrIntersection = 49152, + StructuredType = 130048, + Narrowable = 97793, + RequiresWidening = 6291456, + PropagatingFlags = 14680064, + } + type DestructuringPattern = BindingPattern | ObjectLiteralExpression | ArrayLiteralExpression; + interface Type { + flags: TypeFlags; + id: number; + symbol?: Symbol; + pattern?: DestructuringPattern; + } + interface IntrinsicType extends Type { + intrinsicName: string; + } + interface StringLiteralType extends Type { + text: string; + } + interface ObjectType extends Type { + } + interface InterfaceType extends ObjectType { + typeParameters: TypeParameter[]; + outerTypeParameters: TypeParameter[]; + localTypeParameters: TypeParameter[]; + thisType: TypeParameter; + resolvedBaseConstructorType?: Type; + resolvedBaseTypes: ObjectType[]; + } + interface InterfaceTypeWithDeclaredMembers extends InterfaceType { + declaredProperties: Symbol[]; + declaredCallSignatures: Signature[]; + declaredConstructSignatures: Signature[]; + declaredStringIndexInfo: IndexInfo; + declaredNumberIndexInfo: IndexInfo; + } + interface TypeReference extends ObjectType { + target: GenericType; + typeArguments: Type[]; + } + interface GenericType extends InterfaceType, TypeReference { + instantiations: Map; + } + interface TupleType extends ObjectType { + elementTypes: Type[]; + } + interface UnionOrIntersectionType extends Type { + types: Type[]; + reducedType: Type; + resolvedProperties: SymbolTable; + } + interface UnionType extends UnionOrIntersectionType { + } + interface IntersectionType extends UnionOrIntersectionType { + } + interface AnonymousType extends ObjectType { + target?: AnonymousType; + mapper?: TypeMapper; + } + interface ResolvedType extends ObjectType, UnionOrIntersectionType { + members: SymbolTable; + properties: Symbol[]; + callSignatures: Signature[]; + constructSignatures: Signature[]; + stringIndexInfo?: IndexInfo; + numberIndexInfo?: IndexInfo; + } + interface FreshObjectLiteralType extends ResolvedType { + regularType: ResolvedType; + } + interface IterableOrIteratorType extends ObjectType, UnionType { + iterableElementType?: Type; + iteratorElementType?: Type; + } + interface TypeParameter extends Type { + constraint: Type; + target?: TypeParameter; + mapper?: TypeMapper; + resolvedApparentType: Type; + } + const enum SignatureKind { + Call = 0, + Construct = 1, + } + interface Signature { + declaration: SignatureDeclaration; + typeParameters: TypeParameter[]; + parameters: Symbol[]; + thisType?: Type; + resolvedReturnType: Type; + minArgumentCount: number; + hasRestParameter: boolean; + hasStringLiterals: boolean; + target?: Signature; + mapper?: TypeMapper; + unionSignatures?: Signature[]; + erasedSignatureCache?: Signature; + isolatedSignatureType?: ObjectType; + typePredicate?: TypePredicate; + } + const enum IndexKind { + String = 0, + Number = 1, + } + interface IndexInfo { + type: Type; + isReadonly: boolean; + declaration?: SignatureDeclaration; + } + interface TypeMapper { + (t: TypeParameter): Type; + mappedTypes?: Type[]; + instantiations?: Type[]; + context?: InferenceContext; + } + interface TypeInferences { + primary: Type[]; + secondary: Type[]; + isFixed: boolean; + } + interface InferenceContext { + typeParameters: TypeParameter[]; + inferUnionTypes: boolean; + inferences: TypeInferences[]; + inferredTypes: Type[]; + mapper?: TypeMapper; + failedTypeParameterIndex?: number; + } + const enum SpecialPropertyAssignmentKind { + None = 0, + ExportsProperty = 1, + ModuleExports = 2, + PrototypeProperty = 3, + ThisProperty = 4, + } + interface DiagnosticMessage { + key: string; + category: DiagnosticCategory; + code: number; + message: string; + } + interface DiagnosticMessageChain { + messageText: string; + category: DiagnosticCategory; + code: number; + next?: DiagnosticMessageChain; + } + interface Diagnostic { + file: SourceFile; + start: number; + length: number; + messageText: string | DiagnosticMessageChain; + category: DiagnosticCategory; + code: number; + } + enum DiagnosticCategory { + Warning = 0, + Error = 1, + Message = 2, + } + enum ModuleResolutionKind { + Classic = 1, + NodeJs = 2, + } + type RootPaths = string[]; + type PathSubstitutions = Map; + type TsConfigOnlyOptions = RootPaths | PathSubstitutions; + type CompilerOptionsValue = string | number | boolean | (string | number)[] | TsConfigOnlyOptions; + interface CompilerOptions { + allowNonTsExtensions?: boolean; + charset?: string; + declaration?: boolean; + declarationDir?: string; + diagnostics?: boolean; + emitBOM?: boolean; + help?: boolean; + init?: boolean; + inlineSourceMap?: boolean; + inlineSources?: boolean; + jsx?: JsxEmit; + reactNamespace?: string; + listFiles?: boolean; + typesSearchPaths?: string[]; + locale?: string; + mapRoot?: string; + module?: ModuleKind; + newLine?: NewLineKind; + noEmit?: boolean; + noEmitHelpers?: boolean; + noEmitOnError?: boolean; + noErrorTruncation?: boolean; + noImplicitAny?: boolean; + noImplicitThis?: boolean; + noLib?: boolean; + noResolve?: boolean; + out?: string; + outFile?: string; + outDir?: string; + preserveConstEnums?: boolean; + pretty?: DiagnosticStyle; + project?: string; + removeComments?: boolean; + rootDir?: string; + sourceMap?: boolean; + sourceRoot?: string; + suppressExcessPropertyErrors?: boolean; + suppressImplicitAnyIndexErrors?: boolean; + target?: ScriptTarget; + version?: boolean; + watch?: boolean; + isolatedModules?: boolean; + experimentalDecorators?: boolean; + emitDecoratorMetadata?: boolean; + moduleResolution?: ModuleResolutionKind; + allowUnusedLabels?: boolean; + allowUnreachableCode?: boolean; + noImplicitReturns?: boolean; + noFallthroughCasesInSwitch?: boolean; + forceConsistentCasingInFileNames?: boolean; + baseUrl?: string; + paths?: PathSubstitutions; + rootDirs?: RootPaths; + traceResolution?: boolean; + allowSyntheticDefaultImports?: boolean; + allowJs?: boolean; + noImplicitUseStrict?: boolean; + strictNullChecks?: boolean; + listEmittedFiles?: boolean; + lib?: string[]; + stripInternal?: boolean; + skipDefaultLibCheck?: boolean; + suppressOutputPathCheck?: boolean; + configFilePath?: string; + typesRoot?: string; + types?: string[]; + list?: string[]; + [option: string]: CompilerOptionsValue | undefined; + } + interface TypingOptions { + enableAutoDiscovery?: boolean; + include?: string[]; + exclude?: string[]; + [option: string]: string[] | boolean | undefined; + } + interface DiscoverTypingsInfo { + fileNames: string[]; + projectRootPath: string; + safeListPath: string; + packageNameToTypingLocation: Map; + typingOptions: TypingOptions; + compilerOptions: CompilerOptions; + } + enum ModuleKind { + None = 0, + CommonJS = 1, + AMD = 2, + UMD = 3, + System = 4, + ES6 = 5, + ES2015 = 5, + } + const enum JsxEmit { + None = 0, + Preserve = 1, + React = 2, + } + const enum NewLineKind { + CarriageReturnLineFeed = 0, + LineFeed = 1, + } + interface LineAndCharacter { + line: number; + character: number; + } + const enum ScriptKind { + Unknown = 0, + JS = 1, + JSX = 2, + TS = 3, + TSX = 4, + } + const enum ScriptTarget { + ES3 = 0, + ES5 = 1, + ES6 = 2, + ES2015 = 2, + Latest = 2, + } + const enum LanguageVariant { + Standard = 0, + JSX = 1, + } + const enum DiagnosticStyle { + Simple = 0, + Pretty = 1, + } + interface ParsedCommandLine { + options: CompilerOptions; + typingOptions?: TypingOptions; + fileNames: string[]; + raw?: any; + errors: Diagnostic[]; + } + interface CommandLineOptionBase { + name: string; + type: "string" | "number" | "boolean" | "object" | "list" | Map; + isFilePath?: boolean; + shortName?: string; + description?: DiagnosticMessage; + paramType?: DiagnosticMessage; + experimental?: boolean; + isTSConfigOnly?: boolean; + } + interface CommandLineOptionOfPrimitiveType extends CommandLineOptionBase { + type: "string" | "number" | "boolean"; + } + interface CommandLineOptionOfCustomType extends CommandLineOptionBase { + type: Map; + } + interface TsConfigOnlyOption extends CommandLineOptionBase { + type: "object"; + } + interface CommandLineOptionOfListType extends CommandLineOptionBase { + type: "list"; + element: CommandLineOptionOfCustomType | CommandLineOptionOfPrimitiveType; + } + type CommandLineOption = CommandLineOptionOfCustomType | CommandLineOptionOfPrimitiveType | TsConfigOnlyOption | CommandLineOptionOfListType; + const enum CharacterCodes { + nullCharacter = 0, + maxAsciiCharacter = 127, + lineFeed = 10, + carriageReturn = 13, + lineSeparator = 8232, + paragraphSeparator = 8233, + nextLine = 133, + space = 32, + nonBreakingSpace = 160, + enQuad = 8192, + emQuad = 8193, + enSpace = 8194, + emSpace = 8195, + threePerEmSpace = 8196, + fourPerEmSpace = 8197, + sixPerEmSpace = 8198, + figureSpace = 8199, + punctuationSpace = 8200, + thinSpace = 8201, + hairSpace = 8202, + zeroWidthSpace = 8203, + narrowNoBreakSpace = 8239, + ideographicSpace = 12288, + mathematicalSpace = 8287, + ogham = 5760, + _ = 95, + $ = 36, + _0 = 48, + _1 = 49, + _2 = 50, + _3 = 51, + _4 = 52, + _5 = 53, + _6 = 54, + _7 = 55, + _8 = 56, + _9 = 57, + a = 97, + b = 98, + c = 99, + d = 100, + e = 101, + f = 102, + g = 103, + h = 104, + i = 105, + j = 106, + k = 107, + l = 108, + m = 109, + n = 110, + o = 111, + p = 112, + q = 113, + r = 114, + s = 115, + t = 116, + u = 117, + v = 118, + w = 119, + x = 120, + y = 121, + z = 122, + A = 65, + B = 66, + C = 67, + D = 68, + E = 69, + F = 70, + G = 71, + H = 72, + I = 73, + J = 74, + K = 75, + L = 76, + M = 77, + N = 78, + O = 79, + P = 80, + Q = 81, + R = 82, + S = 83, + T = 84, + U = 85, + V = 86, + W = 87, + X = 88, + Y = 89, + Z = 90, + ampersand = 38, + asterisk = 42, + at = 64, + backslash = 92, + backtick = 96, + bar = 124, + caret = 94, + closeBrace = 125, + closeBracket = 93, + closeParen = 41, + colon = 58, + comma = 44, + dot = 46, + doubleQuote = 34, + equals = 61, + exclamation = 33, + greaterThan = 62, + hash = 35, + lessThan = 60, + minus = 45, + openBrace = 123, + openBracket = 91, + openParen = 40, + percent = 37, + plus = 43, + question = 63, + semicolon = 59, + singleQuote = 39, + slash = 47, + tilde = 126, + backspace = 8, + formFeed = 12, + byteOrderMark = 65279, + tab = 9, + verticalTab = 11, + } + interface ModuleResolutionHost { + fileExists(fileName: string): boolean; + readFile(fileName: string): string; + trace?(s: string): void; + directoryExists?(directoryName: string): boolean; + realpath?(path: string): string; + } + interface ResolvedModule { + resolvedFileName: string; + isExternalLibraryImport?: boolean; + } + interface ResolvedModuleWithFailedLookupLocations { + resolvedModule: ResolvedModule; + failedLookupLocations: string[]; + } + interface ResolvedTypeReferenceDirective { + primary: boolean; + resolvedFileName?: string; + } + interface ResolvedTypeReferenceDirectiveWithFailedLookupLocations { + resolvedTypeReferenceDirective: ResolvedTypeReferenceDirective; + failedLookupLocations: string[]; + } + interface CompilerHost extends ModuleResolutionHost { + getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile; + getSourceFileByPath?(fileName: string, path: Path, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile; + getCancellationToken?(): CancellationToken; + getDefaultLibFileName(options: CompilerOptions): string; + getDefaultLibLocation?(): string; + writeFile: WriteFileCallback; + getCurrentDirectory(): string; + getCanonicalFileName(fileName: string): string; + useCaseSensitiveFileNames(): boolean; + getNewLine(): string; + resolveModuleNames?(moduleNames: string[], containingFile: string): ResolvedModule[]; + resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[], containingFile: string): ResolvedTypeReferenceDirective[]; + } + interface TextSpan { + start: number; + length: number; + } + interface TextChangeRange { + span: TextSpan; + newLength: number; + } + interface DiagnosticCollection { + add(diagnostic: Diagnostic): void; + getGlobalDiagnostics(): Diagnostic[]; + getDiagnostics(fileName?: string): Diagnostic[]; + getModificationCount(): number; + reattachFileDiagnostics(newFile: SourceFile): void; + } +} +declare namespace ts { + const enum Ternary { + False = 0, + Maybe = 1, + True = -1, + } + function createFileMap(keyMapper?: (key: string) => string): FileMap; + function toPath(fileName: string, basePath: string, getCanonicalFileName: (path: string) => string): Path; + const enum Comparison { + LessThan = -1, + EqualTo = 0, + GreaterThan = 1, + } + function forEach(array: T[], callback: (element: T, index: number) => U): U; + function contains(array: T[], value: T, areEqual?: (a: T, b: T) => boolean): boolean; + function indexOf(array: T[], value: T): number; + function countWhere(array: T[], predicate: (x: T) => boolean): number; + function filter(array: T[], f: (x: T) => boolean): T[]; + function map(array: T[], f: (x: T) => U): U[]; + function concatenate(array1: T[], array2: T[]): T[]; + function deduplicate(array: T[], areEqual?: (a: T, b: T) => boolean): T[]; + function sum(array: any[], prop: string): number; + function addRange(to: T[], from: T[]): void; + function rangeEquals(array1: T[], array2: T[], pos: number, end: number): boolean; + function lastOrUndefined(array: T[]): T; + function binarySearch(array: number[], value: number): number; + function reduceLeft(array: T[], f: (a: T, x: T) => T): T; + function reduceLeft(array: T[], f: (a: U, x: T) => U, initial: U): U; + function reduceRight(array: T[], f: (a: T, x: T) => T): T; + function reduceRight(array: T[], f: (a: U, x: T) => U, initial: U): U; + function hasProperty(map: Map, key: string): boolean; + function getKeys(map: Map): string[]; + function getProperty(map: Map, key: string): T; + function isEmpty(map: Map): boolean; + function clone(object: T): T; + function extend, T2 extends Map<{}>>(first: T1, second: T2): T1 & T2; + function forEachValue(map: Map, callback: (value: T) => U): U; + function forEachKey(map: Map, callback: (key: string) => U): U; + function lookUp(map: Map, key: string): T; + function copyMap(source: Map, target: Map): void; + function arrayToMap(array: T[], makeKey: (value: T) => string): Map; + function reduceProperties(map: Map, callback: (aggregate: U, value: T, key: string) => U, initial: U): U; + function isArray(value: any): value is any[]; + function memoize(callback: () => T): () => T; + let localizedDiagnosticMessages: Map; + function getLocaleSpecificMessage(message: DiagnosticMessage): string; + function createFileDiagnostic(file: SourceFile, start: number, length: number, message: DiagnosticMessage, ...args: any[]): Diagnostic; + function formatMessage(dummy: any, message: DiagnosticMessage): string; + function createCompilerDiagnostic(message: DiagnosticMessage, ...args: any[]): Diagnostic; + function chainDiagnosticMessages(details: DiagnosticMessageChain, message: DiagnosticMessage, ...args: any[]): DiagnosticMessageChain; + function concatenateDiagnosticMessageChains(headChain: DiagnosticMessageChain, tailChain: DiagnosticMessageChain): DiagnosticMessageChain; + function compareValues(a: T, b: T): Comparison; + function compareDiagnostics(d1: Diagnostic, d2: Diagnostic): Comparison; + function sortAndDeduplicateDiagnostics(diagnostics: Diagnostic[]): Diagnostic[]; + function deduplicateSortedDiagnostics(diagnostics: Diagnostic[]): Diagnostic[]; + function normalizeSlashes(path: string): string; + function getRootLength(path: string): number; + let directorySeparator: string; + function normalizePath(path: string): string; + function getDirectoryPath(path: Path): Path; + function getDirectoryPath(path: string): string; + function isUrl(path: string): boolean; + function isRootedDiskPath(path: string): boolean; + function getNormalizedPathComponents(path: string, currentDirectory: string): string[]; + function getNormalizedAbsolutePath(fileName: string, currentDirectory: string): string; + function getNormalizedPathFromPathComponents(pathComponents: string[]): string; + function getRelativePathToDirectoryOrUrl(directoryPathOrUrl: string, relativeOrAbsolutePath: string, currentDirectory: string, getCanonicalFileName: (fileName: string) => string, isAbsolutePathAnUrl: boolean): string; + function getBaseFileName(path: string): string; + function combinePaths(path1: string, path2: string): string; + function fileExtensionIs(path: string, extension: string): boolean; + function ensureScriptKind(fileName: string, scriptKind?: ScriptKind): ScriptKind; + function getScriptKindFromFileName(fileName: string): ScriptKind; + const supportedTypeScriptExtensions: string[]; + const supportedJavascriptExtensions: string[]; + function getSupportedExtensions(options?: CompilerOptions): string[]; + function isSupportedSourceFileName(fileName: string, compilerOptions?: CompilerOptions): boolean; + function removeFileExtension(path: string): string; + interface ObjectAllocator { + getNodeConstructor(): new (kind: SyntaxKind, pos?: number, end?: number) => Node; + getSourceFileConstructor(): new (kind: SyntaxKind, pos?: number, end?: number) => SourceFile; + getSymbolConstructor(): new (flags: SymbolFlags, name: string) => Symbol; + getTypeConstructor(): new (checker: TypeChecker, flags: TypeFlags) => Type; + getSignatureConstructor(): new (checker: TypeChecker) => Signature; + } + let objectAllocator: ObjectAllocator; + const enum AssertionLevel { + None = 0, + Normal = 1, + Aggressive = 2, + VeryAggressive = 3, + } + namespace Debug { + function shouldAssert(level: AssertionLevel): boolean; + function assert(expression: boolean, message?: string, verboseDebugInfo?: () => string): void; + function fail(message?: string): void; + } + function copyListRemovingItem(item: T, list: T[]): T[]; + function createGetCanonicalFileName(useCaseSensitivefileNames: boolean): (fileName: string) => string; +} +declare namespace ts { + type FileWatcherCallback = (fileName: string, removed?: boolean) => void; + type DirectoryWatcherCallback = (directoryName: string) => void; + interface WatchedFile { + fileName: string; + callback: FileWatcherCallback; + mtime?: Date; + } + interface System { + args: string[]; + newLine: string; + useCaseSensitiveFileNames: boolean; + write(s: string): void; + readFile(path: string, encoding?: string): string; + writeFile(path: string, data: string, writeByteOrderMark?: boolean): void; + watchFile?(path: string, callback: FileWatcherCallback): FileWatcher; + watchDirectory?(path: string, callback: DirectoryWatcherCallback, recursive?: boolean): FileWatcher; + resolvePath(path: string): string; + fileExists(path: string): boolean; + directoryExists(path: string): boolean; + createDirectory(path: string): void; + getExecutingFilePath(): string; + getCurrentDirectory(): string; + readDirectory(path: string, extension?: string, exclude?: string[]): string[]; + getModifiedTime?(path: string): Date; + createHash?(data: string): string; + getMemoryUsage?(): number; + exit(exitCode?: number): void; + realpath?(path: string): string; + } + interface FileWatcher { + close(): void; + } + interface DirectoryWatcher extends FileWatcher { + directoryName: string; + referenceCount: number; + } + var sys: System; +} +declare namespace ts { + var Diagnostics: { + Unterminated_string_literal: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Identifier_expected: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + _0_expected: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + A_file_cannot_have_a_reference_to_itself: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Trailing_comma_not_allowed: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Asterisk_Slash_expected: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Unexpected_token: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + A_rest_parameter_must_be_last_in_a_parameter_list: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Parameter_cannot_have_question_mark_and_initializer: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + A_required_parameter_cannot_follow_an_optional_parameter: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + An_index_signature_cannot_have_a_rest_parameter: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + An_index_signature_parameter_cannot_have_an_accessibility_modifier: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + An_index_signature_parameter_cannot_have_a_question_mark: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + An_index_signature_parameter_cannot_have_an_initializer: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + An_index_signature_must_have_a_type_annotation: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + An_index_signature_parameter_must_have_a_type_annotation: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + An_index_signature_parameter_type_must_be_string_or_number: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Accessibility_modifier_already_seen: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + _0_modifier_must_precede_1_modifier: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + _0_modifier_already_seen: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + _0_modifier_cannot_appear_on_a_class_element: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + super_must_be_followed_by_an_argument_list_or_member_access: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Only_ambient_modules_can_use_quoted_names: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Statements_are_not_allowed_in_ambient_contexts: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + A_declare_modifier_cannot_be_used_in_an_already_ambient_context: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Initializers_are_not_allowed_in_ambient_contexts: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + _0_modifier_cannot_be_used_in_an_ambient_context: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + _0_modifier_cannot_be_used_with_a_class_declaration: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + _0_modifier_cannot_be_used_here: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + _0_modifier_cannot_appear_on_a_data_property: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + _0_modifier_cannot_appear_on_a_module_or_namespace_element: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + A_0_modifier_cannot_be_used_with_an_interface_declaration: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + A_rest_parameter_cannot_be_optional: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + A_rest_parameter_cannot_have_an_initializer: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + A_set_accessor_must_have_exactly_one_parameter: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + A_set_accessor_cannot_have_an_optional_parameter: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + A_set_accessor_parameter_cannot_have_an_initializer: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + A_set_accessor_cannot_have_rest_parameter: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + A_get_accessor_cannot_have_parameters: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Type_0_is_not_a_valid_async_function_return_type: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + An_async_function_or_method_must_have_a_valid_awaitable_return_type: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Operand_for_await_does_not_have_a_valid_callable_then_member: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Return_expression_in_async_function_does_not_have_a_valid_callable_then_member: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Expression_body_for_async_arrow_function_does_not_have_a_valid_callable_then_member: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Enum_member_must_have_initializer: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + _0_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + An_export_assignment_cannot_be_used_in_a_namespace: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + In_ambient_enum_declarations_member_initializer_must_be_constant_expression: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Unexpected_token_A_constructor_method_accessor_or_property_was_expected: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + _0_modifier_cannot_appear_on_a_type_member: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + _0_modifier_cannot_appear_on_an_index_signature: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + A_0_modifier_cannot_be_used_with_an_import_declaration: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Invalid_reference_directive_syntax: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + An_accessor_cannot_be_declared_in_an_ambient_context: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + _0_modifier_cannot_appear_on_a_constructor_declaration: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + _0_modifier_cannot_appear_on_a_parameter: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Type_parameters_cannot_appear_on_a_constructor_declaration: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Type_annotation_cannot_appear_on_a_constructor_declaration: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + An_accessor_cannot_have_type_parameters: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + A_set_accessor_cannot_have_a_return_type_annotation: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + An_index_signature_must_have_exactly_one_parameter: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + _0_list_cannot_be_empty: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Type_parameter_list_cannot_be_empty: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Type_argument_list_cannot_be_empty: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Invalid_use_of_0_in_strict_mode: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + with_statements_are_not_allowed_in_strict_mode: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + delete_cannot_be_called_on_an_identifier_in_strict_mode: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Jump_target_cannot_cross_function_boundary: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + A_return_statement_can_only_be_used_within_a_function_body: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Expression_expected: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Type_expected: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + A_default_clause_cannot_appear_more_than_once_in_a_switch_statement: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Duplicate_label_0: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + An_object_literal_cannot_have_property_and_accessor_with_the_same_name: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + An_export_assignment_cannot_have_modifiers: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Octal_literals_are_not_allowed_in_strict_mode: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + A_tuple_type_element_list_cannot_be_empty: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Variable_declaration_list_cannot_be_empty: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Digit_expected: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Hexadecimal_digit_expected: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Unexpected_end_of_text: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Invalid_character: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Declaration_or_statement_expected: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Statement_expected: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + case_or_default_expected: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Property_or_signature_expected: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Enum_member_expected: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Variable_declaration_expected: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Argument_expression_expected: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Property_assignment_expected: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Expression_or_comma_expected: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Parameter_declaration_expected: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Type_parameter_declaration_expected: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Type_argument_expected: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + String_literal_expected: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Line_break_not_permitted_here: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + or_expected: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Declaration_expected: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Import_declarations_in_a_namespace_cannot_reference_a_module: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Cannot_compile_modules_unless_the_module_flag_is_provided_with_a_valid_module_type_Consider_setting_the_module_compiler_option_in_a_tsconfig_json_file: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + File_name_0_differs_from_already_included_file_name_1_only_in_casing: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + const_declarations_must_be_initialized: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + const_declarations_can_only_be_declared_inside_a_block: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + let_declarations_can_only_be_declared_inside_a_block: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Unterminated_template_literal: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Unterminated_regular_expression_literal: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + An_object_member_cannot_be_declared_optional: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + A_yield_expression_is_only_allowed_in_a_generator_body: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Computed_property_names_are_not_allowed_in_enums: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_symbol: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + A_comma_expression_is_not_allowed_in_a_computed_property_name: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + extends_clause_already_seen: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + extends_clause_must_precede_implements_clause: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Classes_can_only_extend_a_single_class: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + implements_clause_already_seen: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Interface_declaration_cannot_have_implements_clause: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Binary_digit_expected: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Octal_digit_expected: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Unexpected_token_expected: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Property_destructuring_pattern_expected: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Array_element_destructuring_pattern_expected: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + A_destructuring_declaration_must_have_an_initializer: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + An_implementation_cannot_be_declared_in_ambient_contexts: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Modifiers_cannot_appear_here: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Merge_conflict_marker_encountered: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + A_rest_element_cannot_have_an_initializer: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + A_parameter_property_may_not_be_a_binding_pattern: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + An_import_declaration_cannot_have_modifiers: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Module_0_has_no_default_export: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + An_export_declaration_cannot_have_modifiers: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Export_declarations_are_not_permitted_in_a_namespace: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Catch_clause_variable_name_must_be_an_identifier: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Catch_clause_variable_cannot_have_a_type_annotation: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Catch_clause_variable_cannot_have_an_initializer: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Unterminated_Unicode_escape_sequence: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Line_terminator_not_permitted_before_arrow: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Import_assignment_cannot_be_used_when_targeting_ECMAScript_6_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Export_assignment_cannot_be_used_when_targeting_ECMAScript_6_modules_Consider_using_export_default_or_another_module_format_instead: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Cannot_compile_modules_into_es2015_when_targeting_ES5_or_lower: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Decorators_are_not_valid_here: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Ambient_const_enums_are_not_allowed_when_the_isolatedModules_flag_is_provided: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + A_class_declaration_without_the_default_modifier_must_have_a_name: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Identifier_expected_0_is_a_reserved_word_in_strict_mode: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Invalid_use_of_0_Modules_are_automatically_in_strict_mode: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Export_assignment_is_not_supported_when_module_flag_is_system: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Generators_are_only_available_when_targeting_ECMAScript_6_or_higher: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Generators_are_not_allowed_in_an_ambient_context: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + An_overload_signature_cannot_be_declared_as_a_generator: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + _0_tag_already_specified: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Signature_0_must_have_a_type_predicate: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Cannot_find_parameter_0: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Type_predicate_0_is_not_assignable_to_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Parameter_0_is_not_in_the_same_position_as_parameter_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + A_type_predicate_is_only_allowed_in_return_type_position_for_functions_and_methods: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + A_type_predicate_cannot_reference_a_rest_parameter: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + A_type_predicate_cannot_reference_element_0_in_a_binding_pattern: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + An_export_assignment_can_only_be_used_in_a_module: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + An_import_declaration_can_only_be_used_in_a_namespace_or_module: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + An_export_declaration_can_only_be_used_in_a_module: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + A_namespace_declaration_is_only_allowed_in_a_namespace_or_module: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + The_return_type_of_a_property_decorator_function_must_be_either_void_or_any: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + _0_modifier_cannot_be_used_with_1_modifier: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Abstract_methods_can_only_appear_within_an_abstract_class: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Method_0_cannot_have_an_implementation_because_it_is_marked_abstract: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + An_interface_property_cannot_have_an_initializer: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + A_type_literal_property_cannot_have_an_initializer: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + A_class_member_cannot_have_the_0_keyword: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + A_decorator_can_only_decorate_a_method_implementation_not_an_overload: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Class_definitions_are_automatically_in_strict_mode: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Modules_are_automatically_in_strict_mode: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + with_statements_are_not_allowed_in_an_async_function_block: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + await_expression_is_only_allowed_within_an_async_function: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Async_functions_are_only_available_when_targeting_ECMAScript_6_and_higher: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + The_body_of_an_if_statement_cannot_be_the_empty_statement: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Global_module_exports_may_only_appear_in_module_files: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Global_module_exports_may_only_appear_in_declaration_files: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Global_module_exports_may_only_appear_at_top_level: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Duplicate_identifier_0: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Static_members_cannot_reference_class_type_parameters: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Circular_definition_of_import_alias_0: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Cannot_find_name_0: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Module_0_has_no_exported_member_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + File_0_is_not_a_module: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Cannot_find_module_0: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambiguity: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Type_0_recursively_references_itself_as_a_base_type: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + A_class_may_only_extend_another_class: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + An_interface_may_only_extend_a_class_or_another_interface: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Type_parameter_0_has_a_circular_constraint: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Generic_type_0_requires_1_type_argument_s: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Type_0_is_not_generic: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Global_type_0_must_be_a_class_or_interface_type: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Global_type_0_must_have_1_type_parameter_s: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Cannot_find_global_type_0: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Named_property_0_of_types_1_and_2_are_not_identical: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Interface_0_cannot_simultaneously_extend_types_1_and_2: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Excessive_stack_depth_comparing_types_0_and_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Type_0_is_not_assignable_to_type_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Cannot_redeclare_exported_variable_0: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Property_0_is_missing_in_type_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Property_0_is_private_in_type_1_but_not_in_type_2: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Types_of_property_0_are_incompatible: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Property_0_is_optional_in_type_1_but_required_in_type_2: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Types_of_parameters_0_and_1_are_incompatible: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Index_signature_is_missing_in_type_0: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Index_signatures_are_incompatible: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + this_cannot_be_referenced_in_a_module_or_namespace_body: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + this_cannot_be_referenced_in_current_location: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + this_cannot_be_referenced_in_constructor_arguments: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + this_cannot_be_referenced_in_a_static_property_initializer: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + super_can_only_be_referenced_in_a_derived_class: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + super_cannot_be_referenced_in_constructor_arguments: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Property_0_does_not_exist_on_type_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Property_0_is_private_and_only_accessible_within_class_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + An_index_expression_argument_must_be_of_type_string_number_symbol_or_any: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Type_0_does_not_satisfy_the_constraint_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Supplied_parameters_do_not_match_any_signature_of_call_target: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Untyped_function_calls_may_not_accept_type_arguments: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Value_of_type_0_is_not_callable_Did_you_mean_to_include_new: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Cannot_invoke_an_expression_whose_type_lacks_a_call_signature: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Only_a_void_function_can_be_called_with_the_new_keyword: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Type_0_cannot_be_converted_to_type_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + No_best_common_type_exists_among_return_expressions: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Invalid_left_hand_side_of_assignment_expression: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Operator_0_cannot_be_applied_to_types_1_and_2: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Type_parameter_name_cannot_be_0: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + A_parameter_property_is_only_allowed_in_a_constructor_implementation: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + A_rest_parameter_must_be_of_an_array_type: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Parameter_0_cannot_be_referenced_in_its_initializer: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Duplicate_string_index_signature: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Duplicate_number_index_signature: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Constructors_for_derived_classes_must_contain_a_super_call: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + A_get_accessor_must_return_a_value: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Getter_and_setter_accessors_do_not_agree_in_visibility: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + get_and_set_accessor_must_have_the_same_type: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + A_signature_with_an_implementation_cannot_use_a_string_literal_type: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Overload_signatures_must_all_be_exported_or_non_exported: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Overload_signatures_must_all_be_ambient_or_non_ambient: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Overload_signatures_must_all_be_public_private_or_protected: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Overload_signatures_must_all_be_optional_or_required: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Function_overload_must_be_static: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Function_overload_must_not_be_static: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Function_implementation_name_must_be_0: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Constructor_implementation_is_missing: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Function_implementation_is_missing_or_not_immediately_following_the_declaration: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Multiple_constructor_implementations_are_not_allowed: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Duplicate_function_implementation: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Overload_signature_is_not_compatible_with_function_implementation: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Declaration_name_conflicts_with_built_in_global_identifier_0: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Invalid_left_hand_side_in_for_in_statement: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Setters_cannot_return_a_value: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + All_symbols_within_a_with_block_will_be_resolved_to_any: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Property_0_of_type_1_is_not_assignable_to_string_index_type_2: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Numeric_index_type_0_is_not_assignable_to_string_index_type_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Class_name_cannot_be_0: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Class_0_incorrectly_extends_base_class_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Class_static_side_0_incorrectly_extends_base_class_static_side_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Class_0_incorrectly_implements_interface_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + A_class_may_only_implement_another_class_or_interface: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Interface_name_cannot_be_0: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + All_declarations_of_0_must_have_identical_type_parameters: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Interface_0_incorrectly_extends_interface_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Enum_name_cannot_be_0: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Ambient_module_declaration_cannot_specify_relative_module_name: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Module_0_is_hidden_by_a_local_declaration_with_the_same_name: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Import_name_cannot_be_0: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relative_module_name: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Import_declaration_conflicts_with_local_declaration_of_0: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Types_have_separate_declarations_of_a_private_property_0: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Property_0_is_protected_in_type_1_but_public_in_type_2: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Block_scoped_variable_0_used_before_its_declaration: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant_or_a_read_only_property: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Left_hand_side_of_assignment_expression_cannot_be_a_constant_or_a_read_only_property: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Cannot_redeclare_block_scoped_variable_0: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + An_enum_member_cannot_have_a_numeric_name: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Variable_0_is_used_before_being_assigned: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Type_alias_0_circularly_references_itself: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Type_alias_name_cannot_be_0: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + An_AMD_module_cannot_have_multiple_name_assignments: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Type_0_has_no_property_1_and_no_string_index_signature: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Type_0_has_no_property_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Type_0_is_not_an_array_type: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + A_rest_element_must_be_last_in_an_array_destructuring_pattern: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + A_computed_property_name_must_be_of_type_string_number_symbol_or_any: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + this_cannot_be_referenced_in_a_computed_property_name: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + super_cannot_be_referenced_in_a_computed_property_name: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Cannot_find_global_value_0: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + The_0_operator_cannot_be_applied_to_type_symbol: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Symbol_reference_does_not_refer_to_the_global_Symbol_constructor_object: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + A_computed_property_name_of_the_form_0_must_be_of_type_symbol: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_5_and_higher: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Enum_declarations_must_all_be_const_or_non_const: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + In_const_enum_declarations_member_initializer_must_be_constant_expression: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + A_const_enum_member_can_only_be_accessed_using_a_string_literal: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + const_enum_member_initializer_was_evaluated_to_a_non_finite_value: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Property_0_does_not_exist_on_const_enum_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Export_declaration_conflicts_with_exported_declaration_of_0: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + The_left_hand_side_of_a_for_of_statement_cannot_be_a_constant_or_a_read_only_property: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + The_left_hand_side_of_a_for_in_statement_cannot_be_a_constant_or_a_read_only_property: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Invalid_left_hand_side_in_for_of_statement: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + An_iterator_must_have_a_next_method: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Cannot_redeclare_identifier_0_in_catch_clause: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Type_0_is_not_an_array_type_or_a_string_type: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Module_0_uses_export_and_cannot_be_used_with_export_Asterisk: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + A_rest_element_cannot_contain_a_binding_pattern: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + _0_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Cannot_find_namespace_0: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + No_best_common_type_exists_among_yield_expressions: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + A_generator_cannot_have_a_void_type_annotation: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + _0_is_referenced_directly_or_indirectly_in_its_own_base_expression: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Type_0_is_not_a_constructor_function_type: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + No_base_constructor_has_the_specified_number_of_type_arguments: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Base_constructor_return_type_0_is_not_a_class_or_interface_type: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Base_constructors_must_all_have_the_same_return_type: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Cannot_create_an_instance_of_the_abstract_class_0: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Overload_signatures_must_all_be_abstract_or_non_abstract: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Classes_containing_abstract_methods_must_be_marked_abstract: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + All_declarations_of_an_abstract_method_must_be_consecutive: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Expression_resolves_to_variable_declaration_0_that_compiler_uses_to_support_async_functions: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + The_arguments_object_cannot_be_referenced_in_an_async_arrow_function_Consider_using_a_standard_async_function_expression: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + yield_expressions_cannot_be_used_in_a_parameter_initializer: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + await_expressions_cannot_be_used_in_a_parameter_initializer: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + The_inferred_type_of_0_references_an_inaccessible_this_type_A_type_annotation_is_necessary: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + A_module_cannot_have_multiple_default_exports: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Property_0_is_incompatible_with_index_signature: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Object_is_possibly_null: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Object_is_possibly_undefined: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Object_is_possibly_null_or_undefined: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + A_function_returning_never_cannot_have_a_reachable_end_point: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + JSX_element_attributes_type_0_may_not_be_a_union_type: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + The_return_type_of_a_JSX_element_constructor_must_return_an_object_type: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Property_0_in_type_1_is_not_assignable_to_type_2: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + JSX_element_type_0_does_not_have_any_construct_or_call_signatures: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + JSX_element_type_0_is_not_a_constructor_function_for_JSX_elements: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + The_global_type_JSX_0_may_not_have_more_than_one_property: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Cannot_emit_namespaced_JSX_elements_in_React: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_package_author_to_update_the_package_definition: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_the_package_definition: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + JSX_expressions_must_have_one_parent_element: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Type_0_provides_no_match_for_the_signature_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Cannot_find_name_0_Did_you_mean_the_static_member_1_0: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Cannot_find_name_0_Did_you_mean_the_instance_member_this_0: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Invalid_module_name_in_augmentation_module_0_cannot_be_found: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Exports_and_export_assignments_are_not_permitted_in_module_augmentations: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always_visible: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_declarations: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Augmentations_for_the_global_scope_should_have_declare_modifier_unless_they_appear_in_already_ambient_context: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Cannot_augment_module_0_because_it_resolves_to_a_non_module_entity: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Cannot_assign_a_0_constructor_type_to_a_1_constructor_type: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Constructor_of_class_0_is_private_and_only_accessible_within_the_class_declaration: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Cannot_extend_a_class_0_Class_constructor_is_marked_as_private: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Accessors_must_both_be_abstract_or_non_abstract: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + A_type_predicate_s_type_must_be_assignable_to_its_parameter_s_type: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Type_0_is_not_comparable_to_type_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + A_function_that_is_called_with_the_new_keyword_cannot_have_a_this_type_that_is_void: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + A_this_parameter_must_be_the_first_parameter: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + A_constructor_cannot_have_a_this_parameter: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + get_and_set_accessor_must_have_the_same_this_type: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + The_this_types_of_each_signature_are_incompatible: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Import_declaration_0_is_using_private_name_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Type_parameter_0_of_exported_function_has_or_is_using_private_name_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Implements_clause_of_exported_class_0_has_or_is_using_private_name_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Extends_clause_of_exported_class_0_has_or_is_using_private_name_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Exported_variable_0_has_or_is_using_name_1_from_private_module_2: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Exported_variable_0_has_or_is_using_private_name_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Public_static_property_0_of_exported_class_has_or_is_using_private_name_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Public_property_0_of_exported_class_has_or_is_using_private_name_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Property_0_of_exported_interface_has_or_is_using_private_name_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Return_type_of_exported_function_has_or_is_using_private_name_0: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Parameter_0_of_exported_function_has_or_is_using_private_name_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Exported_type_alias_0_has_or_is_using_private_name_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Default_export_of_the_module_has_or_is_using_private_name_0: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Conflicting_library_definitions_for_0_found_at_1_and_2_Copy_the_correct_file_to_the_typings_folder_to_resolve_this_conflict: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + The_current_host_does_not_support_the_0_option: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Cannot_find_the_common_subdirectory_path_for_the_input_files: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Cannot_read_file_0_Colon_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Unsupported_file_encoding: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Failed_to_parse_file_0_Colon_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Unknown_compiler_option_0: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Compiler_option_0_requires_a_value_of_type_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Could_not_write_file_0_Colon_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Option_project_cannot_be_mixed_with_source_files_on_a_command_line: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES2015_or_higher: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Option_inlineSources_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Option_0_cannot_be_specified_without_specifying_option_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Option_0_cannot_be_specified_with_option_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + A_tsconfig_json_file_is_already_defined_at_Colon_0: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Cannot_write_file_0_because_it_would_overwrite_input_file: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + The_specified_path_does_not_exist_Colon_0: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Option_paths_cannot_be_used_without_specifying_baseUrl_option: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Pattern_0_can_have_at_most_one_Asterisk_character: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Substututions_for_pattern_0_should_be_an_array: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Substitution_0_for_pattern_1_has_incorrect_type_expected_string_got_2: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Concatenate_and_emit_output_to_single_file: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Generates_corresponding_d_ts_file: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Watch_input_files: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Redirect_output_structure_to_the_directory: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Do_not_erase_const_enum_declarations_in_generated_code: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Do_not_emit_outputs_if_any_errors_were_reported: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Do_not_emit_comments_to_output: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Do_not_emit_outputs: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typechecking: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Print_this_message: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Print_the_compiler_s_version: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Compile_the_project_in_the_given_directory: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Syntax_Colon_0: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + options: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + file: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Examples_Colon_0: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Options_Colon: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Version_0: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Insert_command_line_options_and_files_from_a_file: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + File_change_detected_Starting_incremental_compilation: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + KIND: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + FILE: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + VERSION: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + LOCATION: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + DIRECTORY: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Compilation_complete_Watching_for_file_changes: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Generates_corresponding_map_file: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Compiler_option_0_expects_an_argument: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Unterminated_quoted_string_in_response_file_0: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Argument_for_0_option_must_be_Colon_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Unsupported_locale_0: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Unable_to_open_file_0: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Corrupted_locale_file_0: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Raise_error_on_expressions_and_declarations_with_an_implied_any_type: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + File_0_not_found: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + File_0_has_unsupported_extension_The_only_supported_extensions_are_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Do_not_emit_declarations_for_code_that_has_an_internal_annotation: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + NEWLINE: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Option_0_can_only_be_specified_in_tsconfig_json_file: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Enables_experimental_support_for_ES7_decorators: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Enables_experimental_support_for_emitting_type_metadata_for_decorators: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Enables_experimental_support_for_ES7_async_functions: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Successfully_created_a_tsconfig_json_file: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Suppress_excess_property_checks_for_object_literals: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Stylize_errors_and_messages_using_color_and_context_experimental: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Do_not_report_errors_on_unused_labels: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Report_error_when_not_all_code_paths_in_function_return_a_value: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Report_errors_for_fallthrough_cases_in_switch_statement: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Do_not_report_errors_on_unreachable_code: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Disallow_inconsistently_cased_references_to_the_same_file: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Specify_library_files_to_be_included_in_the_compilation_Colon: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Specify_JSX_code_generation_Colon_preserve_or_react: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Only_amd_and_system_modules_are_supported_alongside_0: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Base_directory_to_resolve_non_absolute_module_names: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Specify_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Enable_tracing_of_the_name_resolution_process: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Resolving_module_0_from_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Explicitly_specified_module_resolution_kind_Colon_0: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Module_resolution_kind_is_not_specified_using_0: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Module_name_0_was_successfully_resolved_to_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Module_name_0_was_not_resolved: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + paths_option_is_specified_looking_for_a_pattern_to_match_module_name_0: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Module_name_0_matched_pattern_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Trying_substitution_0_candidate_module_location_Colon_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Resolving_module_name_0_relative_to_base_url_1_2: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Loading_module_as_file_Slash_folder_candidate_module_location_0: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + File_0_does_not_exist: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + File_0_exist_use_it_as_a_name_resolution_result: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Loading_module_0_from_node_modules_folder: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Found_package_json_at_0: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + package_json_does_not_have_types_field: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + package_json_has_0_field_1_that_references_2: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Allow_javascript_files_to_be_compiled: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Option_0_should_have_array_of_strings_as_a_value: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Checking_if_0_is_the_longest_matching_prefix_for_1_2: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Expected_type_of_0_field_in_package_json_to_be_string_got_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Longest_matching_prefix_for_0_is_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Loading_0_from_the_root_dir_1_candidate_location_2: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Trying_other_entries_in_rootDirs: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Module_resolution_using_rootDirs_has_failed: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Do_not_emit_use_strict_directives_in_module_output: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Enable_strict_null_checks: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Unknown_option_excludes_Did_you_mean_exclude: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Raise_error_on_this_expressions_with_an_implied_any_type: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Resolving_type_reference_directive_0_containing_file_1_root_directory_2: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Resolving_using_primary_search_paths: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Resolving_from_node_modules_folder: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Type_reference_directive_0_was_not_resolved: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Resolving_with_primary_search_path_0: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Root_directory_cannot_be_determined_skipping_primary_search_paths: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Type_declaration_files_to_be_included_in_compilation: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Looking_up_in_node_modules_folder_initial_location_0: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_modules_folder: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + The_config_file_0_found_doesn_t_contain_any_source_files: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Resolving_real_path_for_0_result_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Variable_0_implicitly_has_an_1_type: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Parameter_0_implicitly_has_an_1_type: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Member_0_implicitly_has_an_1_type: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + _0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_type_annotation: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Index_signature_of_object_type_implicitly_has_an_any_type: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Object_literal_s_property_0_implicitly_has_an_1_type: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Rest_parameter_0_implicitly_has_an_any_type: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + _0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + _0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + 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: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_type: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Unreachable_code_detected: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Unused_label: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Fallthrough_case_in_switch: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Not_all_code_paths_return_a_value: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Binding_element_0_implicitly_has_an_1_type: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + You_cannot_rename_this_element: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + import_can_only_be_used_in_a_ts_file: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + export_can_only_be_used_in_a_ts_file: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + type_parameter_declarations_can_only_be_used_in_a_ts_file: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + implements_clauses_can_only_be_used_in_a_ts_file: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + interface_declarations_can_only_be_used_in_a_ts_file: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + module_declarations_can_only_be_used_in_a_ts_file: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + type_aliases_can_only_be_used_in_a_ts_file: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + _0_can_only_be_used_in_a_ts_file: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + types_can_only_be_used_in_a_ts_file: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + type_arguments_can_only_be_used_in_a_ts_file: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + parameter_modifiers_can_only_be_used_in_a_ts_file: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + property_declarations_can_only_be_used_in_a_ts_file: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + enum_declarations_can_only_be_used_in_a_ts_file: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + type_assertion_expressions_can_only_be_used_in_a_ts_file: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_class_extends_clauses: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + class_expressions_are_not_currently_supported: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + JSX_attributes_must_only_be_assigned_a_non_empty_expression: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + JSX_elements_cannot_have_multiple_attributes_with_the_same_name: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Expected_corresponding_JSX_closing_tag_for_0: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + JSX_attribute_expected: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Cannot_use_JSX_unless_the_jsx_flag_is_provided: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + A_constructor_cannot_contain_a_super_call_when_its_class_extends_null: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + JSX_element_0_has_no_corresponding_closing_tag: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Unknown_typing_option_0: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + }; +} +declare namespace ts { + interface ErrorCallback { + (message: DiagnosticMessage, length: number): void; + } + function tokenIsIdentifierOrKeyword(token: SyntaxKind): boolean; + interface Scanner { + getStartPos(): number; + getToken(): SyntaxKind; + getTextPos(): number; + getTokenPos(): number; + getTokenText(): string; + getTokenValue(): string; + hasExtendedUnicodeEscape(): boolean; + hasPrecedingLineBreak(): boolean; + isIdentifier(): boolean; + isReservedWord(): boolean; + isUnterminated(): boolean; + reScanGreaterToken(): SyntaxKind; + reScanSlashToken(): SyntaxKind; + reScanTemplateToken(): SyntaxKind; + scanJsxIdentifier(): SyntaxKind; + reScanJsxToken(): SyntaxKind; + scanJsxToken(): SyntaxKind; + scanJSDocToken(): SyntaxKind; + scan(): SyntaxKind; + setText(text: string, start?: number, length?: number): void; + setOnError(onError: ErrorCallback): void; + setScriptTarget(scriptTarget: ScriptTarget): void; + setLanguageVariant(variant: LanguageVariant): void; + setTextPos(textPos: number): void; + lookAhead(callback: () => T): T; + scanRange(start: number, length: number, callback: () => T): T; + tryScan(callback: () => T): T; + } + function isUnicodeIdentifierStart(code: number, languageVersion: ScriptTarget): boolean; + function tokenToString(t: SyntaxKind): string; + function stringToToken(s: string): SyntaxKind; + function computeLineStarts(text: string): number[]; + function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; + function computePositionOfLineAndCharacter(lineStarts: number[], line: number, character: number): number; + function getLineStarts(sourceFile: SourceFile): number[]; + function computeLineAndCharacterOfPosition(lineStarts: number[], position: number): { + line: number; + character: number; + }; + function getLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter; + function isWhiteSpace(ch: number): boolean; + function isLineBreak(ch: number): boolean; + function isOctalDigit(ch: number): boolean; + function couldStartTrivia(text: string, pos: number): boolean; + function skipTrivia(text: string, pos: number, stopAfterLineBreak?: boolean): number; + function getLeadingCommentRanges(text: string, pos: number): CommentRange[]; + function getTrailingCommentRanges(text: string, pos: number): CommentRange[]; + function getShebang(text: string): string; + function isIdentifierStart(ch: number, languageVersion: ScriptTarget): boolean; + function isIdentifierPart(ch: number, languageVersion: ScriptTarget): boolean; + function isIdentifier(name: string, languageVersion: ScriptTarget): boolean; + function createScanner(languageVersion: ScriptTarget, skipTrivia: boolean, languageVariant?: LanguageVariant, text?: string, onError?: ErrorCallback, start?: number, length?: number): Scanner; +} +declare namespace ts { + let optionDeclarations: CommandLineOption[]; + let typingOptionDeclarations: CommandLineOption[]; + interface OptionNameMap { + optionNameMap: Map; + shortOptionNames: Map; + } + function getOptionNameMap(): OptionNameMap; + function createCompilerDiagnosticForInvalidCustomType(opt: CommandLineOptionOfCustomType): Diagnostic; + function parseCustomTypeOption(opt: CommandLineOptionOfCustomType, value: string, errors: Diagnostic[]): number | string; + function parseListTypeOption(opt: CommandLineOptionOfListType, value: string, errors: Diagnostic[]): (string | number)[]; + function parseCommandLine(commandLine: string[], readFile?: (path: string) => string): ParsedCommandLine; + function readConfigFile(fileName: string, readFile: (path: string) => string): { + config?: any; + error?: Diagnostic; + }; + function parseConfigFileTextToJson(fileName: string, jsonText: string): { + config?: any; + error?: Diagnostic; + }; + function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string): ParsedCommandLine; + function convertCompilerOptionsFromJson(jsonOptions: any, basePath: string, configFileName?: string): { + options: CompilerOptions; + errors: Diagnostic[]; + }; + function convertTypingOptionsFromJson(jsonOptions: any, basePath: string, configFileName?: string): { + options: CompilerOptions; + errors: Diagnostic[]; + }; +} +declare namespace ts { + interface ReferencePathMatchResult { + fileReference?: FileReference; + diagnosticMessage?: DiagnosticMessage; + isNoDefaultLib?: boolean; + isTypeReferenceDirective?: boolean; + } + interface SynthesizedNode extends Node { + leadingCommentRanges?: CommentRange[]; + trailingCommentRanges?: CommentRange[]; + startsOnNewLine: boolean; + } + function getDeclarationOfKind(symbol: Symbol, kind: SyntaxKind): Declaration; + interface StringSymbolWriter extends SymbolWriter { + string(): string; + } + interface EmitHost extends ScriptReferenceHost { + getSourceFiles(): SourceFile[]; + getCommonSourceDirectory(): string; + getCanonicalFileName(fileName: string): string; + getNewLine(): string; + isEmitBlocked(emitFileName: string): boolean; + writeFile: WriteFileCallback; + } + function getSingleLineStringWriter(): StringSymbolWriter; + function releaseStringWriter(writer: StringSymbolWriter): void; + function getFullWidth(node: Node): number; + function mapIsEqualTo(map1: Map, map2: Map): boolean; + function arrayIsEqualTo(array1: T[], array2: T[], equaler?: (a: T, b: T) => boolean): boolean; + function hasResolvedModule(sourceFile: SourceFile, moduleNameText: string): boolean; + function getResolvedModule(sourceFile: SourceFile, moduleNameText: string): ResolvedModule; + function setResolvedModule(sourceFile: SourceFile, moduleNameText: string, resolvedModule: ResolvedModule): void; + function setResolvedTypeReferenceDirective(sourceFile: SourceFile, typeReferenceDirectiveName: string, resolvedTypeReferenceDirective: ResolvedTypeReferenceDirective): void; + function moduleResolutionIsEqualTo(oldResolution: ResolvedModule, newResolution: ResolvedModule): boolean; + function typeDirectiveIsEqualTo(oldResolution: ResolvedTypeReferenceDirective, newResolution: ResolvedTypeReferenceDirective): boolean; + function hasChangesInResolutions(names: string[], newResolutions: T[], oldResolutions: Map, comparer: (oldResolution: T, newResolution: T) => boolean): boolean; + function containsParseError(node: Node): boolean; + function getSourceFileOfNode(node: Node): SourceFile; + function isStatementWithLocals(node: Node): boolean; + function getStartPositionOfLine(line: number, sourceFile: SourceFile): number; + function nodePosToString(node: Node): string; + function getStartPosOfNode(node: Node): number; + function getEndLinePosition(line: number, sourceFile: SourceFile): number; + function nodeIsMissing(node: Node): boolean; + function nodeIsPresent(node: Node): boolean; + function getTokenPosOfNode(node: Node, sourceFile?: SourceFile): number; + function getNonDecoratorTokenPosOfNode(node: Node, sourceFile?: SourceFile): number; + function getSourceTextOfNodeFromSourceFile(sourceFile: SourceFile, node: Node, includeTrivia?: boolean): string; + function getTextOfNodeFromSourceText(sourceText: string, node: Node): string; + function getTextOfNode(node: Node, includeTrivia?: boolean): string; + function escapeIdentifier(identifier: string): string; + function unescapeIdentifier(identifier: string): string; + function makeIdentifierFromModuleName(moduleName: string): string; + function isBlockOrCatchScoped(declaration: Declaration): boolean; + function isAmbientModule(node: Node): boolean; + function isBlockScopedContainerTopLevel(node: Node): boolean; + function isGlobalScopeAugmentation(module: ModuleDeclaration): boolean; + function isExternalModuleAugmentation(node: Node): boolean; + function getEnclosingBlockScopeContainer(node: Node): Node; + function isCatchClauseVariableDeclaration(declaration: Declaration): boolean; + function declarationNameToString(name: DeclarationName): string; + function createDiagnosticForNode(node: Node, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any): Diagnostic; + function createDiagnosticForNodeFromMessageChain(node: Node, messageChain: DiagnosticMessageChain): Diagnostic; + function getSpanOfTokenAtPosition(sourceFile: SourceFile, pos: number): TextSpan; + function getErrorSpanForNode(sourceFile: SourceFile, node: Node): TextSpan; + function isExternalOrCommonJsModule(file: SourceFile): boolean; + function isDeclarationFile(file: SourceFile): boolean; + function isConstEnumDeclaration(node: Node): boolean; + function getCombinedNodeFlags(node: Node): NodeFlags; + function isConst(node: Node): boolean; + function isLet(node: Node): boolean; + function isSuperCallExpression(n: Node): boolean; + function isPrologueDirective(node: Node): boolean; + function getLeadingCommentRangesOfNode(node: Node, sourceFileOfNode: SourceFile): CommentRange[]; + function getLeadingCommentRangesOfNodeFromText(node: Node, text: string): CommentRange[]; + function getJsDocComments(node: Node, sourceFileOfNode: SourceFile): CommentRange[]; + function getJsDocCommentsFromText(node: Node, text: string): CommentRange[]; + let fullTripleSlashReferencePathRegEx: RegExp; + let fullTripleSlashReferenceTypeReferenceDirectiveRegEx: RegExp; + let fullTripleSlashAMDReferencePathRegEx: RegExp; + function isTypeNode(node: Node): boolean; + function forEachReturnStatement(body: Block, visitor: (stmt: ReturnStatement) => T): T; + function forEachYieldExpression(body: Block, visitor: (expr: YieldExpression) => void): void; + function isVariableLike(node: Node): node is VariableLikeDeclaration; + function isAccessor(node: Node): node is AccessorDeclaration; + function isClassLike(node: Node): node is ClassLikeDeclaration; + function isFunctionLike(node: Node): node is FunctionLikeDeclaration; + function isFunctionLikeKind(kind: SyntaxKind): boolean; + function introducesArgumentsExoticObject(node: Node): boolean; + function isIterationStatement(node: Node, lookInLabeledStatements: boolean): boolean; + function isFunctionBlock(node: Node): boolean; + function isObjectLiteralMethod(node: Node): node is MethodDeclaration; + function isIdentifierTypePredicate(predicate: TypePredicate): predicate is IdentifierTypePredicate; + function isThisTypePredicate(predicate: TypePredicate): predicate is ThisTypePredicate; + function getContainingFunction(node: Node): FunctionLikeDeclaration; + function getContainingFunctionOrModule(node: Node): Node; + function getContainingClass(node: Node): ClassLikeDeclaration; + function getThisContainer(node: Node, includeArrowFunctions: boolean): Node; + function getSuperContainer(node: Node, stopOnFunctions: boolean): Node; + function isSuperPropertyOrElementAccess(node: Node): boolean; + function getEntityNameFromTypeNode(node: TypeNode): EntityName | Expression; + function getInvokedExpression(node: CallLikeExpression): Expression; + function nodeCanBeDecorated(node: Node): boolean; + function nodeIsDecorated(node: Node): boolean; + function isPropertyAccessExpression(node: Node): node is PropertyAccessExpression; + function isElementAccessExpression(node: Node): node is ElementAccessExpression; + function isJSXTagName(node: Node): boolean; + function isExpression(node: Node): boolean; + function isExternalModuleNameRelative(moduleName: string): boolean; + function isInstantiatedModule(node: ModuleDeclaration, preserveConstEnums: boolean): boolean; + function isExternalModuleImportEqualsDeclaration(node: Node): boolean; + function getExternalModuleImportEqualsDeclarationExpression(node: Node): Expression; + function isInternalModuleImportEqualsDeclaration(node: Node): node is ImportEqualsDeclaration; + function isSourceFileJavaScript(file: SourceFile): boolean; + function isInJavaScriptFile(node: Node): boolean; + function isRequireCall(expression: Node, checkArgumentIsStringLiteral: boolean): expression is CallExpression; + function isSingleOrDoubleQuote(charCode: number): boolean; + function getSpecialPropertyAssignmentKind(expression: Node): SpecialPropertyAssignmentKind; + function getExternalModuleName(node: Node): Expression; + function hasQuestionToken(node: Node): boolean; + function isJSDocConstructSignature(node: Node): boolean; + function getJSDocTypeTag(node: Node): JSDocTypeTag; + function getJSDocReturnTag(node: Node): JSDocReturnTag; + function getJSDocTemplateTag(node: Node): JSDocTemplateTag; + function getCorrespondingJSDocParameterTag(parameter: ParameterDeclaration): JSDocParameterTag; + function hasRestParameter(s: SignatureDeclaration): boolean; + function hasDeclaredRestParameter(s: SignatureDeclaration): boolean; + function isRestParameter(node: ParameterDeclaration): boolean; + function isDeclaredRestParam(node: ParameterDeclaration): boolean; + function isLiteralKind(kind: SyntaxKind): boolean; + function isTextualLiteralKind(kind: SyntaxKind): boolean; + function isTemplateLiteralKind(kind: SyntaxKind): boolean; + function isBindingPattern(node: Node): node is BindingPattern; + function isAssignmentTarget(node: Node): boolean; + function isNodeDescendentOf(node: Node, ancestor: Node): boolean; + function isInAmbientContext(node: Node): boolean; + function isDeclaration(node: Node): boolean; + function isStatement(n: Node): boolean; + function isClassElement(n: Node): boolean; + function isDeclarationName(name: Node): boolean; + function isLiteralComputedPropertyDeclarationName(node: Node): boolean; + function isIdentifierName(node: Identifier): boolean; + function isAliasSymbolDeclaration(node: Node): boolean; + function getClassExtendsHeritageClauseElement(node: ClassLikeDeclaration): ExpressionWithTypeArguments; + function getClassImplementsHeritageClauseElements(node: ClassLikeDeclaration): NodeArray; + function getInterfaceBaseTypeNodes(node: InterfaceDeclaration): NodeArray; + function getHeritageClause(clauses: NodeArray, kind: SyntaxKind): HeritageClause; + function tryResolveScriptReference(host: ScriptReferenceHost, sourceFile: SourceFile, reference: FileReference): SourceFile; + function getAncestor(node: Node, kind: SyntaxKind): Node; + function getFileReferenceFromReferencePath(comment: string, commentRange: CommentRange): ReferencePathMatchResult; + function isKeyword(token: SyntaxKind): boolean; + function isTrivia(token: SyntaxKind): boolean; + function isAsyncFunctionLike(node: Node): boolean; + function isStringOrNumericLiteral(kind: SyntaxKind): boolean; + function hasDynamicName(declaration: Declaration): boolean; + function isDynamicName(name: DeclarationName): boolean; + function isWellKnownSymbolSyntactically(node: Expression): boolean; + function getPropertyNameForPropertyNameNode(name: DeclarationName): string; + function getPropertyNameForKnownSymbolName(symbolName: string): string; + function isESSymbolIdentifier(node: Node): boolean; + function isModifierKind(token: SyntaxKind): boolean; + function isParameterDeclaration(node: VariableLikeDeclaration): boolean; + function getRootDeclaration(node: Node): Node; + function nodeStartsNewLexicalEnvironment(n: Node): boolean; + function cloneNode(node: T, location?: TextRange, flags?: NodeFlags, parent?: Node): T; + function cloneEntityName(node: EntityName, parent?: Node): EntityName; + function isQualifiedName(node: Node): node is QualifiedName; + function nodeIsSynthesized(node: Node): boolean; + function createSynthesizedNode(kind: SyntaxKind, startsOnNewLine?: boolean): Node; + function createSynthesizedNodeArray(): NodeArray; + function createDiagnosticCollection(): DiagnosticCollection; + function escapeString(s: string): string; + function isIntrinsicJsxName(name: string): boolean; + function escapeNonAsciiCharacters(s: string): string; + interface EmitTextWriter { + write(s: string): void; + writeTextOfNode(text: string, node: Node): void; + writeLine(): void; + increaseIndent(): void; + decreaseIndent(): void; + getText(): string; + rawWrite(s: string): void; + writeLiteral(s: string): void; + getTextPos(): number; + getLine(): number; + getColumn(): number; + getIndent(): number; + reset(): void; + } + function getIndentString(level: number): string; + function getIndentSize(): number; + function createTextWriter(newLine: String): EmitTextWriter; + function getExternalModuleNameFromPath(host: EmitHost, fileName: string): string; + function getOwnEmitOutputFilePath(sourceFile: SourceFile, host: EmitHost, extension: string): string; + function getDeclarationEmitOutputFilePath(sourceFile: SourceFile, host: EmitHost): string; + function getEmitScriptTarget(compilerOptions: CompilerOptions): ScriptTarget; + function getEmitModuleKind(compilerOptions: CompilerOptions): ModuleKind; + interface EmitFileNames { + jsFilePath: string; + sourceMapFilePath: string; + declarationFilePath: string; + } + function forEachExpectedEmitFile(host: EmitHost, action: (emitFileNames: EmitFileNames, sourceFiles: SourceFile[], isBundledEmit: boolean) => void, targetSourceFile?: SourceFile): void; + function getSourceFilePathInNewDir(sourceFile: SourceFile, host: EmitHost, newDirPath: string): string; + function writeFile(host: EmitHost, diagnostics: DiagnosticCollection, fileName: string, data: string, writeByteOrderMark: boolean, sourceFiles?: SourceFile[]): void; + function getLineOfLocalPosition(currentSourceFile: SourceFile, pos: number): number; + function getLineOfLocalPositionFromLineMap(lineMap: number[], pos: number): number; + function getFirstConstructorWithBody(node: ClassLikeDeclaration): ConstructorDeclaration; + function getSetAccessorTypeAnnotationNode(accessor: AccessorDeclaration): TypeNode; + function getAllAccessorDeclarations(declarations: NodeArray, accessor: AccessorDeclaration): { + firstAccessor: AccessorDeclaration; + secondAccessor: AccessorDeclaration; + getAccessor: AccessorDeclaration; + setAccessor: AccessorDeclaration; + }; + function emitNewLineBeforeLeadingComments(lineMap: number[], writer: EmitTextWriter, node: TextRange, leadingComments: CommentRange[]): void; + function emitComments(text: string, lineMap: number[], writer: EmitTextWriter, comments: CommentRange[], trailingSeparator: boolean, newLine: string, writeComment: (text: string, lineMap: number[], writer: EmitTextWriter, comment: CommentRange, newLine: string) => void): void; + function emitDetachedComments(text: string, lineMap: number[], writer: EmitTextWriter, writeComment: (text: string, lineMap: number[], writer: EmitTextWriter, comment: CommentRange, newLine: string) => void, node: TextRange, newLine: string, removeComments: boolean): { + nodePos: number; + detachedCommentEndPos: number; + }; + function writeCommentRange(text: string, lineMap: number[], writer: EmitTextWriter, comment: CommentRange, newLine: string): void; + function modifierToFlag(token: SyntaxKind): NodeFlags; + function isLeftHandSideExpression(expr: Expression): boolean; + function isAssignmentOperator(token: SyntaxKind): boolean; + function isExpressionWithTypeArgumentsInClassExtendsClause(node: Node): boolean; + function isSupportedExpressionWithTypeArguments(node: ExpressionWithTypeArguments): boolean; + function isRightSideOfQualifiedNameOrPropertyAccess(node: Node): boolean; + function isEmptyObjectLiteralOrArrayLiteral(expression: Node): boolean; + function getLocalSymbolForExportDefault(symbol: Symbol): Symbol; + function hasJavaScriptFileExtension(fileName: string): boolean; + const stringify: (value: any) => string; + function convertToBase64(input: string): string; + function convertToRelativePath(absoluteOrRelativePath: string, basePath: string, getCanonicalFileName: (path: string) => string): string; + function getNewLineCharacter(options: CompilerOptions): string; + function isWatchSet(options: CompilerOptions): boolean; +} +declare namespace ts { + function getDefaultLibFileName(options: CompilerOptions): string; + function textSpanEnd(span: TextSpan): number; + function textSpanIsEmpty(span: TextSpan): boolean; + function textSpanContainsPosition(span: TextSpan, position: number): boolean; + function textSpanContainsTextSpan(span: TextSpan, other: TextSpan): boolean; + function textSpanOverlapsWith(span: TextSpan, other: TextSpan): boolean; + function textSpanOverlap(span1: TextSpan, span2: TextSpan): TextSpan; + function textSpanIntersectsWithTextSpan(span: TextSpan, other: TextSpan): boolean; + function textSpanIntersectsWith(span: TextSpan, start: number, length: number): boolean; + function decodedTextSpanIntersectsWith(start1: number, length1: number, start2: number, length2: number): boolean; + function textSpanIntersectsWithPosition(span: TextSpan, position: number): boolean; + function textSpanIntersection(span1: TextSpan, span2: TextSpan): TextSpan; + function createTextSpan(start: number, length: number): TextSpan; + function createTextSpanFromBounds(start: number, end: number): TextSpan; + function textChangeRangeNewSpan(range: TextChangeRange): TextSpan; + function textChangeRangeIsUnchanged(range: TextChangeRange): boolean; + function createTextChangeRange(span: TextSpan, newLength: number): TextChangeRange; + let unchangedTextChangeRange: TextChangeRange; + function collapseTextChangeRangesAcrossMultipleVersions(changes: TextChangeRange[]): TextChangeRange; + function getTypeParameterOwner(d: Declaration): Declaration; + function isParameterPropertyDeclaration(node: ParameterDeclaration): boolean; + function startsWith(str: string, prefix: string): boolean; + function endsWith(str: string, suffix: string): boolean; +} +declare namespace ts { + let parseTime: number; + function createNode(kind: SyntaxKind, pos?: number, end?: number): Node; + function forEachChild(node: Node, cbNode: (node: Node) => T, cbNodeArray?: (nodes: Node[]) => T): T; + function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean, scriptKind?: ScriptKind): SourceFile; + function isExternalModule(file: SourceFile): boolean; + function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile; + function parseIsolatedJSDocComment(content: string, start?: number, length?: number): { + jsDocComment: JSDocComment; + diagnostics: Diagnostic[]; + }; + function parseJSDocTypeExpressionForTests(content: string, start?: number, length?: number): { + jsDocTypeExpression: JSDocTypeExpression; + diagnostics: Diagnostic[]; + }; +} +declare namespace ts { + let bindTime: number; + const enum ModuleInstanceState { + NonInstantiated = 0, + Instantiated = 1, + ConstEnumOnly = 2, + } + function getModuleInstanceState(node: Node): ModuleInstanceState; + function bindSourceFile(file: SourceFile, options: CompilerOptions): void; +} +declare namespace ts { + function getNodeId(node: Node): number; + let checkTime: number; + function getSymbolId(symbol: Symbol): number; + function createTypeChecker(host: TypeCheckerHost, produceDiagnostics: boolean): TypeChecker; +} +declare namespace ts { + interface SourceMapWriter { + getSourceMapData(): SourceMapData; + setSourceFile(sourceFile: SourceFile): void; + emitPos(pos: number): void; + emitStart(range: TextRange): void; + emitEnd(range: TextRange, stopOverridingSpan?: boolean): void; + changeEmitSourcePos(): void; + getText(): string; + getSourceMappingURL(): string; + initialize(filePath: string, sourceMapFilePath: string, sourceFiles: SourceFile[], isBundledEmit: boolean): void; + reset(): void; + } + function getNullSourceMapWriter(): SourceMapWriter; + function createSourceMapWriter(host: EmitHost, writer: EmitTextWriter): SourceMapWriter; +} +declare namespace ts { + function getDeclarationDiagnostics(host: EmitHost, resolver: EmitResolver, targetSourceFile: SourceFile): Diagnostic[]; + function writeDeclarationFile(declarationFilePath: string, sourceFiles: SourceFile[], isBundledEmit: boolean, host: EmitHost, resolver: EmitResolver, emitterDiagnostics: DiagnosticCollection): boolean; +} +declare namespace ts { + function getResolvedExternalModuleName(host: EmitHost, file: SourceFile): string; + function getExternalModuleNameFromDeclaration(host: EmitHost, resolver: EmitResolver, declaration: ImportEqualsDeclaration | ImportDeclaration | ExportDeclaration): string; + function emitFiles(resolver: EmitResolver, host: EmitHost, targetSourceFile: SourceFile): EmitResult; +} +declare namespace ts { + let programTime: number; + let emitTime: number; + let ioReadTime: number; + let ioWriteTime: number; + const version: string; + function findConfigFile(searchPath: string, fileExists: (fileName: string) => boolean): string; + function resolveTripleslashReference(moduleName: string, containingFile: string): string; + function computeCommonSourceDirectoryOfFilenames(fileNames: string[], currentDirectory: string, getCanonicalFileName: (fileName: string) => string): string; + function resolveTypeReferenceDirective(typeReferenceDirectiveName: string, containingFile: string, options: CompilerOptions, host: ModuleResolutionHost): ResolvedTypeReferenceDirectiveWithFailedLookupLocations; + function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations; + function nodeModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations; + function directoryProbablyExists(directoryName: string, host: { + directoryExists?: (directoryName: string) => boolean; + }): boolean; + function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations; + const defaultInitCompilerOptions: CompilerOptions; + function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost; + function getPreEmitDiagnostics(program: Program, sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[]; + function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string; + function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost, oldProgram?: Program): Program; +} +declare namespace ts.BreakpointResolver { + function spanInSourceFileAtLocation(sourceFile: SourceFile, position: number): TextSpan; +} +declare namespace ts.OutliningElementsCollector { + function collectElements(sourceFile: SourceFile): OutliningSpan[]; +} +declare namespace ts.NavigateTo { + function getNavigateToItems(program: Program, cancellationToken: CancellationToken, searchValue: string, maxResultCount: number): NavigateToItem[]; +} +declare namespace ts.NavigationBar { + function getNavigationBarItems(sourceFile: SourceFile, compilerOptions: CompilerOptions): ts.NavigationBarItem[]; + function getJsNavigationBarItems(sourceFile: SourceFile, compilerOptions: CompilerOptions): NavigationBarItem[]; +} +declare namespace ts { + enum PatternMatchKind { + exact = 0, + prefix = 1, + substring = 2, + camelCase = 3, + } + interface PatternMatch { + kind: PatternMatchKind; + camelCaseWeight?: number; + isCaseSensitive: boolean; + punctuationStripped: boolean; + } + interface PatternMatcher { + getMatchesForLastSegmentOfPattern(candidate: string): PatternMatch[]; + getMatches(candidateContainers: string[], candidate: string): PatternMatch[]; + patternContainsDots: boolean; + } + function createPatternMatcher(pattern: string): PatternMatcher; + function breakIntoCharacterSpans(identifier: string): TextSpan[]; + function breakIntoWordSpans(identifier: string): TextSpan[]; +} +declare namespace ts.SignatureHelp { + function getSignatureHelpItems(program: Program, sourceFile: SourceFile, position: number, cancellationToken: CancellationToken): SignatureHelpItems; +} +declare namespace ts { + interface ListItemInfo { + listItemIndex: number; + list: Node; + } + function getLineStartPositionForPosition(position: number, sourceFile: SourceFile): number; + function rangeContainsRange(r1: TextRange, r2: TextRange): boolean; + function startEndContainsRange(start: number, end: number, range: TextRange): boolean; + function rangeContainsStartEnd(range: TextRange, start: number, end: number): boolean; + function rangeOverlapsWithStartEnd(r1: TextRange, start: number, end: number): boolean; + function startEndOverlapsWithStartEnd(start1: number, end1: number, start2: number, end2: number): boolean; + function positionBelongsToNode(candidate: Node, position: number, sourceFile: SourceFile): boolean; + function isCompletedNode(n: Node, sourceFile: SourceFile): boolean; + function findListItemInfo(node: Node): ListItemInfo; + function hasChildOfKind(n: Node, kind: SyntaxKind, sourceFile?: SourceFile): boolean; + function findChildOfKind(n: Node, kind: SyntaxKind, sourceFile?: SourceFile): Node; + function findContainingList(node: Node): Node; + function getTouchingWord(sourceFile: SourceFile, position: number): Node; + function getTouchingPropertyName(sourceFile: SourceFile, position: number): Node; + function getTouchingToken(sourceFile: SourceFile, position: number, includeItemAtEndPosition?: (n: Node) => boolean): Node; + function getTokenAtPosition(sourceFile: SourceFile, position: number): Node; + function findTokenOnLeftOfPosition(file: SourceFile, position: number): Node; + function findNextToken(previousToken: Node, parent: Node): Node; + function findPrecedingToken(position: number, sourceFile: SourceFile, startNode?: Node): Node; + function isInString(sourceFile: SourceFile, position: number): boolean; + function isInComment(sourceFile: SourceFile, position: number): boolean; + function isInsideJsxElementOrAttribute(sourceFile: SourceFile, position: number): boolean; + function isInTemplateString(sourceFile: SourceFile, position: number): boolean; + function isInCommentHelper(sourceFile: SourceFile, position: number, predicate?: (c: CommentRange) => boolean): boolean; + function hasDocComment(sourceFile: SourceFile, position: number): boolean; + function getJsDocTagAtPosition(sourceFile: SourceFile, position: number): JSDocTag; + function getNodeModifiers(node: Node): string; + function getTypeArgumentOrTypeParameterList(node: Node): NodeArray; + function isToken(n: Node): boolean; + function isWord(kind: SyntaxKind): boolean; + function isComment(kind: SyntaxKind): boolean; + function isStringOrRegularExpressionOrTemplateLiteral(kind: SyntaxKind): boolean; + function isPunctuation(kind: SyntaxKind): boolean; + function isInsideTemplateLiteral(node: LiteralExpression, position: number): boolean; + function isAccessibilityModifier(kind: SyntaxKind): boolean; + function compareDataObjects(dst: any, src: any): boolean; + function isArrayLiteralOrObjectLiteralDestructuringPattern(node: Node): boolean; +} +declare namespace ts { + function isFirstDeclarationOfSymbolParameter(symbol: Symbol): boolean; + function symbolPart(text: string, symbol: Symbol): SymbolDisplayPart; + function displayPart(text: string, kind: SymbolDisplayPartKind, symbol?: Symbol): SymbolDisplayPart; + function spacePart(): SymbolDisplayPart; + function keywordPart(kind: SyntaxKind): SymbolDisplayPart; + function punctuationPart(kind: SyntaxKind): SymbolDisplayPart; + function operatorPart(kind: SyntaxKind): SymbolDisplayPart; + function textOrKeywordPart(text: string): SymbolDisplayPart; + function textPart(text: string): SymbolDisplayPart; + function getNewLineOrDefaultFromHost(host: LanguageServiceHost | LanguageServiceShimHost): string; + function lineBreakPart(): SymbolDisplayPart; + function mapToDisplayParts(writeDisplayParts: (writer: DisplayPartsSymbolWriter) => void): SymbolDisplayPart[]; + function typeToDisplayParts(typechecker: TypeChecker, type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): SymbolDisplayPart[]; + function symbolToDisplayParts(typeChecker: TypeChecker, symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags): SymbolDisplayPart[]; + function signatureToDisplayParts(typechecker: TypeChecker, signature: Signature, enclosingDeclaration?: Node, flags?: TypeFormatFlags): SymbolDisplayPart[]; + function getDeclaredName(typeChecker: TypeChecker, symbol: Symbol, location: Node): string; + function isImportOrExportSpecifierName(location: Node): boolean; + function stripQuotes(name: string): string; + function scriptKindIs(fileName: string, host: LanguageServiceHost, ...scriptKinds: ScriptKind[]): boolean; + function getScriptKind(fileName: string, host?: LanguageServiceHost): ScriptKind; +} +declare namespace ts.JsTyping { + interface TypingResolutionHost { + directoryExists: (path: string) => boolean; + fileExists: (fileName: string) => boolean; + readFile: (path: string, encoding?: string) => string; + readDirectory: (path: string, extension?: string, exclude?: string[], depth?: number) => string[]; + } + function discoverTypings(host: TypingResolutionHost, fileNames: string[], projectRootPath: Path, safeListPath: Path, packageNameToTypingLocation: Map, typingOptions: TypingOptions, compilerOptions: CompilerOptions): { + cachedTypingPaths: string[]; + newTypingNames: string[]; + filesToWatch: string[]; + }; +} +declare namespace ts.formatting { + interface FormattingScanner { + advance(): void; + isOnToken(): boolean; + readTokenInfo(n: Node): TokenInfo; + getCurrentLeadingTrivia(): TextRangeWithKind[]; + lastTrailingTriviaWasNewLine(): boolean; + close(): void; + } + function getFormattingScanner(sourceFile: SourceFile, startPos: number, endPos: number): FormattingScanner; +} +declare namespace ts.formatting { + class FormattingContext { + sourceFile: SourceFile; + formattingRequestKind: FormattingRequestKind; + currentTokenSpan: TextRangeWithKind; + nextTokenSpan: TextRangeWithKind; + contextNode: Node; + currentTokenParent: Node; + nextTokenParent: Node; + private contextNodeAllOnSameLine; + private nextNodeAllOnSameLine; + private tokensAreOnSameLine; + private contextNodeBlockIsOnOneLine; + private nextNodeBlockIsOnOneLine; + constructor(sourceFile: SourceFile, formattingRequestKind: FormattingRequestKind); + updateContext(currentRange: TextRangeWithKind, currentTokenParent: Node, nextRange: TextRangeWithKind, nextTokenParent: Node, commonParent: Node): void; + ContextNodeAllOnSameLine(): boolean; + NextNodeAllOnSameLine(): boolean; + TokensAreOnSameLine(): boolean; + ContextNodeBlockIsOnOneLine(): boolean; + NextNodeBlockIsOnOneLine(): boolean; + private NodeIsOnOneLine(node); + private BlockIsOnOneLine(node); + } +} +declare namespace ts.formatting { + const enum FormattingRequestKind { + FormatDocument = 0, + FormatSelection = 1, + FormatOnEnter = 2, + FormatOnSemicolon = 3, + FormatOnClosingCurlyBrace = 4, + } +} +declare namespace ts.formatting { + class Rule { + Descriptor: RuleDescriptor; + Operation: RuleOperation; + Flag: RuleFlags; + constructor(Descriptor: RuleDescriptor, Operation: RuleOperation, Flag?: RuleFlags); + toString(): string; + } +} +declare namespace ts.formatting { + const enum RuleAction { + Ignore = 1, + Space = 2, + NewLine = 4, + Delete = 8, + } +} +declare namespace ts.formatting { + class RuleDescriptor { + LeftTokenRange: Shared.TokenRange; + RightTokenRange: Shared.TokenRange; + constructor(LeftTokenRange: Shared.TokenRange, RightTokenRange: Shared.TokenRange); + toString(): string; + static create1(left: SyntaxKind, right: SyntaxKind): RuleDescriptor; + static create2(left: Shared.TokenRange, right: SyntaxKind): RuleDescriptor; + static create3(left: SyntaxKind, right: Shared.TokenRange): RuleDescriptor; + static create4(left: Shared.TokenRange, right: Shared.TokenRange): RuleDescriptor; + } +} +declare namespace ts.formatting { + const enum RuleFlags { + None = 0, + CanDeleteNewLines = 1, + } +} +declare namespace ts.formatting { + class RuleOperation { + Context: RuleOperationContext; + Action: RuleAction; + constructor(); + toString(): string; + static create1(action: RuleAction): RuleOperation; + static create2(context: RuleOperationContext, action: RuleAction): RuleOperation; + } +} +declare namespace ts.formatting { + class RuleOperationContext { + private customContextChecks; + constructor(...funcs: { + (context: FormattingContext): boolean; + }[]); + static Any: RuleOperationContext; + IsAny(): boolean; + InContext(context: FormattingContext): boolean; + } +} +declare namespace ts.formatting { + class Rules { + getRuleName(rule: Rule): string; + [name: string]: any; + IgnoreBeforeComment: Rule; + IgnoreAfterLineComment: Rule; + NoSpaceBeforeSemicolon: Rule; + NoSpaceBeforeColon: Rule; + NoSpaceBeforeQuestionMark: Rule; + SpaceAfterColon: Rule; + SpaceAfterQuestionMarkInConditionalOperator: Rule; + NoSpaceAfterQuestionMark: Rule; + SpaceAfterSemicolon: Rule; + SpaceAfterCloseBrace: Rule; + SpaceBetweenCloseBraceAndElse: Rule; + SpaceBetweenCloseBraceAndWhile: Rule; + NoSpaceAfterCloseBrace: Rule; + NoSpaceBeforeDot: Rule; + NoSpaceAfterDot: Rule; + NoSpaceBeforeOpenBracket: Rule; + NoSpaceAfterCloseBracket: Rule; + SpaceAfterOpenBrace: Rule; + SpaceBeforeCloseBrace: Rule; + NoSpaceBetweenEmptyBraceBrackets: Rule; + NewLineAfterOpenBraceInBlockContext: Rule; + NewLineBeforeCloseBraceInBlockContext: Rule; + NoSpaceAfterUnaryPrefixOperator: Rule; + NoSpaceAfterUnaryPreincrementOperator: Rule; + NoSpaceAfterUnaryPredecrementOperator: Rule; + NoSpaceBeforeUnaryPostincrementOperator: Rule; + NoSpaceBeforeUnaryPostdecrementOperator: Rule; + SpaceAfterPostincrementWhenFollowedByAdd: Rule; + SpaceAfterAddWhenFollowedByUnaryPlus: Rule; + SpaceAfterAddWhenFollowedByPreincrement: Rule; + SpaceAfterPostdecrementWhenFollowedBySubtract: Rule; + SpaceAfterSubtractWhenFollowedByUnaryMinus: Rule; + SpaceAfterSubtractWhenFollowedByPredecrement: Rule; + NoSpaceBeforeComma: Rule; + SpaceAfterCertainKeywords: Rule; + SpaceAfterLetConstInVariableDeclaration: Rule; + NoSpaceBeforeOpenParenInFuncCall: Rule; + SpaceAfterFunctionInFuncDecl: Rule; + NoSpaceBeforeOpenParenInFuncDecl: Rule; + SpaceAfterVoidOperator: Rule; + NoSpaceBetweenReturnAndSemicolon: Rule; + SpaceBetweenStatements: Rule; + SpaceAfterTryFinally: Rule; + SpaceAfterGetSetInMember: Rule; + SpaceBeforeBinaryKeywordOperator: Rule; + SpaceAfterBinaryKeywordOperator: Rule; + NoSpaceAfterConstructor: Rule; + NoSpaceAfterModuleImport: Rule; + SpaceAfterCertainTypeScriptKeywords: Rule; + SpaceBeforeCertainTypeScriptKeywords: Rule; + SpaceAfterModuleName: Rule; + SpaceBeforeArrow: Rule; + SpaceAfterArrow: Rule; + NoSpaceAfterEllipsis: Rule; + NoSpaceAfterOptionalParameters: Rule; + NoSpaceBeforeOpenAngularBracket: Rule; + NoSpaceBetweenCloseParenAndAngularBracket: Rule; + NoSpaceAfterOpenAngularBracket: Rule; + NoSpaceBeforeCloseAngularBracket: Rule; + NoSpaceAfterCloseAngularBracket: Rule; + NoSpaceAfterTypeAssertion: Rule; + NoSpaceBetweenEmptyInterfaceBraceBrackets: Rule; + HighPriorityCommonRules: Rule[]; + LowPriorityCommonRules: Rule[]; + SpaceAfterComma: Rule; + NoSpaceAfterComma: Rule; + SpaceBeforeBinaryOperator: Rule; + SpaceAfterBinaryOperator: Rule; + NoSpaceBeforeBinaryOperator: Rule; + NoSpaceAfterBinaryOperator: Rule; + SpaceAfterKeywordInControl: Rule; + NoSpaceAfterKeywordInControl: Rule; + FunctionOpenBraceLeftTokenRange: Shared.TokenRange; + SpaceBeforeOpenBraceInFunction: Rule; + NewLineBeforeOpenBraceInFunction: Rule; + TypeScriptOpenBraceLeftTokenRange: Shared.TokenRange; + SpaceBeforeOpenBraceInTypeScriptDeclWithBlock: Rule; + NewLineBeforeOpenBraceInTypeScriptDeclWithBlock: Rule; + ControlOpenBraceLeftTokenRange: Shared.TokenRange; + SpaceBeforeOpenBraceInControl: Rule; + NewLineBeforeOpenBraceInControl: Rule; + SpaceAfterSemicolonInFor: Rule; + NoSpaceAfterSemicolonInFor: Rule; + SpaceAfterOpenParen: Rule; + SpaceBeforeCloseParen: Rule; + NoSpaceBetweenParens: Rule; + NoSpaceAfterOpenParen: Rule; + NoSpaceBeforeCloseParen: Rule; + SpaceAfterOpenBracket: Rule; + SpaceBeforeCloseBracket: Rule; + NoSpaceBetweenBrackets: Rule; + NoSpaceAfterOpenBracket: Rule; + NoSpaceBeforeCloseBracket: Rule; + SpaceAfterAnonymousFunctionKeyword: Rule; + NoSpaceAfterAnonymousFunctionKeyword: Rule; + SpaceBeforeAt: Rule; + NoSpaceAfterAt: Rule; + SpaceAfterDecorator: Rule; + NoSpaceBetweenFunctionKeywordAndStar: Rule; + SpaceAfterStarInGeneratorDeclaration: Rule; + NoSpaceBetweenYieldKeywordAndStar: Rule; + SpaceBetweenYieldOrYieldStarAndOperand: Rule; + SpaceBetweenAsyncAndOpenParen: Rule; + SpaceBetweenAsyncAndFunctionKeyword: Rule; + NoSpaceBetweenTagAndTemplateString: Rule; + NoSpaceAfterTemplateHeadAndMiddle: Rule; + SpaceAfterTemplateHeadAndMiddle: Rule; + NoSpaceBeforeTemplateMiddleAndTail: Rule; + SpaceBeforeTemplateMiddleAndTail: Rule; + constructor(); + static IsForContext(context: FormattingContext): boolean; + static IsNotForContext(context: FormattingContext): boolean; + static IsBinaryOpContext(context: FormattingContext): boolean; + static IsNotBinaryOpContext(context: FormattingContext): boolean; + static IsConditionalOperatorContext(context: FormattingContext): boolean; + static IsSameLineTokenOrBeforeMultilineBlockContext(context: FormattingContext): boolean; + static IsBeforeMultilineBlockContext(context: FormattingContext): boolean; + static IsMultilineBlockContext(context: FormattingContext): boolean; + static IsSingleLineBlockContext(context: FormattingContext): boolean; + static IsBlockContext(context: FormattingContext): boolean; + static IsBeforeBlockContext(context: FormattingContext): boolean; + static NodeIsBlockContext(node: Node): boolean; + static IsFunctionDeclContext(context: FormattingContext): boolean; + static IsFunctionDeclarationOrFunctionExpressionContext(context: FormattingContext): boolean; + static IsTypeScriptDeclWithBlockContext(context: FormattingContext): boolean; + static NodeIsTypeScriptDeclWithBlockContext(node: Node): boolean; + static IsAfterCodeBlockContext(context: FormattingContext): boolean; + static IsControlDeclContext(context: FormattingContext): boolean; + static IsObjectContext(context: FormattingContext): boolean; + static IsFunctionCallContext(context: FormattingContext): boolean; + static IsNewContext(context: FormattingContext): boolean; + static IsFunctionCallOrNewContext(context: FormattingContext): boolean; + static IsPreviousTokenNotComma(context: FormattingContext): boolean; + static IsNextTokenNotCloseBracket(context: FormattingContext): boolean; + static IsArrowFunctionContext(context: FormattingContext): boolean; + static IsNonJsxSameLineTokenContext(context: FormattingContext): boolean; + static IsNotBeforeBlockInFunctionDeclarationContext(context: FormattingContext): boolean; + static IsEndOfDecoratorContextOnSameLine(context: FormattingContext): boolean; + static NodeIsInDecoratorContext(node: Node): boolean; + static IsStartOfVariableDeclarationList(context: FormattingContext): boolean; + static IsNotFormatOnEnter(context: FormattingContext): boolean; + static IsModuleDeclContext(context: FormattingContext): boolean; + static IsObjectTypeContext(context: FormattingContext): boolean; + static IsTypeArgumentOrParameterOrAssertion(token: TextRangeWithKind, parent: Node): boolean; + static IsTypeArgumentOrParameterOrAssertionContext(context: FormattingContext): boolean; + static IsTypeAssertionContext(context: FormattingContext): boolean; + static IsVoidOpContext(context: FormattingContext): boolean; + static IsYieldOrYieldStarWithOperand(context: FormattingContext): boolean; + } +} +declare namespace ts.formatting { + class RulesMap { + map: RulesBucket[]; + mapRowLength: number; + constructor(); + static create(rules: Rule[]): RulesMap; + Initialize(rules: Rule[]): RulesBucket[]; + FillRules(rules: Rule[], rulesBucketConstructionStateList: RulesBucketConstructionState[]): void; + private GetRuleBucketIndex(row, column); + private FillRule(rule, rulesBucketConstructionStateList); + GetRule(context: FormattingContext): Rule; + } + enum RulesPosition { + IgnoreRulesSpecific = 0, + IgnoreRulesAny, + ContextRulesSpecific, + ContextRulesAny, + NoContextRulesSpecific, + NoContextRulesAny, + } + class RulesBucketConstructionState { + private rulesInsertionIndexBitmap; + constructor(); + GetInsertionIndex(maskPosition: RulesPosition): number; + IncreaseInsertionIndex(maskPosition: RulesPosition): void; + } + class RulesBucket { + private rules; + constructor(); + Rules(): Rule[]; + AddRule(rule: Rule, specificTokens: boolean, constructionState: RulesBucketConstructionState[], rulesBucketIndex: number): void; + } +} +declare namespace ts.formatting { + module Shared { + interface ITokenAccess { + GetTokens(): SyntaxKind[]; + Contains(token: SyntaxKind): boolean; + } + class TokenRangeAccess implements ITokenAccess { + private tokens; + constructor(from: SyntaxKind, to: SyntaxKind, except: SyntaxKind[]); + GetTokens(): SyntaxKind[]; + Contains(token: SyntaxKind): boolean; + } + class TokenValuesAccess implements ITokenAccess { + private tokens; + constructor(tks: SyntaxKind[]); + GetTokens(): SyntaxKind[]; + Contains(token: SyntaxKind): boolean; + } + class TokenSingleValueAccess implements ITokenAccess { + token: SyntaxKind; + constructor(token: SyntaxKind); + GetTokens(): SyntaxKind[]; + Contains(tokenValue: SyntaxKind): boolean; + } + class TokenAllAccess implements ITokenAccess { + GetTokens(): SyntaxKind[]; + Contains(tokenValue: SyntaxKind): boolean; + toString(): string; + } + class TokenRange { + tokenAccess: ITokenAccess; + constructor(tokenAccess: ITokenAccess); + static FromToken(token: SyntaxKind): TokenRange; + static FromTokens(tokens: SyntaxKind[]): TokenRange; + static FromRange(f: SyntaxKind, to: SyntaxKind, except?: SyntaxKind[]): TokenRange; + static AllTokens(): TokenRange; + GetTokens(): SyntaxKind[]; + Contains(token: SyntaxKind): boolean; + toString(): string; + static Any: TokenRange; + static AnyIncludingMultilineComments: TokenRange; + static Keywords: TokenRange; + static BinaryOperators: TokenRange; + static BinaryKeywordOperators: TokenRange; + static UnaryPrefixOperators: TokenRange; + static UnaryPrefixExpressions: TokenRange; + static UnaryPreincrementExpressions: TokenRange; + static UnaryPostincrementExpressions: TokenRange; + static UnaryPredecrementExpressions: TokenRange; + static UnaryPostdecrementExpressions: TokenRange; + static Comments: TokenRange; + static TypeNames: TokenRange; + } + } +} +declare namespace ts.formatting { + class RulesProvider { + private globalRules; + private options; + private activeRules; + private rulesMap; + constructor(); + getRuleName(rule: Rule): string; + getRuleByName(name: string): Rule; + getRulesMap(): RulesMap; + ensureUpToDate(options: ts.FormatCodeOptions): void; + private createActiveRules(options); + } +} +declare namespace ts.formatting { + interface TextRangeWithKind extends TextRange { + kind: SyntaxKind; + } + interface TokenInfo { + leadingTrivia: TextRangeWithKind[]; + token: TextRangeWithKind; + trailingTrivia: TextRangeWithKind[]; + } + function formatOnEnter(position: number, sourceFile: SourceFile, rulesProvider: RulesProvider, options: FormatCodeOptions): TextChange[]; + function formatOnSemicolon(position: number, sourceFile: SourceFile, rulesProvider: RulesProvider, options: FormatCodeOptions): TextChange[]; + function formatOnClosingCurly(position: number, sourceFile: SourceFile, rulesProvider: RulesProvider, options: FormatCodeOptions): TextChange[]; + function formatDocument(sourceFile: SourceFile, rulesProvider: RulesProvider, options: FormatCodeOptions): TextChange[]; + function formatSelection(start: number, end: number, sourceFile: SourceFile, rulesProvider: RulesProvider, options: FormatCodeOptions): TextChange[]; + function getIndentationString(indentation: number, options: FormatCodeOptions): string; +} +declare namespace ts.formatting { + module SmartIndenter { + function getIndentation(position: number, sourceFile: SourceFile, options: EditorOptions): number; + function getIndentationForNode(n: Node, ignoreActualIndentationRange: TextRange, sourceFile: SourceFile, options: FormatCodeOptions): number; + function childStartsOnTheSameLineWithElseInIfStatement(parent: Node, child: TextRangeWithKind, childStartLine: number, sourceFile: SourceFile): boolean; + function findFirstNonWhitespaceCharacterAndColumn(startPos: number, endPos: number, sourceFile: SourceFile, options: EditorOptions): { + column: number; + character: number; + }; + function findFirstNonWhitespaceColumn(startPos: number, endPos: number, sourceFile: SourceFile, options: EditorOptions): number; + function nodeWillIndentChild(parent: TextRangeWithKind, child: TextRangeWithKind, indentByDefault: boolean): boolean; + function shouldIndentChildNode(parent: TextRangeWithKind, child?: TextRangeWithKind): boolean; + } +} +declare namespace ts { + const servicesVersion: string; + interface Node { + getSourceFile(): SourceFile; + getChildCount(sourceFile?: SourceFile): number; + getChildAt(index: number, sourceFile?: SourceFile): Node; + getChildren(sourceFile?: SourceFile): Node[]; + getStart(sourceFile?: SourceFile): number; + getFullStart(): number; + getEnd(): number; + getWidth(sourceFile?: SourceFile): number; + getFullWidth(): number; + getLeadingTriviaWidth(sourceFile?: SourceFile): number; + getFullText(sourceFile?: SourceFile): string; + getText(sourceFile?: SourceFile): string; + getFirstToken(sourceFile?: SourceFile): Node; + getLastToken(sourceFile?: SourceFile): Node; + } + interface Symbol { + getFlags(): SymbolFlags; + getName(): string; + getDeclarations(): Declaration[]; + getDocumentationComment(): SymbolDisplayPart[]; + } + interface Type { + getFlags(): TypeFlags; + getSymbol(): Symbol; + getProperties(): Symbol[]; + getProperty(propertyName: string): Symbol; + getApparentProperties(): Symbol[]; + getCallSignatures(): Signature[]; + getConstructSignatures(): Signature[]; + getStringIndexType(): Type; + getNumberIndexType(): Type; + getBaseTypes(): ObjectType[]; + getNonNullableType(): Type; + } + interface Signature { + getDeclaration(): SignatureDeclaration; + getTypeParameters(): Type[]; + getParameters(): Symbol[]; + getReturnType(): Type; + getDocumentationComment(): SymbolDisplayPart[]; + } + interface SourceFile { + version: string; + scriptSnapshot: IScriptSnapshot; + nameTable: Map; + getNamedDeclarations(): Map; + getLineAndCharacterOfPosition(pos: number): LineAndCharacter; + getLineStarts(): number[]; + getPositionOfLineAndCharacter(line: number, character: number): number; + update(newText: string, textChangeRange: TextChangeRange): SourceFile; + } + interface IScriptSnapshot { + getText(start: number, end: number): string; + getLength(): number; + getChangeRange(oldSnapshot: IScriptSnapshot): TextChangeRange; + dispose?(): void; + } + namespace ScriptSnapshot { + function fromString(text: string): IScriptSnapshot; + } + interface PreProcessedFileInfo { + referencedFiles: FileReference[]; + typeReferenceDirectives: FileReference[]; + importedFiles: FileReference[]; + ambientExternalModules: string[]; + isLibFile: boolean; + } + interface HostCancellationToken { + isCancellationRequested(): boolean; + } + interface LanguageServiceHost { + getCompilationSettings(): CompilerOptions; + getNewLine?(): string; + getProjectVersion?(): string; + getScriptFileNames(): string[]; + getScriptKind?(fileName: string): ScriptKind; + getScriptVersion(fileName: string): string; + getScriptSnapshot(fileName: string): IScriptSnapshot | undefined; + getLocalizedDiagnosticMessages?(): any; + getCancellationToken?(): HostCancellationToken; + getCurrentDirectory(): string; + getDefaultLibFileName(options: CompilerOptions): string; + log?(s: string): void; + trace?(s: string): void; + error?(s: string): void; + useCaseSensitiveFileNames?(): boolean; + resolveModuleNames?(moduleNames: string[], containingFile: string): ResolvedModule[]; + resolveTypeReferenceDirectives?(typeDirectiveNames: string[], containingFile: string): ResolvedTypeReferenceDirective[]; + directoryExists?(directoryName: string): boolean; + } + interface LanguageService { + cleanupSemanticCache(): void; + getSyntacticDiagnostics(fileName: string): Diagnostic[]; + getSemanticDiagnostics(fileName: string): Diagnostic[]; + getCompilerOptionsDiagnostics(): Diagnostic[]; + getSyntacticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[]; + getSemanticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[]; + getEncodedSyntacticClassifications(fileName: string, span: TextSpan): Classifications; + getEncodedSemanticClassifications(fileName: string, span: TextSpan): Classifications; + getCompletionsAtPosition(fileName: string, position: number): CompletionInfo; + getCompletionEntryDetails(fileName: string, position: number, entryName: string): CompletionEntryDetails; + getQuickInfoAtPosition(fileName: string, position: number): QuickInfo; + getNameOrDottedNameSpan(fileName: string, startPos: number, endPos: number): TextSpan; + getBreakpointStatementAtPosition(fileName: string, position: number): TextSpan; + getSignatureHelpItems(fileName: string, position: number): SignatureHelpItems; + getRenameInfo(fileName: string, position: number): RenameInfo; + findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean): RenameLocation[]; + getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[]; + getTypeDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[]; + getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[]; + findReferences(fileName: string, position: number): ReferencedSymbol[]; + getDocumentHighlights(fileName: string, position: number, filesToSearch: string[]): DocumentHighlights[]; + getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[]; + getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[]; + getNavigationBarItems(fileName: string): NavigationBarItem[]; + getOutliningSpans(fileName: string): OutliningSpan[]; + getTodoComments(fileName: string, descriptors: TodoCommentDescriptor[]): TodoComment[]; + getBraceMatchingAtPosition(fileName: string, position: number): TextSpan[]; + getIndentationAtPosition(fileName: string, position: number, options: EditorOptions): number; + getFormattingEditsForRange(fileName: string, start: number, end: number, options: FormatCodeOptions): TextChange[]; + getFormattingEditsForDocument(fileName: string, options: FormatCodeOptions): TextChange[]; + getFormattingEditsAfterKeystroke(fileName: string, position: number, key: string, options: FormatCodeOptions): TextChange[]; + getDocCommentTemplateAtPosition(fileName: string, position: number): TextInsertion; + isValidBraceCompletionAtPostion(fileName: string, position: number, openingBrace: number): boolean; + getEmitOutput(fileName: string): EmitOutput; + getProgram(): Program; + getNonBoundSourceFile(fileName: string): SourceFile; + dispose(): void; + } + interface Classifications { + spans: number[]; + endOfLineState: EndOfLineState; + } + interface ClassifiedSpan { + textSpan: TextSpan; + classificationType: string; + } + interface NavigationBarItem { + text: string; + kind: string; + kindModifiers: string; + spans: TextSpan[]; + childItems: NavigationBarItem[]; + indent: number; + bolded: boolean; + grayed: boolean; + } + interface TodoCommentDescriptor { + text: string; + priority: number; + } + interface TodoComment { + descriptor: TodoCommentDescriptor; + message: string; + position: number; + } + class TextChange { + span: TextSpan; + newText: string; + } + interface TextInsertion { + newText: string; + caretOffset: number; + } + interface RenameLocation { + textSpan: TextSpan; + fileName: string; + } + interface ReferenceEntry { + textSpan: TextSpan; + fileName: string; + isWriteAccess: boolean; + } + interface DocumentHighlights { + fileName: string; + highlightSpans: HighlightSpan[]; + } + namespace HighlightSpanKind { + const none: string; + const definition: string; + const reference: string; + const writtenReference: string; + } + interface HighlightSpan { + fileName?: string; + textSpan: TextSpan; + kind: string; + } + interface NavigateToItem { + name: string; + kind: string; + kindModifiers: string; + matchKind: string; + isCaseSensitive: boolean; + fileName: string; + textSpan: TextSpan; + containerName: string; + containerKind: string; + } + interface EditorOptions { + IndentSize: number; + TabSize: number; + NewLineCharacter: string; + ConvertTabsToSpaces: boolean; + IndentStyle: IndentStyle; + } + enum IndentStyle { + None = 0, + Block = 1, + Smart = 2, + } + interface FormatCodeOptions extends EditorOptions { + InsertSpaceAfterCommaDelimiter: boolean; + InsertSpaceAfterSemicolonInForStatements: boolean; + InsertSpaceBeforeAndAfterBinaryOperators: boolean; + InsertSpaceAfterKeywordsInControlFlowStatements: boolean; + InsertSpaceAfterFunctionKeywordForAnonymousFunctions: boolean; + InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean; + InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: boolean; + InsertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: boolean; + PlaceOpenBraceOnNewLineForFunctions: boolean; + PlaceOpenBraceOnNewLineForControlBlocks: boolean; + [s: string]: boolean | number | string; + } + interface DefinitionInfo { + fileName: string; + textSpan: TextSpan; + kind: string; + name: string; + containerKind: string; + containerName: string; + } + interface ReferencedSymbol { + definition: DefinitionInfo; + references: ReferenceEntry[]; + } + enum SymbolDisplayPartKind { + aliasName = 0, + className = 1, + enumName = 2, + fieldName = 3, + interfaceName = 4, + keyword = 5, + lineBreak = 6, + numericLiteral = 7, + stringLiteral = 8, + localName = 9, + methodName = 10, + moduleName = 11, + operator = 12, + parameterName = 13, + propertyName = 14, + punctuation = 15, + space = 16, + text = 17, + typeParameterName = 18, + enumMemberName = 19, + functionName = 20, + regularExpressionLiteral = 21, + } + interface SymbolDisplayPart { + text: string; + kind: string; + } + interface QuickInfo { + kind: string; + kindModifiers: string; + textSpan: TextSpan; + displayParts: SymbolDisplayPart[]; + documentation: SymbolDisplayPart[]; + } + interface RenameInfo { + canRename: boolean; + localizedErrorMessage: string; + displayName: string; + fullDisplayName: string; + kind: string; + kindModifiers: string; + triggerSpan: TextSpan; + } + interface SignatureHelpParameter { + name: string; + documentation: SymbolDisplayPart[]; + displayParts: SymbolDisplayPart[]; + isOptional: boolean; + } + interface SignatureHelpItem { + isVariadic: boolean; + prefixDisplayParts: SymbolDisplayPart[]; + suffixDisplayParts: SymbolDisplayPart[]; + separatorDisplayParts: SymbolDisplayPart[]; + parameters: SignatureHelpParameter[]; + documentation: SymbolDisplayPart[]; + } + interface SignatureHelpItems { + items: SignatureHelpItem[]; + applicableSpan: TextSpan; + selectedItemIndex: number; + argumentIndex: number; + argumentCount: number; + } + interface CompletionInfo { + isMemberCompletion: boolean; + isNewIdentifierLocation: boolean; + entries: CompletionEntry[]; + } + interface CompletionEntry { + name: string; + kind: string; + kindModifiers: string; + sortText: string; + } + interface CompletionEntryDetails { + name: string; + kind: string; + kindModifiers: string; + displayParts: SymbolDisplayPart[]; + documentation: SymbolDisplayPart[]; + } + interface OutliningSpan { + textSpan: TextSpan; + hintSpan: TextSpan; + bannerText: string; + autoCollapse: boolean; + } + interface EmitOutput { + outputFiles: OutputFile[]; + emitSkipped: boolean; + } + const enum OutputFileType { + JavaScript = 0, + SourceMap = 1, + Declaration = 2, + } + interface OutputFile { + name: string; + writeByteOrderMark: boolean; + text: string; + } + const enum EndOfLineState { + None = 0, + InMultiLineCommentTrivia = 1, + InSingleQuoteStringLiteral = 2, + InDoubleQuoteStringLiteral = 3, + InTemplateHeadOrNoSubstitutionTemplate = 4, + InTemplateMiddleOrTail = 5, + InTemplateSubstitutionPosition = 6, + } + enum TokenClass { + Punctuation = 0, + Keyword = 1, + Operator = 2, + Comment = 3, + Whitespace = 4, + Identifier = 5, + NumberLiteral = 6, + StringLiteral = 7, + RegExpLiteral = 8, + } + interface ClassificationResult { + finalLexState: EndOfLineState; + entries: ClassificationInfo[]; + } + interface ClassificationInfo { + length: number; + classification: TokenClass; + } + interface Classifier { + getClassificationsForLine(text: string, lexState: EndOfLineState, syntacticClassifierAbsent: boolean): ClassificationResult; + getEncodedLexicalClassifications(text: string, endOfLineState: EndOfLineState, syntacticClassifierAbsent: boolean): Classifications; + } + interface DocumentRegistry { + 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; + 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; + releaseDocument(fileName: string, compilationSettings: CompilerOptions): void; + releaseDocumentWithKey(path: Path, key: DocumentRegistryBucketKey): void; + reportStats(): string; + } + type DocumentRegistryBucketKey = string & { + __bucketKey: any; + }; + namespace ScriptElementKind { + const unknown: string; + const warning: string; + const keyword: string; + const scriptElement: string; + const moduleElement: string; + const classElement: string; + const localClassElement: string; + const interfaceElement: string; + const typeElement: string; + const enumElement: string; + const variableElement: string; + const localVariableElement: string; + const functionElement: string; + const localFunctionElement: string; + const memberFunctionElement: string; + const memberGetAccessorElement: string; + const memberSetAccessorElement: string; + const memberVariableElement: string; + const constructorImplementationElement: string; + const callSignatureElement: string; + const indexSignatureElement: string; + const constructSignatureElement: string; + const parameterElement: string; + const typeParameterElement: string; + const primitiveType: string; + const label: string; + const alias: string; + const constElement: string; + const letElement: string; + } + namespace ScriptElementKindModifier { + const none: string; + const publicMemberModifier: string; + const privateMemberModifier: string; + const protectedMemberModifier: string; + const exportedModifier: string; + const ambientModifier: string; + const staticModifier: string; + const abstractModifier: string; + } + class ClassificationTypeNames { + static comment: string; + static identifier: string; + static keyword: string; + static numericLiteral: string; + static operator: string; + static stringLiteral: string; + static whiteSpace: string; + static text: string; + static punctuation: string; + static className: string; + static enumName: string; + static interfaceName: string; + static moduleName: string; + static typeParameterName: string; + static typeAliasName: string; + static parameterName: string; + static docCommentTagName: string; + static jsxOpenTagName: string; + static jsxCloseTagName: string; + static jsxSelfClosingTagName: string; + static jsxAttribute: string; + static jsxText: string; + static jsxAttributeStringLiteralValue: string; + } + const enum ClassificationType { + comment = 1, + identifier = 2, + keyword = 3, + numericLiteral = 4, + operator = 5, + stringLiteral = 6, + regularExpressionLiteral = 7, + whiteSpace = 8, + text = 9, + punctuation = 10, + className = 11, + enumName = 12, + interfaceName = 13, + moduleName = 14, + typeParameterName = 15, + typeAliasName = 16, + parameterName = 17, + docCommentTagName = 18, + jsxOpenTagName = 19, + jsxCloseTagName = 20, + jsxSelfClosingTagName = 21, + jsxAttribute = 22, + jsxText = 23, + jsxAttributeStringLiteralValue = 24, + } + interface DisplayPartsSymbolWriter extends SymbolWriter { + displayParts(): SymbolDisplayPart[]; + } + function displayPartsToString(displayParts: SymbolDisplayPart[]): string; + function getDefaultCompilerOptions(): CompilerOptions; + interface TranspileOptions { + compilerOptions?: CompilerOptions; + fileName?: string; + reportDiagnostics?: boolean; + moduleName?: string; + renamedDependencies?: Map; + } + interface TranspileOutput { + outputText: string; + diagnostics?: Diagnostic[]; + sourceMapText?: string; + } + function transpileModule(input: string, transpileOptions: TranspileOptions): TranspileOutput; + function transpile(input: string, compilerOptions?: CompilerOptions, fileName?: string, diagnostics?: Diagnostic[], moduleName?: string): string; + function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean, scriptKind?: ScriptKind): SourceFile; + let disableIncrementalParsing: boolean; + function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile; + function createDocumentRegistry(useCaseSensitiveFileNames?: boolean, currentDirectory?: string): DocumentRegistry; + function preProcessFile(sourceText: string, readImportFiles?: boolean, detectJavaScriptImports?: boolean): PreProcessedFileInfo; + function getContainerNode(node: Node): Declaration; + function getNodeKind(node: Node): string; + function createLanguageService(host: LanguageServiceHost, documentRegistry?: DocumentRegistry): LanguageService; + function getNameTable(sourceFile: SourceFile): Map; + function createClassifier(): Classifier; + function getDefaultLibFilePath(options: CompilerOptions): string; +} +declare namespace ts.server { + function generateSpaces(n: number): string; + function generateIndentString(n: number, editorOptions: EditorOptions): string; + interface PendingErrorCheck { + fileName: string; + project: Project; + } + namespace CommandNames { + const Brace: string; + const Change: string; + const Close: string; + const Completions: string; + const CompletionDetails: string; + const Configure: string; + const Definition: string; + const Exit: string; + const Format: string; + const Formatonkey: string; + const Geterr: string; + const GeterrForProject: string; + const NavBar: string; + const Navto: string; + const Occurrences: string; + const DocumentHighlights: string; + const Open: string; + const Quickinfo: string; + const References: string; + const Reload: string; + const Rename: string; + const Saveto: string; + const SignatureHelp: string; + const TypeDefinition: string; + const ProjectInfo: string; + const ReloadProjects: string; + const Unknown: string; + } + interface ServerHost extends ts.System { + setTimeout(callback: (...args: any[]) => void, ms: number, ...args: any[]): any; + clearTimeout(timeoutId: any): void; + } + class Session { + private host; + private byteLength; + private hrtime; + private logger; + protected projectService: ProjectService; + private errorTimer; + private immediateId; + private changeSeq; + constructor(host: ServerHost, byteLength: (buf: string, encoding?: string) => number, hrtime: (start?: number[]) => number[], logger: Logger); + private handleEvent(eventName, project, fileName); + logError(err: Error, cmd: string): void; + private sendLineToClient(line); + send(msg: protocol.Message): void; + configFileDiagnosticEvent(triggerFile: string, configFile: string, diagnostics: ts.Diagnostic[]): void; + event(info: any, eventName: string): void; + private response(info, cmdName, reqSeq?, errorMsg?); + output(body: any, commandName: string, requestSequence?: number, errorMessage?: string): void; + private semanticCheck(file, project); + private syntacticCheck(file, project); + private reloadProjects(); + private updateProjectStructure(seq, matchSeq, ms?); + private updateErrorCheck(checkList, seq, matchSeq, ms?, followMs?, requireOpen?); + private getDefinition(line, offset, fileName); + private getTypeDefinition(line, offset, fileName); + private getOccurrences(line, offset, fileName); + private getDocumentHighlights(line, offset, fileName, filesToSearch); + private getProjectInfo(fileName, needFileNameList); + private getRenameLocations(line, offset, fileName, findInComments, findInStrings); + private getReferences(line, offset, fileName); + private openClientFile(fileName, fileContent?, scriptKind?); + private getQuickInfo(line, offset, fileName); + private getFormattingEditsForRange(line, offset, endLine, endOffset, fileName); + private getFormattingEditsAfterKeystroke(line, offset, key, fileName); + private getCompletions(line, offset, prefix, fileName); + private getCompletionEntryDetails(line, offset, entryNames, fileName); + private getSignatureHelpItems(line, offset, fileName); + private getDiagnostics(delay, fileNames); + private change(line, offset, endLine, endOffset, insertString, fileName); + private reload(fileName, tempFileName, reqSeq?); + private saveToTmp(fileName, tempFileName); + private closeClientFile(fileName); + private decorateNavigationBarItem(project, fileName, items); + private getNavigationBarItems(fileName); + private getNavigateToItems(searchValue, fileName, maxResultCount?); + private getBraceMatching(line, offset, fileName); + getDiagnosticsForProject(delay: number, fileName: string): void; + getCanonicalFileName(fileName: string): string; + exit(): void; + private handlers; + addProtocolHandler(command: string, handler: (request: protocol.Request) => { + response?: any; + responseRequired: boolean; + }): void; + executeCommand(request: protocol.Request): { + response?: any; + responseRequired?: boolean; + }; + onMessage(message: string): void; + } +} +declare namespace ts.server { + interface Logger { + close(): void; + isVerbose(): boolean; + loggingEnabled(): boolean; + perftrc(s: string): void; + info(s: string): void; + startGroup(): void; + endGroup(): void; + msg(s: string, type?: string): void; + } + class ScriptInfo { + private host; + fileName: string; + content: string; + isOpen: boolean; + svc: ScriptVersionCache; + children: ScriptInfo[]; + defaultProject: Project; + fileWatcher: FileWatcher; + formatCodeOptions: FormatCodeOptions; + path: Path; + scriptKind: ScriptKind; + constructor(host: ServerHost, fileName: string, content: string, isOpen?: boolean); + setFormatOptions(formatOptions: protocol.FormatOptions): void; + close(): void; + addChild(childInfo: ScriptInfo): void; + snap(): LineIndexSnapshot; + getText(): string; + getLineInfo(line: number): ILineInfo; + editContent(start: number, end: number, newText: string): void; + getTextChangeRangeBetweenVersions(startVersion: number, endVersion: number): ts.TextChangeRange; + getChangeRange(oldSnapshot: ts.IScriptSnapshot): ts.TextChangeRange; + } + class LSHost implements ts.LanguageServiceHost { + host: ServerHost; + project: Project; + ls: ts.LanguageService; + compilationSettings: ts.CompilerOptions; + filenameToScript: ts.FileMap; + roots: ScriptInfo[]; + private resolvedModuleNames; + private resolvedTypeReferenceDirectives; + private moduleResolutionHost; + private getCanonicalFileName; + constructor(host: ServerHost, project: Project); + private resolveNamesWithLocalCache(names, containingFile, cache, loader, getResult); + resolveTypeReferenceDirectives(typeDirectiveNames: string[], containingFile: string): ResolvedTypeReferenceDirective[]; + resolveModuleNames(moduleNames: string[], containingFile: string): ResolvedModule[]; + getDefaultLibFileName(): string; + getScriptSnapshot(filename: string): ts.IScriptSnapshot; + setCompilationSettings(opt: ts.CompilerOptions): void; + lineAffectsRefs(filename: string, line: number): boolean; + getCompilationSettings(): CompilerOptions; + getScriptFileNames(): string[]; + getScriptKind(fileName: string): ScriptKind; + getScriptVersion(filename: string): string; + getCurrentDirectory(): string; + getScriptIsOpen(filename: string): boolean; + removeReferencedFile(info: ScriptInfo): void; + getScriptInfo(filename: string): ScriptInfo; + addRoot(info: ScriptInfo): void; + removeRoot(info: ScriptInfo): void; + saveTo(filename: string, tmpfilename: string): void; + reloadScript(filename: string, tmpfilename: string, cb: () => any): void; + editScript(filename: string, start: number, end: number, newText: string): void; + resolvePath(path: string): string; + fileExists(path: string): boolean; + directoryExists(path: string): boolean; + lineToTextSpan(filename: string, line: number): ts.TextSpan; + lineOffsetToPosition(filename: string, line: number, offset: number): number; + positionToLineOffset(filename: string, position: number): ILineInfo; + } + interface ProjectOptions { + files?: string[]; + compilerOptions?: ts.CompilerOptions; + } + class Project { + projectService: ProjectService; + projectOptions?: ProjectOptions; + compilerService: CompilerService; + projectFilename: string; + projectFileWatcher: FileWatcher; + directoryWatcher: FileWatcher; + directoriesWatchedForTsconfig: string[]; + program: ts.Program; + filenameToSourceFile: ts.Map; + updateGraphSeq: number; + openRefCount: number; + constructor(projectService: ProjectService, projectOptions?: ProjectOptions); + addOpenRef(): void; + deleteOpenRef(): number; + openReferencedFile(filename: string): ScriptInfo; + getRootFiles(): string[]; + getFileNames(): string[]; + getSourceFile(info: ScriptInfo): SourceFile; + getSourceFileFromName(filename: string, requireOpen?: boolean): SourceFile; + isRoot(info: ScriptInfo): boolean; + removeReferencedFile(info: ScriptInfo): void; + updateFileMap(): void; + finishGraph(): void; + updateGraph(): void; + isConfiguredProject(): string; + addRoot(info: ScriptInfo): void; + removeRoot(info: ScriptInfo): void; + filesToString(): string; + setProjectOptions(projectOptions: ProjectOptions): void; + } + interface ProjectOpenResult { + success?: boolean; + errorMsg?: string; + project?: Project; + } + function combineProjectOutput(projects: Project[], action: (project: Project) => T[], comparer?: (a: T, b: T) => number, areEqual?: (a: T, b: T) => boolean): T[]; + interface ProjectServiceEventHandler { + (eventName: string, project: Project, fileName: string): void; + } + interface HostConfiguration { + formatCodeOptions: ts.FormatCodeOptions; + hostInfo: string; + } + class ProjectService { + host: ServerHost; + psLogger: Logger; + eventHandler?: ProjectServiceEventHandler; + filenameToScriptInfo: ts.Map; + openFileRoots: ScriptInfo[]; + inferredProjects: Project[]; + configuredProjects: Project[]; + openFilesReferenced: ScriptInfo[]; + openFileRootsConfigured: ScriptInfo[]; + directoryWatchersForTsconfig: ts.Map; + directoryWatchersRefCount: ts.Map; + hostConfiguration: HostConfiguration; + timerForDetectingProjectFileListChanges: Map; + constructor(host: ServerHost, psLogger: Logger, eventHandler?: ProjectServiceEventHandler); + addDefaultHostConfiguration(): void; + getFormatCodeOptions(file?: string): FormatCodeOptions; + watchedFileChanged(fileName: string): void; + directoryWatchedForSourceFilesChanged(project: Project, fileName: string): void; + startTimerForDetectingProjectFileListChanges(project: Project): void; + handleProjectFileListChanges(project: Project): void; + directoryWatchedForTsconfigChanged(fileName: string): void; + getCanonicalFileName(fileName: string): string; + watchedProjectConfigFileChanged(project: Project): void; + log(msg: string, type?: string): void; + setHostConfiguration(args: ts.server.protocol.ConfigureRequestArguments): void; + closeLog(): void; + createInferredProject(root: ScriptInfo): Project; + fileDeletedInFilesystem(info: ScriptInfo): void; + updateConfiguredProjectList(): void; + removeProject(project: Project): void; + setConfiguredProjectRoot(info: ScriptInfo): boolean; + addOpenFile(info: ScriptInfo): void; + closeOpenFile(info: ScriptInfo): void; + findReferencingProjects(info: ScriptInfo, excludedProject?: Project): Project[]; + reloadProjects(): void; + updateProjectStructure(): void; + getScriptInfo(filename: string): ScriptInfo; + openFile(fileName: string, openedByClient: boolean, fileContent?: string, scriptKind?: ScriptKind): ScriptInfo; + findConfigFile(searchPath: string): string; + openClientFile(fileName: string, fileContent?: string, scriptKind?: ScriptKind): { + configFileName?: string; + configFileErrors?: Diagnostic[]; + }; + openOrUpdateConfiguredProjectForFile(fileName: string): { + configFileName?: string; + configFileErrors?: Diagnostic[]; + }; + closeClientFile(filename: string): void; + getProjectForFile(filename: string): Project; + printProjectsForFile(filename: string): void; + printProjects(): void; + configProjectIsActive(fileName: string): boolean; + findConfiguredProjectByConfigFile(configFileName: string): Project; + configFileToProjectOptions(configFilename: string): { + succeeded: boolean; + projectOptions?: ProjectOptions; + errors?: Diagnostic[]; + }; + openConfigFile(configFilename: string, clientFileName?: string): { + success: boolean; + project?: Project; + errors?: Diagnostic[]; + }; + updateConfiguredProject(project: Project): Diagnostic[]; + createProject(projectFilename: string, projectOptions?: ProjectOptions): Project; + } + class CompilerService { + project: Project; + host: LSHost; + languageService: ts.LanguageService; + classifier: ts.Classifier; + settings: ts.CompilerOptions; + documentRegistry: DocumentRegistry; + constructor(project: Project, opt?: ts.CompilerOptions); + setCompilerOptions(opt: ts.CompilerOptions): void; + isExternalModule(filename: string): boolean; + static getDefaultFormatCodeOptions(host: ServerHost): ts.FormatCodeOptions; + } + interface LineCollection { + charCount(): number; + lineCount(): number; + isLeaf(): boolean; + walk(rangeStart: number, rangeLength: number, walkFns: ILineIndexWalker): void; + } + interface ILineInfo { + line: number; + offset: number; + text?: string; + leaf?: LineLeaf; + } + enum CharRangeSection { + PreStart = 0, + Start = 1, + Entire = 2, + Mid = 3, + End = 4, + PostEnd = 5, + } + interface ILineIndexWalker { + goSubtree: boolean; + done: boolean; + leaf(relativeStart: number, relativeLength: number, lineCollection: LineLeaf): void; + pre?(relativeStart: number, relativeLength: number, lineCollection: LineCollection, parent: LineNode, nodeType: CharRangeSection): LineCollection; + post?(relativeStart: number, relativeLength: number, lineCollection: LineCollection, parent: LineNode, nodeType: CharRangeSection): LineCollection; + } + class TextChange { + pos: number; + deleteLen: number; + insertedText?: string; + constructor(pos: number, deleteLen: number, insertedText?: string); + getTextChangeRange(): TextChangeRange; + } + class ScriptVersionCache { + changes: TextChange[]; + versions: LineIndexSnapshot[]; + minVersion: number; + private currentVersion; + private host; + static changeNumberThreshold: number; + static changeLengthThreshold: number; + static maxVersions: number; + edit(pos: number, deleteLen: number, insertedText?: string): void; + latest(): LineIndexSnapshot; + latestVersion(): number; + reloadFromFile(filename: string, cb?: () => any): void; + reload(script: string): void; + getSnapshot(): LineIndexSnapshot; + getTextChangesBetweenVersions(oldVersion: number, newVersion: number): TextChangeRange; + static fromString(host: ServerHost, script: string): ScriptVersionCache; + } + class LineIndexSnapshot implements ts.IScriptSnapshot { + version: number; + cache: ScriptVersionCache; + index: LineIndex; + changesSincePreviousVersion: TextChange[]; + constructor(version: number, cache: ScriptVersionCache); + getText(rangeStart: number, rangeEnd: number): string; + getLength(): number; + getLineStartPositions(): number[]; + getLineMapper(): (line: number) => number; + getTextChangeRangeSinceVersion(scriptVersion: number): TextChangeRange; + getChangeRange(oldSnapshot: ts.IScriptSnapshot): ts.TextChangeRange; + } + class LineIndex { + root: LineNode; + checkEdits: boolean; + charOffsetToLineNumberAndPos(charOffset: number): ILineInfo; + lineNumberToInfo(lineNumber: number): ILineInfo; + load(lines: string[]): void; + walk(rangeStart: number, rangeLength: number, walkFns: ILineIndexWalker): void; + getText(rangeStart: number, rangeLength: number): string; + getLength(): number; + every(f: (ll: LineLeaf, s: number, len: number) => boolean, rangeStart: number, rangeEnd?: number): boolean; + edit(pos: number, deleteLength: number, newText?: string): LineIndex; + static buildTreeFromBottom(nodes: LineCollection[]): LineNode; + static linesFromText(text: string): { + lines: string[]; + lineMap: number[]; + }; + } + class LineNode implements LineCollection { + totalChars: number; + totalLines: number; + children: LineCollection[]; + isLeaf(): boolean; + updateCounts(): void; + execWalk(rangeStart: number, rangeLength: number, walkFns: ILineIndexWalker, childIndex: number, nodeType: CharRangeSection): boolean; + skipChild(relativeStart: number, relativeLength: number, childIndex: number, walkFns: ILineIndexWalker, nodeType: CharRangeSection): void; + walk(rangeStart: number, rangeLength: number, walkFns: ILineIndexWalker): void; + charOffsetToLineNumberAndPos(lineNumber: number, charOffset: number): ILineInfo; + lineNumberToInfo(lineNumber: number, charOffset: number): ILineInfo; + childFromLineNumber(lineNumber: number, charOffset: number): { + child: LineCollection; + childIndex: number; + relativeLineNumber: number; + charOffset: number; + }; + childFromCharOffset(lineNumber: number, charOffset: number): { + child: LineCollection; + childIndex: number; + charOffset: number; + lineNumber: number; + }; + splitAfter(childIndex: number): LineNode; + remove(child: LineCollection): void; + findChildIndex(child: LineCollection): number; + insertAt(child: LineCollection, nodes: LineCollection[]): LineNode[]; + add(collection: LineCollection): boolean; + charCount(): number; + lineCount(): number; + } + class LineLeaf implements LineCollection { + text: string; + udata: any; + constructor(text: string); + setUdata(data: any): void; + getUdata(): any; + isLeaf(): boolean; + walk(rangeStart: number, rangeLength: number, walkFns: ILineIndexWalker): void; + charCount(): number; + lineCount(): number; + } +} +declare let debugObjectHost: any; +declare namespace ts { + interface ScriptSnapshotShim { + getText(start: number, end: number): string; + getLength(): number; + getChangeRange(oldSnapshot: ScriptSnapshotShim): string; + dispose?(): void; + } + interface Logger { + log(s: string): void; + trace(s: string): void; + error(s: string): void; + } + interface LanguageServiceShimHost extends Logger { + getCompilationSettings(): string; + getScriptFileNames(): string; + getScriptKind?(fileName: string): ScriptKind; + getScriptVersion(fileName: string): string; + getScriptSnapshot(fileName: string): ScriptSnapshotShim; + getLocalizedDiagnosticMessages(): string; + getCancellationToken(): HostCancellationToken; + getCurrentDirectory(): string; + getDefaultLibFileName(options: string): string; + getNewLine?(): string; + getProjectVersion?(): string; + useCaseSensitiveFileNames?(): boolean; + getModuleResolutionsForFile?(fileName: string): string; + getTypeReferenceDirectiveResolutionsForFile?(fileName: string): string; + directoryExists(directoryName: string): boolean; + } + interface CoreServicesShimHost extends Logger, ModuleResolutionHost { + readDirectory(rootDir: string, extension: string, exclude?: string, depth?: number): string; + trace(s: string): void; + } + interface IFileReference { + path: string; + position: number; + length: number; + } + interface ShimFactory { + registerShim(shim: Shim): void; + unregisterShim(shim: Shim): void; + } + interface Shim { + dispose(dummy: any): void; + } + interface LanguageServiceShim extends Shim { + languageService: LanguageService; + dispose(dummy: any): void; + refresh(throwOnError: boolean): void; + cleanupSemanticCache(): void; + getSyntacticDiagnostics(fileName: string): string; + getSemanticDiagnostics(fileName: string): string; + getCompilerOptionsDiagnostics(): string; + getSyntacticClassifications(fileName: string, start: number, length: number): string; + getSemanticClassifications(fileName: string, start: number, length: number): string; + getEncodedSyntacticClassifications(fileName: string, start: number, length: number): string; + getEncodedSemanticClassifications(fileName: string, start: number, length: number): string; + getCompletionsAtPosition(fileName: string, position: number): string; + getCompletionEntryDetails(fileName: string, position: number, entryName: string): string; + getQuickInfoAtPosition(fileName: string, position: number): string; + getNameOrDottedNameSpan(fileName: string, startPos: number, endPos: number): string; + getBreakpointStatementAtPosition(fileName: string, position: number): string; + getSignatureHelpItems(fileName: string, position: number): string; + getRenameInfo(fileName: string, position: number): string; + findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean): string; + getDefinitionAtPosition(fileName: string, position: number): string; + getTypeDefinitionAtPosition(fileName: string, position: number): string; + getReferencesAtPosition(fileName: string, position: number): string; + findReferences(fileName: string, position: number): string; + getOccurrencesAtPosition(fileName: string, position: number): string; + getDocumentHighlights(fileName: string, position: number, filesToSearch: string): string; + getNavigateToItems(searchValue: string, maxResultCount?: number): string; + getNavigationBarItems(fileName: string): string; + getOutliningSpans(fileName: string): string; + getTodoComments(fileName: string, todoCommentDescriptors: string): string; + getBraceMatchingAtPosition(fileName: string, position: number): string; + getIndentationAtPosition(fileName: string, position: number, options: string): string; + getFormattingEditsForRange(fileName: string, start: number, end: number, options: string): string; + getFormattingEditsForDocument(fileName: string, options: string): string; + getFormattingEditsAfterKeystroke(fileName: string, position: number, key: string, options: string): string; + getDocCommentTemplateAtPosition(fileName: string, position: number): string; + isValidBraceCompletionAtPostion(fileName: string, position: number, openingBrace: number): string; + getEmitOutput(fileName: string): string; + } + interface ClassifierShim extends Shim { + getEncodedLexicalClassifications(text: string, lexState: EndOfLineState, syntacticClassifierAbsent?: boolean): string; + getClassificationsForLine(text: string, lexState: EndOfLineState, syntacticClassifierAbsent?: boolean): string; + } + interface CoreServicesShim extends Shim { + getPreProcessedFileInfo(fileName: string, sourceText: IScriptSnapshot): string; + getTSConfigFileInfo(fileName: string, sourceText: IScriptSnapshot): string; + getDefaultCompilationSettings(): string; + discoverTypings(discoverTypingsJson: string): string; + } + class LanguageServiceShimHostAdapter implements LanguageServiceHost { + private shimHost; + private files; + private loggingEnabled; + private tracingEnabled; + resolveModuleNames: (moduleName: string[], containingFile: string) => ResolvedModule[]; + resolveTypeReferenceDirectives: (typeDirectiveNames: string[], containingFile: string) => ResolvedTypeReferenceDirective[]; + directoryExists: (directoryName: string) => boolean; + constructor(shimHost: LanguageServiceShimHost); + log(s: string): void; + trace(s: string): void; + error(s: string): void; + getProjectVersion(): string; + useCaseSensitiveFileNames(): boolean; + getCompilationSettings(): CompilerOptions; + getScriptFileNames(): string[]; + getScriptSnapshot(fileName: string): IScriptSnapshot; + getScriptKind(fileName: string): ScriptKind; + getScriptVersion(fileName: string): string; + getLocalizedDiagnosticMessages(): any; + getCancellationToken(): HostCancellationToken; + getCurrentDirectory(): string; + getDefaultLibFileName(options: CompilerOptions): string; + } + class CoreServicesShimHostAdapter implements ParseConfigHost, ModuleResolutionHost { + private shimHost; + directoryExists: (directoryName: string) => boolean; + realpath: (path: string) => string; + constructor(shimHost: CoreServicesShimHost); + readDirectory(rootDir: string, extension: string, exclude: string[], depth?: number): string[]; + fileExists(fileName: string): boolean; + readFile(fileName: string): string; + } + function realizeDiagnostics(diagnostics: Diagnostic[], newLine: string): { + message: string; + start: number; + length: number; + category: string; + code: number; + }[]; + class TypeScriptServicesFactory implements ShimFactory { + private _shims; + private documentRegistry; + getServicesVersion(): string; + createLanguageServiceShim(host: LanguageServiceShimHost): LanguageServiceShim; + createClassifierShim(logger: Logger): ClassifierShim; + createCoreServicesShim(host: CoreServicesShimHost): CoreServicesShim; + close(): void; + registerShim(shim: Shim): void; + unregisterShim(shim: Shim): void; + } +} +declare namespace TypeScript.Services { + const TypeScriptServicesFactory: typeof ts.TypeScriptServicesFactory; +} +declare const toolsVersion: string; diff --git a/lib/tsserverlibrary.js b/lib/tsserverlibrary.js new file mode 100644 index 00000000000..050d9ca265d --- /dev/null +++ b/lib/tsserverlibrary.js @@ -0,0 +1,51467 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ + +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var ts; +(function (ts) { + var OperationCanceledException = (function () { + function OperationCanceledException() { + } + return OperationCanceledException; + }()); + ts.OperationCanceledException = OperationCanceledException; + (function (ExitStatus) { + ExitStatus[ExitStatus["Success"] = 0] = "Success"; + ExitStatus[ExitStatus["DiagnosticsPresent_OutputsSkipped"] = 1] = "DiagnosticsPresent_OutputsSkipped"; + ExitStatus[ExitStatus["DiagnosticsPresent_OutputsGenerated"] = 2] = "DiagnosticsPresent_OutputsGenerated"; + })(ts.ExitStatus || (ts.ExitStatus = {})); + var ExitStatus = ts.ExitStatus; + (function (TypeReferenceSerializationKind) { + TypeReferenceSerializationKind[TypeReferenceSerializationKind["Unknown"] = 0] = "Unknown"; + TypeReferenceSerializationKind[TypeReferenceSerializationKind["TypeWithConstructSignatureAndValue"] = 1] = "TypeWithConstructSignatureAndValue"; + TypeReferenceSerializationKind[TypeReferenceSerializationKind["VoidType"] = 2] = "VoidType"; + TypeReferenceSerializationKind[TypeReferenceSerializationKind["NumberLikeType"] = 3] = "NumberLikeType"; + TypeReferenceSerializationKind[TypeReferenceSerializationKind["StringLikeType"] = 4] = "StringLikeType"; + TypeReferenceSerializationKind[TypeReferenceSerializationKind["BooleanType"] = 5] = "BooleanType"; + TypeReferenceSerializationKind[TypeReferenceSerializationKind["ArrayLikeType"] = 6] = "ArrayLikeType"; + TypeReferenceSerializationKind[TypeReferenceSerializationKind["ESSymbolType"] = 7] = "ESSymbolType"; + TypeReferenceSerializationKind[TypeReferenceSerializationKind["TypeWithCallSignature"] = 8] = "TypeWithCallSignature"; + TypeReferenceSerializationKind[TypeReferenceSerializationKind["ObjectType"] = 9] = "ObjectType"; + })(ts.TypeReferenceSerializationKind || (ts.TypeReferenceSerializationKind = {})); + var TypeReferenceSerializationKind = ts.TypeReferenceSerializationKind; + (function (DiagnosticCategory) { + DiagnosticCategory[DiagnosticCategory["Warning"] = 0] = "Warning"; + DiagnosticCategory[DiagnosticCategory["Error"] = 1] = "Error"; + DiagnosticCategory[DiagnosticCategory["Message"] = 2] = "Message"; + })(ts.DiagnosticCategory || (ts.DiagnosticCategory = {})); + var DiagnosticCategory = ts.DiagnosticCategory; + (function (ModuleResolutionKind) { + ModuleResolutionKind[ModuleResolutionKind["Classic"] = 1] = "Classic"; + ModuleResolutionKind[ModuleResolutionKind["NodeJs"] = 2] = "NodeJs"; + })(ts.ModuleResolutionKind || (ts.ModuleResolutionKind = {})); + var ModuleResolutionKind = ts.ModuleResolutionKind; + (function (ModuleKind) { + ModuleKind[ModuleKind["None"] = 0] = "None"; + ModuleKind[ModuleKind["CommonJS"] = 1] = "CommonJS"; + ModuleKind[ModuleKind["AMD"] = 2] = "AMD"; + ModuleKind[ModuleKind["UMD"] = 3] = "UMD"; + ModuleKind[ModuleKind["System"] = 4] = "System"; + ModuleKind[ModuleKind["ES6"] = 5] = "ES6"; + ModuleKind[ModuleKind["ES2015"] = 5] = "ES2015"; + })(ts.ModuleKind || (ts.ModuleKind = {})); + var ModuleKind = ts.ModuleKind; +})(ts || (ts = {})); +var ts; +(function (ts) { + function createFileMap(keyMapper) { + var files = {}; + return { + get: get, + set: set, + contains: contains, + remove: remove, + forEachValue: forEachValueInMap, + clear: clear + }; + function forEachValueInMap(f) { + for (var key in files) { + f(key, files[key]); + } + } + function get(path) { + return files[toKey(path)]; + } + function set(path, value) { + files[toKey(path)] = value; + } + function contains(path) { + return hasProperty(files, toKey(path)); + } + function remove(path) { + var key = toKey(path); + delete files[key]; + } + function clear() { + files = {}; + } + function toKey(path) { + return keyMapper ? keyMapper(path) : path; + } + } + ts.createFileMap = createFileMap; + function toPath(fileName, basePath, getCanonicalFileName) { + var nonCanonicalizedPath = isRootedDiskPath(fileName) + ? normalizePath(fileName) + : getNormalizedAbsolutePath(fileName, basePath); + return getCanonicalFileName(nonCanonicalizedPath); + } + ts.toPath = toPath; + function forEach(array, callback) { + if (array) { + for (var i = 0, len = array.length; i < len; i++) { + var result = callback(array[i], i); + if (result) { + return result; + } + } + } + return undefined; + } + ts.forEach = forEach; + function contains(array, value, areEqual) { + if (array) { + for (var _i = 0, array_1 = array; _i < array_1.length; _i++) { + var v = array_1[_i]; + if (areEqual ? areEqual(v, value) : v === value) { + return true; + } + } + } + return false; + } + ts.contains = contains; + function indexOf(array, value) { + if (array) { + for (var i = 0, len = array.length; i < len; i++) { + if (array[i] === value) { + return i; + } + } + } + return -1; + } + ts.indexOf = indexOf; + function countWhere(array, predicate) { + var count = 0; + if (array) { + for (var _i = 0, array_2 = array; _i < array_2.length; _i++) { + var v = array_2[_i]; + if (predicate(v)) { + count++; + } + } + } + return count; + } + ts.countWhere = countWhere; + function filter(array, f) { + var result; + if (array) { + result = []; + for (var _i = 0, array_3 = array; _i < array_3.length; _i++) { + var item = array_3[_i]; + if (f(item)) { + result.push(item); + } + } + } + return result; + } + ts.filter = filter; + function map(array, f) { + var result; + if (array) { + result = []; + for (var _i = 0, array_4 = array; _i < array_4.length; _i++) { + var v = array_4[_i]; + result.push(f(v)); + } + } + return result; + } + ts.map = map; + function concatenate(array1, array2) { + if (!array2 || !array2.length) + return array1; + if (!array1 || !array1.length) + return array2; + return array1.concat(array2); + } + ts.concatenate = concatenate; + function deduplicate(array, areEqual) { + var result; + if (array) { + result = []; + for (var _i = 0, array_5 = array; _i < array_5.length; _i++) { + var item = array_5[_i]; + if (!contains(result, item, areEqual)) { + result.push(item); + } + } + } + return result; + } + ts.deduplicate = deduplicate; + function sum(array, prop) { + var result = 0; + for (var _i = 0, array_6 = array; _i < array_6.length; _i++) { + var v = array_6[_i]; + result += v[prop]; + } + return result; + } + ts.sum = sum; + function addRange(to, from) { + if (to && from) { + for (var _i = 0, from_1 = from; _i < from_1.length; _i++) { + var v = from_1[_i]; + to.push(v); + } + } + } + ts.addRange = addRange; + function rangeEquals(array1, array2, pos, end) { + while (pos < end) { + if (array1[pos] !== array2[pos]) { + return false; + } + pos++; + } + return true; + } + ts.rangeEquals = rangeEquals; + function lastOrUndefined(array) { + if (array.length === 0) { + return undefined; + } + return array[array.length - 1]; + } + ts.lastOrUndefined = lastOrUndefined; + function binarySearch(array, value) { + var low = 0; + var high = array.length - 1; + while (low <= high) { + var middle = low + ((high - low) >> 1); + var midValue = array[middle]; + if (midValue === value) { + return middle; + } + else if (midValue > value) { + high = middle - 1; + } + else { + low = middle + 1; + } + } + return ~low; + } + ts.binarySearch = binarySearch; + function reduceLeft(array, f, initial) { + if (array) { + var count = array.length; + if (count > 0) { + var pos = 0; + var result = void 0; + if (arguments.length <= 2) { + result = array[pos]; + pos++; + } + else { + result = initial; + } + while (pos < count) { + result = f(result, array[pos]); + pos++; + } + return result; + } + } + return initial; + } + ts.reduceLeft = reduceLeft; + function reduceRight(array, f, initial) { + if (array) { + var pos = array.length - 1; + if (pos >= 0) { + var result = void 0; + if (arguments.length <= 2) { + result = array[pos]; + pos--; + } + else { + result = initial; + } + while (pos >= 0) { + result = f(result, array[pos]); + pos--; + } + return result; + } + } + return initial; + } + ts.reduceRight = reduceRight; + var hasOwnProperty = Object.prototype.hasOwnProperty; + function hasProperty(map, key) { + return hasOwnProperty.call(map, key); + } + ts.hasProperty = hasProperty; + function getKeys(map) { + var keys = []; + for (var key in map) { + keys.push(key); + } + return keys; + } + ts.getKeys = getKeys; + function getProperty(map, key) { + return hasOwnProperty.call(map, key) ? map[key] : undefined; + } + ts.getProperty = getProperty; + function isEmpty(map) { + for (var id in map) { + if (hasProperty(map, id)) { + return false; + } + } + return true; + } + ts.isEmpty = isEmpty; + function clone(object) { + var result = {}; + for (var id in object) { + result[id] = object[id]; + } + return result; + } + ts.clone = clone; + function extend(first, second) { + var result = {}; + for (var id in first) { + result[id] = first[id]; + } + for (var id in second) { + if (!hasProperty(result, id)) { + result[id] = second[id]; + } + } + return result; + } + ts.extend = extend; + function forEachValue(map, callback) { + var result; + for (var id in map) { + if (result = callback(map[id])) + break; + } + return result; + } + ts.forEachValue = forEachValue; + function forEachKey(map, callback) { + var result; + for (var id in map) { + if (result = callback(id)) + break; + } + return result; + } + ts.forEachKey = forEachKey; + function lookUp(map, key) { + return hasProperty(map, key) ? map[key] : undefined; + } + ts.lookUp = lookUp; + function copyMap(source, target) { + for (var p in source) { + target[p] = source[p]; + } + } + ts.copyMap = copyMap; + function arrayToMap(array, makeKey) { + var result = {}; + forEach(array, function (value) { + result[makeKey(value)] = value; + }); + return result; + } + ts.arrayToMap = arrayToMap; + function reduceProperties(map, callback, initial) { + var result = initial; + if (map) { + for (var key in map) { + if (hasProperty(map, key)) { + result = callback(result, map[key], String(key)); + } + } + } + return result; + } + ts.reduceProperties = reduceProperties; + function isArray(value) { + return Array.isArray ? Array.isArray(value) : value instanceof Array; + } + ts.isArray = isArray; + function memoize(callback) { + var value; + return function () { + if (callback) { + value = callback(); + callback = undefined; + } + return value; + }; + } + ts.memoize = memoize; + function formatStringFromArgs(text, args, baseIndex) { + baseIndex = baseIndex || 0; + return text.replace(/{(\d+)}/g, function (match, index) { return args[+index + baseIndex]; }); + } + ts.localizedDiagnosticMessages = undefined; + function getLocaleSpecificMessage(message) { + return ts.localizedDiagnosticMessages && ts.localizedDiagnosticMessages[message.key] + ? ts.localizedDiagnosticMessages[message.key] + : message.message; + } + ts.getLocaleSpecificMessage = getLocaleSpecificMessage; + function createFileDiagnostic(file, start, length, message) { + var end = start + length; + Debug.assert(start >= 0, "start must be non-negative, is " + start); + Debug.assert(length >= 0, "length must be non-negative, is " + length); + if (file) { + Debug.assert(start <= file.text.length, "start must be within the bounds of the file. " + start + " > " + file.text.length); + Debug.assert(end <= file.text.length, "end must be the bounds of the file. " + end + " > " + file.text.length); + } + var text = getLocaleSpecificMessage(message); + if (arguments.length > 4) { + text = formatStringFromArgs(text, arguments, 4); + } + return { + file: file, + start: start, + length: length, + messageText: text, + category: message.category, + code: message.code + }; + } + ts.createFileDiagnostic = createFileDiagnostic; + function formatMessage(dummy, message) { + var text = getLocaleSpecificMessage(message); + if (arguments.length > 2) { + text = formatStringFromArgs(text, arguments, 2); + } + return text; + } + ts.formatMessage = formatMessage; + function createCompilerDiagnostic(message) { + var text = getLocaleSpecificMessage(message); + if (arguments.length > 1) { + text = formatStringFromArgs(text, arguments, 1); + } + return { + file: undefined, + start: undefined, + length: undefined, + messageText: text, + category: message.category, + code: message.code + }; + } + ts.createCompilerDiagnostic = createCompilerDiagnostic; + function chainDiagnosticMessages(details, message) { + var text = getLocaleSpecificMessage(message); + if (arguments.length > 2) { + text = formatStringFromArgs(text, arguments, 2); + } + return { + messageText: text, + category: message.category, + code: message.code, + next: details + }; + } + ts.chainDiagnosticMessages = chainDiagnosticMessages; + function concatenateDiagnosticMessageChains(headChain, tailChain) { + var lastChain = headChain; + while (lastChain.next) { + lastChain = lastChain.next; + } + lastChain.next = tailChain; + return headChain; + } + ts.concatenateDiagnosticMessageChains = concatenateDiagnosticMessageChains; + function compareValues(a, b) { + if (a === b) + return 0; + if (a === undefined) + return -1; + if (b === undefined) + return 1; + return a < b ? -1 : 1; + } + ts.compareValues = compareValues; + function getDiagnosticFileName(diagnostic) { + return diagnostic.file ? diagnostic.file.fileName : undefined; + } + function compareDiagnostics(d1, d2) { + return compareValues(getDiagnosticFileName(d1), getDiagnosticFileName(d2)) || + compareValues(d1.start, d2.start) || + compareValues(d1.length, d2.length) || + compareValues(d1.code, d2.code) || + compareMessageText(d1.messageText, d2.messageText) || + 0; + } + ts.compareDiagnostics = compareDiagnostics; + function compareMessageText(text1, text2) { + while (text1 && text2) { + var string1 = typeof text1 === "string" ? text1 : text1.messageText; + var string2 = typeof text2 === "string" ? text2 : text2.messageText; + var res = compareValues(string1, string2); + if (res) { + return res; + } + text1 = typeof text1 === "string" ? undefined : text1.next; + text2 = typeof text2 === "string" ? undefined : text2.next; + } + if (!text1 && !text2) { + return 0; + } + return text1 ? 1 : -1; + } + function sortAndDeduplicateDiagnostics(diagnostics) { + return deduplicateSortedDiagnostics(diagnostics.sort(compareDiagnostics)); + } + ts.sortAndDeduplicateDiagnostics = sortAndDeduplicateDiagnostics; + function deduplicateSortedDiagnostics(diagnostics) { + if (diagnostics.length < 2) { + return diagnostics; + } + var newDiagnostics = [diagnostics[0]]; + var previousDiagnostic = diagnostics[0]; + for (var i = 1; i < diagnostics.length; i++) { + var currentDiagnostic = diagnostics[i]; + var isDupe = compareDiagnostics(currentDiagnostic, previousDiagnostic) === 0; + if (!isDupe) { + newDiagnostics.push(currentDiagnostic); + previousDiagnostic = currentDiagnostic; + } + } + return newDiagnostics; + } + ts.deduplicateSortedDiagnostics = deduplicateSortedDiagnostics; + function normalizeSlashes(path) { + return path.replace(/\\/g, "/"); + } + ts.normalizeSlashes = normalizeSlashes; + function getRootLength(path) { + if (path.charCodeAt(0) === 47) { + if (path.charCodeAt(1) !== 47) + return 1; + var p1 = path.indexOf("/", 2); + if (p1 < 0) + return 2; + var p2 = path.indexOf("/", p1 + 1); + if (p2 < 0) + return p1 + 1; + return p2 + 1; + } + if (path.charCodeAt(1) === 58) { + if (path.charCodeAt(2) === 47) + return 3; + return 2; + } + if (path.lastIndexOf("file:///", 0) === 0) { + return "file:///".length; + } + var idx = path.indexOf("://"); + if (idx !== -1) { + return idx + "://".length; + } + return 0; + } + ts.getRootLength = getRootLength; + ts.directorySeparator = "/"; + function getNormalizedParts(normalizedSlashedPath, rootLength) { + var parts = normalizedSlashedPath.substr(rootLength).split(ts.directorySeparator); + var normalized = []; + for (var _i = 0, parts_1 = parts; _i < parts_1.length; _i++) { + var part = parts_1[_i]; + if (part !== ".") { + if (part === ".." && normalized.length > 0 && lastOrUndefined(normalized) !== "..") { + normalized.pop(); + } + else { + if (part) { + normalized.push(part); + } + } + } + } + return normalized; + } + function normalizePath(path) { + path = normalizeSlashes(path); + var rootLength = getRootLength(path); + var normalized = getNormalizedParts(path, rootLength); + return path.substr(0, rootLength) + normalized.join(ts.directorySeparator); + } + ts.normalizePath = normalizePath; + function getDirectoryPath(path) { + return path.substr(0, Math.max(getRootLength(path), path.lastIndexOf(ts.directorySeparator))); + } + ts.getDirectoryPath = getDirectoryPath; + function isUrl(path) { + return path && !isRootedDiskPath(path) && path.indexOf("://") !== -1; + } + ts.isUrl = isUrl; + function isRootedDiskPath(path) { + return getRootLength(path) !== 0; + } + ts.isRootedDiskPath = isRootedDiskPath; + function normalizedPathComponents(path, rootLength) { + var normalizedParts = getNormalizedParts(path, rootLength); + return [path.substr(0, rootLength)].concat(normalizedParts); + } + function getNormalizedPathComponents(path, currentDirectory) { + path = normalizeSlashes(path); + var rootLength = getRootLength(path); + if (rootLength === 0) { + path = combinePaths(normalizeSlashes(currentDirectory), path); + rootLength = getRootLength(path); + } + return normalizedPathComponents(path, rootLength); + } + ts.getNormalizedPathComponents = getNormalizedPathComponents; + function getNormalizedAbsolutePath(fileName, currentDirectory) { + return getNormalizedPathFromPathComponents(getNormalizedPathComponents(fileName, currentDirectory)); + } + ts.getNormalizedAbsolutePath = getNormalizedAbsolutePath; + function getNormalizedPathFromPathComponents(pathComponents) { + if (pathComponents && pathComponents.length) { + return pathComponents[0] + pathComponents.slice(1).join(ts.directorySeparator); + } + } + ts.getNormalizedPathFromPathComponents = getNormalizedPathFromPathComponents; + function getNormalizedPathComponentsOfUrl(url) { + var urlLength = url.length; + var rootLength = url.indexOf("://") + "://".length; + while (rootLength < urlLength) { + if (url.charCodeAt(rootLength) === 47) { + rootLength++; + } + else { + break; + } + } + if (rootLength === urlLength) { + return [url]; + } + var indexOfNextSlash = url.indexOf(ts.directorySeparator, rootLength); + if (indexOfNextSlash !== -1) { + rootLength = indexOfNextSlash + 1; + return normalizedPathComponents(url, rootLength); + } + else { + return [url + ts.directorySeparator]; + } + } + function getNormalizedPathOrUrlComponents(pathOrUrl, currentDirectory) { + if (isUrl(pathOrUrl)) { + return getNormalizedPathComponentsOfUrl(pathOrUrl); + } + else { + return getNormalizedPathComponents(pathOrUrl, currentDirectory); + } + } + function getRelativePathToDirectoryOrUrl(directoryPathOrUrl, relativeOrAbsolutePath, currentDirectory, getCanonicalFileName, isAbsolutePathAnUrl) { + var pathComponents = getNormalizedPathOrUrlComponents(relativeOrAbsolutePath, currentDirectory); + var directoryComponents = getNormalizedPathOrUrlComponents(directoryPathOrUrl, currentDirectory); + if (directoryComponents.length > 1 && lastOrUndefined(directoryComponents) === "") { + directoryComponents.length--; + } + var joinStartIndex; + for (joinStartIndex = 0; joinStartIndex < pathComponents.length && joinStartIndex < directoryComponents.length; joinStartIndex++) { + if (getCanonicalFileName(directoryComponents[joinStartIndex]) !== getCanonicalFileName(pathComponents[joinStartIndex])) { + break; + } + } + if (joinStartIndex) { + var relativePath = ""; + var relativePathComponents = pathComponents.slice(joinStartIndex, pathComponents.length); + for (; joinStartIndex < directoryComponents.length; joinStartIndex++) { + if (directoryComponents[joinStartIndex] !== "") { + relativePath = relativePath + ".." + ts.directorySeparator; + } + } + return relativePath + relativePathComponents.join(ts.directorySeparator); + } + var absolutePath = getNormalizedPathFromPathComponents(pathComponents); + if (isAbsolutePathAnUrl && isRootedDiskPath(absolutePath)) { + absolutePath = "file:///" + absolutePath; + } + return absolutePath; + } + ts.getRelativePathToDirectoryOrUrl = getRelativePathToDirectoryOrUrl; + function getBaseFileName(path) { + if (path === undefined) { + return undefined; + } + var i = path.lastIndexOf(ts.directorySeparator); + return i < 0 ? path : path.substring(i + 1); + } + ts.getBaseFileName = getBaseFileName; + function combinePaths(path1, path2) { + if (!(path1 && path1.length)) + return path2; + if (!(path2 && path2.length)) + return path1; + if (getRootLength(path2) !== 0) + return path2; + if (path1.charAt(path1.length - 1) === ts.directorySeparator) + return path1 + path2; + return path1 + ts.directorySeparator + path2; + } + ts.combinePaths = combinePaths; + function fileExtensionIs(path, extension) { + var pathLen = path.length; + var extLen = extension.length; + return pathLen > extLen && path.substr(pathLen - extLen, extLen) === extension; + } + ts.fileExtensionIs = fileExtensionIs; + function ensureScriptKind(fileName, scriptKind) { + return (scriptKind || getScriptKindFromFileName(fileName)) || 3; + } + ts.ensureScriptKind = ensureScriptKind; + function getScriptKindFromFileName(fileName) { + var ext = fileName.substr(fileName.lastIndexOf(".")); + switch (ext.toLowerCase()) { + case ".js": + return 1; + case ".jsx": + return 2; + case ".ts": + return 3; + case ".tsx": + return 4; + default: + return 0; + } + } + ts.getScriptKindFromFileName = getScriptKindFromFileName; + ts.supportedTypeScriptExtensions = [".ts", ".tsx", ".d.ts"]; + ts.supportedJavascriptExtensions = [".js", ".jsx"]; + var allSupportedExtensions = ts.supportedTypeScriptExtensions.concat(ts.supportedJavascriptExtensions); + function getSupportedExtensions(options) { + return options && options.allowJs ? allSupportedExtensions : ts.supportedTypeScriptExtensions; + } + ts.getSupportedExtensions = getSupportedExtensions; + function isSupportedSourceFileName(fileName, compilerOptions) { + if (!fileName) { + return false; + } + for (var _i = 0, _a = getSupportedExtensions(compilerOptions); _i < _a.length; _i++) { + var extension = _a[_i]; + if (fileExtensionIs(fileName, extension)) { + return true; + } + } + return false; + } + ts.isSupportedSourceFileName = isSupportedSourceFileName; + var extensionsToRemove = [".d.ts", ".ts", ".js", ".tsx", ".jsx"]; + function removeFileExtension(path) { + for (var _i = 0, extensionsToRemove_1 = extensionsToRemove; _i < extensionsToRemove_1.length; _i++) { + var ext = extensionsToRemove_1[_i]; + if (fileExtensionIs(path, ext)) { + return path.substr(0, path.length - ext.length); + } + } + return path; + } + ts.removeFileExtension = removeFileExtension; + function Symbol(flags, name) { + this.flags = flags; + this.name = name; + this.declarations = undefined; + } + function Type(checker, flags) { + this.flags = flags; + } + function Signature(checker) { + } + function Node(kind, pos, end) { + this.kind = kind; + this.pos = pos; + this.end = end; + this.flags = 0; + this.parent = undefined; + } + ts.objectAllocator = { + getNodeConstructor: function () { return Node; }, + getSourceFileConstructor: function () { return Node; }, + getSymbolConstructor: function () { return Symbol; }, + getTypeConstructor: function () { return Type; }, + getSignatureConstructor: function () { return Signature; } + }; + var Debug; + (function (Debug) { + var currentAssertionLevel = 0; + function shouldAssert(level) { + return currentAssertionLevel >= level; + } + Debug.shouldAssert = shouldAssert; + function assert(expression, message, verboseDebugInfo) { + if (!expression) { + var verboseDebugString = ""; + if (verboseDebugInfo) { + verboseDebugString = "\r\nVerbose Debug Information: " + verboseDebugInfo(); + } + debugger; + throw new Error("Debug Failure. False expression: " + (message || "") + verboseDebugString); + } + } + Debug.assert = assert; + function fail(message) { + Debug.assert(false, message); + } + Debug.fail = fail; + })(Debug = ts.Debug || (ts.Debug = {})); + function copyListRemovingItem(item, list) { + var copiedList = []; + for (var _i = 0, list_1 = list; _i < list_1.length; _i++) { + var e = list_1[_i]; + if (e !== item) { + copiedList.push(e); + } + } + return copiedList; + } + ts.copyListRemovingItem = copyListRemovingItem; + function createGetCanonicalFileName(useCaseSensitivefileNames) { + return useCaseSensitivefileNames + ? (function (fileName) { return fileName; }) + : (function (fileName) { return fileName.toLowerCase(); }); + } + ts.createGetCanonicalFileName = createGetCanonicalFileName; +})(ts || (ts = {})); +var ts; +(function (ts) { + ts.sys = (function () { + function getWScriptSystem() { + var fso = new ActiveXObject("Scripting.FileSystemObject"); + var fileStream = new ActiveXObject("ADODB.Stream"); + fileStream.Type = 2; + var binaryStream = new ActiveXObject("ADODB.Stream"); + binaryStream.Type = 1; + var args = []; + for (var i = 0; i < WScript.Arguments.length; i++) { + args[i] = WScript.Arguments.Item(i); + } + function readFile(fileName, encoding) { + if (!fso.FileExists(fileName)) { + return undefined; + } + fileStream.Open(); + try { + if (encoding) { + fileStream.Charset = encoding; + fileStream.LoadFromFile(fileName); + } + else { + fileStream.Charset = "x-ansi"; + fileStream.LoadFromFile(fileName); + var bom = fileStream.ReadText(2) || ""; + fileStream.Position = 0; + fileStream.Charset = bom.length >= 2 && (bom.charCodeAt(0) === 0xFF && bom.charCodeAt(1) === 0xFE || bom.charCodeAt(0) === 0xFE && bom.charCodeAt(1) === 0xFF) ? "unicode" : "utf-8"; + } + return fileStream.ReadText(); + } + catch (e) { + throw e; + } + finally { + fileStream.Close(); + } + } + function writeFile(fileName, data, writeByteOrderMark) { + fileStream.Open(); + binaryStream.Open(); + try { + fileStream.Charset = "utf-8"; + fileStream.WriteText(data); + if (writeByteOrderMark) { + fileStream.Position = 0; + } + else { + fileStream.Position = 3; + } + fileStream.CopyTo(binaryStream); + binaryStream.SaveToFile(fileName, 2); + } + finally { + binaryStream.Close(); + fileStream.Close(); + } + } + function getCanonicalPath(path) { + return path.toLowerCase(); + } + function getNames(collection) { + var result = []; + for (var e = new Enumerator(collection); !e.atEnd(); e.moveNext()) { + result.push(e.item().Name); + } + return result.sort(); + } + function readDirectory(path, extension, exclude) { + var result = []; + exclude = ts.map(exclude, function (s) { return getCanonicalPath(ts.combinePaths(path, s)); }); + visitDirectory(path); + return result; + function visitDirectory(path) { + var folder = fso.GetFolder(path || "."); + var files = getNames(folder.files); + for (var _i = 0, files_1 = files; _i < files_1.length; _i++) { + var current = files_1[_i]; + var name_1 = ts.combinePaths(path, current); + if ((!extension || ts.fileExtensionIs(name_1, extension)) && !ts.contains(exclude, getCanonicalPath(name_1))) { + result.push(name_1); + } + } + var subfolders = getNames(folder.subfolders); + for (var _a = 0, subfolders_1 = subfolders; _a < subfolders_1.length; _a++) { + var current = subfolders_1[_a]; + var name_2 = ts.combinePaths(path, current); + if (!ts.contains(exclude, getCanonicalPath(name_2))) { + visitDirectory(name_2); + } + } + } + } + return { + args: args, + newLine: "\r\n", + useCaseSensitiveFileNames: false, + write: function (s) { + WScript.StdOut.Write(s); + }, + readFile: readFile, + writeFile: writeFile, + resolvePath: function (path) { + return fso.GetAbsolutePathName(path); + }, + fileExists: function (path) { + return fso.FileExists(path); + }, + directoryExists: function (path) { + return fso.FolderExists(path); + }, + createDirectory: function (directoryName) { + if (!this.directoryExists(directoryName)) { + fso.CreateFolder(directoryName); + } + }, + getExecutingFilePath: function () { + return WScript.ScriptFullName; + }, + getCurrentDirectory: function () { + return new ActiveXObject("WScript.Shell").CurrentDirectory; + }, + readDirectory: readDirectory, + exit: function (exitCode) { + try { + WScript.Quit(exitCode); + } + catch (e) { + } + } + }; + } + function getNodeSystem() { + var _fs = require("fs"); + var _path = require("path"); + var _os = require("os"); + var _crypto = require("crypto"); + var useNonPollingWatchers = process.env["TSC_NONPOLLING_WATCHER"]; + function createWatchedFileSet() { + var dirWatchers = {}; + var fileWatcherCallbacks = {}; + return { addFile: addFile, removeFile: removeFile }; + function reduceDirWatcherRefCountForFile(fileName) { + var dirName = ts.getDirectoryPath(fileName); + if (ts.hasProperty(dirWatchers, dirName)) { + var watcher = dirWatchers[dirName]; + watcher.referenceCount -= 1; + if (watcher.referenceCount <= 0) { + watcher.close(); + delete dirWatchers[dirName]; + } + } + } + function addDirWatcher(dirPath) { + if (ts.hasProperty(dirWatchers, dirPath)) { + var watcher_1 = dirWatchers[dirPath]; + watcher_1.referenceCount += 1; + return; + } + var watcher = _fs.watch(dirPath, { persistent: true }, function (eventName, relativeFileName) { return fileEventHandler(eventName, relativeFileName, dirPath); }); + watcher.referenceCount = 1; + dirWatchers[dirPath] = watcher; + return; + } + function addFileWatcherCallback(filePath, callback) { + if (ts.hasProperty(fileWatcherCallbacks, filePath)) { + fileWatcherCallbacks[filePath].push(callback); + } + else { + fileWatcherCallbacks[filePath] = [callback]; + } + } + function addFile(fileName, callback) { + addFileWatcherCallback(fileName, callback); + addDirWatcher(ts.getDirectoryPath(fileName)); + return { fileName: fileName, callback: callback }; + } + function removeFile(watchedFile) { + removeFileWatcherCallback(watchedFile.fileName, watchedFile.callback); + reduceDirWatcherRefCountForFile(watchedFile.fileName); + } + function removeFileWatcherCallback(filePath, callback) { + if (ts.hasProperty(fileWatcherCallbacks, filePath)) { + var newCallbacks = ts.copyListRemovingItem(callback, fileWatcherCallbacks[filePath]); + if (newCallbacks.length === 0) { + delete fileWatcherCallbacks[filePath]; + } + else { + fileWatcherCallbacks[filePath] = newCallbacks; + } + } + } + function fileEventHandler(eventName, relativeFileName, baseDirPath) { + var fileName = typeof relativeFileName !== "string" + ? undefined + : ts.getNormalizedAbsolutePath(relativeFileName, baseDirPath); + if ((eventName === "change" || eventName === "rename") && ts.hasProperty(fileWatcherCallbacks, fileName)) { + for (var _i = 0, _a = fileWatcherCallbacks[fileName]; _i < _a.length; _i++) { + var fileCallback = _a[_i]; + fileCallback(fileName); + } + } + } + } + var watchedFileSet = createWatchedFileSet(); + function isNode4OrLater() { + return parseInt(process.version.charAt(1)) >= 4; + } + var platform = _os.platform(); + var useCaseSensitiveFileNames = platform !== "win32" && platform !== "win64" && platform !== "darwin"; + function readFile(fileName, encoding) { + if (!fileExists(fileName)) { + return undefined; + } + var buffer = _fs.readFileSync(fileName); + var len = buffer.length; + if (len >= 2 && buffer[0] === 0xFE && buffer[1] === 0xFF) { + len &= ~1; + for (var i = 0; i < len; i += 2) { + var temp = buffer[i]; + buffer[i] = buffer[i + 1]; + buffer[i + 1] = temp; + } + return buffer.toString("utf16le", 2); + } + if (len >= 2 && buffer[0] === 0xFF && buffer[1] === 0xFE) { + return buffer.toString("utf16le", 2); + } + if (len >= 3 && buffer[0] === 0xEF && buffer[1] === 0xBB && buffer[2] === 0xBF) { + return buffer.toString("utf8", 3); + } + return buffer.toString("utf8"); + } + function writeFile(fileName, data, writeByteOrderMark) { + if (writeByteOrderMark) { + data = "\uFEFF" + data; + } + var fd; + try { + fd = _fs.openSync(fileName, "w"); + _fs.writeSync(fd, data, undefined, "utf8"); + } + finally { + if (fd !== undefined) { + _fs.closeSync(fd); + } + } + } + function getCanonicalPath(path) { + return useCaseSensitiveFileNames ? path : path.toLowerCase(); + } + function fileSystemEntryExists(path, entryKind) { + try { + var stat = _fs.statSync(path); + switch (entryKind) { + case 0: return stat.isFile(); + case 1: return stat.isDirectory(); + } + } + catch (e) { + return false; + } + } + function fileExists(path) { + return fileSystemEntryExists(path, 0); + } + function directoryExists(path) { + return fileSystemEntryExists(path, 1); + } + function readDirectory(path, extension, exclude) { + var result = []; + exclude = ts.map(exclude, function (s) { return getCanonicalPath(ts.combinePaths(path, s)); }); + visitDirectory(path); + return result; + function visitDirectory(path) { + var files = _fs.readdirSync(path || ".").sort(); + var directories = []; + for (var _i = 0, files_2 = files; _i < files_2.length; _i++) { + var current = files_2[_i]; + if (current === "." || current === "..") { + continue; + } + var name_3 = ts.combinePaths(path, current); + if (!ts.contains(exclude, getCanonicalPath(name_3))) { + var stat = _fs.statSync(name_3); + if (stat.isFile()) { + if (!extension || ts.fileExtensionIs(name_3, extension)) { + result.push(name_3); + } + } + else if (stat.isDirectory()) { + directories.push(name_3); + } + } + } + for (var _a = 0, directories_1 = directories; _a < directories_1.length; _a++) { + var current = directories_1[_a]; + visitDirectory(current); + } + } + } + return { + args: process.argv.slice(2), + newLine: _os.EOL, + useCaseSensitiveFileNames: useCaseSensitiveFileNames, + write: function (s) { + process.stdout.write(s); + }, + readFile: readFile, + writeFile: writeFile, + watchFile: function (fileName, callback) { + if (useNonPollingWatchers) { + var watchedFile_1 = watchedFileSet.addFile(fileName, callback); + return { + close: function () { return watchedFileSet.removeFile(watchedFile_1); } + }; + } + else { + _fs.watchFile(fileName, { persistent: true, interval: 250 }, fileChanged); + return { + close: function () { return _fs.unwatchFile(fileName, fileChanged); } + }; + } + function fileChanged(curr, prev) { + if (+curr.mtime <= +prev.mtime) { + return; + } + callback(fileName); + } + }, + watchDirectory: function (directoryName, callback, recursive) { + var options; + if (isNode4OrLater() && (process.platform === "win32" || process.platform === "darwin")) { + options = { persistent: true, recursive: !!recursive }; + } + else { + options = { persistent: true }; + } + return _fs.watch(directoryName, options, function (eventName, relativeFileName) { + if (eventName === "rename") { + callback(!relativeFileName ? relativeFileName : ts.normalizePath(ts.combinePaths(directoryName, relativeFileName))); + } + ; + }); + }, + resolvePath: function (path) { + return _path.resolve(path); + }, + fileExists: fileExists, + directoryExists: directoryExists, + createDirectory: function (directoryName) { + if (!this.directoryExists(directoryName)) { + _fs.mkdirSync(directoryName); + } + }, + getExecutingFilePath: function () { + return __filename; + }, + getCurrentDirectory: function () { + return process.cwd(); + }, + readDirectory: readDirectory, + getModifiedTime: function (path) { + try { + return _fs.statSync(path).mtime; + } + catch (e) { + return undefined; + } + }, + createHash: function (data) { + var hash = _crypto.createHash("md5"); + hash.update(data); + return hash.digest("hex"); + }, + getMemoryUsage: function () { + if (global.gc) { + global.gc(); + } + return process.memoryUsage().heapUsed; + }, + exit: function (exitCode) { + process.exit(exitCode); + }, + realpath: function (path) { + return _fs.realpathSync(path); + } + }; + } + function getChakraSystem() { + var realpath = ChakraHost.realpath && (function (path) { return ChakraHost.realpath(path); }); + return { + newLine: ChakraHost.newLine || "\r\n", + args: ChakraHost.args, + useCaseSensitiveFileNames: !!ChakraHost.useCaseSensitiveFileNames, + write: ChakraHost.echo, + readFile: function (path, encoding) { + return ChakraHost.readFile(path); + }, + writeFile: function (path, data, writeByteOrderMark) { + if (writeByteOrderMark) { + data = "\uFEFF" + data; + } + ChakraHost.writeFile(path, data); + }, + resolvePath: ChakraHost.resolvePath, + fileExists: ChakraHost.fileExists, + directoryExists: ChakraHost.directoryExists, + createDirectory: ChakraHost.createDirectory, + getExecutingFilePath: function () { return ChakraHost.executingFile; }, + getCurrentDirectory: function () { return ChakraHost.currentDirectory; }, + readDirectory: ChakraHost.readDirectory, + exit: ChakraHost.quit, + realpath: realpath + }; + } + if (typeof ChakraHost !== "undefined") { + return getChakraSystem(); + } + else if (typeof WScript !== "undefined" && typeof ActiveXObject === "function") { + return getWScriptSystem(); + } + else if (typeof process !== "undefined" && process.nextTick && !process.browser && typeof require !== "undefined") { + return getNodeSystem(); + } + else { + return undefined; + } + })(); +})(ts || (ts = {})); +var ts; +(function (ts) { + ts.Diagnostics = { + Unterminated_string_literal: { code: 1002, category: ts.DiagnosticCategory.Error, key: "Unterminated_string_literal_1002", message: "Unterminated string literal." }, + Identifier_expected: { code: 1003, category: ts.DiagnosticCategory.Error, key: "Identifier_expected_1003", message: "Identifier expected." }, + _0_expected: { code: 1005, category: ts.DiagnosticCategory.Error, key: "_0_expected_1005", message: "'{0}' expected." }, + A_file_cannot_have_a_reference_to_itself: { code: 1006, category: ts.DiagnosticCategory.Error, key: "A_file_cannot_have_a_reference_to_itself_1006", message: "A file cannot have a reference to itself." }, + Trailing_comma_not_allowed: { code: 1009, category: ts.DiagnosticCategory.Error, key: "Trailing_comma_not_allowed_1009", message: "Trailing comma not allowed." }, + Asterisk_Slash_expected: { code: 1010, category: ts.DiagnosticCategory.Error, key: "Asterisk_Slash_expected_1010", message: "'*/' expected." }, + Unexpected_token: { code: 1012, category: ts.DiagnosticCategory.Error, key: "Unexpected_token_1012", message: "Unexpected token." }, + A_rest_parameter_must_be_last_in_a_parameter_list: { code: 1014, category: ts.DiagnosticCategory.Error, key: "A_rest_parameter_must_be_last_in_a_parameter_list_1014", message: "A rest parameter must be last in a parameter list." }, + Parameter_cannot_have_question_mark_and_initializer: { code: 1015, category: ts.DiagnosticCategory.Error, key: "Parameter_cannot_have_question_mark_and_initializer_1015", message: "Parameter cannot have question mark and initializer." }, + A_required_parameter_cannot_follow_an_optional_parameter: { code: 1016, category: ts.DiagnosticCategory.Error, key: "A_required_parameter_cannot_follow_an_optional_parameter_1016", message: "A required parameter cannot follow an optional parameter." }, + An_index_signature_cannot_have_a_rest_parameter: { code: 1017, category: ts.DiagnosticCategory.Error, key: "An_index_signature_cannot_have_a_rest_parameter_1017", message: "An index signature cannot have a rest parameter." }, + An_index_signature_parameter_cannot_have_an_accessibility_modifier: { code: 1018, category: ts.DiagnosticCategory.Error, key: "An_index_signature_parameter_cannot_have_an_accessibility_modifier_1018", message: "An index signature parameter cannot have an accessibility modifier." }, + An_index_signature_parameter_cannot_have_a_question_mark: { code: 1019, category: ts.DiagnosticCategory.Error, key: "An_index_signature_parameter_cannot_have_a_question_mark_1019", message: "An index signature parameter cannot have a question mark." }, + An_index_signature_parameter_cannot_have_an_initializer: { code: 1020, category: ts.DiagnosticCategory.Error, key: "An_index_signature_parameter_cannot_have_an_initializer_1020", message: "An index signature parameter cannot have an initializer." }, + An_index_signature_must_have_a_type_annotation: { code: 1021, category: ts.DiagnosticCategory.Error, key: "An_index_signature_must_have_a_type_annotation_1021", message: "An index signature must have a type annotation." }, + An_index_signature_parameter_must_have_a_type_annotation: { code: 1022, category: ts.DiagnosticCategory.Error, key: "An_index_signature_parameter_must_have_a_type_annotation_1022", message: "An index signature parameter must have a type annotation." }, + An_index_signature_parameter_type_must_be_string_or_number: { code: 1023, category: ts.DiagnosticCategory.Error, key: "An_index_signature_parameter_type_must_be_string_or_number_1023", message: "An index signature parameter type must be 'string' or 'number'." }, + readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature: { code: 1024, category: ts.DiagnosticCategory.Error, key: "readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature_1024", message: "'readonly' modifier can only appear on a property declaration or index signature." }, + Accessibility_modifier_already_seen: { code: 1028, category: ts.DiagnosticCategory.Error, key: "Accessibility_modifier_already_seen_1028", message: "Accessibility modifier already seen." }, + _0_modifier_must_precede_1_modifier: { code: 1029, category: ts.DiagnosticCategory.Error, key: "_0_modifier_must_precede_1_modifier_1029", message: "'{0}' modifier must precede '{1}' modifier." }, + _0_modifier_already_seen: { code: 1030, category: ts.DiagnosticCategory.Error, key: "_0_modifier_already_seen_1030", message: "'{0}' modifier already seen." }, + _0_modifier_cannot_appear_on_a_class_element: { code: 1031, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_appear_on_a_class_element_1031", message: "'{0}' modifier cannot appear on a class element." }, + super_must_be_followed_by_an_argument_list_or_member_access: { code: 1034, category: ts.DiagnosticCategory.Error, key: "super_must_be_followed_by_an_argument_list_or_member_access_1034", message: "'super' must be followed by an argument list or member access." }, + Only_ambient_modules_can_use_quoted_names: { code: 1035, category: ts.DiagnosticCategory.Error, key: "Only_ambient_modules_can_use_quoted_names_1035", message: "Only ambient modules can use quoted names." }, + Statements_are_not_allowed_in_ambient_contexts: { code: 1036, category: ts.DiagnosticCategory.Error, key: "Statements_are_not_allowed_in_ambient_contexts_1036", message: "Statements are not allowed in ambient contexts." }, + A_declare_modifier_cannot_be_used_in_an_already_ambient_context: { code: 1038, category: ts.DiagnosticCategory.Error, key: "A_declare_modifier_cannot_be_used_in_an_already_ambient_context_1038", message: "A 'declare' modifier cannot be used in an already ambient context." }, + Initializers_are_not_allowed_in_ambient_contexts: { code: 1039, category: ts.DiagnosticCategory.Error, key: "Initializers_are_not_allowed_in_ambient_contexts_1039", message: "Initializers are not allowed in ambient contexts." }, + _0_modifier_cannot_be_used_in_an_ambient_context: { code: 1040, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_be_used_in_an_ambient_context_1040", message: "'{0}' modifier cannot be used in an ambient context." }, + _0_modifier_cannot_be_used_with_a_class_declaration: { code: 1041, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_be_used_with_a_class_declaration_1041", message: "'{0}' modifier cannot be used with a class declaration." }, + _0_modifier_cannot_be_used_here: { code: 1042, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_be_used_here_1042", message: "'{0}' modifier cannot be used here." }, + _0_modifier_cannot_appear_on_a_data_property: { code: 1043, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_appear_on_a_data_property_1043", message: "'{0}' modifier cannot appear on a data property." }, + _0_modifier_cannot_appear_on_a_module_or_namespace_element: { code: 1044, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_appear_on_a_module_or_namespace_element_1044", message: "'{0}' modifier cannot appear on a module or namespace element." }, + A_0_modifier_cannot_be_used_with_an_interface_declaration: { code: 1045, category: ts.DiagnosticCategory.Error, key: "A_0_modifier_cannot_be_used_with_an_interface_declaration_1045", message: "A '{0}' modifier cannot be used with an interface declaration." }, + A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file: { code: 1046, category: ts.DiagnosticCategory.Error, key: "A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file_1046", message: "A 'declare' modifier is required for a top level declaration in a .d.ts file." }, + A_rest_parameter_cannot_be_optional: { code: 1047, category: ts.DiagnosticCategory.Error, key: "A_rest_parameter_cannot_be_optional_1047", message: "A rest parameter cannot be optional." }, + A_rest_parameter_cannot_have_an_initializer: { code: 1048, category: ts.DiagnosticCategory.Error, key: "A_rest_parameter_cannot_have_an_initializer_1048", message: "A rest parameter cannot have an initializer." }, + A_set_accessor_must_have_exactly_one_parameter: { code: 1049, category: ts.DiagnosticCategory.Error, key: "A_set_accessor_must_have_exactly_one_parameter_1049", message: "A 'set' accessor must have exactly one parameter." }, + A_set_accessor_cannot_have_an_optional_parameter: { code: 1051, category: ts.DiagnosticCategory.Error, key: "A_set_accessor_cannot_have_an_optional_parameter_1051", message: "A 'set' accessor cannot have an optional parameter." }, + A_set_accessor_parameter_cannot_have_an_initializer: { code: 1052, category: ts.DiagnosticCategory.Error, key: "A_set_accessor_parameter_cannot_have_an_initializer_1052", message: "A 'set' accessor parameter cannot have an initializer." }, + A_set_accessor_cannot_have_rest_parameter: { code: 1053, category: ts.DiagnosticCategory.Error, key: "A_set_accessor_cannot_have_rest_parameter_1053", message: "A 'set' accessor cannot have rest parameter." }, + A_get_accessor_cannot_have_parameters: { code: 1054, category: ts.DiagnosticCategory.Error, key: "A_get_accessor_cannot_have_parameters_1054", message: "A 'get' accessor cannot have parameters." }, + Type_0_is_not_a_valid_async_function_return_type: { code: 1055, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_a_valid_async_function_return_type_1055", message: "Type '{0}' is not a valid async function return type." }, + Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1056, category: ts.DiagnosticCategory.Error, key: "Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher_1056", message: "Accessors are only available when targeting ECMAScript 5 and higher." }, + An_async_function_or_method_must_have_a_valid_awaitable_return_type: { code: 1057, category: ts.DiagnosticCategory.Error, key: "An_async_function_or_method_must_have_a_valid_awaitable_return_type_1057", message: "An async function or method must have a valid awaitable return type." }, + Operand_for_await_does_not_have_a_valid_callable_then_member: { code: 1058, category: ts.DiagnosticCategory.Error, key: "Operand_for_await_does_not_have_a_valid_callable_then_member_1058", message: "Operand for 'await' does not have a valid callable 'then' member." }, + Return_expression_in_async_function_does_not_have_a_valid_callable_then_member: { code: 1059, category: ts.DiagnosticCategory.Error, key: "Return_expression_in_async_function_does_not_have_a_valid_callable_then_member_1059", message: "Return expression in async function does not have a valid callable 'then' member." }, + Expression_body_for_async_arrow_function_does_not_have_a_valid_callable_then_member: { code: 1060, category: ts.DiagnosticCategory.Error, key: "Expression_body_for_async_arrow_function_does_not_have_a_valid_callable_then_member_1060", message: "Expression body for async arrow function does not have a valid callable 'then' member." }, + Enum_member_must_have_initializer: { code: 1061, category: ts.DiagnosticCategory.Error, key: "Enum_member_must_have_initializer_1061", message: "Enum member must have initializer." }, + _0_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method: { code: 1062, category: ts.DiagnosticCategory.Error, key: "_0_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method_1062", message: "{0} is referenced directly or indirectly in the fulfillment callback of its own 'then' method." }, + An_export_assignment_cannot_be_used_in_a_namespace: { code: 1063, category: ts.DiagnosticCategory.Error, key: "An_export_assignment_cannot_be_used_in_a_namespace_1063", message: "An export assignment cannot be used in a namespace." }, + The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type: { code: 1064, category: ts.DiagnosticCategory.Error, key: "The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_1064", message: "The return type of an async function or method must be the global Promise type." }, + In_ambient_enum_declarations_member_initializer_must_be_constant_expression: { code: 1066, category: ts.DiagnosticCategory.Error, key: "In_ambient_enum_declarations_member_initializer_must_be_constant_expression_1066", message: "In ambient enum declarations member initializer must be constant expression." }, + Unexpected_token_A_constructor_method_accessor_or_property_was_expected: { code: 1068, category: ts.DiagnosticCategory.Error, key: "Unexpected_token_A_constructor_method_accessor_or_property_was_expected_1068", message: "Unexpected token. A constructor, method, accessor, or property was expected." }, + _0_modifier_cannot_appear_on_a_type_member: { code: 1070, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_appear_on_a_type_member_1070", message: "'{0}' modifier cannot appear on a type member." }, + _0_modifier_cannot_appear_on_an_index_signature: { code: 1071, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_appear_on_an_index_signature_1071", message: "'{0}' modifier cannot appear on an index signature." }, + A_0_modifier_cannot_be_used_with_an_import_declaration: { code: 1079, category: ts.DiagnosticCategory.Error, key: "A_0_modifier_cannot_be_used_with_an_import_declaration_1079", message: "A '{0}' modifier cannot be used with an import declaration." }, + Invalid_reference_directive_syntax: { code: 1084, category: ts.DiagnosticCategory.Error, key: "Invalid_reference_directive_syntax_1084", message: "Invalid 'reference' directive syntax." }, + Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher: { code: 1085, category: ts.DiagnosticCategory.Error, key: "Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_1085", message: "Octal literals are not available when targeting ECMAScript 5 and higher." }, + An_accessor_cannot_be_declared_in_an_ambient_context: { code: 1086, category: ts.DiagnosticCategory.Error, key: "An_accessor_cannot_be_declared_in_an_ambient_context_1086", message: "An accessor cannot be declared in an ambient context." }, + _0_modifier_cannot_appear_on_a_constructor_declaration: { code: 1089, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_appear_on_a_constructor_declaration_1089", message: "'{0}' modifier cannot appear on a constructor declaration." }, + _0_modifier_cannot_appear_on_a_parameter: { code: 1090, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_appear_on_a_parameter_1090", message: "'{0}' modifier cannot appear on a parameter." }, + Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement: { code: 1091, category: ts.DiagnosticCategory.Error, key: "Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement_1091", message: "Only a single variable declaration is allowed in a 'for...in' statement." }, + Type_parameters_cannot_appear_on_a_constructor_declaration: { code: 1092, category: ts.DiagnosticCategory.Error, key: "Type_parameters_cannot_appear_on_a_constructor_declaration_1092", message: "Type parameters cannot appear on a constructor declaration." }, + Type_annotation_cannot_appear_on_a_constructor_declaration: { code: 1093, category: ts.DiagnosticCategory.Error, key: "Type_annotation_cannot_appear_on_a_constructor_declaration_1093", message: "Type annotation cannot appear on a constructor declaration." }, + An_accessor_cannot_have_type_parameters: { code: 1094, category: ts.DiagnosticCategory.Error, key: "An_accessor_cannot_have_type_parameters_1094", message: "An accessor cannot have type parameters." }, + A_set_accessor_cannot_have_a_return_type_annotation: { code: 1095, category: ts.DiagnosticCategory.Error, key: "A_set_accessor_cannot_have_a_return_type_annotation_1095", message: "A 'set' accessor cannot have a return type annotation." }, + An_index_signature_must_have_exactly_one_parameter: { code: 1096, category: ts.DiagnosticCategory.Error, key: "An_index_signature_must_have_exactly_one_parameter_1096", message: "An index signature must have exactly one parameter." }, + _0_list_cannot_be_empty: { code: 1097, category: ts.DiagnosticCategory.Error, key: "_0_list_cannot_be_empty_1097", message: "'{0}' list cannot be empty." }, + Type_parameter_list_cannot_be_empty: { code: 1098, category: ts.DiagnosticCategory.Error, key: "Type_parameter_list_cannot_be_empty_1098", message: "Type parameter list cannot be empty." }, + Type_argument_list_cannot_be_empty: { code: 1099, category: ts.DiagnosticCategory.Error, key: "Type_argument_list_cannot_be_empty_1099", message: "Type argument list cannot be empty." }, + Invalid_use_of_0_in_strict_mode: { code: 1100, category: ts.DiagnosticCategory.Error, key: "Invalid_use_of_0_in_strict_mode_1100", message: "Invalid use of '{0}' in strict mode." }, + with_statements_are_not_allowed_in_strict_mode: { code: 1101, category: ts.DiagnosticCategory.Error, key: "with_statements_are_not_allowed_in_strict_mode_1101", message: "'with' statements are not allowed in strict mode." }, + delete_cannot_be_called_on_an_identifier_in_strict_mode: { code: 1102, category: ts.DiagnosticCategory.Error, key: "delete_cannot_be_called_on_an_identifier_in_strict_mode_1102", message: "'delete' cannot be called on an identifier in strict mode." }, + A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement: { code: 1104, category: ts.DiagnosticCategory.Error, key: "A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement_1104", message: "A 'continue' statement can only be used within an enclosing iteration statement." }, + A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement: { code: 1105, category: ts.DiagnosticCategory.Error, key: "A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement_1105", message: "A 'break' statement can only be used within an enclosing iteration or switch statement." }, + Jump_target_cannot_cross_function_boundary: { code: 1107, category: ts.DiagnosticCategory.Error, key: "Jump_target_cannot_cross_function_boundary_1107", message: "Jump target cannot cross function boundary." }, + A_return_statement_can_only_be_used_within_a_function_body: { code: 1108, category: ts.DiagnosticCategory.Error, key: "A_return_statement_can_only_be_used_within_a_function_body_1108", message: "A 'return' statement can only be used within a function body." }, + Expression_expected: { code: 1109, category: ts.DiagnosticCategory.Error, key: "Expression_expected_1109", message: "Expression expected." }, + Type_expected: { code: 1110, category: ts.DiagnosticCategory.Error, key: "Type_expected_1110", message: "Type expected." }, + A_default_clause_cannot_appear_more_than_once_in_a_switch_statement: { code: 1113, category: ts.DiagnosticCategory.Error, key: "A_default_clause_cannot_appear_more_than_once_in_a_switch_statement_1113", message: "A 'default' clause cannot appear more than once in a 'switch' statement." }, + Duplicate_label_0: { code: 1114, category: ts.DiagnosticCategory.Error, key: "Duplicate_label_0_1114", message: "Duplicate label '{0}'" }, + A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement: { code: 1115, category: ts.DiagnosticCategory.Error, key: "A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement_1115", message: "A 'continue' statement can only jump to a label of an enclosing iteration statement." }, + A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement: { code: 1116, category: ts.DiagnosticCategory.Error, key: "A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement_1116", message: "A 'break' statement can only jump to a label of an enclosing statement." }, + An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode: { code: 1117, category: ts.DiagnosticCategory.Error, key: "An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode_1117", message: "An object literal cannot have multiple properties with the same name in strict mode." }, + An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name: { code: 1118, category: ts.DiagnosticCategory.Error, key: "An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name_1118", message: "An object literal cannot have multiple get/set accessors with the same name." }, + An_object_literal_cannot_have_property_and_accessor_with_the_same_name: { code: 1119, category: ts.DiagnosticCategory.Error, key: "An_object_literal_cannot_have_property_and_accessor_with_the_same_name_1119", message: "An object literal cannot have property and accessor with the same name." }, + An_export_assignment_cannot_have_modifiers: { code: 1120, category: ts.DiagnosticCategory.Error, key: "An_export_assignment_cannot_have_modifiers_1120", message: "An export assignment cannot have modifiers." }, + Octal_literals_are_not_allowed_in_strict_mode: { code: 1121, category: ts.DiagnosticCategory.Error, key: "Octal_literals_are_not_allowed_in_strict_mode_1121", message: "Octal literals are not allowed in strict mode." }, + A_tuple_type_element_list_cannot_be_empty: { code: 1122, category: ts.DiagnosticCategory.Error, key: "A_tuple_type_element_list_cannot_be_empty_1122", message: "A tuple type element list cannot be empty." }, + Variable_declaration_list_cannot_be_empty: { code: 1123, category: ts.DiagnosticCategory.Error, key: "Variable_declaration_list_cannot_be_empty_1123", message: "Variable declaration list cannot be empty." }, + Digit_expected: { code: 1124, category: ts.DiagnosticCategory.Error, key: "Digit_expected_1124", message: "Digit expected." }, + Hexadecimal_digit_expected: { code: 1125, category: ts.DiagnosticCategory.Error, key: "Hexadecimal_digit_expected_1125", message: "Hexadecimal digit expected." }, + Unexpected_end_of_text: { code: 1126, category: ts.DiagnosticCategory.Error, key: "Unexpected_end_of_text_1126", message: "Unexpected end of text." }, + Invalid_character: { code: 1127, category: ts.DiagnosticCategory.Error, key: "Invalid_character_1127", message: "Invalid character." }, + Declaration_or_statement_expected: { code: 1128, category: ts.DiagnosticCategory.Error, key: "Declaration_or_statement_expected_1128", message: "Declaration or statement expected." }, + Statement_expected: { code: 1129, category: ts.DiagnosticCategory.Error, key: "Statement_expected_1129", message: "Statement expected." }, + case_or_default_expected: { code: 1130, category: ts.DiagnosticCategory.Error, key: "case_or_default_expected_1130", message: "'case' or 'default' expected." }, + Property_or_signature_expected: { code: 1131, category: ts.DiagnosticCategory.Error, key: "Property_or_signature_expected_1131", message: "Property or signature expected." }, + Enum_member_expected: { code: 1132, category: ts.DiagnosticCategory.Error, key: "Enum_member_expected_1132", message: "Enum member expected." }, + Variable_declaration_expected: { code: 1134, category: ts.DiagnosticCategory.Error, key: "Variable_declaration_expected_1134", message: "Variable declaration expected." }, + Argument_expression_expected: { code: 1135, category: ts.DiagnosticCategory.Error, key: "Argument_expression_expected_1135", message: "Argument expression expected." }, + Property_assignment_expected: { code: 1136, category: ts.DiagnosticCategory.Error, key: "Property_assignment_expected_1136", message: "Property assignment expected." }, + Expression_or_comma_expected: { code: 1137, category: ts.DiagnosticCategory.Error, key: "Expression_or_comma_expected_1137", message: "Expression or comma expected." }, + Parameter_declaration_expected: { code: 1138, category: ts.DiagnosticCategory.Error, key: "Parameter_declaration_expected_1138", message: "Parameter declaration expected." }, + Type_parameter_declaration_expected: { code: 1139, category: ts.DiagnosticCategory.Error, key: "Type_parameter_declaration_expected_1139", message: "Type parameter declaration expected." }, + Type_argument_expected: { code: 1140, category: ts.DiagnosticCategory.Error, key: "Type_argument_expected_1140", message: "Type argument expected." }, + String_literal_expected: { code: 1141, category: ts.DiagnosticCategory.Error, key: "String_literal_expected_1141", message: "String literal expected." }, + Line_break_not_permitted_here: { code: 1142, category: ts.DiagnosticCategory.Error, key: "Line_break_not_permitted_here_1142", message: "Line break not permitted here." }, + or_expected: { code: 1144, category: ts.DiagnosticCategory.Error, key: "or_expected_1144", message: "'{' or ';' expected." }, + Declaration_expected: { code: 1146, category: ts.DiagnosticCategory.Error, key: "Declaration_expected_1146", message: "Declaration expected." }, + Import_declarations_in_a_namespace_cannot_reference_a_module: { code: 1147, category: ts.DiagnosticCategory.Error, key: "Import_declarations_in_a_namespace_cannot_reference_a_module_1147", message: "Import declarations in a namespace cannot reference a module." }, + Cannot_compile_modules_unless_the_module_flag_is_provided_with_a_valid_module_type_Consider_setting_the_module_compiler_option_in_a_tsconfig_json_file: { code: 1148, category: ts.DiagnosticCategory.Error, key: "Cannot_compile_modules_unless_the_module_flag_is_provided_with_a_valid_module_type_Consider_setting__1148", message: "Cannot compile modules unless the '--module' flag is provided with a valid module type. Consider setting the 'module' compiler option in a 'tsconfig.json' file." }, + File_name_0_differs_from_already_included_file_name_1_only_in_casing: { code: 1149, category: ts.DiagnosticCategory.Error, key: "File_name_0_differs_from_already_included_file_name_1_only_in_casing_1149", message: "File name '{0}' differs from already included file name '{1}' only in casing" }, + new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead: { code: 1150, category: ts.DiagnosticCategory.Error, key: "new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead_1150", message: "'new T[]' cannot be used to create an array. Use 'new Array()' instead." }, + const_declarations_must_be_initialized: { code: 1155, category: ts.DiagnosticCategory.Error, key: "const_declarations_must_be_initialized_1155", message: "'const' declarations must be initialized" }, + const_declarations_can_only_be_declared_inside_a_block: { code: 1156, category: ts.DiagnosticCategory.Error, key: "const_declarations_can_only_be_declared_inside_a_block_1156", message: "'const' declarations can only be declared inside a block." }, + let_declarations_can_only_be_declared_inside_a_block: { code: 1157, category: ts.DiagnosticCategory.Error, key: "let_declarations_can_only_be_declared_inside_a_block_1157", message: "'let' declarations can only be declared inside a block." }, + Unterminated_template_literal: { code: 1160, category: ts.DiagnosticCategory.Error, key: "Unterminated_template_literal_1160", message: "Unterminated template literal." }, + Unterminated_regular_expression_literal: { code: 1161, category: ts.DiagnosticCategory.Error, key: "Unterminated_regular_expression_literal_1161", message: "Unterminated regular expression literal." }, + An_object_member_cannot_be_declared_optional: { code: 1162, category: ts.DiagnosticCategory.Error, key: "An_object_member_cannot_be_declared_optional_1162", message: "An object member cannot be declared optional." }, + A_yield_expression_is_only_allowed_in_a_generator_body: { code: 1163, category: ts.DiagnosticCategory.Error, key: "A_yield_expression_is_only_allowed_in_a_generator_body_1163", message: "A 'yield' expression is only allowed in a generator body." }, + Computed_property_names_are_not_allowed_in_enums: { code: 1164, category: ts.DiagnosticCategory.Error, key: "Computed_property_names_are_not_allowed_in_enums_1164", message: "Computed property names are not allowed in enums." }, + A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_symbol: { code: 1165, category: ts.DiagnosticCategory.Error, key: "A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_symbol_1165", message: "A computed property name in an ambient context must directly refer to a built-in symbol." }, + A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol: { code: 1166, category: ts.DiagnosticCategory.Error, key: "A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol_1166", message: "A computed property name in a class property declaration must directly refer to a built-in symbol." }, + A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol: { code: 1168, category: ts.DiagnosticCategory.Error, key: "A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol_1168", message: "A computed property name in a method overload must directly refer to a built-in symbol." }, + A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol: { code: 1169, category: ts.DiagnosticCategory.Error, key: "A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol_1169", message: "A computed property name in an interface must directly refer to a built-in symbol." }, + A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol: { code: 1170, category: ts.DiagnosticCategory.Error, key: "A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol_1170", message: "A computed property name in a type literal must directly refer to a built-in symbol." }, + A_comma_expression_is_not_allowed_in_a_computed_property_name: { code: 1171, category: ts.DiagnosticCategory.Error, key: "A_comma_expression_is_not_allowed_in_a_computed_property_name_1171", message: "A comma expression is not allowed in a computed property name." }, + extends_clause_already_seen: { code: 1172, category: ts.DiagnosticCategory.Error, key: "extends_clause_already_seen_1172", message: "'extends' clause already seen." }, + extends_clause_must_precede_implements_clause: { code: 1173, category: ts.DiagnosticCategory.Error, key: "extends_clause_must_precede_implements_clause_1173", message: "'extends' clause must precede 'implements' clause." }, + Classes_can_only_extend_a_single_class: { code: 1174, category: ts.DiagnosticCategory.Error, key: "Classes_can_only_extend_a_single_class_1174", message: "Classes can only extend a single class." }, + implements_clause_already_seen: { code: 1175, category: ts.DiagnosticCategory.Error, key: "implements_clause_already_seen_1175", message: "'implements' clause already seen." }, + Interface_declaration_cannot_have_implements_clause: { code: 1176, category: ts.DiagnosticCategory.Error, key: "Interface_declaration_cannot_have_implements_clause_1176", message: "Interface declaration cannot have 'implements' clause." }, + Binary_digit_expected: { code: 1177, category: ts.DiagnosticCategory.Error, key: "Binary_digit_expected_1177", message: "Binary digit expected." }, + Octal_digit_expected: { code: 1178, category: ts.DiagnosticCategory.Error, key: "Octal_digit_expected_1178", message: "Octal digit expected." }, + Unexpected_token_expected: { code: 1179, category: ts.DiagnosticCategory.Error, key: "Unexpected_token_expected_1179", message: "Unexpected token. '{' expected." }, + Property_destructuring_pattern_expected: { code: 1180, category: ts.DiagnosticCategory.Error, key: "Property_destructuring_pattern_expected_1180", message: "Property destructuring pattern expected." }, + Array_element_destructuring_pattern_expected: { code: 1181, category: ts.DiagnosticCategory.Error, key: "Array_element_destructuring_pattern_expected_1181", message: "Array element destructuring pattern expected." }, + A_destructuring_declaration_must_have_an_initializer: { code: 1182, category: ts.DiagnosticCategory.Error, key: "A_destructuring_declaration_must_have_an_initializer_1182", message: "A destructuring declaration must have an initializer." }, + An_implementation_cannot_be_declared_in_ambient_contexts: { code: 1183, category: ts.DiagnosticCategory.Error, key: "An_implementation_cannot_be_declared_in_ambient_contexts_1183", message: "An implementation cannot be declared in ambient contexts." }, + Modifiers_cannot_appear_here: { code: 1184, category: ts.DiagnosticCategory.Error, key: "Modifiers_cannot_appear_here_1184", message: "Modifiers cannot appear here." }, + Merge_conflict_marker_encountered: { code: 1185, category: ts.DiagnosticCategory.Error, key: "Merge_conflict_marker_encountered_1185", message: "Merge conflict marker encountered." }, + A_rest_element_cannot_have_an_initializer: { code: 1186, category: ts.DiagnosticCategory.Error, key: "A_rest_element_cannot_have_an_initializer_1186", message: "A rest element cannot have an initializer." }, + A_parameter_property_may_not_be_a_binding_pattern: { code: 1187, category: ts.DiagnosticCategory.Error, key: "A_parameter_property_may_not_be_a_binding_pattern_1187", message: "A parameter property may not be a binding pattern." }, + Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement: { code: 1188, category: ts.DiagnosticCategory.Error, key: "Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement_1188", message: "Only a single variable declaration is allowed in a 'for...of' statement." }, + The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer: { code: 1189, category: ts.DiagnosticCategory.Error, key: "The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer_1189", message: "The variable declaration of a 'for...in' statement cannot have an initializer." }, + The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer: { code: 1190, category: ts.DiagnosticCategory.Error, key: "The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer_1190", message: "The variable declaration of a 'for...of' statement cannot have an initializer." }, + An_import_declaration_cannot_have_modifiers: { code: 1191, category: ts.DiagnosticCategory.Error, key: "An_import_declaration_cannot_have_modifiers_1191", message: "An import declaration cannot have modifiers." }, + Module_0_has_no_default_export: { code: 1192, category: ts.DiagnosticCategory.Error, key: "Module_0_has_no_default_export_1192", message: "Module '{0}' has no default export." }, + An_export_declaration_cannot_have_modifiers: { code: 1193, category: ts.DiagnosticCategory.Error, key: "An_export_declaration_cannot_have_modifiers_1193", message: "An export declaration cannot have modifiers." }, + Export_declarations_are_not_permitted_in_a_namespace: { code: 1194, category: ts.DiagnosticCategory.Error, key: "Export_declarations_are_not_permitted_in_a_namespace_1194", message: "Export declarations are not permitted in a namespace." }, + Catch_clause_variable_name_must_be_an_identifier: { code: 1195, category: ts.DiagnosticCategory.Error, key: "Catch_clause_variable_name_must_be_an_identifier_1195", message: "Catch clause variable name must be an identifier." }, + Catch_clause_variable_cannot_have_a_type_annotation: { code: 1196, category: ts.DiagnosticCategory.Error, key: "Catch_clause_variable_cannot_have_a_type_annotation_1196", message: "Catch clause variable cannot have a type annotation." }, + Catch_clause_variable_cannot_have_an_initializer: { code: 1197, category: ts.DiagnosticCategory.Error, key: "Catch_clause_variable_cannot_have_an_initializer_1197", message: "Catch clause variable cannot have an initializer." }, + An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive: { code: 1198, category: ts.DiagnosticCategory.Error, key: "An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive_1198", message: "An extended Unicode escape value must be between 0x0 and 0x10FFFF inclusive." }, + Unterminated_Unicode_escape_sequence: { code: 1199, category: ts.DiagnosticCategory.Error, key: "Unterminated_Unicode_escape_sequence_1199", message: "Unterminated Unicode escape sequence." }, + Line_terminator_not_permitted_before_arrow: { code: 1200, category: ts.DiagnosticCategory.Error, key: "Line_terminator_not_permitted_before_arrow_1200", message: "Line terminator not permitted before arrow." }, + Import_assignment_cannot_be_used_when_targeting_ECMAScript_6_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead: { code: 1202, category: ts.DiagnosticCategory.Error, key: "Import_assignment_cannot_be_used_when_targeting_ECMAScript_6_modules_Consider_using_import_Asterisk__1202", message: "Import assignment cannot be used when targeting ECMAScript 6 modules. Consider using 'import * as ns from \"mod\"', 'import {a} from \"mod\"', 'import d from \"mod\"', or another module format instead." }, + Export_assignment_cannot_be_used_when_targeting_ECMAScript_6_modules_Consider_using_export_default_or_another_module_format_instead: { code: 1203, category: ts.DiagnosticCategory.Error, key: "Export_assignment_cannot_be_used_when_targeting_ECMAScript_6_modules_Consider_using_export_default_o_1203", message: "Export assignment cannot be used when targeting ECMAScript 6 modules. Consider using 'export default' or another module format instead." }, + Cannot_compile_modules_into_es2015_when_targeting_ES5_or_lower: { code: 1204, category: ts.DiagnosticCategory.Error, key: "Cannot_compile_modules_into_es2015_when_targeting_ES5_or_lower_1204", message: "Cannot compile modules into 'es2015' when targeting 'ES5' or lower." }, + Decorators_are_not_valid_here: { code: 1206, category: ts.DiagnosticCategory.Error, key: "Decorators_are_not_valid_here_1206", message: "Decorators are not valid here." }, + Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name: { code: 1207, category: ts.DiagnosticCategory.Error, key: "Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name_1207", message: "Decorators cannot be applied to multiple get/set accessors of the same name." }, + Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided: { code: 1208, category: ts.DiagnosticCategory.Error, key: "Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided_1208", message: "Cannot compile namespaces when the '--isolatedModules' flag is provided." }, + Ambient_const_enums_are_not_allowed_when_the_isolatedModules_flag_is_provided: { code: 1209, category: ts.DiagnosticCategory.Error, key: "Ambient_const_enums_are_not_allowed_when_the_isolatedModules_flag_is_provided_1209", message: "Ambient const enums are not allowed when the '--isolatedModules' flag is provided." }, + Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode: { code: 1210, category: ts.DiagnosticCategory.Error, key: "Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode_1210", message: "Invalid use of '{0}'. Class definitions are automatically in strict mode." }, + A_class_declaration_without_the_default_modifier_must_have_a_name: { code: 1211, category: ts.DiagnosticCategory.Error, key: "A_class_declaration_without_the_default_modifier_must_have_a_name_1211", message: "A class declaration without the 'default' modifier must have a name" }, + Identifier_expected_0_is_a_reserved_word_in_strict_mode: { code: 1212, category: ts.DiagnosticCategory.Error, key: "Identifier_expected_0_is_a_reserved_word_in_strict_mode_1212", message: "Identifier expected. '{0}' is a reserved word in strict mode" }, + Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode: { code: 1213, category: ts.DiagnosticCategory.Error, key: "Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_stric_1213", message: "Identifier expected. '{0}' is a reserved word in strict mode. Class definitions are automatically in strict mode." }, + Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode: { code: 1214, category: ts.DiagnosticCategory.Error, key: "Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode_1214", message: "Identifier expected. '{0}' is a reserved word in strict mode. Modules are automatically in strict mode." }, + Invalid_use_of_0_Modules_are_automatically_in_strict_mode: { code: 1215, category: ts.DiagnosticCategory.Error, key: "Invalid_use_of_0_Modules_are_automatically_in_strict_mode_1215", message: "Invalid use of '{0}'. Modules are automatically in strict mode." }, + Export_assignment_is_not_supported_when_module_flag_is_system: { code: 1218, category: ts.DiagnosticCategory.Error, key: "Export_assignment_is_not_supported_when_module_flag_is_system_1218", message: "Export assignment is not supported when '--module' flag is 'system'." }, + Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning: { code: 1219, category: ts.DiagnosticCategory.Error, key: "Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_t_1219", message: "Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning." }, + Generators_are_only_available_when_targeting_ECMAScript_6_or_higher: { code: 1220, category: ts.DiagnosticCategory.Error, key: "Generators_are_only_available_when_targeting_ECMAScript_6_or_higher_1220", message: "Generators are only available when targeting ECMAScript 6 or higher." }, + Generators_are_not_allowed_in_an_ambient_context: { code: 1221, category: ts.DiagnosticCategory.Error, key: "Generators_are_not_allowed_in_an_ambient_context_1221", message: "Generators are not allowed in an ambient context." }, + An_overload_signature_cannot_be_declared_as_a_generator: { code: 1222, category: ts.DiagnosticCategory.Error, key: "An_overload_signature_cannot_be_declared_as_a_generator_1222", message: "An overload signature cannot be declared as a generator." }, + _0_tag_already_specified: { code: 1223, category: ts.DiagnosticCategory.Error, key: "_0_tag_already_specified_1223", message: "'{0}' tag already specified." }, + Signature_0_must_have_a_type_predicate: { code: 1224, category: ts.DiagnosticCategory.Error, key: "Signature_0_must_have_a_type_predicate_1224", message: "Signature '{0}' must have a type predicate." }, + Cannot_find_parameter_0: { code: 1225, category: ts.DiagnosticCategory.Error, key: "Cannot_find_parameter_0_1225", message: "Cannot find parameter '{0}'." }, + Type_predicate_0_is_not_assignable_to_1: { code: 1226, category: ts.DiagnosticCategory.Error, key: "Type_predicate_0_is_not_assignable_to_1_1226", message: "Type predicate '{0}' is not assignable to '{1}'." }, + Parameter_0_is_not_in_the_same_position_as_parameter_1: { code: 1227, category: ts.DiagnosticCategory.Error, key: "Parameter_0_is_not_in_the_same_position_as_parameter_1_1227", message: "Parameter '{0}' is not in the same position as parameter '{1}'." }, + A_type_predicate_is_only_allowed_in_return_type_position_for_functions_and_methods: { code: 1228, category: ts.DiagnosticCategory.Error, key: "A_type_predicate_is_only_allowed_in_return_type_position_for_functions_and_methods_1228", message: "A type predicate is only allowed in return type position for functions and methods." }, + A_type_predicate_cannot_reference_a_rest_parameter: { code: 1229, category: ts.DiagnosticCategory.Error, key: "A_type_predicate_cannot_reference_a_rest_parameter_1229", message: "A type predicate cannot reference a rest parameter." }, + A_type_predicate_cannot_reference_element_0_in_a_binding_pattern: { code: 1230, category: ts.DiagnosticCategory.Error, key: "A_type_predicate_cannot_reference_element_0_in_a_binding_pattern_1230", message: "A type predicate cannot reference element '{0}' in a binding pattern." }, + An_export_assignment_can_only_be_used_in_a_module: { code: 1231, category: ts.DiagnosticCategory.Error, key: "An_export_assignment_can_only_be_used_in_a_module_1231", message: "An export assignment can only be used in a module." }, + An_import_declaration_can_only_be_used_in_a_namespace_or_module: { code: 1232, category: ts.DiagnosticCategory.Error, key: "An_import_declaration_can_only_be_used_in_a_namespace_or_module_1232", message: "An import declaration can only be used in a namespace or module." }, + An_export_declaration_can_only_be_used_in_a_module: { code: 1233, category: ts.DiagnosticCategory.Error, key: "An_export_declaration_can_only_be_used_in_a_module_1233", message: "An export declaration can only be used in a module." }, + An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file: { code: 1234, category: ts.DiagnosticCategory.Error, key: "An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file_1234", message: "An ambient module declaration is only allowed at the top level in a file." }, + A_namespace_declaration_is_only_allowed_in_a_namespace_or_module: { code: 1235, category: ts.DiagnosticCategory.Error, key: "A_namespace_declaration_is_only_allowed_in_a_namespace_or_module_1235", message: "A namespace declaration is only allowed in a namespace or module." }, + The_return_type_of_a_property_decorator_function_must_be_either_void_or_any: { code: 1236, category: ts.DiagnosticCategory.Error, key: "The_return_type_of_a_property_decorator_function_must_be_either_void_or_any_1236", message: "The return type of a property decorator function must be either 'void' or 'any'." }, + The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any: { code: 1237, category: ts.DiagnosticCategory.Error, key: "The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any_1237", message: "The return type of a parameter decorator function must be either 'void' or 'any'." }, + Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression: { code: 1238, category: ts.DiagnosticCategory.Error, key: "Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression_1238", message: "Unable to resolve signature of class decorator when called as an expression." }, + Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression: { code: 1239, category: ts.DiagnosticCategory.Error, key: "Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression_1239", message: "Unable to resolve signature of parameter decorator when called as an expression." }, + Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression: { code: 1240, category: ts.DiagnosticCategory.Error, key: "Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression_1240", message: "Unable to resolve signature of property decorator when called as an expression." }, + Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression: { code: 1241, category: ts.DiagnosticCategory.Error, key: "Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression_1241", message: "Unable to resolve signature of method decorator when called as an expression." }, + abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration: { code: 1242, category: ts.DiagnosticCategory.Error, key: "abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration_1242", message: "'abstract' modifier can only appear on a class, method, or property declaration." }, + _0_modifier_cannot_be_used_with_1_modifier: { code: 1243, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_be_used_with_1_modifier_1243", message: "'{0}' modifier cannot be used with '{1}' modifier." }, + Abstract_methods_can_only_appear_within_an_abstract_class: { code: 1244, category: ts.DiagnosticCategory.Error, key: "Abstract_methods_can_only_appear_within_an_abstract_class_1244", message: "Abstract methods can only appear within an abstract class." }, + Method_0_cannot_have_an_implementation_because_it_is_marked_abstract: { code: 1245, category: ts.DiagnosticCategory.Error, key: "Method_0_cannot_have_an_implementation_because_it_is_marked_abstract_1245", message: "Method '{0}' cannot have an implementation because it is marked abstract." }, + An_interface_property_cannot_have_an_initializer: { code: 1246, category: ts.DiagnosticCategory.Error, key: "An_interface_property_cannot_have_an_initializer_1246", message: "An interface property cannot have an initializer." }, + A_type_literal_property_cannot_have_an_initializer: { code: 1247, category: ts.DiagnosticCategory.Error, key: "A_type_literal_property_cannot_have_an_initializer_1247", message: "A type literal property cannot have an initializer." }, + A_class_member_cannot_have_the_0_keyword: { code: 1248, category: ts.DiagnosticCategory.Error, key: "A_class_member_cannot_have_the_0_keyword_1248", message: "A class member cannot have the '{0}' keyword." }, + A_decorator_can_only_decorate_a_method_implementation_not_an_overload: { code: 1249, category: ts.DiagnosticCategory.Error, key: "A_decorator_can_only_decorate_a_method_implementation_not_an_overload_1249", message: "A decorator can only decorate a method implementation, not an overload." }, + Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5: { code: 1250, category: ts.DiagnosticCategory.Error, key: "Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_1250", message: "Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'." }, + Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Class_definitions_are_automatically_in_strict_mode: { code: 1251, category: ts.DiagnosticCategory.Error, key: "Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Class_d_1251", message: "Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. Class definitions are automatically in strict mode." }, + Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Modules_are_automatically_in_strict_mode: { code: 1252, category: ts.DiagnosticCategory.Error, key: "Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Modules_1252", message: "Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. Modules are automatically in strict mode." }, + with_statements_are_not_allowed_in_an_async_function_block: { code: 1300, category: ts.DiagnosticCategory.Error, key: "with_statements_are_not_allowed_in_an_async_function_block_1300", message: "'with' statements are not allowed in an async function block." }, + await_expression_is_only_allowed_within_an_async_function: { code: 1308, category: ts.DiagnosticCategory.Error, key: "await_expression_is_only_allowed_within_an_async_function_1308", message: "'await' expression is only allowed within an async function." }, + Async_functions_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1311, category: ts.DiagnosticCategory.Error, key: "Async_functions_are_only_available_when_targeting_ECMAScript_6_and_higher_1311", message: "Async functions are only available when targeting ECMAScript 6 and higher." }, + can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment: { code: 1312, category: ts.DiagnosticCategory.Error, key: "can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment_1312", message: "'=' can only be used in an object literal property inside a destructuring assignment." }, + The_body_of_an_if_statement_cannot_be_the_empty_statement: { code: 1313, category: ts.DiagnosticCategory.Error, key: "The_body_of_an_if_statement_cannot_be_the_empty_statement_1313", message: "The body of an 'if' statement cannot be the empty statement." }, + Global_module_exports_may_only_appear_in_module_files: { code: 1314, category: ts.DiagnosticCategory.Error, key: "Global_module_exports_may_only_appear_in_module_files_1314", message: "Global module exports may only appear in module files." }, + Global_module_exports_may_only_appear_in_declaration_files: { code: 1315, category: ts.DiagnosticCategory.Error, key: "Global_module_exports_may_only_appear_in_declaration_files_1315", message: "Global module exports may only appear in declaration files." }, + Global_module_exports_may_only_appear_at_top_level: { code: 1316, category: ts.DiagnosticCategory.Error, key: "Global_module_exports_may_only_appear_at_top_level_1316", message: "Global module exports may only appear at top level." }, + Duplicate_identifier_0: { code: 2300, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_0_2300", message: "Duplicate identifier '{0}'." }, + Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: ts.DiagnosticCategory.Error, key: "Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301", message: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, + Static_members_cannot_reference_class_type_parameters: { code: 2302, category: ts.DiagnosticCategory.Error, key: "Static_members_cannot_reference_class_type_parameters_2302", message: "Static members cannot reference class type parameters." }, + Circular_definition_of_import_alias_0: { code: 2303, category: ts.DiagnosticCategory.Error, key: "Circular_definition_of_import_alias_0_2303", message: "Circular definition of import alias '{0}'." }, + Cannot_find_name_0: { code: 2304, category: ts.DiagnosticCategory.Error, key: "Cannot_find_name_0_2304", message: "Cannot find name '{0}'." }, + Module_0_has_no_exported_member_1: { code: 2305, category: ts.DiagnosticCategory.Error, key: "Module_0_has_no_exported_member_1_2305", message: "Module '{0}' has no exported member '{1}'." }, + File_0_is_not_a_module: { code: 2306, category: ts.DiagnosticCategory.Error, key: "File_0_is_not_a_module_2306", message: "File '{0}' is not a module." }, + Cannot_find_module_0: { code: 2307, category: ts.DiagnosticCategory.Error, key: "Cannot_find_module_0_2307", message: "Cannot find module '{0}'." }, + Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambiguity: { code: 2308, category: ts.DiagnosticCategory.Error, key: "Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambig_2308", message: "Module {0} has already exported a member named '{1}'. Consider explicitly re-exporting to resolve the ambiguity." }, + An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements: { code: 2309, category: ts.DiagnosticCategory.Error, key: "An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements_2309", message: "An export assignment cannot be used in a module with other exported elements." }, + Type_0_recursively_references_itself_as_a_base_type: { code: 2310, category: ts.DiagnosticCategory.Error, key: "Type_0_recursively_references_itself_as_a_base_type_2310", message: "Type '{0}' recursively references itself as a base type." }, + A_class_may_only_extend_another_class: { code: 2311, category: ts.DiagnosticCategory.Error, key: "A_class_may_only_extend_another_class_2311", message: "A class may only extend another class." }, + An_interface_may_only_extend_a_class_or_another_interface: { code: 2312, category: ts.DiagnosticCategory.Error, key: "An_interface_may_only_extend_a_class_or_another_interface_2312", message: "An interface may only extend a class or another interface." }, + Type_parameter_0_has_a_circular_constraint: { code: 2313, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_has_a_circular_constraint_2313", message: "Type parameter '{0}' has a circular constraint." }, + Generic_type_0_requires_1_type_argument_s: { code: 2314, category: ts.DiagnosticCategory.Error, key: "Generic_type_0_requires_1_type_argument_s_2314", message: "Generic type '{0}' requires {1} type argument(s)." }, + Type_0_is_not_generic: { code: 2315, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_generic_2315", message: "Type '{0}' is not generic." }, + Global_type_0_must_be_a_class_or_interface_type: { code: 2316, category: ts.DiagnosticCategory.Error, key: "Global_type_0_must_be_a_class_or_interface_type_2316", message: "Global type '{0}' must be a class or interface type." }, + Global_type_0_must_have_1_type_parameter_s: { code: 2317, category: ts.DiagnosticCategory.Error, key: "Global_type_0_must_have_1_type_parameter_s_2317", message: "Global type '{0}' must have {1} type parameter(s)." }, + Cannot_find_global_type_0: { code: 2318, category: ts.DiagnosticCategory.Error, key: "Cannot_find_global_type_0_2318", message: "Cannot find global type '{0}'." }, + Named_property_0_of_types_1_and_2_are_not_identical: { code: 2319, category: ts.DiagnosticCategory.Error, key: "Named_property_0_of_types_1_and_2_are_not_identical_2319", message: "Named property '{0}' of types '{1}' and '{2}' are not identical." }, + Interface_0_cannot_simultaneously_extend_types_1_and_2: { code: 2320, category: ts.DiagnosticCategory.Error, key: "Interface_0_cannot_simultaneously_extend_types_1_and_2_2320", message: "Interface '{0}' cannot simultaneously extend types '{1}' and '{2}'." }, + Excessive_stack_depth_comparing_types_0_and_1: { code: 2321, category: ts.DiagnosticCategory.Error, key: "Excessive_stack_depth_comparing_types_0_and_1_2321", message: "Excessive stack depth comparing types '{0}' and '{1}'." }, + Type_0_is_not_assignable_to_type_1: { code: 2322, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_assignable_to_type_1_2322", message: "Type '{0}' is not assignable to type '{1}'." }, + Cannot_redeclare_exported_variable_0: { code: 2323, category: ts.DiagnosticCategory.Error, key: "Cannot_redeclare_exported_variable_0_2323", message: "Cannot redeclare exported variable '{0}'." }, + Property_0_is_missing_in_type_1: { code: 2324, category: ts.DiagnosticCategory.Error, key: "Property_0_is_missing_in_type_1_2324", message: "Property '{0}' is missing in type '{1}'." }, + Property_0_is_private_in_type_1_but_not_in_type_2: { code: 2325, category: ts.DiagnosticCategory.Error, key: "Property_0_is_private_in_type_1_but_not_in_type_2_2325", message: "Property '{0}' is private in type '{1}' but not in type '{2}'." }, + Types_of_property_0_are_incompatible: { code: 2326, category: ts.DiagnosticCategory.Error, key: "Types_of_property_0_are_incompatible_2326", message: "Types of property '{0}' are incompatible." }, + Property_0_is_optional_in_type_1_but_required_in_type_2: { code: 2327, category: ts.DiagnosticCategory.Error, key: "Property_0_is_optional_in_type_1_but_required_in_type_2_2327", message: "Property '{0}' is optional in type '{1}' but required in type '{2}'." }, + Types_of_parameters_0_and_1_are_incompatible: { code: 2328, category: ts.DiagnosticCategory.Error, key: "Types_of_parameters_0_and_1_are_incompatible_2328", message: "Types of parameters '{0}' and '{1}' are incompatible." }, + Index_signature_is_missing_in_type_0: { code: 2329, category: ts.DiagnosticCategory.Error, key: "Index_signature_is_missing_in_type_0_2329", message: "Index signature is missing in type '{0}'." }, + Index_signatures_are_incompatible: { code: 2330, category: ts.DiagnosticCategory.Error, key: "Index_signatures_are_incompatible_2330", message: "Index signatures are incompatible." }, + this_cannot_be_referenced_in_a_module_or_namespace_body: { code: 2331, category: ts.DiagnosticCategory.Error, key: "this_cannot_be_referenced_in_a_module_or_namespace_body_2331", message: "'this' cannot be referenced in a module or namespace body." }, + this_cannot_be_referenced_in_current_location: { code: 2332, category: ts.DiagnosticCategory.Error, key: "this_cannot_be_referenced_in_current_location_2332", message: "'this' cannot be referenced in current location." }, + this_cannot_be_referenced_in_constructor_arguments: { code: 2333, category: ts.DiagnosticCategory.Error, key: "this_cannot_be_referenced_in_constructor_arguments_2333", message: "'this' cannot be referenced in constructor arguments." }, + this_cannot_be_referenced_in_a_static_property_initializer: { code: 2334, category: ts.DiagnosticCategory.Error, key: "this_cannot_be_referenced_in_a_static_property_initializer_2334", message: "'this' cannot be referenced in a static property initializer." }, + super_can_only_be_referenced_in_a_derived_class: { code: 2335, category: ts.DiagnosticCategory.Error, key: "super_can_only_be_referenced_in_a_derived_class_2335", message: "'super' can only be referenced in a derived class." }, + super_cannot_be_referenced_in_constructor_arguments: { code: 2336, category: ts.DiagnosticCategory.Error, key: "super_cannot_be_referenced_in_constructor_arguments_2336", message: "'super' cannot be referenced in constructor arguments." }, + Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors: { code: 2337, category: ts.DiagnosticCategory.Error, key: "Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors_2337", message: "Super calls are not permitted outside constructors or in nested functions inside constructors." }, + super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class: { code: 2338, category: ts.DiagnosticCategory.Error, key: "super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_der_2338", message: "'super' property access is permitted only in a constructor, member function, or member accessor of a derived class." }, + Property_0_does_not_exist_on_type_1: { code: 2339, category: ts.DiagnosticCategory.Error, key: "Property_0_does_not_exist_on_type_1_2339", message: "Property '{0}' does not exist on type '{1}'." }, + Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: { code: 2340, category: ts.DiagnosticCategory.Error, key: "Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword_2340", message: "Only public and protected methods of the base class are accessible via the 'super' keyword." }, + Property_0_is_private_and_only_accessible_within_class_1: { code: 2341, category: ts.DiagnosticCategory.Error, key: "Property_0_is_private_and_only_accessible_within_class_1_2341", message: "Property '{0}' is private and only accessible within class '{1}'." }, + An_index_expression_argument_must_be_of_type_string_number_symbol_or_any: { code: 2342, category: ts.DiagnosticCategory.Error, key: "An_index_expression_argument_must_be_of_type_string_number_symbol_or_any_2342", message: "An index expression argument must be of type 'string', 'number', 'symbol', or 'any'." }, + Type_0_does_not_satisfy_the_constraint_1: { code: 2344, category: ts.DiagnosticCategory.Error, key: "Type_0_does_not_satisfy_the_constraint_1_2344", message: "Type '{0}' does not satisfy the constraint '{1}'." }, + Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: { code: 2345, category: ts.DiagnosticCategory.Error, key: "Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_2345", message: "Argument of type '{0}' is not assignable to parameter of type '{1}'." }, + Supplied_parameters_do_not_match_any_signature_of_call_target: { code: 2346, category: ts.DiagnosticCategory.Error, key: "Supplied_parameters_do_not_match_any_signature_of_call_target_2346", message: "Supplied parameters do not match any signature of call target." }, + Untyped_function_calls_may_not_accept_type_arguments: { code: 2347, category: ts.DiagnosticCategory.Error, key: "Untyped_function_calls_may_not_accept_type_arguments_2347", message: "Untyped function calls may not accept type arguments." }, + Value_of_type_0_is_not_callable_Did_you_mean_to_include_new: { code: 2348, category: ts.DiagnosticCategory.Error, key: "Value_of_type_0_is_not_callable_Did_you_mean_to_include_new_2348", message: "Value of type '{0}' is not callable. Did you mean to include 'new'?" }, + Cannot_invoke_an_expression_whose_type_lacks_a_call_signature: { code: 2349, category: ts.DiagnosticCategory.Error, key: "Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_2349", message: "Cannot invoke an expression whose type lacks a call signature." }, + Only_a_void_function_can_be_called_with_the_new_keyword: { code: 2350, category: ts.DiagnosticCategory.Error, key: "Only_a_void_function_can_be_called_with_the_new_keyword_2350", message: "Only a void function can be called with the 'new' keyword." }, + Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature: { code: 2351, category: ts.DiagnosticCategory.Error, key: "Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature_2351", message: "Cannot use 'new' with an expression whose type lacks a call or construct signature." }, + Type_0_cannot_be_converted_to_type_1: { code: 2352, category: ts.DiagnosticCategory.Error, key: "Type_0_cannot_be_converted_to_type_1_2352", message: "Type '{0}' cannot be converted to type '{1}'." }, + Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1: { code: 2353, category: ts.DiagnosticCategory.Error, key: "Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1_2353", message: "Object literal may only specify known properties, and '{0}' does not exist in type '{1}'." }, + No_best_common_type_exists_among_return_expressions: { code: 2354, category: ts.DiagnosticCategory.Error, key: "No_best_common_type_exists_among_return_expressions_2354", message: "No best common type exists among return expressions." }, + A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value: { code: 2355, category: ts.DiagnosticCategory.Error, key: "A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_2355", message: "A function whose declared type is neither 'void' nor 'any' must return a value." }, + An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type: { code: 2356, category: ts.DiagnosticCategory.Error, key: "An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type_2356", message: "An arithmetic operand must be of type 'any', 'number' or an enum type." }, + The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer: { code: 2357, category: ts.DiagnosticCategory.Error, key: "The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer_2357", message: "The operand of an increment or decrement operator must be a variable, property or indexer." }, + The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2358, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_paramete_2358", message: "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter." }, + The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: { code: 2359, category: ts.DiagnosticCategory.Error, key: "The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_F_2359", message: "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type." }, + The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol: { code: 2360, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol_2360", message: "The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'." }, + The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2361, category: ts.DiagnosticCategory.Error, key: "The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter_2361", message: "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter" }, + The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2362, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type_2362", message: "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, + The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2363, category: ts.DiagnosticCategory.Error, key: "The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type_2363", message: "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, + Invalid_left_hand_side_of_assignment_expression: { code: 2364, category: ts.DiagnosticCategory.Error, key: "Invalid_left_hand_side_of_assignment_expression_2364", message: "Invalid left-hand side of assignment expression." }, + Operator_0_cannot_be_applied_to_types_1_and_2: { code: 2365, category: ts.DiagnosticCategory.Error, key: "Operator_0_cannot_be_applied_to_types_1_and_2_2365", message: "Operator '{0}' cannot be applied to types '{1}' and '{2}'." }, + Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined: { code: 2366, category: ts.DiagnosticCategory.Error, key: "Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined_2366", message: "Function lacks ending return statement and return type does not include 'undefined'." }, + Type_parameter_name_cannot_be_0: { code: 2368, category: ts.DiagnosticCategory.Error, key: "Type_parameter_name_cannot_be_0_2368", message: "Type parameter name cannot be '{0}'" }, + A_parameter_property_is_only_allowed_in_a_constructor_implementation: { code: 2369, category: ts.DiagnosticCategory.Error, key: "A_parameter_property_is_only_allowed_in_a_constructor_implementation_2369", message: "A parameter property is only allowed in a constructor implementation." }, + A_rest_parameter_must_be_of_an_array_type: { code: 2370, category: ts.DiagnosticCategory.Error, key: "A_rest_parameter_must_be_of_an_array_type_2370", message: "A rest parameter must be of an array type." }, + A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation: { code: 2371, category: ts.DiagnosticCategory.Error, key: "A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation_2371", message: "A parameter initializer is only allowed in a function or constructor implementation." }, + Parameter_0_cannot_be_referenced_in_its_initializer: { code: 2372, category: ts.DiagnosticCategory.Error, key: "Parameter_0_cannot_be_referenced_in_its_initializer_2372", message: "Parameter '{0}' cannot be referenced in its initializer." }, + Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it: { code: 2373, category: ts.DiagnosticCategory.Error, key: "Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it_2373", message: "Initializer of parameter '{0}' cannot reference identifier '{1}' declared after it." }, + Duplicate_string_index_signature: { code: 2374, category: ts.DiagnosticCategory.Error, key: "Duplicate_string_index_signature_2374", message: "Duplicate string index signature." }, + Duplicate_number_index_signature: { code: 2375, category: ts.DiagnosticCategory.Error, key: "Duplicate_number_index_signature_2375", message: "Duplicate number index signature." }, + A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties: { code: 2376, category: ts.DiagnosticCategory.Error, key: "A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_proper_2376", message: "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties." }, + Constructors_for_derived_classes_must_contain_a_super_call: { code: 2377, category: ts.DiagnosticCategory.Error, key: "Constructors_for_derived_classes_must_contain_a_super_call_2377", message: "Constructors for derived classes must contain a 'super' call." }, + A_get_accessor_must_return_a_value: { code: 2378, category: ts.DiagnosticCategory.Error, key: "A_get_accessor_must_return_a_value_2378", message: "A 'get' accessor must return a value." }, + Getter_and_setter_accessors_do_not_agree_in_visibility: { code: 2379, category: ts.DiagnosticCategory.Error, key: "Getter_and_setter_accessors_do_not_agree_in_visibility_2379", message: "Getter and setter accessors do not agree in visibility." }, + get_and_set_accessor_must_have_the_same_type: { code: 2380, category: ts.DiagnosticCategory.Error, key: "get_and_set_accessor_must_have_the_same_type_2380", message: "'get' and 'set' accessor must have the same type." }, + A_signature_with_an_implementation_cannot_use_a_string_literal_type: { code: 2381, category: ts.DiagnosticCategory.Error, key: "A_signature_with_an_implementation_cannot_use_a_string_literal_type_2381", message: "A signature with an implementation cannot use a string literal type." }, + Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature: { code: 2382, category: ts.DiagnosticCategory.Error, key: "Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature_2382", message: "Specialized overload signature is not assignable to any non-specialized signature." }, + Overload_signatures_must_all_be_exported_or_non_exported: { code: 2383, category: ts.DiagnosticCategory.Error, key: "Overload_signatures_must_all_be_exported_or_non_exported_2383", message: "Overload signatures must all be exported or non-exported." }, + Overload_signatures_must_all_be_ambient_or_non_ambient: { code: 2384, category: ts.DiagnosticCategory.Error, key: "Overload_signatures_must_all_be_ambient_or_non_ambient_2384", message: "Overload signatures must all be ambient or non-ambient." }, + Overload_signatures_must_all_be_public_private_or_protected: { code: 2385, category: ts.DiagnosticCategory.Error, key: "Overload_signatures_must_all_be_public_private_or_protected_2385", message: "Overload signatures must all be public, private or protected." }, + Overload_signatures_must_all_be_optional_or_required: { code: 2386, category: ts.DiagnosticCategory.Error, key: "Overload_signatures_must_all_be_optional_or_required_2386", message: "Overload signatures must all be optional or required." }, + Function_overload_must_be_static: { code: 2387, category: ts.DiagnosticCategory.Error, key: "Function_overload_must_be_static_2387", message: "Function overload must be static." }, + Function_overload_must_not_be_static: { code: 2388, category: ts.DiagnosticCategory.Error, key: "Function_overload_must_not_be_static_2388", message: "Function overload must not be static." }, + Function_implementation_name_must_be_0: { code: 2389, category: ts.DiagnosticCategory.Error, key: "Function_implementation_name_must_be_0_2389", message: "Function implementation name must be '{0}'." }, + Constructor_implementation_is_missing: { code: 2390, category: ts.DiagnosticCategory.Error, key: "Constructor_implementation_is_missing_2390", message: "Constructor implementation is missing." }, + Function_implementation_is_missing_or_not_immediately_following_the_declaration: { code: 2391, category: ts.DiagnosticCategory.Error, key: "Function_implementation_is_missing_or_not_immediately_following_the_declaration_2391", message: "Function implementation is missing or not immediately following the declaration." }, + Multiple_constructor_implementations_are_not_allowed: { code: 2392, category: ts.DiagnosticCategory.Error, key: "Multiple_constructor_implementations_are_not_allowed_2392", message: "Multiple constructor implementations are not allowed." }, + Duplicate_function_implementation: { code: 2393, category: ts.DiagnosticCategory.Error, key: "Duplicate_function_implementation_2393", message: "Duplicate function implementation." }, + Overload_signature_is_not_compatible_with_function_implementation: { code: 2394, category: ts.DiagnosticCategory.Error, key: "Overload_signature_is_not_compatible_with_function_implementation_2394", message: "Overload signature is not compatible with function implementation." }, + Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local: { code: 2395, category: ts.DiagnosticCategory.Error, key: "Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local_2395", message: "Individual declarations in merged declaration '{0}' must be all exported or all local." }, + Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters: { code: 2396, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters_2396", message: "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters." }, + Declaration_name_conflicts_with_built_in_global_identifier_0: { code: 2397, category: ts.DiagnosticCategory.Error, key: "Declaration_name_conflicts_with_built_in_global_identifier_0_2397", message: "Declaration name conflicts with built-in global identifier '{0}'." }, + Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference: { code: 2399, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference_2399", message: "Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference." }, + Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference: { code: 2400, category: ts.DiagnosticCategory.Error, key: "Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference_2400", message: "Expression resolves to variable declaration '_this' that compiler uses to capture 'this' reference." }, + Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference: { code: 2401, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference_2401", message: "Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference." }, + Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference: { code: 2402, category: ts.DiagnosticCategory.Error, key: "Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference_2402", message: "Expression resolves to '_super' that compiler uses to capture base class reference." }, + Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2: { code: 2403, category: ts.DiagnosticCategory.Error, key: "Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_t_2403", message: "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'." }, + The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation: { code: 2404, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation_2404", message: "The left-hand side of a 'for...in' statement cannot use a type annotation." }, + The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any: { code: 2405, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any_2405", message: "The left-hand side of a 'for...in' statement must be of type 'string' or 'any'." }, + Invalid_left_hand_side_in_for_in_statement: { code: 2406, category: ts.DiagnosticCategory.Error, key: "Invalid_left_hand_side_in_for_in_statement_2406", message: "Invalid left-hand side in 'for...in' statement." }, + The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2407, category: ts.DiagnosticCategory.Error, key: "The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_2407", message: "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter." }, + Setters_cannot_return_a_value: { code: 2408, category: ts.DiagnosticCategory.Error, key: "Setters_cannot_return_a_value_2408", message: "Setters cannot return a value." }, + Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class: { code: 2409, category: ts.DiagnosticCategory.Error, key: "Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class_2409", message: "Return type of constructor signature must be assignable to the instance type of the class" }, + All_symbols_within_a_with_block_will_be_resolved_to_any: { code: 2410, category: ts.DiagnosticCategory.Error, key: "All_symbols_within_a_with_block_will_be_resolved_to_any_2410", message: "All symbols within a 'with' block will be resolved to 'any'." }, + Property_0_of_type_1_is_not_assignable_to_string_index_type_2: { code: 2411, category: ts.DiagnosticCategory.Error, key: "Property_0_of_type_1_is_not_assignable_to_string_index_type_2_2411", message: "Property '{0}' of type '{1}' is not assignable to string index type '{2}'." }, + Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2: { code: 2412, category: ts.DiagnosticCategory.Error, key: "Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2_2412", message: "Property '{0}' of type '{1}' is not assignable to numeric index type '{2}'." }, + Numeric_index_type_0_is_not_assignable_to_string_index_type_1: { code: 2413, category: ts.DiagnosticCategory.Error, key: "Numeric_index_type_0_is_not_assignable_to_string_index_type_1_2413", message: "Numeric index type '{0}' is not assignable to string index type '{1}'." }, + Class_name_cannot_be_0: { code: 2414, category: ts.DiagnosticCategory.Error, key: "Class_name_cannot_be_0_2414", message: "Class name cannot be '{0}'" }, + Class_0_incorrectly_extends_base_class_1: { code: 2415, category: ts.DiagnosticCategory.Error, key: "Class_0_incorrectly_extends_base_class_1_2415", message: "Class '{0}' incorrectly extends base class '{1}'." }, + Class_static_side_0_incorrectly_extends_base_class_static_side_1: { code: 2417, category: ts.DiagnosticCategory.Error, key: "Class_static_side_0_incorrectly_extends_base_class_static_side_1_2417", message: "Class static side '{0}' incorrectly extends base class static side '{1}'." }, + Class_0_incorrectly_implements_interface_1: { code: 2420, category: ts.DiagnosticCategory.Error, key: "Class_0_incorrectly_implements_interface_1_2420", message: "Class '{0}' incorrectly implements interface '{1}'." }, + A_class_may_only_implement_another_class_or_interface: { code: 2422, category: ts.DiagnosticCategory.Error, key: "A_class_may_only_implement_another_class_or_interface_2422", message: "A class may only implement another class or interface." }, + Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor: { code: 2423, category: ts.DiagnosticCategory.Error, key: "Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_access_2423", message: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor." }, + Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property: { code: 2424, category: ts.DiagnosticCategory.Error, key: "Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_proper_2424", message: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property." }, + Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 2425, category: ts.DiagnosticCategory.Error, key: "Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_functi_2425", message: "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function." }, + Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 2426, category: ts.DiagnosticCategory.Error, key: "Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_functi_2426", message: "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function." }, + Interface_name_cannot_be_0: { code: 2427, category: ts.DiagnosticCategory.Error, key: "Interface_name_cannot_be_0_2427", message: "Interface name cannot be '{0}'" }, + All_declarations_of_0_must_have_identical_type_parameters: { code: 2428, category: ts.DiagnosticCategory.Error, key: "All_declarations_of_0_must_have_identical_type_parameters_2428", message: "All declarations of '{0}' must have identical type parameters." }, + Interface_0_incorrectly_extends_interface_1: { code: 2430, category: ts.DiagnosticCategory.Error, key: "Interface_0_incorrectly_extends_interface_1_2430", message: "Interface '{0}' incorrectly extends interface '{1}'." }, + Enum_name_cannot_be_0: { code: 2431, category: ts.DiagnosticCategory.Error, key: "Enum_name_cannot_be_0_2431", message: "Enum name cannot be '{0}'" }, + In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element: { code: 2432, category: ts.DiagnosticCategory.Error, key: "In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enu_2432", message: "In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element." }, + A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged: { code: 2433, category: ts.DiagnosticCategory.Error, key: "A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merg_2433", message: "A namespace declaration cannot be in a different file from a class or function with which it is merged" }, + A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged: { code: 2434, category: ts.DiagnosticCategory.Error, key: "A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged_2434", message: "A namespace declaration cannot be located prior to a class or function with which it is merged" }, + Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces: { code: 2435, category: ts.DiagnosticCategory.Error, key: "Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces_2435", message: "Ambient modules cannot be nested in other modules or namespaces." }, + Ambient_module_declaration_cannot_specify_relative_module_name: { code: 2436, category: ts.DiagnosticCategory.Error, key: "Ambient_module_declaration_cannot_specify_relative_module_name_2436", message: "Ambient module declaration cannot specify relative module name." }, + Module_0_is_hidden_by_a_local_declaration_with_the_same_name: { code: 2437, category: ts.DiagnosticCategory.Error, key: "Module_0_is_hidden_by_a_local_declaration_with_the_same_name_2437", message: "Module '{0}' is hidden by a local declaration with the same name" }, + Import_name_cannot_be_0: { code: 2438, category: ts.DiagnosticCategory.Error, key: "Import_name_cannot_be_0_2438", message: "Import name cannot be '{0}'" }, + Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relative_module_name: { code: 2439, category: ts.DiagnosticCategory.Error, key: "Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relati_2439", message: "Import or export declaration in an ambient module declaration cannot reference module through relative module name." }, + Import_declaration_conflicts_with_local_declaration_of_0: { code: 2440, category: ts.DiagnosticCategory.Error, key: "Import_declaration_conflicts_with_local_declaration_of_0_2440", message: "Import declaration conflicts with local declaration of '{0}'" }, + Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module: { code: 2441, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_2441", message: "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of a module." }, + Types_have_separate_declarations_of_a_private_property_0: { code: 2442, category: ts.DiagnosticCategory.Error, key: "Types_have_separate_declarations_of_a_private_property_0_2442", message: "Types have separate declarations of a private property '{0}'." }, + Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2: { code: 2443, category: ts.DiagnosticCategory.Error, key: "Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2_2443", message: "Property '{0}' is protected but type '{1}' is not a class derived from '{2}'." }, + Property_0_is_protected_in_type_1_but_public_in_type_2: { code: 2444, category: ts.DiagnosticCategory.Error, key: "Property_0_is_protected_in_type_1_but_public_in_type_2_2444", message: "Property '{0}' is protected in type '{1}' but public in type '{2}'." }, + Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses: { code: 2445, category: ts.DiagnosticCategory.Error, key: "Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses_2445", message: "Property '{0}' is protected and only accessible within class '{1}' and its subclasses." }, + Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1: { code: 2446, category: ts.DiagnosticCategory.Error, key: "Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1_2446", message: "Property '{0}' is protected and only accessible through an instance of class '{1}'." }, + The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead: { code: 2447, category: ts.DiagnosticCategory.Error, key: "The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead_2447", message: "The '{0}' operator is not allowed for boolean types. Consider using '{1}' instead." }, + Block_scoped_variable_0_used_before_its_declaration: { code: 2448, category: ts.DiagnosticCategory.Error, key: "Block_scoped_variable_0_used_before_its_declaration_2448", message: "Block-scoped variable '{0}' used before its declaration." }, + The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant_or_a_read_only_property: { code: 2449, category: ts.DiagnosticCategory.Error, key: "The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant_or_a_read_only_property_2449", message: "The operand of an increment or decrement operator cannot be a constant or a read-only property." }, + Left_hand_side_of_assignment_expression_cannot_be_a_constant_or_a_read_only_property: { code: 2450, category: ts.DiagnosticCategory.Error, key: "Left_hand_side_of_assignment_expression_cannot_be_a_constant_or_a_read_only_property_2450", message: "Left-hand side of assignment expression cannot be a constant or a read-only property." }, + Cannot_redeclare_block_scoped_variable_0: { code: 2451, category: ts.DiagnosticCategory.Error, key: "Cannot_redeclare_block_scoped_variable_0_2451", message: "Cannot redeclare block-scoped variable '{0}'." }, + An_enum_member_cannot_have_a_numeric_name: { code: 2452, category: ts.DiagnosticCategory.Error, key: "An_enum_member_cannot_have_a_numeric_name_2452", message: "An enum member cannot have a numeric name." }, + The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly: { code: 2453, category: ts.DiagnosticCategory.Error, key: "The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_typ_2453", message: "The type argument for type parameter '{0}' cannot be inferred from the usage. Consider specifying the type arguments explicitly." }, + Variable_0_is_used_before_being_assigned: { code: 2454, category: ts.DiagnosticCategory.Error, key: "Variable_0_is_used_before_being_assigned_2454", message: "Variable '{0}' is used before being assigned." }, + Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0: { code: 2455, category: ts.DiagnosticCategory.Error, key: "Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0_2455", message: "Type argument candidate '{1}' is not a valid type argument because it is not a supertype of candidate '{0}'." }, + Type_alias_0_circularly_references_itself: { code: 2456, category: ts.DiagnosticCategory.Error, key: "Type_alias_0_circularly_references_itself_2456", message: "Type alias '{0}' circularly references itself." }, + Type_alias_name_cannot_be_0: { code: 2457, category: ts.DiagnosticCategory.Error, key: "Type_alias_name_cannot_be_0_2457", message: "Type alias name cannot be '{0}'" }, + An_AMD_module_cannot_have_multiple_name_assignments: { code: 2458, category: ts.DiagnosticCategory.Error, key: "An_AMD_module_cannot_have_multiple_name_assignments_2458", message: "An AMD module cannot have multiple name assignments." }, + Type_0_has_no_property_1_and_no_string_index_signature: { code: 2459, category: ts.DiagnosticCategory.Error, key: "Type_0_has_no_property_1_and_no_string_index_signature_2459", message: "Type '{0}' has no property '{1}' and no string index signature." }, + Type_0_has_no_property_1: { code: 2460, category: ts.DiagnosticCategory.Error, key: "Type_0_has_no_property_1_2460", message: "Type '{0}' has no property '{1}'." }, + Type_0_is_not_an_array_type: { code: 2461, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_an_array_type_2461", message: "Type '{0}' is not an array type." }, + A_rest_element_must_be_last_in_an_array_destructuring_pattern: { code: 2462, category: ts.DiagnosticCategory.Error, key: "A_rest_element_must_be_last_in_an_array_destructuring_pattern_2462", message: "A rest element must be last in an array destructuring pattern" }, + A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature: { code: 2463, category: ts.DiagnosticCategory.Error, key: "A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature_2463", message: "A binding pattern parameter cannot be optional in an implementation signature." }, + A_computed_property_name_must_be_of_type_string_number_symbol_or_any: { code: 2464, category: ts.DiagnosticCategory.Error, key: "A_computed_property_name_must_be_of_type_string_number_symbol_or_any_2464", message: "A computed property name must be of type 'string', 'number', 'symbol', or 'any'." }, + this_cannot_be_referenced_in_a_computed_property_name: { code: 2465, category: ts.DiagnosticCategory.Error, key: "this_cannot_be_referenced_in_a_computed_property_name_2465", message: "'this' cannot be referenced in a computed property name." }, + super_cannot_be_referenced_in_a_computed_property_name: { code: 2466, category: ts.DiagnosticCategory.Error, key: "super_cannot_be_referenced_in_a_computed_property_name_2466", message: "'super' cannot be referenced in a computed property name." }, + A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type: { code: 2467, category: ts.DiagnosticCategory.Error, key: "A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type_2467", message: "A computed property name cannot reference a type parameter from its containing type." }, + Cannot_find_global_value_0: { code: 2468, category: ts.DiagnosticCategory.Error, key: "Cannot_find_global_value_0_2468", message: "Cannot find global value '{0}'." }, + The_0_operator_cannot_be_applied_to_type_symbol: { code: 2469, category: ts.DiagnosticCategory.Error, key: "The_0_operator_cannot_be_applied_to_type_symbol_2469", message: "The '{0}' operator cannot be applied to type 'symbol'." }, + Symbol_reference_does_not_refer_to_the_global_Symbol_constructor_object: { code: 2470, category: ts.DiagnosticCategory.Error, key: "Symbol_reference_does_not_refer_to_the_global_Symbol_constructor_object_2470", message: "'Symbol' reference does not refer to the global Symbol constructor object." }, + A_computed_property_name_of_the_form_0_must_be_of_type_symbol: { code: 2471, category: ts.DiagnosticCategory.Error, key: "A_computed_property_name_of_the_form_0_must_be_of_type_symbol_2471", message: "A computed property name of the form '{0}' must be of type 'symbol'." }, + Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_5_and_higher: { code: 2472, category: ts.DiagnosticCategory.Error, key: "Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_5_and_higher_2472", message: "Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher." }, + Enum_declarations_must_all_be_const_or_non_const: { code: 2473, category: ts.DiagnosticCategory.Error, key: "Enum_declarations_must_all_be_const_or_non_const_2473", message: "Enum declarations must all be const or non-const." }, + In_const_enum_declarations_member_initializer_must_be_constant_expression: { code: 2474, category: ts.DiagnosticCategory.Error, key: "In_const_enum_declarations_member_initializer_must_be_constant_expression_2474", message: "In 'const' enum declarations member initializer must be constant expression." }, + const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment: { code: 2475, category: ts.DiagnosticCategory.Error, key: "const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_im_2475", message: "'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment." }, + A_const_enum_member_can_only_be_accessed_using_a_string_literal: { code: 2476, category: ts.DiagnosticCategory.Error, key: "A_const_enum_member_can_only_be_accessed_using_a_string_literal_2476", message: "A const enum member can only be accessed using a string literal." }, + const_enum_member_initializer_was_evaluated_to_a_non_finite_value: { code: 2477, category: ts.DiagnosticCategory.Error, key: "const_enum_member_initializer_was_evaluated_to_a_non_finite_value_2477", message: "'const' enum member initializer was evaluated to a non-finite value." }, + const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN: { code: 2478, category: ts.DiagnosticCategory.Error, key: "const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN_2478", message: "'const' enum member initializer was evaluated to disallowed value 'NaN'." }, + Property_0_does_not_exist_on_const_enum_1: { code: 2479, category: ts.DiagnosticCategory.Error, key: "Property_0_does_not_exist_on_const_enum_1_2479", message: "Property '{0}' does not exist on 'const' enum '{1}'." }, + let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations: { code: 2480, category: ts.DiagnosticCategory.Error, key: "let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations_2480", message: "'let' is not allowed to be used as a name in 'let' or 'const' declarations." }, + Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1: { code: 2481, category: ts.DiagnosticCategory.Error, key: "Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1_2481", message: "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'." }, + The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation: { code: 2483, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation_2483", message: "The left-hand side of a 'for...of' statement cannot use a type annotation." }, + Export_declaration_conflicts_with_exported_declaration_of_0: { code: 2484, category: ts.DiagnosticCategory.Error, key: "Export_declaration_conflicts_with_exported_declaration_of_0_2484", message: "Export declaration conflicts with exported declaration of '{0}'" }, + The_left_hand_side_of_a_for_of_statement_cannot_be_a_constant_or_a_read_only_property: { code: 2485, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_of_statement_cannot_be_a_constant_or_a_read_only_property_2485", message: "The left-hand side of a 'for...of' statement cannot be a constant or a read-only property." }, + The_left_hand_side_of_a_for_in_statement_cannot_be_a_constant_or_a_read_only_property: { code: 2486, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_in_statement_cannot_be_a_constant_or_a_read_only_property_2486", message: "The left-hand side of a 'for...in' statement cannot be a constant or a read-only property." }, + Invalid_left_hand_side_in_for_of_statement: { code: 2487, category: ts.DiagnosticCategory.Error, key: "Invalid_left_hand_side_in_for_of_statement_2487", message: "Invalid left-hand side in 'for...of' statement." }, + Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator: { code: 2488, category: ts.DiagnosticCategory.Error, key: "Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator_2488", message: "Type must have a '[Symbol.iterator]()' method that returns an iterator." }, + An_iterator_must_have_a_next_method: { code: 2489, category: ts.DiagnosticCategory.Error, key: "An_iterator_must_have_a_next_method_2489", message: "An iterator must have a 'next()' method." }, + The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property: { code: 2490, category: ts.DiagnosticCategory.Error, key: "The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property_2490", message: "The type returned by the 'next()' method of an iterator must have a 'value' property." }, + The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern: { code: 2491, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern_2491", message: "The left-hand side of a 'for...in' statement cannot be a destructuring pattern." }, + Cannot_redeclare_identifier_0_in_catch_clause: { code: 2492, category: ts.DiagnosticCategory.Error, key: "Cannot_redeclare_identifier_0_in_catch_clause_2492", message: "Cannot redeclare identifier '{0}' in catch clause" }, + Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2: { code: 2493, category: ts.DiagnosticCategory.Error, key: "Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2_2493", message: "Tuple type '{0}' with length '{1}' cannot be assigned to tuple with length '{2}'." }, + Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher: { code: 2494, category: ts.DiagnosticCategory.Error, key: "Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher_2494", message: "Using a string in a 'for...of' statement is only supported in ECMAScript 5 and higher." }, + Type_0_is_not_an_array_type_or_a_string_type: { code: 2495, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_an_array_type_or_a_string_type_2495", message: "Type '{0}' is not an array type or a string type." }, + The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression: { code: 2496, category: ts.DiagnosticCategory.Error, key: "The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_stand_2496", message: "The 'arguments' object cannot be referenced in an arrow function in ES3 and ES5. Consider using a standard function expression." }, + Module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct: { code: 2497, category: ts.DiagnosticCategory.Error, key: "Module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct_2497", message: "Module '{0}' resolves to a non-module entity and cannot be imported using this construct." }, + Module_0_uses_export_and_cannot_be_used_with_export_Asterisk: { code: 2498, category: ts.DiagnosticCategory.Error, key: "Module_0_uses_export_and_cannot_be_used_with_export_Asterisk_2498", message: "Module '{0}' uses 'export =' and cannot be used with 'export *'." }, + An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2499, category: ts.DiagnosticCategory.Error, key: "An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments_2499", message: "An interface can only extend an identifier/qualified-name with optional type arguments." }, + A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2500, category: ts.DiagnosticCategory.Error, key: "A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments_2500", message: "A class can only implement an identifier/qualified-name with optional type arguments." }, + A_rest_element_cannot_contain_a_binding_pattern: { code: 2501, category: ts.DiagnosticCategory.Error, key: "A_rest_element_cannot_contain_a_binding_pattern_2501", message: "A rest element cannot contain a binding pattern." }, + _0_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 2502, category: ts.DiagnosticCategory.Error, key: "_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation_2502", message: "'{0}' is referenced directly or indirectly in its own type annotation." }, + Cannot_find_namespace_0: { code: 2503, category: ts.DiagnosticCategory.Error, key: "Cannot_find_namespace_0_2503", message: "Cannot find namespace '{0}'." }, + No_best_common_type_exists_among_yield_expressions: { code: 2504, category: ts.DiagnosticCategory.Error, key: "No_best_common_type_exists_among_yield_expressions_2504", message: "No best common type exists among yield expressions." }, + A_generator_cannot_have_a_void_type_annotation: { code: 2505, category: ts.DiagnosticCategory.Error, key: "A_generator_cannot_have_a_void_type_annotation_2505", message: "A generator cannot have a 'void' type annotation." }, + _0_is_referenced_directly_or_indirectly_in_its_own_base_expression: { code: 2506, category: ts.DiagnosticCategory.Error, key: "_0_is_referenced_directly_or_indirectly_in_its_own_base_expression_2506", message: "'{0}' is referenced directly or indirectly in its own base expression." }, + Type_0_is_not_a_constructor_function_type: { code: 2507, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_a_constructor_function_type_2507", message: "Type '{0}' is not a constructor function type." }, + No_base_constructor_has_the_specified_number_of_type_arguments: { code: 2508, category: ts.DiagnosticCategory.Error, key: "No_base_constructor_has_the_specified_number_of_type_arguments_2508", message: "No base constructor has the specified number of type arguments." }, + Base_constructor_return_type_0_is_not_a_class_or_interface_type: { code: 2509, category: ts.DiagnosticCategory.Error, key: "Base_constructor_return_type_0_is_not_a_class_or_interface_type_2509", message: "Base constructor return type '{0}' is not a class or interface type." }, + Base_constructors_must_all_have_the_same_return_type: { code: 2510, category: ts.DiagnosticCategory.Error, key: "Base_constructors_must_all_have_the_same_return_type_2510", message: "Base constructors must all have the same return type." }, + Cannot_create_an_instance_of_the_abstract_class_0: { code: 2511, category: ts.DiagnosticCategory.Error, key: "Cannot_create_an_instance_of_the_abstract_class_0_2511", message: "Cannot create an instance of the abstract class '{0}'." }, + Overload_signatures_must_all_be_abstract_or_non_abstract: { code: 2512, category: ts.DiagnosticCategory.Error, key: "Overload_signatures_must_all_be_abstract_or_non_abstract_2512", message: "Overload signatures must all be abstract or non-abstract." }, + Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression: { code: 2513, category: ts.DiagnosticCategory.Error, key: "Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression_2513", message: "Abstract method '{0}' in class '{1}' cannot be accessed via super expression." }, + Classes_containing_abstract_methods_must_be_marked_abstract: { code: 2514, category: ts.DiagnosticCategory.Error, key: "Classes_containing_abstract_methods_must_be_marked_abstract_2514", message: "Classes containing abstract methods must be marked abstract." }, + Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2: { code: 2515, category: ts.DiagnosticCategory.Error, key: "Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2_2515", message: "Non-abstract class '{0}' does not implement inherited abstract member '{1}' from class '{2}'." }, + All_declarations_of_an_abstract_method_must_be_consecutive: { code: 2516, category: ts.DiagnosticCategory.Error, key: "All_declarations_of_an_abstract_method_must_be_consecutive_2516", message: "All declarations of an abstract method must be consecutive." }, + Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type: { code: 2517, category: ts.DiagnosticCategory.Error, key: "Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type_2517", message: "Cannot assign an abstract constructor type to a non-abstract constructor type." }, + A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard: { code: 2518, category: ts.DiagnosticCategory.Error, key: "A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard_2518", message: "A 'this'-based type guard is not compatible with a parameter-based type guard." }, + Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions: { code: 2520, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions_2520", message: "Duplicate identifier '{0}'. Compiler uses declaration '{1}' to support async functions." }, + Expression_resolves_to_variable_declaration_0_that_compiler_uses_to_support_async_functions: { code: 2521, category: ts.DiagnosticCategory.Error, key: "Expression_resolves_to_variable_declaration_0_that_compiler_uses_to_support_async_functions_2521", message: "Expression resolves to variable declaration '{0}' that compiler uses to support async functions." }, + The_arguments_object_cannot_be_referenced_in_an_async_arrow_function_Consider_using_a_standard_async_function_expression: { code: 2522, category: ts.DiagnosticCategory.Error, key: "The_arguments_object_cannot_be_referenced_in_an_async_arrow_function_Consider_using_a_standard_async_2522", message: "The 'arguments' object cannot be referenced in an async arrow function. Consider using a standard async function expression." }, + yield_expressions_cannot_be_used_in_a_parameter_initializer: { code: 2523, category: ts.DiagnosticCategory.Error, key: "yield_expressions_cannot_be_used_in_a_parameter_initializer_2523", message: "'yield' expressions cannot be used in a parameter initializer." }, + await_expressions_cannot_be_used_in_a_parameter_initializer: { code: 2524, category: ts.DiagnosticCategory.Error, key: "await_expressions_cannot_be_used_in_a_parameter_initializer_2524", message: "'await' expressions cannot be used in a parameter initializer." }, + Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value: { code: 2525, category: ts.DiagnosticCategory.Error, key: "Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value_2525", message: "Initializer provides no value for this binding element and the binding element has no default value." }, + A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface: { code: 2526, category: ts.DiagnosticCategory.Error, key: "A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface_2526", message: "A 'this' type is available only in a non-static member of a class or interface." }, + The_inferred_type_of_0_references_an_inaccessible_this_type_A_type_annotation_is_necessary: { code: 2527, category: ts.DiagnosticCategory.Error, key: "The_inferred_type_of_0_references_an_inaccessible_this_type_A_type_annotation_is_necessary_2527", message: "The inferred type of '{0}' references an inaccessible 'this' type. A type annotation is necessary." }, + A_module_cannot_have_multiple_default_exports: { code: 2528, category: ts.DiagnosticCategory.Error, key: "A_module_cannot_have_multiple_default_exports_2528", message: "A module cannot have multiple default exports." }, + Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions: { code: 2529, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_func_2529", message: "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of a module containing async functions." }, + Property_0_is_incompatible_with_index_signature: { code: 2530, category: ts.DiagnosticCategory.Error, key: "Property_0_is_incompatible_with_index_signature_2530", message: "Property '{0}' is incompatible with index signature." }, + Object_is_possibly_null: { code: 2531, category: ts.DiagnosticCategory.Error, key: "Object_is_possibly_null_2531", message: "Object is possibly 'null'." }, + Object_is_possibly_undefined: { code: 2532, category: ts.DiagnosticCategory.Error, key: "Object_is_possibly_undefined_2532", message: "Object is possibly 'undefined'." }, + Object_is_possibly_null_or_undefined: { code: 2533, category: ts.DiagnosticCategory.Error, key: "Object_is_possibly_null_or_undefined_2533", message: "Object is possibly 'null' or 'undefined'." }, + A_function_returning_never_cannot_have_a_reachable_end_point: { code: 2534, category: ts.DiagnosticCategory.Error, key: "A_function_returning_never_cannot_have_a_reachable_end_point_2534", message: "A function returning 'never' cannot have a reachable end point." }, + JSX_element_attributes_type_0_may_not_be_a_union_type: { code: 2600, category: ts.DiagnosticCategory.Error, key: "JSX_element_attributes_type_0_may_not_be_a_union_type_2600", message: "JSX element attributes type '{0}' may not be a union type." }, + The_return_type_of_a_JSX_element_constructor_must_return_an_object_type: { code: 2601, category: ts.DiagnosticCategory.Error, key: "The_return_type_of_a_JSX_element_constructor_must_return_an_object_type_2601", message: "The return type of a JSX element constructor must return an object type." }, + JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist: { code: 2602, category: ts.DiagnosticCategory.Error, key: "JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist_2602", message: "JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist." }, + Property_0_in_type_1_is_not_assignable_to_type_2: { code: 2603, category: ts.DiagnosticCategory.Error, key: "Property_0_in_type_1_is_not_assignable_to_type_2_2603", message: "Property '{0}' in type '{1}' is not assignable to type '{2}'" }, + JSX_element_type_0_does_not_have_any_construct_or_call_signatures: { code: 2604, category: ts.DiagnosticCategory.Error, key: "JSX_element_type_0_does_not_have_any_construct_or_call_signatures_2604", message: "JSX element type '{0}' does not have any construct or call signatures." }, + JSX_element_type_0_is_not_a_constructor_function_for_JSX_elements: { code: 2605, category: ts.DiagnosticCategory.Error, key: "JSX_element_type_0_is_not_a_constructor_function_for_JSX_elements_2605", message: "JSX element type '{0}' is not a constructor function for JSX elements." }, + Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property: { code: 2606, category: ts.DiagnosticCategory.Error, key: "Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property_2606", message: "Property '{0}' of JSX spread attribute is not assignable to target property." }, + JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property: { code: 2607, category: ts.DiagnosticCategory.Error, key: "JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property_2607", message: "JSX element class does not support attributes because it does not have a '{0}' property" }, + The_global_type_JSX_0_may_not_have_more_than_one_property: { code: 2608, category: ts.DiagnosticCategory.Error, key: "The_global_type_JSX_0_may_not_have_more_than_one_property_2608", message: "The global type 'JSX.{0}' may not have more than one property" }, + Cannot_emit_namespaced_JSX_elements_in_React: { code: 2650, category: ts.DiagnosticCategory.Error, key: "Cannot_emit_namespaced_JSX_elements_in_React_2650", message: "Cannot emit namespaced JSX elements in React" }, + A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: { code: 2651, category: ts.DiagnosticCategory.Error, key: "A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651", message: "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums." }, + Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: { code: 2652, category: ts.DiagnosticCategory.Error, key: "Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_d_2652", message: "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead." }, + Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1: { code: 2653, category: ts.DiagnosticCategory.Error, key: "Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1_2653", message: "Non-abstract class expression does not implement inherited abstract member '{0}' from class '{1}'." }, + Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_package_author_to_update_the_package_definition: { code: 2654, category: ts.DiagnosticCategory.Error, key: "Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_pack_2654", message: "Exported external package typings file cannot contain tripleslash references. Please contact the package author to update the package definition." }, + Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_the_package_definition: { code: 2656, category: ts.DiagnosticCategory.Error, key: "Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_2656", message: "Exported external package typings file '{0}' is not a module. Please contact the package author to update the package definition." }, + JSX_expressions_must_have_one_parent_element: { code: 2657, category: ts.DiagnosticCategory.Error, key: "JSX_expressions_must_have_one_parent_element_2657", message: "JSX expressions must have one parent element" }, + Type_0_provides_no_match_for_the_signature_1: { code: 2658, category: ts.DiagnosticCategory.Error, key: "Type_0_provides_no_match_for_the_signature_1_2658", message: "Type '{0}' provides no match for the signature '{1}'" }, + super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher: { code: 2659, category: ts.DiagnosticCategory.Error, key: "super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_highe_2659", message: "'super' is only allowed in members of object literal expressions when option 'target' is 'ES2015' or higher." }, + super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions: { code: 2660, category: ts.DiagnosticCategory.Error, key: "super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions_2660", message: "'super' can only be referenced in members of derived classes or object literal expressions." }, + Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module: { code: 2661, category: ts.DiagnosticCategory.Error, key: "Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module_2661", message: "Cannot export '{0}'. Only local declarations can be exported from a module." }, + Cannot_find_name_0_Did_you_mean_the_static_member_1_0: { code: 2662, category: ts.DiagnosticCategory.Error, key: "Cannot_find_name_0_Did_you_mean_the_static_member_1_0_2662", message: "Cannot find name '{0}'. Did you mean the static member '{1}.{0}'?" }, + Cannot_find_name_0_Did_you_mean_the_instance_member_this_0: { code: 2663, category: ts.DiagnosticCategory.Error, key: "Cannot_find_name_0_Did_you_mean_the_instance_member_this_0_2663", message: "Cannot find name '{0}'. Did you mean the instance member 'this.{0}'?" }, + Invalid_module_name_in_augmentation_module_0_cannot_be_found: { code: 2664, category: ts.DiagnosticCategory.Error, key: "Invalid_module_name_in_augmentation_module_0_cannot_be_found_2664", message: "Invalid module name in augmentation, module '{0}' cannot be found." }, + Exports_and_export_assignments_are_not_permitted_in_module_augmentations: { code: 2666, category: ts.DiagnosticCategory.Error, key: "Exports_and_export_assignments_are_not_permitted_in_module_augmentations_2666", message: "Exports and export assignments are not permitted in module augmentations." }, + Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module: { code: 2667, category: ts.DiagnosticCategory.Error, key: "Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_mod_2667", message: "Imports are not permitted in module augmentations. Consider moving them to the enclosing external module." }, + export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always_visible: { code: 2668, category: ts.DiagnosticCategory.Error, key: "export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always__2668", message: "'export' modifier cannot be applied to ambient modules and module augmentations since they are always visible." }, + Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_declarations: { code: 2669, category: ts.DiagnosticCategory.Error, key: "Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_2669", message: "Augmentations for the global scope can only be directly nested in external modules or ambient module declarations." }, + Augmentations_for_the_global_scope_should_have_declare_modifier_unless_they_appear_in_already_ambient_context: { code: 2670, category: ts.DiagnosticCategory.Error, key: "Augmentations_for_the_global_scope_should_have_declare_modifier_unless_they_appear_in_already_ambien_2670", message: "Augmentations for the global scope should have 'declare' modifier unless they appear in already ambient context." }, + Cannot_augment_module_0_because_it_resolves_to_a_non_module_entity: { code: 2671, category: ts.DiagnosticCategory.Error, key: "Cannot_augment_module_0_because_it_resolves_to_a_non_module_entity_2671", message: "Cannot augment module '{0}' because it resolves to a non-module entity." }, + Cannot_assign_a_0_constructor_type_to_a_1_constructor_type: { code: 2672, category: ts.DiagnosticCategory.Error, key: "Cannot_assign_a_0_constructor_type_to_a_1_constructor_type_2672", message: "Cannot assign a '{0}' constructor type to a '{1}' constructor type." }, + Constructor_of_class_0_is_private_and_only_accessible_within_the_class_declaration: { code: 2673, category: ts.DiagnosticCategory.Error, key: "Constructor_of_class_0_is_private_and_only_accessible_within_the_class_declaration_2673", message: "Constructor of class '{0}' is private and only accessible within the class declaration." }, + Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration: { code: 2674, category: ts.DiagnosticCategory.Error, key: "Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration_2674", message: "Constructor of class '{0}' is protected and only accessible within the class declaration." }, + Cannot_extend_a_class_0_Class_constructor_is_marked_as_private: { code: 2675, category: ts.DiagnosticCategory.Error, key: "Cannot_extend_a_class_0_Class_constructor_is_marked_as_private_2675", message: "Cannot extend a class '{0}'. Class constructor is marked as private." }, + Accessors_must_both_be_abstract_or_non_abstract: { code: 2676, category: ts.DiagnosticCategory.Error, key: "Accessors_must_both_be_abstract_or_non_abstract_2676", message: "Accessors must both be abstract or non-abstract." }, + A_type_predicate_s_type_must_be_assignable_to_its_parameter_s_type: { code: 2677, category: ts.DiagnosticCategory.Error, key: "A_type_predicate_s_type_must_be_assignable_to_its_parameter_s_type_2677", message: "A type predicate's type must be assignable to its parameter's type." }, + Type_0_is_not_comparable_to_type_1: { code: 2678, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_comparable_to_type_1_2678", message: "Type '{0}' is not comparable to type '{1}'." }, + A_function_that_is_called_with_the_new_keyword_cannot_have_a_this_type_that_is_void: { code: 2679, category: ts.DiagnosticCategory.Error, key: "A_function_that_is_called_with_the_new_keyword_cannot_have_a_this_type_that_is_void_2679", message: "A function that is called with the 'new' keyword cannot have a 'this' type that is 'void'." }, + A_this_parameter_must_be_the_first_parameter: { code: 2680, category: ts.DiagnosticCategory.Error, key: "A_this_parameter_must_be_the_first_parameter_2680", message: "A 'this' parameter must be the first parameter." }, + A_constructor_cannot_have_a_this_parameter: { code: 2681, category: ts.DiagnosticCategory.Error, key: "A_constructor_cannot_have_a_this_parameter_2681", message: "A constructor cannot have a 'this' parameter." }, + get_and_set_accessor_must_have_the_same_this_type: { code: 2682, category: ts.DiagnosticCategory.Error, key: "get_and_set_accessor_must_have_the_same_this_type_2682", message: "'get' and 'set' accessor must have the same 'this' type." }, + this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation: { code: 2683, category: ts.DiagnosticCategory.Error, key: "this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_2683", message: "'this' implicitly has type 'any' because it does not have a type annotation." }, + The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1: { code: 2684, category: ts.DiagnosticCategory.Error, key: "The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1_2684", message: "The 'this' context of type '{0}' is not assignable to method's 'this' of type '{1}'." }, + The_this_types_of_each_signature_are_incompatible: { code: 2685, category: ts.DiagnosticCategory.Error, key: "The_this_types_of_each_signature_are_incompatible_2685", message: "The 'this' types of each signature are incompatible." }, + Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import_declaration_0_is_using_private_name_1_4000", message: "Import declaration '{0}' is using private name '{1}'." }, + Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", message: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, + Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", message: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, + Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4006, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1_4006", message: "Type parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'." }, + Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4008, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1_4008", message: "Type parameter '{0}' of call signature from exported interface has or is using private name '{1}'." }, + Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { code: 4010, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1_4010", message: "Type parameter '{0}' of public static method from exported class has or is using private name '{1}'." }, + Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { code: 4012, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1_4012", message: "Type parameter '{0}' of public method from exported class has or is using private name '{1}'." }, + Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { code: 4014, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1_4014", message: "Type parameter '{0}' of method from exported interface has or is using private name '{1}'." }, + Type_parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4016, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_function_has_or_is_using_private_name_1_4016", message: "Type parameter '{0}' of exported function has or is using private name '{1}'." }, + Implements_clause_of_exported_class_0_has_or_is_using_private_name_1: { code: 4019, category: ts.DiagnosticCategory.Error, key: "Implements_clause_of_exported_class_0_has_or_is_using_private_name_1_4019", message: "Implements clause of exported class '{0}' has or is using private name '{1}'." }, + Extends_clause_of_exported_class_0_has_or_is_using_private_name_1: { code: 4020, category: ts.DiagnosticCategory.Error, key: "Extends_clause_of_exported_class_0_has_or_is_using_private_name_1_4020", message: "Extends clause of exported class '{0}' has or is using private name '{1}'." }, + Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1: { code: 4022, category: ts.DiagnosticCategory.Error, key: "Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1_4022", message: "Extends clause of exported interface '{0}' has or is using private name '{1}'." }, + Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4023, category: ts.DiagnosticCategory.Error, key: "Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named_4023", message: "Exported variable '{0}' has or is using name '{1}' from external module {2} but cannot be named." }, + Exported_variable_0_has_or_is_using_name_1_from_private_module_2: { code: 4024, category: ts.DiagnosticCategory.Error, key: "Exported_variable_0_has_or_is_using_name_1_from_private_module_2_4024", message: "Exported variable '{0}' has or is using name '{1}' from private module '{2}'." }, + Exported_variable_0_has_or_is_using_private_name_1: { code: 4025, category: ts.DiagnosticCategory.Error, key: "Exported_variable_0_has_or_is_using_private_name_1_4025", message: "Exported variable '{0}' has or is using private name '{1}'." }, + Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4026, category: ts.DiagnosticCategory.Error, key: "Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot__4026", message: "Public static property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named." }, + Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4027, category: ts.DiagnosticCategory.Error, key: "Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2_4027", message: "Public static property '{0}' of exported class has or is using name '{1}' from private module '{2}'." }, + Public_static_property_0_of_exported_class_has_or_is_using_private_name_1: { code: 4028, category: ts.DiagnosticCategory.Error, key: "Public_static_property_0_of_exported_class_has_or_is_using_private_name_1_4028", message: "Public static property '{0}' of exported class has or is using private name '{1}'." }, + Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4029, category: ts.DiagnosticCategory.Error, key: "Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_name_4029", message: "Public property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named." }, + Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4030, category: ts.DiagnosticCategory.Error, key: "Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2_4030", message: "Public property '{0}' of exported class has or is using name '{1}' from private module '{2}'." }, + Public_property_0_of_exported_class_has_or_is_using_private_name_1: { code: 4031, category: ts.DiagnosticCategory.Error, key: "Public_property_0_of_exported_class_has_or_is_using_private_name_1_4031", message: "Public property '{0}' of exported class has or is using private name '{1}'." }, + Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4032, category: ts.DiagnosticCategory.Error, key: "Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2_4032", message: "Property '{0}' of exported interface has or is using name '{1}' from private module '{2}'." }, + Property_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4033, category: ts.DiagnosticCategory.Error, key: "Property_0_of_exported_interface_has_or_is_using_private_name_1_4033", message: "Property '{0}' of exported interface has or is using private name '{1}'." }, + Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4034, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_4034", message: "Parameter '{0}' of public static property setter from exported class has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1: { code: 4035, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1_4035", message: "Parameter '{0}' of public static property setter from exported class has or is using private name '{1}'." }, + Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4036, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_4036", message: "Parameter '{0}' of public property setter from exported class has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1: { code: 4037, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1_4037", message: "Parameter '{0}' of public property setter from exported class has or is using private name '{1}'." }, + Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4038, category: ts.DiagnosticCategory.Error, key: "Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_externa_4038", message: "Return type of public static property getter from exported class has or is using name '{0}' from external module {1} but cannot be named." }, + Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4039, category: ts.DiagnosticCategory.Error, key: "Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_4039", message: "Return type of public static property getter from exported class has or is using name '{0}' from private module '{1}'." }, + Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0: { code: 4040, category: ts.DiagnosticCategory.Error, key: "Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0_4040", message: "Return type of public static property getter from exported class has or is using private name '{0}'." }, + Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4041, category: ts.DiagnosticCategory.Error, key: "Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_modul_4041", message: "Return type of public property getter from exported class has or is using name '{0}' from external module {1} but cannot be named." }, + Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4042, category: ts.DiagnosticCategory.Error, key: "Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_4042", message: "Return type of public property getter from exported class has or is using name '{0}' from private module '{1}'." }, + Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0: { code: 4043, category: ts.DiagnosticCategory.Error, key: "Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0_4043", message: "Return type of public property getter from exported class has or is using private name '{0}'." }, + Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4044, category: ts.DiagnosticCategory.Error, key: "Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_mod_4044", message: "Return type of constructor signature from exported interface has or is using name '{0}' from private module '{1}'." }, + Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4045, category: ts.DiagnosticCategory.Error, key: "Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0_4045", message: "Return type of constructor signature from exported interface has or is using private name '{0}'." }, + Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4046, category: ts.DiagnosticCategory.Error, key: "Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1_4046", message: "Return type of call signature from exported interface has or is using name '{0}' from private module '{1}'." }, + Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4047, category: ts.DiagnosticCategory.Error, key: "Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0_4047", message: "Return type of call signature from exported interface has or is using private name '{0}'." }, + Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4048, category: ts.DiagnosticCategory.Error, key: "Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1_4048", message: "Return type of index signature from exported interface has or is using name '{0}' from private module '{1}'." }, + Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4049, category: ts.DiagnosticCategory.Error, key: "Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0_4049", message: "Return type of index signature from exported interface has or is using private name '{0}'." }, + Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4050, category: ts.DiagnosticCategory.Error, key: "Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module__4050", message: "Return type of public static method from exported class has or is using name '{0}' from external module {1} but cannot be named." }, + Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4051, category: ts.DiagnosticCategory.Error, key: "Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1_4051", message: "Return type of public static method from exported class has or is using name '{0}' from private module '{1}'." }, + Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0: { code: 4052, category: ts.DiagnosticCategory.Error, key: "Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0_4052", message: "Return type of public static method from exported class has or is using private name '{0}'." }, + Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4053, category: ts.DiagnosticCategory.Error, key: "Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_c_4053", message: "Return type of public method from exported class has or is using name '{0}' from external module {1} but cannot be named." }, + Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4054, category: ts.DiagnosticCategory.Error, key: "Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1_4054", message: "Return type of public method from exported class has or is using name '{0}' from private module '{1}'." }, + Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0: { code: 4055, category: ts.DiagnosticCategory.Error, key: "Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0_4055", message: "Return type of public method from exported class has or is using private name '{0}'." }, + Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4056, category: ts.DiagnosticCategory.Error, key: "Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1_4056", message: "Return type of method from exported interface has or is using name '{0}' from private module '{1}'." }, + Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0: { code: 4057, category: ts.DiagnosticCategory.Error, key: "Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0_4057", message: "Return type of method from exported interface has or is using private name '{0}'." }, + Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4058, category: ts.DiagnosticCategory.Error, key: "Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named_4058", message: "Return type of exported function has or is using name '{0}' from external module {1} but cannot be named." }, + Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1: { code: 4059, category: ts.DiagnosticCategory.Error, key: "Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1_4059", message: "Return type of exported function has or is using name '{0}' from private module '{1}'." }, + Return_type_of_exported_function_has_or_is_using_private_name_0: { code: 4060, category: ts.DiagnosticCategory.Error, key: "Return_type_of_exported_function_has_or_is_using_private_name_0_4060", message: "Return type of exported function has or is using private name '{0}'." }, + Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4061, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_can_4061", message: "Parameter '{0}' of constructor from exported class has or is using name '{1}' from external module {2} but cannot be named." }, + Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4062, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2_4062", message: "Parameter '{0}' of constructor from exported class has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1: { code: 4063, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1_4063", message: "Parameter '{0}' of constructor from exported class has or is using private name '{1}'." }, + Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4064, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_mod_4064", message: "Parameter '{0}' of constructor signature from exported interface has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4065, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1_4065", message: "Parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'." }, + Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4066, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2_4066", message: "Parameter '{0}' of call signature from exported interface has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4067, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1_4067", message: "Parameter '{0}' of call signature from exported interface has or is using private name '{1}'." }, + Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4068, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module__4068", message: "Parameter '{0}' of public static method from exported class has or is using name '{1}' from external module {2} but cannot be named." }, + Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4069, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2_4069", message: "Parameter '{0}' of public static method from exported class has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { code: 4070, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1_4070", message: "Parameter '{0}' of public static method from exported class has or is using private name '{1}'." }, + Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4071, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_c_4071", message: "Parameter '{0}' of public method from exported class has or is using name '{1}' from external module {2} but cannot be named." }, + Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4072, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2_4072", message: "Parameter '{0}' of public method from exported class has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { code: 4073, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1_4073", message: "Parameter '{0}' of public method from exported class has or is using private name '{1}'." }, + Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4074, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2_4074", message: "Parameter '{0}' of method from exported interface has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { code: 4075, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1_4075", message: "Parameter '{0}' of method from exported interface has or is using private name '{1}'." }, + Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4076, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named_4076", message: "Parameter '{0}' of exported function has or is using name '{1}' from external module {2} but cannot be named." }, + Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2: { code: 4077, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2_4077", message: "Parameter '{0}' of exported function has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4078, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_exported_function_has_or_is_using_private_name_1_4078", message: "Parameter '{0}' of exported function has or is using private name '{1}'." }, + Exported_type_alias_0_has_or_is_using_private_name_1: { code: 4081, category: ts.DiagnosticCategory.Error, key: "Exported_type_alias_0_has_or_is_using_private_name_1_4081", message: "Exported type alias '{0}' has or is using private name '{1}'." }, + Default_export_of_the_module_has_or_is_using_private_name_0: { code: 4082, category: ts.DiagnosticCategory.Error, key: "Default_export_of_the_module_has_or_is_using_private_name_0_4082", message: "Default export of the module has or is using private name '{0}'." }, + Conflicting_library_definitions_for_0_found_at_1_and_2_Copy_the_correct_file_to_the_typings_folder_to_resolve_this_conflict: { code: 4090, category: ts.DiagnosticCategory.Message, key: "Conflicting_library_definitions_for_0_found_at_1_and_2_Copy_the_correct_file_to_the_typings_folder_t_4090", message: "Conflicting library definitions for '{0}' found at '{1}' and '{2}'. Copy the correct file to the 'typings' folder to resolve this conflict." }, + The_current_host_does_not_support_the_0_option: { code: 5001, category: ts.DiagnosticCategory.Error, key: "The_current_host_does_not_support_the_0_option_5001", message: "The current host does not support the '{0}' option." }, + Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: ts.DiagnosticCategory.Error, key: "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", message: "Cannot find the common subdirectory path for the input files." }, + Cannot_read_file_0_Colon_1: { code: 5012, category: ts.DiagnosticCategory.Error, key: "Cannot_read_file_0_Colon_1_5012", message: "Cannot read file '{0}': {1}" }, + Unsupported_file_encoding: { code: 5013, category: ts.DiagnosticCategory.Error, key: "Unsupported_file_encoding_5013", message: "Unsupported file encoding." }, + Failed_to_parse_file_0_Colon_1: { code: 5014, category: ts.DiagnosticCategory.Error, key: "Failed_to_parse_file_0_Colon_1_5014", message: "Failed to parse file '{0}': {1}." }, + Unknown_compiler_option_0: { code: 5023, category: ts.DiagnosticCategory.Error, key: "Unknown_compiler_option_0_5023", message: "Unknown compiler option '{0}'." }, + Compiler_option_0_requires_a_value_of_type_1: { code: 5024, category: ts.DiagnosticCategory.Error, key: "Compiler_option_0_requires_a_value_of_type_1_5024", message: "Compiler option '{0}' requires a value of type {1}." }, + Could_not_write_file_0_Colon_1: { code: 5033, category: ts.DiagnosticCategory.Error, key: "Could_not_write_file_0_Colon_1_5033", message: "Could not write file '{0}': {1}" }, + Option_project_cannot_be_mixed_with_source_files_on_a_command_line: { code: 5042, category: ts.DiagnosticCategory.Error, key: "Option_project_cannot_be_mixed_with_source_files_on_a_command_line_5042", message: "Option 'project' cannot be mixed with source files on a command line." }, + Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES2015_or_higher: { code: 5047, category: ts.DiagnosticCategory.Error, key: "Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES_5047", message: "Option 'isolatedModules' can only be used when either option '--module' is provided or option 'target' is 'ES2015' or higher." }, + Option_inlineSources_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided: { code: 5051, category: ts.DiagnosticCategory.Error, key: "Option_inlineSources_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_prov_5051", message: "Option 'inlineSources' can only be used when either option '--inlineSourceMap' or option '--sourceMap' is provided." }, + Option_0_cannot_be_specified_without_specifying_option_1: { code: 5052, category: ts.DiagnosticCategory.Error, key: "Option_0_cannot_be_specified_without_specifying_option_1_5052", message: "Option '{0}' cannot be specified without specifying option '{1}'." }, + Option_0_cannot_be_specified_with_option_1: { code: 5053, category: ts.DiagnosticCategory.Error, key: "Option_0_cannot_be_specified_with_option_1_5053", message: "Option '{0}' cannot be specified with option '{1}'." }, + A_tsconfig_json_file_is_already_defined_at_Colon_0: { code: 5054, category: ts.DiagnosticCategory.Error, key: "A_tsconfig_json_file_is_already_defined_at_Colon_0_5054", message: "A 'tsconfig.json' file is already defined at: '{0}'." }, + Cannot_write_file_0_because_it_would_overwrite_input_file: { code: 5055, category: ts.DiagnosticCategory.Error, key: "Cannot_write_file_0_because_it_would_overwrite_input_file_5055", message: "Cannot write file '{0}' because it would overwrite input file." }, + Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files: { code: 5056, category: ts.DiagnosticCategory.Error, key: "Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files_5056", message: "Cannot write file '{0}' because it would be overwritten by multiple input files." }, + Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0: { code: 5057, category: ts.DiagnosticCategory.Error, key: "Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0_5057", message: "Cannot find a tsconfig.json file at the specified directory: '{0}'" }, + The_specified_path_does_not_exist_Colon_0: { code: 5058, category: ts.DiagnosticCategory.Error, key: "The_specified_path_does_not_exist_Colon_0_5058", message: "The specified path does not exist: '{0}'" }, + Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier: { code: 5059, category: ts.DiagnosticCategory.Error, key: "Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier_5059", message: "Invalid value for '--reactNamespace'. '{0}' is not a valid identifier." }, + Option_paths_cannot_be_used_without_specifying_baseUrl_option: { code: 5060, category: ts.DiagnosticCategory.Error, key: "Option_paths_cannot_be_used_without_specifying_baseUrl_option_5060", message: "Option 'paths' cannot be used without specifying '--baseUrl' option." }, + Pattern_0_can_have_at_most_one_Asterisk_character: { code: 5061, category: ts.DiagnosticCategory.Error, key: "Pattern_0_can_have_at_most_one_Asterisk_character_5061", message: "Pattern '{0}' can have at most one '*' character" }, + Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character: { code: 5062, category: ts.DiagnosticCategory.Error, key: "Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character_5062", message: "Substitution '{0}' in pattern '{1}' in can have at most one '*' character" }, + Substututions_for_pattern_0_should_be_an_array: { code: 5063, category: ts.DiagnosticCategory.Error, key: "Substututions_for_pattern_0_should_be_an_array_5063", message: "Substututions for pattern '{0}' should be an array." }, + Substitution_0_for_pattern_1_has_incorrect_type_expected_string_got_2: { code: 5064, category: ts.DiagnosticCategory.Error, key: "Substitution_0_for_pattern_1_has_incorrect_type_expected_string_got_2_5064", message: "Substitution '{0}' for pattern '{1}' has incorrect type, expected 'string', got '{2}'." }, + Concatenate_and_emit_output_to_single_file: { code: 6001, category: ts.DiagnosticCategory.Message, key: "Concatenate_and_emit_output_to_single_file_6001", message: "Concatenate and emit output to single file." }, + Generates_corresponding_d_ts_file: { code: 6002, category: ts.DiagnosticCategory.Message, key: "Generates_corresponding_d_ts_file_6002", message: "Generates corresponding '.d.ts' file." }, + Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { code: 6003, category: ts.DiagnosticCategory.Message, key: "Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations_6003", message: "Specify the location where debugger should locate map files instead of generated locations." }, + Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations: { code: 6004, category: ts.DiagnosticCategory.Message, key: "Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations_6004", message: "Specify the location where debugger should locate TypeScript files instead of source locations." }, + Watch_input_files: { code: 6005, category: ts.DiagnosticCategory.Message, key: "Watch_input_files_6005", message: "Watch input files." }, + Redirect_output_structure_to_the_directory: { code: 6006, category: ts.DiagnosticCategory.Message, key: "Redirect_output_structure_to_the_directory_6006", message: "Redirect output structure to the directory." }, + Do_not_erase_const_enum_declarations_in_generated_code: { code: 6007, category: ts.DiagnosticCategory.Message, key: "Do_not_erase_const_enum_declarations_in_generated_code_6007", message: "Do not erase const enum declarations in generated code." }, + Do_not_emit_outputs_if_any_errors_were_reported: { code: 6008, category: ts.DiagnosticCategory.Message, key: "Do_not_emit_outputs_if_any_errors_were_reported_6008", message: "Do not emit outputs if any errors were reported." }, + Do_not_emit_comments_to_output: { code: 6009, category: ts.DiagnosticCategory.Message, key: "Do_not_emit_comments_to_output_6009", message: "Do not emit comments to output." }, + Do_not_emit_outputs: { code: 6010, category: ts.DiagnosticCategory.Message, key: "Do_not_emit_outputs_6010", message: "Do not emit outputs." }, + Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typechecking: { code: 6011, category: ts.DiagnosticCategory.Message, key: "Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typech_6011", message: "Allow default imports from modules with no default export. This does not affect code emit, just typechecking." }, + Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015: { code: 6015, category: ts.DiagnosticCategory.Message, key: "Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015_6015", message: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES2015'" }, + Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015: { code: 6016, category: ts.DiagnosticCategory.Message, key: "Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015_6016", message: "Specify module code generation: 'commonjs', 'amd', 'system', 'umd' or 'es2015'" }, + Print_this_message: { code: 6017, category: ts.DiagnosticCategory.Message, key: "Print_this_message_6017", message: "Print this message." }, + Print_the_compiler_s_version: { code: 6019, category: ts.DiagnosticCategory.Message, key: "Print_the_compiler_s_version_6019", message: "Print the compiler's version." }, + Compile_the_project_in_the_given_directory: { code: 6020, category: ts.DiagnosticCategory.Message, key: "Compile_the_project_in_the_given_directory_6020", message: "Compile the project in the given directory." }, + Syntax_Colon_0: { code: 6023, category: ts.DiagnosticCategory.Message, key: "Syntax_Colon_0_6023", message: "Syntax: {0}" }, + options: { code: 6024, category: ts.DiagnosticCategory.Message, key: "options_6024", message: "options" }, + file: { code: 6025, category: ts.DiagnosticCategory.Message, key: "file_6025", message: "file" }, + Examples_Colon_0: { code: 6026, category: ts.DiagnosticCategory.Message, key: "Examples_Colon_0_6026", message: "Examples: {0}" }, + Options_Colon: { code: 6027, category: ts.DiagnosticCategory.Message, key: "Options_Colon_6027", message: "Options:" }, + Version_0: { code: 6029, category: ts.DiagnosticCategory.Message, key: "Version_0_6029", message: "Version {0}" }, + Insert_command_line_options_and_files_from_a_file: { code: 6030, category: ts.DiagnosticCategory.Message, key: "Insert_command_line_options_and_files_from_a_file_6030", message: "Insert command line options and files from a file." }, + File_change_detected_Starting_incremental_compilation: { code: 6032, category: ts.DiagnosticCategory.Message, key: "File_change_detected_Starting_incremental_compilation_6032", message: "File change detected. Starting incremental compilation..." }, + KIND: { code: 6034, category: ts.DiagnosticCategory.Message, key: "KIND_6034", message: "KIND" }, + FILE: { code: 6035, category: ts.DiagnosticCategory.Message, key: "FILE_6035", message: "FILE" }, + VERSION: { code: 6036, category: ts.DiagnosticCategory.Message, key: "VERSION_6036", message: "VERSION" }, + LOCATION: { code: 6037, category: ts.DiagnosticCategory.Message, key: "LOCATION_6037", message: "LOCATION" }, + DIRECTORY: { code: 6038, category: ts.DiagnosticCategory.Message, key: "DIRECTORY_6038", message: "DIRECTORY" }, + Compilation_complete_Watching_for_file_changes: { code: 6042, category: ts.DiagnosticCategory.Message, key: "Compilation_complete_Watching_for_file_changes_6042", message: "Compilation complete. Watching for file changes." }, + Generates_corresponding_map_file: { code: 6043, category: ts.DiagnosticCategory.Message, key: "Generates_corresponding_map_file_6043", message: "Generates corresponding '.map' file." }, + Compiler_option_0_expects_an_argument: { code: 6044, category: ts.DiagnosticCategory.Error, key: "Compiler_option_0_expects_an_argument_6044", message: "Compiler option '{0}' expects an argument." }, + Unterminated_quoted_string_in_response_file_0: { code: 6045, category: ts.DiagnosticCategory.Error, key: "Unterminated_quoted_string_in_response_file_0_6045", message: "Unterminated quoted string in response file '{0}'." }, + Argument_for_0_option_must_be_Colon_1: { code: 6046, category: ts.DiagnosticCategory.Error, key: "Argument_for_0_option_must_be_Colon_1_6046", message: "Argument for '{0}' option must be: {1}" }, + Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: { code: 6048, category: ts.DiagnosticCategory.Error, key: "Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1_6048", message: "Locale must be of the form or -. For example '{0}' or '{1}'." }, + Unsupported_locale_0: { code: 6049, category: ts.DiagnosticCategory.Error, key: "Unsupported_locale_0_6049", message: "Unsupported locale '{0}'." }, + Unable_to_open_file_0: { code: 6050, category: ts.DiagnosticCategory.Error, key: "Unable_to_open_file_0_6050", message: "Unable to open file '{0}'." }, + Corrupted_locale_file_0: { code: 6051, category: ts.DiagnosticCategory.Error, key: "Corrupted_locale_file_0_6051", message: "Corrupted locale file {0}." }, + Raise_error_on_expressions_and_declarations_with_an_implied_any_type: { code: 6052, category: ts.DiagnosticCategory.Message, key: "Raise_error_on_expressions_and_declarations_with_an_implied_any_type_6052", message: "Raise error on expressions and declarations with an implied 'any' type." }, + File_0_not_found: { code: 6053, category: ts.DiagnosticCategory.Error, key: "File_0_not_found_6053", message: "File '{0}' not found." }, + File_0_has_unsupported_extension_The_only_supported_extensions_are_1: { code: 6054, category: ts.DiagnosticCategory.Error, key: "File_0_has_unsupported_extension_The_only_supported_extensions_are_1_6054", message: "File '{0}' has unsupported extension. The only supported extensions are {1}." }, + Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures: { code: 6055, category: ts.DiagnosticCategory.Message, key: "Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures_6055", message: "Suppress noImplicitAny errors for indexing objects lacking index signatures." }, + Do_not_emit_declarations_for_code_that_has_an_internal_annotation: { code: 6056, category: ts.DiagnosticCategory.Message, key: "Do_not_emit_declarations_for_code_that_has_an_internal_annotation_6056", message: "Do not emit declarations for code that has an '@internal' annotation." }, + Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir: { code: 6058, category: ts.DiagnosticCategory.Message, key: "Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir_6058", message: "Specify the root directory of input files. Use to control the output directory structure with --outDir." }, + File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files: { code: 6059, category: ts.DiagnosticCategory.Error, key: "File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files_6059", message: "File '{0}' is not under 'rootDir' '{1}'. 'rootDir' is expected to contain all source files." }, + Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix: { code: 6060, category: ts.DiagnosticCategory.Message, key: "Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix_6060", message: "Specify the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix)." }, + NEWLINE: { code: 6061, category: ts.DiagnosticCategory.Message, key: "NEWLINE_6061", message: "NEWLINE" }, + Option_0_can_only_be_specified_in_tsconfig_json_file: { code: 6064, category: ts.DiagnosticCategory.Error, key: "Option_0_can_only_be_specified_in_tsconfig_json_file_6064", message: "Option '{0}' can only be specified in 'tsconfig.json' file." }, + Enables_experimental_support_for_ES7_decorators: { code: 6065, category: ts.DiagnosticCategory.Message, key: "Enables_experimental_support_for_ES7_decorators_6065", message: "Enables experimental support for ES7 decorators." }, + Enables_experimental_support_for_emitting_type_metadata_for_decorators: { code: 6066, category: ts.DiagnosticCategory.Message, key: "Enables_experimental_support_for_emitting_type_metadata_for_decorators_6066", message: "Enables experimental support for emitting type metadata for decorators." }, + Enables_experimental_support_for_ES7_async_functions: { code: 6068, category: ts.DiagnosticCategory.Message, key: "Enables_experimental_support_for_ES7_async_functions_6068", message: "Enables experimental support for ES7 async functions." }, + Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6: { code: 6069, category: ts.DiagnosticCategory.Message, key: "Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6_6069", message: "Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6)." }, + Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file: { code: 6070, category: ts.DiagnosticCategory.Message, key: "Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file_6070", message: "Initializes a TypeScript project and creates a tsconfig.json file." }, + Successfully_created_a_tsconfig_json_file: { code: 6071, category: ts.DiagnosticCategory.Message, key: "Successfully_created_a_tsconfig_json_file_6071", message: "Successfully created a tsconfig.json file." }, + Suppress_excess_property_checks_for_object_literals: { code: 6072, category: ts.DiagnosticCategory.Message, key: "Suppress_excess_property_checks_for_object_literals_6072", message: "Suppress excess property checks for object literals." }, + Stylize_errors_and_messages_using_color_and_context_experimental: { code: 6073, category: ts.DiagnosticCategory.Message, key: "Stylize_errors_and_messages_using_color_and_context_experimental_6073", message: "Stylize errors and messages using color and context. (experimental)" }, + Do_not_report_errors_on_unused_labels: { code: 6074, category: ts.DiagnosticCategory.Message, key: "Do_not_report_errors_on_unused_labels_6074", message: "Do not report errors on unused labels." }, + Report_error_when_not_all_code_paths_in_function_return_a_value: { code: 6075, category: ts.DiagnosticCategory.Message, key: "Report_error_when_not_all_code_paths_in_function_return_a_value_6075", message: "Report error when not all code paths in function return a value." }, + Report_errors_for_fallthrough_cases_in_switch_statement: { code: 6076, category: ts.DiagnosticCategory.Message, key: "Report_errors_for_fallthrough_cases_in_switch_statement_6076", message: "Report errors for fallthrough cases in switch statement." }, + Do_not_report_errors_on_unreachable_code: { code: 6077, category: ts.DiagnosticCategory.Message, key: "Do_not_report_errors_on_unreachable_code_6077", message: "Do not report errors on unreachable code." }, + Disallow_inconsistently_cased_references_to_the_same_file: { code: 6078, category: ts.DiagnosticCategory.Message, key: "Disallow_inconsistently_cased_references_to_the_same_file_6078", message: "Disallow inconsistently-cased references to the same file." }, + Specify_library_files_to_be_included_in_the_compilation_Colon: { code: 6079, category: ts.DiagnosticCategory.Message, key: "Specify_library_files_to_be_included_in_the_compilation_Colon_6079", message: "Specify library files to be included in the compilation: " }, + Specify_JSX_code_generation_Colon_preserve_or_react: { code: 6080, category: ts.DiagnosticCategory.Message, key: "Specify_JSX_code_generation_Colon_preserve_or_react_6080", message: "Specify JSX code generation: 'preserve' or 'react'" }, + Only_amd_and_system_modules_are_supported_alongside_0: { code: 6082, category: ts.DiagnosticCategory.Error, key: "Only_amd_and_system_modules_are_supported_alongside_0_6082", message: "Only 'amd' and 'system' modules are supported alongside --{0}." }, + Base_directory_to_resolve_non_absolute_module_names: { code: 6083, category: ts.DiagnosticCategory.Message, key: "Base_directory_to_resolve_non_absolute_module_names_6083", message: "Base directory to resolve non-absolute module names." }, + Specify_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit: { code: 6084, category: ts.DiagnosticCategory.Message, key: "Specify_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit_6084", message: "Specify the object invoked for createElement and __spread when targeting 'react' JSX emit" }, + Enable_tracing_of_the_name_resolution_process: { code: 6085, category: ts.DiagnosticCategory.Message, key: "Enable_tracing_of_the_name_resolution_process_6085", message: "Enable tracing of the name resolution process." }, + Resolving_module_0_from_1: { code: 6086, category: ts.DiagnosticCategory.Message, key: "Resolving_module_0_from_1_6086", message: "======== Resolving module '{0}' from '{1}'. ========" }, + Explicitly_specified_module_resolution_kind_Colon_0: { code: 6087, category: ts.DiagnosticCategory.Message, key: "Explicitly_specified_module_resolution_kind_Colon_0_6087", message: "Explicitly specified module resolution kind: '{0}'." }, + Module_resolution_kind_is_not_specified_using_0: { code: 6088, category: ts.DiagnosticCategory.Message, key: "Module_resolution_kind_is_not_specified_using_0_6088", message: "Module resolution kind is not specified, using '{0}'." }, + Module_name_0_was_successfully_resolved_to_1: { code: 6089, category: ts.DiagnosticCategory.Message, key: "Module_name_0_was_successfully_resolved_to_1_6089", message: "======== Module name '{0}' was successfully resolved to '{1}'. ========" }, + Module_name_0_was_not_resolved: { code: 6090, category: ts.DiagnosticCategory.Message, key: "Module_name_0_was_not_resolved_6090", message: "======== Module name '{0}' was not resolved. ========" }, + paths_option_is_specified_looking_for_a_pattern_to_match_module_name_0: { code: 6091, category: ts.DiagnosticCategory.Message, key: "paths_option_is_specified_looking_for_a_pattern_to_match_module_name_0_6091", message: "'paths' option is specified, looking for a pattern to match module name '{0}'." }, + Module_name_0_matched_pattern_1: { code: 6092, category: ts.DiagnosticCategory.Message, key: "Module_name_0_matched_pattern_1_6092", message: "Module name '{0}', matched pattern '{1}'." }, + Trying_substitution_0_candidate_module_location_Colon_1: { code: 6093, category: ts.DiagnosticCategory.Message, key: "Trying_substitution_0_candidate_module_location_Colon_1_6093", message: "Trying substitution '{0}', candidate module location: '{1}'." }, + Resolving_module_name_0_relative_to_base_url_1_2: { code: 6094, category: ts.DiagnosticCategory.Message, key: "Resolving_module_name_0_relative_to_base_url_1_2_6094", message: "Resolving module name '{0}' relative to base url '{1}' - '{2}'." }, + Loading_module_as_file_Slash_folder_candidate_module_location_0: { code: 6095, category: ts.DiagnosticCategory.Message, key: "Loading_module_as_file_Slash_folder_candidate_module_location_0_6095", message: "Loading module as file / folder, candidate module location '{0}'." }, + File_0_does_not_exist: { code: 6096, category: ts.DiagnosticCategory.Message, key: "File_0_does_not_exist_6096", message: "File '{0}' does not exist." }, + File_0_exist_use_it_as_a_name_resolution_result: { code: 6097, category: ts.DiagnosticCategory.Message, key: "File_0_exist_use_it_as_a_name_resolution_result_6097", message: "File '{0}' exist - use it as a name resolution result." }, + Loading_module_0_from_node_modules_folder: { code: 6098, category: ts.DiagnosticCategory.Message, key: "Loading_module_0_from_node_modules_folder_6098", message: "Loading module '{0}' from 'node_modules' folder." }, + Found_package_json_at_0: { code: 6099, category: ts.DiagnosticCategory.Message, key: "Found_package_json_at_0_6099", message: "Found 'package.json' at '{0}'." }, + package_json_does_not_have_types_field: { code: 6100, category: ts.DiagnosticCategory.Message, key: "package_json_does_not_have_types_field_6100", message: "'package.json' does not have 'types' field." }, + package_json_has_0_field_1_that_references_2: { code: 6101, category: ts.DiagnosticCategory.Message, key: "package_json_has_0_field_1_that_references_2_6101", message: "'package.json' has '{0}' field '{1}' that references '{2}'." }, + Allow_javascript_files_to_be_compiled: { code: 6102, category: ts.DiagnosticCategory.Message, key: "Allow_javascript_files_to_be_compiled_6102", message: "Allow javascript files to be compiled." }, + Option_0_should_have_array_of_strings_as_a_value: { code: 6103, category: ts.DiagnosticCategory.Error, key: "Option_0_should_have_array_of_strings_as_a_value_6103", message: "Option '{0}' should have array of strings as a value." }, + Checking_if_0_is_the_longest_matching_prefix_for_1_2: { code: 6104, category: ts.DiagnosticCategory.Message, key: "Checking_if_0_is_the_longest_matching_prefix_for_1_2_6104", message: "Checking if '{0}' is the longest matching prefix for '{1}' - '{2}'." }, + Expected_type_of_0_field_in_package_json_to_be_string_got_1: { code: 6105, category: ts.DiagnosticCategory.Message, key: "Expected_type_of_0_field_in_package_json_to_be_string_got_1_6105", message: "Expected type of '{0}' field in 'package.json' to be 'string', got '{1}'." }, + baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1: { code: 6106, category: ts.DiagnosticCategory.Message, key: "baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1_6106", message: "'baseUrl' option is set to '{0}', using this value to resolve non-relative module name '{1}'" }, + rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0: { code: 6107, category: ts.DiagnosticCategory.Message, key: "rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0_6107", message: "'rootDirs' option is set, using it to resolve relative module name '{0}'" }, + Longest_matching_prefix_for_0_is_1: { code: 6108, category: ts.DiagnosticCategory.Message, key: "Longest_matching_prefix_for_0_is_1_6108", message: "Longest matching prefix for '{0}' is '{1}'" }, + Loading_0_from_the_root_dir_1_candidate_location_2: { code: 6109, category: ts.DiagnosticCategory.Message, key: "Loading_0_from_the_root_dir_1_candidate_location_2_6109", message: "Loading '{0}' from the root dir '{1}', candidate location '{2}'" }, + Trying_other_entries_in_rootDirs: { code: 6110, category: ts.DiagnosticCategory.Message, key: "Trying_other_entries_in_rootDirs_6110", message: "Trying other entries in 'rootDirs'" }, + Module_resolution_using_rootDirs_has_failed: { code: 6111, category: ts.DiagnosticCategory.Message, key: "Module_resolution_using_rootDirs_has_failed_6111", message: "Module resolution using 'rootDirs' has failed" }, + Do_not_emit_use_strict_directives_in_module_output: { code: 6112, category: ts.DiagnosticCategory.Message, key: "Do_not_emit_use_strict_directives_in_module_output_6112", message: "Do not emit 'use strict' directives in module output." }, + Enable_strict_null_checks: { code: 6113, category: ts.DiagnosticCategory.Message, key: "Enable_strict_null_checks_6113", message: "Enable strict null checks." }, + Unknown_option_excludes_Did_you_mean_exclude: { code: 6114, category: ts.DiagnosticCategory.Error, key: "Unknown_option_excludes_Did_you_mean_exclude_6114", message: "Unknown option 'excludes'. Did you mean 'exclude'?" }, + Raise_error_on_this_expressions_with_an_implied_any_type: { code: 6115, category: ts.DiagnosticCategory.Message, key: "Raise_error_on_this_expressions_with_an_implied_any_type_6115", message: "Raise error on 'this' expressions with an implied 'any' type." }, + Resolving_type_reference_directive_0_containing_file_1_root_directory_2: { code: 6116, category: ts.DiagnosticCategory.Message, key: "Resolving_type_reference_directive_0_containing_file_1_root_directory_2_6116", message: "======== Resolving type reference directive '{0}', containing file '{1}', root directory '{2}'. ========" }, + Resolving_using_primary_search_paths: { code: 6117, category: ts.DiagnosticCategory.Message, key: "Resolving_using_primary_search_paths_6117", message: "Resolving using primary search paths..." }, + Resolving_from_node_modules_folder: { code: 6118, category: ts.DiagnosticCategory.Message, key: "Resolving_from_node_modules_folder_6118", message: "Resolving from node_modules folder..." }, + Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2: { code: 6119, category: ts.DiagnosticCategory.Message, key: "Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2_6119", message: "======== Type reference directive '{0}' was successfully resolved to '{1}', primary: {2}. ========" }, + Type_reference_directive_0_was_not_resolved: { code: 6120, category: ts.DiagnosticCategory.Message, key: "Type_reference_directive_0_was_not_resolved_6120", message: "======== Type reference directive '{0}' was not resolved. ========" }, + Resolving_with_primary_search_path_0: { code: 6121, category: ts.DiagnosticCategory.Message, key: "Resolving_with_primary_search_path_0_6121", message: "Resolving with primary search path '{0}'" }, + Root_directory_cannot_be_determined_skipping_primary_search_paths: { code: 6122, category: ts.DiagnosticCategory.Message, key: "Root_directory_cannot_be_determined_skipping_primary_search_paths_6122", message: "Root directory cannot be determined, skipping primary search paths." }, + Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set: { code: 6123, category: ts.DiagnosticCategory.Message, key: "Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set_6123", message: "======== Resolving type reference directive '{0}', containing file '{1}', root directory not set. ========" }, + Type_declaration_files_to_be_included_in_compilation: { code: 6124, category: ts.DiagnosticCategory.Message, key: "Type_declaration_files_to_be_included_in_compilation_6124", message: "Type declaration files to be included in compilation." }, + Looking_up_in_node_modules_folder_initial_location_0: { code: 6125, category: ts.DiagnosticCategory.Message, key: "Looking_up_in_node_modules_folder_initial_location_0_6125", message: "Looking up in 'node_modules' folder, initial location '{0}'" }, + Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_modules_folder: { code: 6126, category: ts.DiagnosticCategory.Message, key: "Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_mod_6126", message: "Containing file is not specified and root directory cannot be determined, skipping lookup in 'node_modules' folder." }, + Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1: { code: 6127, category: ts.DiagnosticCategory.Message, key: "Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1_6127", message: "======== Resolving type reference directive '{0}', containing file not set, root directory '{1}'. ========" }, + Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set: { code: 6128, category: ts.DiagnosticCategory.Message, key: "Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set_6128", message: "======== Resolving type reference directive '{0}', containing file not set, root directory not set. ========" }, + The_config_file_0_found_doesn_t_contain_any_source_files: { code: 6129, category: ts.DiagnosticCategory.Error, key: "The_config_file_0_found_doesn_t_contain_any_source_files_6129", message: "The config file '{0}' found doesn't contain any source files." }, + Resolving_real_path_for_0_result_1: { code: 6130, category: ts.DiagnosticCategory.Message, key: "Resolving_real_path_for_0_result_1_6130", message: "Resolving real path for '{0}', result '{1}'" }, + Variable_0_implicitly_has_an_1_type: { code: 7005, category: ts.DiagnosticCategory.Error, key: "Variable_0_implicitly_has_an_1_type_7005", message: "Variable '{0}' implicitly has an '{1}' type." }, + Parameter_0_implicitly_has_an_1_type: { code: 7006, category: ts.DiagnosticCategory.Error, key: "Parameter_0_implicitly_has_an_1_type_7006", message: "Parameter '{0}' implicitly has an '{1}' type." }, + Member_0_implicitly_has_an_1_type: { code: 7008, category: ts.DiagnosticCategory.Error, key: "Member_0_implicitly_has_an_1_type_7008", message: "Member '{0}' implicitly has an '{1}' type." }, + new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type: { code: 7009, category: ts.DiagnosticCategory.Error, key: "new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type_7009", message: "'new' expression, whose target lacks a construct signature, implicitly has an 'any' type." }, + _0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type: { code: 7010, category: ts.DiagnosticCategory.Error, key: "_0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type_7010", message: "'{0}', which lacks return-type annotation, implicitly has an '{1}' return type." }, + Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type: { code: 7011, category: ts.DiagnosticCategory.Error, key: "Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type_7011", message: "Function expression, which lacks return-type annotation, implicitly has an '{0}' return type." }, + Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7013, category: ts.DiagnosticCategory.Error, key: "Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type_7013", message: "Construct signature, which lacks return-type annotation, implicitly has an 'any' return type." }, + Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number: { code: 7015, category: ts.DiagnosticCategory.Error, key: "Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number_7015", message: "Element implicitly has an 'any' type because index expression is not of type 'number'." }, + Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_type_annotation: { code: 7016, category: ts.DiagnosticCategory.Error, key: "Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_type_annotation_7016", message: "Property '{0}' implicitly has type 'any', because its 'set' accessor lacks a type annotation." }, + Index_signature_of_object_type_implicitly_has_an_any_type: { code: 7017, category: ts.DiagnosticCategory.Error, key: "Index_signature_of_object_type_implicitly_has_an_any_type_7017", message: "Index signature of object type implicitly has an 'any' type." }, + Object_literal_s_property_0_implicitly_has_an_1_type: { code: 7018, category: ts.DiagnosticCategory.Error, key: "Object_literal_s_property_0_implicitly_has_an_1_type_7018", message: "Object literal's property '{0}' implicitly has an '{1}' type." }, + Rest_parameter_0_implicitly_has_an_any_type: { code: 7019, category: ts.DiagnosticCategory.Error, key: "Rest_parameter_0_implicitly_has_an_any_type_7019", message: "Rest parameter '{0}' implicitly has an 'any[]' type." }, + Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7020, category: ts.DiagnosticCategory.Error, key: "Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type_7020", message: "Call signature, which lacks return-type annotation, implicitly has an 'any' return type." }, + _0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer: { code: 7022, category: ts.DiagnosticCategory.Error, key: "_0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or__7022", message: "'{0}' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer." }, + _0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7023, category: ts.DiagnosticCategory.Error, key: "_0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_reference_7023", message: "'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, + 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: { code: 7024, category: ts.DiagnosticCategory.Error, key: "Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_ref_7024", message: "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: { code: 7025, category: ts.DiagnosticCategory.Error, key: "Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_typ_7025", message: "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: { code: 7026, category: ts.DiagnosticCategory.Error, key: "JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists_7026", message: "JSX element implicitly has type 'any' because no interface 'JSX.{0}' exists" }, + Unreachable_code_detected: { code: 7027, category: ts.DiagnosticCategory.Error, key: "Unreachable_code_detected_7027", message: "Unreachable code detected." }, + Unused_label: { code: 7028, category: ts.DiagnosticCategory.Error, key: "Unused_label_7028", message: "Unused label." }, + Fallthrough_case_in_switch: { code: 7029, category: ts.DiagnosticCategory.Error, key: "Fallthrough_case_in_switch_7029", message: "Fallthrough case in switch." }, + Not_all_code_paths_return_a_value: { code: 7030, category: ts.DiagnosticCategory.Error, key: "Not_all_code_paths_return_a_value_7030", message: "Not all code paths return a value." }, + Binding_element_0_implicitly_has_an_1_type: { code: 7031, category: ts.DiagnosticCategory.Error, key: "Binding_element_0_implicitly_has_an_1_type_7031", message: "Binding element '{0}' implicitly has an '{1}' type." }, + You_cannot_rename_this_element: { code: 8000, category: ts.DiagnosticCategory.Error, key: "You_cannot_rename_this_element_8000", message: "You cannot rename this element." }, + You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: { code: 8001, category: ts.DiagnosticCategory.Error, key: "You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library_8001", message: "You cannot rename elements that are defined in the standard TypeScript library." }, + import_can_only_be_used_in_a_ts_file: { code: 8002, category: ts.DiagnosticCategory.Error, key: "import_can_only_be_used_in_a_ts_file_8002", message: "'import ... =' can only be used in a .ts file." }, + export_can_only_be_used_in_a_ts_file: { code: 8003, category: ts.DiagnosticCategory.Error, key: "export_can_only_be_used_in_a_ts_file_8003", message: "'export=' can only be used in a .ts file." }, + type_parameter_declarations_can_only_be_used_in_a_ts_file: { code: 8004, category: ts.DiagnosticCategory.Error, key: "type_parameter_declarations_can_only_be_used_in_a_ts_file_8004", message: "'type parameter declarations' can only be used in a .ts file." }, + implements_clauses_can_only_be_used_in_a_ts_file: { code: 8005, category: ts.DiagnosticCategory.Error, key: "implements_clauses_can_only_be_used_in_a_ts_file_8005", message: "'implements clauses' can only be used in a .ts file." }, + interface_declarations_can_only_be_used_in_a_ts_file: { code: 8006, category: ts.DiagnosticCategory.Error, key: "interface_declarations_can_only_be_used_in_a_ts_file_8006", message: "'interface declarations' can only be used in a .ts file." }, + module_declarations_can_only_be_used_in_a_ts_file: { code: 8007, category: ts.DiagnosticCategory.Error, key: "module_declarations_can_only_be_used_in_a_ts_file_8007", message: "'module declarations' can only be used in a .ts file." }, + type_aliases_can_only_be_used_in_a_ts_file: { code: 8008, category: ts.DiagnosticCategory.Error, key: "type_aliases_can_only_be_used_in_a_ts_file_8008", message: "'type aliases' can only be used in a .ts file." }, + _0_can_only_be_used_in_a_ts_file: { code: 8009, category: ts.DiagnosticCategory.Error, key: "_0_can_only_be_used_in_a_ts_file_8009", message: "'{0}' can only be used in a .ts file." }, + types_can_only_be_used_in_a_ts_file: { code: 8010, category: ts.DiagnosticCategory.Error, key: "types_can_only_be_used_in_a_ts_file_8010", message: "'types' can only be used in a .ts file." }, + type_arguments_can_only_be_used_in_a_ts_file: { code: 8011, category: ts.DiagnosticCategory.Error, key: "type_arguments_can_only_be_used_in_a_ts_file_8011", message: "'type arguments' can only be used in a .ts file." }, + parameter_modifiers_can_only_be_used_in_a_ts_file: { code: 8012, category: ts.DiagnosticCategory.Error, key: "parameter_modifiers_can_only_be_used_in_a_ts_file_8012", message: "'parameter modifiers' can only be used in a .ts file." }, + property_declarations_can_only_be_used_in_a_ts_file: { code: 8014, category: ts.DiagnosticCategory.Error, key: "property_declarations_can_only_be_used_in_a_ts_file_8014", message: "'property declarations' can only be used in a .ts file." }, + enum_declarations_can_only_be_used_in_a_ts_file: { code: 8015, category: ts.DiagnosticCategory.Error, key: "enum_declarations_can_only_be_used_in_a_ts_file_8015", message: "'enum declarations' can only be used in a .ts file." }, + type_assertion_expressions_can_only_be_used_in_a_ts_file: { code: 8016, category: ts.DiagnosticCategory.Error, key: "type_assertion_expressions_can_only_be_used_in_a_ts_file_8016", message: "'type assertion expressions' can only be used in a .ts file." }, + Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_class_extends_clauses: { code: 9002, category: ts.DiagnosticCategory.Error, key: "Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_clas_9002", message: "Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses." }, + class_expressions_are_not_currently_supported: { code: 9003, category: ts.DiagnosticCategory.Error, key: "class_expressions_are_not_currently_supported_9003", message: "'class' expressions are not currently supported." }, + JSX_attributes_must_only_be_assigned_a_non_empty_expression: { code: 17000, category: ts.DiagnosticCategory.Error, key: "JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000", message: "JSX attributes must only be assigned a non-empty 'expression'." }, + JSX_elements_cannot_have_multiple_attributes_with_the_same_name: { code: 17001, category: ts.DiagnosticCategory.Error, key: "JSX_elements_cannot_have_multiple_attributes_with_the_same_name_17001", message: "JSX elements cannot have multiple attributes with the same name." }, + Expected_corresponding_JSX_closing_tag_for_0: { code: 17002, category: ts.DiagnosticCategory.Error, key: "Expected_corresponding_JSX_closing_tag_for_0_17002", message: "Expected corresponding JSX closing tag for '{0}'." }, + JSX_attribute_expected: { code: 17003, category: ts.DiagnosticCategory.Error, key: "JSX_attribute_expected_17003", message: "JSX attribute expected." }, + Cannot_use_JSX_unless_the_jsx_flag_is_provided: { code: 17004, category: ts.DiagnosticCategory.Error, key: "Cannot_use_JSX_unless_the_jsx_flag_is_provided_17004", message: "Cannot use JSX unless the '--jsx' flag is provided." }, + A_constructor_cannot_contain_a_super_call_when_its_class_extends_null: { code: 17005, category: ts.DiagnosticCategory.Error, key: "A_constructor_cannot_contain_a_super_call_when_its_class_extends_null_17005", message: "A constructor cannot contain a 'super' call when its class extends 'null'" }, + An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: { code: 17006, category: ts.DiagnosticCategory.Error, key: "An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_ex_17006", message: "An unary expression with the '{0}' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses." }, + A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: { code: 17007, category: ts.DiagnosticCategory.Error, key: "A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Con_17007", message: "A type assertion expression is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses." }, + JSX_element_0_has_no_corresponding_closing_tag: { code: 17008, category: ts.DiagnosticCategory.Error, key: "JSX_element_0_has_no_corresponding_closing_tag_17008", message: "JSX element '{0}' has no corresponding closing tag." }, + super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class: { code: 17009, category: ts.DiagnosticCategory.Error, key: "super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class_17009", message: "'super' must be called before accessing 'this' in the constructor of a derived class." }, + Unknown_typing_option_0: { code: 17010, category: ts.DiagnosticCategory.Error, key: "Unknown_typing_option_0_17010", message: "Unknown typing option '{0}'." } + }; +})(ts || (ts = {})); +var ts; +(function (ts) { + function tokenIsIdentifierOrKeyword(token) { + return token >= 69; + } + ts.tokenIsIdentifierOrKeyword = tokenIsIdentifierOrKeyword; + var textToToken = { + "abstract": 115, + "any": 117, + "as": 116, + "boolean": 120, + "break": 70, + "case": 71, + "catch": 72, + "class": 73, + "continue": 75, + "const": 74, + "constructor": 121, + "debugger": 76, + "declare": 122, + "default": 77, + "delete": 78, + "do": 79, + "else": 80, + "enum": 81, + "export": 82, + "extends": 83, + "false": 84, + "finally": 85, + "for": 86, + "from": 136, + "function": 87, + "get": 123, + "if": 88, + "implements": 106, + "import": 89, + "in": 90, + "instanceof": 91, + "interface": 107, + "is": 124, + "let": 108, + "module": 125, + "namespace": 126, + "never": 127, + "new": 92, + "null": 93, + "number": 130, + "package": 109, + "private": 110, + "protected": 111, + "public": 112, + "readonly": 128, + "require": 129, + "global": 137, + "return": 94, + "set": 131, + "static": 113, + "string": 132, + "super": 95, + "switch": 96, + "symbol": 133, + "this": 97, + "throw": 98, + "true": 99, + "try": 100, + "type": 134, + "typeof": 101, + "undefined": 135, + "var": 102, + "void": 103, + "while": 104, + "with": 105, + "yield": 114, + "async": 118, + "await": 119, + "of": 138, + "{": 15, + "}": 16, + "(": 17, + ")": 18, + "[": 19, + "]": 20, + ".": 21, + "...": 22, + ";": 23, + ",": 24, + "<": 25, + ">": 27, + "<=": 28, + ">=": 29, + "==": 30, + "!=": 31, + "===": 32, + "!==": 33, + "=>": 34, + "+": 35, + "-": 36, + "**": 38, + "*": 37, + "/": 39, + "%": 40, + "++": 41, + "--": 42, + "<<": 43, + ">": 44, + ">>>": 45, + "&": 46, + "|": 47, + "^": 48, + "!": 49, + "~": 50, + "&&": 51, + "||": 52, + "?": 53, + ":": 54, + "=": 56, + "+=": 57, + "-=": 58, + "*=": 59, + "**=": 60, + "/=": 61, + "%=": 62, + "<<=": 63, + ">>=": 64, + ">>>=": 65, + "&=": 66, + "|=": 67, + "^=": 68, + "@": 55 + }; + 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,]; + 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) { + if (code < map[0]) { + return false; + } + var lo = 0; + var hi = map.length; + var mid; + while (lo + 1 < hi) { + mid = lo + (hi - lo) / 2; + mid -= mid % 2; + if (map[mid] <= code && code <= map[mid + 1]) { + return true; + } + if (code < map[mid]) { + hi = mid; + } + else { + lo = mid + 2; + } + } + return false; + } + function isUnicodeIdentifierStart(code, languageVersion) { + return languageVersion >= 1 ? + lookupInUnicodeMap(code, unicodeES5IdentifierStart) : + lookupInUnicodeMap(code, unicodeES3IdentifierStart); + } + ts.isUnicodeIdentifierStart = isUnicodeIdentifierStart; + function isUnicodeIdentifierPart(code, languageVersion) { + return languageVersion >= 1 ? + lookupInUnicodeMap(code, unicodeES5IdentifierPart) : + lookupInUnicodeMap(code, unicodeES3IdentifierPart); + } + function makeReverseMap(source) { + var result = []; + for (var name_4 in source) { + if (source.hasOwnProperty(name_4)) { + result[source[name_4]] = name_4; + } + } + return result; + } + var tokenStrings = makeReverseMap(textToToken); + function tokenToString(t) { + return tokenStrings[t]; + } + ts.tokenToString = tokenToString; + function stringToToken(s) { + return textToToken[s]; + } + ts.stringToToken = stringToToken; + function computeLineStarts(text) { + var result = new Array(); + var pos = 0; + var lineStart = 0; + while (pos < text.length) { + var ch = text.charCodeAt(pos); + pos++; + switch (ch) { + case 13: + if (text.charCodeAt(pos) === 10) { + pos++; + } + case 10: + result.push(lineStart); + lineStart = pos; + break; + default: + if (ch > 127 && isLineBreak(ch)) { + result.push(lineStart); + lineStart = pos; + } + break; + } + } + result.push(lineStart); + return result; + } + ts.computeLineStarts = computeLineStarts; + function getPositionOfLineAndCharacter(sourceFile, line, character) { + return computePositionOfLineAndCharacter(getLineStarts(sourceFile), line, character); + } + ts.getPositionOfLineAndCharacter = getPositionOfLineAndCharacter; + function computePositionOfLineAndCharacter(lineStarts, line, character) { + ts.Debug.assert(line >= 0 && line < lineStarts.length); + return lineStarts[line] + character; + } + ts.computePositionOfLineAndCharacter = computePositionOfLineAndCharacter; + function getLineStarts(sourceFile) { + return sourceFile.lineMap || (sourceFile.lineMap = computeLineStarts(sourceFile.text)); + } + ts.getLineStarts = getLineStarts; + function computeLineAndCharacterOfPosition(lineStarts, position) { + var lineNumber = ts.binarySearch(lineStarts, position); + if (lineNumber < 0) { + lineNumber = ~lineNumber - 1; + ts.Debug.assert(lineNumber !== -1, "position cannot precede the beginning of the file"); + } + return { + line: lineNumber, + character: position - lineStarts[lineNumber] + }; + } + ts.computeLineAndCharacterOfPosition = computeLineAndCharacterOfPosition; + function getLineAndCharacterOfPosition(sourceFile, position) { + return computeLineAndCharacterOfPosition(getLineStarts(sourceFile), position); + } + ts.getLineAndCharacterOfPosition = getLineAndCharacterOfPosition; + var hasOwnProperty = Object.prototype.hasOwnProperty; + function isWhiteSpace(ch) { + 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.isWhiteSpace = isWhiteSpace; + function isLineBreak(ch) { + return ch === 10 || + ch === 13 || + ch === 8232 || + ch === 8233; + } + ts.isLineBreak = isLineBreak; + function isDigit(ch) { + return ch >= 48 && ch <= 57; + } + function isOctalDigit(ch) { + return ch >= 48 && ch <= 55; + } + ts.isOctalDigit = isOctalDigit; + function couldStartTrivia(text, pos) { + var ch = text.charCodeAt(pos); + switch (ch) { + case 13: + case 10: + case 9: + case 11: + case 12: + case 32: + case 47: + case 60: + case 61: + case 62: + return true; + case 35: + return pos === 0; + default: + return ch > 127; + } + } + ts.couldStartTrivia = couldStartTrivia; + function skipTrivia(text, pos, stopAfterLineBreak) { + if (!(pos >= 0)) { + return pos; + } + while (true) { + var ch = text.charCodeAt(pos); + switch (ch) { + case 13: + if (text.charCodeAt(pos + 1) === 10) { + pos++; + } + case 10: + pos++; + if (stopAfterLineBreak) { + return pos; + } + continue; + case 9: + case 11: + case 12: + case 32: + pos++; + continue; + case 47: + if (text.charCodeAt(pos + 1) === 47) { + pos += 2; + while (pos < text.length) { + if (isLineBreak(text.charCodeAt(pos))) { + break; + } + pos++; + } + continue; + } + if (text.charCodeAt(pos + 1) === 42) { + pos += 2; + while (pos < text.length) { + if (text.charCodeAt(pos) === 42 && text.charCodeAt(pos + 1) === 47) { + pos += 2; + break; + } + pos++; + } + continue; + } + break; + case 60: + case 61: + case 62: + if (isConflictMarkerTrivia(text, pos)) { + pos = scanConflictMarkerTrivia(text, pos); + continue; + } + break; + case 35: + if (pos === 0 && isShebangTrivia(text, pos)) { + pos = scanShebangTrivia(text, pos); + continue; + } + break; + default: + if (ch > 127 && (isWhiteSpace(ch) || isLineBreak(ch))) { + pos++; + continue; + } + break; + } + return pos; + } + } + ts.skipTrivia = skipTrivia; + var mergeConflictMarkerLength = "<<<<<<<".length; + function isConflictMarkerTrivia(text, pos) { + ts.Debug.assert(pos >= 0); + if (pos === 0 || isLineBreak(text.charCodeAt(pos - 1))) { + var ch = text.charCodeAt(pos); + if ((pos + mergeConflictMarkerLength) < text.length) { + for (var i = 0, n = mergeConflictMarkerLength; i < n; i++) { + if (text.charCodeAt(pos + i) !== ch) { + return false; + } + } + return ch === 61 || + text.charCodeAt(pos + mergeConflictMarkerLength) === 32; + } + } + return false; + } + function scanConflictMarkerTrivia(text, pos, error) { + if (error) { + error(ts.Diagnostics.Merge_conflict_marker_encountered, mergeConflictMarkerLength); + } + var ch = text.charCodeAt(pos); + var len = text.length; + if (ch === 60 || ch === 62) { + while (pos < len && !isLineBreak(text.charCodeAt(pos))) { + pos++; + } + } + else { + ts.Debug.assert(ch === 61); + while (pos < len) { + var ch_1 = text.charCodeAt(pos); + if (ch_1 === 62 && isConflictMarkerTrivia(text, pos)) { + break; + } + pos++; + } + } + return pos; + } + var shebangTriviaRegex = /^#!.*/; + function isShebangTrivia(text, pos) { + ts.Debug.assert(pos === 0); + return shebangTriviaRegex.test(text); + } + function scanShebangTrivia(text, pos) { + var shebang = shebangTriviaRegex.exec(text)[0]; + pos = pos + shebang.length; + return pos; + } + function getCommentRanges(text, pos, trailing) { + var result; + var collecting = trailing || pos === 0; + while (pos < text.length) { + var ch = text.charCodeAt(pos); + switch (ch) { + case 13: + if (text.charCodeAt(pos + 1) === 10) { + pos++; + } + case 10: + pos++; + if (trailing) { + return result; + } + collecting = true; + if (result && result.length) { + ts.lastOrUndefined(result).hasTrailingNewLine = true; + } + continue; + case 9: + case 11: + case 12: + case 32: + pos++; + continue; + case 47: + var nextChar = text.charCodeAt(pos + 1); + var hasTrailingNewLine = false; + if (nextChar === 47 || nextChar === 42) { + var kind = nextChar === 47 ? 2 : 3; + var startPos = pos; + pos += 2; + if (nextChar === 47) { + while (pos < text.length) { + if (isLineBreak(text.charCodeAt(pos))) { + hasTrailingNewLine = true; + break; + } + pos++; + } + } + else { + while (pos < text.length) { + if (text.charCodeAt(pos) === 42 && text.charCodeAt(pos + 1) === 47) { + pos += 2; + break; + } + pos++; + } + } + if (collecting) { + if (!result) { + result = []; + } + result.push({ pos: startPos, end: pos, hasTrailingNewLine: hasTrailingNewLine, kind: kind }); + } + continue; + } + break; + default: + if (ch > 127 && (isWhiteSpace(ch) || isLineBreak(ch))) { + if (result && result.length && isLineBreak(ch)) { + ts.lastOrUndefined(result).hasTrailingNewLine = true; + } + pos++; + continue; + } + break; + } + return result; + } + return result; + } + function getLeadingCommentRanges(text, pos) { + return getCommentRanges(text, pos, false); + } + ts.getLeadingCommentRanges = getLeadingCommentRanges; + function getTrailingCommentRanges(text, pos) { + return getCommentRanges(text, pos, true); + } + ts.getTrailingCommentRanges = getTrailingCommentRanges; + function getShebang(text) { + return shebangTriviaRegex.test(text) + ? shebangTriviaRegex.exec(text)[0] + : undefined; + } + ts.getShebang = getShebang; + function isIdentifierStart(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 && ch <= 90 || ch >= 97 && ch <= 122 || + ch >= 48 && ch <= 57 || ch === 36 || ch === 95 || + ch > 127 && isUnicodeIdentifierPart(ch, languageVersion); + } + ts.isIdentifierPart = isIdentifierPart; + function isIdentifier(name, languageVersion) { + if (!isIdentifierStart(name.charCodeAt(0), languageVersion)) { + return false; + } + for (var i = 1, n = name.length; i < n; i++) { + if (!isIdentifierPart(name.charCodeAt(i), languageVersion)) { + return false; + } + } + return true; + } + ts.isIdentifier = isIdentifier; + function createScanner(languageVersion, skipTrivia, languageVariant, text, onError, start, length) { + if (languageVariant === void 0) { languageVariant = 0; } + var pos; + var end; + var startPos; + var tokenPos; + var token; + var tokenValue; + var precedingLineBreak; + var hasExtendedUnicodeEscape; + var tokenIsUnterminated; + setText(text, start, length); + return { + getStartPos: function () { return startPos; }, + getTextPos: function () { return pos; }, + getToken: function () { return token; }, + getTokenPos: function () { return tokenPos; }, + getTokenText: function () { return text.substring(tokenPos, pos); }, + getTokenValue: function () { return tokenValue; }, + hasExtendedUnicodeEscape: function () { return hasExtendedUnicodeEscape; }, + hasPrecedingLineBreak: function () { return precedingLineBreak; }, + isIdentifier: function () { return token === 69 || token > 105; }, + isReservedWord: function () { return token >= 70 && token <= 105; }, + isUnterminated: function () { return tokenIsUnterminated; }, + reScanGreaterToken: reScanGreaterToken, + reScanSlashToken: reScanSlashToken, + reScanTemplateToken: reScanTemplateToken, + scanJsxIdentifier: scanJsxIdentifier, + reScanJsxToken: reScanJsxToken, + scanJsxToken: scanJsxToken, + scanJSDocToken: scanJSDocToken, + scan: scan, + setText: setText, + setScriptTarget: setScriptTarget, + setLanguageVariant: setLanguageVariant, + setOnError: setOnError, + setTextPos: setTextPos, + tryScan: tryScan, + lookAhead: lookAhead, + scanRange: scanRange + }; + function error(message, length) { + if (onError) { + onError(message, length || 0); + } + } + function scanNumber() { + var start = pos; + while (isDigit(text.charCodeAt(pos))) + pos++; + if (text.charCodeAt(pos) === 46) { + pos++; + while (isDigit(text.charCodeAt(pos))) + pos++; + } + var end = pos; + if (text.charCodeAt(pos) === 69 || text.charCodeAt(pos) === 101) { + pos++; + if (text.charCodeAt(pos) === 43 || text.charCodeAt(pos) === 45) + pos++; + if (isDigit(text.charCodeAt(pos))) { + pos++; + while (isDigit(text.charCodeAt(pos))) + pos++; + end = pos; + } + else { + error(ts.Diagnostics.Digit_expected); + } + } + return "" + +(text.substring(start, end)); + } + function scanOctalDigits() { + var start = pos; + while (isOctalDigit(text.charCodeAt(pos))) { + pos++; + } + return +(text.substring(start, pos)); + } + function scanExactNumberOfHexDigits(count) { + return scanHexDigits(count, false); + } + function scanMinimumNumberOfHexDigits(count) { + return scanHexDigits(count, true); + } + function scanHexDigits(minCount, scanAsManyAsPossible) { + var digits = 0; + var value = 0; + while (digits < minCount || scanAsManyAsPossible) { + var ch = text.charCodeAt(pos); + if (ch >= 48 && ch <= 57) { + value = value * 16 + ch - 48; + } + else if (ch >= 65 && ch <= 70) { + value = value * 16 + ch - 65 + 10; + } + else if (ch >= 97 && ch <= 102) { + value = value * 16 + ch - 97 + 10; + } + else { + break; + } + pos++; + digits++; + } + if (digits < minCount) { + value = -1; + } + return value; + } + function scanString() { + var quote = text.charCodeAt(pos); + pos++; + var result = ""; + var start = pos; + while (true) { + if (pos >= end) { + result += text.substring(start, pos); + tokenIsUnterminated = true; + error(ts.Diagnostics.Unterminated_string_literal); + break; + } + var ch = text.charCodeAt(pos); + if (ch === quote) { + result += text.substring(start, pos); + pos++; + break; + } + if (ch === 92) { + result += text.substring(start, pos); + result += scanEscapeSequence(); + start = pos; + continue; + } + if (isLineBreak(ch)) { + result += text.substring(start, pos); + tokenIsUnterminated = true; + error(ts.Diagnostics.Unterminated_string_literal); + break; + } + pos++; + } + return result; + } + function scanTemplateAndSetTokenValue() { + var startedWithBacktick = text.charCodeAt(pos) === 96; + pos++; + var start = pos; + var contents = ""; + var resultingToken; + while (true) { + if (pos >= end) { + contents += text.substring(start, pos); + tokenIsUnterminated = true; + error(ts.Diagnostics.Unterminated_template_literal); + resultingToken = startedWithBacktick ? 11 : 14; + break; + } + var currChar = text.charCodeAt(pos); + if (currChar === 96) { + contents += text.substring(start, pos); + pos++; + resultingToken = startedWithBacktick ? 11 : 14; + break; + } + if (currChar === 36 && pos + 1 < end && text.charCodeAt(pos + 1) === 123) { + contents += text.substring(start, pos); + pos += 2; + resultingToken = startedWithBacktick ? 12 : 13; + break; + } + if (currChar === 92) { + contents += text.substring(start, pos); + contents += scanEscapeSequence(); + start = pos; + continue; + } + if (currChar === 13) { + contents += text.substring(start, pos); + pos++; + if (pos < end && text.charCodeAt(pos) === 10) { + pos++; + } + contents += "\n"; + start = pos; + continue; + } + pos++; + } + ts.Debug.assert(resultingToken !== undefined); + tokenValue = contents; + return resultingToken; + } + function scanEscapeSequence() { + pos++; + if (pos >= end) { + error(ts.Diagnostics.Unexpected_end_of_text); + return ""; + } + var ch = text.charCodeAt(pos); + pos++; + switch (ch) { + case 48: + return "\0"; + case 98: + return "\b"; + case 116: + return "\t"; + case 110: + return "\n"; + case 118: + return "\v"; + case 102: + return "\f"; + case 114: + return "\r"; + case 39: + return "\'"; + case 34: + return "\""; + case 117: + if (pos < end && text.charCodeAt(pos) === 123) { + hasExtendedUnicodeEscape = true; + pos++; + return scanExtendedUnicodeEscape(); + } + return scanHexadecimalEscape(4); + case 120: + return scanHexadecimalEscape(2); + case 13: + if (pos < end && text.charCodeAt(pos) === 10) { + pos++; + } + case 10: + case 8232: + case 8233: + return ""; + default: + return String.fromCharCode(ch); + } + } + function scanHexadecimalEscape(numDigits) { + var escapedValue = scanExactNumberOfHexDigits(numDigits); + if (escapedValue >= 0) { + return String.fromCharCode(escapedValue); + } + else { + error(ts.Diagnostics.Hexadecimal_digit_expected); + return ""; + } + } + function scanExtendedUnicodeEscape() { + var escapedValue = scanMinimumNumberOfHexDigits(1); + var isInvalidExtendedEscape = false; + if (escapedValue < 0) { + error(ts.Diagnostics.Hexadecimal_digit_expected); + isInvalidExtendedEscape = true; + } + else if (escapedValue > 0x10FFFF) { + error(ts.Diagnostics.An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive); + isInvalidExtendedEscape = true; + } + if (pos >= end) { + error(ts.Diagnostics.Unexpected_end_of_text); + isInvalidExtendedEscape = true; + } + else if (text.charCodeAt(pos) === 125) { + pos++; + } + else { + error(ts.Diagnostics.Unterminated_Unicode_escape_sequence); + isInvalidExtendedEscape = true; + } + if (isInvalidExtendedEscape) { + return ""; + } + return utf16EncodeAsString(escapedValue); + } + function utf16EncodeAsString(codePoint) { + ts.Debug.assert(0x0 <= codePoint && codePoint <= 0x10FFFF); + if (codePoint <= 65535) { + return String.fromCharCode(codePoint); + } + var codeUnit1 = Math.floor((codePoint - 65536) / 1024) + 0xD800; + var codeUnit2 = ((codePoint - 65536) % 1024) + 0xDC00; + return String.fromCharCode(codeUnit1, codeUnit2); + } + function peekUnicodeEscape() { + if (pos + 5 < end && text.charCodeAt(pos + 1) === 117) { + var start_1 = pos; + pos += 2; + var value = scanExactNumberOfHexDigits(4); + pos = start_1; + return value; + } + return -1; + } + function scanIdentifierParts() { + var result = ""; + var start = pos; + while (pos < end) { + var ch = text.charCodeAt(pos); + if (isIdentifierPart(ch, languageVersion)) { + pos++; + } + else if (ch === 92) { + ch = peekUnicodeEscape(); + if (!(ch >= 0 && isIdentifierPart(ch, languageVersion))) { + break; + } + result += text.substring(start, pos); + result += String.fromCharCode(ch); + pos += 6; + start = pos; + } + else { + break; + } + } + result += text.substring(start, pos); + return result; + } + function getIdentifierToken() { + var len = tokenValue.length; + if (len >= 2 && len <= 11) { + var ch = tokenValue.charCodeAt(0); + if (ch >= 97 && ch <= 122 && hasOwnProperty.call(textToToken, tokenValue)) { + return token = textToToken[tokenValue]; + } + } + return token = 69; + } + function scanBinaryOrOctalDigits(base) { + ts.Debug.assert(base !== 2 || base !== 8, "Expected either base 2 or base 8"); + var value = 0; + var numberOfDigits = 0; + while (true) { + var ch = text.charCodeAt(pos); + var valueOfCh = ch - 48; + if (!isDigit(ch) || valueOfCh >= base) { + break; + } + value = value * base + valueOfCh; + pos++; + numberOfDigits++; + } + if (numberOfDigits === 0) { + return -1; + } + return value; + } + function scan() { + startPos = pos; + hasExtendedUnicodeEscape = false; + precedingLineBreak = false; + tokenIsUnterminated = false; + while (true) { + tokenPos = pos; + if (pos >= end) { + return token = 1; + } + var ch = text.charCodeAt(pos); + if (ch === 35 && pos === 0 && isShebangTrivia(text, pos)) { + pos = scanShebangTrivia(text, pos); + if (skipTrivia) { + continue; + } + else { + return token = 6; + } + } + switch (ch) { + case 10: + case 13: + precedingLineBreak = true; + if (skipTrivia) { + pos++; + continue; + } + else { + if (ch === 13 && pos + 1 < end && text.charCodeAt(pos + 1) === 10) { + pos += 2; + } + else { + pos++; + } + return token = 4; + } + case 9: + case 11: + case 12: + case 32: + if (skipTrivia) { + pos++; + continue; + } + else { + while (pos < end && isWhiteSpace(text.charCodeAt(pos))) { + pos++; + } + return token = 5; + } + case 33: + if (text.charCodeAt(pos + 1) === 61) { + if (text.charCodeAt(pos + 2) === 61) { + return pos += 3, token = 33; + } + return pos += 2, token = 31; + } + pos++; + return token = 49; + case 34: + case 39: + tokenValue = scanString(); + return token = 9; + case 96: + return token = scanTemplateAndSetTokenValue(); + case 37: + if (text.charCodeAt(pos + 1) === 61) { + return pos += 2, token = 62; + } + pos++; + return token = 40; + case 38: + if (text.charCodeAt(pos + 1) === 38) { + return pos += 2, token = 51; + } + if (text.charCodeAt(pos + 1) === 61) { + return pos += 2, token = 66; + } + pos++; + return token = 46; + case 40: + pos++; + return token = 17; + case 41: + pos++; + return token = 18; + case 42: + if (text.charCodeAt(pos + 1) === 61) { + return pos += 2, token = 59; + } + if (text.charCodeAt(pos + 1) === 42) { + if (text.charCodeAt(pos + 2) === 61) { + return pos += 3, token = 60; + } + return pos += 2, token = 38; + } + pos++; + return token = 37; + case 43: + if (text.charCodeAt(pos + 1) === 43) { + return pos += 2, token = 41; + } + if (text.charCodeAt(pos + 1) === 61) { + return pos += 2, token = 57; + } + pos++; + return token = 35; + case 44: + pos++; + return token = 24; + case 45: + if (text.charCodeAt(pos + 1) === 45) { + return pos += 2, token = 42; + } + if (text.charCodeAt(pos + 1) === 61) { + return pos += 2, token = 58; + } + pos++; + return token = 36; + case 46: + if (isDigit(text.charCodeAt(pos + 1))) { + tokenValue = scanNumber(); + return token = 8; + } + if (text.charCodeAt(pos + 1) === 46 && text.charCodeAt(pos + 2) === 46) { + return pos += 3, token = 22; + } + pos++; + return token = 21; + case 47: + if (text.charCodeAt(pos + 1) === 47) { + pos += 2; + while (pos < end) { + if (isLineBreak(text.charCodeAt(pos))) { + break; + } + pos++; + } + if (skipTrivia) { + continue; + } + else { + return token = 2; + } + } + if (text.charCodeAt(pos + 1) === 42) { + pos += 2; + var commentClosed = false; + while (pos < end) { + var ch_2 = text.charCodeAt(pos); + if (ch_2 === 42 && text.charCodeAt(pos + 1) === 47) { + pos += 2; + commentClosed = true; + break; + } + if (isLineBreak(ch_2)) { + precedingLineBreak = true; + } + pos++; + } + if (!commentClosed) { + error(ts.Diagnostics.Asterisk_Slash_expected); + } + if (skipTrivia) { + continue; + } + else { + tokenIsUnterminated = !commentClosed; + return token = 3; + } + } + if (text.charCodeAt(pos + 1) === 61) { + return pos += 2, token = 61; + } + pos++; + return token = 39; + case 48: + if (pos + 2 < end && (text.charCodeAt(pos + 1) === 88 || text.charCodeAt(pos + 1) === 120)) { + pos += 2; + var value = scanMinimumNumberOfHexDigits(1); + if (value < 0) { + error(ts.Diagnostics.Hexadecimal_digit_expected); + value = 0; + } + tokenValue = "" + value; + return token = 8; + } + else if (pos + 2 < end && (text.charCodeAt(pos + 1) === 66 || text.charCodeAt(pos + 1) === 98)) { + pos += 2; + var value = scanBinaryOrOctalDigits(2); + if (value < 0) { + error(ts.Diagnostics.Binary_digit_expected); + value = 0; + } + tokenValue = "" + value; + return token = 8; + } + else if (pos + 2 < end && (text.charCodeAt(pos + 1) === 79 || text.charCodeAt(pos + 1) === 111)) { + pos += 2; + var value = scanBinaryOrOctalDigits(8); + if (value < 0) { + error(ts.Diagnostics.Octal_digit_expected); + value = 0; + } + tokenValue = "" + value; + return token = 8; + } + if (pos + 1 < end && isOctalDigit(text.charCodeAt(pos + 1))) { + tokenValue = "" + scanOctalDigits(); + return token = 8; + } + case 49: + case 50: + case 51: + case 52: + case 53: + case 54: + case 55: + case 56: + case 57: + tokenValue = scanNumber(); + return token = 8; + case 58: + pos++; + return token = 54; + case 59: + pos++; + return token = 23; + case 60: + if (isConflictMarkerTrivia(text, pos)) { + pos = scanConflictMarkerTrivia(text, pos, error); + if (skipTrivia) { + continue; + } + else { + return token = 7; + } + } + if (text.charCodeAt(pos + 1) === 60) { + if (text.charCodeAt(pos + 2) === 61) { + return pos += 3, token = 63; + } + return pos += 2, token = 43; + } + if (text.charCodeAt(pos + 1) === 61) { + return pos += 2, token = 28; + } + if (languageVariant === 1 && + text.charCodeAt(pos + 1) === 47 && + text.charCodeAt(pos + 2) !== 42) { + return pos += 2, token = 26; + } + pos++; + return token = 25; + case 61: + if (isConflictMarkerTrivia(text, pos)) { + pos = scanConflictMarkerTrivia(text, pos, error); + if (skipTrivia) { + continue; + } + else { + return token = 7; + } + } + if (text.charCodeAt(pos + 1) === 61) { + if (text.charCodeAt(pos + 2) === 61) { + return pos += 3, token = 32; + } + return pos += 2, token = 30; + } + if (text.charCodeAt(pos + 1) === 62) { + return pos += 2, token = 34; + } + pos++; + return token = 56; + case 62: + if (isConflictMarkerTrivia(text, pos)) { + pos = scanConflictMarkerTrivia(text, pos, error); + if (skipTrivia) { + continue; + } + else { + return token = 7; + } + } + pos++; + return token = 27; + case 63: + pos++; + return token = 53; + case 91: + pos++; + return token = 19; + case 93: + pos++; + return token = 20; + case 94: + if (text.charCodeAt(pos + 1) === 61) { + return pos += 2, token = 68; + } + pos++; + return token = 48; + case 123: + pos++; + return token = 15; + case 124: + if (text.charCodeAt(pos + 1) === 124) { + return pos += 2, token = 52; + } + if (text.charCodeAt(pos + 1) === 61) { + return pos += 2, token = 67; + } + pos++; + return token = 47; + case 125: + pos++; + return token = 16; + case 126: + pos++; + return token = 50; + case 64: + pos++; + return token = 55; + case 92: + var cookedChar = peekUnicodeEscape(); + if (cookedChar >= 0 && isIdentifierStart(cookedChar, languageVersion)) { + pos += 6; + tokenValue = String.fromCharCode(cookedChar) + scanIdentifierParts(); + return token = getIdentifierToken(); + } + error(ts.Diagnostics.Invalid_character); + pos++; + 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) { + tokenValue += scanIdentifierParts(); + } + return token = getIdentifierToken(); + } + else if (isWhiteSpace(ch)) { + pos++; + continue; + } + else if (isLineBreak(ch)) { + precedingLineBreak = true; + pos++; + continue; + } + error(ts.Diagnostics.Invalid_character); + pos++; + return token = 0; + } + } + } + function reScanGreaterToken() { + if (token === 27) { + if (text.charCodeAt(pos) === 62) { + if (text.charCodeAt(pos + 1) === 62) { + if (text.charCodeAt(pos + 2) === 61) { + return pos += 3, token = 65; + } + return pos += 2, token = 45; + } + if (text.charCodeAt(pos + 1) === 61) { + return pos += 2, token = 64; + } + pos++; + return token = 44; + } + if (text.charCodeAt(pos) === 61) { + pos++; + return token = 29; + } + } + return token; + } + function reScanSlashToken() { + if (token === 39 || token === 61) { + var p = tokenPos + 1; + var inEscape = false; + var inCharacterClass = false; + while (true) { + if (p >= end) { + tokenIsUnterminated = true; + error(ts.Diagnostics.Unterminated_regular_expression_literal); + break; + } + var ch = text.charCodeAt(p); + if (isLineBreak(ch)) { + tokenIsUnterminated = true; + error(ts.Diagnostics.Unterminated_regular_expression_literal); + break; + } + if (inEscape) { + inEscape = false; + } + else if (ch === 47 && !inCharacterClass) { + p++; + break; + } + else if (ch === 91) { + inCharacterClass = true; + } + else if (ch === 92) { + inEscape = true; + } + else if (ch === 93) { + inCharacterClass = false; + } + p++; + } + while (p < end && isIdentifierPart(text.charCodeAt(p), languageVersion)) { + p++; + } + pos = p; + tokenValue = text.substring(tokenPos, pos); + token = 10; + } + return token; + } + function reScanTemplateToken() { + ts.Debug.assert(token === 16, "'reScanTemplateToken' should only be called on a '}'"); + pos = tokenPos; + return token = scanTemplateAndSetTokenValue(); + } + function reScanJsxToken() { + pos = tokenPos = startPos; + return token = scanJsxToken(); + } + function scanJsxToken() { + startPos = tokenPos = pos; + if (pos >= end) { + return token = 1; + } + var char = text.charCodeAt(pos); + if (char === 60) { + if (text.charCodeAt(pos + 1) === 47) { + pos += 2; + return token = 26; + } + pos++; + return token = 25; + } + if (char === 123) { + pos++; + return token = 15; + } + while (pos < end) { + pos++; + char = text.charCodeAt(pos); + if ((char === 123) || (char === 60)) { + break; + } + } + return token = 244; + } + function scanJsxIdentifier() { + if (tokenIsIdentifierOrKeyword(token)) { + var firstCharPosition = pos; + while (pos < end) { + var ch = text.charCodeAt(pos); + if (ch === 45 || ((firstCharPosition === pos) ? isIdentifierStart(ch, languageVersion) : isIdentifierPart(ch, languageVersion))) { + pos++; + } + else { + break; + } + } + tokenValue += text.substr(firstCharPosition, pos - firstCharPosition); + } + return token; + } + function scanJSDocToken() { + if (pos >= end) { + return token = 1; + } + startPos = pos; + var ch = text.charCodeAt(pos); + while (pos < end) { + ch = text.charCodeAt(pos); + if (isWhiteSpace(ch)) { + pos++; + } + else { + break; + } + } + tokenPos = pos; + switch (ch) { + case 64: + return pos += 1, token = 55; + case 10: + case 13: + return pos += 1, token = 4; + case 42: + return pos += 1, token = 37; + case 123: + return pos += 1, token = 15; + case 125: + return pos += 1, token = 16; + case 91: + return pos += 1, token = 19; + case 93: + return pos += 1, token = 20; + case 61: + return pos += 1, token = 56; + case 44: + return pos += 1, token = 24; + } + if (isIdentifierStart(ch, 2)) { + pos++; + while (isIdentifierPart(text.charCodeAt(pos), 2) && pos < end) { + pos++; + } + return token = 69; + } + else { + return pos += 1, token = 0; + } + } + function speculationHelper(callback, isLookahead) { + var savePos = pos; + var saveStartPos = startPos; + var saveTokenPos = tokenPos; + var saveToken = token; + var saveTokenValue = tokenValue; + var savePrecedingLineBreak = precedingLineBreak; + var result = callback(); + if (!result || isLookahead) { + pos = savePos; + startPos = saveStartPos; + tokenPos = saveTokenPos; + token = saveToken; + tokenValue = saveTokenValue; + precedingLineBreak = savePrecedingLineBreak; + } + return result; + } + function scanRange(start, length, callback) { + var saveEnd = end; + var savePos = pos; + var saveStartPos = startPos; + var saveTokenPos = tokenPos; + var saveToken = token; + var savePrecedingLineBreak = precedingLineBreak; + var saveTokenValue = tokenValue; + var saveHasExtendedUnicodeEscape = hasExtendedUnicodeEscape; + var saveTokenIsUnterminated = tokenIsUnterminated; + setText(text, start, length); + var result = callback(); + end = saveEnd; + pos = savePos; + startPos = saveStartPos; + tokenPos = saveTokenPos; + token = saveToken; + precedingLineBreak = savePrecedingLineBreak; + tokenValue = saveTokenValue; + hasExtendedUnicodeEscape = saveHasExtendedUnicodeEscape; + tokenIsUnterminated = saveTokenIsUnterminated; + return result; + } + function lookAhead(callback) { + return speculationHelper(callback, true); + } + function tryScan(callback) { + return speculationHelper(callback, false); + } + function setText(newText, start, length) { + text = newText || ""; + end = length === undefined ? text.length : start + length; + setTextPos(start || 0); + } + function setOnError(errorCallback) { + onError = errorCallback; + } + function setScriptTarget(scriptTarget) { + languageVersion = scriptTarget; + } + function setLanguageVariant(variant) { + languageVariant = variant; + } + function setTextPos(textPos) { + ts.Debug.assert(textPos >= 0); + pos = textPos; + startPos = textPos; + tokenPos = textPos; + token = 0; + precedingLineBreak = false; + tokenValue = undefined; + hasExtendedUnicodeEscape = false; + tokenIsUnterminated = false; + } + } + ts.createScanner = createScanner; +})(ts || (ts = {})); +var ts; +(function (ts) { + ts.optionDeclarations = [ + { + name: "charset", + type: "string" + }, + { + name: "declaration", + shortName: "d", + type: "boolean", + description: ts.Diagnostics.Generates_corresponding_d_ts_file + }, + { + name: "declarationDir", + type: "string", + isFilePath: true, + paramType: ts.Diagnostics.DIRECTORY + }, + { + name: "diagnostics", + type: "boolean" + }, + { + name: "emitBOM", + type: "boolean" + }, + { + name: "help", + shortName: "h", + type: "boolean", + description: ts.Diagnostics.Print_this_message + }, + { + name: "init", + type: "boolean", + description: ts.Diagnostics.Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file + }, + { + name: "inlineSourceMap", + type: "boolean" + }, + { + name: "inlineSources", + type: "boolean" + }, + { + name: "jsx", + type: { + "preserve": 1, + "react": 2 + }, + paramType: ts.Diagnostics.KIND, + description: ts.Diagnostics.Specify_JSX_code_generation_Colon_preserve_or_react + }, + { + name: "reactNamespace", + type: "string", + description: ts.Diagnostics.Specify_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit + }, + { + name: "listFiles", + type: "boolean" + }, + { + name: "locale", + type: "string" + }, + { + name: "mapRoot", + type: "string", + isFilePath: true, + description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations, + paramType: ts.Diagnostics.LOCATION + }, + { + name: "module", + shortName: "m", + type: { + "none": ts.ModuleKind.None, + "commonjs": ts.ModuleKind.CommonJS, + "amd": ts.ModuleKind.AMD, + "system": ts.ModuleKind.System, + "umd": ts.ModuleKind.UMD, + "es6": ts.ModuleKind.ES6, + "es2015": ts.ModuleKind.ES2015 + }, + description: ts.Diagnostics.Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015, + paramType: ts.Diagnostics.KIND + }, + { + name: "newLine", + type: { + "crlf": 0, + "lf": 1 + }, + description: ts.Diagnostics.Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix, + paramType: ts.Diagnostics.NEWLINE + }, + { + name: "noEmit", + type: "boolean", + description: ts.Diagnostics.Do_not_emit_outputs + }, + { + name: "noEmitHelpers", + type: "boolean" + }, + { + name: "noEmitOnError", + type: "boolean", + description: ts.Diagnostics.Do_not_emit_outputs_if_any_errors_were_reported + }, + { + name: "noImplicitAny", + type: "boolean", + description: ts.Diagnostics.Raise_error_on_expressions_and_declarations_with_an_implied_any_type + }, + { + name: "noImplicitThis", + type: "boolean", + description: ts.Diagnostics.Raise_error_on_this_expressions_with_an_implied_any_type + }, + { + name: "noLib", + type: "boolean" + }, + { + name: "noResolve", + type: "boolean" + }, + { + name: "skipDefaultLibCheck", + type: "boolean" + }, + { + name: "out", + type: "string", + isFilePath: false, + paramType: ts.Diagnostics.FILE + }, + { + name: "outFile", + type: "string", + isFilePath: true, + description: ts.Diagnostics.Concatenate_and_emit_output_to_single_file, + paramType: ts.Diagnostics.FILE + }, + { + name: "outDir", + type: "string", + isFilePath: true, + description: ts.Diagnostics.Redirect_output_structure_to_the_directory, + paramType: ts.Diagnostics.DIRECTORY + }, + { + name: "preserveConstEnums", + type: "boolean", + description: ts.Diagnostics.Do_not_erase_const_enum_declarations_in_generated_code + }, + { + name: "pretty", + description: ts.Diagnostics.Stylize_errors_and_messages_using_color_and_context_experimental, + type: "boolean" + }, + { + name: "project", + shortName: "p", + type: "string", + isFilePath: true, + description: ts.Diagnostics.Compile_the_project_in_the_given_directory, + paramType: ts.Diagnostics.DIRECTORY + }, + { + name: "removeComments", + type: "boolean", + description: ts.Diagnostics.Do_not_emit_comments_to_output + }, + { + name: "rootDir", + type: "string", + isFilePath: true, + paramType: ts.Diagnostics.LOCATION, + description: ts.Diagnostics.Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir + }, + { + name: "isolatedModules", + type: "boolean" + }, + { + name: "sourceMap", + type: "boolean", + description: ts.Diagnostics.Generates_corresponding_map_file + }, + { + name: "sourceRoot", + type: "string", + isFilePath: true, + description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations, + paramType: ts.Diagnostics.LOCATION + }, + { + name: "suppressExcessPropertyErrors", + type: "boolean", + description: ts.Diagnostics.Suppress_excess_property_checks_for_object_literals, + experimental: true + }, + { + name: "suppressImplicitAnyIndexErrors", + type: "boolean", + description: ts.Diagnostics.Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures + }, + { + name: "stripInternal", + type: "boolean", + description: ts.Diagnostics.Do_not_emit_declarations_for_code_that_has_an_internal_annotation, + experimental: true + }, + { + name: "target", + shortName: "t", + type: { + "es3": 0, + "es5": 1, + "es6": 2, + "es2015": 2 + }, + description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015, + paramType: ts.Diagnostics.VERSION + }, + { + name: "version", + shortName: "v", + type: "boolean", + description: ts.Diagnostics.Print_the_compiler_s_version + }, + { + name: "watch", + shortName: "w", + type: "boolean", + description: ts.Diagnostics.Watch_input_files + }, + { + name: "experimentalDecorators", + type: "boolean", + description: ts.Diagnostics.Enables_experimental_support_for_ES7_decorators + }, + { + name: "emitDecoratorMetadata", + type: "boolean", + experimental: true, + description: ts.Diagnostics.Enables_experimental_support_for_emitting_type_metadata_for_decorators + }, + { + name: "moduleResolution", + type: { + "node": ts.ModuleResolutionKind.NodeJs, + "classic": ts.ModuleResolutionKind.Classic + }, + description: ts.Diagnostics.Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6 + }, + { + name: "allowUnusedLabels", + type: "boolean", + description: ts.Diagnostics.Do_not_report_errors_on_unused_labels + }, + { + name: "noImplicitReturns", + type: "boolean", + description: ts.Diagnostics.Report_error_when_not_all_code_paths_in_function_return_a_value + }, + { + name: "noFallthroughCasesInSwitch", + type: "boolean", + description: ts.Diagnostics.Report_errors_for_fallthrough_cases_in_switch_statement + }, + { + name: "allowUnreachableCode", + type: "boolean", + description: ts.Diagnostics.Do_not_report_errors_on_unreachable_code + }, + { + name: "forceConsistentCasingInFileNames", + type: "boolean", + description: ts.Diagnostics.Disallow_inconsistently_cased_references_to_the_same_file + }, + { + name: "baseUrl", + type: "string", + isFilePath: true, + description: ts.Diagnostics.Base_directory_to_resolve_non_absolute_module_names + }, + { + name: "paths", + type: "object", + isTSConfigOnly: true + }, + { + name: "rootDirs", + type: "list", + isTSConfigOnly: true, + element: { + name: "rootDirs", + type: "string", + isFilePath: true + } + }, + { + name: "typesSearchPaths", + type: "list", + isTSConfigOnly: true, + element: { + name: "typesSearchPaths", + type: "string", + isFilePath: true + } + }, + { + name: "typesRoot", + type: "string" + }, + { + name: "types", + type: "list", + element: { + name: "types", + type: "string" + }, + description: ts.Diagnostics.Type_declaration_files_to_be_included_in_compilation + }, + { + name: "traceResolution", + type: "boolean", + description: ts.Diagnostics.Enable_tracing_of_the_name_resolution_process + }, + { + name: "allowJs", + type: "boolean", + description: ts.Diagnostics.Allow_javascript_files_to_be_compiled + }, + { + name: "allowSyntheticDefaultImports", + type: "boolean", + description: ts.Diagnostics.Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typechecking + }, + { + name: "noImplicitUseStrict", + type: "boolean", + description: ts.Diagnostics.Do_not_emit_use_strict_directives_in_module_output + }, + { + name: "listEmittedFiles", + type: "boolean" + }, + { + name: "lib", + type: "list", + element: { + name: "lib", + type: { + "es5": "lib.es5.d.ts", + "es6": "lib.es2015.d.ts", + "es2015": "lib.es2015.d.ts", + "es7": "lib.es2016.d.ts", + "es2016": "lib.es2016.d.ts", + "es2017": "lib.es2017.d.ts", + "dom": "lib.dom.d.ts", + "webworker": "lib.webworker.d.ts", + "scripthost": "lib.scripthost.d.ts", + "es2015.core": "lib.es2015.core.d.ts", + "es2015.collection": "lib.es2015.collection.d.ts", + "es2015.generator": "lib.es2015.generator.d.ts", + "es2015.iterable": "lib.es2015.iterable.d.ts", + "es2015.promise": "lib.es2015.promise.d.ts", + "es2015.proxy": "lib.es2015.proxy.d.ts", + "es2015.reflect": "lib.es2015.reflect.d.ts", + "es2015.symbol": "lib.es2015.symbol.d.ts", + "es2015.symbol.wellknown": "lib.es2015.symbol.wellknown.d.ts", + "es2016.array.include": "lib.es2016.array.include.d.ts", + "es2017.object": "lib.es2017.object.d.ts" + } + }, + description: ts.Diagnostics.Specify_library_files_to_be_included_in_the_compilation_Colon + }, + { + name: "strictNullChecks", + type: "boolean", + description: ts.Diagnostics.Enable_strict_null_checks + } + ]; + ts.typingOptionDeclarations = [ + { + name: "enableAutoDiscovery", + type: "boolean" + }, + { + name: "include", + type: "list", + element: { + name: "include", + type: "string" + } + }, + { + name: "exclude", + type: "list", + element: { + name: "exclude", + type: "string" + } + } + ]; + var optionNameMapCache; + function getOptionNameMap() { + if (optionNameMapCache) { + return optionNameMapCache; + } + var optionNameMap = {}; + var shortOptionNames = {}; + ts.forEach(ts.optionDeclarations, function (option) { + optionNameMap[option.name.toLowerCase()] = option; + if (option.shortName) { + shortOptionNames[option.shortName] = option.name; + } + }); + optionNameMapCache = { optionNameMap: optionNameMap, shortOptionNames: shortOptionNames }; + return optionNameMapCache; + } + ts.getOptionNameMap = getOptionNameMap; + function createCompilerDiagnosticForInvalidCustomType(opt) { + var namesOfType = []; + ts.forEachKey(opt.type, function (key) { + namesOfType.push(" '" + key + "'"); + }); + return ts.createCompilerDiagnostic(ts.Diagnostics.Argument_for_0_option_must_be_Colon_1, "--" + opt.name, namesOfType); + } + ts.createCompilerDiagnosticForInvalidCustomType = createCompilerDiagnosticForInvalidCustomType; + function parseCustomTypeOption(opt, value, errors) { + var key = trimString((value || "")).toLowerCase(); + var map = opt.type; + if (ts.hasProperty(map, key)) { + return map[key]; + } + else { + errors.push(createCompilerDiagnosticForInvalidCustomType(opt)); + } + } + ts.parseCustomTypeOption = parseCustomTypeOption; + function parseListTypeOption(opt, value, errors) { + var values = trimString((value || "")).split(","); + switch (opt.element.type) { + case "number": + return ts.map(values, parseInt); + case "string": + return ts.map(values, function (v) { return v || ""; }); + default: + return ts.filter(ts.map(values, function (v) { return parseCustomTypeOption(opt.element, v, errors); }), function (v) { return !!v; }); + } + } + ts.parseListTypeOption = parseListTypeOption; + function parseCommandLine(commandLine, readFile) { + var options = {}; + var fileNames = []; + var errors = []; + var _a = getOptionNameMap(), optionNameMap = _a.optionNameMap, shortOptionNames = _a.shortOptionNames; + parseStrings(commandLine); + return { + options: options, + fileNames: fileNames, + errors: errors + }; + function parseStrings(args) { + var i = 0; + while (i < args.length) { + var s = args[i]; + i++; + if (s.charCodeAt(0) === 64) { + parseResponseFile(s.slice(1)); + } + else if (s.charCodeAt(0) === 45) { + s = s.slice(s.charCodeAt(1) === 45 ? 2 : 1).toLowerCase(); + if (ts.hasProperty(shortOptionNames, s)) { + s = shortOptionNames[s]; + } + if (ts.hasProperty(optionNameMap, s)) { + var opt = optionNameMap[s]; + if (opt.isTSConfigOnly) { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_can_only_be_specified_in_tsconfig_json_file, opt.name)); + } + else { + if (!args[i] && opt.type !== "boolean") { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_expects_an_argument, opt.name)); + } + switch (opt.type) { + case "number": + options[opt.name] = parseInt(args[i]); + i++; + break; + case "boolean": + options[opt.name] = true; + break; + case "string": + options[opt.name] = args[i] || ""; + i++; + break; + case "list": + options[opt.name] = parseListTypeOption(opt, args[i], errors); + i++; + break; + default: + options[opt.name] = parseCustomTypeOption(opt, args[i], errors); + i++; + break; + } + } + } + else { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unknown_compiler_option_0, s)); + } + } + else { + fileNames.push(s); + } + } + } + function parseResponseFile(fileName) { + var text = readFile ? readFile(fileName) : ts.sys.readFile(fileName); + if (!text) { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.File_0_not_found, fileName)); + return; + } + var args = []; + var pos = 0; + while (true) { + while (pos < text.length && text.charCodeAt(pos) <= 32) + pos++; + if (pos >= text.length) + break; + var start = pos; + if (text.charCodeAt(start) === 34) { + pos++; + while (pos < text.length && text.charCodeAt(pos) !== 34) + pos++; + if (pos < text.length) { + args.push(text.substring(start + 1, pos)); + pos++; + } + else { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unterminated_quoted_string_in_response_file_0, fileName)); + } + } + else { + while (text.charCodeAt(pos) > 32) + pos++; + args.push(text.substring(start, pos)); + } + } + parseStrings(args); + } + } + ts.parseCommandLine = parseCommandLine; + function readConfigFile(fileName, readFile) { + var text = ""; + try { + text = readFile(fileName); + } + catch (e) { + return { error: ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, e.message) }; + } + return parseConfigFileTextToJson(fileName, text); + } + ts.readConfigFile = readConfigFile; + function parseConfigFileTextToJson(fileName, jsonText) { + try { + var jsonTextWithoutComments = removeComments(jsonText); + return { config: /\S/.test(jsonTextWithoutComments) ? JSON.parse(jsonTextWithoutComments) : {} }; + } + catch (e) { + return { error: ts.createCompilerDiagnostic(ts.Diagnostics.Failed_to_parse_file_0_Colon_1, fileName, e.message) }; + } + } + ts.parseConfigFileTextToJson = parseConfigFileTextToJson; + function removeComments(jsonText) { + var output = ""; + var scanner = ts.createScanner(1, false, 0, jsonText); + var token; + while ((token = scanner.scan()) !== 1) { + switch (token) { + case 2: + case 3: + output += scanner.getTokenText().replace(/\S/g, " "); + break; + default: + output += scanner.getTokenText(); + break; + } + } + return output; + } + var IgnoreFileNamePattern = /(\.min\.js$)|([\\/]\.[\w.])/; + function parseJsonConfigFileContent(json, host, basePath, existingOptions, configFileName) { + if (existingOptions === void 0) { existingOptions = {}; } + var errors = []; + var compilerOptions = convertCompilerOptionsFromJsonWorker(json["compilerOptions"], basePath, errors, configFileName); + var options = ts.extend(existingOptions, compilerOptions); + var typingOptions = convertTypingOptionsFromJsonWorker(json["typingOptions"], basePath, errors, configFileName); + options.configFilePath = configFileName; + var fileNames = getFileNames(errors); + return { + options: options, + fileNames: fileNames, + typingOptions: typingOptions, + raw: json, + errors: errors + }; + function getFileNames(errors) { + var fileNames = []; + if (ts.hasProperty(json, "files")) { + if (ts.isArray(json["files"])) { + fileNames = ts.map(json["files"], function (s) { return ts.combinePaths(basePath, s); }); + } + else { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, "files", "Array")); + } + } + else { + var filesSeen = {}; + var exclude = []; + if (ts.isArray(json["exclude"])) { + exclude = json["exclude"]; + } + else { + exclude = ["node_modules", "bower_components", "jspm_packages"]; + } + var outDir = json["compilerOptions"] && json["compilerOptions"]["outDir"]; + if (outDir) { + exclude.push(outDir); + } + exclude = ts.map(exclude, ts.normalizeSlashes); + var supportedExtensions = ts.getSupportedExtensions(options); + ts.Debug.assert(ts.indexOf(supportedExtensions, ".ts") < ts.indexOf(supportedExtensions, ".d.ts"), "Changed priority of extensions to pick"); + for (var _i = 0, supportedExtensions_1 = supportedExtensions; _i < supportedExtensions_1.length; _i++) { + var extension = supportedExtensions_1[_i]; + var filesInDirWithExtension = host.readDirectory(basePath, extension, exclude); + for (var _a = 0, filesInDirWithExtension_1 = filesInDirWithExtension; _a < filesInDirWithExtension_1.length; _a++) { + var fileName = filesInDirWithExtension_1[_a]; + if (extension === ".ts" && ts.fileExtensionIs(fileName, ".d.ts")) { + continue; + } + if (IgnoreFileNamePattern.test(fileName)) { + continue; + } + if (extension === ".d.ts" || (options.allowJs && ts.contains(ts.supportedJavascriptExtensions, extension))) { + var baseName = fileName.substr(0, fileName.length - extension.length); + if (ts.hasProperty(filesSeen, baseName + ".ts") || ts.hasProperty(filesSeen, baseName + ".tsx")) { + continue; + } + } + filesSeen[fileName] = true; + fileNames.push(fileName); + } + } + } + if (ts.hasProperty(json, "excludes") && !ts.hasProperty(json, "exclude")) { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unknown_option_excludes_Did_you_mean_exclude)); + } + return fileNames; + } + } + ts.parseJsonConfigFileContent = parseJsonConfigFileContent; + function convertCompilerOptionsFromJson(jsonOptions, basePath, configFileName) { + var errors = []; + var options = convertCompilerOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName); + return { options: options, errors: errors }; + } + ts.convertCompilerOptionsFromJson = convertCompilerOptionsFromJson; + function convertTypingOptionsFromJson(jsonOptions, basePath, configFileName) { + var errors = []; + var options = convertTypingOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName); + return { options: options, errors: errors }; + } + ts.convertTypingOptionsFromJson = convertTypingOptionsFromJson; + function convertCompilerOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName) { + var options = ts.getBaseFileName(configFileName) === "jsconfig.json" ? { allowJs: true } : {}; + convertOptionsFromJson(ts.optionDeclarations, jsonOptions, basePath, options, ts.Diagnostics.Unknown_compiler_option_0, errors); + return options; + } + function convertTypingOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName) { + var options = ts.getBaseFileName(configFileName) === "jsconfig.json" + ? { enableAutoDiscovery: true, include: [], exclude: [] } + : { enableAutoDiscovery: false, include: [], exclude: [] }; + convertOptionsFromJson(ts.typingOptionDeclarations, jsonOptions, basePath, options, ts.Diagnostics.Unknown_typing_option_0, errors); + return options; + } + function convertOptionsFromJson(optionDeclarations, jsonOptions, basePath, defaultOptions, diagnosticMessage, errors) { + if (!jsonOptions) { + return; + } + var optionNameMap = ts.arrayToMap(optionDeclarations, function (opt) { return opt.name; }); + for (var id in jsonOptions) { + if (ts.hasProperty(optionNameMap, id)) { + var opt = optionNameMap[id]; + defaultOptions[opt.name] = convertJsonOption(opt, jsonOptions[id], basePath, errors); + } + else { + errors.push(ts.createCompilerDiagnostic(diagnosticMessage, id)); + } + } + } + function convertJsonOption(opt, value, basePath, errors) { + var optType = opt.type; + var expectedType = typeof optType === "string" ? optType : "string"; + if (optType === "list" && ts.isArray(value)) { + return convertJsonOptionOfListType(opt, value, basePath, errors); + } + else if (typeof value === expectedType) { + if (typeof optType !== "string") { + return convertJsonOptionOfCustomType(opt, value, errors); + } + else { + if (opt.isFilePath) { + value = ts.normalizePath(ts.combinePaths(basePath, value)); + if (value === "") { + value = "."; + } + } + } + return value; + } + else { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, opt.name, expectedType)); + } + } + function convertJsonOptionOfCustomType(opt, value, errors) { + var key = value.toLowerCase(); + if (ts.hasProperty(opt.type, key)) { + return opt.type[key]; + } + else { + errors.push(createCompilerDiagnosticForInvalidCustomType(opt)); + } + } + function convertJsonOptionOfListType(option, values, basePath, errors) { + return ts.filter(ts.map(values, function (v) { return convertJsonOption(option.element, v, basePath, errors); }), function (v) { return !!v; }); + } + function trimString(s) { + return typeof s.trim === "function" ? s.trim() : s.replace(/^[\s]+|[\s]+$/g, ""); + } +})(ts || (ts = {})); +var ts; +(function (ts) { + function getDeclarationOfKind(symbol, kind) { + var declarations = symbol.declarations; + if (declarations) { + for (var _i = 0, declarations_1 = declarations; _i < declarations_1.length; _i++) { + var declaration = declarations_1[_i]; + if (declaration.kind === kind) { + return declaration; + } + } + } + return undefined; + } + ts.getDeclarationOfKind = getDeclarationOfKind; + var stringWriters = []; + function getSingleLineStringWriter() { + if (stringWriters.length === 0) { + var str_1 = ""; + var writeText = function (text) { return str_1 += text; }; + return { + string: function () { return str_1; }, + writeKeyword: writeText, + writeOperator: writeText, + writePunctuation: writeText, + writeSpace: writeText, + writeStringLiteral: writeText, + writeParameter: writeText, + writeSymbol: writeText, + writeLine: function () { return str_1 += " "; }, + increaseIndent: function () { }, + decreaseIndent: function () { }, + clear: function () { return str_1 = ""; }, + trackSymbol: function () { }, + reportInaccessibleThisError: function () { } + }; + } + return stringWriters.pop(); + } + ts.getSingleLineStringWriter = getSingleLineStringWriter; + function releaseStringWriter(writer) { + writer.clear(); + stringWriters.push(writer); + } + ts.releaseStringWriter = releaseStringWriter; + function getFullWidth(node) { + return node.end - node.pos; + } + ts.getFullWidth = getFullWidth; + function mapIsEqualTo(map1, map2) { + if (!map1 || !map2) { + return map1 === map2; + } + return containsAll(map1, map2) && containsAll(map2, map1); + } + ts.mapIsEqualTo = mapIsEqualTo; + function containsAll(map, other) { + for (var key in map) { + if (!ts.hasProperty(map, key)) { + continue; + } + if (!ts.hasProperty(other, key) || map[key] !== other[key]) { + return false; + } + } + return true; + } + function arrayIsEqualTo(array1, array2, equaler) { + if (!array1 || !array2) { + return array1 === array2; + } + if (array1.length !== array2.length) { + return false; + } + for (var i = 0; i < array1.length; i++) { + var equals = equaler ? equaler(array1[i], array2[i]) : array1[i] === array2[i]; + if (!equals) { + return false; + } + } + return true; + } + ts.arrayIsEqualTo = arrayIsEqualTo; + function hasResolvedModule(sourceFile, moduleNameText) { + return sourceFile.resolvedModules && ts.hasProperty(sourceFile.resolvedModules, moduleNameText); + } + ts.hasResolvedModule = hasResolvedModule; + function getResolvedModule(sourceFile, moduleNameText) { + return hasResolvedModule(sourceFile, moduleNameText) ? sourceFile.resolvedModules[moduleNameText] : undefined; + } + ts.getResolvedModule = getResolvedModule; + function setResolvedModule(sourceFile, moduleNameText, resolvedModule) { + if (!sourceFile.resolvedModules) { + sourceFile.resolvedModules = {}; + } + sourceFile.resolvedModules[moduleNameText] = resolvedModule; + } + ts.setResolvedModule = setResolvedModule; + function setResolvedTypeReferenceDirective(sourceFile, typeReferenceDirectiveName, resolvedTypeReferenceDirective) { + if (!sourceFile.resolvedTypeReferenceDirectiveNames) { + sourceFile.resolvedTypeReferenceDirectiveNames = {}; + } + sourceFile.resolvedTypeReferenceDirectiveNames[typeReferenceDirectiveName] = resolvedTypeReferenceDirective; + } + ts.setResolvedTypeReferenceDirective = setResolvedTypeReferenceDirective; + function moduleResolutionIsEqualTo(oldResolution, newResolution) { + return oldResolution.resolvedFileName === newResolution.resolvedFileName && oldResolution.isExternalLibraryImport === newResolution.isExternalLibraryImport; + } + ts.moduleResolutionIsEqualTo = moduleResolutionIsEqualTo; + function typeDirectiveIsEqualTo(oldResolution, newResolution) { + return oldResolution.resolvedFileName === newResolution.resolvedFileName && oldResolution.primary === newResolution.primary; + } + ts.typeDirectiveIsEqualTo = typeDirectiveIsEqualTo; + function hasChangesInResolutions(names, newResolutions, oldResolutions, comparer) { + if (names.length !== newResolutions.length) { + return false; + } + for (var i = 0; i < names.length; i++) { + var newResolution = newResolutions[i]; + var oldResolution = oldResolutions && ts.hasProperty(oldResolutions, names[i]) ? oldResolutions[names[i]] : undefined; + var changed = oldResolution + ? !newResolution || !comparer(oldResolution, newResolution) + : newResolution; + if (changed) { + return true; + } + } + return false; + } + ts.hasChangesInResolutions = hasChangesInResolutions; + function containsParseError(node) { + aggregateChildData(node); + return (node.flags & 268435456) !== 0; + } + ts.containsParseError = containsParseError; + function aggregateChildData(node) { + if (!(node.flags & 536870912)) { + var thisNodeOrAnySubNodesHasError = ((node.flags & 67108864) !== 0) || + ts.forEachChild(node, containsParseError); + if (thisNodeOrAnySubNodesHasError) { + node.flags |= 268435456; + } + node.flags |= 536870912; + } + } + function getSourceFileOfNode(node) { + while (node && node.kind !== 256) { + node = node.parent; + } + return node; + } + ts.getSourceFileOfNode = getSourceFileOfNode; + function isStatementWithLocals(node) { + switch (node.kind) { + case 199: + case 227: + case 206: + case 207: + case 208: + return true; + } + return false; + } + ts.isStatementWithLocals = isStatementWithLocals; + function getStartPositionOfLine(line, sourceFile) { + ts.Debug.assert(line >= 0); + return ts.getLineStarts(sourceFile)[line]; + } + ts.getStartPositionOfLine = getStartPositionOfLine; + function nodePosToString(node) { + var file = getSourceFileOfNode(node); + var loc = ts.getLineAndCharacterOfPosition(file, node.pos); + return file.fileName + "(" + (loc.line + 1) + "," + (loc.character + 1) + ")"; + } + ts.nodePosToString = nodePosToString; + function getStartPosOfNode(node) { + return node.pos; + } + ts.getStartPosOfNode = getStartPosOfNode; + function getEndLinePosition(line, sourceFile) { + ts.Debug.assert(line >= 0); + var lineStarts = ts.getLineStarts(sourceFile); + var lineIndex = line; + var sourceText = sourceFile.text; + if (lineIndex + 1 === lineStarts.length) { + return sourceText.length - 1; + } + else { + var start = lineStarts[lineIndex]; + var pos = lineStarts[lineIndex + 1] - 1; + ts.Debug.assert(ts.isLineBreak(sourceText.charCodeAt(pos))); + while (start <= pos && ts.isLineBreak(sourceText.charCodeAt(pos))) { + pos--; + } + return pos; + } + } + ts.getEndLinePosition = getEndLinePosition; + function nodeIsMissing(node) { + if (!node) { + return true; + } + return node.pos === node.end && node.pos >= 0 && node.kind !== 1; + } + ts.nodeIsMissing = nodeIsMissing; + function nodeIsPresent(node) { + return !nodeIsMissing(node); + } + ts.nodeIsPresent = nodeIsPresent; + function getTokenPosOfNode(node, sourceFile) { + if (nodeIsMissing(node)) { + return node.pos; + } + return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos); + } + ts.getTokenPosOfNode = getTokenPosOfNode; + function getNonDecoratorTokenPosOfNode(node, sourceFile) { + if (nodeIsMissing(node) || !node.decorators) { + return getTokenPosOfNode(node, sourceFile); + } + return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.decorators.end); + } + ts.getNonDecoratorTokenPosOfNode = getNonDecoratorTokenPosOfNode; + function getSourceTextOfNodeFromSourceFile(sourceFile, node, includeTrivia) { + if (includeTrivia === void 0) { includeTrivia = false; } + if (nodeIsMissing(node)) { + return ""; + } + var text = sourceFile.text; + return text.substring(includeTrivia ? node.pos : ts.skipTrivia(text, node.pos), node.end); + } + ts.getSourceTextOfNodeFromSourceFile = getSourceTextOfNodeFromSourceFile; + function getTextOfNodeFromSourceText(sourceText, node) { + if (nodeIsMissing(node)) { + return ""; + } + return sourceText.substring(ts.skipTrivia(sourceText, node.pos), node.end); + } + ts.getTextOfNodeFromSourceText = getTextOfNodeFromSourceText; + function getTextOfNode(node, includeTrivia) { + if (includeTrivia === void 0) { includeTrivia = false; } + return getSourceTextOfNodeFromSourceFile(getSourceFileOfNode(node), node, includeTrivia); + } + ts.getTextOfNode = getTextOfNode; + function escapeIdentifier(identifier) { + return identifier.length >= 2 && identifier.charCodeAt(0) === 95 && identifier.charCodeAt(1) === 95 ? "_" + identifier : identifier; + } + ts.escapeIdentifier = escapeIdentifier; + function unescapeIdentifier(identifier) { + return identifier.length >= 3 && identifier.charCodeAt(0) === 95 && identifier.charCodeAt(1) === 95 && identifier.charCodeAt(2) === 95 ? identifier.substr(1) : identifier; + } + ts.unescapeIdentifier = unescapeIdentifier; + function makeIdentifierFromModuleName(moduleName) { + return ts.getBaseFileName(moduleName).replace(/^(\d)/, "_$1").replace(/\W/g, "_"); + } + ts.makeIdentifierFromModuleName = makeIdentifierFromModuleName; + function isBlockOrCatchScoped(declaration) { + return (getCombinedNodeFlags(declaration) & 3072) !== 0 || + isCatchClauseVariableDeclaration(declaration); + } + ts.isBlockOrCatchScoped = isBlockOrCatchScoped; + function isAmbientModule(node) { + return node && node.kind === 225 && + (node.name.kind === 9 || isGlobalScopeAugmentation(node)); + } + ts.isAmbientModule = isAmbientModule; + function isBlockScopedContainerTopLevel(node) { + return node.kind === 256 || + node.kind === 225 || + isFunctionLike(node) || + isFunctionBlock(node); + } + ts.isBlockScopedContainerTopLevel = isBlockScopedContainerTopLevel; + function isGlobalScopeAugmentation(module) { + return !!(module.flags & 131072); + } + ts.isGlobalScopeAugmentation = isGlobalScopeAugmentation; + function isExternalModuleAugmentation(node) { + if (!node || !isAmbientModule(node)) { + return false; + } + switch (node.parent.kind) { + case 256: + return ts.isExternalModule(node.parent); + case 226: + return isAmbientModule(node.parent.parent) && !ts.isExternalModule(node.parent.parent.parent); + } + return false; + } + ts.isExternalModuleAugmentation = isExternalModuleAugmentation; + function getEnclosingBlockScopeContainer(node) { + var current = node.parent; + while (current) { + if (isFunctionLike(current)) { + return current; + } + switch (current.kind) { + case 256: + case 227: + case 252: + case 225: + case 206: + case 207: + case 208: + return current; + case 199: + if (!isFunctionLike(current.parent)) { + return current; + } + } + current = current.parent; + } + } + ts.getEnclosingBlockScopeContainer = getEnclosingBlockScopeContainer; + function isCatchClauseVariableDeclaration(declaration) { + return declaration && + declaration.kind === 218 && + declaration.parent && + declaration.parent.kind === 252; + } + ts.isCatchClauseVariableDeclaration = isCatchClauseVariableDeclaration; + function declarationNameToString(name) { + return getFullWidth(name) === 0 ? "(Missing)" : getTextOfNode(name); + } + ts.declarationNameToString = declarationNameToString; + function createDiagnosticForNode(node, message, arg0, arg1, arg2) { + var sourceFile = getSourceFileOfNode(node); + var span = getErrorSpanForNode(sourceFile, node); + return ts.createFileDiagnostic(sourceFile, span.start, span.length, message, arg0, arg1, arg2); + } + ts.createDiagnosticForNode = createDiagnosticForNode; + function createDiagnosticForNodeFromMessageChain(node, messageChain) { + var sourceFile = getSourceFileOfNode(node); + var span = getErrorSpanForNode(sourceFile, node); + return { + file: sourceFile, + start: span.start, + length: span.length, + code: messageChain.code, + category: messageChain.category, + messageText: messageChain.next ? messageChain : messageChain.messageText + }; + } + ts.createDiagnosticForNodeFromMessageChain = createDiagnosticForNodeFromMessageChain; + function getSpanOfTokenAtPosition(sourceFile, 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()); + } + ts.getSpanOfTokenAtPosition = getSpanOfTokenAtPosition; + function getErrorSpanForArrowFunction(sourceFile, node) { + var pos = ts.skipTrivia(sourceFile.text, node.pos); + if (node.body && node.body.kind === 199) { + var startLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.pos).line; + var endLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.end).line; + if (startLine < endLine) { + return ts.createTextSpan(pos, getEndLinePosition(startLine, sourceFile) - pos + 1); + } + } + return ts.createTextSpanFromBounds(pos, node.end); + } + function getErrorSpanForNode(sourceFile, node) { + var errorNode = node; + switch (node.kind) { + case 256: + var pos_1 = ts.skipTrivia(sourceFile.text, 0, false); + if (pos_1 === sourceFile.text.length) { + return ts.createTextSpan(0, 0); + } + return getSpanOfTokenAtPosition(sourceFile, pos_1); + case 218: + case 169: + case 221: + case 192: + case 222: + case 225: + case 224: + case 255: + case 220: + case 179: + case 147: + case 149: + case 150: + case 223: + errorNode = node.name; + break; + case 180: + return getErrorSpanForArrowFunction(sourceFile, node); + } + if (errorNode === undefined) { + return getSpanOfTokenAtPosition(sourceFile, node.pos); + } + var pos = nodeIsMissing(errorNode) + ? errorNode.pos + : ts.skipTrivia(sourceFile.text, errorNode.pos); + return ts.createTextSpanFromBounds(pos, errorNode.end); + } + ts.getErrorSpanForNode = getErrorSpanForNode; + function isExternalOrCommonJsModule(file) { + return (file.externalModuleIndicator || file.commonJsModuleIndicator) !== undefined; + } + ts.isExternalOrCommonJsModule = isExternalOrCommonJsModule; + function isDeclarationFile(file) { + return file.isDeclarationFile; + } + ts.isDeclarationFile = isDeclarationFile; + function isConstEnumDeclaration(node) { + return node.kind === 224 && isConst(node); + } + ts.isConstEnumDeclaration = isConstEnumDeclaration; + function walkUpBindingElementsAndPatterns(node) { + while (node && (node.kind === 169 || isBindingPattern(node))) { + node = node.parent; + } + return node; + } + function getCombinedNodeFlags(node) { + node = walkUpBindingElementsAndPatterns(node); + var flags = node.flags; + if (node.kind === 218) { + node = node.parent; + } + if (node && node.kind === 219) { + flags |= node.flags; + node = node.parent; + } + if (node && node.kind === 200) { + flags |= node.flags; + } + return flags; + } + ts.getCombinedNodeFlags = getCombinedNodeFlags; + function isConst(node) { + return !!(getCombinedNodeFlags(node) & 2048); + } + ts.isConst = isConst; + function isLet(node) { + return !!(getCombinedNodeFlags(node) & 1024); + } + ts.isLet = isLet; + function isSuperCallExpression(n) { + return n.kind === 174 && n.expression.kind === 95; + } + ts.isSuperCallExpression = isSuperCallExpression; + function isPrologueDirective(node) { + return node.kind === 202 && node.expression.kind === 9; + } + ts.isPrologueDirective = isPrologueDirective; + function getLeadingCommentRangesOfNode(node, sourceFileOfNode) { + return ts.getLeadingCommentRanges(sourceFileOfNode.text, node.pos); + } + ts.getLeadingCommentRangesOfNode = getLeadingCommentRangesOfNode; + function getLeadingCommentRangesOfNodeFromText(node, text) { + return ts.getLeadingCommentRanges(text, node.pos); + } + ts.getLeadingCommentRangesOfNodeFromText = getLeadingCommentRangesOfNodeFromText; + function getJsDocComments(node, sourceFileOfNode) { + return getJsDocCommentsFromText(node, sourceFileOfNode.text); + } + ts.getJsDocComments = getJsDocComments; + function getJsDocCommentsFromText(node, text) { + var commentRanges = (node.kind === 142 || node.kind === 141) ? + ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) : + getLeadingCommentRangesOfNodeFromText(node, text); + return ts.filter(commentRanges, isJsDocComment); + function isJsDocComment(comment) { + return text.charCodeAt(comment.pos + 1) === 42 && + text.charCodeAt(comment.pos + 2) === 42 && + text.charCodeAt(comment.pos + 3) !== 47; + } + } + ts.getJsDocCommentsFromText = getJsDocCommentsFromText; + ts.fullTripleSlashReferencePathRegEx = /^(\/\/\/\s*/; + ts.fullTripleSlashReferenceTypeReferenceDirectiveRegEx = /^(\/\/\/\s*/; + ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*/; + function isTypeNode(node) { + if (154 <= node.kind && node.kind <= 166) { + return true; + } + switch (node.kind) { + case 117: + case 130: + case 132: + case 120: + case 133: + case 135: + case 127: + return true; + case 103: + return node.parent.kind !== 183; + case 194: + return !isExpressionWithTypeArgumentsInClassExtendsClause(node); + case 69: + if (node.parent.kind === 139 && node.parent.right === node) { + node = node.parent; + } + else if (node.parent.kind === 172 && node.parent.name === node) { + node = node.parent; + } + ts.Debug.assert(node.kind === 69 || node.kind === 139 || node.kind === 172, "'node' was expected to be a qualified name, identifier or property access in 'isTypeNode'."); + case 139: + case 172: + case 97: + var parent_1 = node.parent; + if (parent_1.kind === 158) { + return false; + } + if (154 <= parent_1.kind && parent_1.kind <= 166) { + return true; + } + switch (parent_1.kind) { + case 194: + return !isExpressionWithTypeArgumentsInClassExtendsClause(parent_1); + case 141: + return node === parent_1.constraint; + case 145: + case 144: + case 142: + case 218: + return node === parent_1.type; + case 220: + case 179: + case 180: + case 148: + case 147: + case 146: + case 149: + case 150: + return node === parent_1.type; + case 151: + case 152: + case 153: + return node === parent_1.type; + case 177: + return node === parent_1.type; + case 174: + case 175: + return parent_1.typeArguments && ts.indexOf(parent_1.typeArguments, node) >= 0; + case 176: + return false; + } + } + return false; + } + ts.isTypeNode = isTypeNode; + function forEachReturnStatement(body, visitor) { + return traverse(body); + function traverse(node) { + switch (node.kind) { + case 211: + return visitor(node); + case 227: + case 199: + case 203: + case 204: + case 205: + case 206: + case 207: + case 208: + case 212: + case 213: + case 249: + case 250: + case 214: + case 216: + case 252: + return ts.forEachChild(node, traverse); + } + } + } + ts.forEachReturnStatement = forEachReturnStatement; + function forEachYieldExpression(body, visitor) { + return traverse(body); + function traverse(node) { + switch (node.kind) { + case 190: + visitor(node); + var operand = node.expression; + if (operand) { + traverse(operand); + } + case 224: + case 222: + case 225: + case 223: + case 221: + case 192: + return; + default: + if (isFunctionLike(node)) { + var name_5 = node.name; + if (name_5 && name_5.kind === 140) { + traverse(name_5.expression); + return; + } + } + else if (!isTypeNode(node)) { + ts.forEachChild(node, traverse); + } + } + } + } + ts.forEachYieldExpression = forEachYieldExpression; + function isVariableLike(node) { + if (node) { + switch (node.kind) { + case 169: + case 255: + case 142: + case 253: + case 145: + case 144: + case 254: + case 218: + return true; + } + } + return false; + } + ts.isVariableLike = isVariableLike; + function isAccessor(node) { + return node && (node.kind === 149 || node.kind === 150); + } + ts.isAccessor = isAccessor; + function isClassLike(node) { + return node && (node.kind === 221 || node.kind === 192); + } + ts.isClassLike = isClassLike; + function isFunctionLike(node) { + return node && isFunctionLikeKind(node.kind); + } + ts.isFunctionLike = isFunctionLike; + function isFunctionLikeKind(kind) { + switch (kind) { + case 148: + case 179: + case 220: + case 180: + case 147: + case 146: + case 149: + case 150: + case 151: + case 152: + case 153: + case 156: + case 157: + return true; + } + } + ts.isFunctionLikeKind = isFunctionLikeKind; + function introducesArgumentsExoticObject(node) { + switch (node.kind) { + case 147: + case 146: + case 148: + case 149: + case 150: + case 220: + case 179: + return true; + } + return false; + } + ts.introducesArgumentsExoticObject = introducesArgumentsExoticObject; + function isIterationStatement(node, lookInLabeledStatements) { + switch (node.kind) { + case 206: + case 207: + case 208: + case 204: + case 205: + return true; + case 214: + return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); + } + return false; + } + ts.isIterationStatement = isIterationStatement; + function isFunctionBlock(node) { + return node && node.kind === 199 && isFunctionLike(node.parent); + } + ts.isFunctionBlock = isFunctionBlock; + function isObjectLiteralMethod(node) { + return node && node.kind === 147 && node.parent.kind === 171; + } + ts.isObjectLiteralMethod = isObjectLiteralMethod; + function isIdentifierTypePredicate(predicate) { + return predicate && predicate.kind === 1; + } + ts.isIdentifierTypePredicate = isIdentifierTypePredicate; + function isThisTypePredicate(predicate) { + return predicate && predicate.kind === 0; + } + ts.isThisTypePredicate = isThisTypePredicate; + function getContainingFunction(node) { + while (true) { + node = node.parent; + if (!node || isFunctionLike(node)) { + return node; + } + } + } + ts.getContainingFunction = getContainingFunction; + function getContainingFunctionOrModule(node) { + while (true) { + node = node.parent; + if (isFunctionLike(node) || node.kind === 225 || node.kind === 256) { + return node; + } + } + } + ts.getContainingFunctionOrModule = getContainingFunctionOrModule; + function getContainingClass(node) { + while (true) { + node = node.parent; + if (!node || isClassLike(node)) { + return node; + } + } + } + ts.getContainingClass = getContainingClass; + function getThisContainer(node, includeArrowFunctions) { + while (true) { + node = node.parent; + if (!node) { + return undefined; + } + switch (node.kind) { + case 140: + if (isClassLike(node.parent.parent)) { + return node; + } + node = node.parent; + break; + case 143: + if (node.parent.kind === 142 && isClassElement(node.parent.parent)) { + node = node.parent.parent; + } + else if (isClassElement(node.parent)) { + node = node.parent; + } + break; + case 180: + if (!includeArrowFunctions) { + continue; + } + case 220: + case 179: + case 225: + case 145: + case 144: + case 147: + case 146: + case 148: + case 149: + case 150: + case 151: + case 152: + case 153: + case 224: + case 256: + return node; + } + } + } + ts.getThisContainer = getThisContainer; + function getSuperContainer(node, stopOnFunctions) { + while (true) { + node = node.parent; + if (!node) { + return node; + } + switch (node.kind) { + case 140: + node = node.parent; + break; + case 220: + case 179: + case 180: + if (!stopOnFunctions) { + continue; + } + case 145: + case 144: + case 147: + case 146: + case 148: + case 149: + case 150: + return node; + case 143: + if (node.parent.kind === 142 && isClassElement(node.parent.parent)) { + node = node.parent.parent; + } + else if (isClassElement(node.parent)) { + node = node.parent; + } + break; + } + } + } + ts.getSuperContainer = getSuperContainer; + function isSuperPropertyOrElementAccess(node) { + return (node.kind === 172 + || node.kind === 173) + && node.expression.kind === 95; + } + ts.isSuperPropertyOrElementAccess = isSuperPropertyOrElementAccess; + function getEntityNameFromTypeNode(node) { + if (node) { + switch (node.kind) { + case 155: + return node.typeName; + case 194: + return node.expression; + case 69: + case 139: + return node; + } + } + return undefined; + } + ts.getEntityNameFromTypeNode = getEntityNameFromTypeNode; + function getInvokedExpression(node) { + if (node.kind === 176) { + return node.tag; + } + return node.expression; + } + ts.getInvokedExpression = getInvokedExpression; + function nodeCanBeDecorated(node) { + switch (node.kind) { + case 221: + return true; + case 145: + return node.parent.kind === 221; + case 149: + case 150: + case 147: + return node.body !== undefined + && node.parent.kind === 221; + case 142: + return node.parent.body !== undefined + && (node.parent.kind === 148 + || node.parent.kind === 147 + || node.parent.kind === 150) + && node.parent.parent.kind === 221; + } + return false; + } + ts.nodeCanBeDecorated = nodeCanBeDecorated; + function nodeIsDecorated(node) { + return node.decorators !== undefined + && nodeCanBeDecorated(node); + } + ts.nodeIsDecorated = nodeIsDecorated; + function isPropertyAccessExpression(node) { + return node.kind === 172; + } + ts.isPropertyAccessExpression = isPropertyAccessExpression; + function isElementAccessExpression(node) { + return node.kind === 173; + } + ts.isElementAccessExpression = isElementAccessExpression; + function isJSXTagName(node) { + var parent = node.parent; + if (parent.kind === 243 || + parent.kind === 242 || + parent.kind === 245) { + return parent.tagName === node; + } + return false; + } + ts.isJSXTagName = isJSXTagName; + function isExpression(node) { + switch (node.kind) { + case 97: + case 95: + case 93: + case 99: + case 84: + case 10: + case 170: + case 171: + case 172: + case 173: + case 174: + case 175: + case 176: + case 195: + case 177: + case 196: + case 178: + case 179: + case 192: + case 180: + case 183: + case 181: + case 182: + case 185: + case 186: + case 187: + case 188: + case 191: + case 189: + case 11: + case 193: + case 241: + case 242: + case 190: + case 184: + return true; + case 139: + while (node.parent.kind === 139) { + node = node.parent; + } + return node.parent.kind === 158 || isJSXTagName(node); + case 69: + if (node.parent.kind === 158 || isJSXTagName(node)) { + return true; + } + case 8: + case 9: + case 97: + var parent_2 = node.parent; + switch (parent_2.kind) { + case 218: + case 142: + case 145: + case 144: + case 255: + case 253: + case 169: + return parent_2.initializer === node; + case 202: + case 203: + case 204: + case 205: + case 211: + case 212: + case 213: + case 249: + case 215: + case 213: + return parent_2.expression === node; + case 206: + var forStatement = parent_2; + return (forStatement.initializer === node && forStatement.initializer.kind !== 219) || + forStatement.condition === node || + forStatement.incrementor === node; + case 207: + case 208: + var forInStatement = parent_2; + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 219) || + forInStatement.expression === node; + case 177: + case 195: + return node === parent_2.expression; + case 197: + return node === parent_2.expression; + case 140: + return node === parent_2.expression; + case 143: + case 248: + case 247: + return true; + case 194: + return parent_2.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent_2); + default: + if (isExpression(parent_2)) { + return true; + } + } + } + return false; + } + ts.isExpression = isExpression; + function isExternalModuleNameRelative(moduleName) { + return moduleName.substr(0, 2) === "./" || moduleName.substr(0, 3) === "../" || moduleName.substr(0, 2) === ".\\" || moduleName.substr(0, 3) === "..\\"; + } + ts.isExternalModuleNameRelative = isExternalModuleNameRelative; + function isInstantiatedModule(node, preserveConstEnums) { + var moduleState = ts.getModuleInstanceState(node); + return moduleState === 1 || + (preserveConstEnums && moduleState === 2); + } + ts.isInstantiatedModule = isInstantiatedModule; + function isExternalModuleImportEqualsDeclaration(node) { + return node.kind === 229 && node.moduleReference.kind === 240; + } + ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration; + function getExternalModuleImportEqualsDeclarationExpression(node) { + ts.Debug.assert(isExternalModuleImportEqualsDeclaration(node)); + return node.moduleReference.expression; + } + ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression; + function isInternalModuleImportEqualsDeclaration(node) { + return node.kind === 229 && node.moduleReference.kind !== 240; + } + ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration; + function isSourceFileJavaScript(file) { + return isInJavaScriptFile(file); + } + ts.isSourceFileJavaScript = isSourceFileJavaScript; + function isInJavaScriptFile(node) { + return node && !!(node.flags & 134217728); + } + ts.isInJavaScriptFile = isInJavaScriptFile; + function isRequireCall(expression, checkArgumentIsStringLiteral) { + var isRequire = expression.kind === 174 && + expression.expression.kind === 69 && + expression.expression.text === "require" && + expression.arguments.length === 1; + return isRequire && (!checkArgumentIsStringLiteral || expression.arguments[0].kind === 9); + } + ts.isRequireCall = isRequireCall; + function isSingleOrDoubleQuote(charCode) { + return charCode === 39 || charCode === 34; + } + ts.isSingleOrDoubleQuote = isSingleOrDoubleQuote; + function getSpecialPropertyAssignmentKind(expression) { + if (!isInJavaScriptFile(expression)) { + return 0; + } + if (expression.kind !== 187) { + return 0; + } + var expr = expression; + if (expr.operatorToken.kind !== 56 || expr.left.kind !== 172) { + return 0; + } + var lhs = expr.left; + if (lhs.expression.kind === 69) { + var lhsId = lhs.expression; + if (lhsId.text === "exports") { + return 1; + } + else if (lhsId.text === "module" && lhs.name.text === "exports") { + return 2; + } + } + else if (lhs.expression.kind === 97) { + return 4; + } + else if (lhs.expression.kind === 172) { + var innerPropertyAccess = lhs.expression; + if (innerPropertyAccess.expression.kind === 69) { + var innerPropertyAccessIdentifier = innerPropertyAccess.expression; + if (innerPropertyAccessIdentifier.text === "module" && innerPropertyAccess.name.text === "exports") { + return 1; + } + if (innerPropertyAccess.name.text === "prototype") { + return 3; + } + } + } + return 0; + } + ts.getSpecialPropertyAssignmentKind = getSpecialPropertyAssignmentKind; + function getExternalModuleName(node) { + if (node.kind === 230) { + return node.moduleSpecifier; + } + if (node.kind === 229) { + var reference = node.moduleReference; + if (reference.kind === 240) { + return reference.expression; + } + } + if (node.kind === 236) { + return node.moduleSpecifier; + } + if (node.kind === 225 && node.name.kind === 9) { + return node.name; + } + } + ts.getExternalModuleName = getExternalModuleName; + function hasQuestionToken(node) { + if (node) { + switch (node.kind) { + case 142: + case 147: + case 146: + case 254: + case 253: + case 145: + case 144: + return node.questionToken !== undefined; + } + } + return false; + } + ts.hasQuestionToken = hasQuestionToken; + function isJSDocConstructSignature(node) { + return node.kind === 269 && + node.parameters.length > 0 && + node.parameters[0].type.kind === 271; + } + ts.isJSDocConstructSignature = isJSDocConstructSignature; + function getJSDocTag(node, kind, checkParentVariableStatement) { + if (!node) { + return undefined; + } + var jsDocComment = getJSDocComment(node, checkParentVariableStatement); + if (!jsDocComment) { + return undefined; + } + for (var _i = 0, _a = jsDocComment.tags; _i < _a.length; _i++) { + var tag = _a[_i]; + if (tag.kind === kind) { + return tag; + } + } + } + function getJSDocComment(node, checkParentVariableStatement) { + if (node.jsDocComment) { + return node.jsDocComment; + } + if (checkParentVariableStatement) { + var isInitializerOfVariableDeclarationInStatement = node.parent.kind === 218 && + node.parent.initializer === node && + node.parent.parent.parent.kind === 200; + var variableStatementNode = isInitializerOfVariableDeclarationInStatement ? node.parent.parent.parent : undefined; + if (variableStatementNode) { + return variableStatementNode.jsDocComment; + } + var parent_3 = node.parent; + var isSourceOfAssignmentExpressionStatement = parent_3 && parent_3.parent && + parent_3.kind === 187 && + parent_3.operatorToken.kind === 56 && + parent_3.parent.kind === 202; + if (isSourceOfAssignmentExpressionStatement) { + return parent_3.parent.jsDocComment; + } + var isPropertyAssignmentExpression = parent_3 && parent_3.kind === 253; + if (isPropertyAssignmentExpression) { + return parent_3.jsDocComment; + } + } + return undefined; + } + function getJSDocTypeTag(node) { + return getJSDocTag(node, 277, false); + } + ts.getJSDocTypeTag = getJSDocTypeTag; + function getJSDocReturnTag(node) { + return getJSDocTag(node, 276, true); + } + ts.getJSDocReturnTag = getJSDocReturnTag; + function getJSDocTemplateTag(node) { + return getJSDocTag(node, 278, false); + } + ts.getJSDocTemplateTag = getJSDocTemplateTag; + function getCorrespondingJSDocParameterTag(parameter) { + if (parameter.name && parameter.name.kind === 69) { + var parameterName = parameter.name.text; + var jsDocComment = getJSDocComment(parameter.parent, true); + if (jsDocComment) { + for (var _i = 0, _a = jsDocComment.tags; _i < _a.length; _i++) { + var tag = _a[_i]; + if (tag.kind === 275) { + var parameterTag = tag; + var name_6 = parameterTag.preParameterName || parameterTag.postParameterName; + if (name_6.text === parameterName) { + return parameterTag; + } + } + } + } + } + return undefined; + } + ts.getCorrespondingJSDocParameterTag = getCorrespondingJSDocParameterTag; + function hasRestParameter(s) { + return isRestParameter(ts.lastOrUndefined(s.parameters)); + } + ts.hasRestParameter = hasRestParameter; + function hasDeclaredRestParameter(s) { + return isDeclaredRestParam(ts.lastOrUndefined(s.parameters)); + } + ts.hasDeclaredRestParameter = hasDeclaredRestParameter; + function isRestParameter(node) { + if (node && (node.flags & 134217728)) { + if (node.type && node.type.kind === 270) { + return true; + } + var paramTag = getCorrespondingJSDocParameterTag(node); + if (paramTag && paramTag.typeExpression) { + return paramTag.typeExpression.type.kind === 270; + } + } + return isDeclaredRestParam(node); + } + ts.isRestParameter = isRestParameter; + function isDeclaredRestParam(node) { + return node && node.dotDotDotToken !== undefined; + } + ts.isDeclaredRestParam = isDeclaredRestParam; + function isLiteralKind(kind) { + return 8 <= kind && kind <= 11; + } + ts.isLiteralKind = isLiteralKind; + function isTextualLiteralKind(kind) { + return kind === 9 || kind === 11; + } + ts.isTextualLiteralKind = isTextualLiteralKind; + function isTemplateLiteralKind(kind) { + return 11 <= kind && kind <= 14; + } + ts.isTemplateLiteralKind = isTemplateLiteralKind; + function isBindingPattern(node) { + return !!node && (node.kind === 168 || node.kind === 167); + } + ts.isBindingPattern = isBindingPattern; + function isAssignmentTarget(node) { + while (node.parent.kind === 178) { + node = node.parent; + } + while (true) { + var parent_4 = node.parent; + if (parent_4.kind === 170 || parent_4.kind === 191) { + node = parent_4; + continue; + } + if (parent_4.kind === 253 || parent_4.kind === 254) { + node = parent_4.parent; + continue; + } + return parent_4.kind === 187 && + parent_4.operatorToken.kind === 56 && + parent_4.left === node || + (parent_4.kind === 207 || parent_4.kind === 208) && + parent_4.initializer === node; + } + } + ts.isAssignmentTarget = isAssignmentTarget; + function isNodeDescendentOf(node, ancestor) { + while (node) { + if (node === ancestor) + return true; + node = node.parent; + } + return false; + } + ts.isNodeDescendentOf = isNodeDescendentOf; + function isInAmbientContext(node) { + while (node) { + if (node.flags & 2 || (node.kind === 256 && node.isDeclarationFile)) { + return true; + } + node = node.parent; + } + return false; + } + ts.isInAmbientContext = isInAmbientContext; + function isDeclaration(node) { + switch (node.kind) { + case 180: + case 169: + case 221: + case 192: + case 148: + case 224: + case 255: + case 238: + case 220: + case 179: + case 149: + case 231: + case 229: + case 234: + case 222: + case 147: + case 146: + case 225: + case 232: + case 142: + case 253: + case 145: + case 144: + case 150: + case 254: + case 223: + case 141: + case 218: + return true; + } + return false; + } + ts.isDeclaration = isDeclaration; + function isStatement(n) { + switch (n.kind) { + case 210: + case 209: + case 217: + case 204: + case 202: + case 201: + case 207: + case 208: + case 206: + case 203: + case 214: + case 211: + case 213: + case 215: + case 216: + case 200: + case 205: + case 212: + case 235: + return true; + default: + return false; + } + } + ts.isStatement = isStatement; + function isClassElement(n) { + switch (n.kind) { + case 148: + case 145: + case 147: + case 149: + case 150: + case 146: + case 153: + return true; + default: + return false; + } + } + ts.isClassElement = isClassElement; + function isDeclarationName(name) { + if (name.kind !== 69 && name.kind !== 9 && name.kind !== 8) { + return false; + } + var parent = name.parent; + if (parent.kind === 234 || parent.kind === 238) { + if (parent.propertyName) { + return true; + } + } + if (isDeclaration(parent)) { + return parent.name === name; + } + return false; + } + ts.isDeclarationName = isDeclarationName; + function isLiteralComputedPropertyDeclarationName(node) { + return (node.kind === 9 || node.kind === 8) && + node.parent.kind === 140 && + isDeclaration(node.parent.parent); + } + ts.isLiteralComputedPropertyDeclarationName = isLiteralComputedPropertyDeclarationName; + function isIdentifierName(node) { + var parent = node.parent; + switch (parent.kind) { + case 145: + case 144: + case 147: + case 146: + case 149: + case 150: + case 255: + case 253: + case 172: + return parent.name === node; + case 139: + if (parent.right === node) { + while (parent.kind === 139) { + parent = parent.parent; + } + return parent.kind === 158; + } + return false; + case 169: + case 234: + return parent.propertyName === node; + case 238: + return true; + } + return false; + } + ts.isIdentifierName = isIdentifierName; + function isAliasSymbolDeclaration(node) { + return node.kind === 229 || + node.kind === 228 || + node.kind === 231 && !!node.name || + node.kind === 232 || + node.kind === 234 || + node.kind === 238 || + node.kind === 235 && node.expression.kind === 69; + } + ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration; + function getClassExtendsHeritageClauseElement(node) { + var heritageClause = getHeritageClause(node.heritageClauses, 83); + return heritageClause && heritageClause.types.length > 0 ? heritageClause.types[0] : undefined; + } + ts.getClassExtendsHeritageClauseElement = getClassExtendsHeritageClauseElement; + function getClassImplementsHeritageClauseElements(node) { + var heritageClause = getHeritageClause(node.heritageClauses, 106); + return heritageClause ? heritageClause.types : undefined; + } + ts.getClassImplementsHeritageClauseElements = getClassImplementsHeritageClauseElements; + function getInterfaceBaseTypeNodes(node) { + var heritageClause = getHeritageClause(node.heritageClauses, 83); + return heritageClause ? heritageClause.types : undefined; + } + ts.getInterfaceBaseTypeNodes = getInterfaceBaseTypeNodes; + function getHeritageClause(clauses, kind) { + if (clauses) { + for (var _i = 0, clauses_1 = clauses; _i < clauses_1.length; _i++) { + var clause = clauses_1[_i]; + if (clause.token === kind) { + return clause; + } + } + } + return undefined; + } + ts.getHeritageClause = getHeritageClause; + function tryResolveScriptReference(host, sourceFile, reference) { + if (!host.getCompilerOptions().noResolve) { + var referenceFileName = ts.isRootedDiskPath(reference.fileName) ? reference.fileName : ts.combinePaths(ts.getDirectoryPath(sourceFile.fileName), reference.fileName); + return host.getSourceFile(referenceFileName); + } + } + ts.tryResolveScriptReference = tryResolveScriptReference; + function getAncestor(node, kind) { + while (node) { + if (node.kind === kind) { + return node; + } + node = node.parent; + } + return undefined; + } + ts.getAncestor = getAncestor; + function getFileReferenceFromReferencePath(comment, commentRange) { + var simpleReferenceRegEx = /^\/\/\/\s*/gim; + if (simpleReferenceRegEx.test(comment)) { + if (isNoDefaultLibRegEx.test(comment)) { + return { + isNoDefaultLib: true + }; + } + else { + var refMatchResult = ts.fullTripleSlashReferencePathRegEx.exec(comment); + var refLibResult = !refMatchResult && ts.fullTripleSlashReferenceTypeReferenceDirectiveRegEx.exec(comment); + if (refMatchResult || refLibResult) { + var start = commentRange.pos; + var end = commentRange.end; + return { + fileReference: { + pos: start, + end: end, + fileName: (refMatchResult || refLibResult)[3] + }, + isNoDefaultLib: false, + isTypeReferenceDirective: !!refLibResult + }; + } + return { + diagnosticMessage: ts.Diagnostics.Invalid_reference_directive_syntax, + isNoDefaultLib: false + }; + } + } + return undefined; + } + ts.getFileReferenceFromReferencePath = getFileReferenceFromReferencePath; + function isKeyword(token) { + return 70 <= token && token <= 138; + } + ts.isKeyword = isKeyword; + function isTrivia(token) { + return 2 <= token && token <= 7; + } + ts.isTrivia = isTrivia; + function isAsyncFunctionLike(node) { + return isFunctionLike(node) && (node.flags & 256) !== 0 && !isAccessor(node); + } + ts.isAsyncFunctionLike = isAsyncFunctionLike; + function isStringOrNumericLiteral(kind) { + return kind === 9 || kind === 8; + } + ts.isStringOrNumericLiteral = isStringOrNumericLiteral; + function hasDynamicName(declaration) { + return declaration.name && isDynamicName(declaration.name); + } + ts.hasDynamicName = hasDynamicName; + function isDynamicName(name) { + return name.kind === 140 && + !isStringOrNumericLiteral(name.expression.kind) && + !isWellKnownSymbolSyntactically(name.expression); + } + ts.isDynamicName = isDynamicName; + function isWellKnownSymbolSyntactically(node) { + return isPropertyAccessExpression(node) && isESSymbolIdentifier(node.expression); + } + ts.isWellKnownSymbolSyntactically = isWellKnownSymbolSyntactically; + function getPropertyNameForPropertyNameNode(name) { + if (name.kind === 69 || name.kind === 9 || name.kind === 8) { + return name.text; + } + if (name.kind === 140) { + var nameExpression = name.expression; + if (isWellKnownSymbolSyntactically(nameExpression)) { + var rightHandSideName = nameExpression.name.text; + return getPropertyNameForKnownSymbolName(rightHandSideName); + } + else if (nameExpression.kind === 9 || nameExpression.kind === 8) { + return nameExpression.text; + } + } + return undefined; + } + ts.getPropertyNameForPropertyNameNode = getPropertyNameForPropertyNameNode; + function getPropertyNameForKnownSymbolName(symbolName) { + return "__@" + symbolName; + } + ts.getPropertyNameForKnownSymbolName = getPropertyNameForKnownSymbolName; + function isESSymbolIdentifier(node) { + return node.kind === 69 && node.text === "Symbol"; + } + ts.isESSymbolIdentifier = isESSymbolIdentifier; + function isModifierKind(token) { + switch (token) { + case 115: + case 118: + case 74: + case 122: + case 77: + case 82: + case 112: + case 110: + case 111: + case 128: + case 113: + return true; + } + return false; + } + ts.isModifierKind = isModifierKind; + function isParameterDeclaration(node) { + var root = getRootDeclaration(node); + return root.kind === 142; + } + ts.isParameterDeclaration = isParameterDeclaration; + function getRootDeclaration(node) { + while (node.kind === 169) { + node = node.parent.parent; + } + return node; + } + ts.getRootDeclaration = getRootDeclaration; + function nodeStartsNewLexicalEnvironment(n) { + return isFunctionLike(n) || n.kind === 225 || n.kind === 256; + } + ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; + function cloneNode(node, location, flags, parent) { + var clone = location !== undefined + ? ts.createNode(node.kind, location.pos, location.end) + : createSynthesizedNode(node.kind); + for (var key in node) { + if (clone.hasOwnProperty(key) || !node.hasOwnProperty(key)) { + continue; + } + clone[key] = node[key]; + } + if (flags !== undefined) { + clone.flags = flags; + } + if (parent !== undefined) { + clone.parent = parent; + } + return clone; + } + ts.cloneNode = cloneNode; + function cloneEntityName(node, parent) { + var clone = cloneNode(node, node, node.flags, parent); + if (isQualifiedName(clone)) { + var left = clone.left, right = clone.right; + clone.left = cloneEntityName(left, clone); + clone.right = cloneNode(right, right, right.flags, parent); + } + return clone; + } + ts.cloneEntityName = cloneEntityName; + function isQualifiedName(node) { + return node.kind === 139; + } + ts.isQualifiedName = isQualifiedName; + function nodeIsSynthesized(node) { + return node.pos === -1; + } + ts.nodeIsSynthesized = nodeIsSynthesized; + function createSynthesizedNode(kind, startsOnNewLine) { + var node = ts.createNode(kind, -1, -1); + node.startsOnNewLine = startsOnNewLine; + return node; + } + ts.createSynthesizedNode = createSynthesizedNode; + function createSynthesizedNodeArray() { + var array = []; + array.pos = -1; + array.end = -1; + return array; + } + ts.createSynthesizedNodeArray = createSynthesizedNodeArray; + function createDiagnosticCollection() { + var nonFileDiagnostics = []; + var fileDiagnostics = {}; + var diagnosticsModified = false; + var modificationCount = 0; + return { + add: add, + getGlobalDiagnostics: getGlobalDiagnostics, + getDiagnostics: getDiagnostics, + getModificationCount: getModificationCount, + reattachFileDiagnostics: reattachFileDiagnostics + }; + function getModificationCount() { + return modificationCount; + } + function reattachFileDiagnostics(newFile) { + if (!ts.hasProperty(fileDiagnostics, newFile.fileName)) { + return; + } + for (var _i = 0, _a = fileDiagnostics[newFile.fileName]; _i < _a.length; _i++) { + var diagnostic = _a[_i]; + diagnostic.file = newFile; + } + } + function add(diagnostic) { + var diagnostics; + if (diagnostic.file) { + diagnostics = fileDiagnostics[diagnostic.file.fileName]; + if (!diagnostics) { + diagnostics = []; + fileDiagnostics[diagnostic.file.fileName] = diagnostics; + } + } + else { + diagnostics = nonFileDiagnostics; + } + diagnostics.push(diagnostic); + diagnosticsModified = true; + modificationCount++; + } + function getGlobalDiagnostics() { + sortAndDeduplicate(); + return nonFileDiagnostics; + } + function getDiagnostics(fileName) { + sortAndDeduplicate(); + if (fileName) { + return fileDiagnostics[fileName] || []; + } + var allDiagnostics = []; + function pushDiagnostic(d) { + allDiagnostics.push(d); + } + ts.forEach(nonFileDiagnostics, pushDiagnostic); + for (var key in fileDiagnostics) { + if (ts.hasProperty(fileDiagnostics, key)) { + ts.forEach(fileDiagnostics[key], pushDiagnostic); + } + } + return ts.sortAndDeduplicateDiagnostics(allDiagnostics); + } + function sortAndDeduplicate() { + if (!diagnosticsModified) { + return; + } + diagnosticsModified = false; + nonFileDiagnostics = ts.sortAndDeduplicateDiagnostics(nonFileDiagnostics); + for (var key in fileDiagnostics) { + if (ts.hasProperty(fileDiagnostics, key)) { + fileDiagnostics[key] = ts.sortAndDeduplicateDiagnostics(fileDiagnostics[key]); + } + } + } + } + ts.createDiagnosticCollection = createDiagnosticCollection; + var escapedCharsRegExp = /[\\\"\u0000-\u001f\t\v\f\b\r\n\u2028\u2029\u0085]/g; + var escapedCharsMap = { + "\0": "\\0", + "\t": "\\t", + "\v": "\\v", + "\f": "\\f", + "\b": "\\b", + "\r": "\\r", + "\n": "\\n", + "\\": "\\\\", + "\"": "\\\"", + "\u2028": "\\u2028", + "\u2029": "\\u2029", + "\u0085": "\\u0085" + }; + function escapeString(s) { + s = escapedCharsRegExp.test(s) ? s.replace(escapedCharsRegExp, getReplacement) : s; + return s; + function getReplacement(c) { + return escapedCharsMap[c] || get16BitUnicodeEscapeSequence(c.charCodeAt(0)); + } + } + ts.escapeString = escapeString; + function isIntrinsicJsxName(name) { + var ch = name.substr(0, 1); + return ch.toLowerCase() === ch; + } + ts.isIntrinsicJsxName = isIntrinsicJsxName; + function get16BitUnicodeEscapeSequence(charCode) { + var hexCharCode = charCode.toString(16).toUpperCase(); + var paddedHexCode = ("0000" + hexCharCode).slice(-4); + return "\\u" + paddedHexCode; + } + var nonAsciiCharacters = /[^\u0000-\u007F]/g; + function escapeNonAsciiCharacters(s) { + return nonAsciiCharacters.test(s) ? + s.replace(nonAsciiCharacters, function (c) { return get16BitUnicodeEscapeSequence(c.charCodeAt(0)); }) : + s; + } + ts.escapeNonAsciiCharacters = escapeNonAsciiCharacters; + var indentStrings = ["", " "]; + function getIndentString(level) { + if (indentStrings[level] === undefined) { + indentStrings[level] = getIndentString(level - 1) + indentStrings[1]; + } + return indentStrings[level]; + } + ts.getIndentString = getIndentString; + function getIndentSize() { + return indentStrings[1].length; + } + ts.getIndentSize = getIndentSize; + function createTextWriter(newLine) { + var output; + var indent; + var lineStart; + var lineCount; + var linePos; + function write(s) { + if (s && s.length) { + if (lineStart) { + output += getIndentString(indent); + lineStart = false; + } + output += s; + } + } + function reset() { + output = ""; + indent = 0; + lineStart = true; + lineCount = 0; + linePos = 0; + } + function rawWrite(s) { + if (s !== undefined) { + if (lineStart) { + lineStart = false; + } + output += s; + } + } + function writeLiteral(s) { + if (s && s.length) { + write(s); + var lineStartsOfS = ts.computeLineStarts(s); + if (lineStartsOfS.length > 1) { + lineCount = lineCount + lineStartsOfS.length - 1; + linePos = output.length - s.length + ts.lastOrUndefined(lineStartsOfS); + } + } + } + function writeLine() { + if (!lineStart) { + output += newLine; + lineCount++; + linePos = output.length; + lineStart = true; + } + } + function writeTextOfNode(text, node) { + write(getTextOfNodeFromSourceText(text, node)); + } + reset(); + return { + write: write, + rawWrite: rawWrite, + writeTextOfNode: writeTextOfNode, + writeLiteral: writeLiteral, + writeLine: writeLine, + increaseIndent: function () { indent++; }, + 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; }, + getText: function () { return output; }, + reset: reset + }; + } + ts.createTextWriter = createTextWriter; + function getExternalModuleNameFromPath(host, fileName) { + var getCanonicalFileName = function (f) { return host.getCanonicalFileName(f); }; + var dir = ts.toPath(host.getCommonSourceDirectory(), host.getCurrentDirectory(), getCanonicalFileName); + var filePath = ts.getNormalizedAbsolutePath(fileName, host.getCurrentDirectory()); + var relativePath = ts.getRelativePathToDirectoryOrUrl(dir, filePath, dir, getCanonicalFileName, false); + return ts.removeFileExtension(relativePath); + } + ts.getExternalModuleNameFromPath = getExternalModuleNameFromPath; + function getOwnEmitOutputFilePath(sourceFile, host, extension) { + var compilerOptions = host.getCompilerOptions(); + var emitOutputFilePathWithoutExtension; + if (compilerOptions.outDir) { + emitOutputFilePathWithoutExtension = ts.removeFileExtension(getSourceFilePathInNewDir(sourceFile, host, compilerOptions.outDir)); + } + else { + emitOutputFilePathWithoutExtension = ts.removeFileExtension(sourceFile.fileName); + } + return emitOutputFilePathWithoutExtension + extension; + } + ts.getOwnEmitOutputFilePath = getOwnEmitOutputFilePath; + function getDeclarationEmitOutputFilePath(sourceFile, host) { + var options = host.getCompilerOptions(); + var outputDir = options.declarationDir || options.outDir; + if (options.declaration) { + var path = outputDir + ? getSourceFilePathInNewDir(sourceFile, host, outputDir) + : sourceFile.fileName; + return ts.removeFileExtension(path) + ".d.ts"; + } + } + ts.getDeclarationEmitOutputFilePath = getDeclarationEmitOutputFilePath; + function getEmitScriptTarget(compilerOptions) { + return compilerOptions.target || 0; + } + ts.getEmitScriptTarget = getEmitScriptTarget; + function getEmitModuleKind(compilerOptions) { + return typeof compilerOptions.module === "number" ? + compilerOptions.module : + getEmitScriptTarget(compilerOptions) === 2 ? ts.ModuleKind.ES6 : ts.ModuleKind.CommonJS; + } + ts.getEmitModuleKind = getEmitModuleKind; + function forEachExpectedEmitFile(host, action, targetSourceFile) { + var options = host.getCompilerOptions(); + if (options.outFile || options.out) { + onBundledEmit(host); + } + else { + var sourceFiles = targetSourceFile === undefined ? host.getSourceFiles() : [targetSourceFile]; + for (var _i = 0, sourceFiles_1 = sourceFiles; _i < sourceFiles_1.length; _i++) { + var sourceFile = sourceFiles_1[_i]; + if (!isDeclarationFile(sourceFile)) { + onSingleFileEmit(host, sourceFile); + } + } + } + function onSingleFileEmit(host, sourceFile) { + var extension = ".js"; + if (options.jsx === 1) { + if (isSourceFileJavaScript(sourceFile)) { + if (ts.fileExtensionIs(sourceFile.fileName, ".jsx")) { + extension = ".jsx"; + } + } + else if (sourceFile.languageVariant === 1) { + extension = ".jsx"; + } + } + var jsFilePath = getOwnEmitOutputFilePath(sourceFile, host, extension); + var emitFileNames = { + jsFilePath: jsFilePath, + sourceMapFilePath: getSourceMapFilePath(jsFilePath, options), + declarationFilePath: !isSourceFileJavaScript(sourceFile) ? getDeclarationEmitOutputFilePath(sourceFile, host) : undefined + }; + action(emitFileNames, [sourceFile], false); + } + function onBundledEmit(host) { + var bundledSources = ts.filter(host.getSourceFiles(), function (sourceFile) { + return !isDeclarationFile(sourceFile) + && (!ts.isExternalModule(sourceFile) || !!getEmitModuleKind(options)); + }); + if (bundledSources.length) { + var jsFilePath = options.outFile || options.out; + var emitFileNames = { + jsFilePath: jsFilePath, + sourceMapFilePath: getSourceMapFilePath(jsFilePath, options), + declarationFilePath: options.declaration ? ts.removeFileExtension(jsFilePath) + ".d.ts" : undefined + }; + action(emitFileNames, bundledSources, true); + } + } + function getSourceMapFilePath(jsFilePath, options) { + return options.sourceMap ? jsFilePath + ".map" : undefined; + } + } + ts.forEachExpectedEmitFile = forEachExpectedEmitFile; + function getSourceFilePathInNewDir(sourceFile, host, newDirPath) { + var sourceFilePath = ts.getNormalizedAbsolutePath(sourceFile.fileName, host.getCurrentDirectory()); + sourceFilePath = sourceFilePath.replace(host.getCommonSourceDirectory(), ""); + return ts.combinePaths(newDirPath, sourceFilePath); + } + ts.getSourceFilePathInNewDir = getSourceFilePathInNewDir; + function writeFile(host, diagnostics, fileName, data, writeByteOrderMark, sourceFiles) { + host.writeFile(fileName, data, writeByteOrderMark, function (hostErrorMessage) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Could_not_write_file_0_Colon_1, fileName, hostErrorMessage)); + }, sourceFiles); + } + ts.writeFile = writeFile; + function getLineOfLocalPosition(currentSourceFile, pos) { + return ts.getLineAndCharacterOfPosition(currentSourceFile, pos).line; + } + ts.getLineOfLocalPosition = getLineOfLocalPosition; + function getLineOfLocalPositionFromLineMap(lineMap, pos) { + return ts.computeLineAndCharacterOfPosition(lineMap, pos).line; + } + ts.getLineOfLocalPositionFromLineMap = getLineOfLocalPositionFromLineMap; + function getFirstConstructorWithBody(node) { + return ts.forEach(node.members, function (member) { + if (member.kind === 148 && nodeIsPresent(member.body)) { + return member; + } + }); + } + ts.getFirstConstructorWithBody = getFirstConstructorWithBody; + function getSetAccessorTypeAnnotationNode(accessor) { + if (accessor && accessor.parameters.length > 0) { + var hasThis = accessor.parameters.length === 2 && + accessor.parameters[0].name.kind === 69 && + accessor.parameters[0].name.originalKeywordKind === 97; + return accessor.parameters[hasThis ? 1 : 0].type; + } + } + ts.getSetAccessorTypeAnnotationNode = getSetAccessorTypeAnnotationNode; + function getAllAccessorDeclarations(declarations, accessor) { + var firstAccessor; + var secondAccessor; + var getAccessor; + var setAccessor; + if (hasDynamicName(accessor)) { + firstAccessor = accessor; + if (accessor.kind === 149) { + getAccessor = accessor; + } + else if (accessor.kind === 150) { + setAccessor = accessor; + } + else { + ts.Debug.fail("Accessor has wrong kind"); + } + } + else { + ts.forEach(declarations, function (member) { + if ((member.kind === 149 || member.kind === 150) + && (member.flags & 32) === (accessor.flags & 32)) { + var memberName = getPropertyNameForPropertyNameNode(member.name); + var accessorName = getPropertyNameForPropertyNameNode(accessor.name); + if (memberName === accessorName) { + if (!firstAccessor) { + firstAccessor = member; + } + else if (!secondAccessor) { + secondAccessor = member; + } + if (member.kind === 149 && !getAccessor) { + getAccessor = member; + } + if (member.kind === 150 && !setAccessor) { + setAccessor = member; + } + } + } + }); + } + return { + firstAccessor: firstAccessor, + secondAccessor: secondAccessor, + getAccessor: getAccessor, + setAccessor: setAccessor + }; + } + ts.getAllAccessorDeclarations = getAllAccessorDeclarations; + function emitNewLineBeforeLeadingComments(lineMap, writer, node, leadingComments) { + if (leadingComments && leadingComments.length && node.pos !== leadingComments[0].pos && + getLineOfLocalPositionFromLineMap(lineMap, node.pos) !== getLineOfLocalPositionFromLineMap(lineMap, leadingComments[0].pos)) { + writer.writeLine(); + } + } + ts.emitNewLineBeforeLeadingComments = emitNewLineBeforeLeadingComments; + function emitComments(text, lineMap, writer, comments, trailingSeparator, newLine, writeComment) { + var emitLeadingSpace = !trailingSeparator; + ts.forEach(comments, function (comment) { + if (emitLeadingSpace) { + writer.write(" "); + emitLeadingSpace = false; + } + writeComment(text, lineMap, writer, comment, newLine); + if (comment.hasTrailingNewLine) { + writer.writeLine(); + } + else if (trailingSeparator) { + writer.write(" "); + } + else { + emitLeadingSpace = true; + } + }); + } + ts.emitComments = emitComments; + function emitDetachedComments(text, lineMap, writer, writeComment, node, newLine, removeComments) { + var leadingComments; + var currentDetachedCommentInfo; + if (removeComments) { + if (node.pos === 0) { + leadingComments = ts.filter(ts.getLeadingCommentRanges(text, node.pos), isPinnedComment); + } + } + else { + leadingComments = ts.getLeadingCommentRanges(text, node.pos); + } + if (leadingComments) { + var detachedComments = []; + var lastComment = void 0; + for (var _i = 0, leadingComments_1 = leadingComments; _i < leadingComments_1.length; _i++) { + var comment = leadingComments_1[_i]; + if (lastComment) { + var lastCommentLine = getLineOfLocalPositionFromLineMap(lineMap, lastComment.end); + var commentLine = getLineOfLocalPositionFromLineMap(lineMap, comment.pos); + if (commentLine >= lastCommentLine + 2) { + break; + } + } + detachedComments.push(comment); + lastComment = comment; + } + if (detachedComments.length) { + var lastCommentLine = getLineOfLocalPositionFromLineMap(lineMap, ts.lastOrUndefined(detachedComments).end); + var nodeLine = getLineOfLocalPositionFromLineMap(lineMap, ts.skipTrivia(text, node.pos)); + if (nodeLine >= lastCommentLine + 2) { + emitNewLineBeforeLeadingComments(lineMap, writer, node, leadingComments); + emitComments(text, lineMap, writer, detachedComments, true, newLine, writeComment); + currentDetachedCommentInfo = { nodePos: node.pos, detachedCommentEndPos: ts.lastOrUndefined(detachedComments).end }; + } + } + } + return currentDetachedCommentInfo; + function isPinnedComment(comment) { + return text.charCodeAt(comment.pos + 1) === 42 && + text.charCodeAt(comment.pos + 2) === 33; + } + } + ts.emitDetachedComments = emitDetachedComments; + function writeCommentRange(text, lineMap, writer, comment, newLine) { + if (text.charCodeAt(comment.pos + 1) === 42) { + var firstCommentLineAndCharacter = ts.computeLineAndCharacterOfPosition(lineMap, comment.pos); + var lineCount = lineMap.length; + var firstCommentLineIndent = void 0; + for (var pos = comment.pos, currentLine = firstCommentLineAndCharacter.line; pos < comment.end; currentLine++) { + var nextLineStart = (currentLine + 1) === lineCount + ? text.length + 1 + : lineMap[currentLine + 1]; + if (pos !== comment.pos) { + if (firstCommentLineIndent === undefined) { + firstCommentLineIndent = calculateIndent(text, lineMap[firstCommentLineAndCharacter.line], comment.pos); + } + var currentWriterIndentSpacing = writer.getIndent() * getIndentSize(); + var spacesToEmit = currentWriterIndentSpacing - firstCommentLineIndent + calculateIndent(text, pos, nextLineStart); + if (spacesToEmit > 0) { + var numberOfSingleSpacesToEmit = spacesToEmit % getIndentSize(); + var indentSizeSpaceString = getIndentString((spacesToEmit - numberOfSingleSpacesToEmit) / getIndentSize()); + writer.rawWrite(indentSizeSpaceString); + while (numberOfSingleSpacesToEmit) { + writer.rawWrite(" "); + numberOfSingleSpacesToEmit--; + } + } + else { + writer.rawWrite(""); + } + } + writeTrimmedCurrentLine(text, comment, writer, newLine, pos, nextLineStart); + pos = nextLineStart; + } + } + else { + writer.write(text.substring(comment.pos, comment.end)); + } + } + ts.writeCommentRange = writeCommentRange; + function writeTrimmedCurrentLine(text, comment, writer, newLine, pos, nextLineStart) { + var end = Math.min(comment.end, nextLineStart - 1); + var currentLineText = text.substring(pos, end).replace(/^\s+|\s+$/g, ""); + if (currentLineText) { + writer.write(currentLineText); + if (end !== comment.end) { + writer.writeLine(); + } + } + else { + writer.writeLiteral(newLine); + } + } + function calculateIndent(text, pos, end) { + var currentLineIndent = 0; + for (; pos < end && ts.isWhiteSpace(text.charCodeAt(pos)); pos++) { + if (text.charCodeAt(pos) === 9) { + currentLineIndent += getIndentSize() - (currentLineIndent % getIndentSize()); + } + else { + currentLineIndent++; + } + } + return currentLineIndent; + } + function modifierToFlag(token) { + switch (token) { + case 113: return 32; + case 112: return 4; + case 111: return 16; + case 110: return 8; + case 115: return 128; + case 82: return 1; + case 122: return 2; + case 74: return 2048; + case 77: return 512; + case 118: return 256; + case 128: return 64; + } + return 0; + } + ts.modifierToFlag = modifierToFlag; + function isLeftHandSideExpression(expr) { + if (expr) { + switch (expr.kind) { + case 172: + case 173: + case 175: + case 174: + case 196: + case 241: + case 242: + case 176: + case 170: + case 178: + case 171: + case 192: + case 179: + case 69: + case 10: + case 8: + case 9: + case 11: + case 189: + case 84: + case 93: + case 97: + case 99: + case 95: + return true; + } + } + return false; + } + ts.isLeftHandSideExpression = isLeftHandSideExpression; + function isAssignmentOperator(token) { + return token >= 56 && token <= 68; + } + ts.isAssignmentOperator = isAssignmentOperator; + function isExpressionWithTypeArgumentsInClassExtendsClause(node) { + return node.kind === 194 && + node.parent.token === 83 && + isClassLike(node.parent.parent); + } + ts.isExpressionWithTypeArgumentsInClassExtendsClause = isExpressionWithTypeArgumentsInClassExtendsClause; + function isSupportedExpressionWithTypeArguments(node) { + return isSupportedExpressionWithTypeArgumentsRest(node.expression); + } + ts.isSupportedExpressionWithTypeArguments = isSupportedExpressionWithTypeArguments; + function isSupportedExpressionWithTypeArgumentsRest(node) { + if (node.kind === 69) { + return true; + } + else if (isPropertyAccessExpression(node)) { + return isSupportedExpressionWithTypeArgumentsRest(node.expression); + } + else { + return false; + } + } + function isRightSideOfQualifiedNameOrPropertyAccess(node) { + return (node.parent.kind === 139 && node.parent.right === node) || + (node.parent.kind === 172 && node.parent.name === node); + } + ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess; + function isEmptyObjectLiteralOrArrayLiteral(expression) { + var kind = expression.kind; + if (kind === 171) { + return expression.properties.length === 0; + } + if (kind === 170) { + return expression.elements.length === 0; + } + return false; + } + ts.isEmptyObjectLiteralOrArrayLiteral = isEmptyObjectLiteralOrArrayLiteral; + function getLocalSymbolForExportDefault(symbol) { + return symbol && symbol.valueDeclaration && (symbol.valueDeclaration.flags & 512) ? symbol.valueDeclaration.localSymbol : undefined; + } + ts.getLocalSymbolForExportDefault = getLocalSymbolForExportDefault; + function hasJavaScriptFileExtension(fileName) { + return ts.forEach(ts.supportedJavascriptExtensions, function (extension) { return ts.fileExtensionIs(fileName, extension); }); + } + ts.hasJavaScriptFileExtension = hasJavaScriptFileExtension; + function getExpandedCharCodes(input) { + var output = []; + var length = input.length; + for (var i = 0; i < length; i++) { + var charCode = input.charCodeAt(i); + if (charCode < 0x80) { + output.push(charCode); + } + else if (charCode < 0x800) { + output.push((charCode >> 6) | 192); + output.push((charCode & 63) | 128); + } + else if (charCode < 0x10000) { + output.push((charCode >> 12) | 224); + output.push(((charCode >> 6) & 63) | 128); + output.push((charCode & 63) | 128); + } + else if (charCode < 0x20000) { + output.push((charCode >> 18) | 240); + output.push(((charCode >> 12) & 63) | 128); + output.push(((charCode >> 6) & 63) | 128); + output.push((charCode & 63) | 128); + } + else { + ts.Debug.assert(false, "Unexpected code point"); + } + } + return output; + } + ts.stringify = typeof JSON !== "undefined" && JSON.stringify + ? JSON.stringify + : stringifyFallback; + function stringifyFallback(value) { + return value === undefined ? undefined : stringifyValue(value); + } + function stringifyValue(value) { + return typeof value === "string" ? "\"" + escapeString(value) + "\"" + : typeof value === "number" ? isFinite(value) ? String(value) : "null" + : typeof value === "boolean" ? value ? "true" : "false" + : typeof value === "object" && value ? ts.isArray(value) ? cycleCheck(stringifyArray, value) : cycleCheck(stringifyObject, value) + : "null"; + } + function cycleCheck(cb, value) { + ts.Debug.assert(!value.hasOwnProperty("__cycle"), "Converting circular structure to JSON"); + value.__cycle = true; + var result = cb(value); + delete value.__cycle; + return result; + } + function stringifyArray(value) { + return "[" + ts.reduceLeft(value, stringifyElement, "") + "]"; + } + function stringifyElement(memo, value) { + return (memo ? memo + "," : memo) + stringifyValue(value); + } + function stringifyObject(value) { + return "{" + ts.reduceProperties(value, stringifyProperty, "") + "}"; + } + function stringifyProperty(memo, value, key) { + return value === undefined || typeof value === "function" || key === "__cycle" ? memo + : (memo ? memo + "," : memo) + ("\"" + escapeString(key) + "\":" + stringifyValue(value)); + } + var base64Digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; + function convertToBase64(input) { + var result = ""; + var charCodes = getExpandedCharCodes(input); + var i = 0; + var length = charCodes.length; + var byte1, byte2, byte3, byte4; + while (i < length) { + 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; + if (i + 1 >= length) { + byte3 = byte4 = 64; + } + else if (i + 2 >= length) { + byte4 = 64; + } + result += base64Digits.charAt(byte1) + base64Digits.charAt(byte2) + base64Digits.charAt(byte3) + base64Digits.charAt(byte4); + i += 3; + } + return result; + } + ts.convertToBase64 = convertToBase64; + function convertToRelativePath(absoluteOrRelativePath, basePath, getCanonicalFileName) { + return !ts.isRootedDiskPath(absoluteOrRelativePath) + ? absoluteOrRelativePath + : ts.getRelativePathToDirectoryOrUrl(basePath, absoluteOrRelativePath, basePath, getCanonicalFileName, false); + } + ts.convertToRelativePath = convertToRelativePath; + var carriageReturnLineFeed = "\r\n"; + var lineFeed = "\n"; + function getNewLineCharacter(options) { + if (options.newLine === 0) { + return carriageReturnLineFeed; + } + else if (options.newLine === 1) { + return lineFeed; + } + else if (ts.sys) { + return ts.sys.newLine; + } + return carriageReturnLineFeed; + } + ts.getNewLineCharacter = getNewLineCharacter; + function isWatchSet(options) { + return options.watch && options.hasOwnProperty("watch"); + } + ts.isWatchSet = isWatchSet; +})(ts || (ts = {})); +var ts; +(function (ts) { + function getDefaultLibFileName(options) { + return options.target === 2 ? "lib.es6.d.ts" : "lib.d.ts"; + } + ts.getDefaultLibFileName = getDefaultLibFileName; + function textSpanEnd(span) { + return span.start + span.length; + } + ts.textSpanEnd = textSpanEnd; + function textSpanIsEmpty(span) { + return span.length === 0; + } + ts.textSpanIsEmpty = textSpanIsEmpty; + function textSpanContainsPosition(span, position) { + return position >= span.start && position < textSpanEnd(span); + } + ts.textSpanContainsPosition = textSpanContainsPosition; + function textSpanContainsTextSpan(span, other) { + return other.start >= span.start && textSpanEnd(other) <= textSpanEnd(span); + } + ts.textSpanContainsTextSpan = textSpanContainsTextSpan; + function textSpanOverlapsWith(span, other) { + var overlapStart = Math.max(span.start, other.start); + var overlapEnd = Math.min(textSpanEnd(span), textSpanEnd(other)); + return overlapStart < overlapEnd; + } + ts.textSpanOverlapsWith = textSpanOverlapsWith; + function textSpanOverlap(span1, span2) { + var overlapStart = Math.max(span1.start, span2.start); + var overlapEnd = Math.min(textSpanEnd(span1), textSpanEnd(span2)); + if (overlapStart < overlapEnd) { + return createTextSpanFromBounds(overlapStart, overlapEnd); + } + return undefined; + } + ts.textSpanOverlap = textSpanOverlap; + function textSpanIntersectsWithTextSpan(span, other) { + return other.start <= textSpanEnd(span) && textSpanEnd(other) >= span.start; + } + ts.textSpanIntersectsWithTextSpan = textSpanIntersectsWithTextSpan; + function textSpanIntersectsWith(span, start, length) { + var end = start + length; + return start <= textSpanEnd(span) && end >= span.start; + } + ts.textSpanIntersectsWith = textSpanIntersectsWith; + function decodedTextSpanIntersectsWith(start1, length1, start2, length2) { + var end1 = start1 + length1; + var end2 = start2 + length2; + return start2 <= end1 && end2 >= start1; + } + ts.decodedTextSpanIntersectsWith = decodedTextSpanIntersectsWith; + function textSpanIntersectsWithPosition(span, position) { + return position <= textSpanEnd(span) && position >= span.start; + } + ts.textSpanIntersectsWithPosition = textSpanIntersectsWithPosition; + function textSpanIntersection(span1, span2) { + var intersectStart = Math.max(span1.start, span2.start); + var intersectEnd = Math.min(textSpanEnd(span1), textSpanEnd(span2)); + if (intersectStart <= intersectEnd) { + return createTextSpanFromBounds(intersectStart, intersectEnd); + } + return undefined; + } + ts.textSpanIntersection = textSpanIntersection; + function createTextSpan(start, length) { + if (start < 0) { + throw new Error("start < 0"); + } + if (length < 0) { + throw new Error("length < 0"); + } + return { start: start, length: length }; + } + ts.createTextSpan = createTextSpan; + function createTextSpanFromBounds(start, end) { + return createTextSpan(start, end - start); + } + ts.createTextSpanFromBounds = createTextSpanFromBounds; + function textChangeRangeNewSpan(range) { + return createTextSpan(range.span.start, range.newLength); + } + ts.textChangeRangeNewSpan = textChangeRangeNewSpan; + function textChangeRangeIsUnchanged(range) { + return textSpanIsEmpty(range.span) && range.newLength === 0; + } + ts.textChangeRangeIsUnchanged = textChangeRangeIsUnchanged; + function createTextChangeRange(span, newLength) { + if (newLength < 0) { + throw new Error("newLength < 0"); + } + return { span: span, newLength: newLength }; + } + ts.createTextChangeRange = createTextChangeRange; + ts.unchangedTextChangeRange = createTextChangeRange(createTextSpan(0, 0), 0); + function collapseTextChangeRangesAcrossMultipleVersions(changes) { + if (changes.length === 0) { + return ts.unchangedTextChangeRange; + } + if (changes.length === 1) { + return changes[0]; + } + 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]; + var oldStart1 = oldStartN; + var oldEnd1 = oldEndN; + var newEnd1 = newEndN; + var oldStart2 = nextChange.span.start; + var oldEnd2 = textSpanEnd(nextChange.span); + var newEnd2 = oldStart2 + nextChange.newLength; + oldStartN = Math.min(oldStart1, oldStart2); + oldEndN = Math.max(oldEnd1, oldEnd1 + (oldEnd2 - newEnd1)); + newEndN = Math.max(newEnd2, newEnd2 + (newEnd1 - oldEnd2)); + } + return createTextChangeRange(createTextSpanFromBounds(oldStartN, oldEndN), newEndN - oldStartN); + } + ts.collapseTextChangeRangesAcrossMultipleVersions = collapseTextChangeRangesAcrossMultipleVersions; + function getTypeParameterOwner(d) { + if (d && d.kind === 141) { + for (var current = d; current; current = current.parent) { + if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 222) { + return current; + } + } + } + } + ts.getTypeParameterOwner = getTypeParameterOwner; + function isParameterPropertyDeclaration(node) { + return node.flags & 92 && node.parent.kind === 148 && ts.isClassLike(node.parent.parent); + } + ts.isParameterPropertyDeclaration = isParameterPropertyDeclaration; + function startsWith(str, prefix) { + return str.lastIndexOf(prefix, 0) === 0; + } + ts.startsWith = startsWith; + function endsWith(str, suffix) { + var expectedPos = str.length - suffix.length; + return str.indexOf(suffix, expectedPos) === expectedPos; + } + ts.endsWith = endsWith; +})(ts || (ts = {})); +var ts; +(function (ts) { + ts.parseTime = 0; + var NodeConstructor; + var SourceFileConstructor; + function createNode(kind, pos, end) { + if (kind === 256) { + return new (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor()))(kind, pos, end); + } + else { + return new (NodeConstructor || (NodeConstructor = ts.objectAllocator.getNodeConstructor()))(kind, pos, end); + } + } + ts.createNode = createNode; + function visitNode(cbNode, node) { + if (node) { + return cbNode(node); + } + } + function visitNodeArray(cbNodes, nodes) { + if (nodes) { + return cbNodes(nodes); + } + } + function visitEachNode(cbNode, nodes) { + if (nodes) { + for (var _i = 0, nodes_1 = nodes; _i < nodes_1.length; _i++) { + var node = nodes_1[_i]; + var result = cbNode(node); + if (result) { + return result; + } + } + } + } + function forEachChild(node, cbNode, cbNodeArray) { + if (!node) { + return; + } + var visitNodes = cbNodeArray ? visitNodeArray : visitEachNode; + var cbNodes = cbNodeArray || cbNode; + switch (node.kind) { + case 139: + return visitNode(cbNode, node.left) || + visitNode(cbNode, node.right); + case 141: + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.constraint) || + visitNode(cbNode, node.expression); + case 254: + return visitNodes(cbNodes, node.decorators) || + visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.equalsToken) || + visitNode(cbNode, node.objectAssignmentInitializer); + case 142: + case 145: + case 144: + case 253: + case 218: + case 169: + return visitNodes(cbNodes, node.decorators) || + visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.propertyName) || + visitNode(cbNode, node.dotDotDotToken) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.initializer); + case 156: + case 157: + case 151: + case 152: + case 153: + return visitNodes(cbNodes, node.decorators) || + visitNodes(cbNodes, node.modifiers) || + visitNodes(cbNodes, node.typeParameters) || + visitNodes(cbNodes, node.parameters) || + visitNode(cbNode, node.type); + case 147: + case 146: + case 148: + case 149: + case 150: + case 179: + case 220: + case 180: + return visitNodes(cbNodes, node.decorators) || + visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNodes(cbNodes, node.typeParameters) || + visitNodes(cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.equalsGreaterThanToken) || + visitNode(cbNode, node.body); + case 155: + return visitNode(cbNode, node.typeName) || + visitNodes(cbNodes, node.typeArguments); + case 154: + return visitNode(cbNode, node.parameterName) || + visitNode(cbNode, node.type); + case 158: + return visitNode(cbNode, node.exprName); + case 159: + return visitNodes(cbNodes, node.members); + case 160: + return visitNode(cbNode, node.elementType); + case 161: + return visitNodes(cbNodes, node.elementTypes); + case 162: + case 163: + return visitNodes(cbNodes, node.types); + case 164: + return visitNode(cbNode, node.type); + case 167: + case 168: + return visitNodes(cbNodes, node.elements); + case 170: + return visitNodes(cbNodes, node.elements); + case 171: + return visitNodes(cbNodes, node.properties); + case 172: + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.dotToken) || + visitNode(cbNode, node.name); + case 173: + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.argumentExpression); + case 174: + case 175: + return visitNode(cbNode, node.expression) || + visitNodes(cbNodes, node.typeArguments) || + visitNodes(cbNodes, node.arguments); + case 176: + return visitNode(cbNode, node.tag) || + visitNode(cbNode, node.template); + case 177: + return visitNode(cbNode, node.type) || + visitNode(cbNode, node.expression); + case 178: + return visitNode(cbNode, node.expression); + case 181: + return visitNode(cbNode, node.expression); + case 182: + return visitNode(cbNode, node.expression); + case 183: + return visitNode(cbNode, node.expression); + case 185: + return visitNode(cbNode, node.operand); + case 190: + return visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.expression); + case 184: + return visitNode(cbNode, node.expression); + case 186: + return visitNode(cbNode, node.operand); + case 187: + return visitNode(cbNode, node.left) || + visitNode(cbNode, node.operatorToken) || + visitNode(cbNode, node.right); + case 195: + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.type); + case 196: + return visitNode(cbNode, node.expression); + case 188: + return visitNode(cbNode, node.condition) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.whenTrue) || + visitNode(cbNode, node.colonToken) || + visitNode(cbNode, node.whenFalse); + case 191: + return visitNode(cbNode, node.expression); + case 199: + case 226: + return visitNodes(cbNodes, node.statements); + case 256: + return visitNodes(cbNodes, node.statements) || + visitNode(cbNode, node.endOfFileToken); + case 200: + return visitNodes(cbNodes, node.decorators) || + visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.declarationList); + case 219: + return visitNodes(cbNodes, node.declarations); + case 202: + return visitNode(cbNode, node.expression); + case 203: + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.thenStatement) || + visitNode(cbNode, node.elseStatement); + case 204: + return visitNode(cbNode, node.statement) || + visitNode(cbNode, node.expression); + case 205: + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + case 206: + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.condition) || + visitNode(cbNode, node.incrementor) || + visitNode(cbNode, node.statement); + case 207: + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + case 208: + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + case 209: + case 210: + return visitNode(cbNode, node.label); + case 211: + return visitNode(cbNode, node.expression); + case 212: + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + case 213: + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.caseBlock); + case 227: + return visitNodes(cbNodes, node.clauses); + case 249: + return visitNode(cbNode, node.expression) || + visitNodes(cbNodes, node.statements); + case 250: + return visitNodes(cbNodes, node.statements); + case 214: + return visitNode(cbNode, node.label) || + visitNode(cbNode, node.statement); + case 215: + return visitNode(cbNode, node.expression); + case 216: + return visitNode(cbNode, node.tryBlock) || + visitNode(cbNode, node.catchClause) || + visitNode(cbNode, node.finallyBlock); + case 252: + return visitNode(cbNode, node.variableDeclaration) || + visitNode(cbNode, node.block); + case 143: + return visitNode(cbNode, node.expression); + case 221: + case 192: + return visitNodes(cbNodes, node.decorators) || + visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNodes, node.typeParameters) || + visitNodes(cbNodes, node.heritageClauses) || + visitNodes(cbNodes, node.members); + case 222: + return visitNodes(cbNodes, node.decorators) || + visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNodes, node.typeParameters) || + visitNodes(cbNodes, node.heritageClauses) || + visitNodes(cbNodes, node.members); + case 223: + return visitNodes(cbNodes, node.decorators) || + visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNodes, node.typeParameters) || + visitNode(cbNode, node.type); + case 224: + return visitNodes(cbNodes, node.decorators) || + visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNodes, node.members); + case 255: + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.initializer); + case 225: + return visitNodes(cbNodes, node.decorators) || + visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.body); + case 229: + return visitNodes(cbNodes, node.decorators) || + visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.moduleReference); + case 230: + return visitNodes(cbNodes, node.decorators) || + visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.importClause) || + visitNode(cbNode, node.moduleSpecifier); + case 231: + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.namedBindings); + case 228: + return visitNode(cbNode, node.name); + case 232: + return visitNode(cbNode, node.name); + case 233: + case 237: + return visitNodes(cbNodes, node.elements); + case 236: + return visitNodes(cbNodes, node.decorators) || + visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.exportClause) || + visitNode(cbNode, node.moduleSpecifier); + case 234: + case 238: + return visitNode(cbNode, node.propertyName) || + visitNode(cbNode, node.name); + case 235: + return visitNodes(cbNodes, node.decorators) || + visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.expression); + case 189: + return visitNode(cbNode, node.head) || visitNodes(cbNodes, node.templateSpans); + case 197: + return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal); + case 140: + return visitNode(cbNode, node.expression); + case 251: + return visitNodes(cbNodes, node.types); + case 194: + return visitNode(cbNode, node.expression) || + visitNodes(cbNodes, node.typeArguments); + case 240: + return visitNode(cbNode, node.expression); + case 239: + return visitNodes(cbNodes, node.decorators); + case 241: + return visitNode(cbNode, node.openingElement) || + visitNodes(cbNodes, node.children) || + visitNode(cbNode, node.closingElement); + case 242: + case 243: + return visitNode(cbNode, node.tagName) || + visitNodes(cbNodes, node.attributes); + case 246: + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.initializer); + case 247: + return visitNode(cbNode, node.expression); + case 248: + return visitNode(cbNode, node.expression); + case 245: + return visitNode(cbNode, node.tagName); + case 257: + return visitNode(cbNode, node.type); + case 261: + return visitNodes(cbNodes, node.types); + case 262: + return visitNodes(cbNodes, node.types); + case 260: + return visitNode(cbNode, node.elementType); + case 264: + return visitNode(cbNode, node.type); + case 263: + return visitNode(cbNode, node.type); + case 265: + return visitNodes(cbNodes, node.members); + case 267: + return visitNode(cbNode, node.name) || + visitNodes(cbNodes, node.typeArguments); + case 268: + return visitNode(cbNode, node.type); + case 269: + return visitNodes(cbNodes, node.parameters) || + visitNode(cbNode, node.type); + case 270: + return visitNode(cbNode, node.type); + case 271: + return visitNode(cbNode, node.type); + case 272: + return visitNode(cbNode, node.type); + case 266: + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.type); + case 273: + return visitNodes(cbNodes, node.tags); + case 275: + return visitNode(cbNode, node.preParameterName) || + visitNode(cbNode, node.typeExpression) || + visitNode(cbNode, node.postParameterName); + case 276: + return visitNode(cbNode, node.typeExpression); + case 277: + return visitNode(cbNode, node.typeExpression); + case 278: + return visitNodes(cbNodes, node.typeParameters); + } + } + ts.forEachChild = forEachChild; + function createSourceFile(fileName, sourceText, languageVersion, setParentNodes, scriptKind) { + if (setParentNodes === void 0) { setParentNodes = false; } + var start = new Date().getTime(); + var result = Parser.parseSourceFile(fileName, sourceText, languageVersion, undefined, setParentNodes, scriptKind); + ts.parseTime += new Date().getTime() - start; + return result; + } + ts.createSourceFile = createSourceFile; + function isExternalModule(file) { + return file.externalModuleIndicator !== undefined; + } + ts.isExternalModule = isExternalModule; + function updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks) { + return IncrementalParser.updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks); + } + ts.updateSourceFile = updateSourceFile; + function parseIsolatedJSDocComment(content, start, length) { + return Parser.JSDocParser.parseIsolatedJSDocComment(content, start, length); + } + ts.parseIsolatedJSDocComment = parseIsolatedJSDocComment; + function parseJSDocTypeExpressionForTests(content, start, length) { + return Parser.JSDocParser.parseJSDocTypeExpressionForTests(content, start, length); + } + ts.parseJSDocTypeExpressionForTests = parseJSDocTypeExpressionForTests; + var Parser; + (function (Parser) { + var scanner = ts.createScanner(2, true); + var disallowInAndDecoratorContext = 4194304 | 16777216; + var NodeConstructor; + var SourceFileConstructor; + var sourceFile; + var parseDiagnostics; + var syntaxCursor; + var token; + var sourceText; + var nodeCount; + var identifiers; + var identifierCount; + var parsingContext; + var contextFlags; + var parseErrorBeforeNextFinishedNode = false; + function parseSourceFile(fileName, _sourceText, languageVersion, _syntaxCursor, setParentNodes, scriptKind) { + scriptKind = ts.ensureScriptKind(fileName, scriptKind); + initializeState(fileName, _sourceText, languageVersion, _syntaxCursor, scriptKind); + var result = parseSourceFileWorker(fileName, languageVersion, setParentNodes, scriptKind); + clearState(); + return result; + } + Parser.parseSourceFile = parseSourceFile; + function getLanguageVariant(scriptKind) { + return scriptKind === 4 || scriptKind === 2 || scriptKind === 1 ? 1 : 0; + } + function initializeState(fileName, _sourceText, languageVersion, _syntaxCursor, scriptKind) { + NodeConstructor = ts.objectAllocator.getNodeConstructor(); + SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor(); + sourceText = _sourceText; + syntaxCursor = _syntaxCursor; + parseDiagnostics = []; + parsingContext = 0; + identifiers = {}; + identifierCount = 0; + nodeCount = 0; + contextFlags = scriptKind === 1 || scriptKind === 2 ? 134217728 : 0; + parseErrorBeforeNextFinishedNode = false; + scanner.setText(sourceText); + scanner.setOnError(scanError); + scanner.setScriptTarget(languageVersion); + scanner.setLanguageVariant(getLanguageVariant(scriptKind)); + } + function clearState() { + scanner.setText(""); + scanner.setOnError(undefined); + parseDiagnostics = undefined; + sourceFile = undefined; + identifiers = undefined; + syntaxCursor = undefined; + sourceText = undefined; + } + function parseSourceFileWorker(fileName, languageVersion, setParentNodes, scriptKind) { + sourceFile = createSourceFile(fileName, languageVersion, scriptKind); + sourceFile.flags = contextFlags; + token = nextToken(); + processReferenceComments(sourceFile); + sourceFile.statements = parseList(0, parseStatement); + ts.Debug.assert(token === 1); + sourceFile.endOfFileToken = parseTokenNode(); + setExternalModuleIndicator(sourceFile); + sourceFile.nodeCount = nodeCount; + sourceFile.identifierCount = identifierCount; + sourceFile.identifiers = identifiers; + sourceFile.parseDiagnostics = parseDiagnostics; + if (setParentNodes) { + fixupParentReferences(sourceFile); + } + return sourceFile; + } + function addJSDocComment(node) { + if (contextFlags & 134217728) { + var comments = ts.getLeadingCommentRangesOfNode(node, sourceFile); + if (comments) { + for (var _i = 0, comments_1 = comments; _i < comments_1.length; _i++) { + var comment = comments_1[_i]; + var jsDocComment = JSDocParser.parseJSDocComment(node, comment.pos, comment.end - comment.pos); + if (jsDocComment) { + node.jsDocComment = jsDocComment; + } + } + } + } + return node; + } + function fixupParentReferences(sourceFile) { + var parent = sourceFile; + forEachChild(sourceFile, visitNode); + return; + function visitNode(n) { + if (n.parent !== parent) { + n.parent = parent; + var saveParent = parent; + parent = n; + forEachChild(n, visitNode); + parent = saveParent; + } + } + } + Parser.fixupParentReferences = fixupParentReferences; + function createSourceFile(fileName, languageVersion, scriptKind) { + var sourceFile = new SourceFileConstructor(256, 0, sourceText.length); + nodeCount++; + sourceFile.text = sourceText; + sourceFile.bindDiagnostics = []; + sourceFile.languageVersion = languageVersion; + sourceFile.fileName = ts.normalizePath(fileName); + sourceFile.languageVariant = getLanguageVariant(scriptKind); + sourceFile.isDeclarationFile = ts.fileExtensionIs(sourceFile.fileName, ".d.ts"); + sourceFile.scriptKind = scriptKind; + return sourceFile; + } + function setContextFlag(val, flag) { + if (val) { + contextFlags |= flag; + } + else { + contextFlags &= ~flag; + } + } + function setDisallowInContext(val) { + setContextFlag(val, 4194304); + } + function setYieldContext(val) { + setContextFlag(val, 8388608); + } + function setDecoratorContext(val) { + setContextFlag(val, 16777216); + } + function setAwaitContext(val) { + setContextFlag(val, 33554432); + } + function doOutsideOfContext(context, func) { + var contextFlagsToClear = context & contextFlags; + if (contextFlagsToClear) { + setContextFlag(false, contextFlagsToClear); + var result = func(); + setContextFlag(true, contextFlagsToClear); + return result; + } + return func(); + } + function doInsideOfContext(context, func) { + var contextFlagsToSet = context & ~contextFlags; + if (contextFlagsToSet) { + setContextFlag(true, contextFlagsToSet); + var result = func(); + setContextFlag(false, contextFlagsToSet); + return result; + } + return func(); + } + function allowInAnd(func) { + return doOutsideOfContext(4194304, func); + } + function disallowInAnd(func) { + return doInsideOfContext(4194304, func); + } + function doInYieldContext(func) { + return doInsideOfContext(8388608, func); + } + function doInDecoratorContext(func) { + return doInsideOfContext(16777216, func); + } + function doInAwaitContext(func) { + return doInsideOfContext(33554432, func); + } + function doOutsideOfAwaitContext(func) { + return doOutsideOfContext(33554432, func); + } + function doInYieldAndAwaitContext(func) { + return doInsideOfContext(8388608 | 33554432, func); + } + function inContext(flags) { + return (contextFlags & flags) !== 0; + } + function inYieldContext() { + return inContext(8388608); + } + function inDisallowInContext() { + return inContext(4194304); + } + function inDecoratorContext() { + return inContext(16777216); + } + function inAwaitContext() { + return inContext(33554432); + } + function parseErrorAtCurrentToken(message, arg0) { + var start = scanner.getTokenPos(); + var length = scanner.getTextPos() - start; + parseErrorAtPosition(start, length, message, arg0); + } + function parseErrorAtPosition(start, length, message, arg0) { + var lastError = ts.lastOrUndefined(parseDiagnostics); + if (!lastError || start !== lastError.start) { + parseDiagnostics.push(ts.createFileDiagnostic(sourceFile, start, length, message, arg0)); + } + parseErrorBeforeNextFinishedNode = true; + } + function scanError(message, length) { + var pos = scanner.getTextPos(); + parseErrorAtPosition(pos, length || 0, message); + } + function getNodePos() { + return scanner.getStartPos(); + } + function getNodeEnd() { + return scanner.getStartPos(); + } + function nextToken() { + return token = scanner.scan(); + } + function reScanGreaterToken() { + return token = scanner.reScanGreaterToken(); + } + function reScanSlashToken() { + return token = scanner.reScanSlashToken(); + } + function reScanTemplateToken() { + return token = scanner.reScanTemplateToken(); + } + function scanJsxIdentifier() { + return token = scanner.scanJsxIdentifier(); + } + function scanJsxText() { + return token = scanner.scanJsxToken(); + } + function speculationHelper(callback, isLookAhead) { + var saveToken = token; + var saveParseDiagnosticsLength = parseDiagnostics.length; + var saveParseErrorBeforeNextFinishedNode = parseErrorBeforeNextFinishedNode; + var saveContextFlags = contextFlags; + var result = isLookAhead + ? scanner.lookAhead(callback) + : scanner.tryScan(callback); + ts.Debug.assert(saveContextFlags === contextFlags); + if (!result || isLookAhead) { + token = saveToken; + parseDiagnostics.length = saveParseDiagnosticsLength; + parseErrorBeforeNextFinishedNode = saveParseErrorBeforeNextFinishedNode; + } + return result; + } + function lookAhead(callback) { + return speculationHelper(callback, true); + } + function tryParse(callback) { + return speculationHelper(callback, false); + } + function isIdentifier() { + if (token === 69) { + return true; + } + if (token === 114 && inYieldContext()) { + return false; + } + if (token === 119 && inAwaitContext()) { + return false; + } + return token > 105; + } + function parseExpected(kind, diagnosticMessage, shouldAdvance) { + if (shouldAdvance === void 0) { shouldAdvance = true; } + if (token === kind) { + if (shouldAdvance) { + nextToken(); + } + return true; + } + if (diagnosticMessage) { + parseErrorAtCurrentToken(diagnosticMessage); + } + else { + parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(kind)); + } + return false; + } + function parseOptional(t) { + if (token === t) { + nextToken(); + return true; + } + return false; + } + function parseOptionalToken(t) { + if (token === t) { + return parseTokenNode(); + } + return undefined; + } + function parseExpectedToken(t, reportAtCurrentPosition, diagnosticMessage, arg0) { + return parseOptionalToken(t) || + createMissingNode(t, reportAtCurrentPosition, diagnosticMessage, arg0); + } + function parseTokenNode() { + var node = createNode(token); + nextToken(); + return finishNode(node); + } + function canParseSemicolon() { + if (token === 23) { + return true; + } + return token === 16 || token === 1 || scanner.hasPrecedingLineBreak(); + } + function parseSemicolon() { + if (canParseSemicolon()) { + if (token === 23) { + nextToken(); + } + return true; + } + else { + return parseExpected(23); + } + } + function createNode(kind, pos) { + nodeCount++; + if (!(pos >= 0)) { + pos = scanner.getStartPos(); + } + return new NodeConstructor(kind, pos, pos); + } + function finishNode(node, end) { + node.end = end === undefined ? scanner.getStartPos() : end; + if (contextFlags) { + node.flags |= contextFlags; + } + if (parseErrorBeforeNextFinishedNode) { + parseErrorBeforeNextFinishedNode = false; + node.flags |= 67108864; + } + return node; + } + function createMissingNode(kind, reportAtCurrentPosition, diagnosticMessage, arg0) { + if (reportAtCurrentPosition) { + parseErrorAtPosition(scanner.getStartPos(), 0, diagnosticMessage, arg0); + } + else { + parseErrorAtCurrentToken(diagnosticMessage, arg0); + } + var result = createNode(kind, scanner.getStartPos()); + result.text = ""; + return finishNode(result); + } + function internIdentifier(text) { + text = ts.escapeIdentifier(text); + return ts.hasProperty(identifiers, text) ? identifiers[text] : (identifiers[text] = text); + } + function createIdentifier(isIdentifier, diagnosticMessage) { + identifierCount++; + if (isIdentifier) { + var node = createNode(69); + if (token !== 69) { + node.originalKeywordKind = token; + } + node.text = internIdentifier(scanner.getTokenValue()); + nextToken(); + return finishNode(node); + } + return createMissingNode(69, false, diagnosticMessage || ts.Diagnostics.Identifier_expected); + } + function parseIdentifier(diagnosticMessage) { + return createIdentifier(isIdentifier(), diagnosticMessage); + } + function parseIdentifierName() { + return createIdentifier(ts.tokenIsIdentifierOrKeyword(token)); + } + function isLiteralPropertyName() { + return ts.tokenIsIdentifierOrKeyword(token) || + token === 9 || + token === 8; + } + function parsePropertyNameWorker(allowComputedPropertyNames) { + if (token === 9 || token === 8) { + return parseLiteralNode(true); + } + if (allowComputedPropertyNames && token === 19) { + return parseComputedPropertyName(); + } + return parseIdentifierName(); + } + function parsePropertyName() { + return parsePropertyNameWorker(true); + } + function parseSimplePropertyName() { + return parsePropertyNameWorker(false); + } + function isSimplePropertyName() { + return token === 9 || token === 8 || ts.tokenIsIdentifierOrKeyword(token); + } + function parseComputedPropertyName() { + var node = createNode(140); + parseExpected(19); + node.expression = allowInAnd(parseExpression); + parseExpected(20); + return finishNode(node); + } + function parseContextualModifier(t) { + return token === t && tryParse(nextTokenCanFollowModifier); + } + function nextTokenIsOnSameLineAndCanFollowModifier() { + nextToken(); + if (scanner.hasPrecedingLineBreak()) { + return false; + } + return canFollowModifier(); + } + function nextTokenCanFollowModifier() { + if (token === 74) { + return nextToken() === 81; + } + if (token === 82) { + nextToken(); + if (token === 77) { + return lookAhead(nextTokenIsClassOrFunction); + } + return token !== 37 && token !== 116 && token !== 15 && canFollowModifier(); + } + if (token === 77) { + return nextTokenIsClassOrFunction(); + } + if (token === 113) { + nextToken(); + return canFollowModifier(); + } + return nextTokenIsOnSameLineAndCanFollowModifier(); + } + function parseAnyContextualModifier() { + return ts.isModifierKind(token) && tryParse(nextTokenCanFollowModifier); + } + function canFollowModifier() { + return token === 19 + || token === 15 + || token === 37 + || isLiteralPropertyName(); + } + function nextTokenIsClassOrFunction() { + nextToken(); + return token === 73 || token === 87; + } + function isListElement(parsingContext, inErrorRecovery) { + var node = currentNode(parsingContext); + if (node) { + return true; + } + switch (parsingContext) { + case 0: + case 1: + case 3: + return !(token === 23 && inErrorRecovery) && isStartOfStatement(); + case 2: + return token === 71 || token === 77; + case 4: + return lookAhead(isTypeMemberStart); + case 5: + return lookAhead(isClassMemberStart) || (token === 23 && !inErrorRecovery); + case 6: + return token === 19 || isLiteralPropertyName(); + case 12: + return token === 19 || token === 37 || isLiteralPropertyName(); + case 9: + return token === 19 || isLiteralPropertyName(); + case 7: + if (token === 15) { + return lookAhead(isValidHeritageClauseObjectLiteral); + } + if (!inErrorRecovery) { + return isStartOfLeftHandSideExpression() && !isHeritageClauseExtendsOrImplementsKeyword(); + } + else { + return isIdentifier() && !isHeritageClauseExtendsOrImplementsKeyword(); + } + case 8: + return isIdentifierOrPattern(); + case 10: + return token === 24 || token === 22 || isIdentifierOrPattern(); + case 17: + return isIdentifier(); + case 11: + case 15: + return token === 24 || token === 22 || isStartOfExpression(); + case 16: + return isStartOfParameter(); + case 18: + case 19: + return token === 24 || isStartOfType(); + case 20: + return isHeritageClause(); + case 21: + return ts.tokenIsIdentifierOrKeyword(token); + case 13: + return ts.tokenIsIdentifierOrKeyword(token) || token === 15; + case 14: + return true; + case 22: + case 23: + case 25: + return JSDocParser.isJSDocType(); + case 24: + return isSimplePropertyName(); + } + ts.Debug.fail("Non-exhaustive case in 'isListElement'."); + } + function isValidHeritageClauseObjectLiteral() { + ts.Debug.assert(token === 15); + if (nextToken() === 16) { + var next = nextToken(); + return next === 24 || next === 15 || next === 83 || next === 106; + } + return true; + } + function nextTokenIsIdentifier() { + nextToken(); + return isIdentifier(); + } + function nextTokenIsIdentifierOrKeyword() { + nextToken(); + return ts.tokenIsIdentifierOrKeyword(token); + } + function isHeritageClauseExtendsOrImplementsKeyword() { + if (token === 106 || + token === 83) { + return lookAhead(nextTokenIsStartOfExpression); + } + return false; + } + function nextTokenIsStartOfExpression() { + nextToken(); + return isStartOfExpression(); + } + function isListTerminator(kind) { + if (token === 1) { + return true; + } + switch (kind) { + case 1: + case 2: + case 4: + case 5: + case 6: + case 12: + case 9: + case 21: + return token === 16; + case 3: + return token === 16 || token === 71 || token === 77; + case 7: + return token === 15 || token === 83 || token === 106; + case 8: + return isVariableDeclaratorListTerminator(); + case 17: + return token === 27 || token === 17 || token === 15 || token === 83 || token === 106; + case 11: + return token === 18 || token === 23; + case 15: + case 19: + case 10: + return token === 20; + case 16: + return token === 18 || token === 20; + case 18: + return token === 27 || token === 17; + case 20: + return token === 15 || token === 16; + case 13: + return token === 27 || token === 39; + case 14: + return token === 25 && lookAhead(nextTokenIsSlash); + case 22: + return token === 18 || token === 54 || token === 16; + case 23: + return token === 27 || token === 16; + case 25: + return token === 20 || token === 16; + case 24: + return token === 16; + } + } + function isVariableDeclaratorListTerminator() { + if (canParseSemicolon()) { + return true; + } + if (isInOrOfKeyword(token)) { + return true; + } + if (token === 34) { + return true; + } + return false; + } + function isInSomeParsingContext() { + for (var kind = 0; kind < 26; kind++) { + if (parsingContext & (1 << kind)) { + if (isListElement(kind, true) || isListTerminator(kind)) { + return true; + } + } + } + return false; + } + function parseList(kind, parseElement) { + var saveParsingContext = parsingContext; + parsingContext |= 1 << kind; + var result = []; + result.pos = getNodePos(); + while (!isListTerminator(kind)) { + if (isListElement(kind, false)) { + var element = parseListElement(kind, parseElement); + result.push(element); + continue; + } + if (abortParsingListOrMoveToNextToken(kind)) { + break; + } + } + result.end = getNodeEnd(); + parsingContext = saveParsingContext; + return result; + } + function parseListElement(parsingContext, parseElement) { + var node = currentNode(parsingContext); + if (node) { + return consumeNode(node); + } + return parseElement(); + } + function currentNode(parsingContext) { + if (parseErrorBeforeNextFinishedNode) { + return undefined; + } + if (!syntaxCursor) { + return undefined; + } + var node = syntaxCursor.currentNode(scanner.getStartPos()); + if (ts.nodeIsMissing(node)) { + return undefined; + } + if (node.intersectsChange) { + return undefined; + } + if (ts.containsParseError(node)) { + return undefined; + } + var nodeContextFlags = node.flags & 197132288; + if (nodeContextFlags !== contextFlags) { + return undefined; + } + if (!canReuseNode(node, parsingContext)) { + return undefined; + } + return node; + } + function consumeNode(node) { + scanner.setTextPos(node.end); + nextToken(); + return node; + } + function canReuseNode(node, parsingContext) { + switch (parsingContext) { + case 5: + return isReusableClassMember(node); + case 2: + return isReusableSwitchClause(node); + case 0: + case 1: + case 3: + return isReusableStatement(node); + case 6: + return isReusableEnumMember(node); + case 4: + return isReusableTypeMember(node); + case 8: + return isReusableVariableDeclaration(node); + case 16: + return isReusableParameter(node); + case 20: + case 17: + case 19: + case 18: + case 11: + case 12: + case 7: + case 13: + case 14: + } + return false; + } + function isReusableClassMember(node) { + if (node) { + switch (node.kind) { + case 148: + case 153: + case 149: + case 150: + case 145: + case 198: + return true; + case 147: + var methodDeclaration = node; + var nameIsConstructor = methodDeclaration.name.kind === 69 && + methodDeclaration.name.originalKeywordKind === 121; + return !nameIsConstructor; + } + } + return false; + } + function isReusableSwitchClause(node) { + if (node) { + switch (node.kind) { + case 249: + case 250: + return true; + } + } + return false; + } + function isReusableStatement(node) { + if (node) { + switch (node.kind) { + case 220: + case 200: + case 199: + case 203: + case 202: + case 215: + case 211: + case 213: + case 210: + case 209: + case 207: + case 208: + case 206: + case 205: + case 212: + case 201: + case 216: + case 214: + case 204: + case 217: + case 230: + case 229: + case 236: + case 235: + case 225: + case 221: + case 222: + case 224: + case 223: + return true; + } + } + return false; + } + function isReusableEnumMember(node) { + return node.kind === 255; + } + function isReusableTypeMember(node) { + if (node) { + switch (node.kind) { + case 152: + case 146: + case 153: + case 144: + case 151: + return true; + } + } + return false; + } + function isReusableVariableDeclaration(node) { + if (node.kind !== 218) { + return false; + } + var variableDeclarator = node; + return variableDeclarator.initializer === undefined; + } + function isReusableParameter(node) { + if (node.kind !== 142) { + return false; + } + var parameter = node; + return parameter.initializer === undefined; + } + function abortParsingListOrMoveToNextToken(kind) { + parseErrorAtCurrentToken(parsingContextErrors(kind)); + if (isInSomeParsingContext()) { + return true; + } + nextToken(); + return false; + } + function parsingContextErrors(context) { + switch (context) { + case 0: return ts.Diagnostics.Declaration_or_statement_expected; + case 1: return ts.Diagnostics.Declaration_or_statement_expected; + case 2: return ts.Diagnostics.case_or_default_expected; + case 3: return ts.Diagnostics.Statement_expected; + case 4: return ts.Diagnostics.Property_or_signature_expected; + case 5: return ts.Diagnostics.Unexpected_token_A_constructor_method_accessor_or_property_was_expected; + case 6: return ts.Diagnostics.Enum_member_expected; + case 7: return ts.Diagnostics.Expression_expected; + case 8: return ts.Diagnostics.Variable_declaration_expected; + case 9: return ts.Diagnostics.Property_destructuring_pattern_expected; + case 10: return ts.Diagnostics.Array_element_destructuring_pattern_expected; + case 11: return ts.Diagnostics.Argument_expression_expected; + case 12: return ts.Diagnostics.Property_assignment_expected; + case 15: return ts.Diagnostics.Expression_or_comma_expected; + case 16: return ts.Diagnostics.Parameter_declaration_expected; + case 17: return ts.Diagnostics.Type_parameter_declaration_expected; + case 18: return ts.Diagnostics.Type_argument_expected; + case 19: return ts.Diagnostics.Type_expected; + case 20: return ts.Diagnostics.Unexpected_token_expected; + case 21: return ts.Diagnostics.Identifier_expected; + case 13: return ts.Diagnostics.Identifier_expected; + case 14: return ts.Diagnostics.Identifier_expected; + case 22: return ts.Diagnostics.Parameter_declaration_expected; + case 23: return ts.Diagnostics.Type_argument_expected; + case 25: return ts.Diagnostics.Type_expected; + case 24: return ts.Diagnostics.Property_assignment_expected; + } + } + ; + function parseDelimitedList(kind, parseElement, considerSemicolonAsDelimiter) { + var saveParsingContext = parsingContext; + parsingContext |= 1 << kind; + var result = []; + result.pos = getNodePos(); + var commaStart = -1; + while (true) { + if (isListElement(kind, false)) { + result.push(parseListElement(kind, parseElement)); + commaStart = scanner.getTokenPos(); + if (parseOptional(24)) { + continue; + } + commaStart = -1; + if (isListTerminator(kind)) { + break; + } + parseExpected(24); + if (considerSemicolonAsDelimiter && token === 23 && !scanner.hasPrecedingLineBreak()) { + nextToken(); + } + continue; + } + if (isListTerminator(kind)) { + break; + } + if (abortParsingListOrMoveToNextToken(kind)) { + break; + } + } + if (commaStart >= 0) { + result.hasTrailingComma = true; + } + result.end = getNodeEnd(); + parsingContext = saveParsingContext; + return result; + } + function createMissingList() { + var pos = getNodePos(); + var result = []; + result.pos = pos; + result.end = pos; + return result; + } + function parseBracketedList(kind, parseElement, open, close) { + if (parseExpected(open)) { + var result = parseDelimitedList(kind, parseElement); + parseExpected(close); + return result; + } + return createMissingList(); + } + function parseEntityName(allowReservedWords, diagnosticMessage) { + var entity = parseIdentifier(diagnosticMessage); + while (parseOptional(21)) { + var node = createNode(139, entity.pos); + node.left = entity; + node.right = parseRightSideOfDot(allowReservedWords); + entity = finishNode(node); + } + return entity; + } + function parseRightSideOfDot(allowIdentifierNames) { + if (scanner.hasPrecedingLineBreak() && ts.tokenIsIdentifierOrKeyword(token)) { + var matchesPattern = lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine); + if (matchesPattern) { + return createMissingNode(69, true, ts.Diagnostics.Identifier_expected); + } + } + return allowIdentifierNames ? parseIdentifierName() : parseIdentifier(); + } + function parseTemplateExpression() { + var template = createNode(189); + template.head = parseTemplateLiteralFragment(); + ts.Debug.assert(template.head.kind === 12, "Template head has wrong token kind"); + var templateSpans = []; + templateSpans.pos = getNodePos(); + do { + templateSpans.push(parseTemplateSpan()); + } while (ts.lastOrUndefined(templateSpans).literal.kind === 13); + templateSpans.end = getNodeEnd(); + template.templateSpans = templateSpans; + return finishNode(template); + } + function parseTemplateSpan() { + var span = createNode(197); + span.expression = allowInAnd(parseExpression); + var literal; + if (token === 16) { + reScanTemplateToken(); + literal = parseTemplateLiteralFragment(); + } + else { + literal = parseExpectedToken(14, false, ts.Diagnostics._0_expected, ts.tokenToString(16)); + } + span.literal = literal; + return finishNode(span); + } + function parseStringLiteralTypeNode() { + return parseLiteralLikeNode(166, true); + } + function parseLiteralNode(internName) { + return parseLiteralLikeNode(token, internName); + } + function parseTemplateLiteralFragment() { + return parseLiteralLikeNode(token, false); + } + function parseLiteralLikeNode(kind, internName) { + var node = createNode(kind); + var text = scanner.getTokenValue(); + node.text = internName ? internIdentifier(text) : text; + if (scanner.hasExtendedUnicodeEscape()) { + node.hasExtendedUnicodeEscape = true; + } + if (scanner.isUnterminated()) { + node.isUnterminated = true; + } + var tokenPos = scanner.getTokenPos(); + nextToken(); + finishNode(node); + if (node.kind === 8 + && sourceText.charCodeAt(tokenPos) === 48 + && ts.isOctalDigit(sourceText.charCodeAt(tokenPos + 1))) { + node.isOctalLiteral = true; + } + return node; + } + function parseTypeReference() { + var typeName = parseEntityName(false, ts.Diagnostics.Type_expected); + var node = createNode(155, typeName.pos); + node.typeName = typeName; + if (!scanner.hasPrecedingLineBreak() && token === 25) { + node.typeArguments = parseBracketedList(18, parseType, 25, 27); + } + return finishNode(node); + } + function parseThisTypePredicate(lhs) { + nextToken(); + var node = createNode(154, lhs.pos); + node.parameterName = lhs; + node.type = parseType(); + return finishNode(node); + } + function parseThisTypeNode() { + var node = createNode(165); + nextToken(); + return finishNode(node); + } + function parseTypeQuery() { + var node = createNode(158); + parseExpected(101); + node.exprName = parseEntityName(true); + return finishNode(node); + } + function parseTypeParameter() { + var node = createNode(141); + node.name = parseIdentifier(); + if (parseOptional(83)) { + if (isStartOfType() || !isStartOfExpression()) { + node.constraint = parseType(); + } + else { + node.expression = parseUnaryExpressionOrHigher(); + } + } + return finishNode(node); + } + function parseTypeParameters() { + if (token === 25) { + return parseBracketedList(17, parseTypeParameter, 25, 27); + } + } + function parseParameterType() { + if (parseOptional(54)) { + return parseType(); + } + return undefined; + } + function isStartOfParameter() { + return token === 22 || isIdentifierOrPattern() || ts.isModifierKind(token) || token === 55 || token === 97; + } + function setModifiers(node, modifiers) { + if (modifiers) { + node.flags |= modifiers.flags; + node.modifiers = modifiers; + } + } + function parseParameter() { + var node = createNode(142); + if (token === 97) { + node.name = createIdentifier(true, undefined); + node.type = parseParameterType(); + return finishNode(node); + } + node.decorators = parseDecorators(); + setModifiers(node, parseModifiers()); + node.dotDotDotToken = parseOptionalToken(22); + node.name = parseIdentifierOrPattern(); + if (ts.getFullWidth(node.name) === 0 && node.flags === 0 && ts.isModifierKind(token)) { + nextToken(); + } + node.questionToken = parseOptionalToken(53); + node.type = parseParameterType(); + node.initializer = parseBindingElementInitializer(true); + return addJSDocComment(finishNode(node)); + } + function parseBindingElementInitializer(inParameter) { + return inParameter ? parseParameterInitializer() : parseNonParameterInitializer(); + } + function parseParameterInitializer() { + return parseInitializer(true); + } + function fillSignature(returnToken, yieldContext, awaitContext, requireCompleteParameterList, signature) { + var returnTokenRequired = returnToken === 34; + signature.typeParameters = parseTypeParameters(); + signature.parameters = parseParameterList(yieldContext, awaitContext, requireCompleteParameterList); + if (returnTokenRequired) { + parseExpected(returnToken); + signature.type = parseTypeOrTypePredicate(); + } + else if (parseOptional(returnToken)) { + signature.type = parseTypeOrTypePredicate(); + } + } + function parseParameterList(yieldContext, awaitContext, requireCompleteParameterList) { + if (parseExpected(17)) { + var savedYieldContext = inYieldContext(); + var savedAwaitContext = inAwaitContext(); + setYieldContext(yieldContext); + setAwaitContext(awaitContext); + var result = parseDelimitedList(16, parseParameter); + setYieldContext(savedYieldContext); + setAwaitContext(savedAwaitContext); + if (!parseExpected(18) && requireCompleteParameterList) { + return undefined; + } + return result; + } + return requireCompleteParameterList ? undefined : createMissingList(); + } + function parseTypeMemberSemicolon() { + if (parseOptional(24)) { + return; + } + parseSemicolon(); + } + function parseSignatureMember(kind) { + var node = createNode(kind); + if (kind === 152) { + parseExpected(92); + } + fillSignature(54, false, false, false, node); + parseTypeMemberSemicolon(); + return finishNode(node); + } + function isIndexSignature() { + if (token !== 19) { + return false; + } + return lookAhead(isUnambiguouslyIndexSignature); + } + function isUnambiguouslyIndexSignature() { + nextToken(); + if (token === 22 || token === 20) { + return true; + } + if (ts.isModifierKind(token)) { + nextToken(); + if (isIdentifier()) { + return true; + } + } + else if (!isIdentifier()) { + return false; + } + else { + nextToken(); + } + if (token === 54 || token === 24) { + return true; + } + if (token !== 53) { + return false; + } + nextToken(); + return token === 54 || token === 24 || token === 20; + } + function parseIndexSignatureDeclaration(fullStart, decorators, modifiers) { + var node = createNode(153, fullStart); + node.decorators = decorators; + setModifiers(node, modifiers); + node.parameters = parseBracketedList(16, parseParameter, 19, 20); + node.type = parseTypeAnnotation(); + parseTypeMemberSemicolon(); + return finishNode(node); + } + function parsePropertyOrMethodSignature(fullStart, modifiers) { + var name = parsePropertyName(); + var questionToken = parseOptionalToken(53); + if (token === 17 || token === 25) { + var method = createNode(146, fullStart); + setModifiers(method, modifiers); + method.name = name; + method.questionToken = questionToken; + fillSignature(54, false, false, false, method); + parseTypeMemberSemicolon(); + return finishNode(method); + } + else { + var property = createNode(144, fullStart); + setModifiers(property, modifiers); + property.name = name; + property.questionToken = questionToken; + property.type = parseTypeAnnotation(); + if (token === 56) { + property.initializer = parseNonParameterInitializer(); + } + parseTypeMemberSemicolon(); + return finishNode(property); + } + } + function isTypeMemberStart() { + var idToken; + if (token === 17 || token === 25) { + return true; + } + while (ts.isModifierKind(token)) { + idToken = token; + nextToken(); + } + if (token === 19) { + return true; + } + if (isLiteralPropertyName()) { + idToken = token; + nextToken(); + } + if (idToken) { + return token === 17 || + token === 25 || + token === 53 || + token === 54 || + canParseSemicolon(); + } + return false; + } + function parseTypeMember() { + if (token === 17 || token === 25) { + return parseSignatureMember(151); + } + if (token === 92 && lookAhead(isStartOfConstructSignature)) { + return parseSignatureMember(152); + } + var fullStart = getNodePos(); + var modifiers = parseModifiers(); + if (isIndexSignature()) { + return parseIndexSignatureDeclaration(fullStart, undefined, modifiers); + } + return parsePropertyOrMethodSignature(fullStart, modifiers); + } + function isStartOfConstructSignature() { + nextToken(); + return token === 17 || token === 25; + } + function parseTypeLiteral() { + var node = createNode(159); + node.members = parseObjectTypeMembers(); + return finishNode(node); + } + function parseObjectTypeMembers() { + var members; + if (parseExpected(15)) { + members = parseList(4, parseTypeMember); + parseExpected(16); + } + else { + members = createMissingList(); + } + return members; + } + function parseTupleType() { + var node = createNode(161); + node.elementTypes = parseBracketedList(19, parseType, 19, 20); + return finishNode(node); + } + function parseParenthesizedType() { + var node = createNode(164); + parseExpected(17); + node.type = parseType(); + parseExpected(18); + return finishNode(node); + } + function parseFunctionOrConstructorType(kind) { + var node = createNode(kind); + if (kind === 157) { + parseExpected(92); + } + fillSignature(34, false, false, false, node); + return finishNode(node); + } + function parseKeywordAndNoDot() { + var node = parseTokenNode(); + return token === 21 ? undefined : node; + } + function parseNonArrayType() { + switch (token) { + case 117: + case 132: + case 130: + case 120: + case 133: + case 135: + case 127: + var node = tryParse(parseKeywordAndNoDot); + return node || parseTypeReference(); + case 9: + return parseStringLiteralTypeNode(); + case 103: + case 93: + return parseTokenNode(); + case 97: { + var thisKeyword = parseThisTypeNode(); + if (token === 124 && !scanner.hasPrecedingLineBreak()) { + return parseThisTypePredicate(thisKeyword); + } + else { + return thisKeyword; + } + } + case 101: + return parseTypeQuery(); + case 15: + return parseTypeLiteral(); + case 19: + return parseTupleType(); + case 17: + return parseParenthesizedType(); + default: + return parseTypeReference(); + } + } + function isStartOfType() { + switch (token) { + case 117: + case 132: + case 130: + case 120: + case 133: + case 103: + case 135: + case 93: + case 97: + case 101: + case 127: + case 15: + case 19: + case 25: + case 92: + case 9: + return true; + case 17: + return lookAhead(isStartOfParenthesizedOrFunctionType); + default: + return isIdentifier(); + } + } + function isStartOfParenthesizedOrFunctionType() { + nextToken(); + return token === 18 || isStartOfParameter() || isStartOfType(); + } + function parseArrayTypeOrHigher() { + var type = parseNonArrayType(); + while (!scanner.hasPrecedingLineBreak() && parseOptional(19)) { + parseExpected(20); + var node = createNode(160, type.pos); + node.elementType = type; + type = finishNode(node); + } + return type; + } + function parseUnionOrIntersectionType(kind, parseConstituentType, operator) { + var type = parseConstituentType(); + if (token === operator) { + var types = [type]; + types.pos = type.pos; + while (parseOptional(operator)) { + types.push(parseConstituentType()); + } + types.end = getNodeEnd(); + var node = createNode(kind, type.pos); + node.types = types; + type = finishNode(node); + } + return type; + } + function parseIntersectionTypeOrHigher() { + return parseUnionOrIntersectionType(163, parseArrayTypeOrHigher, 46); + } + function parseUnionTypeOrHigher() { + return parseUnionOrIntersectionType(162, parseIntersectionTypeOrHigher, 47); + } + function isStartOfFunctionType() { + if (token === 25) { + return true; + } + return token === 17 && lookAhead(isUnambiguouslyStartOfFunctionType); + } + function skipParameterStart() { + if (ts.isModifierKind(token)) { + parseModifiers(); + } + if (isIdentifier() || token === 97) { + nextToken(); + return true; + } + if (token === 19 || token === 15) { + var previousErrorCount = parseDiagnostics.length; + parseIdentifierOrPattern(); + return previousErrorCount === parseDiagnostics.length; + } + return false; + } + function isUnambiguouslyStartOfFunctionType() { + nextToken(); + if (token === 18 || token === 22) { + return true; + } + if (skipParameterStart()) { + if (token === 54 || token === 24 || + token === 53 || token === 56) { + return true; + } + if (token === 18) { + nextToken(); + if (token === 34) { + return true; + } + } + } + return false; + } + function parseTypeOrTypePredicate() { + var typePredicateVariable = isIdentifier() && tryParse(parseTypePredicatePrefix); + var type = parseType(); + if (typePredicateVariable) { + var node = createNode(154, typePredicateVariable.pos); + node.parameterName = typePredicateVariable; + node.type = type; + return finishNode(node); + } + else { + return type; + } + } + function parseTypePredicatePrefix() { + var id = parseIdentifier(); + if (token === 124 && !scanner.hasPrecedingLineBreak()) { + nextToken(); + return id; + } + } + function parseType() { + return doOutsideOfContext(41943040, parseTypeWorker); + } + function parseTypeWorker() { + if (isStartOfFunctionType()) { + return parseFunctionOrConstructorType(156); + } + if (token === 92) { + return parseFunctionOrConstructorType(157); + } + return parseUnionTypeOrHigher(); + } + function parseTypeAnnotation() { + return parseOptional(54) ? parseType() : undefined; + } + function isStartOfLeftHandSideExpression() { + switch (token) { + case 97: + case 95: + case 93: + case 99: + case 84: + case 8: + case 9: + case 11: + case 12: + case 17: + case 19: + case 15: + case 87: + case 73: + case 92: + case 39: + case 61: + case 69: + return true; + default: + return isIdentifier(); + } + } + function isStartOfExpression() { + if (isStartOfLeftHandSideExpression()) { + return true; + } + switch (token) { + case 35: + case 36: + case 50: + case 49: + case 78: + case 101: + case 103: + case 41: + case 42: + case 25: + case 119: + case 114: + return true; + default: + if (isBinaryOperator()) { + return true; + } + return isIdentifier(); + } + } + function isStartOfExpressionStatement() { + return token !== 15 && + token !== 87 && + token !== 73 && + token !== 55 && + isStartOfExpression(); + } + function parseExpression() { + var saveDecoratorContext = inDecoratorContext(); + if (saveDecoratorContext) { + setDecoratorContext(false); + } + var expr = parseAssignmentExpressionOrHigher(); + var operatorToken; + while ((operatorToken = parseOptionalToken(24))) { + expr = makeBinaryExpression(expr, operatorToken, parseAssignmentExpressionOrHigher()); + } + if (saveDecoratorContext) { + setDecoratorContext(true); + } + return expr; + } + function parseInitializer(inParameter) { + if (token !== 56) { + if (scanner.hasPrecedingLineBreak() || (inParameter && token === 15) || !isStartOfExpression()) { + return undefined; + } + } + parseExpected(56); + return parseAssignmentExpressionOrHigher(); + } + function parseAssignmentExpressionOrHigher() { + if (isYieldExpression()) { + return parseYieldExpression(); + } + var arrowExpression = tryParseParenthesizedArrowFunctionExpression() || tryParseAsyncSimpleArrowFunctionExpression(); + if (arrowExpression) { + return arrowExpression; + } + var expr = parseBinaryExpressionOrHigher(0); + if (expr.kind === 69 && token === 34) { + return parseSimpleArrowFunctionExpression(expr); + } + if (ts.isLeftHandSideExpression(expr) && ts.isAssignmentOperator(reScanGreaterToken())) { + return makeBinaryExpression(expr, parseTokenNode(), parseAssignmentExpressionOrHigher()); + } + return parseConditionalExpressionRest(expr); + } + function isYieldExpression() { + if (token === 114) { + if (inYieldContext()) { + return true; + } + return lookAhead(nextTokenIsIdentifierOrKeywordOrNumberOnSameLine); + } + return false; + } + function nextTokenIsIdentifierOnSameLine() { + nextToken(); + return !scanner.hasPrecedingLineBreak() && isIdentifier(); + } + function parseYieldExpression() { + var node = createNode(190); + nextToken(); + if (!scanner.hasPrecedingLineBreak() && + (token === 37 || isStartOfExpression())) { + node.asteriskToken = parseOptionalToken(37); + node.expression = parseAssignmentExpressionOrHigher(); + return finishNode(node); + } + else { + return finishNode(node); + } + } + function parseSimpleArrowFunctionExpression(identifier, asyncModifier) { + ts.Debug.assert(token === 34, "parseSimpleArrowFunctionExpression should only have been called if we had a =>"); + var node; + if (asyncModifier) { + node = createNode(180, asyncModifier.pos); + setModifiers(node, asyncModifier); + } + else { + node = createNode(180, identifier.pos); + } + var parameter = createNode(142, identifier.pos); + parameter.name = identifier; + finishNode(parameter); + node.parameters = [parameter]; + node.parameters.pos = parameter.pos; + node.parameters.end = parameter.end; + node.equalsGreaterThanToken = parseExpectedToken(34, false, ts.Diagnostics._0_expected, "=>"); + node.body = parseArrowFunctionExpressionBody(!!asyncModifier); + return finishNode(node); + } + function tryParseParenthesizedArrowFunctionExpression() { + var triState = isParenthesizedArrowFunctionExpression(); + if (triState === 0) { + return undefined; + } + var arrowFunction = triState === 1 + ? parseParenthesizedArrowFunctionExpressionHead(true) + : tryParse(parsePossibleParenthesizedArrowFunctionExpressionHead); + if (!arrowFunction) { + return undefined; + } + var isAsync = !!(arrowFunction.flags & 256); + var lastToken = token; + arrowFunction.equalsGreaterThanToken = parseExpectedToken(34, false, ts.Diagnostics._0_expected, "=>"); + arrowFunction.body = (lastToken === 34 || lastToken === 15) + ? parseArrowFunctionExpressionBody(isAsync) + : parseIdentifier(); + return finishNode(arrowFunction); + } + function isParenthesizedArrowFunctionExpression() { + if (token === 17 || token === 25 || token === 118) { + return lookAhead(isParenthesizedArrowFunctionExpressionWorker); + } + if (token === 34) { + return 1; + } + return 0; + } + function isParenthesizedArrowFunctionExpressionWorker() { + if (token === 118) { + nextToken(); + if (scanner.hasPrecedingLineBreak()) { + return 0; + } + if (token !== 17 && token !== 25) { + return 0; + } + } + var first = token; + var second = nextToken(); + if (first === 17) { + if (second === 18) { + var third = nextToken(); + switch (third) { + case 34: + case 54: + case 15: + return 1; + default: + return 0; + } + } + if (second === 19 || second === 15) { + return 2; + } + if (second === 22) { + return 1; + } + if (!isIdentifier()) { + return 0; + } + if (nextToken() === 54) { + return 1; + } + return 2; + } + else { + ts.Debug.assert(first === 25); + if (!isIdentifier()) { + return 0; + } + if (sourceFile.languageVariant === 1) { + var isArrowFunctionInJsx = lookAhead(function () { + var third = nextToken(); + if (third === 83) { + var fourth = nextToken(); + switch (fourth) { + case 56: + case 27: + return false; + default: + return true; + } + } + else if (third === 24) { + return true; + } + return false; + }); + if (isArrowFunctionInJsx) { + return 1; + } + return 0; + } + return 2; + } + } + function parsePossibleParenthesizedArrowFunctionExpressionHead() { + return parseParenthesizedArrowFunctionExpressionHead(false); + } + function tryParseAsyncSimpleArrowFunctionExpression() { + if (token === 118) { + var isUnParenthesizedAsyncArrowFunction = lookAhead(isUnParenthesizedAsyncArrowFunctionWorker); + if (isUnParenthesizedAsyncArrowFunction === 1) { + var asyncModifier = parseModifiersForArrowFunction(); + var expr = parseBinaryExpressionOrHigher(0); + return parseSimpleArrowFunctionExpression(expr, asyncModifier); + } + } + return undefined; + } + function isUnParenthesizedAsyncArrowFunctionWorker() { + if (token === 118) { + nextToken(); + if (scanner.hasPrecedingLineBreak() || token === 34) { + return 0; + } + var expr = parseBinaryExpressionOrHigher(0); + if (!scanner.hasPrecedingLineBreak() && expr.kind === 69 && token === 34) { + return 1; + } + } + return 0; + } + function parseParenthesizedArrowFunctionExpressionHead(allowAmbiguity) { + var node = createNode(180); + setModifiers(node, parseModifiersForArrowFunction()); + var isAsync = !!(node.flags & 256); + fillSignature(54, false, isAsync, !allowAmbiguity, node); + if (!node.parameters) { + return undefined; + } + if (!allowAmbiguity && token !== 34 && token !== 15) { + return undefined; + } + return node; + } + function parseArrowFunctionExpressionBody(isAsync) { + if (token === 15) { + return parseFunctionBlock(false, isAsync, false); + } + if (token !== 23 && + token !== 87 && + token !== 73 && + isStartOfStatement() && + !isStartOfExpressionStatement()) { + return parseFunctionBlock(false, isAsync, true); + } + return isAsync + ? doInAwaitContext(parseAssignmentExpressionOrHigher) + : doOutsideOfAwaitContext(parseAssignmentExpressionOrHigher); + } + function parseConditionalExpressionRest(leftOperand) { + var questionToken = parseOptionalToken(53); + if (!questionToken) { + return leftOperand; + } + var node = createNode(188, leftOperand.pos); + node.condition = leftOperand; + node.questionToken = questionToken; + node.whenTrue = doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher); + node.colonToken = parseExpectedToken(54, false, ts.Diagnostics._0_expected, ts.tokenToString(54)); + node.whenFalse = parseAssignmentExpressionOrHigher(); + return finishNode(node); + } + function parseBinaryExpressionOrHigher(precedence) { + var leftOperand = parseUnaryExpressionOrHigher(); + return parseBinaryExpressionRest(precedence, leftOperand); + } + function isInOrOfKeyword(t) { + return t === 90 || t === 138; + } + function parseBinaryExpressionRest(precedence, leftOperand) { + while (true) { + reScanGreaterToken(); + var newPrecedence = getBinaryOperatorPrecedence(); + var consumeCurrentOperator = token === 38 ? + newPrecedence >= precedence : + newPrecedence > precedence; + if (!consumeCurrentOperator) { + break; + } + if (token === 90 && inDisallowInContext()) { + break; + } + if (token === 116) { + if (scanner.hasPrecedingLineBreak()) { + break; + } + else { + nextToken(); + leftOperand = makeAsExpression(leftOperand, parseType()); + } + } + else { + leftOperand = makeBinaryExpression(leftOperand, parseTokenNode(), parseBinaryExpressionOrHigher(newPrecedence)); + } + } + return leftOperand; + } + function isBinaryOperator() { + if (inDisallowInContext() && token === 90) { + return false; + } + return getBinaryOperatorPrecedence() > 0; + } + function getBinaryOperatorPrecedence() { + switch (token) { + case 52: + return 1; + case 51: + return 2; + case 47: + return 3; + case 48: + return 4; + case 46: + return 5; + case 30: + case 31: + case 32: + case 33: + return 6; + case 25: + case 27: + case 28: + case 29: + case 91: + case 90: + case 116: + return 7; + case 43: + case 44: + case 45: + return 8; + case 35: + case 36: + return 9; + case 37: + case 39: + case 40: + return 10; + case 38: + return 11; + } + return -1; + } + function makeBinaryExpression(left, operatorToken, right) { + var node = createNode(187, left.pos); + node.left = left; + node.operatorToken = operatorToken; + node.right = right; + return finishNode(node); + } + function makeAsExpression(left, right) { + var node = createNode(195, left.pos); + node.expression = left; + node.type = right; + return finishNode(node); + } + function parsePrefixUnaryExpression() { + var node = createNode(185); + node.operator = token; + nextToken(); + node.operand = parseSimpleUnaryExpression(); + return finishNode(node); + } + function parseDeleteExpression() { + var node = createNode(181); + nextToken(); + node.expression = parseSimpleUnaryExpression(); + return finishNode(node); + } + function parseTypeOfExpression() { + var node = createNode(182); + nextToken(); + node.expression = parseSimpleUnaryExpression(); + return finishNode(node); + } + function parseVoidExpression() { + var node = createNode(183); + nextToken(); + node.expression = parseSimpleUnaryExpression(); + return finishNode(node); + } + function isAwaitExpression() { + if (token === 119) { + if (inAwaitContext()) { + return true; + } + return lookAhead(nextTokenIsIdentifierOnSameLine); + } + return false; + } + function parseAwaitExpression() { + var node = createNode(184); + nextToken(); + node.expression = parseSimpleUnaryExpression(); + return finishNode(node); + } + function parseUnaryExpressionOrHigher() { + if (isAwaitExpression()) { + return parseAwaitExpression(); + } + if (isIncrementExpression()) { + var incrementExpression = parseIncrementExpression(); + return token === 38 ? + parseBinaryExpressionRest(getBinaryOperatorPrecedence(), incrementExpression) : + incrementExpression; + } + var unaryOperator = token; + var simpleUnaryExpression = parseSimpleUnaryExpression(); + if (token === 38) { + var start = ts.skipTrivia(sourceText, simpleUnaryExpression.pos); + if (simpleUnaryExpression.kind === 177) { + parseErrorAtPosition(start, simpleUnaryExpression.end - start, 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 { + parseErrorAtPosition(start, simpleUnaryExpression.end - start, ts.Diagnostics.An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses, ts.tokenToString(unaryOperator)); + } + } + return simpleUnaryExpression; + } + function parseSimpleUnaryExpression() { + switch (token) { + case 35: + case 36: + case 50: + case 49: + return parsePrefixUnaryExpression(); + case 78: + return parseDeleteExpression(); + case 101: + return parseTypeOfExpression(); + case 103: + return parseVoidExpression(); + case 25: + return parseTypeAssertion(); + default: + return parseIncrementExpression(); + } + } + function isIncrementExpression() { + switch (token) { + case 35: + case 36: + case 50: + case 49: + case 78: + case 101: + case 103: + return false; + case 25: + if (sourceFile.languageVariant !== 1) { + return false; + } + default: + return true; + } + } + function parseIncrementExpression() { + if (token === 41 || token === 42) { + var node = createNode(185); + node.operator = token; + nextToken(); + node.operand = parseLeftHandSideExpressionOrHigher(); + return finishNode(node); + } + else if (sourceFile.languageVariant === 1 && token === 25 && lookAhead(nextTokenIsIdentifierOrKeyword)) { + return parseJsxElementOrSelfClosingElement(true); + } + var expression = parseLeftHandSideExpressionOrHigher(); + ts.Debug.assert(ts.isLeftHandSideExpression(expression)); + if ((token === 41 || token === 42) && !scanner.hasPrecedingLineBreak()) { + var node = createNode(186, expression.pos); + node.operand = expression; + node.operator = token; + nextToken(); + return finishNode(node); + } + return expression; + } + function parseLeftHandSideExpressionOrHigher() { + var expression = token === 95 + ? parseSuperExpression() + : parseMemberExpressionOrHigher(); + return parseCallExpressionRest(expression); + } + function parseMemberExpressionOrHigher() { + var expression = parsePrimaryExpression(); + return parseMemberExpressionRest(expression); + } + function parseSuperExpression() { + var expression = parseTokenNode(); + if (token === 17 || token === 21 || token === 19) { + return expression; + } + var node = createNode(172, expression.pos); + node.expression = expression; + node.dotToken = parseExpectedToken(21, false, ts.Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access); + node.name = parseRightSideOfDot(true); + return finishNode(node); + } + function tagNamesAreEquivalent(lhs, rhs) { + if (lhs.kind !== rhs.kind) { + return false; + } + if (lhs.kind === 69) { + return lhs.text === rhs.text; + } + return lhs.right.text === rhs.right.text && + tagNamesAreEquivalent(lhs.left, rhs.left); + } + function parseJsxElementOrSelfClosingElement(inExpressionContext) { + var opening = parseJsxOpeningOrSelfClosingElement(inExpressionContext); + var result; + if (opening.kind === 243) { + var node = createNode(241, opening.pos); + node.openingElement = opening; + node.children = parseJsxChildren(node.openingElement.tagName); + node.closingElement = parseJsxClosingElement(inExpressionContext); + if (!tagNamesAreEquivalent(node.openingElement.tagName, node.closingElement.tagName)) { + parseErrorAtPosition(node.closingElement.pos, node.closingElement.end - node.closingElement.pos, ts.Diagnostics.Expected_corresponding_JSX_closing_tag_for_0, ts.getTextOfNodeFromSourceText(sourceText, node.openingElement.tagName)); + } + result = finishNode(node); + } + else { + ts.Debug.assert(opening.kind === 242); + result = opening; + } + if (inExpressionContext && token === 25) { + var invalidElement = tryParse(function () { return parseJsxElementOrSelfClosingElement(true); }); + if (invalidElement) { + parseErrorAtCurrentToken(ts.Diagnostics.JSX_expressions_must_have_one_parent_element); + var badNode = createNode(187, result.pos); + badNode.end = invalidElement.end; + badNode.left = result; + badNode.right = invalidElement; + badNode.operatorToken = createMissingNode(24, false, undefined); + badNode.operatorToken.pos = badNode.operatorToken.end = badNode.right.pos; + return badNode; + } + } + return result; + } + function parseJsxText() { + var node = createNode(244, scanner.getStartPos()); + token = scanner.scanJsxToken(); + return finishNode(node); + } + function parseJsxChild() { + switch (token) { + case 244: + return parseJsxText(); + case 15: + return parseJsxExpression(false); + case 25: + return parseJsxElementOrSelfClosingElement(false); + } + ts.Debug.fail("Unknown JSX child kind " + token); + } + function parseJsxChildren(openingTagName) { + var result = []; + result.pos = scanner.getStartPos(); + var saveParsingContext = parsingContext; + parsingContext |= 1 << 14; + while (true) { + token = scanner.reScanJsxToken(); + if (token === 26) { + break; + } + else if (token === 1) { + parseErrorAtPosition(openingTagName.pos, openingTagName.end - openingTagName.pos, ts.Diagnostics.JSX_element_0_has_no_corresponding_closing_tag, ts.getTextOfNodeFromSourceText(sourceText, openingTagName)); + break; + } + result.push(parseJsxChild()); + } + result.end = scanner.getTokenPos(); + parsingContext = saveParsingContext; + return result; + } + function parseJsxOpeningOrSelfClosingElement(inExpressionContext) { + var fullStart = scanner.getStartPos(); + parseExpected(25); + var tagName = parseJsxElementName(); + var attributes = parseList(13, parseJsxAttribute); + var node; + if (token === 27) { + node = createNode(243, fullStart); + scanJsxText(); + } + else { + parseExpected(39); + if (inExpressionContext) { + parseExpected(27); + } + else { + parseExpected(27, undefined, false); + scanJsxText(); + } + node = createNode(242, fullStart); + } + node.tagName = tagName; + node.attributes = attributes; + return finishNode(node); + } + function parseJsxElementName() { + scanJsxIdentifier(); + var elementName = parseIdentifierName(); + while (parseOptional(21)) { + scanJsxIdentifier(); + var node = createNode(139, elementName.pos); + node.left = elementName; + node.right = parseIdentifierName(); + elementName = finishNode(node); + } + return elementName; + } + function parseJsxExpression(inExpressionContext) { + var node = createNode(248); + parseExpected(15); + if (token !== 16) { + node.expression = parseAssignmentExpressionOrHigher(); + } + if (inExpressionContext) { + parseExpected(16); + } + else { + parseExpected(16, undefined, false); + scanJsxText(); + } + return finishNode(node); + } + function parseJsxAttribute() { + if (token === 15) { + return parseJsxSpreadAttribute(); + } + scanJsxIdentifier(); + var node = createNode(246); + node.name = parseIdentifierName(); + if (parseOptional(56)) { + switch (token) { + case 9: + node.initializer = parseLiteralNode(); + break; + default: + node.initializer = parseJsxExpression(true); + break; + } + } + return finishNode(node); + } + function parseJsxSpreadAttribute() { + var node = createNode(247); + parseExpected(15); + parseExpected(22); + node.expression = parseExpression(); + parseExpected(16); + return finishNode(node); + } + function parseJsxClosingElement(inExpressionContext) { + var node = createNode(245); + parseExpected(26); + node.tagName = parseJsxElementName(); + if (inExpressionContext) { + parseExpected(27); + } + else { + parseExpected(27, undefined, false); + scanJsxText(); + } + return finishNode(node); + } + function parseTypeAssertion() { + var node = createNode(177); + parseExpected(25); + node.type = parseType(); + parseExpected(27); + node.expression = parseSimpleUnaryExpression(); + return finishNode(node); + } + function parseMemberExpressionRest(expression) { + while (true) { + var dotToken = parseOptionalToken(21); + if (dotToken) { + var propertyAccess = createNode(172, expression.pos); + propertyAccess.expression = expression; + propertyAccess.dotToken = dotToken; + propertyAccess.name = parseRightSideOfDot(true); + expression = finishNode(propertyAccess); + continue; + } + if (token === 49 && !scanner.hasPrecedingLineBreak()) { + nextToken(); + var nonNullExpression = createNode(196, expression.pos); + nonNullExpression.expression = expression; + expression = finishNode(nonNullExpression); + continue; + } + if (!inDecoratorContext() && parseOptional(19)) { + var indexedAccess = createNode(173, expression.pos); + indexedAccess.expression = expression; + if (token !== 20) { + indexedAccess.argumentExpression = allowInAnd(parseExpression); + if (indexedAccess.argumentExpression.kind === 9 || indexedAccess.argumentExpression.kind === 8) { + var literal = indexedAccess.argumentExpression; + literal.text = internIdentifier(literal.text); + } + } + parseExpected(20); + expression = finishNode(indexedAccess); + continue; + } + if (token === 11 || token === 12) { + var tagExpression = createNode(176, expression.pos); + tagExpression.tag = expression; + tagExpression.template = token === 11 + ? parseLiteralNode() + : parseTemplateExpression(); + expression = finishNode(tagExpression); + continue; + } + return expression; + } + } + function parseCallExpressionRest(expression) { + while (true) { + expression = parseMemberExpressionRest(expression); + if (token === 25) { + var typeArguments = tryParse(parseTypeArgumentsInExpression); + if (!typeArguments) { + return expression; + } + var callExpr = createNode(174, expression.pos); + callExpr.expression = expression; + callExpr.typeArguments = typeArguments; + callExpr.arguments = parseArgumentList(); + expression = finishNode(callExpr); + continue; + } + else if (token === 17) { + var callExpr = createNode(174, expression.pos); + callExpr.expression = expression; + callExpr.arguments = parseArgumentList(); + expression = finishNode(callExpr); + continue; + } + return expression; + } + } + function parseArgumentList() { + parseExpected(17); + var result = parseDelimitedList(11, parseArgumentExpression); + parseExpected(18); + return result; + } + function parseTypeArgumentsInExpression() { + if (!parseOptional(25)) { + return undefined; + } + var typeArguments = parseDelimitedList(18, parseType); + if (!parseExpected(27)) { + return undefined; + } + return typeArguments && canFollowTypeArgumentsInExpression() + ? typeArguments + : undefined; + } + function canFollowTypeArgumentsInExpression() { + switch (token) { + case 17: + case 21: + case 18: + case 20: + case 54: + case 23: + case 53: + case 30: + case 32: + case 31: + case 33: + case 51: + case 52: + case 48: + case 46: + case 47: + case 16: + case 1: + return true; + case 24: + case 15: + default: + return false; + } + } + function parsePrimaryExpression() { + switch (token) { + case 8: + case 9: + case 11: + return parseLiteralNode(); + case 97: + case 95: + case 93: + case 99: + case 84: + return parseTokenNode(); + case 17: + return parseParenthesizedExpression(); + case 19: + return parseArrayLiteralExpression(); + case 15: + return parseObjectLiteralExpression(); + case 118: + if (!lookAhead(nextTokenIsFunctionKeywordOnSameLine)) { + break; + } + return parseFunctionExpression(); + case 73: + return parseClassExpression(); + case 87: + return parseFunctionExpression(); + case 92: + return parseNewExpression(); + case 39: + case 61: + if (reScanSlashToken() === 10) { + return parseLiteralNode(); + } + break; + case 12: + return parseTemplateExpression(); + } + return parseIdentifier(ts.Diagnostics.Expression_expected); + } + function parseParenthesizedExpression() { + var node = createNode(178); + parseExpected(17); + node.expression = allowInAnd(parseExpression); + parseExpected(18); + return finishNode(node); + } + function parseSpreadElement() { + var node = createNode(191); + parseExpected(22); + node.expression = parseAssignmentExpressionOrHigher(); + return finishNode(node); + } + function parseArgumentOrArrayLiteralElement() { + return token === 22 ? parseSpreadElement() : + token === 24 ? createNode(193) : + parseAssignmentExpressionOrHigher(); + } + function parseArgumentExpression() { + return doOutsideOfContext(disallowInAndDecoratorContext, parseArgumentOrArrayLiteralElement); + } + function parseArrayLiteralExpression() { + var node = createNode(170); + parseExpected(19); + if (scanner.hasPrecedingLineBreak()) { + node.multiLine = true; + } + node.elements = parseDelimitedList(15, parseArgumentOrArrayLiteralElement); + parseExpected(20); + return finishNode(node); + } + function tryParseAccessorDeclaration(fullStart, decorators, modifiers) { + if (parseContextualModifier(123)) { + return addJSDocComment(parseAccessorDeclaration(149, fullStart, decorators, modifiers)); + } + else if (parseContextualModifier(131)) { + return parseAccessorDeclaration(150, fullStart, decorators, modifiers); + } + return undefined; + } + function parseObjectLiteralElement() { + var fullStart = scanner.getStartPos(); + var decorators = parseDecorators(); + var modifiers = parseModifiers(); + var accessor = tryParseAccessorDeclaration(fullStart, decorators, modifiers); + if (accessor) { + return accessor; + } + var asteriskToken = parseOptionalToken(37); + var tokenIsIdentifier = isIdentifier(); + var propertyName = parsePropertyName(); + var questionToken = parseOptionalToken(53); + if (asteriskToken || token === 17 || token === 25) { + return parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, propertyName, questionToken); + } + var isShorthandPropertyAssignment = tokenIsIdentifier && (token === 24 || token === 16 || token === 56); + if (isShorthandPropertyAssignment) { + var shorthandDeclaration = createNode(254, fullStart); + shorthandDeclaration.name = propertyName; + shorthandDeclaration.questionToken = questionToken; + var equalsToken = parseOptionalToken(56); + if (equalsToken) { + shorthandDeclaration.equalsToken = equalsToken; + shorthandDeclaration.objectAssignmentInitializer = allowInAnd(parseAssignmentExpressionOrHigher); + } + return addJSDocComment(finishNode(shorthandDeclaration)); + } + else { + var propertyAssignment = createNode(253, fullStart); + propertyAssignment.modifiers = modifiers; + propertyAssignment.name = propertyName; + propertyAssignment.questionToken = questionToken; + parseExpected(54); + propertyAssignment.initializer = allowInAnd(parseAssignmentExpressionOrHigher); + return addJSDocComment(finishNode(propertyAssignment)); + } + } + function parseObjectLiteralExpression() { + var node = createNode(171); + parseExpected(15); + if (scanner.hasPrecedingLineBreak()) { + node.multiLine = true; + } + node.properties = parseDelimitedList(12, parseObjectLiteralElement, true); + parseExpected(16); + return finishNode(node); + } + function parseFunctionExpression() { + var saveDecoratorContext = inDecoratorContext(); + if (saveDecoratorContext) { + setDecoratorContext(false); + } + var node = createNode(179); + setModifiers(node, parseModifiers()); + parseExpected(87); + node.asteriskToken = parseOptionalToken(37); + var isGenerator = !!node.asteriskToken; + var isAsync = !!(node.flags & 256); + node.name = + isGenerator && isAsync ? doInYieldAndAwaitContext(parseOptionalIdentifier) : + isGenerator ? doInYieldContext(parseOptionalIdentifier) : + isAsync ? doInAwaitContext(parseOptionalIdentifier) : + parseOptionalIdentifier(); + fillSignature(54, isGenerator, isAsync, false, node); + node.body = parseFunctionBlock(isGenerator, isAsync, false); + if (saveDecoratorContext) { + setDecoratorContext(true); + } + return addJSDocComment(finishNode(node)); + } + function parseOptionalIdentifier() { + return isIdentifier() ? parseIdentifier() : undefined; + } + function parseNewExpression() { + var node = createNode(175); + parseExpected(92); + node.expression = parseMemberExpressionOrHigher(); + node.typeArguments = tryParse(parseTypeArgumentsInExpression); + if (node.typeArguments || token === 17) { + node.arguments = parseArgumentList(); + } + return finishNode(node); + } + function parseBlock(ignoreMissingOpenBrace, diagnosticMessage) { + var node = createNode(199); + if (parseExpected(15, diagnosticMessage) || ignoreMissingOpenBrace) { + node.statements = parseList(1, parseStatement); + parseExpected(16); + } + else { + node.statements = createMissingList(); + } + return finishNode(node); + } + function parseFunctionBlock(allowYield, allowAwait, ignoreMissingOpenBrace, diagnosticMessage) { + var savedYieldContext = inYieldContext(); + setYieldContext(allowYield); + var savedAwaitContext = inAwaitContext(); + setAwaitContext(allowAwait); + var saveDecoratorContext = inDecoratorContext(); + if (saveDecoratorContext) { + setDecoratorContext(false); + } + var block = parseBlock(ignoreMissingOpenBrace, diagnosticMessage); + if (saveDecoratorContext) { + setDecoratorContext(true); + } + setYieldContext(savedYieldContext); + setAwaitContext(savedAwaitContext); + return block; + } + function parseEmptyStatement() { + var node = createNode(201); + parseExpected(23); + return finishNode(node); + } + function parseIfStatement() { + var node = createNode(203); + parseExpected(88); + parseExpected(17); + node.expression = allowInAnd(parseExpression); + parseExpected(18); + node.thenStatement = parseStatement(); + node.elseStatement = parseOptional(80) ? parseStatement() : undefined; + return finishNode(node); + } + function parseDoStatement() { + var node = createNode(204); + parseExpected(79); + node.statement = parseStatement(); + parseExpected(104); + parseExpected(17); + node.expression = allowInAnd(parseExpression); + parseExpected(18); + parseOptional(23); + return finishNode(node); + } + function parseWhileStatement() { + var node = createNode(205); + parseExpected(104); + parseExpected(17); + node.expression = allowInAnd(parseExpression); + parseExpected(18); + node.statement = parseStatement(); + return finishNode(node); + } + function parseForOrForInOrForOfStatement() { + var pos = getNodePos(); + parseExpected(86); + parseExpected(17); + var initializer = undefined; + if (token !== 23) { + if (token === 102 || token === 108 || token === 74) { + initializer = parseVariableDeclarationList(true); + } + else { + initializer = disallowInAnd(parseExpression); + } + } + var forOrForInOrForOfStatement; + if (parseOptional(90)) { + var forInStatement = createNode(207, pos); + forInStatement.initializer = initializer; + forInStatement.expression = allowInAnd(parseExpression); + parseExpected(18); + forOrForInOrForOfStatement = forInStatement; + } + else if (parseOptional(138)) { + var forOfStatement = createNode(208, pos); + forOfStatement.initializer = initializer; + forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher); + parseExpected(18); + forOrForInOrForOfStatement = forOfStatement; + } + else { + var forStatement = createNode(206, pos); + forStatement.initializer = initializer; + parseExpected(23); + if (token !== 23 && token !== 18) { + forStatement.condition = allowInAnd(parseExpression); + } + parseExpected(23); + if (token !== 18) { + forStatement.incrementor = allowInAnd(parseExpression); + } + parseExpected(18); + forOrForInOrForOfStatement = forStatement; + } + forOrForInOrForOfStatement.statement = parseStatement(); + return finishNode(forOrForInOrForOfStatement); + } + function parseBreakOrContinueStatement(kind) { + var node = createNode(kind); + parseExpected(kind === 210 ? 70 : 75); + if (!canParseSemicolon()) { + node.label = parseIdentifier(); + } + parseSemicolon(); + return finishNode(node); + } + function parseReturnStatement() { + var node = createNode(211); + parseExpected(94); + if (!canParseSemicolon()) { + node.expression = allowInAnd(parseExpression); + } + parseSemicolon(); + return finishNode(node); + } + function parseWithStatement() { + var node = createNode(212); + parseExpected(105); + parseExpected(17); + node.expression = allowInAnd(parseExpression); + parseExpected(18); + node.statement = parseStatement(); + return finishNode(node); + } + function parseCaseClause() { + var node = createNode(249); + parseExpected(71); + node.expression = allowInAnd(parseExpression); + parseExpected(54); + node.statements = parseList(3, parseStatement); + return finishNode(node); + } + function parseDefaultClause() { + var node = createNode(250); + parseExpected(77); + parseExpected(54); + node.statements = parseList(3, parseStatement); + return finishNode(node); + } + function parseCaseOrDefaultClause() { + return token === 71 ? parseCaseClause() : parseDefaultClause(); + } + function parseSwitchStatement() { + var node = createNode(213); + parseExpected(96); + parseExpected(17); + node.expression = allowInAnd(parseExpression); + parseExpected(18); + var caseBlock = createNode(227, scanner.getStartPos()); + parseExpected(15); + caseBlock.clauses = parseList(2, parseCaseOrDefaultClause); + parseExpected(16); + node.caseBlock = finishNode(caseBlock); + return finishNode(node); + } + function parseThrowStatement() { + var node = createNode(215); + parseExpected(98); + node.expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression); + parseSemicolon(); + return finishNode(node); + } + function parseTryStatement() { + var node = createNode(216); + parseExpected(100); + node.tryBlock = parseBlock(false); + node.catchClause = token === 72 ? parseCatchClause() : undefined; + if (!node.catchClause || token === 85) { + parseExpected(85); + node.finallyBlock = parseBlock(false); + } + return finishNode(node); + } + function parseCatchClause() { + var result = createNode(252); + parseExpected(72); + if (parseExpected(17)) { + result.variableDeclaration = parseVariableDeclaration(); + } + parseExpected(18); + result.block = parseBlock(false); + return finishNode(result); + } + function parseDebuggerStatement() { + var node = createNode(217); + parseExpected(76); + parseSemicolon(); + return finishNode(node); + } + function parseExpressionOrLabeledStatement() { + var fullStart = scanner.getStartPos(); + var expression = allowInAnd(parseExpression); + if (expression.kind === 69 && parseOptional(54)) { + var labeledStatement = createNode(214, fullStart); + labeledStatement.label = expression; + labeledStatement.statement = parseStatement(); + return addJSDocComment(finishNode(labeledStatement)); + } + else { + var expressionStatement = createNode(202, fullStart); + expressionStatement.expression = expression; + parseSemicolon(); + return addJSDocComment(finishNode(expressionStatement)); + } + } + function nextTokenIsIdentifierOrKeywordOnSameLine() { + nextToken(); + return ts.tokenIsIdentifierOrKeyword(token) && !scanner.hasPrecedingLineBreak(); + } + function nextTokenIsFunctionKeywordOnSameLine() { + nextToken(); + return token === 87 && !scanner.hasPrecedingLineBreak(); + } + function nextTokenIsIdentifierOrKeywordOrNumberOnSameLine() { + nextToken(); + return (ts.tokenIsIdentifierOrKeyword(token) || token === 8) && !scanner.hasPrecedingLineBreak(); + } + function isDeclaration() { + while (true) { + switch (token) { + case 102: + case 108: + case 74: + case 87: + case 73: + case 81: + return true; + case 107: + case 134: + return nextTokenIsIdentifierOnSameLine(); + case 125: + case 126: + return nextTokenIsIdentifierOrStringLiteralOnSameLine(); + case 115: + case 118: + case 122: + case 110: + case 111: + case 112: + case 128: + nextToken(); + if (scanner.hasPrecedingLineBreak()) { + return false; + } + continue; + case 137: + nextToken(); + return token === 15 || token === 69 || token === 82; + case 89: + nextToken(); + return token === 9 || token === 37 || + token === 15 || ts.tokenIsIdentifierOrKeyword(token); + case 82: + nextToken(); + if (token === 56 || token === 37 || + token === 15 || token === 77 || + token === 116) { + return true; + } + continue; + case 113: + nextToken(); + continue; + default: + return false; + } + } + } + function isStartOfDeclaration() { + return lookAhead(isDeclaration); + } + function isStartOfStatement() { + switch (token) { + case 55: + case 23: + case 15: + case 102: + case 108: + case 87: + case 73: + case 81: + case 88: + case 79: + case 104: + case 86: + case 75: + case 70: + case 94: + case 105: + case 96: + case 98: + case 100: + case 76: + case 72: + case 85: + return true; + case 74: + case 82: + case 89: + return isStartOfDeclaration(); + case 118: + case 122: + case 107: + case 125: + case 126: + case 134: + case 137: + return true; + case 112: + case 110: + case 111: + case 113: + case 128: + return isStartOfDeclaration() || !lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine); + default: + return isStartOfExpression(); + } + } + function nextTokenIsIdentifierOrStartOfDestructuring() { + nextToken(); + return isIdentifier() || token === 15 || token === 19; + } + function isLetDeclaration() { + return lookAhead(nextTokenIsIdentifierOrStartOfDestructuring); + } + function parseStatement() { + switch (token) { + case 23: + return parseEmptyStatement(); + case 15: + return parseBlock(false); + case 102: + return parseVariableStatement(scanner.getStartPos(), undefined, undefined); + case 108: + if (isLetDeclaration()) { + return parseVariableStatement(scanner.getStartPos(), undefined, undefined); + } + break; + case 87: + return parseFunctionDeclaration(scanner.getStartPos(), undefined, undefined); + case 73: + return parseClassDeclaration(scanner.getStartPos(), undefined, undefined); + case 88: + return parseIfStatement(); + case 79: + return parseDoStatement(); + case 104: + return parseWhileStatement(); + case 86: + return parseForOrForInOrForOfStatement(); + case 75: + return parseBreakOrContinueStatement(209); + case 70: + return parseBreakOrContinueStatement(210); + case 94: + return parseReturnStatement(); + case 105: + return parseWithStatement(); + case 96: + return parseSwitchStatement(); + case 98: + return parseThrowStatement(); + case 100: + case 72: + case 85: + return parseTryStatement(); + case 76: + return parseDebuggerStatement(); + case 55: + return parseDeclaration(); + case 118: + case 107: + case 134: + case 125: + case 126: + case 122: + case 74: + case 81: + case 82: + case 89: + case 110: + case 111: + case 112: + case 115: + case 113: + case 128: + case 137: + if (isStartOfDeclaration()) { + return parseDeclaration(); + } + break; + } + return parseExpressionOrLabeledStatement(); + } + function parseDeclaration() { + var fullStart = getNodePos(); + var decorators = parseDecorators(); + var modifiers = parseModifiers(); + switch (token) { + case 102: + case 108: + case 74: + return parseVariableStatement(fullStart, decorators, modifiers); + case 87: + return parseFunctionDeclaration(fullStart, decorators, modifiers); + case 73: + return parseClassDeclaration(fullStart, decorators, modifiers); + case 107: + return parseInterfaceDeclaration(fullStart, decorators, modifiers); + case 134: + return parseTypeAliasDeclaration(fullStart, decorators, modifiers); + case 81: + return parseEnumDeclaration(fullStart, decorators, modifiers); + case 137: + case 125: + case 126: + return parseModuleDeclaration(fullStart, decorators, modifiers); + case 89: + return parseImportDeclarationOrImportEqualsDeclaration(fullStart, decorators, modifiers); + case 82: + nextToken(); + switch (token) { + case 77: + case 56: + return parseExportAssignment(fullStart, decorators, modifiers); + case 116: + return parseGlobalModuleExportDeclaration(fullStart, decorators, modifiers); + default: + return parseExportDeclaration(fullStart, decorators, modifiers); + } + default: + if (decorators || modifiers) { + var node = createMissingNode(239, true, ts.Diagnostics.Declaration_expected); + node.pos = fullStart; + node.decorators = decorators; + setModifiers(node, modifiers); + return finishNode(node); + } + } + } + function nextTokenIsIdentifierOrStringLiteralOnSameLine() { + nextToken(); + return !scanner.hasPrecedingLineBreak() && (isIdentifier() || token === 9); + } + function parseFunctionBlockOrSemicolon(isGenerator, isAsync, diagnosticMessage) { + if (token !== 15 && canParseSemicolon()) { + parseSemicolon(); + return; + } + return parseFunctionBlock(isGenerator, isAsync, false, diagnosticMessage); + } + function parseArrayBindingElement() { + if (token === 24) { + return createNode(193); + } + var node = createNode(169); + node.dotDotDotToken = parseOptionalToken(22); + node.name = parseIdentifierOrPattern(); + node.initializer = parseBindingElementInitializer(false); + return finishNode(node); + } + function parseObjectBindingElement() { + var node = createNode(169); + var tokenIsIdentifier = isIdentifier(); + var propertyName = parsePropertyName(); + if (tokenIsIdentifier && token !== 54) { + node.name = propertyName; + } + else { + parseExpected(54); + node.propertyName = propertyName; + node.name = parseIdentifierOrPattern(); + } + node.initializer = parseBindingElementInitializer(false); + return finishNode(node); + } + function parseObjectBindingPattern() { + var node = createNode(167); + parseExpected(15); + node.elements = parseDelimitedList(9, parseObjectBindingElement); + parseExpected(16); + return finishNode(node); + } + function parseArrayBindingPattern() { + var node = createNode(168); + parseExpected(19); + node.elements = parseDelimitedList(10, parseArrayBindingElement); + parseExpected(20); + return finishNode(node); + } + function isIdentifierOrPattern() { + return token === 15 || token === 19 || isIdentifier(); + } + function parseIdentifierOrPattern() { + if (token === 19) { + return parseArrayBindingPattern(); + } + if (token === 15) { + return parseObjectBindingPattern(); + } + return parseIdentifier(); + } + function parseVariableDeclaration() { + var node = createNode(218); + node.name = parseIdentifierOrPattern(); + node.type = parseTypeAnnotation(); + if (!isInOrOfKeyword(token)) { + node.initializer = parseInitializer(false); + } + return finishNode(node); + } + function parseVariableDeclarationList(inForStatementInitializer) { + var node = createNode(219); + switch (token) { + case 102: + break; + case 108: + node.flags |= 1024; + break; + case 74: + node.flags |= 2048; + break; + default: + ts.Debug.fail(); + } + nextToken(); + if (token === 138 && lookAhead(canFollowContextualOfKeyword)) { + node.declarations = createMissingList(); + } + else { + var savedDisallowIn = inDisallowInContext(); + setDisallowInContext(inForStatementInitializer); + node.declarations = parseDelimitedList(8, parseVariableDeclaration); + setDisallowInContext(savedDisallowIn); + } + return finishNode(node); + } + function canFollowContextualOfKeyword() { + return nextTokenIsIdentifier() && nextToken() === 18; + } + function parseVariableStatement(fullStart, decorators, modifiers) { + var node = createNode(200, fullStart); + node.decorators = decorators; + setModifiers(node, modifiers); + node.declarationList = parseVariableDeclarationList(false); + parseSemicolon(); + return addJSDocComment(finishNode(node)); + } + function parseFunctionDeclaration(fullStart, decorators, modifiers) { + var node = createNode(220, fullStart); + node.decorators = decorators; + setModifiers(node, modifiers); + parseExpected(87); + node.asteriskToken = parseOptionalToken(37); + node.name = node.flags & 512 ? parseOptionalIdentifier() : parseIdentifier(); + var isGenerator = !!node.asteriskToken; + var isAsync = !!(node.flags & 256); + fillSignature(54, isGenerator, isAsync, false, node); + node.body = parseFunctionBlockOrSemicolon(isGenerator, isAsync, ts.Diagnostics.or_expected); + return addJSDocComment(finishNode(node)); + } + function parseConstructorDeclaration(pos, decorators, modifiers) { + var node = createNode(148, pos); + node.decorators = decorators; + setModifiers(node, modifiers); + parseExpected(121); + fillSignature(54, false, false, false, node); + node.body = parseFunctionBlockOrSemicolon(false, false, ts.Diagnostics.or_expected); + return addJSDocComment(finishNode(node)); + } + function parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, name, questionToken, diagnosticMessage) { + var method = createNode(147, fullStart); + method.decorators = decorators; + setModifiers(method, modifiers); + method.asteriskToken = asteriskToken; + method.name = name; + method.questionToken = questionToken; + var isGenerator = !!asteriskToken; + var isAsync = !!(method.flags & 256); + fillSignature(54, isGenerator, isAsync, false, method); + method.body = parseFunctionBlockOrSemicolon(isGenerator, isAsync, diagnosticMessage); + return addJSDocComment(finishNode(method)); + } + function parsePropertyDeclaration(fullStart, decorators, modifiers, name, questionToken) { + var property = createNode(145, fullStart); + property.decorators = decorators; + setModifiers(property, modifiers); + property.name = name; + property.questionToken = questionToken; + property.type = parseTypeAnnotation(); + property.initializer = modifiers && modifiers.flags & 32 + ? allowInAnd(parseNonParameterInitializer) + : doOutsideOfContext(8388608 | 4194304, parseNonParameterInitializer); + parseSemicolon(); + return finishNode(property); + } + function parsePropertyOrMethodDeclaration(fullStart, decorators, modifiers) { + var asteriskToken = parseOptionalToken(37); + var name = parsePropertyName(); + var questionToken = parseOptionalToken(53); + if (asteriskToken || token === 17 || token === 25) { + return parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, name, questionToken, ts.Diagnostics.or_expected); + } + else { + return parsePropertyDeclaration(fullStart, decorators, modifiers, name, questionToken); + } + } + function parseNonParameterInitializer() { + return parseInitializer(false); + } + function parseAccessorDeclaration(kind, fullStart, decorators, modifiers) { + var node = createNode(kind, fullStart); + node.decorators = decorators; + setModifiers(node, modifiers); + node.name = parsePropertyName(); + fillSignature(54, false, false, false, node); + node.body = parseFunctionBlockOrSemicolon(false, false); + return finishNode(node); + } + function isClassMemberModifier(idToken) { + switch (idToken) { + case 112: + case 110: + case 111: + case 113: + case 128: + return true; + default: + return false; + } + } + function isClassMemberStart() { + var idToken; + if (token === 55) { + return true; + } + while (ts.isModifierKind(token)) { + idToken = token; + if (isClassMemberModifier(idToken)) { + return true; + } + nextToken(); + } + if (token === 37) { + return true; + } + if (isLiteralPropertyName()) { + idToken = token; + nextToken(); + } + if (token === 19) { + return true; + } + if (idToken !== undefined) { + if (!ts.isKeyword(idToken) || idToken === 131 || idToken === 123) { + return true; + } + switch (token) { + case 17: + case 25: + case 54: + case 56: + case 53: + return true; + default: + return canParseSemicolon(); + } + } + return false; + } + function parseDecorators() { + var decorators; + while (true) { + var decoratorStart = getNodePos(); + if (!parseOptional(55)) { + break; + } + if (!decorators) { + decorators = []; + decorators.pos = decoratorStart; + } + var decorator = createNode(143, decoratorStart); + decorator.expression = doInDecoratorContext(parseLeftHandSideExpressionOrHigher); + decorators.push(finishNode(decorator)); + } + if (decorators) { + decorators.end = getNodeEnd(); + } + return decorators; + } + function parseModifiers(permitInvalidConstAsModifier) { + var flags = 0; + var modifiers; + while (true) { + var modifierStart = scanner.getStartPos(); + var modifierKind = token; + if (token === 74 && permitInvalidConstAsModifier) { + if (!tryParse(nextTokenIsOnSameLineAndCanFollowModifier)) { + break; + } + } + else { + if (!parseAnyContextualModifier()) { + break; + } + } + if (!modifiers) { + modifiers = []; + modifiers.pos = modifierStart; + } + flags |= ts.modifierToFlag(modifierKind); + modifiers.push(finishNode(createNode(modifierKind, modifierStart))); + } + if (modifiers) { + modifiers.flags = flags; + modifiers.end = scanner.getStartPos(); + } + return modifiers; + } + function parseModifiersForArrowFunction() { + var flags = 0; + var modifiers; + if (token === 118) { + var modifierStart = scanner.getStartPos(); + var modifierKind = token; + nextToken(); + modifiers = []; + modifiers.pos = modifierStart; + flags |= ts.modifierToFlag(modifierKind); + modifiers.push(finishNode(createNode(modifierKind, modifierStart))); + modifiers.flags = flags; + modifiers.end = scanner.getStartPos(); + } + return modifiers; + } + function parseClassElement() { + if (token === 23) { + var result = createNode(198); + nextToken(); + return finishNode(result); + } + var fullStart = getNodePos(); + var decorators = parseDecorators(); + var modifiers = parseModifiers(true); + var accessor = tryParseAccessorDeclaration(fullStart, decorators, modifiers); + if (accessor) { + return accessor; + } + if (token === 121) { + return parseConstructorDeclaration(fullStart, decorators, modifiers); + } + if (isIndexSignature()) { + return parseIndexSignatureDeclaration(fullStart, decorators, modifiers); + } + if (ts.tokenIsIdentifierOrKeyword(token) || + token === 9 || + token === 8 || + token === 37 || + token === 19) { + return parsePropertyOrMethodDeclaration(fullStart, decorators, modifiers); + } + if (decorators || modifiers) { + var name_7 = createMissingNode(69, true, ts.Diagnostics.Declaration_expected); + return parsePropertyDeclaration(fullStart, decorators, modifiers, name_7, undefined); + } + ts.Debug.fail("Should not have attempted to parse class member declaration."); + } + function parseClassExpression() { + return parseClassDeclarationOrExpression(scanner.getStartPos(), undefined, undefined, 192); + } + function parseClassDeclaration(fullStart, decorators, modifiers) { + return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 221); + } + function parseClassDeclarationOrExpression(fullStart, decorators, modifiers, kind) { + var node = createNode(kind, fullStart); + node.decorators = decorators; + setModifiers(node, modifiers); + parseExpected(73); + node.name = parseNameOfClassDeclarationOrExpression(); + node.typeParameters = parseTypeParameters(); + node.heritageClauses = parseHeritageClauses(true); + if (parseExpected(15)) { + node.members = parseClassMembers(); + parseExpected(16); + } + else { + node.members = createMissingList(); + } + return finishNode(node); + } + function parseNameOfClassDeclarationOrExpression() { + return isIdentifier() && !isImplementsClause() + ? parseIdentifier() + : undefined; + } + function isImplementsClause() { + return token === 106 && lookAhead(nextTokenIsIdentifierOrKeyword); + } + function parseHeritageClauses(isClassHeritageClause) { + if (isHeritageClause()) { + return parseList(20, parseHeritageClause); + } + return undefined; + } + function parseHeritageClause() { + if (token === 83 || token === 106) { + var node = createNode(251); + node.token = token; + nextToken(); + node.types = parseDelimitedList(7, parseExpressionWithTypeArguments); + return finishNode(node); + } + return undefined; + } + function parseExpressionWithTypeArguments() { + var node = createNode(194); + node.expression = parseLeftHandSideExpressionOrHigher(); + if (token === 25) { + node.typeArguments = parseBracketedList(18, parseType, 25, 27); + } + return finishNode(node); + } + function isHeritageClause() { + return token === 83 || token === 106; + } + function parseClassMembers() { + return parseList(5, parseClassElement); + } + function parseInterfaceDeclaration(fullStart, decorators, modifiers) { + var node = createNode(222, fullStart); + node.decorators = decorators; + setModifiers(node, modifiers); + parseExpected(107); + node.name = parseIdentifier(); + node.typeParameters = parseTypeParameters(); + node.heritageClauses = parseHeritageClauses(false); + node.members = parseObjectTypeMembers(); + return finishNode(node); + } + function parseTypeAliasDeclaration(fullStart, decorators, modifiers) { + var node = createNode(223, fullStart); + node.decorators = decorators; + setModifiers(node, modifiers); + parseExpected(134); + node.name = parseIdentifier(); + node.typeParameters = parseTypeParameters(); + parseExpected(56); + node.type = parseType(); + parseSemicolon(); + return finishNode(node); + } + function parseEnumMember() { + var node = createNode(255, scanner.getStartPos()); + node.name = parsePropertyName(); + node.initializer = allowInAnd(parseNonParameterInitializer); + return finishNode(node); + } + function parseEnumDeclaration(fullStart, decorators, modifiers) { + var node = createNode(224, fullStart); + node.decorators = decorators; + setModifiers(node, modifiers); + parseExpected(81); + node.name = parseIdentifier(); + if (parseExpected(15)) { + node.members = parseDelimitedList(6, parseEnumMember); + parseExpected(16); + } + else { + node.members = createMissingList(); + } + return finishNode(node); + } + function parseModuleBlock() { + var node = createNode(226, scanner.getStartPos()); + if (parseExpected(15)) { + node.statements = parseList(1, parseStatement); + parseExpected(16); + } + else { + node.statements = createMissingList(); + } + return finishNode(node); + } + function parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags) { + var node = createNode(225, fullStart); + var namespaceFlag = flags & 4096; + node.decorators = decorators; + setModifiers(node, modifiers); + node.flags |= flags; + node.name = parseIdentifier(); + node.body = parseOptional(21) + ? parseModuleOrNamespaceDeclaration(getNodePos(), undefined, undefined, 1 | namespaceFlag) + : parseModuleBlock(); + return finishNode(node); + } + function parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers) { + var node = createNode(225, fullStart); + node.decorators = decorators; + setModifiers(node, modifiers); + if (token === 137) { + node.name = parseIdentifier(); + node.flags |= 131072; + } + else { + node.name = parseLiteralNode(true); + } + node.body = parseModuleBlock(); + return finishNode(node); + } + function parseModuleDeclaration(fullStart, decorators, modifiers) { + var flags = modifiers ? modifiers.flags : 0; + if (token === 137) { + return parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers); + } + else if (parseOptional(126)) { + flags |= 4096; + } + else { + parseExpected(125); + if (token === 9) { + return parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers); + } + } + return parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags); + } + function isExternalModuleReference() { + return token === 129 && + lookAhead(nextTokenIsOpenParen); + } + function nextTokenIsOpenParen() { + return nextToken() === 17; + } + function nextTokenIsSlash() { + return nextToken() === 39; + } + function parseGlobalModuleExportDeclaration(fullStart, decorators, modifiers) { + var exportDeclaration = createNode(228, fullStart); + exportDeclaration.decorators = decorators; + exportDeclaration.modifiers = modifiers; + parseExpected(116); + parseExpected(126); + exportDeclaration.name = parseIdentifier(); + parseExpected(23); + return finishNode(exportDeclaration); + } + function parseImportDeclarationOrImportEqualsDeclaration(fullStart, decorators, modifiers) { + parseExpected(89); + var afterImportPos = scanner.getStartPos(); + var identifier; + if (isIdentifier()) { + identifier = parseIdentifier(); + if (token !== 24 && token !== 136) { + var importEqualsDeclaration = createNode(229, fullStart); + importEqualsDeclaration.decorators = decorators; + setModifiers(importEqualsDeclaration, modifiers); + importEqualsDeclaration.name = identifier; + parseExpected(56); + importEqualsDeclaration.moduleReference = parseModuleReference(); + parseSemicolon(); + return finishNode(importEqualsDeclaration); + } + } + var importDeclaration = createNode(230, fullStart); + importDeclaration.decorators = decorators; + setModifiers(importDeclaration, modifiers); + if (identifier || + token === 37 || + token === 15) { + importDeclaration.importClause = parseImportClause(identifier, afterImportPos); + parseExpected(136); + } + importDeclaration.moduleSpecifier = parseModuleSpecifier(); + parseSemicolon(); + return finishNode(importDeclaration); + } + function parseImportClause(identifier, fullStart) { + var importClause = createNode(231, fullStart); + if (identifier) { + importClause.name = identifier; + } + if (!importClause.name || + parseOptional(24)) { + importClause.namedBindings = token === 37 ? parseNamespaceImport() : parseNamedImportsOrExports(233); + } + return finishNode(importClause); + } + function parseModuleReference() { + return isExternalModuleReference() + ? parseExternalModuleReference() + : parseEntityName(false); + } + function parseExternalModuleReference() { + var node = createNode(240); + parseExpected(129); + parseExpected(17); + node.expression = parseModuleSpecifier(); + parseExpected(18); + return finishNode(node); + } + function parseModuleSpecifier() { + if (token === 9) { + var result = parseLiteralNode(); + internIdentifier(result.text); + return result; + } + else { + return parseExpression(); + } + } + function parseNamespaceImport() { + var namespaceImport = createNode(232); + parseExpected(37); + parseExpected(116); + namespaceImport.name = parseIdentifier(); + return finishNode(namespaceImport); + } + function parseNamedImportsOrExports(kind) { + var node = createNode(kind); + node.elements = parseBracketedList(21, kind === 233 ? parseImportSpecifier : parseExportSpecifier, 15, 16); + return finishNode(node); + } + function parseExportSpecifier() { + return parseImportOrExportSpecifier(238); + } + function parseImportSpecifier() { + return parseImportOrExportSpecifier(234); + } + function parseImportOrExportSpecifier(kind) { + var node = createNode(kind); + var checkIdentifierIsKeyword = ts.isKeyword(token) && !isIdentifier(); + var checkIdentifierStart = scanner.getTokenPos(); + var checkIdentifierEnd = scanner.getTextPos(); + var identifierName = parseIdentifierName(); + if (token === 116) { + node.propertyName = identifierName; + parseExpected(116); + checkIdentifierIsKeyword = ts.isKeyword(token) && !isIdentifier(); + checkIdentifierStart = scanner.getTokenPos(); + checkIdentifierEnd = scanner.getTextPos(); + node.name = parseIdentifierName(); + } + else { + node.name = identifierName; + } + if (kind === 234 && checkIdentifierIsKeyword) { + parseErrorAtPosition(checkIdentifierStart, checkIdentifierEnd - checkIdentifierStart, ts.Diagnostics.Identifier_expected); + } + return finishNode(node); + } + function parseExportDeclaration(fullStart, decorators, modifiers) { + var node = createNode(236, fullStart); + node.decorators = decorators; + setModifiers(node, modifiers); + if (parseOptional(37)) { + parseExpected(136); + node.moduleSpecifier = parseModuleSpecifier(); + } + else { + node.exportClause = parseNamedImportsOrExports(237); + if (token === 136 || (token === 9 && !scanner.hasPrecedingLineBreak())) { + parseExpected(136); + node.moduleSpecifier = parseModuleSpecifier(); + } + } + parseSemicolon(); + return finishNode(node); + } + function parseExportAssignment(fullStart, decorators, modifiers) { + var node = createNode(235, fullStart); + node.decorators = decorators; + setModifiers(node, modifiers); + if (parseOptional(56)) { + node.isExportEquals = true; + } + else { + parseExpected(77); + } + node.expression = parseAssignmentExpressionOrHigher(); + parseSemicolon(); + return finishNode(node); + } + function processReferenceComments(sourceFile) { + var triviaScanner = ts.createScanner(sourceFile.languageVersion, false, 0, sourceText); + var referencedFiles = []; + var typeReferenceDirectives = []; + var amdDependencies = []; + var amdModuleName; + while (true) { + var kind = triviaScanner.scan(); + if (kind !== 2) { + if (ts.isTrivia(kind)) { + continue; + } + else { + break; + } + } + var range = { pos: triviaScanner.getTokenPos(), end: triviaScanner.getTextPos(), kind: triviaScanner.getToken() }; + var comment = sourceText.substring(range.pos, range.end); + var referencePathMatchResult = ts.getFileReferenceFromReferencePath(comment, range); + if (referencePathMatchResult) { + var fileReference = referencePathMatchResult.fileReference; + sourceFile.hasNoDefaultLib = referencePathMatchResult.isNoDefaultLib; + var diagnosticMessage = referencePathMatchResult.diagnosticMessage; + if (fileReference) { + if (referencePathMatchResult.isTypeReferenceDirective) { + typeReferenceDirectives.push(fileReference); + } + else { + referencedFiles.push(fileReference); + } + } + if (diagnosticMessage) { + parseDiagnostics.push(ts.createFileDiagnostic(sourceFile, range.pos, range.end - range.pos, diagnosticMessage)); + } + } + else { + var amdModuleNameRegEx = /^\/\/\/\s*".length; + return parseErrorAtPosition(start, end - start, ts.Diagnostics.Type_argument_list_cannot_be_empty); + } + } + function parseQualifiedName(left) { + var result = createNode(139, left.pos); + result.left = left; + result.right = parseIdentifierName(); + return finishNode(result); + } + function parseJSDocRecordType() { + var result = createNode(265); + nextToken(); + result.members = parseDelimitedList(24, parseJSDocRecordMember); + checkForTrailingComma(result.members); + parseExpected(16); + return finishNode(result); + } + function parseJSDocRecordMember() { + var result = createNode(266); + result.name = parseSimplePropertyName(); + if (token === 54) { + nextToken(); + result.type = parseJSDocType(); + } + return finishNode(result); + } + function parseJSDocNonNullableType() { + var result = createNode(264); + nextToken(); + result.type = parseJSDocType(); + return finishNode(result); + } + function parseJSDocTupleType() { + var result = createNode(262); + nextToken(); + result.types = parseDelimitedList(25, parseJSDocType); + checkForTrailingComma(result.types); + parseExpected(20); + return finishNode(result); + } + function checkForTrailingComma(list) { + if (parseDiagnostics.length === 0 && list.hasTrailingComma) { + var start = list.end - ",".length; + parseErrorAtPosition(start, ",".length, ts.Diagnostics.Trailing_comma_not_allowed); + } + } + function parseJSDocUnionType() { + var result = createNode(261); + nextToken(); + result.types = parseJSDocTypeList(parseJSDocType()); + parseExpected(18); + return finishNode(result); + } + function parseJSDocTypeList(firstType) { + ts.Debug.assert(!!firstType); + var types = []; + types.pos = firstType.pos; + types.push(firstType); + while (parseOptional(47)) { + types.push(parseJSDocType()); + } + types.end = scanner.getStartPos(); + return types; + } + function parseJSDocAllType() { + var result = createNode(258); + nextToken(); + return finishNode(result); + } + function parseJSDocUnknownOrNullableType() { + var pos = scanner.getStartPos(); + nextToken(); + if (token === 24 || + token === 16 || + token === 18 || + token === 27 || + token === 56 || + token === 47) { + var result = createNode(259, pos); + return finishNode(result); + } + else { + var result = createNode(263, pos); + result.type = parseJSDocType(); + return finishNode(result); + } + } + function parseIsolatedJSDocComment(content, start, length) { + initializeState("file.js", content, 2, undefined, 1); + sourceFile = { languageVariant: 0, text: content }; + var jsDocComment = parseJSDocCommentWorker(start, length); + var diagnostics = parseDiagnostics; + clearState(); + return jsDocComment ? { jsDocComment: jsDocComment, diagnostics: diagnostics } : undefined; + } + JSDocParser.parseIsolatedJSDocComment = parseIsolatedJSDocComment; + function parseJSDocComment(parent, start, length) { + var saveToken = token; + var saveParseDiagnosticsLength = parseDiagnostics.length; + var saveParseErrorBeforeNextFinishedNode = parseErrorBeforeNextFinishedNode; + var comment = parseJSDocCommentWorker(start, length); + if (comment) { + comment.parent = parent; + } + token = saveToken; + parseDiagnostics.length = saveParseDiagnosticsLength; + parseErrorBeforeNextFinishedNode = saveParseErrorBeforeNextFinishedNode; + return comment; + } + JSDocParser.parseJSDocComment = parseJSDocComment; + function parseJSDocCommentWorker(start, length) { + var content = sourceText; + start = start || 0; + var end = length === undefined ? content.length : start + length; + length = end - start; + ts.Debug.assert(start >= 0); + ts.Debug.assert(start <= end); + ts.Debug.assert(end <= content.length); + var tags; + var result; + if (content.charCodeAt(start) === 47 && + content.charCodeAt(start + 1) === 42 && + content.charCodeAt(start + 2) === 42 && + content.charCodeAt(start + 3) !== 42) { + scanner.scanRange(start + 3, length - 5, function () { + var canParseTag = true; + var seenAsterisk = true; + nextJSDocToken(); + while (token !== 1) { + switch (token) { + case 55: + if (canParseTag) { + parseTag(); + } + seenAsterisk = false; + break; + case 4: + canParseTag = true; + seenAsterisk = false; + break; + case 37: + if (seenAsterisk) { + canParseTag = false; + } + seenAsterisk = true; + break; + case 69: + canParseTag = false; + break; + case 1: + break; + } + nextJSDocToken(); + } + result = createJSDocComment(); + }); + } + return result; + function createJSDocComment() { + if (!tags) { + return undefined; + } + var result = createNode(273, start); + result.tags = tags; + return finishNode(result, end); + } + function skipWhitespace() { + while (token === 5 || token === 4) { + nextJSDocToken(); + } + } + function parseTag() { + ts.Debug.assert(token === 55); + var atToken = createNode(55, scanner.getTokenPos()); + atToken.end = scanner.getTextPos(); + nextJSDocToken(); + var tagName = parseJSDocIdentifierName(); + if (!tagName) { + return; + } + var tag = handleTag(atToken, tagName) || handleUnknownTag(atToken, tagName); + addTag(tag); + } + function handleTag(atToken, tagName) { + if (tagName) { + switch (tagName.text) { + case "param": + return handleParamTag(atToken, tagName); + case "return": + case "returns": + return handleReturnTag(atToken, tagName); + case "template": + return handleTemplateTag(atToken, tagName); + case "type": + return handleTypeTag(atToken, tagName); + } + } + return undefined; + } + function handleUnknownTag(atToken, tagName) { + var result = createNode(274, atToken.pos); + result.atToken = atToken; + result.tagName = tagName; + return finishNode(result); + } + function addTag(tag) { + if (tag) { + if (!tags) { + tags = []; + tags.pos = tag.pos; + } + tags.push(tag); + tags.end = tag.end; + } + } + function tryParseTypeExpression() { + if (token !== 15) { + return undefined; + } + var typeExpression = parseJSDocTypeExpression(); + return typeExpression; + } + function handleParamTag(atToken, tagName) { + var typeExpression = tryParseTypeExpression(); + skipWhitespace(); + var name; + var isBracketed; + if (parseOptionalToken(19)) { + name = parseJSDocIdentifierName(); + isBracketed = true; + if (parseOptionalToken(56)) { + parseExpression(); + } + parseExpected(20); + } + else if (ts.tokenIsIdentifierOrKeyword(token)) { + name = parseJSDocIdentifierName(); + } + if (!name) { + parseErrorAtPosition(scanner.getStartPos(), 0, ts.Diagnostics.Identifier_expected); + return undefined; + } + var preName, postName; + if (typeExpression) { + postName = name; + } + else { + preName = name; + } + if (!typeExpression) { + typeExpression = tryParseTypeExpression(); + } + var result = createNode(275, atToken.pos); + result.atToken = atToken; + result.tagName = tagName; + result.preParameterName = preName; + result.typeExpression = typeExpression; + result.postParameterName = postName; + result.isBracketed = isBracketed; + return finishNode(result); + } + function handleReturnTag(atToken, tagName) { + if (ts.forEach(tags, function (t) { return t.kind === 276; })) { + parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); + } + var result = createNode(276, atToken.pos); + result.atToken = atToken; + result.tagName = tagName; + result.typeExpression = tryParseTypeExpression(); + return finishNode(result); + } + function handleTypeTag(atToken, tagName) { + if (ts.forEach(tags, function (t) { return t.kind === 277; })) { + parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); + } + var result = createNode(277, atToken.pos); + result.atToken = atToken; + result.tagName = tagName; + result.typeExpression = tryParseTypeExpression(); + return finishNode(result); + } + function handleTemplateTag(atToken, tagName) { + if (ts.forEach(tags, function (t) { return t.kind === 278; })) { + parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); + } + var typeParameters = []; + typeParameters.pos = scanner.getStartPos(); + while (true) { + var name_8 = parseJSDocIdentifierName(); + if (!name_8) { + parseErrorAtPosition(scanner.getStartPos(), 0, ts.Diagnostics.Identifier_expected); + return undefined; + } + var typeParameter = createNode(141, name_8.pos); + typeParameter.name = name_8; + finishNode(typeParameter); + typeParameters.push(typeParameter); + if (token === 24) { + nextJSDocToken(); + } + else { + break; + } + } + var result = createNode(278, atToken.pos); + result.atToken = atToken; + result.tagName = tagName; + result.typeParameters = typeParameters; + finishNode(result); + typeParameters.end = result.end; + return result; + } + function nextJSDocToken() { + return token = scanner.scanJSDocToken(); + } + function parseJSDocIdentifierName() { + return createJSDocIdentifier(ts.tokenIsIdentifierOrKeyword(token)); + } + function createJSDocIdentifier(isIdentifier) { + if (!isIdentifier) { + parseErrorAtCurrentToken(ts.Diagnostics.Identifier_expected); + return undefined; + } + var pos = scanner.getTokenPos(); + var end = scanner.getTextPos(); + var result = createNode(69, pos); + result.text = content.substring(pos, end); + finishNode(result, end); + nextJSDocToken(); + return result; + } + } + JSDocParser.parseJSDocCommentWorker = parseJSDocCommentWorker; + })(JSDocParser = Parser.JSDocParser || (Parser.JSDocParser = {})); + })(Parser || (Parser = {})); + var IncrementalParser; + (function (IncrementalParser) { + function updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks) { + aggressiveChecks = aggressiveChecks || ts.Debug.shouldAssert(2); + checkChangeRange(sourceFile, newText, textChangeRange, aggressiveChecks); + if (ts.textChangeRangeIsUnchanged(textChangeRange)) { + return sourceFile; + } + if (sourceFile.statements.length === 0) { + return Parser.parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, undefined, true, sourceFile.scriptKind); + } + var incrementalSourceFile = sourceFile; + ts.Debug.assert(!incrementalSourceFile.hasBeenIncrementallyParsed); + incrementalSourceFile.hasBeenIncrementallyParsed = true; + var oldText = sourceFile.text; + var syntaxCursor = createSyntaxCursor(sourceFile); + var changeRange = extendToAffectedRange(sourceFile, textChangeRange); + checkChangeRange(sourceFile, newText, changeRange, aggressiveChecks); + ts.Debug.assert(changeRange.span.start <= textChangeRange.span.start); + ts.Debug.assert(ts.textSpanEnd(changeRange.span) === ts.textSpanEnd(textChangeRange.span)); + ts.Debug.assert(ts.textSpanEnd(ts.textChangeRangeNewSpan(changeRange)) === ts.textSpanEnd(ts.textChangeRangeNewSpan(textChangeRange))); + var delta = ts.textChangeRangeNewSpan(changeRange).length - changeRange.span.length; + updateTokenPositionsAndMarkElements(incrementalSourceFile, changeRange.span.start, ts.textSpanEnd(changeRange.span), ts.textSpanEnd(ts.textChangeRangeNewSpan(changeRange)), delta, oldText, newText, aggressiveChecks); + var result = Parser.parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, syntaxCursor, true, sourceFile.scriptKind); + return result; + } + IncrementalParser.updateSourceFile = updateSourceFile; + function moveElementEntirelyPastChangeRange(element, isArray, delta, oldText, newText, aggressiveChecks) { + if (isArray) { + visitArray(element); + } + else { + visitNode(element); + } + return; + function visitNode(node) { + var text = ""; + if (aggressiveChecks && shouldCheckNode(node)) { + text = oldText.substring(node.pos, node.end); + } + if (node._children) { + node._children = undefined; + } + if (node.jsDocComment) { + node.jsDocComment = undefined; + } + node.pos += delta; + node.end += delta; + if (aggressiveChecks && shouldCheckNode(node)) { + ts.Debug.assert(text === newText.substring(node.pos, node.end)); + } + forEachChild(node, visitNode, visitArray); + checkNodePositions(node, aggressiveChecks); + } + function visitArray(array) { + array._children = undefined; + array.pos += delta; + array.end += delta; + for (var _i = 0, array_7 = array; _i < array_7.length; _i++) { + var node = array_7[_i]; + visitNode(node); + } + } + } + function shouldCheckNode(node) { + switch (node.kind) { + case 9: + case 8: + case 69: + return true; + } + return false; + } + function adjustIntersectingElement(element, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta) { + ts.Debug.assert(element.end >= changeStart, "Adjusting an element that was entirely before the change range"); + ts.Debug.assert(element.pos <= changeRangeOldEnd, "Adjusting an element that was entirely after the change range"); + ts.Debug.assert(element.pos <= element.end); + element.pos = Math.min(element.pos, changeRangeNewEnd); + if (element.end >= changeRangeOldEnd) { + element.end += delta; + } + else { + element.end = Math.min(element.end, changeRangeNewEnd); + } + ts.Debug.assert(element.pos <= element.end); + if (element.parent) { + ts.Debug.assert(element.pos >= element.parent.pos); + ts.Debug.assert(element.end <= element.parent.end); + } + } + function checkNodePositions(node, aggressiveChecks) { + if (aggressiveChecks) { + var pos_2 = node.pos; + forEachChild(node, function (child) { + ts.Debug.assert(child.pos >= pos_2); + pos_2 = child.end; + }); + ts.Debug.assert(pos_2 <= node.end); + } + } + function updateTokenPositionsAndMarkElements(sourceFile, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta, oldText, newText, aggressiveChecks) { + visitNode(sourceFile); + return; + function visitNode(child) { + ts.Debug.assert(child.pos <= child.end); + if (child.pos > changeRangeOldEnd) { + moveElementEntirelyPastChangeRange(child, false, delta, oldText, newText, aggressiveChecks); + return; + } + var fullEnd = child.end; + if (fullEnd >= changeStart) { + child.intersectsChange = true; + child._children = undefined; + adjustIntersectingElement(child, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta); + forEachChild(child, visitNode, visitArray); + checkNodePositions(child, aggressiveChecks); + return; + } + ts.Debug.assert(fullEnd < changeStart); + } + function visitArray(array) { + ts.Debug.assert(array.pos <= array.end); + if (array.pos > changeRangeOldEnd) { + moveElementEntirelyPastChangeRange(array, true, delta, oldText, newText, aggressiveChecks); + return; + } + var fullEnd = array.end; + if (fullEnd >= changeStart) { + array.intersectsChange = true; + array._children = undefined; + adjustIntersectingElement(array, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta); + for (var _i = 0, array_8 = array; _i < array_8.length; _i++) { + var node = array_8[_i]; + visitNode(node); + } + return; + } + ts.Debug.assert(fullEnd < changeStart); + } + } + function extendToAffectedRange(sourceFile, changeRange) { + var maxLookahead = 1; + var start = changeRange.span.start; + for (var i = 0; start > 0 && i <= maxLookahead; i++) { + var nearestNode = findNearestNodeStartingBeforeOrAtPosition(sourceFile, start); + ts.Debug.assert(nearestNode.pos <= start); + var position = nearestNode.pos; + start = Math.max(0, position - 1); + } + var finalSpan = ts.createTextSpanFromBounds(start, ts.textSpanEnd(changeRange.span)); + var finalLength = changeRange.newLength + (changeRange.span.start - start); + return ts.createTextChangeRange(finalSpan, finalLength); + } + function findNearestNodeStartingBeforeOrAtPosition(sourceFile, position) { + var bestResult = sourceFile; + var lastNodeEntirelyBeforePosition; + forEachChild(sourceFile, visit); + if (lastNodeEntirelyBeforePosition) { + var lastChildOfLastEntireNodeBeforePosition = getLastChild(lastNodeEntirelyBeforePosition); + if (lastChildOfLastEntireNodeBeforePosition.pos > bestResult.pos) { + bestResult = lastChildOfLastEntireNodeBeforePosition; + } + } + return bestResult; + function getLastChild(node) { + while (true) { + var lastChild = getLastChildWorker(node); + if (lastChild) { + node = lastChild; + } + else { + return node; + } + } + } + function getLastChildWorker(node) { + var last = undefined; + forEachChild(node, function (child) { + if (ts.nodeIsPresent(child)) { + last = child; + } + }); + return last; + } + function visit(child) { + if (ts.nodeIsMissing(child)) { + return; + } + if (child.pos <= position) { + if (child.pos >= bestResult.pos) { + bestResult = child; + } + if (position < child.end) { + forEachChild(child, visit); + return true; + } + else { + ts.Debug.assert(child.end <= position); + lastNodeEntirelyBeforePosition = child; + } + } + else { + ts.Debug.assert(child.pos > position); + return true; + } + } + } + function checkChangeRange(sourceFile, newText, textChangeRange, aggressiveChecks) { + var oldText = sourceFile.text; + if (textChangeRange) { + ts.Debug.assert((oldText.length - textChangeRange.span.length + textChangeRange.newLength) === newText.length); + if (aggressiveChecks || ts.Debug.shouldAssert(3)) { + var oldTextPrefix = oldText.substr(0, textChangeRange.span.start); + var newTextPrefix = newText.substr(0, textChangeRange.span.start); + ts.Debug.assert(oldTextPrefix === newTextPrefix); + var oldTextSuffix = oldText.substring(ts.textSpanEnd(textChangeRange.span), oldText.length); + var newTextSuffix = newText.substring(ts.textSpanEnd(ts.textChangeRangeNewSpan(textChangeRange)), newText.length); + ts.Debug.assert(oldTextSuffix === newTextSuffix); + } + } + } + function createSyntaxCursor(sourceFile) { + var currentArray = sourceFile.statements; + var currentArrayIndex = 0; + ts.Debug.assert(currentArrayIndex < currentArray.length); + var current = currentArray[currentArrayIndex]; + var lastQueriedPosition = -1; + return { + currentNode: function (position) { + if (position !== lastQueriedPosition) { + if (current && current.end === position && currentArrayIndex < (currentArray.length - 1)) { + currentArrayIndex++; + current = currentArray[currentArrayIndex]; + } + if (!current || current.pos !== position) { + findHighestListElementThatStartsAtPosition(position); + } + } + lastQueriedPosition = position; + ts.Debug.assert(!current || current.pos === position); + return current; + } + }; + function findHighestListElementThatStartsAtPosition(position) { + currentArray = undefined; + currentArrayIndex = -1; + current = undefined; + forEachChild(sourceFile, visitNode, visitArray); + return; + function visitNode(node) { + if (position >= node.pos && position < node.end) { + forEachChild(node, visitNode, visitArray); + return true; + } + return false; + } + function visitArray(array) { + if (position >= array.pos && position < array.end) { + for (var i = 0, n = array.length; i < n; i++) { + var child = array[i]; + if (child) { + if (child.pos === position) { + currentArray = array; + currentArrayIndex = i; + current = child; + return true; + } + else { + if (child.pos < position && position < child.end) { + forEachChild(child, visitNode, visitArray); + return true; + } + } + } + } + } + return false; + } + } + } + })(IncrementalParser || (IncrementalParser = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + ts.bindTime = 0; + function getModuleInstanceState(node) { + if (node.kind === 222 || node.kind === 223) { + return 0; + } + else if (ts.isConstEnumDeclaration(node)) { + return 2; + } + else if ((node.kind === 230 || node.kind === 229) && !(node.flags & 1)) { + return 0; + } + else if (node.kind === 226) { + var state_1 = 0; + ts.forEachChild(node, function (n) { + switch (getModuleInstanceState(n)) { + case 0: + return false; + case 2: + state_1 = 2; + return false; + case 1: + state_1 = 1; + return true; + } + }); + return state_1; + } + else if (node.kind === 225) { + return getModuleInstanceState(node.body); + } + else { + return 1; + } + } + ts.getModuleInstanceState = getModuleInstanceState; + var binder = createBinder(); + function bindSourceFile(file, options) { + var start = new Date().getTime(); + binder(file, options); + ts.bindTime += new Date().getTime() - start; + } + ts.bindSourceFile = bindSourceFile; + function createBinder() { + var file; + var options; + var languageVersion; + var parent; + var container; + var blockScopeContainer; + var lastContainer; + var seenThisKeyword; + var hasExplicitReturn; + var currentFlow; + var currentBreakTarget; + var currentContinueTarget; + var currentTrueTarget; + var currentFalseTarget; + var preSwitchCaseFlow; + var activeLabels; + var hasClassExtends; + var hasAsyncFunctions; + var hasDecorators; + var hasParameterDecorators; + var hasJsxSpreadAttribute; + var inStrictMode; + var symbolCount = 0; + var Symbol; + var classifiableNames; + var unreachableFlow = { flags: 1 }; + var reportedUnreachableFlow = { flags: 1 }; + function bindSourceFile(f, opts) { + file = f; + options = opts; + languageVersion = ts.getEmitScriptTarget(options); + inStrictMode = !!file.externalModuleIndicator; + classifiableNames = {}; + symbolCount = 0; + Symbol = ts.objectAllocator.getSymbolConstructor(); + if (!file.locals) { + bind(file); + file.symbolCount = symbolCount; + file.classifiableNames = classifiableNames; + } + file = undefined; + options = undefined; + languageVersion = undefined; + parent = undefined; + container = undefined; + blockScopeContainer = undefined; + lastContainer = undefined; + seenThisKeyword = false; + hasExplicitReturn = false; + currentFlow = undefined; + currentBreakTarget = undefined; + currentContinueTarget = undefined; + currentTrueTarget = undefined; + currentFalseTarget = undefined; + activeLabels = undefined; + hasClassExtends = false; + hasAsyncFunctions = false; + hasDecorators = false; + hasParameterDecorators = false; + hasJsxSpreadAttribute = false; + } + return bindSourceFile; + function createSymbol(flags, name) { + symbolCount++; + return new Symbol(flags, name); + } + function addDeclarationToSymbol(symbol, node, symbolFlags) { + symbol.flags |= symbolFlags; + node.symbol = symbol; + if (!symbol.declarations) { + symbol.declarations = []; + } + symbol.declarations.push(node); + if (symbolFlags & 1952 && !symbol.exports) { + symbol.exports = {}; + } + if (symbolFlags & 6240 && !symbol.members) { + symbol.members = {}; + } + if (symbolFlags & 107455) { + var valueDeclaration = symbol.valueDeclaration; + if (!valueDeclaration || + (valueDeclaration.kind !== node.kind && valueDeclaration.kind === 225)) { + symbol.valueDeclaration = node; + } + } + } + function getDeclarationName(node) { + if (node.name) { + if (ts.isAmbientModule(node)) { + return ts.isGlobalScopeAugmentation(node) ? "__global" : "\"" + node.name.text + "\""; + } + if (node.name.kind === 140) { + var nameExpression = node.name.expression; + if (ts.isStringOrNumericLiteral(nameExpression.kind)) { + return nameExpression.text; + } + ts.Debug.assert(ts.isWellKnownSymbolSyntactically(nameExpression)); + return ts.getPropertyNameForKnownSymbolName(nameExpression.name.text); + } + return node.name.text; + } + switch (node.kind) { + case 148: + return "__constructor"; + case 156: + case 151: + return "__call"; + case 157: + case 152: + return "__new"; + case 153: + return "__index"; + case 236: + return "__export"; + case 235: + return node.isExportEquals ? "export=" : "default"; + case 187: + switch (ts.getSpecialPropertyAssignmentKind(node)) { + case 2: + return "export="; + case 1: + case 4: + return node.left.name.text; + case 3: + return node.left.expression.name.text; + } + ts.Debug.fail("Unknown binary declaration kind"); + break; + case 220: + case 221: + return node.flags & 512 ? "default" : undefined; + case 269: + return ts.isJSDocConstructSignature(node) ? "__new" : "__call"; + case 142: + ts.Debug.assert(node.parent.kind === 269); + var functionType = node.parent; + var index = ts.indexOf(functionType.parameters, node); + return "p" + index; + } + } + function getDisplayName(node) { + return node.name ? ts.declarationNameToString(node.name) : getDeclarationName(node); + } + function declareSymbol(symbolTable, parent, node, includes, excludes) { + ts.Debug.assert(!ts.hasDynamicName(node)); + var isDefaultExport = node.flags & 512; + var name = isDefaultExport && parent ? "default" : getDeclarationName(node); + var symbol; + if (name !== undefined) { + symbol = ts.hasProperty(symbolTable, name) + ? symbolTable[name] + : (symbolTable[name] = createSymbol(0, name)); + if (name && (includes & 788448)) { + classifiableNames[name] = name; + } + if (symbol.flags & excludes) { + if (node.name) { + node.name.parent = node; + } + var message_1 = symbol.flags & 2 + ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 + : ts.Diagnostics.Duplicate_identifier_0; + ts.forEach(symbol.declarations, function (declaration) { + if (declaration.flags & 512) { + message_1 = ts.Diagnostics.A_module_cannot_have_multiple_default_exports; + } + }); + ts.forEach(symbol.declarations, function (declaration) { + file.bindDiagnostics.push(ts.createDiagnosticForNode(declaration.name || declaration, message_1, getDisplayName(declaration))); + }); + file.bindDiagnostics.push(ts.createDiagnosticForNode(node.name || node, message_1, getDisplayName(node))); + symbol = createSymbol(0, name); + } + } + else { + symbol = createSymbol(0, "__missing"); + } + addDeclarationToSymbol(symbol, node, includes); + symbol.parent = parent; + return symbol; + } + function declareModuleMember(node, symbolFlags, symbolExcludes) { + var hasExportModifier = ts.getCombinedNodeFlags(node) & 1; + if (symbolFlags & 8388608) { + if (node.kind === 238 || (node.kind === 229 && hasExportModifier)) { + return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); + } + else { + return declareSymbol(container.locals, undefined, node, symbolFlags, symbolExcludes); + } + } + else { + if (!ts.isAmbientModule(node) && (hasExportModifier || container.flags & 8192)) { + var exportKind = (symbolFlags & 107455 ? 1048576 : 0) | + (symbolFlags & 793056 ? 2097152 : 0) | + (symbolFlags & 1536 ? 4194304 : 0); + var local = declareSymbol(container.locals, undefined, node, exportKind, symbolExcludes); + local.exportSymbol = declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); + node.localSymbol = local; + return local; + } + else { + return declareSymbol(container.locals, undefined, node, symbolFlags, symbolExcludes); + } + } + } + function bindChildren(node) { + var saveParent = parent; + var saveContainer = container; + var savedBlockScopeContainer = blockScopeContainer; + parent = node; + var containerFlags = getContainerFlags(node); + if (containerFlags & 1) { + container = blockScopeContainer = node; + if (containerFlags & 4) { + container.locals = {}; + } + addToContainerChain(container); + } + else if (containerFlags & 2) { + blockScopeContainer = node; + blockScopeContainer.locals = undefined; + } + var savedHasExplicitReturn; + var savedCurrentFlow; + var savedBreakTarget; + var savedContinueTarget; + var savedActiveLabels; + var kind = node.kind; + var flags = node.flags; + flags &= ~98304; + flags &= ~3932160; + if (kind === 222) { + seenThisKeyword = false; + } + var saveState = kind === 256 || kind === 226 || ts.isFunctionLikeKind(kind); + if (saveState) { + savedHasExplicitReturn = hasExplicitReturn; + savedCurrentFlow = currentFlow; + savedBreakTarget = currentBreakTarget; + savedContinueTarget = currentContinueTarget; + savedActiveLabels = activeLabels; + hasExplicitReturn = false; + currentFlow = { flags: 2 }; + currentBreakTarget = undefined; + currentContinueTarget = undefined; + activeLabels = undefined; + } + if (ts.isInJavaScriptFile(node) && node.jsDocComment) { + bind(node.jsDocComment); + } + bindReachableStatement(node); + if (!(currentFlow.flags & 1) && ts.isFunctionLikeKind(kind) && ts.nodeIsPresent(node.body)) { + flags |= 32768; + if (hasExplicitReturn) { + flags |= 65536; + } + } + if (kind === 222) { + flags = seenThisKeyword ? flags | 16384 : flags & ~16384; + } + if (kind === 256) { + if (hasClassExtends) { + flags |= 262144; + } + if (hasDecorators) { + flags |= 524288; + } + if (hasParameterDecorators) { + flags |= 1048576; + } + if (hasAsyncFunctions) { + flags |= 2097152; + } + if (hasJsxSpreadAttribute) { + flags |= 1073741824; + } + } + node.flags = flags; + if (saveState) { + hasExplicitReturn = savedHasExplicitReturn; + currentFlow = savedCurrentFlow; + currentBreakTarget = savedBreakTarget; + currentContinueTarget = savedContinueTarget; + activeLabels = savedActiveLabels; + } + container = saveContainer; + parent = saveParent; + blockScopeContainer = savedBlockScopeContainer; + } + function bindReachableStatement(node) { + if (checkUnreachable(node)) { + ts.forEachChild(node, bind); + return; + } + switch (node.kind) { + case 205: + bindWhileStatement(node); + break; + case 204: + bindDoStatement(node); + break; + case 206: + bindForStatement(node); + break; + case 207: + case 208: + bindForInOrForOfStatement(node); + break; + case 203: + bindIfStatement(node); + break; + case 211: + case 215: + bindReturnOrThrow(node); + break; + case 210: + case 209: + bindBreakOrContinueStatement(node); + break; + case 216: + bindTryStatement(node); + break; + case 213: + bindSwitchStatement(node); + break; + case 227: + bindCaseBlock(node); + break; + case 214: + bindLabeledStatement(node); + break; + case 185: + bindPrefixUnaryExpressionFlow(node); + break; + case 187: + bindBinaryExpressionFlow(node); + break; + case 181: + bindDeleteExpressionFlow(node); + break; + case 188: + bindConditionalExpressionFlow(node); + break; + case 218: + bindVariableDeclarationFlow(node); + break; + default: + ts.forEachChild(node, bind); + break; + } + } + function isNarrowableReference(expr) { + return expr.kind === 69 || + expr.kind === 97 || + expr.kind === 172 && isNarrowableReference(expr.expression); + } + function isNarrowingExpression(expr) { + switch (expr.kind) { + case 69: + case 97: + case 172: + return isNarrowableReference(expr); + case 174: + return true; + case 178: + return isNarrowingExpression(expr.expression); + case 187: + return isNarrowingBinaryExpression(expr); + case 185: + return expr.operator === 49 && isNarrowingExpression(expr.operand); + } + return false; + } + function isNarrowingBinaryExpression(expr) { + switch (expr.operatorToken.kind) { + case 56: + return isNarrowableReference(expr.left); + case 30: + case 31: + case 32: + case 33: + if (isNarrowingExpression(expr.left) && (expr.right.kind === 93 || expr.right.kind === 69)) { + return true; + } + if (expr.left.kind === 182 && isNarrowingExpression(expr.left.expression) && expr.right.kind === 9) { + return true; + } + return false; + case 91: + return isNarrowingExpression(expr.left); + case 24: + return isNarrowingExpression(expr.right); + } + return false; + } + function createBranchLabel() { + return { + flags: 4, + antecedents: undefined + }; + } + function createLoopLabel() { + return { + flags: 8, + antecedents: undefined + }; + } + function setFlowNodeReferenced(flow) { + flow.flags |= flow.flags & 128 ? 256 : 128; + } + function addAntecedent(label, antecedent) { + if (!(antecedent.flags & 1) && !ts.contains(label.antecedents, antecedent)) { + (label.antecedents || (label.antecedents = [])).push(antecedent); + setFlowNodeReferenced(antecedent); + } + } + function createFlowCondition(flags, antecedent, expression) { + if (antecedent.flags & 1) { + return antecedent; + } + if (!expression) { + return flags & 32 ? antecedent : unreachableFlow; + } + if (expression.kind === 99 && flags & 64 || + expression.kind === 84 && flags & 32) { + return unreachableFlow; + } + if (!isNarrowingExpression(expression)) { + return antecedent; + } + setFlowNodeReferenced(antecedent); + return { + flags: flags, + antecedent: antecedent, + expression: expression + }; + } + function createFlowAssignment(antecedent, node) { + setFlowNodeReferenced(antecedent); + return { + flags: 16, + antecedent: antecedent, + node: node + }; + } + function finishFlowLabel(flow) { + var antecedents = flow.antecedents; + if (!antecedents) { + return unreachableFlow; + } + if (antecedents.length === 1) { + return antecedents[0]; + } + return flow; + } + function isStatementCondition(node) { + var parent = node.parent; + switch (parent.kind) { + case 203: + case 205: + case 204: + return parent.expression === node; + case 206: + case 188: + return parent.condition === node; + } + return false; + } + function isLogicalExpression(node) { + while (true) { + if (node.kind === 178) { + node = node.expression; + } + else if (node.kind === 185 && node.operator === 49) { + node = node.operand; + } + else { + return node.kind === 187 && (node.operatorToken.kind === 51 || + node.operatorToken.kind === 52); + } + } + } + function isTopLevelLogicalExpression(node) { + while (node.parent.kind === 178 || + node.parent.kind === 185 && + node.parent.operator === 49) { + node = node.parent; + } + return !isStatementCondition(node) && !isLogicalExpression(node.parent); + } + function bindCondition(node, trueTarget, falseTarget) { + var saveTrueTarget = currentTrueTarget; + var saveFalseTarget = currentFalseTarget; + currentTrueTarget = trueTarget; + currentFalseTarget = falseTarget; + bind(node); + currentTrueTarget = saveTrueTarget; + currentFalseTarget = saveFalseTarget; + if (!node || !isLogicalExpression(node)) { + addAntecedent(trueTarget, createFlowCondition(32, currentFlow, node)); + addAntecedent(falseTarget, createFlowCondition(64, currentFlow, node)); + } + } + function bindIterativeStatement(node, breakTarget, continueTarget) { + var saveBreakTarget = currentBreakTarget; + var saveContinueTarget = currentContinueTarget; + currentBreakTarget = breakTarget; + currentContinueTarget = continueTarget; + bind(node); + currentBreakTarget = saveBreakTarget; + currentContinueTarget = saveContinueTarget; + } + function bindWhileStatement(node) { + var preWhileLabel = createLoopLabel(); + var preBodyLabel = createBranchLabel(); + var postWhileLabel = createBranchLabel(); + addAntecedent(preWhileLabel, currentFlow); + currentFlow = preWhileLabel; + bindCondition(node.expression, preBodyLabel, postWhileLabel); + currentFlow = finishFlowLabel(preBodyLabel); + bindIterativeStatement(node.statement, postWhileLabel, preWhileLabel); + addAntecedent(preWhileLabel, currentFlow); + currentFlow = finishFlowLabel(postWhileLabel); + } + function bindDoStatement(node) { + var preDoLabel = createLoopLabel(); + var preConditionLabel = createBranchLabel(); + var postDoLabel = createBranchLabel(); + addAntecedent(preDoLabel, currentFlow); + currentFlow = preDoLabel; + bindIterativeStatement(node.statement, postDoLabel, preConditionLabel); + addAntecedent(preConditionLabel, currentFlow); + currentFlow = finishFlowLabel(preConditionLabel); + bindCondition(node.expression, preDoLabel, postDoLabel); + currentFlow = finishFlowLabel(postDoLabel); + } + function bindForStatement(node) { + var preLoopLabel = createLoopLabel(); + var preBodyLabel = createBranchLabel(); + var postLoopLabel = createBranchLabel(); + bind(node.initializer); + addAntecedent(preLoopLabel, currentFlow); + currentFlow = preLoopLabel; + bindCondition(node.condition, preBodyLabel, postLoopLabel); + currentFlow = finishFlowLabel(preBodyLabel); + bindIterativeStatement(node.statement, postLoopLabel, preLoopLabel); + bind(node.incrementor); + addAntecedent(preLoopLabel, currentFlow); + currentFlow = finishFlowLabel(postLoopLabel); + } + function bindForInOrForOfStatement(node) { + var preLoopLabel = createLoopLabel(); + var postLoopLabel = createBranchLabel(); + addAntecedent(preLoopLabel, currentFlow); + currentFlow = preLoopLabel; + bind(node.expression); + addAntecedent(postLoopLabel, currentFlow); + bind(node.initializer); + if (node.initializer.kind !== 219) { + bindAssignmentTargetFlow(node.initializer); + } + bindIterativeStatement(node.statement, postLoopLabel, preLoopLabel); + addAntecedent(preLoopLabel, currentFlow); + currentFlow = finishFlowLabel(postLoopLabel); + } + function bindIfStatement(node) { + var thenLabel = createBranchLabel(); + var elseLabel = createBranchLabel(); + var postIfLabel = createBranchLabel(); + bindCondition(node.expression, thenLabel, elseLabel); + currentFlow = finishFlowLabel(thenLabel); + bind(node.thenStatement); + addAntecedent(postIfLabel, currentFlow); + currentFlow = finishFlowLabel(elseLabel); + bind(node.elseStatement); + addAntecedent(postIfLabel, currentFlow); + currentFlow = finishFlowLabel(postIfLabel); + } + function bindReturnOrThrow(node) { + bind(node.expression); + if (node.kind === 211) { + hasExplicitReturn = true; + } + currentFlow = unreachableFlow; + } + function findActiveLabel(name) { + if (activeLabels) { + for (var _i = 0, activeLabels_1 = activeLabels; _i < activeLabels_1.length; _i++) { + var label = activeLabels_1[_i]; + if (label.name === name) { + return label; + } + } + } + return undefined; + } + function bindbreakOrContinueFlow(node, breakTarget, continueTarget) { + var flowLabel = node.kind === 210 ? breakTarget : continueTarget; + if (flowLabel) { + addAntecedent(flowLabel, currentFlow); + currentFlow = unreachableFlow; + } + } + function bindBreakOrContinueStatement(node) { + bind(node.label); + if (node.label) { + var activeLabel = findActiveLabel(node.label.text); + if (activeLabel) { + activeLabel.referenced = true; + bindbreakOrContinueFlow(node, activeLabel.breakTarget, activeLabel.continueTarget); + } + } + else { + bindbreakOrContinueFlow(node, currentBreakTarget, currentContinueTarget); + } + } + function bindTryStatement(node) { + var postFinallyLabel = createBranchLabel(); + var preTryFlow = currentFlow; + bind(node.tryBlock); + addAntecedent(postFinallyLabel, currentFlow); + if (node.catchClause) { + currentFlow = preTryFlow; + bind(node.catchClause); + addAntecedent(postFinallyLabel, currentFlow); + } + if (node.finallyBlock) { + currentFlow = preTryFlow; + bind(node.finallyBlock); + } + currentFlow = finishFlowLabel(postFinallyLabel); + } + function bindSwitchStatement(node) { + var postSwitchLabel = createBranchLabel(); + bind(node.expression); + var saveBreakTarget = currentBreakTarget; + var savePreSwitchCaseFlow = preSwitchCaseFlow; + currentBreakTarget = postSwitchLabel; + preSwitchCaseFlow = currentFlow; + bind(node.caseBlock); + addAntecedent(postSwitchLabel, currentFlow); + var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 250; }); + if (!hasDefault) { + addAntecedent(postSwitchLabel, preSwitchCaseFlow); + } + currentBreakTarget = saveBreakTarget; + preSwitchCaseFlow = savePreSwitchCaseFlow; + currentFlow = finishFlowLabel(postSwitchLabel); + } + function bindCaseBlock(node) { + var clauses = node.clauses; + for (var i = 0; i < clauses.length; i++) { + var clause = clauses[i]; + if (clause.statements.length) { + if (currentFlow.flags & 1) { + currentFlow = preSwitchCaseFlow; + } + else { + var preCaseLabel = createBranchLabel(); + addAntecedent(preCaseLabel, preSwitchCaseFlow); + addAntecedent(preCaseLabel, currentFlow); + currentFlow = finishFlowLabel(preCaseLabel); + } + bind(clause); + if (!(currentFlow.flags & 1) && i !== clauses.length - 1 && options.noFallthroughCasesInSwitch) { + errorOnFirstToken(clause, ts.Diagnostics.Fallthrough_case_in_switch); + } + } + else { + bind(clause); + } + } + } + function pushActiveLabel(name, breakTarget, continueTarget) { + var activeLabel = { + name: name, + breakTarget: breakTarget, + continueTarget: continueTarget, + referenced: false + }; + (activeLabels || (activeLabels = [])).push(activeLabel); + return activeLabel; + } + function popActiveLabel() { + activeLabels.pop(); + } + function bindLabeledStatement(node) { + var preStatementLabel = createLoopLabel(); + var postStatementLabel = createBranchLabel(); + bind(node.label); + addAntecedent(preStatementLabel, currentFlow); + var activeLabel = pushActiveLabel(node.label.text, postStatementLabel, preStatementLabel); + bind(node.statement); + popActiveLabel(); + if (!activeLabel.referenced && !options.allowUnusedLabels) { + file.bindDiagnostics.push(ts.createDiagnosticForNode(node.label, ts.Diagnostics.Unused_label)); + } + addAntecedent(postStatementLabel, currentFlow); + currentFlow = finishFlowLabel(postStatementLabel); + } + function bindDestructuringTargetFlow(node) { + if (node.kind === 187 && node.operatorToken.kind === 56) { + bindAssignmentTargetFlow(node.left); + } + else { + bindAssignmentTargetFlow(node); + } + } + function bindAssignmentTargetFlow(node) { + if (isNarrowableReference(node)) { + currentFlow = createFlowAssignment(currentFlow, node); + } + else if (node.kind === 170) { + for (var _i = 0, _a = node.elements; _i < _a.length; _i++) { + var e = _a[_i]; + if (e.kind === 191) { + bindAssignmentTargetFlow(e.expression); + } + else { + bindDestructuringTargetFlow(e); + } + } + } + else if (node.kind === 171) { + for (var _b = 0, _c = node.properties; _b < _c.length; _b++) { + var p = _c[_b]; + if (p.kind === 253) { + bindDestructuringTargetFlow(p.initializer); + } + else if (p.kind === 254) { + bindAssignmentTargetFlow(p.name); + } + } + } + } + function bindLogicalExpression(node, trueTarget, falseTarget) { + var preRightLabel = createBranchLabel(); + if (node.operatorToken.kind === 51) { + bindCondition(node.left, preRightLabel, falseTarget); + } + else { + bindCondition(node.left, trueTarget, preRightLabel); + } + currentFlow = finishFlowLabel(preRightLabel); + bind(node.operatorToken); + bindCondition(node.right, trueTarget, falseTarget); + } + function bindPrefixUnaryExpressionFlow(node) { + if (node.operator === 49) { + var saveTrueTarget = currentTrueTarget; + currentTrueTarget = currentFalseTarget; + currentFalseTarget = saveTrueTarget; + ts.forEachChild(node, bind); + currentFalseTarget = currentTrueTarget; + currentTrueTarget = saveTrueTarget; + } + else { + ts.forEachChild(node, bind); + } + } + function bindBinaryExpressionFlow(node) { + var operator = node.operatorToken.kind; + if (operator === 51 || operator === 52) { + if (isTopLevelLogicalExpression(node)) { + var postExpressionLabel = createBranchLabel(); + bindLogicalExpression(node, postExpressionLabel, postExpressionLabel); + currentFlow = finishFlowLabel(postExpressionLabel); + } + else { + bindLogicalExpression(node, currentTrueTarget, currentFalseTarget); + } + } + else { + ts.forEachChild(node, bind); + if (operator === 56 && !ts.isAssignmentTarget(node)) { + bindAssignmentTargetFlow(node.left); + } + } + } + function bindDeleteExpressionFlow(node) { + ts.forEachChild(node, bind); + if (node.expression.kind === 172) { + bindAssignmentTargetFlow(node.expression); + } + } + function bindConditionalExpressionFlow(node) { + var trueLabel = createBranchLabel(); + var falseLabel = createBranchLabel(); + var postExpressionLabel = createBranchLabel(); + bindCondition(node.condition, trueLabel, falseLabel); + currentFlow = finishFlowLabel(trueLabel); + bind(node.whenTrue); + addAntecedent(postExpressionLabel, currentFlow); + currentFlow = finishFlowLabel(falseLabel); + bind(node.whenFalse); + addAntecedent(postExpressionLabel, currentFlow); + currentFlow = finishFlowLabel(postExpressionLabel); + } + function bindInitializedVariableFlow(node) { + var name = node.name; + if (ts.isBindingPattern(name)) { + for (var _i = 0, _a = name.elements; _i < _a.length; _i++) { + var child = _a[_i]; + bindInitializedVariableFlow(child); + } + } + else { + currentFlow = createFlowAssignment(currentFlow, node); + } + } + function bindVariableDeclarationFlow(node) { + ts.forEachChild(node, bind); + if (node.initializer || node.parent.parent.kind === 207 || node.parent.parent.kind === 208) { + bindInitializedVariableFlow(node); + } + } + function getContainerFlags(node) { + switch (node.kind) { + case 192: + case 221: + case 222: + case 224: + case 171: + case 159: + case 265: + return 1; + case 151: + case 152: + case 153: + case 147: + case 146: + case 220: + case 148: + case 149: + case 150: + case 156: + case 269: + case 157: + case 179: + case 180: + case 225: + case 256: + case 223: + return 5; + case 252: + case 206: + case 207: + case 208: + case 227: + return 2; + case 199: + return ts.isFunctionLike(node.parent) ? 0 : 2; + } + return 0; + } + function addToContainerChain(next) { + if (lastContainer) { + lastContainer.nextContainer = next; + } + lastContainer = next; + } + function declareSymbolAndAddToSymbolTable(node, symbolFlags, symbolExcludes) { + declareSymbolAndAddToSymbolTableWorker(node, symbolFlags, symbolExcludes); + } + function declareSymbolAndAddToSymbolTableWorker(node, symbolFlags, symbolExcludes) { + switch (container.kind) { + case 225: + return declareModuleMember(node, symbolFlags, symbolExcludes); + case 256: + return declareSourceFileMember(node, symbolFlags, symbolExcludes); + case 192: + case 221: + return declareClassMember(node, symbolFlags, symbolExcludes); + case 224: + return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); + case 159: + case 171: + case 222: + case 265: + return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); + case 156: + case 157: + case 151: + case 152: + case 153: + case 147: + case 146: + case 148: + case 149: + case 150: + case 220: + case 179: + case 180: + case 269: + case 223: + return declareSymbol(container.locals, undefined, node, symbolFlags, symbolExcludes); + } + } + function declareClassMember(node, symbolFlags, symbolExcludes) { + return node.flags & 32 + ? declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes) + : declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); + } + function declareSourceFileMember(node, symbolFlags, symbolExcludes) { + return ts.isExternalModule(file) + ? declareModuleMember(node, symbolFlags, symbolExcludes) + : declareSymbol(file.locals, undefined, node, symbolFlags, symbolExcludes); + } + function hasExportDeclarations(node) { + var body = node.kind === 256 ? node : node.body; + if (body.kind === 256 || body.kind === 226) { + for (var _i = 0, _a = body.statements; _i < _a.length; _i++) { + var stat = _a[_i]; + if (stat.kind === 236 || stat.kind === 235) { + return true; + } + } + } + return false; + } + function setExportContextFlag(node) { + if (ts.isInAmbientContext(node) && !hasExportDeclarations(node)) { + node.flags |= 8192; + } + else { + node.flags &= ~8192; + } + } + function bindModuleDeclaration(node) { + setExportContextFlag(node); + if (ts.isAmbientModule(node)) { + if (node.flags & 1) { + errorOnFirstToken(node, ts.Diagnostics.export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always_visible); + } + if (ts.isExternalModuleAugmentation(node)) { + declareSymbolAndAddToSymbolTable(node, 1024, 0); + } + else { + declareSymbolAndAddToSymbolTable(node, 512, 106639); + } + } + else { + var state = getModuleInstanceState(node); + if (state === 0) { + declareSymbolAndAddToSymbolTable(node, 1024, 0); + } + else { + declareSymbolAndAddToSymbolTable(node, 512, 106639); + if (node.symbol.flags & (16 | 32 | 256)) { + node.symbol.constEnumOnlyModule = false; + } + else { + var currentModuleIsConstEnumOnly = state === 2; + if (node.symbol.constEnumOnlyModule === undefined) { + node.symbol.constEnumOnlyModule = currentModuleIsConstEnumOnly; + } + else { + node.symbol.constEnumOnlyModule = node.symbol.constEnumOnlyModule && currentModuleIsConstEnumOnly; + } + } + } + } + } + function bindFunctionOrConstructorType(node) { + var symbol = createSymbol(131072, getDeclarationName(node)); + addDeclarationToSymbol(symbol, node, 131072); + var typeLiteralSymbol = createSymbol(2048, "__type"); + addDeclarationToSymbol(typeLiteralSymbol, node, 2048); + typeLiteralSymbol.members = (_a = {}, _a[symbol.name] = symbol, _a); + var _a; + } + function bindObjectLiteralExpression(node) { + if (inStrictMode) { + var seen = {}; + for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { + var prop = _a[_i]; + if (prop.name.kind !== 69) { + continue; + } + var identifier = prop.name; + var currentKind = prop.kind === 253 || prop.kind === 254 || prop.kind === 147 + ? 1 + : 2; + var existingKind = seen[identifier.text]; + if (!existingKind) { + seen[identifier.text] = currentKind; + continue; + } + if (currentKind === 1 && existingKind === 1) { + var span = ts.getErrorSpanForNode(file, identifier); + file.bindDiagnostics.push(ts.createFileDiagnostic(file, span.start, span.length, ts.Diagnostics.An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode)); + } + } + } + return bindAnonymousDeclaration(node, 4096, "__object"); + } + function bindAnonymousDeclaration(node, symbolFlags, name) { + var symbol = createSymbol(symbolFlags, name); + addDeclarationToSymbol(symbol, node, symbolFlags); + } + function bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) { + switch (blockScopeContainer.kind) { + case 225: + declareModuleMember(node, symbolFlags, symbolExcludes); + break; + case 256: + if (ts.isExternalModule(container)) { + declareModuleMember(node, symbolFlags, symbolExcludes); + break; + } + default: + if (!blockScopeContainer.locals) { + blockScopeContainer.locals = {}; + addToContainerChain(blockScopeContainer); + } + declareSymbol(blockScopeContainer.locals, undefined, node, symbolFlags, symbolExcludes); + } + } + function bindBlockScopedVariableDeclaration(node) { + bindBlockScopedDeclaration(node, 2, 107455); + } + function checkStrictModeIdentifier(node) { + if (inStrictMode && + node.originalKeywordKind >= 106 && + node.originalKeywordKind <= 114 && + !ts.isIdentifierName(node) && + !ts.isInAmbientContext(node)) { + if (!file.parseDiagnostics.length) { + file.bindDiagnostics.push(ts.createDiagnosticForNode(node, getStrictModeIdentifierMessage(node), ts.declarationNameToString(node))); + } + } + } + function getStrictModeIdentifierMessage(node) { + if (ts.getContainingClass(node)) { + return ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode; + } + if (file.externalModuleIndicator) { + return ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode; + } + return ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode; + } + function checkStrictModeBinaryExpression(node) { + if (inStrictMode && ts.isLeftHandSideExpression(node.left) && ts.isAssignmentOperator(node.operatorToken.kind)) { + checkStrictModeEvalOrArguments(node, node.left); + } + } + function checkStrictModeCatchClause(node) { + if (inStrictMode && node.variableDeclaration) { + checkStrictModeEvalOrArguments(node, node.variableDeclaration.name); + } + } + function checkStrictModeDeleteExpression(node) { + if (inStrictMode && node.expression.kind === 69) { + var span = ts.getErrorSpanForNode(file, node.expression); + file.bindDiagnostics.push(ts.createFileDiagnostic(file, span.start, span.length, ts.Diagnostics.delete_cannot_be_called_on_an_identifier_in_strict_mode)); + } + } + function isEvalOrArgumentsIdentifier(node) { + return node.kind === 69 && + (node.text === "eval" || node.text === "arguments"); + } + function checkStrictModeEvalOrArguments(contextNode, name) { + if (name && name.kind === 69) { + var identifier = name; + if (isEvalOrArgumentsIdentifier(identifier)) { + var span = ts.getErrorSpanForNode(file, name); + file.bindDiagnostics.push(ts.createFileDiagnostic(file, span.start, span.length, getStrictModeEvalOrArgumentsMessage(contextNode), identifier.text)); + } + } + } + function getStrictModeEvalOrArgumentsMessage(node) { + if (ts.getContainingClass(node)) { + return ts.Diagnostics.Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode; + } + if (file.externalModuleIndicator) { + return ts.Diagnostics.Invalid_use_of_0_Modules_are_automatically_in_strict_mode; + } + return ts.Diagnostics.Invalid_use_of_0_in_strict_mode; + } + function checkStrictModeFunctionName(node) { + if (inStrictMode) { + checkStrictModeEvalOrArguments(node, node.name); + } + } + function getStrictModeBlockScopeFunctionDeclarationMessage(node) { + if (ts.getContainingClass(node)) { + return ts.Diagnostics.Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Class_definitions_are_automatically_in_strict_mode; + } + if (file.externalModuleIndicator) { + return ts.Diagnostics.Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Modules_are_automatically_in_strict_mode; + } + return ts.Diagnostics.Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5; + } + function checkStrictModeFunctionDeclaration(node) { + if (languageVersion < 2) { + if (blockScopeContainer.kind !== 256 && + blockScopeContainer.kind !== 225 && + !ts.isFunctionLike(blockScopeContainer)) { + var errorSpan = ts.getErrorSpanForNode(file, node); + file.bindDiagnostics.push(ts.createFileDiagnostic(file, errorSpan.start, errorSpan.length, getStrictModeBlockScopeFunctionDeclarationMessage(node))); + } + } + } + function checkStrictModeNumericLiteral(node) { + if (inStrictMode && node.isOctalLiteral) { + file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Octal_literals_are_not_allowed_in_strict_mode)); + } + } + function checkStrictModePostfixUnaryExpression(node) { + if (inStrictMode) { + checkStrictModeEvalOrArguments(node, node.operand); + } + } + function checkStrictModePrefixUnaryExpression(node) { + if (inStrictMode) { + if (node.operator === 41 || node.operator === 42) { + checkStrictModeEvalOrArguments(node, node.operand); + } + } + } + function checkStrictModeWithStatement(node) { + if (inStrictMode) { + errorOnFirstToken(node, ts.Diagnostics.with_statements_are_not_allowed_in_strict_mode); + } + } + function errorOnFirstToken(node, message, arg0, arg1, arg2) { + var span = ts.getSpanOfTokenAtPosition(file, node.pos); + file.bindDiagnostics.push(ts.createFileDiagnostic(file, span.start, span.length, message, arg0, arg1, arg2)); + } + function getDestructuringParameterName(node) { + return "__" + ts.indexOf(node.parent.parameters, node); + } + function bind(node) { + if (!node) { + return; + } + node.parent = parent; + var savedInStrictMode = inStrictMode; + if (!savedInStrictMode) { + updateStrictMode(node); + } + bindWorker(node); + bindChildren(node); + inStrictMode = savedInStrictMode; + } + function updateStrictMode(node) { + switch (node.kind) { + case 256: + case 226: + updateStrictModeStatementList(node.statements); + return; + case 199: + if (ts.isFunctionLike(node.parent)) { + updateStrictModeStatementList(node.statements); + } + return; + case 221: + case 192: + inStrictMode = true; + return; + } + } + function updateStrictModeStatementList(statements) { + for (var _i = 0, statements_1 = statements; _i < statements_1.length; _i++) { + var statement = statements_1[_i]; + if (!ts.isPrologueDirective(statement)) { + return; + } + if (isUseStrictPrologueDirective(statement)) { + inStrictMode = true; + return; + } + } + } + function isUseStrictPrologueDirective(node) { + var nodeText = ts.getTextOfNodeFromSourceText(file.text, node.expression); + return nodeText === '"use strict"' || nodeText === "'use strict'"; + } + function bindWorker(node) { + switch (node.kind) { + case 69: + case 97: + if (currentFlow && (ts.isExpression(node) || parent.kind === 254)) { + node.flowNode = currentFlow; + } + return checkStrictModeIdentifier(node); + case 172: + if (currentFlow && isNarrowableReference(node)) { + node.flowNode = currentFlow; + } + break; + case 187: + if (ts.isInJavaScriptFile(node)) { + var specialKind = ts.getSpecialPropertyAssignmentKind(node); + switch (specialKind) { + case 1: + bindExportsPropertyAssignment(node); + break; + case 2: + bindModuleExportsAssignment(node); + break; + case 3: + bindPrototypePropertyAssignment(node); + break; + case 4: + bindThisPropertyAssignment(node); + break; + case 0: + break; + default: + ts.Debug.fail("Unknown special property assignment kind"); + } + } + return checkStrictModeBinaryExpression(node); + case 252: + return checkStrictModeCatchClause(node); + case 181: + return checkStrictModeDeleteExpression(node); + case 8: + return checkStrictModeNumericLiteral(node); + case 186: + return checkStrictModePostfixUnaryExpression(node); + case 185: + return checkStrictModePrefixUnaryExpression(node); + case 212: + return checkStrictModeWithStatement(node); + case 165: + seenThisKeyword = true; + return; + case 154: + return checkTypePredicate(node); + case 141: + return declareSymbolAndAddToSymbolTable(node, 262144, 530912); + case 142: + return bindParameter(node); + case 218: + case 169: + return bindVariableDeclarationOrBindingElement(node); + case 145: + case 144: + case 266: + return bindPropertyOrMethodOrAccessor(node, 4 | (node.questionToken ? 536870912 : 0), 107455); + case 253: + case 254: + return bindPropertyOrMethodOrAccessor(node, 4, 107455); + case 255: + return bindPropertyOrMethodOrAccessor(node, 8, 107455); + case 247: + hasJsxSpreadAttribute = true; + return; + case 151: + case 152: + case 153: + return declareSymbolAndAddToSymbolTable(node, 131072, 0); + case 147: + case 146: + return bindPropertyOrMethodOrAccessor(node, 8192 | (node.questionToken ? 536870912 : 0), ts.isObjectLiteralMethod(node) ? 107455 : 99263); + case 220: + return bindFunctionDeclaration(node); + case 148: + return declareSymbolAndAddToSymbolTable(node, 16384, 0); + case 149: + return bindPropertyOrMethodOrAccessor(node, 32768, 41919); + case 150: + return bindPropertyOrMethodOrAccessor(node, 65536, 74687); + case 156: + case 157: + case 269: + return bindFunctionOrConstructorType(node); + case 159: + case 265: + return bindAnonymousDeclaration(node, 2048, "__type"); + case 171: + return bindObjectLiteralExpression(node); + case 179: + case 180: + return bindFunctionExpression(node); + case 174: + if (ts.isInJavaScriptFile(node)) { + bindCallExpression(node); + } + break; + case 192: + case 221: + return bindClassLikeDeclaration(node); + case 222: + return bindBlockScopedDeclaration(node, 64, 792960); + case 223: + return bindBlockScopedDeclaration(node, 524288, 793056); + case 224: + return bindEnumDeclaration(node); + case 225: + return bindModuleDeclaration(node); + case 229: + case 232: + case 234: + case 238: + return declareSymbolAndAddToSymbolTable(node, 8388608, 8388608); + case 228: + return bindGlobalModuleExportDeclaration(node); + case 231: + return bindImportClause(node); + case 236: + return bindExportDeclaration(node); + case 235: + return bindExportAssignment(node); + case 256: + return bindSourceFileIfExternalModule(); + } + } + function checkTypePredicate(node) { + var parameterName = node.parameterName, type = node.type; + if (parameterName && parameterName.kind === 69) { + checkStrictModeIdentifier(parameterName); + } + if (parameterName && parameterName.kind === 165) { + seenThisKeyword = true; + } + bind(type); + } + function bindSourceFileIfExternalModule() { + setExportContextFlag(file); + if (ts.isExternalModule(file)) { + bindSourceFileAsExternalModule(); + } + } + function bindSourceFileAsExternalModule() { + bindAnonymousDeclaration(file, 512, "\"" + ts.removeFileExtension(file.fileName) + "\""); + } + function bindExportAssignment(node) { + var boundExpression = node.kind === 235 ? node.expression : node.right; + if (!container.symbol || !container.symbol.exports) { + bindAnonymousDeclaration(node, 8388608, getDeclarationName(node)); + } + else if (boundExpression.kind === 69 && node.kind === 235) { + declareSymbol(container.symbol.exports, container.symbol, node, 8388608, 107455 | 8388608); + } + else { + declareSymbol(container.symbol.exports, container.symbol, node, 4, 107455 | 8388608); + } + } + function bindGlobalModuleExportDeclaration(node) { + if (node.modifiers && node.modifiers.length) { + file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Modifiers_cannot_appear_here)); + } + if (node.parent.kind !== 256) { + file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_at_top_level)); + return; + } + else { + var parent_5 = node.parent; + if (!ts.isExternalModule(parent_5)) { + file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_in_module_files)); + return; + } + if (!parent_5.isDeclarationFile) { + file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_in_declaration_files)); + return; + } + } + file.symbol.globalExports = file.symbol.globalExports || {}; + declareSymbol(file.symbol.globalExports, file.symbol, node, 8388608, 8388608); + } + function bindExportDeclaration(node) { + if (!container.symbol || !container.symbol.exports) { + bindAnonymousDeclaration(node, 1073741824, getDeclarationName(node)); + } + else if (!node.exportClause) { + declareSymbol(container.symbol.exports, container.symbol, node, 1073741824, 0); + } + } + function bindImportClause(node) { + if (node.name) { + declareSymbolAndAddToSymbolTable(node, 8388608, 8388608); + } + } + function setCommonJsModuleIndicator(node) { + if (!file.commonJsModuleIndicator) { + file.commonJsModuleIndicator = node; + bindSourceFileAsExternalModule(); + } + } + function bindExportsPropertyAssignment(node) { + setCommonJsModuleIndicator(node); + declareSymbol(file.symbol.exports, file.symbol, node.left, 4 | 7340032, 0); + } + function bindModuleExportsAssignment(node) { + setCommonJsModuleIndicator(node); + declareSymbol(file.symbol.exports, file.symbol, node, 4 | 7340032 | 512, 0); + } + function bindThisPropertyAssignment(node) { + if (container.kind === 179 || container.kind === 220) { + container.symbol.members = container.symbol.members || {}; + declareSymbol(container.symbol.members, container.symbol, node, 4, 107455 & ~4); + } + } + function bindPrototypePropertyAssignment(node) { + var leftSideOfAssignment = node.left; + var classPrototype = leftSideOfAssignment.expression; + var constructorFunction = classPrototype.expression; + leftSideOfAssignment.parent = node; + constructorFunction.parent = classPrototype; + classPrototype.parent = leftSideOfAssignment; + var funcSymbol = container.locals[constructorFunction.text]; + if (!funcSymbol || !(funcSymbol.flags & 16)) { + return; + } + if (!funcSymbol.members) { + funcSymbol.members = {}; + } + declareSymbol(funcSymbol.members, funcSymbol, leftSideOfAssignment, 4, 107455); + } + function bindCallExpression(node) { + if (!file.commonJsModuleIndicator && ts.isRequireCall(node, false)) { + setCommonJsModuleIndicator(node); + } + } + function bindClassLikeDeclaration(node) { + if (!ts.isDeclarationFile(file) && !ts.isInAmbientContext(node)) { + if (ts.getClassExtendsHeritageClauseElement(node) !== undefined) { + hasClassExtends = true; + } + if (ts.nodeIsDecorated(node)) { + hasDecorators = true; + } + } + if (node.kind === 221) { + bindBlockScopedDeclaration(node, 32, 899519); + } + else { + var bindingName = node.name ? node.name.text : "__class"; + bindAnonymousDeclaration(node, 32, bindingName); + if (node.name) { + classifiableNames[node.name.text] = node.name.text; + } + } + var symbol = node.symbol; + var prototypeSymbol = createSymbol(4 | 134217728, "prototype"); + if (ts.hasProperty(symbol.exports, prototypeSymbol.name)) { + if (node.name) { + node.name.parent = node; + } + file.bindDiagnostics.push(ts.createDiagnosticForNode(symbol.exports[prototypeSymbol.name].declarations[0], ts.Diagnostics.Duplicate_identifier_0, prototypeSymbol.name)); + } + symbol.exports[prototypeSymbol.name] = prototypeSymbol; + prototypeSymbol.parent = symbol; + } + function bindEnumDeclaration(node) { + return ts.isConst(node) + ? bindBlockScopedDeclaration(node, 128, 899967) + : bindBlockScopedDeclaration(node, 256, 899327); + } + function bindVariableDeclarationOrBindingElement(node) { + if (inStrictMode) { + checkStrictModeEvalOrArguments(node, node.name); + } + if (!ts.isBindingPattern(node.name)) { + if (ts.isBlockOrCatchScoped(node)) { + bindBlockScopedVariableDeclaration(node); + } + else if (ts.isParameterDeclaration(node)) { + declareSymbolAndAddToSymbolTable(node, 1, 107455); + } + else { + declareSymbolAndAddToSymbolTable(node, 1, 107454); + } + } + } + function bindParameter(node) { + if (!ts.isDeclarationFile(file) && + !ts.isInAmbientContext(node) && + ts.nodeIsDecorated(node)) { + hasDecorators = true; + hasParameterDecorators = true; + } + if (inStrictMode) { + checkStrictModeEvalOrArguments(node, node.name); + } + if (ts.isBindingPattern(node.name)) { + bindAnonymousDeclaration(node, 1, getDestructuringParameterName(node)); + } + else { + declareSymbolAndAddToSymbolTable(node, 1, 107455); + } + if (ts.isParameterPropertyDeclaration(node)) { + var classDeclaration = node.parent.parent; + declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, 4, 107455); + } + } + function bindFunctionDeclaration(node) { + if (!ts.isDeclarationFile(file) && !ts.isInAmbientContext(node)) { + if (ts.isAsyncFunctionLike(node)) { + hasAsyncFunctions = true; + } + } + checkStrictModeFunctionName(node); + if (inStrictMode) { + checkStrictModeFunctionDeclaration(node); + return bindBlockScopedDeclaration(node, 16, 106927); + } + else { + return declareSymbolAndAddToSymbolTable(node, 16, 106927); + } + } + function bindFunctionExpression(node) { + if (!ts.isDeclarationFile(file) && !ts.isInAmbientContext(node)) { + if (ts.isAsyncFunctionLike(node)) { + hasAsyncFunctions = true; + } + } + checkStrictModeFunctionName(node); + var bindingName = node.name ? node.name.text : "__function"; + return bindAnonymousDeclaration(node, 16, bindingName); + } + function bindPropertyOrMethodOrAccessor(node, symbolFlags, symbolExcludes) { + if (!ts.isDeclarationFile(file) && !ts.isInAmbientContext(node)) { + if (ts.isAsyncFunctionLike(node)) { + hasAsyncFunctions = true; + } + if (ts.nodeIsDecorated(node)) { + hasDecorators = true; + } + } + return ts.hasDynamicName(node) + ? bindAnonymousDeclaration(node, symbolFlags, "__computed") + : declareSymbolAndAddToSymbolTable(node, symbolFlags, symbolExcludes); + } + function shouldReportErrorOnModuleDeclaration(node) { + var instanceState = getModuleInstanceState(node); + return instanceState === 1 || (instanceState === 2 && options.preserveConstEnums); + } + function checkUnreachable(node) { + if (!(currentFlow.flags & 1)) { + return false; + } + if (currentFlow === unreachableFlow) { + var reportError = (ts.isStatement(node) && node.kind !== 201) || + node.kind === 221 || + (node.kind === 225 && shouldReportErrorOnModuleDeclaration(node)) || + (node.kind === 224 && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums)); + if (reportError) { + currentFlow = reportedUnreachableFlow; + var reportUnreachableCode = !options.allowUnreachableCode && + !ts.isInAmbientContext(node) && + (node.kind !== 200 || + ts.getCombinedNodeFlags(node.declarationList) & 3072 || + ts.forEach(node.declarationList.declarations, function (d) { return d.initializer; })); + if (reportUnreachableCode) { + errorOnFirstToken(node, ts.Diagnostics.Unreachable_code_detected); + } + } + } + return true; + } + } +})(ts || (ts = {})); +var ts; +(function (ts) { + var nextSymbolId = 1; + var nextNodeId = 1; + var nextMergeId = 1; + var nextFlowId = 1; + function getNodeId(node) { + if (!node.id) { + node.id = nextNodeId; + nextNodeId++; + } + return node.id; + } + ts.getNodeId = getNodeId; + ts.checkTime = 0; + function getSymbolId(symbol) { + if (!symbol.id) { + symbol.id = nextSymbolId; + nextSymbolId++; + } + return symbol.id; + } + ts.getSymbolId = getSymbolId; + function createTypeChecker(host, produceDiagnostics) { + var cancellationToken; + var Symbol = ts.objectAllocator.getSymbolConstructor(); + var Type = ts.objectAllocator.getTypeConstructor(); + var Signature = ts.objectAllocator.getSignatureConstructor(); + var typeCount = 0; + var symbolCount = 0; + var emptyArray = []; + var emptySymbols = {}; + var compilerOptions = host.getCompilerOptions(); + var languageVersion = compilerOptions.target || 0; + var modulekind = ts.getEmitModuleKind(compilerOptions); + var allowSyntheticDefaultImports = typeof compilerOptions.allowSyntheticDefaultImports !== "undefined" ? compilerOptions.allowSyntheticDefaultImports : modulekind === ts.ModuleKind.System; + var strictNullChecks = compilerOptions.strictNullChecks; + var emitResolver = createResolver(); + var undefinedSymbol = createSymbol(4 | 67108864, "undefined"); + undefinedSymbol.declarations = []; + var argumentsSymbol = createSymbol(4 | 67108864, "arguments"); + var checker = { + getNodeCount: function () { return ts.sum(host.getSourceFiles(), "nodeCount"); }, + getIdentifierCount: function () { return ts.sum(host.getSourceFiles(), "identifierCount"); }, + getSymbolCount: function () { return ts.sum(host.getSourceFiles(), "symbolCount") + symbolCount; }, + getTypeCount: function () { return typeCount; }, + isUndefinedSymbol: function (symbol) { return symbol === undefinedSymbol; }, + isArgumentsSymbol: function (symbol) { return symbol === argumentsSymbol; }, + isUnknownSymbol: function (symbol) { return symbol === unknownSymbol; }, + getDiagnostics: getDiagnostics, + getGlobalDiagnostics: getGlobalDiagnostics, + getTypeOfSymbolAtLocation: getTypeOfSymbolAtLocation, + getSymbolsOfParameterPropertyDeclaration: getSymbolsOfParameterPropertyDeclaration, + getDeclaredTypeOfSymbol: getDeclaredTypeOfSymbol, + getPropertiesOfType: getPropertiesOfType, + getPropertyOfType: getPropertyOfType, + getSignaturesOfType: getSignaturesOfType, + getIndexTypeOfType: getIndexTypeOfType, + getBaseTypes: getBaseTypes, + getReturnTypeOfSignature: getReturnTypeOfSignature, + getNonNullableType: getNonNullableType, + getSymbolsInScope: getSymbolsInScope, + getSymbolAtLocation: getSymbolAtLocation, + getShorthandAssignmentValueSymbol: getShorthandAssignmentValueSymbol, + getExportSpecifierLocalTargetSymbol: getExportSpecifierLocalTargetSymbol, + getTypeAtLocation: getTypeOfNode, + getPropertySymbolOfDestructuringAssignment: getPropertySymbolOfDestructuringAssignment, + typeToString: typeToString, + getSymbolDisplayBuilder: getSymbolDisplayBuilder, + symbolToString: symbolToString, + getAugmentedPropertiesOfType: getAugmentedPropertiesOfType, + getRootSymbols: getRootSymbols, + getContextualType: getContextualType, + getFullyQualifiedName: getFullyQualifiedName, + getResolvedSignature: getResolvedSignature, + getConstantValue: getConstantValue, + isValidPropertyAccess: isValidPropertyAccess, + getSignatureFromDeclaration: getSignatureFromDeclaration, + isImplementationOfOverload: isImplementationOfOverload, + getAliasedSymbol: resolveAlias, + getEmitResolver: getEmitResolver, + getExportsOfModule: getExportsOfModuleAsArray, + getJsxElementAttributesType: getJsxElementAttributesType, + getJsxIntrinsicTagNames: getJsxIntrinsicTagNames, + isOptionalParameter: isOptionalParameter + }; + var unknownSymbol = createSymbol(4 | 67108864, "unknown"); + var resolvingSymbol = createSymbol(67108864, "__resolving__"); + var nullableWideningFlags = strictNullChecks ? 0 : 2097152; + var anyType = createIntrinsicType(1, "any"); + var stringType = createIntrinsicType(2, "string"); + var numberType = createIntrinsicType(4, "number"); + var booleanType = createIntrinsicType(8, "boolean"); + var esSymbolType = createIntrinsicType(16777216, "symbol"); + var voidType = createIntrinsicType(16, "void"); + var undefinedType = createIntrinsicType(32 | nullableWideningFlags, "undefined"); + var nullType = createIntrinsicType(64 | nullableWideningFlags, "null"); + var emptyArrayElementType = createIntrinsicType(32 | 2097152, "undefined"); + var unknownType = createIntrinsicType(1, "unknown"); + var neverType = createIntrinsicType(134217728, "never"); + var emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); + var emptyGenericType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); + emptyGenericType.instantiations = {}; + var anyFunctionType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); + anyFunctionType.flags |= 8388608; + var noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); + var anySignature = createSignature(undefined, undefined, undefined, emptyArray, anyType, undefined, 0, false, false); + var unknownSignature = createSignature(undefined, undefined, undefined, emptyArray, unknownType, undefined, 0, false, false); + var enumNumberIndexInfo = createIndexInfo(stringType, true); + var globals = {}; + var getGlobalESSymbolConstructorSymbol; + var getGlobalPromiseConstructorSymbol; + var globalObjectType; + var globalFunctionType; + var globalArrayType; + var globalReadonlyArrayType; + var globalStringType; + var globalNumberType; + var globalBooleanType; + var globalRegExpType; + var anyArrayType; + var anyReadonlyArrayType; + var getGlobalTemplateStringsArrayType; + var getGlobalESSymbolType; + var getGlobalIterableType; + var getGlobalIteratorType; + var getGlobalIterableIteratorType; + var getGlobalClassDecoratorType; + var getGlobalParameterDecoratorType; + var getGlobalPropertyDecoratorType; + var getGlobalMethodDecoratorType; + var getGlobalTypedPropertyDescriptorType; + var getGlobalPromiseType; + var tryGetGlobalPromiseType; + var getGlobalPromiseLikeType; + var getInstantiatedGlobalPromiseLikeType; + var getGlobalPromiseConstructorLikeType; + var getGlobalThenableType; + var jsxElementClassType; + var deferredNodes; + var flowLoopStart = 0; + var flowLoopCount = 0; + var visitedFlowCount = 0; + var tupleTypes = {}; + var unionTypes = {}; + var intersectionTypes = {}; + var stringLiteralTypes = {}; + var resolutionTargets = []; + var resolutionResults = []; + var resolutionPropertyNames = []; + var mergedSymbols = []; + var symbolLinks = []; + var nodeLinks = []; + var flowLoopCaches = []; + var flowLoopNodes = []; + var flowLoopKeys = []; + var flowLoopTypes = []; + var visitedFlowNodes = []; + var visitedFlowTypes = []; + var potentialThisCollisions = []; + var awaitedTypeStack = []; + var diagnostics = ts.createDiagnosticCollection(); + var typeofEQFacts = { + "string": 1, + "number": 2, + "boolean": 4, + "symbol": 8, + "undefined": 16384, + "object": 16, + "function": 32 + }; + var typeofNEFacts = { + "string": 128, + "number": 256, + "boolean": 512, + "symbol": 1024, + "undefined": 131072, + "object": 2048, + "function": 4096 + }; + var typeofTypesByName = { + "string": stringType, + "number": numberType, + "boolean": booleanType, + "symbol": esSymbolType, + "undefined": undefinedType + }; + var jsxElementType; + var jsxTypes = {}; + var JsxNames = { + JSX: "JSX", + IntrinsicElements: "IntrinsicElements", + ElementClass: "ElementClass", + ElementAttributesPropertyNameContainer: "ElementAttributesProperty", + Element: "Element", + IntrinsicAttributes: "IntrinsicAttributes", + IntrinsicClassAttributes: "IntrinsicClassAttributes" + }; + var subtypeRelation = {}; + var assignableRelation = {}; + var comparableRelation = {}; + var identityRelation = {}; + var _displayBuilder; + var builtinGlobals = (_a = {}, + _a[undefinedSymbol.name] = undefinedSymbol, + _a + ); + initializeTypeChecker(); + return checker; + function getEmitResolver(sourceFile, cancellationToken) { + getDiagnostics(sourceFile, cancellationToken); + return emitResolver; + } + function error(location, message, arg0, arg1, arg2) { + var diagnostic = location + ? ts.createDiagnosticForNode(location, message, arg0, arg1, arg2) + : ts.createCompilerDiagnostic(message, arg0, arg1, arg2); + diagnostics.add(diagnostic); + } + function createSymbol(flags, name) { + symbolCount++; + return new Symbol(flags, name); + } + function getExcludedSymbolFlags(flags) { + var result = 0; + if (flags & 2) + result |= 107455; + if (flags & 1) + result |= 107454; + if (flags & 4) + result |= 107455; + if (flags & 8) + result |= 107455; + if (flags & 16) + result |= 106927; + if (flags & 32) + result |= 899519; + if (flags & 64) + result |= 792960; + if (flags & 256) + result |= 899327; + if (flags & 128) + result |= 899967; + if (flags & 512) + result |= 106639; + if (flags & 8192) + result |= 99263; + if (flags & 32768) + result |= 41919; + if (flags & 65536) + result |= 74687; + if (flags & 262144) + result |= 530912; + if (flags & 524288) + result |= 793056; + if (flags & 8388608) + result |= 8388608; + return result; + } + function recordMergedSymbol(target, source) { + if (!source.mergeId) { + source.mergeId = nextMergeId; + nextMergeId++; + } + mergedSymbols[source.mergeId] = target; + } + function cloneSymbol(symbol) { + var result = createSymbol(symbol.flags | 33554432, symbol.name); + result.declarations = symbol.declarations.slice(0); + result.parent = symbol.parent; + if (symbol.valueDeclaration) + result.valueDeclaration = symbol.valueDeclaration; + if (symbol.constEnumOnlyModule) + result.constEnumOnlyModule = true; + if (symbol.members) + result.members = cloneSymbolTable(symbol.members); + if (symbol.exports) + result.exports = cloneSymbolTable(symbol.exports); + recordMergedSymbol(result, symbol); + return result; + } + function mergeSymbol(target, source) { + if (!(target.flags & getExcludedSymbolFlags(source.flags))) { + if (source.flags & 512 && target.flags & 512 && target.constEnumOnlyModule && !source.constEnumOnlyModule) { + target.constEnumOnlyModule = false; + } + target.flags |= source.flags; + if (source.valueDeclaration && + (!target.valueDeclaration || + (target.valueDeclaration.kind === 225 && source.valueDeclaration.kind !== 225))) { + target.valueDeclaration = source.valueDeclaration; + } + ts.forEach(source.declarations, function (node) { + target.declarations.push(node); + }); + if (source.members) { + if (!target.members) + target.members = {}; + mergeSymbolTable(target.members, source.members); + } + if (source.exports) { + if (!target.exports) + target.exports = {}; + mergeSymbolTable(target.exports, source.exports); + } + recordMergedSymbol(target, source); + } + else { + var message_2 = target.flags & 2 || source.flags & 2 + ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0; + ts.forEach(source.declarations, function (node) { + error(node.name ? node.name : node, message_2, symbolToString(source)); + }); + ts.forEach(target.declarations, function (node) { + error(node.name ? node.name : node, message_2, symbolToString(source)); + }); + } + } + function cloneSymbolTable(symbolTable) { + var result = {}; + for (var id in symbolTable) { + if (ts.hasProperty(symbolTable, id)) { + result[id] = symbolTable[id]; + } + } + return result; + } + function mergeSymbolTable(target, source) { + for (var id in source) { + if (ts.hasProperty(source, id)) { + if (!ts.hasProperty(target, id)) { + target[id] = source[id]; + } + else { + var symbol = target[id]; + if (!(symbol.flags & 33554432)) { + target[id] = symbol = cloneSymbol(symbol); + } + mergeSymbol(symbol, source[id]); + } + } + } + } + function mergeModuleAugmentation(moduleName) { + var moduleAugmentation = moduleName.parent; + if (moduleAugmentation.symbol.declarations[0] !== moduleAugmentation) { + ts.Debug.assert(moduleAugmentation.symbol.declarations.length > 1); + return; + } + if (ts.isGlobalScopeAugmentation(moduleAugmentation)) { + mergeSymbolTable(globals, moduleAugmentation.symbol.exports); + } + else { + var moduleNotFoundError = !ts.isInAmbientContext(moduleName.parent.parent) + ? ts.Diagnostics.Invalid_module_name_in_augmentation_module_0_cannot_be_found + : undefined; + var mainModule = resolveExternalModuleNameWorker(moduleName, moduleName, moduleNotFoundError); + if (!mainModule) { + return; + } + mainModule = resolveExternalModuleSymbol(mainModule); + if (mainModule.flags & 1536) { + mainModule = mainModule.flags & 33554432 ? mainModule : cloneSymbol(mainModule); + mergeSymbol(mainModule, moduleAugmentation.symbol); + } + else { + error(moduleName, ts.Diagnostics.Cannot_augment_module_0_because_it_resolves_to_a_non_module_entity, moduleName.text); + } + } + } + function addToSymbolTable(target, source, message) { + for (var id in source) { + if (ts.hasProperty(source, id)) { + if (ts.hasProperty(target, id)) { + ts.forEach(target[id].declarations, addDeclarationDiagnostic(id, message)); + } + else { + target[id] = source[id]; + } + } + } + function addDeclarationDiagnostic(id, message) { + return function (declaration) { return diagnostics.add(ts.createDiagnosticForNode(declaration, message, id)); }; + } + } + function getSymbolLinks(symbol) { + if (symbol.flags & 67108864) + return symbol; + var id = getSymbolId(symbol); + return symbolLinks[id] || (symbolLinks[id] = {}); + } + function getNodeLinks(node) { + var nodeId = getNodeId(node); + return nodeLinks[nodeId] || (nodeLinks[nodeId] = {}); + } + function isGlobalSourceFile(node) { + return node.kind === 256 && !ts.isExternalOrCommonJsModule(node); + } + function getSymbol(symbols, name, meaning) { + if (meaning && ts.hasProperty(symbols, name)) { + var symbol = symbols[name]; + ts.Debug.assert((symbol.flags & 16777216) === 0, "Should never get an instantiated symbol here."); + if (symbol.flags & meaning) { + return symbol; + } + if (symbol.flags & 8388608) { + var target = resolveAlias(symbol); + if (target === unknownSymbol || target.flags & meaning) { + return symbol; + } + } + } + } + function getSymbolsOfParameterPropertyDeclaration(parameter, parameterName) { + var constructorDeclaration = parameter.parent; + var classDeclaration = parameter.parent.parent; + var parameterSymbol = getSymbol(constructorDeclaration.locals, parameterName, 107455); + var propertySymbol = getSymbol(classDeclaration.symbol.members, parameterName, 107455); + if (parameterSymbol && propertySymbol) { + return [parameterSymbol, propertySymbol]; + } + ts.Debug.fail("There should exist two symbols, one as property declaration and one as parameter declaration"); + } + function isBlockScopedNameDeclaredBeforeUse(declaration, usage) { + var declarationFile = ts.getSourceFileOfNode(declaration); + var useFile = ts.getSourceFileOfNode(usage); + if (declarationFile !== useFile) { + if (modulekind || (!compilerOptions.outFile && !compilerOptions.out)) { + return true; + } + var sourceFiles = host.getSourceFiles(); + return ts.indexOf(sourceFiles, declarationFile) <= ts.indexOf(sourceFiles, useFile); + } + if (declaration.pos <= usage.pos) { + return declaration.kind !== 218 || + !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage); + } + return isUsedInFunctionOrNonStaticProperty(declaration, usage); + function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage) { + var container = ts.getEnclosingBlockScopeContainer(declaration); + switch (declaration.parent.parent.kind) { + case 200: + case 206: + case 208: + if (isSameScopeDescendentOf(usage, declaration, container)) { + return true; + } + break; + } + switch (declaration.parent.parent.kind) { + case 207: + case 208: + if (isSameScopeDescendentOf(usage, declaration.parent.parent.expression, container)) { + return true; + } + } + return false; + } + function isUsedInFunctionOrNonStaticProperty(declaration, usage) { + var container = ts.getEnclosingBlockScopeContainer(declaration); + var current = usage; + while (current) { + if (current === container) { + return false; + } + if (ts.isFunctionLike(current)) { + return true; + } + var initializerOfNonStaticProperty = current.parent && + current.parent.kind === 145 && + (current.parent.flags & 32) === 0 && + current.parent.initializer === current; + if (initializerOfNonStaticProperty) { + return true; + } + current = current.parent; + } + return false; + } + } + function resolveName(location, name, meaning, nameNotFoundMessage, nameArg) { + var result; + var lastLocation; + var propertyWithInvalidInitializer; + var errorLocation = location; + var grandparent; + loop: while (location) { + if (location.locals && !isGlobalSourceFile(location)) { + if (result = getSymbol(location.locals, name, meaning)) { + var useResult = true; + if (ts.isFunctionLike(location) && lastLocation && lastLocation !== location.body) { + if (meaning & result.flags & 793056 && lastLocation.kind !== 273) { + useResult = result.flags & 262144 + ? lastLocation === location.type || + lastLocation.kind === 142 || + lastLocation.kind === 141 + : false; + } + if (meaning & 107455 && result.flags & 1) { + useResult = + lastLocation.kind === 142 || + (lastLocation === location.type && + result.valueDeclaration.kind === 142); + } + } + if (useResult) { + break loop; + } + else { + result = undefined; + } + } + } + switch (location.kind) { + case 256: + if (!ts.isExternalOrCommonJsModule(location)) + break; + case 225: + var moduleExports = getSymbolOfNode(location).exports; + if (location.kind === 256 || ts.isAmbientModule(location)) { + if (result = moduleExports["default"]) { + var localSymbol = ts.getLocalSymbolForExportDefault(result); + if (localSymbol && (result.flags & meaning) && localSymbol.name === name) { + break loop; + } + result = undefined; + } + if (ts.hasProperty(moduleExports, name) && + moduleExports[name].flags === 8388608 && + ts.getDeclarationOfKind(moduleExports[name], 238)) { + break; + } + } + if (result = getSymbol(moduleExports, name, meaning & 8914931)) { + break loop; + } + break; + case 224: + if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8)) { + break loop; + } + break; + case 145: + case 144: + if (ts.isClassLike(location.parent) && !(location.flags & 32)) { + var ctor = findConstructorDeclaration(location.parent); + if (ctor && ctor.locals) { + if (getSymbol(ctor.locals, name, meaning & 107455)) { + propertyWithInvalidInitializer = location; + } + } + } + break; + case 221: + case 192: + case 222: + if (result = getSymbol(getSymbolOfNode(location).members, name, meaning & 793056)) { + if (lastLocation && lastLocation.flags & 32) { + error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters); + return undefined; + } + break loop; + } + if (location.kind === 192 && meaning & 32) { + var className = location.name; + if (className && name === className.text) { + result = location.symbol; + break loop; + } + } + break; + case 140: + grandparent = location.parent.parent; + if (ts.isClassLike(grandparent) || grandparent.kind === 222) { + if (result = getSymbol(getSymbolOfNode(grandparent).members, name, meaning & 793056)) { + error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); + return undefined; + } + } + break; + case 147: + case 146: + case 148: + case 149: + case 150: + case 220: + case 180: + if (meaning & 3 && name === "arguments") { + result = argumentsSymbol; + break loop; + } + break; + case 179: + if (meaning & 3 && name === "arguments") { + result = argumentsSymbol; + break loop; + } + if (meaning & 16) { + var functionName = location.name; + if (functionName && name === functionName.text) { + result = location.symbol; + break loop; + } + } + break; + case 143: + if (location.parent && location.parent.kind === 142) { + location = location.parent; + } + if (location.parent && ts.isClassElement(location.parent)) { + location = location.parent; + } + break; + } + lastLocation = location; + location = location.parent; + } + if (!result) { + result = getSymbol(globals, name, meaning); + } + if (!result) { + if (nameNotFoundMessage) { + if (!checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg)) { + error(errorLocation, nameNotFoundMessage, typeof nameArg === "string" ? nameArg : ts.declarationNameToString(nameArg)); + } + } + return undefined; + } + if (nameNotFoundMessage) { + if (propertyWithInvalidInitializer) { + var propertyName = propertyWithInvalidInitializer.name; + error(errorLocation, ts.Diagnostics.Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor, ts.declarationNameToString(propertyName), typeof nameArg === "string" ? nameArg : ts.declarationNameToString(nameArg)); + return undefined; + } + if (meaning & 2) { + var exportOrLocalSymbol = getExportSymbolOfValueSymbolIfExported(result); + if (exportOrLocalSymbol.flags & 2) { + checkResolvedBlockScopedVariable(exportOrLocalSymbol, errorLocation); + } + } + } + return result; + } + function checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) { + if (!errorLocation || (errorLocation.kind === 69 && (isTypeReferenceIdentifier(errorLocation)) || isInTypeQuery(errorLocation))) { + return false; + } + var container = ts.getThisContainer(errorLocation, true); + var location = container; + while (location) { + if (ts.isClassLike(location.parent)) { + var classSymbol = getSymbolOfNode(location.parent); + if (!classSymbol) { + break; + } + var constructorType = getTypeOfSymbol(classSymbol); + if (getPropertyOfType(constructorType, name)) { + error(errorLocation, ts.Diagnostics.Cannot_find_name_0_Did_you_mean_the_static_member_1_0, typeof nameArg === "string" ? nameArg : ts.declarationNameToString(nameArg), symbolToString(classSymbol)); + return true; + } + if (location === container && !(location.flags & 32)) { + var instanceType = getDeclaredTypeOfSymbol(classSymbol).thisType; + if (getPropertyOfType(instanceType, name)) { + error(errorLocation, ts.Diagnostics.Cannot_find_name_0_Did_you_mean_the_instance_member_this_0, typeof nameArg === "string" ? nameArg : ts.declarationNameToString(nameArg)); + return true; + } + } + } + location = location.parent; + } + return false; + } + function checkResolvedBlockScopedVariable(result, errorLocation) { + ts.Debug.assert((result.flags & 2) !== 0); + var declaration = ts.forEach(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) ? d : undefined; }); + ts.Debug.assert(declaration !== undefined, "Block-scoped variable declaration is undefined"); + if (!isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 218), errorLocation)) { + error(errorLocation, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, ts.declarationNameToString(declaration.name)); + } + } + function isSameScopeDescendentOf(initial, parent, stopAt) { + if (!parent) { + return false; + } + for (var current = initial; current && current !== stopAt && !ts.isFunctionLike(current); current = current.parent) { + if (current === parent) { + return true; + } + } + return false; + } + function getAnyImportSyntax(node) { + if (ts.isAliasSymbolDeclaration(node)) { + if (node.kind === 229) { + return node; + } + while (node && node.kind !== 230) { + node = node.parent; + } + return node; + } + } + function getDeclarationOfAliasSymbol(symbol) { + return ts.forEach(symbol.declarations, function (d) { return ts.isAliasSymbolDeclaration(d) ? d : undefined; }); + } + function getTargetOfImportEqualsDeclaration(node) { + if (node.moduleReference.kind === 240) { + return resolveExternalModuleSymbol(resolveExternalModuleName(node, ts.getExternalModuleImportEqualsDeclarationExpression(node))); + } + return getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference, node); + } + function getTargetOfImportClause(node) { + var moduleSymbol = resolveExternalModuleName(node, node.parent.moduleSpecifier); + if (moduleSymbol) { + var exportDefaultSymbol = moduleSymbol.exports["export="] ? + getPropertyOfType(getTypeOfSymbol(moduleSymbol.exports["export="]), "default") : + resolveSymbol(moduleSymbol.exports["default"]); + if (!exportDefaultSymbol && !allowSyntheticDefaultImports) { + error(node.name, ts.Diagnostics.Module_0_has_no_default_export, symbolToString(moduleSymbol)); + } + else if (!exportDefaultSymbol && allowSyntheticDefaultImports) { + return resolveExternalModuleSymbol(moduleSymbol) || resolveSymbol(moduleSymbol); + } + return exportDefaultSymbol; + } + } + function getTargetOfNamespaceImport(node) { + var moduleSpecifier = node.parent.parent.moduleSpecifier; + return resolveESModuleSymbol(resolveExternalModuleName(node, moduleSpecifier), moduleSpecifier); + } + function combineValueAndTypeSymbols(valueSymbol, typeSymbol) { + if (valueSymbol.flags & (793056 | 1536)) { + return valueSymbol; + } + var result = createSymbol(valueSymbol.flags | typeSymbol.flags, valueSymbol.name); + result.declarations = ts.concatenate(valueSymbol.declarations, typeSymbol.declarations); + result.parent = valueSymbol.parent || typeSymbol.parent; + if (valueSymbol.valueDeclaration) + result.valueDeclaration = valueSymbol.valueDeclaration; + if (typeSymbol.members) + result.members = typeSymbol.members; + if (valueSymbol.exports) + result.exports = valueSymbol.exports; + return result; + } + function getExportOfModule(symbol, name) { + if (symbol.flags & 1536) { + var exports = getExportsOfSymbol(symbol); + if (ts.hasProperty(exports, name)) { + return resolveSymbol(exports[name]); + } + } + } + function getPropertyOfVariable(symbol, name) { + if (symbol.flags & 3) { + var typeAnnotation = symbol.valueDeclaration.type; + if (typeAnnotation) { + return resolveSymbol(getPropertyOfType(getTypeFromTypeNode(typeAnnotation), name)); + } + } + } + function getExternalModuleMember(node, specifier) { + var moduleSymbol = resolveExternalModuleName(node, node.moduleSpecifier); + var targetSymbol = resolveESModuleSymbol(moduleSymbol, node.moduleSpecifier); + if (targetSymbol) { + var name_9 = specifier.propertyName || specifier.name; + if (name_9.text) { + var symbolFromVariable = void 0; + if (moduleSymbol && moduleSymbol.exports && moduleSymbol.exports["export="]) { + symbolFromVariable = getPropertyOfType(getTypeOfSymbol(targetSymbol), name_9.text); + } + else { + symbolFromVariable = getPropertyOfVariable(targetSymbol, name_9.text); + } + symbolFromVariable = resolveSymbol(symbolFromVariable); + var symbolFromModule = getExportOfModule(targetSymbol, name_9.text); + var symbol = symbolFromModule && symbolFromVariable ? + combineValueAndTypeSymbols(symbolFromVariable, symbolFromModule) : + symbolFromModule || symbolFromVariable; + if (!symbol) { + error(name_9, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(moduleSymbol), ts.declarationNameToString(name_9)); + } + return symbol; + } + } + } + function getTargetOfImportSpecifier(node) { + return getExternalModuleMember(node.parent.parent.parent, node); + } + function getTargetOfGlobalModuleExportDeclaration(node) { + return resolveExternalModuleSymbol(node.parent.symbol); + } + function getTargetOfExportSpecifier(node) { + return node.parent.parent.moduleSpecifier ? + getExternalModuleMember(node.parent.parent, node) : + resolveEntityName(node.propertyName || node.name, 107455 | 793056 | 1536); + } + function getTargetOfExportAssignment(node) { + return resolveEntityName(node.expression, 107455 | 793056 | 1536); + } + function getTargetOfAliasDeclaration(node) { + switch (node.kind) { + case 229: + return getTargetOfImportEqualsDeclaration(node); + case 231: + return getTargetOfImportClause(node); + case 232: + return getTargetOfNamespaceImport(node); + case 234: + return getTargetOfImportSpecifier(node); + case 238: + return getTargetOfExportSpecifier(node); + case 235: + return getTargetOfExportAssignment(node); + case 228: + return getTargetOfGlobalModuleExportDeclaration(node); + } + } + function resolveSymbol(symbol) { + return symbol && symbol.flags & 8388608 && !(symbol.flags & (107455 | 793056 | 1536)) ? resolveAlias(symbol) : symbol; + } + function resolveAlias(symbol) { + ts.Debug.assert((symbol.flags & 8388608) !== 0, "Should only get Alias here."); + var links = getSymbolLinks(symbol); + if (!links.target) { + links.target = resolvingSymbol; + var node = getDeclarationOfAliasSymbol(symbol); + var target = getTargetOfAliasDeclaration(node); + if (links.target === resolvingSymbol) { + links.target = target || unknownSymbol; + } + else { + error(node, ts.Diagnostics.Circular_definition_of_import_alias_0, symbolToString(symbol)); + } + } + else if (links.target === resolvingSymbol) { + links.target = unknownSymbol; + } + return links.target; + } + function markExportAsReferenced(node) { + var symbol = getSymbolOfNode(node); + var target = resolveAlias(symbol); + if (target) { + var markAlias = target === unknownSymbol || + ((target.flags & 107455) && !isConstEnumOrConstEnumOnlyModule(target)); + if (markAlias) { + markAliasSymbolAsReferenced(symbol); + } + } + } + function markAliasSymbolAsReferenced(symbol) { + var links = getSymbolLinks(symbol); + if (!links.referenced) { + links.referenced = true; + var node = getDeclarationOfAliasSymbol(symbol); + if (node.kind === 235) { + checkExpressionCached(node.expression); + } + else if (node.kind === 238) { + checkExpressionCached(node.propertyName || node.name); + } + else if (ts.isInternalModuleImportEqualsDeclaration(node)) { + checkExpressionCached(node.moduleReference); + } + } + } + function getSymbolOfPartOfRightHandSideOfImportEquals(entityName, importDeclaration) { + if (!importDeclaration) { + importDeclaration = ts.getAncestor(entityName, 229); + ts.Debug.assert(importDeclaration !== undefined); + } + if (entityName.kind === 69 && ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { + entityName = entityName.parent; + } + if (entityName.kind === 69 || entityName.parent.kind === 139) { + return resolveEntityName(entityName, 1536); + } + else { + ts.Debug.assert(entityName.parent.kind === 229); + return resolveEntityName(entityName, 107455 | 793056 | 1536); + } + } + function getFullyQualifiedName(symbol) { + return symbol.parent ? getFullyQualifiedName(symbol.parent) + "." + symbolToString(symbol) : symbolToString(symbol); + } + function resolveEntityName(name, meaning, ignoreErrors) { + if (ts.nodeIsMissing(name)) { + return undefined; + } + var symbol; + if (name.kind === 69) { + var message = meaning === 1536 ? ts.Diagnostics.Cannot_find_namespace_0 : ts.Diagnostics.Cannot_find_name_0; + symbol = resolveName(name, name.text, meaning, ignoreErrors ? undefined : message, name); + if (!symbol) { + return undefined; + } + } + else if (name.kind === 139 || name.kind === 172) { + var left = name.kind === 139 ? name.left : name.expression; + var right = name.kind === 139 ? name.right : name.name; + var namespace = resolveEntityName(left, 1536, ignoreErrors); + if (!namespace || namespace === unknownSymbol || ts.nodeIsMissing(right)) { + return undefined; + } + symbol = getSymbol(getExportsOfSymbol(namespace), right.text, meaning); + if (!symbol) { + if (!ignoreErrors) { + error(right, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(namespace), ts.declarationNameToString(right)); + } + return undefined; + } + } + else { + ts.Debug.fail("Unknown entity name kind."); + } + ts.Debug.assert((symbol.flags & 16777216) === 0, "Should never get an instantiated symbol here."); + return symbol.flags & meaning ? symbol : resolveAlias(symbol); + } + function resolveExternalModuleName(location, moduleReferenceExpression) { + return resolveExternalModuleNameWorker(location, moduleReferenceExpression, ts.Diagnostics.Cannot_find_module_0); + } + function resolveExternalModuleNameWorker(location, moduleReferenceExpression, moduleNotFoundError) { + if (moduleReferenceExpression.kind !== 9) { + return; + } + var moduleReferenceLiteral = moduleReferenceExpression; + var moduleName = ts.escapeIdentifier(moduleReferenceLiteral.text); + if (moduleName === undefined) { + return; + } + var isRelative = ts.isExternalModuleNameRelative(moduleName); + if (!isRelative) { + var symbol = getSymbol(globals, '"' + moduleName + '"', 512); + if (symbol) { + return getMergedSymbol(symbol); + } + } + var resolvedModule = ts.getResolvedModule(ts.getSourceFileOfNode(location), moduleReferenceLiteral.text); + var sourceFile = resolvedModule && host.getSourceFile(resolvedModule.resolvedFileName); + if (sourceFile) { + if (sourceFile.symbol) { + return getMergedSymbol(sourceFile.symbol); + } + if (moduleNotFoundError) { + error(moduleReferenceLiteral, ts.Diagnostics.File_0_is_not_a_module, sourceFile.fileName); + } + return undefined; + } + if (moduleNotFoundError) { + error(moduleReferenceLiteral, moduleNotFoundError, moduleName); + } + return undefined; + } + function resolveExternalModuleSymbol(moduleSymbol) { + return moduleSymbol && getMergedSymbol(resolveSymbol(moduleSymbol.exports["export="])) || moduleSymbol; + } + function resolveESModuleSymbol(moduleSymbol, moduleReferenceExpression) { + var symbol = resolveExternalModuleSymbol(moduleSymbol); + if (symbol && !(symbol.flags & (1536 | 3))) { + error(moduleReferenceExpression, ts.Diagnostics.Module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct, symbolToString(moduleSymbol)); + symbol = undefined; + } + return symbol; + } + function hasExportAssignmentSymbol(moduleSymbol) { + return moduleSymbol.exports["export="] !== undefined; + } + function getExportsOfModuleAsArray(moduleSymbol) { + return symbolsToArray(getExportsOfModule(moduleSymbol)); + } + function getExportsOfSymbol(symbol) { + return symbol.flags & 1536 ? getExportsOfModule(symbol) : symbol.exports || emptySymbols; + } + function getExportsOfModule(moduleSymbol) { + var links = getSymbolLinks(moduleSymbol); + return links.resolvedExports || (links.resolvedExports = getExportsForModule(moduleSymbol)); + } + function extendExportSymbols(target, source, lookupTable, exportNode) { + for (var id in source) { + if (id !== "default" && !ts.hasProperty(target, id)) { + target[id] = source[id]; + if (lookupTable && exportNode) { + lookupTable[id] = { + specifierText: ts.getTextOfNode(exportNode.moduleSpecifier) + }; + } + } + else if (lookupTable && exportNode && id !== "default" && ts.hasProperty(target, id) && resolveSymbol(target[id]) !== resolveSymbol(source[id])) { + if (!lookupTable[id].exportsWithDuplicate) { + lookupTable[id].exportsWithDuplicate = [exportNode]; + } + else { + lookupTable[id].exportsWithDuplicate.push(exportNode); + } + } + } + } + function getExportsForModule(moduleSymbol) { + var visitedSymbols = []; + return visit(moduleSymbol) || moduleSymbol.exports; + function visit(symbol) { + if (!(symbol && symbol.flags & 1952 && !ts.contains(visitedSymbols, symbol))) { + return; + } + visitedSymbols.push(symbol); + var symbols = cloneSymbolTable(symbol.exports); + var exportStars = symbol.exports["__export"]; + if (exportStars) { + var nestedSymbols = {}; + var lookupTable = {}; + for (var _i = 0, _a = exportStars.declarations; _i < _a.length; _i++) { + var node = _a[_i]; + var resolvedModule = resolveExternalModuleName(node, node.moduleSpecifier); + var exportedSymbols = visit(resolvedModule); + extendExportSymbols(nestedSymbols, exportedSymbols, lookupTable, node); + } + for (var id in lookupTable) { + var exportsWithDuplicate = lookupTable[id].exportsWithDuplicate; + if (id === "export=" || !(exportsWithDuplicate && exportsWithDuplicate.length) || ts.hasProperty(symbols, id)) { + continue; + } + for (var _b = 0, exportsWithDuplicate_1 = exportsWithDuplicate; _b < exportsWithDuplicate_1.length; _b++) { + var node = exportsWithDuplicate_1[_b]; + diagnostics.add(ts.createDiagnosticForNode(node, ts.Diagnostics.Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambiguity, lookupTable[id].specifierText, id)); + } + } + extendExportSymbols(symbols, nestedSymbols); + } + return symbols; + } + } + function getMergedSymbol(symbol) { + var merged; + return symbol && symbol.mergeId && (merged = mergedSymbols[symbol.mergeId]) ? merged : symbol; + } + function getSymbolOfNode(node) { + return getMergedSymbol(node.symbol); + } + function getParentOfSymbol(symbol) { + return getMergedSymbol(symbol.parent); + } + function getExportSymbolOfValueSymbolIfExported(symbol) { + return symbol && (symbol.flags & 1048576) !== 0 + ? getMergedSymbol(symbol.exportSymbol) + : symbol; + } + function symbolIsValue(symbol) { + if (symbol.flags & 16777216) { + return symbolIsValue(getSymbolLinks(symbol).target); + } + if (symbol.flags & 107455) { + return true; + } + if (symbol.flags & 8388608) { + return (resolveAlias(symbol).flags & 107455) !== 0; + } + return false; + } + function findConstructorDeclaration(node) { + var members = node.members; + for (var _i = 0, members_1 = members; _i < members_1.length; _i++) { + var member = members_1[_i]; + if (member.kind === 148 && ts.nodeIsPresent(member.body)) { + return member; + } + } + } + function createType(flags) { + var result = new Type(checker, flags); + result.id = typeCount; + typeCount++; + return result; + } + function createIntrinsicType(kind, intrinsicName) { + var type = createType(kind); + type.intrinsicName = intrinsicName; + return type; + } + function createObjectType(kind, symbol) { + var type = createType(kind); + type.symbol = symbol; + return type; + } + function isReservedMemberName(name) { + return name.charCodeAt(0) === 95 && + name.charCodeAt(1) === 95 && + name.charCodeAt(2) !== 95 && + name.charCodeAt(2) !== 64; + } + function getNamedMembers(members) { + var result; + for (var id in members) { + if (ts.hasProperty(members, id)) { + if (!isReservedMemberName(id)) { + if (!result) + result = []; + var symbol = members[id]; + if (symbolIsValue(symbol)) { + result.push(symbol); + } + } + } + } + return result || emptyArray; + } + function setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo) { + type.members = members; + type.properties = getNamedMembers(members); + type.callSignatures = callSignatures; + type.constructSignatures = constructSignatures; + if (stringIndexInfo) + type.stringIndexInfo = stringIndexInfo; + if (numberIndexInfo) + type.numberIndexInfo = numberIndexInfo; + return type; + } + function createAnonymousType(symbol, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo) { + return setObjectTypeMembers(createObjectType(65536, symbol), members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo); + } + function forEachSymbolTableInScope(enclosingDeclaration, callback) { + var result; + for (var location_1 = enclosingDeclaration; location_1; location_1 = location_1.parent) { + if (location_1.locals && !isGlobalSourceFile(location_1)) { + if (result = callback(location_1.locals)) { + return result; + } + } + switch (location_1.kind) { + case 256: + if (!ts.isExternalOrCommonJsModule(location_1)) { + break; + } + case 225: + if (result = callback(getSymbolOfNode(location_1).exports)) { + return result; + } + break; + } + } + return callback(globals); + } + function getQualifiedLeftMeaning(rightMeaning) { + return rightMeaning === 107455 ? 107455 : 1536; + } + function getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning, useOnlyExternalAliasing) { + function getAccessibleSymbolChainFromSymbolTable(symbols) { + function canQualifySymbol(symbolFromSymbolTable, meaning) { + if (!needsQualification(symbolFromSymbolTable, enclosingDeclaration, meaning)) { + return true; + } + var accessibleParent = getAccessibleSymbolChain(symbolFromSymbolTable.parent, enclosingDeclaration, getQualifiedLeftMeaning(meaning), useOnlyExternalAliasing); + return !!accessibleParent; + } + function isAccessible(symbolFromSymbolTable, resolvedAliasSymbol) { + if (symbol === (resolvedAliasSymbol || symbolFromSymbolTable)) { + return !ts.forEach(symbolFromSymbolTable.declarations, hasExternalModuleSymbol) && + canQualifySymbol(symbolFromSymbolTable, meaning); + } + } + if (isAccessible(ts.lookUp(symbols, symbol.name))) { + return [symbol]; + } + return ts.forEachValue(symbols, function (symbolFromSymbolTable) { + if (symbolFromSymbolTable.flags & 8388608 + && symbolFromSymbolTable.name !== "export=" + && !ts.getDeclarationOfKind(symbolFromSymbolTable, 238)) { + if (!useOnlyExternalAliasing || + ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { + var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); + if (isAccessible(symbolFromSymbolTable, resolveAlias(symbolFromSymbolTable))) { + return [symbolFromSymbolTable]; + } + var accessibleSymbolsFromExports = resolvedImportedSymbol.exports ? getAccessibleSymbolChainFromSymbolTable(resolvedImportedSymbol.exports) : undefined; + if (accessibleSymbolsFromExports && canQualifySymbol(symbolFromSymbolTable, getQualifiedLeftMeaning(meaning))) { + return [symbolFromSymbolTable].concat(accessibleSymbolsFromExports); + } + } + } + }); + } + if (symbol) { + if (!(isPropertyOrMethodDeclarationSymbol(symbol))) { + return forEachSymbolTableInScope(enclosingDeclaration, getAccessibleSymbolChainFromSymbolTable); + } + } + } + function needsQualification(symbol, enclosingDeclaration, meaning) { + var qualify = false; + forEachSymbolTableInScope(enclosingDeclaration, function (symbolTable) { + if (!ts.hasProperty(symbolTable, symbol.name)) { + return false; + } + var symbolFromSymbolTable = symbolTable[symbol.name]; + if (symbolFromSymbolTable === symbol) { + return true; + } + symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608 && !ts.getDeclarationOfKind(symbolFromSymbolTable, 238)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; + if (symbolFromSymbolTable.flags & meaning) { + qualify = true; + return true; + } + return false; + }); + return qualify; + } + function isPropertyOrMethodDeclarationSymbol(symbol) { + if (symbol.declarations && symbol.declarations.length) { + for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { + var declaration = _a[_i]; + switch (declaration.kind) { + case 145: + case 147: + case 149: + case 150: + continue; + default: + return false; + } + } + return true; + } + return false; + } + function isSymbolAccessible(symbol, enclosingDeclaration, meaning) { + if (symbol && enclosingDeclaration && !(symbol.flags & 262144)) { + var initialSymbol = symbol; + var meaningToLook = meaning; + while (symbol) { + var accessibleSymbolChain = getAccessibleSymbolChain(symbol, enclosingDeclaration, meaningToLook, false); + if (accessibleSymbolChain) { + var hasAccessibleDeclarations = hasVisibleDeclarations(accessibleSymbolChain[0]); + if (!hasAccessibleDeclarations) { + return { + accessibility: 1, + errorSymbolName: symbolToString(initialSymbol, enclosingDeclaration, meaning), + errorModuleName: symbol !== initialSymbol ? symbolToString(symbol, enclosingDeclaration, 1536) : undefined + }; + } + return hasAccessibleDeclarations; + } + meaningToLook = getQualifiedLeftMeaning(meaning); + symbol = getParentOfSymbol(symbol); + } + var symbolExternalModule = ts.forEach(initialSymbol.declarations, getExternalModuleContainer); + if (symbolExternalModule) { + var enclosingExternalModule = getExternalModuleContainer(enclosingDeclaration); + if (symbolExternalModule !== enclosingExternalModule) { + return { + accessibility: 2, + errorSymbolName: symbolToString(initialSymbol, enclosingDeclaration, meaning), + errorModuleName: symbolToString(symbolExternalModule) + }; + } + } + return { + accessibility: 1, + errorSymbolName: symbolToString(initialSymbol, enclosingDeclaration, meaning) + }; + } + return { accessibility: 0 }; + function getExternalModuleContainer(declaration) { + for (; declaration; declaration = declaration.parent) { + if (hasExternalModuleSymbol(declaration)) { + return getSymbolOfNode(declaration); + } + } + } + } + function hasExternalModuleSymbol(declaration) { + return ts.isAmbientModule(declaration) || (declaration.kind === 256 && ts.isExternalOrCommonJsModule(declaration)); + } + function hasVisibleDeclarations(symbol) { + var aliasesToMakeVisible; + if (ts.forEach(symbol.declarations, function (declaration) { return !getIsDeclarationVisible(declaration); })) { + return undefined; + } + return { accessibility: 0, aliasesToMakeVisible: aliasesToMakeVisible }; + function getIsDeclarationVisible(declaration) { + if (!isDeclarationVisible(declaration)) { + var anyImportSyntax = getAnyImportSyntax(declaration); + if (anyImportSyntax && + !(anyImportSyntax.flags & 1) && + isDeclarationVisible(anyImportSyntax.parent)) { + getNodeLinks(declaration).isVisible = true; + if (aliasesToMakeVisible) { + if (!ts.contains(aliasesToMakeVisible, anyImportSyntax)) { + aliasesToMakeVisible.push(anyImportSyntax); + } + } + else { + aliasesToMakeVisible = [anyImportSyntax]; + } + return true; + } + return false; + } + return true; + } + } + function isEntityNameVisible(entityName, enclosingDeclaration) { + var meaning; + if (entityName.parent.kind === 158 || ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) { + meaning = 107455 | 1048576; + } + else if (entityName.kind === 139 || entityName.kind === 172 || + entityName.parent.kind === 229) { + meaning = 1536; + } + else { + meaning = 793056; + } + var firstIdentifier = getFirstIdentifier(entityName); + var symbol = resolveName(enclosingDeclaration, firstIdentifier.text, meaning, undefined, undefined); + return (symbol && hasVisibleDeclarations(symbol)) || { + accessibility: 1, + errorSymbolName: ts.getTextOfNode(firstIdentifier), + errorNode: firstIdentifier + }; + } + function writeKeyword(writer, kind) { + writer.writeKeyword(ts.tokenToString(kind)); + } + function writePunctuation(writer, kind) { + writer.writePunctuation(ts.tokenToString(kind)); + } + function writeSpace(writer) { + writer.writeSpace(" "); + } + function symbolToString(symbol, enclosingDeclaration, meaning) { + var writer = ts.getSingleLineStringWriter(); + getSymbolDisplayBuilder().buildSymbolDisplay(symbol, writer, enclosingDeclaration, meaning); + var result = writer.string(); + ts.releaseStringWriter(writer); + return result; + } + function signatureToString(signature, enclosingDeclaration, flags, kind) { + var writer = ts.getSingleLineStringWriter(); + getSymbolDisplayBuilder().buildSignatureDisplay(signature, writer, enclosingDeclaration, flags, kind); + var result = writer.string(); + ts.releaseStringWriter(writer); + return result; + } + function typeToString(type, enclosingDeclaration, flags) { + var writer = ts.getSingleLineStringWriter(); + getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags); + var result = writer.string(); + ts.releaseStringWriter(writer); + var maxLength = compilerOptions.noErrorTruncation || flags & 4 ? undefined : 100; + if (maxLength && result.length >= maxLength) { + result = result.substr(0, maxLength - "...".length) + "..."; + } + return result; + } + function typePredicateToString(typePredicate, enclosingDeclaration, flags) { + var writer = ts.getSingleLineStringWriter(); + getSymbolDisplayBuilder().buildTypePredicateDisplay(typePredicate, writer, enclosingDeclaration, flags); + var result = writer.string(); + ts.releaseStringWriter(writer); + return result; + } + function visibilityToString(flags) { + if (flags === 8) { + return "private"; + } + if (flags === 16) { + return "protected"; + } + return "public"; + } + function getTypeAliasForTypeLiteral(type) { + if (type.symbol && type.symbol.flags & 2048) { + var node = type.symbol.declarations[0].parent; + while (node.kind === 164) { + node = node.parent; + } + if (node.kind === 223) { + return getSymbolOfNode(node); + } + } + return undefined; + } + function isTopLevelInExternalModuleAugmentation(node) { + return node && node.parent && + node.parent.kind === 226 && + ts.isExternalModuleAugmentation(node.parent.parent); + } + function getSymbolDisplayBuilder() { + function getNameOfSymbol(symbol) { + if (symbol.declarations && symbol.declarations.length) { + var declaration = symbol.declarations[0]; + if (declaration.name) { + return ts.declarationNameToString(declaration.name); + } + switch (declaration.kind) { + case 192: + return "(Anonymous class)"; + case 179: + case 180: + return "(Anonymous function)"; + } + } + return symbol.name; + } + function appendSymbolNameOnly(symbol, writer) { + writer.writeSymbol(getNameOfSymbol(symbol), symbol); + } + function appendPropertyOrElementAccessForSymbol(symbol, writer) { + var symbolName = getNameOfSymbol(symbol); + var firstChar = symbolName.charCodeAt(0); + var needsElementAccess = !ts.isIdentifierStart(firstChar, languageVersion); + if (needsElementAccess) { + writePunctuation(writer, 19); + if (ts.isSingleOrDoubleQuote(firstChar)) { + writer.writeStringLiteral(symbolName); + } + else { + writer.writeSymbol(symbolName, symbol); + } + writePunctuation(writer, 20); + } + else { + writePunctuation(writer, 21); + writer.writeSymbol(symbolName, symbol); + } + } + function buildSymbolDisplay(symbol, writer, enclosingDeclaration, meaning, flags, typeFlags) { + var parentSymbol; + function appendParentTypeArgumentsAndSymbolName(symbol) { + if (parentSymbol) { + if (flags & 1) { + if (symbol.flags & 16777216) { + buildDisplayForTypeArgumentsAndDelimiters(getTypeParametersOfClassOrInterface(parentSymbol), symbol.mapper, writer, enclosingDeclaration); + } + else { + buildTypeParameterDisplayFromSymbol(parentSymbol, writer, enclosingDeclaration); + } + } + appendPropertyOrElementAccessForSymbol(symbol, writer); + } + else { + appendSymbolNameOnly(symbol, writer); + } + parentSymbol = symbol; + } + writer.trackSymbol(symbol, enclosingDeclaration, meaning); + function walkSymbol(symbol, meaning) { + if (symbol) { + var accessibleSymbolChain = getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning, !!(flags & 2)); + if (!accessibleSymbolChain || + needsQualification(accessibleSymbolChain[0], enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning : getQualifiedLeftMeaning(meaning))) { + walkSymbol(getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol), getQualifiedLeftMeaning(meaning)); + } + if (accessibleSymbolChain) { + for (var _i = 0, accessibleSymbolChain_1 = accessibleSymbolChain; _i < accessibleSymbolChain_1.length; _i++) { + var accessibleSymbol = accessibleSymbolChain_1[_i]; + appendParentTypeArgumentsAndSymbolName(accessibleSymbol); + } + } + else { + if (!parentSymbol && ts.forEach(symbol.declarations, hasExternalModuleSymbol)) { + return; + } + if (symbol.flags & 2048 || symbol.flags & 4096) { + return; + } + appendParentTypeArgumentsAndSymbolName(symbol); + } + } + } + var isTypeParameter = symbol.flags & 262144; + var typeFormatFlag = 128 & typeFlags; + if (!isTypeParameter && (enclosingDeclaration || typeFormatFlag)) { + walkSymbol(symbol, meaning); + return; + } + return appendParentTypeArgumentsAndSymbolName(symbol); + } + function buildTypeDisplay(type, writer, enclosingDeclaration, globalFlags, symbolStack) { + var globalFlagsToPass = globalFlags & 16; + var inObjectTypeLiteral = false; + return writeType(type, globalFlags); + function writeType(type, flags) { + if (type.flags & 150995071) { + writer.writeKeyword(!(globalFlags & 16) && isTypeAny(type) + ? "any" + : type.intrinsicName); + } + else if (type.flags & 33554432) { + if (inObjectTypeLiteral) { + writer.reportInaccessibleThisError(); + } + writer.writeKeyword("this"); + } + else if (type.flags & 4096) { + writeTypeReference(type, flags); + } + else if (type.flags & (1024 | 2048 | 128 | 512)) { + buildSymbolDisplay(type.symbol, writer, enclosingDeclaration, 793056, 0, flags); + } + else if (type.flags & 8192) { + writeTupleType(type); + } + else if (type.flags & 49152) { + writeUnionOrIntersectionType(type, flags); + } + else if (type.flags & 65536) { + writeAnonymousType(type, flags); + } + else if (type.flags & 256) { + writer.writeStringLiteral("\"" + ts.escapeString(type.text) + "\""); + } + else { + writePunctuation(writer, 15); + writeSpace(writer); + writePunctuation(writer, 22); + writeSpace(writer); + writePunctuation(writer, 16); + } + } + function writeTypeList(types, delimiter) { + for (var i = 0; i < types.length; i++) { + if (i > 0) { + if (delimiter !== 24) { + writeSpace(writer); + } + writePunctuation(writer, delimiter); + writeSpace(writer); + } + writeType(types[i], delimiter === 24 ? 0 : 64); + } + } + function writeSymbolTypeReference(symbol, typeArguments, pos, end, flags) { + if (symbol.flags & 32 || !isReservedMemberName(symbol.name)) { + buildSymbolDisplay(symbol, writer, enclosingDeclaration, 793056, 0, flags); + } + if (pos < end) { + writePunctuation(writer, 25); + writeType(typeArguments[pos], 256); + pos++; + while (pos < end) { + writePunctuation(writer, 24); + writeSpace(writer); + writeType(typeArguments[pos], 0); + pos++; + } + writePunctuation(writer, 27); + } + } + function writeTypeReference(type, flags) { + var typeArguments = type.typeArguments || emptyArray; + if (type.target === globalArrayType && !(flags & 1)) { + writeType(typeArguments[0], 64); + writePunctuation(writer, 19); + writePunctuation(writer, 20); + } + else { + var outerTypeParameters = type.target.outerTypeParameters; + var i = 0; + if (outerTypeParameters) { + var length_1 = outerTypeParameters.length; + while (i < length_1) { + var start = i; + var parent_6 = getParentSymbolOfTypeParameter(outerTypeParameters[i]); + do { + i++; + } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent_6); + if (!ts.rangeEquals(outerTypeParameters, typeArguments, start, i)) { + writeSymbolTypeReference(parent_6, typeArguments, start, i, flags); + writePunctuation(writer, 21); + } + } + } + var typeParameterCount = (type.target.typeParameters || emptyArray).length; + writeSymbolTypeReference(type.symbol, typeArguments, i, typeParameterCount, flags); + } + } + function writeTupleType(type) { + writePunctuation(writer, 19); + writeTypeList(type.elementTypes, 24); + writePunctuation(writer, 20); + } + function writeUnionOrIntersectionType(type, flags) { + if (flags & 64) { + writePunctuation(writer, 17); + } + writeTypeList(type.types, type.flags & 16384 ? 47 : 46); + if (flags & 64) { + writePunctuation(writer, 18); + } + } + function writeAnonymousType(type, flags) { + var symbol = type.symbol; + if (symbol) { + if (symbol.flags & (32 | 384 | 512)) { + writeTypeOfSymbol(type, flags); + } + else if (shouldWriteTypeOfFunctionSymbol()) { + writeTypeOfSymbol(type, flags); + } + else if (ts.contains(symbolStack, symbol)) { + var typeAlias = getTypeAliasForTypeLiteral(type); + if (typeAlias) { + buildSymbolDisplay(typeAlias, writer, enclosingDeclaration, 793056, 0, flags); + } + else { + writeKeyword(writer, 117); + } + } + else { + if (!symbolStack) { + symbolStack = []; + } + symbolStack.push(symbol); + writeLiteralType(type, flags); + symbolStack.pop(); + } + } + else { + writeLiteralType(type, flags); + } + function shouldWriteTypeOfFunctionSymbol() { + var isStaticMethodSymbol = !!(symbol.flags & 8192 && + ts.forEach(symbol.declarations, function (declaration) { return declaration.flags & 32; })); + var isNonLocalFunctionSymbol = !!(symbol.flags & 16) && + (symbol.parent || + ts.forEach(symbol.declarations, function (declaration) { + return declaration.parent.kind === 256 || declaration.parent.kind === 226; + })); + if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { + return !!(flags & 2) || + (ts.contains(symbolStack, symbol)); + } + } + } + function writeTypeOfSymbol(type, typeFormatFlags) { + writeKeyword(writer, 101); + writeSpace(writer); + buildSymbolDisplay(type.symbol, writer, enclosingDeclaration, 107455, 0, typeFormatFlags); + } + function writeIndexSignature(info, keyword) { + if (info) { + if (info.isReadonly) { + writeKeyword(writer, 128); + writeSpace(writer); + } + writePunctuation(writer, 19); + writer.writeParameter(info.declaration ? ts.declarationNameToString(info.declaration.parameters[0].name) : "x"); + writePunctuation(writer, 54); + writeSpace(writer); + writeKeyword(writer, keyword); + writePunctuation(writer, 20); + writePunctuation(writer, 54); + writeSpace(writer); + writeType(info.type, 0); + writePunctuation(writer, 23); + writer.writeLine(); + } + } + function writePropertyWithModifiers(prop) { + if (isReadonlySymbol(prop)) { + writeKeyword(writer, 128); + writeSpace(writer); + } + buildSymbolDisplay(prop, writer); + if (prop.flags & 536870912) { + writePunctuation(writer, 53); + } + } + function shouldAddParenthesisAroundFunctionType(callSignature, flags) { + if (flags & 64) { + return true; + } + else if (flags & 256) { + var typeParameters = callSignature.target && (flags & 32) ? + callSignature.target.typeParameters : callSignature.typeParameters; + return typeParameters && typeParameters.length !== 0; + } + return false; + } + function writeLiteralType(type, flags) { + var resolved = resolveStructuredTypeMembers(type); + if (!resolved.properties.length && !resolved.stringIndexInfo && !resolved.numberIndexInfo) { + if (!resolved.callSignatures.length && !resolved.constructSignatures.length) { + writePunctuation(writer, 15); + writePunctuation(writer, 16); + return; + } + if (resolved.callSignatures.length === 1 && !resolved.constructSignatures.length) { + var parenthesizeSignature = shouldAddParenthesisAroundFunctionType(resolved.callSignatures[0], flags); + if (parenthesizeSignature) { + writePunctuation(writer, 17); + } + buildSignatureDisplay(resolved.callSignatures[0], writer, enclosingDeclaration, globalFlagsToPass | 8, undefined, symbolStack); + if (parenthesizeSignature) { + writePunctuation(writer, 18); + } + return; + } + if (resolved.constructSignatures.length === 1 && !resolved.callSignatures.length) { + if (flags & 64) { + writePunctuation(writer, 17); + } + writeKeyword(writer, 92); + writeSpace(writer); + buildSignatureDisplay(resolved.constructSignatures[0], writer, enclosingDeclaration, globalFlagsToPass | 8, undefined, symbolStack); + if (flags & 64) { + writePunctuation(writer, 18); + } + return; + } + } + var saveInObjectTypeLiteral = inObjectTypeLiteral; + inObjectTypeLiteral = true; + writePunctuation(writer, 15); + writer.writeLine(); + writer.increaseIndent(); + for (var _i = 0, _a = resolved.callSignatures; _i < _a.length; _i++) { + var signature = _a[_i]; + buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, undefined, symbolStack); + writePunctuation(writer, 23); + writer.writeLine(); + } + for (var _b = 0, _c = resolved.constructSignatures; _b < _c.length; _b++) { + var signature = _c[_b]; + buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, 1, symbolStack); + writePunctuation(writer, 23); + writer.writeLine(); + } + writeIndexSignature(resolved.stringIndexInfo, 132); + writeIndexSignature(resolved.numberIndexInfo, 130); + for (var _d = 0, _e = resolved.properties; _d < _e.length; _d++) { + var p = _e[_d]; + var t = getTypeOfSymbol(p); + if (p.flags & (16 | 8192) && !getPropertiesOfObjectType(t).length) { + var signatures = getSignaturesOfType(t, 0); + for (var _f = 0, signatures_1 = signatures; _f < signatures_1.length; _f++) { + var signature = signatures_1[_f]; + writePropertyWithModifiers(p); + buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, undefined, symbolStack); + writePunctuation(writer, 23); + writer.writeLine(); + } + } + else { + writePropertyWithModifiers(p); + writePunctuation(writer, 54); + writeSpace(writer); + writeType(t, 0); + writePunctuation(writer, 23); + writer.writeLine(); + } + } + writer.decreaseIndent(); + writePunctuation(writer, 16); + inObjectTypeLiteral = saveInObjectTypeLiteral; + } + } + function buildTypeParameterDisplayFromSymbol(symbol, writer, enclosingDeclaration, flags) { + var targetSymbol = getTargetSymbol(symbol); + if (targetSymbol.flags & 32 || targetSymbol.flags & 64 || targetSymbol.flags & 524288) { + buildDisplayForTypeParametersAndDelimiters(getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol), writer, enclosingDeclaration, flags); + } + } + function buildTypeParameterDisplay(tp, writer, enclosingDeclaration, flags, symbolStack) { + appendSymbolNameOnly(tp.symbol, writer); + var constraint = getConstraintOfTypeParameter(tp); + if (constraint) { + writeSpace(writer); + writeKeyword(writer, 83); + writeSpace(writer); + buildTypeDisplay(constraint, writer, enclosingDeclaration, flags, symbolStack); + } + } + function buildParameterDisplay(p, writer, enclosingDeclaration, flags, symbolStack) { + var parameterNode = p.valueDeclaration; + if (ts.isRestParameter(parameterNode)) { + writePunctuation(writer, 22); + } + if (ts.isBindingPattern(parameterNode.name)) { + buildBindingPatternDisplay(parameterNode.name, writer, enclosingDeclaration, flags, symbolStack); + } + else { + appendSymbolNameOnly(p, writer); + } + if (isOptionalParameter(parameterNode)) { + writePunctuation(writer, 53); + } + writePunctuation(writer, 54); + writeSpace(writer); + buildTypeDisplay(getTypeOfSymbol(p), writer, enclosingDeclaration, flags, symbolStack); + } + function buildBindingPatternDisplay(bindingPattern, writer, enclosingDeclaration, flags, symbolStack) { + if (bindingPattern.kind === 167) { + writePunctuation(writer, 15); + buildDisplayForCommaSeparatedList(bindingPattern.elements, writer, function (e) { return buildBindingElementDisplay(e, writer, enclosingDeclaration, flags, symbolStack); }); + writePunctuation(writer, 16); + } + else if (bindingPattern.kind === 168) { + writePunctuation(writer, 19); + var elements = bindingPattern.elements; + buildDisplayForCommaSeparatedList(elements, writer, function (e) { return buildBindingElementDisplay(e, writer, enclosingDeclaration, flags, symbolStack); }); + if (elements && elements.hasTrailingComma) { + writePunctuation(writer, 24); + } + writePunctuation(writer, 20); + } + } + function buildBindingElementDisplay(bindingElement, writer, enclosingDeclaration, flags, symbolStack) { + if (bindingElement.kind === 193) { + return; + } + ts.Debug.assert(bindingElement.kind === 169); + if (bindingElement.propertyName) { + writer.writeSymbol(ts.getTextOfNode(bindingElement.propertyName), bindingElement.symbol); + writePunctuation(writer, 54); + writeSpace(writer); + } + if (ts.isBindingPattern(bindingElement.name)) { + buildBindingPatternDisplay(bindingElement.name, writer, enclosingDeclaration, flags, symbolStack); + } + else { + if (bindingElement.dotDotDotToken) { + writePunctuation(writer, 22); + } + appendSymbolNameOnly(bindingElement.symbol, writer); + } + } + function buildDisplayForTypeParametersAndDelimiters(typeParameters, writer, enclosingDeclaration, flags, symbolStack) { + if (typeParameters && typeParameters.length) { + writePunctuation(writer, 25); + buildDisplayForCommaSeparatedList(typeParameters, writer, function (p) { return buildTypeParameterDisplay(p, writer, enclosingDeclaration, flags, symbolStack); }); + writePunctuation(writer, 27); + } + } + function buildDisplayForCommaSeparatedList(list, writer, action) { + for (var i = 0; i < list.length; i++) { + if (i > 0) { + writePunctuation(writer, 24); + writeSpace(writer); + } + action(list[i]); + } + } + function buildDisplayForTypeArgumentsAndDelimiters(typeParameters, mapper, writer, enclosingDeclaration, flags, symbolStack) { + if (typeParameters && typeParameters.length) { + writePunctuation(writer, 25); + var flags_1 = 256; + for (var i = 0; i < typeParameters.length; i++) { + if (i > 0) { + writePunctuation(writer, 24); + writeSpace(writer); + flags_1 = 0; + } + buildTypeDisplay(mapper(typeParameters[i]), writer, enclosingDeclaration, flags_1); + } + writePunctuation(writer, 27); + } + } + function buildDisplayForParametersAndDelimiters(thisType, parameters, writer, enclosingDeclaration, flags, symbolStack) { + writePunctuation(writer, 17); + if (thisType) { + writeKeyword(writer, 97); + writePunctuation(writer, 54); + writeSpace(writer); + buildTypeDisplay(thisType, writer, enclosingDeclaration, flags, symbolStack); + } + for (var i = 0; i < parameters.length; i++) { + if (i > 0 || thisType) { + writePunctuation(writer, 24); + writeSpace(writer); + } + buildParameterDisplay(parameters[i], writer, enclosingDeclaration, flags, symbolStack); + } + writePunctuation(writer, 18); + } + function buildTypePredicateDisplay(predicate, writer, enclosingDeclaration, flags, symbolStack) { + if (ts.isIdentifierTypePredicate(predicate)) { + writer.writeParameter(predicate.parameterName); + } + else { + writeKeyword(writer, 97); + } + writeSpace(writer); + writeKeyword(writer, 124); + writeSpace(writer); + buildTypeDisplay(predicate.type, writer, enclosingDeclaration, flags, symbolStack); + } + function buildReturnTypeDisplay(signature, writer, enclosingDeclaration, flags, symbolStack) { + if (flags & 8) { + writeSpace(writer); + writePunctuation(writer, 34); + } + else { + writePunctuation(writer, 54); + } + writeSpace(writer); + if (signature.typePredicate) { + buildTypePredicateDisplay(signature.typePredicate, writer, enclosingDeclaration, flags, symbolStack); + } + else { + var returnType = getReturnTypeOfSignature(signature); + buildTypeDisplay(returnType, writer, enclosingDeclaration, flags, symbolStack); + } + } + function buildSignatureDisplay(signature, writer, enclosingDeclaration, flags, kind, symbolStack) { + if (kind === 1) { + writeKeyword(writer, 92); + writeSpace(writer); + } + if (signature.target && (flags & 32)) { + buildDisplayForTypeArgumentsAndDelimiters(signature.target.typeParameters, signature.mapper, writer, enclosingDeclaration); + } + else { + buildDisplayForTypeParametersAndDelimiters(signature.typeParameters, writer, enclosingDeclaration, flags, symbolStack); + } + buildDisplayForParametersAndDelimiters(signature.thisType, signature.parameters, writer, enclosingDeclaration, flags, symbolStack); + buildReturnTypeDisplay(signature, writer, enclosingDeclaration, flags, symbolStack); + } + return _displayBuilder || (_displayBuilder = { + buildSymbolDisplay: buildSymbolDisplay, + buildTypeDisplay: buildTypeDisplay, + buildTypeParameterDisplay: buildTypeParameterDisplay, + buildTypePredicateDisplay: buildTypePredicateDisplay, + buildParameterDisplay: buildParameterDisplay, + buildDisplayForParametersAndDelimiters: buildDisplayForParametersAndDelimiters, + buildDisplayForTypeParametersAndDelimiters: buildDisplayForTypeParametersAndDelimiters, + buildTypeParameterDisplayFromSymbol: buildTypeParameterDisplayFromSymbol, + buildSignatureDisplay: buildSignatureDisplay, + buildReturnTypeDisplay: buildReturnTypeDisplay + }); + } + function isDeclarationVisible(node) { + if (node) { + var links = getNodeLinks(node); + if (links.isVisible === undefined) { + links.isVisible = !!determineIfDeclarationIsVisible(); + } + return links.isVisible; + } + return false; + function determineIfDeclarationIsVisible() { + switch (node.kind) { + case 169: + return isDeclarationVisible(node.parent.parent); + case 218: + if (ts.isBindingPattern(node.name) && + !node.name.elements.length) { + return false; + } + case 225: + case 221: + case 222: + case 223: + case 220: + case 224: + case 229: + if (ts.isExternalModuleAugmentation(node)) { + return true; + } + var parent_7 = getDeclarationContainer(node); + if (!(ts.getCombinedNodeFlags(node) & 1) && + !(node.kind !== 229 && parent_7.kind !== 256 && ts.isInAmbientContext(parent_7))) { + return isGlobalSourceFile(parent_7); + } + return isDeclarationVisible(parent_7); + case 145: + case 144: + case 149: + case 150: + case 147: + case 146: + if (node.flags & (8 | 16)) { + return false; + } + case 148: + case 152: + case 151: + case 153: + case 142: + case 226: + case 156: + case 157: + case 159: + case 155: + case 160: + case 161: + case 162: + case 163: + case 164: + return isDeclarationVisible(node.parent); + case 231: + case 232: + case 234: + return false; + case 141: + case 256: + return true; + case 235: + return false; + default: + return false; + } + } + } + function collectLinkedAliases(node) { + var exportSymbol; + if (node.parent && node.parent.kind === 235) { + exportSymbol = resolveName(node.parent, node.text, 107455 | 793056 | 1536 | 8388608, ts.Diagnostics.Cannot_find_name_0, node); + } + else if (node.parent.kind === 238) { + var exportSpecifier = node.parent; + exportSymbol = exportSpecifier.parent.parent.moduleSpecifier ? + getExternalModuleMember(exportSpecifier.parent.parent, exportSpecifier) : + resolveEntityName(exportSpecifier.propertyName || exportSpecifier.name, 107455 | 793056 | 1536 | 8388608); + } + var result = []; + if (exportSymbol) { + buildVisibleNodeList(exportSymbol.declarations); + } + return result; + function buildVisibleNodeList(declarations) { + ts.forEach(declarations, function (declaration) { + getNodeLinks(declaration).isVisible = true; + var resultNode = getAnyImportSyntax(declaration) || declaration; + if (!ts.contains(result, resultNode)) { + result.push(resultNode); + } + if (ts.isInternalModuleImportEqualsDeclaration(declaration)) { + var internalModuleReference = declaration.moduleReference; + var firstIdentifier = getFirstIdentifier(internalModuleReference); + var importSymbol = resolveName(declaration, firstIdentifier.text, 107455 | 793056 | 1536, undefined, undefined); + if (importSymbol) { + buildVisibleNodeList(importSymbol.declarations); + } + } + }); + } + } + function pushTypeResolution(target, propertyName) { + var resolutionCycleStartIndex = findResolutionCycleStartIndex(target, propertyName); + if (resolutionCycleStartIndex >= 0) { + var length_2 = resolutionTargets.length; + for (var i = resolutionCycleStartIndex; i < length_2; i++) { + resolutionResults[i] = false; + } + return false; + } + resolutionTargets.push(target); + resolutionResults.push(true); + resolutionPropertyNames.push(propertyName); + return true; + } + function findResolutionCycleStartIndex(target, propertyName) { + for (var i = resolutionTargets.length - 1; i >= 0; i--) { + if (hasType(resolutionTargets[i], resolutionPropertyNames[i])) { + return -1; + } + if (resolutionTargets[i] === target && resolutionPropertyNames[i] === propertyName) { + return i; + } + } + return -1; + } + function hasType(target, propertyName) { + if (propertyName === 0) { + return getSymbolLinks(target).type; + } + if (propertyName === 2) { + return getSymbolLinks(target).declaredType; + } + if (propertyName === 1) { + ts.Debug.assert(!!(target.flags & 1024)); + return target.resolvedBaseConstructorType; + } + if (propertyName === 3) { + return target.resolvedReturnType; + } + ts.Debug.fail("Unhandled TypeSystemPropertyName " + propertyName); + } + function popTypeResolution() { + resolutionTargets.pop(); + resolutionPropertyNames.pop(); + return resolutionResults.pop(); + } + function getDeclarationContainer(node) { + node = ts.getRootDeclaration(node); + while (node) { + switch (node.kind) { + case 218: + case 219: + case 234: + case 233: + case 232: + case 231: + node = node.parent; + break; + default: + return node.parent; + } + } + } + function getTypeOfPrototypeProperty(prototype) { + var classType = getDeclaredTypeOfSymbol(getParentOfSymbol(prototype)); + return classType.typeParameters ? createTypeReference(classType, ts.map(classType.typeParameters, function (_) { return anyType; })) : classType; + } + function getTypeOfPropertyOfType(type, name) { + var prop = getPropertyOfType(type, name); + return prop ? getTypeOfSymbol(prop) : undefined; + } + function isTypeAny(type) { + return type && (type.flags & 1) !== 0; + } + function getTypeForBindingElementParent(node) { + var symbol = getSymbolOfNode(node); + return symbol && getSymbolLinks(symbol).type || getTypeForVariableLikeDeclaration(node); + } + function getTextOfPropertyName(name) { + switch (name.kind) { + case 69: + return name.text; + case 9: + case 8: + return name.text; + case 140: + if (ts.isStringOrNumericLiteral(name.expression.kind)) { + return name.expression.text; + } + } + return undefined; + } + function isComputedNonLiteralName(name) { + return name.kind === 140 && !ts.isStringOrNumericLiteral(name.expression.kind); + } + function getTypeForBindingElement(declaration) { + var pattern = declaration.parent; + var parentType = getTypeForBindingElementParent(pattern.parent); + if (parentType === unknownType) { + return unknownType; + } + if (!parentType || isTypeAny(parentType)) { + if (declaration.initializer) { + return checkExpressionCached(declaration.initializer); + } + return parentType; + } + var type; + if (pattern.kind === 167) { + var name_10 = declaration.propertyName || declaration.name; + if (isComputedNonLiteralName(name_10)) { + return anyType; + } + if (declaration.initializer) { + getContextualType(declaration.initializer); + } + var text = getTextOfPropertyName(name_10); + type = getTypeOfPropertyOfType(parentType, text) || + isNumericLiteralName(text) && getIndexTypeOfType(parentType, 1) || + getIndexTypeOfType(parentType, 0); + if (!type) { + error(name_10, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(name_10)); + return unknownType; + } + } + else { + var elementType = checkIteratedTypeOrElementType(parentType, pattern, false); + if (!declaration.dotDotDotToken) { + var propName = "" + ts.indexOf(pattern.elements, declaration); + type = isTupleLikeType(parentType) + ? getTypeOfPropertyOfType(parentType, propName) + : elementType; + if (!type) { + if (isTupleType(parentType)) { + error(declaration, ts.Diagnostics.Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2, typeToString(parentType), parentType.elementTypes.length, pattern.elements.length); + } + else { + error(declaration, ts.Diagnostics.Type_0_has_no_property_1, typeToString(parentType), propName); + } + return unknownType; + } + } + else { + type = createArrayType(elementType); + } + } + if (strictNullChecks && declaration.initializer && !(getNullableKind(checkExpressionCached(declaration.initializer)) & 32)) { + type = getTypeWithFacts(type, 131072); + } + return type; + } + function getTypeForVariableLikeDeclarationFromJSDocComment(declaration) { + var jsDocType = getJSDocTypeForVariableLikeDeclarationFromJSDocComment(declaration); + if (jsDocType) { + return getTypeFromTypeNode(jsDocType); + } + } + function getJSDocTypeForVariableLikeDeclarationFromJSDocComment(declaration) { + var typeTag = ts.getJSDocTypeTag(declaration); + if (typeTag && typeTag.typeExpression) { + return typeTag.typeExpression.type; + } + if (declaration.kind === 218 && + declaration.parent.kind === 219 && + declaration.parent.parent.kind === 200) { + var annotation = ts.getJSDocTypeTag(declaration.parent.parent); + if (annotation && annotation.typeExpression) { + return annotation.typeExpression.type; + } + } + else if (declaration.kind === 142) { + var paramTag = ts.getCorrespondingJSDocParameterTag(declaration); + if (paramTag && paramTag.typeExpression) { + return paramTag.typeExpression.type; + } + } + return undefined; + } + function addOptionality(type, optional) { + return strictNullChecks && optional ? addNullableKind(type, 32) : type; + } + function getTypeForVariableLikeDeclaration(declaration) { + if (declaration.flags & 134217728) { + var type = getTypeForVariableLikeDeclarationFromJSDocComment(declaration); + if (type && type !== unknownType) { + return type; + } + } + if (declaration.parent.parent.kind === 207) { + return stringType; + } + if (declaration.parent.parent.kind === 208) { + return checkRightHandSideOfForOf(declaration.parent.parent.expression) || anyType; + } + if (ts.isBindingPattern(declaration.parent)) { + return getTypeForBindingElement(declaration); + } + if (declaration.type) { + return addOptionality(getTypeFromTypeNode(declaration.type), !!declaration.questionToken); + } + if (declaration.kind === 142) { + var func = declaration.parent; + if (func.kind === 150 && !ts.hasDynamicName(func)) { + var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 149); + if (getter) { + var signature = getSignatureFromDeclaration(getter); + var thisParameter = getAccessorThisParameter(func); + if (thisParameter && declaration === thisParameter) { + return signature.thisType; + } + return getReturnTypeOfSignature(signature); + } + } + var type = declaration.symbol.name === "this" + ? getContextuallyTypedThisType(func) + : getContextuallyTypedParameterType(declaration); + if (type) { + return addOptionality(type, !!declaration.questionToken); + } + } + if (declaration.initializer) { + return addOptionality(checkExpressionCached(declaration.initializer), !!declaration.questionToken); + } + if (declaration.kind === 254) { + return checkIdentifier(declaration.name); + } + if (ts.isBindingPattern(declaration.name)) { + return getTypeFromBindingPattern(declaration.name, false); + } + return undefined; + } + function getTypeFromBindingElement(element, includePatternInType) { + if (element.initializer) { + var type = checkExpressionCached(element.initializer); + reportErrorsFromWidening(element, type); + return getWidenedType(type); + } + if (ts.isBindingPattern(element.name)) { + return getTypeFromBindingPattern(element.name, includePatternInType); + } + if (compilerOptions.noImplicitAny && !declarationBelongsToPrivateAmbientMember(element)) { + reportImplicitAnyError(element, anyType); + } + return anyType; + } + function getTypeFromObjectBindingPattern(pattern, includePatternInType) { + var members = {}; + var hasComputedProperties = false; + ts.forEach(pattern.elements, function (e) { + var name = e.propertyName || e.name; + if (isComputedNonLiteralName(name)) { + hasComputedProperties = true; + return; + } + var text = getTextOfPropertyName(name); + var flags = 4 | 67108864 | (e.initializer ? 536870912 : 0); + var symbol = createSymbol(flags, text); + symbol.type = getTypeFromBindingElement(e, includePatternInType); + symbol.bindingElement = e; + members[symbol.name] = symbol; + }); + var result = createAnonymousType(undefined, members, emptyArray, emptyArray, undefined, undefined); + if (includePatternInType) { + result.pattern = pattern; + } + if (hasComputedProperties) { + result.flags |= 67108864; + } + return result; + } + function getTypeFromArrayBindingPattern(pattern, includePatternInType) { + var elements = pattern.elements; + if (elements.length === 0 || elements[elements.length - 1].dotDotDotToken) { + return languageVersion >= 2 ? createIterableType(anyType) : anyArrayType; + } + var elementTypes = ts.map(elements, function (e) { return e.kind === 193 ? anyType : getTypeFromBindingElement(e, includePatternInType); }); + if (includePatternInType) { + var result = createNewTupleType(elementTypes); + result.pattern = pattern; + return result; + } + return createTupleType(elementTypes); + } + function getTypeFromBindingPattern(pattern, includePatternInType) { + return pattern.kind === 167 + ? getTypeFromObjectBindingPattern(pattern, includePatternInType) + : getTypeFromArrayBindingPattern(pattern, includePatternInType); + } + function getWidenedTypeForVariableLikeDeclaration(declaration, reportErrors) { + var type = getTypeForVariableLikeDeclaration(declaration); + if (type) { + if (reportErrors) { + reportErrorsFromWidening(declaration, type); + } + if (declaration.kind === 253) { + return type; + } + return getWidenedType(type); + } + type = declaration.dotDotDotToken ? anyArrayType : anyType; + if (reportErrors && compilerOptions.noImplicitAny) { + if (!declarationBelongsToPrivateAmbientMember(declaration)) { + reportImplicitAnyError(declaration, type); + } + } + return type; + } + function declarationBelongsToPrivateAmbientMember(declaration) { + var root = ts.getRootDeclaration(declaration); + var memberDeclaration = root.kind === 142 ? root.parent : root; + return isPrivateWithinAmbient(memberDeclaration); + } + function getTypeOfVariableOrParameterOrProperty(symbol) { + var links = getSymbolLinks(symbol); + if (!links.type) { + if (symbol.flags & 134217728) { + return links.type = getTypeOfPrototypeProperty(symbol); + } + var declaration = symbol.valueDeclaration; + if (declaration.parent.kind === 252) { + return links.type = anyType; + } + if (declaration.kind === 235) { + return links.type = checkExpression(declaration.expression); + } + if (declaration.kind === 187) { + return links.type = getUnionType(ts.map(symbol.declarations, function (decl) { return checkExpressionCached(decl.right); })); + } + if (declaration.kind === 172) { + if (declaration.parent.kind === 187) { + return links.type = checkExpressionCached(declaration.parent.right); + } + } + if (!pushTypeResolution(symbol, 0)) { + return unknownType; + } + var type = getWidenedTypeForVariableLikeDeclaration(declaration, true); + if (!popTypeResolution()) { + if (symbol.valueDeclaration.type) { + type = unknownType; + error(symbol.valueDeclaration, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol)); + } + else { + type = anyType; + if (compilerOptions.noImplicitAny) { + error(symbol.valueDeclaration, ts.Diagnostics._0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, symbolToString(symbol)); + } + } + } + links.type = type; + } + return links.type; + } + function getAnnotatedAccessorType(accessor) { + if (accessor) { + if (accessor.kind === 149) { + return accessor.type && getTypeFromTypeNode(accessor.type); + } + else { + var setterTypeAnnotation = ts.getSetAccessorTypeAnnotationNode(accessor); + return setterTypeAnnotation && getTypeFromTypeNode(setterTypeAnnotation); + } + } + return undefined; + } + function getAnnotatedAccessorThisType(accessor) { + if (accessor) { + var parameter = getAccessorThisParameter(accessor); + if (parameter && parameter.type) { + return getTypeFromTypeNode(accessor.parameters[0].type); + } + } + return undefined; + } + function getTypeOfAccessors(symbol) { + var links = getSymbolLinks(symbol); + if (!links.type) { + var getter = ts.getDeclarationOfKind(symbol, 149); + var setter = ts.getDeclarationOfKind(symbol, 150); + if (getter && getter.flags & 134217728) { + var jsDocType = getTypeForVariableLikeDeclarationFromJSDocComment(getter); + if (jsDocType) { + return links.type = jsDocType; + } + } + if (!pushTypeResolution(symbol, 0)) { + return unknownType; + } + var type = void 0; + var getterReturnType = getAnnotatedAccessorType(getter); + if (getterReturnType) { + type = getterReturnType; + } + else { + var setterParameterType = getAnnotatedAccessorType(setter); + if (setterParameterType) { + type = setterParameterType; + } + else { + if (getter && getter.body) { + type = getReturnTypeFromBody(getter); + } + else { + if (compilerOptions.noImplicitAny) { + error(setter, ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_type_annotation, symbolToString(symbol)); + } + type = anyType; + } + } + } + if (!popTypeResolution()) { + type = anyType; + if (compilerOptions.noImplicitAny) { + var getter_1 = ts.getDeclarationOfKind(symbol, 149); + error(getter_1, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol)); + } + } + links.type = type; + } + return links.type; + } + function getTypeOfFuncClassEnumModule(symbol) { + var links = getSymbolLinks(symbol); + if (!links.type) { + var type = createObjectType(65536, symbol); + links.type = strictNullChecks && symbol.flags & 536870912 ? + addNullableKind(type, 32) : type; + } + return links.type; + } + function getTypeOfEnumMember(symbol) { + var links = getSymbolLinks(symbol); + if (!links.type) { + links.type = getDeclaredTypeOfEnum(getParentOfSymbol(symbol)); + } + return links.type; + } + function getTypeOfAlias(symbol) { + var links = getSymbolLinks(symbol); + if (!links.type) { + var targetSymbol = resolveAlias(symbol); + links.type = targetSymbol.flags & 107455 + ? getTypeOfSymbol(targetSymbol) + : unknownType; + } + return links.type; + } + function getTypeOfInstantiatedSymbol(symbol) { + var links = getSymbolLinks(symbol); + if (!links.type) { + links.type = instantiateType(getTypeOfSymbol(links.target), links.mapper); + } + return links.type; + } + function getTypeOfSymbol(symbol) { + if (symbol.flags & 16777216) { + return getTypeOfInstantiatedSymbol(symbol); + } + if (symbol.flags & (3 | 4)) { + return getTypeOfVariableOrParameterOrProperty(symbol); + } + if (symbol.flags & (16 | 8192 | 32 | 384 | 512)) { + return getTypeOfFuncClassEnumModule(symbol); + } + if (symbol.flags & 8) { + return getTypeOfEnumMember(symbol); + } + if (symbol.flags & 98304) { + return getTypeOfAccessors(symbol); + } + if (symbol.flags & 8388608) { + return getTypeOfAlias(symbol); + } + return unknownType; + } + function getTargetType(type) { + return type.flags & 4096 ? type.target : type; + } + function hasBaseType(type, checkBase) { + return check(type); + function check(type) { + var target = getTargetType(type); + return target === checkBase || ts.forEach(getBaseTypes(target), check); + } + } + function appendTypeParameters(typeParameters, declarations) { + for (var _i = 0, declarations_2 = declarations; _i < declarations_2.length; _i++) { + var declaration = declarations_2[_i]; + var tp = getDeclaredTypeOfTypeParameter(getSymbolOfNode(declaration)); + if (!typeParameters) { + typeParameters = [tp]; + } + else if (!ts.contains(typeParameters, tp)) { + typeParameters.push(tp); + } + } + return typeParameters; + } + function appendOuterTypeParameters(typeParameters, node) { + while (true) { + node = node.parent; + if (!node) { + return typeParameters; + } + if (node.kind === 221 || node.kind === 192 || + node.kind === 220 || node.kind === 179 || + node.kind === 147 || node.kind === 180) { + var declarations = node.typeParameters; + if (declarations) { + return appendTypeParameters(appendOuterTypeParameters(typeParameters, node), declarations); + } + } + } + } + function getOuterTypeParametersOfClassOrInterface(symbol) { + var declaration = symbol.flags & 32 ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 222); + return appendOuterTypeParameters(undefined, declaration); + } + function getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol) { + var result; + for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { + var node = _a[_i]; + if (node.kind === 222 || node.kind === 221 || + node.kind === 192 || node.kind === 223) { + var declaration = node; + if (declaration.typeParameters) { + result = appendTypeParameters(result, declaration.typeParameters); + } + } + } + return result; + } + function getTypeParametersOfClassOrInterface(symbol) { + return ts.concatenate(getOuterTypeParametersOfClassOrInterface(symbol), getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol)); + } + function isConstructorType(type) { + return type.flags & 80896 && getSignaturesOfType(type, 1).length > 0; + } + function getBaseTypeNodeOfClass(type) { + return ts.getClassExtendsHeritageClauseElement(type.symbol.valueDeclaration); + } + function getConstructorsForTypeArguments(type, typeArgumentNodes) { + var typeArgCount = typeArgumentNodes ? typeArgumentNodes.length : 0; + return ts.filter(getSignaturesOfType(type, 1), function (sig) { return (sig.typeParameters ? sig.typeParameters.length : 0) === typeArgCount; }); + } + function getInstantiatedConstructorsForTypeArguments(type, typeArgumentNodes) { + var signatures = getConstructorsForTypeArguments(type, typeArgumentNodes); + if (typeArgumentNodes) { + var typeArguments_1 = ts.map(typeArgumentNodes, getTypeFromTypeNode); + signatures = ts.map(signatures, function (sig) { return getSignatureInstantiation(sig, typeArguments_1); }); + } + return signatures; + } + function getBaseConstructorTypeOfClass(type) { + if (!type.resolvedBaseConstructorType) { + var baseTypeNode = getBaseTypeNodeOfClass(type); + if (!baseTypeNode) { + return type.resolvedBaseConstructorType = undefinedType; + } + if (!pushTypeResolution(type, 1)) { + return unknownType; + } + var baseConstructorType = checkExpression(baseTypeNode.expression); + if (baseConstructorType.flags & 80896) { + resolveStructuredTypeMembers(baseConstructorType); + } + if (!popTypeResolution()) { + error(type.symbol.valueDeclaration, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_base_expression, symbolToString(type.symbol)); + return type.resolvedBaseConstructorType = unknownType; + } + if (baseConstructorType !== unknownType && baseConstructorType !== nullType && !isConstructorType(baseConstructorType)) { + error(baseTypeNode.expression, ts.Diagnostics.Type_0_is_not_a_constructor_function_type, typeToString(baseConstructorType)); + return type.resolvedBaseConstructorType = unknownType; + } + type.resolvedBaseConstructorType = baseConstructorType; + } + return type.resolvedBaseConstructorType; + } + function getBaseTypes(type) { + var isClass = type.symbol.flags & 32; + var isInterface = type.symbol.flags & 64; + if (!type.resolvedBaseTypes) { + if (!isClass && !isInterface) { + ts.Debug.fail("type must be class or interface"); + } + if (isClass) { + resolveBaseTypesOfClass(type); + } + if (isInterface) { + resolveBaseTypesOfInterface(type); + } + } + return type.resolvedBaseTypes; + } + function resolveBaseTypesOfClass(type) { + type.resolvedBaseTypes = type.resolvedBaseTypes || emptyArray; + var baseConstructorType = getBaseConstructorTypeOfClass(type); + if (!(baseConstructorType.flags & 80896)) { + return; + } + var baseTypeNode = getBaseTypeNodeOfClass(type); + var baseType; + var originalBaseType = baseConstructorType && baseConstructorType.symbol ? getDeclaredTypeOfSymbol(baseConstructorType.symbol) : undefined; + if (baseConstructorType.symbol && baseConstructorType.symbol.flags & 32 && + areAllOuterTypeParametersApplied(originalBaseType)) { + baseType = getTypeFromClassOrInterfaceReference(baseTypeNode, baseConstructorType.symbol); + } + else { + var constructors = getInstantiatedConstructorsForTypeArguments(baseConstructorType, baseTypeNode.typeArguments); + if (!constructors.length) { + error(baseTypeNode.expression, ts.Diagnostics.No_base_constructor_has_the_specified_number_of_type_arguments); + return; + } + baseType = getReturnTypeOfSignature(constructors[0]); + } + if (baseType === unknownType) { + return; + } + if (!(getTargetType(baseType).flags & (1024 | 2048))) { + error(baseTypeNode.expression, ts.Diagnostics.Base_constructor_return_type_0_is_not_a_class_or_interface_type, typeToString(baseType)); + return; + } + if (type === baseType || hasBaseType(baseType, type)) { + error(type.symbol.valueDeclaration, ts.Diagnostics.Type_0_recursively_references_itself_as_a_base_type, typeToString(type, undefined, 1)); + return; + } + if (type.resolvedBaseTypes === emptyArray) { + type.resolvedBaseTypes = [baseType]; + } + else { + type.resolvedBaseTypes.push(baseType); + } + } + function areAllOuterTypeParametersApplied(type) { + var outerTypeParameters = type.outerTypeParameters; + if (outerTypeParameters) { + var last = outerTypeParameters.length - 1; + var typeArguments = type.typeArguments; + return outerTypeParameters[last].symbol !== typeArguments[last].symbol; + } + return true; + } + function resolveBaseTypesOfInterface(type) { + type.resolvedBaseTypes = type.resolvedBaseTypes || emptyArray; + for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { + var declaration = _a[_i]; + if (declaration.kind === 222 && ts.getInterfaceBaseTypeNodes(declaration)) { + for (var _b = 0, _c = ts.getInterfaceBaseTypeNodes(declaration); _b < _c.length; _b++) { + var node = _c[_b]; + var baseType = getTypeFromTypeNode(node); + if (baseType !== unknownType) { + if (getTargetType(baseType).flags & (1024 | 2048)) { + if (type !== baseType && !hasBaseType(baseType, type)) { + if (type.resolvedBaseTypes === emptyArray) { + type.resolvedBaseTypes = [baseType]; + } + else { + type.resolvedBaseTypes.push(baseType); + } + } + else { + error(declaration, ts.Diagnostics.Type_0_recursively_references_itself_as_a_base_type, typeToString(type, undefined, 1)); + } + } + else { + error(node, ts.Diagnostics.An_interface_may_only_extend_a_class_or_another_interface); + } + } + } + } + } + } + function isIndependentInterface(symbol) { + for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { + var declaration = _a[_i]; + if (declaration.kind === 222) { + if (declaration.flags & 16384) { + return false; + } + var baseTypeNodes = ts.getInterfaceBaseTypeNodes(declaration); + if (baseTypeNodes) { + for (var _b = 0, baseTypeNodes_1 = baseTypeNodes; _b < baseTypeNodes_1.length; _b++) { + var node = baseTypeNodes_1[_b]; + if (ts.isSupportedExpressionWithTypeArguments(node)) { + var baseSymbol = resolveEntityName(node.expression, 793056, true); + if (!baseSymbol || !(baseSymbol.flags & 64) || getDeclaredTypeOfClassOrInterface(baseSymbol).thisType) { + return false; + } + } + } + } + } + } + return true; + } + function getDeclaredTypeOfClassOrInterface(symbol) { + var links = getSymbolLinks(symbol); + if (!links.declaredType) { + var kind = symbol.flags & 32 ? 1024 : 2048; + var type = links.declaredType = createObjectType(kind, symbol); + var outerTypeParameters = getOuterTypeParametersOfClassOrInterface(symbol); + var localTypeParameters = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol); + if (outerTypeParameters || localTypeParameters || kind === 1024 || !isIndependentInterface(symbol)) { + type.flags |= 4096; + type.typeParameters = ts.concatenate(outerTypeParameters, localTypeParameters); + type.outerTypeParameters = outerTypeParameters; + type.localTypeParameters = localTypeParameters; + type.instantiations = {}; + type.instantiations[getTypeListId(type.typeParameters)] = type; + type.target = type; + type.typeArguments = type.typeParameters; + type.thisType = createType(512 | 33554432); + type.thisType.symbol = symbol; + type.thisType.constraint = type; + } + } + return links.declaredType; + } + function getDeclaredTypeOfTypeAlias(symbol) { + var links = getSymbolLinks(symbol); + if (!links.declaredType) { + if (!pushTypeResolution(symbol, 2)) { + return unknownType; + } + var declaration = ts.getDeclarationOfKind(symbol, 223); + var type = getTypeFromTypeNode(declaration.type); + if (popTypeResolution()) { + links.typeParameters = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol); + if (links.typeParameters) { + links.instantiations = {}; + links.instantiations[getTypeListId(links.typeParameters)] = type; + } + } + else { + type = unknownType; + error(declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol)); + } + links.declaredType = type; + } + return links.declaredType; + } + function getDeclaredTypeOfEnum(symbol) { + var links = getSymbolLinks(symbol); + if (!links.declaredType) { + var type = createType(128); + type.symbol = symbol; + links.declaredType = type; + } + return links.declaredType; + } + function getDeclaredTypeOfTypeParameter(symbol) { + var links = getSymbolLinks(symbol); + if (!links.declaredType) { + var type = createType(512); + type.symbol = symbol; + if (!ts.getDeclarationOfKind(symbol, 141).constraint) { + type.constraint = noConstraintType; + } + links.declaredType = type; + } + return links.declaredType; + } + function getDeclaredTypeOfAlias(symbol) { + var links = getSymbolLinks(symbol); + if (!links.declaredType) { + links.declaredType = getDeclaredTypeOfSymbol(resolveAlias(symbol)); + } + return links.declaredType; + } + function getDeclaredTypeOfSymbol(symbol) { + ts.Debug.assert((symbol.flags & 16777216) === 0); + if (symbol.flags & (32 | 64)) { + return getDeclaredTypeOfClassOrInterface(symbol); + } + if (symbol.flags & 524288) { + return getDeclaredTypeOfTypeAlias(symbol); + } + if (symbol.flags & 384) { + return getDeclaredTypeOfEnum(symbol); + } + if (symbol.flags & 262144) { + return getDeclaredTypeOfTypeParameter(symbol); + } + if (symbol.flags & 8388608) { + return getDeclaredTypeOfAlias(symbol); + } + return unknownType; + } + function isIndependentTypeReference(node) { + if (node.typeArguments) { + for (var _i = 0, _a = node.typeArguments; _i < _a.length; _i++) { + var typeNode = _a[_i]; + if (!isIndependentType(typeNode)) { + return false; + } + } + } + return true; + } + function isIndependentType(node) { + switch (node.kind) { + case 117: + case 132: + case 130: + case 120: + case 133: + case 103: + case 135: + case 93: + case 127: + case 166: + return true; + case 160: + return isIndependentType(node.elementType); + case 155: + return isIndependentTypeReference(node); + } + return false; + } + function isIndependentVariableLikeDeclaration(node) { + return node.type && isIndependentType(node.type) || !node.type && !node.initializer; + } + function isIndependentFunctionLikeDeclaration(node) { + if (node.kind !== 148 && (!node.type || !isIndependentType(node.type))) { + return false; + } + for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) { + var parameter = _a[_i]; + if (!isIndependentVariableLikeDeclaration(parameter)) { + return false; + } + } + return true; + } + function isIndependentMember(symbol) { + if (symbol.declarations && symbol.declarations.length === 1) { + var declaration = symbol.declarations[0]; + if (declaration) { + switch (declaration.kind) { + case 145: + case 144: + return isIndependentVariableLikeDeclaration(declaration); + case 147: + case 146: + case 148: + return isIndependentFunctionLikeDeclaration(declaration); + } + } + } + return false; + } + function createSymbolTable(symbols) { + var result = {}; + for (var _i = 0, symbols_1 = symbols; _i < symbols_1.length; _i++) { + var symbol = symbols_1[_i]; + result[symbol.name] = symbol; + } + return result; + } + function createInstantiatedSymbolTable(symbols, mapper, mappingThisOnly) { + var result = {}; + for (var _i = 0, symbols_2 = symbols; _i < symbols_2.length; _i++) { + var symbol = symbols_2[_i]; + result[symbol.name] = mappingThisOnly && isIndependentMember(symbol) ? symbol : instantiateSymbol(symbol, mapper); + } + return result; + } + function addInheritedMembers(symbols, baseSymbols) { + for (var _i = 0, baseSymbols_1 = baseSymbols; _i < baseSymbols_1.length; _i++) { + var s = baseSymbols_1[_i]; + if (!ts.hasProperty(symbols, s.name)) { + symbols[s.name] = s; + } + } + } + function resolveDeclaredMembers(type) { + if (!type.declaredProperties) { + var symbol = type.symbol; + type.declaredProperties = getNamedMembers(symbol.members); + type.declaredCallSignatures = getSignaturesOfSymbol(symbol.members["__call"]); + type.declaredConstructSignatures = getSignaturesOfSymbol(symbol.members["__new"]); + type.declaredStringIndexInfo = getIndexInfoOfSymbol(symbol, 0); + type.declaredNumberIndexInfo = getIndexInfoOfSymbol(symbol, 1); + } + return type; + } + function getTypeWithThisArgument(type, thisArgument) { + if (type.flags & 4096) { + return createTypeReference(type.target, ts.concatenate(type.typeArguments, [thisArgument || type.target.thisType])); + } + return type; + } + function resolveObjectTypeMembers(type, source, typeParameters, typeArguments) { + var mapper = identityMapper; + var members = source.symbol.members; + var callSignatures = source.declaredCallSignatures; + var constructSignatures = source.declaredConstructSignatures; + var stringIndexInfo = source.declaredStringIndexInfo; + var numberIndexInfo = source.declaredNumberIndexInfo; + if (!ts.rangeEquals(typeParameters, typeArguments, 0, typeParameters.length)) { + mapper = createTypeMapper(typeParameters, typeArguments); + members = createInstantiatedSymbolTable(source.declaredProperties, mapper, typeParameters.length === 1); + callSignatures = instantiateList(source.declaredCallSignatures, mapper, instantiateSignature); + constructSignatures = instantiateList(source.declaredConstructSignatures, mapper, instantiateSignature); + stringIndexInfo = instantiateIndexInfo(source.declaredStringIndexInfo, mapper); + numberIndexInfo = instantiateIndexInfo(source.declaredNumberIndexInfo, mapper); + } + var baseTypes = getBaseTypes(source); + if (baseTypes.length) { + if (members === source.symbol.members) { + members = createSymbolTable(source.declaredProperties); + } + var thisArgument = ts.lastOrUndefined(typeArguments); + for (var _i = 0, baseTypes_1 = baseTypes; _i < baseTypes_1.length; _i++) { + var baseType = baseTypes_1[_i]; + var instantiatedBaseType = thisArgument ? getTypeWithThisArgument(instantiateType(baseType, mapper), thisArgument) : baseType; + addInheritedMembers(members, getPropertiesOfObjectType(instantiatedBaseType)); + callSignatures = ts.concatenate(callSignatures, getSignaturesOfType(instantiatedBaseType, 0)); + constructSignatures = ts.concatenate(constructSignatures, getSignaturesOfType(instantiatedBaseType, 1)); + stringIndexInfo = stringIndexInfo || getIndexInfoOfType(instantiatedBaseType, 0); + numberIndexInfo = numberIndexInfo || getIndexInfoOfType(instantiatedBaseType, 1); + } + } + setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo); + } + function resolveClassOrInterfaceMembers(type) { + resolveObjectTypeMembers(type, resolveDeclaredMembers(type), emptyArray, emptyArray); + } + function resolveTypeReferenceMembers(type) { + var source = resolveDeclaredMembers(type.target); + var typeParameters = ts.concatenate(source.typeParameters, [source.thisType]); + var typeArguments = type.typeArguments && type.typeArguments.length === typeParameters.length ? + type.typeArguments : ts.concatenate(type.typeArguments, [type]); + resolveObjectTypeMembers(type, source, typeParameters, typeArguments); + } + function createSignature(declaration, typeParameters, thisType, parameters, resolvedReturnType, typePredicate, minArgumentCount, hasRestParameter, hasStringLiterals) { + var sig = new Signature(checker); + sig.declaration = declaration; + sig.typeParameters = typeParameters; + sig.parameters = parameters; + sig.thisType = thisType; + sig.resolvedReturnType = resolvedReturnType; + sig.typePredicate = typePredicate; + sig.minArgumentCount = minArgumentCount; + sig.hasRestParameter = hasRestParameter; + sig.hasStringLiterals = hasStringLiterals; + return sig; + } + function cloneSignature(sig) { + return createSignature(sig.declaration, sig.typeParameters, sig.thisType, sig.parameters, sig.resolvedReturnType, sig.typePredicate, sig.minArgumentCount, sig.hasRestParameter, sig.hasStringLiterals); + } + function getDefaultConstructSignatures(classType) { + var baseConstructorType = getBaseConstructorTypeOfClass(classType); + var baseSignatures = getSignaturesOfType(baseConstructorType, 1); + if (baseSignatures.length === 0) { + return [createSignature(undefined, classType.localTypeParameters, undefined, emptyArray, classType, undefined, 0, false, false)]; + } + var baseTypeNode = getBaseTypeNodeOfClass(classType); + var typeArguments = ts.map(baseTypeNode.typeArguments, getTypeFromTypeNode); + var typeArgCount = typeArguments ? typeArguments.length : 0; + var result = []; + for (var _i = 0, baseSignatures_1 = baseSignatures; _i < baseSignatures_1.length; _i++) { + var baseSig = baseSignatures_1[_i]; + var typeParamCount = baseSig.typeParameters ? baseSig.typeParameters.length : 0; + if (typeParamCount === typeArgCount) { + var sig = typeParamCount ? getSignatureInstantiation(baseSig, typeArguments) : cloneSignature(baseSig); + sig.typeParameters = classType.localTypeParameters; + sig.resolvedReturnType = classType; + result.push(sig); + } + } + return result; + } + function createTupleTypeMemberSymbols(memberTypes) { + var members = {}; + for (var i = 0; i < memberTypes.length; i++) { + var symbol = createSymbol(4 | 67108864, "" + i); + symbol.type = memberTypes[i]; + members[i] = symbol; + } + return members; + } + function resolveTupleTypeMembers(type) { + var arrayElementType = getUnionType(type.elementTypes, true); + var arrayType = resolveStructuredTypeMembers(createTypeFromGenericGlobalType(globalArrayType, [arrayElementType, type])); + var members = createTupleTypeMemberSymbols(type.elementTypes); + addInheritedMembers(members, arrayType.properties); + setObjectTypeMembers(type, members, arrayType.callSignatures, arrayType.constructSignatures, arrayType.stringIndexInfo, arrayType.numberIndexInfo); + } + function findMatchingSignature(signatureList, signature, partialMatch, ignoreThisTypes, ignoreReturnTypes) { + for (var _i = 0, signatureList_1 = signatureList; _i < signatureList_1.length; _i++) { + var s = signatureList_1[_i]; + if (compareSignaturesIdentical(s, signature, partialMatch, ignoreThisTypes, ignoreReturnTypes, compareTypesIdentical)) { + return s; + } + } + } + function findMatchingSignatures(signatureLists, signature, listIndex) { + if (signature.typeParameters) { + if (listIndex > 0) { + return undefined; + } + for (var i = 1; i < signatureLists.length; i++) { + if (!findMatchingSignature(signatureLists[i], signature, false, false, false)) { + return undefined; + } + } + return [signature]; + } + var result = undefined; + for (var i = 0; i < signatureLists.length; i++) { + var match = i === listIndex ? signature : findMatchingSignature(signatureLists[i], signature, true, true, true); + if (!match) { + return undefined; + } + if (!ts.contains(result, match)) { + (result || (result = [])).push(match); + } + } + return result; + } + function getUnionSignatures(types, kind) { + var signatureLists = ts.map(types, function (t) { return getSignaturesOfType(t, kind); }); + var result = undefined; + for (var i = 0; i < signatureLists.length; i++) { + for (var _i = 0, _a = signatureLists[i]; _i < _a.length; _i++) { + var signature = _a[_i]; + if (!result || !findMatchingSignature(result, signature, false, true, true)) { + var unionSignatures = findMatchingSignatures(signatureLists, signature, i); + if (unionSignatures) { + var s = signature; + if (unionSignatures.length > 1) { + s = cloneSignature(signature); + if (ts.forEach(unionSignatures, function (sig) { return sig.thisType; })) { + s.thisType = getUnionType(ts.map(unionSignatures, function (sig) { return sig.thisType || anyType; })); + } + s.resolvedReturnType = undefined; + s.unionSignatures = unionSignatures; + } + (result || (result = [])).push(s); + } + } + } + } + return result || emptyArray; + } + function getUnionIndexInfo(types, kind) { + var indexTypes = []; + var isAnyReadonly = false; + for (var _i = 0, types_1 = types; _i < types_1.length; _i++) { + var type = types_1[_i]; + var indexInfo = getIndexInfoOfType(type, kind); + if (!indexInfo) { + return undefined; + } + indexTypes.push(indexInfo.type); + isAnyReadonly = isAnyReadonly || indexInfo.isReadonly; + } + return createIndexInfo(getUnionType(indexTypes), isAnyReadonly); + } + function resolveUnionTypeMembers(type) { + var callSignatures = getUnionSignatures(type.types, 0); + var constructSignatures = getUnionSignatures(type.types, 1); + var stringIndexInfo = getUnionIndexInfo(type.types, 0); + var numberIndexInfo = getUnionIndexInfo(type.types, 1); + setObjectTypeMembers(type, emptySymbols, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo); + } + function intersectTypes(type1, type2) { + return !type1 ? type2 : !type2 ? type1 : getIntersectionType([type1, type2]); + } + function intersectIndexInfos(info1, info2) { + return !info1 ? info2 : !info2 ? info1 : createIndexInfo(getIntersectionType([info1.type, info2.type]), info1.isReadonly && info2.isReadonly); + } + function resolveIntersectionTypeMembers(type) { + var callSignatures = emptyArray; + var constructSignatures = emptyArray; + var stringIndexInfo = undefined; + var numberIndexInfo = undefined; + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var t = _a[_i]; + callSignatures = ts.concatenate(callSignatures, getSignaturesOfType(t, 0)); + constructSignatures = ts.concatenate(constructSignatures, getSignaturesOfType(t, 1)); + stringIndexInfo = intersectIndexInfos(stringIndexInfo, getIndexInfoOfType(t, 0)); + numberIndexInfo = intersectIndexInfos(numberIndexInfo, getIndexInfoOfType(t, 1)); + } + setObjectTypeMembers(type, emptySymbols, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo); + } + function resolveAnonymousTypeMembers(type) { + var symbol = type.symbol; + if (type.target) { + var members = createInstantiatedSymbolTable(getPropertiesOfObjectType(type.target), type.mapper, false); + var callSignatures = instantiateList(getSignaturesOfType(type.target, 0), type.mapper, instantiateSignature); + var constructSignatures = instantiateList(getSignaturesOfType(type.target, 1), type.mapper, instantiateSignature); + var stringIndexInfo = instantiateIndexInfo(getIndexInfoOfType(type.target, 0), type.mapper); + var numberIndexInfo = instantiateIndexInfo(getIndexInfoOfType(type.target, 1), type.mapper); + setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo); + } + else if (symbol.flags & 2048) { + var members = symbol.members; + var callSignatures = getSignaturesOfSymbol(members["__call"]); + var constructSignatures = getSignaturesOfSymbol(members["__new"]); + var stringIndexInfo = getIndexInfoOfSymbol(symbol, 0); + var numberIndexInfo = getIndexInfoOfSymbol(symbol, 1); + setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo); + } + else { + var members = emptySymbols; + var constructSignatures = emptyArray; + if (symbol.flags & 1952) { + members = getExportsOfSymbol(symbol); + } + if (symbol.flags & 32) { + var classType = getDeclaredTypeOfClassOrInterface(symbol); + constructSignatures = getSignaturesOfSymbol(symbol.members["__constructor"]); + if (!constructSignatures.length) { + constructSignatures = getDefaultConstructSignatures(classType); + } + var baseConstructorType = getBaseConstructorTypeOfClass(classType); + if (baseConstructorType.flags & 80896) { + members = createSymbolTable(getNamedMembers(members)); + addInheritedMembers(members, getPropertiesOfObjectType(baseConstructorType)); + } + } + var numberIndexInfo = symbol.flags & 384 ? enumNumberIndexInfo : undefined; + setObjectTypeMembers(type, members, emptyArray, constructSignatures, undefined, numberIndexInfo); + if (symbol.flags & (16 | 8192)) { + type.callSignatures = getSignaturesOfSymbol(symbol); + } + } + } + function resolveStructuredTypeMembers(type) { + if (!type.members) { + if (type.flags & 4096) { + resolveTypeReferenceMembers(type); + } + else if (type.flags & (1024 | 2048)) { + resolveClassOrInterfaceMembers(type); + } + else if (type.flags & 65536) { + resolveAnonymousTypeMembers(type); + } + else if (type.flags & 8192) { + resolveTupleTypeMembers(type); + } + else if (type.flags & 16384) { + resolveUnionTypeMembers(type); + } + else if (type.flags & 32768) { + resolveIntersectionTypeMembers(type); + } + } + return type; + } + function getPropertiesOfObjectType(type) { + if (type.flags & 80896) { + return resolveStructuredTypeMembers(type).properties; + } + return emptyArray; + } + function getPropertyOfObjectType(type, name) { + if (type.flags & 80896) { + var resolved = resolveStructuredTypeMembers(type); + if (ts.hasProperty(resolved.members, name)) { + var symbol = resolved.members[name]; + if (symbolIsValue(symbol)) { + return symbol; + } + } + } + } + function getPropertiesOfUnionOrIntersectionType(type) { + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var current = _a[_i]; + for (var _b = 0, _c = getPropertiesOfType(current); _b < _c.length; _b++) { + var prop = _c[_b]; + getPropertyOfUnionOrIntersectionType(type, prop.name); + } + if (type.flags & 16384) { + break; + } + } + return type.resolvedProperties ? symbolsToArray(type.resolvedProperties) : emptyArray; + } + function getPropertiesOfType(type) { + type = getApparentType(type); + return type.flags & 49152 ? getPropertiesOfUnionOrIntersectionType(type) : getPropertiesOfObjectType(type); + } + function getApparentTypeOfTypeParameter(type) { + if (!type.resolvedApparentType) { + var constraintType = getConstraintOfTypeParameter(type); + while (constraintType && constraintType.flags & 512) { + constraintType = getConstraintOfTypeParameter(constraintType); + } + type.resolvedApparentType = getTypeWithThisArgument(constraintType || emptyObjectType, type); + } + return type.resolvedApparentType; + } + function getApparentType(type) { + if (type.flags & 512) { + type = getApparentTypeOfTypeParameter(type); + } + if (type.flags & 258) { + type = globalStringType; + } + else if (type.flags & 132) { + type = globalNumberType; + } + else if (type.flags & 8) { + type = globalBooleanType; + } + else if (type.flags & 16777216) { + type = getGlobalESSymbolType(); + } + return type; + } + function createUnionOrIntersectionProperty(containingType, name) { + var types = containingType.types; + var props; + var commonFlags = (containingType.flags & 32768) ? 536870912 : 0; + for (var _i = 0, types_2 = types; _i < types_2.length; _i++) { + var current = types_2[_i]; + var type = getApparentType(current); + if (type !== unknownType) { + var prop = getPropertyOfType(type, name); + if (prop && !(getDeclarationFlagsFromSymbol(prop) & (8 | 16))) { + commonFlags &= prop.flags; + if (!props) { + props = [prop]; + } + else if (!ts.contains(props, prop)) { + props.push(prop); + } + } + else if (containingType.flags & 16384) { + return undefined; + } + } + } + if (!props) { + return undefined; + } + if (props.length === 1) { + return props[0]; + } + var propTypes = []; + var declarations = []; + for (var _a = 0, props_1 = props; _a < props_1.length; _a++) { + var prop = props_1[_a]; + if (prop.declarations) { + ts.addRange(declarations, prop.declarations); + } + propTypes.push(getTypeOfSymbol(prop)); + } + var result = createSymbol(4 | + 67108864 | + 268435456 | + commonFlags, name); + result.containingType = containingType; + result.declarations = declarations; + result.type = containingType.flags & 16384 ? getUnionType(propTypes) : getIntersectionType(propTypes); + return result; + } + function getPropertyOfUnionOrIntersectionType(type, name) { + var properties = type.resolvedProperties || (type.resolvedProperties = {}); + if (ts.hasProperty(properties, name)) { + return properties[name]; + } + var property = createUnionOrIntersectionProperty(type, name); + if (property) { + properties[name] = property; + } + return property; + } + function getPropertyOfType(type, name) { + type = getApparentType(type); + if (type.flags & 80896) { + var resolved = resolveStructuredTypeMembers(type); + if (ts.hasProperty(resolved.members, name)) { + var symbol = resolved.members[name]; + if (symbolIsValue(symbol)) { + return symbol; + } + } + if (resolved === anyFunctionType || resolved.callSignatures.length || resolved.constructSignatures.length) { + var symbol = getPropertyOfObjectType(globalFunctionType, name); + if (symbol) { + return symbol; + } + } + return getPropertyOfObjectType(globalObjectType, name); + } + if (type.flags & 49152) { + return getPropertyOfUnionOrIntersectionType(type, name); + } + return undefined; + } + function getSignaturesOfStructuredType(type, kind) { + if (type.flags & 130048) { + var resolved = resolveStructuredTypeMembers(type); + return kind === 0 ? resolved.callSignatures : resolved.constructSignatures; + } + return emptyArray; + } + function getSignaturesOfType(type, kind) { + return getSignaturesOfStructuredType(getApparentType(type), kind); + } + function getIndexInfoOfStructuredType(type, kind) { + if (type.flags & 130048) { + var resolved = resolveStructuredTypeMembers(type); + return kind === 0 ? resolved.stringIndexInfo : resolved.numberIndexInfo; + } + } + function getIndexTypeOfStructuredType(type, kind) { + var info = getIndexInfoOfStructuredType(type, kind); + return info && info.type; + } + function getIndexInfoOfType(type, kind) { + return getIndexInfoOfStructuredType(getApparentType(type), kind); + } + function getIndexTypeOfType(type, kind) { + return getIndexTypeOfStructuredType(getApparentType(type), kind); + } + function getImplicitIndexTypeOfType(type, kind) { + if (isObjectLiteralType(type)) { + var propTypes = []; + for (var _i = 0, _a = getPropertiesOfType(type); _i < _a.length; _i++) { + var prop = _a[_i]; + if (kind === 0 || isNumericLiteralName(prop.name)) { + propTypes.push(getTypeOfSymbol(prop)); + } + } + if (propTypes.length) { + return getUnionType(propTypes); + } + } + return undefined; + } + function getTypeParametersFromJSDocTemplate(declaration) { + if (declaration.flags & 134217728) { + var templateTag = ts.getJSDocTemplateTag(declaration); + if (templateTag) { + return getTypeParametersFromDeclaration(templateTag.typeParameters); + } + } + return undefined; + } + function getTypeParametersFromDeclaration(typeParameterDeclarations) { + var result = []; + ts.forEach(typeParameterDeclarations, function (node) { + var tp = getDeclaredTypeOfTypeParameter(node.symbol); + if (!ts.contains(result, tp)) { + result.push(tp); + } + }); + return result; + } + function symbolsToArray(symbols) { + var result = []; + for (var id in symbols) { + if (!isReservedMemberName(id)) { + result.push(symbols[id]); + } + } + return result; + } + function isOptionalParameter(node) { + if (node.flags & 134217728) { + if (node.type && node.type.kind === 268) { + return true; + } + var paramTag = ts.getCorrespondingJSDocParameterTag(node); + if (paramTag) { + if (paramTag.isBracketed) { + return true; + } + if (paramTag.typeExpression) { + return paramTag.typeExpression.type.kind === 268; + } + } + } + if (ts.hasQuestionToken(node)) { + return true; + } + if (node.initializer) { + var signatureDeclaration = node.parent; + var signature = getSignatureFromDeclaration(signatureDeclaration); + var parameterIndex = ts.indexOf(signatureDeclaration.parameters, node); + ts.Debug.assert(parameterIndex >= 0); + return parameterIndex >= signature.minArgumentCount; + } + return false; + } + function createTypePredicateFromTypePredicateNode(node) { + if (node.parameterName.kind === 69) { + var parameterName = node.parameterName; + return { + kind: 1, + parameterName: parameterName ? parameterName.text : undefined, + parameterIndex: parameterName ? getTypePredicateParameterIndex(node.parent.parameters, parameterName) : undefined, + type: getTypeFromTypeNode(node.type) + }; + } + else { + return { + kind: 0, + type: getTypeFromTypeNode(node.type) + }; + } + } + function getSignatureFromDeclaration(declaration) { + var links = getNodeLinks(declaration); + if (!links.resolvedSignature) { + var parameters = []; + var hasStringLiterals = false; + var minArgumentCount = -1; + var thisType = undefined; + var hasThisParameter = void 0; + var isJSConstructSignature = ts.isJSDocConstructSignature(declaration); + for (var i = isJSConstructSignature ? 1 : 0, n = declaration.parameters.length; i < n; i++) { + var param = declaration.parameters[i]; + var paramSymbol = param.symbol; + if (paramSymbol && !!(paramSymbol.flags & 4) && !ts.isBindingPattern(param.name)) { + var resolvedSymbol = resolveName(param, paramSymbol.name, 107455, undefined, undefined); + paramSymbol = resolvedSymbol; + } + if (i === 0 && paramSymbol.name === "this") { + hasThisParameter = true; + thisType = param.type ? getTypeFromTypeNode(param.type) : unknownType; + } + else { + parameters.push(paramSymbol); + } + if (param.type && param.type.kind === 166) { + hasStringLiterals = true; + } + if (param.initializer || param.questionToken || param.dotDotDotToken) { + if (minArgumentCount < 0) { + minArgumentCount = i - (hasThisParameter ? 1 : 0); + } + } + else { + minArgumentCount = -1; + } + } + if ((declaration.kind === 149 || declaration.kind === 150) && + !ts.hasDynamicName(declaration) && + (!hasThisParameter || thisType === unknownType)) { + var otherKind = declaration.kind === 149 ? 150 : 149; + var setter = ts.getDeclarationOfKind(declaration.symbol, otherKind); + thisType = getAnnotatedAccessorThisType(setter); + } + if (minArgumentCount < 0) { + minArgumentCount = declaration.parameters.length - (hasThisParameter ? 1 : 0); + } + if (isJSConstructSignature) { + minArgumentCount--; + } + var classType = declaration.kind === 148 ? + getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol)) + : undefined; + var typeParameters = classType ? classType.localTypeParameters : + declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : + getTypeParametersFromJSDocTemplate(declaration); + var returnType = getSignatureReturnTypeFromDeclaration(declaration, minArgumentCount, isJSConstructSignature, classType); + var typePredicate = declaration.type && declaration.type.kind === 154 ? + createTypePredicateFromTypePredicateNode(declaration.type) : + undefined; + links.resolvedSignature = createSignature(declaration, typeParameters, thisType, parameters, returnType, typePredicate, minArgumentCount, ts.hasRestParameter(declaration), hasStringLiterals); + } + return links.resolvedSignature; + } + function getSignatureReturnTypeFromDeclaration(declaration, minArgumentCount, isJSConstructSignature, classType) { + if (isJSConstructSignature) { + return getTypeFromTypeNode(declaration.parameters[0].type); + } + else if (classType) { + return classType; + } + else if (declaration.type) { + return getTypeFromTypeNode(declaration.type); + } + if (declaration.flags & 134217728) { + var type = getReturnTypeFromJSDocComment(declaration); + if (type && type !== unknownType) { + return type; + } + } + if (declaration.kind === 149 && !ts.hasDynamicName(declaration)) { + var setter = ts.getDeclarationOfKind(declaration.symbol, 150); + return getAnnotatedAccessorType(setter); + } + if (ts.nodeIsMissing(declaration.body)) { + return anyType; + } + } + function getSignaturesOfSymbol(symbol) { + if (!symbol) + return emptyArray; + var result = []; + for (var i = 0, len = symbol.declarations.length; i < len; i++) { + var node = symbol.declarations[i]; + switch (node.kind) { + case 156: + case 157: + case 220: + case 147: + case 146: + case 148: + case 151: + case 152: + case 153: + case 149: + case 150: + case 179: + case 180: + case 269: + if (i > 0 && node.body) { + var previous = symbol.declarations[i - 1]; + if (node.parent === previous.parent && node.kind === previous.kind && node.pos === previous.end) { + break; + } + } + result.push(getSignatureFromDeclaration(node)); + } + } + return result; + } + function resolveExternalModuleTypeByLiteral(name) { + var moduleSym = resolveExternalModuleName(name, name); + if (moduleSym) { + var resolvedModuleSymbol = resolveExternalModuleSymbol(moduleSym); + if (resolvedModuleSymbol) { + return getTypeOfSymbol(resolvedModuleSymbol); + } + } + return anyType; + } + function getReturnTypeOfSignature(signature) { + if (!signature.resolvedReturnType) { + if (!pushTypeResolution(signature, 3)) { + return unknownType; + } + var type = void 0; + if (signature.target) { + type = instantiateType(getReturnTypeOfSignature(signature.target), signature.mapper); + } + else if (signature.unionSignatures) { + type = getUnionType(ts.map(signature.unionSignatures, getReturnTypeOfSignature)); + } + else { + type = getReturnTypeFromBody(signature.declaration); + } + if (!popTypeResolution()) { + type = anyType; + if (compilerOptions.noImplicitAny) { + var declaration = signature.declaration; + if (declaration.name) { + error(declaration.name, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, ts.declarationNameToString(declaration.name)); + } + else { + error(declaration, ts.Diagnostics.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); + } + } + } + signature.resolvedReturnType = type; + } + return signature.resolvedReturnType; + } + function getRestTypeOfSignature(signature) { + if (signature.hasRestParameter) { + var type = getTypeOfSymbol(ts.lastOrUndefined(signature.parameters)); + if (type.flags & 4096 && type.target === globalArrayType) { + return type.typeArguments[0]; + } + } + return anyType; + } + function getSignatureInstantiation(signature, typeArguments) { + return instantiateSignature(signature, createTypeMapper(signature.typeParameters, typeArguments), true); + } + function getErasedSignature(signature) { + if (!signature.typeParameters) + return signature; + if (!signature.erasedSignatureCache) { + signature.erasedSignatureCache = instantiateSignature(signature, createTypeEraser(signature.typeParameters), true); + } + return signature.erasedSignatureCache; + } + function getOrCreateTypeFromSignature(signature) { + if (!signature.isolatedSignatureType) { + var isConstructor = signature.declaration.kind === 148 || signature.declaration.kind === 152; + var type = createObjectType(65536 | 262144); + type.members = emptySymbols; + type.properties = emptyArray; + type.callSignatures = !isConstructor ? [signature] : emptyArray; + type.constructSignatures = isConstructor ? [signature] : emptyArray; + signature.isolatedSignatureType = type; + } + return signature.isolatedSignatureType; + } + function getIndexSymbol(symbol) { + return symbol.members["__index"]; + } + function getIndexDeclarationOfSymbol(symbol, kind) { + var syntaxKind = kind === 1 ? 130 : 132; + var indexSymbol = getIndexSymbol(symbol); + if (indexSymbol) { + for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { + var decl = _a[_i]; + var node = decl; + if (node.parameters.length === 1) { + var parameter = node.parameters[0]; + if (parameter && parameter.type && parameter.type.kind === syntaxKind) { + return node; + } + } + } + } + return undefined; + } + function createIndexInfo(type, isReadonly, declaration) { + return { type: type, isReadonly: isReadonly, declaration: declaration }; + } + function getIndexInfoOfSymbol(symbol, kind) { + var declaration = getIndexDeclarationOfSymbol(symbol, kind); + if (declaration) { + return createIndexInfo(declaration.type ? getTypeFromTypeNode(declaration.type) : anyType, (declaration.flags & 64) !== 0, declaration); + } + return undefined; + } + function getConstraintDeclaration(type) { + return ts.getDeclarationOfKind(type.symbol, 141).constraint; + } + function hasConstraintReferenceTo(type, target) { + var checked; + while (type && !(type.flags & 33554432) && type.flags & 512 && !ts.contains(checked, type)) { + if (type === target) { + return true; + } + (checked || (checked = [])).push(type); + var constraintDeclaration = getConstraintDeclaration(type); + type = constraintDeclaration && getTypeFromTypeNode(constraintDeclaration); + } + return false; + } + function getConstraintOfTypeParameter(typeParameter) { + if (!typeParameter.constraint) { + if (typeParameter.target) { + var targetConstraint = getConstraintOfTypeParameter(typeParameter.target); + typeParameter.constraint = targetConstraint ? instantiateType(targetConstraint, typeParameter.mapper) : noConstraintType; + } + else { + var constraintDeclaration = getConstraintDeclaration(typeParameter); + var constraint = getTypeFromTypeNode(constraintDeclaration); + if (hasConstraintReferenceTo(constraint, typeParameter)) { + error(constraintDeclaration, ts.Diagnostics.Type_parameter_0_has_a_circular_constraint, typeToString(typeParameter)); + constraint = unknownType; + } + typeParameter.constraint = constraint; + } + } + return typeParameter.constraint === noConstraintType ? undefined : typeParameter.constraint; + } + function getParentSymbolOfTypeParameter(typeParameter) { + return getSymbolOfNode(ts.getDeclarationOfKind(typeParameter.symbol, 141).parent); + } + function getTypeListId(types) { + if (types) { + switch (types.length) { + case 1: + return "" + types[0].id; + case 2: + return types[0].id + "," + types[1].id; + default: + var result = ""; + for (var i = 0; i < types.length; i++) { + if (i > 0) { + result += ","; + } + result += types[i].id; + } + return result; + } + } + return ""; + } + function getPropagatingFlagsOfTypes(types, excludeKinds) { + var result = 0; + for (var _i = 0, types_3 = types; _i < types_3.length; _i++) { + var type = types_3[_i]; + if (!(type.flags & excludeKinds)) { + result |= type.flags; + } + } + return result & 14680064; + } + function createTypeReference(target, typeArguments) { + var id = getTypeListId(typeArguments); + var type = target.instantiations[id]; + if (!type) { + var propagatedFlags = typeArguments ? getPropagatingFlagsOfTypes(typeArguments, 0) : 0; + var flags = 4096 | propagatedFlags; + type = target.instantiations[id] = createObjectType(flags, target.symbol); + type.target = target; + type.typeArguments = typeArguments; + } + return type; + } + function getTypeFromClassOrInterfaceReference(node, symbol) { + var type = getDeclaredTypeOfSymbol(getMergedSymbol(symbol)); + var typeParameters = type.localTypeParameters; + if (typeParameters) { + if (!node.typeArguments || node.typeArguments.length !== typeParameters.length) { + error(node, ts.Diagnostics.Generic_type_0_requires_1_type_argument_s, typeToString(type, undefined, 1), typeParameters.length); + return unknownType; + } + return createTypeReference(type, ts.concatenate(type.outerTypeParameters, ts.map(node.typeArguments, getTypeFromTypeNode))); + } + if (node.typeArguments) { + error(node, ts.Diagnostics.Type_0_is_not_generic, typeToString(type)); + return unknownType; + } + return type; + } + function getTypeFromTypeAliasReference(node, symbol) { + var type = getDeclaredTypeOfSymbol(symbol); + var links = getSymbolLinks(symbol); + var typeParameters = links.typeParameters; + if (typeParameters) { + if (!node.typeArguments || node.typeArguments.length !== typeParameters.length) { + error(node, ts.Diagnostics.Generic_type_0_requires_1_type_argument_s, symbolToString(symbol), typeParameters.length); + return unknownType; + } + var typeArguments = ts.map(node.typeArguments, getTypeFromTypeNode); + var id = getTypeListId(typeArguments); + return links.instantiations[id] || (links.instantiations[id] = instantiateType(type, createTypeMapper(typeParameters, typeArguments))); + } + if (node.typeArguments) { + error(node, ts.Diagnostics.Type_0_is_not_generic, symbolToString(symbol)); + return unknownType; + } + return type; + } + function getTypeFromNonGenericTypeReference(node, symbol) { + if (node.typeArguments) { + error(node, ts.Diagnostics.Type_0_is_not_generic, symbolToString(symbol)); + return unknownType; + } + return getDeclaredTypeOfSymbol(symbol); + } + function getTypeReferenceName(node) { + switch (node.kind) { + case 155: + return node.typeName; + case 267: + return node.name; + case 194: + if (ts.isSupportedExpressionWithTypeArguments(node)) { + return node.expression; + } + } + return undefined; + } + function resolveTypeReferenceName(node, typeReferenceName) { + if (!typeReferenceName) { + return unknownSymbol; + } + return resolveEntityName(typeReferenceName, 793056) || unknownSymbol; + } + function getTypeReferenceType(node, symbol) { + if (symbol === unknownSymbol) { + return unknownType; + } + if (symbol.flags & (32 | 64)) { + return getTypeFromClassOrInterfaceReference(node, symbol); + } + if (symbol.flags & 524288) { + return getTypeFromTypeAliasReference(node, symbol); + } + if (symbol.flags & 107455 && node.kind === 267) { + return getTypeOfSymbol(symbol); + } + return getTypeFromNonGenericTypeReference(node, symbol); + } + function getTypeFromTypeReference(node) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + var symbol = void 0; + var type = void 0; + if (node.kind === 267) { + var typeReferenceName = getTypeReferenceName(node); + symbol = resolveTypeReferenceName(node, typeReferenceName); + type = getTypeReferenceType(node, symbol); + links.resolvedSymbol = symbol; + links.resolvedType = type; + } + else { + var typeNameOrExpression = node.kind === 155 ? node.typeName : + ts.isSupportedExpressionWithTypeArguments(node) ? node.expression : + undefined; + symbol = typeNameOrExpression && resolveEntityName(typeNameOrExpression, 793056) || unknownSymbol; + type = symbol === unknownSymbol ? unknownType : + symbol.flags & (32 | 64) ? getTypeFromClassOrInterfaceReference(node, symbol) : + symbol.flags & 524288 ? getTypeFromTypeAliasReference(node, symbol) : + getTypeFromNonGenericTypeReference(node, symbol); + } + links.resolvedSymbol = symbol; + links.resolvedType = type; + } + return links.resolvedType; + } + function getTypeFromTypeQueryNode(node) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + links.resolvedType = getWidenedType(checkExpression(node.exprName)); + } + return links.resolvedType; + } + function getTypeOfGlobalSymbol(symbol, arity) { + function getTypeDeclaration(symbol) { + var declarations = symbol.declarations; + for (var _i = 0, declarations_3 = declarations; _i < declarations_3.length; _i++) { + var declaration = declarations_3[_i]; + switch (declaration.kind) { + case 221: + case 222: + case 224: + return declaration; + } + } + } + if (!symbol) { + return arity ? emptyGenericType : emptyObjectType; + } + var type = getDeclaredTypeOfSymbol(symbol); + if (!(type.flags & 80896)) { + error(getTypeDeclaration(symbol), ts.Diagnostics.Global_type_0_must_be_a_class_or_interface_type, symbol.name); + return arity ? emptyGenericType : emptyObjectType; + } + if ((type.typeParameters ? type.typeParameters.length : 0) !== arity) { + error(getTypeDeclaration(symbol), ts.Diagnostics.Global_type_0_must_have_1_type_parameter_s, symbol.name, arity); + return arity ? emptyGenericType : emptyObjectType; + } + return type; + } + function getGlobalValueSymbol(name) { + return getGlobalSymbol(name, 107455, ts.Diagnostics.Cannot_find_global_value_0); + } + function getGlobalTypeSymbol(name) { + return getGlobalSymbol(name, 793056, ts.Diagnostics.Cannot_find_global_type_0); + } + function getGlobalSymbol(name, meaning, diagnostic) { + return resolveName(undefined, name, meaning, diagnostic, name); + } + function getGlobalType(name, arity) { + if (arity === void 0) { arity = 0; } + return getTypeOfGlobalSymbol(getGlobalTypeSymbol(name), arity); + } + function getExportedTypeFromNamespace(namespace, name) { + var namespaceSymbol = getGlobalSymbol(namespace, 1536, undefined); + var typeSymbol = namespaceSymbol && getSymbol(namespaceSymbol.exports, name, 793056); + return typeSymbol && getDeclaredTypeOfSymbol(typeSymbol); + } + function createTypedPropertyDescriptorType(propertyType) { + var globalTypedPropertyDescriptorType = getGlobalTypedPropertyDescriptorType(); + return globalTypedPropertyDescriptorType !== emptyGenericType + ? createTypeReference(globalTypedPropertyDescriptorType, [propertyType]) + : emptyObjectType; + } + function createTypeFromGenericGlobalType(genericGlobalType, typeArguments) { + return genericGlobalType !== emptyGenericType ? createTypeReference(genericGlobalType, typeArguments) : emptyObjectType; + } + function createIterableType(elementType) { + return createTypeFromGenericGlobalType(getGlobalIterableType(), [elementType]); + } + function createIterableIteratorType(elementType) { + return createTypeFromGenericGlobalType(getGlobalIterableIteratorType(), [elementType]); + } + function createArrayType(elementType) { + return createTypeFromGenericGlobalType(globalArrayType, [elementType]); + } + function getTypeFromArrayTypeNode(node) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + links.resolvedType = createArrayType(getTypeFromTypeNode(node.elementType)); + } + return links.resolvedType; + } + function createTupleType(elementTypes) { + var id = getTypeListId(elementTypes); + return tupleTypes[id] || (tupleTypes[id] = createNewTupleType(elementTypes)); + } + function createNewTupleType(elementTypes) { + var propagatedFlags = getPropagatingFlagsOfTypes(elementTypes, 0); + var type = createObjectType(8192 | propagatedFlags); + type.elementTypes = elementTypes; + return type; + } + function getTypeFromTupleTypeNode(node) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + links.resolvedType = createTupleType(ts.map(node.elementTypes, getTypeFromTypeNode)); + } + return links.resolvedType; + } + function addTypeToSet(typeSet, type, typeSetKind) { + if (type.flags & typeSetKind) { + addTypesToSet(typeSet, type.types, typeSetKind); + } + else if (type.flags & (1 | 32 | 64)) { + if (type.flags & 1) + typeSet.containsAny = true; + if (type.flags & 32) + typeSet.containsUndefined = true; + if (type.flags & 64) + typeSet.containsNull = true; + } + else if (type !== neverType && !ts.contains(typeSet, type)) { + typeSet.push(type); + } + } + function addTypesToSet(typeSet, types, typeSetKind) { + for (var _i = 0, types_4 = types; _i < types_4.length; _i++) { + var type = types_4[_i]; + addTypeToSet(typeSet, type, typeSetKind); + } + } + function isSubtypeOfAny(candidate, types) { + for (var i = 0, len = types.length; i < len; i++) { + if (candidate !== types[i] && isTypeSubtypeOf(candidate, types[i])) { + return true; + } + } + return false; + } + function removeSubtypes(types) { + var i = types.length; + while (i > 0) { + i--; + if (isSubtypeOfAny(types[i], types)) { + types.splice(i, 1); + } + } + } + function getUnionType(types, noSubtypeReduction) { + if (types.length === 0) { + return neverType; + } + if (types.length === 1) { + return types[0]; + } + var typeSet = []; + addTypesToSet(typeSet, types, 16384); + if (typeSet.containsAny) { + return anyType; + } + if (strictNullChecks) { + if (typeSet.containsNull) + typeSet.push(nullType); + if (typeSet.containsUndefined) + typeSet.push(undefinedType); + } + if (!noSubtypeReduction) { + removeSubtypes(typeSet); + } + if (typeSet.length === 0) { + return typeSet.containsNull ? nullType : + typeSet.containsUndefined ? undefinedType : + neverType; + } + else if (typeSet.length === 1) { + return typeSet[0]; + } + var id = getTypeListId(typeSet); + var type = unionTypes[id]; + if (!type) { + var propagatedFlags = getPropagatingFlagsOfTypes(typeSet, 96); + type = unionTypes[id] = createObjectType(16384 | propagatedFlags); + type.types = typeSet; + } + return type; + } + function getTypeFromUnionTypeNode(node) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + links.resolvedType = getUnionType(ts.map(node.types, getTypeFromTypeNode), true); + } + return links.resolvedType; + } + function getIntersectionType(types) { + if (types.length === 0) { + return emptyObjectType; + } + var typeSet = []; + addTypesToSet(typeSet, types, 32768); + if (typeSet.containsAny) { + return anyType; + } + if (strictNullChecks) { + if (typeSet.containsNull) + typeSet.push(nullType); + if (typeSet.containsUndefined) + typeSet.push(undefinedType); + } + if (typeSet.length === 1) { + return typeSet[0]; + } + var id = getTypeListId(typeSet); + var type = intersectionTypes[id]; + if (!type) { + var propagatedFlags = getPropagatingFlagsOfTypes(typeSet, 96); + type = intersectionTypes[id] = createObjectType(32768 | propagatedFlags); + type.types = typeSet; + } + return type; + } + function getTypeFromIntersectionTypeNode(node) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + links.resolvedType = getIntersectionType(ts.map(node.types, getTypeFromTypeNode)); + } + return links.resolvedType; + } + function getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + links.resolvedType = createObjectType(65536, node.symbol); + } + return links.resolvedType; + } + function getStringLiteralTypeForText(text) { + if (ts.hasProperty(stringLiteralTypes, text)) { + return stringLiteralTypes[text]; + } + var type = stringLiteralTypes[text] = createType(256); + type.text = text; + return type; + } + function getTypeFromStringLiteralTypeNode(node) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + links.resolvedType = getStringLiteralTypeForText(ts.unescapeIdentifier(node.text)); + } + return links.resolvedType; + } + function getTypeFromJSDocVariadicType(node) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + var type = getTypeFromTypeNode(node.type); + links.resolvedType = type ? createArrayType(type) : unknownType; + } + return links.resolvedType; + } + function getTypeFromJSDocTupleType(node) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + var types = ts.map(node.types, getTypeFromTypeNode); + links.resolvedType = createTupleType(types); + } + return links.resolvedType; + } + function getThisType(node) { + var container = ts.getThisContainer(node, false); + var parent = container && container.parent; + if (parent && (ts.isClassLike(parent) || parent.kind === 222)) { + if (!(container.flags & 32) && + (container.kind !== 148 || ts.isNodeDescendentOf(node, container.body))) { + return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent)).thisType; + } + } + error(node, ts.Diagnostics.A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface); + return unknownType; + } + function getTypeFromThisTypeNode(node) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + links.resolvedType = getThisType(node); + } + return links.resolvedType; + } + function getTypeFromTypeNode(node) { + switch (node.kind) { + case 117: + case 258: + case 259: + return anyType; + case 132: + return stringType; + case 130: + return numberType; + case 120: + return booleanType; + case 133: + return esSymbolType; + case 103: + return voidType; + case 135: + return undefinedType; + case 93: + return nullType; + case 127: + return neverType; + case 165: + case 97: + return getTypeFromThisTypeNode(node); + case 166: + return getTypeFromStringLiteralTypeNode(node); + case 155: + case 267: + return getTypeFromTypeReference(node); + case 154: + return booleanType; + case 194: + return getTypeFromTypeReference(node); + case 158: + return getTypeFromTypeQueryNode(node); + case 160: + case 260: + return getTypeFromArrayTypeNode(node); + case 161: + return getTypeFromTupleTypeNode(node); + case 162: + case 261: + return getTypeFromUnionTypeNode(node); + case 163: + return getTypeFromIntersectionTypeNode(node); + case 164: + case 263: + case 264: + case 271: + case 272: + case 268: + return getTypeFromTypeNode(node.type); + case 156: + case 157: + case 159: + case 269: + case 265: + return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); + case 69: + case 139: + var symbol = getSymbolAtLocation(node); + return symbol && getDeclaredTypeOfSymbol(symbol); + case 262: + return getTypeFromJSDocTupleType(node); + case 270: + return getTypeFromJSDocVariadicType(node); + default: + return unknownType; + } + } + function instantiateList(items, mapper, instantiator) { + if (items && items.length) { + var result = []; + for (var _i = 0, items_1 = items; _i < items_1.length; _i++) { + var v = items_1[_i]; + result.push(instantiator(v, mapper)); + } + return result; + } + return items; + } + function createUnaryTypeMapper(source, target) { + return function (t) { return t === source ? target : t; }; + } + function createBinaryTypeMapper(source1, target1, source2, target2) { + return function (t) { return t === source1 ? target1 : t === source2 ? target2 : t; }; + } + function createArrayTypeMapper(sources, targets) { + return function (t) { + for (var i = 0; i < sources.length; i++) { + if (t === sources[i]) { + return targets ? targets[i] : anyType; + } + } + return t; + }; + } + function createTypeMapper(sources, targets) { + var count = sources.length; + var mapper = count == 1 ? createUnaryTypeMapper(sources[0], targets ? targets[0] : anyType) : + count == 2 ? createBinaryTypeMapper(sources[0], targets ? targets[0] : anyType, sources[1], targets ? targets[1] : anyType) : + createArrayTypeMapper(sources, targets); + mapper.mappedTypes = sources; + return mapper; + } + function createTypeEraser(sources) { + return createTypeMapper(sources, undefined); + } + function getInferenceMapper(context) { + if (!context.mapper) { + var mapper = function (t) { + var typeParameters = context.typeParameters; + for (var i = 0; i < typeParameters.length; i++) { + if (t === typeParameters[i]) { + context.inferences[i].isFixed = true; + return getInferredType(context, i); + } + } + return t; + }; + mapper.mappedTypes = context.typeParameters; + mapper.context = context; + context.mapper = mapper; + } + return context.mapper; + } + function identityMapper(type) { + return type; + } + function combineTypeMappers(mapper1, mapper2) { + var mapper = function (t) { return instantiateType(mapper1(t), mapper2); }; + mapper.mappedTypes = mapper1.mappedTypes; + return mapper; + } + function cloneTypeParameter(typeParameter) { + var result = createType(512); + result.symbol = typeParameter.symbol; + result.target = typeParameter; + return result; + } + function cloneTypePredicate(predicate, mapper) { + if (ts.isIdentifierTypePredicate(predicate)) { + return { + kind: 1, + parameterName: predicate.parameterName, + parameterIndex: predicate.parameterIndex, + type: instantiateType(predicate.type, mapper) + }; + } + else { + return { + kind: 0, + type: instantiateType(predicate.type, mapper) + }; + } + } + function instantiateSignature(signature, mapper, eraseTypeParameters) { + var freshTypeParameters; + var freshTypePredicate; + if (signature.typeParameters && !eraseTypeParameters) { + freshTypeParameters = ts.map(signature.typeParameters, cloneTypeParameter); + mapper = combineTypeMappers(createTypeMapper(signature.typeParameters, freshTypeParameters), mapper); + for (var _i = 0, freshTypeParameters_1 = freshTypeParameters; _i < freshTypeParameters_1.length; _i++) { + var tp = freshTypeParameters_1[_i]; + tp.mapper = mapper; + } + } + if (signature.typePredicate) { + freshTypePredicate = cloneTypePredicate(signature.typePredicate, mapper); + } + var result = createSignature(signature.declaration, freshTypeParameters, signature.thisType && instantiateType(signature.thisType, mapper), instantiateList(signature.parameters, mapper, instantiateSymbol), instantiateType(signature.resolvedReturnType, mapper), freshTypePredicate, signature.minArgumentCount, signature.hasRestParameter, signature.hasStringLiterals); + result.target = signature; + result.mapper = mapper; + return result; + } + function instantiateSymbol(symbol, mapper) { + if (symbol.flags & 16777216) { + var links = getSymbolLinks(symbol); + symbol = links.target; + mapper = combineTypeMappers(links.mapper, mapper); + } + var result = createSymbol(16777216 | 67108864 | symbol.flags, symbol.name); + result.declarations = symbol.declarations; + result.parent = symbol.parent; + result.target = symbol; + result.mapper = mapper; + if (symbol.valueDeclaration) { + result.valueDeclaration = symbol.valueDeclaration; + } + return result; + } + function instantiateAnonymousType(type, mapper) { + if (mapper.instantiations) { + var cachedType = mapper.instantiations[type.id]; + if (cachedType) { + return cachedType; + } + } + else { + mapper.instantiations = []; + } + var result = createObjectType(65536 | 131072, type.symbol); + result.target = type; + result.mapper = mapper; + mapper.instantiations[type.id] = result; + return result; + } + function isSymbolInScopeOfMappedTypeParameter(symbol, mapper) { + var mappedTypes = mapper.mappedTypes; + var node = symbol.declarations[0].parent; + while (node) { + switch (node.kind) { + case 156: + case 157: + case 220: + case 147: + case 146: + case 148: + case 151: + case 152: + case 153: + case 149: + case 150: + case 179: + case 180: + case 221: + case 192: + case 222: + case 223: + var declaration = node; + if (declaration.typeParameters) { + for (var _i = 0, _a = declaration.typeParameters; _i < _a.length; _i++) { + var d = _a[_i]; + if (ts.contains(mappedTypes, getDeclaredTypeOfTypeParameter(getSymbolOfNode(d)))) { + return true; + } + } + } + if (ts.isClassLike(node) || node.kind === 222) { + var thisType = getDeclaredTypeOfClassOrInterface(getSymbolOfNode(node)).thisType; + if (thisType && ts.contains(mappedTypes, thisType)) { + return true; + } + } + break; + case 225: + case 256: + return false; + } + node = node.parent; + } + return false; + } + function instantiateType(type, mapper) { + if (type && mapper !== identityMapper) { + if (type.flags & 512) { + return mapper(type); + } + if (type.flags & 65536) { + return type.symbol && + type.symbol.flags & (16 | 8192 | 32 | 2048 | 4096) && + (type.flags & 131072 || isSymbolInScopeOfMappedTypeParameter(type.symbol, mapper)) ? + instantiateAnonymousType(type, mapper) : type; + } + if (type.flags & 4096) { + return createTypeReference(type.target, instantiateList(type.typeArguments, mapper, instantiateType)); + } + if (type.flags & 8192) { + return createTupleType(instantiateList(type.elementTypes, mapper, instantiateType)); + } + if (type.flags & 16384) { + return getUnionType(instantiateList(type.types, mapper, instantiateType), true); + } + if (type.flags & 32768) { + return getIntersectionType(instantiateList(type.types, mapper, instantiateType)); + } + } + return type; + } + function instantiateIndexInfo(info, mapper) { + return info && createIndexInfo(instantiateType(info.type, mapper), info.isReadonly, info.declaration); + } + function isContextSensitive(node) { + ts.Debug.assert(node.kind !== 147 || ts.isObjectLiteralMethod(node)); + switch (node.kind) { + case 179: + case 180: + return isContextSensitiveFunctionLikeDeclaration(node); + case 171: + return ts.forEach(node.properties, isContextSensitive); + case 170: + return ts.forEach(node.elements, isContextSensitive); + case 188: + return isContextSensitive(node.whenTrue) || + isContextSensitive(node.whenFalse); + case 187: + return node.operatorToken.kind === 52 && + (isContextSensitive(node.left) || isContextSensitive(node.right)); + case 253: + return isContextSensitive(node.initializer); + case 147: + case 146: + return isContextSensitiveFunctionLikeDeclaration(node); + case 178: + return isContextSensitive(node.expression); + } + return false; + } + function isContextSensitiveFunctionLikeDeclaration(node) { + var areAllParametersUntyped = !ts.forEach(node.parameters, function (p) { return p.type; }); + var isNullaryArrow = node.kind === 180 && !node.parameters.length; + return !node.typeParameters && areAllParametersUntyped && !isNullaryArrow; + } + function isContextSensitiveFunctionOrObjectLiteralMethod(func) { + return (isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) && isContextSensitiveFunctionLikeDeclaration(func); + } + function getTypeWithoutSignatures(type) { + if (type.flags & 80896) { + var resolved = resolveStructuredTypeMembers(type); + if (resolved.constructSignatures.length) { + var result = createObjectType(65536, type.symbol); + result.members = resolved.members; + result.properties = resolved.properties; + result.callSignatures = emptyArray; + result.constructSignatures = emptyArray; + type = result; + } + } + return type; + } + function isTypeIdenticalTo(source, target) { + return checkTypeRelatedTo(source, target, identityRelation, undefined); + } + function compareTypesIdentical(source, target) { + return checkTypeRelatedTo(source, target, identityRelation, undefined) ? -1 : 0; + } + function compareTypesAssignable(source, target) { + return checkTypeRelatedTo(source, target, assignableRelation, undefined) ? -1 : 0; + } + function isTypeSubtypeOf(source, target) { + return checkTypeSubtypeOf(source, target, undefined); + } + function isTypeAssignableTo(source, target) { + return checkTypeAssignableTo(source, target, undefined); + } + function isTypeComparableTo(source, target) { + return checkTypeComparableTo(source, target, undefined); + } + function checkTypeSubtypeOf(source, target, errorNode, headMessage, containingMessageChain) { + return checkTypeRelatedTo(source, target, subtypeRelation, errorNode, headMessage, containingMessageChain); + } + function checkTypeAssignableTo(source, target, errorNode, headMessage, containingMessageChain) { + return checkTypeRelatedTo(source, target, assignableRelation, errorNode, headMessage, containingMessageChain); + } + function checkTypeComparableTo(source, target, errorNode, headMessage, containingMessageChain) { + return checkTypeRelatedTo(source, target, comparableRelation, errorNode, headMessage, containingMessageChain); + } + function isSignatureAssignableTo(source, target, ignoreReturnTypes) { + return compareSignaturesRelated(source, target, ignoreReturnTypes, false, undefined, compareTypesAssignable) !== 0; + } + function compareSignaturesRelated(source, target, ignoreReturnTypes, reportErrors, errorReporter, compareTypes) { + if (source === target) { + return -1; + } + if (!target.hasRestParameter && source.minArgumentCount > target.parameters.length) { + return 0; + } + source = getErasedSignature(source); + target = getErasedSignature(target); + var result = -1; + if (source.thisType && target.thisType && source.thisType !== voidType) { + var related = compareTypes(source.thisType, target.thisType, false) + || compareTypes(target.thisType, source.thisType, reportErrors); + if (!related) { + if (reportErrors) { + errorReporter(ts.Diagnostics.The_this_types_of_each_signature_are_incompatible); + } + return 0; + } + result &= related; + } + var sourceMax = getNumNonRestParameters(source); + var targetMax = getNumNonRestParameters(target); + var checkCount = getNumParametersToCheckForSignatureRelatability(source, sourceMax, target, targetMax); + var sourceParams = source.parameters; + var targetParams = target.parameters; + for (var i = 0; i < checkCount; i++) { + var s = i < sourceMax ? getTypeOfParameter(sourceParams[i]) : getRestTypeOfSignature(source); + var t = i < targetMax ? getTypeOfParameter(targetParams[i]) : getRestTypeOfSignature(target); + var related = compareTypes(s, t, false) || compareTypes(t, s, reportErrors); + if (!related) { + if (reportErrors) { + errorReporter(ts.Diagnostics.Types_of_parameters_0_and_1_are_incompatible, sourceParams[i < sourceMax ? i : sourceMax].name, targetParams[i < targetMax ? i : targetMax].name); + } + return 0; + } + result &= related; + } + if (!ignoreReturnTypes) { + var targetReturnType = getReturnTypeOfSignature(target); + if (targetReturnType === voidType) { + return result; + } + var sourceReturnType = getReturnTypeOfSignature(source); + if (target.typePredicate) { + if (source.typePredicate) { + result &= compareTypePredicateRelatedTo(source.typePredicate, target.typePredicate, reportErrors, errorReporter, compareTypes); + } + else if (ts.isIdentifierTypePredicate(target.typePredicate)) { + if (reportErrors) { + errorReporter(ts.Diagnostics.Signature_0_must_have_a_type_predicate, signatureToString(source)); + } + return 0; + } + } + else { + result &= compareTypes(sourceReturnType, targetReturnType, reportErrors); + } + } + return result; + } + function compareTypePredicateRelatedTo(source, target, reportErrors, errorReporter, compareTypes) { + if (source.kind !== target.kind) { + if (reportErrors) { + errorReporter(ts.Diagnostics.A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard); + errorReporter(ts.Diagnostics.Type_predicate_0_is_not_assignable_to_1, typePredicateToString(source), typePredicateToString(target)); + } + return 0; + } + if (source.kind === 1) { + var sourceIdentifierPredicate = source; + var targetIdentifierPredicate = target; + if (sourceIdentifierPredicate.parameterIndex !== targetIdentifierPredicate.parameterIndex) { + if (reportErrors) { + errorReporter(ts.Diagnostics.Parameter_0_is_not_in_the_same_position_as_parameter_1, sourceIdentifierPredicate.parameterName, targetIdentifierPredicate.parameterName); + errorReporter(ts.Diagnostics.Type_predicate_0_is_not_assignable_to_1, typePredicateToString(source), typePredicateToString(target)); + } + return 0; + } + } + var related = compareTypes(source.type, target.type, reportErrors); + if (related === 0 && reportErrors) { + errorReporter(ts.Diagnostics.Type_predicate_0_is_not_assignable_to_1, typePredicateToString(source), typePredicateToString(target)); + } + return related; + } + function isImplementationCompatibleWithOverload(implementation, overload) { + var erasedSource = getErasedSignature(implementation); + var erasedTarget = getErasedSignature(overload); + var sourceReturnType = getReturnTypeOfSignature(erasedSource); + var targetReturnType = getReturnTypeOfSignature(erasedTarget); + if (targetReturnType === voidType + || checkTypeRelatedTo(targetReturnType, sourceReturnType, assignableRelation, undefined) + || checkTypeRelatedTo(sourceReturnType, targetReturnType, assignableRelation, undefined)) { + return isSignatureAssignableTo(erasedSource, erasedTarget, true); + } + return false; + } + function getNumNonRestParameters(signature) { + var numParams = signature.parameters.length; + return signature.hasRestParameter ? + numParams - 1 : + numParams; + } + function getNumParametersToCheckForSignatureRelatability(source, sourceNonRestParamCount, target, targetNonRestParamCount) { + if (source.hasRestParameter === target.hasRestParameter) { + if (source.hasRestParameter) { + return Math.max(sourceNonRestParamCount, targetNonRestParamCount) + 1; + } + else { + return Math.min(sourceNonRestParamCount, targetNonRestParamCount); + } + } + else { + return source.hasRestParameter ? + targetNonRestParamCount : + sourceNonRestParamCount; + } + } + function checkTypeRelatedTo(source, target, relation, errorNode, headMessage, containingMessageChain) { + var errorInfo; + var sourceStack; + var targetStack; + var maybeStack; + var expandingFlags; + var depth = 0; + var overflow = false; + ts.Debug.assert(relation !== identityRelation || !errorNode, "no error reporting in identity checking"); + var result = isRelatedTo(source, target, !!errorNode, headMessage); + if (overflow) { + error(errorNode, ts.Diagnostics.Excessive_stack_depth_comparing_types_0_and_1, typeToString(source), typeToString(target)); + } + else if (errorInfo) { + if (containingMessageChain) { + errorInfo = ts.concatenateDiagnosticMessageChains(containingMessageChain, errorInfo); + } + diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(errorNode, errorInfo)); + } + return result !== 0; + function reportError(message, arg0, arg1, arg2) { + ts.Debug.assert(!!errorNode); + errorInfo = ts.chainDiagnosticMessages(errorInfo, message, arg0, arg1, arg2); + } + function reportRelationError(message, source, target) { + var sourceType = typeToString(source); + var targetType = typeToString(target); + if (sourceType === targetType) { + sourceType = typeToString(source, undefined, 128); + targetType = typeToString(target, undefined, 128); + } + if (!message) { + message = relation === comparableRelation ? + ts.Diagnostics.Type_0_is_not_comparable_to_type_1 : + ts.Diagnostics.Type_0_is_not_assignable_to_type_1; + } + reportError(message, sourceType, targetType); + } + function isRelatedTo(source, target, reportErrors, headMessage) { + var result; + if (source === target) + return -1; + if (relation === identityRelation) { + return isIdenticalTo(source, target); + } + if (!(target.flags & 134217728)) { + if (target.flags & 1) + return -1; + if (source.flags & 32) { + if (!strictNullChecks || target.flags & (32 | 16) || source === emptyArrayElementType) + return -1; + } + if (source.flags & 64) { + if (!strictNullChecks || target.flags & 64) + return -1; + } + if (source.flags & 128 && target === numberType) + return -1; + if (source.flags & 128 && target.flags & 128) { + if (result = enumRelatedTo(source, target, reportErrors)) { + return result; + } + } + if (source.flags & 256 && target === stringType) + return -1; + if (relation === assignableRelation || relation === comparableRelation) { + if (source.flags & (1 | 134217728)) + return -1; + if (source === numberType && target.flags & 128) + return -1; + } + if (source.flags & 8 && target.flags & 8) { + return -1; + } + } + if (source.flags & 1048576) { + if (hasExcessProperties(source, target, reportErrors)) { + if (reportErrors) { + reportRelationError(headMessage, source, target); + } + return 0; + } + if (target.flags & 49152) { + source = getRegularTypeOfObjectLiteral(source); + } + } + var saveErrorInfo = errorInfo; + if (source.flags & 16384) { + if (relation === comparableRelation) { + result = someTypeRelatedToType(source, target, reportErrors); + } + else { + result = eachTypeRelatedToType(source, target, reportErrors); + } + if (result) { + return result; + } + } + else if (target.flags & 32768) { + result = typeRelatedToEachType(source, target, reportErrors); + if (result) { + return result; + } + } + else { + if (source.flags & 32768) { + if (result = someTypeRelatedToType(source, target, false)) { + return result; + } + } + if (target.flags & 16384) { + if (result = typeRelatedToSomeType(source, target, reportErrors && !(source.flags & 16777726))) { + return result; + } + } + } + if (source.flags & 512) { + var constraint = getConstraintOfTypeParameter(source); + if (!constraint || constraint.flags & 1) { + constraint = emptyObjectType; + } + constraint = getTypeWithThisArgument(constraint, source); + var reportConstraintErrors = reportErrors && constraint !== emptyObjectType; + if (result = isRelatedTo(constraint, target, reportConstraintErrors)) { + errorInfo = saveErrorInfo; + return result; + } + } + else { + if (source.flags & 4096 && target.flags & 4096 && source.target === target.target) { + if (result = typeArgumentsRelatedTo(source, target, reportErrors)) { + return result; + } + } + var apparentSource = getApparentType(source); + if (apparentSource.flags & (80896 | 32768) && target.flags & 80896) { + var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo && !(source.flags & 16777726); + if (result = objectTypeRelatedTo(apparentSource, source, target, reportStructuralErrors)) { + errorInfo = saveErrorInfo; + return result; + } + } + } + if (reportErrors) { + reportRelationError(headMessage, source, target); + } + return 0; + } + function isIdenticalTo(source, target) { + var result; + if (source.flags & 80896 && target.flags & 80896) { + if (source.flags & 4096 && target.flags & 4096 && source.target === target.target) { + if (result = typeArgumentsRelatedTo(source, target, false)) { + return result; + } + } + return objectTypeRelatedTo(source, source, target, false); + } + if (source.flags & 16384 && target.flags & 16384 || + source.flags & 32768 && target.flags & 32768) { + if (result = eachTypeRelatedToSomeType(source, target, false)) { + if (result &= eachTypeRelatedToSomeType(target, source, false)) { + return result; + } + } + } + return 0; + } + function isKnownProperty(type, name) { + if (type.flags & 80896) { + var resolved = resolveStructuredTypeMembers(type); + if ((relation === assignableRelation || relation === comparableRelation) && + (type === globalObjectType || isEmptyObjectType(resolved)) || + resolved.stringIndexInfo || resolved.numberIndexInfo || getPropertyOfType(type, name)) { + return true; + } + } + else if (type.flags & 49152) { + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var t = _a[_i]; + if (isKnownProperty(t, name)) { + return true; + } + } + } + return false; + } + function isEmptyObjectType(t) { + return t.properties.length === 0 && + t.callSignatures.length === 0 && + t.constructSignatures.length === 0 && + !t.stringIndexInfo && + !t.numberIndexInfo; + } + function hasExcessProperties(source, target, reportErrors) { + if (!(target.flags & 67108864) && maybeTypeOfKind(target, 80896)) { + for (var _i = 0, _a = getPropertiesOfObjectType(source); _i < _a.length; _i++) { + var prop = _a[_i]; + if (!isKnownProperty(target, prop.name)) { + if (reportErrors) { + ts.Debug.assert(!!errorNode); + errorNode = prop.valueDeclaration; + reportError(ts.Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1, symbolToString(prop), typeToString(target)); + } + return true; + } + } + } + return false; + } + function eachTypeRelatedToSomeType(source, target, reportErrors) { + var result = -1; + var sourceTypes = source.types; + for (var _i = 0, sourceTypes_1 = sourceTypes; _i < sourceTypes_1.length; _i++) { + var sourceType = sourceTypes_1[_i]; + var related = typeRelatedToSomeType(sourceType, target, false); + if (!related) { + return 0; + } + result &= related; + } + return result; + } + function typeRelatedToSomeType(source, target, reportErrors) { + var targetTypes = target.types; + var len = targetTypes.length; + while (len >= 2 && targetTypes[len - 1].flags & 96) { + var related = isRelatedTo(source, targetTypes[len - 1], false); + if (related) { + return related; + } + len--; + } + for (var i = 0; i < len; i++) { + var related = isRelatedTo(source, targetTypes[i], reportErrors && i === len - 1); + if (related) { + return related; + } + } + return 0; + } + function typeRelatedToEachType(source, target, reportErrors) { + var result = -1; + var targetTypes = target.types; + for (var _i = 0, targetTypes_1 = targetTypes; _i < targetTypes_1.length; _i++) { + var targetType = targetTypes_1[_i]; + var related = isRelatedTo(source, targetType, reportErrors); + if (!related) { + return 0; + } + result &= related; + } + return result; + } + function someTypeRelatedToType(source, target, reportErrors) { + var sourceTypes = source.types; + var len = sourceTypes.length; + while (len >= 2 && sourceTypes[len - 1].flags & 96) { + var related = isRelatedTo(sourceTypes[len - 1], target, false); + if (related) { + return related; + } + len--; + } + for (var i = 0; i < len; i++) { + var related = isRelatedTo(sourceTypes[i], target, reportErrors && i === len - 1); + if (related) { + return related; + } + } + return 0; + } + function eachTypeRelatedToType(source, target, reportErrors) { + var result = -1; + var sourceTypes = source.types; + for (var _i = 0, sourceTypes_2 = sourceTypes; _i < sourceTypes_2.length; _i++) { + var sourceType = sourceTypes_2[_i]; + var related = isRelatedTo(sourceType, target, reportErrors); + if (!related) { + return 0; + } + result &= related; + } + return result; + } + function typeArgumentsRelatedTo(source, target, reportErrors) { + var sources = source.typeArguments || emptyArray; + var targets = target.typeArguments || emptyArray; + if (sources.length !== targets.length && relation === identityRelation) { + return 0; + } + var length = sources.length <= targets.length ? sources.length : targets.length; + var result = -1; + for (var i = 0; i < length; i++) { + var related = isRelatedTo(sources[i], targets[i], reportErrors); + if (!related) { + return 0; + } + result &= related; + } + return result; + } + function objectTypeRelatedTo(source, originalSource, target, reportErrors) { + if (overflow) { + return 0; + } + var id = relation !== identityRelation || source.id < target.id ? source.id + "," + target.id : target.id + "," + source.id; + var related = relation[id]; + if (related !== undefined) { + if (reportErrors && related === 2) { + relation[id] = 3; + } + else { + return related === 1 ? -1 : 0; + } + } + if (depth > 0) { + for (var i = 0; i < depth; i++) { + if (maybeStack[i][id]) { + return 1; + } + } + if (depth === 100) { + overflow = true; + return 0; + } + } + else { + sourceStack = []; + targetStack = []; + maybeStack = []; + expandingFlags = 0; + } + sourceStack[depth] = source; + targetStack[depth] = target; + maybeStack[depth] = {}; + maybeStack[depth][id] = 1; + depth++; + var saveExpandingFlags = expandingFlags; + if (!(expandingFlags & 1) && isDeeplyNestedGeneric(source, sourceStack, depth)) + expandingFlags |= 1; + if (!(expandingFlags & 2) && isDeeplyNestedGeneric(target, targetStack, depth)) + expandingFlags |= 2; + var result; + if (expandingFlags === 3) { + result = 1; + } + else { + result = propertiesRelatedTo(source, target, reportErrors); + if (result) { + result &= signaturesRelatedTo(source, target, 0, reportErrors); + if (result) { + result &= signaturesRelatedTo(source, target, 1, reportErrors); + if (result) { + result &= indexTypesRelatedTo(source, originalSource, target, 0, reportErrors); + if (result) { + result &= indexTypesRelatedTo(source, originalSource, target, 1, reportErrors); + } + } + } + } + } + expandingFlags = saveExpandingFlags; + depth--; + if (result) { + var maybeCache = maybeStack[depth]; + var destinationCache = (result === -1 || depth === 0) ? relation : maybeStack[depth - 1]; + ts.copyMap(maybeCache, destinationCache); + } + else { + relation[id] = reportErrors ? 3 : 2; + } + return result; + } + function propertiesRelatedTo(source, target, reportErrors) { + if (relation === identityRelation) { + return propertiesIdenticalTo(source, target); + } + var result = -1; + var properties = getPropertiesOfObjectType(target); + var requireOptionalProperties = relation === subtypeRelation && !(source.flags & 524288); + for (var _i = 0, properties_1 = properties; _i < properties_1.length; _i++) { + var targetProp = properties_1[_i]; + var sourceProp = getPropertyOfType(source, targetProp.name); + if (sourceProp !== targetProp) { + if (!sourceProp) { + if (!(targetProp.flags & 536870912) || requireOptionalProperties) { + if (reportErrors) { + reportError(ts.Diagnostics.Property_0_is_missing_in_type_1, symbolToString(targetProp), typeToString(source)); + } + return 0; + } + } + else if (!(targetProp.flags & 134217728)) { + var sourcePropFlags = getDeclarationFlagsFromSymbol(sourceProp); + var targetPropFlags = getDeclarationFlagsFromSymbol(targetProp); + if (sourcePropFlags & 8 || targetPropFlags & 8) { + if (sourceProp.valueDeclaration !== targetProp.valueDeclaration) { + if (reportErrors) { + if (sourcePropFlags & 8 && targetPropFlags & 8) { + reportError(ts.Diagnostics.Types_have_separate_declarations_of_a_private_property_0, symbolToString(targetProp)); + } + else { + reportError(ts.Diagnostics.Property_0_is_private_in_type_1_but_not_in_type_2, symbolToString(targetProp), typeToString(sourcePropFlags & 8 ? source : target), typeToString(sourcePropFlags & 8 ? target : source)); + } + } + return 0; + } + } + else if (targetPropFlags & 16) { + var sourceDeclaredInClass = sourceProp.parent && sourceProp.parent.flags & 32; + var sourceClass = sourceDeclaredInClass ? getDeclaredTypeOfSymbol(getParentOfSymbol(sourceProp)) : undefined; + var targetClass = getDeclaredTypeOfSymbol(getParentOfSymbol(targetProp)); + if (!sourceClass || !hasBaseType(sourceClass, targetClass)) { + if (reportErrors) { + reportError(ts.Diagnostics.Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2, symbolToString(targetProp), typeToString(sourceClass || source), typeToString(targetClass)); + } + return 0; + } + } + else if (sourcePropFlags & 16) { + if (reportErrors) { + reportError(ts.Diagnostics.Property_0_is_protected_in_type_1_but_public_in_type_2, symbolToString(targetProp), typeToString(source), typeToString(target)); + } + return 0; + } + var related = isRelatedTo(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp), reportErrors); + if (!related) { + if (reportErrors) { + reportError(ts.Diagnostics.Types_of_property_0_are_incompatible, symbolToString(targetProp)); + } + return 0; + } + result &= related; + if (sourceProp.flags & 536870912 && !(targetProp.flags & 536870912)) { + if (reportErrors) { + reportError(ts.Diagnostics.Property_0_is_optional_in_type_1_but_required_in_type_2, symbolToString(targetProp), typeToString(source), typeToString(target)); + } + return 0; + } + } + } + } + return result; + } + function propertiesIdenticalTo(source, target) { + if (!(source.flags & 80896 && target.flags & 80896)) { + return 0; + } + var sourceProperties = getPropertiesOfObjectType(source); + var targetProperties = getPropertiesOfObjectType(target); + if (sourceProperties.length !== targetProperties.length) { + return 0; + } + var result = -1; + for (var _i = 0, sourceProperties_1 = sourceProperties; _i < sourceProperties_1.length; _i++) { + var sourceProp = sourceProperties_1[_i]; + var targetProp = getPropertyOfObjectType(target, sourceProp.name); + if (!targetProp) { + return 0; + } + var related = compareProperties(sourceProp, targetProp, isRelatedTo); + if (!related) { + return 0; + } + result &= related; + } + return result; + } + function signaturesRelatedTo(source, target, kind, reportErrors) { + if (relation === identityRelation) { + return signaturesIdenticalTo(source, target, kind); + } + if (target === anyFunctionType || source === anyFunctionType) { + return -1; + } + var sourceSignatures = getSignaturesOfType(source, kind); + var targetSignatures = getSignaturesOfType(target, kind); + if (kind === 1 && sourceSignatures.length && targetSignatures.length) { + if (isAbstractConstructorType(source) && !isAbstractConstructorType(target)) { + if (reportErrors) { + reportError(ts.Diagnostics.Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type); + } + return 0; + } + if (!constructorVisibilitiesAreCompatible(sourceSignatures[0], targetSignatures[0], reportErrors)) { + return 0; + } + } + var result = -1; + var saveErrorInfo = errorInfo; + outer: for (var _i = 0, targetSignatures_1 = targetSignatures; _i < targetSignatures_1.length; _i++) { + var t = targetSignatures_1[_i]; + var shouldElaborateErrors = reportErrors; + for (var _a = 0, sourceSignatures_1 = sourceSignatures; _a < sourceSignatures_1.length; _a++) { + var s = sourceSignatures_1[_a]; + var related = signatureRelatedTo(s, t, shouldElaborateErrors); + if (related) { + result &= related; + errorInfo = saveErrorInfo; + continue outer; + } + shouldElaborateErrors = false; + } + if (shouldElaborateErrors) { + reportError(ts.Diagnostics.Type_0_provides_no_match_for_the_signature_1, typeToString(source), signatureToString(t, undefined, undefined, kind)); + } + return 0; + } + return result; + } + function signatureRelatedTo(source, target, reportErrors) { + return compareSignaturesRelated(source, target, false, reportErrors, reportError, isRelatedTo); + } + function signaturesIdenticalTo(source, target, kind) { + var sourceSignatures = getSignaturesOfType(source, kind); + var targetSignatures = getSignaturesOfType(target, kind); + if (sourceSignatures.length !== targetSignatures.length) { + return 0; + } + var result = -1; + for (var i = 0, len = sourceSignatures.length; i < len; i++) { + var related = compareSignaturesIdentical(sourceSignatures[i], targetSignatures[i], false, false, false, isRelatedTo); + if (!related) { + return 0; + } + result &= related; + } + return result; + } + function eachPropertyRelatedTo(source, target, kind, reportErrors) { + var result = -1; + for (var _i = 0, _a = getPropertiesOfObjectType(source); _i < _a.length; _i++) { + var prop = _a[_i]; + if (kind === 0 || isNumericLiteralName(prop.name)) { + var related = isRelatedTo(getTypeOfSymbol(prop), target, reportErrors); + if (!related) { + if (reportErrors) { + reportError(ts.Diagnostics.Property_0_is_incompatible_with_index_signature, symbolToString(prop)); + } + return 0; + } + result &= related; + } + } + return result; + } + function indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors) { + var related = isRelatedTo(sourceInfo.type, targetInfo.type, reportErrors); + if (!related && reportErrors) { + reportError(ts.Diagnostics.Index_signatures_are_incompatible); + } + return related; + } + function indexTypesRelatedTo(source, originalSource, target, kind, reportErrors) { + if (relation === identityRelation) { + return indexTypesIdenticalTo(source, target, kind); + } + var targetInfo = getIndexInfoOfType(target, kind); + if (!targetInfo || ((targetInfo.type.flags & 1) && !(originalSource.flags & 16777726))) { + return -1; + } + var sourceInfo = getIndexInfoOfType(source, kind) || + kind === 1 && getIndexInfoOfType(source, 0); + if (sourceInfo) { + return indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors); + } + if (isObjectLiteralType(source)) { + var related = -1; + if (kind === 0) { + var sourceNumberInfo = getIndexInfoOfType(source, 1); + if (sourceNumberInfo) { + related = indexInfoRelatedTo(sourceNumberInfo, targetInfo, reportErrors); + } + } + if (related) { + related &= eachPropertyRelatedTo(source, targetInfo.type, kind, reportErrors); + } + return related; + } + if (reportErrors) { + reportError(ts.Diagnostics.Index_signature_is_missing_in_type_0, typeToString(source)); + } + return 0; + } + function indexTypesIdenticalTo(source, target, indexKind) { + var targetInfo = getIndexInfoOfType(target, indexKind); + var sourceInfo = getIndexInfoOfType(source, indexKind); + if (!sourceInfo && !targetInfo) { + return -1; + } + if (sourceInfo && targetInfo && sourceInfo.isReadonly === targetInfo.isReadonly) { + return isRelatedTo(sourceInfo.type, targetInfo.type); + } + return 0; + } + function enumRelatedTo(source, target, reportErrors) { + if (source.symbol.name !== target.symbol.name || + source.symbol.flags & 128 || + target.symbol.flags & 128) { + return 0; + } + var targetEnumType = getTypeOfSymbol(target.symbol); + for (var _i = 0, _a = getPropertiesOfType(getTypeOfSymbol(source.symbol)); _i < _a.length; _i++) { + var property = _a[_i]; + if (property.flags & 8) { + var targetProperty = getPropertyOfType(targetEnumType, property.name); + if (!targetProperty || !(targetProperty.flags & 8)) { + if (reportErrors) { + reportError(ts.Diagnostics.Property_0_is_missing_in_type_1, property.name, typeToString(target, undefined, 128)); + } + return 0; + } + } + } + return -1; + } + function constructorVisibilitiesAreCompatible(sourceSignature, targetSignature, reportErrors) { + if (!sourceSignature.declaration || !targetSignature.declaration) { + return true; + } + var sourceAccessibility = sourceSignature.declaration.flags & (8 | 16); + var targetAccessibility = targetSignature.declaration.flags & (8 | 16); + if (targetAccessibility === 8) { + return true; + } + if (targetAccessibility === 16 && sourceAccessibility !== 8) { + return true; + } + if (targetAccessibility !== 16 && !sourceAccessibility) { + return true; + } + if (reportErrors) { + reportError(ts.Diagnostics.Cannot_assign_a_0_constructor_type_to_a_1_constructor_type, visibilityToString(sourceAccessibility), visibilityToString(targetAccessibility)); + } + return false; + } + } + function isAbstractConstructorType(type) { + if (type.flags & 65536) { + var symbol = type.symbol; + if (symbol && symbol.flags & 32) { + var declaration = getClassLikeDeclarationOfSymbol(symbol); + if (declaration && declaration.flags & 128) { + return true; + } + } + } + return false; + } + function isDeeplyNestedGeneric(type, stack, depth) { + if (type.flags & (4096 | 131072) && depth >= 5) { + var symbol = type.symbol; + var count = 0; + for (var i = 0; i < depth; i++) { + var t = stack[i]; + if (t.flags & (4096 | 131072) && t.symbol === symbol) { + count++; + if (count >= 5) + return true; + } + } + } + return false; + } + function isPropertyIdenticalTo(sourceProp, targetProp) { + return compareProperties(sourceProp, targetProp, compareTypesIdentical) !== 0; + } + function compareProperties(sourceProp, targetProp, compareTypes) { + if (sourceProp === targetProp) { + return -1; + } + var sourcePropAccessibility = getDeclarationFlagsFromSymbol(sourceProp) & (8 | 16); + var targetPropAccessibility = getDeclarationFlagsFromSymbol(targetProp) & (8 | 16); + if (sourcePropAccessibility !== targetPropAccessibility) { + return 0; + } + if (sourcePropAccessibility) { + if (getTargetSymbol(sourceProp) !== getTargetSymbol(targetProp)) { + return 0; + } + } + else { + if ((sourceProp.flags & 536870912) !== (targetProp.flags & 536870912)) { + return 0; + } + } + if (isReadonlySymbol(sourceProp) !== isReadonlySymbol(targetProp)) { + return 0; + } + return compareTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp)); + } + function isMatchingSignature(source, target, partialMatch) { + if (source.parameters.length === target.parameters.length && + source.minArgumentCount === target.minArgumentCount && + source.hasRestParameter === target.hasRestParameter) { + return true; + } + if (partialMatch && source.minArgumentCount <= target.minArgumentCount && (source.hasRestParameter && !target.hasRestParameter || + source.hasRestParameter === target.hasRestParameter && source.parameters.length >= target.parameters.length)) { + return true; + } + return false; + } + function compareSignaturesIdentical(source, target, partialMatch, ignoreThisTypes, ignoreReturnTypes, compareTypes) { + if (source === target) { + return -1; + } + if (!(isMatchingSignature(source, target, partialMatch))) { + return 0; + } + if ((source.typeParameters ? source.typeParameters.length : 0) !== (target.typeParameters ? target.typeParameters.length : 0)) { + return 0; + } + source = getErasedSignature(source); + target = getErasedSignature(target); + var result = -1; + if (!ignoreThisTypes && source.thisType && target.thisType) { + var related = compareTypes(source.thisType, target.thisType); + if (!related) { + return 0; + } + result &= related; + } + var targetLen = target.parameters.length; + for (var i = 0; i < targetLen; i++) { + var s = isRestParameterIndex(source, i) ? getRestTypeOfSignature(source) : getTypeOfParameter(source.parameters[i]); + var t = isRestParameterIndex(target, i) ? getRestTypeOfSignature(target) : getTypeOfParameter(target.parameters[i]); + var related = compareTypes(s, t); + if (!related) { + return 0; + } + result &= related; + } + if (!ignoreReturnTypes) { + result &= compareTypes(getReturnTypeOfSignature(source), getReturnTypeOfSignature(target)); + } + return result; + } + function isRestParameterIndex(signature, parameterIndex) { + return signature.hasRestParameter && parameterIndex >= signature.parameters.length - 1; + } + function isSupertypeOfEach(candidate, types) { + for (var _i = 0, types_5 = types; _i < types_5.length; _i++) { + var t = types_5[_i]; + if (candidate !== t && !isTypeSubtypeOf(t, candidate)) + return false; + } + return true; + } + function getCombinedFlagsOfTypes(types) { + var flags = 0; + for (var _i = 0, types_6 = types; _i < types_6.length; _i++) { + var t = types_6[_i]; + flags |= t.flags; + } + return flags; + } + function getCommonSupertype(types) { + if (!strictNullChecks) { + return ts.forEach(types, function (t) { return isSupertypeOfEach(t, types) ? t : undefined; }); + } + var primaryTypes = ts.filter(types, function (t) { return !(t.flags & 96); }); + if (!primaryTypes.length) { + return getUnionType(types); + } + var supertype = ts.forEach(primaryTypes, function (t) { return isSupertypeOfEach(t, primaryTypes) ? t : undefined; }); + return supertype && addNullableKind(supertype, getCombinedFlagsOfTypes(types) & 96); + } + function reportNoCommonSupertypeError(types, errorLocation, errorMessageChainHead) { + var bestSupertype; + var bestSupertypeDownfallType; + var bestSupertypeScore = 0; + for (var i = 0; i < types.length; i++) { + var score = 0; + var downfallType = undefined; + for (var j = 0; j < types.length; j++) { + if (isTypeSubtypeOf(types[j], types[i])) { + score++; + } + else if (!downfallType) { + downfallType = types[j]; + } + } + ts.Debug.assert(!!downfallType, "If there is no common supertype, each type should have a downfallType"); + if (score > bestSupertypeScore) { + bestSupertype = types[i]; + bestSupertypeDownfallType = downfallType; + bestSupertypeScore = score; + } + if (bestSupertypeScore === types.length - 1) { + break; + } + } + checkTypeSubtypeOf(bestSupertypeDownfallType, bestSupertype, errorLocation, ts.Diagnostics.Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0, errorMessageChainHead); + } + function isArrayType(type) { + return type.flags & 4096 && type.target === globalArrayType; + } + function isArrayLikeType(type) { + return type.flags & 4096 && (type.target === globalArrayType || type.target === globalReadonlyArrayType) || + !(type.flags & 96) && isTypeAssignableTo(type, anyReadonlyArrayType); + } + function isTupleLikeType(type) { + return !!getPropertyOfType(type, "0"); + } + function isStringLiteralType(type) { + return type.flags & 256; + } + function isTupleType(type) { + return !!(type.flags & 8192); + } + function getNullableKind(type) { + var flags = type.flags; + if (flags & 16384) { + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var t = _a[_i]; + flags |= t.flags; + } + } + return flags & 96; + } + function addNullableKind(type, kind) { + if ((getNullableKind(type) & kind) !== kind) { + var types = [type]; + if (kind & 32) { + types.push(undefinedType); + } + if (kind & 64) { + types.push(nullType); + } + type = getUnionType(types); + } + return type; + } + function getNonNullableType(type) { + return strictNullChecks ? getTypeWithFacts(type, 524288) : type; + } + function isObjectLiteralType(type) { + return type.symbol && (type.symbol.flags & (4096 | 2048)) !== 0 && + getSignaturesOfType(type, 0).length === 0 && + getSignaturesOfType(type, 1).length === 0; + } + function getRegularTypeOfObjectLiteral(type) { + if (type.flags & 1048576) { + var regularType = type.regularType; + if (!regularType) { + regularType = createType(type.flags & ~1048576); + regularType.symbol = type.symbol; + regularType.members = type.members; + regularType.properties = type.properties; + regularType.callSignatures = type.callSignatures; + regularType.constructSignatures = type.constructSignatures; + regularType.stringIndexInfo = type.stringIndexInfo; + regularType.numberIndexInfo = type.numberIndexInfo; + type.regularType = regularType; + } + return regularType; + } + return type; + } + function getWidenedTypeOfObjectLiteral(type) { + var properties = getPropertiesOfObjectType(type); + var members = {}; + ts.forEach(properties, function (p) { + var propType = getTypeOfSymbol(p); + var widenedType = getWidenedType(propType); + if (propType !== widenedType) { + var symbol = createSymbol(p.flags | 67108864, p.name); + symbol.declarations = p.declarations; + symbol.parent = p.parent; + symbol.type = widenedType; + symbol.target = p; + if (p.valueDeclaration) + symbol.valueDeclaration = p.valueDeclaration; + p = symbol; + } + members[p.name] = p; + }); + var stringIndexInfo = getIndexInfoOfType(type, 0); + var numberIndexInfo = getIndexInfoOfType(type, 1); + return createAnonymousType(type.symbol, members, emptyArray, emptyArray, stringIndexInfo && createIndexInfo(getWidenedType(stringIndexInfo.type), stringIndexInfo.isReadonly), numberIndexInfo && createIndexInfo(getWidenedType(numberIndexInfo.type), numberIndexInfo.isReadonly)); + } + function getWidenedConstituentType(type) { + return type.flags & 96 ? type : getWidenedType(type); + } + function getWidenedType(type) { + if (type.flags & 6291456) { + if (type.flags & 96) { + return anyType; + } + if (type.flags & 524288) { + return getWidenedTypeOfObjectLiteral(type); + } + if (type.flags & 16384) { + return getUnionType(ts.map(type.types, getWidenedConstituentType), true); + } + if (isArrayType(type)) { + return createArrayType(getWidenedType(type.typeArguments[0])); + } + if (isTupleType(type)) { + return createTupleType(ts.map(type.elementTypes, getWidenedType)); + } + } + return type; + } + function reportWideningErrorsInType(type) { + var errorReported = false; + if (type.flags & 16384) { + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var t = _a[_i]; + if (reportWideningErrorsInType(t)) { + errorReported = true; + } + } + } + if (isArrayType(type)) { + return reportWideningErrorsInType(type.typeArguments[0]); + } + if (isTupleType(type)) { + for (var _b = 0, _c = type.elementTypes; _b < _c.length; _b++) { + var t = _c[_b]; + if (reportWideningErrorsInType(t)) { + errorReported = true; + } + } + } + if (type.flags & 524288) { + for (var _d = 0, _e = getPropertiesOfObjectType(type); _d < _e.length; _d++) { + var p = _e[_d]; + var t = getTypeOfSymbol(p); + if (t.flags & 2097152) { + if (!reportWideningErrorsInType(t)) { + error(p.valueDeclaration, ts.Diagnostics.Object_literal_s_property_0_implicitly_has_an_1_type, p.name, typeToString(getWidenedType(t))); + } + errorReported = true; + } + } + } + return errorReported; + } + function reportImplicitAnyError(declaration, type) { + var typeAsString = typeToString(getWidenedType(type)); + var diagnostic; + switch (declaration.kind) { + case 145: + case 144: + diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type; + break; + case 142: + diagnostic = declaration.dotDotDotToken ? + ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : + ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; + break; + case 169: + diagnostic = ts.Diagnostics.Binding_element_0_implicitly_has_an_1_type; + break; + case 220: + case 147: + case 146: + case 149: + case 150: + case 179: + case 180: + if (!declaration.name) { + error(declaration, ts.Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString); + return; + } + diagnostic = ts.Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type; + break; + default: + diagnostic = ts.Diagnostics.Variable_0_implicitly_has_an_1_type; + } + error(declaration, diagnostic, ts.declarationNameToString(declaration.name), typeAsString); + } + function reportErrorsFromWidening(declaration, type) { + if (produceDiagnostics && compilerOptions.noImplicitAny && type.flags & 2097152) { + if (!reportWideningErrorsInType(type)) { + reportImplicitAnyError(declaration, type); + } + } + } + function forEachMatchingParameterType(source, target, callback) { + var sourceMax = source.parameters.length; + var targetMax = target.parameters.length; + var count; + if (source.hasRestParameter && target.hasRestParameter) { + count = Math.max(sourceMax, targetMax); + } + else if (source.hasRestParameter) { + count = targetMax; + } + else if (target.hasRestParameter) { + count = sourceMax; + } + else { + count = Math.min(sourceMax, targetMax); + } + for (var i = 0; i < count; i++) { + callback(getTypeAtPosition(source, i), getTypeAtPosition(target, i)); + } + } + function createInferenceContext(typeParameters, inferUnionTypes) { + var inferences = ts.map(typeParameters, createTypeInferencesObject); + return { + typeParameters: typeParameters, + inferUnionTypes: inferUnionTypes, + inferences: inferences, + inferredTypes: new Array(typeParameters.length) + }; + } + function createTypeInferencesObject() { + return { + primary: undefined, + secondary: undefined, + isFixed: false + }; + } + function inferTypes(context, source, target) { + var sourceStack; + var targetStack; + var depth = 0; + var inferiority = 0; + var visited = {}; + inferFromTypes(source, target); + function isInProcess(source, target) { + for (var i = 0; i < depth; i++) { + if (source === sourceStack[i] && target === targetStack[i]) { + return true; + } + } + return false; + } + function inferFromTypes(source, target) { + if (source.flags & 16384 && target.flags & 16384 || + source.flags & 32768 && target.flags & 32768) { + var matchingTypes = void 0; + for (var _i = 0, _a = target.types; _i < _a.length; _i++) { + var t = _a[_i]; + if (typeIdenticalToSomeType(t, source.types)) { + (matchingTypes || (matchingTypes = [])).push(t); + inferFromTypes(t, t); + } + } + if (matchingTypes) { + source = removeTypesFromUnionOrIntersection(source, matchingTypes); + target = removeTypesFromUnionOrIntersection(target, matchingTypes); + } + } + if (target.flags & 512) { + if (source.flags & 8388608) { + return; + } + var typeParameters = context.typeParameters; + for (var i = 0; i < typeParameters.length; i++) { + if (target === typeParameters[i]) { + var inferences = context.inferences[i]; + if (!inferences.isFixed) { + var candidates = inferiority ? + inferences.secondary || (inferences.secondary = []) : + inferences.primary || (inferences.primary = []); + if (!ts.contains(candidates, source)) { + candidates.push(source); + } + } + return; + } + } + } + else if (source.flags & 4096 && target.flags & 4096 && source.target === target.target) { + var sourceTypes = source.typeArguments || emptyArray; + var targetTypes = target.typeArguments || emptyArray; + var count = sourceTypes.length < targetTypes.length ? sourceTypes.length : targetTypes.length; + for (var i = 0; i < count; i++) { + inferFromTypes(sourceTypes[i], targetTypes[i]); + } + } + else if (source.flags & 8192 && target.flags & 8192 && source.elementTypes.length === target.elementTypes.length) { + var sourceTypes = source.elementTypes; + var targetTypes = target.elementTypes; + for (var i = 0; i < sourceTypes.length; i++) { + inferFromTypes(sourceTypes[i], targetTypes[i]); + } + } + else if (target.flags & 49152) { + var targetTypes = target.types; + var typeParameterCount = 0; + var typeParameter = void 0; + for (var _b = 0, targetTypes_2 = targetTypes; _b < targetTypes_2.length; _b++) { + var t = targetTypes_2[_b]; + if (t.flags & 512 && ts.contains(context.typeParameters, t)) { + typeParameter = t; + typeParameterCount++; + } + else { + inferFromTypes(source, t); + } + } + if (target.flags & 16384 && typeParameterCount === 1) { + inferiority++; + inferFromTypes(source, typeParameter); + inferiority--; + } + } + else if (source.flags & 49152) { + var sourceTypes = source.types; + for (var _c = 0, sourceTypes_3 = sourceTypes; _c < sourceTypes_3.length; _c++) { + var sourceType = sourceTypes_3[_c]; + inferFromTypes(sourceType, target); + } + } + else { + source = getApparentType(source); + if (source.flags & 80896 && (target.flags & 4096 && target.typeArguments || + target.flags & 8192 || + target.flags & 65536 && target.symbol && target.symbol.flags & (8192 | 2048 | 32))) { + if (isInProcess(source, target)) { + return; + } + if (isDeeplyNestedGeneric(source, sourceStack, depth) && isDeeplyNestedGeneric(target, targetStack, depth)) { + return; + } + var key = source.id + "," + target.id; + if (ts.hasProperty(visited, key)) { + return; + } + visited[key] = true; + if (depth === 0) { + sourceStack = []; + targetStack = []; + } + sourceStack[depth] = source; + targetStack[depth] = target; + depth++; + inferFromProperties(source, target); + inferFromSignatures(source, target, 0); + inferFromSignatures(source, target, 1); + inferFromIndexTypes(source, target); + depth--; + } + } + } + function inferFromProperties(source, target) { + var properties = getPropertiesOfObjectType(target); + for (var _i = 0, properties_2 = properties; _i < properties_2.length; _i++) { + var targetProp = properties_2[_i]; + var sourceProp = getPropertyOfObjectType(source, targetProp.name); + if (sourceProp) { + inferFromTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp)); + } + } + } + function inferFromSignatures(source, target, kind) { + var sourceSignatures = getSignaturesOfType(source, kind); + var targetSignatures = getSignaturesOfType(target, kind); + var sourceLen = sourceSignatures.length; + var targetLen = targetSignatures.length; + var len = sourceLen < targetLen ? sourceLen : targetLen; + for (var i = 0; i < len; i++) { + inferFromSignature(getErasedSignature(sourceSignatures[sourceLen - len + i]), getErasedSignature(targetSignatures[targetLen - len + i])); + } + } + function inferFromSignature(source, target) { + forEachMatchingParameterType(source, target, inferFromTypes); + if (source.typePredicate && target.typePredicate && source.typePredicate.kind === target.typePredicate.kind) { + inferFromTypes(source.typePredicate.type, target.typePredicate.type); + } + else { + inferFromTypes(getReturnTypeOfSignature(source), getReturnTypeOfSignature(target)); + } + } + function inferFromIndexTypes(source, target) { + var targetStringIndexType = getIndexTypeOfType(target, 0); + if (targetStringIndexType) { + var sourceIndexType = getIndexTypeOfType(source, 0) || + getImplicitIndexTypeOfType(source, 0); + if (sourceIndexType) { + inferFromTypes(sourceIndexType, targetStringIndexType); + } + } + var targetNumberIndexType = getIndexTypeOfType(target, 1); + if (targetNumberIndexType) { + var sourceIndexType = getIndexTypeOfType(source, 1) || + getIndexTypeOfType(source, 0) || + getImplicitIndexTypeOfType(source, 1); + if (sourceIndexType) { + inferFromTypes(sourceIndexType, targetNumberIndexType); + } + } + } + } + function typeIdenticalToSomeType(type, types) { + for (var _i = 0, types_7 = types; _i < types_7.length; _i++) { + var t = types_7[_i]; + if (isTypeIdenticalTo(t, type)) { + return true; + } + } + return false; + } + function removeTypesFromUnionOrIntersection(type, typesToRemove) { + var reducedTypes = []; + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var t = _a[_i]; + if (!typeIdenticalToSomeType(t, typesToRemove)) { + reducedTypes.push(t); + } + } + return type.flags & 16384 ? getUnionType(reducedTypes, true) : getIntersectionType(reducedTypes); + } + function getInferenceCandidates(context, index) { + var inferences = context.inferences[index]; + return inferences.primary || inferences.secondary || emptyArray; + } + function getInferredType(context, index) { + var inferredType = context.inferredTypes[index]; + var inferenceSucceeded; + if (!inferredType) { + var inferences = getInferenceCandidates(context, index); + if (inferences.length) { + var unionOrSuperType = context.inferUnionTypes ? getUnionType(inferences) : getCommonSupertype(inferences); + inferredType = unionOrSuperType ? getWidenedType(unionOrSuperType) : unknownType; + inferenceSucceeded = !!unionOrSuperType; + } + else { + inferredType = emptyObjectType; + inferenceSucceeded = true; + } + context.inferredTypes[index] = inferredType; + if (inferenceSucceeded) { + var constraint = getConstraintOfTypeParameter(context.typeParameters[index]); + if (constraint) { + var instantiatedConstraint = instantiateType(constraint, getInferenceMapper(context)); + if (!isTypeAssignableTo(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) { + context.inferredTypes[index] = inferredType = instantiatedConstraint; + } + } + } + else if (context.failedTypeParameterIndex === undefined || context.failedTypeParameterIndex > index) { + context.failedTypeParameterIndex = index; + } + } + return inferredType; + } + function getInferredTypes(context) { + for (var i = 0; i < context.inferredTypes.length; i++) { + getInferredType(context, i); + } + return context.inferredTypes; + } + function getResolvedSymbol(node) { + var links = getNodeLinks(node); + if (!links.resolvedSymbol) { + links.resolvedSymbol = !ts.nodeIsMissing(node) && resolveName(node, node.text, 107455 | 1048576, ts.Diagnostics.Cannot_find_name_0, node) || unknownSymbol; + } + return links.resolvedSymbol; + } + function isInTypeQuery(node) { + while (node) { + switch (node.kind) { + case 158: + return true; + case 69: + case 139: + node = node.parent; + continue; + default: + return false; + } + } + ts.Debug.fail("should not get here"); + } + function getFlowCacheKey(node) { + if (node.kind === 69) { + var symbol = getResolvedSymbol(node); + return symbol !== unknownSymbol ? "" + getSymbolId(symbol) : undefined; + } + if (node.kind === 97) { + return "0"; + } + if (node.kind === 172) { + var key = getFlowCacheKey(node.expression); + return key && key + "." + node.name.text; + } + return undefined; + } + function isNullOrUndefinedLiteral(node) { + return node.kind === 93 || + node.kind === 69 && getResolvedSymbol(node) === undefinedSymbol; + } + function getLeftmostIdentifierOrThis(node) { + switch (node.kind) { + case 69: + case 97: + return node; + case 172: + return getLeftmostIdentifierOrThis(node.expression); + } + return undefined; + } + function isMatchingReference(source, target) { + if (source.kind === target.kind) { + switch (source.kind) { + case 69: + return getResolvedSymbol(source) === getResolvedSymbol(target); + case 97: + return true; + case 172: + return source.name.text === target.name.text && + isMatchingReference(source.expression, target.expression); + } + } + return false; + } + function containsMatchingReference(source, target) { + while (source.kind === 172) { + source = source.expression; + if (isMatchingReference(source, target)) { + return true; + } + } + return false; + } + function isOrContainsMatchingReference(source, target) { + return isMatchingReference(source, target) || containsMatchingReference(source, target); + } + function hasMatchingArgument(callExpression, reference) { + if (callExpression.arguments) { + for (var _i = 0, _a = callExpression.arguments; _i < _a.length; _i++) { + var argument = _a[_i]; + if (isOrContainsMatchingReference(reference, argument)) { + return true; + } + } + } + if (callExpression.expression.kind === 172 && + isOrContainsMatchingReference(reference, callExpression.expression.expression)) { + return true; + } + return false; + } + function getFlowNodeId(flow) { + if (!flow.id) { + flow.id = nextFlowId; + nextFlowId++; + } + return flow.id; + } + function typeMaybeAssignableTo(source, target) { + if (!(source.flags & 16384)) { + return isTypeAssignableTo(source, target); + } + for (var _i = 0, _a = source.types; _i < _a.length; _i++) { + var t = _a[_i]; + if (isTypeAssignableTo(t, target)) { + return true; + } + } + return false; + } + function getAssignmentReducedType(declaredType, assignedType) { + if (declaredType !== assignedType && declaredType.flags & 16384) { + var reducedTypes = ts.filter(declaredType.types, function (t) { return typeMaybeAssignableTo(assignedType, t); }); + if (reducedTypes.length) { + return reducedTypes.length === 1 ? reducedTypes[0] : getUnionType(reducedTypes); + } + } + return declaredType; + } + function getTypeFacts(type) { + var flags = type.flags; + if (flags & 258) { + return strictNullChecks ? 4079361 : 4194049; + } + if (flags & 132) { + return strictNullChecks ? 4079234 : 4193922; + } + if (flags & 8) { + return strictNullChecks ? 4078980 : 4193668; + } + if (flags & 80896) { + var resolved = resolveStructuredTypeMembers(type); + return resolved.callSignatures.length || resolved.constructSignatures.length || isTypeSubtypeOf(type, globalFunctionType) ? + strictNullChecks ? 1970144 : 4181984 : + strictNullChecks ? 1972176 : 4184016; + } + if (flags & (16 | 32)) { + return 2457472; + } + if (flags & 64) { + return 2340752; + } + if (flags & 16777216) { + return strictNullChecks ? 1981320 : 4193160; + } + if (flags & 512) { + var constraint = getConstraintOfTypeParameter(type); + return constraint ? getTypeFacts(constraint) : 4194303; + } + if (flags & 32768) { + return ts.reduceLeft(type.types, function (flags, type) { return flags |= getTypeFacts(type); }, 0); + } + return 4194303; + } + function getTypeWithFacts(type, include) { + if (!(type.flags & 16384)) { + return getTypeFacts(type) & include ? type : neverType; + } + var firstType; + var types; + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var t = _a[_i]; + if (getTypeFacts(t) & include) { + if (!firstType) { + firstType = t; + } + else { + if (!types) { + types = [firstType]; + } + types.push(t); + } + } + } + return firstType ? types ? getUnionType(types, true) : firstType : neverType; + } + function getTypeWithDefault(type, defaultExpression) { + if (defaultExpression) { + var defaultType = checkExpression(defaultExpression); + return getUnionType([getTypeWithFacts(type, 131072), defaultType]); + } + return type; + } + function getTypeOfDestructuredProperty(type, name) { + var text = getTextOfPropertyName(name); + return getTypeOfPropertyOfType(type, text) || + isNumericLiteralName(text) && getIndexTypeOfType(type, 1) || + getIndexTypeOfType(type, 0) || + unknownType; + } + function getTypeOfDestructuredArrayElement(type, index) { + return isTupleLikeType(type) && getTypeOfPropertyOfType(type, "" + index) || + checkIteratedTypeOrElementType(type, undefined, false) || + unknownType; + } + function getTypeOfDestructuredSpreadElement(type) { + return createArrayType(checkIteratedTypeOrElementType(type, undefined, false) || unknownType); + } + function getAssignedTypeOfBinaryExpression(node) { + return node.parent.kind === 170 || node.parent.kind === 253 ? + getTypeWithDefault(getAssignedType(node), node.right) : + checkExpression(node.right); + } + function getAssignedTypeOfArrayLiteralElement(node, element) { + return getTypeOfDestructuredArrayElement(getAssignedType(node), ts.indexOf(node.elements, element)); + } + function getAssignedTypeOfSpreadElement(node) { + return getTypeOfDestructuredSpreadElement(getAssignedType(node.parent)); + } + function getAssignedTypeOfPropertyAssignment(node) { + return getTypeOfDestructuredProperty(getAssignedType(node.parent), node.name); + } + function getAssignedTypeOfShorthandPropertyAssignment(node) { + return getTypeWithDefault(getAssignedTypeOfPropertyAssignment(node), node.objectAssignmentInitializer); + } + function getAssignedType(node) { + var parent = node.parent; + switch (parent.kind) { + case 207: + return stringType; + case 208: + return checkRightHandSideOfForOf(parent.expression) || unknownType; + case 187: + return getAssignedTypeOfBinaryExpression(parent); + case 181: + return undefinedType; + case 170: + return getAssignedTypeOfArrayLiteralElement(parent, node); + case 191: + return getAssignedTypeOfSpreadElement(parent); + case 253: + return getAssignedTypeOfPropertyAssignment(parent); + case 254: + return getAssignedTypeOfShorthandPropertyAssignment(parent); + } + return unknownType; + } + function getInitialTypeOfBindingElement(node) { + var pattern = node.parent; + var parentType = getInitialType(pattern.parent); + var type = pattern.kind === 167 ? + getTypeOfDestructuredProperty(parentType, node.propertyName || node.name) : + !node.dotDotDotToken ? + getTypeOfDestructuredArrayElement(parentType, ts.indexOf(pattern.elements, node)) : + getTypeOfDestructuredSpreadElement(parentType); + return getTypeWithDefault(type, node.initializer); + } + function getTypeOfInitializer(node) { + var links = getNodeLinks(node); + return links.resolvedType || checkExpression(node); + } + function getInitialTypeOfVariableDeclaration(node) { + if (node.initializer) { + return getTypeOfInitializer(node.initializer); + } + if (node.parent.parent.kind === 207) { + return stringType; + } + if (node.parent.parent.kind === 208) { + return checkRightHandSideOfForOf(node.parent.parent.expression) || unknownType; + } + return unknownType; + } + function getInitialType(node) { + return node.kind === 218 ? + getInitialTypeOfVariableDeclaration(node) : + getInitialTypeOfBindingElement(node); + } + function getFlowTypeOfReference(reference, declaredType, assumeInitialized) { + var key; + if (!reference.flowNode || assumeInitialized && !(declaredType.flags & 97793)) { + return declaredType; + } + var initialType = assumeInitialized ? declaredType : addNullableKind(declaredType, 32); + var visitedFlowStart = visitedFlowCount; + var result = getTypeAtFlowNode(reference.flowNode); + visitedFlowCount = visitedFlowStart; + if (reference.parent.kind === 196 && getTypeWithFacts(result, 524288) === neverType) { + return declaredType; + } + return result; + function getTypeAtFlowNode(flow) { + while (true) { + if (flow.flags & 256) { + for (var i = visitedFlowStart; i < visitedFlowCount; i++) { + if (visitedFlowNodes[i] === flow) { + return visitedFlowTypes[i]; + } + } + } + var type = void 0; + if (flow.flags & 16) { + type = getTypeAtFlowAssignment(flow); + if (!type) { + flow = flow.antecedent; + continue; + } + } + else if (flow.flags & 96) { + type = getTypeAtFlowCondition(flow); + } + else if (flow.flags & 12) { + if (flow.antecedents.length === 1) { + flow = flow.antecedents[0]; + continue; + } + type = flow.flags & 4 ? + getTypeAtFlowBranchLabel(flow) : + getTypeAtFlowLoopLabel(flow); + } + else if (flow.flags & 1) { + type = declaredType; + } + else { + type = initialType; + } + if (flow.flags & 256) { + visitedFlowNodes[visitedFlowCount] = flow; + visitedFlowTypes[visitedFlowCount] = type; + visitedFlowCount++; + } + return type; + } + } + function getTypeAtFlowAssignment(flow) { + var node = flow.node; + if ((node.kind === 218 || node.kind === 169) && + reference.kind === 69 && + getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(reference)) === getSymbolOfNode(node)) { + return declaredType.flags & 16384 ? + getAssignmentReducedType(declaredType, getInitialType(node)) : + declaredType; + } + if (isMatchingReference(reference, node)) { + return declaredType.flags & 16384 ? + getAssignmentReducedType(declaredType, getAssignedType(node)) : + declaredType; + } + if (containsMatchingReference(reference, node)) { + return declaredType; + } + return undefined; + } + function getTypeAtFlowCondition(flow) { + var type = getTypeAtFlowNode(flow.antecedent); + if (type !== neverType) { + var assumeTrue = (flow.flags & 32) !== 0; + type = narrowType(type, flow.expression, assumeTrue); + if (type === neverType) { + type = narrowType(declaredType, flow.expression, assumeTrue); + } + } + return type; + } + function getTypeAtFlowBranchLabel(flow) { + var antecedentTypes = []; + for (var _i = 0, _a = flow.antecedents; _i < _a.length; _i++) { + var antecedent = _a[_i]; + var type = getTypeAtFlowNode(antecedent); + if (type === declaredType && declaredType === initialType) { + return type; + } + if (!ts.contains(antecedentTypes, type)) { + antecedentTypes.push(type); + } + } + return getUnionType(antecedentTypes); + } + function getTypeAtFlowLoopLabel(flow) { + var id = getFlowNodeId(flow); + var cache = flowLoopCaches[id] || (flowLoopCaches[id] = {}); + if (!key) { + key = getFlowCacheKey(reference); + } + if (cache[key]) { + return cache[key]; + } + for (var i = flowLoopStart; i < flowLoopCount; i++) { + if (flowLoopNodes[i] === flow && flowLoopKeys[i] === key) { + return getUnionType(flowLoopTypes[i]); + } + } + var antecedentTypes = []; + flowLoopNodes[flowLoopCount] = flow; + flowLoopKeys[flowLoopCount] = key; + flowLoopTypes[flowLoopCount] = antecedentTypes; + for (var _i = 0, _a = flow.antecedents; _i < _a.length; _i++) { + var antecedent = _a[_i]; + flowLoopCount++; + var type = getTypeAtFlowNode(antecedent); + flowLoopCount--; + if (cache[key]) { + return cache[key]; + } + if (!ts.contains(antecedentTypes, type)) { + antecedentTypes.push(type); + } + if (type === declaredType) { + break; + } + } + return cache[key] = getUnionType(antecedentTypes); + } + function narrowTypeByTruthiness(type, expr, assumeTrue) { + return isMatchingReference(reference, expr) ? getTypeWithFacts(type, assumeTrue ? 1048576 : 2097152) : type; + } + function narrowTypeByBinaryExpression(type, expr, assumeTrue) { + switch (expr.operatorToken.kind) { + case 56: + return narrowTypeByTruthiness(type, expr.left, assumeTrue); + case 30: + case 31: + case 32: + case 33: + if (isNullOrUndefinedLiteral(expr.right)) { + return narrowTypeByNullCheck(type, expr, assumeTrue); + } + if (expr.left.kind === 182 && expr.right.kind === 9) { + return narrowTypeByTypeof(type, expr, assumeTrue); + } + break; + case 91: + return narrowTypeByInstanceof(type, expr, assumeTrue); + case 24: + return narrowType(type, expr.right, assumeTrue); + } + return type; + } + function narrowTypeByNullCheck(type, expr, assumeTrue) { + var operator = expr.operatorToken.kind; + if (operator === 31 || operator === 33) { + assumeTrue = !assumeTrue; + } + if (!strictNullChecks || !isMatchingReference(reference, expr.left)) { + return type; + } + var doubleEquals = operator === 30 || operator === 31; + var facts = doubleEquals ? + assumeTrue ? 65536 : 524288 : + expr.right.kind === 93 ? + assumeTrue ? 32768 : 262144 : + assumeTrue ? 16384 : 131072; + return getTypeWithFacts(type, facts); + } + function narrowTypeByTypeof(type, expr, assumeTrue) { + var left = expr.left; + var right = expr.right; + if (!isMatchingReference(reference, left.expression)) { + if (containsMatchingReference(reference, left.expression)) { + return declaredType; + } + return type; + } + if (expr.operatorToken.kind === 31 || + expr.operatorToken.kind === 33) { + assumeTrue = !assumeTrue; + } + if (assumeTrue && !(type.flags & 16384)) { + var targetType = ts.getProperty(typeofTypesByName, right.text); + if (targetType && isTypeSubtypeOf(targetType, type)) { + return targetType; + } + } + var facts = assumeTrue ? + ts.getProperty(typeofEQFacts, right.text) || 64 : + ts.getProperty(typeofNEFacts, right.text) || 8192; + return getTypeWithFacts(type, facts); + } + function narrowTypeByInstanceof(type, expr, assumeTrue) { + if (!isMatchingReference(reference, expr.left)) { + if (containsMatchingReference(reference, expr.left)) { + return declaredType; + } + return type; + } + if (isTypeAny(type)) { + return type; + } + var rightType = checkExpression(expr.right); + if (!isTypeSubtypeOf(rightType, globalFunctionType)) { + return type; + } + var targetType; + var prototypeProperty = getPropertyOfType(rightType, "prototype"); + if (prototypeProperty) { + var prototypePropertyType = getTypeOfSymbol(prototypeProperty); + if (!isTypeAny(prototypePropertyType)) { + targetType = prototypePropertyType; + } + } + if (!targetType) { + var constructSignatures = void 0; + if (rightType.flags & 2048) { + constructSignatures = resolveDeclaredMembers(rightType).declaredConstructSignatures; + } + else if (rightType.flags & 65536) { + constructSignatures = getSignaturesOfType(rightType, 1); + } + if (constructSignatures && constructSignatures.length) { + targetType = getUnionType(ts.map(constructSignatures, function (signature) { return getReturnTypeOfSignature(getErasedSignature(signature)); })); + } + } + if (targetType) { + return getNarrowedType(type, targetType, assumeTrue); + } + return type; + } + function getNarrowedType(type, candidate, assumeTrue) { + if (!assumeTrue) { + return type.flags & 16384 ? + getUnionType(ts.filter(type.types, function (t) { return !isTypeSubtypeOf(t, candidate); })) : + type; + } + if (type.flags & 16384) { + var assignableConstituents = ts.filter(type.types, function (t) { return isTypeAssignableTo(t, candidate); }); + if (assignableConstituents.length) { + return getUnionType(assignableConstituents); + } + } + var targetType = type.flags & 512 ? getApparentType(type) : type; + return isTypeAssignableTo(candidate, targetType) ? candidate : + isTypeAssignableTo(type, candidate) ? type : + neverType; + } + function narrowTypeByTypePredicate(type, callExpression, assumeTrue) { + if (type.flags & 1 || !hasMatchingArgument(callExpression, reference)) { + return type; + } + var signature = getResolvedSignature(callExpression); + var predicate = signature.typePredicate; + if (!predicate) { + return type; + } + if (ts.isIdentifierTypePredicate(predicate)) { + var predicateArgument = callExpression.arguments[predicate.parameterIndex]; + if (predicateArgument) { + if (isMatchingReference(reference, predicateArgument)) { + return getNarrowedType(type, predicate.type, assumeTrue); + } + if (containsMatchingReference(reference, predicateArgument)) { + return declaredType; + } + } + } + else { + var invokedExpression = skipParenthesizedNodes(callExpression.expression); + if (invokedExpression.kind === 173 || invokedExpression.kind === 172) { + var accessExpression = invokedExpression; + var possibleReference = skipParenthesizedNodes(accessExpression.expression); + if (isMatchingReference(reference, possibleReference)) { + return getNarrowedType(type, predicate.type, assumeTrue); + } + if (containsMatchingReference(reference, possibleReference)) { + return declaredType; + } + } + } + return type; + } + function narrowType(type, expr, assumeTrue) { + switch (expr.kind) { + case 69: + case 97: + case 172: + return narrowTypeByTruthiness(type, expr, assumeTrue); + case 174: + return narrowTypeByTypePredicate(type, expr, assumeTrue); + case 178: + return narrowType(type, expr.expression, assumeTrue); + case 187: + return narrowTypeByBinaryExpression(type, expr, assumeTrue); + case 185: + if (expr.operator === 49) { + return narrowType(type, expr.operand, !assumeTrue); + } + break; + } + return type; + } + } + function getTypeOfSymbolAtLocation(symbol, location) { + if (location.kind === 69) { + if (ts.isRightSideOfQualifiedNameOrPropertyAccess(location)) { + location = location.parent; + } + if (ts.isExpression(location) && !ts.isAssignmentTarget(location)) { + var type = checkExpression(location); + if (getExportSymbolOfValueSymbolIfExported(getNodeLinks(location).resolvedSymbol) === symbol) { + return type; + } + } + } + return getTypeOfSymbol(symbol); + } + function skipParenthesizedNodes(expression) { + while (expression.kind === 178) { + expression = expression.expression; + } + return expression; + } + function checkIdentifier(node) { + var symbol = getResolvedSymbol(node); + if (symbol === argumentsSymbol) { + var container = ts.getContainingFunction(node); + if (container.kind === 180) { + if (languageVersion < 2) { + error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression); + } + } + if (node.flags & 33554432) { + getNodeLinks(container).flags |= 8192; + } + } + if (symbol.flags & 8388608 && !isInTypeQuery(node) && !isConstEnumOrConstEnumOnlyModule(resolveAlias(symbol))) { + markAliasSymbolAsReferenced(symbol); + } + var localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol); + if (languageVersion === 2 + && localOrExportSymbol.flags & 32 + && localOrExportSymbol.valueDeclaration.kind === 221 + && ts.nodeIsDecorated(localOrExportSymbol.valueDeclaration)) { + var container = ts.getContainingClass(node); + while (container !== undefined) { + if (container === localOrExportSymbol.valueDeclaration && container.name !== node) { + getNodeLinks(container).flags |= 524288; + getNodeLinks(node).flags |= 1048576; + break; + } + container = ts.getContainingClass(container); + } + } + checkCollisionWithCapturedSuperVariable(node, node); + checkCollisionWithCapturedThisVariable(node, node); + checkNestedBlockScopedBinding(node, symbol); + var type = getTypeOfSymbol(localOrExportSymbol); + if (!(localOrExportSymbol.flags & 3) || ts.isAssignmentTarget(node)) { + return type; + } + var declaration = localOrExportSymbol.valueDeclaration; + var assumeInitialized = !strictNullChecks || (type.flags & 1) !== 0 || !declaration || + ts.getRootDeclaration(declaration).kind === 142 || ts.isInAmbientContext(declaration) || + ts.getContainingFunctionOrModule(declaration) !== ts.getContainingFunctionOrModule(node); + var flowType = getFlowTypeOfReference(node, type, assumeInitialized); + if (!assumeInitialized && !(getNullableKind(type) & 32) && getNullableKind(flowType) & 32) { + error(node, ts.Diagnostics.Variable_0_is_used_before_being_assigned, symbolToString(symbol)); + return type; + } + return flowType; + } + function isInsideFunction(node, threshold) { + var current = node; + while (current && current !== threshold) { + if (ts.isFunctionLike(current)) { + return true; + } + current = current.parent; + } + return false; + } + function checkNestedBlockScopedBinding(node, symbol) { + if (languageVersion >= 2 || + (symbol.flags & (2 | 32)) === 0 || + symbol.valueDeclaration.parent.kind === 252) { + return; + } + var container = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration); + var usedInFunction = isInsideFunction(node.parent, container); + var current = container; + var containedInIterationStatement = false; + while (current && !ts.nodeStartsNewLexicalEnvironment(current)) { + if (ts.isIterationStatement(current, false)) { + containedInIterationStatement = true; + break; + } + current = current.parent; + } + if (containedInIterationStatement) { + if (usedInFunction) { + getNodeLinks(current).flags |= 65536; + } + if (container.kind === 206 && + ts.getAncestor(symbol.valueDeclaration, 219).parent === container && + isAssignedInBodyOfForStatement(node, container)) { + getNodeLinks(symbol.valueDeclaration).flags |= 2097152; + } + getNodeLinks(symbol.valueDeclaration).flags |= 262144; + } + if (usedInFunction) { + getNodeLinks(symbol.valueDeclaration).flags |= 131072; + } + } + function isAssignedInBodyOfForStatement(node, container) { + var current = node; + while (current.parent.kind === 178) { + current = current.parent; + } + var isAssigned = false; + if (ts.isAssignmentTarget(current)) { + isAssigned = true; + } + else if ((current.parent.kind === 185 || current.parent.kind === 186)) { + var expr = current.parent; + isAssigned = expr.operator === 41 || expr.operator === 42; + } + if (!isAssigned) { + return false; + } + while (current !== container) { + if (current === container.statement) { + return true; + } + else { + current = current.parent; + } + } + return false; + } + function captureLexicalThis(node, container) { + getNodeLinks(node).flags |= 2; + if (container.kind === 145 || container.kind === 148) { + var classNode = container.parent; + getNodeLinks(classNode).flags |= 4; + } + else { + getNodeLinks(container).flags |= 4; + } + } + function findFirstSuperCall(n) { + if (ts.isSuperCallExpression(n)) { + return n; + } + else if (ts.isFunctionLike(n)) { + return undefined; + } + return ts.forEachChild(n, findFirstSuperCall); + } + function getSuperCallInConstructor(constructor) { + var links = getNodeLinks(constructor); + if (links.hasSuperCall === undefined) { + links.superCall = findFirstSuperCall(constructor.body); + links.hasSuperCall = links.superCall ? true : false; + } + return links.superCall; + } + function classDeclarationExtendsNull(classDecl) { + var classSymbol = getSymbolOfNode(classDecl); + var classInstanceType = getDeclaredTypeOfSymbol(classSymbol); + var baseConstructorType = getBaseConstructorTypeOfClass(classInstanceType); + return baseConstructorType === nullType; + } + function checkThisExpression(node) { + var container = ts.getThisContainer(node, true); + var needToCaptureLexicalThis = false; + if (container.kind === 148) { + var containingClassDecl = container.parent; + var baseTypeNode = ts.getClassExtendsHeritageClauseElement(containingClassDecl); + if (baseTypeNode && !classDeclarationExtendsNull(containingClassDecl)) { + var superCall = getSuperCallInConstructor(container); + if (!superCall || superCall.end > node.pos) { + error(node, ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class); + } + } + } + if (container.kind === 180) { + container = ts.getThisContainer(container, false); + needToCaptureLexicalThis = (languageVersion < 2); + } + switch (container.kind) { + case 225: + error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body); + break; + case 224: + error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location); + break; + case 148: + if (isInConstructorArgumentInitializer(node, container)) { + error(node, ts.Diagnostics.this_cannot_be_referenced_in_constructor_arguments); + } + break; + case 145: + case 144: + if (container.flags & 32) { + error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_static_property_initializer); + } + break; + case 140: + error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_computed_property_name); + break; + } + if (needToCaptureLexicalThis) { + captureLexicalThis(node, container); + } + if (ts.isFunctionLike(container)) { + if (container.kind === 179 && + ts.isInJavaScriptFile(container.parent) && + ts.getSpecialPropertyAssignmentKind(container.parent) === 3) { + var className = container.parent + .left + .expression + .expression; + var classSymbol = checkExpression(className).symbol; + if (classSymbol && classSymbol.members && (classSymbol.flags & 16)) { + return getInferredClassType(classSymbol); + } + } + var type = getContextuallyTypedThisType(container); + if (type) { + return type; + } + var signature = getSignatureFromDeclaration(container); + if (signature.thisType) { + return signature.thisType; + } + } + if (ts.isClassLike(container.parent)) { + var symbol = getSymbolOfNode(container.parent); + var type = container.flags & 32 ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol).thisType; + return getFlowTypeOfReference(node, type, true); + } + if (ts.isInJavaScriptFile(node)) { + var type = getTypeForThisExpressionFromJSDoc(container); + if (type && type !== unknownType) { + return type; + } + } + if (compilerOptions.noImplicitThis) { + error(node, ts.Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation); + } + return anyType; + } + function getTypeForThisExpressionFromJSDoc(node) { + var typeTag = ts.getJSDocTypeTag(node); + if (typeTag && typeTag.typeExpression && typeTag.typeExpression.type && typeTag.typeExpression.type.kind === 269) { + var jsDocFunctionType = typeTag.typeExpression.type; + if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].type.kind === 272) { + return getTypeFromTypeNode(jsDocFunctionType.parameters[0].type); + } + } + } + function isInConstructorArgumentInitializer(node, constructorDecl) { + for (var n = node; n && n !== constructorDecl; n = n.parent) { + if (n.kind === 142) { + return true; + } + } + return false; + } + function checkSuperExpression(node) { + var isCallExpression = node.parent.kind === 174 && node.parent.expression === node; + var container = ts.getSuperContainer(node, true); + var needToCaptureLexicalThis = false; + if (!isCallExpression) { + while (container && container.kind === 180) { + container = ts.getSuperContainer(container, true); + needToCaptureLexicalThis = languageVersion < 2; + } + } + var canUseSuperExpression = isLegalUsageOfSuperExpression(container); + var nodeCheckFlag = 0; + if (!canUseSuperExpression) { + var current = node; + while (current && current !== container && current.kind !== 140) { + current = current.parent; + } + if (current && current.kind === 140) { + error(node, ts.Diagnostics.super_cannot_be_referenced_in_a_computed_property_name); + } + else if (isCallExpression) { + error(node, ts.Diagnostics.Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors); + } + else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 171)) { + error(node, ts.Diagnostics.super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions); + } + else { + error(node, ts.Diagnostics.super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class); + } + return unknownType; + } + if ((container.flags & 32) || isCallExpression) { + nodeCheckFlag = 512; + } + else { + nodeCheckFlag = 256; + } + getNodeLinks(node).flags |= nodeCheckFlag; + if (container.kind === 147 && container.flags & 256) { + if (ts.isSuperPropertyOrElementAccess(node.parent) && ts.isAssignmentTarget(node.parent)) { + getNodeLinks(container).flags |= 4096; + } + else { + getNodeLinks(container).flags |= 2048; + } + } + if (needToCaptureLexicalThis) { + captureLexicalThis(node.parent, container); + } + if (container.parent.kind === 171) { + if (languageVersion < 2) { + error(node, ts.Diagnostics.super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher); + return unknownType; + } + else { + return anyType; + } + } + var classLikeDeclaration = container.parent; + var classType = getDeclaredTypeOfSymbol(getSymbolOfNode(classLikeDeclaration)); + var baseClassType = classType && getBaseTypes(classType)[0]; + if (!baseClassType) { + if (!ts.getClassExtendsHeritageClauseElement(classLikeDeclaration)) { + error(node, ts.Diagnostics.super_can_only_be_referenced_in_a_derived_class); + } + return unknownType; + } + if (container.kind === 148 && isInConstructorArgumentInitializer(node, container)) { + error(node, ts.Diagnostics.super_cannot_be_referenced_in_constructor_arguments); + return unknownType; + } + return nodeCheckFlag === 512 + ? getBaseConstructorTypeOfClass(classType) + : baseClassType; + function isLegalUsageOfSuperExpression(container) { + if (!container) { + return false; + } + if (isCallExpression) { + return container.kind === 148; + } + else { + if (ts.isClassLike(container.parent) || container.parent.kind === 171) { + if (container.flags & 32) { + return container.kind === 147 || + container.kind === 146 || + container.kind === 149 || + container.kind === 150; + } + else { + return container.kind === 147 || + container.kind === 146 || + container.kind === 149 || + container.kind === 150 || + container.kind === 145 || + container.kind === 144 || + container.kind === 148; + } + } + } + return false; + } + } + function getContextuallyTypedThisType(func) { + if (isContextSensitiveFunctionOrObjectLiteralMethod(func) && func.kind !== 180) { + var contextualSignature = getContextualSignature(func); + if (contextualSignature) { + return contextualSignature.thisType; + } + } + return undefined; + } + function getContextuallyTypedParameterType(parameter) { + var func = parameter.parent; + if (isContextSensitiveFunctionOrObjectLiteralMethod(func)) { + var iife = getImmediatelyInvokedFunctionExpression(func); + if (iife) { + var indexOfParameter = ts.indexOf(func.parameters, parameter); + if (iife.arguments && indexOfParameter < iife.arguments.length) { + if (parameter.dotDotDotToken) { + var restTypes = []; + for (var i = indexOfParameter; i < iife.arguments.length; i++) { + restTypes.push(getTypeOfExpression(iife.arguments[i])); + } + return createArrayType(getUnionType(restTypes)); + } + var links = getNodeLinks(iife); + var cached = links.resolvedSignature; + links.resolvedSignature = anySignature; + var type = checkExpression(iife.arguments[indexOfParameter]); + links.resolvedSignature = cached; + return type; + } + } + var contextualSignature = getContextualSignature(func); + if (contextualSignature) { + var funcHasRestParameters = ts.hasRestParameter(func); + var len = func.parameters.length - (funcHasRestParameters ? 1 : 0); + var indexOfParameter = ts.indexOf(func.parameters, parameter); + if (indexOfParameter < len) { + return getTypeAtPosition(contextualSignature, indexOfParameter); + } + if (funcHasRestParameters && + indexOfParameter === (func.parameters.length - 1) && + isRestParameterIndex(contextualSignature, func.parameters.length - 1)) { + return getTypeOfSymbol(ts.lastOrUndefined(contextualSignature.parameters)); + } + } + } + return undefined; + } + function getImmediatelyInvokedFunctionExpression(func) { + if (isFunctionExpressionOrArrowFunction(func)) { + var prev = func; + var parent_8 = func.parent; + while (parent_8.kind === 178) { + prev = parent_8; + parent_8 = parent_8.parent; + } + if (parent_8.kind === 174 && parent_8.expression === prev) { + return parent_8; + } + } + } + function getContextualTypeForInitializerExpression(node) { + var declaration = node.parent; + if (node === declaration.initializer) { + if (declaration.type) { + return getTypeFromTypeNode(declaration.type); + } + if (declaration.kind === 142) { + var type = getContextuallyTypedParameterType(declaration); + if (type) { + return type; + } + } + if (ts.isBindingPattern(declaration.name)) { + return getTypeFromBindingPattern(declaration.name, true); + } + if (ts.isBindingPattern(declaration.parent)) { + var parentDeclaration = declaration.parent.parent; + var name_11 = declaration.propertyName || declaration.name; + if (ts.isVariableLike(parentDeclaration) && + parentDeclaration.type && + !ts.isBindingPattern(name_11)) { + var text = getTextOfPropertyName(name_11); + if (text) { + return getTypeOfPropertyOfType(getTypeFromTypeNode(parentDeclaration.type), text); + } + } + } + } + return undefined; + } + function getContextualTypeForReturnExpression(node) { + var func = ts.getContainingFunction(node); + if (func && !func.asteriskToken) { + return getContextualReturnType(func); + } + return undefined; + } + function getContextualTypeForYieldOperand(node) { + var func = ts.getContainingFunction(node); + if (func) { + var contextualReturnType = getContextualReturnType(func); + if (contextualReturnType) { + return node.asteriskToken + ? contextualReturnType + : getElementTypeOfIterableIterator(contextualReturnType); + } + } + return undefined; + } + function isInParameterInitializerBeforeContainingFunction(node) { + while (node.parent && !ts.isFunctionLike(node.parent)) { + if (node.parent.kind === 142 && node.parent.initializer === node) { + return true; + } + node = node.parent; + } + return false; + } + function getContextualReturnType(functionDecl) { + if (functionDecl.type || + functionDecl.kind === 148 || + functionDecl.kind === 149 && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(functionDecl.symbol, 150))) { + return getReturnTypeOfSignature(getSignatureFromDeclaration(functionDecl)); + } + var signature = getContextualSignatureForFunctionLikeDeclaration(functionDecl); + if (signature) { + return getReturnTypeOfSignature(signature); + } + return undefined; + } + function getContextualTypeForArgument(callTarget, arg) { + var args = getEffectiveCallArguments(callTarget); + var argIndex = ts.indexOf(args, arg); + if (argIndex >= 0) { + var signature = getResolvedOrAnySignature(callTarget); + return getTypeAtPosition(signature, argIndex); + } + return undefined; + } + function getContextualTypeForSubstitutionExpression(template, substitutionExpression) { + if (template.parent.kind === 176) { + return getContextualTypeForArgument(template.parent, substitutionExpression); + } + return undefined; + } + function getContextualTypeForBinaryOperand(node) { + var binaryExpression = node.parent; + var operator = binaryExpression.operatorToken.kind; + if (operator >= 56 && operator <= 68) { + if (node === binaryExpression.right) { + return checkExpression(binaryExpression.left); + } + } + else if (operator === 52) { + var type = getContextualType(binaryExpression); + if (!type && node === binaryExpression.right) { + type = checkExpression(binaryExpression.left); + } + return type; + } + else if (operator === 51 || operator === 24) { + if (node === binaryExpression.right) { + return getContextualType(binaryExpression); + } + } + return undefined; + } + function applyToContextualType(type, mapper) { + if (!(type.flags & 16384)) { + return mapper(type); + } + var types = type.types; + var mappedType; + var mappedTypes; + for (var _i = 0, types_8 = types; _i < types_8.length; _i++) { + var current = types_8[_i]; + var t = mapper(current); + if (t) { + if (!mappedType) { + mappedType = t; + } + else if (!mappedTypes) { + mappedTypes = [mappedType, t]; + } + else { + mappedTypes.push(t); + } + } + } + return mappedTypes ? getUnionType(mappedTypes) : mappedType; + } + function getTypeOfPropertyOfContextualType(type, name) { + return applyToContextualType(type, function (t) { + var prop = t.flags & 130048 ? getPropertyOfType(t, name) : undefined; + return prop ? getTypeOfSymbol(prop) : undefined; + }); + } + function getIndexTypeOfContextualType(type, kind) { + return applyToContextualType(type, function (t) { return getIndexTypeOfStructuredType(t, kind); }); + } + function contextualTypeIsStringLiteralType(type) { + return !!(type.flags & 16384 ? ts.forEach(type.types, isStringLiteralType) : isStringLiteralType(type)); + } + function contextualTypeIsTupleLikeType(type) { + return !!(type.flags & 16384 ? ts.forEach(type.types, isTupleLikeType) : isTupleLikeType(type)); + } + function getContextualTypeForObjectLiteralMethod(node) { + ts.Debug.assert(ts.isObjectLiteralMethod(node)); + if (isInsideWithStatementBody(node)) { + return undefined; + } + return getContextualTypeForObjectLiteralElement(node); + } + function getContextualTypeForObjectLiteralElement(element) { + var objectLiteral = element.parent; + var type = getApparentTypeOfContextualType(objectLiteral); + if (type) { + if (!ts.hasDynamicName(element)) { + var symbolName = getSymbolOfNode(element).name; + var propertyType = getTypeOfPropertyOfContextualType(type, symbolName); + if (propertyType) { + return propertyType; + } + } + return isNumericName(element.name) && getIndexTypeOfContextualType(type, 1) || + getIndexTypeOfContextualType(type, 0); + } + return undefined; + } + function getContextualTypeForElementExpression(node) { + var arrayLiteral = node.parent; + var type = getApparentTypeOfContextualType(arrayLiteral); + if (type) { + var index = ts.indexOf(arrayLiteral.elements, node); + return getTypeOfPropertyOfContextualType(type, "" + index) + || getIndexTypeOfContextualType(type, 1) + || (languageVersion >= 2 ? getElementTypeOfIterable(type, undefined) : undefined); + } + return undefined; + } + function getContextualTypeForConditionalOperand(node) { + var conditional = node.parent; + return node === conditional.whenTrue || node === conditional.whenFalse ? getContextualType(conditional) : undefined; + } + function getContextualTypeForJsxAttribute(attribute) { + var kind = attribute.kind; + var jsxElement = attribute.parent; + var attrsType = getJsxElementAttributesType(jsxElement); + if (attribute.kind === 246) { + if (!attrsType || isTypeAny(attrsType)) { + return undefined; + } + return getTypeOfPropertyOfType(attrsType, attribute.name.text); + } + else if (attribute.kind === 247) { + return attrsType; + } + ts.Debug.fail("Expected JsxAttribute or JsxSpreadAttribute, got ts.SyntaxKind[" + kind + "]"); + } + function getApparentTypeOfContextualType(node) { + var type = getContextualType(node); + return type && getApparentType(type); + } + function getContextualType(node) { + if (isInsideWithStatementBody(node)) { + return undefined; + } + if (node.contextualType) { + return node.contextualType; + } + var parent = node.parent; + switch (parent.kind) { + case 218: + case 142: + case 145: + case 144: + case 169: + return getContextualTypeForInitializerExpression(node); + case 180: + case 211: + return getContextualTypeForReturnExpression(node); + case 190: + return getContextualTypeForYieldOperand(parent); + case 174: + case 175: + return getContextualTypeForArgument(parent, node); + case 177: + case 195: + return getTypeFromTypeNode(parent.type); + case 187: + return getContextualTypeForBinaryOperand(node); + case 253: + return getContextualTypeForObjectLiteralElement(parent); + case 170: + return getContextualTypeForElementExpression(node); + case 188: + return getContextualTypeForConditionalOperand(node); + case 197: + ts.Debug.assert(parent.parent.kind === 189); + return getContextualTypeForSubstitutionExpression(parent.parent, node); + case 178: + return getContextualType(parent); + case 248: + return getContextualType(parent); + case 246: + case 247: + return getContextualTypeForJsxAttribute(parent); + } + return undefined; + } + function getNonGenericSignature(type) { + var signatures = getSignaturesOfStructuredType(type, 0); + if (signatures.length === 1) { + var signature = signatures[0]; + if (!signature.typeParameters) { + return signature; + } + } + } + function isFunctionExpressionOrArrowFunction(node) { + return node.kind === 179 || node.kind === 180; + } + function getContextualSignatureForFunctionLikeDeclaration(node) { + return isFunctionExpressionOrArrowFunction(node) || ts.isObjectLiteralMethod(node) + ? getContextualSignature(node) + : undefined; + } + function getContextualTypeForFunctionLikeDeclaration(node) { + return ts.isObjectLiteralMethod(node) ? + getContextualTypeForObjectLiteralMethod(node) : + getApparentTypeOfContextualType(node); + } + function getContextualSignature(node) { + ts.Debug.assert(node.kind !== 147 || ts.isObjectLiteralMethod(node)); + var type = getContextualTypeForFunctionLikeDeclaration(node); + if (!type) { + return undefined; + } + if (!(type.flags & 16384)) { + return getNonGenericSignature(type); + } + var signatureList; + var types = type.types; + for (var _i = 0, types_9 = types; _i < types_9.length; _i++) { + var current = types_9[_i]; + var signature = getNonGenericSignature(current); + if (signature) { + if (!signatureList) { + signatureList = [signature]; + } + else if (!compareSignaturesIdentical(signatureList[0], signature, false, true, true, compareTypesIdentical)) { + return undefined; + } + else { + signatureList.push(signature); + } + } + } + var result; + if (signatureList) { + result = cloneSignature(signatureList[0]); + result.resolvedReturnType = undefined; + result.unionSignatures = signatureList; + } + return result; + } + function isInferentialContext(mapper) { + return mapper && mapper.context; + } + function checkSpreadElementExpression(node, contextualMapper) { + var arrayOrIterableType = checkExpressionCached(node.expression, contextualMapper); + return checkIteratedTypeOrElementType(arrayOrIterableType, node.expression, false); + } + function hasDefaultValue(node) { + return (node.kind === 169 && !!node.initializer) || + (node.kind === 187 && node.operatorToken.kind === 56); + } + function checkArrayLiteral(node, contextualMapper) { + var elements = node.elements; + var hasSpreadElement = false; + var elementTypes = []; + var inDestructuringPattern = ts.isAssignmentTarget(node); + for (var _i = 0, elements_1 = elements; _i < elements_1.length; _i++) { + var e = elements_1[_i]; + if (inDestructuringPattern && e.kind === 191) { + var restArrayType = checkExpression(e.expression, contextualMapper); + var restElementType = getIndexTypeOfType(restArrayType, 1) || + (languageVersion >= 2 ? getElementTypeOfIterable(restArrayType, undefined) : undefined); + if (restElementType) { + elementTypes.push(restElementType); + } + } + else { + var type = checkExpression(e, contextualMapper); + elementTypes.push(type); + } + hasSpreadElement = hasSpreadElement || e.kind === 191; + } + if (!hasSpreadElement) { + if (inDestructuringPattern && elementTypes.length) { + var type = createNewTupleType(elementTypes); + type.pattern = node; + return type; + } + var contextualType = getApparentTypeOfContextualType(node); + if (contextualType && contextualTypeIsTupleLikeType(contextualType)) { + var pattern = contextualType.pattern; + if (pattern && (pattern.kind === 168 || pattern.kind === 170)) { + var patternElements = pattern.elements; + for (var i = elementTypes.length; i < patternElements.length; i++) { + var patternElement = patternElements[i]; + if (hasDefaultValue(patternElement)) { + elementTypes.push(contextualType.elementTypes[i]); + } + else { + if (patternElement.kind !== 193) { + error(patternElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); + } + elementTypes.push(unknownType); + } + } + } + if (elementTypes.length) { + return createTupleType(elementTypes); + } + } + } + return createArrayType(elementTypes.length ? getUnionType(elementTypes) : emptyArrayElementType); + } + function isNumericName(name) { + return name.kind === 140 ? isNumericComputedName(name) : isNumericLiteralName(name.text); + } + function isNumericComputedName(name) { + return isTypeAnyOrAllConstituentTypesHaveKind(checkComputedPropertyName(name), 132); + } + function isTypeAnyOrAllConstituentTypesHaveKind(type, kind) { + return isTypeAny(type) || isTypeOfKind(type, kind); + } + function isNumericLiteralName(name) { + return (+name).toString() === name; + } + function checkComputedPropertyName(node) { + var links = getNodeLinks(node.expression); + if (!links.resolvedType) { + links.resolvedType = checkExpression(node.expression); + if (!isTypeAnyOrAllConstituentTypesHaveKind(links.resolvedType, 132 | 258 | 16777216)) { + error(node, ts.Diagnostics.A_computed_property_name_must_be_of_type_string_number_symbol_or_any); + } + else { + checkThatExpressionIsProperSymbolReference(node.expression, links.resolvedType, true); + } + } + return links.resolvedType; + } + function getObjectLiteralIndexInfo(node, properties, kind) { + var propTypes = []; + for (var i = 0; i < properties.length; i++) { + if (kind === 0 || isNumericName(node.properties[i].name)) { + propTypes.push(getTypeOfSymbol(properties[i])); + } + } + var unionType = propTypes.length ? getUnionType(propTypes) : undefinedType; + return createIndexInfo(unionType, false); + } + function checkObjectLiteral(node, contextualMapper) { + var inDestructuringPattern = ts.isAssignmentTarget(node); + checkGrammarObjectLiteralExpression(node, inDestructuringPattern); + var propertiesTable = {}; + var propertiesArray = []; + var contextualType = getApparentTypeOfContextualType(node); + var contextualTypeHasPattern = contextualType && contextualType.pattern && + (contextualType.pattern.kind === 167 || contextualType.pattern.kind === 171); + var typeFlags = 0; + var patternWithComputedProperties = false; + var hasComputedStringProperty = false; + var hasComputedNumberProperty = false; + for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { + var memberDecl = _a[_i]; + var member = memberDecl.symbol; + if (memberDecl.kind === 253 || + memberDecl.kind === 254 || + ts.isObjectLiteralMethod(memberDecl)) { + var type = void 0; + if (memberDecl.kind === 253) { + type = checkPropertyAssignment(memberDecl, contextualMapper); + } + else if (memberDecl.kind === 147) { + type = checkObjectLiteralMethod(memberDecl, contextualMapper); + } + else { + ts.Debug.assert(memberDecl.kind === 254); + type = checkExpression(memberDecl.name, contextualMapper); + } + typeFlags |= type.flags; + var prop = createSymbol(4 | 67108864 | member.flags, member.name); + if (inDestructuringPattern) { + var isOptional = (memberDecl.kind === 253 && hasDefaultValue(memberDecl.initializer)) || + (memberDecl.kind === 254 && memberDecl.objectAssignmentInitializer); + if (isOptional) { + prop.flags |= 536870912; + } + if (ts.hasDynamicName(memberDecl)) { + patternWithComputedProperties = true; + } + } + else if (contextualTypeHasPattern && !(contextualType.flags & 67108864)) { + var impliedProp = getPropertyOfType(contextualType, member.name); + if (impliedProp) { + prop.flags |= impliedProp.flags & 536870912; + } + else if (!compilerOptions.suppressExcessPropertyErrors) { + error(memberDecl.name, ts.Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1, symbolToString(member), typeToString(contextualType)); + } + } + prop.declarations = member.declarations; + prop.parent = member.parent; + if (member.valueDeclaration) { + prop.valueDeclaration = member.valueDeclaration; + } + prop.type = type; + prop.target = member; + member = prop; + } + else { + ts.Debug.assert(memberDecl.kind === 149 || memberDecl.kind === 150); + checkAccessorDeclaration(memberDecl); + } + if (ts.hasDynamicName(memberDecl)) { + if (isNumericName(memberDecl.name)) { + hasComputedNumberProperty = true; + } + else { + hasComputedStringProperty = true; + } + } + else { + propertiesTable[member.name] = member; + } + propertiesArray.push(member); + } + if (contextualTypeHasPattern) { + for (var _b = 0, _c = getPropertiesOfType(contextualType); _b < _c.length; _b++) { + var prop = _c[_b]; + if (!ts.hasProperty(propertiesTable, prop.name)) { + if (!(prop.flags & 536870912)) { + error(prop.valueDeclaration || prop.bindingElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); + } + propertiesTable[prop.name] = prop; + propertiesArray.push(prop); + } + } + } + var stringIndexInfo = hasComputedStringProperty ? getObjectLiteralIndexInfo(node, propertiesArray, 0) : undefined; + var numberIndexInfo = hasComputedNumberProperty ? getObjectLiteralIndexInfo(node, propertiesArray, 1) : undefined; + var result = createAnonymousType(node.symbol, propertiesTable, emptyArray, emptyArray, stringIndexInfo, numberIndexInfo); + var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 1048576; + result.flags |= 524288 | 4194304 | freshObjectLiteralFlag | (typeFlags & 14680064) | (patternWithComputedProperties ? 67108864 : 0); + if (inDestructuringPattern) { + result.pattern = node; + } + return result; + } + function checkJsxSelfClosingElement(node) { + checkJsxOpeningLikeElement(node); + return jsxElementType || anyType; + } + function checkJsxElement(node) { + checkJsxOpeningLikeElement(node.openingElement); + if (isJsxIntrinsicIdentifier(node.closingElement.tagName)) { + getIntrinsicTagSymbol(node.closingElement); + } + else { + checkExpression(node.closingElement.tagName); + } + for (var _i = 0, _a = node.children; _i < _a.length; _i++) { + var child = _a[_i]; + switch (child.kind) { + case 248: + checkJsxExpression(child); + break; + case 241: + checkJsxElement(child); + break; + case 242: + checkJsxSelfClosingElement(child); + break; + } + } + return jsxElementType || anyType; + } + function isUnhyphenatedJsxName(name) { + return name.indexOf("-") < 0; + } + function isJsxIntrinsicIdentifier(tagName) { + if (tagName.kind === 139) { + return false; + } + else { + return ts.isIntrinsicJsxName(tagName.text); + } + } + function checkJsxAttribute(node, elementAttributesType, nameTable) { + var correspondingPropType = undefined; + if (elementAttributesType === emptyObjectType && isUnhyphenatedJsxName(node.name.text)) { + error(node.parent, ts.Diagnostics.JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property, getJsxElementPropertiesName()); + } + else if (elementAttributesType && !isTypeAny(elementAttributesType)) { + var correspondingPropSymbol = getPropertyOfType(elementAttributesType, node.name.text); + correspondingPropType = correspondingPropSymbol && getTypeOfSymbol(correspondingPropSymbol); + if (isUnhyphenatedJsxName(node.name.text)) { + var indexerType = getIndexTypeOfType(elementAttributesType, 0); + if (indexerType) { + correspondingPropType = indexerType; + } + else { + if (!correspondingPropType) { + error(node.name, ts.Diagnostics.Property_0_does_not_exist_on_type_1, node.name.text, typeToString(elementAttributesType)); + return unknownType; + } + } + } + } + var exprType; + if (node.initializer) { + exprType = checkExpression(node.initializer); + } + else { + exprType = booleanType; + } + if (correspondingPropType) { + checkTypeAssignableTo(exprType, correspondingPropType, node); + } + nameTable[node.name.text] = true; + return exprType; + } + function checkJsxSpreadAttribute(node, elementAttributesType, nameTable) { + var type = checkExpression(node.expression); + var props = getPropertiesOfType(type); + for (var _i = 0, props_2 = props; _i < props_2.length; _i++) { + var prop = props_2[_i]; + if (!nameTable[prop.name]) { + var targetPropSym = getPropertyOfType(elementAttributesType, prop.name); + if (targetPropSym) { + var msg = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property, prop.name); + checkTypeAssignableTo(getTypeOfSymbol(prop), getTypeOfSymbol(targetPropSym), node, undefined, msg); + } + nameTable[prop.name] = true; + } + } + return type; + } + function getJsxType(name) { + if (jsxTypes[name] === undefined) { + return jsxTypes[name] = getExportedTypeFromNamespace(JsxNames.JSX, name) || unknownType; + } + return jsxTypes[name]; + } + function getIntrinsicTagSymbol(node) { + var links = getNodeLinks(node); + if (!links.resolvedSymbol) { + var intrinsicElementsType = getJsxType(JsxNames.IntrinsicElements); + if (intrinsicElementsType !== unknownType) { + var intrinsicProp = getPropertyOfType(intrinsicElementsType, node.tagName.text); + if (intrinsicProp) { + links.jsxFlags |= 1; + return links.resolvedSymbol = intrinsicProp; + } + var indexSignatureType = getIndexTypeOfType(intrinsicElementsType, 0); + if (indexSignatureType) { + links.jsxFlags |= 2; + return links.resolvedSymbol = intrinsicElementsType.symbol; + } + error(node, ts.Diagnostics.Property_0_does_not_exist_on_type_1, node.tagName.text, "JSX." + JsxNames.IntrinsicElements); + return links.resolvedSymbol = unknownSymbol; + } + else { + if (compilerOptions.noImplicitAny) { + error(node, ts.Diagnostics.JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists, JsxNames.IntrinsicElements); + } + return links.resolvedSymbol = unknownSymbol; + } + } + return links.resolvedSymbol; + } + function getJsxElementInstanceType(node, valueType) { + ts.Debug.assert(!(valueType.flags & 16384)); + if (isTypeAny(valueType)) { + return anyType; + } + var signatures = getSignaturesOfType(valueType, 1); + if (signatures.length === 0) { + signatures = getSignaturesOfType(valueType, 0); + if (signatures.length === 0) { + error(node.tagName, ts.Diagnostics.JSX_element_type_0_does_not_have_any_construct_or_call_signatures, ts.getTextOfNode(node.tagName)); + return unknownType; + } + } + return getUnionType(signatures.map(getReturnTypeOfSignature)); + } + function getJsxElementPropertiesName() { + var jsxNamespace = getGlobalSymbol(JsxNames.JSX, 1536, undefined); + var attribsPropTypeSym = jsxNamespace && getSymbol(jsxNamespace.exports, JsxNames.ElementAttributesPropertyNameContainer, 793056); + var attribPropType = attribsPropTypeSym && getDeclaredTypeOfSymbol(attribsPropTypeSym); + var attribProperties = attribPropType && getPropertiesOfType(attribPropType); + if (attribProperties) { + if (attribProperties.length === 0) { + return ""; + } + else if (attribProperties.length === 1) { + return attribProperties[0].name; + } + else { + error(attribsPropTypeSym.declarations[0], ts.Diagnostics.The_global_type_JSX_0_may_not_have_more_than_one_property, JsxNames.ElementAttributesPropertyNameContainer); + return undefined; + } + } + else { + return undefined; + } + } + function getResolvedJsxType(node, elemType, elemClassType) { + if (!elemType) { + elemType = checkExpression(node.tagName); + } + if (elemType.flags & 16384) { + var types = elemType.types; + return getUnionType(types.map(function (type) { + return getResolvedJsxType(node, type, elemClassType); + })); + } + var elemInstanceType = getJsxElementInstanceType(node, elemType); + if (!elemClassType || !isTypeAssignableTo(elemInstanceType, elemClassType)) { + if (jsxElementType) { + var callSignatures = elemType && getSignaturesOfType(elemType, 0); + var callSignature = callSignatures && callSignatures.length > 0 && callSignatures[0]; + var callReturnType = callSignature && getReturnTypeOfSignature(callSignature); + var paramType = callReturnType && (callSignature.parameters.length === 0 ? emptyObjectType : getTypeOfSymbol(callSignature.parameters[0])); + if (callReturnType && isTypeAssignableTo(callReturnType, jsxElementType)) { + var intrinsicAttributes = getJsxType(JsxNames.IntrinsicAttributes); + if (intrinsicAttributes !== unknownType) { + paramType = intersectTypes(intrinsicAttributes, paramType); + } + return paramType; + } + } + } + if (elemClassType) { + checkTypeRelatedTo(elemInstanceType, elemClassType, assignableRelation, node, ts.Diagnostics.JSX_element_type_0_is_not_a_constructor_function_for_JSX_elements); + } + if (isTypeAny(elemInstanceType)) { + return elemInstanceType; + } + var propsName = getJsxElementPropertiesName(); + if (propsName === undefined) { + return anyType; + } + else if (propsName === "") { + return elemInstanceType; + } + else { + var attributesType = getTypeOfPropertyOfType(elemInstanceType, propsName); + if (!attributesType) { + return emptyObjectType; + } + else if (isTypeAny(attributesType) || (attributesType === unknownType)) { + return attributesType; + } + else if (attributesType.flags & 16384) { + error(node.tagName, ts.Diagnostics.JSX_element_attributes_type_0_may_not_be_a_union_type, typeToString(attributesType)); + return anyType; + } + else { + var apparentAttributesType = attributesType; + var intrinsicClassAttribs = getJsxType(JsxNames.IntrinsicClassAttributes); + if (intrinsicClassAttribs !== unknownType) { + var typeParams = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(intrinsicClassAttribs.symbol); + if (typeParams) { + if (typeParams.length === 1) { + apparentAttributesType = intersectTypes(createTypeReference(intrinsicClassAttribs, [elemInstanceType]), apparentAttributesType); + } + } + else { + apparentAttributesType = intersectTypes(attributesType, intrinsicClassAttribs); + } + } + var intrinsicAttribs = getJsxType(JsxNames.IntrinsicAttributes); + if (intrinsicAttribs !== unknownType) { + apparentAttributesType = intersectTypes(intrinsicAttribs, apparentAttributesType); + } + return apparentAttributesType; + } + } + } + function getJsxElementAttributesType(node) { + var links = getNodeLinks(node); + if (!links.resolvedJsxType) { + if (isJsxIntrinsicIdentifier(node.tagName)) { + var symbol = getIntrinsicTagSymbol(node); + if (links.jsxFlags & 1) { + return links.resolvedJsxType = getTypeOfSymbol(symbol); + } + else if (links.jsxFlags & 2) { + return links.resolvedJsxType = getIndexInfoOfSymbol(symbol, 0).type; + } + else { + return links.resolvedJsxType = unknownType; + } + } + else { + var elemClassType = getJsxGlobalElementClassType(); + return links.resolvedJsxType = getResolvedJsxType(node, undefined, elemClassType); + } + } + return links.resolvedJsxType; + } + function getJsxAttributePropertySymbol(attrib) { + var attributesType = getJsxElementAttributesType(attrib.parent); + var prop = getPropertyOfType(attributesType, attrib.name.text); + return prop || unknownSymbol; + } + function getJsxGlobalElementClassType() { + if (!jsxElementClassType) { + jsxElementClassType = getExportedTypeFromNamespace(JsxNames.JSX, JsxNames.ElementClass); + } + return jsxElementClassType; + } + function getJsxIntrinsicTagNames() { + var intrinsics = getJsxType(JsxNames.IntrinsicElements); + return intrinsics ? getPropertiesOfType(intrinsics) : emptyArray; + } + function checkJsxPreconditions(errorNode) { + if ((compilerOptions.jsx || 0) === 0) { + error(errorNode, ts.Diagnostics.Cannot_use_JSX_unless_the_jsx_flag_is_provided); + } + if (jsxElementType === undefined) { + if (compilerOptions.noImplicitAny) { + error(errorNode, ts.Diagnostics.JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist); + } + } + } + function checkJsxOpeningLikeElement(node) { + checkGrammarJsxElement(node); + checkJsxPreconditions(node); + var reactRefErr = compilerOptions.jsx === 2 ? ts.Diagnostics.Cannot_find_name_0 : undefined; + var reactNamespace = compilerOptions.reactNamespace ? compilerOptions.reactNamespace : "React"; + var reactSym = resolveName(node.tagName, reactNamespace, 107455, reactRefErr, reactNamespace); + if (reactSym) { + getSymbolLinks(reactSym).referenced = true; + } + var targetAttributesType = getJsxElementAttributesType(node); + var nameTable = {}; + var sawSpreadedAny = false; + for (var i = node.attributes.length - 1; i >= 0; i--) { + if (node.attributes[i].kind === 246) { + checkJsxAttribute((node.attributes[i]), targetAttributesType, nameTable); + } + else { + ts.Debug.assert(node.attributes[i].kind === 247); + var spreadType = checkJsxSpreadAttribute((node.attributes[i]), targetAttributesType, nameTable); + if (isTypeAny(spreadType)) { + sawSpreadedAny = true; + } + } + } + if (targetAttributesType && !sawSpreadedAny) { + var targetProperties = getPropertiesOfType(targetAttributesType); + for (var i = 0; i < targetProperties.length; i++) { + if (!(targetProperties[i].flags & 536870912) && + nameTable[targetProperties[i].name] === undefined) { + error(node, ts.Diagnostics.Property_0_is_missing_in_type_1, targetProperties[i].name, typeToString(targetAttributesType)); + } + } + } + } + function checkJsxExpression(node) { + if (node.expression) { + return checkExpression(node.expression); + } + else { + return unknownType; + } + } + function getDeclarationKindFromSymbol(s) { + return s.valueDeclaration ? s.valueDeclaration.kind : 145; + } + function getDeclarationFlagsFromSymbol(s) { + return s.valueDeclaration ? ts.getCombinedNodeFlags(s.valueDeclaration) : s.flags & 134217728 ? 4 | 32 : 0; + } + function checkClassPropertyAccess(node, left, type, prop) { + var flags = getDeclarationFlagsFromSymbol(prop); + var declaringClass = getDeclaredTypeOfSymbol(getParentOfSymbol(prop)); + var errorNode = node.kind === 172 || node.kind === 218 ? + node.name : + node.right; + if (left.kind === 95) { + if (languageVersion < 2 && getDeclarationKindFromSymbol(prop) !== 147) { + error(errorNode, ts.Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword); + return false; + } + if (flags & 128) { + error(errorNode, ts.Diagnostics.Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression, symbolToString(prop), typeToString(declaringClass)); + return false; + } + } + if (!(flags & (8 | 16))) { + return true; + } + if (flags & 8) { + var declaringClassDeclaration = getClassLikeDeclarationOfSymbol(getParentOfSymbol(prop)); + if (!isNodeWithinClass(node, declaringClassDeclaration)) { + error(errorNode, ts.Diagnostics.Property_0_is_private_and_only_accessible_within_class_1, symbolToString(prop), typeToString(declaringClass)); + return false; + } + return true; + } + if (left.kind === 95) { + return true; + } + var enclosingClass = forEachEnclosingClass(node, function (enclosingDeclaration) { + var enclosingClass = getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingDeclaration)); + return hasBaseType(enclosingClass, declaringClass) ? enclosingClass : undefined; + }); + if (!enclosingClass) { + error(errorNode, ts.Diagnostics.Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses, symbolToString(prop), typeToString(declaringClass)); + return false; + } + if (flags & 32) { + return true; + } + if (type.flags & 33554432) { + type = getConstraintOfTypeParameter(type); + } + if (!(getTargetType(type).flags & (1024 | 2048) && hasBaseType(type, enclosingClass))) { + error(errorNode, ts.Diagnostics.Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1, symbolToString(prop), typeToString(enclosingClass)); + return false; + } + return true; + } + function checkNonNullExpression(node) { + var type = checkExpression(node); + if (strictNullChecks) { + var kind = getNullableKind(type); + if (kind) { + error(node, kind & 32 ? kind & 64 ? + ts.Diagnostics.Object_is_possibly_null_or_undefined : + ts.Diagnostics.Object_is_possibly_undefined : + ts.Diagnostics.Object_is_possibly_null); + } + return getNonNullableType(type); + } + return type; + } + function checkPropertyAccessExpression(node) { + return checkPropertyAccessExpressionOrQualifiedName(node, node.expression, node.name); + } + function checkQualifiedName(node) { + return checkPropertyAccessExpressionOrQualifiedName(node, node.left, node.right); + } + function checkPropertyAccessExpressionOrQualifiedName(node, left, right) { + var type = checkNonNullExpression(left); + if (isTypeAny(type)) { + return type; + } + var apparentType = getApparentType(getWidenedType(type)); + if (apparentType === unknownType) { + return unknownType; + } + var prop = getPropertyOfType(apparentType, right.text); + if (!prop) { + if (right.text) { + error(right, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.declarationNameToString(right), typeToString(type.flags & 33554432 ? apparentType : type)); + } + return unknownType; + } + getNodeLinks(node).resolvedSymbol = prop; + if (prop.parent && prop.parent.flags & 32) { + checkClassPropertyAccess(node, left, apparentType, prop); + } + var propType = getTypeOfSymbol(prop); + if (node.kind !== 172 || ts.isAssignmentTarget(node) || + !(propType.flags & 16384) && !(prop.flags & (3 | 4 | 98304))) { + return propType; + } + var leftmostNode = getLeftmostIdentifierOrThis(node); + if (!leftmostNode) { + return propType; + } + if (leftmostNode.kind === 69) { + var leftmostSymbol = getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(leftmostNode)); + if (!leftmostSymbol) { + return propType; + } + var declaration = leftmostSymbol.valueDeclaration; + if (!declaration || declaration.kind !== 218 && declaration.kind !== 142 && declaration.kind !== 169) { + return propType; + } + } + return getFlowTypeOfReference(node, propType, true); + } + function isValidPropertyAccess(node, propertyName) { + var left = node.kind === 172 + ? node.expression + : node.left; + var type = checkExpression(left); + if (type !== unknownType && !isTypeAny(type)) { + var prop = getPropertyOfType(getWidenedType(type), propertyName); + if (prop && prop.parent && prop.parent.flags & 32) { + return checkClassPropertyAccess(node, left, type, prop); + } + } + return true; + } + function getForInVariableSymbol(node) { + var initializer = node.initializer; + if (initializer.kind === 219) { + var variable = initializer.declarations[0]; + if (variable && !ts.isBindingPattern(variable.name)) { + return getSymbolOfNode(variable); + } + } + else if (initializer.kind === 69) { + return getResolvedSymbol(initializer); + } + return undefined; + } + function hasNumericPropertyNames(type) { + return getIndexTypeOfType(type, 1) && !getIndexTypeOfType(type, 0); + } + function isForInVariableForNumericPropertyNames(expr) { + var e = skipParenthesizedNodes(expr); + if (e.kind === 69) { + var symbol = getResolvedSymbol(e); + if (symbol.flags & 3) { + var child = expr; + var node = expr.parent; + while (node) { + if (node.kind === 207 && + child === node.statement && + getForInVariableSymbol(node) === symbol && + hasNumericPropertyNames(checkExpression(node.expression))) { + return true; + } + child = node; + node = node.parent; + } + } + } + return false; + } + function checkIndexedAccess(node) { + if (!node.argumentExpression) { + var sourceFile = ts.getSourceFileOfNode(node); + if (node.parent.kind === 175 && node.parent.expression === node) { + var start = ts.skipTrivia(sourceFile.text, node.expression.end); + var end = node.end; + grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead); + } + else { + var start = node.end - "]".length; + var end = node.end; + grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.Expression_expected); + } + } + var objectType = getApparentType(checkNonNullExpression(node.expression)); + var indexType = node.argumentExpression ? checkExpression(node.argumentExpression) : unknownType; + if (objectType === unknownType) { + return unknownType; + } + var isConstEnum = isConstEnumObjectType(objectType); + if (isConstEnum && + (!node.argumentExpression || node.argumentExpression.kind !== 9)) { + error(node.argumentExpression, ts.Diagnostics.A_const_enum_member_can_only_be_accessed_using_a_string_literal); + return unknownType; + } + if (node.argumentExpression) { + var name_12 = getPropertyNameForIndexedAccess(node.argumentExpression, indexType); + if (name_12 !== undefined) { + var prop = getPropertyOfType(objectType, name_12); + if (prop) { + getNodeLinks(node).resolvedSymbol = prop; + return getTypeOfSymbol(prop); + } + else if (isConstEnum) { + error(node.argumentExpression, ts.Diagnostics.Property_0_does_not_exist_on_const_enum_1, name_12, symbolToString(objectType.symbol)); + return unknownType; + } + } + } + if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, 258 | 132 | 16777216)) { + if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, 132) || isForInVariableForNumericPropertyNames(node.argumentExpression)) { + var numberIndexInfo = getIndexInfoOfType(objectType, 1); + if (numberIndexInfo) { + getNodeLinks(node).resolvedIndexInfo = numberIndexInfo; + return numberIndexInfo.type; + } + } + var stringIndexInfo = getIndexInfoOfType(objectType, 0); + if (stringIndexInfo) { + getNodeLinks(node).resolvedIndexInfo = stringIndexInfo; + return stringIndexInfo.type; + } + if (compilerOptions.noImplicitAny && !compilerOptions.suppressImplicitAnyIndexErrors && !isTypeAny(objectType)) { + error(node, getIndexTypeOfType(objectType, 1) ? + ts.Diagnostics.Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number : + ts.Diagnostics.Index_signature_of_object_type_implicitly_has_an_any_type); + } + return anyType; + } + error(node, ts.Diagnostics.An_index_expression_argument_must_be_of_type_string_number_symbol_or_any); + return unknownType; + } + function getPropertyNameForIndexedAccess(indexArgumentExpression, indexArgumentType) { + if (indexArgumentExpression.kind === 9 || indexArgumentExpression.kind === 8) { + return indexArgumentExpression.text; + } + if (indexArgumentExpression.kind === 173 || indexArgumentExpression.kind === 172) { + var value = getConstantValue(indexArgumentExpression); + if (value !== undefined) { + return value.toString(); + } + } + if (checkThatExpressionIsProperSymbolReference(indexArgumentExpression, indexArgumentType, false)) { + var rightHandSideName = indexArgumentExpression.name.text; + return ts.getPropertyNameForKnownSymbolName(rightHandSideName); + } + return undefined; + } + function checkThatExpressionIsProperSymbolReference(expression, expressionType, reportError) { + if (expressionType === unknownType) { + return false; + } + if (!ts.isWellKnownSymbolSyntactically(expression)) { + return false; + } + if ((expressionType.flags & 16777216) === 0) { + if (reportError) { + error(expression, ts.Diagnostics.A_computed_property_name_of_the_form_0_must_be_of_type_symbol, ts.getTextOfNode(expression)); + } + return false; + } + var leftHandSide = expression.expression; + var leftHandSideSymbol = getResolvedSymbol(leftHandSide); + if (!leftHandSideSymbol) { + return false; + } + var globalESSymbol = getGlobalESSymbolConstructorSymbol(); + if (!globalESSymbol) { + return false; + } + if (leftHandSideSymbol !== globalESSymbol) { + if (reportError) { + error(leftHandSide, ts.Diagnostics.Symbol_reference_does_not_refer_to_the_global_Symbol_constructor_object); + } + return false; + } + return true; + } + function resolveUntypedCall(node) { + if (node.kind === 176) { + checkExpression(node.template); + } + else if (node.kind !== 143) { + ts.forEach(node.arguments, function (argument) { + checkExpression(argument); + }); + } + return anySignature; + } + function resolveErrorCall(node) { + resolveUntypedCall(node); + return unknownSignature; + } + function reorderCandidates(signatures, result) { + var lastParent; + var lastSymbol; + var cutoffIndex = 0; + var index; + var specializedIndex = -1; + var spliceIndex; + ts.Debug.assert(!result.length); + for (var _i = 0, signatures_2 = signatures; _i < signatures_2.length; _i++) { + var signature = signatures_2[_i]; + var symbol = signature.declaration && getSymbolOfNode(signature.declaration); + var parent_9 = signature.declaration && signature.declaration.parent; + if (!lastSymbol || symbol === lastSymbol) { + if (lastParent && parent_9 === lastParent) { + index++; + } + else { + lastParent = parent_9; + index = cutoffIndex; + } + } + else { + index = cutoffIndex = result.length; + lastParent = parent_9; + } + lastSymbol = symbol; + if (signature.hasStringLiterals) { + specializedIndex++; + spliceIndex = specializedIndex; + cutoffIndex++; + } + else { + spliceIndex = index; + } + result.splice(spliceIndex, 0, signature); + } + } + function getSpreadArgumentIndex(args) { + for (var i = 0; i < args.length; i++) { + var arg = args[i]; + if (arg && arg.kind === 191) { + return i; + } + } + return -1; + } + function hasCorrectArity(node, args, signature) { + var adjustedArgCount; + var typeArguments; + var callIsIncomplete; + var isDecorator; + var spreadArgIndex = -1; + if (node.kind === 176) { + var tagExpression = node; + adjustedArgCount = args.length; + typeArguments = undefined; + if (tagExpression.template.kind === 189) { + var templateExpression = tagExpression.template; + var lastSpan = ts.lastOrUndefined(templateExpression.templateSpans); + ts.Debug.assert(lastSpan !== undefined); + callIsIncomplete = ts.nodeIsMissing(lastSpan.literal) || !!lastSpan.literal.isUnterminated; + } + else { + var templateLiteral = tagExpression.template; + ts.Debug.assert(templateLiteral.kind === 11); + callIsIncomplete = !!templateLiteral.isUnterminated; + } + } + else if (node.kind === 143) { + isDecorator = true; + typeArguments = undefined; + adjustedArgCount = getEffectiveArgumentCount(node, undefined, signature); + } + else { + var callExpression = node; + if (!callExpression.arguments) { + ts.Debug.assert(callExpression.kind === 175); + return signature.minArgumentCount === 0; + } + adjustedArgCount = callExpression.arguments.hasTrailingComma ? args.length + 1 : args.length; + callIsIncomplete = callExpression.arguments.end === callExpression.end; + typeArguments = callExpression.typeArguments; + spreadArgIndex = getSpreadArgumentIndex(args); + } + var hasRightNumberOfTypeArgs = !typeArguments || + (signature.typeParameters && typeArguments.length === signature.typeParameters.length); + if (!hasRightNumberOfTypeArgs) { + return false; + } + if (spreadArgIndex >= 0) { + return isRestParameterIndex(signature, spreadArgIndex); + } + if (!signature.hasRestParameter && adjustedArgCount > signature.parameters.length) { + return false; + } + var hasEnoughArguments = adjustedArgCount >= signature.minArgumentCount; + return callIsIncomplete || hasEnoughArguments; + } + function getSingleCallSignature(type) { + if (type.flags & 80896) { + var resolved = resolveStructuredTypeMembers(type); + if (resolved.callSignatures.length === 1 && resolved.constructSignatures.length === 0 && + resolved.properties.length === 0 && !resolved.stringIndexInfo && !resolved.numberIndexInfo) { + return resolved.callSignatures[0]; + } + } + return undefined; + } + function instantiateSignatureInContextOf(signature, contextualSignature, contextualMapper) { + var context = createInferenceContext(signature.typeParameters, true); + forEachMatchingParameterType(contextualSignature, signature, function (source, target) { + inferTypes(context, instantiateType(source, contextualMapper), target); + }); + return getSignatureInstantiation(signature, getInferredTypes(context)); + } + function inferTypeArguments(node, signature, args, excludeArgument, context) { + var typeParameters = signature.typeParameters; + var inferenceMapper = getInferenceMapper(context); + for (var i = 0; i < typeParameters.length; i++) { + if (!context.inferences[i].isFixed) { + context.inferredTypes[i] = undefined; + } + } + if (context.failedTypeParameterIndex !== undefined && !context.inferences[context.failedTypeParameterIndex].isFixed) { + context.failedTypeParameterIndex = undefined; + } + if (signature.thisType) { + var thisArgumentNode = getThisArgumentOfCall(node); + var thisArgumentType = thisArgumentNode ? checkExpression(thisArgumentNode) : voidType; + inferTypes(context, thisArgumentType, signature.thisType); + } + var argCount = getEffectiveArgumentCount(node, args, signature); + for (var i = 0; i < argCount; i++) { + var arg = getEffectiveArgument(node, args, i); + if (arg === undefined || arg.kind !== 193) { + var paramType = getTypeAtPosition(signature, i); + var argType = getEffectiveArgumentType(node, i, arg); + if (argType === undefined) { + var mapper = excludeArgument && excludeArgument[i] !== undefined ? identityMapper : inferenceMapper; + argType = checkExpressionWithContextualType(arg, paramType, mapper); + } + inferTypes(context, argType, paramType); + } + } + if (excludeArgument) { + for (var i = 0; i < argCount; i++) { + if (excludeArgument[i] === false) { + var arg = args[i]; + var paramType = getTypeAtPosition(signature, i); + inferTypes(context, checkExpressionWithContextualType(arg, paramType, inferenceMapper), paramType); + } + } + } + getInferredTypes(context); + } + function checkTypeArguments(signature, typeArgumentNodes, typeArgumentTypes, reportErrors, headMessage) { + var typeParameters = signature.typeParameters; + var typeArgumentsAreAssignable = true; + var mapper; + for (var i = 0; i < typeParameters.length; i++) { + if (typeArgumentsAreAssignable) { + var constraint = getConstraintOfTypeParameter(typeParameters[i]); + if (constraint) { + var errorInfo = void 0; + var typeArgumentHeadMessage = ts.Diagnostics.Type_0_does_not_satisfy_the_constraint_1; + if (reportErrors && headMessage) { + errorInfo = ts.chainDiagnosticMessages(errorInfo, typeArgumentHeadMessage); + typeArgumentHeadMessage = headMessage; + } + if (!mapper) { + mapper = createTypeMapper(typeParameters, typeArgumentTypes); + } + var typeArgument = typeArgumentTypes[i]; + typeArgumentsAreAssignable = checkTypeAssignableTo(typeArgument, getTypeWithThisArgument(instantiateType(constraint, mapper), typeArgument), reportErrors ? typeArgumentNodes[i] : undefined, typeArgumentHeadMessage, errorInfo); + } + } + } + return typeArgumentsAreAssignable; + } + function checkApplicableSignature(node, args, signature, relation, excludeArgument, reportErrors) { + if (signature.thisType && signature.thisType !== voidType && node.kind !== 175) { + var thisArgumentNode = getThisArgumentOfCall(node); + var thisArgumentType = thisArgumentNode ? checkExpression(thisArgumentNode) : voidType; + var errorNode = reportErrors ? (thisArgumentNode || node) : undefined; + var headMessage_1 = ts.Diagnostics.The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1; + if (!checkTypeRelatedTo(thisArgumentType, signature.thisType, relation, errorNode, headMessage_1)) { + return false; + } + } + var headMessage = ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1; + var argCount = getEffectiveArgumentCount(node, args, signature); + for (var i = 0; i < argCount; i++) { + var arg = getEffectiveArgument(node, args, i); + if (arg === undefined || arg.kind !== 193) { + var paramType = getTypeAtPosition(signature, i); + var argType = getEffectiveArgumentType(node, i, arg); + if (argType === undefined) { + argType = arg.kind === 9 && !reportErrors + ? getStringLiteralTypeForText(arg.text) + : checkExpressionWithContextualType(arg, paramType, excludeArgument && excludeArgument[i] ? identityMapper : undefined); + } + var errorNode = reportErrors ? getEffectiveArgumentErrorNode(node, i, arg) : undefined; + if (!checkTypeRelatedTo(argType, paramType, relation, errorNode, headMessage)) { + return false; + } + } + } + return true; + } + function getThisArgumentOfCall(node) { + if (node.kind === 174) { + var callee = node.expression; + if (callee.kind === 172) { + return callee.expression; + } + else if (callee.kind === 173) { + return callee.expression; + } + } + } + function getEffectiveCallArguments(node) { + var args; + if (node.kind === 176) { + var template = node.template; + args = [undefined]; + if (template.kind === 189) { + ts.forEach(template.templateSpans, function (span) { + args.push(span.expression); + }); + } + } + else if (node.kind === 143) { + return undefined; + } + else { + args = node.arguments || emptyArray; + } + return args; + } + function getEffectiveArgumentCount(node, args, signature) { + if (node.kind === 143) { + switch (node.parent.kind) { + case 221: + case 192: + return 1; + case 145: + return 2; + case 147: + case 149: + case 150: + if (languageVersion === 0) { + return 2; + } + return signature.parameters.length >= 3 ? 3 : 2; + case 142: + return 3; + } + } + else { + return args.length; + } + } + function getEffectiveDecoratorFirstArgumentType(node) { + if (node.kind === 221) { + var classSymbol = getSymbolOfNode(node); + return getTypeOfSymbol(classSymbol); + } + if (node.kind === 142) { + node = node.parent; + if (node.kind === 148) { + var classSymbol = getSymbolOfNode(node); + return getTypeOfSymbol(classSymbol); + } + } + if (node.kind === 145 || + node.kind === 147 || + node.kind === 149 || + node.kind === 150) { + return getParentTypeOfClassElement(node); + } + ts.Debug.fail("Unsupported decorator target."); + return unknownType; + } + function getEffectiveDecoratorSecondArgumentType(node) { + if (node.kind === 221) { + ts.Debug.fail("Class decorators should not have a second synthetic argument."); + return unknownType; + } + if (node.kind === 142) { + node = node.parent; + if (node.kind === 148) { + return anyType; + } + } + if (node.kind === 145 || + node.kind === 147 || + node.kind === 149 || + node.kind === 150) { + var element = node; + switch (element.name.kind) { + case 69: + case 8: + case 9: + return getStringLiteralTypeForText(element.name.text); + case 140: + var nameType = checkComputedPropertyName(element.name); + if (isTypeOfKind(nameType, 16777216)) { + return nameType; + } + else { + return stringType; + } + default: + ts.Debug.fail("Unsupported property name."); + return unknownType; + } + } + ts.Debug.fail("Unsupported decorator target."); + return unknownType; + } + function getEffectiveDecoratorThirdArgumentType(node) { + if (node.kind === 221) { + ts.Debug.fail("Class decorators should not have a third synthetic argument."); + return unknownType; + } + if (node.kind === 142) { + return numberType; + } + if (node.kind === 145) { + ts.Debug.fail("Property decorators should not have a third synthetic argument."); + return unknownType; + } + if (node.kind === 147 || + node.kind === 149 || + node.kind === 150) { + var propertyType = getTypeOfNode(node); + return createTypedPropertyDescriptorType(propertyType); + } + ts.Debug.fail("Unsupported decorator target."); + return unknownType; + } + function getEffectiveDecoratorArgumentType(node, argIndex) { + if (argIndex === 0) { + return getEffectiveDecoratorFirstArgumentType(node.parent); + } + else if (argIndex === 1) { + return getEffectiveDecoratorSecondArgumentType(node.parent); + } + else if (argIndex === 2) { + return getEffectiveDecoratorThirdArgumentType(node.parent); + } + ts.Debug.fail("Decorators should not have a fourth synthetic argument."); + return unknownType; + } + function getEffectiveArgumentType(node, argIndex, arg) { + if (node.kind === 143) { + return getEffectiveDecoratorArgumentType(node, argIndex); + } + else if (argIndex === 0 && node.kind === 176) { + return getGlobalTemplateStringsArrayType(); + } + return undefined; + } + function getEffectiveArgument(node, args, argIndex) { + if (node.kind === 143 || + (argIndex === 0 && node.kind === 176)) { + return undefined; + } + return args[argIndex]; + } + function getEffectiveArgumentErrorNode(node, argIndex, arg) { + if (node.kind === 143) { + return node.expression; + } + else if (argIndex === 0 && node.kind === 176) { + return node.template; + } + else { + return arg; + } + } + function resolveCall(node, signatures, candidatesOutArray, headMessage) { + var isTaggedTemplate = node.kind === 176; + var isDecorator = node.kind === 143; + var typeArguments; + if (!isTaggedTemplate && !isDecorator) { + typeArguments = node.typeArguments; + if (node.expression.kind !== 95) { + ts.forEach(typeArguments, checkSourceElement); + } + } + var candidates = candidatesOutArray || []; + reorderCandidates(signatures, candidates); + if (!candidates.length) { + reportError(ts.Diagnostics.Supplied_parameters_do_not_match_any_signature_of_call_target); + return resolveErrorCall(node); + } + var args = getEffectiveCallArguments(node); + var excludeArgument; + if (!isDecorator) { + for (var i = isTaggedTemplate ? 1 : 0; i < args.length; i++) { + if (isContextSensitive(args[i])) { + if (!excludeArgument) { + excludeArgument = new Array(args.length); + } + excludeArgument[i] = true; + } + } + } + var candidateForArgumentError; + var candidateForTypeArgumentError; + var resultOfFailedInference; + var result; + if (candidates.length > 1) { + result = chooseOverload(candidates, subtypeRelation); + } + if (!result) { + candidateForArgumentError = undefined; + candidateForTypeArgumentError = undefined; + resultOfFailedInference = undefined; + result = chooseOverload(candidates, assignableRelation); + } + if (result) { + return result; + } + if (candidateForArgumentError) { + checkApplicableSignature(node, args, candidateForArgumentError, assignableRelation, undefined, true); + } + else if (candidateForTypeArgumentError) { + if (!isTaggedTemplate && !isDecorator && typeArguments) { + var typeArguments_2 = node.typeArguments; + checkTypeArguments(candidateForTypeArgumentError, typeArguments_2, ts.map(typeArguments_2, getTypeFromTypeNode), true, headMessage); + } + else { + ts.Debug.assert(resultOfFailedInference.failedTypeParameterIndex >= 0); + var failedTypeParameter = candidateForTypeArgumentError.typeParameters[resultOfFailedInference.failedTypeParameterIndex]; + var inferenceCandidates = getInferenceCandidates(resultOfFailedInference, resultOfFailedInference.failedTypeParameterIndex); + var diagnosticChainHead = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly, typeToString(failedTypeParameter)); + if (headMessage) { + diagnosticChainHead = ts.chainDiagnosticMessages(diagnosticChainHead, headMessage); + } + reportNoCommonSupertypeError(inferenceCandidates, node.expression || node.tag, diagnosticChainHead); + } + } + else { + reportError(ts.Diagnostics.Supplied_parameters_do_not_match_any_signature_of_call_target); + } + if (!produceDiagnostics) { + for (var _i = 0, candidates_1 = candidates; _i < candidates_1.length; _i++) { + var candidate = candidates_1[_i]; + if (hasCorrectArity(node, args, candidate)) { + if (candidate.typeParameters && typeArguments) { + candidate = getSignatureInstantiation(candidate, ts.map(typeArguments, getTypeFromTypeNode)); + } + return candidate; + } + } + } + return resolveErrorCall(node); + function reportError(message, arg0, arg1, arg2) { + var errorInfo; + errorInfo = ts.chainDiagnosticMessages(errorInfo, message, arg0, arg1, arg2); + if (headMessage) { + errorInfo = ts.chainDiagnosticMessages(errorInfo, headMessage); + } + diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(node, errorInfo)); + } + function chooseOverload(candidates, relation) { + for (var _i = 0, candidates_2 = candidates; _i < candidates_2.length; _i++) { + var originalCandidate = candidates_2[_i]; + if (!hasCorrectArity(node, args, originalCandidate)) { + continue; + } + var candidate = void 0; + var typeArgumentsAreValid = void 0; + var inferenceContext = originalCandidate.typeParameters + ? createInferenceContext(originalCandidate.typeParameters, false) + : undefined; + while (true) { + candidate = originalCandidate; + if (candidate.typeParameters) { + var typeArgumentTypes = void 0; + if (typeArguments) { + typeArgumentTypes = ts.map(typeArguments, getTypeFromTypeNode); + typeArgumentsAreValid = checkTypeArguments(candidate, typeArguments, typeArgumentTypes, false); + } + else { + inferTypeArguments(node, candidate, args, excludeArgument, inferenceContext); + typeArgumentsAreValid = inferenceContext.failedTypeParameterIndex === undefined; + typeArgumentTypes = inferenceContext.inferredTypes; + } + if (!typeArgumentsAreValid) { + break; + } + candidate = getSignatureInstantiation(candidate, typeArgumentTypes); + } + if (!checkApplicableSignature(node, args, candidate, relation, excludeArgument, false)) { + break; + } + var index = excludeArgument ? ts.indexOf(excludeArgument, true) : -1; + if (index < 0) { + return candidate; + } + excludeArgument[index] = false; + } + if (originalCandidate.typeParameters) { + var instantiatedCandidate = candidate; + if (typeArgumentsAreValid) { + candidateForArgumentError = instantiatedCandidate; + } + else { + candidateForTypeArgumentError = originalCandidate; + if (!typeArguments) { + resultOfFailedInference = inferenceContext; + } + } + } + else { + ts.Debug.assert(originalCandidate === candidate); + candidateForArgumentError = originalCandidate; + } + } + return undefined; + } + } + function resolveCallExpression(node, candidatesOutArray) { + if (node.expression.kind === 95) { + var superType = checkSuperExpression(node.expression); + if (superType !== unknownType) { + var baseTypeNode = ts.getClassExtendsHeritageClauseElement(ts.getContainingClass(node)); + if (baseTypeNode) { + var baseConstructors = getInstantiatedConstructorsForTypeArguments(superType, baseTypeNode.typeArguments); + return resolveCall(node, baseConstructors, candidatesOutArray); + } + } + return resolveUntypedCall(node); + } + var funcType = checkNonNullExpression(node.expression); + var apparentType = getApparentType(funcType); + if (apparentType === unknownType) { + return resolveErrorCall(node); + } + var callSignatures = getSignaturesOfType(apparentType, 0); + var constructSignatures = getSignaturesOfType(apparentType, 1); + if (isTypeAny(funcType) || (!callSignatures.length && !constructSignatures.length && !(funcType.flags & 16384) && isTypeAssignableTo(funcType, globalFunctionType))) { + if (funcType !== unknownType && node.typeArguments) { + error(node, ts.Diagnostics.Untyped_function_calls_may_not_accept_type_arguments); + } + return resolveUntypedCall(node); + } + if (!callSignatures.length) { + if (constructSignatures.length) { + error(node, ts.Diagnostics.Value_of_type_0_is_not_callable_Did_you_mean_to_include_new, typeToString(funcType)); + } + else { + error(node, ts.Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature); + } + return resolveErrorCall(node); + } + return resolveCall(node, callSignatures, candidatesOutArray); + } + function resolveNewExpression(node, candidatesOutArray) { + if (node.arguments && languageVersion < 1) { + var spreadIndex = getSpreadArgumentIndex(node.arguments); + if (spreadIndex >= 0) { + error(node.arguments[spreadIndex], ts.Diagnostics.Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_5_and_higher); + } + } + var expressionType = checkNonNullExpression(node.expression); + expressionType = getApparentType(expressionType); + if (expressionType === unknownType) { + return resolveErrorCall(node); + } + var valueDecl = expressionType.symbol && getClassLikeDeclarationOfSymbol(expressionType.symbol); + if (valueDecl && valueDecl.flags & 128) { + error(node, ts.Diagnostics.Cannot_create_an_instance_of_the_abstract_class_0, ts.declarationNameToString(valueDecl.name)); + return resolveErrorCall(node); + } + if (isTypeAny(expressionType)) { + if (node.typeArguments) { + error(node, ts.Diagnostics.Untyped_function_calls_may_not_accept_type_arguments); + } + return resolveUntypedCall(node); + } + var constructSignatures = getSignaturesOfType(expressionType, 1); + if (constructSignatures.length) { + if (!isConstructorAccessible(node, constructSignatures[0])) { + return resolveErrorCall(node); + } + return resolveCall(node, constructSignatures, candidatesOutArray); + } + var callSignatures = getSignaturesOfType(expressionType, 0); + if (callSignatures.length) { + var signature = resolveCall(node, callSignatures, candidatesOutArray); + if (getReturnTypeOfSignature(signature) !== voidType) { + error(node, ts.Diagnostics.Only_a_void_function_can_be_called_with_the_new_keyword); + } + if (signature.thisType === voidType) { + error(node, ts.Diagnostics.A_function_that_is_called_with_the_new_keyword_cannot_have_a_this_type_that_is_void); + } + return signature; + } + error(node, ts.Diagnostics.Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature); + return resolveErrorCall(node); + } + function isConstructorAccessible(node, signature) { + if (!signature || !signature.declaration) { + return true; + } + var declaration = signature.declaration; + var flags = declaration.flags; + if (!(flags & (8 | 16))) { + return true; + } + var declaringClassDeclaration = getClassLikeDeclarationOfSymbol(declaration.parent.symbol); + var declaringClass = getDeclaredTypeOfSymbol(declaration.parent.symbol); + if (!isNodeWithinClass(node, declaringClassDeclaration)) { + if (flags & 8) { + error(node, ts.Diagnostics.Constructor_of_class_0_is_private_and_only_accessible_within_the_class_declaration, typeToString(declaringClass)); + } + if (flags & 16) { + error(node, ts.Diagnostics.Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration, typeToString(declaringClass)); + } + return false; + } + return true; + } + function resolveTaggedTemplateExpression(node, candidatesOutArray) { + var tagType = checkExpression(node.tag); + var apparentType = getApparentType(tagType); + if (apparentType === unknownType) { + return resolveErrorCall(node); + } + var callSignatures = getSignaturesOfType(apparentType, 0); + if (isTypeAny(tagType) || (!callSignatures.length && !(tagType.flags & 16384) && isTypeAssignableTo(tagType, globalFunctionType))) { + return resolveUntypedCall(node); + } + if (!callSignatures.length) { + error(node, ts.Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature); + return resolveErrorCall(node); + } + return resolveCall(node, callSignatures, candidatesOutArray); + } + function getDiagnosticHeadMessageForDecoratorResolution(node) { + switch (node.parent.kind) { + case 221: + case 192: + return ts.Diagnostics.Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression; + case 142: + return ts.Diagnostics.Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression; + case 145: + return ts.Diagnostics.Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression; + case 147: + case 149: + case 150: + return ts.Diagnostics.Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression; + } + } + function resolveDecorator(node, candidatesOutArray) { + var funcType = checkExpression(node.expression); + var apparentType = getApparentType(funcType); + if (apparentType === unknownType) { + return resolveErrorCall(node); + } + var callSignatures = getSignaturesOfType(apparentType, 0); + if (funcType === anyType || (!callSignatures.length && !(funcType.flags & 16384) && isTypeAssignableTo(funcType, globalFunctionType))) { + return resolveUntypedCall(node); + } + var headMessage = getDiagnosticHeadMessageForDecoratorResolution(node); + if (!callSignatures.length) { + var errorInfo = void 0; + errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature); + errorInfo = ts.chainDiagnosticMessages(errorInfo, headMessage); + diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(node, errorInfo)); + return resolveErrorCall(node); + } + return resolveCall(node, callSignatures, candidatesOutArray, headMessage); + } + function resolveSignature(node, candidatesOutArray) { + switch (node.kind) { + case 174: + return resolveCallExpression(node, candidatesOutArray); + case 175: + return resolveNewExpression(node, candidatesOutArray); + case 176: + return resolveTaggedTemplateExpression(node, candidatesOutArray); + case 143: + return resolveDecorator(node, candidatesOutArray); + } + ts.Debug.fail("Branch in 'resolveSignature' should be unreachable."); + } + function getResolvedSignature(node, candidatesOutArray) { + var links = getNodeLinks(node); + var cached = links.resolvedSignature; + if (cached && cached !== anySignature && !candidatesOutArray) { + return cached; + } + links.resolvedSignature = anySignature; + var result = resolveSignature(node, candidatesOutArray); + links.resolvedSignature = flowLoopStart === flowLoopCount ? result : cached; + return result; + } + function getResolvedOrAnySignature(node) { + return getNodeLinks(node).resolvedSignature === anySignature ? anySignature : getResolvedSignature(node); + } + function getInferredClassType(symbol) { + var links = getSymbolLinks(symbol); + if (!links.inferredClassType) { + links.inferredClassType = createAnonymousType(undefined, symbol.members, emptyArray, emptyArray, undefined, undefined); + } + return links.inferredClassType; + } + function checkCallExpression(node) { + checkGrammarTypeArguments(node, node.typeArguments) || checkGrammarArguments(node, node.arguments); + var signature = getResolvedSignature(node); + if (node.expression.kind === 95) { + return voidType; + } + if (node.kind === 175) { + var declaration = signature.declaration; + if (declaration && + declaration.kind !== 148 && + declaration.kind !== 152 && + declaration.kind !== 157 && + !ts.isJSDocConstructSignature(declaration)) { + var funcSymbol = checkExpression(node.expression).symbol; + if (funcSymbol && funcSymbol.members && (funcSymbol.flags & 16)) { + return getInferredClassType(funcSymbol); + } + else if (compilerOptions.noImplicitAny) { + error(node, ts.Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type); + } + return anyType; + } + } + if (ts.isInJavaScriptFile(node) && ts.isRequireCall(node, true)) { + return resolveExternalModuleTypeByLiteral(node.arguments[0]); + } + return getReturnTypeOfSignature(signature); + } + function checkTaggedTemplateExpression(node) { + return getReturnTypeOfSignature(getResolvedSignature(node)); + } + function checkAssertion(node) { + var exprType = getRegularTypeOfObjectLiteral(checkExpression(node.expression)); + var targetType = getTypeFromTypeNode(node.type); + if (produceDiagnostics && targetType !== unknownType) { + var widenedType = getWidenedType(exprType); + if (!isTypeComparableTo(targetType, widenedType)) { + checkTypeComparableTo(exprType, targetType, node, ts.Diagnostics.Type_0_cannot_be_converted_to_type_1); + } + } + return targetType; + } + function checkNonNullAssertion(node) { + return getNonNullableType(checkExpression(node.expression)); + } + function getTypeOfParameter(symbol) { + var type = getTypeOfSymbol(symbol); + if (strictNullChecks) { + var declaration = symbol.valueDeclaration; + if (declaration && declaration.initializer) { + return addNullableKind(type, 32); + } + } + return type; + } + function getTypeAtPosition(signature, pos) { + return signature.hasRestParameter ? + pos < signature.parameters.length - 1 ? getTypeOfParameter(signature.parameters[pos]) : getRestTypeOfSignature(signature) : + pos < signature.parameters.length ? getTypeOfParameter(signature.parameters[pos]) : anyType; + } + function assignContextualParameterTypes(signature, context, mapper) { + var len = signature.parameters.length - (signature.hasRestParameter ? 1 : 0); + for (var i = 0; i < len; i++) { + var parameter = signature.parameters[i]; + var contextualParameterType = getTypeAtPosition(context, i); + assignTypeToParameterAndFixTypeParameters(parameter, contextualParameterType, mapper); + } + if (signature.hasRestParameter && isRestParameterIndex(context, signature.parameters.length - 1)) { + var parameter = ts.lastOrUndefined(signature.parameters); + var contextualParameterType = getTypeOfSymbol(ts.lastOrUndefined(context.parameters)); + assignTypeToParameterAndFixTypeParameters(parameter, contextualParameterType, mapper); + } + } + function assignBindingElementTypes(node) { + if (ts.isBindingPattern(node.name)) { + for (var _i = 0, _a = node.name.elements; _i < _a.length; _i++) { + var element = _a[_i]; + if (element.kind !== 193) { + if (element.name.kind === 69) { + getSymbolLinks(getSymbolOfNode(element)).type = getTypeForBindingElement(element); + } + assignBindingElementTypes(element); + } + } + } + } + function assignTypeToParameterAndFixTypeParameters(parameter, contextualType, mapper) { + var links = getSymbolLinks(parameter); + if (!links.type) { + links.type = instantiateType(contextualType, mapper); + if (links.type === emptyObjectType && + (parameter.valueDeclaration.name.kind === 167 || + parameter.valueDeclaration.name.kind === 168)) { + links.type = getTypeFromBindingPattern(parameter.valueDeclaration.name); + } + assignBindingElementTypes(parameter.valueDeclaration); + } + else if (isInferentialContext(mapper)) { + inferTypes(mapper.context, links.type, instantiateType(contextualType, mapper)); + } + } + function getReturnTypeFromJSDocComment(func) { + var returnTag = ts.getJSDocReturnTag(func); + if (returnTag && returnTag.typeExpression) { + return getTypeFromTypeNode(returnTag.typeExpression.type); + } + return undefined; + } + function createPromiseType(promisedType) { + var globalPromiseType = getGlobalPromiseType(); + if (globalPromiseType !== emptyGenericType) { + promisedType = getAwaitedType(promisedType); + return createTypeReference(globalPromiseType, [promisedType]); + } + return emptyObjectType; + } + function getReturnTypeFromBody(func, contextualMapper) { + var contextualSignature = getContextualSignatureForFunctionLikeDeclaration(func); + if (!func.body) { + return unknownType; + } + var isAsync = ts.isAsyncFunctionLike(func); + var type; + if (func.body.kind !== 199) { + type = checkExpressionCached(func.body, contextualMapper); + if (isAsync) { + type = checkAwaitedType(type, func, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member); + } + } + else { + var types = void 0; + var funcIsGenerator = !!func.asteriskToken; + if (funcIsGenerator) { + types = checkAndAggregateYieldOperandTypes(func.body, contextualMapper); + if (types.length === 0) { + var iterableIteratorAny = createIterableIteratorType(anyType); + if (compilerOptions.noImplicitAny) { + error(func.asteriskToken, ts.Diagnostics.Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_type, typeToString(iterableIteratorAny)); + } + return iterableIteratorAny; + } + } + else { + var hasImplicitReturn = !!(func.flags & 32768); + types = checkAndAggregateReturnExpressionTypes(func.body, contextualMapper, isAsync, hasImplicitReturn); + if (!types) { + return neverType; + } + if (types.length === 0) { + if (isAsync) { + var promiseType = createPromiseType(voidType); + if (promiseType === emptyObjectType) { + error(func, ts.Diagnostics.An_async_function_or_method_must_have_a_valid_awaitable_return_type); + return unknownType; + } + return promiseType; + } + return voidType; + } + } + type = contextualSignature ? getUnionType(types) : getCommonSupertype(types); + if (!type) { + if (funcIsGenerator) { + error(func, ts.Diagnostics.No_best_common_type_exists_among_yield_expressions); + return createIterableIteratorType(unknownType); + } + else { + error(func, ts.Diagnostics.No_best_common_type_exists_among_return_expressions); + return getUnionType(types); + } + } + if (funcIsGenerator) { + type = createIterableIteratorType(type); + } + } + if (!contextualSignature) { + reportErrorsFromWidening(func, type); + } + var widenedType = getWidenedType(type); + if (isAsync) { + var promiseType = createPromiseType(widenedType); + if (promiseType === emptyObjectType) { + error(func, ts.Diagnostics.An_async_function_or_method_must_have_a_valid_awaitable_return_type); + return unknownType; + } + return promiseType; + } + else { + return widenedType; + } + } + function checkAndAggregateYieldOperandTypes(body, contextualMapper) { + var aggregatedTypes = []; + ts.forEachYieldExpression(body, function (yieldExpression) { + var expr = yieldExpression.expression; + if (expr) { + var type = checkExpressionCached(expr, contextualMapper); + if (yieldExpression.asteriskToken) { + type = checkElementTypeOfIterable(type, yieldExpression.expression); + } + if (!ts.contains(aggregatedTypes, type)) { + aggregatedTypes.push(type); + } + } + }); + return aggregatedTypes; + } + function checkAndAggregateReturnExpressionTypes(body, contextualMapper, isAsync, hasImplicitReturn) { + var aggregatedTypes = []; + var hasOmittedExpressions = false; + ts.forEachReturnStatement(body, function (returnStatement) { + var expr = returnStatement.expression; + if (expr) { + var type = checkExpressionCached(expr, contextualMapper); + if (isAsync) { + type = checkAwaitedType(type, body.parent, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member); + } + if (type !== neverType && !ts.contains(aggregatedTypes, type)) { + aggregatedTypes.push(type); + } + } + else { + hasOmittedExpressions = true; + } + }); + if (aggregatedTypes.length === 0 && !hasOmittedExpressions && !hasImplicitReturn) { + return undefined; + } + if (strictNullChecks && aggregatedTypes.length && (hasOmittedExpressions || hasImplicitReturn)) { + if (!ts.contains(aggregatedTypes, undefinedType)) { + aggregatedTypes.push(undefinedType); + } + } + return aggregatedTypes; + } + function checkAllCodePathsInNonVoidFunctionReturnOrThrow(func, returnType) { + if (!produceDiagnostics) { + return; + } + if (returnType && maybeTypeOfKind(returnType, 1 | 16)) { + return; + } + if (ts.nodeIsMissing(func.body) || func.body.kind !== 199 || !(func.flags & 32768)) { + return; + } + var hasExplicitReturn = func.flags & 65536; + if (returnType === neverType) { + error(func.type, ts.Diagnostics.A_function_returning_never_cannot_have_a_reachable_end_point); + } + else if (returnType && !hasExplicitReturn) { + error(func.type, ts.Diagnostics.A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value); + } + else if (returnType && strictNullChecks && !isTypeAssignableTo(undefinedType, returnType)) { + error(func.type, ts.Diagnostics.Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined); + } + else if (compilerOptions.noImplicitReturns) { + if (!returnType) { + if (!hasExplicitReturn) { + return; + } + var inferredReturnType = getReturnTypeOfSignature(getSignatureFromDeclaration(func)); + if (isUnwrappedReturnTypeVoidOrAny(func, inferredReturnType)) { + return; + } + } + error(func.type || func, ts.Diagnostics.Not_all_code_paths_return_a_value); + } + } + function checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper) { + ts.Debug.assert(node.kind !== 147 || ts.isObjectLiteralMethod(node)); + var hasGrammarError = checkGrammarFunctionLikeDeclaration(node); + if (!hasGrammarError && node.kind === 179) { + checkGrammarForGenerator(node); + } + if (contextualMapper === identityMapper && isContextSensitive(node)) { + checkNodeDeferred(node); + return anyFunctionType; + } + var links = getNodeLinks(node); + var type = getTypeOfSymbol(node.symbol); + var contextSensitive = isContextSensitive(node); + var mightFixTypeParameters = contextSensitive && isInferentialContext(contextualMapper); + if (mightFixTypeParameters || !(links.flags & 1024)) { + var contextualSignature = getContextualSignature(node); + var contextChecked = !!(links.flags & 1024); + if (mightFixTypeParameters || !contextChecked) { + links.flags |= 1024; + if (contextualSignature) { + var signature = getSignaturesOfType(type, 0)[0]; + if (contextSensitive) { + assignContextualParameterTypes(signature, contextualSignature, contextualMapper || identityMapper); + } + if (mightFixTypeParameters || !node.type && !signature.resolvedReturnType) { + var returnType = getReturnTypeFromBody(node, contextualMapper); + if (!signature.resolvedReturnType) { + signature.resolvedReturnType = returnType; + } + } + } + if (!contextChecked) { + checkSignatureDeclaration(node); + checkNodeDeferred(node); + } + } + } + if (produceDiagnostics && node.kind !== 147 && node.kind !== 146) { + checkCollisionWithCapturedSuperVariable(node, node.name); + checkCollisionWithCapturedThisVariable(node, node.name); + } + return type; + } + function checkFunctionExpressionOrObjectLiteralMethodDeferred(node) { + ts.Debug.assert(node.kind !== 147 || ts.isObjectLiteralMethod(node)); + var isAsync = ts.isAsyncFunctionLike(node); + var returnOrPromisedType = node.type && (isAsync ? checkAsyncFunctionReturnType(node) : getTypeFromTypeNode(node.type)); + if (!node.asteriskToken) { + checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnOrPromisedType); + } + if (node.body) { + if (!node.type) { + getReturnTypeOfSignature(getSignatureFromDeclaration(node)); + } + if (node.body.kind === 199) { + checkSourceElement(node.body); + } + else { + var exprType = checkExpression(node.body); + if (returnOrPromisedType) { + if (isAsync) { + var awaitedType = checkAwaitedType(exprType, node.body, ts.Diagnostics.Expression_body_for_async_arrow_function_does_not_have_a_valid_callable_then_member); + checkTypeAssignableTo(awaitedType, returnOrPromisedType, node.body); + } + else { + checkTypeAssignableTo(exprType, returnOrPromisedType, node.body); + } + } + } + } + } + function checkArithmeticOperandType(operand, type, diagnostic) { + if (!isTypeAnyOrAllConstituentTypesHaveKind(type, 132)) { + error(operand, diagnostic); + return false; + } + return true; + } + function isReadonlySymbol(symbol) { + return symbol.flags & 4 && (getDeclarationFlagsFromSymbol(symbol) & 64) !== 0 || + symbol.flags & 3 && (getDeclarationFlagsFromSymbol(symbol) & 2048) !== 0 || + symbol.flags & 98304 && !(symbol.flags & 65536) || + (symbol.flags & 8) !== 0; + } + function isReferenceToReadonlyEntity(expr, symbol) { + if (isReadonlySymbol(symbol)) { + if (symbol.flags & 4 && + (expr.kind === 172 || expr.kind === 173) && + expr.expression.kind === 97) { + var func = ts.getContainingFunction(expr); + return !(func && func.kind === 148 && func.parent === symbol.valueDeclaration.parent); + } + return true; + } + return false; + } + function isReferenceThroughNamespaceImport(expr) { + if (expr.kind === 172 || expr.kind === 173) { + var node = skipParenthesizedNodes(expr.expression); + if (node.kind === 69) { + var symbol = getNodeLinks(node).resolvedSymbol; + if (symbol.flags & 8388608) { + var declaration = getDeclarationOfAliasSymbol(symbol); + return declaration && declaration.kind === 232; + } + } + } + return false; + } + function checkReferenceExpression(expr, invalidReferenceMessage, constantVariableMessage) { + var node = skipParenthesizedNodes(expr); + if (node.kind !== 69 && node.kind !== 172 && node.kind !== 173) { + error(expr, invalidReferenceMessage); + return false; + } + var links = getNodeLinks(node); + var symbol = getExportSymbolOfValueSymbolIfExported(links.resolvedSymbol); + if (symbol) { + if (symbol !== unknownSymbol && symbol !== argumentsSymbol) { + if (node.kind === 69 && !(symbol.flags & 3)) { + error(expr, invalidReferenceMessage); + return false; + } + if (isReferenceToReadonlyEntity(node, symbol) || isReferenceThroughNamespaceImport(node)) { + error(expr, constantVariableMessage); + return false; + } + } + } + else if (node.kind === 173) { + if (links.resolvedIndexInfo && links.resolvedIndexInfo.isReadonly) { + error(expr, constantVariableMessage); + return false; + } + } + return true; + } + function checkDeleteExpression(node) { + checkExpression(node.expression); + return booleanType; + } + function checkTypeOfExpression(node) { + checkExpression(node.expression); + return stringType; + } + function checkVoidExpression(node) { + checkExpression(node.expression); + return undefinedType; + } + function checkAwaitExpression(node) { + if (produceDiagnostics) { + if (!(node.flags & 33554432)) { + grammarErrorOnFirstToken(node, ts.Diagnostics.await_expression_is_only_allowed_within_an_async_function); + } + if (isInParameterInitializerBeforeContainingFunction(node)) { + error(node, ts.Diagnostics.await_expressions_cannot_be_used_in_a_parameter_initializer); + } + } + var operandType = checkExpression(node.expression); + return checkAwaitedType(operandType, node); + } + function checkPrefixUnaryExpression(node) { + var operandType = checkExpression(node.operand); + switch (node.operator) { + case 35: + case 36: + case 50: + if (maybeTypeOfKind(operandType, 16777216)) { + error(node.operand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(node.operator)); + } + return numberType; + case 49: + return booleanType; + case 41: + case 42: + var ok = checkArithmeticOperandType(node.operand, getNonNullableType(operandType), ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); + if (ok) { + checkReferenceExpression(node.operand, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant_or_a_read_only_property); + } + return numberType; + } + return unknownType; + } + function checkPostfixUnaryExpression(node) { + var operandType = checkExpression(node.operand); + var ok = checkArithmeticOperandType(node.operand, getNonNullableType(operandType), ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); + if (ok) { + checkReferenceExpression(node.operand, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant_or_a_read_only_property); + } + return numberType; + } + function maybeTypeOfKind(type, kind) { + if (type.flags & kind) { + return true; + } + if (type.flags & 49152) { + var types = type.types; + for (var _i = 0, types_10 = types; _i < types_10.length; _i++) { + var t = types_10[_i]; + if (maybeTypeOfKind(t, kind)) { + return true; + } + } + } + return false; + } + function isTypeOfKind(type, kind) { + if (type.flags & kind) { + return true; + } + if (type.flags & 16384) { + var types = type.types; + for (var _i = 0, types_11 = types; _i < types_11.length; _i++) { + var t = types_11[_i]; + if (!isTypeOfKind(t, kind)) { + return false; + } + } + return true; + } + if (type.flags & 32768) { + var types = type.types; + for (var _a = 0, types_12 = types; _a < types_12.length; _a++) { + var t = types_12[_a]; + if (isTypeOfKind(t, kind)) { + return true; + } + } + } + return false; + } + function isConstEnumObjectType(type) { + return type.flags & (80896 | 65536) && type.symbol && isConstEnumSymbol(type.symbol); + } + function isConstEnumSymbol(symbol) { + return (symbol.flags & 128) !== 0; + } + function checkInstanceOfExpression(left, right, leftType, rightType) { + if (isTypeOfKind(leftType, 16777726)) { + error(left, ts.Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); + } + if (!(isTypeAny(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) { + error(right, ts.Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type); + } + return booleanType; + } + function checkInExpression(left, right, leftType, rightType) { + if (!isTypeAnyOrAllConstituentTypesHaveKind(leftType, 258 | 132 | 16777216)) { + error(left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol); + } + if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 80896 | 512)) { + error(right, ts.Diagnostics.The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); + } + return booleanType; + } + function checkObjectLiteralAssignment(node, sourceType, contextualMapper) { + var properties = node.properties; + for (var _i = 0, properties_3 = properties; _i < properties_3.length; _i++) { + var p = properties_3[_i]; + checkObjectLiteralDestructuringPropertyAssignment(sourceType, p, contextualMapper); + } + return sourceType; + } + function checkObjectLiteralDestructuringPropertyAssignment(objectLiteralType, property, contextualMapper) { + if (property.kind === 253 || property.kind === 254) { + var name_13 = property.name; + if (name_13.kind === 140) { + checkComputedPropertyName(name_13); + } + if (isComputedNonLiteralName(name_13)) { + return undefined; + } + var text = getTextOfPropertyName(name_13); + var type = isTypeAny(objectLiteralType) + ? objectLiteralType + : getTypeOfPropertyOfType(objectLiteralType, text) || + isNumericLiteralName(text) && getIndexTypeOfType(objectLiteralType, 1) || + getIndexTypeOfType(objectLiteralType, 0); + if (type) { + if (property.kind === 254) { + return checkDestructuringAssignment(property, type); + } + else { + return checkDestructuringAssignment(property.initializer, type); + } + } + else { + error(name_13, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(objectLiteralType), ts.declarationNameToString(name_13)); + } + } + else { + error(property, ts.Diagnostics.Property_assignment_expected); + } + } + function checkArrayLiteralAssignment(node, sourceType, contextualMapper) { + var elementType = checkIteratedTypeOrElementType(sourceType, node, false) || unknownType; + var elements = node.elements; + for (var i = 0; i < elements.length; i++) { + checkArrayLiteralDestructuringElementAssignment(node, sourceType, i, elementType, contextualMapper); + } + return sourceType; + } + function checkArrayLiteralDestructuringElementAssignment(node, sourceType, elementIndex, elementType, contextualMapper) { + var elements = node.elements; + var element = elements[elementIndex]; + if (element.kind !== 193) { + if (element.kind !== 191) { + var propName = "" + elementIndex; + var type = isTypeAny(sourceType) + ? sourceType + : isTupleLikeType(sourceType) + ? getTypeOfPropertyOfType(sourceType, propName) + : elementType; + if (type) { + return checkDestructuringAssignment(element, type, contextualMapper); + } + else { + if (isTupleType(sourceType)) { + error(element, ts.Diagnostics.Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2, typeToString(sourceType), sourceType.elementTypes.length, elements.length); + } + else { + error(element, ts.Diagnostics.Type_0_has_no_property_1, typeToString(sourceType), propName); + } + } + } + else { + if (elementIndex < elements.length - 1) { + error(element, ts.Diagnostics.A_rest_element_must_be_last_in_an_array_destructuring_pattern); + } + else { + var restExpression = element.expression; + if (restExpression.kind === 187 && restExpression.operatorToken.kind === 56) { + error(restExpression.operatorToken, ts.Diagnostics.A_rest_element_cannot_have_an_initializer); + } + else { + return checkDestructuringAssignment(restExpression, createArrayType(elementType), contextualMapper); + } + } + } + } + return undefined; + } + function checkDestructuringAssignment(exprOrAssignment, sourceType, contextualMapper) { + var target; + if (exprOrAssignment.kind === 254) { + var prop = exprOrAssignment; + if (prop.objectAssignmentInitializer) { + checkBinaryLikeExpression(prop.name, prop.equalsToken, prop.objectAssignmentInitializer, contextualMapper); + } + target = exprOrAssignment.name; + } + else { + target = exprOrAssignment; + } + if (target.kind === 187 && target.operatorToken.kind === 56) { + checkBinaryExpression(target, contextualMapper); + target = target.left; + } + if (target.kind === 171) { + return checkObjectLiteralAssignment(target, sourceType, contextualMapper); + } + if (target.kind === 170) { + return checkArrayLiteralAssignment(target, sourceType, contextualMapper); + } + return checkReferenceAssignment(target, sourceType, contextualMapper); + } + function checkReferenceAssignment(target, sourceType, contextualMapper) { + var targetType = checkExpression(target, contextualMapper); + if (checkReferenceExpression(target, ts.Diagnostics.Invalid_left_hand_side_of_assignment_expression, ts.Diagnostics.Left_hand_side_of_assignment_expression_cannot_be_a_constant_or_a_read_only_property)) { + checkTypeAssignableTo(sourceType, targetType, target, undefined); + } + return sourceType; + } + function isTypeEqualityComparableTo(source, target) { + return (target.flags & 96) !== 0 || isTypeComparableTo(source, target); + } + function checkBinaryExpression(node, contextualMapper) { + return checkBinaryLikeExpression(node.left, node.operatorToken, node.right, contextualMapper, node); + } + function checkBinaryLikeExpression(left, operatorToken, right, contextualMapper, errorNode) { + var operator = operatorToken.kind; + if (operator === 56 && (left.kind === 171 || left.kind === 170)) { + return checkDestructuringAssignment(left, checkExpression(right, contextualMapper), contextualMapper); + } + var leftType = checkExpression(left, contextualMapper); + var rightType = checkExpression(right, contextualMapper); + switch (operator) { + case 37: + case 38: + case 59: + case 60: + case 39: + case 61: + case 40: + case 62: + case 36: + case 58: + case 43: + case 63: + case 44: + case 64: + case 45: + case 65: + case 47: + case 67: + case 48: + case 68: + case 46: + case 66: + if (leftType.flags & 96) + leftType = rightType; + if (rightType.flags & 96) + rightType = leftType; + leftType = getNonNullableType(leftType); + rightType = getNonNullableType(rightType); + var suggestedOperator = void 0; + if ((leftType.flags & 8) && + (rightType.flags & 8) && + (suggestedOperator = getSuggestedBooleanOperator(operatorToken.kind)) !== undefined) { + error(errorNode || operatorToken, ts.Diagnostics.The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead, ts.tokenToString(operatorToken.kind), ts.tokenToString(suggestedOperator)); + } + else { + var leftOk = checkArithmeticOperandType(left, leftType, ts.Diagnostics.The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type); + var rightOk = checkArithmeticOperandType(right, rightType, ts.Diagnostics.The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type); + if (leftOk && rightOk) { + checkAssignmentOperator(numberType); + } + } + return numberType; + case 35: + case 57: + if (leftType.flags & 96) + leftType = rightType; + if (rightType.flags & 96) + rightType = leftType; + leftType = getNonNullableType(leftType); + rightType = getNonNullableType(rightType); + var resultType = void 0; + if (isTypeOfKind(leftType, 132) && isTypeOfKind(rightType, 132)) { + resultType = numberType; + } + else { + if (isTypeOfKind(leftType, 258) || isTypeOfKind(rightType, 258)) { + resultType = stringType; + } + else if (isTypeAny(leftType) || isTypeAny(rightType)) { + resultType = leftType === unknownType || rightType === unknownType ? unknownType : anyType; + } + if (resultType && !checkForDisallowedESSymbolOperand(operator)) { + return resultType; + } + } + if (!resultType) { + reportOperatorError(); + return anyType; + } + if (operator === 57) { + checkAssignmentOperator(resultType); + } + return resultType; + case 25: + case 27: + case 28: + case 29: + if (checkForDisallowedESSymbolOperand(operator)) { + if (!isTypeComparableTo(leftType, rightType) && !isTypeComparableTo(rightType, leftType)) { + reportOperatorError(); + } + } + return booleanType; + case 30: + case 31: + case 32: + case 33: + if (!isTypeEqualityComparableTo(leftType, rightType) && !isTypeEqualityComparableTo(rightType, leftType)) { + reportOperatorError(); + } + return booleanType; + case 91: + return checkInstanceOfExpression(left, right, leftType, rightType); + case 90: + return checkInExpression(left, right, leftType, rightType); + case 51: + return addNullableKind(rightType, getNullableKind(leftType)); + case 52: + return getUnionType([getNonNullableType(leftType), rightType]); + case 56: + checkAssignmentOperator(rightType); + return getRegularTypeOfObjectLiteral(rightType); + case 24: + return rightType; + } + function checkForDisallowedESSymbolOperand(operator) { + var offendingSymbolOperand = maybeTypeOfKind(leftType, 16777216) ? left : + maybeTypeOfKind(rightType, 16777216) ? right : + undefined; + if (offendingSymbolOperand) { + error(offendingSymbolOperand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(operator)); + return false; + } + return true; + } + function getSuggestedBooleanOperator(operator) { + switch (operator) { + case 47: + case 67: + return 52; + case 48: + case 68: + return 33; + case 46: + case 66: + return 51; + default: + return undefined; + } + } + function checkAssignmentOperator(valueType) { + if (produceDiagnostics && operator >= 56 && operator <= 68) { + var ok = checkReferenceExpression(left, ts.Diagnostics.Invalid_left_hand_side_of_assignment_expression, ts.Diagnostics.Left_hand_side_of_assignment_expression_cannot_be_a_constant_or_a_read_only_property); + if (ok) { + checkTypeAssignableTo(valueType, leftType, left, undefined); + } + } + } + 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)); + } + } + function isYieldExpressionInClass(node) { + var current = node; + var parent = node.parent; + while (parent) { + if (ts.isFunctionLike(parent) && current === parent.body) { + return false; + } + else if (ts.isClassLike(current)) { + return true; + } + current = parent; + parent = parent.parent; + } + return false; + } + function checkYieldExpression(node) { + if (produceDiagnostics) { + if (!(node.flags & 8388608) || isYieldExpressionInClass(node)) { + grammarErrorOnFirstToken(node, ts.Diagnostics.A_yield_expression_is_only_allowed_in_a_generator_body); + } + if (isInParameterInitializerBeforeContainingFunction(node)) { + error(node, ts.Diagnostics.yield_expressions_cannot_be_used_in_a_parameter_initializer); + } + } + if (node.expression) { + var func = ts.getContainingFunction(node); + if (func && func.asteriskToken) { + var expressionType = checkExpressionCached(node.expression, undefined); + var expressionElementType = void 0; + var nodeIsYieldStar = !!node.asteriskToken; + if (nodeIsYieldStar) { + expressionElementType = checkElementTypeOfIterable(expressionType, node.expression); + } + if (func.type) { + var signatureElementType = getElementTypeOfIterableIterator(getTypeFromTypeNode(func.type)) || anyType; + if (nodeIsYieldStar) { + checkTypeAssignableTo(expressionElementType, signatureElementType, node.expression, undefined); + } + else { + checkTypeAssignableTo(expressionType, signatureElementType, node.expression, undefined); + } + } + } + } + return anyType; + } + function checkConditionalExpression(node, contextualMapper) { + checkExpression(node.condition); + var type1 = checkExpression(node.whenTrue, contextualMapper); + var type2 = checkExpression(node.whenFalse, contextualMapper); + return getUnionType([type1, type2]); + } + function checkStringLiteralExpression(node) { + var contextualType = getContextualType(node); + if (contextualType && contextualTypeIsStringLiteralType(contextualType)) { + return getStringLiteralTypeForText(node.text); + } + return stringType; + } + function checkTemplateExpression(node) { + ts.forEach(node.templateSpans, function (templateSpan) { + checkExpression(templateSpan.expression); + }); + return stringType; + } + function checkExpressionWithContextualType(node, contextualType, contextualMapper) { + var saveContextualType = node.contextualType; + node.contextualType = contextualType; + var result = checkExpression(node, contextualMapper); + node.contextualType = saveContextualType; + return result; + } + function checkExpressionCached(node, contextualMapper) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + var saveFlowLoopStart = flowLoopStart; + flowLoopStart = flowLoopCount; + links.resolvedType = checkExpression(node, contextualMapper); + flowLoopStart = saveFlowLoopStart; + } + return links.resolvedType; + } + function checkPropertyAssignment(node, contextualMapper) { + if (node.name.kind === 140) { + checkComputedPropertyName(node.name); + } + return checkExpression(node.initializer, contextualMapper); + } + function checkObjectLiteralMethod(node, contextualMapper) { + checkGrammarMethod(node); + if (node.name.kind === 140) { + checkComputedPropertyName(node.name); + } + var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); + return instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, contextualMapper); + } + function instantiateTypeWithSingleGenericCallSignature(node, type, contextualMapper) { + if (isInferentialContext(contextualMapper)) { + var signature = getSingleCallSignature(type); + if (signature && signature.typeParameters) { + var contextualType = getApparentTypeOfContextualType(node); + if (contextualType) { + var contextualSignature = getSingleCallSignature(contextualType); + if (contextualSignature && !contextualSignature.typeParameters) { + return getOrCreateTypeFromSignature(instantiateSignatureInContextOf(signature, contextualSignature, contextualMapper)); + } + } + } + } + return type; + } + function checkExpression(node, contextualMapper) { + var type; + if (node.kind === 139) { + type = checkQualifiedName(node); + } + else { + var uninstantiatedType = checkExpressionWorker(node, contextualMapper); + type = instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, contextualMapper); + } + if (isConstEnumObjectType(type)) { + var ok = (node.parent.kind === 172 && node.parent.expression === node) || + (node.parent.kind === 173 && node.parent.expression === node) || + ((node.kind === 69 || node.kind === 139) && isInRightSideOfImportOrExportAssignment(node)); + if (!ok) { + error(node, ts.Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment); + } + } + return type; + } + function checkNumericLiteral(node) { + checkGrammarNumericLiteral(node); + return numberType; + } + function checkExpressionWorker(node, contextualMapper) { + switch (node.kind) { + case 69: + return checkIdentifier(node); + case 97: + return checkThisExpression(node); + case 95: + return checkSuperExpression(node); + case 93: + return nullType; + case 99: + case 84: + return booleanType; + case 8: + return checkNumericLiteral(node); + case 189: + return checkTemplateExpression(node); + case 9: + return checkStringLiteralExpression(node); + case 11: + return stringType; + case 10: + return globalRegExpType; + case 170: + return checkArrayLiteral(node, contextualMapper); + case 171: + return checkObjectLiteral(node, contextualMapper); + case 172: + return checkPropertyAccessExpression(node); + case 173: + return checkIndexedAccess(node); + case 174: + case 175: + return checkCallExpression(node); + case 176: + return checkTaggedTemplateExpression(node); + case 178: + return checkExpression(node.expression, contextualMapper); + case 192: + return checkClassExpression(node); + case 179: + case 180: + return checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); + case 182: + return checkTypeOfExpression(node); + case 177: + case 195: + return checkAssertion(node); + case 196: + return checkNonNullAssertion(node); + case 181: + return checkDeleteExpression(node); + case 183: + return checkVoidExpression(node); + case 184: + return checkAwaitExpression(node); + case 185: + return checkPrefixUnaryExpression(node); + case 186: + return checkPostfixUnaryExpression(node); + case 187: + return checkBinaryExpression(node, contextualMapper); + case 188: + return checkConditionalExpression(node, contextualMapper); + case 191: + return checkSpreadElementExpression(node, contextualMapper); + case 193: + return undefinedType; + case 190: + return checkYieldExpression(node); + case 248: + return checkJsxExpression(node); + case 241: + return checkJsxElement(node); + case 242: + return checkJsxSelfClosingElement(node); + case 243: + ts.Debug.fail("Shouldn't ever directly check a JsxOpeningElement"); + } + return unknownType; + } + function checkTypeParameter(node) { + if (node.expression) { + grammarErrorOnFirstToken(node.expression, ts.Diagnostics.Type_expected); + } + checkSourceElement(node.constraint); + getConstraintOfTypeParameter(getDeclaredTypeOfTypeParameter(getSymbolOfNode(node))); + if (produceDiagnostics) { + checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_parameter_name_cannot_be_0); + } + } + function checkParameter(node) { + checkGrammarDecorators(node) || checkGrammarModifiers(node); + checkVariableLikeDeclaration(node); + var func = ts.getContainingFunction(node); + if (node.flags & 92) { + func = ts.getContainingFunction(node); + if (!(func.kind === 148 && ts.nodeIsPresent(func.body))) { + error(node, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); + } + } + if (node.questionToken && ts.isBindingPattern(node.name) && func.body) { + error(node, ts.Diagnostics.A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature); + } + if (node.name.text === "this") { + if (ts.indexOf(func.parameters, node) !== 0) { + error(node, ts.Diagnostics.A_this_parameter_must_be_the_first_parameter); + } + if (func.kind === 148 || func.kind === 152 || func.kind === 157) { + error(node, ts.Diagnostics.A_constructor_cannot_have_a_this_parameter); + } + } + if (node.dotDotDotToken && !ts.isBindingPattern(node.name) && !isArrayType(getTypeOfSymbol(node.symbol))) { + error(node, ts.Diagnostics.A_rest_parameter_must_be_of_an_array_type); + } + } + function isSyntacticallyValidGenerator(node) { + if (!node.asteriskToken || !node.body) { + return false; + } + return node.kind === 147 || + node.kind === 220 || + node.kind === 179; + } + function getTypePredicateParameterIndex(parameterList, parameter) { + if (parameterList) { + for (var i = 0; i < parameterList.length; i++) { + var param = parameterList[i]; + if (param.name.kind === 69 && + param.name.text === parameter.text) { + return i; + } + } + } + return -1; + } + function checkTypePredicate(node) { + var parent = getTypePredicateParent(node); + if (!parent) { + error(node, ts.Diagnostics.A_type_predicate_is_only_allowed_in_return_type_position_for_functions_and_methods); + return; + } + var typePredicate = getSignatureFromDeclaration(parent).typePredicate; + if (!typePredicate) { + return; + } + var parameterName = node.parameterName; + if (ts.isThisTypePredicate(typePredicate)) { + getTypeFromThisTypeNode(parameterName); + } + else { + if (typePredicate.parameterIndex >= 0) { + if (parent.parameters[typePredicate.parameterIndex].dotDotDotToken) { + error(parameterName, ts.Diagnostics.A_type_predicate_cannot_reference_a_rest_parameter); + } + else { + var leadingError = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.A_type_predicate_s_type_must_be_assignable_to_its_parameter_s_type); + checkTypeAssignableTo(typePredicate.type, getTypeOfNode(parent.parameters[typePredicate.parameterIndex]), node.type, undefined, leadingError); + } + } + else if (parameterName) { + var hasReportedError = false; + for (var _i = 0, _a = parent.parameters; _i < _a.length; _i++) { + var name_14 = _a[_i].name; + if (ts.isBindingPattern(name_14) && + checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_14, parameterName, typePredicate.parameterName)) { + hasReportedError = true; + break; + } + } + if (!hasReportedError) { + error(node.parameterName, ts.Diagnostics.Cannot_find_parameter_0, typePredicate.parameterName); + } + } + } + } + function getTypePredicateParent(node) { + switch (node.parent.kind) { + case 180: + case 151: + case 220: + case 179: + case 156: + case 147: + case 146: + var parent_10 = node.parent; + if (node === parent_10.type) { + return parent_10; + } + } + } + function checkIfTypePredicateVariableIsDeclaredInBindingPattern(pattern, predicateVariableNode, predicateVariableName) { + for (var _i = 0, _a = pattern.elements; _i < _a.length; _i++) { + var name_15 = _a[_i].name; + if (name_15.kind === 69 && + name_15.text === predicateVariableName) { + error(predicateVariableNode, ts.Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, predicateVariableName); + return true; + } + else if (name_15.kind === 168 || + name_15.kind === 167) { + if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_15, predicateVariableNode, predicateVariableName)) { + return true; + } + } + } + } + function checkSignatureDeclaration(node) { + if (node.kind === 153) { + checkGrammarIndexSignature(node); + } + else if (node.kind === 156 || node.kind === 220 || node.kind === 157 || + node.kind === 151 || node.kind === 148 || + node.kind === 152) { + checkGrammarFunctionLikeDeclaration(node); + } + checkTypeParameters(node.typeParameters); + ts.forEach(node.parameters, checkParameter); + if (node.type) { + checkSourceElement(node.type); + } + if (produceDiagnostics) { + checkCollisionWithArgumentsInGeneratedCode(node); + if (compilerOptions.noImplicitAny && !node.type) { + switch (node.kind) { + case 152: + error(node, ts.Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); + break; + case 151: + error(node, ts.Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); + break; + } + } + if (node.type) { + if (languageVersion >= 2 && isSyntacticallyValidGenerator(node)) { + var returnType = getTypeFromTypeNode(node.type); + if (returnType === voidType) { + error(node.type, ts.Diagnostics.A_generator_cannot_have_a_void_type_annotation); + } + else { + var generatorElementType = getElementTypeOfIterableIterator(returnType) || anyType; + var iterableIteratorInstantiation = createIterableIteratorType(generatorElementType); + checkTypeAssignableTo(iterableIteratorInstantiation, returnType, node.type); + } + } + else if (ts.isAsyncFunctionLike(node)) { + checkAsyncFunctionReturnType(node); + } + } + } + } + function checkTypeForDuplicateIndexSignatures(node) { + if (node.kind === 222) { + var nodeSymbol = getSymbolOfNode(node); + if (nodeSymbol.declarations.length > 0 && nodeSymbol.declarations[0] !== node) { + return; + } + } + var indexSymbol = getIndexSymbol(getSymbolOfNode(node)); + if (indexSymbol) { + var seenNumericIndexer = false; + var seenStringIndexer = false; + for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { + var decl = _a[_i]; + var declaration = decl; + if (declaration.parameters.length === 1 && declaration.parameters[0].type) { + switch (declaration.parameters[0].type.kind) { + case 132: + if (!seenStringIndexer) { + seenStringIndexer = true; + } + else { + error(declaration, ts.Diagnostics.Duplicate_string_index_signature); + } + break; + case 130: + if (!seenNumericIndexer) { + seenNumericIndexer = true; + } + else { + error(declaration, ts.Diagnostics.Duplicate_number_index_signature); + } + break; + } + } + } + } + } + function checkPropertyDeclaration(node) { + checkGrammarDecorators(node) || checkGrammarModifiers(node) || checkGrammarProperty(node) || checkGrammarComputedPropertyName(node.name); + checkVariableLikeDeclaration(node); + } + function checkMethodDeclaration(node) { + checkGrammarMethod(node) || checkGrammarComputedPropertyName(node.name); + checkFunctionOrMethodDeclaration(node); + if (node.flags & 128 && node.body) { + error(node, ts.Diagnostics.Method_0_cannot_have_an_implementation_because_it_is_marked_abstract, ts.declarationNameToString(node.name)); + } + } + function checkConstructorDeclaration(node) { + checkSignatureDeclaration(node); + checkGrammarConstructorTypeParameters(node) || checkGrammarConstructorTypeAnnotation(node); + checkSourceElement(node.body); + var symbol = getSymbolOfNode(node); + var firstDeclaration = ts.getDeclarationOfKind(symbol, node.kind); + if (node === firstDeclaration) { + checkFunctionOrConstructorSymbol(symbol); + } + if (ts.nodeIsMissing(node.body)) { + return; + } + if (!produceDiagnostics) { + return; + } + function containsSuperCallAsComputedPropertyName(n) { + return n.name && containsSuperCall(n.name); + } + function containsSuperCall(n) { + if (ts.isSuperCallExpression(n)) { + return true; + } + else if (ts.isFunctionLike(n)) { + return false; + } + else if (ts.isClassLike(n)) { + return ts.forEach(n.members, containsSuperCallAsComputedPropertyName); + } + return ts.forEachChild(n, containsSuperCall); + } + function markThisReferencesAsErrors(n) { + if (n.kind === 97) { + error(n, ts.Diagnostics.this_cannot_be_referenced_in_current_location); + } + else if (n.kind !== 179 && n.kind !== 220) { + ts.forEachChild(n, markThisReferencesAsErrors); + } + } + function isInstancePropertyWithInitializer(n) { + return n.kind === 145 && + !(n.flags & 32) && + !!n.initializer; + } + var containingClassDecl = node.parent; + if (ts.getClassExtendsHeritageClauseElement(containingClassDecl)) { + var classExtendsNull = classDeclarationExtendsNull(containingClassDecl); + var superCall = getSuperCallInConstructor(node); + if (superCall) { + if (classExtendsNull) { + error(superCall, ts.Diagnostics.A_constructor_cannot_contain_a_super_call_when_its_class_extends_null); + } + var superCallShouldBeFirst = ts.forEach(node.parent.members, isInstancePropertyWithInitializer) || + ts.forEach(node.parameters, function (p) { return p.flags & 92; }); + if (superCallShouldBeFirst) { + var statements = node.body.statements; + var superCallStatement = void 0; + for (var _i = 0, statements_2 = statements; _i < statements_2.length; _i++) { + var statement = statements_2[_i]; + if (statement.kind === 202 && ts.isSuperCallExpression(statement.expression)) { + superCallStatement = statement; + break; + } + if (!ts.isPrologueDirective(statement)) { + break; + } + } + if (!superCallStatement) { + error(node, ts.Diagnostics.A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties); + } + } + } + else if (!classExtendsNull) { + error(node, ts.Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call); + } + } + } + function checkAccessorDeclaration(node) { + if (produceDiagnostics) { + checkGrammarFunctionLikeDeclaration(node) || checkGrammarAccessor(node) || checkGrammarComputedPropertyName(node.name); + checkDecorators(node); + checkSignatureDeclaration(node); + if (node.kind === 149) { + if (!ts.isInAmbientContext(node) && ts.nodeIsPresent(node.body) && (node.flags & 32768)) { + if (node.flags & 65536) { + if (compilerOptions.noImplicitReturns) { + error(node.name, ts.Diagnostics.Not_all_code_paths_return_a_value); + } + } + else { + error(node.name, ts.Diagnostics.A_get_accessor_must_return_a_value); + } + } + } + if (node.name.kind === 140) { + checkComputedPropertyName(node.name); + } + if (!ts.hasDynamicName(node)) { + var otherKind = node.kind === 149 ? 150 : 149; + var otherAccessor = ts.getDeclarationOfKind(node.symbol, otherKind); + if (otherAccessor) { + if (((node.flags & 28) !== (otherAccessor.flags & 28))) { + error(node.name, ts.Diagnostics.Getter_and_setter_accessors_do_not_agree_in_visibility); + } + if (((node.flags & 128) !== (otherAccessor.flags & 128))) { + error(node.name, ts.Diagnostics.Accessors_must_both_be_abstract_or_non_abstract); + } + checkAccessorDeclarationTypesIdentical(node, otherAccessor, getAnnotatedAccessorType, ts.Diagnostics.get_and_set_accessor_must_have_the_same_type); + checkAccessorDeclarationTypesIdentical(node, otherAccessor, getAnnotatedAccessorThisType, ts.Diagnostics.get_and_set_accessor_must_have_the_same_this_type); + } + } + getTypeOfAccessors(getSymbolOfNode(node)); + } + if (node.parent.kind !== 171) { + checkSourceElement(node.body); + } + else { + checkNodeDeferred(node); + } + } + function checkAccessorDeclarationTypesIdentical(first, second, getAnnotatedType, message) { + var firstType = getAnnotatedType(first); + var secondType = getAnnotatedType(second); + if (firstType && secondType && !isTypeIdenticalTo(firstType, secondType)) { + error(first, message); + } + } + function checkAccessorDeferred(node) { + checkSourceElement(node.body); + } + function checkMissingDeclaration(node) { + checkDecorators(node); + } + function checkTypeArgumentConstraints(typeParameters, typeArgumentNodes) { + var typeArguments; + var mapper; + var result = true; + for (var i = 0; i < typeParameters.length; i++) { + var constraint = getConstraintOfTypeParameter(typeParameters[i]); + if (constraint) { + if (!typeArguments) { + typeArguments = ts.map(typeArgumentNodes, getTypeFromTypeNode); + mapper = createTypeMapper(typeParameters, typeArguments); + } + var typeArgument = typeArguments[i]; + result = result && checkTypeAssignableTo(typeArgument, getTypeWithThisArgument(instantiateType(constraint, mapper), typeArgument), typeArgumentNodes[i], ts.Diagnostics.Type_0_does_not_satisfy_the_constraint_1); + } + } + return result; + } + function checkTypeReferenceNode(node) { + checkGrammarTypeArguments(node, node.typeArguments); + var type = getTypeFromTypeReference(node); + if (type !== unknownType && node.typeArguments) { + ts.forEach(node.typeArguments, checkSourceElement); + if (produceDiagnostics) { + var symbol = getNodeLinks(node).resolvedSymbol; + var typeParameters = symbol.flags & 524288 ? getSymbolLinks(symbol).typeParameters : type.target.localTypeParameters; + checkTypeArgumentConstraints(typeParameters, node.typeArguments); + } + } + } + function checkTypeQuery(node) { + getTypeFromTypeQueryNode(node); + } + function checkTypeLiteral(node) { + ts.forEach(node.members, checkSourceElement); + if (produceDiagnostics) { + var type = getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); + checkIndexConstraints(type); + checkTypeForDuplicateIndexSignatures(node); + } + } + function checkArrayType(node) { + checkSourceElement(node.elementType); + } + function checkTupleType(node) { + var hasErrorFromDisallowedTrailingComma = checkGrammarForDisallowedTrailingComma(node.elementTypes); + if (!hasErrorFromDisallowedTrailingComma && node.elementTypes.length === 0) { + grammarErrorOnNode(node, ts.Diagnostics.A_tuple_type_element_list_cannot_be_empty); + } + ts.forEach(node.elementTypes, checkSourceElement); + } + function checkUnionOrIntersectionType(node) { + ts.forEach(node.types, checkSourceElement); + } + function isPrivateWithinAmbient(node) { + return (node.flags & 8) && ts.isInAmbientContext(node); + } + function getEffectiveDeclarationFlags(n, flagsToCheck) { + var flags = ts.getCombinedNodeFlags(n); + if (n.parent.kind !== 222 && + n.parent.kind !== 221 && + n.parent.kind !== 192 && + ts.isInAmbientContext(n)) { + if (!(flags & 2)) { + flags |= 1; + } + flags |= 2; + } + return flags & flagsToCheck; + } + function checkFunctionOrConstructorSymbol(symbol) { + if (!produceDiagnostics) { + return; + } + function getCanonicalOverload(overloads, implementation) { + var implementationSharesContainerWithFirstOverload = implementation !== undefined && implementation.parent === overloads[0].parent; + return implementationSharesContainerWithFirstOverload ? implementation : overloads[0]; + } + function checkFlagAgreementBetweenOverloads(overloads, implementation, flagsToCheck, someOverloadFlags, allOverloadFlags) { + var someButNotAllOverloadFlags = someOverloadFlags ^ allOverloadFlags; + if (someButNotAllOverloadFlags !== 0) { + var canonicalFlags_1 = getEffectiveDeclarationFlags(getCanonicalOverload(overloads, implementation), flagsToCheck); + ts.forEach(overloads, function (o) { + var deviation = getEffectiveDeclarationFlags(o, flagsToCheck) ^ canonicalFlags_1; + if (deviation & 1) { + error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_exported_or_non_exported); + } + else if (deviation & 2) { + error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_ambient_or_non_ambient); + } + else if (deviation & (8 | 16)) { + error(o.name || o, ts.Diagnostics.Overload_signatures_must_all_be_public_private_or_protected); + } + else if (deviation & 128) { + error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_abstract_or_non_abstract); + } + }); + } + } + function checkQuestionTokenAgreementBetweenOverloads(overloads, implementation, someHaveQuestionToken, allHaveQuestionToken) { + if (someHaveQuestionToken !== allHaveQuestionToken) { + var canonicalHasQuestionToken_1 = ts.hasQuestionToken(getCanonicalOverload(overloads, implementation)); + ts.forEach(overloads, function (o) { + var deviation = ts.hasQuestionToken(o) !== canonicalHasQuestionToken_1; + if (deviation) { + error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_optional_or_required); + } + }); + } + } + var flagsToCheck = 1 | 2 | 8 | 16 | 128; + var someNodeFlags = 0; + var allNodeFlags = flagsToCheck; + var someHaveQuestionToken = false; + var allHaveQuestionToken = true; + var hasOverloads = false; + var bodyDeclaration; + var lastSeenNonAmbientDeclaration; + var previousDeclaration; + var declarations = symbol.declarations; + var isConstructor = (symbol.flags & 16384) !== 0; + function reportImplementationExpectedError(node) { + if (node.name && ts.nodeIsMissing(node.name)) { + return; + } + var seen = false; + var subsequentNode = ts.forEachChild(node.parent, function (c) { + if (seen) { + return c; + } + else { + seen = c === node; + } + }); + if (subsequentNode && subsequentNode.pos === node.end) { + if (subsequentNode.kind === node.kind) { + var errorNode_1 = subsequentNode.name || subsequentNode; + if (node.name && subsequentNode.name && node.name.text === subsequentNode.name.text) { + var reportError = (node.kind === 147 || node.kind === 146) && + (node.flags & 32) !== (subsequentNode.flags & 32); + if (reportError) { + var diagnostic = node.flags & 32 ? ts.Diagnostics.Function_overload_must_be_static : ts.Diagnostics.Function_overload_must_not_be_static; + error(errorNode_1, diagnostic); + } + return; + } + else if (ts.nodeIsPresent(subsequentNode.body)) { + error(errorNode_1, ts.Diagnostics.Function_implementation_name_must_be_0, ts.declarationNameToString(node.name)); + return; + } + } + } + var errorNode = node.name || node; + if (isConstructor) { + error(errorNode, ts.Diagnostics.Constructor_implementation_is_missing); + } + else { + if (node.flags & 128) { + error(errorNode, ts.Diagnostics.All_declarations_of_an_abstract_method_must_be_consecutive); + } + else { + error(errorNode, ts.Diagnostics.Function_implementation_is_missing_or_not_immediately_following_the_declaration); + } + } + } + var isExportSymbolInsideModule = symbol.parent && symbol.parent.flags & 1536; + var duplicateFunctionDeclaration = false; + var multipleConstructorImplementation = false; + for (var _i = 0, declarations_4 = declarations; _i < declarations_4.length; _i++) { + var current = declarations_4[_i]; + var node = current; + var inAmbientContext = ts.isInAmbientContext(node); + var inAmbientContextOrInterface = node.parent.kind === 222 || node.parent.kind === 159 || inAmbientContext; + if (inAmbientContextOrInterface) { + previousDeclaration = undefined; + } + if (node.kind === 220 || node.kind === 147 || node.kind === 146 || node.kind === 148) { + var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); + someNodeFlags |= currentNodeFlags; + allNodeFlags &= currentNodeFlags; + someHaveQuestionToken = someHaveQuestionToken || ts.hasQuestionToken(node); + allHaveQuestionToken = allHaveQuestionToken && ts.hasQuestionToken(node); + if (ts.nodeIsPresent(node.body) && bodyDeclaration) { + if (isConstructor) { + multipleConstructorImplementation = true; + } + else { + duplicateFunctionDeclaration = true; + } + } + else if (!isExportSymbolInsideModule && previousDeclaration && previousDeclaration.parent === node.parent && previousDeclaration.end !== node.pos) { + reportImplementationExpectedError(previousDeclaration); + } + if (ts.nodeIsPresent(node.body)) { + if (!bodyDeclaration) { + bodyDeclaration = node; + } + } + else { + hasOverloads = true; + } + previousDeclaration = node; + if (!inAmbientContextOrInterface) { + lastSeenNonAmbientDeclaration = node; + } + } + } + if (multipleConstructorImplementation) { + ts.forEach(declarations, function (declaration) { + error(declaration, ts.Diagnostics.Multiple_constructor_implementations_are_not_allowed); + }); + } + if (duplicateFunctionDeclaration) { + ts.forEach(declarations, function (declaration) { + error(declaration.name, ts.Diagnostics.Duplicate_function_implementation); + }); + } + if (!isExportSymbolInsideModule && lastSeenNonAmbientDeclaration && !lastSeenNonAmbientDeclaration.body && + !(lastSeenNonAmbientDeclaration.flags & 128) && !lastSeenNonAmbientDeclaration.questionToken) { + reportImplementationExpectedError(lastSeenNonAmbientDeclaration); + } + if (hasOverloads) { + checkFlagAgreementBetweenOverloads(declarations, bodyDeclaration, flagsToCheck, someNodeFlags, allNodeFlags); + checkQuestionTokenAgreementBetweenOverloads(declarations, bodyDeclaration, someHaveQuestionToken, allHaveQuestionToken); + if (bodyDeclaration) { + var signatures = getSignaturesOfSymbol(symbol); + var bodySignature = getSignatureFromDeclaration(bodyDeclaration); + for (var _a = 0, signatures_3 = signatures; _a < signatures_3.length; _a++) { + var signature = signatures_3[_a]; + if (!isImplementationCompatibleWithOverload(bodySignature, signature)) { + error(signature.declaration, ts.Diagnostics.Overload_signature_is_not_compatible_with_function_implementation); + break; + } + } + } + } + } + function checkExportsOnMergedDeclarations(node) { + if (!produceDiagnostics) { + return; + } + var symbol = node.localSymbol; + if (!symbol) { + symbol = getSymbolOfNode(node); + if (!(symbol.flags & 7340032)) { + return; + } + } + if (ts.getDeclarationOfKind(symbol, node.kind) !== node) { + return; + } + var exportedDeclarationSpaces = 0; + var nonExportedDeclarationSpaces = 0; + var defaultExportedDeclarationSpaces = 0; + for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { + var d = _a[_i]; + var declarationSpaces = getDeclarationSpaces(d); + var effectiveDeclarationFlags = getEffectiveDeclarationFlags(d, 1 | 512); + if (effectiveDeclarationFlags & 1) { + if (effectiveDeclarationFlags & 512) { + defaultExportedDeclarationSpaces |= declarationSpaces; + } + else { + exportedDeclarationSpaces |= declarationSpaces; + } + } + else { + nonExportedDeclarationSpaces |= declarationSpaces; + } + } + var nonDefaultExportedDeclarationSpaces = exportedDeclarationSpaces | nonExportedDeclarationSpaces; + var commonDeclarationSpacesForExportsAndLocals = exportedDeclarationSpaces & nonExportedDeclarationSpaces; + var commonDeclarationSpacesForDefaultAndNonDefault = defaultExportedDeclarationSpaces & nonDefaultExportedDeclarationSpaces; + if (commonDeclarationSpacesForExportsAndLocals || commonDeclarationSpacesForDefaultAndNonDefault) { + for (var _b = 0, _c = symbol.declarations; _b < _c.length; _b++) { + var d = _c[_b]; + var declarationSpaces = getDeclarationSpaces(d); + if (declarationSpaces & commonDeclarationSpacesForDefaultAndNonDefault) { + error(d.name, ts.Diagnostics.Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead, ts.declarationNameToString(d.name)); + } + else if (declarationSpaces & commonDeclarationSpacesForExportsAndLocals) { + error(d.name, ts.Diagnostics.Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local, ts.declarationNameToString(d.name)); + } + } + } + function getDeclarationSpaces(d) { + switch (d.kind) { + case 222: + return 2097152; + case 225: + return ts.isAmbientModule(d) || ts.getModuleInstanceState(d) !== 0 + ? 4194304 | 1048576 + : 4194304; + case 221: + case 224: + return 2097152 | 1048576; + case 229: + var result_1 = 0; + var target = resolveAlias(getSymbolOfNode(d)); + ts.forEach(target.declarations, function (d) { result_1 |= getDeclarationSpaces(d); }); + return result_1; + default: + return 1048576; + } + } + } + function checkNonThenableType(type, location, message) { + type = getWidenedType(type); + if (!isTypeAny(type) && isTypeAssignableTo(type, getGlobalThenableType())) { + if (location) { + if (!message) { + message = ts.Diagnostics.Operand_for_await_does_not_have_a_valid_callable_then_member; + } + error(location, message); + } + return unknownType; + } + return type; + } + function getPromisedType(promise) { + if (promise.flags & 1) { + return undefined; + } + if ((promise.flags & 4096) && promise.target === tryGetGlobalPromiseType()) { + return promise.typeArguments[0]; + } + var globalPromiseLikeType = getInstantiatedGlobalPromiseLikeType(); + if (globalPromiseLikeType === emptyObjectType || !isTypeAssignableTo(promise, globalPromiseLikeType)) { + return undefined; + } + var thenFunction = getTypeOfPropertyOfType(promise, "then"); + if (thenFunction && (thenFunction.flags & 1)) { + return undefined; + } + var thenSignatures = thenFunction ? getSignaturesOfType(thenFunction, 0) : emptyArray; + if (thenSignatures.length === 0) { + return undefined; + } + var onfulfilledParameterType = getTypeWithFacts(getUnionType(ts.map(thenSignatures, getTypeOfFirstParameterOfSignature)), 131072); + if (onfulfilledParameterType.flags & 1) { + return undefined; + } + var onfulfilledParameterSignatures = getSignaturesOfType(onfulfilledParameterType, 0); + if (onfulfilledParameterSignatures.length === 0) { + return undefined; + } + var valueParameterType = getUnionType(ts.map(onfulfilledParameterSignatures, getTypeOfFirstParameterOfSignature)); + return valueParameterType; + } + function getTypeOfFirstParameterOfSignature(signature) { + return getTypeAtPosition(signature, 0); + } + function getAwaitedType(type) { + return checkAwaitedType(type, undefined, undefined); + } + function checkAwaitedType(type, location, message) { + return checkAwaitedTypeWorker(type); + function checkAwaitedTypeWorker(type) { + if (type.flags & 16384) { + var types = []; + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var constituentType = _a[_i]; + types.push(checkAwaitedTypeWorker(constituentType)); + } + return getUnionType(types); + } + else { + var promisedType = getPromisedType(type); + if (promisedType === undefined) { + return checkNonThenableType(type, location, message); + } + else { + if (type.id === promisedType.id || ts.indexOf(awaitedTypeStack, promisedType.id) >= 0) { + if (location) { + error(location, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method, symbolToString(type.symbol)); + } + return unknownType; + } + awaitedTypeStack.push(type.id); + var awaitedType = checkAwaitedTypeWorker(promisedType); + awaitedTypeStack.pop(); + return awaitedType; + } + } + } + } + function checkCorrectPromiseType(returnType, location) { + if (returnType === unknownType) { + return unknownType; + } + var globalPromiseType = getGlobalPromiseType(); + if (globalPromiseType === emptyGenericType + || globalPromiseType === getTargetType(returnType)) { + return checkAwaitedType(returnType, location, ts.Diagnostics.An_async_function_or_method_must_have_a_valid_awaitable_return_type); + } + error(location, ts.Diagnostics.The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type); + return unknownType; + } + function checkAsyncFunctionReturnType(node) { + if (languageVersion >= 2) { + var returnType = getTypeFromTypeNode(node.type); + return checkCorrectPromiseType(returnType, node.type); + } + var globalPromiseConstructorLikeType = getGlobalPromiseConstructorLikeType(); + if (globalPromiseConstructorLikeType === emptyObjectType) { + return unknownType; + } + var promiseType = getTypeFromTypeNode(node.type); + if (promiseType === unknownType && compilerOptions.isolatedModules) { + return unknownType; + } + var promiseConstructor = getNodeLinks(node.type).resolvedSymbol; + if (!promiseConstructor || !symbolIsValue(promiseConstructor)) { + var typeName = promiseConstructor + ? symbolToString(promiseConstructor) + : typeToString(promiseType); + error(node, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type, typeName); + return unknownType; + } + checkReturnTypeAnnotationAsExpression(node); + var promiseConstructorType = getTypeOfSymbol(promiseConstructor); + if (!checkTypeAssignableTo(promiseConstructorType, globalPromiseConstructorLikeType, node, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type)) { + return unknownType; + } + var promiseName = ts.getEntityNameFromTypeNode(node.type); + var promiseNameOrNamespaceRoot = getFirstIdentifier(promiseName); + var rootSymbol = getSymbol(node.locals, promiseNameOrNamespaceRoot.text, 107455); + if (rootSymbol) { + error(rootSymbol.valueDeclaration, ts.Diagnostics.Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions, promiseNameOrNamespaceRoot.text, getFullyQualifiedName(promiseConstructor)); + return unknownType; + } + return checkAwaitedType(promiseType, node, ts.Diagnostics.An_async_function_or_method_must_have_a_valid_awaitable_return_type); + } + function checkDecorator(node) { + var signature = getResolvedSignature(node); + var returnType = getReturnTypeOfSignature(signature); + if (returnType.flags & 1) { + return; + } + var expectedReturnType; + var headMessage = getDiagnosticHeadMessageForDecoratorResolution(node); + var errorInfo; + switch (node.parent.kind) { + case 221: + var classSymbol = getSymbolOfNode(node.parent); + var classConstructorType = getTypeOfSymbol(classSymbol); + expectedReturnType = getUnionType([classConstructorType, voidType]); + break; + case 142: + expectedReturnType = voidType; + errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any); + break; + case 145: + expectedReturnType = voidType; + errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.The_return_type_of_a_property_decorator_function_must_be_either_void_or_any); + break; + case 147: + case 149: + case 150: + var methodType = getTypeOfNode(node.parent); + var descriptorType = createTypedPropertyDescriptorType(methodType); + expectedReturnType = getUnionType([descriptorType, voidType]); + break; + } + checkTypeAssignableTo(returnType, expectedReturnType, node, headMessage, errorInfo); + } + function checkTypeNodeAsExpression(node) { + if (node && node.kind === 155) { + var root = getFirstIdentifier(node.typeName); + var meaning = root.parent.kind === 155 ? 793056 : 1536; + var rootSymbol = resolveName(root, root.text, meaning | 8388608, undefined, undefined); + if (rootSymbol && rootSymbol.flags & 8388608) { + var aliasTarget = resolveAlias(rootSymbol); + if (aliasTarget.flags & 107455 && !isConstEnumOrConstEnumOnlyModule(resolveAlias(rootSymbol))) { + markAliasSymbolAsReferenced(rootSymbol); + } + } + } + } + function checkTypeAnnotationAsExpression(node) { + checkTypeNodeAsExpression(node.type); + } + function checkReturnTypeAnnotationAsExpression(node) { + checkTypeNodeAsExpression(node.type); + } + function checkParameterTypeAnnotationsAsExpressions(node) { + for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) { + var parameter = _a[_i]; + checkTypeAnnotationAsExpression(parameter); + } + } + function checkDecorators(node) { + if (!node.decorators) { + return; + } + if (!ts.nodeCanBeDecorated(node)) { + return; + } + if (!compilerOptions.experimentalDecorators) { + error(node, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning); + } + if (compilerOptions.emitDecoratorMetadata) { + switch (node.kind) { + case 221: + var constructor = ts.getFirstConstructorWithBody(node); + if (constructor) { + checkParameterTypeAnnotationsAsExpressions(constructor); + } + break; + case 147: + case 149: + case 150: + checkParameterTypeAnnotationsAsExpressions(node); + checkReturnTypeAnnotationAsExpression(node); + break; + case 145: + case 142: + checkTypeAnnotationAsExpression(node); + break; + } + } + ts.forEach(node.decorators, checkDecorator); + } + function checkFunctionDeclaration(node) { + if (produceDiagnostics) { + checkFunctionOrMethodDeclaration(node) || checkGrammarForGenerator(node); + checkCollisionWithCapturedSuperVariable(node, node.name); + checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithRequireExportsInGeneratedCode(node, node.name); + checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); + } + } + function checkFunctionOrMethodDeclaration(node) { + checkDecorators(node); + checkSignatureDeclaration(node); + var isAsync = ts.isAsyncFunctionLike(node); + if (node.name && node.name.kind === 140) { + checkComputedPropertyName(node.name); + } + if (!ts.hasDynamicName(node)) { + var symbol = getSymbolOfNode(node); + var localSymbol = node.localSymbol || symbol; + var firstDeclaration = ts.forEach(localSymbol.declarations, function (declaration) { return declaration.kind === node.kind && !ts.isSourceFileJavaScript(ts.getSourceFileOfNode(declaration)) ? + declaration : undefined; }); + if (node === firstDeclaration) { + checkFunctionOrConstructorSymbol(localSymbol); + } + if (symbol.parent) { + if (ts.getDeclarationOfKind(symbol, node.kind) === node) { + checkFunctionOrConstructorSymbol(symbol); + } + } + } + checkSourceElement(node.body); + if (!node.asteriskToken) { + var returnOrPromisedType = node.type && (isAsync ? checkAsyncFunctionReturnType(node) : getTypeFromTypeNode(node.type)); + checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnOrPromisedType); + } + if (produceDiagnostics && !node.type) { + if (compilerOptions.noImplicitAny && ts.nodeIsMissing(node.body) && !isPrivateWithinAmbient(node)) { + reportImplicitAnyError(node, anyType); + } + if (node.asteriskToken && ts.nodeIsPresent(node.body)) { + getReturnTypeOfSignature(getSignatureFromDeclaration(node)); + } + } + } + function checkBlock(node) { + if (node.kind === 199) { + checkGrammarStatementInAmbientContext(node); + } + ts.forEach(node.statements, checkSourceElement); + } + function checkCollisionWithArgumentsInGeneratedCode(node) { + if (!ts.hasDeclaredRestParameter(node) || ts.isInAmbientContext(node) || ts.nodeIsMissing(node.body)) { + return; + } + ts.forEach(node.parameters, function (p) { + if (p.name && !ts.isBindingPattern(p.name) && p.name.text === argumentsSymbol.name) { + error(p, ts.Diagnostics.Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters); + } + }); + } + function needCollisionCheckForIdentifier(node, identifier, name) { + if (!(identifier && identifier.text === name)) { + return false; + } + if (node.kind === 145 || + node.kind === 144 || + node.kind === 147 || + node.kind === 146 || + node.kind === 149 || + node.kind === 150) { + return false; + } + if (ts.isInAmbientContext(node)) { + return false; + } + var root = ts.getRootDeclaration(node); + if (root.kind === 142 && ts.nodeIsMissing(root.parent.body)) { + return false; + } + return true; + } + function checkCollisionWithCapturedThisVariable(node, name) { + if (needCollisionCheckForIdentifier(node, name, "_this")) { + potentialThisCollisions.push(node); + } + } + function checkIfThisIsCapturedInEnclosingScope(node) { + var current = node; + while (current) { + if (getNodeCheckFlags(current) & 4) { + var isDeclaration_1 = node.kind !== 69; + if (isDeclaration_1) { + error(node.name, ts.Diagnostics.Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference); + } + else { + error(node, ts.Diagnostics.Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference); + } + return; + } + current = current.parent; + } + } + function checkCollisionWithCapturedSuperVariable(node, name) { + if (!needCollisionCheckForIdentifier(node, name, "_super")) { + return; + } + var enclosingClass = ts.getContainingClass(node); + if (!enclosingClass || ts.isInAmbientContext(enclosingClass)) { + return; + } + if (ts.getClassExtendsHeritageClauseElement(enclosingClass)) { + var isDeclaration_2 = node.kind !== 69; + if (isDeclaration_2) { + error(node, ts.Diagnostics.Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference); + } + else { + error(node, ts.Diagnostics.Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference); + } + } + } + function checkCollisionWithRequireExportsInGeneratedCode(node, name) { + if (!needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) { + return; + } + if (node.kind === 225 && ts.getModuleInstanceState(node) !== 1) { + return; + } + var parent = getDeclarationContainer(node); + if (parent.kind === 256 && ts.isExternalOrCommonJsModule(parent)) { + error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); + } + } + function checkCollisionWithGlobalPromiseInGeneratedCode(node, name) { + if (!needCollisionCheckForIdentifier(node, name, "Promise")) { + return; + } + if (node.kind === 225 && ts.getModuleInstanceState(node) !== 1) { + return; + } + var parent = getDeclarationContainer(node); + if (parent.kind === 256 && ts.isExternalOrCommonJsModule(parent) && parent.flags & 2097152) { + error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions, ts.declarationNameToString(name), ts.declarationNameToString(name)); + } + } + function checkVarDeclaredNamesNotShadowed(node) { + if ((ts.getCombinedNodeFlags(node) & 3072) !== 0 || ts.isParameterDeclaration(node)) { + return; + } + if (node.kind === 218 && !node.initializer) { + return; + } + var symbol = getSymbolOfNode(node); + if (symbol.flags & 1) { + var localDeclarationSymbol = resolveName(node, node.name.text, 3, undefined, undefined); + if (localDeclarationSymbol && + localDeclarationSymbol !== symbol && + localDeclarationSymbol.flags & 2) { + if (getDeclarationFlagsFromSymbol(localDeclarationSymbol) & 3072) { + var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 219); + var container = varDeclList.parent.kind === 200 && varDeclList.parent.parent + ? varDeclList.parent.parent + : undefined; + var namesShareScope = container && + (container.kind === 199 && ts.isFunctionLike(container.parent) || + container.kind === 226 || + container.kind === 225 || + container.kind === 256); + if (!namesShareScope) { + var name_16 = symbolToString(localDeclarationSymbol); + error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name_16, name_16); + } + } + } + } + } + function checkParameterInitializer(node) { + if (ts.getRootDeclaration(node).kind !== 142) { + return; + } + var func = ts.getContainingFunction(node); + visit(node.initializer); + function visit(n) { + if (ts.isTypeNode(n) || ts.isDeclarationName(n)) { + return; + } + if (n.kind === 172) { + return visit(n.expression); + } + else if (n.kind === 69) { + var symbol = resolveName(n, n.text, 107455 | 8388608, undefined, undefined); + if (!symbol || symbol === unknownSymbol || !symbol.valueDeclaration) { + return; + } + if (symbol.valueDeclaration === node) { + error(n, ts.Diagnostics.Parameter_0_cannot_be_referenced_in_its_initializer, ts.declarationNameToString(node.name)); + return; + } + var enclosingContainer = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration); + if (enclosingContainer === func) { + if (symbol.valueDeclaration.kind === 142) { + if (symbol.valueDeclaration.pos < node.pos) { + return; + } + var current = n; + while (current !== node.initializer) { + if (ts.isFunctionLike(current.parent)) { + return; + } + if (current.parent.kind === 145 && + !(current.parent.flags & 32) && + ts.isClassLike(current.parent.parent)) { + return; + } + current = current.parent; + } + } + error(n, ts.Diagnostics.Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it, ts.declarationNameToString(node.name), ts.declarationNameToString(n)); + } + } + else { + return ts.forEachChild(n, visit); + } + } + } + function checkVariableLikeDeclaration(node) { + checkDecorators(node); + checkSourceElement(node.type); + if (node.name.kind === 140) { + checkComputedPropertyName(node.name); + if (node.initializer) { + checkExpressionCached(node.initializer); + } + } + if (node.kind === 169) { + if (node.propertyName && node.propertyName.kind === 140) { + checkComputedPropertyName(node.propertyName); + } + var parent_11 = node.parent.parent; + var parentType = getTypeForBindingElementParent(parent_11); + var name_17 = node.propertyName || node.name; + var property = getPropertyOfType(parentType, getTextOfPropertyName(name_17)); + if (parent_11.initializer && property && getParentOfSymbol(property)) { + checkClassPropertyAccess(parent_11, parent_11.initializer, parentType, property); + } + } + if (ts.isBindingPattern(node.name)) { + ts.forEach(node.name.elements, checkSourceElement); + } + if (node.initializer && ts.getRootDeclaration(node).kind === 142 && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { + error(node, ts.Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation); + return; + } + if (ts.isBindingPattern(node.name)) { + if (node.initializer && node.parent.parent.kind !== 207) { + checkTypeAssignableTo(checkExpressionCached(node.initializer), getWidenedTypeForVariableLikeDeclaration(node), node, undefined); + checkParameterInitializer(node); + } + return; + } + var symbol = getSymbolOfNode(node); + var type = getTypeOfVariableOrParameterOrProperty(symbol); + if (node === symbol.valueDeclaration) { + if (node.initializer && node.parent.parent.kind !== 207) { + checkTypeAssignableTo(checkExpressionCached(node.initializer), type, node, undefined); + checkParameterInitializer(node); + } + } + else { + var declarationType = getWidenedTypeForVariableLikeDeclaration(node); + if (type !== unknownType && declarationType !== unknownType && !isTypeIdenticalTo(type, declarationType)) { + error(node.name, ts.Diagnostics.Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2, ts.declarationNameToString(node.name), typeToString(type), typeToString(declarationType)); + } + if (node.initializer) { + checkTypeAssignableTo(checkExpressionCached(node.initializer), declarationType, node, undefined); + } + } + if (node.kind !== 145 && node.kind !== 144) { + checkExportsOnMergedDeclarations(node); + if (node.kind === 218 || node.kind === 169) { + checkVarDeclaredNamesNotShadowed(node); + } + checkCollisionWithCapturedSuperVariable(node, node.name); + checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithRequireExportsInGeneratedCode(node, node.name); + checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); + } + } + function checkVariableDeclaration(node) { + checkGrammarVariableDeclaration(node); + return checkVariableLikeDeclaration(node); + } + function checkBindingElement(node) { + checkGrammarBindingElement(node); + return checkVariableLikeDeclaration(node); + } + function checkVariableStatement(node) { + checkGrammarDecorators(node) || checkGrammarModifiers(node) || checkGrammarVariableDeclarationList(node.declarationList) || checkGrammarForDisallowedLetOrConstStatement(node); + ts.forEach(node.declarationList.declarations, checkSourceElement); + } + function checkGrammarDisallowedModifiersOnObjectLiteralExpressionMethod(node) { + if (node.modifiers && node.parent.kind === 171) { + if (ts.isAsyncFunctionLike(node)) { + if (node.modifiers.length > 1) { + return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); + } + } + else { + return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); + } + } + } + function checkExpressionStatement(node) { + checkGrammarStatementInAmbientContext(node); + checkExpression(node.expression); + } + function checkIfStatement(node) { + checkGrammarStatementInAmbientContext(node); + checkExpression(node.expression); + checkSourceElement(node.thenStatement); + if (node.thenStatement.kind === 201) { + error(node.thenStatement, ts.Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement); + } + checkSourceElement(node.elseStatement); + } + function checkDoStatement(node) { + checkGrammarStatementInAmbientContext(node); + checkSourceElement(node.statement); + checkExpression(node.expression); + } + function checkWhileStatement(node) { + checkGrammarStatementInAmbientContext(node); + checkExpression(node.expression); + checkSourceElement(node.statement); + } + function checkForStatement(node) { + if (!checkGrammarStatementInAmbientContext(node)) { + if (node.initializer && node.initializer.kind === 219) { + checkGrammarVariableDeclarationList(node.initializer); + } + } + if (node.initializer) { + if (node.initializer.kind === 219) { + ts.forEach(node.initializer.declarations, checkVariableDeclaration); + } + else { + checkExpression(node.initializer); + } + } + if (node.condition) + checkExpression(node.condition); + if (node.incrementor) + checkExpression(node.incrementor); + checkSourceElement(node.statement); + } + function checkForOfStatement(node) { + checkGrammarForInOrForOfStatement(node); + if (node.initializer.kind === 219) { + checkForInOrForOfVariableDeclaration(node); + } + else { + var varExpr = node.initializer; + var iteratedType = checkRightHandSideOfForOf(node.expression); + if (varExpr.kind === 170 || varExpr.kind === 171) { + checkDestructuringAssignment(varExpr, iteratedType || unknownType); + } + else { + var leftType = checkExpression(varExpr); + checkReferenceExpression(varExpr, ts.Diagnostics.Invalid_left_hand_side_in_for_of_statement, ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_be_a_constant_or_a_read_only_property); + if (iteratedType) { + checkTypeAssignableTo(iteratedType, leftType, varExpr, undefined); + } + } + } + checkSourceElement(node.statement); + } + function checkForInStatement(node) { + checkGrammarForInOrForOfStatement(node); + if (node.initializer.kind === 219) { + var variable = node.initializer.declarations[0]; + if (variable && ts.isBindingPattern(variable.name)) { + error(variable.name, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); + } + checkForInOrForOfVariableDeclaration(node); + } + else { + var varExpr = node.initializer; + var leftType = checkExpression(varExpr); + if (varExpr.kind === 170 || varExpr.kind === 171) { + error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); + } + else if (!isTypeAnyOrAllConstituentTypesHaveKind(leftType, 258)) { + error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any); + } + else { + checkReferenceExpression(varExpr, ts.Diagnostics.Invalid_left_hand_side_in_for_in_statement, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_constant_or_a_read_only_property); + } + } + var rightType = checkNonNullExpression(node.expression); + if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 80896 | 512)) { + error(node.expression, ts.Diagnostics.The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter); + } + checkSourceElement(node.statement); + } + function checkForInOrForOfVariableDeclaration(iterationStatement) { + var variableDeclarationList = iterationStatement.initializer; + if (variableDeclarationList.declarations.length >= 1) { + var decl = variableDeclarationList.declarations[0]; + checkVariableDeclaration(decl); + } + } + function checkRightHandSideOfForOf(rhsExpression) { + var expressionType = checkNonNullExpression(rhsExpression); + return checkIteratedTypeOrElementType(expressionType, rhsExpression, true); + } + function checkIteratedTypeOrElementType(inputType, errorNode, allowStringInput) { + if (isTypeAny(inputType)) { + return inputType; + } + if (languageVersion >= 2) { + return checkElementTypeOfIterable(inputType, errorNode); + } + if (allowStringInput) { + return checkElementTypeOfArrayOrString(inputType, errorNode); + } + if (isArrayLikeType(inputType)) { + var indexType = getIndexTypeOfType(inputType, 1); + if (indexType) { + return indexType; + } + } + if (errorNode) { + error(errorNode, ts.Diagnostics.Type_0_is_not_an_array_type, typeToString(inputType)); + } + return unknownType; + } + function checkElementTypeOfIterable(iterable, errorNode) { + var elementType = getElementTypeOfIterable(iterable, errorNode); + if (errorNode && elementType) { + checkTypeAssignableTo(iterable, createIterableType(elementType), errorNode); + } + return elementType || anyType; + } + function getElementTypeOfIterable(type, errorNode) { + if (isTypeAny(type)) { + return undefined; + } + var typeAsIterable = type; + if (!typeAsIterable.iterableElementType) { + if ((type.flags & 4096) && type.target === getGlobalIterableType()) { + typeAsIterable.iterableElementType = type.typeArguments[0]; + } + else { + var iteratorFunction = getTypeOfPropertyOfType(type, ts.getPropertyNameForKnownSymbolName("iterator")); + if (isTypeAny(iteratorFunction)) { + return undefined; + } + var iteratorFunctionSignatures = iteratorFunction ? getSignaturesOfType(iteratorFunction, 0) : emptyArray; + if (iteratorFunctionSignatures.length === 0) { + if (errorNode) { + error(errorNode, ts.Diagnostics.Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator); + } + return undefined; + } + typeAsIterable.iterableElementType = getElementTypeOfIterator(getUnionType(ts.map(iteratorFunctionSignatures, getReturnTypeOfSignature)), errorNode); + } + } + return typeAsIterable.iterableElementType; + } + function getElementTypeOfIterator(type, errorNode) { + if (isTypeAny(type)) { + return undefined; + } + var typeAsIterator = type; + if (!typeAsIterator.iteratorElementType) { + if ((type.flags & 4096) && type.target === getGlobalIteratorType()) { + typeAsIterator.iteratorElementType = type.typeArguments[0]; + } + else { + var iteratorNextFunction = getTypeOfPropertyOfType(type, "next"); + if (isTypeAny(iteratorNextFunction)) { + return undefined; + } + var iteratorNextFunctionSignatures = iteratorNextFunction ? getSignaturesOfType(iteratorNextFunction, 0) : emptyArray; + if (iteratorNextFunctionSignatures.length === 0) { + if (errorNode) { + error(errorNode, ts.Diagnostics.An_iterator_must_have_a_next_method); + } + return undefined; + } + var iteratorNextResult = getUnionType(ts.map(iteratorNextFunctionSignatures, getReturnTypeOfSignature)); + if (isTypeAny(iteratorNextResult)) { + return undefined; + } + var iteratorNextValue = getTypeOfPropertyOfType(iteratorNextResult, "value"); + if (!iteratorNextValue) { + if (errorNode) { + error(errorNode, ts.Diagnostics.The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property); + } + return undefined; + } + typeAsIterator.iteratorElementType = iteratorNextValue; + } + } + return typeAsIterator.iteratorElementType; + } + function getElementTypeOfIterableIterator(type) { + if (isTypeAny(type)) { + return undefined; + } + if ((type.flags & 4096) && type.target === getGlobalIterableIteratorType()) { + return type.typeArguments[0]; + } + return getElementTypeOfIterable(type, undefined) || + getElementTypeOfIterator(type, undefined); + } + function checkElementTypeOfArrayOrString(arrayOrStringType, errorNode) { + ts.Debug.assert(languageVersion < 2); + var arrayType = arrayOrStringType; + if (arrayOrStringType.flags & 16384) { + arrayType = getUnionType(ts.filter(arrayOrStringType.types, function (t) { return !(t.flags & 258); })); + } + else if (arrayOrStringType.flags & 258) { + arrayType = neverType; + } + var hasStringConstituent = arrayOrStringType !== arrayType; + var reportedError = false; + if (hasStringConstituent) { + if (languageVersion < 1) { + error(errorNode, ts.Diagnostics.Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher); + reportedError = true; + } + if (arrayType === neverType) { + return stringType; + } + } + if (!isArrayLikeType(arrayType)) { + if (!reportedError) { + var diagnostic = hasStringConstituent + ? ts.Diagnostics.Type_0_is_not_an_array_type + : ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type; + error(errorNode, diagnostic, typeToString(arrayType)); + } + return hasStringConstituent ? stringType : unknownType; + } + var arrayElementType = getIndexTypeOfType(arrayType, 1) || unknownType; + if (hasStringConstituent) { + if (arrayElementType.flags & 258) { + return stringType; + } + return getUnionType([arrayElementType, stringType]); + } + return arrayElementType; + } + function checkBreakOrContinueStatement(node) { + checkGrammarStatementInAmbientContext(node) || checkGrammarBreakOrContinueStatement(node); + } + function isGetAccessorWithAnnotatedSetAccessor(node) { + return !!(node.kind === 149 && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 150))); + } + function isUnwrappedReturnTypeVoidOrAny(func, returnType) { + var unwrappedReturnType = ts.isAsyncFunctionLike(func) ? getPromisedType(returnType) : returnType; + return maybeTypeOfKind(unwrappedReturnType, 16 | 1); + } + function checkReturnStatement(node) { + if (!checkGrammarStatementInAmbientContext(node)) { + var functionBlock = ts.getContainingFunction(node); + if (!functionBlock) { + grammarErrorOnFirstToken(node, ts.Diagnostics.A_return_statement_can_only_be_used_within_a_function_body); + } + } + var func = ts.getContainingFunction(node); + if (func) { + var signature = getSignatureFromDeclaration(func); + var returnType = getReturnTypeOfSignature(signature); + if (strictNullChecks || node.expression || returnType === neverType) { + var exprType = node.expression ? checkExpressionCached(node.expression) : undefinedType; + if (func.asteriskToken) { + return; + } + if (func.kind === 150) { + if (node.expression) { + error(node.expression, ts.Diagnostics.Setters_cannot_return_a_value); + } + } + else if (func.kind === 148) { + if (node.expression && !checkTypeAssignableTo(exprType, returnType, node.expression)) { + error(node.expression, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); + } + } + else if (func.type || isGetAccessorWithAnnotatedSetAccessor(func)) { + if (ts.isAsyncFunctionLike(func)) { + var promisedType = getPromisedType(returnType); + var awaitedType = checkAwaitedType(exprType, node.expression || node, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member); + if (promisedType) { + checkTypeAssignableTo(awaitedType, promisedType, node.expression || node); + } + } + else { + checkTypeAssignableTo(exprType, returnType, node.expression || node); + } + } + } + else if (func.kind !== 148 && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(func, returnType)) { + error(node, ts.Diagnostics.Not_all_code_paths_return_a_value); + } + } + } + function checkWithStatement(node) { + if (!checkGrammarStatementInAmbientContext(node)) { + if (node.flags & 33554432) { + grammarErrorOnFirstToken(node, ts.Diagnostics.with_statements_are_not_allowed_in_an_async_function_block); + } + } + checkExpression(node.expression); + error(node.expression, ts.Diagnostics.All_symbols_within_a_with_block_will_be_resolved_to_any); + } + function checkSwitchStatement(node) { + checkGrammarStatementInAmbientContext(node); + var firstDefaultClause; + var hasDuplicateDefaultClause = false; + var expressionType = checkExpression(node.expression); + ts.forEach(node.caseBlock.clauses, function (clause) { + if (clause.kind === 250 && !hasDuplicateDefaultClause) { + if (firstDefaultClause === undefined) { + firstDefaultClause = clause; + } + else { + var sourceFile = ts.getSourceFileOfNode(node); + var start = ts.skipTrivia(sourceFile.text, clause.pos); + var end = clause.statements.length > 0 ? clause.statements[0].pos : clause.end; + grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.A_default_clause_cannot_appear_more_than_once_in_a_switch_statement); + hasDuplicateDefaultClause = true; + } + } + if (produceDiagnostics && clause.kind === 249) { + var caseClause = clause; + var caseType = checkExpression(caseClause.expression); + if (!isTypeComparableTo(expressionType, caseType)) { + checkTypeComparableTo(caseType, expressionType, caseClause.expression, undefined); + } + } + ts.forEach(clause.statements, checkSourceElement); + }); + } + function checkLabeledStatement(node) { + if (!checkGrammarStatementInAmbientContext(node)) { + var current = node.parent; + while (current) { + if (ts.isFunctionLike(current)) { + break; + } + if (current.kind === 214 && current.label.text === node.label.text) { + var sourceFile = ts.getSourceFileOfNode(node); + grammarErrorOnNode(node.label, ts.Diagnostics.Duplicate_label_0, ts.getTextOfNodeFromSourceText(sourceFile.text, node.label)); + break; + } + current = current.parent; + } + } + checkSourceElement(node.statement); + } + function checkThrowStatement(node) { + if (!checkGrammarStatementInAmbientContext(node)) { + if (node.expression === undefined) { + grammarErrorAfterFirstToken(node, ts.Diagnostics.Line_break_not_permitted_here); + } + } + if (node.expression) { + checkExpression(node.expression); + } + } + function checkTryStatement(node) { + checkGrammarStatementInAmbientContext(node); + checkBlock(node.tryBlock); + var catchClause = node.catchClause; + if (catchClause) { + if (catchClause.variableDeclaration) { + if (catchClause.variableDeclaration.name.kind !== 69) { + grammarErrorOnFirstToken(catchClause.variableDeclaration.name, ts.Diagnostics.Catch_clause_variable_name_must_be_an_identifier); + } + else if (catchClause.variableDeclaration.type) { + grammarErrorOnFirstToken(catchClause.variableDeclaration.type, ts.Diagnostics.Catch_clause_variable_cannot_have_a_type_annotation); + } + else if (catchClause.variableDeclaration.initializer) { + grammarErrorOnFirstToken(catchClause.variableDeclaration.initializer, ts.Diagnostics.Catch_clause_variable_cannot_have_an_initializer); + } + else { + var identifierName = catchClause.variableDeclaration.name.text; + var locals = catchClause.block.locals; + if (locals && ts.hasProperty(locals, identifierName)) { + var localSymbol = locals[identifierName]; + if (localSymbol && (localSymbol.flags & 2) !== 0) { + grammarErrorOnNode(localSymbol.valueDeclaration, ts.Diagnostics.Cannot_redeclare_identifier_0_in_catch_clause, identifierName); + } + } + } + } + checkBlock(catchClause.block); + } + if (node.finallyBlock) { + checkBlock(node.finallyBlock); + } + } + function checkIndexConstraints(type) { + var declaredNumberIndexer = getIndexDeclarationOfSymbol(type.symbol, 1); + var declaredStringIndexer = getIndexDeclarationOfSymbol(type.symbol, 0); + var stringIndexType = getIndexTypeOfType(type, 0); + var numberIndexType = getIndexTypeOfType(type, 1); + if (stringIndexType || numberIndexType) { + ts.forEach(getPropertiesOfObjectType(type), function (prop) { + var propType = getTypeOfSymbol(prop); + checkIndexConstraintForProperty(prop, propType, type, declaredStringIndexer, stringIndexType, 0); + checkIndexConstraintForProperty(prop, propType, type, declaredNumberIndexer, numberIndexType, 1); + }); + if (type.flags & 1024 && ts.isClassLike(type.symbol.valueDeclaration)) { + var classDeclaration = type.symbol.valueDeclaration; + for (var _i = 0, _a = classDeclaration.members; _i < _a.length; _i++) { + var member = _a[_i]; + if (!(member.flags & 32) && ts.hasDynamicName(member)) { + var propType = getTypeOfSymbol(member.symbol); + checkIndexConstraintForProperty(member.symbol, propType, type, declaredStringIndexer, stringIndexType, 0); + checkIndexConstraintForProperty(member.symbol, propType, type, declaredNumberIndexer, numberIndexType, 1); + } + } + } + } + var errorNode; + if (stringIndexType && numberIndexType) { + errorNode = declaredNumberIndexer || declaredStringIndexer; + if (!errorNode && (type.flags & 2048)) { + var someBaseTypeHasBothIndexers = ts.forEach(getBaseTypes(type), function (base) { return getIndexTypeOfType(base, 0) && getIndexTypeOfType(base, 1); }); + errorNode = someBaseTypeHasBothIndexers ? undefined : type.symbol.declarations[0]; + } + } + if (errorNode && !isTypeAssignableTo(numberIndexType, stringIndexType)) { + error(errorNode, ts.Diagnostics.Numeric_index_type_0_is_not_assignable_to_string_index_type_1, typeToString(numberIndexType), typeToString(stringIndexType)); + } + function checkIndexConstraintForProperty(prop, propertyType, containingType, indexDeclaration, indexType, indexKind) { + if (!indexType) { + return; + } + if (indexKind === 1 && !isNumericName(prop.valueDeclaration.name)) { + return; + } + var errorNode; + if (prop.valueDeclaration.name.kind === 140 || prop.parent === containingType.symbol) { + errorNode = prop.valueDeclaration; + } + else if (indexDeclaration) { + errorNode = indexDeclaration; + } + else if (containingType.flags & 2048) { + var someBaseClassHasBothPropertyAndIndexer = ts.forEach(getBaseTypes(containingType), function (base) { return getPropertyOfObjectType(base, prop.name) && getIndexTypeOfType(base, indexKind); }); + errorNode = someBaseClassHasBothPropertyAndIndexer ? undefined : containingType.symbol.declarations[0]; + } + if (errorNode && !isTypeAssignableTo(propertyType, indexType)) { + var errorMessage = indexKind === 0 + ? ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_string_index_type_2 + : ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2; + error(errorNode, errorMessage, symbolToString(prop), typeToString(propertyType), typeToString(indexType)); + } + } + } + function checkTypeNameIsReserved(name, message) { + switch (name.text) { + case "any": + case "number": + case "boolean": + case "string": + case "symbol": + case "void": + error(name, message, name.text); + } + } + function checkTypeParameters(typeParameterDeclarations) { + if (typeParameterDeclarations) { + for (var i = 0, n = typeParameterDeclarations.length; i < n; i++) { + var node = typeParameterDeclarations[i]; + checkTypeParameter(node); + if (produceDiagnostics) { + for (var j = 0; j < i; j++) { + if (typeParameterDeclarations[j].symbol === node.symbol) { + error(node.name, ts.Diagnostics.Duplicate_identifier_0, ts.declarationNameToString(node.name)); + } + } + } + } + } + } + function checkTypeParameterListsIdentical(node, symbol) { + if (symbol.declarations.length === 1) { + return; + } + var firstDecl; + for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { + var declaration = _a[_i]; + if (declaration.kind === 221 || declaration.kind === 222) { + if (!firstDecl) { + firstDecl = declaration; + } + else if (!areTypeParametersIdentical(firstDecl.typeParameters, node.typeParameters)) { + error(node.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_type_parameters, node.name.text); + } + } + } + } + function checkClassExpression(node) { + checkClassLikeDeclaration(node); + checkNodeDeferred(node); + return getTypeOfSymbol(getSymbolOfNode(node)); + } + function checkClassExpressionDeferred(node) { + ts.forEach(node.members, checkSourceElement); + } + function checkClassDeclaration(node) { + if (!node.name && !(node.flags & 512)) { + grammarErrorOnFirstToken(node, ts.Diagnostics.A_class_declaration_without_the_default_modifier_must_have_a_name); + } + checkClassLikeDeclaration(node); + ts.forEach(node.members, checkSourceElement); + } + function checkClassLikeDeclaration(node) { + checkGrammarClassDeclarationHeritageClauses(node); + checkDecorators(node); + if (node.name) { + checkTypeNameIsReserved(node.name, ts.Diagnostics.Class_name_cannot_be_0); + checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithRequireExportsInGeneratedCode(node, node.name); + checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); + } + checkTypeParameters(node.typeParameters); + checkExportsOnMergedDeclarations(node); + var symbol = getSymbolOfNode(node); + var type = getDeclaredTypeOfSymbol(symbol); + var typeWithThis = getTypeWithThisArgument(type); + var staticType = getTypeOfSymbol(symbol); + checkTypeParameterListsIdentical(node, symbol); + var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); + if (baseTypeNode) { + var baseTypes = getBaseTypes(type); + if (baseTypes.length && produceDiagnostics) { + var baseType_1 = baseTypes[0]; + var staticBaseType = getBaseConstructorTypeOfClass(type); + checkBaseTypeAccessibility(staticBaseType, baseTypeNode); + checkSourceElement(baseTypeNode.expression); + if (baseTypeNode.typeArguments) { + ts.forEach(baseTypeNode.typeArguments, checkSourceElement); + for (var _i = 0, _a = getConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments); _i < _a.length; _i++) { + var constructor = _a[_i]; + if (!checkTypeArgumentConstraints(constructor.typeParameters, baseTypeNode.typeArguments)) { + break; + } + } + } + checkTypeAssignableTo(typeWithThis, getTypeWithThisArgument(baseType_1, type.thisType), node.name || node, ts.Diagnostics.Class_0_incorrectly_extends_base_class_1); + checkTypeAssignableTo(staticType, getTypeWithoutSignatures(staticBaseType), node.name || node, ts.Diagnostics.Class_static_side_0_incorrectly_extends_base_class_static_side_1); + if (!(staticBaseType.symbol && staticBaseType.symbol.flags & 32)) { + var constructors = getInstantiatedConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments); + if (ts.forEach(constructors, function (sig) { return getReturnTypeOfSignature(sig) !== baseType_1; })) { + error(baseTypeNode.expression, ts.Diagnostics.Base_constructors_must_all_have_the_same_return_type); + } + } + checkKindsOfPropertyMemberOverrides(type, baseType_1); + } + } + var implementedTypeNodes = ts.getClassImplementsHeritageClauseElements(node); + if (implementedTypeNodes) { + for (var _b = 0, implementedTypeNodes_1 = implementedTypeNodes; _b < implementedTypeNodes_1.length; _b++) { + var typeRefNode = implementedTypeNodes_1[_b]; + if (!ts.isSupportedExpressionWithTypeArguments(typeRefNode)) { + error(typeRefNode.expression, ts.Diagnostics.A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments); + } + checkTypeReferenceNode(typeRefNode); + if (produceDiagnostics) { + var t = getTypeFromTypeNode(typeRefNode); + if (t !== unknownType) { + var declaredType = (t.flags & 4096) ? t.target : t; + if (declaredType.flags & (1024 | 2048)) { + checkTypeAssignableTo(typeWithThis, getTypeWithThisArgument(t, type.thisType), node.name || node, ts.Diagnostics.Class_0_incorrectly_implements_interface_1); + } + else { + error(typeRefNode, ts.Diagnostics.A_class_may_only_implement_another_class_or_interface); + } + } + } + } + } + if (produceDiagnostics) { + checkIndexConstraints(type); + checkTypeForDuplicateIndexSignatures(node); + } + } + function checkBaseTypeAccessibility(type, node) { + var signatures = getSignaturesOfType(type, 1); + if (signatures.length) { + var declaration = signatures[0].declaration; + if (declaration && declaration.flags & 8) { + var typeClassDeclaration = getClassLikeDeclarationOfSymbol(type.symbol); + if (!isNodeWithinClass(node, typeClassDeclaration)) { + error(node, ts.Diagnostics.Cannot_extend_a_class_0_Class_constructor_is_marked_as_private, node.expression.text); + } + } + } + } + function getTargetSymbol(s) { + return s.flags & 16777216 ? getSymbolLinks(s).target : s; + } + function getClassLikeDeclarationOfSymbol(symbol) { + return ts.forEach(symbol.declarations, function (d) { return ts.isClassLike(d) ? d : undefined; }); + } + function checkKindsOfPropertyMemberOverrides(type, baseType) { + var baseProperties = getPropertiesOfObjectType(baseType); + for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) { + var baseProperty = baseProperties_1[_i]; + var base = getTargetSymbol(baseProperty); + if (base.flags & 134217728) { + continue; + } + var derived = getTargetSymbol(getPropertyOfObjectType(type, base.name)); + var baseDeclarationFlags = getDeclarationFlagsFromSymbol(base); + ts.Debug.assert(!!derived, "derived should point to something, even if it is the base class' declaration."); + if (derived) { + if (derived === base) { + var derivedClassDecl = getClassLikeDeclarationOfSymbol(type.symbol); + if (baseDeclarationFlags & 128 && (!derivedClassDecl || !(derivedClassDecl.flags & 128))) { + if (derivedClassDecl.kind === 192) { + error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType)); + } + else { + error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2, typeToString(type), symbolToString(baseProperty), typeToString(baseType)); + } + } + } + else { + var derivedDeclarationFlags = getDeclarationFlagsFromSymbol(derived); + if ((baseDeclarationFlags & 8) || (derivedDeclarationFlags & 8)) { + continue; + } + if ((baseDeclarationFlags & 32) !== (derivedDeclarationFlags & 32)) { + continue; + } + if ((base.flags & derived.flags & 8192) || ((base.flags & 98308) && (derived.flags & 98308))) { + continue; + } + var errorMessage = void 0; + if (base.flags & 8192) { + if (derived.flags & 98304) { + errorMessage = ts.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor; + } + else { + ts.Debug.assert((derived.flags & 4) !== 0); + errorMessage = ts.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property; + } + } + else if (base.flags & 4) { + ts.Debug.assert((derived.flags & 8192) !== 0); + errorMessage = ts.Diagnostics.Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function; + } + else { + ts.Debug.assert((base.flags & 98304) !== 0); + ts.Debug.assert((derived.flags & 8192) !== 0); + errorMessage = ts.Diagnostics.Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function; + } + error(derived.valueDeclaration.name, errorMessage, typeToString(baseType), symbolToString(base), typeToString(type)); + } + } + } + } + function isAccessor(kind) { + return kind === 149 || kind === 150; + } + function areTypeParametersIdentical(list1, list2) { + if (!list1 && !list2) { + return true; + } + if (!list1 || !list2 || list1.length !== list2.length) { + return false; + } + for (var i = 0, len = list1.length; i < len; i++) { + var tp1 = list1[i]; + var tp2 = list2[i]; + if (tp1.name.text !== tp2.name.text) { + return false; + } + if (!tp1.constraint && !tp2.constraint) { + continue; + } + if (!tp1.constraint || !tp2.constraint) { + return false; + } + if (!isTypeIdenticalTo(getTypeFromTypeNode(tp1.constraint), getTypeFromTypeNode(tp2.constraint))) { + return false; + } + } + return true; + } + function checkInheritedPropertiesAreIdentical(type, typeNode) { + var baseTypes = getBaseTypes(type); + if (baseTypes.length < 2) { + return true; + } + var seen = {}; + ts.forEach(resolveDeclaredMembers(type).declaredProperties, function (p) { seen[p.name] = { prop: p, containingType: type }; }); + var ok = true; + for (var _i = 0, baseTypes_2 = baseTypes; _i < baseTypes_2.length; _i++) { + var base = baseTypes_2[_i]; + var properties = getPropertiesOfObjectType(getTypeWithThisArgument(base, type.thisType)); + for (var _a = 0, properties_4 = properties; _a < properties_4.length; _a++) { + var prop = properties_4[_a]; + if (!ts.hasProperty(seen, prop.name)) { + seen[prop.name] = { prop: prop, containingType: base }; + } + else { + var existing = seen[prop.name]; + var isInheritedProperty = existing.containingType !== type; + if (isInheritedProperty && !isPropertyIdenticalTo(existing.prop, prop)) { + ok = false; + var typeName1 = typeToString(existing.containingType); + var typeName2 = typeToString(base); + var errorInfo = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.Named_property_0_of_types_1_and_2_are_not_identical, symbolToString(prop), typeName1, typeName2); + errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.Interface_0_cannot_simultaneously_extend_types_1_and_2, typeToString(type), typeName1, typeName2); + diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(typeNode, errorInfo)); + } + } + } + } + return ok; + } + function checkInterfaceDeclaration(node) { + checkGrammarDecorators(node) || checkGrammarModifiers(node) || checkGrammarInterfaceDeclaration(node); + checkTypeParameters(node.typeParameters); + if (produceDiagnostics) { + checkTypeNameIsReserved(node.name, ts.Diagnostics.Interface_name_cannot_be_0); + checkExportsOnMergedDeclarations(node); + var symbol = getSymbolOfNode(node); + checkTypeParameterListsIdentical(node, symbol); + var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 222); + if (node === firstInterfaceDecl) { + var type = getDeclaredTypeOfSymbol(symbol); + var typeWithThis = getTypeWithThisArgument(type); + if (checkInheritedPropertiesAreIdentical(type, node.name)) { + for (var _i = 0, _a = getBaseTypes(type); _i < _a.length; _i++) { + var baseType = _a[_i]; + checkTypeAssignableTo(typeWithThis, getTypeWithThisArgument(baseType, type.thisType), node.name, ts.Diagnostics.Interface_0_incorrectly_extends_interface_1); + } + checkIndexConstraints(type); + } + } + } + ts.forEach(ts.getInterfaceBaseTypeNodes(node), function (heritageElement) { + if (!ts.isSupportedExpressionWithTypeArguments(heritageElement)) { + error(heritageElement.expression, ts.Diagnostics.An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments); + } + checkTypeReferenceNode(heritageElement); + }); + ts.forEach(node.members, checkSourceElement); + if (produceDiagnostics) { + checkTypeForDuplicateIndexSignatures(node); + } + } + function checkTypeAliasDeclaration(node) { + checkGrammarDecorators(node) || checkGrammarModifiers(node); + checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_alias_name_cannot_be_0); + checkSourceElement(node.type); + } + function computeEnumMemberValues(node) { + var nodeLinks = getNodeLinks(node); + if (!(nodeLinks.flags & 16384)) { + var enumSymbol = getSymbolOfNode(node); + var enumType = getDeclaredTypeOfSymbol(enumSymbol); + var autoValue = 0; + var ambient = ts.isInAmbientContext(node); + var enumIsConst = ts.isConst(node); + for (var _i = 0, _a = node.members; _i < _a.length; _i++) { + var member = _a[_i]; + if (isComputedNonLiteralName(member.name)) { + error(member.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_enums); + } + else { + var text = getTextOfPropertyName(member.name); + if (isNumericLiteralName(text)) { + error(member.name, ts.Diagnostics.An_enum_member_cannot_have_a_numeric_name); + } + } + var previousEnumMemberIsNonConstant = autoValue === undefined; + var initializer = member.initializer; + if (initializer) { + autoValue = computeConstantValueForEnumMemberInitializer(initializer, enumType, enumIsConst, ambient); + } + else if (ambient && !enumIsConst) { + autoValue = undefined; + } + else if (previousEnumMemberIsNonConstant) { + error(member.name, ts.Diagnostics.Enum_member_must_have_initializer); + } + if (autoValue !== undefined) { + getNodeLinks(member).enumMemberValue = autoValue; + autoValue++; + } + } + nodeLinks.flags |= 16384; + } + function computeConstantValueForEnumMemberInitializer(initializer, enumType, enumIsConst, ambient) { + var reportError = true; + var value = evalConstant(initializer); + if (reportError) { + if (value === undefined) { + if (enumIsConst) { + error(initializer, ts.Diagnostics.In_const_enum_declarations_member_initializer_must_be_constant_expression); + } + else if (ambient) { + error(initializer, ts.Diagnostics.In_ambient_enum_declarations_member_initializer_must_be_constant_expression); + } + else { + checkTypeAssignableTo(checkExpression(initializer), enumType, initializer, undefined); + } + } + else if (enumIsConst) { + if (isNaN(value)) { + error(initializer, ts.Diagnostics.const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN); + } + else if (!isFinite(value)) { + error(initializer, ts.Diagnostics.const_enum_member_initializer_was_evaluated_to_a_non_finite_value); + } + } + } + return value; + function evalConstant(e) { + switch (e.kind) { + case 185: + var value_1 = evalConstant(e.operand); + if (value_1 === undefined) { + return undefined; + } + switch (e.operator) { + case 35: return value_1; + case 36: return -value_1; + case 50: return ~value_1; + } + return undefined; + case 187: + var left = evalConstant(e.left); + if (left === undefined) { + return undefined; + } + var right = evalConstant(e.right); + if (right === undefined) { + return undefined; + } + switch (e.operatorToken.kind) { + case 47: return left | right; + case 46: return left & right; + case 44: return left >> right; + case 45: return left >>> right; + case 43: return left << right; + case 48: return left ^ right; + case 37: return left * right; + case 39: return left / right; + case 35: return left + right; + case 36: return left - right; + case 40: return left % right; + } + return undefined; + case 8: + return +e.text; + case 178: + return evalConstant(e.expression); + case 69: + case 173: + case 172: + var member = initializer.parent; + var currentType = getTypeOfSymbol(getSymbolOfNode(member.parent)); + var enumType_1; + var propertyName = void 0; + if (e.kind === 69) { + enumType_1 = currentType; + propertyName = e.text; + } + else { + var expression = void 0; + if (e.kind === 173) { + if (e.argumentExpression === undefined || + e.argumentExpression.kind !== 9) { + return undefined; + } + expression = e.expression; + propertyName = e.argumentExpression.text; + } + else { + expression = e.expression; + propertyName = e.name.text; + } + var current = expression; + while (current) { + if (current.kind === 69) { + break; + } + else if (current.kind === 172) { + current = current.expression; + } + else { + return undefined; + } + } + enumType_1 = checkExpression(expression); + if (!(enumType_1.symbol && (enumType_1.symbol.flags & 384))) { + return undefined; + } + } + if (propertyName === undefined) { + return undefined; + } + var property = getPropertyOfObjectType(enumType_1, propertyName); + if (!property || !(property.flags & 8)) { + return undefined; + } + var propertyDecl = property.valueDeclaration; + if (member === propertyDecl) { + return undefined; + } + if (!isBlockScopedNameDeclaredBeforeUse(propertyDecl, member)) { + reportError = false; + error(e, ts.Diagnostics.A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums); + return undefined; + } + return getNodeLinks(propertyDecl).enumMemberValue; + } + } + } + } + function checkEnumDeclaration(node) { + if (!produceDiagnostics) { + return; + } + checkGrammarDecorators(node) || checkGrammarModifiers(node); + checkTypeNameIsReserved(node.name, ts.Diagnostics.Enum_name_cannot_be_0); + checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithRequireExportsInGeneratedCode(node, node.name); + checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); + checkExportsOnMergedDeclarations(node); + computeEnumMemberValues(node); + var enumIsConst = ts.isConst(node); + if (compilerOptions.isolatedModules && enumIsConst && ts.isInAmbientContext(node)) { + error(node.name, ts.Diagnostics.Ambient_const_enums_are_not_allowed_when_the_isolatedModules_flag_is_provided); + } + var enumSymbol = getSymbolOfNode(node); + var firstDeclaration = ts.getDeclarationOfKind(enumSymbol, node.kind); + if (node === firstDeclaration) { + if (enumSymbol.declarations.length > 1) { + ts.forEach(enumSymbol.declarations, function (decl) { + if (ts.isConstEnumDeclaration(decl) !== enumIsConst) { + error(decl.name, ts.Diagnostics.Enum_declarations_must_all_be_const_or_non_const); + } + }); + } + var seenEnumMissingInitialInitializer_1 = false; + ts.forEach(enumSymbol.declarations, function (declaration) { + if (declaration.kind !== 224) { + return false; + } + var enumDeclaration = declaration; + if (!enumDeclaration.members.length) { + return false; + } + var firstEnumMember = enumDeclaration.members[0]; + if (!firstEnumMember.initializer) { + if (seenEnumMissingInitialInitializer_1) { + error(firstEnumMember.name, ts.Diagnostics.In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element); + } + else { + seenEnumMissingInitialInitializer_1 = true; + } + } + }); + } + } + function getFirstNonAmbientClassOrFunctionDeclaration(symbol) { + var declarations = symbol.declarations; + for (var _i = 0, declarations_5 = declarations; _i < declarations_5.length; _i++) { + var declaration = declarations_5[_i]; + if ((declaration.kind === 221 || + (declaration.kind === 220 && ts.nodeIsPresent(declaration.body))) && + !ts.isInAmbientContext(declaration)) { + return declaration; + } + } + return undefined; + } + function inSameLexicalScope(node1, node2) { + var container1 = ts.getEnclosingBlockScopeContainer(node1); + var container2 = ts.getEnclosingBlockScopeContainer(node2); + if (isGlobalSourceFile(container1)) { + return isGlobalSourceFile(container2); + } + else if (isGlobalSourceFile(container2)) { + return false; + } + else { + return container1 === container2; + } + } + function checkModuleDeclaration(node) { + if (produceDiagnostics) { + var isGlobalAugmentation = ts.isGlobalScopeAugmentation(node); + var inAmbientContext = ts.isInAmbientContext(node); + if (isGlobalAugmentation && !inAmbientContext) { + error(node.name, ts.Diagnostics.Augmentations_for_the_global_scope_should_have_declare_modifier_unless_they_appear_in_already_ambient_context); + } + var isAmbientExternalModule = ts.isAmbientModule(node); + var contextErrorMessage = isAmbientExternalModule + ? ts.Diagnostics.An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file + : ts.Diagnostics.A_namespace_declaration_is_only_allowed_in_a_namespace_or_module; + if (checkGrammarModuleElementContext(node, contextErrorMessage)) { + return; + } + if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node)) { + if (!inAmbientContext && node.name.kind === 9) { + grammarErrorOnNode(node.name, ts.Diagnostics.Only_ambient_modules_can_use_quoted_names); + } + } + checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithRequireExportsInGeneratedCode(node, node.name); + checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); + checkExportsOnMergedDeclarations(node); + var symbol = getSymbolOfNode(node); + if (symbol.flags & 512 + && symbol.declarations.length > 1 + && !inAmbientContext + && ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums || compilerOptions.isolatedModules)) { + var firstNonAmbientClassOrFunc = getFirstNonAmbientClassOrFunctionDeclaration(symbol); + if (firstNonAmbientClassOrFunc) { + if (ts.getSourceFileOfNode(node) !== ts.getSourceFileOfNode(firstNonAmbientClassOrFunc)) { + error(node.name, ts.Diagnostics.A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged); + } + else if (node.pos < firstNonAmbientClassOrFunc.pos) { + error(node.name, ts.Diagnostics.A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged); + } + } + var mergedClass = ts.getDeclarationOfKind(symbol, 221); + if (mergedClass && + inSameLexicalScope(node, mergedClass)) { + getNodeLinks(node).flags |= 32768; + } + } + if (isAmbientExternalModule) { + if (ts.isExternalModuleAugmentation(node)) { + var checkBody = isGlobalAugmentation || (getSymbolOfNode(node).flags & 33554432); + if (checkBody) { + for (var _i = 0, _a = node.body.statements; _i < _a.length; _i++) { + var statement = _a[_i]; + checkModuleAugmentationElement(statement, isGlobalAugmentation); + } + } + } + else if (isGlobalSourceFile(node.parent)) { + if (isGlobalAugmentation) { + error(node.name, ts.Diagnostics.Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_declarations); + } + else if (ts.isExternalModuleNameRelative(node.name.text)) { + error(node.name, ts.Diagnostics.Ambient_module_declaration_cannot_specify_relative_module_name); + } + } + else { + if (isGlobalAugmentation) { + error(node.name, ts.Diagnostics.Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_declarations); + } + else { + error(node.name, ts.Diagnostics.Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces); + } + } + } + } + checkSourceElement(node.body); + } + function checkModuleAugmentationElement(node, isGlobalAugmentation) { + switch (node.kind) { + case 200: + for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { + var decl = _a[_i]; + checkModuleAugmentationElement(decl, isGlobalAugmentation); + } + break; + case 235: + case 236: + grammarErrorOnFirstToken(node, ts.Diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations); + break; + case 229: + case 230: + grammarErrorOnFirstToken(node, ts.Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module); + break; + case 169: + case 218: + var name_18 = node.name; + if (ts.isBindingPattern(name_18)) { + for (var _b = 0, _c = name_18.elements; _b < _c.length; _b++) { + var el = _c[_b]; + checkModuleAugmentationElement(el, isGlobalAugmentation); + } + break; + } + case 221: + case 224: + case 220: + case 222: + case 225: + case 223: + if (isGlobalAugmentation) { + return; + } + var symbol = getSymbolOfNode(node); + if (symbol) { + var reportError = !(symbol.flags & 33554432); + if (!reportError) { + reportError = ts.isExternalModuleAugmentation(symbol.parent.declarations[0]); + } + } + break; + } + } + function getFirstIdentifier(node) { + while (true) { + if (node.kind === 139) { + node = node.left; + } + else if (node.kind === 172) { + node = node.expression; + } + else { + break; + } + } + ts.Debug.assert(node.kind === 69); + return node; + } + function checkExternalImportOrExportDeclaration(node) { + var moduleName = ts.getExternalModuleName(node); + if (!ts.nodeIsMissing(moduleName) && moduleName.kind !== 9) { + error(moduleName, ts.Diagnostics.String_literal_expected); + return false; + } + var inAmbientExternalModule = node.parent.kind === 226 && ts.isAmbientModule(node.parent.parent); + if (node.parent.kind !== 256 && !inAmbientExternalModule) { + error(moduleName, node.kind === 236 ? + ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace : + ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module); + return false; + } + if (inAmbientExternalModule && ts.isExternalModuleNameRelative(moduleName.text)) { + if (!isTopLevelInExternalModuleAugmentation(node)) { + error(node, ts.Diagnostics.Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relative_module_name); + return false; + } + } + return true; + } + function checkAliasSymbol(node) { + var symbol = getSymbolOfNode(node); + var target = resolveAlias(symbol); + if (target !== unknownSymbol) { + var excludedMeanings = (symbol.flags & (107455 | 1048576) ? 107455 : 0) | + (symbol.flags & 793056 ? 793056 : 0) | + (symbol.flags & 1536 ? 1536 : 0); + if (target.flags & excludedMeanings) { + var message = node.kind === 238 ? + ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : + ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0; + error(node, message, symbolToString(symbol)); + } + } + } + function checkImportBinding(node) { + checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithRequireExportsInGeneratedCode(node, node.name); + checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); + checkAliasSymbol(node); + } + function checkImportDeclaration(node) { + if (checkGrammarModuleElementContext(node, ts.Diagnostics.An_import_declaration_can_only_be_used_in_a_namespace_or_module)) { + return; + } + if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && (node.flags & 1023)) { + grammarErrorOnFirstToken(node, ts.Diagnostics.An_import_declaration_cannot_have_modifiers); + } + if (checkExternalImportOrExportDeclaration(node)) { + var importClause = node.importClause; + if (importClause) { + if (importClause.name) { + checkImportBinding(importClause); + } + if (importClause.namedBindings) { + if (importClause.namedBindings.kind === 232) { + checkImportBinding(importClause.namedBindings); + } + else { + ts.forEach(importClause.namedBindings.elements, checkImportBinding); + } + } + } + } + } + function checkImportEqualsDeclaration(node) { + if (checkGrammarModuleElementContext(node, ts.Diagnostics.An_import_declaration_can_only_be_used_in_a_namespace_or_module)) { + return; + } + checkGrammarDecorators(node) || checkGrammarModifiers(node); + if (ts.isInternalModuleImportEqualsDeclaration(node) || checkExternalImportOrExportDeclaration(node)) { + checkImportBinding(node); + if (node.flags & 1) { + markExportAsReferenced(node); + } + if (ts.isInternalModuleImportEqualsDeclaration(node)) { + var target = resolveAlias(getSymbolOfNode(node)); + if (target !== unknownSymbol) { + if (target.flags & 107455) { + var moduleName = getFirstIdentifier(node.moduleReference); + if (!(resolveEntityName(moduleName, 107455 | 1536).flags & 1536)) { + error(moduleName, ts.Diagnostics.Module_0_is_hidden_by_a_local_declaration_with_the_same_name, ts.declarationNameToString(moduleName)); + } + } + if (target.flags & 793056) { + checkTypeNameIsReserved(node.name, ts.Diagnostics.Import_name_cannot_be_0); + } + } + } + else { + if (modulekind === ts.ModuleKind.ES6 && !ts.isInAmbientContext(node)) { + grammarErrorOnNode(node, ts.Diagnostics.Import_assignment_cannot_be_used_when_targeting_ECMAScript_6_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead); + } + } + } + } + function checkExportDeclaration(node) { + if (checkGrammarModuleElementContext(node, ts.Diagnostics.An_export_declaration_can_only_be_used_in_a_module)) { + return; + } + if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && (node.flags & 1023)) { + grammarErrorOnFirstToken(node, ts.Diagnostics.An_export_declaration_cannot_have_modifiers); + } + if (!node.moduleSpecifier || checkExternalImportOrExportDeclaration(node)) { + if (node.exportClause) { + ts.forEach(node.exportClause.elements, checkExportSpecifier); + var inAmbientExternalModule = node.parent.kind === 226 && ts.isAmbientModule(node.parent.parent); + if (node.parent.kind !== 256 && !inAmbientExternalModule) { + error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace); + } + } + else { + var moduleSymbol = resolveExternalModuleName(node, node.moduleSpecifier); + if (moduleSymbol && hasExportAssignmentSymbol(moduleSymbol)) { + error(node.moduleSpecifier, ts.Diagnostics.Module_0_uses_export_and_cannot_be_used_with_export_Asterisk, symbolToString(moduleSymbol)); + } + } + } + } + function checkGrammarModuleElementContext(node, errorMessage) { + if (node.parent.kind !== 256 && node.parent.kind !== 226 && node.parent.kind !== 225) { + return grammarErrorOnFirstToken(node, errorMessage); + } + } + function checkExportSpecifier(node) { + checkAliasSymbol(node); + if (!node.parent.parent.moduleSpecifier) { + var exportedName = node.propertyName || node.name; + var symbol = resolveName(exportedName, exportedName.text, 107455 | 793056 | 1536 | 8388608, undefined, undefined); + if (symbol && (symbol === undefinedSymbol || isGlobalSourceFile(getDeclarationContainer(symbol.declarations[0])))) { + error(exportedName, ts.Diagnostics.Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module, exportedName.text); + } + else { + markExportAsReferenced(node); + } + } + } + function checkExportAssignment(node) { + if (checkGrammarModuleElementContext(node, ts.Diagnostics.An_export_assignment_can_only_be_used_in_a_module)) { + return; + } + var container = node.parent.kind === 256 ? node.parent : node.parent.parent; + if (container.kind === 225 && !ts.isAmbientModule(container)) { + error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); + return; + } + if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && (node.flags & 1023)) { + grammarErrorOnFirstToken(node, ts.Diagnostics.An_export_assignment_cannot_have_modifiers); + } + if (node.expression.kind === 69) { + markExportAsReferenced(node); + } + else { + checkExpressionCached(node.expression); + } + checkExternalModuleExports(container); + if (node.isExportEquals && !ts.isInAmbientContext(node)) { + if (modulekind === ts.ModuleKind.ES6) { + grammarErrorOnNode(node, ts.Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_6_modules_Consider_using_export_default_or_another_module_format_instead); + } + else if (modulekind === ts.ModuleKind.System) { + grammarErrorOnNode(node, ts.Diagnostics.Export_assignment_is_not_supported_when_module_flag_is_system); + } + } + } + function hasExportedMembers(moduleSymbol) { + for (var id in moduleSymbol.exports) { + if (id !== "export=") { + return true; + } + } + return false; + } + function checkExternalModuleExports(node) { + var moduleSymbol = getSymbolOfNode(node); + var links = getSymbolLinks(moduleSymbol); + if (!links.exportsChecked) { + var exportEqualsSymbol = moduleSymbol.exports["export="]; + if (exportEqualsSymbol && hasExportedMembers(moduleSymbol)) { + var declaration = getDeclarationOfAliasSymbol(exportEqualsSymbol) || exportEqualsSymbol.valueDeclaration; + if (!isTopLevelInExternalModuleAugmentation(declaration)) { + error(declaration, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements); + } + } + var exports = getExportsOfModule(moduleSymbol); + for (var id in exports) { + if (id === "__export") { + continue; + } + var _a = exports[id], declarations = _a.declarations, flags = _a.flags; + if (flags & (1536 | 64 | 384)) { + continue; + } + var exportedDeclarationsCount = ts.countWhere(declarations, isNotOverload); + if (flags & 524288 && exportedDeclarationsCount <= 2) { + continue; + } + if (exportedDeclarationsCount > 1) { + for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) { + var declaration = declarations_6[_i]; + if (isNotOverload(declaration)) { + diagnostics.add(ts.createDiagnosticForNode(declaration, ts.Diagnostics.Cannot_redeclare_exported_variable_0, id)); + } + } + } + } + links.exportsChecked = true; + } + function isNotOverload(declaration) { + return declaration.kind !== 220 || !!declaration.body; + } + } + function checkSourceElement(node) { + if (!node) { + return; + } + var kind = node.kind; + if (cancellationToken) { + switch (kind) { + case 225: + case 221: + case 222: + case 220: + cancellationToken.throwIfCancellationRequested(); + } + } + switch (kind) { + case 141: + return checkTypeParameter(node); + case 142: + return checkParameter(node); + case 145: + case 144: + return checkPropertyDeclaration(node); + case 156: + case 157: + case 151: + case 152: + return checkSignatureDeclaration(node); + case 153: + return checkSignatureDeclaration(node); + case 147: + case 146: + return checkMethodDeclaration(node); + case 148: + return checkConstructorDeclaration(node); + case 149: + case 150: + return checkAccessorDeclaration(node); + case 155: + return checkTypeReferenceNode(node); + case 154: + return checkTypePredicate(node); + case 158: + return checkTypeQuery(node); + case 159: + return checkTypeLiteral(node); + case 160: + return checkArrayType(node); + case 161: + return checkTupleType(node); + case 162: + case 163: + return checkUnionOrIntersectionType(node); + case 164: + return checkSourceElement(node.type); + case 220: + return checkFunctionDeclaration(node); + case 199: + case 226: + return checkBlock(node); + case 200: + return checkVariableStatement(node); + case 202: + return checkExpressionStatement(node); + case 203: + return checkIfStatement(node); + case 204: + return checkDoStatement(node); + case 205: + return checkWhileStatement(node); + case 206: + return checkForStatement(node); + case 207: + return checkForInStatement(node); + case 208: + return checkForOfStatement(node); + case 209: + case 210: + return checkBreakOrContinueStatement(node); + case 211: + return checkReturnStatement(node); + case 212: + return checkWithStatement(node); + case 213: + return checkSwitchStatement(node); + case 214: + return checkLabeledStatement(node); + case 215: + return checkThrowStatement(node); + case 216: + return checkTryStatement(node); + case 218: + return checkVariableDeclaration(node); + case 169: + return checkBindingElement(node); + case 221: + return checkClassDeclaration(node); + case 222: + return checkInterfaceDeclaration(node); + case 223: + return checkTypeAliasDeclaration(node); + case 224: + return checkEnumDeclaration(node); + case 225: + return checkModuleDeclaration(node); + case 230: + return checkImportDeclaration(node); + case 229: + return checkImportEqualsDeclaration(node); + case 236: + return checkExportDeclaration(node); + case 235: + return checkExportAssignment(node); + case 201: + checkGrammarStatementInAmbientContext(node); + return; + case 217: + checkGrammarStatementInAmbientContext(node); + return; + case 239: + return checkMissingDeclaration(node); + } + } + function checkNodeDeferred(node) { + if (deferredNodes) { + deferredNodes.push(node); + } + } + function checkDeferredNodes() { + for (var _i = 0, deferredNodes_1 = deferredNodes; _i < deferredNodes_1.length; _i++) { + var node = deferredNodes_1[_i]; + switch (node.kind) { + case 179: + case 180: + case 147: + case 146: + checkFunctionExpressionOrObjectLiteralMethodDeferred(node); + break; + case 149: + case 150: + checkAccessorDeferred(node); + break; + case 192: + checkClassExpressionDeferred(node); + break; + } + } + } + function checkSourceFile(node) { + var start = new Date().getTime(); + checkSourceFileWorker(node); + ts.checkTime += new Date().getTime() - start; + } + function checkSourceFileWorker(node) { + var links = getNodeLinks(node); + if (!(links.flags & 1)) { + if (compilerOptions.skipDefaultLibCheck) { + if (node.hasNoDefaultLib) { + return; + } + } + checkGrammarSourceFile(node); + potentialThisCollisions.length = 0; + deferredNodes = []; + ts.forEach(node.statements, checkSourceElement); + checkDeferredNodes(); + deferredNodes = undefined; + if (ts.isExternalOrCommonJsModule(node)) { + checkExternalModuleExports(node); + } + if (potentialThisCollisions.length) { + ts.forEach(potentialThisCollisions, checkIfThisIsCapturedInEnclosingScope); + potentialThisCollisions.length = 0; + } + links.flags |= 1; + } + } + function getDiagnostics(sourceFile, ct) { + try { + cancellationToken = ct; + return getDiagnosticsWorker(sourceFile); + } + finally { + cancellationToken = undefined; + } + } + function getDiagnosticsWorker(sourceFile) { + throwIfNonDiagnosticsProducing(); + if (sourceFile) { + checkSourceFile(sourceFile); + return diagnostics.getDiagnostics(sourceFile.fileName); + } + ts.forEach(host.getSourceFiles(), checkSourceFile); + return diagnostics.getDiagnostics(); + } + function getGlobalDiagnostics() { + throwIfNonDiagnosticsProducing(); + return diagnostics.getGlobalDiagnostics(); + } + function throwIfNonDiagnosticsProducing() { + if (!produceDiagnostics) { + throw new Error("Trying to get diagnostics from a type checker that does not produce them."); + } + } + function isInsideWithStatementBody(node) { + if (node) { + while (node.parent) { + if (node.parent.kind === 212 && node.parent.statement === node) { + return true; + } + node = node.parent; + } + } + return false; + } + function getSymbolsInScope(location, meaning) { + var symbols = {}; + var memberFlags = 0; + if (isInsideWithStatementBody(location)) { + return []; + } + populateSymbols(); + return symbolsToArray(symbols); + function populateSymbols() { + while (location) { + if (location.locals && !isGlobalSourceFile(location)) { + copySymbols(location.locals, meaning); + } + switch (location.kind) { + case 256: + if (!ts.isExternalOrCommonJsModule(location)) { + break; + } + case 225: + copySymbols(getSymbolOfNode(location).exports, meaning & 8914931); + break; + case 224: + copySymbols(getSymbolOfNode(location).exports, meaning & 8); + break; + case 192: + var className = location.name; + if (className) { + copySymbol(location.symbol, meaning); + } + case 221: + case 222: + if (!(memberFlags & 32)) { + copySymbols(getSymbolOfNode(location).members, meaning & 793056); + } + break; + case 179: + var funcName = location.name; + if (funcName) { + copySymbol(location.symbol, meaning); + } + break; + } + if (ts.introducesArgumentsExoticObject(location)) { + copySymbol(argumentsSymbol, meaning); + } + memberFlags = location.flags; + location = location.parent; + } + copySymbols(globals, meaning); + } + function copySymbol(symbol, meaning) { + if (symbol.flags & meaning) { + var id = symbol.name; + if (!ts.hasProperty(symbols, id)) { + symbols[id] = symbol; + } + } + } + function copySymbols(source, meaning) { + if (meaning) { + for (var id in source) { + var symbol = source[id]; + copySymbol(symbol, meaning); + } + } + } + } + function isTypeDeclarationName(name) { + return name.kind === 69 && + isTypeDeclaration(name.parent) && + name.parent.name === name; + } + function isTypeDeclaration(node) { + switch (node.kind) { + case 141: + case 221: + case 222: + case 223: + case 224: + return true; + } + } + function isTypeReferenceIdentifier(entityName) { + var node = entityName; + while (node.parent && node.parent.kind === 139) { + node = node.parent; + } + return node.parent && node.parent.kind === 155; + } + function isHeritageClauseElementIdentifier(entityName) { + var node = entityName; + while (node.parent && node.parent.kind === 172) { + node = node.parent; + } + return node.parent && node.parent.kind === 194; + } + function forEachEnclosingClass(node, callback) { + var result; + while (true) { + node = ts.getContainingClass(node); + if (!node) + break; + if (result = callback(node)) + break; + } + return result; + } + function isNodeWithinClass(node, classDeclaration) { + return !!forEachEnclosingClass(node, function (n) { return n === classDeclaration; }); + } + function getLeftSideOfImportEqualsOrExportAssignment(nodeOnRightSide) { + while (nodeOnRightSide.parent.kind === 139) { + nodeOnRightSide = nodeOnRightSide.parent; + } + if (nodeOnRightSide.parent.kind === 229) { + return nodeOnRightSide.parent.moduleReference === nodeOnRightSide && nodeOnRightSide.parent; + } + if (nodeOnRightSide.parent.kind === 235) { + return nodeOnRightSide.parent.expression === nodeOnRightSide && nodeOnRightSide.parent; + } + return undefined; + } + function isInRightSideOfImportOrExportAssignment(node) { + return getLeftSideOfImportEqualsOrExportAssignment(node) !== undefined; + } + function getSymbolOfEntityNameOrPropertyAccessExpression(entityName) { + if (ts.isDeclarationName(entityName)) { + return getSymbolOfNode(entityName.parent); + } + if (ts.isInJavaScriptFile(entityName) && entityName.parent.kind === 172) { + var specialPropertyAssignmentKind = ts.getSpecialPropertyAssignmentKind(entityName.parent.parent); + switch (specialPropertyAssignmentKind) { + case 1: + case 3: + return getSymbolOfNode(entityName.parent); + case 4: + case 2: + return getSymbolOfNode(entityName.parent.parent); + default: + } + } + if (entityName.parent.kind === 235) { + return resolveEntityName(entityName, 107455 | 793056 | 1536 | 8388608); + } + if (entityName.kind !== 172) { + if (isInRightSideOfImportOrExportAssignment(entityName)) { + return getSymbolOfPartOfRightHandSideOfImportEquals(entityName); + } + } + if (ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { + entityName = entityName.parent; + } + if (isHeritageClauseElementIdentifier(entityName)) { + var meaning = 0; + if (entityName.parent.kind === 194) { + meaning = 793056; + if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) { + meaning |= 107455; + } + } + else { + meaning = 1536; + } + meaning |= 8388608; + return resolveEntityName(entityName, meaning); + } + else if (ts.isExpression(entityName)) { + if (ts.nodeIsMissing(entityName)) { + return undefined; + } + if (entityName.kind === 69) { + if (ts.isJSXTagName(entityName) && isJsxIntrinsicIdentifier(entityName)) { + return getIntrinsicTagSymbol(entityName.parent); + } + var meaning = 107455 | 8388608; + return resolveEntityName(entityName, meaning); + } + else if (entityName.kind === 172) { + var symbol = getNodeLinks(entityName).resolvedSymbol; + if (!symbol) { + checkPropertyAccessExpression(entityName); + } + return getNodeLinks(entityName).resolvedSymbol; + } + else if (entityName.kind === 139) { + var symbol = getNodeLinks(entityName).resolvedSymbol; + if (!symbol) { + checkQualifiedName(entityName); + } + return getNodeLinks(entityName).resolvedSymbol; + } + } + else if (isTypeReferenceIdentifier(entityName)) { + var meaning = entityName.parent.kind === 155 ? 793056 : 1536; + meaning |= 8388608; + return resolveEntityName(entityName, meaning); + } + else if (entityName.parent.kind === 246) { + return getJsxAttributePropertySymbol(entityName.parent); + } + if (entityName.parent.kind === 154) { + return resolveEntityName(entityName, 1); + } + return undefined; + } + function getSymbolAtLocation(node) { + if (node.kind === 256) { + return ts.isExternalModule(node) ? getMergedSymbol(node.symbol) : undefined; + } + if (isInsideWithStatementBody(node)) { + return undefined; + } + if (ts.isDeclarationName(node)) { + return getSymbolOfNode(node.parent); + } + else if (ts.isLiteralComputedPropertyDeclarationName(node)) { + return getSymbolOfNode(node.parent.parent); + } + if (node.kind === 69) { + if (isInRightSideOfImportOrExportAssignment(node)) { + return node.parent.kind === 235 + ? getSymbolOfEntityNameOrPropertyAccessExpression(node) + : getSymbolOfPartOfRightHandSideOfImportEquals(node); + } + else if (node.parent.kind === 169 && + node.parent.parent.kind === 167 && + node === node.parent.propertyName) { + var typeOfPattern = getTypeOfNode(node.parent.parent); + var propertyDeclaration = typeOfPattern && getPropertyOfType(typeOfPattern, node.text); + if (propertyDeclaration) { + return propertyDeclaration; + } + } + } + switch (node.kind) { + case 69: + case 172: + case 139: + return getSymbolOfEntityNameOrPropertyAccessExpression(node); + case 97: + case 95: + var type = ts.isExpression(node) ? checkExpression(node) : getTypeFromTypeNode(node); + return type.symbol; + case 165: + return getTypeFromTypeNode(node).symbol; + case 121: + var constructorDeclaration = node.parent; + if (constructorDeclaration && constructorDeclaration.kind === 148) { + return constructorDeclaration.parent.symbol; + } + return undefined; + case 9: + if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && + ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || + ((node.parent.kind === 230 || node.parent.kind === 236) && + node.parent.moduleSpecifier === node)) { + return resolveExternalModuleName(node, node); + } + case 8: + if (node.parent.kind === 173 && node.parent.argumentExpression === node) { + var objectType = checkExpression(node.parent.expression); + if (objectType === unknownType) + return undefined; + var apparentType = getApparentType(objectType); + if (apparentType === unknownType) + return undefined; + return getPropertyOfType(apparentType, node.text); + } + break; + } + return undefined; + } + function getShorthandAssignmentValueSymbol(location) { + if (location && location.kind === 254) { + return resolveEntityName(location.name, 107455 | 8388608); + } + return undefined; + } + function getExportSpecifierLocalTargetSymbol(node) { + return node.parent.parent.moduleSpecifier ? + getExternalModuleMember(node.parent.parent, node) : + resolveEntityName(node.propertyName || node.name, 107455 | 793056 | 1536 | 8388608); + } + function getTypeOfNode(node) { + if (isInsideWithStatementBody(node)) { + return unknownType; + } + if (ts.isTypeNode(node)) { + return getTypeFromTypeNode(node); + } + if (ts.isExpression(node)) { + return getTypeOfExpression(node); + } + if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(node)) { + return getBaseTypes(getDeclaredTypeOfSymbol(getSymbolOfNode(node.parent.parent)))[0]; + } + if (isTypeDeclaration(node)) { + var symbol = getSymbolOfNode(node); + return getDeclaredTypeOfSymbol(symbol); + } + if (isTypeDeclarationName(node)) { + var symbol = getSymbolAtLocation(node); + return symbol && getDeclaredTypeOfSymbol(symbol); + } + if (ts.isDeclaration(node)) { + var symbol = getSymbolOfNode(node); + return getTypeOfSymbol(symbol); + } + if (ts.isDeclarationName(node)) { + var symbol = getSymbolAtLocation(node); + return symbol && getTypeOfSymbol(symbol); + } + if (ts.isBindingPattern(node)) { + return getTypeForVariableLikeDeclaration(node.parent); + } + if (isInRightSideOfImportOrExportAssignment(node)) { + var symbol = getSymbolAtLocation(node); + var declaredType = symbol && getDeclaredTypeOfSymbol(symbol); + return declaredType !== unknownType ? declaredType : getTypeOfSymbol(symbol); + } + return unknownType; + } + function getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr) { + ts.Debug.assert(expr.kind === 171 || expr.kind === 170); + if (expr.parent.kind === 208) { + var iteratedType = checkRightHandSideOfForOf(expr.parent.expression); + return checkDestructuringAssignment(expr, iteratedType || unknownType); + } + if (expr.parent.kind === 187) { + var iteratedType = checkExpression(expr.parent.right); + return checkDestructuringAssignment(expr, iteratedType || unknownType); + } + if (expr.parent.kind === 253) { + var typeOfParentObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent.parent); + return checkObjectLiteralDestructuringPropertyAssignment(typeOfParentObjectLiteral || unknownType, expr.parent); + } + ts.Debug.assert(expr.parent.kind === 170); + var typeOfArrayLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent); + var elementType = checkIteratedTypeOrElementType(typeOfArrayLiteral || unknownType, expr.parent, false) || unknownType; + return checkArrayLiteralDestructuringElementAssignment(expr.parent, typeOfArrayLiteral, ts.indexOf(expr.parent.elements, expr), elementType || unknownType); + } + function getPropertySymbolOfDestructuringAssignment(location) { + var typeOfObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(location.parent.parent); + return typeOfObjectLiteral && getPropertyOfType(typeOfObjectLiteral, location.text); + } + function getTypeOfExpression(expr) { + if (ts.isRightSideOfQualifiedNameOrPropertyAccess(expr)) { + expr = expr.parent; + } + return checkExpression(expr); + } + function getParentTypeOfClassElement(node) { + var classSymbol = getSymbolOfNode(node.parent); + return node.flags & 32 + ? getTypeOfSymbol(classSymbol) + : getDeclaredTypeOfSymbol(classSymbol); + } + function getAugmentedPropertiesOfType(type) { + type = getApparentType(type); + var propsByName = createSymbolTable(getPropertiesOfType(type)); + if (getSignaturesOfType(type, 0).length || getSignaturesOfType(type, 1).length) { + ts.forEach(getPropertiesOfType(globalFunctionType), function (p) { + if (!ts.hasProperty(propsByName, p.name)) { + propsByName[p.name] = p; + } + }); + } + return getNamedMembers(propsByName); + } + function getRootSymbols(symbol) { + if (symbol.flags & 268435456) { + var symbols_3 = []; + var name_19 = symbol.name; + ts.forEach(getSymbolLinks(symbol).containingType.types, function (t) { + var symbol = getPropertyOfType(t, name_19); + if (symbol) { + symbols_3.push(symbol); + } + }); + return symbols_3; + } + else if (symbol.flags & 67108864) { + var target = void 0; + var next = symbol; + while (next = getSymbolLinks(next).target) { + target = next; + } + if (target) { + return [target]; + } + } + return [symbol]; + } + function isArgumentsLocalBinding(node) { + return getReferencedValueSymbol(node) === argumentsSymbol; + } + function moduleExportsSomeValue(moduleReferenceExpression) { + var moduleSymbol = resolveExternalModuleName(moduleReferenceExpression.parent, moduleReferenceExpression); + if (!moduleSymbol) { + return true; + } + var hasExportAssignment = hasExportAssignmentSymbol(moduleSymbol); + moduleSymbol = resolveExternalModuleSymbol(moduleSymbol); + var symbolLinks = getSymbolLinks(moduleSymbol); + if (symbolLinks.exportsSomeValue === undefined) { + symbolLinks.exportsSomeValue = hasExportAssignment + ? !!(moduleSymbol.flags & 107455) + : ts.forEachValue(getExportsOfModule(moduleSymbol), isValue); + } + return symbolLinks.exportsSomeValue; + function isValue(s) { + s = resolveSymbol(s); + return s && !!(s.flags & 107455); + } + } + function getReferencedExportContainer(node) { + var symbol = getReferencedValueSymbol(node); + if (symbol) { + if (symbol.flags & 1048576) { + var exportSymbol = getMergedSymbol(symbol.exportSymbol); + if (exportSymbol.flags & 944) { + return undefined; + } + symbol = exportSymbol; + } + var parentSymbol = getParentOfSymbol(symbol); + if (parentSymbol) { + if (parentSymbol.flags & 512 && parentSymbol.valueDeclaration.kind === 256) { + return parentSymbol.valueDeclaration; + } + for (var n = node.parent; n; n = n.parent) { + if ((n.kind === 225 || n.kind === 224) && getSymbolOfNode(n) === parentSymbol) { + return n; + } + } + } + } + } + function getReferencedImportDeclaration(node) { + var symbol = getReferencedValueSymbol(node); + return symbol && symbol.flags & 8388608 ? getDeclarationOfAliasSymbol(symbol) : undefined; + } + function isSymbolOfDeclarationWithCollidingName(symbol) { + if (symbol.flags & 418) { + var links = getSymbolLinks(symbol); + if (links.isDeclarationWithCollidingName === undefined) { + var container = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration); + if (ts.isStatementWithLocals(container)) { + var nodeLinks_1 = getNodeLinks(symbol.valueDeclaration); + if (!!resolveName(container.parent, symbol.name, 107455, undefined, undefined)) { + links.isDeclarationWithCollidingName = true; + } + else if (nodeLinks_1.flags & 131072) { + var isDeclaredInLoop = nodeLinks_1.flags & 262144; + var inLoopInitializer = ts.isIterationStatement(container, false); + var inLoopBodyBlock = container.kind === 199 && ts.isIterationStatement(container.parent, false); + links.isDeclarationWithCollidingName = !ts.isBlockScopedContainerTopLevel(container) && (!isDeclaredInLoop || (!inLoopInitializer && !inLoopBodyBlock)); + } + else { + links.isDeclarationWithCollidingName = false; + } + } + } + return links.isDeclarationWithCollidingName; + } + return false; + } + function getReferencedDeclarationWithCollidingName(node) { + var symbol = getReferencedValueSymbol(node); + return symbol && isSymbolOfDeclarationWithCollidingName(symbol) ? symbol.valueDeclaration : undefined; + } + function isDeclarationWithCollidingName(node) { + return isSymbolOfDeclarationWithCollidingName(getSymbolOfNode(node)); + } + function isValueAliasDeclaration(node) { + switch (node.kind) { + case 229: + case 231: + case 232: + case 234: + case 238: + return isAliasResolvedToValue(getSymbolOfNode(node)); + case 236: + var exportClause = node.exportClause; + return exportClause && ts.forEach(exportClause.elements, isValueAliasDeclaration); + case 235: + return node.expression && node.expression.kind === 69 ? isAliasResolvedToValue(getSymbolOfNode(node)) : true; + } + return false; + } + function isTopLevelValueImportEqualsWithEntityName(node) { + if (node.parent.kind !== 256 || !ts.isInternalModuleImportEqualsDeclaration(node)) { + return false; + } + var isValue = isAliasResolvedToValue(getSymbolOfNode(node)); + return isValue && node.moduleReference && !ts.nodeIsMissing(node.moduleReference); + } + function isAliasResolvedToValue(symbol) { + var target = resolveAlias(symbol); + if (target === unknownSymbol) { + return true; + } + return target.flags & 107455 && + (compilerOptions.preserveConstEnums || !isConstEnumOrConstEnumOnlyModule(target)); + } + function isConstEnumOrConstEnumOnlyModule(s) { + return isConstEnumSymbol(s) || s.constEnumOnlyModule; + } + function isReferencedAliasDeclaration(node, checkChildren) { + if (ts.isAliasSymbolDeclaration(node)) { + var symbol = getSymbolOfNode(node); + if (getSymbolLinks(symbol).referenced) { + return true; + } + } + if (checkChildren) { + return ts.forEachChild(node, function (node) { return isReferencedAliasDeclaration(node, checkChildren); }); + } + return false; + } + function isImplementationOfOverload(node) { + if (ts.nodeIsPresent(node.body)) { + var symbol = getSymbolOfNode(node); + var signaturesOfSymbol = getSignaturesOfSymbol(symbol); + return signaturesOfSymbol.length > 1 || + (signaturesOfSymbol.length === 1 && signaturesOfSymbol[0].declaration !== node); + } + return false; + } + function getNodeCheckFlags(node) { + return getNodeLinks(node).flags; + } + function getEnumMemberValue(node) { + computeEnumMemberValues(node.parent); + return getNodeLinks(node).enumMemberValue; + } + function getConstantValue(node) { + if (node.kind === 255) { + return getEnumMemberValue(node); + } + var symbol = getNodeLinks(node).resolvedSymbol; + if (symbol && (symbol.flags & 8)) { + if (ts.isConstEnumDeclaration(symbol.valueDeclaration.parent)) { + return getEnumMemberValue(symbol.valueDeclaration); + } + } + return undefined; + } + function isFunctionType(type) { + return type.flags & 80896 && getSignaturesOfType(type, 0).length > 0; + } + function getTypeReferenceSerializationKind(typeName) { + var valueSymbol = resolveEntityName(typeName, 107455, true); + var constructorType = valueSymbol ? getTypeOfSymbol(valueSymbol) : undefined; + if (constructorType && isConstructorType(constructorType)) { + return ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue; + } + var typeSymbol = resolveEntityName(typeName, 793056, true); + if (!typeSymbol) { + return ts.TypeReferenceSerializationKind.ObjectType; + } + var type = getDeclaredTypeOfSymbol(typeSymbol); + if (type === unknownType) { + return ts.TypeReferenceSerializationKind.Unknown; + } + else if (type.flags & 1) { + return ts.TypeReferenceSerializationKind.ObjectType; + } + else if (isTypeOfKind(type, 16)) { + return ts.TypeReferenceSerializationKind.VoidType; + } + else if (isTypeOfKind(type, 8)) { + return ts.TypeReferenceSerializationKind.BooleanType; + } + else if (isTypeOfKind(type, 132)) { + return ts.TypeReferenceSerializationKind.NumberLikeType; + } + else if (isTypeOfKind(type, 258)) { + return ts.TypeReferenceSerializationKind.StringLikeType; + } + else if (isTypeOfKind(type, 8192)) { + return ts.TypeReferenceSerializationKind.ArrayLikeType; + } + else if (isTypeOfKind(type, 16777216)) { + return ts.TypeReferenceSerializationKind.ESSymbolType; + } + else if (isFunctionType(type)) { + return ts.TypeReferenceSerializationKind.TypeWithCallSignature; + } + else if (isArrayType(type)) { + return ts.TypeReferenceSerializationKind.ArrayLikeType; + } + else { + return ts.TypeReferenceSerializationKind.ObjectType; + } + } + function writeTypeOfDeclaration(declaration, enclosingDeclaration, flags, writer) { + var symbol = getSymbolOfNode(declaration); + var type = symbol && !(symbol.flags & (2048 | 131072)) + ? getTypeOfSymbol(symbol) + : unknownType; + getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags); + } + function writeReturnTypeOfSignatureDeclaration(signatureDeclaration, enclosingDeclaration, flags, writer) { + var signature = getSignatureFromDeclaration(signatureDeclaration); + getSymbolDisplayBuilder().buildTypeDisplay(getReturnTypeOfSignature(signature), writer, enclosingDeclaration, flags); + } + function writeTypeOfExpression(expr, enclosingDeclaration, flags, writer) { + var type = getWidenedType(getTypeOfExpression(expr)); + getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags); + } + function writeBaseConstructorTypeOfClass(node, enclosingDeclaration, flags, writer) { + var classType = getDeclaredTypeOfSymbol(getSymbolOfNode(node)); + resolveBaseTypesOfClass(classType); + var baseType = classType.resolvedBaseTypes.length ? classType.resolvedBaseTypes[0] : unknownType; + getSymbolDisplayBuilder().buildTypeDisplay(baseType, writer, enclosingDeclaration, flags); + } + function hasGlobalName(name) { + return ts.hasProperty(globals, name); + } + function getReferencedValueSymbol(reference) { + return getNodeLinks(reference).resolvedSymbol || + resolveName(reference, reference.text, 107455 | 1048576 | 8388608, undefined, undefined); + } + function getReferencedValueDeclaration(reference) { + ts.Debug.assert(!ts.nodeIsSynthesized(reference)); + var symbol = getReferencedValueSymbol(reference); + return symbol && getExportSymbolOfValueSymbolIfExported(symbol).valueDeclaration; + } + function createResolver() { + var resolvedTypeReferenceDirectives = host.getResolvedTypeReferenceDirectives(); + var fileToDirective; + if (resolvedTypeReferenceDirectives) { + fileToDirective = ts.createFileMap(); + for (var key in resolvedTypeReferenceDirectives) { + if (!ts.hasProperty(resolvedTypeReferenceDirectives, key)) { + continue; + } + var resolvedDirective = resolvedTypeReferenceDirectives[key]; + if (!resolvedDirective) { + continue; + } + var file = host.getSourceFile(resolvedDirective.resolvedFileName); + fileToDirective.set(file.path, key); + } + } + return { + getReferencedExportContainer: getReferencedExportContainer, + getReferencedImportDeclaration: getReferencedImportDeclaration, + getReferencedDeclarationWithCollidingName: getReferencedDeclarationWithCollidingName, + isDeclarationWithCollidingName: isDeclarationWithCollidingName, + isValueAliasDeclaration: isValueAliasDeclaration, + hasGlobalName: hasGlobalName, + isReferencedAliasDeclaration: isReferencedAliasDeclaration, + getNodeCheckFlags: getNodeCheckFlags, + isTopLevelValueImportEqualsWithEntityName: isTopLevelValueImportEqualsWithEntityName, + isDeclarationVisible: isDeclarationVisible, + isImplementationOfOverload: isImplementationOfOverload, + writeTypeOfDeclaration: writeTypeOfDeclaration, + writeReturnTypeOfSignatureDeclaration: writeReturnTypeOfSignatureDeclaration, + writeTypeOfExpression: writeTypeOfExpression, + writeBaseConstructorTypeOfClass: writeBaseConstructorTypeOfClass, + isSymbolAccessible: isSymbolAccessible, + isEntityNameVisible: isEntityNameVisible, + getConstantValue: getConstantValue, + collectLinkedAliases: collectLinkedAliases, + getReferencedValueDeclaration: getReferencedValueDeclaration, + getTypeReferenceSerializationKind: getTypeReferenceSerializationKind, + isOptionalParameter: isOptionalParameter, + moduleExportsSomeValue: moduleExportsSomeValue, + isArgumentsLocalBinding: isArgumentsLocalBinding, + getExternalModuleFileFromDeclaration: getExternalModuleFileFromDeclaration, + getTypeReferenceDirectivesForEntityName: getTypeReferenceDirectivesForEntityName, + getTypeReferenceDirectivesForSymbol: getTypeReferenceDirectivesForSymbol + }; + function getTypeReferenceDirectivesForEntityName(node) { + if (!fileToDirective) { + return undefined; + } + var meaning = (node.kind === 172) || (node.kind === 69 && isInTypeQuery(node)) + ? 107455 | 1048576 + : 793056 | 1536; + var symbol = resolveEntityName(node, meaning, true); + return symbol && symbol !== unknownSymbol ? getTypeReferenceDirectivesForSymbol(symbol, meaning) : undefined; + } + function getTypeReferenceDirectivesForSymbol(symbol, meaning) { + if (!fileToDirective) { + return undefined; + } + if (!isSymbolFromTypeDeclarationFile(symbol)) { + return undefined; + } + var typeReferenceDirectives; + for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { + var decl = _a[_i]; + if (decl.symbol && decl.symbol.flags & meaning) { + var file = ts.getSourceFileOfNode(decl); + var typeReferenceDirective = fileToDirective.get(file.path); + if (typeReferenceDirective) { + (typeReferenceDirectives || (typeReferenceDirectives = [])).push(typeReferenceDirective); + } + } + } + return typeReferenceDirectives; + } + function isSymbolFromTypeDeclarationFile(symbol) { + if (!symbol.declarations) { + return false; + } + var current = symbol; + while (true) { + var parent_12 = getParentOfSymbol(current); + if (parent_12) { + current = parent_12; + } + else { + break; + } + } + if (current.valueDeclaration && current.valueDeclaration.kind === 256 && current.flags & 512) { + return false; + } + for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { + var decl = _a[_i]; + var file = ts.getSourceFileOfNode(decl); + if (fileToDirective.contains(file.path)) { + return true; + } + } + return false; + } + } + function getExternalModuleFileFromDeclaration(declaration) { + var specifier = ts.getExternalModuleName(declaration); + var moduleSymbol = resolveExternalModuleNameWorker(specifier, specifier, undefined); + if (!moduleSymbol) { + return undefined; + } + return ts.getDeclarationOfKind(moduleSymbol, 256); + } + function initializeTypeChecker() { + ts.forEach(host.getSourceFiles(), function (file) { + ts.bindSourceFile(file, compilerOptions); + }); + var augmentations; + ts.forEach(host.getSourceFiles(), function (file) { + if (!ts.isExternalOrCommonJsModule(file)) { + mergeSymbolTable(globals, file.locals); + } + if (file.moduleAugmentations.length) { + (augmentations || (augmentations = [])).push(file.moduleAugmentations); + } + if (file.wasReferenced && file.symbol && file.symbol.globalExports) { + mergeSymbolTable(globals, file.symbol.globalExports); + } + }); + if (augmentations) { + for (var _i = 0, augmentations_1 = augmentations; _i < augmentations_1.length; _i++) { + var list = augmentations_1[_i]; + for (var _a = 0, list_2 = list; _a < list_2.length; _a++) { + var augmentation = list_2[_a]; + mergeModuleAugmentation(augmentation); + } + } + } + addToSymbolTable(globals, builtinGlobals, ts.Diagnostics.Declaration_name_conflicts_with_built_in_global_identifier_0); + getSymbolLinks(undefinedSymbol).type = undefinedType; + getSymbolLinks(argumentsSymbol).type = getGlobalType("IArguments"); + getSymbolLinks(unknownSymbol).type = unknownType; + globalArrayType = getGlobalType("Array", 1); + globalObjectType = getGlobalType("Object"); + globalFunctionType = getGlobalType("Function"); + globalStringType = getGlobalType("String"); + globalNumberType = getGlobalType("Number"); + globalBooleanType = getGlobalType("Boolean"); + globalRegExpType = getGlobalType("RegExp"); + jsxElementType = getExportedTypeFromNamespace("JSX", JsxNames.Element); + getGlobalClassDecoratorType = ts.memoize(function () { return getGlobalType("ClassDecorator"); }); + getGlobalPropertyDecoratorType = ts.memoize(function () { return getGlobalType("PropertyDecorator"); }); + getGlobalMethodDecoratorType = ts.memoize(function () { return getGlobalType("MethodDecorator"); }); + getGlobalParameterDecoratorType = ts.memoize(function () { return getGlobalType("ParameterDecorator"); }); + getGlobalTypedPropertyDescriptorType = ts.memoize(function () { return getGlobalType("TypedPropertyDescriptor", 1); }); + getGlobalESSymbolConstructorSymbol = ts.memoize(function () { return getGlobalValueSymbol("Symbol"); }); + getGlobalPromiseType = ts.memoize(function () { return getGlobalType("Promise", 1); }); + tryGetGlobalPromiseType = ts.memoize(function () { return getGlobalSymbol("Promise", 793056, undefined) && getGlobalPromiseType(); }); + getGlobalPromiseLikeType = ts.memoize(function () { return getGlobalType("PromiseLike", 1); }); + getInstantiatedGlobalPromiseLikeType = ts.memoize(createInstantiatedPromiseLikeType); + getGlobalPromiseConstructorSymbol = ts.memoize(function () { return getGlobalValueSymbol("Promise"); }); + getGlobalPromiseConstructorLikeType = ts.memoize(function () { return getGlobalType("PromiseConstructorLike"); }); + getGlobalThenableType = ts.memoize(createThenableType); + getGlobalTemplateStringsArrayType = ts.memoize(function () { return getGlobalType("TemplateStringsArray"); }); + if (languageVersion >= 2) { + getGlobalESSymbolType = ts.memoize(function () { return getGlobalType("Symbol"); }); + getGlobalIterableType = ts.memoize(function () { return getGlobalType("Iterable", 1); }); + getGlobalIteratorType = ts.memoize(function () { return getGlobalType("Iterator", 1); }); + getGlobalIterableIteratorType = ts.memoize(function () { return getGlobalType("IterableIterator", 1); }); + } + else { + getGlobalESSymbolType = ts.memoize(function () { return emptyObjectType; }); + getGlobalIterableType = ts.memoize(function () { return emptyGenericType; }); + getGlobalIteratorType = ts.memoize(function () { return emptyGenericType; }); + getGlobalIterableIteratorType = ts.memoize(function () { return emptyGenericType; }); + } + anyArrayType = createArrayType(anyType); + var symbol = getGlobalSymbol("ReadonlyArray", 793056, undefined); + globalReadonlyArrayType = symbol && getTypeOfGlobalSymbol(symbol, 1); + anyReadonlyArrayType = globalReadonlyArrayType ? createTypeFromGenericGlobalType(globalReadonlyArrayType, [anyType]) : anyArrayType; + } + function createInstantiatedPromiseLikeType() { + var promiseLikeType = getGlobalPromiseLikeType(); + if (promiseLikeType !== emptyGenericType) { + return createTypeReference(promiseLikeType, [anyType]); + } + return emptyObjectType; + } + function createThenableType() { + var thenPropertySymbol = createSymbol(67108864 | 4, "then"); + getSymbolLinks(thenPropertySymbol).type = globalFunctionType; + var thenableType = createObjectType(65536); + thenableType.properties = [thenPropertySymbol]; + thenableType.members = createSymbolTable(thenableType.properties); + thenableType.callSignatures = []; + thenableType.constructSignatures = []; + return thenableType; + } + function checkGrammarDecorators(node) { + if (!node.decorators) { + return false; + } + if (!ts.nodeCanBeDecorated(node)) { + if (node.kind === 147 && !ts.nodeIsPresent(node.body)) { + return grammarErrorOnFirstToken(node, ts.Diagnostics.A_decorator_can_only_decorate_a_method_implementation_not_an_overload); + } + else { + return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_are_not_valid_here); + } + } + else if (node.kind === 149 || node.kind === 150) { + var accessors = ts.getAllAccessorDeclarations(node.parent.members, node); + if (accessors.firstAccessor.decorators && node === accessors.secondAccessor) { + return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name); + } + } + return false; + } + function checkGrammarModifiers(node) { + switch (node.kind) { + case 149: + case 150: + case 148: + case 145: + case 144: + case 147: + case 146: + case 153: + case 225: + case 230: + case 229: + case 236: + case 235: + case 142: + break; + case 220: + if (node.modifiers && (node.modifiers.length > 1 || node.modifiers[0].kind !== 118) && + node.parent.kind !== 226 && node.parent.kind !== 256) { + return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); + } + break; + case 221: + case 222: + case 200: + case 223: + if (node.modifiers && node.parent.kind !== 226 && node.parent.kind !== 256) { + return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); + } + break; + case 224: + if (node.modifiers && (node.modifiers.length > 1 || node.modifiers[0].kind !== 74) && + node.parent.kind !== 226 && node.parent.kind !== 256) { + return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); + } + break; + default: + return false; + } + if (!node.modifiers) { + return; + } + var lastStatic, lastPrivate, lastProtected, lastDeclare, lastAsync, lastReadonly; + var flags = 0; + for (var _i = 0, _a = node.modifiers; _i < _a.length; _i++) { + var modifier = _a[_i]; + if (modifier.kind !== 128) { + if (node.kind === 144 || node.kind === 146) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_type_member, ts.tokenToString(modifier.kind)); + } + if (node.kind === 153) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_an_index_signature, ts.tokenToString(modifier.kind)); + } + } + switch (modifier.kind) { + case 74: + if (node.kind !== 224 && node.parent.kind === 221) { + return grammarErrorOnNode(node, ts.Diagnostics.A_class_member_cannot_have_the_0_keyword, ts.tokenToString(74)); + } + break; + case 112: + case 111: + case 110: + var text = visibilityToString(ts.modifierToFlag(modifier.kind)); + if (modifier.kind === 111) { + lastProtected = modifier; + } + else if (modifier.kind === 110) { + lastPrivate = modifier; + } + if (flags & 28) { + return grammarErrorOnNode(modifier, ts.Diagnostics.Accessibility_modifier_already_seen); + } + else if (flags & 32) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "static"); + } + else if (flags & 64) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "readonly"); + } + else if (flags & 256) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "async"); + } + else if (node.parent.kind === 226 || node.parent.kind === 256) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, text); + } + else if (flags & 128) { + if (modifier.kind === 110) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, text, "abstract"); + } + else { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "abstract"); + } + } + flags |= ts.modifierToFlag(modifier.kind); + break; + case 113: + if (flags & 32) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "static"); + } + else if (flags & 64) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "readonly"); + } + else if (flags & 256) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "async"); + } + else if (node.parent.kind === 226 || node.parent.kind === 256) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, "static"); + } + else if (node.kind === 142) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static"); + } + else if (flags & 128) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "static", "abstract"); + } + flags |= 32; + lastStatic = modifier; + break; + case 128: + if (flags & 64) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "readonly"); + } + else if (node.kind !== 145 && node.kind !== 144 && node.kind !== 153 && node.kind !== 142) { + return grammarErrorOnNode(modifier, ts.Diagnostics.readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature); + } + flags |= 64; + lastReadonly = modifier; + break; + case 82: + if (flags & 1) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "export"); + } + else if (flags & 2) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "declare"); + } + else if (flags & 128) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "abstract"); + } + else if (flags & 256) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "async"); + } + else if (node.parent.kind === 221) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export"); + } + else if (node.kind === 142) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export"); + } + flags |= 1; + break; + case 122: + if (flags & 2) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "declare"); + } + else if (flags & 256) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); + } + else if (node.parent.kind === 221) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare"); + } + else if (node.kind === 142) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); + } + else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 226) { + return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); + } + flags |= 2; + lastDeclare = modifier; + break; + case 115: + if (flags & 128) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "abstract"); + } + if (node.kind !== 221) { + if (node.kind !== 147 && + node.kind !== 145 && + node.kind !== 149 && + node.kind !== 150) { + return grammarErrorOnNode(modifier, ts.Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration); + } + if (!(node.parent.kind === 221 && node.parent.flags & 128)) { + return grammarErrorOnNode(modifier, ts.Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class); + } + if (flags & 32) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "static", "abstract"); + } + if (flags & 8) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "private", "abstract"); + } + } + flags |= 128; + break; + case 118: + if (flags & 256) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "async"); + } + else if (flags & 2 || ts.isInAmbientContext(node.parent)) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); + } + else if (node.kind === 142) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "async"); + } + flags |= 256; + lastAsync = modifier; + break; + } + } + if (node.kind === 148) { + if (flags & 32) { + return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static"); + } + if (flags & 128) { + return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "abstract"); + } + else if (flags & 256) { + return grammarErrorOnNode(lastAsync, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "async"); + } + else if (flags & 64) { + return grammarErrorOnNode(lastReadonly, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "readonly"); + } + return; + } + else if ((node.kind === 230 || node.kind === 229) && flags & 2) { + return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare"); + } + else if (node.kind === 142 && (flags & 92) && ts.isBindingPattern(node.name)) { + return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_may_not_be_a_binding_pattern); + } + if (flags & 256) { + return checkGrammarAsyncModifier(node, lastAsync); + } + } + function checkGrammarAsyncModifier(node, asyncModifier) { + if (languageVersion < 2) { + return grammarErrorOnNode(asyncModifier, ts.Diagnostics.Async_functions_are_only_available_when_targeting_ECMAScript_6_and_higher); + } + switch (node.kind) { + case 147: + case 220: + case 179: + case 180: + if (!node.asteriskToken) { + return false; + } + break; + } + return grammarErrorOnNode(asyncModifier, ts.Diagnostics._0_modifier_cannot_be_used_here, "async"); + } + function checkGrammarForDisallowedTrailingComma(list) { + if (list && list.hasTrailingComma) { + var start = list.end - ",".length; + var end = list.end; + var sourceFile = ts.getSourceFileOfNode(list[0]); + return grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.Trailing_comma_not_allowed); + } + } + function checkGrammarTypeParameterList(node, typeParameters, file) { + if (checkGrammarForDisallowedTrailingComma(typeParameters)) { + return true; + } + if (typeParameters && typeParameters.length === 0) { + var start = typeParameters.pos - "<".length; + var end = ts.skipTrivia(file.text, typeParameters.end) + ">".length; + return grammarErrorAtPos(file, start, end - start, ts.Diagnostics.Type_parameter_list_cannot_be_empty); + } + } + function checkGrammarParameterList(parameters) { + if (checkGrammarForDisallowedTrailingComma(parameters)) { + return true; + } + var seenOptionalParameter = false; + var parameterCount = parameters.length; + for (var i = 0; i < parameterCount; i++) { + var parameter = parameters[i]; + if (parameter.dotDotDotToken) { + if (i !== (parameterCount - 1)) { + return grammarErrorOnNode(parameter.dotDotDotToken, ts.Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list); + } + if (ts.isBindingPattern(parameter.name)) { + return grammarErrorOnNode(parameter.name, ts.Diagnostics.A_rest_element_cannot_contain_a_binding_pattern); + } + if (parameter.questionToken) { + return grammarErrorOnNode(parameter.questionToken, ts.Diagnostics.A_rest_parameter_cannot_be_optional); + } + if (parameter.initializer) { + return grammarErrorOnNode(parameter.name, ts.Diagnostics.A_rest_parameter_cannot_have_an_initializer); + } + } + else if (parameter.questionToken) { + seenOptionalParameter = true; + if (parameter.initializer) { + return grammarErrorOnNode(parameter.name, ts.Diagnostics.Parameter_cannot_have_question_mark_and_initializer); + } + } + else if (seenOptionalParameter && !parameter.initializer) { + return grammarErrorOnNode(parameter.name, ts.Diagnostics.A_required_parameter_cannot_follow_an_optional_parameter); + } + } + } + function checkGrammarFunctionLikeDeclaration(node) { + var file = ts.getSourceFileOfNode(node); + return checkGrammarDecorators(node) || checkGrammarModifiers(node) || checkGrammarTypeParameterList(node, node.typeParameters, file) || + checkGrammarParameterList(node.parameters) || checkGrammarArrowFunction(node, file); + } + function checkGrammarArrowFunction(node, file) { + if (node.kind === 180) { + var arrowFunction = node; + var startLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.pos).line; + var endLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.end).line; + if (startLine !== endLine) { + return grammarErrorOnNode(arrowFunction.equalsGreaterThanToken, ts.Diagnostics.Line_terminator_not_permitted_before_arrow); + } + } + return false; + } + function checkGrammarIndexSignatureParameters(node) { + var parameter = node.parameters[0]; + if (node.parameters.length !== 1) { + if (parameter) { + return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_must_have_exactly_one_parameter); + } + else { + return grammarErrorOnNode(node, ts.Diagnostics.An_index_signature_must_have_exactly_one_parameter); + } + } + if (parameter.dotDotDotToken) { + return grammarErrorOnNode(parameter.dotDotDotToken, ts.Diagnostics.An_index_signature_cannot_have_a_rest_parameter); + } + if (parameter.flags & 1023) { + return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_cannot_have_an_accessibility_modifier); + } + if (parameter.questionToken) { + return grammarErrorOnNode(parameter.questionToken, ts.Diagnostics.An_index_signature_parameter_cannot_have_a_question_mark); + } + if (parameter.initializer) { + return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_cannot_have_an_initializer); + } + if (!parameter.type) { + return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_must_have_a_type_annotation); + } + if (parameter.type.kind !== 132 && parameter.type.kind !== 130) { + return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_must_be_string_or_number); + } + if (!node.type) { + return grammarErrorOnNode(node, ts.Diagnostics.An_index_signature_must_have_a_type_annotation); + } + } + function checkGrammarIndexSignature(node) { + return checkGrammarDecorators(node) || checkGrammarModifiers(node) || checkGrammarIndexSignatureParameters(node); + } + function checkGrammarForAtLeastOneTypeArgument(node, typeArguments) { + if (typeArguments && typeArguments.length === 0) { + var sourceFile = ts.getSourceFileOfNode(node); + var start = typeArguments.pos - "<".length; + var end = ts.skipTrivia(sourceFile.text, typeArguments.end) + ">".length; + return grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.Type_argument_list_cannot_be_empty); + } + } + function checkGrammarTypeArguments(node, typeArguments) { + return checkGrammarForDisallowedTrailingComma(typeArguments) || + checkGrammarForAtLeastOneTypeArgument(node, typeArguments); + } + function checkGrammarForOmittedArgument(node, args) { + if (args) { + var sourceFile = ts.getSourceFileOfNode(node); + for (var _i = 0, args_1 = args; _i < args_1.length; _i++) { + var arg = args_1[_i]; + if (arg.kind === 193) { + return grammarErrorAtPos(sourceFile, arg.pos, 0, ts.Diagnostics.Argument_expression_expected); + } + } + } + } + function checkGrammarArguments(node, args) { + return checkGrammarForDisallowedTrailingComma(args) || + checkGrammarForOmittedArgument(node, args); + } + function checkGrammarHeritageClause(node) { + var types = node.types; + if (checkGrammarForDisallowedTrailingComma(types)) { + return true; + } + if (types && types.length === 0) { + var listType = ts.tokenToString(node.token); + var sourceFile = ts.getSourceFileOfNode(node); + return grammarErrorAtPos(sourceFile, types.pos, 0, ts.Diagnostics._0_list_cannot_be_empty, listType); + } + } + function checkGrammarClassDeclarationHeritageClauses(node) { + var seenExtendsClause = false; + var seenImplementsClause = false; + if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && node.heritageClauses) { + for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) { + var heritageClause = _a[_i]; + if (heritageClause.token === 83) { + if (seenExtendsClause) { + return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_already_seen); + } + if (seenImplementsClause) { + return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_must_precede_implements_clause); + } + if (heritageClause.types.length > 1) { + return grammarErrorOnFirstToken(heritageClause.types[1], ts.Diagnostics.Classes_can_only_extend_a_single_class); + } + seenExtendsClause = true; + } + else { + ts.Debug.assert(heritageClause.token === 106); + if (seenImplementsClause) { + return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.implements_clause_already_seen); + } + seenImplementsClause = true; + } + checkGrammarHeritageClause(heritageClause); + } + } + } + function checkGrammarInterfaceDeclaration(node) { + var seenExtendsClause = false; + if (node.heritageClauses) { + for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) { + var heritageClause = _a[_i]; + if (heritageClause.token === 83) { + if (seenExtendsClause) { + return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_already_seen); + } + seenExtendsClause = true; + } + else { + ts.Debug.assert(heritageClause.token === 106); + return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.Interface_declaration_cannot_have_implements_clause); + } + checkGrammarHeritageClause(heritageClause); + } + } + return false; + } + function checkGrammarComputedPropertyName(node) { + if (node.kind !== 140) { + return false; + } + var computedPropertyName = node; + if (computedPropertyName.expression.kind === 187 && computedPropertyName.expression.operatorToken.kind === 24) { + return grammarErrorOnNode(computedPropertyName.expression, ts.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name); + } + } + function checkGrammarForGenerator(node) { + if (node.asteriskToken) { + ts.Debug.assert(node.kind === 220 || + node.kind === 179 || + node.kind === 147); + if (ts.isInAmbientContext(node)) { + return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_not_allowed_in_an_ambient_context); + } + if (!node.body) { + return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.An_overload_signature_cannot_be_declared_as_a_generator); + } + if (languageVersion < 2) { + return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_only_available_when_targeting_ECMAScript_6_or_higher); + } + } + } + function checkGrammarForInvalidQuestionMark(node, questionToken, message) { + if (questionToken) { + return grammarErrorOnNode(questionToken, message); + } + } + function checkGrammarObjectLiteralExpression(node, inDestructuring) { + var seen = {}; + var Property = 1; + var GetAccessor = 2; + var SetAccessor = 4; + var GetOrSetAccessor = GetAccessor | SetAccessor; + var _loop_1 = function(prop) { + var name_20 = prop.name; + if (prop.kind === 193 || + name_20.kind === 140) { + checkGrammarComputedPropertyName(name_20); + return "continue"; + } + if (prop.kind === 254 && !inDestructuring && prop.objectAssignmentInitializer) { + return { value: grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment) }; + } + ts.forEach(prop.modifiers, function (mod) { + if (mod.kind !== 118 || prop.kind !== 147) { + grammarErrorOnNode(mod, ts.Diagnostics._0_modifier_cannot_be_used_here, ts.getTextOfNode(mod)); + } + }); + var currentKind = void 0; + if (prop.kind === 253 || prop.kind === 254) { + checkGrammarForInvalidQuestionMark(prop, prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); + if (name_20.kind === 8) { + checkGrammarNumericLiteral(name_20); + } + currentKind = Property; + } + else if (prop.kind === 147) { + currentKind = Property; + } + else if (prop.kind === 149) { + currentKind = GetAccessor; + } + else if (prop.kind === 150) { + currentKind = SetAccessor; + } + else { + ts.Debug.fail("Unexpected syntax kind:" + prop.kind); + } + if (!ts.hasProperty(seen, name_20.text)) { + seen[name_20.text] = currentKind; + } + else { + var existingKind = seen[name_20.text]; + if (currentKind === Property && existingKind === Property) { + return "continue"; + } + else if ((currentKind & GetOrSetAccessor) && (existingKind & GetOrSetAccessor)) { + if (existingKind !== GetOrSetAccessor && currentKind !== existingKind) { + seen[name_20.text] = currentKind | existingKind; + } + else { + return { value: grammarErrorOnNode(name_20, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name) }; + } + } + else { + return { value: grammarErrorOnNode(name_20, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name) }; + } + } + }; + for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { + var prop = _a[_i]; + var state_2 = _loop_1(prop); + if (typeof state_2 === "object") return state_2.value; + } + } + function checkGrammarJsxElement(node) { + var seen = {}; + for (var _i = 0, _a = node.attributes; _i < _a.length; _i++) { + var attr = _a[_i]; + if (attr.kind === 247) { + continue; + } + var jsxAttr = attr; + var name_21 = jsxAttr.name; + if (!ts.hasProperty(seen, name_21.text)) { + seen[name_21.text] = true; + } + else { + return grammarErrorOnNode(name_21, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); + } + var initializer = jsxAttr.initializer; + if (initializer && initializer.kind === 248 && !initializer.expression) { + return grammarErrorOnNode(jsxAttr.initializer, ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression); + } + } + } + function checkGrammarForInOrForOfStatement(forInOrOfStatement) { + if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { + return true; + } + if (forInOrOfStatement.initializer.kind === 219) { + var variableList = forInOrOfStatement.initializer; + if (!checkGrammarVariableDeclarationList(variableList)) { + var declarations = variableList.declarations; + if (!declarations.length) { + return false; + } + if (declarations.length > 1) { + var diagnostic = forInOrOfStatement.kind === 207 + ? ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement + : ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement; + return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic); + } + var firstDeclaration = declarations[0]; + if (firstDeclaration.initializer) { + var diagnostic = forInOrOfStatement.kind === 207 + ? ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer + : ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; + return grammarErrorOnNode(firstDeclaration.name, diagnostic); + } + if (firstDeclaration.type) { + var diagnostic = forInOrOfStatement.kind === 207 + ? ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation + : ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation; + return grammarErrorOnNode(firstDeclaration, diagnostic); + } + } + } + return false; + } + function checkGrammarAccessor(accessor) { + var kind = accessor.kind; + if (languageVersion < 1) { + return grammarErrorOnNode(accessor.name, ts.Diagnostics.Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher); + } + else if (ts.isInAmbientContext(accessor)) { + return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_be_declared_in_an_ambient_context); + } + else if (accessor.body === undefined && !(accessor.flags & 128)) { + return grammarErrorAtPos(ts.getSourceFileOfNode(accessor), accessor.end - 1, ";".length, ts.Diagnostics._0_expected, "{"); + } + else if (accessor.typeParameters) { + return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters); + } + else if (!doesAccessorHaveCorrectParameterCount(accessor)) { + return grammarErrorOnNode(accessor.name, kind === 149 ? + ts.Diagnostics.A_get_accessor_cannot_have_parameters : + ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter); + } + else if (kind === 150) { + if (accessor.type) { + return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation); + } + else { + var parameter = accessor.parameters[0]; + if (parameter.dotDotDotToken) { + return grammarErrorOnNode(parameter.dotDotDotToken, ts.Diagnostics.A_set_accessor_cannot_have_rest_parameter); + } + else if (parameter.questionToken) { + return grammarErrorOnNode(parameter.questionToken, ts.Diagnostics.A_set_accessor_cannot_have_an_optional_parameter); + } + else if (parameter.initializer) { + return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_parameter_cannot_have_an_initializer); + } + } + } + } + function doesAccessorHaveCorrectParameterCount(accessor) { + return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 149 ? 0 : 1); + } + function getAccessorThisParameter(accessor) { + if (accessor.parameters.length === (accessor.kind === 149 ? 1 : 2) && + accessor.parameters[0].name.kind === 69 && + accessor.parameters[0].name.originalKeywordKind === 97) { + return accessor.parameters[0]; + } + } + function checkGrammarForNonSymbolComputedProperty(node, message) { + if (ts.isDynamicName(node)) { + return grammarErrorOnNode(node, message); + } + } + function checkGrammarMethod(node) { + if (checkGrammarDisallowedModifiersOnObjectLiteralExpressionMethod(node) || + checkGrammarFunctionLikeDeclaration(node) || + checkGrammarForGenerator(node)) { + return true; + } + if (node.parent.kind === 171) { + if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional)) { + return true; + } + else if (node.body === undefined) { + return grammarErrorAtPos(ts.getSourceFileOfNode(node), node.end - 1, ";".length, ts.Diagnostics._0_expected, "{"); + } + } + if (ts.isClassLike(node.parent)) { + if (ts.isInAmbientContext(node)) { + return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_symbol); + } + else if (!node.body) { + return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol); + } + } + else if (node.parent.kind === 222) { + return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol); + } + else if (node.parent.kind === 159) { + return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol); + } + } + function checkGrammarBreakOrContinueStatement(node) { + var current = node; + while (current) { + if (ts.isFunctionLike(current)) { + return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); + } + switch (current.kind) { + case 214: + if (node.label && current.label.text === node.label.text) { + var isMisplacedContinueLabel = node.kind === 209 + && !ts.isIterationStatement(current.statement, true); + if (isMisplacedContinueLabel) { + return grammarErrorOnNode(node, ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement); + } + return false; + } + break; + case 213: + if (node.kind === 210 && !node.label) { + return false; + } + break; + default: + if (ts.isIterationStatement(current, false) && !node.label) { + return false; + } + break; + } + current = current.parent; + } + if (node.label) { + var message = node.kind === 210 + ? ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement + : ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement; + return grammarErrorOnNode(node, message); + } + else { + var message = node.kind === 210 + ? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement + : ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; + return grammarErrorOnNode(node, message); + } + } + function checkGrammarBindingElement(node) { + if (node.dotDotDotToken) { + var elements = node.parent.elements; + if (node !== ts.lastOrUndefined(elements)) { + return grammarErrorOnNode(node, ts.Diagnostics.A_rest_element_must_be_last_in_an_array_destructuring_pattern); + } + if (node.name.kind === 168 || node.name.kind === 167) { + return grammarErrorOnNode(node.name, ts.Diagnostics.A_rest_element_cannot_contain_a_binding_pattern); + } + if (node.initializer) { + return grammarErrorAtPos(ts.getSourceFileOfNode(node), node.initializer.pos - 1, 1, ts.Diagnostics.A_rest_element_cannot_have_an_initializer); + } + } + } + function checkGrammarVariableDeclaration(node) { + if (node.parent.parent.kind !== 207 && node.parent.parent.kind !== 208) { + if (ts.isInAmbientContext(node)) { + if (node.initializer) { + var equalsTokenLength = "=".length; + return grammarErrorAtPos(ts.getSourceFileOfNode(node), node.initializer.pos - equalsTokenLength, equalsTokenLength, ts.Diagnostics.Initializers_are_not_allowed_in_ambient_contexts); + } + } + else if (!node.initializer) { + if (ts.isBindingPattern(node.name) && !ts.isBindingPattern(node.parent)) { + return grammarErrorOnNode(node, ts.Diagnostics.A_destructuring_declaration_must_have_an_initializer); + } + if (ts.isConst(node)) { + return grammarErrorOnNode(node, ts.Diagnostics.const_declarations_must_be_initialized); + } + } + } + var checkLetConstNames = (ts.isLet(node) || ts.isConst(node)); + return checkLetConstNames && checkGrammarNameInLetOrConstDeclarations(node.name); + } + function checkGrammarNameInLetOrConstDeclarations(name) { + if (name.kind === 69) { + if (name.originalKeywordKind === 108) { + return grammarErrorOnNode(name, ts.Diagnostics.let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations); + } + } + else { + var elements = name.elements; + for (var _i = 0, elements_2 = elements; _i < elements_2.length; _i++) { + var element = elements_2[_i]; + if (element.kind !== 193) { + checkGrammarNameInLetOrConstDeclarations(element.name); + } + } + } + } + function checkGrammarVariableDeclarationList(declarationList) { + var declarations = declarationList.declarations; + if (checkGrammarForDisallowedTrailingComma(declarationList.declarations)) { + return true; + } + if (!declarationList.declarations.length) { + return grammarErrorAtPos(ts.getSourceFileOfNode(declarationList), declarations.pos, declarations.end - declarations.pos, ts.Diagnostics.Variable_declaration_list_cannot_be_empty); + } + } + function allowLetAndConstDeclarations(parent) { + switch (parent.kind) { + case 203: + case 204: + case 205: + case 212: + case 206: + case 207: + case 208: + return false; + case 214: + return allowLetAndConstDeclarations(parent.parent); + } + return true; + } + function checkGrammarForDisallowedLetOrConstStatement(node) { + if (!allowLetAndConstDeclarations(node.parent)) { + if (ts.isLet(node.declarationList)) { + return grammarErrorOnNode(node, ts.Diagnostics.let_declarations_can_only_be_declared_inside_a_block); + } + else if (ts.isConst(node.declarationList)) { + return grammarErrorOnNode(node, ts.Diagnostics.const_declarations_can_only_be_declared_inside_a_block); + } + } + } + function hasParseDiagnostics(sourceFile) { + return sourceFile.parseDiagnostics.length > 0; + } + function grammarErrorOnFirstToken(node, message, arg0, arg1, arg2) { + var sourceFile = ts.getSourceFileOfNode(node); + if (!hasParseDiagnostics(sourceFile)) { + var span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos); + diagnostics.add(ts.createFileDiagnostic(sourceFile, span.start, span.length, message, arg0, arg1, arg2)); + return true; + } + } + function grammarErrorAtPos(sourceFile, start, length, message, arg0, arg1, arg2) { + if (!hasParseDiagnostics(sourceFile)) { + diagnostics.add(ts.createFileDiagnostic(sourceFile, start, length, message, arg0, arg1, arg2)); + return true; + } + } + function grammarErrorOnNode(node, message, arg0, arg1, arg2) { + var sourceFile = ts.getSourceFileOfNode(node); + if (!hasParseDiagnostics(sourceFile)) { + diagnostics.add(ts.createDiagnosticForNode(node, message, arg0, arg1, arg2)); + return true; + } + } + function checkGrammarConstructorTypeParameters(node) { + if (node.typeParameters) { + return grammarErrorAtPos(ts.getSourceFileOfNode(node), node.typeParameters.pos, node.typeParameters.end - node.typeParameters.pos, ts.Diagnostics.Type_parameters_cannot_appear_on_a_constructor_declaration); + } + } + function checkGrammarConstructorTypeAnnotation(node) { + if (node.type) { + return grammarErrorOnNode(node.type, ts.Diagnostics.Type_annotation_cannot_appear_on_a_constructor_declaration); + } + } + function checkGrammarProperty(node) { + if (ts.isClassLike(node.parent)) { + if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol)) { + return true; + } + } + else if (node.parent.kind === 222) { + if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol)) { + return true; + } + if (node.initializer) { + return grammarErrorOnNode(node.initializer, ts.Diagnostics.An_interface_property_cannot_have_an_initializer); + } + } + else if (node.parent.kind === 159) { + if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol)) { + return true; + } + if (node.initializer) { + return grammarErrorOnNode(node.initializer, ts.Diagnostics.A_type_literal_property_cannot_have_an_initializer); + } + } + if (ts.isInAmbientContext(node) && node.initializer) { + return grammarErrorOnFirstToken(node.initializer, ts.Diagnostics.Initializers_are_not_allowed_in_ambient_contexts); + } + } + function checkGrammarTopLevelElementForRequiredDeclareModifier(node) { + if (node.kind === 222 || + node.kind === 223 || + node.kind === 230 || + node.kind === 229 || + node.kind === 236 || + node.kind === 235 || + (node.flags & 2) || + (node.flags & (1 | 512))) { + return false; + } + return grammarErrorOnFirstToken(node, ts.Diagnostics.A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file); + } + function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) { + for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { + var decl = _a[_i]; + if (ts.isDeclaration(decl) || decl.kind === 200) { + if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { + return true; + } + } + } + } + function checkGrammarSourceFile(node) { + return ts.isInAmbientContext(node) && checkGrammarTopLevelElementsForRequiredDeclareModifier(node); + } + function checkGrammarStatementInAmbientContext(node) { + if (ts.isInAmbientContext(node)) { + if (isAccessor(node.parent.kind)) { + return getNodeLinks(node).hasReportedStatementInAmbientContext = true; + } + var links = getNodeLinks(node); + if (!links.hasReportedStatementInAmbientContext && ts.isFunctionLike(node.parent)) { + return getNodeLinks(node).hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts); + } + if (node.parent.kind === 199 || node.parent.kind === 226 || node.parent.kind === 256) { + var links_1 = getNodeLinks(node.parent); + if (!links_1.hasReportedStatementInAmbientContext) { + return links_1.hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.Statements_are_not_allowed_in_ambient_contexts); + } + } + else { + } + } + } + function checkGrammarNumericLiteral(node) { + if (node.isOctalLiteral && languageVersion >= 1) { + return grammarErrorOnNode(node, ts.Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher); + } + } + function grammarErrorAfterFirstToken(node, message, arg0, arg1, arg2) { + var sourceFile = ts.getSourceFileOfNode(node); + if (!hasParseDiagnostics(sourceFile)) { + var span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos); + diagnostics.add(ts.createFileDiagnostic(sourceFile, ts.textSpanEnd(span), 0, message, arg0, arg1, arg2)); + return true; + } + } + var _a; + } + ts.createTypeChecker = createTypeChecker; +})(ts || (ts = {})); +var ts; +(function (ts) { + var nullSourceMapWriter; + var defaultLastEncodedSourceMapSpan = { + emittedLine: 1, + emittedColumn: 1, + sourceLine: 1, + sourceColumn: 1, + sourceIndex: 0 + }; + function getNullSourceMapWriter() { + if (nullSourceMapWriter === undefined) { + nullSourceMapWriter = { + getSourceMapData: function () { return undefined; }, + setSourceFile: function (sourceFile) { }, + emitStart: function (range) { }, + emitEnd: function (range, stopOverridingSpan) { }, + emitPos: function (pos) { }, + changeEmitSourcePos: function () { }, + getText: function () { return undefined; }, + getSourceMappingURL: function () { return undefined; }, + initialize: function (filePath, sourceMapFilePath, sourceFiles, isBundledEmit) { }, + reset: function () { } + }; + } + return nullSourceMapWriter; + } + ts.getNullSourceMapWriter = getNullSourceMapWriter; + function createSourceMapWriter(host, writer) { + var compilerOptions = host.getCompilerOptions(); + var currentSourceFile; + var sourceMapDir; + var stopOverridingSpan = false; + var modifyLastSourcePos = false; + var sourceMapSourceIndex; + var lastRecordedSourceMapSpan; + var lastEncodedSourceMapSpan; + var lastEncodedNameIndex; + var sourceMapData; + return { + getSourceMapData: function () { return sourceMapData; }, + setSourceFile: setSourceFile, + emitPos: emitPos, + emitStart: emitStart, + emitEnd: emitEnd, + changeEmitSourcePos: changeEmitSourcePos, + getText: getText, + getSourceMappingURL: getSourceMappingURL, + initialize: initialize, + reset: reset + }; + function initialize(filePath, sourceMapFilePath, sourceFiles, isBundledEmit) { + if (sourceMapData) { + reset(); + } + currentSourceFile = undefined; + sourceMapSourceIndex = -1; + lastRecordedSourceMapSpan = undefined; + lastEncodedSourceMapSpan = defaultLastEncodedSourceMapSpan; + lastEncodedNameIndex = 0; + sourceMapData = { + sourceMapFilePath: sourceMapFilePath, + jsSourceMappingURL: !compilerOptions.inlineSourceMap ? ts.getBaseFileName(ts.normalizeSlashes(sourceMapFilePath)) : undefined, + sourceMapFile: ts.getBaseFileName(ts.normalizeSlashes(filePath)), + sourceMapSourceRoot: compilerOptions.sourceRoot || "", + sourceMapSources: [], + inputSourceFileNames: [], + sourceMapNames: [], + sourceMapMappings: "", + sourceMapSourcesContent: compilerOptions.inlineSources ? [] : undefined, + sourceMapDecodedMappings: [] + }; + sourceMapData.sourceMapSourceRoot = ts.normalizeSlashes(sourceMapData.sourceMapSourceRoot); + if (sourceMapData.sourceMapSourceRoot.length && sourceMapData.sourceMapSourceRoot.charCodeAt(sourceMapData.sourceMapSourceRoot.length - 1) !== 47) { + sourceMapData.sourceMapSourceRoot += ts.directorySeparator; + } + if (compilerOptions.mapRoot) { + sourceMapDir = ts.normalizeSlashes(compilerOptions.mapRoot); + if (!isBundledEmit) { + ts.Debug.assert(sourceFiles.length === 1); + sourceMapDir = ts.getDirectoryPath(ts.getSourceFilePathInNewDir(sourceFiles[0], host, sourceMapDir)); + } + if (!ts.isRootedDiskPath(sourceMapDir) && !ts.isUrl(sourceMapDir)) { + sourceMapDir = ts.combinePaths(host.getCommonSourceDirectory(), sourceMapDir); + sourceMapData.jsSourceMappingURL = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizePath(filePath)), ts.combinePaths(sourceMapDir, sourceMapData.jsSourceMappingURL), host.getCurrentDirectory(), host.getCanonicalFileName, true); + } + else { + sourceMapData.jsSourceMappingURL = ts.combinePaths(sourceMapDir, sourceMapData.jsSourceMappingURL); + } + } + else { + sourceMapDir = ts.getDirectoryPath(ts.normalizePath(filePath)); + } + } + function reset() { + currentSourceFile = undefined; + sourceMapDir = undefined; + sourceMapSourceIndex = undefined; + lastRecordedSourceMapSpan = undefined; + lastEncodedSourceMapSpan = undefined; + lastEncodedNameIndex = undefined; + sourceMapData = undefined; + } + function updateLastEncodedAndRecordedSpans() { + if (modifyLastSourcePos) { + modifyLastSourcePos = false; + lastRecordedSourceMapSpan.emittedLine = lastEncodedSourceMapSpan.emittedLine; + lastRecordedSourceMapSpan.emittedColumn = lastEncodedSourceMapSpan.emittedColumn; + sourceMapData.sourceMapDecodedMappings.pop(); + lastEncodedSourceMapSpan = sourceMapData.sourceMapDecodedMappings.length ? + sourceMapData.sourceMapDecodedMappings[sourceMapData.sourceMapDecodedMappings.length - 1] : + defaultLastEncodedSourceMapSpan; + var sourceMapMappings = sourceMapData.sourceMapMappings; + var lenthToSet = sourceMapMappings.length - 1; + for (; lenthToSet >= 0; lenthToSet--) { + var currentChar = sourceMapMappings.charAt(lenthToSet); + if (currentChar === ",") { + break; + } + if (currentChar === ";" && lenthToSet !== 0 && sourceMapMappings.charAt(lenthToSet - 1) !== ";") { + break; + } + } + sourceMapData.sourceMapMappings = sourceMapMappings.substr(0, Math.max(0, lenthToSet)); + } + } + function encodeLastRecordedSourceMapSpan() { + if (!lastRecordedSourceMapSpan || lastRecordedSourceMapSpan === lastEncodedSourceMapSpan) { + return; + } + var prevEncodedEmittedColumn = lastEncodedSourceMapSpan.emittedColumn; + if (lastEncodedSourceMapSpan.emittedLine === lastRecordedSourceMapSpan.emittedLine) { + if (sourceMapData.sourceMapMappings) { + sourceMapData.sourceMapMappings += ","; + } + } + else { + for (var encodedLine = lastEncodedSourceMapSpan.emittedLine; encodedLine < lastRecordedSourceMapSpan.emittedLine; encodedLine++) { + sourceMapData.sourceMapMappings += ";"; + } + prevEncodedEmittedColumn = 1; + } + sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.emittedColumn - prevEncodedEmittedColumn); + sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceIndex - lastEncodedSourceMapSpan.sourceIndex); + sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceLine - lastEncodedSourceMapSpan.sourceLine); + sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceColumn - lastEncodedSourceMapSpan.sourceColumn); + if (lastRecordedSourceMapSpan.nameIndex >= 0) { + ts.Debug.assert(false, "We do not support name index right now, Make sure to update updateLastEncodedAndRecordedSpans when we start using this"); + sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.nameIndex - lastEncodedNameIndex); + lastEncodedNameIndex = lastRecordedSourceMapSpan.nameIndex; + } + lastEncodedSourceMapSpan = lastRecordedSourceMapSpan; + sourceMapData.sourceMapDecodedMappings.push(lastEncodedSourceMapSpan); + } + function emitPos(pos) { + if (pos === -1) { + return; + } + var sourceLinePos = ts.getLineAndCharacterOfPosition(currentSourceFile, pos); + sourceLinePos.line++; + sourceLinePos.character++; + var emittedLine = writer.getLine(); + var emittedColumn = writer.getColumn(); + if (!lastRecordedSourceMapSpan || + lastRecordedSourceMapSpan.emittedLine !== emittedLine || + lastRecordedSourceMapSpan.emittedColumn !== emittedColumn || + (lastRecordedSourceMapSpan.sourceIndex === sourceMapSourceIndex && + (lastRecordedSourceMapSpan.sourceLine > sourceLinePos.line || + (lastRecordedSourceMapSpan.sourceLine === sourceLinePos.line && lastRecordedSourceMapSpan.sourceColumn > sourceLinePos.character)))) { + encodeLastRecordedSourceMapSpan(); + lastRecordedSourceMapSpan = { + emittedLine: emittedLine, + emittedColumn: emittedColumn, + sourceLine: sourceLinePos.line, + sourceColumn: sourceLinePos.character, + sourceIndex: sourceMapSourceIndex + }; + stopOverridingSpan = false; + } + else if (!stopOverridingSpan) { + lastRecordedSourceMapSpan.sourceLine = sourceLinePos.line; + lastRecordedSourceMapSpan.sourceColumn = sourceLinePos.character; + lastRecordedSourceMapSpan.sourceIndex = sourceMapSourceIndex; + } + updateLastEncodedAndRecordedSpans(); + } + function getStartPos(range) { + var rangeHasDecorators = !!range.decorators; + return range.pos !== -1 ? ts.skipTrivia(currentSourceFile.text, rangeHasDecorators ? range.decorators.end : range.pos) : -1; + } + function emitStart(range) { + emitPos(getStartPos(range)); + } + function emitEnd(range, stopOverridingEnd) { + emitPos(range.end); + stopOverridingSpan = stopOverridingEnd; + } + function changeEmitSourcePos() { + ts.Debug.assert(!modifyLastSourcePos); + modifyLastSourcePos = true; + } + function setSourceFile(sourceFile) { + currentSourceFile = sourceFile; + var sourcesDirectoryPath = compilerOptions.sourceRoot ? host.getCommonSourceDirectory() : sourceMapDir; + var source = ts.getRelativePathToDirectoryOrUrl(sourcesDirectoryPath, currentSourceFile.fileName, host.getCurrentDirectory(), host.getCanonicalFileName, true); + sourceMapSourceIndex = ts.indexOf(sourceMapData.sourceMapSources, source); + if (sourceMapSourceIndex === -1) { + sourceMapSourceIndex = sourceMapData.sourceMapSources.length; + sourceMapData.sourceMapSources.push(source); + sourceMapData.inputSourceFileNames.push(sourceFile.fileName); + if (compilerOptions.inlineSources) { + sourceMapData.sourceMapSourcesContent.push(sourceFile.text); + } + } + } + function getText() { + encodeLastRecordedSourceMapSpan(); + return ts.stringify({ + version: 3, + file: sourceMapData.sourceMapFile, + sourceRoot: sourceMapData.sourceMapSourceRoot, + sources: sourceMapData.sourceMapSources, + names: sourceMapData.sourceMapNames, + mappings: sourceMapData.sourceMapMappings, + sourcesContent: sourceMapData.sourceMapSourcesContent + }); + } + function getSourceMappingURL() { + if (compilerOptions.inlineSourceMap) { + var base64SourceMapText = ts.convertToBase64(getText()); + return sourceMapData.jsSourceMappingURL = "data:application/json;base64," + base64SourceMapText; + } + else { + return sourceMapData.jsSourceMappingURL; + } + } + } + ts.createSourceMapWriter = createSourceMapWriter; + var base64Chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + function base64FormatEncode(inValue) { + if (inValue < 64) { + return base64Chars.charAt(inValue); + } + throw TypeError(inValue + ": not a 64 based value"); + } + function base64VLQFormatEncode(inValue) { + if (inValue < 0) { + inValue = ((-inValue) << 1) + 1; + } + else { + inValue = inValue << 1; + } + var encodedStr = ""; + do { + var currentDigit = inValue & 31; + inValue = inValue >> 5; + if (inValue > 0) { + currentDigit = currentDigit | 32; + } + encodedStr = encodedStr + base64FormatEncode(currentDigit); + } while (inValue > 0); + return encodedStr; + } +})(ts || (ts = {})); +var ts; +(function (ts) { + function getDeclarationDiagnostics(host, resolver, targetSourceFile) { + var declarationDiagnostics = ts.createDiagnosticCollection(); + ts.forEachExpectedEmitFile(host, getDeclarationDiagnosticsFromFile, targetSourceFile); + return declarationDiagnostics.getDiagnostics(targetSourceFile ? targetSourceFile.fileName : undefined); + function getDeclarationDiagnosticsFromFile(_a, sources, isBundledEmit) { + var declarationFilePath = _a.declarationFilePath; + emitDeclarations(host, resolver, declarationDiagnostics, declarationFilePath, sources, isBundledEmit); + } + } + ts.getDeclarationDiagnostics = getDeclarationDiagnostics; + function emitDeclarations(host, resolver, emitterDiagnostics, declarationFilePath, sourceFiles, isBundledEmit) { + var newLine = host.getNewLine(); + var compilerOptions = host.getCompilerOptions(); + var write; + var writeLine; + var increaseIndent; + var decreaseIndent; + var writeTextOfNode; + var writer; + createAndSetNewTextWriterWithSymbolWriter(); + var enclosingDeclaration; + var resultHasExternalModuleIndicator; + var currentText; + var currentLineMap; + var currentIdentifiers; + var isCurrentFileExternalModule; + var reportedDeclarationError = false; + var errorNameNode; + var emitJsDocComments = compilerOptions.removeComments ? function (declaration) { } : writeJsDocComments; + var emit = compilerOptions.stripInternal ? stripInternal : emitNode; + var noDeclare; + var moduleElementDeclarationEmitInfo = []; + var asynchronousSubModuleDeclarationEmitInfo; + var referencesOutput = ""; + var usedTypeDirectiveReferences; + var emittedReferencedFiles = []; + var addedGlobalFileReference = false; + var allSourcesModuleElementDeclarationEmitInfo = []; + ts.forEach(sourceFiles, function (sourceFile) { + if (ts.isSourceFileJavaScript(sourceFile)) { + return; + } + if (!compilerOptions.noResolve) { + ts.forEach(sourceFile.referencedFiles, function (fileReference) { + var referencedFile = ts.tryResolveScriptReference(host, sourceFile, fileReference); + if (referencedFile && !ts.contains(emittedReferencedFiles, referencedFile)) { + if (writeReferencePath(referencedFile, !isBundledEmit && !addedGlobalFileReference)) { + addedGlobalFileReference = true; + } + emittedReferencedFiles.push(referencedFile); + } + }); + } + resultHasExternalModuleIndicator = false; + if (!isBundledEmit || !ts.isExternalModule(sourceFile)) { + noDeclare = false; + emitSourceFile(sourceFile); + } + else if (ts.isExternalModule(sourceFile)) { + noDeclare = true; + write("declare module \"" + ts.getResolvedExternalModuleName(host, sourceFile) + "\" {"); + writeLine(); + increaseIndent(); + emitSourceFile(sourceFile); + decreaseIndent(); + write("}"); + writeLine(); + } + if (moduleElementDeclarationEmitInfo.length) { + var oldWriter = writer; + ts.forEach(moduleElementDeclarationEmitInfo, function (aliasEmitInfo) { + if (aliasEmitInfo.isVisible && !aliasEmitInfo.asynchronousOutput) { + ts.Debug.assert(aliasEmitInfo.node.kind === 230); + createAndSetNewTextWriterWithSymbolWriter(); + ts.Debug.assert(aliasEmitInfo.indent === 0 || (aliasEmitInfo.indent === 1 && isBundledEmit)); + for (var i = 0; i < aliasEmitInfo.indent; i++) { + increaseIndent(); + } + writeImportDeclaration(aliasEmitInfo.node); + aliasEmitInfo.asynchronousOutput = writer.getText(); + for (var i = 0; i < aliasEmitInfo.indent; i++) { + decreaseIndent(); + } + } + }); + setWriter(oldWriter); + allSourcesModuleElementDeclarationEmitInfo = allSourcesModuleElementDeclarationEmitInfo.concat(moduleElementDeclarationEmitInfo); + moduleElementDeclarationEmitInfo = []; + } + if (!isBundledEmit && ts.isExternalModule(sourceFile) && sourceFile.moduleAugmentations.length && !resultHasExternalModuleIndicator) { + write("export {};"); + writeLine(); + } + }); + if (usedTypeDirectiveReferences) { + for (var directive in usedTypeDirectiveReferences) { + if (ts.hasProperty(usedTypeDirectiveReferences, directive)) { + referencesOutput += "/// " + newLine; + } + } + } + return { + reportedDeclarationError: reportedDeclarationError, + moduleElementDeclarationEmitInfo: allSourcesModuleElementDeclarationEmitInfo, + synchronousDeclarationOutput: writer.getText(), + referencesOutput: referencesOutput + }; + function hasInternalAnnotation(range) { + var comment = currentText.substring(range.pos, range.end); + return comment.indexOf("@internal") >= 0; + } + function stripInternal(node) { + if (node) { + var leadingCommentRanges = ts.getLeadingCommentRanges(currentText, node.pos); + if (ts.forEach(leadingCommentRanges, hasInternalAnnotation)) { + return; + } + emitNode(node); + } + } + function createAndSetNewTextWriterWithSymbolWriter() { + var writer = ts.createTextWriter(newLine); + writer.trackSymbol = trackSymbol; + writer.reportInaccessibleThisError = reportInaccessibleThisError; + writer.writeKeyword = writer.write; + writer.writeOperator = writer.write; + writer.writePunctuation = writer.write; + writer.writeSpace = writer.write; + writer.writeStringLiteral = writer.writeLiteral; + writer.writeParameter = writer.write; + writer.writeSymbol = writer.write; + setWriter(writer); + } + function setWriter(newWriter) { + writer = newWriter; + write = newWriter.write; + writeTextOfNode = newWriter.writeTextOfNode; + writeLine = newWriter.writeLine; + increaseIndent = newWriter.increaseIndent; + decreaseIndent = newWriter.decreaseIndent; + } + function writeAsynchronousModuleElements(nodes) { + var oldWriter = writer; + ts.forEach(nodes, function (declaration) { + var nodeToCheck; + if (declaration.kind === 218) { + nodeToCheck = declaration.parent.parent; + } + else if (declaration.kind === 233 || declaration.kind === 234 || declaration.kind === 231) { + ts.Debug.fail("We should be getting ImportDeclaration instead to write"); + } + else { + nodeToCheck = declaration; + } + var moduleElementEmitInfo = ts.forEach(moduleElementDeclarationEmitInfo, function (declEmitInfo) { return declEmitInfo.node === nodeToCheck ? declEmitInfo : undefined; }); + if (!moduleElementEmitInfo && asynchronousSubModuleDeclarationEmitInfo) { + moduleElementEmitInfo = ts.forEach(asynchronousSubModuleDeclarationEmitInfo, function (declEmitInfo) { return declEmitInfo.node === nodeToCheck ? declEmitInfo : undefined; }); + } + if (moduleElementEmitInfo) { + if (moduleElementEmitInfo.node.kind === 230) { + moduleElementEmitInfo.isVisible = true; + } + else { + createAndSetNewTextWriterWithSymbolWriter(); + for (var declarationIndent = moduleElementEmitInfo.indent; declarationIndent; declarationIndent--) { + increaseIndent(); + } + if (nodeToCheck.kind === 225) { + ts.Debug.assert(asynchronousSubModuleDeclarationEmitInfo === undefined); + asynchronousSubModuleDeclarationEmitInfo = []; + } + writeModuleElement(nodeToCheck); + if (nodeToCheck.kind === 225) { + moduleElementEmitInfo.subModuleElementDeclarationEmitInfo = asynchronousSubModuleDeclarationEmitInfo; + asynchronousSubModuleDeclarationEmitInfo = undefined; + } + moduleElementEmitInfo.asynchronousOutput = writer.getText(); + } + } + }); + setWriter(oldWriter); + } + function recordTypeReferenceDirectivesIfNecessary(typeReferenceDirectives) { + if (!typeReferenceDirectives) { + return; + } + if (!usedTypeDirectiveReferences) { + usedTypeDirectiveReferences = {}; + } + for (var _i = 0, typeReferenceDirectives_1 = typeReferenceDirectives; _i < typeReferenceDirectives_1.length; _i++) { + var directive = typeReferenceDirectives_1[_i]; + if (!ts.hasProperty(usedTypeDirectiveReferences, directive)) { + usedTypeDirectiveReferences[directive] = directive; + } + } + } + function handleSymbolAccessibilityError(symbolAccessibilityResult) { + if (symbolAccessibilityResult.accessibility === 0) { + if (symbolAccessibilityResult && symbolAccessibilityResult.aliasesToMakeVisible) { + writeAsynchronousModuleElements(symbolAccessibilityResult.aliasesToMakeVisible); + } + } + else { + reportedDeclarationError = true; + var errorInfo = writer.getSymbolAccessibilityDiagnostic(symbolAccessibilityResult); + if (errorInfo) { + if (errorInfo.typeName) { + emitterDiagnostics.add(ts.createDiagnosticForNode(symbolAccessibilityResult.errorNode || errorInfo.errorNode, errorInfo.diagnosticMessage, ts.getTextOfNodeFromSourceText(currentText, errorInfo.typeName), symbolAccessibilityResult.errorSymbolName, symbolAccessibilityResult.errorModuleName)); + } + else { + emitterDiagnostics.add(ts.createDiagnosticForNode(symbolAccessibilityResult.errorNode || errorInfo.errorNode, errorInfo.diagnosticMessage, symbolAccessibilityResult.errorSymbolName, symbolAccessibilityResult.errorModuleName)); + } + } + } + } + function trackSymbol(symbol, enclosingDeclaration, meaning) { + handleSymbolAccessibilityError(resolver.isSymbolAccessible(symbol, enclosingDeclaration, meaning)); + recordTypeReferenceDirectivesIfNecessary(resolver.getTypeReferenceDirectivesForSymbol(symbol, meaning)); + } + function reportInaccessibleThisError() { + if (errorNameNode) { + reportedDeclarationError = true; + emitterDiagnostics.add(ts.createDiagnosticForNode(errorNameNode, ts.Diagnostics.The_inferred_type_of_0_references_an_inaccessible_this_type_A_type_annotation_is_necessary, ts.declarationNameToString(errorNameNode))); + } + } + function writeTypeOfDeclaration(declaration, type, getSymbolAccessibilityDiagnostic) { + writer.getSymbolAccessibilityDiagnostic = getSymbolAccessibilityDiagnostic; + write(": "); + if (type) { + emitType(type); + } + else { + errorNameNode = declaration.name; + resolver.writeTypeOfDeclaration(declaration, enclosingDeclaration, 2, writer); + errorNameNode = undefined; + } + } + function writeReturnTypeAtSignature(signature, getSymbolAccessibilityDiagnostic) { + writer.getSymbolAccessibilityDiagnostic = getSymbolAccessibilityDiagnostic; + write(": "); + if (signature.type) { + emitType(signature.type); + } + else { + errorNameNode = signature.name; + resolver.writeReturnTypeOfSignatureDeclaration(signature, enclosingDeclaration, 2, writer); + errorNameNode = undefined; + } + } + function emitLines(nodes) { + for (var _i = 0, nodes_2 = nodes; _i < nodes_2.length; _i++) { + var node = nodes_2[_i]; + emit(node); + } + } + function emitSeparatedList(nodes, separator, eachNodeEmitFn, canEmitFn) { + var currentWriterPos = writer.getTextPos(); + for (var _i = 0, nodes_3 = nodes; _i < nodes_3.length; _i++) { + var node = nodes_3[_i]; + if (!canEmitFn || canEmitFn(node)) { + if (currentWriterPos !== writer.getTextPos()) { + write(separator); + } + currentWriterPos = writer.getTextPos(); + eachNodeEmitFn(node); + } + } + } + function emitCommaList(nodes, eachNodeEmitFn, canEmitFn) { + emitSeparatedList(nodes, ", ", eachNodeEmitFn, canEmitFn); + } + function writeJsDocComments(declaration) { + if (declaration) { + var jsDocComments = ts.getJsDocCommentsFromText(declaration, currentText); + ts.emitNewLineBeforeLeadingComments(currentLineMap, writer, declaration, jsDocComments); + ts.emitComments(currentText, currentLineMap, writer, jsDocComments, true, newLine, ts.writeCommentRange); + } + } + function emitTypeWithNewGetSymbolAccessibilityDiagnostic(type, getSymbolAccessibilityDiagnostic) { + writer.getSymbolAccessibilityDiagnostic = getSymbolAccessibilityDiagnostic; + emitType(type); + } + function emitType(type) { + switch (type.kind) { + case 117: + case 132: + case 130: + case 120: + case 133: + case 103: + case 135: + case 93: + case 127: + case 165: + case 166: + return writeTextOfNode(currentText, type); + case 194: + return emitExpressionWithTypeArguments(type); + case 155: + return emitTypeReference(type); + case 158: + return emitTypeQuery(type); + case 160: + return emitArrayType(type); + case 161: + return emitTupleType(type); + case 162: + return emitUnionType(type); + case 163: + return emitIntersectionType(type); + case 164: + return emitParenType(type); + case 156: + case 157: + return emitSignatureDeclarationWithJsDocComments(type); + case 159: + return emitTypeLiteral(type); + case 69: + return emitEntityName(type); + case 139: + return emitEntityName(type); + case 154: + return emitTypePredicate(type); + } + function writeEntityName(entityName) { + if (entityName.kind === 69) { + writeTextOfNode(currentText, entityName); + } + else { + var left = entityName.kind === 139 ? entityName.left : entityName.expression; + var right = entityName.kind === 139 ? entityName.right : entityName.name; + writeEntityName(left); + write("."); + writeTextOfNode(currentText, right); + } + } + function emitEntityName(entityName) { + var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 229 ? entityName.parent : enclosingDeclaration); + handleSymbolAccessibilityError(visibilityResult); + recordTypeReferenceDirectivesIfNecessary(resolver.getTypeReferenceDirectivesForEntityName(entityName)); + writeEntityName(entityName); + } + function emitExpressionWithTypeArguments(node) { + if (ts.isSupportedExpressionWithTypeArguments(node)) { + ts.Debug.assert(node.expression.kind === 69 || node.expression.kind === 172); + emitEntityName(node.expression); + if (node.typeArguments) { + write("<"); + emitCommaList(node.typeArguments, emitType); + write(">"); + } + } + } + function emitTypeReference(type) { + emitEntityName(type.typeName); + if (type.typeArguments) { + write("<"); + emitCommaList(type.typeArguments, emitType); + write(">"); + } + } + function emitTypePredicate(type) { + writeTextOfNode(currentText, type.parameterName); + write(" is "); + emitType(type.type); + } + function emitTypeQuery(type) { + write("typeof "); + emitEntityName(type.exprName); + } + function emitArrayType(type) { + emitType(type.elementType); + write("[]"); + } + function emitTupleType(type) { + write("["); + emitCommaList(type.elementTypes, emitType); + write("]"); + } + function emitUnionType(type) { + emitSeparatedList(type.types, " | ", emitType); + } + function emitIntersectionType(type) { + emitSeparatedList(type.types, " & ", emitType); + } + function emitParenType(type) { + write("("); + emitType(type.type); + write(")"); + } + function emitTypeLiteral(type) { + write("{"); + if (type.members.length) { + writeLine(); + increaseIndent(); + emitLines(type.members); + decreaseIndent(); + } + write("}"); + } + } + function emitSourceFile(node) { + currentText = node.text; + currentLineMap = ts.getLineStarts(node); + currentIdentifiers = node.identifiers; + isCurrentFileExternalModule = ts.isExternalModule(node); + enclosingDeclaration = node; + ts.emitDetachedComments(currentText, currentLineMap, writer, ts.writeCommentRange, node, newLine, true); + emitLines(node.statements); + } + function getExportDefaultTempVariableName() { + var baseName = "_default"; + if (!ts.hasProperty(currentIdentifiers, baseName)) { + return baseName; + } + var count = 0; + while (true) { + count++; + var name_22 = baseName + "_" + count; + if (!ts.hasProperty(currentIdentifiers, name_22)) { + return name_22; + } + } + } + function emitExportAssignment(node) { + if (node.expression.kind === 69) { + write(node.isExportEquals ? "export = " : "export default "); + writeTextOfNode(currentText, node.expression); + } + else { + var tempVarName = getExportDefaultTempVariableName(); + if (!noDeclare) { + write("declare "); + } + write("var "); + write(tempVarName); + write(": "); + writer.getSymbolAccessibilityDiagnostic = getDefaultExportAccessibilityDiagnostic; + resolver.writeTypeOfExpression(node.expression, enclosingDeclaration, 2, writer); + write(";"); + writeLine(); + write(node.isExportEquals ? "export = " : "export default "); + write(tempVarName); + } + write(";"); + writeLine(); + if (node.expression.kind === 69) { + var nodes = resolver.collectLinkedAliases(node.expression); + writeAsynchronousModuleElements(nodes); + } + function getDefaultExportAccessibilityDiagnostic(diagnostic) { + return { + diagnosticMessage: ts.Diagnostics.Default_export_of_the_module_has_or_is_using_private_name_0, + errorNode: node + }; + } + } + function isModuleElementVisible(node) { + return resolver.isDeclarationVisible(node); + } + function emitModuleElement(node, isModuleElementVisible) { + if (isModuleElementVisible) { + writeModuleElement(node); + } + else if (node.kind === 229 || + (node.parent.kind === 256 && isCurrentFileExternalModule)) { + var isVisible = void 0; + if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 256) { + asynchronousSubModuleDeclarationEmitInfo.push({ + node: node, + outputPos: writer.getTextPos(), + indent: writer.getIndent(), + isVisible: isVisible + }); + } + else { + if (node.kind === 230) { + var importDeclaration = node; + if (importDeclaration.importClause) { + isVisible = (importDeclaration.importClause.name && resolver.isDeclarationVisible(importDeclaration.importClause)) || + isVisibleNamedBinding(importDeclaration.importClause.namedBindings); + } + } + moduleElementDeclarationEmitInfo.push({ + node: node, + outputPos: writer.getTextPos(), + indent: writer.getIndent(), + isVisible: isVisible + }); + } + } + } + function writeModuleElement(node) { + switch (node.kind) { + case 220: + return writeFunctionDeclaration(node); + case 200: + return writeVariableStatement(node); + case 222: + return writeInterfaceDeclaration(node); + case 221: + return writeClassDeclaration(node); + case 223: + return writeTypeAliasDeclaration(node); + case 224: + return writeEnumDeclaration(node); + case 225: + return writeModuleDeclaration(node); + case 229: + return writeImportEqualsDeclaration(node); + case 230: + return writeImportDeclaration(node); + default: + ts.Debug.fail("Unknown symbol kind"); + } + } + function emitModuleElementDeclarationFlags(node) { + if (node.parent.kind === 256) { + if (node.flags & 1) { + write("export "); + } + if (node.flags & 512) { + write("default "); + } + else if (node.kind !== 222 && !noDeclare) { + write("declare "); + } + } + } + function emitClassMemberDeclarationFlags(flags) { + if (flags & 8) { + write("private "); + } + else if (flags & 16) { + write("protected "); + } + if (flags & 32) { + write("static "); + } + if (flags & 64) { + write("readonly "); + } + if (flags & 128) { + write("abstract "); + } + } + function writeImportEqualsDeclaration(node) { + emitJsDocComments(node); + if (node.flags & 1) { + write("export "); + } + write("import "); + writeTextOfNode(currentText, node.name); + write(" = "); + if (ts.isInternalModuleImportEqualsDeclaration(node)) { + emitTypeWithNewGetSymbolAccessibilityDiagnostic(node.moduleReference, getImportEntityNameVisibilityError); + write(";"); + } + else { + write("require("); + emitExternalModuleSpecifier(node); + write(");"); + } + writer.writeLine(); + function getImportEntityNameVisibilityError(symbolAccessibilityResult) { + return { + diagnosticMessage: ts.Diagnostics.Import_declaration_0_is_using_private_name_1, + errorNode: node, + typeName: node.name + }; + } + } + function isVisibleNamedBinding(namedBindings) { + if (namedBindings) { + if (namedBindings.kind === 232) { + return resolver.isDeclarationVisible(namedBindings); + } + else { + return ts.forEach(namedBindings.elements, function (namedImport) { return resolver.isDeclarationVisible(namedImport); }); + } + } + } + function writeImportDeclaration(node) { + emitJsDocComments(node); + if (node.flags & 1) { + write("export "); + } + write("import "); + if (node.importClause) { + var currentWriterPos = writer.getTextPos(); + if (node.importClause.name && resolver.isDeclarationVisible(node.importClause)) { + writeTextOfNode(currentText, node.importClause.name); + } + if (node.importClause.namedBindings && isVisibleNamedBinding(node.importClause.namedBindings)) { + if (currentWriterPos !== writer.getTextPos()) { + write(", "); + } + if (node.importClause.namedBindings.kind === 232) { + write("* as "); + writeTextOfNode(currentText, node.importClause.namedBindings.name); + } + else { + write("{ "); + emitCommaList(node.importClause.namedBindings.elements, emitImportOrExportSpecifier, resolver.isDeclarationVisible); + write(" }"); + } + } + write(" from "); + } + emitExternalModuleSpecifier(node); + write(";"); + writer.writeLine(); + } + function emitExternalModuleSpecifier(parent) { + resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || parent.kind !== 225; + var moduleSpecifier; + if (parent.kind === 229) { + var node = parent; + moduleSpecifier = ts.getExternalModuleImportEqualsDeclarationExpression(node); + } + else if (parent.kind === 225) { + moduleSpecifier = parent.name; + } + else { + var node = parent; + moduleSpecifier = node.moduleSpecifier; + } + if (moduleSpecifier.kind === 9 && isBundledEmit && (compilerOptions.out || compilerOptions.outFile)) { + var moduleName = ts.getExternalModuleNameFromDeclaration(host, resolver, parent); + if (moduleName) { + write('"'); + write(moduleName); + write('"'); + return; + } + } + writeTextOfNode(currentText, moduleSpecifier); + } + function emitImportOrExportSpecifier(node) { + if (node.propertyName) { + writeTextOfNode(currentText, node.propertyName); + write(" as "); + } + writeTextOfNode(currentText, node.name); + } + function emitExportSpecifier(node) { + emitImportOrExportSpecifier(node); + var nodes = resolver.collectLinkedAliases(node.propertyName || node.name); + writeAsynchronousModuleElements(nodes); + } + function emitExportDeclaration(node) { + emitJsDocComments(node); + write("export "); + if (node.exportClause) { + write("{ "); + emitCommaList(node.exportClause.elements, emitExportSpecifier); + write(" }"); + } + else { + write("*"); + } + if (node.moduleSpecifier) { + write(" from "); + emitExternalModuleSpecifier(node); + } + write(";"); + writer.writeLine(); + } + function writeModuleDeclaration(node) { + emitJsDocComments(node); + emitModuleElementDeclarationFlags(node); + if (ts.isGlobalScopeAugmentation(node)) { + write("global "); + } + else { + if (node.flags & 4096) { + write("namespace "); + } + else { + write("module "); + } + if (ts.isExternalModuleAugmentation(node)) { + emitExternalModuleSpecifier(node); + } + else { + writeTextOfNode(currentText, node.name); + } + } + while (node.body.kind !== 226) { + node = node.body; + write("."); + writeTextOfNode(currentText, node.name); + } + var prevEnclosingDeclaration = enclosingDeclaration; + enclosingDeclaration = node; + write(" {"); + writeLine(); + increaseIndent(); + emitLines(node.body.statements); + decreaseIndent(); + write("}"); + writeLine(); + enclosingDeclaration = prevEnclosingDeclaration; + } + function writeTypeAliasDeclaration(node) { + var prevEnclosingDeclaration = enclosingDeclaration; + enclosingDeclaration = node; + emitJsDocComments(node); + emitModuleElementDeclarationFlags(node); + write("type "); + writeTextOfNode(currentText, node.name); + emitTypeParameters(node.typeParameters); + write(" = "); + emitTypeWithNewGetSymbolAccessibilityDiagnostic(node.type, getTypeAliasDeclarationVisibilityError); + write(";"); + writeLine(); + enclosingDeclaration = prevEnclosingDeclaration; + function getTypeAliasDeclarationVisibilityError(symbolAccessibilityResult) { + return { + diagnosticMessage: ts.Diagnostics.Exported_type_alias_0_has_or_is_using_private_name_1, + errorNode: node.type, + typeName: node.name + }; + } + } + function writeEnumDeclaration(node) { + emitJsDocComments(node); + emitModuleElementDeclarationFlags(node); + if (ts.isConst(node)) { + write("const "); + } + write("enum "); + writeTextOfNode(currentText, node.name); + write(" {"); + writeLine(); + increaseIndent(); + emitLines(node.members); + decreaseIndent(); + write("}"); + writeLine(); + } + function emitEnumMemberDeclaration(node) { + emitJsDocComments(node); + writeTextOfNode(currentText, node.name); + var enumMemberValue = resolver.getConstantValue(node); + if (enumMemberValue !== undefined) { + write(" = "); + write(enumMemberValue.toString()); + } + write(","); + writeLine(); + } + function isPrivateMethodTypeParameter(node) { + return node.parent.kind === 147 && (node.parent.flags & 8); + } + function emitTypeParameters(typeParameters) { + function emitTypeParameter(node) { + increaseIndent(); + emitJsDocComments(node); + decreaseIndent(); + writeTextOfNode(currentText, node.name); + if (node.constraint && !isPrivateMethodTypeParameter(node)) { + write(" extends "); + if (node.parent.kind === 156 || + node.parent.kind === 157 || + (node.parent.parent && node.parent.parent.kind === 159)) { + ts.Debug.assert(node.parent.kind === 147 || + node.parent.kind === 146 || + node.parent.kind === 156 || + node.parent.kind === 157 || + node.parent.kind === 151 || + node.parent.kind === 152); + emitType(node.constraint); + } + else { + emitTypeWithNewGetSymbolAccessibilityDiagnostic(node.constraint, getTypeParameterConstraintVisibilityError); + } + } + function getTypeParameterConstraintVisibilityError(symbolAccessibilityResult) { + var diagnosticMessage; + switch (node.parent.kind) { + case 221: + diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; + break; + case 222: + diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; + break; + case 152: + diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; + break; + case 151: + diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; + break; + case 147: + case 146: + if (node.parent.flags & 32) { + diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; + } + else if (node.parent.parent.kind === 221) { + diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; + } + else { + diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; + } + break; + case 220: + diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; + break; + default: + ts.Debug.fail("This is unknown parent for type parameter: " + node.parent.kind); + } + return { + diagnosticMessage: diagnosticMessage, + errorNode: node, + typeName: node.name + }; + } + } + if (typeParameters) { + write("<"); + emitCommaList(typeParameters, emitTypeParameter); + write(">"); + } + } + function emitHeritageClause(typeReferences, isImplementsList) { + if (typeReferences) { + write(isImplementsList ? " implements " : " extends "); + emitCommaList(typeReferences, emitTypeOfTypeReference); + } + function emitTypeOfTypeReference(node) { + if (ts.isSupportedExpressionWithTypeArguments(node)) { + emitTypeWithNewGetSymbolAccessibilityDiagnostic(node, getHeritageClauseVisibilityError); + } + else if (!isImplementsList && node.expression.kind === 93) { + write("null"); + } + else { + writer.getSymbolAccessibilityDiagnostic = getHeritageClauseVisibilityError; + resolver.writeBaseConstructorTypeOfClass(enclosingDeclaration, enclosingDeclaration, 2, writer); + } + function getHeritageClauseVisibilityError(symbolAccessibilityResult) { + var diagnosticMessage; + if (node.parent.parent.kind === 221) { + diagnosticMessage = isImplementsList ? + ts.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 : + ts.Diagnostics.Extends_clause_of_exported_class_0_has_or_is_using_private_name_1; + } + else { + diagnosticMessage = ts.Diagnostics.Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1; + } + return { + diagnosticMessage: diagnosticMessage, + errorNode: node, + typeName: node.parent.parent.name + }; + } + } + } + function writeClassDeclaration(node) { + function emitParameterProperties(constructorDeclaration) { + if (constructorDeclaration) { + ts.forEach(constructorDeclaration.parameters, function (param) { + if (param.flags & 92) { + emitPropertyDeclaration(param); + } + }); + } + } + emitJsDocComments(node); + emitModuleElementDeclarationFlags(node); + if (node.flags & 128) { + write("abstract "); + } + write("class "); + writeTextOfNode(currentText, node.name); + var prevEnclosingDeclaration = enclosingDeclaration; + enclosingDeclaration = node; + emitTypeParameters(node.typeParameters); + var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); + if (baseTypeNode) { + emitHeritageClause([baseTypeNode], false); + } + emitHeritageClause(ts.getClassImplementsHeritageClauseElements(node), true); + write(" {"); + writeLine(); + increaseIndent(); + emitParameterProperties(ts.getFirstConstructorWithBody(node)); + emitLines(node.members); + decreaseIndent(); + write("}"); + writeLine(); + enclosingDeclaration = prevEnclosingDeclaration; + } + function writeInterfaceDeclaration(node) { + emitJsDocComments(node); + emitModuleElementDeclarationFlags(node); + write("interface "); + writeTextOfNode(currentText, node.name); + var prevEnclosingDeclaration = enclosingDeclaration; + enclosingDeclaration = node; + emitTypeParameters(node.typeParameters); + emitHeritageClause(ts.getInterfaceBaseTypeNodes(node), false); + write(" {"); + writeLine(); + increaseIndent(); + emitLines(node.members); + decreaseIndent(); + write("}"); + writeLine(); + enclosingDeclaration = prevEnclosingDeclaration; + } + function emitPropertyDeclaration(node) { + if (ts.hasDynamicName(node)) { + return; + } + emitJsDocComments(node); + emitClassMemberDeclarationFlags(node.flags); + emitVariableDeclaration(node); + write(";"); + writeLine(); + } + function emitVariableDeclaration(node) { + if (node.kind !== 218 || resolver.isDeclarationVisible(node)) { + if (ts.isBindingPattern(node.name)) { + emitBindingPattern(node.name); + } + else { + writeTextOfNode(currentText, node.name); + if ((node.kind === 145 || node.kind === 144 || node.kind === 142) && ts.hasQuestionToken(node)) { + write("?"); + } + if ((node.kind === 145 || node.kind === 144) && node.parent.kind === 159) { + emitTypeOfVariableDeclarationFromTypeLiteral(node); + } + else if (!(node.flags & 8)) { + writeTypeOfDeclaration(node, node.type, getVariableDeclarationTypeVisibilityError); + } + } + } + function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { + if (node.kind === 218) { + return symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === 2 ? + ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : + ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Exported_variable_0_has_or_is_using_private_name_1; + } + else if (node.kind === 145 || node.kind === 144) { + if (node.flags & 32) { + return symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === 2 ? + ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : + ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; + } + else if (node.parent.kind === 221) { + return symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === 2 ? + ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : + ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_private_name_1; + } + else { + return symbolAccessibilityResult.errorModuleName ? + ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_private_name_1; + } + } + } + function getVariableDeclarationTypeVisibilityError(symbolAccessibilityResult) { + var diagnosticMessage = getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult); + return diagnosticMessage !== undefined ? { + diagnosticMessage: diagnosticMessage, + errorNode: node, + typeName: node.name + } : undefined; + } + function emitBindingPattern(bindingPattern) { + var elements = []; + for (var _i = 0, _a = bindingPattern.elements; _i < _a.length; _i++) { + var element = _a[_i]; + if (element.kind !== 193) { + elements.push(element); + } + } + emitCommaList(elements, emitBindingElement); + } + function emitBindingElement(bindingElement) { + function getBindingElementTypeVisibilityError(symbolAccessibilityResult) { + var diagnosticMessage = getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult); + return diagnosticMessage !== undefined ? { + diagnosticMessage: diagnosticMessage, + errorNode: bindingElement, + typeName: bindingElement.name + } : undefined; + } + if (bindingElement.name) { + if (ts.isBindingPattern(bindingElement.name)) { + emitBindingPattern(bindingElement.name); + } + else { + writeTextOfNode(currentText, bindingElement.name); + writeTypeOfDeclaration(bindingElement, undefined, getBindingElementTypeVisibilityError); + } + } + } + } + function emitTypeOfVariableDeclarationFromTypeLiteral(node) { + if (node.type) { + write(": "); + emitType(node.type); + } + } + function isVariableStatementVisible(node) { + return ts.forEach(node.declarationList.declarations, function (varDeclaration) { return resolver.isDeclarationVisible(varDeclaration); }); + } + function writeVariableStatement(node) { + emitJsDocComments(node); + emitModuleElementDeclarationFlags(node); + if (ts.isLet(node.declarationList)) { + write("let "); + } + else if (ts.isConst(node.declarationList)) { + write("const "); + } + else { + write("var "); + } + emitCommaList(node.declarationList.declarations, emitVariableDeclaration, resolver.isDeclarationVisible); + write(";"); + writeLine(); + } + function emitAccessorDeclaration(node) { + if (ts.hasDynamicName(node)) { + return; + } + var accessors = ts.getAllAccessorDeclarations(node.parent.members, node); + var accessorWithTypeAnnotation; + if (node === accessors.firstAccessor) { + emitJsDocComments(accessors.getAccessor); + emitJsDocComments(accessors.setAccessor); + emitClassMemberDeclarationFlags(node.flags | (accessors.setAccessor ? 0 : 64)); + writeTextOfNode(currentText, node.name); + if (!(node.flags & 8)) { + accessorWithTypeAnnotation = node; + var type = getTypeAnnotationFromAccessor(node); + if (!type) { + var anotherAccessor = node.kind === 149 ? accessors.setAccessor : accessors.getAccessor; + type = getTypeAnnotationFromAccessor(anotherAccessor); + if (type) { + accessorWithTypeAnnotation = anotherAccessor; + } + } + writeTypeOfDeclaration(node, type, getAccessorDeclarationTypeVisibilityError); + } + write(";"); + writeLine(); + } + function getTypeAnnotationFromAccessor(accessor) { + if (accessor) { + return accessor.kind === 149 + ? accessor.type + : accessor.parameters.length > 0 + ? accessor.parameters[0].type + : undefined; + } + } + function getAccessorDeclarationTypeVisibilityError(symbolAccessibilityResult) { + var diagnosticMessage; + if (accessorWithTypeAnnotation.kind === 150) { + if (accessorWithTypeAnnotation.parent.flags & 32) { + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? + ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1; + } + else { + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? + ts.Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1; + } + return { + diagnosticMessage: diagnosticMessage, + errorNode: accessorWithTypeAnnotation.parameters[0], + typeName: accessorWithTypeAnnotation.name + }; + } + else { + if (accessorWithTypeAnnotation.flags & 32) { + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === 2 ? + ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : + ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 : + ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0; + } + else { + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === 2 ? + ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : + ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 : + ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0; + } + return { + diagnosticMessage: diagnosticMessage, + errorNode: accessorWithTypeAnnotation.name, + typeName: undefined + }; + } + } + } + function writeFunctionDeclaration(node) { + if (ts.hasDynamicName(node)) { + return; + } + if (!resolver.isImplementationOfOverload(node)) { + emitJsDocComments(node); + if (node.kind === 220) { + emitModuleElementDeclarationFlags(node); + } + else if (node.kind === 147 || node.kind === 148) { + emitClassMemberDeclarationFlags(node.flags); + } + if (node.kind === 220) { + write("function "); + writeTextOfNode(currentText, node.name); + } + else if (node.kind === 148) { + write("constructor"); + } + else { + writeTextOfNode(currentText, node.name); + if (ts.hasQuestionToken(node)) { + write("?"); + } + } + emitSignatureDeclaration(node); + } + } + function emitSignatureDeclarationWithJsDocComments(node) { + emitJsDocComments(node); + emitSignatureDeclaration(node); + } + function emitSignatureDeclaration(node) { + var prevEnclosingDeclaration = enclosingDeclaration; + enclosingDeclaration = node; + var closeParenthesizedFunctionType = false; + if (node.kind === 153) { + emitClassMemberDeclarationFlags(node.flags); + write("["); + } + else { + if (node.kind === 152 || node.kind === 157) { + write("new "); + } + else if (node.kind === 156) { + var currentOutput = writer.getText(); + if (node.typeParameters && currentOutput.charAt(currentOutput.length - 1) === "<") { + closeParenthesizedFunctionType = true; + write("("); + } + } + emitTypeParameters(node.typeParameters); + write("("); + } + emitCommaList(node.parameters, emitParameterDeclaration); + if (node.kind === 153) { + write("]"); + } + else { + write(")"); + } + var isFunctionTypeOrConstructorType = node.kind === 156 || node.kind === 157; + if (isFunctionTypeOrConstructorType || node.parent.kind === 159) { + if (node.type) { + write(isFunctionTypeOrConstructorType ? " => " : ": "); + emitType(node.type); + } + } + else if (node.kind !== 148 && !(node.flags & 8)) { + writeReturnTypeAtSignature(node, getReturnTypeVisibilityError); + } + enclosingDeclaration = prevEnclosingDeclaration; + if (!isFunctionTypeOrConstructorType) { + write(";"); + writeLine(); + } + else if (closeParenthesizedFunctionType) { + write(")"); + } + function getReturnTypeVisibilityError(symbolAccessibilityResult) { + var diagnosticMessage; + switch (node.kind) { + case 152: + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? + ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : + ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0; + break; + case 151: + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? + ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : + ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0; + break; + case 153: + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? + ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : + ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0; + break; + case 147: + case 146: + if (node.flags & 32) { + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === 2 ? + ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : + ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : + ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0; + } + else if (node.parent.kind === 221) { + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === 2 ? + ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : + ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : + ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0; + } + else { + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? + ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : + ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; + } + break; + case 220: + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === 2 ? + ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : + ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1 : + ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_private_name_0; + break; + default: + ts.Debug.fail("This is unknown kind for signature: " + node.kind); + } + return { + diagnosticMessage: diagnosticMessage, + errorNode: node.name || node + }; + } + } + function emitParameterDeclaration(node) { + increaseIndent(); + emitJsDocComments(node); + if (node.dotDotDotToken) { + write("..."); + } + if (ts.isBindingPattern(node.name)) { + emitBindingPattern(node.name); + } + else { + writeTextOfNode(currentText, node.name); + } + if (resolver.isOptionalParameter(node)) { + write("?"); + } + decreaseIndent(); + if (node.parent.kind === 156 || + node.parent.kind === 157 || + node.parent.parent.kind === 159) { + emitTypeOfVariableDeclarationFromTypeLiteral(node); + } + else if (!(node.parent.flags & 8)) { + writeTypeOfDeclaration(node, node.type, getParameterDeclarationTypeVisibilityError); + } + function getParameterDeclarationTypeVisibilityError(symbolAccessibilityResult) { + var diagnosticMessage = getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult); + return diagnosticMessage !== undefined ? { + diagnosticMessage: diagnosticMessage, + errorNode: node, + typeName: node.name + } : undefined; + } + function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { + switch (node.parent.kind) { + case 148: + return symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === 2 ? + ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : + ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1; + case 152: + return symbolAccessibilityResult.errorModuleName ? + ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; + case 151: + return symbolAccessibilityResult.errorModuleName ? + ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; + case 147: + case 146: + if (node.parent.flags & 32) { + return symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === 2 ? + ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : + ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; + } + else if (node.parent.parent.kind === 221) { + return symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === 2 ? + ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : + ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; + } + else { + return symbolAccessibilityResult.errorModuleName ? + ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; + } + case 220: + return symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === 2 ? + ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : + ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1; + default: + ts.Debug.fail("This is unknown parent for parameter: " + node.parent.kind); + } + } + function emitBindingPattern(bindingPattern) { + if (bindingPattern.kind === 167) { + write("{"); + emitCommaList(bindingPattern.elements, emitBindingElement); + write("}"); + } + else if (bindingPattern.kind === 168) { + write("["); + var elements = bindingPattern.elements; + emitCommaList(elements, emitBindingElement); + if (elements && elements.hasTrailingComma) { + write(", "); + } + write("]"); + } + } + function emitBindingElement(bindingElement) { + if (bindingElement.kind === 193) { + write(" "); + } + else if (bindingElement.kind === 169) { + if (bindingElement.propertyName) { + writeTextOfNode(currentText, bindingElement.propertyName); + write(": "); + } + if (bindingElement.name) { + if (ts.isBindingPattern(bindingElement.name)) { + emitBindingPattern(bindingElement.name); + } + else { + ts.Debug.assert(bindingElement.name.kind === 69); + if (bindingElement.dotDotDotToken) { + write("..."); + } + writeTextOfNode(currentText, bindingElement.name); + } + } + } + } + } + function emitNode(node) { + switch (node.kind) { + case 220: + case 225: + case 229: + case 222: + case 221: + case 223: + case 224: + return emitModuleElement(node, isModuleElementVisible(node)); + case 200: + return emitModuleElement(node, isVariableStatementVisible(node)); + case 230: + return emitModuleElement(node, !node.importClause); + case 236: + return emitExportDeclaration(node); + case 148: + case 147: + case 146: + return writeFunctionDeclaration(node); + case 152: + case 151: + case 153: + return emitSignatureDeclarationWithJsDocComments(node); + case 149: + case 150: + return emitAccessorDeclaration(node); + case 145: + case 144: + return emitPropertyDeclaration(node); + case 255: + return emitEnumMemberDeclaration(node); + case 235: + return emitExportAssignment(node); + case 256: + return emitSourceFile(node); + } + } + function writeReferencePath(referencedFile, addBundledFileReference) { + var declFileName; + var addedBundledEmitReference = false; + if (ts.isDeclarationFile(referencedFile)) { + declFileName = referencedFile.fileName; + } + else { + ts.forEachExpectedEmitFile(host, getDeclFileName, referencedFile); + } + if (declFileName) { + declFileName = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizeSlashes(declarationFilePath)), declFileName, host.getCurrentDirectory(), host.getCanonicalFileName, false); + referencesOutput += "/// " + newLine; + } + return addedBundledEmitReference; + function getDeclFileName(emitFileNames, sourceFiles, isBundledEmit) { + if (isBundledEmit && !addBundledFileReference) { + return; + } + ts.Debug.assert(!!emitFileNames.declarationFilePath || ts.isSourceFileJavaScript(referencedFile), "Declaration file is not present only for javascript files"); + declFileName = emitFileNames.declarationFilePath || emitFileNames.jsFilePath; + addedBundledEmitReference = isBundledEmit; + } + } + } + function writeDeclarationFile(declarationFilePath, sourceFiles, isBundledEmit, host, resolver, emitterDiagnostics) { + var emitDeclarationResult = emitDeclarations(host, resolver, emitterDiagnostics, declarationFilePath, sourceFiles, isBundledEmit); + var emitSkipped = emitDeclarationResult.reportedDeclarationError || host.isEmitBlocked(declarationFilePath) || host.getCompilerOptions().noEmit; + if (!emitSkipped) { + var declarationOutput = emitDeclarationResult.referencesOutput + + getDeclarationOutput(emitDeclarationResult.synchronousDeclarationOutput, emitDeclarationResult.moduleElementDeclarationEmitInfo); + ts.writeFile(host, emitterDiagnostics, declarationFilePath, declarationOutput, host.getCompilerOptions().emitBOM, sourceFiles); + } + return emitSkipped; + function getDeclarationOutput(synchronousDeclarationOutput, moduleElementDeclarationEmitInfo) { + var appliedSyncOutputPos = 0; + var declarationOutput = ""; + ts.forEach(moduleElementDeclarationEmitInfo, function (aliasEmitInfo) { + if (aliasEmitInfo.asynchronousOutput) { + declarationOutput += synchronousDeclarationOutput.substring(appliedSyncOutputPos, aliasEmitInfo.outputPos); + declarationOutput += getDeclarationOutput(aliasEmitInfo.asynchronousOutput, aliasEmitInfo.subModuleElementDeclarationEmitInfo); + appliedSyncOutputPos = aliasEmitInfo.outputPos; + } + }); + declarationOutput += synchronousDeclarationOutput.substring(appliedSyncOutputPos); + return declarationOutput; + } + } + ts.writeDeclarationFile = writeDeclarationFile; +})(ts || (ts = {})); +var ts; +(function (ts) { + function getResolvedExternalModuleName(host, file) { + return file.moduleName || ts.getExternalModuleNameFromPath(host, file.fileName); + } + ts.getResolvedExternalModuleName = getResolvedExternalModuleName; + function getExternalModuleNameFromDeclaration(host, resolver, declaration) { + var file = resolver.getExternalModuleFileFromDeclaration(declaration); + if (!file || ts.isDeclarationFile(file)) { + return undefined; + } + return getResolvedExternalModuleName(host, file); + } + ts.getExternalModuleNameFromDeclaration = getExternalModuleNameFromDeclaration; + var entities = { + "quot": 0x0022, + "amp": 0x0026, + "apos": 0x0027, + "lt": 0x003C, + "gt": 0x003E, + "nbsp": 0x00A0, + "iexcl": 0x00A1, + "cent": 0x00A2, + "pound": 0x00A3, + "curren": 0x00A4, + "yen": 0x00A5, + "brvbar": 0x00A6, + "sect": 0x00A7, + "uml": 0x00A8, + "copy": 0x00A9, + "ordf": 0x00AA, + "laquo": 0x00AB, + "not": 0x00AC, + "shy": 0x00AD, + "reg": 0x00AE, + "macr": 0x00AF, + "deg": 0x00B0, + "plusmn": 0x00B1, + "sup2": 0x00B2, + "sup3": 0x00B3, + "acute": 0x00B4, + "micro": 0x00B5, + "para": 0x00B6, + "middot": 0x00B7, + "cedil": 0x00B8, + "sup1": 0x00B9, + "ordm": 0x00BA, + "raquo": 0x00BB, + "frac14": 0x00BC, + "frac12": 0x00BD, + "frac34": 0x00BE, + "iquest": 0x00BF, + "Agrave": 0x00C0, + "Aacute": 0x00C1, + "Acirc": 0x00C2, + "Atilde": 0x00C3, + "Auml": 0x00C4, + "Aring": 0x00C5, + "AElig": 0x00C6, + "Ccedil": 0x00C7, + "Egrave": 0x00C8, + "Eacute": 0x00C9, + "Ecirc": 0x00CA, + "Euml": 0x00CB, + "Igrave": 0x00CC, + "Iacute": 0x00CD, + "Icirc": 0x00CE, + "Iuml": 0x00CF, + "ETH": 0x00D0, + "Ntilde": 0x00D1, + "Ograve": 0x00D2, + "Oacute": 0x00D3, + "Ocirc": 0x00D4, + "Otilde": 0x00D5, + "Ouml": 0x00D6, + "times": 0x00D7, + "Oslash": 0x00D8, + "Ugrave": 0x00D9, + "Uacute": 0x00DA, + "Ucirc": 0x00DB, + "Uuml": 0x00DC, + "Yacute": 0x00DD, + "THORN": 0x00DE, + "szlig": 0x00DF, + "agrave": 0x00E0, + "aacute": 0x00E1, + "acirc": 0x00E2, + "atilde": 0x00E3, + "auml": 0x00E4, + "aring": 0x00E5, + "aelig": 0x00E6, + "ccedil": 0x00E7, + "egrave": 0x00E8, + "eacute": 0x00E9, + "ecirc": 0x00EA, + "euml": 0x00EB, + "igrave": 0x00EC, + "iacute": 0x00ED, + "icirc": 0x00EE, + "iuml": 0x00EF, + "eth": 0x00F0, + "ntilde": 0x00F1, + "ograve": 0x00F2, + "oacute": 0x00F3, + "ocirc": 0x00F4, + "otilde": 0x00F5, + "ouml": 0x00F6, + "divide": 0x00F7, + "oslash": 0x00F8, + "ugrave": 0x00F9, + "uacute": 0x00FA, + "ucirc": 0x00FB, + "uuml": 0x00FC, + "yacute": 0x00FD, + "thorn": 0x00FE, + "yuml": 0x00FF, + "OElig": 0x0152, + "oelig": 0x0153, + "Scaron": 0x0160, + "scaron": 0x0161, + "Yuml": 0x0178, + "fnof": 0x0192, + "circ": 0x02C6, + "tilde": 0x02DC, + "Alpha": 0x0391, + "Beta": 0x0392, + "Gamma": 0x0393, + "Delta": 0x0394, + "Epsilon": 0x0395, + "Zeta": 0x0396, + "Eta": 0x0397, + "Theta": 0x0398, + "Iota": 0x0399, + "Kappa": 0x039A, + "Lambda": 0x039B, + "Mu": 0x039C, + "Nu": 0x039D, + "Xi": 0x039E, + "Omicron": 0x039F, + "Pi": 0x03A0, + "Rho": 0x03A1, + "Sigma": 0x03A3, + "Tau": 0x03A4, + "Upsilon": 0x03A5, + "Phi": 0x03A6, + "Chi": 0x03A7, + "Psi": 0x03A8, + "Omega": 0x03A9, + "alpha": 0x03B1, + "beta": 0x03B2, + "gamma": 0x03B3, + "delta": 0x03B4, + "epsilon": 0x03B5, + "zeta": 0x03B6, + "eta": 0x03B7, + "theta": 0x03B8, + "iota": 0x03B9, + "kappa": 0x03BA, + "lambda": 0x03BB, + "mu": 0x03BC, + "nu": 0x03BD, + "xi": 0x03BE, + "omicron": 0x03BF, + "pi": 0x03C0, + "rho": 0x03C1, + "sigmaf": 0x03C2, + "sigma": 0x03C3, + "tau": 0x03C4, + "upsilon": 0x03C5, + "phi": 0x03C6, + "chi": 0x03C7, + "psi": 0x03C8, + "omega": 0x03C9, + "thetasym": 0x03D1, + "upsih": 0x03D2, + "piv": 0x03D6, + "ensp": 0x2002, + "emsp": 0x2003, + "thinsp": 0x2009, + "zwnj": 0x200C, + "zwj": 0x200D, + "lrm": 0x200E, + "rlm": 0x200F, + "ndash": 0x2013, + "mdash": 0x2014, + "lsquo": 0x2018, + "rsquo": 0x2019, + "sbquo": 0x201A, + "ldquo": 0x201C, + "rdquo": 0x201D, + "bdquo": 0x201E, + "dagger": 0x2020, + "Dagger": 0x2021, + "bull": 0x2022, + "hellip": 0x2026, + "permil": 0x2030, + "prime": 0x2032, + "Prime": 0x2033, + "lsaquo": 0x2039, + "rsaquo": 0x203A, + "oline": 0x203E, + "frasl": 0x2044, + "euro": 0x20AC, + "image": 0x2111, + "weierp": 0x2118, + "real": 0x211C, + "trade": 0x2122, + "alefsym": 0x2135, + "larr": 0x2190, + "uarr": 0x2191, + "rarr": 0x2192, + "darr": 0x2193, + "harr": 0x2194, + "crarr": 0x21B5, + "lArr": 0x21D0, + "uArr": 0x21D1, + "rArr": 0x21D2, + "dArr": 0x21D3, + "hArr": 0x21D4, + "forall": 0x2200, + "part": 0x2202, + "exist": 0x2203, + "empty": 0x2205, + "nabla": 0x2207, + "isin": 0x2208, + "notin": 0x2209, + "ni": 0x220B, + "prod": 0x220F, + "sum": 0x2211, + "minus": 0x2212, + "lowast": 0x2217, + "radic": 0x221A, + "prop": 0x221D, + "infin": 0x221E, + "ang": 0x2220, + "and": 0x2227, + "or": 0x2228, + "cap": 0x2229, + "cup": 0x222A, + "int": 0x222B, + "there4": 0x2234, + "sim": 0x223C, + "cong": 0x2245, + "asymp": 0x2248, + "ne": 0x2260, + "equiv": 0x2261, + "le": 0x2264, + "ge": 0x2265, + "sub": 0x2282, + "sup": 0x2283, + "nsub": 0x2284, + "sube": 0x2286, + "supe": 0x2287, + "oplus": 0x2295, + "otimes": 0x2297, + "perp": 0x22A5, + "sdot": 0x22C5, + "lceil": 0x2308, + "rceil": 0x2309, + "lfloor": 0x230A, + "rfloor": 0x230B, + "lang": 0x2329, + "rang": 0x232A, + "loz": 0x25CA, + "spades": 0x2660, + "clubs": 0x2663, + "hearts": 0x2665, + "diams": 0x2666 + }; + function emitFiles(resolver, host, targetSourceFile) { + var extendsHelper = "\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};"; + var assignHelper = "\nvar __assign = (this && this.__assign) || Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n};"; + var decorateHelper = "\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};"; + var metadataHelper = "\nvar __metadata = (this && this.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};"; + var paramHelper = "\nvar __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n};"; + var awaiterHelper = "\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator.throw(value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments)).next());\n });\n};"; + var compilerOptions = host.getCompilerOptions(); + var languageVersion = ts.getEmitScriptTarget(compilerOptions); + var modulekind = ts.getEmitModuleKind(compilerOptions); + var sourceMapDataList = compilerOptions.sourceMap || compilerOptions.inlineSourceMap ? [] : undefined; + var emittedFilesList = compilerOptions.listEmittedFiles ? [] : undefined; + var emitterDiagnostics = ts.createDiagnosticCollection(); + var emitSkipped = false; + var newLine = host.getNewLine(); + var emitJavaScript = createFileEmitter(); + ts.forEachExpectedEmitFile(host, emitFile, targetSourceFile); + return { + emitSkipped: emitSkipped, + diagnostics: emitterDiagnostics.getDiagnostics(), + emittedFiles: emittedFilesList, + sourceMaps: sourceMapDataList + }; + function isUniqueLocalName(name, container) { + for (var node = container; ts.isNodeDescendentOf(node, container); node = node.nextContainer) { + if (node.locals && ts.hasProperty(node.locals, name)) { + if (node.locals[name].flags & (107455 | 1048576 | 8388608)) { + return false; + } + } + } + return true; + } + function setLabeledJump(state, isBreak, labelText, labelMarker) { + if (isBreak) { + if (!state.labeledNonLocalBreaks) { + state.labeledNonLocalBreaks = {}; + } + state.labeledNonLocalBreaks[labelText] = labelMarker; + } + else { + if (!state.labeledNonLocalContinues) { + state.labeledNonLocalContinues = {}; + } + state.labeledNonLocalContinues[labelText] = labelMarker; + } + } + function hoistVariableDeclarationFromLoop(state, declaration) { + if (!state.hoistedLocalVariables) { + state.hoistedLocalVariables = []; + } + visit(declaration.name); + function visit(node) { + if (node.kind === 69) { + state.hoistedLocalVariables.push(node); + } + else { + for (var _a = 0, _b = node.elements; _a < _b.length; _a++) { + var element = _b[_a]; + visit(element.name); + } + } + } + } + function createFileEmitter() { + var writer = ts.createTextWriter(newLine); + var write = writer.write, writeTextOfNode = writer.writeTextOfNode, writeLine = writer.writeLine, increaseIndent = writer.increaseIndent, decreaseIndent = writer.decreaseIndent; + var sourceMap = compilerOptions.sourceMap || compilerOptions.inlineSourceMap ? ts.createSourceMapWriter(host, writer) : ts.getNullSourceMapWriter(); + var setSourceFile = sourceMap.setSourceFile, emitStart = sourceMap.emitStart, emitEnd = sourceMap.emitEnd, emitPos = sourceMap.emitPos; + var currentSourceFile; + var currentText; + var currentLineMap; + var currentFileIdentifiers; + var renamedDependencies; + var isEs6Module; + var isCurrentFileExternalModule; + var exportFunctionForFile; + var contextObjectForFile; + var generatedNameSet; + var nodeToGeneratedName; + var computedPropertyNamesToGeneratedNames; + var decoratedClassAliases; + var convertedLoopState; + var extendsEmitted; + var assignEmitted; + var decorateEmitted; + var paramEmitted; + var awaiterEmitted; + var tempFlags = 0; + var tempVariables; + var tempParameters; + var externalImports; + var exportSpecifiers; + var exportEquals; + var hasExportStarsToExportValues; + var detachedCommentsInfo; + var sourceMapData; + var isOwnFileEmit; + var emitLeadingCommentsOfPosition = compilerOptions.removeComments ? function (pos) { } : emitLeadingCommentsOfPositionWorker; + var setSourceMapWriterEmit = compilerOptions.sourceMap || compilerOptions.inlineSourceMap ? changeSourceMapEmit : function (writer) { }; + var moduleEmitDelegates = (_a = {}, + _a[ts.ModuleKind.ES6] = emitES6Module, + _a[ts.ModuleKind.AMD] = emitAMDModule, + _a[ts.ModuleKind.System] = emitSystemModule, + _a[ts.ModuleKind.UMD] = emitUMDModule, + _a[ts.ModuleKind.CommonJS] = emitCommonJSModule, + _a + ); + var bundleEmitDelegates = (_b = {}, + _b[ts.ModuleKind.ES6] = function () { }, + _b[ts.ModuleKind.AMD] = emitAMDModule, + _b[ts.ModuleKind.System] = emitSystemModule, + _b[ts.ModuleKind.UMD] = function () { }, + _b[ts.ModuleKind.CommonJS] = function () { }, + _b + ); + return doEmit; + function doEmit(jsFilePath, sourceMapFilePath, sourceFiles, isBundledEmit) { + sourceMap.initialize(jsFilePath, sourceMapFilePath, sourceFiles, isBundledEmit); + generatedNameSet = {}; + nodeToGeneratedName = []; + decoratedClassAliases = []; + isOwnFileEmit = !isBundledEmit; + if (isBundledEmit && modulekind) { + ts.forEach(sourceFiles, emitEmitHelpers); + } + ts.forEach(sourceFiles, emitSourceFile); + writeLine(); + var sourceMappingURL = sourceMap.getSourceMappingURL(); + if (sourceMappingURL) { + write("//# sourceMappingURL=" + sourceMappingURL); + } + writeEmittedFiles(writer.getText(), jsFilePath, sourceMapFilePath, compilerOptions.emitBOM, sourceFiles); + sourceMap.reset(); + writer.reset(); + currentSourceFile = undefined; + currentText = undefined; + currentLineMap = undefined; + exportFunctionForFile = undefined; + contextObjectForFile = undefined; + generatedNameSet = undefined; + nodeToGeneratedName = undefined; + decoratedClassAliases = undefined; + computedPropertyNamesToGeneratedNames = undefined; + convertedLoopState = undefined; + extendsEmitted = false; + decorateEmitted = false; + paramEmitted = false; + awaiterEmitted = false; + assignEmitted = false; + tempFlags = 0; + tempVariables = undefined; + tempParameters = undefined; + externalImports = undefined; + exportSpecifiers = undefined; + exportEquals = undefined; + hasExportStarsToExportValues = undefined; + detachedCommentsInfo = undefined; + sourceMapData = undefined; + isEs6Module = false; + renamedDependencies = undefined; + isCurrentFileExternalModule = false; + } + function emitSourceFile(sourceFile) { + currentSourceFile = sourceFile; + currentText = sourceFile.text; + currentLineMap = ts.getLineStarts(sourceFile); + exportFunctionForFile = undefined; + contextObjectForFile = undefined; + isEs6Module = sourceFile.symbol && sourceFile.symbol.exports && !!sourceFile.symbol.exports["___esModule"]; + renamedDependencies = sourceFile.renamedDependencies; + currentFileIdentifiers = sourceFile.identifiers; + isCurrentFileExternalModule = ts.isExternalModule(sourceFile); + setSourceFile(sourceFile); + emitNodeWithCommentsAndWithoutSourcemap(sourceFile); + } + function isUniqueName(name) { + return !resolver.hasGlobalName(name) && + !ts.hasProperty(currentFileIdentifiers, name) && + !ts.hasProperty(generatedNameSet, name); + } + function makeTempVariableName(flags) { + if (flags && !(tempFlags & flags)) { + var name_23 = flags === 268435456 ? "_i" : "_n"; + if (isUniqueName(name_23)) { + tempFlags |= flags; + return name_23; + } + } + while (true) { + var count = tempFlags & 268435455; + tempFlags++; + if (count !== 8 && count !== 13) { + var name_24 = count < 26 ? "_" + String.fromCharCode(97 + count) : "_" + (count - 26); + if (isUniqueName(name_24)) { + return name_24; + } + } + } + } + function makeUniqueName(baseName) { + if (baseName.charCodeAt(baseName.length - 1) !== 95) { + baseName += "_"; + } + var i = 1; + while (true) { + var generatedName = baseName + i; + if (isUniqueName(generatedName)) { + return generatedNameSet[generatedName] = generatedName; + } + i++; + } + } + function generateNameForModuleOrEnum(node) { + var name = node.name.text; + return isUniqueLocalName(name, node) ? name : makeUniqueName(name); + } + function generateNameForImportOrExportDeclaration(node) { + var expr = ts.getExternalModuleName(node); + var baseName = expr.kind === 9 ? + ts.escapeIdentifier(ts.makeIdentifierFromModuleName(expr.text)) : "module"; + return makeUniqueName(baseName); + } + function generateNameForExportDefault() { + return makeUniqueName("default"); + } + function generateNameForClassExpression() { + return makeUniqueName("class"); + } + function generateNameForNode(node) { + switch (node.kind) { + case 69: + return makeUniqueName(node.text); + case 225: + case 224: + return generateNameForModuleOrEnum(node); + case 230: + case 236: + return generateNameForImportOrExportDeclaration(node); + case 220: + case 221: + case 235: + return generateNameForExportDefault(); + case 192: + return generateNameForClassExpression(); + } + } + function getGeneratedNameForNode(node) { + var id = ts.getNodeId(node); + return nodeToGeneratedName[id] || (nodeToGeneratedName[id] = ts.unescapeIdentifier(generateNameForNode(node))); + } + function writeEmittedFiles(emitOutput, jsFilePath, sourceMapFilePath, writeByteOrderMark, sourceFiles) { + if (compilerOptions.sourceMap && !compilerOptions.inlineSourceMap) { + ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap.getText(), false, sourceFiles); + } + if (sourceMapDataList) { + sourceMapDataList.push(sourceMap.getSourceMapData()); + } + ts.writeFile(host, emitterDiagnostics, jsFilePath, emitOutput, writeByteOrderMark, sourceFiles); + } + function createTempVariable(flags) { + var result = ts.createSynthesizedNode(69); + result.text = makeTempVariableName(flags); + return result; + } + function recordTempDeclaration(name) { + if (!tempVariables) { + tempVariables = []; + } + tempVariables.push(name); + } + function createAndRecordTempVariable(flags) { + var temp = createTempVariable(flags); + recordTempDeclaration(temp); + return temp; + } + function emitTempDeclarations(newLine) { + if (tempVariables) { + if (newLine) { + writeLine(); + } + else { + write(" "); + } + write("var "); + emitCommaList(tempVariables); + write(";"); + } + } + function emitToken(tokenKind, startPos, emitFn) { + var tokenStartPos = ts.skipTrivia(currentText, startPos); + emitPos(tokenStartPos); + var tokenString = ts.tokenToString(tokenKind); + if (emitFn) { + emitFn(); + } + else { + write(tokenString); + } + var tokenEndPos = tokenStartPos + tokenString.length; + emitPos(tokenEndPos); + return tokenEndPos; + } + function emitOptional(prefix, node) { + if (node) { + write(prefix); + emit(node); + } + } + function emitParenthesizedIf(node, parenthesized) { + if (parenthesized) { + write("("); + } + emit(node); + if (parenthesized) { + write(")"); + } + } + function emitLinePreservingList(parent, nodes, allowTrailingComma, spacesBetweenBraces) { + ts.Debug.assert(nodes.length > 0); + increaseIndent(); + if (nodeStartPositionsAreOnSameLine(parent, nodes[0])) { + if (spacesBetweenBraces) { + write(" "); + } + } + else { + writeLine(); + } + for (var i = 0, n = nodes.length; i < n; i++) { + if (i) { + if (nodeEndIsOnSameLineAsNodeStart(nodes[i - 1], nodes[i])) { + write(", "); + } + else { + write(","); + writeLine(); + } + } + emit(nodes[i]); + } + if (nodes.hasTrailingComma && allowTrailingComma) { + write(","); + } + decreaseIndent(); + if (nodeEndPositionsAreOnSameLine(parent, ts.lastOrUndefined(nodes))) { + if (spacesBetweenBraces) { + write(" "); + } + } + else { + writeLine(); + } + } + function emitList(nodes, start, count, multiLine, trailingComma, leadingComma, noTrailingNewLine, emitNode) { + if (!emitNode) { + emitNode = emit; + } + for (var i = 0; i < count; i++) { + if (multiLine) { + if (i || leadingComma) { + write(","); + } + writeLine(); + } + else { + if (i || leadingComma) { + write(", "); + } + } + var node = nodes[start + i]; + emitTrailingCommentsOfPosition(node.pos); + emitNode(node); + leadingComma = true; + } + if (trailingComma) { + write(","); + } + if (multiLine && !noTrailingNewLine) { + writeLine(); + } + return count; + } + function emitCommaList(nodes) { + if (nodes) { + emitList(nodes, 0, nodes.length, false, false); + } + } + function emitLines(nodes) { + emitLinesStartingAt(nodes, 0); + } + function emitLinesStartingAt(nodes, startIndex) { + for (var i = startIndex; i < nodes.length; i++) { + writeLine(); + emit(nodes[i]); + } + } + function isBinaryOrOctalIntegerLiteral(node, text) { + if (node.kind === 8 && text.length > 1) { + switch (text.charCodeAt(1)) { + case 98: + case 66: + case 111: + case 79: + return true; + } + } + return false; + } + function emitLiteral(node) { + var text = getLiteralText(node); + if ((compilerOptions.sourceMap || compilerOptions.inlineSourceMap) && (node.kind === 9 || ts.isTemplateLiteralKind(node.kind))) { + writer.writeLiteral(text); + } + else if (languageVersion < 2 && isBinaryOrOctalIntegerLiteral(node, text)) { + write(node.text); + } + else { + write(text); + } + } + function getLiteralText(node) { + if (languageVersion < 2 && (ts.isTemplateLiteralKind(node.kind) || node.hasExtendedUnicodeEscape)) { + return getQuotedEscapedLiteralText('"', node.text, '"'); + } + if (node.parent) { + return ts.getTextOfNodeFromSourceText(currentText, node); + } + switch (node.kind) { + case 9: + return getQuotedEscapedLiteralText('"', node.text, '"'); + case 11: + return getQuotedEscapedLiteralText("`", node.text, "`"); + case 12: + return getQuotedEscapedLiteralText("`", node.text, "${"); + case 13: + return getQuotedEscapedLiteralText("}", node.text, "${"); + case 14: + return getQuotedEscapedLiteralText("}", node.text, "`"); + case 8: + return node.text; + } + ts.Debug.fail("Literal kind '" + node.kind + "' not accounted for."); + } + function getQuotedEscapedLiteralText(leftQuote, text, rightQuote) { + return leftQuote + ts.escapeNonAsciiCharacters(ts.escapeString(text)) + rightQuote; + } + function emitDownlevelRawTemplateLiteral(node) { + var text = ts.getTextOfNodeFromSourceText(currentText, node); + var isLast = node.kind === 11 || node.kind === 14; + text = text.substring(1, text.length - (isLast ? 1 : 2)); + text = text.replace(/\r\n?/g, "\n"); + text = ts.escapeString(text); + write("\"" + text + "\""); + } + function emitDownlevelTaggedTemplateArray(node, literalEmitter) { + write("["); + if (node.template.kind === 11) { + literalEmitter(node.template); + } + else { + literalEmitter(node.template.head); + ts.forEach(node.template.templateSpans, function (child) { + write(", "); + literalEmitter(child.literal); + }); + } + write("]"); + } + function emitDownlevelTaggedTemplate(node) { + var tempVariable = createAndRecordTempVariable(0); + write("("); + emit(tempVariable); + write(" = "); + emitDownlevelTaggedTemplateArray(node, emit); + write(", "); + emit(tempVariable); + write(".raw = "); + emitDownlevelTaggedTemplateArray(node, emitDownlevelRawTemplateLiteral); + write(", "); + emitParenthesizedIf(node.tag, needsParenthesisForPropertyAccessOrInvocation(node.tag)); + write("("); + emit(tempVariable); + if (node.template.kind === 189) { + ts.forEach(node.template.templateSpans, function (templateSpan) { + write(", "); + var needsParens = templateSpan.expression.kind === 187 + && templateSpan.expression.operatorToken.kind === 24; + emitParenthesizedIf(templateSpan.expression, needsParens); + }); + } + write("))"); + } + function emitTemplateExpression(node) { + if (languageVersion >= 2) { + ts.forEachChild(node, emit); + return; + } + var emitOuterParens = ts.isExpression(node.parent) + && templateNeedsParens(node, node.parent); + if (emitOuterParens) { + write("("); + } + var headEmitted = false; + if (shouldEmitTemplateHead()) { + emitLiteral(node.head); + headEmitted = true; + } + for (var i = 0, n = node.templateSpans.length; i < n; i++) { + var templateSpan = node.templateSpans[i]; + var needsParens = templateSpan.expression.kind !== 178 + && comparePrecedenceToBinaryPlus(templateSpan.expression) !== 1; + if (i > 0 || headEmitted) { + write(" + "); + } + emitParenthesizedIf(templateSpan.expression, needsParens); + if (templateSpan.literal.text.length !== 0) { + write(" + "); + emitLiteral(templateSpan.literal); + } + } + if (emitOuterParens) { + write(")"); + } + function shouldEmitTemplateHead() { + ts.Debug.assert(node.templateSpans.length !== 0); + return node.head.text.length !== 0 || node.templateSpans[0].literal.text.length === 0; + } + function templateNeedsParens(template, parent) { + switch (parent.kind) { + case 174: + case 175: + return parent.expression === template; + case 176: + case 178: + return false; + default: + return comparePrecedenceToBinaryPlus(parent) !== -1; + } + } + function comparePrecedenceToBinaryPlus(expression) { + switch (expression.kind) { + case 187: + switch (expression.operatorToken.kind) { + case 37: + case 39: + case 40: + return 1; + case 35: + case 36: + return 0; + default: + return -1; + } + case 190: + case 188: + return -1; + default: + return 1; + } + } + } + function emitTemplateSpan(span) { + emit(span.expression); + emit(span.literal); + } + function jsxEmitReact(node) { + function emitTagName(name) { + if (name.kind === 69 && ts.isIntrinsicJsxName(name.text)) { + write('"'); + emit(name); + write('"'); + } + else { + emit(name); + } + } + function emitAttributeName(name) { + if (/^[A-Za-z_]\w*$/.test(name.text)) { + emit(name); + } + else { + write('"'); + emit(name); + write('"'); + } + } + function emitJsxAttribute(node) { + emitAttributeName(node.name); + write(": "); + if (node.initializer) { + emit(node.initializer); + } + else { + write("true"); + } + } + function emitJsxElement(openingNode, children) { + var syntheticReactRef = ts.createSynthesizedNode(69); + syntheticReactRef.text = compilerOptions.reactNamespace ? compilerOptions.reactNamespace : "React"; + syntheticReactRef.parent = openingNode; + emitLeadingComments(openingNode); + emitExpressionIdentifier(syntheticReactRef); + write(".createElement("); + emitTagName(openingNode.tagName); + write(", "); + if (openingNode.attributes.length === 0) { + write("null"); + } + else { + var attrs = openingNode.attributes; + if (ts.forEach(attrs, function (attr) { return attr.kind === 247; })) { + write("__assign("); + var haveOpenedObjectLiteral = false; + for (var i = 0; i < attrs.length; i++) { + if (attrs[i].kind === 247) { + if (i === 0) { + write("{}, "); + } + if (haveOpenedObjectLiteral) { + write("}"); + haveOpenedObjectLiteral = false; + } + if (i > 0) { + write(", "); + } + emit(attrs[i].expression); + } + else { + ts.Debug.assert(attrs[i].kind === 246); + if (haveOpenedObjectLiteral) { + write(", "); + } + else { + haveOpenedObjectLiteral = true; + if (i > 0) { + write(", "); + } + write("{"); + } + emitJsxAttribute(attrs[i]); + } + } + if (haveOpenedObjectLiteral) + write("}"); + write(")"); + } + else { + write("{"); + for (var i = 0, n = attrs.length; i < n; i++) { + if (i > 0) { + write(", "); + } + emitJsxAttribute(attrs[i]); + } + write("}"); + } + } + if (children) { + var firstChild = void 0; + var multipleEmittableChildren = false; + for (var i = 0, n = children.length; i < n; i++) { + var jsxChild = children[i]; + if (isJsxChildEmittable(jsxChild)) { + if (!firstChild) { + write(", "); + firstChild = jsxChild; + } + else { + if (!multipleEmittableChildren) { + multipleEmittableChildren = true; + increaseIndent(); + writeLine(); + emit(firstChild); + } + write(", "); + writeLine(); + emit(jsxChild); + } + } + } + if (multipleEmittableChildren) { + decreaseIndent(); + } + else if (firstChild) { + if (firstChild.kind !== 241 && firstChild.kind !== 242) { + emit(firstChild); + } + else { + increaseIndent(); + writeLine(); + emit(firstChild); + writeLine(); + decreaseIndent(); + } + } + } + write(")"); + emitTrailingComments(openingNode); + } + if (node.kind === 241) { + emitJsxElement(node.openingElement, node.children); + } + else { + ts.Debug.assert(node.kind === 242); + emitJsxElement(node); + } + } + function jsxEmitPreserve(node) { + function emitJsxAttribute(node) { + emit(node.name); + if (node.initializer) { + write("="); + emit(node.initializer); + } + } + function emitJsxSpreadAttribute(node) { + write("{..."); + emit(node.expression); + write("}"); + } + function emitAttributes(attribs) { + for (var i = 0, n = attribs.length; i < n; i++) { + if (i > 0) { + write(" "); + } + if (attribs[i].kind === 247) { + emitJsxSpreadAttribute(attribs[i]); + } + else { + ts.Debug.assert(attribs[i].kind === 246); + emitJsxAttribute(attribs[i]); + } + } + } + function emitJsxOpeningOrSelfClosingElement(node) { + write("<"); + emit(node.tagName); + if (node.attributes.length > 0 || (node.kind === 242)) { + write(" "); + } + emitAttributes(node.attributes); + if (node.kind === 242) { + write("/>"); + } + else { + write(">"); + } + } + function emitJsxClosingElement(node) { + write(""); + } + function emitJsxElement(node) { + emitJsxOpeningOrSelfClosingElement(node.openingElement); + for (var i = 0, n = node.children.length; i < n; i++) { + emit(node.children[i]); + } + emitJsxClosingElement(node.closingElement); + } + if (node.kind === 241) { + emitJsxElement(node); + } + else { + ts.Debug.assert(node.kind === 242); + emitJsxOpeningOrSelfClosingElement(node); + } + } + function emitExpressionForPropertyName(node) { + ts.Debug.assert(node.kind !== 169); + if (node.kind === 9) { + emitLiteral(node); + } + else if (node.kind === 140) { + if (ts.nodeIsDecorated(node.parent)) { + if (!computedPropertyNamesToGeneratedNames) { + computedPropertyNamesToGeneratedNames = []; + } + var generatedName = computedPropertyNamesToGeneratedNames[ts.getNodeId(node)]; + if (generatedName) { + write(generatedName); + return; + } + generatedName = createAndRecordTempVariable(0).text; + computedPropertyNamesToGeneratedNames[ts.getNodeId(node)] = generatedName; + write(generatedName); + write(" = "); + } + emit(node.expression); + } + else { + write('"'); + if (node.kind === 8) { + write(node.text); + } + else { + writeTextOfNode(currentText, node); + } + write('"'); + } + } + function isExpressionIdentifier(node) { + var parent = node.parent; + switch (parent.kind) { + case 170: + case 195: + case 184: + case 187: + case 174: + case 249: + case 140: + case 188: + case 143: + case 181: + case 204: + case 173: + case 235: + case 202: + case 194: + case 206: + case 207: + case 208: + case 203: + case 245: + case 242: + case 243: + case 247: + case 248: + case 175: + case 196: + case 178: + case 186: + case 185: + case 211: + case 254: + case 191: + case 213: + case 176: + case 197: + case 215: + case 177: + case 182: + case 183: + case 205: + case 212: + case 190: + return true; + case 169: + case 255: + case 142: + case 253: + case 145: + case 218: + return parent.initializer === node; + case 172: + return parent.expression === node; + case 180: + case 179: + return parent.body === node; + case 229: + return parent.moduleReference === node; + case 139: + return parent.left === node; + } + return false; + } + function emitExpressionIdentifier(node) { + var container = resolver.getReferencedExportContainer(node); + if (container) { + if (container.kind === 256) { + if (modulekind !== ts.ModuleKind.ES6 && modulekind !== ts.ModuleKind.System) { + write("exports."); + } + } + else { + write(getGeneratedNameForNode(container)); + write("."); + } + } + else { + if (modulekind !== ts.ModuleKind.ES6) { + var declaration = resolver.getReferencedImportDeclaration(node); + if (declaration) { + if (declaration.kind === 231) { + write(getGeneratedNameForNode(declaration.parent)); + write(languageVersion === 0 ? '["default"]' : ".default"); + return; + } + else if (declaration.kind === 234) { + write(getGeneratedNameForNode(declaration.parent.parent.parent)); + var name_25 = declaration.propertyName || declaration.name; + var identifier = ts.getTextOfNodeFromSourceText(currentText, name_25); + if (languageVersion === 0 && identifier === "default") { + write('["default"]'); + } + else { + write("."); + write(identifier); + } + return; + } + } + } + if (languageVersion < 2) { + var declaration = resolver.getReferencedDeclarationWithCollidingName(node); + if (declaration) { + write(getGeneratedNameForNode(declaration.name)); + return; + } + } + else if (resolver.getNodeCheckFlags(node) & 1048576) { + var declaration = resolver.getReferencedValueDeclaration(node); + if (declaration) { + var classAlias = decoratedClassAliases[ts.getNodeId(declaration)]; + if (classAlias !== undefined) { + write(classAlias); + return; + } + } + } + } + if (ts.nodeIsSynthesized(node)) { + write(node.text); + } + else { + writeTextOfNode(currentText, node); + } + } + function isNameOfNestedBlockScopedRedeclarationOrCapturedBinding(node) { + if (languageVersion < 2) { + var parent_13 = node.parent; + switch (parent_13.kind) { + case 169: + case 221: + case 224: + case 218: + return parent_13.name === node && resolver.isDeclarationWithCollidingName(parent_13); + } + } + return false; + } + function emitIdentifier(node) { + if (convertedLoopState) { + if (node.text == "arguments" && resolver.isArgumentsLocalBinding(node)) { + var name_26 = convertedLoopState.argumentsName || (convertedLoopState.argumentsName = makeUniqueName("arguments")); + write(name_26); + return; + } + } + if (!node.parent) { + write(node.text); + } + else if (isExpressionIdentifier(node)) { + emitExpressionIdentifier(node); + } + else if (isNameOfNestedBlockScopedRedeclarationOrCapturedBinding(node)) { + write(getGeneratedNameForNode(node)); + } + else if (ts.nodeIsSynthesized(node)) { + write(node.text); + } + else { + writeTextOfNode(currentText, node); + } + } + function emitThis(node) { + if (resolver.getNodeCheckFlags(node) & 2) { + write("_this"); + } + else if (convertedLoopState) { + write(convertedLoopState.thisName || (convertedLoopState.thisName = makeUniqueName("this"))); + } + else { + write("this"); + } + } + function emitSuper(node) { + if (languageVersion >= 2) { + write("super"); + } + else { + var flags = resolver.getNodeCheckFlags(node); + if (flags & 256) { + write("_super.prototype"); + } + else { + write("_super"); + } + } + } + function emitObjectBindingPattern(node) { + write("{ "); + var elements = node.elements; + emitList(elements, 0, elements.length, false, elements.hasTrailingComma); + write(" }"); + } + function emitArrayBindingPattern(node) { + write("["); + var elements = node.elements; + emitList(elements, 0, elements.length, false, elements.hasTrailingComma); + write("]"); + } + function emitBindingElement(node) { + if (node.propertyName) { + emit(node.propertyName); + write(": "); + } + if (node.dotDotDotToken) { + write("..."); + } + if (ts.isBindingPattern(node.name)) { + emit(node.name); + } + else { + emitModuleMemberName(node); + } + emitOptional(" = ", node.initializer); + } + function emitSpreadElementExpression(node) { + write("..."); + emit(node.expression); + } + function emitYieldExpression(node) { + write(ts.tokenToString(114)); + if (node.asteriskToken) { + write("*"); + } + if (node.expression) { + write(" "); + emit(node.expression); + } + } + function emitAwaitExpression(node) { + var needsParenthesis = needsParenthesisForAwaitExpressionAsYield(node); + if (needsParenthesis) { + write("("); + } + write(ts.tokenToString(114)); + write(" "); + emit(node.expression); + if (needsParenthesis) { + write(")"); + } + } + function needsParenthesisForAwaitExpressionAsYield(node) { + if (node.parent.kind === 187 && !ts.isAssignmentOperator(node.parent.operatorToken.kind)) { + return true; + } + else if (node.parent.kind === 188 && node.parent.condition === node) { + return true; + } + return false; + } + function needsParenthesisForPropertyAccessOrInvocation(node) { + switch (node.kind) { + case 69: + case 170: + case 172: + case 173: + case 174: + case 178: + return false; + } + return true; + } + function emitListWithSpread(elements, needsUniqueCopy, multiLine, trailingComma, useConcat) { + var pos = 0; + var group = 0; + var length = elements.length; + while (pos < length) { + if (group === 1 && useConcat) { + write(".concat("); + } + else if (group > 0) { + write(", "); + } + var e = elements[pos]; + if (e.kind === 191) { + e = e.expression; + emitParenthesizedIf(e, group === 0 && needsParenthesisForPropertyAccessOrInvocation(e)); + pos++; + if (pos === length && group === 0 && needsUniqueCopy && e.kind !== 170) { + write(".slice()"); + } + } + else { + var i = pos; + while (i < length && elements[i].kind !== 191) { + i++; + } + write("["); + if (multiLine) { + increaseIndent(); + } + emitList(elements, pos, i - pos, multiLine, trailingComma && i === length); + if (multiLine) { + decreaseIndent(); + } + write("]"); + pos = i; + } + group++; + } + if (group > 1) { + if (useConcat) { + write(")"); + } + } + } + function isSpreadElementExpression(node) { + return node.kind === 191; + } + function emitArrayLiteral(node) { + var elements = node.elements; + if (elements.length === 0) { + write("[]"); + } + else if (languageVersion >= 2 || !ts.forEach(elements, isSpreadElementExpression)) { + write("["); + emitLinePreservingList(node, node.elements, elements.hasTrailingComma, false); + write("]"); + } + else { + emitListWithSpread(elements, true, node.multiLine, elements.hasTrailingComma, true); + } + } + function emitObjectLiteralBody(node, numElements) { + if (numElements === 0) { + write("{}"); + return; + } + write("{"); + if (numElements > 0) { + var properties = node.properties; + if (numElements === properties.length) { + emitLinePreservingList(node, properties, languageVersion >= 1, true); + } + else { + var multiLine = node.multiLine; + if (!multiLine) { + write(" "); + } + else { + increaseIndent(); + } + emitList(properties, 0, numElements, multiLine, false); + if (!multiLine) { + write(" "); + } + else { + decreaseIndent(); + } + } + } + write("}"); + } + function emitDownlevelObjectLiteralWithComputedProperties(node, firstComputedPropertyIndex) { + var multiLine = node.multiLine; + var properties = node.properties; + write("("); + if (multiLine) { + increaseIndent(); + } + var tempVar = createAndRecordTempVariable(0); + emit(tempVar); + write(" = "); + emitObjectLiteralBody(node, firstComputedPropertyIndex); + for (var i = firstComputedPropertyIndex, n = properties.length; i < n; i++) { + writeComma(); + var property = properties[i]; + emitStart(property); + if (property.kind === 149 || property.kind === 150) { + var accessors = ts.getAllAccessorDeclarations(node.properties, property); + if (property !== accessors.firstAccessor) { + continue; + } + write("Object.defineProperty("); + emit(tempVar); + write(", "); + emitStart(property.name); + emitExpressionForPropertyName(property.name); + emitEnd(property.name); + write(", {"); + increaseIndent(); + if (accessors.getAccessor) { + writeLine(); + emitLeadingComments(accessors.getAccessor); + write("get: "); + emitStart(accessors.getAccessor); + write("function "); + emitSignatureAndBody(accessors.getAccessor); + emitEnd(accessors.getAccessor); + emitTrailingComments(accessors.getAccessor); + write(","); + } + if (accessors.setAccessor) { + writeLine(); + emitLeadingComments(accessors.setAccessor); + write("set: "); + emitStart(accessors.setAccessor); + write("function "); + emitSignatureAndBody(accessors.setAccessor); + emitEnd(accessors.setAccessor); + emitTrailingComments(accessors.setAccessor); + write(","); + } + writeLine(); + write("enumerable: true,"); + writeLine(); + write("configurable: true"); + decreaseIndent(); + writeLine(); + write("})"); + emitEnd(property); + } + else { + emitLeadingComments(property); + emitStart(property.name); + emit(tempVar); + emitMemberAccessForPropertyName(property.name); + emitEnd(property.name); + write(" = "); + if (property.kind === 253) { + emit(property.initializer); + } + else if (property.kind === 254) { + emitExpressionIdentifier(property.name); + } + else if (property.kind === 147) { + emitFunctionDeclaration(property); + } + else { + ts.Debug.fail("ObjectLiteralElement type not accounted for: " + property.kind); + } + } + emitEnd(property); + } + writeComma(); + emit(tempVar); + if (multiLine) { + decreaseIndent(); + writeLine(); + } + write(")"); + function writeComma() { + if (multiLine) { + write(","); + writeLine(); + } + else { + write(", "); + } + } + } + function emitObjectLiteral(node) { + var properties = node.properties; + if (languageVersion < 2) { + var numProperties = properties.length; + var numInitialNonComputedProperties = numProperties; + for (var i = 0, n = properties.length; i < n; i++) { + if (properties[i].name.kind === 140) { + numInitialNonComputedProperties = i; + break; + } + } + var hasComputedProperty = numInitialNonComputedProperties !== properties.length; + if (hasComputedProperty) { + emitDownlevelObjectLiteralWithComputedProperties(node, numInitialNonComputedProperties); + return; + } + } + emitObjectLiteralBody(node, properties.length); + } + function createBinaryExpression(left, operator, right, startsOnNewLine) { + var result = ts.createSynthesizedNode(187, startsOnNewLine); + result.operatorToken = ts.createSynthesizedNode(operator); + result.left = left; + result.right = right; + return result; + } + function createPropertyAccessExpression(expression, name) { + var result = ts.createSynthesizedNode(172); + result.expression = parenthesizeForAccess(expression); + result.dotToken = ts.createSynthesizedNode(21); + result.name = name; + return result; + } + function createElementAccessExpression(expression, argumentExpression) { + var result = ts.createSynthesizedNode(173); + result.expression = parenthesizeForAccess(expression); + result.argumentExpression = argumentExpression; + return result; + } + function parenthesizeForAccess(expr) { + while (expr.kind === 177 || + expr.kind === 195 || + expr.kind === 196) { + expr = expr.expression; + } + if (ts.isLeftHandSideExpression(expr) && + expr.kind !== 175 && + expr.kind !== 8) { + return expr; + } + var node = ts.createSynthesizedNode(178); + node.expression = expr; + return node; + } + function emitComputedPropertyName(node) { + write("["); + emitExpressionForPropertyName(node); + write("]"); + } + function emitMethod(node) { + if (languageVersion >= 2 && node.asteriskToken) { + write("*"); + } + emit(node.name); + if (languageVersion < 2) { + write(": function "); + } + emitSignatureAndBody(node); + } + function emitPropertyAssignment(node) { + emit(node.name); + write(": "); + emitTrailingCommentsOfPosition(node.initializer.pos); + emit(node.initializer); + } + function isNamespaceExportReference(node) { + var container = resolver.getReferencedExportContainer(node); + return container && container.kind !== 256; + } + function isImportedReference(node) { + var declaration = resolver.getReferencedImportDeclaration(node); + return declaration && (declaration.kind === 231 || declaration.kind === 234); + } + function emitShorthandPropertyAssignment(node) { + writeTextOfNode(currentText, node.name); + if (languageVersion < 2 || (modulekind !== ts.ModuleKind.ES6 && isImportedReference(node.name)) || isNamespaceExportReference(node.name)) { + write(": "); + emit(node.name); + } + if (languageVersion >= 2 && node.objectAssignmentInitializer) { + write(" = "); + emit(node.objectAssignmentInitializer); + } + } + function tryEmitConstantValue(node) { + var constantValue = tryGetConstEnumValue(node); + if (constantValue !== undefined) { + write(constantValue.toString()); + if (!compilerOptions.removeComments) { + var propertyName = node.kind === 172 ? ts.declarationNameToString(node.name) : ts.getTextOfNode(node.argumentExpression); + write(" /* " + propertyName + " */"); + } + return true; + } + return false; + } + function tryGetConstEnumValue(node) { + if (compilerOptions.isolatedModules) { + return undefined; + } + return node.kind === 172 || node.kind === 173 + ? resolver.getConstantValue(node) + : undefined; + } + function indentIfOnDifferentLines(parent, node1, node2, valueToWriteWhenNotIndenting) { + var realNodesAreOnDifferentLines = !ts.nodeIsSynthesized(parent) && !nodeEndIsOnSameLineAsNodeStart(node1, node2); + var synthesizedNodeIsOnDifferentLine = synthesizedNodeStartsOnNewLine(node2); + if (realNodesAreOnDifferentLines || synthesizedNodeIsOnDifferentLine) { + increaseIndent(); + writeLine(); + return true; + } + else { + if (valueToWriteWhenNotIndenting) { + write(valueToWriteWhenNotIndenting); + } + return false; + } + } + function emitPropertyAccess(node) { + if (tryEmitConstantValue(node)) { + return; + } + if (languageVersion === 2 && + node.expression.kind === 95 && + isInAsyncMethodWithSuperInES6(node)) { + var name_27 = ts.createSynthesizedNode(9); + name_27.text = node.name.text; + emitSuperAccessInAsyncMethod(node.expression, name_27); + return; + } + emit(node.expression); + var indentedBeforeDot = indentIfOnDifferentLines(node, node.expression, node.dotToken); + var shouldEmitSpace = false; + if (!indentedBeforeDot) { + if (node.expression.kind === 8) { + var text = ts.getTextOfNodeFromSourceText(currentText, node.expression); + shouldEmitSpace = text.indexOf(ts.tokenToString(21)) < 0; + } + else { + var constantValue = tryGetConstEnumValue(node.expression); + shouldEmitSpace = isFinite(constantValue) && Math.floor(constantValue) === constantValue; + } + } + if (shouldEmitSpace) { + write(" ."); + } + else { + write("."); + } + var indentedAfterDot = indentIfOnDifferentLines(node, node.dotToken, node.name); + emit(node.name); + decreaseIndentIf(indentedBeforeDot, indentedAfterDot); + } + function emitQualifiedName(node) { + emit(node.left); + write("."); + emit(node.right); + } + function emitQualifiedNameAsExpression(node, useFallback) { + if (node.left.kind === 69) { + emitEntityNameAsExpression(node.left, useFallback); + } + else if (useFallback) { + var temp = createAndRecordTempVariable(0); + write("("); + emitNodeWithoutSourceMap(temp); + write(" = "); + emitEntityNameAsExpression(node.left, true); + write(") && "); + emitNodeWithoutSourceMap(temp); + } + else { + emitEntityNameAsExpression(node.left, false); + } + write("."); + emit(node.right); + } + function emitEntityNameAsExpression(node, useFallback) { + switch (node.kind) { + case 69: + if (useFallback) { + write("typeof "); + emitExpressionIdentifier(node); + write(" !== 'undefined' && "); + } + emitExpressionIdentifier(node); + break; + case 139: + emitQualifiedNameAsExpression(node, useFallback); + break; + default: + emitNodeWithoutSourceMap(node); + break; + } + } + function emitIndexedAccess(node) { + if (tryEmitConstantValue(node)) { + return; + } + if (languageVersion === 2 && + node.expression.kind === 95 && + isInAsyncMethodWithSuperInES6(node)) { + emitSuperAccessInAsyncMethod(node.expression, node.argumentExpression); + return; + } + emit(node.expression); + write("["); + emit(node.argumentExpression); + write("]"); + } + function hasSpreadElement(elements) { + return ts.forEach(elements, function (e) { return e.kind === 191; }); + } + function skipParentheses(node) { + while (node.kind === 178 || + node.kind === 177 || + node.kind === 195 || + node.kind === 196) { + node = node.expression; + } + return node; + } + function emitCallTarget(node) { + if (node.kind === 69 || node.kind === 97 || node.kind === 95) { + emit(node); + return node; + } + var temp = createAndRecordTempVariable(0); + write("("); + emit(temp); + write(" = "); + emit(node); + write(")"); + return temp; + } + function emitCallWithSpread(node) { + var target; + var expr = skipParentheses(node.expression); + if (expr.kind === 172) { + target = emitCallTarget(expr.expression); + write("."); + emit(expr.name); + } + else if (expr.kind === 173) { + target = emitCallTarget(expr.expression); + write("["); + emit(expr.argumentExpression); + write("]"); + } + else if (expr.kind === 95) { + target = expr; + write("_super"); + } + else { + emit(node.expression); + } + write(".apply("); + if (target) { + if (target.kind === 95) { + emitThis(target); + } + else { + emit(target); + } + } + else { + write("void 0"); + } + write(", "); + emitListWithSpread(node.arguments, false, false, false, true); + write(")"); + } + function isInAsyncMethodWithSuperInES6(node) { + if (languageVersion === 2) { + var container = ts.getSuperContainer(node, false); + if (container && resolver.getNodeCheckFlags(container) & (2048 | 4096)) { + return true; + } + } + return false; + } + function emitSuperAccessInAsyncMethod(superNode, argumentExpression) { + var container = ts.getSuperContainer(superNode, false); + var isSuperBinding = resolver.getNodeCheckFlags(container) & 4096; + write("_super("); + emit(argumentExpression); + write(isSuperBinding ? ").value" : ")"); + } + function emitCallExpression(node) { + if (languageVersion < 2 && hasSpreadElement(node.arguments)) { + emitCallWithSpread(node); + return; + } + var expression = node.expression; + var superCall = false; + var isAsyncMethodWithSuper = false; + if (expression.kind === 95) { + emitSuper(expression); + superCall = true; + } + else { + superCall = ts.isSuperPropertyOrElementAccess(expression); + isAsyncMethodWithSuper = superCall && isInAsyncMethodWithSuperInES6(node); + emit(expression); + } + if (superCall && (languageVersion < 2 || isAsyncMethodWithSuper)) { + write(".call("); + emitThis(expression); + if (node.arguments.length) { + write(", "); + emitCommaList(node.arguments); + } + write(")"); + } + else { + write("("); + emitCommaList(node.arguments); + write(")"); + } + } + function emitNewExpression(node) { + write("new "); + if (languageVersion === 1 && + node.arguments && + hasSpreadElement(node.arguments)) { + write("("); + var target = emitCallTarget(node.expression); + write(".bind.apply("); + emit(target); + write(", [void 0].concat("); + emitListWithSpread(node.arguments, false, false, false, false); + write(")))"); + write("()"); + } + else { + emit(node.expression); + if (node.arguments) { + write("("); + emitCommaList(node.arguments); + write(")"); + } + } + } + function emitTaggedTemplateExpression(node) { + if (languageVersion >= 2) { + emit(node.tag); + write(" "); + emit(node.template); + } + else { + emitDownlevelTaggedTemplate(node); + } + } + function emitParenExpression(node) { + if (!ts.nodeIsSynthesized(node) && node.parent.kind !== 180) { + if (node.expression.kind === 177 || + node.expression.kind === 195 || + node.expression.kind === 196) { + var operand = node.expression.expression; + while (operand.kind === 177 || + operand.kind === 195 || + operand.kind === 196) { + operand = operand.expression; + } + if (operand.kind !== 185 && + operand.kind !== 183 && + operand.kind !== 182 && + operand.kind !== 181 && + operand.kind !== 186 && + operand.kind !== 175 && + !(operand.kind === 174 && node.parent.kind === 175) && + !(operand.kind === 179 && node.parent.kind === 174) && + !(operand.kind === 8 && node.parent.kind === 172)) { + emit(operand); + return; + } + } + } + write("("); + emit(node.expression); + write(")"); + } + function emitDeleteExpression(node) { + write(ts.tokenToString(78)); + write(" "); + emit(node.expression); + } + function emitVoidExpression(node) { + write(ts.tokenToString(103)); + write(" "); + emit(node.expression); + } + function emitTypeOfExpression(node) { + write(ts.tokenToString(101)); + write(" "); + emit(node.expression); + } + function isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node) { + if (!isCurrentFileSystemExternalModule() || node.kind !== 69 || ts.nodeIsSynthesized(node)) { + return false; + } + var isVariableDeclarationOrBindingElement = node.parent && (node.parent.kind === 218 || node.parent.kind === 169); + var targetDeclaration = isVariableDeclarationOrBindingElement + ? node.parent + : resolver.getReferencedValueDeclaration(node); + return isSourceFileLevelDeclarationInSystemJsModule(targetDeclaration, true); + } + function emitPrefixUnaryExpression(node) { + var exportChanged = (node.operator === 41 || node.operator === 42) && + isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.operand); + if (exportChanged) { + write(exportFunctionForFile + "(\""); + emitNodeWithoutSourceMap(node.operand); + write("\", "); + } + write(ts.tokenToString(node.operator)); + if (node.operand.kind === 185) { + var operand = node.operand; + if (node.operator === 35 && (operand.operator === 35 || operand.operator === 41)) { + write(" "); + } + else if (node.operator === 36 && (operand.operator === 36 || operand.operator === 42)) { + write(" "); + } + } + emit(node.operand); + if (exportChanged) { + write(")"); + } + } + function emitPostfixUnaryExpression(node) { + var exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.operand); + if (exportChanged) { + write("(" + exportFunctionForFile + "(\""); + emitNodeWithoutSourceMap(node.operand); + write("\", "); + write(ts.tokenToString(node.operator)); + emit(node.operand); + if (node.operator === 41) { + write(") - 1)"); + } + else { + write(") + 1)"); + } + } + else { + emit(node.operand); + write(ts.tokenToString(node.operator)); + } + } + function shouldHoistDeclarationInSystemJsModule(node) { + return isSourceFileLevelDeclarationInSystemJsModule(node, false); + } + function isSourceFileLevelDeclarationInSystemJsModule(node, isExported) { + if (!node || !isCurrentFileSystemExternalModule()) { + return false; + } + var current = ts.getRootDeclaration(node).parent; + while (current) { + if (current.kind === 256) { + return !isExported || ((ts.getCombinedNodeFlags(node) & 1) !== 0); + } + else if (ts.isDeclaration(current)) { + return false; + } + else { + current = current.parent; + } + } + } + function emitExponentiationOperator(node) { + var leftHandSideExpression = node.left; + if (node.operatorToken.kind === 60) { + var synthesizedLHS = void 0; + var shouldEmitParentheses = false; + if (ts.isElementAccessExpression(leftHandSideExpression)) { + shouldEmitParentheses = true; + write("("); + synthesizedLHS = ts.createSynthesizedNode(173, false); + var identifier = emitTempVariableAssignment(leftHandSideExpression.expression, false, false); + synthesizedLHS.expression = identifier; + if (leftHandSideExpression.argumentExpression.kind !== 8 && + leftHandSideExpression.argumentExpression.kind !== 9) { + var tempArgumentExpression = createAndRecordTempVariable(268435456); + synthesizedLHS.argumentExpression = tempArgumentExpression; + emitAssignment(tempArgumentExpression, leftHandSideExpression.argumentExpression, true, leftHandSideExpression.expression); + } + else { + synthesizedLHS.argumentExpression = leftHandSideExpression.argumentExpression; + } + write(", "); + } + else if (ts.isPropertyAccessExpression(leftHandSideExpression)) { + shouldEmitParentheses = true; + write("("); + synthesizedLHS = ts.createSynthesizedNode(172, false); + var identifier = emitTempVariableAssignment(leftHandSideExpression.expression, false, false); + synthesizedLHS.expression = identifier; + synthesizedLHS.dotToken = leftHandSideExpression.dotToken; + synthesizedLHS.name = leftHandSideExpression.name; + write(", "); + } + emit(synthesizedLHS || leftHandSideExpression); + write(" = "); + write("Math.pow("); + emit(synthesizedLHS || leftHandSideExpression); + write(", "); + emit(node.right); + write(")"); + if (shouldEmitParentheses) { + write(")"); + } + } + else { + write("Math.pow("); + emit(leftHandSideExpression); + write(", "); + emit(node.right); + write(")"); + } + } + function emitBinaryExpression(node) { + if (languageVersion < 2 && node.operatorToken.kind === 56 && + (node.left.kind === 171 || node.left.kind === 170)) { + emitDestructuring(node, node.parent.kind === 202); + } + else { + var exportChanged = node.operatorToken.kind >= 56 && + node.operatorToken.kind <= 68 && + isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.left); + if (exportChanged) { + write(exportFunctionForFile + "(\""); + emitNodeWithoutSourceMap(node.left); + write("\", "); + } + if (node.operatorToken.kind === 38 || node.operatorToken.kind === 60) { + emitExponentiationOperator(node); + } + else { + emit(node.left); + var indentedBeforeOperator = indentIfOnDifferentLines(node, node.left, node.operatorToken, node.operatorToken.kind !== 24 ? " " : undefined); + write(ts.tokenToString(node.operatorToken.kind)); + var indentedAfterOperator = indentIfOnDifferentLines(node, node.operatorToken, node.right, " "); + emit(node.right); + decreaseIndentIf(indentedBeforeOperator, indentedAfterOperator); + } + if (exportChanged) { + write(")"); + } + } + } + function synthesizedNodeStartsOnNewLine(node) { + return ts.nodeIsSynthesized(node) && node.startsOnNewLine; + } + function emitConditionalExpression(node) { + emit(node.condition); + var indentedBeforeQuestion = indentIfOnDifferentLines(node, node.condition, node.questionToken, " "); + write("?"); + var indentedAfterQuestion = indentIfOnDifferentLines(node, node.questionToken, node.whenTrue, " "); + emit(node.whenTrue); + decreaseIndentIf(indentedBeforeQuestion, indentedAfterQuestion); + var indentedBeforeColon = indentIfOnDifferentLines(node, node.whenTrue, node.colonToken, " "); + write(":"); + var indentedAfterColon = indentIfOnDifferentLines(node, node.colonToken, node.whenFalse, " "); + emit(node.whenFalse); + decreaseIndentIf(indentedBeforeColon, indentedAfterColon); + } + function decreaseIndentIf(value1, value2) { + if (value1) { + decreaseIndent(); + } + if (value2) { + decreaseIndent(); + } + } + function isSingleLineEmptyBlock(node) { + if (node && node.kind === 199) { + var block = node; + return block.statements.length === 0 && nodeEndIsOnSameLineAsNodeStart(block, block); + } + } + function emitBlock(node) { + if (isSingleLineEmptyBlock(node)) { + emitToken(15, node.pos); + write(" "); + emitToken(16, node.statements.end); + return; + } + emitToken(15, node.pos); + increaseIndent(); + if (node.kind === 226) { + ts.Debug.assert(node.parent.kind === 225); + emitCaptureThisForNodeIfNecessary(node.parent); + } + emitLines(node.statements); + if (node.kind === 226) { + emitTempDeclarations(true); + } + decreaseIndent(); + writeLine(); + emitToken(16, node.statements.end); + } + function emitEmbeddedStatement(node) { + if (node.kind === 199) { + write(" "); + emit(node); + } + else { + increaseIndent(); + writeLine(); + emit(node); + decreaseIndent(); + } + } + function emitExpressionStatement(node) { + emitParenthesizedIf(node.expression, node.expression.kind === 180); + write(";"); + } + function emitIfStatement(node) { + var endPos = emitToken(88, node.pos); + write(" "); + endPos = emitToken(17, endPos); + emit(node.expression); + emitToken(18, node.expression.end); + emitEmbeddedStatement(node.thenStatement); + if (node.elseStatement) { + writeLine(); + emitToken(80, node.thenStatement.end); + if (node.elseStatement.kind === 203) { + write(" "); + emit(node.elseStatement); + } + else { + emitEmbeddedStatement(node.elseStatement); + } + } + } + function emitDoStatement(node) { + emitLoop(node, emitDoStatementWorker); + } + function emitDoStatementWorker(node, loop) { + write("do"); + if (loop) { + emitConvertedLoopCall(loop, true); + } + else { + emitNormalLoopBody(node, true); + } + if (node.statement.kind === 199) { + write(" "); + } + else { + writeLine(); + } + write("while ("); + emit(node.expression); + write(");"); + } + function emitWhileStatement(node) { + emitLoop(node, emitWhileStatementWorker); + } + function emitWhileStatementWorker(node, loop) { + write("while ("); + emit(node.expression); + write(")"); + if (loop) { + emitConvertedLoopCall(loop, true); + } + else { + emitNormalLoopBody(node, true); + } + } + function tryEmitStartOfVariableDeclarationList(decl) { + if (shouldHoistVariable(decl, true)) { + return false; + } + if (convertedLoopState && (ts.getCombinedNodeFlags(decl) & 3072) === 0) { + for (var _a = 0, _b = decl.declarations; _a < _b.length; _a++) { + var varDecl = _b[_a]; + hoistVariableDeclarationFromLoop(convertedLoopState, varDecl); + } + return false; + } + emitStart(decl); + if (decl && languageVersion >= 2) { + if (ts.isLet(decl)) { + write("let "); + } + else if (ts.isConst(decl)) { + write("const "); + } + else { + write("var "); + } + } + else { + write("var "); + } + return true; + } + function emitVariableDeclarationListSkippingUninitializedEntries(list) { + var started = false; + for (var _a = 0, _b = list.declarations; _a < _b.length; _a++) { + var decl = _b[_a]; + if (!decl.initializer) { + continue; + } + if (!started) { + started = true; + } + else { + write(", "); + } + emit(decl); + } + return started; + } + function shouldConvertLoopBody(node) { + return languageVersion < 2 && + (resolver.getNodeCheckFlags(node) & 65536) !== 0; + } + function emitLoop(node, loopEmitter) { + var shouldConvert = shouldConvertLoopBody(node); + if (!shouldConvert) { + loopEmitter(node, undefined); + } + else { + var loop = convertLoopBody(node); + if (node.parent.kind === 214) { + emitLabelAndColon(node.parent); + } + loopEmitter(node, loop); + } + } + function convertLoopBody(node) { + var functionName = makeUniqueName("_loop"); + var loopInitializer; + switch (node.kind) { + case 206: + case 207: + case 208: + var initializer = node.initializer; + if (initializer && initializer.kind === 219) { + loopInitializer = node.initializer; + } + break; + } + var loopParameters; + var loopOutParameters; + if (loopInitializer && (ts.getCombinedNodeFlags(loopInitializer) & 3072)) { + loopParameters = []; + for (var _a = 0, _b = loopInitializer.declarations; _a < _b.length; _a++) { + var varDeclaration = _b[_a]; + processVariableDeclaration(varDeclaration.name); + } + } + var bodyIsBlock = node.statement.kind === 199; + var paramList = loopParameters ? loopParameters.join(", ") : ""; + writeLine(); + write("var " + functionName + " = function(" + paramList + ")"); + var convertedOuterLoopState = convertedLoopState; + convertedLoopState = { loopOutParameters: loopOutParameters }; + if (convertedOuterLoopState) { + if (convertedOuterLoopState.argumentsName) { + convertedLoopState.argumentsName = convertedOuterLoopState.argumentsName; + } + if (convertedOuterLoopState.thisName) { + convertedLoopState.thisName = convertedOuterLoopState.thisName; + } + if (convertedOuterLoopState.hoistedLocalVariables) { + convertedLoopState.hoistedLocalVariables = convertedOuterLoopState.hoistedLocalVariables; + } + } + write(" {"); + writeLine(); + increaseIndent(); + if (bodyIsBlock) { + emitLines(node.statement.statements); + } + else { + emit(node.statement); + } + writeLine(); + copyLoopOutParameters(convertedLoopState, 1, true); + decreaseIndent(); + writeLine(); + write("};"); + writeLine(); + if (loopOutParameters) { + write("var "); + for (var i = 0; i < loopOutParameters.length; i++) { + if (i !== 0) { + write(", "); + } + write(loopOutParameters[i].outParamName); + } + write(";"); + writeLine(); + } + if (convertedLoopState.argumentsName) { + if (convertedOuterLoopState) { + convertedOuterLoopState.argumentsName = convertedLoopState.argumentsName; + } + else { + write("var " + convertedLoopState.argumentsName + " = arguments;"); + writeLine(); + } + } + if (convertedLoopState.thisName) { + if (convertedOuterLoopState) { + convertedOuterLoopState.thisName = convertedLoopState.thisName; + } + else { + write("var " + convertedLoopState.thisName + " = this;"); + writeLine(); + } + } + if (convertedLoopState.hoistedLocalVariables) { + if (convertedOuterLoopState) { + convertedOuterLoopState.hoistedLocalVariables = convertedLoopState.hoistedLocalVariables; + } + else { + write("var "); + var seen = void 0; + for (var _c = 0, _d = convertedLoopState.hoistedLocalVariables; _c < _d.length; _c++) { + var id = _d[_c]; + if (!seen) { + seen = {}; + } + else { + write(", "); + } + if (!ts.hasProperty(seen, id.text)) { + emit(id); + seen[id.text] = id.text; + } + } + write(";"); + writeLine(); + } + } + var currentLoopState = convertedLoopState; + convertedLoopState = convertedOuterLoopState; + return { functionName: functionName, paramList: paramList, state: currentLoopState }; + function processVariableDeclaration(name) { + if (name.kind === 69) { + var nameText = isNameOfNestedBlockScopedRedeclarationOrCapturedBinding(name) + ? getGeneratedNameForNode(name) + : name.text; + loopParameters.push(nameText); + if (resolver.getNodeCheckFlags(name.parent) & 2097152) { + var reassignedVariable = { originalName: name, outParamName: makeUniqueName("out_" + nameText) }; + (loopOutParameters || (loopOutParameters = [])).push(reassignedVariable); + } + } + else { + for (var _a = 0, _b = name.elements; _a < _b.length; _a++) { + var element = _b[_a]; + processVariableDeclaration(element.name); + } + } + } + } + function emitNormalLoopBody(node, emitAsEmbeddedStatement) { + var saveAllowedNonLabeledJumps; + if (convertedLoopState) { + saveAllowedNonLabeledJumps = convertedLoopState.allowedNonLabeledJumps; + convertedLoopState.allowedNonLabeledJumps = 2 | 4; + } + if (emitAsEmbeddedStatement) { + emitEmbeddedStatement(node.statement); + } + else if (node.statement.kind === 199) { + emitLines(node.statement.statements); + } + else { + writeLine(); + emit(node.statement); + } + if (convertedLoopState) { + convertedLoopState.allowedNonLabeledJumps = saveAllowedNonLabeledJumps; + } + } + function copyLoopOutParameters(state, copyDirection, emitAsStatements) { + if (state.loopOutParameters) { + for (var _a = 0, _b = state.loopOutParameters; _a < _b.length; _a++) { + var outParam = _b[_a]; + if (copyDirection === 0) { + emitIdentifier(outParam.originalName); + write(" = " + outParam.outParamName); + } + else { + write(outParam.outParamName + " = "); + emitIdentifier(outParam.originalName); + } + if (emitAsStatements) { + write(";"); + writeLine(); + } + else { + write(", "); + } + } + } + } + function emitConvertedLoopCall(loop, emitAsBlock) { + if (emitAsBlock) { + write(" {"); + writeLine(); + increaseIndent(); + } + var isSimpleLoop = !(loop.state.nonLocalJumps & ~4) && + !loop.state.labeledNonLocalBreaks && + !loop.state.labeledNonLocalContinues; + var loopResult = makeUniqueName("state"); + if (!isSimpleLoop) { + write("var " + loopResult + " = "); + } + write(loop.functionName + "(" + loop.paramList + ");"); + writeLine(); + copyLoopOutParameters(loop.state, 0, true); + if (!isSimpleLoop) { + writeLine(); + if (loop.state.nonLocalJumps & 8) { + write("if (typeof " + loopResult + " === \"object\") "); + if (convertedLoopState) { + write("return " + loopResult + ";"); + convertedLoopState.nonLocalJumps |= 8; + } + else { + write("return " + loopResult + ".value;"); + } + writeLine(); + } + if (loop.state.nonLocalJumps & 2) { + write("if (" + loopResult + " === \"break\") break;"); + writeLine(); + } + emitDispatchTableForLabeledJumps(loopResult, loop.state, convertedLoopState); + } + if (emitAsBlock) { + writeLine(); + decreaseIndent(); + write("}"); + } + function emitDispatchTableForLabeledJumps(loopResultVariable, currentLoop, outerLoop) { + if (!currentLoop.labeledNonLocalBreaks && !currentLoop.labeledNonLocalContinues) { + return; + } + write("switch(" + loopResultVariable + ") {"); + increaseIndent(); + emitDispatchEntriesForLabeledJumps(currentLoop.labeledNonLocalBreaks, true, loopResultVariable, outerLoop); + emitDispatchEntriesForLabeledJumps(currentLoop.labeledNonLocalContinues, false, loopResultVariable, outerLoop); + decreaseIndent(); + writeLine(); + write("}"); + } + function emitDispatchEntriesForLabeledJumps(table, isBreak, loopResultVariable, outerLoop) { + if (!table) { + return; + } + for (var labelText in table) { + var labelMarker = table[labelText]; + writeLine(); + write("case \"" + labelMarker + "\": "); + if (!outerLoop || (outerLoop.labels && outerLoop.labels[labelText])) { + if (isBreak) { + write("break "); + } + else { + write("continue "); + } + write(labelText + ";"); + } + else { + setLabeledJump(outerLoop, isBreak, labelText, labelMarker); + write("return " + loopResultVariable + ";"); + } + } + } + } + function emitForStatement(node) { + emitLoop(node, emitForStatementWorker); + } + function emitForStatementWorker(node, loop) { + var endPos = emitToken(86, node.pos); + write(" "); + endPos = emitToken(17, endPos); + if (node.initializer && node.initializer.kind === 219) { + var variableDeclarationList = node.initializer; + var startIsEmitted = tryEmitStartOfVariableDeclarationList(variableDeclarationList); + if (startIsEmitted) { + emitCommaList(variableDeclarationList.declarations); + } + else { + emitVariableDeclarationListSkippingUninitializedEntries(variableDeclarationList); + } + } + else if (node.initializer) { + emit(node.initializer); + } + write(";"); + emitOptional(" ", node.condition); + write(";"); + emitOptional(" ", node.incrementor); + write(")"); + if (loop) { + emitConvertedLoopCall(loop, true); + } + else { + emitNormalLoopBody(node, true); + } + } + function emitForInOrForOfStatement(node) { + if (languageVersion < 2 && node.kind === 208) { + emitLoop(node, emitDownLevelForOfStatementWorker); + } + else { + emitLoop(node, emitForInOrForOfStatementWorker); + } + } + function emitForInOrForOfStatementWorker(node, loop) { + var endPos = emitToken(86, node.pos); + write(" "); + endPos = emitToken(17, endPos); + if (node.initializer.kind === 219) { + var variableDeclarationList = node.initializer; + if (variableDeclarationList.declarations.length >= 1) { + tryEmitStartOfVariableDeclarationList(variableDeclarationList); + emit(variableDeclarationList.declarations[0]); + } + } + else { + emit(node.initializer); + } + if (node.kind === 207) { + write(" in "); + } + else { + write(" of "); + } + emit(node.expression); + emitToken(18, node.expression.end); + if (loop) { + emitConvertedLoopCall(loop, true); + } + else { + emitNormalLoopBody(node, true); + } + } + function emitDownLevelForOfStatementWorker(node, loop) { + var endPos = emitToken(86, node.pos); + write(" "); + endPos = emitToken(17, endPos); + var counter = createTempVariable(268435456); + var rhsReference = ts.createSynthesizedNode(69); + rhsReference.text = node.expression.kind === 69 ? + makeUniqueName(node.expression.text) : + makeTempVariableName(0); + emitStart(node.expression); + write("var "); + emitNodeWithoutSourceMap(counter); + write(" = 0"); + emitEnd(node.expression); + write(", "); + emitStart(node.expression); + emitNodeWithoutSourceMap(rhsReference); + write(" = "); + emitNodeWithoutSourceMap(node.expression); + emitEnd(node.expression); + write("; "); + emitStart(node.expression); + emitNodeWithoutSourceMap(counter); + write(" < "); + emitNodeWithCommentsAndWithoutSourcemap(rhsReference); + write(".length"); + emitEnd(node.expression); + write("; "); + emitStart(node.expression); + emitNodeWithoutSourceMap(counter); + write("++"); + emitEnd(node.expression); + emitToken(18, node.expression.end); + write(" {"); + writeLine(); + increaseIndent(); + var rhsIterationValue = createElementAccessExpression(rhsReference, counter); + emitStart(node.initializer); + if (node.initializer.kind === 219) { + write("var "); + var variableDeclarationList = node.initializer; + if (variableDeclarationList.declarations.length > 0) { + var declaration = variableDeclarationList.declarations[0]; + if (ts.isBindingPattern(declaration.name)) { + emitDestructuring(declaration, false, rhsIterationValue); + } + else { + emitNodeWithCommentsAndWithoutSourcemap(declaration); + write(" = "); + emitNodeWithoutSourceMap(rhsIterationValue); + } + } + else { + emitNodeWithoutSourceMap(createTempVariable(0)); + write(" = "); + emitNodeWithoutSourceMap(rhsIterationValue); + } + } + else { + var assignmentExpression = createBinaryExpression(node.initializer, 56, rhsIterationValue, false); + if (node.initializer.kind === 170 || node.initializer.kind === 171) { + emitDestructuring(assignmentExpression, true, undefined); + } + else { + emitNodeWithCommentsAndWithoutSourcemap(assignmentExpression); + } + } + emitEnd(node.initializer); + write(";"); + if (loop) { + writeLine(); + emitConvertedLoopCall(loop, false); + } + else { + emitNormalLoopBody(node, false); + } + writeLine(); + decreaseIndent(); + write("}"); + } + function emitBreakOrContinueStatement(node) { + if (convertedLoopState) { + var jump = node.kind === 210 ? 2 : 4; + var canUseBreakOrContinue = (node.label && convertedLoopState.labels && convertedLoopState.labels[node.label.text]) || + (!node.label && (convertedLoopState.allowedNonLabeledJumps & jump)); + if (!canUseBreakOrContinue) { + write("return "); + copyLoopOutParameters(convertedLoopState, 1, false); + if (!node.label) { + if (node.kind === 210) { + convertedLoopState.nonLocalJumps |= 2; + write("\"break\";"); + } + else { + convertedLoopState.nonLocalJumps |= 4; + write("\"continue\";"); + } + } + else { + var labelMarker = void 0; + if (node.kind === 210) { + labelMarker = "break-" + node.label.text; + setLabeledJump(convertedLoopState, true, node.label.text, labelMarker); + } + else { + labelMarker = "continue-" + node.label.text; + setLabeledJump(convertedLoopState, false, node.label.text, labelMarker); + } + write("\"" + labelMarker + "\";"); + } + return; + } + } + emitToken(node.kind === 210 ? 70 : 75, node.pos); + emitOptional(" ", node.label); + write(";"); + } + function emitReturnStatement(node) { + if (convertedLoopState) { + convertedLoopState.nonLocalJumps |= 8; + write("return { value: "); + if (node.expression) { + emit(node.expression); + } + else { + write("void 0"); + } + write(" };"); + return; + } + emitToken(94, node.pos); + emitOptional(" ", node.expression); + write(";"); + } + function emitWithStatement(node) { + write("with ("); + emit(node.expression); + write(")"); + emitEmbeddedStatement(node.statement); + } + function emitSwitchStatement(node) { + var endPos = emitToken(96, node.pos); + write(" "); + emitToken(17, endPos); + emit(node.expression); + endPos = emitToken(18, node.expression.end); + write(" "); + var saveAllowedNonLabeledJumps; + if (convertedLoopState) { + saveAllowedNonLabeledJumps = convertedLoopState.allowedNonLabeledJumps; + convertedLoopState.allowedNonLabeledJumps |= 2; + } + emitCaseBlock(node.caseBlock, endPos); + if (convertedLoopState) { + convertedLoopState.allowedNonLabeledJumps = saveAllowedNonLabeledJumps; + } + } + function emitCaseBlock(node, startPos) { + emitToken(15, startPos); + increaseIndent(); + emitLines(node.clauses); + decreaseIndent(); + writeLine(); + emitToken(16, node.clauses.end); + } + function nodeStartPositionsAreOnSameLine(node1, node2) { + return ts.getLineOfLocalPositionFromLineMap(currentLineMap, ts.skipTrivia(currentText, node1.pos)) === + ts.getLineOfLocalPositionFromLineMap(currentLineMap, ts.skipTrivia(currentText, node2.pos)); + } + function nodeEndPositionsAreOnSameLine(node1, node2) { + return ts.getLineOfLocalPositionFromLineMap(currentLineMap, node1.end) === + ts.getLineOfLocalPositionFromLineMap(currentLineMap, node2.end); + } + function nodeEndIsOnSameLineAsNodeStart(node1, node2) { + return ts.getLineOfLocalPositionFromLineMap(currentLineMap, node1.end) === + ts.getLineOfLocalPositionFromLineMap(currentLineMap, ts.skipTrivia(currentText, node2.pos)); + } + function emitCaseOrDefaultClause(node) { + if (node.kind === 249) { + write("case "); + emit(node.expression); + write(":"); + } + else { + write("default:"); + } + if (node.statements.length === 1 && nodeStartPositionsAreOnSameLine(node, node.statements[0])) { + write(" "); + emit(node.statements[0]); + } + else { + increaseIndent(); + emitLines(node.statements); + decreaseIndent(); + } + } + function emitThrowStatement(node) { + write("throw "); + emit(node.expression); + write(";"); + } + function emitTryStatement(node) { + write("try "); + emit(node.tryBlock); + emit(node.catchClause); + if (node.finallyBlock) { + writeLine(); + write("finally "); + emit(node.finallyBlock); + } + } + function emitCatchClause(node) { + writeLine(); + var endPos = emitToken(72, node.pos); + write(" "); + emitToken(17, endPos); + emit(node.variableDeclaration); + emitToken(18, node.variableDeclaration ? node.variableDeclaration.end : endPos); + write(" "); + emitBlock(node.block); + } + function emitDebuggerStatement(node) { + emitToken(76, node.pos); + write(";"); + } + function emitLabelAndColon(node) { + emit(node.label); + write(": "); + } + function emitLabeledStatement(node) { + if (!ts.isIterationStatement(node.statement, false) || !shouldConvertLoopBody(node.statement)) { + emitLabelAndColon(node); + } + if (convertedLoopState) { + if (!convertedLoopState.labels) { + convertedLoopState.labels = {}; + } + convertedLoopState.labels[node.label.text] = node.label.text; + } + emit(node.statement); + if (convertedLoopState) { + convertedLoopState.labels[node.label.text] = undefined; + } + } + function getContainingModule(node) { + do { + node = node.parent; + } while (node && node.kind !== 225); + return node; + } + function emitContainingModuleName(node) { + var container = getContainingModule(node); + write(container ? getGeneratedNameForNode(container) : "exports"); + } + function emitModuleMemberName(node) { + emitStart(node.name); + if (ts.getCombinedNodeFlags(node) & 1) { + var container = getContainingModule(node); + if (container) { + write(getGeneratedNameForNode(container)); + write("."); + } + else if (modulekind !== ts.ModuleKind.ES6 && modulekind !== ts.ModuleKind.System) { + write("exports."); + } + } + emitNodeWithCommentsAndWithoutSourcemap(node.name); + emitEnd(node.name); + } + function createVoidZero() { + var zero = ts.createSynthesizedNode(8); + zero.text = "0"; + var result = ts.createSynthesizedNode(183); + result.expression = zero; + return result; + } + function emitEs6ExportDefaultCompat(node) { + if (node.parent.kind === 256) { + ts.Debug.assert(!!(node.flags & 512) || node.kind === 235); + if (modulekind === ts.ModuleKind.CommonJS || modulekind === ts.ModuleKind.AMD || modulekind === ts.ModuleKind.UMD) { + if (!isEs6Module) { + if (languageVersion !== 0) { + write('Object.defineProperty(exports, "__esModule", { value: true });'); + writeLine(); + } + else { + write("exports.__esModule = true;"); + writeLine(); + } + } + } + } + } + function emitExportMemberAssignment(node) { + if (node.flags & 1) { + writeLine(); + emitStart(node); + if (modulekind === ts.ModuleKind.System && node.parent === currentSourceFile) { + write(exportFunctionForFile + "(\""); + if (node.flags & 512) { + write("default"); + } + else { + emitNodeWithCommentsAndWithoutSourcemap(node.name); + } + write("\", "); + emitDeclarationName(node); + write(")"); + } + else { + if (node.flags & 512) { + emitEs6ExportDefaultCompat(node); + if (languageVersion === 0) { + write('exports["default"]'); + } + else { + write("exports.default"); + } + } + else { + emitModuleMemberName(node); + } + write(" = "); + emitDeclarationName(node); + } + emitEnd(node); + write(";"); + } + } + function emitExportMemberAssignments(name) { + if (modulekind === ts.ModuleKind.System) { + return; + } + if (!exportEquals && exportSpecifiers && ts.hasProperty(exportSpecifiers, name.text)) { + for (var _a = 0, _b = exportSpecifiers[name.text]; _a < _b.length; _a++) { + var specifier = _b[_a]; + writeLine(); + emitStart(specifier.name); + emitContainingModuleName(specifier); + write("."); + emitNodeWithCommentsAndWithoutSourcemap(specifier.name); + emitEnd(specifier.name); + write(" = "); + emitExpressionIdentifier(name); + write(";"); + } + } + } + function emitExportSpecifierInSystemModule(specifier) { + ts.Debug.assert(modulekind === ts.ModuleKind.System); + if (!resolver.getReferencedValueDeclaration(specifier.propertyName || specifier.name) && !resolver.isValueAliasDeclaration(specifier)) { + return; + } + writeLine(); + emitStart(specifier.name); + write(exportFunctionForFile + "(\""); + emitNodeWithCommentsAndWithoutSourcemap(specifier.name); + write("\", "); + emitExpressionIdentifier(specifier.propertyName || specifier.name); + write(")"); + emitEnd(specifier.name); + write(";"); + } + function emitAssignment(name, value, shouldEmitCommaBeforeAssignment, nodeForSourceMap) { + if (shouldEmitCommaBeforeAssignment) { + write(", "); + } + var exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(name); + if (exportChanged) { + write(exportFunctionForFile + "(\""); + emitNodeWithCommentsAndWithoutSourcemap(name); + write("\", "); + } + var isVariableDeclarationOrBindingElement = name.parent && (name.parent.kind === 218 || name.parent.kind === 169); + emitStart(isFirstVariableDeclaration(nodeForSourceMap) ? nodeForSourceMap.parent : nodeForSourceMap); + withTemporaryNoSourceMap(function () { + if (isVariableDeclarationOrBindingElement) { + emitModuleMemberName(name.parent); + } + else { + emit(name); + } + write(" = "); + emit(value); + }); + emitEnd(nodeForSourceMap, true); + if (exportChanged) { + write(")"); + } + } + function emitTempVariableAssignment(expression, canDefineTempVariablesInPlace, shouldEmitCommaBeforeAssignment, sourceMapNode) { + var identifier = createTempVariable(0); + if (!canDefineTempVariablesInPlace) { + recordTempDeclaration(identifier); + } + emitAssignment(identifier, expression, shouldEmitCommaBeforeAssignment, sourceMapNode || expression.parent); + return identifier; + } + function isFirstVariableDeclaration(root) { + return root.kind === 218 && + root.parent.kind === 219 && + root.parent.declarations[0] === root; + } + function emitDestructuring(root, isAssignmentExpressionStatement, value) { + var emitCount = 0; + var canDefineTempVariablesInPlace = false; + if (root.kind === 218) { + var isExported = ts.getCombinedNodeFlags(root) & 1; + var isSourceLevelForSystemModuleKind = shouldHoistDeclarationInSystemJsModule(root); + canDefineTempVariablesInPlace = !isExported && !isSourceLevelForSystemModuleKind; + } + else if (root.kind === 142) { + canDefineTempVariablesInPlace = true; + } + if (root.kind === 187) { + emitAssignmentExpression(root); + } + else { + ts.Debug.assert(!isAssignmentExpressionStatement); + if (isFirstVariableDeclaration(root)) { + sourceMap.changeEmitSourcePos(); + } + emitBindingElement(root, value); + } + function ensureIdentifier(expr, reuseIdentifierExpressions, sourceMapNode) { + if (expr.kind === 69 && reuseIdentifierExpressions) { + return expr; + } + var identifier = emitTempVariableAssignment(expr, canDefineTempVariablesInPlace, emitCount > 0, sourceMapNode); + emitCount++; + return identifier; + } + function createDefaultValueCheck(value, defaultValue, sourceMapNode) { + value = ensureIdentifier(value, true, sourceMapNode); + var equals = ts.createSynthesizedNode(187); + equals.left = value; + equals.operatorToken = ts.createSynthesizedNode(32); + equals.right = createVoidZero(); + return createConditionalExpression(equals, defaultValue, value); + } + function createConditionalExpression(condition, whenTrue, whenFalse) { + var cond = ts.createSynthesizedNode(188); + cond.condition = condition; + cond.questionToken = ts.createSynthesizedNode(53); + cond.whenTrue = whenTrue; + cond.colonToken = ts.createSynthesizedNode(54); + cond.whenFalse = whenFalse; + return cond; + } + function createNumericLiteral(value) { + var node = ts.createSynthesizedNode(8); + node.text = "" + value; + return node; + } + function createPropertyAccessForDestructuringProperty(object, propName) { + var index; + var nameIsComputed = propName.kind === 140; + if (nameIsComputed) { + index = ensureIdentifier(propName.expression, false, propName); + } + else { + index = ts.createSynthesizedNode(propName.kind); + index.text = ts.unescapeIdentifier(propName.text); + } + return !nameIsComputed && index.kind === 69 + ? createPropertyAccessExpression(object, index) + : createElementAccessExpression(object, index); + } + function createSliceCall(value, sliceIndex) { + var call = ts.createSynthesizedNode(174); + var sliceIdentifier = ts.createSynthesizedNode(69); + sliceIdentifier.text = "slice"; + call.expression = createPropertyAccessExpression(value, sliceIdentifier); + call.arguments = ts.createSynthesizedNodeArray(); + call.arguments[0] = createNumericLiteral(sliceIndex); + return call; + } + function emitObjectLiteralAssignment(target, value, sourceMapNode) { + var properties = target.properties; + if (properties.length !== 1) { + value = ensureIdentifier(value, true, sourceMapNode); + } + for (var _a = 0, properties_5 = properties; _a < properties_5.length; _a++) { + var p = properties_5[_a]; + if (p.kind === 253 || p.kind === 254) { + var propName = p.name; + var target_1 = p.kind === 254 ? p : p.initializer || propName; + emitDestructuringAssignment(target_1, createPropertyAccessForDestructuringProperty(value, propName), p); + } + } + } + function emitArrayLiteralAssignment(target, value, sourceMapNode) { + var elements = target.elements; + if (elements.length !== 1) { + value = ensureIdentifier(value, true, sourceMapNode); + } + for (var i = 0; i < elements.length; i++) { + var e = elements[i]; + if (e.kind !== 193) { + if (e.kind !== 191) { + emitDestructuringAssignment(e, createElementAccessExpression(value, createNumericLiteral(i)), e); + } + else if (i === elements.length - 1) { + emitDestructuringAssignment(e.expression, createSliceCall(value, i), e); + } + } + } + } + function emitDestructuringAssignment(target, value, sourceMapNode) { + if (target.kind === 254) { + if (target.objectAssignmentInitializer) { + value = createDefaultValueCheck(value, target.objectAssignmentInitializer, sourceMapNode); + } + target = target.name; + } + else if (target.kind === 187 && target.operatorToken.kind === 56) { + value = createDefaultValueCheck(value, target.right, sourceMapNode); + target = target.left; + } + if (target.kind === 171) { + emitObjectLiteralAssignment(target, value, sourceMapNode); + } + else if (target.kind === 170) { + emitArrayLiteralAssignment(target, value, sourceMapNode); + } + else { + emitAssignment(target, value, emitCount > 0, sourceMapNode); + emitCount++; + } + } + function emitAssignmentExpression(root) { + var target = root.left; + var value = root.right; + if (ts.isEmptyObjectLiteralOrArrayLiteral(target)) { + emit(value); + } + else if (isAssignmentExpressionStatement) { + emitDestructuringAssignment(target, value, ts.nodeIsSynthesized(root) ? target : root); + } + else { + if (root.parent.kind !== 178) { + write("("); + } + value = ensureIdentifier(value, true, root); + emitDestructuringAssignment(target, value, root); + write(", "); + emit(value); + if (root.parent.kind !== 178) { + write(")"); + } + } + } + function emitBindingElement(target, value) { + if (target.initializer) { + value = value ? createDefaultValueCheck(value, target.initializer, target) : target.initializer; + } + else if (!value) { + value = createVoidZero(); + } + if (ts.isBindingPattern(target.name)) { + var pattern = target.name; + var elements = pattern.elements; + var numElements = elements.length; + if (numElements !== 1) { + value = ensureIdentifier(value, numElements !== 0, target); + } + for (var i = 0; i < numElements; i++) { + var element = elements[i]; + if (pattern.kind === 167) { + var propName = element.propertyName || element.name; + emitBindingElement(element, createPropertyAccessForDestructuringProperty(value, propName)); + } + else if (element.kind !== 193) { + if (!element.dotDotDotToken) { + emitBindingElement(element, createElementAccessExpression(value, createNumericLiteral(i))); + } + else if (i === numElements - 1) { + emitBindingElement(element, createSliceCall(value, i)); + } + } + } + } + else { + emitAssignment(target.name, value, emitCount > 0, target); + emitCount++; + } + } + } + function emitVariableDeclaration(node) { + if (ts.isBindingPattern(node.name)) { + var isExported = ts.getCombinedNodeFlags(node) & 1; + if (languageVersion >= 2 && (!isExported || modulekind === ts.ModuleKind.ES6)) { + var isTopLevelDeclarationInSystemModule = modulekind === ts.ModuleKind.System && + shouldHoistVariable(node, true); + if (isTopLevelDeclarationInSystemModule) { + write("("); + } + emit(node.name); + emitOptional(" = ", node.initializer); + if (isTopLevelDeclarationInSystemModule) { + write(")"); + } + } + else { + emitDestructuring(node, false); + } + } + else { + var initializer = node.initializer; + if (!initializer && + languageVersion < 2 && + node.name.kind === 69) { + var container = ts.getEnclosingBlockScopeContainer(node); + var flags = resolver.getNodeCheckFlags(node); + var isCapturedInFunction = flags & 131072; + var isDeclaredInLoop = flags & 262144; + var emittedAsTopLevel = ts.isBlockScopedContainerTopLevel(container) || + (isCapturedInFunction && isDeclaredInLoop && container.kind === 199 && ts.isIterationStatement(container.parent, false)); + var emittedAsNestedLetDeclaration = ts.getCombinedNodeFlags(node) & 1024 && + !emittedAsTopLevel; + var emitExplicitInitializer = emittedAsNestedLetDeclaration && + container.kind !== 207 && + container.kind !== 208 && + (!resolver.isDeclarationWithCollidingName(node) || + (isDeclaredInLoop && !isCapturedInFunction && !ts.isIterationStatement(container, false))); + if (emitExplicitInitializer) { + initializer = createVoidZero(); + } + } + var exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.name); + if (exportChanged) { + write(exportFunctionForFile + "(\""); + emitNodeWithCommentsAndWithoutSourcemap(node.name); + write("\", "); + } + emitModuleMemberName(node); + emitOptional(" = ", initializer); + if (exportChanged) { + write(")"); + } + } + } + function emitExportVariableAssignments(node) { + if (node.kind === 193) { + return; + } + var name = node.name; + if (name.kind === 69) { + emitExportMemberAssignments(name); + } + else if (ts.isBindingPattern(name)) { + ts.forEach(name.elements, emitExportVariableAssignments); + } + } + function isES6ExportedDeclaration(node) { + return !!(node.flags & 1) && + modulekind === ts.ModuleKind.ES6 && + node.parent.kind === 256; + } + function emitVariableStatement(node) { + var startIsEmitted = false; + if (node.flags & 1) { + if (isES6ExportedDeclaration(node)) { + write("export "); + startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList); + } + } + else { + startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList); + } + if (startIsEmitted) { + emitCommaList(node.declarationList.declarations); + write(";"); + } + else { + var atLeastOneItem = emitVariableDeclarationListSkippingUninitializedEntries(node.declarationList); + if (atLeastOneItem) { + write(";"); + } + } + if (modulekind !== ts.ModuleKind.ES6 && node.parent === currentSourceFile) { + ts.forEach(node.declarationList.declarations, emitExportVariableAssignments); + } + } + function shouldEmitLeadingAndTrailingCommentsForVariableStatement(node) { + if (!(node.flags & 1)) { + return true; + } + if (isES6ExportedDeclaration(node)) { + return true; + } + for (var _a = 0, _b = node.declarationList.declarations; _a < _b.length; _a++) { + var declaration = _b[_a]; + if (declaration.initializer) { + return true; + } + } + return false; + } + function emitParameter(node) { + if (languageVersion < 2) { + if (ts.isBindingPattern(node.name)) { + var name_28 = createTempVariable(0); + if (!tempParameters) { + tempParameters = []; + } + tempParameters.push(name_28); + emit(name_28); + } + else { + emit(node.name); + } + } + else { + if (node.dotDotDotToken) { + write("..."); + } + emit(node.name); + emitOptional(" = ", node.initializer); + } + } + function emitDefaultValueAssignments(node) { + if (languageVersion < 2) { + var tempIndex_1 = 0; + ts.forEach(node.parameters, function (parameter) { + if (parameter.dotDotDotToken) { + return; + } + var paramName = parameter.name, initializer = parameter.initializer; + if (ts.isBindingPattern(paramName)) { + var hasBindingElements = paramName.elements.length > 0; + if (hasBindingElements || initializer) { + writeLine(); + write("var "); + if (hasBindingElements) { + emitDestructuring(parameter, false, tempParameters[tempIndex_1]); + } + else { + emit(tempParameters[tempIndex_1]); + write(" = "); + emit(initializer); + } + write(";"); + tempIndex_1++; + } + } + else if (initializer) { + writeLine(); + emitStart(parameter); + write("if ("); + emitNodeWithoutSourceMap(paramName); + write(" === void 0)"); + emitEnd(parameter); + write(" { "); + emitStart(parameter); + emitNodeWithCommentsAndWithoutSourcemap(paramName); + write(" = "); + emitNodeWithCommentsAndWithoutSourcemap(initializer); + emitEnd(parameter); + write("; }"); + } + }); + } + } + function emitRestParameter(node) { + if (languageVersion < 2 && ts.hasDeclaredRestParameter(node)) { + var restIndex = node.parameters.length - 1; + var restParam = node.parameters[restIndex]; + if (ts.isBindingPattern(restParam.name)) { + return; + } + var tempName = createTempVariable(268435456).text; + writeLine(); + emitLeadingComments(restParam); + emitStart(restParam); + write("var "); + emitNodeWithCommentsAndWithoutSourcemap(restParam.name); + write(" = [];"); + emitEnd(restParam); + emitTrailingComments(restParam); + writeLine(); + write("for ("); + emitStart(restParam); + write("var " + tempName + " = " + restIndex + ";"); + emitEnd(restParam); + write(" "); + emitStart(restParam); + write(tempName + " < arguments.length;"); + emitEnd(restParam); + write(" "); + emitStart(restParam); + write(tempName + "++"); + emitEnd(restParam); + write(") {"); + increaseIndent(); + writeLine(); + emitStart(restParam); + emitNodeWithCommentsAndWithoutSourcemap(restParam.name); + write("[" + tempName + " - " + restIndex + "] = arguments[" + tempName + "];"); + emitEnd(restParam); + decreaseIndent(); + writeLine(); + write("}"); + } + } + function emitAccessor(node) { + write(node.kind === 149 ? "get " : "set "); + emit(node.name); + emitSignatureAndBody(node); + } + function shouldEmitAsArrowFunction(node) { + return node.kind === 180 && languageVersion >= 2; + } + function emitDeclarationName(node) { + if (node.name) { + emitNodeWithCommentsAndWithoutSourcemap(node.name); + } + else { + write(getGeneratedNameForNode(node)); + } + } + function shouldEmitFunctionName(node) { + if (node.kind === 179) { + return !!node.name; + } + if (node.kind === 220) { + return !!node.name || modulekind !== ts.ModuleKind.ES6; + } + } + function emitFunctionDeclaration(node) { + if (ts.nodeIsMissing(node.body)) { + return emitCommentsOnNotEmittedNode(node); + } + var kind = node.kind, parent = node.parent; + if (kind !== 147 && + kind !== 146 && + parent && + parent.kind !== 253 && + parent.kind !== 174 && + parent.kind !== 170) { + emitLeadingComments(node); + } + emitStart(node); + if (!shouldEmitAsArrowFunction(node)) { + if (isES6ExportedDeclaration(node)) { + write("export "); + if (node.flags & 512) { + write("default "); + } + } + write("function"); + if (languageVersion >= 2 && node.asteriskToken) { + write("*"); + } + write(" "); + } + if (shouldEmitFunctionName(node)) { + emitDeclarationName(node); + } + emitSignatureAndBody(node); + if (modulekind !== ts.ModuleKind.ES6 && kind === 220 && parent === currentSourceFile && node.name) { + emitExportMemberAssignments(node.name); + } + emitEnd(node); + if (kind !== 147 && + kind !== 146 && + kind !== 180) { + emitTrailingComments(node); + } + } + function emitCaptureThisForNodeIfNecessary(node) { + if (resolver.getNodeCheckFlags(node) & 4) { + writeLine(); + emitStart(node); + write("var _this = this;"); + emitEnd(node); + } + } + function emitSignatureParameters(node) { + increaseIndent(); + write("("); + if (node) { + var parameters = node.parameters; + var skipCount = node.parameters.length && node.parameters[0].name.text === "this" ? 1 : 0; + var omitCount = languageVersion < 2 && ts.hasDeclaredRestParameter(node) ? 1 : 0; + emitList(parameters, skipCount, parameters.length - omitCount - skipCount, false, false); + } + write(")"); + decreaseIndent(); + } + function emitSignatureParametersForArrow(node) { + if (node.parameters.length === 1 && node.pos === node.parameters[0].pos) { + emit(node.parameters[0]); + return; + } + emitSignatureParameters(node); + } + function emitAsyncFunctionBodyForES6(node) { + var promiseConstructor = ts.getEntityNameFromTypeNode(node.type); + var isArrowFunction = node.kind === 180; + var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 8192) !== 0; + if (!isArrowFunction) { + write(" {"); + increaseIndent(); + writeLine(); + if (resolver.getNodeCheckFlags(node) & 4096) { + writeLines("\nconst _super = (function (geti, seti) {\n const cache = Object.create(null);\n return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });\n})(name => super[name], (name, value) => super[name] = value);"); + writeLine(); + } + else if (resolver.getNodeCheckFlags(node) & 2048) { + write("const _super = name => super[name];"); + writeLine(); + } + write("return"); + } + write(" __awaiter(this"); + if (hasLexicalArguments) { + write(", arguments, "); + } + else { + write(", void 0, "); + } + if (languageVersion >= 2 || !promiseConstructor) { + write("void 0"); + } + else { + emitEntityNameAsExpression(promiseConstructor, false); + } + write(", function* ()"); + emitFunctionBody(node); + write(")"); + if (!isArrowFunction) { + write(";"); + decreaseIndent(); + writeLine(); + write("}"); + } + } + function emitFunctionBody(node) { + if (!node.body) { + write(" { }"); + } + else { + if (node.body.kind === 199) { + emitBlockFunctionBody(node, node.body); + } + else { + emitExpressionFunctionBody(node, node.body); + } + } + } + function emitSignatureAndBody(node) { + var saveConvertedLoopState = convertedLoopState; + var saveTempFlags = tempFlags; + var saveTempVariables = tempVariables; + var saveTempParameters = tempParameters; + convertedLoopState = undefined; + tempFlags = 0; + tempVariables = undefined; + tempParameters = undefined; + if (shouldEmitAsArrowFunction(node)) { + emitSignatureParametersForArrow(node); + write(" =>"); + } + else { + emitSignatureParameters(node); + } + var isAsync = ts.isAsyncFunctionLike(node); + if (isAsync) { + emitAsyncFunctionBodyForES6(node); + } + else { + emitFunctionBody(node); + } + if (!isES6ExportedDeclaration(node)) { + emitExportMemberAssignment(node); + } + ts.Debug.assert(convertedLoopState === undefined); + convertedLoopState = saveConvertedLoopState; + tempFlags = saveTempFlags; + tempVariables = saveTempVariables; + tempParameters = saveTempParameters; + } + function emitFunctionBodyPreamble(node) { + emitCaptureThisForNodeIfNecessary(node); + emitDefaultValueAssignments(node); + emitRestParameter(node); + } + function emitExpressionFunctionBody(node, body) { + if (languageVersion < 2 || node.flags & 256) { + emitDownLevelExpressionFunctionBody(node, body); + return; + } + write(" "); + var current = body; + while (current.kind === 177) { + current = current.expression; + } + emitParenthesizedIf(body, current.kind === 171); + } + function emitDownLevelExpressionFunctionBody(node, body) { + write(" {"); + increaseIndent(); + var outPos = writer.getTextPos(); + emitDetachedCommentsAndUpdateCommentsInfo(node.body); + emitFunctionBodyPreamble(node); + var preambleEmitted = writer.getTextPos() !== outPos; + decreaseIndent(); + if (!preambleEmitted && nodeStartPositionsAreOnSameLine(node, body)) { + write(" "); + emitStart(body); + write("return "); + emit(body); + emitEnd(body); + write(";"); + emitTempDeclarations(false); + write(" "); + } + else { + increaseIndent(); + writeLine(); + emitLeadingComments(node.body); + emitStart(body); + write("return "); + emit(body); + emitEnd(body); + write(";"); + emitTrailingComments(node.body); + emitTempDeclarations(true); + decreaseIndent(); + writeLine(); + } + emitStart(node.body); + write("}"); + emitEnd(node.body); + } + function emitBlockFunctionBody(node, body) { + write(" {"); + var initialTextPos = writer.getTextPos(); + increaseIndent(); + emitDetachedCommentsAndUpdateCommentsInfo(body.statements); + var startIndex = emitDirectivePrologues(body.statements, true); + emitFunctionBodyPreamble(node); + decreaseIndent(); + var preambleEmitted = writer.getTextPos() !== initialTextPos; + if (!preambleEmitted && nodeEndIsOnSameLineAsNodeStart(body, body)) { + for (var _a = 0, _b = body.statements; _a < _b.length; _a++) { + var statement = _b[_a]; + write(" "); + emit(statement); + } + emitTempDeclarations(false); + write(" "); + emitLeadingCommentsOfPosition(body.statements.end); + } + else { + increaseIndent(); + emitLinesStartingAt(body.statements, startIndex); + emitTempDeclarations(true); + writeLine(); + emitLeadingCommentsOfPosition(body.statements.end); + decreaseIndent(); + } + emitToken(16, body.statements.end); + } + function getSuperCallAtGivenIndex(ctor, index) { + if (!ctor.body) { + return undefined; + } + var statements = ctor.body.statements; + if (!statements || index >= statements.length) { + return undefined; + } + var statement = statements[index]; + if (statement.kind === 202) { + return ts.isSuperCallExpression(statement.expression) ? statement : undefined; + } + } + function emitParameterPropertyAssignments(node) { + ts.forEach(node.parameters, function (param) { + if (param.flags & 92) { + writeLine(); + emitStart(param); + emitStart(param.name); + write("this."); + emitNodeWithoutSourceMap(param.name); + emitEnd(param.name); + write(" = "); + emit(param.name); + write(";"); + emitEnd(param); + } + }); + } + function emitMemberAccessForPropertyName(memberName) { + if (memberName.kind === 9 || memberName.kind === 8) { + write("["); + emitNodeWithCommentsAndWithoutSourcemap(memberName); + write("]"); + } + else if (memberName.kind === 140) { + emitComputedPropertyName(memberName); + } + else { + write("."); + emitNodeWithCommentsAndWithoutSourcemap(memberName); + } + } + function getInitializedProperties(node, isStatic) { + var properties = []; + for (var _a = 0, _b = node.members; _a < _b.length; _a++) { + var member = _b[_a]; + if (member.kind === 145 && isStatic === ((member.flags & 32) !== 0) && member.initializer) { + properties.push(member); + } + } + return properties; + } + function emitPropertyDeclarations(node, properties) { + for (var _a = 0, properties_6 = properties; _a < properties_6.length; _a++) { + var property = properties_6[_a]; + emitPropertyDeclaration(node, property); + } + } + function emitPropertyDeclaration(node, property, receiver, isExpression) { + writeLine(); + emitLeadingComments(property); + emitStart(property); + emitStart(property.name); + if (receiver) { + emit(receiver); + } + else { + if (property.flags & 32) { + emitDeclarationName(node); + } + else { + write("this"); + } + } + emitMemberAccessForPropertyName(property.name); + emitEnd(property.name); + write(" = "); + emit(property.initializer); + if (!isExpression) { + write(";"); + } + emitEnd(property); + emitTrailingComments(property); + } + function emitMemberFunctionsForES5AndLower(node) { + ts.forEach(node.members, function (member) { + if (member.kind === 198) { + writeLine(); + write(";"); + } + else if (member.kind === 147 || node.kind === 146) { + if (!member.body) { + return emitCommentsOnNotEmittedNode(member); + } + writeLine(); + emitLeadingComments(member); + emitStart(member); + emitStart(member.name); + emitClassMemberPrefix(node, member); + emitMemberAccessForPropertyName(member.name); + emitEnd(member.name); + write(" = "); + emitFunctionDeclaration(member); + emitEnd(member); + write(";"); + emitTrailingComments(member); + } + else if (member.kind === 149 || member.kind === 150) { + var accessors = ts.getAllAccessorDeclarations(node.members, member); + if (member === accessors.firstAccessor) { + writeLine(); + emitStart(member); + write("Object.defineProperty("); + emitStart(member.name); + emitClassMemberPrefix(node, member); + write(", "); + emitExpressionForPropertyName(member.name); + emitEnd(member.name); + write(", {"); + increaseIndent(); + if (accessors.getAccessor) { + writeLine(); + emitLeadingComments(accessors.getAccessor); + write("get: "); + emitStart(accessors.getAccessor); + write("function "); + emitSignatureAndBody(accessors.getAccessor); + emitEnd(accessors.getAccessor); + emitTrailingComments(accessors.getAccessor); + write(","); + } + if (accessors.setAccessor) { + writeLine(); + emitLeadingComments(accessors.setAccessor); + write("set: "); + emitStart(accessors.setAccessor); + write("function "); + emitSignatureAndBody(accessors.setAccessor); + emitEnd(accessors.setAccessor); + emitTrailingComments(accessors.setAccessor); + write(","); + } + writeLine(); + write("enumerable: true,"); + writeLine(); + write("configurable: true"); + decreaseIndent(); + writeLine(); + write("});"); + emitEnd(member); + } + } + }); + } + function emitMemberFunctionsForES6AndHigher(node) { + for (var _a = 0, _b = node.members; _a < _b.length; _a++) { + var member = _b[_a]; + if ((member.kind === 147 || node.kind === 146) && !member.body) { + emitCommentsOnNotEmittedNode(member); + } + else if (member.kind === 147 || + member.kind === 149 || + member.kind === 150) { + writeLine(); + emitLeadingComments(member); + emitStart(member); + if (member.flags & 32) { + write("static "); + } + if (member.kind === 149) { + write("get "); + } + else if (member.kind === 150) { + write("set "); + } + if (member.asteriskToken) { + write("*"); + } + emit(member.name); + emitSignatureAndBody(member); + emitEnd(member); + emitTrailingComments(member); + } + else if (member.kind === 198) { + writeLine(); + write(";"); + } + } + } + function emitConstructor(node, baseTypeElement) { + var saveConvertedLoopState = convertedLoopState; + var saveTempFlags = tempFlags; + var saveTempVariables = tempVariables; + var saveTempParameters = tempParameters; + convertedLoopState = undefined; + tempFlags = 0; + tempVariables = undefined; + tempParameters = undefined; + emitConstructorWorker(node, baseTypeElement); + ts.Debug.assert(convertedLoopState === undefined); + convertedLoopState = saveConvertedLoopState; + tempFlags = saveTempFlags; + tempVariables = saveTempVariables; + tempParameters = saveTempParameters; + } + function emitConstructorWorker(node, baseTypeElement) { + var hasInstancePropertyWithInitializer = false; + ts.forEach(node.members, function (member) { + if (member.kind === 148 && !member.body) { + emitCommentsOnNotEmittedNode(member); + } + if (member.kind === 145 && member.initializer && (member.flags & 32) === 0) { + hasInstancePropertyWithInitializer = true; + } + }); + var ctor = ts.getFirstConstructorWithBody(node); + if (languageVersion >= 2 && !ctor && !hasInstancePropertyWithInitializer) { + return; + } + if (ctor) { + emitLeadingComments(ctor); + } + emitStart(ctor || node); + if (languageVersion < 2) { + write("function "); + emitDeclarationName(node); + emitSignatureParameters(ctor); + } + else { + write("constructor"); + if (ctor) { + emitSignatureParameters(ctor); + } + else { + if (baseTypeElement) { + write("(...args)"); + } + else { + write("()"); + } + } + } + var startIndex = 0; + write(" {"); + increaseIndent(); + if (ctor) { + startIndex = emitDirectivePrologues(ctor.body.statements, true); + emitDetachedCommentsAndUpdateCommentsInfo(ctor.body.statements); + } + emitCaptureThisForNodeIfNecessary(node); + var superCall; + if (ctor) { + emitDefaultValueAssignments(ctor); + emitRestParameter(ctor); + if (baseTypeElement) { + superCall = getSuperCallAtGivenIndex(ctor, startIndex); + if (superCall) { + writeLine(); + emit(superCall); + } + } + emitParameterPropertyAssignments(ctor); + } + else { + if (baseTypeElement) { + writeLine(); + emitStart(baseTypeElement); + if (languageVersion < 2) { + write("_super.apply(this, arguments);"); + } + else { + write("super(...args);"); + } + emitEnd(baseTypeElement); + } + } + emitPropertyDeclarations(node, getInitializedProperties(node, false)); + if (ctor) { + var statements = ctor.body.statements; + if (superCall) { + statements = statements.slice(1); + } + emitLinesStartingAt(statements, startIndex); + } + emitTempDeclarations(true); + writeLine(); + if (ctor) { + emitLeadingCommentsOfPosition(ctor.body.statements.end); + } + decreaseIndent(); + emitToken(16, ctor ? ctor.body.statements.end : node.members.end); + emitEnd(ctor || node); + if (ctor) { + emitTrailingComments(ctor); + } + } + function emitClassExpression(node) { + return emitClassLikeDeclaration(node); + } + function emitClassDeclaration(node) { + return emitClassLikeDeclaration(node); + } + function emitClassLikeDeclaration(node) { + if (languageVersion < 2) { + emitClassLikeDeclarationBelowES6(node); + } + else { + emitClassLikeDeclarationForES6AndHigher(node); + } + if (modulekind !== ts.ModuleKind.ES6 && node.parent === currentSourceFile && node.name) { + emitExportMemberAssignments(node.name); + } + } + function emitClassLikeDeclarationForES6AndHigher(node) { + var decoratedClassAlias; + var isHoistedDeclarationInSystemModule = shouldHoistDeclarationInSystemJsModule(node); + var isDecorated = ts.nodeIsDecorated(node); + var rewriteAsClassExpression = isDecorated || isHoistedDeclarationInSystemModule; + if (node.kind === 221) { + if (rewriteAsClassExpression) { + if (isDecorated && resolver.getNodeCheckFlags(node) & 524288) { + decoratedClassAlias = ts.unescapeIdentifier(makeUniqueName(node.name ? node.name.text : "default")); + decoratedClassAliases[ts.getNodeId(node)] = decoratedClassAlias; + write("let " + decoratedClassAlias + ";"); + writeLine(); + } + if (isES6ExportedDeclaration(node) && !(node.flags & 512)) { + write("export "); + } + if (!isHoistedDeclarationInSystemModule) { + write("let "); + } + emitDeclarationName(node); + if (decoratedClassAlias !== undefined) { + write(" = " + decoratedClassAlias); + } + write(" = "); + } + else if (isES6ExportedDeclaration(node)) { + write("export "); + if (node.flags & 512) { + write("default "); + } + } + } + var staticProperties = getInitializedProperties(node, true); + var isClassExpressionWithStaticProperties = staticProperties.length > 0 && node.kind === 192; + var tempVariable; + if (isClassExpressionWithStaticProperties) { + tempVariable = createAndRecordTempVariable(0); + write("("); + increaseIndent(); + emit(tempVariable); + write(" = "); + } + write("class"); + if (node.name || (node.flags & 512 && (staticProperties.length > 0 || modulekind !== ts.ModuleKind.ES6) && !rewriteAsClassExpression)) { + write(" "); + emitDeclarationName(node); + } + var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); + if (baseTypeNode) { + write(" extends "); + emit(baseTypeNode.expression); + } + write(" {"); + increaseIndent(); + writeLine(); + emitConstructor(node, baseTypeNode); + emitMemberFunctionsForES6AndHigher(node); + decreaseIndent(); + writeLine(); + emitToken(16, node.members.end); + if (rewriteAsClassExpression) { + decoratedClassAliases[ts.getNodeId(node)] = undefined; + write(";"); + } + if (isClassExpressionWithStaticProperties) { + for (var _a = 0, staticProperties_1 = staticProperties; _a < staticProperties_1.length; _a++) { + var property = staticProperties_1[_a]; + write(","); + writeLine(); + emitPropertyDeclaration(node, property, tempVariable, true); + } + write(","); + writeLine(); + emit(tempVariable); + decreaseIndent(); + write(")"); + } + else { + writeLine(); + emitPropertyDeclarations(node, staticProperties); + emitDecoratorsOfClass(node, decoratedClassAlias); + } + if (!(node.flags & 1)) { + return; + } + if (modulekind !== ts.ModuleKind.ES6) { + emitExportMemberAssignment(node); + } + else { + if (node.flags & 512) { + if (isDecorated) { + writeLine(); + write("export default "); + emitDeclarationName(node); + write(";"); + } + } + else if (node.parent.kind !== 256) { + writeLine(); + emitStart(node); + emitModuleMemberName(node); + write(" = "); + emitDeclarationName(node); + emitEnd(node); + write(";"); + } + } + } + function emitClassLikeDeclarationBelowES6(node) { + if (node.kind === 221) { + if (!shouldHoistDeclarationInSystemJsModule(node)) { + write("var "); + } + emitDeclarationName(node); + write(" = "); + } + write("(function ("); + var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); + if (baseTypeNode) { + write("_super"); + } + write(") {"); + var saveTempFlags = tempFlags; + var saveTempVariables = tempVariables; + var saveTempParameters = tempParameters; + var saveComputedPropertyNamesToGeneratedNames = computedPropertyNamesToGeneratedNames; + var saveConvertedLoopState = convertedLoopState; + convertedLoopState = undefined; + tempFlags = 0; + tempVariables = undefined; + tempParameters = undefined; + computedPropertyNamesToGeneratedNames = undefined; + increaseIndent(); + if (baseTypeNode) { + writeLine(); + emitStart(baseTypeNode); + write("__extends("); + emitDeclarationName(node); + write(", _super);"); + emitEnd(baseTypeNode); + } + writeLine(); + emitConstructor(node, baseTypeNode); + emitMemberFunctionsForES5AndLower(node); + emitPropertyDeclarations(node, getInitializedProperties(node, true)); + writeLine(); + emitDecoratorsOfClass(node, undefined); + writeLine(); + emitToken(16, node.members.end, function () { + write("return "); + emitDeclarationName(node); + }); + write(";"); + emitTempDeclarations(true); + ts.Debug.assert(convertedLoopState === undefined); + convertedLoopState = saveConvertedLoopState; + tempFlags = saveTempFlags; + tempVariables = saveTempVariables; + tempParameters = saveTempParameters; + computedPropertyNamesToGeneratedNames = saveComputedPropertyNamesToGeneratedNames; + decreaseIndent(); + writeLine(); + emitToken(16, node.members.end); + emitStart(node); + write("("); + if (baseTypeNode) { + emit(baseTypeNode.expression); + } + write("))"); + if (node.kind === 221) { + write(";"); + } + emitEnd(node); + if (node.kind === 221) { + emitExportMemberAssignment(node); + } + } + function emitClassMemberPrefix(node, member) { + emitDeclarationName(node); + if (!(member.flags & 32)) { + write(".prototype"); + } + } + function emitDecoratorsOfClass(node, decoratedClassAlias) { + emitDecoratorsOfMembers(node, 0); + emitDecoratorsOfMembers(node, 32); + emitDecoratorsOfConstructor(node, decoratedClassAlias); + } + function emitDecoratorsOfConstructor(node, decoratedClassAlias) { + var decorators = node.decorators; + var constructor = ts.getFirstConstructorWithBody(node); + var firstParameterDecorator = constructor && ts.forEach(constructor.parameters, function (parameter) { return parameter.decorators; }); + if (!decorators && !firstParameterDecorator) { + return; + } + writeLine(); + emitStart(node.decorators || firstParameterDecorator); + emitDeclarationName(node); + if (decoratedClassAlias !== undefined) { + write(" = " + decoratedClassAlias); + } + write(" = __decorate(["); + increaseIndent(); + writeLine(); + var decoratorCount = decorators ? decorators.length : 0; + var argumentsWritten = emitList(decorators, 0, decoratorCount, true, false, false, true, function (decorator) { return emit(decorator.expression); }); + if (firstParameterDecorator) { + argumentsWritten += emitDecoratorsOfParameters(constructor, argumentsWritten > 0); + } + emitSerializedTypeMetadata(node, argumentsWritten >= 0); + decreaseIndent(); + writeLine(); + write("], "); + emitDeclarationName(node); + write(")"); + emitEnd(node.decorators || firstParameterDecorator); + write(";"); + writeLine(); + } + function emitDecoratorsOfMembers(node, staticFlag) { + for (var _a = 0, _b = node.members; _a < _b.length; _a++) { + var member = _b[_a]; + if ((member.flags & 32) !== staticFlag) { + continue; + } + if (!ts.nodeCanBeDecorated(member)) { + continue; + } + var decorators = void 0; + var functionLikeMember = void 0; + if (ts.isAccessor(member)) { + var accessors = ts.getAllAccessorDeclarations(node.members, member); + if (member !== accessors.firstAccessor) { + continue; + } + decorators = accessors.firstAccessor.decorators; + if (!decorators && accessors.secondAccessor) { + decorators = accessors.secondAccessor.decorators; + } + functionLikeMember = accessors.setAccessor; + } + else { + decorators = member.decorators; + if (member.kind === 147) { + functionLikeMember = member; + } + } + var firstParameterDecorator = functionLikeMember && ts.forEach(functionLikeMember.parameters, function (parameter) { return parameter.decorators; }); + if (!decorators && !firstParameterDecorator) { + continue; + } + writeLine(); + emitStart(decorators || firstParameterDecorator); + write("__decorate(["); + increaseIndent(); + writeLine(); + var decoratorCount = decorators ? decorators.length : 0; + var argumentsWritten = emitList(decorators, 0, decoratorCount, true, false, false, true, function (decorator) { return emit(decorator.expression); }); + if (firstParameterDecorator) { + argumentsWritten += emitDecoratorsOfParameters(functionLikeMember, argumentsWritten > 0); + } + emitSerializedTypeMetadata(member, argumentsWritten > 0); + decreaseIndent(); + writeLine(); + write("], "); + emitClassMemberPrefix(node, member); + write(", "); + emitExpressionForPropertyName(member.name); + if (languageVersion > 0) { + if (member.kind !== 145) { + write(", null"); + } + else { + write(", void 0"); + } + } + write(")"); + emitEnd(decorators || firstParameterDecorator); + write(";"); + writeLine(); + } + } + function emitDecoratorsOfParameters(node, leadingComma) { + var argumentsWritten = 0; + if (node) { + var parameterIndex_1 = 0; + for (var _a = 0, _b = node.parameters; _a < _b.length; _a++) { + var parameter = _b[_a]; + if (ts.nodeIsDecorated(parameter)) { + var decorators = parameter.decorators; + argumentsWritten += emitList(decorators, 0, decorators.length, true, false, leadingComma, true, function (decorator) { + write("__param(" + parameterIndex_1 + ", "); + emit(decorator.expression); + write(")"); + }); + leadingComma = true; + } + parameterIndex_1++; + } + } + return argumentsWritten; + } + function shouldEmitTypeMetadata(node) { + switch (node.kind) { + case 147: + case 149: + case 150: + case 145: + return true; + } + return false; + } + function shouldEmitReturnTypeMetadata(node) { + switch (node.kind) { + case 147: + return true; + } + return false; + } + function shouldEmitParamTypesMetadata(node) { + switch (node.kind) { + case 221: + case 147: + case 150: + return true; + } + return false; + } + function emitSerializedTypeOfNode(node) { + switch (node.kind) { + case 221: + write("Function"); + return; + case 145: + emitSerializedTypeNode(node.type); + return; + case 142: + emitSerializedTypeNode(node.type); + return; + case 149: + emitSerializedTypeNode(node.type); + return; + case 150: + emitSerializedTypeNode(ts.getSetAccessorTypeAnnotationNode(node)); + return; + } + if (ts.isFunctionLike(node)) { + write("Function"); + return; + } + write("void 0"); + } + function emitSerializedTypeNode(node) { + if (node) { + switch (node.kind) { + case 103: + write("void 0"); + return; + case 164: + emitSerializedTypeNode(node.type); + return; + case 156: + case 157: + write("Function"); + return; + case 160: + case 161: + write("Array"); + return; + case 154: + case 120: + write("Boolean"); + return; + case 132: + case 166: + write("String"); + return; + case 130: + write("Number"); + return; + case 133: + write("Symbol"); + return; + case 155: + emitSerializedTypeReferenceNode(node); + return; + case 158: + case 159: + case 162: + case 163: + case 117: + case 165: + break; + default: + ts.Debug.fail("Cannot serialize unexpected type node."); + break; + } + } + write("Object"); + } + function emitSerializedTypeReferenceNode(node) { + var location = node.parent; + while (ts.isDeclaration(location) || ts.isTypeNode(location)) { + location = location.parent; + } + var typeName = ts.cloneEntityName(node.typeName, location); + var result = resolver.getTypeReferenceSerializationKind(typeName); + switch (result) { + case ts.TypeReferenceSerializationKind.Unknown: + var temp = createAndRecordTempVariable(0); + write("(typeof ("); + emitNodeWithoutSourceMap(temp); + write(" = "); + emitEntityNameAsExpression(typeName, true); + write(") === 'function' && "); + emitNodeWithoutSourceMap(temp); + write(") || Object"); + break; + case ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue: + emitEntityNameAsExpression(typeName, false); + break; + case ts.TypeReferenceSerializationKind.VoidType: + write("void 0"); + break; + case ts.TypeReferenceSerializationKind.BooleanType: + write("Boolean"); + break; + case ts.TypeReferenceSerializationKind.NumberLikeType: + write("Number"); + break; + case ts.TypeReferenceSerializationKind.StringLikeType: + write("String"); + break; + case ts.TypeReferenceSerializationKind.ArrayLikeType: + write("Array"); + break; + case ts.TypeReferenceSerializationKind.ESSymbolType: + if (languageVersion < 2) { + write("typeof Symbol === 'function' ? Symbol : Object"); + } + else { + write("Symbol"); + } + break; + case ts.TypeReferenceSerializationKind.TypeWithCallSignature: + write("Function"); + break; + case ts.TypeReferenceSerializationKind.ObjectType: + write("Object"); + break; + } + } + function emitSerializedParameterTypesOfNode(node) { + if (node) { + var valueDeclaration = void 0; + if (node.kind === 221) { + valueDeclaration = ts.getFirstConstructorWithBody(node); + } + else if (ts.isFunctionLike(node) && ts.nodeIsPresent(node.body)) { + valueDeclaration = node; + } + if (valueDeclaration) { + var parameters = valueDeclaration.parameters; + var parameterCount = parameters.length; + if (parameterCount > 0) { + for (var i = 0; i < parameterCount; i++) { + if (i > 0) { + write(", "); + } + if (parameters[i].dotDotDotToken) { + var parameterType = parameters[i].type; + if (parameterType.kind === 160) { + parameterType = parameterType.elementType; + } + else if (parameterType.kind === 155 && parameterType.typeArguments && parameterType.typeArguments.length === 1) { + parameterType = parameterType.typeArguments[0]; + } + else { + parameterType = undefined; + } + emitSerializedTypeNode(parameterType); + } + else { + emitSerializedTypeOfNode(parameters[i]); + } + } + } + } + } + } + function emitSerializedReturnTypeOfNode(node) { + if (node && ts.isFunctionLike(node) && node.type) { + emitSerializedTypeNode(node.type); + return; + } + write("void 0"); + } + function emitSerializedTypeMetadata(node, writeComma) { + var argumentsWritten = 0; + if (compilerOptions.emitDecoratorMetadata) { + if (shouldEmitTypeMetadata(node)) { + if (writeComma) { + write(", "); + } + writeLine(); + write("__metadata('design:type', "); + emitSerializedTypeOfNode(node); + write(")"); + argumentsWritten++; + } + if (shouldEmitParamTypesMetadata(node)) { + if (writeComma || argumentsWritten) { + write(", "); + } + writeLine(); + write("__metadata('design:paramtypes', ["); + emitSerializedParameterTypesOfNode(node); + write("])"); + argumentsWritten++; + } + if (shouldEmitReturnTypeMetadata(node)) { + if (writeComma || argumentsWritten) { + write(", "); + } + writeLine(); + write("__metadata('design:returntype', "); + emitSerializedReturnTypeOfNode(node); + write(")"); + argumentsWritten++; + } + } + return argumentsWritten; + } + function emitInterfaceDeclaration(node) { + emitCommentsOnNotEmittedNode(node); + } + function shouldEmitEnumDeclaration(node) { + var isConstEnum = ts.isConst(node); + return !isConstEnum || compilerOptions.preserveConstEnums || compilerOptions.isolatedModules; + } + function emitEnumDeclaration(node) { + if (!shouldEmitEnumDeclaration(node)) { + return; + } + if (!shouldHoistDeclarationInSystemJsModule(node)) { + var isES6ExportedEnum = isES6ExportedDeclaration(node); + if (!(node.flags & 1) || (isES6ExportedEnum && isFirstDeclarationOfKind(node, node.symbol && node.symbol.declarations, 224))) { + emitStart(node); + if (isES6ExportedEnum) { + write("export "); + } + write("var "); + emit(node.name); + emitEnd(node); + write(";"); + } + } + writeLine(); + emitStart(node); + write("(function ("); + emitStart(node.name); + write(getGeneratedNameForNode(node)); + emitEnd(node.name); + write(") {"); + increaseIndent(); + emitLines(node.members); + decreaseIndent(); + writeLine(); + emitToken(16, node.members.end); + write(")("); + emitModuleMemberName(node); + write(" || ("); + emitModuleMemberName(node); + write(" = {}));"); + emitEnd(node); + if (!isES6ExportedDeclaration(node) && node.flags & 1 && !shouldHoistDeclarationInSystemJsModule(node)) { + writeLine(); + emitStart(node); + write("var "); + emit(node.name); + write(" = "); + emitModuleMemberName(node); + emitEnd(node); + write(";"); + } + if (modulekind !== ts.ModuleKind.ES6 && node.parent === currentSourceFile) { + if (modulekind === ts.ModuleKind.System && (node.flags & 1)) { + writeLine(); + write(exportFunctionForFile + "(\""); + emitDeclarationName(node); + write("\", "); + emitDeclarationName(node); + write(");"); + } + emitExportMemberAssignments(node.name); + } + } + function emitEnumMember(node) { + var enumParent = node.parent; + emitStart(node); + write(getGeneratedNameForNode(enumParent)); + write("["); + write(getGeneratedNameForNode(enumParent)); + write("["); + emitExpressionForPropertyName(node.name); + write("] = "); + writeEnumMemberDeclarationValue(node); + write("] = "); + emitExpressionForPropertyName(node.name); + emitEnd(node); + write(";"); + } + function writeEnumMemberDeclarationValue(member) { + var value = resolver.getConstantValue(member); + if (value !== undefined) { + write(value.toString()); + return; + } + else if (member.initializer) { + emit(member.initializer); + } + else { + write("undefined"); + } + } + function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { + if (moduleDeclaration.body.kind === 225) { + var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); + return recursiveInnerModule || moduleDeclaration.body; + } + } + function shouldEmitModuleDeclaration(node) { + return ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums || compilerOptions.isolatedModules); + } + function isModuleMergedWithES6Class(node) { + return languageVersion === 2 && !!(resolver.getNodeCheckFlags(node) & 32768); + } + function isFirstDeclarationOfKind(node, declarations, kind) { + return !ts.forEach(declarations, function (declaration) { return declaration.kind === kind && declaration.pos < node.pos; }); + } + function emitModuleDeclaration(node) { + var shouldEmit = shouldEmitModuleDeclaration(node); + if (!shouldEmit) { + return emitCommentsOnNotEmittedNode(node); + } + var hoistedInDeclarationScope = shouldHoistDeclarationInSystemJsModule(node); + var emitVarForModule = !hoistedInDeclarationScope && !isModuleMergedWithES6Class(node); + if (emitVarForModule) { + var isES6ExportedNamespace = isES6ExportedDeclaration(node); + if (!isES6ExportedNamespace || isFirstDeclarationOfKind(node, node.symbol && node.symbol.declarations, 225)) { + emitStart(node); + if (isES6ExportedNamespace) { + write("export "); + } + write("var "); + emit(node.name); + write(";"); + emitEnd(node); + writeLine(); + } + } + emitStart(node); + write("(function ("); + emitStart(node.name); + write(getGeneratedNameForNode(node)); + emitEnd(node.name); + write(") "); + if (node.body.kind === 226) { + var saveConvertedLoopState = convertedLoopState; + var saveTempFlags = tempFlags; + var saveTempVariables = tempVariables; + convertedLoopState = undefined; + tempFlags = 0; + tempVariables = undefined; + emit(node.body); + ts.Debug.assert(convertedLoopState === undefined); + convertedLoopState = saveConvertedLoopState; + tempFlags = saveTempFlags; + tempVariables = saveTempVariables; + } + else { + write("{"); + increaseIndent(); + emitCaptureThisForNodeIfNecessary(node); + writeLine(); + emit(node.body); + decreaseIndent(); + writeLine(); + var moduleBlock = getInnerMostModuleDeclarationFromDottedModule(node).body; + emitToken(16, moduleBlock.statements.end); + } + write(")("); + if ((node.flags & 1) && !isES6ExportedDeclaration(node)) { + emit(node.name); + write(" = "); + } + emitModuleMemberName(node); + write(" || ("); + emitModuleMemberName(node); + write(" = {}));"); + emitEnd(node); + if (!isES6ExportedDeclaration(node) && node.name.kind === 69 && node.parent === currentSourceFile) { + if (modulekind === ts.ModuleKind.System && (node.flags & 1)) { + writeLine(); + write(exportFunctionForFile + "(\""); + emitDeclarationName(node); + write("\", "); + emitDeclarationName(node); + write(");"); + } + emitExportMemberAssignments(node.name); + } + } + function tryRenameExternalModule(moduleName) { + if (renamedDependencies && ts.hasProperty(renamedDependencies, moduleName.text)) { + return "\"" + renamedDependencies[moduleName.text] + "\""; + } + return undefined; + } + function emitRequire(moduleName) { + if (moduleName.kind === 9) { + write("require("); + var text = tryRenameExternalModule(moduleName); + if (text) { + write(text); + } + else { + emitStart(moduleName); + emitLiteral(moduleName); + emitEnd(moduleName); + } + emitToken(18, moduleName.end); + } + else { + write("require()"); + } + } + function getNamespaceDeclarationNode(node) { + if (node.kind === 229) { + return node; + } + var importClause = node.importClause; + if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 232) { + return importClause.namedBindings; + } + } + function isDefaultImport(node) { + return node.kind === 230 && node.importClause && !!node.importClause.name; + } + function emitExportImportAssignments(node) { + if (ts.isAliasSymbolDeclaration(node) && resolver.isValueAliasDeclaration(node)) { + emitExportMemberAssignments(node.name); + } + ts.forEachChild(node, emitExportImportAssignments); + } + function emitImportDeclaration(node) { + if (modulekind !== ts.ModuleKind.ES6) { + return emitExternalImportDeclaration(node); + } + if (node.importClause) { + var shouldEmitDefaultBindings = resolver.isReferencedAliasDeclaration(node.importClause); + var shouldEmitNamedBindings = node.importClause.namedBindings && resolver.isReferencedAliasDeclaration(node.importClause.namedBindings, true); + if (shouldEmitDefaultBindings || shouldEmitNamedBindings) { + write("import "); + emitStart(node.importClause); + if (shouldEmitDefaultBindings) { + emit(node.importClause.name); + if (shouldEmitNamedBindings) { + write(", "); + } + } + if (shouldEmitNamedBindings) { + emitLeadingComments(node.importClause.namedBindings); + emitStart(node.importClause.namedBindings); + if (node.importClause.namedBindings.kind === 232) { + write("* as "); + emit(node.importClause.namedBindings.name); + } + else { + write("{ "); + emitExportOrImportSpecifierList(node.importClause.namedBindings.elements, resolver.isReferencedAliasDeclaration); + write(" }"); + } + emitEnd(node.importClause.namedBindings); + emitTrailingComments(node.importClause.namedBindings); + } + emitEnd(node.importClause); + write(" from "); + emit(node.moduleSpecifier); + write(";"); + } + } + else { + write("import "); + emit(node.moduleSpecifier); + write(";"); + } + } + function emitExternalImportDeclaration(node) { + if (ts.contains(externalImports, node)) { + var isExportedImport = node.kind === 229 && (node.flags & 1) !== 0; + var namespaceDeclaration = getNamespaceDeclarationNode(node); + var varOrConst = (languageVersion <= 1) ? "var " : "const "; + if (modulekind !== ts.ModuleKind.AMD) { + emitLeadingComments(node); + emitStart(node); + if (namespaceDeclaration && !isDefaultImport(node)) { + if (!isExportedImport) { + write(varOrConst); + } + ; + emitModuleMemberName(namespaceDeclaration); + write(" = "); + } + else { + var isNakedImport = 230 && !node.importClause; + if (!isNakedImport) { + write(varOrConst); + write(getGeneratedNameForNode(node)); + write(" = "); + } + } + emitRequire(ts.getExternalModuleName(node)); + if (namespaceDeclaration && isDefaultImport(node)) { + write(", "); + emitModuleMemberName(namespaceDeclaration); + write(" = "); + write(getGeneratedNameForNode(node)); + } + write(";"); + emitEnd(node); + emitExportImportAssignments(node); + emitTrailingComments(node); + } + else { + if (isExportedImport) { + emitModuleMemberName(namespaceDeclaration); + write(" = "); + emit(namespaceDeclaration.name); + write(";"); + } + else if (namespaceDeclaration && isDefaultImport(node)) { + write(varOrConst); + emitModuleMemberName(namespaceDeclaration); + write(" = "); + write(getGeneratedNameForNode(node)); + write(";"); + } + emitExportImportAssignments(node); + } + } + } + function emitImportEqualsDeclaration(node) { + if (ts.isExternalModuleImportEqualsDeclaration(node)) { + emitExternalImportDeclaration(node); + return; + } + if (resolver.isReferencedAliasDeclaration(node) || + (!isCurrentFileExternalModule && resolver.isTopLevelValueImportEqualsWithEntityName(node))) { + emitLeadingComments(node); + emitStart(node); + var variableDeclarationIsHoisted = shouldHoistVariable(node, true); + var isExported = isSourceFileLevelDeclarationInSystemJsModule(node, true); + if (!variableDeclarationIsHoisted) { + ts.Debug.assert(!isExported); + if (isES6ExportedDeclaration(node)) { + write("export "); + write("var "); + } + else if (!(node.flags & 1)) { + write("var "); + } + } + if (isExported) { + write(exportFunctionForFile + "(\""); + emitNodeWithoutSourceMap(node.name); + write("\", "); + } + emitModuleMemberName(node); + write(" = "); + emit(node.moduleReference); + if (isExported) { + write(")"); + } + write(";"); + emitEnd(node); + emitExportImportAssignments(node); + emitTrailingComments(node); + } + } + function emitExportDeclaration(node) { + ts.Debug.assert(modulekind !== ts.ModuleKind.System); + if (modulekind !== ts.ModuleKind.ES6) { + if (node.moduleSpecifier && (!node.exportClause || resolver.isValueAliasDeclaration(node))) { + emitStart(node); + var generatedName = getGeneratedNameForNode(node); + if (node.exportClause) { + if (modulekind !== ts.ModuleKind.AMD) { + write("var "); + write(generatedName); + write(" = "); + emitRequire(ts.getExternalModuleName(node)); + write(";"); + } + for (var _a = 0, _b = node.exportClause.elements; _a < _b.length; _a++) { + var specifier = _b[_a]; + if (resolver.isValueAliasDeclaration(specifier)) { + writeLine(); + emitStart(specifier); + emitContainingModuleName(specifier); + write("."); + emitNodeWithCommentsAndWithoutSourcemap(specifier.name); + write(" = "); + write(generatedName); + write("."); + emitNodeWithCommentsAndWithoutSourcemap(specifier.propertyName || specifier.name); + write(";"); + emitEnd(specifier); + } + } + } + else { + if (hasExportStarsToExportValues && resolver.moduleExportsSomeValue(node.moduleSpecifier)) { + writeLine(); + write("__export("); + if (modulekind !== ts.ModuleKind.AMD) { + emitRequire(ts.getExternalModuleName(node)); + } + else { + write(generatedName); + } + write(");"); + } + } + emitEnd(node); + } + } + else { + if (!node.exportClause || resolver.isValueAliasDeclaration(node)) { + write("export "); + if (node.exportClause) { + write("{ "); + emitExportOrImportSpecifierList(node.exportClause.elements, resolver.isValueAliasDeclaration); + write(" }"); + } + else { + write("*"); + } + if (node.moduleSpecifier) { + write(" from "); + emit(node.moduleSpecifier); + } + write(";"); + } + } + } + function emitExportOrImportSpecifierList(specifiers, shouldEmit) { + ts.Debug.assert(modulekind === ts.ModuleKind.ES6); + var needsComma = false; + for (var _a = 0, specifiers_1 = specifiers; _a < specifiers_1.length; _a++) { + var specifier = specifiers_1[_a]; + if (shouldEmit(specifier)) { + if (needsComma) { + write(", "); + } + if (specifier.propertyName) { + emit(specifier.propertyName); + write(" as "); + } + emit(specifier.name); + needsComma = true; + } + } + } + function emitExportAssignment(node) { + if (!node.isExportEquals && resolver.isValueAliasDeclaration(node)) { + if (modulekind === ts.ModuleKind.ES6) { + writeLine(); + emitStart(node); + write("export default "); + var expression = node.expression; + emit(expression); + if (expression.kind !== 220 && + expression.kind !== 221) { + write(";"); + } + emitEnd(node); + } + else { + writeLine(); + emitStart(node); + if (modulekind === ts.ModuleKind.System) { + write(exportFunctionForFile + "(\"default\","); + emit(node.expression); + write(")"); + } + else { + emitEs6ExportDefaultCompat(node); + emitContainingModuleName(node); + if (languageVersion === 0) { + write('["default"] = '); + } + else { + write(".default = "); + } + emit(node.expression); + } + write(";"); + emitEnd(node); + } + } + } + function collectExternalModuleInfo(sourceFile) { + externalImports = []; + exportSpecifiers = {}; + exportEquals = undefined; + hasExportStarsToExportValues = false; + for (var _a = 0, _b = sourceFile.statements; _a < _b.length; _a++) { + var node = _b[_a]; + switch (node.kind) { + case 230: + if (!node.importClause || + resolver.isReferencedAliasDeclaration(node.importClause, true)) { + externalImports.push(node); + } + break; + case 229: + if (node.moduleReference.kind === 240 && resolver.isReferencedAliasDeclaration(node)) { + externalImports.push(node); + } + break; + case 236: + if (node.moduleSpecifier) { + if (!node.exportClause) { + if (resolver.moduleExportsSomeValue(node.moduleSpecifier)) { + externalImports.push(node); + hasExportStarsToExportValues = true; + } + } + else if (resolver.isValueAliasDeclaration(node)) { + externalImports.push(node); + } + } + else { + for (var _c = 0, _d = node.exportClause.elements; _c < _d.length; _c++) { + var specifier = _d[_c]; + var name_29 = (specifier.propertyName || specifier.name).text; + (exportSpecifiers[name_29] || (exportSpecifiers[name_29] = [])).push(specifier); + } + } + break; + case 235: + if (node.isExportEquals && !exportEquals) { + exportEquals = node; + } + break; + } + } + } + function emitExportStarHelper() { + if (hasExportStarsToExportValues) { + writeLine(); + write("function __export(m) {"); + increaseIndent(); + writeLine(); + write("for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];"); + decreaseIndent(); + writeLine(); + write("}"); + } + } + function getLocalNameForExternalImport(node) { + var namespaceDeclaration = getNamespaceDeclarationNode(node); + if (namespaceDeclaration && !isDefaultImport(node)) { + return ts.getTextOfNodeFromSourceText(currentText, namespaceDeclaration.name); + } + if (node.kind === 230 && node.importClause) { + return getGeneratedNameForNode(node); + } + if (node.kind === 236 && node.moduleSpecifier) { + return getGeneratedNameForNode(node); + } + } + function getExternalModuleNameText(importNode, emitRelativePathAsModuleName) { + if (emitRelativePathAsModuleName) { + var name_30 = getExternalModuleNameFromDeclaration(host, resolver, importNode); + if (name_30) { + return "\"" + name_30 + "\""; + } + } + var moduleName = ts.getExternalModuleName(importNode); + if (moduleName.kind === 9) { + return tryRenameExternalModule(moduleName) || getLiteralText(moduleName); + } + return undefined; + } + function emitVariableDeclarationsForImports() { + if (externalImports.length === 0) { + return; + } + writeLine(); + var started = false; + for (var _a = 0, externalImports_1 = externalImports; _a < externalImports_1.length; _a++) { + var importNode = externalImports_1[_a]; + var skipNode = importNode.kind === 236 || + (importNode.kind === 230 && !importNode.importClause); + if (skipNode) { + continue; + } + if (!started) { + write("var "); + started = true; + } + else { + write(", "); + } + write(getLocalNameForExternalImport(importNode)); + } + if (started) { + write(";"); + } + } + function emitLocalStorageForExportedNamesIfNecessary(exportedDeclarations) { + if (!hasExportStarsToExportValues) { + return undefined; + } + if (!exportedDeclarations && ts.isEmpty(exportSpecifiers)) { + var hasExportDeclarationWithExportClause = false; + for (var _a = 0, externalImports_2 = externalImports; _a < externalImports_2.length; _a++) { + var externalImport = externalImports_2[_a]; + if (externalImport.kind === 236 && externalImport.exportClause) { + hasExportDeclarationWithExportClause = true; + break; + } + } + if (!hasExportDeclarationWithExportClause) { + return emitExportStarFunction(undefined); + } + } + var exportedNamesStorageRef = makeUniqueName("exportedNames"); + writeLine(); + write("var " + exportedNamesStorageRef + " = {"); + increaseIndent(); + var started = false; + if (exportedDeclarations) { + for (var i = 0; i < exportedDeclarations.length; i++) { + writeExportedName(exportedDeclarations[i]); + } + } + if (exportSpecifiers) { + for (var n in exportSpecifiers) { + for (var _b = 0, _c = exportSpecifiers[n]; _b < _c.length; _b++) { + var specifier = _c[_b]; + writeExportedName(specifier.name); + } + } + } + for (var _d = 0, externalImports_3 = externalImports; _d < externalImports_3.length; _d++) { + var externalImport = externalImports_3[_d]; + if (externalImport.kind !== 236) { + continue; + } + var exportDecl = externalImport; + if (!exportDecl.exportClause) { + continue; + } + for (var _e = 0, _f = exportDecl.exportClause.elements; _e < _f.length; _e++) { + var element = _f[_e]; + writeExportedName(element.name || element.propertyName); + } + } + decreaseIndent(); + writeLine(); + write("};"); + return emitExportStarFunction(exportedNamesStorageRef); + function emitExportStarFunction(localNames) { + var exportStarFunction = makeUniqueName("exportStar"); + writeLine(); + write("function " + exportStarFunction + "(m) {"); + increaseIndent(); + writeLine(); + write("var exports = {};"); + writeLine(); + write("for(var n in m) {"); + increaseIndent(); + writeLine(); + write("if (n !== \"default\""); + if (localNames) { + write("&& !" + localNames + ".hasOwnProperty(n)"); + } + write(") exports[n] = m[n];"); + decreaseIndent(); + writeLine(); + write("}"); + writeLine(); + write(exportFunctionForFile + "(exports);"); + decreaseIndent(); + writeLine(); + write("}"); + return exportStarFunction; + } + function writeExportedName(node) { + if (node.kind !== 69 && node.flags & 512) { + return; + } + if (started) { + write(","); + } + else { + started = true; + } + writeLine(); + write("'"); + if (node.kind === 69) { + emitNodeWithCommentsAndWithoutSourcemap(node); + } + else { + emitDeclarationName(node); + } + write("': true"); + } + } + function processTopLevelVariableAndFunctionDeclarations(node) { + var hoistedVars; + var hoistedFunctionDeclarations; + var exportedDeclarations; + visit(node); + if (hoistedVars) { + writeLine(); + write("var "); + var seen = {}; + for (var i = 0; i < hoistedVars.length; i++) { + var local = hoistedVars[i]; + var name_31 = local.kind === 69 + ? local + : local.name; + if (name_31) { + var text = ts.unescapeIdentifier(name_31.text); + if (ts.hasProperty(seen, text)) { + continue; + } + else { + seen[text] = text; + } + } + if (i !== 0) { + write(", "); + } + if (local.kind === 221 || local.kind === 225 || local.kind === 224) { + emitDeclarationName(local); + } + else { + emit(local); + } + var flags = ts.getCombinedNodeFlags(local.kind === 69 ? local.parent : local); + if (flags & 1) { + if (!exportedDeclarations) { + exportedDeclarations = []; + } + exportedDeclarations.push(local); + } + } + write(";"); + } + if (hoistedFunctionDeclarations) { + for (var _a = 0, hoistedFunctionDeclarations_1 = hoistedFunctionDeclarations; _a < hoistedFunctionDeclarations_1.length; _a++) { + var f = hoistedFunctionDeclarations_1[_a]; + writeLine(); + emit(f); + if (f.flags & 1) { + if (!exportedDeclarations) { + exportedDeclarations = []; + } + exportedDeclarations.push(f); + } + } + } + return exportedDeclarations; + function visit(node) { + if (node.flags & 2) { + return; + } + if (node.kind === 220) { + if (!hoistedFunctionDeclarations) { + hoistedFunctionDeclarations = []; + } + hoistedFunctionDeclarations.push(node); + return; + } + if (node.kind === 221) { + if (!hoistedVars) { + hoistedVars = []; + } + hoistedVars.push(node); + return; + } + if (node.kind === 224) { + if (shouldEmitEnumDeclaration(node)) { + if (!hoistedVars) { + hoistedVars = []; + } + hoistedVars.push(node); + } + return; + } + if (node.kind === 225) { + if (shouldEmitModuleDeclaration(node)) { + if (!hoistedVars) { + hoistedVars = []; + } + hoistedVars.push(node); + } + return; + } + if (node.kind === 218 || node.kind === 169) { + if (shouldHoistVariable(node, false)) { + var name_32 = node.name; + if (name_32.kind === 69) { + if (!hoistedVars) { + hoistedVars = []; + } + hoistedVars.push(name_32); + } + else { + ts.forEachChild(name_32, visit); + } + } + return; + } + if (ts.isInternalModuleImportEqualsDeclaration(node) && resolver.isValueAliasDeclaration(node)) { + if (!hoistedVars) { + hoistedVars = []; + } + hoistedVars.push(node.name); + return; + } + if (ts.isBindingPattern(node)) { + ts.forEach(node.elements, visit); + return; + } + if (!ts.isDeclaration(node)) { + ts.forEachChild(node, visit); + } + } + } + function shouldHoistVariable(node, checkIfSourceFileLevelDecl) { + if (checkIfSourceFileLevelDecl && !shouldHoistDeclarationInSystemJsModule(node)) { + return false; + } + return (ts.getCombinedNodeFlags(node) & 3072) === 0 || + ts.getEnclosingBlockScopeContainer(node).kind === 256; + } + function isCurrentFileSystemExternalModule() { + return modulekind === ts.ModuleKind.System && isCurrentFileExternalModule; + } + function emitSystemModuleBody(node, dependencyGroups, startIndex) { + emitVariableDeclarationsForImports(); + writeLine(); + var exportedDeclarations = processTopLevelVariableAndFunctionDeclarations(node); + var exportStarFunction = emitLocalStorageForExportedNamesIfNecessary(exportedDeclarations); + writeLine(); + write("return {"); + increaseIndent(); + writeLine(); + emitSetters(exportStarFunction, dependencyGroups); + writeLine(); + emitExecute(node, startIndex); + decreaseIndent(); + writeLine(); + write("}"); + emitTempDeclarations(true); + } + function emitSetters(exportStarFunction, dependencyGroups) { + write("setters:["); + for (var i = 0; i < dependencyGroups.length; i++) { + if (i !== 0) { + write(","); + } + writeLine(); + increaseIndent(); + var group = dependencyGroups[i]; + var parameterName = makeUniqueName(ts.forEach(group, getLocalNameForExternalImport) || ""); + write("function (" + parameterName + ") {"); + increaseIndent(); + for (var _a = 0, group_1 = group; _a < group_1.length; _a++) { + var entry = group_1[_a]; + var importVariableName = getLocalNameForExternalImport(entry) || ""; + switch (entry.kind) { + case 230: + if (!entry.importClause) { + break; + } + case 229: + ts.Debug.assert(importVariableName !== ""); + writeLine(); + write(importVariableName + " = " + parameterName + ";"); + writeLine(); + break; + case 236: + ts.Debug.assert(importVariableName !== ""); + if (entry.exportClause) { + writeLine(); + write(exportFunctionForFile + "({"); + writeLine(); + increaseIndent(); + for (var i_1 = 0, len = entry.exportClause.elements.length; i_1 < len; i_1++) { + if (i_1 !== 0) { + write(","); + writeLine(); + } + var e = entry.exportClause.elements[i_1]; + write("\""); + emitNodeWithCommentsAndWithoutSourcemap(e.name); + write("\": " + parameterName + "[\""); + emitNodeWithCommentsAndWithoutSourcemap(e.propertyName || e.name); + write("\"]"); + } + decreaseIndent(); + writeLine(); + write("});"); + } + else { + writeLine(); + write(exportStarFunction + "(" + parameterName + ");"); + } + writeLine(); + break; + } + } + decreaseIndent(); + write("}"); + decreaseIndent(); + } + write("],"); + } + function emitExecute(node, startIndex) { + write("execute: function() {"); + increaseIndent(); + writeLine(); + for (var i = startIndex; i < node.statements.length; i++) { + var statement = node.statements[i]; + switch (statement.kind) { + case 220: + case 230: + continue; + case 236: + if (!statement.moduleSpecifier) { + for (var _a = 0, _b = statement.exportClause.elements; _a < _b.length; _a++) { + var element = _b[_a]; + emitExportSpecifierInSystemModule(element); + } + } + continue; + case 229: + if (!ts.isInternalModuleImportEqualsDeclaration(statement)) { + continue; + } + default: + writeLine(); + emit(statement); + } + } + decreaseIndent(); + writeLine(); + write("}"); + } + function writeModuleName(node, emitRelativePathAsModuleName) { + var moduleName = node.moduleName; + if (moduleName || (emitRelativePathAsModuleName && (moduleName = getResolvedExternalModuleName(host, node)))) { + write("\"" + moduleName + "\", "); + } + } + function emitSystemModule(node, emitRelativePathAsModuleName) { + collectExternalModuleInfo(node); + ts.Debug.assert(!exportFunctionForFile); + exportFunctionForFile = makeUniqueName("exports"); + contextObjectForFile = makeUniqueName("context"); + writeLine(); + write("System.register("); + writeModuleName(node, emitRelativePathAsModuleName); + write("["); + var groupIndices = {}; + var dependencyGroups = []; + for (var i = 0; i < externalImports.length; i++) { + var text = getExternalModuleNameText(externalImports[i], emitRelativePathAsModuleName); + if (text === undefined) { + continue; + } + var key = text.substr(1, text.length - 2); + if (ts.hasProperty(groupIndices, key)) { + var groupIndex = groupIndices[key]; + dependencyGroups[groupIndex].push(externalImports[i]); + continue; + } + else { + groupIndices[key] = dependencyGroups.length; + dependencyGroups.push([externalImports[i]]); + } + if (i !== 0) { + write(", "); + } + write(text); + } + write("], function(" + exportFunctionForFile + ", " + contextObjectForFile + ") {"); + writeLine(); + increaseIndent(); + var startIndex = emitDirectivePrologues(node.statements, true, !compilerOptions.noImplicitUseStrict); + writeLine(); + write("var __moduleName = " + contextObjectForFile + " && " + contextObjectForFile + ".id;"); + writeLine(); + emitEmitHelpers(node); + emitCaptureThisForNodeIfNecessary(node); + emitSystemModuleBody(node, dependencyGroups, startIndex); + decreaseIndent(); + writeLine(); + write("});"); + } + function getAMDDependencyNames(node, includeNonAmdDependencies, emitRelativePathAsModuleName) { + var aliasedModuleNames = []; + var unaliasedModuleNames = []; + var importAliasNames = []; + for (var _a = 0, _b = node.amdDependencies; _a < _b.length; _a++) { + var amdDependency = _b[_a]; + if (amdDependency.name) { + aliasedModuleNames.push('"' + amdDependency.path + '"'); + importAliasNames.push(amdDependency.name); + } + else { + unaliasedModuleNames.push('"' + amdDependency.path + '"'); + } + } + for (var _c = 0, externalImports_4 = externalImports; _c < externalImports_4.length; _c++) { + var importNode = externalImports_4[_c]; + var externalModuleName = getExternalModuleNameText(importNode, emitRelativePathAsModuleName); + var importAliasName = getLocalNameForExternalImport(importNode); + if (includeNonAmdDependencies && importAliasName) { + aliasedModuleNames.push(externalModuleName); + importAliasNames.push(importAliasName); + } + else { + unaliasedModuleNames.push(externalModuleName); + } + } + return { aliasedModuleNames: aliasedModuleNames, unaliasedModuleNames: unaliasedModuleNames, importAliasNames: importAliasNames }; + } + function emitAMDDependencies(node, includeNonAmdDependencies, emitRelativePathAsModuleName) { + var dependencyNames = getAMDDependencyNames(node, includeNonAmdDependencies, emitRelativePathAsModuleName); + emitAMDDependencyList(dependencyNames); + write(", "); + emitAMDFactoryHeader(dependencyNames); + } + function emitAMDDependencyList(_a) { + var aliasedModuleNames = _a.aliasedModuleNames, unaliasedModuleNames = _a.unaliasedModuleNames; + write('["require", "exports"'); + if (aliasedModuleNames.length) { + write(", "); + write(aliasedModuleNames.join(", ")); + } + if (unaliasedModuleNames.length) { + write(", "); + write(unaliasedModuleNames.join(", ")); + } + write("]"); + } + function emitAMDFactoryHeader(_a) { + var importAliasNames = _a.importAliasNames; + write("function (require, exports"); + if (importAliasNames.length) { + write(", "); + write(importAliasNames.join(", ")); + } + write(") {"); + } + function emitAMDModule(node, emitRelativePathAsModuleName) { + emitEmitHelpers(node); + collectExternalModuleInfo(node); + writeLine(); + write("define("); + writeModuleName(node, emitRelativePathAsModuleName); + emitAMDDependencies(node, true, emitRelativePathAsModuleName); + increaseIndent(); + var startIndex = emitDirectivePrologues(node.statements, true, !compilerOptions.noImplicitUseStrict); + emitExportStarHelper(); + emitCaptureThisForNodeIfNecessary(node); + emitLinesStartingAt(node.statements, startIndex); + emitExportEquals(true); + emitTempDeclarations(true); + decreaseIndent(); + writeLine(); + write("});"); + } + function emitCommonJSModule(node) { + var startIndex = emitDirectivePrologues(node.statements, false, !compilerOptions.noImplicitUseStrict); + emitEmitHelpers(node); + collectExternalModuleInfo(node); + emitExportStarHelper(); + emitCaptureThisForNodeIfNecessary(node); + emitLinesStartingAt(node.statements, startIndex); + emitExportEquals(false); + emitTempDeclarations(true); + } + function emitUMDModule(node) { + emitEmitHelpers(node); + collectExternalModuleInfo(node); + var dependencyNames = getAMDDependencyNames(node, false); + writeLines("(function (factory) {\n if (typeof module === 'object' && typeof module.exports === 'object') {\n var v = factory(require, exports); if (v !== undefined) module.exports = v;\n }\n else if (typeof define === 'function' && define.amd) {\n define("); + emitAMDDependencyList(dependencyNames); + write(", factory);"); + writeLines(" }\n})("); + emitAMDFactoryHeader(dependencyNames); + increaseIndent(); + var startIndex = emitDirectivePrologues(node.statements, true, !compilerOptions.noImplicitUseStrict); + emitExportStarHelper(); + emitCaptureThisForNodeIfNecessary(node); + emitLinesStartingAt(node.statements, startIndex); + emitExportEquals(true); + emitTempDeclarations(true); + decreaseIndent(); + writeLine(); + write("});"); + } + function emitES6Module(node) { + externalImports = undefined; + exportSpecifiers = undefined; + exportEquals = undefined; + hasExportStarsToExportValues = false; + var startIndex = emitDirectivePrologues(node.statements, false); + emitEmitHelpers(node); + emitCaptureThisForNodeIfNecessary(node); + emitLinesStartingAt(node.statements, startIndex); + emitTempDeclarations(true); + } + function emitExportEquals(emitAsReturn) { + if (exportEquals && resolver.isValueAliasDeclaration(exportEquals)) { + writeLine(); + emitStart(exportEquals); + write(emitAsReturn ? "return " : "module.exports = "); + emit(exportEquals.expression); + write(";"); + emitEnd(exportEquals); + } + } + function emitJsxElement(node) { + switch (compilerOptions.jsx) { + case 2: + jsxEmitReact(node); + break; + case 1: + default: + jsxEmitPreserve(node); + break; + } + } + function trimReactWhitespaceAndApplyEntities(node) { + var result = undefined; + var text = ts.getTextOfNode(node, true); + var firstNonWhitespace = 0; + var lastNonWhitespace = -1; + for (var i = 0; i < text.length; i++) { + var c = text.charCodeAt(i); + if (ts.isLineBreak(c)) { + if (firstNonWhitespace !== -1 && (lastNonWhitespace - firstNonWhitespace + 1 > 0)) { + var part = text.substr(firstNonWhitespace, lastNonWhitespace - firstNonWhitespace + 1); + result = (result ? result + "\" + ' ' + \"" : "") + ts.escapeString(part); + } + firstNonWhitespace = -1; + } + else if (!ts.isWhiteSpace(c)) { + lastNonWhitespace = i; + if (firstNonWhitespace === -1) { + firstNonWhitespace = i; + } + } + } + if (firstNonWhitespace !== -1) { + var part = text.substr(firstNonWhitespace); + result = (result ? result + "\" + ' ' + \"" : "") + ts.escapeString(part); + } + if (result) { + result = result.replace(/&(\w+);/g, function (s, m) { + if (entities[m] !== undefined) { + var ch = String.fromCharCode(entities[m]); + return ch === '"' ? "\\\"" : ch; + } + else { + return s; + } + }); + } + return result; + } + function isJsxChildEmittable(child) { + if (child.kind === 248) { + return !!child.expression; + } + else if (child.kind === 244) { + return !!getTextToEmit(child); + } + return true; + } + ; + function getTextToEmit(node) { + switch (compilerOptions.jsx) { + case 2: + var text = trimReactWhitespaceAndApplyEntities(node); + if (text === undefined || text.length === 0) { + return undefined; + } + else { + return text; + } + case 1: + default: + return ts.getTextOfNode(node, true); + } + } + function emitJsxText(node) { + switch (compilerOptions.jsx) { + case 2: + write('"'); + write(trimReactWhitespaceAndApplyEntities(node)); + write('"'); + break; + case 1: + default: + writer.writeLiteral(ts.getTextOfNode(node, true)); + break; + } + } + function emitJsxExpression(node) { + if (node.expression) { + switch (compilerOptions.jsx) { + case 1: + default: + write("{"); + emit(node.expression); + write("}"); + break; + case 2: + emit(node.expression); + break; + } + } + } + function isUseStrictPrologue(node) { + return node.expression.text === "use strict"; + } + function ensureUseStrictPrologue(startWithNewLine, writeUseStrict) { + if (writeUseStrict) { + if (startWithNewLine) { + writeLine(); + } + write("\"use strict\";"); + } + } + function emitDirectivePrologues(statements, startWithNewLine, ensureUseStrict) { + var foundUseStrict = false; + for (var i = 0; i < statements.length; i++) { + if (ts.isPrologueDirective(statements[i])) { + if (isUseStrictPrologue(statements[i])) { + foundUseStrict = true; + } + if (startWithNewLine || i > 0) { + writeLine(); + } + emit(statements[i]); + } + else { + ensureUseStrictPrologue(startWithNewLine || i > 0, !foundUseStrict && ensureUseStrict); + return i; + } + } + ensureUseStrictPrologue(startWithNewLine, !foundUseStrict && ensureUseStrict); + return statements.length; + } + function writeLines(text) { + var lines = text.split(/\r\n|\r|\n/g); + for (var i = 0; i < lines.length; i++) { + var line = lines[i]; + if (line.length) { + writeLine(); + write(line); + } + } + } + function emitEmitHelpers(node) { + if (!compilerOptions.noEmitHelpers) { + if (languageVersion < 2 && !extendsEmitted && node.flags & 262144) { + writeLines(extendsHelper); + extendsEmitted = true; + } + if (compilerOptions.jsx !== 1 && !assignEmitted && (node.flags & 1073741824)) { + writeLines(assignHelper); + assignEmitted = true; + } + if (!decorateEmitted && node.flags & 524288) { + writeLines(decorateHelper); + if (compilerOptions.emitDecoratorMetadata) { + writeLines(metadataHelper); + } + decorateEmitted = true; + } + if (!paramEmitted && node.flags & 1048576) { + writeLines(paramHelper); + paramEmitted = true; + } + if (!awaiterEmitted && node.flags & 2097152) { + writeLines(awaiterHelper); + awaiterEmitted = true; + } + } + } + function emitSourceFileNode(node) { + writeLine(); + emitShebang(); + emitDetachedCommentsAndUpdateCommentsInfo(node); + if (ts.isExternalModule(node) || compilerOptions.isolatedModules) { + if (isOwnFileEmit || (!ts.isExternalModule(node) && compilerOptions.isolatedModules)) { + var emitModule = moduleEmitDelegates[modulekind] || moduleEmitDelegates[ts.ModuleKind.CommonJS]; + emitModule(node); + } + else { + bundleEmitDelegates[modulekind](node, true); + } + } + else { + var startIndex = emitDirectivePrologues(node.statements, false); + externalImports = undefined; + exportSpecifiers = undefined; + exportEquals = undefined; + hasExportStarsToExportValues = false; + emitEmitHelpers(node); + emitCaptureThisForNodeIfNecessary(node); + emitLinesStartingAt(node.statements, startIndex); + emitTempDeclarations(true); + } + emitLeadingComments(node.endOfFileToken); + } + function emit(node) { + emitNodeConsideringCommentsOption(node, emitNodeWithSourceMap); + } + function emitNodeWithCommentsAndWithoutSourcemap(node) { + emitNodeConsideringCommentsOption(node, emitNodeWithoutSourceMap); + } + function emitNodeConsideringCommentsOption(node, emitNodeConsideringSourcemap) { + if (node) { + if (node.flags & 2) { + return emitCommentsOnNotEmittedNode(node); + } + if (isSpecializedCommentHandling(node)) { + return emitNodeWithoutSourceMap(node); + } + var emitComments_1 = shouldEmitLeadingAndTrailingComments(node); + if (emitComments_1) { + emitLeadingComments(node); + } + emitNodeConsideringSourcemap(node); + if (emitComments_1) { + emitTrailingComments(node); + } + } + } + function emitNodeWithSourceMap(node) { + if (node) { + emitStart(node); + emitNodeWithoutSourceMap(node); + emitEnd(node); + } + } + function emitNodeWithoutSourceMap(node) { + if (node) { + emitJavaScriptWorker(node); + } + } + function changeSourceMapEmit(writer) { + sourceMap = writer; + emitStart = writer.emitStart; + emitEnd = writer.emitEnd; + emitPos = writer.emitPos; + setSourceFile = writer.setSourceFile; + } + function withTemporaryNoSourceMap(callback) { + var prevSourceMap = sourceMap; + setSourceMapWriterEmit(ts.getNullSourceMapWriter()); + callback(); + setSourceMapWriterEmit(prevSourceMap); + } + function isSpecializedCommentHandling(node) { + switch (node.kind) { + case 222: + case 220: + case 230: + case 229: + case 223: + case 235: + return true; + } + } + function shouldEmitLeadingAndTrailingComments(node) { + switch (node.kind) { + case 200: + return shouldEmitLeadingAndTrailingCommentsForVariableStatement(node); + case 225: + return shouldEmitModuleDeclaration(node); + case 224: + return shouldEmitEnumDeclaration(node); + } + ts.Debug.assert(!isSpecializedCommentHandling(node)); + if (node.kind !== 199 && + node.parent && + node.parent.kind === 180 && + node.parent.body === node && + languageVersion <= 1) { + return false; + } + return true; + } + function emitJavaScriptWorker(node) { + switch (node.kind) { + case 69: + return emitIdentifier(node); + case 142: + return emitParameter(node); + case 147: + case 146: + return emitMethod(node); + case 149: + case 150: + return emitAccessor(node); + case 97: + return emitThis(node); + case 95: + return emitSuper(node); + case 93: + return write("null"); + case 99: + return write("true"); + case 84: + return write("false"); + case 8: + case 9: + case 10: + case 11: + case 12: + case 13: + case 14: + return emitLiteral(node); + case 189: + return emitTemplateExpression(node); + case 197: + return emitTemplateSpan(node); + case 241: + case 242: + return emitJsxElement(node); + case 244: + return emitJsxText(node); + case 248: + return emitJsxExpression(node); + case 139: + return emitQualifiedName(node); + case 167: + return emitObjectBindingPattern(node); + case 168: + return emitArrayBindingPattern(node); + case 169: + return emitBindingElement(node); + case 170: + return emitArrayLiteral(node); + case 171: + return emitObjectLiteral(node); + case 253: + return emitPropertyAssignment(node); + case 254: + return emitShorthandPropertyAssignment(node); + case 140: + return emitComputedPropertyName(node); + case 172: + return emitPropertyAccess(node); + case 173: + return emitIndexedAccess(node); + case 174: + return emitCallExpression(node); + case 175: + return emitNewExpression(node); + case 176: + return emitTaggedTemplateExpression(node); + case 177: + case 195: + case 196: + return emit(node.expression); + case 178: + return emitParenExpression(node); + case 220: + case 179: + case 180: + return emitFunctionDeclaration(node); + case 181: + return emitDeleteExpression(node); + case 182: + return emitTypeOfExpression(node); + case 183: + return emitVoidExpression(node); + case 184: + return emitAwaitExpression(node); + case 185: + return emitPrefixUnaryExpression(node); + case 186: + return emitPostfixUnaryExpression(node); + case 187: + return emitBinaryExpression(node); + case 188: + return emitConditionalExpression(node); + case 191: + return emitSpreadElementExpression(node); + case 190: + return emitYieldExpression(node); + case 193: + return; + case 199: + case 226: + return emitBlock(node); + case 200: + return emitVariableStatement(node); + case 201: + return write(";"); + case 202: + return emitExpressionStatement(node); + case 203: + return emitIfStatement(node); + case 204: + return emitDoStatement(node); + case 205: + return emitWhileStatement(node); + case 206: + return emitForStatement(node); + case 208: + case 207: + return emitForInOrForOfStatement(node); + case 209: + case 210: + return emitBreakOrContinueStatement(node); + case 211: + return emitReturnStatement(node); + case 212: + return emitWithStatement(node); + case 213: + return emitSwitchStatement(node); + case 249: + case 250: + return emitCaseOrDefaultClause(node); + case 214: + return emitLabeledStatement(node); + case 215: + return emitThrowStatement(node); + case 216: + return emitTryStatement(node); + case 252: + return emitCatchClause(node); + case 217: + return emitDebuggerStatement(node); + case 218: + return emitVariableDeclaration(node); + case 192: + return emitClassExpression(node); + case 221: + return emitClassDeclaration(node); + case 222: + return emitInterfaceDeclaration(node); + case 224: + return emitEnumDeclaration(node); + case 255: + return emitEnumMember(node); + case 225: + return emitModuleDeclaration(node); + case 230: + return emitImportDeclaration(node); + case 229: + return emitImportEqualsDeclaration(node); + case 236: + return emitExportDeclaration(node); + case 235: + return emitExportAssignment(node); + case 256: + return emitSourceFileNode(node); + } + } + function hasDetachedComments(pos) { + return detachedCommentsInfo !== undefined && ts.lastOrUndefined(detachedCommentsInfo).nodePos === pos; + } + function getLeadingCommentsWithoutDetachedComments() { + var leadingComments = ts.getLeadingCommentRanges(currentText, ts.lastOrUndefined(detachedCommentsInfo).detachedCommentEndPos); + if (detachedCommentsInfo.length - 1) { + detachedCommentsInfo.pop(); + } + else { + detachedCommentsInfo = undefined; + } + return leadingComments; + } + function isTripleSlashComment(comment) { + if (currentText.charCodeAt(comment.pos + 1) === 47 && + comment.pos + 2 < comment.end && + currentText.charCodeAt(comment.pos + 2) === 47) { + var textSubStr = currentText.substring(comment.pos, comment.end); + return textSubStr.match(ts.fullTripleSlashReferencePathRegEx) || + textSubStr.match(ts.fullTripleSlashAMDReferencePathRegEx) ? + true : false; + } + return false; + } + function getLeadingCommentsToEmit(node) { + if (node.parent) { + if (node.parent.kind === 256 || node.pos !== node.parent.pos) { + if (hasDetachedComments(node.pos)) { + return getLeadingCommentsWithoutDetachedComments(); + } + else { + return ts.getLeadingCommentRangesOfNodeFromText(node, currentText); + } + } + } + } + function getTrailingCommentsToEmit(node) { + if (node.parent) { + if (node.parent.kind === 256 || node.end !== node.parent.end) { + return ts.getTrailingCommentRanges(currentText, node.end); + } + } + } + function emitCommentsOnNotEmittedNode(node) { + emitLeadingCommentsWorker(node, false); + } + function emitLeadingComments(node) { + return emitLeadingCommentsWorker(node, true); + } + function emitLeadingCommentsWorker(node, isEmittedNode) { + if (compilerOptions.removeComments) { + return; + } + var leadingComments; + if (isEmittedNode) { + leadingComments = getLeadingCommentsToEmit(node); + } + else { + if (node.pos === 0) { + leadingComments = ts.filter(getLeadingCommentsToEmit(node), isTripleSlashComment); + } + } + ts.emitNewLineBeforeLeadingComments(currentLineMap, writer, node, leadingComments); + ts.emitComments(currentText, currentLineMap, writer, leadingComments, true, newLine, writeComment); + } + function emitTrailingComments(node) { + if (compilerOptions.removeComments) { + return; + } + var trailingComments = getTrailingCommentsToEmit(node); + ts.emitComments(currentText, currentLineMap, writer, trailingComments, false, newLine, writeComment); + } + function emitTrailingCommentsOfPosition(pos) { + if (compilerOptions.removeComments) { + return; + } + var trailingComments = ts.getTrailingCommentRanges(currentText, pos); + ts.emitComments(currentText, currentLineMap, writer, trailingComments, true, newLine, writeComment); + } + function emitLeadingCommentsOfPositionWorker(pos) { + if (compilerOptions.removeComments) { + return; + } + var leadingComments; + if (hasDetachedComments(pos)) { + leadingComments = getLeadingCommentsWithoutDetachedComments(); + } + else { + leadingComments = ts.getLeadingCommentRanges(currentText, pos); + } + ts.emitNewLineBeforeLeadingComments(currentLineMap, writer, { pos: pos, end: pos }, leadingComments); + ts.emitComments(currentText, currentLineMap, writer, leadingComments, true, newLine, writeComment); + } + function emitDetachedCommentsAndUpdateCommentsInfo(node) { + var currentDetachedCommentInfo = ts.emitDetachedComments(currentText, currentLineMap, writer, writeComment, node, newLine, compilerOptions.removeComments); + if (currentDetachedCommentInfo) { + if (detachedCommentsInfo) { + detachedCommentsInfo.push(currentDetachedCommentInfo); + } + else { + detachedCommentsInfo = [currentDetachedCommentInfo]; + } + } + } + function writeComment(text, lineMap, writer, comment, newLine) { + emitPos(comment.pos); + ts.writeCommentRange(text, lineMap, writer, comment, newLine); + emitPos(comment.end); + } + function emitShebang() { + var shebang = ts.getShebang(currentText); + if (shebang) { + write(shebang); + writeLine(); + } + } + var _a, _b; + } + function emitFile(_a, sourceFiles, isBundledEmit) { + var jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath; + if (!host.isEmitBlocked(jsFilePath) && !compilerOptions.noEmit) { + emitJavaScript(jsFilePath, sourceMapFilePath, sourceFiles, isBundledEmit); + } + else { + emitSkipped = true; + } + if (declarationFilePath) { + emitSkipped = ts.writeDeclarationFile(declarationFilePath, sourceFiles, isBundledEmit, host, resolver, emitterDiagnostics) || emitSkipped; + } + if (!emitSkipped && emittedFilesList) { + emittedFilesList.push(jsFilePath); + if (sourceMapFilePath) { + emittedFilesList.push(sourceMapFilePath); + } + if (declarationFilePath) { + emittedFilesList.push(declarationFilePath); + } + } + } + } + ts.emitFiles = emitFiles; +})(ts || (ts = {})); +var ts; +(function (ts) { + ts.programTime = 0; + ts.emitTime = 0; + ts.ioReadTime = 0; + ts.ioWriteTime = 0; + var emptyArray = []; + var defaultLibrarySearchPaths = [ + "types/", + "node_modules/", + "node_modules/@types/", + ]; + ts.version = "1.9.0"; + function findConfigFile(searchPath, fileExists) { + while (true) { + var fileName = ts.combinePaths(searchPath, "tsconfig.json"); + if (fileExists(fileName)) { + return fileName; + } + var parentPath = ts.getDirectoryPath(searchPath); + if (parentPath === searchPath) { + break; + } + searchPath = parentPath; + } + return undefined; + } + ts.findConfigFile = findConfigFile; + function resolveTripleslashReference(moduleName, containingFile) { + var basePath = ts.getDirectoryPath(containingFile); + var referencedFileName = ts.isRootedDiskPath(moduleName) ? moduleName : ts.combinePaths(basePath, moduleName); + return ts.normalizePath(referencedFileName); + } + ts.resolveTripleslashReference = resolveTripleslashReference; + function computeCommonSourceDirectoryOfFilenames(fileNames, currentDirectory, getCanonicalFileName) { + var commonPathComponents; + var failed = ts.forEach(fileNames, function (sourceFile) { + var sourcePathComponents = ts.getNormalizedPathComponents(sourceFile, currentDirectory); + sourcePathComponents.pop(); + if (!commonPathComponents) { + commonPathComponents = sourcePathComponents; + return; + } + for (var i = 0, n = Math.min(commonPathComponents.length, sourcePathComponents.length); i < n; i++) { + if (getCanonicalFileName(commonPathComponents[i]) !== getCanonicalFileName(sourcePathComponents[i])) { + if (i === 0) { + return true; + } + commonPathComponents.length = i; + break; + } + } + if (sourcePathComponents.length < commonPathComponents.length) { + commonPathComponents.length = sourcePathComponents.length; + } + }); + if (failed) { + return ""; + } + if (!commonPathComponents) { + return currentDirectory; + } + return ts.getNormalizedPathFromPathComponents(commonPathComponents); + } + ts.computeCommonSourceDirectoryOfFilenames = computeCommonSourceDirectoryOfFilenames; + function trace(host, message) { + host.trace(ts.formatMessage.apply(undefined, arguments)); + } + function isTraceEnabled(compilerOptions, host) { + return compilerOptions.traceResolution && host.trace !== undefined; + } + function hasZeroOrOneAsteriskCharacter(str) { + var seenAsterisk = false; + for (var i = 0; i < str.length; i++) { + if (str.charCodeAt(i) === 42) { + if (!seenAsterisk) { + seenAsterisk = true; + } + else { + return false; + } + } + } + return true; + } + function createResolvedModule(resolvedFileName, isExternalLibraryImport, failedLookupLocations) { + return { resolvedModule: resolvedFileName ? { resolvedFileName: resolvedFileName, isExternalLibraryImport: isExternalLibraryImport } : undefined, failedLookupLocations: failedLookupLocations }; + } + function moduleHasNonRelativeName(moduleName) { + if (ts.isRootedDiskPath(moduleName)) { + return false; + } + var i = moduleName.lastIndexOf("./", 1); + var startsWithDotSlashOrDotDotSlash = i === 0 || (i === 1 && moduleName.charCodeAt(0) === 46); + return !startsWithDotSlashOrDotDotSlash; + } + function tryReadTypesSection(packageJsonPath, baseDirectory, state) { + var jsonContent; + try { + var jsonText = state.host.readFile(packageJsonPath); + jsonContent = jsonText ? JSON.parse(jsonText) : {}; + } + catch (e) { + jsonContent = {}; + } + var typesFile; + var fieldName; + if (jsonContent.typings) { + if (typeof jsonContent.typings === "string") { + fieldName = "typings"; + typesFile = jsonContent.typings; + } + else { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Expected_type_of_0_field_in_package_json_to_be_string_got_1, "typings", typeof jsonContent.typings); + } + } + } + if (!typesFile && jsonContent.types) { + if (typeof jsonContent.types === "string") { + fieldName = "types"; + typesFile = jsonContent.types; + } + else { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Expected_type_of_0_field_in_package_json_to_be_string_got_1, "types", typeof jsonContent.types); + } + } + } + if (typesFile) { + var typesFilePath = ts.normalizePath(ts.combinePaths(baseDirectory, typesFile)); + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.package_json_has_0_field_1_that_references_2, fieldName, typesFile, typesFilePath); + } + return typesFilePath; + } + return undefined; + } + var typeReferenceExtensions = [".d.ts"]; + function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFile, options, host) { + var traceEnabled = isTraceEnabled(options, host); + var moduleResolutionState = { + compilerOptions: options, + host: host, + skipTsx: true, + traceEnabled: traceEnabled + }; + var rootDir = options.typesRoot || (options.configFilePath ? ts.getDirectoryPath(options.configFilePath) : undefined); + if (traceEnabled) { + if (containingFile === undefined) { + if (rootDir === undefined) { + trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set, typeReferenceDirectiveName); + } + else { + trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1, typeReferenceDirectiveName, rootDir); + } + } + else { + if (rootDir === undefined) { + trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set, typeReferenceDirectiveName, containingFile); + } + else { + trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_1_root_directory_2, typeReferenceDirectiveName, containingFile, rootDir); + } + } + } + var failedLookupLocations = []; + if (rootDir !== undefined) { + var effectivePrimarySearchPaths = options.typesSearchPaths || defaultLibrarySearchPaths; + for (var _i = 0, effectivePrimarySearchPaths_1 = effectivePrimarySearchPaths; _i < effectivePrimarySearchPaths_1.length; _i++) { + var searchPath = effectivePrimarySearchPaths_1[_i]; + var primaryPath = ts.combinePaths(rootDir, searchPath); + if (traceEnabled) { + trace(host, ts.Diagnostics.Resolving_with_primary_search_path_0, primaryPath); + } + var candidate = ts.combinePaths(primaryPath, typeReferenceDirectiveName); + var candidateDirectory = ts.getDirectoryPath(candidate); + var resolvedFile_1 = loadNodeModuleFromDirectory(typeReferenceExtensions, candidate, failedLookupLocations, !directoryProbablyExists(candidateDirectory, host), moduleResolutionState); + if (resolvedFile_1) { + if (traceEnabled) { + trace(host, ts.Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2, typeReferenceDirectiveName, resolvedFile_1, true); + } + return { + resolvedTypeReferenceDirective: { primary: true, resolvedFileName: resolvedFile_1 }, + failedLookupLocations: failedLookupLocations + }; + } + } + } + else { + if (traceEnabled) { + trace(host, ts.Diagnostics.Root_directory_cannot_be_determined_skipping_primary_search_paths); + } + } + var resolvedFile; + var initialLocationForSecondaryLookup; + if (containingFile) { + initialLocationForSecondaryLookup = ts.getDirectoryPath(containingFile); + } + else { + initialLocationForSecondaryLookup = rootDir; + } + if (initialLocationForSecondaryLookup !== undefined) { + if (traceEnabled) { + trace(host, ts.Diagnostics.Looking_up_in_node_modules_folder_initial_location_0, initialLocationForSecondaryLookup); + } + resolvedFile = loadModuleFromNodeModules(typeReferenceDirectiveName, initialLocationForSecondaryLookup, failedLookupLocations, moduleResolutionState); + if (traceEnabled) { + if (resolvedFile) { + trace(host, ts.Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2, typeReferenceDirectiveName, resolvedFile, false); + } + else { + trace(host, ts.Diagnostics.Type_reference_directive_0_was_not_resolved, typeReferenceDirectiveName); + } + } + } + else { + if (traceEnabled) { + trace(host, ts.Diagnostics.Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_modules_folder); + } + } + return { + resolvedTypeReferenceDirective: resolvedFile + ? { primary: false, resolvedFileName: resolvedFile } + : undefined, + failedLookupLocations: failedLookupLocations + }; + } + ts.resolveTypeReferenceDirective = resolveTypeReferenceDirective; + function resolveModuleName(moduleName, containingFile, compilerOptions, host) { + var traceEnabled = isTraceEnabled(compilerOptions, host); + if (traceEnabled) { + trace(host, ts.Diagnostics.Resolving_module_0_from_1, moduleName, containingFile); + } + var moduleResolution = compilerOptions.moduleResolution; + if (moduleResolution === undefined) { + moduleResolution = ts.getEmitModuleKind(compilerOptions) === ts.ModuleKind.CommonJS ? ts.ModuleResolutionKind.NodeJs : ts.ModuleResolutionKind.Classic; + if (traceEnabled) { + trace(host, ts.Diagnostics.Module_resolution_kind_is_not_specified_using_0, ts.ModuleResolutionKind[moduleResolution]); + } + } + else { + if (traceEnabled) { + trace(host, ts.Diagnostics.Explicitly_specified_module_resolution_kind_Colon_0, ts.ModuleResolutionKind[moduleResolution]); + } + } + var result; + switch (moduleResolution) { + case ts.ModuleResolutionKind.NodeJs: + result = nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host); + break; + case ts.ModuleResolutionKind.Classic: + result = classicNameResolver(moduleName, containingFile, compilerOptions, host); + break; + } + if (traceEnabled) { + if (result.resolvedModule) { + trace(host, ts.Diagnostics.Module_name_0_was_successfully_resolved_to_1, moduleName, result.resolvedModule.resolvedFileName); + } + else { + trace(host, ts.Diagnostics.Module_name_0_was_not_resolved, moduleName); + } + } + return result; + } + ts.resolveModuleName = resolveModuleName; + function tryLoadModuleUsingOptionalResolutionSettings(moduleName, containingDirectory, loader, failedLookupLocations, supportedExtensions, state) { + if (moduleHasNonRelativeName(moduleName)) { + return tryLoadModuleUsingBaseUrl(moduleName, loader, failedLookupLocations, supportedExtensions, state); + } + else { + return tryLoadModuleUsingRootDirs(moduleName, containingDirectory, loader, failedLookupLocations, supportedExtensions, state); + } + } + function tryLoadModuleUsingRootDirs(moduleName, containingDirectory, loader, failedLookupLocations, supportedExtensions, state) { + if (!state.compilerOptions.rootDirs) { + return undefined; + } + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0, moduleName); + } + var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); + var matchedRootDir; + var matchedNormalizedPrefix; + for (var _i = 0, _a = state.compilerOptions.rootDirs; _i < _a.length; _i++) { + var rootDir = _a[_i]; + var normalizedRoot = ts.normalizePath(rootDir); + if (!ts.endsWith(normalizedRoot, ts.directorySeparator)) { + normalizedRoot += ts.directorySeparator; + } + var isLongestMatchingPrefix = ts.startsWith(candidate, normalizedRoot) && + (matchedNormalizedPrefix === undefined || matchedNormalizedPrefix.length < normalizedRoot.length); + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Checking_if_0_is_the_longest_matching_prefix_for_1_2, normalizedRoot, candidate, isLongestMatchingPrefix); + } + if (isLongestMatchingPrefix) { + matchedNormalizedPrefix = normalizedRoot; + matchedRootDir = rootDir; + } + } + if (matchedNormalizedPrefix) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Longest_matching_prefix_for_0_is_1, candidate, matchedNormalizedPrefix); + } + var suffix = candidate.substr(matchedNormalizedPrefix.length); + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Loading_0_from_the_root_dir_1_candidate_location_2, suffix, matchedNormalizedPrefix, candidate); + } + var resolvedFileName = loader(candidate, supportedExtensions, failedLookupLocations, !directoryProbablyExists(containingDirectory, state.host), state); + if (resolvedFileName) { + return resolvedFileName; + } + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Trying_other_entries_in_rootDirs); + } + for (var _b = 0, _c = state.compilerOptions.rootDirs; _b < _c.length; _b++) { + var rootDir = _c[_b]; + if (rootDir === matchedRootDir) { + continue; + } + var candidate_1 = ts.combinePaths(ts.normalizePath(rootDir), suffix); + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Loading_0_from_the_root_dir_1_candidate_location_2, suffix, rootDir, candidate_1); + } + var baseDirectory = ts.getDirectoryPath(candidate_1); + var resolvedFileName_1 = loader(candidate_1, supportedExtensions, failedLookupLocations, !directoryProbablyExists(baseDirectory, state.host), state); + if (resolvedFileName_1) { + return resolvedFileName_1; + } + } + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Module_resolution_using_rootDirs_has_failed); + } + } + return undefined; + } + function tryLoadModuleUsingBaseUrl(moduleName, loader, failedLookupLocations, supportedExtensions, state) { + if (!state.compilerOptions.baseUrl) { + return undefined; + } + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1, state.compilerOptions.baseUrl, moduleName); + } + var longestMatchPrefixLength = -1; + var matchedPattern; + var matchedStar; + if (state.compilerOptions.paths) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.paths_option_is_specified_looking_for_a_pattern_to_match_module_name_0, moduleName); + } + for (var key in state.compilerOptions.paths) { + var pattern = key; + var indexOfStar = pattern.indexOf("*"); + if (indexOfStar !== -1) { + var prefix = pattern.substr(0, indexOfStar); + var suffix = pattern.substr(indexOfStar + 1); + if (moduleName.length >= prefix.length + suffix.length && + ts.startsWith(moduleName, prefix) && + ts.endsWith(moduleName, suffix)) { + if (prefix.length > longestMatchPrefixLength) { + longestMatchPrefixLength = prefix.length; + matchedPattern = pattern; + matchedStar = moduleName.substr(prefix.length, moduleName.length - suffix.length); + } + } + } + else if (pattern === moduleName) { + matchedPattern = pattern; + matchedStar = undefined; + break; + } + } + } + if (matchedPattern) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Module_name_0_matched_pattern_1, moduleName, matchedPattern); + } + for (var _i = 0, _a = state.compilerOptions.paths[matchedPattern]; _i < _a.length; _i++) { + var subst = _a[_i]; + var path = matchedStar ? subst.replace("\*", matchedStar) : subst; + var candidate = ts.normalizePath(ts.combinePaths(state.compilerOptions.baseUrl, path)); + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Trying_substitution_0_candidate_module_location_Colon_1, subst, path); + } + var resolvedFileName = loader(candidate, supportedExtensions, failedLookupLocations, !directoryProbablyExists(ts.getDirectoryPath(candidate), state.host), state); + if (resolvedFileName) { + return resolvedFileName; + } + } + return undefined; + } + else { + var candidate = ts.normalizePath(ts.combinePaths(state.compilerOptions.baseUrl, moduleName)); + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Resolving_module_name_0_relative_to_base_url_1_2, moduleName, state.compilerOptions.baseUrl, candidate); + } + return loader(candidate, supportedExtensions, failedLookupLocations, !directoryProbablyExists(ts.getDirectoryPath(candidate), state.host), state); + } + } + function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host) { + var containingDirectory = ts.getDirectoryPath(containingFile); + var supportedExtensions = ts.getSupportedExtensions(compilerOptions); + var traceEnabled = isTraceEnabled(compilerOptions, host); + var failedLookupLocations = []; + var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled, skipTsx: false }; + var resolvedFileName = tryLoadModuleUsingOptionalResolutionSettings(moduleName, containingDirectory, nodeLoadModuleByRelativeName, failedLookupLocations, supportedExtensions, state); + var isExternalLibraryImport = false; + if (!resolvedFileName) { + if (moduleHasNonRelativeName(moduleName)) { + if (traceEnabled) { + trace(host, ts.Diagnostics.Loading_module_0_from_node_modules_folder, moduleName); + } + resolvedFileName = loadModuleFromNodeModules(moduleName, containingDirectory, failedLookupLocations, state); + isExternalLibraryImport = resolvedFileName !== undefined; + } + else { + var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); + resolvedFileName = nodeLoadModuleByRelativeName(candidate, supportedExtensions, failedLookupLocations, false, state); + } + } + if (resolvedFileName && host.realpath) { + var originalFileName = resolvedFileName; + resolvedFileName = ts.normalizePath(host.realpath(resolvedFileName)); + if (traceEnabled) { + trace(host, ts.Diagnostics.Resolving_real_path_for_0_result_1, originalFileName, resolvedFileName); + } + } + return createResolvedModule(resolvedFileName, isExternalLibraryImport, failedLookupLocations); + } + ts.nodeModuleNameResolver = nodeModuleNameResolver; + function nodeLoadModuleByRelativeName(candidate, supportedExtensions, failedLookupLocations, onlyRecordFailures, state) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Loading_module_as_file_Slash_folder_candidate_module_location_0, candidate); + } + var resolvedFileName = loadModuleFromFile(candidate, supportedExtensions, failedLookupLocations, onlyRecordFailures, state); + return resolvedFileName || loadNodeModuleFromDirectory(supportedExtensions, candidate, failedLookupLocations, onlyRecordFailures, state); + } + function directoryProbablyExists(directoryName, host) { + return !host.directoryExists || host.directoryExists(directoryName); + } + ts.directoryProbablyExists = directoryProbablyExists; + function loadModuleFromFile(candidate, extensions, failedLookupLocation, onlyRecordFailures, state) { + if (!onlyRecordFailures) { + var directory = ts.getDirectoryPath(candidate); + if (directory) { + onlyRecordFailures = !directoryProbablyExists(directory, state.host); + } + } + return ts.forEach(extensions, tryLoad); + function tryLoad(ext) { + if (ext === ".tsx" && state.skipTsx) { + return undefined; + } + var fileName = ts.fileExtensionIs(candidate, ext) ? candidate : candidate + ext; + if (!onlyRecordFailures && state.host.fileExists(fileName)) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.File_0_exist_use_it_as_a_name_resolution_result, fileName); + } + return fileName; + } + else { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.File_0_does_not_exist, fileName); + } + failedLookupLocation.push(fileName); + return undefined; + } + } + } + function loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocation, onlyRecordFailures, state) { + var packageJsonPath = ts.combinePaths(candidate, "package.json"); + var directoryExists = !onlyRecordFailures && directoryProbablyExists(candidate, state.host); + if (directoryExists && state.host.fileExists(packageJsonPath)) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Found_package_json_at_0, packageJsonPath); + } + var typesFile = tryReadTypesSection(packageJsonPath, candidate, state); + if (typesFile) { + var result = loadModuleFromFile(typesFile, extensions, failedLookupLocation, !directoryProbablyExists(ts.getDirectoryPath(typesFile), state.host), state); + if (result) { + return result; + } + } + else { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.package_json_does_not_have_types_field); + } + } + } + else { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.File_0_does_not_exist, packageJsonPath); + } + failedLookupLocation.push(packageJsonPath); + } + return loadModuleFromFile(ts.combinePaths(candidate, "index"), extensions, failedLookupLocation, !directoryExists, state); + } + function loadModuleFromNodeModulesFolder(moduleName, directory, failedLookupLocations, state) { + var nodeModulesFolder = ts.combinePaths(directory, "node_modules"); + var nodeModulesFolderExists = directoryProbablyExists(nodeModulesFolder, state.host); + var candidate = ts.normalizePath(ts.combinePaths(nodeModulesFolder, moduleName)); + var result = loadModuleFromFile(candidate, ts.supportedTypeScriptExtensions, failedLookupLocations, !nodeModulesFolderExists, state); + if (result) { + return result; + } + result = loadNodeModuleFromDirectory(ts.supportedTypeScriptExtensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state); + if (result) { + return result; + } + } + function loadModuleFromNodeModules(moduleName, directory, failedLookupLocations, state) { + directory = ts.normalizeSlashes(directory); + while (true) { + var baseName = ts.getBaseFileName(directory); + if (baseName !== "node_modules") { + var result = loadModuleFromNodeModulesFolder(moduleName, directory, failedLookupLocations, state) || + loadModuleFromNodeModulesFolder(ts.combinePaths("@types", moduleName), directory, failedLookupLocations, state); + if (result) { + return result; + } + } + var parentPath = ts.getDirectoryPath(directory); + if (parentPath === directory) { + break; + } + directory = parentPath; + } + return undefined; + } + function classicNameResolver(moduleName, containingFile, compilerOptions, host) { + var traceEnabled = isTraceEnabled(compilerOptions, host); + var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled, skipTsx: !compilerOptions.jsx }; + var failedLookupLocations = []; + var supportedExtensions = ts.getSupportedExtensions(compilerOptions); + var containingDirectory = ts.getDirectoryPath(containingFile); + var resolvedFileName = tryLoadModuleUsingOptionalResolutionSettings(moduleName, containingDirectory, loadModuleFromFile, failedLookupLocations, supportedExtensions, state); + if (resolvedFileName) { + return createResolvedModule(resolvedFileName, false, failedLookupLocations); + } + var referencedSourceFile; + if (moduleHasNonRelativeName(moduleName)) { + while (true) { + var searchName = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); + referencedSourceFile = loadModuleFromFile(searchName, supportedExtensions, failedLookupLocations, false, state); + if (referencedSourceFile) { + break; + } + var parentPath = ts.getDirectoryPath(containingDirectory); + if (parentPath === containingDirectory) { + break; + } + containingDirectory = parentPath; + } + } + else { + var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); + referencedSourceFile = loadModuleFromFile(candidate, supportedExtensions, failedLookupLocations, false, state); + } + return referencedSourceFile + ? { resolvedModule: { resolvedFileName: referencedSourceFile }, failedLookupLocations: failedLookupLocations } + : { resolvedModule: undefined, failedLookupLocations: failedLookupLocations }; + } + ts.classicNameResolver = classicNameResolver; + ts.defaultInitCompilerOptions = { + module: ts.ModuleKind.CommonJS, + target: 1, + noImplicitAny: false, + sourceMap: false + }; + function createCompilerHost(options, setParentNodes) { + var existingDirectories = {}; + function getCanonicalFileName(fileName) { + return ts.sys.useCaseSensitiveFileNames ? fileName : fileName.toLowerCase(); + } + var unsupportedFileEncodingErrorCode = -2147024809; + function getSourceFile(fileName, languageVersion, onError) { + var text; + try { + var start = new Date().getTime(); + text = ts.sys.readFile(fileName, options.charset); + ts.ioReadTime += new Date().getTime() - start; + } + catch (e) { + if (onError) { + onError(e.number === unsupportedFileEncodingErrorCode + ? ts.createCompilerDiagnostic(ts.Diagnostics.Unsupported_file_encoding).messageText + : e.message); + } + text = ""; + } + return text !== undefined ? ts.createSourceFile(fileName, text, languageVersion, setParentNodes) : undefined; + } + function directoryExists(directoryPath) { + if (ts.hasProperty(existingDirectories, directoryPath)) { + return true; + } + if (ts.sys.directoryExists(directoryPath)) { + existingDirectories[directoryPath] = true; + return true; + } + return false; + } + function ensureDirectoriesExist(directoryPath) { + if (directoryPath.length > ts.getRootLength(directoryPath) && !directoryExists(directoryPath)) { + var parentDirectory = ts.getDirectoryPath(directoryPath); + ensureDirectoriesExist(parentDirectory); + ts.sys.createDirectory(directoryPath); + } + } + var outputFingerprints; + function writeFileIfUpdated(fileName, data, writeByteOrderMark) { + if (!outputFingerprints) { + outputFingerprints = {}; + } + var hash = ts.sys.createHash(data); + var mtimeBefore = ts.sys.getModifiedTime(fileName); + if (mtimeBefore && ts.hasProperty(outputFingerprints, fileName)) { + var fingerprint = outputFingerprints[fileName]; + if (fingerprint.byteOrderMark === writeByteOrderMark && + fingerprint.hash === hash && + fingerprint.mtime.getTime() === mtimeBefore.getTime()) { + return; + } + } + ts.sys.writeFile(fileName, data, writeByteOrderMark); + var mtimeAfter = ts.sys.getModifiedTime(fileName); + outputFingerprints[fileName] = { + hash: hash, + byteOrderMark: writeByteOrderMark, + mtime: mtimeAfter + }; + } + function writeFile(fileName, data, writeByteOrderMark, onError) { + try { + var start = new Date().getTime(); + ensureDirectoriesExist(ts.getDirectoryPath(ts.normalizePath(fileName))); + if (ts.isWatchSet(options) && ts.sys.createHash && ts.sys.getModifiedTime) { + writeFileIfUpdated(fileName, data, writeByteOrderMark); + } + else { + ts.sys.writeFile(fileName, data, writeByteOrderMark); + } + ts.ioWriteTime += new Date().getTime() - start; + } + catch (e) { + if (onError) { + onError(e.message); + } + } + } + function getDefaultLibLocation() { + return ts.getDirectoryPath(ts.normalizePath(ts.sys.getExecutingFilePath())); + } + var newLine = ts.getNewLineCharacter(options); + var realpath = ts.sys.realpath && (function (path) { return ts.sys.realpath(path); }); + return { + getSourceFile: getSourceFile, + getDefaultLibLocation: getDefaultLibLocation, + getDefaultLibFileName: function (options) { return ts.combinePaths(getDefaultLibLocation(), ts.getDefaultLibFileName(options)); }, + writeFile: writeFile, + getCurrentDirectory: ts.memoize(function () { return ts.sys.getCurrentDirectory(); }), + useCaseSensitiveFileNames: function () { return ts.sys.useCaseSensitiveFileNames; }, + getCanonicalFileName: getCanonicalFileName, + getNewLine: function () { return newLine; }, + fileExists: function (fileName) { return ts.sys.fileExists(fileName); }, + readFile: function (fileName) { return ts.sys.readFile(fileName); }, + trace: function (s) { return ts.sys.write(s + newLine); }, + directoryExists: function (directoryName) { return ts.sys.directoryExists(directoryName); }, + realpath: realpath + }; + } + ts.createCompilerHost = createCompilerHost; + function getPreEmitDiagnostics(program, sourceFile, cancellationToken) { + var diagnostics = program.getOptionsDiagnostics(cancellationToken).concat(program.getSyntacticDiagnostics(sourceFile, cancellationToken), program.getGlobalDiagnostics(cancellationToken), program.getSemanticDiagnostics(sourceFile, cancellationToken)); + if (program.getCompilerOptions().declaration) { + diagnostics = diagnostics.concat(program.getDeclarationDiagnostics(sourceFile, cancellationToken)); + } + return ts.sortAndDeduplicateDiagnostics(diagnostics); + } + ts.getPreEmitDiagnostics = getPreEmitDiagnostics; + function flattenDiagnosticMessageText(messageText, newLine) { + if (typeof messageText === "string") { + return messageText; + } + else { + var diagnosticChain = messageText; + var result = ""; + var indent = 0; + while (diagnosticChain) { + if (indent) { + result += newLine; + for (var i = 0; i < indent; i++) { + result += " "; + } + } + result += diagnosticChain.messageText; + indent++; + diagnosticChain = diagnosticChain.next; + } + return result; + } + } + ts.flattenDiagnosticMessageText = flattenDiagnosticMessageText; + function loadWithLocalCache(names, containingFile, loader) { + if (names.length === 0) { + return []; + } + var resolutions = []; + var cache = {}; + for (var _i = 0, names_1 = names; _i < names_1.length; _i++) { + var name_33 = names_1[_i]; + var result = void 0; + if (ts.hasProperty(cache, name_33)) { + result = cache[name_33]; + } + else { + result = loader(name_33, containingFile); + cache[name_33] = result; + } + resolutions.push(result); + } + return resolutions; + } + function createProgram(rootNames, options, host, oldProgram) { + var program; + var files = []; + var commonSourceDirectory; + var diagnosticsProducingTypeChecker; + var noDiagnosticsTypeChecker; + var classifiableNames; + var resolvedTypeReferenceDirectives = {}; + var fileProcessingDiagnostics = ts.createDiagnosticCollection(); + var start = new Date().getTime(); + host = host || createCompilerHost(options); + var skipDefaultLib = options.noLib; + var programDiagnostics = ts.createDiagnosticCollection(); + var currentDirectory = host.getCurrentDirectory(); + var supportedExtensions = ts.getSupportedExtensions(options); + var hasEmitBlockingDiagnostics = ts.createFileMap(getCanonicalFileName); + var resolveModuleNamesWorker; + if (host.resolveModuleNames) { + resolveModuleNamesWorker = function (moduleNames, containingFile) { return host.resolveModuleNames(moduleNames, containingFile); }; + } + else { + var loader_1 = function (moduleName, containingFile) { return resolveModuleName(moduleName, containingFile, options, host).resolvedModule; }; + resolveModuleNamesWorker = function (moduleNames, containingFile) { return loadWithLocalCache(moduleNames, containingFile, loader_1); }; + } + var resolveTypeReferenceDirectiveNamesWorker; + if (host.resolveTypeReferenceDirectives) { + resolveTypeReferenceDirectiveNamesWorker = function (typeDirectiveNames, containingFile) { return host.resolveTypeReferenceDirectives(typeDirectiveNames, containingFile); }; + } + else { + var loader_2 = function (typesRef, containingFile) { return resolveTypeReferenceDirective(typesRef, containingFile, options, host).resolvedTypeReferenceDirective; }; + resolveTypeReferenceDirectiveNamesWorker = function (typeReferenceDirectiveNames, containingFile) { return loadWithLocalCache(typeReferenceDirectiveNames, containingFile, loader_2); }; + } + var filesByName = ts.createFileMap(); + var filesByNameIgnoreCase = host.useCaseSensitiveFileNames() ? ts.createFileMap(function (fileName) { return fileName.toLowerCase(); }) : undefined; + if (!tryReuseStructureFromOldProgram()) { + if (options.types && options.types.length) { + var resolutions = resolveTypeReferenceDirectiveNamesWorker(options.types, undefined); + for (var i = 0; i < options.types.length; i++) { + processTypeReferenceDirective(options.types[i], resolutions[i]); + } + } + ts.forEach(rootNames, function (name) { return processRootFile(name, false); }); + if (!skipDefaultLib) { + if (!options.lib) { + processRootFile(host.getDefaultLibFileName(options), true); + } + else { + var libDirectory_1 = host.getDefaultLibLocation ? host.getDefaultLibLocation() : ts.getDirectoryPath(host.getDefaultLibFileName(options)); + ts.forEach(options.lib, function (libFileName) { + processRootFile(ts.combinePaths(libDirectory_1, libFileName), true); + }); + } + } + } + oldProgram = undefined; + program = { + getRootFileNames: function () { return rootNames; }, + getSourceFile: getSourceFile, + getSourceFileByPath: getSourceFileByPath, + getSourceFiles: function () { return files; }, + getCompilerOptions: function () { return options; }, + getSyntacticDiagnostics: getSyntacticDiagnostics, + getOptionsDiagnostics: getOptionsDiagnostics, + getGlobalDiagnostics: getGlobalDiagnostics, + getSemanticDiagnostics: getSemanticDiagnostics, + getDeclarationDiagnostics: getDeclarationDiagnostics, + getTypeChecker: getTypeChecker, + getClassifiableNames: getClassifiableNames, + getDiagnosticsProducingTypeChecker: getDiagnosticsProducingTypeChecker, + getCommonSourceDirectory: getCommonSourceDirectory, + emit: emit, + getCurrentDirectory: function () { return currentDirectory; }, + getNodeCount: function () { return getDiagnosticsProducingTypeChecker().getNodeCount(); }, + getIdentifierCount: function () { return getDiagnosticsProducingTypeChecker().getIdentifierCount(); }, + getSymbolCount: function () { return getDiagnosticsProducingTypeChecker().getSymbolCount(); }, + getTypeCount: function () { return getDiagnosticsProducingTypeChecker().getTypeCount(); }, + getFileProcessingDiagnostics: function () { return fileProcessingDiagnostics; }, + getResolvedTypeReferenceDirectives: function () { return resolvedTypeReferenceDirectives; } + }; + verifyCompilerOptions(); + ts.programTime += new Date().getTime() - start; + return program; + function getCommonSourceDirectory() { + if (typeof commonSourceDirectory === "undefined") { + if (options.rootDir && checkSourceFilesBelongToPath(files, options.rootDir)) { + commonSourceDirectory = ts.getNormalizedAbsolutePath(options.rootDir, currentDirectory); + } + else { + commonSourceDirectory = computeCommonSourceDirectory(files); + } + if (commonSourceDirectory && commonSourceDirectory[commonSourceDirectory.length - 1] !== ts.directorySeparator) { + commonSourceDirectory += ts.directorySeparator; + } + } + return commonSourceDirectory; + } + function getClassifiableNames() { + if (!classifiableNames) { + getTypeChecker(); + classifiableNames = {}; + for (var _i = 0, files_3 = files; _i < files_3.length; _i++) { + var sourceFile = files_3[_i]; + ts.copyMap(sourceFile.classifiableNames, classifiableNames); + } + } + return classifiableNames; + } + function tryReuseStructureFromOldProgram() { + if (!oldProgram) { + return false; + } + var oldOptions = oldProgram.getCompilerOptions(); + if ((oldOptions.module !== options.module) || + (oldOptions.noResolve !== options.noResolve) || + (oldOptions.target !== options.target) || + (oldOptions.noLib !== options.noLib) || + (oldOptions.jsx !== options.jsx) || + (oldOptions.allowJs !== options.allowJs) || + (oldOptions.rootDir !== options.rootDir) || + (oldOptions.typesSearchPaths !== options.typesSearchPaths) || + (oldOptions.configFilePath !== options.configFilePath) || + (oldOptions.baseUrl !== options.baseUrl) || + (oldOptions.typesRoot !== options.typesRoot) || + !ts.arrayIsEqualTo(oldOptions.rootDirs, options.rootDirs) || + !ts.mapIsEqualTo(oldOptions.paths, options.paths)) { + return false; + } + ts.Debug.assert(!oldProgram.structureIsReused); + var oldRootNames = oldProgram.getRootFileNames(); + if (!ts.arrayIsEqualTo(oldRootNames, rootNames)) { + return false; + } + if (!ts.arrayIsEqualTo(options.types, oldOptions.types)) { + return false; + } + var newSourceFiles = []; + var filePaths = []; + var modifiedSourceFiles = []; + for (var _i = 0, _a = oldProgram.getSourceFiles(); _i < _a.length; _i++) { + var oldSourceFile = _a[_i]; + var newSourceFile = host.getSourceFileByPath + ? host.getSourceFileByPath(oldSourceFile.fileName, oldSourceFile.path, options.target) + : host.getSourceFile(oldSourceFile.fileName, options.target); + if (!newSourceFile) { + return false; + } + newSourceFile.path = oldSourceFile.path; + filePaths.push(newSourceFile.path); + if (oldSourceFile !== newSourceFile) { + if (oldSourceFile.hasNoDefaultLib !== newSourceFile.hasNoDefaultLib) { + return false; + } + if (!ts.arrayIsEqualTo(oldSourceFile.referencedFiles, newSourceFile.referencedFiles, fileReferenceIsEqualTo)) { + return false; + } + collectExternalModuleReferences(newSourceFile); + if (!ts.arrayIsEqualTo(oldSourceFile.imports, newSourceFile.imports, moduleNameIsEqualTo)) { + return false; + } + if (!ts.arrayIsEqualTo(oldSourceFile.moduleAugmentations, newSourceFile.moduleAugmentations, moduleNameIsEqualTo)) { + return false; + } + if (!ts.arrayIsEqualTo(oldSourceFile.typeReferenceDirectives, newSourceFile.typeReferenceDirectives, fileReferenceIsEqualTo)) { + return false; + } + var newSourceFilePath = ts.getNormalizedAbsolutePath(newSourceFile.fileName, currentDirectory); + if (resolveModuleNamesWorker) { + var moduleNames = ts.map(ts.concatenate(newSourceFile.imports, newSourceFile.moduleAugmentations), getTextOfLiteral); + var resolutions = resolveModuleNamesWorker(moduleNames, newSourceFilePath); + var resolutionsChanged = ts.hasChangesInResolutions(moduleNames, resolutions, oldSourceFile.resolvedModules, ts.moduleResolutionIsEqualTo); + if (resolutionsChanged) { + return false; + } + } + if (resolveTypeReferenceDirectiveNamesWorker) { + var typesReferenceDirectives = ts.map(newSourceFile.typeReferenceDirectives, function (x) { return x.fileName; }); + var resolutions = resolveTypeReferenceDirectiveNamesWorker(typesReferenceDirectives, newSourceFilePath); + var resolutionsChanged = ts.hasChangesInResolutions(typesReferenceDirectives, resolutions, oldSourceFile.resolvedTypeReferenceDirectiveNames, ts.typeDirectiveIsEqualTo); + if (resolutionsChanged) { + return false; + } + } + newSourceFile.resolvedModules = oldSourceFile.resolvedModules; + newSourceFile.resolvedTypeReferenceDirectiveNames = oldSourceFile.resolvedTypeReferenceDirectiveNames; + modifiedSourceFiles.push(newSourceFile); + } + else { + newSourceFile = oldSourceFile; + } + newSourceFiles.push(newSourceFile); + } + for (var i = 0, len = newSourceFiles.length; i < len; i++) { + filesByName.set(filePaths[i], newSourceFiles[i]); + } + files = newSourceFiles; + fileProcessingDiagnostics = oldProgram.getFileProcessingDiagnostics(); + for (var _b = 0, modifiedSourceFiles_1 = modifiedSourceFiles; _b < modifiedSourceFiles_1.length; _b++) { + var modifiedFile = modifiedSourceFiles_1[_b]; + fileProcessingDiagnostics.reattachFileDiagnostics(modifiedFile); + } + resolvedTypeReferenceDirectives = oldProgram.getResolvedTypeReferenceDirectives(); + oldProgram.structureIsReused = true; + return true; + } + function getEmitHost(writeFileCallback) { + return { + getCanonicalFileName: getCanonicalFileName, + getCommonSourceDirectory: program.getCommonSourceDirectory, + getCompilerOptions: program.getCompilerOptions, + getCurrentDirectory: function () { return currentDirectory; }, + getNewLine: function () { return host.getNewLine(); }, + getSourceFile: program.getSourceFile, + getSourceFileByPath: program.getSourceFileByPath, + getSourceFiles: program.getSourceFiles, + writeFile: writeFileCallback || (function (fileName, data, writeByteOrderMark, onError, sourceFiles) { return host.writeFile(fileName, data, writeByteOrderMark, onError, sourceFiles); }), + isEmitBlocked: isEmitBlocked + }; + } + function getDiagnosticsProducingTypeChecker() { + return diagnosticsProducingTypeChecker || (diagnosticsProducingTypeChecker = ts.createTypeChecker(program, true)); + } + function getTypeChecker() { + return noDiagnosticsTypeChecker || (noDiagnosticsTypeChecker = ts.createTypeChecker(program, false)); + } + function emit(sourceFile, writeFileCallback, cancellationToken) { + var _this = this; + return runWithCancellationToken(function () { return emitWorker(_this, sourceFile, writeFileCallback, cancellationToken); }); + } + function isEmitBlocked(emitFileName) { + return hasEmitBlockingDiagnostics.contains(ts.toPath(emitFileName, currentDirectory, getCanonicalFileName)); + } + function emitWorker(program, sourceFile, writeFileCallback, cancellationToken) { + var declarationDiagnostics = []; + if (options.noEmit) { + return { diagnostics: declarationDiagnostics, sourceMaps: undefined, emittedFiles: undefined, emitSkipped: true }; + } + if (options.noEmitOnError) { + var diagnostics = program.getOptionsDiagnostics(cancellationToken).concat(program.getSyntacticDiagnostics(sourceFile, cancellationToken), program.getGlobalDiagnostics(cancellationToken), program.getSemanticDiagnostics(sourceFile, cancellationToken)); + if (diagnostics.length === 0 && program.getCompilerOptions().declaration) { + declarationDiagnostics = program.getDeclarationDiagnostics(undefined, cancellationToken); + } + if (diagnostics.length > 0 || declarationDiagnostics.length > 0) { + return { + diagnostics: ts.concatenate(diagnostics, declarationDiagnostics), + sourceMaps: undefined, + emittedFiles: undefined, + emitSkipped: true + }; + } + } + var emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver((options.outFile || options.out) ? undefined : sourceFile); + var start = new Date().getTime(); + var emitResult = ts.emitFiles(emitResolver, getEmitHost(writeFileCallback), sourceFile); + ts.emitTime += new Date().getTime() - start; + return emitResult; + } + function getSourceFile(fileName) { + return getSourceFileByPath(ts.toPath(fileName, currentDirectory, getCanonicalFileName)); + } + function getSourceFileByPath(path) { + return filesByName.get(path); + } + function getDiagnosticsHelper(sourceFile, getDiagnostics, cancellationToken) { + if (sourceFile) { + return getDiagnostics(sourceFile, cancellationToken); + } + var allDiagnostics = []; + ts.forEach(program.getSourceFiles(), function (sourceFile) { + if (cancellationToken) { + cancellationToken.throwIfCancellationRequested(); + } + ts.addRange(allDiagnostics, getDiagnostics(sourceFile, cancellationToken)); + }); + return ts.sortAndDeduplicateDiagnostics(allDiagnostics); + } + function getSyntacticDiagnostics(sourceFile, cancellationToken) { + return getDiagnosticsHelper(sourceFile, getSyntacticDiagnosticsForFile, cancellationToken); + } + function getSemanticDiagnostics(sourceFile, cancellationToken) { + return getDiagnosticsHelper(sourceFile, getSemanticDiagnosticsForFile, cancellationToken); + } + function getDeclarationDiagnostics(sourceFile, cancellationToken) { + var options = program.getCompilerOptions(); + if (!sourceFile || options.out || options.outFile) { + return getDeclarationDiagnosticsWorker(sourceFile, cancellationToken); + } + else { + return getDiagnosticsHelper(sourceFile, getDeclarationDiagnosticsForFile, cancellationToken); + } + } + function getSyntacticDiagnosticsForFile(sourceFile, cancellationToken) { + return sourceFile.parseDiagnostics; + } + function runWithCancellationToken(func) { + try { + return func(); + } + catch (e) { + if (e instanceof ts.OperationCanceledException) { + noDiagnosticsTypeChecker = undefined; + diagnosticsProducingTypeChecker = undefined; + } + throw e; + } + } + function getSemanticDiagnosticsForFile(sourceFile, cancellationToken) { + return runWithCancellationToken(function () { + var typeChecker = getDiagnosticsProducingTypeChecker(); + ts.Debug.assert(!!sourceFile.bindDiagnostics); + var bindDiagnostics = sourceFile.bindDiagnostics; + var checkDiagnostics = ts.isSourceFileJavaScript(sourceFile) ? + getJavaScriptSemanticDiagnosticsForFile(sourceFile, cancellationToken) : + typeChecker.getDiagnostics(sourceFile, cancellationToken); + var fileProcessingDiagnosticsInFile = fileProcessingDiagnostics.getDiagnostics(sourceFile.fileName); + var programDiagnosticsInFile = programDiagnostics.getDiagnostics(sourceFile.fileName); + return bindDiagnostics.concat(checkDiagnostics).concat(fileProcessingDiagnosticsInFile).concat(programDiagnosticsInFile); + }); + } + function getJavaScriptSemanticDiagnosticsForFile(sourceFile, cancellationToken) { + return runWithCancellationToken(function () { + var diagnostics = []; + walk(sourceFile); + return diagnostics; + function walk(node) { + if (!node) { + return false; + } + switch (node.kind) { + case 229: + diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_a_ts_file)); + return true; + case 235: + if (node.isExportEquals) { + diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.export_can_only_be_used_in_a_ts_file)); + return true; + } + break; + case 221: + var classDeclaration = node; + if (checkModifiers(classDeclaration.modifiers) || + checkTypeParameters(classDeclaration.typeParameters)) { + return true; + } + break; + case 251: + var heritageClause = node; + if (heritageClause.token === 106) { + diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_a_ts_file)); + return true; + } + break; + case 222: + diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.interface_declarations_can_only_be_used_in_a_ts_file)); + return true; + case 225: + diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.module_declarations_can_only_be_used_in_a_ts_file)); + return true; + case 223: + diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.type_aliases_can_only_be_used_in_a_ts_file)); + return true; + case 147: + case 146: + case 148: + case 149: + case 150: + case 179: + case 220: + case 180: + case 220: + var functionDeclaration = node; + if (checkModifiers(functionDeclaration.modifiers) || + checkTypeParameters(functionDeclaration.typeParameters) || + checkTypeAnnotation(functionDeclaration.type)) { + return true; + } + break; + case 200: + var variableStatement = node; + if (checkModifiers(variableStatement.modifiers)) { + return true; + } + break; + case 218: + var variableDeclaration = node; + if (checkTypeAnnotation(variableDeclaration.type)) { + return true; + } + break; + case 174: + case 175: + var expression = node; + if (expression.typeArguments && expression.typeArguments.length > 0) { + var start_2 = expression.typeArguments.pos; + diagnostics.push(ts.createFileDiagnostic(sourceFile, start_2, expression.typeArguments.end - start_2, ts.Diagnostics.type_arguments_can_only_be_used_in_a_ts_file)); + return true; + } + break; + case 142: + var parameter = node; + if (parameter.modifiers) { + var start_3 = parameter.modifiers.pos; + diagnostics.push(ts.createFileDiagnostic(sourceFile, start_3, parameter.modifiers.end - start_3, ts.Diagnostics.parameter_modifiers_can_only_be_used_in_a_ts_file)); + return true; + } + if (parameter.questionToken) { + diagnostics.push(ts.createDiagnosticForNode(parameter.questionToken, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, "?")); + return true; + } + if (parameter.type) { + diagnostics.push(ts.createDiagnosticForNode(parameter.type, ts.Diagnostics.types_can_only_be_used_in_a_ts_file)); + return true; + } + break; + case 145: + diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.property_declarations_can_only_be_used_in_a_ts_file)); + return true; + case 224: + diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.enum_declarations_can_only_be_used_in_a_ts_file)); + return true; + case 177: + var typeAssertionExpression = node; + diagnostics.push(ts.createDiagnosticForNode(typeAssertionExpression.type, ts.Diagnostics.type_assertion_expressions_can_only_be_used_in_a_ts_file)); + return true; + case 143: + if (!options.experimentalDecorators) { + diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning)); + } + return true; + } + return ts.forEachChild(node, walk); + } + function checkTypeParameters(typeParameters) { + if (typeParameters) { + var start_4 = typeParameters.pos; + diagnostics.push(ts.createFileDiagnostic(sourceFile, start_4, typeParameters.end - start_4, ts.Diagnostics.type_parameter_declarations_can_only_be_used_in_a_ts_file)); + return true; + } + return false; + } + function checkTypeAnnotation(type) { + if (type) { + diagnostics.push(ts.createDiagnosticForNode(type, ts.Diagnostics.types_can_only_be_used_in_a_ts_file)); + return true; + } + return false; + } + function checkModifiers(modifiers) { + if (modifiers) { + for (var _i = 0, modifiers_1 = modifiers; _i < modifiers_1.length; _i++) { + var modifier = modifiers_1[_i]; + switch (modifier.kind) { + case 112: + case 110: + case 111: + case 128: + case 122: + diagnostics.push(ts.createDiagnosticForNode(modifier, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, ts.tokenToString(modifier.kind))); + return true; + case 113: + case 82: + case 74: + case 77: + case 115: + } + } + } + return false; + } + }); + } + function getDeclarationDiagnosticsWorker(sourceFile, cancellationToken) { + return runWithCancellationToken(function () { + var resolver = getDiagnosticsProducingTypeChecker().getEmitResolver(sourceFile, cancellationToken); + var writeFile = function () { }; + return ts.getDeclarationDiagnostics(getEmitHost(writeFile), resolver, sourceFile); + }); + } + function getDeclarationDiagnosticsForFile(sourceFile, cancellationToken) { + return ts.isDeclarationFile(sourceFile) ? [] : getDeclarationDiagnosticsWorker(sourceFile, cancellationToken); + } + function getOptionsDiagnostics() { + var allDiagnostics = []; + ts.addRange(allDiagnostics, fileProcessingDiagnostics.getGlobalDiagnostics()); + ts.addRange(allDiagnostics, programDiagnostics.getGlobalDiagnostics()); + return ts.sortAndDeduplicateDiagnostics(allDiagnostics); + } + function getGlobalDiagnostics() { + var allDiagnostics = []; + ts.addRange(allDiagnostics, getDiagnosticsProducingTypeChecker().getGlobalDiagnostics()); + return ts.sortAndDeduplicateDiagnostics(allDiagnostics); + } + function hasExtension(fileName) { + return ts.getBaseFileName(fileName).indexOf(".") >= 0; + } + function processRootFile(fileName, isDefaultLib) { + processSourceFile(ts.normalizePath(fileName), isDefaultLib, true); + } + function fileReferenceIsEqualTo(a, b) { + return a.fileName === b.fileName; + } + function moduleNameIsEqualTo(a, b) { + return a.text === b.text; + } + function getTextOfLiteral(literal) { + return literal.text; + } + function collectExternalModuleReferences(file) { + if (file.imports) { + return; + } + var isJavaScriptFile = ts.isSourceFileJavaScript(file); + var isExternalModuleFile = ts.isExternalModule(file); + var imports; + var moduleAugmentations; + for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { + var node = _a[_i]; + collectModuleReferences(node, false); + if (isJavaScriptFile) { + collectRequireCalls(node); + } + } + file.imports = imports || emptyArray; + file.moduleAugmentations = moduleAugmentations || emptyArray; + return; + function collectModuleReferences(node, inAmbientModule) { + switch (node.kind) { + case 230: + case 229: + case 236: + var moduleNameExpr = ts.getExternalModuleName(node); + if (!moduleNameExpr || moduleNameExpr.kind !== 9) { + break; + } + if (!moduleNameExpr.text) { + break; + } + if (!inAmbientModule || !ts.isExternalModuleNameRelative(moduleNameExpr.text)) { + (imports || (imports = [])).push(moduleNameExpr); + } + break; + case 225: + if (ts.isAmbientModule(node) && (inAmbientModule || node.flags & 2 || ts.isDeclarationFile(file))) { + var moduleName = node.name; + if (isExternalModuleFile || (inAmbientModule && !ts.isExternalModuleNameRelative(moduleName.text))) { + (moduleAugmentations || (moduleAugmentations = [])).push(moduleName); + } + else if (!inAmbientModule) { + for (var _i = 0, _a = node.body.statements; _i < _a.length; _i++) { + var statement = _a[_i]; + collectModuleReferences(statement, true); + } + } + } + } + } + function collectRequireCalls(node) { + if (ts.isRequireCall(node, true)) { + (imports || (imports = [])).push(node.arguments[0]); + } + else { + ts.forEachChild(node, collectRequireCalls); + } + } + } + function processSourceFile(fileName, isDefaultLib, isReference, refFile, refPos, refEnd) { + var diagnosticArgument; + var diagnostic; + if (hasExtension(fileName)) { + if (!options.allowNonTsExtensions && !ts.forEach(supportedExtensions, function (extension) { return ts.fileExtensionIs(host.getCanonicalFileName(fileName), extension); })) { + diagnostic = ts.Diagnostics.File_0_has_unsupported_extension_The_only_supported_extensions_are_1; + diagnosticArgument = [fileName, "'" + supportedExtensions.join("', '") + "'"]; + } + else if (!findSourceFile(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName), isDefaultLib, isReference, refFile, refPos, refEnd)) { + diagnostic = ts.Diagnostics.File_0_not_found; + diagnosticArgument = [fileName]; + } + else if (refFile && host.getCanonicalFileName(fileName) === host.getCanonicalFileName(refFile.fileName)) { + diagnostic = ts.Diagnostics.A_file_cannot_have_a_reference_to_itself; + diagnosticArgument = [fileName]; + } + } + else { + var nonTsFile = options.allowNonTsExtensions && findSourceFile(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName), isDefaultLib, isReference, refFile, refPos, refEnd); + if (!nonTsFile) { + if (options.allowNonTsExtensions) { + diagnostic = ts.Diagnostics.File_0_not_found; + diagnosticArgument = [fileName]; + } + else if (!ts.forEach(supportedExtensions, function (extension) { return findSourceFile(fileName + extension, ts.toPath(fileName + extension, currentDirectory, getCanonicalFileName), isDefaultLib, isReference, refFile, refPos, refEnd); })) { + diagnostic = ts.Diagnostics.File_0_not_found; + fileName += ".ts"; + diagnosticArgument = [fileName]; + } + } + } + if (diagnostic) { + if (refFile !== undefined && refEnd !== undefined && refPos !== undefined) { + fileProcessingDiagnostics.add(ts.createFileDiagnostic.apply(void 0, [refFile, refPos, refEnd - refPos, diagnostic].concat(diagnosticArgument))); + } + else { + fileProcessingDiagnostics.add(ts.createCompilerDiagnostic.apply(void 0, [diagnostic].concat(diagnosticArgument))); + } + } + } + function reportFileNamesDifferOnlyInCasingError(fileName, existingFileName, refFile, refPos, refEnd) { + if (refFile !== undefined && refPos !== undefined && refEnd !== undefined) { + fileProcessingDiagnostics.add(ts.createFileDiagnostic(refFile, refPos, refEnd - refPos, ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, existingFileName)); + } + else { + fileProcessingDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, existingFileName)); + } + } + function findSourceFile(fileName, path, isDefaultLib, isReference, refFile, refPos, refEnd) { + if (filesByName.contains(path)) { + var file_1 = filesByName.get(path); + if (file_1 && options.forceConsistentCasingInFileNames && ts.getNormalizedAbsolutePath(file_1.fileName, currentDirectory) !== ts.getNormalizedAbsolutePath(fileName, currentDirectory)) { + reportFileNamesDifferOnlyInCasingError(fileName, file_1.fileName, refFile, refPos, refEnd); + } + if (file_1) { + file_1.wasReferenced = file_1.wasReferenced || isReference; + } + return file_1; + } + var file = host.getSourceFile(fileName, options.target, function (hostErrorMessage) { + if (refFile !== undefined && refPos !== undefined && refEnd !== undefined) { + fileProcessingDiagnostics.add(ts.createFileDiagnostic(refFile, refPos, refEnd - refPos, ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage)); + } + else { + fileProcessingDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage)); + } + }); + filesByName.set(path, file); + if (file) { + file.wasReferenced = file.wasReferenced || isReference; + file.path = path; + if (host.useCaseSensitiveFileNames()) { + var existingFile = filesByNameIgnoreCase.get(path); + if (existingFile) { + reportFileNamesDifferOnlyInCasingError(fileName, existingFile.fileName, refFile, refPos, refEnd); + } + else { + filesByNameIgnoreCase.set(path, file); + } + } + skipDefaultLib = skipDefaultLib || file.hasNoDefaultLib; + var basePath = ts.getDirectoryPath(fileName); + if (!options.noResolve) { + processReferencedFiles(file, basePath, isDefaultLib); + processTypeReferenceDirectives(file); + } + processImportedModules(file, basePath); + if (isDefaultLib) { + files.unshift(file); + } + else { + files.push(file); + } + } + return file; + } + function processReferencedFiles(file, basePath, isDefaultLib) { + ts.forEach(file.referencedFiles, function (ref) { + var referencedFileName = resolveTripleslashReference(ref.fileName, file.fileName); + processSourceFile(referencedFileName, isDefaultLib, true, file, ref.pos, ref.end); + }); + } + function processTypeReferenceDirectives(file) { + var typeDirectives = ts.map(file.typeReferenceDirectives, function (l) { return l.fileName; }); + var resolutions = resolveTypeReferenceDirectiveNamesWorker(typeDirectives, file.fileName); + for (var i = 0; i < typeDirectives.length; i++) { + var ref = file.typeReferenceDirectives[i]; + var resolvedTypeReferenceDirective = resolutions[i]; + ts.setResolvedTypeReferenceDirective(file, ref.fileName, resolvedTypeReferenceDirective); + processTypeReferenceDirective(ref.fileName, resolvedTypeReferenceDirective, file, ref.pos, ref.end); + } + } + function processTypeReferenceDirective(typeReferenceDirective, resolvedTypeReferenceDirective, refFile, refPos, refEnd) { + var previousResolution = resolvedTypeReferenceDirectives[typeReferenceDirective]; + if (previousResolution && previousResolution.primary) { + return; + } + var saveResolution = true; + if (resolvedTypeReferenceDirective) { + if (resolvedTypeReferenceDirective.primary) { + processSourceFile(resolvedTypeReferenceDirective.resolvedFileName, false, true, refFile, refPos, refEnd); + } + else { + if (previousResolution) { + var otherFileText = host.readFile(resolvedTypeReferenceDirective.resolvedFileName); + if (otherFileText !== getSourceFile(previousResolution.resolvedFileName).text) { + fileProcessingDiagnostics.add(createDiagnostic(refFile, refPos, refEnd, ts.Diagnostics.Conflicting_library_definitions_for_0_found_at_1_and_2_Copy_the_correct_file_to_the_typings_folder_to_resolve_this_conflict, typeReferenceDirective, resolvedTypeReferenceDirective.resolvedFileName, previousResolution.resolvedFileName)); + } + saveResolution = false; + } + else { + processSourceFile(resolvedTypeReferenceDirective.resolvedFileName, false, true, refFile, refPos, refEnd); + } + } + } + else { + fileProcessingDiagnostics.add(createDiagnostic(refFile, refPos, refEnd, ts.Diagnostics.Cannot_find_name_0, typeReferenceDirective)); + } + if (saveResolution) { + resolvedTypeReferenceDirectives[typeReferenceDirective] = resolvedTypeReferenceDirective; + } + } + function createDiagnostic(refFile, refPos, refEnd, message) { + var args = []; + for (var _i = 4; _i < arguments.length; _i++) { + args[_i - 4] = arguments[_i]; + } + if (refFile === undefined || refPos === undefined || refEnd === undefined) { + return ts.createCompilerDiagnostic.apply(void 0, [message].concat(args)); + } + else { + return ts.createFileDiagnostic.apply(void 0, [refFile, refPos, refEnd - refPos, message].concat(args)); + } + } + function getCanonicalFileName(fileName) { + return host.getCanonicalFileName(fileName); + } + function processImportedModules(file, basePath) { + collectExternalModuleReferences(file); + if (file.imports.length || file.moduleAugmentations.length) { + file.resolvedModules = {}; + var moduleNames = ts.map(ts.concatenate(file.imports, file.moduleAugmentations), getTextOfLiteral); + var resolutions = resolveModuleNamesWorker(moduleNames, ts.getNormalizedAbsolutePath(file.fileName, currentDirectory)); + for (var i = 0; i < moduleNames.length; i++) { + var resolution = resolutions[i]; + ts.setResolvedModule(file, moduleNames[i], resolution); + var shouldAddFile = resolution && + !options.noResolve && + i < file.imports.length; + if (shouldAddFile) { + var importedFile = findSourceFile(resolution.resolvedFileName, ts.toPath(resolution.resolvedFileName, currentDirectory, getCanonicalFileName), false, false, file, ts.skipTrivia(file.text, file.imports[i].pos), file.imports[i].end); + if (importedFile && resolution.isExternalLibraryImport) { + if (!ts.isExternalModule(importedFile) && importedFile.statements.length) { + var start_5 = ts.getTokenPosOfNode(file.imports[i], file); + fileProcessingDiagnostics.add(ts.createFileDiagnostic(file, start_5, file.imports[i].end - start_5, ts.Diagnostics.Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_the_package_definition, importedFile.fileName)); + } + else if (importedFile.referencedFiles.length) { + var firstRef = importedFile.referencedFiles[0]; + fileProcessingDiagnostics.add(ts.createFileDiagnostic(importedFile, firstRef.pos, firstRef.end - firstRef.pos, ts.Diagnostics.Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_package_author_to_update_the_package_definition)); + } + } + } + } + } + else { + file.resolvedModules = undefined; + } + return; + } + function computeCommonSourceDirectory(sourceFiles) { + var fileNames = []; + for (var _i = 0, sourceFiles_2 = sourceFiles; _i < sourceFiles_2.length; _i++) { + var file = sourceFiles_2[_i]; + if (!file.isDeclarationFile) { + fileNames.push(file.fileName); + } + } + return computeCommonSourceDirectoryOfFilenames(fileNames, currentDirectory, getCanonicalFileName); + } + function checkSourceFilesBelongToPath(sourceFiles, rootDirectory) { + var allFilesBelongToPath = true; + if (sourceFiles) { + var absoluteRootDirectoryPath = host.getCanonicalFileName(ts.getNormalizedAbsolutePath(rootDirectory, currentDirectory)); + for (var _i = 0, sourceFiles_3 = sourceFiles; _i < sourceFiles_3.length; _i++) { + var sourceFile = sourceFiles_3[_i]; + if (!ts.isDeclarationFile(sourceFile)) { + var absoluteSourceFilePath = host.getCanonicalFileName(ts.getNormalizedAbsolutePath(sourceFile.fileName, currentDirectory)); + if (absoluteSourceFilePath.indexOf(absoluteRootDirectoryPath) !== 0) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files, sourceFile.fileName, options.rootDir)); + allFilesBelongToPath = false; + } + } + } + } + return allFilesBelongToPath; + } + function verifyCompilerOptions() { + if (options.isolatedModules) { + if (options.declaration) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "declaration", "isolatedModules")); + } + if (options.noEmitOnError) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmitOnError", "isolatedModules")); + } + if (options.out) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "isolatedModules")); + } + if (options.outFile) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "outFile", "isolatedModules")); + } + } + if (options.inlineSourceMap) { + if (options.sourceMap) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceMap", "inlineSourceMap")); + } + if (options.mapRoot) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "mapRoot", "inlineSourceMap")); + } + } + if (options.paths && options.baseUrl === undefined) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_paths_cannot_be_used_without_specifying_baseUrl_option)); + } + if (options.paths) { + for (var key in options.paths) { + if (!ts.hasProperty(options.paths, key)) { + continue; + } + if (!hasZeroOrOneAsteriskCharacter(key)) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Pattern_0_can_have_at_most_one_Asterisk_character, key)); + } + if (ts.isArray(options.paths[key])) { + for (var _i = 0, _a = options.paths[key]; _i < _a.length; _i++) { + var subst = _a[_i]; + var typeOfSubst = typeof subst; + if (typeOfSubst === "string") { + if (!hasZeroOrOneAsteriskCharacter(subst)) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character, subst, key)); + } + } + else { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Substitution_0_for_pattern_1_has_incorrect_type_expected_string_got_2, subst, key, typeOfSubst)); + } + } + } + else { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Substututions_for_pattern_0_should_be_an_array, key)); + } + } + } + if (options.inlineSources) { + if (!options.sourceMap && !options.inlineSourceMap) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_inlineSources_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided)); + } + if (options.sourceRoot) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceRoot", "inlineSources")); + } + } + if (options.out && options.outFile) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "outFile")); + } + if (!options.sourceMap && (options.mapRoot || options.sourceRoot)) { + if (options.mapRoot) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "mapRoot", "sourceMap")); + } + if (options.sourceRoot && !options.inlineSourceMap) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "sourceRoot", "sourceMap")); + } + } + if (options.declarationDir) { + if (!options.declaration) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "declarationDir", "declaration")); + } + if (options.out || options.outFile) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "declarationDir", options.out ? "out" : "outFile")); + } + } + if (options.lib && options.noLib) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "lib", "noLib")); + } + var languageVersion = options.target || 0; + var outFile = options.outFile || options.out; + var firstExternalModuleSourceFile = ts.forEach(files, function (f) { return ts.isExternalModule(f) ? f : undefined; }); + if (options.isolatedModules) { + if (options.module === ts.ModuleKind.None && languageVersion < 2) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES2015_or_higher)); + } + var firstNonExternalModuleSourceFile = ts.forEach(files, function (f) { return !ts.isExternalModule(f) && !ts.isDeclarationFile(f) ? f : undefined; }); + if (firstNonExternalModuleSourceFile) { + var span = ts.getErrorSpanForNode(firstNonExternalModuleSourceFile, firstNonExternalModuleSourceFile); + programDiagnostics.add(ts.createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided)); + } + } + else if (firstExternalModuleSourceFile && languageVersion < 2 && options.module === ts.ModuleKind.None) { + var span = ts.getErrorSpanForNode(firstExternalModuleSourceFile, firstExternalModuleSourceFile.externalModuleIndicator); + programDiagnostics.add(ts.createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_modules_unless_the_module_flag_is_provided_with_a_valid_module_type_Consider_setting_the_module_compiler_option_in_a_tsconfig_json_file)); + } + if (options.module === ts.ModuleKind.ES6 && languageVersion < 2) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_compile_modules_into_es2015_when_targeting_ES5_or_lower)); + } + if (outFile && options.module && !(options.module === ts.ModuleKind.AMD || options.module === ts.ModuleKind.System)) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Only_amd_and_system_modules_are_supported_alongside_0, options.out ? "out" : "outFile")); + } + if (options.outDir || + options.sourceRoot || + options.mapRoot) { + var dir = getCommonSourceDirectory(); + if (options.outDir && dir === "" && ts.forEach(files, function (file) { return ts.getRootLength(file.fileName) > 1; })) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files)); + } + } + if (!options.noEmit && options.allowJs && options.declaration) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "allowJs", "declaration")); + } + if (options.emitDecoratorMetadata && + !options.experimentalDecorators) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators")); + } + if (options.reactNamespace && !ts.isIdentifier(options.reactNamespace, languageVersion)) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier, options.reactNamespace)); + } + if (!options.noEmit && !options.suppressOutputPathCheck) { + var emitHost = getEmitHost(); + var emitFilesSeen_1 = ts.createFileMap(!host.useCaseSensitiveFileNames() ? function (key) { return key.toLocaleLowerCase(); } : undefined); + ts.forEachExpectedEmitFile(emitHost, function (emitFileNames, sourceFiles, isBundledEmit) { + verifyEmitFilePath(emitFileNames.jsFilePath, emitFilesSeen_1); + verifyEmitFilePath(emitFileNames.declarationFilePath, emitFilesSeen_1); + }); + } + function verifyEmitFilePath(emitFileName, emitFilesSeen) { + if (emitFileName) { + var emitFilePath = ts.toPath(emitFileName, currentDirectory, getCanonicalFileName); + if (filesByName.contains(emitFilePath)) { + createEmitBlockingDiagnostics(emitFileName, emitFilePath, ts.Diagnostics.Cannot_write_file_0_because_it_would_overwrite_input_file); + } + if (emitFilesSeen.contains(emitFilePath)) { + createEmitBlockingDiagnostics(emitFileName, emitFilePath, ts.Diagnostics.Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files); + } + else { + emitFilesSeen.set(emitFilePath, true); + } + } + } + } + function createEmitBlockingDiagnostics(emitFileName, emitFilePath, message) { + hasEmitBlockingDiagnostics.set(ts.toPath(emitFileName, currentDirectory, getCanonicalFileName), true); + programDiagnostics.add(ts.createCompilerDiagnostic(message, emitFileName)); + } + } + ts.createProgram = createProgram; +})(ts || (ts = {})); +var ts; +(function (ts) { + var BreakpointResolver; + (function (BreakpointResolver) { + function spanInSourceFileAtLocation(sourceFile, position) { + if (sourceFile.isDeclarationFile) { + return undefined; + } + var tokenAtLocation = ts.getTokenAtPosition(sourceFile, position); + var lineOfPosition = sourceFile.getLineAndCharacterOfPosition(position).line; + if (sourceFile.getLineAndCharacterOfPosition(tokenAtLocation.getStart(sourceFile)).line > lineOfPosition) { + tokenAtLocation = ts.findPrecedingToken(tokenAtLocation.pos, sourceFile); + if (!tokenAtLocation || sourceFile.getLineAndCharacterOfPosition(tokenAtLocation.getEnd()).line !== lineOfPosition) { + return undefined; + } + } + if (ts.isInAmbientContext(tokenAtLocation)) { + return undefined; + } + return spanInNode(tokenAtLocation); + function textSpan(startNode, endNode) { + var start = startNode.decorators ? + ts.skipTrivia(sourceFile.text, startNode.decorators.end) : + startNode.getStart(sourceFile); + return ts.createTextSpanFromBounds(start, (endNode || startNode).getEnd()); + } + function textSpanEndingAtNextToken(startNode, previousTokenToFindNextEndToken) { + return textSpan(startNode, ts.findNextToken(previousTokenToFindNextEndToken, previousTokenToFindNextEndToken.parent)); + } + function spanInNodeIfStartsOnSameLine(node, otherwiseOnNode) { + if (node && lineOfPosition === sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile)).line) { + return spanInNode(node); + } + return spanInNode(otherwiseOnNode); + } + function spanInNodeArray(nodeArray) { + return ts.createTextSpanFromBounds(ts.skipTrivia(sourceFile.text, nodeArray.pos), nodeArray.end); + } + function spanInPreviousNode(node) { + return spanInNode(ts.findPrecedingToken(node.pos, sourceFile)); + } + function spanInNextNode(node) { + return spanInNode(ts.findNextToken(node, node.parent)); + } + function spanInNode(node) { + if (node) { + switch (node.kind) { + case 200: + return spanInVariableDeclaration(node.declarationList.declarations[0]); + case 218: + case 145: + case 144: + return spanInVariableDeclaration(node); + case 142: + return spanInParameterDeclaration(node); + case 220: + case 147: + case 146: + case 149: + case 150: + case 148: + case 179: + case 180: + return spanInFunctionDeclaration(node); + case 199: + if (ts.isFunctionBlock(node)) { + return spanInFunctionBlock(node); + } + case 226: + return spanInBlock(node); + case 252: + return spanInBlock(node.block); + case 202: + return textSpan(node.expression); + case 211: + return textSpan(node.getChildAt(0), node.expression); + case 205: + return textSpanEndingAtNextToken(node, node.expression); + case 204: + return spanInNode(node.statement); + case 217: + return textSpan(node.getChildAt(0)); + case 203: + return textSpanEndingAtNextToken(node, node.expression); + case 214: + return spanInNode(node.statement); + case 210: + case 209: + return textSpan(node.getChildAt(0), node.label); + case 206: + return spanInForStatement(node); + case 207: + return textSpanEndingAtNextToken(node, node.expression); + case 208: + return spanInInitializerOfForLike(node); + case 213: + return textSpanEndingAtNextToken(node, node.expression); + case 249: + case 250: + return spanInNode(node.statements[0]); + case 216: + return spanInBlock(node.tryBlock); + case 215: + return textSpan(node, node.expression); + case 235: + return textSpan(node, node.expression); + case 229: + return textSpan(node, node.moduleReference); + case 230: + return textSpan(node, node.moduleSpecifier); + case 236: + return textSpan(node, node.moduleSpecifier); + case 225: + if (ts.getModuleInstanceState(node) !== 1) { + return undefined; + } + case 221: + case 224: + case 255: + case 169: + return textSpan(node); + case 212: + return spanInNode(node.statement); + case 143: + return spanInNodeArray(node.parent.decorators); + case 167: + case 168: + return spanInBindingPattern(node); + case 222: + case 223: + return undefined; + case 23: + case 1: + return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile)); + case 24: + return spanInPreviousNode(node); + case 15: + return spanInOpenBraceToken(node); + case 16: + return spanInCloseBraceToken(node); + case 20: + return spanInCloseBracketToken(node); + case 17: + return spanInOpenParenToken(node); + case 18: + return spanInCloseParenToken(node); + case 54: + return spanInColonToken(node); + case 27: + case 25: + return spanInGreaterThanOrLessThanToken(node); + case 104: + return spanInWhileKeyword(node); + case 80: + case 72: + case 85: + return spanInNextNode(node); + case 138: + return spanInOfKeyword(node); + default: + if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node)) { + return spanInArrayLiteralOrObjectLiteralDestructuringPattern(node); + } + if ((node.kind === 69 || + node.kind == 191 || + node.kind === 253 || + node.kind === 254) && + ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent)) { + return textSpan(node); + } + if (node.kind === 187) { + var binaryExpression = node; + if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(binaryExpression.left)) { + return spanInArrayLiteralOrObjectLiteralDestructuringPattern(binaryExpression.left); + } + if (binaryExpression.operatorToken.kind === 56 && + ts.isArrayLiteralOrObjectLiteralDestructuringPattern(binaryExpression.parent)) { + return textSpan(node); + } + if (binaryExpression.operatorToken.kind === 24) { + return spanInNode(binaryExpression.left); + } + } + if (ts.isExpression(node)) { + switch (node.parent.kind) { + case 204: + return spanInPreviousNode(node); + case 143: + return spanInNode(node.parent); + case 206: + case 208: + return textSpan(node); + case 187: + if (node.parent.operatorToken.kind === 24) { + return textSpan(node); + } + break; + case 180: + if (node.parent.body === node) { + return textSpan(node); + } + break; + } + } + if (node.parent.kind === 253 && + node.parent.name === node && + !ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.parent)) { + return spanInNode(node.parent.initializer); + } + if (node.parent.kind === 177 && node.parent.type === node) { + return spanInNextNode(node.parent.type); + } + if (ts.isFunctionLike(node.parent) && node.parent.type === node) { + return spanInPreviousNode(node); + } + if ((node.parent.kind === 218 || + node.parent.kind === 142)) { + var paramOrVarDecl = node.parent; + if (paramOrVarDecl.initializer === node || + paramOrVarDecl.type === node || + ts.isAssignmentOperator(node.kind)) { + return spanInPreviousNode(node); + } + } + if (node.parent.kind === 187) { + var binaryExpression = node.parent; + if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(binaryExpression.left) && + (binaryExpression.right === node || + binaryExpression.operatorToken === node)) { + return spanInPreviousNode(node); + } + } + return spanInNode(node.parent); + } + } + function textSpanFromVariableDeclaration(variableDeclaration) { + var declarations = variableDeclaration.parent.declarations; + if (declarations && declarations[0] === variableDeclaration) { + return textSpan(ts.findPrecedingToken(variableDeclaration.pos, sourceFile, variableDeclaration.parent), variableDeclaration); + } + else { + return textSpan(variableDeclaration); + } + } + function spanInVariableDeclaration(variableDeclaration) { + if (variableDeclaration.parent.parent.kind === 207) { + return spanInNode(variableDeclaration.parent.parent); + } + if (ts.isBindingPattern(variableDeclaration.name)) { + return spanInBindingPattern(variableDeclaration.name); + } + if (variableDeclaration.initializer || + (variableDeclaration.flags & 1) || + variableDeclaration.parent.parent.kind === 208) { + return textSpanFromVariableDeclaration(variableDeclaration); + } + var declarations = variableDeclaration.parent.declarations; + if (declarations && declarations[0] !== variableDeclaration) { + return spanInNode(ts.findPrecedingToken(variableDeclaration.pos, sourceFile, variableDeclaration.parent)); + } + } + function canHaveSpanInParameterDeclaration(parameter) { + return !!parameter.initializer || parameter.dotDotDotToken !== undefined || + !!(parameter.flags & 4) || !!(parameter.flags & 8); + } + function spanInParameterDeclaration(parameter) { + if (ts.isBindingPattern(parameter.name)) { + return spanInBindingPattern(parameter.name); + } + else if (canHaveSpanInParameterDeclaration(parameter)) { + return textSpan(parameter); + } + else { + var functionDeclaration = parameter.parent; + var indexOfParameter = ts.indexOf(functionDeclaration.parameters, parameter); + if (indexOfParameter) { + return spanInParameterDeclaration(functionDeclaration.parameters[indexOfParameter - 1]); + } + else { + return spanInNode(functionDeclaration.body); + } + } + } + function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) { + return !!(functionDeclaration.flags & 1) || + (functionDeclaration.parent.kind === 221 && functionDeclaration.kind !== 148); + } + function spanInFunctionDeclaration(functionDeclaration) { + if (!functionDeclaration.body) { + return undefined; + } + if (canFunctionHaveSpanInWholeDeclaration(functionDeclaration)) { + return textSpan(functionDeclaration); + } + return spanInNode(functionDeclaration.body); + } + function spanInFunctionBlock(block) { + var nodeForSpanInBlock = block.statements.length ? block.statements[0] : block.getLastToken(); + if (canFunctionHaveSpanInWholeDeclaration(block.parent)) { + return spanInNodeIfStartsOnSameLine(block.parent, nodeForSpanInBlock); + } + return spanInNode(nodeForSpanInBlock); + } + function spanInBlock(block) { + switch (block.parent.kind) { + case 225: + if (ts.getModuleInstanceState(block.parent) !== 1) { + return undefined; + } + case 205: + case 203: + case 207: + return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]); + case 206: + case 208: + return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(block.pos, sourceFile, block.parent), block.statements[0]); + } + return spanInNode(block.statements[0]); + } + function spanInInitializerOfForLike(forLikeStatement) { + if (forLikeStatement.initializer.kind === 219) { + var variableDeclarationList = forLikeStatement.initializer; + if (variableDeclarationList.declarations.length > 0) { + return spanInNode(variableDeclarationList.declarations[0]); + } + } + else { + return spanInNode(forLikeStatement.initializer); + } + } + function spanInForStatement(forStatement) { + if (forStatement.initializer) { + return spanInInitializerOfForLike(forStatement); + } + if (forStatement.condition) { + return textSpan(forStatement.condition); + } + if (forStatement.incrementor) { + return textSpan(forStatement.incrementor); + } + } + function spanInBindingPattern(bindingPattern) { + var firstBindingElement = ts.forEach(bindingPattern.elements, function (element) { return element.kind !== 193 ? element : undefined; }); + if (firstBindingElement) { + return spanInNode(firstBindingElement); + } + if (bindingPattern.parent.kind === 169) { + return textSpan(bindingPattern.parent); + } + return textSpanFromVariableDeclaration(bindingPattern.parent); + } + function spanInArrayLiteralOrObjectLiteralDestructuringPattern(node) { + ts.Debug.assert(node.kind !== 168 && node.kind !== 167); + var elements = node.kind === 170 ? + node.elements : + node.properties; + var firstBindingElement = ts.forEach(elements, function (element) { return element.kind !== 193 ? element : undefined; }); + if (firstBindingElement) { + return spanInNode(firstBindingElement); + } + return textSpan(node.parent.kind === 187 ? node.parent : node); + } + function spanInOpenBraceToken(node) { + switch (node.parent.kind) { + case 224: + var enumDeclaration = node.parent; + return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), enumDeclaration.members.length ? enumDeclaration.members[0] : enumDeclaration.getLastToken(sourceFile)); + case 221: + var classDeclaration = node.parent; + return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile)); + case 227: + return spanInNodeIfStartsOnSameLine(node.parent.parent, node.parent.clauses[0]); + } + return spanInNode(node.parent); + } + function spanInCloseBraceToken(node) { + switch (node.parent.kind) { + case 226: + if (ts.getModuleInstanceState(node.parent.parent) !== 1) { + return undefined; + } + case 224: + case 221: + return textSpan(node); + case 199: + if (ts.isFunctionBlock(node.parent)) { + return textSpan(node); + } + case 252: + return spanInNode(ts.lastOrUndefined(node.parent.statements)); + case 227: + var caseBlock = node.parent; + var lastClause = ts.lastOrUndefined(caseBlock.clauses); + if (lastClause) { + return spanInNode(ts.lastOrUndefined(lastClause.statements)); + } + return undefined; + case 167: + var bindingPattern = node.parent; + return spanInNode(ts.lastOrUndefined(bindingPattern.elements) || bindingPattern); + default: + if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent)) { + var objectLiteral = node.parent; + return textSpan(ts.lastOrUndefined(objectLiteral.properties) || objectLiteral); + } + return spanInNode(node.parent); + } + } + function spanInCloseBracketToken(node) { + switch (node.parent.kind) { + case 168: + var bindingPattern = node.parent; + return textSpan(ts.lastOrUndefined(bindingPattern.elements) || bindingPattern); + default: + if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent)) { + var arrayLiteral = node.parent; + return textSpan(ts.lastOrUndefined(arrayLiteral.elements) || arrayLiteral); + } + return spanInNode(node.parent); + } + } + function spanInOpenParenToken(node) { + if (node.parent.kind === 204 || + node.parent.kind === 174 || + node.parent.kind === 175) { + return spanInPreviousNode(node); + } + if (node.parent.kind === 178) { + return spanInNextNode(node); + } + return spanInNode(node.parent); + } + function spanInCloseParenToken(node) { + switch (node.parent.kind) { + case 179: + case 220: + case 180: + case 147: + case 146: + case 149: + case 150: + case 148: + case 205: + case 204: + case 206: + case 208: + case 174: + case 175: + case 178: + return spanInPreviousNode(node); + default: + return spanInNode(node.parent); + } + } + function spanInColonToken(node) { + if (ts.isFunctionLike(node.parent) || + node.parent.kind === 253 || + node.parent.kind === 142) { + return spanInPreviousNode(node); + } + return spanInNode(node.parent); + } + function spanInGreaterThanOrLessThanToken(node) { + if (node.parent.kind === 177) { + return spanInNextNode(node); + } + return spanInNode(node.parent); + } + function spanInWhileKeyword(node) { + if (node.parent.kind === 204) { + return textSpanEndingAtNextToken(node, node.parent.expression); + } + return spanInNode(node.parent); + } + function spanInOfKeyword(node) { + if (node.parent.kind === 208) { + return spanInNextNode(node); + } + return spanInNode(node.parent); + } + } + } + BreakpointResolver.spanInSourceFileAtLocation = spanInSourceFileAtLocation; + })(BreakpointResolver = ts.BreakpointResolver || (ts.BreakpointResolver = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var OutliningElementsCollector; + (function (OutliningElementsCollector) { + function collectElements(sourceFile) { + var elements = []; + var collapseText = "..."; + function addOutliningSpan(hintSpanNode, startElement, endElement, autoCollapse) { + if (hintSpanNode && startElement && endElement) { + var span = { + textSpan: ts.createTextSpanFromBounds(startElement.pos, endElement.end), + hintSpan: ts.createTextSpanFromBounds(hintSpanNode.getStart(), hintSpanNode.end), + bannerText: collapseText, + autoCollapse: autoCollapse + }; + elements.push(span); + } + } + function addOutliningSpanComments(commentSpan, autoCollapse) { + if (commentSpan) { + var span = { + textSpan: ts.createTextSpanFromBounds(commentSpan.pos, commentSpan.end), + hintSpan: ts.createTextSpanFromBounds(commentSpan.pos, commentSpan.end), + bannerText: collapseText, + autoCollapse: autoCollapse + }; + elements.push(span); + } + } + function addOutliningForLeadingCommentsForNode(n) { + var comments = ts.getLeadingCommentRangesOfNode(n, sourceFile); + if (comments) { + var firstSingleLineCommentStart = -1; + var lastSingleLineCommentEnd = -1; + var isFirstSingleLineComment = true; + var singleLineCommentCount = 0; + for (var _i = 0, comments_2 = comments; _i < comments_2.length; _i++) { + var currentComment = comments_2[_i]; + if (currentComment.kind === 2) { + if (isFirstSingleLineComment) { + firstSingleLineCommentStart = currentComment.pos; + } + isFirstSingleLineComment = false; + lastSingleLineCommentEnd = currentComment.end; + singleLineCommentCount++; + } + else if (currentComment.kind === 3) { + combineAndAddMultipleSingleLineComments(singleLineCommentCount, firstSingleLineCommentStart, lastSingleLineCommentEnd); + addOutliningSpanComments(currentComment, false); + singleLineCommentCount = 0; + lastSingleLineCommentEnd = -1; + isFirstSingleLineComment = true; + } + } + combineAndAddMultipleSingleLineComments(singleLineCommentCount, firstSingleLineCommentStart, lastSingleLineCommentEnd); + } + } + function combineAndAddMultipleSingleLineComments(count, start, end) { + if (count > 1) { + var multipleSingleLineComments = { + pos: start, + end: end, + kind: 2 + }; + addOutliningSpanComments(multipleSingleLineComments, false); + } + } + function autoCollapse(node) { + return ts.isFunctionBlock(node) && node.parent.kind !== 180; + } + var depth = 0; + var maxDepth = 20; + function walk(n) { + if (depth > maxDepth) { + return; + } + if (ts.isDeclaration(n)) { + addOutliningForLeadingCommentsForNode(n); + } + switch (n.kind) { + case 199: + if (!ts.isFunctionBlock(n)) { + var parent_14 = n.parent; + var openBrace = ts.findChildOfKind(n, 15, sourceFile); + var closeBrace = ts.findChildOfKind(n, 16, sourceFile); + if (parent_14.kind === 204 || + parent_14.kind === 207 || + parent_14.kind === 208 || + parent_14.kind === 206 || + parent_14.kind === 203 || + parent_14.kind === 205 || + parent_14.kind === 212 || + parent_14.kind === 252) { + addOutliningSpan(parent_14, openBrace, closeBrace, autoCollapse(n)); + break; + } + if (parent_14.kind === 216) { + var tryStatement = parent_14; + if (tryStatement.tryBlock === n) { + addOutliningSpan(parent_14, openBrace, closeBrace, autoCollapse(n)); + break; + } + else if (tryStatement.finallyBlock === n) { + var finallyKeyword = ts.findChildOfKind(tryStatement, 85, sourceFile); + if (finallyKeyword) { + addOutliningSpan(finallyKeyword, openBrace, closeBrace, autoCollapse(n)); + break; + } + } + } + var span = ts.createTextSpanFromBounds(n.getStart(), n.end); + elements.push({ + textSpan: span, + hintSpan: span, + bannerText: collapseText, + autoCollapse: autoCollapse(n) + }); + break; + } + case 226: { + var openBrace = ts.findChildOfKind(n, 15, sourceFile); + var closeBrace = ts.findChildOfKind(n, 16, sourceFile); + addOutliningSpan(n.parent, openBrace, closeBrace, autoCollapse(n)); + break; + } + case 221: + case 222: + case 224: + case 171: + case 227: { + var openBrace = ts.findChildOfKind(n, 15, sourceFile); + var closeBrace = ts.findChildOfKind(n, 16, sourceFile); + addOutliningSpan(n, openBrace, closeBrace, autoCollapse(n)); + break; + } + case 170: + var openBracket = ts.findChildOfKind(n, 19, sourceFile); + var closeBracket = ts.findChildOfKind(n, 20, sourceFile); + addOutliningSpan(n, openBracket, closeBracket, autoCollapse(n)); + break; + } + depth++; + ts.forEachChild(n, walk); + depth--; + } + walk(sourceFile); + return elements; + } + OutliningElementsCollector.collectElements = collectElements; + })(OutliningElementsCollector = ts.OutliningElementsCollector || (ts.OutliningElementsCollector = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var NavigateTo; + (function (NavigateTo) { + function getNavigateToItems(program, cancellationToken, searchValue, maxResultCount) { + var patternMatcher = ts.createPatternMatcher(searchValue); + var rawItems = []; + var baseSensitivity = { sensitivity: "base" }; + ts.forEach(program.getSourceFiles(), function (sourceFile) { + cancellationToken.throwIfCancellationRequested(); + var nameToDeclarations = sourceFile.getNamedDeclarations(); + for (var name_34 in nameToDeclarations) { + var declarations = ts.getProperty(nameToDeclarations, name_34); + if (declarations) { + var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_34); + if (!matches) { + continue; + } + for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) { + var declaration = declarations_7[_i]; + if (patternMatcher.patternContainsDots) { + var containers = getContainers(declaration); + if (!containers) { + return undefined; + } + matches = patternMatcher.getMatches(containers, name_34); + if (!matches) { + continue; + } + } + var fileName = sourceFile.fileName; + var matchKind = bestMatchKind(matches); + rawItems.push({ name: name_34, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); + } + } + } + }); + rawItems.sort(compareNavigateToItems); + if (maxResultCount !== undefined) { + rawItems = rawItems.slice(0, maxResultCount); + } + var items = ts.map(rawItems, createNavigateToItem); + return items; + function allMatchesAreCaseSensitive(matches) { + ts.Debug.assert(matches.length > 0); + for (var _i = 0, matches_1 = matches; _i < matches_1.length; _i++) { + var match = matches_1[_i]; + if (!match.isCaseSensitive) { + return false; + } + } + return true; + } + function getTextOfIdentifierOrLiteral(node) { + if (node) { + if (node.kind === 69 || + node.kind === 9 || + node.kind === 8) { + return node.text; + } + } + return undefined; + } + function tryAddSingleDeclarationName(declaration, containers) { + if (declaration && declaration.name) { + var text = getTextOfIdentifierOrLiteral(declaration.name); + if (text !== undefined) { + containers.unshift(text); + } + else if (declaration.name.kind === 140) { + return tryAddComputedPropertyName(declaration.name.expression, containers, true); + } + else { + return false; + } + } + return true; + } + function tryAddComputedPropertyName(expression, containers, includeLastPortion) { + var text = getTextOfIdentifierOrLiteral(expression); + if (text !== undefined) { + if (includeLastPortion) { + containers.unshift(text); + } + return true; + } + if (expression.kind === 172) { + var propertyAccess = expression; + if (includeLastPortion) { + containers.unshift(propertyAccess.name.text); + } + return tryAddComputedPropertyName(propertyAccess.expression, containers, true); + } + return false; + } + function getContainers(declaration) { + var containers = []; + if (declaration.name.kind === 140) { + if (!tryAddComputedPropertyName(declaration.name.expression, containers, false)) { + return undefined; + } + } + declaration = ts.getContainerNode(declaration); + while (declaration) { + if (!tryAddSingleDeclarationName(declaration, containers)) { + return undefined; + } + declaration = ts.getContainerNode(declaration); + } + return containers; + } + function bestMatchKind(matches) { + ts.Debug.assert(matches.length > 0); + var bestMatchKind = ts.PatternMatchKind.camelCase; + for (var _i = 0, matches_2 = matches; _i < matches_2.length; _i++) { + var match = matches_2[_i]; + var kind = match.kind; + if (kind < bestMatchKind) { + bestMatchKind = kind; + } + } + return bestMatchKind; + } + function compareNavigateToItems(i1, i2) { + return i1.matchKind - i2.matchKind || + i1.name.localeCompare(i2.name, undefined, baseSensitivity) || + i1.name.localeCompare(i2.name); + } + function createNavigateToItem(rawItem) { + var declaration = rawItem.declaration; + var container = ts.getContainerNode(declaration); + return { + name: rawItem.name, + kind: ts.getNodeKind(declaration), + kindModifiers: ts.getNodeModifiers(declaration), + matchKind: ts.PatternMatchKind[rawItem.matchKind], + isCaseSensitive: rawItem.isCaseSensitive, + fileName: rawItem.fileName, + textSpan: ts.createTextSpanFromBounds(declaration.getStart(), declaration.getEnd()), + containerName: container && container.name ? container.name.text : "", + containerKind: container && container.name ? ts.getNodeKind(container) : "" + }; + } + } + NavigateTo.getNavigateToItems = getNavigateToItems; + })(NavigateTo = ts.NavigateTo || (ts.NavigateTo = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var NavigationBar; + (function (NavigationBar) { + function getNavigationBarItems(sourceFile, compilerOptions) { + if (ts.isSourceFileJavaScript(sourceFile)) { + return getJsNavigationBarItems(sourceFile, compilerOptions); + } + var hasGlobalNode = false; + return getItemsWorker(getTopLevelNodes(sourceFile), createTopLevelItem); + function getIndent(node) { + var indent = hasGlobalNode ? 1 : 0; + var current = node.parent; + while (current) { + switch (current.kind) { + case 225: + do { + current = current.parent; + } while (current.kind === 225); + case 221: + case 224: + case 222: + case 220: + indent++; + } + current = current.parent; + } + return indent; + } + function getChildNodes(nodes) { + var childNodes = []; + function visit(node) { + switch (node.kind) { + case 200: + ts.forEach(node.declarationList.declarations, visit); + break; + case 167: + case 168: + ts.forEach(node.elements, visit); + break; + case 236: + if (node.exportClause) { + ts.forEach(node.exportClause.elements, visit); + } + break; + case 230: + var importClause = node.importClause; + if (importClause) { + if (importClause.name) { + childNodes.push(importClause); + } + if (importClause.namedBindings) { + if (importClause.namedBindings.kind === 232) { + childNodes.push(importClause.namedBindings); + } + else { + ts.forEach(importClause.namedBindings.elements, visit); + } + } + } + break; + case 169: + case 218: + if (ts.isBindingPattern(node.name)) { + visit(node.name); + break; + } + case 221: + case 224: + case 222: + case 225: + case 220: + case 229: + case 234: + case 238: + childNodes.push(node); + break; + } + } + ts.forEach(nodes, visit); + return sortNodes(childNodes); + } + function getTopLevelNodes(node) { + var topLevelNodes = []; + topLevelNodes.push(node); + addTopLevelNodes(node.statements, topLevelNodes); + return topLevelNodes; + } + function sortNodes(nodes) { + return nodes.slice(0).sort(function (n1, n2) { + if (n1.name && n2.name) { + return ts.getPropertyNameForPropertyNameNode(n1.name).localeCompare(ts.getPropertyNameForPropertyNameNode(n2.name)); + } + else if (n1.name) { + return 1; + } + else if (n2.name) { + return -1; + } + else { + return n1.kind - n2.kind; + } + }); + } + function addTopLevelNodes(nodes, topLevelNodes) { + nodes = sortNodes(nodes); + for (var _i = 0, nodes_4 = nodes; _i < nodes_4.length; _i++) { + var node = nodes_4[_i]; + switch (node.kind) { + case 221: + topLevelNodes.push(node); + for (var _a = 0, _b = node.members; _a < _b.length; _a++) { + var member = _b[_a]; + if (member.kind === 147 || member.kind === 148) { + if (member.body) { + if (hasNamedFunctionDeclarations(member.body.statements)) { + topLevelNodes.push(member); + } + addTopLevelNodes(member.body.statements, topLevelNodes); + } + } + } + break; + case 224: + case 222: + case 223: + topLevelNodes.push(node); + break; + case 225: + var moduleDeclaration = node; + topLevelNodes.push(node); + addTopLevelNodes(getInnermostModule(moduleDeclaration).body.statements, topLevelNodes); + break; + case 220: + var functionDeclaration = node; + if (isTopLevelFunctionDeclaration(functionDeclaration)) { + topLevelNodes.push(node); + addTopLevelNodes(functionDeclaration.body.statements, topLevelNodes); + } + break; + } + } + } + function hasNamedFunctionDeclarations(nodes) { + for (var _i = 0, nodes_5 = nodes; _i < nodes_5.length; _i++) { + var s = nodes_5[_i]; + if (s.kind === 220 && !isEmpty(s.name.text)) { + return true; + } + } + return false; + } + function isTopLevelFunctionDeclaration(functionDeclaration) { + if (functionDeclaration.kind === 220) { + if (functionDeclaration.body && functionDeclaration.body.kind === 199) { + if (hasNamedFunctionDeclarations(functionDeclaration.body.statements)) { + return true; + } + if (!ts.isFunctionBlock(functionDeclaration.parent)) { + return true; + } + else { + var grandParentKind = functionDeclaration.parent.parent.kind; + if (grandParentKind === 147 || + grandParentKind === 148) { + return true; + } + } + } + } + return false; + } + function getItemsWorker(nodes, createItem) { + var items = []; + var keyToItem = {}; + for (var _i = 0, nodes_6 = nodes; _i < nodes_6.length; _i++) { + var child = nodes_6[_i]; + var item = createItem(child); + if (item !== undefined) { + if (item.text.length > 0) { + var key = item.text + "-" + item.kind + "-" + item.indent; + var itemWithSameName = keyToItem[key]; + if (itemWithSameName) { + merge(itemWithSameName, item); + } + else { + keyToItem[key] = item; + items.push(item); + } + } + } + } + return items; + } + function merge(target, source) { + ts.addRange(target.spans, source.spans); + if (source.childItems) { + if (!target.childItems) { + target.childItems = []; + } + outer: for (var _i = 0, _a = source.childItems; _i < _a.length; _i++) { + var sourceChild = _a[_i]; + for (var _b = 0, _c = target.childItems; _b < _c.length; _b++) { + var targetChild = _c[_b]; + if (targetChild.text === sourceChild.text && targetChild.kind === sourceChild.kind) { + merge(targetChild, sourceChild); + continue outer; + } + } + target.childItems.push(sourceChild); + } + } + } + function createChildItem(node) { + switch (node.kind) { + case 142: + if (ts.isBindingPattern(node.name)) { + break; + } + if ((node.flags & 1023) === 0) { + return undefined; + } + return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); + case 147: + case 146: + return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberFunctionElement); + case 149: + return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberGetAccessorElement); + case 150: + return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberSetAccessorElement); + case 153: + return createItem(node, "[]", ts.ScriptElementKind.indexSignatureElement); + case 255: + return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); + case 151: + return createItem(node, "()", ts.ScriptElementKind.callSignatureElement); + case 152: + return createItem(node, "new()", ts.ScriptElementKind.constructSignatureElement); + case 145: + case 144: + return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); + case 220: + return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.functionElement); + case 218: + case 169: + var variableDeclarationNode = void 0; + var name_35; + if (node.kind === 169) { + name_35 = node.name; + variableDeclarationNode = node; + while (variableDeclarationNode && variableDeclarationNode.kind !== 218) { + variableDeclarationNode = variableDeclarationNode.parent; + } + ts.Debug.assert(variableDeclarationNode !== undefined); + } + else { + ts.Debug.assert(!ts.isBindingPattern(node.name)); + variableDeclarationNode = node; + name_35 = node.name; + } + if (ts.isConst(variableDeclarationNode)) { + return createItem(node, getTextOfNode(name_35), ts.ScriptElementKind.constElement); + } + else if (ts.isLet(variableDeclarationNode)) { + return createItem(node, getTextOfNode(name_35), ts.ScriptElementKind.letElement); + } + else { + return createItem(node, getTextOfNode(name_35), ts.ScriptElementKind.variableElement); + } + case 148: + return createItem(node, "constructor", ts.ScriptElementKind.constructorImplementationElement); + case 238: + case 234: + case 229: + case 231: + case 232: + return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.alias); + } + return undefined; + function createItem(node, name, scriptElementKind) { + return getNavigationBarItem(name, scriptElementKind, ts.getNodeModifiers(node), [getNodeSpan(node)]); + } + } + function isEmpty(text) { + return !text || text.trim() === ""; + } + function getNavigationBarItem(text, kind, kindModifiers, spans, childItems, indent) { + if (childItems === void 0) { childItems = []; } + if (indent === void 0) { indent = 0; } + if (isEmpty(text)) { + return undefined; + } + return { + text: text, + kind: kind, + kindModifiers: kindModifiers, + spans: spans, + childItems: childItems, + indent: indent, + bolded: false, + grayed: false + }; + } + function createTopLevelItem(node) { + switch (node.kind) { + case 256: + return createSourceFileItem(node); + case 221: + return createClassItem(node); + case 147: + case 148: + return createMemberFunctionLikeItem(node); + case 224: + return createEnumItem(node); + case 222: + return createInterfaceItem(node); + case 225: + return createModuleItem(node); + case 220: + return createFunctionItem(node); + case 223: + return createTypeAliasItem(node); + } + return undefined; + function getModuleName(moduleDeclaration) { + if (ts.isAmbientModule(moduleDeclaration)) { + return getTextOfNode(moduleDeclaration.name); + } + var result = []; + result.push(moduleDeclaration.name.text); + while (moduleDeclaration.body && moduleDeclaration.body.kind === 225) { + moduleDeclaration = moduleDeclaration.body; + result.push(moduleDeclaration.name.text); + } + return result.join("."); + } + function createModuleItem(node) { + var moduleName = getModuleName(node); + var childItems = getItemsWorker(getChildNodes(getInnermostModule(node).body.statements), createChildItem); + return getNavigationBarItem(moduleName, ts.ScriptElementKind.moduleElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); + } + function createFunctionItem(node) { + if (node.body && node.body.kind === 199) { + var childItems = getItemsWorker(sortNodes(node.body.statements), createChildItem); + return getNavigationBarItem(!node.name ? "default" : node.name.text, ts.ScriptElementKind.functionElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); + } + return undefined; + } + function createTypeAliasItem(node) { + return getNavigationBarItem(node.name.text, ts.ScriptElementKind.typeElement, ts.getNodeModifiers(node), [getNodeSpan(node)], [], getIndent(node)); + } + function createMemberFunctionLikeItem(node) { + if (node.body && node.body.kind === 199) { + var childItems = getItemsWorker(sortNodes(node.body.statements), createChildItem); + var scriptElementKind = void 0; + var memberFunctionName = void 0; + if (node.kind === 147) { + memberFunctionName = ts.getPropertyNameForPropertyNameNode(node.name); + scriptElementKind = ts.ScriptElementKind.memberFunctionElement; + } + else { + memberFunctionName = "constructor"; + scriptElementKind = ts.ScriptElementKind.constructorImplementationElement; + } + return getNavigationBarItem(memberFunctionName, scriptElementKind, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); + } + return undefined; + } + function createSourceFileItem(node) { + var childItems = getItemsWorker(getChildNodes(node.statements), createChildItem); + if (childItems === undefined || childItems.length === 0) { + return undefined; + } + hasGlobalNode = true; + var rootName = ts.isExternalModule(node) + ? "\"" + ts.escapeString(ts.getBaseFileName(ts.removeFileExtension(ts.normalizePath(node.fileName)))) + "\"" + : ""; + return getNavigationBarItem(rootName, ts.ScriptElementKind.moduleElement, ts.ScriptElementKindModifier.none, [getNodeSpan(node)], childItems); + } + function createClassItem(node) { + var childItems; + if (node.members) { + var constructor = ts.forEach(node.members, function (member) { + return member.kind === 148 && member; + }); + var nodes = removeDynamicallyNamedProperties(node); + if (constructor) { + ts.addRange(nodes, ts.filter(constructor.parameters, function (p) { return !ts.isBindingPattern(p.name); })); + } + childItems = getItemsWorker(sortNodes(nodes), createChildItem); + } + var nodeName = !node.name ? "default" : node.name.text; + return getNavigationBarItem(nodeName, ts.ScriptElementKind.classElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); + } + function createEnumItem(node) { + var childItems = getItemsWorker(sortNodes(removeComputedProperties(node)), createChildItem); + return getNavigationBarItem(node.name.text, ts.ScriptElementKind.enumElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); + } + function createInterfaceItem(node) { + var childItems = getItemsWorker(sortNodes(removeDynamicallyNamedProperties(node)), createChildItem); + return getNavigationBarItem(node.name.text, ts.ScriptElementKind.interfaceElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); + } + } + function removeComputedProperties(node) { + return ts.filter(node.members, function (member) { return member.name === undefined || member.name.kind !== 140; }); + } + function removeDynamicallyNamedProperties(node) { + return ts.filter(node.members, function (member) { return !ts.hasDynamicName(member); }); + } + function getInnermostModule(node) { + while (node.body.kind === 225) { + node = node.body; + } + return node; + } + function getNodeSpan(node) { + return node.kind === 256 + ? ts.createTextSpanFromBounds(node.getFullStart(), node.getEnd()) + : ts.createTextSpanFromBounds(node.getStart(), node.getEnd()); + } + function getTextOfNode(node) { + return ts.getTextOfNodeFromSourceText(sourceFile.text, node); + } + } + NavigationBar.getNavigationBarItems = getNavigationBarItems; + function getJsNavigationBarItems(sourceFile, compilerOptions) { + var anonFnText = ""; + var anonClassText = ""; + var indent = 0; + var rootName = ts.isExternalModule(sourceFile) ? + "\"" + ts.escapeString(ts.getBaseFileName(ts.removeFileExtension(ts.normalizePath(sourceFile.fileName)))) + "\"" + : ""; + var sourceFileItem = getNavBarItem(rootName, ts.ScriptElementKind.moduleElement, [getNodeSpan(sourceFile)]); + var topItem = sourceFileItem; + ts.forEachChild(sourceFile, visitNode); + function visitNode(node) { + var newItem = createNavBarItem(node); + if (newItem) { + topItem.childItems.push(newItem); + } + if (newItem && (ts.isFunctionLike(node) || ts.isClassLike(node))) { + var lastTop = topItem; + indent++; + topItem = newItem; + ts.forEachChild(node, visitNode); + topItem = lastTop; + indent--; + if (newItem && newItem.text === anonFnText && newItem.childItems.length === 0) { + topItem.childItems.pop(); + } + } + else { + ts.forEachChild(node, visitNode); + } + } + function createNavBarItem(node) { + switch (node.kind) { + case 218: + if (node.parent.parent + .parent.kind !== 256) { + return undefined; + } + var varDecl = node; + if (varDecl.initializer && (varDecl.initializer.kind === 179 || + varDecl.initializer.kind === 180 || + varDecl.initializer.kind === 192)) { + return undefined; + } + case 220: + case 221: + case 148: + case 149: + case 150: + var name_36 = node.flags && (node.flags & 512) && !node.name ? "default" : + node.kind === 148 ? "constructor" : + ts.declarationNameToString(node.name); + return getNavBarItem(name_36, getScriptKindForElementKind(node.kind), [getNodeSpan(node)]); + case 179: + case 180: + case 192: + return getDefineModuleItem(node) || getFunctionOrClassExpressionItem(node); + case 147: + var methodDecl = node; + return getNavBarItem(ts.declarationNameToString(methodDecl.name), ts.ScriptElementKind.memberFunctionElement, [getNodeSpan(node)]); + case 235: + return getNavBarItem("default", ts.ScriptElementKind.variableElement, [getNodeSpan(node)]); + case 231: + if (!node.name) { + return undefined; + } + case 234: + case 232: + case 238: + if (node.kind === 238) { + if (!node.parent.parent.moduleSpecifier && !node.propertyName) { + return undefined; + } + } + var decl = node; + if (!decl.name) { + return undefined; + } + var declName = ts.declarationNameToString(decl.name); + return getNavBarItem(declName, ts.ScriptElementKind.constElement, [getNodeSpan(node)]); + default: + return undefined; + } + } + function getNavBarItem(text, kind, spans, kindModifiers) { + if (kindModifiers === void 0) { kindModifiers = ts.ScriptElementKindModifier.none; } + return { + text: text, kind: kind, kindModifiers: kindModifiers, spans: spans, childItems: [], indent: indent, bolded: false, grayed: false + }; + } + function getDefineModuleItem(node) { + if (node.kind !== 179 && node.kind !== 180) { + return undefined; + } + if (node.parent.kind !== 174) { + return undefined; + } + var callExpr = node.parent; + if (callExpr.expression.kind !== 69 || callExpr.expression.getText() !== "define") { + return undefined; + } + var defaultName = node.getSourceFile().fileName; + if (callExpr.arguments[0].kind === 9) { + defaultName = (callExpr.arguments[0]).text; + } + return getNavBarItem(defaultName, ts.ScriptElementKind.moduleElement, [getNodeSpan(node.parent)]); + } + function getFunctionOrClassExpressionItem(node) { + if (node.kind !== 179 && + node.kind !== 180 && + node.kind !== 192) { + return undefined; + } + var fnExpr = node; + var fnName; + if (fnExpr.name && ts.getFullWidth(fnExpr.name) > 0) { + fnName = ts.declarationNameToString(fnExpr.name); + } + else { + if (fnExpr.parent.kind === 218) { + fnName = ts.declarationNameToString(fnExpr.parent.name); + } + else if (fnExpr.parent.kind === 187 && + fnExpr.parent.operatorToken.kind === 56) { + fnName = fnExpr.parent.left.getText(); + } + else if (fnExpr.parent.kind === 253 && + fnExpr.parent.name) { + fnName = fnExpr.parent.name.getText(); + } + else { + fnName = node.kind === 192 ? anonClassText : anonFnText; + } + } + var scriptKind = node.kind === 192 ? ts.ScriptElementKind.classElement : ts.ScriptElementKind.functionElement; + return getNavBarItem(fnName, scriptKind, [getNodeSpan(node)]); + } + function getNodeSpan(node) { + return node.kind === 256 + ? ts.createTextSpanFromBounds(node.getFullStart(), node.getEnd()) + : ts.createTextSpanFromBounds(node.getStart(), node.getEnd()); + } + function getScriptKindForElementKind(kind) { + switch (kind) { + case 218: + return ts.ScriptElementKind.variableElement; + case 220: + return ts.ScriptElementKind.functionElement; + case 221: + return ts.ScriptElementKind.classElement; + case 148: + return ts.ScriptElementKind.constructorImplementationElement; + case 149: + return ts.ScriptElementKind.memberGetAccessorElement; + case 150: + return ts.ScriptElementKind.memberSetAccessorElement; + default: + return "unknown"; + } + } + return sourceFileItem.childItems; + } + NavigationBar.getJsNavigationBarItems = getJsNavigationBarItems; + })(NavigationBar = ts.NavigationBar || (ts.NavigationBar = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + (function (PatternMatchKind) { + PatternMatchKind[PatternMatchKind["exact"] = 0] = "exact"; + PatternMatchKind[PatternMatchKind["prefix"] = 1] = "prefix"; + PatternMatchKind[PatternMatchKind["substring"] = 2] = "substring"; + PatternMatchKind[PatternMatchKind["camelCase"] = 3] = "camelCase"; + })(ts.PatternMatchKind || (ts.PatternMatchKind = {})); + var PatternMatchKind = ts.PatternMatchKind; + function createPatternMatch(kind, punctuationStripped, isCaseSensitive, camelCaseWeight) { + return { + kind: kind, + punctuationStripped: punctuationStripped, + isCaseSensitive: isCaseSensitive, + camelCaseWeight: camelCaseWeight + }; + } + function createPatternMatcher(pattern) { + var stringToWordSpans = {}; + pattern = pattern.trim(); + var dotSeparatedSegments = pattern.split(".").map(function (p) { return createSegment(p.trim()); }); + var invalidPattern = dotSeparatedSegments.length === 0 || ts.forEach(dotSeparatedSegments, segmentIsInvalid); + return { + getMatches: getMatches, + getMatchesForLastSegmentOfPattern: getMatchesForLastSegmentOfPattern, + patternContainsDots: dotSeparatedSegments.length > 1 + }; + function skipMatch(candidate) { + return invalidPattern || !candidate; + } + function getMatchesForLastSegmentOfPattern(candidate) { + if (skipMatch(candidate)) { + return undefined; + } + return matchSegment(candidate, ts.lastOrUndefined(dotSeparatedSegments)); + } + function getMatches(candidateContainers, candidate) { + if (skipMatch(candidate)) { + return undefined; + } + var candidateMatch = matchSegment(candidate, ts.lastOrUndefined(dotSeparatedSegments)); + if (!candidateMatch) { + return undefined; + } + candidateContainers = candidateContainers || []; + if (dotSeparatedSegments.length - 1 > candidateContainers.length) { + return undefined; + } + var totalMatch = candidateMatch; + for (var i = dotSeparatedSegments.length - 2, j = candidateContainers.length - 1; i >= 0; i -= 1, j -= 1) { + var segment = dotSeparatedSegments[i]; + var containerName = candidateContainers[j]; + var containerMatch = matchSegment(containerName, segment); + if (!containerMatch) { + return undefined; + } + ts.addRange(totalMatch, containerMatch); + } + return totalMatch; + } + function getWordSpans(word) { + if (!ts.hasProperty(stringToWordSpans, word)) { + stringToWordSpans[word] = breakIntoWordSpans(word); + } + return stringToWordSpans[word]; + } + function matchTextChunk(candidate, chunk, punctuationStripped) { + var index = indexOfIgnoringCase(candidate, chunk.textLowerCase); + if (index === 0) { + if (chunk.text.length === candidate.length) { + return createPatternMatch(PatternMatchKind.exact, punctuationStripped, candidate === chunk.text); + } + else { + return createPatternMatch(PatternMatchKind.prefix, punctuationStripped, startsWith(candidate, chunk.text)); + } + } + var isLowercase = chunk.isLowerCase; + if (isLowercase) { + if (index > 0) { + var wordSpans = getWordSpans(candidate); + for (var _i = 0, wordSpans_1 = wordSpans; _i < wordSpans_1.length; _i++) { + var span = wordSpans_1[_i]; + if (partStartsWith(candidate, span, chunk.text, true)) { + return createPatternMatch(PatternMatchKind.substring, punctuationStripped, partStartsWith(candidate, span, chunk.text, false)); + } + } + } + } + else { + if (candidate.indexOf(chunk.text) > 0) { + return createPatternMatch(PatternMatchKind.substring, punctuationStripped, true); + } + } + if (!isLowercase) { + if (chunk.characterSpans.length > 0) { + var candidateParts = getWordSpans(candidate); + var camelCaseWeight = tryCamelCaseMatch(candidate, candidateParts, chunk, false); + if (camelCaseWeight !== undefined) { + return createPatternMatch(PatternMatchKind.camelCase, punctuationStripped, true, camelCaseWeight); + } + camelCaseWeight = tryCamelCaseMatch(candidate, candidateParts, chunk, true); + if (camelCaseWeight !== undefined) { + return createPatternMatch(PatternMatchKind.camelCase, punctuationStripped, false, camelCaseWeight); + } + } + } + if (isLowercase) { + if (chunk.text.length < candidate.length) { + if (index > 0 && isUpperCaseLetter(candidate.charCodeAt(index))) { + return createPatternMatch(PatternMatchKind.substring, punctuationStripped, false); + } + } + } + return undefined; + } + function containsSpaceOrAsterisk(text) { + for (var i = 0; i < text.length; i++) { + var ch = text.charCodeAt(i); + if (ch === 32 || ch === 42) { + return true; + } + } + return false; + } + function matchSegment(candidate, segment) { + if (!containsSpaceOrAsterisk(segment.totalTextChunk.text)) { + var match = matchTextChunk(candidate, segment.totalTextChunk, false); + if (match) { + return [match]; + } + } + var subWordTextChunks = segment.subWordTextChunks; + var matches = undefined; + for (var _i = 0, subWordTextChunks_1 = subWordTextChunks; _i < subWordTextChunks_1.length; _i++) { + var subWordTextChunk = subWordTextChunks_1[_i]; + var result = matchTextChunk(candidate, subWordTextChunk, true); + if (!result) { + return undefined; + } + matches = matches || []; + matches.push(result); + } + return matches; + } + function partStartsWith(candidate, candidateSpan, pattern, ignoreCase, patternSpan) { + var patternPartStart = patternSpan ? patternSpan.start : 0; + var patternPartLength = patternSpan ? patternSpan.length : pattern.length; + if (patternPartLength > candidateSpan.length) { + return false; + } + if (ignoreCase) { + for (var i = 0; i < patternPartLength; i++) { + var ch1 = pattern.charCodeAt(patternPartStart + i); + var ch2 = candidate.charCodeAt(candidateSpan.start + i); + if (toLowerCase(ch1) !== toLowerCase(ch2)) { + return false; + } + } + } + else { + for (var i = 0; i < patternPartLength; i++) { + var ch1 = pattern.charCodeAt(patternPartStart + i); + var ch2 = candidate.charCodeAt(candidateSpan.start + i); + if (ch1 !== ch2) { + return false; + } + } + } + return true; + } + function tryCamelCaseMatch(candidate, candidateParts, chunk, ignoreCase) { + var chunkCharacterSpans = chunk.characterSpans; + var currentCandidate = 0; + var currentChunkSpan = 0; + var firstMatch = undefined; + var contiguous = undefined; + while (true) { + if (currentChunkSpan === chunkCharacterSpans.length) { + var weight = 0; + if (contiguous) { + weight += 1; + } + if (firstMatch === 0) { + weight += 2; + } + return weight; + } + else if (currentCandidate === candidateParts.length) { + return undefined; + } + var candidatePart = candidateParts[currentCandidate]; + var gotOneMatchThisCandidate = false; + for (; currentChunkSpan < chunkCharacterSpans.length; currentChunkSpan++) { + var chunkCharacterSpan = chunkCharacterSpans[currentChunkSpan]; + if (gotOneMatchThisCandidate) { + if (!isUpperCaseLetter(chunk.text.charCodeAt(chunkCharacterSpans[currentChunkSpan - 1].start)) || + !isUpperCaseLetter(chunk.text.charCodeAt(chunkCharacterSpans[currentChunkSpan].start))) { + break; + } + } + if (!partStartsWith(candidate, candidatePart, chunk.text, ignoreCase, chunkCharacterSpan)) { + break; + } + gotOneMatchThisCandidate = true; + firstMatch = firstMatch === undefined ? currentCandidate : firstMatch; + contiguous = contiguous === undefined ? true : contiguous; + candidatePart = ts.createTextSpan(candidatePart.start + chunkCharacterSpan.length, candidatePart.length - chunkCharacterSpan.length); + } + if (!gotOneMatchThisCandidate && contiguous !== undefined) { + contiguous = false; + } + currentCandidate++; + } + } + } + ts.createPatternMatcher = createPatternMatcher; + function createSegment(text) { + return { + totalTextChunk: createTextChunk(text), + subWordTextChunks: breakPatternIntoTextChunks(text) + }; + } + function segmentIsInvalid(segment) { + return segment.subWordTextChunks.length === 0; + } + function isUpperCaseLetter(ch) { + if (ch >= 65 && ch <= 90) { + return true; + } + if (ch < 127 || !ts.isUnicodeIdentifierStart(ch, 2)) { + return false; + } + var str = String.fromCharCode(ch); + return str === str.toUpperCase(); + } + function isLowerCaseLetter(ch) { + if (ch >= 97 && ch <= 122) { + return true; + } + if (ch < 127 || !ts.isUnicodeIdentifierStart(ch, 2)) { + return false; + } + var str = String.fromCharCode(ch); + return str === str.toLowerCase(); + } + function startsWith(string, search) { + for (var i = 0, n = search.length; i < n; i++) { + if (string.charCodeAt(i) !== search.charCodeAt(i)) { + return false; + } + } + return true; + } + function indexOfIgnoringCase(string, value) { + for (var i = 0, n = string.length - value.length; i <= n; i++) { + if (startsWithIgnoringCase(string, value, i)) { + return i; + } + } + return -1; + } + function startsWithIgnoringCase(string, value, start) { + for (var i = 0, n = value.length; i < n; i++) { + var ch1 = toLowerCase(string.charCodeAt(i + start)); + var ch2 = value.charCodeAt(i); + if (ch1 !== ch2) { + return false; + } + } + return true; + } + function toLowerCase(ch) { + if (ch >= 65 && ch <= 90) { + return 97 + (ch - 65); + } + if (ch < 127) { + return ch; + } + return String.fromCharCode(ch).toLowerCase().charCodeAt(0); + } + function isDigit(ch) { + return ch >= 48 && ch <= 57; + } + function isWordChar(ch) { + return isUpperCaseLetter(ch) || isLowerCaseLetter(ch) || isDigit(ch) || ch === 95 || ch === 36; + } + function breakPatternIntoTextChunks(pattern) { + var result = []; + var wordStart = 0; + var wordLength = 0; + for (var i = 0; i < pattern.length; i++) { + var ch = pattern.charCodeAt(i); + if (isWordChar(ch)) { + if (wordLength === 0) { + wordStart = i; + } + wordLength++; + } + else { + if (wordLength > 0) { + result.push(createTextChunk(pattern.substr(wordStart, wordLength))); + wordLength = 0; + } + } + } + if (wordLength > 0) { + result.push(createTextChunk(pattern.substr(wordStart, wordLength))); + } + return result; + } + function createTextChunk(text) { + var textLowerCase = text.toLowerCase(); + return { + text: text, + textLowerCase: textLowerCase, + isLowerCase: text === textLowerCase, + characterSpans: breakIntoCharacterSpans(text) + }; + } + function breakIntoCharacterSpans(identifier) { + return breakIntoSpans(identifier, false); + } + ts.breakIntoCharacterSpans = breakIntoCharacterSpans; + function breakIntoWordSpans(identifier) { + return breakIntoSpans(identifier, true); + } + ts.breakIntoWordSpans = breakIntoWordSpans; + function breakIntoSpans(identifier, word) { + var result = []; + var wordStart = 0; + for (var i = 1, n = identifier.length; i < n; i++) { + var lastIsDigit = isDigit(identifier.charCodeAt(i - 1)); + var currentIsDigit = isDigit(identifier.charCodeAt(i)); + var hasTransitionFromLowerToUpper = transitionFromLowerToUpper(identifier, word, i); + var hasTransitionFromUpperToLower = transitionFromUpperToLower(identifier, word, i, wordStart); + if (charIsPunctuation(identifier.charCodeAt(i - 1)) || + charIsPunctuation(identifier.charCodeAt(i)) || + lastIsDigit !== currentIsDigit || + hasTransitionFromLowerToUpper || + hasTransitionFromUpperToLower) { + if (!isAllPunctuation(identifier, wordStart, i)) { + result.push(ts.createTextSpan(wordStart, i - wordStart)); + } + wordStart = i; + } + } + if (!isAllPunctuation(identifier, wordStart, identifier.length)) { + result.push(ts.createTextSpan(wordStart, identifier.length - wordStart)); + } + return result; + } + function charIsPunctuation(ch) { + switch (ch) { + case 33: + case 34: + case 35: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 44: + case 45: + case 46: + case 47: + case 58: + case 59: + case 63: + case 64: + case 91: + case 92: + case 93: + case 95: + case 123: + case 125: + return true; + } + return false; + } + function isAllPunctuation(identifier, start, end) { + for (var i = start; i < end; i++) { + var ch = identifier.charCodeAt(i); + if (!charIsPunctuation(ch) || ch === 95 || ch === 36) { + return false; + } + } + return true; + } + function transitionFromUpperToLower(identifier, word, index, wordStart) { + if (word) { + if (index !== wordStart && + index + 1 < identifier.length) { + var currentIsUpper = isUpperCaseLetter(identifier.charCodeAt(index)); + var nextIsLower = isLowerCaseLetter(identifier.charCodeAt(index + 1)); + if (currentIsUpper && nextIsLower) { + for (var i = wordStart; i < index; i++) { + if (!isUpperCaseLetter(identifier.charCodeAt(i))) { + return false; + } + } + return true; + } + } + } + return false; + } + function transitionFromLowerToUpper(identifier, word, index) { + var lastIsUpper = isUpperCaseLetter(identifier.charCodeAt(index - 1)); + var currentIsUpper = isUpperCaseLetter(identifier.charCodeAt(index)); + var transition = word + ? (currentIsUpper && !lastIsUpper) + : currentIsUpper; + return transition; + } +})(ts || (ts = {})); +var ts; +(function (ts) { + var SignatureHelp; + (function (SignatureHelp) { + var emptyArray = []; + function getSignatureHelpItems(program, sourceFile, position, cancellationToken) { + var typeChecker = program.getTypeChecker(); + var startingToken = ts.findTokenOnLeftOfPosition(sourceFile, position); + if (!startingToken) { + return undefined; + } + var argumentInfo = getContainingArgumentInfo(startingToken); + cancellationToken.throwIfCancellationRequested(); + if (!argumentInfo) { + return undefined; + } + var call = argumentInfo.invocation; + var candidates = []; + var resolvedSignature = typeChecker.getResolvedSignature(call, candidates); + cancellationToken.throwIfCancellationRequested(); + if (!candidates.length) { + if (ts.isSourceFileJavaScript(sourceFile)) { + return createJavaScriptSignatureHelpItems(argumentInfo); + } + return undefined; + } + return createSignatureHelpItems(candidates, resolvedSignature, argumentInfo); + function createJavaScriptSignatureHelpItems(argumentInfo) { + if (argumentInfo.invocation.kind !== 174) { + return undefined; + } + var callExpression = argumentInfo.invocation; + var expression = callExpression.expression; + var name = expression.kind === 69 + ? expression + : expression.kind === 172 + ? expression.name + : undefined; + if (!name || !name.text) { + return undefined; + } + var typeChecker = program.getTypeChecker(); + for (var _i = 0, _a = program.getSourceFiles(); _i < _a.length; _i++) { + var sourceFile_1 = _a[_i]; + var nameToDeclarations = sourceFile_1.getNamedDeclarations(); + var declarations = ts.getProperty(nameToDeclarations, name.text); + if (declarations) { + for (var _b = 0, declarations_8 = declarations; _b < declarations_8.length; _b++) { + var declaration = declarations_8[_b]; + var symbol = declaration.symbol; + if (symbol) { + var type = typeChecker.getTypeOfSymbolAtLocation(symbol, declaration); + if (type) { + var callSignatures = type.getCallSignatures(); + if (callSignatures && callSignatures.length) { + return createSignatureHelpItems(callSignatures, callSignatures[0], argumentInfo); + } + } + } + } + } + } + } + function getImmediatelyContainingArgumentInfo(node) { + if (node.parent.kind === 174 || node.parent.kind === 175) { + var callExpression = node.parent; + if (node.kind === 25 || + node.kind === 17) { + var list = getChildListThatStartsWithOpenerToken(callExpression, node, sourceFile); + var isTypeArgList = callExpression.typeArguments && callExpression.typeArguments.pos === list.pos; + ts.Debug.assert(list !== undefined); + return { + kind: isTypeArgList ? 0 : 1, + invocation: callExpression, + argumentsSpan: getApplicableSpanForArguments(list), + argumentIndex: 0, + argumentCount: getArgumentCount(list) + }; + } + var listItemInfo = ts.findListItemInfo(node); + if (listItemInfo) { + var list = listItemInfo.list; + var isTypeArgList = callExpression.typeArguments && callExpression.typeArguments.pos === list.pos; + var argumentIndex = getArgumentIndex(list, node); + var argumentCount = getArgumentCount(list); + ts.Debug.assert(argumentIndex === 0 || argumentIndex < argumentCount, "argumentCount < argumentIndex, " + argumentCount + " < " + argumentIndex); + return { + kind: isTypeArgList ? 0 : 1, + invocation: callExpression, + argumentsSpan: getApplicableSpanForArguments(list), + argumentIndex: argumentIndex, + argumentCount: argumentCount + }; + } + } + else if (node.kind === 11 && node.parent.kind === 176) { + if (ts.isInsideTemplateLiteral(node, position)) { + return getArgumentListInfoForTemplate(node.parent, 0); + } + } + else if (node.kind === 12 && node.parent.parent.kind === 176) { + var templateExpression = node.parent; + var tagExpression = templateExpression.parent; + ts.Debug.assert(templateExpression.kind === 189); + var argumentIndex = ts.isInsideTemplateLiteral(node, position) ? 0 : 1; + return getArgumentListInfoForTemplate(tagExpression, argumentIndex); + } + else if (node.parent.kind === 197 && node.parent.parent.parent.kind === 176) { + var templateSpan = node.parent; + var templateExpression = templateSpan.parent; + var tagExpression = templateExpression.parent; + ts.Debug.assert(templateExpression.kind === 189); + if (node.kind === 14 && !ts.isInsideTemplateLiteral(node, position)) { + return undefined; + } + var spanIndex = templateExpression.templateSpans.indexOf(templateSpan); + var argumentIndex = getArgumentIndexForTemplatePiece(spanIndex, node); + return getArgumentListInfoForTemplate(tagExpression, argumentIndex); + } + return undefined; + } + function getArgumentIndex(argumentsList, node) { + var argumentIndex = 0; + var listChildren = argumentsList.getChildren(); + for (var _i = 0, listChildren_1 = listChildren; _i < listChildren_1.length; _i++) { + var child = listChildren_1[_i]; + if (child === node) { + break; + } + if (child.kind !== 24) { + argumentIndex++; + } + } + return argumentIndex; + } + function getArgumentCount(argumentsList) { + var listChildren = argumentsList.getChildren(); + var argumentCount = ts.countWhere(listChildren, function (arg) { return arg.kind !== 24; }); + if (listChildren.length > 0 && ts.lastOrUndefined(listChildren).kind === 24) { + argumentCount++; + } + return argumentCount; + } + function getArgumentIndexForTemplatePiece(spanIndex, node) { + ts.Debug.assert(position >= node.getStart(), "Assumed 'position' could not occur before node."); + if (ts.isTemplateLiteralKind(node.kind)) { + if (ts.isInsideTemplateLiteral(node, position)) { + return 0; + } + return spanIndex + 2; + } + return spanIndex + 1; + } + function getArgumentListInfoForTemplate(tagExpression, argumentIndex) { + var argumentCount = tagExpression.template.kind === 11 + ? 1 + : tagExpression.template.templateSpans.length + 1; + ts.Debug.assert(argumentIndex === 0 || argumentIndex < argumentCount, "argumentCount < argumentIndex, " + argumentCount + " < " + argumentIndex); + return { + kind: 2, + invocation: tagExpression, + argumentsSpan: getApplicableSpanForTaggedTemplate(tagExpression), + argumentIndex: argumentIndex, + argumentCount: argumentCount + }; + } + function getApplicableSpanForArguments(argumentsList) { + var applicableSpanStart = argumentsList.getFullStart(); + var applicableSpanEnd = ts.skipTrivia(sourceFile.text, argumentsList.getEnd(), false); + return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart); + } + function getApplicableSpanForTaggedTemplate(taggedTemplate) { + var template = taggedTemplate.template; + var applicableSpanStart = template.getStart(); + var applicableSpanEnd = template.getEnd(); + if (template.kind === 189) { + var lastSpan = ts.lastOrUndefined(template.templateSpans); + if (lastSpan.literal.getFullWidth() === 0) { + applicableSpanEnd = ts.skipTrivia(sourceFile.text, applicableSpanEnd, false); + } + } + return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart); + } + function getContainingArgumentInfo(node) { + for (var n = node; n.kind !== 256; n = n.parent) { + if (ts.isFunctionBlock(n)) { + return undefined; + } + if (n.pos < n.parent.pos || n.end > n.parent.end) { + ts.Debug.fail("Node of kind " + n.kind + " is not a subspan of its parent of kind " + n.parent.kind); + } + var argumentInfo_1 = getImmediatelyContainingArgumentInfo(n); + if (argumentInfo_1) { + return argumentInfo_1; + } + } + return undefined; + } + function getChildListThatStartsWithOpenerToken(parent, openerToken, sourceFile) { + var children = parent.getChildren(sourceFile); + var indexOfOpenerToken = children.indexOf(openerToken); + ts.Debug.assert(indexOfOpenerToken >= 0 && children.length > indexOfOpenerToken + 1); + return children[indexOfOpenerToken + 1]; + } + function selectBestInvalidOverloadIndex(candidates, argumentCount) { + var maxParamsSignatureIndex = -1; + var maxParams = -1; + for (var i = 0; i < candidates.length; i++) { + var candidate = candidates[i]; + if (candidate.hasRestParameter || candidate.parameters.length >= argumentCount) { + return i; + } + if (candidate.parameters.length > maxParams) { + maxParams = candidate.parameters.length; + maxParamsSignatureIndex = i; + } + } + return maxParamsSignatureIndex; + } + function createSignatureHelpItems(candidates, bestSignature, argumentListInfo) { + var applicableSpan = argumentListInfo.argumentsSpan; + var isTypeParameterList = argumentListInfo.kind === 0; + var invocation = argumentListInfo.invocation; + var callTarget = ts.getInvokedExpression(invocation); + var callTargetSymbol = typeChecker.getSymbolAtLocation(callTarget); + var callTargetDisplayParts = callTargetSymbol && ts.symbolToDisplayParts(typeChecker, callTargetSymbol, undefined, undefined); + var items = ts.map(candidates, function (candidateSignature) { + var signatureHelpParameters; + var prefixDisplayParts = []; + var suffixDisplayParts = []; + if (callTargetDisplayParts) { + ts.addRange(prefixDisplayParts, callTargetDisplayParts); + } + if (isTypeParameterList) { + prefixDisplayParts.push(ts.punctuationPart(25)); + var typeParameters = candidateSignature.typeParameters; + signatureHelpParameters = typeParameters && typeParameters.length > 0 ? ts.map(typeParameters, createSignatureHelpParameterForTypeParameter) : emptyArray; + suffixDisplayParts.push(ts.punctuationPart(27)); + var parameterParts = ts.mapToDisplayParts(function (writer) { + return typeChecker.getSymbolDisplayBuilder().buildDisplayForParametersAndDelimiters(candidateSignature.thisType, candidateSignature.parameters, writer, invocation); + }); + ts.addRange(suffixDisplayParts, parameterParts); + } + else { + var typeParameterParts = ts.mapToDisplayParts(function (writer) { + return typeChecker.getSymbolDisplayBuilder().buildDisplayForTypeParametersAndDelimiters(candidateSignature.typeParameters, writer, invocation); + }); + ts.addRange(prefixDisplayParts, typeParameterParts); + prefixDisplayParts.push(ts.punctuationPart(17)); + var parameters = candidateSignature.parameters; + signatureHelpParameters = parameters.length > 0 ? ts.map(parameters, createSignatureHelpParameterForParameter) : emptyArray; + suffixDisplayParts.push(ts.punctuationPart(18)); + } + var returnTypeParts = ts.mapToDisplayParts(function (writer) { + return typeChecker.getSymbolDisplayBuilder().buildReturnTypeDisplay(candidateSignature, writer, invocation); + }); + ts.addRange(suffixDisplayParts, returnTypeParts); + return { + isVariadic: candidateSignature.hasRestParameter, + prefixDisplayParts: prefixDisplayParts, + suffixDisplayParts: suffixDisplayParts, + separatorDisplayParts: [ts.punctuationPart(24), ts.spacePart()], + parameters: signatureHelpParameters, + documentation: candidateSignature.getDocumentationComment() + }; + }); + var argumentIndex = argumentListInfo.argumentIndex; + var argumentCount = argumentListInfo.argumentCount; + var selectedItemIndex = candidates.indexOf(bestSignature); + if (selectedItemIndex < 0) { + selectedItemIndex = selectBestInvalidOverloadIndex(candidates, argumentCount); + } + ts.Debug.assert(argumentIndex === 0 || argumentIndex < argumentCount, "argumentCount < argumentIndex, " + argumentCount + " < " + argumentIndex); + return { + items: items, + applicableSpan: applicableSpan, + selectedItemIndex: selectedItemIndex, + argumentIndex: argumentIndex, + argumentCount: argumentCount + }; + function createSignatureHelpParameterForParameter(parameter) { + var displayParts = ts.mapToDisplayParts(function (writer) { + return typeChecker.getSymbolDisplayBuilder().buildParameterDisplay(parameter, writer, invocation); + }); + return { + name: parameter.name, + documentation: parameter.getDocumentationComment(), + displayParts: displayParts, + isOptional: typeChecker.isOptionalParameter(parameter.valueDeclaration) + }; + } + function createSignatureHelpParameterForTypeParameter(typeParameter) { + var displayParts = ts.mapToDisplayParts(function (writer) { + return typeChecker.getSymbolDisplayBuilder().buildTypeParameterDisplay(typeParameter, writer, invocation); + }); + return { + name: typeParameter.symbol.name, + documentation: emptyArray, + displayParts: displayParts, + isOptional: false + }; + } + } + } + SignatureHelp.getSignatureHelpItems = getSignatureHelpItems; + })(SignatureHelp = ts.SignatureHelp || (ts.SignatureHelp = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + function getLineStartPositionForPosition(position, sourceFile) { + var lineStarts = sourceFile.getLineStarts(); + var line = sourceFile.getLineAndCharacterOfPosition(position).line; + return lineStarts[line]; + } + ts.getLineStartPositionForPosition = getLineStartPositionForPosition; + function rangeContainsRange(r1, r2) { + return startEndContainsRange(r1.pos, r1.end, r2); + } + ts.rangeContainsRange = rangeContainsRange; + function startEndContainsRange(start, end, range) { + return start <= range.pos && end >= range.end; + } + ts.startEndContainsRange = startEndContainsRange; + function rangeContainsStartEnd(range, start, end) { + return range.pos <= start && range.end >= end; + } + ts.rangeContainsStartEnd = rangeContainsStartEnd; + function rangeOverlapsWithStartEnd(r1, start, end) { + return startEndOverlapsWithStartEnd(r1.pos, r1.end, start, end); + } + ts.rangeOverlapsWithStartEnd = rangeOverlapsWithStartEnd; + function startEndOverlapsWithStartEnd(start1, end1, start2, end2) { + var start = Math.max(start1, start2); + var end = Math.min(end1, end2); + return start < end; + } + ts.startEndOverlapsWithStartEnd = startEndOverlapsWithStartEnd; + function positionBelongsToNode(candidate, position, sourceFile) { + return candidate.end > position || !isCompletedNode(candidate, sourceFile); + } + ts.positionBelongsToNode = positionBelongsToNode; + function isCompletedNode(n, sourceFile) { + if (ts.nodeIsMissing(n)) { + return false; + } + switch (n.kind) { + case 221: + case 222: + case 224: + case 171: + case 167: + case 159: + case 199: + case 226: + case 227: + return nodeEndsWith(n, 16, sourceFile); + case 252: + return isCompletedNode(n.block, sourceFile); + case 175: + if (!n.arguments) { + return true; + } + case 174: + case 178: + case 164: + return nodeEndsWith(n, 18, sourceFile); + case 156: + case 157: + return isCompletedNode(n.type, sourceFile); + case 148: + case 149: + case 150: + case 220: + case 179: + case 147: + case 146: + case 152: + case 151: + case 180: + if (n.body) { + return isCompletedNode(n.body, sourceFile); + } + if (n.type) { + return isCompletedNode(n.type, sourceFile); + } + return hasChildOfKind(n, 18, sourceFile); + case 225: + return n.body && isCompletedNode(n.body, sourceFile); + case 203: + if (n.elseStatement) { + return isCompletedNode(n.elseStatement, sourceFile); + } + return isCompletedNode(n.thenStatement, sourceFile); + case 202: + return isCompletedNode(n.expression, sourceFile) || + hasChildOfKind(n, 23); + case 170: + case 168: + case 173: + case 140: + case 161: + return nodeEndsWith(n, 20, sourceFile); + case 153: + if (n.type) { + return isCompletedNode(n.type, sourceFile); + } + return hasChildOfKind(n, 20, sourceFile); + case 249: + case 250: + return false; + case 206: + case 207: + case 208: + case 205: + return isCompletedNode(n.statement, sourceFile); + case 204: + var hasWhileKeyword = findChildOfKind(n, 104, sourceFile); + if (hasWhileKeyword) { + return nodeEndsWith(n, 18, sourceFile); + } + return isCompletedNode(n.statement, sourceFile); + case 158: + return isCompletedNode(n.exprName, sourceFile); + case 182: + case 181: + case 183: + case 190: + case 191: + var unaryWordExpression = n; + return isCompletedNode(unaryWordExpression.expression, sourceFile); + case 176: + return isCompletedNode(n.template, sourceFile); + case 189: + var lastSpan = ts.lastOrUndefined(n.templateSpans); + return isCompletedNode(lastSpan, sourceFile); + case 197: + return ts.nodeIsPresent(n.literal); + case 185: + return isCompletedNode(n.operand, sourceFile); + case 187: + return isCompletedNode(n.right, sourceFile); + case 188: + return isCompletedNode(n.whenFalse, sourceFile); + default: + return true; + } + } + ts.isCompletedNode = isCompletedNode; + function nodeEndsWith(n, expectedLastToken, sourceFile) { + var children = n.getChildren(sourceFile); + if (children.length) { + var last = ts.lastOrUndefined(children); + if (last.kind === expectedLastToken) { + return true; + } + else if (last.kind === 23 && children.length !== 1) { + return children[children.length - 2].kind === expectedLastToken; + } + } + return false; + } + function findListItemInfo(node) { + var list = findContainingList(node); + if (!list) { + return undefined; + } + var children = list.getChildren(); + var listItemIndex = ts.indexOf(children, node); + return { + listItemIndex: listItemIndex, + list: list + }; + } + ts.findListItemInfo = findListItemInfo; + function hasChildOfKind(n, kind, sourceFile) { + return !!findChildOfKind(n, kind, sourceFile); + } + ts.hasChildOfKind = hasChildOfKind; + function findChildOfKind(n, kind, sourceFile) { + return ts.forEach(n.getChildren(sourceFile), function (c) { return c.kind === kind && c; }); + } + ts.findChildOfKind = findChildOfKind; + function findContainingList(node) { + var syntaxList = ts.forEach(node.parent.getChildren(), function (c) { + if (c.kind === 279 && c.pos <= node.pos && c.end >= node.end) { + return c; + } + }); + ts.Debug.assert(!syntaxList || ts.contains(syntaxList.getChildren(), node)); + return syntaxList; + } + ts.findContainingList = findContainingList; + function getTouchingWord(sourceFile, position) { + return getTouchingToken(sourceFile, position, function (n) { return isWord(n.kind); }); + } + ts.getTouchingWord = getTouchingWord; + function getTouchingPropertyName(sourceFile, position) { + return getTouchingToken(sourceFile, position, function (n) { return isPropertyName(n.kind); }); + } + ts.getTouchingPropertyName = getTouchingPropertyName; + function getTouchingToken(sourceFile, position, includeItemAtEndPosition) { + return getTokenAtPositionWorker(sourceFile, position, false, includeItemAtEndPosition); + } + ts.getTouchingToken = getTouchingToken; + function getTokenAtPosition(sourceFile, position) { + return getTokenAtPositionWorker(sourceFile, position, true, undefined); + } + ts.getTokenAtPosition = getTokenAtPosition; + function getTokenAtPositionWorker(sourceFile, position, allowPositionInLeadingTrivia, includeItemAtEndPosition) { + var current = sourceFile; + outer: while (true) { + if (isToken(current)) { + return current; + } + for (var i = 0, n = current.getChildCount(sourceFile); i < n; i++) { + var child = current.getChildAt(i); + var start = allowPositionInLeadingTrivia ? child.getFullStart() : child.getStart(sourceFile); + if (start <= position) { + var end = child.getEnd(); + if (position < end || (position === end && child.kind === 1)) { + current = child; + continue outer; + } + else if (includeItemAtEndPosition && end === position) { + var previousToken = findPrecedingToken(position, sourceFile, child); + if (previousToken && includeItemAtEndPosition(previousToken)) { + return previousToken; + } + } + } + } + return current; + } + } + function findTokenOnLeftOfPosition(file, position) { + var tokenAtPosition = getTokenAtPosition(file, position); + if (isToken(tokenAtPosition) && position > tokenAtPosition.getStart(file) && position < tokenAtPosition.getEnd()) { + return tokenAtPosition; + } + return findPrecedingToken(position, file); + } + ts.findTokenOnLeftOfPosition = findTokenOnLeftOfPosition; + function findNextToken(previousToken, parent) { + return find(parent); + function find(n) { + if (isToken(n) && n.pos === previousToken.end) { + return n; + } + var children = n.getChildren(); + for (var _i = 0, children_1 = children; _i < children_1.length; _i++) { + var child = children_1[_i]; + var shouldDiveInChildNode = (child.pos <= previousToken.pos && child.end > previousToken.end) || + (child.pos === previousToken.end); + if (shouldDiveInChildNode && nodeHasTokens(child)) { + return find(child); + } + } + return undefined; + } + } + ts.findNextToken = findNextToken; + function findPrecedingToken(position, sourceFile, startNode) { + return find(startNode || sourceFile); + function findRightmostToken(n) { + if (isToken(n) || n.kind === 244) { + return n; + } + var children = n.getChildren(); + var candidate = findRightmostChildNodeWithTokens(children, children.length); + return candidate && findRightmostToken(candidate); + } + function find(n) { + if (isToken(n) || n.kind === 244) { + return n; + } + var children = n.getChildren(); + for (var i = 0, len = children.length; i < len; i++) { + var child = children[i]; + if (position < child.end && (nodeHasTokens(child) || child.kind === 244)) { + var start = child.getStart(sourceFile); + var lookInPreviousChild = (start >= position) || + (child.kind === 244 && start === child.end); + if (lookInPreviousChild) { + var candidate = findRightmostChildNodeWithTokens(children, i); + return candidate && findRightmostToken(candidate); + } + else { + return find(child); + } + } + } + ts.Debug.assert(startNode !== undefined || n.kind === 256); + if (children.length) { + var candidate = findRightmostChildNodeWithTokens(children, children.length); + return candidate && findRightmostToken(candidate); + } + } + function findRightmostChildNodeWithTokens(children, exclusiveStartPosition) { + for (var i = exclusiveStartPosition - 1; i >= 0; --i) { + if (nodeHasTokens(children[i])) { + return children[i]; + } + } + } + } + ts.findPrecedingToken = findPrecedingToken; + function isInString(sourceFile, position) { + var token = getTokenAtPosition(sourceFile, position); + return token && (token.kind === 9 || token.kind === 166) && position > token.getStart(sourceFile); + } + ts.isInString = isInString; + function isInComment(sourceFile, position) { + return isInCommentHelper(sourceFile, position, undefined); + } + ts.isInComment = isInComment; + function isInsideJsxElementOrAttribute(sourceFile, position) { + var token = getTokenAtPosition(sourceFile, position); + if (!token) { + return false; + } + if (token.kind === 25 && token.parent.kind === 244) { + return true; + } + if (token.kind === 25 && token.parent.kind === 248) { + return true; + } + if (token && token.kind === 16 && token.parent.kind === 248) { + return true; + } + if (token.kind === 25 && token.parent.kind === 245) { + return true; + } + return false; + } + ts.isInsideJsxElementOrAttribute = isInsideJsxElementOrAttribute; + function isInTemplateString(sourceFile, position) { + var token = getTokenAtPosition(sourceFile, position); + return ts.isTemplateLiteralKind(token.kind) && position > token.getStart(sourceFile); + } + ts.isInTemplateString = isInTemplateString; + function isInCommentHelper(sourceFile, position, predicate) { + var token = getTokenAtPosition(sourceFile, position); + if (token && position <= token.getStart(sourceFile)) { + var commentRanges = ts.getLeadingCommentRanges(sourceFile.text, token.pos); + return predicate ? + ts.forEach(commentRanges, function (c) { return c.pos < position && + (c.kind == 2 ? position <= c.end : position < c.end) && + predicate(c); }) : + ts.forEach(commentRanges, function (c) { return c.pos < position && + (c.kind == 2 ? position <= c.end : position < c.end); }); + } + return false; + } + ts.isInCommentHelper = isInCommentHelper; + function hasDocComment(sourceFile, position) { + var token = getTokenAtPosition(sourceFile, position); + var commentRanges = ts.getLeadingCommentRanges(sourceFile.text, token.pos); + return ts.forEach(commentRanges, jsDocPrefix); + function jsDocPrefix(c) { + var text = sourceFile.text; + return text.length >= c.pos + 3 && text[c.pos] === "/" && text[c.pos + 1] === "*" && text[c.pos + 2] === "*"; + } + } + ts.hasDocComment = hasDocComment; + function getJsDocTagAtPosition(sourceFile, position) { + var node = ts.getTokenAtPosition(sourceFile, position); + if (isToken(node)) { + switch (node.kind) { + case 102: + case 108: + case 74: + node = node.parent === undefined ? undefined : node.parent.parent; + break; + default: + node = node.parent; + break; + } + } + if (node) { + var jsDocComment = node.jsDocComment; + if (jsDocComment) { + for (var _i = 0, _a = jsDocComment.tags; _i < _a.length; _i++) { + var tag = _a[_i]; + if (tag.pos <= position && position <= tag.end) { + return tag; + } + } + } + } + return undefined; + } + ts.getJsDocTagAtPosition = getJsDocTagAtPosition; + function nodeHasTokens(n) { + return n.getWidth() !== 0; + } + function getNodeModifiers(node) { + var flags = ts.getCombinedNodeFlags(node); + var result = []; + if (flags & 8) + result.push(ts.ScriptElementKindModifier.privateMemberModifier); + if (flags & 16) + result.push(ts.ScriptElementKindModifier.protectedMemberModifier); + if (flags & 4) + result.push(ts.ScriptElementKindModifier.publicMemberModifier); + if (flags & 32) + result.push(ts.ScriptElementKindModifier.staticModifier); + if (flags & 128) + result.push(ts.ScriptElementKindModifier.abstractModifier); + if (flags & 1) + result.push(ts.ScriptElementKindModifier.exportedModifier); + if (ts.isInAmbientContext(node)) + result.push(ts.ScriptElementKindModifier.ambientModifier); + return result.length > 0 ? result.join(",") : ts.ScriptElementKindModifier.none; + } + ts.getNodeModifiers = getNodeModifiers; + function getTypeArgumentOrTypeParameterList(node) { + if (node.kind === 155 || node.kind === 174) { + return node.typeArguments; + } + if (ts.isFunctionLike(node) || node.kind === 221 || node.kind === 222) { + return node.typeParameters; + } + return undefined; + } + ts.getTypeArgumentOrTypeParameterList = getTypeArgumentOrTypeParameterList; + function isToken(n) { + return n.kind >= 0 && n.kind <= 138; + } + ts.isToken = isToken; + function isWord(kind) { + return kind === 69 || ts.isKeyword(kind); + } + ts.isWord = isWord; + function isPropertyName(kind) { + return kind === 9 || kind === 8 || isWord(kind); + } + function isComment(kind) { + return kind === 2 || kind === 3; + } + ts.isComment = isComment; + function isStringOrRegularExpressionOrTemplateLiteral(kind) { + if (kind === 9 + || kind === 166 + || kind === 10 + || ts.isTemplateLiteralKind(kind)) { + return true; + } + return false; + } + ts.isStringOrRegularExpressionOrTemplateLiteral = isStringOrRegularExpressionOrTemplateLiteral; + function isPunctuation(kind) { + return 15 <= kind && kind <= 68; + } + ts.isPunctuation = isPunctuation; + function isInsideTemplateLiteral(node, position) { + return ts.isTemplateLiteralKind(node.kind) + && (node.getStart() < position && position < node.getEnd()) || (!!node.isUnterminated && position === node.getEnd()); + } + ts.isInsideTemplateLiteral = isInsideTemplateLiteral; + function isAccessibilityModifier(kind) { + switch (kind) { + case 112: + case 110: + case 111: + return true; + } + return false; + } + ts.isAccessibilityModifier = isAccessibilityModifier; + function compareDataObjects(dst, src) { + for (var e in dst) { + if (typeof dst[e] === "object") { + if (!compareDataObjects(dst[e], src[e])) { + return false; + } + } + else if (typeof dst[e] !== "function") { + if (dst[e] !== src[e]) { + return false; + } + } + } + return true; + } + ts.compareDataObjects = compareDataObjects; + function isArrayLiteralOrObjectLiteralDestructuringPattern(node) { + if (node.kind === 170 || + node.kind === 171) { + if (node.parent.kind === 187 && + node.parent.left === node && + node.parent.operatorToken.kind === 56) { + return true; + } + if (node.parent.kind === 208 && + node.parent.initializer === node) { + return true; + } + if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 253 ? node.parent.parent : node.parent)) { + return true; + } + } + return false; + } + ts.isArrayLiteralOrObjectLiteralDestructuringPattern = isArrayLiteralOrObjectLiteralDestructuringPattern; +})(ts || (ts = {})); +var ts; +(function (ts) { + function isFirstDeclarationOfSymbolParameter(symbol) { + return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 142; + } + ts.isFirstDeclarationOfSymbolParameter = isFirstDeclarationOfSymbolParameter; + var displayPartWriter = getDisplayPartWriter(); + function getDisplayPartWriter() { + var displayParts; + var lineStart; + var indent; + resetWriter(); + return { + displayParts: function () { return displayParts; }, + writeKeyword: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.keyword); }, + writeOperator: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.operator); }, + writePunctuation: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.punctuation); }, + writeSpace: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.space); }, + writeStringLiteral: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.stringLiteral); }, + writeParameter: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.parameterName); }, + writeSymbol: writeSymbol, + writeLine: writeLine, + increaseIndent: function () { indent++; }, + decreaseIndent: function () { indent--; }, + clear: resetWriter, + trackSymbol: function () { }, + reportInaccessibleThisError: function () { } + }; + function writeIndent() { + if (lineStart) { + var indentString = ts.getIndentString(indent); + if (indentString) { + displayParts.push(displayPart(indentString, ts.SymbolDisplayPartKind.space)); + } + lineStart = false; + } + } + function writeKind(text, kind) { + writeIndent(); + displayParts.push(displayPart(text, kind)); + } + function writeSymbol(text, symbol) { + writeIndent(); + displayParts.push(symbolPart(text, symbol)); + } + function writeLine() { + displayParts.push(lineBreakPart()); + lineStart = true; + } + function resetWriter() { + displayParts = []; + lineStart = true; + indent = 0; + } + } + function symbolPart(text, symbol) { + return displayPart(text, displayPartKind(symbol), symbol); + function displayPartKind(symbol) { + var flags = symbol.flags; + if (flags & 3) { + return isFirstDeclarationOfSymbolParameter(symbol) ? ts.SymbolDisplayPartKind.parameterName : ts.SymbolDisplayPartKind.localName; + } + else if (flags & 4) { + return ts.SymbolDisplayPartKind.propertyName; + } + else if (flags & 32768) { + return ts.SymbolDisplayPartKind.propertyName; + } + else if (flags & 65536) { + return ts.SymbolDisplayPartKind.propertyName; + } + else if (flags & 8) { + return ts.SymbolDisplayPartKind.enumMemberName; + } + else if (flags & 16) { + return ts.SymbolDisplayPartKind.functionName; + } + else if (flags & 32) { + return ts.SymbolDisplayPartKind.className; + } + else if (flags & 64) { + return ts.SymbolDisplayPartKind.interfaceName; + } + else if (flags & 384) { + return ts.SymbolDisplayPartKind.enumName; + } + else if (flags & 1536) { + return ts.SymbolDisplayPartKind.moduleName; + } + else if (flags & 8192) { + return ts.SymbolDisplayPartKind.methodName; + } + else if (flags & 262144) { + return ts.SymbolDisplayPartKind.typeParameterName; + } + else if (flags & 524288) { + return ts.SymbolDisplayPartKind.aliasName; + } + else if (flags & 8388608) { + return ts.SymbolDisplayPartKind.aliasName; + } + return ts.SymbolDisplayPartKind.text; + } + } + ts.symbolPart = symbolPart; + function displayPart(text, kind, symbol) { + return { + text: text, + kind: ts.SymbolDisplayPartKind[kind] + }; + } + ts.displayPart = displayPart; + function spacePart() { + return displayPart(" ", ts.SymbolDisplayPartKind.space); + } + ts.spacePart = spacePart; + function keywordPart(kind) { + return displayPart(ts.tokenToString(kind), ts.SymbolDisplayPartKind.keyword); + } + ts.keywordPart = keywordPart; + function punctuationPart(kind) { + return displayPart(ts.tokenToString(kind), ts.SymbolDisplayPartKind.punctuation); + } + ts.punctuationPart = punctuationPart; + function operatorPart(kind) { + return displayPart(ts.tokenToString(kind), ts.SymbolDisplayPartKind.operator); + } + ts.operatorPart = operatorPart; + function textOrKeywordPart(text) { + var kind = ts.stringToToken(text); + return kind === undefined + ? textPart(text) + : keywordPart(kind); + } + ts.textOrKeywordPart = textOrKeywordPart; + function textPart(text) { + return displayPart(text, ts.SymbolDisplayPartKind.text); + } + ts.textPart = textPart; + var carriageReturnLineFeed = "\r\n"; + function getNewLineOrDefaultFromHost(host) { + return host.getNewLine ? host.getNewLine() : carriageReturnLineFeed; + } + ts.getNewLineOrDefaultFromHost = getNewLineOrDefaultFromHost; + function lineBreakPart() { + return displayPart("\n", ts.SymbolDisplayPartKind.lineBreak); + } + ts.lineBreakPart = lineBreakPart; + function mapToDisplayParts(writeDisplayParts) { + writeDisplayParts(displayPartWriter); + var result = displayPartWriter.displayParts(); + displayPartWriter.clear(); + return result; + } + ts.mapToDisplayParts = mapToDisplayParts; + function typeToDisplayParts(typechecker, type, enclosingDeclaration, flags) { + return mapToDisplayParts(function (writer) { + typechecker.getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags); + }); + } + ts.typeToDisplayParts = typeToDisplayParts; + function symbolToDisplayParts(typeChecker, symbol, enclosingDeclaration, meaning, flags) { + return mapToDisplayParts(function (writer) { + typeChecker.getSymbolDisplayBuilder().buildSymbolDisplay(symbol, writer, enclosingDeclaration, meaning, flags); + }); + } + ts.symbolToDisplayParts = symbolToDisplayParts; + function signatureToDisplayParts(typechecker, signature, enclosingDeclaration, flags) { + return mapToDisplayParts(function (writer) { + typechecker.getSymbolDisplayBuilder().buildSignatureDisplay(signature, writer, enclosingDeclaration, flags); + }); + } + ts.signatureToDisplayParts = signatureToDisplayParts; + function getDeclaredName(typeChecker, symbol, location) { + if (isImportOrExportSpecifierName(location)) { + return location.getText(); + } + else if (ts.isStringOrNumericLiteral(location.kind) && + location.parent.kind === 140) { + return location.text; + } + var localExportDefaultSymbol = ts.getLocalSymbolForExportDefault(symbol); + var name = typeChecker.symbolToString(localExportDefaultSymbol || symbol); + return name; + } + ts.getDeclaredName = getDeclaredName; + function isImportOrExportSpecifierName(location) { + return location.parent && + (location.parent.kind === 234 || location.parent.kind === 238) && + location.parent.propertyName === location; + } + ts.isImportOrExportSpecifierName = isImportOrExportSpecifierName; + function stripQuotes(name) { + var length = name.length; + if (length >= 2 && + name.charCodeAt(0) === name.charCodeAt(length - 1) && + (name.charCodeAt(0) === 34 || name.charCodeAt(0) === 39)) { + return name.substring(1, length - 1); + } + ; + return name; + } + ts.stripQuotes = stripQuotes; + function scriptKindIs(fileName, host) { + var scriptKinds = []; + for (var _i = 2; _i < arguments.length; _i++) { + scriptKinds[_i - 2] = arguments[_i]; + } + var scriptKind = getScriptKind(fileName, host); + return ts.forEach(scriptKinds, function (k) { return k === scriptKind; }); + } + ts.scriptKindIs = scriptKindIs; + function getScriptKind(fileName, host) { + var scriptKind; + if (host && host.getScriptKind) { + scriptKind = host.getScriptKind(fileName); + } + if (!scriptKind || scriptKind === 0) { + scriptKind = ts.getScriptKindFromFileName(fileName); + } + return ts.ensureScriptKind(fileName, scriptKind); + } + ts.getScriptKind = getScriptKind; +})(ts || (ts = {})); +var ts; +(function (ts) { + var JsTyping; + (function (JsTyping) { + ; + ; + var safeList; + function discoverTypings(host, fileNames, projectRootPath, safeListPath, packageNameToTypingLocation, typingOptions, compilerOptions) { + var inferredTypings = {}; + if (!typingOptions || !typingOptions.enableAutoDiscovery) { + return { cachedTypingPaths: [], newTypingNames: [], filesToWatch: [] }; + } + fileNames = ts.filter(ts.map(fileNames, ts.normalizePath), function (f) { return ts.scriptKindIs(f, undefined, 1, 2); }); + if (!safeList) { + var result = ts.readConfigFile(safeListPath, function (path) { return host.readFile(path); }); + if (result.config) { + safeList = result.config; + } + else { + safeList = {}; + } + ; + } + var filesToWatch = []; + var searchDirs = []; + var exclude = []; + mergeTypings(typingOptions.include); + exclude = typingOptions.exclude || []; + var possibleSearchDirs = ts.map(fileNames, ts.getDirectoryPath); + if (projectRootPath !== undefined) { + possibleSearchDirs.push(projectRootPath); + } + searchDirs = ts.deduplicate(possibleSearchDirs); + for (var _i = 0, searchDirs_1 = searchDirs; _i < searchDirs_1.length; _i++) { + var searchDir = searchDirs_1[_i]; + var packageJsonPath = ts.combinePaths(searchDir, "package.json"); + getTypingNamesFromJson(packageJsonPath, filesToWatch); + var bowerJsonPath = ts.combinePaths(searchDir, "bower.json"); + getTypingNamesFromJson(bowerJsonPath, filesToWatch); + var nodeModulesPath = ts.combinePaths(searchDir, "node_modules"); + getTypingNamesFromNodeModuleFolder(nodeModulesPath); + } + getTypingNamesFromSourceFileNames(fileNames); + for (var name_37 in packageNameToTypingLocation) { + if (ts.hasProperty(inferredTypings, name_37) && !inferredTypings[name_37]) { + inferredTypings[name_37] = packageNameToTypingLocation[name_37]; + } + } + for (var _a = 0, exclude_1 = exclude; _a < exclude_1.length; _a++) { + var excludeTypingName = exclude_1[_a]; + delete inferredTypings[excludeTypingName]; + } + var newTypingNames = []; + var cachedTypingPaths = []; + for (var typing in inferredTypings) { + if (inferredTypings[typing] !== undefined) { + cachedTypingPaths.push(inferredTypings[typing]); + } + else { + newTypingNames.push(typing); + } + } + return { cachedTypingPaths: cachedTypingPaths, newTypingNames: newTypingNames, filesToWatch: filesToWatch }; + function mergeTypings(typingNames) { + if (!typingNames) { + return; + } + for (var _i = 0, typingNames_1 = typingNames; _i < typingNames_1.length; _i++) { + var typing = typingNames_1[_i]; + if (!ts.hasProperty(inferredTypings, typing)) { + inferredTypings[typing] = undefined; + } + } + } + function getTypingNamesFromJson(jsonPath, filesToWatch) { + var result = ts.readConfigFile(jsonPath, function (path) { return host.readFile(path); }); + if (result.config) { + var jsonConfig = result.config; + filesToWatch.push(jsonPath); + if (jsonConfig.dependencies) { + mergeTypings(ts.getKeys(jsonConfig.dependencies)); + } + if (jsonConfig.devDependencies) { + mergeTypings(ts.getKeys(jsonConfig.devDependencies)); + } + if (jsonConfig.optionalDependencies) { + mergeTypings(ts.getKeys(jsonConfig.optionalDependencies)); + } + if (jsonConfig.peerDependencies) { + mergeTypings(ts.getKeys(jsonConfig.peerDependencies)); + } + } + } + function getTypingNamesFromSourceFileNames(fileNames) { + var jsFileNames = ts.filter(fileNames, ts.hasJavaScriptFileExtension); + var inferredTypingNames = ts.map(jsFileNames, function (f) { return ts.removeFileExtension(ts.getBaseFileName(f.toLowerCase())); }); + var cleanedTypingNames = ts.map(inferredTypingNames, function (f) { return f.replace(/((?:\.|-)min(?=\.|$))|((?:-|\.)\d+)/g, ""); }); + if (safeList === undefined) { + mergeTypings(cleanedTypingNames); + } + else { + mergeTypings(ts.filter(cleanedTypingNames, function (f) { return ts.hasProperty(safeList, f); })); + } + var hasJsxFile = ts.forEach(fileNames, function (f) { return ts.scriptKindIs(f, undefined, 2); }); + if (hasJsxFile) { + mergeTypings(["react"]); + } + } + function getTypingNamesFromNodeModuleFolder(nodeModulesPath) { + if (!host.directoryExists(nodeModulesPath)) { + return; + } + var typingNames = []; + var fileNames = host.readDirectory(nodeModulesPath, "*.json", undefined, 2); + for (var _i = 0, fileNames_1 = fileNames; _i < fileNames_1.length; _i++) { + var fileName = fileNames_1[_i]; + var normalizedFileName = ts.normalizePath(fileName); + if (ts.getBaseFileName(normalizedFileName) !== "package.json") { + continue; + } + var result = ts.readConfigFile(normalizedFileName, function (path) { return host.readFile(path); }); + if (!result.config) { + continue; + } + var packageJson = result.config; + if (packageJson._requiredBy && + ts.filter(packageJson._requiredBy, function (r) { return r[0] === "#" || r === "/"; }).length === 0) { + continue; + } + if (!packageJson.name) { + continue; + } + if (packageJson.typings) { + var absolutePath = ts.getNormalizedAbsolutePath(packageJson.typings, ts.getDirectoryPath(normalizedFileName)); + inferredTypings[packageJson.name] = absolutePath; + } + else { + typingNames.push(packageJson.name); + } + } + mergeTypings(typingNames); + } + } + JsTyping.discoverTypings = discoverTypings; + })(JsTyping = ts.JsTyping || (ts.JsTyping = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var formatting; + (function (formatting) { + var standardScanner = ts.createScanner(2, false, 0); + var jsxScanner = ts.createScanner(2, false, 1); + var scanner; + function getFormattingScanner(sourceFile, startPos, endPos) { + ts.Debug.assert(scanner === undefined); + scanner = sourceFile.languageVariant === 1 ? jsxScanner : standardScanner; + scanner.setText(sourceFile.text); + scanner.setTextPos(startPos); + var wasNewLine = true; + var leadingTrivia; + var trailingTrivia; + var savedPos; + var lastScanAction; + var lastTokenInfo; + return { + advance: advance, + readTokenInfo: readTokenInfo, + isOnToken: isOnToken, + getCurrentLeadingTrivia: function () { return leadingTrivia; }, + lastTrailingTriviaWasNewLine: function () { return wasNewLine; }, + close: function () { + ts.Debug.assert(scanner !== undefined); + lastTokenInfo = undefined; + scanner.setText(undefined); + scanner = undefined; + } + }; + function advance() { + ts.Debug.assert(scanner !== undefined); + lastTokenInfo = undefined; + var isStarted = scanner.getStartPos() !== startPos; + if (isStarted) { + if (trailingTrivia) { + ts.Debug.assert(trailingTrivia.length !== 0); + wasNewLine = ts.lastOrUndefined(trailingTrivia).kind === 4; + } + else { + wasNewLine = false; + } + } + leadingTrivia = undefined; + trailingTrivia = undefined; + if (!isStarted) { + scanner.scan(); + } + var t; + var pos = scanner.getStartPos(); + while (pos < endPos) { + var t_1 = scanner.getToken(); + if (!ts.isTrivia(t_1)) { + break; + } + scanner.scan(); + var item = { + pos: pos, + end: scanner.getStartPos(), + kind: t_1 + }; + pos = scanner.getStartPos(); + if (!leadingTrivia) { + leadingTrivia = []; + } + leadingTrivia.push(item); + } + savedPos = scanner.getStartPos(); + } + function shouldRescanGreaterThanToken(node) { + if (node) { + switch (node.kind) { + case 29: + case 64: + case 65: + case 45: + case 44: + return true; + } + } + return false; + } + function shouldRescanJsxIdentifier(node) { + if (node.parent) { + switch (node.parent.kind) { + case 246: + case 243: + case 245: + case 242: + return node.kind === 69; + } + } + return false; + } + function shouldRescanSlashToken(container) { + return container.kind === 10; + } + function shouldRescanTemplateToken(container) { + return container.kind === 13 || + container.kind === 14; + } + function startsWithSlashToken(t) { + return t === 39 || t === 61; + } + function readTokenInfo(n) { + ts.Debug.assert(scanner !== undefined); + if (!isOnToken()) { + return { + leadingTrivia: leadingTrivia, + trailingTrivia: undefined, + token: undefined + }; + } + var expectedScanAction = shouldRescanGreaterThanToken(n) + ? 1 + : shouldRescanSlashToken(n) + ? 2 + : shouldRescanTemplateToken(n) + ? 3 + : shouldRescanJsxIdentifier(n) + ? 4 + : 0; + if (lastTokenInfo && expectedScanAction === lastScanAction) { + return fixTokenKind(lastTokenInfo, n); + } + if (scanner.getStartPos() !== savedPos) { + ts.Debug.assert(lastTokenInfo !== undefined); + scanner.setTextPos(savedPos); + scanner.scan(); + } + var currentToken = scanner.getToken(); + if (expectedScanAction === 1 && currentToken === 27) { + currentToken = scanner.reScanGreaterToken(); + ts.Debug.assert(n.kind === currentToken); + lastScanAction = 1; + } + else if (expectedScanAction === 2 && startsWithSlashToken(currentToken)) { + currentToken = scanner.reScanSlashToken(); + ts.Debug.assert(n.kind === currentToken); + lastScanAction = 2; + } + else if (expectedScanAction === 3 && currentToken === 16) { + currentToken = scanner.reScanTemplateToken(); + lastScanAction = 3; + } + else if (expectedScanAction === 4 && currentToken === 69) { + currentToken = scanner.scanJsxIdentifier(); + lastScanAction = 4; + } + else { + lastScanAction = 0; + } + var token = { + pos: scanner.getStartPos(), + end: scanner.getTextPos(), + kind: currentToken + }; + if (trailingTrivia) { + trailingTrivia = undefined; + } + while (scanner.getStartPos() < endPos) { + currentToken = scanner.scan(); + if (!ts.isTrivia(currentToken)) { + break; + } + var trivia = { + pos: scanner.getStartPos(), + end: scanner.getTextPos(), + kind: currentToken + }; + if (!trailingTrivia) { + trailingTrivia = []; + } + trailingTrivia.push(trivia); + if (currentToken === 4) { + scanner.scan(); + break; + } + } + lastTokenInfo = { + leadingTrivia: leadingTrivia, + trailingTrivia: trailingTrivia, + token: token + }; + return fixTokenKind(lastTokenInfo, n); + } + function isOnToken() { + ts.Debug.assert(scanner !== undefined); + var current = (lastTokenInfo && lastTokenInfo.token.kind) || scanner.getToken(); + var startPos = (lastTokenInfo && lastTokenInfo.token.pos) || scanner.getStartPos(); + return startPos < endPos && current !== 1 && !ts.isTrivia(current); + } + function fixTokenKind(tokenInfo, container) { + if (ts.isToken(container) && tokenInfo.token.kind !== container.kind) { + tokenInfo.token.kind = container.kind; + } + return tokenInfo; + } + } + formatting.getFormattingScanner = getFormattingScanner; + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var formatting; + (function (formatting) { + var FormattingContext = (function () { + function FormattingContext(sourceFile, formattingRequestKind) { + this.sourceFile = sourceFile; + this.formattingRequestKind = formattingRequestKind; + } + FormattingContext.prototype.updateContext = function (currentRange, currentTokenParent, nextRange, nextTokenParent, commonParent) { + ts.Debug.assert(currentRange !== undefined, "currentTokenSpan is null"); + ts.Debug.assert(currentTokenParent !== undefined, "currentTokenParent is null"); + ts.Debug.assert(nextRange !== undefined, "nextTokenSpan is null"); + ts.Debug.assert(nextTokenParent !== undefined, "nextTokenParent is null"); + ts.Debug.assert(commonParent !== undefined, "commonParent is null"); + this.currentTokenSpan = currentRange; + this.currentTokenParent = currentTokenParent; + this.nextTokenSpan = nextRange; + this.nextTokenParent = nextTokenParent; + this.contextNode = commonParent; + this.contextNodeAllOnSameLine = undefined; + this.nextNodeAllOnSameLine = undefined; + this.tokensAreOnSameLine = undefined; + this.contextNodeBlockIsOnOneLine = undefined; + this.nextNodeBlockIsOnOneLine = undefined; + }; + FormattingContext.prototype.ContextNodeAllOnSameLine = function () { + if (this.contextNodeAllOnSameLine === undefined) { + this.contextNodeAllOnSameLine = this.NodeIsOnOneLine(this.contextNode); + } + return this.contextNodeAllOnSameLine; + }; + FormattingContext.prototype.NextNodeAllOnSameLine = function () { + if (this.nextNodeAllOnSameLine === undefined) { + this.nextNodeAllOnSameLine = this.NodeIsOnOneLine(this.nextTokenParent); + } + return this.nextNodeAllOnSameLine; + }; + FormattingContext.prototype.TokensAreOnSameLine = function () { + if (this.tokensAreOnSameLine === undefined) { + var startLine = this.sourceFile.getLineAndCharacterOfPosition(this.currentTokenSpan.pos).line; + var endLine = this.sourceFile.getLineAndCharacterOfPosition(this.nextTokenSpan.pos).line; + this.tokensAreOnSameLine = (startLine === endLine); + } + return this.tokensAreOnSameLine; + }; + FormattingContext.prototype.ContextNodeBlockIsOnOneLine = function () { + if (this.contextNodeBlockIsOnOneLine === undefined) { + this.contextNodeBlockIsOnOneLine = this.BlockIsOnOneLine(this.contextNode); + } + return this.contextNodeBlockIsOnOneLine; + }; + FormattingContext.prototype.NextNodeBlockIsOnOneLine = function () { + if (this.nextNodeBlockIsOnOneLine === undefined) { + this.nextNodeBlockIsOnOneLine = this.BlockIsOnOneLine(this.nextTokenParent); + } + return this.nextNodeBlockIsOnOneLine; + }; + FormattingContext.prototype.NodeIsOnOneLine = function (node) { + var startLine = this.sourceFile.getLineAndCharacterOfPosition(node.getStart(this.sourceFile)).line; + var endLine = this.sourceFile.getLineAndCharacterOfPosition(node.getEnd()).line; + return startLine === endLine; + }; + FormattingContext.prototype.BlockIsOnOneLine = function (node) { + var openBrace = ts.findChildOfKind(node, 15, this.sourceFile); + var closeBrace = ts.findChildOfKind(node, 16, this.sourceFile); + if (openBrace && closeBrace) { + var startLine = this.sourceFile.getLineAndCharacterOfPosition(openBrace.getEnd()).line; + var endLine = this.sourceFile.getLineAndCharacterOfPosition(closeBrace.getStart(this.sourceFile)).line; + return startLine === endLine; + } + return false; + }; + return FormattingContext; + }()); + formatting.FormattingContext = FormattingContext; + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var formatting; + (function (formatting) { + var Rule = (function () { + function Rule(Descriptor, Operation, Flag) { + if (Flag === void 0) { Flag = 0; } + this.Descriptor = Descriptor; + this.Operation = Operation; + this.Flag = Flag; + } + Rule.prototype.toString = function () { + return "[desc=" + this.Descriptor + "," + + "operation=" + this.Operation + "," + + "flag=" + this.Flag + "]"; + }; + return Rule; + }()); + formatting.Rule = Rule; + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var formatting; + (function (formatting) { + var RuleDescriptor = (function () { + function RuleDescriptor(LeftTokenRange, RightTokenRange) { + this.LeftTokenRange = LeftTokenRange; + this.RightTokenRange = RightTokenRange; + } + RuleDescriptor.prototype.toString = function () { + return "[leftRange=" + this.LeftTokenRange + "," + + "rightRange=" + this.RightTokenRange + "]"; + }; + RuleDescriptor.create1 = function (left, right) { + return RuleDescriptor.create4(formatting.Shared.TokenRange.FromToken(left), formatting.Shared.TokenRange.FromToken(right)); + }; + RuleDescriptor.create2 = function (left, right) { + return RuleDescriptor.create4(left, formatting.Shared.TokenRange.FromToken(right)); + }; + RuleDescriptor.create3 = function (left, right) { + return RuleDescriptor.create4(formatting.Shared.TokenRange.FromToken(left), right); + }; + RuleDescriptor.create4 = function (left, right) { + return new RuleDescriptor(left, right); + }; + return RuleDescriptor; + }()); + formatting.RuleDescriptor = RuleDescriptor; + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var formatting; + (function (formatting) { + var RuleOperation = (function () { + function RuleOperation() { + this.Context = null; + this.Action = null; + } + RuleOperation.prototype.toString = function () { + return "[context=" + this.Context + "," + + "action=" + this.Action + "]"; + }; + RuleOperation.create1 = function (action) { + return RuleOperation.create2(formatting.RuleOperationContext.Any, action); + }; + RuleOperation.create2 = function (context, action) { + var result = new RuleOperation(); + result.Context = context; + result.Action = action; + return result; + }; + return RuleOperation; + }()); + formatting.RuleOperation = RuleOperation; + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var formatting; + (function (formatting) { + var RuleOperationContext = (function () { + function RuleOperationContext() { + var funcs = []; + for (var _i = 0; _i < arguments.length; _i++) { + funcs[_i - 0] = arguments[_i]; + } + this.customContextChecks = funcs; + } + RuleOperationContext.prototype.IsAny = function () { + return this === RuleOperationContext.Any; + }; + RuleOperationContext.prototype.InContext = function (context) { + if (this.IsAny()) { + return true; + } + for (var _i = 0, _a = this.customContextChecks; _i < _a.length; _i++) { + var check = _a[_i]; + if (!check(context)) { + return false; + } + } + return true; + }; + RuleOperationContext.Any = new RuleOperationContext(); + return RuleOperationContext; + }()); + formatting.RuleOperationContext = RuleOperationContext; + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var formatting; + (function (formatting) { + var Rules = (function () { + function Rules() { + this.IgnoreBeforeComment = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.Comments), formatting.RuleOperation.create1(1)); + this.IgnoreAfterLineComment = new formatting.Rule(formatting.RuleDescriptor.create3(2, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create1(1)); + this.NoSpaceBeforeSemicolon = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 23), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); + this.NoSpaceBeforeColon = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 54), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotBinaryOpContext), 8)); + this.NoSpaceBeforeQuestionMark = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 53), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotBinaryOpContext), 8)); + this.SpaceAfterColon = new formatting.Rule(formatting.RuleDescriptor.create3(54, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotBinaryOpContext), 2)); + this.SpaceAfterQuestionMarkInConditionalOperator = new formatting.Rule(formatting.RuleDescriptor.create3(53, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsConditionalOperatorContext), 2)); + this.NoSpaceAfterQuestionMark = new formatting.Rule(formatting.RuleDescriptor.create3(53, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); + this.SpaceAfterSemicolon = new formatting.Rule(formatting.RuleDescriptor.create3(23, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); + this.SpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(16, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsAfterCodeBlockContext), 2)); + this.SpaceBetweenCloseBraceAndElse = new formatting.Rule(formatting.RuleDescriptor.create1(16, 80), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); + this.SpaceBetweenCloseBraceAndWhile = new formatting.Rule(formatting.RuleDescriptor.create1(16, 104), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); + this.NoSpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(16, formatting.Shared.TokenRange.FromTokens([18, 20, 24, 23])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); + this.NoSpaceBeforeDot = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 21), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); + this.NoSpaceAfterDot = new formatting.Rule(formatting.RuleDescriptor.create3(21, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); + this.NoSpaceBeforeOpenBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 19), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); + this.NoSpaceAfterCloseBracket = new formatting.Rule(formatting.RuleDescriptor.create3(20, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotBeforeBlockInFunctionDeclarationContext), 8)); + this.FunctionOpenBraceLeftTokenRange = formatting.Shared.TokenRange.AnyIncludingMultilineComments; + this.SpaceBeforeOpenBraceInFunction = new formatting.Rule(formatting.RuleDescriptor.create2(this.FunctionOpenBraceLeftTokenRange, 15), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext, Rules.IsBeforeBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2), 1); + this.TypeScriptOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([69, 3, 73]); + this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock = new formatting.Rule(formatting.RuleDescriptor.create2(this.TypeScriptOpenBraceLeftTokenRange, 15), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsTypeScriptDeclWithBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2), 1); + this.ControlOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([18, 3, 79, 100, 85, 80]); + this.SpaceBeforeOpenBraceInControl = new formatting.Rule(formatting.RuleDescriptor.create2(this.ControlOpenBraceLeftTokenRange, 15), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2), 1); + this.SpaceAfterOpenBrace = new formatting.Rule(formatting.RuleDescriptor.create3(15, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 2)); + this.SpaceBeforeCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 2)); + this.NoSpaceBetweenEmptyBraceBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(15, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsObjectContext), 8)); + this.NewLineAfterOpenBraceInBlockContext = new formatting.Rule(formatting.RuleDescriptor.create3(15, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsMultilineBlockContext), 4)); + this.NewLineBeforeCloseBraceInBlockContext = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.AnyIncludingMultilineComments, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsMultilineBlockContext), 4)); + this.NoSpaceAfterUnaryPrefixOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.UnaryPrefixOperators, formatting.Shared.TokenRange.UnaryPrefixExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotBinaryOpContext), 8)); + this.NoSpaceAfterUnaryPreincrementOperator = new formatting.Rule(formatting.RuleDescriptor.create3(41, formatting.Shared.TokenRange.UnaryPreincrementExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); + this.NoSpaceAfterUnaryPredecrementOperator = new formatting.Rule(formatting.RuleDescriptor.create3(42, formatting.Shared.TokenRange.UnaryPredecrementExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); + this.NoSpaceBeforeUnaryPostincrementOperator = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.UnaryPostincrementExpressions, 41), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); + this.NoSpaceBeforeUnaryPostdecrementOperator = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.UnaryPostdecrementExpressions, 42), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); + this.SpaceAfterPostincrementWhenFollowedByAdd = new formatting.Rule(formatting.RuleDescriptor.create1(41, 35), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2)); + this.SpaceAfterAddWhenFollowedByUnaryPlus = new formatting.Rule(formatting.RuleDescriptor.create1(35, 35), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2)); + this.SpaceAfterAddWhenFollowedByPreincrement = new formatting.Rule(formatting.RuleDescriptor.create1(35, 41), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2)); + this.SpaceAfterPostdecrementWhenFollowedBySubtract = new formatting.Rule(formatting.RuleDescriptor.create1(42, 36), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2)); + this.SpaceAfterSubtractWhenFollowedByUnaryMinus = new formatting.Rule(formatting.RuleDescriptor.create1(36, 36), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2)); + this.SpaceAfterSubtractWhenFollowedByPredecrement = new formatting.Rule(formatting.RuleDescriptor.create1(36, 42), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2)); + this.NoSpaceBeforeComma = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 24), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); + this.SpaceAfterCertainKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([102, 98, 92, 78, 94, 101, 119]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); + this.SpaceAfterLetConstInVariableDeclaration = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([108, 74]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsStartOfVariableDeclarationList), 2)); + this.NoSpaceBeforeOpenParenInFuncCall = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsFunctionCallOrNewContext, Rules.IsPreviousTokenNotComma), 8)); + this.SpaceAfterFunctionInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create3(87, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2)); + this.NoSpaceBeforeOpenParenInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsFunctionDeclContext), 8)); + this.SpaceAfterVoidOperator = new formatting.Rule(formatting.RuleDescriptor.create3(103, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsVoidOpContext), 2)); + this.NoSpaceBetweenReturnAndSemicolon = new formatting.Rule(formatting.RuleDescriptor.create1(94, 23), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); + this.SpaceBetweenStatements = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([18, 79, 80, 71]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotForContext), 2)); + this.SpaceAfterTryFinally = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([100, 85]), 15), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); + this.SpaceAfterGetSetInMember = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([123, 131]), 69), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2)); + this.SpaceBeforeBinaryKeywordOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.BinaryKeywordOperators), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2)); + this.SpaceAfterBinaryKeywordOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.BinaryKeywordOperators, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2)); + this.NoSpaceAfterConstructor = new formatting.Rule(formatting.RuleDescriptor.create1(121, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); + this.NoSpaceAfterModuleImport = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([125, 129]), 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); + this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([115, 73, 122, 77, 81, 82, 83, 123, 106, 89, 107, 125, 126, 110, 112, 111, 131, 113, 134]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); + this.SpaceBeforeCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([83, 106])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); + this.SpaceAfterModuleName = new formatting.Rule(formatting.RuleDescriptor.create1(9, 15), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsModuleDeclContext), 2)); + this.SpaceBeforeArrow = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 34), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); + this.SpaceAfterArrow = new formatting.Rule(formatting.RuleDescriptor.create3(34, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); + this.NoSpaceAfterEllipsis = new formatting.Rule(formatting.RuleDescriptor.create1(22, 69), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); + this.NoSpaceAfterOptionalParameters = new formatting.Rule(formatting.RuleDescriptor.create3(53, formatting.Shared.TokenRange.FromTokens([18, 24])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotBinaryOpContext), 8)); + this.NoSpaceBeforeOpenAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.TypeNames, 25), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8)); + this.NoSpaceBetweenCloseParenAndAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create1(18, 25), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8)); + this.NoSpaceAfterOpenAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create3(25, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8)); + this.NoSpaceBeforeCloseAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 27), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8)); + this.NoSpaceAfterCloseAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create3(27, formatting.Shared.TokenRange.FromTokens([17, 19, 27, 24])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8)); + this.NoSpaceAfterTypeAssertion = new formatting.Rule(formatting.RuleDescriptor.create3(27, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeAssertionContext), 8)); + this.NoSpaceBetweenEmptyInterfaceBraceBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(15, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsObjectTypeContext), 8)); + this.SpaceBeforeAt = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 55), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); + this.NoSpaceAfterAt = new formatting.Rule(formatting.RuleDescriptor.create3(55, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); + this.SpaceAfterDecorator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([115, 69, 82, 77, 73, 113, 112, 110, 111, 123, 131, 19, 37])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsEndOfDecoratorContextOnSameLine), 2)); + this.NoSpaceBetweenFunctionKeywordAndStar = new formatting.Rule(formatting.RuleDescriptor.create1(87, 37), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), 8)); + this.SpaceAfterStarInGeneratorDeclaration = new formatting.Rule(formatting.RuleDescriptor.create3(37, formatting.Shared.TokenRange.FromTokens([69, 17])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), 2)); + this.NoSpaceBetweenYieldKeywordAndStar = new formatting.Rule(formatting.RuleDescriptor.create1(114, 37), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), 8)); + this.SpaceBetweenYieldOrYieldStarAndOperand = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([114, 37]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), 2)); + this.SpaceBetweenAsyncAndOpenParen = new formatting.Rule(formatting.RuleDescriptor.create1(118, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsArrowFunctionContext, Rules.IsNonJsxSameLineTokenContext), 2)); + this.SpaceBetweenAsyncAndFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(118, 87), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); + this.NoSpaceBetweenTagAndTemplateString = new formatting.Rule(formatting.RuleDescriptor.create3(69, formatting.Shared.TokenRange.FromTokens([11, 12])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); + this.HighPriorityCommonRules = [ + this.IgnoreBeforeComment, this.IgnoreAfterLineComment, + this.NoSpaceBeforeColon, this.SpaceAfterColon, this.NoSpaceBeforeQuestionMark, this.SpaceAfterQuestionMarkInConditionalOperator, + this.NoSpaceAfterQuestionMark, + this.NoSpaceBeforeDot, this.NoSpaceAfterDot, + this.NoSpaceAfterUnaryPrefixOperator, + this.NoSpaceAfterUnaryPreincrementOperator, this.NoSpaceAfterUnaryPredecrementOperator, + this.NoSpaceBeforeUnaryPostincrementOperator, this.NoSpaceBeforeUnaryPostdecrementOperator, + this.SpaceAfterPostincrementWhenFollowedByAdd, + this.SpaceAfterAddWhenFollowedByUnaryPlus, this.SpaceAfterAddWhenFollowedByPreincrement, + this.SpaceAfterPostdecrementWhenFollowedBySubtract, + this.SpaceAfterSubtractWhenFollowedByUnaryMinus, this.SpaceAfterSubtractWhenFollowedByPredecrement, + this.NoSpaceAfterCloseBrace, + this.SpaceAfterOpenBrace, this.SpaceBeforeCloseBrace, this.NewLineBeforeCloseBraceInBlockContext, + this.SpaceAfterCloseBrace, this.SpaceBetweenCloseBraceAndElse, this.SpaceBetweenCloseBraceAndWhile, this.NoSpaceBetweenEmptyBraceBrackets, + this.NoSpaceBetweenFunctionKeywordAndStar, this.SpaceAfterStarInGeneratorDeclaration, + this.SpaceAfterFunctionInFuncDecl, this.NewLineAfterOpenBraceInBlockContext, this.SpaceAfterGetSetInMember, + this.NoSpaceBetweenYieldKeywordAndStar, this.SpaceBetweenYieldOrYieldStarAndOperand, + this.NoSpaceBetweenReturnAndSemicolon, + this.SpaceAfterCertainKeywords, + this.SpaceAfterLetConstInVariableDeclaration, + this.NoSpaceBeforeOpenParenInFuncCall, + this.SpaceBeforeBinaryKeywordOperator, this.SpaceAfterBinaryKeywordOperator, + this.SpaceAfterVoidOperator, + this.SpaceBetweenAsyncAndOpenParen, this.SpaceBetweenAsyncAndFunctionKeyword, + this.NoSpaceBetweenTagAndTemplateString, + this.NoSpaceAfterConstructor, this.NoSpaceAfterModuleImport, + this.SpaceAfterCertainTypeScriptKeywords, this.SpaceBeforeCertainTypeScriptKeywords, + this.SpaceAfterModuleName, + this.SpaceBeforeArrow, this.SpaceAfterArrow, + this.NoSpaceAfterEllipsis, + this.NoSpaceAfterOptionalParameters, + this.NoSpaceBetweenEmptyInterfaceBraceBrackets, + this.NoSpaceBeforeOpenAngularBracket, + this.NoSpaceBetweenCloseParenAndAngularBracket, + this.NoSpaceAfterOpenAngularBracket, + this.NoSpaceBeforeCloseAngularBracket, + this.NoSpaceAfterCloseAngularBracket, + this.NoSpaceAfterTypeAssertion, + this.SpaceBeforeAt, + this.NoSpaceAfterAt, + this.SpaceAfterDecorator, + ]; + this.LowPriorityCommonRules = [ + this.NoSpaceBeforeSemicolon, + this.SpaceBeforeOpenBraceInControl, this.SpaceBeforeOpenBraceInFunction, this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock, + this.NoSpaceBeforeComma, + this.NoSpaceBeforeOpenBracket, + this.NoSpaceAfterCloseBracket, + this.SpaceAfterSemicolon, + this.NoSpaceBeforeOpenParenInFuncDecl, + this.SpaceBetweenStatements, this.SpaceAfterTryFinally + ]; + this.SpaceAfterComma = new formatting.Rule(formatting.RuleDescriptor.create3(24, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNextTokenNotCloseBracket), 2)); + this.NoSpaceAfterComma = new formatting.Rule(formatting.RuleDescriptor.create3(24, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); + this.SpaceBeforeBinaryOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.BinaryOperators), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2)); + this.SpaceAfterBinaryOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.BinaryOperators, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2)); + this.NoSpaceBeforeBinaryOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.BinaryOperators), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 8)); + this.NoSpaceAfterBinaryOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.BinaryOperators, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 8)); + this.SpaceAfterKeywordInControl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Keywords, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext), 2)); + this.NoSpaceAfterKeywordInControl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Keywords, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext), 8)); + this.NewLineBeforeOpenBraceInFunction = new formatting.Rule(formatting.RuleDescriptor.create2(this.FunctionOpenBraceLeftTokenRange, 15), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext, Rules.IsBeforeMultilineBlockContext), 4), 1); + this.NewLineBeforeOpenBraceInTypeScriptDeclWithBlock = new formatting.Rule(formatting.RuleDescriptor.create2(this.TypeScriptOpenBraceLeftTokenRange, 15), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsTypeScriptDeclWithBlockContext, Rules.IsBeforeMultilineBlockContext), 4), 1); + this.NewLineBeforeOpenBraceInControl = new formatting.Rule(formatting.RuleDescriptor.create2(this.ControlOpenBraceLeftTokenRange, 15), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext, Rules.IsBeforeMultilineBlockContext), 4), 1); + this.SpaceAfterSemicolonInFor = new formatting.Rule(formatting.RuleDescriptor.create3(23, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsForContext), 2)); + this.NoSpaceAfterSemicolonInFor = new formatting.Rule(formatting.RuleDescriptor.create3(23, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsForContext), 8)); + this.SpaceAfterOpenParen = new formatting.Rule(formatting.RuleDescriptor.create3(17, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); + this.SpaceBeforeCloseParen = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 18), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); + this.NoSpaceBetweenParens = new formatting.Rule(formatting.RuleDescriptor.create1(17, 18), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); + this.NoSpaceAfterOpenParen = new formatting.Rule(formatting.RuleDescriptor.create3(17, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); + this.NoSpaceBeforeCloseParen = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 18), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); + this.SpaceAfterOpenBracket = new formatting.Rule(formatting.RuleDescriptor.create3(19, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); + this.SpaceBeforeCloseBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 20), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); + this.NoSpaceBetweenBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(19, 20), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); + this.NoSpaceAfterOpenBracket = new formatting.Rule(formatting.RuleDescriptor.create3(19, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); + this.NoSpaceBeforeCloseBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 20), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); + this.NoSpaceAfterTemplateHeadAndMiddle = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([12, 13]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); + this.SpaceAfterTemplateHeadAndMiddle = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([12, 13]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); + this.NoSpaceBeforeTemplateMiddleAndTail = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([13, 14])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); + this.SpaceBeforeTemplateMiddleAndTail = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([13, 14])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); + this.SpaceAfterAnonymousFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(87, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2)); + this.NoSpaceAfterAnonymousFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(87, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 8)); + } + Rules.prototype.getRuleName = function (rule) { + var o = this; + for (var name_38 in o) { + if (o[name_38] === rule) { + return name_38; + } + } + throw new Error("Unknown rule"); + }; + Rules.IsForContext = function (context) { + return context.contextNode.kind === 206; + }; + Rules.IsNotForContext = function (context) { + return !Rules.IsForContext(context); + }; + Rules.IsBinaryOpContext = function (context) { + switch (context.contextNode.kind) { + case 187: + case 188: + case 195: + case 154: + case 162: + case 163: + return true; + case 169: + case 223: + case 229: + case 218: + case 142: + case 255: + case 145: + case 144: + return context.currentTokenSpan.kind === 56 || context.nextTokenSpan.kind === 56; + case 207: + return context.currentTokenSpan.kind === 90 || context.nextTokenSpan.kind === 90; + case 208: + return context.currentTokenSpan.kind === 138 || context.nextTokenSpan.kind === 138; + } + return false; + }; + Rules.IsNotBinaryOpContext = function (context) { + return !Rules.IsBinaryOpContext(context); + }; + Rules.IsConditionalOperatorContext = function (context) { + return context.contextNode.kind === 188; + }; + Rules.IsSameLineTokenOrBeforeMultilineBlockContext = function (context) { + return context.TokensAreOnSameLine() || Rules.IsBeforeMultilineBlockContext(context); + }; + Rules.IsBeforeMultilineBlockContext = function (context) { + return Rules.IsBeforeBlockContext(context) && !(context.NextNodeAllOnSameLine() || context.NextNodeBlockIsOnOneLine()); + }; + Rules.IsMultilineBlockContext = function (context) { + return Rules.IsBlockContext(context) && !(context.ContextNodeAllOnSameLine() || context.ContextNodeBlockIsOnOneLine()); + }; + Rules.IsSingleLineBlockContext = function (context) { + return Rules.IsBlockContext(context) && (context.ContextNodeAllOnSameLine() || context.ContextNodeBlockIsOnOneLine()); + }; + Rules.IsBlockContext = function (context) { + return Rules.NodeIsBlockContext(context.contextNode); + }; + Rules.IsBeforeBlockContext = function (context) { + return Rules.NodeIsBlockContext(context.nextTokenParent); + }; + Rules.NodeIsBlockContext = function (node) { + if (Rules.NodeIsTypeScriptDeclWithBlockContext(node)) { + return true; + } + switch (node.kind) { + case 199: + case 227: + case 171: + case 226: + return true; + } + return false; + }; + Rules.IsFunctionDeclContext = function (context) { + switch (context.contextNode.kind) { + case 220: + case 147: + case 146: + case 149: + case 150: + case 151: + case 179: + case 148: + case 180: + case 222: + return true; + } + return false; + }; + Rules.IsFunctionDeclarationOrFunctionExpressionContext = function (context) { + return context.contextNode.kind === 220 || context.contextNode.kind === 179; + }; + Rules.IsTypeScriptDeclWithBlockContext = function (context) { + return Rules.NodeIsTypeScriptDeclWithBlockContext(context.contextNode); + }; + Rules.NodeIsTypeScriptDeclWithBlockContext = function (node) { + switch (node.kind) { + case 221: + case 192: + case 222: + case 224: + case 159: + case 225: + return true; + } + return false; + }; + Rules.IsAfterCodeBlockContext = function (context) { + switch (context.currentTokenParent.kind) { + case 221: + case 225: + case 224: + case 199: + case 252: + case 226: + case 213: + return true; + } + return false; + }; + Rules.IsControlDeclContext = function (context) { + switch (context.contextNode.kind) { + case 203: + case 213: + case 206: + case 207: + case 208: + case 205: + case 216: + case 204: + case 212: + case 252: + return true; + default: + return false; + } + }; + Rules.IsObjectContext = function (context) { + return context.contextNode.kind === 171; + }; + Rules.IsFunctionCallContext = function (context) { + return context.contextNode.kind === 174; + }; + Rules.IsNewContext = function (context) { + return context.contextNode.kind === 175; + }; + Rules.IsFunctionCallOrNewContext = function (context) { + return Rules.IsFunctionCallContext(context) || Rules.IsNewContext(context); + }; + Rules.IsPreviousTokenNotComma = function (context) { + return context.currentTokenSpan.kind !== 24; + }; + Rules.IsNextTokenNotCloseBracket = function (context) { + return context.nextTokenSpan.kind !== 20; + }; + Rules.IsArrowFunctionContext = function (context) { + return context.contextNode.kind === 180; + }; + Rules.IsNonJsxSameLineTokenContext = function (context) { + return context.TokensAreOnSameLine() && context.contextNode.kind !== 244; + }; + Rules.IsNotBeforeBlockInFunctionDeclarationContext = function (context) { + return !Rules.IsFunctionDeclContext(context) && !Rules.IsBeforeBlockContext(context); + }; + Rules.IsEndOfDecoratorContextOnSameLine = function (context) { + return context.TokensAreOnSameLine() && + context.contextNode.decorators && + Rules.NodeIsInDecoratorContext(context.currentTokenParent) && + !Rules.NodeIsInDecoratorContext(context.nextTokenParent); + }; + Rules.NodeIsInDecoratorContext = function (node) { + while (ts.isExpression(node)) { + node = node.parent; + } + return node.kind === 143; + }; + Rules.IsStartOfVariableDeclarationList = function (context) { + return context.currentTokenParent.kind === 219 && + context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos; + }; + Rules.IsNotFormatOnEnter = function (context) { + return context.formattingRequestKind !== 2; + }; + Rules.IsModuleDeclContext = function (context) { + return context.contextNode.kind === 225; + }; + Rules.IsObjectTypeContext = function (context) { + return context.contextNode.kind === 159; + }; + Rules.IsTypeArgumentOrParameterOrAssertion = function (token, parent) { + if (token.kind !== 25 && token.kind !== 27) { + return false; + } + switch (parent.kind) { + case 155: + case 177: + case 221: + case 192: + case 222: + case 220: + case 179: + case 180: + case 147: + case 146: + case 151: + case 152: + case 174: + case 175: + case 194: + return true; + default: + return false; + } + }; + Rules.IsTypeArgumentOrParameterOrAssertionContext = function (context) { + return Rules.IsTypeArgumentOrParameterOrAssertion(context.currentTokenSpan, context.currentTokenParent) || + Rules.IsTypeArgumentOrParameterOrAssertion(context.nextTokenSpan, context.nextTokenParent); + }; + Rules.IsTypeAssertionContext = function (context) { + return context.contextNode.kind === 177; + }; + Rules.IsVoidOpContext = function (context) { + return context.currentTokenSpan.kind === 103 && context.currentTokenParent.kind === 183; + }; + Rules.IsYieldOrYieldStarWithOperand = function (context) { + return context.contextNode.kind === 190 && context.contextNode.expression !== undefined; + }; + return Rules; + }()); + formatting.Rules = Rules; + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var formatting; + (function (formatting) { + var RulesMap = (function () { + function RulesMap() { + this.map = []; + this.mapRowLength = 0; + } + RulesMap.create = function (rules) { + var result = new RulesMap(); + result.Initialize(rules); + return result; + }; + RulesMap.prototype.Initialize = function (rules) { + this.mapRowLength = 138 + 1; + this.map = new Array(this.mapRowLength * this.mapRowLength); + var rulesBucketConstructionStateList = new Array(this.map.length); + this.FillRules(rules, rulesBucketConstructionStateList); + return this.map; + }; + RulesMap.prototype.FillRules = function (rules, rulesBucketConstructionStateList) { + var _this = this; + rules.forEach(function (rule) { + _this.FillRule(rule, rulesBucketConstructionStateList); + }); + }; + RulesMap.prototype.GetRuleBucketIndex = function (row, column) { + var rulesBucketIndex = (row * this.mapRowLength) + column; + return rulesBucketIndex; + }; + RulesMap.prototype.FillRule = function (rule, rulesBucketConstructionStateList) { + var _this = this; + var specificRule = rule.Descriptor.LeftTokenRange !== formatting.Shared.TokenRange.Any && + rule.Descriptor.RightTokenRange !== formatting.Shared.TokenRange.Any; + rule.Descriptor.LeftTokenRange.GetTokens().forEach(function (left) { + rule.Descriptor.RightTokenRange.GetTokens().forEach(function (right) { + var rulesBucketIndex = _this.GetRuleBucketIndex(left, right); + var rulesBucket = _this.map[rulesBucketIndex]; + if (rulesBucket === undefined) { + rulesBucket = _this.map[rulesBucketIndex] = new RulesBucket(); + } + rulesBucket.AddRule(rule, specificRule, rulesBucketConstructionStateList, rulesBucketIndex); + }); + }); + }; + RulesMap.prototype.GetRule = function (context) { + var bucketIndex = this.GetRuleBucketIndex(context.currentTokenSpan.kind, context.nextTokenSpan.kind); + var bucket = this.map[bucketIndex]; + if (bucket != null) { + for (var _i = 0, _a = bucket.Rules(); _i < _a.length; _i++) { + var rule = _a[_i]; + if (rule.Operation.Context.InContext(context)) { + return rule; + } + } + } + return null; + }; + return RulesMap; + }()); + formatting.RulesMap = RulesMap; + var MaskBitSize = 5; + var Mask = 0x1f; + (function (RulesPosition) { + RulesPosition[RulesPosition["IgnoreRulesSpecific"] = 0] = "IgnoreRulesSpecific"; + RulesPosition[RulesPosition["IgnoreRulesAny"] = MaskBitSize * 1] = "IgnoreRulesAny"; + RulesPosition[RulesPosition["ContextRulesSpecific"] = MaskBitSize * 2] = "ContextRulesSpecific"; + RulesPosition[RulesPosition["ContextRulesAny"] = MaskBitSize * 3] = "ContextRulesAny"; + RulesPosition[RulesPosition["NoContextRulesSpecific"] = MaskBitSize * 4] = "NoContextRulesSpecific"; + RulesPosition[RulesPosition["NoContextRulesAny"] = MaskBitSize * 5] = "NoContextRulesAny"; + })(formatting.RulesPosition || (formatting.RulesPosition = {})); + var RulesPosition = formatting.RulesPosition; + var RulesBucketConstructionState = (function () { + function RulesBucketConstructionState() { + this.rulesInsertionIndexBitmap = 0; + } + RulesBucketConstructionState.prototype.GetInsertionIndex = function (maskPosition) { + var index = 0; + var pos = 0; + var indexBitmap = this.rulesInsertionIndexBitmap; + while (pos <= maskPosition) { + index += (indexBitmap & Mask); + indexBitmap >>= MaskBitSize; + pos += MaskBitSize; + } + return index; + }; + RulesBucketConstructionState.prototype.IncreaseInsertionIndex = function (maskPosition) { + var value = (this.rulesInsertionIndexBitmap >> maskPosition) & Mask; + value++; + ts.Debug.assert((value & Mask) === value, "Adding more rules into the sub-bucket than allowed. Maximum allowed is 32 rules."); + var temp = this.rulesInsertionIndexBitmap & ~(Mask << maskPosition); + temp |= value << maskPosition; + this.rulesInsertionIndexBitmap = temp; + }; + return RulesBucketConstructionState; + }()); + formatting.RulesBucketConstructionState = RulesBucketConstructionState; + var RulesBucket = (function () { + function RulesBucket() { + this.rules = []; + } + RulesBucket.prototype.Rules = function () { + return this.rules; + }; + RulesBucket.prototype.AddRule = function (rule, specificTokens, constructionState, rulesBucketIndex) { + var position; + if (rule.Operation.Action === 1) { + position = specificTokens ? + RulesPosition.IgnoreRulesSpecific : + RulesPosition.IgnoreRulesAny; + } + else if (!rule.Operation.Context.IsAny()) { + position = specificTokens ? + RulesPosition.ContextRulesSpecific : + RulesPosition.ContextRulesAny; + } + else { + position = specificTokens ? + RulesPosition.NoContextRulesSpecific : + RulesPosition.NoContextRulesAny; + } + var state = constructionState[rulesBucketIndex]; + if (state === undefined) { + state = constructionState[rulesBucketIndex] = new RulesBucketConstructionState(); + } + var index = state.GetInsertionIndex(position); + this.rules.splice(index, 0, rule); + state.IncreaseInsertionIndex(position); + }; + return RulesBucket; + }()); + formatting.RulesBucket = RulesBucket; + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var formatting; + (function (formatting) { + var Shared; + (function (Shared) { + var TokenRangeAccess = (function () { + function TokenRangeAccess(from, to, except) { + this.tokens = []; + for (var token = from; token <= to; token++) { + if (ts.indexOf(except, token) < 0) { + this.tokens.push(token); + } + } + } + TokenRangeAccess.prototype.GetTokens = function () { + return this.tokens; + }; + TokenRangeAccess.prototype.Contains = function (token) { + return this.tokens.indexOf(token) >= 0; + }; + return TokenRangeAccess; + }()); + Shared.TokenRangeAccess = TokenRangeAccess; + var TokenValuesAccess = (function () { + function TokenValuesAccess(tks) { + this.tokens = tks && tks.length ? tks : []; + } + TokenValuesAccess.prototype.GetTokens = function () { + return this.tokens; + }; + TokenValuesAccess.prototype.Contains = function (token) { + return this.tokens.indexOf(token) >= 0; + }; + return TokenValuesAccess; + }()); + Shared.TokenValuesAccess = TokenValuesAccess; + var TokenSingleValueAccess = (function () { + function TokenSingleValueAccess(token) { + this.token = token; + } + TokenSingleValueAccess.prototype.GetTokens = function () { + return [this.token]; + }; + TokenSingleValueAccess.prototype.Contains = function (tokenValue) { + return tokenValue === this.token; + }; + return TokenSingleValueAccess; + }()); + Shared.TokenSingleValueAccess = TokenSingleValueAccess; + var TokenAllAccess = (function () { + function TokenAllAccess() { + } + TokenAllAccess.prototype.GetTokens = function () { + var result = []; + for (var token = 0; token <= 138; token++) { + result.push(token); + } + return result; + }; + TokenAllAccess.prototype.Contains = function (tokenValue) { + return true; + }; + TokenAllAccess.prototype.toString = function () { + return "[allTokens]"; + }; + return TokenAllAccess; + }()); + Shared.TokenAllAccess = TokenAllAccess; + var TokenRange = (function () { + function TokenRange(tokenAccess) { + this.tokenAccess = tokenAccess; + } + TokenRange.FromToken = function (token) { + return new TokenRange(new TokenSingleValueAccess(token)); + }; + TokenRange.FromTokens = function (tokens) { + return new TokenRange(new TokenValuesAccess(tokens)); + }; + TokenRange.FromRange = function (f, to, except) { + if (except === void 0) { except = []; } + return new TokenRange(new TokenRangeAccess(f, to, except)); + }; + TokenRange.AllTokens = function () { + return new TokenRange(new TokenAllAccess()); + }; + TokenRange.prototype.GetTokens = function () { + return this.tokenAccess.GetTokens(); + }; + TokenRange.prototype.Contains = function (token) { + return this.tokenAccess.Contains(token); + }; + TokenRange.prototype.toString = function () { + return this.tokenAccess.toString(); + }; + TokenRange.Any = TokenRange.AllTokens(); + TokenRange.AnyIncludingMultilineComments = TokenRange.FromTokens(TokenRange.Any.GetTokens().concat([3])); + TokenRange.Keywords = TokenRange.FromRange(70, 138); + TokenRange.BinaryOperators = TokenRange.FromRange(25, 68); + TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([90, 91, 138, 116, 124]); + TokenRange.UnaryPrefixOperators = TokenRange.FromTokens([41, 42, 50, 49]); + TokenRange.UnaryPrefixExpressions = TokenRange.FromTokens([8, 69, 17, 19, 15, 97, 92]); + TokenRange.UnaryPreincrementExpressions = TokenRange.FromTokens([69, 17, 97, 92]); + TokenRange.UnaryPostincrementExpressions = TokenRange.FromTokens([69, 18, 20, 92]); + TokenRange.UnaryPredecrementExpressions = TokenRange.FromTokens([69, 17, 97, 92]); + TokenRange.UnaryPostdecrementExpressions = TokenRange.FromTokens([69, 18, 20, 92]); + TokenRange.Comments = TokenRange.FromTokens([2, 3]); + TokenRange.TypeNames = TokenRange.FromTokens([69, 130, 132, 120, 133, 103, 117]); + return TokenRange; + }()); + Shared.TokenRange = TokenRange; + })(Shared = formatting.Shared || (formatting.Shared = {})); + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var formatting; + (function (formatting) { + var RulesProvider = (function () { + function RulesProvider() { + this.globalRules = new formatting.Rules(); + } + RulesProvider.prototype.getRuleName = function (rule) { + return this.globalRules.getRuleName(rule); + }; + RulesProvider.prototype.getRuleByName = function (name) { + return this.globalRules[name]; + }; + RulesProvider.prototype.getRulesMap = function () { + return this.rulesMap; + }; + RulesProvider.prototype.ensureUpToDate = function (options) { + if (this.options == null || !ts.compareDataObjects(this.options, options)) { + var activeRules = this.createActiveRules(options); + var rulesMap = formatting.RulesMap.create(activeRules); + this.activeRules = activeRules; + this.rulesMap = rulesMap; + this.options = ts.clone(options); + } + }; + RulesProvider.prototype.createActiveRules = function (options) { + var rules = this.globalRules.HighPriorityCommonRules.slice(0); + if (options.InsertSpaceAfterCommaDelimiter) { + rules.push(this.globalRules.SpaceAfterComma); + } + else { + rules.push(this.globalRules.NoSpaceAfterComma); + } + if (options.InsertSpaceAfterFunctionKeywordForAnonymousFunctions) { + rules.push(this.globalRules.SpaceAfterAnonymousFunctionKeyword); + } + else { + rules.push(this.globalRules.NoSpaceAfterAnonymousFunctionKeyword); + } + if (options.InsertSpaceAfterKeywordsInControlFlowStatements) { + rules.push(this.globalRules.SpaceAfterKeywordInControl); + } + else { + rules.push(this.globalRules.NoSpaceAfterKeywordInControl); + } + if (options.InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis) { + rules.push(this.globalRules.SpaceAfterOpenParen); + rules.push(this.globalRules.SpaceBeforeCloseParen); + rules.push(this.globalRules.NoSpaceBetweenParens); + } + else { + rules.push(this.globalRules.NoSpaceAfterOpenParen); + rules.push(this.globalRules.NoSpaceBeforeCloseParen); + rules.push(this.globalRules.NoSpaceBetweenParens); + } + if (options.InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets) { + rules.push(this.globalRules.SpaceAfterOpenBracket); + rules.push(this.globalRules.SpaceBeforeCloseBracket); + rules.push(this.globalRules.NoSpaceBetweenBrackets); + } + else { + rules.push(this.globalRules.NoSpaceAfterOpenBracket); + rules.push(this.globalRules.NoSpaceBeforeCloseBracket); + rules.push(this.globalRules.NoSpaceBetweenBrackets); + } + if (options.InsertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces) { + rules.push(this.globalRules.SpaceAfterTemplateHeadAndMiddle); + rules.push(this.globalRules.SpaceBeforeTemplateMiddleAndTail); + } + else { + rules.push(this.globalRules.NoSpaceAfterTemplateHeadAndMiddle); + rules.push(this.globalRules.NoSpaceBeforeTemplateMiddleAndTail); + } + if (options.InsertSpaceAfterSemicolonInForStatements) { + rules.push(this.globalRules.SpaceAfterSemicolonInFor); + } + else { + rules.push(this.globalRules.NoSpaceAfterSemicolonInFor); + } + if (options.InsertSpaceBeforeAndAfterBinaryOperators) { + rules.push(this.globalRules.SpaceBeforeBinaryOperator); + rules.push(this.globalRules.SpaceAfterBinaryOperator); + } + else { + rules.push(this.globalRules.NoSpaceBeforeBinaryOperator); + rules.push(this.globalRules.NoSpaceAfterBinaryOperator); + } + if (options.PlaceOpenBraceOnNewLineForControlBlocks) { + rules.push(this.globalRules.NewLineBeforeOpenBraceInControl); + } + if (options.PlaceOpenBraceOnNewLineForFunctions) { + rules.push(this.globalRules.NewLineBeforeOpenBraceInFunction); + rules.push(this.globalRules.NewLineBeforeOpenBraceInTypeScriptDeclWithBlock); + } + rules = rules.concat(this.globalRules.LowPriorityCommonRules); + return rules; + }; + return RulesProvider; + }()); + formatting.RulesProvider = RulesProvider; + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var formatting; + (function (formatting) { + function formatOnEnter(position, sourceFile, rulesProvider, options) { + var line = sourceFile.getLineAndCharacterOfPosition(position).line; + if (line === 0) { + return []; + } + var endOfFormatSpan = ts.getEndLinePosition(line, sourceFile); + while (ts.isWhiteSpace(sourceFile.text.charCodeAt(endOfFormatSpan)) && !ts.isLineBreak(sourceFile.text.charCodeAt(endOfFormatSpan))) { + endOfFormatSpan--; + } + var span = { + pos: ts.getStartPositionOfLine(line - 1, sourceFile), + end: endOfFormatSpan + 1 + }; + return formatSpan(span, sourceFile, options, rulesProvider, 2); + } + formatting.formatOnEnter = formatOnEnter; + function formatOnSemicolon(position, sourceFile, rulesProvider, options) { + return formatOutermostParent(position, 23, sourceFile, options, rulesProvider, 3); + } + formatting.formatOnSemicolon = formatOnSemicolon; + function formatOnClosingCurly(position, sourceFile, rulesProvider, options) { + return formatOutermostParent(position, 16, sourceFile, options, rulesProvider, 4); + } + formatting.formatOnClosingCurly = formatOnClosingCurly; + function formatDocument(sourceFile, rulesProvider, options) { + var span = { + pos: 0, + end: sourceFile.text.length + }; + return formatSpan(span, sourceFile, options, rulesProvider, 0); + } + formatting.formatDocument = formatDocument; + function formatSelection(start, end, sourceFile, rulesProvider, options) { + var span = { + pos: ts.getLineStartPositionForPosition(start, sourceFile), + end: end + }; + return formatSpan(span, sourceFile, options, rulesProvider, 1); + } + formatting.formatSelection = formatSelection; + function formatOutermostParent(position, expectedLastToken, sourceFile, options, rulesProvider, requestKind) { + var parent = findOutermostParent(position, expectedLastToken, sourceFile); + if (!parent) { + return []; + } + var span = { + pos: ts.getLineStartPositionForPosition(parent.getStart(sourceFile), sourceFile), + end: parent.end + }; + return formatSpan(span, sourceFile, options, rulesProvider, requestKind); + } + function findOutermostParent(position, expectedTokenKind, sourceFile) { + var precedingToken = ts.findPrecedingToken(position, sourceFile); + if (!precedingToken || + precedingToken.kind !== expectedTokenKind || + position !== precedingToken.getEnd()) { + return undefined; + } + var current = precedingToken; + while (current && + current.parent && + current.parent.end === precedingToken.end && + !isListElement(current.parent, current)) { + current = current.parent; + } + return current; + } + function isListElement(parent, node) { + switch (parent.kind) { + case 221: + case 222: + return ts.rangeContainsRange(parent.members, node); + case 225: + var body = parent.body; + return body && body.kind === 199 && ts.rangeContainsRange(body.statements, node); + case 256: + case 199: + case 226: + return ts.rangeContainsRange(parent.statements, node); + case 252: + return ts.rangeContainsRange(parent.block.statements, node); + } + return false; + } + function findEnclosingNode(range, sourceFile) { + return find(sourceFile); + function find(n) { + var candidate = ts.forEachChild(n, function (c) { return ts.startEndContainsRange(c.getStart(sourceFile), c.end, range) && c; }); + if (candidate) { + var result = find(candidate); + if (result) { + return result; + } + } + return n; + } + } + function prepareRangeContainsErrorFunction(errors, originalRange) { + if (!errors.length) { + return rangeHasNoErrors; + } + var sorted = errors + .filter(function (d) { return ts.rangeOverlapsWithStartEnd(originalRange, d.start, d.start + d.length); }) + .sort(function (e1, e2) { return e1.start - e2.start; }); + if (!sorted.length) { + return rangeHasNoErrors; + } + var index = 0; + return function (r) { + while (true) { + if (index >= sorted.length) { + return false; + } + var error = sorted[index]; + if (r.end <= error.start) { + return false; + } + if (ts.startEndOverlapsWithStartEnd(r.pos, r.end, error.start, error.start + error.length)) { + return true; + } + index++; + } + }; + function rangeHasNoErrors(r) { + return false; + } + } + function getScanStartPosition(enclosingNode, originalRange, sourceFile) { + var start = enclosingNode.getStart(sourceFile); + if (start === originalRange.pos && enclosingNode.end === originalRange.end) { + return start; + } + var precedingToken = ts.findPrecedingToken(originalRange.pos, sourceFile); + if (!precedingToken) { + return enclosingNode.pos; + } + if (precedingToken.end >= originalRange.pos) { + return enclosingNode.pos; + } + return precedingToken.end; + } + function getOwnOrInheritedDelta(n, options, sourceFile) { + var previousLine = -1; + var child; + while (n) { + var line = sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)).line; + if (previousLine !== -1 && line !== previousLine) { + break; + } + if (formatting.SmartIndenter.shouldIndentChildNode(n, child)) { + return options.IndentSize; + } + previousLine = line; + child = n; + n = n.parent; + } + return 0; + } + function formatSpan(originalRange, sourceFile, options, rulesProvider, requestKind) { + var rangeContainsError = prepareRangeContainsErrorFunction(sourceFile.parseDiagnostics, originalRange); + var formattingContext = new formatting.FormattingContext(sourceFile, requestKind); + var enclosingNode = findEnclosingNode(originalRange, sourceFile); + var formattingScanner = formatting.getFormattingScanner(sourceFile, getScanStartPosition(enclosingNode, originalRange, sourceFile), originalRange.end); + var initialIndentation = formatting.SmartIndenter.getIndentationForNode(enclosingNode, originalRange, sourceFile, options); + var previousRangeHasError; + var previousRange; + var previousParent; + var previousRangeStartLine; + var lastIndentedLine; + var indentationOnLastIndentedLine; + var edits = []; + formattingScanner.advance(); + if (formattingScanner.isOnToken()) { + var startLine = sourceFile.getLineAndCharacterOfPosition(enclosingNode.getStart(sourceFile)).line; + var undecoratedStartLine = startLine; + if (enclosingNode.decorators) { + undecoratedStartLine = sourceFile.getLineAndCharacterOfPosition(ts.getNonDecoratorTokenPosOfNode(enclosingNode, sourceFile)).line; + } + var delta = getOwnOrInheritedDelta(enclosingNode, options, sourceFile); + processNode(enclosingNode, enclosingNode, startLine, undecoratedStartLine, initialIndentation, delta); + } + if (!formattingScanner.isOnToken()) { + var leadingTrivia = formattingScanner.getCurrentLeadingTrivia(); + if (leadingTrivia) { + processTrivia(leadingTrivia, enclosingNode, enclosingNode, undefined); + trimTrailingWhitespacesForRemainingRange(); + } + } + formattingScanner.close(); + return edits; + function tryComputeIndentationForListItem(startPos, endPos, parentStartLine, range, inheritedIndentation) { + if (ts.rangeOverlapsWithStartEnd(range, startPos, endPos) || + ts.rangeContainsStartEnd(range, startPos, endPos)) { + if (inheritedIndentation !== -1) { + return inheritedIndentation; + } + } + else { + var startLine = sourceFile.getLineAndCharacterOfPosition(startPos).line; + var startLinePosition = ts.getLineStartPositionForPosition(startPos, sourceFile); + var column = formatting.SmartIndenter.findFirstNonWhitespaceColumn(startLinePosition, startPos, sourceFile, options); + if (startLine !== parentStartLine || startPos === column) { + return column; + } + } + return -1; + } + function computeIndentation(node, startLine, inheritedIndentation, parent, parentDynamicIndentation, effectiveParentStartLine) { + var indentation = inheritedIndentation; + var delta = formatting.SmartIndenter.shouldIndentChildNode(node) ? options.IndentSize : 0; + if (effectiveParentStartLine === startLine) { + indentation = startLine === lastIndentedLine + ? indentationOnLastIndentedLine + : parentDynamicIndentation.getIndentation(); + delta = Math.min(options.IndentSize, parentDynamicIndentation.getDelta(node) + delta); + } + else if (indentation === -1) { + if (formatting.SmartIndenter.childStartsOnTheSameLineWithElseInIfStatement(parent, node, startLine, sourceFile)) { + indentation = parentDynamicIndentation.getIndentation(); + } + else { + indentation = parentDynamicIndentation.getIndentation() + parentDynamicIndentation.getDelta(node); + } + } + return { + indentation: indentation, + delta: delta + }; + } + function getFirstNonDecoratorTokenOfNode(node) { + if (node.modifiers && node.modifiers.length) { + return node.modifiers[0].kind; + } + switch (node.kind) { + case 221: return 73; + case 222: return 107; + case 220: return 87; + case 224: return 224; + case 149: return 123; + case 150: return 131; + case 147: + if (node.asteriskToken) { + return 37; + } + case 145: + case 142: + return node.name.kind; + } + } + function getDynamicIndentation(node, nodeStartLine, indentation, delta) { + return { + getIndentationForComment: function (kind, tokenIndentation, container) { + switch (kind) { + case 16: + case 20: + case 18: + return indentation + getEffectiveDelta(delta, container); + } + return tokenIndentation !== -1 ? tokenIndentation : indentation; + }, + getIndentationForToken: function (line, kind, container) { + if (nodeStartLine !== line && node.decorators) { + if (kind === getFirstNonDecoratorTokenOfNode(node)) { + return indentation; + } + } + switch (kind) { + case 15: + case 16: + case 19: + case 20: + case 17: + case 18: + case 80: + case 104: + case 55: + return indentation; + default: + return nodeStartLine !== line ? indentation + getEffectiveDelta(delta, container) : indentation; + } + }, + getIndentation: function () { return indentation; }, + getDelta: function (child) { return getEffectiveDelta(delta, child); }, + recomputeIndentation: function (lineAdded) { + if (node.parent && formatting.SmartIndenter.shouldIndentChildNode(node.parent, node)) { + if (lineAdded) { + indentation += options.IndentSize; + } + else { + indentation -= options.IndentSize; + } + if (formatting.SmartIndenter.shouldIndentChildNode(node)) { + delta = options.IndentSize; + } + else { + delta = 0; + } + } + } + }; + function getEffectiveDelta(delta, child) { + return formatting.SmartIndenter.nodeWillIndentChild(node, child, true) ? delta : 0; + } + } + function processNode(node, contextNode, nodeStartLine, undecoratedNodeStartLine, indentation, delta) { + if (!ts.rangeOverlapsWithStartEnd(originalRange, node.getStart(sourceFile), node.getEnd())) { + return; + } + var nodeDynamicIndentation = getDynamicIndentation(node, nodeStartLine, indentation, delta); + var childContextNode = contextNode; + ts.forEachChild(node, function (child) { + processChildNode(child, -1, node, nodeDynamicIndentation, nodeStartLine, undecoratedNodeStartLine, false); + }, function (nodes) { + processChildNodes(nodes, node, nodeStartLine, nodeDynamicIndentation); + }); + while (formattingScanner.isOnToken()) { + var tokenInfo = formattingScanner.readTokenInfo(node); + if (tokenInfo.token.end > node.end) { + break; + } + consumeTokenAndAdvanceScanner(tokenInfo, node, nodeDynamicIndentation); + } + function processChildNode(child, inheritedIndentation, parent, parentDynamicIndentation, parentStartLine, undecoratedParentStartLine, isListItem, isFirstListItem) { + var childStartPos = child.getStart(sourceFile); + var childStartLine = sourceFile.getLineAndCharacterOfPosition(childStartPos).line; + var undecoratedChildStartLine = childStartLine; + if (child.decorators) { + undecoratedChildStartLine = sourceFile.getLineAndCharacterOfPosition(ts.getNonDecoratorTokenPosOfNode(child, sourceFile)).line; + } + var childIndentationAmount = -1; + if (isListItem) { + childIndentationAmount = tryComputeIndentationForListItem(childStartPos, child.end, parentStartLine, originalRange, inheritedIndentation); + if (childIndentationAmount !== -1) { + inheritedIndentation = childIndentationAmount; + } + } + if (!ts.rangeOverlapsWithStartEnd(originalRange, child.pos, child.end)) { + return inheritedIndentation; + } + if (child.getFullWidth() === 0) { + return inheritedIndentation; + } + while (formattingScanner.isOnToken()) { + var tokenInfo = formattingScanner.readTokenInfo(node); + if (tokenInfo.token.end > childStartPos) { + break; + } + consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation); + } + if (!formattingScanner.isOnToken()) { + return inheritedIndentation; + } + if (ts.isToken(child)) { + var tokenInfo = formattingScanner.readTokenInfo(child); + ts.Debug.assert(tokenInfo.token.end === child.end); + consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation, child); + return inheritedIndentation; + } + var effectiveParentStartLine = child.kind === 143 ? childStartLine : undecoratedParentStartLine; + var childIndentation = computeIndentation(child, childStartLine, childIndentationAmount, node, parentDynamicIndentation, effectiveParentStartLine); + processNode(child, childContextNode, childStartLine, undecoratedChildStartLine, childIndentation.indentation, childIndentation.delta); + childContextNode = node; + if (isFirstListItem && parent.kind === 170 && inheritedIndentation === -1) { + inheritedIndentation = childIndentation.indentation; + } + return inheritedIndentation; + } + function processChildNodes(nodes, parent, parentStartLine, parentDynamicIndentation) { + var listStartToken = getOpenTokenForList(parent, nodes); + var listEndToken = getCloseTokenForOpenToken(listStartToken); + var listDynamicIndentation = parentDynamicIndentation; + var startLine = parentStartLine; + if (listStartToken !== 0) { + while (formattingScanner.isOnToken()) { + var tokenInfo = formattingScanner.readTokenInfo(parent); + if (tokenInfo.token.end > nodes.pos) { + break; + } + else if (tokenInfo.token.kind === listStartToken) { + startLine = sourceFile.getLineAndCharacterOfPosition(tokenInfo.token.pos).line; + var indentation_1 = computeIndentation(tokenInfo.token, startLine, -1, parent, parentDynamicIndentation, parentStartLine); + listDynamicIndentation = getDynamicIndentation(parent, parentStartLine, indentation_1.indentation, indentation_1.delta); + consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation); + } + else { + consumeTokenAndAdvanceScanner(tokenInfo, parent, parentDynamicIndentation); + } + } + } + var inheritedIndentation = -1; + for (var i = 0; i < nodes.length; i++) { + var child = nodes[i]; + inheritedIndentation = processChildNode(child, inheritedIndentation, node, listDynamicIndentation, startLine, startLine, true, i === 0); + } + if (listEndToken !== 0) { + if (formattingScanner.isOnToken()) { + var tokenInfo = formattingScanner.readTokenInfo(parent); + if (tokenInfo.token.kind === listEndToken && ts.rangeContainsRange(parent, tokenInfo.token)) { + consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation); + } + } + } + } + function consumeTokenAndAdvanceScanner(currentTokenInfo, parent, dynamicIndentation, container) { + ts.Debug.assert(ts.rangeContainsRange(parent, currentTokenInfo.token)); + var lastTriviaWasNewLine = formattingScanner.lastTrailingTriviaWasNewLine(); + var indentToken = false; + if (currentTokenInfo.leadingTrivia) { + processTrivia(currentTokenInfo.leadingTrivia, parent, childContextNode, dynamicIndentation); + } + var lineAdded; + var isTokenInRange = ts.rangeContainsRange(originalRange, currentTokenInfo.token); + var tokenStart = sourceFile.getLineAndCharacterOfPosition(currentTokenInfo.token.pos); + if (isTokenInRange) { + var rangeHasError = rangeContainsError(currentTokenInfo.token); + var savePreviousRange = previousRange; + lineAdded = processRange(currentTokenInfo.token, tokenStart, parent, childContextNode, dynamicIndentation); + if (rangeHasError) { + indentToken = false; + } + else { + if (lineAdded !== undefined) { + indentToken = lineAdded; + } + else { + var prevEndLine = savePreviousRange && sourceFile.getLineAndCharacterOfPosition(savePreviousRange.end).line; + indentToken = lastTriviaWasNewLine && tokenStart.line !== prevEndLine; + } + } + } + if (currentTokenInfo.trailingTrivia) { + processTrivia(currentTokenInfo.trailingTrivia, parent, childContextNode, dynamicIndentation); + } + if (indentToken) { + var tokenIndentation = (isTokenInRange && !rangeContainsError(currentTokenInfo.token)) ? + dynamicIndentation.getIndentationForToken(tokenStart.line, currentTokenInfo.token.kind, container) : + -1; + var indentNextTokenOrTrivia = true; + if (currentTokenInfo.leadingTrivia) { + var commentIndentation = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind, tokenIndentation, container); + for (var _i = 0, _a = currentTokenInfo.leadingTrivia; _i < _a.length; _i++) { + var triviaItem = _a[_i]; + var triviaInRange = ts.rangeContainsRange(originalRange, triviaItem); + switch (triviaItem.kind) { + case 3: + if (triviaInRange) { + indentMultilineComment(triviaItem, commentIndentation, !indentNextTokenOrTrivia); + } + indentNextTokenOrTrivia = false; + break; + case 2: + if (indentNextTokenOrTrivia && triviaInRange) { + insertIndentation(triviaItem.pos, commentIndentation, false); + } + indentNextTokenOrTrivia = false; + break; + case 4: + indentNextTokenOrTrivia = true; + break; + } + } + } + if (tokenIndentation !== -1 && indentNextTokenOrTrivia) { + insertIndentation(currentTokenInfo.token.pos, tokenIndentation, lineAdded); + lastIndentedLine = tokenStart.line; + indentationOnLastIndentedLine = tokenIndentation; + } + } + formattingScanner.advance(); + childContextNode = parent; + } + } + function processTrivia(trivia, parent, contextNode, dynamicIndentation) { + for (var _i = 0, trivia_1 = trivia; _i < trivia_1.length; _i++) { + var triviaItem = trivia_1[_i]; + if (ts.isComment(triviaItem.kind) && ts.rangeContainsRange(originalRange, triviaItem)) { + var triviaItemStart = sourceFile.getLineAndCharacterOfPosition(triviaItem.pos); + processRange(triviaItem, triviaItemStart, parent, contextNode, dynamicIndentation); + } + } + } + function processRange(range, rangeStart, parent, contextNode, dynamicIndentation) { + var rangeHasError = rangeContainsError(range); + var lineAdded; + if (!rangeHasError && !previousRangeHasError) { + if (!previousRange) { + var originalStart = sourceFile.getLineAndCharacterOfPosition(originalRange.pos); + trimTrailingWhitespacesForLines(originalStart.line, rangeStart.line); + } + else { + lineAdded = + processPair(range, rangeStart.line, parent, previousRange, previousRangeStartLine, previousParent, contextNode, dynamicIndentation); + } + } + previousRange = range; + previousParent = parent; + previousRangeStartLine = rangeStart.line; + previousRangeHasError = rangeHasError; + return lineAdded; + } + function processPair(currentItem, currentStartLine, currentParent, previousItem, previousStartLine, previousParent, contextNode, dynamicIndentation) { + formattingContext.updateContext(previousItem, previousParent, currentItem, currentParent, contextNode); + var rule = rulesProvider.getRulesMap().GetRule(formattingContext); + var trimTrailingWhitespaces; + var lineAdded; + if (rule) { + applyRuleEdits(rule, previousItem, previousStartLine, currentItem, currentStartLine); + if (rule.Operation.Action & (2 | 8) && currentStartLine !== previousStartLine) { + lineAdded = false; + if (currentParent.getStart(sourceFile) === currentItem.pos) { + dynamicIndentation.recomputeIndentation(false); + } + } + else if (rule.Operation.Action & 4 && currentStartLine === previousStartLine) { + lineAdded = true; + if (currentParent.getStart(sourceFile) === currentItem.pos) { + dynamicIndentation.recomputeIndentation(true); + } + } + trimTrailingWhitespaces = !(rule.Operation.Action & 8) && rule.Flag !== 1; + } + else { + trimTrailingWhitespaces = true; + } + if (currentStartLine !== previousStartLine && trimTrailingWhitespaces) { + trimTrailingWhitespacesForLines(previousStartLine, currentStartLine, previousItem); + } + return lineAdded; + } + function insertIndentation(pos, indentation, lineAdded) { + var indentationString = getIndentationString(indentation, options); + if (lineAdded) { + recordReplace(pos, 0, indentationString); + } + else { + var tokenStart = sourceFile.getLineAndCharacterOfPosition(pos); + var startLinePosition = ts.getStartPositionOfLine(tokenStart.line, sourceFile); + if (indentation !== tokenStart.character || indentationIsDifferent(indentationString, startLinePosition)) { + recordReplace(startLinePosition, tokenStart.character, indentationString); + } + } + } + function indentationIsDifferent(indentationString, startLinePosition) { + return indentationString !== sourceFile.text.substr(startLinePosition, indentationString.length); + } + function indentMultilineComment(commentRange, indentation, firstLineIsIndented) { + var startLine = sourceFile.getLineAndCharacterOfPosition(commentRange.pos).line; + var endLine = sourceFile.getLineAndCharacterOfPosition(commentRange.end).line; + var parts; + if (startLine === endLine) { + if (!firstLineIsIndented) { + insertIndentation(commentRange.pos, indentation, false); + } + return; + } + else { + parts = []; + var startPos = commentRange.pos; + for (var line = startLine; line < endLine; ++line) { + var endOfLine = ts.getEndLinePosition(line, sourceFile); + parts.push({ pos: startPos, end: endOfLine }); + startPos = ts.getStartPositionOfLine(line + 1, sourceFile); + } + parts.push({ pos: startPos, end: commentRange.end }); + } + var startLinePos = ts.getStartPositionOfLine(startLine, sourceFile); + var nonWhitespaceColumnInFirstPart = formatting.SmartIndenter.findFirstNonWhitespaceCharacterAndColumn(startLinePos, parts[0].pos, sourceFile, options); + if (indentation === nonWhitespaceColumnInFirstPart.column) { + return; + } + var startIndex = 0; + if (firstLineIsIndented) { + startIndex = 1; + startLine++; + } + var delta = indentation - nonWhitespaceColumnInFirstPart.column; + for (var i = startIndex, len = parts.length; i < len; ++i, ++startLine) { + var startLinePos_1 = ts.getStartPositionOfLine(startLine, sourceFile); + var nonWhitespaceCharacterAndColumn = i === 0 + ? nonWhitespaceColumnInFirstPart + : formatting.SmartIndenter.findFirstNonWhitespaceCharacterAndColumn(parts[i].pos, parts[i].end, sourceFile, options); + var newIndentation = nonWhitespaceCharacterAndColumn.column + delta; + if (newIndentation > 0) { + var indentationString = getIndentationString(newIndentation, options); + recordReplace(startLinePos_1, nonWhitespaceCharacterAndColumn.character, indentationString); + } + else { + recordDelete(startLinePos_1, nonWhitespaceCharacterAndColumn.character); + } + } + } + function trimTrailingWhitespacesForLines(line1, line2, range) { + for (var line = line1; line < line2; ++line) { + var lineStartPosition = ts.getStartPositionOfLine(line, sourceFile); + var lineEndPosition = ts.getEndLinePosition(line, sourceFile); + if (range && (ts.isComment(range.kind) || ts.isStringOrRegularExpressionOrTemplateLiteral(range.kind)) && range.pos <= lineEndPosition && range.end > lineEndPosition) { + continue; + } + var whitespaceStart = getTrailingWhitespaceStartPosition(lineStartPosition, lineEndPosition); + if (whitespaceStart !== -1) { + ts.Debug.assert(whitespaceStart === lineStartPosition || !ts.isWhiteSpace(sourceFile.text.charCodeAt(whitespaceStart - 1))); + recordDelete(whitespaceStart, lineEndPosition + 1 - whitespaceStart); + } + } + } + function getTrailingWhitespaceStartPosition(start, end) { + var pos = end; + while (pos >= start && ts.isWhiteSpace(sourceFile.text.charCodeAt(pos))) { + pos--; + } + if (pos !== end) { + return pos + 1; + } + return -1; + } + function trimTrailingWhitespacesForRemainingRange() { + var startPosition = previousRange ? previousRange.end : originalRange.pos; + var startLine = sourceFile.getLineAndCharacterOfPosition(startPosition).line; + var endLine = sourceFile.getLineAndCharacterOfPosition(originalRange.end).line; + trimTrailingWhitespacesForLines(startLine, endLine + 1, previousRange); + } + function newTextChange(start, len, newText) { + return { span: ts.createTextSpan(start, len), newText: newText }; + } + function recordDelete(start, len) { + if (len) { + edits.push(newTextChange(start, len, "")); + } + } + function recordReplace(start, len, newText) { + if (len || newText) { + edits.push(newTextChange(start, len, newText)); + } + } + function applyRuleEdits(rule, previousRange, previousStartLine, currentRange, currentStartLine) { + var between; + switch (rule.Operation.Action) { + case 1: + return; + case 8: + if (previousRange.end !== currentRange.pos) { + recordDelete(previousRange.end, currentRange.pos - previousRange.end); + } + break; + case 4: + if (rule.Flag !== 1 && previousStartLine !== currentStartLine) { + return; + } + var lineDelta = currentStartLine - previousStartLine; + if (lineDelta !== 1) { + recordReplace(previousRange.end, currentRange.pos - previousRange.end, options.NewLineCharacter); + } + break; + case 2: + if (rule.Flag !== 1 && previousStartLine !== currentStartLine) { + return; + } + var posDelta = currentRange.pos - previousRange.end; + if (posDelta !== 1 || sourceFile.text.charCodeAt(previousRange.end) !== 32) { + recordReplace(previousRange.end, currentRange.pos - previousRange.end, " "); + } + break; + } + } + } + function isSomeBlock(kind) { + switch (kind) { + case 199: + case 226: + return true; + } + return false; + } + function getOpenTokenForList(node, list) { + switch (node.kind) { + case 148: + case 220: + case 179: + case 147: + case 146: + case 180: + if (node.typeParameters === list) { + return 25; + } + else if (node.parameters === list) { + return 17; + } + break; + case 174: + case 175: + if (node.typeArguments === list) { + return 25; + } + else if (node.arguments === list) { + return 17; + } + break; + case 155: + if (node.typeArguments === list) { + return 25; + } + } + return 0; + } + function getCloseTokenForOpenToken(kind) { + switch (kind) { + case 17: + return 18; + case 25: + return 27; + } + return 0; + } + var internedSizes; + var internedTabsIndentation; + var internedSpacesIndentation; + function getIndentationString(indentation, options) { + var resetInternedStrings = !internedSizes || (internedSizes.tabSize !== options.TabSize || internedSizes.indentSize !== options.IndentSize); + if (resetInternedStrings) { + internedSizes = { tabSize: options.TabSize, indentSize: options.IndentSize }; + internedTabsIndentation = internedSpacesIndentation = undefined; + } + if (!options.ConvertTabsToSpaces) { + var tabs = Math.floor(indentation / options.TabSize); + var spaces = indentation - tabs * options.TabSize; + var tabString = void 0; + if (!internedTabsIndentation) { + internedTabsIndentation = []; + } + if (internedTabsIndentation[tabs] === undefined) { + internedTabsIndentation[tabs] = tabString = repeat('\t', tabs); + } + else { + tabString = internedTabsIndentation[tabs]; + } + return spaces ? tabString + repeat(" ", spaces) : tabString; + } + else { + var spacesString = void 0; + var quotient = Math.floor(indentation / options.IndentSize); + var remainder = indentation % options.IndentSize; + if (!internedSpacesIndentation) { + internedSpacesIndentation = []; + } + if (internedSpacesIndentation[quotient] === undefined) { + spacesString = repeat(" ", options.IndentSize * quotient); + internedSpacesIndentation[quotient] = spacesString; + } + else { + spacesString = internedSpacesIndentation[quotient]; + } + return remainder ? spacesString + repeat(" ", remainder) : spacesString; + } + function repeat(value, count) { + var s = ""; + for (var i = 0; i < count; ++i) { + s += value; + } + return s; + } + } + formatting.getIndentationString = getIndentationString; + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var formatting; + (function (formatting) { + var SmartIndenter; + (function (SmartIndenter) { + function getIndentation(position, sourceFile, options) { + if (position > sourceFile.text.length) { + return 0; + } + if (options.IndentStyle === ts.IndentStyle.None) { + return 0; + } + var precedingToken = ts.findPrecedingToken(position, sourceFile); + if (!precedingToken) { + return 0; + } + var precedingTokenIsLiteral = ts.isStringOrRegularExpressionOrTemplateLiteral(precedingToken.kind); + if (precedingTokenIsLiteral && precedingToken.getStart(sourceFile) <= position && precedingToken.end > position) { + return 0; + } + var lineAtPosition = sourceFile.getLineAndCharacterOfPosition(position).line; + if (options.IndentStyle === ts.IndentStyle.Block) { + var current_1 = position; + while (current_1 > 0) { + var char = sourceFile.text.charCodeAt(current_1); + if (!ts.isWhiteSpace(char) && !ts.isLineBreak(char)) { + break; + } + current_1--; + } + var lineStart = ts.getLineStartPositionForPosition(current_1, sourceFile); + return SmartIndenter.findFirstNonWhitespaceColumn(lineStart, current_1, sourceFile, options); + } + if (precedingToken.kind === 24 && precedingToken.parent.kind !== 187) { + var actualIndentation = getActualIndentationForListItemBeforeComma(precedingToken, sourceFile, options); + if (actualIndentation !== -1) { + return actualIndentation; + } + } + var previous; + var current = precedingToken; + var currentStart; + var indentationDelta; + while (current) { + if (ts.positionBelongsToNode(current, position, sourceFile) && shouldIndentChildNode(current, previous)) { + currentStart = getStartLineAndCharacterForNode(current, sourceFile); + if (nextTokenIsCurlyBraceOnSameLineAsCursor(precedingToken, current, lineAtPosition, sourceFile)) { + indentationDelta = 0; + } + else { + indentationDelta = lineAtPosition !== currentStart.line ? options.IndentSize : 0; + } + break; + } + var actualIndentation = getActualIndentationForListItem(current, sourceFile, options); + if (actualIndentation !== -1) { + return actualIndentation; + } + actualIndentation = getLineIndentationWhenExpressionIsInMultiLine(current, sourceFile, options); + if (actualIndentation !== -1) { + return actualIndentation + options.IndentSize; + } + previous = current; + current = current.parent; + } + if (!current) { + return 0; + } + return getIndentationForNodeWorker(current, currentStart, undefined, indentationDelta, sourceFile, options); + } + SmartIndenter.getIndentation = getIndentation; + function getIndentationForNode(n, ignoreActualIndentationRange, sourceFile, options) { + var start = sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)); + return getIndentationForNodeWorker(n, start, ignoreActualIndentationRange, 0, sourceFile, options); + } + SmartIndenter.getIndentationForNode = getIndentationForNode; + function getIndentationForNodeWorker(current, currentStart, ignoreActualIndentationRange, indentationDelta, sourceFile, options) { + var parent = current.parent; + var parentStart; + while (parent) { + var useActualIndentation = true; + if (ignoreActualIndentationRange) { + var start = current.getStart(sourceFile); + useActualIndentation = start < ignoreActualIndentationRange.pos || start > ignoreActualIndentationRange.end; + } + if (useActualIndentation) { + var actualIndentation = getActualIndentationForListItem(current, sourceFile, options); + if (actualIndentation !== -1) { + return actualIndentation + indentationDelta; + } + } + parentStart = getParentStart(parent, current, sourceFile); + var parentAndChildShareLine = parentStart.line === currentStart.line || + childStartsOnTheSameLineWithElseInIfStatement(parent, current, currentStart.line, sourceFile); + if (useActualIndentation) { + var actualIndentation = getActualIndentationForNode(current, parent, currentStart, parentAndChildShareLine, sourceFile, options); + if (actualIndentation !== -1) { + return actualIndentation + indentationDelta; + } + actualIndentation = getLineIndentationWhenExpressionIsInMultiLine(current, sourceFile, options); + if (actualIndentation !== -1) { + return actualIndentation + indentationDelta; + } + } + if (shouldIndentChildNode(parent, current) && !parentAndChildShareLine) { + indentationDelta += options.IndentSize; + } + current = parent; + currentStart = parentStart; + parent = current.parent; + } + return indentationDelta; + } + function getParentStart(parent, child, sourceFile) { + var containingList = getContainingList(child, sourceFile); + if (containingList) { + return sourceFile.getLineAndCharacterOfPosition(containingList.pos); + } + return sourceFile.getLineAndCharacterOfPosition(parent.getStart(sourceFile)); + } + function getActualIndentationForListItemBeforeComma(commaToken, sourceFile, options) { + var commaItemInfo = ts.findListItemInfo(commaToken); + if (commaItemInfo && commaItemInfo.listItemIndex > 0) { + return deriveActualIndentationFromList(commaItemInfo.list.getChildren(), commaItemInfo.listItemIndex - 1, sourceFile, options); + } + else { + return -1; + } + } + function getActualIndentationForNode(current, parent, currentLineAndChar, parentAndChildShareLine, sourceFile, options) { + var useActualIndentation = (ts.isDeclaration(current) || ts.isStatement(current)) && + (parent.kind === 256 || !parentAndChildShareLine); + if (!useActualIndentation) { + return -1; + } + return findColumnForFirstNonWhitespaceCharacterInLine(currentLineAndChar, sourceFile, options); + } + function nextTokenIsCurlyBraceOnSameLineAsCursor(precedingToken, current, lineAtPosition, sourceFile) { + var nextToken = ts.findNextToken(precedingToken, current); + if (!nextToken) { + return false; + } + if (nextToken.kind === 15) { + return true; + } + else if (nextToken.kind === 16) { + var nextTokenStartLine = getStartLineAndCharacterForNode(nextToken, sourceFile).line; + return lineAtPosition === nextTokenStartLine; + } + return false; + } + function getStartLineAndCharacterForNode(n, sourceFile) { + return sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)); + } + function childStartsOnTheSameLineWithElseInIfStatement(parent, child, childStartLine, sourceFile) { + if (parent.kind === 203 && parent.elseStatement === child) { + var elseKeyword = ts.findChildOfKind(parent, 80, sourceFile); + ts.Debug.assert(elseKeyword !== undefined); + var elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line; + return elseKeywordStartLine === childStartLine; + } + return false; + } + SmartIndenter.childStartsOnTheSameLineWithElseInIfStatement = childStartsOnTheSameLineWithElseInIfStatement; + function getContainingList(node, sourceFile) { + if (node.parent) { + switch (node.parent.kind) { + case 155: + if (node.parent.typeArguments && + ts.rangeContainsStartEnd(node.parent.typeArguments, node.getStart(sourceFile), node.getEnd())) { + return node.parent.typeArguments; + } + break; + case 171: + return node.parent.properties; + case 170: + return node.parent.elements; + case 220: + case 179: + case 180: + case 147: + case 146: + case 151: + case 152: { + var start = node.getStart(sourceFile); + if (node.parent.typeParameters && + ts.rangeContainsStartEnd(node.parent.typeParameters, start, node.getEnd())) { + return node.parent.typeParameters; + } + if (ts.rangeContainsStartEnd(node.parent.parameters, start, node.getEnd())) { + return node.parent.parameters; + } + break; + } + case 175: + case 174: { + var start = node.getStart(sourceFile); + if (node.parent.typeArguments && + ts.rangeContainsStartEnd(node.parent.typeArguments, start, node.getEnd())) { + return node.parent.typeArguments; + } + if (node.parent.arguments && + ts.rangeContainsStartEnd(node.parent.arguments, start, node.getEnd())) { + return node.parent.arguments; + } + break; + } + } + } + return undefined; + } + function getActualIndentationForListItem(node, sourceFile, options) { + var containingList = getContainingList(node, sourceFile); + return containingList ? getActualIndentationFromList(containingList) : -1; + function getActualIndentationFromList(list) { + var index = ts.indexOf(list, node); + return index !== -1 ? deriveActualIndentationFromList(list, index, sourceFile, options) : -1; + } + } + function getLineIndentationWhenExpressionIsInMultiLine(node, sourceFile, options) { + if (node.kind === 18) { + return -1; + } + if (node.parent && (node.parent.kind === 174 || + node.parent.kind === 175) && + node.parent.expression !== node) { + var fullCallOrNewExpression = node.parent.expression; + var startingExpression = getStartingExpression(fullCallOrNewExpression); + if (fullCallOrNewExpression === startingExpression) { + return -1; + } + var fullCallOrNewExpressionEnd = sourceFile.getLineAndCharacterOfPosition(fullCallOrNewExpression.end); + var startingExpressionEnd = sourceFile.getLineAndCharacterOfPosition(startingExpression.end); + if (fullCallOrNewExpressionEnd.line === startingExpressionEnd.line) { + return -1; + } + return findColumnForFirstNonWhitespaceCharacterInLine(fullCallOrNewExpressionEnd, sourceFile, options); + } + return -1; + function getStartingExpression(node) { + while (true) { + switch (node.kind) { + case 174: + case 175: + case 172: + case 173: + node = node.expression; + break; + default: + return node; + } + } + } + } + function deriveActualIndentationFromList(list, index, sourceFile, options) { + ts.Debug.assert(index >= 0 && index < list.length); + var node = list[index]; + var lineAndCharacter = getStartLineAndCharacterForNode(node, sourceFile); + for (var i = index - 1; i >= 0; --i) { + if (list[i].kind === 24) { + continue; + } + var prevEndLine = sourceFile.getLineAndCharacterOfPosition(list[i].end).line; + if (prevEndLine !== lineAndCharacter.line) { + return findColumnForFirstNonWhitespaceCharacterInLine(lineAndCharacter, sourceFile, options); + } + lineAndCharacter = getStartLineAndCharacterForNode(list[i], sourceFile); + } + return -1; + } + function findColumnForFirstNonWhitespaceCharacterInLine(lineAndCharacter, sourceFile, options) { + var lineStart = sourceFile.getPositionOfLineAndCharacter(lineAndCharacter.line, 0); + return findFirstNonWhitespaceColumn(lineStart, lineStart + lineAndCharacter.character, sourceFile, options); + } + function findFirstNonWhitespaceCharacterAndColumn(startPos, endPos, sourceFile, options) { + var character = 0; + var column = 0; + for (var pos = startPos; pos < endPos; ++pos) { + var ch = sourceFile.text.charCodeAt(pos); + if (!ts.isWhiteSpace(ch)) { + break; + } + if (ch === 9) { + column += options.TabSize + (column % options.TabSize); + } + else { + column++; + } + character++; + } + return { column: column, character: character }; + } + SmartIndenter.findFirstNonWhitespaceCharacterAndColumn = findFirstNonWhitespaceCharacterAndColumn; + function findFirstNonWhitespaceColumn(startPos, endPos, sourceFile, options) { + return findFirstNonWhitespaceCharacterAndColumn(startPos, endPos, sourceFile, options).column; + } + SmartIndenter.findFirstNonWhitespaceColumn = findFirstNonWhitespaceColumn; + function nodeContentIsAlwaysIndented(kind) { + switch (kind) { + case 202: + case 221: + case 192: + case 222: + case 224: + case 223: + case 170: + case 199: + case 226: + case 171: + case 159: + case 161: + case 227: + case 250: + case 249: + case 178: + case 172: + case 174: + case 175: + case 200: + case 218: + case 235: + case 211: + case 188: + case 168: + case 167: + case 243: + case 242: + case 248: + case 146: + case 151: + case 152: + case 142: + case 156: + case 157: + case 164: + case 176: + case 184: + case 233: + return true; + } + return false; + } + function nodeWillIndentChild(parent, child, indentByDefault) { + var childKind = child ? child.kind : 0; + switch (parent.kind) { + case 204: + case 205: + case 207: + case 208: + case 206: + case 203: + case 220: + case 179: + case 147: + case 180: + case 148: + case 149: + case 150: + return childKind !== 199; + case 241: + return childKind !== 245; + } + return indentByDefault; + } + SmartIndenter.nodeWillIndentChild = nodeWillIndentChild; + function shouldIndentChildNode(parent, child) { + return nodeContentIsAlwaysIndented(parent.kind) || nodeWillIndentChild(parent, child, false); + } + SmartIndenter.shouldIndentChildNode = shouldIndentChildNode; + })(SmartIndenter = formatting.SmartIndenter || (formatting.SmartIndenter = {})); + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + ts.servicesVersion = "0.5"; + var ScriptSnapshot; + (function (ScriptSnapshot) { + var StringScriptSnapshot = (function () { + function StringScriptSnapshot(text) { + this.text = text; + } + StringScriptSnapshot.prototype.getText = function (start, end) { + return this.text.substring(start, end); + }; + StringScriptSnapshot.prototype.getLength = function () { + return this.text.length; + }; + StringScriptSnapshot.prototype.getChangeRange = function (oldSnapshot) { + return undefined; + }; + return StringScriptSnapshot; + }()); + function fromString(text) { + return new StringScriptSnapshot(text); + } + ScriptSnapshot.fromString = fromString; + })(ScriptSnapshot = ts.ScriptSnapshot || (ts.ScriptSnapshot = {})); + var scanner = ts.createScanner(2, true); + var emptyArray = []; + var jsDocTagNames = [ + "augments", + "author", + "argument", + "borrows", + "class", + "constant", + "constructor", + "constructs", + "default", + "deprecated", + "description", + "event", + "example", + "extends", + "field", + "fileOverview", + "function", + "ignore", + "inner", + "lends", + "link", + "memberOf", + "name", + "namespace", + "param", + "private", + "property", + "public", + "requires", + "returns", + "see", + "since", + "static", + "throws", + "type", + "version" + ]; + var jsDocCompletionEntries; + function createNode(kind, pos, end, flags, parent) { + var node = new NodeObject(kind, pos, end); + node.flags = flags; + node.parent = parent; + return node; + } + var NodeObject = (function () { + function NodeObject(kind, pos, end) { + this.kind = kind; + this.pos = pos; + this.end = end; + this.flags = 0; + this.parent = undefined; + } + NodeObject.prototype.getSourceFile = function () { + return ts.getSourceFileOfNode(this); + }; + NodeObject.prototype.getStart = function (sourceFile) { + return ts.getTokenPosOfNode(this, sourceFile); + }; + NodeObject.prototype.getFullStart = function () { + return this.pos; + }; + NodeObject.prototype.getEnd = function () { + return this.end; + }; + NodeObject.prototype.getWidth = function (sourceFile) { + return this.getEnd() - this.getStart(sourceFile); + }; + NodeObject.prototype.getFullWidth = function () { + return this.end - this.pos; + }; + NodeObject.prototype.getLeadingTriviaWidth = function (sourceFile) { + return this.getStart(sourceFile) - this.pos; + }; + NodeObject.prototype.getFullText = function (sourceFile) { + return (sourceFile || this.getSourceFile()).text.substring(this.pos, this.end); + }; + NodeObject.prototype.getText = function (sourceFile) { + return (sourceFile || this.getSourceFile()).text.substring(this.getStart(), this.getEnd()); + }; + NodeObject.prototype.addSyntheticNodes = function (nodes, pos, end) { + scanner.setTextPos(pos); + while (pos < end) { + var token = scanner.scan(); + var textPos = scanner.getTextPos(); + nodes.push(createNode(token, pos, textPos, 0, this)); + pos = textPos; + } + return pos; + }; + NodeObject.prototype.createSyntaxList = function (nodes) { + var list = createNode(279, nodes.pos, nodes.end, 0, this); + list._children = []; + var pos = nodes.pos; + for (var _i = 0, nodes_7 = nodes; _i < nodes_7.length; _i++) { + var node = nodes_7[_i]; + if (pos < node.pos) { + pos = this.addSyntheticNodes(list._children, pos, node.pos); + } + list._children.push(node); + pos = node.end; + } + if (pos < nodes.end) { + this.addSyntheticNodes(list._children, pos, nodes.end); + } + return list; + }; + NodeObject.prototype.createChildren = function (sourceFile) { + var _this = this; + var children; + if (this.kind >= 139) { + scanner.setText((sourceFile || this.getSourceFile()).text); + children = []; + var pos_3 = this.pos; + var processNode = function (node) { + if (pos_3 < node.pos) { + pos_3 = _this.addSyntheticNodes(children, pos_3, node.pos); + } + children.push(node); + pos_3 = node.end; + }; + var processNodes = function (nodes) { + if (pos_3 < nodes.pos) { + pos_3 = _this.addSyntheticNodes(children, pos_3, nodes.pos); + } + children.push(_this.createSyntaxList(nodes)); + pos_3 = nodes.end; + }; + ts.forEachChild(this, processNode, processNodes); + if (pos_3 < this.end) { + this.addSyntheticNodes(children, pos_3, this.end); + } + scanner.setText(undefined); + } + this._children = children || emptyArray; + }; + NodeObject.prototype.getChildCount = function (sourceFile) { + if (!this._children) + this.createChildren(sourceFile); + return this._children.length; + }; + NodeObject.prototype.getChildAt = function (index, sourceFile) { + if (!this._children) + this.createChildren(sourceFile); + return this._children[index]; + }; + NodeObject.prototype.getChildren = function (sourceFile) { + if (!this._children) + this.createChildren(sourceFile); + return this._children; + }; + NodeObject.prototype.getFirstToken = function (sourceFile) { + var children = this.getChildren(sourceFile); + if (!children.length) { + return undefined; + } + var child = children[0]; + return child.kind < 139 ? child : child.getFirstToken(sourceFile); + }; + NodeObject.prototype.getLastToken = function (sourceFile) { + var children = this.getChildren(sourceFile); + var child = ts.lastOrUndefined(children); + if (!child) { + return undefined; + } + return child.kind < 139 ? child : child.getLastToken(sourceFile); + }; + return NodeObject; + }()); + var SymbolObject = (function () { + function SymbolObject(flags, name) { + this.flags = flags; + this.name = name; + } + SymbolObject.prototype.getFlags = function () { + return this.flags; + }; + SymbolObject.prototype.getName = function () { + return this.name; + }; + SymbolObject.prototype.getDeclarations = function () { + return this.declarations; + }; + SymbolObject.prototype.getDocumentationComment = function () { + if (this.documentationComment === undefined) { + this.documentationComment = getJsDocCommentsFromDeclarations(this.declarations, this.name, !(this.flags & 4)); + } + return this.documentationComment; + }; + return SymbolObject; + }()); + function getJsDocCommentsFromDeclarations(declarations, name, canUseParsedParamTagComments) { + var documentationComment = []; + var docComments = getJsDocCommentsSeparatedByNewLines(); + ts.forEach(docComments, function (docComment) { + if (documentationComment.length) { + documentationComment.push(ts.lineBreakPart()); + } + documentationComment.push(docComment); + }); + return documentationComment; + function getJsDocCommentsSeparatedByNewLines() { + var paramTag = "@param"; + var jsDocCommentParts = []; + ts.forEach(declarations, function (declaration, indexOfDeclaration) { + if (ts.indexOf(declarations, declaration) === indexOfDeclaration) { + var sourceFileOfDeclaration_1 = ts.getSourceFileOfNode(declaration); + if (canUseParsedParamTagComments && declaration.kind === 142) { + ts.forEach(getJsDocCommentTextRange(declaration.parent, sourceFileOfDeclaration_1), function (jsDocCommentTextRange) { + var cleanedParamJsDocComment = getCleanedParamJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration_1); + if (cleanedParamJsDocComment) { + ts.addRange(jsDocCommentParts, cleanedParamJsDocComment); + } + }); + } + if (declaration.kind === 225 && declaration.body.kind === 225) { + return; + } + while (declaration.kind === 225 && declaration.parent.kind === 225) { + declaration = declaration.parent; + } + ts.forEach(getJsDocCommentTextRange(declaration.kind === 218 ? declaration.parent.parent : declaration, sourceFileOfDeclaration_1), function (jsDocCommentTextRange) { + var cleanedJsDocComment = getCleanedJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration_1); + if (cleanedJsDocComment) { + ts.addRange(jsDocCommentParts, cleanedJsDocComment); + } + }); + } + }); + return jsDocCommentParts; + function getJsDocCommentTextRange(node, sourceFile) { + return ts.map(ts.getJsDocComments(node, sourceFile), function (jsDocComment) { + return { + pos: jsDocComment.pos + "/*".length, + end: jsDocComment.end - "*/".length + }; + }); + } + function consumeWhiteSpacesOnTheLine(pos, end, sourceFile, maxSpacesToRemove) { + if (maxSpacesToRemove !== undefined) { + end = Math.min(end, pos + maxSpacesToRemove); + } + for (; pos < end; pos++) { + var ch = sourceFile.text.charCodeAt(pos); + if (!ts.isWhiteSpace(ch) || ts.isLineBreak(ch)) { + return pos; + } + } + return end; + } + function consumeLineBreaks(pos, end, sourceFile) { + while (pos < end && ts.isLineBreak(sourceFile.text.charCodeAt(pos))) { + pos++; + } + return pos; + } + function isName(pos, end, sourceFile, name) { + return pos + name.length < end && + sourceFile.text.substr(pos, name.length) === name && + (ts.isWhiteSpace(sourceFile.text.charCodeAt(pos + name.length)) || + ts.isLineBreak(sourceFile.text.charCodeAt(pos + name.length))); + } + function isParamTag(pos, end, sourceFile) { + return isName(pos, end, sourceFile, paramTag); + } + function pushDocCommentLineText(docComments, text, blankLineCount) { + while (blankLineCount) { + blankLineCount--; + docComments.push(ts.textPart("")); + } + docComments.push(ts.textPart(text)); + } + function getCleanedJsDocComment(pos, end, sourceFile) { + var spacesToRemoveAfterAsterisk; + var docComments = []; + var blankLineCount = 0; + var isInParamTag = false; + while (pos < end) { + var docCommentTextOfLine = ""; + pos = consumeWhiteSpacesOnTheLine(pos, end, sourceFile); + if (pos < end && sourceFile.text.charCodeAt(pos) === 42) { + var lineStartPos = pos + 1; + pos = consumeWhiteSpacesOnTheLine(pos + 1, end, sourceFile, spacesToRemoveAfterAsterisk); + if (spacesToRemoveAfterAsterisk === undefined && pos < end && !ts.isLineBreak(sourceFile.text.charCodeAt(pos))) { + spacesToRemoveAfterAsterisk = pos - lineStartPos; + } + } + else if (spacesToRemoveAfterAsterisk === undefined) { + spacesToRemoveAfterAsterisk = 0; + } + while (pos < end && !ts.isLineBreak(sourceFile.text.charCodeAt(pos))) { + var ch = sourceFile.text.charAt(pos); + if (ch === "@") { + if (isParamTag(pos, end, sourceFile)) { + isInParamTag = true; + pos += paramTag.length; + continue; + } + else { + isInParamTag = false; + } + } + if (!isInParamTag) { + docCommentTextOfLine += ch; + } + pos++; + } + pos = consumeLineBreaks(pos, end, sourceFile); + if (docCommentTextOfLine) { + pushDocCommentLineText(docComments, docCommentTextOfLine, blankLineCount); + blankLineCount = 0; + } + else if (!isInParamTag && docComments.length) { + blankLineCount++; + } + } + return docComments; + } + function getCleanedParamJsDocComment(pos, end, sourceFile) { + var paramHelpStringMargin; + var paramDocComments = []; + while (pos < end) { + if (isParamTag(pos, end, sourceFile)) { + var blankLineCount = 0; + var recordedParamTag = false; + pos = consumeWhiteSpaces(pos + paramTag.length); + if (pos >= end) { + break; + } + if (sourceFile.text.charCodeAt(pos) === 123) { + pos++; + for (var curlies = 1; pos < end; pos++) { + var charCode = sourceFile.text.charCodeAt(pos); + if (charCode === 123) { + curlies++; + continue; + } + if (charCode === 125) { + curlies--; + if (curlies === 0) { + pos++; + break; + } + else { + continue; + } + } + if (charCode === 64) { + break; + } + } + pos = consumeWhiteSpaces(pos); + if (pos >= end) { + break; + } + } + if (isName(pos, end, sourceFile, name)) { + pos = consumeWhiteSpaces(pos + name.length); + if (pos >= end) { + break; + } + var paramHelpString = ""; + var firstLineParamHelpStringPos = pos; + while (pos < end) { + var ch = sourceFile.text.charCodeAt(pos); + if (ts.isLineBreak(ch)) { + if (paramHelpString) { + pushDocCommentLineText(paramDocComments, paramHelpString, blankLineCount); + paramHelpString = ""; + blankLineCount = 0; + recordedParamTag = true; + } + else if (recordedParamTag) { + blankLineCount++; + } + setPosForParamHelpStringOnNextLine(firstLineParamHelpStringPos); + continue; + } + if (ch === 64) { + break; + } + paramHelpString += sourceFile.text.charAt(pos); + pos++; + } + if (paramHelpString) { + pushDocCommentLineText(paramDocComments, paramHelpString, blankLineCount); + } + paramHelpStringMargin = undefined; + } + if (sourceFile.text.charCodeAt(pos) === 64) { + continue; + } + } + pos++; + } + return paramDocComments; + function consumeWhiteSpaces(pos) { + while (pos < end && ts.isWhiteSpace(sourceFile.text.charCodeAt(pos))) { + pos++; + } + return pos; + } + function setPosForParamHelpStringOnNextLine(firstLineParamHelpStringPos) { + pos = consumeLineBreaks(pos, end, sourceFile); + if (pos >= end) { + return; + } + if (paramHelpStringMargin === undefined) { + paramHelpStringMargin = sourceFile.getLineAndCharacterOfPosition(firstLineParamHelpStringPos).character; + } + var startOfLinePos = pos; + pos = consumeWhiteSpacesOnTheLine(pos, end, sourceFile, paramHelpStringMargin); + if (pos >= end) { + return; + } + var consumedSpaces = pos - startOfLinePos; + if (consumedSpaces < paramHelpStringMargin) { + var ch = sourceFile.text.charCodeAt(pos); + if (ch === 42) { + pos = consumeWhiteSpacesOnTheLine(pos + 1, end, sourceFile, paramHelpStringMargin - consumedSpaces - 1); + } + } + } + } + } + } + var TypeObject = (function () { + function TypeObject(checker, flags) { + this.checker = checker; + this.flags = flags; + } + TypeObject.prototype.getFlags = function () { + return this.flags; + }; + TypeObject.prototype.getSymbol = function () { + return this.symbol; + }; + TypeObject.prototype.getProperties = function () { + return this.checker.getPropertiesOfType(this); + }; + TypeObject.prototype.getProperty = function (propertyName) { + return this.checker.getPropertyOfType(this, propertyName); + }; + TypeObject.prototype.getApparentProperties = function () { + return this.checker.getAugmentedPropertiesOfType(this); + }; + TypeObject.prototype.getCallSignatures = function () { + return this.checker.getSignaturesOfType(this, 0); + }; + TypeObject.prototype.getConstructSignatures = function () { + return this.checker.getSignaturesOfType(this, 1); + }; + TypeObject.prototype.getStringIndexType = function () { + return this.checker.getIndexTypeOfType(this, 0); + }; + TypeObject.prototype.getNumberIndexType = function () { + return this.checker.getIndexTypeOfType(this, 1); + }; + TypeObject.prototype.getBaseTypes = function () { + return this.flags & (1024 | 2048) + ? this.checker.getBaseTypes(this) + : undefined; + }; + TypeObject.prototype.getNonNullableType = function () { + return this.checker.getNonNullableType(this); + }; + return TypeObject; + }()); + var SignatureObject = (function () { + function SignatureObject(checker) { + this.checker = checker; + } + SignatureObject.prototype.getDeclaration = function () { + return this.declaration; + }; + SignatureObject.prototype.getTypeParameters = function () { + return this.typeParameters; + }; + SignatureObject.prototype.getParameters = function () { + return this.parameters; + }; + SignatureObject.prototype.getReturnType = function () { + return this.checker.getReturnTypeOfSignature(this); + }; + SignatureObject.prototype.getDocumentationComment = function () { + if (this.documentationComment === undefined) { + this.documentationComment = this.declaration ? getJsDocCommentsFromDeclarations([this.declaration], undefined, false) : []; + } + return this.documentationComment; + }; + return SignatureObject; + }()); + var SourceFileObject = (function (_super) { + __extends(SourceFileObject, _super); + function SourceFileObject(kind, pos, end) { + _super.call(this, kind, pos, end); + } + SourceFileObject.prototype.update = function (newText, textChangeRange) { + return ts.updateSourceFile(this, newText, textChangeRange); + }; + SourceFileObject.prototype.getLineAndCharacterOfPosition = function (position) { + return ts.getLineAndCharacterOfPosition(this, position); + }; + SourceFileObject.prototype.getLineStarts = function () { + return ts.getLineStarts(this); + }; + SourceFileObject.prototype.getPositionOfLineAndCharacter = function (line, character) { + return ts.getPositionOfLineAndCharacter(this, line, character); + }; + SourceFileObject.prototype.getNamedDeclarations = function () { + if (!this.namedDeclarations) { + this.namedDeclarations = this.computeNamedDeclarations(); + } + return this.namedDeclarations; + }; + SourceFileObject.prototype.computeNamedDeclarations = function () { + var result = {}; + ts.forEachChild(this, visit); + return result; + function addDeclaration(declaration) { + var name = getDeclarationName(declaration); + if (name) { + var declarations = getDeclarations(name); + declarations.push(declaration); + } + } + function getDeclarations(name) { + return ts.getProperty(result, name) || (result[name] = []); + } + function getDeclarationName(declaration) { + if (declaration.name) { + var result_2 = getTextOfIdentifierOrLiteral(declaration.name); + if (result_2 !== undefined) { + return result_2; + } + if (declaration.name.kind === 140) { + var expr = declaration.name.expression; + if (expr.kind === 172) { + return expr.name.text; + } + return getTextOfIdentifierOrLiteral(expr); + } + } + return undefined; + } + function getTextOfIdentifierOrLiteral(node) { + if (node) { + if (node.kind === 69 || + node.kind === 9 || + node.kind === 8) { + return node.text; + } + } + return undefined; + } + function visit(node) { + switch (node.kind) { + case 220: + case 179: + case 147: + case 146: + var functionDeclaration = node; + var declarationName = getDeclarationName(functionDeclaration); + if (declarationName) { + var declarations = getDeclarations(declarationName); + var lastDeclaration = ts.lastOrUndefined(declarations); + if (lastDeclaration && functionDeclaration.parent === lastDeclaration.parent && functionDeclaration.symbol === lastDeclaration.symbol) { + if (functionDeclaration.body && !lastDeclaration.body) { + declarations[declarations.length - 1] = functionDeclaration; + } + } + else { + declarations.push(functionDeclaration); + } + ts.forEachChild(node, visit); + } + break; + case 221: + case 192: + case 222: + case 223: + case 224: + case 225: + case 229: + case 238: + case 234: + case 229: + case 231: + case 232: + case 149: + case 150: + case 159: + addDeclaration(node); + ts.forEachChild(node, visit); + break; + case 142: + if (!(node.flags & 92)) { + break; + } + case 218: + case 169: { + var decl = node; + if (ts.isBindingPattern(decl.name)) { + ts.forEachChild(decl.name, visit); + break; + } + if (decl.initializer) + visit(decl.initializer); + } + case 255: + case 145: + case 144: + addDeclaration(node); + break; + case 236: + if (node.exportClause) { + ts.forEach(node.exportClause.elements, visit); + } + break; + case 230: + var importClause = node.importClause; + if (importClause) { + if (importClause.name) { + addDeclaration(importClause); + } + if (importClause.namedBindings) { + if (importClause.namedBindings.kind === 232) { + addDeclaration(importClause.namedBindings); + } + else { + ts.forEach(importClause.namedBindings.elements, visit); + } + } + } + break; + default: + ts.forEachChild(node, visit); + } + } + }; + return SourceFileObject; + }(NodeObject)); + var TextChange = (function () { + function TextChange() { + } + return TextChange; + }()); + ts.TextChange = TextChange; + var HighlightSpanKind; + (function (HighlightSpanKind) { + HighlightSpanKind.none = "none"; + HighlightSpanKind.definition = "definition"; + HighlightSpanKind.reference = "reference"; + HighlightSpanKind.writtenReference = "writtenReference"; + })(HighlightSpanKind = ts.HighlightSpanKind || (ts.HighlightSpanKind = {})); + (function (IndentStyle) { + IndentStyle[IndentStyle["None"] = 0] = "None"; + IndentStyle[IndentStyle["Block"] = 1] = "Block"; + IndentStyle[IndentStyle["Smart"] = 2] = "Smart"; + })(ts.IndentStyle || (ts.IndentStyle = {})); + var IndentStyle = ts.IndentStyle; + (function (SymbolDisplayPartKind) { + SymbolDisplayPartKind[SymbolDisplayPartKind["aliasName"] = 0] = "aliasName"; + SymbolDisplayPartKind[SymbolDisplayPartKind["className"] = 1] = "className"; + SymbolDisplayPartKind[SymbolDisplayPartKind["enumName"] = 2] = "enumName"; + SymbolDisplayPartKind[SymbolDisplayPartKind["fieldName"] = 3] = "fieldName"; + SymbolDisplayPartKind[SymbolDisplayPartKind["interfaceName"] = 4] = "interfaceName"; + SymbolDisplayPartKind[SymbolDisplayPartKind["keyword"] = 5] = "keyword"; + SymbolDisplayPartKind[SymbolDisplayPartKind["lineBreak"] = 6] = "lineBreak"; + SymbolDisplayPartKind[SymbolDisplayPartKind["numericLiteral"] = 7] = "numericLiteral"; + SymbolDisplayPartKind[SymbolDisplayPartKind["stringLiteral"] = 8] = "stringLiteral"; + SymbolDisplayPartKind[SymbolDisplayPartKind["localName"] = 9] = "localName"; + SymbolDisplayPartKind[SymbolDisplayPartKind["methodName"] = 10] = "methodName"; + SymbolDisplayPartKind[SymbolDisplayPartKind["moduleName"] = 11] = "moduleName"; + SymbolDisplayPartKind[SymbolDisplayPartKind["operator"] = 12] = "operator"; + SymbolDisplayPartKind[SymbolDisplayPartKind["parameterName"] = 13] = "parameterName"; + SymbolDisplayPartKind[SymbolDisplayPartKind["propertyName"] = 14] = "propertyName"; + SymbolDisplayPartKind[SymbolDisplayPartKind["punctuation"] = 15] = "punctuation"; + SymbolDisplayPartKind[SymbolDisplayPartKind["space"] = 16] = "space"; + SymbolDisplayPartKind[SymbolDisplayPartKind["text"] = 17] = "text"; + SymbolDisplayPartKind[SymbolDisplayPartKind["typeParameterName"] = 18] = "typeParameterName"; + SymbolDisplayPartKind[SymbolDisplayPartKind["enumMemberName"] = 19] = "enumMemberName"; + SymbolDisplayPartKind[SymbolDisplayPartKind["functionName"] = 20] = "functionName"; + SymbolDisplayPartKind[SymbolDisplayPartKind["regularExpressionLiteral"] = 21] = "regularExpressionLiteral"; + })(ts.SymbolDisplayPartKind || (ts.SymbolDisplayPartKind = {})); + var SymbolDisplayPartKind = ts.SymbolDisplayPartKind; + (function (TokenClass) { + TokenClass[TokenClass["Punctuation"] = 0] = "Punctuation"; + TokenClass[TokenClass["Keyword"] = 1] = "Keyword"; + TokenClass[TokenClass["Operator"] = 2] = "Operator"; + TokenClass[TokenClass["Comment"] = 3] = "Comment"; + TokenClass[TokenClass["Whitespace"] = 4] = "Whitespace"; + TokenClass[TokenClass["Identifier"] = 5] = "Identifier"; + TokenClass[TokenClass["NumberLiteral"] = 6] = "NumberLiteral"; + TokenClass[TokenClass["StringLiteral"] = 7] = "StringLiteral"; + TokenClass[TokenClass["RegExpLiteral"] = 8] = "RegExpLiteral"; + })(ts.TokenClass || (ts.TokenClass = {})); + var TokenClass = ts.TokenClass; + var ScriptElementKind; + (function (ScriptElementKind) { + ScriptElementKind.unknown = ""; + ScriptElementKind.warning = "warning"; + ScriptElementKind.keyword = "keyword"; + ScriptElementKind.scriptElement = "script"; + ScriptElementKind.moduleElement = "module"; + ScriptElementKind.classElement = "class"; + ScriptElementKind.localClassElement = "local class"; + ScriptElementKind.interfaceElement = "interface"; + ScriptElementKind.typeElement = "type"; + ScriptElementKind.enumElement = "enum"; + ScriptElementKind.variableElement = "var"; + ScriptElementKind.localVariableElement = "local var"; + ScriptElementKind.functionElement = "function"; + ScriptElementKind.localFunctionElement = "local function"; + ScriptElementKind.memberFunctionElement = "method"; + ScriptElementKind.memberGetAccessorElement = "getter"; + ScriptElementKind.memberSetAccessorElement = "setter"; + ScriptElementKind.memberVariableElement = "property"; + ScriptElementKind.constructorImplementationElement = "constructor"; + ScriptElementKind.callSignatureElement = "call"; + ScriptElementKind.indexSignatureElement = "index"; + ScriptElementKind.constructSignatureElement = "construct"; + ScriptElementKind.parameterElement = "parameter"; + ScriptElementKind.typeParameterElement = "type parameter"; + ScriptElementKind.primitiveType = "primitive type"; + ScriptElementKind.label = "label"; + ScriptElementKind.alias = "alias"; + ScriptElementKind.constElement = "const"; + ScriptElementKind.letElement = "let"; + })(ScriptElementKind = ts.ScriptElementKind || (ts.ScriptElementKind = {})); + var ScriptElementKindModifier; + (function (ScriptElementKindModifier) { + ScriptElementKindModifier.none = ""; + ScriptElementKindModifier.publicMemberModifier = "public"; + ScriptElementKindModifier.privateMemberModifier = "private"; + ScriptElementKindModifier.protectedMemberModifier = "protected"; + ScriptElementKindModifier.exportedModifier = "export"; + ScriptElementKindModifier.ambientModifier = "declare"; + ScriptElementKindModifier.staticModifier = "static"; + ScriptElementKindModifier.abstractModifier = "abstract"; + })(ScriptElementKindModifier = ts.ScriptElementKindModifier || (ts.ScriptElementKindModifier = {})); + var ClassificationTypeNames = (function () { + function ClassificationTypeNames() { + } + ClassificationTypeNames.comment = "comment"; + ClassificationTypeNames.identifier = "identifier"; + ClassificationTypeNames.keyword = "keyword"; + ClassificationTypeNames.numericLiteral = "number"; + ClassificationTypeNames.operator = "operator"; + ClassificationTypeNames.stringLiteral = "string"; + ClassificationTypeNames.whiteSpace = "whitespace"; + ClassificationTypeNames.text = "text"; + ClassificationTypeNames.punctuation = "punctuation"; + ClassificationTypeNames.className = "class name"; + ClassificationTypeNames.enumName = "enum name"; + ClassificationTypeNames.interfaceName = "interface name"; + ClassificationTypeNames.moduleName = "module name"; + ClassificationTypeNames.typeParameterName = "type parameter name"; + ClassificationTypeNames.typeAliasName = "type alias name"; + ClassificationTypeNames.parameterName = "parameter name"; + ClassificationTypeNames.docCommentTagName = "doc comment tag name"; + ClassificationTypeNames.jsxOpenTagName = "jsx open tag name"; + ClassificationTypeNames.jsxCloseTagName = "jsx close tag name"; + ClassificationTypeNames.jsxSelfClosingTagName = "jsx self closing tag name"; + ClassificationTypeNames.jsxAttribute = "jsx attribute"; + ClassificationTypeNames.jsxText = "jsx text"; + ClassificationTypeNames.jsxAttributeStringLiteralValue = "jsx attribute string literal value"; + return ClassificationTypeNames; + }()); + ts.ClassificationTypeNames = ClassificationTypeNames; + function displayPartsToString(displayParts) { + if (displayParts) { + return ts.map(displayParts, function (displayPart) { return displayPart.text; }).join(""); + } + return ""; + } + ts.displayPartsToString = displayPartsToString; + function isLocalVariableOrFunction(symbol) { + if (symbol.parent) { + return false; + } + return ts.forEach(symbol.declarations, function (declaration) { + if (declaration.kind === 179) { + return true; + } + if (declaration.kind !== 218 && declaration.kind !== 220) { + return false; + } + for (var parent_15 = declaration.parent; !ts.isFunctionBlock(parent_15); parent_15 = parent_15.parent) { + if (parent_15.kind === 256 || parent_15.kind === 226) { + return false; + } + } + return true; + }); + } + function getDefaultCompilerOptions() { + return { + target: 1, + jsx: 1 + }; + } + ts.getDefaultCompilerOptions = getDefaultCompilerOptions; + var HostCache = (function () { + function HostCache(host, getCanonicalFileName) { + this.host = host; + this.getCanonicalFileName = getCanonicalFileName; + this.currentDirectory = host.getCurrentDirectory(); + this.fileNameToEntry = ts.createFileMap(); + var rootFileNames = host.getScriptFileNames(); + for (var _i = 0, rootFileNames_1 = rootFileNames; _i < rootFileNames_1.length; _i++) { + var fileName = rootFileNames_1[_i]; + this.createEntry(fileName, ts.toPath(fileName, this.currentDirectory, getCanonicalFileName)); + } + this._compilationSettings = host.getCompilationSettings() || getDefaultCompilerOptions(); + } + HostCache.prototype.compilationSettings = function () { + return this._compilationSettings; + }; + HostCache.prototype.createEntry = function (fileName, path) { + var entry; + var scriptSnapshot = this.host.getScriptSnapshot(fileName); + if (scriptSnapshot) { + entry = { + hostFileName: fileName, + version: this.host.getScriptVersion(fileName), + scriptSnapshot: scriptSnapshot, + scriptKind: ts.getScriptKind(fileName, this.host) + }; + } + this.fileNameToEntry.set(path, entry); + return entry; + }; + HostCache.prototype.getEntry = function (path) { + return this.fileNameToEntry.get(path); + }; + HostCache.prototype.contains = function (path) { + return this.fileNameToEntry.contains(path); + }; + HostCache.prototype.getOrCreateEntry = function (fileName) { + var path = ts.toPath(fileName, this.currentDirectory, this.getCanonicalFileName); + return this.getOrCreateEntryByPath(fileName, path); + }; + HostCache.prototype.getOrCreateEntryByPath = function (fileName, path) { + return this.contains(path) + ? this.getEntry(path) + : this.createEntry(fileName, path); + }; + HostCache.prototype.getRootFileNames = function () { + var fileNames = []; + this.fileNameToEntry.forEachValue(function (path, value) { + if (value) { + fileNames.push(value.hostFileName); + } + }); + return fileNames; + }; + HostCache.prototype.getVersion = function (path) { + var file = this.getEntry(path); + return file && file.version; + }; + HostCache.prototype.getScriptSnapshot = function (path) { + var file = this.getEntry(path); + return file && file.scriptSnapshot; + }; + return HostCache; + }()); + var SyntaxTreeCache = (function () { + function SyntaxTreeCache(host) { + this.host = host; + } + SyntaxTreeCache.prototype.getCurrentSourceFile = function (fileName) { + var scriptSnapshot = this.host.getScriptSnapshot(fileName); + if (!scriptSnapshot) { + throw new Error("Could not find file: '" + fileName + "'."); + } + var scriptKind = ts.getScriptKind(fileName, this.host); + var version = this.host.getScriptVersion(fileName); + var sourceFile; + if (this.currentFileName !== fileName) { + sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, 2, version, true, scriptKind); + } + else if (this.currentFileVersion !== version) { + var editRange = scriptSnapshot.getChangeRange(this.currentFileScriptSnapshot); + sourceFile = updateLanguageServiceSourceFile(this.currentSourceFile, scriptSnapshot, version, editRange); + } + if (sourceFile) { + this.currentFileVersion = version; + this.currentFileName = fileName; + this.currentFileScriptSnapshot = scriptSnapshot; + this.currentSourceFile = sourceFile; + } + return this.currentSourceFile; + }; + return SyntaxTreeCache; + }()); + function setSourceFileFields(sourceFile, scriptSnapshot, version) { + sourceFile.version = version; + sourceFile.scriptSnapshot = scriptSnapshot; + } + function transpileModule(input, transpileOptions) { + var options = transpileOptions.compilerOptions ? ts.clone(transpileOptions.compilerOptions) : getDefaultCompilerOptions(); + options.isolatedModules = true; + options.suppressOutputPathCheck = true; + options.allowNonTsExtensions = true; + options.noLib = true; + options.noResolve = true; + var inputFileName = transpileOptions.fileName || (options.jsx ? "module.tsx" : "module.ts"); + var sourceFile = ts.createSourceFile(inputFileName, input, options.target); + if (transpileOptions.moduleName) { + sourceFile.moduleName = transpileOptions.moduleName; + } + sourceFile.renamedDependencies = transpileOptions.renamedDependencies; + var newLine = ts.getNewLineCharacter(options); + var outputText; + var sourceMapText; + var compilerHost = { + getSourceFile: function (fileName, target) { return fileName === ts.normalizePath(inputFileName) ? sourceFile : undefined; }, + writeFile: function (name, text, writeByteOrderMark) { + if (ts.fileExtensionIs(name, ".map")) { + ts.Debug.assert(sourceMapText === undefined, "Unexpected multiple source map outputs for the file '" + name + "'"); + sourceMapText = text; + } + else { + ts.Debug.assert(outputText === undefined, "Unexpected multiple outputs for the file: '" + name + "'"); + outputText = text; + } + }, + getDefaultLibFileName: function () { return "lib.d.ts"; }, + useCaseSensitiveFileNames: function () { return false; }, + getCanonicalFileName: function (fileName) { return fileName; }, + getCurrentDirectory: function () { return ""; }, + getNewLine: function () { return newLine; }, + fileExists: function (fileName) { return fileName === inputFileName; }, + readFile: function (fileName) { return ""; }, + directoryExists: function (directoryExists) { return true; } + }; + var program = ts.createProgram([inputFileName], options, compilerHost); + var diagnostics; + if (transpileOptions.reportDiagnostics) { + diagnostics = []; + ts.addRange(diagnostics, program.getSyntacticDiagnostics(sourceFile)); + ts.addRange(diagnostics, program.getOptionsDiagnostics()); + } + program.emit(); + ts.Debug.assert(outputText !== undefined, "Output generation failed"); + return { outputText: outputText, diagnostics: diagnostics, sourceMapText: sourceMapText }; + } + ts.transpileModule = transpileModule; + function transpile(input, compilerOptions, fileName, diagnostics, moduleName) { + var output = transpileModule(input, { compilerOptions: compilerOptions, fileName: fileName, reportDiagnostics: !!diagnostics, moduleName: moduleName }); + ts.addRange(diagnostics, output.diagnostics); + return output.outputText; + } + ts.transpile = transpile; + function createLanguageServiceSourceFile(fileName, scriptSnapshot, scriptTarget, version, setNodeParents, scriptKind) { + var text = scriptSnapshot.getText(0, scriptSnapshot.getLength()); + var sourceFile = ts.createSourceFile(fileName, text, scriptTarget, setNodeParents, scriptKind); + setSourceFileFields(sourceFile, scriptSnapshot, version); + return sourceFile; + } + ts.createLanguageServiceSourceFile = createLanguageServiceSourceFile; + ts.disableIncrementalParsing = false; + function updateLanguageServiceSourceFile(sourceFile, scriptSnapshot, version, textChangeRange, aggressiveChecks) { + if (textChangeRange) { + if (version !== sourceFile.version) { + if (!ts.disableIncrementalParsing) { + var newText = void 0; + var prefix = textChangeRange.span.start !== 0 + ? sourceFile.text.substr(0, textChangeRange.span.start) + : ""; + var suffix = ts.textSpanEnd(textChangeRange.span) !== sourceFile.text.length + ? sourceFile.text.substr(ts.textSpanEnd(textChangeRange.span)) + : ""; + if (textChangeRange.newLength === 0) { + newText = prefix && suffix ? prefix + suffix : prefix || suffix; + } + else { + var changedText = scriptSnapshot.getText(textChangeRange.span.start, textChangeRange.span.start + textChangeRange.newLength); + newText = prefix && suffix + ? prefix + changedText + suffix + : prefix + ? (prefix + changedText) + : (changedText + suffix); + } + var newSourceFile = ts.updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks); + setSourceFileFields(newSourceFile, scriptSnapshot, version); + newSourceFile.nameTable = undefined; + if (sourceFile !== newSourceFile && sourceFile.scriptSnapshot) { + if (sourceFile.scriptSnapshot.dispose) { + sourceFile.scriptSnapshot.dispose(); + } + sourceFile.scriptSnapshot = undefined; + } + return newSourceFile; + } + } + } + return createLanguageServiceSourceFile(sourceFile.fileName, scriptSnapshot, sourceFile.languageVersion, version, true, sourceFile.scriptKind); + } + ts.updateLanguageServiceSourceFile = updateLanguageServiceSourceFile; + function createDocumentRegistry(useCaseSensitiveFileNames, currentDirectory) { + if (currentDirectory === void 0) { currentDirectory = ""; } + var buckets = {}; + var getCanonicalFileName = ts.createGetCanonicalFileName(!!useCaseSensitiveFileNames); + function getKeyForCompilationSettings(settings) { + return ("_" + settings.target + "|" + settings.module + "|" + settings.noResolve + "|" + settings.jsx + "|" + settings.allowJs + "|" + settings.baseUrl + "|" + settings.typesRoot + "|" + settings.typesSearchPaths + "|" + JSON.stringify(settings.rootDirs) + "|" + JSON.stringify(settings.paths)); + } + function getBucketForCompilationSettings(key, createIfMissing) { + var bucket = ts.lookUp(buckets, key); + if (!bucket && createIfMissing) { + buckets[key] = bucket = ts.createFileMap(); + } + return bucket; + } + function reportStats() { + var bucketInfoArray = Object.keys(buckets).filter(function (name) { return name && name.charAt(0) === "_"; }).map(function (name) { + var entries = ts.lookUp(buckets, name); + var sourceFiles = []; + entries.forEachValue(function (key, entry) { + sourceFiles.push({ + name: key, + refCount: entry.languageServiceRefCount, + references: entry.owners.slice(0) + }); + }); + sourceFiles.sort(function (x, y) { return y.refCount - x.refCount; }); + return { + bucket: name, + sourceFiles: sourceFiles + }; + }); + return JSON.stringify(bucketInfoArray, undefined, 2); + } + function acquireDocument(fileName, compilationSettings, scriptSnapshot, version, scriptKind) { + var path = ts.toPath(fileName, currentDirectory, getCanonicalFileName); + var key = getKeyForCompilationSettings(compilationSettings); + return acquireDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind); + } + function acquireDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind) { + return acquireOrUpdateDocument(fileName, path, compilationSettings, key, scriptSnapshot, version, true, scriptKind); + } + function updateDocument(fileName, compilationSettings, scriptSnapshot, version, scriptKind) { + var path = ts.toPath(fileName, currentDirectory, getCanonicalFileName); + var key = getKeyForCompilationSettings(compilationSettings); + return updateDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind); + } + function updateDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind) { + return acquireOrUpdateDocument(fileName, path, compilationSettings, key, scriptSnapshot, version, false, scriptKind); + } + function acquireOrUpdateDocument(fileName, path, compilationSettings, key, scriptSnapshot, version, acquiring, scriptKind) { + var bucket = getBucketForCompilationSettings(key, true); + var entry = bucket.get(path); + if (!entry) { + ts.Debug.assert(acquiring, "How could we be trying to update a document that the registry doesn't have?"); + var sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, compilationSettings.target, version, false, scriptKind); + entry = { + sourceFile: sourceFile, + languageServiceRefCount: 0, + owners: [] + }; + bucket.set(path, entry); + } + else { + if (entry.sourceFile.version !== version) { + entry.sourceFile = updateLanguageServiceSourceFile(entry.sourceFile, scriptSnapshot, version, scriptSnapshot.getChangeRange(entry.sourceFile.scriptSnapshot)); + } + } + if (acquiring) { + entry.languageServiceRefCount++; + } + return entry.sourceFile; + } + function releaseDocument(fileName, compilationSettings) { + var path = ts.toPath(fileName, currentDirectory, getCanonicalFileName); + var key = getKeyForCompilationSettings(compilationSettings); + return releaseDocumentWithKey(path, key); + } + function releaseDocumentWithKey(path, key) { + var bucket = getBucketForCompilationSettings(key, false); + ts.Debug.assert(bucket !== undefined); + var entry = bucket.get(path); + entry.languageServiceRefCount--; + ts.Debug.assert(entry.languageServiceRefCount >= 0); + if (entry.languageServiceRefCount === 0) { + bucket.remove(path); + } + } + return { + acquireDocument: acquireDocument, + acquireDocumentWithKey: acquireDocumentWithKey, + updateDocument: updateDocument, + updateDocumentWithKey: updateDocumentWithKey, + releaseDocument: releaseDocument, + releaseDocumentWithKey: releaseDocumentWithKey, + reportStats: reportStats, + getKeyForCompilationSettings: getKeyForCompilationSettings + }; + } + ts.createDocumentRegistry = createDocumentRegistry; + function preProcessFile(sourceText, readImportFiles, detectJavaScriptImports) { + if (readImportFiles === void 0) { readImportFiles = true; } + if (detectJavaScriptImports === void 0) { detectJavaScriptImports = false; } + var referencedFiles = []; + var typeReferenceDirectives = []; + var importedFiles = []; + var ambientExternalModules; + var isNoDefaultLib = false; + var braceNesting = 0; + var externalModule = false; + function nextToken() { + var token = scanner.scan(); + if (token === 15) { + braceNesting++; + } + else if (token === 16) { + braceNesting--; + } + return token; + } + function processTripleSlashDirectives() { + var commentRanges = ts.getLeadingCommentRanges(sourceText, 0); + ts.forEach(commentRanges, function (commentRange) { + var comment = sourceText.substring(commentRange.pos, commentRange.end); + var referencePathMatchResult = ts.getFileReferenceFromReferencePath(comment, commentRange); + if (referencePathMatchResult) { + isNoDefaultLib = referencePathMatchResult.isNoDefaultLib; + var fileReference = referencePathMatchResult.fileReference; + if (fileReference) { + var collection = referencePathMatchResult.isTypeReferenceDirective + ? typeReferenceDirectives + : referencedFiles; + collection.push(fileReference); + } + } + }); + } + function getFileReference() { + var file = scanner.getTokenValue(); + var pos = scanner.getTokenPos(); + return { + fileName: file, + pos: pos, + end: pos + file.length + }; + } + function recordAmbientExternalModule() { + if (!ambientExternalModules) { + ambientExternalModules = []; + } + ambientExternalModules.push({ ref: getFileReference(), depth: braceNesting }); + } + function recordModuleName() { + importedFiles.push(getFileReference()); + markAsExternalModuleIfTopLevel(); + } + function markAsExternalModuleIfTopLevel() { + if (braceNesting === 0) { + externalModule = true; + } + } + function tryConsumeDeclare() { + var token = scanner.getToken(); + if (token === 122) { + token = nextToken(); + if (token === 125) { + token = nextToken(); + if (token === 9) { + recordAmbientExternalModule(); + } + } + return true; + } + return false; + } + function tryConsumeImport() { + var token = scanner.getToken(); + if (token === 89) { + token = nextToken(); + if (token === 9) { + recordModuleName(); + return true; + } + else { + if (token === 69 || ts.isKeyword(token)) { + token = nextToken(); + if (token === 136) { + token = nextToken(); + if (token === 9) { + recordModuleName(); + return true; + } + } + else if (token === 56) { + if (tryConsumeRequireCall(true)) { + return true; + } + } + else if (token === 24) { + token = nextToken(); + } + else { + return true; + } + } + if (token === 15) { + token = nextToken(); + while (token !== 16 && token !== 1) { + token = nextToken(); + } + if (token === 16) { + token = nextToken(); + if (token === 136) { + token = nextToken(); + if (token === 9) { + recordModuleName(); + } + } + } + } + else if (token === 37) { + token = nextToken(); + if (token === 116) { + token = nextToken(); + if (token === 69 || ts.isKeyword(token)) { + token = nextToken(); + if (token === 136) { + token = nextToken(); + if (token === 9) { + recordModuleName(); + } + } + } + } + } + } + return true; + } + return false; + } + function tryConsumeExport() { + var token = scanner.getToken(); + if (token === 82) { + markAsExternalModuleIfTopLevel(); + token = nextToken(); + if (token === 15) { + token = nextToken(); + while (token !== 16 && token !== 1) { + token = nextToken(); + } + if (token === 16) { + token = nextToken(); + if (token === 136) { + token = nextToken(); + if (token === 9) { + recordModuleName(); + } + } + } + } + else if (token === 37) { + token = nextToken(); + if (token === 136) { + token = nextToken(); + if (token === 9) { + recordModuleName(); + } + } + } + else if (token === 89) { + token = nextToken(); + if (token === 69 || ts.isKeyword(token)) { + token = nextToken(); + if (token === 56) { + if (tryConsumeRequireCall(true)) { + return true; + } + } + } + } + return true; + } + return false; + } + function tryConsumeRequireCall(skipCurrentToken) { + var token = skipCurrentToken ? nextToken() : scanner.getToken(); + if (token === 129) { + token = nextToken(); + if (token === 17) { + token = nextToken(); + if (token === 9) { + recordModuleName(); + } + } + return true; + } + return false; + } + function tryConsumeDefine() { + var token = scanner.getToken(); + if (token === 69 && scanner.getTokenValue() === "define") { + token = nextToken(); + if (token !== 17) { + return true; + } + token = nextToken(); + if (token === 9) { + token = nextToken(); + if (token === 24) { + token = nextToken(); + } + else { + return true; + } + } + if (token !== 19) { + return true; + } + token = nextToken(); + var i = 0; + while (token !== 20 && token !== 1) { + if (token === 9) { + recordModuleName(); + i++; + } + token = nextToken(); + } + return true; + } + return false; + } + function processImports() { + scanner.setText(sourceText); + nextToken(); + while (true) { + if (scanner.getToken() === 1) { + break; + } + if (tryConsumeDeclare() || + tryConsumeImport() || + tryConsumeExport() || + (detectJavaScriptImports && (tryConsumeRequireCall(false) || tryConsumeDefine()))) { + continue; + } + else { + nextToken(); + } + } + scanner.setText(undefined); + } + if (readImportFiles) { + processImports(); + } + processTripleSlashDirectives(); + if (externalModule) { + if (ambientExternalModules) { + for (var _i = 0, ambientExternalModules_1 = ambientExternalModules; _i < ambientExternalModules_1.length; _i++) { + var decl = ambientExternalModules_1[_i]; + importedFiles.push(decl.ref); + } + } + return { referencedFiles: referencedFiles, typeReferenceDirectives: typeReferenceDirectives, importedFiles: importedFiles, isLibFile: isNoDefaultLib, ambientExternalModules: undefined }; + } + else { + var ambientModuleNames = void 0; + if (ambientExternalModules) { + for (var _a = 0, ambientExternalModules_2 = ambientExternalModules; _a < ambientExternalModules_2.length; _a++) { + var decl = ambientExternalModules_2[_a]; + if (decl.depth === 0) { + if (!ambientModuleNames) { + ambientModuleNames = []; + } + ambientModuleNames.push(decl.ref.fileName); + } + else { + importedFiles.push(decl.ref); + } + } + } + return { referencedFiles: referencedFiles, typeReferenceDirectives: typeReferenceDirectives, importedFiles: importedFiles, isLibFile: isNoDefaultLib, ambientExternalModules: ambientModuleNames }; + } + } + ts.preProcessFile = preProcessFile; + function getTargetLabel(referenceNode, labelName) { + while (referenceNode) { + if (referenceNode.kind === 214 && referenceNode.label.text === labelName) { + return referenceNode.label; + } + referenceNode = referenceNode.parent; + } + return undefined; + } + function isJumpStatementTarget(node) { + return node.kind === 69 && + (node.parent.kind === 210 || node.parent.kind === 209) && + node.parent.label === node; + } + function isLabelOfLabeledStatement(node) { + return node.kind === 69 && + node.parent.kind === 214 && + node.parent.label === node; + } + function isLabeledBy(node, labelName) { + for (var owner = node.parent; owner.kind === 214; owner = owner.parent) { + if (owner.label.text === labelName) { + return true; + } + } + return false; + } + function isLabelName(node) { + return isLabelOfLabeledStatement(node) || isJumpStatementTarget(node); + } + function isRightSideOfQualifiedName(node) { + return node.parent.kind === 139 && node.parent.right === node; + } + function isRightSideOfPropertyAccess(node) { + return node && node.parent && node.parent.kind === 172 && node.parent.name === node; + } + function isCallExpressionTarget(node) { + if (isRightSideOfPropertyAccess(node)) { + node = node.parent; + } + return node && node.parent && node.parent.kind === 174 && node.parent.expression === node; + } + function isNewExpressionTarget(node) { + if (isRightSideOfPropertyAccess(node)) { + node = node.parent; + } + return node && node.parent && node.parent.kind === 175 && node.parent.expression === node; + } + function isNameOfModuleDeclaration(node) { + return node.parent.kind === 225 && node.parent.name === node; + } + function isNameOfFunctionDeclaration(node) { + return node.kind === 69 && + ts.isFunctionLike(node.parent) && node.parent.name === node; + } + function isObjectLiteralPropertyDeclaration(node) { + switch (node.kind) { + case 253: + case 254: + case 147: + case 149: + case 150: + return true; + } + return false; + } + function getContainingObjectLiteralElement(node) { + switch (node.kind) { + case 9: + case 8: + if (node.parent.kind === 140) { + return isObjectLiteralPropertyDeclaration(node.parent.parent) ? node.parent.parent : undefined; + } + case 69: + return isObjectLiteralPropertyDeclaration(node.parent) && node.parent.name === node ? node.parent : undefined; + } + return undefined; + } + function isLiteralNameOfPropertyDeclarationOrIndexAccess(node) { + if (node.kind === 9 || node.kind === 8) { + switch (node.parent.kind) { + case 145: + case 144: + case 253: + case 255: + case 147: + case 146: + case 149: + case 150: + case 225: + return node.parent.name === node; + case 173: + return node.parent.argumentExpression === node; + case 140: + return true; + } + } + return false; + } + function isNameOfExternalModuleImportOrDeclaration(node) { + if (node.kind === 9) { + return isNameOfModuleDeclaration(node) || + (ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node); + } + return false; + } + function isInsideComment(sourceFile, token, position) { + return position <= token.getStart(sourceFile) && + (isInsideCommentRange(ts.getTrailingCommentRanges(sourceFile.text, token.getFullStart())) || + isInsideCommentRange(ts.getLeadingCommentRanges(sourceFile.text, token.getFullStart()))); + function isInsideCommentRange(comments) { + return ts.forEach(comments, function (comment) { + if (comment.pos < position && position < comment.end) { + return true; + } + else if (position === comment.end) { + var text = sourceFile.text; + var width = comment.end - comment.pos; + if (width <= 2 || text.charCodeAt(comment.pos + 1) === 47) { + return true; + } + else { + return !(text.charCodeAt(comment.end - 1) === 47 && + text.charCodeAt(comment.end - 2) === 42); + } + } + return false; + }); + } + } + var keywordCompletions = []; + for (var i = 70; i <= 138; i++) { + keywordCompletions.push({ + name: ts.tokenToString(i), + kind: ScriptElementKind.keyword, + kindModifiers: ScriptElementKindModifier.none, + sortText: "0" + }); + } + function getContainerNode(node) { + while (true) { + node = node.parent; + if (!node) { + return undefined; + } + switch (node.kind) { + case 256: + case 147: + case 146: + case 220: + case 179: + case 149: + case 150: + case 221: + case 222: + case 224: + case 225: + return node; + } + } + } + ts.getContainerNode = getContainerNode; + function getNodeKind(node) { + switch (node.kind) { + case 225: return ScriptElementKind.moduleElement; + case 221: + case 192: + return ScriptElementKind.classElement; + case 222: return ScriptElementKind.interfaceElement; + case 223: return ScriptElementKind.typeElement; + case 224: return ScriptElementKind.enumElement; + case 218: + return ts.isConst(node) + ? ScriptElementKind.constElement + : ts.isLet(node) + ? ScriptElementKind.letElement + : ScriptElementKind.variableElement; + case 220: + case 179: + return ScriptElementKind.functionElement; + case 149: return ScriptElementKind.memberGetAccessorElement; + case 150: return ScriptElementKind.memberSetAccessorElement; + case 147: + case 146: + return ScriptElementKind.memberFunctionElement; + case 145: + case 144: + return ScriptElementKind.memberVariableElement; + case 153: return ScriptElementKind.indexSignatureElement; + case 152: return ScriptElementKind.constructSignatureElement; + case 151: return ScriptElementKind.callSignatureElement; + case 148: return ScriptElementKind.constructorImplementationElement; + case 141: return ScriptElementKind.typeParameterElement; + case 255: return ScriptElementKind.variableElement; + case 142: return (node.flags & 92) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; + case 229: + case 234: + case 231: + case 238: + case 232: + return ScriptElementKind.alias; + } + return ScriptElementKind.unknown; + } + ts.getNodeKind = getNodeKind; + var CancellationTokenObject = (function () { + function CancellationTokenObject(cancellationToken) { + this.cancellationToken = cancellationToken; + } + CancellationTokenObject.prototype.isCancellationRequested = function () { + return this.cancellationToken && this.cancellationToken.isCancellationRequested(); + }; + CancellationTokenObject.prototype.throwIfCancellationRequested = function () { + if (this.isCancellationRequested()) { + throw new ts.OperationCanceledException(); + } + }; + return CancellationTokenObject; + }()); + function createLanguageService(host, documentRegistry) { + if (documentRegistry === void 0) { documentRegistry = createDocumentRegistry(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames(), host.getCurrentDirectory()); } + var syntaxTreeCache = new SyntaxTreeCache(host); + var ruleProvider; + var program; + var lastProjectVersion; + var useCaseSensitivefileNames = false; + var cancellationToken = new CancellationTokenObject(host.getCancellationToken && host.getCancellationToken()); + var currentDirectory = host.getCurrentDirectory(); + if (!ts.localizedDiagnosticMessages && host.getLocalizedDiagnosticMessages) { + ts.localizedDiagnosticMessages = host.getLocalizedDiagnosticMessages(); + } + function log(message) { + if (host.log) { + host.log(message); + } + } + var getCanonicalFileName = ts.createGetCanonicalFileName(useCaseSensitivefileNames); + function getValidSourceFile(fileName) { + var sourceFile = program.getSourceFile(fileName); + if (!sourceFile) { + throw new Error("Could not find file: '" + fileName + "'."); + } + return sourceFile; + } + function getRuleProvider(options) { + if (!ruleProvider) { + ruleProvider = new ts.formatting.RulesProvider(); + } + ruleProvider.ensureUpToDate(options); + return ruleProvider; + } + function synchronizeHostData() { + if (host.getProjectVersion) { + var hostProjectVersion = host.getProjectVersion(); + if (hostProjectVersion) { + if (lastProjectVersion === hostProjectVersion) { + return; + } + lastProjectVersion = hostProjectVersion; + } + } + var hostCache = new HostCache(host, getCanonicalFileName); + if (programUpToDate()) { + return; + } + var oldSettings = program && program.getCompilerOptions(); + var newSettings = hostCache.compilationSettings(); + var changesInCompilationSettingsAffectSyntax = oldSettings && + (oldSettings.target !== newSettings.target || + oldSettings.module !== newSettings.module || + oldSettings.noResolve !== newSettings.noResolve || + oldSettings.jsx !== newSettings.jsx || + oldSettings.allowJs !== newSettings.allowJs); + var compilerHost = { + getSourceFile: getOrCreateSourceFile, + getSourceFileByPath: getOrCreateSourceFileByPath, + getCancellationToken: function () { return cancellationToken; }, + getCanonicalFileName: getCanonicalFileName, + useCaseSensitiveFileNames: function () { return useCaseSensitivefileNames; }, + getNewLine: function () { return ts.getNewLineOrDefaultFromHost(host); }, + getDefaultLibFileName: function (options) { return host.getDefaultLibFileName(options); }, + writeFile: function (fileName, data, writeByteOrderMark) { }, + getCurrentDirectory: function () { return currentDirectory; }, + fileExists: function (fileName) { + ts.Debug.assert(!host.resolveModuleNames || !host.resolveTypeReferenceDirectives); + return hostCache.getOrCreateEntry(fileName) !== undefined; + }, + readFile: function (fileName) { + var entry = hostCache.getOrCreateEntry(fileName); + return entry && entry.scriptSnapshot.getText(0, entry.scriptSnapshot.getLength()); + }, + directoryExists: function (directoryName) { + ts.Debug.assert(!host.resolveModuleNames || !host.resolveTypeReferenceDirectives); + return ts.directoryProbablyExists(directoryName, host); + } + }; + if (host.trace) { + compilerHost.trace = function (message) { return host.trace(message); }; + } + if (host.resolveModuleNames) { + compilerHost.resolveModuleNames = function (moduleNames, containingFile) { return host.resolveModuleNames(moduleNames, containingFile); }; + } + if (host.resolveTypeReferenceDirectives) { + compilerHost.resolveTypeReferenceDirectives = function (typeReferenceDirectiveNames, containingFile) { + return host.resolveTypeReferenceDirectives(typeReferenceDirectiveNames, containingFile); + }; + } + var documentRegistryBucketKey = documentRegistry.getKeyForCompilationSettings(newSettings); + var newProgram = ts.createProgram(hostCache.getRootFileNames(), newSettings, compilerHost, program); + if (program) { + var oldSourceFiles = program.getSourceFiles(); + var oldSettingsKey = documentRegistry.getKeyForCompilationSettings(oldSettings); + for (var _i = 0, oldSourceFiles_1 = oldSourceFiles; _i < oldSourceFiles_1.length; _i++) { + var oldSourceFile = oldSourceFiles_1[_i]; + if (!newProgram.getSourceFile(oldSourceFile.fileName) || changesInCompilationSettingsAffectSyntax) { + documentRegistry.releaseDocumentWithKey(oldSourceFile.path, oldSettingsKey); + } + } + } + hostCache = undefined; + program = newProgram; + program.getTypeChecker(); + return; + function getOrCreateSourceFile(fileName) { + return getOrCreateSourceFileByPath(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName)); + } + function getOrCreateSourceFileByPath(fileName, path) { + ts.Debug.assert(hostCache !== undefined); + var hostFileInformation = hostCache.getOrCreateEntryByPath(fileName, path); + if (!hostFileInformation) { + return undefined; + } + if (!changesInCompilationSettingsAffectSyntax) { + var oldSourceFile = program && program.getSourceFileByPath(path); + if (oldSourceFile) { + ts.Debug.assert(hostFileInformation.scriptKind === oldSourceFile.scriptKind, "Registered script kind (" + oldSourceFile.scriptKind + ") should match new script kind (" + hostFileInformation.scriptKind + ") for file: " + path); + return documentRegistry.updateDocumentWithKey(fileName, path, newSettings, documentRegistryBucketKey, hostFileInformation.scriptSnapshot, hostFileInformation.version, hostFileInformation.scriptKind); + } + } + return documentRegistry.acquireDocumentWithKey(fileName, path, newSettings, documentRegistryBucketKey, hostFileInformation.scriptSnapshot, hostFileInformation.version, hostFileInformation.scriptKind); + } + function sourceFileUpToDate(sourceFile) { + if (!sourceFile) { + return false; + } + var path = sourceFile.path || ts.toPath(sourceFile.fileName, currentDirectory, getCanonicalFileName); + return sourceFile.version === hostCache.getVersion(path); + } + function programUpToDate() { + if (!program) { + return false; + } + var rootFileNames = hostCache.getRootFileNames(); + if (program.getSourceFiles().length !== rootFileNames.length) { + return false; + } + for (var _i = 0, rootFileNames_2 = rootFileNames; _i < rootFileNames_2.length; _i++) { + var fileName = rootFileNames_2[_i]; + if (!sourceFileUpToDate(program.getSourceFile(fileName))) { + return false; + } + } + return ts.compareDataObjects(program.getCompilerOptions(), hostCache.compilationSettings()); + } + } + function getProgram() { + synchronizeHostData(); + return program; + } + function cleanupSemanticCache() { + } + function dispose() { + if (program) { + ts.forEach(program.getSourceFiles(), function (f) { + return documentRegistry.releaseDocument(f.fileName, program.getCompilerOptions()); + }); + } + } + function getSyntacticDiagnostics(fileName) { + synchronizeHostData(); + return program.getSyntacticDiagnostics(getValidSourceFile(fileName), cancellationToken); + } + function getSemanticDiagnostics(fileName) { + synchronizeHostData(); + var targetSourceFile = getValidSourceFile(fileName); + var semanticDiagnostics = program.getSemanticDiagnostics(targetSourceFile, cancellationToken); + if (!program.getCompilerOptions().declaration) { + return semanticDiagnostics; + } + var declarationDiagnostics = program.getDeclarationDiagnostics(targetSourceFile, cancellationToken); + return ts.concatenate(semanticDiagnostics, declarationDiagnostics); + } + function getCompilerOptionsDiagnostics() { + synchronizeHostData(); + return program.getOptionsDiagnostics(cancellationToken).concat(program.getGlobalDiagnostics(cancellationToken)); + } + function getCompletionEntryDisplayNameForSymbol(symbol, target, performCharacterChecks, location) { + var displayName = ts.getDeclaredName(program.getTypeChecker(), symbol, location); + if (displayName) { + var firstCharCode = displayName.charCodeAt(0); + if ((symbol.flags & 1536) && (firstCharCode === 39 || firstCharCode === 34)) { + return undefined; + } + } + return getCompletionEntryDisplayName(displayName, target, performCharacterChecks); + } + function getCompletionEntryDisplayName(name, target, performCharacterChecks) { + if (!name) { + return undefined; + } + name = ts.stripQuotes(name); + if (!name) { + return undefined; + } + if (performCharacterChecks) { + if (!ts.isIdentifier(name, target)) { + return undefined; + } + } + return name; + } + function getCompletionData(fileName, position) { + var typeChecker = program.getTypeChecker(); + var sourceFile = getValidSourceFile(fileName); + var isJavaScriptFile = ts.isSourceFileJavaScript(sourceFile); + var isJsDocTagName = false; + var start = new Date().getTime(); + var currentToken = ts.getTokenAtPosition(sourceFile, position); + log("getCompletionData: Get current token: " + (new Date().getTime() - start)); + start = new Date().getTime(); + var insideComment = isInsideComment(sourceFile, currentToken, position); + log("getCompletionData: Is inside comment: " + (new Date().getTime() - start)); + if (insideComment) { + if (ts.hasDocComment(sourceFile, position) && sourceFile.text.charCodeAt(position - 1) === 64) { + isJsDocTagName = true; + } + var insideJsDocTagExpression = false; + var tag = ts.getJsDocTagAtPosition(sourceFile, position); + if (tag) { + if (tag.tagName.pos <= position && position <= tag.tagName.end) { + isJsDocTagName = true; + } + switch (tag.kind) { + case 277: + case 275: + case 276: + var tagWithExpression = tag; + if (tagWithExpression.typeExpression) { + insideJsDocTagExpression = tagWithExpression.typeExpression.pos < position && position < tagWithExpression.typeExpression.end; + } + break; + } + } + if (isJsDocTagName) { + return { symbols: undefined, isMemberCompletion: false, isNewIdentifierLocation: false, location: undefined, isRightOfDot: false, isJsDocTagName: isJsDocTagName }; + } + if (!insideJsDocTagExpression) { + log("Returning an empty list because completion was inside a regular comment or plain text part of a JsDoc comment."); + return undefined; + } + } + start = new Date().getTime(); + var previousToken = ts.findPrecedingToken(position, sourceFile); + log("getCompletionData: Get previous token 1: " + (new Date().getTime() - start)); + var contextToken = previousToken; + if (contextToken && position <= contextToken.end && ts.isWord(contextToken.kind)) { + var start_6 = new Date().getTime(); + contextToken = ts.findPrecedingToken(contextToken.getFullStart(), sourceFile); + log("getCompletionData: Get previous token 2: " + (new Date().getTime() - start_6)); + } + var node = currentToken; + var isRightOfDot = false; + var isRightOfOpenTag = false; + var isStartingCloseTag = false; + var location = ts.getTouchingPropertyName(sourceFile, position); + if (contextToken) { + if (isCompletionListBlocker(contextToken)) { + log("Returning an empty list because completion was requested in an invalid position."); + return undefined; + } + var parent_16 = contextToken.parent, kind = contextToken.kind; + if (kind === 21) { + if (parent_16.kind === 172) { + node = contextToken.parent.expression; + isRightOfDot = true; + } + else if (parent_16.kind === 139) { + node = contextToken.parent.left; + isRightOfDot = true; + } + else { + return undefined; + } + } + else if (sourceFile.languageVariant === 1) { + if (kind === 25) { + isRightOfOpenTag = true; + location = contextToken; + } + else if (kind === 39 && contextToken.parent.kind === 245) { + isStartingCloseTag = true; + location = contextToken; + } + } + } + var semanticStart = new Date().getTime(); + var isMemberCompletion; + var isNewIdentifierLocation; + var symbols = []; + if (isRightOfDot) { + getTypeScriptMemberSymbols(); + } + else if (isRightOfOpenTag) { + var tagSymbols = typeChecker.getJsxIntrinsicTagNames(); + if (tryGetGlobalSymbols()) { + symbols = tagSymbols.concat(symbols.filter(function (s) { return !!(s.flags & (107455 | 8388608)); })); + } + else { + symbols = tagSymbols; + } + isMemberCompletion = true; + isNewIdentifierLocation = false; + } + else if (isStartingCloseTag) { + var tagName = contextToken.parent.parent.openingElement.tagName; + var tagSymbol = typeChecker.getSymbolAtLocation(tagName); + if (!typeChecker.isUnknownSymbol(tagSymbol)) { + symbols = [tagSymbol]; + } + isMemberCompletion = true; + isNewIdentifierLocation = false; + } + else { + if (!tryGetGlobalSymbols()) { + return undefined; + } + } + log("getCompletionData: Semantic work: " + (new Date().getTime() - semanticStart)); + return { symbols: symbols, isMemberCompletion: isMemberCompletion, isNewIdentifierLocation: isNewIdentifierLocation, location: location, isRightOfDot: (isRightOfDot || isRightOfOpenTag), isJsDocTagName: isJsDocTagName }; + function getTypeScriptMemberSymbols() { + isMemberCompletion = true; + isNewIdentifierLocation = false; + if (node.kind === 69 || node.kind === 139 || node.kind === 172) { + var symbol = typeChecker.getSymbolAtLocation(node); + if (symbol && symbol.flags & 8388608) { + symbol = typeChecker.getAliasedSymbol(symbol); + } + if (symbol && symbol.flags & 1952) { + var exportedSymbols = typeChecker.getExportsOfModule(symbol); + ts.forEach(exportedSymbols, function (symbol) { + if (typeChecker.isValidPropertyAccess((node.parent), symbol.name)) { + symbols.push(symbol); + } + }); + } + } + var type = typeChecker.getTypeAtLocation(node); + addTypeProperties(type); + } + function addTypeProperties(type) { + if (type) { + for (var _i = 0, _a = type.getApparentProperties(); _i < _a.length; _i++) { + var symbol = _a[_i]; + if (typeChecker.isValidPropertyAccess((node.parent), symbol.name)) { + symbols.push(symbol); + } + } + if (isJavaScriptFile && type.flags & 16384) { + var unionType = type; + for (var _b = 0, _c = unionType.types; _b < _c.length; _b++) { + var elementType = _c[_b]; + addTypeProperties(elementType); + } + } + } + } + function tryGetGlobalSymbols() { + var objectLikeContainer; + var namedImportsOrExports; + var jsxContainer; + if (objectLikeContainer = tryGetObjectLikeCompletionContainer(contextToken)) { + return tryGetObjectLikeCompletionSymbols(objectLikeContainer); + } + if (namedImportsOrExports = tryGetNamedImportsOrExportsForCompletion(contextToken)) { + return tryGetImportOrExportClauseCompletionSymbols(namedImportsOrExports); + } + if (jsxContainer = tryGetContainingJsxElement(contextToken)) { + var attrsType = void 0; + if ((jsxContainer.kind === 242) || (jsxContainer.kind === 243)) { + attrsType = typeChecker.getJsxElementAttributesType(jsxContainer); + if (attrsType) { + symbols = filterJsxAttributes(typeChecker.getPropertiesOfType(attrsType), jsxContainer.attributes); + isMemberCompletion = true; + isNewIdentifierLocation = false; + return true; + } + } + } + isMemberCompletion = false; + isNewIdentifierLocation = isNewIdentifierDefinitionLocation(contextToken); + if (previousToken !== contextToken) { + ts.Debug.assert(!!previousToken, "Expected 'contextToken' to be defined when different from 'previousToken'."); + } + var adjustedPosition = previousToken !== contextToken ? + previousToken.getStart() : + position; + var scopeNode = getScopeNode(contextToken, adjustedPosition, sourceFile) || sourceFile; + var symbolMeanings = 793056 | 107455 | 1536 | 8388608; + symbols = typeChecker.getSymbolsInScope(scopeNode, symbolMeanings); + return true; + } + function getScopeNode(initialToken, position, sourceFile) { + var scope = initialToken; + while (scope && !ts.positionBelongsToNode(scope, position, sourceFile)) { + scope = scope.parent; + } + return scope; + } + function isCompletionListBlocker(contextToken) { + var start = new Date().getTime(); + var result = isInStringOrRegularExpressionOrTemplateLiteral(contextToken) || + isSolelyIdentifierDefinitionLocation(contextToken) || + isDotOfNumericLiteral(contextToken) || + isInJsxText(contextToken); + log("getCompletionsAtPosition: isCompletionListBlocker: " + (new Date().getTime() - start)); + return result; + } + function isInJsxText(contextToken) { + if (contextToken.kind === 244) { + return true; + } + if (contextToken.kind === 27 && contextToken.parent) { + if (contextToken.parent.kind === 243) { + return true; + } + if (contextToken.parent.kind === 245 || contextToken.parent.kind === 242) { + return contextToken.parent.parent && contextToken.parent.parent.kind === 241; + } + } + return false; + } + function isNewIdentifierDefinitionLocation(previousToken) { + if (previousToken) { + var containingNodeKind = previousToken.parent.kind; + switch (previousToken.kind) { + case 24: + return containingNodeKind === 174 + || containingNodeKind === 148 + || containingNodeKind === 175 + || containingNodeKind === 170 + || containingNodeKind === 187 + || containingNodeKind === 156; + case 17: + return containingNodeKind === 174 + || containingNodeKind === 148 + || containingNodeKind === 175 + || containingNodeKind === 178 + || containingNodeKind === 164; + case 19: + return containingNodeKind === 170 + || containingNodeKind === 153 + || containingNodeKind === 140; + case 125: + case 126: + return true; + case 21: + return containingNodeKind === 225; + case 15: + return containingNodeKind === 221; + case 56: + return containingNodeKind === 218 + || containingNodeKind === 187; + case 12: + return containingNodeKind === 189; + case 13: + return containingNodeKind === 197; + case 112: + case 110: + case 111: + return containingNodeKind === 145; + } + switch (previousToken.getText()) { + case "public": + case "protected": + case "private": + return true; + } + } + return false; + } + function isInStringOrRegularExpressionOrTemplateLiteral(contextToken) { + if (contextToken.kind === 9 + || contextToken.kind === 166 + || contextToken.kind === 10 + || ts.isTemplateLiteralKind(contextToken.kind)) { + var start_7 = contextToken.getStart(); + var end = contextToken.getEnd(); + if (start_7 < position && position < end) { + return true; + } + if (position === end) { + return !!contextToken.isUnterminated + || contextToken.kind === 10; + } + } + return false; + } + function tryGetObjectLikeCompletionSymbols(objectLikeContainer) { + isMemberCompletion = true; + var typeForObject; + var existingMembers; + if (objectLikeContainer.kind === 171) { + isNewIdentifierLocation = true; + typeForObject = typeChecker.getContextualType(objectLikeContainer); + existingMembers = objectLikeContainer.properties; + } + else if (objectLikeContainer.kind === 167) { + isNewIdentifierLocation = false; + var rootDeclaration = ts.getRootDeclaration(objectLikeContainer.parent); + if (ts.isVariableLike(rootDeclaration)) { + var canGetType = !!(rootDeclaration.initializer || rootDeclaration.type); + if (!canGetType && rootDeclaration.kind === 142) { + if (ts.isExpression(rootDeclaration.parent)) { + canGetType = !!typeChecker.getContextualType(rootDeclaration.parent); + } + else if (rootDeclaration.parent.kind === 147 || rootDeclaration.parent.kind === 150) { + canGetType = ts.isExpression(rootDeclaration.parent.parent) && !!typeChecker.getContextualType(rootDeclaration.parent.parent); + } + } + if (canGetType) { + typeForObject = typeChecker.getTypeAtLocation(objectLikeContainer); + existingMembers = objectLikeContainer.elements; + } + } + else { + ts.Debug.fail("Root declaration is not variable-like."); + } + } + else { + ts.Debug.fail("Expected object literal or binding pattern, got " + objectLikeContainer.kind); + } + if (!typeForObject) { + return false; + } + var typeMembers = typeChecker.getPropertiesOfType(typeForObject); + if (typeMembers && typeMembers.length > 0) { + symbols = filterObjectMembersList(typeMembers, existingMembers); + } + return true; + } + function tryGetImportOrExportClauseCompletionSymbols(namedImportsOrExports) { + var declarationKind = namedImportsOrExports.kind === 233 ? + 230 : + 236; + var importOrExportDeclaration = ts.getAncestor(namedImportsOrExports, declarationKind); + var moduleSpecifier = importOrExportDeclaration.moduleSpecifier; + if (!moduleSpecifier) { + return false; + } + isMemberCompletion = true; + isNewIdentifierLocation = false; + var exports; + var moduleSpecifierSymbol = typeChecker.getSymbolAtLocation(importOrExportDeclaration.moduleSpecifier); + if (moduleSpecifierSymbol) { + exports = typeChecker.getExportsOfModule(moduleSpecifierSymbol); + } + symbols = exports ? filterNamedImportOrExportCompletionItems(exports, namedImportsOrExports.elements) : emptyArray; + return true; + } + function tryGetObjectLikeCompletionContainer(contextToken) { + if (contextToken) { + switch (contextToken.kind) { + case 15: + case 24: + var parent_17 = contextToken.parent; + if (parent_17 && (parent_17.kind === 171 || parent_17.kind === 167)) { + return parent_17; + } + break; + } + } + return undefined; + } + function tryGetNamedImportsOrExportsForCompletion(contextToken) { + if (contextToken) { + switch (contextToken.kind) { + case 15: + case 24: + switch (contextToken.parent.kind) { + case 233: + case 237: + return contextToken.parent; + } + } + } + return undefined; + } + function tryGetContainingJsxElement(contextToken) { + if (contextToken) { + var parent_18 = contextToken.parent; + switch (contextToken.kind) { + case 26: + case 39: + case 69: + case 246: + case 247: + if (parent_18 && (parent_18.kind === 242 || parent_18.kind === 243)) { + return parent_18; + } + else if (parent_18.kind === 246) { + return parent_18.parent; + } + break; + case 9: + if (parent_18 && ((parent_18.kind === 246) || (parent_18.kind === 247))) { + return parent_18.parent; + } + break; + case 16: + if (parent_18 && + parent_18.kind === 248 && + parent_18.parent && + (parent_18.parent.kind === 246)) { + return parent_18.parent.parent; + } + if (parent_18 && parent_18.kind === 247) { + return parent_18.parent; + } + break; + } + } + return undefined; + } + function isFunction(kind) { + switch (kind) { + case 179: + case 180: + case 220: + case 147: + case 146: + case 149: + case 150: + case 151: + case 152: + case 153: + return true; + } + return false; + } + function isSolelyIdentifierDefinitionLocation(contextToken) { + var containingNodeKind = contextToken.parent.kind; + switch (contextToken.kind) { + case 24: + return containingNodeKind === 218 || + containingNodeKind === 219 || + containingNodeKind === 200 || + containingNodeKind === 224 || + isFunction(containingNodeKind) || + containingNodeKind === 221 || + containingNodeKind === 192 || + containingNodeKind === 222 || + containingNodeKind === 168 || + containingNodeKind === 223; + case 21: + return containingNodeKind === 168; + case 54: + return containingNodeKind === 169; + case 19: + return containingNodeKind === 168; + case 17: + return containingNodeKind === 252 || + isFunction(containingNodeKind); + case 15: + return containingNodeKind === 224 || + containingNodeKind === 222 || + containingNodeKind === 159; + case 23: + return containingNodeKind === 144 && + contextToken.parent && contextToken.parent.parent && + (contextToken.parent.parent.kind === 222 || + contextToken.parent.parent.kind === 159); + case 25: + return containingNodeKind === 221 || + containingNodeKind === 192 || + containingNodeKind === 222 || + containingNodeKind === 223 || + isFunction(containingNodeKind); + case 113: + return containingNodeKind === 145; + case 22: + return containingNodeKind === 142 || + (contextToken.parent && contextToken.parent.parent && + contextToken.parent.parent.kind === 168); + case 112: + case 110: + case 111: + return containingNodeKind === 142; + case 116: + return containingNodeKind === 234 || + containingNodeKind === 238 || + containingNodeKind === 232; + case 73: + case 81: + case 107: + case 87: + case 102: + case 123: + case 131: + case 89: + case 108: + case 74: + case 114: + case 134: + return true; + } + switch (contextToken.getText()) { + case "abstract": + case "async": + case "class": + case "const": + case "declare": + case "enum": + case "function": + case "interface": + case "let": + case "private": + case "protected": + case "public": + case "static": + case "var": + case "yield": + return true; + } + return false; + } + function isDotOfNumericLiteral(contextToken) { + if (contextToken.kind === 8) { + var text = contextToken.getFullText(); + return text.charAt(text.length - 1) === "."; + } + return false; + } + function filterNamedImportOrExportCompletionItems(exportsOfModule, namedImportsOrExports) { + var existingImportsOrExports = {}; + for (var _i = 0, namedImportsOrExports_1 = namedImportsOrExports; _i < namedImportsOrExports_1.length; _i++) { + var element = namedImportsOrExports_1[_i]; + if (element.getStart() <= position && position <= element.getEnd()) { + continue; + } + var name_39 = element.propertyName || element.name; + existingImportsOrExports[name_39.text] = true; + } + if (ts.isEmpty(existingImportsOrExports)) { + return ts.filter(exportsOfModule, function (e) { return e.name !== "default"; }); + } + return ts.filter(exportsOfModule, function (e) { return e.name !== "default" && !ts.lookUp(existingImportsOrExports, e.name); }); + } + function filterObjectMembersList(contextualMemberSymbols, existingMembers) { + if (!existingMembers || existingMembers.length === 0) { + return contextualMemberSymbols; + } + var existingMemberNames = {}; + for (var _i = 0, existingMembers_1 = existingMembers; _i < existingMembers_1.length; _i++) { + var m = existingMembers_1[_i]; + if (m.kind !== 253 && + m.kind !== 254 && + m.kind !== 169 && + m.kind !== 147) { + continue; + } + if (m.getStart() <= position && position <= m.getEnd()) { + continue; + } + var existingName = void 0; + if (m.kind === 169 && m.propertyName) { + if (m.propertyName.kind === 69) { + existingName = m.propertyName.text; + } + } + else { + existingName = m.name.text; + } + existingMemberNames[existingName] = true; + } + return ts.filter(contextualMemberSymbols, function (m) { return !ts.lookUp(existingMemberNames, m.name); }); + } + function filterJsxAttributes(symbols, attributes) { + var seenNames = {}; + for (var _i = 0, attributes_1 = attributes; _i < attributes_1.length; _i++) { + var attr = attributes_1[_i]; + if (attr.getStart() <= position && position <= attr.getEnd()) { + continue; + } + if (attr.kind === 246) { + seenNames[attr.name.text] = true; + } + } + return ts.filter(symbols, function (a) { return !ts.lookUp(seenNames, a.name); }); + } + } + function getCompletionsAtPosition(fileName, position) { + synchronizeHostData(); + var completionData = getCompletionData(fileName, position); + if (!completionData) { + return undefined; + } + var symbols = completionData.symbols, isMemberCompletion = completionData.isMemberCompletion, isNewIdentifierLocation = completionData.isNewIdentifierLocation, location = completionData.location, isJsDocTagName = completionData.isJsDocTagName; + if (isJsDocTagName) { + return { isMemberCompletion: false, isNewIdentifierLocation: false, entries: getAllJsDocCompletionEntries() }; + } + var sourceFile = getValidSourceFile(fileName); + var entries = []; + if (ts.isSourceFileJavaScript(sourceFile)) { + var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries); + ts.addRange(entries, getJavaScriptCompletionEntries(sourceFile, location.pos, uniqueNames)); + } + else { + if (!symbols || symbols.length === 0) { + if (sourceFile.languageVariant === 1 && + location.parent && location.parent.kind === 245) { + var tagName = location.parent.parent.openingElement.tagName; + entries.push({ + name: tagName.text, + kind: undefined, + kindModifiers: undefined, + sortText: "0" + }); + } + else { + return undefined; + } + } + getCompletionEntriesFromSymbols(symbols, entries); + } + if (!isMemberCompletion && !isJsDocTagName) { + ts.addRange(entries, keywordCompletions); + } + return { isMemberCompletion: isMemberCompletion, isNewIdentifierLocation: isNewIdentifierLocation, entries: entries }; + function getJavaScriptCompletionEntries(sourceFile, position, uniqueNames) { + var entries = []; + var target = program.getCompilerOptions().target; + var nameTable = getNameTable(sourceFile); + for (var name_40 in nameTable) { + if (nameTable[name_40] === position) { + continue; + } + if (!uniqueNames[name_40]) { + uniqueNames[name_40] = name_40; + var displayName = getCompletionEntryDisplayName(name_40, target, true); + if (displayName) { + var entry = { + name: displayName, + kind: ScriptElementKind.warning, + kindModifiers: "", + sortText: "1" + }; + entries.push(entry); + } + } + } + return entries; + } + function getAllJsDocCompletionEntries() { + return jsDocCompletionEntries || (jsDocCompletionEntries = ts.map(jsDocTagNames, function (tagName) { + return { + name: tagName, + kind: ScriptElementKind.keyword, + kindModifiers: "", + sortText: "0" + }; + })); + } + function createCompletionEntry(symbol, location) { + var displayName = getCompletionEntryDisplayNameForSymbol(symbol, program.getCompilerOptions().target, true, location); + if (!displayName) { + return undefined; + } + return { + name: displayName, + kind: getSymbolKind(symbol, location), + kindModifiers: getSymbolModifiers(symbol), + sortText: "0" + }; + } + function getCompletionEntriesFromSymbols(symbols, entries) { + var start = new Date().getTime(); + var uniqueNames = {}; + if (symbols) { + for (var _i = 0, symbols_4 = symbols; _i < symbols_4.length; _i++) { + var symbol = symbols_4[_i]; + var entry = createCompletionEntry(symbol, location); + if (entry) { + var id = ts.escapeIdentifier(entry.name); + if (!ts.lookUp(uniqueNames, id)) { + entries.push(entry); + uniqueNames[id] = id; + } + } + } + } + log("getCompletionsAtPosition: getCompletionEntriesFromSymbols: " + (new Date().getTime() - start)); + return uniqueNames; + } + } + function getCompletionEntryDetails(fileName, position, entryName) { + synchronizeHostData(); + var completionData = getCompletionData(fileName, position); + if (completionData) { + var symbols = completionData.symbols, location_2 = completionData.location; + var target_2 = program.getCompilerOptions().target; + var symbol = ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(s, target_2, false, location_2) === entryName ? s : undefined; }); + if (symbol) { + var _a = getSymbolDisplayPartsDocumentationAndSymbolKind(symbol, getValidSourceFile(fileName), location_2, location_2, 7), displayParts = _a.displayParts, documentation = _a.documentation, symbolKind = _a.symbolKind; + return { + name: entryName, + kindModifiers: getSymbolModifiers(symbol), + kind: symbolKind, + displayParts: displayParts, + documentation: documentation + }; + } + } + var keywordCompletion = ts.forEach(keywordCompletions, function (c) { return c.name === entryName; }); + if (keywordCompletion) { + return { + name: entryName, + kind: ScriptElementKind.keyword, + kindModifiers: ScriptElementKindModifier.none, + displayParts: [ts.displayPart(entryName, SymbolDisplayPartKind.keyword)], + documentation: undefined + }; + } + return undefined; + } + function getSymbolKind(symbol, location) { + var flags = symbol.getFlags(); + if (flags & 32) + return ts.getDeclarationOfKind(symbol, 192) ? + ScriptElementKind.localClassElement : ScriptElementKind.classElement; + if (flags & 384) + return ScriptElementKind.enumElement; + if (flags & 524288) + return ScriptElementKind.typeElement; + if (flags & 64) + return ScriptElementKind.interfaceElement; + if (flags & 262144) + return ScriptElementKind.typeParameterElement; + var result = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(symbol, flags, location); + if (result === ScriptElementKind.unknown) { + if (flags & 262144) + return ScriptElementKind.typeParameterElement; + if (flags & 8) + return ScriptElementKind.variableElement; + if (flags & 8388608) + return ScriptElementKind.alias; + if (flags & 1536) + return ScriptElementKind.moduleElement; + } + return result; + } + function getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(symbol, flags, location) { + var typeChecker = program.getTypeChecker(); + if (typeChecker.isUndefinedSymbol(symbol)) { + return ScriptElementKind.variableElement; + } + if (typeChecker.isArgumentsSymbol(symbol)) { + return ScriptElementKind.localVariableElement; + } + if (location.kind === 97 && ts.isExpression(location)) { + return ScriptElementKind.parameterElement; + } + if (flags & 3) { + if (ts.isFirstDeclarationOfSymbolParameter(symbol)) { + return ScriptElementKind.parameterElement; + } + else if (symbol.valueDeclaration && ts.isConst(symbol.valueDeclaration)) { + return ScriptElementKind.constElement; + } + else if (ts.forEach(symbol.declarations, ts.isLet)) { + return ScriptElementKind.letElement; + } + return isLocalVariableOrFunction(symbol) ? ScriptElementKind.localVariableElement : ScriptElementKind.variableElement; + } + if (flags & 16) + return isLocalVariableOrFunction(symbol) ? ScriptElementKind.localFunctionElement : ScriptElementKind.functionElement; + if (flags & 32768) + return ScriptElementKind.memberGetAccessorElement; + if (flags & 65536) + return ScriptElementKind.memberSetAccessorElement; + if (flags & 8192) + return ScriptElementKind.memberFunctionElement; + if (flags & 16384) + return ScriptElementKind.constructorImplementationElement; + if (flags & 4) { + if (flags & 268435456) { + var unionPropertyKind = ts.forEach(typeChecker.getRootSymbols(symbol), function (rootSymbol) { + var rootSymbolFlags = rootSymbol.getFlags(); + if (rootSymbolFlags & (98308 | 3)) { + return ScriptElementKind.memberVariableElement; + } + ts.Debug.assert(!!(rootSymbolFlags & 8192)); + }); + if (!unionPropertyKind) { + var typeOfUnionProperty = typeChecker.getTypeOfSymbolAtLocation(symbol, location); + if (typeOfUnionProperty.getCallSignatures().length) { + return ScriptElementKind.memberFunctionElement; + } + return ScriptElementKind.memberVariableElement; + } + return unionPropertyKind; + } + return ScriptElementKind.memberVariableElement; + } + return ScriptElementKind.unknown; + } + function getSymbolModifiers(symbol) { + return symbol && symbol.declarations && symbol.declarations.length > 0 + ? ts.getNodeModifiers(symbol.declarations[0]) + : ScriptElementKindModifier.none; + } + function getSymbolDisplayPartsDocumentationAndSymbolKind(symbol, sourceFile, enclosingDeclaration, location, semanticMeaning) { + if (semanticMeaning === void 0) { semanticMeaning = getMeaningFromLocation(location); } + var typeChecker = program.getTypeChecker(); + var displayParts = []; + var documentation; + var symbolFlags = symbol.flags; + var symbolKind = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(symbol, symbolFlags, location); + var hasAddedSymbolInfo; + var isThisExpression = location.kind === 97 && ts.isExpression(location); + var type; + if (symbolKind !== ScriptElementKind.unknown || symbolFlags & 32 || symbolFlags & 8388608) { + if (symbolKind === ScriptElementKind.memberGetAccessorElement || symbolKind === ScriptElementKind.memberSetAccessorElement) { + symbolKind = ScriptElementKind.memberVariableElement; + } + var signature = void 0; + type = isThisExpression ? typeChecker.getTypeAtLocation(location) : typeChecker.getTypeOfSymbolAtLocation(symbol, location); + if (type) { + if (location.parent && location.parent.kind === 172) { + var right = location.parent.name; + if (right === location || (right && right.getFullWidth() === 0)) { + location = location.parent; + } + } + var callExpression = void 0; + if (location.kind === 174 || location.kind === 175) { + callExpression = location; + } + else if (isCallExpressionTarget(location) || isNewExpressionTarget(location)) { + callExpression = location.parent; + } + if (callExpression) { + var candidateSignatures = []; + signature = typeChecker.getResolvedSignature(callExpression, candidateSignatures); + if (!signature && candidateSignatures.length) { + signature = candidateSignatures[0]; + } + var useConstructSignatures = callExpression.kind === 175 || callExpression.expression.kind === 95; + var allSignatures = useConstructSignatures ? type.getConstructSignatures() : type.getCallSignatures(); + if (!ts.contains(allSignatures, signature.target) && !ts.contains(allSignatures, signature)) { + signature = allSignatures.length ? allSignatures[0] : undefined; + } + if (signature) { + if (useConstructSignatures && (symbolFlags & 32)) { + symbolKind = ScriptElementKind.constructorImplementationElement; + addPrefixForAnyFunctionOrVar(type.symbol, symbolKind); + } + else if (symbolFlags & 8388608) { + symbolKind = ScriptElementKind.alias; + pushTypePart(symbolKind); + displayParts.push(ts.spacePart()); + if (useConstructSignatures) { + displayParts.push(ts.keywordPart(92)); + displayParts.push(ts.spacePart()); + } + addFullSymbolName(symbol); + } + else { + addPrefixForAnyFunctionOrVar(symbol, symbolKind); + } + switch (symbolKind) { + case ScriptElementKind.memberVariableElement: + case ScriptElementKind.variableElement: + case ScriptElementKind.constElement: + case ScriptElementKind.letElement: + case ScriptElementKind.parameterElement: + case ScriptElementKind.localVariableElement: + displayParts.push(ts.punctuationPart(54)); + displayParts.push(ts.spacePart()); + if (useConstructSignatures) { + displayParts.push(ts.keywordPart(92)); + displayParts.push(ts.spacePart()); + } + if (!(type.flags & 65536) && type.symbol) { + ts.addRange(displayParts, ts.symbolToDisplayParts(typeChecker, type.symbol, enclosingDeclaration, undefined, 1)); + } + addSignatureDisplayParts(signature, allSignatures, 8); + break; + default: + addSignatureDisplayParts(signature, allSignatures); + } + hasAddedSymbolInfo = true; + } + } + else if ((isNameOfFunctionDeclaration(location) && !(symbol.flags & 98304)) || + (location.kind === 121 && location.parent.kind === 148)) { + var functionDeclaration = location.parent; + var allSignatures = functionDeclaration.kind === 148 ? type.getNonNullableType().getConstructSignatures() : type.getNonNullableType().getCallSignatures(); + if (!typeChecker.isImplementationOfOverload(functionDeclaration)) { + signature = typeChecker.getSignatureFromDeclaration(functionDeclaration); + } + else { + signature = allSignatures[0]; + } + if (functionDeclaration.kind === 148) { + symbolKind = ScriptElementKind.constructorImplementationElement; + addPrefixForAnyFunctionOrVar(type.symbol, symbolKind); + } + else { + addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 151 && + !(type.symbol.flags & 2048 || type.symbol.flags & 4096) ? type.symbol : symbol, symbolKind); + } + addSignatureDisplayParts(signature, allSignatures); + hasAddedSymbolInfo = true; + } + } + } + if (symbolFlags & 32 && !hasAddedSymbolInfo && !isThisExpression) { + if (ts.getDeclarationOfKind(symbol, 192)) { + pushTypePart(ScriptElementKind.localClassElement); + } + else { + displayParts.push(ts.keywordPart(73)); + } + displayParts.push(ts.spacePart()); + addFullSymbolName(symbol); + writeTypeParametersOfSymbol(symbol, sourceFile); + } + if ((symbolFlags & 64) && (semanticMeaning & 2)) { + addNewLineIfDisplayPartsExist(); + displayParts.push(ts.keywordPart(107)); + displayParts.push(ts.spacePart()); + addFullSymbolName(symbol); + writeTypeParametersOfSymbol(symbol, sourceFile); + } + if (symbolFlags & 524288) { + addNewLineIfDisplayPartsExist(); + displayParts.push(ts.keywordPart(134)); + displayParts.push(ts.spacePart()); + addFullSymbolName(symbol); + writeTypeParametersOfSymbol(symbol, sourceFile); + displayParts.push(ts.spacePart()); + displayParts.push(ts.operatorPart(56)); + displayParts.push(ts.spacePart()); + ts.addRange(displayParts, ts.typeToDisplayParts(typeChecker, typeChecker.getDeclaredTypeOfSymbol(symbol), enclosingDeclaration)); + } + if (symbolFlags & 384) { + addNewLineIfDisplayPartsExist(); + if (ts.forEach(symbol.declarations, ts.isConstEnumDeclaration)) { + displayParts.push(ts.keywordPart(74)); + displayParts.push(ts.spacePart()); + } + displayParts.push(ts.keywordPart(81)); + displayParts.push(ts.spacePart()); + addFullSymbolName(symbol); + } + if (symbolFlags & 1536) { + addNewLineIfDisplayPartsExist(); + var declaration = ts.getDeclarationOfKind(symbol, 225); + var isNamespace = declaration && declaration.name && declaration.name.kind === 69; + displayParts.push(ts.keywordPart(isNamespace ? 126 : 125)); + displayParts.push(ts.spacePart()); + addFullSymbolName(symbol); + } + if ((symbolFlags & 262144) && (semanticMeaning & 2)) { + addNewLineIfDisplayPartsExist(); + displayParts.push(ts.punctuationPart(17)); + displayParts.push(ts.textPart("type parameter")); + displayParts.push(ts.punctuationPart(18)); + displayParts.push(ts.spacePart()); + addFullSymbolName(symbol); + displayParts.push(ts.spacePart()); + displayParts.push(ts.keywordPart(90)); + displayParts.push(ts.spacePart()); + if (symbol.parent) { + addFullSymbolName(symbol.parent, enclosingDeclaration); + writeTypeParametersOfSymbol(symbol.parent, enclosingDeclaration); + } + else { + var declaration = ts.getDeclarationOfKind(symbol, 141); + ts.Debug.assert(declaration !== undefined); + declaration = declaration.parent; + if (declaration) { + if (ts.isFunctionLikeKind(declaration.kind)) { + var signature = typeChecker.getSignatureFromDeclaration(declaration); + if (declaration.kind === 152) { + displayParts.push(ts.keywordPart(92)); + displayParts.push(ts.spacePart()); + } + else if (declaration.kind !== 151 && declaration.name) { + addFullSymbolName(declaration.symbol); + } + ts.addRange(displayParts, ts.signatureToDisplayParts(typeChecker, signature, sourceFile, 32)); + } + else { + displayParts.push(ts.keywordPart(134)); + displayParts.push(ts.spacePart()); + addFullSymbolName(declaration.symbol); + writeTypeParametersOfSymbol(declaration.symbol, sourceFile); + } + } + } + } + if (symbolFlags & 8) { + addPrefixForAnyFunctionOrVar(symbol, "enum member"); + var declaration = symbol.declarations[0]; + if (declaration.kind === 255) { + var constantValue = typeChecker.getConstantValue(declaration); + if (constantValue !== undefined) { + displayParts.push(ts.spacePart()); + displayParts.push(ts.operatorPart(56)); + displayParts.push(ts.spacePart()); + displayParts.push(ts.displayPart(constantValue.toString(), SymbolDisplayPartKind.numericLiteral)); + } + } + } + if (symbolFlags & 8388608) { + addNewLineIfDisplayPartsExist(); + displayParts.push(ts.keywordPart(89)); + displayParts.push(ts.spacePart()); + addFullSymbolName(symbol); + ts.forEach(symbol.declarations, function (declaration) { + if (declaration.kind === 229) { + var importEqualsDeclaration = declaration; + if (ts.isExternalModuleImportEqualsDeclaration(importEqualsDeclaration)) { + displayParts.push(ts.spacePart()); + displayParts.push(ts.operatorPart(56)); + displayParts.push(ts.spacePart()); + displayParts.push(ts.keywordPart(129)); + displayParts.push(ts.punctuationPart(17)); + displayParts.push(ts.displayPart(ts.getTextOfNode(ts.getExternalModuleImportEqualsDeclarationExpression(importEqualsDeclaration)), SymbolDisplayPartKind.stringLiteral)); + displayParts.push(ts.punctuationPart(18)); + } + else { + var internalAliasSymbol = typeChecker.getSymbolAtLocation(importEqualsDeclaration.moduleReference); + if (internalAliasSymbol) { + displayParts.push(ts.spacePart()); + displayParts.push(ts.operatorPart(56)); + displayParts.push(ts.spacePart()); + addFullSymbolName(internalAliasSymbol, enclosingDeclaration); + } + } + return true; + } + }); + } + if (!hasAddedSymbolInfo) { + if (symbolKind !== ScriptElementKind.unknown) { + if (type) { + if (isThisExpression) { + addNewLineIfDisplayPartsExist(); + displayParts.push(ts.keywordPart(97)); + } + else { + addPrefixForAnyFunctionOrVar(symbol, symbolKind); + } + if (symbolKind === ScriptElementKind.memberVariableElement || + symbolFlags & 3 || + symbolKind === ScriptElementKind.localVariableElement || + isThisExpression) { + displayParts.push(ts.punctuationPart(54)); + displayParts.push(ts.spacePart()); + if (type.symbol && type.symbol.flags & 262144) { + var typeParameterParts = ts.mapToDisplayParts(function (writer) { + typeChecker.getSymbolDisplayBuilder().buildTypeParameterDisplay(type, writer, enclosingDeclaration); + }); + ts.addRange(displayParts, typeParameterParts); + } + else { + ts.addRange(displayParts, ts.typeToDisplayParts(typeChecker, type, enclosingDeclaration)); + } + } + else if (symbolFlags & 16 || + symbolFlags & 8192 || + symbolFlags & 16384 || + symbolFlags & 131072 || + symbolFlags & 98304 || + symbolKind === ScriptElementKind.memberFunctionElement) { + var allSignatures = type.getNonNullableType().getCallSignatures(); + addSignatureDisplayParts(allSignatures[0], allSignatures); + } + } + } + else { + symbolKind = getSymbolKind(symbol, location); + } + } + if (!documentation) { + documentation = symbol.getDocumentationComment(); + } + return { displayParts: displayParts, documentation: documentation, symbolKind: symbolKind }; + function addNewLineIfDisplayPartsExist() { + if (displayParts.length) { + displayParts.push(ts.lineBreakPart()); + } + } + function addFullSymbolName(symbol, enclosingDeclaration) { + var fullSymbolDisplayParts = ts.symbolToDisplayParts(typeChecker, symbol, enclosingDeclaration || sourceFile, undefined, 1 | 2); + ts.addRange(displayParts, fullSymbolDisplayParts); + } + function addPrefixForAnyFunctionOrVar(symbol, symbolKind) { + addNewLineIfDisplayPartsExist(); + if (symbolKind) { + pushTypePart(symbolKind); + displayParts.push(ts.spacePart()); + addFullSymbolName(symbol); + } + } + function pushTypePart(symbolKind) { + switch (symbolKind) { + case ScriptElementKind.variableElement: + case ScriptElementKind.functionElement: + case ScriptElementKind.letElement: + case ScriptElementKind.constElement: + case ScriptElementKind.constructorImplementationElement: + displayParts.push(ts.textOrKeywordPart(symbolKind)); + return; + default: + displayParts.push(ts.punctuationPart(17)); + displayParts.push(ts.textOrKeywordPart(symbolKind)); + displayParts.push(ts.punctuationPart(18)); + return; + } + } + function addSignatureDisplayParts(signature, allSignatures, flags) { + ts.addRange(displayParts, ts.signatureToDisplayParts(typeChecker, signature, enclosingDeclaration, flags | 32)); + if (allSignatures.length > 1) { + displayParts.push(ts.spacePart()); + displayParts.push(ts.punctuationPart(17)); + displayParts.push(ts.operatorPart(35)); + displayParts.push(ts.displayPart((allSignatures.length - 1).toString(), SymbolDisplayPartKind.numericLiteral)); + displayParts.push(ts.spacePart()); + displayParts.push(ts.textPart(allSignatures.length === 2 ? "overload" : "overloads")); + displayParts.push(ts.punctuationPart(18)); + } + documentation = signature.getDocumentationComment(); + } + function writeTypeParametersOfSymbol(symbol, enclosingDeclaration) { + var typeParameterParts = ts.mapToDisplayParts(function (writer) { + typeChecker.getSymbolDisplayBuilder().buildTypeParameterDisplayFromSymbol(symbol, writer, enclosingDeclaration); + }); + ts.addRange(displayParts, typeParameterParts); + } + } + function getQuickInfoAtPosition(fileName, position) { + synchronizeHostData(); + var sourceFile = getValidSourceFile(fileName); + var node = ts.getTouchingPropertyName(sourceFile, position); + if (node === sourceFile) { + return undefined; + } + if (isLabelName(node)) { + return undefined; + } + var typeChecker = program.getTypeChecker(); + var symbol = typeChecker.getSymbolAtLocation(node); + if (!symbol || typeChecker.isUnknownSymbol(symbol)) { + switch (node.kind) { + case 69: + case 172: + case 139: + case 97: + case 165: + case 95: + var type = typeChecker.getTypeAtLocation(node); + if (type) { + return { + kind: ScriptElementKind.unknown, + kindModifiers: ScriptElementKindModifier.none, + textSpan: ts.createTextSpan(node.getStart(), node.getWidth()), + displayParts: ts.typeToDisplayParts(typeChecker, type, getContainerNode(node)), + documentation: type.symbol ? type.symbol.getDocumentationComment() : undefined + }; + } + } + return undefined; + } + var displayPartsDocumentationsAndKind = getSymbolDisplayPartsDocumentationAndSymbolKind(symbol, sourceFile, getContainerNode(node), node); + return { + kind: displayPartsDocumentationsAndKind.symbolKind, + kindModifiers: getSymbolModifiers(symbol), + textSpan: ts.createTextSpan(node.getStart(), node.getWidth()), + displayParts: displayPartsDocumentationsAndKind.displayParts, + documentation: displayPartsDocumentationsAndKind.documentation + }; + } + function createDefinitionInfo(node, symbolKind, symbolName, containerName) { + return { + fileName: node.getSourceFile().fileName, + textSpan: ts.createTextSpanFromBounds(node.getStart(), node.getEnd()), + kind: symbolKind, + name: symbolName, + containerKind: undefined, + containerName: containerName + }; + } + function getDefinitionFromSymbol(symbol, node) { + var typeChecker = program.getTypeChecker(); + var result = []; + var declarations = symbol.getDeclarations(); + var symbolName = typeChecker.symbolToString(symbol); + var symbolKind = getSymbolKind(symbol, node); + var containerSymbol = symbol.parent; + var containerName = containerSymbol ? typeChecker.symbolToString(containerSymbol, node) : ""; + if (!tryAddConstructSignature(symbol, node, symbolKind, symbolName, containerName, result) && + !tryAddCallSignature(symbol, node, symbolKind, symbolName, containerName, result)) { + ts.forEach(declarations, function (declaration) { + result.push(createDefinitionInfo(declaration, symbolKind, symbolName, containerName)); + }); + } + return result; + function tryAddConstructSignature(symbol, location, symbolKind, symbolName, containerName, result) { + if (isNewExpressionTarget(location) || location.kind === 121) { + if (symbol.flags & 32) { + for (var _i = 0, _a = symbol.getDeclarations(); _i < _a.length; _i++) { + var declaration = _a[_i]; + if (ts.isClassLike(declaration)) { + return tryAddSignature(declaration.members, true, symbolKind, symbolName, containerName, result); + } + } + ts.Debug.fail("Expected declaration to have at least one class-like declaration"); + } + } + return false; + } + function tryAddCallSignature(symbol, location, symbolKind, symbolName, containerName, result) { + if (isCallExpressionTarget(location) || isNewExpressionTarget(location) || isNameOfFunctionDeclaration(location)) { + return tryAddSignature(symbol.declarations, false, symbolKind, symbolName, containerName, result); + } + return false; + } + function tryAddSignature(signatureDeclarations, selectConstructors, symbolKind, symbolName, containerName, result) { + var declarations = []; + var definition; + ts.forEach(signatureDeclarations, function (d) { + if ((selectConstructors && d.kind === 148) || + (!selectConstructors && (d.kind === 220 || d.kind === 147 || d.kind === 146))) { + declarations.push(d); + if (d.body) + definition = d; + } + }); + if (definition) { + result.push(createDefinitionInfo(definition, symbolKind, symbolName, containerName)); + return true; + } + else if (declarations.length) { + result.push(createDefinitionInfo(ts.lastOrUndefined(declarations), symbolKind, symbolName, containerName)); + return true; + } + return false; + } + } + function findReferenceInPosition(refs, pos) { + for (var _i = 0, refs_1 = refs; _i < refs_1.length; _i++) { + var ref = refs_1[_i]; + if (ref.pos <= pos && pos < ref.end) { + return ref; + } + } + return undefined; + } + function getDefinitionInfoForFileReference(name, targetFileName) { + return { + fileName: targetFileName, + textSpan: ts.createTextSpanFromBounds(0, 0), + kind: ScriptElementKind.scriptElement, + name: name, + containerName: undefined, + containerKind: undefined + }; + } + function getDefinitionAtPosition(fileName, position) { + synchronizeHostData(); + var sourceFile = getValidSourceFile(fileName); + var comment = findReferenceInPosition(sourceFile.referencedFiles, position); + if (comment) { + var referenceFile = ts.tryResolveScriptReference(program, sourceFile, comment); + if (referenceFile) { + return [getDefinitionInfoForFileReference(comment.fileName, referenceFile.fileName)]; + } + return undefined; + } + var typeReferenceDirective = findReferenceInPosition(sourceFile.typeReferenceDirectives, position); + if (typeReferenceDirective) { + var referenceFile = ts.lookUp(program.getResolvedTypeReferenceDirectives(), typeReferenceDirective.fileName); + if (referenceFile && referenceFile.resolvedFileName) { + return [getDefinitionInfoForFileReference(typeReferenceDirective.fileName, referenceFile.resolvedFileName)]; + } + return undefined; + } + var node = ts.getTouchingPropertyName(sourceFile, position); + if (node === sourceFile) { + return undefined; + } + if (isJumpStatementTarget(node)) { + var labelName = node.text; + var label = getTargetLabel(node.parent, node.text); + return label ? [createDefinitionInfo(label, ScriptElementKind.label, labelName, undefined)] : undefined; + } + var typeChecker = program.getTypeChecker(); + var symbol = typeChecker.getSymbolAtLocation(node); + if (!symbol) { + return undefined; + } + if (symbol.flags & 8388608) { + var declaration = symbol.declarations[0]; + if (node.kind === 69 && + (node.parent === declaration || + (declaration.kind === 234 && declaration.parent && declaration.parent.kind === 233))) { + symbol = typeChecker.getAliasedSymbol(symbol); + } + } + if (node.parent.kind === 254) { + var shorthandSymbol = typeChecker.getShorthandAssignmentValueSymbol(symbol.valueDeclaration); + if (!shorthandSymbol) { + return []; + } + var shorthandDeclarations = shorthandSymbol.getDeclarations(); + var shorthandSymbolKind_1 = getSymbolKind(shorthandSymbol, node); + var shorthandSymbolName_1 = typeChecker.symbolToString(shorthandSymbol); + var shorthandContainerName_1 = typeChecker.symbolToString(symbol.parent, node); + return ts.map(shorthandDeclarations, function (declaration) { return createDefinitionInfo(declaration, shorthandSymbolKind_1, shorthandSymbolName_1, shorthandContainerName_1); }); + } + return getDefinitionFromSymbol(symbol, node); + } + function getTypeDefinitionAtPosition(fileName, position) { + synchronizeHostData(); + var sourceFile = getValidSourceFile(fileName); + var node = ts.getTouchingPropertyName(sourceFile, position); + if (node === sourceFile) { + return undefined; + } + var typeChecker = program.getTypeChecker(); + var symbol = typeChecker.getSymbolAtLocation(node); + if (!symbol) { + return undefined; + } + var type = typeChecker.getTypeOfSymbolAtLocation(symbol, node); + if (!type) { + return undefined; + } + if (type.flags & 16384) { + var result_3 = []; + ts.forEach(type.types, function (t) { + if (t.symbol) { + ts.addRange(result_3, getDefinitionFromSymbol(t.symbol, node)); + } + }); + return result_3; + } + if (!type.symbol) { + return undefined; + } + return getDefinitionFromSymbol(type.symbol, node); + } + function getOccurrencesAtPosition(fileName, position) { + var results = getOccurrencesAtPositionCore(fileName, position); + if (results) { + var sourceFile_2 = getCanonicalFileName(ts.normalizeSlashes(fileName)); + results = ts.filter(results, function (r) { return getCanonicalFileName(ts.normalizeSlashes(r.fileName)) === sourceFile_2; }); + } + return results; + } + function getDocumentHighlights(fileName, position, filesToSearch) { + synchronizeHostData(); + filesToSearch = ts.map(filesToSearch, ts.normalizeSlashes); + var sourceFilesToSearch = ts.filter(program.getSourceFiles(), function (f) { return ts.contains(filesToSearch, f.fileName); }); + var sourceFile = getValidSourceFile(fileName); + var node = ts.getTouchingWord(sourceFile, position); + if (!node) { + return undefined; + } + return getSemanticDocumentHighlights(node) || getSyntacticDocumentHighlights(node); + function getHighlightSpanForNode(node) { + var start = node.getStart(); + var end = node.getEnd(); + return { + fileName: sourceFile.fileName, + textSpan: ts.createTextSpanFromBounds(start, end), + kind: HighlightSpanKind.none + }; + } + function getSemanticDocumentHighlights(node) { + if (node.kind === 69 || + node.kind === 97 || + node.kind === 165 || + node.kind === 95 || + node.kind === 9 || + isLiteralNameOfPropertyDeclarationOrIndexAccess(node)) { + var referencedSymbols = getReferencedSymbolsForNode(node, sourceFilesToSearch, false, false); + return convertReferencedSymbols(referencedSymbols); + } + return undefined; + function convertReferencedSymbols(referencedSymbols) { + if (!referencedSymbols) { + return undefined; + } + var fileNameToDocumentHighlights = {}; + var result = []; + for (var _i = 0, referencedSymbols_1 = referencedSymbols; _i < referencedSymbols_1.length; _i++) { + var referencedSymbol = referencedSymbols_1[_i]; + for (var _a = 0, _b = referencedSymbol.references; _a < _b.length; _a++) { + var referenceEntry = _b[_a]; + var fileName_1 = referenceEntry.fileName; + var documentHighlights = ts.getProperty(fileNameToDocumentHighlights, fileName_1); + if (!documentHighlights) { + documentHighlights = { fileName: fileName_1, highlightSpans: [] }; + fileNameToDocumentHighlights[fileName_1] = documentHighlights; + result.push(documentHighlights); + } + documentHighlights.highlightSpans.push({ + textSpan: referenceEntry.textSpan, + kind: referenceEntry.isWriteAccess ? HighlightSpanKind.writtenReference : HighlightSpanKind.reference + }); + } + } + return result; + } + } + function getSyntacticDocumentHighlights(node) { + var fileName = sourceFile.fileName; + var highlightSpans = getHighlightSpans(node); + if (!highlightSpans || highlightSpans.length === 0) { + return undefined; + } + return [{ fileName: fileName, highlightSpans: highlightSpans }]; + function hasKind(node, kind) { + return node !== undefined && node.kind === kind; + } + function parent(node) { + return node && node.parent; + } + function getHighlightSpans(node) { + if (node) { + switch (node.kind) { + case 88: + case 80: + if (hasKind(node.parent, 203)) { + return getIfElseOccurrences(node.parent); + } + break; + case 94: + if (hasKind(node.parent, 211)) { + return getReturnOccurrences(node.parent); + } + break; + case 98: + if (hasKind(node.parent, 215)) { + return getThrowOccurrences(node.parent); + } + break; + case 72: + if (hasKind(parent(parent(node)), 216)) { + return getTryCatchFinallyOccurrences(node.parent.parent); + } + break; + case 100: + case 85: + if (hasKind(parent(node), 216)) { + return getTryCatchFinallyOccurrences(node.parent); + } + break; + case 96: + if (hasKind(node.parent, 213)) { + return getSwitchCaseDefaultOccurrences(node.parent); + } + break; + case 71: + case 77: + if (hasKind(parent(parent(parent(node))), 213)) { + return getSwitchCaseDefaultOccurrences(node.parent.parent.parent); + } + break; + case 70: + case 75: + if (hasKind(node.parent, 210) || hasKind(node.parent, 209)) { + return getBreakOrContinueStatementOccurrences(node.parent); + } + break; + case 86: + if (hasKind(node.parent, 206) || + hasKind(node.parent, 207) || + hasKind(node.parent, 208)) { + return getLoopBreakContinueOccurrences(node.parent); + } + break; + case 104: + case 79: + if (hasKind(node.parent, 205) || hasKind(node.parent, 204)) { + return getLoopBreakContinueOccurrences(node.parent); + } + break; + case 121: + if (hasKind(node.parent, 148)) { + return getConstructorOccurrences(node.parent); + } + break; + case 123: + case 131: + if (hasKind(node.parent, 149) || hasKind(node.parent, 150)) { + return getGetAndSetOccurrences(node.parent); + } + break; + default: + if (ts.isModifierKind(node.kind) && node.parent && + (ts.isDeclaration(node.parent) || node.parent.kind === 200)) { + return getModifierOccurrences(node.kind, node.parent); + } + } + } + return undefined; + } + function aggregateOwnedThrowStatements(node) { + var statementAccumulator = []; + aggregate(node); + return statementAccumulator; + function aggregate(node) { + if (node.kind === 215) { + statementAccumulator.push(node); + } + else if (node.kind === 216) { + var tryStatement = node; + if (tryStatement.catchClause) { + aggregate(tryStatement.catchClause); + } + else { + aggregate(tryStatement.tryBlock); + } + if (tryStatement.finallyBlock) { + aggregate(tryStatement.finallyBlock); + } + } + else if (!ts.isFunctionLike(node)) { + ts.forEachChild(node, aggregate); + } + } + } + function getThrowStatementOwner(throwStatement) { + var child = throwStatement; + while (child.parent) { + var parent_19 = child.parent; + if (ts.isFunctionBlock(parent_19) || parent_19.kind === 256) { + return parent_19; + } + if (parent_19.kind === 216) { + var tryStatement = parent_19; + if (tryStatement.tryBlock === child && tryStatement.catchClause) { + return child; + } + } + child = parent_19; + } + return undefined; + } + function aggregateAllBreakAndContinueStatements(node) { + var statementAccumulator = []; + aggregate(node); + return statementAccumulator; + function aggregate(node) { + if (node.kind === 210 || node.kind === 209) { + statementAccumulator.push(node); + } + else if (!ts.isFunctionLike(node)) { + ts.forEachChild(node, aggregate); + } + } + } + function ownsBreakOrContinueStatement(owner, statement) { + var actualOwner = getBreakOrContinueOwner(statement); + return actualOwner && actualOwner === owner; + } + function getBreakOrContinueOwner(statement) { + for (var node_1 = statement.parent; node_1; node_1 = node_1.parent) { + switch (node_1.kind) { + case 213: + if (statement.kind === 209) { + continue; + } + case 206: + case 207: + case 208: + case 205: + case 204: + if (!statement.label || isLabeledBy(node_1, statement.label.text)) { + return node_1; + } + break; + default: + if (ts.isFunctionLike(node_1)) { + return undefined; + } + break; + } + } + return undefined; + } + function getModifierOccurrences(modifier, declaration) { + var container = declaration.parent; + if (ts.isAccessibilityModifier(modifier)) { + if (!(container.kind === 221 || + container.kind === 192 || + (declaration.kind === 142 && hasKind(container, 148)))) { + return undefined; + } + } + else if (modifier === 113) { + if (!(container.kind === 221 || container.kind === 192)) { + return undefined; + } + } + else if (modifier === 82 || modifier === 122) { + if (!(container.kind === 226 || container.kind === 256)) { + return undefined; + } + } + else if (modifier === 115) { + if (!(container.kind === 221 || declaration.kind === 221)) { + return undefined; + } + } + else { + return undefined; + } + var keywords = []; + var modifierFlag = getFlagFromModifier(modifier); + var nodes; + switch (container.kind) { + case 226: + case 256: + if (modifierFlag & 128) { + nodes = declaration.members.concat(declaration); + } + else { + nodes = container.statements; + } + break; + case 148: + nodes = container.parameters.concat(container.parent.members); + break; + case 221: + case 192: + nodes = container.members; + if (modifierFlag & 28) { + var constructor = ts.forEach(container.members, function (member) { + return member.kind === 148 && member; + }); + if (constructor) { + nodes = nodes.concat(constructor.parameters); + } + } + else if (modifierFlag & 128) { + nodes = nodes.concat(container); + } + break; + default: + ts.Debug.fail("Invalid container kind."); + } + ts.forEach(nodes, function (node) { + if (node.modifiers && node.flags & modifierFlag) { + ts.forEach(node.modifiers, function (child) { return pushKeywordIf(keywords, child, modifier); }); + } + }); + return ts.map(keywords, getHighlightSpanForNode); + function getFlagFromModifier(modifier) { + switch (modifier) { + case 112: + return 4; + case 110: + return 8; + case 111: + return 16; + case 113: + return 32; + case 82: + return 1; + case 122: + return 2; + case 115: + return 128; + default: + ts.Debug.fail(); + } + } + } + function pushKeywordIf(keywordList, token) { + var expected = []; + for (var _i = 2; _i < arguments.length; _i++) { + expected[_i - 2] = arguments[_i]; + } + if (token && ts.contains(expected, token.kind)) { + keywordList.push(token); + return true; + } + return false; + } + function getGetAndSetOccurrences(accessorDeclaration) { + var keywords = []; + tryPushAccessorKeyword(accessorDeclaration.symbol, 149); + tryPushAccessorKeyword(accessorDeclaration.symbol, 150); + return ts.map(keywords, getHighlightSpanForNode); + function tryPushAccessorKeyword(accessorSymbol, accessorKind) { + var accessor = ts.getDeclarationOfKind(accessorSymbol, accessorKind); + if (accessor) { + ts.forEach(accessor.getChildren(), function (child) { return pushKeywordIf(keywords, child, 123, 131); }); + } + } + } + function getConstructorOccurrences(constructorDeclaration) { + var declarations = constructorDeclaration.symbol.getDeclarations(); + var keywords = []; + ts.forEach(declarations, function (declaration) { + ts.forEach(declaration.getChildren(), function (token) { + return pushKeywordIf(keywords, token, 121); + }); + }); + return ts.map(keywords, getHighlightSpanForNode); + } + function getLoopBreakContinueOccurrences(loopNode) { + var keywords = []; + if (pushKeywordIf(keywords, loopNode.getFirstToken(), 86, 104, 79)) { + if (loopNode.kind === 204) { + var loopTokens = loopNode.getChildren(); + for (var i = loopTokens.length - 1; i >= 0; i--) { + if (pushKeywordIf(keywords, loopTokens[i], 104)) { + break; + } + } + } + } + var breaksAndContinues = aggregateAllBreakAndContinueStatements(loopNode.statement); + ts.forEach(breaksAndContinues, function (statement) { + if (ownsBreakOrContinueStatement(loopNode, statement)) { + pushKeywordIf(keywords, statement.getFirstToken(), 70, 75); + } + }); + return ts.map(keywords, getHighlightSpanForNode); + } + function getBreakOrContinueStatementOccurrences(breakOrContinueStatement) { + var owner = getBreakOrContinueOwner(breakOrContinueStatement); + if (owner) { + switch (owner.kind) { + case 206: + case 207: + case 208: + case 204: + case 205: + return getLoopBreakContinueOccurrences(owner); + case 213: + return getSwitchCaseDefaultOccurrences(owner); + } + } + return undefined; + } + function getSwitchCaseDefaultOccurrences(switchStatement) { + var keywords = []; + pushKeywordIf(keywords, switchStatement.getFirstToken(), 96); + ts.forEach(switchStatement.caseBlock.clauses, function (clause) { + pushKeywordIf(keywords, clause.getFirstToken(), 71, 77); + var breaksAndContinues = aggregateAllBreakAndContinueStatements(clause); + ts.forEach(breaksAndContinues, function (statement) { + if (ownsBreakOrContinueStatement(switchStatement, statement)) { + pushKeywordIf(keywords, statement.getFirstToken(), 70); + } + }); + }); + return ts.map(keywords, getHighlightSpanForNode); + } + function getTryCatchFinallyOccurrences(tryStatement) { + var keywords = []; + pushKeywordIf(keywords, tryStatement.getFirstToken(), 100); + if (tryStatement.catchClause) { + pushKeywordIf(keywords, tryStatement.catchClause.getFirstToken(), 72); + } + if (tryStatement.finallyBlock) { + var finallyKeyword = ts.findChildOfKind(tryStatement, 85, sourceFile); + pushKeywordIf(keywords, finallyKeyword, 85); + } + return ts.map(keywords, getHighlightSpanForNode); + } + function getThrowOccurrences(throwStatement) { + var owner = getThrowStatementOwner(throwStatement); + if (!owner) { + return undefined; + } + var keywords = []; + ts.forEach(aggregateOwnedThrowStatements(owner), function (throwStatement) { + pushKeywordIf(keywords, throwStatement.getFirstToken(), 98); + }); + if (ts.isFunctionBlock(owner)) { + ts.forEachReturnStatement(owner, function (returnStatement) { + pushKeywordIf(keywords, returnStatement.getFirstToken(), 94); + }); + } + return ts.map(keywords, getHighlightSpanForNode); + } + function getReturnOccurrences(returnStatement) { + var func = ts.getContainingFunction(returnStatement); + if (!(func && hasKind(func.body, 199))) { + return undefined; + } + var keywords = []; + ts.forEachReturnStatement(func.body, function (returnStatement) { + pushKeywordIf(keywords, returnStatement.getFirstToken(), 94); + }); + ts.forEach(aggregateOwnedThrowStatements(func.body), function (throwStatement) { + pushKeywordIf(keywords, throwStatement.getFirstToken(), 98); + }); + return ts.map(keywords, getHighlightSpanForNode); + } + function getIfElseOccurrences(ifStatement) { + var keywords = []; + while (hasKind(ifStatement.parent, 203) && ifStatement.parent.elseStatement === ifStatement) { + ifStatement = ifStatement.parent; + } + while (ifStatement) { + var children = ifStatement.getChildren(); + pushKeywordIf(keywords, children[0], 88); + for (var i = children.length - 1; i >= 0; i--) { + if (pushKeywordIf(keywords, children[i], 80)) { + break; + } + } + if (!hasKind(ifStatement.elseStatement, 203)) { + break; + } + ifStatement = ifStatement.elseStatement; + } + var result = []; + for (var i = 0; i < keywords.length; i++) { + if (keywords[i].kind === 80 && i < keywords.length - 1) { + var elseKeyword = keywords[i]; + var ifKeyword = keywords[i + 1]; + var shouldCombindElseAndIf = true; + for (var j = ifKeyword.getStart() - 1; j >= elseKeyword.end; j--) { + if (!ts.isWhiteSpace(sourceFile.text.charCodeAt(j))) { + shouldCombindElseAndIf = false; + break; + } + } + if (shouldCombindElseAndIf) { + result.push({ + fileName: fileName, + textSpan: ts.createTextSpanFromBounds(elseKeyword.getStart(), ifKeyword.end), + kind: HighlightSpanKind.reference + }); + i++; + continue; + } + } + result.push(getHighlightSpanForNode(keywords[i])); + } + return result; + } + } + } + function getOccurrencesAtPositionCore(fileName, position) { + synchronizeHostData(); + return convertDocumentHighlights(getDocumentHighlights(fileName, position, [fileName])); + function convertDocumentHighlights(documentHighlights) { + if (!documentHighlights) { + return undefined; + } + var result = []; + for (var _i = 0, documentHighlights_1 = documentHighlights; _i < documentHighlights_1.length; _i++) { + var entry = documentHighlights_1[_i]; + for (var _a = 0, _b = entry.highlightSpans; _a < _b.length; _a++) { + var highlightSpan = _b[_a]; + result.push({ + fileName: entry.fileName, + textSpan: highlightSpan.textSpan, + isWriteAccess: highlightSpan.kind === HighlightSpanKind.writtenReference + }); + } + } + return result; + } + } + function convertReferences(referenceSymbols) { + if (!referenceSymbols) { + return undefined; + } + var referenceEntries = []; + for (var _i = 0, referenceSymbols_1 = referenceSymbols; _i < referenceSymbols_1.length; _i++) { + var referenceSymbol = referenceSymbols_1[_i]; + ts.addRange(referenceEntries, referenceSymbol.references); + } + return referenceEntries; + } + function findRenameLocations(fileName, position, findInStrings, findInComments) { + var referencedSymbols = findReferencedSymbols(fileName, position, findInStrings, findInComments); + return convertReferences(referencedSymbols); + } + function getReferencesAtPosition(fileName, position) { + var referencedSymbols = findReferencedSymbols(fileName, position, false, false); + return convertReferences(referencedSymbols); + } + function findReferences(fileName, position) { + var referencedSymbols = findReferencedSymbols(fileName, position, false, false); + return ts.filter(referencedSymbols, function (rs) { return !!rs.definition; }); + } + function findReferencedSymbols(fileName, position, findInStrings, findInComments) { + synchronizeHostData(); + var sourceFile = getValidSourceFile(fileName); + var node = ts.getTouchingPropertyName(sourceFile, position); + if (node === sourceFile) { + return undefined; + } + if (node.kind !== 69 && + node.kind !== 9 && + !isLiteralNameOfPropertyDeclarationOrIndexAccess(node)) { + return undefined; + } + ts.Debug.assert(node.kind === 69 || node.kind === 8 || node.kind === 9); + return getReferencedSymbolsForNode(node, program.getSourceFiles(), findInStrings, findInComments); + } + function getReferencedSymbolsForNode(node, sourceFiles, findInStrings, findInComments) { + var typeChecker = program.getTypeChecker(); + if (isLabelName(node)) { + if (isJumpStatementTarget(node)) { + var labelDefinition = getTargetLabel(node.parent, node.text); + return labelDefinition ? getLabelReferencesInNode(labelDefinition.parent, labelDefinition) : undefined; + } + else { + return getLabelReferencesInNode(node.parent, node); + } + } + if (node.kind === 97 || node.kind === 165) { + return getReferencesForThisKeyword(node, sourceFiles); + } + if (node.kind === 95) { + return getReferencesForSuperKeyword(node); + } + var symbol = typeChecker.getSymbolAtLocation(node); + if (!symbol && node.kind === 9) { + return getReferencesForStringLiteral(node, sourceFiles); + } + if (!symbol) { + return undefined; + } + var declarations = symbol.declarations; + if (!declarations || !declarations.length) { + return undefined; + } + var result; + var searchMeaning = getIntersectingMeaningFromDeclarations(getMeaningFromLocation(node), declarations); + var declaredName = ts.stripQuotes(ts.getDeclaredName(typeChecker, symbol, node)); + var scope = getSymbolScope(symbol); + var symbolToIndex = []; + if (scope) { + result = []; + getReferencesInNode(scope, symbol, declaredName, node, searchMeaning, findInStrings, findInComments, result, symbolToIndex); + } + else { + var internedName = getInternedName(symbol, node, declarations); + for (var _i = 0, sourceFiles_4 = sourceFiles; _i < sourceFiles_4.length; _i++) { + var sourceFile = sourceFiles_4[_i]; + cancellationToken.throwIfCancellationRequested(); + var nameTable = getNameTable(sourceFile); + if (ts.lookUp(nameTable, internedName) !== undefined) { + result = result || []; + getReferencesInNode(sourceFile, symbol, declaredName, node, searchMeaning, findInStrings, findInComments, result, symbolToIndex); + } + } + } + return result; + function getDefinition(symbol) { + var info = getSymbolDisplayPartsDocumentationAndSymbolKind(symbol, node.getSourceFile(), getContainerNode(node), node); + var name = ts.map(info.displayParts, function (p) { return p.text; }).join(""); + var declarations = symbol.declarations; + if (!declarations || declarations.length === 0) { + return undefined; + } + return { + containerKind: "", + containerName: "", + name: name, + kind: info.symbolKind, + fileName: declarations[0].getSourceFile().fileName, + textSpan: ts.createTextSpan(declarations[0].getStart(), 0) + }; + } + function getAliasSymbolForPropertyNameSymbol(symbol, location) { + if (symbol.flags & 8388608) { + var defaultImport = ts.getDeclarationOfKind(symbol, 231); + if (defaultImport) { + return typeChecker.getAliasedSymbol(symbol); + } + var importOrExportSpecifier = ts.forEach(symbol.declarations, function (declaration) { return (declaration.kind === 234 || + declaration.kind === 238) ? declaration : undefined; }); + if (importOrExportSpecifier && + (!importOrExportSpecifier.propertyName || + importOrExportSpecifier.propertyName === location)) { + return importOrExportSpecifier.kind === 234 ? + typeChecker.getAliasedSymbol(symbol) : + typeChecker.getExportSpecifierLocalTargetSymbol(importOrExportSpecifier); + } + } + return undefined; + } + function getPropertySymbolOfDestructuringAssignment(location) { + return ts.isArrayLiteralOrObjectLiteralDestructuringPattern(location.parent.parent) && + typeChecker.getPropertySymbolOfDestructuringAssignment(location); + } + function isObjectBindingPatternElementWithoutPropertyName(symbol) { + var bindingElement = ts.getDeclarationOfKind(symbol, 169); + return bindingElement && + bindingElement.parent.kind === 167 && + !bindingElement.propertyName; + } + function getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol) { + if (isObjectBindingPatternElementWithoutPropertyName(symbol)) { + var bindingElement = ts.getDeclarationOfKind(symbol, 169); + var typeOfPattern = typeChecker.getTypeAtLocation(bindingElement.parent); + return typeOfPattern && typeChecker.getPropertyOfType(typeOfPattern, bindingElement.name.text); + } + return undefined; + } + function getInternedName(symbol, location, declarations) { + if (ts.isImportOrExportSpecifierName(location)) { + return location.getText(); + } + var localExportDefaultSymbol = ts.getLocalSymbolForExportDefault(symbol); + symbol = localExportDefaultSymbol || symbol; + return ts.stripQuotes(symbol.name); + } + function getSymbolScope(symbol) { + var valueDeclaration = symbol.valueDeclaration; + if (valueDeclaration && (valueDeclaration.kind === 179 || valueDeclaration.kind === 192)) { + return valueDeclaration; + } + if (symbol.flags & (4 | 8192)) { + var privateDeclaration = ts.forEach(symbol.getDeclarations(), function (d) { return (d.flags & 8) ? d : undefined; }); + if (privateDeclaration) { + return ts.getAncestor(privateDeclaration, 221); + } + } + if (symbol.flags & 8388608) { + return undefined; + } + if (isObjectBindingPatternElementWithoutPropertyName(symbol)) { + return undefined; + } + if (symbol.parent || (symbol.flags & 268435456)) { + return undefined; + } + var scope; + var declarations = symbol.getDeclarations(); + if (declarations) { + for (var _i = 0, declarations_9 = declarations; _i < declarations_9.length; _i++) { + var declaration = declarations_9[_i]; + var container = getContainerNode(declaration); + if (!container) { + return undefined; + } + if (scope && scope !== container) { + return undefined; + } + if (container.kind === 256 && !ts.isExternalModule(container)) { + return undefined; + } + scope = container; + } + } + return scope; + } + function getPossibleSymbolReferencePositions(sourceFile, symbolName, start, end) { + var positions = []; + if (!symbolName || !symbolName.length) { + return positions; + } + var text = sourceFile.text; + var sourceLength = text.length; + var symbolNameLength = symbolName.length; + var position = text.indexOf(symbolName, start); + while (position >= 0) { + cancellationToken.throwIfCancellationRequested(); + if (position > end) + break; + var endPosition = position + symbolNameLength; + if ((position === 0 || !ts.isIdentifierPart(text.charCodeAt(position - 1), 2)) && + (endPosition === sourceLength || !ts.isIdentifierPart(text.charCodeAt(endPosition), 2))) { + positions.push(position); + } + position = text.indexOf(symbolName, position + symbolNameLength + 1); + } + return positions; + } + function getLabelReferencesInNode(container, targetLabel) { + var references = []; + var sourceFile = container.getSourceFile(); + var labelName = targetLabel.text; + var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, labelName, container.getStart(), container.getEnd()); + ts.forEach(possiblePositions, function (position) { + cancellationToken.throwIfCancellationRequested(); + var node = ts.getTouchingWord(sourceFile, position); + if (!node || node.getWidth() !== labelName.length) { + return; + } + if (node === targetLabel || + (isJumpStatementTarget(node) && getTargetLabel(node, labelName) === targetLabel)) { + references.push(getReferenceEntryFromNode(node)); + } + }); + var definition = { + containerKind: "", + containerName: "", + fileName: targetLabel.getSourceFile().fileName, + kind: ScriptElementKind.label, + name: labelName, + textSpan: ts.createTextSpanFromBounds(targetLabel.getStart(), targetLabel.getEnd()) + }; + return [{ definition: definition, references: references }]; + } + function isValidReferencePosition(node, searchSymbolName) { + if (node) { + switch (node.kind) { + case 69: + return node.getWidth() === searchSymbolName.length; + case 9: + if (isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || + isNameOfExternalModuleImportOrDeclaration(node)) { + return node.getWidth() === searchSymbolName.length + 2; + } + break; + case 8: + if (isLiteralNameOfPropertyDeclarationOrIndexAccess(node)) { + return node.getWidth() === searchSymbolName.length; + } + break; + } + } + return false; + } + function getReferencesInNode(container, searchSymbol, searchText, searchLocation, searchMeaning, findInStrings, findInComments, result, symbolToIndex) { + var sourceFile = container.getSourceFile(); + var tripleSlashDirectivePrefixRegex = /^\/\/\/\s*= 0) { + var referencedSymbol = getReferencedSymbol(shorthandValueSymbol); + referencedSymbol.references.push(getReferenceEntryFromNode(referenceSymbolDeclaration.name)); + } + } + }); + } + return; + function getReferencedSymbol(symbol) { + var symbolId = ts.getSymbolId(symbol); + var index = symbolToIndex[symbolId]; + if (index === undefined) { + index = result.length; + symbolToIndex[symbolId] = index; + result.push({ + definition: getDefinition(symbol), + references: [] + }); + } + return result[index]; + } + function isInNonReferenceComment(sourceFile, position) { + return ts.isInCommentHelper(sourceFile, position, isNonReferenceComment); + function isNonReferenceComment(c) { + var commentText = sourceFile.text.substring(c.pos, c.end); + return !tripleSlashDirectivePrefixRegex.test(commentText); + } + } + } + function getReferencesForSuperKeyword(superKeyword) { + var searchSpaceNode = ts.getSuperContainer(superKeyword, false); + if (!searchSpaceNode) { + return undefined; + } + var staticFlag = 32; + switch (searchSpaceNode.kind) { + case 145: + case 144: + case 147: + case 146: + case 148: + case 149: + case 150: + staticFlag &= searchSpaceNode.flags; + searchSpaceNode = searchSpaceNode.parent; + break; + default: + return undefined; + } + var references = []; + var sourceFile = searchSpaceNode.getSourceFile(); + var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "super", searchSpaceNode.getStart(), searchSpaceNode.getEnd()); + ts.forEach(possiblePositions, function (position) { + cancellationToken.throwIfCancellationRequested(); + var node = ts.getTouchingWord(sourceFile, position); + if (!node || node.kind !== 95) { + return; + } + var container = ts.getSuperContainer(node, false); + if (container && (32 & container.flags) === staticFlag && container.parent.symbol === searchSpaceNode.symbol) { + references.push(getReferenceEntryFromNode(node)); + } + }); + var definition = getDefinition(searchSpaceNode.symbol); + return [{ definition: definition, references: references }]; + } + function getReferencesForThisKeyword(thisOrSuperKeyword, sourceFiles) { + var searchSpaceNode = ts.getThisContainer(thisOrSuperKeyword, false); + var staticFlag = 32; + switch (searchSpaceNode.kind) { + case 147: + case 146: + if (ts.isObjectLiteralMethod(searchSpaceNode)) { + break; + } + case 145: + case 144: + case 148: + case 149: + case 150: + staticFlag &= searchSpaceNode.flags; + searchSpaceNode = searchSpaceNode.parent; + break; + case 256: + if (ts.isExternalModule(searchSpaceNode)) { + return undefined; + } + case 220: + case 179: + break; + default: + return undefined; + } + var references = []; + var possiblePositions; + if (searchSpaceNode.kind === 256) { + ts.forEach(sourceFiles, function (sourceFile) { + possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", sourceFile.getStart(), sourceFile.getEnd()); + getThisReferencesInFile(sourceFile, sourceFile, possiblePositions, references); + }); + } + else { + var sourceFile = searchSpaceNode.getSourceFile(); + possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", searchSpaceNode.getStart(), searchSpaceNode.getEnd()); + getThisReferencesInFile(sourceFile, searchSpaceNode, possiblePositions, references); + } + return [{ + definition: { + containerKind: "", + containerName: "", + fileName: node.getSourceFile().fileName, + kind: ScriptElementKind.variableElement, + name: "this", + textSpan: ts.createTextSpanFromBounds(node.getStart(), node.getEnd()) + }, + references: references + }]; + function getThisReferencesInFile(sourceFile, searchSpaceNode, possiblePositions, result) { + ts.forEach(possiblePositions, function (position) { + cancellationToken.throwIfCancellationRequested(); + var node = ts.getTouchingWord(sourceFile, position); + if (!node || (node.kind !== 97 && node.kind !== 165)) { + return; + } + var container = ts.getThisContainer(node, false); + switch (searchSpaceNode.kind) { + case 179: + case 220: + if (searchSpaceNode.symbol === container.symbol) { + result.push(getReferenceEntryFromNode(node)); + } + break; + case 147: + case 146: + if (ts.isObjectLiteralMethod(searchSpaceNode) && searchSpaceNode.symbol === container.symbol) { + result.push(getReferenceEntryFromNode(node)); + } + break; + case 192: + case 221: + if (container.parent && searchSpaceNode.symbol === container.parent.symbol && (container.flags & 32) === staticFlag) { + result.push(getReferenceEntryFromNode(node)); + } + break; + case 256: + if (container.kind === 256 && !ts.isExternalModule(container)) { + result.push(getReferenceEntryFromNode(node)); + } + break; + } + }); + } + } + function getReferencesForStringLiteral(node, sourceFiles) { + var typeChecker = program.getTypeChecker(); + var type = getStringLiteralTypeForNode(node, typeChecker); + if (!type) { + return undefined; + } + var references = []; + for (var _i = 0, sourceFiles_5 = sourceFiles; _i < sourceFiles_5.length; _i++) { + var sourceFile = sourceFiles_5[_i]; + var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, type.text, sourceFile.getStart(), sourceFile.getEnd()); + getReferencesForStringLiteralInFile(sourceFile, type, possiblePositions, references); + } + return [{ + definition: { + containerKind: "", + containerName: "", + fileName: node.getSourceFile().fileName, + kind: ScriptElementKind.variableElement, + name: type.text, + textSpan: ts.createTextSpanFromBounds(node.getStart(), node.getEnd()) + }, + references: references + }]; + function getReferencesForStringLiteralInFile(sourceFile, searchType, possiblePositions, references) { + for (var _i = 0, possiblePositions_1 = possiblePositions; _i < possiblePositions_1.length; _i++) { + var position = possiblePositions_1[_i]; + cancellationToken.throwIfCancellationRequested(); + var node_2 = ts.getTouchingWord(sourceFile, position); + if (!node_2 || node_2.kind !== 9) { + return; + } + var type_1 = getStringLiteralTypeForNode(node_2, typeChecker); + if (type_1 === searchType) { + references.push(getReferenceEntryFromNode(node_2)); + } + } + } + } + function populateSearchSymbolSet(symbol, location) { + var result = [symbol]; + var containingObjectLiteralElement = getContainingObjectLiteralElement(location); + if (containingObjectLiteralElement && containingObjectLiteralElement.kind !== 254) { + var propertySymbol = getPropertySymbolOfDestructuringAssignment(location); + if (propertySymbol) { + result.push(propertySymbol); + } + } + var aliasSymbol = getAliasSymbolForPropertyNameSymbol(symbol, location); + if (aliasSymbol) { + result = result.concat(populateSearchSymbolSet(aliasSymbol, location)); + } + if (containingObjectLiteralElement) { + ts.forEach(getPropertySymbolsFromContextualType(containingObjectLiteralElement), function (contextualSymbol) { + ts.addRange(result, typeChecker.getRootSymbols(contextualSymbol)); + }); + var shorthandValueSymbol = typeChecker.getShorthandAssignmentValueSymbol(location.parent); + if (shorthandValueSymbol) { + result.push(shorthandValueSymbol); + } + } + if (symbol.valueDeclaration && symbol.valueDeclaration.kind === 142 && + ts.isParameterPropertyDeclaration(symbol.valueDeclaration)) { + result = result.concat(typeChecker.getSymbolsOfParameterPropertyDeclaration(symbol.valueDeclaration, symbol.name)); + } + var bindingElementPropertySymbol = getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol); + if (bindingElementPropertySymbol) { + result.push(bindingElementPropertySymbol); + } + ts.forEach(typeChecker.getRootSymbols(symbol), function (rootSymbol) { + if (rootSymbol !== symbol) { + result.push(rootSymbol); + } + if (rootSymbol.parent && rootSymbol.parent.flags & (32 | 64)) { + getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result, {}); + } + }); + return result; + } + function getPropertySymbolsFromBaseTypes(symbol, propertyName, result, previousIterationSymbolsCache) { + if (!symbol) { + return; + } + if (ts.hasProperty(previousIterationSymbolsCache, symbol.name)) { + return; + } + if (symbol.flags & (32 | 64)) { + ts.forEach(symbol.getDeclarations(), function (declaration) { + if (ts.isClassLike(declaration)) { + getPropertySymbolFromTypeReference(ts.getClassExtendsHeritageClauseElement(declaration)); + ts.forEach(ts.getClassImplementsHeritageClauseElements(declaration), getPropertySymbolFromTypeReference); + } + else if (declaration.kind === 222) { + ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), getPropertySymbolFromTypeReference); + } + }); + } + return; + function getPropertySymbolFromTypeReference(typeReference) { + if (typeReference) { + var type = typeChecker.getTypeAtLocation(typeReference); + if (type) { + var propertySymbol = typeChecker.getPropertyOfType(type, propertyName); + if (propertySymbol) { + result.push.apply(result, typeChecker.getRootSymbols(propertySymbol)); + } + previousIterationSymbolsCache[symbol.name] = symbol; + getPropertySymbolsFromBaseTypes(type.symbol, propertyName, result, previousIterationSymbolsCache); + } + } + } + } + function getRelatedSymbol(searchSymbols, referenceSymbol, referenceLocation) { + if (searchSymbols.indexOf(referenceSymbol) >= 0) { + return referenceSymbol; + } + var aliasSymbol = getAliasSymbolForPropertyNameSymbol(referenceSymbol, referenceLocation); + if (aliasSymbol) { + return getRelatedSymbol(searchSymbols, aliasSymbol, referenceLocation); + } + var containingObjectLiteralElement = getContainingObjectLiteralElement(referenceLocation); + if (containingObjectLiteralElement) { + var contextualSymbol = ts.forEach(getPropertySymbolsFromContextualType(containingObjectLiteralElement), function (contextualSymbol) { + return ts.forEach(typeChecker.getRootSymbols(contextualSymbol), function (s) { return searchSymbols.indexOf(s) >= 0 ? s : undefined; }); + }); + if (contextualSymbol) { + return contextualSymbol; + } + var propertySymbol = getPropertySymbolOfDestructuringAssignment(referenceLocation); + if (propertySymbol && searchSymbols.indexOf(propertySymbol) >= 0) { + return propertySymbol; + } + } + var bindingElementPropertySymbol = getPropertySymbolOfObjectBindingPatternWithoutPropertyName(referenceSymbol); + if (bindingElementPropertySymbol && searchSymbols.indexOf(bindingElementPropertySymbol) >= 0) { + return bindingElementPropertySymbol; + } + return ts.forEach(typeChecker.getRootSymbols(referenceSymbol), function (rootSymbol) { + if (searchSymbols.indexOf(rootSymbol) >= 0) { + return rootSymbol; + } + if (rootSymbol.parent && rootSymbol.parent.flags & (32 | 64)) { + var result_4 = []; + getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result_4, {}); + return ts.forEach(result_4, function (s) { return searchSymbols.indexOf(s) >= 0 ? s : undefined; }); + } + return undefined; + }); + } + function getNameFromObjectLiteralElement(node) { + if (node.name.kind === 140) { + var nameExpression = node.name.expression; + if (ts.isStringOrNumericLiteral(nameExpression.kind)) { + return nameExpression.text; + } + return undefined; + } + return node.name.text; + } + function getPropertySymbolsFromContextualType(node) { + var objectLiteral = node.parent; + var contextualType = typeChecker.getContextualType(objectLiteral); + var name = getNameFromObjectLiteralElement(node); + if (name && contextualType) { + var result_5 = []; + var symbol_1 = contextualType.getProperty(name); + if (symbol_1) { + result_5.push(symbol_1); + } + if (contextualType.flags & 16384) { + ts.forEach(contextualType.types, function (t) { + var symbol = t.getProperty(name); + if (symbol) { + result_5.push(symbol); + } + }); + } + return result_5; + } + return undefined; + } + function getIntersectingMeaningFromDeclarations(meaning, declarations) { + if (declarations) { + var lastIterationMeaning = void 0; + do { + lastIterationMeaning = meaning; + for (var _i = 0, declarations_10 = declarations; _i < declarations_10.length; _i++) { + var declaration = declarations_10[_i]; + var declarationMeaning = getMeaningFromDeclaration(declaration); + if (declarationMeaning & meaning) { + meaning |= declarationMeaning; + } + } + } while (meaning !== lastIterationMeaning); + } + return meaning; + } + } + function getReferenceEntryFromNode(node) { + var start = node.getStart(); + var end = node.getEnd(); + if (node.kind === 9) { + start += 1; + end -= 1; + } + return { + fileName: node.getSourceFile().fileName, + textSpan: ts.createTextSpanFromBounds(start, end), + isWriteAccess: isWriteAccess(node) + }; + } + function isWriteAccess(node) { + if (node.kind === 69 && ts.isDeclarationName(node)) { + return true; + } + var parent = node.parent; + if (parent) { + if (parent.kind === 186 || parent.kind === 185) { + return true; + } + else if (parent.kind === 187 && parent.left === node) { + var operator = parent.operatorToken.kind; + return 56 <= operator && operator <= 68; + } + } + return false; + } + function getNavigateToItems(searchValue, maxResultCount) { + synchronizeHostData(); + return ts.NavigateTo.getNavigateToItems(program, cancellationToken, searchValue, maxResultCount); + } + function getEmitOutput(fileName) { + synchronizeHostData(); + var sourceFile = getValidSourceFile(fileName); + var outputFiles = []; + function writeFile(fileName, data, writeByteOrderMark) { + outputFiles.push({ + name: fileName, + writeByteOrderMark: writeByteOrderMark, + text: data + }); + } + var emitOutput = program.emit(sourceFile, writeFile, cancellationToken); + return { + outputFiles: outputFiles, + emitSkipped: emitOutput.emitSkipped + }; + } + function getMeaningFromDeclaration(node) { + switch (node.kind) { + case 142: + case 218: + case 169: + case 145: + case 144: + case 253: + case 254: + case 255: + case 147: + case 146: + case 148: + case 149: + case 150: + case 220: + case 179: + case 180: + case 252: + return 1; + case 141: + case 222: + case 223: + case 159: + return 2; + case 221: + case 224: + return 1 | 2; + case 225: + if (ts.isAmbientModule(node)) { + return 4 | 1; + } + else if (ts.getModuleInstanceState(node) === 1) { + return 4 | 1; + } + else { + return 4; + } + case 233: + case 234: + case 229: + case 230: + case 235: + case 236: + return 1 | 2 | 4; + case 256: + return 4 | 1; + } + return 1 | 2 | 4; + } + function isTypeReference(node) { + if (ts.isRightSideOfQualifiedNameOrPropertyAccess(node)) { + node = node.parent; + } + return node.parent.kind === 155 || + (node.parent.kind === 194 && !ts.isExpressionWithTypeArgumentsInClassExtendsClause(node.parent)) || + (node.kind === 97 && !ts.isExpression(node)) || + node.kind === 165; + } + function isNamespaceReference(node) { + return isQualifiedNameNamespaceReference(node) || isPropertyAccessNamespaceReference(node); + } + function isPropertyAccessNamespaceReference(node) { + var root = node; + var isLastClause = true; + if (root.parent.kind === 172) { + while (root.parent && root.parent.kind === 172) { + root = root.parent; + } + isLastClause = root.name === node; + } + if (!isLastClause && root.parent.kind === 194 && root.parent.parent.kind === 251) { + var decl = root.parent.parent.parent; + return (decl.kind === 221 && root.parent.parent.token === 106) || + (decl.kind === 222 && root.parent.parent.token === 83); + } + return false; + } + function isQualifiedNameNamespaceReference(node) { + var root = node; + var isLastClause = true; + if (root.parent.kind === 139) { + while (root.parent && root.parent.kind === 139) { + root = root.parent; + } + isLastClause = root.right === node; + } + return root.parent.kind === 155 && !isLastClause; + } + function isInRightSideOfImport(node) { + while (node.parent.kind === 139) { + node = node.parent; + } + return ts.isInternalModuleImportEqualsDeclaration(node.parent) && node.parent.moduleReference === node; + } + function getMeaningFromRightHandSideOfImportEquals(node) { + ts.Debug.assert(node.kind === 69); + if (node.parent.kind === 139 && + node.parent.right === node && + node.parent.parent.kind === 229) { + return 1 | 2 | 4; + } + return 4; + } + function getMeaningFromLocation(node) { + if (node.parent.kind === 235) { + return 1 | 2 | 4; + } + else if (isInRightSideOfImport(node)) { + return getMeaningFromRightHandSideOfImportEquals(node); + } + else if (ts.isDeclarationName(node)) { + return getMeaningFromDeclaration(node.parent); + } + else if (isTypeReference(node)) { + return 2; + } + else if (isNamespaceReference(node)) { + return 4; + } + else { + return 1; + } + } + function getSignatureHelpItems(fileName, position) { + synchronizeHostData(); + var sourceFile = getValidSourceFile(fileName); + return ts.SignatureHelp.getSignatureHelpItems(program, sourceFile, position, cancellationToken); + } + function getNonBoundSourceFile(fileName) { + return syntaxTreeCache.getCurrentSourceFile(fileName); + } + function getNameOrDottedNameSpan(fileName, startPos, endPos) { + var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); + var node = ts.getTouchingPropertyName(sourceFile, startPos); + if (node === sourceFile) { + return; + } + switch (node.kind) { + case 172: + case 139: + case 9: + case 166: + case 84: + case 99: + case 93: + case 95: + case 97: + case 165: + case 69: + break; + default: + return; + } + var nodeForStartPos = node; + while (true) { + if (isRightSideOfPropertyAccess(nodeForStartPos) || isRightSideOfQualifiedName(nodeForStartPos)) { + nodeForStartPos = nodeForStartPos.parent; + } + else if (isNameOfModuleDeclaration(nodeForStartPos)) { + if (nodeForStartPos.parent.parent.kind === 225 && + nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { + nodeForStartPos = nodeForStartPos.parent.parent.name; + } + else { + break; + } + } + else { + break; + } + } + return ts.createTextSpanFromBounds(nodeForStartPos.getStart(), node.getEnd()); + } + function getBreakpointStatementAtPosition(fileName, position) { + var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); + return ts.BreakpointResolver.spanInSourceFileAtLocation(sourceFile, position); + } + function getNavigationBarItems(fileName) { + var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); + return ts.NavigationBar.getNavigationBarItems(sourceFile, host.getCompilationSettings()); + } + function getSemanticClassifications(fileName, span) { + return convertClassifications(getEncodedSemanticClassifications(fileName, span)); + } + function checkForClassificationCancellation(kind) { + switch (kind) { + case 225: + case 221: + case 222: + case 220: + cancellationToken.throwIfCancellationRequested(); + } + } + function getEncodedSemanticClassifications(fileName, span) { + synchronizeHostData(); + var sourceFile = getValidSourceFile(fileName); + var typeChecker = program.getTypeChecker(); + var result = []; + var classifiableNames = program.getClassifiableNames(); + processNode(sourceFile); + return { spans: result, endOfLineState: 0 }; + function pushClassification(start, length, type) { + result.push(start); + result.push(length); + result.push(type); + } + function classifySymbol(symbol, meaningAtPosition) { + var flags = symbol.getFlags(); + if ((flags & 788448) === 0) { + return; + } + if (flags & 32) { + return 11; + } + else if (flags & 384) { + return 12; + } + else if (flags & 524288) { + return 16; + } + else if (meaningAtPosition & 2) { + if (flags & 64) { + return 13; + } + else if (flags & 262144) { + return 15; + } + } + else if (flags & 1536) { + if (meaningAtPosition & 4 || + (meaningAtPosition & 1 && hasValueSideModule(symbol))) { + return 14; + } + } + return undefined; + function hasValueSideModule(symbol) { + return ts.forEach(symbol.declarations, function (declaration) { + return declaration.kind === 225 && + ts.getModuleInstanceState(declaration) === 1; + }); + } + } + function processNode(node) { + if (node && ts.textSpanIntersectsWith(span, node.getFullStart(), node.getFullWidth())) { + var kind = node.kind; + checkForClassificationCancellation(kind); + if (kind === 69 && !ts.nodeIsMissing(node)) { + var identifier = node; + if (classifiableNames[identifier.text]) { + var symbol = typeChecker.getSymbolAtLocation(node); + if (symbol) { + var type = classifySymbol(symbol, getMeaningFromLocation(node)); + if (type) { + pushClassification(node.getStart(), node.getWidth(), type); + } + } + } + } + ts.forEachChild(node, processNode); + } + } + } + function getClassificationTypeName(type) { + switch (type) { + case 1: return ClassificationTypeNames.comment; + case 2: return ClassificationTypeNames.identifier; + case 3: return ClassificationTypeNames.keyword; + case 4: return ClassificationTypeNames.numericLiteral; + case 5: return ClassificationTypeNames.operator; + case 6: return ClassificationTypeNames.stringLiteral; + case 8: return ClassificationTypeNames.whiteSpace; + case 9: return ClassificationTypeNames.text; + case 10: return ClassificationTypeNames.punctuation; + case 11: return ClassificationTypeNames.className; + case 12: return ClassificationTypeNames.enumName; + case 13: return ClassificationTypeNames.interfaceName; + case 14: return ClassificationTypeNames.moduleName; + case 15: return ClassificationTypeNames.typeParameterName; + case 16: return ClassificationTypeNames.typeAliasName; + case 17: return ClassificationTypeNames.parameterName; + case 18: return ClassificationTypeNames.docCommentTagName; + case 19: return ClassificationTypeNames.jsxOpenTagName; + case 20: return ClassificationTypeNames.jsxCloseTagName; + case 21: return ClassificationTypeNames.jsxSelfClosingTagName; + case 22: return ClassificationTypeNames.jsxAttribute; + case 23: return ClassificationTypeNames.jsxText; + case 24: return ClassificationTypeNames.jsxAttributeStringLiteralValue; + } + } + function convertClassifications(classifications) { + ts.Debug.assert(classifications.spans.length % 3 === 0); + var dense = classifications.spans; + var result = []; + for (var i = 0, n = dense.length; i < n; i += 3) { + result.push({ + textSpan: ts.createTextSpan(dense[i], dense[i + 1]), + classificationType: getClassificationTypeName(dense[i + 2]) + }); + } + return result; + } + function getSyntacticClassifications(fileName, span) { + return convertClassifications(getEncodedSyntacticClassifications(fileName, span)); + } + function getEncodedSyntacticClassifications(fileName, span) { + var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); + var spanStart = span.start; + var spanLength = span.length; + var triviaScanner = ts.createScanner(2, false, sourceFile.languageVariant, sourceFile.text); + var mergeConflictScanner = ts.createScanner(2, false, sourceFile.languageVariant, sourceFile.text); + var result = []; + processElement(sourceFile); + return { spans: result, endOfLineState: 0 }; + function pushClassification(start, length, type) { + result.push(start); + result.push(length); + result.push(type); + } + function classifyLeadingTriviaAndGetTokenStart(token) { + triviaScanner.setTextPos(token.pos); + while (true) { + var start = triviaScanner.getTextPos(); + if (!ts.couldStartTrivia(sourceFile.text, start)) { + return start; + } + var kind = triviaScanner.scan(); + var end = triviaScanner.getTextPos(); + var width = end - start; + if (!ts.isTrivia(kind)) { + return start; + } + if (kind === 4 || kind === 5) { + continue; + } + if (ts.isComment(kind)) { + classifyComment(token, kind, start, width); + triviaScanner.setTextPos(end); + continue; + } + if (kind === 7) { + var text = sourceFile.text; + var ch = text.charCodeAt(start); + if (ch === 60 || ch === 62) { + pushClassification(start, width, 1); + continue; + } + ts.Debug.assert(ch === 61); + classifyDisabledMergeCode(text, start, end); + } + } + } + function classifyComment(token, kind, start, width) { + if (kind === 3) { + var docCommentAndDiagnostics = ts.parseIsolatedJSDocComment(sourceFile.text, start, width); + if (docCommentAndDiagnostics && docCommentAndDiagnostics.jsDocComment) { + docCommentAndDiagnostics.jsDocComment.parent = token; + classifyJSDocComment(docCommentAndDiagnostics.jsDocComment); + return; + } + } + pushCommentRange(start, width); + } + function pushCommentRange(start, width) { + pushClassification(start, width, 1); + } + function classifyJSDocComment(docComment) { + var pos = docComment.pos; + for (var _i = 0, _a = docComment.tags; _i < _a.length; _i++) { + var tag = _a[_i]; + if (tag.pos !== pos) { + pushCommentRange(pos, tag.pos - pos); + } + pushClassification(tag.atToken.pos, tag.atToken.end - tag.atToken.pos, 10); + pushClassification(tag.tagName.pos, tag.tagName.end - tag.tagName.pos, 18); + pos = tag.tagName.end; + switch (tag.kind) { + case 275: + processJSDocParameterTag(tag); + break; + case 278: + processJSDocTemplateTag(tag); + break; + case 277: + processElement(tag.typeExpression); + break; + case 276: + processElement(tag.typeExpression); + break; + } + pos = tag.end; + } + if (pos !== docComment.end) { + pushCommentRange(pos, docComment.end - pos); + } + return; + function processJSDocParameterTag(tag) { + if (tag.preParameterName) { + pushCommentRange(pos, tag.preParameterName.pos - pos); + pushClassification(tag.preParameterName.pos, tag.preParameterName.end - tag.preParameterName.pos, 17); + pos = tag.preParameterName.end; + } + if (tag.typeExpression) { + pushCommentRange(pos, tag.typeExpression.pos - pos); + processElement(tag.typeExpression); + pos = tag.typeExpression.end; + } + if (tag.postParameterName) { + pushCommentRange(pos, tag.postParameterName.pos - pos); + pushClassification(tag.postParameterName.pos, tag.postParameterName.end - tag.postParameterName.pos, 17); + pos = tag.postParameterName.end; + } + } + } + function processJSDocTemplateTag(tag) { + for (var _i = 0, _a = tag.getChildren(); _i < _a.length; _i++) { + var child = _a[_i]; + processElement(child); + } + } + function classifyDisabledMergeCode(text, start, end) { + var i; + for (i = start; i < end; i++) { + if (ts.isLineBreak(text.charCodeAt(i))) { + break; + } + } + pushClassification(start, i - start, 1); + mergeConflictScanner.setTextPos(i); + while (mergeConflictScanner.getTextPos() < end) { + classifyDisabledCodeToken(); + } + } + function classifyDisabledCodeToken() { + var start = mergeConflictScanner.getTextPos(); + var tokenKind = mergeConflictScanner.scan(); + var end = mergeConflictScanner.getTextPos(); + var type = classifyTokenType(tokenKind); + if (type) { + pushClassification(start, end - start, type); + } + } + function tryClassifyNode(node) { + if (ts.nodeIsMissing(node)) { + return true; + } + var classifiedElementName = tryClassifyJsxElementName(node); + if (!ts.isToken(node) && node.kind !== 244 && classifiedElementName === undefined) { + return false; + } + var tokenStart = node.kind === 244 ? node.pos : classifyLeadingTriviaAndGetTokenStart(node); + var tokenWidth = node.end - tokenStart; + ts.Debug.assert(tokenWidth >= 0); + if (tokenWidth > 0) { + var type = classifiedElementName || classifyTokenType(node.kind, node); + if (type) { + pushClassification(tokenStart, tokenWidth, type); + } + } + return true; + } + function tryClassifyJsxElementName(token) { + switch (token.parent && token.parent.kind) { + case 243: + if (token.parent.tagName === token) { + return 19; + } + break; + case 245: + if (token.parent.tagName === token) { + return 20; + } + break; + case 242: + if (token.parent.tagName === token) { + return 21; + } + break; + case 246: + if (token.parent.name === token) { + return 22; + } + break; + } + return undefined; + } + function classifyTokenType(tokenKind, token) { + if (ts.isKeyword(tokenKind)) { + return 3; + } + if (tokenKind === 25 || tokenKind === 27) { + if (token && ts.getTypeArgumentOrTypeParameterList(token.parent)) { + return 10; + } + } + if (ts.isPunctuation(tokenKind)) { + if (token) { + if (tokenKind === 56) { + if (token.parent.kind === 218 || + token.parent.kind === 145 || + token.parent.kind === 142 || + token.parent.kind === 246) { + return 5; + } + } + if (token.parent.kind === 187 || + token.parent.kind === 185 || + token.parent.kind === 186 || + token.parent.kind === 188) { + return 5; + } + } + return 10; + } + else if (tokenKind === 8) { + return 4; + } + else if (tokenKind === 9 || tokenKind === 166) { + return token.parent.kind === 246 ? 24 : 6; + } + else if (tokenKind === 10) { + return 6; + } + else if (ts.isTemplateLiteralKind(tokenKind)) { + return 6; + } + else if (tokenKind === 244) { + return 23; + } + else if (tokenKind === 69) { + if (token) { + switch (token.parent.kind) { + case 221: + if (token.parent.name === token) { + return 11; + } + return; + case 141: + if (token.parent.name === token) { + return 15; + } + return; + case 222: + if (token.parent.name === token) { + return 13; + } + return; + case 224: + if (token.parent.name === token) { + return 12; + } + return; + case 225: + if (token.parent.name === token) { + return 14; + } + return; + case 142: + if (token.parent.name === token) { + return 17; + } + return; + } + } + return 2; + } + } + function processElement(element) { + if (!element) { + return; + } + if (ts.decodedTextSpanIntersectsWith(spanStart, spanLength, element.pos, element.getFullWidth())) { + checkForClassificationCancellation(element.kind); + var children = element.getChildren(sourceFile); + for (var i = 0, n = children.length; i < n; i++) { + var child = children[i]; + if (!tryClassifyNode(child)) { + processElement(child); + } + } + } + } + } + function getOutliningSpans(fileName) { + var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); + return ts.OutliningElementsCollector.collectElements(sourceFile); + } + function getBraceMatchingAtPosition(fileName, position) { + var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); + var result = []; + var token = ts.getTouchingToken(sourceFile, position); + if (token.getStart(sourceFile) === position) { + var matchKind = getMatchingTokenKind(token); + if (matchKind) { + var parentElement = token.parent; + var childNodes = parentElement.getChildren(sourceFile); + for (var _i = 0, childNodes_1 = childNodes; _i < childNodes_1.length; _i++) { + var current = childNodes_1[_i]; + if (current.kind === matchKind) { + var range1 = ts.createTextSpan(token.getStart(sourceFile), token.getWidth(sourceFile)); + var range2 = ts.createTextSpan(current.getStart(sourceFile), current.getWidth(sourceFile)); + if (range1.start < range2.start) { + result.push(range1, range2); + } + else { + result.push(range2, range1); + } + break; + } + } + } + } + return result; + function getMatchingTokenKind(token) { + switch (token.kind) { + case 15: return 16; + case 17: return 18; + case 19: return 20; + case 25: return 27; + case 16: return 15; + case 18: return 17; + case 20: return 19; + case 27: return 25; + } + return undefined; + } + } + function getIndentationAtPosition(fileName, position, editorOptions) { + var start = new Date().getTime(); + var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); + log("getIndentationAtPosition: getCurrentSourceFile: " + (new Date().getTime() - start)); + start = new Date().getTime(); + var result = ts.formatting.SmartIndenter.getIndentation(position, sourceFile, editorOptions); + log("getIndentationAtPosition: computeIndentation : " + (new Date().getTime() - start)); + return result; + } + function getFormattingEditsForRange(fileName, start, end, options) { + var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); + return ts.formatting.formatSelection(start, end, sourceFile, getRuleProvider(options), options); + } + function getFormattingEditsForDocument(fileName, options) { + var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); + return ts.formatting.formatDocument(sourceFile, getRuleProvider(options), options); + } + function getFormattingEditsAfterKeystroke(fileName, position, key, options) { + var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); + if (key === "}") { + return ts.formatting.formatOnClosingCurly(position, sourceFile, getRuleProvider(options), options); + } + else if (key === ";") { + return ts.formatting.formatOnSemicolon(position, sourceFile, getRuleProvider(options), options); + } + else if (key === "\n") { + return ts.formatting.formatOnEnter(position, sourceFile, getRuleProvider(options), options); + } + return []; + } + function getDocCommentTemplateAtPosition(fileName, position) { + var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); + if (ts.isInString(sourceFile, position) || ts.isInComment(sourceFile, position) || ts.hasDocComment(sourceFile, position)) { + return undefined; + } + var tokenAtPos = ts.getTokenAtPosition(sourceFile, position); + var tokenStart = tokenAtPos.getStart(); + if (!tokenAtPos || tokenStart < position) { + return undefined; + } + var commentOwner; + findOwner: for (commentOwner = tokenAtPos; commentOwner; commentOwner = commentOwner.parent) { + switch (commentOwner.kind) { + case 220: + case 147: + case 148: + case 221: + case 200: + break findOwner; + case 256: + return undefined; + case 225: + if (commentOwner.parent.kind === 225) { + return undefined; + } + break findOwner; + } + } + if (!commentOwner || commentOwner.getStart() < position) { + return undefined; + } + var parameters = getParametersForJsDocOwningNode(commentOwner); + var posLineAndChar = sourceFile.getLineAndCharacterOfPosition(position); + var lineStart = sourceFile.getLineStarts()[posLineAndChar.line]; + var indentationStr = sourceFile.text.substr(lineStart, posLineAndChar.character); + var newLine = ts.getNewLineOrDefaultFromHost(host); + var docParams = ""; + for (var i = 0, numParams = parameters.length; i < numParams; i++) { + var currentName = parameters[i].name; + var paramName = currentName.kind === 69 ? + currentName.text : + "param" + i; + docParams += indentationStr + " * @param " + paramName + newLine; + } + var preamble = "/**" + newLine + + indentationStr + " * "; + var result = preamble + newLine + + docParams + + indentationStr + " */" + + (tokenStart === position ? newLine + indentationStr : ""); + return { newText: result, caretOffset: preamble.length }; + } + function isValidBraceCompletionAtPostion(fileName, position, openingBrace) { + if (openingBrace === 60) { + return false; + } + var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); + if (ts.isInString(sourceFile, position) || ts.isInComment(sourceFile, position)) { + return false; + } + if (ts.isInsideJsxElementOrAttribute(sourceFile, position)) { + return openingBrace === 123; + } + if (ts.isInTemplateString(sourceFile, position)) { + return false; + } + return true; + } + function getParametersForJsDocOwningNode(commentOwner) { + if (ts.isFunctionLike(commentOwner)) { + return commentOwner.parameters; + } + if (commentOwner.kind === 200) { + var varStatement = commentOwner; + var varDeclarations = varStatement.declarationList.declarations; + if (varDeclarations.length === 1 && varDeclarations[0].initializer) { + return getParametersFromRightHandSideOfAssignment(varDeclarations[0].initializer); + } + } + return emptyArray; + } + function getParametersFromRightHandSideOfAssignment(rightHandSide) { + while (rightHandSide.kind === 178) { + rightHandSide = rightHandSide.expression; + } + switch (rightHandSide.kind) { + case 179: + case 180: + return rightHandSide.parameters; + case 192: + for (var _i = 0, _a = rightHandSide.members; _i < _a.length; _i++) { + var member = _a[_i]; + if (member.kind === 148) { + return member.parameters; + } + } + break; + } + return emptyArray; + } + function getTodoComments(fileName, descriptors) { + synchronizeHostData(); + var sourceFile = getValidSourceFile(fileName); + cancellationToken.throwIfCancellationRequested(); + var fileContents = sourceFile.text; + var result = []; + if (descriptors.length > 0) { + var regExp = getTodoCommentsRegExp(); + var matchArray = void 0; + while (matchArray = regExp.exec(fileContents)) { + cancellationToken.throwIfCancellationRequested(); + var firstDescriptorCaptureIndex = 3; + ts.Debug.assert(matchArray.length === descriptors.length + firstDescriptorCaptureIndex); + var preamble = matchArray[1]; + var matchPosition = matchArray.index + preamble.length; + var token = ts.getTokenAtPosition(sourceFile, matchPosition); + if (!isInsideComment(sourceFile, token, matchPosition)) { + continue; + } + var descriptor = undefined; + for (var i = 0, n = descriptors.length; i < n; i++) { + if (matchArray[i + firstDescriptorCaptureIndex]) { + descriptor = descriptors[i]; + } + } + ts.Debug.assert(descriptor !== undefined); + if (isLetterOrDigit(fileContents.charCodeAt(matchPosition + descriptor.text.length))) { + continue; + } + var message = matchArray[2]; + result.push({ + descriptor: descriptor, + message: message, + position: matchPosition + }); + } + } + return result; + function escapeRegExp(str) { + return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"); + } + function getTodoCommentsRegExp() { + var singleLineCommentStart = /(?:\/\/+\s*)/.source; + var multiLineCommentStart = /(?:\/\*+\s*)/.source; + var anyNumberOfSpacesAndAsterisksAtStartOfLine = /(?:^(?:\s|\*)*)/.source; + var preamble = "(" + anyNumberOfSpacesAndAsterisksAtStartOfLine + "|" + singleLineCommentStart + "|" + multiLineCommentStart + ")"; + var literals = "(?:" + ts.map(descriptors, function (d) { return "(" + escapeRegExp(d.text) + ")"; }).join("|") + ")"; + var endOfLineOrEndOfComment = /(?:$|\*\/)/.source; + var messageRemainder = /(?:.*?)/.source; + var messagePortion = "(" + literals + messageRemainder + ")"; + var regExpString = preamble + messagePortion + endOfLineOrEndOfComment; + return new RegExp(regExpString, "gim"); + } + function isLetterOrDigit(char) { + return (char >= 97 && char <= 122) || + (char >= 65 && char <= 90) || + (char >= 48 && char <= 57); + } + } + function getStringLiteralTypeForNode(node, typeChecker) { + var searchNode = node.parent.kind === 166 ? node.parent : node; + var type = typeChecker.getTypeAtLocation(searchNode); + if (type && type.flags & 256) { + return type; + } + return undefined; + } + function getRenameInfo(fileName, position) { + synchronizeHostData(); + var sourceFile = getValidSourceFile(fileName); + var typeChecker = program.getTypeChecker(); + var defaultLibFileName = host.getDefaultLibFileName(host.getCompilationSettings()); + var canonicalDefaultLibName = getCanonicalFileName(ts.normalizePath(defaultLibFileName)); + var node = ts.getTouchingWord(sourceFile, position); + if (node) { + if (node.kind === 69 || + node.kind === 9 || + isLiteralNameOfPropertyDeclarationOrIndexAccess(node)) { + var symbol = typeChecker.getSymbolAtLocation(node); + if (symbol) { + var declarations = symbol.getDeclarations(); + if (declarations && declarations.length > 0) { + if (ts.forEach(declarations, isDefinedInLibraryFile)) { + return getRenameInfoError(ts.getLocaleSpecificMessage(ts.Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library)); + } + var displayName = ts.stripQuotes(ts.getDeclaredName(typeChecker, symbol, node)); + var kind = getSymbolKind(symbol, node); + if (kind) { + return { + canRename: true, + kind: kind, + displayName: displayName, + localizedErrorMessage: undefined, + fullDisplayName: typeChecker.getFullyQualifiedName(symbol), + kindModifiers: getSymbolModifiers(symbol), + triggerSpan: createTriggerSpanForNode(node, sourceFile) + }; + } + } + } + else if (node.kind === 9) { + var type = getStringLiteralTypeForNode(node, typeChecker); + if (type) { + if (isDefinedInLibraryFile(node)) { + return getRenameInfoError(ts.getLocaleSpecificMessage(ts.Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library)); + } + else { + var displayName = ts.stripQuotes(type.text); + return { + canRename: true, + kind: ScriptElementKind.variableElement, + displayName: displayName, + localizedErrorMessage: undefined, + fullDisplayName: displayName, + kindModifiers: ScriptElementKindModifier.none, + triggerSpan: createTriggerSpanForNode(node, sourceFile) + }; + } + } + } + } + } + return getRenameInfoError(ts.getLocaleSpecificMessage(ts.Diagnostics.You_cannot_rename_this_element)); + function getRenameInfoError(localizedErrorMessage) { + return { + canRename: false, + localizedErrorMessage: localizedErrorMessage, + displayName: undefined, + fullDisplayName: undefined, + kind: undefined, + kindModifiers: undefined, + triggerSpan: undefined + }; + } + function isDefinedInLibraryFile(declaration) { + if (defaultLibFileName) { + var sourceFile_3 = declaration.getSourceFile(); + var canonicalName = getCanonicalFileName(ts.normalizePath(sourceFile_3.fileName)); + if (canonicalName === canonicalDefaultLibName) { + return true; + } + } + return false; + } + function createTriggerSpanForNode(node, sourceFile) { + var start = node.getStart(sourceFile); + var width = node.getWidth(sourceFile); + if (node.kind === 9) { + start += 1; + width -= 2; + } + return ts.createTextSpan(start, width); + } + } + return { + dispose: dispose, + cleanupSemanticCache: cleanupSemanticCache, + getSyntacticDiagnostics: getSyntacticDiagnostics, + getSemanticDiagnostics: getSemanticDiagnostics, + getCompilerOptionsDiagnostics: getCompilerOptionsDiagnostics, + getSyntacticClassifications: getSyntacticClassifications, + getSemanticClassifications: getSemanticClassifications, + getEncodedSyntacticClassifications: getEncodedSyntacticClassifications, + getEncodedSemanticClassifications: getEncodedSemanticClassifications, + getCompletionsAtPosition: getCompletionsAtPosition, + getCompletionEntryDetails: getCompletionEntryDetails, + getSignatureHelpItems: getSignatureHelpItems, + getQuickInfoAtPosition: getQuickInfoAtPosition, + getDefinitionAtPosition: getDefinitionAtPosition, + getTypeDefinitionAtPosition: getTypeDefinitionAtPosition, + getReferencesAtPosition: getReferencesAtPosition, + findReferences: findReferences, + getOccurrencesAtPosition: getOccurrencesAtPosition, + getDocumentHighlights: getDocumentHighlights, + getNameOrDottedNameSpan: getNameOrDottedNameSpan, + getBreakpointStatementAtPosition: getBreakpointStatementAtPosition, + getNavigateToItems: getNavigateToItems, + getRenameInfo: getRenameInfo, + findRenameLocations: findRenameLocations, + getNavigationBarItems: getNavigationBarItems, + getOutliningSpans: getOutliningSpans, + getTodoComments: getTodoComments, + getBraceMatchingAtPosition: getBraceMatchingAtPosition, + getIndentationAtPosition: getIndentationAtPosition, + getFormattingEditsForRange: getFormattingEditsForRange, + getFormattingEditsForDocument: getFormattingEditsForDocument, + getFormattingEditsAfterKeystroke: getFormattingEditsAfterKeystroke, + getDocCommentTemplateAtPosition: getDocCommentTemplateAtPosition, + isValidBraceCompletionAtPostion: isValidBraceCompletionAtPostion, + getEmitOutput: getEmitOutput, + getNonBoundSourceFile: getNonBoundSourceFile, + getProgram: getProgram + }; + } + ts.createLanguageService = createLanguageService; + function getNameTable(sourceFile) { + if (!sourceFile.nameTable) { + initializeNameTable(sourceFile); + } + return sourceFile.nameTable; + } + ts.getNameTable = getNameTable; + function initializeNameTable(sourceFile) { + var nameTable = {}; + walk(sourceFile); + sourceFile.nameTable = nameTable; + function walk(node) { + switch (node.kind) { + case 69: + nameTable[node.text] = nameTable[node.text] === undefined ? node.pos : -1; + break; + case 9: + case 8: + if (ts.isDeclarationName(node) || + node.parent.kind === 240 || + isArgumentOfElementAccessExpression(node) || + ts.isLiteralComputedPropertyDeclarationName(node)) { + nameTable[node.text] = nameTable[node.text] === undefined ? node.pos : -1; + } + break; + default: + ts.forEachChild(node, walk); + } + } + } + function isArgumentOfElementAccessExpression(node) { + return node && + node.parent && + node.parent.kind === 173 && + node.parent.argumentExpression === node; + } + function createClassifier() { + var scanner = ts.createScanner(2, false); + var noRegexTable = []; + noRegexTable[69] = true; + noRegexTable[9] = true; + noRegexTable[8] = true; + noRegexTable[10] = true; + noRegexTable[97] = true; + noRegexTable[41] = true; + noRegexTable[42] = true; + noRegexTable[18] = true; + noRegexTable[20] = true; + noRegexTable[16] = true; + noRegexTable[99] = true; + noRegexTable[84] = true; + var templateStack = []; + function canFollow(keyword1, keyword2) { + if (ts.isAccessibilityModifier(keyword1)) { + if (keyword2 === 123 || + keyword2 === 131 || + keyword2 === 121 || + keyword2 === 113) { + return true; + } + return false; + } + return true; + } + function convertClassifications(classifications, text) { + var entries = []; + var dense = classifications.spans; + var lastEnd = 0; + for (var i = 0, n = dense.length; i < n; i += 3) { + var start = dense[i]; + var length_3 = dense[i + 1]; + var type = dense[i + 2]; + if (lastEnd >= 0) { + var whitespaceLength_1 = start - lastEnd; + if (whitespaceLength_1 > 0) { + entries.push({ length: whitespaceLength_1, classification: TokenClass.Whitespace }); + } + } + entries.push({ length: length_3, classification: convertClassification(type) }); + lastEnd = start + length_3; + } + var whitespaceLength = text.length - lastEnd; + if (whitespaceLength > 0) { + entries.push({ length: whitespaceLength, classification: TokenClass.Whitespace }); + } + return { entries: entries, finalLexState: classifications.endOfLineState }; + } + function convertClassification(type) { + switch (type) { + case 1: return TokenClass.Comment; + case 3: return TokenClass.Keyword; + case 4: return TokenClass.NumberLiteral; + case 5: return TokenClass.Operator; + case 6: return TokenClass.StringLiteral; + case 8: return TokenClass.Whitespace; + case 10: return TokenClass.Punctuation; + case 2: + case 11: + case 12: + case 13: + case 14: + case 15: + case 16: + case 9: + case 17: + default: + return TokenClass.Identifier; + } + } + function getClassificationsForLine(text, lexState, syntacticClassifierAbsent) { + return convertClassifications(getEncodedLexicalClassifications(text, lexState, syntacticClassifierAbsent), text); + } + function getEncodedLexicalClassifications(text, lexState, syntacticClassifierAbsent) { + var offset = 0; + var token = 0; + var lastNonTriviaToken = 0; + while (templateStack.length > 0) { + templateStack.pop(); + } + switch (lexState) { + case 3: + text = "\"\\\n" + text; + offset = 3; + break; + case 2: + text = "'\\\n" + text; + offset = 3; + break; + case 1: + text = "/*\n" + text; + offset = 3; + break; + case 4: + text = "`\n" + text; + offset = 2; + break; + case 5: + text = "}\n" + text; + offset = 2; + case 6: + templateStack.push(12); + break; + } + scanner.setText(text); + var result = { + endOfLineState: 0, + spans: [] + }; + var angleBracketStack = 0; + do { + token = scanner.scan(); + if (!ts.isTrivia(token)) { + if ((token === 39 || token === 61) && !noRegexTable[lastNonTriviaToken]) { + if (scanner.reScanSlashToken() === 10) { + token = 10; + } + } + else if (lastNonTriviaToken === 21 && isKeyword(token)) { + token = 69; + } + else if (isKeyword(lastNonTriviaToken) && isKeyword(token) && !canFollow(lastNonTriviaToken, token)) { + token = 69; + } + else if (lastNonTriviaToken === 69 && + token === 25) { + angleBracketStack++; + } + else if (token === 27 && angleBracketStack > 0) { + angleBracketStack--; + } + else if (token === 117 || + token === 132 || + token === 130 || + token === 120 || + token === 133) { + if (angleBracketStack > 0 && !syntacticClassifierAbsent) { + token = 69; + } + } + else if (token === 12) { + templateStack.push(token); + } + else if (token === 15) { + if (templateStack.length > 0) { + templateStack.push(token); + } + } + else if (token === 16) { + if (templateStack.length > 0) { + var lastTemplateStackToken = ts.lastOrUndefined(templateStack); + if (lastTemplateStackToken === 12) { + token = scanner.reScanTemplateToken(); + if (token === 14) { + templateStack.pop(); + } + else { + ts.Debug.assert(token === 13, "Should have been a template middle. Was " + token); + } + } + else { + ts.Debug.assert(lastTemplateStackToken === 15, "Should have been an open brace. Was: " + token); + templateStack.pop(); + } + } + } + lastNonTriviaToken = token; + } + processToken(); + } while (token !== 1); + return result; + function processToken() { + var start = scanner.getTokenPos(); + var end = scanner.getTextPos(); + addResult(start, end, classFromKind(token)); + if (end >= text.length) { + if (token === 9 || token === 166) { + var tokenText = scanner.getTokenText(); + if (scanner.isUnterminated()) { + var lastCharIndex = tokenText.length - 1; + var numBackslashes = 0; + while (tokenText.charCodeAt(lastCharIndex - numBackslashes) === 92) { + numBackslashes++; + } + if (numBackslashes & 1) { + var quoteChar = tokenText.charCodeAt(0); + result.endOfLineState = quoteChar === 34 + ? 3 + : 2; + } + } + } + else if (token === 3) { + if (scanner.isUnterminated()) { + result.endOfLineState = 1; + } + } + else if (ts.isTemplateLiteralKind(token)) { + if (scanner.isUnterminated()) { + if (token === 14) { + result.endOfLineState = 5; + } + else if (token === 11) { + result.endOfLineState = 4; + } + else { + ts.Debug.fail("Only 'NoSubstitutionTemplateLiteral's and 'TemplateTail's can be unterminated; got SyntaxKind #" + token); + } + } + } + else if (templateStack.length > 0 && ts.lastOrUndefined(templateStack) === 12) { + result.endOfLineState = 6; + } + } + } + function addResult(start, end, classification) { + if (classification === 8) { + return; + } + if (start === 0 && offset > 0) { + start += offset; + } + start -= offset; + end -= offset; + var length = end - start; + if (length > 0) { + result.spans.push(start); + result.spans.push(length); + result.spans.push(classification); + } + } + } + function isBinaryExpressionOperatorToken(token) { + switch (token) { + case 37: + case 39: + case 40: + case 35: + case 36: + case 43: + case 44: + case 45: + case 25: + case 27: + case 28: + case 29: + case 91: + case 90: + case 116: + case 30: + case 31: + case 32: + case 33: + case 46: + case 48: + case 47: + case 51: + case 52: + case 67: + case 66: + case 68: + case 63: + case 64: + case 65: + case 57: + case 58: + case 59: + case 61: + case 62: + case 56: + case 24: + return true; + default: + return false; + } + } + function isPrefixUnaryExpressionOperatorToken(token) { + switch (token) { + case 35: + case 36: + case 50: + case 49: + case 41: + case 42: + return true; + default: + return false; + } + } + function isKeyword(token) { + return token >= 70 && token <= 138; + } + function classFromKind(token) { + if (isKeyword(token)) { + return 3; + } + else if (isBinaryExpressionOperatorToken(token) || isPrefixUnaryExpressionOperatorToken(token)) { + return 5; + } + else if (token >= 15 && token <= 68) { + return 10; + } + switch (token) { + case 8: + return 4; + case 9: + case 166: + return 6; + case 10: + return 7; + case 7: + case 3: + case 2: + return 1; + case 5: + case 4: + return 8; + case 69: + default: + if (ts.isTemplateLiteralKind(token)) { + return 6; + } + return 2; + } + } + return { + getClassificationsForLine: getClassificationsForLine, + getEncodedLexicalClassifications: getEncodedLexicalClassifications + }; + } + ts.createClassifier = createClassifier; + function getDefaultLibFilePath(options) { + if (typeof __dirname !== "undefined") { + return __dirname + ts.directorySeparator + ts.getDefaultLibFileName(options); + } + throw new Error("getDefaultLibFilePath is only supported when consumed as a node module. "); + } + ts.getDefaultLibFilePath = getDefaultLibFilePath; + function initializeServices() { + ts.objectAllocator = { + getNodeConstructor: function () { return NodeObject; }, + getSourceFileConstructor: function () { return SourceFileObject; }, + getSymbolConstructor: function () { return SymbolObject; }, + getTypeConstructor: function () { return TypeObject; }, + getSignatureConstructor: function () { return SignatureObject; } + }; + } + initializeServices(); +})(ts || (ts = {})); +var ts; +(function (ts) { + var server; + (function (server) { + var spaceCache = []; + function generateSpaces(n) { + if (!spaceCache[n]) { + var strBuilder = ""; + for (var i = 0; i < n; i++) { + strBuilder += " "; + } + spaceCache[n] = strBuilder; + } + return spaceCache[n]; + } + server.generateSpaces = generateSpaces; + function generateIndentString(n, editorOptions) { + if (editorOptions.ConvertTabsToSpaces) { + return generateSpaces(n); + } + else { + var result = ""; + for (var i = 0; i < Math.floor(n / editorOptions.TabSize); i++) { + result += "\t"; + } + for (var i = 0; i < n % editorOptions.TabSize; i++) { + result += " "; + } + return result; + } + } + server.generateIndentString = generateIndentString; + function compareNumber(a, b) { + if (a < b) { + return -1; + } + else if (a === b) { + return 0; + } + else + return 1; + } + function compareFileStart(a, b) { + if (a.file < b.file) { + return -1; + } + else if (a.file == b.file) { + var n = compareNumber(a.start.line, b.start.line); + if (n === 0) { + return compareNumber(a.start.offset, b.start.offset); + } + else + return n; + } + else { + return 1; + } + } + function formatDiag(fileName, project, diag) { + return { + start: project.compilerService.host.positionToLineOffset(fileName, diag.start), + end: project.compilerService.host.positionToLineOffset(fileName, diag.start + diag.length), + text: ts.flattenDiagnosticMessageText(diag.messageText, "\n") + }; + } + function formatConfigFileDiag(diag) { + return { + start: undefined, + end: undefined, + text: ts.flattenDiagnosticMessageText(diag.messageText, "\n") + }; + } + function allEditsBeforePos(edits, pos) { + for (var i = 0, len = edits.length; i < len; i++) { + if (ts.textSpanEnd(edits[i].span) >= pos) { + return false; + } + } + return true; + } + var CommandNames; + (function (CommandNames) { + CommandNames.Brace = "brace"; + CommandNames.Change = "change"; + CommandNames.Close = "close"; + CommandNames.Completions = "completions"; + CommandNames.CompletionDetails = "completionEntryDetails"; + CommandNames.Configure = "configure"; + CommandNames.Definition = "definition"; + CommandNames.Exit = "exit"; + CommandNames.Format = "format"; + CommandNames.Formatonkey = "formatonkey"; + CommandNames.Geterr = "geterr"; + CommandNames.GeterrForProject = "geterrForProject"; + CommandNames.NavBar = "navbar"; + CommandNames.Navto = "navto"; + CommandNames.Occurrences = "occurrences"; + CommandNames.DocumentHighlights = "documentHighlights"; + CommandNames.Open = "open"; + CommandNames.Quickinfo = "quickinfo"; + CommandNames.References = "references"; + CommandNames.Reload = "reload"; + CommandNames.Rename = "rename"; + CommandNames.Saveto = "saveto"; + CommandNames.SignatureHelp = "signatureHelp"; + CommandNames.TypeDefinition = "typeDefinition"; + CommandNames.ProjectInfo = "projectInfo"; + CommandNames.ReloadProjects = "reloadProjects"; + CommandNames.Unknown = "unknown"; + })(CommandNames = server.CommandNames || (server.CommandNames = {})); + var Errors; + (function (Errors) { + Errors.NoProject = new Error("No Project."); + })(Errors || (Errors = {})); + var Session = (function () { + function Session(host, byteLength, hrtime, logger) { + var _this = this; + this.host = host; + this.byteLength = byteLength; + this.hrtime = hrtime; + this.logger = logger; + this.changeSeq = 0; + this.handlers = (_a = {}, + _a[CommandNames.Exit] = function () { + _this.exit(); + return { responseRequired: false }; + }, + _a[CommandNames.Definition] = function (request) { + var defArgs = request.arguments; + return { response: _this.getDefinition(defArgs.line, defArgs.offset, defArgs.file), responseRequired: true }; + }, + _a[CommandNames.TypeDefinition] = function (request) { + var defArgs = request.arguments; + return { response: _this.getTypeDefinition(defArgs.line, defArgs.offset, defArgs.file), responseRequired: true }; + }, + _a[CommandNames.References] = function (request) { + var defArgs = request.arguments; + return { response: _this.getReferences(defArgs.line, defArgs.offset, defArgs.file), responseRequired: true }; + }, + _a[CommandNames.Rename] = function (request) { + var renameArgs = request.arguments; + return { response: _this.getRenameLocations(renameArgs.line, renameArgs.offset, renameArgs.file, renameArgs.findInComments, renameArgs.findInStrings), responseRequired: true }; + }, + _a[CommandNames.Open] = function (request) { + var openArgs = request.arguments; + var scriptKind; + switch (openArgs.scriptKindName) { + case "TS": + scriptKind = 3; + break; + case "JS": + scriptKind = 1; + break; + case "TSX": + scriptKind = 4; + break; + case "JSX": + scriptKind = 2; + break; + } + _this.openClientFile(openArgs.file, openArgs.fileContent, scriptKind); + return { responseRequired: false }; + }, + _a[CommandNames.Quickinfo] = function (request) { + var quickinfoArgs = request.arguments; + return { response: _this.getQuickInfo(quickinfoArgs.line, quickinfoArgs.offset, quickinfoArgs.file), responseRequired: true }; + }, + _a[CommandNames.Format] = function (request) { + var formatArgs = request.arguments; + return { response: _this.getFormattingEditsForRange(formatArgs.line, formatArgs.offset, formatArgs.endLine, formatArgs.endOffset, formatArgs.file), responseRequired: true }; + }, + _a[CommandNames.Formatonkey] = function (request) { + var formatOnKeyArgs = request.arguments; + return { response: _this.getFormattingEditsAfterKeystroke(formatOnKeyArgs.line, formatOnKeyArgs.offset, formatOnKeyArgs.key, formatOnKeyArgs.file), responseRequired: true }; + }, + _a[CommandNames.Completions] = function (request) { + var completionsArgs = request.arguments; + return { response: _this.getCompletions(completionsArgs.line, completionsArgs.offset, completionsArgs.prefix, completionsArgs.file), responseRequired: true }; + }, + _a[CommandNames.CompletionDetails] = function (request) { + var completionDetailsArgs = request.arguments; + return { + response: _this.getCompletionEntryDetails(completionDetailsArgs.line, completionDetailsArgs.offset, completionDetailsArgs.entryNames, completionDetailsArgs.file), responseRequired: true + }; + }, + _a[CommandNames.SignatureHelp] = function (request) { + var signatureHelpArgs = request.arguments; + return { response: _this.getSignatureHelpItems(signatureHelpArgs.line, signatureHelpArgs.offset, signatureHelpArgs.file), responseRequired: true }; + }, + _a[CommandNames.Geterr] = function (request) { + var geterrArgs = request.arguments; + return { response: _this.getDiagnostics(geterrArgs.delay, geterrArgs.files), responseRequired: false }; + }, + _a[CommandNames.GeterrForProject] = function (request) { + var _a = request.arguments, file = _a.file, delay = _a.delay; + return { response: _this.getDiagnosticsForProject(delay, file), responseRequired: false }; + }, + _a[CommandNames.Change] = function (request) { + var changeArgs = request.arguments; + _this.change(changeArgs.line, changeArgs.offset, changeArgs.endLine, changeArgs.endOffset, changeArgs.insertString, changeArgs.file); + return { responseRequired: false }; + }, + _a[CommandNames.Configure] = function (request) { + var configureArgs = request.arguments; + _this.projectService.setHostConfiguration(configureArgs); + _this.output(undefined, CommandNames.Configure, request.seq); + return { responseRequired: false }; + }, + _a[CommandNames.Reload] = function (request) { + var reloadArgs = request.arguments; + _this.reload(reloadArgs.file, reloadArgs.tmpfile, request.seq); + return { response: { reloadFinished: true }, responseRequired: true }; + }, + _a[CommandNames.Saveto] = function (request) { + var savetoArgs = request.arguments; + _this.saveToTmp(savetoArgs.file, savetoArgs.tmpfile); + return { responseRequired: false }; + }, + _a[CommandNames.Close] = function (request) { + var closeArgs = request.arguments; + _this.closeClientFile(closeArgs.file); + return { responseRequired: false }; + }, + _a[CommandNames.Navto] = function (request) { + var navtoArgs = request.arguments; + return { response: _this.getNavigateToItems(navtoArgs.searchValue, navtoArgs.file, navtoArgs.maxResultCount), responseRequired: true }; + }, + _a[CommandNames.Brace] = function (request) { + var braceArguments = request.arguments; + return { response: _this.getBraceMatching(braceArguments.line, braceArguments.offset, braceArguments.file), responseRequired: true }; + }, + _a[CommandNames.NavBar] = function (request) { + var navBarArgs = request.arguments; + return { response: _this.getNavigationBarItems(navBarArgs.file), responseRequired: true }; + }, + _a[CommandNames.Occurrences] = function (request) { + var _a = request.arguments, line = _a.line, offset = _a.offset, fileName = _a.file; + return { response: _this.getOccurrences(line, offset, fileName), responseRequired: true }; + }, + _a[CommandNames.DocumentHighlights] = function (request) { + var _a = request.arguments, line = _a.line, offset = _a.offset, fileName = _a.file, filesToSearch = _a.filesToSearch; + return { response: _this.getDocumentHighlights(line, offset, fileName, filesToSearch), responseRequired: true }; + }, + _a[CommandNames.ProjectInfo] = function (request) { + var _a = request.arguments, file = _a.file, needFileNameList = _a.needFileNameList; + return { response: _this.getProjectInfo(file, needFileNameList), responseRequired: true }; + }, + _a[CommandNames.ReloadProjects] = function (request) { + _this.reloadProjects(); + return { responseRequired: false }; + }, + _a + ); + this.projectService = + new server.ProjectService(host, logger, function (eventName, project, fileName) { + _this.handleEvent(eventName, project, fileName); + }); + var _a; + } + Session.prototype.handleEvent = function (eventName, project, fileName) { + var _this = this; + if (eventName == "context") { + this.projectService.log("got context event, updating diagnostics for" + fileName, "Info"); + this.updateErrorCheck([{ fileName: fileName, project: project }], this.changeSeq, function (n) { return n === _this.changeSeq; }, 100); + } + }; + Session.prototype.logError = function (err, cmd) { + var typedErr = err; + var msg = "Exception on executing command " + cmd; + if (typedErr.message) { + msg += ":\n" + typedErr.message; + if (typedErr.stack) { + msg += "\n" + typedErr.stack; + } + } + this.projectService.log(msg); + }; + Session.prototype.sendLineToClient = function (line) { + this.host.write(line + this.host.newLine); + }; + Session.prototype.send = function (msg) { + var json = JSON.stringify(msg); + if (this.logger.isVerbose()) { + this.logger.info(msg.type + ": " + json); + } + this.sendLineToClient("Content-Length: " + (1 + this.byteLength(json, "utf8")) + + "\r\n\r\n" + json); + }; + Session.prototype.configFileDiagnosticEvent = function (triggerFile, configFile, diagnostics) { + var bakedDiags = ts.map(diagnostics, formatConfigFileDiag); + var ev = { + seq: 0, + type: "event", + event: "configFileDiag", + body: { + triggerFile: triggerFile, + configFile: configFile, + diagnostics: bakedDiags + } + }; + this.send(ev); + }; + Session.prototype.event = function (info, eventName) { + var ev = { + seq: 0, + type: "event", + event: eventName, + body: info + }; + this.send(ev); + }; + Session.prototype.response = function (info, cmdName, reqSeq, errorMsg) { + if (reqSeq === void 0) { reqSeq = 0; } + var res = { + seq: 0, + type: "response", + command: cmdName, + request_seq: reqSeq, + success: !errorMsg + }; + if (!errorMsg) { + res.body = info; + } + else { + res.message = errorMsg; + } + this.send(res); + }; + Session.prototype.output = function (body, commandName, requestSequence, errorMessage) { + if (requestSequence === void 0) { requestSequence = 0; } + this.response(body, commandName, requestSequence, errorMessage); + }; + Session.prototype.semanticCheck = function (file, project) { + try { + var diags = project.compilerService.languageService.getSemanticDiagnostics(file); + if (diags) { + var bakedDiags = diags.map(function (diag) { return formatDiag(file, project, diag); }); + this.event({ file: file, diagnostics: bakedDiags }, "semanticDiag"); + } + } + catch (err) { + this.logError(err, "semantic check"); + } + }; + Session.prototype.syntacticCheck = function (file, project) { + try { + var diags = project.compilerService.languageService.getSyntacticDiagnostics(file); + if (diags) { + var bakedDiags = diags.map(function (diag) { return formatDiag(file, project, diag); }); + this.event({ file: file, diagnostics: bakedDiags }, "syntaxDiag"); + } + } + catch (err) { + this.logError(err, "syntactic check"); + } + }; + Session.prototype.reloadProjects = function () { + this.projectService.reloadProjects(); + }; + Session.prototype.updateProjectStructure = function (seq, matchSeq, ms) { + var _this = this; + if (ms === void 0) { ms = 1500; } + setTimeout(function () { + if (matchSeq(seq)) { + _this.projectService.updateProjectStructure(); + } + }, ms); + }; + Session.prototype.updateErrorCheck = function (checkList, seq, matchSeq, ms, followMs, requireOpen) { + var _this = this; + if (ms === void 0) { ms = 1500; } + if (followMs === void 0) { followMs = 200; } + if (requireOpen === void 0) { requireOpen = true; } + if (followMs > ms) { + followMs = ms; + } + if (this.errorTimer) { + clearTimeout(this.errorTimer); + } + if (this.immediateId) { + clearImmediate(this.immediateId); + this.immediateId = undefined; + } + var index = 0; + var checkOne = function () { + if (matchSeq(seq)) { + var checkSpec_1 = checkList[index]; + index++; + if (checkSpec_1.project.getSourceFileFromName(checkSpec_1.fileName, requireOpen)) { + _this.syntacticCheck(checkSpec_1.fileName, checkSpec_1.project); + _this.immediateId = setImmediate(function () { + _this.semanticCheck(checkSpec_1.fileName, checkSpec_1.project); + _this.immediateId = undefined; + if (checkList.length > index) { + _this.errorTimer = setTimeout(checkOne, followMs); + } + else { + _this.errorTimer = undefined; + } + }); + } + } + }; + if ((checkList.length > index) && (matchSeq(seq))) { + this.errorTimer = setTimeout(checkOne, ms); + } + }; + Session.prototype.getDefinition = function (line, offset, fileName) { + var file = ts.normalizePath(fileName); + var project = this.projectService.getProjectForFile(file); + if (!project) { + throw Errors.NoProject; + } + var compilerService = project.compilerService; + var position = compilerService.host.lineOffsetToPosition(file, line, offset); + var definitions = compilerService.languageService.getDefinitionAtPosition(file, position); + if (!definitions) { + return undefined; + } + return definitions.map(function (def) { return ({ + file: def.fileName, + start: compilerService.host.positionToLineOffset(def.fileName, def.textSpan.start), + end: compilerService.host.positionToLineOffset(def.fileName, ts.textSpanEnd(def.textSpan)) + }); }); + }; + Session.prototype.getTypeDefinition = function (line, offset, fileName) { + var file = ts.normalizePath(fileName); + var project = this.projectService.getProjectForFile(file); + if (!project) { + throw Errors.NoProject; + } + var compilerService = project.compilerService; + var position = compilerService.host.lineOffsetToPosition(file, line, offset); + var definitions = compilerService.languageService.getTypeDefinitionAtPosition(file, position); + if (!definitions) { + return undefined; + } + return definitions.map(function (def) { return ({ + file: def.fileName, + start: compilerService.host.positionToLineOffset(def.fileName, def.textSpan.start), + end: compilerService.host.positionToLineOffset(def.fileName, ts.textSpanEnd(def.textSpan)) + }); }); + }; + Session.prototype.getOccurrences = function (line, offset, fileName) { + fileName = ts.normalizePath(fileName); + var project = this.projectService.getProjectForFile(fileName); + if (!project) { + throw Errors.NoProject; + } + var compilerService = project.compilerService; + var position = compilerService.host.lineOffsetToPosition(fileName, line, offset); + var occurrences = compilerService.languageService.getOccurrencesAtPosition(fileName, position); + if (!occurrences) { + return undefined; + } + return occurrences.map(function (occurrence) { + var fileName = occurrence.fileName, isWriteAccess = occurrence.isWriteAccess, textSpan = occurrence.textSpan; + var start = compilerService.host.positionToLineOffset(fileName, textSpan.start); + var end = compilerService.host.positionToLineOffset(fileName, ts.textSpanEnd(textSpan)); + return { + start: start, + end: end, + file: fileName, + isWriteAccess: isWriteAccess + }; + }); + }; + Session.prototype.getDocumentHighlights = function (line, offset, fileName, filesToSearch) { + fileName = ts.normalizePath(fileName); + var project = this.projectService.getProjectForFile(fileName); + if (!project) { + throw Errors.NoProject; + } + var compilerService = project.compilerService; + var position = compilerService.host.lineOffsetToPosition(fileName, line, offset); + var documentHighlights = compilerService.languageService.getDocumentHighlights(fileName, position, filesToSearch); + if (!documentHighlights) { + return undefined; + } + return documentHighlights.map(convertToDocumentHighlightsItem); + function convertToDocumentHighlightsItem(documentHighlights) { + var fileName = documentHighlights.fileName, highlightSpans = documentHighlights.highlightSpans; + return { + file: fileName, + highlightSpans: highlightSpans.map(convertHighlightSpan) + }; + function convertHighlightSpan(highlightSpan) { + var textSpan = highlightSpan.textSpan, kind = highlightSpan.kind; + var start = compilerService.host.positionToLineOffset(fileName, textSpan.start); + var end = compilerService.host.positionToLineOffset(fileName, ts.textSpanEnd(textSpan)); + return { start: start, end: end, kind: kind }; + } + } + }; + Session.prototype.getProjectInfo = function (fileName, needFileNameList) { + fileName = ts.normalizePath(fileName); + var project = this.projectService.getProjectForFile(fileName); + var projectInfo = { + configFileName: project.projectFilename + }; + if (needFileNameList) { + projectInfo.fileNames = project.getFileNames(); + } + return projectInfo; + }; + Session.prototype.getRenameLocations = function (line, offset, fileName, findInComments, findInStrings) { + var file = ts.normalizePath(fileName); + var info = this.projectService.getScriptInfo(file); + var projects = this.projectService.findReferencingProjects(info); + if (!projects.length) { + throw Errors.NoProject; + } + var defaultProject = projects[0]; + var defaultProjectCompilerService = defaultProject.compilerService; + var position = defaultProjectCompilerService.host.lineOffsetToPosition(file, line, offset); + var renameInfo = defaultProjectCompilerService.languageService.getRenameInfo(file, position); + if (!renameInfo) { + return undefined; + } + if (!renameInfo.canRename) { + return { + info: renameInfo, + locs: [] + }; + } + var fileSpans = server.combineProjectOutput(projects, function (project) { + var compilerService = project.compilerService; + var renameLocations = compilerService.languageService.findRenameLocations(file, position, findInStrings, findInComments); + if (!renameLocations) { + return []; + } + return renameLocations.map(function (location) { return ({ + file: location.fileName, + start: compilerService.host.positionToLineOffset(location.fileName, location.textSpan.start), + end: compilerService.host.positionToLineOffset(location.fileName, ts.textSpanEnd(location.textSpan)) + }); }); + }, compareRenameLocation, function (a, b) { return a.file === b.file && a.start.line === b.start.line && a.start.offset === b.start.offset; }); + var locs = fileSpans.reduce(function (accum, cur) { + var curFileAccum; + if (accum.length > 0) { + curFileAccum = accum[accum.length - 1]; + if (curFileAccum.file !== cur.file) { + curFileAccum = undefined; + } + } + if (!curFileAccum) { + curFileAccum = { file: cur.file, locs: [] }; + accum.push(curFileAccum); + } + curFileAccum.locs.push({ start: cur.start, end: cur.end }); + return accum; + }, []); + return { info: renameInfo, locs: locs }; + function compareRenameLocation(a, b) { + if (a.file < b.file) { + return -1; + } + else if (a.file > b.file) { + return 1; + } + else { + if (a.start.line < b.start.line) { + return 1; + } + else if (a.start.line > b.start.line) { + return -1; + } + else { + return b.start.offset - a.start.offset; + } + } + } + }; + Session.prototype.getReferences = function (line, offset, fileName) { + var file = ts.normalizePath(fileName); + var info = this.projectService.getScriptInfo(file); + var projects = this.projectService.findReferencingProjects(info); + if (!projects.length) { + throw Errors.NoProject; + } + var defaultProject = projects[0]; + var position = defaultProject.compilerService.host.lineOffsetToPosition(file, line, offset); + var nameInfo = defaultProject.compilerService.languageService.getQuickInfoAtPosition(file, position); + if (!nameInfo) { + return undefined; + } + var displayString = ts.displayPartsToString(nameInfo.displayParts); + var nameSpan = nameInfo.textSpan; + var nameColStart = defaultProject.compilerService.host.positionToLineOffset(file, nameSpan.start).offset; + var nameText = defaultProject.compilerService.host.getScriptSnapshot(file).getText(nameSpan.start, ts.textSpanEnd(nameSpan)); + var refs = server.combineProjectOutput(projects, function (project) { + var compilerService = project.compilerService; + var references = compilerService.languageService.getReferencesAtPosition(file, position); + if (!references) { + return []; + } + return references.map(function (ref) { + var start = compilerService.host.positionToLineOffset(ref.fileName, ref.textSpan.start); + var refLineSpan = compilerService.host.lineToTextSpan(ref.fileName, start.line - 1); + var snap = compilerService.host.getScriptSnapshot(ref.fileName); + var lineText = snap.getText(refLineSpan.start, ts.textSpanEnd(refLineSpan)).replace(/\r|\n/g, ""); + return { + file: ref.fileName, + start: start, + lineText: lineText, + end: compilerService.host.positionToLineOffset(ref.fileName, ts.textSpanEnd(ref.textSpan)), + isWriteAccess: ref.isWriteAccess + }; + }); + }, compareFileStart, areReferencesResponseItemsForTheSameLocation); + return { + refs: refs, + symbolName: nameText, + symbolStartOffset: nameColStart, + symbolDisplayString: displayString + }; + function areReferencesResponseItemsForTheSameLocation(a, b) { + if (a && b) { + return a.file === b.file && + a.start === b.start && + a.end === b.end; + } + return false; + } + }; + Session.prototype.openClientFile = function (fileName, fileContent, scriptKind) { + var file = ts.normalizePath(fileName); + var _a = this.projectService.openClientFile(file, fileContent, scriptKind), configFileName = _a.configFileName, configFileErrors = _a.configFileErrors; + if (configFileErrors) { + this.configFileDiagnosticEvent(fileName, configFileName, configFileErrors); + } + }; + Session.prototype.getQuickInfo = function (line, offset, fileName) { + var file = ts.normalizePath(fileName); + var project = this.projectService.getProjectForFile(file); + if (!project) { + throw Errors.NoProject; + } + var compilerService = project.compilerService; + var position = compilerService.host.lineOffsetToPosition(file, line, offset); + var quickInfo = compilerService.languageService.getQuickInfoAtPosition(file, position); + if (!quickInfo) { + return undefined; + } + var displayString = ts.displayPartsToString(quickInfo.displayParts); + var docString = ts.displayPartsToString(quickInfo.documentation); + return { + kind: quickInfo.kind, + kindModifiers: quickInfo.kindModifiers, + start: compilerService.host.positionToLineOffset(file, quickInfo.textSpan.start), + end: compilerService.host.positionToLineOffset(file, ts.textSpanEnd(quickInfo.textSpan)), + displayString: displayString, + documentation: docString + }; + }; + Session.prototype.getFormattingEditsForRange = function (line, offset, endLine, endOffset, fileName) { + var file = ts.normalizePath(fileName); + var project = this.projectService.getProjectForFile(file); + if (!project) { + throw Errors.NoProject; + } + var compilerService = project.compilerService; + var startPosition = compilerService.host.lineOffsetToPosition(file, line, offset); + var endPosition = compilerService.host.lineOffsetToPosition(file, endLine, endOffset); + var edits = compilerService.languageService.getFormattingEditsForRange(file, startPosition, endPosition, this.projectService.getFormatCodeOptions(file)); + if (!edits) { + return undefined; + } + return edits.map(function (edit) { + return { + start: compilerService.host.positionToLineOffset(file, edit.span.start), + end: compilerService.host.positionToLineOffset(file, ts.textSpanEnd(edit.span)), + newText: edit.newText ? edit.newText : "" + }; + }); + }; + Session.prototype.getFormattingEditsAfterKeystroke = function (line, offset, key, fileName) { + var file = ts.normalizePath(fileName); + var project = this.projectService.getProjectForFile(file); + if (!project) { + throw Errors.NoProject; + } + var compilerService = project.compilerService; + var position = compilerService.host.lineOffsetToPosition(file, line, offset); + var formatOptions = this.projectService.getFormatCodeOptions(file); + var edits = compilerService.languageService.getFormattingEditsAfterKeystroke(file, position, key, formatOptions); + if ((key == "\n") && ((!edits) || (edits.length === 0) || allEditsBeforePos(edits, position))) { + var scriptInfo = compilerService.host.getScriptInfo(file); + if (scriptInfo) { + var lineInfo = scriptInfo.getLineInfo(line); + if (lineInfo && (lineInfo.leaf) && (lineInfo.leaf.text)) { + var lineText = lineInfo.leaf.text; + if (lineText.search("\\S") < 0) { + var editorOptions = { + IndentSize: formatOptions.IndentSize, + TabSize: formatOptions.TabSize, + NewLineCharacter: formatOptions.NewLineCharacter, + ConvertTabsToSpaces: formatOptions.ConvertTabsToSpaces, + IndentStyle: ts.IndentStyle.Smart + }; + var preferredIndent = compilerService.languageService.getIndentationAtPosition(file, position, editorOptions); + var hasIndent = 0; + var i = void 0, len = void 0; + for (i = 0, len = lineText.length; i < len; i++) { + if (lineText.charAt(i) == " ") { + hasIndent++; + } + else if (lineText.charAt(i) == "\t") { + hasIndent += editorOptions.TabSize; + } + else { + break; + } + } + if (preferredIndent !== hasIndent) { + var firstNoWhiteSpacePosition = lineInfo.offset + i; + edits.push({ + span: ts.createTextSpanFromBounds(lineInfo.offset, firstNoWhiteSpacePosition), + newText: generateIndentString(preferredIndent, editorOptions) + }); + } + } + } + } + } + if (!edits) { + return undefined; + } + return edits.map(function (edit) { + return { + start: compilerService.host.positionToLineOffset(file, edit.span.start), + end: compilerService.host.positionToLineOffset(file, ts.textSpanEnd(edit.span)), + newText: edit.newText ? edit.newText : "" + }; + }); + }; + Session.prototype.getCompletions = function (line, offset, prefix, fileName) { + if (!prefix) { + prefix = ""; + } + var file = ts.normalizePath(fileName); + var project = this.projectService.getProjectForFile(file); + if (!project) { + throw Errors.NoProject; + } + var compilerService = project.compilerService; + var position = compilerService.host.lineOffsetToPosition(file, line, offset); + var completions = compilerService.languageService.getCompletionsAtPosition(file, position); + if (!completions) { + return undefined; + } + return completions.entries.reduce(function (result, entry) { + if (completions.isMemberCompletion || (entry.name.toLowerCase().indexOf(prefix.toLowerCase()) === 0)) { + result.push(entry); + } + return result; + }, []).sort(function (a, b) { return a.name.localeCompare(b.name); }); + }; + Session.prototype.getCompletionEntryDetails = function (line, offset, entryNames, fileName) { + var file = ts.normalizePath(fileName); + var project = this.projectService.getProjectForFile(file); + if (!project) { + throw Errors.NoProject; + } + var compilerService = project.compilerService; + var position = compilerService.host.lineOffsetToPosition(file, line, offset); + return entryNames.reduce(function (accum, entryName) { + var details = compilerService.languageService.getCompletionEntryDetails(file, position, entryName); + if (details) { + accum.push(details); + } + return accum; + }, []); + }; + Session.prototype.getSignatureHelpItems = function (line, offset, fileName) { + var file = ts.normalizePath(fileName); + var project = this.projectService.getProjectForFile(file); + if (!project) { + throw Errors.NoProject; + } + var compilerService = project.compilerService; + var position = compilerService.host.lineOffsetToPosition(file, line, offset); + var helpItems = compilerService.languageService.getSignatureHelpItems(file, position); + if (!helpItems) { + return undefined; + } + var span = helpItems.applicableSpan; + var result = { + items: helpItems.items, + applicableSpan: { + start: compilerService.host.positionToLineOffset(file, span.start), + end: compilerService.host.positionToLineOffset(file, span.start + span.length) + }, + selectedItemIndex: helpItems.selectedItemIndex, + argumentIndex: helpItems.argumentIndex, + argumentCount: helpItems.argumentCount + }; + return result; + }; + Session.prototype.getDiagnostics = function (delay, fileNames) { + var _this = this; + var checkList = fileNames.reduce(function (accum, fileName) { + fileName = ts.normalizePath(fileName); + var project = _this.projectService.getProjectForFile(fileName); + if (project) { + accum.push({ fileName: fileName, project: project }); + } + return accum; + }, []); + if (checkList.length > 0) { + this.updateErrorCheck(checkList, this.changeSeq, function (n) { return n === _this.changeSeq; }, delay); + } + }; + Session.prototype.change = function (line, offset, endLine, endOffset, insertString, fileName) { + var _this = this; + var file = ts.normalizePath(fileName); + var project = this.projectService.getProjectForFile(file); + if (project) { + var compilerService = project.compilerService; + var start = compilerService.host.lineOffsetToPosition(file, line, offset); + var end = compilerService.host.lineOffsetToPosition(file, endLine, endOffset); + if (start >= 0) { + compilerService.host.editScript(file, start, end, insertString); + this.changeSeq++; + } + this.updateProjectStructure(this.changeSeq, function (n) { return n === _this.changeSeq; }); + } + }; + Session.prototype.reload = function (fileName, tempFileName, reqSeq) { + var _this = this; + if (reqSeq === void 0) { reqSeq = 0; } + var file = ts.normalizePath(fileName); + var tmpfile = ts.normalizePath(tempFileName); + var project = this.projectService.getProjectForFile(file); + if (project) { + this.changeSeq++; + project.compilerService.host.reloadScript(file, tmpfile, function () { + _this.output(undefined, CommandNames.Reload, reqSeq); + }); + } + }; + Session.prototype.saveToTmp = function (fileName, tempFileName) { + var file = ts.normalizePath(fileName); + var tmpfile = ts.normalizePath(tempFileName); + var project = this.projectService.getProjectForFile(file); + if (project) { + project.compilerService.host.saveTo(file, tmpfile); + } + }; + Session.prototype.closeClientFile = function (fileName) { + if (!fileName) { + return; + } + var file = ts.normalizePath(fileName); + this.projectService.closeClientFile(file); + }; + Session.prototype.decorateNavigationBarItem = function (project, fileName, items) { + var _this = this; + if (!items) { + return undefined; + } + var compilerService = project.compilerService; + return items.map(function (item) { return ({ + text: item.text, + kind: item.kind, + kindModifiers: item.kindModifiers, + spans: item.spans.map(function (span) { return ({ + start: compilerService.host.positionToLineOffset(fileName, span.start), + end: compilerService.host.positionToLineOffset(fileName, ts.textSpanEnd(span)) + }); }), + childItems: _this.decorateNavigationBarItem(project, fileName, item.childItems) + }); }); + }; + Session.prototype.getNavigationBarItems = function (fileName) { + var file = ts.normalizePath(fileName); + var project = this.projectService.getProjectForFile(file); + if (!project) { + throw Errors.NoProject; + } + var compilerService = project.compilerService; + var items = compilerService.languageService.getNavigationBarItems(file); + if (!items) { + return undefined; + } + return this.decorateNavigationBarItem(project, fileName, items); + }; + Session.prototype.getNavigateToItems = function (searchValue, fileName, maxResultCount) { + var file = ts.normalizePath(fileName); + var info = this.projectService.getScriptInfo(file); + var projects = this.projectService.findReferencingProjects(info); + var defaultProject = projects[0]; + if (!defaultProject) { + throw Errors.NoProject; + } + var allNavToItems = server.combineProjectOutput(projects, function (project) { + var compilerService = project.compilerService; + var navItems = compilerService.languageService.getNavigateToItems(searchValue, maxResultCount); + if (!navItems) { + return []; + } + return navItems.map(function (navItem) { + var start = compilerService.host.positionToLineOffset(navItem.fileName, navItem.textSpan.start); + var end = compilerService.host.positionToLineOffset(navItem.fileName, ts.textSpanEnd(navItem.textSpan)); + var bakedItem = { + name: navItem.name, + kind: navItem.kind, + file: navItem.fileName, + start: start, + end: end + }; + if (navItem.kindModifiers && (navItem.kindModifiers !== "")) { + bakedItem.kindModifiers = navItem.kindModifiers; + } + if (navItem.matchKind !== "none") { + bakedItem.matchKind = navItem.matchKind; + } + if (navItem.containerName && (navItem.containerName.length > 0)) { + bakedItem.containerName = navItem.containerName; + } + if (navItem.containerKind && (navItem.containerKind.length > 0)) { + bakedItem.containerKind = navItem.containerKind; + } + return bakedItem; + }); + }, undefined, areNavToItemsForTheSameLocation); + return allNavToItems; + function areNavToItemsForTheSameLocation(a, b) { + if (a && b) { + return a.file === b.file && + a.start === b.start && + a.end === b.end; + } + return false; + } + }; + Session.prototype.getBraceMatching = function (line, offset, fileName) { + var file = ts.normalizePath(fileName); + var project = this.projectService.getProjectForFile(file); + if (!project) { + throw Errors.NoProject; + } + var compilerService = project.compilerService; + var position = compilerService.host.lineOffsetToPosition(file, line, offset); + var spans = compilerService.languageService.getBraceMatchingAtPosition(file, position); + if (!spans) { + return undefined; + } + return spans.map(function (span) { return ({ + start: compilerService.host.positionToLineOffset(file, span.start), + end: compilerService.host.positionToLineOffset(file, span.start + span.length) + }); }); + }; + Session.prototype.getDiagnosticsForProject = function (delay, fileName) { + var _this = this; + var fileNames = this.getProjectInfo(fileName, true).fileNames; + var fileNamesInProject = fileNames.filter(function (value, index, array) { return value.indexOf("lib.d.ts") < 0; }); + var highPriorityFiles = []; + var mediumPriorityFiles = []; + var lowPriorityFiles = []; + var veryLowPriorityFiles = []; + var normalizedFileName = ts.normalizePath(fileName); + var project = this.projectService.getProjectForFile(normalizedFileName); + for (var _i = 0, fileNamesInProject_1 = fileNamesInProject; _i < fileNamesInProject_1.length; _i++) { + var fileNameInProject = fileNamesInProject_1[_i]; + if (this.getCanonicalFileName(fileNameInProject) == this.getCanonicalFileName(fileName)) + highPriorityFiles.push(fileNameInProject); + else { + var info = this.projectService.getScriptInfo(fileNameInProject); + if (!info.isOpen) { + if (fileNameInProject.indexOf(".d.ts") > 0) + veryLowPriorityFiles.push(fileNameInProject); + else + lowPriorityFiles.push(fileNameInProject); + } + else + mediumPriorityFiles.push(fileNameInProject); + } + } + fileNamesInProject = highPriorityFiles.concat(mediumPriorityFiles).concat(lowPriorityFiles).concat(veryLowPriorityFiles); + if (fileNamesInProject.length > 0) { + var checkList = fileNamesInProject.map(function (fileName) { + var normalizedFileName = ts.normalizePath(fileName); + return { fileName: normalizedFileName, project: project }; + }); + this.updateErrorCheck(checkList, this.changeSeq, function (n) { return n == _this.changeSeq; }, delay, 200, false); + } + }; + Session.prototype.getCanonicalFileName = function (fileName) { + var name = this.host.useCaseSensitiveFileNames ? fileName : fileName.toLowerCase(); + return ts.normalizePath(name); + }; + Session.prototype.exit = function () { + }; + Session.prototype.addProtocolHandler = function (command, handler) { + if (this.handlers[command]) { + throw new Error("Protocol handler already exists for command \"" + command + "\""); + } + this.handlers[command] = handler; + }; + Session.prototype.executeCommand = function (request) { + var handler = this.handlers[request.command]; + if (handler) { + return handler(request); + } + else { + this.projectService.log("Unrecognized JSON command: " + JSON.stringify(request)); + this.output(undefined, CommandNames.Unknown, request.seq, "Unrecognized JSON command: " + request.command); + return { responseRequired: false }; + } + }; + Session.prototype.onMessage = function (message) { + var start; + if (this.logger.isVerbose()) { + this.logger.info("request: " + message); + start = this.hrtime(); + } + var request; + try { + request = JSON.parse(message); + var _a = this.executeCommand(request), response = _a.response, responseRequired = _a.responseRequired; + if (this.logger.isVerbose()) { + var elapsed = this.hrtime(start); + var seconds = elapsed[0]; + var nanoseconds = elapsed[1]; + var elapsedMs = ((1e9 * seconds) + nanoseconds) / 1000000.0; + var leader = "Elapsed time (in milliseconds)"; + if (!responseRequired) { + leader = "Async elapsed time (in milliseconds)"; + } + this.logger.msg(leader + ": " + elapsedMs.toFixed(4).toString(), "Perf"); + } + if (response) { + this.output(response, request.command, request.seq); + } + else if (responseRequired) { + this.output(undefined, request.command, request.seq, "No content available."); + } + } + catch (err) { + if (err instanceof ts.OperationCanceledException) { + } + this.logError(err, message); + this.output(undefined, request ? request.command : CommandNames.Unknown, request ? request.seq : 0, "Error processing request. " + err.message); + } + }; + return Session; + }()); + server.Session = Session; + })(server = ts.server || (ts.server = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var server; + (function (server) { + var lineCollectionCapacity = 4; + function mergeFormatOptions(formatCodeOptions, formatOptions) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + Object.keys(formatOptions).forEach(function (key) { + var codeKey = key.charAt(0).toUpperCase() + key.substring(1); + if (hasOwnProperty.call(formatCodeOptions, codeKey)) { + formatCodeOptions[codeKey] = formatOptions[key]; + } + }); + } + var ScriptInfo = (function () { + function ScriptInfo(host, fileName, content, isOpen) { + if (isOpen === void 0) { isOpen = false; } + this.host = host; + this.fileName = fileName; + this.content = content; + this.isOpen = isOpen; + this.children = []; + this.formatCodeOptions = ts.clone(CompilerService.getDefaultFormatCodeOptions(this.host)); + this.path = ts.toPath(fileName, host.getCurrentDirectory(), ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames)); + this.svc = ScriptVersionCache.fromString(host, content); + } + ScriptInfo.prototype.setFormatOptions = function (formatOptions) { + if (formatOptions) { + mergeFormatOptions(this.formatCodeOptions, formatOptions); + } + }; + ScriptInfo.prototype.close = function () { + this.isOpen = false; + }; + ScriptInfo.prototype.addChild = function (childInfo) { + this.children.push(childInfo); + }; + ScriptInfo.prototype.snap = function () { + return this.svc.getSnapshot(); + }; + ScriptInfo.prototype.getText = function () { + var snap = this.snap(); + return snap.getText(0, snap.getLength()); + }; + ScriptInfo.prototype.getLineInfo = function (line) { + var snap = this.snap(); + return snap.index.lineNumberToInfo(line); + }; + ScriptInfo.prototype.editContent = function (start, end, newText) { + this.svc.edit(start, end - start, newText); + }; + ScriptInfo.prototype.getTextChangeRangeBetweenVersions = function (startVersion, endVersion) { + return this.svc.getTextChangesBetweenVersions(startVersion, endVersion); + }; + ScriptInfo.prototype.getChangeRange = function (oldSnapshot) { + return this.snap().getChangeRange(oldSnapshot); + }; + return ScriptInfo; + }()); + server.ScriptInfo = ScriptInfo; + var LSHost = (function () { + function LSHost(host, project) { + var _this = this; + this.host = host; + this.project = project; + this.roots = []; + this.getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames); + this.resolvedModuleNames = ts.createFileMap(); + this.resolvedTypeReferenceDirectives = ts.createFileMap(); + this.filenameToScript = ts.createFileMap(); + this.moduleResolutionHost = { + fileExists: function (fileName) { return _this.fileExists(fileName); }, + readFile: function (fileName) { return _this.host.readFile(fileName); }, + directoryExists: function (directoryName) { return _this.host.directoryExists(directoryName); } + }; + } + LSHost.prototype.resolveNamesWithLocalCache = function (names, containingFile, cache, loader, getResult) { + var path = ts.toPath(containingFile, this.host.getCurrentDirectory(), this.getCanonicalFileName); + var currentResolutionsInFile = cache.get(path); + var newResolutions = {}; + var resolvedModules = []; + var compilerOptions = this.getCompilationSettings(); + for (var _i = 0, names_2 = names; _i < names_2.length; _i++) { + var name_41 = names_2[_i]; + var resolution = ts.lookUp(newResolutions, name_41); + if (!resolution) { + var existingResolution = currentResolutionsInFile && ts.lookUp(currentResolutionsInFile, name_41); + if (moduleResolutionIsValid(existingResolution)) { + resolution = existingResolution; + } + else { + resolution = loader(name_41, containingFile, compilerOptions, this.moduleResolutionHost); + resolution.lastCheckTime = Date.now(); + newResolutions[name_41] = resolution; + } + } + ts.Debug.assert(resolution !== undefined); + resolvedModules.push(getResult(resolution)); + } + cache.set(path, newResolutions); + return resolvedModules; + function moduleResolutionIsValid(resolution) { + if (!resolution) { + return false; + } + if (getResult(resolution)) { + return true; + } + return resolution.failedLookupLocations.length === 0; + } + }; + LSHost.prototype.resolveTypeReferenceDirectives = function (typeDirectiveNames, containingFile) { + return this.resolveNamesWithLocalCache(typeDirectiveNames, containingFile, this.resolvedTypeReferenceDirectives, ts.resolveTypeReferenceDirective, function (m) { return m.resolvedTypeReferenceDirective; }); + }; + LSHost.prototype.resolveModuleNames = function (moduleNames, containingFile) { + return this.resolveNamesWithLocalCache(moduleNames, containingFile, this.resolvedModuleNames, ts.resolveModuleName, function (m) { return m.resolvedModule; }); + }; + LSHost.prototype.getDefaultLibFileName = function () { + var nodeModuleBinDir = ts.getDirectoryPath(ts.normalizePath(this.host.getExecutingFilePath())); + return ts.combinePaths(nodeModuleBinDir, ts.getDefaultLibFileName(this.compilationSettings)); + }; + LSHost.prototype.getScriptSnapshot = function (filename) { + var scriptInfo = this.getScriptInfo(filename); + if (scriptInfo) { + return scriptInfo.snap(); + } + }; + LSHost.prototype.setCompilationSettings = function (opt) { + this.compilationSettings = opt; + this.resolvedModuleNames.clear(); + this.resolvedTypeReferenceDirectives.clear(); + }; + LSHost.prototype.lineAffectsRefs = function (filename, line) { + var info = this.getScriptInfo(filename); + var lineInfo = info.getLineInfo(line); + if (lineInfo && lineInfo.text) { + var regex = /reference|import|\/\*|\*\//; + return regex.test(lineInfo.text); + } + }; + LSHost.prototype.getCompilationSettings = function () { + return this.compilationSettings; + }; + LSHost.prototype.getScriptFileNames = function () { + return this.roots.map(function (root) { return root.fileName; }); + }; + LSHost.prototype.getScriptKind = function (fileName) { + var info = this.getScriptInfo(fileName); + if (!info) { + return undefined; + } + if (!info.scriptKind) { + info.scriptKind = ts.getScriptKindFromFileName(fileName); + } + return info.scriptKind; + }; + LSHost.prototype.getScriptVersion = function (filename) { + return this.getScriptInfo(filename).svc.latestVersion().toString(); + }; + LSHost.prototype.getCurrentDirectory = function () { + return ""; + }; + LSHost.prototype.getScriptIsOpen = function (filename) { + return this.getScriptInfo(filename).isOpen; + }; + LSHost.prototype.removeReferencedFile = function (info) { + if (!info.isOpen) { + this.filenameToScript.remove(info.path); + this.resolvedModuleNames.remove(info.path); + this.resolvedTypeReferenceDirectives.remove(info.path); + } + }; + LSHost.prototype.getScriptInfo = function (filename) { + var path = ts.toPath(filename, this.host.getCurrentDirectory(), this.getCanonicalFileName); + var scriptInfo = this.filenameToScript.get(path); + if (!scriptInfo) { + scriptInfo = this.project.openReferencedFile(filename); + if (scriptInfo) { + this.filenameToScript.set(path, scriptInfo); + } + } + return scriptInfo; + }; + LSHost.prototype.addRoot = function (info) { + if (!this.filenameToScript.contains(info.path)) { + this.filenameToScript.set(info.path, info); + this.roots.push(info); + } + }; + LSHost.prototype.removeRoot = function (info) { + if (!this.filenameToScript.contains(info.path)) { + this.filenameToScript.remove(info.path); + this.roots = copyListRemovingItem(info, this.roots); + this.resolvedModuleNames.remove(info.path); + this.resolvedTypeReferenceDirectives.remove(info.path); + } + }; + LSHost.prototype.saveTo = function (filename, tmpfilename) { + var script = this.getScriptInfo(filename); + if (script) { + var snap = script.snap(); + this.host.writeFile(tmpfilename, snap.getText(0, snap.getLength())); + } + }; + LSHost.prototype.reloadScript = function (filename, tmpfilename, cb) { + var script = this.getScriptInfo(filename); + if (script) { + script.svc.reloadFromFile(tmpfilename, cb); + } + }; + LSHost.prototype.editScript = function (filename, start, end, newText) { + var script = this.getScriptInfo(filename); + if (script) { + script.editContent(start, end, newText); + return; + } + throw new Error("No script with name '" + filename + "'"); + }; + LSHost.prototype.resolvePath = function (path) { + var result = this.host.resolvePath(path); + return result; + }; + LSHost.prototype.fileExists = function (path) { + var result = this.host.fileExists(path); + return result; + }; + LSHost.prototype.directoryExists = function (path) { + return this.host.directoryExists(path); + }; + LSHost.prototype.lineToTextSpan = function (filename, line) { + var path = ts.toPath(filename, this.host.getCurrentDirectory(), this.getCanonicalFileName); + var script = this.filenameToScript.get(path); + var index = script.snap().index; + var lineInfo = index.lineNumberToInfo(line + 1); + var len; + if (lineInfo.leaf) { + len = lineInfo.leaf.text.length; + } + else { + var nextLineInfo = index.lineNumberToInfo(line + 2); + len = nextLineInfo.offset - lineInfo.offset; + } + return ts.createTextSpan(lineInfo.offset, len); + }; + LSHost.prototype.lineOffsetToPosition = function (filename, line, offset) { + var path = ts.toPath(filename, this.host.getCurrentDirectory(), this.getCanonicalFileName); + var script = this.filenameToScript.get(path); + var index = script.snap().index; + var lineInfo = index.lineNumberToInfo(line); + return (lineInfo.offset + offset - 1); + }; + LSHost.prototype.positionToLineOffset = function (filename, position) { + var path = ts.toPath(filename, this.host.getCurrentDirectory(), this.getCanonicalFileName); + var script = this.filenameToScript.get(path); + var index = script.snap().index; + var lineOffset = index.charOffsetToLineNumberAndPos(position); + return { line: lineOffset.line, offset: lineOffset.offset + 1 }; + }; + return LSHost; + }()); + server.LSHost = LSHost; + var Project = (function () { + function Project(projectService, projectOptions) { + this.projectService = projectService; + this.projectOptions = projectOptions; + this.directoriesWatchedForTsconfig = []; + this.filenameToSourceFile = {}; + this.updateGraphSeq = 0; + this.openRefCount = 0; + if (projectOptions && projectOptions.files) { + projectOptions.compilerOptions.allowNonTsExtensions = true; + } + this.compilerService = new CompilerService(this, projectOptions && projectOptions.compilerOptions); + } + Project.prototype.addOpenRef = function () { + this.openRefCount++; + }; + Project.prototype.deleteOpenRef = function () { + this.openRefCount--; + return this.openRefCount; + }; + Project.prototype.openReferencedFile = function (filename) { + return this.projectService.openFile(filename, false); + }; + Project.prototype.getRootFiles = function () { + return this.compilerService.host.roots.map(function (info) { return info.fileName; }); + }; + Project.prototype.getFileNames = function () { + var sourceFiles = this.program.getSourceFiles(); + return sourceFiles.map(function (sourceFile) { return sourceFile.fileName; }); + }; + Project.prototype.getSourceFile = function (info) { + return this.filenameToSourceFile[info.fileName]; + }; + Project.prototype.getSourceFileFromName = function (filename, requireOpen) { + var info = this.projectService.getScriptInfo(filename); + if (info) { + if ((!requireOpen) || info.isOpen) { + return this.getSourceFile(info); + } + } + }; + Project.prototype.isRoot = function (info) { + return this.compilerService.host.roots.some(function (root) { return root === info; }); + }; + Project.prototype.removeReferencedFile = function (info) { + this.compilerService.host.removeReferencedFile(info); + this.updateGraph(); + }; + Project.prototype.updateFileMap = function () { + this.filenameToSourceFile = {}; + var sourceFiles = this.program.getSourceFiles(); + for (var i = 0, len = sourceFiles.length; i < len; i++) { + var normFilename = ts.normalizePath(sourceFiles[i].fileName); + this.filenameToSourceFile[normFilename] = sourceFiles[i]; + } + }; + Project.prototype.finishGraph = function () { + this.updateGraph(); + this.compilerService.languageService.getNavigateToItems(".*"); + }; + Project.prototype.updateGraph = function () { + this.program = this.compilerService.languageService.getProgram(); + this.updateFileMap(); + }; + Project.prototype.isConfiguredProject = function () { + return this.projectFilename; + }; + Project.prototype.addRoot = function (info) { + this.compilerService.host.addRoot(info); + }; + Project.prototype.removeRoot = function (info) { + this.compilerService.host.removeRoot(info); + }; + Project.prototype.filesToString = function () { + var strBuilder = ""; + ts.forEachValue(this.filenameToSourceFile, function (sourceFile) { strBuilder += sourceFile.fileName + "\n"; }); + return strBuilder; + }; + Project.prototype.setProjectOptions = function (projectOptions) { + this.projectOptions = projectOptions; + if (projectOptions.compilerOptions) { + projectOptions.compilerOptions.allowNonTsExtensions = true; + this.compilerService.setCompilerOptions(projectOptions.compilerOptions); + } + }; + return Project; + }()); + server.Project = Project; + function copyListRemovingItem(item, list) { + var copiedList = []; + for (var i = 0, len = list.length; i < len; i++) { + if (list[i] != item) { + copiedList.push(list[i]); + } + } + return copiedList; + } + function combineProjectOutput(projects, action, comparer, areEqual) { + var result = projects.reduce(function (previous, current) { return ts.concatenate(previous, action(current)); }, []).sort(comparer); + return projects.length > 1 ? ts.deduplicate(result, areEqual) : result; + } + server.combineProjectOutput = combineProjectOutput; + var ProjectService = (function () { + function ProjectService(host, psLogger, eventHandler) { + this.host = host; + this.psLogger = psLogger; + this.eventHandler = eventHandler; + this.filenameToScriptInfo = {}; + this.openFileRoots = []; + this.inferredProjects = []; + this.configuredProjects = []; + this.openFilesReferenced = []; + this.openFileRootsConfigured = []; + this.directoryWatchersForTsconfig = {}; + this.directoryWatchersRefCount = {}; + this.timerForDetectingProjectFileListChanges = {}; + this.addDefaultHostConfiguration(); + } + ProjectService.prototype.addDefaultHostConfiguration = function () { + this.hostConfiguration = { + formatCodeOptions: ts.clone(CompilerService.getDefaultFormatCodeOptions(this.host)), + hostInfo: "Unknown host" + }; + }; + ProjectService.prototype.getFormatCodeOptions = function (file) { + if (file) { + var info = this.filenameToScriptInfo[file]; + if (info) { + return info.formatCodeOptions; + } + } + return this.hostConfiguration.formatCodeOptions; + }; + ProjectService.prototype.watchedFileChanged = function (fileName) { + var info = this.filenameToScriptInfo[fileName]; + if (!info) { + this.psLogger.info("Error: got watch notification for unknown file: " + fileName); + } + if (!this.host.fileExists(fileName)) { + this.fileDeletedInFilesystem(info); + } + else { + if (info && (!info.isOpen)) { + info.svc.reloadFromFile(info.fileName); + } + } + }; + ProjectService.prototype.directoryWatchedForSourceFilesChanged = function (project, fileName) { + if (fileName && !ts.isSupportedSourceFileName(fileName, project.projectOptions ? project.projectOptions.compilerOptions : undefined)) { + return; + } + this.log("Detected source file changes: " + fileName); + this.startTimerForDetectingProjectFileListChanges(project); + }; + ProjectService.prototype.startTimerForDetectingProjectFileListChanges = function (project) { + var _this = this; + if (this.timerForDetectingProjectFileListChanges[project.projectFilename]) { + this.host.clearTimeout(this.timerForDetectingProjectFileListChanges[project.projectFilename]); + } + this.timerForDetectingProjectFileListChanges[project.projectFilename] = this.host.setTimeout(function () { return _this.handleProjectFileListChanges(project); }, 250); + }; + ProjectService.prototype.handleProjectFileListChanges = function (project) { + var _this = this; + var projectOptions = this.configFileToProjectOptions(project.projectFilename).projectOptions; + var newRootFiles = projectOptions.files.map((function (f) { return _this.getCanonicalFileName(f); })); + var currentRootFiles = project.getRootFiles().map((function (f) { return _this.getCanonicalFileName(f); })); + if (!ts.arrayIsEqualTo(currentRootFiles && currentRootFiles.sort(), newRootFiles && newRootFiles.sort())) { + this.updateConfiguredProject(project); + this.updateProjectStructure(); + } + }; + ProjectService.prototype.directoryWatchedForTsconfigChanged = function (fileName) { + var _this = this; + if (ts.getBaseFileName(fileName) != "tsconfig.json") { + this.log(fileName + " is not tsconfig.json"); + return; + } + this.log("Detected newly added tsconfig file: " + fileName); + var projectOptions = this.configFileToProjectOptions(fileName).projectOptions; + var rootFilesInTsconfig = projectOptions.files.map(function (f) { return _this.getCanonicalFileName(f); }); + var openFileRoots = this.openFileRoots.map(function (s) { return _this.getCanonicalFileName(s.fileName); }); + for (var _i = 0, openFileRoots_1 = openFileRoots; _i < openFileRoots_1.length; _i++) { + var openFileRoot = openFileRoots_1[_i]; + if (rootFilesInTsconfig.indexOf(openFileRoot) >= 0) { + this.reloadProjects(); + return; + } + } + }; + ProjectService.prototype.getCanonicalFileName = function (fileName) { + var name = this.host.useCaseSensitiveFileNames ? fileName : fileName.toLowerCase(); + return ts.normalizePath(name); + }; + ProjectService.prototype.watchedProjectConfigFileChanged = function (project) { + this.log("Config file changed: " + project.projectFilename); + this.updateConfiguredProject(project); + this.updateProjectStructure(); + }; + ProjectService.prototype.log = function (msg, type) { + if (type === void 0) { type = "Err"; } + this.psLogger.msg(msg, type); + }; + ProjectService.prototype.setHostConfiguration = function (args) { + if (args.file) { + var info = this.filenameToScriptInfo[args.file]; + if (info) { + info.setFormatOptions(args.formatOptions); + this.log("Host configuration update for file " + args.file, "Info"); + } + } + else { + if (args.hostInfo !== undefined) { + this.hostConfiguration.hostInfo = args.hostInfo; + this.log("Host information " + args.hostInfo, "Info"); + } + if (args.formatOptions) { + mergeFormatOptions(this.hostConfiguration.formatCodeOptions, args.formatOptions); + this.log("Format host information updated", "Info"); + } + } + }; + ProjectService.prototype.closeLog = function () { + this.psLogger.close(); + }; + ProjectService.prototype.createInferredProject = function (root) { + var _this = this; + var project = new Project(this); + project.addRoot(root); + var currentPath = ts.getDirectoryPath(root.fileName); + var parentPath = ts.getDirectoryPath(currentPath); + while (currentPath != parentPath) { + if (!project.projectService.directoryWatchersForTsconfig[currentPath]) { + this.log("Add watcher for: " + currentPath); + project.projectService.directoryWatchersForTsconfig[currentPath] = + this.host.watchDirectory(currentPath, function (fileName) { return _this.directoryWatchedForTsconfigChanged(fileName); }); + project.projectService.directoryWatchersRefCount[currentPath] = 1; + } + else { + project.projectService.directoryWatchersRefCount[currentPath] += 1; + } + project.directoriesWatchedForTsconfig.push(currentPath); + currentPath = parentPath; + parentPath = ts.getDirectoryPath(parentPath); + } + project.finishGraph(); + this.inferredProjects.push(project); + return project; + }; + ProjectService.prototype.fileDeletedInFilesystem = function (info) { + this.psLogger.info(info.fileName + " deleted"); + if (info.fileWatcher) { + info.fileWatcher.close(); + info.fileWatcher = undefined; + } + if (!info.isOpen) { + this.filenameToScriptInfo[info.fileName] = undefined; + var referencingProjects = this.findReferencingProjects(info); + if (info.defaultProject) { + info.defaultProject.removeRoot(info); + } + for (var i = 0, len = referencingProjects.length; i < len; i++) { + referencingProjects[i].removeReferencedFile(info); + } + for (var j = 0, flen = this.openFileRoots.length; j < flen; j++) { + var openFile = this.openFileRoots[j]; + if (this.eventHandler) { + this.eventHandler("context", openFile.defaultProject, openFile.fileName); + } + } + for (var j = 0, flen = this.openFilesReferenced.length; j < flen; j++) { + var openFile = this.openFilesReferenced[j]; + if (this.eventHandler) { + this.eventHandler("context", openFile.defaultProject, openFile.fileName); + } + } + } + this.printProjects(); + }; + ProjectService.prototype.updateConfiguredProjectList = function () { + var configuredProjects = []; + for (var i = 0, len = this.configuredProjects.length; i < len; i++) { + if (this.configuredProjects[i].openRefCount > 0) { + configuredProjects.push(this.configuredProjects[i]); + } + } + this.configuredProjects = configuredProjects; + }; + ProjectService.prototype.removeProject = function (project) { + this.log("remove project: " + project.getRootFiles().toString()); + if (project.isConfiguredProject()) { + project.projectFileWatcher.close(); + project.directoryWatcher.close(); + this.configuredProjects = copyListRemovingItem(project, this.configuredProjects); + } + else { + for (var _i = 0, _a = project.directoriesWatchedForTsconfig; _i < _a.length; _i++) { + var directory = _a[_i]; + project.projectService.directoryWatchersRefCount[directory]--; + if (!project.projectService.directoryWatchersRefCount[directory]) { + this.log("Close directory watcher for: " + directory); + project.projectService.directoryWatchersForTsconfig[directory].close(); + delete project.projectService.directoryWatchersForTsconfig[directory]; + } + } + this.inferredProjects = copyListRemovingItem(project, this.inferredProjects); + } + var fileNames = project.getFileNames(); + for (var _b = 0, fileNames_2 = fileNames; _b < fileNames_2.length; _b++) { + var fileName = fileNames_2[_b]; + var info = this.getScriptInfo(fileName); + if (info.defaultProject == project) { + info.defaultProject = undefined; + } + } + }; + ProjectService.prototype.setConfiguredProjectRoot = function (info) { + for (var i = 0, len = this.configuredProjects.length; i < len; i++) { + var configuredProject = this.configuredProjects[i]; + if (configuredProject.isRoot(info)) { + info.defaultProject = configuredProject; + configuredProject.addOpenRef(); + return true; + } + } + return false; + }; + ProjectService.prototype.addOpenFile = function (info) { + if (this.setConfiguredProjectRoot(info)) { + this.openFileRootsConfigured.push(info); + } + else { + this.findReferencingProjects(info); + if (info.defaultProject) { + this.openFilesReferenced.push(info); + } + else { + info.defaultProject = this.createInferredProject(info); + var openFileRoots = []; + for (var i = 0, len = this.openFileRoots.length; i < len; i++) { + var r = this.openFileRoots[i]; + if (info.defaultProject.getSourceFile(r)) { + this.removeProject(r.defaultProject); + this.openFilesReferenced.push(r); + r.defaultProject = info.defaultProject; + } + else { + openFileRoots.push(r); + } + } + this.openFileRoots = openFileRoots; + this.openFileRoots.push(info); + } + } + this.updateConfiguredProjectList(); + }; + ProjectService.prototype.closeOpenFile = function (info) { + info.svc.reloadFromFile(info.fileName); + var openFileRoots = []; + var removedProject; + for (var i = 0, len = this.openFileRoots.length; i < len; i++) { + if (info === this.openFileRoots[i]) { + removedProject = info.defaultProject; + } + else { + openFileRoots.push(this.openFileRoots[i]); + } + } + this.openFileRoots = openFileRoots; + if (!removedProject) { + var openFileRootsConfigured = []; + for (var i = 0, len = this.openFileRootsConfigured.length; i < len; i++) { + if (info === this.openFileRootsConfigured[i]) { + if (info.defaultProject.deleteOpenRef() === 0) { + removedProject = info.defaultProject; + } + } + else { + openFileRootsConfigured.push(this.openFileRootsConfigured[i]); + } + } + this.openFileRootsConfigured = openFileRootsConfigured; + } + if (removedProject) { + this.removeProject(removedProject); + var openFilesReferenced = []; + var orphanFiles = []; + for (var i = 0, len = this.openFilesReferenced.length; i < len; i++) { + var f = this.openFilesReferenced[i]; + if (f.defaultProject === removedProject || !f.defaultProject) { + f.defaultProject = undefined; + orphanFiles.push(f); + } + else { + openFilesReferenced.push(f); + } + } + this.openFilesReferenced = openFilesReferenced; + for (var i = 0, len = orphanFiles.length; i < len; i++) { + this.addOpenFile(orphanFiles[i]); + } + } + else { + this.openFilesReferenced = copyListRemovingItem(info, this.openFilesReferenced); + } + info.close(); + }; + ProjectService.prototype.findReferencingProjects = function (info, excludedProject) { + var referencingProjects = []; + info.defaultProject = undefined; + for (var i = 0, len = this.inferredProjects.length; i < len; i++) { + var inferredProject = this.inferredProjects[i]; + inferredProject.updateGraph(); + if (inferredProject !== excludedProject) { + if (inferredProject.getSourceFile(info)) { + info.defaultProject = inferredProject; + referencingProjects.push(inferredProject); + } + } + } + for (var i = 0, len = this.configuredProjects.length; i < len; i++) { + var configuredProject = this.configuredProjects[i]; + configuredProject.updateGraph(); + if (configuredProject.getSourceFile(info)) { + info.defaultProject = configuredProject; + referencingProjects.push(configuredProject); + } + } + return referencingProjects; + }; + ProjectService.prototype.reloadProjects = function () { + this.log("reload projects."); + for (var _i = 0, _a = this.openFileRoots; _i < _a.length; _i++) { + var info = _a[_i]; + this.openOrUpdateConfiguredProjectForFile(info.fileName); + } + this.updateProjectStructure(); + }; + ProjectService.prototype.updateProjectStructure = function () { + this.log("updating project structure from ...", "Info"); + this.printProjects(); + var unattachedOpenFiles = []; + var openFileRootsConfigured = []; + for (var _i = 0, _a = this.openFileRootsConfigured; _i < _a.length; _i++) { + var info = _a[_i]; + var project = info.defaultProject; + if (!project || !(project.getSourceFile(info))) { + info.defaultProject = undefined; + unattachedOpenFiles.push(info); + } + else { + openFileRootsConfigured.push(info); + } + } + this.openFileRootsConfigured = openFileRootsConfigured; + var openFilesReferenced = []; + for (var i = 0, len = this.openFilesReferenced.length; i < len; i++) { + var referencedFile = this.openFilesReferenced[i]; + referencedFile.defaultProject.updateGraph(); + var sourceFile = referencedFile.defaultProject.getSourceFile(referencedFile); + if (sourceFile) { + openFilesReferenced.push(referencedFile); + } + else { + unattachedOpenFiles.push(referencedFile); + } + } + this.openFilesReferenced = openFilesReferenced; + var openFileRoots = []; + for (var i = 0, len = this.openFileRoots.length; i < len; i++) { + var rootFile = this.openFileRoots[i]; + var rootedProject = rootFile.defaultProject; + var referencingProjects = this.findReferencingProjects(rootFile, rootedProject); + if (rootFile.defaultProject && rootFile.defaultProject.isConfiguredProject()) { + if (!rootedProject.isConfiguredProject()) { + this.removeProject(rootedProject); + } + this.openFileRootsConfigured.push(rootFile); + } + else { + if (referencingProjects.length === 0) { + rootFile.defaultProject = rootedProject; + openFileRoots.push(rootFile); + } + else { + this.removeProject(rootedProject); + this.openFilesReferenced.push(rootFile); + } + } + } + this.openFileRoots = openFileRoots; + for (var i = 0, len = unattachedOpenFiles.length; i < len; i++) { + this.addOpenFile(unattachedOpenFiles[i]); + } + this.printProjects(); + }; + ProjectService.prototype.getScriptInfo = function (filename) { + filename = ts.normalizePath(filename); + return ts.lookUp(this.filenameToScriptInfo, filename); + }; + ProjectService.prototype.openFile = function (fileName, openedByClient, fileContent, scriptKind) { + var _this = this; + fileName = ts.normalizePath(fileName); + var info = ts.lookUp(this.filenameToScriptInfo, fileName); + if (!info) { + var content = void 0; + if (this.host.fileExists(fileName)) { + content = fileContent || this.host.readFile(fileName); + } + if (!content) { + if (openedByClient) { + content = ""; + } + } + if (content !== undefined) { + info = new ScriptInfo(this.host, fileName, content, openedByClient); + info.scriptKind = scriptKind; + info.setFormatOptions(this.getFormatCodeOptions()); + this.filenameToScriptInfo[fileName] = info; + if (!info.isOpen) { + info.fileWatcher = this.host.watchFile(fileName, function (_) { _this.watchedFileChanged(fileName); }); + } + } + } + if (info) { + if (fileContent) { + info.svc.reload(fileContent); + } + if (openedByClient) { + info.isOpen = true; + } + } + return info; + }; + ProjectService.prototype.findConfigFile = function (searchPath) { + while (true) { + var tsconfigFileName = ts.combinePaths(searchPath, "tsconfig.json"); + if (this.host.fileExists(tsconfigFileName)) { + return tsconfigFileName; + } + var jsconfigFileName = ts.combinePaths(searchPath, "jsconfig.json"); + if (this.host.fileExists(jsconfigFileName)) { + return jsconfigFileName; + } + var parentPath = ts.getDirectoryPath(searchPath); + if (parentPath === searchPath) { + break; + } + searchPath = parentPath; + } + return undefined; + }; + ProjectService.prototype.openClientFile = function (fileName, fileContent, scriptKind) { + var _a = this.openOrUpdateConfiguredProjectForFile(fileName), configFileName = _a.configFileName, configFileErrors = _a.configFileErrors; + var info = this.openFile(fileName, true, fileContent, scriptKind); + this.addOpenFile(info); + this.printProjects(); + return { configFileName: configFileName, configFileErrors: configFileErrors }; + }; + ProjectService.prototype.openOrUpdateConfiguredProjectForFile = function (fileName) { + var searchPath = ts.normalizePath(ts.getDirectoryPath(fileName)); + this.log("Search path: " + searchPath, "Info"); + var configFileName = this.findConfigFile(searchPath); + if (configFileName) { + this.log("Config file name: " + configFileName, "Info"); + var project = this.findConfiguredProjectByConfigFile(configFileName); + if (!project) { + var configResult = this.openConfigFile(configFileName, fileName); + if (!configResult.success) { + return { configFileName: configFileName, configFileErrors: configResult.errors }; + } + else { + this.log("Opened configuration file " + configFileName, "Info"); + this.configuredProjects.push(configResult.project); + if (configResult.errors && configResult.errors.length > 0) { + return { configFileName: configFileName, configFileErrors: configResult.errors }; + } + } + } + else { + this.updateConfiguredProject(project); + } + } + else { + this.log("No config files found."); + } + return {}; + }; + ProjectService.prototype.closeClientFile = function (filename) { + var info = ts.lookUp(this.filenameToScriptInfo, filename); + if (info) { + this.closeOpenFile(info); + info.isOpen = false; + } + this.printProjects(); + }; + ProjectService.prototype.getProjectForFile = function (filename) { + var scriptInfo = ts.lookUp(this.filenameToScriptInfo, filename); + if (scriptInfo) { + return scriptInfo.defaultProject; + } + }; + ProjectService.prototype.printProjectsForFile = function (filename) { + var scriptInfo = ts.lookUp(this.filenameToScriptInfo, filename); + if (scriptInfo) { + this.psLogger.startGroup(); + this.psLogger.info("Projects for " + filename); + var projects = this.findReferencingProjects(scriptInfo); + for (var i = 0, len = projects.length; i < len; i++) { + this.psLogger.info("Project " + i.toString()); + } + this.psLogger.endGroup(); + } + else { + this.psLogger.info(filename + " not in any project"); + } + }; + ProjectService.prototype.printProjects = function () { + if (!this.psLogger.isVerbose()) { + return; + } + this.psLogger.startGroup(); + for (var i = 0, len = this.inferredProjects.length; i < len; i++) { + var project = this.inferredProjects[i]; + project.updateGraph(); + this.psLogger.info("Project " + i.toString()); + this.psLogger.info(project.filesToString()); + this.psLogger.info("-----------------------------------------------"); + } + for (var i = 0, len = this.configuredProjects.length; i < len; i++) { + var project = this.configuredProjects[i]; + project.updateGraph(); + this.psLogger.info("Project (configured) " + (i + this.inferredProjects.length).toString()); + this.psLogger.info(project.filesToString()); + this.psLogger.info("-----------------------------------------------"); + } + this.psLogger.info("Open file roots of inferred projects: "); + for (var i = 0, len = this.openFileRoots.length; i < len; i++) { + this.psLogger.info(this.openFileRoots[i].fileName); + } + this.psLogger.info("Open files referenced by inferred or configured projects: "); + for (var i = 0, len = this.openFilesReferenced.length; i < len; i++) { + var fileInfo = this.openFilesReferenced[i].fileName; + if (this.openFilesReferenced[i].defaultProject.isConfiguredProject()) { + fileInfo += " (configured)"; + } + this.psLogger.info(fileInfo); + } + this.psLogger.info("Open file roots of configured projects: "); + for (var i = 0, len = this.openFileRootsConfigured.length; i < len; i++) { + this.psLogger.info(this.openFileRootsConfigured[i].fileName); + } + this.psLogger.endGroup(); + }; + ProjectService.prototype.configProjectIsActive = function (fileName) { + return this.findConfiguredProjectByConfigFile(fileName) === undefined; + }; + ProjectService.prototype.findConfiguredProjectByConfigFile = function (configFileName) { + for (var i = 0, len = this.configuredProjects.length; i < len; i++) { + if (this.configuredProjects[i].projectFilename == configFileName) { + return this.configuredProjects[i]; + } + } + return undefined; + }; + ProjectService.prototype.configFileToProjectOptions = function (configFilename) { + configFilename = ts.normalizePath(configFilename); + var dirPath = ts.getDirectoryPath(configFilename); + var contents = this.host.readFile(configFilename); + var rawConfig = ts.parseConfigFileTextToJson(configFilename, contents); + if (rawConfig.error) { + return { succeeded: false, errors: [rawConfig.error] }; + } + else { + var parsedCommandLine = ts.parseJsonConfigFileContent(rawConfig.config, this.host, dirPath, {}, configFilename); + ts.Debug.assert(!!parsedCommandLine.fileNames); + if (parsedCommandLine.errors && (parsedCommandLine.errors.length > 0)) { + return { succeeded: false, errors: parsedCommandLine.errors }; + } + else if (parsedCommandLine.fileNames.length === 0) { + var error = ts.createCompilerDiagnostic(ts.Diagnostics.The_config_file_0_found_doesn_t_contain_any_source_files, configFilename); + return { succeeded: false, errors: [error] }; + } + else { + var projectOptions = { + files: parsedCommandLine.fileNames, + compilerOptions: parsedCommandLine.options + }; + return { succeeded: true, projectOptions: projectOptions }; + } + } + }; + ProjectService.prototype.openConfigFile = function (configFilename, clientFileName) { + var _this = this; + var _a = this.configFileToProjectOptions(configFilename), succeeded = _a.succeeded, projectOptions = _a.projectOptions, errors = _a.errors; + if (!succeeded) { + return { success: false, errors: errors }; + } + else { + var project_1 = this.createProject(configFilename, projectOptions); + var errors_1; + for (var _i = 0, _b = projectOptions.files; _i < _b.length; _i++) { + var rootFilename = _b[_i]; + if (this.host.fileExists(rootFilename)) { + var info = this.openFile(rootFilename, clientFileName == rootFilename); + project_1.addRoot(info); + } + else { + (errors_1 || (errors_1 = [])).push(ts.createCompilerDiagnostic(ts.Diagnostics.File_0_not_found, rootFilename)); + } + } + project_1.finishGraph(); + project_1.projectFileWatcher = this.host.watchFile(configFilename, function (_) { return _this.watchedProjectConfigFileChanged(project_1); }); + this.log("Add recursive watcher for: " + ts.getDirectoryPath(configFilename)); + project_1.directoryWatcher = this.host.watchDirectory(ts.getDirectoryPath(configFilename), function (path) { return _this.directoryWatchedForSourceFilesChanged(project_1, path); }, true); + return { success: true, project: project_1, errors: errors_1 }; + } + }; + ProjectService.prototype.updateConfiguredProject = function (project) { + var _this = this; + if (!this.host.fileExists(project.projectFilename)) { + this.log("Config file deleted"); + this.removeProject(project); + } + else { + var _a = this.configFileToProjectOptions(project.projectFilename), succeeded = _a.succeeded, projectOptions = _a.projectOptions, errors = _a.errors; + if (!succeeded) { + return errors; + } + else { + var oldFileNames_1 = project.compilerService.host.roots.map(function (info) { return info.fileName; }); + var newFileNames_1 = ts.filter(projectOptions.files, function (f) { return _this.host.fileExists(f); }); + var fileNamesToRemove = oldFileNames_1.filter(function (f) { return newFileNames_1.indexOf(f) < 0; }); + var fileNamesToAdd = newFileNames_1.filter(function (f) { return oldFileNames_1.indexOf(f) < 0; }); + for (var _i = 0, fileNamesToRemove_1 = fileNamesToRemove; _i < fileNamesToRemove_1.length; _i++) { + var fileName = fileNamesToRemove_1[_i]; + var info = this.getScriptInfo(fileName); + if (info) { + project.removeRoot(info); + } + } + for (var _b = 0, fileNamesToAdd_1 = fileNamesToAdd; _b < fileNamesToAdd_1.length; _b++) { + var fileName = fileNamesToAdd_1[_b]; + var info = this.getScriptInfo(fileName); + if (!info) { + info = this.openFile(fileName, false); + } + else { + if (info.isOpen) { + if (this.openFileRoots.indexOf(info) >= 0) { + this.openFileRoots = copyListRemovingItem(info, this.openFileRoots); + if (info.defaultProject && !info.defaultProject.isConfiguredProject()) { + this.removeProject(info.defaultProject); + } + } + if (this.openFilesReferenced.indexOf(info) >= 0) { + this.openFilesReferenced = copyListRemovingItem(info, this.openFilesReferenced); + } + this.openFileRootsConfigured.push(info); + info.defaultProject = project; + } + } + project.addRoot(info); + } + project.setProjectOptions(projectOptions); + project.finishGraph(); + } + } + }; + ProjectService.prototype.createProject = function (projectFilename, projectOptions) { + var project = new Project(this, projectOptions); + project.projectFilename = projectFilename; + return project; + }; + return ProjectService; + }()); + server.ProjectService = ProjectService; + var CompilerService = (function () { + function CompilerService(project, opt) { + this.project = project; + this.documentRegistry = ts.createDocumentRegistry(); + this.host = new LSHost(project.projectService.host, project); + if (opt) { + this.setCompilerOptions(opt); + } + else { + var defaultOpts = ts.getDefaultCompilerOptions(); + defaultOpts.allowNonTsExtensions = true; + defaultOpts.allowJs = true; + this.setCompilerOptions(defaultOpts); + } + this.languageService = ts.createLanguageService(this.host, this.documentRegistry); + this.classifier = ts.createClassifier(); + } + CompilerService.prototype.setCompilerOptions = function (opt) { + this.settings = opt; + this.host.setCompilationSettings(opt); + }; + CompilerService.prototype.isExternalModule = function (filename) { + var sourceFile = this.languageService.getNonBoundSourceFile(filename); + return ts.isExternalModule(sourceFile); + }; + CompilerService.getDefaultFormatCodeOptions = function (host) { + return ts.clone({ + IndentSize: 4, + TabSize: 4, + NewLineCharacter: host.newLine || "\n", + ConvertTabsToSpaces: true, + IndentStyle: ts.IndentStyle.Smart, + InsertSpaceAfterCommaDelimiter: true, + InsertSpaceAfterSemicolonInForStatements: true, + InsertSpaceBeforeAndAfterBinaryOperators: true, + InsertSpaceAfterKeywordsInControlFlowStatements: true, + InsertSpaceAfterFunctionKeywordForAnonymousFunctions: false, + InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: false, + InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: false, + InsertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: false, + PlaceOpenBraceOnNewLineForFunctions: false, + PlaceOpenBraceOnNewLineForControlBlocks: false + }); + }; + return CompilerService; + }()); + server.CompilerService = CompilerService; + (function (CharRangeSection) { + CharRangeSection[CharRangeSection["PreStart"] = 0] = "PreStart"; + CharRangeSection[CharRangeSection["Start"] = 1] = "Start"; + CharRangeSection[CharRangeSection["Entire"] = 2] = "Entire"; + CharRangeSection[CharRangeSection["Mid"] = 3] = "Mid"; + CharRangeSection[CharRangeSection["End"] = 4] = "End"; + CharRangeSection[CharRangeSection["PostEnd"] = 5] = "PostEnd"; + })(server.CharRangeSection || (server.CharRangeSection = {})); + var CharRangeSection = server.CharRangeSection; + var BaseLineIndexWalker = (function () { + function BaseLineIndexWalker() { + this.goSubtree = true; + this.done = false; + } + BaseLineIndexWalker.prototype.leaf = function (rangeStart, rangeLength, ll) { + }; + return BaseLineIndexWalker; + }()); + var EditWalker = (function (_super) { + __extends(EditWalker, _super); + function EditWalker() { + _super.call(this); + this.lineIndex = new LineIndex(); + this.endBranch = []; + this.state = CharRangeSection.Entire; + this.initialText = ""; + this.trailingText = ""; + this.suppressTrailingText = false; + this.lineIndex.root = new LineNode(); + this.startPath = [this.lineIndex.root]; + this.stack = [this.lineIndex.root]; + } + EditWalker.prototype.insertLines = function (insertedText) { + if (this.suppressTrailingText) { + this.trailingText = ""; + } + if (insertedText) { + insertedText = this.initialText + insertedText + this.trailingText; + } + else { + insertedText = this.initialText + this.trailingText; + } + var lm = LineIndex.linesFromText(insertedText); + var lines = lm.lines; + if (lines.length > 1) { + if (lines[lines.length - 1] == "") { + lines.length--; + } + } + var branchParent; + var lastZeroCount; + for (var k = this.endBranch.length - 1; k >= 0; k--) { + this.endBranch[k].updateCounts(); + if (this.endBranch[k].charCount() === 0) { + lastZeroCount = this.endBranch[k]; + if (k > 0) { + branchParent = this.endBranch[k - 1]; + } + else { + branchParent = this.branchNode; + } + } + } + if (lastZeroCount) { + branchParent.remove(lastZeroCount); + } + var insertionNode = this.startPath[this.startPath.length - 2]; + var leafNode = this.startPath[this.startPath.length - 1]; + var len = lines.length; + if (len > 0) { + leafNode.text = lines[0]; + if (len > 1) { + var insertedNodes = new Array(len - 1); + var startNode = leafNode; + for (var i = 1, len_1 = lines.length; i < len_1; i++) { + insertedNodes[i - 1] = new LineLeaf(lines[i]); + } + var pathIndex = this.startPath.length - 2; + while (pathIndex >= 0) { + insertionNode = this.startPath[pathIndex]; + insertedNodes = insertionNode.insertAt(startNode, insertedNodes); + pathIndex--; + startNode = insertionNode; + } + var insertedNodesLen = insertedNodes.length; + while (insertedNodesLen > 0) { + var newRoot = new LineNode(); + newRoot.add(this.lineIndex.root); + insertedNodes = newRoot.insertAt(this.lineIndex.root, insertedNodes); + insertedNodesLen = insertedNodes.length; + this.lineIndex.root = newRoot; + } + this.lineIndex.root.updateCounts(); + } + else { + for (var j = this.startPath.length - 2; j >= 0; j--) { + this.startPath[j].updateCounts(); + } + } + } + else { + insertionNode.remove(leafNode); + for (var j = this.startPath.length - 2; j >= 0; j--) { + this.startPath[j].updateCounts(); + } + } + return this.lineIndex; + }; + EditWalker.prototype.post = function (relativeStart, relativeLength, lineCollection, parent, nodeType) { + if (lineCollection === this.lineCollectionAtBranch) { + this.state = CharRangeSection.End; + } + this.stack.length--; + return undefined; + }; + EditWalker.prototype.pre = function (relativeStart, relativeLength, lineCollection, parent, nodeType) { + var currentNode = this.stack[this.stack.length - 1]; + if ((this.state === CharRangeSection.Entire) && (nodeType === CharRangeSection.Start)) { + this.state = CharRangeSection.Start; + this.branchNode = currentNode; + this.lineCollectionAtBranch = lineCollection; + } + var child; + function fresh(node) { + if (node.isLeaf()) { + return new LineLeaf(""); + } + else + return new LineNode(); + } + switch (nodeType) { + case CharRangeSection.PreStart: + this.goSubtree = false; + if (this.state !== CharRangeSection.End) { + currentNode.add(lineCollection); + } + break; + case CharRangeSection.Start: + if (this.state === CharRangeSection.End) { + this.goSubtree = false; + } + else { + child = fresh(lineCollection); + currentNode.add(child); + this.startPath[this.startPath.length] = child; + } + break; + case CharRangeSection.Entire: + if (this.state !== CharRangeSection.End) { + child = fresh(lineCollection); + currentNode.add(child); + this.startPath[this.startPath.length] = child; + } + else { + if (!lineCollection.isLeaf()) { + child = fresh(lineCollection); + currentNode.add(child); + this.endBranch[this.endBranch.length] = child; + } + } + break; + case CharRangeSection.Mid: + this.goSubtree = false; + break; + case CharRangeSection.End: + if (this.state !== CharRangeSection.End) { + this.goSubtree = false; + } + else { + if (!lineCollection.isLeaf()) { + child = fresh(lineCollection); + currentNode.add(child); + this.endBranch[this.endBranch.length] = child; + } + } + break; + case CharRangeSection.PostEnd: + this.goSubtree = false; + if (this.state !== CharRangeSection.Start) { + currentNode.add(lineCollection); + } + break; + } + if (this.goSubtree) { + this.stack[this.stack.length] = child; + } + return lineCollection; + }; + EditWalker.prototype.leaf = function (relativeStart, relativeLength, ll) { + if (this.state === CharRangeSection.Start) { + this.initialText = ll.text.substring(0, relativeStart); + } + else if (this.state === CharRangeSection.Entire) { + this.initialText = ll.text.substring(0, relativeStart); + this.trailingText = ll.text.substring(relativeStart + relativeLength); + } + else { + this.trailingText = ll.text.substring(relativeStart + relativeLength); + } + }; + return EditWalker; + }(BaseLineIndexWalker)); + var TextChange = (function () { + function TextChange(pos, deleteLen, insertedText) { + this.pos = pos; + this.deleteLen = deleteLen; + this.insertedText = insertedText; + } + TextChange.prototype.getTextChangeRange = function () { + return ts.createTextChangeRange(ts.createTextSpan(this.pos, this.deleteLen), this.insertedText ? this.insertedText.length : 0); + }; + return TextChange; + }()); + server.TextChange = TextChange; + var ScriptVersionCache = (function () { + function ScriptVersionCache() { + this.changes = []; + this.versions = []; + this.minVersion = 0; + this.currentVersion = 0; + } + ScriptVersionCache.prototype.edit = function (pos, deleteLen, insertedText) { + this.changes[this.changes.length] = new TextChange(pos, deleteLen, insertedText); + if ((this.changes.length > ScriptVersionCache.changeNumberThreshold) || + (deleteLen > ScriptVersionCache.changeLengthThreshold) || + (insertedText && (insertedText.length > ScriptVersionCache.changeLengthThreshold))) { + this.getSnapshot(); + } + }; + ScriptVersionCache.prototype.latest = function () { + return this.versions[this.currentVersion]; + }; + ScriptVersionCache.prototype.latestVersion = function () { + if (this.changes.length > 0) { + this.getSnapshot(); + } + return this.currentVersion; + }; + ScriptVersionCache.prototype.reloadFromFile = function (filename, cb) { + var content = this.host.readFile(filename); + if (!content) { + content = ""; + } + this.reload(content); + if (cb) + cb(); + }; + ScriptVersionCache.prototype.reload = function (script) { + this.currentVersion++; + this.changes = []; + var snap = new LineIndexSnapshot(this.currentVersion, this); + this.versions[this.currentVersion] = snap; + snap.index = new LineIndex(); + var lm = LineIndex.linesFromText(script); + snap.index.load(lm.lines); + for (var i = this.minVersion; i < this.currentVersion; i++) { + this.versions[i] = undefined; + } + this.minVersion = this.currentVersion; + }; + ScriptVersionCache.prototype.getSnapshot = function () { + var snap = this.versions[this.currentVersion]; + if (this.changes.length > 0) { + var snapIndex = this.latest().index; + for (var i = 0, len = this.changes.length; i < len; i++) { + var change = this.changes[i]; + snapIndex = snapIndex.edit(change.pos, change.deleteLen, change.insertedText); + } + snap = new LineIndexSnapshot(this.currentVersion + 1, this); + snap.index = snapIndex; + snap.changesSincePreviousVersion = this.changes; + this.currentVersion = snap.version; + this.versions[snap.version] = snap; + this.changes = []; + if ((this.currentVersion - this.minVersion) >= ScriptVersionCache.maxVersions) { + var oldMin = this.minVersion; + this.minVersion = (this.currentVersion - ScriptVersionCache.maxVersions) + 1; + for (var j = oldMin; j < this.minVersion; j++) { + this.versions[j] = undefined; + } + } + } + return snap; + }; + ScriptVersionCache.prototype.getTextChangesBetweenVersions = function (oldVersion, newVersion) { + if (oldVersion < newVersion) { + if (oldVersion >= this.minVersion) { + var textChangeRanges = []; + for (var i = oldVersion + 1; i <= newVersion; i++) { + var snap = this.versions[i]; + for (var j = 0, len = snap.changesSincePreviousVersion.length; j < len; j++) { + var textChange = snap.changesSincePreviousVersion[j]; + textChangeRanges[textChangeRanges.length] = textChange.getTextChangeRange(); + } + } + return ts.collapseTextChangeRangesAcrossMultipleVersions(textChangeRanges); + } + else { + return undefined; + } + } + else { + return ts.unchangedTextChangeRange; + } + }; + ScriptVersionCache.fromString = function (host, script) { + var svc = new ScriptVersionCache(); + var snap = new LineIndexSnapshot(0, svc); + svc.versions[svc.currentVersion] = snap; + svc.host = host; + snap.index = new LineIndex(); + var lm = LineIndex.linesFromText(script); + snap.index.load(lm.lines); + return svc; + }; + ScriptVersionCache.changeNumberThreshold = 8; + ScriptVersionCache.changeLengthThreshold = 256; + ScriptVersionCache.maxVersions = 8; + return ScriptVersionCache; + }()); + server.ScriptVersionCache = ScriptVersionCache; + var LineIndexSnapshot = (function () { + function LineIndexSnapshot(version, cache) { + this.version = version; + this.cache = cache; + this.changesSincePreviousVersion = []; + } + LineIndexSnapshot.prototype.getText = function (rangeStart, rangeEnd) { + return this.index.getText(rangeStart, rangeEnd - rangeStart); + }; + LineIndexSnapshot.prototype.getLength = function () { + return this.index.root.charCount(); + }; + LineIndexSnapshot.prototype.getLineStartPositions = function () { + var starts = [-1]; + var count = 1; + var pos = 0; + this.index.every(function (ll, s, len) { + starts[count] = pos; + count++; + pos += ll.text.length; + return true; + }, 0); + return starts; + }; + LineIndexSnapshot.prototype.getLineMapper = function () { + var _this = this; + return function (line) { + return _this.index.lineNumberToInfo(line).offset; + }; + }; + LineIndexSnapshot.prototype.getTextChangeRangeSinceVersion = function (scriptVersion) { + if (this.version <= scriptVersion) { + return ts.unchangedTextChangeRange; + } + else { + return this.cache.getTextChangesBetweenVersions(scriptVersion, this.version); + } + }; + LineIndexSnapshot.prototype.getChangeRange = function (oldSnapshot) { + var oldSnap = oldSnapshot; + return this.getTextChangeRangeSinceVersion(oldSnap.version); + }; + return LineIndexSnapshot; + }()); + server.LineIndexSnapshot = LineIndexSnapshot; + var LineIndex = (function () { + function LineIndex() { + this.checkEdits = false; + } + LineIndex.prototype.charOffsetToLineNumberAndPos = function (charOffset) { + return this.root.charOffsetToLineNumberAndPos(1, charOffset); + }; + LineIndex.prototype.lineNumberToInfo = function (lineNumber) { + var lineCount = this.root.lineCount(); + if (lineNumber <= lineCount) { + var lineInfo = this.root.lineNumberToInfo(lineNumber, 0); + lineInfo.line = lineNumber; + return lineInfo; + } + else { + return { + line: lineNumber, + offset: this.root.charCount() + }; + } + }; + LineIndex.prototype.load = function (lines) { + if (lines.length > 0) { + var leaves = []; + for (var i = 0, len = lines.length; i < len; i++) { + leaves[i] = new LineLeaf(lines[i]); + } + this.root = LineIndex.buildTreeFromBottom(leaves); + } + else { + this.root = new LineNode(); + } + }; + LineIndex.prototype.walk = function (rangeStart, rangeLength, walkFns) { + this.root.walk(rangeStart, rangeLength, walkFns); + }; + LineIndex.prototype.getText = function (rangeStart, rangeLength) { + var accum = ""; + if ((rangeLength > 0) && (rangeStart < this.root.charCount())) { + this.walk(rangeStart, rangeLength, { + goSubtree: true, + done: false, + leaf: function (relativeStart, relativeLength, ll) { + accum = accum.concat(ll.text.substring(relativeStart, relativeStart + relativeLength)); + } + }); + } + return accum; + }; + LineIndex.prototype.getLength = function () { + return this.root.charCount(); + }; + LineIndex.prototype.every = function (f, rangeStart, rangeEnd) { + if (!rangeEnd) { + rangeEnd = this.root.charCount(); + } + var walkFns = { + goSubtree: true, + done: false, + leaf: function (relativeStart, relativeLength, ll) { + if (!f(ll, relativeStart, relativeLength)) { + this.done = true; + } + } + }; + this.walk(rangeStart, rangeEnd - rangeStart, walkFns); + return !walkFns.done; + }; + LineIndex.prototype.edit = function (pos, deleteLength, newText) { + function editFlat(source, s, dl, nt) { + if (nt === void 0) { nt = ""; } + return source.substring(0, s) + nt + source.substring(s + dl, source.length); + } + if (this.root.charCount() === 0) { + if (newText) { + this.load(LineIndex.linesFromText(newText).lines); + return this; + } + } + else { + var checkText = void 0; + if (this.checkEdits) { + checkText = editFlat(this.getText(0, this.root.charCount()), pos, deleteLength, newText); + } + var walker = new EditWalker(); + if (pos >= this.root.charCount()) { + pos = this.root.charCount() - 1; + var endString = this.getText(pos, 1); + if (newText) { + newText = endString + newText; + } + else { + newText = endString; + } + deleteLength = 0; + walker.suppressTrailingText = true; + } + else if (deleteLength > 0) { + var e = pos + deleteLength; + var lineInfo = this.charOffsetToLineNumberAndPos(e); + if ((lineInfo && (lineInfo.offset === 0))) { + deleteLength += lineInfo.text.length; + if (newText) { + newText = newText + lineInfo.text; + } + else { + newText = lineInfo.text; + } + } + } + if (pos < this.root.charCount()) { + this.root.walk(pos, deleteLength, walker); + walker.insertLines(newText); + } + if (this.checkEdits) { + var updatedText = this.getText(0, this.root.charCount()); + ts.Debug.assert(checkText == updatedText, "buffer edit mismatch"); + } + return walker.lineIndex; + } + }; + LineIndex.buildTreeFromBottom = function (nodes) { + var nodeCount = Math.ceil(nodes.length / lineCollectionCapacity); + var interiorNodes = []; + var nodeIndex = 0; + for (var i = 0; i < nodeCount; i++) { + interiorNodes[i] = new LineNode(); + var charCount = 0; + var lineCount = 0; + for (var j = 0; j < lineCollectionCapacity; j++) { + if (nodeIndex < nodes.length) { + interiorNodes[i].add(nodes[nodeIndex]); + charCount += nodes[nodeIndex].charCount(); + lineCount += nodes[nodeIndex].lineCount(); + } + else { + break; + } + nodeIndex++; + } + interiorNodes[i].totalChars = charCount; + interiorNodes[i].totalLines = lineCount; + } + if (interiorNodes.length === 1) { + return interiorNodes[0]; + } + else { + return this.buildTreeFromBottom(interiorNodes); + } + }; + LineIndex.linesFromText = function (text) { + var lineStarts = ts.computeLineStarts(text); + if (lineStarts.length === 0) { + return { lines: [], lineMap: lineStarts }; + } + var lines = new Array(lineStarts.length); + var lc = lineStarts.length - 1; + for (var lmi = 0; lmi < lc; lmi++) { + lines[lmi] = text.substring(lineStarts[lmi], lineStarts[lmi + 1]); + } + var endText = text.substring(lineStarts[lc]); + if (endText.length > 0) { + lines[lc] = endText; + } + else { + lines.length--; + } + return { lines: lines, lineMap: lineStarts }; + }; + return LineIndex; + }()); + server.LineIndex = LineIndex; + var LineNode = (function () { + function LineNode() { + this.totalChars = 0; + this.totalLines = 0; + this.children = []; + } + LineNode.prototype.isLeaf = function () { + return false; + }; + LineNode.prototype.updateCounts = function () { + this.totalChars = 0; + this.totalLines = 0; + for (var i = 0, len = this.children.length; i < len; i++) { + var child = this.children[i]; + this.totalChars += child.charCount(); + this.totalLines += child.lineCount(); + } + }; + LineNode.prototype.execWalk = function (rangeStart, rangeLength, walkFns, childIndex, nodeType) { + if (walkFns.pre) { + walkFns.pre(rangeStart, rangeLength, this.children[childIndex], this, nodeType); + } + if (walkFns.goSubtree) { + this.children[childIndex].walk(rangeStart, rangeLength, walkFns); + if (walkFns.post) { + walkFns.post(rangeStart, rangeLength, this.children[childIndex], this, nodeType); + } + } + else { + walkFns.goSubtree = true; + } + return walkFns.done; + }; + LineNode.prototype.skipChild = function (relativeStart, relativeLength, childIndex, walkFns, nodeType) { + if (walkFns.pre && (!walkFns.done)) { + walkFns.pre(relativeStart, relativeLength, this.children[childIndex], this, nodeType); + walkFns.goSubtree = true; + } + }; + LineNode.prototype.walk = function (rangeStart, rangeLength, walkFns) { + var childIndex = 0; + var child = this.children[0]; + var childCharCount = child.charCount(); + var adjustedStart = rangeStart; + while (adjustedStart >= childCharCount) { + this.skipChild(adjustedStart, rangeLength, childIndex, walkFns, CharRangeSection.PreStart); + adjustedStart -= childCharCount; + childIndex++; + child = this.children[childIndex]; + childCharCount = child.charCount(); + } + if ((adjustedStart + rangeLength) <= childCharCount) { + if (this.execWalk(adjustedStart, rangeLength, walkFns, childIndex, CharRangeSection.Entire)) { + return; + } + } + else { + if (this.execWalk(adjustedStart, childCharCount - adjustedStart, walkFns, childIndex, CharRangeSection.Start)) { + return; + } + var adjustedLength = rangeLength - (childCharCount - adjustedStart); + childIndex++; + child = this.children[childIndex]; + childCharCount = child.charCount(); + while (adjustedLength > childCharCount) { + if (this.execWalk(0, childCharCount, walkFns, childIndex, CharRangeSection.Mid)) { + return; + } + adjustedLength -= childCharCount; + childIndex++; + child = this.children[childIndex]; + childCharCount = child.charCount(); + } + if (adjustedLength > 0) { + if (this.execWalk(0, adjustedLength, walkFns, childIndex, CharRangeSection.End)) { + return; + } + } + } + if (walkFns.pre) { + var clen = this.children.length; + if (childIndex < (clen - 1)) { + for (var ej = childIndex + 1; ej < clen; ej++) { + this.skipChild(0, 0, ej, walkFns, CharRangeSection.PostEnd); + } + } + } + }; + LineNode.prototype.charOffsetToLineNumberAndPos = function (lineNumber, charOffset) { + var childInfo = this.childFromCharOffset(lineNumber, charOffset); + if (!childInfo.child) { + return { + line: lineNumber, + offset: charOffset + }; + } + else if (childInfo.childIndex < this.children.length) { + if (childInfo.child.isLeaf()) { + return { + line: childInfo.lineNumber, + offset: childInfo.charOffset, + text: (childInfo.child).text, + leaf: (childInfo.child) + }; + } + else { + var lineNode = (childInfo.child); + return lineNode.charOffsetToLineNumberAndPos(childInfo.lineNumber, childInfo.charOffset); + } + } + else { + var lineInfo = this.lineNumberToInfo(this.lineCount(), 0); + return { line: this.lineCount(), offset: lineInfo.leaf.charCount() }; + } + }; + LineNode.prototype.lineNumberToInfo = function (lineNumber, charOffset) { + var childInfo = this.childFromLineNumber(lineNumber, charOffset); + if (!childInfo.child) { + return { + line: lineNumber, + offset: charOffset + }; + } + else if (childInfo.child.isLeaf()) { + return { + line: lineNumber, + offset: childInfo.charOffset, + text: (childInfo.child).text, + leaf: (childInfo.child) + }; + } + else { + var lineNode = (childInfo.child); + return lineNode.lineNumberToInfo(childInfo.relativeLineNumber, childInfo.charOffset); + } + }; + LineNode.prototype.childFromLineNumber = function (lineNumber, charOffset) { + var child; + var relativeLineNumber = lineNumber; + var i; + var len; + for (i = 0, len = this.children.length; i < len; i++) { + child = this.children[i]; + var childLineCount = child.lineCount(); + if (childLineCount >= relativeLineNumber) { + break; + } + else { + relativeLineNumber -= childLineCount; + charOffset += child.charCount(); + } + } + return { + child: child, + childIndex: i, + relativeLineNumber: relativeLineNumber, + charOffset: charOffset + }; + }; + LineNode.prototype.childFromCharOffset = function (lineNumber, charOffset) { + var child; + var i; + var len; + for (i = 0, len = this.children.length; i < len; i++) { + child = this.children[i]; + if (child.charCount() > charOffset) { + break; + } + else { + charOffset -= child.charCount(); + lineNumber += child.lineCount(); + } + } + return { + child: child, + childIndex: i, + charOffset: charOffset, + lineNumber: lineNumber + }; + }; + LineNode.prototype.splitAfter = function (childIndex) { + var splitNode; + var clen = this.children.length; + childIndex++; + var endLength = childIndex; + if (childIndex < clen) { + splitNode = new LineNode(); + while (childIndex < clen) { + splitNode.add(this.children[childIndex]); + childIndex++; + } + splitNode.updateCounts(); + } + this.children.length = endLength; + return splitNode; + }; + LineNode.prototype.remove = function (child) { + var childIndex = this.findChildIndex(child); + var clen = this.children.length; + if (childIndex < (clen - 1)) { + for (var i = childIndex; i < (clen - 1); i++) { + this.children[i] = this.children[i + 1]; + } + } + this.children.length--; + }; + LineNode.prototype.findChildIndex = function (child) { + var childIndex = 0; + var clen = this.children.length; + while ((this.children[childIndex] !== child) && (childIndex < clen)) + childIndex++; + return childIndex; + }; + LineNode.prototype.insertAt = function (child, nodes) { + var childIndex = this.findChildIndex(child); + var clen = this.children.length; + var nodeCount = nodes.length; + if ((clen < lineCollectionCapacity) && (childIndex === (clen - 1)) && (nodeCount === 1)) { + this.add(nodes[0]); + this.updateCounts(); + return []; + } + else { + var shiftNode = this.splitAfter(childIndex); + var nodeIndex = 0; + childIndex++; + while ((childIndex < lineCollectionCapacity) && (nodeIndex < nodeCount)) { + this.children[childIndex] = nodes[nodeIndex]; + childIndex++; + nodeIndex++; + } + var splitNodes = []; + var splitNodeCount = 0; + if (nodeIndex < nodeCount) { + splitNodeCount = Math.ceil((nodeCount - nodeIndex) / lineCollectionCapacity); + splitNodes = new Array(splitNodeCount); + var splitNodeIndex = 0; + for (var i = 0; i < splitNodeCount; i++) { + splitNodes[i] = new LineNode(); + } + var splitNode = splitNodes[0]; + while (nodeIndex < nodeCount) { + splitNode.add(nodes[nodeIndex]); + nodeIndex++; + if (splitNode.children.length === lineCollectionCapacity) { + splitNodeIndex++; + splitNode = splitNodes[splitNodeIndex]; + } + } + for (var i = splitNodes.length - 1; i >= 0; i--) { + if (splitNodes[i].children.length === 0) { + splitNodes.length--; + } + } + } + if (shiftNode) { + splitNodes[splitNodes.length] = shiftNode; + } + this.updateCounts(); + for (var i = 0; i < splitNodeCount; i++) { + splitNodes[i].updateCounts(); + } + return splitNodes; + } + }; + LineNode.prototype.add = function (collection) { + this.children[this.children.length] = collection; + return (this.children.length < lineCollectionCapacity); + }; + LineNode.prototype.charCount = function () { + return this.totalChars; + }; + LineNode.prototype.lineCount = function () { + return this.totalLines; + }; + return LineNode; + }()); + server.LineNode = LineNode; + var LineLeaf = (function () { + function LineLeaf(text) { + this.text = text; + } + LineLeaf.prototype.setUdata = function (data) { + this.udata = data; + }; + LineLeaf.prototype.getUdata = function () { + return this.udata; + }; + LineLeaf.prototype.isLeaf = function () { + return true; + }; + LineLeaf.prototype.walk = function (rangeStart, rangeLength, walkFns) { + walkFns.leaf(rangeStart, rangeLength, this); + }; + LineLeaf.prototype.charCount = function () { + return this.text.length; + }; + LineLeaf.prototype.lineCount = function () { + return 1; + }; + return LineLeaf; + }()); + server.LineLeaf = LineLeaf; + })(server = ts.server || (ts.server = {})); +})(ts || (ts = {})); +var debugObjectHost = this; +var ts; +(function (ts) { + function logInternalError(logger, err) { + if (logger) { + logger.log("*INTERNAL ERROR* - Exception in typescript services: " + err.message); + } + } + var ScriptSnapshotShimAdapter = (function () { + function ScriptSnapshotShimAdapter(scriptSnapshotShim) { + this.scriptSnapshotShim = scriptSnapshotShim; + } + ScriptSnapshotShimAdapter.prototype.getText = function (start, end) { + return this.scriptSnapshotShim.getText(start, end); + }; + ScriptSnapshotShimAdapter.prototype.getLength = function () { + return this.scriptSnapshotShim.getLength(); + }; + ScriptSnapshotShimAdapter.prototype.getChangeRange = function (oldSnapshot) { + var oldSnapshotShim = oldSnapshot; + var encoded = this.scriptSnapshotShim.getChangeRange(oldSnapshotShim.scriptSnapshotShim); + if (encoded == null) { + return null; + } + var decoded = JSON.parse(encoded); + return ts.createTextChangeRange(ts.createTextSpan(decoded.span.start, decoded.span.length), decoded.newLength); + }; + ScriptSnapshotShimAdapter.prototype.dispose = function () { + if ("dispose" in this.scriptSnapshotShim) { + this.scriptSnapshotShim.dispose(); + } + }; + return ScriptSnapshotShimAdapter; + }()); + var LanguageServiceShimHostAdapter = (function () { + function LanguageServiceShimHostAdapter(shimHost) { + var _this = this; + this.shimHost = shimHost; + this.loggingEnabled = false; + this.tracingEnabled = false; + if ("getModuleResolutionsForFile" in this.shimHost) { + this.resolveModuleNames = function (moduleNames, containingFile) { + var resolutionsInFile = JSON.parse(_this.shimHost.getModuleResolutionsForFile(containingFile)); + return ts.map(moduleNames, function (name) { + var result = ts.lookUp(resolutionsInFile, name); + return result ? { resolvedFileName: result } : undefined; + }); + }; + } + if ("directoryExists" in this.shimHost) { + this.directoryExists = function (directoryName) { return _this.shimHost.directoryExists(directoryName); }; + } + if ("getTypeReferenceDirectiveResolutionsForFile" in this.shimHost) { + this.resolveTypeReferenceDirectives = function (typeDirectiveNames, containingFile) { + var typeDirectivesForFile = JSON.parse(_this.shimHost.getTypeReferenceDirectiveResolutionsForFile(containingFile)); + return ts.map(typeDirectiveNames, function (name) { return ts.lookUp(typeDirectivesForFile, name); }); + }; + } + } + LanguageServiceShimHostAdapter.prototype.log = function (s) { + if (this.loggingEnabled) { + this.shimHost.log(s); + } + }; + LanguageServiceShimHostAdapter.prototype.trace = function (s) { + if (this.tracingEnabled) { + this.shimHost.trace(s); + } + }; + LanguageServiceShimHostAdapter.prototype.error = function (s) { + this.shimHost.error(s); + }; + LanguageServiceShimHostAdapter.prototype.getProjectVersion = function () { + if (!this.shimHost.getProjectVersion) { + return undefined; + } + return this.shimHost.getProjectVersion(); + }; + LanguageServiceShimHostAdapter.prototype.useCaseSensitiveFileNames = function () { + return this.shimHost.useCaseSensitiveFileNames ? this.shimHost.useCaseSensitiveFileNames() : false; + }; + LanguageServiceShimHostAdapter.prototype.getCompilationSettings = function () { + var settingsJson = this.shimHost.getCompilationSettings(); + if (settingsJson == null || settingsJson == "") { + throw Error("LanguageServiceShimHostAdapter.getCompilationSettings: empty compilationSettings"); + } + return JSON.parse(settingsJson); + }; + LanguageServiceShimHostAdapter.prototype.getScriptFileNames = function () { + var encoded = this.shimHost.getScriptFileNames(); + return this.files = JSON.parse(encoded); + }; + LanguageServiceShimHostAdapter.prototype.getScriptSnapshot = function (fileName) { + var scriptSnapshot = this.shimHost.getScriptSnapshot(fileName); + return scriptSnapshot && new ScriptSnapshotShimAdapter(scriptSnapshot); + }; + LanguageServiceShimHostAdapter.prototype.getScriptKind = function (fileName) { + if ("getScriptKind" in this.shimHost) { + return this.shimHost.getScriptKind(fileName); + } + else { + return 0; + } + }; + LanguageServiceShimHostAdapter.prototype.getScriptVersion = function (fileName) { + return this.shimHost.getScriptVersion(fileName); + }; + LanguageServiceShimHostAdapter.prototype.getLocalizedDiagnosticMessages = function () { + var diagnosticMessagesJson = this.shimHost.getLocalizedDiagnosticMessages(); + if (diagnosticMessagesJson == null || diagnosticMessagesJson == "") { + return null; + } + try { + return JSON.parse(diagnosticMessagesJson); + } + catch (e) { + this.log(e.description || "diagnosticMessages.generated.json has invalid JSON format"); + return null; + } + }; + LanguageServiceShimHostAdapter.prototype.getCancellationToken = function () { + var hostCancellationToken = this.shimHost.getCancellationToken(); + return new ThrottledCancellationToken(hostCancellationToken); + }; + LanguageServiceShimHostAdapter.prototype.getCurrentDirectory = function () { + return this.shimHost.getCurrentDirectory(); + }; + LanguageServiceShimHostAdapter.prototype.getDefaultLibFileName = function (options) { + return this.shimHost.getDefaultLibFileName(JSON.stringify(options)); + }; + return LanguageServiceShimHostAdapter; + }()); + ts.LanguageServiceShimHostAdapter = LanguageServiceShimHostAdapter; + var ThrottledCancellationToken = (function () { + function ThrottledCancellationToken(hostCancellationToken) { + this.hostCancellationToken = hostCancellationToken; + this.lastCancellationCheckTime = 0; + } + ThrottledCancellationToken.prototype.isCancellationRequested = function () { + var time = Date.now(); + var duration = Math.abs(time - this.lastCancellationCheckTime); + if (duration > 10) { + this.lastCancellationCheckTime = time; + return this.hostCancellationToken.isCancellationRequested(); + } + return false; + }; + return ThrottledCancellationToken; + }()); + var CoreServicesShimHostAdapter = (function () { + function CoreServicesShimHostAdapter(shimHost) { + var _this = this; + this.shimHost = shimHost; + if ("directoryExists" in this.shimHost) { + this.directoryExists = function (directoryName) { return _this.shimHost.directoryExists(directoryName); }; + } + if ("realpath" in this.shimHost) { + this.realpath = function (path) { return _this.shimHost.realpath(path); }; + } + } + CoreServicesShimHostAdapter.prototype.readDirectory = function (rootDir, extension, exclude, depth) { + var encoded; + try { + encoded = this.shimHost.readDirectory(rootDir, extension, JSON.stringify(exclude), depth); + } + catch (e) { + encoded = this.shimHost.readDirectory(rootDir, extension, JSON.stringify(exclude)); + } + return JSON.parse(encoded); + }; + CoreServicesShimHostAdapter.prototype.fileExists = function (fileName) { + return this.shimHost.fileExists(fileName); + }; + CoreServicesShimHostAdapter.prototype.readFile = function (fileName) { + return this.shimHost.readFile(fileName); + }; + return CoreServicesShimHostAdapter; + }()); + ts.CoreServicesShimHostAdapter = CoreServicesShimHostAdapter; + function simpleForwardCall(logger, actionDescription, action, logPerformance) { + var start; + if (logPerformance) { + logger.log(actionDescription); + start = Date.now(); + } + var result = action(); + if (logPerformance) { + var end = Date.now(); + logger.log(actionDescription + " completed in " + (end - start) + " msec"); + if (typeof result === "string") { + var str = result; + if (str.length > 128) { + str = str.substring(0, 128) + "..."; + } + logger.log(" result.length=" + str.length + ", result='" + JSON.stringify(str) + "'"); + } + } + return result; + } + function forwardJSONCall(logger, actionDescription, action, logPerformance) { + try { + var result = simpleForwardCall(logger, actionDescription, action, logPerformance); + return JSON.stringify({ result: result }); + } + catch (err) { + if (err instanceof ts.OperationCanceledException) { + return JSON.stringify({ canceled: true }); + } + logInternalError(logger, err); + err.description = actionDescription; + return JSON.stringify({ error: err }); + } + } + var ShimBase = (function () { + function ShimBase(factory) { + this.factory = factory; + factory.registerShim(this); + } + ShimBase.prototype.dispose = function (dummy) { + this.factory.unregisterShim(this); + }; + return ShimBase; + }()); + function realizeDiagnostics(diagnostics, newLine) { + return diagnostics.map(function (d) { return realizeDiagnostic(d, newLine); }); + } + ts.realizeDiagnostics = realizeDiagnostics; + function realizeDiagnostic(diagnostic, newLine) { + return { + message: ts.flattenDiagnosticMessageText(diagnostic.messageText, newLine), + start: diagnostic.start, + length: diagnostic.length, + category: ts.DiagnosticCategory[diagnostic.category].toLowerCase(), + code: diagnostic.code + }; + } + var LanguageServiceShimObject = (function (_super) { + __extends(LanguageServiceShimObject, _super); + function LanguageServiceShimObject(factory, host, languageService) { + _super.call(this, factory); + this.host = host; + this.languageService = languageService; + this.logPerformance = false; + this.logger = this.host; + } + LanguageServiceShimObject.prototype.forwardJSONCall = function (actionDescription, action) { + return forwardJSONCall(this.logger, actionDescription, action, this.logPerformance); + }; + LanguageServiceShimObject.prototype.dispose = function (dummy) { + this.logger.log("dispose()"); + this.languageService.dispose(); + this.languageService = null; + if (debugObjectHost && debugObjectHost.CollectGarbage) { + debugObjectHost.CollectGarbage(); + this.logger.log("CollectGarbage()"); + } + this.logger = null; + _super.prototype.dispose.call(this, dummy); + }; + LanguageServiceShimObject.prototype.refresh = function (throwOnError) { + this.forwardJSONCall("refresh(" + throwOnError + ")", function () { return null; }); + }; + LanguageServiceShimObject.prototype.cleanupSemanticCache = function () { + var _this = this; + this.forwardJSONCall("cleanupSemanticCache()", function () { + _this.languageService.cleanupSemanticCache(); + return null; + }); + }; + LanguageServiceShimObject.prototype.realizeDiagnostics = function (diagnostics) { + var newLine = ts.getNewLineOrDefaultFromHost(this.host); + return ts.realizeDiagnostics(diagnostics, newLine); + }; + LanguageServiceShimObject.prototype.getSyntacticClassifications = function (fileName, start, length) { + var _this = this; + return this.forwardJSONCall("getSyntacticClassifications('" + fileName + "', " + start + ", " + length + ")", function () { return _this.languageService.getSyntacticClassifications(fileName, ts.createTextSpan(start, length)); }); + }; + LanguageServiceShimObject.prototype.getSemanticClassifications = function (fileName, start, length) { + var _this = this; + return this.forwardJSONCall("getSemanticClassifications('" + fileName + "', " + start + ", " + length + ")", function () { return _this.languageService.getSemanticClassifications(fileName, ts.createTextSpan(start, length)); }); + }; + LanguageServiceShimObject.prototype.getEncodedSyntacticClassifications = function (fileName, start, length) { + var _this = this; + return this.forwardJSONCall("getEncodedSyntacticClassifications('" + fileName + "', " + start + ", " + length + ")", function () { return convertClassifications(_this.languageService.getEncodedSyntacticClassifications(fileName, ts.createTextSpan(start, length))); }); + }; + LanguageServiceShimObject.prototype.getEncodedSemanticClassifications = function (fileName, start, length) { + var _this = this; + return this.forwardJSONCall("getEncodedSemanticClassifications('" + fileName + "', " + start + ", " + length + ")", function () { return convertClassifications(_this.languageService.getEncodedSemanticClassifications(fileName, ts.createTextSpan(start, length))); }); + }; + LanguageServiceShimObject.prototype.getSyntacticDiagnostics = function (fileName) { + var _this = this; + return this.forwardJSONCall("getSyntacticDiagnostics('" + fileName + "')", function () { + var diagnostics = _this.languageService.getSyntacticDiagnostics(fileName); + return _this.realizeDiagnostics(diagnostics); + }); + }; + LanguageServiceShimObject.prototype.getSemanticDiagnostics = function (fileName) { + var _this = this; + return this.forwardJSONCall("getSemanticDiagnostics('" + fileName + "')", function () { + var diagnostics = _this.languageService.getSemanticDiagnostics(fileName); + return _this.realizeDiagnostics(diagnostics); + }); + }; + LanguageServiceShimObject.prototype.getCompilerOptionsDiagnostics = function () { + var _this = this; + return this.forwardJSONCall("getCompilerOptionsDiagnostics()", function () { + var diagnostics = _this.languageService.getCompilerOptionsDiagnostics(); + return _this.realizeDiagnostics(diagnostics); + }); + }; + LanguageServiceShimObject.prototype.getQuickInfoAtPosition = function (fileName, position) { + var _this = this; + return this.forwardJSONCall("getQuickInfoAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getQuickInfoAtPosition(fileName, position); }); + }; + LanguageServiceShimObject.prototype.getNameOrDottedNameSpan = function (fileName, startPos, endPos) { + var _this = this; + return this.forwardJSONCall("getNameOrDottedNameSpan('" + fileName + "', " + startPos + ", " + endPos + ")", function () { return _this.languageService.getNameOrDottedNameSpan(fileName, startPos, endPos); }); + }; + LanguageServiceShimObject.prototype.getBreakpointStatementAtPosition = function (fileName, position) { + var _this = this; + return this.forwardJSONCall("getBreakpointStatementAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getBreakpointStatementAtPosition(fileName, position); }); + }; + LanguageServiceShimObject.prototype.getSignatureHelpItems = function (fileName, position) { + var _this = this; + return this.forwardJSONCall("getSignatureHelpItems('" + fileName + "', " + position + ")", function () { return _this.languageService.getSignatureHelpItems(fileName, position); }); + }; + LanguageServiceShimObject.prototype.getDefinitionAtPosition = function (fileName, position) { + var _this = this; + return this.forwardJSONCall("getDefinitionAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getDefinitionAtPosition(fileName, position); }); + }; + LanguageServiceShimObject.prototype.getTypeDefinitionAtPosition = function (fileName, position) { + var _this = this; + return this.forwardJSONCall("getTypeDefinitionAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getTypeDefinitionAtPosition(fileName, position); }); + }; + LanguageServiceShimObject.prototype.getRenameInfo = function (fileName, position) { + var _this = this; + return this.forwardJSONCall("getRenameInfo('" + fileName + "', " + position + ")", function () { return _this.languageService.getRenameInfo(fileName, position); }); + }; + LanguageServiceShimObject.prototype.findRenameLocations = function (fileName, position, findInStrings, findInComments) { + var _this = this; + return this.forwardJSONCall("findRenameLocations('" + fileName + "', " + position + ", " + findInStrings + ", " + findInComments + ")", function () { return _this.languageService.findRenameLocations(fileName, position, findInStrings, findInComments); }); + }; + LanguageServiceShimObject.prototype.getBraceMatchingAtPosition = function (fileName, position) { + var _this = this; + return this.forwardJSONCall("getBraceMatchingAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getBraceMatchingAtPosition(fileName, position); }); + }; + LanguageServiceShimObject.prototype.isValidBraceCompletionAtPostion = function (fileName, position, openingBrace) { + var _this = this; + return this.forwardJSONCall("isValidBraceCompletionAtPostion('" + fileName + "', " + position + ", " + openingBrace + ")", function () { return _this.languageService.isValidBraceCompletionAtPostion(fileName, position, openingBrace); }); + }; + LanguageServiceShimObject.prototype.getIndentationAtPosition = function (fileName, position, options) { + var _this = this; + return this.forwardJSONCall("getIndentationAtPosition('" + fileName + "', " + position + ")", function () { + var localOptions = JSON.parse(options); + return _this.languageService.getIndentationAtPosition(fileName, position, localOptions); + }); + }; + LanguageServiceShimObject.prototype.getReferencesAtPosition = function (fileName, position) { + var _this = this; + return this.forwardJSONCall("getReferencesAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getReferencesAtPosition(fileName, position); }); + }; + LanguageServiceShimObject.prototype.findReferences = function (fileName, position) { + var _this = this; + return this.forwardJSONCall("findReferences('" + fileName + "', " + position + ")", function () { return _this.languageService.findReferences(fileName, position); }); + }; + LanguageServiceShimObject.prototype.getOccurrencesAtPosition = function (fileName, position) { + var _this = this; + return this.forwardJSONCall("getOccurrencesAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getOccurrencesAtPosition(fileName, position); }); + }; + LanguageServiceShimObject.prototype.getDocumentHighlights = function (fileName, position, filesToSearch) { + var _this = this; + return this.forwardJSONCall("getDocumentHighlights('" + fileName + "', " + position + ")", function () { + var results = _this.languageService.getDocumentHighlights(fileName, position, JSON.parse(filesToSearch)); + var normalizedName = ts.normalizeSlashes(fileName).toLowerCase(); + return ts.filter(results, function (r) { return ts.normalizeSlashes(r.fileName).toLowerCase() === normalizedName; }); + }); + }; + LanguageServiceShimObject.prototype.getCompletionsAtPosition = function (fileName, position) { + var _this = this; + return this.forwardJSONCall("getCompletionsAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getCompletionsAtPosition(fileName, position); }); + }; + LanguageServiceShimObject.prototype.getCompletionEntryDetails = function (fileName, position, entryName) { + var _this = this; + return this.forwardJSONCall("getCompletionEntryDetails('" + fileName + "', " + position + ", '" + entryName + "')", function () { return _this.languageService.getCompletionEntryDetails(fileName, position, entryName); }); + }; + LanguageServiceShimObject.prototype.getFormattingEditsForRange = function (fileName, start, end, options) { + var _this = this; + return this.forwardJSONCall("getFormattingEditsForRange('" + fileName + "', " + start + ", " + end + ")", function () { + var localOptions = JSON.parse(options); + return _this.languageService.getFormattingEditsForRange(fileName, start, end, localOptions); + }); + }; + LanguageServiceShimObject.prototype.getFormattingEditsForDocument = function (fileName, options) { + var _this = this; + return this.forwardJSONCall("getFormattingEditsForDocument('" + fileName + "')", function () { + var localOptions = JSON.parse(options); + return _this.languageService.getFormattingEditsForDocument(fileName, localOptions); + }); + }; + LanguageServiceShimObject.prototype.getFormattingEditsAfterKeystroke = function (fileName, position, key, options) { + var _this = this; + return this.forwardJSONCall("getFormattingEditsAfterKeystroke('" + fileName + "', " + position + ", '" + key + "')", function () { + var localOptions = JSON.parse(options); + return _this.languageService.getFormattingEditsAfterKeystroke(fileName, position, key, localOptions); + }); + }; + LanguageServiceShimObject.prototype.getDocCommentTemplateAtPosition = function (fileName, position) { + var _this = this; + return this.forwardJSONCall("getDocCommentTemplateAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getDocCommentTemplateAtPosition(fileName, position); }); + }; + LanguageServiceShimObject.prototype.getNavigateToItems = function (searchValue, maxResultCount) { + var _this = this; + return this.forwardJSONCall("getNavigateToItems('" + searchValue + "', " + maxResultCount + ")", function () { return _this.languageService.getNavigateToItems(searchValue, maxResultCount); }); + }; + LanguageServiceShimObject.prototype.getNavigationBarItems = function (fileName) { + var _this = this; + return this.forwardJSONCall("getNavigationBarItems('" + fileName + "')", function () { return _this.languageService.getNavigationBarItems(fileName); }); + }; + LanguageServiceShimObject.prototype.getOutliningSpans = function (fileName) { + var _this = this; + return this.forwardJSONCall("getOutliningSpans('" + fileName + "')", function () { return _this.languageService.getOutliningSpans(fileName); }); + }; + LanguageServiceShimObject.prototype.getTodoComments = function (fileName, descriptors) { + var _this = this; + return this.forwardJSONCall("getTodoComments('" + fileName + "')", function () { return _this.languageService.getTodoComments(fileName, JSON.parse(descriptors)); }); + }; + LanguageServiceShimObject.prototype.getEmitOutput = function (fileName) { + var _this = this; + return this.forwardJSONCall("getEmitOutput('" + fileName + "')", function () { return _this.languageService.getEmitOutput(fileName); }); + }; + return LanguageServiceShimObject; + }(ShimBase)); + function convertClassifications(classifications) { + return { spans: classifications.spans.join(","), endOfLineState: classifications.endOfLineState }; + } + var ClassifierShimObject = (function (_super) { + __extends(ClassifierShimObject, _super); + function ClassifierShimObject(factory, logger) { + _super.call(this, factory); + this.logger = logger; + this.logPerformance = false; + this.classifier = ts.createClassifier(); + } + ClassifierShimObject.prototype.getEncodedLexicalClassifications = function (text, lexState, syntacticClassifierAbsent) { + var _this = this; + return forwardJSONCall(this.logger, "getEncodedLexicalClassifications", function () { return convertClassifications(_this.classifier.getEncodedLexicalClassifications(text, lexState, syntacticClassifierAbsent)); }, this.logPerformance); + }; + ClassifierShimObject.prototype.getClassificationsForLine = function (text, lexState, classifyKeywordsInGenerics) { + var classification = this.classifier.getClassificationsForLine(text, lexState, classifyKeywordsInGenerics); + var result = ""; + for (var _i = 0, _a = classification.entries; _i < _a.length; _i++) { + var item = _a[_i]; + result += item.length + "\n"; + result += item.classification + "\n"; + } + result += classification.finalLexState; + return result; + }; + return ClassifierShimObject; + }(ShimBase)); + var CoreServicesShimObject = (function (_super) { + __extends(CoreServicesShimObject, _super); + function CoreServicesShimObject(factory, logger, host) { + _super.call(this, factory); + this.logger = logger; + this.host = host; + this.logPerformance = false; + } + CoreServicesShimObject.prototype.forwardJSONCall = function (actionDescription, action) { + return forwardJSONCall(this.logger, actionDescription, action, this.logPerformance); + }; + CoreServicesShimObject.prototype.resolveModuleName = function (fileName, moduleName, compilerOptionsJson) { + var _this = this; + return this.forwardJSONCall("resolveModuleName('" + fileName + "')", function () { + var compilerOptions = JSON.parse(compilerOptionsJson); + var result = ts.resolveModuleName(moduleName, ts.normalizeSlashes(fileName), compilerOptions, _this.host); + return { + resolvedFileName: result.resolvedModule ? result.resolvedModule.resolvedFileName : undefined, + failedLookupLocations: result.failedLookupLocations + }; + }); + }; + CoreServicesShimObject.prototype.resolveTypeReferenceDirective = function (fileName, typeReferenceDirective, compilerOptionsJson) { + var _this = this; + return this.forwardJSONCall("resolveTypeReferenceDirective(" + fileName + ")", function () { + var compilerOptions = JSON.parse(compilerOptionsJson); + var result = ts.resolveTypeReferenceDirective(typeReferenceDirective, ts.normalizeSlashes(fileName), compilerOptions, _this.host); + return { + resolvedFileName: result.resolvedTypeReferenceDirective ? result.resolvedTypeReferenceDirective.resolvedFileName : undefined, + primary: result.resolvedTypeReferenceDirective ? result.resolvedTypeReferenceDirective.primary : true, + failedLookupLocations: result.failedLookupLocations + }; + }); + }; + CoreServicesShimObject.prototype.getPreProcessedFileInfo = function (fileName, sourceTextSnapshot) { + var _this = this; + return this.forwardJSONCall("getPreProcessedFileInfo('" + fileName + "')", function () { + var result = ts.preProcessFile(sourceTextSnapshot.getText(0, sourceTextSnapshot.getLength()), true, true); + return { + referencedFiles: _this.convertFileReferences(result.referencedFiles), + importedFiles: _this.convertFileReferences(result.importedFiles), + ambientExternalModules: result.ambientExternalModules, + isLibFile: result.isLibFile, + typeReferenceDirectives: _this.convertFileReferences(result.typeReferenceDirectives) + }; + }); + }; + CoreServicesShimObject.prototype.convertFileReferences = function (refs) { + if (!refs) { + return undefined; + } + var result = []; + for (var _i = 0, refs_2 = refs; _i < refs_2.length; _i++) { + var ref = refs_2[_i]; + result.push({ + path: ts.normalizeSlashes(ref.fileName), + position: ref.pos, + length: ref.end - ref.pos + }); + } + return result; + }; + CoreServicesShimObject.prototype.getTSConfigFileInfo = function (fileName, sourceTextSnapshot) { + var _this = this; + return this.forwardJSONCall("getTSConfigFileInfo('" + fileName + "')", function () { + var text = sourceTextSnapshot.getText(0, sourceTextSnapshot.getLength()); + var result = ts.parseConfigFileTextToJson(fileName, text); + if (result.error) { + return { + options: {}, + typingOptions: {}, + files: [], + raw: {}, + errors: [realizeDiagnostic(result.error, "\r\n")] + }; + } + var normalizedFileName = ts.normalizeSlashes(fileName); + var configFile = ts.parseJsonConfigFileContent(result.config, _this.host, ts.getDirectoryPath(normalizedFileName), {}, normalizedFileName); + return { + options: configFile.options, + typingOptions: configFile.typingOptions, + files: configFile.fileNames, + raw: configFile.raw, + errors: realizeDiagnostics(configFile.errors, "\r\n") + }; + }); + }; + CoreServicesShimObject.prototype.getDefaultCompilationSettings = function () { + return this.forwardJSONCall("getDefaultCompilationSettings()", function () { return ts.getDefaultCompilerOptions(); }); + }; + CoreServicesShimObject.prototype.discoverTypings = function (discoverTypingsJson) { + var _this = this; + var getCanonicalFileName = ts.createGetCanonicalFileName(false); + return this.forwardJSONCall("discoverTypings()", function () { + var info = JSON.parse(discoverTypingsJson); + return ts.JsTyping.discoverTypings(_this.host, info.fileNames, ts.toPath(info.projectRootPath, info.projectRootPath, getCanonicalFileName), ts.toPath(info.safeListPath, info.safeListPath, getCanonicalFileName), info.packageNameToTypingLocation, info.typingOptions, info.compilerOptions); + }); + }; + return CoreServicesShimObject; + }(ShimBase)); + var TypeScriptServicesFactory = (function () { + function TypeScriptServicesFactory() { + this._shims = []; + } + TypeScriptServicesFactory.prototype.getServicesVersion = function () { + return ts.servicesVersion; + }; + TypeScriptServicesFactory.prototype.createLanguageServiceShim = function (host) { + try { + if (this.documentRegistry === undefined) { + this.documentRegistry = ts.createDocumentRegistry(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames(), host.getCurrentDirectory()); + } + var hostAdapter = new LanguageServiceShimHostAdapter(host); + var languageService = ts.createLanguageService(hostAdapter, this.documentRegistry); + return new LanguageServiceShimObject(this, host, languageService); + } + catch (err) { + logInternalError(host, err); + throw err; + } + }; + TypeScriptServicesFactory.prototype.createClassifierShim = function (logger) { + try { + return new ClassifierShimObject(this, logger); + } + catch (err) { + logInternalError(logger, err); + throw err; + } + }; + TypeScriptServicesFactory.prototype.createCoreServicesShim = function (host) { + try { + var adapter = new CoreServicesShimHostAdapter(host); + return new CoreServicesShimObject(this, host, adapter); + } + catch (err) { + logInternalError(host, err); + throw err; + } + }; + TypeScriptServicesFactory.prototype.close = function () { + this._shims = []; + this.documentRegistry = undefined; + }; + TypeScriptServicesFactory.prototype.registerShim = function (shim) { + this._shims.push(shim); + }; + TypeScriptServicesFactory.prototype.unregisterShim = function (shim) { + for (var i = 0, n = this._shims.length; i < n; i++) { + if (this._shims[i] === shim) { + delete this._shims[i]; + return; + } + } + throw new Error("Invalid operation"); + }; + return TypeScriptServicesFactory; + }()); + ts.TypeScriptServicesFactory = TypeScriptServicesFactory; + if (typeof module !== "undefined" && module.exports) { + module.exports = ts; + } +})(ts || (ts = {})); +var TypeScript; +(function (TypeScript) { + var Services; + (function (Services) { + Services.TypeScriptServicesFactory = ts.TypeScriptServicesFactory; + })(Services = TypeScript.Services || (TypeScript.Services = {})); +})(TypeScript || (TypeScript = {})); +var toolsVersion = "1.9"; diff --git a/lib/typescript.d.ts b/lib/typescript.d.ts index 32a6dee4623..84a06001d14 100644 --- a/lib/typescript.d.ts +++ b/lib/typescript.d.ts @@ -160,166 +160,174 @@ declare namespace ts { IsKeyword = 124, ModuleKeyword = 125, NamespaceKeyword = 126, - RequireKeyword = 127, - NumberKeyword = 128, - SetKeyword = 129, - StringKeyword = 130, - SymbolKeyword = 131, - TypeKeyword = 132, - FromKeyword = 133, - OfKeyword = 134, - QualifiedName = 135, - ComputedPropertyName = 136, - TypeParameter = 137, - Parameter = 138, - Decorator = 139, - PropertySignature = 140, - PropertyDeclaration = 141, - MethodSignature = 142, - MethodDeclaration = 143, - Constructor = 144, - GetAccessor = 145, - SetAccessor = 146, - CallSignature = 147, - ConstructSignature = 148, - IndexSignature = 149, - TypePredicate = 150, - TypeReference = 151, - FunctionType = 152, - ConstructorType = 153, - TypeQuery = 154, - TypeLiteral = 155, - ArrayType = 156, - TupleType = 157, - UnionType = 158, - IntersectionType = 159, - ParenthesizedType = 160, - ObjectBindingPattern = 161, - ArrayBindingPattern = 162, - BindingElement = 163, - ArrayLiteralExpression = 164, - ObjectLiteralExpression = 165, - PropertyAccessExpression = 166, - ElementAccessExpression = 167, - CallExpression = 168, - NewExpression = 169, - TaggedTemplateExpression = 170, - TypeAssertionExpression = 171, - ParenthesizedExpression = 172, - FunctionExpression = 173, - ArrowFunction = 174, - DeleteExpression = 175, - TypeOfExpression = 176, - VoidExpression = 177, - AwaitExpression = 178, - PrefixUnaryExpression = 179, - PostfixUnaryExpression = 180, - BinaryExpression = 181, - ConditionalExpression = 182, - TemplateExpression = 183, - YieldExpression = 184, - SpreadElementExpression = 185, - ClassExpression = 186, - OmittedExpression = 187, - ExpressionWithTypeArguments = 188, - AsExpression = 189, - TemplateSpan = 190, - SemicolonClassElement = 191, - Block = 192, - VariableStatement = 193, - EmptyStatement = 194, - ExpressionStatement = 195, - IfStatement = 196, - DoStatement = 197, - WhileStatement = 198, - ForStatement = 199, - ForInStatement = 200, - ForOfStatement = 201, - ContinueStatement = 202, - BreakStatement = 203, - ReturnStatement = 204, - WithStatement = 205, - SwitchStatement = 206, - LabeledStatement = 207, - ThrowStatement = 208, - TryStatement = 209, - DebuggerStatement = 210, - VariableDeclaration = 211, - VariableDeclarationList = 212, - FunctionDeclaration = 213, - ClassDeclaration = 214, - InterfaceDeclaration = 215, - TypeAliasDeclaration = 216, - EnumDeclaration = 217, - ModuleDeclaration = 218, - ModuleBlock = 219, - CaseBlock = 220, - ImportEqualsDeclaration = 221, - ImportDeclaration = 222, - ImportClause = 223, - NamespaceImport = 224, - NamedImports = 225, - ImportSpecifier = 226, - ExportAssignment = 227, - ExportDeclaration = 228, - NamedExports = 229, - ExportSpecifier = 230, - MissingDeclaration = 231, - ExternalModuleReference = 232, - JsxElement = 233, - JsxSelfClosingElement = 234, - JsxOpeningElement = 235, - JsxText = 236, - JsxClosingElement = 237, - JsxAttribute = 238, - JsxSpreadAttribute = 239, - JsxExpression = 240, - CaseClause = 241, - DefaultClause = 242, - HeritageClause = 243, - CatchClause = 244, - PropertyAssignment = 245, - ShorthandPropertyAssignment = 246, - EnumMember = 247, - SourceFile = 248, - JSDocTypeExpression = 249, - JSDocAllType = 250, - JSDocUnknownType = 251, - JSDocArrayType = 252, - JSDocUnionType = 253, - JSDocTupleType = 254, - JSDocNullableType = 255, - JSDocNonNullableType = 256, - JSDocRecordType = 257, - JSDocRecordMember = 258, - JSDocTypeReference = 259, - JSDocOptionalType = 260, - JSDocFunctionType = 261, - JSDocVariadicType = 262, - JSDocConstructorType = 263, - JSDocThisType = 264, - JSDocComment = 265, - JSDocTag = 266, - JSDocParameterTag = 267, - JSDocReturnTag = 268, - JSDocTypeTag = 269, - JSDocTemplateTag = 270, - SyntaxList = 271, - Count = 272, + NeverKeyword = 127, + ReadonlyKeyword = 128, + RequireKeyword = 129, + NumberKeyword = 130, + SetKeyword = 131, + StringKeyword = 132, + SymbolKeyword = 133, + TypeKeyword = 134, + UndefinedKeyword = 135, + FromKeyword = 136, + GlobalKeyword = 137, + OfKeyword = 138, + QualifiedName = 139, + ComputedPropertyName = 140, + TypeParameter = 141, + Parameter = 142, + Decorator = 143, + PropertySignature = 144, + PropertyDeclaration = 145, + MethodSignature = 146, + MethodDeclaration = 147, + Constructor = 148, + GetAccessor = 149, + SetAccessor = 150, + CallSignature = 151, + ConstructSignature = 152, + IndexSignature = 153, + TypePredicate = 154, + TypeReference = 155, + FunctionType = 156, + ConstructorType = 157, + TypeQuery = 158, + TypeLiteral = 159, + ArrayType = 160, + TupleType = 161, + UnionType = 162, + IntersectionType = 163, + ParenthesizedType = 164, + ThisType = 165, + StringLiteralType = 166, + ObjectBindingPattern = 167, + ArrayBindingPattern = 168, + BindingElement = 169, + ArrayLiteralExpression = 170, + ObjectLiteralExpression = 171, + PropertyAccessExpression = 172, + ElementAccessExpression = 173, + CallExpression = 174, + NewExpression = 175, + TaggedTemplateExpression = 176, + TypeAssertionExpression = 177, + ParenthesizedExpression = 178, + FunctionExpression = 179, + ArrowFunction = 180, + DeleteExpression = 181, + TypeOfExpression = 182, + VoidExpression = 183, + AwaitExpression = 184, + PrefixUnaryExpression = 185, + PostfixUnaryExpression = 186, + BinaryExpression = 187, + ConditionalExpression = 188, + TemplateExpression = 189, + YieldExpression = 190, + SpreadElementExpression = 191, + ClassExpression = 192, + OmittedExpression = 193, + ExpressionWithTypeArguments = 194, + AsExpression = 195, + NonNullExpression = 196, + TemplateSpan = 197, + SemicolonClassElement = 198, + Block = 199, + VariableStatement = 200, + EmptyStatement = 201, + ExpressionStatement = 202, + IfStatement = 203, + DoStatement = 204, + WhileStatement = 205, + ForStatement = 206, + ForInStatement = 207, + ForOfStatement = 208, + ContinueStatement = 209, + BreakStatement = 210, + ReturnStatement = 211, + WithStatement = 212, + SwitchStatement = 213, + LabeledStatement = 214, + ThrowStatement = 215, + TryStatement = 216, + DebuggerStatement = 217, + VariableDeclaration = 218, + VariableDeclarationList = 219, + FunctionDeclaration = 220, + ClassDeclaration = 221, + InterfaceDeclaration = 222, + TypeAliasDeclaration = 223, + EnumDeclaration = 224, + ModuleDeclaration = 225, + ModuleBlock = 226, + CaseBlock = 227, + GlobalModuleExportDeclaration = 228, + ImportEqualsDeclaration = 229, + ImportDeclaration = 230, + ImportClause = 231, + NamespaceImport = 232, + NamedImports = 233, + ImportSpecifier = 234, + ExportAssignment = 235, + ExportDeclaration = 236, + NamedExports = 237, + ExportSpecifier = 238, + MissingDeclaration = 239, + ExternalModuleReference = 240, + JsxElement = 241, + JsxSelfClosingElement = 242, + JsxOpeningElement = 243, + JsxText = 244, + JsxClosingElement = 245, + JsxAttribute = 246, + JsxSpreadAttribute = 247, + JsxExpression = 248, + CaseClause = 249, + DefaultClause = 250, + HeritageClause = 251, + CatchClause = 252, + PropertyAssignment = 253, + ShorthandPropertyAssignment = 254, + EnumMember = 255, + SourceFile = 256, + JSDocTypeExpression = 257, + JSDocAllType = 258, + JSDocUnknownType = 259, + JSDocArrayType = 260, + JSDocUnionType = 261, + JSDocTupleType = 262, + JSDocNullableType = 263, + JSDocNonNullableType = 264, + JSDocRecordType = 265, + JSDocRecordMember = 266, + JSDocTypeReference = 267, + JSDocOptionalType = 268, + JSDocFunctionType = 269, + JSDocVariadicType = 270, + JSDocConstructorType = 271, + JSDocThisType = 272, + JSDocComment = 273, + JSDocTag = 274, + JSDocParameterTag = 275, + JSDocReturnTag = 276, + JSDocTypeTag = 277, + JSDocTemplateTag = 278, + SyntaxList = 279, + Count = 280, FirstAssignment = 56, LastAssignment = 68, FirstReservedWord = 70, LastReservedWord = 105, FirstKeyword = 70, - LastKeyword = 134, + LastKeyword = 138, FirstFutureReservedWord = 106, LastFutureReservedWord = 114, - FirstTypeNode = 151, - LastTypeNode = 160, + FirstTypeNode = 154, + LastTypeNode = 166, FirstPunctuation = 15, LastPunctuation = 68, FirstToken = 0, - LastToken = 134, + LastToken = 138, FirstTriviaToken = 2, LastTriviaToken = 7, FirstLiteralToken = 8, @@ -328,41 +336,56 @@ declare namespace ts { LastTemplateToken = 14, FirstBinaryOperator = 25, LastBinaryOperator = 68, - FirstNode = 135, + FirstNode = 139, } enum NodeFlags { None = 0, - Export = 2, - Ambient = 4, - Public = 8, - Private = 16, - Protected = 32, - Static = 64, + Export = 1, + Ambient = 2, + Public = 4, + Private = 8, + Protected = 16, + Static = 32, + Readonly = 64, Abstract = 128, Async = 256, Default = 512, - MultiLine = 1024, - Synthetic = 2048, - DeclarationFile = 4096, - Let = 8192, - Const = 16384, - OctalLiteral = 32768, - Namespace = 65536, - ExportContext = 131072, - ContainsThis = 262144, - HasImplicitReturn = 524288, - HasExplicitReturn = 1048576, - Modifier = 1022, - AccessibilityModifier = 56, - BlockScoped = 24576, - ReachabilityCheckFlags = 1572864, + Let = 1024, + Const = 2048, + Namespace = 4096, + ExportContext = 8192, + ContainsThis = 16384, + HasImplicitReturn = 32768, + HasExplicitReturn = 65536, + GlobalAugmentation = 131072, + HasClassExtends = 262144, + HasDecorators = 524288, + HasParamDecorators = 1048576, + HasAsyncFunctions = 2097152, + DisallowInContext = 4194304, + YieldContext = 8388608, + DecoratorContext = 16777216, + AwaitContext = 33554432, + ThisNodeHasError = 67108864, + JavaScriptFile = 134217728, + ThisNodeOrAnySubNodesHasError = 268435456, + HasAggregatedChildData = 536870912, + HasJsxSpreadAttribute = 1073741824, + Modifier = 1023, + AccessibilityModifier = 28, + ParameterPropertyModifier = 92, + BlockScoped = 3072, + ReachabilityCheckFlags = 98304, + EmitHelperFlags = 3932160, + ContextFlags = 197132288, + TypeExcludesFlags = 41943040, } 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, - ClassElement = 4, - UnknownElement = 8, IntrinsicElement = 3, } interface Node extends TextRange { @@ -375,9 +398,11 @@ declare namespace ts { interface NodeArray extends Array, TextRange { hasTrailingComma?: boolean; } - interface ModifiersArray extends NodeArray { + interface ModifiersArray extends NodeArray { flags: number; } + interface Modifier extends Node { + } interface Identifier extends PrimaryExpression { text: string; originalKeywordKind?: SyntaxKind; @@ -393,6 +418,9 @@ declare namespace ts { _declarationBrand: any; name?: DeclarationName; } + interface DeclarationStatement extends Declaration, Statement { + name?: Identifier; + } interface ComputedPropertyName extends Node { expression: Expression; } @@ -405,10 +433,15 @@ declare namespace ts { expression?: Expression; } interface SignatureDeclaration extends Declaration { + name?: PropertyName; typeParameters?: NodeArray; parameters: NodeArray; type?: TypeNode; } + interface CallSignatureDeclaration extends SignatureDeclaration, TypeElement { + } + interface ConstructSignatureDeclaration extends SignatureDeclaration, TypeElement { + } interface VariableDeclaration extends Declaration { parent?: VariableDeclarationList; name: Identifier | BindingPattern; @@ -431,18 +464,25 @@ declare namespace ts { name: Identifier | BindingPattern; initializer?: Expression; } - interface PropertyDeclaration extends Declaration, ClassElement { - name: DeclarationName; + interface PropertySignature extends TypeElement { + name: PropertyName; questionToken?: Node; type?: TypeNode; initializer?: Expression; } + interface PropertyDeclaration extends ClassElement { + questionToken?: Node; + name: PropertyName; + type?: TypeNode; + initializer?: Expression; + } interface ObjectLiteralElement extends Declaration { _objectLiteralBrandBrand: any; + name?: PropertyName; } interface PropertyAssignment extends ObjectLiteralElement { _propertyAssignmentBrand: any; - name: DeclarationName; + name: PropertyName; questionToken?: Node; initializer: Expression; } @@ -460,9 +500,16 @@ declare namespace ts { type?: TypeNode; initializer?: Expression; } + interface PropertyLikeDeclaration extends Declaration { + name: PropertyName; + } interface BindingPattern extends Node { elements: NodeArray; } + interface ObjectBindingPattern extends BindingPattern { + } + interface ArrayBindingPattern extends BindingPattern { + } /** * Several node kinds share function-like features such as a signature, * a name, and a body. These nodes should extend FunctionLikeDeclaration. @@ -477,45 +524,61 @@ declare namespace ts { questionToken?: Node; body?: Block | Expression; } - interface FunctionDeclaration extends FunctionLikeDeclaration, Statement { + interface FunctionDeclaration extends FunctionLikeDeclaration, DeclarationStatement { name?: Identifier; - body?: Block; + body?: FunctionBody; + } + interface MethodSignature extends SignatureDeclaration, TypeElement { + name: PropertyName; } interface MethodDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement { - body?: Block; + name: PropertyName; + body?: FunctionBody; } interface ConstructorDeclaration extends FunctionLikeDeclaration, ClassElement { - body?: Block; + body?: FunctionBody; } interface SemicolonClassElement extends ClassElement { _semicolonClassElementBrand: any; } interface AccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement { _accessorDeclarationBrand: any; - body: Block; + name: PropertyName; + body: FunctionBody; } - interface IndexSignatureDeclaration extends SignatureDeclaration, ClassElement { + interface GetAccessorDeclaration extends AccessorDeclaration { + } + interface SetAccessorDeclaration extends AccessorDeclaration { + } + interface IndexSignatureDeclaration extends SignatureDeclaration, ClassElement, TypeElement { _indexSignatureDeclarationBrand: any; } interface TypeNode extends Node { _typeNodeBrand: any; } + interface ThisTypeNode extends TypeNode { + _thisTypeNodeBrand: any; + } interface FunctionOrConstructorTypeNode extends TypeNode, SignatureDeclaration { _functionOrConstructorTypeNodeBrand: any; } + interface FunctionTypeNode extends FunctionOrConstructorTypeNode { + } + interface ConstructorTypeNode extends FunctionOrConstructorTypeNode { + } interface TypeReferenceNode extends TypeNode { typeName: EntityName; typeArguments?: NodeArray; } interface TypePredicateNode extends TypeNode { - parameterName: Identifier; + parameterName: Identifier | ThisTypeNode; type: TypeNode; } interface TypeQueryNode extends TypeNode { exprName: EntityName; } interface TypeLiteralNode extends TypeNode, Declaration { - members: NodeArray; + members: NodeArray; } interface ArrayTypeNode extends TypeNode { elementType: TypeNode; @@ -533,13 +596,18 @@ declare namespace ts { interface ParenthesizedTypeNode extends TypeNode { type: TypeNode; } - interface StringLiteral extends LiteralExpression, TypeNode { + interface StringLiteralTypeNode extends LiteralLikeNode, TypeNode { + _stringLiteralTypeBrand: any; + } + interface StringLiteral extends LiteralExpression { _stringLiteralBrand: any; } interface Expression extends Node { _expressionBrand: any; contextualType?: Type; } + interface OmittedExpression extends Expression { + } interface UnaryExpression extends Expression { _unaryExpressionBrand: any; } @@ -594,25 +662,34 @@ declare namespace ts { colonToken: Node; whenFalse: Expression; } + type FunctionBody = Block; + type ConciseBody = FunctionBody | Expression; interface FunctionExpression extends PrimaryExpression, FunctionLikeDeclaration { name?: Identifier; - body: Block | Expression; + body: FunctionBody; } interface ArrowFunction extends Expression, FunctionLikeDeclaration { equalsGreaterThanToken: Node; + body: ConciseBody; } - interface LiteralExpression extends PrimaryExpression { + interface LiteralLikeNode extends Node { text: string; isUnterminated?: boolean; hasExtendedUnicodeEscape?: boolean; } + interface LiteralExpression extends LiteralLikeNode, PrimaryExpression { + _literalExpressionBrand: any; + } + interface TemplateLiteralFragment extends LiteralLikeNode { + _templateLiteralFragmentBrand: any; + } interface TemplateExpression extends PrimaryExpression { - head: LiteralExpression; + head: TemplateLiteralFragment; templateSpans: NodeArray; } interface TemplateSpan extends Node { expression: Expression; - literal: LiteralExpression; + literal: TemplateLiteralFragment; } interface ParenthesizedExpression extends PrimaryExpression { expression: Expression; @@ -631,11 +708,12 @@ declare namespace ts { dotToken: Node; name: Identifier; } + type IdentifierOrPropertyAccess = Identifier | PropertyAccessExpression; interface ElementAccessExpression extends MemberExpression { expression: LeftHandSideExpression; argumentExpression?: Expression; } - interface CallExpression extends LeftHandSideExpression { + interface CallExpression extends LeftHandSideExpression, Declaration { expression: LeftHandSideExpression; typeArguments?: NodeArray; arguments: NodeArray; @@ -660,6 +738,9 @@ declare namespace ts { expression: UnaryExpression; } type AssertionExpression = TypeAssertion | AsExpression; + interface NonNullExpression extends LeftHandSideExpression { + expression: Expression; + } interface JsxElement extends PrimaryExpression { openingElement: JsxOpeningElement; children: NodeArray; @@ -694,6 +775,14 @@ declare namespace ts { interface Statement extends Node { _statementBrand: any; } + interface EmptyStatement extends Statement { + } + interface DebuggerStatement extends Statement { + } + interface MissingDeclaration extends DeclarationStatement, ClassElement, ObjectLiteralElement, TypeElement { + name?: Identifier; + } + type BlockLike = SourceFile | Block | ModuleBlock | CaseClause; interface Block extends Statement { statements: NodeArray; } @@ -730,9 +819,13 @@ declare namespace ts { initializer: VariableDeclarationList | Expression; expression: Expression; } - interface BreakOrContinueStatement extends Statement { + interface BreakStatement extends Statement { label?: Identifier; } + interface ContinueStatement extends Statement { + label?: Identifier; + } + type BreakOrContinueStatement = BreakStatement | ContinueStatement; interface ReturnStatement extends Statement { expression?: Expression; } @@ -748,7 +841,7 @@ declare namespace ts { clauses: NodeArray; } interface CaseClause extends Node { - expression?: Expression; + expression: Expression; statements: NodeArray; } interface DefaultClause extends Node { @@ -771,30 +864,38 @@ declare namespace ts { variableDeclaration: VariableDeclaration; block: Block; } + type DeclarationWithTypeParameters = SignatureDeclaration | ClassLikeDeclaration | InterfaceDeclaration | TypeAliasDeclaration; interface ClassLikeDeclaration extends Declaration { name?: Identifier; typeParameters?: NodeArray; heritageClauses?: NodeArray; members: NodeArray; } - interface ClassDeclaration extends ClassLikeDeclaration, Statement { + interface ClassDeclaration extends ClassLikeDeclaration, DeclarationStatement { + name?: Identifier; } interface ClassExpression extends ClassLikeDeclaration, PrimaryExpression { } interface ClassElement extends Declaration { _classElementBrand: any; + name?: PropertyName; } - interface InterfaceDeclaration extends Declaration, Statement { + interface TypeElement extends Declaration { + _typeElementBrand: any; + name?: PropertyName; + questionToken?: Node; + } + interface InterfaceDeclaration extends DeclarationStatement { name: Identifier; typeParameters?: NodeArray; heritageClauses?: NodeArray; - members: NodeArray; + members: NodeArray; } interface HeritageClause extends Node { token: SyntaxKind; types?: NodeArray; } - interface TypeAliasDeclaration extends Declaration, Statement { + interface TypeAliasDeclaration extends DeclarationStatement { name: Identifier; typeParameters?: NodeArray; type: TypeNode; @@ -803,18 +904,19 @@ declare namespace ts { name: DeclarationName; initializer?: Expression; } - interface EnumDeclaration extends Declaration, Statement { + interface EnumDeclaration extends DeclarationStatement { name: Identifier; members: NodeArray; } - interface ModuleDeclaration extends Declaration, Statement { + type ModuleBody = ModuleBlock | ModuleDeclaration; + interface ModuleDeclaration extends DeclarationStatement { name: Identifier | LiteralExpression; body: ModuleBlock | ModuleDeclaration; } interface ModuleBlock extends Node, Statement { statements: NodeArray; } - interface ImportEqualsDeclaration extends Declaration, Statement { + interface ImportEqualsDeclaration extends DeclarationStatement { name: Identifier; moduleReference: EntityName | ExternalModuleReference; } @@ -832,22 +934,31 @@ declare namespace ts { interface NamespaceImport extends Declaration { name: Identifier; } - interface ExportDeclaration extends Declaration, Statement { + interface GlobalModuleExportDeclaration extends DeclarationStatement { + name: Identifier; + moduleReference: LiteralLikeNode; + } + interface ExportDeclaration extends DeclarationStatement { exportClause?: NamedExports; moduleSpecifier?: Expression; } - interface NamedImportsOrExports extends Node { - elements: NodeArray; + interface NamedImports extends Node { + elements: NodeArray; } - type NamedImports = NamedImportsOrExports; - type NamedExports = NamedImportsOrExports; - interface ImportOrExportSpecifier extends Declaration { + interface NamedExports extends Node { + elements: NodeArray; + } + type NamedImportsOrExports = NamedImports | NamedExports; + interface ImportSpecifier extends Declaration { propertyName?: Identifier; name: Identifier; } - type ImportSpecifier = ImportOrExportSpecifier; - type ExportSpecifier = ImportOrExportSpecifier; - interface ExportAssignment extends Declaration, Statement { + interface ExportSpecifier extends Declaration { + propertyName?: Identifier; + name: Identifier; + } + type ImportOrExportSpecifier = ImportSpecifier | ExportSpecifier; + interface ExportAssignment extends DeclarationStatement { isExportEquals?: boolean; expression: Expression; } @@ -908,7 +1019,8 @@ declare namespace ts { interface JSDocThisType extends JSDocType { type: JSDocType; } - interface JSDocRecordMember extends PropertyDeclaration { + type JSDocTypeReferencingNode = JSDocThisType | JSDocConstructorType | JSDocVariadicType | JSDocOptionalType | JSDocNullableType | JSDocNonNullableType; + interface JSDocRecordMember extends PropertySignature { name: Identifier | LiteralExpression; type?: JSDocType; } @@ -934,19 +1046,50 @@ declare namespace ts { postParameterName?: Identifier; isBracketed: boolean; } + enum FlowFlags { + Unreachable = 1, + Start = 2, + BranchLabel = 4, + LoopLabel = 8, + Assignment = 16, + TrueCondition = 32, + FalseCondition = 64, + Referenced = 128, + Shared = 256, + Label = 12, + Condition = 96, + } + interface FlowNode { + flags: FlowFlags; + id?: number; + } + interface FlowLabel extends FlowNode { + antecedents: FlowNode[]; + } + interface FlowAssignment extends FlowNode { + node: Expression | VariableDeclaration | BindingElement; + antecedent: FlowNode; + } + interface FlowCondition extends FlowNode { + expression: Expression; + antecedent: FlowNode; + } + interface AmdDependency { + path: string; + name: string; + } interface SourceFile extends Declaration { statements: NodeArray; endOfFileToken: Node; fileName: string; path: Path; text: string; - amdDependencies: { - path: string; - name: string; - }[]; + amdDependencies: AmdDependency[]; moduleName: string; referencedFiles: FileReference[]; + typeReferenceDirectives: FileReference[]; languageVariant: LanguageVariant; + isDeclarationFile: boolean; /** * lib.d.ts should have a reference comment like * @@ -961,13 +1104,14 @@ declare namespace ts { interface ScriptReferenceHost { getCompilerOptions(): CompilerOptions; getSourceFile(fileName: string): SourceFile; + getSourceFileByPath(path: Path): SourceFile; getCurrentDirectory(): string; } interface ParseConfigHost { readDirectory(rootDir: string, extension: string, exclude: string[]): string[]; } interface WriteFileCallback { - (fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void): void; + (fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void, sourceFiles?: SourceFile[]): void; } class OperationCanceledException { } @@ -1040,7 +1184,9 @@ declare namespace ts { } interface EmitResult { emitSkipped: boolean; + /** Contains declaration emit diagnostics */ diagnostics: Diagnostic[]; + emittedFiles: string[]; } interface TypeChecker { getTypeOfSymbolAtLocation(symbol: Symbol, node: Node): Type; @@ -1051,9 +1197,13 @@ declare namespace ts { getIndexTypeOfType(type: Type, kind: IndexKind): Type; getBaseTypes(type: InterfaceType): ObjectType[]; getReturnTypeOfSignature(signature: Signature): Type; + getNonNullableType(type: Type): Type; getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[]; getSymbolAtLocation(node: Node): Symbol; + getSymbolsOfParameterPropertyDeclaration(parameter: ParameterDeclaration, parameterName: string): Symbol[]; getShorthandAssignmentValueSymbol(location: Node): Symbol; + getExportSpecifierLocalTargetSymbol(location: ExportSpecifier): Symbol; + getPropertySymbolOfDestructuringAssignment(location: Identifier): Symbol; getTypeAtLocation(node: Node): Type; typeToString(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string; symbolToString(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): string; @@ -1067,6 +1217,7 @@ declare namespace ts { isImplementationOfOverload(node: FunctionLikeDeclaration): boolean; isUndefinedSymbol(symbol: Symbol): boolean; isArgumentsSymbol(symbol: Symbol): boolean; + isUnknownSymbol(symbol: Symbol): boolean; getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number; isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName, propertyName: string): boolean; getAliasedSymbol(symbol: Symbol): Symbol; @@ -1078,11 +1229,12 @@ declare namespace ts { interface SymbolDisplayBuilder { buildTypeDisplay(type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; buildSymbolDisplay(symbol: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags): void; - buildSignatureDisplay(signatures: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; + buildSignatureDisplay(signatures: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags, kind?: SignatureKind): void; buildParameterDisplay(parameter: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; buildTypeParameterDisplay(tp: TypeParameter, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; - buildTypeParameterDisplayFromSymbol(symbol: Symbol, writer: SymbolWriter, enclosingDeclaraiton?: Node, flags?: TypeFormatFlags): void; - buildDisplayForParametersAndDelimiters(parameters: Symbol[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; + buildTypePredicateDisplay(predicate: TypePredicate, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; + buildTypeParameterDisplayFromSymbol(symbol: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; + buildDisplayForParametersAndDelimiters(thisType: Type, 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; } @@ -1111,17 +1263,29 @@ declare namespace ts { WriteTypeArgumentsOfSignature = 32, InElementType = 64, UseFullyQualifiedType = 128, + InFirstTypeArgument = 256, } enum SymbolFormatFlags { None = 0, WriteTypeParametersOrArguments = 1, UseOnlyExternalAliasing = 2, } - interface TypePredicate { - parameterName: string; - parameterIndex: number; + enum TypePredicateKind { + This = 0, + Identifier = 1, + } + interface TypePredicateBase { + kind: TypePredicateKind; type: Type; } + interface ThisTypePredicate extends TypePredicateBase { + _thisTypePredicateBrand: any; + } + interface IdentifierTypePredicate extends TypePredicateBase { + parameterName: string; + parameterIndex: number; + } + type TypePredicate = IdentifierTypePredicate | ThisTypePredicate; enum SymbolFlags { None = 0, FunctionScopedVariable = 1, @@ -1195,6 +1359,7 @@ declare namespace ts { valueDeclaration?: Declaration; members?: SymbolTable; exports?: SymbolTable; + globalExports?: SymbolTable; } interface SymbolTable { [index: string]: Symbol; @@ -1222,11 +1387,13 @@ declare namespace ts { ESSymbol = 16777216, ThisType = 33554432, ObjectLiteralPatternWithComputedProperties = 67108864, + Never = 134217728, StringLike = 258, NumberLike = 132, ObjectType = 80896, UnionOrIntersection = 49152, StructuredType = 130048, + Narrowable = 97793, } type DestructuringPattern = BindingPattern | ObjectLiteralExpression | ArrayLiteralExpression; interface Type { @@ -1249,8 +1416,8 @@ declare namespace ts { declaredProperties: Symbol[]; declaredCallSignatures: Signature[]; declaredConstructSignatures: Signature[]; - declaredStringIndexType: Type; - declaredNumberIndexType: Type; + declaredStringIndexInfo: IndexInfo; + declaredNumberIndexInfo: IndexInfo; } interface TypeReference extends ObjectType { target: GenericType; @@ -1279,12 +1446,17 @@ declare namespace ts { declaration: SignatureDeclaration; typeParameters: TypeParameter[]; parameters: Symbol[]; - typePredicate?: TypePredicate; + thisType?: Type; } enum IndexKind { String = 0, Number = 1, } + interface IndexInfo { + type: Type; + isReadonly: boolean; + declaration?: SignatureDeclaration; + } interface DiagnosticMessage { key: string; category: DiagnosticCategory; @@ -1320,10 +1492,15 @@ declare namespace ts { Classic = 1, NodeJs = 2, } + type RootPaths = string[]; + type PathSubstitutions = Map; + type TsConfigOnlyOptions = RootPaths | PathSubstitutions; + type CompilerOptionsValue = string | number | boolean | (string | number)[] | TsConfigOnlyOptions; interface CompilerOptions { allowNonTsExtensions?: boolean; charset?: string; declaration?: boolean; + declarationDir?: string; diagnostics?: boolean; emitBOM?: boolean; help?: boolean; @@ -1331,7 +1508,9 @@ declare namespace ts { inlineSourceMap?: boolean; inlineSources?: boolean; jsx?: JsxEmit; + reactNamespace?: string; listFiles?: boolean; + typesSearchPaths?: string[]; locale?: string; mapRoot?: string; module?: ModuleKind; @@ -1341,6 +1520,7 @@ declare namespace ts { noEmitOnError?: boolean; noErrorTruncation?: boolean; noImplicitAny?: boolean; + noImplicitThis?: boolean; noLib?: boolean; noResolve?: boolean; out?: string; @@ -1366,7 +1546,33 @@ declare namespace ts { noImplicitReturns?: boolean; noFallthroughCasesInSwitch?: boolean; forceConsistentCasingInFileNames?: boolean; - [option: string]: string | number | boolean; + baseUrl?: string; + paths?: PathSubstitutions; + rootDirs?: RootPaths; + traceResolution?: boolean; + allowSyntheticDefaultImports?: boolean; + allowJs?: boolean; + noImplicitUseStrict?: boolean; + strictNullChecks?: boolean; + listEmittedFiles?: boolean; + lib?: string[]; + types?: string[]; + list?: string[]; + [option: string]: CompilerOptionsValue | undefined; + } + interface TypingOptions { + enableAutoDiscovery?: boolean; + include?: string[]; + exclude?: string[]; + [option: string]: string[] | boolean | undefined; + } + interface DiscoverTypingsInfo { + fileNames: string[]; + projectRootPath: string; + safeListPath: string; + packageNameToTypingLocation: Map; + typingOptions: TypingOptions; + compilerOptions: CompilerOptions; } enum ModuleKind { None = 0, @@ -1390,6 +1596,13 @@ declare namespace ts { line: number; character: number; } + enum ScriptKind { + Unknown = 0, + JS = 1, + JSX = 2, + TS = 3, + TSX = 4, + } enum ScriptTarget { ES3 = 0, ES5 = 1, @@ -1403,12 +1616,17 @@ declare namespace ts { } interface ParsedCommandLine { options: CompilerOptions; + typingOptions?: TypingOptions; fileNames: string[]; + raw?: any; errors: Diagnostic[]; } interface ModuleResolutionHost { fileExists(fileName: string): boolean; readFile(fileName: string): string; + trace?(s: string): void; + directoryExists?(directoryName: string): boolean; + realpath?(path: string): string; } interface ResolvedModule { resolvedFileName: string; @@ -1418,16 +1636,30 @@ declare namespace ts { resolvedModule: ResolvedModule; failedLookupLocations: string[]; } + interface ResolvedTypeReferenceDirective { + primary: boolean; + resolvedFileName?: string; + } + interface ResolvedTypeReferenceDirectiveWithFailedLookupLocations { + resolvedTypeReferenceDirective: ResolvedTypeReferenceDirective; + failedLookupLocations: string[]; + } interface CompilerHost extends ModuleResolutionHost { getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile; + getSourceFileByPath?(fileName: string, path: Path, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile; getCancellationToken?(): CancellationToken; getDefaultLibFileName(options: CompilerOptions): string; + getDefaultLibLocation?(): string; writeFile: WriteFileCallback; getCurrentDirectory(): string; getCanonicalFileName(fileName: string): string; useCaseSensitiveFileNames(): boolean; getNewLine(): string; resolveModuleNames?(moduleNames: string[], containingFile: string): ResolvedModule[]; + /** + * 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[]; } interface TextSpan { start: number; @@ -1439,6 +1671,13 @@ declare namespace ts { } } declare namespace ts { + type FileWatcherCallback = (fileName: string, removed?: boolean) => void; + type DirectoryWatcherCallback = (directoryName: string) => void; + interface WatchedFile { + fileName: string; + callback: FileWatcherCallback; + mtime?: Date; + } interface System { args: string[]; newLine: string; @@ -1446,8 +1685,8 @@ declare namespace ts { write(s: string): void; readFile(path: string, encoding?: string): string; writeFile(path: string, data: string, writeByteOrderMark?: boolean): void; - watchFile?(path: string, callback: (path: string, removed?: boolean) => void): FileWatcher; - watchDirectory?(path: string, callback: (path: string) => void, recursive?: boolean): FileWatcher; + watchFile?(path: string, callback: FileWatcherCallback): FileWatcher; + watchDirectory?(path: string, callback: DirectoryWatcherCallback, recursive?: boolean): FileWatcher; resolvePath(path: string): string; fileExists(path: string): boolean; directoryExists(path: string): boolean; @@ -1455,12 +1694,19 @@ declare namespace ts { getExecutingFilePath(): string; getCurrentDirectory(): string; readDirectory(path: string, extension?: string, exclude?: string[]): string[]; + getModifiedTime?(path: string): Date; + createHash?(data: string): string; getMemoryUsage?(): number; exit(exitCode?: number): void; + realpath?(path: string): string; } interface FileWatcher { close(): void; } + interface DirectoryWatcher extends FileWatcher { + directoryName: string; + referenceCount: number; + } var sys: System; } declare namespace ts { @@ -1485,6 +1731,7 @@ declare namespace ts { scanJsxIdentifier(): SyntaxKind; reScanJsxToken(): SyntaxKind; scanJsxToken(): SyntaxKind; + scanJSDocToken(): SyntaxKind; scan(): SyntaxKind; setText(text: string, start?: number, length?: number): void; setOnError(onError: ErrorCallback): void; @@ -1492,6 +1739,7 @@ declare namespace ts { setLanguageVariant(variant: LanguageVariant): void; setTextPos(textPos: number): void; lookAhead(callback: () => T): T; + scanRange(start: number, length: number, callback: () => T): T; tryScan(callback: () => T): T; } function tokenToString(t: SyntaxKind): string; @@ -1537,19 +1785,29 @@ declare namespace ts { */ function collapseTextChangeRangesAcrossMultipleVersions(changes: TextChangeRange[]): TextChangeRange; function getTypeParameterOwner(d: Declaration): Declaration; + function isParameterPropertyDeclaration(node: ParameterDeclaration): boolean; + function startsWith(str: string, prefix: string): boolean; + function endsWith(str: string, suffix: string): boolean; } declare namespace ts { function createNode(kind: SyntaxKind, pos?: number, end?: number): Node; function forEachChild(node: Node, cbNode: (node: Node) => T, cbNodeArray?: (nodes: Node[]) => T): T; - function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean): SourceFile; + function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean, scriptKind?: ScriptKind): SourceFile; + function isExternalModule(file: SourceFile): boolean; function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile; } declare namespace ts { const version: string; - function findConfigFile(searchPath: string): string; + function findConfigFile(searchPath: string, fileExists: (fileName: string) => boolean): string; function resolveTripleslashReference(moduleName: string, containingFile: string): string; + /** + * @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, options: CompilerOptions, host: ModuleResolutionHost): ResolvedTypeReferenceDirectiveWithFailedLookupLocations; function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations; - function nodeModuleNameResolver(moduleName: string, containingFile: string, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations; + function nodeModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations; function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations; function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost; function getPreEmitDiagnostics(program: Program, sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[]; @@ -1557,7 +1815,6 @@ declare namespace ts { function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost, oldProgram?: Program): Program; } declare namespace ts { - function parseCommandLine(commandLine: string[], readFile?: (path: string) => string): ParsedCommandLine; /** * Read tsconfig.json file * @param fileName The path to the config file @@ -1582,15 +1839,19 @@ declare namespace ts { * @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): ParsedCommandLine; - function convertCompilerOptionsFromJson(jsonOptions: any, basePath: string): { + function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string): ParsedCommandLine; + function convertCompilerOptionsFromJson(jsonOptions: any, basePath: string, configFileName?: string): { + options: CompilerOptions; + errors: Diagnostic[]; + }; + function convertTypingOptionsFromJson(jsonOptions: any, basePath: string, configFileName?: string): { options: CompilerOptions; errors: Diagnostic[]; }; } declare namespace ts { /** The version of the language service API */ - let servicesVersion: string; + const servicesVersion: string; interface Node { getSourceFile(): SourceFile; getChildCount(sourceFile?: SourceFile): number; @@ -1624,6 +1885,7 @@ declare namespace ts { getStringIndexType(): Type; getNumberIndexType(): Type; getBaseTypes(): ObjectType[]; + getNonNullableType(): Type; } interface Signature { getDeclaration(): SignatureDeclaration; @@ -1659,11 +1921,12 @@ declare namespace ts { /** Releases all resources held by this script snapshot */ dispose?(): void; } - module ScriptSnapshot { + namespace ScriptSnapshot { function fromString(text: string): IScriptSnapshot; } interface PreProcessedFileInfo { referencedFiles: FileReference[]; + typeReferenceDirectives: FileReference[]; importedFiles: FileReference[]; ambientExternalModules: string[]; isLibFile: boolean; @@ -1676,8 +1939,9 @@ declare namespace ts { getNewLine?(): string; getProjectVersion?(): string; getScriptFileNames(): string[]; + getScriptKind?(fileName: string): ScriptKind; getScriptVersion(fileName: string): string; - getScriptSnapshot(fileName: string): IScriptSnapshot; + getScriptSnapshot(fileName: string): IScriptSnapshot | undefined; getLocalizedDiagnosticMessages?(): any; getCancellationToken?(): HostCancellationToken; getCurrentDirectory(): string; @@ -1687,6 +1951,8 @@ declare namespace ts { error?(s: string): void; useCaseSensitiveFileNames?(): boolean; resolveModuleNames?(moduleNames: string[], containingFile: string): ResolvedModule[]; + resolveTypeReferenceDirectives?(typeDirectiveNames: string[], containingFile: string): ResolvedTypeReferenceDirective[]; + directoryExists?(directoryName: string): boolean; } interface LanguageService { cleanupSemanticCache(): void; @@ -1728,9 +1994,9 @@ declare namespace ts { getFormattingEditsForDocument(fileName: string, options: FormatCodeOptions): TextChange[]; getFormattingEditsAfterKeystroke(fileName: string, position: number, key: string, options: FormatCodeOptions): TextChange[]; getDocCommentTemplateAtPosition(fileName: string, position: number): TextInsertion; + isValidBraceCompletionAtPostion(fileName: string, position: number, openingBrace: number): boolean; getEmitOutput(fileName: string): EmitOutput; getProgram(): Program; - getSourceFile(fileName: string): SourceFile; dispose(): void; } interface Classifications { @@ -1782,7 +2048,7 @@ declare namespace ts { fileName: string; highlightSpans: HighlightSpan[]; } - module HighlightSpanKind { + namespace HighlightSpanKind { const none: string; const definition: string; const reference: string; @@ -1824,6 +2090,7 @@ declare namespace ts { InsertSpaceAfterFunctionKeywordForAnonymousFunctions: boolean; InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean; InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: boolean; + InsertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: boolean; PlaceOpenBraceOnNewLineForFunctions: boolean; PlaceOpenBraceOnNewLineForControlBlocks: boolean; [s: string]: boolean | number | string; @@ -2042,7 +2309,8 @@ declare namespace ts { * @parm version Current version of the file. Only used if the file was not found * in the registry and a new one was created. */ - acquireDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string): SourceFile; + 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 @@ -2055,7 +2323,9 @@ declare namespace ts { * @param scriptSnapshot Text of the file. * @param version Current version of the file. */ - updateDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string): SourceFile; + 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. * @@ -2066,9 +2336,13 @@ declare namespace ts { * @param compilationSettings The compilation settings used to acquire the file */ releaseDocument(fileName: string, compilationSettings: CompilerOptions): void; + releaseDocumentWithKey(path: Path, key: DocumentRegistryBucketKey): void; reportStats(): string; } - module ScriptElementKind { + type DocumentRegistryBucketKey = string & { + __bucketKey: any; + }; + namespace ScriptElementKind { const unknown: string; const warning: string; const keyword: string; @@ -2099,7 +2373,7 @@ declare namespace ts { const constElement: string; const letElement: string; } - module ScriptElementKindModifier { + namespace ScriptElementKindModifier { const none: string; const publicMemberModifier: string; const privateMemberModifier: string; @@ -2130,6 +2404,9 @@ declare namespace ts { static jsxOpenTagName: string; static jsxCloseTagName: string; static jsxSelfClosingTagName: string; + static jsxAttribute: string; + static jsxText: string; + static jsxAttributeStringLiteralValue: string; } enum ClassificationType { comment = 1, @@ -2153,6 +2430,9 @@ declare namespace ts { jsxOpenTagName = 19, jsxCloseTagName = 20, jsxSelfClosingTagName = 21, + jsxAttribute = 22, + jsxText = 23, + jsxAttributeStringLiteralValue = 24, } interface DisplayPartsSymbolWriter extends SymbolWriter { displayParts(): SymbolDisplayPart[]; @@ -2173,10 +2453,9 @@ declare namespace ts { } function transpileModule(input: string, transpileOptions: TranspileOptions): TranspileOutput; function transpile(input: string, compilerOptions?: CompilerOptions, fileName?: string, diagnostics?: Diagnostic[], moduleName?: string): string; - function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile; + function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean, scriptKind?: ScriptKind): SourceFile; let disableIncrementalParsing: boolean; function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile; - function createGetCanonicalFileName(useCaseSensitivefileNames: boolean): (fileName: string) => string; function createDocumentRegistry(useCaseSensitiveFileNames?: boolean, currentDirectory?: string): DocumentRegistry; function preProcessFile(sourceText: string, readImportFiles?: boolean, detectJavaScriptImports?: boolean): PreProcessedFileInfo; function createLanguageService(host: LanguageServiceHost, documentRegistry?: DocumentRegistry): LanguageService; diff --git a/lib/typescript.js b/lib/typescript.js index 498ddc37860..e78eda7b0bb 100644 --- a/lib/typescript.js +++ b/lib/typescript.js @@ -13,6 +13,11 @@ See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; var ts; (function (ts) { // token > SyntaxKind.Identifer => token is a keyword @@ -156,187 +161,195 @@ var ts; SyntaxKind[SyntaxKind["IsKeyword"] = 124] = "IsKeyword"; SyntaxKind[SyntaxKind["ModuleKeyword"] = 125] = "ModuleKeyword"; SyntaxKind[SyntaxKind["NamespaceKeyword"] = 126] = "NamespaceKeyword"; - SyntaxKind[SyntaxKind["RequireKeyword"] = 127] = "RequireKeyword"; - SyntaxKind[SyntaxKind["NumberKeyword"] = 128] = "NumberKeyword"; - SyntaxKind[SyntaxKind["SetKeyword"] = 129] = "SetKeyword"; - SyntaxKind[SyntaxKind["StringKeyword"] = 130] = "StringKeyword"; - SyntaxKind[SyntaxKind["SymbolKeyword"] = 131] = "SymbolKeyword"; - SyntaxKind[SyntaxKind["TypeKeyword"] = 132] = "TypeKeyword"; - SyntaxKind[SyntaxKind["FromKeyword"] = 133] = "FromKeyword"; - SyntaxKind[SyntaxKind["OfKeyword"] = 134] = "OfKeyword"; + SyntaxKind[SyntaxKind["NeverKeyword"] = 127] = "NeverKeyword"; + SyntaxKind[SyntaxKind["ReadonlyKeyword"] = 128] = "ReadonlyKeyword"; + SyntaxKind[SyntaxKind["RequireKeyword"] = 129] = "RequireKeyword"; + SyntaxKind[SyntaxKind["NumberKeyword"] = 130] = "NumberKeyword"; + SyntaxKind[SyntaxKind["SetKeyword"] = 131] = "SetKeyword"; + SyntaxKind[SyntaxKind["StringKeyword"] = 132] = "StringKeyword"; + SyntaxKind[SyntaxKind["SymbolKeyword"] = 133] = "SymbolKeyword"; + SyntaxKind[SyntaxKind["TypeKeyword"] = 134] = "TypeKeyword"; + SyntaxKind[SyntaxKind["UndefinedKeyword"] = 135] = "UndefinedKeyword"; + SyntaxKind[SyntaxKind["FromKeyword"] = 136] = "FromKeyword"; + SyntaxKind[SyntaxKind["GlobalKeyword"] = 137] = "GlobalKeyword"; + SyntaxKind[SyntaxKind["OfKeyword"] = 138] = "OfKeyword"; // Parse tree nodes // Names - SyntaxKind[SyntaxKind["QualifiedName"] = 135] = "QualifiedName"; - SyntaxKind[SyntaxKind["ComputedPropertyName"] = 136] = "ComputedPropertyName"; + SyntaxKind[SyntaxKind["QualifiedName"] = 139] = "QualifiedName"; + SyntaxKind[SyntaxKind["ComputedPropertyName"] = 140] = "ComputedPropertyName"; // Signature elements - SyntaxKind[SyntaxKind["TypeParameter"] = 137] = "TypeParameter"; - SyntaxKind[SyntaxKind["Parameter"] = 138] = "Parameter"; - SyntaxKind[SyntaxKind["Decorator"] = 139] = "Decorator"; + SyntaxKind[SyntaxKind["TypeParameter"] = 141] = "TypeParameter"; + SyntaxKind[SyntaxKind["Parameter"] = 142] = "Parameter"; + SyntaxKind[SyntaxKind["Decorator"] = 143] = "Decorator"; // TypeMember - SyntaxKind[SyntaxKind["PropertySignature"] = 140] = "PropertySignature"; - SyntaxKind[SyntaxKind["PropertyDeclaration"] = 141] = "PropertyDeclaration"; - SyntaxKind[SyntaxKind["MethodSignature"] = 142] = "MethodSignature"; - SyntaxKind[SyntaxKind["MethodDeclaration"] = 143] = "MethodDeclaration"; - SyntaxKind[SyntaxKind["Constructor"] = 144] = "Constructor"; - SyntaxKind[SyntaxKind["GetAccessor"] = 145] = "GetAccessor"; - SyntaxKind[SyntaxKind["SetAccessor"] = 146] = "SetAccessor"; - SyntaxKind[SyntaxKind["CallSignature"] = 147] = "CallSignature"; - SyntaxKind[SyntaxKind["ConstructSignature"] = 148] = "ConstructSignature"; - SyntaxKind[SyntaxKind["IndexSignature"] = 149] = "IndexSignature"; + SyntaxKind[SyntaxKind["PropertySignature"] = 144] = "PropertySignature"; + SyntaxKind[SyntaxKind["PropertyDeclaration"] = 145] = "PropertyDeclaration"; + SyntaxKind[SyntaxKind["MethodSignature"] = 146] = "MethodSignature"; + SyntaxKind[SyntaxKind["MethodDeclaration"] = 147] = "MethodDeclaration"; + SyntaxKind[SyntaxKind["Constructor"] = 148] = "Constructor"; + SyntaxKind[SyntaxKind["GetAccessor"] = 149] = "GetAccessor"; + SyntaxKind[SyntaxKind["SetAccessor"] = 150] = "SetAccessor"; + SyntaxKind[SyntaxKind["CallSignature"] = 151] = "CallSignature"; + SyntaxKind[SyntaxKind["ConstructSignature"] = 152] = "ConstructSignature"; + SyntaxKind[SyntaxKind["IndexSignature"] = 153] = "IndexSignature"; // Type - SyntaxKind[SyntaxKind["TypePredicate"] = 150] = "TypePredicate"; - SyntaxKind[SyntaxKind["TypeReference"] = 151] = "TypeReference"; - SyntaxKind[SyntaxKind["FunctionType"] = 152] = "FunctionType"; - SyntaxKind[SyntaxKind["ConstructorType"] = 153] = "ConstructorType"; - SyntaxKind[SyntaxKind["TypeQuery"] = 154] = "TypeQuery"; - SyntaxKind[SyntaxKind["TypeLiteral"] = 155] = "TypeLiteral"; - SyntaxKind[SyntaxKind["ArrayType"] = 156] = "ArrayType"; - SyntaxKind[SyntaxKind["TupleType"] = 157] = "TupleType"; - SyntaxKind[SyntaxKind["UnionType"] = 158] = "UnionType"; - SyntaxKind[SyntaxKind["IntersectionType"] = 159] = "IntersectionType"; - SyntaxKind[SyntaxKind["ParenthesizedType"] = 160] = "ParenthesizedType"; + SyntaxKind[SyntaxKind["TypePredicate"] = 154] = "TypePredicate"; + SyntaxKind[SyntaxKind["TypeReference"] = 155] = "TypeReference"; + SyntaxKind[SyntaxKind["FunctionType"] = 156] = "FunctionType"; + SyntaxKind[SyntaxKind["ConstructorType"] = 157] = "ConstructorType"; + SyntaxKind[SyntaxKind["TypeQuery"] = 158] = "TypeQuery"; + SyntaxKind[SyntaxKind["TypeLiteral"] = 159] = "TypeLiteral"; + SyntaxKind[SyntaxKind["ArrayType"] = 160] = "ArrayType"; + SyntaxKind[SyntaxKind["TupleType"] = 161] = "TupleType"; + SyntaxKind[SyntaxKind["UnionType"] = 162] = "UnionType"; + SyntaxKind[SyntaxKind["IntersectionType"] = 163] = "IntersectionType"; + SyntaxKind[SyntaxKind["ParenthesizedType"] = 164] = "ParenthesizedType"; + SyntaxKind[SyntaxKind["ThisType"] = 165] = "ThisType"; + SyntaxKind[SyntaxKind["StringLiteralType"] = 166] = "StringLiteralType"; // Binding patterns - SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 161] = "ObjectBindingPattern"; - SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 162] = "ArrayBindingPattern"; - SyntaxKind[SyntaxKind["BindingElement"] = 163] = "BindingElement"; + SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 167] = "ObjectBindingPattern"; + SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 168] = "ArrayBindingPattern"; + SyntaxKind[SyntaxKind["BindingElement"] = 169] = "BindingElement"; // Expression - SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 164] = "ArrayLiteralExpression"; - SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 165] = "ObjectLiteralExpression"; - SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 166] = "PropertyAccessExpression"; - SyntaxKind[SyntaxKind["ElementAccessExpression"] = 167] = "ElementAccessExpression"; - SyntaxKind[SyntaxKind["CallExpression"] = 168] = "CallExpression"; - SyntaxKind[SyntaxKind["NewExpression"] = 169] = "NewExpression"; - SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 170] = "TaggedTemplateExpression"; - SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 171] = "TypeAssertionExpression"; - SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 172] = "ParenthesizedExpression"; - SyntaxKind[SyntaxKind["FunctionExpression"] = 173] = "FunctionExpression"; - SyntaxKind[SyntaxKind["ArrowFunction"] = 174] = "ArrowFunction"; - SyntaxKind[SyntaxKind["DeleteExpression"] = 175] = "DeleteExpression"; - SyntaxKind[SyntaxKind["TypeOfExpression"] = 176] = "TypeOfExpression"; - SyntaxKind[SyntaxKind["VoidExpression"] = 177] = "VoidExpression"; - SyntaxKind[SyntaxKind["AwaitExpression"] = 178] = "AwaitExpression"; - SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 179] = "PrefixUnaryExpression"; - SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 180] = "PostfixUnaryExpression"; - SyntaxKind[SyntaxKind["BinaryExpression"] = 181] = "BinaryExpression"; - SyntaxKind[SyntaxKind["ConditionalExpression"] = 182] = "ConditionalExpression"; - SyntaxKind[SyntaxKind["TemplateExpression"] = 183] = "TemplateExpression"; - SyntaxKind[SyntaxKind["YieldExpression"] = 184] = "YieldExpression"; - SyntaxKind[SyntaxKind["SpreadElementExpression"] = 185] = "SpreadElementExpression"; - SyntaxKind[SyntaxKind["ClassExpression"] = 186] = "ClassExpression"; - SyntaxKind[SyntaxKind["OmittedExpression"] = 187] = "OmittedExpression"; - SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 188] = "ExpressionWithTypeArguments"; - SyntaxKind[SyntaxKind["AsExpression"] = 189] = "AsExpression"; + SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 170] = "ArrayLiteralExpression"; + SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 171] = "ObjectLiteralExpression"; + SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 172] = "PropertyAccessExpression"; + SyntaxKind[SyntaxKind["ElementAccessExpression"] = 173] = "ElementAccessExpression"; + SyntaxKind[SyntaxKind["CallExpression"] = 174] = "CallExpression"; + SyntaxKind[SyntaxKind["NewExpression"] = 175] = "NewExpression"; + SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 176] = "TaggedTemplateExpression"; + SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 177] = "TypeAssertionExpression"; + SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 178] = "ParenthesizedExpression"; + SyntaxKind[SyntaxKind["FunctionExpression"] = 179] = "FunctionExpression"; + SyntaxKind[SyntaxKind["ArrowFunction"] = 180] = "ArrowFunction"; + SyntaxKind[SyntaxKind["DeleteExpression"] = 181] = "DeleteExpression"; + SyntaxKind[SyntaxKind["TypeOfExpression"] = 182] = "TypeOfExpression"; + SyntaxKind[SyntaxKind["VoidExpression"] = 183] = "VoidExpression"; + SyntaxKind[SyntaxKind["AwaitExpression"] = 184] = "AwaitExpression"; + SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 185] = "PrefixUnaryExpression"; + SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 186] = "PostfixUnaryExpression"; + SyntaxKind[SyntaxKind["BinaryExpression"] = 187] = "BinaryExpression"; + SyntaxKind[SyntaxKind["ConditionalExpression"] = 188] = "ConditionalExpression"; + SyntaxKind[SyntaxKind["TemplateExpression"] = 189] = "TemplateExpression"; + SyntaxKind[SyntaxKind["YieldExpression"] = 190] = "YieldExpression"; + SyntaxKind[SyntaxKind["SpreadElementExpression"] = 191] = "SpreadElementExpression"; + SyntaxKind[SyntaxKind["ClassExpression"] = 192] = "ClassExpression"; + SyntaxKind[SyntaxKind["OmittedExpression"] = 193] = "OmittedExpression"; + SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 194] = "ExpressionWithTypeArguments"; + SyntaxKind[SyntaxKind["AsExpression"] = 195] = "AsExpression"; + SyntaxKind[SyntaxKind["NonNullExpression"] = 196] = "NonNullExpression"; // Misc - SyntaxKind[SyntaxKind["TemplateSpan"] = 190] = "TemplateSpan"; - SyntaxKind[SyntaxKind["SemicolonClassElement"] = 191] = "SemicolonClassElement"; + SyntaxKind[SyntaxKind["TemplateSpan"] = 197] = "TemplateSpan"; + SyntaxKind[SyntaxKind["SemicolonClassElement"] = 198] = "SemicolonClassElement"; // Element - SyntaxKind[SyntaxKind["Block"] = 192] = "Block"; - SyntaxKind[SyntaxKind["VariableStatement"] = 193] = "VariableStatement"; - SyntaxKind[SyntaxKind["EmptyStatement"] = 194] = "EmptyStatement"; - SyntaxKind[SyntaxKind["ExpressionStatement"] = 195] = "ExpressionStatement"; - SyntaxKind[SyntaxKind["IfStatement"] = 196] = "IfStatement"; - SyntaxKind[SyntaxKind["DoStatement"] = 197] = "DoStatement"; - SyntaxKind[SyntaxKind["WhileStatement"] = 198] = "WhileStatement"; - SyntaxKind[SyntaxKind["ForStatement"] = 199] = "ForStatement"; - SyntaxKind[SyntaxKind["ForInStatement"] = 200] = "ForInStatement"; - SyntaxKind[SyntaxKind["ForOfStatement"] = 201] = "ForOfStatement"; - SyntaxKind[SyntaxKind["ContinueStatement"] = 202] = "ContinueStatement"; - SyntaxKind[SyntaxKind["BreakStatement"] = 203] = "BreakStatement"; - SyntaxKind[SyntaxKind["ReturnStatement"] = 204] = "ReturnStatement"; - SyntaxKind[SyntaxKind["WithStatement"] = 205] = "WithStatement"; - SyntaxKind[SyntaxKind["SwitchStatement"] = 206] = "SwitchStatement"; - SyntaxKind[SyntaxKind["LabeledStatement"] = 207] = "LabeledStatement"; - SyntaxKind[SyntaxKind["ThrowStatement"] = 208] = "ThrowStatement"; - SyntaxKind[SyntaxKind["TryStatement"] = 209] = "TryStatement"; - SyntaxKind[SyntaxKind["DebuggerStatement"] = 210] = "DebuggerStatement"; - SyntaxKind[SyntaxKind["VariableDeclaration"] = 211] = "VariableDeclaration"; - SyntaxKind[SyntaxKind["VariableDeclarationList"] = 212] = "VariableDeclarationList"; - SyntaxKind[SyntaxKind["FunctionDeclaration"] = 213] = "FunctionDeclaration"; - SyntaxKind[SyntaxKind["ClassDeclaration"] = 214] = "ClassDeclaration"; - SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 215] = "InterfaceDeclaration"; - SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 216] = "TypeAliasDeclaration"; - SyntaxKind[SyntaxKind["EnumDeclaration"] = 217] = "EnumDeclaration"; - SyntaxKind[SyntaxKind["ModuleDeclaration"] = 218] = "ModuleDeclaration"; - SyntaxKind[SyntaxKind["ModuleBlock"] = 219] = "ModuleBlock"; - SyntaxKind[SyntaxKind["CaseBlock"] = 220] = "CaseBlock"; - SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 221] = "ImportEqualsDeclaration"; - SyntaxKind[SyntaxKind["ImportDeclaration"] = 222] = "ImportDeclaration"; - SyntaxKind[SyntaxKind["ImportClause"] = 223] = "ImportClause"; - SyntaxKind[SyntaxKind["NamespaceImport"] = 224] = "NamespaceImport"; - SyntaxKind[SyntaxKind["NamedImports"] = 225] = "NamedImports"; - SyntaxKind[SyntaxKind["ImportSpecifier"] = 226] = "ImportSpecifier"; - SyntaxKind[SyntaxKind["ExportAssignment"] = 227] = "ExportAssignment"; - SyntaxKind[SyntaxKind["ExportDeclaration"] = 228] = "ExportDeclaration"; - SyntaxKind[SyntaxKind["NamedExports"] = 229] = "NamedExports"; - SyntaxKind[SyntaxKind["ExportSpecifier"] = 230] = "ExportSpecifier"; - SyntaxKind[SyntaxKind["MissingDeclaration"] = 231] = "MissingDeclaration"; + SyntaxKind[SyntaxKind["Block"] = 199] = "Block"; + SyntaxKind[SyntaxKind["VariableStatement"] = 200] = "VariableStatement"; + SyntaxKind[SyntaxKind["EmptyStatement"] = 201] = "EmptyStatement"; + SyntaxKind[SyntaxKind["ExpressionStatement"] = 202] = "ExpressionStatement"; + SyntaxKind[SyntaxKind["IfStatement"] = 203] = "IfStatement"; + SyntaxKind[SyntaxKind["DoStatement"] = 204] = "DoStatement"; + SyntaxKind[SyntaxKind["WhileStatement"] = 205] = "WhileStatement"; + SyntaxKind[SyntaxKind["ForStatement"] = 206] = "ForStatement"; + SyntaxKind[SyntaxKind["ForInStatement"] = 207] = "ForInStatement"; + SyntaxKind[SyntaxKind["ForOfStatement"] = 208] = "ForOfStatement"; + SyntaxKind[SyntaxKind["ContinueStatement"] = 209] = "ContinueStatement"; + SyntaxKind[SyntaxKind["BreakStatement"] = 210] = "BreakStatement"; + SyntaxKind[SyntaxKind["ReturnStatement"] = 211] = "ReturnStatement"; + SyntaxKind[SyntaxKind["WithStatement"] = 212] = "WithStatement"; + SyntaxKind[SyntaxKind["SwitchStatement"] = 213] = "SwitchStatement"; + SyntaxKind[SyntaxKind["LabeledStatement"] = 214] = "LabeledStatement"; + SyntaxKind[SyntaxKind["ThrowStatement"] = 215] = "ThrowStatement"; + SyntaxKind[SyntaxKind["TryStatement"] = 216] = "TryStatement"; + SyntaxKind[SyntaxKind["DebuggerStatement"] = 217] = "DebuggerStatement"; + SyntaxKind[SyntaxKind["VariableDeclaration"] = 218] = "VariableDeclaration"; + SyntaxKind[SyntaxKind["VariableDeclarationList"] = 219] = "VariableDeclarationList"; + SyntaxKind[SyntaxKind["FunctionDeclaration"] = 220] = "FunctionDeclaration"; + SyntaxKind[SyntaxKind["ClassDeclaration"] = 221] = "ClassDeclaration"; + SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 222] = "InterfaceDeclaration"; + SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 223] = "TypeAliasDeclaration"; + SyntaxKind[SyntaxKind["EnumDeclaration"] = 224] = "EnumDeclaration"; + SyntaxKind[SyntaxKind["ModuleDeclaration"] = 225] = "ModuleDeclaration"; + SyntaxKind[SyntaxKind["ModuleBlock"] = 226] = "ModuleBlock"; + SyntaxKind[SyntaxKind["CaseBlock"] = 227] = "CaseBlock"; + SyntaxKind[SyntaxKind["GlobalModuleExportDeclaration"] = 228] = "GlobalModuleExportDeclaration"; + SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 229] = "ImportEqualsDeclaration"; + SyntaxKind[SyntaxKind["ImportDeclaration"] = 230] = "ImportDeclaration"; + SyntaxKind[SyntaxKind["ImportClause"] = 231] = "ImportClause"; + SyntaxKind[SyntaxKind["NamespaceImport"] = 232] = "NamespaceImport"; + SyntaxKind[SyntaxKind["NamedImports"] = 233] = "NamedImports"; + SyntaxKind[SyntaxKind["ImportSpecifier"] = 234] = "ImportSpecifier"; + SyntaxKind[SyntaxKind["ExportAssignment"] = 235] = "ExportAssignment"; + SyntaxKind[SyntaxKind["ExportDeclaration"] = 236] = "ExportDeclaration"; + SyntaxKind[SyntaxKind["NamedExports"] = 237] = "NamedExports"; + SyntaxKind[SyntaxKind["ExportSpecifier"] = 238] = "ExportSpecifier"; + SyntaxKind[SyntaxKind["MissingDeclaration"] = 239] = "MissingDeclaration"; // Module references - SyntaxKind[SyntaxKind["ExternalModuleReference"] = 232] = "ExternalModuleReference"; + SyntaxKind[SyntaxKind["ExternalModuleReference"] = 240] = "ExternalModuleReference"; // JSX - SyntaxKind[SyntaxKind["JsxElement"] = 233] = "JsxElement"; - SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 234] = "JsxSelfClosingElement"; - SyntaxKind[SyntaxKind["JsxOpeningElement"] = 235] = "JsxOpeningElement"; - SyntaxKind[SyntaxKind["JsxText"] = 236] = "JsxText"; - SyntaxKind[SyntaxKind["JsxClosingElement"] = 237] = "JsxClosingElement"; - SyntaxKind[SyntaxKind["JsxAttribute"] = 238] = "JsxAttribute"; - SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 239] = "JsxSpreadAttribute"; - SyntaxKind[SyntaxKind["JsxExpression"] = 240] = "JsxExpression"; + SyntaxKind[SyntaxKind["JsxElement"] = 241] = "JsxElement"; + SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 242] = "JsxSelfClosingElement"; + SyntaxKind[SyntaxKind["JsxOpeningElement"] = 243] = "JsxOpeningElement"; + SyntaxKind[SyntaxKind["JsxText"] = 244] = "JsxText"; + SyntaxKind[SyntaxKind["JsxClosingElement"] = 245] = "JsxClosingElement"; + SyntaxKind[SyntaxKind["JsxAttribute"] = 246] = "JsxAttribute"; + SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 247] = "JsxSpreadAttribute"; + SyntaxKind[SyntaxKind["JsxExpression"] = 248] = "JsxExpression"; // Clauses - SyntaxKind[SyntaxKind["CaseClause"] = 241] = "CaseClause"; - SyntaxKind[SyntaxKind["DefaultClause"] = 242] = "DefaultClause"; - SyntaxKind[SyntaxKind["HeritageClause"] = 243] = "HeritageClause"; - SyntaxKind[SyntaxKind["CatchClause"] = 244] = "CatchClause"; + SyntaxKind[SyntaxKind["CaseClause"] = 249] = "CaseClause"; + SyntaxKind[SyntaxKind["DefaultClause"] = 250] = "DefaultClause"; + SyntaxKind[SyntaxKind["HeritageClause"] = 251] = "HeritageClause"; + SyntaxKind[SyntaxKind["CatchClause"] = 252] = "CatchClause"; // Property assignments - SyntaxKind[SyntaxKind["PropertyAssignment"] = 245] = "PropertyAssignment"; - SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 246] = "ShorthandPropertyAssignment"; + SyntaxKind[SyntaxKind["PropertyAssignment"] = 253] = "PropertyAssignment"; + SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 254] = "ShorthandPropertyAssignment"; // Enum - SyntaxKind[SyntaxKind["EnumMember"] = 247] = "EnumMember"; + SyntaxKind[SyntaxKind["EnumMember"] = 255] = "EnumMember"; // Top-level nodes - SyntaxKind[SyntaxKind["SourceFile"] = 248] = "SourceFile"; - // JSDoc nodes. - SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 249] = "JSDocTypeExpression"; - // The * type. - SyntaxKind[SyntaxKind["JSDocAllType"] = 250] = "JSDocAllType"; - // The ? type. - SyntaxKind[SyntaxKind["JSDocUnknownType"] = 251] = "JSDocUnknownType"; - SyntaxKind[SyntaxKind["JSDocArrayType"] = 252] = "JSDocArrayType"; - SyntaxKind[SyntaxKind["JSDocUnionType"] = 253] = "JSDocUnionType"; - SyntaxKind[SyntaxKind["JSDocTupleType"] = 254] = "JSDocTupleType"; - SyntaxKind[SyntaxKind["JSDocNullableType"] = 255] = "JSDocNullableType"; - SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 256] = "JSDocNonNullableType"; - SyntaxKind[SyntaxKind["JSDocRecordType"] = 257] = "JSDocRecordType"; - SyntaxKind[SyntaxKind["JSDocRecordMember"] = 258] = "JSDocRecordMember"; - SyntaxKind[SyntaxKind["JSDocTypeReference"] = 259] = "JSDocTypeReference"; - SyntaxKind[SyntaxKind["JSDocOptionalType"] = 260] = "JSDocOptionalType"; - SyntaxKind[SyntaxKind["JSDocFunctionType"] = 261] = "JSDocFunctionType"; - SyntaxKind[SyntaxKind["JSDocVariadicType"] = 262] = "JSDocVariadicType"; - SyntaxKind[SyntaxKind["JSDocConstructorType"] = 263] = "JSDocConstructorType"; - SyntaxKind[SyntaxKind["JSDocThisType"] = 264] = "JSDocThisType"; - SyntaxKind[SyntaxKind["JSDocComment"] = 265] = "JSDocComment"; - SyntaxKind[SyntaxKind["JSDocTag"] = 266] = "JSDocTag"; - SyntaxKind[SyntaxKind["JSDocParameterTag"] = 267] = "JSDocParameterTag"; - SyntaxKind[SyntaxKind["JSDocReturnTag"] = 268] = "JSDocReturnTag"; - SyntaxKind[SyntaxKind["JSDocTypeTag"] = 269] = "JSDocTypeTag"; - SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 270] = "JSDocTemplateTag"; + SyntaxKind[SyntaxKind["SourceFile"] = 256] = "SourceFile"; + // JSDoc nodes + SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 257] = "JSDocTypeExpression"; + // The * type + SyntaxKind[SyntaxKind["JSDocAllType"] = 258] = "JSDocAllType"; + // The ? type + SyntaxKind[SyntaxKind["JSDocUnknownType"] = 259] = "JSDocUnknownType"; + SyntaxKind[SyntaxKind["JSDocArrayType"] = 260] = "JSDocArrayType"; + SyntaxKind[SyntaxKind["JSDocUnionType"] = 261] = "JSDocUnionType"; + SyntaxKind[SyntaxKind["JSDocTupleType"] = 262] = "JSDocTupleType"; + SyntaxKind[SyntaxKind["JSDocNullableType"] = 263] = "JSDocNullableType"; + SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 264] = "JSDocNonNullableType"; + SyntaxKind[SyntaxKind["JSDocRecordType"] = 265] = "JSDocRecordType"; + SyntaxKind[SyntaxKind["JSDocRecordMember"] = 266] = "JSDocRecordMember"; + SyntaxKind[SyntaxKind["JSDocTypeReference"] = 267] = "JSDocTypeReference"; + SyntaxKind[SyntaxKind["JSDocOptionalType"] = 268] = "JSDocOptionalType"; + SyntaxKind[SyntaxKind["JSDocFunctionType"] = 269] = "JSDocFunctionType"; + SyntaxKind[SyntaxKind["JSDocVariadicType"] = 270] = "JSDocVariadicType"; + SyntaxKind[SyntaxKind["JSDocConstructorType"] = 271] = "JSDocConstructorType"; + SyntaxKind[SyntaxKind["JSDocThisType"] = 272] = "JSDocThisType"; + SyntaxKind[SyntaxKind["JSDocComment"] = 273] = "JSDocComment"; + SyntaxKind[SyntaxKind["JSDocTag"] = 274] = "JSDocTag"; + SyntaxKind[SyntaxKind["JSDocParameterTag"] = 275] = "JSDocParameterTag"; + SyntaxKind[SyntaxKind["JSDocReturnTag"] = 276] = "JSDocReturnTag"; + SyntaxKind[SyntaxKind["JSDocTypeTag"] = 277] = "JSDocTypeTag"; + SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 278] = "JSDocTemplateTag"; // Synthesized list - SyntaxKind[SyntaxKind["SyntaxList"] = 271] = "SyntaxList"; + SyntaxKind[SyntaxKind["SyntaxList"] = 279] = "SyntaxList"; // Enum value count - SyntaxKind[SyntaxKind["Count"] = 272] = "Count"; + SyntaxKind[SyntaxKind["Count"] = 280] = "Count"; // Markers SyntaxKind[SyntaxKind["FirstAssignment"] = 56] = "FirstAssignment"; SyntaxKind[SyntaxKind["LastAssignment"] = 68] = "LastAssignment"; SyntaxKind[SyntaxKind["FirstReservedWord"] = 70] = "FirstReservedWord"; SyntaxKind[SyntaxKind["LastReservedWord"] = 105] = "LastReservedWord"; SyntaxKind[SyntaxKind["FirstKeyword"] = 70] = "FirstKeyword"; - SyntaxKind[SyntaxKind["LastKeyword"] = 134] = "LastKeyword"; + SyntaxKind[SyntaxKind["LastKeyword"] = 138] = "LastKeyword"; SyntaxKind[SyntaxKind["FirstFutureReservedWord"] = 106] = "FirstFutureReservedWord"; SyntaxKind[SyntaxKind["LastFutureReservedWord"] = 114] = "LastFutureReservedWord"; - SyntaxKind[SyntaxKind["FirstTypeNode"] = 151] = "FirstTypeNode"; - SyntaxKind[SyntaxKind["LastTypeNode"] = 160] = "LastTypeNode"; + SyntaxKind[SyntaxKind["FirstTypeNode"] = 154] = "FirstTypeNode"; + SyntaxKind[SyntaxKind["LastTypeNode"] = 166] = "LastTypeNode"; SyntaxKind[SyntaxKind["FirstPunctuation"] = 15] = "FirstPunctuation"; SyntaxKind[SyntaxKind["LastPunctuation"] = 68] = "LastPunctuation"; SyntaxKind[SyntaxKind["FirstToken"] = 0] = "FirstToken"; - SyntaxKind[SyntaxKind["LastToken"] = 134] = "LastToken"; + SyntaxKind[SyntaxKind["LastToken"] = 138] = "LastToken"; SyntaxKind[SyntaxKind["FirstTriviaToken"] = 2] = "FirstTriviaToken"; SyntaxKind[SyntaxKind["LastTriviaToken"] = 7] = "LastTriviaToken"; SyntaxKind[SyntaxKind["FirstLiteralToken"] = 8] = "FirstLiteralToken"; @@ -345,73 +358,61 @@ var ts; SyntaxKind[SyntaxKind["LastTemplateToken"] = 14] = "LastTemplateToken"; SyntaxKind[SyntaxKind["FirstBinaryOperator"] = 25] = "FirstBinaryOperator"; SyntaxKind[SyntaxKind["LastBinaryOperator"] = 68] = "LastBinaryOperator"; - SyntaxKind[SyntaxKind["FirstNode"] = 135] = "FirstNode"; + SyntaxKind[SyntaxKind["FirstNode"] = 139] = "FirstNode"; })(ts.SyntaxKind || (ts.SyntaxKind = {})); var SyntaxKind = ts.SyntaxKind; (function (NodeFlags) { NodeFlags[NodeFlags["None"] = 0] = "None"; - NodeFlags[NodeFlags["Export"] = 2] = "Export"; - NodeFlags[NodeFlags["Ambient"] = 4] = "Ambient"; - NodeFlags[NodeFlags["Public"] = 8] = "Public"; - NodeFlags[NodeFlags["Private"] = 16] = "Private"; - NodeFlags[NodeFlags["Protected"] = 32] = "Protected"; - NodeFlags[NodeFlags["Static"] = 64] = "Static"; + NodeFlags[NodeFlags["Export"] = 1] = "Export"; + NodeFlags[NodeFlags["Ambient"] = 2] = "Ambient"; + NodeFlags[NodeFlags["Public"] = 4] = "Public"; + NodeFlags[NodeFlags["Private"] = 8] = "Private"; + NodeFlags[NodeFlags["Protected"] = 16] = "Protected"; + NodeFlags[NodeFlags["Static"] = 32] = "Static"; + NodeFlags[NodeFlags["Readonly"] = 64] = "Readonly"; NodeFlags[NodeFlags["Abstract"] = 128] = "Abstract"; NodeFlags[NodeFlags["Async"] = 256] = "Async"; NodeFlags[NodeFlags["Default"] = 512] = "Default"; - NodeFlags[NodeFlags["MultiLine"] = 1024] = "MultiLine"; - NodeFlags[NodeFlags["Synthetic"] = 2048] = "Synthetic"; - NodeFlags[NodeFlags["DeclarationFile"] = 4096] = "DeclarationFile"; - NodeFlags[NodeFlags["Let"] = 8192] = "Let"; - NodeFlags[NodeFlags["Const"] = 16384] = "Const"; - NodeFlags[NodeFlags["OctalLiteral"] = 32768] = "OctalLiteral"; - NodeFlags[NodeFlags["Namespace"] = 65536] = "Namespace"; - NodeFlags[NodeFlags["ExportContext"] = 131072] = "ExportContext"; - NodeFlags[NodeFlags["ContainsThis"] = 262144] = "ContainsThis"; - NodeFlags[NodeFlags["HasImplicitReturn"] = 524288] = "HasImplicitReturn"; - NodeFlags[NodeFlags["HasExplicitReturn"] = 1048576] = "HasExplicitReturn"; - NodeFlags[NodeFlags["Modifier"] = 1022] = "Modifier"; - NodeFlags[NodeFlags["AccessibilityModifier"] = 56] = "AccessibilityModifier"; - NodeFlags[NodeFlags["BlockScoped"] = 24576] = "BlockScoped"; - NodeFlags[NodeFlags["ReachabilityCheckFlags"] = 1572864] = "ReachabilityCheckFlags"; + NodeFlags[NodeFlags["Let"] = 1024] = "Let"; + NodeFlags[NodeFlags["Const"] = 2048] = "Const"; + NodeFlags[NodeFlags["Namespace"] = 4096] = "Namespace"; + NodeFlags[NodeFlags["ExportContext"] = 8192] = "ExportContext"; + NodeFlags[NodeFlags["ContainsThis"] = 16384] = "ContainsThis"; + NodeFlags[NodeFlags["HasImplicitReturn"] = 32768] = "HasImplicitReturn"; + NodeFlags[NodeFlags["HasExplicitReturn"] = 65536] = "HasExplicitReturn"; + NodeFlags[NodeFlags["GlobalAugmentation"] = 131072] = "GlobalAugmentation"; + NodeFlags[NodeFlags["HasClassExtends"] = 262144] = "HasClassExtends"; + NodeFlags[NodeFlags["HasDecorators"] = 524288] = "HasDecorators"; + NodeFlags[NodeFlags["HasParamDecorators"] = 1048576] = "HasParamDecorators"; + NodeFlags[NodeFlags["HasAsyncFunctions"] = 2097152] = "HasAsyncFunctions"; + NodeFlags[NodeFlags["DisallowInContext"] = 4194304] = "DisallowInContext"; + NodeFlags[NodeFlags["YieldContext"] = 8388608] = "YieldContext"; + NodeFlags[NodeFlags["DecoratorContext"] = 16777216] = "DecoratorContext"; + NodeFlags[NodeFlags["AwaitContext"] = 33554432] = "AwaitContext"; + NodeFlags[NodeFlags["ThisNodeHasError"] = 67108864] = "ThisNodeHasError"; + NodeFlags[NodeFlags["JavaScriptFile"] = 134217728] = "JavaScriptFile"; + NodeFlags[NodeFlags["ThisNodeOrAnySubNodesHasError"] = 268435456] = "ThisNodeOrAnySubNodesHasError"; + NodeFlags[NodeFlags["HasAggregatedChildData"] = 536870912] = "HasAggregatedChildData"; + NodeFlags[NodeFlags["HasJsxSpreadAttribute"] = 1073741824] = "HasJsxSpreadAttribute"; + NodeFlags[NodeFlags["Modifier"] = 1023] = "Modifier"; + NodeFlags[NodeFlags["AccessibilityModifier"] = 28] = "AccessibilityModifier"; + // Accessibility modifiers and 'readonly' can be attached to a parameter in a constructor to make it a property. + NodeFlags[NodeFlags["ParameterPropertyModifier"] = 92] = "ParameterPropertyModifier"; + NodeFlags[NodeFlags["BlockScoped"] = 3072] = "BlockScoped"; + NodeFlags[NodeFlags["ReachabilityCheckFlags"] = 98304] = "ReachabilityCheckFlags"; + NodeFlags[NodeFlags["EmitHelperFlags"] = 3932160] = "EmitHelperFlags"; + // Parsing context flags + NodeFlags[NodeFlags["ContextFlags"] = 197132288] = "ContextFlags"; + // Exclude these flags when parsing a Type + NodeFlags[NodeFlags["TypeExcludesFlags"] = 41943040] = "TypeExcludesFlags"; })(ts.NodeFlags || (ts.NodeFlags = {})); var NodeFlags = ts.NodeFlags; - /* @internal */ - (function (ParserContextFlags) { - ParserContextFlags[ParserContextFlags["None"] = 0] = "None"; - // If this node was parsed in a context where 'in-expressions' are not allowed. - ParserContextFlags[ParserContextFlags["DisallowIn"] = 1] = "DisallowIn"; - // If this node was parsed in the 'yield' context created when parsing a generator. - ParserContextFlags[ParserContextFlags["Yield"] = 2] = "Yield"; - // If this node was parsed as part of a decorator - ParserContextFlags[ParserContextFlags["Decorator"] = 4] = "Decorator"; - // If this node was parsed in the 'await' context created when parsing an async function. - ParserContextFlags[ParserContextFlags["Await"] = 8] = "Await"; - // If the parser encountered an error when parsing the code that created this node. Note - // the parser only sets this directly on the node it creates right after encountering the - // error. - ParserContextFlags[ParserContextFlags["ThisNodeHasError"] = 16] = "ThisNodeHasError"; - // This node was parsed in a JavaScript file and can be processed differently. For example - // its type can be specified usign a JSDoc comment. - ParserContextFlags[ParserContextFlags["JavaScriptFile"] = 32] = "JavaScriptFile"; - // Context flags set directly by the parser. - ParserContextFlags[ParserContextFlags["ParserGeneratedFlags"] = 31] = "ParserGeneratedFlags"; - // Exclude these flags when parsing a Type - ParserContextFlags[ParserContextFlags["TypeExcludesFlags"] = 10] = "TypeExcludesFlags"; - // Context flags computed by aggregating child flags upwards. - // Used during incremental parsing to determine if this node or any of its children had an - // error. Computed only once and then cached. - ParserContextFlags[ParserContextFlags["ThisNodeOrAnySubNodesHasError"] = 64] = "ThisNodeOrAnySubNodesHasError"; - // Used to know if we've computed data from children and cached it in this node. - ParserContextFlags[ParserContextFlags["HasAggregatedChildData"] = 128] = "HasAggregatedChildData"; - })(ts.ParserContextFlags || (ts.ParserContextFlags = {})); - var ParserContextFlags = ts.ParserContextFlags; (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["ClassElement"] = 4] = "ClassElement"; - JsxFlags[JsxFlags["UnknownElement"] = 8] = "UnknownElement"; JsxFlags[JsxFlags["IntrinsicElement"] = 3] = "IntrinsicElement"; })(ts.JsxFlags || (ts.JsxFlags = {})); var JsxFlags = ts.JsxFlags; @@ -422,11 +423,25 @@ var ts; RelationComparisonResult[RelationComparisonResult["FailedAndReported"] = 3] = "FailedAndReported"; })(ts.RelationComparisonResult || (ts.RelationComparisonResult = {})); var RelationComparisonResult = ts.RelationComparisonResult; + (function (FlowFlags) { + FlowFlags[FlowFlags["Unreachable"] = 1] = "Unreachable"; + FlowFlags[FlowFlags["Start"] = 2] = "Start"; + FlowFlags[FlowFlags["BranchLabel"] = 4] = "BranchLabel"; + FlowFlags[FlowFlags["LoopLabel"] = 8] = "LoopLabel"; + FlowFlags[FlowFlags["Assignment"] = 16] = "Assignment"; + FlowFlags[FlowFlags["TrueCondition"] = 32] = "TrueCondition"; + FlowFlags[FlowFlags["FalseCondition"] = 64] = "FalseCondition"; + FlowFlags[FlowFlags["Referenced"] = 128] = "Referenced"; + FlowFlags[FlowFlags["Shared"] = 256] = "Shared"; + FlowFlags[FlowFlags["Label"] = 12] = "Label"; + FlowFlags[FlowFlags["Condition"] = 96] = "Condition"; + })(ts.FlowFlags || (ts.FlowFlags = {})); + var FlowFlags = ts.FlowFlags; var OperationCanceledException = (function () { function OperationCanceledException() { } return OperationCanceledException; - })(); + }()); ts.OperationCanceledException = OperationCanceledException; /** Return code used by getEmitOutput function to indicate status of the function */ (function (ExitStatus) { @@ -450,6 +465,7 @@ var ts; TypeFormatFlags[TypeFormatFlags["WriteTypeArgumentsOfSignature"] = 32] = "WriteTypeArgumentsOfSignature"; TypeFormatFlags[TypeFormatFlags["InElementType"] = 64] = "InElementType"; TypeFormatFlags[TypeFormatFlags["UseFullyQualifiedType"] = 128] = "UseFullyQualifiedType"; + TypeFormatFlags[TypeFormatFlags["InFirstTypeArgument"] = 256] = "InFirstTypeArgument"; })(ts.TypeFormatFlags || (ts.TypeFormatFlags = {})); var TypeFormatFlags = ts.TypeFormatFlags; (function (SymbolFormatFlags) { @@ -472,6 +488,11 @@ var ts; SymbolAccessibility[SymbolAccessibility["CannotBeNamed"] = 2] = "CannotBeNamed"; })(ts.SymbolAccessibility || (ts.SymbolAccessibility = {})); var SymbolAccessibility = ts.SymbolAccessibility; + (function (TypePredicateKind) { + TypePredicateKind[TypePredicateKind["This"] = 0] = "This"; + TypePredicateKind[TypePredicateKind["Identifier"] = 1] = "Identifier"; + })(ts.TypePredicateKind || (ts.TypePredicateKind = {})); + var TypePredicateKind = ts.TypePredicateKind; /** Indicates how to serialize the name for a TypeReferenceNode when emitting decorator * metadata */ /* @internal */ @@ -573,21 +594,20 @@ var ts; NodeCheckFlags[NodeCheckFlags["TypeChecked"] = 1] = "TypeChecked"; NodeCheckFlags[NodeCheckFlags["LexicalThis"] = 2] = "LexicalThis"; NodeCheckFlags[NodeCheckFlags["CaptureThis"] = 4] = "CaptureThis"; - NodeCheckFlags[NodeCheckFlags["EmitExtends"] = 8] = "EmitExtends"; - NodeCheckFlags[NodeCheckFlags["EmitDecorate"] = 16] = "EmitDecorate"; - NodeCheckFlags[NodeCheckFlags["EmitParam"] = 32] = "EmitParam"; - NodeCheckFlags[NodeCheckFlags["EmitAwaiter"] = 64] = "EmitAwaiter"; - NodeCheckFlags[NodeCheckFlags["EmitGenerator"] = 128] = "EmitGenerator"; NodeCheckFlags[NodeCheckFlags["SuperInstance"] = 256] = "SuperInstance"; NodeCheckFlags[NodeCheckFlags["SuperStatic"] = 512] = "SuperStatic"; NodeCheckFlags[NodeCheckFlags["ContextChecked"] = 1024] = "ContextChecked"; - NodeCheckFlags[NodeCheckFlags["LexicalArguments"] = 2048] = "LexicalArguments"; - NodeCheckFlags[NodeCheckFlags["CaptureArguments"] = 4096] = "CaptureArguments"; - // Values for enum members have been computed, and any errors have been reported for them. - NodeCheckFlags[NodeCheckFlags["EnumValuesComputed"] = 8192] = "EnumValuesComputed"; - NodeCheckFlags[NodeCheckFlags["BlockScopedBindingInLoop"] = 16384] = "BlockScopedBindingInLoop"; + NodeCheckFlags[NodeCheckFlags["AsyncMethodWithSuper"] = 2048] = "AsyncMethodWithSuper"; + NodeCheckFlags[NodeCheckFlags["AsyncMethodWithSuperBinding"] = 4096] = "AsyncMethodWithSuperBinding"; + NodeCheckFlags[NodeCheckFlags["CaptureArguments"] = 8192] = "CaptureArguments"; + NodeCheckFlags[NodeCheckFlags["EnumValuesComputed"] = 16384] = "EnumValuesComputed"; NodeCheckFlags[NodeCheckFlags["LexicalModuleMergesWithClass"] = 32768] = "LexicalModuleMergesWithClass"; - NodeCheckFlags[NodeCheckFlags["LoopWithBlockScopedBindingCapturedInFunction"] = 65536] = "LoopWithBlockScopedBindingCapturedInFunction"; + NodeCheckFlags[NodeCheckFlags["LoopWithCapturedBlockScopedBinding"] = 65536] = "LoopWithCapturedBlockScopedBinding"; + NodeCheckFlags[NodeCheckFlags["CapturedBlockScopedBinding"] = 131072] = "CapturedBlockScopedBinding"; + NodeCheckFlags[NodeCheckFlags["BlockScopedBindingInLoop"] = 262144] = "BlockScopedBindingInLoop"; + NodeCheckFlags[NodeCheckFlags["ClassWithBodyScopedClassBinding"] = 524288] = "ClassWithBodyScopedClassBinding"; + NodeCheckFlags[NodeCheckFlags["BodyScopedClassBinding"] = 1048576] = "BodyScopedClassBinding"; + NodeCheckFlags[NodeCheckFlags["NeedsLoopOutParameter"] = 2097152] = "NeedsLoopOutParameter"; })(ts.NodeCheckFlags || (ts.NodeCheckFlags = {})); var NodeCheckFlags = ts.NodeCheckFlags; (function (TypeFlags) { @@ -623,8 +643,11 @@ var ts; TypeFlags[TypeFlags["ESSymbol"] = 16777216] = "ESSymbol"; TypeFlags[TypeFlags["ThisType"] = 33554432] = "ThisType"; TypeFlags[TypeFlags["ObjectLiteralPatternWithComputedProperties"] = 67108864] = "ObjectLiteralPatternWithComputedProperties"; + TypeFlags[TypeFlags["Never"] = 134217728] = "Never"; /* @internal */ - TypeFlags[TypeFlags["Intrinsic"] = 16777343] = "Intrinsic"; + TypeFlags[TypeFlags["Nullable"] = 96] = "Nullable"; + /* @internal */ + TypeFlags[TypeFlags["Intrinsic"] = 150995071] = "Intrinsic"; /* @internal */ TypeFlags[TypeFlags["Primitive"] = 16777726] = "Primitive"; TypeFlags[TypeFlags["StringLike"] = 258] = "StringLike"; @@ -632,6 +655,7 @@ var ts; TypeFlags[TypeFlags["ObjectType"] = 80896] = "ObjectType"; TypeFlags[TypeFlags["UnionOrIntersection"] = 49152] = "UnionOrIntersection"; TypeFlags[TypeFlags["StructuredType"] = 130048] = "StructuredType"; + TypeFlags[TypeFlags["Narrowable"] = 97793] = "Narrowable"; /* @internal */ TypeFlags[TypeFlags["RequiresWidening"] = 6291456] = "RequiresWidening"; /* @internal */ @@ -648,6 +672,19 @@ var ts; IndexKind[IndexKind["Number"] = 1] = "Number"; })(ts.IndexKind || (ts.IndexKind = {})); var IndexKind = ts.IndexKind; + /* @internal */ + (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"; + })(ts.SpecialPropertyAssignmentKind || (ts.SpecialPropertyAssignmentKind = {})); + var SpecialPropertyAssignmentKind = ts.SpecialPropertyAssignmentKind; (function (DiagnosticCategory) { DiagnosticCategory[DiagnosticCategory["Warning"] = 0] = "Warning"; DiagnosticCategory[DiagnosticCategory["Error"] = 1] = "Error"; @@ -680,6 +717,14 @@ var ts; NewLineKind[NewLineKind["LineFeed"] = 1] = "LineFeed"; })(ts.NewLineKind || (ts.NewLineKind = {})); var NewLineKind = ts.NewLineKind; + (function (ScriptKind) { + ScriptKind[ScriptKind["Unknown"] = 0] = "Unknown"; + ScriptKind[ScriptKind["JS"] = 1] = "JS"; + ScriptKind[ScriptKind["JSX"] = 2] = "JSX"; + ScriptKind[ScriptKind["TS"] = 3] = "TS"; + ScriptKind[ScriptKind["TSX"] = 4] = "TSX"; + })(ts.ScriptKind || (ts.ScriptKind = {})); + var ScriptKind = ts.ScriptKind; (function (ScriptTarget) { ScriptTarget[ScriptTarget["ES3"] = 0] = "ES3"; ScriptTarget[ScriptTarget["ES5"] = 1] = "ES5"; @@ -915,11 +960,11 @@ var ts; return undefined; } ts.forEach = forEach; - function contains(array, value) { + function contains(array, value, areEqual) { if (array) { for (var _i = 0, array_1 = array; _i < array_1.length; _i++) { var v = array_1[_i]; - if (v === value) { + if (areEqual ? areEqual(v, value) : v === value) { return true; } } @@ -985,13 +1030,13 @@ var ts; return array1.concat(array2); } ts.concatenate = concatenate; - function deduplicate(array) { + function deduplicate(array, areEqual) { var result; if (array) { result = []; for (var _i = 0, array_5 = array; _i < array_5.length; _i++) { var item = array_5[_i]; - if (!contains(result, item)) { + if (!contains(result, item, areEqual)) { result.push(item); } } @@ -1068,9 +1113,17 @@ var ts; var count = array.length; if (count > 0) { var pos = 0; - var result = arguments.length <= 2 ? array[pos++] : initial; + var result = void 0; + if (arguments.length <= 2) { + result = array[pos]; + pos++; + } + else { + result = initial; + } while (pos < count) { - result = f(result, array[pos++]); + result = f(result, array[pos]); + pos++; } return result; } @@ -1082,9 +1135,17 @@ var ts; if (array) { var pos = array.length - 1; if (pos >= 0) { - var result = arguments.length <= 2 ? array[pos--] : initial; + var result = void 0; + if (arguments.length <= 2) { + result = array[pos]; + pos--; + } + else { + result = initial; + } while (pos >= 0) { - result = f(result, array[pos--]); + result = f(result, array[pos]); + pos--; } return result; } @@ -1097,6 +1158,14 @@ var ts; return hasOwnProperty.call(map, key); } ts.hasProperty = hasProperty; + function getKeys(map) { + var keys = []; + for (var key in map) { + keys.push(key); + } + return keys; + } + ts.getKeys = getKeys; function getProperty(map, key) { return hasOwnProperty.call(map, key) ? map[key] : undefined; } @@ -1177,6 +1246,32 @@ var ts; return result; } ts.arrayToMap = arrayToMap; + /** + * Reduce the properties of a map. + * + * @param map The map to reduce + * @param callback An aggregation function that is called for each entry in the map + * @param initial The initial value for the reduction. + */ + function reduceProperties(map, callback, initial) { + var result = initial; + if (map) { + for (var key in map) { + if (hasProperty(map, key)) { + result = callback(result, map[key], String(key)); + } + } + } + return result; + } + ts.reduceProperties = reduceProperties; + /** + * Tests whether a value is an array. + */ + function isArray(value) { + return Array.isArray ? Array.isArray(value) : value instanceof Array; + } + ts.isArray = isArray; function memoize(callback) { var value; return function () { @@ -1221,6 +1316,15 @@ var ts; }; } ts.createFileDiagnostic = createFileDiagnostic; + /* internal */ + function formatMessage(dummy, message) { + var text = getLocaleSpecificMessage(message); + if (arguments.length > 2) { + text = formatStringFromArgs(text, arguments, 2); + } + return text; + } + ts.formatMessage = formatMessage; function createCompilerDiagnostic(message) { var text = getLocaleSpecificMessage(message); if (arguments.length > 1) { @@ -1423,7 +1527,7 @@ var ts; } ts.getNormalizedPathFromPathComponents = getNormalizedPathFromPathComponents; function getNormalizedPathComponentsOfUrl(url) { - // Get root length of http://www.website.com/folder1/foler2/ + // Get root length of http://www.website.com/folder1/folder2/ // In this example the root is: http://www.website.com/ // normalized path components should be ["http://www.website.com/", "folder1", "folder2"] var urlLength = url.length; @@ -1448,7 +1552,7 @@ var ts; var indexOfNextSlash = url.indexOf(ts.directorySeparator, rootLength); if (indexOfNextSlash !== -1) { // Found the "/" after the website.com so the root is length of http://www.website.com/ - // and get components afetr the root normally like any other folder components + // and get components after the root normally like any other folder components rootLength = indexOfNextSlash + 1; return normalizedPathComponents(url, rootLength); } @@ -1477,7 +1581,8 @@ var ts; directoryComponents.length--; } // Find the component that differs - for (var joinStartIndex = 0; joinStartIndex < pathComponents.length && joinStartIndex < directoryComponents.length; joinStartIndex++) { + var joinStartIndex; + for (joinStartIndex = 0; joinStartIndex < pathComponents.length && joinStartIndex < directoryComponents.length; joinStartIndex++) { if (getCanonicalFileName(directoryComponents[joinStartIndex]) !== getCanonicalFileName(pathComponents[joinStartIndex])) { break; } @@ -1502,7 +1607,7 @@ var ts; } ts.getRelativePathToDirectoryOrUrl = getRelativePathToDirectoryOrUrl; function getBaseFileName(path) { - if (!path) { + if (path === undefined) { return undefined; } var i = path.lastIndexOf(ts.directorySeparator); @@ -1527,17 +1632,48 @@ var ts; return pathLen > extLen && path.substr(pathLen - extLen, extLen) === extension; } ts.fileExtensionIs = fileExtensionIs; + 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 */; + } + ts.ensureScriptKind = ensureScriptKind; + function getScriptKindFromFileName(fileName) { + var ext = fileName.substr(fileName.lastIndexOf(".")); + switch (ext.toLowerCase()) { + case ".js": + return 1 /* JS */; + case ".jsx": + return 2 /* JSX */; + case ".ts": + return 3 /* TS */; + case ".tsx": + return 4 /* TSX */; + default: + return 0 /* Unknown */; + } + } + ts.getScriptKindFromFileName = getScriptKindFromFileName; /** * List of supported extensions in order of file resolution precedence. */ - ts.supportedExtensions = [".ts", ".tsx", ".d.ts"]; - ts.supportedJsExtensions = ts.supportedExtensions.concat(".js", ".jsx"); - function isSupportedSourceFileName(fileName) { + ts.supportedTypeScriptExtensions = [".ts", ".tsx", ".d.ts"]; + ts.supportedJavascriptExtensions = [".js", ".jsx"]; + var allSupportedExtensions = ts.supportedTypeScriptExtensions.concat(ts.supportedJavascriptExtensions); + function getSupportedExtensions(options) { + return options && options.allowJs ? allSupportedExtensions : ts.supportedTypeScriptExtensions; + } + ts.getSupportedExtensions = getSupportedExtensions; + function isSupportedSourceFileName(fileName, compilerOptions) { if (!fileName) { return false; } - for (var _i = 0, supportedExtensions_1 = ts.supportedExtensions; _i < supportedExtensions_1.length; _i++) { - var extension = supportedExtensions_1[_i]; + for (var _i = 0, _a = getSupportedExtensions(compilerOptions); _i < _a.length; _i++) { + var extension = _a[_i]; if (fileExtensionIs(fileName, extension)) { return true; } @@ -1556,22 +1692,6 @@ var ts; return path; } ts.removeFileExtension = removeFileExtension; - var backslashOrDoubleQuote = /[\"\\]/g; - var escapedCharsRegExp = /[\u0000-\u001f\t\v\f\b\r\n\u2028\u2029\u0085]/g; - var escapedCharsMap = { - "\0": "\\0", - "\t": "\\t", - "\v": "\\v", - "\f": "\\f", - "\b": "\\b", - "\r": "\\r", - "\n": "\\n", - "\\": "\\\\", - "\"": "\\\"", - "\u2028": "\\u2028", - "\u2029": "\\u2029", - "\u0085": "\\u0085" // nextLine - }; function Symbol(flags, name) { this.flags = flags; this.name = name; @@ -1622,7 +1742,7 @@ var ts; } Debug.assert = assert; function fail(message) { - Debug.assert(false, message); + Debug.assert(/*expression*/ false, message); } Debug.fail = fail; })(Debug = ts.Debug || (ts.Debug = {})); @@ -1637,6 +1757,12 @@ var ts; return copiedList; } ts.copyListRemovingItem = copyListRemovingItem; + function createGetCanonicalFileName(useCaseSensitivefileNames) { + return useCaseSensitivefileNames + ? (function (fileName) { return fileName; }) + : (function (fileName) { return fileName.toLowerCase(); }); + } + ts.createGetCanonicalFileName = createGetCanonicalFileName; })(ts || (ts = {})); /// var ts; @@ -1783,91 +1909,77 @@ var ts; var _fs = require("fs"); var _path = require("path"); var _os = require("os"); - var _tty = require("tty"); - // average async stat takes about 30 microseconds - // set chunk size to do 30 files in < 1 millisecond - function createWatchedFileSet(interval, chunkSize) { - if (interval === void 0) { interval = 2500; } - if (chunkSize === void 0) { chunkSize = 30; } - var watchedFiles = []; - var nextFileToCheck = 0; - var watchTimer; - function getModifiedTime(fileName) { - return _fs.statSync(fileName).mtime; + var _crypto = require("crypto"); + var useNonPollingWatchers = process.env["TSC_NONPOLLING_WATCHER"]; + function createWatchedFileSet() { + var dirWatchers = {}; + // One file can have multiple watchers + var fileWatcherCallbacks = {}; + return { addFile: addFile, removeFile: removeFile }; + function reduceDirWatcherRefCountForFile(fileName) { + var dirName = ts.getDirectoryPath(fileName); + if (ts.hasProperty(dirWatchers, dirName)) { + var watcher = dirWatchers[dirName]; + watcher.referenceCount -= 1; + if (watcher.referenceCount <= 0) { + watcher.close(); + delete dirWatchers[dirName]; + } + } } - function poll(checkedIndex) { - var watchedFile = watchedFiles[checkedIndex]; - if (!watchedFile) { + function addDirWatcher(dirPath) { + if (ts.hasProperty(dirWatchers, dirPath)) { + var watcher_1 = dirWatchers[dirPath]; + watcher_1.referenceCount += 1; return; } - _fs.stat(watchedFile.fileName, function (err, stats) { - if (err) { - watchedFile.callback(watchedFile.fileName); - } - else if (watchedFile.mtime.getTime() !== stats.mtime.getTime()) { - watchedFile.mtime = getModifiedTime(watchedFile.fileName); - watchedFile.callback(watchedFile.fileName, watchedFile.mtime.getTime() === 0); - } - }); + var watcher = _fs.watch(dirPath, { persistent: true }, function (eventName, relativeFileName) { return fileEventHandler(eventName, relativeFileName, dirPath); }); + watcher.referenceCount = 1; + dirWatchers[dirPath] = watcher; + return; } - // this implementation uses polling and - // stat due to inconsistencies of fs.watch - // and efficiency of stat on modern filesystems - function startWatchTimer() { - watchTimer = setInterval(function () { - var count = 0; - var nextToCheck = nextFileToCheck; - var firstCheck = -1; - while ((count < chunkSize) && (nextToCheck !== firstCheck)) { - poll(nextToCheck); - if (firstCheck < 0) { - firstCheck = nextToCheck; - } - nextToCheck++; - if (nextToCheck === watchedFiles.length) { - nextToCheck = 0; - } - count++; - } - nextFileToCheck = nextToCheck; - }, interval); + function addFileWatcherCallback(filePath, callback) { + if (ts.hasProperty(fileWatcherCallbacks, filePath)) { + fileWatcherCallbacks[filePath].push(callback); + } + else { + fileWatcherCallbacks[filePath] = [callback]; + } } function addFile(fileName, callback) { - var file = { - fileName: fileName, - callback: callback, - mtime: getModifiedTime(fileName) - }; - watchedFiles.push(file); - if (watchedFiles.length === 1) { - startWatchTimer(); + addFileWatcherCallback(fileName, callback); + addDirWatcher(ts.getDirectoryPath(fileName)); + return { fileName: fileName, callback: callback }; + } + function removeFile(watchedFile) { + removeFileWatcherCallback(watchedFile.fileName, watchedFile.callback); + reduceDirWatcherRefCountForFile(watchedFile.fileName); + } + function removeFileWatcherCallback(filePath, callback) { + if (ts.hasProperty(fileWatcherCallbacks, filePath)) { + var newCallbacks = ts.copyListRemovingItem(callback, fileWatcherCallbacks[filePath]); + if (newCallbacks.length === 0) { + delete fileWatcherCallbacks[filePath]; + } + else { + fileWatcherCallbacks[filePath] = newCallbacks; + } } - return file; } - function removeFile(file) { - watchedFiles = ts.copyListRemovingItem(file, watchedFiles); + function fileEventHandler(eventName, relativeFileName, baseDirPath) { + // When files are deleted from disk, the triggered "rename" event would have a relativefileName of "undefined" + var fileName = typeof relativeFileName !== "string" + ? undefined + : ts.getNormalizedAbsolutePath(relativeFileName, baseDirPath); + // Some applications save a working file via rename operations + if ((eventName === "change" || eventName === "rename") && ts.hasProperty(fileWatcherCallbacks, fileName)) { + for (var _i = 0, _a = fileWatcherCallbacks[fileName]; _i < _a.length; _i++) { + var fileCallback = _a[_i]; + fileCallback(fileName); + } + } } - return { - getModifiedTime: getModifiedTime, - poll: poll, - startWatchTimer: startWatchTimer, - addFile: addFile, - removeFile: removeFile - }; } - // 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 watchedFileSet = createWatchedFileSet(); function isNode4OrLater() { return parseInt(process.version.charAt(1)) >= 4; @@ -1876,7 +1988,7 @@ var ts; // win32\win64 are case insensitive platforms, MacOS (darwin) by default is also case insensitive var useCaseSensitiveFileNames = platform !== "win32" && platform !== "win64" && platform !== "darwin"; function readFile(fileName, encoding) { - if (!_fs.existsSync(fileName)) { + if (!fileExists(fileName)) { return undefined; } var buffer = _fs.readFileSync(fileName); @@ -1920,7 +2032,30 @@ var ts; } } function getCanonicalPath(path) { - return useCaseSensitiveFileNames ? path.toLowerCase() : path; + return useCaseSensitiveFileNames ? path : path.toLowerCase(); + } + var FileSystemEntryKind; + (function (FileSystemEntryKind) { + FileSystemEntryKind[FileSystemEntryKind["File"] = 0] = "File"; + FileSystemEntryKind[FileSystemEntryKind["Directory"] = 1] = "Directory"; + })(FileSystemEntryKind || (FileSystemEntryKind = {})); + function fileSystemEntryExists(path, entryKind) { + try { + var stat = _fs.statSync(path); + switch (entryKind) { + case 0 /* File */: return stat.isFile(); + case 1 /* Directory */: return stat.isDirectory(); + } + } + catch (e) { + return false; + } + } + function fileExists(path) { + return fileSystemEntryExists(path, 0 /* File */); + } + function directoryExists(path) { + return fileSystemEntryExists(path, 1 /* Directory */); } function readDirectory(path, extension, exclude) { var result = []; @@ -1932,6 +2067,11 @@ var ts; var directories = []; for (var _i = 0, files_2 = files; _i < files_2.length; _i++) { var current = files_2[_i]; + // This is necessary because on some file system node fails to exclude + // "." and "..". See https://github.com/nodejs/node/issues/4002 + if (current === "." || current === "..") { + continue; + } var name_3 = ts.combinePaths(path, current); if (!ts.contains(exclude, getCanonicalPath(name_3))) { var stat = _fs.statSync(name_3); @@ -1961,29 +2101,42 @@ var ts; readFile: readFile, writeFile: writeFile, watchFile: function (fileName, callback) { - // Node 4.0 stablized the `fs.watch` function on Windows which avoids polling - // and is more efficient than `fs.watchFile` (ref: https://github.com/nodejs/node/pull/2649 - // and https://github.com/Microsoft/TypeScript/issues/4643), therefore - // if the current node.js version is newer than 4, use `fs.watch` instead. - if (isNode4OrLater()) { - // Note: in node the callback of fs.watch is given only the relative file name as a parameter - return _fs.watch(fileName, function (eventName, relativeFileName) { return callback(fileName); }); + if (useNonPollingWatchers) { + var watchedFile_1 = watchedFileSet.addFile(fileName, callback); + return { + close: function () { return watchedFileSet.removeFile(watchedFile_1); } + }; + } + else { + _fs.watchFile(fileName, { persistent: true, interval: 250 }, fileChanged); + return { + close: function () { return _fs.unwatchFile(fileName, fileChanged); } + }; + } + function fileChanged(curr, prev) { + if (+curr.mtime <= +prev.mtime) { + return; + } + callback(fileName); } - var watchedFile = watchedFileSet.addFile(fileName, callback); - return { - close: function () { return watchedFileSet.removeFile(watchedFile); } - }; }, - watchDirectory: function (path, callback, recursive) { - // Node 4.0 `fs.watch` function supports the "recursive" option on both OSX and Windows + watchDirectory: function (directoryName, callback, recursive) { + // 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) - return _fs.watch(path, { persistent: true, recursive: !!recursive }, function (eventName, relativeFileName) { + var options; + if (isNode4OrLater() && (process.platform === "win32" || process.platform === "darwin")) { + options = { persistent: true, recursive: !!recursive }; + } + else { + options = { persistent: true }; + } + return _fs.watch(directoryName, options, 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 ? relativeFileName : ts.normalizePath(ts.combinePaths(path, relativeFileName))); + callback(!relativeFileName ? relativeFileName : ts.normalizePath(ts.combinePaths(directoryName, relativeFileName))); } ; }); @@ -1991,12 +2144,8 @@ var ts; resolvePath: function (path) { return _path.resolve(path); }, - fileExists: function (path) { - return _fs.existsSync(path); - }, - directoryExists: function (path) { - return _fs.existsSync(path) && _fs.statSync(path).isDirectory(); - }, + fileExists: fileExists, + directoryExists: directoryExists, createDirectory: function (directoryName) { if (!this.directoryExists(directoryName)) { _fs.mkdirSync(directoryName); @@ -2009,6 +2158,19 @@ var ts; return process.cwd(); }, readDirectory: readDirectory, + getModifiedTime: function (path) { + try { + return _fs.statSync(path).mtime; + } + catch (e) { + return undefined; + } + }, + createHash: function (data) { + var hash = _crypto.createHash("md5"); + hash.update(data); + return hash.digest("hex"); + }, getMemoryUsage: function () { if (global.gc) { global.gc(); @@ -2017,10 +2179,45 @@ var ts; }, exit: function (exitCode) { process.exit(exitCode); + }, + realpath: function (path) { + return _fs.realpathSync(path); } }; } - if (typeof WScript !== "undefined" && typeof ActiveXObject === "function") { + function getChakraSystem() { + var realpath = ChakraHost.realpath && (function (path) { return ChakraHost.realpath(path); }); + return { + newLine: ChakraHost.newLine || "\r\n", + args: ChakraHost.args, + 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 = "\uFEFF" + data; + } + ChakraHost.writeFile(path, data); + }, + resolvePath: ChakraHost.resolvePath, + fileExists: ChakraHost.fileExists, + directoryExists: ChakraHost.directoryExists, + createDirectory: ChakraHost.createDirectory, + getExecutingFilePath: function () { return ChakraHost.executingFile; }, + getCurrentDirectory: function () { return ChakraHost.currentDirectory; }, + readDirectory: ChakraHost.readDirectory, + exit: ChakraHost.quit, + realpath: realpath + }; + } + if (typeof ChakraHost !== "undefined") { + return getChakraSystem(); + } + else if (typeof WScript !== "undefined" && typeof ActiveXObject === "function") { return getWScriptSystem(); } else if (typeof process !== "undefined" && process.nextTick && !process.browser && typeof require !== "undefined") { @@ -2056,6 +2253,7 @@ var ts; An_index_signature_must_have_a_type_annotation: { code: 1021, category: ts.DiagnosticCategory.Error, key: "An_index_signature_must_have_a_type_annotation_1021", message: "An index signature must have a type annotation." }, An_index_signature_parameter_must_have_a_type_annotation: { code: 1022, category: ts.DiagnosticCategory.Error, key: "An_index_signature_parameter_must_have_a_type_annotation_1022", message: "An index signature parameter must have a type annotation." }, An_index_signature_parameter_type_must_be_string_or_number: { code: 1023, category: ts.DiagnosticCategory.Error, key: "An_index_signature_parameter_type_must_be_string_or_number_1023", message: "An index signature parameter type must be 'string' or 'number'." }, + readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature: { code: 1024, category: ts.DiagnosticCategory.Error, key: "readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature_1024", message: "'readonly' modifier can only appear on a property declaration or index signature." }, Accessibility_modifier_already_seen: { code: 1028, category: ts.DiagnosticCategory.Error, key: "Accessibility_modifier_already_seen_1028", message: "Accessibility modifier already seen." }, _0_modifier_must_precede_1_modifier: { code: 1029, category: ts.DiagnosticCategory.Error, key: "_0_modifier_must_precede_1_modifier_1029", message: "'{0}' modifier must precede '{1}' modifier." }, _0_modifier_already_seen: { code: 1030, category: ts.DiagnosticCategory.Error, key: "_0_modifier_already_seen_1030", message: "'{0}' modifier already seen." }, @@ -2069,7 +2267,7 @@ var ts; _0_modifier_cannot_be_used_with_a_class_declaration: { code: 1041, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_be_used_with_a_class_declaration_1041", message: "'{0}' modifier cannot be used with a class declaration." }, _0_modifier_cannot_be_used_here: { code: 1042, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_be_used_here_1042", message: "'{0}' modifier cannot be used here." }, _0_modifier_cannot_appear_on_a_data_property: { code: 1043, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_appear_on_a_data_property_1043", message: "'{0}' modifier cannot appear on a data property." }, - _0_modifier_cannot_appear_on_a_module_element: { code: 1044, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_appear_on_a_module_element_1044", message: "'{0}' modifier cannot appear on a module element." }, + _0_modifier_cannot_appear_on_a_module_or_namespace_element: { code: 1044, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_appear_on_a_module_or_namespace_element_1044", message: "'{0}' modifier cannot appear on a module or namespace element." }, A_0_modifier_cannot_be_used_with_an_interface_declaration: { code: 1045, category: ts.DiagnosticCategory.Error, key: "A_0_modifier_cannot_be_used_with_an_interface_declaration_1045", message: "A '{0}' modifier cannot be used with an interface declaration." }, A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file: { code: 1046, category: ts.DiagnosticCategory.Error, key: "A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file_1046", message: "A 'declare' modifier is required for a top level declaration in a .d.ts file." }, A_rest_parameter_cannot_be_optional: { code: 1047, category: ts.DiagnosticCategory.Error, key: "A_rest_parameter_cannot_be_optional_1047", message: "A rest parameter cannot be optional." }, @@ -2088,8 +2286,11 @@ var ts; Enum_member_must_have_initializer: { code: 1061, category: ts.DiagnosticCategory.Error, key: "Enum_member_must_have_initializer_1061", message: "Enum member must have initializer." }, _0_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method: { code: 1062, category: ts.DiagnosticCategory.Error, key: "_0_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method_1062", message: "{0} is referenced directly or indirectly in the fulfillment callback of its own 'then' method." }, An_export_assignment_cannot_be_used_in_a_namespace: { code: 1063, category: ts.DiagnosticCategory.Error, key: "An_export_assignment_cannot_be_used_in_a_namespace_1063", message: "An export assignment cannot be used in a namespace." }, + The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type: { code: 1064, category: ts.DiagnosticCategory.Error, key: "The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_1064", message: "The return type of an async function or method must be the global Promise type." }, In_ambient_enum_declarations_member_initializer_must_be_constant_expression: { code: 1066, category: ts.DiagnosticCategory.Error, key: "In_ambient_enum_declarations_member_initializer_must_be_constant_expression_1066", message: "In ambient enum declarations member initializer must be constant expression." }, Unexpected_token_A_constructor_method_accessor_or_property_was_expected: { code: 1068, category: ts.DiagnosticCategory.Error, key: "Unexpected_token_A_constructor_method_accessor_or_property_was_expected_1068", message: "Unexpected token. A constructor, method, accessor, or property was expected." }, + _0_modifier_cannot_appear_on_a_type_member: { code: 1070, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_appear_on_a_type_member_1070", message: "'{0}' modifier cannot appear on a type member." }, + _0_modifier_cannot_appear_on_an_index_signature: { code: 1071, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_appear_on_an_index_signature_1071", message: "'{0}' modifier cannot appear on an index signature." }, A_0_modifier_cannot_be_used_with_an_import_declaration: { code: 1079, category: ts.DiagnosticCategory.Error, key: "A_0_modifier_cannot_be_used_with_an_import_declaration_1079", message: "A '{0}' modifier cannot be used with an import declaration." }, Invalid_reference_directive_syntax: { code: 1084, category: ts.DiagnosticCategory.Error, key: "Invalid_reference_directive_syntax_1084", message: "Invalid 'reference' directive syntax." }, Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher: { code: 1085, category: ts.DiagnosticCategory.Error, key: "Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_1085", message: "Octal literals are not available when targeting ECMAScript 5 and higher." }, @@ -2114,7 +2315,6 @@ var ts; A_return_statement_can_only_be_used_within_a_function_body: { code: 1108, category: ts.DiagnosticCategory.Error, key: "A_return_statement_can_only_be_used_within_a_function_body_1108", message: "A 'return' statement can only be used within a function body." }, Expression_expected: { code: 1109, category: ts.DiagnosticCategory.Error, key: "Expression_expected_1109", message: "Expression expected." }, Type_expected: { code: 1110, category: ts.DiagnosticCategory.Error, key: "Type_expected_1110", message: "Type expected." }, - A_class_member_cannot_be_declared_optional: { code: 1112, category: ts.DiagnosticCategory.Error, key: "A_class_member_cannot_be_declared_optional_1112", message: "A class member cannot be declared optional." }, A_default_clause_cannot_appear_more_than_once_in_a_switch_statement: { code: 1113, category: ts.DiagnosticCategory.Error, key: "A_default_clause_cannot_appear_more_than_once_in_a_switch_statement_1113", message: "A 'default' clause cannot appear more than once in a 'switch' statement." }, Duplicate_label_0: { code: 1114, category: ts.DiagnosticCategory.Error, key: "Duplicate_label_0_1114", message: "Duplicate label '{0}'" }, A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement: { code: 1115, category: ts.DiagnosticCategory.Error, key: "A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement_1115", message: "A 'continue' statement can only jump to a label of an enclosing iteration statement." }, @@ -2145,10 +2345,9 @@ var ts; String_literal_expected: { code: 1141, category: ts.DiagnosticCategory.Error, key: "String_literal_expected_1141", message: "String literal expected." }, Line_break_not_permitted_here: { code: 1142, category: ts.DiagnosticCategory.Error, key: "Line_break_not_permitted_here_1142", message: "Line break not permitted here." }, or_expected: { code: 1144, category: ts.DiagnosticCategory.Error, key: "or_expected_1144", message: "'{' or ';' expected." }, - Modifiers_not_permitted_on_index_signature_members: { code: 1145, category: ts.DiagnosticCategory.Error, key: "Modifiers_not_permitted_on_index_signature_members_1145", message: "Modifiers not permitted on index signature members." }, Declaration_expected: { code: 1146, category: ts.DiagnosticCategory.Error, key: "Declaration_expected_1146", message: "Declaration expected." }, Import_declarations_in_a_namespace_cannot_reference_a_module: { code: 1147, category: ts.DiagnosticCategory.Error, key: "Import_declarations_in_a_namespace_cannot_reference_a_module_1147", message: "Import declarations in a namespace cannot reference a module." }, - Cannot_compile_modules_unless_the_module_flag_is_provided: { code: 1148, category: ts.DiagnosticCategory.Error, key: "Cannot_compile_modules_unless_the_module_flag_is_provided_1148", message: "Cannot compile modules unless the '--module' flag is provided." }, + Cannot_compile_modules_unless_the_module_flag_is_provided_with_a_valid_module_type_Consider_setting_the_module_compiler_option_in_a_tsconfig_json_file: { code: 1148, category: ts.DiagnosticCategory.Error, key: "Cannot_compile_modules_unless_the_module_flag_is_provided_with_a_valid_module_type_Consider_setting__1148", message: "Cannot compile modules unless the '--module' flag is provided with a valid module type. Consider setting the 'module' compiler option in a 'tsconfig.json' file." }, File_name_0_differs_from_already_included_file_name_1_only_in_casing: { code: 1149, category: ts.DiagnosticCategory.Error, key: "File_name_0_differs_from_already_included_file_name_1_only_in_casing_1149", message: "File name '{0}' differs from already included file name '{1}' only in casing" }, new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead: { code: 1150, category: ts.DiagnosticCategory.Error, key: "new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead_1150", message: "'new T[]' cannot be used to create an array. Use 'new Array()' instead." }, const_declarations_must_be_initialized: { code: 1155, category: ts.DiagnosticCategory.Error, key: "const_declarations_must_be_initialized_1155", message: "'const' declarations must be initialized" }, @@ -2208,7 +2407,7 @@ var ts; Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode: { code: 1214, category: ts.DiagnosticCategory.Error, key: "Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode_1214", message: "Identifier expected. '{0}' is a reserved word in strict mode. Modules are automatically in strict mode." }, Invalid_use_of_0_Modules_are_automatically_in_strict_mode: { code: 1215, category: ts.DiagnosticCategory.Error, key: "Invalid_use_of_0_Modules_are_automatically_in_strict_mode_1215", message: "Invalid use of '{0}'. Modules are automatically in strict mode." }, Export_assignment_is_not_supported_when_module_flag_is_system: { code: 1218, category: ts.DiagnosticCategory.Error, key: "Export_assignment_is_not_supported_when_module_flag_is_system_1218", message: "Export assignment is not supported when '--module' flag is 'system'." }, - Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Specify_experimentalDecorators_to_remove_this_warning: { code: 1219, category: ts.DiagnosticCategory.Error, key: "Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Speci_1219", message: "Experimental support for decorators is a feature that is subject to change in a future release. Specify '--experimentalDecorators' to remove this warning." }, + Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning: { code: 1219, category: ts.DiagnosticCategory.Error, key: "Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_t_1219", message: "Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning." }, Generators_are_only_available_when_targeting_ECMAScript_6_or_higher: { code: 1220, category: ts.DiagnosticCategory.Error, key: "Generators_are_only_available_when_targeting_ECMAScript_6_or_higher_1220", message: "Generators are only available when targeting ECMAScript 6 or higher." }, Generators_are_not_allowed_in_an_ambient_context: { code: 1221, category: ts.DiagnosticCategory.Error, key: "Generators_are_not_allowed_in_an_ambient_context_1221", message: "Generators are not allowed in an ambient context." }, An_overload_signature_cannot_be_declared_as_a_generator: { code: 1222, category: ts.DiagnosticCategory.Error, key: "An_overload_signature_cannot_be_declared_as_a_generator_1222", message: "An overload signature cannot be declared as a generator." }, @@ -2231,15 +2430,25 @@ var ts; Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression: { code: 1239, category: ts.DiagnosticCategory.Error, key: "Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression_1239", message: "Unable to resolve signature of parameter decorator when called as an expression." }, Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression: { code: 1240, category: ts.DiagnosticCategory.Error, key: "Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression_1240", message: "Unable to resolve signature of property decorator when called as an expression." }, Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression: { code: 1241, category: ts.DiagnosticCategory.Error, key: "Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression_1241", message: "Unable to resolve signature of method decorator when called as an expression." }, - abstract_modifier_can_only_appear_on_a_class_or_method_declaration: { code: 1242, category: ts.DiagnosticCategory.Error, key: "abstract_modifier_can_only_appear_on_a_class_or_method_declaration_1242", message: "'abstract' modifier can only appear on a class or method declaration." }, + abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration: { code: 1242, category: ts.DiagnosticCategory.Error, key: "abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration_1242", message: "'abstract' modifier can only appear on a class, method, or property declaration." }, _0_modifier_cannot_be_used_with_1_modifier: { code: 1243, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_be_used_with_1_modifier_1243", message: "'{0}' modifier cannot be used with '{1}' modifier." }, Abstract_methods_can_only_appear_within_an_abstract_class: { code: 1244, category: ts.DiagnosticCategory.Error, key: "Abstract_methods_can_only_appear_within_an_abstract_class_1244", message: "Abstract methods can only appear within an abstract class." }, Method_0_cannot_have_an_implementation_because_it_is_marked_abstract: { code: 1245, category: ts.DiagnosticCategory.Error, key: "Method_0_cannot_have_an_implementation_because_it_is_marked_abstract_1245", message: "Method '{0}' cannot have an implementation because it is marked abstract." }, + An_interface_property_cannot_have_an_initializer: { code: 1246, category: ts.DiagnosticCategory.Error, key: "An_interface_property_cannot_have_an_initializer_1246", message: "An interface property cannot have an initializer." }, + A_type_literal_property_cannot_have_an_initializer: { code: 1247, category: ts.DiagnosticCategory.Error, key: "A_type_literal_property_cannot_have_an_initializer_1247", message: "A type literal property cannot have an initializer." }, + A_class_member_cannot_have_the_0_keyword: { code: 1248, category: ts.DiagnosticCategory.Error, key: "A_class_member_cannot_have_the_0_keyword_1248", message: "A class member cannot have the '{0}' keyword." }, + A_decorator_can_only_decorate_a_method_implementation_not_an_overload: { code: 1249, category: ts.DiagnosticCategory.Error, key: "A_decorator_can_only_decorate_a_method_implementation_not_an_overload_1249", message: "A decorator can only decorate a method implementation, not an overload." }, + Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5: { code: 1250, category: ts.DiagnosticCategory.Error, key: "Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_1250", message: "Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'." }, + Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Class_definitions_are_automatically_in_strict_mode: { code: 1251, category: ts.DiagnosticCategory.Error, key: "Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Class_d_1251", message: "Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. Class definitions are automatically in strict mode." }, + Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Modules_are_automatically_in_strict_mode: { code: 1252, category: ts.DiagnosticCategory.Error, key: "Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Modules_1252", message: "Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. Modules are automatically in strict mode." }, with_statements_are_not_allowed_in_an_async_function_block: { code: 1300, category: ts.DiagnosticCategory.Error, key: "with_statements_are_not_allowed_in_an_async_function_block_1300", message: "'with' statements are not allowed in an async function block." }, await_expression_is_only_allowed_within_an_async_function: { code: 1308, category: ts.DiagnosticCategory.Error, key: "await_expression_is_only_allowed_within_an_async_function_1308", message: "'await' expression is only allowed within an async function." }, Async_functions_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1311, category: ts.DiagnosticCategory.Error, key: "Async_functions_are_only_available_when_targeting_ECMAScript_6_and_higher_1311", message: "Async functions are only available when targeting ECMAScript 6 and higher." }, can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment: { code: 1312, category: ts.DiagnosticCategory.Error, key: "can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment_1312", message: "'=' can only be used in an object literal property inside a destructuring assignment." }, The_body_of_an_if_statement_cannot_be_the_empty_statement: { code: 1313, category: ts.DiagnosticCategory.Error, key: "The_body_of_an_if_statement_cannot_be_the_empty_statement_1313", message: "The body of an 'if' statement cannot be the empty statement." }, + Global_module_exports_may_only_appear_in_module_files: { code: 1314, category: ts.DiagnosticCategory.Error, key: "Global_module_exports_may_only_appear_in_module_files_1314", message: "Global module exports may only appear in module files." }, + Global_module_exports_may_only_appear_in_declaration_files: { code: 1315, category: ts.DiagnosticCategory.Error, key: "Global_module_exports_may_only_appear_in_declaration_files_1315", message: "Global module exports may only appear in declaration files." }, + Global_module_exports_may_only_appear_at_top_level: { code: 1316, category: ts.DiagnosticCategory.Error, key: "Global_module_exports_may_only_appear_at_top_level_1316", message: "Global module exports may only appear at top level." }, Duplicate_identifier_0: { code: 2300, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_0_2300", message: "Duplicate identifier '{0}'." }, Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: ts.DiagnosticCategory.Error, key: "Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301", message: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, Static_members_cannot_reference_class_type_parameters: { code: 2302, category: ts.DiagnosticCategory.Error, key: "Static_members_cannot_reference_class_type_parameters_2302", message: "Static members cannot reference class type parameters." }, @@ -2248,11 +2457,12 @@ var ts; Module_0_has_no_exported_member_1: { code: 2305, category: ts.DiagnosticCategory.Error, key: "Module_0_has_no_exported_member_1_2305", message: "Module '{0}' has no exported member '{1}'." }, File_0_is_not_a_module: { code: 2306, category: ts.DiagnosticCategory.Error, key: "File_0_is_not_a_module_2306", message: "File '{0}' is not a module." }, Cannot_find_module_0: { code: 2307, category: ts.DiagnosticCategory.Error, key: "Cannot_find_module_0_2307", message: "Cannot find module '{0}'." }, + Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambiguity: { code: 2308, category: ts.DiagnosticCategory.Error, key: "Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambig_2308", message: "Module {0} has already exported a member named '{1}'. Consider explicitly re-exporting to resolve the ambiguity." }, An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements: { code: 2309, category: ts.DiagnosticCategory.Error, key: "An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements_2309", message: "An export assignment cannot be used in a module with other exported elements." }, Type_0_recursively_references_itself_as_a_base_type: { code: 2310, category: ts.DiagnosticCategory.Error, key: "Type_0_recursively_references_itself_as_a_base_type_2310", message: "Type '{0}' recursively references itself as a base type." }, A_class_may_only_extend_another_class: { code: 2311, category: ts.DiagnosticCategory.Error, key: "A_class_may_only_extend_another_class_2311", message: "A class may only extend another class." }, An_interface_may_only_extend_a_class_or_another_interface: { code: 2312, category: ts.DiagnosticCategory.Error, key: "An_interface_may_only_extend_a_class_or_another_interface_2312", message: "An interface may only extend a class or another interface." }, - Constraint_of_a_type_parameter_cannot_reference_any_type_parameter_from_the_same_type_parameter_list: { code: 2313, category: ts.DiagnosticCategory.Error, key: "Constraint_of_a_type_parameter_cannot_reference_any_type_parameter_from_the_same_type_parameter_list_2313", message: "Constraint of a type parameter cannot reference any type parameter from the same type parameter list." }, + Type_parameter_0_has_a_circular_constraint: { code: 2313, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_has_a_circular_constraint_2313", message: "Type parameter '{0}' has a circular constraint." }, Generic_type_0_requires_1_type_argument_s: { code: 2314, category: ts.DiagnosticCategory.Error, key: "Generic_type_0_requires_1_type_argument_s_2314", message: "Generic type '{0}' requires {1} type argument(s)." }, Type_0_is_not_generic: { code: 2315, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_generic_2315", message: "Type '{0}' is not generic." }, Global_type_0_must_be_a_class_or_interface_type: { code: 2316, category: ts.DiagnosticCategory.Error, key: "Global_type_0_must_be_a_class_or_interface_type_2316", message: "Global type '{0}' must be a class or interface type." }, @@ -2262,6 +2472,7 @@ var ts; Interface_0_cannot_simultaneously_extend_types_1_and_2: { code: 2320, category: ts.DiagnosticCategory.Error, key: "Interface_0_cannot_simultaneously_extend_types_1_and_2_2320", message: "Interface '{0}' cannot simultaneously extend types '{1}' and '{2}'." }, Excessive_stack_depth_comparing_types_0_and_1: { code: 2321, category: ts.DiagnosticCategory.Error, key: "Excessive_stack_depth_comparing_types_0_and_1_2321", message: "Excessive stack depth comparing types '{0}' and '{1}'." }, Type_0_is_not_assignable_to_type_1: { code: 2322, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_assignable_to_type_1_2322", message: "Type '{0}' is not assignable to type '{1}'." }, + Cannot_redeclare_exported_variable_0: { code: 2323, category: ts.DiagnosticCategory.Error, key: "Cannot_redeclare_exported_variable_0_2323", message: "Cannot redeclare exported variable '{0}'." }, Property_0_is_missing_in_type_1: { code: 2324, category: ts.DiagnosticCategory.Error, key: "Property_0_is_missing_in_type_1_2324", message: "Property '{0}' is missing in type '{1}'." }, Property_0_is_private_in_type_1_but_not_in_type_2: { code: 2325, category: ts.DiagnosticCategory.Error, key: "Property_0_is_private_in_type_1_but_not_in_type_2_2325", message: "Property '{0}' is private in type '{1}' but not in type '{2}'." }, Types_of_property_0_are_incompatible: { code: 2326, category: ts.DiagnosticCategory.Error, key: "Types_of_property_0_are_incompatible_2326", message: "Types of property '{0}' are incompatible." }, @@ -2289,7 +2500,7 @@ var ts; Cannot_invoke_an_expression_whose_type_lacks_a_call_signature: { code: 2349, category: ts.DiagnosticCategory.Error, key: "Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_2349", message: "Cannot invoke an expression whose type lacks a call signature." }, Only_a_void_function_can_be_called_with_the_new_keyword: { code: 2350, category: ts.DiagnosticCategory.Error, key: "Only_a_void_function_can_be_called_with_the_new_keyword_2350", message: "Only a void function can be called with the 'new' keyword." }, Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature: { code: 2351, category: ts.DiagnosticCategory.Error, key: "Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature_2351", message: "Cannot use 'new' with an expression whose type lacks a call or construct signature." }, - Neither_type_0_nor_type_1_is_assignable_to_the_other: { code: 2352, category: ts.DiagnosticCategory.Error, key: "Neither_type_0_nor_type_1_is_assignable_to_the_other_2352", message: "Neither type '{0}' nor type '{1}' is assignable to the other." }, + Type_0_cannot_be_converted_to_type_1: { code: 2352, category: ts.DiagnosticCategory.Error, key: "Type_0_cannot_be_converted_to_type_1_2352", message: "Type '{0}' cannot be converted to type '{1}'." }, Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1: { code: 2353, category: ts.DiagnosticCategory.Error, key: "Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1_2353", message: "Object literal may only specify known properties, and '{0}' does not exist in type '{1}'." }, No_best_common_type_exists_among_return_expressions: { code: 2354, category: ts.DiagnosticCategory.Error, key: "No_best_common_type_exists_among_return_expressions_2354", message: "No best common type exists among return expressions." }, A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value: { code: 2355, category: ts.DiagnosticCategory.Error, key: "A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_2355", message: "A function whose declared type is neither 'void' nor 'any' must return a value." }, @@ -2303,6 +2514,7 @@ var ts; The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2363, category: ts.DiagnosticCategory.Error, key: "The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type_2363", message: "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, Invalid_left_hand_side_of_assignment_expression: { code: 2364, category: ts.DiagnosticCategory.Error, key: "Invalid_left_hand_side_of_assignment_expression_2364", message: "Invalid left-hand side of assignment expression." }, Operator_0_cannot_be_applied_to_types_1_and_2: { code: 2365, category: ts.DiagnosticCategory.Error, key: "Operator_0_cannot_be_applied_to_types_1_and_2_2365", message: "Operator '{0}' cannot be applied to types '{1}' and '{2}'." }, + Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined: { code: 2366, category: ts.DiagnosticCategory.Error, key: "Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined_2366", message: "Function lacks ending return statement and return type does not include 'undefined'." }, Type_parameter_name_cannot_be_0: { code: 2368, category: ts.DiagnosticCategory.Error, key: "Type_parameter_name_cannot_be_0_2368", message: "Type parameter name cannot be '{0}'" }, A_parameter_property_is_only_allowed_in_a_constructor_implementation: { code: 2369, category: ts.DiagnosticCategory.Error, key: "A_parameter_property_is_only_allowed_in_a_constructor_implementation_2369", message: "A parameter property is only allowed in a constructor implementation." }, A_rest_parameter_must_be_of_an_array_type: { code: 2370, category: ts.DiagnosticCategory.Error, key: "A_rest_parameter_must_be_of_an_array_type_2370", message: "A rest parameter must be of an array type." }, @@ -2318,7 +2530,7 @@ var ts; get_and_set_accessor_must_have_the_same_type: { code: 2380, category: ts.DiagnosticCategory.Error, key: "get_and_set_accessor_must_have_the_same_type_2380", message: "'get' and 'set' accessor must have the same type." }, A_signature_with_an_implementation_cannot_use_a_string_literal_type: { code: 2381, category: ts.DiagnosticCategory.Error, key: "A_signature_with_an_implementation_cannot_use_a_string_literal_type_2381", message: "A signature with an implementation cannot use a string literal type." }, Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature: { code: 2382, category: ts.DiagnosticCategory.Error, key: "Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature_2382", message: "Specialized overload signature is not assignable to any non-specialized signature." }, - Overload_signatures_must_all_be_exported_or_not_exported: { code: 2383, category: ts.DiagnosticCategory.Error, key: "Overload_signatures_must_all_be_exported_or_not_exported_2383", message: "Overload signatures must all be exported or not exported." }, + Overload_signatures_must_all_be_exported_or_non_exported: { code: 2383, category: ts.DiagnosticCategory.Error, key: "Overload_signatures_must_all_be_exported_or_non_exported_2383", message: "Overload signatures must all be exported or non-exported." }, Overload_signatures_must_all_be_ambient_or_non_ambient: { code: 2384, category: ts.DiagnosticCategory.Error, key: "Overload_signatures_must_all_be_ambient_or_non_ambient_2384", message: "Overload signatures must all be ambient or non-ambient." }, Overload_signatures_must_all_be_public_private_or_protected: { code: 2385, category: ts.DiagnosticCategory.Error, key: "Overload_signatures_must_all_be_public_private_or_protected_2385", message: "Overload signatures must all be public, private or protected." }, Overload_signatures_must_all_be_optional_or_required: { code: 2386, category: ts.DiagnosticCategory.Error, key: "Overload_signatures_must_all_be_optional_or_required_2386", message: "Overload signatures must all be optional or required." }, @@ -2332,6 +2544,7 @@ var ts; Overload_signature_is_not_compatible_with_function_implementation: { code: 2394, category: ts.DiagnosticCategory.Error, key: "Overload_signature_is_not_compatible_with_function_implementation_2394", message: "Overload signature is not compatible with function implementation." }, Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local: { code: 2395, category: ts.DiagnosticCategory.Error, key: "Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local_2395", message: "Individual declarations in merged declaration '{0}' must be all exported or all local." }, Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters: { code: 2396, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters_2396", message: "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters." }, + Declaration_name_conflicts_with_built_in_global_identifier_0: { code: 2397, category: ts.DiagnosticCategory.Error, key: "Declaration_name_conflicts_with_built_in_global_identifier_0_2397", message: "Declaration name conflicts with built-in global identifier '{0}'." }, Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference: { code: 2399, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference_2399", message: "Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference." }, Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference: { code: 2400, category: ts.DiagnosticCategory.Error, key: "Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference_2400", message: "Expression resolves to variable declaration '_this' that compiler uses to capture 'this' reference." }, Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference: { code: 2401, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference_2401", message: "Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference." }, @@ -2350,7 +2563,6 @@ var ts; Class_name_cannot_be_0: { code: 2414, category: ts.DiagnosticCategory.Error, key: "Class_name_cannot_be_0_2414", message: "Class name cannot be '{0}'" }, Class_0_incorrectly_extends_base_class_1: { code: 2415, category: ts.DiagnosticCategory.Error, key: "Class_0_incorrectly_extends_base_class_1_2415", message: "Class '{0}' incorrectly extends base class '{1}'." }, Class_static_side_0_incorrectly_extends_base_class_static_side_1: { code: 2417, category: ts.DiagnosticCategory.Error, key: "Class_static_side_0_incorrectly_extends_base_class_static_side_1_2417", message: "Class static side '{0}' incorrectly extends base class static side '{1}'." }, - Type_name_0_in_extends_clause_does_not_reference_constructor_function_for_0: { code: 2419, category: ts.DiagnosticCategory.Error, key: "Type_name_0_in_extends_clause_does_not_reference_constructor_function_for_0_2419", message: "Type name '{0}' in extends clause does not reference constructor function for '{0}'." }, Class_0_incorrectly_implements_interface_1: { code: 2420, category: ts.DiagnosticCategory.Error, key: "Class_0_incorrectly_implements_interface_1_2420", message: "Class '{0}' incorrectly implements interface '{1}'." }, A_class_may_only_implement_another_class_or_interface: { code: 2422, category: ts.DiagnosticCategory.Error, key: "A_class_may_only_implement_another_class_or_interface_2422", message: "A class may only implement another class or interface." }, Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor: { code: 2423, category: ts.DiagnosticCategory.Error, key: "Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_access_2423", message: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor." }, @@ -2358,7 +2570,7 @@ var ts; Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 2425, category: ts.DiagnosticCategory.Error, key: "Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_functi_2425", message: "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function." }, Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 2426, category: ts.DiagnosticCategory.Error, key: "Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_functi_2426", message: "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function." }, Interface_name_cannot_be_0: { code: 2427, category: ts.DiagnosticCategory.Error, key: "Interface_name_cannot_be_0_2427", message: "Interface name cannot be '{0}'" }, - All_declarations_of_an_interface_must_have_identical_type_parameters: { code: 2428, category: ts.DiagnosticCategory.Error, key: "All_declarations_of_an_interface_must_have_identical_type_parameters_2428", message: "All declarations of an interface must have identical type parameters." }, + All_declarations_of_0_must_have_identical_type_parameters: { code: 2428, category: ts.DiagnosticCategory.Error, key: "All_declarations_of_0_must_have_identical_type_parameters_2428", message: "All declarations of '{0}' must have identical type parameters." }, Interface_0_incorrectly_extends_interface_1: { code: 2430, category: ts.DiagnosticCategory.Error, key: "Interface_0_incorrectly_extends_interface_1_2430", message: "Interface '{0}' incorrectly extends interface '{1}'." }, Enum_name_cannot_be_0: { code: 2431, category: ts.DiagnosticCategory.Error, key: "Enum_name_cannot_be_0_2431", message: "Enum name cannot be '{0}'" }, In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element: { code: 2432, category: ts.DiagnosticCategory.Error, key: "In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enu_2432", message: "In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element." }, @@ -2378,11 +2590,12 @@ var ts; Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1: { code: 2446, category: ts.DiagnosticCategory.Error, key: "Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1_2446", message: "Property '{0}' is protected and only accessible through an instance of class '{1}'." }, The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead: { code: 2447, category: ts.DiagnosticCategory.Error, key: "The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead_2447", message: "The '{0}' operator is not allowed for boolean types. Consider using '{1}' instead." }, Block_scoped_variable_0_used_before_its_declaration: { code: 2448, category: ts.DiagnosticCategory.Error, key: "Block_scoped_variable_0_used_before_its_declaration_2448", message: "Block-scoped variable '{0}' used before its declaration." }, - The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant: { code: 2449, category: ts.DiagnosticCategory.Error, key: "The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant_2449", message: "The operand of an increment or decrement operator cannot be a constant." }, - Left_hand_side_of_assignment_expression_cannot_be_a_constant: { code: 2450, category: ts.DiagnosticCategory.Error, key: "Left_hand_side_of_assignment_expression_cannot_be_a_constant_2450", message: "Left-hand side of assignment expression cannot be a constant." }, + The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant_or_a_read_only_property: { code: 2449, category: ts.DiagnosticCategory.Error, key: "The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant_or_a_read_only_property_2449", message: "The operand of an increment or decrement operator cannot be a constant or a read-only property." }, + Left_hand_side_of_assignment_expression_cannot_be_a_constant_or_a_read_only_property: { code: 2450, category: ts.DiagnosticCategory.Error, key: "Left_hand_side_of_assignment_expression_cannot_be_a_constant_or_a_read_only_property_2450", message: "Left-hand side of assignment expression cannot be a constant or a read-only property." }, Cannot_redeclare_block_scoped_variable_0: { code: 2451, category: ts.DiagnosticCategory.Error, key: "Cannot_redeclare_block_scoped_variable_0_2451", message: "Cannot redeclare block-scoped variable '{0}'." }, An_enum_member_cannot_have_a_numeric_name: { code: 2452, category: ts.DiagnosticCategory.Error, key: "An_enum_member_cannot_have_a_numeric_name_2452", message: "An enum member cannot have a numeric name." }, The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly: { code: 2453, category: ts.DiagnosticCategory.Error, key: "The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_typ_2453", message: "The type argument for type parameter '{0}' cannot be inferred from the usage. Consider specifying the type arguments explicitly." }, + Variable_0_is_used_before_being_assigned: { code: 2454, category: ts.DiagnosticCategory.Error, key: "Variable_0_is_used_before_being_assigned_2454", message: "Variable '{0}' is used before being assigned." }, Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0: { code: 2455, category: ts.DiagnosticCategory.Error, key: "Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0_2455", message: "Type argument candidate '{1}' is not a valid type argument because it is not a supertype of candidate '{0}'." }, Type_alias_0_circularly_references_itself: { code: 2456, category: ts.DiagnosticCategory.Error, key: "Type_alias_0_circularly_references_itself_2456", message: "Type alias '{0}' circularly references itself." }, Type_alias_name_cannot_be_0: { code: 2457, category: ts.DiagnosticCategory.Error, key: "Type_alias_name_cannot_be_0_2457", message: "Type alias name cannot be '{0}'" }, @@ -2412,8 +2625,8 @@ var ts; Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1: { code: 2481, category: ts.DiagnosticCategory.Error, key: "Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1_2481", message: "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'." }, The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation: { code: 2483, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation_2483", message: "The left-hand side of a 'for...of' statement cannot use a type annotation." }, Export_declaration_conflicts_with_exported_declaration_of_0: { code: 2484, category: ts.DiagnosticCategory.Error, key: "Export_declaration_conflicts_with_exported_declaration_of_0_2484", message: "Export declaration conflicts with exported declaration of '{0}'" }, - The_left_hand_side_of_a_for_of_statement_cannot_be_a_previously_defined_constant: { code: 2485, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_of_statement_cannot_be_a_previously_defined_constant_2485", message: "The left-hand side of a 'for...of' statement cannot be a previously defined constant." }, - The_left_hand_side_of_a_for_in_statement_cannot_be_a_previously_defined_constant: { code: 2486, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_in_statement_cannot_be_a_previously_defined_constant_2486", message: "The left-hand side of a 'for...in' statement cannot be a previously defined constant." }, + The_left_hand_side_of_a_for_of_statement_cannot_be_a_constant_or_a_read_only_property: { code: 2485, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_of_statement_cannot_be_a_constant_or_a_read_only_property_2485", message: "The left-hand side of a 'for...of' statement cannot be a constant or a read-only property." }, + The_left_hand_side_of_a_for_in_statement_cannot_be_a_constant_or_a_read_only_property: { code: 2486, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_in_statement_cannot_be_a_constant_or_a_read_only_property_2486", message: "The left-hand side of a 'for...in' statement cannot be a constant or a read-only property." }, Invalid_left_hand_side_in_for_of_statement: { code: 2487, category: ts.DiagnosticCategory.Error, key: "Invalid_left_hand_side_in_for_of_statement_2487", message: "Invalid left-hand side in 'for...of' statement." }, Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator: { code: 2488, category: ts.DiagnosticCategory.Error, key: "Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator_2488", message: "Type must have a '[Symbol.iterator]()' method that returns an iterator." }, An_iterator_must_have_a_next_method: { code: 2489, category: ts.DiagnosticCategory.Error, key: "An_iterator_must_have_a_next_method_2489", message: "An iterator must have a 'next()' method." }, @@ -2439,12 +2652,13 @@ var ts; Base_constructor_return_type_0_is_not_a_class_or_interface_type: { code: 2509, category: ts.DiagnosticCategory.Error, key: "Base_constructor_return_type_0_is_not_a_class_or_interface_type_2509", message: "Base constructor return type '{0}' is not a class or interface type." }, Base_constructors_must_all_have_the_same_return_type: { code: 2510, category: ts.DiagnosticCategory.Error, key: "Base_constructors_must_all_have_the_same_return_type_2510", message: "Base constructors must all have the same return type." }, Cannot_create_an_instance_of_the_abstract_class_0: { code: 2511, category: ts.DiagnosticCategory.Error, key: "Cannot_create_an_instance_of_the_abstract_class_0_2511", message: "Cannot create an instance of the abstract class '{0}'." }, - Overload_signatures_must_all_be_abstract_or_not_abstract: { code: 2512, category: ts.DiagnosticCategory.Error, key: "Overload_signatures_must_all_be_abstract_or_not_abstract_2512", message: "Overload signatures must all be abstract or not abstract." }, + Overload_signatures_must_all_be_abstract_or_non_abstract: { code: 2512, category: ts.DiagnosticCategory.Error, key: "Overload_signatures_must_all_be_abstract_or_non_abstract_2512", message: "Overload signatures must all be abstract or non-abstract." }, Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression: { code: 2513, category: ts.DiagnosticCategory.Error, key: "Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression_2513", message: "Abstract method '{0}' in class '{1}' cannot be accessed via super expression." }, Classes_containing_abstract_methods_must_be_marked_abstract: { code: 2514, category: ts.DiagnosticCategory.Error, key: "Classes_containing_abstract_methods_must_be_marked_abstract_2514", message: "Classes containing abstract methods must be marked abstract." }, Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2: { code: 2515, category: ts.DiagnosticCategory.Error, key: "Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2_2515", message: "Non-abstract class '{0}' does not implement inherited abstract member '{1}' from class '{2}'." }, All_declarations_of_an_abstract_method_must_be_consecutive: { code: 2516, category: ts.DiagnosticCategory.Error, key: "All_declarations_of_an_abstract_method_must_be_consecutive_2516", message: "All declarations of an abstract method must be consecutive." }, Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type: { code: 2517, category: ts.DiagnosticCategory.Error, key: "Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type_2517", message: "Cannot assign an abstract constructor type to a non-abstract constructor type." }, + A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard: { code: 2518, category: ts.DiagnosticCategory.Error, key: "A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard_2518", message: "A 'this'-based type guard is not compatible with a parameter-based type guard." }, Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions: { code: 2520, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions_2520", message: "Duplicate identifier '{0}'. Compiler uses declaration '{1}' to support async functions." }, Expression_resolves_to_variable_declaration_0_that_compiler_uses_to_support_async_functions: { code: 2521, category: ts.DiagnosticCategory.Error, key: "Expression_resolves_to_variable_declaration_0_that_compiler_uses_to_support_async_functions_2521", message: "Expression resolves to variable declaration '{0}' that compiler uses to support async functions." }, The_arguments_object_cannot_be_referenced_in_an_async_arrow_function_Consider_using_a_standard_async_function_expression: { code: 2522, category: ts.DiagnosticCategory.Error, key: "The_arguments_object_cannot_be_referenced_in_an_async_arrow_function_Consider_using_a_standard_async_2522", message: "The 'arguments' object cannot be referenced in an async arrow function. Consider using a standard async function expression." }, @@ -2454,7 +2668,13 @@ var ts; A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface: { code: 2526, category: ts.DiagnosticCategory.Error, key: "A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface_2526", message: "A 'this' type is available only in a non-static member of a class or interface." }, The_inferred_type_of_0_references_an_inaccessible_this_type_A_type_annotation_is_necessary: { code: 2527, category: ts.DiagnosticCategory.Error, key: "The_inferred_type_of_0_references_an_inaccessible_this_type_A_type_annotation_is_necessary_2527", message: "The inferred type of '{0}' references an inaccessible 'this' type. A type annotation is necessary." }, A_module_cannot_have_multiple_default_exports: { code: 2528, category: ts.DiagnosticCategory.Error, key: "A_module_cannot_have_multiple_default_exports_2528", message: "A module cannot have multiple default exports." }, - JSX_element_attributes_type_0_must_be_an_object_type: { code: 2600, category: ts.DiagnosticCategory.Error, key: "JSX_element_attributes_type_0_must_be_an_object_type_2600", message: "JSX element attributes type '{0}' must be an object type." }, + Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions: { code: 2529, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_func_2529", message: "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of a module containing async functions." }, + Property_0_is_incompatible_with_index_signature: { code: 2530, category: ts.DiagnosticCategory.Error, key: "Property_0_is_incompatible_with_index_signature_2530", message: "Property '{0}' is incompatible with index signature." }, + Object_is_possibly_null: { code: 2531, category: ts.DiagnosticCategory.Error, key: "Object_is_possibly_null_2531", message: "Object is possibly 'null'." }, + Object_is_possibly_undefined: { code: 2532, category: ts.DiagnosticCategory.Error, key: "Object_is_possibly_undefined_2532", message: "Object is possibly 'undefined'." }, + Object_is_possibly_null_or_undefined: { code: 2533, category: ts.DiagnosticCategory.Error, key: "Object_is_possibly_null_or_undefined_2533", message: "Object is possibly 'null' or 'undefined'." }, + A_function_returning_never_cannot_have_a_reachable_end_point: { code: 2534, category: ts.DiagnosticCategory.Error, key: "A_function_returning_never_cannot_have_a_reachable_end_point_2534", message: "A function returning 'never' cannot have a reachable end point." }, + JSX_element_attributes_type_0_may_not_be_a_union_type: { code: 2600, category: ts.DiagnosticCategory.Error, key: "JSX_element_attributes_type_0_may_not_be_a_union_type_2600", message: "JSX element attributes type '{0}' may not be a union type." }, The_return_type_of_a_JSX_element_constructor_must_return_an_object_type: { code: 2601, category: ts.DiagnosticCategory.Error, key: "The_return_type_of_a_JSX_element_constructor_must_return_an_object_type_2601", message: "The return type of a JSX element constructor must return an object type." }, JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist: { code: 2602, category: ts.DiagnosticCategory.Error, key: "JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist_2602", message: "JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist." }, Property_0_in_type_1_is_not_assignable_to_type_2: { code: 2603, category: ts.DiagnosticCategory.Error, key: "Property_0_in_type_1_is_not_assignable_to_type_2_2603", message: "Property '{0}' in type '{1}' is not assignable to type '{2}'" }, @@ -2470,6 +2690,33 @@ var ts; Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_package_author_to_update_the_package_definition: { code: 2654, category: ts.DiagnosticCategory.Error, key: "Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_pack_2654", message: "Exported external package typings file cannot contain tripleslash references. Please contact the package author to update the package definition." }, Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_the_package_definition: { code: 2656, category: ts.DiagnosticCategory.Error, key: "Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_2656", message: "Exported external package typings file '{0}' is not a module. Please contact the package author to update the package definition." }, JSX_expressions_must_have_one_parent_element: { code: 2657, category: ts.DiagnosticCategory.Error, key: "JSX_expressions_must_have_one_parent_element_2657", message: "JSX expressions must have one parent element" }, + Type_0_provides_no_match_for_the_signature_1: { code: 2658, category: ts.DiagnosticCategory.Error, key: "Type_0_provides_no_match_for_the_signature_1_2658", message: "Type '{0}' provides no match for the signature '{1}'" }, + super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher: { code: 2659, category: ts.DiagnosticCategory.Error, key: "super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_highe_2659", message: "'super' is only allowed in members of object literal expressions when option 'target' is 'ES2015' or higher." }, + super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions: { code: 2660, category: ts.DiagnosticCategory.Error, key: "super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions_2660", message: "'super' can only be referenced in members of derived classes or object literal expressions." }, + Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module: { code: 2661, category: ts.DiagnosticCategory.Error, key: "Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module_2661", message: "Cannot export '{0}'. Only local declarations can be exported from a module." }, + Cannot_find_name_0_Did_you_mean_the_static_member_1_0: { code: 2662, category: ts.DiagnosticCategory.Error, key: "Cannot_find_name_0_Did_you_mean_the_static_member_1_0_2662", message: "Cannot find name '{0}'. Did you mean the static member '{1}.{0}'?" }, + Cannot_find_name_0_Did_you_mean_the_instance_member_this_0: { code: 2663, category: ts.DiagnosticCategory.Error, key: "Cannot_find_name_0_Did_you_mean_the_instance_member_this_0_2663", message: "Cannot find name '{0}'. Did you mean the instance member 'this.{0}'?" }, + Invalid_module_name_in_augmentation_module_0_cannot_be_found: { code: 2664, category: ts.DiagnosticCategory.Error, key: "Invalid_module_name_in_augmentation_module_0_cannot_be_found_2664", message: "Invalid module name in augmentation, module '{0}' cannot be found." }, + Exports_and_export_assignments_are_not_permitted_in_module_augmentations: { code: 2666, category: ts.DiagnosticCategory.Error, key: "Exports_and_export_assignments_are_not_permitted_in_module_augmentations_2666", message: "Exports and export assignments are not permitted in module augmentations." }, + Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module: { code: 2667, category: ts.DiagnosticCategory.Error, key: "Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_mod_2667", message: "Imports are not permitted in module augmentations. Consider moving them to the enclosing external module." }, + export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always_visible: { code: 2668, category: ts.DiagnosticCategory.Error, key: "export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always__2668", message: "'export' modifier cannot be applied to ambient modules and module augmentations since they are always visible." }, + Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_declarations: { code: 2669, category: ts.DiagnosticCategory.Error, key: "Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_2669", message: "Augmentations for the global scope can only be directly nested in external modules or ambient module declarations." }, + Augmentations_for_the_global_scope_should_have_declare_modifier_unless_they_appear_in_already_ambient_context: { code: 2670, category: ts.DiagnosticCategory.Error, key: "Augmentations_for_the_global_scope_should_have_declare_modifier_unless_they_appear_in_already_ambien_2670", message: "Augmentations for the global scope should have 'declare' modifier unless they appear in already ambient context." }, + Cannot_augment_module_0_because_it_resolves_to_a_non_module_entity: { code: 2671, category: ts.DiagnosticCategory.Error, key: "Cannot_augment_module_0_because_it_resolves_to_a_non_module_entity_2671", message: "Cannot augment module '{0}' because it resolves to a non-module entity." }, + Cannot_assign_a_0_constructor_type_to_a_1_constructor_type: { code: 2672, category: ts.DiagnosticCategory.Error, key: "Cannot_assign_a_0_constructor_type_to_a_1_constructor_type_2672", message: "Cannot assign a '{0}' constructor type to a '{1}' constructor type." }, + Constructor_of_class_0_is_private_and_only_accessible_within_the_class_declaration: { code: 2673, category: ts.DiagnosticCategory.Error, key: "Constructor_of_class_0_is_private_and_only_accessible_within_the_class_declaration_2673", message: "Constructor of class '{0}' is private and only accessible within the class declaration." }, + Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration: { code: 2674, category: ts.DiagnosticCategory.Error, key: "Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration_2674", message: "Constructor of class '{0}' is protected and only accessible within the class declaration." }, + Cannot_extend_a_class_0_Class_constructor_is_marked_as_private: { code: 2675, category: ts.DiagnosticCategory.Error, key: "Cannot_extend_a_class_0_Class_constructor_is_marked_as_private_2675", message: "Cannot extend a class '{0}'. Class constructor is marked as private." }, + Accessors_must_both_be_abstract_or_non_abstract: { code: 2676, category: ts.DiagnosticCategory.Error, key: "Accessors_must_both_be_abstract_or_non_abstract_2676", message: "Accessors must both be abstract or non-abstract." }, + A_type_predicate_s_type_must_be_assignable_to_its_parameter_s_type: { code: 2677, category: ts.DiagnosticCategory.Error, key: "A_type_predicate_s_type_must_be_assignable_to_its_parameter_s_type_2677", message: "A type predicate's type must be assignable to its parameter's type." }, + Type_0_is_not_comparable_to_type_1: { code: 2678, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_comparable_to_type_1_2678", message: "Type '{0}' is not comparable to type '{1}'." }, + A_function_that_is_called_with_the_new_keyword_cannot_have_a_this_type_that_is_void: { code: 2679, category: ts.DiagnosticCategory.Error, key: "A_function_that_is_called_with_the_new_keyword_cannot_have_a_this_type_that_is_void_2679", message: "A function that is called with the 'new' keyword cannot have a 'this' type that is 'void'." }, + A_this_parameter_must_be_the_first_parameter: { code: 2680, category: ts.DiagnosticCategory.Error, key: "A_this_parameter_must_be_the_first_parameter_2680", message: "A 'this' parameter must be the first parameter." }, + A_constructor_cannot_have_a_this_parameter: { code: 2681, category: ts.DiagnosticCategory.Error, key: "A_constructor_cannot_have_a_this_parameter_2681", message: "A constructor cannot have a 'this' parameter." }, + get_and_set_accessor_must_have_the_same_this_type: { code: 2682, category: ts.DiagnosticCategory.Error, key: "get_and_set_accessor_must_have_the_same_this_type_2682", message: "'get' and 'set' accessor must have the same 'this' type." }, + this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation: { code: 2683, category: ts.DiagnosticCategory.Error, key: "this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_2683", message: "'this' implicitly has type 'any' because it does not have a type annotation." }, + The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1: { code: 2684, category: ts.DiagnosticCategory.Error, key: "The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1_2684", message: "The 'this' context of type '{0}' is not assignable to method's 'this' of type '{1}'." }, + The_this_types_of_each_signature_are_incompatible: { code: 2685, category: ts.DiagnosticCategory.Error, key: "The_this_types_of_each_signature_are_incompatible_2685", message: "The 'this' types of each signature are incompatible." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import_declaration_0_is_using_private_name_1_4000", message: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", message: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", message: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, @@ -2540,6 +2787,7 @@ var ts; Parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4078, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_exported_function_has_or_is_using_private_name_1_4078", message: "Parameter '{0}' of exported function has or is using private name '{1}'." }, Exported_type_alias_0_has_or_is_using_private_name_1: { code: 4081, category: ts.DiagnosticCategory.Error, key: "Exported_type_alias_0_has_or_is_using_private_name_1_4081", message: "Exported type alias '{0}' has or is using private name '{1}'." }, Default_export_of_the_module_has_or_is_using_private_name_0: { code: 4082, category: ts.DiagnosticCategory.Error, key: "Default_export_of_the_module_has_or_is_using_private_name_0_4082", message: "Default export of the module has or is using private name '{0}'." }, + Conflicting_library_definitions_for_0_found_at_1_and_2_Copy_the_correct_file_to_the_typings_folder_to_resolve_this_conflict: { code: 4090, category: ts.DiagnosticCategory.Message, key: "Conflicting_library_definitions_for_0_found_at_1_and_2_Copy_the_correct_file_to_the_typings_folder_t_4090", message: "Conflicting library definitions for '{0}' found at '{1}' and '{2}'. Copy the correct file to the 'typings' folder to resolve this conflict." }, The_current_host_does_not_support_the_0_option: { code: 5001, category: ts.DiagnosticCategory.Error, key: "The_current_host_does_not_support_the_0_option_5001", message: "The current host does not support the '{0}' option." }, Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: ts.DiagnosticCategory.Error, key: "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", message: "Cannot find the common subdirectory path for the input files." }, Cannot_read_file_0_Colon_1: { code: 5012, category: ts.DiagnosticCategory.Error, key: "Cannot_read_file_0_Colon_1_5012", message: "Cannot read file '{0}': {1}" }, @@ -2554,17 +2802,28 @@ var ts; Option_0_cannot_be_specified_without_specifying_option_1: { code: 5052, category: ts.DiagnosticCategory.Error, key: "Option_0_cannot_be_specified_without_specifying_option_1_5052", message: "Option '{0}' cannot be specified without specifying option '{1}'." }, Option_0_cannot_be_specified_with_option_1: { code: 5053, category: ts.DiagnosticCategory.Error, key: "Option_0_cannot_be_specified_with_option_1_5053", message: "Option '{0}' cannot be specified with option '{1}'." }, A_tsconfig_json_file_is_already_defined_at_Colon_0: { code: 5054, category: ts.DiagnosticCategory.Error, key: "A_tsconfig_json_file_is_already_defined_at_Colon_0_5054", message: "A 'tsconfig.json' file is already defined at: '{0}'." }, + Cannot_write_file_0_because_it_would_overwrite_input_file: { code: 5055, category: ts.DiagnosticCategory.Error, key: "Cannot_write_file_0_because_it_would_overwrite_input_file_5055", message: "Cannot write file '{0}' because it would overwrite input file." }, + Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files: { code: 5056, category: ts.DiagnosticCategory.Error, key: "Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files_5056", message: "Cannot write file '{0}' because it would be overwritten by multiple input files." }, + Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0: { code: 5057, category: ts.DiagnosticCategory.Error, key: "Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0_5057", message: "Cannot find a tsconfig.json file at the specified directory: '{0}'" }, + The_specified_path_does_not_exist_Colon_0: { code: 5058, category: ts.DiagnosticCategory.Error, key: "The_specified_path_does_not_exist_Colon_0_5058", message: "The specified path does not exist: '{0}'" }, + Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier: { code: 5059, category: ts.DiagnosticCategory.Error, key: "Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier_5059", message: "Invalid value for '--reactNamespace'. '{0}' is not a valid identifier." }, + Option_paths_cannot_be_used_without_specifying_baseUrl_option: { code: 5060, category: ts.DiagnosticCategory.Error, key: "Option_paths_cannot_be_used_without_specifying_baseUrl_option_5060", message: "Option 'paths' cannot be used without specifying '--baseUrl' option." }, + Pattern_0_can_have_at_most_one_Asterisk_character: { code: 5061, category: ts.DiagnosticCategory.Error, key: "Pattern_0_can_have_at_most_one_Asterisk_character_5061", message: "Pattern '{0}' can have at most one '*' character" }, + Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character: { code: 5062, category: ts.DiagnosticCategory.Error, key: "Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character_5062", message: "Substitution '{0}' in pattern '{1}' in can have at most one '*' character" }, + Substututions_for_pattern_0_should_be_an_array: { code: 5063, category: ts.DiagnosticCategory.Error, key: "Substututions_for_pattern_0_should_be_an_array_5063", message: "Substututions for pattern '{0}' should be an array." }, + Substitution_0_for_pattern_1_has_incorrect_type_expected_string_got_2: { code: 5064, category: ts.DiagnosticCategory.Error, key: "Substitution_0_for_pattern_1_has_incorrect_type_expected_string_got_2_5064", message: "Substitution '{0}' for pattern '{1}' has incorrect type, expected 'string', got '{2}'." }, Concatenate_and_emit_output_to_single_file: { code: 6001, category: ts.DiagnosticCategory.Message, key: "Concatenate_and_emit_output_to_single_file_6001", message: "Concatenate and emit output to single file." }, Generates_corresponding_d_ts_file: { code: 6002, category: ts.DiagnosticCategory.Message, key: "Generates_corresponding_d_ts_file_6002", message: "Generates corresponding '.d.ts' file." }, - Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { code: 6003, category: ts.DiagnosticCategory.Message, key: "Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations_6003", message: "Specifies the location where debugger should locate map files instead of generated locations." }, - Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations: { code: 6004, category: ts.DiagnosticCategory.Message, key: "Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations_6004", message: "Specifies the location where debugger should locate TypeScript files instead of source locations." }, + Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { code: 6003, category: ts.DiagnosticCategory.Message, key: "Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations_6003", message: "Specify the location where debugger should locate map files instead of generated locations." }, + Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations: { code: 6004, category: ts.DiagnosticCategory.Message, key: "Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations_6004", message: "Specify the location where debugger should locate TypeScript files instead of source locations." }, Watch_input_files: { code: 6005, category: ts.DiagnosticCategory.Message, key: "Watch_input_files_6005", message: "Watch input files." }, Redirect_output_structure_to_the_directory: { code: 6006, category: ts.DiagnosticCategory.Message, key: "Redirect_output_structure_to_the_directory_6006", message: "Redirect output structure to the directory." }, Do_not_erase_const_enum_declarations_in_generated_code: { code: 6007, category: ts.DiagnosticCategory.Message, key: "Do_not_erase_const_enum_declarations_in_generated_code_6007", message: "Do not erase const enum declarations in generated code." }, Do_not_emit_outputs_if_any_errors_were_reported: { code: 6008, category: ts.DiagnosticCategory.Message, key: "Do_not_emit_outputs_if_any_errors_were_reported_6008", message: "Do not emit outputs if any errors were reported." }, Do_not_emit_comments_to_output: { code: 6009, category: ts.DiagnosticCategory.Message, key: "Do_not_emit_comments_to_output_6009", message: "Do not emit comments to output." }, Do_not_emit_outputs: { code: 6010, category: ts.DiagnosticCategory.Message, key: "Do_not_emit_outputs_6010", message: "Do not emit outputs." }, - Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015_experimental: { code: 6015, category: ts.DiagnosticCategory.Message, key: "Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015_experimental_6015", message: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES2015' (experimental)" }, + Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typechecking: { code: 6011, category: ts.DiagnosticCategory.Message, key: "Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typech_6011", message: "Allow default imports from modules with no default export. This does not affect code emit, just typechecking." }, + Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015: { code: 6015, category: ts.DiagnosticCategory.Message, key: "Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015_6015", message: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES2015'" }, Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015: { code: 6016, category: ts.DiagnosticCategory.Message, key: "Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015_6016", message: "Specify module code generation: 'commonjs', 'amd', 'system', 'umd' or 'es2015'" }, Print_this_message: { code: 6017, category: ts.DiagnosticCategory.Message, key: "Print_this_message_6017", message: "Print this message." }, Print_the_compiler_s_version: { code: 6019, category: ts.DiagnosticCategory.Message, key: "Print_the_compiler_s_version_6019", message: "Print the compiler's version." }, @@ -2586,8 +2845,7 @@ var ts; Generates_corresponding_map_file: { code: 6043, category: ts.DiagnosticCategory.Message, key: "Generates_corresponding_map_file_6043", message: "Generates corresponding '.map' file." }, Compiler_option_0_expects_an_argument: { code: 6044, category: ts.DiagnosticCategory.Error, key: "Compiler_option_0_expects_an_argument_6044", message: "Compiler option '{0}' expects an argument." }, Unterminated_quoted_string_in_response_file_0: { code: 6045, category: ts.DiagnosticCategory.Error, key: "Unterminated_quoted_string_in_response_file_0_6045", message: "Unterminated quoted string in response file '{0}'." }, - Argument_for_module_option_must_be_commonjs_amd_system_umd_or_es2015: { code: 6046, category: ts.DiagnosticCategory.Error, key: "Argument_for_module_option_must_be_commonjs_amd_system_umd_or_es2015_6046", message: "Argument for '--module' option must be 'commonjs', 'amd', 'system', 'umd', or 'es2015'." }, - Argument_for_target_option_must_be_ES3_ES5_or_ES2015: { code: 6047, category: ts.DiagnosticCategory.Error, key: "Argument_for_target_option_must_be_ES3_ES5_or_ES2015_6047", message: "Argument for '--target' option must be 'ES3', 'ES5', or 'ES2015'." }, + Argument_for_0_option_must_be_Colon_1: { code: 6046, category: ts.DiagnosticCategory.Error, key: "Argument_for_0_option_must_be_Colon_1_6046", message: "Argument for '{0}' option must be: {1}" }, Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: { code: 6048, category: ts.DiagnosticCategory.Error, key: "Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1_6048", message: "Locale must be of the form or -. For example '{0}' or '{1}'." }, Unsupported_locale_0: { code: 6049, category: ts.DiagnosticCategory.Error, key: "Unsupported_locale_0_6049", message: "Unsupported locale '{0}'." }, Unable_to_open_file_0: { code: 6050, category: ts.DiagnosticCategory.Error, key: "Unable_to_open_file_0_6050", message: "Unable to open file '{0}'." }, @@ -2597,16 +2855,15 @@ var ts; File_0_has_unsupported_extension_The_only_supported_extensions_are_1: { code: 6054, category: ts.DiagnosticCategory.Error, key: "File_0_has_unsupported_extension_The_only_supported_extensions_are_1_6054", message: "File '{0}' has unsupported extension. The only supported extensions are {1}." }, Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures: { code: 6055, category: ts.DiagnosticCategory.Message, key: "Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures_6055", message: "Suppress noImplicitAny errors for indexing objects lacking index signatures." }, Do_not_emit_declarations_for_code_that_has_an_internal_annotation: { code: 6056, category: ts.DiagnosticCategory.Message, key: "Do_not_emit_declarations_for_code_that_has_an_internal_annotation_6056", message: "Do not emit declarations for code that has an '@internal' annotation." }, - Specifies_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir: { code: 6058, category: ts.DiagnosticCategory.Message, key: "Specifies_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDi_6058", message: "Specifies the root directory of input files. Use to control the output directory structure with --outDir." }, + Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir: { code: 6058, category: ts.DiagnosticCategory.Message, key: "Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir_6058", message: "Specify the root directory of input files. Use to control the output directory structure with --outDir." }, File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files: { code: 6059, category: ts.DiagnosticCategory.Error, key: "File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files_6059", message: "File '{0}' is not under 'rootDir' '{1}'. 'rootDir' is expected to contain all source files." }, - Specifies_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix: { code: 6060, category: ts.DiagnosticCategory.Message, key: "Specifies_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix_6060", message: "Specifies the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix)." }, + Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix: { code: 6060, category: ts.DiagnosticCategory.Message, key: "Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix_6060", message: "Specify the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix)." }, NEWLINE: { code: 6061, category: ts.DiagnosticCategory.Message, key: "NEWLINE_6061", message: "NEWLINE" }, - Argument_for_newLine_option_must_be_CRLF_or_LF: { code: 6062, category: ts.DiagnosticCategory.Error, key: "Argument_for_newLine_option_must_be_CRLF_or_LF_6062", message: "Argument for '--newLine' option must be 'CRLF' or 'LF'." }, - Argument_for_moduleResolution_option_must_be_node_or_classic: { code: 6063, category: ts.DiagnosticCategory.Error, key: "Argument_for_moduleResolution_option_must_be_node_or_classic_6063", message: "Argument for '--moduleResolution' option must be 'node' or 'classic'." }, + Option_0_can_only_be_specified_in_tsconfig_json_file: { code: 6064, category: ts.DiagnosticCategory.Error, key: "Option_0_can_only_be_specified_in_tsconfig_json_file_6064", message: "Option '{0}' can only be specified in 'tsconfig.json' file." }, Enables_experimental_support_for_ES7_decorators: { code: 6065, category: ts.DiagnosticCategory.Message, key: "Enables_experimental_support_for_ES7_decorators_6065", message: "Enables experimental support for ES7 decorators." }, Enables_experimental_support_for_emitting_type_metadata_for_decorators: { code: 6066, category: ts.DiagnosticCategory.Message, key: "Enables_experimental_support_for_emitting_type_metadata_for_decorators_6066", message: "Enables experimental support for emitting type metadata for decorators." }, Enables_experimental_support_for_ES7_async_functions: { code: 6068, category: ts.DiagnosticCategory.Message, key: "Enables_experimental_support_for_ES7_async_functions_6068", message: "Enables experimental support for ES7 async functions." }, - Specifies_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6: { code: 6069, category: ts.DiagnosticCategory.Message, key: "Specifies_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6_6069", message: "Specifies module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6)." }, + Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6: { code: 6069, category: ts.DiagnosticCategory.Message, key: "Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6_6069", message: "Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6)." }, Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file: { code: 6070, category: ts.DiagnosticCategory.Message, key: "Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file_6070", message: "Initializes a TypeScript project and creates a tsconfig.json file." }, Successfully_created_a_tsconfig_json_file: { code: 6071, category: ts.DiagnosticCategory.Message, key: "Successfully_created_a_tsconfig_json_file_6071", message: "Successfully created a tsconfig.json file." }, Suppress_excess_property_checks_for_object_literals: { code: 6072, category: ts.DiagnosticCategory.Message, key: "Suppress_excess_property_checks_for_object_literals_6072", message: "Suppress excess property checks for object literals." }, @@ -2616,9 +2873,57 @@ var ts; Report_errors_for_fallthrough_cases_in_switch_statement: { code: 6076, category: ts.DiagnosticCategory.Message, key: "Report_errors_for_fallthrough_cases_in_switch_statement_6076", message: "Report errors for fallthrough cases in switch statement." }, Do_not_report_errors_on_unreachable_code: { code: 6077, category: ts.DiagnosticCategory.Message, key: "Do_not_report_errors_on_unreachable_code_6077", message: "Do not report errors on unreachable code." }, Disallow_inconsistently_cased_references_to_the_same_file: { code: 6078, category: ts.DiagnosticCategory.Message, key: "Disallow_inconsistently_cased_references_to_the_same_file_6078", message: "Disallow inconsistently-cased references to the same file." }, + Specify_library_files_to_be_included_in_the_compilation_Colon: { code: 6079, category: ts.DiagnosticCategory.Message, key: "Specify_library_files_to_be_included_in_the_compilation_Colon_6079", message: "Specify library files to be included in the compilation: " }, Specify_JSX_code_generation_Colon_preserve_or_react: { code: 6080, category: ts.DiagnosticCategory.Message, key: "Specify_JSX_code_generation_Colon_preserve_or_react_6080", message: "Specify JSX code generation: 'preserve' or 'react'" }, - Argument_for_jsx_must_be_preserve_or_react: { code: 6081, category: ts.DiagnosticCategory.Message, key: "Argument_for_jsx_must_be_preserve_or_react_6081", message: "Argument for '--jsx' must be 'preserve' or 'react'." }, Only_amd_and_system_modules_are_supported_alongside_0: { code: 6082, category: ts.DiagnosticCategory.Error, key: "Only_amd_and_system_modules_are_supported_alongside_0_6082", message: "Only 'amd' and 'system' modules are supported alongside --{0}." }, + Base_directory_to_resolve_non_absolute_module_names: { code: 6083, category: ts.DiagnosticCategory.Message, key: "Base_directory_to_resolve_non_absolute_module_names_6083", message: "Base directory to resolve non-absolute module names." }, + Specify_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit: { code: 6084, category: ts.DiagnosticCategory.Message, key: "Specify_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit_6084", message: "Specify the object invoked for createElement and __spread when targeting 'react' JSX emit" }, + Enable_tracing_of_the_name_resolution_process: { code: 6085, category: ts.DiagnosticCategory.Message, key: "Enable_tracing_of_the_name_resolution_process_6085", message: "Enable tracing of the name resolution process." }, + Resolving_module_0_from_1: { code: 6086, category: ts.DiagnosticCategory.Message, key: "Resolving_module_0_from_1_6086", message: "======== Resolving module '{0}' from '{1}'. ========" }, + Explicitly_specified_module_resolution_kind_Colon_0: { code: 6087, category: ts.DiagnosticCategory.Message, key: "Explicitly_specified_module_resolution_kind_Colon_0_6087", message: "Explicitly specified module resolution kind: '{0}'." }, + Module_resolution_kind_is_not_specified_using_0: { code: 6088, category: ts.DiagnosticCategory.Message, key: "Module_resolution_kind_is_not_specified_using_0_6088", message: "Module resolution kind is not specified, using '{0}'." }, + Module_name_0_was_successfully_resolved_to_1: { code: 6089, category: ts.DiagnosticCategory.Message, key: "Module_name_0_was_successfully_resolved_to_1_6089", message: "======== Module name '{0}' was successfully resolved to '{1}'. ========" }, + Module_name_0_was_not_resolved: { code: 6090, category: ts.DiagnosticCategory.Message, key: "Module_name_0_was_not_resolved_6090", message: "======== Module name '{0}' was not resolved. ========" }, + paths_option_is_specified_looking_for_a_pattern_to_match_module_name_0: { code: 6091, category: ts.DiagnosticCategory.Message, key: "paths_option_is_specified_looking_for_a_pattern_to_match_module_name_0_6091", message: "'paths' option is specified, looking for a pattern to match module name '{0}'." }, + Module_name_0_matched_pattern_1: { code: 6092, category: ts.DiagnosticCategory.Message, key: "Module_name_0_matched_pattern_1_6092", message: "Module name '{0}', matched pattern '{1}'." }, + Trying_substitution_0_candidate_module_location_Colon_1: { code: 6093, category: ts.DiagnosticCategory.Message, key: "Trying_substitution_0_candidate_module_location_Colon_1_6093", message: "Trying substitution '{0}', candidate module location: '{1}'." }, + Resolving_module_name_0_relative_to_base_url_1_2: { code: 6094, category: ts.DiagnosticCategory.Message, key: "Resolving_module_name_0_relative_to_base_url_1_2_6094", message: "Resolving module name '{0}' relative to base url '{1}' - '{2}'." }, + Loading_module_as_file_Slash_folder_candidate_module_location_0: { code: 6095, category: ts.DiagnosticCategory.Message, key: "Loading_module_as_file_Slash_folder_candidate_module_location_0_6095", message: "Loading module as file / folder, candidate module location '{0}'." }, + File_0_does_not_exist: { code: 6096, category: ts.DiagnosticCategory.Message, key: "File_0_does_not_exist_6096", message: "File '{0}' does not exist." }, + File_0_exist_use_it_as_a_name_resolution_result: { code: 6097, category: ts.DiagnosticCategory.Message, key: "File_0_exist_use_it_as_a_name_resolution_result_6097", message: "File '{0}' exist - use it as a name resolution result." }, + Loading_module_0_from_node_modules_folder: { code: 6098, category: ts.DiagnosticCategory.Message, key: "Loading_module_0_from_node_modules_folder_6098", message: "Loading module '{0}' from 'node_modules' folder." }, + Found_package_json_at_0: { code: 6099, category: ts.DiagnosticCategory.Message, key: "Found_package_json_at_0_6099", message: "Found 'package.json' at '{0}'." }, + package_json_does_not_have_types_field: { code: 6100, category: ts.DiagnosticCategory.Message, key: "package_json_does_not_have_types_field_6100", message: "'package.json' does not have 'types' field." }, + package_json_has_0_field_1_that_references_2: { code: 6101, category: ts.DiagnosticCategory.Message, key: "package_json_has_0_field_1_that_references_2_6101", message: "'package.json' has '{0}' field '{1}' that references '{2}'." }, + Allow_javascript_files_to_be_compiled: { code: 6102, category: ts.DiagnosticCategory.Message, key: "Allow_javascript_files_to_be_compiled_6102", message: "Allow javascript files to be compiled." }, + Option_0_should_have_array_of_strings_as_a_value: { code: 6103, category: ts.DiagnosticCategory.Error, key: "Option_0_should_have_array_of_strings_as_a_value_6103", message: "Option '{0}' should have array of strings as a value." }, + Checking_if_0_is_the_longest_matching_prefix_for_1_2: { code: 6104, category: ts.DiagnosticCategory.Message, key: "Checking_if_0_is_the_longest_matching_prefix_for_1_2_6104", message: "Checking if '{0}' is the longest matching prefix for '{1}' - '{2}'." }, + Expected_type_of_0_field_in_package_json_to_be_string_got_1: { code: 6105, category: ts.DiagnosticCategory.Message, key: "Expected_type_of_0_field_in_package_json_to_be_string_got_1_6105", message: "Expected type of '{0}' field in 'package.json' to be 'string', got '{1}'." }, + baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1: { code: 6106, category: ts.DiagnosticCategory.Message, key: "baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1_6106", message: "'baseUrl' option is set to '{0}', using this value to resolve non-relative module name '{1}'" }, + rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0: { code: 6107, category: ts.DiagnosticCategory.Message, key: "rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0_6107", message: "'rootDirs' option is set, using it to resolve relative module name '{0}'" }, + Longest_matching_prefix_for_0_is_1: { code: 6108, category: ts.DiagnosticCategory.Message, key: "Longest_matching_prefix_for_0_is_1_6108", message: "Longest matching prefix for '{0}' is '{1}'" }, + Loading_0_from_the_root_dir_1_candidate_location_2: { code: 6109, category: ts.DiagnosticCategory.Message, key: "Loading_0_from_the_root_dir_1_candidate_location_2_6109", message: "Loading '{0}' from the root dir '{1}', candidate location '{2}'" }, + Trying_other_entries_in_rootDirs: { code: 6110, category: ts.DiagnosticCategory.Message, key: "Trying_other_entries_in_rootDirs_6110", message: "Trying other entries in 'rootDirs'" }, + Module_resolution_using_rootDirs_has_failed: { code: 6111, category: ts.DiagnosticCategory.Message, key: "Module_resolution_using_rootDirs_has_failed_6111", message: "Module resolution using 'rootDirs' has failed" }, + Do_not_emit_use_strict_directives_in_module_output: { code: 6112, category: ts.DiagnosticCategory.Message, key: "Do_not_emit_use_strict_directives_in_module_output_6112", message: "Do not emit 'use strict' directives in module output." }, + Enable_strict_null_checks: { code: 6113, category: ts.DiagnosticCategory.Message, key: "Enable_strict_null_checks_6113", message: "Enable strict null checks." }, + Unknown_option_excludes_Did_you_mean_exclude: { code: 6114, category: ts.DiagnosticCategory.Error, key: "Unknown_option_excludes_Did_you_mean_exclude_6114", message: "Unknown option 'excludes'. Did you mean 'exclude'?" }, + Raise_error_on_this_expressions_with_an_implied_any_type: { code: 6115, category: ts.DiagnosticCategory.Message, key: "Raise_error_on_this_expressions_with_an_implied_any_type_6115", message: "Raise error on 'this' expressions with an implied 'any' type." }, + Resolving_type_reference_directive_0_containing_file_1_root_directory_2: { code: 6116, category: ts.DiagnosticCategory.Message, key: "Resolving_type_reference_directive_0_containing_file_1_root_directory_2_6116", message: "======== Resolving type reference directive '{0}', containing file '{1}', root directory '{2}'. ========" }, + Resolving_using_primary_search_paths: { code: 6117, category: ts.DiagnosticCategory.Message, key: "Resolving_using_primary_search_paths_6117", message: "Resolving using primary search paths..." }, + Resolving_from_node_modules_folder: { code: 6118, category: ts.DiagnosticCategory.Message, key: "Resolving_from_node_modules_folder_6118", message: "Resolving from node_modules folder..." }, + Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2: { code: 6119, category: ts.DiagnosticCategory.Message, key: "Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2_6119", message: "======== Type reference directive '{0}' was successfully resolved to '{1}', primary: {2}. ========" }, + Type_reference_directive_0_was_not_resolved: { code: 6120, category: ts.DiagnosticCategory.Message, key: "Type_reference_directive_0_was_not_resolved_6120", message: "======== Type reference directive '{0}' was not resolved. ========" }, + Resolving_with_primary_search_path_0: { code: 6121, category: ts.DiagnosticCategory.Message, key: "Resolving_with_primary_search_path_0_6121", message: "Resolving with primary search path '{0}'" }, + Root_directory_cannot_be_determined_skipping_primary_search_paths: { code: 6122, category: ts.DiagnosticCategory.Message, key: "Root_directory_cannot_be_determined_skipping_primary_search_paths_6122", message: "Root directory cannot be determined, skipping primary search paths." }, + Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set: { code: 6123, category: ts.DiagnosticCategory.Message, key: "Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set_6123", message: "======== Resolving type reference directive '{0}', containing file '{1}', root directory not set. ========" }, + Type_declaration_files_to_be_included_in_compilation: { code: 6124, category: ts.DiagnosticCategory.Message, key: "Type_declaration_files_to_be_included_in_compilation_6124", message: "Type declaration files to be included in compilation." }, + Looking_up_in_node_modules_folder_initial_location_0: { code: 6125, category: ts.DiagnosticCategory.Message, key: "Looking_up_in_node_modules_folder_initial_location_0_6125", message: "Looking up in 'node_modules' folder, initial location '{0}'" }, + Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_modules_folder: { code: 6126, category: ts.DiagnosticCategory.Message, key: "Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_mod_6126", message: "Containing file is not specified and root directory cannot be determined, skipping lookup in 'node_modules' folder." }, + Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1: { code: 6127, category: ts.DiagnosticCategory.Message, key: "Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1_6127", message: "======== Resolving type reference directive '{0}', containing file not set, root directory '{1}'. ========" }, + Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set: { code: 6128, category: ts.DiagnosticCategory.Message, key: "Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set_6128", message: "======== Resolving type reference directive '{0}', containing file not set, root directory not set. ========" }, + The_config_file_0_found_doesn_t_contain_any_source_files: { code: 6129, category: ts.DiagnosticCategory.Error, key: "The_config_file_0_found_doesn_t_contain_any_source_files_6129", message: "The config file '{0}' found doesn't contain any source files." }, + Resolving_real_path_for_0_result_1: { code: 6130, category: ts.DiagnosticCategory.Message, key: "Resolving_real_path_for_0_result_1_6130", message: "Resolving real path for '{0}', result '{1}'" }, Variable_0_implicitly_has_an_1_type: { code: 7005, category: ts.DiagnosticCategory.Error, key: "Variable_0_implicitly_has_an_1_type_7005", message: "Variable '{0}' implicitly has an '{1}' type." }, Parameter_0_implicitly_has_an_1_type: { code: 7006, category: ts.DiagnosticCategory.Error, key: "Parameter_0_implicitly_has_an_1_type_7006", message: "Parameter '{0}' implicitly has an '{1}' type." }, Member_0_implicitly_has_an_1_type: { code: 7008, category: ts.DiagnosticCategory.Error, key: "Member_0_implicitly_has_an_1_type_7008", message: "Member '{0}' implicitly has an '{1}' type." }, @@ -2626,6 +2931,7 @@ var ts; _0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type: { code: 7010, category: ts.DiagnosticCategory.Error, key: "_0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type_7010", message: "'{0}', which lacks return-type annotation, implicitly has an '{1}' return type." }, Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type: { code: 7011, category: ts.DiagnosticCategory.Error, key: "Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type_7011", message: "Function expression, which lacks return-type annotation, implicitly has an '{0}' return type." }, Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7013, category: ts.DiagnosticCategory.Error, key: "Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type_7013", message: "Construct signature, which lacks return-type annotation, implicitly has an 'any' return type." }, + Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number: { code: 7015, category: ts.DiagnosticCategory.Error, key: "Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number_7015", message: "Element implicitly has an 'any' type because index expression is not of type 'number'." }, Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_type_annotation: { code: 7016, category: ts.DiagnosticCategory.Error, key: "Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_type_annotation_7016", message: "Property '{0}' implicitly has type 'any', because its 'set' accessor lacks a type annotation." }, Index_signature_of_object_type_implicitly_has_an_any_type: { code: 7017, category: ts.DiagnosticCategory.Error, key: "Index_signature_of_object_type_implicitly_has_an_any_type_7017", message: "Index signature of object type implicitly has an 'any' type." }, Object_literal_s_property_0_implicitly_has_an_1_type: { code: 7018, category: ts.DiagnosticCategory.Error, key: "Object_literal_s_property_0_implicitly_has_an_1_type_7018", message: "Object literal's property '{0}' implicitly has an '{1}' type." }, @@ -2640,6 +2946,7 @@ var ts; Unused_label: { code: 7028, category: ts.DiagnosticCategory.Error, key: "Unused_label_7028", message: "Unused label." }, Fallthrough_case_in_switch: { code: 7029, category: ts.DiagnosticCategory.Error, key: "Fallthrough_case_in_switch_7029", message: "Fallthrough case in switch." }, Not_all_code_paths_return_a_value: { code: 7030, category: ts.DiagnosticCategory.Error, key: "Not_all_code_paths_return_a_value_7030", message: "Not all code paths return a value." }, + Binding_element_0_implicitly_has_an_1_type: { code: 7031, category: ts.DiagnosticCategory.Error, key: "Binding_element_0_implicitly_has_an_1_type_7031", message: "Binding element '{0}' implicitly has an '{1}' type." }, You_cannot_rename_this_element: { code: 8000, category: ts.DiagnosticCategory.Error, key: "You_cannot_rename_this_element_8000", message: "You cannot rename this element." }, You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: { code: 8001, category: ts.DiagnosticCategory.Error, key: "You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library_8001", message: "You cannot rename elements that are defined in the standard TypeScript library." }, import_can_only_be_used_in_a_ts_file: { code: 8002, category: ts.DiagnosticCategory.Error, key: "import_can_only_be_used_in_a_ts_file_8002", message: "'import ... =' can only be used in a .ts file." }, @@ -2656,7 +2963,6 @@ var ts; property_declarations_can_only_be_used_in_a_ts_file: { code: 8014, category: ts.DiagnosticCategory.Error, key: "property_declarations_can_only_be_used_in_a_ts_file_8014", message: "'property declarations' can only be used in a .ts file." }, enum_declarations_can_only_be_used_in_a_ts_file: { code: 8015, category: ts.DiagnosticCategory.Error, key: "enum_declarations_can_only_be_used_in_a_ts_file_8015", message: "'enum declarations' can only be used in a .ts file." }, type_assertion_expressions_can_only_be_used_in_a_ts_file: { code: 8016, category: ts.DiagnosticCategory.Error, key: "type_assertion_expressions_can_only_be_used_in_a_ts_file_8016", message: "'type assertion expressions' can only be used in a .ts file." }, - decorators_can_only_be_used_in_a_ts_file: { code: 8017, category: ts.DiagnosticCategory.Error, key: "decorators_can_only_be_used_in_a_ts_file_8017", message: "'decorators' can only be used in a .ts file." }, Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_class_extends_clauses: { code: 9002, category: ts.DiagnosticCategory.Error, key: "Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_clas_9002", message: "Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses." }, class_expressions_are_not_currently_supported: { code: 9003, category: ts.DiagnosticCategory.Error, key: "class_expressions_are_not_currently_supported_9003", message: "'class' expressions are not currently supported." }, JSX_attributes_must_only_be_assigned_a_non_empty_expression: { code: 17000, category: ts.DiagnosticCategory.Error, key: "JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000", message: "JSX attributes must only be assigned a non-empty 'expression'." }, @@ -2666,7 +2972,10 @@ var ts; Cannot_use_JSX_unless_the_jsx_flag_is_provided: { code: 17004, category: ts.DiagnosticCategory.Error, key: "Cannot_use_JSX_unless_the_jsx_flag_is_provided_17004", message: "Cannot use JSX unless the '--jsx' flag is provided." }, A_constructor_cannot_contain_a_super_call_when_its_class_extends_null: { code: 17005, category: ts.DiagnosticCategory.Error, key: "A_constructor_cannot_contain_a_super_call_when_its_class_extends_null_17005", message: "A constructor cannot contain a 'super' call when its class extends 'null'" }, An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: { code: 17006, category: ts.DiagnosticCategory.Error, key: "An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_ex_17006", message: "An unary expression with the '{0}' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses." }, - A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: { code: 17007, category: ts.DiagnosticCategory.Error, key: "A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Con_17007", message: "A type assertion expression is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses." } + A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: { code: 17007, category: ts.DiagnosticCategory.Error, key: "A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Con_17007", message: "A type assertion expression is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses." }, + JSX_element_0_has_no_corresponding_closing_tag: { code: 17008, category: ts.DiagnosticCategory.Error, key: "JSX_element_0_has_no_corresponding_closing_tag_17008", message: "JSX element '{0}' has no corresponding closing tag." }, + super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class: { code: 17009, category: ts.DiagnosticCategory.Error, key: "super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class_17009", message: "'super' must be called before accessing 'this' in the constructor of a derived class." }, + Unknown_typing_option_0: { code: 17010, category: ts.DiagnosticCategory.Error, key: "Unknown_typing_option_0_17010", message: "Unknown typing option '{0}'." } }; })(ts || (ts = {})); /// @@ -2702,7 +3011,7 @@ var ts; "false": 84 /* FalseKeyword */, "finally": 85 /* FinallyKeyword */, "for": 86 /* ForKeyword */, - "from": 133 /* FromKeyword */, + "from": 136 /* FromKeyword */, "function": 87 /* FunctionKeyword */, "get": 123 /* GetKeyword */, "if": 88 /* IfKeyword */, @@ -2715,27 +3024,31 @@ var ts; "let": 108 /* LetKeyword */, "module": 125 /* ModuleKeyword */, "namespace": 126 /* NamespaceKeyword */, + "never": 127 /* NeverKeyword */, "new": 92 /* NewKeyword */, "null": 93 /* NullKeyword */, - "number": 128 /* NumberKeyword */, + "number": 130 /* NumberKeyword */, "package": 109 /* PackageKeyword */, "private": 110 /* PrivateKeyword */, "protected": 111 /* ProtectedKeyword */, "public": 112 /* PublicKeyword */, - "require": 127 /* RequireKeyword */, + "readonly": 128 /* ReadonlyKeyword */, + "require": 129 /* RequireKeyword */, + "global": 137 /* GlobalKeyword */, "return": 94 /* ReturnKeyword */, - "set": 129 /* SetKeyword */, + "set": 131 /* SetKeyword */, "static": 113 /* StaticKeyword */, - "string": 130 /* StringKeyword */, + "string": 132 /* StringKeyword */, "super": 95 /* SuperKeyword */, "switch": 96 /* SwitchKeyword */, - "symbol": 131 /* SymbolKeyword */, + "symbol": 133 /* SymbolKeyword */, "this": 97 /* ThisKeyword */, "throw": 98 /* ThrowKeyword */, "true": 99 /* TrueKeyword */, "try": 100 /* TryKeyword */, - "type": 132 /* TypeKeyword */, + "type": 134 /* TypeKeyword */, "typeof": 101 /* TypeOfKeyword */, + "undefined": 135 /* UndefinedKeyword */, "var": 102 /* VarKeyword */, "void": 103 /* VoidKeyword */, "while": 104 /* WhileKeyword */, @@ -2743,7 +3056,7 @@ var ts; "yield": 114 /* YieldKeyword */, "async": 118 /* AsyncKeyword */, "await": 119 /* AwaitKeyword */, - "of": 134 /* OfKeyword */, + "of": 138 /* OfKeyword */, "{": 15 /* OpenBraceToken */, "}": 16 /* CloseBraceToken */, "(": 17 /* OpenParenToken */, @@ -2906,7 +3219,8 @@ var ts; var pos = 0; var lineStart = 0; while (pos < text.length) { - var ch = text.charCodeAt(pos++); + var ch = text.charCodeAt(pos); + pos++; switch (ch) { case 13 /* carriageReturn */: if (text.charCodeAt(pos) === 10 /* lineFeed */) { @@ -3040,6 +3354,11 @@ var ts; ts.couldStartTrivia = couldStartTrivia; /* @internal */ function skipTrivia(text, pos, stopAfterLineBreak) { + // Using ! with a greater than test is a fast way of testing the following conditions: + // pos === undefined || pos === null || isNaN(pos) || pos < 0; + if (!(pos >= 0)) { + return pos; + } // Keep in sync with couldStartTrivia while (true) { var ch = text.charCodeAt(pos); @@ -3109,7 +3428,7 @@ 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 followd by a space. + // a <<<<<<< or >>>>>>> marker then it is also followed by a space. var mergeConflictMarkerLength = "<<<<<<<".length; function isConflictMarkerTrivia(text, pos) { ts.Debug.assert(pos >= 0); @@ -3141,7 +3460,7 @@ var ts; } else { ts.Debug.assert(ch === 61 /* equals */); - // Consume everything from the start of the mid-conlict marker to the start of the next + // Consume everything from the start of the mid-conflict marker to the start of the next // end-conflict marker. while (pos < len) { var ch_1 = text.charCodeAt(pos); @@ -3276,6 +3595,19 @@ var ts; ch > 127 /* maxAsciiCharacter */ && isUnicodeIdentifierPart(ch, languageVersion); } ts.isIdentifierPart = isIdentifierPart; + /* @internal */ + function isIdentifier(name, languageVersion) { + if (!isIdentifierStart(name.charCodeAt(0), languageVersion)) { + return false; + } + for (var i = 1, n = name.length; i < n; i++) { + if (!isIdentifierPart(name.charCodeAt(i), languageVersion)) { + return false; + } + } + return true; + } + ts.isIdentifier = isIdentifier; // Creates a scanner over a (possibly unspecified) range of a piece of text. function createScanner(languageVersion, skipTrivia, languageVariant, text, onError, start, length) { if (languageVariant === void 0) { languageVariant = 0 /* Standard */; } @@ -3311,6 +3643,7 @@ var ts; scanJsxIdentifier: scanJsxIdentifier, reScanJsxToken: reScanJsxToken, scanJsxToken: scanJsxToken, + scanJSDocToken: scanJSDocToken, scan: scan, setText: setText, setScriptTarget: setScriptTarget, @@ -3318,7 +3651,8 @@ var ts; setOnError: setOnError, setTextPos: setTextPos, tryScan: tryScan, - lookAhead: lookAhead + lookAhead: lookAhead, + scanRange: scanRange }; function error(message, length) { if (onError) { @@ -3398,7 +3732,8 @@ var ts; return value; } function scanString() { - var quote = text.charCodeAt(pos++); + var quote = text.charCodeAt(pos); + pos++; var result = ""; var start = pos; while (true) { @@ -3494,7 +3829,8 @@ var ts; error(ts.Diagnostics.Unexpected_end_of_text); return ""; } - var ch = text.charCodeAt(pos++); + var ch = text.charCodeAt(pos); + pos++; switch (ch) { case 48 /* _0 */: return "\0"; @@ -3721,7 +4057,8 @@ var ts; } return pos += 2, token = 31 /* ExclamationEqualsToken */; } - return pos++, token = 49 /* ExclamationToken */; + pos++; + return token = 49 /* ExclamationToken */; case 34 /* doubleQuote */: case 39 /* singleQuote */: tokenValue = scanString(); @@ -3732,7 +4069,8 @@ var ts; if (text.charCodeAt(pos + 1) === 61 /* equals */) { return pos += 2, token = 62 /* PercentEqualsToken */; } - return pos++, token = 40 /* PercentToken */; + pos++; + return token = 40 /* PercentToken */; case 38 /* ampersand */: if (text.charCodeAt(pos + 1) === 38 /* ampersand */) { return pos += 2, token = 51 /* AmpersandAmpersandToken */; @@ -3740,11 +4078,14 @@ var ts; if (text.charCodeAt(pos + 1) === 61 /* equals */) { return pos += 2, token = 66 /* AmpersandEqualsToken */; } - return pos++, token = 46 /* AmpersandToken */; + pos++; + return token = 46 /* AmpersandToken */; case 40 /* openParen */: - return pos++, token = 17 /* OpenParenToken */; + pos++; + return token = 17 /* OpenParenToken */; case 41 /* closeParen */: - return pos++, token = 18 /* CloseParenToken */; + pos++; + return token = 18 /* CloseParenToken */; case 42 /* asterisk */: if (text.charCodeAt(pos + 1) === 61 /* equals */) { return pos += 2, token = 59 /* AsteriskEqualsToken */; @@ -3755,7 +4096,8 @@ var ts; } return pos += 2, token = 38 /* AsteriskAsteriskToken */; } - return pos++, token = 37 /* AsteriskToken */; + pos++; + return token = 37 /* AsteriskToken */; case 43 /* plus */: if (text.charCodeAt(pos + 1) === 43 /* plus */) { return pos += 2, token = 41 /* PlusPlusToken */; @@ -3763,9 +4105,11 @@ var ts; if (text.charCodeAt(pos + 1) === 61 /* equals */) { return pos += 2, token = 57 /* PlusEqualsToken */; } - return pos++, token = 35 /* PlusToken */; + pos++; + return token = 35 /* PlusToken */; case 44 /* comma */: - return pos++, token = 24 /* CommaToken */; + pos++; + return token = 24 /* CommaToken */; case 45 /* minus */: if (text.charCodeAt(pos + 1) === 45 /* minus */) { return pos += 2, token = 42 /* MinusMinusToken */; @@ -3773,7 +4117,8 @@ var ts; if (text.charCodeAt(pos + 1) === 61 /* equals */) { return pos += 2, token = 58 /* MinusEqualsToken */; } - return pos++, token = 36 /* MinusToken */; + pos++; + return token = 36 /* MinusToken */; case 46 /* dot */: if (isDigit(text.charCodeAt(pos + 1))) { tokenValue = scanNumber(); @@ -3782,7 +4127,8 @@ var ts; if (text.charCodeAt(pos + 1) === 46 /* dot */ && text.charCodeAt(pos + 2) === 46 /* dot */) { return pos += 3, token = 22 /* DotDotDotToken */; } - return pos++, token = 21 /* DotToken */; + pos++; + return token = 21 /* DotToken */; case 47 /* slash */: // Single-line comment if (text.charCodeAt(pos + 1) === 47 /* slash */) { @@ -3830,7 +4176,8 @@ var ts; if (text.charCodeAt(pos + 1) === 61 /* equals */) { return pos += 2, token = 61 /* SlashEqualsToken */; } - return pos++, token = 39 /* SlashToken */; + pos++; + return token = 39 /* SlashToken */; case 48 /* _0 */: if (pos + 2 < end && (text.charCodeAt(pos + 1) === 88 /* X */ || text.charCodeAt(pos + 1) === 120 /* x */)) { pos += 2; @@ -3882,9 +4229,11 @@ var ts; tokenValue = scanNumber(); return token = 8 /* NumericLiteral */; case 58 /* colon */: - return pos++, token = 54 /* ColonToken */; + pos++; + return token = 54 /* ColonToken */; case 59 /* semicolon */: - return pos++, token = 23 /* SemicolonToken */; + pos++; + return token = 23 /* SemicolonToken */; case 60 /* lessThan */: if (isConflictMarkerTrivia(text, pos)) { pos = scanConflictMarkerTrivia(text, pos, error); @@ -3909,7 +4258,8 @@ var ts; text.charCodeAt(pos + 2) !== 42 /* asterisk */) { return pos += 2, token = 26 /* LessThanSlashToken */; } - return pos++, token = 25 /* LessThanToken */; + pos++; + return token = 25 /* LessThanToken */; case 61 /* equals */: if (isConflictMarkerTrivia(text, pos)) { pos = scanConflictMarkerTrivia(text, pos, error); @@ -3929,7 +4279,8 @@ var ts; if (text.charCodeAt(pos + 1) === 62 /* greaterThan */) { return pos += 2, token = 34 /* EqualsGreaterThanToken */; } - return pos++, token = 56 /* EqualsToken */; + pos++; + return token = 56 /* EqualsToken */; case 62 /* greaterThan */: if (isConflictMarkerTrivia(text, pos)) { pos = scanConflictMarkerTrivia(text, pos, error); @@ -3940,20 +4291,26 @@ var ts; return token = 7 /* ConflictMarkerTrivia */; } } - return pos++, token = 27 /* GreaterThanToken */; + pos++; + return token = 27 /* GreaterThanToken */; case 63 /* question */: - return pos++, token = 53 /* QuestionToken */; + pos++; + return token = 53 /* QuestionToken */; case 91 /* openBracket */: - return pos++, token = 19 /* OpenBracketToken */; + pos++; + return token = 19 /* OpenBracketToken */; case 93 /* closeBracket */: - return pos++, token = 20 /* CloseBracketToken */; + pos++; + return token = 20 /* CloseBracketToken */; case 94 /* caret */: if (text.charCodeAt(pos + 1) === 61 /* equals */) { return pos += 2, token = 68 /* CaretEqualsToken */; } - return pos++, token = 48 /* CaretToken */; + pos++; + return token = 48 /* CaretToken */; case 123 /* openBrace */: - return pos++, token = 15 /* OpenBraceToken */; + pos++; + return token = 15 /* OpenBraceToken */; case 124 /* bar */: if (text.charCodeAt(pos + 1) === 124 /* bar */) { return pos += 2, token = 52 /* BarBarToken */; @@ -3961,13 +4318,17 @@ var ts; if (text.charCodeAt(pos + 1) === 61 /* equals */) { return pos += 2, token = 67 /* BarEqualsToken */; } - return pos++, token = 47 /* BarToken */; + pos++; + return token = 47 /* BarToken */; case 125 /* closeBrace */: - return pos++, token = 16 /* CloseBraceToken */; + pos++; + return token = 16 /* CloseBraceToken */; case 126 /* tilde */: - return pos++, token = 50 /* TildeToken */; + pos++; + return token = 50 /* TildeToken */; case 64 /* at */: - return pos++, token = 55 /* AtToken */; + pos++; + return token = 55 /* AtToken */; case 92 /* backslash */: var cookedChar = peekUnicodeEscape(); if (cookedChar >= 0 && isIdentifierStart(cookedChar, languageVersion)) { @@ -3976,7 +4337,8 @@ var ts; return token = getIdentifierToken(); } error(ts.Diagnostics.Invalid_character); - return pos++, token = 0 /* Unknown */; + pos++; + return token = 0 /* Unknown */; default: if (isIdentifierStart(ch, languageVersion)) { pos++; @@ -3998,7 +4360,8 @@ var ts; continue; } error(ts.Diagnostics.Invalid_character); - return pos++, token = 0 /* Unknown */; + pos++; + return token = 0 /* Unknown */; } } } @@ -4014,10 +4377,12 @@ var ts; if (text.charCodeAt(pos + 1) === 61 /* equals */) { return pos += 2, token = 64 /* GreaterThanGreaterThanEqualsToken */; } - return pos++, token = 44 /* GreaterThanGreaterThanToken */; + pos++; + return token = 44 /* GreaterThanGreaterThanToken */; } if (text.charCodeAt(pos) === 61 /* equals */) { - return pos++, token = 29 /* GreaterThanEqualsToken */; + pos++; + return token = 29 /* GreaterThanEqualsToken */; } } return token; @@ -4109,7 +4474,7 @@ var ts; break; } } - return token = 236 /* JsxText */; + return token = 244 /* JsxText */; } // Scans a JSX identifier; these differ from normal identifiers in that // they allow dashes @@ -4129,6 +4494,55 @@ var ts; } return token; } + function scanJSDocToken() { + if (pos >= end) { + return token = 1 /* EndOfFileToken */; + } + startPos = pos; + // Eat leading whitespace + var ch = text.charCodeAt(pos); + while (pos < end) { + ch = text.charCodeAt(pos); + if (isWhiteSpace(ch)) { + pos++; + } + else { + break; + } + } + tokenPos = pos; + switch (ch) { + case 64 /* at */: + return pos += 1, token = 55 /* AtToken */; + case 10 /* lineFeed */: + case 13 /* carriageReturn */: + return pos += 1, token = 4 /* NewLineTrivia */; + case 42 /* asterisk */: + return pos += 1, token = 37 /* AsteriskToken */; + case 123 /* openBrace */: + return pos += 1, token = 15 /* OpenBraceToken */; + case 125 /* closeBrace */: + return pos += 1, token = 16 /* CloseBraceToken */; + case 91 /* openBracket */: + return pos += 1, token = 19 /* OpenBracketToken */; + case 93 /* closeBracket */: + return pos += 1, token = 20 /* CloseBracketToken */; + case 61 /* equals */: + return pos += 1, token = 56 /* EqualsToken */; + case 44 /* comma */: + return pos += 1, token = 24 /* CommaToken */; + } + if (isIdentifierStart(ch, 2 /* Latest */)) { + pos++; + while (isIdentifierPart(text.charCodeAt(pos), 2 /* Latest */) && pos < end) { + pos++; + } + return token = 69 /* Identifier */; + } + else { + return pos += 1, token = 0 /* Unknown */; + } + } function speculationHelper(callback, isLookahead) { var savePos = pos; var saveStartPos = startPos; @@ -4149,11 +4563,34 @@ var ts; } return result; } + function scanRange(start, length, callback) { + var saveEnd = end; + var savePos = pos; + var saveStartPos = startPos; + var saveTokenPos = tokenPos; + var saveToken = token; + var savePrecedingLineBreak = precedingLineBreak; + var saveTokenValue = tokenValue; + var saveHasExtendedUnicodeEscape = hasExtendedUnicodeEscape; + var saveTokenIsUnterminated = tokenIsUnterminated; + setText(text, start, length); + var result = callback(); + end = saveEnd; + pos = savePos; + startPos = saveStartPos; + tokenPos = saveTokenPos; + token = saveToken; + precedingLineBreak = savePrecedingLineBreak; + tokenValue = saveTokenValue; + hasExtendedUnicodeEscape = saveHasExtendedUnicodeEscape; + tokenIsUnterminated = saveTokenIsUnterminated; + return result; + } function lookAhead(callback) { - return speculationHelper(callback, /*isLookahead:*/ true); + return speculationHelper(callback, /*isLookahead*/ true); } function tryScan(callback) { - return speculationHelper(callback, /*isLookahead:*/ false); + return speculationHelper(callback, /*isLookahead*/ false); } function setText(newText, start, length) { text = newText || ""; @@ -4204,10 +4641,10 @@ var ts; var stringWriters = []; function getSingleLineStringWriter() { if (stringWriters.length === 0) { - var str = ""; - var writeText = function (text) { return str += text; }; + var str_1 = ""; + var writeText = function (text) { return str_1 += text; }; return { - string: function () { return str; }, + string: function () { return str_1; }, writeKeyword: writeText, writeOperator: writeText, writePunctuation: writeText, @@ -4217,10 +4654,10 @@ var ts; writeSymbol: writeText, // Completely ignore indentation for string writers. And map newlines to // a single space. - writeLine: function () { return str += " "; }, + writeLine: function () { return str_1 += " "; }, increaseIndent: function () { }, decreaseIndent: function () { }, - clear: function () { return str = ""; }, + clear: function () { return str_1 = ""; }, trackSymbol: function () { }, reportInaccessibleThisError: function () { } }; @@ -4237,6 +4674,24 @@ var ts; return node.end - node.pos; } ts.getFullWidth = getFullWidth; + function mapIsEqualTo(map1, map2) { + if (!map1 || !map2) { + return map1 === map2; + } + return containsAll(map1, map2) && containsAll(map2, map1); + } + ts.mapIsEqualTo = mapIsEqualTo; + function containsAll(map, other) { + for (var key in map) { + if (!ts.hasProperty(map, key)) { + continue; + } + if (!ts.hasProperty(other, key) || map[key] !== other[key]) { + return false; + } + } + return true; + } function arrayIsEqualTo(array1, array2, equaler) { if (!array1 || !array2) { return array1 === array2; @@ -4244,7 +4699,7 @@ var ts; if (array1.length !== array2.length) { return false; } - for (var i = 0; i < array1.length; ++i) { + for (var i = 0; i < array1.length; i++) { var equals = equaler ? equaler(array1[i], array2[i]) : array1[i] === array2[i]; if (!equals) { return false; @@ -4268,36 +4723,83 @@ var ts; sourceFile.resolvedModules[moduleNameText] = resolvedModule; } ts.setResolvedModule = setResolvedModule; + function setResolvedTypeReferenceDirective(sourceFile, typeReferenceDirectiveName, resolvedTypeReferenceDirective) { + if (!sourceFile.resolvedTypeReferenceDirectiveNames) { + sourceFile.resolvedTypeReferenceDirectiveNames = {}; + } + sourceFile.resolvedTypeReferenceDirectiveNames[typeReferenceDirectiveName] = resolvedTypeReferenceDirective; + } + ts.setResolvedTypeReferenceDirective = setResolvedTypeReferenceDirective; + /* @internal */ + function moduleResolutionIsEqualTo(oldResolution, newResolution) { + return oldResolution.resolvedFileName === newResolution.resolvedFileName && oldResolution.isExternalLibraryImport === newResolution.isExternalLibraryImport; + } + ts.moduleResolutionIsEqualTo = moduleResolutionIsEqualTo; + /* @internal */ + function typeDirectiveIsEqualTo(oldResolution, newResolution) { + return oldResolution.resolvedFileName === newResolution.resolvedFileName && oldResolution.primary === newResolution.primary; + } + ts.typeDirectiveIsEqualTo = typeDirectiveIsEqualTo; + /* @internal */ + function hasChangesInResolutions(names, newResolutions, oldResolutions, comparer) { + if (names.length !== newResolutions.length) { + return false; + } + for (var i = 0; i < names.length; i++) { + var newResolution = newResolutions[i]; + var oldResolution = oldResolutions && ts.hasProperty(oldResolutions, names[i]) ? oldResolutions[names[i]] : undefined; + var changed = oldResolution + ? !newResolution || !comparer(oldResolution, newResolution) + : newResolution; + if (changed) { + return true; + } + } + return false; + } + ts.hasChangesInResolutions = hasChangesInResolutions; // Returns true if this node contains a parse error anywhere underneath it. function containsParseError(node) { aggregateChildData(node); - return (node.parserContextFlags & 64 /* ThisNodeOrAnySubNodesHasError */) !== 0; + return (node.flags & 268435456 /* ThisNodeOrAnySubNodesHasError */) !== 0; } ts.containsParseError = containsParseError; function aggregateChildData(node) { - if (!(node.parserContextFlags & 128 /* HasAggregatedChildData */)) { + if (!(node.flags & 536870912 /* 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.parserContextFlags & 16 /* ThisNodeHasError */) !== 0) || + var thisNodeOrAnySubNodesHasError = ((node.flags & 67108864 /* ThisNodeHasError */) !== 0) || ts.forEachChild(node, containsParseError); // If so, mark ourselves accordingly. if (thisNodeOrAnySubNodesHasError) { - node.parserContextFlags |= 64 /* ThisNodeOrAnySubNodesHasError */; + node.flags |= 268435456 /* ThisNodeOrAnySubNodesHasError */; } - // Also mark that we've propogated the child information to this node. This way we can + // 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.parserContextFlags |= 128 /* HasAggregatedChildData */; + node.flags |= 536870912 /* HasAggregatedChildData */; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 248 /* SourceFile */) { + while (node && node.kind !== 256 /* SourceFile */) { node = node.parent; } return node; } ts.getSourceFileOfNode = getSourceFileOfNode; + function isStatementWithLocals(node) { + switch (node.kind) { + case 199 /* Block */: + case 227 /* CaseBlock */: + case 206 /* ForStatement */: + case 207 /* ForInStatement */: + case 208 /* ForOfStatement */: + return true; + } + return false; + } + ts.isStatementWithLocals = isStatementWithLocals; function getStartPositionOfLine(line, sourceFile) { ts.Debug.assert(line >= 0); return ts.getLineStarts(sourceFile)[line]; @@ -4314,6 +4816,32 @@ var ts; return node.pos; } ts.getStartPosOfNode = getStartPosOfNode; + function getEndLinePosition(line, sourceFile) { + ts.Debug.assert(line >= 0); + var lineStarts = ts.getLineStarts(sourceFile); + 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--; + } + return pos; + } + } + ts.getEndLinePosition = getEndLinePosition; // 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 @@ -4391,10 +4919,42 @@ var ts; } ts.makeIdentifierFromModuleName = makeIdentifierFromModuleName; function isBlockOrCatchScoped(declaration) { - return (getCombinedNodeFlags(declaration) & 24576 /* BlockScoped */) !== 0 || + return (getCombinedNodeFlags(declaration) & 3072 /* BlockScoped */) !== 0 || isCatchClauseVariableDeclaration(declaration); } ts.isBlockOrCatchScoped = isBlockOrCatchScoped; + function isAmbientModule(node) { + return node && node.kind === 225 /* ModuleDeclaration */ && + (node.name.kind === 9 /* StringLiteral */ || isGlobalScopeAugmentation(node)); + } + ts.isAmbientModule = isAmbientModule; + function isBlockScopedContainerTopLevel(node) { + return node.kind === 256 /* SourceFile */ || + node.kind === 225 /* ModuleDeclaration */ || + isFunctionLike(node) || + isFunctionBlock(node); + } + ts.isBlockScopedContainerTopLevel = isBlockScopedContainerTopLevel; + function isGlobalScopeAugmentation(module) { + return !!(module.flags & 131072 /* GlobalAugmentation */); + } + ts.isGlobalScopeAugmentation = isGlobalScopeAugmentation; + function isExternalModuleAugmentation(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 + if (!node || !isAmbientModule(node)) { + return false; + } + switch (node.parent.kind) { + case 256 /* SourceFile */: + return ts.isExternalModule(node.parent); + case 226 /* ModuleBlock */: + return isAmbientModule(node.parent.parent) && !ts.isExternalModule(node.parent.parent.parent); + } + return false; + } + ts.isExternalModuleAugmentation = isExternalModuleAugmentation; // Gets the nearest enclosing block scope container that has the provided node // as a descendant, that is not the provided node. function getEnclosingBlockScopeContainer(node) { @@ -4404,15 +4964,15 @@ var ts; return current; } switch (current.kind) { - case 248 /* SourceFile */: - case 220 /* CaseBlock */: - case 244 /* CatchClause */: - case 218 /* ModuleDeclaration */: - case 199 /* ForStatement */: - case 200 /* ForInStatement */: - case 201 /* ForOfStatement */: + case 256 /* SourceFile */: + case 227 /* CaseBlock */: + case 252 /* CatchClause */: + case 225 /* ModuleDeclaration */: + case 206 /* ForStatement */: + case 207 /* ForInStatement */: + case 208 /* ForOfStatement */: return current; - case 192 /* Block */: + case 199 /* Block */: // function block is not considered block-scope container // see comment in binder.ts: bind(...), case for SyntaxKind.Block if (!isFunctionLike(current.parent)) { @@ -4425,9 +4985,9 @@ var ts; ts.getEnclosingBlockScopeContainer = getEnclosingBlockScopeContainer; function isCatchClauseVariableDeclaration(declaration) { return declaration && - declaration.kind === 211 /* VariableDeclaration */ && + declaration.kind === 218 /* VariableDeclaration */ && declaration.parent && - declaration.parent.kind === 244 /* CatchClause */; + declaration.parent.kind === 252 /* CatchClause */; } ts.isCatchClauseVariableDeclaration = isCatchClauseVariableDeclaration; // Return display name of an identifier @@ -4463,10 +5023,23 @@ var ts; return ts.createTextSpanFromBounds(start, scanner.getTextPos()); } ts.getSpanOfTokenAtPosition = getSpanOfTokenAtPosition; + function getErrorSpanForArrowFunction(sourceFile, node) { + var pos = ts.skipTrivia(sourceFile.text, node.pos); + if (node.body && node.body.kind === 199 /* Block */) { + 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); + } + } + return ts.createTextSpanFromBounds(pos, node.end); + } function getErrorSpanForNode(sourceFile, node) { var errorNode = node; switch (node.kind) { - case 248 /* SourceFile */: + case 256 /* SourceFile */: var pos_1 = ts.skipTrivia(sourceFile.text, 0, /*stopAfterLineBreak*/ false); if (pos_1 === sourceFile.text.length) { // file is empty - return span for the beginning of the file @@ -4475,18 +5048,24 @@ var ts; return getSpanOfTokenAtPosition(sourceFile, pos_1); // This list is a work in progress. Add missing node kinds to improve their error // spans. - case 211 /* VariableDeclaration */: - case 163 /* BindingElement */: - case 214 /* ClassDeclaration */: - case 186 /* ClassExpression */: - case 215 /* InterfaceDeclaration */: - case 218 /* ModuleDeclaration */: - case 217 /* EnumDeclaration */: - case 247 /* EnumMember */: - case 213 /* FunctionDeclaration */: - case 173 /* FunctionExpression */: + case 218 /* VariableDeclaration */: + case 169 /* BindingElement */: + case 221 /* ClassDeclaration */: + case 192 /* ClassExpression */: + case 222 /* InterfaceDeclaration */: + case 225 /* ModuleDeclaration */: + case 224 /* EnumDeclaration */: + case 255 /* EnumMember */: + case 220 /* FunctionDeclaration */: + case 179 /* FunctionExpression */: + case 147 /* MethodDeclaration */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: + case 223 /* TypeAliasDeclaration */: errorNode = node.name; break; + case 180 /* ArrowFunction */: + 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 @@ -4499,24 +5078,20 @@ var ts; return ts.createTextSpanFromBounds(pos, errorNode.end); } ts.getErrorSpanForNode = getErrorSpanForNode; - function isExternalModule(file) { - return file.externalModuleIndicator !== undefined; - } - ts.isExternalModule = isExternalModule; function isExternalOrCommonJsModule(file) { return (file.externalModuleIndicator || file.commonJsModuleIndicator) !== undefined; } ts.isExternalOrCommonJsModule = isExternalOrCommonJsModule; function isDeclarationFile(file) { - return (file.flags & 4096 /* DeclarationFile */) !== 0; + return file.isDeclarationFile; } ts.isDeclarationFile = isDeclarationFile; function isConstEnumDeclaration(node) { - return node.kind === 217 /* EnumDeclaration */ && isConst(node); + return node.kind === 224 /* EnumDeclaration */ && isConst(node); } ts.isConstEnumDeclaration = isConstEnumDeclaration; function walkUpBindingElementsAndPatterns(node) { - while (node && (node.kind === 163 /* BindingElement */ || isBindingPattern(node))) { + while (node && (node.kind === 169 /* BindingElement */ || isBindingPattern(node))) { node = node.parent; } return node; @@ -4531,29 +5106,33 @@ var ts; function getCombinedNodeFlags(node) { node = walkUpBindingElementsAndPatterns(node); var flags = node.flags; - if (node.kind === 211 /* VariableDeclaration */) { + if (node.kind === 218 /* VariableDeclaration */) { node = node.parent; } - if (node && node.kind === 212 /* VariableDeclarationList */) { + if (node && node.kind === 219 /* VariableDeclarationList */) { flags |= node.flags; node = node.parent; } - if (node && node.kind === 193 /* VariableStatement */) { + if (node && node.kind === 200 /* VariableStatement */) { flags |= node.flags; } return flags; } ts.getCombinedNodeFlags = getCombinedNodeFlags; function isConst(node) { - return !!(getCombinedNodeFlags(node) & 16384 /* Const */); + return !!(getCombinedNodeFlags(node) & 2048 /* Const */); } ts.isConst = isConst; function isLet(node) { - return !!(getCombinedNodeFlags(node) & 8192 /* Let */); + return !!(getCombinedNodeFlags(node) & 1024 /* Let */); } ts.isLet = isLet; + function isSuperCallExpression(n) { + return n.kind === 174 /* CallExpression */ && n.expression.kind === 95 /* SuperKeyword */; + } + ts.isSuperCallExpression = isSuperCallExpression; function isPrologueDirective(node) { - return node.kind === 195 /* ExpressionStatement */ && node.expression.kind === 9 /* StringLiteral */; + return node.kind === 202 /* ExpressionStatement */ && node.expression.kind === 9 /* StringLiteral */; } ts.isPrologueDirective = isPrologueDirective; function getLeadingCommentRangesOfNode(node, sourceFileOfNode) { @@ -4569,7 +5148,7 @@ var ts; } ts.getJsDocComments = getJsDocComments; function getJsDocCommentsFromText(node, text) { - var commentRanges = (node.kind === 138 /* Parameter */ || node.kind === 137 /* TypeParameter */) ? + var commentRanges = (node.kind === 142 /* Parameter */ || node.kind === 141 /* TypeParameter */) ? ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) : getLeadingCommentRangesOfNodeFromText(node, text); return ts.filter(commentRanges, isJsDocComment); @@ -4582,42 +5161,42 @@ var ts; } ts.getJsDocCommentsFromText = getJsDocCommentsFromText; ts.fullTripleSlashReferencePathRegEx = /^(\/\/\/\s*/; + ts.fullTripleSlashReferenceTypeReferenceDirectiveRegEx = /^(\/\/\/\s*/; ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*/; function isTypeNode(node) { - if (151 /* FirstTypeNode */ <= node.kind && node.kind <= 160 /* LastTypeNode */) { + if (154 /* FirstTypeNode */ <= node.kind && node.kind <= 166 /* LastTypeNode */) { return true; } switch (node.kind) { case 117 /* AnyKeyword */: - case 128 /* NumberKeyword */: - case 130 /* StringKeyword */: + case 130 /* NumberKeyword */: + case 132 /* StringKeyword */: case 120 /* BooleanKeyword */: - case 131 /* SymbolKeyword */: + case 133 /* SymbolKeyword */: + case 135 /* UndefinedKeyword */: + case 127 /* NeverKeyword */: return true; case 103 /* VoidKeyword */: - return node.parent.kind !== 177 /* VoidExpression */; - case 9 /* StringLiteral */: - // Specialized signatures can have string literals as their parameters' type names - return node.parent.kind === 138 /* Parameter */; - case 188 /* ExpressionWithTypeArguments */: + return node.parent.kind !== 183 /* VoidExpression */; + case 194 /* ExpressionWithTypeArguments */: return !isExpressionWithTypeArgumentsInClassExtendsClause(node); // Identifiers and qualified names may be type nodes, depending on their context. Climb // above them to find the lowest container case 69 /* Identifier */: // If the identifier is the RHS of a qualified name, then it's a type iff its parent is. - if (node.parent.kind === 135 /* QualifiedName */ && node.parent.right === node) { + if (node.parent.kind === 139 /* QualifiedName */ && node.parent.right === node) { node = node.parent; } - else if (node.parent.kind === 166 /* PropertyAccessExpression */ && node.parent.name === node) { + else if (node.parent.kind === 172 /* PropertyAccessExpression */ && node.parent.name === node) { node = node.parent; } // At this point, node is either a qualified name or an identifier - ts.Debug.assert(node.kind === 69 /* Identifier */ || node.kind === 135 /* QualifiedName */ || node.kind === 166 /* PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isTypeNode'."); - case 135 /* QualifiedName */: - case 166 /* PropertyAccessExpression */: + ts.Debug.assert(node.kind === 69 /* Identifier */ || node.kind === 139 /* QualifiedName */ || node.kind === 172 /* PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isTypeNode'."); + case 139 /* QualifiedName */: + case 172 /* PropertyAccessExpression */: case 97 /* ThisKeyword */: var parent_1 = node.parent; - if (parent_1.kind === 154 /* TypeQuery */) { + if (parent_1.kind === 158 /* TypeQuery */) { return false; } // Do not recursively call isTypeNode on the parent. In the example: @@ -4626,38 +5205,38 @@ var ts; // // Calling isTypeNode would consider the qualified name A.B a type node. Only C or // A.B.C is a type node. - if (151 /* FirstTypeNode */ <= parent_1.kind && parent_1.kind <= 160 /* LastTypeNode */) { + if (154 /* FirstTypeNode */ <= parent_1.kind && parent_1.kind <= 166 /* LastTypeNode */) { return true; } switch (parent_1.kind) { - case 188 /* ExpressionWithTypeArguments */: + case 194 /* ExpressionWithTypeArguments */: return !isExpressionWithTypeArgumentsInClassExtendsClause(parent_1); - case 137 /* TypeParameter */: + case 141 /* TypeParameter */: return node === parent_1.constraint; - case 141 /* PropertyDeclaration */: - case 140 /* PropertySignature */: - case 138 /* Parameter */: - case 211 /* VariableDeclaration */: + case 145 /* PropertyDeclaration */: + case 144 /* PropertySignature */: + case 142 /* Parameter */: + case 218 /* VariableDeclaration */: return node === parent_1.type; - case 213 /* FunctionDeclaration */: - case 173 /* FunctionExpression */: - case 174 /* ArrowFunction */: - case 144 /* Constructor */: - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: + case 220 /* FunctionDeclaration */: + case 179 /* FunctionExpression */: + case 180 /* ArrowFunction */: + case 148 /* Constructor */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: return node === parent_1.type; - case 147 /* CallSignature */: - case 148 /* ConstructSignature */: - case 149 /* IndexSignature */: + case 151 /* CallSignature */: + case 152 /* ConstructSignature */: + case 153 /* IndexSignature */: return node === parent_1.type; - case 171 /* TypeAssertionExpression */: + case 177 /* TypeAssertionExpression */: return node === parent_1.type; - case 168 /* CallExpression */: - case 169 /* NewExpression */: + case 174 /* CallExpression */: + case 175 /* NewExpression */: return parent_1.typeArguments && ts.indexOf(parent_1.typeArguments, node) >= 0; - case 170 /* TaggedTemplateExpression */: + case 176 /* TaggedTemplateExpression */: // TODO (drosen): TaggedTemplateExpressions may eventually support type arguments. return false; } @@ -4671,23 +5250,23 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 204 /* ReturnStatement */: + case 211 /* ReturnStatement */: return visitor(node); - case 220 /* CaseBlock */: - case 192 /* Block */: - case 196 /* IfStatement */: - case 197 /* DoStatement */: - case 198 /* WhileStatement */: - case 199 /* ForStatement */: - case 200 /* ForInStatement */: - case 201 /* ForOfStatement */: - case 205 /* WithStatement */: - case 206 /* SwitchStatement */: - case 241 /* CaseClause */: - case 242 /* DefaultClause */: - case 207 /* LabeledStatement */: - case 209 /* TryStatement */: - case 244 /* CatchClause */: + case 227 /* CaseBlock */: + case 199 /* Block */: + case 203 /* IfStatement */: + case 204 /* DoStatement */: + case 205 /* WhileStatement */: + case 206 /* ForStatement */: + case 207 /* ForInStatement */: + case 208 /* ForOfStatement */: + case 212 /* WithStatement */: + case 213 /* SwitchStatement */: + case 249 /* CaseClause */: + case 250 /* DefaultClause */: + case 214 /* LabeledStatement */: + case 216 /* TryStatement */: + case 252 /* CatchClause */: return ts.forEachChild(node, traverse); } } @@ -4697,18 +5276,18 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 184 /* YieldExpression */: + case 190 /* YieldExpression */: visitor(node); var operand = node.expression; if (operand) { traverse(operand); } - case 217 /* EnumDeclaration */: - case 215 /* InterfaceDeclaration */: - case 218 /* ModuleDeclaration */: - case 216 /* TypeAliasDeclaration */: - case 214 /* ClassDeclaration */: - case 186 /* ClassExpression */: + case 224 /* EnumDeclaration */: + case 222 /* InterfaceDeclaration */: + case 225 /* ModuleDeclaration */: + case 223 /* TypeAliasDeclaration */: + case 221 /* ClassDeclaration */: + case 192 /* 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. @@ -4716,7 +5295,7 @@ var ts; default: if (isFunctionLike(node)) { var name_5 = node.name; - if (name_5 && name_5.kind === 136 /* ComputedPropertyName */) { + if (name_5 && name_5.kind === 140 /* 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. traverse(name_5.expression); @@ -4735,14 +5314,14 @@ var ts; function isVariableLike(node) { if (node) { switch (node.kind) { - case 163 /* BindingElement */: - case 247 /* EnumMember */: - case 138 /* Parameter */: - case 245 /* PropertyAssignment */: - case 141 /* PropertyDeclaration */: - case 140 /* PropertySignature */: - case 246 /* ShorthandPropertyAssignment */: - case 211 /* VariableDeclaration */: + case 169 /* BindingElement */: + case 255 /* EnumMember */: + case 142 /* Parameter */: + case 253 /* PropertyAssignment */: + case 145 /* PropertyDeclaration */: + case 144 /* PropertySignature */: + case 254 /* ShorthandPropertyAssignment */: + case 218 /* VariableDeclaration */: return true; } } @@ -4750,11 +5329,11 @@ var ts; } ts.isVariableLike = isVariableLike; function isAccessor(node) { - return node && (node.kind === 145 /* GetAccessor */ || node.kind === 146 /* SetAccessor */); + return node && (node.kind === 149 /* GetAccessor */ || node.kind === 150 /* SetAccessor */); } ts.isAccessor = isAccessor; function isClassLike(node) { - return node && (node.kind === 214 /* ClassDeclaration */ || node.kind === 186 /* ClassExpression */); + return node && (node.kind === 221 /* ClassDeclaration */ || node.kind === 192 /* ClassExpression */); } ts.isClassLike = isClassLike; function isFunctionLike(node) { @@ -4763,32 +5342,32 @@ var ts; ts.isFunctionLike = isFunctionLike; function isFunctionLikeKind(kind) { switch (kind) { - case 144 /* Constructor */: - case 173 /* FunctionExpression */: - case 213 /* FunctionDeclaration */: - case 174 /* ArrowFunction */: - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: - case 147 /* CallSignature */: - case 148 /* ConstructSignature */: - case 149 /* IndexSignature */: - case 152 /* FunctionType */: - case 153 /* ConstructorType */: + case 148 /* Constructor */: + case 179 /* FunctionExpression */: + case 220 /* FunctionDeclaration */: + case 180 /* ArrowFunction */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: + case 151 /* CallSignature */: + case 152 /* ConstructSignature */: + case 153 /* IndexSignature */: + case 156 /* FunctionType */: + case 157 /* ConstructorType */: return true; } } ts.isFunctionLikeKind = isFunctionLikeKind; function introducesArgumentsExoticObject(node) { switch (node.kind) { - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - case 144 /* Constructor */: - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: - case 213 /* FunctionDeclaration */: - case 173 /* FunctionExpression */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: + case 148 /* Constructor */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: + case 220 /* FunctionDeclaration */: + case 179 /* FunctionExpression */: return true; } return false; @@ -4796,26 +5375,34 @@ var ts; ts.introducesArgumentsExoticObject = introducesArgumentsExoticObject; function isIterationStatement(node, lookInLabeledStatements) { switch (node.kind) { - case 199 /* ForStatement */: - case 200 /* ForInStatement */: - case 201 /* ForOfStatement */: - case 197 /* DoStatement */: - case 198 /* WhileStatement */: + case 206 /* ForStatement */: + case 207 /* ForInStatement */: + case 208 /* ForOfStatement */: + case 204 /* DoStatement */: + case 205 /* WhileStatement */: return true; - case 207 /* LabeledStatement */: + case 214 /* LabeledStatement */: return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); } return false; } ts.isIterationStatement = isIterationStatement; function isFunctionBlock(node) { - return node && node.kind === 192 /* Block */ && isFunctionLike(node.parent); + return node && node.kind === 199 /* Block */ && isFunctionLike(node.parent); } ts.isFunctionBlock = isFunctionBlock; function isObjectLiteralMethod(node) { - return node && node.kind === 143 /* MethodDeclaration */ && node.parent.kind === 165 /* ObjectLiteralExpression */; + return node && node.kind === 147 /* MethodDeclaration */ && node.parent.kind === 171 /* ObjectLiteralExpression */; } ts.isObjectLiteralMethod = isObjectLiteralMethod; + function isIdentifierTypePredicate(predicate) { + return predicate && predicate.kind === 1 /* Identifier */; + } + ts.isIdentifierTypePredicate = isIdentifierTypePredicate; + function isThisTypePredicate(predicate) { + return predicate && predicate.kind === 0 /* This */; + } + ts.isThisTypePredicate = isThisTypePredicate; function getContainingFunction(node) { while (true) { node = node.parent; @@ -4825,6 +5412,15 @@ var ts; } } ts.getContainingFunction = getContainingFunction; + function getContainingFunctionOrModule(node) { + while (true) { + node = node.parent; + if (isFunctionLike(node) || node.kind === 225 /* ModuleDeclaration */ || node.kind === 256 /* SourceFile */) { + return node; + } + } + } + ts.getContainingFunctionOrModule = getContainingFunctionOrModule; function getContainingClass(node) { while (true) { node = node.parent; @@ -4841,7 +5437,7 @@ var ts; return undefined; } switch (node.kind) { - case 136 /* ComputedPropertyName */: + case 140 /* 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 @@ -4856,9 +5452,9 @@ var ts; // the *body* of the container. node = node.parent; break; - case 139 /* Decorator */: + case 143 /* Decorator */: // Decorators are always applied outside of the body of a class or method. - if (node.parent.kind === 138 /* Parameter */ && isClassElement(node.parent.parent)) { + if (node.parent.kind === 142 /* Parameter */ && isClassElement(node.parent.parent)) { // If the decorator's parent is a Parameter, we resolve the this container from // the grandparent class declaration. node = node.parent.parent; @@ -4869,55 +5465,66 @@ var ts; node = node.parent; } break; - case 174 /* ArrowFunction */: + case 180 /* ArrowFunction */: if (!includeArrowFunctions) { continue; } // Fall through - case 213 /* FunctionDeclaration */: - case 173 /* FunctionExpression */: - case 218 /* ModuleDeclaration */: - case 141 /* PropertyDeclaration */: - case 140 /* PropertySignature */: - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - case 144 /* Constructor */: - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: - case 147 /* CallSignature */: - case 148 /* ConstructSignature */: - case 149 /* IndexSignature */: - case 217 /* EnumDeclaration */: - case 248 /* SourceFile */: + case 220 /* FunctionDeclaration */: + case 179 /* FunctionExpression */: + case 225 /* ModuleDeclaration */: + case 145 /* PropertyDeclaration */: + case 144 /* PropertySignature */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: + case 148 /* Constructor */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: + case 151 /* CallSignature */: + case 152 /* ConstructSignature */: + case 153 /* IndexSignature */: + case 224 /* EnumDeclaration */: + case 256 /* SourceFile */: return node; } } } ts.getThisContainer = getThisContainer; - function getSuperContainer(node, includeFunctions) { + /** + * Given an super call\property node returns a closest node where either + * - super call\property 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. + * - node is arrow function (so caller might need to call getSuperContainer in case it needs to climb higher) + * - super call\property is definitely illegal in the node (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; - if (!node) + if (!node) { return node; + } switch (node.kind) { - case 136 /* ComputedPropertyName */: - // If the grandparent node is an object literal (as opposed to a class), - // then the computed property is not a 'super' container. - // A computed property name in a class needs to be a super container - // so that we can error on it. - if (isClassLike(node.parent.parent)) { - return node; - } - // If this is a computed property, then the parent should not - // make it a super 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 super container, the reference must be in - // the *body* of the container. + case 140 /* ComputedPropertyName */: node = node.parent; break; - case 139 /* Decorator */: + case 220 /* FunctionDeclaration */: + case 179 /* FunctionExpression */: + case 180 /* ArrowFunction */: + if (!stopOnFunctions) { + continue; + } + case 145 /* PropertyDeclaration */: + case 144 /* PropertySignature */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: + case 148 /* Constructor */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: + return node; + case 143 /* Decorator */: // Decorators are always applied outside of the body of a class or method. - if (node.parent.kind === 138 /* Parameter */ && isClassElement(node.parent.parent)) { + if (node.parent.kind === 142 /* Parameter */ && isClassElement(node.parent.parent)) { // If the decorator's parent is a Parameter, we resolve the this container from // the grandparent class declaration. node = node.parent.parent; @@ -4928,33 +5535,28 @@ var ts; node = node.parent; } break; - case 213 /* FunctionDeclaration */: - case 173 /* FunctionExpression */: - case 174 /* ArrowFunction */: - if (!includeFunctions) { - continue; - } - case 141 /* PropertyDeclaration */: - case 140 /* PropertySignature */: - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - case 144 /* Constructor */: - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: - return node; } } } ts.getSuperContainer = getSuperContainer; + /** + * Determines whether a node is a property or element access expression for super. + */ + function isSuperPropertyOrElementAccess(node) { + return (node.kind === 172 /* PropertyAccessExpression */ + || node.kind === 173 /* ElementAccessExpression */) + && node.expression.kind === 95 /* SuperKeyword */; + } + ts.isSuperPropertyOrElementAccess = isSuperPropertyOrElementAccess; function getEntityNameFromTypeNode(node) { if (node) { switch (node.kind) { - case 151 /* TypeReference */: + case 155 /* TypeReference */: return node.typeName; - case 188 /* ExpressionWithTypeArguments */: + case 194 /* ExpressionWithTypeArguments */: return node.expression; case 69 /* Identifier */: - case 135 /* QualifiedName */: + case 139 /* QualifiedName */: return node; } } @@ -4962,7 +5564,7 @@ var ts; } ts.getEntityNameFromTypeNode = getEntityNameFromTypeNode; function getInvokedExpression(node) { - if (node.kind === 170 /* TaggedTemplateExpression */) { + if (node.kind === 176 /* TaggedTemplateExpression */) { return node.tag; } // Will either be a CallExpression, NewExpression, or Decorator. @@ -4971,118 +5573,97 @@ var ts; ts.getInvokedExpression = getInvokedExpression; function nodeCanBeDecorated(node) { switch (node.kind) { - case 214 /* ClassDeclaration */: + case 221 /* ClassDeclaration */: // classes are valid targets return true; - case 141 /* PropertyDeclaration */: + case 145 /* PropertyDeclaration */: // property declarations are valid if their parent is a class declaration. - return node.parent.kind === 214 /* ClassDeclaration */; - case 138 /* Parameter */: - // if the parameter's parent has a body and its grandparent is a class declaration, this is a valid target; - return node.parent.body && node.parent.parent.kind === 214 /* ClassDeclaration */; - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: - case 143 /* MethodDeclaration */: + return node.parent.kind === 221 /* ClassDeclaration */; + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: + case 147 /* MethodDeclaration */: // if this method has a body and its parent is a class declaration, this is a valid target. - return node.body && node.parent.kind === 214 /* ClassDeclaration */; + return node.body !== undefined + && node.parent.kind === 221 /* ClassDeclaration */; + case 142 /* Parameter */: + // if the parameter's parent has a body and its grandparent is a class declaration, this is a valid target; + return node.parent.body !== undefined + && (node.parent.kind === 148 /* Constructor */ + || node.parent.kind === 147 /* MethodDeclaration */ + || node.parent.kind === 150 /* SetAccessor */) + && node.parent.parent.kind === 221 /* ClassDeclaration */; } return false; } ts.nodeCanBeDecorated = nodeCanBeDecorated; function nodeIsDecorated(node) { - switch (node.kind) { - case 214 /* ClassDeclaration */: - if (node.decorators) { - return true; - } - return false; - case 141 /* PropertyDeclaration */: - case 138 /* Parameter */: - if (node.decorators) { - return true; - } - return false; - case 145 /* GetAccessor */: - if (node.body && node.decorators) { - return true; - } - return false; - case 143 /* MethodDeclaration */: - case 146 /* SetAccessor */: - if (node.body && node.decorators) { - return true; - } - return false; - } - return false; + return node.decorators !== undefined + && nodeCanBeDecorated(node); } ts.nodeIsDecorated = nodeIsDecorated; - function childIsDecorated(node) { - switch (node.kind) { - case 214 /* ClassDeclaration */: - return ts.forEach(node.members, nodeOrChildIsDecorated); - case 143 /* MethodDeclaration */: - case 146 /* SetAccessor */: - return ts.forEach(node.parameters, nodeIsDecorated); - } - return false; - } - ts.childIsDecorated = childIsDecorated; - function nodeOrChildIsDecorated(node) { - return nodeIsDecorated(node) || childIsDecorated(node); - } - ts.nodeOrChildIsDecorated = nodeOrChildIsDecorated; function isPropertyAccessExpression(node) { - return node.kind === 166 /* PropertyAccessExpression */; + return node.kind === 172 /* PropertyAccessExpression */; } ts.isPropertyAccessExpression = isPropertyAccessExpression; function isElementAccessExpression(node) { - return node.kind === 167 /* ElementAccessExpression */; + return node.kind === 173 /* ElementAccessExpression */; } ts.isElementAccessExpression = isElementAccessExpression; + function isJSXTagName(node) { + var parent = node.parent; + if (parent.kind === 243 /* JsxOpeningElement */ || + parent.kind === 242 /* JsxSelfClosingElement */ || + parent.kind === 245 /* JsxClosingElement */) { + return parent.tagName === node; + } + return false; + } + ts.isJSXTagName = isJSXTagName; function isExpression(node) { switch (node.kind) { + case 97 /* ThisKeyword */: case 95 /* SuperKeyword */: case 93 /* NullKeyword */: case 99 /* TrueKeyword */: case 84 /* FalseKeyword */: case 10 /* RegularExpressionLiteral */: - case 164 /* ArrayLiteralExpression */: - case 165 /* ObjectLiteralExpression */: - case 166 /* PropertyAccessExpression */: - case 167 /* ElementAccessExpression */: - case 168 /* CallExpression */: - case 169 /* NewExpression */: - case 170 /* TaggedTemplateExpression */: - case 189 /* AsExpression */: - case 171 /* TypeAssertionExpression */: - case 172 /* ParenthesizedExpression */: - case 173 /* FunctionExpression */: - case 186 /* ClassExpression */: - case 174 /* ArrowFunction */: - case 177 /* VoidExpression */: - case 175 /* DeleteExpression */: - case 176 /* TypeOfExpression */: - case 179 /* PrefixUnaryExpression */: - case 180 /* PostfixUnaryExpression */: - case 181 /* BinaryExpression */: - case 182 /* ConditionalExpression */: - case 185 /* SpreadElementExpression */: - case 183 /* TemplateExpression */: + case 170 /* ArrayLiteralExpression */: + case 171 /* ObjectLiteralExpression */: + case 172 /* PropertyAccessExpression */: + case 173 /* ElementAccessExpression */: + case 174 /* CallExpression */: + case 175 /* NewExpression */: + case 176 /* TaggedTemplateExpression */: + case 195 /* AsExpression */: + case 177 /* TypeAssertionExpression */: + case 196 /* NonNullExpression */: + case 178 /* ParenthesizedExpression */: + case 179 /* FunctionExpression */: + case 192 /* ClassExpression */: + case 180 /* ArrowFunction */: + case 183 /* VoidExpression */: + case 181 /* DeleteExpression */: + case 182 /* TypeOfExpression */: + case 185 /* PrefixUnaryExpression */: + case 186 /* PostfixUnaryExpression */: + case 187 /* BinaryExpression */: + case 188 /* ConditionalExpression */: + case 191 /* SpreadElementExpression */: + case 189 /* TemplateExpression */: case 11 /* NoSubstitutionTemplateLiteral */: - case 187 /* OmittedExpression */: - case 233 /* JsxElement */: - case 234 /* JsxSelfClosingElement */: - case 184 /* YieldExpression */: - case 178 /* AwaitExpression */: + case 193 /* OmittedExpression */: + case 241 /* JsxElement */: + case 242 /* JsxSelfClosingElement */: + case 190 /* YieldExpression */: + case 184 /* AwaitExpression */: return true; - case 135 /* QualifiedName */: - while (node.parent.kind === 135 /* QualifiedName */) { + case 139 /* QualifiedName */: + while (node.parent.kind === 139 /* QualifiedName */) { node = node.parent; } - return node.parent.kind === 154 /* TypeQuery */; + return node.parent.kind === 158 /* TypeQuery */ || isJSXTagName(node); case 69 /* Identifier */: - if (node.parent.kind === 154 /* TypeQuery */) { + if (node.parent.kind === 158 /* TypeQuery */ || isJSXTagName(node)) { return true; } // fall through @@ -5091,47 +5672,47 @@ var ts; case 97 /* ThisKeyword */: var parent_2 = node.parent; switch (parent_2.kind) { - case 211 /* VariableDeclaration */: - case 138 /* Parameter */: - case 141 /* PropertyDeclaration */: - case 140 /* PropertySignature */: - case 247 /* EnumMember */: - case 245 /* PropertyAssignment */: - case 163 /* BindingElement */: + case 218 /* VariableDeclaration */: + case 142 /* Parameter */: + case 145 /* PropertyDeclaration */: + case 144 /* PropertySignature */: + case 255 /* EnumMember */: + case 253 /* PropertyAssignment */: + case 169 /* BindingElement */: return parent_2.initializer === node; - case 195 /* ExpressionStatement */: - case 196 /* IfStatement */: - case 197 /* DoStatement */: - case 198 /* WhileStatement */: - case 204 /* ReturnStatement */: - case 205 /* WithStatement */: - case 206 /* SwitchStatement */: - case 241 /* CaseClause */: - case 208 /* ThrowStatement */: - case 206 /* SwitchStatement */: + case 202 /* ExpressionStatement */: + case 203 /* IfStatement */: + case 204 /* DoStatement */: + case 205 /* WhileStatement */: + case 211 /* ReturnStatement */: + case 212 /* WithStatement */: + case 213 /* SwitchStatement */: + case 249 /* CaseClause */: + case 215 /* ThrowStatement */: + case 213 /* SwitchStatement */: return parent_2.expression === node; - case 199 /* ForStatement */: + case 206 /* ForStatement */: var forStatement = parent_2; - return (forStatement.initializer === node && forStatement.initializer.kind !== 212 /* VariableDeclarationList */) || + return (forStatement.initializer === node && forStatement.initializer.kind !== 219 /* VariableDeclarationList */) || forStatement.condition === node || forStatement.incrementor === node; - case 200 /* ForInStatement */: - case 201 /* ForOfStatement */: + case 207 /* ForInStatement */: + case 208 /* ForOfStatement */: var forInStatement = parent_2; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 212 /* VariableDeclarationList */) || + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 219 /* VariableDeclarationList */) || forInStatement.expression === node; - case 171 /* TypeAssertionExpression */: - case 189 /* AsExpression */: + case 177 /* TypeAssertionExpression */: + case 195 /* AsExpression */: return node === parent_2.expression; - case 190 /* TemplateSpan */: + case 197 /* TemplateSpan */: return node === parent_2.expression; - case 136 /* ComputedPropertyName */: + case 140 /* ComputedPropertyName */: return node === parent_2.expression; - case 139 /* Decorator */: - case 240 /* JsxExpression */: - case 239 /* JsxSpreadAttribute */: + case 143 /* Decorator */: + case 248 /* JsxExpression */: + case 247 /* JsxSpreadAttribute */: return true; - case 188 /* ExpressionWithTypeArguments */: + case 194 /* ExpressionWithTypeArguments */: return parent_2.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent_2); default: if (isExpression(parent_2)) { @@ -5155,7 +5736,7 @@ var ts; } ts.isInstantiatedModule = isInstantiatedModule; function isExternalModuleImportEqualsDeclaration(node) { - return node.kind === 221 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 232 /* ExternalModuleReference */; + return node.kind === 229 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 240 /* ExternalModuleReference */; } ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration; function getExternalModuleImportEqualsDeclarationExpression(node) { @@ -5164,7 +5745,7 @@ var ts; } ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression; function isInternalModuleImportEqualsDeclaration(node) { - return node.kind === 221 /* ImportEqualsDeclaration */ && node.moduleReference.kind !== 232 /* ExternalModuleReference */; + return node.kind === 229 /* ImportEqualsDeclaration */ && node.moduleReference.kind !== 240 /* ExternalModuleReference */; } ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration; function isSourceFileJavaScript(file) { @@ -5172,77 +5753,100 @@ var ts; } ts.isSourceFileJavaScript = isSourceFileJavaScript; function isInJavaScriptFile(node) { - return node && !!(node.parserContextFlags & 32 /* JavaScriptFile */); + return node && !!(node.flags & 134217728 /* JavaScriptFile */); } ts.isInJavaScriptFile = isInJavaScriptFile; /** * Returns true if the node is a CallExpression to the identifier 'require' with - * exactly one string literal argument. + * exactly one argument. * This function does not test if the node is in a JavaScript file or not. */ - function isRequireCall(expression) { + function isRequireCall(expression, checkArgumentIsStringLiteral) { // of the form 'require("name")' - return expression.kind === 168 /* CallExpression */ && + var isRequire = expression.kind === 174 /* CallExpression */ && expression.expression.kind === 69 /* Identifier */ && expression.expression.text === "require" && - expression.arguments.length === 1 && - expression.arguments[0].kind === 9 /* StringLiteral */; + expression.arguments.length === 1; + return isRequire && (!checkArgumentIsStringLiteral || expression.arguments[0].kind === 9 /* StringLiteral */); } ts.isRequireCall = isRequireCall; - /** - * Returns true if the node is an assignment to a property on the identifier 'exports'. - * This function does not test if the node is in a JavaScript file or not. - */ - function isExportsPropertyAssignment(expression) { - // of the form 'exports.name = expr' where 'name' and 'expr' are arbitrary - return isInJavaScriptFile(expression) && - (expression.kind === 181 /* BinaryExpression */) && - (expression.operatorToken.kind === 56 /* EqualsToken */) && - (expression.left.kind === 166 /* PropertyAccessExpression */) && - (expression.left.expression.kind === 69 /* Identifier */) && - ((expression.left.expression).text === "exports"); + function isSingleOrDoubleQuote(charCode) { + return charCode === 39 /* singleQuote */ || charCode === 34 /* doubleQuote */; } - ts.isExportsPropertyAssignment = isExportsPropertyAssignment; - /** - * Returns true if the node is an assignment to the property access expression 'module.exports'. - * This function does not test if the node is in a JavaScript file or not. - */ - function isModuleExportsAssignment(expression) { - // of the form 'module.exports = expr' where 'expr' is arbitrary - return isInJavaScriptFile(expression) && - (expression.kind === 181 /* BinaryExpression */) && - (expression.operatorToken.kind === 56 /* EqualsToken */) && - (expression.left.kind === 166 /* PropertyAccessExpression */) && - (expression.left.expression.kind === 69 /* Identifier */) && - ((expression.left.expression).text === "module") && - (expression.left.name.text === "exports"); + ts.isSingleOrDoubleQuote = isSingleOrDoubleQuote; + /// Given a BinaryExpression, returns SpecialPropertyAssignmentKind for the various kinds of property + /// assignments we treat as special in the binder + function getSpecialPropertyAssignmentKind(expression) { + if (!isInJavaScriptFile(expression)) { + return 0 /* None */; + } + if (expression.kind !== 187 /* BinaryExpression */) { + return 0 /* None */; + } + var expr = expression; + if (expr.operatorToken.kind !== 56 /* EqualsToken */ || expr.left.kind !== 172 /* PropertyAccessExpression */) { + return 0 /* None */; + } + var lhs = expr.left; + if (lhs.expression.kind === 69 /* Identifier */) { + var lhsId = lhs.expression; + if (lhsId.text === "exports") { + // exports.name = expr + return 1 /* ExportsProperty */; + } + else if (lhsId.text === "module" && lhs.name.text === "exports") { + // module.exports = expr + return 2 /* ModuleExports */; + } + } + else if (lhs.expression.kind === 97 /* ThisKeyword */) { + return 4 /* ThisProperty */; + } + else if (lhs.expression.kind === 172 /* PropertyAccessExpression */) { + // chained dot, e.g. x.y.z = expr; this var is the 'x.y' part + var innerPropertyAccess = lhs.expression; + if (innerPropertyAccess.expression.kind === 69 /* Identifier */) { + // module.exports.name = expr + var innerPropertyAccessIdentifier = innerPropertyAccess.expression; + if (innerPropertyAccessIdentifier.text === "module" && innerPropertyAccess.name.text === "exports") { + return 1 /* ExportsProperty */; + } + if (innerPropertyAccess.name.text === "prototype") { + return 3 /* PrototypeProperty */; + } + } + } + return 0 /* None */; } - ts.isModuleExportsAssignment = isModuleExportsAssignment; + ts.getSpecialPropertyAssignmentKind = getSpecialPropertyAssignmentKind; function getExternalModuleName(node) { - if (node.kind === 222 /* ImportDeclaration */) { + if (node.kind === 230 /* ImportDeclaration */) { return node.moduleSpecifier; } - if (node.kind === 221 /* ImportEqualsDeclaration */) { + if (node.kind === 229 /* ImportEqualsDeclaration */) { var reference = node.moduleReference; - if (reference.kind === 232 /* ExternalModuleReference */) { + if (reference.kind === 240 /* ExternalModuleReference */) { return reference.expression; } } - if (node.kind === 228 /* ExportDeclaration */) { + if (node.kind === 236 /* ExportDeclaration */) { return node.moduleSpecifier; } + if (node.kind === 225 /* ModuleDeclaration */ && node.name.kind === 9 /* StringLiteral */) { + return node.name; + } } ts.getExternalModuleName = getExternalModuleName; function hasQuestionToken(node) { if (node) { switch (node.kind) { - case 138 /* Parameter */: - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - case 246 /* ShorthandPropertyAssignment */: - case 245 /* PropertyAssignment */: - case 141 /* PropertyDeclaration */: - case 140 /* PropertySignature */: + case 142 /* Parameter */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: + case 254 /* ShorthandPropertyAssignment */: + case 253 /* PropertyAssignment */: + case 145 /* PropertyDeclaration */: + case 144 /* PropertySignature */: return node.questionToken !== undefined; } } @@ -5250,31 +5854,70 @@ var ts; } ts.hasQuestionToken = hasQuestionToken; function isJSDocConstructSignature(node) { - return node.kind === 261 /* JSDocFunctionType */ && + return node.kind === 269 /* JSDocFunctionType */ && node.parameters.length > 0 && - node.parameters[0].type.kind === 263 /* JSDocConstructorType */; + node.parameters[0].type.kind === 271 /* JSDocConstructorType */; } ts.isJSDocConstructSignature = isJSDocConstructSignature; - function getJSDocTag(node, kind) { - if (node && node.jsDocComment) { - for (var _i = 0, _a = node.jsDocComment.tags; _i < _a.length; _i++) { - var tag = _a[_i]; - if (tag.kind === kind) { - return tag; - } + function getJSDocTag(node, kind, checkParentVariableStatement) { + if (!node) { + return undefined; + } + var jsDocComment = getJSDocComment(node, checkParentVariableStatement); + if (!jsDocComment) { + return undefined; + } + for (var _i = 0, _a = jsDocComment.tags; _i < _a.length; _i++) { + var tag = _a[_i]; + if (tag.kind === kind) { + return tag; } } } + function getJSDocComment(node, checkParentVariableStatement) { + if (node.jsDocComment) { + return node.jsDocComment; + } + // 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 (checkParentVariableStatement) { + var isInitializerOfVariableDeclarationInStatement = node.parent.kind === 218 /* VariableDeclaration */ && + node.parent.initializer === node && + node.parent.parent.parent.kind === 200 /* VariableStatement */; + var variableStatementNode = isInitializerOfVariableDeclarationInStatement ? node.parent.parent.parent : undefined; + if (variableStatementNode) { + return variableStatementNode.jsDocComment; + } + // Also recognize when the node is the RHS of an assignment expression + var parent_3 = node.parent; + var isSourceOfAssignmentExpressionStatement = parent_3 && parent_3.parent && + parent_3.kind === 187 /* BinaryExpression */ && + parent_3.operatorToken.kind === 56 /* EqualsToken */ && + parent_3.parent.kind === 202 /* ExpressionStatement */; + if (isSourceOfAssignmentExpressionStatement) { + return parent_3.parent.jsDocComment; + } + var isPropertyAssignmentExpression = parent_3 && parent_3.kind === 253 /* PropertyAssignment */; + if (isPropertyAssignmentExpression) { + return parent_3.jsDocComment; + } + } + return undefined; + } function getJSDocTypeTag(node) { - return getJSDocTag(node, 269 /* JSDocTypeTag */); + return getJSDocTag(node, 277 /* JSDocTypeTag */, /*checkParentVariableStatement*/ false); } ts.getJSDocTypeTag = getJSDocTypeTag; function getJSDocReturnTag(node) { - return getJSDocTag(node, 268 /* JSDocReturnTag */); + return getJSDocTag(node, 276 /* JSDocReturnTag */, /*checkParentVariableStatement*/ true); } ts.getJSDocReturnTag = getJSDocReturnTag; function getJSDocTemplateTag(node) { - return getJSDocTag(node, 270 /* JSDocTemplateTag */); + return getJSDocTag(node, 278 /* JSDocTemplateTag */, /*checkParentVariableStatement*/ false); } ts.getJSDocTemplateTag = getJSDocTemplateTag; function getCorrespondingJSDocParameterTag(parameter) { @@ -5282,41 +5925,48 @@ var ts; // If it's a parameter, see if the parent has a jsdoc comment with an @param // annotation. var parameterName = parameter.name.text; - var docComment = parameter.parent.jsDocComment; - if (docComment) { - return ts.forEach(docComment.tags, function (t) { - if (t.kind === 267 /* JSDocParameterTag */) { - var parameterTag = t; + var jsDocComment = getJSDocComment(parameter.parent, /*checkParentVariableStatement*/ true); + if (jsDocComment) { + for (var _i = 0, _a = jsDocComment.tags; _i < _a.length; _i++) { + var tag = _a[_i]; + if (tag.kind === 275 /* JSDocParameterTag */) { + var parameterTag = tag; var name_6 = parameterTag.preParameterName || parameterTag.postParameterName; if (name_6.text === parameterName) { - return t; + return parameterTag; } } - }); + } } } + return undefined; } ts.getCorrespondingJSDocParameterTag = getCorrespondingJSDocParameterTag; function hasRestParameter(s) { return isRestParameter(ts.lastOrUndefined(s.parameters)); } ts.hasRestParameter = hasRestParameter; + function hasDeclaredRestParameter(s) { + return isDeclaredRestParam(ts.lastOrUndefined(s.parameters)); + } + ts.hasDeclaredRestParameter = hasDeclaredRestParameter; function isRestParameter(node) { - if (node) { - if (node.parserContextFlags & 32 /* JavaScriptFile */) { - if (node.type && node.type.kind === 262 /* JSDocVariadicType */) { - return true; - } - var paramTag = getCorrespondingJSDocParameterTag(node); - if (paramTag && paramTag.typeExpression) { - return paramTag.typeExpression.type.kind === 262 /* JSDocVariadicType */; - } + if (node && (node.flags & 134217728 /* JavaScriptFile */)) { + if (node.type && node.type.kind === 270 /* JSDocVariadicType */) { + return true; + } + var paramTag = getCorrespondingJSDocParameterTag(node); + if (paramTag && paramTag.typeExpression) { + return paramTag.typeExpression.type.kind === 270 /* JSDocVariadicType */; } - return node.dotDotDotToken !== undefined; } - return false; + return isDeclaredRestParam(node); } ts.isRestParameter = isRestParameter; + function isDeclaredRestParam(node) { + return node && node.dotDotDotToken !== undefined; + } + ts.isDeclaredRestParam = isDeclaredRestParam; function isLiteralKind(kind) { return 8 /* FirstLiteralToken */ <= kind && kind <= 11 /* LastLiteralToken */; } @@ -5330,9 +5980,34 @@ var ts; } ts.isTemplateLiteralKind = isTemplateLiteralKind; function isBindingPattern(node) { - return !!node && (node.kind === 162 /* ArrayBindingPattern */ || node.kind === 161 /* ObjectBindingPattern */); + return !!node && (node.kind === 168 /* ArrayBindingPattern */ || node.kind === 167 /* ObjectBindingPattern */); } ts.isBindingPattern = isBindingPattern; + // 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', '[{ p: a}] = xxx'. + function isAssignmentTarget(node) { + while (node.parent.kind === 178 /* ParenthesizedExpression */) { + node = node.parent; + } + while (true) { + var parent_4 = node.parent; + if (parent_4.kind === 170 /* ArrayLiteralExpression */ || parent_4.kind === 191 /* SpreadElementExpression */) { + node = parent_4; + continue; + } + if (parent_4.kind === 253 /* PropertyAssignment */ || parent_4.kind === 254 /* ShorthandPropertyAssignment */) { + node = parent_4.parent; + continue; + } + return parent_4.kind === 187 /* BinaryExpression */ && + parent_4.operatorToken.kind === 56 /* EqualsToken */ && + parent_4.left === node || + (parent_4.kind === 207 /* ForInStatement */ || parent_4.kind === 208 /* ForOfStatement */) && + parent_4.initializer === node; + } + } + ts.isAssignmentTarget = isAssignmentTarget; function isNodeDescendentOf(node, ancestor) { while (node) { if (node === ancestor) @@ -5344,7 +6019,7 @@ var ts; ts.isNodeDescendentOf = isNodeDescendentOf; function isInAmbientContext(node) { while (node) { - if (node.flags & (4 /* Ambient */ | 4096 /* DeclarationFile */)) { + if (node.flags & 2 /* Ambient */ || (node.kind === 256 /* SourceFile */ && node.isDeclarationFile)) { return true; } node = node.parent; @@ -5354,34 +6029,34 @@ var ts; ts.isInAmbientContext = isInAmbientContext; function isDeclaration(node) { switch (node.kind) { - case 174 /* ArrowFunction */: - case 163 /* BindingElement */: - case 214 /* ClassDeclaration */: - case 186 /* ClassExpression */: - case 144 /* Constructor */: - case 217 /* EnumDeclaration */: - case 247 /* EnumMember */: - case 230 /* ExportSpecifier */: - case 213 /* FunctionDeclaration */: - case 173 /* FunctionExpression */: - case 145 /* GetAccessor */: - case 223 /* ImportClause */: - case 221 /* ImportEqualsDeclaration */: - case 226 /* ImportSpecifier */: - case 215 /* InterfaceDeclaration */: - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - case 218 /* ModuleDeclaration */: - case 224 /* NamespaceImport */: - case 138 /* Parameter */: - case 245 /* PropertyAssignment */: - case 141 /* PropertyDeclaration */: - case 140 /* PropertySignature */: - case 146 /* SetAccessor */: - case 246 /* ShorthandPropertyAssignment */: - case 216 /* TypeAliasDeclaration */: - case 137 /* TypeParameter */: - case 211 /* VariableDeclaration */: + case 180 /* ArrowFunction */: + case 169 /* BindingElement */: + case 221 /* ClassDeclaration */: + case 192 /* ClassExpression */: + case 148 /* Constructor */: + case 224 /* EnumDeclaration */: + case 255 /* EnumMember */: + case 238 /* ExportSpecifier */: + case 220 /* FunctionDeclaration */: + case 179 /* FunctionExpression */: + case 149 /* GetAccessor */: + case 231 /* ImportClause */: + case 229 /* ImportEqualsDeclaration */: + case 234 /* ImportSpecifier */: + case 222 /* InterfaceDeclaration */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: + case 225 /* ModuleDeclaration */: + case 232 /* NamespaceImport */: + case 142 /* Parameter */: + case 253 /* PropertyAssignment */: + case 145 /* PropertyDeclaration */: + case 144 /* PropertySignature */: + case 150 /* SetAccessor */: + case 254 /* ShorthandPropertyAssignment */: + case 223 /* TypeAliasDeclaration */: + case 141 /* TypeParameter */: + case 218 /* VariableDeclaration */: return true; } return false; @@ -5389,25 +6064,25 @@ var ts; ts.isDeclaration = isDeclaration; function isStatement(n) { switch (n.kind) { - case 203 /* BreakStatement */: - case 202 /* ContinueStatement */: - case 210 /* DebuggerStatement */: - case 197 /* DoStatement */: - case 195 /* ExpressionStatement */: - case 194 /* EmptyStatement */: - case 200 /* ForInStatement */: - case 201 /* ForOfStatement */: - case 199 /* ForStatement */: - case 196 /* IfStatement */: - case 207 /* LabeledStatement */: - case 204 /* ReturnStatement */: - case 206 /* SwitchStatement */: - case 208 /* ThrowStatement */: - case 209 /* TryStatement */: - case 193 /* VariableStatement */: - case 198 /* WhileStatement */: - case 205 /* WithStatement */: - case 227 /* ExportAssignment */: + case 210 /* BreakStatement */: + case 209 /* ContinueStatement */: + case 217 /* DebuggerStatement */: + case 204 /* DoStatement */: + case 202 /* ExpressionStatement */: + case 201 /* EmptyStatement */: + case 207 /* ForInStatement */: + case 208 /* ForOfStatement */: + case 206 /* ForStatement */: + case 203 /* IfStatement */: + case 214 /* LabeledStatement */: + case 211 /* ReturnStatement */: + case 213 /* SwitchStatement */: + case 215 /* ThrowStatement */: + case 216 /* TryStatement */: + case 200 /* VariableStatement */: + case 205 /* WhileStatement */: + case 212 /* WithStatement */: + case 235 /* ExportAssignment */: return true; default: return false; @@ -5416,13 +6091,13 @@ var ts; ts.isStatement = isStatement; function isClassElement(n) { switch (n.kind) { - case 144 /* Constructor */: - case 141 /* PropertyDeclaration */: - case 143 /* MethodDeclaration */: - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: - case 142 /* MethodSignature */: - case 149 /* IndexSignature */: + case 148 /* Constructor */: + case 145 /* PropertyDeclaration */: + case 147 /* MethodDeclaration */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: + case 146 /* MethodSignature */: + case 153 /* IndexSignature */: return true; default: return false; @@ -5435,7 +6110,7 @@ var ts; return false; } var parent = name.parent; - if (parent.kind === 226 /* ImportSpecifier */ || parent.kind === 230 /* ExportSpecifier */) { + if (parent.kind === 234 /* ImportSpecifier */ || parent.kind === 238 /* ExportSpecifier */) { if (parent.propertyName) { return true; } @@ -5446,35 +6121,41 @@ var ts; return false; } ts.isDeclarationName = isDeclarationName; + function isLiteralComputedPropertyDeclarationName(node) { + return (node.kind === 9 /* StringLiteral */ || node.kind === 8 /* NumericLiteral */) && + node.parent.kind === 140 /* ComputedPropertyName */ && + 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 141 /* PropertyDeclaration */: - case 140 /* PropertySignature */: - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: - case 247 /* EnumMember */: - case 245 /* PropertyAssignment */: - case 166 /* PropertyAccessExpression */: + case 145 /* PropertyDeclaration */: + case 144 /* PropertySignature */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: + case 255 /* EnumMember */: + case 253 /* PropertyAssignment */: + case 172 /* PropertyAccessExpression */: // Name in member declaration or property name in property access return parent.name === node; - case 135 /* QualifiedName */: + case 139 /* QualifiedName */: // Name on right hand side of dot in a type query if (parent.right === node) { - while (parent.kind === 135 /* QualifiedName */) { + while (parent.kind === 139 /* QualifiedName */) { parent = parent.parent; } - return parent.kind === 154 /* TypeQuery */; + return parent.kind === 158 /* TypeQuery */; } return false; - case 163 /* BindingElement */: - case 226 /* ImportSpecifier */: + case 169 /* BindingElement */: + case 234 /* ImportSpecifier */: // Property name in binding element or import specifier return parent.propertyName === node; - case 230 /* ExportSpecifier */: + case 238 /* ExportSpecifier */: // Any name in an export specifier return true; } @@ -5490,12 +6171,13 @@ var ts; // export = ... // export default ... function isAliasSymbolDeclaration(node) { - return node.kind === 221 /* ImportEqualsDeclaration */ || - node.kind === 223 /* ImportClause */ && !!node.name || - node.kind === 224 /* NamespaceImport */ || - node.kind === 226 /* ImportSpecifier */ || - node.kind === 230 /* ExportSpecifier */ || - node.kind === 227 /* ExportAssignment */ && node.expression.kind === 69 /* Identifier */; + return node.kind === 229 /* ImportEqualsDeclaration */ || + node.kind === 228 /* GlobalModuleExportDeclaration */ || + node.kind === 231 /* ImportClause */ && !!node.name || + node.kind === 232 /* NamespaceImport */ || + node.kind === 234 /* ImportSpecifier */ || + node.kind === 238 /* ExportSpecifier */ || + node.kind === 235 /* ExportAssignment */ && node.expression.kind === 69 /* Identifier */; } ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration; function getClassExtendsHeritageClauseElement(node) { @@ -5552,32 +6234,32 @@ var ts; }; } else { - var matchResult = ts.fullTripleSlashReferencePathRegEx.exec(comment); - if (matchResult) { + var refMatchResult = ts.fullTripleSlashReferencePathRegEx.exec(comment); + var refLibResult = !refMatchResult && ts.fullTripleSlashReferenceTypeReferenceDirectiveRegEx.exec(comment); + if (refMatchResult || refLibResult) { var start = commentRange.pos; var end = commentRange.end; return { fileReference: { pos: start, end: end, - fileName: matchResult[3] + fileName: (refMatchResult || refLibResult)[3] }, - isNoDefaultLib: false - }; - } - else { - return { - diagnosticMessage: ts.Diagnostics.Invalid_reference_directive_syntax, - isNoDefaultLib: false + isNoDefaultLib: false, + isTypeReferenceDirective: !!refLibResult }; } + return { + diagnosticMessage: ts.Diagnostics.Invalid_reference_directive_syntax, + isNoDefaultLib: false + }; } } return undefined; } ts.getFileReferenceFromReferencePath = getFileReferenceFromReferencePath; function isKeyword(token) { - return 70 /* FirstKeyword */ <= token && token <= 134 /* LastKeyword */; + return 70 /* FirstKeyword */ <= token && token <= 138 /* LastKeyword */; } ts.isKeyword = isKeyword; function isTrivia(token) { @@ -5604,7 +6286,7 @@ var ts; } ts.hasDynamicName = hasDynamicName; function isDynamicName(name) { - return name.kind === 136 /* ComputedPropertyName */ && + return name.kind === 140 /* ComputedPropertyName */ && !isStringOrNumericLiteral(name.expression.kind) && !isWellKnownSymbolSyntactically(name.expression); } @@ -5622,12 +6304,15 @@ var ts; if (name.kind === 69 /* Identifier */ || name.kind === 9 /* StringLiteral */ || name.kind === 8 /* NumericLiteral */) { return name.text; } - if (name.kind === 136 /* ComputedPropertyName */) { + if (name.kind === 140 /* ComputedPropertyName */) { var nameExpression = name.expression; if (isWellKnownSymbolSyntactically(nameExpression)) { var rightHandSideName = nameExpression.name.text; return getPropertyNameForKnownSymbolName(rightHandSideName); } + else if (nameExpression.kind === 9 /* StringLiteral */ || nameExpression.kind === 8 /* NumericLiteral */) { + return nameExpression.text; + } } return undefined; } @@ -5643,7 +6328,7 @@ var ts; return node.kind === 69 /* Identifier */ && node.text === "Symbol"; } ts.isESSymbolIdentifier = isESSymbolIdentifier; - function isModifier(token) { + function isModifierKind(token) { switch (token) { case 115 /* AbstractKeyword */: case 118 /* AsyncKeyword */: @@ -5654,44 +6339,79 @@ var ts; case 112 /* PublicKeyword */: case 110 /* PrivateKeyword */: case 111 /* ProtectedKeyword */: + case 128 /* ReadonlyKeyword */: case 113 /* StaticKeyword */: return true; } return false; } - ts.isModifier = isModifier; + ts.isModifierKind = isModifierKind; function isParameterDeclaration(node) { var root = getRootDeclaration(node); - return root.kind === 138 /* Parameter */; + return root.kind === 142 /* Parameter */; } ts.isParameterDeclaration = isParameterDeclaration; function getRootDeclaration(node) { - while (node.kind === 163 /* BindingElement */) { + while (node.kind === 169 /* BindingElement */) { node = node.parent.parent; } return node; } ts.getRootDeclaration = getRootDeclaration; function nodeStartsNewLexicalEnvironment(n) { - return isFunctionLike(n) || n.kind === 218 /* ModuleDeclaration */ || n.kind === 248 /* SourceFile */; + return isFunctionLike(n) || n.kind === 225 /* ModuleDeclaration */ || n.kind === 256 /* SourceFile */; } ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; - function cloneEntityName(node) { - if (node.kind === 69 /* Identifier */) { - var clone_1 = createSynthesizedNode(69 /* Identifier */); - clone_1.text = node.text; - return clone_1; + /** + * Creates a shallow, memberwise clone of a node. The "kind", "pos", "end", "flags", and "parent" + * properties are excluded by default, and can be provided via the "location", "flags", and + * "parent" parameters. + * @param node The node to clone. + * @param location An optional TextRange to use to supply the new position. + * @param flags The NodeFlags to use for the cloned node. + * @param parent The parent for the new node. + */ + function cloneNode(node, location, flags, parent) { + // We don't use "clone" from core.ts here, as we need to preserve the prototype chain of + // the original node. We also need to exclude specific properties and only include own- + // properties (to skip members already defined on the shared prototype). + var clone = location !== undefined + ? ts.createNode(node.kind, location.pos, location.end) + : createSynthesizedNode(node.kind); + for (var key in node) { + if (clone.hasOwnProperty(key) || !node.hasOwnProperty(key)) { + continue; + } + clone[key] = node[key]; } - else { - var clone_2 = createSynthesizedNode(135 /* QualifiedName */); - clone_2.left = cloneEntityName(node.left); - clone_2.left.parent = clone_2; - clone_2.right = cloneEntityName(node.right); - clone_2.right.parent = clone_2; - return clone_2; + if (flags !== undefined) { + clone.flags = flags; } + if (parent !== undefined) { + clone.parent = parent; + } + return clone; + } + ts.cloneNode = cloneNode; + /** + * Creates a deep clone of an EntityName, with new parent pointers. + * @param node The EntityName to clone. + * @param parent The parent for the cloned node. + */ + function cloneEntityName(node, parent) { + var clone = cloneNode(node, node, node.flags, parent); + if (isQualifiedName(clone)) { + var left = clone.left, right = clone.right; + clone.left = cloneEntityName(left, clone); + clone.right = cloneNode(right, right, right.flags, parent); + } + return clone; } ts.cloneEntityName = cloneEntityName; + function isQualifiedName(node) { + return node.kind === 139 /* QualifiedName */; + } + ts.isQualifiedName = isQualifiedName; function nodeIsSynthesized(node) { return node.pos === -1; } @@ -5906,8 +6626,8 @@ var ts; writeTextOfNode: writeTextOfNode, writeLiteral: writeLiteral, writeLine: writeLine, - increaseIndent: function () { return indent++; }, - decreaseIndent: function () { return indent--; }, + increaseIndent: function () { indent++; }, + decreaseIndent: function () { indent--; }, getIndent: function () { return indent; }, getTextPos: function () { return output.length; }, getLine: function () { return lineCount + 1; }, @@ -5921,8 +6641,10 @@ var ts; * Resolves a local path to a path which is absolute to the base of the emit */ function getExternalModuleNameFromPath(host, fileName) { - var dir = host.getCurrentDirectory(); - var relativePath = ts.getRelativePathToDirectoryOrUrl(dir, fileName, dir, function (f) { return host.getCanonicalFileName(f); }, /*isAbsolutePathAnUrl*/ false); + var getCanonicalFileName = function (f) { return host.getCanonicalFileName(f); }; + var dir = ts.toPath(host.getCommonSourceDirectory(), host.getCurrentDirectory(), getCanonicalFileName); + var filePath = ts.getNormalizedAbsolutePath(fileName, host.getCurrentDirectory()); + var relativePath = ts.getRelativePathToDirectoryOrUrl(dir, filePath, dir, getCanonicalFileName, /*isAbsolutePathAnUrl*/ false); return ts.removeFileExtension(relativePath); } ts.getExternalModuleNameFromPath = getExternalModuleNameFromPath; @@ -5938,16 +6660,97 @@ var ts; return emitOutputFilePathWithoutExtension + extension; } ts.getOwnEmitOutputFilePath = getOwnEmitOutputFilePath; + function getDeclarationEmitOutputFilePath(sourceFile, host) { + var options = host.getCompilerOptions(); + var outputDir = options.declarationDir || options.outDir; // Prefer declaration folder if specified + if (options.declaration) { + var path = outputDir + ? getSourceFilePathInNewDir(sourceFile, host, outputDir) + : sourceFile.fileName; + return ts.removeFileExtension(path) + ".d.ts"; + } + } + ts.getDeclarationEmitOutputFilePath = getDeclarationEmitOutputFilePath; + function getEmitScriptTarget(compilerOptions) { + return compilerOptions.target || 0 /* ES3 */; + } + ts.getEmitScriptTarget = getEmitScriptTarget; + function getEmitModuleKind(compilerOptions) { + return typeof compilerOptions.module === "number" ? + compilerOptions.module : + getEmitScriptTarget(compilerOptions) === 2 /* ES6 */ ? ts.ModuleKind.ES6 : ts.ModuleKind.CommonJS; + } + ts.getEmitModuleKind = getEmitModuleKind; + function forEachExpectedEmitFile(host, action, targetSourceFile) { + var options = host.getCompilerOptions(); + // Emit on each source file + if (options.outFile || options.out) { + onBundledEmit(host); + } + else { + var sourceFiles = targetSourceFile === undefined ? host.getSourceFiles() : [targetSourceFile]; + for (var _i = 0, sourceFiles_1 = sourceFiles; _i < sourceFiles_1.length; _i++) { + var sourceFile = sourceFiles_1[_i]; + if (!isDeclarationFile(sourceFile)) { + onSingleFileEmit(host, sourceFile); + } + } + } + function onSingleFileEmit(host, sourceFile) { + // JavaScript files are always LanguageVariant.JSX, as JSX syntax is allowed in .js files also. + // So for JavaScript files, '.jsx' is only emitted if the input was '.jsx', and JsxEmit.Preserve. + // For TypeScript, the only time to emit with a '.jsx' extension, is on JSX input, and JsxEmit.Preserve + var extension = ".js"; + if (options.jsx === 1 /* Preserve */) { + if (isSourceFileJavaScript(sourceFile)) { + if (ts.fileExtensionIs(sourceFile.fileName, ".jsx")) { + extension = ".jsx"; + } + } + else if (sourceFile.languageVariant === 1 /* JSX */) { + // TypeScript source file preserving JSX syntax + extension = ".jsx"; + } + } + var jsFilePath = getOwnEmitOutputFilePath(sourceFile, host, extension); + var emitFileNames = { + jsFilePath: jsFilePath, + sourceMapFilePath: getSourceMapFilePath(jsFilePath, options), + declarationFilePath: !isSourceFileJavaScript(sourceFile) ? getDeclarationEmitOutputFilePath(sourceFile, host) : undefined + }; + action(emitFileNames, [sourceFile], /*isBundledEmit*/ false); + } + function onBundledEmit(host) { + // Can emit only sources that are not declaration file and are either non module code or module with --module or --target es6 specified + var bundledSources = ts.filter(host.getSourceFiles(), function (sourceFile) { + return !isDeclarationFile(sourceFile) // Not a declaration file + && (!ts.isExternalModule(sourceFile) || !!getEmitModuleKind(options)); + }); // and not a module, unless module emit enabled + if (bundledSources.length) { + var jsFilePath = options.outFile || options.out; + var emitFileNames = { + jsFilePath: jsFilePath, + sourceMapFilePath: getSourceMapFilePath(jsFilePath, options), + declarationFilePath: options.declaration ? ts.removeFileExtension(jsFilePath) + ".d.ts" : undefined + }; + action(emitFileNames, bundledSources, /*isBundledEmit*/ true); + } + } + function getSourceMapFilePath(jsFilePath, options) { + return options.sourceMap ? jsFilePath + ".map" : undefined; + } + } + ts.forEachExpectedEmitFile = forEachExpectedEmitFile; function getSourceFilePathInNewDir(sourceFile, host, newDirPath) { var sourceFilePath = ts.getNormalizedAbsolutePath(sourceFile.fileName, host.getCurrentDirectory()); sourceFilePath = sourceFilePath.replace(host.getCommonSourceDirectory(), ""); return ts.combinePaths(newDirPath, sourceFilePath); } ts.getSourceFilePathInNewDir = getSourceFilePathInNewDir; - function writeFile(host, diagnostics, fileName, data, writeByteOrderMark) { + function writeFile(host, diagnostics, fileName, data, writeByteOrderMark, sourceFiles) { host.writeFile(fileName, data, writeByteOrderMark, function (hostErrorMessage) { - diagnostics.push(ts.createCompilerDiagnostic(ts.Diagnostics.Could_not_write_file_0_Colon_1, fileName, hostErrorMessage)); - }); + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Could_not_write_file_0_Colon_1, fileName, hostErrorMessage)); + }, sourceFiles); } ts.writeFile = writeFile; function getLineOfLocalPosition(currentSourceFile, pos) { @@ -5960,28 +6763,21 @@ var ts; ts.getLineOfLocalPositionFromLineMap = getLineOfLocalPositionFromLineMap; function getFirstConstructorWithBody(node) { return ts.forEach(node.members, function (member) { - if (member.kind === 144 /* Constructor */ && nodeIsPresent(member.body)) { + if (member.kind === 148 /* Constructor */ && nodeIsPresent(member.body)) { return member; } }); } ts.getFirstConstructorWithBody = getFirstConstructorWithBody; function getSetAccessorTypeAnnotationNode(accessor) { - return accessor && accessor.parameters.length > 0 && accessor.parameters[0].type; + if (accessor && accessor.parameters.length > 0) { + var hasThis = accessor.parameters.length === 2 && + accessor.parameters[0].name.kind === 69 /* Identifier */ && + accessor.parameters[0].name.originalKeywordKind === 97 /* ThisKeyword */; + return accessor.parameters[hasThis ? 1 : 0].type; + } } ts.getSetAccessorTypeAnnotationNode = getSetAccessorTypeAnnotationNode; - function shouldEmitToOwnFile(sourceFile, compilerOptions) { - if (!isDeclarationFile(sourceFile)) { - if ((isExternalModule(sourceFile) || !(compilerOptions.outFile || compilerOptions.out))) { - // 1. in-browser single file compilation scenario - // 2. non .js file - return compilerOptions.isolatedModules || !ts.fileExtensionIs(sourceFile.fileName, ".js"); - } - return false; - } - return false; - } - ts.shouldEmitToOwnFile = shouldEmitToOwnFile; function getAllAccessorDeclarations(declarations, accessor) { var firstAccessor; var secondAccessor; @@ -5989,10 +6785,10 @@ var ts; var setAccessor; if (hasDynamicName(accessor)) { firstAccessor = accessor; - if (accessor.kind === 145 /* GetAccessor */) { + if (accessor.kind === 149 /* GetAccessor */) { getAccessor = accessor; } - else if (accessor.kind === 146 /* SetAccessor */) { + else if (accessor.kind === 150 /* SetAccessor */) { setAccessor = accessor; } else { @@ -6001,8 +6797,8 @@ var ts; } else { ts.forEach(declarations, function (member) { - if ((member.kind === 145 /* GetAccessor */ || member.kind === 146 /* SetAccessor */) - && (member.flags & 64 /* Static */) === (accessor.flags & 64 /* Static */)) { + if ((member.kind === 149 /* GetAccessor */ || member.kind === 150 /* SetAccessor */) + && (member.flags & 32 /* Static */) === (accessor.flags & 32 /* Static */)) { var memberName = getPropertyNameForPropertyNameNode(member.name); var accessorName = getPropertyNameForPropertyNameNode(accessor.name); if (memberName === accessorName) { @@ -6012,10 +6808,10 @@ var ts; else if (!secondAccessor) { secondAccessor = member; } - if (member.kind === 145 /* GetAccessor */ && !getAccessor) { + if (member.kind === 149 /* GetAccessor */ && !getAccessor) { getAccessor = member; } - if (member.kind === 146 /* SetAccessor */ && !setAccessor) { + if (member.kind === 150 /* SetAccessor */ && !setAccessor) { setAccessor = member; } } @@ -6082,7 +6878,7 @@ var ts; } if (leadingComments) { var detachedComments = []; - var lastComment; + var lastComment = void 0; for (var _i = 0, leadingComments_1 = leadingComments; _i < leadingComments_1.length; _i++) { var comment = leadingComments_1[_i]; if (lastComment) { @@ -6123,7 +6919,7 @@ var ts; if (text.charCodeAt(comment.pos + 1) === 42 /* asterisk */) { var firstCommentLineAndCharacter = ts.computeLineAndCharacterOfPosition(lineMap, comment.pos); var lineCount = lineMap.length; - var firstCommentLineIndent; + var firstCommentLineIndent = void 0; for (var pos = comment.pos, currentLine = firstCommentLineAndCharacter.line; pos < comment.end; currentLine++) { var nextLineStart = (currentLine + 1) === lineCount ? text.length + 1 @@ -6208,16 +7004,17 @@ var ts; } function modifierToFlag(token) { switch (token) { - case 113 /* StaticKeyword */: return 64 /* Static */; - case 112 /* PublicKeyword */: return 8 /* Public */; - case 111 /* ProtectedKeyword */: return 32 /* Protected */; - case 110 /* PrivateKeyword */: return 16 /* Private */; + case 113 /* StaticKeyword */: return 32 /* Static */; + case 112 /* PublicKeyword */: return 4 /* Public */; + case 111 /* ProtectedKeyword */: return 16 /* Protected */; + case 110 /* PrivateKeyword */: return 8 /* Private */; case 115 /* AbstractKeyword */: return 128 /* Abstract */; - case 82 /* ExportKeyword */: return 2 /* Export */; - case 122 /* DeclareKeyword */: return 4 /* Ambient */; - case 74 /* ConstKeyword */: return 16384 /* Const */; + case 82 /* ExportKeyword */: return 1 /* Export */; + case 122 /* DeclareKeyword */: return 2 /* Ambient */; + case 74 /* ConstKeyword */: return 2048 /* Const */; case 77 /* DefaultKeyword */: return 512 /* Default */; case 118 /* AsyncKeyword */: return 256 /* Async */; + case 128 /* ReadonlyKeyword */: return 64 /* Readonly */; } return 0; } @@ -6225,24 +7022,25 @@ var ts; function isLeftHandSideExpression(expr) { if (expr) { switch (expr.kind) { - case 166 /* PropertyAccessExpression */: - case 167 /* ElementAccessExpression */: - case 169 /* NewExpression */: - case 168 /* CallExpression */: - case 233 /* JsxElement */: - case 234 /* JsxSelfClosingElement */: - case 170 /* TaggedTemplateExpression */: - case 164 /* ArrayLiteralExpression */: - case 172 /* ParenthesizedExpression */: - case 165 /* ObjectLiteralExpression */: - case 186 /* ClassExpression */: - case 173 /* FunctionExpression */: + case 172 /* PropertyAccessExpression */: + case 173 /* ElementAccessExpression */: + case 175 /* NewExpression */: + case 174 /* CallExpression */: + case 196 /* NonNullExpression */: + case 241 /* JsxElement */: + case 242 /* JsxSelfClosingElement */: + case 176 /* TaggedTemplateExpression */: + case 170 /* ArrayLiteralExpression */: + case 178 /* ParenthesizedExpression */: + case 171 /* ObjectLiteralExpression */: + case 192 /* ClassExpression */: + case 179 /* FunctionExpression */: case 69 /* Identifier */: case 10 /* RegularExpressionLiteral */: case 8 /* NumericLiteral */: case 9 /* StringLiteral */: case 11 /* NoSubstitutionTemplateLiteral */: - case 183 /* TemplateExpression */: + case 189 /* TemplateExpression */: case 84 /* FalseKeyword */: case 93 /* NullKeyword */: case 97 /* ThisKeyword */: @@ -6259,7 +7057,7 @@ var ts; } ts.isAssignmentOperator = isAssignmentOperator; function isExpressionWithTypeArgumentsInClassExtendsClause(node) { - return node.kind === 188 /* ExpressionWithTypeArguments */ && + return node.kind === 194 /* ExpressionWithTypeArguments */ && node.parent.token === 83 /* ExtendsKeyword */ && isClassLike(node.parent.parent); } @@ -6282,16 +7080,16 @@ var ts; } } function isRightSideOfQualifiedNameOrPropertyAccess(node) { - return (node.parent.kind === 135 /* QualifiedName */ && node.parent.right === node) || - (node.parent.kind === 166 /* PropertyAccessExpression */ && node.parent.name === node); + return (node.parent.kind === 139 /* QualifiedName */ && node.parent.right === node) || + (node.parent.kind === 172 /* PropertyAccessExpression */ && node.parent.name === node); } ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess; function isEmptyObjectLiteralOrArrayLiteral(expression) { var kind = expression.kind; - if (kind === 165 /* ObjectLiteralExpression */) { + if (kind === 171 /* ObjectLiteralExpression */) { return expression.properties.length === 0; } - if (kind === 164 /* ArrayLiteralExpression */) { + if (kind === 170 /* ArrayLiteralExpression */) { return expression.elements.length === 0; } return false; @@ -6302,13 +7100,9 @@ var ts; } ts.getLocalSymbolForExportDefault = getLocalSymbolForExportDefault; function hasJavaScriptFileExtension(fileName) { - return ts.fileExtensionIs(fileName, ".js") || ts.fileExtensionIs(fileName, ".jsx"); + return ts.forEach(ts.supportedJavascriptExtensions, function (extension) { return ts.fileExtensionIs(fileName, extension); }); } ts.hasJavaScriptFileExtension = hasJavaScriptFileExtension; - function allowsJsxExpressions(fileName) { - return ts.fileExtensionIs(fileName, ".tsx") || ts.fileExtensionIs(fileName, ".jsx"); - } - ts.allowsJsxExpressions = allowsJsxExpressions; /** * 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. @@ -6343,6 +7137,47 @@ var ts; } return output; } + /** + * Serialize an object graph into a JSON string. This is intended only for use on an acyclic graph + * as the fallback implementation does not check for circular references by default. + */ + ts.stringify = typeof JSON !== "undefined" && JSON.stringify + ? JSON.stringify + : stringifyFallback; + /** + * Serialize an object graph into a JSON string. + */ + function stringifyFallback(value) { + // JSON.stringify returns `undefined` here, instead of the string "undefined". + return value === undefined ? undefined : stringifyValue(value); + } + function stringifyValue(value) { + return typeof value === "string" ? "\"" + escapeString(value) + "\"" + : typeof value === "number" ? isFinite(value) ? String(value) : "null" + : typeof value === "boolean" ? value ? "true" : "false" + : typeof value === "object" && value ? ts.isArray(value) ? cycleCheck(stringifyArray, value) : cycleCheck(stringifyObject, value) + : "null"; + } + function cycleCheck(cb, value) { + ts.Debug.assert(!value.hasOwnProperty("__cycle"), "Converting circular structure to JSON"); + value.__cycle = true; + var result = cb(value); + delete value.__cycle; + return result; + } + function stringifyArray(value) { + return "[" + ts.reduceLeft(value, stringifyElement, "") + "]"; + } + function stringifyElement(memo, value) { + return (memo ? memo + "," : memo) + stringifyValue(value); + } + function stringifyObject(value) { + return "{" + ts.reduceProperties(value, stringifyProperty, "") + "}"; + } + function stringifyProperty(memo, value, key) { + return value === undefined || typeof value === "function" || key === "__cycle" ? memo + : (memo ? memo + "," : memo) + ("\"" + escapeString(key) + "\":" + stringifyValue(value)); + } var base64Digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; /** * Converts a string to a base-64 encoded ASCII string. @@ -6368,7 +7203,7 @@ var ts; else if (i + 2 >= length) { byte4 = 64; } - // Write to the ouput + // Write to the output result += base64Digits.charAt(byte1) + base64Digits.charAt(byte2) + base64Digits.charAt(byte3) + base64Digits.charAt(byte4); i += 3; } @@ -6396,6 +7231,11 @@ var ts; return carriageReturnLineFeed; } ts.getNewLineCharacter = getNewLineCharacter; + function isWatchSet(options) { + // Firefox has Object.prototype.watch + return options.watch && options.hasOwnProperty("watch"); + } + ts.isWatchSet = isWatchSet; })(ts || (ts = {})); var ts; (function (ts) { @@ -6554,9 +7394,9 @@ var ts; // . | \ // ----------------------------------------------------------------------*-------------------------------- // - // (Note the dots represent the newly inferrred start. + // (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 asterixes, and the relative change between the dollar signs. Basically, we see + // 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: // @@ -6579,8 +7419,8 @@ var ts; // 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 rahter - // than pusing the first edit forward to match the second, we'll push the second edit forward to match the + // 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 @@ -6609,15 +7449,28 @@ var ts; } ts.collapseTextChangeRangesAcrossMultipleVersions = collapseTextChangeRangesAcrossMultipleVersions; function getTypeParameterOwner(d) { - if (d && d.kind === 137 /* TypeParameter */) { + if (d && d.kind === 141 /* TypeParameter */) { for (var current = d; current; current = current.parent) { - if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 215 /* InterfaceDeclaration */) { + if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 222 /* InterfaceDeclaration */) { return current; } } } } ts.getTypeParameterOwner = getTypeParameterOwner; + function isParameterPropertyDeclaration(node) { + return node.flags & 92 /* ParameterPropertyModifier */ && node.parent.kind === 148 /* Constructor */ && ts.isClassLike(node.parent.parent); + } + ts.isParameterPropertyDeclaration = isParameterPropertyDeclaration; + function startsWith(str, prefix) { + return str.lastIndexOf(prefix, 0) === 0; + } + ts.startsWith = startsWith; + function endsWith(str, suffix) { + var expectedPos = str.length - suffix.length; + return str.indexOf(suffix, expectedPos) === expectedPos; + } + ts.endsWith = endsWith; })(ts || (ts = {})); /// /// @@ -6627,7 +7480,7 @@ var ts; var NodeConstructor; var SourceFileConstructor; function createNode(kind, pos, end) { - if (kind === 248 /* SourceFile */) { + if (kind === 256 /* SourceFile */) { return new (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor()))(kind, pos, end); } else { @@ -6670,26 +7523,26 @@ var ts; var visitNodes = cbNodeArray ? visitNodeArray : visitEachNode; var cbNodes = cbNodeArray || cbNode; switch (node.kind) { - case 135 /* QualifiedName */: + case 139 /* QualifiedName */: return visitNode(cbNode, node.left) || visitNode(cbNode, node.right); - case 137 /* TypeParameter */: + case 141 /* TypeParameter */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.constraint) || visitNode(cbNode, node.expression); - case 246 /* ShorthandPropertyAssignment */: + case 254 /* ShorthandPropertyAssignment */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.equalsToken) || visitNode(cbNode, node.objectAssignmentInitializer); - case 138 /* Parameter */: - case 141 /* PropertyDeclaration */: - case 140 /* PropertySignature */: - case 245 /* PropertyAssignment */: - case 211 /* VariableDeclaration */: - case 163 /* BindingElement */: + case 142 /* Parameter */: + case 145 /* PropertyDeclaration */: + case 144 /* PropertySignature */: + case 253 /* PropertyAssignment */: + case 218 /* VariableDeclaration */: + case 169 /* BindingElement */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.propertyName) || @@ -6698,24 +7551,24 @@ var ts; visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.type) || visitNode(cbNode, node.initializer); - case 152 /* FunctionType */: - case 153 /* ConstructorType */: - case 147 /* CallSignature */: - case 148 /* ConstructSignature */: - case 149 /* IndexSignature */: + case 156 /* FunctionType */: + case 157 /* ConstructorType */: + case 151 /* CallSignature */: + case 152 /* ConstructSignature */: + case 153 /* IndexSignature */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type); - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - case 144 /* Constructor */: - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: - case 173 /* FunctionExpression */: - case 213 /* FunctionDeclaration */: - case 174 /* ArrowFunction */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: + case 148 /* Constructor */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: + case 179 /* FunctionExpression */: + case 220 /* FunctionDeclaration */: + case 180 /* ArrowFunction */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.asteriskToken) || @@ -6726,302 +7579,310 @@ var ts; visitNode(cbNode, node.type) || visitNode(cbNode, node.equalsGreaterThanToken) || visitNode(cbNode, node.body); - case 151 /* TypeReference */: + case 155 /* TypeReference */: return visitNode(cbNode, node.typeName) || visitNodes(cbNodes, node.typeArguments); - case 150 /* TypePredicate */: + case 154 /* TypePredicate */: return visitNode(cbNode, node.parameterName) || visitNode(cbNode, node.type); - case 154 /* TypeQuery */: + case 158 /* TypeQuery */: return visitNode(cbNode, node.exprName); - case 155 /* TypeLiteral */: + case 159 /* TypeLiteral */: return visitNodes(cbNodes, node.members); - case 156 /* ArrayType */: + case 160 /* ArrayType */: return visitNode(cbNode, node.elementType); - case 157 /* TupleType */: + case 161 /* TupleType */: return visitNodes(cbNodes, node.elementTypes); - case 158 /* UnionType */: - case 159 /* IntersectionType */: + case 162 /* UnionType */: + case 163 /* IntersectionType */: return visitNodes(cbNodes, node.types); - case 160 /* ParenthesizedType */: + case 164 /* ParenthesizedType */: return visitNode(cbNode, node.type); - case 161 /* ObjectBindingPattern */: - case 162 /* ArrayBindingPattern */: + case 167 /* ObjectBindingPattern */: + case 168 /* ArrayBindingPattern */: return visitNodes(cbNodes, node.elements); - case 164 /* ArrayLiteralExpression */: + case 170 /* ArrayLiteralExpression */: return visitNodes(cbNodes, node.elements); - case 165 /* ObjectLiteralExpression */: + case 171 /* ObjectLiteralExpression */: return visitNodes(cbNodes, node.properties); - case 166 /* PropertyAccessExpression */: + case 172 /* PropertyAccessExpression */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.dotToken) || visitNode(cbNode, node.name); - case 167 /* ElementAccessExpression */: + case 173 /* ElementAccessExpression */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.argumentExpression); - case 168 /* CallExpression */: - case 169 /* NewExpression */: + case 174 /* CallExpression */: + case 175 /* NewExpression */: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments) || visitNodes(cbNodes, node.arguments); - case 170 /* TaggedTemplateExpression */: + case 176 /* TaggedTemplateExpression */: return visitNode(cbNode, node.tag) || visitNode(cbNode, node.template); - case 171 /* TypeAssertionExpression */: + case 177 /* TypeAssertionExpression */: return visitNode(cbNode, node.type) || visitNode(cbNode, node.expression); - case 172 /* ParenthesizedExpression */: + case 178 /* ParenthesizedExpression */: return visitNode(cbNode, node.expression); - case 175 /* DeleteExpression */: + case 181 /* DeleteExpression */: return visitNode(cbNode, node.expression); - case 176 /* TypeOfExpression */: + case 182 /* TypeOfExpression */: return visitNode(cbNode, node.expression); - case 177 /* VoidExpression */: + case 183 /* VoidExpression */: return visitNode(cbNode, node.expression); - case 179 /* PrefixUnaryExpression */: + case 185 /* PrefixUnaryExpression */: return visitNode(cbNode, node.operand); - case 184 /* YieldExpression */: + case 190 /* YieldExpression */: return visitNode(cbNode, node.asteriskToken) || visitNode(cbNode, node.expression); - case 178 /* AwaitExpression */: + case 184 /* AwaitExpression */: return visitNode(cbNode, node.expression); - case 180 /* PostfixUnaryExpression */: + case 186 /* PostfixUnaryExpression */: return visitNode(cbNode, node.operand); - case 181 /* BinaryExpression */: + case 187 /* BinaryExpression */: return visitNode(cbNode, node.left) || visitNode(cbNode, node.operatorToken) || visitNode(cbNode, node.right); - case 189 /* AsExpression */: + case 195 /* AsExpression */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.type); - case 182 /* ConditionalExpression */: + case 196 /* NonNullExpression */: + return visitNode(cbNode, node.expression); + case 188 /* ConditionalExpression */: return visitNode(cbNode, node.condition) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.whenTrue) || visitNode(cbNode, node.colonToken) || visitNode(cbNode, node.whenFalse); - case 185 /* SpreadElementExpression */: + case 191 /* SpreadElementExpression */: return visitNode(cbNode, node.expression); - case 192 /* Block */: - case 219 /* ModuleBlock */: + case 199 /* Block */: + case 226 /* ModuleBlock */: return visitNodes(cbNodes, node.statements); - case 248 /* SourceFile */: + case 256 /* SourceFile */: return visitNodes(cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); - case 193 /* VariableStatement */: + case 200 /* VariableStatement */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.declarationList); - case 212 /* VariableDeclarationList */: + case 219 /* VariableDeclarationList */: return visitNodes(cbNodes, node.declarations); - case 195 /* ExpressionStatement */: + case 202 /* ExpressionStatement */: return visitNode(cbNode, node.expression); - case 196 /* IfStatement */: + case 203 /* IfStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.thenStatement) || visitNode(cbNode, node.elseStatement); - case 197 /* DoStatement */: + case 204 /* DoStatement */: return visitNode(cbNode, node.statement) || visitNode(cbNode, node.expression); - case 198 /* WhileStatement */: + case 205 /* WhileStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 199 /* ForStatement */: + case 206 /* ForStatement */: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.condition) || visitNode(cbNode, node.incrementor) || visitNode(cbNode, node.statement); - case 200 /* ForInStatement */: + case 207 /* ForInStatement */: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 201 /* ForOfStatement */: + case 208 /* ForOfStatement */: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 202 /* ContinueStatement */: - case 203 /* BreakStatement */: + case 209 /* ContinueStatement */: + case 210 /* BreakStatement */: return visitNode(cbNode, node.label); - case 204 /* ReturnStatement */: + case 211 /* ReturnStatement */: return visitNode(cbNode, node.expression); - case 205 /* WithStatement */: + case 212 /* WithStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 206 /* SwitchStatement */: + case 213 /* SwitchStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.caseBlock); - case 220 /* CaseBlock */: + case 227 /* CaseBlock */: return visitNodes(cbNodes, node.clauses); - case 241 /* CaseClause */: + case 249 /* CaseClause */: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.statements); - case 242 /* DefaultClause */: + case 250 /* DefaultClause */: return visitNodes(cbNodes, node.statements); - case 207 /* LabeledStatement */: + case 214 /* LabeledStatement */: return visitNode(cbNode, node.label) || visitNode(cbNode, node.statement); - case 208 /* ThrowStatement */: + case 215 /* ThrowStatement */: return visitNode(cbNode, node.expression); - case 209 /* TryStatement */: + case 216 /* TryStatement */: return visitNode(cbNode, node.tryBlock) || visitNode(cbNode, node.catchClause) || visitNode(cbNode, node.finallyBlock); - case 244 /* CatchClause */: + case 252 /* CatchClause */: return visitNode(cbNode, node.variableDeclaration) || visitNode(cbNode, node.block); - case 139 /* Decorator */: + case 143 /* Decorator */: return visitNode(cbNode, node.expression); - case 214 /* ClassDeclaration */: - case 186 /* ClassExpression */: + case 221 /* ClassDeclaration */: + case 192 /* ClassExpression */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.heritageClauses) || visitNodes(cbNodes, node.members); - case 215 /* InterfaceDeclaration */: + case 222 /* InterfaceDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.heritageClauses) || visitNodes(cbNodes, node.members); - case 216 /* TypeAliasDeclaration */: + case 223 /* TypeAliasDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNode(cbNode, node.type); - case 217 /* EnumDeclaration */: + case 224 /* EnumDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.members); - case 247 /* EnumMember */: + case 255 /* EnumMember */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 218 /* ModuleDeclaration */: + case 225 /* ModuleDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.body); - case 221 /* ImportEqualsDeclaration */: + case 229 /* ImportEqualsDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); - case 222 /* ImportDeclaration */: + case 230 /* ImportDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.importClause) || visitNode(cbNode, node.moduleSpecifier); - case 223 /* ImportClause */: + case 231 /* ImportClause */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.namedBindings); - case 224 /* NamespaceImport */: + case 228 /* GlobalModuleExportDeclaration */: return visitNode(cbNode, node.name); - case 225 /* NamedImports */: - case 229 /* NamedExports */: + case 232 /* NamespaceImport */: + return visitNode(cbNode, node.name); + case 233 /* NamedImports */: + case 237 /* NamedExports */: return visitNodes(cbNodes, node.elements); - case 228 /* ExportDeclaration */: + case 236 /* ExportDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.exportClause) || visitNode(cbNode, node.moduleSpecifier); - case 226 /* ImportSpecifier */: - case 230 /* ExportSpecifier */: + case 234 /* ImportSpecifier */: + case 238 /* ExportSpecifier */: return visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.name); - case 227 /* ExportAssignment */: + case 235 /* ExportAssignment */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.expression); - case 183 /* TemplateExpression */: + case 189 /* TemplateExpression */: return visitNode(cbNode, node.head) || visitNodes(cbNodes, node.templateSpans); - case 190 /* TemplateSpan */: + case 197 /* TemplateSpan */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal); - case 136 /* ComputedPropertyName */: + case 140 /* ComputedPropertyName */: return visitNode(cbNode, node.expression); - case 243 /* HeritageClause */: + case 251 /* HeritageClause */: return visitNodes(cbNodes, node.types); - case 188 /* ExpressionWithTypeArguments */: + case 194 /* ExpressionWithTypeArguments */: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments); - case 232 /* ExternalModuleReference */: + case 240 /* ExternalModuleReference */: return visitNode(cbNode, node.expression); - case 231 /* MissingDeclaration */: + case 239 /* MissingDeclaration */: return visitNodes(cbNodes, node.decorators); - case 233 /* JsxElement */: + case 241 /* JsxElement */: return visitNode(cbNode, node.openingElement) || visitNodes(cbNodes, node.children) || visitNode(cbNode, node.closingElement); - case 234 /* JsxSelfClosingElement */: - case 235 /* JsxOpeningElement */: + case 242 /* JsxSelfClosingElement */: + case 243 /* JsxOpeningElement */: return visitNode(cbNode, node.tagName) || visitNodes(cbNodes, node.attributes); - case 238 /* JsxAttribute */: + case 246 /* JsxAttribute */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 239 /* JsxSpreadAttribute */: + case 247 /* JsxSpreadAttribute */: return visitNode(cbNode, node.expression); - case 240 /* JsxExpression */: + case 248 /* JsxExpression */: return visitNode(cbNode, node.expression); - case 237 /* JsxClosingElement */: + case 245 /* JsxClosingElement */: return visitNode(cbNode, node.tagName); - case 249 /* JSDocTypeExpression */: + case 257 /* JSDocTypeExpression */: return visitNode(cbNode, node.type); - case 253 /* JSDocUnionType */: + case 261 /* JSDocUnionType */: return visitNodes(cbNodes, node.types); - case 254 /* JSDocTupleType */: + case 262 /* JSDocTupleType */: return visitNodes(cbNodes, node.types); - case 252 /* JSDocArrayType */: + case 260 /* JSDocArrayType */: return visitNode(cbNode, node.elementType); - case 256 /* JSDocNonNullableType */: + case 264 /* JSDocNonNullableType */: return visitNode(cbNode, node.type); - case 255 /* JSDocNullableType */: + case 263 /* JSDocNullableType */: return visitNode(cbNode, node.type); - case 257 /* JSDocRecordType */: + case 265 /* JSDocRecordType */: return visitNodes(cbNodes, node.members); - case 259 /* JSDocTypeReference */: + case 267 /* JSDocTypeReference */: return visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeArguments); - case 260 /* JSDocOptionalType */: + case 268 /* JSDocOptionalType */: return visitNode(cbNode, node.type); - case 261 /* JSDocFunctionType */: + case 269 /* JSDocFunctionType */: return visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type); - case 262 /* JSDocVariadicType */: + case 270 /* JSDocVariadicType */: return visitNode(cbNode, node.type); - case 263 /* JSDocConstructorType */: + case 271 /* JSDocConstructorType */: return visitNode(cbNode, node.type); - case 264 /* JSDocThisType */: + case 272 /* JSDocThisType */: return visitNode(cbNode, node.type); - case 258 /* JSDocRecordMember */: + case 266 /* JSDocRecordMember */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.type); - case 265 /* JSDocComment */: + case 273 /* JSDocComment */: return visitNodes(cbNodes, node.tags); - case 267 /* JSDocParameterTag */: + case 275 /* JSDocParameterTag */: return visitNode(cbNode, node.preParameterName) || visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.postParameterName); - case 268 /* JSDocReturnTag */: + case 276 /* JSDocReturnTag */: return visitNode(cbNode, node.typeExpression); - case 269 /* JSDocTypeTag */: + case 277 /* JSDocTypeTag */: return visitNode(cbNode, node.typeExpression); - case 270 /* JSDocTemplateTag */: + case 278 /* JSDocTemplateTag */: return visitNodes(cbNodes, node.typeParameters); } } ts.forEachChild = forEachChild; - function createSourceFile(fileName, sourceText, languageVersion, setParentNodes) { + function createSourceFile(fileName, sourceText, languageVersion, setParentNodes, scriptKind) { if (setParentNodes === void 0) { setParentNodes = false; } var start = new Date().getTime(); - var result = Parser.parseSourceFile(fileName, sourceText, languageVersion, /*syntaxCursor*/ undefined, setParentNodes); + var result = Parser.parseSourceFile(fileName, sourceText, languageVersion, /*syntaxCursor*/ undefined, setParentNodes, scriptKind); ts.parseTime += new Date().getTime() - start; return result; } ts.createSourceFile = createSourceFile; + 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 @@ -7054,7 +7915,7 @@ var ts; // 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(2 /* Latest */, /*skipTrivia*/ true); - var disallowInAndDecoratorContext = 1 /* DisallowIn */ | 4 /* Decorator */; + var disallowInAndDecoratorContext = 4194304 /* DisallowInContext */ | 16777216 /* DecoratorContext */; // capture constructors in 'initializeState' to avoid null checks var NodeConstructor; var SourceFileConstructor; @@ -7142,15 +8003,19 @@ var ts; // 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) { - var isJavaScriptFile = ts.hasJavaScriptFileExtension(fileName) || _sourceText.lastIndexOf("// @language=javascript", 0) === 0; - initializeState(fileName, _sourceText, languageVersion, isJavaScriptFile, _syntaxCursor); - var result = parseSourceFileWorker(fileName, languageVersion, setParentNodes); + function parseSourceFile(fileName, _sourceText, languageVersion, _syntaxCursor, setParentNodes, scriptKind) { + scriptKind = ts.ensureScriptKind(fileName, scriptKind); + initializeState(fileName, _sourceText, languageVersion, _syntaxCursor, scriptKind); + var result = parseSourceFileWorker(fileName, languageVersion, setParentNodes, scriptKind); clearState(); return result; } Parser.parseSourceFile = parseSourceFile; - function initializeState(fileName, _sourceText, languageVersion, isJavaScriptFile, _syntaxCursor) { + function getLanguageVariant(scriptKind) { + // .tsx and .jsx files are treated as jsx language variant. + return scriptKind === 4 /* TSX */ || scriptKind === 2 /* JSX */ || scriptKind === 1 /* JS */ ? 1 /* JSX */ : 0 /* Standard */; + } + function initializeState(fileName, _sourceText, languageVersion, _syntaxCursor, scriptKind) { NodeConstructor = ts.objectAllocator.getNodeConstructor(); SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor(); sourceText = _sourceText; @@ -7160,30 +8025,28 @@ var ts; identifiers = {}; identifierCount = 0; nodeCount = 0; - contextFlags = isJavaScriptFile ? 32 /* JavaScriptFile */ : 0 /* None */; + contextFlags = scriptKind === 1 /* JS */ || scriptKind === 2 /* JSX */ ? 134217728 /* JavaScriptFile */ : 0 /* None */; parseErrorBeforeNextFinishedNode = false; // Initialize and prime the scanner before parsing the source elements. scanner.setText(sourceText); scanner.setOnError(scanError); scanner.setScriptTarget(languageVersion); - scanner.setLanguageVariant(ts.allowsJsxExpressions(fileName) ? 1 /* JSX */ : 0 /* Standard */); + 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 accidently hold onto it for too long. + // Clear any data. We don't want to accidentally hold onto it for too long. parseDiagnostics = undefined; sourceFile = undefined; identifiers = undefined; syntaxCursor = undefined; sourceText = undefined; } - function parseSourceFileWorker(fileName, languageVersion, setParentNodes) { - sourceFile = createSourceFile(fileName, languageVersion); - if (contextFlags & 32 /* JavaScriptFile */) { - sourceFile.parserContextFlags = 32 /* JavaScriptFile */; - } + function parseSourceFileWorker(fileName, languageVersion, setParentNodes, scriptKind) { + sourceFile = createSourceFile(fileName, languageVersion, scriptKind); + sourceFile.flags = contextFlags; // Prime the scanner. token = nextToken(); processReferenceComments(sourceFile); @@ -7198,40 +8061,22 @@ var ts; if (setParentNodes) { fixupParentReferences(sourceFile); } - // If this is a javascript file, proactively see if we can get JSDoc comments for - // relevant nodes in the file. We'll use these to provide typing informaion if they're - // available. - if (ts.isSourceFileJavaScript(sourceFile)) { - addJSDocComments(); - } return sourceFile; } - function addJSDocComments() { - forEachChild(sourceFile, visit); - return; - function visit(node) { - // Add additional cases as necessary depending on how we see JSDoc comments used - // in the wild. - switch (node.kind) { - case 193 /* VariableStatement */: - case 213 /* FunctionDeclaration */: - case 138 /* Parameter */: - addJSDocComment(node); - } - forEachChild(node, visit); - } - } function addJSDocComment(node) { - var comments = ts.getLeadingCommentRangesOfNode(node, sourceFile); - if (comments) { - for (var _i = 0, comments_1 = comments; _i < comments_1.length; _i++) { - var comment = comments_1[_i]; - var jsDocComment = JSDocParser.parseJSDocComment(node, comment.pos, comment.end - comment.pos); - if (jsDocComment) { - node.jsDocComment = jsDocComment; + if (contextFlags & 134217728 /* JavaScriptFile */) { + var comments = ts.getLeadingCommentRangesOfNode(node, sourceFile); + if (comments) { + for (var _i = 0, comments_1 = comments; _i < comments_1.length; _i++) { + var comment = comments_1[_i]; + var jsDocComment = JSDocParser.parseJSDocComment(node, comment.pos, comment.end - comment.pos); + if (jsDocComment) { + node.jsDocComment = jsDocComment; + } } } } + return node; } function fixupParentReferences(sourceFile) { // normally parent references are set during binding. However, for clients that only need @@ -7255,17 +8100,18 @@ var ts; } } Parser.fixupParentReferences = fixupParentReferences; - function createSourceFile(fileName, languageVersion) { + function createSourceFile(fileName, languageVersion, scriptKind) { // 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(248 /* SourceFile */, /*pos*/ 0, /* end */ sourceText.length); + var sourceFile = new SourceFileConstructor(256 /* SourceFile */, /*pos*/ 0, /* end */ sourceText.length); nodeCount++; sourceFile.text = sourceText; sourceFile.bindDiagnostics = []; sourceFile.languageVersion = languageVersion; sourceFile.fileName = ts.normalizePath(fileName); - sourceFile.flags = ts.fileExtensionIs(sourceFile.fileName, ".d.ts") ? 4096 /* DeclarationFile */ : 0; - sourceFile.languageVariant = ts.allowsJsxExpressions(sourceFile.fileName) ? 1 /* JSX */ : 0 /* Standard */; + sourceFile.languageVariant = getLanguageVariant(scriptKind); + sourceFile.isDeclarationFile = ts.fileExtensionIs(sourceFile.fileName, ".d.ts"); + sourceFile.scriptKind = scriptKind; return sourceFile; } function setContextFlag(val, flag) { @@ -7277,16 +8123,16 @@ var ts; } } function setDisallowInContext(val) { - setContextFlag(val, 1 /* DisallowIn */); + setContextFlag(val, 4194304 /* DisallowInContext */); } function setYieldContext(val) { - setContextFlag(val, 2 /* Yield */); + setContextFlag(val, 8388608 /* YieldContext */); } function setDecoratorContext(val) { - setContextFlag(val, 4 /* Decorator */); + setContextFlag(val, 16777216 /* DecoratorContext */); } function setAwaitContext(val) { - setContextFlag(val, 8 /* Await */); + setContextFlag(val, 33554432 /* AwaitContext */); } function doOutsideOfContext(context, func) { // contextFlagsToClear will contain only the context flags that are @@ -7298,10 +8144,10 @@ var ts; var contextFlagsToClear = context & contextFlags; if (contextFlagsToClear) { // clear the requested context flags - setContextFlag(false, contextFlagsToClear); + setContextFlag(/*val*/ false, contextFlagsToClear); var result = func(); // restore the context flags we just cleared - setContextFlag(true, contextFlagsToClear); + setContextFlag(/*val*/ true, contextFlagsToClear); return result; } // no need to do anything special as we are not in any of the requested contexts @@ -7317,56 +8163,50 @@ var ts; var contextFlagsToSet = context & ~contextFlags; if (contextFlagsToSet) { // set the requested context flags - setContextFlag(true, contextFlagsToSet); + setContextFlag(/*val*/ true, contextFlagsToSet); var result = func(); // reset the context flags we just set - setContextFlag(false, contextFlagsToSet); + setContextFlag(/*val*/ 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(1 /* DisallowIn */, func); + return doOutsideOfContext(4194304 /* DisallowInContext */, func); } function disallowInAnd(func) { - return doInsideOfContext(1 /* DisallowIn */, func); + return doInsideOfContext(4194304 /* DisallowInContext */, func); } function doInYieldContext(func) { - return doInsideOfContext(2 /* Yield */, func); - } - function doOutsideOfYieldContext(func) { - return doOutsideOfContext(2 /* Yield */, func); + return doInsideOfContext(8388608 /* YieldContext */, func); } function doInDecoratorContext(func) { - return doInsideOfContext(4 /* Decorator */, func); + return doInsideOfContext(16777216 /* DecoratorContext */, func); } function doInAwaitContext(func) { - return doInsideOfContext(8 /* Await */, func); + return doInsideOfContext(33554432 /* AwaitContext */, func); } function doOutsideOfAwaitContext(func) { - return doOutsideOfContext(8 /* Await */, func); + return doOutsideOfContext(33554432 /* AwaitContext */, func); } function doInYieldAndAwaitContext(func) { - return doInsideOfContext(2 /* Yield */ | 8 /* Await */, func); - } - function doOutsideOfYieldAndAwaitContext(func) { - return doOutsideOfContext(2 /* Yield */ | 8 /* Await */, func); + return doInsideOfContext(8388608 /* YieldContext */ | 33554432 /* AwaitContext */, func); } function inContext(flags) { return (contextFlags & flags) !== 0; } function inYieldContext() { - return inContext(2 /* Yield */); + return inContext(8388608 /* YieldContext */); } function inDisallowInContext() { - return inContext(1 /* DisallowIn */); + return inContext(4194304 /* DisallowInContext */); } function inDecoratorContext() { - return inContext(4 /* Decorator */); + return inContext(16777216 /* DecoratorContext */); } function inAwaitContext() { - return inContext(8 /* Await */); + return inContext(33554432 /* AwaitContext */); } function parseErrorAtCurrentToken(message, arg0) { var start = scanner.getTokenPos(); @@ -7396,9 +8236,6 @@ var ts; function nextToken() { return token = scanner.scan(); } - function getTokenPos(pos) { - return ts.skipTrivia(sourceText, pos); - } function reScanGreaterToken() { return token = scanner.reScanGreaterToken(); } @@ -7441,16 +8278,18 @@ 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. + /** 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); } - // 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. + /** 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); } @@ -7541,14 +8380,14 @@ var ts; function finishNode(node, end) { node.end = end === undefined ? scanner.getStartPos() : end; if (contextFlags) { - node.parserContextFlags = 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.parserContextFlags |= 16 /* ThisNodeHasError */; + node.flags |= 67108864 /* ThisNodeHasError */; } return node; } @@ -7605,10 +8444,10 @@ var ts; return parseIdentifierName(); } function parsePropertyName() { - return parsePropertyNameWorker(/*allowComputedPropertyNames:*/ true); + return parsePropertyNameWorker(/*allowComputedPropertyNames*/ true); } function parseSimplePropertyName() { - return parsePropertyNameWorker(/*allowComputedPropertyNames:*/ false); + return parsePropertyNameWorker(/*allowComputedPropertyNames*/ false); } function isSimplePropertyName() { return token === 9 /* StringLiteral */ || token === 8 /* NumericLiteral */ || ts.tokenIsIdentifierOrKeyword(token); @@ -7617,7 +8456,7 @@ var ts; // PropertyName [Yield]: // LiteralPropertyName // ComputedPropertyName[?Yield] - var node = createNode(136 /* ComputedPropertyName */); + var node = createNode(140 /* ComputedPropertyName */); parseExpected(19 /* OpenBracketToken */); // We parse any expression (including a comma expression). But the grammar // says that only an assignment expression is allowed, so the grammar checker @@ -7629,6 +8468,13 @@ var ts; function parseContextualModifier(t) { return token === t && tryParse(nextTokenCanFollowModifier); } + function nextTokenIsOnSameLineAndCanFollowModifier() { + nextToken(); + if (scanner.hasPrecedingLineBreak()) { + return false; + } + return canFollowModifier(); + } function nextTokenCanFollowModifier() { if (token === 74 /* ConstKeyword */) { // 'const' is only a modifier if followed by 'enum'. @@ -7639,7 +8485,7 @@ var ts; if (token === 77 /* DefaultKeyword */) { return lookAhead(nextTokenIsClassOrFunction); } - return token !== 37 /* AsteriskToken */ && token !== 15 /* OpenBraceToken */ && canFollowModifier(); + return token !== 37 /* AsteriskToken */ && token !== 116 /* AsKeyword */ && token !== 15 /* OpenBraceToken */ && canFollowModifier(); } if (token === 77 /* DefaultKeyword */) { return nextTokenIsClassOrFunction(); @@ -7648,14 +8494,10 @@ var ts; nextToken(); return canFollowModifier(); } - nextToken(); - if (scanner.hasPrecedingLineBreak()) { - return false; - } - return canFollowModifier(); + return nextTokenIsOnSameLineAndCanFollowModifier(); } function parseAnyContextualModifier() { - return ts.isModifier(token) && tryParse(nextTokenCanFollowModifier); + return ts.isModifierKind(token) && tryParse(nextTokenCanFollowModifier); } function canFollowModifier() { return token === 19 /* OpenBracketToken */ @@ -7687,7 +8529,7 @@ var ts; case 2 /* SwitchClauses */: return token === 71 /* CaseKeyword */ || token === 77 /* DefaultKeyword */; case 4 /* TypeMembers */: - return isStartOfTypeMember(); + 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 @@ -7861,7 +8703,7 @@ var ts; function isInSomeParsingContext() { for (var kind = 0; kind < 26 /* Count */; kind++) { if (parsingContext & (1 << kind)) { - if (isListElement(kind, /* inErrorRecovery */ true) || isListTerminator(kind)) { + if (isListElement(kind, /*inErrorRecovery*/ true) || isListTerminator(kind)) { return true; } } @@ -7875,7 +8717,7 @@ var ts; var result = []; result.pos = getNodePos(); while (!isListTerminator(kind)) { - if (isListElement(kind, /* inErrorRecovery */ false)) { + if (isListElement(kind, /*inErrorRecovery*/ false)) { var element = parseListElement(kind, parseElement); result.push(element); continue; @@ -7927,20 +8769,20 @@ var ts; // 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 presense of strict mode may cause us to parse the tokens in the file - // differetly. + // 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.parserContextFlags & 31 /* ParserGeneratedFlags */; + var nodeContextFlags = node.flags & 197132288 /* ContextFlags */; 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 currest list parsing context that we're currently at. + // in the current list parsing context that we're currently at. if (!canReuseNode(node, parsingContext)) { return undefined; } @@ -8015,14 +8857,14 @@ var ts; function isReusableClassMember(node) { if (node) { switch (node.kind) { - case 144 /* Constructor */: - case 149 /* IndexSignature */: - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: - case 141 /* PropertyDeclaration */: - case 191 /* SemicolonClassElement */: + case 148 /* Constructor */: + case 153 /* IndexSignature */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: + case 145 /* PropertyDeclaration */: + case 198 /* SemicolonClassElement */: return true; - case 143 /* MethodDeclaration */: + case 147 /* 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. @@ -8037,8 +8879,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 241 /* CaseClause */: - case 242 /* DefaultClause */: + case 249 /* CaseClause */: + case 250 /* DefaultClause */: return true; } } @@ -8047,58 +8889,58 @@ var ts; function isReusableStatement(node) { if (node) { switch (node.kind) { - case 213 /* FunctionDeclaration */: - case 193 /* VariableStatement */: - case 192 /* Block */: - case 196 /* IfStatement */: - case 195 /* ExpressionStatement */: - case 208 /* ThrowStatement */: - case 204 /* ReturnStatement */: - case 206 /* SwitchStatement */: - case 203 /* BreakStatement */: - case 202 /* ContinueStatement */: - case 200 /* ForInStatement */: - case 201 /* ForOfStatement */: - case 199 /* ForStatement */: - case 198 /* WhileStatement */: - case 205 /* WithStatement */: - case 194 /* EmptyStatement */: - case 209 /* TryStatement */: - case 207 /* LabeledStatement */: - case 197 /* DoStatement */: - case 210 /* DebuggerStatement */: - case 222 /* ImportDeclaration */: - case 221 /* ImportEqualsDeclaration */: - case 228 /* ExportDeclaration */: - case 227 /* ExportAssignment */: - case 218 /* ModuleDeclaration */: - case 214 /* ClassDeclaration */: - case 215 /* InterfaceDeclaration */: - case 217 /* EnumDeclaration */: - case 216 /* TypeAliasDeclaration */: + case 220 /* FunctionDeclaration */: + case 200 /* VariableStatement */: + case 199 /* Block */: + case 203 /* IfStatement */: + case 202 /* ExpressionStatement */: + case 215 /* ThrowStatement */: + case 211 /* ReturnStatement */: + case 213 /* SwitchStatement */: + case 210 /* BreakStatement */: + case 209 /* ContinueStatement */: + case 207 /* ForInStatement */: + case 208 /* ForOfStatement */: + case 206 /* ForStatement */: + case 205 /* WhileStatement */: + case 212 /* WithStatement */: + case 201 /* EmptyStatement */: + case 216 /* TryStatement */: + case 214 /* LabeledStatement */: + case 204 /* DoStatement */: + case 217 /* DebuggerStatement */: + case 230 /* ImportDeclaration */: + case 229 /* ImportEqualsDeclaration */: + case 236 /* ExportDeclaration */: + case 235 /* ExportAssignment */: + case 225 /* ModuleDeclaration */: + case 221 /* ClassDeclaration */: + case 222 /* InterfaceDeclaration */: + case 224 /* EnumDeclaration */: + case 223 /* TypeAliasDeclaration */: return true; } } return false; } function isReusableEnumMember(node) { - return node.kind === 247 /* EnumMember */; + return node.kind === 255 /* EnumMember */; } function isReusableTypeMember(node) { if (node) { switch (node.kind) { - case 148 /* ConstructSignature */: - case 142 /* MethodSignature */: - case 149 /* IndexSignature */: - case 140 /* PropertySignature */: - case 147 /* CallSignature */: + case 152 /* ConstructSignature */: + case 146 /* MethodSignature */: + case 153 /* IndexSignature */: + case 144 /* PropertySignature */: + case 151 /* CallSignature */: return true; } } return false; } function isReusableVariableDeclaration(node) { - if (node.kind !== 211 /* VariableDeclaration */) { + if (node.kind !== 218 /* VariableDeclaration */) { return false; } // Very subtle incremental parsing bug. Consider the following code: @@ -8119,7 +8961,7 @@ var ts; return variableDeclarator.initializer === undefined; } function isReusableParameter(node) { - if (node.kind !== 138 /* Parameter */) { + if (node.kind !== 142 /* Parameter */) { return false; } // See the comment in isReusableVariableDeclaration for why we do this. @@ -8167,14 +9009,14 @@ var ts; } ; // Parses a comma-delimited list of elements - function parseDelimitedList(kind, parseElement, considerSemicolonAsDelimeter) { + function parseDelimitedList(kind, parseElement, considerSemicolonAsDelimiter) { var saveParsingContext = parsingContext; parsingContext |= 1 << kind; var result = []; result.pos = getNodePos(); var commaStart = -1; // Meaning the previous token was not a comma while (true) { - if (isListElement(kind, /* inErrorRecovery */ false)) { + if (isListElement(kind, /*inErrorRecovery*/ false)) { result.push(parseListElement(kind, parseElement)); commaStart = scanner.getTokenPos(); if (parseOptional(24 /* CommaToken */)) { @@ -8192,7 +9034,7 @@ var ts; // parse errors. For example, this can happen when people do things like use // a semicolon to delimit object literal members. Note: we'll have already // reported an error when we called parseExpected above. - if (considerSemicolonAsDelimeter && token === 23 /* SemicolonToken */ && !scanner.hasPrecedingLineBreak()) { + if (considerSemicolonAsDelimiter && token === 23 /* SemicolonToken */ && !scanner.hasPrecedingLineBreak()) { nextToken(); } continue; @@ -8236,7 +9078,7 @@ var ts; function parseEntityName(allowReservedWords, diagnosticMessage) { var entity = parseIdentifier(diagnosticMessage); while (parseOptional(21 /* DotToken */)) { - var node = createNode(135 /* QualifiedName */, entity.pos); + var node = createNode(139 /* QualifiedName */, entity.pos); // !!! node.left = entity; node.right = parseRightSideOfDot(allowReservedWords); entity = finishNode(node); @@ -8269,14 +9111,14 @@ var ts; // 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(69 /* Identifier */, /*reportAtCurrentToken*/ true, ts.Diagnostics.Identifier_expected); + return createMissingNode(69 /* Identifier */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Identifier_expected); } } return allowIdentifierNames ? parseIdentifierName() : parseIdentifier(); } function parseTemplateExpression() { - var template = createNode(183 /* TemplateExpression */); - template.head = parseLiteralNode(); + var template = createNode(189 /* TemplateExpression */); + template.head = parseTemplateLiteralFragment(); ts.Debug.assert(template.head.kind === 12 /* TemplateHead */, "Template head has wrong token kind"); var templateSpans = []; templateSpans.pos = getNodePos(); @@ -8288,12 +9130,12 @@ var ts; return finishNode(template); } function parseTemplateSpan() { - var span = createNode(190 /* TemplateSpan */); + var span = createNode(197 /* TemplateSpan */); span.expression = allowInAnd(parseExpression); var literal; if (token === 16 /* CloseBraceToken */) { reScanTemplateToken(); - literal = parseLiteralNode(); + literal = parseTemplateLiteralFragment(); } else { literal = parseExpectedToken(14 /* TemplateTail */, /*reportAtCurrentPosition*/ false, ts.Diagnostics._0_expected, ts.tokenToString(16 /* CloseBraceToken */)); @@ -8301,8 +9143,17 @@ var ts; span.literal = literal; return finishNode(span); } + function parseStringLiteralTypeNode() { + return parseLiteralLikeNode(166 /* StringLiteralType */, /*internName*/ true); + } function parseLiteralNode(internName) { - var node = createNode(token); + return parseLiteralLikeNode(token, internName); + } + function parseTemplateLiteralFragment() { + return parseLiteralLikeNode(token, /*internName*/ false); + } + function parseLiteralLikeNode(kind, internName) { + var node = createNode(kind); var text = scanner.getTokenValue(); node.text = internName ? internIdentifier(text) : text; if (scanner.hasExtendedUnicodeEscape()) { @@ -8323,35 +9174,40 @@ var ts; if (node.kind === 8 /* NumericLiteral */ && sourceText.charCodeAt(tokenPos) === 48 /* _0 */ && ts.isOctalDigit(sourceText.charCodeAt(tokenPos + 1))) { - node.flags |= 32768 /* OctalLiteral */; + node.isOctalLiteral = true; } return node; } // TYPES - function parseTypeReferenceOrTypePredicate() { + function parseTypeReference() { var typeName = parseEntityName(/*allowReservedWords*/ false, ts.Diagnostics.Type_expected); - if (typeName.kind === 69 /* Identifier */ && token === 124 /* IsKeyword */ && !scanner.hasPrecedingLineBreak()) { - nextToken(); - var node_1 = createNode(150 /* TypePredicate */, typeName.pos); - node_1.parameterName = typeName; - node_1.type = parseType(); - return finishNode(node_1); - } - var node = createNode(151 /* TypeReference */, typeName.pos); + var node = createNode(155 /* TypeReference */, typeName.pos); node.typeName = typeName; if (!scanner.hasPrecedingLineBreak() && token === 25 /* LessThanToken */) { node.typeArguments = parseBracketedList(18 /* TypeArguments */, parseType, 25 /* LessThanToken */, 27 /* GreaterThanToken */); } return finishNode(node); } + function parseThisTypePredicate(lhs) { + nextToken(); + var node = createNode(154 /* TypePredicate */, lhs.pos); + node.parameterName = lhs; + node.type = parseType(); + return finishNode(node); + } + function parseThisTypeNode() { + var node = createNode(165 /* ThisType */); + nextToken(); + return finishNode(node); + } function parseTypeQuery() { - var node = createNode(154 /* TypeQuery */); + var node = createNode(158 /* TypeQuery */); parseExpected(101 /* TypeOfKeyword */); node.exprName = parseEntityName(/*allowReservedWords*/ true); return finishNode(node); } function parseTypeParameter() { - var node = createNode(137 /* TypeParameter */); + var node = createNode(141 /* TypeParameter */); node.name = parseIdentifier(); if (parseOptional(83 /* ExtendsKeyword */)) { // It's not uncommon for people to write improper constraints to a generic. If the @@ -8386,7 +9242,7 @@ var ts; return undefined; } function isStartOfParameter() { - return token === 22 /* DotDotDotToken */ || isIdentifierOrPattern() || ts.isModifier(token) || token === 55 /* AtToken */; + return token === 22 /* DotDotDotToken */ || isIdentifierOrPattern() || ts.isModifierKind(token) || token === 55 /* AtToken */ || token === 97 /* ThisKeyword */; } function setModifiers(node, modifiers) { if (modifiers) { @@ -8395,14 +9251,19 @@ var ts; } } function parseParameter() { - var node = createNode(138 /* Parameter */); + var node = createNode(142 /* Parameter */); + if (token === 97 /* ThisKeyword */) { + node.name = createIdentifier(/*isIdentifier*/ true, undefined); + node.type = parseParameterType(); + return finishNode(node); + } node.decorators = parseDecorators(); setModifiers(node, parseModifiers()); node.dotDotDotToken = parseOptionalToken(22 /* DotDotDotToken */); // FormalParameter [Yield,Await]: // BindingElement[?Yield,?Await] node.name = parseIdentifierOrPattern(); - if (ts.getFullWidth(node.name) === 0 && node.flags === 0 && ts.isModifier(token)) { + if (ts.getFullWidth(node.name) === 0 && node.flags === 0 && ts.isModifierKind(token)) { // in cases like // 'use strict' // function foo(static) @@ -8424,7 +9285,7 @@ var ts; // contexts. In addition, parameter initializers are semantically disallowed in // overload signatures. So parameter initializers are transitively disallowed in // ambient contexts. - return finishNode(node); + return addJSDocComment(finishNode(node)); } function parseBindingElementInitializer(inParameter) { return inParameter ? parseParameterInitializer() : parseNonParameterInitializer(); @@ -8438,10 +9299,10 @@ var ts; signature.parameters = parseParameterList(yieldContext, awaitContext, requireCompleteParameterList); if (returnTokenRequired) { parseExpected(returnToken); - signature.type = parseType(); + signature.type = parseTypeOrTypePredicate(); } else if (parseOptional(returnToken)) { - signature.type = parseType(); + signature.type = parseTypeOrTypePredicate(); } } function parseParameterList(yieldContext, awaitContext, requireCompleteParameterList) { @@ -8489,7 +9350,7 @@ var ts; } function parseSignatureMember(kind) { var node = createNode(kind); - if (kind === 148 /* ConstructSignature */) { + if (kind === 152 /* ConstructSignature */) { parseExpected(92 /* NewKeyword */); } fillSignature(54 /* ColonToken */, /*yieldContext*/ false, /*awaitContext*/ false, /*requireCompleteParameterList*/ false, node); @@ -8523,7 +9384,7 @@ var ts; if (token === 22 /* DotDotDotToken */ || token === 20 /* CloseBracketToken */) { return true; } - if (ts.isModifier(token)) { + if (ts.isModifierKind(token)) { nextToken(); if (isIdentifier()) { return true; @@ -8553,7 +9414,7 @@ var ts; return token === 54 /* ColonToken */ || token === 24 /* CommaToken */ || token === 20 /* CloseBracketToken */; } function parseIndexSignatureDeclaration(fullStart, decorators, modifiers) { - var node = createNode(149 /* IndexSignature */, fullStart); + var node = createNode(153 /* IndexSignature */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.parameters = parseBracketedList(16 /* Parameters */, parseParameter, 19 /* OpenBracketToken */, 20 /* CloseBracketToken */); @@ -8561,109 +9422,87 @@ var ts; parseTypeMemberSemicolon(); return finishNode(node); } - function parsePropertyOrMethodSignature() { - var fullStart = scanner.getStartPos(); + function parsePropertyOrMethodSignature(fullStart, modifiers) { var name = parsePropertyName(); var questionToken = parseOptionalToken(53 /* QuestionToken */); if (token === 17 /* OpenParenToken */ || token === 25 /* LessThanToken */) { - var method = createNode(142 /* MethodSignature */, fullStart); + var method = createNode(146 /* MethodSignature */, fullStart); + setModifiers(method, modifiers); method.name = name; method.questionToken = questionToken; - // Method signatues don't exist in expression contexts. So they have neither + // Method signatures don't exist in expression contexts. So they have neither // [Yield] nor [Await] fillSignature(54 /* ColonToken */, /*yieldContext*/ false, /*awaitContext*/ false, /*requireCompleteParameterList*/ false, method); parseTypeMemberSemicolon(); return finishNode(method); } else { - var property = createNode(140 /* PropertySignature */, fullStart); + var property = createNode(144 /* PropertySignature */, fullStart); + setModifiers(property, modifiers); property.name = name; property.questionToken = questionToken; property.type = parseTypeAnnotation(); + if (token === 56 /* 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. + property.initializer = parseNonParameterInitializer(); + } parseTypeMemberSemicolon(); return finishNode(property); } } - function isStartOfTypeMember() { - switch (token) { - case 17 /* OpenParenToken */: - case 25 /* LessThanToken */: - case 19 /* OpenBracketToken */: - return true; - default: - if (ts.isModifier(token)) { - var result = lookAhead(isStartOfIndexSignatureDeclaration); - if (result) { - return result; - } - } - return isLiteralPropertyName() && lookAhead(isTypeMemberWithLiteralPropertyName); + function isTypeMemberStart() { + var idToken; + // Return true if we have the start of a signature member + if (token === 17 /* OpenParenToken */ || token === 25 /* LessThanToken */) { + return true; } - } - function isStartOfIndexSignatureDeclaration() { - while (ts.isModifier(token)) { + // Eat up all modifiers, but hold on to the last one in case it is actually an identifier + while (ts.isModifierKind(token)) { + idToken = token; nextToken(); } - return isIndexSignature(); - } - function isTypeMemberWithLiteralPropertyName() { - nextToken(); - return token === 17 /* OpenParenToken */ || - token === 25 /* LessThanToken */ || - token === 53 /* QuestionToken */ || - token === 54 /* ColonToken */ || - canParseSemicolon(); + // Index signatures and computed property names are type members + if (token === 19 /* OpenBracketToken */) { + return true; + } + // Try to get the first property-like token following all modifiers + if (isLiteralPropertyName()) { + idToken = token; + nextToken(); + } + // If we were able to get any potential identifier, check that it is + // the start of a member declaration + if (idToken) { + return token === 17 /* OpenParenToken */ || + token === 25 /* LessThanToken */ || + token === 53 /* QuestionToken */ || + token === 54 /* ColonToken */ || + canParseSemicolon(); + } + return false; } function parseTypeMember() { - switch (token) { - case 17 /* OpenParenToken */: - case 25 /* LessThanToken */: - return parseSignatureMember(147 /* CallSignature */); - case 19 /* OpenBracketToken */: - // Indexer or computed property - return isIndexSignature() - ? parseIndexSignatureDeclaration(scanner.getStartPos(), /*decorators*/ undefined, /*modifiers*/ undefined) - : parsePropertyOrMethodSignature(); - case 92 /* NewKeyword */: - if (lookAhead(isStartOfConstructSignature)) { - return parseSignatureMember(148 /* ConstructSignature */); - } - // fall through. - case 9 /* StringLiteral */: - case 8 /* NumericLiteral */: - return parsePropertyOrMethodSignature(); - default: - // Index declaration as allowed as a type member. But as per the grammar, - // they also allow modifiers. So we have to check for an index declaration - // that might be following modifiers. This ensures that things work properly - // when incrementally parsing as the parser will produce the Index declaration - // if it has the same text regardless of whether it is inside a class or an - // object type. - if (ts.isModifier(token)) { - var result = tryParse(parseIndexSignatureWithModifiers); - if (result) { - return result; - } - } - if (ts.tokenIsIdentifierOrKeyword(token)) { - return parsePropertyOrMethodSignature(); - } + if (token === 17 /* OpenParenToken */ || token === 25 /* LessThanToken */) { + return parseSignatureMember(151 /* CallSignature */); } - } - function parseIndexSignatureWithModifiers() { - var fullStart = scanner.getStartPos(); - var decorators = parseDecorators(); + if (token === 92 /* NewKeyword */ && lookAhead(isStartOfConstructSignature)) { + return parseSignatureMember(152 /* ConstructSignature */); + } + var fullStart = getNodePos(); var modifiers = parseModifiers(); - return isIndexSignature() - ? parseIndexSignatureDeclaration(fullStart, decorators, modifiers) - : undefined; + if (isIndexSignature()) { + return parseIndexSignatureDeclaration(fullStart, /*decorators*/ undefined, modifiers); + } + return parsePropertyOrMethodSignature(fullStart, modifiers); } function isStartOfConstructSignature() { nextToken(); return token === 17 /* OpenParenToken */ || token === 25 /* LessThanToken */; } function parseTypeLiteral() { - var node = createNode(155 /* TypeLiteral */); + var node = createNode(159 /* TypeLiteral */); node.members = parseObjectTypeMembers(); return finishNode(node); } @@ -8679,12 +9518,12 @@ var ts; return members; } function parseTupleType() { - var node = createNode(157 /* TupleType */); + var node = createNode(161 /* TupleType */); node.elementTypes = parseBracketedList(19 /* TupleElementTypes */, parseType, 19 /* OpenBracketToken */, 20 /* CloseBracketToken */); return finishNode(node); } function parseParenthesizedType() { - var node = createNode(160 /* ParenthesizedType */); + var node = createNode(164 /* ParenthesizedType */); parseExpected(17 /* OpenParenToken */); node.type = parseType(); parseExpected(18 /* CloseParenToken */); @@ -8692,7 +9531,7 @@ var ts; } function parseFunctionOrConstructorType(kind) { var node = createNode(kind); - if (kind === 153 /* ConstructorType */) { + if (kind === 157 /* ConstructorType */) { parseExpected(92 /* NewKeyword */); } fillSignature(34 /* EqualsGreaterThanToken */, /*yieldContext*/ false, /*awaitContext*/ false, /*requireCompleteParameterList*/ false, node); @@ -8705,18 +9544,29 @@ var ts; function parseNonArrayType() { switch (token) { case 117 /* AnyKeyword */: - case 130 /* StringKeyword */: - case 128 /* NumberKeyword */: + case 132 /* StringKeyword */: + case 130 /* NumberKeyword */: case 120 /* BooleanKeyword */: - case 131 /* SymbolKeyword */: + case 133 /* SymbolKeyword */: + case 135 /* UndefinedKeyword */: + case 127 /* NeverKeyword */: // If these are followed by a dot, then parse these out as a dotted type reference instead. var node = tryParse(parseKeywordAndNoDot); - return node || parseTypeReferenceOrTypePredicate(); + return node || parseTypeReference(); case 9 /* StringLiteral */: - return parseLiteralNode(/*internName*/ true); + return parseStringLiteralTypeNode(); case 103 /* VoidKeyword */: - case 97 /* ThisKeyword */: + case 93 /* NullKeyword */: return parseTokenNode(); + case 97 /* ThisKeyword */: { + var thisKeyword = parseThisTypeNode(); + if (token === 124 /* IsKeyword */ && !scanner.hasPrecedingLineBreak()) { + return parseThisTypePredicate(thisKeyword); + } + else { + return thisKeyword; + } + } case 101 /* TypeOfKeyword */: return parseTypeQuery(); case 15 /* OpenBraceToken */: @@ -8726,19 +9576,22 @@ var ts; case 17 /* OpenParenToken */: return parseParenthesizedType(); default: - return parseTypeReferenceOrTypePredicate(); + return parseTypeReference(); } } function isStartOfType() { switch (token) { case 117 /* AnyKeyword */: - case 130 /* StringKeyword */: - case 128 /* NumberKeyword */: + case 132 /* StringKeyword */: + case 130 /* NumberKeyword */: case 120 /* BooleanKeyword */: - case 131 /* SymbolKeyword */: + case 133 /* SymbolKeyword */: case 103 /* VoidKeyword */: + case 135 /* UndefinedKeyword */: + case 93 /* NullKeyword */: case 97 /* ThisKeyword */: case 101 /* TypeOfKeyword */: + case 127 /* NeverKeyword */: case 15 /* OpenBraceToken */: case 19 /* OpenBracketToken */: case 25 /* LessThanToken */: @@ -8761,7 +9614,7 @@ var ts; var type = parseNonArrayType(); while (!scanner.hasPrecedingLineBreak() && parseOptional(19 /* OpenBracketToken */)) { parseExpected(20 /* CloseBracketToken */); - var node = createNode(156 /* ArrayType */, type.pos); + var node = createNode(160 /* ArrayType */, type.pos); node.elementType = type; type = finishNode(node); } @@ -8783,10 +9636,10 @@ var ts; return type; } function parseIntersectionTypeOrHigher() { - return parseUnionOrIntersectionType(159 /* IntersectionType */, parseArrayTypeOrHigher, 46 /* AmpersandToken */); + return parseUnionOrIntersectionType(163 /* IntersectionType */, parseArrayTypeOrHigher, 46 /* AmpersandToken */); } function parseUnionTypeOrHigher() { - return parseUnionOrIntersectionType(158 /* UnionType */, parseIntersectionTypeOrHigher, 47 /* BarToken */); + return parseUnionOrIntersectionType(162 /* UnionType */, parseIntersectionTypeOrHigher, 47 /* BarToken */); } function isStartOfFunctionType() { if (token === 25 /* LessThanToken */) { @@ -8794,6 +9647,23 @@ var ts; } return token === 17 /* OpenParenToken */ && lookAhead(isUnambiguouslyStartOfFunctionType); } + function skipParameterStart() { + if (ts.isModifierKind(token)) { + // Skip modifiers + parseModifiers(); + } + if (isIdentifier() || token === 97 /* ThisKeyword */) { + nextToken(); + return true; + } + if (token === 19 /* OpenBracketToken */ || token === 15 /* OpenBraceToken */) { + // Return true if we can parse an array or object binding pattern with no errors + var previousErrorCount = parseDiagnostics.length; + parseIdentifierOrPattern(); + return previousErrorCount === parseDiagnostics.length; + } + return false; + } function isUnambiguouslyStartOfFunctionType() { nextToken(); if (token === 18 /* CloseParenToken */ || token === 22 /* DotDotDotToken */) { @@ -8801,39 +9671,58 @@ var ts; // ( ... return true; } - if (isIdentifier() || ts.isModifier(token)) { - nextToken(); + 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 === 54 /* ColonToken */ || token === 24 /* CommaToken */ || - token === 53 /* QuestionToken */ || token === 56 /* EqualsToken */ || - isIdentifier() || ts.isModifier(token)) { - // ( id : - // ( id , - // ( id ? - // ( id = - // ( modifier id + token === 53 /* QuestionToken */ || token === 56 /* EqualsToken */) { + // ( xxx : + // ( xxx , + // ( xxx ? + // ( xxx = return true; } if (token === 18 /* CloseParenToken */) { nextToken(); if (token === 34 /* EqualsGreaterThanToken */) { - // ( id ) => + // ( xxx ) => return true; } } } return false; } + function parseTypeOrTypePredicate() { + var typePredicateVariable = isIdentifier() && tryParse(parseTypePredicatePrefix); + var type = parseType(); + if (typePredicateVariable) { + var node = createNode(154 /* TypePredicate */, typePredicateVariable.pos); + node.parameterName = typePredicateVariable; + node.type = type; + return finishNode(node); + } + else { + return type; + } + } + function parseTypePredicatePrefix() { + var id = parseIdentifier(); + if (token === 124 /* IsKeyword */ && !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(10 /* TypeExcludesFlags */, parseTypeWorker); + return doOutsideOfContext(41943040 /* TypeExcludesFlags */, parseTypeWorker); } function parseTypeWorker() { if (isStartOfFunctionType()) { - return parseFunctionOrConstructorType(152 /* FunctionType */); + return parseFunctionOrConstructorType(156 /* FunctionType */); } if (token === 92 /* NewKeyword */) { - return parseFunctionOrConstructorType(153 /* ConstructorType */); + return parseFunctionOrConstructorType(157 /* ConstructorType */); } return parseUnionTypeOrHigher(); } @@ -8906,9 +9795,6 @@ var ts; token !== 55 /* AtToken */ && isStartOfExpression(); } - function allowInAndParseExpression() { - return allowInAnd(parseExpression); - } function parseExpression() { // Expression[in]: // AssignmentExpression[in] @@ -8916,7 +9802,7 @@ var ts; // clear the decorator context when parsing Expression, as it should be unambiguous when parsing a decorator var saveDecoratorContext = inDecoratorContext(); if (saveDecoratorContext) { - setDecoratorContext(false); + setDecoratorContext(/*val*/ false); } var expr = parseAssignmentExpressionOrHigher(); var operatorToken; @@ -8924,7 +9810,7 @@ var ts; expr = makeBinaryExpression(expr, operatorToken, parseAssignmentExpressionOrHigher()); } if (saveDecoratorContext) { - setDecoratorContext(true); + setDecoratorContext(/*val*/ true); } return expr; } @@ -8955,7 +9841,8 @@ var ts; // 2) LeftHandSideExpression = AssignmentExpression[?in,?yield] // 3) LeftHandSideExpression AssignmentOperator AssignmentExpression[?in,?yield] // 4) ArrowFunctionExpression[?in,?yield] - // 5) [+Yield] YieldExpression[?In] + // 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). @@ -8963,11 +9850,18 @@ var ts; if (isYieldExpression()) { return parseYieldExpression(); } - // Then, check if we have an arrow function (production '4') that starts with a parenthesized - // parameter list. If we do, we must *not* recurse for productions 1, 2 or 3. An ArrowFunction is + // 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(); + var arrowExpression = tryParseParenthesizedArrowFunctionExpression() || tryParseAsyncSimpleArrowFunctionExpression(); if (arrowExpression) { return arrowExpression; } @@ -9001,7 +9895,7 @@ var ts; } function isYieldExpression() { if (token === 114 /* YieldKeyword */) { - // If we have a 'yield' keyword, and htis is a context where yield expressions are + // If we have a 'yield' keyword, and this is a context where yield expressions are // allowed, then definitely parse out a yield expression. if (inYieldContext()) { return true; @@ -9019,7 +9913,7 @@ var ts; // // 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 accidently consume something legal. + // don't accidentally consume something legal. return lookAhead(nextTokenIsIdentifierOrKeywordOrNumberOnSameLine); } return false; @@ -9029,7 +9923,7 @@ var ts; return !scanner.hasPrecedingLineBreak() && isIdentifier(); } function parseYieldExpression() { - var node = createNode(184 /* YieldExpression */); + var node = createNode(190 /* YieldExpression */); // YieldExpression[In] : // yield // yield [no LineTerminator here] [Lexical goal InputElementRegExp]AssignmentExpression[?In, Yield] @@ -9043,21 +9937,28 @@ var ts; } else { // if the next token is not on the same line as yield. or we don't have an '*' or - // the start of an expressin, then this is just a simple "yield" expression. + // the start of an expression, then this is just a simple "yield" expression. return finishNode(node); } } - function parseSimpleArrowFunctionExpression(identifier) { + function parseSimpleArrowFunctionExpression(identifier, asyncModifier) { ts.Debug.assert(token === 34 /* EqualsGreaterThanToken */, "parseSimpleArrowFunctionExpression should only have been called if we had a =>"); - var node = createNode(174 /* ArrowFunction */, identifier.pos); - var parameter = createNode(138 /* Parameter */, identifier.pos); + var node; + if (asyncModifier) { + node = createNode(180 /* ArrowFunction */, asyncModifier.pos); + setModifiers(node, asyncModifier); + } + else { + node = createNode(180 /* ArrowFunction */, identifier.pos); + } + var parameter = createNode(142 /* Parameter */, identifier.pos); parameter.name = identifier; finishNode(parameter); node.parameters = [parameter]; node.parameters.pos = parameter.pos; node.parameters.end = parameter.end; - node.equalsGreaterThanToken = parseExpectedToken(34 /* EqualsGreaterThanToken */, false, ts.Diagnostics._0_expected, "=>"); - node.body = parseArrowFunctionExpressionBody(/*isAsync*/ false); + node.equalsGreaterThanToken = parseExpectedToken(34 /* EqualsGreaterThanToken */, /*reportAtCurrentPosition*/ false, ts.Diagnostics._0_expected, "=>"); + node.body = parseArrowFunctionExpressionBody(/*isAsync*/ !!asyncModifier); return finishNode(node); } function tryParseParenthesizedArrowFunctionExpression() { @@ -9160,7 +10061,7 @@ var ts; return 1 /* True */; } // This *could* be a parenthesized arrow function. - // Return Unknown to const the caller know. + // Return Unknown to let the caller know. return 2 /* Unknown */; } else { @@ -9201,8 +10102,39 @@ var ts; function parsePossibleParenthesizedArrowFunctionExpressionHead() { return parseParenthesizedArrowFunctionExpressionHead(/*allowAmbiguity*/ false); } + function tryParseAsyncSimpleArrowFunctionExpression() { + // We do a check here so that we won't be doing unnecessarily call to "lookAhead" + if (token === 118 /* AsyncKeyword */) { + var isUnParenthesizedAsyncArrowFunction = lookAhead(isUnParenthesizedAsyncArrowFunctionWorker); + if (isUnParenthesizedAsyncArrowFunction === 1 /* True */) { + var asyncModifier = parseModifiersForArrowFunction(); + var expr = parseBinaryExpressionOrHigher(/*precedence*/ 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 === 118 /* AsyncKeyword */) { + nextToken(); + // If the "async" is followed by "=>" token then it is not a begining of an async arrow-function + // but instead a simple arrow-function which will be parsed inside "parseAssignmentExpressionOrHigher" + if (scanner.hasPrecedingLineBreak() || token === 34 /* EqualsGreaterThanToken */) { + return 0 /* False */; + } + // Check for un-parenthesized AsyncArrowFunction + var expr = parseBinaryExpressionOrHigher(/*precedence*/ 0); + if (!scanner.hasPrecedingLineBreak() && expr.kind === 69 /* Identifier */ && token === 34 /* EqualsGreaterThanToken */) { + return 1 /* True */; + } + } + return 0 /* False */; + } function parseParenthesizedArrowFunctionExpressionHead(allowAmbiguity) { - var node = createNode(174 /* ArrowFunction */); + var node = createNode(180 /* ArrowFunction */); setModifiers(node, parseModifiersForArrowFunction()); var isAsync = !!(node.flags & 256 /* Async */); // Arrow functions are never generators. @@ -9246,7 +10178,7 @@ var ts; // user meant to supply a block. For example, if the user wrote: // // a => - // const v = 0; + // let v = 0; // } // // they may be missing an open brace. Check to see if that's the case so we can @@ -9268,7 +10200,7 @@ var ts; } // Note: we explicitly 'allowIn' in the whenTrue part of the condition expression, and // we do not that for the 'whenFalse' part. - var node = createNode(182 /* ConditionalExpression */, leftOperand.pos); + var node = createNode(188 /* ConditionalExpression */, leftOperand.pos); node.condition = leftOperand; node.questionToken = questionToken; node.whenTrue = doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher); @@ -9281,7 +10213,7 @@ var ts; return parseBinaryExpressionRest(precedence, leftOperand); } function isInOrOfKeyword(t) { - return t === 90 /* InKeyword */ || t === 134 /* OfKeyword */; + return t === 90 /* InKeyword */ || t === 138 /* OfKeyword */; } function parseBinaryExpressionRest(precedence, leftOperand) { while (true) { @@ -9292,7 +10224,7 @@ var ts; // 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 precendence of the operator is greater then or equal to the current precendence. + // 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 @@ -9301,8 +10233,8 @@ var ts; // 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 precendence of - // the operator is strictly grater than the current precendence + // 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 @@ -9389,39 +10321,39 @@ var ts; return -1; } function makeBinaryExpression(left, operatorToken, right) { - var node = createNode(181 /* BinaryExpression */, left.pos); + var node = createNode(187 /* BinaryExpression */, left.pos); node.left = left; node.operatorToken = operatorToken; node.right = right; return finishNode(node); } function makeAsExpression(left, right) { - var node = createNode(189 /* AsExpression */, left.pos); + var node = createNode(195 /* AsExpression */, left.pos); node.expression = left; node.type = right; return finishNode(node); } function parsePrefixUnaryExpression() { - var node = createNode(179 /* PrefixUnaryExpression */); + var node = createNode(185 /* PrefixUnaryExpression */); node.operator = token; nextToken(); node.operand = parseSimpleUnaryExpression(); return finishNode(node); } function parseDeleteExpression() { - var node = createNode(175 /* DeleteExpression */); + var node = createNode(181 /* DeleteExpression */); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); } function parseTypeOfExpression() { - var node = createNode(176 /* TypeOfExpression */); + var node = createNode(182 /* TypeOfExpression */); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); } function parseVoidExpression() { - var node = createNode(177 /* VoidExpression */); + var node = createNode(183 /* VoidExpression */); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); @@ -9437,7 +10369,7 @@ var ts; return false; } function parseAwaitExpression() { - var node = createNode(178 /* AwaitExpression */); + var node = createNode(184 /* AwaitExpression */); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); @@ -9463,7 +10395,7 @@ var ts; var simpleUnaryExpression = parseSimpleUnaryExpression(); if (token === 38 /* AsteriskAsteriskToken */) { var start = ts.skipTrivia(sourceText, simpleUnaryExpression.pos); - if (simpleUnaryExpression.kind === 171 /* TypeAssertionExpression */) { + if (simpleUnaryExpression.kind === 177 /* TypeAssertionExpression */) { parseErrorAtPosition(start, simpleUnaryExpression.end - start, 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 { @@ -9519,7 +10451,7 @@ var ts; */ function isIncrementExpression() { // This function is called inside parseUnaryExpression to decide - // whether to call parseSimpleUnaryExpression or call parseIncrmentExpression directly + // whether to call parseSimpleUnaryExpression or call parseIncrementExpression directly switch (token) { case 35 /* PlusToken */: case 36 /* MinusToken */: @@ -9553,7 +10485,7 @@ var ts; */ function parseIncrementExpression() { if (token === 41 /* PlusPlusToken */ || token === 42 /* MinusMinusToken */) { - var node = createNode(179 /* PrefixUnaryExpression */); + var node = createNode(185 /* PrefixUnaryExpression */); node.operator = token; nextToken(); node.operand = parseLeftHandSideExpressionOrHigher(); @@ -9566,7 +10498,7 @@ var ts; var expression = parseLeftHandSideExpressionOrHigher(); ts.Debug.assert(ts.isLeftHandSideExpression(expression)); if ((token === 41 /* PlusPlusToken */ || token === 42 /* MinusMinusToken */) && !scanner.hasPrecedingLineBreak()) { - var node = createNode(180 /* PostfixUnaryExpression */, expression.pos); + var node = createNode(186 /* PostfixUnaryExpression */, expression.pos); node.operand = expression; node.operator = token; nextToken(); @@ -9670,24 +10602,37 @@ var ts; } // 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(166 /* PropertyAccessExpression */, expression.pos); + var node = createNode(172 /* PropertyAccessExpression */, expression.pos); node.expression = expression; node.dotToken = parseExpectedToken(21 /* DotToken */, /*reportAtCurrentPosition*/ false, ts.Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access); node.name = parseRightSideOfDot(/*allowIdentifierNames*/ true); return finishNode(node); } + function tagNamesAreEquivalent(lhs, rhs) { + if (lhs.kind !== rhs.kind) { + return false; + } + if (lhs.kind === 69 /* Identifier */) { + return lhs.text === rhs.text; + } + return lhs.right.text === rhs.right.text && + tagNamesAreEquivalent(lhs.left, rhs.left); + } function parseJsxElementOrSelfClosingElement(inExpressionContext) { var opening = parseJsxOpeningOrSelfClosingElement(inExpressionContext); var result; - if (opening.kind === 235 /* JsxOpeningElement */) { - var node = createNode(233 /* JsxElement */, opening.pos); + if (opening.kind === 243 /* JsxOpeningElement */) { + var node = createNode(241 /* JsxElement */, opening.pos); node.openingElement = opening; node.children = parseJsxChildren(node.openingElement.tagName); node.closingElement = parseJsxClosingElement(inExpressionContext); + if (!tagNamesAreEquivalent(node.openingElement.tagName, node.closingElement.tagName)) { + parseErrorAtPosition(node.closingElement.pos, node.closingElement.end - node.closingElement.pos, ts.Diagnostics.Expected_corresponding_JSX_closing_tag_for_0, ts.getTextOfNodeFromSourceText(sourceText, node.openingElement.tagName)); + } result = finishNode(node); } else { - ts.Debug.assert(opening.kind === 234 /* JsxSelfClosingElement */); + ts.Debug.assert(opening.kind === 242 /* JsxSelfClosingElement */); // Nothing else to do for self-closing elements result = opening; } @@ -9702,7 +10647,7 @@ var ts; var invalidElement = tryParse(function () { return parseJsxElementOrSelfClosingElement(/*inExpressionContext*/ true); }); if (invalidElement) { parseErrorAtCurrentToken(ts.Diagnostics.JSX_expressions_must_have_one_parent_element); - var badNode = createNode(181 /* BinaryExpression */, result.pos); + var badNode = createNode(187 /* BinaryExpression */, result.pos); badNode.end = invalidElement.end; badNode.left = result; badNode.right = invalidElement; @@ -9714,13 +10659,13 @@ var ts; return result; } function parseJsxText() { - var node = createNode(236 /* JsxText */, scanner.getStartPos()); + var node = createNode(244 /* JsxText */, scanner.getStartPos()); token = scanner.scanJsxToken(); return finishNode(node); } function parseJsxChild() { switch (token) { - case 236 /* JsxText */: + case 244 /* JsxText */: return parseJsxText(); case 15 /* OpenBraceToken */: return parseJsxExpression(/*inExpressionContext*/ false); @@ -9737,10 +10682,13 @@ var ts; while (true) { token = scanner.reScanJsxToken(); if (token === 26 /* LessThanSlashToken */) { + // Closing tag break; } else if (token === 1 /* EndOfFileToken */) { - parseErrorAtCurrentToken(ts.Diagnostics.Expected_corresponding_JSX_closing_tag_for_0, ts.getTextOfNodeFromSourceText(sourceText, openingTagName)); + // 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) + parseErrorAtPosition(openingTagName.pos, openingTagName.end - openingTagName.pos, ts.Diagnostics.JSX_element_0_has_no_corresponding_closing_tag, ts.getTextOfNodeFromSourceText(sourceText, openingTagName)); break; } result.push(parseJsxChild()); @@ -9759,7 +10707,7 @@ var ts; // 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(235 /* JsxOpeningElement */, fullStart); + node = createNode(243 /* JsxOpeningElement */, fullStart); scanJsxText(); } else { @@ -9768,10 +10716,10 @@ var ts; parseExpected(27 /* GreaterThanToken */); } else { - parseExpected(27 /* GreaterThanToken */, /*diagnostic*/ undefined, /*advance*/ false); + parseExpected(27 /* GreaterThanToken */, /*diagnostic*/ undefined, /*shouldAdvance*/ false); scanJsxText(); } - node = createNode(234 /* JsxSelfClosingElement */, fullStart); + node = createNode(242 /* JsxSelfClosingElement */, fullStart); } node.tagName = tagName; node.attributes = attributes; @@ -9782,7 +10730,7 @@ var ts; var elementName = parseIdentifierName(); while (parseOptional(21 /* DotToken */)) { scanJsxIdentifier(); - var node = createNode(135 /* QualifiedName */, elementName.pos); + var node = createNode(139 /* QualifiedName */, elementName.pos); // !!! node.left = elementName; node.right = parseIdentifierName(); elementName = finishNode(node); @@ -9790,16 +10738,16 @@ var ts; return elementName; } function parseJsxExpression(inExpressionContext) { - var node = createNode(240 /* JsxExpression */); + var node = createNode(248 /* JsxExpression */); parseExpected(15 /* OpenBraceToken */); if (token !== 16 /* CloseBraceToken */) { - node.expression = parseExpression(); + node.expression = parseAssignmentExpressionOrHigher(); } if (inExpressionContext) { parseExpected(16 /* CloseBraceToken */); } else { - parseExpected(16 /* CloseBraceToken */, /*message*/ undefined, /*advance*/ false); + parseExpected(16 /* CloseBraceToken */, /*message*/ undefined, /*shouldAdvance*/ false); scanJsxText(); } return finishNode(node); @@ -9809,7 +10757,7 @@ var ts; return parseJsxSpreadAttribute(); } scanJsxIdentifier(); - var node = createNode(238 /* JsxAttribute */); + var node = createNode(246 /* JsxAttribute */); node.name = parseIdentifierName(); if (parseOptional(56 /* EqualsToken */)) { switch (token) { @@ -9824,7 +10772,7 @@ var ts; return finishNode(node); } function parseJsxSpreadAttribute() { - var node = createNode(239 /* JsxSpreadAttribute */); + var node = createNode(247 /* JsxSpreadAttribute */); parseExpected(15 /* OpenBraceToken */); parseExpected(22 /* DotDotDotToken */); node.expression = parseExpression(); @@ -9832,20 +10780,20 @@ var ts; return finishNode(node); } function parseJsxClosingElement(inExpressionContext) { - var node = createNode(237 /* JsxClosingElement */); + var node = createNode(245 /* JsxClosingElement */); parseExpected(26 /* LessThanSlashToken */); node.tagName = parseJsxElementName(); if (inExpressionContext) { parseExpected(27 /* GreaterThanToken */); } else { - parseExpected(27 /* GreaterThanToken */, /*diagnostic*/ undefined, /*advance*/ false); + parseExpected(27 /* GreaterThanToken */, /*diagnostic*/ undefined, /*shouldAdvance*/ false); scanJsxText(); } return finishNode(node); } function parseTypeAssertion() { - var node = createNode(171 /* TypeAssertionExpression */); + var node = createNode(177 /* TypeAssertionExpression */); parseExpected(25 /* LessThanToken */); node.type = parseType(); parseExpected(27 /* GreaterThanToken */); @@ -9856,16 +10804,23 @@ var ts; while (true) { var dotToken = parseOptionalToken(21 /* DotToken */); if (dotToken) { - var propertyAccess = createNode(166 /* PropertyAccessExpression */, expression.pos); + var propertyAccess = createNode(172 /* PropertyAccessExpression */, expression.pos); propertyAccess.expression = expression; propertyAccess.dotToken = dotToken; propertyAccess.name = parseRightSideOfDot(/*allowIdentifierNames*/ true); expression = finishNode(propertyAccess); continue; } + if (token === 49 /* ExclamationToken */ && !scanner.hasPrecedingLineBreak()) { + nextToken(); + var nonNullExpression = createNode(196 /* NonNullExpression */, 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(19 /* OpenBracketToken */)) { - var indexedAccess = createNode(167 /* ElementAccessExpression */, expression.pos); + var indexedAccess = createNode(173 /* ElementAccessExpression */, expression.pos); indexedAccess.expression = expression; // It's not uncommon for a user to write: "new Type[]". // Check for that common pattern and report a better error message. @@ -9881,7 +10836,7 @@ var ts; continue; } if (token === 11 /* NoSubstitutionTemplateLiteral */ || token === 12 /* TemplateHead */) { - var tagExpression = createNode(170 /* TaggedTemplateExpression */, expression.pos); + var tagExpression = createNode(176 /* TaggedTemplateExpression */, expression.pos); tagExpression.tag = expression; tagExpression.template = token === 11 /* NoSubstitutionTemplateLiteral */ ? parseLiteralNode() @@ -9904,7 +10859,7 @@ var ts; if (!typeArguments) { return expression; } - var callExpr = createNode(168 /* CallExpression */, expression.pos); + var callExpr = createNode(174 /* CallExpression */, expression.pos); callExpr.expression = expression; callExpr.typeArguments = typeArguments; callExpr.arguments = parseArgumentList(); @@ -9912,7 +10867,7 @@ var ts; continue; } else if (token === 17 /* OpenParenToken */) { - var callExpr = createNode(168 /* CallExpression */, expression.pos); + var callExpr = createNode(174 /* CallExpression */, expression.pos); callExpr.expression = expression; callExpr.arguments = parseArgumentList(); expression = finishNode(callExpr); @@ -9936,7 +10891,7 @@ var ts; // If it doesn't have the closing > then it's definitely not an type argument list. return undefined; } - // If we have a '<', then only parse this as a arugment list if the type arguments + // 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 @@ -10022,41 +10977,42 @@ var ts; return parseIdentifier(ts.Diagnostics.Expression_expected); } function parseParenthesizedExpression() { - var node = createNode(172 /* ParenthesizedExpression */); + var node = createNode(178 /* ParenthesizedExpression */); parseExpected(17 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); parseExpected(18 /* CloseParenToken */); return finishNode(node); } function parseSpreadElement() { - var node = createNode(185 /* SpreadElementExpression */); + var node = createNode(191 /* SpreadElementExpression */); parseExpected(22 /* DotDotDotToken */); node.expression = parseAssignmentExpressionOrHigher(); return finishNode(node); } function parseArgumentOrArrayLiteralElement() { return token === 22 /* DotDotDotToken */ ? parseSpreadElement() : - token === 24 /* CommaToken */ ? createNode(187 /* OmittedExpression */) : + token === 24 /* CommaToken */ ? createNode(193 /* OmittedExpression */) : parseAssignmentExpressionOrHigher(); } function parseArgumentExpression() { return doOutsideOfContext(disallowInAndDecoratorContext, parseArgumentOrArrayLiteralElement); } function parseArrayLiteralExpression() { - var node = createNode(164 /* ArrayLiteralExpression */); + var node = createNode(170 /* ArrayLiteralExpression */); parseExpected(19 /* OpenBracketToken */); - if (scanner.hasPrecedingLineBreak()) - node.flags |= 1024 /* MultiLine */; + if (scanner.hasPrecedingLineBreak()) { + node.multiLine = true; + } node.elements = parseDelimitedList(15 /* ArrayLiteralMembers */, parseArgumentOrArrayLiteralElement); parseExpected(20 /* CloseBracketToken */); return finishNode(node); } function tryParseAccessorDeclaration(fullStart, decorators, modifiers) { if (parseContextualModifier(123 /* GetKeyword */)) { - return parseAccessorDeclaration(145 /* GetAccessor */, fullStart, decorators, modifiers); + return addJSDocComment(parseAccessorDeclaration(149 /* GetAccessor */, fullStart, decorators, modifiers)); } - else if (parseContextualModifier(129 /* SetKeyword */)) { - return parseAccessorDeclaration(146 /* SetAccessor */, fullStart, decorators, modifiers); + else if (parseContextualModifier(131 /* SetKeyword */)) { + return parseAccessorDeclaration(150 /* SetAccessor */, fullStart, decorators, modifiers); } return undefined; } @@ -10070,7 +11026,6 @@ var ts; } var asteriskToken = parseOptionalToken(37 /* AsteriskToken */); var tokenIsIdentifier = isIdentifier(); - var nameToken = token; var propertyName = parsePropertyName(); // Disallowing of optional property assignments happens in the grammar checker. var questionToken = parseOptionalToken(53 /* QuestionToken */); @@ -10084,7 +11039,7 @@ var ts; // this is necessary because ObjectLiteral productions are also used to cover grammar for ObjectAssignmentPattern var isShorthandPropertyAssignment = tokenIsIdentifier && (token === 24 /* CommaToken */ || token === 16 /* CloseBraceToken */ || token === 56 /* EqualsToken */); if (isShorthandPropertyAssignment) { - var shorthandDeclaration = createNode(246 /* ShorthandPropertyAssignment */, fullStart); + var shorthandDeclaration = createNode(254 /* ShorthandPropertyAssignment */, fullStart); shorthandDeclaration.name = propertyName; shorthandDeclaration.questionToken = questionToken; var equalsToken = parseOptionalToken(56 /* EqualsToken */); @@ -10092,24 +11047,25 @@ var ts; shorthandDeclaration.equalsToken = equalsToken; shorthandDeclaration.objectAssignmentInitializer = allowInAnd(parseAssignmentExpressionOrHigher); } - return finishNode(shorthandDeclaration); + return addJSDocComment(finishNode(shorthandDeclaration)); } else { - var propertyAssignment = createNode(245 /* PropertyAssignment */, fullStart); + var propertyAssignment = createNode(253 /* PropertyAssignment */, fullStart); + propertyAssignment.modifiers = modifiers; propertyAssignment.name = propertyName; propertyAssignment.questionToken = questionToken; parseExpected(54 /* ColonToken */); propertyAssignment.initializer = allowInAnd(parseAssignmentExpressionOrHigher); - return finishNode(propertyAssignment); + return addJSDocComment(finishNode(propertyAssignment)); } } function parseObjectLiteralExpression() { - var node = createNode(165 /* ObjectLiteralExpression */); + var node = createNode(171 /* ObjectLiteralExpression */); parseExpected(15 /* OpenBraceToken */); if (scanner.hasPrecedingLineBreak()) { - node.flags |= 1024 /* MultiLine */; + node.multiLine = true; } - node.properties = parseDelimitedList(12 /* ObjectLiteralMembers */, parseObjectLiteralElement, /*considerSemicolonAsDelimeter*/ true); + node.properties = parseDelimitedList(12 /* ObjectLiteralMembers */, parseObjectLiteralElement, /*considerSemicolonAsDelimiter*/ true); parseExpected(16 /* CloseBraceToken */); return finishNode(node); } @@ -10121,9 +11077,9 @@ var ts; // function BindingIdentifier[opt](FormalParameters){ FunctionBody } var saveDecoratorContext = inDecoratorContext(); if (saveDecoratorContext) { - setDecoratorContext(false); + setDecoratorContext(/*val*/ false); } - var node = createNode(173 /* FunctionExpression */); + var node = createNode(179 /* FunctionExpression */); setModifiers(node, parseModifiers()); parseExpected(87 /* FunctionKeyword */); node.asteriskToken = parseOptionalToken(37 /* AsteriskToken */); @@ -10137,15 +11093,15 @@ var ts; fillSignature(54 /* ColonToken */, /*yieldContext*/ isGenerator, /*awaitContext*/ isAsync, /*requireCompleteParameterList*/ false, node); node.body = parseFunctionBlock(/*allowYield*/ isGenerator, /*allowAwait*/ isAsync, /*ignoreMissingOpenBrace*/ false); if (saveDecoratorContext) { - setDecoratorContext(true); + setDecoratorContext(/*val*/ true); } - return finishNode(node); + return addJSDocComment(finishNode(node)); } function parseOptionalIdentifier() { return isIdentifier() ? parseIdentifier() : undefined; } function parseNewExpression() { - var node = createNode(169 /* NewExpression */); + var node = createNode(175 /* NewExpression */); parseExpected(92 /* NewKeyword */); node.expression = parseMemberExpressionOrHigher(); node.typeArguments = tryParse(parseTypeArgumentsInExpression); @@ -10156,7 +11112,7 @@ var ts; } // STATEMENTS function parseBlock(ignoreMissingOpenBrace, diagnosticMessage) { - var node = createNode(192 /* Block */); + var node = createNode(199 /* Block */); if (parseExpected(15 /* OpenBraceToken */, diagnosticMessage) || ignoreMissingOpenBrace) { node.statements = parseList(1 /* BlockStatements */, parseStatement); parseExpected(16 /* CloseBraceToken */); @@ -10175,23 +11131,23 @@ var ts; // arrow function. The body of the function is not in [Decorator] context. var saveDecoratorContext = inDecoratorContext(); if (saveDecoratorContext) { - setDecoratorContext(false); + setDecoratorContext(/*val*/ false); } var block = parseBlock(ignoreMissingOpenBrace, diagnosticMessage); if (saveDecoratorContext) { - setDecoratorContext(true); + setDecoratorContext(/*val*/ true); } setYieldContext(savedYieldContext); setAwaitContext(savedAwaitContext); return block; } function parseEmptyStatement() { - var node = createNode(194 /* EmptyStatement */); + var node = createNode(201 /* EmptyStatement */); parseExpected(23 /* SemicolonToken */); return finishNode(node); } function parseIfStatement() { - var node = createNode(196 /* IfStatement */); + var node = createNode(203 /* IfStatement */); parseExpected(88 /* IfKeyword */); parseExpected(17 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); @@ -10201,7 +11157,7 @@ var ts; return finishNode(node); } function parseDoStatement() { - var node = createNode(197 /* DoStatement */); + var node = createNode(204 /* DoStatement */); parseExpected(79 /* DoKeyword */); node.statement = parseStatement(); parseExpected(104 /* WhileKeyword */); @@ -10216,7 +11172,7 @@ var ts; return finishNode(node); } function parseWhileStatement() { - var node = createNode(198 /* WhileStatement */); + var node = createNode(205 /* WhileStatement */); parseExpected(104 /* WhileKeyword */); parseExpected(17 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); @@ -10239,21 +11195,21 @@ var ts; } var forOrForInOrForOfStatement; if (parseOptional(90 /* InKeyword */)) { - var forInStatement = createNode(200 /* ForInStatement */, pos); + var forInStatement = createNode(207 /* ForInStatement */, pos); forInStatement.initializer = initializer; forInStatement.expression = allowInAnd(parseExpression); parseExpected(18 /* CloseParenToken */); forOrForInOrForOfStatement = forInStatement; } - else if (parseOptional(134 /* OfKeyword */)) { - var forOfStatement = createNode(201 /* ForOfStatement */, pos); + else if (parseOptional(138 /* OfKeyword */)) { + var forOfStatement = createNode(208 /* ForOfStatement */, pos); forOfStatement.initializer = initializer; forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher); parseExpected(18 /* CloseParenToken */); forOrForInOrForOfStatement = forOfStatement; } else { - var forStatement = createNode(199 /* ForStatement */, pos); + var forStatement = createNode(206 /* ForStatement */, pos); forStatement.initializer = initializer; parseExpected(23 /* SemicolonToken */); if (token !== 23 /* SemicolonToken */ && token !== 18 /* CloseParenToken */) { @@ -10271,7 +11227,7 @@ var ts; } function parseBreakOrContinueStatement(kind) { var node = createNode(kind); - parseExpected(kind === 203 /* BreakStatement */ ? 70 /* BreakKeyword */ : 75 /* ContinueKeyword */); + parseExpected(kind === 210 /* BreakStatement */ ? 70 /* BreakKeyword */ : 75 /* ContinueKeyword */); if (!canParseSemicolon()) { node.label = parseIdentifier(); } @@ -10279,7 +11235,7 @@ var ts; return finishNode(node); } function parseReturnStatement() { - var node = createNode(204 /* ReturnStatement */); + var node = createNode(211 /* ReturnStatement */); parseExpected(94 /* ReturnKeyword */); if (!canParseSemicolon()) { node.expression = allowInAnd(parseExpression); @@ -10288,7 +11244,7 @@ var ts; return finishNode(node); } function parseWithStatement() { - var node = createNode(205 /* WithStatement */); + var node = createNode(212 /* WithStatement */); parseExpected(105 /* WithKeyword */); parseExpected(17 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); @@ -10297,7 +11253,7 @@ var ts; return finishNode(node); } function parseCaseClause() { - var node = createNode(241 /* CaseClause */); + var node = createNode(249 /* CaseClause */); parseExpected(71 /* CaseKeyword */); node.expression = allowInAnd(parseExpression); parseExpected(54 /* ColonToken */); @@ -10305,7 +11261,7 @@ var ts; return finishNode(node); } function parseDefaultClause() { - var node = createNode(242 /* DefaultClause */); + var node = createNode(250 /* DefaultClause */); parseExpected(77 /* DefaultKeyword */); parseExpected(54 /* ColonToken */); node.statements = parseList(3 /* SwitchClauseStatements */, parseStatement); @@ -10315,12 +11271,12 @@ var ts; return token === 71 /* CaseKeyword */ ? parseCaseClause() : parseDefaultClause(); } function parseSwitchStatement() { - var node = createNode(206 /* SwitchStatement */); + var node = createNode(213 /* SwitchStatement */); parseExpected(96 /* SwitchKeyword */); parseExpected(17 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); parseExpected(18 /* CloseParenToken */); - var caseBlock = createNode(220 /* CaseBlock */, scanner.getStartPos()); + var caseBlock = createNode(227 /* CaseBlock */, scanner.getStartPos()); parseExpected(15 /* OpenBraceToken */); caseBlock.clauses = parseList(2 /* SwitchClauses */, parseCaseOrDefaultClause); parseExpected(16 /* CloseBraceToken */); @@ -10335,7 +11291,7 @@ var ts; // directly as that might consume an expression on the following line. // We just return 'undefined' in that case. The actual error will be reported in the // grammar walker. - var node = createNode(208 /* ThrowStatement */); + var node = createNode(215 /* ThrowStatement */); parseExpected(98 /* ThrowKeyword */); node.expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression); parseSemicolon(); @@ -10343,7 +11299,7 @@ var ts; } // TODO: Review for error recovery function parseTryStatement() { - var node = createNode(209 /* TryStatement */); + var node = createNode(216 /* TryStatement */); parseExpected(100 /* TryKeyword */); node.tryBlock = parseBlock(/*ignoreMissingOpenBrace*/ false); node.catchClause = token === 72 /* CatchKeyword */ ? parseCatchClause() : undefined; @@ -10356,7 +11312,7 @@ var ts; return finishNode(node); } function parseCatchClause() { - var result = createNode(244 /* CatchClause */); + var result = createNode(252 /* CatchClause */); parseExpected(72 /* CatchKeyword */); if (parseExpected(17 /* OpenParenToken */)) { result.variableDeclaration = parseVariableDeclaration(); @@ -10366,7 +11322,7 @@ var ts; return finishNode(result); } function parseDebuggerStatement() { - var node = createNode(210 /* DebuggerStatement */); + var node = createNode(217 /* DebuggerStatement */); parseExpected(76 /* DebuggerKeyword */); parseSemicolon(); return finishNode(node); @@ -10378,16 +11334,16 @@ var ts; var fullStart = scanner.getStartPos(); var expression = allowInAnd(parseExpression); if (expression.kind === 69 /* Identifier */ && parseOptional(54 /* ColonToken */)) { - var labeledStatement = createNode(207 /* LabeledStatement */, fullStart); + var labeledStatement = createNode(214 /* LabeledStatement */, fullStart); labeledStatement.label = expression; labeledStatement.statement = parseStatement(); - return finishNode(labeledStatement); + return addJSDocComment(finishNode(labeledStatement)); } else { - var expressionStatement = createNode(195 /* ExpressionStatement */, fullStart); + var expressionStatement = createNode(202 /* ExpressionStatement */, fullStart); expressionStatement.expression = expression; parseSemicolon(); - return finishNode(expressionStatement); + return addJSDocComment(finishNode(expressionStatement)); } } function nextTokenIsIdentifierOrKeywordOnSameLine() { @@ -10434,7 +11390,7 @@ var ts; // // could be legal, it would add complexity for very little gain. case 107 /* InterfaceKeyword */: - case 132 /* TypeKeyword */: + case 134 /* TypeKeyword */: return nextTokenIsIdentifierOnSameLine(); case 125 /* ModuleKeyword */: case 126 /* NamespaceKeyword */: @@ -10445,12 +11401,16 @@ var ts; case 110 /* PrivateKeyword */: case 111 /* ProtectedKeyword */: case 112 /* PublicKeyword */: + case 128 /* ReadonlyKeyword */: nextToken(); // ASI takes effect for this modifier. if (scanner.hasPrecedingLineBreak()) { return false; } continue; + case 137 /* GlobalKeyword */: + nextToken(); + return token === 15 /* OpenBraceToken */ || token === 69 /* Identifier */ || token === 82 /* ExportKeyword */; case 89 /* ImportKeyword */: nextToken(); return token === 9 /* StringLiteral */ || token === 37 /* AsteriskToken */ || @@ -10458,7 +11418,8 @@ var ts; case 82 /* ExportKeyword */: nextToken(); if (token === 56 /* EqualsToken */ || token === 37 /* AsteriskToken */ || - token === 15 /* OpenBraceToken */ || token === 77 /* DefaultKeyword */) { + token === 15 /* OpenBraceToken */ || token === 77 /* DefaultKeyword */ || + token === 116 /* AsKeyword */) { return true; } continue; @@ -10509,13 +11470,15 @@ var ts; case 107 /* InterfaceKeyword */: case 125 /* ModuleKeyword */: case 126 /* NamespaceKeyword */: - case 132 /* TypeKeyword */: + case 134 /* TypeKeyword */: + case 137 /* GlobalKeyword */: // When these don't start a declaration, they're an identifier in an expression statement return true; case 112 /* PublicKeyword */: case 110 /* PrivateKeyword */: case 111 /* ProtectedKeyword */: case 113 /* StaticKeyword */: + case 128 /* ReadonlyKeyword */: // When these don't start a declaration, they may be the start of a class member if an identifier // immediately follows. Otherwise they're an identifier in an expression statement. return isStartOfDeclaration() || !lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine); @@ -10558,9 +11521,9 @@ var ts; case 86 /* ForKeyword */: return parseForOrForInOrForOfStatement(); case 75 /* ContinueKeyword */: - return parseBreakOrContinueStatement(202 /* ContinueStatement */); + return parseBreakOrContinueStatement(209 /* ContinueStatement */); case 70 /* BreakKeyword */: - return parseBreakOrContinueStatement(203 /* BreakStatement */); + return parseBreakOrContinueStatement(210 /* BreakStatement */); case 94 /* ReturnKeyword */: return parseReturnStatement(); case 105 /* WithKeyword */: @@ -10580,7 +11543,7 @@ var ts; return parseDeclaration(); case 118 /* AsyncKeyword */: case 107 /* InterfaceKeyword */: - case 132 /* TypeKeyword */: + case 134 /* TypeKeyword */: case 125 /* ModuleKeyword */: case 126 /* NamespaceKeyword */: case 122 /* DeclareKeyword */: @@ -10593,6 +11556,8 @@ var ts; case 112 /* PublicKeyword */: case 115 /* AbstractKeyword */: case 113 /* StaticKeyword */: + case 128 /* ReadonlyKeyword */: + case 137 /* GlobalKeyword */: if (isStartOfDeclaration()) { return parseDeclaration(); } @@ -10615,10 +11580,11 @@ var ts; return parseClassDeclaration(fullStart, decorators, modifiers); case 107 /* InterfaceKeyword */: return parseInterfaceDeclaration(fullStart, decorators, modifiers); - case 132 /* TypeKeyword */: + case 134 /* TypeKeyword */: return parseTypeAliasDeclaration(fullStart, decorators, modifiers); case 81 /* EnumKeyword */: return parseEnumDeclaration(fullStart, decorators, modifiers); + case 137 /* GlobalKeyword */: case 125 /* ModuleKeyword */: case 126 /* NamespaceKeyword */: return parseModuleDeclaration(fullStart, decorators, modifiers); @@ -10626,14 +11592,20 @@ var ts; return parseImportDeclarationOrImportEqualsDeclaration(fullStart, decorators, modifiers); case 82 /* ExportKeyword */: nextToken(); - return token === 77 /* DefaultKeyword */ || token === 56 /* EqualsToken */ ? - parseExportAssignment(fullStart, decorators, modifiers) : - parseExportDeclaration(fullStart, decorators, modifiers); + switch (token) { + case 77 /* DefaultKeyword */: + case 56 /* EqualsToken */: + return parseExportAssignment(fullStart, decorators, modifiers); + case 116 /* AsKeyword */: + return parseGlobalModuleExportDeclaration(fullStart, decorators, modifiers); + default: + return parseExportDeclaration(fullStart, decorators, modifiers); + } default: if (decorators || modifiers) { // We reached this point because we encountered decorators and/or modifiers and assumed a declaration // would follow. For recovery and error reporting purposes, return an incomplete declaration. - var node = createMissingNode(231 /* MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); + var node = createMissingNode(239 /* MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); node.pos = fullStart; node.decorators = decorators; setModifiers(node, modifiers); @@ -10655,16 +11627,16 @@ var ts; // DECLARATIONS function parseArrayBindingElement() { if (token === 24 /* CommaToken */) { - return createNode(187 /* OmittedExpression */); + return createNode(193 /* OmittedExpression */); } - var node = createNode(163 /* BindingElement */); + var node = createNode(169 /* BindingElement */); node.dotDotDotToken = parseOptionalToken(22 /* DotDotDotToken */); node.name = parseIdentifierOrPattern(); node.initializer = parseBindingElementInitializer(/*inParameter*/ false); return finishNode(node); } function parseObjectBindingElement() { - var node = createNode(163 /* BindingElement */); + var node = createNode(169 /* BindingElement */); var tokenIsIdentifier = isIdentifier(); var propertyName = parsePropertyName(); if (tokenIsIdentifier && token !== 54 /* ColonToken */) { @@ -10679,14 +11651,14 @@ var ts; return finishNode(node); } function parseObjectBindingPattern() { - var node = createNode(161 /* ObjectBindingPattern */); + var node = createNode(167 /* ObjectBindingPattern */); parseExpected(15 /* OpenBraceToken */); node.elements = parseDelimitedList(9 /* ObjectBindingElements */, parseObjectBindingElement); parseExpected(16 /* CloseBraceToken */); return finishNode(node); } function parseArrayBindingPattern() { - var node = createNode(162 /* ArrayBindingPattern */); + var node = createNode(168 /* ArrayBindingPattern */); parseExpected(19 /* OpenBracketToken */); node.elements = parseDelimitedList(10 /* ArrayBindingElements */, parseArrayBindingElement); parseExpected(20 /* CloseBracketToken */); @@ -10705,7 +11677,7 @@ var ts; return parseIdentifier(); } function parseVariableDeclaration() { - var node = createNode(211 /* VariableDeclaration */); + var node = createNode(218 /* VariableDeclaration */); node.name = parseIdentifierOrPattern(); node.type = parseTypeAnnotation(); if (!isInOrOfKeyword(token)) { @@ -10714,15 +11686,15 @@ var ts; return finishNode(node); } function parseVariableDeclarationList(inForStatementInitializer) { - var node = createNode(212 /* VariableDeclarationList */); + var node = createNode(219 /* VariableDeclarationList */); switch (token) { case 102 /* VarKeyword */: break; case 108 /* LetKeyword */: - node.flags |= 8192 /* Let */; + node.flags |= 1024 /* Let */; break; case 74 /* ConstKeyword */: - node.flags |= 16384 /* Const */; + node.flags |= 2048 /* Const */; break; default: ts.Debug.fail(); @@ -10737,7 +11709,7 @@ var ts; // So we need to look ahead to determine if 'of' should be treated as a keyword in // this context. // The checker will then give an error that there is an empty declaration list. - if (token === 134 /* OfKeyword */ && lookAhead(canFollowContextualOfKeyword)) { + if (token === 138 /* OfKeyword */ && lookAhead(canFollowContextualOfKeyword)) { node.declarations = createMissingList(); } else { @@ -10752,15 +11724,15 @@ var ts; return nextTokenIsIdentifier() && nextToken() === 18 /* CloseParenToken */; } function parseVariableStatement(fullStart, decorators, modifiers) { - var node = createNode(193 /* VariableStatement */, fullStart); + var node = createNode(200 /* VariableStatement */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.declarationList = parseVariableDeclarationList(/*inForStatementInitializer*/ false); parseSemicolon(); - return finishNode(node); + return addJSDocComment(finishNode(node)); } function parseFunctionDeclaration(fullStart, decorators, modifiers) { - var node = createNode(213 /* FunctionDeclaration */, fullStart); + var node = createNode(220 /* FunctionDeclaration */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(87 /* FunctionKeyword */); @@ -10770,19 +11742,19 @@ var ts; var isAsync = !!(node.flags & 256 /* Async */); fillSignature(54 /* ColonToken */, /*yieldContext*/ isGenerator, /*awaitContext*/ isAsync, /*requireCompleteParameterList*/ false, node); node.body = parseFunctionBlockOrSemicolon(isGenerator, isAsync, ts.Diagnostics.or_expected); - return finishNode(node); + return addJSDocComment(finishNode(node)); } function parseConstructorDeclaration(pos, decorators, modifiers) { - var node = createNode(144 /* Constructor */, pos); + var node = createNode(148 /* Constructor */, pos); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(121 /* ConstructorKeyword */); fillSignature(54 /* ColonToken */, /*yieldContext*/ false, /*awaitContext*/ false, /*requireCompleteParameterList*/ false, node); node.body = parseFunctionBlockOrSemicolon(/*isGenerator*/ false, /*isAsync*/ false, ts.Diagnostics.or_expected); - return finishNode(node); + return addJSDocComment(finishNode(node)); } function parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, name, questionToken, diagnosticMessage) { - var method = createNode(143 /* MethodDeclaration */, fullStart); + var method = createNode(147 /* MethodDeclaration */, fullStart); method.decorators = decorators; setModifiers(method, modifiers); method.asteriskToken = asteriskToken; @@ -10792,10 +11764,10 @@ var ts; var isAsync = !!(method.flags & 256 /* Async */); fillSignature(54 /* ColonToken */, /*yieldContext*/ isGenerator, /*awaitContext*/ isAsync, /*requireCompleteParameterList*/ false, method); method.body = parseFunctionBlockOrSemicolon(isGenerator, isAsync, diagnosticMessage); - return finishNode(method); + return addJSDocComment(finishNode(method)); } function parsePropertyDeclaration(fullStart, decorators, modifiers, name, questionToken) { - var property = createNode(141 /* PropertyDeclaration */, fullStart); + var property = createNode(145 /* PropertyDeclaration */, fullStart); property.decorators = decorators; setModifiers(property, modifiers); property.name = name; @@ -10806,13 +11778,13 @@ var ts; // off. The grammar would look something like this: // // MemberVariableDeclaration[Yield]: - // AccessibilityModifier_opt PropertyName TypeAnnotation_opt Initialiser_opt[In]; - // AccessibilityModifier_opt static_opt PropertyName TypeAnnotation_opt Initialiser_opt[In, ?Yield]; + // AccessibilityModifier_opt PropertyName TypeAnnotation_opt Initializer_opt[In]; + // AccessibilityModifier_opt static_opt PropertyName TypeAnnotation_opt Initializer_opt[In, ?Yield]; // // The checker may still error in the static case to explicitly disallow the yield expression. - property.initializer = modifiers && modifiers.flags & 64 /* Static */ + property.initializer = modifiers && modifiers.flags & 32 /* Static */ ? allowInAnd(parseNonParameterInitializer) - : doOutsideOfContext(2 /* Yield */ | 1 /* DisallowIn */, parseNonParameterInitializer); + : doOutsideOfContext(8388608 /* YieldContext */ | 4194304 /* DisallowInContext */, parseNonParameterInitializer); parseSemicolon(); return finishNode(property); } @@ -10847,6 +11819,7 @@ var ts; case 110 /* PrivateKeyword */: case 111 /* ProtectedKeyword */: case 113 /* StaticKeyword */: + case 128 /* ReadonlyKeyword */: return true; default: return false; @@ -10858,7 +11831,7 @@ var ts; return true; } // Eat up all modifiers, but hold on to the last one in case it is actually an identifier. - while (ts.isModifier(token)) { + while (ts.isModifierKind(token)) { idToken = token; // If the idToken is a class modifier (protected, private, public, and static), it is // certain that we are starting to parse class member. This allows better error recovery @@ -10887,7 +11860,7 @@ var ts; // If we were able to get any potential identifier... if (idToken !== undefined) { // If we have a non-keyword identifier, or if we have an accessor, then it's safe to parse. - if (!ts.isKeyword(idToken) || idToken === 129 /* SetKeyword */ || idToken === 123 /* GetKeyword */) { + if (!ts.isKeyword(idToken) || idToken === 131 /* SetKeyword */ || idToken === 123 /* GetKeyword */) { return true; } // If it *is* a keyword, but not an accessor, check a little farther along @@ -10919,9 +11892,9 @@ var ts; } if (!decorators) { decorators = []; - decorators.pos = scanner.getStartPos(); + decorators.pos = decoratorStart; } - var decorator = createNode(139 /* Decorator */, decoratorStart); + var decorator = createNode(143 /* Decorator */, decoratorStart); decorator.expression = doInDecoratorContext(parseLeftHandSideExpressionOrHigher); decorators.push(finishNode(decorator)); } @@ -10930,14 +11903,30 @@ var ts; } return decorators; } - function parseModifiers() { + /* + * There are situations in which a modifier like 'const' will appear unexpectedly, such as on a class member. + * In those situations, if we are entirely sure that 'const' is not valid on its own (such as when ASI takes effect + * and turns it into a standalone declaration), then it is better to parse it and report an error later. + * + * In such situations, 'permitInvalidConstAsModifier' should be set to true. + */ + function parseModifiers(permitInvalidConstAsModifier) { var flags = 0; var modifiers; while (true) { var modifierStart = scanner.getStartPos(); var modifierKind = token; - if (!parseAnyContextualModifier()) { - break; + if (token === 74 /* ConstKeyword */ && permitInvalidConstAsModifier) { + // We need to ensure that any subsequent modifiers appear on the same line + // so that when 'const' is a standalone declaration, we don't issue an error. + if (!tryParse(nextTokenIsOnSameLineAndCanFollowModifier)) { + break; + } + } + else { + if (!parseAnyContextualModifier()) { + break; + } } if (!modifiers) { modifiers = []; @@ -10970,13 +11959,13 @@ var ts; } function parseClassElement() { if (token === 23 /* SemicolonToken */) { - var result = createNode(191 /* SemicolonClassElement */); + var result = createNode(198 /* SemicolonClassElement */); nextToken(); return finishNode(result); } var fullStart = getNodePos(); var decorators = parseDecorators(); - var modifiers = parseModifiers(); + var modifiers = parseModifiers(/*permitInvalidConstAsModifier*/ true); var accessor = tryParseAccessorDeclaration(fullStart, decorators, modifiers); if (accessor) { return accessor; @@ -11008,10 +11997,10 @@ var ts; return parseClassDeclarationOrExpression( /*fullStart*/ scanner.getStartPos(), /*decorators*/ undefined, - /*modifiers*/ undefined, 186 /* ClassExpression */); + /*modifiers*/ undefined, 192 /* ClassExpression */); } function parseClassDeclaration(fullStart, decorators, modifiers) { - return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 214 /* ClassDeclaration */); + return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 221 /* ClassDeclaration */); } function parseClassDeclarationOrExpression(fullStart, decorators, modifiers, kind) { var node = createNode(kind, fullStart); @@ -11036,8 +12025,8 @@ var ts; // implements is a future reserved word so // 'class implements' might mean either // - class expression with omitted name, 'implements' starts heritage clause - // - class with name 'implements' - // 'isImplementsClause' helps to disambiguate between these two cases + // - class with name 'implements' + // 'isImplementsClause' helps to disambiguate between these two cases return isIdentifier() && !isImplementsClause() ? parseIdentifier() : undefined; @@ -11053,12 +12042,9 @@ var ts; } return undefined; } - function parseHeritageClausesWorker() { - return parseList(20 /* HeritageClauses */, parseHeritageClause); - } function parseHeritageClause() { if (token === 83 /* ExtendsKeyword */ || token === 106 /* ImplementsKeyword */) { - var node = createNode(243 /* HeritageClause */); + var node = createNode(251 /* HeritageClause */); node.token = token; nextToken(); node.types = parseDelimitedList(7 /* HeritageClauseElement */, parseExpressionWithTypeArguments); @@ -11067,7 +12053,7 @@ var ts; return undefined; } function parseExpressionWithTypeArguments() { - var node = createNode(188 /* ExpressionWithTypeArguments */); + var node = createNode(194 /* ExpressionWithTypeArguments */); node.expression = parseLeftHandSideExpressionOrHigher(); if (token === 25 /* LessThanToken */) { node.typeArguments = parseBracketedList(18 /* TypeArguments */, parseType, 25 /* LessThanToken */, 27 /* GreaterThanToken */); @@ -11081,7 +12067,7 @@ var ts; return parseList(5 /* ClassMembers */, parseClassElement); } function parseInterfaceDeclaration(fullStart, decorators, modifiers) { - var node = createNode(215 /* InterfaceDeclaration */, fullStart); + var node = createNode(222 /* InterfaceDeclaration */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(107 /* InterfaceKeyword */); @@ -11092,10 +12078,10 @@ var ts; return finishNode(node); } function parseTypeAliasDeclaration(fullStart, decorators, modifiers) { - var node = createNode(216 /* TypeAliasDeclaration */, fullStart); + var node = createNode(223 /* TypeAliasDeclaration */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - parseExpected(132 /* TypeKeyword */); + parseExpected(134 /* TypeKeyword */); node.name = parseIdentifier(); node.typeParameters = parseTypeParameters(); parseExpected(56 /* EqualsToken */); @@ -11108,13 +12094,13 @@ var ts; // ConstantEnumMemberSection, which starts at the beginning of an enum declaration // or any time an integer literal initializer is encountered. function parseEnumMember() { - var node = createNode(247 /* EnumMember */, scanner.getStartPos()); + var node = createNode(255 /* EnumMember */, scanner.getStartPos()); node.name = parsePropertyName(); node.initializer = allowInAnd(parseNonParameterInitializer); return finishNode(node); } function parseEnumDeclaration(fullStart, decorators, modifiers) { - var node = createNode(217 /* EnumDeclaration */, fullStart); + var node = createNode(224 /* EnumDeclaration */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(81 /* EnumKeyword */); @@ -11129,7 +12115,7 @@ var ts; return finishNode(node); } function parseModuleBlock() { - var node = createNode(219 /* ModuleBlock */, scanner.getStartPos()); + var node = createNode(226 /* ModuleBlock */, scanner.getStartPos()); if (parseExpected(15 /* OpenBraceToken */)) { node.statements = parseList(1 /* BlockStatements */, parseStatement); parseExpected(16 /* CloseBraceToken */); @@ -11140,31 +12126,42 @@ var ts; return finishNode(node); } function parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags) { - var node = createNode(218 /* ModuleDeclaration */, fullStart); + var node = createNode(225 /* ModuleDeclaration */, fullStart); // If we are parsing a dotted namespace name, we want to // propagate the 'Namespace' flag across the names if set. - var namespaceFlag = flags & 65536 /* Namespace */; + var namespaceFlag = flags & 4096 /* Namespace */; node.decorators = decorators; setModifiers(node, modifiers); node.flags |= flags; node.name = parseIdentifier(); node.body = parseOptional(21 /* DotToken */) - ? parseModuleOrNamespaceDeclaration(getNodePos(), /*decorators*/ undefined, /*modifiers*/ undefined, 2 /* Export */ | namespaceFlag) + ? parseModuleOrNamespaceDeclaration(getNodePos(), /*decorators*/ undefined, /*modifiers*/ undefined, 1 /* Export */ | namespaceFlag) : parseModuleBlock(); return finishNode(node); } function parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers) { - var node = createNode(218 /* ModuleDeclaration */, fullStart); + var node = createNode(225 /* ModuleDeclaration */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - node.name = parseLiteralNode(/*internName*/ true); + if (token === 137 /* GlobalKeyword */) { + // parse 'global' as name of global scope augmentation + node.name = parseIdentifier(); + node.flags |= 131072 /* GlobalAugmentation */; + } + else { + node.name = parseLiteralNode(/*internName*/ true); + } node.body = parseModuleBlock(); return finishNode(node); } function parseModuleDeclaration(fullStart, decorators, modifiers) { var flags = modifiers ? modifiers.flags : 0; - if (parseOptional(126 /* NamespaceKeyword */)) { - flags |= 65536 /* Namespace */; + if (token === 137 /* GlobalKeyword */) { + // global augmentation + return parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers); + } + else if (parseOptional(126 /* NamespaceKeyword */)) { + flags |= 4096 /* Namespace */; } else { parseExpected(125 /* ModuleKeyword */); @@ -11175,7 +12172,7 @@ var ts; return parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags); } function isExternalModuleReference() { - return token === 127 /* RequireKeyword */ && + return token === 129 /* RequireKeyword */ && lookAhead(nextTokenIsOpenParen); } function nextTokenIsOpenParen() { @@ -11184,10 +12181,15 @@ var ts; function nextTokenIsSlash() { return nextToken() === 39 /* SlashToken */; } - function nextTokenIsCommaOrFromKeyword() { - nextToken(); - return token === 24 /* CommaToken */ || - token === 133 /* FromKeyword */; + function parseGlobalModuleExportDeclaration(fullStart, decorators, modifiers) { + var exportDeclaration = createNode(228 /* GlobalModuleExportDeclaration */, fullStart); + exportDeclaration.decorators = decorators; + exportDeclaration.modifiers = modifiers; + parseExpected(116 /* AsKeyword */); + parseExpected(126 /* NamespaceKeyword */); + exportDeclaration.name = parseIdentifier(); + parseExpected(23 /* SemicolonToken */); + return finishNode(exportDeclaration); } function parseImportDeclarationOrImportEqualsDeclaration(fullStart, decorators, modifiers) { parseExpected(89 /* ImportKeyword */); @@ -11195,11 +12197,11 @@ var ts; var identifier; if (isIdentifier()) { identifier = parseIdentifier(); - if (token !== 24 /* CommaToken */ && token !== 133 /* FromKeyword */) { + if (token !== 24 /* CommaToken */ && token !== 136 /* FromKeyword */) { // ImportEquals declaration of type: // import x = require("mod"); or // import x = M.x; - var importEqualsDeclaration = createNode(221 /* ImportEqualsDeclaration */, fullStart); + var importEqualsDeclaration = createNode(229 /* ImportEqualsDeclaration */, fullStart); importEqualsDeclaration.decorators = decorators; setModifiers(importEqualsDeclaration, modifiers); importEqualsDeclaration.name = identifier; @@ -11210,7 +12212,7 @@ var ts; } } // Import statement - var importDeclaration = createNode(222 /* ImportDeclaration */, fullStart); + var importDeclaration = createNode(230 /* ImportDeclaration */, fullStart); importDeclaration.decorators = decorators; setModifiers(importDeclaration, modifiers); // ImportDeclaration: @@ -11220,7 +12222,7 @@ var ts; token === 37 /* AsteriskToken */ || token === 15 /* OpenBraceToken */) { importDeclaration.importClause = parseImportClause(identifier, afterImportPos); - parseExpected(133 /* FromKeyword */); + parseExpected(136 /* FromKeyword */); } importDeclaration.moduleSpecifier = parseModuleSpecifier(); parseSemicolon(); @@ -11233,7 +12235,7 @@ var ts; // NamedImports // ImportedDefaultBinding, NameSpaceImport // ImportedDefaultBinding, NamedImports - var importClause = createNode(223 /* ImportClause */, fullStart); + var importClause = createNode(231 /* ImportClause */, fullStart); if (identifier) { // ImportedDefaultBinding: // ImportedBinding @@ -11243,7 +12245,7 @@ var ts; // parse namespace or named imports if (!importClause.name || parseOptional(24 /* CommaToken */)) { - importClause.namedBindings = token === 37 /* AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(225 /* NamedImports */); + importClause.namedBindings = token === 37 /* AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(233 /* NamedImports */); } return finishNode(importClause); } @@ -11253,29 +12255,30 @@ var ts; : parseEntityName(/*allowReservedWords*/ false); } function parseExternalModuleReference() { - var node = createNode(232 /* ExternalModuleReference */); - parseExpected(127 /* RequireKeyword */); + var node = createNode(240 /* ExternalModuleReference */); + parseExpected(129 /* RequireKeyword */); parseExpected(17 /* OpenParenToken */); node.expression = parseModuleSpecifier(); parseExpected(18 /* CloseParenToken */); return finishNode(node); } function parseModuleSpecifier() { - // We allow arbitrary expressions here, even though the grammar only allows string - // literals. We check to ensure that it is only a string literal later in the grammar - // walker. - var result = parseExpression(); - // Ensure the string being required is in our 'identifier' table. This will ensure - // that features like 'find refs' will look inside this file when search for its name. - if (result.kind === 9 /* StringLiteral */) { + if (token === 9 /* StringLiteral */) { + var result = parseLiteralNode(); internIdentifier(result.text); + return result; + } + else { + // We allow arbitrary expressions here, even though the grammar only allows string + // literals. We check to ensure that it is only a string literal later in the grammar + // check pass. + return parseExpression(); } - return result; } function parseNamespaceImport() { // NameSpaceImport: // * as ImportedBinding - var namespaceImport = createNode(224 /* NamespaceImport */); + var namespaceImport = createNode(232 /* NamespaceImport */); parseExpected(37 /* AsteriskToken */); parseExpected(116 /* AsKeyword */); namespaceImport.name = parseIdentifier(); @@ -11290,21 +12293,21 @@ var ts; // ImportsList: // ImportSpecifier // ImportsList, ImportSpecifier - node.elements = parseBracketedList(21 /* ImportOrExportSpecifiers */, kind === 225 /* NamedImports */ ? parseImportSpecifier : parseExportSpecifier, 15 /* OpenBraceToken */, 16 /* CloseBraceToken */); + node.elements = parseBracketedList(21 /* ImportOrExportSpecifiers */, kind === 233 /* NamedImports */ ? parseImportSpecifier : parseExportSpecifier, 15 /* OpenBraceToken */, 16 /* CloseBraceToken */); return finishNode(node); } function parseExportSpecifier() { - return parseImportOrExportSpecifier(230 /* ExportSpecifier */); + return parseImportOrExportSpecifier(238 /* ExportSpecifier */); } function parseImportSpecifier() { - return parseImportOrExportSpecifier(226 /* ImportSpecifier */); + return parseImportOrExportSpecifier(234 /* ImportSpecifier */); } function parseImportOrExportSpecifier(kind) { var node = createNode(kind); // ImportSpecifier: // BindingIdentifier // IdentifierName as BindingIdentifier - // ExportSpecififer: + // ExportSpecifier: // IdentifierName // IdentifierName as IdentifierName var checkIdentifierIsKeyword = ts.isKeyword(token) && !isIdentifier(); @@ -11322,27 +12325,27 @@ var ts; else { node.name = identifierName; } - if (kind === 226 /* ImportSpecifier */ && checkIdentifierIsKeyword) { + if (kind === 234 /* ImportSpecifier */ && checkIdentifierIsKeyword) { // Report error identifier expected parseErrorAtPosition(checkIdentifierStart, checkIdentifierEnd - checkIdentifierStart, ts.Diagnostics.Identifier_expected); } return finishNode(node); } function parseExportDeclaration(fullStart, decorators, modifiers) { - var node = createNode(228 /* ExportDeclaration */, fullStart); + var node = createNode(236 /* ExportDeclaration */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); if (parseOptional(37 /* AsteriskToken */)) { - parseExpected(133 /* FromKeyword */); + parseExpected(136 /* FromKeyword */); node.moduleSpecifier = parseModuleSpecifier(); } else { - node.exportClause = parseNamedImportsOrExports(229 /* NamedExports */); + node.exportClause = parseNamedImportsOrExports(237 /* NamedExports */); // It is not uncommon to accidentally omit the 'from' keyword. Additionally, in editing scenarios, // the 'from' keyword can be parsed as a named export when the export clause is unterminated (i.e. `export { from "moduleName";`) // If we don't have a 'from' keyword, see if we have a string literal such that ASI won't take effect. - if (token === 133 /* FromKeyword */ || (token === 9 /* StringLiteral */ && !scanner.hasPrecedingLineBreak())) { - parseExpected(133 /* FromKeyword */); + if (token === 136 /* FromKeyword */ || (token === 9 /* StringLiteral */ && !scanner.hasPrecedingLineBreak())) { + parseExpected(136 /* FromKeyword */); node.moduleSpecifier = parseModuleSpecifier(); } } @@ -11350,7 +12353,7 @@ var ts; return finishNode(node); } function parseExportAssignment(fullStart, decorators, modifiers) { - var node = createNode(227 /* ExportAssignment */, fullStart); + var node = createNode(235 /* ExportAssignment */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); if (parseOptional(56 /* EqualsToken */)) { @@ -11366,6 +12369,7 @@ var ts; function processReferenceComments(sourceFile) { var triviaScanner = ts.createScanner(sourceFile.languageVersion, /*skipTrivia*/ false, 0 /* Standard */, sourceText); var referencedFiles = []; + var typeReferenceDirectives = []; var amdDependencies = []; var amdModuleName; // Keep scanning all the leading trivia in the file until we get to something that @@ -11373,11 +12377,13 @@ var ts; // reference comment. while (true) { var kind = triviaScanner.scan(); - if (kind === 5 /* WhitespaceTrivia */ || kind === 4 /* NewLineTrivia */ || kind === 3 /* MultiLineCommentTrivia */) { - continue; - } if (kind !== 2 /* SingleLineCommentTrivia */) { - break; + if (ts.isTrivia(kind)) { + continue; + } + else { + break; + } } var range = { pos: triviaScanner.getTokenPos(), end: triviaScanner.getTextPos(), kind: triviaScanner.getToken() }; var comment = sourceText.substring(range.pos, range.end); @@ -11387,7 +12393,12 @@ var ts; sourceFile.hasNoDefaultLib = referencePathMatchResult.isNoDefaultLib; var diagnosticMessage = referencePathMatchResult.diagnosticMessage; if (fileReference) { - referencedFiles.push(fileReference); + if (referencePathMatchResult.isTypeReferenceDirective) { + typeReferenceDirectives.push(fileReference); + } + else { + referencedFiles.push(fileReference); + } } if (diagnosticMessage) { parseDiagnostics.push(ts.createFileDiagnostic(sourceFile, range.pos, range.end - range.pos, diagnosticMessage)); @@ -11417,16 +12428,17 @@ var ts; } } sourceFile.referencedFiles = referencedFiles; + sourceFile.typeReferenceDirectives = typeReferenceDirectives; sourceFile.amdDependencies = amdDependencies; sourceFile.moduleName = amdModuleName; } function setExternalModuleIndicator(sourceFile) { sourceFile.externalModuleIndicator = ts.forEach(sourceFile.statements, function (node) { - return node.flags & 2 /* Export */ - || node.kind === 221 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 232 /* ExternalModuleReference */ - || node.kind === 222 /* ImportDeclaration */ - || node.kind === 227 /* ExportAssignment */ - || node.kind === 228 /* ExportDeclaration */ + return node.flags & 1 /* Export */ + || node.kind === 229 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 240 /* ExternalModuleReference */ + || node.kind === 230 /* ImportDeclaration */ + || node.kind === 235 /* ExportAssignment */ + || node.kind === 236 /* ExportDeclaration */ ? node : undefined; }); @@ -11487,21 +12499,19 @@ var ts; } JSDocParser.isJSDocType = isJSDocType; function parseJSDocTypeExpressionForTests(content, start, length) { - initializeState("file.js", content, 2 /* Latest */, /*isJavaScriptFile*/ true, /*_syntaxCursor:*/ undefined); - var jsDocTypeExpression = parseJSDocTypeExpression(start, length); + initializeState("file.js", content, 2 /* Latest */, /*_syntaxCursor:*/ undefined, 1 /* JS */); + scanner.setText(content, start, length); + token = scanner.scan(); + var jsDocTypeExpression = parseJSDocTypeExpression(); var diagnostics = parseDiagnostics; clearState(); return jsDocTypeExpression ? { jsDocTypeExpression: jsDocTypeExpression, diagnostics: diagnostics } : undefined; } JSDocParser.parseJSDocTypeExpressionForTests = parseJSDocTypeExpressionForTests; - // Parses out a JSDoc type expression. The starting position should be right at the open - // curly in the type expression. Returns 'undefined' if it encounters any errors while parsing. + // Parses out a JSDoc type expression. /* @internal */ - function parseJSDocTypeExpression(start, length) { - scanner.setText(sourceText, start, length); - // Prime the first token for us to start processing. - token = nextToken(); - var result = createNode(249 /* JSDocTypeExpression */); + function parseJSDocTypeExpression() { + var result = createNode(257 /* JSDocTypeExpression */, scanner.getTokenPos()); parseExpected(15 /* OpenBraceToken */); result.type = parseJSDocTopLevelType(); parseExpected(16 /* CloseBraceToken */); @@ -11512,12 +12522,12 @@ var ts; function parseJSDocTopLevelType() { var type = parseJSDocType(); if (token === 47 /* BarToken */) { - var unionType = createNode(253 /* JSDocUnionType */, type.pos); + var unionType = createNode(261 /* JSDocUnionType */, type.pos); unionType.types = parseJSDocTypeList(type); type = finishNode(unionType); } if (token === 56 /* EqualsToken */) { - var optionalType = createNode(260 /* JSDocOptionalType */, type.pos); + var optionalType = createNode(268 /* JSDocOptionalType */, type.pos); nextToken(); optionalType.type = type; type = finishNode(optionalType); @@ -11528,20 +12538,20 @@ var ts; var type = parseBasicTypeExpression(); while (true) { if (token === 19 /* OpenBracketToken */) { - var arrayType = createNode(252 /* JSDocArrayType */, type.pos); + var arrayType = createNode(260 /* JSDocArrayType */, type.pos); arrayType.elementType = type; nextToken(); parseExpected(20 /* CloseBracketToken */); type = finishNode(arrayType); } else if (token === 53 /* QuestionToken */) { - var nullableType = createNode(255 /* JSDocNullableType */, type.pos); + var nullableType = createNode(263 /* JSDocNullableType */, type.pos); nullableType.type = type; nextToken(); type = finishNode(nullableType); } else if (token === 49 /* ExclamationToken */) { - var nonNullableType = createNode(256 /* JSDocNonNullableType */, type.pos); + var nonNullableType = createNode(264 /* JSDocNonNullableType */, type.pos); nonNullableType.type = type; nextToken(); type = finishNode(nonNullableType); @@ -11575,10 +12585,10 @@ var ts; case 97 /* ThisKeyword */: return parseJSDocThisType(); case 117 /* AnyKeyword */: - case 130 /* StringKeyword */: - case 128 /* NumberKeyword */: + case 132 /* StringKeyword */: + case 130 /* NumberKeyword */: case 120 /* BooleanKeyword */: - case 131 /* SymbolKeyword */: + case 133 /* SymbolKeyword */: case 103 /* VoidKeyword */: return parseTokenNode(); } @@ -11586,27 +12596,27 @@ var ts; return parseJSDocTypeReference(); } function parseJSDocThisType() { - var result = createNode(264 /* JSDocThisType */); + var result = createNode(272 /* JSDocThisType */); nextToken(); parseExpected(54 /* ColonToken */); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocConstructorType() { - var result = createNode(263 /* JSDocConstructorType */); + var result = createNode(271 /* JSDocConstructorType */); nextToken(); parseExpected(54 /* ColonToken */); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocVariadicType() { - var result = createNode(262 /* JSDocVariadicType */); + var result = createNode(270 /* JSDocVariadicType */); nextToken(); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocFunctionType() { - var result = createNode(261 /* JSDocFunctionType */); + var result = createNode(269 /* JSDocFunctionType */); nextToken(); parseExpected(17 /* OpenParenToken */); result.parameters = parseDelimitedList(22 /* JSDocFunctionParameters */, parseJSDocParameter); @@ -11619,26 +12629,28 @@ var ts; return finishNode(result); } function parseJSDocParameter() { - var parameter = createNode(138 /* Parameter */); + var parameter = createNode(142 /* Parameter */); parameter.type = parseJSDocType(); + if (parseOptional(56 /* EqualsToken */)) { + parameter.questionToken = createNode(56 /* EqualsToken */); + } return finishNode(parameter); } - function parseJSDocOptionalType(type) { - var result = createNode(260 /* JSDocOptionalType */, type.pos); - nextToken(); - result.type = type; - return finishNode(result); - } function parseJSDocTypeReference() { - var result = createNode(259 /* JSDocTypeReference */); + var result = createNode(267 /* JSDocTypeReference */); result.name = parseSimplePropertyName(); - while (parseOptional(21 /* DotToken */)) { - if (token === 25 /* LessThanToken */) { - result.typeArguments = parseTypeArguments(); - break; - } - else { - result.name = parseQualifiedName(result.name); + if (token === 25 /* LessThanToken */) { + result.typeArguments = parseTypeArguments(); + } + else { + while (parseOptional(21 /* DotToken */)) { + if (token === 25 /* LessThanToken */) { + result.typeArguments = parseTypeArguments(); + break; + } + else { + result.name = parseQualifiedName(result.name); + } } } return finishNode(result); @@ -11660,13 +12672,13 @@ var ts; } } function parseQualifiedName(left) { - var result = createNode(135 /* QualifiedName */, left.pos); + var result = createNode(139 /* QualifiedName */, left.pos); result.left = left; result.right = parseIdentifierName(); return finishNode(result); } function parseJSDocRecordType() { - var result = createNode(257 /* JSDocRecordType */); + var result = createNode(265 /* JSDocRecordType */); nextToken(); result.members = parseDelimitedList(24 /* JSDocRecordMembers */, parseJSDocRecordMember); checkForTrailingComma(result.members); @@ -11674,7 +12686,7 @@ var ts; return finishNode(result); } function parseJSDocRecordMember() { - var result = createNode(258 /* JSDocRecordMember */); + var result = createNode(266 /* JSDocRecordMember */); result.name = parseSimplePropertyName(); if (token === 54 /* ColonToken */) { nextToken(); @@ -11683,13 +12695,13 @@ var ts; return finishNode(result); } function parseJSDocNonNullableType() { - var result = createNode(256 /* JSDocNonNullableType */); + var result = createNode(264 /* JSDocNonNullableType */); nextToken(); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocTupleType() { - var result = createNode(254 /* JSDocTupleType */); + var result = createNode(262 /* JSDocTupleType */); nextToken(); result.types = parseDelimitedList(25 /* JSDocTupleTypes */, parseJSDocType); checkForTrailingComma(result.types); @@ -11703,7 +12715,7 @@ var ts; } } function parseJSDocUnionType() { - var result = createNode(253 /* JSDocUnionType */); + var result = createNode(261 /* JSDocUnionType */); nextToken(); result.types = parseJSDocTypeList(parseJSDocType()); parseExpected(18 /* CloseParenToken */); @@ -11721,7 +12733,7 @@ var ts; return types; } function parseJSDocAllType() { - var result = createNode(250 /* JSDocAllType */); + var result = createNode(258 /* JSDocAllType */); nextToken(); return finishNode(result); } @@ -11744,29 +12756,35 @@ var ts; token === 27 /* GreaterThanToken */ || token === 56 /* EqualsToken */ || token === 47 /* BarToken */) { - var result = createNode(251 /* JSDocUnknownType */, pos); + var result = createNode(259 /* JSDocUnknownType */, pos); return finishNode(result); } else { - var result = createNode(255 /* JSDocNullableType */, pos); + var result = createNode(263 /* JSDocNullableType */, pos); result.type = parseJSDocType(); return finishNode(result); } } function parseIsolatedJSDocComment(content, start, length) { - initializeState("file.js", content, 2 /* Latest */, /*isJavaScriptFile*/ true, /*_syntaxCursor:*/ undefined); - var jsDocComment = parseJSDocComment(/*parent:*/ undefined, start, length); + initializeState("file.js", content, 2 /* Latest */, /*_syntaxCursor:*/ undefined, 1 /* JS */); + sourceFile = { languageVariant: 0 /* Standard */, text: content }; + var jsDocComment = parseJSDocCommentWorker(start, length); var diagnostics = parseDiagnostics; clearState(); return jsDocComment ? { jsDocComment: jsDocComment, diagnostics: diagnostics } : undefined; } JSDocParser.parseIsolatedJSDocComment = parseIsolatedJSDocComment; function parseJSDocComment(parent, start, length) { + var saveToken = token; + var saveParseDiagnosticsLength = parseDiagnostics.length; + var saveParseErrorBeforeNextFinishedNode = parseErrorBeforeNextFinishedNode; var comment = parseJSDocCommentWorker(start, length); if (comment) { - fixupParentReferences(comment); comment.parent = parent; } + token = saveToken; + parseDiagnostics.length = saveParseDiagnosticsLength; + parseErrorBeforeNextFinishedNode = saveParseErrorBeforeNextFinishedNode; return comment; } JSDocParser.parseJSDocComment = parseJSDocComment; @@ -11779,77 +12797,75 @@ var ts; ts.Debug.assert(start <= end); ts.Debug.assert(end <= content.length); var tags; - var pos; - // NOTE(cyrusn): This is essentially a handwritten scanner for JSDocComments. I - // considered using an actual Scanner, but this would complicate things. The - // scanner would need to know it was in a Doc Comment. Otherwise, it would then - // produce comments *inside* the doc comment. In the end it was just easier to - // write a simple scanner rather than go that route. - if (length >= "/** */".length) { - if (content.charCodeAt(start) === 47 /* slash */ && - content.charCodeAt(start + 1) === 42 /* asterisk */ && - content.charCodeAt(start + 2) === 42 /* asterisk */ && - content.charCodeAt(start + 3) !== 42 /* asterisk */) { + var result; + // Check for /** (JSDoc opening part) + if (content.charCodeAt(start) === 47 /* slash */ && + content.charCodeAt(start + 1) === 42 /* asterisk */ && + content.charCodeAt(start + 2) === 42 /* asterisk */ && + content.charCodeAt(start + 3) !== 42 /* asterisk */) { + // + 3 for leading /**, - 5 in total for /** */ + scanner.scanRange(start + 3, length - 5, function () { // Initially we can parse out a tag. We also have seen a starting asterisk. // This is so that /** * @type */ doesn't parse. var canParseTag = true; var seenAsterisk = true; - for (pos = start + "/**".length; pos < end;) { - var ch = content.charCodeAt(pos); - pos++; - if (ch === 64 /* at */ && canParseTag) { - parseTag(); - // Once we parse out a tag, we cannot keep parsing out tags on this line. - canParseTag = false; - continue; - } - if (ts.isLineBreak(ch)) { - // After a line break, we can parse a tag, and we haven't seen as asterisk - // on the next line yet. - canParseTag = true; - seenAsterisk = false; - continue; - } - if (ts.isWhiteSpace(ch)) { - // Whitespace doesn't affect any of our parsing. - continue; - } - // Ignore the first asterisk on a line. - if (ch === 42 /* asterisk */) { - if (seenAsterisk) { - // If we've already seen an asterisk, then we can no longer parse a tag - // on this line. + nextJSDocToken(); + while (token !== 1 /* EndOfFileToken */) { + switch (token) { + case 55 /* AtToken */: + if (canParseTag) { + parseTag(); + } + // This will take us to the end of the line, so it's OK to parse a tag on the next pass through the loop + seenAsterisk = false; + break; + case 4 /* NewLineTrivia */: + // After a line break, we can parse a tag, and we haven't seen an asterisk on the next line yet + canParseTag = true; + seenAsterisk = false; + break; + case 37 /* AsteriskToken */: + if (seenAsterisk) { + // If we've already seen an asterisk, then we can no longer parse a tag on this line + canParseTag = false; + } + // Ignore the first asterisk on a line + seenAsterisk = true; + break; + case 69 /* Identifier */: + // Anything else is doc comment text. We can't do anything with it. Because it + // wasn't a tag, we can no longer parse a tag on this line until we hit the next + // line break. canParseTag = false; - } - seenAsterisk = true; - continue; + break; + case 1 /* EndOfFileToken */: + break; } - // Anything else is doc comment text. We can't do anything with it. Because it - // wasn't a tag, we can no longer parse a tag on this line until we hit the next - // line break. - canParseTag = false; + nextJSDocToken(); } - } + result = createJSDocComment(); + }); } - return createJSDocComment(); + return result; function createJSDocComment() { if (!tags) { return undefined; } - var result = createNode(265 /* JSDocComment */, start); + var result = createNode(273 /* JSDocComment */, start); result.tags = tags; return finishNode(result, end); } function skipWhitespace() { - while (pos < end && ts.isWhiteSpace(content.charCodeAt(pos))) { - pos++; + while (token === 5 /* WhitespaceTrivia */ || token === 4 /* NewLineTrivia */) { + nextJSDocToken(); } } function parseTag() { - ts.Debug.assert(content.charCodeAt(pos - 1) === 64 /* at */); - var atToken = createNode(55 /* AtToken */, pos - 1); - atToken.end = pos; - var tagName = scanIdentifier(); + ts.Debug.assert(token === 55 /* AtToken */); + var atToken = createNode(55 /* AtToken */, scanner.getTokenPos()); + atToken.end = scanner.getTextPos(); + nextJSDocToken(); + var tagName = parseJSDocIdentifierName(); if (!tagName) { return; } @@ -11873,10 +12889,10 @@ var ts; return undefined; } function handleUnknownTag(atToken, tagName) { - var result = createNode(266 /* JSDocTag */, atToken.pos); + var result = createNode(274 /* JSDocTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; - return finishNode(result, pos); + return finishNode(result); } function addTag(tag) { if (tag) { @@ -11889,12 +12905,10 @@ var ts; } } function tryParseTypeExpression() { - skipWhitespace(); - if (content.charCodeAt(pos) !== 123 /* openBrace */) { + if (token !== 15 /* OpenBraceToken */) { return undefined; } - var typeExpression = parseJSDocTypeExpression(pos, end - pos); - pos = typeExpression.end; + var typeExpression = parseJSDocTypeExpression(); return typeExpression; } function handleParamTag(atToken, tagName) { @@ -11902,17 +12916,22 @@ var ts; skipWhitespace(); var name; var isBracketed; - if (content.charCodeAt(pos) === 91 /* openBracket */) { - pos++; - skipWhitespace(); - name = scanIdentifier(); + // Looking for something like '[foo]' or 'foo' + if (parseOptionalToken(19 /* OpenBracketToken */)) { + name = parseJSDocIdentifierName(); isBracketed = true; + // May have an optional default, e.g. '[foo = 42]' + if (parseOptionalToken(56 /* EqualsToken */)) { + parseExpression(); + } + parseExpected(20 /* CloseBracketToken */); } - else { - name = scanIdentifier(); + else if (ts.tokenIsIdentifierOrKeyword(token)) { + name = parseJSDocIdentifierName(); } if (!name) { - parseErrorAtPosition(pos, 0, ts.Diagnostics.Identifier_expected); + parseErrorAtPosition(scanner.getStartPos(), 0, ts.Diagnostics.Identifier_expected); + return undefined; } var preName, postName; if (typeExpression) { @@ -11924,84 +12943,85 @@ var ts; if (!typeExpression) { typeExpression = tryParseTypeExpression(); } - var result = createNode(267 /* JSDocParameterTag */, atToken.pos); + var result = createNode(275 /* JSDocParameterTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.preParameterName = preName; result.typeExpression = typeExpression; result.postParameterName = postName; result.isBracketed = isBracketed; - return finishNode(result, pos); + return finishNode(result); } function handleReturnTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 268 /* JSDocReturnTag */; })) { - parseErrorAtPosition(tagName.pos, pos - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); + if (ts.forEach(tags, function (t) { return t.kind === 276 /* JSDocReturnTag */; })) { + parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } - var result = createNode(268 /* JSDocReturnTag */, atToken.pos); + var result = createNode(276 /* JSDocReturnTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); - return finishNode(result, pos); + return finishNode(result); } function handleTypeTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 269 /* JSDocTypeTag */; })) { - parseErrorAtPosition(tagName.pos, pos - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); + if (ts.forEach(tags, function (t) { return t.kind === 277 /* JSDocTypeTag */; })) { + parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } - var result = createNode(269 /* JSDocTypeTag */, atToken.pos); + var result = createNode(277 /* JSDocTypeTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); - return finishNode(result, pos); + return finishNode(result); } function handleTemplateTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 270 /* JSDocTemplateTag */; })) { - parseErrorAtPosition(tagName.pos, pos - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); + if (ts.forEach(tags, function (t) { return t.kind === 278 /* JSDocTemplateTag */; })) { + parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } + // Type parameter list looks like '@template T,U,V' var typeParameters = []; - typeParameters.pos = pos; + typeParameters.pos = scanner.getStartPos(); while (true) { - skipWhitespace(); - var startPos = pos; - var name_8 = scanIdentifier(); + var name_8 = parseJSDocIdentifierName(); if (!name_8) { - parseErrorAtPosition(startPos, 0, ts.Diagnostics.Identifier_expected); + parseErrorAtPosition(scanner.getStartPos(), 0, ts.Diagnostics.Identifier_expected); return undefined; } - var typeParameter = createNode(137 /* TypeParameter */, name_8.pos); + var typeParameter = createNode(141 /* TypeParameter */, name_8.pos); typeParameter.name = name_8; - finishNode(typeParameter, pos); + finishNode(typeParameter); typeParameters.push(typeParameter); - skipWhitespace(); - if (content.charCodeAt(pos) !== 44 /* comma */) { + if (token === 24 /* CommaToken */) { + nextJSDocToken(); + } + else { break; } - pos++; } - typeParameters.end = pos; - var result = createNode(270 /* JSDocTemplateTag */, atToken.pos); + var result = createNode(278 /* JSDocTemplateTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeParameters = typeParameters; - return finishNode(result, pos); + finishNode(result); + typeParameters.end = result.end; + return result; } - function scanIdentifier() { - var startPos = pos; - for (; pos < end; pos++) { - var ch = content.charCodeAt(pos); - if (pos === startPos && ts.isIdentifierStart(ch, 2 /* Latest */)) { - continue; - } - else if (pos > startPos && ts.isIdentifierPart(ch, 2 /* Latest */)) { - continue; - } - break; - } - if (startPos === pos) { + function nextJSDocToken() { + return token = scanner.scanJSDocToken(); + } + function parseJSDocIdentifierName() { + return createJSDocIdentifier(ts.tokenIsIdentifierOrKeyword(token)); + } + function createJSDocIdentifier(isIdentifier) { + if (!isIdentifier) { + parseErrorAtCurrentToken(ts.Diagnostics.Identifier_expected); return undefined; } - var result = createNode(69 /* Identifier */, startPos); - result.text = content.substring(startPos, pos); - return finishNode(result, pos); + var pos = scanner.getTokenPos(); + var end = scanner.getTextPos(); + var result = createNode(69 /* Identifier */, pos); + result.text = content.substring(pos, end); + finishNode(result, end); + nextJSDocToken(); + return result; } } JSDocParser.parseJSDocCommentWorker = parseJSDocCommentWorker; @@ -12019,10 +13039,10 @@ var ts; if (sourceFile.statements.length === 0) { // If we don't have any statements in the current source file, then there's no real // way to incrementally parse. So just do a full parse instead. - return Parser.parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, /*syntaxCursor*/ undefined, /*setNodeParents*/ true); + return Parser.parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, /*syntaxCursor*/ undefined, /*setParentNodes*/ true, sourceFile.scriptKind); } // Make sure we're not trying to incrementally update a source file more than once. Once - // we do an update the original source file is considered unusbale from that point onwards. + // we do an update the original source file is considered unusable from that point onwards. // // This is because we do incremental parsing in-place. i.e. we take nodes from the old // tree and give them new positions and parents. From that point on, trusting the old @@ -12075,7 +13095,7 @@ var ts; // inconsistent tree. Setting the parents on the new tree should be very fast. We // will immediately bail out of walking any subtrees when we can see that their parents // are already correct. - var result = Parser.parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, syntaxCursor, /* setParentNode */ true); + var result = Parser.parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, syntaxCursor, /*setParentNodes*/ true, sourceFile.scriptKind); return result; } IncrementalParser.updateSourceFile = updateSourceFile; @@ -12134,7 +13154,7 @@ var ts; // We have an element that intersects the change range in some way. It may have its // start, or its end (or both) in the changed range. We want to adjust any part // that intersects such that the final tree is in a consistent state. i.e. all - // chlidren have spans within the span of their parent, and all siblings are ordered + // children have spans within the span of their parent, and all siblings are ordered // properly. // We may need to update both the 'pos' and the 'end' of the element. // If the 'pos' is before the start of the change, then we don't need to touch it. @@ -12154,7 +13174,7 @@ var ts; // -------------------ZZZ----------------- // // In this case, any element that started in the 'X' range will keep its position. - // However any element htat started after that will have their pos adjusted to be + // However any element that started after that will have their pos adjusted to be // at the end of the new range. i.e. any node that started in the 'Y' range will // be adjusted to have their start at the end of the 'Z' range. // @@ -12178,7 +13198,7 @@ var ts; // -------------------ZZZ----------------- // // In this case, any element that ended in the 'X' range will keep its position. - // However any element htat ended after that will have their pos adjusted to be + // However any element that ended after that will have their pos adjusted to be // at the end of the new range. i.e. any node that ended in the 'Y' range will // be adjusted to have their end at the end of the 'Z' range. if (element.end >= changeRangeOldEnd) { @@ -12198,12 +13218,12 @@ var ts; } function checkNodePositions(node, aggressiveChecks) { if (aggressiveChecks) { - var pos = node.pos; + var pos_2 = node.pos; forEachChild(node, function (child) { - ts.Debug.assert(child.pos >= pos); - pos = child.end; + ts.Debug.assert(child.pos >= pos_2); + pos_2 = child.end; }); - ts.Debug.assert(pos <= node.end); + ts.Debug.assert(pos_2 <= node.end); } } function updateTokenPositionsAndMarkElements(sourceFile, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta, oldText, newText, aggressiveChecks) { @@ -12437,7 +13457,7 @@ var ts; if (position >= node.pos && position < node.end) { // Position was within this node. Keep searching deeper to find the node. forEachChild(node, visitNode, visitArray); - // don't procede any futher in the search. + // don't proceed any further in the search. return true; } // position wasn't in this node, have to keep searching. @@ -12491,34 +13511,20 @@ var ts; ModuleInstanceState[ModuleInstanceState["ConstEnumOnly"] = 2] = "ConstEnumOnly"; })(ts.ModuleInstanceState || (ts.ModuleInstanceState = {})); var ModuleInstanceState = ts.ModuleInstanceState; - var Reachability; - (function (Reachability) { - Reachability[Reachability["Unintialized"] = 1] = "Unintialized"; - Reachability[Reachability["Reachable"] = 2] = "Reachable"; - Reachability[Reachability["Unreachable"] = 4] = "Unreachable"; - Reachability[Reachability["ReportedUnreachable"] = 8] = "ReportedUnreachable"; - })(Reachability || (Reachability = {})); - function or(state1, state2) { - return (state1 | state2) & 2 /* Reachable */ - ? 2 /* Reachable */ - : (state1 & state2) & 8 /* ReportedUnreachable */ - ? 8 /* ReportedUnreachable */ - : 4 /* Unreachable */; - } function getModuleInstanceState(node) { // A module is uninstantiated if it contains only // 1. interface declarations, type alias declarations - if (node.kind === 215 /* InterfaceDeclaration */ || node.kind === 216 /* TypeAliasDeclaration */) { + if (node.kind === 222 /* InterfaceDeclaration */ || node.kind === 223 /* TypeAliasDeclaration */) { return 0 /* NonInstantiated */; } else if (ts.isConstEnumDeclaration(node)) { return 2 /* ConstEnumOnly */; } - else if ((node.kind === 222 /* ImportDeclaration */ || node.kind === 221 /* ImportEqualsDeclaration */) && !(node.flags & 2 /* Export */)) { + else if ((node.kind === 230 /* ImportDeclaration */ || node.kind === 229 /* ImportEqualsDeclaration */) && !(node.flags & 1 /* Export */)) { return 0 /* NonInstantiated */; } - else if (node.kind === 219 /* ModuleBlock */) { - var state = 0 /* NonInstantiated */; + else if (node.kind === 226 /* ModuleBlock */) { + var state_1 = 0 /* NonInstantiated */; ts.forEachChild(node, function (n) { switch (getModuleInstanceState(n)) { case 0 /* NonInstantiated */: @@ -12526,17 +13532,17 @@ var ts; return false; case 2 /* ConstEnumOnly */: // child is const enum only - record state and continue searching - state = 2 /* ConstEnumOnly */; + state_1 = 2 /* ConstEnumOnly */; return false; case 1 /* Instantiated */: // child is instantiated - record state and stop - state = 1 /* Instantiated */; + state_1 = 1 /* Instantiated */; return true; } }); - return state; + return state_1; } - else if (node.kind === 218 /* ModuleDeclaration */) { + else if (node.kind === 225 /* ModuleDeclaration */) { return getModuleInstanceState(node.body); } else { @@ -12575,6 +13581,7 @@ var ts; function createBinder() { var file; var options; + var languageVersion; var parent; var container; var blockScopeContainer; @@ -12582,10 +13589,19 @@ var ts; var seenThisKeyword; // state used by reachability checks var hasExplicitReturn; - var currentReachabilityState; - var labelStack; - var labelIndexMap; - var implicitLabels; + var currentFlow; + var currentBreakTarget; + var currentContinueTarget; + var currentTrueTarget; + var currentFalseTarget; + var preSwitchCaseFlow; + var activeLabels; + // state used for emit helpers + var hasClassExtends; + var hasAsyncFunctions; + var hasDecorators; + var hasParameterDecorators; + var hasJsxSpreadAttribute; // If this file is an external module, then it is automatically in strict-mode according to // ES6. If it is not an external module, then we'll determine if it is in strict mode or // not depending on if we see "use strict" in certain places (or if we hit a class/namespace). @@ -12593,26 +13609,41 @@ var ts; var symbolCount = 0; var Symbol; var classifiableNames; + var unreachableFlow = { flags: 1 /* Unreachable */ }; + var reportedUnreachableFlow = { flags: 1 /* Unreachable */ }; function bindSourceFile(f, opts) { file = f; options = opts; + languageVersion = ts.getEmitScriptTarget(options); inStrictMode = !!file.externalModuleIndicator; classifiableNames = {}; + symbolCount = 0; Symbol = ts.objectAllocator.getSymbolConstructor(); if (!file.locals) { bind(file); file.symbolCount = symbolCount; file.classifiableNames = classifiableNames; } + file = undefined; + options = undefined; + languageVersion = undefined; parent = undefined; container = undefined; blockScopeContainer = undefined; lastContainer = undefined; seenThisKeyword = false; hasExplicitReturn = false; - labelStack = undefined; - labelIndexMap = undefined; - implicitLabels = undefined; + currentFlow = undefined; + currentBreakTarget = undefined; + currentContinueTarget = undefined; + currentTrueTarget = undefined; + currentFalseTarget = undefined; + activeLabels = undefined; + hasClassExtends = false; + hasAsyncFunctions = false; + hasDecorators = false; + hasParameterDecorators = false; + hasJsxSpreadAttribute = false; } return bindSourceFile; function createSymbol(flags, name) { @@ -12632,20 +13663,25 @@ var ts; if (symbolFlags & 6240 /* HasMembers */ && !symbol.members) { symbol.members = {}; } - if (symbolFlags & 107455 /* Value */ && !symbol.valueDeclaration) { - symbol.valueDeclaration = node; + if (symbolFlags & 107455 /* Value */) { + var valueDeclaration = symbol.valueDeclaration; + if (!valueDeclaration || + (valueDeclaration.kind !== node.kind && valueDeclaration.kind === 225 /* ModuleDeclaration */)) { + // other kinds of value declarations take precedence over modules + symbol.valueDeclaration = node; + } } } // Should not be called on a declaration with a computed property name, // unless it is a well known Symbol. function getDeclarationName(node) { if (node.name) { - if (node.kind === 218 /* ModuleDeclaration */ && node.name.kind === 9 /* StringLiteral */) { - return "\"" + node.name.text + "\""; + if (ts.isAmbientModule(node)) { + return ts.isGlobalScopeAugmentation(node) ? "__global" : "\"" + node.name.text + "\""; } - if (node.name.kind === 136 /* ComputedPropertyName */) { + if (node.name.kind === 140 /* ComputedPropertyName */) { var nameExpression = node.name.expression; - // treat computed property names where expression is string/numeric literal as just string/numeric literal + // treat computed property names where expression is string/numeric literal as just string/numeric literal if (ts.isStringOrNumericLiteral(nameExpression.kind)) { return nameExpression.text; } @@ -12655,26 +13691,47 @@ var ts; return node.name.text; } switch (node.kind) { - case 144 /* Constructor */: + case 148 /* Constructor */: return "__constructor"; - case 152 /* FunctionType */: - case 147 /* CallSignature */: + case 156 /* FunctionType */: + case 151 /* CallSignature */: return "__call"; - case 153 /* ConstructorType */: - case 148 /* ConstructSignature */: + case 157 /* ConstructorType */: + case 152 /* ConstructSignature */: return "__new"; - case 149 /* IndexSignature */: + case 153 /* IndexSignature */: return "__index"; - case 228 /* ExportDeclaration */: + case 236 /* ExportDeclaration */: return "__export"; - case 227 /* ExportAssignment */: + case 235 /* ExportAssignment */: return node.isExportEquals ? "export=" : "default"; - case 181 /* BinaryExpression */: - // Binary expression case is for JS module 'module.exports = expr' - return "export="; - case 213 /* FunctionDeclaration */: - case 214 /* ClassDeclaration */: + case 187 /* BinaryExpression */: + switch (ts.getSpecialPropertyAssignmentKind(node)) { + case 2 /* ModuleExports */: + // module.exports = ... + return "export="; + case 1 /* ExportsProperty */: + case 4 /* ThisProperty */: + // exports.x = ... or this.y = ... + return node.left.name.text; + case 3 /* PrototypeProperty */: + // className.prototype.methodName = ... + return node.left.expression.name.text; + } + ts.Debug.fail("Unknown binary declaration kind"); + break; + case 220 /* FunctionDeclaration */: + case 221 /* ClassDeclaration */: return node.flags & 512 /* Default */ ? "default" : undefined; + case 269 /* JSDocFunctionType */: + return ts.isJSDocConstructSignature(node) ? "__new" : "__call"; + case 142 /* Parameter */: + // Parameters with names are handled at the top of this function. Parameters + // without names can only come from JSDocFunctionTypes. + ts.Debug.assert(node.parent.kind === 269 /* JSDocFunctionType */); + var functionType = node.parent; + var index = ts.indexOf(functionType.parameters, node); + return "p" + index; } } function getDisplayName(node) { @@ -12725,18 +13782,18 @@ var ts; } // Report errors every position with duplicate declaration // Report errors on previous encountered declarations - var message = symbol.flags & 2 /* BlockScopedVariable */ + var message_1 = symbol.flags & 2 /* BlockScopedVariable */ ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0; ts.forEach(symbol.declarations, function (declaration) { if (declaration.flags & 512 /* Default */) { - message = ts.Diagnostics.A_module_cannot_have_multiple_default_exports; + message_1 = ts.Diagnostics.A_module_cannot_have_multiple_default_exports; } }); ts.forEach(symbol.declarations, function (declaration) { - file.bindDiagnostics.push(ts.createDiagnosticForNode(declaration.name || declaration, message, getDisplayName(declaration))); + file.bindDiagnostics.push(ts.createDiagnosticForNode(declaration.name || declaration, message_1, getDisplayName(declaration))); }); - file.bindDiagnostics.push(ts.createDiagnosticForNode(node.name || node, message, getDisplayName(node))); + file.bindDiagnostics.push(ts.createDiagnosticForNode(node.name || node, message_1, getDisplayName(node))); symbol = createSymbol(0 /* None */, name); } } @@ -12748,9 +13805,9 @@ var ts; return symbol; } function declareModuleMember(node, symbolFlags, symbolExcludes) { - var hasExportModifier = ts.getCombinedNodeFlags(node) & 2 /* Export */; + var hasExportModifier = ts.getCombinedNodeFlags(node) & 1 /* Export */; if (symbolFlags & 8388608 /* Alias */) { - if (node.kind === 230 /* ExportSpecifier */ || (node.kind === 221 /* ImportEqualsDeclaration */ && hasExportModifier)) { + if (node.kind === 238 /* ExportSpecifier */ || (node.kind === 229 /* ImportEqualsDeclaration */ && hasExportModifier)) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); } else { @@ -12769,7 +13826,11 @@ var ts; // 2. When we checkIdentifier in the checker, we set its resolved symbol to the local symbol, // but return the export symbol (by calling getExportSymbolOfValueSymbolIfExported). That way // when the emitter comes back to it, it knows not to qualify the name if it was found in a containing scope. - if (hasExportModifier || container.flags & 131072 /* ExportContext */) { + // NOTE: Nested ambient modules always should go to to 'locals' table to prevent their automatic merge + // during global merging in the checker. Why? The only case when ambient module is permitted inside another module is module augmentation + // and this case is specially handled. Module augmentations should only be merged with original module definition + // and should never be merged directly with other augmentation, and the latter case would be possible if automatic merge is allowed. + if (!ts.isAmbientModule(node) && (hasExportModifier || container.flags & 8192 /* ExportContext */)) { var exportKind = (symbolFlags & 107455 /* Value */ ? 1048576 /* ExportValue */ : 0) | (symbolFlags & 793056 /* Type */ ? 2097152 /* ExportType */ : 0) | (symbolFlags & 1536 /* Namespace */ ? 4194304 /* ExportNamespace */ : 0); @@ -12787,7 +13848,7 @@ var ts; // the getLocalNameOfContainer function in the type checker to validate that the local name // used for a container is unique. function bindChildren(node) { - // Before we recurse into a node's chilren, we first save the existing parent, container + // Before we recurse into a node's children, we first save the existing parent, container // and block-container. Then after we pop out of processing the children, we restore // these saved values. var saveParent = parent; @@ -12810,7 +13871,7 @@ var ts; // Finally, if this is a block-container, then we clear out any existing .locals object // it may contain within it. This happens in incremental scenarios. Because we can be // reusing a node from a previous compilation, that node may have had 'locals' created - // for it. We must clear this so we don't accidently move any stale data forward from + // for it. We must clear this so we don't accidentally move any stale data forward from // a previous compilation. var containerFlags = getContainerFlags(node); if (containerFlags & 1 /* IsContainer */) { @@ -12824,46 +13885,70 @@ var ts; blockScopeContainer = node; blockScopeContainer.locals = undefined; } - var savedReachabilityState; - var savedLabelStack; - var savedLabels; - var savedImplicitLabels; var savedHasExplicitReturn; + var savedCurrentFlow; + var savedBreakTarget; + var savedContinueTarget; + var savedActiveLabels; var kind = node.kind; var flags = node.flags; // reset all reachability check related flags on node (for incremental scenarios) - flags &= ~1572864 /* ReachabilityCheckFlags */; - if (kind === 215 /* InterfaceDeclaration */) { + flags &= ~98304 /* ReachabilityCheckFlags */; + // reset all emit helper flags on node (for incremental scenarios) + flags &= ~3932160 /* EmitHelperFlags */; + if (kind === 222 /* InterfaceDeclaration */) { seenThisKeyword = false; } - var saveState = kind === 248 /* SourceFile */ || kind === 219 /* ModuleBlock */ || ts.isFunctionLikeKind(kind); + var saveState = kind === 256 /* SourceFile */ || kind === 226 /* ModuleBlock */ || ts.isFunctionLikeKind(kind); if (saveState) { - savedReachabilityState = currentReachabilityState; - savedLabelStack = labelStack; - savedLabels = labelIndexMap; - savedImplicitLabels = implicitLabels; savedHasExplicitReturn = hasExplicitReturn; - currentReachabilityState = 2 /* Reachable */; + savedCurrentFlow = currentFlow; + savedBreakTarget = currentBreakTarget; + savedContinueTarget = currentContinueTarget; + savedActiveLabels = activeLabels; hasExplicitReturn = false; - labelStack = labelIndexMap = implicitLabels = undefined; + currentFlow = { flags: 2 /* Start */ }; + currentBreakTarget = undefined; + currentContinueTarget = undefined; + activeLabels = undefined; + } + if (ts.isInJavaScriptFile(node) && node.jsDocComment) { + bind(node.jsDocComment); } bindReachableStatement(node); - if (currentReachabilityState === 2 /* Reachable */ && ts.isFunctionLikeKind(kind) && ts.nodeIsPresent(node.body)) { - flags |= 524288 /* HasImplicitReturn */; + if (!(currentFlow.flags & 1 /* Unreachable */) && ts.isFunctionLikeKind(kind) && ts.nodeIsPresent(node.body)) { + flags |= 32768 /* HasImplicitReturn */; if (hasExplicitReturn) { - flags |= 1048576 /* HasExplicitReturn */; + flags |= 65536 /* HasExplicitReturn */; } } - if (kind === 215 /* InterfaceDeclaration */) { - flags = seenThisKeyword ? flags | 262144 /* ContainsThis */ : flags & ~262144 /* ContainsThis */; + if (kind === 222 /* InterfaceDeclaration */) { + flags = seenThisKeyword ? flags | 16384 /* ContainsThis */ : flags & ~16384 /* ContainsThis */; + } + if (kind === 256 /* SourceFile */) { + if (hasClassExtends) { + flags |= 262144 /* HasClassExtends */; + } + if (hasDecorators) { + flags |= 524288 /* HasDecorators */; + } + if (hasParameterDecorators) { + flags |= 1048576 /* HasParamDecorators */; + } + if (hasAsyncFunctions) { + flags |= 2097152 /* HasAsyncFunctions */; + } + if (hasJsxSpreadAttribute) { + flags |= 1073741824 /* HasJsxSpreadAttribute */; + } } node.flags = flags; if (saveState) { hasExplicitReturn = savedHasExplicitReturn; - currentReachabilityState = savedReachabilityState; - labelStack = savedLabelStack; - labelIndexMap = savedLabels; - implicitLabels = savedImplicitLabels; + currentFlow = savedCurrentFlow; + currentBreakTarget = savedBreakTarget; + currentContinueTarget = savedContinueTarget; + activeLabels = savedActiveLabels; } container = saveContainer; parent = saveParent; @@ -12879,209 +13964,566 @@ var ts; return; } switch (node.kind) { - case 198 /* WhileStatement */: + case 205 /* WhileStatement */: bindWhileStatement(node); break; - case 197 /* DoStatement */: + case 204 /* DoStatement */: bindDoStatement(node); break; - case 199 /* ForStatement */: + case 206 /* ForStatement */: bindForStatement(node); break; - case 200 /* ForInStatement */: - case 201 /* ForOfStatement */: + case 207 /* ForInStatement */: + case 208 /* ForOfStatement */: bindForInOrForOfStatement(node); break; - case 196 /* IfStatement */: + case 203 /* IfStatement */: bindIfStatement(node); break; - case 204 /* ReturnStatement */: - case 208 /* ThrowStatement */: + case 211 /* ReturnStatement */: + case 215 /* ThrowStatement */: bindReturnOrThrow(node); break; - case 203 /* BreakStatement */: - case 202 /* ContinueStatement */: + case 210 /* BreakStatement */: + case 209 /* ContinueStatement */: bindBreakOrContinueStatement(node); break; - case 209 /* TryStatement */: + case 216 /* TryStatement */: bindTryStatement(node); break; - case 206 /* SwitchStatement */: + case 213 /* SwitchStatement */: bindSwitchStatement(node); break; - case 220 /* CaseBlock */: + case 227 /* CaseBlock */: bindCaseBlock(node); break; - case 207 /* LabeledStatement */: + case 214 /* LabeledStatement */: bindLabeledStatement(node); break; + case 185 /* PrefixUnaryExpression */: + bindPrefixUnaryExpressionFlow(node); + break; + case 187 /* BinaryExpression */: + bindBinaryExpressionFlow(node); + break; + case 181 /* DeleteExpression */: + bindDeleteExpressionFlow(node); + break; + case 188 /* ConditionalExpression */: + bindConditionalExpressionFlow(node); + break; + case 218 /* VariableDeclaration */: + bindVariableDeclarationFlow(node); + break; default: ts.forEachChild(node, bind); break; } } - function bindWhileStatement(n) { - var preWhileState = n.expression.kind === 84 /* FalseKeyword */ ? 4 /* Unreachable */ : currentReachabilityState; - var postWhileState = n.expression.kind === 99 /* TrueKeyword */ ? 4 /* Unreachable */ : currentReachabilityState; - // bind expressions (don't affect reachability) - bind(n.expression); - currentReachabilityState = preWhileState; - var postWhileLabel = pushImplicitLabel(); - bind(n.statement); - popImplicitLabel(postWhileLabel, postWhileState); + function isNarrowableReference(expr) { + return expr.kind === 69 /* Identifier */ || + expr.kind === 97 /* ThisKeyword */ || + expr.kind === 172 /* PropertyAccessExpression */ && isNarrowableReference(expr.expression); } - function bindDoStatement(n) { - var preDoState = currentReachabilityState; - var postDoLabel = pushImplicitLabel(); - bind(n.statement); - var postDoState = n.expression.kind === 99 /* TrueKeyword */ ? 4 /* Unreachable */ : preDoState; - popImplicitLabel(postDoLabel, postDoState); - // bind expressions (don't affect reachability) - bind(n.expression); - } - function bindForStatement(n) { - var preForState = currentReachabilityState; - var postForLabel = pushImplicitLabel(); - // bind expressions (don't affect reachability) - bind(n.initializer); - bind(n.condition); - bind(n.incrementor); - bind(n.statement); - // for statement is considered infinite when it condition is either omitted or is true keyword - // - for(..;;..) - // - for(..;true;..) - var isInfiniteLoop = (!n.condition || n.condition.kind === 99 /* TrueKeyword */); - var postForState = isInfiniteLoop ? 4 /* Unreachable */ : preForState; - popImplicitLabel(postForLabel, postForState); - } - function bindForInOrForOfStatement(n) { - var preStatementState = currentReachabilityState; - var postStatementLabel = pushImplicitLabel(); - // bind expressions (don't affect reachability) - bind(n.initializer); - bind(n.expression); - bind(n.statement); - popImplicitLabel(postStatementLabel, preStatementState); - } - function bindIfStatement(n) { - // denotes reachability state when entering 'thenStatement' part of the if statement: - // i.e. if condition is false then thenStatement is unreachable - var ifTrueState = n.expression.kind === 84 /* FalseKeyword */ ? 4 /* Unreachable */ : currentReachabilityState; - // denotes reachability state when entering 'elseStatement': - // i.e. if condition is true then elseStatement is unreachable - var ifFalseState = n.expression.kind === 99 /* TrueKeyword */ ? 4 /* Unreachable */ : currentReachabilityState; - currentReachabilityState = ifTrueState; - // bind expression (don't affect reachability) - bind(n.expression); - bind(n.thenStatement); - if (n.elseStatement) { - var preElseState = currentReachabilityState; - currentReachabilityState = ifFalseState; - bind(n.elseStatement); - currentReachabilityState = or(currentReachabilityState, preElseState); + function isNarrowingExpression(expr) { + switch (expr.kind) { + case 69 /* Identifier */: + case 97 /* ThisKeyword */: + case 172 /* PropertyAccessExpression */: + return isNarrowableReference(expr); + case 174 /* CallExpression */: + return true; + case 178 /* ParenthesizedExpression */: + return isNarrowingExpression(expr.expression); + case 187 /* BinaryExpression */: + return isNarrowingBinaryExpression(expr); + case 185 /* PrefixUnaryExpression */: + return expr.operator === 49 /* ExclamationToken */ && isNarrowingExpression(expr.operand); } - else { - currentReachabilityState = or(currentReachabilityState, ifFalseState); + return false; + } + function isNarrowingBinaryExpression(expr) { + switch (expr.operatorToken.kind) { + case 56 /* EqualsToken */: + return isNarrowableReference(expr.left); + case 30 /* EqualsEqualsToken */: + case 31 /* ExclamationEqualsToken */: + case 32 /* EqualsEqualsEqualsToken */: + case 33 /* ExclamationEqualsEqualsToken */: + if (isNarrowingExpression(expr.left) && (expr.right.kind === 93 /* NullKeyword */ || expr.right.kind === 69 /* Identifier */)) { + return true; + } + if (expr.left.kind === 182 /* TypeOfExpression */ && isNarrowingExpression(expr.left.expression) && expr.right.kind === 9 /* StringLiteral */) { + return true; + } + return false; + case 91 /* InstanceOfKeyword */: + return isNarrowingExpression(expr.left); + case 24 /* CommaToken */: + return isNarrowingExpression(expr.right); + } + return false; + } + function createBranchLabel() { + return { + flags: 4 /* BranchLabel */, + antecedents: undefined + }; + } + function createLoopLabel() { + return { + flags: 8 /* LoopLabel */, + antecedents: undefined + }; + } + function setFlowNodeReferenced(flow) { + // On first reference we set the Referenced flag, thereafter we set the Shared flag + flow.flags |= flow.flags & 128 /* Referenced */ ? 256 /* Shared */ : 128 /* Referenced */; + } + function addAntecedent(label, antecedent) { + if (!(antecedent.flags & 1 /* Unreachable */) && !ts.contains(label.antecedents, antecedent)) { + (label.antecedents || (label.antecedents = [])).push(antecedent); + setFlowNodeReferenced(antecedent); } } - function bindReturnOrThrow(n) { - // bind expression (don't affect reachability) - bind(n.expression); - if (n.kind === 204 /* ReturnStatement */) { - hasExplicitReturn = true; + function createFlowCondition(flags, antecedent, expression) { + if (antecedent.flags & 1 /* Unreachable */) { + return antecedent; } - currentReachabilityState = 4 /* Unreachable */; - } - function bindBreakOrContinueStatement(n) { - // call bind on label (don't affect reachability) - bind(n.label); - // for continue case touch label so it will be marked a used - var isValidJump = jumpToLabel(n.label, n.kind === 203 /* BreakStatement */ ? currentReachabilityState : 4 /* Unreachable */); - if (isValidJump) { - currentReachabilityState = 4 /* Unreachable */; + if (!expression) { + return flags & 32 /* TrueCondition */ ? antecedent : unreachableFlow; } + if (expression.kind === 99 /* TrueKeyword */ && flags & 64 /* FalseCondition */ || + expression.kind === 84 /* FalseKeyword */ && flags & 32 /* TrueCondition */) { + return unreachableFlow; + } + if (!isNarrowingExpression(expression)) { + return antecedent; + } + setFlowNodeReferenced(antecedent); + return { + flags: flags, + antecedent: antecedent, + expression: expression + }; } - function bindTryStatement(n) { - // catch\finally blocks has the same reachability as try block - var preTryState = currentReachabilityState; - bind(n.tryBlock); - var postTryState = currentReachabilityState; - currentReachabilityState = preTryState; - bind(n.catchClause); - var postCatchState = currentReachabilityState; - currentReachabilityState = preTryState; - bind(n.finallyBlock); - // post catch/finally state is reachable if - // - post try state is reachable - control flow can fall out of try block - // - post catch state is reachable - control flow can fall out of catch block - currentReachabilityState = or(postTryState, postCatchState); + function createFlowAssignment(antecedent, node) { + setFlowNodeReferenced(antecedent); + return { + flags: 16 /* Assignment */, + antecedent: antecedent, + node: node + }; } - function bindSwitchStatement(n) { - var preSwitchState = currentReachabilityState; - var postSwitchLabel = pushImplicitLabel(); - // bind expression (don't affect reachability) - bind(n.expression); - bind(n.caseBlock); - var hasDefault = ts.forEach(n.caseBlock.clauses, function (c) { return c.kind === 242 /* DefaultClause */; }); - // post switch state is unreachable if switch is exaustive (has a default case ) and does not have fallthrough from the last case - var postSwitchState = hasDefault && currentReachabilityState !== 2 /* Reachable */ ? 4 /* Unreachable */ : preSwitchState; - popImplicitLabel(postSwitchLabel, postSwitchState); + function finishFlowLabel(flow) { + var antecedents = flow.antecedents; + if (!antecedents) { + return unreachableFlow; + } + if (antecedents.length === 1) { + return antecedents[0]; + } + return flow; } - function bindCaseBlock(n) { - var startState = currentReachabilityState; - for (var _i = 0, _a = n.clauses; _i < _a.length; _i++) { - var clause = _a[_i]; - currentReachabilityState = startState; - bind(clause); - if (clause.statements.length && currentReachabilityState === 2 /* Reachable */ && options.noFallthroughCasesInSwitch) { - errorOnFirstToken(clause, ts.Diagnostics.Fallthrough_case_in_switch); + function isStatementCondition(node) { + var parent = node.parent; + switch (parent.kind) { + case 203 /* IfStatement */: + case 205 /* WhileStatement */: + case 204 /* DoStatement */: + return parent.expression === node; + case 206 /* ForStatement */: + case 188 /* ConditionalExpression */: + return parent.condition === node; + } + return false; + } + function isLogicalExpression(node) { + while (true) { + if (node.kind === 178 /* ParenthesizedExpression */) { + node = node.expression; + } + else if (node.kind === 185 /* PrefixUnaryExpression */ && node.operator === 49 /* ExclamationToken */) { + node = node.operand; + } + else { + return node.kind === 187 /* BinaryExpression */ && (node.operatorToken.kind === 51 /* AmpersandAmpersandToken */ || + node.operatorToken.kind === 52 /* BarBarToken */); } } } - function bindLabeledStatement(n) { - // call bind on label (don't affect reachability) - bind(n.label); - var ok = pushNamedLabel(n.label); - bind(n.statement); - if (ok) { - popNamedLabel(n.label, currentReachabilityState); + function isTopLevelLogicalExpression(node) { + while (node.parent.kind === 178 /* ParenthesizedExpression */ || + node.parent.kind === 185 /* PrefixUnaryExpression */ && + node.parent.operator === 49 /* ExclamationToken */) { + node = node.parent; + } + return !isStatementCondition(node) && !isLogicalExpression(node.parent); + } + function bindCondition(node, trueTarget, falseTarget) { + var saveTrueTarget = currentTrueTarget; + var saveFalseTarget = currentFalseTarget; + currentTrueTarget = trueTarget; + currentFalseTarget = falseTarget; + bind(node); + currentTrueTarget = saveTrueTarget; + currentFalseTarget = saveFalseTarget; + if (!node || !isLogicalExpression(node)) { + addAntecedent(trueTarget, createFlowCondition(32 /* TrueCondition */, currentFlow, node)); + addAntecedent(falseTarget, createFlowCondition(64 /* FalseCondition */, currentFlow, node)); + } + } + function bindIterativeStatement(node, breakTarget, continueTarget) { + var saveBreakTarget = currentBreakTarget; + var saveContinueTarget = currentContinueTarget; + currentBreakTarget = breakTarget; + currentContinueTarget = continueTarget; + bind(node); + currentBreakTarget = saveBreakTarget; + currentContinueTarget = saveContinueTarget; + } + function bindWhileStatement(node) { + var preWhileLabel = createLoopLabel(); + var preBodyLabel = createBranchLabel(); + var postWhileLabel = createBranchLabel(); + addAntecedent(preWhileLabel, currentFlow); + currentFlow = preWhileLabel; + bindCondition(node.expression, preBodyLabel, postWhileLabel); + currentFlow = finishFlowLabel(preBodyLabel); + bindIterativeStatement(node.statement, postWhileLabel, preWhileLabel); + addAntecedent(preWhileLabel, currentFlow); + currentFlow = finishFlowLabel(postWhileLabel); + } + function bindDoStatement(node) { + var preDoLabel = createLoopLabel(); + var preConditionLabel = createBranchLabel(); + var postDoLabel = createBranchLabel(); + addAntecedent(preDoLabel, currentFlow); + currentFlow = preDoLabel; + bindIterativeStatement(node.statement, postDoLabel, preConditionLabel); + addAntecedent(preConditionLabel, currentFlow); + currentFlow = finishFlowLabel(preConditionLabel); + bindCondition(node.expression, preDoLabel, postDoLabel); + currentFlow = finishFlowLabel(postDoLabel); + } + function bindForStatement(node) { + var preLoopLabel = createLoopLabel(); + var preBodyLabel = createBranchLabel(); + var postLoopLabel = createBranchLabel(); + bind(node.initializer); + addAntecedent(preLoopLabel, currentFlow); + currentFlow = preLoopLabel; + bindCondition(node.condition, preBodyLabel, postLoopLabel); + currentFlow = finishFlowLabel(preBodyLabel); + bindIterativeStatement(node.statement, postLoopLabel, preLoopLabel); + bind(node.incrementor); + addAntecedent(preLoopLabel, currentFlow); + currentFlow = finishFlowLabel(postLoopLabel); + } + function bindForInOrForOfStatement(node) { + var preLoopLabel = createLoopLabel(); + var postLoopLabel = createBranchLabel(); + addAntecedent(preLoopLabel, currentFlow); + currentFlow = preLoopLabel; + bind(node.expression); + addAntecedent(postLoopLabel, currentFlow); + bind(node.initializer); + if (node.initializer.kind !== 219 /* VariableDeclarationList */) { + bindAssignmentTargetFlow(node.initializer); + } + bindIterativeStatement(node.statement, postLoopLabel, preLoopLabel); + addAntecedent(preLoopLabel, currentFlow); + currentFlow = finishFlowLabel(postLoopLabel); + } + function bindIfStatement(node) { + var thenLabel = createBranchLabel(); + var elseLabel = createBranchLabel(); + var postIfLabel = createBranchLabel(); + bindCondition(node.expression, thenLabel, elseLabel); + currentFlow = finishFlowLabel(thenLabel); + bind(node.thenStatement); + addAntecedent(postIfLabel, currentFlow); + currentFlow = finishFlowLabel(elseLabel); + bind(node.elseStatement); + addAntecedent(postIfLabel, currentFlow); + currentFlow = finishFlowLabel(postIfLabel); + } + function bindReturnOrThrow(node) { + bind(node.expression); + if (node.kind === 211 /* ReturnStatement */) { + hasExplicitReturn = true; + } + currentFlow = unreachableFlow; + } + function findActiveLabel(name) { + if (activeLabels) { + for (var _i = 0, activeLabels_1 = activeLabels; _i < activeLabels_1.length; _i++) { + var label = activeLabels_1[_i]; + if (label.name === name) { + return label; + } + } + } + return undefined; + } + function bindbreakOrContinueFlow(node, breakTarget, continueTarget) { + var flowLabel = node.kind === 210 /* BreakStatement */ ? breakTarget : continueTarget; + if (flowLabel) { + addAntecedent(flowLabel, currentFlow); + currentFlow = unreachableFlow; + } + } + function bindBreakOrContinueStatement(node) { + bind(node.label); + if (node.label) { + var activeLabel = findActiveLabel(node.label.text); + if (activeLabel) { + activeLabel.referenced = true; + bindbreakOrContinueFlow(node, activeLabel.breakTarget, activeLabel.continueTarget); + } + } + else { + bindbreakOrContinueFlow(node, currentBreakTarget, currentContinueTarget); + } + } + function bindTryStatement(node) { + var postFinallyLabel = createBranchLabel(); + var preTryFlow = currentFlow; + // TODO: Every statement in try block is potentially an exit point! + bind(node.tryBlock); + addAntecedent(postFinallyLabel, currentFlow); + if (node.catchClause) { + currentFlow = preTryFlow; + bind(node.catchClause); + addAntecedent(postFinallyLabel, currentFlow); + } + if (node.finallyBlock) { + currentFlow = preTryFlow; + bind(node.finallyBlock); + } + currentFlow = finishFlowLabel(postFinallyLabel); + } + function bindSwitchStatement(node) { + var postSwitchLabel = createBranchLabel(); + bind(node.expression); + var saveBreakTarget = currentBreakTarget; + var savePreSwitchCaseFlow = preSwitchCaseFlow; + currentBreakTarget = postSwitchLabel; + preSwitchCaseFlow = currentFlow; + bind(node.caseBlock); + addAntecedent(postSwitchLabel, currentFlow); + var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 250 /* DefaultClause */; }); + if (!hasDefault) { + addAntecedent(postSwitchLabel, preSwitchCaseFlow); + } + currentBreakTarget = saveBreakTarget; + preSwitchCaseFlow = savePreSwitchCaseFlow; + currentFlow = finishFlowLabel(postSwitchLabel); + } + function bindCaseBlock(node) { + var clauses = node.clauses; + for (var i = 0; i < clauses.length; i++) { + var clause = clauses[i]; + if (clause.statements.length) { + if (currentFlow.flags & 1 /* Unreachable */) { + currentFlow = preSwitchCaseFlow; + } + else { + var preCaseLabel = createBranchLabel(); + addAntecedent(preCaseLabel, preSwitchCaseFlow); + addAntecedent(preCaseLabel, currentFlow); + currentFlow = finishFlowLabel(preCaseLabel); + } + bind(clause); + if (!(currentFlow.flags & 1 /* Unreachable */) && i !== clauses.length - 1 && options.noFallthroughCasesInSwitch) { + errorOnFirstToken(clause, ts.Diagnostics.Fallthrough_case_in_switch); + } + } + else { + bind(clause); + } + } + } + function pushActiveLabel(name, breakTarget, continueTarget) { + var activeLabel = { + name: name, + breakTarget: breakTarget, + continueTarget: continueTarget, + referenced: false + }; + (activeLabels || (activeLabels = [])).push(activeLabel); + return activeLabel; + } + function popActiveLabel() { + activeLabels.pop(); + } + function bindLabeledStatement(node) { + var preStatementLabel = createLoopLabel(); + var postStatementLabel = createBranchLabel(); + bind(node.label); + addAntecedent(preStatementLabel, currentFlow); + var activeLabel = pushActiveLabel(node.label.text, postStatementLabel, preStatementLabel); + bind(node.statement); + popActiveLabel(); + if (!activeLabel.referenced && !options.allowUnusedLabels) { + file.bindDiagnostics.push(ts.createDiagnosticForNode(node.label, ts.Diagnostics.Unused_label)); + } + addAntecedent(postStatementLabel, currentFlow); + currentFlow = finishFlowLabel(postStatementLabel); + } + function bindDestructuringTargetFlow(node) { + if (node.kind === 187 /* BinaryExpression */ && node.operatorToken.kind === 56 /* EqualsToken */) { + bindAssignmentTargetFlow(node.left); + } + else { + bindAssignmentTargetFlow(node); + } + } + function bindAssignmentTargetFlow(node) { + if (isNarrowableReference(node)) { + currentFlow = createFlowAssignment(currentFlow, node); + } + else if (node.kind === 170 /* ArrayLiteralExpression */) { + for (var _i = 0, _a = node.elements; _i < _a.length; _i++) { + var e = _a[_i]; + if (e.kind === 191 /* SpreadElementExpression */) { + bindAssignmentTargetFlow(e.expression); + } + else { + bindDestructuringTargetFlow(e); + } + } + } + else if (node.kind === 171 /* ObjectLiteralExpression */) { + for (var _b = 0, _c = node.properties; _b < _c.length; _b++) { + var p = _c[_b]; + if (p.kind === 253 /* PropertyAssignment */) { + bindDestructuringTargetFlow(p.initializer); + } + else if (p.kind === 254 /* ShorthandPropertyAssignment */) { + bindAssignmentTargetFlow(p.name); + } + } + } + } + function bindLogicalExpression(node, trueTarget, falseTarget) { + var preRightLabel = createBranchLabel(); + if (node.operatorToken.kind === 51 /* AmpersandAmpersandToken */) { + bindCondition(node.left, preRightLabel, falseTarget); + } + else { + bindCondition(node.left, trueTarget, preRightLabel); + } + currentFlow = finishFlowLabel(preRightLabel); + bind(node.operatorToken); + bindCondition(node.right, trueTarget, falseTarget); + } + function bindPrefixUnaryExpressionFlow(node) { + if (node.operator === 49 /* ExclamationToken */) { + var saveTrueTarget = currentTrueTarget; + currentTrueTarget = currentFalseTarget; + currentFalseTarget = saveTrueTarget; + ts.forEachChild(node, bind); + currentFalseTarget = currentTrueTarget; + currentTrueTarget = saveTrueTarget; + } + else { + ts.forEachChild(node, bind); + } + } + function bindBinaryExpressionFlow(node) { + var operator = node.operatorToken.kind; + if (operator === 51 /* AmpersandAmpersandToken */ || operator === 52 /* BarBarToken */) { + if (isTopLevelLogicalExpression(node)) { + var postExpressionLabel = createBranchLabel(); + bindLogicalExpression(node, postExpressionLabel, postExpressionLabel); + currentFlow = finishFlowLabel(postExpressionLabel); + } + else { + bindLogicalExpression(node, currentTrueTarget, currentFalseTarget); + } + } + else { + ts.forEachChild(node, bind); + if (operator === 56 /* EqualsToken */ && !ts.isAssignmentTarget(node)) { + bindAssignmentTargetFlow(node.left); + } + } + } + function bindDeleteExpressionFlow(node) { + ts.forEachChild(node, bind); + if (node.expression.kind === 172 /* PropertyAccessExpression */) { + bindAssignmentTargetFlow(node.expression); + } + } + function bindConditionalExpressionFlow(node) { + var trueLabel = createBranchLabel(); + var falseLabel = createBranchLabel(); + var postExpressionLabel = createBranchLabel(); + bindCondition(node.condition, trueLabel, falseLabel); + currentFlow = finishFlowLabel(trueLabel); + bind(node.whenTrue); + addAntecedent(postExpressionLabel, currentFlow); + currentFlow = finishFlowLabel(falseLabel); + bind(node.whenFalse); + addAntecedent(postExpressionLabel, currentFlow); + currentFlow = finishFlowLabel(postExpressionLabel); + } + function bindInitializedVariableFlow(node) { + var name = node.name; + if (ts.isBindingPattern(name)) { + for (var _i = 0, _a = name.elements; _i < _a.length; _i++) { + var child = _a[_i]; + bindInitializedVariableFlow(child); + } + } + else { + currentFlow = createFlowAssignment(currentFlow, node); + } + } + function bindVariableDeclarationFlow(node) { + ts.forEachChild(node, bind); + if (node.initializer || node.parent.parent.kind === 207 /* ForInStatement */ || node.parent.parent.kind === 208 /* ForOfStatement */) { + bindInitializedVariableFlow(node); } } function getContainerFlags(node) { switch (node.kind) { - case 186 /* ClassExpression */: - case 214 /* ClassDeclaration */: - case 215 /* InterfaceDeclaration */: - case 217 /* EnumDeclaration */: - case 155 /* TypeLiteral */: - case 165 /* ObjectLiteralExpression */: + case 192 /* ClassExpression */: + case 221 /* ClassDeclaration */: + case 222 /* InterfaceDeclaration */: + case 224 /* EnumDeclaration */: + case 171 /* ObjectLiteralExpression */: + case 159 /* TypeLiteral */: + case 265 /* JSDocRecordType */: return 1 /* IsContainer */; - case 147 /* CallSignature */: - case 148 /* ConstructSignature */: - case 149 /* IndexSignature */: - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - case 213 /* FunctionDeclaration */: - case 144 /* Constructor */: - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: - case 152 /* FunctionType */: - case 153 /* ConstructorType */: - case 173 /* FunctionExpression */: - case 174 /* ArrowFunction */: - case 218 /* ModuleDeclaration */: - case 248 /* SourceFile */: - case 216 /* TypeAliasDeclaration */: + case 151 /* CallSignature */: + case 152 /* ConstructSignature */: + case 153 /* IndexSignature */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: + case 220 /* FunctionDeclaration */: + case 148 /* Constructor */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: + case 156 /* FunctionType */: + case 269 /* JSDocFunctionType */: + case 157 /* ConstructorType */: + case 179 /* FunctionExpression */: + case 180 /* ArrowFunction */: + case 225 /* ModuleDeclaration */: + case 256 /* SourceFile */: + case 223 /* TypeAliasDeclaration */: return 5 /* IsContainerWithLocals */; - case 244 /* CatchClause */: - case 199 /* ForStatement */: - case 200 /* ForInStatement */: - case 201 /* ForOfStatement */: - case 220 /* CaseBlock */: + case 252 /* CatchClause */: + case 206 /* ForStatement */: + case 207 /* ForInStatement */: + case 208 /* ForOfStatement */: + case 227 /* CaseBlock */: return 2 /* IsBlockScopedContainer */; - case 192 /* Block */: + case 199 /* Block */: // do not treat blocks directly inside a function as a block-scoped-container. - // Locals that reside in this block should go to the function locals. Othewise 'x' + // Locals that reside in this block should go to the function locals. Otherwise 'x' // would not appear to be a redeclaration of a block scoped local in the following // example: // @@ -13116,38 +14558,40 @@ var ts; // members are declared (for example, a member of a class will go into a specific // symbol table depending on if it is static or not). We defer to specialized // handlers to take care of declaring these child members. - case 218 /* ModuleDeclaration */: + case 225 /* ModuleDeclaration */: return declareModuleMember(node, symbolFlags, symbolExcludes); - case 248 /* SourceFile */: + case 256 /* SourceFile */: return declareSourceFileMember(node, symbolFlags, symbolExcludes); - case 186 /* ClassExpression */: - case 214 /* ClassDeclaration */: + case 192 /* ClassExpression */: + case 221 /* ClassDeclaration */: return declareClassMember(node, symbolFlags, symbolExcludes); - case 217 /* EnumDeclaration */: + case 224 /* EnumDeclaration */: return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); - case 155 /* TypeLiteral */: - case 165 /* ObjectLiteralExpression */: - case 215 /* InterfaceDeclaration */: + case 159 /* TypeLiteral */: + case 171 /* ObjectLiteralExpression */: + case 222 /* InterfaceDeclaration */: + case 265 /* JSDocRecordType */: // Interface/Object-types always have their children added to the 'members' of // their container. They are only accessible through an instance of their // container, and are never in scope otherwise (even inside the body of the // object / type / interface declaring them). An exception is type parameters, // which are in scope without qualification (similar to 'locals'). return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); - case 152 /* FunctionType */: - case 153 /* ConstructorType */: - case 147 /* CallSignature */: - case 148 /* ConstructSignature */: - case 149 /* IndexSignature */: - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - case 144 /* Constructor */: - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: - case 213 /* FunctionDeclaration */: - case 173 /* FunctionExpression */: - case 174 /* ArrowFunction */: - case 216 /* TypeAliasDeclaration */: + case 156 /* FunctionType */: + case 157 /* ConstructorType */: + case 151 /* CallSignature */: + case 152 /* ConstructSignature */: + case 153 /* IndexSignature */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: + case 148 /* Constructor */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: + case 220 /* FunctionDeclaration */: + case 179 /* FunctionExpression */: + case 180 /* ArrowFunction */: + case 269 /* JSDocFunctionType */: + case 223 /* TypeAliasDeclaration */: // All the children of these container types are never visible through another // symbol (i.e. through another symbol's 'exports' or 'members'). Instead, // they're only accessed 'lexically' (i.e. from code that exists underneath @@ -13158,7 +14602,7 @@ var ts; } } function declareClassMember(node, symbolFlags, symbolExcludes) { - return node.flags & 64 /* Static */ + return node.flags & 32 /* Static */ ? declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes) : declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); } @@ -13168,11 +14612,11 @@ var ts; : declareSymbol(file.locals, undefined, node, symbolFlags, symbolExcludes); } function hasExportDeclarations(node) { - var body = node.kind === 248 /* SourceFile */ ? node : node.body; - if (body.kind === 248 /* SourceFile */ || body.kind === 219 /* ModuleBlock */) { + var body = node.kind === 256 /* SourceFile */ ? node : node.body; + if (body.kind === 256 /* SourceFile */ || body.kind === 226 /* ModuleBlock */) { for (var _i = 0, _a = body.statements; _i < _a.length; _i++) { var stat = _a[_i]; - if (stat.kind === 228 /* ExportDeclaration */ || stat.kind === 227 /* ExportAssignment */) { + if (stat.kind === 236 /* ExportDeclaration */ || stat.kind === 235 /* ExportAssignment */) { return true; } } @@ -13183,16 +14627,24 @@ var ts; // A declaration source file or ambient module declaration that contains no export declarations (but possibly regular // declarations with export modifiers) is an export context in which declarations are implicitly exported. if (ts.isInAmbientContext(node) && !hasExportDeclarations(node)) { - node.flags |= 131072 /* ExportContext */; + node.flags |= 8192 /* ExportContext */; } else { - node.flags &= ~131072 /* ExportContext */; + node.flags &= ~8192 /* ExportContext */; } } function bindModuleDeclaration(node) { setExportContextFlag(node); - if (node.name.kind === 9 /* StringLiteral */) { - declareSymbolAndAddToSymbolTable(node, 512 /* ValueModule */, 106639 /* ValueModuleExcludes */); + if (ts.isAmbientModule(node)) { + if (node.flags & 1 /* Export */) { + errorOnFirstToken(node, ts.Diagnostics.export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always_visible); + } + if (ts.isExternalModuleAugmentation(node)) { + declareSymbolAndAddToSymbolTable(node, 1024 /* NamespaceModule */, 0 /* NamespaceModuleExcludes */); + } + else { + declareSymbolAndAddToSymbolTable(node, 512 /* ValueModule */, 106639 /* ValueModuleExcludes */); + } } else { var state = getModuleInstanceState(node); @@ -13248,7 +14700,7 @@ var ts; continue; } var identifier = prop.name; - // ECMA-262 11.1.5 Object Initialiser + // ECMA-262 11.1.5 Object Initializer // If previous is not undefined then throw a SyntaxError exception if any of the following conditions are true // a.This production is contained in strict code and IsDataDescriptor(previous) is true and // IsDataDescriptor(propId.descriptor) is true. @@ -13256,7 +14708,7 @@ var ts; // c.IsAccessorDescriptor(previous) is true and IsDataDescriptor(propId.descriptor) is true. // d.IsAccessorDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true // and either both previous and propId.descriptor have[[Get]] fields or both previous and propId.descriptor have[[Set]] fields - var currentKind = prop.kind === 245 /* PropertyAssignment */ || prop.kind === 246 /* ShorthandPropertyAssignment */ || prop.kind === 143 /* MethodDeclaration */ + var currentKind = prop.kind === 253 /* PropertyAssignment */ || prop.kind === 254 /* ShorthandPropertyAssignment */ || prop.kind === 147 /* MethodDeclaration */ ? 1 /* Property */ : 2 /* Accessor */; var existingKind = seen[identifier.text]; @@ -13278,10 +14730,10 @@ var ts; } function bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) { switch (blockScopeContainer.kind) { - case 218 /* ModuleDeclaration */: + case 225 /* ModuleDeclaration */: declareModuleMember(node, symbolFlags, symbolExcludes); break; - case 248 /* SourceFile */: + case 256 /* SourceFile */: if (ts.isExternalModule(container)) { declareModuleMember(node, symbolFlags, symbolExcludes); break; @@ -13304,7 +14756,8 @@ var ts; if (inStrictMode && node.originalKeywordKind >= 106 /* FirstFutureReservedWord */ && node.originalKeywordKind <= 114 /* LastFutureReservedWord */ && - !ts.isIdentifierName(node)) { + !ts.isIdentifierName(node) && + !ts.isInAmbientContext(node)) { // Report error only if there are no parse errors in file if (!file.parseDiagnostics.length) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, getStrictModeIdentifierMessage(node), ts.declarationNameToString(node))); @@ -13377,8 +14830,32 @@ var ts; checkStrictModeEvalOrArguments(node, node.name); } } + function getStrictModeBlockScopeFunctionDeclarationMessage(node) { + // Provide specialized messages to help the user understand why we think they're in + // strict mode. + if (ts.getContainingClass(node)) { + return ts.Diagnostics.Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Class_definitions_are_automatically_in_strict_mode; + } + if (file.externalModuleIndicator) { + return ts.Diagnostics.Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Modules_are_automatically_in_strict_mode; + } + return ts.Diagnostics.Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5; + } + function checkStrictModeFunctionDeclaration(node) { + if (languageVersion < 2 /* ES6 */) { + // Report error if function is not top level function declaration + if (blockScopeContainer.kind !== 256 /* SourceFile */ && + blockScopeContainer.kind !== 225 /* ModuleDeclaration */ && + !ts.isFunctionLike(blockScopeContainer)) { + // We check first if the name is inside class declaration or class expression; if so give explicit message + // otherwise report generic error message. + var errorSpan = ts.getErrorSpanForNode(file, node); + file.bindDiagnostics.push(ts.createFileDiagnostic(file, errorSpan.start, errorSpan.length, getStrictModeBlockScopeFunctionDeclarationMessage(node))); + } + } + } function checkStrictModeNumericLiteral(node) { - if (inStrictMode && node.flags & 32768 /* OctalLiteral */) { + if (inStrictMode && node.isOctalLiteral) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Octal_literals_are_not_allowed_in_strict_mode)); } } @@ -13441,17 +14918,17 @@ var ts; } function updateStrictMode(node) { switch (node.kind) { - case 248 /* SourceFile */: - case 219 /* ModuleBlock */: + case 256 /* SourceFile */: + case 226 /* ModuleBlock */: updateStrictModeStatementList(node.statements); return; - case 192 /* Block */: + case 199 /* Block */: if (ts.isFunctionLike(node.parent)) { updateStrictModeStatementList(node.statements); } return; - case 214 /* ClassDeclaration */: - case 186 /* ClassExpression */: + case 221 /* ClassDeclaration */: + case 192 /* ClassExpression */: // All classes are automatically in strict mode in ES6. inStrictMode = true; return; @@ -13474,118 +14951,158 @@ var ts; var nodeText = ts.getTextOfNodeFromSourceText(file.text, node.expression); // Note: the node text must be exactly "use strict" or 'use strict'. It is not ok for the // string to contain unicode escapes (as per ES5). - return nodeText === "\"use strict\"" || nodeText === "'use strict'"; + return nodeText === '"use strict"' || nodeText === "'use strict'"; } function bindWorker(node) { switch (node.kind) { /* Strict mode checks */ case 69 /* Identifier */: + case 97 /* ThisKeyword */: + if (currentFlow && (ts.isExpression(node) || parent.kind === 254 /* ShorthandPropertyAssignment */)) { + node.flowNode = currentFlow; + } return checkStrictModeIdentifier(node); - case 181 /* BinaryExpression */: + case 172 /* PropertyAccessExpression */: + if (currentFlow && isNarrowableReference(node)) { + node.flowNode = currentFlow; + } + break; + case 187 /* BinaryExpression */: if (ts.isInJavaScriptFile(node)) { - if (ts.isExportsPropertyAssignment(node)) { - bindExportsPropertyAssignment(node); - } - else if (ts.isModuleExportsAssignment(node)) { - bindModuleExportsAssignment(node); + var specialKind = ts.getSpecialPropertyAssignmentKind(node); + switch (specialKind) { + case 1 /* ExportsProperty */: + bindExportsPropertyAssignment(node); + break; + case 2 /* ModuleExports */: + bindModuleExportsAssignment(node); + break; + case 3 /* PrototypeProperty */: + bindPrototypePropertyAssignment(node); + break; + case 4 /* ThisProperty */: + bindThisPropertyAssignment(node); + break; + case 0 /* None */: + // Nothing to do + break; + default: + ts.Debug.fail("Unknown special property assignment kind"); } } return checkStrictModeBinaryExpression(node); - case 244 /* CatchClause */: + case 252 /* CatchClause */: return checkStrictModeCatchClause(node); - case 175 /* DeleteExpression */: + case 181 /* DeleteExpression */: return checkStrictModeDeleteExpression(node); case 8 /* NumericLiteral */: return checkStrictModeNumericLiteral(node); - case 180 /* PostfixUnaryExpression */: + case 186 /* PostfixUnaryExpression */: return checkStrictModePostfixUnaryExpression(node); - case 179 /* PrefixUnaryExpression */: + case 185 /* PrefixUnaryExpression */: return checkStrictModePrefixUnaryExpression(node); - case 205 /* WithStatement */: + case 212 /* WithStatement */: return checkStrictModeWithStatement(node); - case 97 /* ThisKeyword */: + case 165 /* ThisType */: seenThisKeyword = true; return; - case 137 /* TypeParameter */: + case 154 /* TypePredicate */: + return checkTypePredicate(node); + case 141 /* TypeParameter */: return declareSymbolAndAddToSymbolTable(node, 262144 /* TypeParameter */, 530912 /* TypeParameterExcludes */); - case 138 /* Parameter */: + case 142 /* Parameter */: return bindParameter(node); - case 211 /* VariableDeclaration */: - case 163 /* BindingElement */: + case 218 /* VariableDeclaration */: + case 169 /* BindingElement */: return bindVariableDeclarationOrBindingElement(node); - case 141 /* PropertyDeclaration */: - case 140 /* PropertySignature */: + case 145 /* PropertyDeclaration */: + case 144 /* PropertySignature */: + case 266 /* JSDocRecordMember */: return bindPropertyOrMethodOrAccessor(node, 4 /* Property */ | (node.questionToken ? 536870912 /* Optional */ : 0 /* None */), 107455 /* PropertyExcludes */); - case 245 /* PropertyAssignment */: - case 246 /* ShorthandPropertyAssignment */: + case 253 /* PropertyAssignment */: + case 254 /* ShorthandPropertyAssignment */: return bindPropertyOrMethodOrAccessor(node, 4 /* Property */, 107455 /* PropertyExcludes */); - case 247 /* EnumMember */: + case 255 /* EnumMember */: return bindPropertyOrMethodOrAccessor(node, 8 /* EnumMember */, 107455 /* EnumMemberExcludes */); - case 147 /* CallSignature */: - case 148 /* ConstructSignature */: - case 149 /* IndexSignature */: + case 247 /* JsxSpreadAttribute */: + hasJsxSpreadAttribute = true; + return; + case 151 /* CallSignature */: + case 152 /* ConstructSignature */: + case 153 /* IndexSignature */: return declareSymbolAndAddToSymbolTable(node, 131072 /* Signature */, 0 /* None */); - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: // If this is an ObjectLiteralExpression method, then it sits in the same space // as other properties in the object literal. So we use SymbolFlags.PropertyExcludes // so that it will conflict with any other object literal members with the same // name. return bindPropertyOrMethodOrAccessor(node, 8192 /* Method */ | (node.questionToken ? 536870912 /* Optional */ : 0 /* None */), ts.isObjectLiteralMethod(node) ? 107455 /* PropertyExcludes */ : 99263 /* MethodExcludes */); - case 213 /* FunctionDeclaration */: - checkStrictModeFunctionName(node); - return declareSymbolAndAddToSymbolTable(node, 16 /* Function */, 106927 /* FunctionExcludes */); - case 144 /* Constructor */: + case 220 /* FunctionDeclaration */: + return bindFunctionDeclaration(node); + case 148 /* Constructor */: return declareSymbolAndAddToSymbolTable(node, 16384 /* Constructor */, /*symbolExcludes:*/ 0 /* None */); - case 145 /* GetAccessor */: + case 149 /* GetAccessor */: return bindPropertyOrMethodOrAccessor(node, 32768 /* GetAccessor */, 41919 /* GetAccessorExcludes */); - case 146 /* SetAccessor */: + case 150 /* SetAccessor */: return bindPropertyOrMethodOrAccessor(node, 65536 /* SetAccessor */, 74687 /* SetAccessorExcludes */); - case 152 /* FunctionType */: - case 153 /* ConstructorType */: + case 156 /* FunctionType */: + case 157 /* ConstructorType */: + case 269 /* JSDocFunctionType */: return bindFunctionOrConstructorType(node); - case 155 /* TypeLiteral */: + case 159 /* TypeLiteral */: + case 265 /* JSDocRecordType */: return bindAnonymousDeclaration(node, 2048 /* TypeLiteral */, "__type"); - case 165 /* ObjectLiteralExpression */: + case 171 /* ObjectLiteralExpression */: return bindObjectLiteralExpression(node); - case 173 /* FunctionExpression */: - case 174 /* ArrowFunction */: - checkStrictModeFunctionName(node); - var bindingName = node.name ? node.name.text : "__function"; - return bindAnonymousDeclaration(node, 16 /* Function */, bindingName); - case 168 /* CallExpression */: + case 179 /* FunctionExpression */: + case 180 /* ArrowFunction */: + return bindFunctionExpression(node); + case 174 /* CallExpression */: if (ts.isInJavaScriptFile(node)) { bindCallExpression(node); } break; // Members of classes, interfaces, and modules - case 186 /* ClassExpression */: - case 214 /* ClassDeclaration */: + case 192 /* ClassExpression */: + case 221 /* ClassDeclaration */: return bindClassLikeDeclaration(node); - case 215 /* InterfaceDeclaration */: + case 222 /* InterfaceDeclaration */: return bindBlockScopedDeclaration(node, 64 /* Interface */, 792960 /* InterfaceExcludes */); - case 216 /* TypeAliasDeclaration */: + case 223 /* TypeAliasDeclaration */: return bindBlockScopedDeclaration(node, 524288 /* TypeAlias */, 793056 /* TypeAliasExcludes */); - case 217 /* EnumDeclaration */: + case 224 /* EnumDeclaration */: return bindEnumDeclaration(node); - case 218 /* ModuleDeclaration */: + case 225 /* ModuleDeclaration */: return bindModuleDeclaration(node); // Imports and exports - case 221 /* ImportEqualsDeclaration */: - case 224 /* NamespaceImport */: - case 226 /* ImportSpecifier */: - case 230 /* ExportSpecifier */: + case 229 /* ImportEqualsDeclaration */: + case 232 /* NamespaceImport */: + case 234 /* ImportSpecifier */: + case 238 /* ExportSpecifier */: return declareSymbolAndAddToSymbolTable(node, 8388608 /* Alias */, 8388608 /* AliasExcludes */); - case 223 /* ImportClause */: + case 228 /* GlobalModuleExportDeclaration */: + return bindGlobalModuleExportDeclaration(node); + case 231 /* ImportClause */: return bindImportClause(node); - case 228 /* ExportDeclaration */: + case 236 /* ExportDeclaration */: return bindExportDeclaration(node); - case 227 /* ExportAssignment */: + case 235 /* ExportAssignment */: return bindExportAssignment(node); - case 248 /* SourceFile */: + case 256 /* SourceFile */: return bindSourceFileIfExternalModule(); } } + function checkTypePredicate(node) { + var parameterName = node.parameterName, type = node.type; + if (parameterName && parameterName.kind === 69 /* Identifier */) { + checkStrictModeIdentifier(parameterName); + } + if (parameterName && parameterName.kind === 165 /* ThisType */) { + seenThisKeyword = true; + } + bind(type); + } function bindSourceFileIfExternalModule() { setExportContextFlag(file); if (ts.isExternalModule(file)) { @@ -13596,12 +15113,12 @@ var ts; bindAnonymousDeclaration(file, 512 /* ValueModule */, "\"" + ts.removeFileExtension(file.fileName) + "\""); } function bindExportAssignment(node) { - var boundExpression = node.kind === 227 /* ExportAssignment */ ? node.expression : node.right; + var boundExpression = node.kind === 235 /* ExportAssignment */ ? node.expression : node.right; if (!container.symbol || !container.symbol.exports) { // Export assignment in some sort of block construct bindAnonymousDeclaration(node, 8388608 /* Alias */, getDeclarationName(node)); } - else if (boundExpression.kind === 69 /* Identifier */) { + else if (boundExpression.kind === 69 /* Identifier */ && node.kind === 235 /* ExportAssignment */) { // An export default clause with an identifier exports all meanings of that identifier declareSymbol(container.symbol.exports, container.symbol, node, 8388608 /* Alias */, 107455 /* PropertyExcludes */ | 8388608 /* AliasExcludes */); } @@ -13610,6 +15127,28 @@ var ts; declareSymbol(container.symbol.exports, container.symbol, node, 4 /* Property */, 107455 /* PropertyExcludes */ | 8388608 /* AliasExcludes */); } } + function bindGlobalModuleExportDeclaration(node) { + if (node.modifiers && node.modifiers.length) { + file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Modifiers_cannot_appear_here)); + } + if (node.parent.kind !== 256 /* SourceFile */) { + file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_at_top_level)); + return; + } + else { + var parent_5 = node.parent; + if (!ts.isExternalModule(parent_5)) { + file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_in_module_files)); + return; + } + if (!parent_5.isDeclarationFile) { + file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_in_declaration_files)); + return; + } + } + file.symbol.globalExports = file.symbol.globalExports || {}; + declareSymbol(file.symbol.globalExports, file.symbol, node, 8388608 /* Alias */, 8388608 /* AliasExcludes */); + } function bindExportDeclaration(node) { if (!container.symbol || !container.symbol.exports) { // Export * in some sort of block construct @@ -13640,17 +15179,55 @@ var ts; function bindModuleExportsAssignment(node) { // 'module.exports = expr' assignment setCommonJsModuleIndicator(node); - bindExportAssignment(node); + declareSymbol(file.symbol.exports, file.symbol, node, 4 /* Property */ | 7340032 /* Export */ | 512 /* ValueModule */, 0 /* None */); + } + function bindThisPropertyAssignment(node) { + // Declare a 'member' in case it turns out the container was an ES5 class + if (container.kind === 179 /* FunctionExpression */ || container.kind === 220 /* FunctionDeclaration */) { + container.symbol.members = container.symbol.members || {}; + // It's acceptable for multiple 'this' assignments of the same identifier to occur + declareSymbol(container.symbol.members, container.symbol, node, 4 /* Property */, 107455 /* PropertyExcludes */ & ~4 /* Property */); + } + } + function bindPrototypePropertyAssignment(node) { + // We saw a node of the form 'x.prototype.y = z'. Declare a 'member' y on x if x was a function. + // Look up the function in the local scope, since prototype assignments should + // follow the function declaration + var leftSideOfAssignment = node.left; + var classPrototype = leftSideOfAssignment.expression; + var constructorFunction = classPrototype.expression; + // Fix up parent pointers since we're going to use these nodes before we bind into them + leftSideOfAssignment.parent = node; + constructorFunction.parent = classPrototype; + classPrototype.parent = leftSideOfAssignment; + var funcSymbol = container.locals[constructorFunction.text]; + if (!funcSymbol || !(funcSymbol.flags & 16 /* Function */)) { + return; + } + // Set up the members collection if it doesn't exist already + if (!funcSymbol.members) { + funcSymbol.members = {}; + } + // Declare the method/property + declareSymbol(funcSymbol.members, funcSymbol, leftSideOfAssignment, 4 /* Property */, 107455 /* PropertyExcludes */); } function bindCallExpression(node) { // We're only inspecting call expressions to detect CommonJS modules, so we can skip // this check if we've already seen the module indicator - if (!file.commonJsModuleIndicator && ts.isRequireCall(node)) { + if (!file.commonJsModuleIndicator && ts.isRequireCall(node, /*checkArgumentIsStringLiteral*/ false)) { setCommonJsModuleIndicator(node); } } function bindClassLikeDeclaration(node) { - if (node.kind === 214 /* ClassDeclaration */) { + if (!ts.isDeclarationFile(file) && !ts.isInAmbientContext(node)) { + if (ts.getClassExtendsHeritageClauseElement(node) !== undefined) { + hasClassExtends = true; + } + if (ts.nodeIsDecorated(node)) { + hasDecorators = true; + } + } + if (node.kind === 221 /* ClassDeclaration */) { bindBlockScopedDeclaration(node, 32 /* Class */, 899519 /* ClassExcludes */); } else { @@ -13712,6 +15289,12 @@ var ts; } } function bindParameter(node) { + if (!ts.isDeclarationFile(file) && + !ts.isInAmbientContext(node) && + ts.nodeIsDecorated(node)) { + hasDecorators = true; + hasParameterDecorators = true; + } if (inStrictMode) { // It is a SyntaxError if the identifier eval or arguments appears within a FormalParameterList of a // strict mode FunctionLikeDeclaration or FunctionExpression(13.1) @@ -13725,123 +15308,90 @@ var ts; } // If this is a property-parameter, then also declare the property symbol into the // containing class. - if (node.flags & 56 /* AccessibilityModifier */ && - node.parent.kind === 144 /* Constructor */ && - ts.isClassLike(node.parent.parent)) { + if (ts.isParameterPropertyDeclaration(node)) { var classDeclaration = node.parent.parent; declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, 4 /* Property */, 107455 /* PropertyExcludes */); } } + function bindFunctionDeclaration(node) { + if (!ts.isDeclarationFile(file) && !ts.isInAmbientContext(node)) { + if (ts.isAsyncFunctionLike(node)) { + hasAsyncFunctions = true; + } + } + checkStrictModeFunctionName(node); + if (inStrictMode) { + checkStrictModeFunctionDeclaration(node); + return bindBlockScopedDeclaration(node, 16 /* Function */, 106927 /* FunctionExcludes */); + } + else { + return declareSymbolAndAddToSymbolTable(node, 16 /* Function */, 106927 /* FunctionExcludes */); + } + } + function bindFunctionExpression(node) { + if (!ts.isDeclarationFile(file) && !ts.isInAmbientContext(node)) { + if (ts.isAsyncFunctionLike(node)) { + hasAsyncFunctions = true; + } + } + checkStrictModeFunctionName(node); + var bindingName = node.name ? node.name.text : "__function"; + return bindAnonymousDeclaration(node, 16 /* Function */, bindingName); + } function bindPropertyOrMethodOrAccessor(node, symbolFlags, symbolExcludes) { + if (!ts.isDeclarationFile(file) && !ts.isInAmbientContext(node)) { + if (ts.isAsyncFunctionLike(node)) { + hasAsyncFunctions = true; + } + if (ts.nodeIsDecorated(node)) { + hasDecorators = true; + } + } return ts.hasDynamicName(node) ? bindAnonymousDeclaration(node, symbolFlags, "__computed") : declareSymbolAndAddToSymbolTable(node, symbolFlags, symbolExcludes); } // reachability checks - function pushNamedLabel(name) { - initializeReachabilityStateIfNecessary(); - if (ts.hasProperty(labelIndexMap, name.text)) { - return false; - } - labelIndexMap[name.text] = labelStack.push(1 /* Unintialized */) - 1; - return true; - } - function pushImplicitLabel() { - initializeReachabilityStateIfNecessary(); - var index = labelStack.push(1 /* Unintialized */) - 1; - implicitLabels.push(index); - return index; - } - function popNamedLabel(label, outerState) { - var index = labelIndexMap[label.text]; - ts.Debug.assert(index !== undefined); - ts.Debug.assert(labelStack.length == index + 1); - labelIndexMap[label.text] = undefined; - setCurrentStateAtLabel(labelStack.pop(), outerState, label); - } - function popImplicitLabel(implicitLabelIndex, outerState) { - if (labelStack.length !== implicitLabelIndex + 1) { - ts.Debug.assert(false, "Label stack: " + labelStack.length + ", index:" + implicitLabelIndex); - } - var i = implicitLabels.pop(); - if (implicitLabelIndex !== i) { - ts.Debug.assert(false, "i: " + i + ", index: " + implicitLabelIndex); - } - setCurrentStateAtLabel(labelStack.pop(), outerState, /*name*/ undefined); - } - function setCurrentStateAtLabel(innerMergedState, outerState, label) { - if (innerMergedState === 1 /* Unintialized */) { - if (label && !options.allowUnusedLabels) { - file.bindDiagnostics.push(ts.createDiagnosticForNode(label, ts.Diagnostics.Unused_label)); - } - currentReachabilityState = outerState; - } - else { - currentReachabilityState = or(innerMergedState, outerState); - } - } - function jumpToLabel(label, outerState) { - initializeReachabilityStateIfNecessary(); - var index = label ? labelIndexMap[label.text] : ts.lastOrUndefined(implicitLabels); - if (index === undefined) { - // reference to unknown label or - // break/continue used outside of loops - return false; - } - var stateAtLabel = labelStack[index]; - labelStack[index] = stateAtLabel === 1 /* Unintialized */ ? outerState : or(stateAtLabel, outerState); - return true; + function shouldReportErrorOnModuleDeclaration(node) { + var instanceState = getModuleInstanceState(node); + return instanceState === 1 /* Instantiated */ || (instanceState === 2 /* ConstEnumOnly */ && options.preserveConstEnums); } function checkUnreachable(node) { - switch (currentReachabilityState) { - case 4 /* Unreachable */: - var reportError = - // report error on all statements except empty ones - (ts.isStatement(node) && node.kind !== 194 /* EmptyStatement */) || - // report error on class declarations - node.kind === 214 /* ClassDeclaration */ || - // report error on instantiated modules or const-enums only modules if preserveConstEnums is set - (node.kind === 218 /* ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node)) || - // report error on regular enums and const enums if preserveConstEnums is set - (node.kind === 217 /* EnumDeclaration */ && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums)); - if (reportError) { - currentReachabilityState = 8 /* ReportedUnreachable */; - // unreachable code is reported if - // - user has explicitly asked about it AND - // - statement is in not ambient context (statements in ambient context is already an error - // so we should not report extras) AND - // - node is not variable statement OR - // - node is block scoped variable statement OR - // - node is not block scoped variable statement and at least one variable declaration has initializer - // Rationale: we don't want to report errors on non-initialized var's since they are hoisted - // On the other side we do want to report errors on non-initialized 'lets' because of TDZ - var reportUnreachableCode = !options.allowUnreachableCode && - !ts.isInAmbientContext(node) && - (node.kind !== 193 /* VariableStatement */ || - ts.getCombinedNodeFlags(node.declarationList) & 24576 /* BlockScoped */ || - ts.forEach(node.declarationList.declarations, function (d) { return d.initializer; })); - if (reportUnreachableCode) { - errorOnFirstToken(node, ts.Diagnostics.Unreachable_code_detected); - } + if (!(currentFlow.flags & 1 /* Unreachable */)) { + return false; + } + if (currentFlow === unreachableFlow) { + var reportError = + // report error on all statements except empty ones + (ts.isStatement(node) && node.kind !== 201 /* EmptyStatement */) || + // report error on class declarations + node.kind === 221 /* ClassDeclaration */ || + // report error on instantiated modules or const-enums only modules if preserveConstEnums is set + (node.kind === 225 /* ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node)) || + // report error on regular enums and const enums if preserveConstEnums is set + (node.kind === 224 /* EnumDeclaration */ && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums)); + if (reportError) { + currentFlow = reportedUnreachableFlow; + // unreachable code is reported if + // - user has explicitly asked about it AND + // - statement is in not ambient context (statements in ambient context is already an error + // so we should not report extras) AND + // - node is not variable statement OR + // - node is block scoped variable statement OR + // - node is not block scoped variable statement and at least one variable declaration has initializer + // Rationale: we don't want to report errors on non-initialized var's since they are hoisted + // On the other side we do want to report errors on non-initialized 'lets' because of TDZ + var reportUnreachableCode = !options.allowUnreachableCode && + !ts.isInAmbientContext(node) && + (node.kind !== 200 /* VariableStatement */ || + ts.getCombinedNodeFlags(node.declarationList) & 3072 /* BlockScoped */ || + ts.forEach(node.declarationList.declarations, function (d) { return d.initializer; })); + if (reportUnreachableCode) { + errorOnFirstToken(node, ts.Diagnostics.Unreachable_code_detected); } - case 8 /* ReportedUnreachable */: - return true; - default: - return false; + } } - function shouldReportErrorOnModuleDeclaration(node) { - var instanceState = getModuleInstanceState(node); - return instanceState === 1 /* Instantiated */ || (instanceState === 2 /* ConstEnumOnly */ && options.preserveConstEnums); - } - } - function initializeReachabilityStateIfNecessary() { - if (labelIndexMap) { - return; - } - currentReachabilityState = 2 /* Reachable */; - labelIndexMap = {}; - labelStack = []; - implicitLabels = []; + return true; } } })(ts || (ts = {})); @@ -13852,16 +15402,20 @@ var ts; var nextSymbolId = 1; var nextNodeId = 1; var nextMergeId = 1; + var nextFlowId = 1; function getNodeId(node) { - if (!node.id) - node.id = nextNodeId++; + if (!node.id) { + node.id = nextNodeId; + nextNodeId++; + } return node.id; } ts.getNodeId = getNodeId; ts.checkTime = 0; function getSymbolId(symbol) { if (!symbol.id) { - symbol.id = nextSymbolId++; + symbol.id = nextSymbolId; + nextSymbolId++; } return symbol.id; } @@ -13886,9 +15440,12 @@ var ts; var emptySymbols = {}; var compilerOptions = host.getCompilerOptions(); var languageVersion = compilerOptions.target || 0 /* ES3 */; - var modulekind = compilerOptions.module ? compilerOptions.module : languageVersion === 2 /* ES6 */ ? 5 /* ES6 */ : 0 /* None */; + var modulekind = ts.getEmitModuleKind(compilerOptions); + var allowSyntheticDefaultImports = typeof compilerOptions.allowSyntheticDefaultImports !== "undefined" ? compilerOptions.allowSyntheticDefaultImports : modulekind === ts.ModuleKind.System; + var strictNullChecks = compilerOptions.strictNullChecks; var emitResolver = createResolver(); var undefinedSymbol = createSymbol(4 /* Property */ | 67108864 /* Transient */, "undefined"); + undefinedSymbol.declarations = []; var argumentsSymbol = createSymbol(4 /* Property */ | 67108864 /* Transient */, "arguments"); var checker = { getNodeCount: function () { return ts.sum(host.getSourceFiles(), "nodeCount"); }, @@ -13897,11 +15454,11 @@ var ts; getTypeCount: function () { return typeCount; }, isUndefinedSymbol: function (symbol) { return symbol === undefinedSymbol; }, isArgumentsSymbol: function (symbol) { return symbol === argumentsSymbol; }, + isUnknownSymbol: function (symbol) { return symbol === unknownSymbol; }, getDiagnostics: getDiagnostics, getGlobalDiagnostics: getGlobalDiagnostics, - // The language service will always care about the narrowed type of a symbol, because that is - // the type the language says the symbol should have. - getTypeOfSymbolAtLocation: getNarrowedTypeOfSymbol, + getTypeOfSymbolAtLocation: getTypeOfSymbolAtLocation, + getSymbolsOfParameterPropertyDeclaration: getSymbolsOfParameterPropertyDeclaration, getDeclaredTypeOfSymbol: getDeclaredTypeOfSymbol, getPropertiesOfType: getPropertiesOfType, getPropertyOfType: getPropertyOfType, @@ -13909,16 +15466,19 @@ var ts; getIndexTypeOfType: getIndexTypeOfType, getBaseTypes: getBaseTypes, getReturnTypeOfSignature: getReturnTypeOfSignature, + getNonNullableType: getNonNullableType, getSymbolsInScope: getSymbolsInScope, getSymbolAtLocation: getSymbolAtLocation, getShorthandAssignmentValueSymbol: getShorthandAssignmentValueSymbol, + getExportSpecifierLocalTargetSymbol: getExportSpecifierLocalTargetSymbol, getTypeAtLocation: getTypeOfNode, + getPropertySymbolOfDestructuringAssignment: getPropertySymbolOfDestructuringAssignment, typeToString: typeToString, getSymbolDisplayBuilder: getSymbolDisplayBuilder, symbolToString: symbolToString, getAugmentedPropertiesOfType: getAugmentedPropertiesOfType, getRootSymbols: getRootSymbols, - getContextualType: getApparentTypeOfContextualType, + getContextualType: getContextualType, getFullyQualifiedName: getFullyQualifiedName, getResolvedSignature: getResolvedSignature, getConstantValue: getConstantValue, @@ -13934,16 +15494,18 @@ var ts; }; var unknownSymbol = createSymbol(4 /* Property */ | 67108864 /* Transient */, "unknown"); var resolvingSymbol = createSymbol(67108864 /* Transient */, "__resolving__"); + var nullableWideningFlags = strictNullChecks ? 0 : 2097152 /* ContainsUndefinedOrNull */; var anyType = createIntrinsicType(1 /* Any */, "any"); var stringType = createIntrinsicType(2 /* String */, "string"); var numberType = createIntrinsicType(4 /* Number */, "number"); var booleanType = createIntrinsicType(8 /* Boolean */, "boolean"); var esSymbolType = createIntrinsicType(16777216 /* ESSymbol */, "symbol"); var voidType = createIntrinsicType(16 /* Void */, "void"); - var undefinedType = createIntrinsicType(32 /* Undefined */ | 2097152 /* ContainsUndefinedOrNull */, "undefined"); - var nullType = createIntrinsicType(64 /* Null */ | 2097152 /* ContainsUndefinedOrNull */, "null"); + var undefinedType = createIntrinsicType(32 /* Undefined */ | nullableWideningFlags, "undefined"); + var nullType = createIntrinsicType(64 /* Null */ | nullableWideningFlags, "null"); + var emptyArrayElementType = createIntrinsicType(32 /* Undefined */ | 2097152 /* ContainsUndefinedOrNull */, "undefined"); var unknownType = createIntrinsicType(1 /* Any */, "unknown"); - var circularType = createIntrinsicType(1 /* Any */, "__circular__"); + var neverType = createIntrinsicType(134217728 /* Never */, "never"); var emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); var emptyGenericType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); emptyGenericType.instantiations = {}; @@ -13952,27 +15514,30 @@ var ts; // in getPropagatingFlagsOfTypes, and it is checked in inferFromTypes. anyFunctionType.flags |= 8388608 /* ContainsAnyFunctionType */; var noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); - var anySignature = createSignature(undefined, undefined, emptyArray, anyType, undefined, 0, false, false); - var unknownSignature = createSignature(undefined, undefined, emptyArray, unknownType, undefined, 0, false, false); + var anySignature = createSignature(undefined, undefined, undefined, emptyArray, anyType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasStringLiterals*/ false); + var unknownSignature = createSignature(undefined, undefined, undefined, emptyArray, unknownType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasStringLiterals*/ false); + var enumNumberIndexInfo = createIndexInfo(stringType, /*isReadonly*/ true); var globals = {}; - var globalESSymbolConstructorSymbol; + var getGlobalESSymbolConstructorSymbol; var getGlobalPromiseConstructorSymbol; var globalObjectType; var globalFunctionType; var globalArrayType; + var globalReadonlyArrayType; var globalStringType; var globalNumberType; var globalBooleanType; var globalRegExpType; - var globalTemplateStringsArrayType; - var globalESSymbolType; - var jsxElementType; - /** Lazily loaded, use getJsxIntrinsicElementType() */ - var jsxIntrinsicElementsType; - var globalIterableType; - var globalIteratorType; - var globalIterableIteratorType; var anyArrayType; + var anyReadonlyArrayType; + // The library files are only loaded when the feature is used. + // This allows users to just specify library files they want to used through --lib + // and they will not get an error from not having unrelated library files + var getGlobalTemplateStringsArrayType; + var getGlobalESSymbolType; + var getGlobalIterableType; + var getGlobalIteratorType; + var getGlobalIterableIteratorType; var getGlobalClassDecoratorType; var getGlobalParameterDecoratorType; var getGlobalPropertyDecoratorType; @@ -13985,51 +15550,113 @@ var ts; var getGlobalPromiseConstructorLikeType; var getGlobalThenableType; var jsxElementClassType; + var deferredNodes; + var flowLoopStart = 0; + var flowLoopCount = 0; + var visitedFlowCount = 0; var tupleTypes = {}; var unionTypes = {}; var intersectionTypes = {}; var stringLiteralTypes = {}; - var emitExtends = false; - var emitDecorate = false; - var emitParam = false; - var emitAwaiter = false; - var emitGenerator = false; var resolutionTargets = []; var resolutionResults = []; var resolutionPropertyNames = []; var mergedSymbols = []; var symbolLinks = []; var nodeLinks = []; + var flowLoopCaches = []; + var flowLoopNodes = []; + var flowLoopKeys = []; + var flowLoopTypes = []; + var visitedFlowNodes = []; + var visitedFlowTypes = []; var potentialThisCollisions = []; var awaitedTypeStack = []; var diagnostics = ts.createDiagnosticCollection(); - var primitiveTypeInfo = { - "string": { - type: stringType, - flags: 258 /* StringLike */ - }, - "number": { - type: numberType, - flags: 132 /* NumberLike */ - }, - "boolean": { - type: booleanType, - flags: 8 /* Boolean */ - }, - "symbol": { - type: esSymbolType, - flags: 16777216 /* ESSymbol */ - } + var TypeFacts; + (function (TypeFacts) { + TypeFacts[TypeFacts["None"] = 0] = "None"; + TypeFacts[TypeFacts["TypeofEQString"] = 1] = "TypeofEQString"; + TypeFacts[TypeFacts["TypeofEQNumber"] = 2] = "TypeofEQNumber"; + TypeFacts[TypeFacts["TypeofEQBoolean"] = 4] = "TypeofEQBoolean"; + TypeFacts[TypeFacts["TypeofEQSymbol"] = 8] = "TypeofEQSymbol"; + TypeFacts[TypeFacts["TypeofEQObject"] = 16] = "TypeofEQObject"; + TypeFacts[TypeFacts["TypeofEQFunction"] = 32] = "TypeofEQFunction"; + TypeFacts[TypeFacts["TypeofEQHostObject"] = 64] = "TypeofEQHostObject"; + TypeFacts[TypeFacts["TypeofNEString"] = 128] = "TypeofNEString"; + TypeFacts[TypeFacts["TypeofNENumber"] = 256] = "TypeofNENumber"; + TypeFacts[TypeFacts["TypeofNEBoolean"] = 512] = "TypeofNEBoolean"; + TypeFacts[TypeFacts["TypeofNESymbol"] = 1024] = "TypeofNESymbol"; + TypeFacts[TypeFacts["TypeofNEObject"] = 2048] = "TypeofNEObject"; + TypeFacts[TypeFacts["TypeofNEFunction"] = 4096] = "TypeofNEFunction"; + TypeFacts[TypeFacts["TypeofNEHostObject"] = 8192] = "TypeofNEHostObject"; + TypeFacts[TypeFacts["EQUndefined"] = 16384] = "EQUndefined"; + TypeFacts[TypeFacts["EQNull"] = 32768] = "EQNull"; + TypeFacts[TypeFacts["EQUndefinedOrNull"] = 65536] = "EQUndefinedOrNull"; + TypeFacts[TypeFacts["NEUndefined"] = 131072] = "NEUndefined"; + TypeFacts[TypeFacts["NENull"] = 262144] = "NENull"; + TypeFacts[TypeFacts["NEUndefinedOrNull"] = 524288] = "NEUndefinedOrNull"; + TypeFacts[TypeFacts["Truthy"] = 1048576] = "Truthy"; + TypeFacts[TypeFacts["Falsy"] = 2097152] = "Falsy"; + TypeFacts[TypeFacts["All"] = 4194303] = "All"; + // The following members encode facts about particular kinds of types for use in the getTypeFacts function. + // The presence of a particular fact means that the given test is true for some (and possibly all) values + // of that kind of type. + TypeFacts[TypeFacts["StringStrictFacts"] = 4079361] = "StringStrictFacts"; + TypeFacts[TypeFacts["StringFacts"] = 4194049] = "StringFacts"; + TypeFacts[TypeFacts["NumberStrictFacts"] = 4079234] = "NumberStrictFacts"; + TypeFacts[TypeFacts["NumberFacts"] = 4193922] = "NumberFacts"; + TypeFacts[TypeFacts["BooleanStrictFacts"] = 4078980] = "BooleanStrictFacts"; + TypeFacts[TypeFacts["BooleanFacts"] = 4193668] = "BooleanFacts"; + TypeFacts[TypeFacts["SymbolStrictFacts"] = 1981320] = "SymbolStrictFacts"; + TypeFacts[TypeFacts["SymbolFacts"] = 4193160] = "SymbolFacts"; + TypeFacts[TypeFacts["ObjectStrictFacts"] = 1972176] = "ObjectStrictFacts"; + TypeFacts[TypeFacts["ObjectFacts"] = 4184016] = "ObjectFacts"; + TypeFacts[TypeFacts["FunctionStrictFacts"] = 1970144] = "FunctionStrictFacts"; + TypeFacts[TypeFacts["FunctionFacts"] = 4181984] = "FunctionFacts"; + TypeFacts[TypeFacts["UndefinedFacts"] = 2457472] = "UndefinedFacts"; + TypeFacts[TypeFacts["NullFacts"] = 2340752] = "NullFacts"; + })(TypeFacts || (TypeFacts = {})); + var typeofEQFacts = { + "string": 1 /* TypeofEQString */, + "number": 2 /* TypeofEQNumber */, + "boolean": 4 /* TypeofEQBoolean */, + "symbol": 8 /* TypeofEQSymbol */, + "undefined": 16384 /* EQUndefined */, + "object": 16 /* TypeofEQObject */, + "function": 32 /* TypeofEQFunction */ }; + var typeofNEFacts = { + "string": 128 /* TypeofNEString */, + "number": 256 /* TypeofNENumber */, + "boolean": 512 /* TypeofNEBoolean */, + "symbol": 1024 /* TypeofNESymbol */, + "undefined": 131072 /* NEUndefined */, + "object": 2048 /* TypeofNEObject */, + "function": 4096 /* TypeofNEFunction */ + }; + var typeofTypesByName = { + "string": stringType, + "number": numberType, + "boolean": booleanType, + "symbol": esSymbolType, + "undefined": undefinedType + }; + var jsxElementType; + /** Things we lazy load from the JSX namespace */ + var jsxTypes = {}; var JsxNames = { JSX: "JSX", IntrinsicElements: "IntrinsicElements", ElementClass: "ElementClass", ElementAttributesPropertyNameContainer: "ElementAttributesProperty", - Element: "Element" + Element: "Element", + IntrinsicAttributes: "IntrinsicAttributes", + IntrinsicClassAttributes: "IntrinsicClassAttributes" }; var subtypeRelation = {}; var assignableRelation = {}; + var comparableRelation = {}; var identityRelation = {}; // This is for caching the result of getSymbolDisplayBuilder. Do not access directly. var _displayBuilder; @@ -14040,6 +15667,10 @@ var ts; TypeSystemPropertyName[TypeSystemPropertyName["DeclaredType"] = 2] = "DeclaredType"; TypeSystemPropertyName[TypeSystemPropertyName["ResolvedReturnType"] = 3] = "ResolvedReturnType"; })(TypeSystemPropertyName || (TypeSystemPropertyName = {})); + var builtinGlobals = (_a = {}, + _a[undefinedSymbol.name] = undefinedSymbol, + _a + ); initializeTypeChecker(); return checker; function getEmitResolver(sourceFile, cancellationToken) { @@ -14095,8 +15726,10 @@ var ts; return result; } function recordMergedSymbol(target, source) { - if (!source.mergeId) - source.mergeId = nextMergeId++; + if (!source.mergeId) { + source.mergeId = nextMergeId; + nextMergeId++; + } mergedSymbols[source.mergeId] = target; } function cloneSymbol(symbol) { @@ -14121,8 +15754,12 @@ var ts; target.constEnumOnlyModule = false; } target.flags |= source.flags; - if (!target.valueDeclaration && source.valueDeclaration) + if (source.valueDeclaration && + (!target.valueDeclaration || + (target.valueDeclaration.kind === 225 /* ModuleDeclaration */ && source.valueDeclaration.kind !== 225 /* ModuleDeclaration */))) { + // other kinds of value declarations take precedence over modules target.valueDeclaration = source.valueDeclaration; + } ts.forEach(source.declarations, function (node) { target.declarations.push(node); }); @@ -14139,13 +15776,13 @@ var ts; recordMergedSymbol(target, source); } else { - var message = target.flags & 2 /* BlockScopedVariable */ || source.flags & 2 /* BlockScopedVariable */ + var message_2 = target.flags & 2 /* BlockScopedVariable */ || source.flags & 2 /* BlockScopedVariable */ ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0; ts.forEach(source.declarations, function (node) { - error(node.name ? node.name : node, message, symbolToString(source)); + error(node.name ? node.name : node, message_2, symbolToString(source)); }); ts.forEach(target.declarations, function (node) { - error(node.name ? node.name : node, message, symbolToString(source)); + error(node.name ? node.name : node, message_2, symbolToString(source)); }); } } @@ -14174,6 +15811,57 @@ var ts; } } } + function mergeModuleAugmentation(moduleName) { + var moduleAugmentation = moduleName.parent; + if (moduleAugmentation.symbol.declarations[0] !== moduleAugmentation) { + // this is a combined symbol for multiple augmentations within the same file. + // its symbol already has accumulated information for all declarations + // so we need to add it just once - do the work only for first declaration + ts.Debug.assert(moduleAugmentation.symbol.declarations.length > 1); + return; + } + if (ts.isGlobalScopeAugmentation(moduleAugmentation)) { + mergeSymbolTable(globals, moduleAugmentation.symbol.exports); + } + else { + // find a module that about to be augmented + // do not validate names of augmentations that are defined in ambient context + var moduleNotFoundError = !ts.isInAmbientContext(moduleName.parent.parent) + ? ts.Diagnostics.Invalid_module_name_in_augmentation_module_0_cannot_be_found + : undefined; + var mainModule = resolveExternalModuleNameWorker(moduleName, moduleName, moduleNotFoundError); + if (!mainModule) { + return; + } + // obtain item referenced by 'export=' + mainModule = resolveExternalModuleSymbol(mainModule); + if (mainModule.flags & 1536 /* Namespace */) { + // if module symbol has already been merged - it is safe to use it. + // otherwise clone it + mainModule = mainModule.flags & 33554432 /* Merged */ ? mainModule : cloneSymbol(mainModule); + mergeSymbol(mainModule, moduleAugmentation.symbol); + } + else { + error(moduleName, ts.Diagnostics.Cannot_augment_module_0_because_it_resolves_to_a_non_module_entity, moduleName.text); + } + } + } + function addToSymbolTable(target, source, message) { + for (var id in source) { + if (ts.hasProperty(source, id)) { + if (ts.hasProperty(target, id)) { + // Error on redeclarations + ts.forEach(target[id].declarations, addDeclarationDiagnostic(id, message)); + } + else { + target[id] = source[id]; + } + } + } + function addDeclarationDiagnostic(id, message) { + return function (declaration) { return diagnostics.add(ts.createDiagnosticForNode(declaration, message, id)); }; + } + } function getSymbolLinks(symbol) { if (symbol.flags & 67108864 /* Transient */) return symbol; @@ -14184,11 +15872,8 @@ var ts; var nodeId = getNodeId(node); return nodeLinks[nodeId] || (nodeLinks[nodeId] = {}); } - function getSourceFile(node) { - return ts.getAncestor(node, 248 /* SourceFile */); - } function isGlobalSourceFile(node) { - return node.kind === 248 /* SourceFile */ && !ts.isExternalOrCommonJsModule(node); + return node.kind === 256 /* SourceFile */ && !ts.isExternalOrCommonJsModule(node); } function getSymbol(symbols, name, meaning) { if (meaning && ts.hasProperty(symbols, name)) { @@ -14207,6 +15892,22 @@ var ts; } // return undefined if we can't find a symbol. } + /** + * Get symbols that represent parameter-property-declaration as parameter and as property declaration + * @param parameter a parameterDeclaration node + * @param parameterName a name of the parameter to get the symbols for. + * @return a tuple of two symbols + */ + function getSymbolsOfParameterPropertyDeclaration(parameter, parameterName) { + var constructorDeclaration = parameter.parent; + var classDeclaration = parameter.parent.parent; + var parameterSymbol = getSymbol(constructorDeclaration.locals, parameterName, 107455 /* Value */); + var propertySymbol = getSymbol(classDeclaration.symbol.members, parameterName, 107455 /* Value */); + if (parameterSymbol && propertySymbol) { + return [parameterSymbol, propertySymbol]; + } + ts.Debug.fail("There should exist two symbols, one as property declaration and one as parameter declaration"); + } function isBlockScopedNameDeclaredBeforeUse(declaration, usage) { var declarationFile = ts.getSourceFileOfNode(declaration); var useFile = ts.getSourceFileOfNode(usage); @@ -14221,7 +15922,7 @@ var ts; if (declaration.pos <= usage.pos) { // declaration is before usage // still might be illegal if usage is in the initializer of the variable declaration - return declaration.kind !== 211 /* VariableDeclaration */ || + return declaration.kind !== 218 /* VariableDeclaration */ || !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage); } // declaration is after usage @@ -14229,18 +15930,26 @@ var ts; return isUsedInFunctionOrNonStaticProperty(declaration, usage); function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage) { var container = ts.getEnclosingBlockScopeContainer(declaration); - if (declaration.parent.parent.kind === 193 /* VariableStatement */ || - declaration.parent.parent.kind === 199 /* ForStatement */) { - // variable statement/for statement case, - // use site should not be inside variable declaration (initializer of declaration or binding element) - return isSameScopeDescendentOf(usage, declaration, container); + switch (declaration.parent.parent.kind) { + case 200 /* VariableStatement */: + case 206 /* ForStatement */: + case 208 /* ForOfStatement */: + // variable statement/for/for-of statement case, + // use site should not be inside variable declaration (initializer of declaration or binding element) + if (isSameScopeDescendentOf(usage, declaration, container)) { + return true; + } + break; } - else if (declaration.parent.parent.kind === 201 /* ForOfStatement */ || - declaration.parent.parent.kind === 200 /* ForInStatement */) { - // ForIn/ForOf case - use site should not be used in expression part - var expression = declaration.parent.parent.expression; - return isSameScopeDescendentOf(usage, expression, container); + switch (declaration.parent.parent.kind) { + case 207 /* ForInStatement */: + case 208 /* ForOfStatement */: + // ForIn/ForOf case - use site should not be used in expression part + if (isSameScopeDescendentOf(usage, declaration.parent.parent.expression, container)) { + return true; + } } + return false; } function isUsedInFunctionOrNonStaticProperty(declaration, usage) { var container = ts.getEnclosingBlockScopeContainer(declaration); @@ -14253,8 +15962,8 @@ var ts; return true; } var initializerOfNonStaticProperty = current.parent && - current.parent.kind === 141 /* PropertyDeclaration */ && - (current.parent.flags & 64 /* Static */) === 0 && + current.parent.kind === 145 /* PropertyDeclaration */ && + (current.parent.flags & 32 /* Static */) === 0 && current.parent.initializer === current; if (initializerOfNonStaticProperty) { return true; @@ -14277,25 +15986,47 @@ var ts; // Locals of a source file are not in scope (because they get merged into the global symbol table) if (location.locals && !isGlobalSourceFile(location)) { if (result = getSymbol(location.locals, name, meaning)) { - // Type parameters of a function are in scope in the entire function declaration, including the parameter - // list and return type. However, local types are only in scope in the function body. - if (!(meaning & 793056 /* Type */) || - !(result.flags & (793056 /* Type */ & ~262144 /* TypeParameter */)) || - !ts.isFunctionLike(location) || - lastLocation === location.body) { + var useResult = true; + if (ts.isFunctionLike(location) && lastLocation && lastLocation !== location.body) { + // symbol lookup restrictions for function-like declarations + // - Type parameters of a function are in scope in the entire function declaration, including the parameter + // list and return type. However, local types are only in scope in the function body. + // - parameters are only in the scope of function body + // This restriction does not apply to JSDoc comment types because they are parented + // at a higher level than type parameters would normally be + if (meaning & result.flags & 793056 /* Type */ && lastLocation.kind !== 273 /* JSDocComment */) { + useResult = result.flags & 262144 /* TypeParameter */ + ? lastLocation === location.type || + lastLocation.kind === 142 /* Parameter */ || + lastLocation.kind === 141 /* TypeParameter */ + : false; + } + if (meaning & 107455 /* Value */ && result.flags & 1 /* FunctionScopedVariable */) { + // parameters are visible only inside function body, parameter list and return type + // technically for parameter list case here we might mix parameters and variables declared in function, + // however it is detected separately when checking initializers of parameters + // to make sure that they reference no variables declared after them. + useResult = + lastLocation.kind === 142 /* Parameter */ || + (lastLocation === location.type && + result.valueDeclaration.kind === 142 /* Parameter */); + } + } + if (useResult) { break loop; } - result = undefined; + else { + result = undefined; + } } } switch (location.kind) { - case 248 /* SourceFile */: + case 256 /* SourceFile */: if (!ts.isExternalOrCommonJsModule(location)) break; - case 218 /* ModuleDeclaration */: + case 225 /* ModuleDeclaration */: var moduleExports = getSymbolOfNode(location).exports; - if (location.kind === 248 /* SourceFile */ || - (location.kind === 218 /* ModuleDeclaration */ && location.name.kind === 9 /* StringLiteral */)) { + if (location.kind === 256 /* SourceFile */ || ts.isAmbientModule(location)) { // It's an external module. First see if the module has an export default and if the local // name of that export default matches. if (result = moduleExports["default"]) { @@ -14306,7 +16037,7 @@ var ts; result = undefined; } // Because of module/namespace merging, a module's exports are in scope, - // yet we never want to treat an export specifier as putting a member in scope. + // yet we never want to treat an export specifier as putting a member in scope. // Therefore, if the name we find is purely an export specifier, it is not actually considered in scope. // Two things to note about this: // 1. We have to check this without calling getSymbol. The problem with calling getSymbol @@ -14318,7 +16049,7 @@ var ts; // which is not the desired behavior. if (ts.hasProperty(moduleExports, name) && moduleExports[name].flags === 8388608 /* Alias */ && - ts.getDeclarationOfKind(moduleExports[name], 230 /* ExportSpecifier */)) { + ts.getDeclarationOfKind(moduleExports[name], 238 /* ExportSpecifier */)) { break; } } @@ -14326,20 +16057,20 @@ var ts; break loop; } break; - case 217 /* EnumDeclaration */: + case 224 /* EnumDeclaration */: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8 /* EnumMember */)) { break loop; } break; - case 141 /* PropertyDeclaration */: - case 140 /* PropertySignature */: + case 145 /* PropertyDeclaration */: + case 144 /* PropertySignature */: // TypeScript 1.0 spec (April 2014): 8.4.1 // Initializer expressions for instance member variables are evaluated in the scope // of the class constructor body but are not permitted to reference parameters or // local variables of the constructor. This effectively means that entities from outer scopes // by the same name as a constructor parameter or local variable are inaccessible // in initializer expressions for instance member variables. - if (ts.isClassLike(location.parent) && !(location.flags & 64 /* Static */)) { + if (ts.isClassLike(location.parent) && !(location.flags & 32 /* Static */)) { var ctor = findConstructorDeclaration(location.parent); if (ctor && ctor.locals) { if (getSymbol(ctor.locals, name, meaning & 107455 /* Value */)) { @@ -14349,11 +16080,11 @@ var ts; } } break; - case 214 /* ClassDeclaration */: - case 186 /* ClassExpression */: - case 215 /* InterfaceDeclaration */: + case 221 /* ClassDeclaration */: + case 192 /* ClassExpression */: + case 222 /* InterfaceDeclaration */: if (result = getSymbol(getSymbolOfNode(location).members, name, meaning & 793056 /* Type */)) { - if (lastLocation && lastLocation.flags & 64 /* Static */) { + if (lastLocation && lastLocation.flags & 32 /* Static */) { // TypeScript 1.0 spec (April 2014): 3.4.1 // The scope of a type parameter extends over the entire declaration with which the type // parameter list is associated, with the exception of static member declarations in classes. @@ -14362,7 +16093,7 @@ var ts; } break loop; } - if (location.kind === 186 /* ClassExpression */ && meaning & 32 /* Class */) { + if (location.kind === 192 /* ClassExpression */ && meaning & 32 /* Class */) { var className = location.name; if (className && name === className.text) { result = location.symbol; @@ -14378,9 +16109,9 @@ var ts; // [foo()]() { } // <-- Reference to T from class's own computed property // } // - case 136 /* ComputedPropertyName */: + case 140 /* ComputedPropertyName */: grandparent = location.parent.parent; - if (ts.isClassLike(grandparent) || grandparent.kind === 215 /* InterfaceDeclaration */) { + if (ts.isClassLike(grandparent) || grandparent.kind === 222 /* InterfaceDeclaration */) { // A reference to this grandparent's type parameters would be an error if (result = getSymbol(getSymbolOfNode(grandparent).members, name, meaning & 793056 /* Type */)) { error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); @@ -14388,19 +16119,19 @@ var ts; } } break; - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - case 144 /* Constructor */: - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: - case 213 /* FunctionDeclaration */: - case 174 /* ArrowFunction */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: + case 148 /* Constructor */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: + case 220 /* FunctionDeclaration */: + case 180 /* ArrowFunction */: if (meaning & 3 /* Variable */ && name === "arguments") { result = argumentsSymbol; break loop; } break; - case 173 /* FunctionExpression */: + case 179 /* FunctionExpression */: if (meaning & 3 /* Variable */ && name === "arguments") { result = argumentsSymbol; break loop; @@ -14413,7 +16144,7 @@ var ts; } } break; - case 139 /* Decorator */: + case 143 /* Decorator */: // Decorators are resolved at the class declaration. Resolving at the parameter // or member would result in looking up locals in the method. // @@ -14422,7 +16153,7 @@ var ts; // method(@y x, y) {} // <-- decorator y should be resolved at the class declaration, not the parameter. // } // - if (location.parent && location.parent.kind === 138 /* Parameter */) { + if (location.parent && location.parent.kind === 142 /* Parameter */) { location = location.parent; } // @@ -14444,7 +16175,9 @@ var ts; } if (!result) { if (nameNotFoundMessage) { - error(errorLocation, nameNotFoundMessage, typeof nameArg === "string" ? nameArg : ts.declarationNameToString(nameArg)); + if (!checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg)) { + error(errorLocation, nameNotFoundMessage, typeof nameArg === "string" ? nameArg : ts.declarationNameToString(nameArg)); + } } return undefined; } @@ -14477,12 +16210,44 @@ var ts; } return result; } + function checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) { + if (!errorLocation || (errorLocation.kind === 69 /* Identifier */ && (isTypeReferenceIdentifier(errorLocation)) || isInTypeQuery(errorLocation))) { + return false; + } + var container = ts.getThisContainer(errorLocation, /* includeArrowFunctions */ true); + var location = container; + while (location) { + if (ts.isClassLike(location.parent)) { + var classSymbol = getSymbolOfNode(location.parent); + if (!classSymbol) { + break; + } + // Check to see if a static member exists. + var constructorType = getTypeOfSymbol(classSymbol); + if (getPropertyOfType(constructorType, name)) { + error(errorLocation, ts.Diagnostics.Cannot_find_name_0_Did_you_mean_the_static_member_1_0, typeof nameArg === "string" ? nameArg : ts.declarationNameToString(nameArg), symbolToString(classSymbol)); + return true; + } + // No static member is present. + // Check if we're in an instance method and look for a relevant instance member. + if (location === container && !(location.flags & 32 /* Static */)) { + var instanceType = getDeclaredTypeOfSymbol(classSymbol).thisType; + if (getPropertyOfType(instanceType, name)) { + error(errorLocation, ts.Diagnostics.Cannot_find_name_0_Did_you_mean_the_instance_member_this_0, typeof nameArg === "string" ? nameArg : ts.declarationNameToString(nameArg)); + return true; + } + } + } + location = location.parent; + } + return false; + } function checkResolvedBlockScopedVariable(result, errorLocation) { ts.Debug.assert((result.flags & 2 /* BlockScopedVariable */) !== 0); // Block-scoped variables cannot be used before their definition var declaration = ts.forEach(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) ? d : undefined; }); ts.Debug.assert(declaration !== undefined, "Block-scoped variable declaration is undefined"); - if (!isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 211 /* VariableDeclaration */), errorLocation)) { + if (!isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 218 /* VariableDeclaration */), errorLocation)) { error(errorLocation, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, ts.declarationNameToString(declaration.name)); } } @@ -14503,10 +16268,10 @@ var ts; } function getAnyImportSyntax(node) { if (ts.isAliasSymbolDeclaration(node)) { - if (node.kind === 221 /* ImportEqualsDeclaration */) { + if (node.kind === 229 /* ImportEqualsDeclaration */) { return node; } - while (node && node.kind !== 222 /* ImportDeclaration */) { + while (node && node.kind !== 230 /* ImportDeclaration */) { node = node.parent; } return node; @@ -14516,7 +16281,7 @@ var ts; return ts.forEach(symbol.declarations, function (d) { return ts.isAliasSymbolDeclaration(d) ? d : undefined; }); } function getTargetOfImportEqualsDeclaration(node) { - if (node.moduleReference.kind === 232 /* ExternalModuleReference */) { + if (node.moduleReference.kind === 240 /* ExternalModuleReference */) { return resolveExternalModuleSymbol(resolveExternalModuleName(node, ts.getExternalModuleImportEqualsDeclarationExpression(node))); } return getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference, node); @@ -14524,10 +16289,15 @@ var ts; function getTargetOfImportClause(node) { var moduleSymbol = resolveExternalModuleName(node, node.parent.moduleSpecifier); if (moduleSymbol) { - var exportDefaultSymbol = resolveSymbol(moduleSymbol.exports["default"]); - if (!exportDefaultSymbol) { + var exportDefaultSymbol = moduleSymbol.exports["export="] ? + getPropertyOfType(getTypeOfSymbol(moduleSymbol.exports["export="]), "default") : + resolveSymbol(moduleSymbol.exports["default"]); + if (!exportDefaultSymbol && !allowSyntheticDefaultImports) { error(node.name, ts.Diagnostics.Module_0_has_no_default_export, symbolToString(moduleSymbol)); } + else if (!exportDefaultSymbol && allowSyntheticDefaultImports) { + return resolveExternalModuleSymbol(moduleSymbol) || resolveSymbol(moduleSymbol); + } return exportDefaultSymbol; } } @@ -14535,14 +16305,6 @@ var ts; var moduleSpecifier = node.parent.parent.moduleSpecifier; return resolveESModuleSymbol(resolveExternalModuleName(node, moduleSpecifier), moduleSpecifier); } - function getMemberOfModuleVariable(moduleSymbol, name) { - if (moduleSymbol.flags & 3 /* Variable */) { - var typeAnnotation = moduleSymbol.valueDeclaration.type; - if (typeAnnotation) { - return getPropertyOfType(getTypeFromTypeNode(typeAnnotation), name); - } - } - } // This function creates a synthetic symbol that combines the value side of one symbol with the // type/namespace side of another symbol. Consider this example: // @@ -14598,8 +16360,17 @@ var ts; if (targetSymbol) { var name_9 = specifier.propertyName || specifier.name; if (name_9.text) { + var symbolFromVariable = void 0; + // First check if module was specified with "export=". If so, get the member from the resolved type + if (moduleSymbol && moduleSymbol.exports && moduleSymbol.exports["export="]) { + symbolFromVariable = getPropertyOfType(getTypeOfSymbol(targetSymbol), name_9.text); + } + else { + symbolFromVariable = getPropertyOfVariable(targetSymbol, name_9.text); + } + // if symbolFromVariable is export - get its final target + symbolFromVariable = resolveSymbol(symbolFromVariable); var symbolFromModule = getExportOfModule(targetSymbol, name_9.text); - var symbolFromVariable = getPropertyOfVariable(targetSymbol, name_9.text); var symbol = symbolFromModule && symbolFromVariable ? combineValueAndTypeSymbols(symbolFromVariable, symbolFromModule) : symbolFromModule || symbolFromVariable; @@ -14613,6 +16384,9 @@ var ts; function getTargetOfImportSpecifier(node) { return getExternalModuleMember(node.parent.parent.parent, node); } + function getTargetOfGlobalModuleExportDeclaration(node) { + return resolveExternalModuleSymbol(node.parent.symbol); + } function getTargetOfExportSpecifier(node) { return node.parent.parent.moduleSpecifier ? getExternalModuleMember(node.parent.parent, node) : @@ -14623,18 +16397,20 @@ var ts; } function getTargetOfAliasDeclaration(node) { switch (node.kind) { - case 221 /* ImportEqualsDeclaration */: + case 229 /* ImportEqualsDeclaration */: return getTargetOfImportEqualsDeclaration(node); - case 223 /* ImportClause */: + case 231 /* ImportClause */: return getTargetOfImportClause(node); - case 224 /* NamespaceImport */: + case 232 /* NamespaceImport */: return getTargetOfNamespaceImport(node); - case 226 /* ImportSpecifier */: + case 234 /* ImportSpecifier */: return getTargetOfImportSpecifier(node); - case 230 /* ExportSpecifier */: + case 238 /* ExportSpecifier */: return getTargetOfExportSpecifier(node); - case 227 /* ExportAssignment */: + case 235 /* ExportAssignment */: return getTargetOfExportAssignment(node); + case 228 /* GlobalModuleExportDeclaration */: + return getTargetOfGlobalModuleExportDeclaration(node); } } function resolveSymbol(symbol) { @@ -14663,8 +16439,8 @@ var ts; var symbol = getSymbolOfNode(node); var target = resolveAlias(symbol); if (target) { - var markAlias = (target === unknownSymbol && compilerOptions.isolatedModules) || - (target !== unknownSymbol && (target.flags & 107455 /* Value */) && !isConstEnumOrConstEnumOnlyModule(target)); + var markAlias = target === unknownSymbol || + ((target.flags & 107455 /* Value */) && !isConstEnumOrConstEnumOnlyModule(target)); if (markAlias) { markAliasSymbolAsReferenced(symbol); } @@ -14678,11 +16454,11 @@ var ts; if (!links.referenced) { links.referenced = true; var node = getDeclarationOfAliasSymbol(symbol); - if (node.kind === 227 /* ExportAssignment */) { + if (node.kind === 235 /* ExportAssignment */) { // export default checkExpressionCached(node.expression); } - else if (node.kind === 230 /* ExportSpecifier */) { + else if (node.kind === 238 /* ExportSpecifier */) { // export { } or export { as foo } checkExpressionCached(node.propertyName || node.name); } @@ -14695,7 +16471,7 @@ var ts; // This function is only for imports with entity names function getSymbolOfPartOfRightHandSideOfImportEquals(entityName, importDeclaration) { if (!importDeclaration) { - importDeclaration = ts.getAncestor(entityName, 221 /* ImportEqualsDeclaration */); + importDeclaration = ts.getAncestor(entityName, 229 /* ImportEqualsDeclaration */); ts.Debug.assert(importDeclaration !== undefined); } // There are three things we might try to look for. In the following examples, @@ -14708,13 +16484,13 @@ var ts; entityName = entityName.parent; } // Check for case 1 and 3 in the above example - if (entityName.kind === 69 /* Identifier */ || entityName.parent.kind === 135 /* QualifiedName */) { + if (entityName.kind === 69 /* Identifier */ || entityName.parent.kind === 139 /* QualifiedName */) { return resolveEntityName(entityName, 1536 /* Namespace */); } else { // Case 2 in above example // entityName.kind could be a QualifiedName or a Missing identifier - ts.Debug.assert(entityName.parent.kind === 221 /* ImportEqualsDeclaration */); + ts.Debug.assert(entityName.parent.kind === 229 /* ImportEqualsDeclaration */); return resolveEntityName(entityName, 107455 /* Value */ | 793056 /* Type */ | 1536 /* Namespace */); } } @@ -14734,9 +16510,9 @@ var ts; return undefined; } } - else if (name.kind === 135 /* QualifiedName */ || name.kind === 166 /* PropertyAccessExpression */) { - var left = name.kind === 135 /* QualifiedName */ ? name.left : name.expression; - var right = name.kind === 135 /* QualifiedName */ ? name.right : name.name; + else if (name.kind === 139 /* QualifiedName */ || name.kind === 172 /* PropertyAccessExpression */) { + var left = name.kind === 139 /* QualifiedName */ ? name.left : name.expression; + var right = name.kind === 139 /* QualifiedName */ ? name.right : name.name; var namespace = resolveEntityName(left, 1536 /* Namespace */, ignoreErrors); if (!namespace || namespace === unknownSymbol || ts.nodeIsMissing(right)) { return undefined; @@ -14756,42 +16532,50 @@ var ts; return symbol.flags & meaning ? symbol : resolveAlias(symbol); } function resolveExternalModuleName(location, moduleReferenceExpression) { + return resolveExternalModuleNameWorker(location, moduleReferenceExpression, ts.Diagnostics.Cannot_find_module_0); + } + function resolveExternalModuleNameWorker(location, moduleReferenceExpression, moduleNotFoundError) { if (moduleReferenceExpression.kind !== 9 /* StringLiteral */) { return; } var moduleReferenceLiteral = moduleReferenceExpression; - var searchPath = ts.getDirectoryPath(getSourceFile(location).fileName); // Module names are escaped in our symbol table. However, string literal values aren't. // Escape the name in the "require(...)" clause to ensure we find the right symbol. var moduleName = ts.escapeIdentifier(moduleReferenceLiteral.text); if (moduleName === undefined) { return; } - if (moduleName.indexOf("!") >= 0) { - moduleName = moduleName.substr(0, moduleName.indexOf("!")); - } var isRelative = ts.isExternalModuleNameRelative(moduleName); if (!isRelative) { - var symbol = getSymbol(globals, "\"" + moduleName + "\"", 512 /* ValueModule */); + var symbol = getSymbol(globals, '"' + moduleName + '"', 512 /* ValueModule */); if (symbol) { - return symbol; + // merged symbol is module declaration symbol combined with all augmentations + return getMergedSymbol(symbol); } } - var resolvedModule = ts.getResolvedModule(getSourceFile(location), moduleReferenceLiteral.text); + var resolvedModule = ts.getResolvedModule(ts.getSourceFileOfNode(location), moduleReferenceLiteral.text); var sourceFile = resolvedModule && host.getSourceFile(resolvedModule.resolvedFileName); if (sourceFile) { if (sourceFile.symbol) { - return sourceFile.symbol; + // merged symbol is module declaration symbol combined with all augmentations + return getMergedSymbol(sourceFile.symbol); } - error(moduleReferenceLiteral, ts.Diagnostics.File_0_is_not_a_module, sourceFile.fileName); - return; + if (moduleNotFoundError) { + // report errors only if it was requested + error(moduleReferenceLiteral, ts.Diagnostics.File_0_is_not_a_module, sourceFile.fileName); + } + return undefined; } - error(moduleReferenceLiteral, ts.Diagnostics.Cannot_find_module_0, moduleName); + if (moduleNotFoundError) { + // report errors only if it was requested + error(moduleReferenceLiteral, moduleNotFoundError, moduleName); + } + return undefined; } // An external module with an 'export =' declaration resolves to the target of the 'export =' declaration, // and an external module with no 'export =' declaration resolves to the module itself. function resolveExternalModuleSymbol(moduleSymbol) { - return moduleSymbol && resolveSymbol(moduleSymbol.exports["export="]) || moduleSymbol; + return moduleSymbol && getMergedSymbol(resolveSymbol(moduleSymbol.exports["export="])) || moduleSymbol; } // An external module with an 'export =' declaration may be referenced as an ES6 module provided the 'export =' // references a symbol that is at least declared as a module or a variable. The target of the 'export =' may @@ -14804,8 +16588,8 @@ var ts; } return symbol; } - function getExportAssignmentSymbol(moduleSymbol) { - return moduleSymbol.exports["export="]; + function hasExportAssignmentSymbol(moduleSymbol) { + return moduleSymbol.exports["export="] !== undefined; } function getExportsOfModuleAsArray(moduleSymbol) { return symbolsToArray(getExportsOfModule(moduleSymbol)); @@ -14817,38 +16601,66 @@ var ts; var links = getSymbolLinks(moduleSymbol); return links.resolvedExports || (links.resolvedExports = getExportsForModule(moduleSymbol)); } - function extendExportSymbols(target, source) { + /** + * Extends one symbol table with another while collecting information on name collisions for error message generation into the `lookupTable` argument + * Not passing `lookupTable` and `exportNode` disables this collection, and just extends the tables + */ + function extendExportSymbols(target, source, lookupTable, exportNode) { for (var id in source) { if (id !== "default" && !ts.hasProperty(target, id)) { target[id] = source[id]; + if (lookupTable && exportNode) { + lookupTable[id] = { + specifierText: ts.getTextOfNode(exportNode.moduleSpecifier) + }; + } + } + else if (lookupTable && exportNode && id !== "default" && ts.hasProperty(target, id) && resolveSymbol(target[id]) !== resolveSymbol(source[id])) { + if (!lookupTable[id].exportsWithDuplicate) { + lookupTable[id].exportsWithDuplicate = [exportNode]; + } + else { + lookupTable[id].exportsWithDuplicate.push(exportNode); + } } } } function getExportsForModule(moduleSymbol) { - var result; var visitedSymbols = []; - visit(moduleSymbol); - return result || moduleSymbol.exports; + return visit(moduleSymbol) || moduleSymbol.exports; // The ES6 spec permits export * declarations in a module to circularly reference the module itself. For example, // module 'a' can 'export * from "b"' and 'b' can 'export * from "a"' without error. function visit(symbol) { - if (symbol && symbol.flags & 1952 /* HasExports */ && !ts.contains(visitedSymbols, symbol)) { - visitedSymbols.push(symbol); - if (symbol !== moduleSymbol) { - if (!result) { - result = cloneSymbolTable(moduleSymbol.exports); - } - extendExportSymbols(result, symbol.exports); - } - // All export * declarations are collected in an __export symbol by the binder - var exportStars = symbol.exports["__export"]; - if (exportStars) { - for (var _i = 0, _a = exportStars.declarations; _i < _a.length; _i++) { - var node = _a[_i]; - visit(resolveExternalModuleName(node, node.moduleSpecifier)); - } - } + if (!(symbol && symbol.flags & 1952 /* HasExports */ && !ts.contains(visitedSymbols, symbol))) { + return; } + visitedSymbols.push(symbol); + var symbols = cloneSymbolTable(symbol.exports); + // All export * declarations are collected in an __export symbol by the binder + var exportStars = symbol.exports["__export"]; + if (exportStars) { + var nestedSymbols = {}; + var lookupTable = {}; + for (var _i = 0, _a = exportStars.declarations; _i < _a.length; _i++) { + var node = _a[_i]; + var resolvedModule = resolveExternalModuleName(node, node.moduleSpecifier); + var exportedSymbols = visit(resolvedModule); + extendExportSymbols(nestedSymbols, exportedSymbols, lookupTable, node); + } + for (var id in lookupTable) { + var exportsWithDuplicate = lookupTable[id].exportsWithDuplicate; + // It's not an error if the file with multiple `export *`s with duplicate names exports a member with that name itself + if (id === "export=" || !(exportsWithDuplicate && exportsWithDuplicate.length) || ts.hasProperty(symbols, id)) { + continue; + } + for (var _b = 0, exportsWithDuplicate_1 = exportsWithDuplicate; _b < exportsWithDuplicate_1.length; _b++) { + var node = exportsWithDuplicate_1[_b]; + diagnostics.add(ts.createDiagnosticForNode(node, ts.Diagnostics.Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambiguity, lookupTable[id].specifierText, id)); + } + } + extendExportSymbols(symbols, nestedSymbols); + } + return symbols; } } function getMergedSymbol(symbol) { @@ -14886,14 +16698,15 @@ var ts; var members = node.members; for (var _i = 0, members_1 = members; _i < members_1.length; _i++) { var member = members_1[_i]; - if (member.kind === 144 /* Constructor */ && ts.nodeIsPresent(member.body)) { + if (member.kind === 148 /* Constructor */ && ts.nodeIsPresent(member.body)) { return member; } } } function createType(flags) { var result = new Type(checker, flags); - result.id = typeCount++; + result.id = typeCount; + typeCount++; return result; } function createIntrinsicType(kind, intrinsicName) { @@ -14932,19 +16745,19 @@ var ts; } return result || emptyArray; } - function setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexType, numberIndexType) { + function setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo) { type.members = members; type.properties = getNamedMembers(members); type.callSignatures = callSignatures; type.constructSignatures = constructSignatures; - if (stringIndexType) - type.stringIndexType = stringIndexType; - if (numberIndexType) - type.numberIndexType = numberIndexType; + if (stringIndexInfo) + type.stringIndexInfo = stringIndexInfo; + if (numberIndexInfo) + type.numberIndexInfo = numberIndexInfo; return type; } - function createAnonymousType(symbol, members, callSignatures, constructSignatures, stringIndexType, numberIndexType) { - return setObjectTypeMembers(createObjectType(65536 /* Anonymous */, symbol), members, callSignatures, constructSignatures, stringIndexType, numberIndexType); + function createAnonymousType(symbol, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo) { + return setObjectTypeMembers(createObjectType(65536 /* Anonymous */, symbol), members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo); } function forEachSymbolTableInScope(enclosingDeclaration, callback) { var result; @@ -14956,21 +16769,15 @@ var ts; } } switch (location_1.kind) { - case 248 /* SourceFile */: + case 256 /* SourceFile */: if (!ts.isExternalOrCommonJsModule(location_1)) { break; } - case 218 /* ModuleDeclaration */: + case 225 /* ModuleDeclaration */: if (result = callback(getSymbolOfNode(location_1).exports)) { return result; } break; - case 214 /* ClassDeclaration */: - case 215 /* InterfaceDeclaration */: - if (result = callback(getSymbolOfNode(location_1).members)) { - return result; - } - break; } } return callback(globals); @@ -14993,7 +16800,7 @@ var ts; function isAccessible(symbolFromSymbolTable, resolvedAliasSymbol) { if (symbol === (resolvedAliasSymbol || symbolFromSymbolTable)) { // if the symbolFromSymbolTable is not external module (it could be if it was determined as ambient external module and would be in globals table) - // and if symbolfrom symbolTable or alias resolution matches the symbol, + // and if symbolFromSymbolTable or alias resolution matches the symbol, // check the symbol can be qualified, it is only then this symbol is accessible return !ts.forEach(symbolFromSymbolTable.declarations, hasExternalModuleSymbol) && canQualifySymbol(symbolFromSymbolTable, meaning); @@ -15007,7 +16814,7 @@ var ts; return ts.forEachValue(symbols, function (symbolFromSymbolTable) { if (symbolFromSymbolTable.flags & 8388608 /* Alias */ && symbolFromSymbolTable.name !== "export=" - && !ts.getDeclarationOfKind(symbolFromSymbolTable, 230 /* ExportSpecifier */)) { + && !ts.getDeclarationOfKind(symbolFromSymbolTable, 238 /* ExportSpecifier */)) { if (!useOnlyExternalAliasing || // Is this external alias, then use it to name ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { @@ -15026,7 +16833,9 @@ var ts; }); } if (symbol) { - return forEachSymbolTableInScope(enclosingDeclaration, getAccessibleSymbolChainFromSymbolTable); + if (!(isPropertyOrMethodDeclarationSymbol(symbol))) { + return forEachSymbolTableInScope(enclosingDeclaration, getAccessibleSymbolChainFromSymbolTable); + } } } function needsQualification(symbol, enclosingDeclaration, meaning) { @@ -15044,7 +16853,7 @@ var ts; return true; } // Qualify if the symbol from symbol table has same meaning as expected - symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608 /* Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 230 /* ExportSpecifier */)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; + symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608 /* Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 238 /* ExportSpecifier */)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; if (symbolFromSymbolTable.flags & meaning) { qualify = true; return true; @@ -15054,6 +16863,24 @@ var ts; }); return qualify; } + function isPropertyOrMethodDeclarationSymbol(symbol) { + if (symbol.declarations && symbol.declarations.length) { + for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { + var declaration = _a[_i]; + switch (declaration.kind) { + case 145 /* PropertyDeclaration */: + case 147 /* MethodDeclaration */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: + continue; + default: + return false; + } + } + return true; + } + return false; + } function isSymbolAccessible(symbol, enclosingDeclaration, meaning) { if (symbol && enclosingDeclaration && !(symbol.flags & 262144 /* TypeParameter */)) { var initialSymbol = symbol; @@ -15117,8 +16944,7 @@ var ts; } } function hasExternalModuleSymbol(declaration) { - return (declaration.kind === 218 /* ModuleDeclaration */ && declaration.name.kind === 9 /* StringLiteral */) || - (declaration.kind === 248 /* SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); + return ts.isAmbientModule(declaration) || (declaration.kind === 256 /* SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); } function hasVisibleDeclarations(symbol) { var aliasesToMakeVisible; @@ -15132,7 +16958,7 @@ var ts; // because these kind of aliases can be used to name types in declaration file var anyImportSyntax = getAnyImportSyntax(declaration); if (anyImportSyntax && - !(anyImportSyntax.flags & 2 /* Export */) && + !(anyImportSyntax.flags & 1 /* Export */) && isDeclarationVisible(anyImportSyntax.parent)) { getNodeLinks(declaration).isVisible = true; if (aliasesToMakeVisible) { @@ -15154,12 +16980,12 @@ var ts; function isEntityNameVisible(entityName, enclosingDeclaration) { // get symbol of the first identifier of the entityName var meaning; - if (entityName.parent.kind === 154 /* TypeQuery */) { + if (entityName.parent.kind === 158 /* TypeQuery */ || ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) { // Typeof value meaning = 107455 /* Value */ | 1048576 /* ExportValue */; } - else if (entityName.kind === 135 /* QualifiedName */ || entityName.kind === 166 /* PropertyAccessExpression */ || - entityName.parent.kind === 221 /* ImportEqualsDeclaration */) { + else if (entityName.kind === 139 /* QualifiedName */ || entityName.kind === 172 /* PropertyAccessExpression */ || + entityName.parent.kind === 229 /* ImportEqualsDeclaration */) { // Left identifier from type reference or TypeAlias // Entity name of the import declaration meaning = 1536 /* Namespace */; @@ -15193,9 +17019,9 @@ var ts; ts.releaseStringWriter(writer); return result; } - function signatureToString(signature, enclosingDeclaration, flags) { + function signatureToString(signature, enclosingDeclaration, flags, kind) { var writer = ts.getSingleLineStringWriter(); - getSymbolDisplayBuilder().buildSignatureDisplay(signature, writer, enclosingDeclaration, flags); + getSymbolDisplayBuilder().buildSignatureDisplay(signature, writer, enclosingDeclaration, flags, kind); var result = writer.string(); ts.releaseStringWriter(writer); return result; @@ -15211,18 +17037,39 @@ var ts; } return result; } + function typePredicateToString(typePredicate, enclosingDeclaration, flags) { + var writer = ts.getSingleLineStringWriter(); + getSymbolDisplayBuilder().buildTypePredicateDisplay(typePredicate, writer, enclosingDeclaration, flags); + var result = writer.string(); + ts.releaseStringWriter(writer); + return result; + } + function visibilityToString(flags) { + if (flags === 8 /* Private */) { + return "private"; + } + if (flags === 16 /* Protected */) { + return "protected"; + } + return "public"; + } function getTypeAliasForTypeLiteral(type) { if (type.symbol && type.symbol.flags & 2048 /* TypeLiteral */) { var node = type.symbol.declarations[0].parent; - while (node.kind === 160 /* ParenthesizedType */) { + while (node.kind === 164 /* ParenthesizedType */) { node = node.parent; } - if (node.kind === 216 /* TypeAliasDeclaration */) { + if (node.kind === 223 /* TypeAliasDeclaration */) { return getSymbolOfNode(node); } } return undefined; } + function isTopLevelInExternalModuleAugmentation(node) { + return node && node.parent && + node.parent.kind === 226 /* ModuleBlock */ && + ts.isExternalModuleAugmentation(node.parent.parent); + } function getSymbolDisplayBuilder() { function getNameOfSymbol(symbol) { if (symbol.declarations && symbol.declarations.length) { @@ -15231,10 +17078,10 @@ var ts; return ts.declarationNameToString(declaration.name); } switch (declaration.kind) { - case 186 /* ClassExpression */: + case 192 /* ClassExpression */: return "(Anonymous class)"; - case 173 /* FunctionExpression */: - case 174 /* ArrowFunction */: + case 179 /* FunctionExpression */: + case 180 /* ArrowFunction */: return "(Anonymous function)"; } } @@ -15242,11 +17089,35 @@ var ts; } /** * Writes only the name of the symbol out to the writer. Uses the original source text - * for the name of the symbol if it is available to match how the user inputted the name. + * for the name of the symbol if it is available to match how the user wrote the name. */ function appendSymbolNameOnly(symbol, writer) { writer.writeSymbol(getNameOfSymbol(symbol), symbol); } + /** + * Writes a property access or element access with the name of the symbol out to the writer. + * Uses the original source text for the name of the symbol if it is available to match how the user wrote the name, + * ensuring that any names written with literals use element accesses. + */ + function appendPropertyOrElementAccessForSymbol(symbol, writer) { + var symbolName = getNameOfSymbol(symbol); + var firstChar = symbolName.charCodeAt(0); + var needsElementAccess = !ts.isIdentifierStart(firstChar, languageVersion); + if (needsElementAccess) { + writePunctuation(writer, 19 /* OpenBracketToken */); + if (ts.isSingleOrDoubleQuote(firstChar)) { + writer.writeStringLiteral(symbolName); + } + else { + writer.writeSymbol(symbolName, symbol); + } + writePunctuation(writer, 20 /* CloseBracketToken */); + } + else { + writePunctuation(writer, 21 /* DotToken */); + writer.writeSymbol(symbolName, symbol); + } + } /** * Enclosing declaration is optional when we don't want to get qualified name in the enclosing declaration scope * Meaning needs to be specified if the enclosing declaration is given @@ -15264,10 +17135,12 @@ var ts; buildTypeParameterDisplayFromSymbol(parentSymbol, writer, enclosingDeclaration); } } - writePunctuation(writer, 21 /* DotToken */); + appendPropertyOrElementAccessForSymbol(symbol, writer); + } + else { + appendSymbolNameOnly(symbol, writer); } parentSymbol = symbol; - appendSymbolNameOnly(symbol, writer); } // const the writer know we just wrote out a symbol. The declaration emitter writer uses // this to determine if an import it has previously seen (and not written out) needs @@ -15321,7 +17194,7 @@ var ts; return writeType(type, globalFlags); function writeType(type, flags) { // Write undefined/null type as any - if (type.flags & 16777343 /* Intrinsic */) { + if (type.flags & 150995071 /* Intrinsic */) { // Special handling for unknown / resolving types, they should show up as any and not unknown or __resolving writer.writeKeyword(!(globalFlags & 16 /* WriteOwnNameForAnyLike */) && isTypeAny(type) ? "any" @@ -15381,11 +17254,13 @@ var ts; } if (pos < end) { writePunctuation(writer, 25 /* LessThanToken */); - writeType(typeArguments[pos++], 0 /* None */); + writeType(typeArguments[pos], 256 /* InFirstTypeArgument */); + pos++; while (pos < end) { writePunctuation(writer, 24 /* CommaToken */); writeSpace(writer); - writeType(typeArguments[pos++], 0 /* None */); + writeType(typeArguments[pos], 0 /* None */); + pos++; } writePunctuation(writer, 27 /* GreaterThanToken */); } @@ -15408,14 +17283,14 @@ var ts; while (i < length_1) { // Find group of type arguments for type parameters with the same declaring container. var start = i; - var parent_3 = getParentSymbolOfTypeParameter(outerTypeParameters[i]); + var parent_6 = getParentSymbolOfTypeParameter(outerTypeParameters[i]); do { i++; - } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent_3); + } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent_6); // When type parameters are their own type arguments for the whole group (i.e. we have // the default outer type arguments), we don't show the group. if (!ts.rangeEquals(outerTypeParameters, typeArguments, start, i)) { - writeSymbolTypeReference(parent_3, typeArguments, start, i, flags); + writeSymbolTypeReference(parent_6, typeArguments, start, i, flags); writePunctuation(writer, 21 /* DotToken */); } } @@ -15443,10 +17318,10 @@ var ts; if (symbol) { // Always use 'typeof T' for type of class, enum, and module objects if (symbol.flags & (32 /* Class */ | 384 /* Enum */ | 512 /* ValueModule */)) { - writeTypeofSymbol(type, flags); + writeTypeOfSymbol(type, flags); } else if (shouldWriteTypeOfFunctionSymbol()) { - writeTypeofSymbol(type, flags); + writeTypeOfSymbol(type, flags); } else if (ts.contains(symbolStack, symbol)) { // If type is an anonymous type literal in a type alias declaration, use type alias name @@ -15477,11 +17352,11 @@ var ts; } function shouldWriteTypeOfFunctionSymbol() { var isStaticMethodSymbol = !!(symbol.flags & 8192 /* Method */ && - ts.forEach(symbol.declarations, function (declaration) { return declaration.flags & 64 /* Static */; })); + ts.forEach(symbol.declarations, function (declaration) { return declaration.flags & 32 /* Static */; })); var isNonLocalFunctionSymbol = !!(symbol.flags & 16 /* Function */) && (symbol.parent || ts.forEach(symbol.declarations, function (declaration) { - return declaration.parent.kind === 248 /* SourceFile */ || declaration.parent.kind === 219 /* ModuleBlock */; + return declaration.parent.kind === 256 /* SourceFile */ || declaration.parent.kind === 226 /* ModuleBlock */; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { // typeof is allowed only for static/non local functions @@ -15490,35 +17365,67 @@ var ts; } } } - function writeTypeofSymbol(type, typeFormatFlags) { + function writeTypeOfSymbol(type, typeFormatFlags) { writeKeyword(writer, 101 /* TypeOfKeyword */); writeSpace(writer); buildSymbolDisplay(type.symbol, writer, enclosingDeclaration, 107455 /* Value */, 0 /* None */, typeFormatFlags); } - function getIndexerParameterName(type, indexKind, fallbackName) { - var declaration = getIndexDeclarationOfSymbol(type.symbol, indexKind); - if (!declaration) { - // declaration might not be found if indexer was added from the contextual type. - // in this case use fallback name - return fallbackName; + function writeIndexSignature(info, keyword) { + if (info) { + if (info.isReadonly) { + writeKeyword(writer, 128 /* ReadonlyKeyword */); + writeSpace(writer); + } + writePunctuation(writer, 19 /* OpenBracketToken */); + writer.writeParameter(info.declaration ? ts.declarationNameToString(info.declaration.parameters[0].name) : "x"); + writePunctuation(writer, 54 /* ColonToken */); + writeSpace(writer); + writeKeyword(writer, keyword); + writePunctuation(writer, 20 /* CloseBracketToken */); + writePunctuation(writer, 54 /* ColonToken */); + writeSpace(writer); + writeType(info.type, 0 /* None */); + writePunctuation(writer, 23 /* SemicolonToken */); + writer.writeLine(); } - ts.Debug.assert(declaration.parameters.length !== 0); - return ts.declarationNameToString(declaration.parameters[0].name); + } + function writePropertyWithModifiers(prop) { + if (isReadonlySymbol(prop)) { + writeKeyword(writer, 128 /* ReadonlyKeyword */); + writeSpace(writer); + } + buildSymbolDisplay(prop, writer); + if (prop.flags & 536870912 /* Optional */) { + writePunctuation(writer, 53 /* QuestionToken */); + } + } + function shouldAddParenthesisAroundFunctionType(callSignature, flags) { + if (flags & 64 /* InElementType */) { + return true; + } + else if (flags & 256 /* InFirstTypeArgument */) { + // Add parenthesis around function type for the first type argument to avoid ambiguity + var typeParameters = callSignature.target && (flags & 32 /* WriteTypeArgumentsOfSignature */) ? + callSignature.target.typeParameters : callSignature.typeParameters; + return typeParameters && typeParameters.length !== 0; + } + return false; } function writeLiteralType(type, flags) { var resolved = resolveStructuredTypeMembers(type); - if (!resolved.properties.length && !resolved.stringIndexType && !resolved.numberIndexType) { + if (!resolved.properties.length && !resolved.stringIndexInfo && !resolved.numberIndexInfo) { if (!resolved.callSignatures.length && !resolved.constructSignatures.length) { writePunctuation(writer, 15 /* OpenBraceToken */); writePunctuation(writer, 16 /* CloseBraceToken */); return; } if (resolved.callSignatures.length === 1 && !resolved.constructSignatures.length) { - if (flags & 64 /* InElementType */) { + var parenthesizeSignature = shouldAddParenthesisAroundFunctionType(resolved.callSignatures[0], flags); + if (parenthesizeSignature) { writePunctuation(writer, 17 /* OpenParenToken */); } - buildSignatureDisplay(resolved.callSignatures[0], writer, enclosingDeclaration, globalFlagsToPass | 8 /* WriteArrowStyleSignature */, symbolStack); - if (flags & 64 /* InElementType */) { + buildSignatureDisplay(resolved.callSignatures[0], writer, enclosingDeclaration, globalFlagsToPass | 8 /* WriteArrowStyleSignature */, /*kind*/ undefined, symbolStack); + if (parenthesizeSignature) { writePunctuation(writer, 18 /* CloseParenToken */); } return; @@ -15529,7 +17436,7 @@ var ts; } writeKeyword(writer, 92 /* NewKeyword */); writeSpace(writer); - buildSignatureDisplay(resolved.constructSignatures[0], writer, enclosingDeclaration, globalFlagsToPass | 8 /* WriteArrowStyleSignature */, symbolStack); + buildSignatureDisplay(resolved.constructSignatures[0], writer, enclosingDeclaration, globalFlagsToPass | 8 /* WriteArrowStyleSignature */, /*kind*/ undefined, symbolStack); if (flags & 64 /* InElementType */) { writePunctuation(writer, 18 /* CloseParenToken */); } @@ -15543,46 +17450,18 @@ var ts; writer.increaseIndent(); for (var _i = 0, _a = resolved.callSignatures; _i < _a.length; _i++) { var signature = _a[_i]; - buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, symbolStack); + buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, /*kind*/ undefined, symbolStack); writePunctuation(writer, 23 /* SemicolonToken */); writer.writeLine(); } for (var _b = 0, _c = resolved.constructSignatures; _b < _c.length; _b++) { var signature = _c[_b]; - writeKeyword(writer, 92 /* NewKeyword */); - writeSpace(writer); - buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, symbolStack); - writePunctuation(writer, 23 /* SemicolonToken */); - writer.writeLine(); - } - if (resolved.stringIndexType) { - // [x: string]: - writePunctuation(writer, 19 /* OpenBracketToken */); - writer.writeParameter(getIndexerParameterName(resolved, 0 /* String */, /*fallbackName*/ "x")); - writePunctuation(writer, 54 /* ColonToken */); - writeSpace(writer); - writeKeyword(writer, 130 /* StringKeyword */); - writePunctuation(writer, 20 /* CloseBracketToken */); - writePunctuation(writer, 54 /* ColonToken */); - writeSpace(writer); - writeType(resolved.stringIndexType, 0 /* None */); - writePunctuation(writer, 23 /* SemicolonToken */); - writer.writeLine(); - } - if (resolved.numberIndexType) { - // [x: number]: - writePunctuation(writer, 19 /* OpenBracketToken */); - writer.writeParameter(getIndexerParameterName(resolved, 1 /* Number */, /*fallbackName*/ "x")); - writePunctuation(writer, 54 /* ColonToken */); - writeSpace(writer); - writeKeyword(writer, 128 /* NumberKeyword */); - writePunctuation(writer, 20 /* CloseBracketToken */); - writePunctuation(writer, 54 /* ColonToken */); - writeSpace(writer); - writeType(resolved.numberIndexType, 0 /* None */); + buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, 1 /* Construct */, symbolStack); writePunctuation(writer, 23 /* SemicolonToken */); writer.writeLine(); } + writeIndexSignature(resolved.stringIndexInfo, 132 /* StringKeyword */); + writeIndexSignature(resolved.numberIndexInfo, 130 /* NumberKeyword */); for (var _d = 0, _e = resolved.properties; _d < _e.length; _d++) { var p = _e[_d]; var t = getTypeOfSymbol(p); @@ -15590,20 +17469,14 @@ var ts; var signatures = getSignaturesOfType(t, 0 /* Call */); for (var _f = 0, signatures_1 = signatures; _f < signatures_1.length; _f++) { var signature = signatures_1[_f]; - buildSymbolDisplay(p, writer); - if (p.flags & 536870912 /* Optional */) { - writePunctuation(writer, 53 /* QuestionToken */); - } - buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, symbolStack); + writePropertyWithModifiers(p); + buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, /*kind*/ undefined, symbolStack); writePunctuation(writer, 23 /* SemicolonToken */); writer.writeLine(); } } else { - buildSymbolDisplay(p, writer); - if (p.flags & 536870912 /* Optional */) { - writePunctuation(writer, 53 /* QuestionToken */); - } + writePropertyWithModifiers(p); writePunctuation(writer, 54 /* ColonToken */); writeSpace(writer); writeType(t, 0 /* None */); @@ -15616,10 +17489,10 @@ var ts; inObjectTypeLiteral = saveInObjectTypeLiteral; } } - function buildTypeParameterDisplayFromSymbol(symbol, writer, enclosingDeclaraiton, flags) { + function buildTypeParameterDisplayFromSymbol(symbol, writer, enclosingDeclaration, flags) { var targetSymbol = getTargetSymbol(symbol); if (targetSymbol.flags & 32 /* Class */ || targetSymbol.flags & 64 /* Interface */ || targetSymbol.flags & 524288 /* TypeAlias */) { - buildDisplayForTypeParametersAndDelimiters(getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol), writer, enclosingDeclaraiton, flags); + buildDisplayForTypeParametersAndDelimiters(getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol), writer, enclosingDeclaration, flags); } } function buildTypeParameterDisplay(tp, writer, enclosingDeclaration, flags, symbolStack) { @@ -15637,7 +17510,12 @@ var ts; if (ts.isRestParameter(parameterNode)) { writePunctuation(writer, 22 /* DotDotDotToken */); } - appendSymbolNameOnly(p, writer); + if (ts.isBindingPattern(parameterNode.name)) { + buildBindingPatternDisplay(parameterNode.name, writer, enclosingDeclaration, flags, symbolStack); + } + else { + appendSymbolNameOnly(p, writer); + } if (isOptionalParameter(parameterNode)) { writePunctuation(writer, 53 /* QuestionToken */); } @@ -15645,36 +17523,84 @@ var ts; writeSpace(writer); buildTypeDisplay(getTypeOfSymbol(p), writer, enclosingDeclaration, flags, symbolStack); } + function buildBindingPatternDisplay(bindingPattern, writer, enclosingDeclaration, flags, symbolStack) { + // We have to explicitly emit square bracket and bracket because these tokens are not stored inside the node. + if (bindingPattern.kind === 167 /* ObjectBindingPattern */) { + writePunctuation(writer, 15 /* OpenBraceToken */); + buildDisplayForCommaSeparatedList(bindingPattern.elements, writer, function (e) { return buildBindingElementDisplay(e, writer, enclosingDeclaration, flags, symbolStack); }); + writePunctuation(writer, 16 /* CloseBraceToken */); + } + else if (bindingPattern.kind === 168 /* ArrayBindingPattern */) { + writePunctuation(writer, 19 /* OpenBracketToken */); + var elements = bindingPattern.elements; + buildDisplayForCommaSeparatedList(elements, writer, function (e) { return buildBindingElementDisplay(e, writer, enclosingDeclaration, flags, symbolStack); }); + if (elements && elements.hasTrailingComma) { + writePunctuation(writer, 24 /* CommaToken */); + } + writePunctuation(writer, 20 /* CloseBracketToken */); + } + } + function buildBindingElementDisplay(bindingElement, writer, enclosingDeclaration, flags, symbolStack) { + if (bindingElement.kind === 193 /* OmittedExpression */) { + return; + } + ts.Debug.assert(bindingElement.kind === 169 /* BindingElement */); + if (bindingElement.propertyName) { + writer.writeSymbol(ts.getTextOfNode(bindingElement.propertyName), bindingElement.symbol); + writePunctuation(writer, 54 /* ColonToken */); + writeSpace(writer); + } + if (ts.isBindingPattern(bindingElement.name)) { + buildBindingPatternDisplay(bindingElement.name, writer, enclosingDeclaration, flags, symbolStack); + } + else { + if (bindingElement.dotDotDotToken) { + writePunctuation(writer, 22 /* DotDotDotToken */); + } + appendSymbolNameOnly(bindingElement.symbol, writer); + } + } function buildDisplayForTypeParametersAndDelimiters(typeParameters, writer, enclosingDeclaration, flags, symbolStack) { if (typeParameters && typeParameters.length) { writePunctuation(writer, 25 /* LessThanToken */); - for (var i = 0; i < typeParameters.length; i++) { - if (i > 0) { - writePunctuation(writer, 24 /* CommaToken */); - writeSpace(writer); - } - buildTypeParameterDisplay(typeParameters[i], writer, enclosingDeclaration, flags, symbolStack); - } + buildDisplayForCommaSeparatedList(typeParameters, writer, function (p) { return buildTypeParameterDisplay(p, writer, enclosingDeclaration, flags, symbolStack); }); writePunctuation(writer, 27 /* GreaterThanToken */); } } + function buildDisplayForCommaSeparatedList(list, writer, action) { + for (var i = 0; i < list.length; i++) { + if (i > 0) { + writePunctuation(writer, 24 /* CommaToken */); + writeSpace(writer); + } + action(list[i]); + } + } function buildDisplayForTypeArgumentsAndDelimiters(typeParameters, mapper, writer, enclosingDeclaration, flags, symbolStack) { if (typeParameters && typeParameters.length) { writePunctuation(writer, 25 /* LessThanToken */); + var flags_1 = 256 /* InFirstTypeArgument */; for (var i = 0; i < typeParameters.length; i++) { if (i > 0) { writePunctuation(writer, 24 /* CommaToken */); writeSpace(writer); + flags_1 = 0 /* None */; } - buildTypeDisplay(mapper(typeParameters[i]), writer, enclosingDeclaration, 0 /* None */); + buildTypeDisplay(mapper(typeParameters[i]), writer, enclosingDeclaration, flags_1); } writePunctuation(writer, 27 /* GreaterThanToken */); } } - function buildDisplayForParametersAndDelimiters(parameters, writer, enclosingDeclaration, flags, symbolStack) { + function buildDisplayForParametersAndDelimiters(thisType, parameters, writer, enclosingDeclaration, flags, symbolStack) { writePunctuation(writer, 17 /* OpenParenToken */); + if (thisType) { + writeKeyword(writer, 97 /* ThisKeyword */); + writePunctuation(writer, 54 /* ColonToken */); + writeSpace(writer); + buildTypeDisplay(thisType, writer, enclosingDeclaration, flags, symbolStack); + } for (var i = 0; i < parameters.length; i++) { - if (i > 0) { + if (i > 0 || thisType) { writePunctuation(writer, 24 /* CommaToken */); writeSpace(writer); } @@ -15682,6 +17608,18 @@ var ts; } writePunctuation(writer, 18 /* CloseParenToken */); } + function buildTypePredicateDisplay(predicate, writer, enclosingDeclaration, flags, symbolStack) { + if (ts.isIdentifierTypePredicate(predicate)) { + writer.writeParameter(predicate.parameterName); + } + else { + writeKeyword(writer, 97 /* ThisKeyword */); + } + writeSpace(writer); + writeKeyword(writer, 124 /* IsKeyword */); + writeSpace(writer); + buildTypeDisplay(predicate.type, writer, enclosingDeclaration, flags, symbolStack); + } function buildReturnTypeDisplay(signature, writer, enclosingDeclaration, flags, symbolStack) { if (flags & 8 /* WriteArrowStyleSignature */) { writeSpace(writer); @@ -15691,20 +17629,19 @@ var ts; writePunctuation(writer, 54 /* ColonToken */); } writeSpace(writer); - var returnType; if (signature.typePredicate) { - writer.writeParameter(signature.typePredicate.parameterName); - writeSpace(writer); - writeKeyword(writer, 124 /* IsKeyword */); - writeSpace(writer); - returnType = signature.typePredicate.type; + buildTypePredicateDisplay(signature.typePredicate, writer, enclosingDeclaration, flags, symbolStack); } else { - returnType = getReturnTypeOfSignature(signature); + var returnType = getReturnTypeOfSignature(signature); + buildTypeDisplay(returnType, writer, enclosingDeclaration, flags, symbolStack); } - buildTypeDisplay(returnType, writer, enclosingDeclaration, flags, symbolStack); } - function buildSignatureDisplay(signature, writer, enclosingDeclaration, flags, symbolStack) { + function buildSignatureDisplay(signature, writer, enclosingDeclaration, flags, kind, symbolStack) { + if (kind === 1 /* Construct */) { + writeKeyword(writer, 92 /* NewKeyword */); + writeSpace(writer); + } if (signature.target && (flags & 32 /* WriteTypeArgumentsOfSignature */)) { // Instantiated signature, write type arguments instead // This is achieved by passing in the mapper separately @@ -15713,13 +17650,14 @@ var ts; else { buildDisplayForTypeParametersAndDelimiters(signature.typeParameters, writer, enclosingDeclaration, flags, symbolStack); } - buildDisplayForParametersAndDelimiters(signature.parameters, writer, enclosingDeclaration, flags, symbolStack); + buildDisplayForParametersAndDelimiters(signature.thisType, signature.parameters, writer, enclosingDeclaration, flags, symbolStack); buildReturnTypeDisplay(signature, writer, enclosingDeclaration, flags, symbolStack); } return _displayBuilder || (_displayBuilder = { buildSymbolDisplay: buildSymbolDisplay, buildTypeDisplay: buildTypeDisplay, buildTypeParameterDisplay: buildTypeParameterDisplay, + buildTypePredicateDisplay: buildTypePredicateDisplay, buildParameterDisplay: buildParameterDisplay, buildDisplayForParametersAndDelimiters: buildDisplayForParametersAndDelimiters, buildDisplayForTypeParametersAndDelimiters: buildDisplayForTypeParametersAndDelimiters, @@ -15729,131 +17667,6 @@ var ts; }); } function isDeclarationVisible(node) { - function getContainingExternalModule(node) { - for (; node; node = node.parent) { - if (node.kind === 218 /* ModuleDeclaration */) { - if (node.name.kind === 9 /* StringLiteral */) { - return node; - } - } - else if (node.kind === 248 /* SourceFile */) { - return ts.isExternalOrCommonJsModule(node) ? node : undefined; - } - } - ts.Debug.fail("getContainingModule cant reach here"); - } - function isUsedInExportAssignment(node) { - // Get source File and see if it is external module and has export assigned symbol - var externalModule = getContainingExternalModule(node); - var exportAssignmentSymbol; - var resolvedExportSymbol; - if (externalModule) { - // This is export assigned symbol node - var externalModuleSymbol = getSymbolOfNode(externalModule); - exportAssignmentSymbol = getExportAssignmentSymbol(externalModuleSymbol); - var symbolOfNode = getSymbolOfNode(node); - if (isSymbolUsedInExportAssignment(symbolOfNode)) { - return true; - } - // if symbolOfNode is alias declaration, resolve the symbol declaration and check - if (symbolOfNode.flags & 8388608 /* Alias */) { - return isSymbolUsedInExportAssignment(resolveAlias(symbolOfNode)); - } - } - // Check if the symbol is used in export assignment - function isSymbolUsedInExportAssignment(symbol) { - if (exportAssignmentSymbol === symbol) { - return true; - } - if (exportAssignmentSymbol && !!(exportAssignmentSymbol.flags & 8388608 /* Alias */)) { - // if export assigned symbol is alias declaration, resolve the alias - resolvedExportSymbol = resolvedExportSymbol || resolveAlias(exportAssignmentSymbol); - if (resolvedExportSymbol === symbol) { - return true; - } - // Container of resolvedExportSymbol is visible - return ts.forEach(resolvedExportSymbol.declarations, function (current) { - while (current) { - if (current === node) { - return true; - } - current = current.parent; - } - }); - } - } - } - function determineIfDeclarationIsVisible() { - switch (node.kind) { - case 163 /* BindingElement */: - return isDeclarationVisible(node.parent.parent); - case 211 /* VariableDeclaration */: - if (ts.isBindingPattern(node.name) && - !node.name.elements.length) { - // If the binding pattern is empty, this variable declaration is not visible - return false; - } - // Otherwise fall through - case 218 /* ModuleDeclaration */: - case 214 /* ClassDeclaration */: - case 215 /* InterfaceDeclaration */: - case 216 /* TypeAliasDeclaration */: - case 213 /* FunctionDeclaration */: - case 217 /* EnumDeclaration */: - case 221 /* ImportEqualsDeclaration */: - var parent_4 = getDeclarationContainer(node); - // If the node is not exported or it is not ambient module element (except import declaration) - if (!(ts.getCombinedNodeFlags(node) & 2 /* Export */) && - !(node.kind !== 221 /* ImportEqualsDeclaration */ && parent_4.kind !== 248 /* SourceFile */ && ts.isInAmbientContext(parent_4))) { - return isGlobalSourceFile(parent_4); - } - // Exported members/ambient module elements (exception import declaration) are visible if parent is visible - return isDeclarationVisible(parent_4); - case 141 /* PropertyDeclaration */: - case 140 /* PropertySignature */: - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - if (node.flags & (16 /* Private */ | 32 /* Protected */)) { - // Private/protected properties/methods are not visible - return false; - } - // Public properties/methods are visible if its parents are visible, so const it fall into next case statement - case 144 /* Constructor */: - case 148 /* ConstructSignature */: - case 147 /* CallSignature */: - case 149 /* IndexSignature */: - case 138 /* Parameter */: - case 219 /* ModuleBlock */: - case 152 /* FunctionType */: - case 153 /* ConstructorType */: - case 155 /* TypeLiteral */: - case 151 /* TypeReference */: - case 156 /* ArrayType */: - case 157 /* TupleType */: - case 158 /* UnionType */: - case 159 /* IntersectionType */: - case 160 /* ParenthesizedType */: - return isDeclarationVisible(node.parent); - // Default binding, import specifier and namespace import is visible - // only on demand so by default it is not visible - case 223 /* ImportClause */: - case 224 /* NamespaceImport */: - case 226 /* ImportSpecifier */: - return false; - // Type parameters are always visible - case 137 /* TypeParameter */: - // Source file is always visible - case 248 /* SourceFile */: - return true; - // Export assignments do not create name bindings outside the module - case 227 /* ExportAssignment */: - return false; - default: - ts.Debug.fail("isDeclarationVisible unknown: SyntaxKind: " + node.kind); - } - } if (node) { var links = getNodeLinks(node); if (links.isVisible === undefined) { @@ -15861,13 +17674,89 @@ var ts; } return links.isVisible; } + return false; + function determineIfDeclarationIsVisible() { + switch (node.kind) { + case 169 /* BindingElement */: + return isDeclarationVisible(node.parent.parent); + case 218 /* VariableDeclaration */: + if (ts.isBindingPattern(node.name) && + !node.name.elements.length) { + // If the binding pattern is empty, this variable declaration is not visible + return false; + } + // Otherwise fall through + case 225 /* ModuleDeclaration */: + case 221 /* ClassDeclaration */: + case 222 /* InterfaceDeclaration */: + case 223 /* TypeAliasDeclaration */: + case 220 /* FunctionDeclaration */: + case 224 /* EnumDeclaration */: + case 229 /* ImportEqualsDeclaration */: + // external module augmentation is always visible + if (ts.isExternalModuleAugmentation(node)) { + return true; + } + var parent_7 = getDeclarationContainer(node); + // If the node is not exported or it is not ambient module element (except import declaration) + if (!(ts.getCombinedNodeFlags(node) & 1 /* Export */) && + !(node.kind !== 229 /* ImportEqualsDeclaration */ && parent_7.kind !== 256 /* SourceFile */ && ts.isInAmbientContext(parent_7))) { + return isGlobalSourceFile(parent_7); + } + // Exported members/ambient module elements (exception import declaration) are visible if parent is visible + return isDeclarationVisible(parent_7); + case 145 /* PropertyDeclaration */: + case 144 /* PropertySignature */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: + if (node.flags & (8 /* Private */ | 16 /* Protected */)) { + // Private/protected properties/methods are not visible + return false; + } + // Public properties/methods are visible if its parents are visible, so const it fall into next case statement + case 148 /* Constructor */: + case 152 /* ConstructSignature */: + case 151 /* CallSignature */: + case 153 /* IndexSignature */: + case 142 /* Parameter */: + case 226 /* ModuleBlock */: + case 156 /* FunctionType */: + case 157 /* ConstructorType */: + case 159 /* TypeLiteral */: + case 155 /* TypeReference */: + case 160 /* ArrayType */: + case 161 /* TupleType */: + case 162 /* UnionType */: + case 163 /* IntersectionType */: + case 164 /* ParenthesizedType */: + return isDeclarationVisible(node.parent); + // Default binding, import specifier and namespace import is visible + // only on demand so by default it is not visible + case 231 /* ImportClause */: + case 232 /* NamespaceImport */: + case 234 /* ImportSpecifier */: + return false; + // Type parameters are always visible + case 141 /* TypeParameter */: + // Source file is always visible + case 256 /* SourceFile */: + return true; + // Export assignments do not create name bindings outside the module + case 235 /* ExportAssignment */: + return false; + default: + return false; + } + } } function collectLinkedAliases(node) { var exportSymbol; - if (node.parent && node.parent.kind === 227 /* ExportAssignment */) { + if (node.parent && node.parent.kind === 235 /* ExportAssignment */) { exportSymbol = resolveName(node.parent, node.text, 107455 /* Value */ | 793056 /* Type */ | 1536 /* Namespace */ | 8388608 /* Alias */, ts.Diagnostics.Cannot_find_name_0, node); } - else if (node.parent.kind === 230 /* ExportSpecifier */) { + else if (node.parent.kind === 238 /* ExportSpecifier */) { var exportSpecifier = node.parent; exportSymbol = exportSpecifier.parent.parent.moduleSpecifier ? getExternalModuleMember(exportSpecifier.parent.parent, exportSpecifier) : @@ -15889,8 +17778,10 @@ var ts; // Add the referenced top container visible var internalModuleReference = declaration.moduleReference; var firstIdentifier = getFirstIdentifier(internalModuleReference); - var importSymbol = resolveName(declaration, firstIdentifier.text, 107455 /* Value */ | 793056 /* Type */ | 1536 /* Namespace */, ts.Diagnostics.Cannot_find_name_0, firstIdentifier); - buildVisibleNodeList(importSymbol.declarations); + var importSymbol = resolveName(declaration, firstIdentifier.text, 107455 /* Value */ | 793056 /* Type */ | 1536 /* Namespace */, undefined, undefined); + if (importSymbol) { + buildVisibleNodeList(importSymbol.declarations); + } } }); } @@ -15917,7 +17808,7 @@ var ts; return false; } resolutionTargets.push(target); - resolutionResults.push(true); + resolutionResults.push(/*items*/ true); resolutionPropertyNames.push(propertyName); return true; } @@ -15957,16 +17848,27 @@ var ts; } function getDeclarationContainer(node) { node = ts.getRootDeclaration(node); - // Parent chain: - // VaribleDeclaration -> VariableDeclarationList -> VariableStatement -> 'Declaration Container' - return node.kind === 211 /* VariableDeclaration */ ? node.parent.parent.parent : node.parent; + while (node) { + switch (node.kind) { + case 218 /* VariableDeclaration */: + case 219 /* VariableDeclarationList */: + case 234 /* ImportSpecifier */: + case 233 /* NamedImports */: + case 232 /* NamespaceImport */: + case 231 /* ImportClause */: + node = node.parent; + break; + default: + return node.parent; + } + } } function getTypeOfPrototypeProperty(prototype) { // TypeScript 1.0 spec (April 2014): 8.4 // Every class automatically contains a static property member named 'prototype', // the type of which is an instantiation of the class type with type Any supplied as a type argument for each type parameter. // It is an error to explicitly declare a static property member with the name 'prototype'. - var classType = getDeclaredTypeOfSymbol(prototype.parent); + var classType = getDeclaredTypeOfSymbol(getParentOfSymbol(prototype)); return classType.typeParameters ? createTypeReference(classType, ts.map(classType.typeParameters, function (_) { return anyType; })) : classType; } // Return the type of the given property in the given type, or undefined if no such property exists @@ -15990,7 +17892,7 @@ var ts; case 9 /* StringLiteral */: case 8 /* NumericLiteral */: return name.text; - case 136 /* ComputedPropertyName */: + case 140 /* ComputedPropertyName */: if (ts.isStringOrNumericLiteral(name.expression.kind)) { return name.expression.text; } @@ -15998,9 +17900,9 @@ var ts; return undefined; } function isComputedNonLiteralName(name) { - return name.kind === 136 /* ComputedPropertyName */ && !ts.isStringOrNumericLiteral(name.expression.kind); + return name.kind === 140 /* ComputedPropertyName */ && !ts.isStringOrNumericLiteral(name.expression.kind); } - // Return the inferred type for a binding element + /** Return the inferred type for a binding element */ function getTypeForBindingElement(declaration) { var pattern = declaration.parent; var parentType = getTypeForBindingElementParent(pattern.parent); @@ -16018,13 +17920,16 @@ var ts; return parentType; } var type; - if (pattern.kind === 161 /* ObjectBindingPattern */) { + if (pattern.kind === 167 /* ObjectBindingPattern */) { // Use explicitly specified property name ({ p: xxx } form), or otherwise the implied name ({ p } form) var name_10 = declaration.propertyName || declaration.name; if (isComputedNonLiteralName(name_10)) { // computed properties with non-literal names are treated as 'any' return anyType; } + if (declaration.initializer) { + getContextualType(declaration.initializer); + } // Use type of the specified property, or otherwise, for a numeric name, the type of the numeric index signature, // or otherwise the type of the string index signature. var text = getTextOfPropertyName(name_10); @@ -16062,15 +17967,63 @@ var ts; type = createArrayType(elementType); } } + // In strict null checking mode, if a default value of a non-undefined type is specified, remove + // undefined from the final type. + if (strictNullChecks && declaration.initializer && !(getNullableKind(checkExpressionCached(declaration.initializer)) & 32 /* Undefined */)) { + type = getTypeWithFacts(type, 131072 /* NEUndefined */); + } return type; } + function getTypeForVariableLikeDeclarationFromJSDocComment(declaration) { + var jsDocType = getJSDocTypeForVariableLikeDeclarationFromJSDocComment(declaration); + if (jsDocType) { + return getTypeFromTypeNode(jsDocType); + } + } + function getJSDocTypeForVariableLikeDeclarationFromJSDocComment(declaration) { + // First, see if this node has an @type annotation on it directly. + var typeTag = ts.getJSDocTypeTag(declaration); + if (typeTag && typeTag.typeExpression) { + return typeTag.typeExpression.type; + } + if (declaration.kind === 218 /* VariableDeclaration */ && + declaration.parent.kind === 219 /* VariableDeclarationList */ && + declaration.parent.parent.kind === 200 /* VariableStatement */) { + // @type annotation might have been on the variable statement, try that instead. + var annotation = ts.getJSDocTypeTag(declaration.parent.parent); + if (annotation && annotation.typeExpression) { + return annotation.typeExpression.type; + } + } + else if (declaration.kind === 142 /* Parameter */) { + // If it's a parameter, see if the parent has a jsdoc comment with an @param + // annotation. + var paramTag = ts.getCorrespondingJSDocParameterTag(declaration); + if (paramTag && paramTag.typeExpression) { + return paramTag.typeExpression.type; + } + } + return undefined; + } + function addOptionality(type, optional) { + return strictNullChecks && optional ? addNullableKind(type, 32 /* Undefined */) : type; + } // Return the inferred type for a variable, parameter, or property declaration function getTypeForVariableLikeDeclaration(declaration) { - // A variable declared in a for..in statement is always of type any - if (declaration.parent.parent.kind === 200 /* ForInStatement */) { - return anyType; + if (declaration.flags & 134217728 /* JavaScriptFile */) { + // If this is a variable in a JavaScript file, then use the JSDoc type (if it has + // one as its type), otherwise fallback to the below standard TS codepaths to + // try to figure it out. + var type = getTypeForVariableLikeDeclarationFromJSDocComment(declaration); + if (type && type !== unknownType) { + return type; + } } - if (declaration.parent.parent.kind === 201 /* ForOfStatement */) { + // A variable declared in a for..in statement is always of type string + if (declaration.parent.parent.kind === 207 /* ForInStatement */) { + return stringType; + } + if (declaration.parent.parent.kind === 208 /* ForOfStatement */) { // checkRightHandSideOfForOf will return undefined if the for-of expression type was // missing properties/signatures required to get its iteratedType (like // [Symbol.iterator] or next). This may be because we accessed properties from anyType, @@ -16082,29 +18035,36 @@ var ts; } // Use type from type annotation if one is present if (declaration.type) { - return getTypeFromTypeNode(declaration.type); + return addOptionality(getTypeFromTypeNode(declaration.type), /*optional*/ !!declaration.questionToken); } - if (declaration.kind === 138 /* Parameter */) { + if (declaration.kind === 142 /* Parameter */) { var func = declaration.parent; // For a parameter of a set accessor, use the type of the get accessor if one is present - if (func.kind === 146 /* SetAccessor */ && !ts.hasDynamicName(func)) { - var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 145 /* GetAccessor */); + if (func.kind === 150 /* SetAccessor */ && !ts.hasDynamicName(func)) { + var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 149 /* GetAccessor */); if (getter) { - return getReturnTypeOfSignature(getSignatureFromDeclaration(getter)); + var signature = getSignatureFromDeclaration(getter); + var thisParameter = getAccessorThisParameter(func); + if (thisParameter && declaration === thisParameter) { + return signature.thisType; + } + return getReturnTypeOfSignature(signature); } } // Use contextual parameter type if one is available - var type = getContextuallyTypedParameterType(declaration); + var type = declaration.symbol.name === "this" + ? getContextuallyTypedThisType(func) + : getContextuallyTypedParameterType(declaration); if (type) { - return type; + return addOptionality(type, /*optional*/ !!declaration.questionToken); } } // Use the type of the initializer expression if one is present if (declaration.initializer) { - return checkExpressionCached(declaration.initializer); + return addOptionality(checkExpressionCached(declaration.initializer), /*optional*/ !!declaration.questionToken); } // If it is a short-hand property assignment, use the type of the identifier - if (declaration.kind === 246 /* ShorthandPropertyAssignment */) { + if (declaration.kind === 254 /* ShorthandPropertyAssignment */) { return checkIdentifier(declaration.name); } // If the declaration specifies a binding pattern, use the type implied by the binding pattern @@ -16119,11 +18079,16 @@ var ts; // pattern. Otherwise, it is the type any. function getTypeFromBindingElement(element, includePatternInType) { if (element.initializer) { - return getWidenedType(checkExpressionCached(element.initializer)); + var type = checkExpressionCached(element.initializer); + reportErrorsFromWidening(element, type); + return getWidenedType(type); } if (ts.isBindingPattern(element.name)) { return getTypeFromBindingPattern(element.name, includePatternInType); } + if (compilerOptions.noImplicitAny && !declarationBelongsToPrivateAmbientMember(element)) { + reportImplicitAnyError(element, anyType); + } return anyType; } // Return the type implied by an object binding pattern @@ -16160,7 +18125,7 @@ var ts; return languageVersion >= 2 /* ES6 */ ? createIterableType(anyType) : anyArrayType; } // If the pattern has at least one element, and no rest element, then it should imply a tuple type. - var elementTypes = ts.map(elements, function (e) { return e.kind === 187 /* OmittedExpression */ ? anyType : getTypeFromBindingElement(e, includePatternInType); }); + var elementTypes = ts.map(elements, function (e) { return e.kind === 193 /* OmittedExpression */ ? anyType : getTypeFromBindingElement(e, includePatternInType); }); if (includePatternInType) { var result = createNewTupleType(elementTypes); result.pattern = pattern; @@ -16176,7 +18141,7 @@ var ts; // parameter with no type annotation or initializer, the type implied by the binding pattern becomes the type of // the parameter. function getTypeFromBindingPattern(pattern, includePatternInType) { - return pattern.kind === 161 /* ObjectBindingPattern */ + return pattern.kind === 167 /* ObjectBindingPattern */ ? getTypeFromObjectBindingPattern(pattern, includePatternInType) : getTypeFromArrayBindingPattern(pattern, includePatternInType); } @@ -16198,19 +18163,26 @@ var ts; // During a normal type check we'll never get to here with a property assignment (the check of the containing // object literal uses a different path). We exclude widening only so that language services and type verification // tools see the actual type. - return declaration.kind !== 245 /* PropertyAssignment */ ? getWidenedType(type) : type; + if (declaration.kind === 253 /* PropertyAssignment */) { + return type; + } + return getWidenedType(type); } // Rest parameters default to type any[], other parameters default to type any type = declaration.dotDotDotToken ? anyArrayType : anyType; // Report implicit any errors unless this is a private property within an ambient declaration if (reportErrors && compilerOptions.noImplicitAny) { - var root = ts.getRootDeclaration(declaration); - if (!isPrivateWithinAmbient(root) && !(root.kind === 138 /* Parameter */ && isPrivateWithinAmbient(root.parent))) { + if (!declarationBelongsToPrivateAmbientMember(declaration)) { reportImplicitAnyError(declaration, type); } } return type; } + function declarationBelongsToPrivateAmbientMember(declaration) { + var root = ts.getRootDeclaration(declaration); + var memberDeclaration = root.kind === 142 /* Parameter */ ? root.parent : root; + return isPrivateWithinAmbient(memberDeclaration); + } function getTypeOfVariableOrParameterOrProperty(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { @@ -16220,20 +18192,24 @@ var ts; } // Handle catch clause variables var declaration = symbol.valueDeclaration; - if (declaration.parent.kind === 244 /* CatchClause */) { + if (declaration.parent.kind === 252 /* CatchClause */) { return links.type = anyType; } // Handle export default expressions - if (declaration.kind === 227 /* ExportAssignment */) { + if (declaration.kind === 235 /* ExportAssignment */) { return links.type = checkExpression(declaration.expression); } // Handle module.exports = expr - if (declaration.kind === 181 /* BinaryExpression */) { - return links.type = checkExpression(declaration.right); + if (declaration.kind === 187 /* BinaryExpression */) { + return links.type = getUnionType(ts.map(symbol.declarations, function (decl) { return checkExpressionCached(decl.right); })); } - // Handle exports.p = expr - if (declaration.kind === 166 /* PropertyAccessExpression */) { - return checkExpressionCached(declaration.parent.right); + if (declaration.kind === 172 /* PropertyAccessExpression */) { + // Declarations only exist for property access expressions for certain + // special assignment kinds + if (declaration.parent.kind === 187 /* BinaryExpression */) { + // Handle exports.p = expr or this.p = expr or className.prototype.method = expr + return links.type = checkExpressionCached(declaration.parent.right); + } } // Handle variable, parameter or property if (!pushTypeResolution(symbol, 0 /* Type */)) { @@ -16260,7 +18236,7 @@ var ts; } function getAnnotatedAccessorType(accessor) { if (accessor) { - if (accessor.kind === 145 /* GetAccessor */) { + if (accessor.kind === 149 /* GetAccessor */) { return accessor.type && getTypeFromTypeNode(accessor.type); } else { @@ -16270,15 +18246,30 @@ var ts; } return undefined; } + function getAnnotatedAccessorThisType(accessor) { + if (accessor) { + var parameter = getAccessorThisParameter(accessor); + if (parameter && parameter.type) { + return getTypeFromTypeNode(accessor.parameters[0].type); + } + } + return undefined; + } function getTypeOfAccessors(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { + var getter = ts.getDeclarationOfKind(symbol, 149 /* GetAccessor */); + var setter = ts.getDeclarationOfKind(symbol, 150 /* SetAccessor */); + if (getter && getter.flags & 134217728 /* JavaScriptFile */) { + var jsDocType = getTypeForVariableLikeDeclarationFromJSDocComment(getter); + if (jsDocType) { + return links.type = jsDocType; + } + } if (!pushTypeResolution(symbol, 0 /* Type */)) { return unknownType; } - var getter = ts.getDeclarationOfKind(symbol, 145 /* GetAccessor */); - var setter = ts.getDeclarationOfKind(symbol, 146 /* SetAccessor */); - var type; + var type = void 0; // First try to see if the user specified a return type on the get-accessor. var getterReturnType = getAnnotatedAccessorType(getter); if (getterReturnType) { @@ -16306,7 +18297,7 @@ var ts; if (!popTypeResolution()) { type = anyType; if (compilerOptions.noImplicitAny) { - var getter_1 = ts.getDeclarationOfKind(symbol, 145 /* GetAccessor */); + var getter_1 = ts.getDeclarationOfKind(symbol, 149 /* GetAccessor */); error(getter_1, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol)); } } @@ -16317,7 +18308,9 @@ var ts; function getTypeOfFuncClassEnumModule(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { - links.type = createObjectType(65536 /* Anonymous */, symbol); + var type = createObjectType(65536 /* Anonymous */, symbol); + links.type = strictNullChecks && symbol.flags & 536870912 /* Optional */ ? + addNullableKind(type, 32 /* Undefined */) : type; } return links.type; } @@ -16406,9 +18399,9 @@ var ts; if (!node) { return typeParameters; } - if (node.kind === 214 /* ClassDeclaration */ || node.kind === 186 /* ClassExpression */ || - node.kind === 213 /* FunctionDeclaration */ || node.kind === 173 /* FunctionExpression */ || - node.kind === 143 /* MethodDeclaration */ || node.kind === 174 /* ArrowFunction */) { + if (node.kind === 221 /* ClassDeclaration */ || node.kind === 192 /* ClassExpression */ || + node.kind === 220 /* FunctionDeclaration */ || node.kind === 179 /* FunctionExpression */ || + node.kind === 147 /* MethodDeclaration */ || node.kind === 180 /* ArrowFunction */) { var declarations = node.typeParameters; if (declarations) { return appendTypeParameters(appendOuterTypeParameters(typeParameters, node), declarations); @@ -16418,7 +18411,7 @@ var ts; } // The outer type parameters are those defined by enclosing generic classes, methods, or functions. function getOuterTypeParametersOfClassOrInterface(symbol) { - var declaration = symbol.flags & 32 /* Class */ ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 215 /* InterfaceDeclaration */); + var declaration = symbol.flags & 32 /* Class */ ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 222 /* InterfaceDeclaration */); return appendOuterTypeParameters(undefined, declaration); } // The local type parameters are the combined set of type parameters from all declarations of the class, @@ -16427,8 +18420,8 @@ var ts; var result; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var node = _a[_i]; - if (node.kind === 215 /* InterfaceDeclaration */ || node.kind === 214 /* ClassDeclaration */ || - node.kind === 186 /* ClassExpression */ || node.kind === 216 /* TypeAliasDeclaration */) { + if (node.kind === 222 /* InterfaceDeclaration */ || node.kind === 221 /* ClassDeclaration */ || + node.kind === 192 /* ClassExpression */ || node.kind === 223 /* TypeAliasDeclaration */) { var declaration = node; if (declaration.typeParameters) { result = appendTypeParameters(result, declaration.typeParameters); @@ -16455,8 +18448,8 @@ var ts; function getInstantiatedConstructorsForTypeArguments(type, typeArgumentNodes) { var signatures = getConstructorsForTypeArguments(type, typeArgumentNodes); if (typeArgumentNodes) { - var typeArguments = ts.map(typeArgumentNodes, getTypeFromTypeNode); - signatures = ts.map(signatures, function (sig) { return getSignatureInstantiation(sig, typeArguments); }); + var typeArguments_1 = ts.map(typeArgumentNodes, getTypeFromTypeNode); + signatures = ts.map(signatures, function (sig) { return getSignatureInstantiation(sig, typeArguments_1); }); } return signatures; } @@ -16492,9 +18485,6 @@ var ts; } return type.resolvedBaseConstructorType; } - function hasClassBaseType(type) { - return !!ts.forEach(getBaseTypes(type), function (t) { return !!(t.symbol.flags & 32 /* Class */); }); - } function getBaseTypes(type) { var isClass = type.symbol.flags & 32 /* Class */; var isInterface = type.symbol.flags & 64 /* Interface */; @@ -16571,7 +18561,7 @@ var ts; type.resolvedBaseTypes = type.resolvedBaseTypes || emptyArray; for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 215 /* InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) { + if (declaration.kind === 222 /* InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) { for (var _b = 0, _c = ts.getInterfaceBaseTypeNodes(declaration); _b < _c.length; _b++) { var node = _c[_b]; var baseType = getTypeFromTypeNode(node); @@ -16603,8 +18593,8 @@ var ts; function isIndependentInterface(symbol) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 215 /* InterfaceDeclaration */) { - if (declaration.flags & 262144 /* ContainsThis */) { + if (declaration.kind === 222 /* InterfaceDeclaration */) { + if (declaration.flags & 16384 /* ContainsThis */) { return false; } var baseTypeNodes = ts.getInterfaceBaseTypeNodes(declaration); @@ -16659,7 +18649,7 @@ var ts; if (!pushTypeResolution(symbol, 2 /* DeclaredType */)) { return unknownType; } - var declaration = ts.getDeclarationOfKind(symbol, 216 /* TypeAliasDeclaration */); + var declaration = ts.getDeclarationOfKind(symbol, 223 /* TypeAliasDeclaration */); var type = getTypeFromTypeNode(declaration.type); if (popTypeResolution()) { links.typeParameters = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol); @@ -16692,7 +18682,7 @@ var ts; if (!links.declaredType) { var type = createType(512 /* TypeParameter */); type.symbol = symbol; - if (!ts.getDeclarationOfKind(symbol, 137 /* TypeParameter */).constraint) { + if (!ts.getDeclarationOfKind(symbol, 141 /* TypeParameter */).constraint) { type.constraint = noConstraintType; } links.declaredType = type; @@ -16743,16 +18733,19 @@ var ts; function isIndependentType(node) { switch (node.kind) { case 117 /* AnyKeyword */: - case 130 /* StringKeyword */: - case 128 /* NumberKeyword */: + case 132 /* StringKeyword */: + case 130 /* NumberKeyword */: case 120 /* BooleanKeyword */: - case 131 /* SymbolKeyword */: + case 133 /* SymbolKeyword */: case 103 /* VoidKeyword */: - case 9 /* StringLiteral */: + case 135 /* UndefinedKeyword */: + case 93 /* NullKeyword */: + case 127 /* NeverKeyword */: + case 166 /* StringLiteralType */: return true; - case 156 /* ArrayType */: + case 160 /* ArrayType */: return isIndependentType(node.elementType); - case 151 /* TypeReference */: + case 155 /* TypeReference */: return isIndependentTypeReference(node); } return false; @@ -16765,7 +18758,7 @@ var ts; // A function-like declaration is considered independent (free of this references) if it has a return type // annotation that is considered independent and if each parameter is considered independent. function isIndependentFunctionLikeDeclaration(node) { - if (node.kind !== 144 /* Constructor */ && (!node.type || !isIndependentType(node.type))) { + if (node.kind !== 148 /* Constructor */ && (!node.type || !isIndependentType(node.type))) { return false; } for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) { @@ -16779,19 +18772,19 @@ var ts; // Returns true if the class or interface member given by the symbol is free of "this" references. The // function may return false for symbols that are actually free of "this" references because it is not // feasible to perform a complete analysis in all cases. In particular, property members with types - // inferred from their initializers and function members with inferred return types are convervatively + // inferred from their initializers and function members with inferred return types are conservatively // assumed not to be free of "this" references. function isIndependentMember(symbol) { if (symbol.declarations && symbol.declarations.length === 1) { var declaration = symbol.declarations[0]; if (declaration) { switch (declaration.kind) { - case 141 /* PropertyDeclaration */: - case 140 /* PropertySignature */: + case 145 /* PropertyDeclaration */: + case 144 /* PropertySignature */: return isIndependentVariableLikeDeclaration(declaration); - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - case 144 /* Constructor */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: + case 148 /* Constructor */: return isIndependentFunctionLikeDeclaration(declaration); } } @@ -16824,22 +18817,14 @@ var ts; } } } - function addInheritedSignatures(signatures, baseSignatures) { - if (baseSignatures) { - for (var _i = 0, baseSignatures_1 = baseSignatures; _i < baseSignatures_1.length; _i++) { - var signature = baseSignatures_1[_i]; - signatures.push(signature); - } - } - } function resolveDeclaredMembers(type) { if (!type.declaredProperties) { var symbol = type.symbol; type.declaredProperties = getNamedMembers(symbol.members); type.declaredCallSignatures = getSignaturesOfSymbol(symbol.members["__call"]); type.declaredConstructSignatures = getSignaturesOfSymbol(symbol.members["__new"]); - type.declaredStringIndexType = getIndexTypeOfSymbol(symbol, 0 /* String */); - type.declaredNumberIndexType = getIndexTypeOfSymbol(symbol, 1 /* Number */); + type.declaredStringIndexInfo = getIndexInfoOfSymbol(symbol, 0 /* String */); + type.declaredNumberIndexInfo = getIndexInfoOfSymbol(symbol, 1 /* Number */); } return type; } @@ -16854,15 +18839,15 @@ var ts; var members = source.symbol.members; var callSignatures = source.declaredCallSignatures; var constructSignatures = source.declaredConstructSignatures; - var stringIndexType = source.declaredStringIndexType; - var numberIndexType = source.declaredNumberIndexType; + var stringIndexInfo = source.declaredStringIndexInfo; + var numberIndexInfo = source.declaredNumberIndexInfo; if (!ts.rangeEquals(typeParameters, typeArguments, 0, typeParameters.length)) { mapper = createTypeMapper(typeParameters, typeArguments); members = createInstantiatedSymbolTable(source.declaredProperties, mapper, /*mappingThisOnly*/ typeParameters.length === 1); callSignatures = instantiateList(source.declaredCallSignatures, mapper, instantiateSignature); constructSignatures = instantiateList(source.declaredConstructSignatures, mapper, instantiateSignature); - stringIndexType = instantiateType(source.declaredStringIndexType, mapper); - numberIndexType = instantiateType(source.declaredNumberIndexType, mapper); + stringIndexInfo = instantiateIndexInfo(source.declaredStringIndexInfo, mapper); + numberIndexInfo = instantiateIndexInfo(source.declaredNumberIndexInfo, mapper); } var baseTypes = getBaseTypes(source); if (baseTypes.length) { @@ -16876,11 +18861,11 @@ var ts; addInheritedMembers(members, getPropertiesOfObjectType(instantiatedBaseType)); callSignatures = ts.concatenate(callSignatures, getSignaturesOfType(instantiatedBaseType, 0 /* Call */)); constructSignatures = ts.concatenate(constructSignatures, getSignaturesOfType(instantiatedBaseType, 1 /* Construct */)); - stringIndexType = stringIndexType || getIndexTypeOfType(instantiatedBaseType, 0 /* String */); - numberIndexType = numberIndexType || getIndexTypeOfType(instantiatedBaseType, 1 /* Number */); + stringIndexInfo = stringIndexInfo || getIndexInfoOfType(instantiatedBaseType, 0 /* String */); + numberIndexInfo = numberIndexInfo || getIndexInfoOfType(instantiatedBaseType, 1 /* Number */); } } - setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexType, numberIndexType); + setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo); } function resolveClassOrInterfaceMembers(type) { resolveObjectTypeMembers(type, resolveDeclaredMembers(type), emptyArray, emptyArray); @@ -16892,11 +18877,12 @@ var ts; type.typeArguments : ts.concatenate(type.typeArguments, [type]); resolveObjectTypeMembers(type, source, typeParameters, typeArguments); } - function createSignature(declaration, typeParameters, parameters, resolvedReturnType, typePredicate, minArgumentCount, hasRestParameter, hasStringLiterals) { + function createSignature(declaration, typeParameters, thisType, parameters, resolvedReturnType, typePredicate, minArgumentCount, hasRestParameter, hasStringLiterals) { var sig = new Signature(checker); sig.declaration = declaration; sig.typeParameters = typeParameters; sig.parameters = parameters; + sig.thisType = thisType; sig.resolvedReturnType = resolvedReturnType; sig.typePredicate = typePredicate; sig.minArgumentCount = minArgumentCount; @@ -16905,20 +18891,20 @@ var ts; return sig; } function cloneSignature(sig) { - return createSignature(sig.declaration, sig.typeParameters, sig.parameters, sig.resolvedReturnType, sig.typePredicate, sig.minArgumentCount, sig.hasRestParameter, sig.hasStringLiterals); + return createSignature(sig.declaration, sig.typeParameters, sig.thisType, sig.parameters, sig.resolvedReturnType, sig.typePredicate, sig.minArgumentCount, sig.hasRestParameter, sig.hasStringLiterals); } function getDefaultConstructSignatures(classType) { - if (!hasClassBaseType(classType)) { - return [createSignature(undefined, classType.localTypeParameters, emptyArray, classType, undefined, 0, false, false)]; - } var baseConstructorType = getBaseConstructorTypeOfClass(classType); var baseSignatures = getSignaturesOfType(baseConstructorType, 1 /* Construct */); + if (baseSignatures.length === 0) { + return [createSignature(undefined, classType.localTypeParameters, undefined, emptyArray, classType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasStringLiterals*/ false)]; + } var baseTypeNode = getBaseTypeNodeOfClass(classType); var typeArguments = ts.map(baseTypeNode.typeArguments, getTypeFromTypeNode); var typeArgCount = typeArguments ? typeArguments.length : 0; var result = []; - for (var _i = 0, baseSignatures_2 = baseSignatures; _i < baseSignatures_2.length; _i++) { - var baseSig = baseSignatures_2[_i]; + for (var _i = 0, baseSignatures_1 = baseSignatures; _i < baseSignatures_1.length; _i++) { + var baseSig = baseSignatures_1[_i]; var typeParamCount = baseSig.typeParameters ? baseSig.typeParameters.length : 0; if (typeParamCount === typeArgCount) { var sig = typeParamCount ? getSignatureInstantiation(baseSig, typeArguments) : cloneSignature(baseSig); @@ -16944,12 +18930,12 @@ var ts; var arrayType = resolveStructuredTypeMembers(createTypeFromGenericGlobalType(globalArrayType, [arrayElementType, type])); var members = createTupleTypeMemberSymbols(type.elementTypes); addInheritedMembers(members, arrayType.properties); - setObjectTypeMembers(type, members, arrayType.callSignatures, arrayType.constructSignatures, arrayType.stringIndexType, arrayType.numberIndexType); + setObjectTypeMembers(type, members, arrayType.callSignatures, arrayType.constructSignatures, arrayType.stringIndexInfo, arrayType.numberIndexInfo); } - function findMatchingSignature(signatureList, signature, partialMatch, ignoreReturnTypes) { + function findMatchingSignature(signatureList, signature, partialMatch, ignoreThisTypes, ignoreReturnTypes) { for (var _i = 0, signatureList_1 = signatureList; _i < signatureList_1.length; _i++) { var s = signatureList_1[_i]; - if (compareSignatures(s, signature, partialMatch, ignoreReturnTypes, compareTypes)) { + if (compareSignaturesIdentical(s, signature, partialMatch, ignoreThisTypes, ignoreReturnTypes, compareTypesIdentical)) { return s; } } @@ -16962,7 +18948,7 @@ var ts; return undefined; } for (var i = 1; i < signatureLists.length; i++) { - if (!findMatchingSignature(signatureLists[i], signature, /*partialMatch*/ false, /*ignoreReturnTypes*/ false)) { + if (!findMatchingSignature(signatureLists[i], signature, /*partialMatch*/ false, /*ignoreThisTypes*/ false, /*ignoreReturnTypes*/ false)) { return undefined; } } @@ -16971,7 +18957,7 @@ var ts; var result = undefined; for (var i = 0; i < signatureLists.length; i++) { // Allow matching non-generic signatures to have excess parameters and different return types - var match = i === listIndex ? signature : findMatchingSignature(signatureLists[i], signature, /*partialMatch*/ true, /*ignoreReturnTypes*/ true); + var match = i === listIndex ? signature : findMatchingSignature(signatureLists[i], signature, /*partialMatch*/ true, /*ignoreThisTypes*/ true, /*ignoreReturnTypes*/ true); if (!match) { return undefined; } @@ -16992,13 +18978,16 @@ var ts; for (var _i = 0, _a = signatureLists[i]; _i < _a.length; _i++) { var signature = _a[_i]; // Only process signatures with parameter lists that aren't already in the result list - if (!result || !findMatchingSignature(result, signature, /*partialMatch*/ false, /*ignoreReturnTypes*/ true)) { + if (!result || !findMatchingSignature(result, signature, /*partialMatch*/ false, /*ignoreThisTypes*/ true, /*ignoreReturnTypes*/ true)) { var unionSignatures = findMatchingSignatures(signatureLists, signature, i); if (unionSignatures) { var s = signature; // Union the result types when more than one signature matches if (unionSignatures.length > 1) { s = cloneSignature(signature); + if (ts.forEach(unionSignatures, function (sig) { return sig.thisType; })) { + s.thisType = getUnionType(ts.map(unionSignatures, function (sig) { return sig.thisType || anyType; })); + } // Clear resolved return type we possibly got from cloneSignature s.resolvedReturnType = undefined; s.unionSignatures = unionSignatures; @@ -17010,78 +18999,76 @@ var ts; } return result || emptyArray; } - function getUnionIndexType(types, kind) { + function getUnionIndexInfo(types, kind) { var indexTypes = []; + var isAnyReadonly = false; for (var _i = 0, types_1 = types; _i < types_1.length; _i++) { var type = types_1[_i]; - var indexType = getIndexTypeOfType(type, kind); - if (!indexType) { + var indexInfo = getIndexInfoOfType(type, kind); + if (!indexInfo) { return undefined; } - indexTypes.push(indexType); + indexTypes.push(indexInfo.type); + isAnyReadonly = isAnyReadonly || indexInfo.isReadonly; } - return getUnionType(indexTypes); + return createIndexInfo(getUnionType(indexTypes), isAnyReadonly); } function resolveUnionTypeMembers(type) { // The members and properties collections are empty for union types. To get all properties of a union // type use getPropertiesOfType (only the language service uses this). var callSignatures = getUnionSignatures(type.types, 0 /* Call */); var constructSignatures = getUnionSignatures(type.types, 1 /* Construct */); - var stringIndexType = getUnionIndexType(type.types, 0 /* String */); - var numberIndexType = getUnionIndexType(type.types, 1 /* Number */); - setObjectTypeMembers(type, emptySymbols, callSignatures, constructSignatures, stringIndexType, numberIndexType); + var stringIndexInfo = getUnionIndexInfo(type.types, 0 /* String */); + var numberIndexInfo = getUnionIndexInfo(type.types, 1 /* Number */); + setObjectTypeMembers(type, emptySymbols, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo); } function intersectTypes(type1, type2) { return !type1 ? type2 : !type2 ? type1 : getIntersectionType([type1, type2]); } + function intersectIndexInfos(info1, info2) { + return !info1 ? info2 : !info2 ? info1 : createIndexInfo(getIntersectionType([info1.type, info2.type]), info1.isReadonly && info2.isReadonly); + } function resolveIntersectionTypeMembers(type) { // The members and properties collections are empty for intersection types. To get all properties of an // intersection type use getPropertiesOfType (only the language service uses this). var callSignatures = emptyArray; var constructSignatures = emptyArray; - var stringIndexType = undefined; - var numberIndexType = undefined; + var stringIndexInfo = undefined; + var numberIndexInfo = undefined; for (var _i = 0, _a = type.types; _i < _a.length; _i++) { var t = _a[_i]; callSignatures = ts.concatenate(callSignatures, getSignaturesOfType(t, 0 /* Call */)); constructSignatures = ts.concatenate(constructSignatures, getSignaturesOfType(t, 1 /* Construct */)); - stringIndexType = intersectTypes(stringIndexType, getIndexTypeOfType(t, 0 /* String */)); - numberIndexType = intersectTypes(numberIndexType, getIndexTypeOfType(t, 1 /* Number */)); + stringIndexInfo = intersectIndexInfos(stringIndexInfo, getIndexInfoOfType(t, 0 /* String */)); + numberIndexInfo = intersectIndexInfos(numberIndexInfo, getIndexInfoOfType(t, 1 /* Number */)); } - setObjectTypeMembers(type, emptySymbols, callSignatures, constructSignatures, stringIndexType, numberIndexType); + setObjectTypeMembers(type, emptySymbols, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo); } function resolveAnonymousTypeMembers(type) { var symbol = type.symbol; - var members; - var callSignatures; - var constructSignatures; - var stringIndexType; - var numberIndexType; if (type.target) { - members = createInstantiatedSymbolTable(getPropertiesOfObjectType(type.target), type.mapper, /*mappingThisOnly*/ false); - callSignatures = instantiateList(getSignaturesOfType(type.target, 0 /* Call */), type.mapper, instantiateSignature); - constructSignatures = instantiateList(getSignaturesOfType(type.target, 1 /* Construct */), type.mapper, instantiateSignature); - stringIndexType = instantiateType(getIndexTypeOfType(type.target, 0 /* String */), type.mapper); - numberIndexType = instantiateType(getIndexTypeOfType(type.target, 1 /* Number */), type.mapper); + var members = createInstantiatedSymbolTable(getPropertiesOfObjectType(type.target), type.mapper, /*mappingThisOnly*/ false); + var callSignatures = instantiateList(getSignaturesOfType(type.target, 0 /* Call */), type.mapper, instantiateSignature); + var constructSignatures = instantiateList(getSignaturesOfType(type.target, 1 /* Construct */), type.mapper, instantiateSignature); + var stringIndexInfo = instantiateIndexInfo(getIndexInfoOfType(type.target, 0 /* String */), type.mapper); + var numberIndexInfo = instantiateIndexInfo(getIndexInfoOfType(type.target, 1 /* Number */), type.mapper); + setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo); } else if (symbol.flags & 2048 /* TypeLiteral */) { - members = symbol.members; - callSignatures = getSignaturesOfSymbol(members["__call"]); - constructSignatures = getSignaturesOfSymbol(members["__new"]); - stringIndexType = getIndexTypeOfSymbol(symbol, 0 /* String */); - numberIndexType = getIndexTypeOfSymbol(symbol, 1 /* Number */); + var members = symbol.members; + var callSignatures = getSignaturesOfSymbol(members["__call"]); + var constructSignatures = getSignaturesOfSymbol(members["__new"]); + var stringIndexInfo = getIndexInfoOfSymbol(symbol, 0 /* String */); + var numberIndexInfo = getIndexInfoOfSymbol(symbol, 1 /* Number */); + setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo); } else { // Combinations of function, class, enum and module - members = emptySymbols; - callSignatures = emptyArray; - constructSignatures = emptyArray; + var members = emptySymbols; + var constructSignatures = emptyArray; if (symbol.flags & 1952 /* HasExports */) { members = getExportsOfSymbol(symbol); } - if (symbol.flags & (16 /* Function */ | 8192 /* Method */)) { - callSignatures = getSignaturesOfSymbol(symbol); - } if (symbol.flags & 32 /* Class */) { var classType = getDeclaredTypeOfClassOrInterface(symbol); constructSignatures = getSignaturesOfSymbol(symbol.members["__constructor"]); @@ -17094,10 +19081,16 @@ var ts; addInheritedMembers(members, getPropertiesOfObjectType(baseConstructorType)); } } - stringIndexType = undefined; - numberIndexType = (symbol.flags & 384 /* Enum */) ? stringType : undefined; + var numberIndexInfo = symbol.flags & 384 /* Enum */ ? enumNumberIndexInfo : undefined; + setObjectTypeMembers(type, members, emptyArray, constructSignatures, undefined, numberIndexInfo); + // We resolve the members before computing the signatures because a signature may use + // typeof with a qualified name expression that circularly references the type we are + // in the process of resolving (see issue #6072). The temporarily empty signature list + // will never be observed because a qualified name can't reference signatures. + if (symbol.flags & (16 /* Function */ | 8192 /* Method */)) { + type.callSignatures = getSignaturesOfSymbol(symbol); + } } - setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexType, numberIndexType); } function resolveStructuredTypeMembers(type) { if (!type.members) { @@ -17122,15 +19115,15 @@ var ts; } return type; } - // Return properties of an object type or an empty array for other types + /** Return properties of an object type or an empty array for other types */ function getPropertiesOfObjectType(type) { if (type.flags & 80896 /* ObjectType */) { return resolveStructuredTypeMembers(type).properties; } return emptyArray; } - // If the given type is an object type and that type has a property by the given name, - // return the symbol for that property.Otherwise return undefined. + /** If the given type is an object type and that type has a property by the given name, + * return the symbol for that property. Otherwise return undefined. */ function getPropertyOfObjectType(type, name) { if (type.flags & 80896 /* ObjectType */) { var resolved = resolveStructuredTypeMembers(type); @@ -17194,19 +19187,22 @@ var ts; type = globalBooleanType; } else if (type.flags & 16777216 /* ESSymbol */) { - type = globalESSymbolType; + type = getGlobalESSymbolType(); } return type; } function createUnionOrIntersectionProperty(containingType, name) { var types = containingType.types; var props; + // Flags we want to propagate to the result if they exist in all source symbols + var commonFlags = (containingType.flags & 32768 /* Intersection */) ? 536870912 /* Optional */ : 0 /* None */; for (var _i = 0, types_2 = types; _i < types_2.length; _i++) { var current = types_2[_i]; var type = getApparentType(current); if (type !== unknownType) { var prop = getPropertyOfType(type, name); - if (prop && !(getDeclarationFlagsFromSymbol(prop) & (16 /* Private */ | 32 /* Protected */))) { + if (prop && !(getDeclarationFlagsFromSymbol(prop) & (8 /* Private */ | 16 /* Protected */))) { + commonFlags &= prop.flags; if (!props) { props = [prop]; } @@ -17235,7 +19231,10 @@ var ts; } propTypes.push(getTypeOfSymbol(prop)); } - var result = createSymbol(4 /* Property */ | 67108864 /* Transient */ | 268435456 /* SyntheticProperty */, name); + var result = createSymbol(4 /* Property */ | + 67108864 /* Transient */ | + 268435456 /* SyntheticProperty */ | + commonFlags, name); result.containingType = containingType; result.declarations = declarations; result.type = containingType.flags & 16384 /* Union */ ? getUnionType(propTypes) : getIntersectionType(propTypes); @@ -17292,33 +19291,50 @@ var ts; function getSignaturesOfType(type, kind) { return getSignaturesOfStructuredType(getApparentType(type), kind); } - function typeHasConstructSignatures(type) { - var apparentType = getApparentType(type); - if (apparentType.flags & (80896 /* ObjectType */ | 16384 /* Union */)) { - var resolved = resolveStructuredTypeMembers(type); - return resolved.constructSignatures.length > 0; - } - return false; - } - function typeHasCallOrConstructSignatures(type) { - var apparentType = getApparentType(type); - if (apparentType.flags & 130048 /* StructuredType */) { - var resolved = resolveStructuredTypeMembers(type); - return resolved.callSignatures.length > 0 || resolved.constructSignatures.length > 0; - } - return false; - } - function getIndexTypeOfStructuredType(type, kind) { + function getIndexInfoOfStructuredType(type, kind) { if (type.flags & 130048 /* StructuredType */) { var resolved = resolveStructuredTypeMembers(type); - return kind === 0 /* String */ ? resolved.stringIndexType : resolved.numberIndexType; + return kind === 0 /* String */ ? resolved.stringIndexInfo : resolved.numberIndexInfo; } } + function getIndexTypeOfStructuredType(type, kind) { + var info = getIndexInfoOfStructuredType(type, kind); + return info && info.type; + } + // Return the indexing info of the given kind in the given type. Creates synthetic union index types when necessary and + // maps primitive types and type parameters are to their apparent types. + function getIndexInfoOfType(type, kind) { + return getIndexInfoOfStructuredType(getApparentType(type), kind); + } // Return the index type of the given kind in the given type. Creates synthetic union index types when necessary and // maps primitive types and type parameters are to their apparent types. function getIndexTypeOfType(type, kind) { return getIndexTypeOfStructuredType(getApparentType(type), kind); } + function getImplicitIndexTypeOfType(type, kind) { + if (isObjectLiteralType(type)) { + var propTypes = []; + for (var _i = 0, _a = getPropertiesOfType(type); _i < _a.length; _i++) { + var prop = _a[_i]; + if (kind === 0 /* String */ || isNumericLiteralName(prop.name)) { + propTypes.push(getTypeOfSymbol(prop)); + } + } + if (propTypes.length) { + return getUnionType(propTypes); + } + } + return undefined; + } + function getTypeParametersFromJSDocTemplate(declaration) { + if (declaration.flags & 134217728 /* JavaScriptFile */) { + var templateTag = ts.getJSDocTemplateTag(declaration); + if (templateTag) { + return getTypeParametersFromDeclaration(templateTag.typeParameters); + } + } + return undefined; + } // Return list of type parameters with duplicates removed (duplicate identifier errors are generated in the actual // type checking functions). function getTypeParametersFromDeclaration(typeParameterDeclarations) { @@ -17341,6 +19357,20 @@ var ts; return result; } function isOptionalParameter(node) { + if (node.flags & 134217728 /* JavaScriptFile */) { + if (node.type && node.type.kind === 268 /* JSDocOptionalType */) { + return true; + } + var paramTag = ts.getCorrespondingJSDocParameterTag(node); + if (paramTag) { + if (paramTag.isBracketed) { + return true; + } + if (paramTag.typeExpression) { + return paramTag.typeExpression.type.kind === 268 /* JSDocOptionalType */; + } + } + } if (ts.hasQuestionToken(node)) { return true; } @@ -17353,26 +19383,56 @@ var ts; } return false; } + function createTypePredicateFromTypePredicateNode(node) { + if (node.parameterName.kind === 69 /* Identifier */) { + var parameterName = node.parameterName; + return { + kind: 1 /* Identifier */, + parameterName: parameterName ? parameterName.text : undefined, + parameterIndex: parameterName ? getTypePredicateParameterIndex(node.parent.parameters, parameterName) : undefined, + type: getTypeFromTypeNode(node.type) + }; + } + else { + return { + kind: 0 /* This */, + type: getTypeFromTypeNode(node.type) + }; + } + } function getSignatureFromDeclaration(declaration) { var links = getNodeLinks(declaration); if (!links.resolvedSignature) { - var classType = declaration.kind === 144 /* Constructor */ ? - getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol)) - : undefined; - var typeParameters = classType ? classType.localTypeParameters : - declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : undefined; var parameters = []; var hasStringLiterals = false; var minArgumentCount = -1; - for (var i = 0, n = declaration.parameters.length; i < n; i++) { + var thisType = undefined; + var hasThisParameter = void 0; + var isJSConstructSignature = ts.isJSDocConstructSignature(declaration); + // If this is a JSDoc construct signature, then skip the first parameter in the + // parameter list. The first parameter represents the return type of the construct + // signature. + for (var i = isJSConstructSignature ? 1 : 0, n = declaration.parameters.length; i < n; i++) { var param = declaration.parameters[i]; - parameters.push(param.symbol); - if (param.type && param.type.kind === 9 /* StringLiteral */) { + var paramSymbol = param.symbol; + // Include parameter symbol instead of property symbol in the signature + if (paramSymbol && !!(paramSymbol.flags & 4 /* Property */) && !ts.isBindingPattern(param.name)) { + var resolvedSymbol = resolveName(param, paramSymbol.name, 107455 /* Value */, undefined, undefined); + paramSymbol = resolvedSymbol; + } + if (i === 0 && paramSymbol.name === "this") { + hasThisParameter = true; + thisType = param.type ? getTypeFromTypeNode(param.type) : unknownType; + } + else { + parameters.push(paramSymbol); + } + if (param.type && param.type.kind === 166 /* StringLiteralType */) { hasStringLiterals = true; } if (param.initializer || param.questionToken || param.dotDotDotToken) { if (minArgumentCount < 0) { - minArgumentCount = i; + minArgumentCount = i - (hasThisParameter ? 1 : 0); } } else { @@ -17380,40 +19440,60 @@ var ts; minArgumentCount = -1; } } + // If only one accessor includes a this-type annotation, the other behaves as if it had the same type annotation + if ((declaration.kind === 149 /* GetAccessor */ || declaration.kind === 150 /* SetAccessor */) && + !ts.hasDynamicName(declaration) && + (!hasThisParameter || thisType === unknownType)) { + var otherKind = declaration.kind === 149 /* GetAccessor */ ? 150 /* SetAccessor */ : 149 /* GetAccessor */; + var setter = ts.getDeclarationOfKind(declaration.symbol, otherKind); + thisType = getAnnotatedAccessorThisType(setter); + } if (minArgumentCount < 0) { - minArgumentCount = declaration.parameters.length; + minArgumentCount = declaration.parameters.length - (hasThisParameter ? 1 : 0); } - var returnType; - var typePredicate; - if (classType) { - returnType = classType; + if (isJSConstructSignature) { + minArgumentCount--; } - else if (declaration.type) { - returnType = getTypeFromTypeNode(declaration.type); - if (declaration.type.kind === 150 /* TypePredicate */) { - var typePredicateNode = declaration.type; - typePredicate = { - parameterName: typePredicateNode.parameterName ? typePredicateNode.parameterName.text : undefined, - parameterIndex: typePredicateNode.parameterName ? getTypePredicateParameterIndex(declaration.parameters, typePredicateNode.parameterName) : undefined, - type: getTypeFromTypeNode(typePredicateNode.type) - }; - } - } - else { - // TypeScript 1.0 spec (April 2014): - // If only one accessor includes a type annotation, the other behaves as if it had the same type annotation. - if (declaration.kind === 145 /* GetAccessor */ && !ts.hasDynamicName(declaration)) { - var setter = ts.getDeclarationOfKind(declaration.symbol, 146 /* SetAccessor */); - returnType = getAnnotatedAccessorType(setter); - } - if (!returnType && ts.nodeIsMissing(declaration.body)) { - returnType = anyType; - } - } - links.resolvedSignature = createSignature(declaration, typeParameters, parameters, returnType, typePredicate, minArgumentCount, ts.hasRestParameter(declaration), hasStringLiterals); + var classType = declaration.kind === 148 /* Constructor */ ? + getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol)) + : undefined; + var typeParameters = classType ? classType.localTypeParameters : + declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : + getTypeParametersFromJSDocTemplate(declaration); + var returnType = getSignatureReturnTypeFromDeclaration(declaration, minArgumentCount, isJSConstructSignature, classType); + var typePredicate = declaration.type && declaration.type.kind === 154 /* TypePredicate */ ? + createTypePredicateFromTypePredicateNode(declaration.type) : + undefined; + links.resolvedSignature = createSignature(declaration, typeParameters, thisType, parameters, returnType, typePredicate, minArgumentCount, ts.hasRestParameter(declaration), hasStringLiterals); } return links.resolvedSignature; } + function getSignatureReturnTypeFromDeclaration(declaration, minArgumentCount, isJSConstructSignature, classType) { + if (isJSConstructSignature) { + return getTypeFromTypeNode(declaration.parameters[0].type); + } + else if (classType) { + return classType; + } + else if (declaration.type) { + return getTypeFromTypeNode(declaration.type); + } + if (declaration.flags & 134217728 /* JavaScriptFile */) { + var type = getReturnTypeFromJSDocComment(declaration); + if (type && type !== unknownType) { + return type; + } + } + // TypeScript 1.0 spec (April 2014): + // If only one accessor includes a type annotation, the other behaves as if it had the same type annotation. + if (declaration.kind === 149 /* GetAccessor */ && !ts.hasDynamicName(declaration)) { + var setter = ts.getDeclarationOfKind(declaration.symbol, 150 /* SetAccessor */); + return getAnnotatedAccessorType(setter); + } + if (ts.nodeIsMissing(declaration.body)) { + return anyType; + } + } function getSignaturesOfSymbol(symbol) { if (!symbol) return emptyArray; @@ -17421,19 +19501,20 @@ var ts; for (var i = 0, len = symbol.declarations.length; i < len; i++) { var node = symbol.declarations[i]; switch (node.kind) { - case 152 /* FunctionType */: - case 153 /* ConstructorType */: - case 213 /* FunctionDeclaration */: - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - case 144 /* Constructor */: - case 147 /* CallSignature */: - case 148 /* ConstructSignature */: - case 149 /* IndexSignature */: - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: - case 173 /* FunctionExpression */: - case 174 /* ArrowFunction */: + case 156 /* FunctionType */: + case 157 /* ConstructorType */: + case 220 /* FunctionDeclaration */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: + case 148 /* Constructor */: + case 151 /* CallSignature */: + case 152 /* ConstructSignature */: + case 153 /* IndexSignature */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: + case 179 /* FunctionExpression */: + case 180 /* ArrowFunction */: + case 269 /* JSDocFunctionType */: // Don't include signature if node is the implementation of an overloaded function. A node is considered // an implementation node if it has a body and the previous node is of the same kind and immediately // precedes the implementation node (i.e. has the same parent and ends where the implementation starts). @@ -17463,7 +19544,7 @@ var ts; if (!pushTypeResolution(signature, 3 /* ResolvedReturnType */)) { return unknownType; } - var type; + var type = void 0; if (signature.target) { type = instantiateType(getReturnTypeOfSignature(signature.target), signature.mapper); } @@ -17499,18 +19580,13 @@ var ts; return anyType; } function getSignatureInstantiation(signature, typeArguments) { - return instantiateSignature(signature, createTypeMapper(signature.typeParameters, typeArguments), true); + return instantiateSignature(signature, createTypeMapper(signature.typeParameters, typeArguments), /*eraseTypeParameters*/ true); } function getErasedSignature(signature) { if (!signature.typeParameters) return signature; if (!signature.erasedSignatureCache) { - if (signature.target) { - signature.erasedSignatureCache = instantiateSignature(getErasedSignature(signature.target), signature.mapper); - } - else { - signature.erasedSignatureCache = instantiateSignature(signature, createTypeEraser(signature.typeParameters), true); - } + signature.erasedSignatureCache = instantiateSignature(signature, createTypeEraser(signature.typeParameters), /*eraseTypeParameters*/ true); } return signature.erasedSignatureCache; } @@ -17520,7 +19596,7 @@ var ts; // object type literal or interface (using the new keyword). Each way of declaring a constructor // will result in a different declaration kind. if (!signature.isolatedSignatureType) { - var isConstructor = signature.declaration.kind === 144 /* Constructor */ || signature.declaration.kind === 148 /* ConstructSignature */; + var isConstructor = signature.declaration.kind === 148 /* Constructor */ || signature.declaration.kind === 152 /* ConstructSignature */; var type = createObjectType(65536 /* Anonymous */ | 262144 /* FromSignature */); type.members = emptySymbols; type.properties = emptyArray; @@ -17534,7 +19610,7 @@ var ts; return symbol.members["__index"]; } function getIndexDeclarationOfSymbol(symbol, kind) { - var syntaxKind = kind === 1 /* Number */ ? 128 /* NumberKeyword */ : 130 /* StringKeyword */; + var syntaxKind = kind === 1 /* Number */ ? 130 /* NumberKeyword */ : 132 /* StringKeyword */; var indexSymbol = getIndexSymbol(symbol); if (indexSymbol) { for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { @@ -17550,26 +19626,51 @@ var ts; } return undefined; } - function getIndexTypeOfSymbol(symbol, kind) { - var declaration = getIndexDeclarationOfSymbol(symbol, kind); - return declaration - ? declaration.type ? getTypeFromTypeNode(declaration.type) : anyType - : undefined; + function createIndexInfo(type, isReadonly, declaration) { + return { type: type, isReadonly: isReadonly, declaration: declaration }; } - function getConstraintOfTypeParameter(type) { - if (!type.constraint) { - if (type.target) { - var targetConstraint = getConstraintOfTypeParameter(type.target); - type.constraint = targetConstraint ? instantiateType(targetConstraint, type.mapper) : noConstraintType; + function getIndexInfoOfSymbol(symbol, kind) { + var declaration = getIndexDeclarationOfSymbol(symbol, kind); + if (declaration) { + return createIndexInfo(declaration.type ? getTypeFromTypeNode(declaration.type) : anyType, (declaration.flags & 64 /* Readonly */) !== 0, declaration); + } + return undefined; + } + function getConstraintDeclaration(type) { + return ts.getDeclarationOfKind(type.symbol, 141 /* TypeParameter */).constraint; + } + function hasConstraintReferenceTo(type, target) { + var checked; + while (type && !(type.flags & 33554432 /* ThisType */) && type.flags & 512 /* TypeParameter */ && !ts.contains(checked, type)) { + if (type === target) { + return true; + } + (checked || (checked = [])).push(type); + var constraintDeclaration = getConstraintDeclaration(type); + type = constraintDeclaration && getTypeFromTypeNode(constraintDeclaration); + } + return false; + } + function getConstraintOfTypeParameter(typeParameter) { + if (!typeParameter.constraint) { + if (typeParameter.target) { + var targetConstraint = getConstraintOfTypeParameter(typeParameter.target); + typeParameter.constraint = targetConstraint ? instantiateType(targetConstraint, typeParameter.mapper) : noConstraintType; } else { - type.constraint = getTypeFromTypeNode(ts.getDeclarationOfKind(type.symbol, 137 /* TypeParameter */).constraint); + var constraintDeclaration = getConstraintDeclaration(typeParameter); + var constraint = getTypeFromTypeNode(constraintDeclaration); + if (hasConstraintReferenceTo(constraint, typeParameter)) { + error(constraintDeclaration, ts.Diagnostics.Type_parameter_0_has_a_circular_constraint, typeToString(typeParameter)); + constraint = unknownType; + } + typeParameter.constraint = constraint; } } - return type.constraint === noConstraintType ? undefined : type.constraint; + return typeParameter.constraint === noConstraintType ? undefined : typeParameter.constraint; } function getParentSymbolOfTypeParameter(typeParameter) { - return getSymbolOfNode(ts.getDeclarationOfKind(typeParameter.symbol, 137 /* TypeParameter */).parent); + return getSymbolOfNode(ts.getDeclarationOfKind(typeParameter.symbol, 141 /* TypeParameter */).parent); } function getTypeListId(types) { if (types) { @@ -17595,11 +19696,13 @@ var ts; // It is only necessary to do so if a constituent type might be the undefined type, the null type, the type // of an object literal or the anyFunctionType. This is because there are operations in the type checker // that care about the presence of such types at arbitrary depth in a containing type. - function getPropagatingFlagsOfTypes(types) { + function getPropagatingFlagsOfTypes(types, excludeKinds) { var result = 0; for (var _i = 0, types_3 = types; _i < types_3.length; _i++) { var type = types_3[_i]; - result |= type.flags; + if (!(type.flags & excludeKinds)) { + result |= type.flags; + } } return result & 14680064 /* PropagatingFlags */; } @@ -17607,60 +19710,17 @@ var ts; var id = getTypeListId(typeArguments); var type = target.instantiations[id]; if (!type) { - var flags = 4096 /* Reference */ | (typeArguments ? getPropagatingFlagsOfTypes(typeArguments) : 0); + var propagatedFlags = typeArguments ? getPropagatingFlagsOfTypes(typeArguments, /*excludeKinds*/ 0) : 0; + var flags = 4096 /* Reference */ | propagatedFlags; type = target.instantiations[id] = createObjectType(flags, target.symbol); type.target = target; type.typeArguments = typeArguments; } return type; } - function isTypeParameterReferenceIllegalInConstraint(typeReferenceNode, typeParameterSymbol) { - var links = getNodeLinks(typeReferenceNode); - if (links.isIllegalTypeReferenceInConstraint !== undefined) { - return links.isIllegalTypeReferenceInConstraint; - } - // bubble up to the declaration - var currentNode = typeReferenceNode; - // forEach === exists - while (!ts.forEach(typeParameterSymbol.declarations, function (d) { return d.parent === currentNode.parent; })) { - currentNode = currentNode.parent; - } - // if last step was made from the type parameter this means that path has started somewhere in constraint which is illegal - links.isIllegalTypeReferenceInConstraint = currentNode.kind === 137 /* TypeParameter */; - return links.isIllegalTypeReferenceInConstraint; - } - function checkTypeParameterHasIllegalReferencesInConstraint(typeParameter) { - var typeParameterSymbol; - function check(n) { - if (n.kind === 151 /* TypeReference */ && n.typeName.kind === 69 /* Identifier */) { - var links = getNodeLinks(n); - if (links.isIllegalTypeReferenceInConstraint === undefined) { - var symbol = resolveName(typeParameter, n.typeName.text, 793056 /* Type */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined); - if (symbol && (symbol.flags & 262144 /* TypeParameter */)) { - // TypeScript 1.0 spec (April 2014): 3.4.1 - // Type parameters declared in a particular type parameter list - // may not be referenced in constraints in that type parameter list - // symbol.declaration.parent === typeParameter.parent - // -> typeParameter and symbol.declaration originate from the same type parameter list - // -> illegal for all declarations in symbol - // forEach === exists - links.isIllegalTypeReferenceInConstraint = ts.forEach(symbol.declarations, function (d) { return d.parent === typeParameter.parent; }); - } - } - if (links.isIllegalTypeReferenceInConstraint) { - error(typeParameter, ts.Diagnostics.Constraint_of_a_type_parameter_cannot_reference_any_type_parameter_from_the_same_type_parameter_list); - } - } - ts.forEachChild(n, check); - } - if (typeParameter.constraint) { - typeParameterSymbol = getSymbolOfNode(typeParameter); - check(typeParameter.constraint); - } - } // Get type from reference to class or interface function getTypeFromClassOrInterfaceReference(node, symbol) { - var type = getDeclaredTypeOfSymbol(symbol); + var type = getDeclaredTypeOfSymbol(getMergedSymbol(symbol)); var typeParameters = type.localTypeParameters; if (typeParameters) { if (!node.typeArguments || node.typeArguments.length !== typeParameters.length) { @@ -17702,31 +19762,74 @@ var ts; } // Get type from reference to named type that cannot be generic (enum or type parameter) function getTypeFromNonGenericTypeReference(node, symbol) { - if (symbol.flags & 262144 /* TypeParameter */ && isTypeParameterReferenceIllegalInConstraint(node, symbol)) { - // TypeScript 1.0 spec (April 2014): 3.4.1 - // Type parameters declared in a particular type parameter list - // may not be referenced in constraints in that type parameter list - // Implementation: such type references are resolved to 'unknown' type that usually denotes error - return unknownType; - } if (node.typeArguments) { error(node, ts.Diagnostics.Type_0_is_not_generic, symbolToString(symbol)); return unknownType; } return getDeclaredTypeOfSymbol(symbol); } + function getTypeReferenceName(node) { + switch (node.kind) { + case 155 /* TypeReference */: + return node.typeName; + case 267 /* JSDocTypeReference */: + return node.name; + case 194 /* ExpressionWithTypeArguments */: + // We only support expressions that are simple qualified names. For other + // expressions this produces undefined. + if (ts.isSupportedExpressionWithTypeArguments(node)) { + return node.expression; + } + } + return undefined; + } + function resolveTypeReferenceName(node, typeReferenceName) { + if (!typeReferenceName) { + return unknownSymbol; + } + return resolveEntityName(typeReferenceName, 793056 /* Type */) || unknownSymbol; + } + function getTypeReferenceType(node, symbol) { + if (symbol === unknownSymbol) { + return unknownType; + } + if (symbol.flags & (32 /* Class */ | 64 /* Interface */)) { + return getTypeFromClassOrInterfaceReference(node, symbol); + } + if (symbol.flags & 524288 /* TypeAlias */) { + return getTypeFromTypeAliasReference(node, symbol); + } + if (symbol.flags & 107455 /* Value */ && node.kind === 267 /* JSDocTypeReference */) { + // A JSDocTypeReference may have resolved to a value (as opposed to a type). In + // that case, the type of this reference is just the type of the value we resolved + // to. + return getTypeOfSymbol(symbol); + } + return getTypeFromNonGenericTypeReference(node, symbol); + } function getTypeFromTypeReference(node) { var links = getNodeLinks(node); if (!links.resolvedType) { - // We only support expressions that are simple qualified names. For other expressions this produces undefined. - var typeNameOrExpression = node.kind === 151 /* TypeReference */ ? node.typeName : - ts.isSupportedExpressionWithTypeArguments(node) ? node.expression : - undefined; - var symbol = typeNameOrExpression && resolveEntityName(typeNameOrExpression, 793056 /* Type */) || unknownSymbol; - var type = symbol === unknownSymbol ? unknownType : - symbol.flags & (32 /* Class */ | 64 /* Interface */) ? getTypeFromClassOrInterfaceReference(node, symbol) : - symbol.flags & 524288 /* TypeAlias */ ? getTypeFromTypeAliasReference(node, symbol) : - getTypeFromNonGenericTypeReference(node, symbol); + var symbol = void 0; + var type = void 0; + if (node.kind === 267 /* JSDocTypeReference */) { + var typeReferenceName = getTypeReferenceName(node); + symbol = resolveTypeReferenceName(node, typeReferenceName); + type = getTypeReferenceType(node, symbol); + links.resolvedSymbol = symbol; + links.resolvedType = type; + } + else { + // We only support expressions that are simple qualified names. For other expressions this produces undefined. + var typeNameOrExpression = node.kind === 155 /* TypeReference */ ? node.typeName : + ts.isSupportedExpressionWithTypeArguments(node) ? node.expression : + undefined; + symbol = typeNameOrExpression && resolveEntityName(typeNameOrExpression, 793056 /* Type */) || unknownSymbol; + type = symbol === unknownSymbol ? unknownType : + symbol.flags & (32 /* Class */ | 64 /* Interface */) ? getTypeFromClassOrInterfaceReference(node, symbol) : + symbol.flags & 524288 /* TypeAlias */ ? getTypeFromTypeAliasReference(node, symbol) : + getTypeFromNonGenericTypeReference(node, symbol); + } // Cache both the resolved symbol and the resolved type. The resolved symbol is needed in when we check the // type reference in checkTypeReferenceOrExpressionWithTypeArguments. links.resolvedSymbol = symbol; @@ -17751,9 +19854,9 @@ var ts; for (var _i = 0, declarations_3 = declarations; _i < declarations_3.length; _i++) { var declaration = declarations_3[_i]; switch (declaration.kind) { - case 214 /* ClassDeclaration */: - case 215 /* InterfaceDeclaration */: - case 217 /* EnumDeclaration */: + case 221 /* ClassDeclaration */: + case 222 /* InterfaceDeclaration */: + case 224 /* EnumDeclaration */: return declaration; } } @@ -17785,10 +19888,6 @@ var ts; if (arity === void 0) { arity = 0; } return getTypeOfGlobalSymbol(getGlobalTypeSymbol(name), arity); } - function tryGetGlobalType(name, arity) { - if (arity === void 0) { arity = 0; } - return getTypeOfGlobalSymbol(getGlobalSymbol(name, 793056 /* Type */, /*diagnostic*/ undefined), arity); - } /** * Returns a type that is inside a namespace at the global scope, e.g. * getExportedTypeFromNamespace('JSX', 'Element') returns the JSX.Element type @@ -17798,9 +19897,6 @@ var ts; var typeSymbol = namespaceSymbol && getSymbol(namespaceSymbol.exports, name, 793056 /* Type */); return typeSymbol && getDeclaredTypeOfSymbol(typeSymbol); } - function getGlobalESSymbolConstructorSymbol() { - return globalESSymbolConstructorSymbol || (globalESSymbolConstructorSymbol = getGlobalValueSymbol("Symbol")); - } /** * Creates a TypeReference for a generic `TypedPropertyDescriptor`. */ @@ -17817,10 +19913,10 @@ var ts; return genericGlobalType !== emptyGenericType ? createTypeReference(genericGlobalType, typeArguments) : emptyObjectType; } function createIterableType(elementType) { - return createTypeFromGenericGlobalType(globalIterableType, [elementType]); + return createTypeFromGenericGlobalType(getGlobalIterableType(), [elementType]); } function createIterableIteratorType(elementType) { - return createTypeFromGenericGlobalType(globalIterableIteratorType, [elementType]); + return createTypeFromGenericGlobalType(getGlobalIterableIteratorType(), [elementType]); } function createArrayType(elementType) { return createTypeFromGenericGlobalType(globalArrayType, [elementType]); @@ -17837,7 +19933,8 @@ var ts; return tupleTypes[id] || (tupleTypes[id] = createNewTupleType(elementTypes)); } function createNewTupleType(elementTypes) { - var type = createObjectType(8192 /* Tuple */ | getPropagatingFlagsOfTypes(elementTypes)); + var propagatedFlags = getPropagatingFlagsOfTypes(elementTypes, /*excludeKinds*/ 0); + var type = createObjectType(8192 /* Tuple */ | propagatedFlags); type.elementTypes = elementTypes; return type; } @@ -17852,7 +19949,15 @@ var ts; if (type.flags & typeSetKind) { addTypesToSet(typeSet, type.types, typeSetKind); } - else if (!ts.contains(typeSet, type)) { + else if (type.flags & (1 /* Any */ | 32 /* Undefined */ | 64 /* Null */)) { + if (type.flags & 1 /* Any */) + typeSet.containsAny = true; + if (type.flags & 32 /* Undefined */) + typeSet.containsUndefined = true; + if (type.flags & 64 /* Null */) + typeSet.containsNull = true; + } + else if (type !== neverType && !ts.contains(typeSet, type)) { typeSet.push(type); } } @@ -17881,24 +19986,6 @@ var ts; } } } - function containsTypeAny(types) { - for (var _i = 0, types_5 = types; _i < types_5.length; _i++) { - var type = types_5[_i]; - if (isTypeAny(type)) { - return true; - } - } - return false; - } - function removeAllButLast(types, typeToRemove) { - var i = types.length; - while (i > 0 && types.length > 1) { - i--; - if (types[i] === typeToRemove) { - types.splice(i, 1); - } - } - } // We reduce the constituent type set to only include types that aren't subtypes of other types, unless // the noSubtypeReduction flag is specified, in which case we perform a simple deduplication based on // object identity. Subtype reduction is possible only when union types are known not to circularly @@ -17908,27 +19995,38 @@ var ts; // a named type that circularly references itself. function getUnionType(types, noSubtypeReduction) { if (types.length === 0) { - return emptyObjectType; + return neverType; + } + if (types.length === 1) { + return types[0]; } var typeSet = []; addTypesToSet(typeSet, types, 16384 /* Union */); - if (containsTypeAny(typeSet)) { + if (typeSet.containsAny) { return anyType; } - if (noSubtypeReduction) { - removeAllButLast(typeSet, undefinedType); - removeAllButLast(typeSet, nullType); + if (strictNullChecks) { + if (typeSet.containsNull) + typeSet.push(nullType); + if (typeSet.containsUndefined) + typeSet.push(undefinedType); } - else { + if (!noSubtypeReduction) { removeSubtypes(typeSet); } - if (typeSet.length === 1) { + if (typeSet.length === 0) { + return typeSet.containsNull ? nullType : + typeSet.containsUndefined ? undefinedType : + neverType; + } + else if (typeSet.length === 1) { return typeSet[0]; } var id = getTypeListId(typeSet); var type = unionTypes[id]; if (!type) { - type = unionTypes[id] = createObjectType(16384 /* Union */ | getPropagatingFlagsOfTypes(typeSet)); + var propagatedFlags = getPropagatingFlagsOfTypes(typeSet, /*excludeKinds*/ 96 /* Nullable */); + type = unionTypes[id] = createObjectType(16384 /* Union */ | propagatedFlags); type.types = typeSet; } return type; @@ -17951,16 +20049,23 @@ var ts; } var typeSet = []; addTypesToSet(typeSet, types, 32768 /* Intersection */); - if (containsTypeAny(typeSet)) { + if (typeSet.containsAny) { return anyType; } + if (strictNullChecks) { + if (typeSet.containsNull) + typeSet.push(nullType); + if (typeSet.containsUndefined) + typeSet.push(undefinedType); + } if (typeSet.length === 1) { return typeSet[0]; } var id = getTypeListId(typeSet); var type = intersectionTypes[id]; if (!type) { - type = intersectionTypes[id] = createObjectType(32768 /* Intersection */ | getPropagatingFlagsOfTypes(typeSet)); + var propagatedFlags = getPropagatingFlagsOfTypes(typeSet, /*excludeKinds*/ 96 /* Nullable */); + type = intersectionTypes[id] = createObjectType(32768 /* Intersection */ | propagatedFlags); type.types = typeSet; } return type; @@ -17980,8 +20085,7 @@ var ts; } return links.resolvedType; } - function getStringLiteralType(node) { - var text = node.text; + function getStringLiteralTypeForText(text) { if (ts.hasProperty(stringLiteralTypes, text)) { return stringLiteralTypes[text]; } @@ -17989,19 +20093,35 @@ var ts; type.text = text; return type; } - function getTypeFromStringLiteral(node) { + function getTypeFromStringLiteralTypeNode(node) { var links = getNodeLinks(node); if (!links.resolvedType) { - links.resolvedType = getStringLiteralType(node); + links.resolvedType = getStringLiteralTypeForText(ts.unescapeIdentifier(node.text)); + } + return links.resolvedType; + } + function getTypeFromJSDocVariadicType(node) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + var type = getTypeFromTypeNode(node.type); + links.resolvedType = type ? createArrayType(type) : unknownType; + } + return links.resolvedType; + } + function getTypeFromJSDocTupleType(node) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + var types = ts.map(node.types, getTypeFromTypeNode); + links.resolvedType = createTupleType(types); } return links.resolvedType; } function getThisType(node) { var container = ts.getThisContainer(node, /*includeArrowFunctions*/ false); var parent = container && container.parent; - if (parent && (ts.isClassLike(parent) || parent.kind === 215 /* InterfaceDeclaration */)) { - if (!(container.flags & 64 /* Static */) && - (container.kind !== 144 /* Constructor */ || ts.isNodeDescendentOf(node, container.body))) { + if (parent && (ts.isClassLike(parent) || parent.kind === 222 /* InterfaceDeclaration */)) { + if (!(container.flags & 32 /* Static */) && + (container.kind !== 148 /* Constructor */ || ts.isNodeDescendentOf(node, container.body))) { return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent)).thisType; } } @@ -18018,49 +20138,72 @@ var ts; function getTypeFromTypeNode(node) { switch (node.kind) { case 117 /* AnyKeyword */: + case 258 /* JSDocAllType */: + case 259 /* JSDocUnknownType */: return anyType; - case 130 /* StringKeyword */: + case 132 /* StringKeyword */: return stringType; - case 128 /* NumberKeyword */: + case 130 /* NumberKeyword */: return numberType; case 120 /* BooleanKeyword */: return booleanType; - case 131 /* SymbolKeyword */: + case 133 /* SymbolKeyword */: return esSymbolType; case 103 /* VoidKeyword */: return voidType; + case 135 /* UndefinedKeyword */: + return undefinedType; + case 93 /* NullKeyword */: + return nullType; + case 127 /* NeverKeyword */: + return neverType; + case 165 /* ThisType */: case 97 /* ThisKeyword */: return getTypeFromThisTypeNode(node); - case 9 /* StringLiteral */: - return getTypeFromStringLiteral(node); - case 151 /* TypeReference */: + case 166 /* StringLiteralType */: + return getTypeFromStringLiteralTypeNode(node); + case 155 /* TypeReference */: + case 267 /* JSDocTypeReference */: return getTypeFromTypeReference(node); - case 150 /* TypePredicate */: + case 154 /* TypePredicate */: return booleanType; - case 188 /* ExpressionWithTypeArguments */: + case 194 /* ExpressionWithTypeArguments */: return getTypeFromTypeReference(node); - case 154 /* TypeQuery */: + case 158 /* TypeQuery */: return getTypeFromTypeQueryNode(node); - case 156 /* ArrayType */: + case 160 /* ArrayType */: + case 260 /* JSDocArrayType */: return getTypeFromArrayTypeNode(node); - case 157 /* TupleType */: + case 161 /* TupleType */: return getTypeFromTupleTypeNode(node); - case 158 /* UnionType */: + case 162 /* UnionType */: + case 261 /* JSDocUnionType */: return getTypeFromUnionTypeNode(node); - case 159 /* IntersectionType */: + case 163 /* IntersectionType */: return getTypeFromIntersectionTypeNode(node); - case 160 /* ParenthesizedType */: + case 164 /* ParenthesizedType */: + case 263 /* JSDocNullableType */: + case 264 /* JSDocNonNullableType */: + case 271 /* JSDocConstructorType */: + case 272 /* JSDocThisType */: + case 268 /* JSDocOptionalType */: return getTypeFromTypeNode(node.type); - case 152 /* FunctionType */: - case 153 /* ConstructorType */: - case 155 /* TypeLiteral */: + case 156 /* FunctionType */: + case 157 /* ConstructorType */: + case 159 /* TypeLiteral */: + case 269 /* JSDocFunctionType */: + case 265 /* JSDocRecordType */: return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); // This function assumes that an identifier or qualified name is a type expression // Callers should first ensure this by calling isTypeNode case 69 /* Identifier */: - case 135 /* QualifiedName */: + case 139 /* QualifiedName */: var symbol = getSymbolAtLocation(node); return symbol && getDeclaredTypeOfSymbol(symbol); + case 262 /* JSDocTupleType */: + return getTypeFromJSDocTupleType(node); + case 270 /* JSDocVariadicType */: + return getTypeFromJSDocVariadicType(node); default: return unknownType; } @@ -18082,87 +20225,93 @@ var ts; function createBinaryTypeMapper(source1, target1, source2, target2) { return function (t) { return t === source1 ? target1 : t === source2 ? target2 : t; }; } - function createTypeMapper(sources, targets) { - switch (sources.length) { - case 1: return createUnaryTypeMapper(sources[0], targets[0]); - case 2: return createBinaryTypeMapper(sources[0], targets[0], sources[1], targets[1]); - } + function createArrayTypeMapper(sources, targets) { return function (t) { for (var i = 0; i < sources.length; i++) { if (t === sources[i]) { - return targets[i]; + return targets ? targets[i] : anyType; } } return t; }; } - function createUnaryTypeEraser(source) { - return function (t) { return t === source ? anyType : t; }; - } - function createBinaryTypeEraser(source1, source2) { - return function (t) { return t === source1 || t === source2 ? anyType : t; }; + function createTypeMapper(sources, targets) { + var count = sources.length; + var mapper = count == 1 ? createUnaryTypeMapper(sources[0], targets ? targets[0] : anyType) : + count == 2 ? createBinaryTypeMapper(sources[0], targets ? targets[0] : anyType, sources[1], targets ? targets[1] : anyType) : + createArrayTypeMapper(sources, targets); + mapper.mappedTypes = sources; + return mapper; } function createTypeEraser(sources) { - switch (sources.length) { - case 1: return createUnaryTypeEraser(sources[0]); - case 2: return createBinaryTypeEraser(sources[0], sources[1]); - } - return function (t) { - for (var _i = 0, sources_1 = sources; _i < sources_1.length; _i++) { - var source = sources_1[_i]; - if (t === source) { - return anyType; - } - } - return t; - }; + return createTypeMapper(sources, undefined); } - function createInferenceMapper(context) { - var mapper = function (t) { - for (var i = 0; i < context.typeParameters.length; i++) { - if (t === context.typeParameters[i]) { - context.inferences[i].isFixed = true; - return getInferredType(context, i); + function getInferenceMapper(context) { + if (!context.mapper) { + var mapper = function (t) { + var typeParameters = context.typeParameters; + for (var i = 0; i < typeParameters.length; i++) { + if (t === typeParameters[i]) { + context.inferences[i].isFixed = true; + return getInferredType(context, i); + } } - } - return t; - }; - mapper.context = context; - return mapper; + return t; + }; + mapper.mappedTypes = context.typeParameters; + mapper.context = context; + context.mapper = mapper; + } + return context.mapper; } function identityMapper(type) { return type; } function combineTypeMappers(mapper1, mapper2) { - return function (t) { return instantiateType(mapper1(t), mapper2); }; + var mapper = function (t) { return instantiateType(mapper1(t), mapper2); }; + mapper.mappedTypes = mapper1.mappedTypes; + return mapper; } - function instantiateTypeParameter(typeParameter, mapper) { + function cloneTypeParameter(typeParameter) { var result = createType(512 /* TypeParameter */); result.symbol = typeParameter.symbol; - if (typeParameter.constraint) { - result.constraint = instantiateType(typeParameter.constraint, mapper); + result.target = typeParameter; + return result; + } + function cloneTypePredicate(predicate, mapper) { + if (ts.isIdentifierTypePredicate(predicate)) { + return { + kind: 1 /* Identifier */, + parameterName: predicate.parameterName, + parameterIndex: predicate.parameterIndex, + type: instantiateType(predicate.type, mapper) + }; } else { - result.target = typeParameter; - result.mapper = mapper; + return { + kind: 0 /* This */, + type: instantiateType(predicate.type, mapper) + }; } - return result; } function instantiateSignature(signature, mapper, eraseTypeParameters) { var freshTypeParameters; var freshTypePredicate; if (signature.typeParameters && !eraseTypeParameters) { - freshTypeParameters = instantiateList(signature.typeParameters, mapper, instantiateTypeParameter); + // First create a fresh set of type parameters, then include a mapping from the old to the + // new type parameters in the mapper function. Finally store this mapper in the new type + // parameters such that we can use it when instantiating constraints. + freshTypeParameters = ts.map(signature.typeParameters, cloneTypeParameter); mapper = combineTypeMappers(createTypeMapper(signature.typeParameters, freshTypeParameters), mapper); + for (var _i = 0, freshTypeParameters_1 = freshTypeParameters; _i < freshTypeParameters_1.length; _i++) { + var tp = freshTypeParameters_1[_i]; + tp.mapper = mapper; + } } if (signature.typePredicate) { - freshTypePredicate = { - parameterName: signature.typePredicate.parameterName, - parameterIndex: signature.typePredicate.parameterIndex, - type: instantiateType(signature.typePredicate.type, mapper) - }; + freshTypePredicate = cloneTypePredicate(signature.typePredicate, mapper); } - var result = createSignature(signature.declaration, freshTypeParameters, instantiateList(signature.parameters, mapper, instantiateSymbol), instantiateType(signature.resolvedReturnType, mapper), freshTypePredicate, signature.minArgumentCount, signature.hasRestParameter, signature.hasStringLiterals); + var result = createSignature(signature.declaration, freshTypeParameters, signature.thisType && instantiateType(signature.thisType, mapper), instantiateList(signature.parameters, mapper, instantiateSymbol), instantiateType(signature.resolvedReturnType, mapper), freshTypePredicate, signature.minArgumentCount, signature.hasRestParameter, signature.hasStringLiterals); result.target = signature; result.mapper = mapper; return result; @@ -18205,13 +20354,70 @@ var ts; mapper.instantiations[type.id] = result; return result; } + function isSymbolInScopeOfMappedTypeParameter(symbol, mapper) { + var mappedTypes = mapper.mappedTypes; + // Starting with the parent of the symbol's declaration, check if the mapper maps any of + // the type parameters introduced by enclosing declarations. We just pick the first + // declaration since multiple declarations will all have the same parent anyway. + var node = symbol.declarations[0].parent; + while (node) { + switch (node.kind) { + case 156 /* FunctionType */: + case 157 /* ConstructorType */: + case 220 /* FunctionDeclaration */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: + case 148 /* Constructor */: + case 151 /* CallSignature */: + case 152 /* ConstructSignature */: + case 153 /* IndexSignature */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: + case 179 /* FunctionExpression */: + case 180 /* ArrowFunction */: + case 221 /* ClassDeclaration */: + case 192 /* ClassExpression */: + case 222 /* InterfaceDeclaration */: + case 223 /* TypeAliasDeclaration */: + var declaration = node; + if (declaration.typeParameters) { + for (var _i = 0, _a = declaration.typeParameters; _i < _a.length; _i++) { + var d = _a[_i]; + if (ts.contains(mappedTypes, getDeclaredTypeOfTypeParameter(getSymbolOfNode(d)))) { + return true; + } + } + } + if (ts.isClassLike(node) || node.kind === 222 /* InterfaceDeclaration */) { + var thisType = getDeclaredTypeOfClassOrInterface(getSymbolOfNode(node)).thisType; + if (thisType && ts.contains(mappedTypes, thisType)) { + return true; + } + } + break; + case 225 /* ModuleDeclaration */: + case 256 /* SourceFile */: + return false; + } + node = node.parent; + } + return false; + } function instantiateType(type, mapper) { if (type && mapper !== identityMapper) { if (type.flags & 512 /* TypeParameter */) { return mapper(type); } if (type.flags & 65536 /* Anonymous */) { - return type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) ? + // If the anonymous type originates in a declaration of a function, method, class, or + // interface, in an object type literal, or in an object literal expression, we may need + // to instantiate the type because it might reference a type parameter. We skip instantiation + // if none of the type parameters that are in scope in the type's declaration are mapped by + // the given mapper, however we can only do that analysis if the type isn't itself an + // instantiation. + return type.symbol && + type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && + (type.flags & 131072 /* Instantiated */ || isSymbolInScopeOfMappedTypeParameter(type.symbol, mapper)) ? instantiateAnonymousType(type, mapper) : type; } if (type.flags & 4096 /* Reference */) { @@ -18229,36 +20435,44 @@ var ts; } return type; } + function instantiateIndexInfo(info, mapper) { + return info && createIndexInfo(instantiateType(info.type, mapper), info.isReadonly, info.declaration); + } // Returns true if the given expression contains (at any level of nesting) a function or arrow expression // that is subject to contextual typing. function isContextSensitive(node) { - ts.Debug.assert(node.kind !== 143 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 147 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); switch (node.kind) { - case 173 /* FunctionExpression */: - case 174 /* ArrowFunction */: + case 179 /* FunctionExpression */: + case 180 /* ArrowFunction */: return isContextSensitiveFunctionLikeDeclaration(node); - case 165 /* ObjectLiteralExpression */: + case 171 /* ObjectLiteralExpression */: return ts.forEach(node.properties, isContextSensitive); - case 164 /* ArrayLiteralExpression */: + case 170 /* ArrayLiteralExpression */: return ts.forEach(node.elements, isContextSensitive); - case 182 /* ConditionalExpression */: + case 188 /* ConditionalExpression */: return isContextSensitive(node.whenTrue) || isContextSensitive(node.whenFalse); - case 181 /* BinaryExpression */: + case 187 /* BinaryExpression */: return node.operatorToken.kind === 52 /* BarBarToken */ && (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 245 /* PropertyAssignment */: + case 253 /* PropertyAssignment */: return isContextSensitive(node.initializer); - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: return isContextSensitiveFunctionLikeDeclaration(node); - case 172 /* ParenthesizedExpression */: + case 178 /* ParenthesizedExpression */: return isContextSensitive(node.expression); } return false; } function isContextSensitiveFunctionLikeDeclaration(node) { - return !node.typeParameters && node.parameters.length && !ts.forEach(node.parameters, function (p) { return p.type; }); + var areAllParametersUntyped = !ts.forEach(node.parameters, function (p) { return p.type; }); + var isNullaryArrow = node.kind === 180 /* ArrowFunction */ && !node.parameters.length; + return !node.typeParameters && areAllParametersUntyped && !isNullaryArrow; + } + function isContextSensitiveFunctionOrObjectLiteralMethod(func) { + return (isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) && isContextSensitiveFunctionLikeDeclaration(func); } function getTypeWithoutSignatures(type) { if (type.flags & 80896 /* ObjectType */) { @@ -18278,31 +20492,177 @@ var ts; function isTypeIdenticalTo(source, target) { return checkTypeRelatedTo(source, target, identityRelation, /*errorNode*/ undefined); } - function compareTypes(source, target) { + function compareTypesIdentical(source, target) { return checkTypeRelatedTo(source, target, identityRelation, /*errorNode*/ undefined) ? -1 /* True */ : 0 /* False */; } + function compareTypesAssignable(source, target) { + return checkTypeRelatedTo(source, target, assignableRelation, /*errorNode*/ undefined) ? -1 /* True */ : 0 /* False */; + } function isTypeSubtypeOf(source, target) { return checkTypeSubtypeOf(source, target, /*errorNode*/ undefined); } function isTypeAssignableTo(source, target) { return checkTypeAssignableTo(source, target, /*errorNode*/ undefined); } + /** + * This is *not* a bi-directional relationship. + * If one needs to check both directions for comparability, use a second call to this function or 'checkTypeComparableTo'. + */ + function isTypeComparableTo(source, target) { + return checkTypeComparableTo(source, target, /*errorNode*/ undefined); + } function checkTypeSubtypeOf(source, target, errorNode, headMessage, containingMessageChain) { return checkTypeRelatedTo(source, target, subtypeRelation, errorNode, headMessage, containingMessageChain); } function checkTypeAssignableTo(source, target, errorNode, headMessage, containingMessageChain) { return checkTypeRelatedTo(source, target, assignableRelation, errorNode, headMessage, containingMessageChain); } - function isSignatureAssignableTo(source, target) { - var sourceType = getOrCreateTypeFromSignature(source); - var targetType = getOrCreateTypeFromSignature(target); - return checkTypeRelatedTo(sourceType, targetType, assignableRelation, /*errorNode*/ undefined); + /** + * This is *not* a bi-directional relationship. + * If one needs to check both directions for comparability, use a second call to this function or 'isTypeComparableTo'. + */ + function checkTypeComparableTo(source, target, errorNode, headMessage, containingMessageChain) { + return checkTypeRelatedTo(source, target, comparableRelation, errorNode, headMessage, containingMessageChain); + } + function isSignatureAssignableTo(source, target, ignoreReturnTypes) { + return compareSignaturesRelated(source, target, ignoreReturnTypes, /*reportErrors*/ false, /*errorReporter*/ undefined, compareTypesAssignable) !== 0 /* False */; + } + /** + * See signatureRelatedTo, compareSignaturesIdentical + */ + function compareSignaturesRelated(source, target, ignoreReturnTypes, reportErrors, errorReporter, compareTypes) { + // TODO (drosen): De-duplicate code between related functions. + if (source === target) { + return -1 /* True */; + } + if (!target.hasRestParameter && source.minArgumentCount > target.parameters.length) { + return 0 /* False */; + } + // Spec 1.0 Section 3.8.3 & 3.8.4: + // M and N (the signatures) are instantiated using type Any as the type argument for all type parameters declared by M and N + source = getErasedSignature(source); + target = getErasedSignature(target); + var result = -1 /* True */; + if (source.thisType && target.thisType && source.thisType !== voidType) { + // void sources are assignable to anything. + var related = compareTypes(source.thisType, target.thisType, /*reportErrors*/ false) + || compareTypes(target.thisType, source.thisType, reportErrors); + if (!related) { + if (reportErrors) { + errorReporter(ts.Diagnostics.The_this_types_of_each_signature_are_incompatible); + } + return 0 /* False */; + } + result &= related; + } + var sourceMax = getNumNonRestParameters(source); + var targetMax = getNumNonRestParameters(target); + var checkCount = getNumParametersToCheckForSignatureRelatability(source, sourceMax, target, targetMax); + var sourceParams = source.parameters; + var targetParams = target.parameters; + for (var i = 0; i < checkCount; i++) { + var s = i < sourceMax ? getTypeOfParameter(sourceParams[i]) : getRestTypeOfSignature(source); + var t = i < targetMax ? getTypeOfParameter(targetParams[i]) : getRestTypeOfSignature(target); + var related = compareTypes(s, t, /*reportErrors*/ false) || compareTypes(t, s, reportErrors); + if (!related) { + if (reportErrors) { + errorReporter(ts.Diagnostics.Types_of_parameters_0_and_1_are_incompatible, sourceParams[i < sourceMax ? i : sourceMax].name, targetParams[i < targetMax ? i : targetMax].name); + } + return 0 /* False */; + } + result &= related; + } + if (!ignoreReturnTypes) { + var targetReturnType = getReturnTypeOfSignature(target); + if (targetReturnType === voidType) { + return result; + } + var sourceReturnType = getReturnTypeOfSignature(source); + // The following block preserves behavior forbidding boolean returning functions from being assignable to type guard returning functions + if (target.typePredicate) { + if (source.typePredicate) { + result &= compareTypePredicateRelatedTo(source.typePredicate, target.typePredicate, reportErrors, errorReporter, compareTypes); + } + else if (ts.isIdentifierTypePredicate(target.typePredicate)) { + if (reportErrors) { + errorReporter(ts.Diagnostics.Signature_0_must_have_a_type_predicate, signatureToString(source)); + } + return 0 /* False */; + } + } + else { + result &= compareTypes(sourceReturnType, targetReturnType, reportErrors); + } + } + return result; + } + function compareTypePredicateRelatedTo(source, target, reportErrors, errorReporter, compareTypes) { + if (source.kind !== target.kind) { + if (reportErrors) { + errorReporter(ts.Diagnostics.A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard); + errorReporter(ts.Diagnostics.Type_predicate_0_is_not_assignable_to_1, typePredicateToString(source), typePredicateToString(target)); + } + return 0 /* False */; + } + if (source.kind === 1 /* Identifier */) { + var sourceIdentifierPredicate = source; + var targetIdentifierPredicate = target; + if (sourceIdentifierPredicate.parameterIndex !== targetIdentifierPredicate.parameterIndex) { + if (reportErrors) { + errorReporter(ts.Diagnostics.Parameter_0_is_not_in_the_same_position_as_parameter_1, sourceIdentifierPredicate.parameterName, targetIdentifierPredicate.parameterName); + errorReporter(ts.Diagnostics.Type_predicate_0_is_not_assignable_to_1, typePredicateToString(source), typePredicateToString(target)); + } + return 0 /* False */; + } + } + var related = compareTypes(source.type, target.type, reportErrors); + if (related === 0 /* False */ && reportErrors) { + errorReporter(ts.Diagnostics.Type_predicate_0_is_not_assignable_to_1, typePredicateToString(source), typePredicateToString(target)); + } + return related; + } + function isImplementationCompatibleWithOverload(implementation, overload) { + var erasedSource = getErasedSignature(implementation); + var erasedTarget = getErasedSignature(overload); + // First see if the return types are compatible in either direction. + var sourceReturnType = getReturnTypeOfSignature(erasedSource); + var targetReturnType = getReturnTypeOfSignature(erasedTarget); + if (targetReturnType === voidType + || checkTypeRelatedTo(targetReturnType, sourceReturnType, assignableRelation, /*errorNode*/ undefined) + || checkTypeRelatedTo(sourceReturnType, targetReturnType, assignableRelation, /*errorNode*/ undefined)) { + return isSignatureAssignableTo(erasedSource, erasedTarget, /*ignoreReturnTypes*/ true); + } + return false; + } + function getNumNonRestParameters(signature) { + var numParams = signature.parameters.length; + return signature.hasRestParameter ? + numParams - 1 : + numParams; + } + function getNumParametersToCheckForSignatureRelatability(source, sourceNonRestParamCount, target, targetNonRestParamCount) { + if (source.hasRestParameter === target.hasRestParameter) { + if (source.hasRestParameter) { + // If both have rest parameters, get the max and add 1 to + // compensate for the rest parameter. + return Math.max(sourceNonRestParamCount, targetNonRestParamCount) + 1; + } + else { + return Math.min(sourceNonRestParamCount, targetNonRestParamCount); + } + } + else { + // Return the count for whichever signature doesn't have rest parameters. + return source.hasRestParameter ? + targetNonRestParamCount : + sourceNonRestParamCount; + } } /** * Checks if 'source' is related to 'target' (e.g.: is a assignable to). * @param source The left-hand-side of the relation. * @param target The right-hand-side of the relation. - * @param relation The relation considered. One of 'identityRelation', 'assignableRelation', or 'subTypeRelation'. + * @param relation The relation considered. One of 'identityRelation', 'subtypeRelation', 'assignableRelation', or 'comparableRelation'. * Used as both to determine which checks are performed and as a cache of previously computed results. * @param errorNode The suggested node upon which all errors will be reported, if defined. This may or may not be the actual node used. * @param headMessage If the error chain should be prepended by a head message, then headMessage will be used. @@ -18316,22 +20676,12 @@ var ts; var expandingFlags; var depth = 0; var overflow = false; - var elaborateErrors = false; ts.Debug.assert(relation !== identityRelation || !errorNode, "no error reporting in identity checking"); - var result = isRelatedTo(source, target, errorNode !== undefined, headMessage); + var result = isRelatedTo(source, target, /*reportErrors*/ !!errorNode, headMessage); if (overflow) { error(errorNode, ts.Diagnostics.Excessive_stack_depth_comparing_types_0_and_1, typeToString(source), typeToString(target)); } else if (errorInfo) { - // If we already computed this relation, but in a context where we didn't want to report errors (e.g. overload resolution), - // then we'll only have a top-level error (e.g. 'Class X does not implement interface Y') without any details. If this happened, - // request a recompuation to get a complete error message. This will be skipped if we've already done this computation in a context - // where errors were being reported. - if (errorInfo.next === undefined) { - errorInfo = undefined; - elaborateErrors = true; - isRelatedTo(source, target, errorNode !== undefined, headMessage); - } if (containingMessageChain) { errorInfo = ts.concatenateDiagnosticMessageChains(containingMessageChain, errorInfo); } @@ -18339,6 +20689,7 @@ var ts; } return result !== 0 /* False */; function reportError(message, arg0, arg1, arg2) { + ts.Debug.assert(!!errorNode); errorInfo = ts.chainDiagnosticMessages(errorInfo, message, arg0, arg1, arg2); } function reportRelationError(message, source, target) { @@ -18348,7 +20699,12 @@ var ts; sourceType = typeToString(source, /*enclosingDeclaration*/ undefined, 128 /* UseFullyQualifiedType */); targetType = typeToString(target, /*enclosingDeclaration*/ undefined, 128 /* UseFullyQualifiedType */); } - reportError(message || ts.Diagnostics.Type_0_is_not_assignable_to_type_1, sourceType, targetType); + if (!message) { + message = relation === comparableRelation ? + ts.Diagnostics.Type_0_is_not_comparable_to_type_1 : + ts.Diagnostics.Type_0_is_not_assignable_to_type_1; + } + reportError(message, sourceType, targetType); } // Compare two types and return // Ternary.True if they are related with no assumptions, @@ -18362,21 +20718,35 @@ var ts; if (relation === identityRelation) { return isIdenticalTo(source, target); } - if (isTypeAny(target)) - return -1 /* True */; - if (source === undefinedType) - return -1 /* True */; - if (source === nullType && target !== undefinedType) - return -1 /* True */; - if (source.flags & 128 /* Enum */ && target === numberType) - return -1 /* True */; - if (source.flags & 256 /* StringLiteral */ && target === stringType) - return -1 /* True */; - if (relation === assignableRelation) { - if (isTypeAny(source)) + if (!(target.flags & 134217728 /* Never */)) { + if (target.flags & 1 /* Any */) return -1 /* True */; - if (source === numberType && target.flags & 128 /* Enum */) + if (source.flags & 32 /* Undefined */) { + if (!strictNullChecks || target.flags & (32 /* Undefined */ | 16 /* Void */) || source === emptyArrayElementType) + return -1 /* True */; + } + if (source.flags & 64 /* Null */) { + if (!strictNullChecks || target.flags & 64 /* Null */) + return -1 /* True */; + } + if (source.flags & 128 /* Enum */ && target === numberType) return -1 /* True */; + if (source.flags & 128 /* Enum */ && target.flags & 128 /* Enum */) { + if (result = enumRelatedTo(source, target, reportErrors)) { + return result; + } + } + if (source.flags & 256 /* StringLiteral */ && target === stringType) + return -1 /* True */; + if (relation === assignableRelation || relation === comparableRelation) { + if (source.flags & (1 /* Any */ | 134217728 /* Never */)) + return -1 /* True */; + if (source === numberType && target.flags & 128 /* Enum */) + return -1 /* True */; + } + if (source.flags & 8 /* Boolean */ && target.flags & 8 /* Boolean */) { + return -1 /* True */; + } } if (source.flags & 1048576 /* FreshObjectLiteral */) { if (hasExcessProperties(source, target, reportErrors)) { @@ -18394,29 +20764,48 @@ var ts; } } var saveErrorInfo = errorInfo; - // Note that the "each" checks must precede the "some" checks to produce the correct results + // Note that these checks are specifically ordered to produce correct results. if (source.flags & 16384 /* Union */) { - if (result = eachTypeRelatedToType(source, target, reportErrors)) { + if (relation === comparableRelation) { + result = someTypeRelatedToType(source, target, reportErrors); + } + else { + result = eachTypeRelatedToType(source, target, reportErrors); + } + if (result) { return result; } } else if (target.flags & 32768 /* Intersection */) { - if (result = typeRelatedToEachType(source, target, reportErrors)) { + result = typeRelatedToEachType(source, target, reportErrors); + if (result) { return result; } } else { - // It is necessary to try "some" checks on both sides because there may be nested "each" checks + // It is necessary to try these "some" checks on both sides because there may be nested "each" checks // on either side that need to be prioritized. For example, A | B = (A | B) & (C | D) or // A & B = (A & B) | (C & D). if (source.flags & 32768 /* Intersection */) { - // If target is a union type the following check will report errors so we suppress them here - if (result = someTypeRelatedToType(source, target, reportErrors && !(target.flags & 16384 /* Union */))) { + // Check to see if any constituents of the intersection are immediately related to the target. + // + // Don't report errors though. Checking whether a constituent is related to the source is not actually + // useful and leads to some confusing error messages. Instead it is better to let the below checks + // take care of this, or to not elaborate at all. For instance, + // + // - For an object type (such as 'C = A & B'), users are usually more interested in structural errors. + // + // - For a union type (such as '(A | B) = (C & D)'), it's better to hold onto the whole intersection + // than to report that 'D' is not assignable to 'A' or 'B'. + // + // - For a primitive type or type parameter (such as 'number = A & B') there is no point in + // breaking the intersection apart. + if (result = someTypeRelatedToType(source, target, /*reportErrors*/ false)) { return result; } } if (target.flags & 16384 /* Union */) { - if (result = typeRelatedToSomeType(source, target, reportErrors)) { + if (result = typeRelatedToSomeType(source, target, reportErrors && !(source.flags & 16777726 /* Primitive */))) { return result; } } @@ -18426,6 +20815,8 @@ var ts; if (!constraint || constraint.flags & 1 /* Any */) { constraint = emptyObjectType; } + // The constraint may need to be further instantiated with its 'this' type. + constraint = getTypeWithThisArgument(constraint, source); // Report constraint errors only if the constraint is not the empty object type var reportConstraintErrors = reportErrors && constraint !== emptyObjectType; if (result = isRelatedTo(constraint, target, reportConstraintErrors)) { @@ -18442,14 +20833,14 @@ var ts; } // Even if relationship doesn't hold for unions, intersections, or generic type references, // it may hold in a structural comparison. - var apparentType = getApparentType(source); + var apparentSource = getApparentType(source); // In a check of the form X = A & B, we will have previously checked if A relates to X or B relates // to X. Failing both of those we want to check if the aggregation of A and B's members structurally // relates to X. Thus, we include intersection types on the source side here. - if (apparentType.flags & (80896 /* ObjectType */ | 32768 /* Intersection */) && target.flags & 80896 /* ObjectType */) { + if (apparentSource.flags & (80896 /* ObjectType */ | 32768 /* Intersection */) && target.flags & 80896 /* ObjectType */) { // Report structural errors only if we haven't reported any errors yet - var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo; - if (result = objectTypeRelatedTo(apparentType, source, target, reportStructuralErrors)) { + var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo && !(source.flags & 16777726 /* Primitive */); + if (result = objectTypeRelatedTo(apparentSource, source, target, reportStructuralErrors)) { errorInfo = saveErrorInfo; return result; } @@ -18471,13 +20862,10 @@ var ts; } return objectTypeRelatedTo(source, source, target, /*reportErrors*/ false); } - if (source.flags & 512 /* TypeParameter */ && target.flags & 512 /* TypeParameter */) { - return typeParameterIdenticalTo(source, target); - } if (source.flags & 16384 /* Union */ && target.flags & 16384 /* Union */ || source.flags & 32768 /* Intersection */ && target.flags & 32768 /* Intersection */) { - if (result = eachTypeRelatedToSomeType(source, target)) { - if (result &= eachTypeRelatedToSomeType(target, source)) { + if (result = eachTypeRelatedToSomeType(source, target, /*reportErrors*/ false)) { + if (result &= eachTypeRelatedToSomeType(target, source, /*reportErrors*/ false)) { return result; } } @@ -18491,8 +20879,9 @@ var ts; function isKnownProperty(type, name) { if (type.flags & 80896 /* ObjectType */) { var resolved = resolveStructuredTypeMembers(type); - if (relation === assignableRelation && (type === globalObjectType || resolved.properties.length === 0) || - resolved.stringIndexType || resolved.numberIndexType || getPropertyOfType(type, name)) { + if ((relation === assignableRelation || relation === comparableRelation) && + (type === globalObjectType || isEmptyObjectType(resolved)) || + resolved.stringIndexInfo || resolved.numberIndexInfo || getPropertyOfType(type, name)) { return true; } } @@ -18506,8 +20895,15 @@ var ts; } return false; } + function isEmptyObjectType(t) { + return t.properties.length === 0 && + t.callSignatures.length === 0 && + t.constructSignatures.length === 0 && + !t.stringIndexInfo && + !t.numberIndexInfo; + } function hasExcessProperties(source, target, reportErrors) { - if (!(target.flags & 67108864 /* ObjectLiteralPatternWithComputedProperties */) && someConstituentTypeHasKind(target, 80896 /* ObjectType */)) { + if (!(target.flags & 67108864 /* ObjectLiteralPatternWithComputedProperties */) && maybeTypeOfKind(target, 80896 /* ObjectType */)) { for (var _i = 0, _a = getPropertiesOfObjectType(source); _i < _a.length; _i++) { var prop = _a[_i]; if (!isKnownProperty(target, prop.name)) { @@ -18515,6 +20911,7 @@ var ts; // We know *exactly* where things went wrong when comparing the types. // Use this property as the error node as this will be more helpful in // reasoning about what went wrong. + ts.Debug.assert(!!errorNode); errorNode = prop.valueDeclaration; reportError(ts.Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1, symbolToString(prop), typeToString(target)); } @@ -18524,12 +20921,12 @@ var ts; } return false; } - function eachTypeRelatedToSomeType(source, target) { + function eachTypeRelatedToSomeType(source, target, reportErrors) { var result = -1 /* True */; var sourceTypes = source.types; for (var _i = 0, sourceTypes_1 = sourceTypes; _i < sourceTypes_1.length; _i++) { var sourceType = sourceTypes_1[_i]; - var related = typeRelatedToSomeType(sourceType, target, false); + var related = typeRelatedToSomeType(sourceType, target, /*reportErrors*/ false); if (!related) { return 0 /* False */; } @@ -18539,7 +20936,19 @@ var ts; } function typeRelatedToSomeType(source, target, reportErrors) { var targetTypes = target.types; - for (var i = 0, len = targetTypes.length; i < len; i++) { + var len = targetTypes.length; + // The null and undefined types are guaranteed to be at the end of the constituent type list. In order + // to produce the best possible errors we first check the nullable types, such that the last type we + // check and report errors from is a non-nullable type if one is present. + while (len >= 2 && targetTypes[len - 1].flags & 96 /* Nullable */) { + var related = isRelatedTo(source, targetTypes[len - 1], /*reportErrors*/ false); + if (related) { + return related; + } + len--; + } + // Now check the non-nullable types and report errors on the last one. + for (var i = 0; i < len; i++) { var related = isRelatedTo(source, targetTypes[i], reportErrors && i === len - 1); if (related) { return related; @@ -18562,7 +20971,19 @@ var ts; } function someTypeRelatedToType(source, target, reportErrors) { var sourceTypes = source.types; - for (var i = 0, len = sourceTypes.length; i < len; i++) { + var len = sourceTypes.length; + // The null and undefined types are guaranteed to be at the end of the constituent type list. In order + // to produce the best possible errors we first check the nullable types, such that the last type we + // check and report errors from is a non-nullable type if one is present. + while (len >= 2 && sourceTypes[len - 1].flags & 96 /* Nullable */) { + var related = isRelatedTo(sourceTypes[len - 1], target, /*reportErrors*/ false); + if (related) { + return related; + } + len--; + } + // Now check the non-nullable types and report errors on the last one. + for (var i = 0; i < len; i++) { var related = isRelatedTo(sourceTypes[i], target, reportErrors && i === len - 1); if (related) { return related; @@ -18589,8 +21010,9 @@ var ts; if (sources.length !== targets.length && relation === identityRelation) { return 0 /* False */; } + var length = sources.length <= targets.length ? sources.length : targets.length; var result = -1 /* True */; - for (var i = 0; i < targets.length; i++) { + for (var i = 0; i < length; i++) { var related = isRelatedTo(sources[i], targets[i], reportErrors); if (!related) { return 0 /* False */; @@ -18599,31 +21021,24 @@ var ts; } return result; } - function typeParameterIdenticalTo(source, target) { - // covers case when both type parameters does not have constraint (both equal to noConstraintType) - if (source.constraint === target.constraint) { - return -1 /* True */; - } - if (source.constraint === noConstraintType || target.constraint === noConstraintType) { - return 0 /* False */; - } - return isIdenticalTo(source.constraint, target.constraint); - } // Determine if two object types are related by structure. First, check if the result is already available in the global cache. // Second, check if we have already started a comparison of the given two types in which case we assume the result to be true. // Third, check if both types are part of deeply nested chains of generic type instantiations and if so assume the types are // equal and infinitely expanding. Fourth, if we have reached a depth of 100 nested comparisons, assume we have runaway recursion // and issue an error. Otherwise, actually compare the structure of the two types. - function objectTypeRelatedTo(apparentSource, originalSource, target, reportErrors) { + function objectTypeRelatedTo(source, originalSource, target, reportErrors) { if (overflow) { return 0 /* False */; } - var id = relation !== identityRelation || apparentSource.id < target.id ? apparentSource.id + "," + target.id : target.id + "," + apparentSource.id; + var id = relation !== identityRelation || source.id < target.id ? source.id + "," + target.id : target.id + "," + source.id; var related = relation[id]; if (related !== undefined) { - // If we computed this relation already and it was failed and reported, or if we're not being asked to elaborate - // errors, we can use the cached value. Otherwise, recompute the relation - if (!elaborateErrors || (related === 3 /* FailedAndReported */)) { + if (reportErrors && related === 2 /* Failed */) { + // We are elaborating errors and the cached result is an unreported failure. Record the result as a reported + // failure and continue computing the relation such that errors get reported. + relation[id] = 3 /* FailedAndReported */; + } + else { return related === 1 /* Succeeded */ ? -1 /* True */ : 0 /* False */; } } @@ -18645,13 +21060,13 @@ var ts; maybeStack = []; expandingFlags = 0; } - sourceStack[depth] = apparentSource; + sourceStack[depth] = source; targetStack[depth] = target; maybeStack[depth] = {}; maybeStack[depth][id] = 1 /* Succeeded */; depth++; var saveExpandingFlags = expandingFlags; - if (!(expandingFlags & 1) && isDeeplyNestedGeneric(apparentSource, sourceStack, depth)) + if (!(expandingFlags & 1) && isDeeplyNestedGeneric(source, sourceStack, depth)) expandingFlags |= 1; if (!(expandingFlags & 2) && isDeeplyNestedGeneric(target, targetStack, depth)) expandingFlags |= 2; @@ -18660,15 +21075,15 @@ var ts; result = 1 /* Maybe */; } else { - result = propertiesRelatedTo(apparentSource, target, reportErrors); + result = propertiesRelatedTo(source, target, reportErrors); if (result) { - result &= signaturesRelatedTo(apparentSource, target, 0 /* Call */, reportErrors); + result &= signaturesRelatedTo(source, target, 0 /* Call */, reportErrors); if (result) { - result &= signaturesRelatedTo(apparentSource, target, 1 /* Construct */, reportErrors); + result &= signaturesRelatedTo(source, target, 1 /* Construct */, reportErrors); if (result) { - result &= stringIndexTypesRelatedTo(apparentSource, originalSource, target, reportErrors); + result &= indexTypesRelatedTo(source, originalSource, target, 0 /* String */, reportErrors); if (result) { - result &= numberIndexTypesRelatedTo(apparentSource, originalSource, target, reportErrors); + result &= indexTypesRelatedTo(source, originalSource, target, 1 /* Number */, reportErrors); } } } @@ -18711,23 +21126,23 @@ var ts; else if (!(targetProp.flags & 134217728 /* Prototype */)) { var sourcePropFlags = getDeclarationFlagsFromSymbol(sourceProp); var targetPropFlags = getDeclarationFlagsFromSymbol(targetProp); - if (sourcePropFlags & 16 /* Private */ || targetPropFlags & 16 /* Private */) { + if (sourcePropFlags & 8 /* Private */ || targetPropFlags & 8 /* Private */) { if (sourceProp.valueDeclaration !== targetProp.valueDeclaration) { if (reportErrors) { - if (sourcePropFlags & 16 /* Private */ && targetPropFlags & 16 /* Private */) { + if (sourcePropFlags & 8 /* Private */ && targetPropFlags & 8 /* Private */) { reportError(ts.Diagnostics.Types_have_separate_declarations_of_a_private_property_0, symbolToString(targetProp)); } else { - reportError(ts.Diagnostics.Property_0_is_private_in_type_1_but_not_in_type_2, symbolToString(targetProp), typeToString(sourcePropFlags & 16 /* Private */ ? source : target), typeToString(sourcePropFlags & 16 /* Private */ ? target : source)); + reportError(ts.Diagnostics.Property_0_is_private_in_type_1_but_not_in_type_2, symbolToString(targetProp), typeToString(sourcePropFlags & 8 /* Private */ ? source : target), typeToString(sourcePropFlags & 8 /* Private */ ? target : source)); } } return 0 /* False */; } } - else if (targetPropFlags & 32 /* Protected */) { + else if (targetPropFlags & 16 /* Protected */) { var sourceDeclaredInClass = sourceProp.parent && sourceProp.parent.flags & 32 /* Class */; - var sourceClass = sourceDeclaredInClass ? getDeclaredTypeOfSymbol(sourceProp.parent) : undefined; - var targetClass = getDeclaredTypeOfSymbol(targetProp.parent); + var sourceClass = sourceDeclaredInClass ? getDeclaredTypeOfSymbol(getParentOfSymbol(sourceProp)) : undefined; + var targetClass = getDeclaredTypeOfSymbol(getParentOfSymbol(targetProp)); if (!sourceClass || !hasBaseType(sourceClass, targetClass)) { if (reportErrors) { reportError(ts.Diagnostics.Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2, symbolToString(targetProp), typeToString(sourceClass || source), typeToString(targetClass)); @@ -18735,7 +21150,7 @@ var ts; return 0 /* False */; } } - else if (sourcePropFlags & 32 /* Protected */) { + else if (sourcePropFlags & 16 /* Protected */) { if (reportErrors) { reportError(ts.Diagnostics.Property_0_is_protected_in_type_1_but_public_in_type_2, symbolToString(targetProp), typeToString(source), typeToString(target)); } @@ -18800,154 +21215,49 @@ var ts; } var sourceSignatures = getSignaturesOfType(source, kind); var targetSignatures = getSignaturesOfType(target, kind); + if (kind === 1 /* Construct */ && sourceSignatures.length && targetSignatures.length) { + if (isAbstractConstructorType(source) && !isAbstractConstructorType(target)) { + // An abstract constructor type is not assignable to a non-abstract constructor type + // as it would otherwise be possible to new an abstract class. Note that the assignability + // check we perform for an extends clause excludes construct signatures from the target, + // so this check never proceeds. + if (reportErrors) { + reportError(ts.Diagnostics.Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type); + } + return 0 /* False */; + } + if (!constructorVisibilitiesAreCompatible(sourceSignatures[0], targetSignatures[0], reportErrors)) { + return 0 /* False */; + } + } var result = -1 /* True */; var saveErrorInfo = errorInfo; - if (kind === 1 /* Construct */) { - // Only want to compare the construct signatures for abstractness guarantees. - // Because the "abstractness" of a class is the same across all construct signatures - // (internally we are checking the corresponding declaration), it is enough to perform - // the check and report an error once over all pairs of source and target construct signatures. - // - // sourceSig and targetSig are (possibly) undefined. - // - // Note that in an extends-clause, targetSignatures is stripped, so the check never proceeds. - var sourceSig = sourceSignatures[0]; - var targetSig = targetSignatures[0]; - result &= abstractSignatureRelatedTo(source, sourceSig, target, targetSig); - if (result !== -1 /* True */) { - return result; - } - } outer: for (var _i = 0, targetSignatures_1 = targetSignatures; _i < targetSignatures_1.length; _i++) { var t = targetSignatures_1[_i]; - if (!t.hasStringLiterals || target.flags & 262144 /* FromSignature */) { - var localErrors = reportErrors; - var checkedAbstractAssignability = false; - for (var _a = 0, sourceSignatures_1 = sourceSignatures; _a < sourceSignatures_1.length; _a++) { - var s = sourceSignatures_1[_a]; - if (!s.hasStringLiterals || source.flags & 262144 /* FromSignature */) { - var related = signatureRelatedTo(s, t, localErrors); - if (related) { - result &= related; - errorInfo = saveErrorInfo; - continue outer; - } - // Only report errors from the first failure - localErrors = false; - } + // Only elaborate errors from the first failure + var shouldElaborateErrors = reportErrors; + for (var _a = 0, sourceSignatures_1 = sourceSignatures; _a < sourceSignatures_1.length; _a++) { + var s = sourceSignatures_1[_a]; + var related = signatureRelatedTo(s, t, shouldElaborateErrors); + if (related) { + result &= related; + errorInfo = saveErrorInfo; + continue outer; } - return 0 /* False */; + shouldElaborateErrors = false; } + if (shouldElaborateErrors) { + reportError(ts.Diagnostics.Type_0_provides_no_match_for_the_signature_1, typeToString(source), signatureToString(t, /*enclosingDeclaration*/ undefined, /*flags*/ undefined, kind)); + } + return 0 /* False */; } return result; - function abstractSignatureRelatedTo(source, sourceSig, target, targetSig) { - if (sourceSig && targetSig) { - var sourceDecl = source.symbol && getClassLikeDeclarationOfSymbol(source.symbol); - var targetDecl = target.symbol && getClassLikeDeclarationOfSymbol(target.symbol); - if (!sourceDecl) { - // If the source object isn't itself a class declaration, it can be freely assigned, regardless - // of whether the constructed object is abstract or not. - return -1 /* True */; - } - var sourceErasedSignature = getErasedSignature(sourceSig); - var targetErasedSignature = getErasedSignature(targetSig); - var sourceReturnType = sourceErasedSignature && getReturnTypeOfSignature(sourceErasedSignature); - var targetReturnType = targetErasedSignature && getReturnTypeOfSignature(targetErasedSignature); - var sourceReturnDecl = sourceReturnType && sourceReturnType.symbol && getClassLikeDeclarationOfSymbol(sourceReturnType.symbol); - var targetReturnDecl = targetReturnType && targetReturnType.symbol && getClassLikeDeclarationOfSymbol(targetReturnType.symbol); - var sourceIsAbstract = sourceReturnDecl && sourceReturnDecl.flags & 128 /* Abstract */; - var targetIsAbstract = targetReturnDecl && targetReturnDecl.flags & 128 /* Abstract */; - if (sourceIsAbstract && !(targetIsAbstract && targetDecl)) { - // if target isn't a class-declaration type, then it can be new'd, so we forbid the assignment. - if (reportErrors) { - reportError(ts.Diagnostics.Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type); - } - return 0 /* False */; - } - } - return -1 /* True */; - } } + /** + * See signatureAssignableTo, compareSignaturesIdentical + */ function signatureRelatedTo(source, target, reportErrors) { - if (source === target) { - return -1 /* True */; - } - if (!target.hasRestParameter && source.minArgumentCount > target.parameters.length) { - return 0 /* False */; - } - var sourceMax = source.parameters.length; - var targetMax = target.parameters.length; - var checkCount; - if (source.hasRestParameter && target.hasRestParameter) { - checkCount = sourceMax > targetMax ? sourceMax : targetMax; - sourceMax--; - targetMax--; - } - else if (source.hasRestParameter) { - sourceMax--; - checkCount = targetMax; - } - else if (target.hasRestParameter) { - targetMax--; - checkCount = sourceMax; - } - else { - checkCount = sourceMax < targetMax ? sourceMax : targetMax; - } - // Spec 1.0 Section 3.8.3 & 3.8.4: - // M and N (the signatures) are instantiated using type Any as the type argument for all type parameters declared by M and N - source = getErasedSignature(source); - target = getErasedSignature(target); - var result = -1 /* True */; - for (var i = 0; i < checkCount; i++) { - var s = i < sourceMax ? getTypeOfSymbol(source.parameters[i]) : getRestTypeOfSignature(source); - var t = i < targetMax ? getTypeOfSymbol(target.parameters[i]) : getRestTypeOfSignature(target); - var saveErrorInfo = errorInfo; - var related = isRelatedTo(s, t, reportErrors); - if (!related) { - related = isRelatedTo(t, s, false); - if (!related) { - if (reportErrors) { - reportError(ts.Diagnostics.Types_of_parameters_0_and_1_are_incompatible, source.parameters[i < sourceMax ? i : sourceMax].name, target.parameters[i < targetMax ? i : targetMax].name); - } - return 0 /* False */; - } - errorInfo = saveErrorInfo; - } - result &= related; - } - if (source.typePredicate && target.typePredicate) { - var hasDifferentParameterIndex = source.typePredicate.parameterIndex !== target.typePredicate.parameterIndex; - var hasDifferentTypes; - if (hasDifferentParameterIndex || - (hasDifferentTypes = !isTypeIdenticalTo(source.typePredicate.type, target.typePredicate.type))) { - if (reportErrors) { - var sourceParamText = source.typePredicate.parameterName; - var targetParamText = target.typePredicate.parameterName; - var sourceTypeText = typeToString(source.typePredicate.type); - var targetTypeText = typeToString(target.typePredicate.type); - if (hasDifferentParameterIndex) { - reportError(ts.Diagnostics.Parameter_0_is_not_in_the_same_position_as_parameter_1, sourceParamText, targetParamText); - } - else if (hasDifferentTypes) { - reportError(ts.Diagnostics.Type_0_is_not_assignable_to_type_1, sourceTypeText, targetTypeText); - } - reportError(ts.Diagnostics.Type_predicate_0_is_not_assignable_to_1, sourceParamText + " is " + sourceTypeText, targetParamText + " is " + targetTypeText); - } - return 0 /* False */; - } - } - else if (!source.typePredicate && target.typePredicate) { - if (reportErrors) { - reportError(ts.Diagnostics.Signature_0_must_have_a_type_predicate, signatureToString(source)); - } - return 0 /* False */; - } - var targetReturnType = getReturnTypeOfSignature(target); - if (targetReturnType === voidType) - return result; - var sourceReturnType = getReturnTypeOfSignature(source); - return result & isRelatedTo(sourceReturnType, targetReturnType, reportErrors); + return compareSignaturesRelated(source, target, /*ignoreReturnTypes*/ false, reportErrors, reportError, isRelatedTo); } function signaturesIdenticalTo(source, target, kind) { var sourceSignatures = getSignaturesOfType(source, kind); @@ -18956,8 +21266,8 @@ var ts; return 0 /* False */; } var result = -1 /* True */; - for (var i = 0, len = sourceSignatures.length; i < len; ++i) { - var related = compareSignatures(sourceSignatures[i], targetSignatures[i], /*partialMatch*/ false, /*ignoreReturnTypes*/ false, isRelatedTo); + for (var i = 0, len = sourceSignatures.length; i < len; i++) { + var related = compareSignaturesIdentical(sourceSignatures[i], targetSignatures[i], /*partialMatch*/ false, /*ignoreThisTypes*/ false, /*ignoreReturnTypes*/ false, isRelatedTo); if (!related) { return 0 /* False */; } @@ -18965,83 +21275,130 @@ var ts; } return result; } - function stringIndexTypesRelatedTo(source, originalSource, target, reportErrors) { - if (relation === identityRelation) { - return indexTypesIdenticalTo(0 /* String */, source, target); - } - var targetType = getIndexTypeOfType(target, 0 /* String */); - if (targetType) { - if ((targetType.flags & 1 /* Any */) && !(originalSource.flags & 16777726 /* Primitive */)) { - // non-primitive assignment to any is always allowed, eg - // `var x: { [index: string]: any } = { property: 12 };` - return -1 /* True */; - } - var sourceType = getIndexTypeOfType(source, 0 /* String */); - if (!sourceType) { - if (reportErrors) { - reportError(ts.Diagnostics.Index_signature_is_missing_in_type_0, typeToString(source)); + function eachPropertyRelatedTo(source, target, kind, reportErrors) { + var result = -1 /* True */; + for (var _i = 0, _a = getPropertiesOfObjectType(source); _i < _a.length; _i++) { + var prop = _a[_i]; + if (kind === 0 /* String */ || isNumericLiteralName(prop.name)) { + var related = isRelatedTo(getTypeOfSymbol(prop), target, reportErrors); + if (!related) { + if (reportErrors) { + reportError(ts.Diagnostics.Property_0_is_incompatible_with_index_signature, symbolToString(prop)); + } + return 0 /* False */; } - return 0 /* False */; + result &= related; } - var related = isRelatedTo(sourceType, targetType, reportErrors); - if (!related) { - if (reportErrors) { - reportError(ts.Diagnostics.Index_signatures_are_incompatible); - } - return 0 /* False */; - } - return related; } - return -1 /* True */; + return result; } - function numberIndexTypesRelatedTo(source, originalSource, target, reportErrors) { - if (relation === identityRelation) { - return indexTypesIdenticalTo(1 /* Number */, source, target); + function indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors) { + var related = isRelatedTo(sourceInfo.type, targetInfo.type, reportErrors); + if (!related && reportErrors) { + reportError(ts.Diagnostics.Index_signatures_are_incompatible); } - var targetType = getIndexTypeOfType(target, 1 /* Number */); - if (targetType) { - if ((targetType.flags & 1 /* Any */) && !(originalSource.flags & 16777726 /* Primitive */)) { - // non-primitive assignment to any is always allowed, eg - // `var x: { [index: number]: any } = { property: 12 };` - return -1 /* True */; - } - var sourceStringType = getIndexTypeOfType(source, 0 /* String */); - var sourceNumberType = getIndexTypeOfType(source, 1 /* Number */); - if (!(sourceStringType || sourceNumberType)) { - if (reportErrors) { - reportError(ts.Diagnostics.Index_signature_is_missing_in_type_0, typeToString(source)); - } - return 0 /* False */; - } - var related; - if (sourceStringType && sourceNumberType) { - // If we know for sure we're testing both string and numeric index types then only report errors from the second one - related = isRelatedTo(sourceStringType, targetType, false) || isRelatedTo(sourceNumberType, targetType, reportErrors); - } - else { - related = isRelatedTo(sourceStringType || sourceNumberType, targetType, reportErrors); - } - if (!related) { - if (reportErrors) { - reportError(ts.Diagnostics.Index_signatures_are_incompatible); - } - return 0 /* False */; - } - return related; - } - return -1 /* True */; + return related; } - function indexTypesIdenticalTo(indexKind, source, target) { - var targetType = getIndexTypeOfType(target, indexKind); - var sourceType = getIndexTypeOfType(source, indexKind); - if (!sourceType && !targetType) { + function indexTypesRelatedTo(source, originalSource, target, kind, reportErrors) { + if (relation === identityRelation) { + return indexTypesIdenticalTo(source, target, kind); + } + var targetInfo = getIndexInfoOfType(target, kind); + if (!targetInfo || ((targetInfo.type.flags & 1 /* Any */) && !(originalSource.flags & 16777726 /* Primitive */))) { + // Index signature of type any permits assignment from everything but primitives return -1 /* True */; } - if (sourceType && targetType) { - return isRelatedTo(sourceType, targetType); + var sourceInfo = getIndexInfoOfType(source, kind) || + kind === 1 /* Number */ && getIndexInfoOfType(source, 0 /* String */); + if (sourceInfo) { + return indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors); + } + if (isObjectLiteralType(source)) { + var related = -1 /* True */; + if (kind === 0 /* String */) { + var sourceNumberInfo = getIndexInfoOfType(source, 1 /* Number */); + if (sourceNumberInfo) { + related = indexInfoRelatedTo(sourceNumberInfo, targetInfo, reportErrors); + } + } + if (related) { + related &= eachPropertyRelatedTo(source, targetInfo.type, kind, reportErrors); + } + return related; + } + if (reportErrors) { + reportError(ts.Diagnostics.Index_signature_is_missing_in_type_0, typeToString(source)); } return 0 /* False */; } + function indexTypesIdenticalTo(source, target, indexKind) { + var targetInfo = getIndexInfoOfType(target, indexKind); + var sourceInfo = getIndexInfoOfType(source, indexKind); + if (!sourceInfo && !targetInfo) { + return -1 /* True */; + } + if (sourceInfo && targetInfo && sourceInfo.isReadonly === targetInfo.isReadonly) { + return isRelatedTo(sourceInfo.type, targetInfo.type); + } + return 0 /* False */; + } + function enumRelatedTo(source, target, reportErrors) { + if (source.symbol.name !== target.symbol.name || + source.symbol.flags & 128 /* ConstEnum */ || + target.symbol.flags & 128 /* ConstEnum */) { + return 0 /* False */; + } + var targetEnumType = getTypeOfSymbol(target.symbol); + for (var _i = 0, _a = getPropertiesOfType(getTypeOfSymbol(source.symbol)); _i < _a.length; _i++) { + var property = _a[_i]; + if (property.flags & 8 /* EnumMember */) { + var targetProperty = getPropertyOfType(targetEnumType, property.name); + if (!targetProperty || !(targetProperty.flags & 8 /* EnumMember */)) { + if (reportErrors) { + reportError(ts.Diagnostics.Property_0_is_missing_in_type_1, property.name, typeToString(target, /*enclosingDeclaration*/ undefined, 128 /* UseFullyQualifiedType */)); + } + return 0 /* False */; + } + } + } + return -1 /* True */; + } + function constructorVisibilitiesAreCompatible(sourceSignature, targetSignature, reportErrors) { + if (!sourceSignature.declaration || !targetSignature.declaration) { + return true; + } + var sourceAccessibility = sourceSignature.declaration.flags & (8 /* Private */ | 16 /* Protected */); + var targetAccessibility = targetSignature.declaration.flags & (8 /* Private */ | 16 /* Protected */); + // A public, protected and private signature is assignable to a private signature. + if (targetAccessibility === 8 /* Private */) { + return true; + } + // A public and protected signature is assignable to a protected signature. + if (targetAccessibility === 16 /* Protected */ && sourceAccessibility !== 8 /* Private */) { + return true; + } + // Only a public signature is assignable to public signature. + if (targetAccessibility !== 16 /* Protected */ && !sourceAccessibility) { + return true; + } + if (reportErrors) { + reportError(ts.Diagnostics.Cannot_assign_a_0_constructor_type_to_a_1_constructor_type, visibilityToString(sourceAccessibility), visibilityToString(targetAccessibility)); + } + return false; + } + } + // Return true if the given type is the constructor type for an abstract class + function isAbstractConstructorType(type) { + if (type.flags & 65536 /* Anonymous */) { + var symbol = type.symbol; + if (symbol && symbol.flags & 32 /* Class */) { + var declaration = getClassLikeDeclarationOfSymbol(symbol); + if (declaration && declaration.flags & 128 /* Abstract */) { + return true; + } + } + } + return false; } // Return true if the given type is part of a deeply nested chain of generic instantiations. We consider this to be the case // when structural type comparisons have been started for 10 or more instantiations of the same generic type. It is possible, @@ -19065,7 +21422,7 @@ var ts; return false; } function isPropertyIdenticalTo(sourceProp, targetProp) { - return compareProperties(sourceProp, targetProp, compareTypes) !== 0 /* False */; + return compareProperties(sourceProp, targetProp, compareTypesIdentical) !== 0 /* False */; } function compareProperties(sourceProp, targetProp, compareTypes) { // Two members are considered identical when @@ -19074,8 +21431,8 @@ var ts; if (sourceProp === targetProp) { return -1 /* True */; } - var sourcePropAccessibility = getDeclarationFlagsFromSymbol(sourceProp) & (16 /* Private */ | 32 /* Protected */); - var targetPropAccessibility = getDeclarationFlagsFromSymbol(targetProp) & (16 /* Private */ | 32 /* Protected */); + var sourcePropAccessibility = getDeclarationFlagsFromSymbol(sourceProp) & (8 /* Private */ | 16 /* Protected */); + var targetPropAccessibility = getDeclarationFlagsFromSymbol(targetProp) & (8 /* Private */ | 16 /* Protected */); if (sourcePropAccessibility !== targetPropAccessibility) { return 0 /* False */; } @@ -19089,6 +21446,9 @@ var ts; return 0 /* False */; } } + if (isReadonlySymbol(sourceProp) !== isReadonlySymbol(targetProp)) { + return 0 /* False */; + } return compareTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp)); } function isMatchingSignature(source, target, partialMatch) { @@ -19108,37 +21468,41 @@ var ts; } return false; } - function compareSignatures(source, target, partialMatch, ignoreReturnTypes, compareTypes) { + /** + * See signatureRelatedTo, compareSignaturesIdentical + */ + function compareSignaturesIdentical(source, target, partialMatch, ignoreThisTypes, ignoreReturnTypes, compareTypes) { + // TODO (drosen): De-duplicate code between related functions. if (source === target) { return -1 /* True */; } if (!(isMatchingSignature(source, target, partialMatch))) { return 0 /* False */; } - var result = -1 /* True */; - if (source.typeParameters && target.typeParameters) { - if (source.typeParameters.length !== target.typeParameters.length) { - return 0 /* False */; - } - for (var i = 0, len = source.typeParameters.length; i < len; ++i) { - var related = compareTypes(source.typeParameters[i], target.typeParameters[i]); - if (!related) { - return 0 /* False */; - } - result &= related; - } - } - else if (source.typeParameters || target.typeParameters) { + // Check that the two signatures have the same number of type parameters. We might consider + // also checking that any type parameter constraints match, but that would require instantiating + // the constraints with a common set of type arguments to get relatable entities in places where + // type parameters occur in the constraints. The complexity of doing that doesn't seem worthwhile, + // particularly as we're comparing erased versions of the signatures below. + if ((source.typeParameters ? source.typeParameters.length : 0) !== (target.typeParameters ? target.typeParameters.length : 0)) { return 0 /* False */; } // Spec 1.0 Section 3.8.3 & 3.8.4: // M and N (the signatures) are instantiated using type Any as the type argument for all type parameters declared by M and N source = getErasedSignature(source); target = getErasedSignature(target); + var result = -1 /* True */; + if (!ignoreThisTypes && source.thisType && target.thisType) { + var related = compareTypes(source.thisType, target.thisType); + if (!related) { + return 0 /* False */; + } + result &= related; + } var targetLen = target.parameters.length; for (var i = 0; i < targetLen; i++) { - var s = isRestParameterIndex(source, i) ? getRestTypeOfSignature(source) : getTypeOfSymbol(source.parameters[i]); - var t = isRestParameterIndex(target, i) ? getRestTypeOfSignature(target) : getTypeOfSymbol(target.parameters[i]); + var s = isRestParameterIndex(source, i) ? getRestTypeOfSignature(source) : getTypeOfParameter(source.parameters[i]); + var t = isRestParameterIndex(target, i) ? getRestTypeOfSignature(target) : getTypeOfParameter(target.parameters[i]); var related = compareTypes(s, t); if (!related) { return 0 /* False */; @@ -19154,15 +21518,31 @@ var ts; return signature.hasRestParameter && parameterIndex >= signature.parameters.length - 1; } function isSupertypeOfEach(candidate, types) { - for (var _i = 0, types_6 = types; _i < types_6.length; _i++) { - var type = types_6[_i]; - if (candidate !== type && !isTypeSubtypeOf(type, candidate)) + for (var _i = 0, types_5 = types; _i < types_5.length; _i++) { + var t = types_5[_i]; + if (candidate !== t && !isTypeSubtypeOf(t, candidate)) return false; } return true; } + function getCombinedFlagsOfTypes(types) { + var flags = 0; + for (var _i = 0, types_6 = types; _i < types_6.length; _i++) { + var t = types_6[_i]; + flags |= t.flags; + } + return flags; + } function getCommonSupertype(types) { - return ts.forEach(types, function (t) { return isSupertypeOfEach(t, types) ? t : undefined; }); + if (!strictNullChecks) { + return ts.forEach(types, function (t) { return isSupertypeOfEach(t, types) ? t : undefined; }); + } + var primaryTypes = ts.filter(types, function (t) { return !(t.flags & 96 /* Nullable */); }); + if (!primaryTypes.length) { + return getUnionType(types); + } + var supertype = ts.forEach(primaryTypes, function (t) { return isSupertypeOfEach(t, primaryTypes) ? t : undefined; }); + return supertype && addNullableKind(supertype, getCombinedFlagsOfTypes(types) & 96 /* Nullable */); } function reportNoCommonSupertypeError(types, errorLocation, errorMessageChainHead) { // The downfallType/bestSupertypeDownfallType is the first type that caused a particular candidate @@ -19201,8 +21581,10 @@ var ts; return type.flags & 4096 /* Reference */ && type.target === globalArrayType; } function isArrayLikeType(type) { - // A type is array-like if it is not the undefined or null type and if it is assignable to any[] - return !(type.flags & (32 /* Undefined */ | 64 /* Null */)) && isTypeAssignableTo(type, anyArrayType); + // A type is array-like if it is a reference to the global Array or global ReadonlyArray type, + // or if it is not the undefined or null type and if it is assignable to ReadonlyArray + return type.flags & 4096 /* Reference */ && (type.target === globalArrayType || type.target === globalReadonlyArrayType) || + !(type.flags & 96 /* Nullable */) && isTypeAssignableTo(type, anyReadonlyArrayType); } function isTupleLikeType(type) { return !!getPropertyOfType(type, "0"); @@ -19217,6 +21599,41 @@ var ts; function isTupleType(type) { return !!(type.flags & 8192 /* Tuple */); } + function getNullableKind(type) { + var flags = type.flags; + if (flags & 16384 /* Union */) { + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var t = _a[_i]; + flags |= t.flags; + } + } + return flags & 96 /* Nullable */; + } + function addNullableKind(type, kind) { + if ((getNullableKind(type) & kind) !== kind) { + var types = [type]; + if (kind & 32 /* Undefined */) { + types.push(undefinedType); + } + if (kind & 64 /* Null */) { + types.push(nullType); + } + type = getUnionType(types); + } + return type; + } + function getNonNullableType(type) { + return strictNullChecks ? getTypeWithFacts(type, 524288 /* NEUndefinedOrNull */) : type; + } + /** + * Return true if type was inferred from an object literal or written as an object type literal + * with no call or construct signatures. + */ + function isObjectLiteralType(type) { + return type.symbol && (type.symbol.flags & (4096 /* ObjectLiteral */ | 2048 /* TypeLiteral */)) !== 0 && + getSignaturesOfType(type, 0 /* Call */).length === 0 && + getSignaturesOfType(type, 1 /* Construct */).length === 0; + } function getRegularTypeOfObjectLiteral(type) { if (type.flags & 1048576 /* FreshObjectLiteral */) { var regularType = type.regularType; @@ -19227,8 +21644,8 @@ var ts; regularType.properties = type.properties; regularType.callSignatures = type.callSignatures; regularType.constructSignatures = type.constructSignatures; - regularType.stringIndexType = type.stringIndexType; - regularType.numberIndexType = type.numberIndexType; + regularType.stringIndexInfo = type.stringIndexInfo; + regularType.numberIndexInfo = type.numberIndexInfo; type.regularType = regularType; } return regularType; @@ -19253,24 +21670,23 @@ var ts; } members[p.name] = p; }); - var stringIndexType = getIndexTypeOfType(type, 0 /* String */); - var numberIndexType = getIndexTypeOfType(type, 1 /* Number */); - if (stringIndexType) - stringIndexType = getWidenedType(stringIndexType); - if (numberIndexType) - numberIndexType = getWidenedType(numberIndexType); - return createAnonymousType(type.symbol, members, emptyArray, emptyArray, stringIndexType, numberIndexType); + var stringIndexInfo = getIndexInfoOfType(type, 0 /* String */); + var numberIndexInfo = getIndexInfoOfType(type, 1 /* Number */); + return createAnonymousType(type.symbol, members, emptyArray, emptyArray, stringIndexInfo && createIndexInfo(getWidenedType(stringIndexInfo.type), stringIndexInfo.isReadonly), numberIndexInfo && createIndexInfo(getWidenedType(numberIndexInfo.type), numberIndexInfo.isReadonly)); + } + function getWidenedConstituentType(type) { + return type.flags & 96 /* Nullable */ ? type : getWidenedType(type); } function getWidenedType(type) { if (type.flags & 6291456 /* RequiresWidening */) { - if (type.flags & (32 /* Undefined */ | 64 /* Null */)) { + if (type.flags & 96 /* Nullable */) { return anyType; } if (type.flags & 524288 /* ObjectLiteral */) { return getWidenedTypeOfObjectLiteral(type); } if (type.flags & 16384 /* Union */) { - return getUnionType(ts.map(type.types, getWidenedType), /*noSubtypeReduction*/ true); + return getUnionType(ts.map(type.types, getWidenedConstituentType), /*noSubtypeReduction*/ true); } if (isArrayType(type)) { return createArrayType(getWidenedType(type.typeArguments[0])); @@ -19331,22 +21747,25 @@ var ts; var typeAsString = typeToString(getWidenedType(type)); var diagnostic; switch (declaration.kind) { - case 141 /* PropertyDeclaration */: - case 140 /* PropertySignature */: + case 145 /* PropertyDeclaration */: + case 144 /* PropertySignature */: diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type; break; - case 138 /* Parameter */: + case 142 /* Parameter */: diagnostic = declaration.dotDotDotToken ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; break; - case 213 /* FunctionDeclaration */: - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: - case 173 /* FunctionExpression */: - case 174 /* ArrowFunction */: + case 169 /* BindingElement */: + diagnostic = ts.Diagnostics.Binding_element_0_implicitly_has_an_1_type; + break; + case 220 /* FunctionDeclaration */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: + case 179 /* FunctionExpression */: + case 180 /* ArrowFunction */: if (!declaration.name) { error(declaration, ts.Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString); return; @@ -19371,35 +21790,23 @@ var ts; var targetMax = target.parameters.length; var count; if (source.hasRestParameter && target.hasRestParameter) { - count = sourceMax > targetMax ? sourceMax : targetMax; - sourceMax--; - targetMax--; + count = Math.max(sourceMax, targetMax); } else if (source.hasRestParameter) { - sourceMax--; count = targetMax; } else if (target.hasRestParameter) { - targetMax--; count = sourceMax; } else { - count = sourceMax < targetMax ? sourceMax : targetMax; + count = Math.min(sourceMax, targetMax); } for (var i = 0; i < count; i++) { - var s = i < sourceMax ? getTypeOfSymbol(source.parameters[i]) : getRestTypeOfSignature(source); - var t = i < targetMax ? getTypeOfSymbol(target.parameters[i]) : getRestTypeOfSignature(target); - callback(s, t); + callback(getTypeAtPosition(source, i), getTypeAtPosition(target, i)); } } function createInferenceContext(typeParameters, inferUnionTypes) { - var inferences = []; - for (var _i = 0, typeParameters_1 = typeParameters; _i < typeParameters_1.length; _i++) { - var unused = typeParameters_1[_i]; - inferences.push({ - primary: undefined, secondary: undefined, isFixed: false - }); - } + var inferences = ts.map(typeParameters, createTypeInferencesObject); return { typeParameters: typeParameters, inferUnionTypes: inferUnionTypes, @@ -19407,11 +21814,19 @@ var ts; inferredTypes: new Array(typeParameters.length) }; } + function createTypeInferencesObject() { + return { + primary: undefined, + secondary: undefined, + isFixed: false + }; + } function inferTypes(context, source, target) { var sourceStack; var targetStack; var depth = 0; var inferiority = 0; + var visited = {}; inferFromTypes(source, target); function isInProcess(source, target) { for (var i = 0; i < depth; i++) { @@ -19422,6 +21837,29 @@ var ts; return false; } function inferFromTypes(source, target) { + if (source.flags & 16384 /* Union */ && target.flags & 16384 /* Union */ || + source.flags & 32768 /* Intersection */ && target.flags & 32768 /* Intersection */) { + // Source and target are both unions or both intersections. First, find each + // target constituent type that has an identically matching source constituent + // type, and for each such target constituent type infer from the type to itself. + // When inferring from a type to itself we effectively find all type parameter + // occurrences within that type and infer themselves as their type arguments. + var matchingTypes = void 0; + for (var _i = 0, _a = target.types; _i < _a.length; _i++) { + var t = _a[_i]; + if (typeIdenticalToSomeType(t, source.types)) { + (matchingTypes || (matchingTypes = [])).push(t); + inferFromTypes(t, t); + } + } + // Next, to improve the quality of inferences, reduce the source and target types by + // removing the identically matched constituents. For example, when inferring from + // 'string | string[]' to 'string | T' we reduce the types to 'string[]' and 'T'. + if (matchingTypes) { + source = removeTypesFromUnionOrIntersection(source, matchingTypes); + target = removeTypesFromUnionOrIntersection(target, matchingTypes); + } + } if (target.flags & 512 /* TypeParameter */) { // If target is a type parameter, make an inference, unless the source type contains // the anyFunctionType (the wildcard type that's used to avoid contextually typing functions). @@ -19474,10 +21912,10 @@ var ts; else if (target.flags & 49152 /* UnionOrIntersection */) { var targetTypes = target.types; var typeParameterCount = 0; - var typeParameter; + var typeParameter = void 0; // First infer to each type in union or intersection that isn't a type parameter - for (var _i = 0, targetTypes_2 = targetTypes; _i < targetTypes_2.length; _i++) { - var t = targetTypes_2[_i]; + for (var _b = 0, targetTypes_2 = targetTypes; _b < targetTypes_2.length; _b++) { + var t = targetTypes_2[_b]; if (t.flags & 512 /* TypeParameter */ && ts.contains(context.typeParameters, t)) { typeParameter = t; typeParameterCount++; @@ -19497,24 +21935,31 @@ var ts; } } else if (source.flags & 49152 /* UnionOrIntersection */) { - // Source is a union or intersection type, infer from each consituent type + // Source is a union or intersection type, infer from each constituent type var sourceTypes = source.types; - for (var _a = 0, sourceTypes_3 = sourceTypes; _a < sourceTypes_3.length; _a++) { - var sourceType = sourceTypes_3[_a]; + for (var _c = 0, sourceTypes_3 = sourceTypes; _c < sourceTypes_3.length; _c++) { + var sourceType = sourceTypes_3[_c]; inferFromTypes(sourceType, target); } } else { source = getApparentType(source); - if (source.flags & 80896 /* ObjectType */ && (target.flags & (4096 /* Reference */ | 8192 /* Tuple */) || - (target.flags & 65536 /* Anonymous */) && target.symbol && target.symbol.flags & (8192 /* Method */ | 2048 /* TypeLiteral */ | 32 /* Class */))) { - // If source is an object type, and target is a type reference, a tuple type, the type of a method, or a type literal, infer from members + if (source.flags & 80896 /* ObjectType */ && (target.flags & 4096 /* Reference */ && target.typeArguments || + target.flags & 8192 /* Tuple */ || + target.flags & 65536 /* Anonymous */ && target.symbol && target.symbol.flags & (8192 /* Method */ | 2048 /* TypeLiteral */ | 32 /* Class */))) { + // If source is an object type, and target is a type reference with type arguments, a tuple type, + // the type of a method, or a type literal, infer from members if (isInProcess(source, target)) { return; } if (isDeeplyNestedGeneric(source, sourceStack, depth) && isDeeplyNestedGeneric(target, targetStack, depth)) { return; } + var key = source.id + "," + target.id; + if (ts.hasProperty(visited, key)) { + return; + } + visited[key] = true; if (depth === 0) { sourceStack = []; targetStack = []; @@ -19525,9 +21970,7 @@ var ts; inferFromProperties(source, target); inferFromSignatures(source, target, 0 /* Call */); inferFromSignatures(source, target, 1 /* Construct */); - inferFromIndexTypes(source, target, 0 /* String */, 0 /* String */); - inferFromIndexTypes(source, target, 1 /* Number */, 1 /* Number */); - inferFromIndexTypes(source, target, 0 /* String */, 1 /* Number */); + inferFromIndexTypes(source, target); depth--; } } @@ -19554,28 +21997,56 @@ var ts; } function inferFromSignature(source, target) { forEachMatchingParameterType(source, target, inferFromTypes); - if (source.typePredicate && target.typePredicate) { - if (target.typePredicate.parameterIndex === source.typePredicate.parameterIndex) { - // Return types from type predicates are treated as booleans. In order to infer types - // from type predicates we would need to infer using the type within the type predicate - // (i.e. 'Foo' from 'x is Foo'). - inferFromTypes(source.typePredicate.type, target.typePredicate.type); - } + if (source.typePredicate && target.typePredicate && source.typePredicate.kind === target.typePredicate.kind) { + inferFromTypes(source.typePredicate.type, target.typePredicate.type); } else { inferFromTypes(getReturnTypeOfSignature(source), getReturnTypeOfSignature(target)); } } - function inferFromIndexTypes(source, target, sourceKind, targetKind) { - var targetIndexType = getIndexTypeOfType(target, targetKind); - if (targetIndexType) { - var sourceIndexType = getIndexTypeOfType(source, sourceKind); + function inferFromIndexTypes(source, target) { + var targetStringIndexType = getIndexTypeOfType(target, 0 /* String */); + if (targetStringIndexType) { + var sourceIndexType = getIndexTypeOfType(source, 0 /* String */) || + getImplicitIndexTypeOfType(source, 0 /* String */); if (sourceIndexType) { - inferFromTypes(sourceIndexType, targetIndexType); + inferFromTypes(sourceIndexType, targetStringIndexType); + } + } + var targetNumberIndexType = getIndexTypeOfType(target, 1 /* Number */); + if (targetNumberIndexType) { + var sourceIndexType = getIndexTypeOfType(source, 1 /* Number */) || + getIndexTypeOfType(source, 0 /* String */) || + getImplicitIndexTypeOfType(source, 1 /* Number */); + if (sourceIndexType) { + inferFromTypes(sourceIndexType, targetNumberIndexType); } } } } + function typeIdenticalToSomeType(type, types) { + for (var _i = 0, types_7 = types; _i < types_7.length; _i++) { + var t = types_7[_i]; + if (isTypeIdenticalTo(t, type)) { + return true; + } + } + return false; + } + /** + * Return a new union or intersection type computed by removing a given set of types + * from a given union or intersection type. + */ + function removeTypesFromUnionOrIntersection(type, typesToRemove) { + var reducedTypes = []; + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var t = _a[_i]; + if (!typeIdenticalToSomeType(t, typesToRemove)) { + reducedTypes.push(t); + } + } + return type.flags & 16384 /* Union */ ? getUnionType(reducedTypes, /*noSubtypeReduction*/ true) : getIntersectionType(reducedTypes); + } function getInferenceCandidates(context, index) { var inferences = context.inferences[index]; return inferences.primary || inferences.secondary || emptyArray; @@ -19599,10 +22070,16 @@ var ts; inferredType = emptyObjectType; inferenceSucceeded = true; } + context.inferredTypes[index] = inferredType; // Only do the constraint check if inference succeeded (to prevent cascading errors) if (inferenceSucceeded) { var constraint = getConstraintOfTypeParameter(context.typeParameters[index]); - inferredType = constraint && !isTypeAssignableTo(inferredType, constraint) ? constraint : inferredType; + if (constraint) { + var instantiatedConstraint = instantiateType(constraint, getInferenceMapper(context)); + if (!isTypeAssignableTo(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) { + context.inferredTypes[index] = inferredType = instantiatedConstraint; + } + } } else if (context.failedTypeParameterIndex === undefined || context.failedTypeParameterIndex > index) { // If inference failed, it is necessary to record the index of the failed type parameter (the one we are on). @@ -19610,7 +22087,6 @@ var ts; // So if this failure is on preceding type parameter, this type parameter is the new failure index. context.failedTypeParameterIndex = index; } - context.inferredTypes[index] = inferredType; } return inferredType; } @@ -19620,14 +22096,11 @@ var ts; } return context.inferredTypes; } - function hasAncestor(node, kind) { - return ts.getAncestor(node, kind) !== undefined; - } // EXPRESSION TYPE CHECKING function getResolvedSymbol(node) { var links = getNodeLinks(node); if (!links.resolvedSymbol) { - links.resolvedSymbol = (!ts.nodeIsMissing(node) && resolveName(node, node.text, 107455 /* Value */ | 1048576 /* ExportValue */, ts.Diagnostics.Cannot_find_name_0, node)) || unknownSymbol; + links.resolvedSymbol = !ts.nodeIsMissing(node) && resolveName(node, node.text, 107455 /* Value */ | 1048576 /* ExportValue */, ts.Diagnostics.Cannot_find_name_0, node) || unknownSymbol; } return links.resolvedSymbol; } @@ -19637,10 +22110,10 @@ var ts; // The expression is restricted to a single identifier or a sequence of identifiers separated by periods while (node) { switch (node.kind) { - case 154 /* TypeQuery */: + case 158 /* TypeQuery */: return true; case 69 /* Identifier */: - case 135 /* QualifiedName */: + case 139 /* QualifiedName */: node = node.parent; continue; default: @@ -19649,240 +22122,523 @@ var ts; } ts.Debug.fail("should not get here"); } - // For a union type, remove all constituent types that are of the given type kind (when isOfTypeKind is true) - // or not of the given type kind (when isOfTypeKind is false) - function removeTypesFromUnionType(type, typeKind, isOfTypeKind, allowEmptyUnionResult) { - if (type.flags & 16384 /* Union */) { - var types = type.types; - if (ts.forEach(types, function (t) { return !!(t.flags & typeKind) === isOfTypeKind; })) { - // Above we checked if we have anything to remove, now use the opposite test to do the removal - var narrowedType = getUnionType(ts.filter(types, function (t) { return !(t.flags & typeKind) === isOfTypeKind; })); - if (allowEmptyUnionResult || narrowedType !== emptyObjectType) { - return narrowedType; - } + // Return the flow cache key for a "dotted name" (i.e. a sequence of identifiers + // separated by dots). The key consists of the id of the symbol referenced by the + // leftmost identifier followed by zero or more property names separated by dots. + // The result is undefined if the reference isn't a dotted name. + function getFlowCacheKey(node) { + if (node.kind === 69 /* Identifier */) { + var symbol = getResolvedSymbol(node); + return symbol !== unknownSymbol ? "" + getSymbolId(symbol) : undefined; + } + if (node.kind === 97 /* ThisKeyword */) { + return "0"; + } + if (node.kind === 172 /* PropertyAccessExpression */) { + var key = getFlowCacheKey(node.expression); + return key && key + "." + node.name.text; + } + return undefined; + } + function isNullOrUndefinedLiteral(node) { + return node.kind === 93 /* NullKeyword */ || + node.kind === 69 /* Identifier */ && getResolvedSymbol(node) === undefinedSymbol; + } + function getLeftmostIdentifierOrThis(node) { + switch (node.kind) { + case 69 /* Identifier */: + case 97 /* ThisKeyword */: + return node; + case 172 /* PropertyAccessExpression */: + return getLeftmostIdentifierOrThis(node.expression); + } + return undefined; + } + function isMatchingReference(source, target) { + if (source.kind === target.kind) { + switch (source.kind) { + case 69 /* Identifier */: + return getResolvedSymbol(source) === getResolvedSymbol(target); + case 97 /* ThisKeyword */: + return true; + case 172 /* PropertyAccessExpression */: + return source.name.text === target.name.text && + isMatchingReference(source.expression, target.expression); } } - else if (allowEmptyUnionResult && !!(type.flags & typeKind) === isOfTypeKind) { - // Use getUnionType(emptyArray) instead of emptyObjectType in case the way empty union types - // are represented ever changes. - return getUnionType(emptyArray); - } - return type; + return false; } - function hasInitializer(node) { - return !!(node.initializer || ts.isBindingPattern(node.parent) && hasInitializer(node.parent.parent)); - } - // Check if a given variable is assigned within a given syntax node - function isVariableAssignedWithin(symbol, node) { - var links = getNodeLinks(node); - if (links.assignmentChecks) { - var cachedResult = links.assignmentChecks[symbol.id]; - if (cachedResult !== undefined) { - return cachedResult; + function containsMatchingReference(source, target) { + while (source.kind === 172 /* PropertyAccessExpression */) { + source = source.expression; + if (isMatchingReference(source, target)) { + return true; } } - else { - links.assignmentChecks = {}; - } - return links.assignmentChecks[symbol.id] = isAssignedIn(node); - function isAssignedInBinaryExpression(node) { - if (node.operatorToken.kind >= 56 /* FirstAssignment */ && node.operatorToken.kind <= 68 /* LastAssignment */) { - var n = node.left; - while (n.kind === 172 /* ParenthesizedExpression */) { - n = n.expression; - } - if (n.kind === 69 /* Identifier */ && getResolvedSymbol(n) === symbol) { + return false; + } + function isOrContainsMatchingReference(source, target) { + return isMatchingReference(source, target) || containsMatchingReference(source, target); + } + function hasMatchingArgument(callExpression, reference) { + if (callExpression.arguments) { + for (var _i = 0, _a = callExpression.arguments; _i < _a.length; _i++) { + var argument = _a[_i]; + if (isOrContainsMatchingReference(reference, argument)) { return true; } } - return ts.forEachChild(node, isAssignedIn); } - function isAssignedInVariableDeclaration(node) { - if (!ts.isBindingPattern(node.name) && getSymbolOfNode(node) === symbol && hasInitializer(node)) { + if (callExpression.expression.kind === 172 /* PropertyAccessExpression */ && + isOrContainsMatchingReference(reference, callExpression.expression.expression)) { + return true; + } + return false; + } + function getFlowNodeId(flow) { + if (!flow.id) { + flow.id = nextFlowId; + nextFlowId++; + } + return flow.id; + } + function typeMaybeAssignableTo(source, target) { + if (!(source.flags & 16384 /* Union */)) { + return isTypeAssignableTo(source, target); + } + for (var _i = 0, _a = source.types; _i < _a.length; _i++) { + var t = _a[_i]; + if (isTypeAssignableTo(t, target)) { return true; } - return ts.forEachChild(node, isAssignedIn); - } - function isAssignedIn(node) { - switch (node.kind) { - case 181 /* BinaryExpression */: - return isAssignedInBinaryExpression(node); - case 211 /* VariableDeclaration */: - case 163 /* BindingElement */: - return isAssignedInVariableDeclaration(node); - case 161 /* ObjectBindingPattern */: - case 162 /* ArrayBindingPattern */: - case 164 /* ArrayLiteralExpression */: - case 165 /* ObjectLiteralExpression */: - case 166 /* PropertyAccessExpression */: - case 167 /* ElementAccessExpression */: - case 168 /* CallExpression */: - case 169 /* NewExpression */: - case 171 /* TypeAssertionExpression */: - case 189 /* AsExpression */: - case 172 /* ParenthesizedExpression */: - case 179 /* PrefixUnaryExpression */: - case 175 /* DeleteExpression */: - case 178 /* AwaitExpression */: - case 176 /* TypeOfExpression */: - case 177 /* VoidExpression */: - case 180 /* PostfixUnaryExpression */: - case 184 /* YieldExpression */: - case 182 /* ConditionalExpression */: - case 185 /* SpreadElementExpression */: - case 192 /* Block */: - case 193 /* VariableStatement */: - case 195 /* ExpressionStatement */: - case 196 /* IfStatement */: - case 197 /* DoStatement */: - case 198 /* WhileStatement */: - case 199 /* ForStatement */: - case 200 /* ForInStatement */: - case 201 /* ForOfStatement */: - case 204 /* ReturnStatement */: - case 205 /* WithStatement */: - case 206 /* SwitchStatement */: - case 241 /* CaseClause */: - case 242 /* DefaultClause */: - case 207 /* LabeledStatement */: - case 208 /* ThrowStatement */: - case 209 /* TryStatement */: - case 244 /* CatchClause */: - case 233 /* JsxElement */: - case 234 /* JsxSelfClosingElement */: - case 238 /* JsxAttribute */: - case 239 /* JsxSpreadAttribute */: - case 235 /* JsxOpeningElement */: - case 240 /* JsxExpression */: - return ts.forEachChild(node, isAssignedIn); - } - return false; } + return false; } - // Get the narrowed type of a given symbol at a given location - function getNarrowedTypeOfSymbol(symbol, node) { - var type = getTypeOfSymbol(symbol); - // Only narrow when symbol is variable of type any or an object, union, or type parameter type - if (node && symbol.flags & 3 /* Variable */) { - if (isTypeAny(type) || type.flags & (80896 /* ObjectType */ | 16384 /* Union */ | 512 /* TypeParameter */)) { - loop: while (node.parent) { - var child = node; - node = node.parent; - var narrowedType = type; - switch (node.kind) { - case 196 /* IfStatement */: - // In a branch of an if statement, narrow based on controlling expression - if (child !== node.expression) { - narrowedType = narrowType(type, node.expression, /*assumeTrue*/ child === node.thenStatement); - } - break; - case 182 /* ConditionalExpression */: - // In a branch of a conditional expression, narrow based on controlling condition - if (child !== node.condition) { - narrowedType = narrowType(type, node.condition, /*assumeTrue*/ child === node.whenTrue); - } - break; - case 181 /* BinaryExpression */: - // In the right operand of an && or ||, narrow based on left operand - if (child === node.right) { - if (node.operatorToken.kind === 51 /* AmpersandAmpersandToken */) { - narrowedType = narrowType(type, node.left, /*assumeTrue*/ true); - } - else if (node.operatorToken.kind === 52 /* BarBarToken */) { - narrowedType = narrowType(type, node.left, /*assumeTrue*/ false); - } - } - break; - case 248 /* SourceFile */: - case 218 /* ModuleDeclaration */: - case 213 /* FunctionDeclaration */: - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: - case 144 /* Constructor */: - // Stop at the first containing function or module declaration - break loop; - } - // Use narrowed type if construct contains no assignments to variable - if (narrowedType !== type) { - if (isVariableAssignedWithin(symbol, node)) { - break; - } - type = narrowedType; + // Remove those constituent types of declaredType to which no constituent type of assignedType is assignable. + // For example, when a variable of type number | string | boolean is assigned a value of type number | boolean, + // we remove type string. + function getAssignmentReducedType(declaredType, assignedType) { + if (declaredType !== assignedType && declaredType.flags & 16384 /* Union */) { + var reducedTypes = ts.filter(declaredType.types, function (t) { return typeMaybeAssignableTo(assignedType, t); }); + if (reducedTypes.length) { + return reducedTypes.length === 1 ? reducedTypes[0] : getUnionType(reducedTypes); + } + } + return declaredType; + } + function getTypeFacts(type) { + var flags = type.flags; + if (flags & 258 /* StringLike */) { + return strictNullChecks ? 4079361 /* StringStrictFacts */ : 4194049 /* StringFacts */; + } + if (flags & 132 /* NumberLike */) { + return strictNullChecks ? 4079234 /* NumberStrictFacts */ : 4193922 /* NumberFacts */; + } + if (flags & 8 /* Boolean */) { + return strictNullChecks ? 4078980 /* BooleanStrictFacts */ : 4193668 /* BooleanFacts */; + } + if (flags & 80896 /* ObjectType */) { + var resolved = resolveStructuredTypeMembers(type); + return resolved.callSignatures.length || resolved.constructSignatures.length || isTypeSubtypeOf(type, globalFunctionType) ? + strictNullChecks ? 1970144 /* FunctionStrictFacts */ : 4181984 /* FunctionFacts */ : + strictNullChecks ? 1972176 /* ObjectStrictFacts */ : 4184016 /* ObjectFacts */; + } + if (flags & (16 /* Void */ | 32 /* Undefined */)) { + return 2457472 /* UndefinedFacts */; + } + if (flags & 64 /* Null */) { + return 2340752 /* NullFacts */; + } + if (flags & 16777216 /* ESSymbol */) { + return strictNullChecks ? 1981320 /* SymbolStrictFacts */ : 4193160 /* SymbolFacts */; + } + if (flags & 512 /* TypeParameter */) { + var constraint = getConstraintOfTypeParameter(type); + return constraint ? getTypeFacts(constraint) : 4194303 /* All */; + } + if (flags & 32768 /* Intersection */) { + return ts.reduceLeft(type.types, function (flags, type) { return flags |= getTypeFacts(type); }, 0 /* None */); + } + return 4194303 /* All */; + } + function getTypeWithFacts(type, include) { + if (!(type.flags & 16384 /* Union */)) { + return getTypeFacts(type) & include ? type : neverType; + } + var firstType; + var types; + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var t = _a[_i]; + if (getTypeFacts(t) & include) { + if (!firstType) { + firstType = t; + } + else { + if (!types) { + types = [firstType]; } + types.push(t); } } } + return firstType ? types ? getUnionType(types, /*noSubtypeReduction*/ true) : firstType : neverType; + } + function getTypeWithDefault(type, defaultExpression) { + if (defaultExpression) { + var defaultType = checkExpression(defaultExpression); + return getUnionType([getTypeWithFacts(type, 131072 /* NEUndefined */), defaultType]); + } return type; - function narrowTypeByEquality(type, expr, assumeTrue) { - // Check that we have 'typeof ' on the left and string literal on the right - if (expr.left.kind !== 176 /* TypeOfExpression */ || expr.right.kind !== 9 /* StringLiteral */) { + } + function getTypeOfDestructuredProperty(type, name) { + var text = getTextOfPropertyName(name); + return getTypeOfPropertyOfType(type, text) || + isNumericLiteralName(text) && getIndexTypeOfType(type, 1 /* Number */) || + getIndexTypeOfType(type, 0 /* String */) || + unknownType; + } + function getTypeOfDestructuredArrayElement(type, index) { + return isTupleLikeType(type) && getTypeOfPropertyOfType(type, "" + index) || + checkIteratedTypeOrElementType(type, /*errorNode*/ undefined, /*allowStringInput*/ false) || + unknownType; + } + function getTypeOfDestructuredSpreadElement(type) { + return createArrayType(checkIteratedTypeOrElementType(type, /*errorNode*/ undefined, /*allowStringInput*/ false) || unknownType); + } + function getAssignedTypeOfBinaryExpression(node) { + return node.parent.kind === 170 /* ArrayLiteralExpression */ || node.parent.kind === 253 /* PropertyAssignment */ ? + getTypeWithDefault(getAssignedType(node), node.right) : + checkExpression(node.right); + } + function getAssignedTypeOfArrayLiteralElement(node, element) { + return getTypeOfDestructuredArrayElement(getAssignedType(node), ts.indexOf(node.elements, element)); + } + function getAssignedTypeOfSpreadElement(node) { + return getTypeOfDestructuredSpreadElement(getAssignedType(node.parent)); + } + function getAssignedTypeOfPropertyAssignment(node) { + return getTypeOfDestructuredProperty(getAssignedType(node.parent), node.name); + } + function getAssignedTypeOfShorthandPropertyAssignment(node) { + return getTypeWithDefault(getAssignedTypeOfPropertyAssignment(node), node.objectAssignmentInitializer); + } + function getAssignedType(node) { + var parent = node.parent; + switch (parent.kind) { + case 207 /* ForInStatement */: + return stringType; + case 208 /* ForOfStatement */: + return checkRightHandSideOfForOf(parent.expression) || unknownType; + case 187 /* BinaryExpression */: + return getAssignedTypeOfBinaryExpression(parent); + case 181 /* DeleteExpression */: + return undefinedType; + case 170 /* ArrayLiteralExpression */: + return getAssignedTypeOfArrayLiteralElement(parent, node); + case 191 /* SpreadElementExpression */: + return getAssignedTypeOfSpreadElement(parent); + case 253 /* PropertyAssignment */: + return getAssignedTypeOfPropertyAssignment(parent); + case 254 /* ShorthandPropertyAssignment */: + return getAssignedTypeOfShorthandPropertyAssignment(parent); + } + return unknownType; + } + function getInitialTypeOfBindingElement(node) { + var pattern = node.parent; + var parentType = getInitialType(pattern.parent); + var type = pattern.kind === 167 /* ObjectBindingPattern */ ? + getTypeOfDestructuredProperty(parentType, node.propertyName || node.name) : + !node.dotDotDotToken ? + getTypeOfDestructuredArrayElement(parentType, ts.indexOf(pattern.elements, node)) : + getTypeOfDestructuredSpreadElement(parentType); + return getTypeWithDefault(type, node.initializer); + } + function getTypeOfInitializer(node) { + // Return the cached type if one is available. If the type of the variable was inferred + // from its initializer, we'll already have cached the type. Otherwise we compute it now + // without caching such that transient types are reflected. + var links = getNodeLinks(node); + return links.resolvedType || checkExpression(node); + } + function getInitialTypeOfVariableDeclaration(node) { + if (node.initializer) { + return getTypeOfInitializer(node.initializer); + } + if (node.parent.parent.kind === 207 /* ForInStatement */) { + return stringType; + } + if (node.parent.parent.kind === 208 /* ForOfStatement */) { + return checkRightHandSideOfForOf(node.parent.parent.expression) || unknownType; + } + return unknownType; + } + function getInitialType(node) { + return node.kind === 218 /* VariableDeclaration */ ? + getInitialTypeOfVariableDeclaration(node) : + getInitialTypeOfBindingElement(node); + } + function getFlowTypeOfReference(reference, declaredType, assumeInitialized) { + var key; + if (!reference.flowNode || assumeInitialized && !(declaredType.flags & 97793 /* Narrowable */)) { + return declaredType; + } + var initialType = assumeInitialized ? declaredType : addNullableKind(declaredType, 32 /* Undefined */); + var visitedFlowStart = visitedFlowCount; + var result = getTypeAtFlowNode(reference.flowNode); + visitedFlowCount = visitedFlowStart; + if (reference.parent.kind === 196 /* NonNullExpression */ && getTypeWithFacts(result, 524288 /* NEUndefinedOrNull */) === neverType) { + return declaredType; + } + return result; + function getTypeAtFlowNode(flow) { + while (true) { + if (flow.flags & 256 /* Shared */) { + // We cache results of flow type resolution for shared nodes that were previously visited in + // the same getFlowTypeOfReference invocation. A node is considered shared when it is the + // antecedent of more than one node. + for (var i = visitedFlowStart; i < visitedFlowCount; i++) { + if (visitedFlowNodes[i] === flow) { + return visitedFlowTypes[i]; + } + } + } + var type = void 0; + if (flow.flags & 16 /* Assignment */) { + type = getTypeAtFlowAssignment(flow); + if (!type) { + flow = flow.antecedent; + continue; + } + } + else if (flow.flags & 96 /* Condition */) { + type = getTypeAtFlowCondition(flow); + } + else if (flow.flags & 12 /* Label */) { + if (flow.antecedents.length === 1) { + flow = flow.antecedents[0]; + continue; + } + type = flow.flags & 4 /* BranchLabel */ ? + getTypeAtFlowBranchLabel(flow) : + getTypeAtFlowLoopLabel(flow); + } + else if (flow.flags & 1 /* Unreachable */) { + // Unreachable code errors are reported in the binding phase. Here we + // simply return the declared type to reduce follow-on errors. + type = declaredType; + } + else { + // At the top of the flow we have the initial type. + type = initialType; + } + if (flow.flags & 256 /* Shared */) { + // Record visited node and the associated type in the cache. + visitedFlowNodes[visitedFlowCount] = flow; + visitedFlowTypes[visitedFlowCount] = type; + visitedFlowCount++; + } return type; } - var left = expr.left; - var right = expr.right; - if (left.expression.kind !== 69 /* Identifier */ || getResolvedSymbol(left.expression) !== symbol) { - return type; + } + function getTypeAtFlowAssignment(flow) { + var node = flow.node; + // Assignments only narrow the computed type if the declared type is a union type. Thus, we + // only need to evaluate the assigned type if the declared type is a union type. + if ((node.kind === 218 /* VariableDeclaration */ || node.kind === 169 /* BindingElement */) && + reference.kind === 69 /* Identifier */ && + getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(reference)) === getSymbolOfNode(node)) { + return declaredType.flags & 16384 /* Union */ ? + getAssignmentReducedType(declaredType, getInitialType(node)) : + declaredType; } - var typeInfo = primitiveTypeInfo[right.text]; - if (expr.operatorToken.kind === 33 /* ExclamationEqualsEqualsToken */) { + // If the node is not a variable declaration or binding element, it is an identifier + // or a dotted name that is the target of an assignment. If we have a match, reduce + // the declared type by the assigned type. + if (isMatchingReference(reference, node)) { + return declaredType.flags & 16384 /* Union */ ? + getAssignmentReducedType(declaredType, getAssignedType(node)) : + declaredType; + } + // We didn't have a direct match. However, if the reference is a dotted name, this + // may be an assignment to a left hand part of the reference. For example, for a + // reference 'x.y.z', we may be at an assignment to 'x.y' or 'x'. In that case, + // return the declared type. + if (containsMatchingReference(reference, node)) { + return declaredType; + } + // Assignment doesn't affect reference + return undefined; + } + function getTypeAtFlowCondition(flow) { + var type = getTypeAtFlowNode(flow.antecedent); + if (type !== neverType) { + // If we have an antecedent type (meaning we're reachable in some way), we first + // attempt to narrow the antecedent type. If that produces the nothing type, then + // we take the type guard as an indication that control could reach here in a + // manner not understood by the control flow analyzer (e.g. a function argument + // has an invalid type, or a nested function has possibly made an assignment to a + // captured variable). We proceed by reverting to the declared type and then + // narrow that. + var assumeTrue = (flow.flags & 32 /* TrueCondition */) !== 0; + type = narrowType(type, flow.expression, assumeTrue); + if (type === neverType) { + type = narrowType(declaredType, flow.expression, assumeTrue); + } + } + return type; + } + function getTypeAtFlowBranchLabel(flow) { + var antecedentTypes = []; + for (var _i = 0, _a = flow.antecedents; _i < _a.length; _i++) { + var antecedent = _a[_i]; + var type = getTypeAtFlowNode(antecedent); + // If the type at a particular antecedent path is the declared type and the + // reference is known to always be assigned (i.e. when declared and initial types + // are the same), there is no reason to process more antecedents since the only + // possible outcome is subtypes that will be removed in the final union type anyway. + if (type === declaredType && declaredType === initialType) { + return type; + } + if (!ts.contains(antecedentTypes, type)) { + antecedentTypes.push(type); + } + } + return getUnionType(antecedentTypes); + } + function getTypeAtFlowLoopLabel(flow) { + // If we have previously computed the control flow type for the reference at + // this flow loop junction, return the cached type. + var id = getFlowNodeId(flow); + var cache = flowLoopCaches[id] || (flowLoopCaches[id] = {}); + if (!key) { + key = getFlowCacheKey(reference); + } + if (cache[key]) { + return cache[key]; + } + // If this flow loop junction and reference are already being processed, return + // the union of the types computed for each branch so far. We should never see + // an empty array here because the first antecedent of a loop junction is always + // the non-looping control flow path that leads to the top. + for (var i = flowLoopStart; i < flowLoopCount; i++) { + if (flowLoopNodes[i] === flow && flowLoopKeys[i] === key) { + return getUnionType(flowLoopTypes[i]); + } + } + // Add the flow loop junction and reference to the in-process stack and analyze + // each antecedent code path. + var antecedentTypes = []; + flowLoopNodes[flowLoopCount] = flow; + flowLoopKeys[flowLoopCount] = key; + flowLoopTypes[flowLoopCount] = antecedentTypes; + for (var _i = 0, _a = flow.antecedents; _i < _a.length; _i++) { + var antecedent = _a[_i]; + flowLoopCount++; + var type = getTypeAtFlowNode(antecedent); + flowLoopCount--; + // If we see a value appear in the cache it is a sign that control flow analysis + // was restarted and completed by checkExpressionCached. We can simply pick up + // the resulting type and bail out. + if (cache[key]) { + return cache[key]; + } + if (!ts.contains(antecedentTypes, type)) { + antecedentTypes.push(type); + } + // If the type at a particular antecedent path is the declared type there is no + // reason to process more antecedents since the only possible outcome is subtypes + // that will be removed in the final union type anyway. + if (type === declaredType) { + break; + } + } + return cache[key] = getUnionType(antecedentTypes); + } + function narrowTypeByTruthiness(type, expr, assumeTrue) { + return isMatchingReference(reference, expr) ? getTypeWithFacts(type, assumeTrue ? 1048576 /* Truthy */ : 2097152 /* Falsy */) : type; + } + function narrowTypeByBinaryExpression(type, expr, assumeTrue) { + switch (expr.operatorToken.kind) { + case 56 /* EqualsToken */: + return narrowTypeByTruthiness(type, expr.left, assumeTrue); + case 30 /* EqualsEqualsToken */: + case 31 /* ExclamationEqualsToken */: + case 32 /* EqualsEqualsEqualsToken */: + case 33 /* ExclamationEqualsEqualsToken */: + if (isNullOrUndefinedLiteral(expr.right)) { + return narrowTypeByNullCheck(type, expr, assumeTrue); + } + if (expr.left.kind === 182 /* TypeOfExpression */ && expr.right.kind === 9 /* StringLiteral */) { + return narrowTypeByTypeof(type, expr, assumeTrue); + } + break; + case 91 /* InstanceOfKeyword */: + return narrowTypeByInstanceof(type, expr, assumeTrue); + case 24 /* CommaToken */: + return narrowType(type, expr.right, assumeTrue); + } + return type; + } + function narrowTypeByNullCheck(type, expr, assumeTrue) { + // We have '==', '!=', '===', or '!==' operator with 'null' or 'undefined' on the right + var operator = expr.operatorToken.kind; + if (operator === 31 /* ExclamationEqualsToken */ || operator === 33 /* ExclamationEqualsEqualsToken */) { assumeTrue = !assumeTrue; } - if (assumeTrue) { - // Assumed result is true. If check was not for a primitive type, remove all primitive types - if (!typeInfo) { - return removeTypesFromUnionType(type, /*typeKind*/ 258 /* StringLike */ | 132 /* NumberLike */ | 8 /* Boolean */ | 16777216 /* ESSymbol */, - /*isOfTypeKind*/ true, /*allowEmptyUnionResult*/ false); - } - // Check was for a primitive type, return that primitive type if it is a subtype - if (isTypeSubtypeOf(typeInfo.type, type)) { - return typeInfo.type; - } - // Otherwise, remove all types that aren't of the primitive type kind. This can happen when the type is - // union of enum types and other types. - return removeTypesFromUnionType(type, /*typeKind*/ typeInfo.flags, /*isOfTypeKind*/ false, /*allowEmptyUnionResult*/ false); - } - else { - // Assumed result is false. If check was for a primitive type, remove that primitive type - if (typeInfo) { - return removeTypesFromUnionType(type, /*typeKind*/ typeInfo.flags, /*isOfTypeKind*/ true, /*allowEmptyUnionResult*/ false); - } - // Otherwise we don't have enough information to do anything. + if (!strictNullChecks || !isMatchingReference(reference, expr.left)) { return type; } + var doubleEquals = operator === 30 /* EqualsEqualsToken */ || operator === 31 /* ExclamationEqualsToken */; + var facts = doubleEquals ? + assumeTrue ? 65536 /* EQUndefinedOrNull */ : 524288 /* NEUndefinedOrNull */ : + expr.right.kind === 93 /* NullKeyword */ ? + assumeTrue ? 32768 /* EQNull */ : 262144 /* NENull */ : + assumeTrue ? 16384 /* EQUndefined */ : 131072 /* NEUndefined */; + return getTypeWithFacts(type, facts); } - function narrowTypeByAnd(type, expr, assumeTrue) { - if (assumeTrue) { - // The assumed result is true, therefore we narrow assuming each operand to be true. - return narrowType(narrowType(type, expr.left, /*assumeTrue*/ true), expr.right, /*assumeTrue*/ true); + function narrowTypeByTypeof(type, expr, assumeTrue) { + // We have '==', '!=', '====', or !==' operator with 'typeof xxx' on the left + // and string literal on the right + var left = expr.left; + var right = expr.right; + if (!isMatchingReference(reference, left.expression)) { + // For a reference of the form 'x.y', a 'typeof x === ...' type guard resets the + // narrowed type of 'y' to its declared type. + if (containsMatchingReference(reference, left.expression)) { + return declaredType; + } + return type; } - else { - // The assumed result is false. This means either the first operand was false, or the first operand was true - // and the second operand was false. We narrow with those assumptions and union the two resulting types. - return getUnionType([ - narrowType(type, expr.left, /*assumeTrue*/ false), - narrowType(narrowType(type, expr.left, /*assumeTrue*/ true), expr.right, /*assumeTrue*/ false) - ]); + if (expr.operatorToken.kind === 31 /* ExclamationEqualsToken */ || + expr.operatorToken.kind === 33 /* ExclamationEqualsEqualsToken */) { + assumeTrue = !assumeTrue; } - } - function narrowTypeByOr(type, expr, assumeTrue) { - if (assumeTrue) { - // The assumed result is true. This means either the first operand was true, or the first operand was false - // and the second operand was true. We narrow with those assumptions and union the two resulting types. - return getUnionType([ - narrowType(type, expr.left, /*assumeTrue*/ true), - narrowType(narrowType(type, expr.left, /*assumeTrue*/ false), expr.right, /*assumeTrue*/ true) - ]); - } - else { - // The assumed result is false, therefore we narrow assuming each operand to be false. - return narrowType(narrowType(type, expr.left, /*assumeTrue*/ false), expr.right, /*assumeTrue*/ false); + if (assumeTrue && !(type.flags & 16384 /* Union */)) { + // We narrow a non-union type to an exact primitive type if the non-union type + // is a supertype of that primtive type. For example, type 'any' can be narrowed + // to one of the primitive types. + var targetType = ts.getProperty(typeofTypesByName, right.text); + if (targetType && isTypeSubtypeOf(targetType, type)) { + return targetType; + } } + var facts = assumeTrue ? + ts.getProperty(typeofEQFacts, right.text) || 64 /* TypeofEQHostObject */ : + ts.getProperty(typeofNEFacts, right.text) || 8192 /* TypeofNEHostObject */; + return getTypeWithFacts(type, facts); } function narrowTypeByInstanceof(type, expr, assumeTrue) { - // Check that type is not any, assumed result is true, and we have variable symbol on the left - if (isTypeAny(type) || expr.left.kind !== 69 /* Identifier */ || getResolvedSymbol(expr.left) !== symbol) { + if (!isMatchingReference(reference, expr.left)) { + // For a reference of the form 'x.y', an 'x instanceof T' type guard resets the + // narrowed type of 'y' to its declared type. + if (containsMatchingReference(reference, expr.left)) { + return declaredType; + } + return type; + } + // We never narrow type any in an instanceof guard + if (isTypeAny(type)) { return type; } // Check that right operand is a function type with a prototype property @@ -19901,7 +22657,7 @@ var ts; } if (!targetType) { // Target type is type of construct signature - var constructSignatures; + var constructSignatures = void 0; if (rightType.flags & 2048 /* Interface */) { constructSignatures = resolveDeclaredMembers(rightType).declaredConstructSignatures; } @@ -19913,46 +22669,64 @@ var ts; } } if (targetType) { - if (!assumeTrue) { - if (type.flags & 16384 /* Union */) { - return getUnionType(ts.filter(type.types, function (t) { return !isTypeSubtypeOf(t, targetType); })); - } - return type; - } - return getNarrowedType(type, targetType); + return getNarrowedType(type, targetType, assumeTrue); } return type; } - function getNarrowedType(originalType, narrowedTypeCandidate) { - // If the current type is a union type, remove all constituents that aren't assignable to target. If that produces - // 0 candidates, fall back to the assignability check - if (originalType.flags & 16384 /* Union */) { - var assignableConstituents = ts.filter(originalType.types, function (t) { return isTypeAssignableTo(t, narrowedTypeCandidate); }); + function getNarrowedType(type, candidate, assumeTrue) { + if (!assumeTrue) { + return type.flags & 16384 /* Union */ ? + getUnionType(ts.filter(type.types, function (t) { return !isTypeSubtypeOf(t, candidate); })) : + type; + } + // If the current type is a union type, remove all constituents that aren't assignable to + // the candidate type. If one or more constituents remain, return a union of those. + if (type.flags & 16384 /* Union */) { + var assignableConstituents = ts.filter(type.types, function (t) { return isTypeAssignableTo(t, candidate); }); if (assignableConstituents.length) { return getUnionType(assignableConstituents); } } - if (isTypeAssignableTo(narrowedTypeCandidate, originalType)) { - // Narrow to the target type if it's assignable to the current type - return narrowedTypeCandidate; - } - return originalType; + // If the candidate type is assignable to the target type, narrow to the candidate type. + // Otherwise, if the current type is assignable to the candidate, keep the current type. + // Otherwise, the types are completely unrelated, so narrow to the empty type. + var targetType = type.flags & 512 /* TypeParameter */ ? getApparentType(type) : type; + return isTypeAssignableTo(candidate, targetType) ? candidate : + isTypeAssignableTo(type, candidate) ? type : + neverType; } - function narrowTypeByTypePredicate(type, expr, assumeTrue) { - if (type.flags & 1 /* Any */) { + function narrowTypeByTypePredicate(type, callExpression, assumeTrue) { + if (type.flags & 1 /* Any */ || !hasMatchingArgument(callExpression, reference)) { return type; } - var signature = getResolvedSignature(expr); - if (signature.typePredicate && - expr.arguments[signature.typePredicate.parameterIndex] && - getSymbolAtLocation(expr.arguments[signature.typePredicate.parameterIndex]) === symbol) { - if (!assumeTrue) { - if (type.flags & 16384 /* Union */) { - return getUnionType(ts.filter(type.types, function (t) { return !isTypeSubtypeOf(t, signature.typePredicate.type); })); + var signature = getResolvedSignature(callExpression); + var predicate = signature.typePredicate; + if (!predicate) { + return type; + } + if (ts.isIdentifierTypePredicate(predicate)) { + var predicateArgument = callExpression.arguments[predicate.parameterIndex]; + if (predicateArgument) { + if (isMatchingReference(reference, predicateArgument)) { + return getNarrowedType(type, predicate.type, assumeTrue); + } + if (containsMatchingReference(reference, predicateArgument)) { + return declaredType; + } + } + } + else { + var invokedExpression = skipParenthesizedNodes(callExpression.expression); + if (invokedExpression.kind === 173 /* ElementAccessExpression */ || invokedExpression.kind === 172 /* PropertyAccessExpression */) { + var accessExpression = invokedExpression; + var possibleReference = skipParenthesizedNodes(accessExpression.expression); + if (isMatchingReference(reference, possibleReference)) { + return getNarrowedType(type, predicate.type, assumeTrue); + } + if (containsMatchingReference(reference, possibleReference)) { + return declaredType; } - return type; } - return getNarrowedType(type, signature.typePredicate.type); } return type; } @@ -19960,26 +22734,17 @@ var ts; // will be a subtype or the same type as the argument. function narrowType(type, expr, assumeTrue) { switch (expr.kind) { - case 168 /* CallExpression */: + case 69 /* Identifier */: + case 97 /* ThisKeyword */: + case 172 /* PropertyAccessExpression */: + return narrowTypeByTruthiness(type, expr, assumeTrue); + case 174 /* CallExpression */: return narrowTypeByTypePredicate(type, expr, assumeTrue); - case 172 /* ParenthesizedExpression */: + case 178 /* ParenthesizedExpression */: return narrowType(type, expr.expression, assumeTrue); - case 181 /* BinaryExpression */: - var operator = expr.operatorToken.kind; - if (operator === 32 /* EqualsEqualsEqualsToken */ || operator === 33 /* ExclamationEqualsEqualsToken */) { - return narrowTypeByEquality(type, expr, assumeTrue); - } - else if (operator === 51 /* AmpersandAmpersandToken */) { - return narrowTypeByAnd(type, expr, assumeTrue); - } - else if (operator === 52 /* BarBarToken */) { - return narrowTypeByOr(type, expr, assumeTrue); - } - else if (operator === 91 /* InstanceOfKeyword */) { - return narrowTypeByInstanceof(type, expr, assumeTrue); - } - break; - case 179 /* PrefixUnaryExpression */: + case 187 /* BinaryExpression */: + return narrowTypeByBinaryExpression(type, expr, assumeTrue); + case 185 /* PrefixUnaryExpression */: if (expr.operator === 49 /* ExclamationToken */) { return narrowType(type, expr.operand, !assumeTrue); } @@ -19988,6 +22753,35 @@ var ts; return type; } } + function getTypeOfSymbolAtLocation(symbol, location) { + // If we have an identifier or a property access at the given location, if the location is + // an dotted name expression, and if the location is not an assignment target, obtain the type + // of the expression (which will reflect control flow analysis). If the expression indeed + // resolved to the given symbol, return the narrowed type. + if (location.kind === 69 /* Identifier */) { + if (ts.isRightSideOfQualifiedNameOrPropertyAccess(location)) { + location = location.parent; + } + if (ts.isExpression(location) && !ts.isAssignmentTarget(location)) { + var type = checkExpression(location); + if (getExportSymbolOfValueSymbolIfExported(getNodeLinks(location).resolvedSymbol) === symbol) { + return type; + } + } + } + // The location isn't a reference to the given symbol, meaning we're being asked + // a hypothetical question of what type the symbol would have if there was a reference + // to it at the given location. Since we have no control flow information for the + // hypotherical reference (control flow information is created and attached by the + // binder), we simply return the declared type of the symbol. + return getTypeOfSymbol(symbol); + } + function skipParenthesizedNodes(expression) { + while (expression.kind === 178 /* ParenthesizedExpression */) { + expression = expression.expression; + } + return expression; + } function checkIdentifier(node) { var symbol = getResolvedSymbol(node); // As noted in ECMAScript 6 language spec, arrow functions never have an arguments objects. @@ -19998,23 +22792,54 @@ var ts; // can explicitly bound arguments objects if (symbol === argumentsSymbol) { var container = ts.getContainingFunction(node); - if (container.kind === 174 /* ArrowFunction */) { + if (container.kind === 180 /* ArrowFunction */) { if (languageVersion < 2 /* ES6 */) { error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression); } } - if (node.parserContextFlags & 8 /* Await */) { - getNodeLinks(container).flags |= 4096 /* CaptureArguments */; - getNodeLinks(node).flags |= 2048 /* LexicalArguments */; + if (node.flags & 33554432 /* AwaitContext */) { + getNodeLinks(container).flags |= 8192 /* CaptureArguments */; } } if (symbol.flags & 8388608 /* Alias */ && !isInTypeQuery(node) && !isConstEnumOrConstEnumOnlyModule(resolveAlias(symbol))) { markAliasSymbolAsReferenced(symbol); } + var localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol); + // Due to the emit for class decorators, any reference to the class from inside of the class body + // must instead be rewritten to point to a temporary variable to avoid issues with the double-bind + // behavior of class names in ES6. + if (languageVersion === 2 /* ES6 */ + && localOrExportSymbol.flags & 32 /* Class */ + && localOrExportSymbol.valueDeclaration.kind === 221 /* ClassDeclaration */ + && ts.nodeIsDecorated(localOrExportSymbol.valueDeclaration)) { + var container = ts.getContainingClass(node); + while (container !== undefined) { + if (container === localOrExportSymbol.valueDeclaration && container.name !== node) { + getNodeLinks(container).flags |= 524288 /* ClassWithBodyScopedClassBinding */; + getNodeLinks(node).flags |= 1048576 /* BodyScopedClassBinding */; + break; + } + container = ts.getContainingClass(container); + } + } checkCollisionWithCapturedSuperVariable(node, node); checkCollisionWithCapturedThisVariable(node, node); - checkBlockScopedBindingCapturedInLoop(node, symbol); - return getNarrowedTypeOfSymbol(getExportSymbolOfValueSymbolIfExported(symbol), node); + checkNestedBlockScopedBinding(node, symbol); + var type = getTypeOfSymbol(localOrExportSymbol); + if (!(localOrExportSymbol.flags & 3 /* Variable */) || ts.isAssignmentTarget(node)) { + return type; + } + var declaration = localOrExportSymbol.valueDeclaration; + var assumeInitialized = !strictNullChecks || (type.flags & 1 /* Any */) !== 0 || !declaration || + ts.getRootDeclaration(declaration).kind === 142 /* Parameter */ || ts.isInAmbientContext(declaration) || + ts.getContainingFunctionOrModule(declaration) !== ts.getContainingFunctionOrModule(node); + var flowType = getFlowTypeOfReference(node, type, assumeInitialized); + if (!assumeInitialized && !(getNullableKind(type) & 32 /* Undefined */) && getNullableKind(flowType) & 32 /* Undefined */) { + error(node, ts.Diagnostics.Variable_0_is_used_before_being_assigned, symbolToString(symbol)); + // Return the declared type to reduce follow-on errors + return type; + } + return flowType; } function isInsideFunction(node, threshold) { var current = node; @@ -20026,52 +22851,79 @@ var ts; } return false; } - function checkBlockScopedBindingCapturedInLoop(node, symbol) { + function checkNestedBlockScopedBinding(node, symbol) { if (languageVersion >= 2 /* ES6 */ || (symbol.flags & (2 /* BlockScopedVariable */ | 32 /* Class */)) === 0 || - symbol.valueDeclaration.parent.kind === 244 /* CatchClause */) { + symbol.valueDeclaration.parent.kind === 252 /* CatchClause */) { return; } // 1. walk from the use site up to the declaration and check // if there is anything function like between declaration and use-site (is binding/class is captured in function). // 2. walk from the declaration up to the boundary of lexical environment and check // if there is an iteration statement in between declaration and boundary (is binding/class declared inside iteration statement) - var container; - if (symbol.flags & 32 /* Class */) { - // get parent of class declaration - container = getClassLikeDeclarationOfSymbol(symbol).parent; - } - else { - // nesting structure: - // (variable declaration or binding element) -> variable declaration list -> container - container = symbol.valueDeclaration; - while (container.kind !== 212 /* VariableDeclarationList */) { - container = container.parent; - } - // get the parent of variable declaration list - container = container.parent; - if (container.kind === 193 /* VariableStatement */) { - // if parent is variable statement - get its parent - container = container.parent; - } - } - var inFunction = isInsideFunction(node.parent, container); + var container = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration); + var usedInFunction = isInsideFunction(node.parent, container); var current = container; + var containedInIterationStatement = false; while (current && !ts.nodeStartsNewLexicalEnvironment(current)) { if (ts.isIterationStatement(current, /*lookInLabeledStatements*/ false)) { - if (inFunction) { - getNodeLinks(current).flags |= 65536 /* LoopWithBlockScopedBindingCapturedInFunction */; - } - // mark value declaration so during emit they can have a special handling - getNodeLinks(symbol.valueDeclaration).flags |= 16384 /* BlockScopedBindingInLoop */; + containedInIterationStatement = true; break; } current = current.parent; } + if (containedInIterationStatement) { + if (usedInFunction) { + // mark iteration statement as containing block-scoped binding captured in some function + getNodeLinks(current).flags |= 65536 /* LoopWithCapturedBlockScopedBinding */; + } + // mark variables that are declared in loop initializer and reassigned inside the body of ForStatement. + // if body of ForStatement will be converted to function then we'll need a extra machinery to propagate reassigned values back. + if (container.kind === 206 /* ForStatement */ && + ts.getAncestor(symbol.valueDeclaration, 219 /* VariableDeclarationList */).parent === container && + isAssignedInBodyOfForStatement(node, container)) { + getNodeLinks(symbol.valueDeclaration).flags |= 2097152 /* NeedsLoopOutParameter */; + } + // set 'declared inside loop' bit on the block-scoped binding + getNodeLinks(symbol.valueDeclaration).flags |= 262144 /* BlockScopedBindingInLoop */; + } + if (usedInFunction) { + getNodeLinks(symbol.valueDeclaration).flags |= 131072 /* CapturedBlockScopedBinding */; + } + } + function isAssignedInBodyOfForStatement(node, container) { + var current = node; + // skip parenthesized nodes + while (current.parent.kind === 178 /* ParenthesizedExpression */) { + current = current.parent; + } + // check if node is used as LHS in some assignment expression + var isAssigned = false; + if (ts.isAssignmentTarget(current)) { + isAssigned = true; + } + else if ((current.parent.kind === 185 /* PrefixUnaryExpression */ || current.parent.kind === 186 /* PostfixUnaryExpression */)) { + var expr = current.parent; + isAssigned = expr.operator === 41 /* PlusPlusToken */ || expr.operator === 42 /* MinusMinusToken */; + } + if (!isAssigned) { + return false; + } + // at this point we know that node is the target of assignment + // now check that modification happens inside the statement part of the ForStatement + while (current !== container) { + if (current === container.statement) { + return true; + } + else { + current = current.parent; + } + } + return false; } function captureLexicalThis(node, container) { getNodeLinks(node).flags |= 2 /* LexicalThis */; - if (container.kind === 141 /* PropertyDeclaration */ || container.kind === 144 /* Constructor */) { + if (container.kind === 145 /* PropertyDeclaration */ || container.kind === 148 /* Constructor */) { var classNode = container.parent; getNodeLinks(classNode).flags |= 4 /* CaptureThis */; } @@ -20079,109 +22931,293 @@ var ts; getNodeLinks(container).flags |= 4 /* CaptureThis */; } } + function findFirstSuperCall(n) { + if (ts.isSuperCallExpression(n)) { + return n; + } + else if (ts.isFunctionLike(n)) { + return undefined; + } + return ts.forEachChild(n, findFirstSuperCall); + } + /** + * Return a cached result if super-statement is already found. + * Otherwise, find a super statement in a given constructor function and cache the result in the node-links of the constructor + * + * @param constructor constructor-function to look for super statement + */ + function getSuperCallInConstructor(constructor) { + var links = getNodeLinks(constructor); + // Only trying to find super-call if we haven't yet tried to find one. Once we try, we will record the result + if (links.hasSuperCall === undefined) { + links.superCall = findFirstSuperCall(constructor.body); + links.hasSuperCall = links.superCall ? true : false; + } + return links.superCall; + } + /** + * Check if the given class-declaration extends null then return true. + * Otherwise, return false + * @param classDecl a class declaration to check if it extends null + */ + function classDeclarationExtendsNull(classDecl) { + var classSymbol = getSymbolOfNode(classDecl); + var classInstanceType = getDeclaredTypeOfSymbol(classSymbol); + var baseConstructorType = getBaseConstructorTypeOfClass(classInstanceType); + return baseConstructorType === nullType; + } function checkThisExpression(node) { // Stop at the first arrow function so that we can // tell whether 'this' needs to be captured. var container = ts.getThisContainer(node, /* includeArrowFunctions */ true); var needToCaptureLexicalThis = false; + if (container.kind === 148 /* Constructor */) { + var containingClassDecl = container.parent; + var baseTypeNode = ts.getClassExtendsHeritageClauseElement(containingClassDecl); + // If a containing class does not have extends clause or the class extends null + // skip checking whether super statement is called before "this" accessing. + if (baseTypeNode && !classDeclarationExtendsNull(containingClassDecl)) { + var superCall = getSuperCallInConstructor(container); + // We should give an error in the following cases: + // - No super-call + // - "this" is accessing before super-call. + // i.e super(this) + // this.x; super(); + // We want to make sure that super-call is done before accessing "this" so that + // "this" is not accessed as a parameter of the super-call. + if (!superCall || superCall.end > node.pos) { + // In ES6, super inside constructor of class-declaration has to precede "this" accessing + error(node, ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class); + } + } + } // Now skip arrow functions to get the "real" owner of 'this'. - if (container.kind === 174 /* ArrowFunction */) { + if (container.kind === 180 /* ArrowFunction */) { container = ts.getThisContainer(container, /* includeArrowFunctions */ false); // When targeting es6, arrow function lexically bind "this" so we do not need to do the work of binding "this" in emitted code needToCaptureLexicalThis = (languageVersion < 2 /* ES6 */); } switch (container.kind) { - case 218 /* ModuleDeclaration */: + case 225 /* ModuleDeclaration */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body); // do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks break; - case 217 /* EnumDeclaration */: + case 224 /* EnumDeclaration */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location); // do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks break; - case 144 /* Constructor */: + case 148 /* Constructor */: if (isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_constructor_arguments); } break; - case 141 /* PropertyDeclaration */: - case 140 /* PropertySignature */: - if (container.flags & 64 /* Static */) { + case 145 /* PropertyDeclaration */: + case 144 /* PropertySignature */: + if (container.flags & 32 /* Static */) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_static_property_initializer); } break; - case 136 /* ComputedPropertyName */: + case 140 /* ComputedPropertyName */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_computed_property_name); break; } if (needToCaptureLexicalThis) { captureLexicalThis(node, container); } + if (ts.isFunctionLike(container)) { + // If this is a function in a JS file, it might be a class method. Check if it's the RHS + // of a x.prototype.y = function [name]() { .... } + if (container.kind === 179 /* FunctionExpression */ && + ts.isInJavaScriptFile(container.parent) && + ts.getSpecialPropertyAssignmentKind(container.parent) === 3 /* PrototypeProperty */) { + // Get the 'x' of 'x.prototype.y = f' (here, 'f' is 'container') + var className = container.parent // x.prototype.y = f + .left // x.prototype.y + .expression // x.prototype + .expression; // x + var classSymbol = checkExpression(className).symbol; + if (classSymbol && classSymbol.members && (classSymbol.flags & 16 /* Function */)) { + return getInferredClassType(classSymbol); + } + } + var type = getContextuallyTypedThisType(container); + if (type) { + return type; + } + var signature = getSignatureFromDeclaration(container); + if (signature.thisType) { + return signature.thisType; + } + } if (ts.isClassLike(container.parent)) { var symbol = getSymbolOfNode(container.parent); - return container.flags & 64 /* Static */ ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol).thisType; + var type = container.flags & 32 /* Static */ ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol).thisType; + return getFlowTypeOfReference(node, type, /*assumeInitialized*/ true); + } + if (ts.isInJavaScriptFile(node)) { + var type = getTypeForThisExpressionFromJSDoc(container); + if (type && type !== unknownType) { + return type; + } + } + if (compilerOptions.noImplicitThis) { + // With noImplicitThis, functions may not reference 'this' if it has type 'any' + error(node, ts.Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation); } return anyType; } + function getTypeForThisExpressionFromJSDoc(node) { + var typeTag = ts.getJSDocTypeTag(node); + if (typeTag && typeTag.typeExpression && typeTag.typeExpression.type && typeTag.typeExpression.type.kind === 269 /* JSDocFunctionType */) { + var jsDocFunctionType = typeTag.typeExpression.type; + if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].type.kind === 272 /* JSDocThisType */) { + return getTypeFromTypeNode(jsDocFunctionType.parameters[0].type); + } + } + } function isInConstructorArgumentInitializer(node, constructorDecl) { for (var n = node; n && n !== constructorDecl; n = n.parent) { - if (n.kind === 138 /* Parameter */) { + if (n.kind === 142 /* Parameter */) { return true; } } return false; } function checkSuperExpression(node) { - var isCallExpression = node.parent.kind === 168 /* CallExpression */ && node.parent.expression === node; - var classDeclaration = ts.getContainingClass(node); - var classType = classDeclaration && getDeclaredTypeOfSymbol(getSymbolOfNode(classDeclaration)); - var baseClassType = classType && getBaseTypes(classType)[0]; - var container = ts.getSuperContainer(node, /*includeFunctions*/ true); + var isCallExpression = node.parent.kind === 174 /* CallExpression */ && node.parent.expression === node; + var container = ts.getSuperContainer(node, /*stopOnFunctions*/ true); var needToCaptureLexicalThis = false; if (!isCallExpression) { // adjust the container reference in case if super is used inside arrow functions with arbitrary deep nesting - while (container && container.kind === 174 /* ArrowFunction */) { - container = ts.getSuperContainer(container, /*includeFunctions*/ true); + while (container && container.kind === 180 /* ArrowFunction */) { + container = ts.getSuperContainer(container, /*stopOnFunctions*/ true); needToCaptureLexicalThis = languageVersion < 2 /* ES6 */; } } var canUseSuperExpression = isLegalUsageOfSuperExpression(container); var nodeCheckFlag = 0; - // always set NodeCheckFlags for 'super' expression node - if (canUseSuperExpression) { - if ((container.flags & 64 /* Static */) || isCallExpression) { - nodeCheckFlag = 512 /* SuperStatic */; - } - else { - nodeCheckFlag = 256 /* SuperInstance */; - } - getNodeLinks(node).flags |= nodeCheckFlag; - if (needToCaptureLexicalThis) { - // call expressions are allowed only in constructors so they should always capture correct 'this' - // super property access expressions can also appear in arrow functions - - // in this case they should also use correct lexical this - captureLexicalThis(node.parent, container); - } - } - if (!baseClassType) { - if (!classDeclaration || !ts.getClassExtendsHeritageClauseElement(classDeclaration)) { - error(node, ts.Diagnostics.super_can_only_be_referenced_in_a_derived_class); - } - return unknownType; - } if (!canUseSuperExpression) { - if (container && container.kind === 136 /* ComputedPropertyName */) { + // issue more specific error if super is used in computed property name + // class A { foo() { return "1" }} + // class B { + // [super.foo()]() {} + // } + var current = node; + while (current && current !== container && current.kind !== 140 /* ComputedPropertyName */) { + current = current.parent; + } + if (current && current.kind === 140 /* ComputedPropertyName */) { error(node, ts.Diagnostics.super_cannot_be_referenced_in_a_computed_property_name); } else if (isCallExpression) { error(node, ts.Diagnostics.Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors); } + else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 171 /* ObjectLiteralExpression */)) { + error(node, ts.Diagnostics.super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions); + } else { error(node, ts.Diagnostics.super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class); } return unknownType; } - if (container.kind === 144 /* Constructor */ && isInConstructorArgumentInitializer(node, container)) { + if ((container.flags & 32 /* Static */) || isCallExpression) { + nodeCheckFlag = 512 /* SuperStatic */; + } + else { + nodeCheckFlag = 256 /* SuperInstance */; + } + getNodeLinks(node).flags |= nodeCheckFlag; + // Due to how we emit async functions, we need to specialize the emit for an async method that contains a `super` reference. + // This is due to the fact that we emit the body of an async function inside of a generator function. As generator + // functions cannot reference `super`, we emit a helper inside of the method body, but outside of the generator. This helper + // uses an arrow function, which is permitted to reference `super`. + // + // There are two primary ways we can access `super` from within an async method. The first is getting the value of a property + // or indexed access on super, either as part of a right-hand-side expression or call expression. The second is when setting the value + // of a property or indexed access, either as part of an assignment expression or destructuring assignment. + // + // The simplest case is reading a value, in which case we will emit something like the following: + // + // // ts + // ... + // async asyncMethod() { + // let x = await super.asyncMethod(); + // return x; + // } + // ... + // + // // js + // ... + // asyncMethod() { + // const _super = name => super[name]; + // return __awaiter(this, arguments, Promise, function *() { + // let x = yield _super("asyncMethod").call(this); + // return x; + // }); + // } + // ... + // + // The more complex case is when we wish to assign a value, especially as part of a destructuring assignment. As both cases + // are legal in ES6, but also likely less frequent, we emit the same more complex helper for both scenarios: + // + // // ts + // ... + // async asyncMethod(ar: Promise) { + // [super.a, super.b] = await ar; + // } + // ... + // + // // js + // ... + // asyncMethod(ar) { + // const _super = (function (geti, seti) { + // const cache = Object.create(null); + // return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } }); + // })(name => super[name], (name, value) => super[name] = value); + // return __awaiter(this, arguments, Promise, function *() { + // [_super("a").value, _super("b").value] = yield ar; + // }); + // } + // ... + // + // This helper creates an object with a "value" property that wraps the `super` property or indexed access for both get and set. + // This is required for destructuring assignments, as a call expression cannot be used as the target of a destructuring assignment + // while a property access can. + if (container.kind === 147 /* MethodDeclaration */ && container.flags & 256 /* Async */) { + if (ts.isSuperPropertyOrElementAccess(node.parent) && ts.isAssignmentTarget(node.parent)) { + getNodeLinks(container).flags |= 4096 /* AsyncMethodWithSuperBinding */; + } + else { + getNodeLinks(container).flags |= 2048 /* AsyncMethodWithSuper */; + } + } + if (needToCaptureLexicalThis) { + // call expressions are allowed only in constructors so they should always capture correct 'this' + // super property access expressions can also appear in arrow functions - + // in this case they should also use correct lexical this + captureLexicalThis(node.parent, container); + } + if (container.parent.kind === 171 /* ObjectLiteralExpression */) { + if (languageVersion < 2 /* ES6 */) { + error(node, ts.Diagnostics.super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher); + return unknownType; + } + else { + // for object literal assume that type of 'super' is 'any' + return anyType; + } + } + // at this point the only legal case for parent is ClassLikeDeclaration + var classLikeDeclaration = container.parent; + var classType = getDeclaredTypeOfSymbol(getSymbolOfNode(classLikeDeclaration)); + var baseClassType = classType && getBaseTypes(classType)[0]; + if (!baseClassType) { + if (!ts.getClassExtendsHeritageClauseElement(classLikeDeclaration)) { + error(node, ts.Diagnostics.super_can_only_be_referenced_in_a_derived_class); + } + return unknownType; + } + if (container.kind === 148 /* Constructor */ && isInConstructorArgumentInitializer(node, container)) { // issue custom error message for super property access in constructor arguments (to be aligned with old compiler) error(node, ts.Diagnostics.super_cannot_be_referenced_in_constructor_arguments); return unknownType; @@ -20196,71 +23232,113 @@ var ts; if (isCallExpression) { // TS 1.0 SPEC (April 2014): 4.8.1 // Super calls are only permitted in constructors of derived classes - return container.kind === 144 /* Constructor */; + return container.kind === 148 /* Constructor */; } else { // TS 1.0 SPEC (April 2014) // 'super' property access is allowed // - In a constructor, instance member function, instance member accessor, or instance member variable initializer where this references a derived class instance // - In a static member function or static member accessor - // topmost container must be something that is directly nested in the class declaration - if (container && ts.isClassLike(container.parent)) { - if (container.flags & 64 /* Static */) { - return container.kind === 143 /* MethodDeclaration */ || - container.kind === 142 /* MethodSignature */ || - container.kind === 145 /* GetAccessor */ || - container.kind === 146 /* SetAccessor */; + // topmost container must be something that is directly nested in the class declaration\object literal expression + if (ts.isClassLike(container.parent) || container.parent.kind === 171 /* ObjectLiteralExpression */) { + if (container.flags & 32 /* Static */) { + return container.kind === 147 /* MethodDeclaration */ || + container.kind === 146 /* MethodSignature */ || + container.kind === 149 /* GetAccessor */ || + container.kind === 150 /* SetAccessor */; } else { - return container.kind === 143 /* MethodDeclaration */ || - container.kind === 142 /* MethodSignature */ || - container.kind === 145 /* GetAccessor */ || - container.kind === 146 /* SetAccessor */ || - container.kind === 141 /* PropertyDeclaration */ || - container.kind === 140 /* PropertySignature */ || - container.kind === 144 /* Constructor */; + return container.kind === 147 /* MethodDeclaration */ || + container.kind === 146 /* MethodSignature */ || + container.kind === 149 /* GetAccessor */ || + container.kind === 150 /* SetAccessor */ || + container.kind === 145 /* PropertyDeclaration */ || + container.kind === 144 /* PropertySignature */ || + container.kind === 148 /* Constructor */; } } } return false; } } + function getContextuallyTypedThisType(func) { + if (isContextSensitiveFunctionOrObjectLiteralMethod(func) && func.kind !== 180 /* ArrowFunction */) { + var contextualSignature = getContextualSignature(func); + if (contextualSignature) { + return contextualSignature.thisType; + } + } + return undefined; + } // Return contextual type of parameter or undefined if no contextual type is available function getContextuallyTypedParameterType(parameter) { var func = parameter.parent; - if (isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) { - if (isContextSensitive(func)) { - var contextualSignature = getContextualSignature(func); - if (contextualSignature) { - var funcHasRestParameters = ts.hasRestParameter(func); - var len = func.parameters.length - (funcHasRestParameters ? 1 : 0); - var indexOfParameter = ts.indexOf(func.parameters, parameter); - if (indexOfParameter < len) { - return getTypeAtPosition(contextualSignature, indexOfParameter); - } - // If last parameter is contextually rest parameter get its type - if (funcHasRestParameters && - indexOfParameter === (func.parameters.length - 1) && - isRestParameterIndex(contextualSignature, func.parameters.length - 1)) { - return getTypeOfSymbol(ts.lastOrUndefined(contextualSignature.parameters)); + if (isContextSensitiveFunctionOrObjectLiteralMethod(func)) { + var iife = getImmediatelyInvokedFunctionExpression(func); + if (iife) { + var indexOfParameter = ts.indexOf(func.parameters, parameter); + if (iife.arguments && indexOfParameter < iife.arguments.length) { + if (parameter.dotDotDotToken) { + var restTypes = []; + for (var i = indexOfParameter; i < iife.arguments.length; i++) { + restTypes.push(getTypeOfExpression(iife.arguments[i])); + } + return createArrayType(getUnionType(restTypes)); } + var links = getNodeLinks(iife); + var cached = links.resolvedSignature; + links.resolvedSignature = anySignature; + var type = checkExpression(iife.arguments[indexOfParameter]); + links.resolvedSignature = cached; + return type; + } + } + var contextualSignature = getContextualSignature(func); + if (contextualSignature) { + var funcHasRestParameters = ts.hasRestParameter(func); + var len = func.parameters.length - (funcHasRestParameters ? 1 : 0); + var indexOfParameter = ts.indexOf(func.parameters, parameter); + if (indexOfParameter < len) { + return getTypeAtPosition(contextualSignature, indexOfParameter); + } + // If last parameter is contextually rest parameter get its type + if (funcHasRestParameters && + indexOfParameter === (func.parameters.length - 1) && + isRestParameterIndex(contextualSignature, func.parameters.length - 1)) { + return getTypeOfSymbol(ts.lastOrUndefined(contextualSignature.parameters)); } } } return undefined; } - // In a variable, parameter or property declaration with a type annotation, the contextual type of an initializer - // expression is the type of the variable, parameter or property. Otherwise, in a parameter declaration of a - // contextually typed function expression, the contextual type of an initializer expression is the contextual type - // of the parameter. Otherwise, in a variable or parameter declaration with a binding pattern name, the contextual - // type of an initializer expression is the type implied by the binding pattern. + function getImmediatelyInvokedFunctionExpression(func) { + if (isFunctionExpressionOrArrowFunction(func)) { + var prev = func; + var parent_8 = func.parent; + while (parent_8.kind === 178 /* ParenthesizedExpression */) { + prev = parent_8; + parent_8 = parent_8.parent; + } + if (parent_8.kind === 174 /* CallExpression */ && parent_8.expression === prev) { + return parent_8; + } + } + } + // In a variable, parameter or property declaration with a type annotation, + // the contextual type of an initializer expression is the type of the variable, parameter or property. + // Otherwise, in a parameter declaration of a contextually typed function expression, + // the contextual type of an initializer expression is the contextual type of the parameter. + // Otherwise, in a variable or parameter declaration with a binding pattern name, + // the contextual type of an initializer expression is the type implied by the binding pattern. + // Otherwise, in a binding pattern inside a variable or parameter declaration, + // the contextual type of an initializer expression is the type annotation of the containing declaration, if present. function getContextualTypeForInitializerExpression(node) { var declaration = node.parent; if (node === declaration.initializer) { if (declaration.type) { return getTypeFromTypeNode(declaration.type); } - if (declaration.kind === 138 /* Parameter */) { + if (declaration.kind === 142 /* Parameter */) { var type = getContextuallyTypedParameterType(declaration); if (type) { return type; @@ -20269,6 +23347,18 @@ var ts; if (ts.isBindingPattern(declaration.name)) { return getTypeFromBindingPattern(declaration.name, /*includePatternInType*/ true); } + if (ts.isBindingPattern(declaration.parent)) { + var parentDeclaration = declaration.parent.parent; + var name_11 = declaration.propertyName || declaration.name; + if (ts.isVariableLike(parentDeclaration) && + parentDeclaration.type && + !ts.isBindingPattern(name_11)) { + var text = getTextOfPropertyName(name_11); + if (text) { + return getTypeOfPropertyOfType(getTypeFromTypeNode(parentDeclaration.type), text); + } + } + } } return undefined; } @@ -20293,7 +23383,7 @@ var ts; } function isInParameterInitializerBeforeContainingFunction(node) { while (node.parent && !ts.isFunctionLike(node.parent)) { - if (node.parent.kind === 138 /* Parameter */ && node.parent.initializer === node) { + if (node.parent.kind === 142 /* Parameter */ && node.parent.initializer === node) { return true; } node = node.parent; @@ -20304,8 +23394,8 @@ var ts; // If the containing function has a return type annotation, is a constructor, or is a get accessor whose // corresponding set accessor has a type annotation, return statements in the function are contextually typed if (functionDecl.type || - functionDecl.kind === 144 /* Constructor */ || - functionDecl.kind === 145 /* GetAccessor */ && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(functionDecl.symbol, 146 /* SetAccessor */))) { + functionDecl.kind === 148 /* Constructor */ || + functionDecl.kind === 149 /* GetAccessor */ && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(functionDecl.symbol, 150 /* SetAccessor */))) { return getReturnTypeOfSignature(getSignatureFromDeclaration(functionDecl)); } // Otherwise, if the containing function is contextually typed by a function type with exactly one call signature @@ -20321,13 +23411,13 @@ var ts; var args = getEffectiveCallArguments(callTarget); var argIndex = ts.indexOf(args, arg); if (argIndex >= 0) { - var signature = getResolvedSignature(callTarget); + var signature = getResolvedOrAnySignature(callTarget); return getTypeAtPosition(signature, argIndex); } return undefined; } function getContextualTypeForSubstitutionExpression(template, substitutionExpression) { - if (template.parent.kind === 170 /* TaggedTemplateExpression */) { + if (template.parent.kind === 176 /* TaggedTemplateExpression */) { return getContextualTypeForArgument(template.parent, substitutionExpression); } return undefined; @@ -20350,6 +23440,11 @@ var ts; } return type; } + else if (operator === 51 /* AmpersandAmpersandToken */ || operator === 24 /* CommaToken */) { + if (node === binaryExpression.right) { + return getContextualType(binaryExpression); + } + } return undefined; } // Apply a mapping function to a contextual type and return the resulting type. If the contextual type @@ -20362,8 +23457,8 @@ var ts; var types = type.types; var mappedType; var mappedTypes; - for (var _i = 0, types_7 = types; _i < types_7.length; _i++) { - var current = types_7[_i]; + for (var _i = 0, types_8 = types; _i < types_8.length; _i++) { + var current = types_8[_i]; var t = mapper(current); if (t) { if (!mappedType) { @@ -20395,10 +23490,6 @@ var ts; function contextualTypeIsTupleLikeType(type) { return !!(type.flags & 16384 /* Union */ ? ts.forEach(type.types, isTupleLikeType) : isTupleLikeType(type)); } - // Return true if the given contextual type provides an index signature of the given kind - function contextualTypeHasIndexSignature(type, kind) { - return !!(type.flags & 16384 /* Union */ ? ts.forEach(type.types, function (t) { return getIndexTypeOfStructuredType(t, kind); }) : getIndexTypeOfStructuredType(type, kind)); - } // In an object literal contextually typed by a type T, the contextual type of a property assignment is the type of // the matching property in T, if one exists. Otherwise, it is the type of the numeric index signature in T, if one // exists. Otherwise, it is the type of the string index signature in T, if one exists. @@ -20449,22 +23540,20 @@ var ts; var conditional = node.parent; return node === conditional.whenTrue || node === conditional.whenFalse ? getContextualType(conditional) : undefined; } - function getContextualTypeForJsxExpression(expr) { - // Contextual type only applies to JSX expressions that are in attribute assignments (not in 'Children' positions) - if (expr.parent.kind === 238 /* JsxAttribute */) { - var attrib = expr.parent; - var attrsType = getJsxElementAttributesType(attrib.parent); + function getContextualTypeForJsxAttribute(attribute) { + var kind = attribute.kind; + var jsxElement = attribute.parent; + var attrsType = getJsxElementAttributesType(jsxElement); + if (attribute.kind === 246 /* JsxAttribute */) { if (!attrsType || isTypeAny(attrsType)) { return undefined; } - else { - return getTypeOfPropertyOfType(attrsType, attrib.name.text); - } + return getTypeOfPropertyOfType(attrsType, attribute.name.text); } - if (expr.kind === 239 /* JsxSpreadAttribute */) { - return getJsxElementAttributesType(expr.parent); + else if (attribute.kind === 247 /* JsxSpreadAttribute */) { + return attrsType; } - return undefined; + ts.Debug.fail("Expected JsxAttribute or JsxSpreadAttribute, got ts.SyntaxKind[" + kind + "]"); } // Return the contextual type for a given expression node. During overload resolution, a contextual type may temporarily // be "pushed" onto a node using the contextualType property. @@ -20481,7 +23570,7 @@ var ts; * Otherwise this may not be very useful. * * In cases where you *are* working on this function, you should understand - * when it is appropriate to use 'getContextualType' and 'getApparentTypeOfContetxualType'. + * when it is appropriate to use 'getContextualType' and 'getApparentTypeOfContextualType'. * * - Use 'getContextualType' when you are simply going to propagate the result to the expression. * - Use 'getApparentTypeOfContextualType' when you're going to need the members of the type. @@ -20499,39 +23588,41 @@ var ts; } var parent = node.parent; switch (parent.kind) { - case 211 /* VariableDeclaration */: - case 138 /* Parameter */: - case 141 /* PropertyDeclaration */: - case 140 /* PropertySignature */: - case 163 /* BindingElement */: + case 218 /* VariableDeclaration */: + case 142 /* Parameter */: + case 145 /* PropertyDeclaration */: + case 144 /* PropertySignature */: + case 169 /* BindingElement */: return getContextualTypeForInitializerExpression(node); - case 174 /* ArrowFunction */: - case 204 /* ReturnStatement */: + case 180 /* ArrowFunction */: + case 211 /* ReturnStatement */: return getContextualTypeForReturnExpression(node); - case 184 /* YieldExpression */: + case 190 /* YieldExpression */: return getContextualTypeForYieldOperand(parent); - case 168 /* CallExpression */: - case 169 /* NewExpression */: + case 174 /* CallExpression */: + case 175 /* NewExpression */: return getContextualTypeForArgument(parent, node); - case 171 /* TypeAssertionExpression */: - case 189 /* AsExpression */: + case 177 /* TypeAssertionExpression */: + case 195 /* AsExpression */: return getTypeFromTypeNode(parent.type); - case 181 /* BinaryExpression */: + case 187 /* BinaryExpression */: return getContextualTypeForBinaryOperand(node); - case 245 /* PropertyAssignment */: + case 253 /* PropertyAssignment */: return getContextualTypeForObjectLiteralElement(parent); - case 164 /* ArrayLiteralExpression */: + case 170 /* ArrayLiteralExpression */: return getContextualTypeForElementExpression(node); - case 182 /* ConditionalExpression */: + case 188 /* ConditionalExpression */: return getContextualTypeForConditionalOperand(node); - case 190 /* TemplateSpan */: - ts.Debug.assert(parent.parent.kind === 183 /* TemplateExpression */); + case 197 /* TemplateSpan */: + ts.Debug.assert(parent.parent.kind === 189 /* TemplateExpression */); return getContextualTypeForSubstitutionExpression(parent.parent, node); - case 172 /* ParenthesizedExpression */: + case 178 /* ParenthesizedExpression */: return getContextualType(parent); - case 240 /* JsxExpression */: - case 239 /* JsxSpreadAttribute */: - return getContextualTypeForJsxExpression(parent); + case 248 /* JsxExpression */: + return getContextualType(parent); + case 246 /* JsxAttribute */: + case 247 /* JsxSpreadAttribute */: + return getContextualTypeForJsxAttribute(parent); } return undefined; } @@ -20547,7 +23638,7 @@ var ts; } } function isFunctionExpressionOrArrowFunction(node) { - return node.kind === 173 /* FunctionExpression */ || node.kind === 174 /* ArrowFunction */; + return node.kind === 179 /* FunctionExpression */ || node.kind === 180 /* ArrowFunction */; } function getContextualSignatureForFunctionLikeDeclaration(node) { // Only function expressions, arrow functions, and object literal methods are contextually typed. @@ -20555,16 +23646,19 @@ var ts; ? getContextualSignature(node) : undefined; } + function getContextualTypeForFunctionLikeDeclaration(node) { + return ts.isObjectLiteralMethod(node) ? + getContextualTypeForObjectLiteralMethod(node) : + getApparentTypeOfContextualType(node); + } // Return the contextual signature for a given expression node. A contextual type provides a // contextual signature if it has a single call signature and if that call signature is non-generic. // If the contextual type is a union type, get the signature from each type possible and if they are // all identical ignoring their return type, the result is same signature but with return type as // union type of return types from these signatures function getContextualSignature(node) { - ts.Debug.assert(node.kind !== 143 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); - var type = ts.isObjectLiteralMethod(node) - ? getContextualTypeForObjectLiteralMethod(node) - : getApparentTypeOfContextualType(node); + ts.Debug.assert(node.kind !== 147 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + var type = getContextualTypeForFunctionLikeDeclaration(node); if (!type) { return undefined; } @@ -20573,15 +23667,15 @@ var ts; } var signatureList; var types = type.types; - for (var _i = 0, types_8 = types; _i < types_8.length; _i++) { - var current = types_8[_i]; + for (var _i = 0, types_9 = types; _i < types_9.length; _i++) { + var current = types_9[_i]; var signature = getNonGenericSignature(current); if (signature) { if (!signatureList) { // This signature will contribute to contextual union signature signatureList = [signature]; } - else if (!compareSignatures(signatureList[0], signature, /*partialMatch*/ false, /*ignoreReturnTypes*/ true, compareTypes)) { + else if (!compareSignaturesIdentical(signatureList[0], signature, /*partialMatch*/ false, /*ignoreThisTypes*/ true, /*ignoreReturnTypes*/ true, compareTypesIdentical)) { // Signatures aren't identical, do not use return undefined; } @@ -20619,22 +23713,6 @@ var ts; function isInferentialContext(mapper) { return mapper && mapper.context; } - // 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', '[{ p: a}] = xxx'. - function isAssignmentTarget(node) { - var parent = node.parent; - if (parent.kind === 181 /* BinaryExpression */ && parent.operatorToken.kind === 56 /* EqualsToken */ && parent.left === node) { - return true; - } - if (parent.kind === 245 /* PropertyAssignment */) { - return isAssignmentTarget(parent.parent); - } - if (parent.kind === 164 /* ArrayLiteralExpression */) { - return isAssignmentTarget(parent); - } - return false; - } function checkSpreadElementExpression(node, contextualMapper) { // It is usually not safe to call checkExpressionCached if we can be contextually typing. // You can tell that we are contextually typing because of the contextualMapper parameter. @@ -20646,17 +23724,17 @@ var ts; return checkIteratedTypeOrElementType(arrayOrIterableType, node.expression, /*allowStringInput*/ false); } function hasDefaultValue(node) { - return (node.kind === 163 /* BindingElement */ && !!node.initializer) || - (node.kind === 181 /* BinaryExpression */ && node.operatorToken.kind === 56 /* EqualsToken */); + return (node.kind === 169 /* BindingElement */ && !!node.initializer) || + (node.kind === 187 /* BinaryExpression */ && node.operatorToken.kind === 56 /* EqualsToken */); } function checkArrayLiteral(node, contextualMapper) { var elements = node.elements; var hasSpreadElement = false; var elementTypes = []; - var inDestructuringPattern = isAssignmentTarget(node); + var inDestructuringPattern = ts.isAssignmentTarget(node); for (var _i = 0, elements_1 = elements; _i < elements_1.length; _i++) { var e = elements_1[_i]; - if (inDestructuringPattern && e.kind === 185 /* SpreadElementExpression */) { + if (inDestructuringPattern && e.kind === 191 /* SpreadElementExpression */) { // Given the following situation: // var c: {}; // [...c] = ["", 0]; @@ -20680,7 +23758,7 @@ var ts; var type = checkExpression(e, contextualMapper); elementTypes.push(type); } - hasSpreadElement = hasSpreadElement || e.kind === 185 /* SpreadElementExpression */; + hasSpreadElement = hasSpreadElement || e.kind === 191 /* SpreadElementExpression */; } if (!hasSpreadElement) { // If array literal is actually a destructuring pattern, mark it as an implied type. We do this such @@ -20695,7 +23773,7 @@ var ts; var pattern = contextualType.pattern; // If array literal is contextually typed by a binding pattern or an assignment pattern, pad the resulting // tuple type with the corresponding binding or assignment element types to make the lengths equal. - if (pattern && (pattern.kind === 162 /* ArrayBindingPattern */ || pattern.kind === 164 /* ArrayLiteralExpression */)) { + if (pattern && (pattern.kind === 168 /* ArrayBindingPattern */ || pattern.kind === 170 /* ArrayLiteralExpression */)) { var patternElements = pattern.elements; for (var i = elementTypes.length; i < patternElements.length; i++) { var patternElement = patternElements[i]; @@ -20703,7 +23781,7 @@ var ts; elementTypes.push(contextualType.elementTypes[i]); } else { - if (patternElement.kind !== 187 /* OmittedExpression */) { + if (patternElement.kind !== 193 /* OmittedExpression */) { error(patternElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); } elementTypes.push(unknownType); @@ -20715,10 +23793,10 @@ var ts; } } } - return createArrayType(elementTypes.length ? getUnionType(elementTypes) : undefinedType); + return createArrayType(elementTypes.length ? getUnionType(elementTypes) : emptyArrayElementType); } function isNumericName(name) { - return name.kind === 136 /* ComputedPropertyName */ ? isNumericComputedName(name) : isNumericLiteralName(name.text); + return name.kind === 140 /* ComputedPropertyName */ ? isNumericComputedName(name) : isNumericLiteralName(name.text); } function isNumericComputedName(name) { // It seems odd to consider an expression of type Any to result in a numeric name, @@ -20726,7 +23804,7 @@ var ts; return isTypeAnyOrAllConstituentTypesHaveKind(checkComputedPropertyName(name), 132 /* NumberLike */); } function isTypeAnyOrAllConstituentTypesHaveKind(type, kind) { - return isTypeAny(type) || allConstituentTypesHaveKind(type, kind); + return isTypeAny(type) || isTypeOfKind(type, kind); } function isNumericLiteralName(name) { // The intent of numeric names is that @@ -20767,32 +23845,44 @@ var ts; } return links.resolvedType; } + function getObjectLiteralIndexInfo(node, properties, kind) { + var propTypes = []; + for (var i = 0; i < properties.length; i++) { + if (kind === 0 /* String */ || isNumericName(node.properties[i].name)) { + propTypes.push(getTypeOfSymbol(properties[i])); + } + } + var unionType = propTypes.length ? getUnionType(propTypes) : undefinedType; + return createIndexInfo(unionType, /*isReadonly*/ false); + } function checkObjectLiteral(node, contextualMapper) { - var inDestructuringPattern = isAssignmentTarget(node); + var inDestructuringPattern = ts.isAssignmentTarget(node); // Grammar checking checkGrammarObjectLiteralExpression(node, inDestructuringPattern); var propertiesTable = {}; var propertiesArray = []; var contextualType = getApparentTypeOfContextualType(node); var contextualTypeHasPattern = contextualType && contextualType.pattern && - (contextualType.pattern.kind === 161 /* ObjectBindingPattern */ || contextualType.pattern.kind === 165 /* ObjectLiteralExpression */); + (contextualType.pattern.kind === 167 /* ObjectBindingPattern */ || contextualType.pattern.kind === 171 /* ObjectLiteralExpression */); var typeFlags = 0; var patternWithComputedProperties = false; + var hasComputedStringProperty = false; + var hasComputedNumberProperty = false; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var memberDecl = _a[_i]; var member = memberDecl.symbol; - if (memberDecl.kind === 245 /* PropertyAssignment */ || - memberDecl.kind === 246 /* ShorthandPropertyAssignment */ || + if (memberDecl.kind === 253 /* PropertyAssignment */ || + memberDecl.kind === 254 /* ShorthandPropertyAssignment */ || ts.isObjectLiteralMethod(memberDecl)) { var type = void 0; - if (memberDecl.kind === 245 /* PropertyAssignment */) { + if (memberDecl.kind === 253 /* PropertyAssignment */) { type = checkPropertyAssignment(memberDecl, contextualMapper); } - else if (memberDecl.kind === 143 /* MethodDeclaration */) { + else if (memberDecl.kind === 147 /* MethodDeclaration */) { type = checkObjectLiteralMethod(memberDecl, contextualMapper); } else { - ts.Debug.assert(memberDecl.kind === 246 /* ShorthandPropertyAssignment */); + ts.Debug.assert(memberDecl.kind === 254 /* ShorthandPropertyAssignment */); type = checkExpression(memberDecl.name, contextualMapper); } typeFlags |= type.flags; @@ -20800,8 +23890,8 @@ var ts; if (inDestructuringPattern) { // If object literal is an assignment pattern and if the assignment pattern specifies a default value // for the property, make the property optional. - var isOptional = (memberDecl.kind === 245 /* PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) || - (memberDecl.kind === 246 /* ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer); + var isOptional = (memberDecl.kind === 253 /* PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) || + (memberDecl.kind === 254 /* ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer); if (isOptional) { prop.flags |= 536870912 /* Optional */; } @@ -20835,10 +23925,18 @@ var ts; // an ordinary function declaration(section 6.1) with no parameters. // A set accessor declaration is processed in the same manner // as an ordinary function declaration with a single parameter and a Void return type. - ts.Debug.assert(memberDecl.kind === 145 /* GetAccessor */ || memberDecl.kind === 146 /* SetAccessor */); + ts.Debug.assert(memberDecl.kind === 149 /* GetAccessor */ || memberDecl.kind === 150 /* SetAccessor */); checkAccessorDeclaration(memberDecl); } - if (!ts.hasDynamicName(memberDecl)) { + if (ts.hasDynamicName(memberDecl)) { + if (isNumericName(memberDecl.name)) { + hasComputedNumberProperty = true; + } + else { + hasComputedStringProperty = true; + } + } + else { propertiesTable[member.name] = member; } propertiesArray.push(member); @@ -20857,74 +23955,41 @@ var ts; } } } - var stringIndexType = getIndexType(0 /* String */); - var numberIndexType = getIndexType(1 /* Number */); - var result = createAnonymousType(node.symbol, propertiesTable, emptyArray, emptyArray, stringIndexType, numberIndexType); + var stringIndexInfo = hasComputedStringProperty ? getObjectLiteralIndexInfo(node, propertiesArray, 0 /* String */) : undefined; + var numberIndexInfo = hasComputedNumberProperty ? getObjectLiteralIndexInfo(node, propertiesArray, 1 /* Number */) : undefined; + var result = createAnonymousType(node.symbol, propertiesTable, emptyArray, emptyArray, stringIndexInfo, numberIndexInfo); var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 1048576 /* FreshObjectLiteral */; result.flags |= 524288 /* ObjectLiteral */ | 4194304 /* ContainsObjectLiteral */ | freshObjectLiteralFlag | (typeFlags & 14680064 /* PropagatingFlags */) | (patternWithComputedProperties ? 67108864 /* ObjectLiteralPatternWithComputedProperties */ : 0); if (inDestructuringPattern) { result.pattern = node; } return result; - function getIndexType(kind) { - if (contextualType && contextualTypeHasIndexSignature(contextualType, kind)) { - var propTypes = []; - for (var i = 0; i < propertiesArray.length; i++) { - var propertyDecl = node.properties[i]; - if (kind === 0 /* String */ || isNumericName(propertyDecl.name)) { - // Do not call getSymbolOfNode(propertyDecl), as that will get the - // original symbol for the node. We actually want to get the symbol - // created by checkObjectLiteral, since that will be appropriately - // contextually typed and resolved. - var type = getTypeOfSymbol(propertiesArray[i]); - if (!ts.contains(propTypes, type)) { - propTypes.push(type); - } - } - } - var result_1 = propTypes.length ? getUnionType(propTypes) : undefinedType; - typeFlags |= result_1.flags; - return result_1; - } - return undefined; - } } function checkJsxSelfClosingElement(node) { checkJsxOpeningLikeElement(node); return jsxElementType || anyType; } - function tagNamesAreEquivalent(lhs, rhs) { - if (lhs.kind !== rhs.kind) { - return false; - } - if (lhs.kind === 69 /* Identifier */) { - return lhs.text === rhs.text; - } - return lhs.right.text === rhs.right.text && - tagNamesAreEquivalent(lhs.left, rhs.left); - } function checkJsxElement(node) { // Check attributes checkJsxOpeningLikeElement(node.openingElement); - // Check that the closing tag matches - if (!tagNamesAreEquivalent(node.openingElement.tagName, node.closingElement.tagName)) { - error(node.closingElement, ts.Diagnostics.Expected_corresponding_JSX_closing_tag_for_0, ts.getTextOfNode(node.openingElement.tagName)); + // Perform resolution on the closing tag so that rename/go to definition/etc work + if (isJsxIntrinsicIdentifier(node.closingElement.tagName)) { + getIntrinsicTagSymbol(node.closingElement); } else { - // Perform resolution on the closing tag so that rename/go to definition/etc work - getJsxElementTagSymbol(node.closingElement); + checkExpression(node.closingElement.tagName); } // Check children for (var _i = 0, _a = node.children; _i < _a.length; _i++) { var child = _a[_i]; switch (child.kind) { - case 240 /* JsxExpression */: + case 248 /* JsxExpression */: checkJsxExpression(child); break; - case 233 /* JsxElement */: + case 241 /* JsxElement */: checkJsxElement(child); break; - case 234 /* JsxSelfClosingElement */: + case 242 /* JsxSelfClosingElement */: checkJsxSelfClosingElement(child); break; } @@ -20942,7 +24007,7 @@ var ts; * Returns true iff React would emit this tag name as a string rather than an identifier or qualified name */ function isJsxIntrinsicIdentifier(tagName) { - if (tagName.kind === 135 /* QualifiedName */) { + if (tagName.kind === 139 /* QualifiedName */) { return false; } else { @@ -21006,98 +24071,60 @@ var ts; } return type; } - /// Returns the type JSX.IntrinsicElements. May return `unknownType` if that type is not present. - function getJsxIntrinsicElementsType() { - if (!jsxIntrinsicElementsType) { - jsxIntrinsicElementsType = getExportedTypeFromNamespace(JsxNames.JSX, JsxNames.IntrinsicElements) || unknownType; + function getJsxType(name) { + if (jsxTypes[name] === undefined) { + return jsxTypes[name] = getExportedTypeFromNamespace(JsxNames.JSX, name) || unknownType; } - return jsxIntrinsicElementsType; + return jsxTypes[name]; } - /// Given a JSX opening element or self-closing element, return the symbol of the property that the tag name points to if - /// this is an intrinsic tag. This might be a named - /// property of the IntrinsicElements interface, or its string indexer. - /// If this is a class-based tag (otherwise returns undefined), returns the symbol of the class - /// type or factory function. - /// Otherwise, returns unknownSymbol. - function getJsxElementTagSymbol(node) { - var flags = 8 /* UnknownElement */; + /** + * Looks up an intrinsic tag name and returns a symbol that either points to an intrinsic + * property (in which case nodeLinks.jsxFlags will be IntrinsicNamedElement) or an intrinsic + * string index signature (in which case nodeLinks.jsxFlags will be IntrinsicIndexedElement). + * May also return unknownSymbol if both of these lookups fail. + */ + function getIntrinsicTagSymbol(node) { var links = getNodeLinks(node); if (!links.resolvedSymbol) { - if (isJsxIntrinsicIdentifier(node.tagName)) { - links.resolvedSymbol = lookupIntrinsicTag(node); - } - else { - links.resolvedSymbol = lookupClassTag(node); - } - } - return links.resolvedSymbol; - function lookupIntrinsicTag(node) { - var intrinsicElementsType = getJsxIntrinsicElementsType(); + var intrinsicElementsType = getJsxType(JsxNames.IntrinsicElements); if (intrinsicElementsType !== unknownType) { // Property case var intrinsicProp = getPropertyOfType(intrinsicElementsType, node.tagName.text); if (intrinsicProp) { links.jsxFlags |= 1 /* IntrinsicNamedElement */; - return intrinsicProp; + return links.resolvedSymbol = intrinsicProp; } // Intrinsic string indexer case var indexSignatureType = getIndexTypeOfType(intrinsicElementsType, 0 /* String */); if (indexSignatureType) { links.jsxFlags |= 2 /* IntrinsicIndexedElement */; - return intrinsicElementsType.symbol; + return links.resolvedSymbol = intrinsicElementsType.symbol; } // Wasn't found error(node, ts.Diagnostics.Property_0_does_not_exist_on_type_1, node.tagName.text, "JSX." + JsxNames.IntrinsicElements); - return unknownSymbol; + return links.resolvedSymbol = unknownSymbol; } else { if (compilerOptions.noImplicitAny) { error(node, ts.Diagnostics.JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists, JsxNames.IntrinsicElements); } + return links.resolvedSymbol = unknownSymbol; } } - function lookupClassTag(node) { - var valueSymbol = resolveJsxTagName(node); - // Look up the value in the current scope - if (valueSymbol && valueSymbol !== unknownSymbol) { - links.jsxFlags |= 4 /* ClassElement */; - if (valueSymbol.flags & 8388608 /* Alias */) { - markAliasSymbolAsReferenced(valueSymbol); - } - } - return valueSymbol || unknownSymbol; - } - function resolveJsxTagName(node) { - if (node.tagName.kind === 69 /* Identifier */) { - var tag = node.tagName; - var sym = getResolvedSymbol(tag); - return sym.exportSymbol || sym; - } - else { - return checkQualifiedName(node.tagName).symbol; - } - } + return links.resolvedSymbol; } /** * Given a JSX element that is a class element, finds the Element Instance Type. If the * element is not a class element, or the class element type cannot be determined, returns 'undefined'. * For example, in the element , the element instance type is `MyClass` (not `typeof MyClass`). */ - function getJsxElementInstanceType(node) { - // There is no such thing as an instance type for a non-class element. This - // line shouldn't be hit. - ts.Debug.assert(!!(getNodeLinks(node).jsxFlags & 4 /* ClassElement */), "Should not call getJsxElementInstanceType on non-class Element"); - var classSymbol = getJsxElementTagSymbol(node); - if (classSymbol === unknownSymbol) { - // Couldn't find the class instance type. Error has already been issued - return anyType; - } - var valueType = getTypeOfSymbol(classSymbol); + function getJsxElementInstanceType(node, valueType) { + ts.Debug.assert(!(valueType.flags & 16384 /* Union */)); if (isTypeAny(valueType)) { // Short-circuit if the class tag is using an element type 'any' return anyType; } - // Resolve the signatures, preferring constructors + // Resolve the signatures, preferring constructor var signatures = getSignaturesOfType(valueType, 1 /* Construct */); if (signatures.length === 0) { // No construct signatures, try call signatures @@ -21108,19 +24135,13 @@ var ts; return unknownType; } } - var returnType = getUnionType(signatures.map(getReturnTypeOfSignature)); - // Issue an error if this return type isn't assignable to JSX.ElementClass - var elemClassType = getJsxGlobalElementClassType(); - if (elemClassType) { - checkTypeRelatedTo(returnType, elemClassType, assignableRelation, node, ts.Diagnostics.JSX_element_type_0_is_not_a_constructor_function_for_JSX_elements); - } - return returnType; + return getUnionType(signatures.map(getReturnTypeOfSignature)); } /// e.g. "props" for React.d.ts, - /// or 'undefined' if ElementAttributesPropery doesn't exist (which means all + /// or 'undefined' if ElementAttributesProperty doesn't exist (which means all /// non-intrinsic elements' attributes type is 'any'), /// or '' if it has 0 properties (which means every - /// non-instrinsic elements' attributes type is the element instance type) + /// non-intrinsic elements' attributes type is the element instance type) function getJsxElementPropertiesName() { // JSX var jsxNamespace = getGlobalSymbol(JsxNames.JSX, 1536 /* Namespace */, /*diagnosticMessage*/ undefined); @@ -21128,7 +24149,7 @@ var ts; var attribsPropTypeSym = jsxNamespace && getSymbol(jsxNamespace.exports, JsxNames.ElementAttributesPropertyNameContainer, 793056 /* Type */); // JSX.ElementAttributesProperty [type] var attribPropType = attribsPropTypeSym && getDeclaredTypeOfSymbol(attribsPropTypeSym); - // The properites of JSX.ElementAttributesProperty + // The properties of JSX.ElementAttributesProperty var attribProperties = attribPropType && getPropertiesOfType(attribPropType); if (attribProperties) { // Element Attributes has zero properties, so the element attributes type will be the class instance type @@ -21148,6 +24169,94 @@ var ts; return undefined; } } + /** + * Given React element instance type and the class type, resolve the Jsx type + * Pass elemType to handle individual type in the union typed element type. + */ + function getResolvedJsxType(node, elemType, elemClassType) { + if (!elemType) { + elemType = checkExpression(node.tagName); + } + if (elemType.flags & 16384 /* Union */) { + var types = elemType.types; + return getUnionType(types.map(function (type) { + return getResolvedJsxType(node, type, elemClassType); + })); + } + // Get the element instance type (the result of newing or invoking this tag) + var elemInstanceType = getJsxElementInstanceType(node, elemType); + if (!elemClassType || !isTypeAssignableTo(elemInstanceType, elemClassType)) { + // Is this is a stateless function component? See if its single signature's return type is + // assignable to the JSX Element Type + if (jsxElementType) { + var callSignatures = elemType && getSignaturesOfType(elemType, 0 /* Call */); + var callSignature = callSignatures && callSignatures.length > 0 && callSignatures[0]; + var callReturnType = callSignature && getReturnTypeOfSignature(callSignature); + var paramType = callReturnType && (callSignature.parameters.length === 0 ? emptyObjectType : getTypeOfSymbol(callSignature.parameters[0])); + if (callReturnType && isTypeAssignableTo(callReturnType, jsxElementType)) { + // Intersect in JSX.IntrinsicAttributes if it exists + var intrinsicAttributes = getJsxType(JsxNames.IntrinsicAttributes); + if (intrinsicAttributes !== unknownType) { + paramType = intersectTypes(intrinsicAttributes, paramType); + } + return paramType; + } + } + } + // Issue an error if this return type isn't assignable to JSX.ElementClass + if (elemClassType) { + checkTypeRelatedTo(elemInstanceType, elemClassType, assignableRelation, node, ts.Diagnostics.JSX_element_type_0_is_not_a_constructor_function_for_JSX_elements); + } + if (isTypeAny(elemInstanceType)) { + return elemInstanceType; + } + var propsName = getJsxElementPropertiesName(); + if (propsName === undefined) { + // There is no type ElementAttributesProperty, return 'any' + return anyType; + } + else if (propsName === "") { + // If there is no e.g. 'props' member in ElementAttributesProperty, use the element class type instead + return elemInstanceType; + } + else { + var attributesType = getTypeOfPropertyOfType(elemInstanceType, propsName); + if (!attributesType) { + // There is no property named 'props' on this instance type + return emptyObjectType; + } + else if (isTypeAny(attributesType) || (attributesType === unknownType)) { + // Props is of type 'any' or unknown + return attributesType; + } + else if (attributesType.flags & 16384 /* Union */) { + // Props cannot be a union type + error(node.tagName, ts.Diagnostics.JSX_element_attributes_type_0_may_not_be_a_union_type, typeToString(attributesType)); + return anyType; + } + else { + // Normal case -- add in IntrinsicClassElements and IntrinsicElements + var apparentAttributesType = attributesType; + var intrinsicClassAttribs = getJsxType(JsxNames.IntrinsicClassAttributes); + if (intrinsicClassAttribs !== unknownType) { + var typeParams = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(intrinsicClassAttribs.symbol); + if (typeParams) { + if (typeParams.length === 1) { + apparentAttributesType = intersectTypes(createTypeReference(intrinsicClassAttribs, [elemInstanceType]), apparentAttributesType); + } + } + else { + apparentAttributesType = intersectTypes(attributesType, intrinsicClassAttribs); + } + } + var intrinsicAttribs = getJsxType(JsxNames.IntrinsicAttributes); + if (intrinsicAttribs !== unknownType) { + apparentAttributesType = intersectTypes(intrinsicAttribs, apparentAttributesType); + } + return apparentAttributesType; + } + } + } /** * Given an opening/self-closing element, get the 'element attributes type', i.e. the type that tells * us which attributes are valid on a given element. @@ -21155,48 +24264,21 @@ var ts; function getJsxElementAttributesType(node) { var links = getNodeLinks(node); if (!links.resolvedJsxType) { - var sym = getJsxElementTagSymbol(node); - if (links.jsxFlags & 4 /* ClassElement */) { - var elemInstanceType = getJsxElementInstanceType(node); - if (isTypeAny(elemInstanceType)) { - return links.resolvedJsxType = elemInstanceType; + if (isJsxIntrinsicIdentifier(node.tagName)) { + var symbol = getIntrinsicTagSymbol(node); + if (links.jsxFlags & 1 /* IntrinsicNamedElement */) { + return links.resolvedJsxType = getTypeOfSymbol(symbol); } - var propsName = getJsxElementPropertiesName(); - if (propsName === undefined) { - // There is no type ElementAttributesProperty, return 'any' - return links.resolvedJsxType = anyType; - } - else if (propsName === "") { - // If there is no e.g. 'props' member in ElementAttributesProperty, use the element class type instead - return links.resolvedJsxType = elemInstanceType; + else if (links.jsxFlags & 2 /* IntrinsicIndexedElement */) { + return links.resolvedJsxType = getIndexInfoOfSymbol(symbol, 0 /* String */).type; } else { - var attributesType = getTypeOfPropertyOfType(elemInstanceType, propsName); - if (!attributesType) { - // There is no property named 'props' on this instance type - return links.resolvedJsxType = emptyObjectType; - } - else if (isTypeAny(attributesType) || (attributesType === unknownType)) { - return links.resolvedJsxType = attributesType; - } - else if (!(attributesType.flags & 80896 /* ObjectType */)) { - error(node.tagName, ts.Diagnostics.JSX_element_attributes_type_0_must_be_an_object_type, typeToString(attributesType)); - return links.resolvedJsxType = anyType; - } - else { - return links.resolvedJsxType = attributesType; - } + return links.resolvedJsxType = unknownType; } } - else if (links.jsxFlags & 1 /* IntrinsicNamedElement */) { - return links.resolvedJsxType = getTypeOfSymbol(sym); - } - else if (links.jsxFlags & 2 /* IntrinsicIndexedElement */) { - return links.resolvedJsxType = getIndexTypeOfSymbol(sym, 0 /* String */); - } else { - // Resolution failed, so we don't know - return links.resolvedJsxType = anyType; + var elemClassType = getJsxGlobalElementClassType(); + return links.resolvedJsxType = getResolvedJsxType(node, undefined, elemClassType); } } return links.resolvedJsxType; @@ -21219,7 +24301,7 @@ var ts; } /// Returns all the properties of the Jsx.IntrinsicElements interface function getJsxIntrinsicTagNames() { - var intrinsics = getJsxIntrinsicElementsType(); + var intrinsics = getJsxType(JsxNames.IntrinsicElements); return intrinsics ? getPropertiesOfType(intrinsics) : emptyArray; } function checkJsxPreconditions(errorNode) { @@ -21236,14 +24318,13 @@ var ts; function checkJsxOpeningLikeElement(node) { checkGrammarJsxElement(node); checkJsxPreconditions(node); - // If we're compiling under --jsx react, the symbol 'React' should - // be marked as 'used' so we don't incorrectly elide its import. And if there - // is no 'React' symbol in scope, we should issue an error. - if (compilerOptions.jsx === 2 /* React */) { - var reactSym = resolveName(node.tagName, "React", 107455 /* Value */, ts.Diagnostics.Cannot_find_name_0, "React"); - if (reactSym) { - getSymbolLinks(reactSym).referenced = true; - } + // The reactNamespace symbol should be marked as 'used' so we don't incorrectly elide its import. And if there + // is no reactNamespace symbol in scope when targeting React emit, we should issue an error. + var reactRefErr = compilerOptions.jsx === 2 /* React */ ? ts.Diagnostics.Cannot_find_name_0 : undefined; + var reactNamespace = compilerOptions.reactNamespace ? compilerOptions.reactNamespace : "React"; + var reactSym = resolveName(node.tagName, reactNamespace, 107455 /* Value */, reactRefErr, reactNamespace); + if (reactSym) { + getSymbolLinks(reactSym).referenced = true; } var targetAttributesType = getJsxElementAttributesType(node); var nameTable = {}; @@ -21252,11 +24333,11 @@ var ts; // thus should have their types ignored var sawSpreadedAny = false; for (var i = node.attributes.length - 1; i >= 0; i--) { - if (node.attributes[i].kind === 238 /* JsxAttribute */) { + if (node.attributes[i].kind === 246 /* JsxAttribute */) { checkJsxAttribute((node.attributes[i]), targetAttributesType, nameTable); } else { - ts.Debug.assert(node.attributes[i].kind === 239 /* JsxSpreadAttribute */); + ts.Debug.assert(node.attributes[i].kind === 247 /* JsxSpreadAttribute */); var spreadType = checkJsxSpreadAttribute((node.attributes[i]), targetAttributesType, nameTable); if (isTypeAny(spreadType)) { sawSpreadedAny = true; @@ -21286,10 +24367,10 @@ var ts; // If a symbol is a synthesized symbol with no value declaration, we assume it is a property. Example of this are the synthesized // '.prototype' property as well as synthesized tuple index properties. function getDeclarationKindFromSymbol(s) { - return s.valueDeclaration ? s.valueDeclaration.kind : 141 /* PropertyDeclaration */; + return s.valueDeclaration ? s.valueDeclaration.kind : 145 /* PropertyDeclaration */; } function getDeclarationFlagsFromSymbol(s) { - return s.valueDeclaration ? ts.getCombinedNodeFlags(s.valueDeclaration) : s.flags & 134217728 /* Prototype */ ? 8 /* Public */ | 64 /* Static */ : 0; + return s.valueDeclaration ? ts.getCombinedNodeFlags(s.valueDeclaration) : s.flags & 134217728 /* Prototype */ ? 4 /* Public */ | 32 /* Static */ : 0; } /** * Check whether the requested property access is valid. @@ -21301,11 +24382,11 @@ var ts; */ function checkClassPropertyAccess(node, left, type, prop) { var flags = getDeclarationFlagsFromSymbol(prop); - var declaringClass = getDeclaredTypeOfSymbol(prop.parent); + var declaringClass = getDeclaredTypeOfSymbol(getParentOfSymbol(prop)); + var errorNode = node.kind === 172 /* PropertyAccessExpression */ || node.kind === 218 /* VariableDeclaration */ ? + node.name : + node.right; if (left.kind === 95 /* SuperKeyword */) { - var errorNode = node.kind === 166 /* PropertyAccessExpression */ ? - node.name : - node.right; // TS 1.0 spec (April 2014): 4.8.2 // - In a constructor, instance member function, instance member accessor, or // instance member variable initializer where this references a derived class instance, @@ -21313,7 +24394,7 @@ var ts; // - In a static member function or static member accessor // where this references the constructor function object of a derived class, // a super property access is permitted and must specify a public static member function of the base class. - if (getDeclarationKindFromSymbol(prop) !== 143 /* MethodDeclaration */) { + if (languageVersion < 2 /* ES6 */ && getDeclarationKindFromSymbol(prop) !== 147 /* MethodDeclaration */) { // `prop` refers to a *property* declared in the super class // rather than a *method*, so it does not satisfy the above criteria. error(errorNode, ts.Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword); @@ -21329,17 +24410,15 @@ var ts; } } // Public properties are otherwise accessible. - if (!(flags & (16 /* Private */ | 32 /* Protected */))) { + if (!(flags & (8 /* Private */ | 16 /* Protected */))) { return true; } // Property is known to be private or protected at this point - // Get the declaring and enclosing class instance types - var enclosingClassDeclaration = ts.getContainingClass(node); - var enclosingClass = enclosingClassDeclaration ? getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingClassDeclaration)) : undefined; - // Private property is accessible if declaring and enclosing class are the same - if (flags & 16 /* Private */) { - if (declaringClass !== enclosingClass) { - error(node, ts.Diagnostics.Property_0_is_private_and_only_accessible_within_class_1, symbolToString(prop), typeToString(declaringClass)); + // Private property is accessible if the property is within the declaring class + if (flags & 8 /* Private */) { + var declaringClassDeclaration = getClassLikeDeclarationOfSymbol(getParentOfSymbol(prop)); + if (!isNodeWithinClass(node, declaringClassDeclaration)) { + error(errorNode, ts.Diagnostics.Property_0_is_private_and_only_accessible_within_class_1, symbolToString(prop), typeToString(declaringClass)); return false; } return true; @@ -21349,13 +24428,18 @@ var ts; if (left.kind === 95 /* SuperKeyword */) { return true; } - // A protected property is accessible in the declaring class and classes derived from it - if (!enclosingClass || !hasBaseType(enclosingClass, declaringClass)) { - error(node, ts.Diagnostics.Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses, symbolToString(prop), typeToString(declaringClass)); + // Get the enclosing class that has the declaring class as its base type + var enclosingClass = forEachEnclosingClass(node, function (enclosingDeclaration) { + var enclosingClass = getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingDeclaration)); + return hasBaseType(enclosingClass, declaringClass) ? enclosingClass : undefined; + }); + // A protected property is accessible if the property is within the declaring class or classes derived from it + if (!enclosingClass) { + error(errorNode, ts.Diagnostics.Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses, symbolToString(prop), typeToString(declaringClass)); return false; } // No further restrictions for static properties - if (flags & 64 /* Static */) { + if (flags & 32 /* Static */) { return true; } // An instance property must be accessed through an instance of the enclosing class @@ -21365,11 +24449,25 @@ var ts; } // TODO: why is the first part of this check here? if (!(getTargetType(type).flags & (1024 /* Class */ | 2048 /* Interface */) && hasBaseType(type, enclosingClass))) { - error(node, ts.Diagnostics.Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1, symbolToString(prop), typeToString(enclosingClass)); + error(errorNode, ts.Diagnostics.Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1, symbolToString(prop), typeToString(enclosingClass)); return false; } return true; } + function checkNonNullExpression(node) { + var type = checkExpression(node); + if (strictNullChecks) { + var kind = getNullableKind(type); + if (kind) { + error(node, kind & 32 /* Undefined */ ? kind & 64 /* Null */ ? + ts.Diagnostics.Object_is_possibly_null_or_undefined : + ts.Diagnostics.Object_is_possibly_undefined : + ts.Diagnostics.Object_is_possibly_null); + } + return getNonNullableType(type); + } + return type; + } function checkPropertyAccessExpression(node) { return checkPropertyAccessExpressionOrQualifiedName(node, node.expression, node.name); } @@ -21377,7 +24475,7 @@ var ts; return checkPropertyAccessExpressionOrQualifiedName(node, node.left, node.right); } function checkPropertyAccessExpressionOrQualifiedName(node, left, right) { - var type = checkExpression(left); + var type = checkNonNullExpression(left); if (isTypeAny(type)) { return type; } @@ -21397,10 +24495,29 @@ var ts; if (prop.parent && prop.parent.flags & 32 /* Class */) { checkClassPropertyAccess(node, left, apparentType, prop); } - return getTypeOfSymbol(prop); + var propType = getTypeOfSymbol(prop); + if (node.kind !== 172 /* PropertyAccessExpression */ || ts.isAssignmentTarget(node) || + !(propType.flags & 16384 /* Union */) && !(prop.flags & (3 /* Variable */ | 4 /* Property */ | 98304 /* Accessor */))) { + return propType; + } + var leftmostNode = getLeftmostIdentifierOrThis(node); + if (!leftmostNode) { + return propType; + } + if (leftmostNode.kind === 69 /* Identifier */) { + var leftmostSymbol = getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(leftmostNode)); + if (!leftmostSymbol) { + return propType; + } + var declaration = leftmostSymbol.valueDeclaration; + if (!declaration || declaration.kind !== 218 /* VariableDeclaration */ && declaration.kind !== 142 /* Parameter */ && declaration.kind !== 169 /* BindingElement */) { + return propType; + } + } + return getFlowTypeOfReference(node, propType, /*assumeInitialized*/ true); } function isValidPropertyAccess(node, propertyName) { - var left = node.kind === 166 /* PropertyAccessExpression */ + var left = node.kind === 172 /* PropertyAccessExpression */ ? node.expression : node.left; var type = checkExpression(left); @@ -21412,11 +24529,58 @@ var ts; } return true; } + /** + * Return the symbol of the for-in variable declared or referenced by the given for-in statement. + */ + function getForInVariableSymbol(node) { + var initializer = node.initializer; + if (initializer.kind === 219 /* VariableDeclarationList */) { + var variable = initializer.declarations[0]; + if (variable && !ts.isBindingPattern(variable.name)) { + return getSymbolOfNode(variable); + } + } + else if (initializer.kind === 69 /* Identifier */) { + return getResolvedSymbol(initializer); + } + return undefined; + } + /** + * Return true if the given type is considered to have numeric property names. + */ + function hasNumericPropertyNames(type) { + return getIndexTypeOfType(type, 1 /* Number */) && !getIndexTypeOfType(type, 0 /* String */); + } + /** + * Return true if given node is an expression consisting of an identifier (possibly parenthesized) + * that references a for-in variable for an object with numeric property names. + */ + function isForInVariableForNumericPropertyNames(expr) { + var e = skipParenthesizedNodes(expr); + if (e.kind === 69 /* Identifier */) { + var symbol = getResolvedSymbol(e); + if (symbol.flags & 3 /* Variable */) { + var child = expr; + var node = expr.parent; + while (node) { + if (node.kind === 207 /* ForInStatement */ && + child === node.statement && + getForInVariableSymbol(node) === symbol && + hasNumericPropertyNames(checkExpression(node.expression))) { + return true; + } + child = node; + node = node.parent; + } + } + } + return false; + } function checkIndexedAccess(node) { // Grammar checking if (!node.argumentExpression) { - var sourceFile = getSourceFile(node); - if (node.parent.kind === 169 /* NewExpression */ && node.parent.expression === node) { + var sourceFile = ts.getSourceFileOfNode(node); + if (node.parent.kind === 175 /* NewExpression */ && node.parent.expression === node) { var start = ts.skipTrivia(sourceFile.text, node.expression.end); var end = node.end; grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead); @@ -21428,7 +24592,7 @@ var ts; } } // Obtain base constraint such that we can bail out if the constraint is an unknown type - var objectType = getApparentType(checkExpression(node.expression)); + var objectType = getApparentType(checkNonNullExpression(node.expression)); var indexType = node.argumentExpression ? checkExpression(node.argumentExpression) : unknownType; if (objectType === unknownType) { return unknownType; @@ -21449,15 +24613,15 @@ var ts; // - Otherwise, if IndexExpr is of type Any, the String or Number primitive type, or an enum type, the property access is of type Any. // See if we can index as a property. if (node.argumentExpression) { - var name_11 = getPropertyNameForIndexedAccess(node.argumentExpression, indexType); - if (name_11 !== undefined) { - var prop = getPropertyOfType(objectType, name_11); + var name_12 = getPropertyNameForIndexedAccess(node.argumentExpression, indexType); + if (name_12 !== undefined) { + var prop = getPropertyOfType(objectType, name_12); if (prop) { getNodeLinks(node).resolvedSymbol = prop; return getTypeOfSymbol(prop); } else if (isConstEnum) { - error(node.argumentExpression, ts.Diagnostics.Property_0_does_not_exist_on_const_enum_1, name_11, symbolToString(objectType.symbol)); + error(node.argumentExpression, ts.Diagnostics.Property_0_does_not_exist_on_const_enum_1, name_12, symbolToString(objectType.symbol)); return unknownType; } } @@ -21465,20 +24629,24 @@ var ts; // Check for compatible indexer types. if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, 258 /* StringLike */ | 132 /* NumberLike */ | 16777216 /* ESSymbol */)) { // Try to use a number indexer. - if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, 132 /* NumberLike */)) { - var numberIndexType = getIndexTypeOfType(objectType, 1 /* Number */); - if (numberIndexType) { - return numberIndexType; + if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, 132 /* NumberLike */) || isForInVariableForNumericPropertyNames(node.argumentExpression)) { + var numberIndexInfo = getIndexInfoOfType(objectType, 1 /* Number */); + if (numberIndexInfo) { + getNodeLinks(node).resolvedIndexInfo = numberIndexInfo; + return numberIndexInfo.type; } } // Try to use string indexing. - var stringIndexType = getIndexTypeOfType(objectType, 0 /* String */); - if (stringIndexType) { - return stringIndexType; + var stringIndexInfo = getIndexInfoOfType(objectType, 0 /* String */); + if (stringIndexInfo) { + getNodeLinks(node).resolvedIndexInfo = stringIndexInfo; + return stringIndexInfo.type; } // Fall back to any. if (compilerOptions.noImplicitAny && !compilerOptions.suppressImplicitAnyIndexErrors && !isTypeAny(objectType)) { - error(node, ts.Diagnostics.Index_signature_of_object_type_implicitly_has_an_any_type); + error(node, getIndexTypeOfType(objectType, 1 /* Number */) ? + ts.Diagnostics.Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number : + ts.Diagnostics.Index_signature_of_object_type_implicitly_has_an_any_type); } return anyType; } @@ -21497,7 +24665,7 @@ var ts; if (indexArgumentExpression.kind === 9 /* StringLiteral */ || indexArgumentExpression.kind === 8 /* NumericLiteral */) { return indexArgumentExpression.text; } - if (indexArgumentExpression.kind === 167 /* ElementAccessExpression */ || indexArgumentExpression.kind === 166 /* PropertyAccessExpression */) { + if (indexArgumentExpression.kind === 173 /* ElementAccessExpression */ || indexArgumentExpression.kind === 172 /* PropertyAccessExpression */) { var value = getConstantValue(indexArgumentExpression); if (value !== undefined) { return value.toString(); @@ -21552,10 +24720,10 @@ var ts; return true; } function resolveUntypedCall(node) { - if (node.kind === 170 /* TaggedTemplateExpression */) { + if (node.kind === 176 /* TaggedTemplateExpression */) { checkExpression(node.template); } - else if (node.kind !== 139 /* Decorator */) { + else if (node.kind !== 143 /* Decorator */) { ts.forEach(node.arguments, function (argument) { checkExpression(argument); }); @@ -21585,13 +24753,13 @@ var ts; for (var _i = 0, signatures_2 = signatures; _i < signatures_2.length; _i++) { var signature = signatures_2[_i]; var symbol = signature.declaration && getSymbolOfNode(signature.declaration); - var parent_5 = signature.declaration && signature.declaration.parent; + var parent_9 = signature.declaration && signature.declaration.parent; if (!lastSymbol || symbol === lastSymbol) { - if (lastParent && parent_5 === lastParent) { + if (lastParent && parent_9 === lastParent) { index++; } else { - lastParent = parent_5; + lastParent = parent_9; index = cutoffIndex; } } @@ -21599,7 +24767,7 @@ var ts; // current declaration belongs to a different symbol // set cutoffIndex so re-orderings in the future won't change result set from 0 to cutoffIndex index = cutoffIndex = result.length; - lastParent = parent_5; + lastParent = parent_9; } lastSymbol = symbol; // specialized signatures always need to be placed before non-specialized signatures regardless @@ -21621,7 +24789,7 @@ var ts; function getSpreadArgumentIndex(args) { for (var i = 0; i < args.length; i++) { var arg = args[i]; - if (arg && arg.kind === 185 /* SpreadElementExpression */) { + if (arg && arg.kind === 191 /* SpreadElementExpression */) { return i; } } @@ -21633,13 +24801,13 @@ var ts; var callIsIncomplete; // In incomplete call we want to be lenient when we have too few arguments var isDecorator; var spreadArgIndex = -1; - if (node.kind === 170 /* TaggedTemplateExpression */) { + if (node.kind === 176 /* TaggedTemplateExpression */) { var tagExpression = node; // Even if the call is incomplete, we'll have a missing expression as our last argument, // so we can say the count is just the arg list length adjustedArgCount = args.length; typeArguments = undefined; - if (tagExpression.template.kind === 183 /* TemplateExpression */) { + if (tagExpression.template.kind === 189 /* TemplateExpression */) { // If a tagged template expression lacks a tail literal, the call is incomplete. // Specifically, a template only can end in a TemplateTail or a Missing literal. var templateExpression = tagExpression.template; @@ -21656,7 +24824,7 @@ var ts; callIsIncomplete = !!templateLiteral.isUnterminated; } } - else if (node.kind === 139 /* Decorator */) { + else if (node.kind === 143 /* Decorator */) { isDecorator = true; typeArguments = undefined; adjustedArgCount = getEffectiveArgumentCount(node, /*args*/ undefined, signature); @@ -21665,7 +24833,7 @@ var ts; var callExpression = node; if (!callExpression.arguments) { // This only happens when we have something of the form: 'new C' - ts.Debug.assert(callExpression.kind === 169 /* NewExpression */); + ts.Debug.assert(callExpression.kind === 175 /* NewExpression */); return signature.minArgumentCount === 0; } // For IDE scenarios we may have an incomplete call, so a trailing comma is tantamount to adding another argument. @@ -21700,7 +24868,7 @@ var ts; if (type.flags & 80896 /* ObjectType */) { var resolved = resolveStructuredTypeMembers(type); if (resolved.callSignatures.length === 1 && resolved.constructSignatures.length === 0 && - resolved.properties.length === 0 && !resolved.stringIndexType && !resolved.numberIndexType) { + resolved.properties.length === 0 && !resolved.stringIndexInfo && !resolved.numberIndexInfo) { return resolved.callSignatures[0]; } } @@ -21717,7 +24885,7 @@ var ts; } function inferTypeArguments(node, signature, args, excludeArgument, context) { var typeParameters = signature.typeParameters; - var inferenceMapper = createInferenceMapper(context); + var inferenceMapper = getInferenceMapper(context); // Clear out all the inference results from the last time inferTypeArguments was called on this context for (var i = 0; i < typeParameters.length; i++) { // As an optimization, we don't have to clear (and later recompute) inferred types @@ -21738,13 +24906,18 @@ var ts; if (context.failedTypeParameterIndex !== undefined && !context.inferences[context.failedTypeParameterIndex].isFixed) { context.failedTypeParameterIndex = undefined; } + if (signature.thisType) { + var thisArgumentNode = getThisArgumentOfCall(node); + var thisArgumentType = thisArgumentNode ? checkExpression(thisArgumentNode) : voidType; + inferTypes(context, thisArgumentType, signature.thisType); + } // We perform two passes over the arguments. In the first pass we infer from all arguments, but use // wildcards for all context sensitive function expressions. var argCount = getEffectiveArgumentCount(node, args, signature); for (var i = 0; i < argCount; i++) { var arg = getEffectiveArgument(node, args, i); // If the effective argument is 'undefined', then it is an argument that is present but is synthetic. - if (arg === undefined || arg.kind !== 187 /* OmittedExpression */) { + if (arg === undefined || arg.kind !== 193 /* OmittedExpression */) { var paramType = getTypeAtPosition(signature, i); var argType = getEffectiveArgumentType(node, i, arg); // If the effective argument type is 'undefined', there is no synthetic type @@ -21765,7 +24938,7 @@ var ts; // Tagged template expressions will always have `undefined` for `excludeArgument[0]`. if (excludeArgument) { for (var i = 0; i < argCount; i++) { - // No need to check for omitted args and template expressions, their exlusion value is always undefined + // No need to check for omitted args and template expressions, their exclusion value is always undefined if (excludeArgument[i] === false) { var arg = args[i]; var paramType = getTypeAtPosition(signature, i); @@ -21775,14 +24948,11 @@ var ts; } getInferredTypes(context); } - function checkTypeArguments(signature, typeArguments, typeArgumentResultTypes, reportErrors, headMessage) { + function checkTypeArguments(signature, typeArgumentNodes, typeArgumentTypes, reportErrors, headMessage) { var typeParameters = signature.typeParameters; var typeArgumentsAreAssignable = true; + var mapper; for (var i = 0; i < typeParameters.length; i++) { - var typeArgNode = typeArguments[i]; - var typeArgument = getTypeFromTypeNode(typeArgNode); - // Do not push on this array! It has a preallocated length - typeArgumentResultTypes[i] = typeArgument; if (typeArgumentsAreAssignable /* so far */) { var constraint = getConstraintOfTypeParameter(typeParameters[i]); if (constraint) { @@ -21792,18 +24962,35 @@ var ts; errorInfo = ts.chainDiagnosticMessages(errorInfo, typeArgumentHeadMessage); typeArgumentHeadMessage = headMessage; } - typeArgumentsAreAssignable = checkTypeAssignableTo(typeArgument, constraint, reportErrors ? typeArgNode : undefined, typeArgumentHeadMessage, errorInfo); + if (!mapper) { + mapper = createTypeMapper(typeParameters, typeArgumentTypes); + } + var typeArgument = typeArgumentTypes[i]; + typeArgumentsAreAssignable = checkTypeAssignableTo(typeArgument, getTypeWithThisArgument(instantiateType(constraint, mapper), typeArgument), reportErrors ? typeArgumentNodes[i] : undefined, typeArgumentHeadMessage, errorInfo); } } } return typeArgumentsAreAssignable; } function checkApplicableSignature(node, args, signature, relation, excludeArgument, reportErrors) { + if (signature.thisType && signature.thisType !== voidType && node.kind !== 175 /* NewExpression */) { + // If the called expression is not of the form `x.f` or `x["f"]`, then sourceType = voidType + // If the signature's 'this' type is voidType, then the check is skipped -- anything is compatible. + // If the expression is a new expression, then the check is skipped. + var thisArgumentNode = getThisArgumentOfCall(node); + var thisArgumentType = thisArgumentNode ? checkExpression(thisArgumentNode) : voidType; + var errorNode = reportErrors ? (thisArgumentNode || node) : undefined; + var headMessage_1 = ts.Diagnostics.The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1; + if (!checkTypeRelatedTo(thisArgumentType, signature.thisType, relation, errorNode, headMessage_1)) { + return false; + } + } + var headMessage = ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1; var argCount = getEffectiveArgumentCount(node, args, signature); for (var i = 0; i < argCount; i++) { var arg = getEffectiveArgument(node, args, i); // If the effective argument is 'undefined', then it is an argument that is present but is synthetic. - if (arg === undefined || arg.kind !== 187 /* OmittedExpression */) { + if (arg === undefined || arg.kind !== 193 /* OmittedExpression */) { // Check spread elements against rest type (from arity check we know spread argument corresponds to a rest parameter) var paramType = getTypeAtPosition(signature, i); var argType = getEffectiveArgumentType(node, i, arg); @@ -21811,12 +24998,11 @@ var ts; // for the argument. In that case, we should check the argument. if (argType === undefined) { argType = arg.kind === 9 /* StringLiteral */ && !reportErrors - ? getStringLiteralType(arg) + ? getStringLiteralTypeForText(arg.text) : checkExpressionWithContextualType(arg, paramType, excludeArgument && excludeArgument[i] ? identityMapper : undefined); } // Use argument expression as error location when reporting errors var errorNode = reportErrors ? getEffectiveArgumentErrorNode(node, i, arg) : undefined; - var headMessage = ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1; if (!checkTypeRelatedTo(argType, paramType, relation, errorNode, headMessage)) { return false; } @@ -21824,6 +25010,20 @@ var ts; } return true; } + /** + * Returns the this argument in calls like x.f(...) and x[f](...). Undefined otherwise. + */ + function getThisArgumentOfCall(node) { + if (node.kind === 174 /* CallExpression */) { + var callee = node.expression; + if (callee.kind === 172 /* PropertyAccessExpression */) { + return callee.expression; + } + else if (callee.kind === 173 /* ElementAccessExpression */) { + return callee.expression; + } + } + } /** * Returns the effective arguments for an expression that works like a function invocation. * @@ -21835,16 +25035,16 @@ var ts; */ function getEffectiveCallArguments(node) { var args; - if (node.kind === 170 /* TaggedTemplateExpression */) { + if (node.kind === 176 /* TaggedTemplateExpression */) { var template = node.template; args = [undefined]; - if (template.kind === 183 /* TemplateExpression */) { + if (template.kind === 189 /* TemplateExpression */) { ts.forEach(template.templateSpans, function (span) { args.push(span.expression); }); } } - else if (node.kind === 139 /* Decorator */) { + else if (node.kind === 143 /* Decorator */) { // For a decorator, we return undefined as we will determine // the number and types of arguments for a decorator using // `getEffectiveArgumentCount` and `getEffectiveArgumentType` below. @@ -21869,19 +25069,19 @@ var ts; * Otherwise, the argument count is the length of the 'args' array. */ function getEffectiveArgumentCount(node, args, signature) { - if (node.kind === 139 /* Decorator */) { + if (node.kind === 143 /* Decorator */) { switch (node.parent.kind) { - case 214 /* ClassDeclaration */: - case 186 /* ClassExpression */: + case 221 /* ClassDeclaration */: + case 192 /* ClassExpression */: // A class decorator will have one argument (see `ClassDecorator` in core.d.ts) return 1; - case 141 /* PropertyDeclaration */: + case 145 /* PropertyDeclaration */: // A property declaration decorator will have two arguments (see // `PropertyDecorator` in core.d.ts) return 2; - case 143 /* MethodDeclaration */: - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: + case 147 /* MethodDeclaration */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: // A method or accessor declaration decorator will have two or three arguments (see // `PropertyDecorator` and `MethodDecorator` in core.d.ts) // If we are emitting decorators for ES3, we will only pass two arguments. @@ -21891,7 +25091,7 @@ var ts; // If the method decorator signature only accepts a target and a key, we will only // type check those arguments. return signature.parameters.length >= 3 ? 3 : 2; - case 138 /* Parameter */: + case 142 /* Parameter */: // A parameter declaration decorator will have three arguments (see // `ParameterDecorator` in core.d.ts) return 3; @@ -21915,25 +25115,25 @@ var ts; */ function getEffectiveDecoratorFirstArgumentType(node) { // The first argument to a decorator is its `target`. - if (node.kind === 214 /* ClassDeclaration */) { + if (node.kind === 221 /* ClassDeclaration */) { // For a class decorator, the `target` is the type of the class (e.g. the // "static" or "constructor" side of the class) var classSymbol = getSymbolOfNode(node); return getTypeOfSymbol(classSymbol); } - if (node.kind === 138 /* Parameter */) { + if (node.kind === 142 /* Parameter */) { // For a parameter decorator, the `target` is the parent type of the // parameter's containing method. node = node.parent; - if (node.kind === 144 /* Constructor */) { + if (node.kind === 148 /* Constructor */) { var classSymbol = getSymbolOfNode(node); return getTypeOfSymbol(classSymbol); } } - if (node.kind === 141 /* PropertyDeclaration */ || - node.kind === 143 /* MethodDeclaration */ || - node.kind === 145 /* GetAccessor */ || - node.kind === 146 /* SetAccessor */) { + if (node.kind === 145 /* PropertyDeclaration */ || + node.kind === 147 /* MethodDeclaration */ || + node.kind === 149 /* GetAccessor */ || + node.kind === 150 /* SetAccessor */) { // For a property or method decorator, the `target` is the // "static"-side type of the parent of the member if the member is // declared "static"; otherwise, it is the "instance"-side type of the @@ -21960,21 +25160,21 @@ var ts; */ function getEffectiveDecoratorSecondArgumentType(node) { // The second argument to a decorator is its `propertyKey` - if (node.kind === 214 /* ClassDeclaration */) { + if (node.kind === 221 /* ClassDeclaration */) { ts.Debug.fail("Class decorators should not have a second synthetic argument."); return unknownType; } - if (node.kind === 138 /* Parameter */) { + if (node.kind === 142 /* Parameter */) { node = node.parent; - if (node.kind === 144 /* Constructor */) { + if (node.kind === 148 /* Constructor */) { // For a constructor parameter decorator, the `propertyKey` will be `undefined`. return anyType; } } - if (node.kind === 141 /* PropertyDeclaration */ || - node.kind === 143 /* MethodDeclaration */ || - node.kind === 145 /* GetAccessor */ || - node.kind === 146 /* SetAccessor */) { + if (node.kind === 145 /* PropertyDeclaration */ || + node.kind === 147 /* MethodDeclaration */ || + node.kind === 149 /* GetAccessor */ || + node.kind === 150 /* SetAccessor */) { // The `propertyKey` for a property or method decorator will be a // string literal type if the member name is an identifier, number, or string; // otherwise, if the member name is a computed property name it will @@ -21984,10 +25184,10 @@ var ts; case 69 /* Identifier */: case 8 /* NumericLiteral */: case 9 /* StringLiteral */: - return getStringLiteralType(element.name); - case 136 /* ComputedPropertyName */: + return getStringLiteralTypeForText(element.name.text); + case 140 /* ComputedPropertyName */: var nameType = checkComputedPropertyName(element.name); - if (allConstituentTypesHaveKind(nameType, 16777216 /* ESSymbol */)) { + if (isTypeOfKind(nameType, 16777216 /* ESSymbol */)) { return nameType; } else { @@ -22010,22 +25210,22 @@ var ts; */ function getEffectiveDecoratorThirdArgumentType(node) { // The third argument to a decorator is either its `descriptor` for a method decorator - // or its `parameterIndex` for a paramter decorator - if (node.kind === 214 /* ClassDeclaration */) { + // or its `parameterIndex` for a parameter decorator + if (node.kind === 221 /* ClassDeclaration */) { ts.Debug.fail("Class decorators should not have a third synthetic argument."); return unknownType; } - if (node.kind === 138 /* Parameter */) { + if (node.kind === 142 /* Parameter */) { // The `parameterIndex` for a parameter decorator is always a number return numberType; } - if (node.kind === 141 /* PropertyDeclaration */) { + if (node.kind === 145 /* PropertyDeclaration */) { ts.Debug.fail("Property decorators should not have a third synthetic argument."); return unknownType; } - if (node.kind === 143 /* MethodDeclaration */ || - node.kind === 145 /* GetAccessor */ || - node.kind === 146 /* SetAccessor */) { + if (node.kind === 147 /* MethodDeclaration */ || + node.kind === 149 /* GetAccessor */ || + node.kind === 150 /* SetAccessor */) { // The `descriptor` for a method decorator will be a `TypedPropertyDescriptor` // for the type of the member. var propertyType = getTypeOfNode(node); @@ -22057,11 +25257,11 @@ var ts; // Decorators provide special arguments, a tagged template expression provides // a special first argument, and string literals get string literal types // unless we're reporting errors - if (node.kind === 139 /* Decorator */) { + if (node.kind === 143 /* Decorator */) { return getEffectiveDecoratorArgumentType(node, argIndex); } - else if (argIndex === 0 && node.kind === 170 /* TaggedTemplateExpression */) { - return globalTemplateStringsArrayType; + else if (argIndex === 0 && node.kind === 176 /* TaggedTemplateExpression */) { + return getGlobalTemplateStringsArrayType(); } // This is not a synthetic argument, so we return 'undefined' // to signal that the caller needs to check the argument. @@ -22072,8 +25272,8 @@ var ts; */ function getEffectiveArgument(node, args, argIndex) { // For a decorator or the first argument of a tagged template expression we return undefined. - if (node.kind === 139 /* Decorator */ || - (argIndex === 0 && node.kind === 170 /* TaggedTemplateExpression */)) { + if (node.kind === 143 /* Decorator */ || + (argIndex === 0 && node.kind === 176 /* TaggedTemplateExpression */)) { return undefined; } return args[argIndex]; @@ -22082,11 +25282,11 @@ var ts; * Gets the error node to use when reporting errors for an effective argument. */ function getEffectiveArgumentErrorNode(node, argIndex, arg) { - if (node.kind === 139 /* Decorator */) { + if (node.kind === 143 /* Decorator */) { // For a decorator, we use the expression of the decorator for error reporting. return node.expression; } - else if (argIndex === 0 && node.kind === 170 /* TaggedTemplateExpression */) { + else if (argIndex === 0 && node.kind === 176 /* TaggedTemplateExpression */) { // For a the first argument of a tagged template expression, we use the template of the tag for error reporting. return node.template; } @@ -22095,8 +25295,8 @@ var ts; } } function resolveCall(node, signatures, candidatesOutArray, headMessage) { - var isTaggedTemplate = node.kind === 170 /* TaggedTemplateExpression */; - var isDecorator = node.kind === 139 /* Decorator */; + var isTaggedTemplate = node.kind === 176 /* TaggedTemplateExpression */; + var isDecorator = node.kind === 143 /* Decorator */; var typeArguments; if (!isTaggedTemplate && !isDecorator) { typeArguments = node.typeArguments; @@ -22202,7 +25402,8 @@ var ts; } else if (candidateForTypeArgumentError) { if (!isTaggedTemplate && !isDecorator && typeArguments) { - checkTypeArguments(candidateForTypeArgumentError, node.typeArguments, [], /*reportErrors*/ true, headMessage); + var typeArguments_2 = node.typeArguments; + checkTypeArguments(candidateForTypeArgumentError, typeArguments_2, ts.map(typeArguments_2, getTypeFromTypeNode), /*reportErrors*/ true, headMessage); } else { ts.Debug.assert(resultOfFailedInference.failedTypeParameterIndex >= 0); @@ -22260,7 +25461,7 @@ var ts; if (candidate.typeParameters) { var typeArgumentTypes = void 0; if (typeArguments) { - typeArgumentTypes = new Array(candidate.typeParameters.length); + typeArgumentTypes = ts.map(typeArguments, getTypeFromTypeNode); typeArgumentsAreValid = checkTypeArguments(candidate, typeArguments, typeArgumentTypes, /*reportErrors*/ false); } else { @@ -22314,12 +25515,14 @@ var ts; // In super call, the candidate signatures are the matching arity signatures of the base constructor function instantiated // with the type arguments specified in the extends clause. var baseTypeNode = ts.getClassExtendsHeritageClauseElement(ts.getContainingClass(node)); - var baseConstructors = getInstantiatedConstructorsForTypeArguments(superType, baseTypeNode.typeArguments); - return resolveCall(node, baseConstructors, candidatesOutArray); + if (baseTypeNode) { + var baseConstructors = getInstantiatedConstructorsForTypeArguments(superType, baseTypeNode.typeArguments); + return resolveCall(node, baseConstructors, candidatesOutArray); + } } return resolveUntypedCall(node); } - var funcType = checkExpression(node.expression); + var funcType = checkNonNullExpression(node.expression); var apparentType = getApparentType(funcType); if (apparentType === unknownType) { // Another error has already been reported @@ -22339,7 +25542,7 @@ var ts; // We exclude union types because we may have a union of function types that happen to have // no common signatures. if (isTypeAny(funcType) || (!callSignatures.length && !constructSignatures.length && !(funcType.flags & 16384 /* Union */) && isTypeAssignableTo(funcType, globalFunctionType))) { - // The unknownType indicates that an error already occured (and was reported). No + // The unknownType indicates that an error already occurred (and was reported). No // need to report another error in this case. if (funcType !== unknownType && node.typeArguments) { error(node, ts.Diagnostics.Untyped_function_calls_may_not_accept_type_arguments); @@ -22367,7 +25570,7 @@ var ts; error(node.arguments[spreadIndex], ts.Diagnostics.Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_5_and_higher); } } - var expressionType = checkExpression(node.expression); + var expressionType = checkNonNullExpression(node.expression); // If expressionType's apparent type(section 3.8.1) is an object type with one or // more construct signatures, the expression is processed in the same manner as a // function call, but using the construct signatures as the initial set of candidate @@ -22402,23 +25605,53 @@ var ts; // that the user will not add any. var constructSignatures = getSignaturesOfType(expressionType, 1 /* Construct */); if (constructSignatures.length) { + if (!isConstructorAccessible(node, constructSignatures[0])) { + return resolveErrorCall(node); + } return resolveCall(node, constructSignatures, candidatesOutArray); } // If expressionType's apparent type is an object type with no construct signatures but // one or more call signatures, the expression is processed as a function call. A compile-time // error occurs if the result of the function call is not Void. The type of the result of the - // operation is Any. + // operation is Any. It is an error to have a Void this type. var callSignatures = getSignaturesOfType(expressionType, 0 /* Call */); if (callSignatures.length) { var signature = resolveCall(node, callSignatures, candidatesOutArray); if (getReturnTypeOfSignature(signature) !== voidType) { error(node, ts.Diagnostics.Only_a_void_function_can_be_called_with_the_new_keyword); } + if (signature.thisType === voidType) { + error(node, ts.Diagnostics.A_function_that_is_called_with_the_new_keyword_cannot_have_a_this_type_that_is_void); + } return signature; } error(node, ts.Diagnostics.Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature); return resolveErrorCall(node); } + function isConstructorAccessible(node, signature) { + if (!signature || !signature.declaration) { + return true; + } + var declaration = signature.declaration; + var flags = declaration.flags; + // Public constructor is accessible. + if (!(flags & (8 /* Private */ | 16 /* Protected */))) { + return true; + } + var declaringClassDeclaration = getClassLikeDeclarationOfSymbol(declaration.parent.symbol); + var declaringClass = getDeclaredTypeOfSymbol(declaration.parent.symbol); + // A private or protected constructor can only be instantiated within it's own class + if (!isNodeWithinClass(node, declaringClassDeclaration)) { + if (flags & 8 /* Private */) { + error(node, ts.Diagnostics.Constructor_of_class_0_is_private_and_only_accessible_within_the_class_declaration, typeToString(declaringClass)); + } + if (flags & 16 /* Protected */) { + error(node, ts.Diagnostics.Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration, typeToString(declaringClass)); + } + return false; + } + return true; + } function resolveTaggedTemplateExpression(node, candidatesOutArray) { var tagType = checkExpression(node.tag); var apparentType = getApparentType(tagType); @@ -22441,16 +25674,16 @@ var ts; */ function getDiagnosticHeadMessageForDecoratorResolution(node) { switch (node.parent.kind) { - case 214 /* ClassDeclaration */: - case 186 /* ClassExpression */: + case 221 /* ClassDeclaration */: + case 192 /* ClassExpression */: return ts.Diagnostics.Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression; - case 138 /* Parameter */: + case 142 /* Parameter */: return ts.Diagnostics.Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression; - case 141 /* PropertyDeclaration */: + case 145 /* PropertyDeclaration */: return ts.Diagnostics.Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression; - case 143 /* MethodDeclaration */: - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: + case 147 /* MethodDeclaration */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: return ts.Diagnostics.Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression; } } @@ -22469,7 +25702,7 @@ var ts; } var headMessage = getDiagnosticHeadMessageForDecoratorResolution(node); if (!callSignatures.length) { - var errorInfo; + var errorInfo = void 0; errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature); errorInfo = ts.chainDiagnosticMessages(errorInfo, headMessage); diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(node, errorInfo)); @@ -22477,6 +25710,19 @@ var ts; } return resolveCall(node, callSignatures, candidatesOutArray, headMessage); } + function resolveSignature(node, candidatesOutArray) { + switch (node.kind) { + case 174 /* CallExpression */: + return resolveCallExpression(node, candidatesOutArray); + case 175 /* NewExpression */: + return resolveNewExpression(node, candidatesOutArray); + case 176 /* TaggedTemplateExpression */: + return resolveTaggedTemplateExpression(node, candidatesOutArray); + case 143 /* Decorator */: + return resolveDecorator(node, candidatesOutArray); + } + ts.Debug.fail("Branch in 'resolveSignature' should be unreachable."); + } // candidatesOutArray is passed by signature help in the language service, and collectCandidates // must fill it up with the appropriate candidate signatures function getResolvedSignature(node, candidatesOutArray) { @@ -22485,25 +25731,29 @@ var ts; // However, it is possible that either candidatesOutArray was not passed in the first time, // or that a different candidatesOutArray was passed in. Therefore, we need to redo the work // to correctly fill the candidatesOutArray. - if (!links.resolvedSignature || candidatesOutArray) { - links.resolvedSignature = anySignature; - if (node.kind === 168 /* CallExpression */) { - links.resolvedSignature = resolveCallExpression(node, candidatesOutArray); - } - else if (node.kind === 169 /* NewExpression */) { - links.resolvedSignature = resolveNewExpression(node, candidatesOutArray); - } - else if (node.kind === 170 /* TaggedTemplateExpression */) { - links.resolvedSignature = resolveTaggedTemplateExpression(node, candidatesOutArray); - } - else if (node.kind === 139 /* Decorator */) { - links.resolvedSignature = resolveDecorator(node, candidatesOutArray); - } - else { - ts.Debug.fail("Branch in 'getResolvedSignature' should be unreachable."); - } + var cached = links.resolvedSignature; + if (cached && cached !== anySignature && !candidatesOutArray) { + return cached; } - return links.resolvedSignature; + links.resolvedSignature = anySignature; + var result = resolveSignature(node, candidatesOutArray); + // If signature resolution originated in control flow type analysis (for example to compute the + // assigned type in a flow assignment) we don't cache the result as it may be based on temporary + // types from the control flow analysis. + links.resolvedSignature = flowLoopStart === flowLoopCount ? result : cached; + return result; + } + function getResolvedOrAnySignature(node) { + // If we're already in the process of resolving the given signature, don't resolve again as + // that could cause infinite recursion. Instead, return anySignature. + return getNodeLinks(node).resolvedSignature === anySignature ? anySignature : getResolvedSignature(node); + } + function getInferredClassType(symbol) { + var links = getSymbolLinks(symbol); + if (!links.inferredClassType) { + links.inferredClassType = createAnonymousType(undefined, symbol.members, emptyArray, emptyArray, /*stringIndexType*/ undefined, /*numberIndexType*/ undefined); + } + return links.inferredClassType; } /** * Syntactically and semantically checks a call or new expression. @@ -22517,21 +25767,28 @@ var ts; if (node.expression.kind === 95 /* SuperKeyword */) { return voidType; } - if (node.kind === 169 /* NewExpression */) { + if (node.kind === 175 /* NewExpression */) { var declaration = signature.declaration; if (declaration && - declaration.kind !== 144 /* Constructor */ && - declaration.kind !== 148 /* ConstructSignature */ && - declaration.kind !== 153 /* ConstructorType */) { - // When resolved signature is a call signature (and not a construct signature) the result type is any - if (compilerOptions.noImplicitAny) { + declaration.kind !== 148 /* Constructor */ && + declaration.kind !== 152 /* ConstructSignature */ && + declaration.kind !== 157 /* ConstructorType */ && + !ts.isJSDocConstructSignature(declaration)) { + // When resolved signature is a call signature (and not a construct signature) the result type is any, unless + // the declaring function had members created through 'x.prototype.y = expr' or 'this.y = expr' psuedodeclarations + // in a JS file + var funcSymbol = checkExpression(node.expression).symbol; + if (funcSymbol && funcSymbol.members && (funcSymbol.flags & 16 /* Function */)) { + return getInferredClassType(funcSymbol); + } + else if (compilerOptions.noImplicitAny) { error(node, ts.Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type); } return anyType; } } // In JavaScript files, calls to any identifier 'require' are treated as external module imports - if (ts.isInJavaScriptFile(node) && ts.isRequireCall(node)) { + if (ts.isInJavaScriptFile(node) && ts.isRequireCall(node, /*checkArgumentIsStringLiteral*/ true)) { return resolveExternalModuleTypeByLiteral(node.arguments[0]); } return getReturnTypeOfSignature(signature); @@ -22544,19 +25801,29 @@ var ts; var targetType = getTypeFromTypeNode(node.type); if (produceDiagnostics && targetType !== unknownType) { var widenedType = getWidenedType(exprType); - // Permit 'number[] | "foo"' to be asserted to 'string'. - var bothAreStringLike = someConstituentTypeHasKind(targetType, 258 /* StringLike */) && - someConstituentTypeHasKind(widenedType, 258 /* StringLike */); - if (!bothAreStringLike && !(isTypeAssignableTo(targetType, widenedType))) { - checkTypeAssignableTo(exprType, targetType, node, ts.Diagnostics.Neither_type_0_nor_type_1_is_assignable_to_the_other); + if (!isTypeComparableTo(targetType, widenedType)) { + checkTypeComparableTo(exprType, targetType, node, ts.Diagnostics.Type_0_cannot_be_converted_to_type_1); } } return targetType; } + function checkNonNullAssertion(node) { + return getNonNullableType(checkExpression(node.expression)); + } + function getTypeOfParameter(symbol) { + var type = getTypeOfSymbol(symbol); + if (strictNullChecks) { + var declaration = symbol.valueDeclaration; + if (declaration && declaration.initializer) { + return addNullableKind(type, 32 /* Undefined */); + } + } + return type; + } function getTypeAtPosition(signature, pos) { return signature.hasRestParameter ? - pos < signature.parameters.length - 1 ? getTypeOfSymbol(signature.parameters[pos]) : getRestTypeOfSignature(signature) : - pos < signature.parameters.length ? getTypeOfSymbol(signature.parameters[pos]) : anyType; + pos < signature.parameters.length - 1 ? getTypeOfParameter(signature.parameters[pos]) : getRestTypeOfSignature(signature) : + pos < signature.parameters.length ? getTypeOfParameter(signature.parameters[pos]) : anyType; } function assignContextualParameterTypes(signature, context, mapper) { var len = signature.parameters.length - (signature.hasRestParameter ? 1 : 0); @@ -22577,7 +25844,7 @@ var ts; if (ts.isBindingPattern(node.name)) { for (var _i = 0, _a = node.name.elements; _i < _a.length; _i++) { var element = _a[_i]; - if (element.kind !== 187 /* OmittedExpression */) { + if (element.kind !== 193 /* OmittedExpression */) { if (element.name.kind === 69 /* Identifier */) { getSymbolLinks(getSymbolOfNode(element)).type = getTypeForBindingElement(element); } @@ -22590,6 +25857,12 @@ var ts; var links = getSymbolLinks(parameter); if (!links.type) { links.type = instantiateType(contextualType, mapper); + // if inference didn't come up with anything but {}, fall back to the binding pattern if present. + if (links.type === emptyObjectType && + (parameter.valueDeclaration.name.kind === 167 /* ObjectBindingPattern */ || + parameter.valueDeclaration.name.kind === 168 /* ArrayBindingPattern */)) { + links.type = getTypeFromBindingPattern(parameter.valueDeclaration.name); + } assignBindingElementTypes(parameter.valueDeclaration); } else if (isInferentialContext(mapper)) { @@ -22625,6 +25898,13 @@ var ts; inferTypes(mapper.context, links.type, instantiateType(contextualType, mapper)); } } + function getReturnTypeFromJSDocComment(func) { + var returnTag = ts.getJSDocReturnTag(func); + if (returnTag && returnTag.typeExpression) { + return getTypeFromTypeNode(returnTag.typeExpression.type); + } + return undefined; + } function createPromiseType(promisedType) { // creates a `Promise` type where `T` is the promisedType argument var globalPromiseType = getGlobalPromiseType(); @@ -22642,7 +25922,7 @@ var ts; } var isAsync = ts.isAsyncFunctionLike(func); var type; - if (func.body.kind !== 192 /* Block */) { + if (func.body.kind !== 199 /* Block */) { type = checkExpressionCached(func.body, contextualMapper); if (isAsync) { // From within an async function you can return either a non-promise value or a promise. Any @@ -22653,7 +25933,7 @@ var ts; } } else { - var types; + var types = void 0; var funcIsGenerator = !!func.asteriskToken; if (funcIsGenerator) { types = checkAndAggregateYieldOperandTypes(func.body, contextualMapper); @@ -22666,7 +25946,11 @@ var ts; } } else { - types = checkAndAggregateReturnExpressionTypes(func.body, contextualMapper, isAsync); + var hasImplicitReturn = !!(func.flags & 32768 /* HasImplicitReturn */); + types = checkAndAggregateReturnExpressionTypes(func.body, contextualMapper, isAsync, hasImplicitReturn); + if (!types) { + return neverType; + } if (types.length === 0) { if (isAsync) { // For an async function, the return type will not be void, but rather a Promise for void. @@ -22677,9 +25961,7 @@ var ts; } return promiseType; } - else { - return voidType; - } + return voidType; } } // When yield/return statements are contextually typed we allow the return type to be a union type. @@ -22692,7 +25974,8 @@ var ts; } else { error(func, ts.Diagnostics.No_best_common_type_exists_among_return_expressions); - return unknownType; + // Defer to unioning the return types so we get a) downstream errors earlier and b) better Salsa experience + return getUnionType(types); } } if (funcIsGenerator) { @@ -22735,8 +26018,9 @@ var ts; }); return aggregatedTypes; } - function checkAndAggregateReturnExpressionTypes(body, contextualMapper, isAsync) { + function checkAndAggregateReturnExpressionTypes(body, contextualMapper, isAsync, hasImplicitReturn) { var aggregatedTypes = []; + var hasOmittedExpressions = false; ts.forEachReturnStatement(body, function (returnStatement) { var expr = returnStatement.expression; if (expr) { @@ -22748,55 +26032,87 @@ var ts; // the native Promise type by the caller. type = checkAwaitedType(type, body.parent, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member); } - if (!ts.contains(aggregatedTypes, type)) { + if (type !== neverType && !ts.contains(aggregatedTypes, type)) { aggregatedTypes.push(type); } } + else { + hasOmittedExpressions = true; + } }); + if (aggregatedTypes.length === 0 && !hasOmittedExpressions && !hasImplicitReturn) { + return undefined; + } + if (strictNullChecks && aggregatedTypes.length && (hasOmittedExpressions || hasImplicitReturn)) { + if (!ts.contains(aggregatedTypes, undefinedType)) { + aggregatedTypes.push(undefinedType); + } + } return aggregatedTypes; } - // TypeScript Specification 1.0 (6.3) - July 2014 - // An explicitly typed function whose return type isn't the Void or the Any type - // must have at least one return statement somewhere in its body. - // An exception to this rule is if the function implementation consists of a single 'throw' statement. + /** + * TypeScript Specification 1.0 (6.3) - July 2014 + * An explicitly typed function whose return type isn't the Void type, + * the Any type, or a union type containing the Void or Any type as a constituent + * must have at least one return statement somewhere in its body. + * An exception to this rule is if the function implementation consists of a single 'throw' statement. + * + * @param returnType - return type of the function, can be undefined if return type is not explicitly specified + */ function checkAllCodePathsInNonVoidFunctionReturnOrThrow(func, returnType) { if (!produceDiagnostics) { return; } - // Functions that return 'void' or 'any' don't need any return expressions. - if (returnType === voidType || isTypeAny(returnType)) { + // Functions with with an explicitly specified 'void' or 'any' return type don't need any return expressions. + if (returnType && maybeTypeOfKind(returnType, 1 /* Any */ | 16 /* Void */)) { return; } // If all we have is a function signature, or an arrow function with an expression body, then there is nothing to check. - // also if HasImplicitReturnValue flags is not set this means that all codepaths in function body end with return of throw - if (ts.nodeIsMissing(func.body) || func.body.kind !== 192 /* Block */ || !(func.flags & 524288 /* HasImplicitReturn */)) { + // also if HasImplicitReturn flag is not set this means that all codepaths in function body end with return or throw + if (ts.nodeIsMissing(func.body) || func.body.kind !== 199 /* Block */ || !(func.flags & 32768 /* HasImplicitReturn */)) { return; } - if (func.flags & 1048576 /* HasExplicitReturn */) { - if (compilerOptions.noImplicitReturns) { - error(func.type, ts.Diagnostics.Not_all_code_paths_return_a_value); - } + var hasExplicitReturn = func.flags & 65536 /* HasExplicitReturn */; + if (returnType === neverType) { + error(func.type, ts.Diagnostics.A_function_returning_never_cannot_have_a_reachable_end_point); } - else { - // This function does not conform to the specification. + else if (returnType && !hasExplicitReturn) { + // minimal check: function has syntactic return type annotation and no explicit return statements in the body + // this function does not conform to the specification. + // NOTE: having returnType !== undefined is a precondition for entering this branch so func.type will always be present error(func.type, ts.Diagnostics.A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value); } + else if (returnType && strictNullChecks && !isTypeAssignableTo(undefinedType, returnType)) { + error(func.type, ts.Diagnostics.Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined); + } + else if (compilerOptions.noImplicitReturns) { + if (!returnType) { + // If return type annotation is omitted check if function has any explicit return statements. + // If it does not have any - its inferred return type is void - don't do any checks. + // Otherwise get inferred return type from function body and report error only if it is not void / anytype + if (!hasExplicitReturn) { + return; + } + var inferredReturnType = getReturnTypeOfSignature(getSignatureFromDeclaration(func)); + if (isUnwrappedReturnTypeVoidOrAny(func, inferredReturnType)) { + return; + } + } + error(func.type || func, ts.Diagnostics.Not_all_code_paths_return_a_value); + } } function checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper) { - ts.Debug.assert(node.kind !== 143 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 147 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); // Grammar checking var hasGrammarError = checkGrammarFunctionLikeDeclaration(node); - if (!hasGrammarError && node.kind === 173 /* FunctionExpression */) { + if (!hasGrammarError && node.kind === 179 /* FunctionExpression */) { checkGrammarForGenerator(node); } // The identityMapper object is used to indicate that function expressions are wildcards if (contextualMapper === identityMapper && isContextSensitive(node)) { + checkNodeDeferred(node); return anyFunctionType; } - var isAsync = ts.isAsyncFunctionLike(node); - if (isAsync) { - emitAwaiter = true; - } var links = getNodeLinks(node); var type = getTypeOfSymbol(node.symbol); var contextSensitive = isContextSensitive(node); @@ -22826,28 +26142,23 @@ var ts; } if (!contextChecked) { checkSignatureDeclaration(node); + checkNodeDeferred(node); } } } - if (produceDiagnostics && node.kind !== 143 /* MethodDeclaration */ && node.kind !== 142 /* MethodSignature */) { + if (produceDiagnostics && node.kind !== 147 /* MethodDeclaration */ && node.kind !== 146 /* MethodSignature */) { checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); } return type; } - function checkFunctionExpressionOrObjectLiteralMethodBody(node) { - ts.Debug.assert(node.kind !== 143 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + function checkFunctionExpressionOrObjectLiteralMethodDeferred(node) { + ts.Debug.assert(node.kind !== 147 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); var isAsync = ts.isAsyncFunctionLike(node); - if (isAsync) { - emitAwaiter = true; - } - var returnType = node.type && getTypeFromTypeNode(node.type); - var promisedType; - if (returnType && isAsync) { - promisedType = checkAsyncFunctionReturnType(node); - } - if (returnType && !node.asteriskToken) { - checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, isAsync ? promisedType : returnType); + var returnOrPromisedType = node.type && (isAsync ? checkAsyncFunctionReturnType(node) : getTypeFromTypeNode(node.type)); + if (!node.asteriskToken) { + // return is not necessary in the body of generators + checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnOrPromisedType); } if (node.body) { if (!node.type) { @@ -22858,7 +26169,7 @@ var ts; // checkFunctionExpressionBodies). So it must be done now. getReturnTypeOfSignature(getSignatureFromDeclaration(node)); } - if (node.body.kind === 192 /* Block */) { + if (node.body.kind === 199 /* Block */) { checkSourceElement(node.body); } else { @@ -22868,16 +26179,15 @@ var ts; // check assignability of the awaited type of the expression body against the promised type of // its return type annotation. var exprType = checkExpression(node.body); - if (returnType) { + if (returnOrPromisedType) { if (isAsync) { var awaitedType = checkAwaitedType(exprType, node.body, ts.Diagnostics.Expression_body_for_async_arrow_function_does_not_have_a_valid_callable_then_member); - checkTypeAssignableTo(awaitedType, promisedType, node.body); + checkTypeAssignableTo(awaitedType, returnOrPromisedType, node.body); } else { - checkTypeAssignableTo(exprType, returnType, node.body); + checkTypeAssignableTo(exprType, returnOrPromisedType, node.body); } } - checkFunctionAndClassExpressionBodies(node.body); } } } @@ -22888,75 +26198,74 @@ var ts; } return true; } - function checkReferenceExpression(n, invalidReferenceMessage, constantVariableMessage) { - function findSymbol(n) { - var symbol = getNodeLinks(n).resolvedSymbol; - // Because we got the symbol from the resolvedSymbol property, it might be of kind - // SymbolFlags.ExportValue. In this case it is necessary to get the actual export - // symbol, which will have the correct flags set on it. - return symbol && getExportSymbolOfValueSymbolIfExported(symbol); + function isReadonlySymbol(symbol) { + // The following symbols are considered read-only: + // Properties with a 'readonly' modifier + // Variables declared with 'const' + // Get accessors without matching set accessors + // Enum members + return symbol.flags & 4 /* Property */ && (getDeclarationFlagsFromSymbol(symbol) & 64 /* Readonly */) !== 0 || + symbol.flags & 3 /* Variable */ && (getDeclarationFlagsFromSymbol(symbol) & 2048 /* Const */) !== 0 || + symbol.flags & 98304 /* Accessor */ && !(symbol.flags & 65536 /* SetAccessor */) || + (symbol.flags & 8 /* EnumMember */) !== 0; + } + function isReferenceToReadonlyEntity(expr, symbol) { + if (isReadonlySymbol(symbol)) { + // Allow assignments to readonly properties within constructors of the same class declaration. + if (symbol.flags & 4 /* Property */ && + (expr.kind === 172 /* PropertyAccessExpression */ || expr.kind === 173 /* ElementAccessExpression */) && + expr.expression.kind === 97 /* ThisKeyword */) { + var func = ts.getContainingFunction(expr); + return !(func && func.kind === 148 /* Constructor */ && func.parent === symbol.valueDeclaration.parent); + } + return true; } - function isReferenceOrErrorExpression(n) { - // TypeScript 1.0 spec (April 2014): - // Expressions are classified as values or references. - // References are the subset of expressions that are permitted as the target of an assignment. - // Specifically, references are combinations of identifiers(section 4.3), parentheses(section 4.7), - // and property accesses(section 4.10). - // All other expression constructs described in this chapter are classified as values. - switch (n.kind) { - case 69 /* Identifier */: { - var symbol = findSymbol(n); - // TypeScript 1.0 spec (April 2014): 4.3 - // An identifier expression that references a variable or parameter is classified as a reference. - // An identifier expression that references any other kind of entity is classified as a value(and therefore cannot be the target of an assignment). - return !symbol || symbol === unknownSymbol || symbol === argumentsSymbol || (symbol.flags & 3 /* Variable */) !== 0; + return false; + } + function isReferenceThroughNamespaceImport(expr) { + if (expr.kind === 172 /* PropertyAccessExpression */ || expr.kind === 173 /* ElementAccessExpression */) { + var node = skipParenthesizedNodes(expr.expression); + if (node.kind === 69 /* Identifier */) { + var symbol = getNodeLinks(node).resolvedSymbol; + if (symbol.flags & 8388608 /* Alias */) { + var declaration = getDeclarationOfAliasSymbol(symbol); + return declaration && declaration.kind === 232 /* NamespaceImport */; } - case 166 /* PropertyAccessExpression */: { - var symbol = findSymbol(n); - // TypeScript 1.0 spec (April 2014): 4.10 - // A property access expression is always classified as a reference. - // NOTE (not in spec): assignment to enum members should not be allowed - return !symbol || symbol === unknownSymbol || (symbol.flags & ~8 /* EnumMember */) !== 0; - } - case 167 /* ElementAccessExpression */: - // old compiler doesn't check indexed access - return true; - case 172 /* ParenthesizedExpression */: - return isReferenceOrErrorExpression(n.expression); - default: - return false; } } - function isConstVariableReference(n) { - switch (n.kind) { - case 69 /* Identifier */: - case 166 /* PropertyAccessExpression */: { - var symbol = findSymbol(n); - return symbol && (symbol.flags & 3 /* Variable */) !== 0 && (getDeclarationFlagsFromSymbol(symbol) & 16384 /* Const */) !== 0; - } - case 167 /* ElementAccessExpression */: { - var index = n.argumentExpression; - var symbol = findSymbol(n.expression); - if (symbol && index && index.kind === 9 /* StringLiteral */) { - var name_12 = index.text; - var prop = getPropertyOfType(getTypeOfSymbol(symbol), name_12); - return prop && (prop.flags & 3 /* Variable */) !== 0 && (getDeclarationFlagsFromSymbol(prop) & 16384 /* Const */) !== 0; - } + return false; + } + function checkReferenceExpression(expr, invalidReferenceMessage, constantVariableMessage) { + // References are combinations of identifiers, parentheses, and property accesses. + var node = skipParenthesizedNodes(expr); + if (node.kind !== 69 /* Identifier */ && node.kind !== 172 /* PropertyAccessExpression */ && node.kind !== 173 /* ElementAccessExpression */) { + error(expr, invalidReferenceMessage); + return false; + } + // Because we get the symbol from the resolvedSymbol property, it might be of kind + // SymbolFlags.ExportValue. In this case it is necessary to get the actual export + // symbol, which will have the correct flags set on it. + var links = getNodeLinks(node); + var symbol = getExportSymbolOfValueSymbolIfExported(links.resolvedSymbol); + if (symbol) { + if (symbol !== unknownSymbol && symbol !== argumentsSymbol) { + // Only variables (and not functions, classes, namespaces, enum objects, or enum members) + // are considered references when referenced using a simple identifier. + if (node.kind === 69 /* Identifier */ && !(symbol.flags & 3 /* Variable */)) { + error(expr, invalidReferenceMessage); return false; } - case 172 /* ParenthesizedExpression */: - return isConstVariableReference(n.expression); - default: + if (isReferenceToReadonlyEntity(node, symbol) || isReferenceThroughNamespaceImport(node)) { + error(expr, constantVariableMessage); return false; + } } } - if (!isReferenceOrErrorExpression(n)) { - error(n, invalidReferenceMessage); - return false; - } - if (isConstVariableReference(n)) { - error(n, constantVariableMessage); - return false; + else if (node.kind === 173 /* ElementAccessExpression */) { + if (links.resolvedIndexInfo && links.resolvedIndexInfo.isReadonly) { + error(expr, constantVariableMessage); + return false; + } } return true; } @@ -22975,7 +26284,7 @@ var ts; function checkAwaitExpression(node) { // Grammar checking if (produceDiagnostics) { - if (!(node.parserContextFlags & 8 /* Await */)) { + if (!(node.flags & 33554432 /* AwaitContext */)) { grammarErrorOnFirstToken(node, ts.Diagnostics.await_expression_is_only_allowed_within_an_async_function); } if (isInParameterInitializerBeforeContainingFunction(node)) { @@ -22991,7 +26300,7 @@ var ts; case 35 /* PlusToken */: case 36 /* MinusToken */: case 50 /* TildeToken */: - if (someConstituentTypeHasKind(operandType, 16777216 /* ESSymbol */)) { + if (maybeTypeOfKind(operandType, 16777216 /* ESSymbol */)) { error(node.operand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(node.operator)); } return numberType; @@ -22999,10 +26308,10 @@ var ts; return booleanType; case 41 /* PlusPlusToken */: case 42 /* MinusMinusToken */: - var ok = checkArithmeticOperandType(node.operand, operandType, ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); + var ok = checkArithmeticOperandType(node.operand, getNonNullableType(operandType), ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); if (ok) { // run check only if former checks succeeded to avoid reporting cascading errors - checkReferenceExpression(node.operand, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant); + checkReferenceExpression(node.operand, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant_or_a_read_only_property); } return numberType; } @@ -23010,46 +26319,56 @@ var ts; } function checkPostfixUnaryExpression(node) { var operandType = checkExpression(node.operand); - var ok = checkArithmeticOperandType(node.operand, operandType, ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); + var ok = checkArithmeticOperandType(node.operand, getNonNullableType(operandType), ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); if (ok) { // run check only if former checks succeeded to avoid reporting cascading errors - checkReferenceExpression(node.operand, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant); + checkReferenceExpression(node.operand, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant_or_a_read_only_property); } return numberType; } - // Just like isTypeOfKind below, except that it returns true if *any* constituent - // has this kind. - function someConstituentTypeHasKind(type, kind) { - if (type.flags & kind) { - return true; - } - if (type.flags & 49152 /* UnionOrIntersection */) { - var types = type.types; - for (var _i = 0, types_9 = types; _i < types_9.length; _i++) { - var current = types_9[_i]; - if (current.flags & kind) { - return true; - } - } - return false; - } - return false; - } - // Return true if type has the given flags, or is a union or intersection type composed of types that all have those flags. - function allConstituentTypesHaveKind(type, kind) { + // Return true if type might be of the given kind. A union or intersection type might be of a given + // kind if at least one constituent type is of the given kind. + function maybeTypeOfKind(type, kind) { if (type.flags & kind) { return true; } if (type.flags & 49152 /* UnionOrIntersection */) { var types = type.types; for (var _i = 0, types_10 = types; _i < types_10.length; _i++) { - var current = types_10[_i]; - if (!(current.flags & kind)) { + var t = types_10[_i]; + if (maybeTypeOfKind(t, kind)) { + return true; + } + } + } + return false; + } + // Return true if type is of the given kind. A union type is of a given kind if all constituent types + // are of the given kind. An intersection type is of a given kind if at least one constituent type is + // of the given kind. + function isTypeOfKind(type, kind) { + if (type.flags & kind) { + return true; + } + if (type.flags & 16384 /* Union */) { + var types = type.types; + for (var _i = 0, types_11 = types; _i < types_11.length; _i++) { + var t = types_11[_i]; + if (!isTypeOfKind(t, kind)) { return false; } } return true; } + if (type.flags & 32768 /* Intersection */) { + var types = type.types; + for (var _a = 0, types_12 = types; _a < types_12.length; _a++) { + var t = types_12[_a]; + if (isTypeOfKind(t, kind)) { + return true; + } + } + } return false; } function isConstEnumObjectType(type) { @@ -23064,7 +26383,7 @@ var ts; // and the right operand to be of type Any or a subtype of the 'Function' interface type. // The result is always of the Boolean primitive type. // NOTE: do not raise error if leftType is unknown as related error was already reported - if (allConstituentTypesHaveKind(leftType, 16777726 /* Primitive */)) { + if (isTypeOfKind(leftType, 16777726 /* Primitive */)) { error(left, ts.Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); } // NOTE: do not raise error if right is unknown as related error was already reported @@ -23090,38 +26409,41 @@ var ts; var properties = node.properties; for (var _i = 0, properties_3 = properties; _i < properties_3.length; _i++) { var p = properties_3[_i]; - if (p.kind === 245 /* PropertyAssignment */ || p.kind === 246 /* ShorthandPropertyAssignment */) { - var name_13 = p.name; - if (name_13.kind === 136 /* ComputedPropertyName */) { - checkComputedPropertyName(name_13); - } - if (isComputedNonLiteralName(name_13)) { - continue; - } - var text = getTextOfPropertyName(name_13); - var type = isTypeAny(sourceType) - ? sourceType - : getTypeOfPropertyOfType(sourceType, text) || - isNumericLiteralName(text) && getIndexTypeOfType(sourceType, 1 /* Number */) || - getIndexTypeOfType(sourceType, 0 /* String */); - if (type) { - if (p.kind === 246 /* ShorthandPropertyAssignment */) { - checkDestructuringAssignment(p, type); - } - else { - // non-shorthand property assignments should always have initializers - checkDestructuringAssignment(p.initializer, type); - } + checkObjectLiteralDestructuringPropertyAssignment(sourceType, p, contextualMapper); + } + return sourceType; + } + function checkObjectLiteralDestructuringPropertyAssignment(objectLiteralType, property, contextualMapper) { + if (property.kind === 253 /* PropertyAssignment */ || property.kind === 254 /* ShorthandPropertyAssignment */) { + var name_13 = property.name; + if (name_13.kind === 140 /* ComputedPropertyName */) { + checkComputedPropertyName(name_13); + } + if (isComputedNonLiteralName(name_13)) { + return undefined; + } + var text = getTextOfPropertyName(name_13); + var type = isTypeAny(objectLiteralType) + ? objectLiteralType + : getTypeOfPropertyOfType(objectLiteralType, text) || + isNumericLiteralName(text) && getIndexTypeOfType(objectLiteralType, 1 /* Number */) || + getIndexTypeOfType(objectLiteralType, 0 /* String */); + if (type) { + if (property.kind === 254 /* ShorthandPropertyAssignment */) { + return checkDestructuringAssignment(property, type); } else { - error(name_13, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(sourceType), ts.declarationNameToString(name_13)); + // non-shorthand property assignments should always have initializers + return checkDestructuringAssignment(property.initializer, type); } } else { - error(p, ts.Diagnostics.Property_assignment_expected); + error(name_13, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(objectLiteralType), ts.declarationNameToString(name_13)); } } - return sourceType; + else { + error(property, ts.Diagnostics.Property_assignment_expected); + } } function checkArrayLiteralAssignment(node, sourceType, contextualMapper) { // This elementType will be used if the specific property corresponding to this index is not @@ -23130,48 +26452,53 @@ var ts; var elementType = checkIteratedTypeOrElementType(sourceType, node, /*allowStringInput*/ false) || unknownType; var elements = node.elements; for (var i = 0; i < elements.length; i++) { - var e = elements[i]; - if (e.kind !== 187 /* OmittedExpression */) { - if (e.kind !== 185 /* SpreadElementExpression */) { - var propName = "" + i; - var type = isTypeAny(sourceType) - ? sourceType - : isTupleLikeType(sourceType) - ? getTypeOfPropertyOfType(sourceType, propName) - : elementType; - if (type) { - checkDestructuringAssignment(e, type, contextualMapper); - } - else { - if (isTupleType(sourceType)) { - error(e, ts.Diagnostics.Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2, typeToString(sourceType), sourceType.elementTypes.length, elements.length); - } - else { - error(e, ts.Diagnostics.Type_0_has_no_property_1, typeToString(sourceType), propName); - } - } + checkArrayLiteralDestructuringElementAssignment(node, sourceType, i, elementType, contextualMapper); + } + return sourceType; + } + function checkArrayLiteralDestructuringElementAssignment(node, sourceType, elementIndex, elementType, contextualMapper) { + var elements = node.elements; + var element = elements[elementIndex]; + if (element.kind !== 193 /* OmittedExpression */) { + if (element.kind !== 191 /* SpreadElementExpression */) { + var propName = "" + elementIndex; + var type = isTypeAny(sourceType) + ? sourceType + : isTupleLikeType(sourceType) + ? getTypeOfPropertyOfType(sourceType, propName) + : elementType; + if (type) { + return checkDestructuringAssignment(element, type, contextualMapper); } else { - if (i < elements.length - 1) { - error(e, ts.Diagnostics.A_rest_element_must_be_last_in_an_array_destructuring_pattern); + if (isTupleType(sourceType)) { + error(element, ts.Diagnostics.Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2, typeToString(sourceType), sourceType.elementTypes.length, elements.length); } else { - var restExpression = e.expression; - if (restExpression.kind === 181 /* BinaryExpression */ && restExpression.operatorToken.kind === 56 /* EqualsToken */) { - error(restExpression.operatorToken, ts.Diagnostics.A_rest_element_cannot_have_an_initializer); - } - else { - checkDestructuringAssignment(restExpression, createArrayType(elementType), contextualMapper); - } + error(element, ts.Diagnostics.Type_0_has_no_property_1, typeToString(sourceType), propName); + } + } + } + else { + if (elementIndex < elements.length - 1) { + error(element, ts.Diagnostics.A_rest_element_must_be_last_in_an_array_destructuring_pattern); + } + else { + var restExpression = element.expression; + if (restExpression.kind === 187 /* BinaryExpression */ && restExpression.operatorToken.kind === 56 /* EqualsToken */) { + error(restExpression.operatorToken, ts.Diagnostics.A_rest_element_cannot_have_an_initializer); + } + else { + return checkDestructuringAssignment(restExpression, createArrayType(elementType), contextualMapper); } } } } - return sourceType; + return undefined; } function checkDestructuringAssignment(exprOrAssignment, sourceType, contextualMapper) { var target; - if (exprOrAssignment.kind === 246 /* ShorthandPropertyAssignment */) { + if (exprOrAssignment.kind === 254 /* ShorthandPropertyAssignment */) { var prop = exprOrAssignment; if (prop.objectAssignmentInitializer) { checkBinaryLikeExpression(prop.name, prop.equalsToken, prop.objectAssignmentInitializer, contextualMapper); @@ -23181,31 +26508,34 @@ var ts; else { target = exprOrAssignment; } - if (target.kind === 181 /* BinaryExpression */ && target.operatorToken.kind === 56 /* EqualsToken */) { + if (target.kind === 187 /* BinaryExpression */ && target.operatorToken.kind === 56 /* EqualsToken */) { checkBinaryExpression(target, contextualMapper); target = target.left; } - if (target.kind === 165 /* ObjectLiteralExpression */) { + if (target.kind === 171 /* ObjectLiteralExpression */) { return checkObjectLiteralAssignment(target, sourceType, contextualMapper); } - if (target.kind === 164 /* ArrayLiteralExpression */) { + if (target.kind === 170 /* ArrayLiteralExpression */) { return checkArrayLiteralAssignment(target, sourceType, contextualMapper); } return checkReferenceAssignment(target, sourceType, contextualMapper); } function checkReferenceAssignment(target, sourceType, contextualMapper) { var targetType = checkExpression(target, contextualMapper); - if (checkReferenceExpression(target, ts.Diagnostics.Invalid_left_hand_side_of_assignment_expression, ts.Diagnostics.Left_hand_side_of_assignment_expression_cannot_be_a_constant)) { + if (checkReferenceExpression(target, ts.Diagnostics.Invalid_left_hand_side_of_assignment_expression, ts.Diagnostics.Left_hand_side_of_assignment_expression_cannot_be_a_constant_or_a_read_only_property)) { checkTypeAssignableTo(sourceType, targetType, target, /*headMessage*/ undefined); } return sourceType; } + function isTypeEqualityComparableTo(source, target) { + return (target.flags & 96 /* Nullable */) !== 0 || isTypeComparableTo(source, target); + } function checkBinaryExpression(node, contextualMapper) { return checkBinaryLikeExpression(node.left, node.operatorToken, node.right, contextualMapper, node); } function checkBinaryLikeExpression(left, operatorToken, right, contextualMapper, errorNode) { var operator = operatorToken.kind; - if (operator === 56 /* EqualsToken */ && (left.kind === 165 /* ObjectLiteralExpression */ || left.kind === 164 /* ArrayLiteralExpression */)) { + if (operator === 56 /* EqualsToken */ && (left.kind === 171 /* ObjectLiteralExpression */ || left.kind === 170 /* ArrayLiteralExpression */)) { return checkDestructuringAssignment(left, checkExpression(right, contextualMapper), contextualMapper); } var leftType = checkExpression(left, contextualMapper); @@ -23239,11 +26569,13 @@ var ts; // as having the primitive type Number. If one operand is the null or undefined value, // it is treated as having the type of the other operand. // The result is always of the Number primitive type. - if (leftType.flags & (32 /* Undefined */ | 64 /* Null */)) + if (leftType.flags & 96 /* Nullable */) leftType = rightType; - if (rightType.flags & (32 /* Undefined */ | 64 /* Null */)) + if (rightType.flags & 96 /* Nullable */) rightType = leftType; - var suggestedOperator; + leftType = getNonNullableType(leftType); + rightType = getNonNullableType(rightType); + var suggestedOperator = void 0; // if a user tries to apply a bitwise operator to 2 boolean operands // try and return them a helpful suggestion if ((leftType.flags & 8 /* Boolean */) && @@ -23266,18 +26598,20 @@ var ts; // The binary + operator requires both operands to be of the Number primitive type or an enum type, // or at least one of the operands to be of type Any or the String primitive type. // If one operand is the null or undefined value, it is treated as having the type of the other operand. - if (leftType.flags & (32 /* Undefined */ | 64 /* Null */)) + if (leftType.flags & 96 /* Nullable */) leftType = rightType; - if (rightType.flags & (32 /* Undefined */ | 64 /* Null */)) + if (rightType.flags & 96 /* Nullable */) rightType = leftType; - var resultType; - if (allConstituentTypesHaveKind(leftType, 132 /* NumberLike */) && allConstituentTypesHaveKind(rightType, 132 /* NumberLike */)) { + leftType = getNonNullableType(leftType); + rightType = getNonNullableType(rightType); + var resultType = void 0; + if (isTypeOfKind(leftType, 132 /* NumberLike */) && isTypeOfKind(rightType, 132 /* NumberLike */)) { // Operands of an enum type are treated as having the primitive type Number. // If both operands are of the Number primitive type, the result is of the Number primitive type. resultType = numberType; } else { - if (allConstituentTypesHaveKind(leftType, 258 /* StringLike */) || allConstituentTypesHaveKind(rightType, 258 /* StringLike */)) { + if (isTypeOfKind(leftType, 258 /* StringLike */) || isTypeOfKind(rightType, 258 /* StringLike */)) { // If one or both operands are of the String primitive type, the result is of the String primitive type. resultType = stringType; } @@ -23303,19 +26637,17 @@ var ts; case 27 /* GreaterThanToken */: case 28 /* LessThanEqualsToken */: case 29 /* GreaterThanEqualsToken */: - if (!checkForDisallowedESSymbolOperand(operator)) { - return booleanType; + if (checkForDisallowedESSymbolOperand(operator)) { + if (!isTypeComparableTo(leftType, rightType) && !isTypeComparableTo(rightType, leftType)) { + reportOperatorError(); + } } - // Fall through + return booleanType; case 30 /* EqualsEqualsToken */: case 31 /* ExclamationEqualsToken */: case 32 /* EqualsEqualsEqualsToken */: case 33 /* ExclamationEqualsEqualsToken */: - // Permit 'number[] | "foo"' to be asserted to 'string'. - if (someConstituentTypeHasKind(leftType, 258 /* StringLike */) && someConstituentTypeHasKind(rightType, 258 /* StringLike */)) { - return booleanType; - } - if (!isTypeAssignableTo(leftType, rightType) && !isTypeAssignableTo(rightType, leftType)) { + if (!isTypeEqualityComparableTo(leftType, rightType) && !isTypeEqualityComparableTo(rightType, leftType)) { reportOperatorError(); } return booleanType; @@ -23324,9 +26656,9 @@ var ts; case 90 /* InKeyword */: return checkInExpression(left, right, leftType, rightType); case 51 /* AmpersandAmpersandToken */: - return rightType; + return addNullableKind(rightType, getNullableKind(leftType)); case 52 /* BarBarToken */: - return getUnionType([leftType, rightType]); + return getUnionType([getNonNullableType(leftType), rightType]); case 56 /* EqualsToken */: checkAssignmentOperator(rightType); return getRegularTypeOfObjectLiteral(rightType); @@ -23335,8 +26667,8 @@ var ts; } // Return true if there was no error, false if there was an error. function checkForDisallowedESSymbolOperand(operator) { - var offendingSymbolOperand = someConstituentTypeHasKind(leftType, 16777216 /* ESSymbol */) ? left : - someConstituentTypeHasKind(rightType, 16777216 /* ESSymbol */) ? right : + var offendingSymbolOperand = maybeTypeOfKind(leftType, 16777216 /* ESSymbol */) ? left : + maybeTypeOfKind(rightType, 16777216 /* ESSymbol */) ? right : undefined; if (offendingSymbolOperand) { error(offendingSymbolOperand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(operator)); @@ -23367,7 +26699,7 @@ var ts; // requires VarExpr to be classified as a reference // A compound assignment furthermore requires VarExpr to be classified as a reference (section 4.1) // and the type of the non - compound operation to be assignable to the type of VarExpr. - var ok = checkReferenceExpression(left, ts.Diagnostics.Invalid_left_hand_side_of_assignment_expression, ts.Diagnostics.Left_hand_side_of_assignment_expression_cannot_be_a_constant); + var ok = checkReferenceExpression(left, ts.Diagnostics.Invalid_left_hand_side_of_assignment_expression, ts.Diagnostics.Left_hand_side_of_assignment_expression_cannot_be_a_constant_or_a_read_only_property); // Use default messages if (ok) { // to avoid cascading errors check assignability only if 'isReference' check succeeded and no errors were reported @@ -23397,7 +26729,7 @@ var ts; function checkYieldExpression(node) { // Grammar checking if (produceDiagnostics) { - if (!(node.parserContextFlags & 2 /* Yield */) || isYieldExpressionInClass(node)) { + if (!(node.flags & 8388608 /* YieldContext */) || isYieldExpressionInClass(node)) { grammarErrorOnFirstToken(node, ts.Diagnostics.A_yield_expression_is_only_allowed_in_a_generator_body); } if (isInParameterInitializerBeforeContainingFunction(node)) { @@ -23410,7 +26742,7 @@ var ts; // we are in a yield context. if (func && func.asteriskToken) { var expressionType = checkExpressionCached(node.expression, /*contextualMapper*/ undefined); - var expressionElementType; + var expressionElementType = void 0; var nodeIsYieldStar = !!node.asteriskToken; if (nodeIsYieldStar) { expressionElementType = checkElementTypeOfIterable(expressionType, node.expression); @@ -23441,7 +26773,7 @@ var ts; function checkStringLiteralExpression(node) { var contextualType = getContextualType(node); if (contextualType && contextualTypeIsStringLiteralType(contextualType)) { - return getStringLiteralType(node); + return getStringLiteralTypeForText(node.text); } return stringType; } @@ -23466,7 +26798,13 @@ var ts; function checkExpressionCached(node, contextualMapper) { var links = getNodeLinks(node); if (!links.resolvedType) { + // When computing a type that we're going to cache, we need to ignore any ongoing control flow + // analysis because variables may have transient types in indeterminable states. Moving flowLoopStart + // to the top of the stack ensures all transient types are computed from a known point. + var saveFlowLoopStart = flowLoopStart; + flowLoopStart = flowLoopCount; links.resolvedType = checkExpression(node, contextualMapper); + flowLoopStart = saveFlowLoopStart; } return links.resolvedType; } @@ -23474,7 +26812,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 136 /* ComputedPropertyName */) { + if (node.name.kind === 140 /* ComputedPropertyName */) { checkComputedPropertyName(node.name); } return checkExpression(node.initializer, contextualMapper); @@ -23485,7 +26823,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 136 /* ComputedPropertyName */) { + if (node.name.kind === 140 /* ComputedPropertyName */) { checkComputedPropertyName(node.name); } var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); @@ -23508,14 +26846,14 @@ var ts; } // Checks an expression and returns its type. The contextualMapper parameter serves two purposes: When // contextualMapper is not undefined and not equal to the identityMapper function object it indicates that the - // expression is being inferentially typed (section 4.12.2 in spec) and provides the type mapper to use in + // expression is being inferentially typed (section 4.15.2 in spec) and provides the type mapper to use in // conjunction with the generic contextual type. When contextualMapper is equal to the identityMapper function // object, it serves as an indicator that all contained function and arrow expressions should be considered to // have the wildcard function type; this form of type check is used during overload resolution to exclude // contextually typed function and arrow expressions in the initial phase. function checkExpression(node, contextualMapper) { var type; - if (node.kind === 135 /* QualifiedName */) { + if (node.kind === 139 /* QualifiedName */) { type = checkQualifiedName(node); } else { @@ -23527,9 +26865,9 @@ var ts; // - 'left' in property access // - 'object' in indexed access // - target in rhs of import statement - var ok = (node.parent.kind === 166 /* PropertyAccessExpression */ && node.parent.expression === node) || - (node.parent.kind === 167 /* ElementAccessExpression */ && node.parent.expression === node) || - ((node.kind === 69 /* Identifier */ || node.kind === 135 /* QualifiedName */) && isInRightSideOfImportOrExportAssignment(node)); + var ok = (node.parent.kind === 172 /* PropertyAccessExpression */ && node.parent.expression === node) || + (node.parent.kind === 173 /* ElementAccessExpression */ && node.parent.expression === node) || + ((node.kind === 69 /* Identifier */ || node.kind === 139 /* QualifiedName */) && isInRightSideOfImportOrExportAssignment(node)); if (!ok) { error(node, ts.Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment); } @@ -23556,7 +26894,7 @@ var ts; return booleanType; case 8 /* NumericLiteral */: return checkNumericLiteral(node); - case 183 /* TemplateExpression */: + case 189 /* TemplateExpression */: return checkTemplateExpression(node); case 9 /* StringLiteral */: return checkStringLiteralExpression(node); @@ -23564,58 +26902,60 @@ var ts; return stringType; case 10 /* RegularExpressionLiteral */: return globalRegExpType; - case 164 /* ArrayLiteralExpression */: + case 170 /* ArrayLiteralExpression */: return checkArrayLiteral(node, contextualMapper); - case 165 /* ObjectLiteralExpression */: + case 171 /* ObjectLiteralExpression */: return checkObjectLiteral(node, contextualMapper); - case 166 /* PropertyAccessExpression */: + case 172 /* PropertyAccessExpression */: return checkPropertyAccessExpression(node); - case 167 /* ElementAccessExpression */: + case 173 /* ElementAccessExpression */: return checkIndexedAccess(node); - case 168 /* CallExpression */: - case 169 /* NewExpression */: + case 174 /* CallExpression */: + case 175 /* NewExpression */: return checkCallExpression(node); - case 170 /* TaggedTemplateExpression */: + case 176 /* TaggedTemplateExpression */: return checkTaggedTemplateExpression(node); - case 172 /* ParenthesizedExpression */: + case 178 /* ParenthesizedExpression */: return checkExpression(node.expression, contextualMapper); - case 186 /* ClassExpression */: + case 192 /* ClassExpression */: return checkClassExpression(node); - case 173 /* FunctionExpression */: - case 174 /* ArrowFunction */: + case 179 /* FunctionExpression */: + case 180 /* ArrowFunction */: return checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); - case 176 /* TypeOfExpression */: + case 182 /* TypeOfExpression */: return checkTypeOfExpression(node); - case 171 /* TypeAssertionExpression */: - case 189 /* AsExpression */: + case 177 /* TypeAssertionExpression */: + case 195 /* AsExpression */: return checkAssertion(node); - case 175 /* DeleteExpression */: + case 196 /* NonNullExpression */: + return checkNonNullAssertion(node); + case 181 /* DeleteExpression */: return checkDeleteExpression(node); - case 177 /* VoidExpression */: + case 183 /* VoidExpression */: return checkVoidExpression(node); - case 178 /* AwaitExpression */: + case 184 /* AwaitExpression */: return checkAwaitExpression(node); - case 179 /* PrefixUnaryExpression */: + case 185 /* PrefixUnaryExpression */: return checkPrefixUnaryExpression(node); - case 180 /* PostfixUnaryExpression */: + case 186 /* PostfixUnaryExpression */: return checkPostfixUnaryExpression(node); - case 181 /* BinaryExpression */: + case 187 /* BinaryExpression */: return checkBinaryExpression(node, contextualMapper); - case 182 /* ConditionalExpression */: + case 188 /* ConditionalExpression */: return checkConditionalExpression(node, contextualMapper); - case 185 /* SpreadElementExpression */: + case 191 /* SpreadElementExpression */: return checkSpreadElementExpression(node, contextualMapper); - case 187 /* OmittedExpression */: + case 193 /* OmittedExpression */: return undefinedType; - case 184 /* YieldExpression */: + case 190 /* YieldExpression */: return checkYieldExpression(node); - case 240 /* JsxExpression */: + case 248 /* JsxExpression */: return checkJsxExpression(node); - case 233 /* JsxElement */: + case 241 /* JsxElement */: return checkJsxElement(node); - case 234 /* JsxSelfClosingElement */: + case 242 /* JsxSelfClosingElement */: return checkJsxSelfClosingElement(node); - case 235 /* JsxOpeningElement */: + case 243 /* JsxOpeningElement */: ts.Debug.fail("Shouldn't ever directly check a JsxOpeningElement"); } return unknownType; @@ -23627,11 +26967,10 @@ var ts; grammarErrorOnFirstToken(node.expression, ts.Diagnostics.Type_expected); } checkSourceElement(node.constraint); + getConstraintOfTypeParameter(getDeclaredTypeOfTypeParameter(getSymbolOfNode(node))); if (produceDiagnostics) { - checkTypeParameterHasIllegalReferencesInConstraint(node); checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_parameter_name_cannot_be_0); } - // TODO: Check multiple declarations are identical } function checkParameter(node) { // Grammar checking @@ -23642,15 +26981,23 @@ var ts; checkGrammarDecorators(node) || checkGrammarModifiers(node); checkVariableLikeDeclaration(node); var func = ts.getContainingFunction(node); - if (node.flags & 56 /* AccessibilityModifier */) { + if (node.flags & 92 /* ParameterPropertyModifier */) { func = ts.getContainingFunction(node); - if (!(func.kind === 144 /* Constructor */ && ts.nodeIsPresent(func.body))) { + if (!(func.kind === 148 /* Constructor */ && ts.nodeIsPresent(func.body))) { error(node, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); } } if (node.questionToken && ts.isBindingPattern(node.name) && func.body) { error(node, ts.Diagnostics.A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature); } + if (node.name.text === "this") { + if (ts.indexOf(func.parameters, node) !== 0) { + error(node, ts.Diagnostics.A_this_parameter_must_be_the_first_parameter); + } + if (func.kind === 148 /* Constructor */ || func.kind === 152 /* ConstructSignature */ || func.kind === 157 /* ConstructorType */) { + error(node, ts.Diagnostics.A_constructor_cannot_have_a_this_parameter); + } + } // Only check rest parameter type if it's not a binding pattern. Since binding patterns are // not allowed in a rest parameter, we already have an error from checkGrammarParameterList. if (node.dotDotDotToken && !ts.isBindingPattern(node.name) && !isArrayType(getTypeOfSymbol(node.symbol))) { @@ -23661,9 +27008,9 @@ var ts; if (!node.asteriskToken || !node.body) { return false; } - return node.kind === 143 /* MethodDeclaration */ || - node.kind === 213 /* FunctionDeclaration */ || - node.kind === 173 /* FunctionExpression */; + return node.kind === 147 /* MethodDeclaration */ || + node.kind === 220 /* FunctionDeclaration */ || + node.kind === 179 /* FunctionExpression */; } function getTypePredicateParameterIndex(parameterList, parameter) { if (parameterList) { @@ -23677,91 +27024,102 @@ var ts; } return -1; } - function isInLegalTypePredicatePosition(node) { - switch (node.parent.kind) { - case 174 /* ArrowFunction */: - case 147 /* CallSignature */: - case 213 /* FunctionDeclaration */: - case 173 /* FunctionExpression */: - case 152 /* FunctionType */: - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - return node === node.parent.type; + function checkTypePredicate(node) { + var parent = getTypePredicateParent(node); + if (!parent) { + // The parent must not be valid. + error(node, ts.Diagnostics.A_type_predicate_is_only_allowed_in_return_type_position_for_functions_and_methods); + return; + } + var typePredicate = getSignatureFromDeclaration(parent).typePredicate; + if (!typePredicate) { + return; + } + var parameterName = node.parameterName; + if (ts.isThisTypePredicate(typePredicate)) { + getTypeFromThisTypeNode(parameterName); + } + else { + if (typePredicate.parameterIndex >= 0) { + if (parent.parameters[typePredicate.parameterIndex].dotDotDotToken) { + error(parameterName, ts.Diagnostics.A_type_predicate_cannot_reference_a_rest_parameter); + } + else { + var leadingError = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.A_type_predicate_s_type_must_be_assignable_to_its_parameter_s_type); + checkTypeAssignableTo(typePredicate.type, getTypeOfNode(parent.parameters[typePredicate.parameterIndex]), node.type, + /*headMessage*/ undefined, leadingError); + } + } + else if (parameterName) { + var hasReportedError = false; + for (var _i = 0, _a = parent.parameters; _i < _a.length; _i++) { + var name_14 = _a[_i].name; + if (ts.isBindingPattern(name_14) && + checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_14, parameterName, typePredicate.parameterName)) { + hasReportedError = true; + break; + } + } + if (!hasReportedError) { + error(node.parameterName, ts.Diagnostics.Cannot_find_parameter_0, typePredicate.parameterName); + } + } + } + } + function getTypePredicateParent(node) { + switch (node.parent.kind) { + case 180 /* ArrowFunction */: + case 151 /* CallSignature */: + case 220 /* FunctionDeclaration */: + case 179 /* FunctionExpression */: + case 156 /* FunctionType */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: + var parent_10 = node.parent; + if (node === parent_10.type) { + return parent_10; + } + } + } + function checkIfTypePredicateVariableIsDeclaredInBindingPattern(pattern, predicateVariableNode, predicateVariableName) { + for (var _i = 0, _a = pattern.elements; _i < _a.length; _i++) { + var name_15 = _a[_i].name; + if (name_15.kind === 69 /* Identifier */ && + name_15.text === predicateVariableName) { + error(predicateVariableNode, ts.Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, predicateVariableName); + return true; + } + else if (name_15.kind === 168 /* ArrayBindingPattern */ || + name_15.kind === 167 /* ObjectBindingPattern */) { + if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_15, predicateVariableNode, predicateVariableName)) { + return true; + } + } } - return false; } function checkSignatureDeclaration(node) { // Grammar checking - if (node.kind === 149 /* IndexSignature */) { + if (node.kind === 153 /* IndexSignature */) { checkGrammarIndexSignature(node); } - else if (node.kind === 152 /* FunctionType */ || node.kind === 213 /* FunctionDeclaration */ || node.kind === 153 /* ConstructorType */ || - node.kind === 147 /* CallSignature */ || node.kind === 144 /* Constructor */ || - node.kind === 148 /* ConstructSignature */) { + else if (node.kind === 156 /* FunctionType */ || node.kind === 220 /* FunctionDeclaration */ || node.kind === 157 /* ConstructorType */ || + node.kind === 151 /* CallSignature */ || node.kind === 148 /* Constructor */ || + node.kind === 152 /* ConstructSignature */) { checkGrammarFunctionLikeDeclaration(node); } checkTypeParameters(node.typeParameters); ts.forEach(node.parameters, checkParameter); if (node.type) { - if (node.type.kind === 150 /* TypePredicate */) { - var typePredicate = getSignatureFromDeclaration(node).typePredicate; - var typePredicateNode = node.type; - if (isInLegalTypePredicatePosition(typePredicateNode)) { - if (typePredicate.parameterIndex >= 0) { - if (node.parameters[typePredicate.parameterIndex].dotDotDotToken) { - error(typePredicateNode.parameterName, ts.Diagnostics.A_type_predicate_cannot_reference_a_rest_parameter); - } - else { - checkTypeAssignableTo(typePredicate.type, getTypeOfNode(node.parameters[typePredicate.parameterIndex]), typePredicateNode.type); - } - } - else if (typePredicateNode.parameterName) { - var hasReportedError = false; - for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) { - var param = _a[_i]; - if (hasReportedError) { - break; - } - if (param.name.kind === 161 /* ObjectBindingPattern */ || - param.name.kind === 162 /* ArrayBindingPattern */) { - (function checkBindingPattern(pattern) { - for (var _i = 0, _a = pattern.elements; _i < _a.length; _i++) { - var element = _a[_i]; - if (element.name.kind === 69 /* Identifier */ && - element.name.text === typePredicate.parameterName) { - error(typePredicateNode.parameterName, ts.Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, typePredicate.parameterName); - hasReportedError = true; - break; - } - else if (element.name.kind === 162 /* ArrayBindingPattern */ || - element.name.kind === 161 /* ObjectBindingPattern */) { - checkBindingPattern(element.name); - } - } - })(param.name); - } - } - if (!hasReportedError) { - error(typePredicateNode.parameterName, ts.Diagnostics.Cannot_find_parameter_0, typePredicate.parameterName); - } - } - } - else { - error(typePredicateNode, ts.Diagnostics.A_type_predicate_is_only_allowed_in_return_type_position_for_functions_and_methods); - } - } - else { - checkSourceElement(node.type); - } + checkSourceElement(node.type); } if (produceDiagnostics) { checkCollisionWithArgumentsInGeneratedCode(node); if (compilerOptions.noImplicitAny && !node.type) { switch (node.kind) { - case 148 /* ConstructSignature */: + case 152 /* ConstructSignature */: error(node, ts.Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; - case 147 /* CallSignature */: + case 151 /* CallSignature */: error(node, ts.Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; } @@ -23784,12 +27142,14 @@ var ts; checkTypeAssignableTo(iterableIteratorInstantiation, returnType, node.type); } } + else if (ts.isAsyncFunctionLike(node)) { + checkAsyncFunctionReturnType(node); + } } } - checkSpecializedSignatureDeclaration(node); } function checkTypeForDuplicateIndexSignatures(node) { - if (node.kind === 215 /* InterfaceDeclaration */) { + if (node.kind === 222 /* InterfaceDeclaration */) { var nodeSymbol = getSymbolOfNode(node); // in case of merging interface declaration it is possible that we'll enter this check procedure several times for every declaration // to prevent this run check only for the first declaration of a given kind @@ -23809,7 +27169,7 @@ var ts; var declaration = decl; if (declaration.parameters.length === 1 && declaration.parameters[0].type) { switch (declaration.parameters[0].type.kind) { - case 130 /* StringKeyword */: + case 132 /* StringKeyword */: if (!seenStringIndexer) { seenStringIndexer = true; } @@ -23817,7 +27177,7 @@ var ts; error(declaration, ts.Diagnostics.Duplicate_string_index_signature); } break; - case 128 /* NumberKeyword */: + case 130 /* NumberKeyword */: if (!seenNumericIndexer) { seenNumericIndexer = true; } @@ -23839,7 +27199,7 @@ var ts; // Grammar checking checkGrammarMethod(node) || checkGrammarComputedPropertyName(node.name); // Grammar checking for modifiers is done inside the function checkGrammarFunctionLikeDeclaration - checkFunctionLikeDeclaration(node); + checkFunctionOrMethodDeclaration(node); // Abstract methods cannot have an implementation. // Extra checks are to avoid reporting multiple errors relating to the "abstractness" of the node. if (node.flags & 128 /* Abstract */ && node.body) { @@ -23849,7 +27209,7 @@ var ts; function checkConstructorDeclaration(node) { // Grammar check on signature of constructor and modifier of the constructor is done in checkSignatureDeclaration function. checkSignatureDeclaration(node); - // Grammar check for checking only related to constructoDeclaration + // Grammar check for checking only related to constructorDeclaration checkGrammarConstructorTypeParameters(node) || checkGrammarConstructorTypeAnnotation(node); checkSourceElement(node.body); var symbol = getSymbolOfNode(node); @@ -23865,14 +27225,11 @@ var ts; if (!produceDiagnostics) { return; } - function isSuperCallExpression(n) { - return n.kind === 168 /* CallExpression */ && n.expression.kind === 95 /* SuperKeyword */; - } function containsSuperCallAsComputedPropertyName(n) { return n.name && containsSuperCall(n.name); } function containsSuperCall(n) { - if (isSuperCallExpression(n)) { + if (ts.isSuperCallExpression(n)) { return true; } else if (ts.isFunctionLike(n)) { @@ -23887,13 +27244,13 @@ var ts; if (n.kind === 97 /* ThisKeyword */) { error(n, ts.Diagnostics.this_cannot_be_referenced_in_current_location); } - else if (n.kind !== 173 /* FunctionExpression */ && n.kind !== 213 /* FunctionDeclaration */) { + else if (n.kind !== 179 /* FunctionExpression */ && n.kind !== 220 /* FunctionDeclaration */) { ts.forEachChild(n, markThisReferencesAsErrors); } } function isInstancePropertyWithInitializer(n) { - return n.kind === 141 /* PropertyDeclaration */ && - !(n.flags & 64 /* Static */) && + return n.kind === 145 /* PropertyDeclaration */ && + !(n.flags & 32 /* Static */) && !!n.initializer; } // TS 1.0 spec (April 2014): 8.3.2 @@ -23901,12 +27258,11 @@ var ts; // constructors of derived classes must contain at least one super call somewhere in their function body. var containingClassDecl = node.parent; if (ts.getClassExtendsHeritageClauseElement(containingClassDecl)) { - var containingClassSymbol = getSymbolOfNode(containingClassDecl); - var containingClassInstanceType = getDeclaredTypeOfSymbol(containingClassSymbol); - var baseConstructorType = getBaseConstructorTypeOfClass(containingClassInstanceType); - if (containsSuperCall(node.body)) { - if (baseConstructorType === nullType) { - error(node, ts.Diagnostics.A_constructor_cannot_contain_a_super_call_when_its_class_extends_null); + var classExtendsNull = classDeclarationExtendsNull(containingClassDecl); + var superCall = getSuperCallInConstructor(node); + if (superCall) { + if (classExtendsNull) { + error(superCall, ts.Diagnostics.A_constructor_cannot_contain_a_super_call_when_its_class_extends_null); } // The first statement in the body of a constructor (excluding prologue directives) must be a super call // if both of the following are true: @@ -23914,15 +27270,15 @@ var ts; // - The constructor declares parameter properties // or the containing class declares instance member variables with initializers. var superCallShouldBeFirst = ts.forEach(node.parent.members, isInstancePropertyWithInitializer) || - ts.forEach(node.parameters, function (p) { return p.flags & (8 /* Public */ | 16 /* Private */ | 32 /* Protected */); }); + ts.forEach(node.parameters, function (p) { return p.flags & 92 /* ParameterPropertyModifier */; }); // Skip past any prologue directives to find the first statement // to ensure that it was a super call. if (superCallShouldBeFirst) { var statements = node.body.statements; - var superCallStatement; + var superCallStatement = void 0; for (var _i = 0, statements_2 = statements; _i < statements_2.length; _i++) { var statement = statements_2[_i]; - if (statement.kind === 195 /* ExpressionStatement */ && isSuperCallExpression(statement.expression)) { + if (statement.kind === 202 /* ExpressionStatement */ && ts.isSuperCallExpression(statement.expression)) { superCallStatement = statement; break; } @@ -23933,13 +27289,9 @@ var ts; if (!superCallStatement) { error(node, ts.Diagnostics.A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties); } - else { - // In such a required super call, it is a compile-time error for argument expressions to reference this. - markThisReferencesAsErrors(superCallStatement.expression); - } } } - else if (baseConstructorType !== nullType) { + else if (!classExtendsNull) { error(node, ts.Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call); } } @@ -23948,9 +27300,11 @@ var ts; if (produceDiagnostics) { // Grammar checking accessors checkGrammarFunctionLikeDeclaration(node) || checkGrammarAccessor(node) || checkGrammarComputedPropertyName(node.name); - if (node.kind === 145 /* GetAccessor */) { - if (!ts.isInAmbientContext(node) && ts.nodeIsPresent(node.body) && (node.flags & 524288 /* HasImplicitReturn */)) { - if (node.flags & 1048576 /* HasExplicitReturn */) { + checkDecorators(node); + checkSignatureDeclaration(node); + if (node.kind === 149 /* GetAccessor */) { + if (!ts.isInAmbientContext(node) && ts.nodeIsPresent(node.body) && (node.flags & 32768 /* HasImplicitReturn */)) { + if (node.flags & 65536 /* HasExplicitReturn */) { if (compilerOptions.noImplicitReturns) { error(node.name, ts.Diagnostics.Not_all_code_paths_return_a_value); } @@ -23960,40 +27314,65 @@ var ts; } } } + // Do not use hasDynamicName here, because that returns false for well known symbols. + // We want to perform checkComputedPropertyName for all computed properties, including + // well known symbols. + if (node.name.kind === 140 /* ComputedPropertyName */) { + checkComputedPropertyName(node.name); + } if (!ts.hasDynamicName(node)) { // TypeScript 1.0 spec (April 2014): 8.4.3 // Accessors for the same member name must specify the same accessibility. - var otherKind = node.kind === 145 /* GetAccessor */ ? 146 /* SetAccessor */ : 145 /* GetAccessor */; + var otherKind = node.kind === 149 /* GetAccessor */ ? 150 /* SetAccessor */ : 149 /* GetAccessor */; var otherAccessor = ts.getDeclarationOfKind(node.symbol, otherKind); if (otherAccessor) { - if (((node.flags & 56 /* AccessibilityModifier */) !== (otherAccessor.flags & 56 /* AccessibilityModifier */))) { + if (((node.flags & 28 /* AccessibilityModifier */) !== (otherAccessor.flags & 28 /* AccessibilityModifier */))) { error(node.name, ts.Diagnostics.Getter_and_setter_accessors_do_not_agree_in_visibility); } - var currentAccessorType = getAnnotatedAccessorType(node); - var otherAccessorType = getAnnotatedAccessorType(otherAccessor); + if (((node.flags & 128 /* Abstract */) !== (otherAccessor.flags & 128 /* Abstract */))) { + error(node.name, ts.Diagnostics.Accessors_must_both_be_abstract_or_non_abstract); + } // TypeScript 1.0 spec (April 2014): 4.5 // If both accessors include type annotations, the specified types must be identical. - if (currentAccessorType && otherAccessorType) { - if (!isTypeIdenticalTo(currentAccessorType, otherAccessorType)) { - error(node, ts.Diagnostics.get_and_set_accessor_must_have_the_same_type); - } - } + checkAccessorDeclarationTypesIdentical(node, otherAccessor, getAnnotatedAccessorType, ts.Diagnostics.get_and_set_accessor_must_have_the_same_type); + checkAccessorDeclarationTypesIdentical(node, otherAccessor, getAnnotatedAccessorThisType, ts.Diagnostics.get_and_set_accessor_must_have_the_same_this_type); } } getTypeOfAccessors(getSymbolOfNode(node)); } - checkFunctionLikeDeclaration(node); + if (node.parent.kind !== 171 /* ObjectLiteralExpression */) { + checkSourceElement(node.body); + } + else { + checkNodeDeferred(node); + } + } + function checkAccessorDeclarationTypesIdentical(first, second, getAnnotatedType, message) { + var firstType = getAnnotatedType(first); + var secondType = getAnnotatedType(second); + if (firstType && secondType && !isTypeIdenticalTo(firstType, secondType)) { + error(first, message); + } + } + function checkAccessorDeferred(node) { + checkSourceElement(node.body); } function checkMissingDeclaration(node) { checkDecorators(node); } - function checkTypeArgumentConstraints(typeParameters, typeArguments) { + function checkTypeArgumentConstraints(typeParameters, typeArgumentNodes) { + var typeArguments; + var mapper; var result = true; for (var i = 0; i < typeParameters.length; i++) { var constraint = getConstraintOfTypeParameter(typeParameters[i]); if (constraint) { + if (!typeArguments) { + typeArguments = ts.map(typeArgumentNodes, getTypeFromTypeNode); + mapper = createTypeMapper(typeParameters, typeArguments); + } var typeArgument = typeArguments[i]; - result = result && checkTypeAssignableTo(getTypeFromTypeNode(typeArgument), constraint, typeArgument, ts.Diagnostics.Type_0_does_not_satisfy_the_constraint_1); + result = result && checkTypeAssignableTo(typeArgument, getTypeWithThisArgument(instantiateType(constraint, mapper), typeArgument), typeArgumentNodes[i], ts.Diagnostics.Type_0_does_not_satisfy_the_constraint_1); } } return result; @@ -24037,59 +27416,21 @@ var ts; ts.forEach(node.types, checkSourceElement); } function isPrivateWithinAmbient(node) { - return (node.flags & 16 /* Private */) && ts.isInAmbientContext(node); - } - function checkSpecializedSignatureDeclaration(signatureDeclarationNode) { - if (!produceDiagnostics) { - return; - } - var signature = getSignatureFromDeclaration(signatureDeclarationNode); - if (!signature.hasStringLiterals) { - return; - } - // TypeScript 1.0 spec (April 2014): 3.7.2.2 - // Specialized signatures are not permitted in conjunction with a function body - if (ts.nodeIsPresent(signatureDeclarationNode.body)) { - error(signatureDeclarationNode, ts.Diagnostics.A_signature_with_an_implementation_cannot_use_a_string_literal_type); - return; - } - // TypeScript 1.0 spec (April 2014): 3.7.2.4 - // Every specialized call or construct signature in an object type must be assignable - // to at least one non-specialized call or construct signature in the same object type - var signaturesToCheck; - // Unnamed (call\construct) signatures in interfaces are inherited and not shadowed so examining just node symbol won't give complete answer. - // Use declaring type to obtain full list of signatures. - if (!signatureDeclarationNode.name && signatureDeclarationNode.parent && signatureDeclarationNode.parent.kind === 215 /* InterfaceDeclaration */) { - ts.Debug.assert(signatureDeclarationNode.kind === 147 /* CallSignature */ || signatureDeclarationNode.kind === 148 /* ConstructSignature */); - var signatureKind = signatureDeclarationNode.kind === 147 /* CallSignature */ ? 0 /* Call */ : 1 /* Construct */; - var containingSymbol = getSymbolOfNode(signatureDeclarationNode.parent); - var containingType = getDeclaredTypeOfSymbol(containingSymbol); - signaturesToCheck = getSignaturesOfType(containingType, signatureKind); - } - else { - signaturesToCheck = getSignaturesOfSymbol(getSymbolOfNode(signatureDeclarationNode)); - } - for (var _i = 0, signaturesToCheck_1 = signaturesToCheck; _i < signaturesToCheck_1.length; _i++) { - var otherSignature = signaturesToCheck_1[_i]; - if (!otherSignature.hasStringLiterals && isSignatureAssignableTo(signature, otherSignature)) { - return; - } - } - error(signatureDeclarationNode, ts.Diagnostics.Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature); + return (node.flags & 8 /* Private */) && ts.isInAmbientContext(node); } function getEffectiveDeclarationFlags(n, flagsToCheck) { var flags = ts.getCombinedNodeFlags(n); // children of classes (even ambient classes) should not be marked as ambient or export // because those flags have no useful semantics there. - if (n.parent.kind !== 215 /* InterfaceDeclaration */ && - n.parent.kind !== 214 /* ClassDeclaration */ && - n.parent.kind !== 186 /* ClassExpression */ && + if (n.parent.kind !== 222 /* InterfaceDeclaration */ && + n.parent.kind !== 221 /* ClassDeclaration */ && + n.parent.kind !== 192 /* ClassExpression */ && ts.isInAmbientContext(n)) { - if (!(flags & 4 /* Ambient */)) { + if (!(flags & 2 /* Ambient */)) { // It is nested in an ambient context, which means it is automatically exported - flags |= 2 /* Export */; + flags |= 1 /* Export */; } - flags |= 4 /* Ambient */; + flags |= 2 /* Ambient */; } return flags & flagsToCheck; } @@ -24111,36 +27452,36 @@ var ts; // deviations, we XOR someOverloadFlags with allOverloadFlags var someButNotAllOverloadFlags = someOverloadFlags ^ allOverloadFlags; if (someButNotAllOverloadFlags !== 0) { - var canonicalFlags = getEffectiveDeclarationFlags(getCanonicalOverload(overloads, implementation), flagsToCheck); + var canonicalFlags_1 = getEffectiveDeclarationFlags(getCanonicalOverload(overloads, implementation), flagsToCheck); ts.forEach(overloads, function (o) { - var deviation = getEffectiveDeclarationFlags(o, flagsToCheck) ^ canonicalFlags; - if (deviation & 2 /* Export */) { - error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_exported_or_not_exported); + var deviation = getEffectiveDeclarationFlags(o, flagsToCheck) ^ canonicalFlags_1; + if (deviation & 1 /* Export */) { + error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_exported_or_non_exported); } - else if (deviation & 4 /* Ambient */) { + else if (deviation & 2 /* Ambient */) { error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_ambient_or_non_ambient); } - else if (deviation & (16 /* Private */ | 32 /* Protected */)) { - error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_public_private_or_protected); + else if (deviation & (8 /* Private */ | 16 /* Protected */)) { + error(o.name || o, ts.Diagnostics.Overload_signatures_must_all_be_public_private_or_protected); } else if (deviation & 128 /* Abstract */) { - error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_abstract_or_not_abstract); + error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_abstract_or_non_abstract); } }); } } function checkQuestionTokenAgreementBetweenOverloads(overloads, implementation, someHaveQuestionToken, allHaveQuestionToken) { if (someHaveQuestionToken !== allHaveQuestionToken) { - var canonicalHasQuestionToken = ts.hasQuestionToken(getCanonicalOverload(overloads, implementation)); + var canonicalHasQuestionToken_1 = ts.hasQuestionToken(getCanonicalOverload(overloads, implementation)); ts.forEach(overloads, function (o) { - var deviation = ts.hasQuestionToken(o) !== canonicalHasQuestionToken; + var deviation = ts.hasQuestionToken(o) !== canonicalHasQuestionToken_1; if (deviation) { error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_optional_or_required); } }); } } - var flagsToCheck = 2 /* Export */ | 4 /* Ambient */ | 16 /* Private */ | 32 /* Protected */ | 128 /* Abstract */; + var flagsToCheck = 1 /* Export */ | 2 /* Ambient */ | 8 /* Private */ | 16 /* Protected */ | 128 /* Abstract */; var someNodeFlags = 0; var allNodeFlags = flagsToCheck; var someHaveQuestionToken = false; @@ -24164,16 +27505,23 @@ var ts; seen = c === node; } }); - if (subsequentNode) { + // We may be here because of some extra nodes between overloads that could not be parsed into a valid node. + // In this case the subsequent node is not really consecutive (.pos !== node.end), and we must ignore it here. + if (subsequentNode && subsequentNode.pos === node.end) { if (subsequentNode.kind === node.kind) { var errorNode_1 = subsequentNode.name || subsequentNode; // TODO(jfreeman): These are methods, so handle computed name case if (node.name && subsequentNode.name && node.name.text === subsequentNode.name.text) { - // the only situation when this is possible (same kind\same name but different symbol) - mixed static and instance class members - ts.Debug.assert(node.kind === 143 /* MethodDeclaration */ || node.kind === 142 /* MethodSignature */); - ts.Debug.assert((node.flags & 64 /* Static */) !== (subsequentNode.flags & 64 /* Static */)); - var diagnostic = node.flags & 64 /* Static */ ? ts.Diagnostics.Function_overload_must_be_static : ts.Diagnostics.Function_overload_must_not_be_static; - error(errorNode_1, diagnostic); + var reportError = (node.kind === 147 /* MethodDeclaration */ || node.kind === 146 /* MethodSignature */) && + (node.flags & 32 /* Static */) !== (subsequentNode.flags & 32 /* Static */); + // we can get here in two cases + // 1. mixed static and instance class members + // 2. something with the same name was defined before the set of overloads that prevents them from merging + // here we'll report error only for the first case since for second we should already report error in binder + if (reportError) { + var diagnostic = node.flags & 32 /* Static */ ? ts.Diagnostics.Function_overload_must_be_static : ts.Diagnostics.Function_overload_must_not_be_static; + error(errorNode_1, diagnostic); + } return; } else if (ts.nodeIsPresent(subsequentNode.body)) { @@ -24206,7 +27554,7 @@ var ts; var current = declarations_4[_i]; var node = current; var inAmbientContext = ts.isInAmbientContext(node); - var inAmbientContextOrInterface = node.parent.kind === 215 /* InterfaceDeclaration */ || node.parent.kind === 155 /* TypeLiteral */ || inAmbientContext; + var inAmbientContextOrInterface = node.parent.kind === 222 /* InterfaceDeclaration */ || node.parent.kind === 159 /* TypeLiteral */ || inAmbientContext; if (inAmbientContextOrInterface) { // check if declarations are consecutive only if they are non-ambient // 1. ambient declarations can be interleaved @@ -24217,7 +27565,7 @@ var ts; // 2. mixing ambient and non-ambient declarations is a separate error that will be reported - do not want to report an extra one previousDeclaration = undefined; } - if (node.kind === 213 /* FunctionDeclaration */ || node.kind === 143 /* MethodDeclaration */ || node.kind === 142 /* MethodSignature */ || node.kind === 144 /* Constructor */) { + if (node.kind === 220 /* FunctionDeclaration */ || node.kind === 147 /* MethodDeclaration */ || node.kind === 146 /* MethodSignature */ || node.kind === 148 /* Constructor */) { var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; allNodeFlags &= currentNodeFlags; @@ -24260,7 +27608,7 @@ var ts; } // Abstract methods can't have an implementation -- in particular, they don't need one. if (!isExportSymbolInsideModule && lastSeenNonAmbientDeclaration && !lastSeenNonAmbientDeclaration.body && - !(lastSeenNonAmbientDeclaration.flags & 128 /* Abstract */)) { + !(lastSeenNonAmbientDeclaration.flags & 128 /* Abstract */) && !lastSeenNonAmbientDeclaration.questionToken) { reportImplementationExpectedError(lastSeenNonAmbientDeclaration); } if (hasOverloads) { @@ -24269,29 +27617,11 @@ var ts; if (bodyDeclaration) { var signatures = getSignaturesOfSymbol(symbol); var bodySignature = getSignatureFromDeclaration(bodyDeclaration); - // If the implementation signature has string literals, we will have reported an error in - // checkSpecializedSignatureDeclaration - if (!bodySignature.hasStringLiterals) { - // TypeScript 1.0 spec (April 2014): 6.1 - // If a function declaration includes overloads, the overloads determine the call - // signatures of the type given to the function object - // and the function implementation signature must be assignable to that type - // - // TypeScript 1.0 spec (April 2014): 3.8.4 - // Note that specialized call and construct signatures (section 3.7.2.4) are not significant when determining assignment compatibility - // Consider checking against specialized signatures too. Not doing so creates a type hole: - // - // function g(x: "hi", y: boolean); - // function g(x: string, y: {}); - // function g(x: string, y: string) { } - // - // The implementation is completely unrelated to the specialized signature, yet we do not check this. - for (var _a = 0, signatures_3 = signatures; _a < signatures_3.length; _a++) { - var signature = signatures_3[_a]; - if (!signature.hasStringLiterals && !isSignatureAssignableTo(bodySignature, signature)) { - error(signature.declaration, ts.Diagnostics.Overload_signature_is_not_compatible_with_function_implementation); - break; - } + for (var _a = 0, signatures_3 = signatures; _a < signatures_3.length; _a++) { + var signature = signatures_3[_a]; + if (!isImplementationCompatibleWithOverload(bodySignature, signature)) { + error(signature.declaration, ts.Diagnostics.Overload_signature_is_not_compatible_with_function_implementation); + break; } } } @@ -24324,8 +27654,8 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var d = _a[_i]; var declarationSpaces = getDeclarationSpaces(d); - var effectiveDeclarationFlags = getEffectiveDeclarationFlags(d, 2 /* Export */ | 512 /* Default */); - if (effectiveDeclarationFlags & 2 /* Export */) { + var effectiveDeclarationFlags = getEffectiveDeclarationFlags(d, 1 /* Export */ | 512 /* Default */); + if (effectiveDeclarationFlags & 1 /* Export */) { if (effectiveDeclarationFlags & 512 /* Default */) { defaultExportedDeclarationSpaces |= declarationSpaces; } @@ -24337,7 +27667,7 @@ var ts; nonExportedDeclarationSpaces |= declarationSpaces; } } - // Spaces for anyting not declared a 'default export'. + // Spaces for anything not declared a 'default export'. var nonDefaultExportedDeclarationSpaces = exportedDeclarationSpaces | nonExportedDeclarationSpaces; var commonDeclarationSpacesForExportsAndLocals = exportedDeclarationSpaces & nonExportedDeclarationSpaces; var commonDeclarationSpacesForDefaultAndNonDefault = defaultExportedDeclarationSpaces & nonDefaultExportedDeclarationSpaces; @@ -24346,7 +27676,7 @@ var ts; for (var _b = 0, _c = symbol.declarations; _b < _c.length; _b++) { var d = _c[_b]; var declarationSpaces = getDeclarationSpaces(d); - // Only error on the declarations that conributed to the intersecting spaces. + // Only error on the declarations that contributed to the intersecting spaces. if (declarationSpaces & commonDeclarationSpacesForDefaultAndNonDefault) { error(d.name, ts.Diagnostics.Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead, ts.declarationNameToString(d.name)); } @@ -24357,20 +27687,20 @@ var ts; } function getDeclarationSpaces(d) { switch (d.kind) { - case 215 /* InterfaceDeclaration */: + case 222 /* InterfaceDeclaration */: return 2097152 /* ExportType */; - case 218 /* ModuleDeclaration */: - return d.name.kind === 9 /* StringLiteral */ || ts.getModuleInstanceState(d) !== 0 /* NonInstantiated */ + case 225 /* ModuleDeclaration */: + return ts.isAmbientModule(d) || ts.getModuleInstanceState(d) !== 0 /* NonInstantiated */ ? 4194304 /* ExportNamespace */ | 1048576 /* ExportValue */ : 4194304 /* ExportNamespace */; - case 214 /* ClassDeclaration */: - case 217 /* EnumDeclaration */: + case 221 /* ClassDeclaration */: + case 224 /* EnumDeclaration */: return 2097152 /* ExportType */ | 1048576 /* ExportValue */; - case 221 /* ImportEqualsDeclaration */: - var result = 0; + case 229 /* ImportEqualsDeclaration */: + var result_1 = 0; var target = resolveAlias(getSymbolOfNode(d)); - ts.forEach(target.declarations, function (d) { result |= getDeclarationSpaces(d); }); - return result; + ts.forEach(target.declarations, function (d) { result_1 |= getDeclarationSpaces(d); }); + return result_1; default: return 1048576 /* ExportValue */; } @@ -24422,7 +27752,7 @@ var ts; if (thenSignatures.length === 0) { return undefined; } - var onfulfilledParameterType = getUnionType(ts.map(thenSignatures, getTypeOfFirstParameterOfSignature)); + var onfulfilledParameterType = getTypeWithFacts(getUnionType(ts.map(thenSignatures, getTypeOfFirstParameterOfSignature)), 131072 /* NEUndefined */); if (onfulfilledParameterType.flags & 1 /* Any */) { return undefined; } @@ -24478,7 +27808,7 @@ var ts; return checkNonThenableType(type, location, message); } else { - if (type.id === promisedType.id || awaitedTypeStack.indexOf(promisedType.id) >= 0) { + if (type.id === promisedType.id || ts.indexOf(awaitedTypeStack, promisedType.id) >= 0) { // We have a bad actor in the form of a promise whose promised type is // the same promise type, or a mutually recursive promise. Return the // unknown type as we cannot guess the shape. If this were the actual @@ -24527,6 +27857,33 @@ var ts; } } } + /** + * Checks that the return type provided is an instantiation of the global Promise type + * and returns the awaited type of the return type. + * + * @param returnType The return type of a FunctionLikeDeclaration + * @param location The node on which to report the error. + */ + function checkCorrectPromiseType(returnType, location) { + if (returnType === unknownType) { + // The return type already had some other error, so we ignore and return + // the unknown type. + return unknownType; + } + var globalPromiseType = getGlobalPromiseType(); + if (globalPromiseType === emptyGenericType + || globalPromiseType === getTargetType(returnType)) { + // Either we couldn't resolve the global promise type, which would have already + // reported an error, or we could resolve it and the return type is a valid type + // reference to the global type. In either case, we return the awaited type for + // the return type. + return checkAwaitedType(returnType, location, ts.Diagnostics.An_async_function_or_method_must_have_a_valid_awaitable_return_type); + } + // The promise type was not a valid type reference to the global promise type, so we + // report an error and return the unknown type. + error(location, ts.Diagnostics.The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type); + return unknownType; + } /** * Checks the return type of an async function to ensure it is a compatible * Promise implementation. @@ -24541,6 +27898,10 @@ var ts; * callable `then` signature. */ function checkAsyncFunctionReturnType(node) { + if (languageVersion >= 2 /* ES6 */) { + var returnType = getTypeFromTypeNode(node.type); + return checkCorrectPromiseType(returnType, node.type); + } var globalPromiseConstructorLikeType = getGlobalPromiseConstructorLikeType(); if (globalPromiseConstructorLikeType === emptyObjectType) { // If we couldn't resolve the global PromiseConstructorLike type we cannot verify @@ -24587,6 +27948,8 @@ var ts; error(node, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type, typeName); return unknownType; } + // If the Promise constructor, resolved locally, is an alias symbol we should mark it as referenced. + checkReturnTypeAnnotationAsExpression(node); // Validate the promise constructor type. var promiseConstructorType = getTypeOfSymbol(promiseConstructor); if (!checkTypeAssignableTo(promiseConstructorType, globalPromiseConstructorLikeType, node, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type)) { @@ -24594,10 +27957,10 @@ var ts; } // Verify there is no local declaration that could collide with the promise constructor. var promiseName = ts.getEntityNameFromTypeNode(node.type); - var root = getFirstIdentifier(promiseName); - var rootSymbol = getSymbol(node.locals, root.text, 107455 /* Value */); + var promiseNameOrNamespaceRoot = getFirstIdentifier(promiseName); + var rootSymbol = getSymbol(node.locals, promiseNameOrNamespaceRoot.text, 107455 /* Value */); if (rootSymbol) { - error(rootSymbol.valueDeclaration, ts.Diagnostics.Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions, root.text, getFullyQualifiedName(promiseConstructor)); + error(rootSymbol.valueDeclaration, ts.Diagnostics.Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions, promiseNameOrNamespaceRoot.text, getFullyQualifiedName(promiseConstructor)); return unknownType; } // Get and return the awaited type of the return type. @@ -24614,22 +27977,22 @@ var ts; var headMessage = getDiagnosticHeadMessageForDecoratorResolution(node); var errorInfo; switch (node.parent.kind) { - case 214 /* ClassDeclaration */: + case 221 /* ClassDeclaration */: var classSymbol = getSymbolOfNode(node.parent); var classConstructorType = getTypeOfSymbol(classSymbol); expectedReturnType = getUnionType([classConstructorType, voidType]); break; - case 138 /* Parameter */: + case 142 /* Parameter */: expectedReturnType = voidType; errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any); break; - case 141 /* PropertyDeclaration */: + case 145 /* PropertyDeclaration */: expectedReturnType = voidType; errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.The_return_type_of_a_property_decorator_function_must_be_either_void_or_any); break; - case 143 /* MethodDeclaration */: - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: + case 147 /* MethodDeclaration */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: var methodType = getTypeOfNode(node.parent); var descriptorType = createTypedPropertyDescriptorType(methodType); expectedReturnType = getUnionType([descriptorType, voidType]); @@ -24642,9 +28005,9 @@ var ts; // When we are emitting type metadata for decorators, we need to try to check the type // as if it were an expression so that we can emit the type in a value position when we // serialize the type metadata. - if (node && node.kind === 151 /* TypeReference */) { + if (node && node.kind === 155 /* TypeReference */) { var root = getFirstIdentifier(node.typeName); - var meaning = root.parent.kind === 151 /* TypeReference */ ? 793056 /* Type */ : 1536 /* Namespace */; + var meaning = root.parent.kind === 155 /* TypeReference */ ? 793056 /* Type */ : 1536 /* Namespace */; // Resolve type so we know which symbol is referenced var rootSymbol = resolveName(root, root.text, meaning | 8388608 /* Alias */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined); // Resolved symbol is alias @@ -24662,23 +28025,10 @@ var ts; * an expression if it is a type reference to a type with a value declaration. */ function checkTypeAnnotationAsExpression(node) { - switch (node.kind) { - case 141 /* PropertyDeclaration */: - checkTypeNodeAsExpression(node.type); - break; - case 138 /* Parameter */: - checkTypeNodeAsExpression(node.type); - break; - case 143 /* MethodDeclaration */: - checkTypeNodeAsExpression(node.type); - break; - case 145 /* GetAccessor */: - checkTypeNodeAsExpression(node.type); - break; - case 146 /* SetAccessor */: - checkTypeNodeAsExpression(ts.getSetAccessorTypeAnnotationNode(node)); - break; - } + checkTypeNodeAsExpression(node.type); + } + function checkReturnTypeAnnotationAsExpression(node) { + checkTypeNodeAsExpression(node.type); } /** Checks the type annotation of the parameters of a function/method or the constructor of a class as expressions */ function checkParameterTypeAnnotationsAsExpressions(node) { @@ -24699,53 +28049,48 @@ var ts; return; } if (!compilerOptions.experimentalDecorators) { - error(node, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Specify_experimentalDecorators_to_remove_this_warning); + error(node, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning); } if (compilerOptions.emitDecoratorMetadata) { // we only need to perform these checks if we are emitting serialized type metadata for the target of a decorator. switch (node.kind) { - case 214 /* ClassDeclaration */: + case 221 /* ClassDeclaration */: var constructor = ts.getFirstConstructorWithBody(node); if (constructor) { checkParameterTypeAnnotationsAsExpressions(constructor); } break; - case 143 /* MethodDeclaration */: + case 147 /* MethodDeclaration */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: checkParameterTypeAnnotationsAsExpressions(node); - // fall-through - case 146 /* SetAccessor */: - case 145 /* GetAccessor */: - case 141 /* PropertyDeclaration */: - case 138 /* Parameter */: + checkReturnTypeAnnotationAsExpression(node); + break; + case 145 /* PropertyDeclaration */: + case 142 /* Parameter */: checkTypeAnnotationAsExpression(node); break; } } - emitDecorate = true; - if (node.kind === 138 /* Parameter */) { - emitParam = true; - } ts.forEach(node.decorators, checkDecorator); } function checkFunctionDeclaration(node) { if (produceDiagnostics) { - checkFunctionLikeDeclaration(node) || checkGrammarForGenerator(node); + checkFunctionOrMethodDeclaration(node) || checkGrammarForGenerator(node); checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); + checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); } } - function checkFunctionLikeDeclaration(node) { + function checkFunctionOrMethodDeclaration(node) { checkDecorators(node); checkSignatureDeclaration(node); var isAsync = ts.isAsyncFunctionLike(node); - if (isAsync) { - emitAwaiter = true; - } // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name && node.name.kind === 136 /* ComputedPropertyName */) { + if (node.name && node.name.kind === 140 /* ComputedPropertyName */) { // This check will account for methods in class/interface declarations, // as well as accessors in classes/object literals checkComputedPropertyName(node.name); @@ -24756,7 +28101,13 @@ var ts; // - if node.localSymbol === undefined - this node is non-exported so we can just pick the result of getSymbolOfNode var symbol = getSymbolOfNode(node); var localSymbol = node.localSymbol || symbol; - var firstDeclaration = ts.getDeclarationOfKind(localSymbol, node.kind); + // Since the javascript won't do semantic analysis like typescript, + // if the javascript file comes before the typescript file and both contain same name functions, + // checkFunctionOrConstructorSymbol wouldn't be called if we didnt ignore javascript function. + var firstDeclaration = ts.forEach(localSymbol.declarations, + // Get first non javascript function declaration + function (declaration) { return declaration.kind === node.kind && !ts.isSourceFileJavaScript(ts.getSourceFileOfNode(declaration)) ? + declaration : undefined; }); // Only type check the symbol once if (node === firstDeclaration) { checkFunctionOrConstructorSymbol(localSymbol); @@ -24770,13 +28121,9 @@ var ts; } } checkSourceElement(node.body); - if (node.type && !isAccessor(node.kind) && !node.asteriskToken) { - var returnType = getTypeFromTypeNode(node.type); - var promisedType; - if (isAsync) { - promisedType = checkAsyncFunctionReturnType(node); - } - checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, isAsync ? promisedType : returnType); + if (!node.asteriskToken) { + var returnOrPromisedType = node.type && (isAsync ? checkAsyncFunctionReturnType(node) : getTypeFromTypeNode(node.type)); + checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnOrPromisedType); } if (produceDiagnostics && !node.type) { // Report an implicit any error if there is no body, no explicit return type, and node is not a private method @@ -24794,17 +28141,14 @@ var ts; } function checkBlock(node) { // Grammar checking for SyntaxKind.Block - if (node.kind === 192 /* Block */) { + if (node.kind === 199 /* Block */) { checkGrammarStatementInAmbientContext(node); } ts.forEach(node.statements, checkSourceElement); - if (ts.isFunctionBlock(node) || node.kind === 219 /* ModuleBlock */) { - checkFunctionAndClassExpressionBodies(node); - } } function checkCollisionWithArgumentsInGeneratedCode(node) { // no rest parameters \ declaration context \ overload - no codegen impact - if (!ts.hasRestParameter(node) || ts.isInAmbientContext(node) || ts.nodeIsMissing(node.body)) { + if (!ts.hasDeclaredRestParameter(node) || ts.isInAmbientContext(node) || ts.nodeIsMissing(node.body)) { return; } ts.forEach(node.parameters, function (p) { @@ -24817,12 +28161,12 @@ var ts; if (!(identifier && identifier.text === name)) { return false; } - if (node.kind === 141 /* PropertyDeclaration */ || - node.kind === 140 /* PropertySignature */ || - node.kind === 143 /* MethodDeclaration */ || - node.kind === 142 /* MethodSignature */ || - node.kind === 145 /* GetAccessor */ || - node.kind === 146 /* SetAccessor */) { + if (node.kind === 145 /* PropertyDeclaration */ || + node.kind === 144 /* PropertySignature */ || + node.kind === 147 /* MethodDeclaration */ || + node.kind === 146 /* MethodSignature */ || + node.kind === 149 /* GetAccessor */ || + node.kind === 150 /* SetAccessor */) { // it is ok to have member named '_super' or '_this' - member access is always qualified return false; } @@ -24831,7 +28175,7 @@ var ts; return false; } var root = ts.getRootDeclaration(node); - if (root.kind === 138 /* Parameter */ && ts.nodeIsMissing(root.parent.body)) { + if (root.kind === 142 /* Parameter */ && ts.nodeIsMissing(root.parent.body)) { // just an overload - no codegen impact return false; } @@ -24884,16 +28228,31 @@ var ts; return; } // Uninstantiated modules shouldnt do this check - if (node.kind === 218 /* ModuleDeclaration */ && ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { + if (node.kind === 225 /* ModuleDeclaration */ && ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { return; } // In case of variable declaration, node.parent is variable statement so look at the variable statement's parent var parent = getDeclarationContainer(node); - if (parent.kind === 248 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent)) { + if (parent.kind === 256 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent)) { // If the declaration happens to be in external module, report error that require and exports are reserved keywords error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } } + function checkCollisionWithGlobalPromiseInGeneratedCode(node, name) { + if (!needCollisionCheckForIdentifier(node, name, "Promise")) { + return; + } + // Uninstantiated modules shouldnt do this check + if (node.kind === 225 /* ModuleDeclaration */ && ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { + return; + } + // In case of variable declaration, node.parent is variable statement so look at the variable statement's parent + var parent = getDeclarationContainer(node); + if (parent.kind === 256 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent) && parent.flags & 2097152 /* HasAsyncFunctions */) { + // If the declaration happens to be in external module, report error that Promise is a reserved identifier. + error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions, ts.declarationNameToString(name), ts.declarationNameToString(name)); + } + } function checkVarDeclaredNamesNotShadowed(node) { // - ScriptBody : StatementList // It is a Syntax Error if any element of the LexicallyDeclaredNames of StatementList @@ -24918,13 +28277,13 @@ var ts; // const x = 0; // symbol for this declaration will be 'symbol' // } // skip block-scoped variables and parameters - if ((ts.getCombinedNodeFlags(node) & 24576 /* BlockScoped */) !== 0 || ts.isParameterDeclaration(node)) { + if ((ts.getCombinedNodeFlags(node) & 3072 /* BlockScoped */) !== 0 || ts.isParameterDeclaration(node)) { return; } // skip variable declarations that don't have initializers // NOTE: in ES6 spec initializer is required in variable declarations where name is binding pattern // so we'll always treat binding elements as initialized - if (node.kind === 211 /* VariableDeclaration */ && !node.initializer) { + if (node.kind === 218 /* VariableDeclaration */ && !node.initializer) { return; } var symbol = getSymbolOfNode(node); @@ -24933,25 +28292,25 @@ var ts; if (localDeclarationSymbol && localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2 /* BlockScopedVariable */) { - if (getDeclarationFlagsFromSymbol(localDeclarationSymbol) & 24576 /* BlockScoped */) { - var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 212 /* VariableDeclarationList */); - var container = varDeclList.parent.kind === 193 /* VariableStatement */ && varDeclList.parent.parent + if (getDeclarationFlagsFromSymbol(localDeclarationSymbol) & 3072 /* BlockScoped */) { + var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 219 /* VariableDeclarationList */); + var container = varDeclList.parent.kind === 200 /* VariableStatement */ && varDeclList.parent.parent ? varDeclList.parent.parent : undefined; // names of block-scoped and function scoped variables can collide only // if block scoped variable is defined in the function\module\source file scope (because of variable hoisting) var namesShareScope = container && - (container.kind === 192 /* Block */ && ts.isFunctionLike(container.parent) || - container.kind === 219 /* ModuleBlock */ || - container.kind === 218 /* ModuleDeclaration */ || - container.kind === 248 /* SourceFile */); + (container.kind === 199 /* Block */ && ts.isFunctionLike(container.parent) || + container.kind === 226 /* ModuleBlock */ || + container.kind === 225 /* ModuleDeclaration */ || + container.kind === 256 /* SourceFile */); // here we know that function scoped variable is shadowed by block scoped one // if they are defined in the same scope - binder has already reported redeclaration error // otherwise if variable has an initializer - show error that initialization will fail // since LHS will be block scoped name instead of function scoped if (!namesShareScope) { - var name_14 = symbolToString(localDeclarationSymbol); - error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name_14, name_14); + var name_16 = symbolToString(localDeclarationSymbol); + error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name_16, name_16); } } } @@ -24959,32 +28318,63 @@ var ts; } // Check that a parameter initializer contains no references to parameters declared to the right of itself function checkParameterInitializer(node) { - if (ts.getRootDeclaration(node).kind !== 138 /* Parameter */) { + if (ts.getRootDeclaration(node).kind !== 142 /* Parameter */) { return; } var func = ts.getContainingFunction(node); visit(node.initializer); function visit(n) { - if (n.kind === 69 /* Identifier */) { - var referencedSymbol = getNodeLinks(n).resolvedSymbol; + if (ts.isTypeNode(n) || ts.isDeclarationName(n)) { + // do not dive in types + // skip declaration names (i.e. in object literal expressions) + return; + } + if (n.kind === 172 /* PropertyAccessExpression */) { + // skip property names in property access expression + return visit(n.expression); + } + else if (n.kind === 69 /* Identifier */) { // check FunctionLikeDeclaration.locals (stores parameters\function local variable) - // if it contains entry with a specified name and if this entry matches the resolved symbol - if (referencedSymbol && referencedSymbol !== unknownSymbol && getSymbol(func.locals, referencedSymbol.name, 107455 /* Value */) === referencedSymbol) { - if (referencedSymbol.valueDeclaration.kind === 138 /* Parameter */) { - if (referencedSymbol.valueDeclaration === node) { - error(n, ts.Diagnostics.Parameter_0_cannot_be_referenced_in_its_initializer, ts.declarationNameToString(node.name)); + // if it contains entry with a specified name + var symbol = resolveName(n, n.text, 107455 /* Value */ | 8388608 /* Alias */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined); + if (!symbol || symbol === unknownSymbol || !symbol.valueDeclaration) { + return; + } + if (symbol.valueDeclaration === node) { + error(n, ts.Diagnostics.Parameter_0_cannot_be_referenced_in_its_initializer, ts.declarationNameToString(node.name)); + return; + } + // locals map for function contain both parameters and function locals + // so we need to do a bit of extra work to check if reference is legal + var enclosingContainer = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration); + if (enclosingContainer === func) { + if (symbol.valueDeclaration.kind === 142 /* Parameter */) { + // it is ok to reference parameter in initializer if either + // - parameter is located strictly on the left of current parameter declaration + if (symbol.valueDeclaration.pos < node.pos) { return; } - if (referencedSymbol.valueDeclaration.pos < node.pos) { - // legal case - parameter initializer references some parameter strictly on left of current parameter declaration - return; + // - parameter is wrapped in function-like entity + var current = n; + while (current !== node.initializer) { + if (ts.isFunctionLike(current.parent)) { + return; + } + // computed property names/initializers in instance property declaration of class like entities + // are executed in constructor and thus deferred + if (current.parent.kind === 145 /* PropertyDeclaration */ && + !(current.parent.flags & 32 /* Static */) && + ts.isClassLike(current.parent.parent)) { + return; + } + current = current.parent; } } error(n, ts.Diagnostics.Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it, ts.declarationNameToString(node.name), ts.declarationNameToString(n)); } } else { - ts.forEachChild(n, visit); + return ts.forEachChild(n, visit); } } } @@ -24996,30 +28386,39 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 136 /* ComputedPropertyName */) { + if (node.name.kind === 140 /* ComputedPropertyName */) { checkComputedPropertyName(node.name); if (node.initializer) { checkExpressionCached(node.initializer); } } - if (node.kind === 163 /* BindingElement */) { + if (node.kind === 169 /* BindingElement */) { // check computed properties inside property names of binding elements - if (node.propertyName && node.propertyName.kind === 136 /* ComputedPropertyName */) { + if (node.propertyName && node.propertyName.kind === 140 /* ComputedPropertyName */) { checkComputedPropertyName(node.propertyName); } + // check private/protected variable access + var parent_11 = node.parent.parent; + var parentType = getTypeForBindingElementParent(parent_11); + var name_17 = node.propertyName || node.name; + var property = getPropertyOfType(parentType, getTextOfPropertyName(name_17)); + if (parent_11.initializer && property && getParentOfSymbol(property)) { + checkClassPropertyAccess(parent_11, parent_11.initializer, parentType, property); + } } // For a binding pattern, check contained binding elements if (ts.isBindingPattern(node.name)) { ts.forEach(node.name.elements, checkSourceElement); } // For a parameter declaration with an initializer, error and exit if the containing function doesn't have a body - if (node.initializer && ts.getRootDeclaration(node).kind === 138 /* Parameter */ && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { + if (node.initializer && ts.getRootDeclaration(node).kind === 142 /* Parameter */ && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { error(node, ts.Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation); return; } // For a binding pattern, validate the initializer and exit if (ts.isBindingPattern(node.name)) { - if (node.initializer) { + // Don't validate for-in initializer as it is already an error + if (node.initializer && node.parent.parent.kind !== 207 /* ForInStatement */) { checkTypeAssignableTo(checkExpressionCached(node.initializer), getWidenedTypeForVariableLikeDeclaration(node), node, /*headMessage*/ undefined); checkParameterInitializer(node); } @@ -25029,7 +28428,8 @@ var ts; var type = getTypeOfVariableOrParameterOrProperty(symbol); if (node === symbol.valueDeclaration) { // Node is the primary declaration of the symbol, just validate the initializer - if (node.initializer) { + // Don't validate for-in initializer as it is already an error + if (node.initializer && node.parent.parent.kind !== 207 /* ForInStatement */) { checkTypeAssignableTo(checkExpressionCached(node.initializer), type, node, /*headMessage*/ undefined); checkParameterInitializer(node); } @@ -25045,15 +28445,16 @@ var ts; checkTypeAssignableTo(checkExpressionCached(node.initializer), declarationType, node, /*headMessage*/ undefined); } } - if (node.kind !== 141 /* PropertyDeclaration */ && node.kind !== 140 /* PropertySignature */) { + if (node.kind !== 145 /* PropertyDeclaration */ && node.kind !== 144 /* PropertySignature */) { // We know we don't have a binding pattern or computed name here checkExportsOnMergedDeclarations(node); - if (node.kind === 211 /* VariableDeclaration */ || node.kind === 163 /* BindingElement */) { + if (node.kind === 218 /* VariableDeclaration */ || node.kind === 169 /* BindingElement */) { checkVarDeclaredNamesNotShadowed(node); } checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); + checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); } } function checkVariableDeclaration(node) { @@ -25071,7 +28472,7 @@ var ts; } function checkGrammarDisallowedModifiersOnObjectLiteralExpressionMethod(node) { // We only disallow modifier on a method declaration if it is a property of object-literal-expression - if (node.modifiers && node.parent.kind === 165 /* ObjectLiteralExpression */) { + if (node.modifiers && node.parent.kind === 171 /* ObjectLiteralExpression */) { if (ts.isAsyncFunctionLike(node)) { if (node.modifiers.length > 1) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); @@ -25092,7 +28493,7 @@ var ts; checkGrammarStatementInAmbientContext(node); checkExpression(node.expression); checkSourceElement(node.thenStatement); - if (node.thenStatement.kind === 194 /* EmptyStatement */) { + if (node.thenStatement.kind === 201 /* EmptyStatement */) { error(node.thenStatement, ts.Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement); } checkSourceElement(node.elseStatement); @@ -25112,12 +28513,12 @@ var ts; function checkForStatement(node) { // Grammar checking if (!checkGrammarStatementInAmbientContext(node)) { - if (node.initializer && node.initializer.kind === 212 /* VariableDeclarationList */) { + if (node.initializer && node.initializer.kind === 219 /* VariableDeclarationList */) { checkGrammarVariableDeclarationList(node.initializer); } } if (node.initializer) { - if (node.initializer.kind === 212 /* VariableDeclarationList */) { + if (node.initializer.kind === 219 /* VariableDeclarationList */) { ts.forEach(node.initializer.declarations, checkVariableDeclaration); } else { @@ -25137,14 +28538,14 @@ var ts; // via checkRightHandSideOfForOf. // If the LHS is an expression, check the LHS, as a destructuring assignment or as a reference. // Then check that the RHS is assignable to it. - if (node.initializer.kind === 212 /* VariableDeclarationList */) { + if (node.initializer.kind === 219 /* VariableDeclarationList */) { checkForInOrForOfVariableDeclaration(node); } else { var varExpr = node.initializer; var iteratedType = checkRightHandSideOfForOf(node.expression); // There may be a destructuring assignment on the left side - if (varExpr.kind === 164 /* ArrayLiteralExpression */ || varExpr.kind === 165 /* ObjectLiteralExpression */) { + if (varExpr.kind === 170 /* ArrayLiteralExpression */ || varExpr.kind === 171 /* ObjectLiteralExpression */) { // iteratedType may be undefined. In this case, we still want to check the structure of // varExpr, in particular making sure it's a valid LeftHandSideExpression. But we'd like // to short circuit the type relation checking as much as possible, so we pass the unknownType. @@ -25153,7 +28554,7 @@ var ts; else { var leftType = checkExpression(varExpr); checkReferenceExpression(varExpr, /*invalidReferenceMessage*/ ts.Diagnostics.Invalid_left_hand_side_in_for_of_statement, - /*constantVariableMessage*/ ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_be_a_previously_defined_constant); + /*constantVariableMessage*/ ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_be_a_constant_or_a_read_only_property); // iteratedType will be undefined if the rightType was missing properties/signatures // required to get its iteratedType (like [Symbol.iterator] or next). This may be // because we accessed properties from anyType, or it may have led to an error inside @@ -25173,7 +28574,7 @@ var ts; // for (let VarDecl in Expr) Statement // VarDecl must be a variable declaration without a type annotation that declares a variable of type Any, // and Expr must be an expression of type Any, an object type, or a type parameter type. - if (node.initializer.kind === 212 /* VariableDeclarationList */) { + if (node.initializer.kind === 219 /* VariableDeclarationList */) { var variable = node.initializer.declarations[0]; if (variable && ts.isBindingPattern(variable.name)) { error(variable.name, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); @@ -25187,7 +28588,7 @@ var ts; // and Expr must be an expression of type Any, an object type, or a type parameter type. var varExpr = node.initializer; var leftType = checkExpression(varExpr); - if (varExpr.kind === 164 /* ArrayLiteralExpression */ || varExpr.kind === 165 /* ObjectLiteralExpression */) { + if (varExpr.kind === 170 /* ArrayLiteralExpression */ || varExpr.kind === 171 /* ObjectLiteralExpression */) { error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); } else if (!isTypeAnyOrAllConstituentTypesHaveKind(leftType, 258 /* StringLike */)) { @@ -25195,10 +28596,10 @@ var ts; } else { // run check only former check succeeded to avoid cascading errors - checkReferenceExpression(varExpr, ts.Diagnostics.Invalid_left_hand_side_in_for_in_statement, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_previously_defined_constant); + checkReferenceExpression(varExpr, ts.Diagnostics.Invalid_left_hand_side_in_for_in_statement, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_constant_or_a_read_only_property); } } - var rightType = checkExpression(node.expression); + var rightType = checkNonNullExpression(node.expression); // unknownType is returned i.e. if node.expression is identifier whose name cannot be resolved // in this case error about missing name is already reported - do not report extra one if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 80896 /* ObjectType */ | 512 /* TypeParameter */)) { @@ -25215,7 +28616,7 @@ var ts; } } function checkRightHandSideOfForOf(rhsExpression) { - var expressionType = getTypeOfExpression(rhsExpression); + var expressionType = checkNonNullExpression(rhsExpression); return checkIteratedTypeOrElementType(expressionType, rhsExpression, /*allowStringInput*/ true); } function checkIteratedTypeOrElementType(inputType, errorNode, allowStringInput) { @@ -25234,7 +28635,9 @@ var ts; return indexType; } } - error(errorNode, ts.Diagnostics.Type_0_is_not_an_array_type, typeToString(inputType)); + if (errorNode) { + error(errorNode, ts.Diagnostics.Type_0_is_not_an_array_type, typeToString(inputType)); + } return unknownType; } /** @@ -25278,7 +28681,7 @@ var ts; if (!typeAsIterable.iterableElementType) { // As an optimization, if the type is instantiated directly using the globalIterableType (Iterable), // then just grab its type argument. - if ((type.flags & 4096 /* Reference */) && type.target === globalIterableType) { + if ((type.flags & 4096 /* Reference */) && type.target === getGlobalIterableType()) { typeAsIterable.iterableElementType = type.typeArguments[0]; } else { @@ -25319,7 +28722,7 @@ var ts; if (!typeAsIterator.iteratorElementType) { // As an optimization, if the type is instantiated directly using the globalIteratorType (Iterator), // then just grab its type argument. - if ((type.flags & 4096 /* Reference */) && type.target === globalIteratorType) { + if ((type.flags & 4096 /* Reference */) && type.target === getGlobalIteratorType()) { typeAsIterator.iteratorElementType = type.typeArguments[0]; } else { @@ -25356,7 +28759,7 @@ var ts; } // As an optimization, if the type is instantiated directly using the globalIterableIteratorType (IterableIterator), // then just grab its type argument. - if ((type.flags & 4096 /* Reference */) && type.target === globalIterableIteratorType) { + if ((type.flags & 4096 /* Reference */) && type.target === getGlobalIterableIteratorType()) { return type.typeArguments[0]; } return getElementTypeOfIterable(type, /*errorNode*/ undefined) || @@ -25366,7 +28769,7 @@ var ts; * This function does the following steps: * 1. Break up arrayOrStringType (possibly a union) into its string constituents and array constituents. * 2. Take the element types of the array constituents. - * 3. Return the union of the element types, and string if there was a string constitutent. + * 3. Return the union of the element types, and string if there was a string constituent. * * For example: * string -> string @@ -25383,7 +28786,13 @@ var ts; ts.Debug.assert(languageVersion < 2 /* ES6 */); // After we remove all types that are StringLike, we will know if there was a string constituent // based on whether the remaining type is the same as the initial type. - var arrayType = removeTypesFromUnionType(arrayOrStringType, 258 /* StringLike */, /*isTypeOfKind*/ true, /*allowEmptyUnionResult*/ true); + var arrayType = arrayOrStringType; + if (arrayOrStringType.flags & 16384 /* Union */) { + arrayType = getUnionType(ts.filter(arrayOrStringType.types, function (t) { return !(t.flags & 258 /* StringLike */); })); + } + else if (arrayOrStringType.flags & 258 /* StringLike */) { + arrayType = neverType; + } var hasStringConstituent = arrayOrStringType !== arrayType; var reportedError = false; if (hasStringConstituent) { @@ -25393,7 +28802,7 @@ var ts; } // Now that we've removed all the StringLike types, if no constituents remain, then the entire // arrayOrStringType was a string. - if (arrayType === emptyObjectType) { + if (arrayType === neverType) { return stringType; } } @@ -25425,8 +28834,12 @@ var ts; checkGrammarStatementInAmbientContext(node) || checkGrammarBreakOrContinueStatement(node); // TODO: Check that target label is valid } - function isGetAccessorWithAnnotatatedSetAccessor(node) { - return !!(node.kind === 145 /* GetAccessor */ && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 146 /* SetAccessor */))); + function isGetAccessorWithAnnotatedSetAccessor(node) { + return !!(node.kind === 149 /* GetAccessor */ && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 150 /* SetAccessor */))); + } + function isUnwrappedReturnTypeVoidOrAny(func, returnType) { + var unwrappedReturnType = ts.isAsyncFunctionLike(func) ? getPromisedType(returnType) : returnType; + return maybeTypeOfKind(unwrappedReturnType, 16 /* Void */ | 1 /* Any */); } function checkReturnStatement(node) { // Grammar checking @@ -25436,12 +28849,12 @@ var ts; grammarErrorOnFirstToken(node, ts.Diagnostics.A_return_statement_can_only_be_used_within_a_function_body); } } - if (node.expression) { - var func = ts.getContainingFunction(node); - if (func) { - var signature = getSignatureFromDeclaration(func); - var returnType = getReturnTypeOfSignature(signature); - var exprType = checkExpressionCached(node.expression); + var func = ts.getContainingFunction(node); + if (func) { + var signature = getSignatureFromDeclaration(func); + var returnType = getReturnTypeOfSignature(signature); + if (strictNullChecks || node.expression || returnType === neverType) { + var exprType = node.expression ? checkExpressionCached(node.expression) : undefinedType; if (func.asteriskToken) { // A generator does not need its return expressions checked against its return type. // Instead, the yield expressions are checked against the element type. @@ -25449,36 +28862,42 @@ var ts; // for generators. return; } - if (func.kind === 146 /* SetAccessor */) { - error(node.expression, ts.Diagnostics.Setters_cannot_return_a_value); + if (func.kind === 150 /* SetAccessor */) { + if (node.expression) { + error(node.expression, ts.Diagnostics.Setters_cannot_return_a_value); + } } - else if (func.kind === 144 /* Constructor */) { - if (!checkTypeAssignableTo(exprType, returnType, node.expression)) { + else if (func.kind === 148 /* Constructor */) { + if (node.expression && !checkTypeAssignableTo(exprType, returnType, node.expression)) { error(node.expression, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); } } - else if (func.type || isGetAccessorWithAnnotatatedSetAccessor(func) || signature.typePredicate) { + else if (func.type || isGetAccessorWithAnnotatedSetAccessor(func)) { if (ts.isAsyncFunctionLike(func)) { var promisedType = getPromisedType(returnType); - var awaitedType = checkAwaitedType(exprType, node.expression, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member); + var awaitedType = checkAwaitedType(exprType, node.expression || node, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member); if (promisedType) { // If the function has a return type, but promisedType is // undefined, an error will be reported in checkAsyncFunctionReturnType // so we don't need to report one here. - checkTypeAssignableTo(awaitedType, promisedType, node.expression); + checkTypeAssignableTo(awaitedType, promisedType, node.expression || node); } } else { - checkTypeAssignableTo(exprType, returnType, node.expression); + checkTypeAssignableTo(exprType, returnType, node.expression || node); } } } + else if (func.kind !== 148 /* Constructor */ && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(func, returnType)) { + // The function has a return type, but the return statement doesn't have an expression. + error(node, ts.Diagnostics.Not_all_code_paths_return_a_value); + } } } function checkWithStatement(node) { // Grammar checking for withStatement if (!checkGrammarStatementInAmbientContext(node)) { - if (node.parserContextFlags & 8 /* Await */) { + if (node.flags & 33554432 /* AwaitContext */) { grammarErrorOnFirstToken(node, ts.Diagnostics.with_statements_are_not_allowed_in_an_async_function_block); } } @@ -25491,10 +28910,9 @@ var ts; var firstDefaultClause; var hasDuplicateDefaultClause = false; var expressionType = checkExpression(node.expression); - var expressionTypeIsStringLike = someConstituentTypeHasKind(expressionType, 258 /* StringLike */); ts.forEach(node.caseBlock.clauses, function (clause) { // Grammar check for duplicate default clauses, skip if we already report duplicate default clause - if (clause.kind === 242 /* DefaultClause */ && !hasDuplicateDefaultClause) { + if (clause.kind === 250 /* DefaultClause */ && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -25506,18 +28924,15 @@ var ts; hasDuplicateDefaultClause = true; } } - if (produceDiagnostics && clause.kind === 241 /* CaseClause */) { + if (produceDiagnostics && clause.kind === 249 /* CaseClause */) { var caseClause = clause; - // TypeScript 1.0 spec (April 2014):5.9 - // In a 'switch' statement, each 'case' expression must be of a type that is assignable to or from the type of the 'switch' expression. + // TypeScript 1.0 spec (April 2014): 5.9 + // In a 'switch' statement, each 'case' expression must be of a type that is comparable + // to or from the type of the 'switch' expression. var caseType = checkExpression(caseClause.expression); - // Permit 'number[] | "foo"' to be asserted to 'string'. - if (expressionTypeIsStringLike && someConstituentTypeHasKind(caseType, 258 /* StringLike */)) { - return; - } - if (!isTypeAssignableTo(expressionType, caseType)) { - // check 'expressionType isAssignableTo caseType' failed, try the reversed check and report errors if it fails - checkTypeAssignableTo(caseType, expressionType, caseClause.expression, /*headMessage*/ undefined); + if (!isTypeComparableTo(expressionType, caseType)) { + // expressionType is not comparable to caseType, try the reversed check and report errors if it fails + checkTypeComparableTo(caseType, expressionType, caseClause.expression, /*headMessage*/ undefined); } } ts.forEach(clause.statements, checkSourceElement); @@ -25531,7 +28946,7 @@ var ts; if (ts.isFunctionLike(current)) { break; } - if (current.kind === 207 /* LabeledStatement */ && current.label.text === node.label.text) { + if (current.kind === 214 /* LabeledStatement */ && current.label.text === node.label.text) { var sourceFile = ts.getSourceFileOfNode(node); grammarErrorOnNode(node.label, ts.Diagnostics.Duplicate_label_0, ts.getTextOfNodeFromSourceText(sourceFile.text, node.label)); break; @@ -25605,7 +29020,7 @@ var ts; // Only process instance properties with computed names here. // Static properties cannot be in conflict with indexers, // and properties with literal names were already checked. - if (!(member.flags & 64 /* Static */) && ts.hasDynamicName(member)) { + if (!(member.flags & 32 /* Static */) && ts.hasDynamicName(member)) { var propType = getTypeOfSymbol(member.symbol); checkIndexConstraintForProperty(member.symbol, propType, type, declaredStringIndexer, stringIndexType, 0 /* String */); checkIndexConstraintForProperty(member.symbol, propType, type, declaredNumberIndexer, numberIndexType, 1 /* Number */); @@ -25636,7 +29051,7 @@ var ts; // perform property check if property or indexer is declared in 'type' // this allows to rule out cases when both property and indexer are inherited from the base class var errorNode; - if (prop.valueDeclaration.name.kind === 136 /* ComputedPropertyName */ || prop.parent === containingType.symbol) { + if (prop.valueDeclaration.name.kind === 140 /* ComputedPropertyName */ || prop.parent === containingType.symbol) { errorNode = prop.valueDeclaration; } else if (indexDeclaration) { @@ -25670,7 +29085,7 @@ var ts; error(name, message, name.text); } } - // Check each type parameter and check that list has no duplicate type parameter declarations + /** Check each type parameter and check that type parameters have no duplicate type parameter declarations */ function checkTypeParameters(typeParameterDeclarations) { if (typeParameterDeclarations) { for (var i = 0, n = typeParameterDeclarations.length; i < n; i++) { @@ -25686,10 +29101,32 @@ var ts; } } } + /** Check that type parameter lists are identical across multiple declarations */ + function checkTypeParameterListsIdentical(node, symbol) { + if (symbol.declarations.length === 1) { + return; + } + var firstDecl; + for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { + var declaration = _a[_i]; + if (declaration.kind === 221 /* ClassDeclaration */ || declaration.kind === 222 /* InterfaceDeclaration */) { + if (!firstDecl) { + firstDecl = declaration; + } + else if (!areTypeParametersIdentical(firstDecl.typeParameters, node.typeParameters)) { + error(node.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_type_parameters, node.name.text); + } + } + } + } function checkClassExpression(node) { checkClassLikeDeclaration(node); + checkNodeDeferred(node); return getTypeOfSymbol(getSymbolOfNode(node)); } + function checkClassExpressionDeferred(node) { + ts.forEach(node.members, checkSourceElement); + } function checkClassDeclaration(node) { if (!node.name && !(node.flags & 512 /* Default */)) { grammarErrorOnFirstToken(node, ts.Diagnostics.A_class_declaration_without_the_default_modifier_must_have_a_name); @@ -25704,6 +29141,7 @@ var ts; checkTypeNameIsReserved(node.name, ts.Diagnostics.Class_name_cannot_be_0); checkCollisionWithCapturedThisVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); + checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); } checkTypeParameters(node.typeParameters); checkExportsOnMergedDeclarations(node); @@ -25711,13 +29149,14 @@ var ts; var type = getDeclaredTypeOfSymbol(symbol); var typeWithThis = getTypeWithThisArgument(type); var staticType = getTypeOfSymbol(symbol); + checkTypeParameterListsIdentical(node, symbol); var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { - emitExtends = emitExtends || !ts.isInAmbientContext(node); var baseTypes = getBaseTypes(type); if (baseTypes.length && produceDiagnostics) { - var baseType = baseTypes[0]; + var baseType_1 = baseTypes[0]; var staticBaseType = getBaseConstructorTypeOfClass(type); + checkBaseTypeAccessibility(staticBaseType, baseTypeNode); checkSourceElement(baseTypeNode.expression); if (baseTypeNode.typeArguments) { ts.forEach(baseTypeNode.typeArguments, checkSourceElement); @@ -25728,7 +29167,7 @@ var ts; } } } - checkTypeAssignableTo(typeWithThis, getTypeWithThisArgument(baseType, type.thisType), node.name || node, ts.Diagnostics.Class_0_incorrectly_extends_base_class_1); + checkTypeAssignableTo(typeWithThis, getTypeWithThisArgument(baseType_1, type.thisType), node.name || node, ts.Diagnostics.Class_0_incorrectly_extends_base_class_1); checkTypeAssignableTo(staticType, getTypeWithoutSignatures(staticBaseType), node.name || node, ts.Diagnostics.Class_static_side_0_incorrectly_extends_base_class_static_side_1); if (!(staticBaseType.symbol && staticBaseType.symbol.flags & 32 /* Class */)) { // When the static base type is a "class-like" constructor function (but not actually a class), we verify @@ -25736,11 +29175,11 @@ var ts; // references (as opposed to checking the structure of the types) because elsewhere we have already checked // that the base type is a class or interface type (and not, for example, an anonymous object type). var constructors = getInstantiatedConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments); - if (ts.forEach(constructors, function (sig) { return getReturnTypeOfSignature(sig) !== baseType; })) { + if (ts.forEach(constructors, function (sig) { return getReturnTypeOfSignature(sig) !== baseType_1; })) { error(baseTypeNode.expression, ts.Diagnostics.Base_constructors_must_all_have_the_same_return_type); } } - checkKindsOfPropertyMemberOverrides(type, baseType); + checkKindsOfPropertyMemberOverrides(type, baseType_1); } } var implementedTypeNodes = ts.getClassImplementsHeritageClauseElements(node); @@ -25770,6 +29209,18 @@ var ts; checkTypeForDuplicateIndexSignatures(node); } } + function checkBaseTypeAccessibility(type, node) { + var signatures = getSignaturesOfType(type, 1 /* Construct */); + if (signatures.length) { + var declaration = signatures[0].declaration; + if (declaration && declaration.flags & 8 /* Private */) { + var typeClassDeclaration = getClassLikeDeclarationOfSymbol(type.symbol); + if (!isNodeWithinClass(node, typeClassDeclaration)) { + error(node, ts.Diagnostics.Cannot_extend_a_class_0_Class_constructor_is_marked_as_private, node.expression.text); + } + } + } + } function getTargetSymbol(s) { // if symbol is instantiated its flags are not copied from the 'target' // so we'll need to get back original 'target' symbol to work with correct set of flags @@ -25804,7 +29255,7 @@ var ts; var baseDeclarationFlags = getDeclarationFlagsFromSymbol(base); ts.Debug.assert(!!derived, "derived should point to something, even if it is the base class' declaration."); if (derived) { - // In order to resolve whether the inherited method was overriden in the base class or not, + // In order to resolve whether the inherited method was overridden in the base class or not, // we compare the Symbols obtained. Since getTargetSymbol returns the symbol on the *uninstantiated* // type declaration, derived and base resolve to the same symbol even in the case of generic classes. if (derived === base) { @@ -25814,7 +29265,7 @@ var ts; // If there is no declaration for the derived class (as in the case of class expressions), // then the class cannot be declared abstract. if (baseDeclarationFlags & 128 /* Abstract */ && (!derivedClassDecl || !(derivedClassDecl.flags & 128 /* Abstract */))) { - if (derivedClassDecl.kind === 186 /* ClassExpression */) { + if (derivedClassDecl.kind === 192 /* ClassExpression */) { error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType)); } else { @@ -25825,11 +29276,11 @@ var ts; else { // derived overrides base. var derivedDeclarationFlags = getDeclarationFlagsFromSymbol(derived); - if ((baseDeclarationFlags & 16 /* Private */) || (derivedDeclarationFlags & 16 /* Private */)) { + if ((baseDeclarationFlags & 8 /* Private */) || (derivedDeclarationFlags & 8 /* Private */)) { // either base or derived property is private - not override, skip it continue; } - if ((baseDeclarationFlags & 64 /* Static */) !== (derivedDeclarationFlags & 64 /* Static */)) { + if ((baseDeclarationFlags & 32 /* Static */) !== (derivedDeclarationFlags & 32 /* Static */)) { // value of 'static' is not the same for properties - not override, skip it continue; } @@ -25862,7 +29313,7 @@ var ts; } } function isAccessor(kind) { - return kind === 145 /* GetAccessor */ || kind === 146 /* SetAccessor */; + return kind === 149 /* GetAccessor */ || kind === 150 /* SetAccessor */; } function areTypeParametersIdentical(list1, list2) { if (!list1 && !list2) { @@ -25932,13 +29383,9 @@ var ts; checkTypeNameIsReserved(node.name, ts.Diagnostics.Interface_name_cannot_be_0); checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); - var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 215 /* InterfaceDeclaration */); - if (symbol.declarations.length > 1) { - if (node !== firstInterfaceDecl && !areTypeParametersIdentical(firstInterfaceDecl.typeParameters, node.typeParameters)) { - error(node.name, ts.Diagnostics.All_declarations_of_an_interface_must_have_identical_type_parameters); - } - } + checkTypeParameterListsIdentical(node, symbol); // Only check this symbol once + var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 222 /* InterfaceDeclaration */); if (node === firstInterfaceDecl) { var type = getDeclaredTypeOfSymbol(symbol); var typeWithThis = getTypeWithThisArgument(type); @@ -25971,7 +29418,7 @@ var ts; } function computeEnumMemberValues(node) { var nodeLinks = getNodeLinks(node); - if (!(nodeLinks.flags & 8192 /* EnumValuesComputed */)) { + if (!(nodeLinks.flags & 16384 /* EnumValuesComputed */)) { var enumSymbol = getSymbolOfNode(node); var enumType = getDeclaredTypeOfSymbol(enumSymbol); var autoValue = 0; // set to undefined when enum member is non-constant @@ -26006,10 +29453,11 @@ var ts; error(member.name, ts.Diagnostics.Enum_member_must_have_initializer); } if (autoValue !== undefined) { - getNodeLinks(member).enumMemberValue = autoValue++; + getNodeLinks(member).enumMemberValue = autoValue; + autoValue++; } } - nodeLinks.flags |= 8192 /* EnumValuesComputed */; + nodeLinks.flags |= 16384 /* EnumValuesComputed */; } function computeConstantValueForEnumMemberInitializer(initializer, enumType, enumIsConst, ambient) { // Controls if error should be reported after evaluation of constant value is completed @@ -26041,7 +29489,7 @@ var ts; return value; function evalConstant(e) { switch (e.kind) { - case 179 /* PrefixUnaryExpression */: + case 185 /* PrefixUnaryExpression */: var value_1 = evalConstant(e.operand); if (value_1 === undefined) { return undefined; @@ -26052,7 +29500,7 @@ var ts; case 50 /* TildeToken */: return ~value_1; } return undefined; - case 181 /* BinaryExpression */: + case 187 /* BinaryExpression */: var left = evalConstant(e.left); if (left === undefined) { return undefined; @@ -26077,15 +29525,15 @@ var ts; return undefined; case 8 /* NumericLiteral */: return +e.text; - case 172 /* ParenthesizedExpression */: + case 178 /* ParenthesizedExpression */: return evalConstant(e.expression); case 69 /* Identifier */: - case 167 /* ElementAccessExpression */: - case 166 /* PropertyAccessExpression */: + case 173 /* ElementAccessExpression */: + case 172 /* PropertyAccessExpression */: var member = initializer.parent; var currentType = getTypeOfSymbol(getSymbolOfNode(member.parent)); var enumType_1; - var propertyName; + var propertyName = void 0; if (e.kind === 69 /* Identifier */) { // unqualified names can refer to member that reside in different declaration of the enum so just doing name resolution won't work. // instead pick current enum type and later try to fetch member from the type @@ -26093,8 +29541,8 @@ var ts; propertyName = e.text; } else { - var expression; - if (e.kind === 167 /* ElementAccessExpression */) { + var expression = void 0; + if (e.kind === 173 /* ElementAccessExpression */) { if (e.argumentExpression === undefined || e.argumentExpression.kind !== 9 /* StringLiteral */) { return undefined; @@ -26112,7 +29560,7 @@ var ts; if (current.kind === 69 /* Identifier */) { break; } - else if (current.kind === 166 /* PropertyAccessExpression */) { + else if (current.kind === 172 /* PropertyAccessExpression */) { current = current.expression; } else { @@ -26157,6 +29605,7 @@ var ts; checkTypeNameIsReserved(node.name, ts.Diagnostics.Enum_name_cannot_be_0); checkCollisionWithCapturedThisVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); + checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); checkExportsOnMergedDeclarations(node); computeEnumMemberValues(node); var enumIsConst = ts.isConst(node); @@ -26180,10 +29629,10 @@ var ts; } }); } - var seenEnumMissingInitialInitializer = false; + var seenEnumMissingInitialInitializer_1 = false; ts.forEach(enumSymbol.declarations, function (declaration) { // return true if we hit a violation of the rule, false otherwise - if (declaration.kind !== 217 /* EnumDeclaration */) { + if (declaration.kind !== 224 /* EnumDeclaration */) { return false; } var enumDeclaration = declaration; @@ -26192,11 +29641,11 @@ var ts; } var firstEnumMember = enumDeclaration.members[0]; if (!firstEnumMember.initializer) { - if (seenEnumMissingInitialInitializer) { + if (seenEnumMissingInitialInitializer_1) { error(firstEnumMember.name, ts.Diagnostics.In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element); } else { - seenEnumMissingInitialInitializer = true; + seenEnumMissingInitialInitializer_1 = true; } } }); @@ -26206,8 +29655,8 @@ var ts; var declarations = symbol.declarations; for (var _i = 0, declarations_5 = declarations; _i < declarations_5.length; _i++) { var declaration = declarations_5[_i]; - if ((declaration.kind === 214 /* ClassDeclaration */ || - (declaration.kind === 213 /* FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) && + if ((declaration.kind === 221 /* ClassDeclaration */ || + (declaration.kind === 220 /* FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { return declaration; } @@ -26230,7 +29679,12 @@ var ts; function checkModuleDeclaration(node) { if (produceDiagnostics) { // Grammar checking - var isAmbientExternalModule = node.name.kind === 9 /* StringLiteral */; + var isGlobalAugmentation = ts.isGlobalScopeAugmentation(node); + var inAmbientContext = ts.isInAmbientContext(node); + if (isGlobalAugmentation && !inAmbientContext) { + error(node.name, ts.Diagnostics.Augmentations_for_the_global_scope_should_have_declare_modifier_unless_they_appear_in_already_ambient_context); + } + var isAmbientExternalModule = ts.isAmbientModule(node); var contextErrorMessage = isAmbientExternalModule ? ts.Diagnostics.An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file : ts.Diagnostics.A_namespace_declaration_is_only_allowed_in_a_namespace_or_module; @@ -26239,18 +29693,19 @@ var ts; return; } if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node)) { - if (!ts.isInAmbientContext(node) && node.name.kind === 9 /* StringLiteral */) { + if (!inAmbientContext && node.name.kind === 9 /* StringLiteral */) { grammarErrorOnNode(node.name, ts.Diagnostics.Only_ambient_modules_can_use_quoted_names); } } checkCollisionWithCapturedThisVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); + checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); // The following checks only apply on a non-ambient instantiated module declaration. if (symbol.flags & 512 /* ValueModule */ && symbol.declarations.length > 1 - && !ts.isInAmbientContext(node) + && !inAmbientContext && ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums || compilerOptions.isolatedModules)) { var firstNonAmbientClassOrFunc = getFirstNonAmbientClassOrFunctionDeclaration(symbol); if (firstNonAmbientClassOrFunc) { @@ -26263,30 +29718,109 @@ var ts; } // if the module merges with a class declaration in the same lexical scope, // we need to track this to ensure the correct emit. - var mergedClass = ts.getDeclarationOfKind(symbol, 214 /* ClassDeclaration */); + var mergedClass = ts.getDeclarationOfKind(symbol, 221 /* ClassDeclaration */); if (mergedClass && inSameLexicalScope(node, mergedClass)) { getNodeLinks(node).flags |= 32768 /* LexicalModuleMergesWithClass */; } } - // Checks for ambient external modules. if (isAmbientExternalModule) { - if (!isGlobalSourceFile(node.parent)) { - error(node.name, ts.Diagnostics.Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces); + if (ts.isExternalModuleAugmentation(node)) { + // body of the augmentation should be checked for consistency only if augmentation was applied to its target (either global scope or module) + // otherwise we'll be swamped in cascading errors. + // We can detect if augmentation was applied using following rules: + // - augmentation for a global scope is always applied + // - augmentation for some external module is applied if symbol for augmentation is merged (it was combined with target module). + var checkBody = isGlobalAugmentation || (getSymbolOfNode(node).flags & 33554432 /* Merged */); + if (checkBody) { + // body of ambient external module is always a module block + for (var _i = 0, _a = node.body.statements; _i < _a.length; _i++) { + var statement = _a[_i]; + checkModuleAugmentationElement(statement, isGlobalAugmentation); + } + } } - if (ts.isExternalModuleNameRelative(node.name.text)) { - error(node.name, ts.Diagnostics.Ambient_module_declaration_cannot_specify_relative_module_name); + else if (isGlobalSourceFile(node.parent)) { + if (isGlobalAugmentation) { + error(node.name, ts.Diagnostics.Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_declarations); + } + else if (ts.isExternalModuleNameRelative(node.name.text)) { + error(node.name, ts.Diagnostics.Ambient_module_declaration_cannot_specify_relative_module_name); + } + } + else { + if (isGlobalAugmentation) { + error(node.name, ts.Diagnostics.Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_declarations); + } + else { + // Node is not an augmentation and is not located on the script level. + // This means that this is declaration of ambient module that is located in other module or namespace which is prohibited. + error(node.name, ts.Diagnostics.Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces); + } } } } checkSourceElement(node.body); } + function checkModuleAugmentationElement(node, isGlobalAugmentation) { + switch (node.kind) { + case 200 /* VariableStatement */: + // error each individual name in variable statement instead of marking the entire variable statement + for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { + var decl = _a[_i]; + checkModuleAugmentationElement(decl, isGlobalAugmentation); + } + break; + case 235 /* ExportAssignment */: + case 236 /* ExportDeclaration */: + grammarErrorOnFirstToken(node, ts.Diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations); + break; + case 229 /* ImportEqualsDeclaration */: + case 230 /* ImportDeclaration */: + grammarErrorOnFirstToken(node, ts.Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module); + break; + case 169 /* BindingElement */: + case 218 /* VariableDeclaration */: + var name_18 = node.name; + if (ts.isBindingPattern(name_18)) { + for (var _b = 0, _c = name_18.elements; _b < _c.length; _b++) { + var el = _c[_b]; + // mark individual names in binding pattern + checkModuleAugmentationElement(el, isGlobalAugmentation); + } + break; + } + // fallthrough + case 221 /* ClassDeclaration */: + case 224 /* EnumDeclaration */: + case 220 /* FunctionDeclaration */: + case 222 /* InterfaceDeclaration */: + case 225 /* ModuleDeclaration */: + case 223 /* TypeAliasDeclaration */: + if (isGlobalAugmentation) { + return; + } + var symbol = getSymbolOfNode(node); + if (symbol) { + // module augmentations cannot introduce new names on the top level scope of the module + // this is done it two steps + // 1. quick check - if symbol for node is not merged - this is local symbol to this augmentation - report error + // 2. main check - report error if value declaration of the parent symbol is module augmentation) + var reportError = !(symbol.flags & 33554432 /* Merged */); + if (!reportError) { + // symbol should not originate in augmentation + reportError = ts.isExternalModuleAugmentation(symbol.parent.declarations[0]); + } + } + break; + } + } function getFirstIdentifier(node) { while (true) { - if (node.kind === 135 /* QualifiedName */) { + if (node.kind === 139 /* QualifiedName */) { node = node.left; } - else if (node.kind === 166 /* PropertyAccessExpression */) { + else if (node.kind === 172 /* PropertyAccessExpression */) { node = node.expression; } else { @@ -26302,20 +29836,24 @@ var ts; error(moduleName, ts.Diagnostics.String_literal_expected); return false; } - var inAmbientExternalModule = node.parent.kind === 219 /* ModuleBlock */ && node.parent.parent.name.kind === 9 /* StringLiteral */; - if (node.parent.kind !== 248 /* SourceFile */ && !inAmbientExternalModule) { - error(moduleName, node.kind === 228 /* ExportDeclaration */ ? + var inAmbientExternalModule = node.parent.kind === 226 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent); + if (node.parent.kind !== 256 /* SourceFile */ && !inAmbientExternalModule) { + error(moduleName, node.kind === 236 /* ExportDeclaration */ ? ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace : ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module); return false; } if (inAmbientExternalModule && ts.isExternalModuleNameRelative(moduleName.text)) { - // TypeScript 1.0 spec (April 2013): 12.1.6 - // An ExternalImportDeclaration in an AmbientExternalModuleDeclaration may reference - // other external modules only through top - level external module names. - // Relative external module names are not permitted. - error(node, ts.Diagnostics.Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relative_module_name); - return false; + // we have already reported errors on top level imports\exports in external module augmentations in checkModuleDeclaration + // no need to do this again. + if (!isTopLevelInExternalModuleAugmentation(node)) { + // TypeScript 1.0 spec (April 2013): 12.1.6 + // An ExternalImportDeclaration in an AmbientExternalModuleDeclaration may reference + // other external modules only through top - level external module names. + // Relative external module names are not permitted. + error(node, ts.Diagnostics.Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relative_module_name); + return false; + } } return true; } @@ -26323,11 +29861,17 @@ var ts; var symbol = getSymbolOfNode(node); var target = resolveAlias(symbol); if (target !== unknownSymbol) { - var excludedMeanings = (symbol.flags & 107455 /* Value */ ? 107455 /* Value */ : 0) | + // For external modules symbol represent local symbol for an alias. + // This local symbol will merge any other local declarations (excluding other aliases) + // and symbol.flags will contains combined representation for all merged declaration. + // Based on symbol.flags we can compute a set of excluded meanings (meaning that resolved alias should not have, + // otherwise it will conflict with some local declaration). Note that in addition to normal flags we include matching SymbolFlags.Export* + // in order to prevent collisions with declarations that were exported from the current module (they still contribute to local names). + var excludedMeanings = (symbol.flags & (107455 /* Value */ | 1048576 /* ExportValue */) ? 107455 /* Value */ : 0) | (symbol.flags & 793056 /* Type */ ? 793056 /* Type */ : 0) | (symbol.flags & 1536 /* Namespace */ ? 1536 /* Namespace */ : 0); if (target.flags & excludedMeanings) { - var message = node.kind === 230 /* ExportSpecifier */ ? + var message = node.kind === 238 /* ExportSpecifier */ ? ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0; error(node, message, symbolToString(symbol)); @@ -26337,6 +29881,7 @@ var ts; function checkImportBinding(node) { checkCollisionWithCapturedThisVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); + checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); checkAliasSymbol(node); } function checkImportDeclaration(node) { @@ -26344,7 +29889,7 @@ var ts; // If we hit an import declaration in an illegal context, just bail out to avoid cascading errors. return; } - if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && (node.flags & 1022 /* Modifier */)) { + if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && (node.flags & 1023 /* Modifier */)) { grammarErrorOnFirstToken(node, ts.Diagnostics.An_import_declaration_cannot_have_modifiers); } if (checkExternalImportOrExportDeclaration(node)) { @@ -26354,7 +29899,7 @@ var ts; checkImportBinding(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 224 /* NamespaceImport */) { + if (importClause.namedBindings.kind === 232 /* NamespaceImport */) { checkImportBinding(importClause.namedBindings); } else { @@ -26372,7 +29917,7 @@ var ts; checkGrammarDecorators(node) || checkGrammarModifiers(node); if (ts.isInternalModuleImportEqualsDeclaration(node) || checkExternalImportOrExportDeclaration(node)) { checkImportBinding(node); - if (node.flags & 2 /* Export */) { + if (node.flags & 1 /* Export */) { markExportAsReferenced(node); } if (ts.isInternalModuleImportEqualsDeclaration(node)) { @@ -26391,7 +29936,7 @@ var ts; } } else { - if (modulekind === 5 /* ES6 */ && !ts.isInAmbientContext(node)) { + if (modulekind === ts.ModuleKind.ES6 && !ts.isInAmbientContext(node)) { // Import equals declaration is deprecated in es6 or above grammarErrorOnNode(node, ts.Diagnostics.Import_assignment_cannot_be_used_when_targeting_ECMAScript_6_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead); } @@ -26403,7 +29948,7 @@ var ts; // If we hit an export in an illegal context, just bail out to avoid cascading errors. return; } - if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && (node.flags & 1022 /* Modifier */)) { + if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && (node.flags & 1023 /* Modifier */)) { grammarErrorOnFirstToken(node, ts.Diagnostics.An_export_declaration_cannot_have_modifiers); } if (!node.moduleSpecifier || checkExternalImportOrExportDeclaration(node)) { @@ -26411,29 +29956,38 @@ var ts; // export { x, y } // export { x, y } from "foo" ts.forEach(node.exportClause.elements, checkExportSpecifier); - var inAmbientExternalModule = node.parent.kind === 219 /* ModuleBlock */ && node.parent.parent.name.kind === 9 /* StringLiteral */; - if (node.parent.kind !== 248 /* SourceFile */ && !inAmbientExternalModule) { + var inAmbientExternalModule = node.parent.kind === 226 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent); + if (node.parent.kind !== 256 /* SourceFile */ && !inAmbientExternalModule) { error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace); } } else { // export * from "foo" var moduleSymbol = resolveExternalModuleName(node, node.moduleSpecifier); - if (moduleSymbol && moduleSymbol.exports["export="]) { + if (moduleSymbol && hasExportAssignmentSymbol(moduleSymbol)) { error(node.moduleSpecifier, ts.Diagnostics.Module_0_uses_export_and_cannot_be_used_with_export_Asterisk, symbolToString(moduleSymbol)); } } } } function checkGrammarModuleElementContext(node, errorMessage) { - if (node.parent.kind !== 248 /* SourceFile */ && node.parent.kind !== 219 /* ModuleBlock */ && node.parent.kind !== 218 /* ModuleDeclaration */) { + if (node.parent.kind !== 256 /* SourceFile */ && node.parent.kind !== 226 /* ModuleBlock */ && node.parent.kind !== 225 /* ModuleDeclaration */) { return grammarErrorOnFirstToken(node, errorMessage); } } function checkExportSpecifier(node) { checkAliasSymbol(node); if (!node.parent.parent.moduleSpecifier) { - markExportAsReferenced(node); + var exportedName = node.propertyName || node.name; + // find immediate value referenced by exported name (SymbolFlags.Alias is set so we don't chase down aliases) + var symbol = resolveName(exportedName, exportedName.text, 107455 /* Value */ | 793056 /* Type */ | 1536 /* Namespace */ | 8388608 /* Alias */, + /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined); + if (symbol && (symbol === undefinedSymbol || isGlobalSourceFile(getDeclarationContainer(symbol.declarations[0])))) { + error(exportedName, ts.Diagnostics.Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module, exportedName.text); + } + else { + markExportAsReferenced(node); + } } } function checkExportAssignment(node) { @@ -26441,13 +29995,13 @@ var ts; // If we hit an export assignment in an illegal context, just bail out to avoid cascading errors. return; } - var container = node.parent.kind === 248 /* SourceFile */ ? node.parent : node.parent.parent; - if (container.kind === 218 /* ModuleDeclaration */ && container.name.kind === 69 /* Identifier */) { + var container = node.parent.kind === 256 /* SourceFile */ ? node.parent : node.parent.parent; + if (container.kind === 225 /* ModuleDeclaration */ && !ts.isAmbientModule(container)) { error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); return; } // Grammar checking - if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && (node.flags & 1022 /* Modifier */)) { + if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && (node.flags & 1023 /* Modifier */)) { grammarErrorOnFirstToken(node, ts.Diagnostics.An_export_assignment_cannot_have_modifiers); } if (node.expression.kind === 69 /* Identifier */) { @@ -26458,25 +30012,16 @@ var ts; } checkExternalModuleExports(container); if (node.isExportEquals && !ts.isInAmbientContext(node)) { - if (modulekind === 5 /* ES6 */) { + if (modulekind === ts.ModuleKind.ES6) { // export assignment is not supported in es6 modules grammarErrorOnNode(node, ts.Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_6_modules_Consider_using_export_default_or_another_module_format_instead); } - else if (modulekind === 4 /* System */) { + else if (modulekind === ts.ModuleKind.System) { // system modules does not support export assignment grammarErrorOnNode(node, ts.Diagnostics.Export_assignment_is_not_supported_when_module_flag_is_system); } } } - function getModuleStatements(node) { - if (node.kind === 248 /* SourceFile */) { - return node.statements; - } - if (node.kind === 218 /* ModuleDeclaration */ && node.body.kind === 219 /* ModuleBlock */) { - return node.body.statements; - } - return emptyArray; - } function hasExportedMembers(moduleSymbol) { for (var id in moduleSymbol.exports) { if (id !== "export=") { @@ -26492,14 +30037,41 @@ var ts; var exportEqualsSymbol = moduleSymbol.exports["export="]; if (exportEqualsSymbol && hasExportedMembers(moduleSymbol)) { var declaration = getDeclarationOfAliasSymbol(exportEqualsSymbol) || exportEqualsSymbol.valueDeclaration; - error(declaration, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements); + if (!isTopLevelInExternalModuleAugmentation(declaration)) { + error(declaration, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements); + } + } + // Checks for export * conflicts + var exports = getExportsOfModule(moduleSymbol); + for (var id in exports) { + if (id === "__export") { + continue; + } + var _a = exports[id], declarations = _a.declarations, flags = _a.flags; + // ECMA262: 15.2.1.1 It is a Syntax Error if the ExportedNames of ModuleItemList contains any duplicate entries. + // (TS Exceptions: namespaces, function overloads, enums, and interfaces) + if (flags & (1536 /* Namespace */ | 64 /* Interface */ | 384 /* Enum */)) { + continue; + } + var exportedDeclarationsCount = ts.countWhere(declarations, isNotOverload); + if (flags & 524288 /* TypeAlias */ && exportedDeclarationsCount <= 2) { + // it is legal to merge type alias with other values + // so count should be either 1 (just type alias) or 2 (type alias + merged value) + continue; + } + if (exportedDeclarationsCount > 1) { + for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) { + var declaration = declarations_6[_i]; + if (isNotOverload(declaration)) { + diagnostics.add(ts.createDiagnosticForNode(declaration, ts.Diagnostics.Cannot_redeclare_exported_variable_0, id)); + } + } + } } links.exportsChecked = true; } - } - function checkTypePredicate(node) { - if (!isInLegalTypePredicatePosition(node)) { - error(node, ts.Diagnostics.A_type_predicate_is_only_allowed_in_return_type_position_for_functions_and_methods); + function isNotOverload(declaration) { + return declaration.kind !== 220 /* FunctionDeclaration */ || !!declaration.body; } } function checkSourceElement(node) { @@ -26508,121 +30080,121 @@ var ts; } var kind = node.kind; if (cancellationToken) { - // Only bother checking on a few construct kinds. We don't want to be excessivly + // Only bother checking on a few construct kinds. We don't want to be excessively // hitting the cancellation token on every node we check. switch (kind) { - case 218 /* ModuleDeclaration */: - case 214 /* ClassDeclaration */: - case 215 /* InterfaceDeclaration */: - case 213 /* FunctionDeclaration */: + case 225 /* ModuleDeclaration */: + case 221 /* ClassDeclaration */: + case 222 /* InterfaceDeclaration */: + case 220 /* FunctionDeclaration */: cancellationToken.throwIfCancellationRequested(); } } switch (kind) { - case 137 /* TypeParameter */: + case 141 /* TypeParameter */: return checkTypeParameter(node); - case 138 /* Parameter */: + case 142 /* Parameter */: return checkParameter(node); - case 141 /* PropertyDeclaration */: - case 140 /* PropertySignature */: + case 145 /* PropertyDeclaration */: + case 144 /* PropertySignature */: return checkPropertyDeclaration(node); - case 152 /* FunctionType */: - case 153 /* ConstructorType */: - case 147 /* CallSignature */: - case 148 /* ConstructSignature */: + case 156 /* FunctionType */: + case 157 /* ConstructorType */: + case 151 /* CallSignature */: + case 152 /* ConstructSignature */: return checkSignatureDeclaration(node); - case 149 /* IndexSignature */: + case 153 /* IndexSignature */: return checkSignatureDeclaration(node); - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: return checkMethodDeclaration(node); - case 144 /* Constructor */: + case 148 /* Constructor */: return checkConstructorDeclaration(node); - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: return checkAccessorDeclaration(node); - case 151 /* TypeReference */: + case 155 /* TypeReference */: return checkTypeReferenceNode(node); - case 150 /* TypePredicate */: + case 154 /* TypePredicate */: return checkTypePredicate(node); - case 154 /* TypeQuery */: + case 158 /* TypeQuery */: return checkTypeQuery(node); - case 155 /* TypeLiteral */: + case 159 /* TypeLiteral */: return checkTypeLiteral(node); - case 156 /* ArrayType */: + case 160 /* ArrayType */: return checkArrayType(node); - case 157 /* TupleType */: + case 161 /* TupleType */: return checkTupleType(node); - case 158 /* UnionType */: - case 159 /* IntersectionType */: + case 162 /* UnionType */: + case 163 /* IntersectionType */: return checkUnionOrIntersectionType(node); - case 160 /* ParenthesizedType */: + case 164 /* ParenthesizedType */: return checkSourceElement(node.type); - case 213 /* FunctionDeclaration */: + case 220 /* FunctionDeclaration */: return checkFunctionDeclaration(node); - case 192 /* Block */: - case 219 /* ModuleBlock */: + case 199 /* Block */: + case 226 /* ModuleBlock */: return checkBlock(node); - case 193 /* VariableStatement */: + case 200 /* VariableStatement */: return checkVariableStatement(node); - case 195 /* ExpressionStatement */: + case 202 /* ExpressionStatement */: return checkExpressionStatement(node); - case 196 /* IfStatement */: + case 203 /* IfStatement */: return checkIfStatement(node); - case 197 /* DoStatement */: + case 204 /* DoStatement */: return checkDoStatement(node); - case 198 /* WhileStatement */: + case 205 /* WhileStatement */: return checkWhileStatement(node); - case 199 /* ForStatement */: + case 206 /* ForStatement */: return checkForStatement(node); - case 200 /* ForInStatement */: + case 207 /* ForInStatement */: return checkForInStatement(node); - case 201 /* ForOfStatement */: + case 208 /* ForOfStatement */: return checkForOfStatement(node); - case 202 /* ContinueStatement */: - case 203 /* BreakStatement */: + case 209 /* ContinueStatement */: + case 210 /* BreakStatement */: return checkBreakOrContinueStatement(node); - case 204 /* ReturnStatement */: + case 211 /* ReturnStatement */: return checkReturnStatement(node); - case 205 /* WithStatement */: + case 212 /* WithStatement */: return checkWithStatement(node); - case 206 /* SwitchStatement */: + case 213 /* SwitchStatement */: return checkSwitchStatement(node); - case 207 /* LabeledStatement */: + case 214 /* LabeledStatement */: return checkLabeledStatement(node); - case 208 /* ThrowStatement */: + case 215 /* ThrowStatement */: return checkThrowStatement(node); - case 209 /* TryStatement */: + case 216 /* TryStatement */: return checkTryStatement(node); - case 211 /* VariableDeclaration */: + case 218 /* VariableDeclaration */: return checkVariableDeclaration(node); - case 163 /* BindingElement */: + case 169 /* BindingElement */: return checkBindingElement(node); - case 214 /* ClassDeclaration */: + case 221 /* ClassDeclaration */: return checkClassDeclaration(node); - case 215 /* InterfaceDeclaration */: + case 222 /* InterfaceDeclaration */: return checkInterfaceDeclaration(node); - case 216 /* TypeAliasDeclaration */: + case 223 /* TypeAliasDeclaration */: return checkTypeAliasDeclaration(node); - case 217 /* EnumDeclaration */: + case 224 /* EnumDeclaration */: return checkEnumDeclaration(node); - case 218 /* ModuleDeclaration */: + case 225 /* ModuleDeclaration */: return checkModuleDeclaration(node); - case 222 /* ImportDeclaration */: + case 230 /* ImportDeclaration */: return checkImportDeclaration(node); - case 221 /* ImportEqualsDeclaration */: + case 229 /* ImportEqualsDeclaration */: return checkImportEqualsDeclaration(node); - case 228 /* ExportDeclaration */: + case 236 /* ExportDeclaration */: return checkExportDeclaration(node); - case 227 /* ExportAssignment */: + case 235 /* ExportAssignment */: return checkExportAssignment(node); - case 194 /* EmptyStatement */: + case 201 /* EmptyStatement */: checkGrammarStatementInAmbientContext(node); return; - case 210 /* DebuggerStatement */: + case 217 /* DebuggerStatement */: checkGrammarStatementInAmbientContext(node); return; - case 231 /* MissingDeclaration */: + case 239 /* MissingDeclaration */: return checkMissingDeclaration(node); } } @@ -26635,102 +30207,29 @@ var ts; // Here, performing a full type check of the body of the function expression whilst in the process of // determining the type of foo would cause foo to be given type any because of the recursive reference. // Delaying the type check of the body ensures foo has been assigned a type. - function checkFunctionAndClassExpressionBodies(node) { - switch (node.kind) { - case 173 /* FunctionExpression */: - case 174 /* ArrowFunction */: - ts.forEach(node.parameters, checkFunctionAndClassExpressionBodies); - checkFunctionExpressionOrObjectLiteralMethodBody(node); - break; - case 186 /* ClassExpression */: - ts.forEach(node.members, checkSourceElement); - ts.forEachChild(node, checkFunctionAndClassExpressionBodies); - break; - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - ts.forEach(node.decorators, checkFunctionAndClassExpressionBodies); - ts.forEach(node.parameters, checkFunctionAndClassExpressionBodies); - if (ts.isObjectLiteralMethod(node)) { - checkFunctionExpressionOrObjectLiteralMethodBody(node); - } - break; - case 144 /* Constructor */: - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: - case 213 /* FunctionDeclaration */: - ts.forEach(node.parameters, checkFunctionAndClassExpressionBodies); - break; - case 205 /* WithStatement */: - checkFunctionAndClassExpressionBodies(node.expression); - break; - case 139 /* Decorator */: - case 138 /* Parameter */: - case 141 /* PropertyDeclaration */: - case 140 /* PropertySignature */: - case 161 /* ObjectBindingPattern */: - case 162 /* ArrayBindingPattern */: - case 163 /* BindingElement */: - case 164 /* ArrayLiteralExpression */: - case 165 /* ObjectLiteralExpression */: - case 245 /* PropertyAssignment */: - case 166 /* PropertyAccessExpression */: - case 167 /* ElementAccessExpression */: - case 168 /* CallExpression */: - case 169 /* NewExpression */: - case 170 /* TaggedTemplateExpression */: - case 183 /* TemplateExpression */: - case 190 /* TemplateSpan */: - case 171 /* TypeAssertionExpression */: - case 189 /* AsExpression */: - case 172 /* ParenthesizedExpression */: - case 176 /* TypeOfExpression */: - case 177 /* VoidExpression */: - case 178 /* AwaitExpression */: - case 175 /* DeleteExpression */: - case 179 /* PrefixUnaryExpression */: - case 180 /* PostfixUnaryExpression */: - case 181 /* BinaryExpression */: - case 182 /* ConditionalExpression */: - case 185 /* SpreadElementExpression */: - case 184 /* YieldExpression */: - case 192 /* Block */: - case 219 /* ModuleBlock */: - case 193 /* VariableStatement */: - case 195 /* ExpressionStatement */: - case 196 /* IfStatement */: - case 197 /* DoStatement */: - case 198 /* WhileStatement */: - case 199 /* ForStatement */: - case 200 /* ForInStatement */: - case 201 /* ForOfStatement */: - case 202 /* ContinueStatement */: - case 203 /* BreakStatement */: - case 204 /* ReturnStatement */: - case 206 /* SwitchStatement */: - case 220 /* CaseBlock */: - case 241 /* CaseClause */: - case 242 /* DefaultClause */: - case 207 /* LabeledStatement */: - case 208 /* ThrowStatement */: - case 209 /* TryStatement */: - case 244 /* CatchClause */: - case 211 /* VariableDeclaration */: - case 212 /* VariableDeclarationList */: - case 214 /* ClassDeclaration */: - case 243 /* HeritageClause */: - case 188 /* ExpressionWithTypeArguments */: - case 217 /* EnumDeclaration */: - case 247 /* EnumMember */: - case 227 /* ExportAssignment */: - case 248 /* SourceFile */: - case 240 /* JsxExpression */: - case 233 /* JsxElement */: - case 234 /* JsxSelfClosingElement */: - case 238 /* JsxAttribute */: - case 239 /* JsxSpreadAttribute */: - case 235 /* JsxOpeningElement */: - ts.forEachChild(node, checkFunctionAndClassExpressionBodies); - break; + function checkNodeDeferred(node) { + if (deferredNodes) { + deferredNodes.push(node); + } + } + function checkDeferredNodes() { + for (var _i = 0, deferredNodes_1 = deferredNodes; _i < deferredNodes_1.length; _i++) { + var node = deferredNodes_1[_i]; + switch (node.kind) { + case 179 /* FunctionExpression */: + case 180 /* ArrowFunction */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: + checkFunctionExpressionOrObjectLiteralMethodDeferred(node); + break; + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: + checkAccessorDeferred(node); + break; + case 192 /* ClassExpression */: + checkClassExpressionDeferred(node); + break; + } } } function checkSourceFile(node) { @@ -26753,12 +30252,11 @@ var ts; } // Grammar checking checkGrammarSourceFile(node); - emitExtends = false; - emitDecorate = false; - emitParam = false; potentialThisCollisions.length = 0; + deferredNodes = []; ts.forEach(node.statements, checkSourceElement); - checkFunctionAndClassExpressionBodies(node); + checkDeferredNodes(); + deferredNodes = undefined; if (ts.isExternalOrCommonJsModule(node)) { checkExternalModuleExports(node); } @@ -26766,21 +30264,6 @@ var ts; ts.forEach(potentialThisCollisions, checkIfThisIsCapturedInEnclosingScope); potentialThisCollisions.length = 0; } - if (emitExtends) { - links.flags |= 8 /* EmitExtends */; - } - if (emitDecorate) { - links.flags |= 16 /* EmitDecorate */; - } - if (emitParam) { - links.flags |= 32 /* EmitParam */; - } - if (emitAwaiter) { - links.flags |= 64 /* EmitAwaiter */; - } - if (emitGenerator || (emitAwaiter && languageVersion < 2 /* ES6 */)) { - links.flags |= 128 /* EmitGenerator */; - } links.flags |= 1 /* TypeChecked */; } } @@ -26818,7 +30301,7 @@ var ts; function isInsideWithStatementBody(node) { if (node) { while (node.parent) { - if (node.parent.kind === 205 /* WithStatement */ && node.parent.statement === node) { + if (node.parent.kind === 212 /* WithStatement */ && node.parent.statement === node) { return true; } node = node.parent; @@ -26841,34 +30324,34 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 248 /* SourceFile */: + case 256 /* SourceFile */: if (!ts.isExternalOrCommonJsModule(location)) { break; } - case 218 /* ModuleDeclaration */: + case 225 /* ModuleDeclaration */: copySymbols(getSymbolOfNode(location).exports, meaning & 8914931 /* ModuleMember */); break; - case 217 /* EnumDeclaration */: + case 224 /* EnumDeclaration */: copySymbols(getSymbolOfNode(location).exports, meaning & 8 /* EnumMember */); break; - case 186 /* ClassExpression */: + case 192 /* ClassExpression */: var className = location.name; if (className) { copySymbol(location.symbol, meaning); } // fall through; this fall-through is necessary because we would like to handle // type parameter inside class expression similar to how we handle it in classDeclaration and interface Declaration - case 214 /* ClassDeclaration */: - case 215 /* InterfaceDeclaration */: + case 221 /* ClassDeclaration */: + case 222 /* InterfaceDeclaration */: // If we didn't come from static member of class or interface, // add the type parameters into the symbol table // (type parameters of classDeclaration/classExpression and interface are in member property of the symbol. // Note: that the memberFlags come from previous iteration. - if (!(memberFlags & 64 /* Static */)) { + if (!(memberFlags & 32 /* Static */)) { copySymbols(getSymbolOfNode(location).members, meaning & 793056 /* Type */); } break; - case 173 /* FunctionExpression */: + case 179 /* FunctionExpression */: var funcName = location.name; if (funcName) { copySymbol(location.symbol, meaning); @@ -26917,37 +30400,51 @@ var ts; } function isTypeDeclaration(node) { switch (node.kind) { - case 137 /* TypeParameter */: - case 214 /* ClassDeclaration */: - case 215 /* InterfaceDeclaration */: - case 216 /* TypeAliasDeclaration */: - case 217 /* EnumDeclaration */: + case 141 /* TypeParameter */: + case 221 /* ClassDeclaration */: + case 222 /* InterfaceDeclaration */: + case 223 /* TypeAliasDeclaration */: + case 224 /* EnumDeclaration */: return true; } } // True if the given identifier is part of a type reference function isTypeReferenceIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 135 /* QualifiedName */) { + while (node.parent && node.parent.kind === 139 /* QualifiedName */) { node = node.parent; } - return node.parent && node.parent.kind === 151 /* TypeReference */; + return node.parent && node.parent.kind === 155 /* TypeReference */; } function isHeritageClauseElementIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 166 /* PropertyAccessExpression */) { + while (node.parent && node.parent.kind === 172 /* PropertyAccessExpression */) { node = node.parent; } - return node.parent && node.parent.kind === 188 /* ExpressionWithTypeArguments */; + return node.parent && node.parent.kind === 194 /* ExpressionWithTypeArguments */; + } + function forEachEnclosingClass(node, callback) { + var result; + while (true) { + node = ts.getContainingClass(node); + if (!node) + break; + if (result = callback(node)) + break; + } + return result; + } + function isNodeWithinClass(node, classDeclaration) { + return !!forEachEnclosingClass(node, function (n) { return n === classDeclaration; }); } function getLeftSideOfImportEqualsOrExportAssignment(nodeOnRightSide) { - while (nodeOnRightSide.parent.kind === 135 /* QualifiedName */) { + while (nodeOnRightSide.parent.kind === 139 /* QualifiedName */) { nodeOnRightSide = nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 221 /* ImportEqualsDeclaration */) { + if (nodeOnRightSide.parent.kind === 229 /* ImportEqualsDeclaration */) { return nodeOnRightSide.parent.moduleReference === nodeOnRightSide && nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 227 /* ExportAssignment */) { + if (nodeOnRightSide.parent.kind === 235 /* ExportAssignment */) { return nodeOnRightSide.parent.expression === nodeOnRightSide && nodeOnRightSide.parent; } return undefined; @@ -26959,11 +30456,23 @@ var ts; if (ts.isDeclarationName(entityName)) { return getSymbolOfNode(entityName.parent); } - if (entityName.parent.kind === 227 /* ExportAssignment */) { + if (ts.isInJavaScriptFile(entityName) && entityName.parent.kind === 172 /* PropertyAccessExpression */) { + var specialPropertyAssignmentKind = ts.getSpecialPropertyAssignmentKind(entityName.parent.parent); + switch (specialPropertyAssignmentKind) { + case 1 /* ExportsProperty */: + case 3 /* PrototypeProperty */: + return getSymbolOfNode(entityName.parent); + case 4 /* ThisProperty */: + case 2 /* ModuleExports */: + return getSymbolOfNode(entityName.parent.parent); + default: + } + } + if (entityName.parent.kind === 235 /* ExportAssignment */) { return resolveEntityName(entityName, /*all meanings*/ 107455 /* Value */ | 793056 /* Type */ | 1536 /* Namespace */ | 8388608 /* Alias */); } - if (entityName.kind !== 166 /* PropertyAccessExpression */) { + if (entityName.kind !== 172 /* PropertyAccessExpression */) { if (isInRightSideOfImportOrExportAssignment(entityName)) { // Since we already checked for ExportAssignment, this really could only be an Import return getSymbolOfPartOfRightHandSideOfImportEquals(entityName); @@ -26975,7 +30484,7 @@ var ts; if (isHeritageClauseElementIdentifier(entityName)) { var meaning = 0 /* None */; // In an interface or class, we're definitely interested in a type. - if (entityName.parent.kind === 188 /* ExpressionWithTypeArguments */) { + if (entityName.parent.kind === 194 /* ExpressionWithTypeArguments */) { meaning = 793056 /* Type */; // In a class 'extends' clause we are also looking for a value. if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) { @@ -26988,30 +30497,28 @@ var ts; meaning |= 8388608 /* Alias */; return resolveEntityName(entityName, meaning); } - else if ((entityName.parent.kind === 235 /* JsxOpeningElement */) || - (entityName.parent.kind === 234 /* JsxSelfClosingElement */) || - (entityName.parent.kind === 237 /* JsxClosingElement */)) { - return getJsxElementTagSymbol(entityName.parent); - } else if (ts.isExpression(entityName)) { if (ts.nodeIsMissing(entityName)) { // Missing entity name. return undefined; } if (entityName.kind === 69 /* Identifier */) { + if (ts.isJSXTagName(entityName) && isJsxIntrinsicIdentifier(entityName)) { + return getIntrinsicTagSymbol(entityName.parent); + } // Include aliases in the meaning, this ensures that we do not follow aliases to where they point and instead // return the alias symbol. var meaning = 107455 /* Value */ | 8388608 /* Alias */; return resolveEntityName(entityName, meaning); } - else if (entityName.kind === 166 /* PropertyAccessExpression */) { + else if (entityName.kind === 172 /* PropertyAccessExpression */) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkPropertyAccessExpression(entityName); } return getNodeLinks(entityName).resolvedSymbol; } - else if (entityName.kind === 135 /* QualifiedName */) { + else if (entityName.kind === 139 /* QualifiedName */) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkQualifiedName(entityName); @@ -27020,22 +30527,25 @@ var ts; } } else if (isTypeReferenceIdentifier(entityName)) { - var meaning = entityName.parent.kind === 151 /* TypeReference */ ? 793056 /* Type */ : 1536 /* Namespace */; + var meaning = entityName.parent.kind === 155 /* TypeReference */ ? 793056 /* Type */ : 1536 /* Namespace */; // Include aliases in the meaning, this ensures that we do not follow aliases to where they point and instead // return the alias symbol. meaning |= 8388608 /* Alias */; return resolveEntityName(entityName, meaning); } - else if (entityName.parent.kind === 238 /* JsxAttribute */) { + else if (entityName.parent.kind === 246 /* JsxAttribute */) { return getJsxAttributePropertySymbol(entityName.parent); } - if (entityName.parent.kind === 150 /* TypePredicate */) { + if (entityName.parent.kind === 154 /* TypePredicate */) { return resolveEntityName(entityName, /*meaning*/ 1 /* FunctionScopedVariable */); } // Do we want to return undefined here? return undefined; } function getSymbolAtLocation(node) { + if (node.kind === 256 /* SourceFile */) { + return ts.isExternalModule(node) ? getMergedSymbol(node.symbol) : undefined; + } if (isInsideWithStatementBody(node)) { // We cannot answer semantic questions within a with block, do not proceed any further return undefined; @@ -27044,14 +30554,17 @@ var ts; // This is a declaration, call getSymbolOfNode return getSymbolOfNode(node.parent); } + else if (ts.isLiteralComputedPropertyDeclarationName(node)) { + return getSymbolOfNode(node.parent.parent); + } if (node.kind === 69 /* Identifier */) { if (isInRightSideOfImportOrExportAssignment(node)) { - return node.parent.kind === 227 /* ExportAssignment */ + return node.parent.kind === 235 /* ExportAssignment */ ? getSymbolOfEntityNameOrPropertyAccessExpression(node) : getSymbolOfPartOfRightHandSideOfImportEquals(node); } - else if (node.parent.kind === 163 /* BindingElement */ && - node.parent.parent.kind === 161 /* ObjectBindingPattern */ && + else if (node.parent.kind === 169 /* BindingElement */ && + node.parent.parent.kind === 167 /* ObjectBindingPattern */ && node === node.parent.propertyName) { var typeOfPattern = getTypeOfNode(node.parent.parent); var propertyDeclaration = typeOfPattern && getPropertyOfType(typeOfPattern, node.text); @@ -27062,17 +30575,19 @@ var ts; } switch (node.kind) { case 69 /* Identifier */: - case 166 /* PropertyAccessExpression */: - case 135 /* QualifiedName */: + case 172 /* PropertyAccessExpression */: + case 139 /* QualifiedName */: return getSymbolOfEntityNameOrPropertyAccessExpression(node); case 97 /* ThisKeyword */: case 95 /* SuperKeyword */: var type = ts.isExpression(node) ? checkExpression(node) : getTypeFromTypeNode(node); return type.symbol; + case 165 /* ThisType */: + return getTypeFromTypeNode(node).symbol; case 121 /* ConstructorKeyword */: // constructor keyword for an overload, should take us to the definition if it exist var constructorDeclaration = node.parent; - if (constructorDeclaration && constructorDeclaration.kind === 144 /* Constructor */) { + if (constructorDeclaration && constructorDeclaration.kind === 148 /* Constructor */) { return constructorDeclaration.parent.symbol; } return undefined; @@ -27080,14 +30595,14 @@ var ts; // External module name in an import declaration if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || - ((node.parent.kind === 222 /* ImportDeclaration */ || node.parent.kind === 228 /* ExportDeclaration */) && + ((node.parent.kind === 230 /* ImportDeclaration */ || node.parent.kind === 236 /* ExportDeclaration */) && node.parent.moduleSpecifier === node)) { return resolveExternalModuleName(node, node); } // Fall through case 8 /* NumericLiteral */: // index access - if (node.parent.kind === 167 /* ElementAccessExpression */ && node.parent.argumentExpression === node) { + if (node.parent.kind === 173 /* ElementAccessExpression */ && node.parent.argumentExpression === node) { var objectType = checkExpression(node.parent.expression); if (objectType === unknownType) return undefined; @@ -27104,11 +30619,17 @@ var ts; // The function returns a value 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. - if (location && location.kind === 246 /* ShorthandPropertyAssignment */) { - return resolveEntityName(location.name, 107455 /* Value */); + if (location && location.kind === 254 /* ShorthandPropertyAssignment */) { + return resolveEntityName(location.name, 107455 /* Value */ | 8388608 /* Alias */); } return undefined; } + /** Returns the target of an export specifier without following aliases */ + function getExportSpecifierLocalTargetSymbol(node) { + return node.parent.parent.moduleSpecifier ? + getExternalModuleMember(node.parent.parent, node) : + resolveEntityName(node.propertyName || node.name, 107455 /* Value */ | 793056 /* Type */ | 1536 /* Namespace */ | 8388608 /* Alias */); + } function getTypeOfNode(node) { if (isInsideWithStatementBody(node)) { // We cannot answer semantic questions within a with block, do not proceed any further @@ -27153,6 +30674,51 @@ var ts; } return unknownType; } + // Gets the type of object literal or array literal of destructuring assignment. + // { a } from + // for ( { a } of elems) { + // } + // [ a ] from + // [a] = [ some array ...] + function getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr) { + ts.Debug.assert(expr.kind === 171 /* ObjectLiteralExpression */ || expr.kind === 170 /* ArrayLiteralExpression */); + // If this is from "for of" + // for ( { a } of elems) { + // } + if (expr.parent.kind === 208 /* ForOfStatement */) { + var iteratedType = checkRightHandSideOfForOf(expr.parent.expression); + return checkDestructuringAssignment(expr, iteratedType || unknownType); + } + // If this is from "for" initializer + // for ({a } = elems[0];.....) { } + if (expr.parent.kind === 187 /* BinaryExpression */) { + var iteratedType = checkExpression(expr.parent.right); + return checkDestructuringAssignment(expr, iteratedType || unknownType); + } + // If this is from nested object binding pattern + // for ({ skills: { primary, secondary } } = multiRobot, i = 0; i < 1; i++) { + if (expr.parent.kind === 253 /* PropertyAssignment */) { + var typeOfParentObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent.parent); + return checkObjectLiteralDestructuringPropertyAssignment(typeOfParentObjectLiteral || unknownType, expr.parent); + } + // Array literal assignment - array destructuring pattern + ts.Debug.assert(expr.parent.kind === 170 /* ArrayLiteralExpression */); + // [{ property1: p1, property2 }] = elems; + var typeOfArrayLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent); + var elementType = checkIteratedTypeOrElementType(typeOfArrayLiteral || unknownType, expr.parent, /*allowStringInput*/ false) || unknownType; + return checkArrayLiteralDestructuringElementAssignment(expr.parent, typeOfArrayLiteral, ts.indexOf(expr.parent.elements, expr), elementType || unknownType); + } + // Gets the property symbol corresponding to the property in destructuring assignment + // 'property1' from + // for ( { property1: a } of elems) { + // } + // 'property1' at location 'a' from: + // [a] = [ property1, property2 ] + function getPropertySymbolOfDestructuringAssignment(location) { + // Get the type of the object or array literal and then look for property of given name in the type + var typeOfObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(location.parent.parent); + return typeOfObjectLiteral && getPropertyOfType(typeOfObjectLiteral, location.text); + } function getTypeOfExpression(expr) { if (ts.isRightSideOfQualifiedNameOrPropertyAccess(expr)) { expr = expr.parent; @@ -27165,7 +30731,7 @@ var ts; */ function getParentTypeOfClassElement(node) { var classSymbol = getSymbolOfNode(node.parent); - return node.flags & 64 /* Static */ + return node.flags & 32 /* Static */ ? getTypeOfSymbol(classSymbol) : getDeclaredTypeOfSymbol(classSymbol); } @@ -27185,18 +30751,22 @@ var ts; } function getRootSymbols(symbol) { if (symbol.flags & 268435456 /* SyntheticProperty */) { - var symbols = []; - var name_15 = symbol.name; + var symbols_3 = []; + var name_19 = symbol.name; ts.forEach(getSymbolLinks(symbol).containingType.types, function (t) { - var symbol = getPropertyOfType(t, name_15); + var symbol = getPropertyOfType(t, name_19); if (symbol) { - symbols.push(symbol); + symbols_3.push(symbol); } }); - return symbols; + return symbols_3; } else if (symbol.flags & 67108864 /* Transient */) { - var target = getSymbolLinks(symbol).target; + var target = void 0; + var next = symbol; + while (next = getSymbolLinks(next).target) { + target = next; + } if (target) { return [target]; } @@ -27207,6 +30777,30 @@ var ts; function isArgumentsLocalBinding(node) { return getReferencedValueSymbol(node) === argumentsSymbol; } + function moduleExportsSomeValue(moduleReferenceExpression) { + var moduleSymbol = resolveExternalModuleName(moduleReferenceExpression.parent, moduleReferenceExpression); + if (!moduleSymbol) { + // module not found - be conservative + return true; + } + var hasExportAssignment = hasExportAssignmentSymbol(moduleSymbol); + // if module has export assignment then 'resolveExternalModuleSymbol' will return resolved symbol for export assignment + // otherwise it will return moduleSymbol itself + moduleSymbol = resolveExternalModuleSymbol(moduleSymbol); + var symbolLinks = getSymbolLinks(moduleSymbol); + if (symbolLinks.exportsSomeValue === undefined) { + // for export assignments - check if resolved symbol for RHS is itself a value + // otherwise - check if at least one export is value + symbolLinks.exportsSomeValue = hasExportAssignment + ? !!(moduleSymbol.flags & 107455 /* Value */) + : ts.forEachValue(getExportsOfModule(moduleSymbol), isValue); + } + return symbolLinks.exportsSomeValue; + function isValue(s) { + s = resolveSymbol(s); + return s && !!(s.flags & 107455 /* Value */); + } + } // When resolved as an expression identifier, if the given node references an exported entity, return the declaration // node of the exported entity's container. Otherwise, return undefined. function getReferencedExportContainer(node) { @@ -27224,11 +30818,11 @@ var ts; } var parentSymbol = getParentOfSymbol(symbol); if (parentSymbol) { - if (parentSymbol.flags & 512 /* ValueModule */ && parentSymbol.valueDeclaration.kind === 248 /* SourceFile */) { + if (parentSymbol.flags & 512 /* ValueModule */ && parentSymbol.valueDeclaration.kind === 256 /* SourceFile */) { return parentSymbol.valueDeclaration; } for (var n = node.parent; n; n = n.parent) { - if ((n.kind === 218 /* ModuleDeclaration */ || n.kind === 217 /* EnumDeclaration */) && getSymbolOfNode(n) === parentSymbol) { + if ((n.kind === 225 /* ModuleDeclaration */ || n.kind === 224 /* EnumDeclaration */) && getSymbolOfNode(n) === parentSymbol) { return n; } } @@ -27241,58 +30835,77 @@ var ts; var symbol = getReferencedValueSymbol(node); return symbol && symbol.flags & 8388608 /* Alias */ ? getDeclarationOfAliasSymbol(symbol) : undefined; } - function isStatementWithLocals(node) { - switch (node.kind) { - case 192 /* Block */: - case 220 /* CaseBlock */: - case 199 /* ForStatement */: - case 200 /* ForInStatement */: - case 201 /* ForOfStatement */: - return true; - } - return false; - } - function isNestedRedeclarationSymbol(symbol) { + function isSymbolOfDeclarationWithCollidingName(symbol) { if (symbol.flags & 418 /* BlockScoped */) { var links = getSymbolLinks(symbol); - if (links.isNestedRedeclaration === undefined) { + if (links.isDeclarationWithCollidingName === undefined) { var container = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration); - links.isNestedRedeclaration = isStatementWithLocals(container) && - !!resolveName(container.parent, symbol.name, 107455 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined); + if (ts.isStatementWithLocals(container)) { + var nodeLinks_1 = getNodeLinks(symbol.valueDeclaration); + if (!!resolveName(container.parent, symbol.name, 107455 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined)) { + // redeclaration - always should be renamed + links.isDeclarationWithCollidingName = true; + } + else if (nodeLinks_1.flags & 131072 /* CapturedBlockScopedBinding */) { + // binding is captured in the function + // should be renamed if: + // - binding is not top level - top level bindings never collide with anything + // AND + // - binding is not declared in loop, should be renamed to avoid name reuse across siblings + // let a, b + // { let x = 1; a = () => x; } + // { let x = 100; b = () => x; } + // console.log(a()); // should print '1' + // console.log(b()); // should print '100' + // OR + // - binding is declared inside loop but not in inside initializer of iteration statement or directly inside loop body + // * variables from initializer are passed to rewritten loop body as parameters so they are not captured directly + // * variables that are declared immediately in loop body will become top level variable after loop is rewritten and thus + // they will not collide with anything + var isDeclaredInLoop = nodeLinks_1.flags & 262144 /* BlockScopedBindingInLoop */; + var inLoopInitializer = ts.isIterationStatement(container, /*lookInLabeledStatements*/ false); + var inLoopBodyBlock = container.kind === 199 /* Block */ && ts.isIterationStatement(container.parent, /*lookInLabeledStatements*/ false); + links.isDeclarationWithCollidingName = !ts.isBlockScopedContainerTopLevel(container) && (!isDeclaredInLoop || (!inLoopInitializer && !inLoopBodyBlock)); + } + else { + links.isDeclarationWithCollidingName = false; + } + } } - return links.isNestedRedeclaration; + return links.isDeclarationWithCollidingName; } return false; } // When resolved as an expression identifier, if the given node references a nested block scoped entity with - // a name that hides an existing name, return the declaration of that entity. Otherwise, return undefined. - function getReferencedNestedRedeclaration(node) { + // a name that either hides an existing name or might hide it when compiled downlevel, + // return the declaration of that entity. Otherwise, return undefined. + function getReferencedDeclarationWithCollidingName(node) { var symbol = getReferencedValueSymbol(node); - return symbol && isNestedRedeclarationSymbol(symbol) ? symbol.valueDeclaration : undefined; + return symbol && isSymbolOfDeclarationWithCollidingName(symbol) ? symbol.valueDeclaration : undefined; } - // Return true if the given node is a declaration of a nested block scoped entity with a name that hides an - // existing name. - function isNestedRedeclaration(node) { - return isNestedRedeclarationSymbol(getSymbolOfNode(node)); + // Return true if the given node is a declaration of a nested block scoped entity with a name that either hides an + // existing name or might hide a name when compiled downlevel + function isDeclarationWithCollidingName(node) { + return isSymbolOfDeclarationWithCollidingName(getSymbolOfNode(node)); } function isValueAliasDeclaration(node) { switch (node.kind) { - case 221 /* ImportEqualsDeclaration */: - case 223 /* ImportClause */: - case 224 /* NamespaceImport */: - case 226 /* ImportSpecifier */: - case 230 /* ExportSpecifier */: + case 229 /* ImportEqualsDeclaration */: + case 231 /* ImportClause */: + case 232 /* NamespaceImport */: + case 234 /* ImportSpecifier */: + case 238 /* ExportSpecifier */: return isAliasResolvedToValue(getSymbolOfNode(node)); - case 228 /* ExportDeclaration */: + case 236 /* ExportDeclaration */: var exportClause = node.exportClause; return exportClause && ts.forEach(exportClause.elements, isValueAliasDeclaration); - case 227 /* ExportAssignment */: + case 235 /* ExportAssignment */: return node.expression && node.expression.kind === 69 /* Identifier */ ? isAliasResolvedToValue(getSymbolOfNode(node)) : true; } return false; } function isTopLevelValueImportEqualsWithEntityName(node) { - if (node.parent.kind !== 248 /* SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) { + if (node.parent.kind !== 256 /* SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) { // parent is not source file or it is not reference to internal module return false; } @@ -27301,14 +30914,12 @@ var ts; } function isAliasResolvedToValue(symbol) { var target = resolveAlias(symbol); - if (target === unknownSymbol && compilerOptions.isolatedModules) { + if (target === unknownSymbol) { return true; } - // const enums and modules that contain only const enums are not considered values from the emit perespective + // const enums and modules that contain only const enums are not considered values from the emit perspective // unless 'preserveConstEnums' option is set to true - return target !== unknownSymbol && - target && - target.flags & 107455 /* Value */ && + return target.flags & 107455 /* Value */ && (compilerOptions.preserveConstEnums || !isConstEnumOrConstEnumOnlyModule(target)); } function isConstEnumOrConstEnumOnlyModule(s) { @@ -27354,7 +30965,7 @@ var ts; return getNodeLinks(node).enumMemberValue; } function getConstantValue(node) { - if (node.kind === 247 /* EnumMember */) { + if (node.kind === 255 /* EnumMember */) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; @@ -27389,22 +31000,22 @@ var ts; else if (type.flags & 1 /* Any */) { return ts.TypeReferenceSerializationKind.ObjectType; } - else if (allConstituentTypesHaveKind(type, 16 /* Void */)) { + else if (isTypeOfKind(type, 16 /* Void */)) { return ts.TypeReferenceSerializationKind.VoidType; } - else if (allConstituentTypesHaveKind(type, 8 /* Boolean */)) { + else if (isTypeOfKind(type, 8 /* Boolean */)) { return ts.TypeReferenceSerializationKind.BooleanType; } - else if (allConstituentTypesHaveKind(type, 132 /* NumberLike */)) { + else if (isTypeOfKind(type, 132 /* NumberLike */)) { return ts.TypeReferenceSerializationKind.NumberLikeType; } - else if (allConstituentTypesHaveKind(type, 258 /* StringLike */)) { + else if (isTypeOfKind(type, 258 /* StringLike */)) { return ts.TypeReferenceSerializationKind.StringLikeType; } - else if (allConstituentTypesHaveKind(type, 8192 /* Tuple */)) { + else if (isTypeOfKind(type, 8192 /* Tuple */)) { return ts.TypeReferenceSerializationKind.ArrayLikeType; } - else if (allConstituentTypesHaveKind(type, 16777216 /* ESSymbol */)) { + else if (isTypeOfKind(type, 16777216 /* ESSymbol */)) { return ts.TypeReferenceSerializationKind.ESSymbolType; } else if (isFunctionType(type)) { @@ -27430,9 +31041,15 @@ var ts; getSymbolDisplayBuilder().buildTypeDisplay(getReturnTypeOfSignature(signature), writer, enclosingDeclaration, flags); } function writeTypeOfExpression(expr, enclosingDeclaration, flags, writer) { - var type = getTypeOfExpression(expr); + var type = getWidenedType(getTypeOfExpression(expr)); getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags); } + function writeBaseConstructorTypeOfClass(node, enclosingDeclaration, flags, writer) { + var classType = getDeclaredTypeOfSymbol(getSymbolOfNode(node)); + resolveBaseTypesOfClass(classType); + var baseType = classType.resolvedBaseTypes.length ? classType.resolvedBaseTypes[0] : unknownType; + getSymbolDisplayBuilder().buildTypeDisplay(baseType, writer, enclosingDeclaration, flags); + } function hasGlobalName(name) { return ts.hasProperty(globals, name); } @@ -27446,23 +31063,31 @@ var ts; var symbol = getReferencedValueSymbol(reference); return symbol && getExportSymbolOfValueSymbolIfExported(symbol).valueDeclaration; } - function instantiateSingleCallFunctionType(functionType, typeArguments) { - if (functionType === unknownType) { - return unknownType; - } - var signature = getSingleCallSignature(functionType); - if (!signature) { - return unknownType; - } - var instantiatedSignature = getSignatureInstantiation(signature, typeArguments); - return getOrCreateTypeFromSignature(instantiatedSignature); - } function createResolver() { + // this variable and functions that use it are deliberately moved here from the outer scope + // to avoid scope pollution + var resolvedTypeReferenceDirectives = host.getResolvedTypeReferenceDirectives(); + var fileToDirective; + if (resolvedTypeReferenceDirectives) { + // populate reverse mapping: file path -> type reference directive that was resolved to this file + fileToDirective = ts.createFileMap(); + for (var key in resolvedTypeReferenceDirectives) { + if (!ts.hasProperty(resolvedTypeReferenceDirectives, key)) { + continue; + } + var resolvedDirective = resolvedTypeReferenceDirectives[key]; + if (!resolvedDirective) { + continue; + } + var file = host.getSourceFile(resolvedDirective.resolvedFileName); + fileToDirective.set(file.path, key); + } + } return { getReferencedExportContainer: getReferencedExportContainer, getReferencedImportDeclaration: getReferencedImportDeclaration, - getReferencedNestedRedeclaration: getReferencedNestedRedeclaration, - isNestedRedeclaration: isNestedRedeclaration, + getReferencedDeclarationWithCollidingName: getReferencedDeclarationWithCollidingName, + isDeclarationWithCollidingName: isDeclarationWithCollidingName, isValueAliasDeclaration: isValueAliasDeclaration, hasGlobalName: hasGlobalName, isReferencedAliasDeclaration: isReferencedAliasDeclaration, @@ -27473,6 +31098,7 @@ var ts; writeTypeOfDeclaration: writeTypeOfDeclaration, writeReturnTypeOfSignatureDeclaration: writeReturnTypeOfSignatureDeclaration, writeTypeOfExpression: writeTypeOfExpression, + writeBaseConstructorTypeOfClass: writeBaseConstructorTypeOfClass, isSymbolAccessible: isSymbolAccessible, isEntityNameVisible: isEntityNameVisible, getConstantValue: getConstantValue, @@ -27480,33 +31106,124 @@ var ts; getReferencedValueDeclaration: getReferencedValueDeclaration, getTypeReferenceSerializationKind: getTypeReferenceSerializationKind, isOptionalParameter: isOptionalParameter, + moduleExportsSomeValue: moduleExportsSomeValue, isArgumentsLocalBinding: isArgumentsLocalBinding, - getExternalModuleFileFromDeclaration: getExternalModuleFileFromDeclaration + getExternalModuleFileFromDeclaration: getExternalModuleFileFromDeclaration, + getTypeReferenceDirectivesForEntityName: getTypeReferenceDirectivesForEntityName, + getTypeReferenceDirectivesForSymbol: getTypeReferenceDirectivesForSymbol }; + // defined here to avoid outer scope pollution + function getTypeReferenceDirectivesForEntityName(node) { + // program does not have any files with type reference directives - bail out + if (!fileToDirective) { + return undefined; + } + // property access can only be used as values + // qualified names can only be used as types\namespaces + // identifiers are treated as values only if they appear in type queries + var meaning = (node.kind === 172 /* PropertyAccessExpression */) || (node.kind === 69 /* Identifier */ && isInTypeQuery(node)) + ? 107455 /* Value */ | 1048576 /* ExportValue */ + : 793056 /* Type */ | 1536 /* Namespace */; + var symbol = resolveEntityName(node, meaning, /*ignoreErrors*/ true); + return symbol && symbol !== unknownSymbol ? getTypeReferenceDirectivesForSymbol(symbol, meaning) : undefined; + } + // defined here to avoid outer scope pollution + function getTypeReferenceDirectivesForSymbol(symbol, meaning) { + // program does not have any files with type reference directives - bail out + if (!fileToDirective) { + return undefined; + } + if (!isSymbolFromTypeDeclarationFile(symbol)) { + return undefined; + } + // check what declarations in the symbol can contribute to the target meaning + var typeReferenceDirectives; + for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { + var decl = _a[_i]; + // check meaning of the local symbol to see if declaration needs to be analyzed further + if (decl.symbol && decl.symbol.flags & meaning) { + var file = ts.getSourceFileOfNode(decl); + var typeReferenceDirective = fileToDirective.get(file.path); + if (typeReferenceDirective) { + (typeReferenceDirectives || (typeReferenceDirectives = [])).push(typeReferenceDirective); + } + } + } + return typeReferenceDirectives; + } + function isSymbolFromTypeDeclarationFile(symbol) { + // bail out if symbol does not have associated declarations (i.e. this is transient symbol created for property in binding pattern) + if (!symbol.declarations) { + return false; + } + // walk the parent chain for symbols to make sure that top level parent symbol is in the global scope + // external modules cannot define or contribute to type declaration files + var current = symbol; + while (true) { + var parent_12 = getParentOfSymbol(current); + if (parent_12) { + current = parent_12; + } + else { + break; + } + } + if (current.valueDeclaration && current.valueDeclaration.kind === 256 /* SourceFile */ && current.flags & 512 /* ValueModule */) { + return false; + } + // check that at least one declaration of top level symbol originates from type declaration file + for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { + var decl = _a[_i]; + var file = ts.getSourceFileOfNode(decl); + if (fileToDirective.contains(file.path)) { + return true; + } + } + return false; + } } function getExternalModuleFileFromDeclaration(declaration) { var specifier = ts.getExternalModuleName(declaration); - var moduleSymbol = getSymbolAtLocation(specifier); + var moduleSymbol = resolveExternalModuleNameWorker(specifier, specifier, /*moduleNotFoundError*/ undefined); if (!moduleSymbol) { return undefined; } - return ts.getDeclarationOfKind(moduleSymbol, 248 /* SourceFile */); + return ts.getDeclarationOfKind(moduleSymbol, 256 /* SourceFile */); } function initializeTypeChecker() { // Bind all source files and propagate errors ts.forEach(host.getSourceFiles(), function (file) { ts.bindSourceFile(file, compilerOptions); }); + var augmentations; // Initialize global symbol table ts.forEach(host.getSourceFiles(), function (file) { if (!ts.isExternalOrCommonJsModule(file)) { mergeSymbolTable(globals, file.locals); } + if (file.moduleAugmentations.length) { + (augmentations || (augmentations = [])).push(file.moduleAugmentations); + } + if (file.wasReferenced && file.symbol && file.symbol.globalExports) { + mergeSymbolTable(globals, file.symbol.globalExports); + } }); + if (augmentations) { + // merge module augmentations. + // this needs to be done after global symbol table is initialized to make sure that all ambient modules are indexed + for (var _i = 0, augmentations_1 = augmentations; _i < augmentations_1.length; _i++) { + var list = augmentations_1[_i]; + for (var _a = 0, list_2 = list; _a < list_2.length; _a++) { + var augmentation = list_2[_a]; + mergeModuleAugmentation(augmentation); + } + } + } + // Setup global builtins + addToSymbolTable(globals, builtinGlobals, ts.Diagnostics.Declaration_name_conflicts_with_built_in_global_identifier_0); getSymbolLinks(undefinedSymbol).type = undefinedType; getSymbolLinks(argumentsSymbol).type = getGlobalType("IArguments"); getSymbolLinks(unknownSymbol).type = unknownType; - globals[undefinedSymbol.name] = undefinedSymbol; // Initialize special types globalArrayType = getGlobalType("Array", /*arity*/ 1); globalObjectType = getGlobalType("Object"); @@ -27521,6 +31238,7 @@ var ts; getGlobalMethodDecoratorType = ts.memoize(function () { return getGlobalType("MethodDecorator"); }); getGlobalParameterDecoratorType = ts.memoize(function () { return getGlobalType("ParameterDecorator"); }); getGlobalTypedPropertyDescriptorType = ts.memoize(function () { return getGlobalType("TypedPropertyDescriptor", /*arity*/ 1); }); + getGlobalESSymbolConstructorSymbol = ts.memoize(function () { return getGlobalValueSymbol("Symbol"); }); getGlobalPromiseType = ts.memoize(function () { return getGlobalType("Promise", /*arity*/ 1); }); tryGetGlobalPromiseType = ts.memoize(function () { return getGlobalSymbol("Promise", 793056 /* Type */, /*diagnostic*/ undefined) && getGlobalPromiseType(); }); getGlobalPromiseLikeType = ts.memoize(function () { return getGlobalType("PromiseLike", /*arity*/ 1); }); @@ -27528,28 +31246,23 @@ var ts; getGlobalPromiseConstructorSymbol = ts.memoize(function () { return getGlobalValueSymbol("Promise"); }); getGlobalPromiseConstructorLikeType = ts.memoize(function () { return getGlobalType("PromiseConstructorLike"); }); getGlobalThenableType = ts.memoize(createThenableType); - // If we're in ES6 mode, load the TemplateStringsArray. - // Otherwise, default to 'unknown' for the purposes of type checking in LS scenarios. + getGlobalTemplateStringsArrayType = ts.memoize(function () { return getGlobalType("TemplateStringsArray"); }); if (languageVersion >= 2 /* ES6 */) { - globalTemplateStringsArrayType = getGlobalType("TemplateStringsArray"); - globalESSymbolType = getGlobalType("Symbol"); - globalESSymbolConstructorSymbol = getGlobalValueSymbol("Symbol"); - globalIterableType = getGlobalType("Iterable", /*arity*/ 1); - globalIteratorType = getGlobalType("Iterator", /*arity*/ 1); - globalIterableIteratorType = getGlobalType("IterableIterator", /*arity*/ 1); + getGlobalESSymbolType = ts.memoize(function () { return getGlobalType("Symbol"); }); + getGlobalIterableType = ts.memoize(function () { return getGlobalType("Iterable", /*arity*/ 1); }); + getGlobalIteratorType = ts.memoize(function () { return getGlobalType("Iterator", /*arity*/ 1); }); + getGlobalIterableIteratorType = ts.memoize(function () { return getGlobalType("IterableIterator", /*arity*/ 1); }); } else { - globalTemplateStringsArrayType = unknownType; - // Consider putting Symbol interface in lib.d.ts. On the plus side, putting it in lib.d.ts would make it - // extensible for Polyfilling Symbols. But putting it into lib.d.ts could also break users that have - // a global Symbol already, particularly if it is a class. - globalESSymbolType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); - globalESSymbolConstructorSymbol = undefined; - globalIterableType = emptyGenericType; - globalIteratorType = emptyGenericType; - globalIterableIteratorType = emptyGenericType; + getGlobalESSymbolType = ts.memoize(function () { return emptyObjectType; }); + getGlobalIterableType = ts.memoize(function () { return emptyGenericType; }); + getGlobalIteratorType = ts.memoize(function () { return emptyGenericType; }); + getGlobalIterableIteratorType = ts.memoize(function () { return emptyGenericType; }); } anyArrayType = createArrayType(anyType); + var symbol = getGlobalSymbol("ReadonlyArray", 793056 /* Type */, /*diagnostic*/ undefined); + globalReadonlyArrayType = symbol && getTypeOfGlobalSymbol(symbol, /*arity*/ 1); + anyReadonlyArrayType = globalReadonlyArrayType ? createTypeFromGenericGlobalType(globalReadonlyArrayType, [anyType]) : anyArrayType; } function createInstantiatedPromiseLikeType() { var promiseLikeType = getGlobalPromiseLikeType(); @@ -27575,9 +31288,14 @@ var ts; return false; } if (!ts.nodeCanBeDecorated(node)) { - return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_are_not_valid_here); + if (node.kind === 147 /* MethodDeclaration */ && !ts.nodeIsPresent(node.body)) { + return grammarErrorOnFirstToken(node, ts.Diagnostics.A_decorator_can_only_decorate_a_method_implementation_not_an_overload); + } + else { + return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_are_not_valid_here); + } } - else if (node.kind === 145 /* GetAccessor */ || node.kind === 146 /* SetAccessor */) { + else if (node.kind === 149 /* GetAccessor */ || node.kind === 150 /* SetAccessor */) { var accessors = ts.getAllAccessorDeclarations(node.parent.members, node); if (accessors.firstAccessor.decorators && node === accessors.secondAccessor) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name); @@ -27587,38 +31305,38 @@ var ts; } function checkGrammarModifiers(node) { switch (node.kind) { - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: - case 144 /* Constructor */: - case 141 /* PropertyDeclaration */: - case 140 /* PropertySignature */: - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - case 149 /* IndexSignature */: - case 218 /* ModuleDeclaration */: - case 222 /* ImportDeclaration */: - case 221 /* ImportEqualsDeclaration */: - case 228 /* ExportDeclaration */: - case 227 /* ExportAssignment */: - case 138 /* Parameter */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: + case 148 /* Constructor */: + case 145 /* PropertyDeclaration */: + case 144 /* PropertySignature */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: + case 153 /* IndexSignature */: + case 225 /* ModuleDeclaration */: + case 230 /* ImportDeclaration */: + case 229 /* ImportEqualsDeclaration */: + case 236 /* ExportDeclaration */: + case 235 /* ExportAssignment */: + case 142 /* Parameter */: break; - case 213 /* FunctionDeclaration */: + case 220 /* FunctionDeclaration */: if (node.modifiers && (node.modifiers.length > 1 || node.modifiers[0].kind !== 118 /* AsyncKeyword */) && - node.parent.kind !== 219 /* ModuleBlock */ && node.parent.kind !== 248 /* SourceFile */) { + node.parent.kind !== 226 /* ModuleBlock */ && node.parent.kind !== 256 /* SourceFile */) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); } break; - case 214 /* ClassDeclaration */: - case 215 /* InterfaceDeclaration */: - case 193 /* VariableStatement */: - case 216 /* TypeAliasDeclaration */: - if (node.modifiers && node.parent.kind !== 219 /* ModuleBlock */ && node.parent.kind !== 248 /* SourceFile */) { + case 221 /* ClassDeclaration */: + case 222 /* InterfaceDeclaration */: + case 200 /* VariableStatement */: + case 223 /* TypeAliasDeclaration */: + if (node.modifiers && node.parent.kind !== 226 /* ModuleBlock */ && node.parent.kind !== 256 /* SourceFile */) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); } break; - case 217 /* EnumDeclaration */: + case 224 /* EnumDeclaration */: if (node.modifiers && (node.modifiers.length > 1 || node.modifiers[0].kind !== 74 /* ConstKeyword */) && - node.parent.kind !== 219 /* ModuleBlock */ && node.parent.kind !== 248 /* SourceFile */) { + node.parent.kind !== 226 /* ModuleBlock */ && node.parent.kind !== 256 /* SourceFile */) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); } break; @@ -27628,37 +31346,48 @@ var ts; if (!node.modifiers) { return; } - var lastStatic, lastPrivate, lastProtected, lastDeclare, lastAsync; + var lastStatic, lastPrivate, lastProtected, lastDeclare, lastAsync, lastReadonly; var flags = 0; for (var _i = 0, _a = node.modifiers; _i < _a.length; _i++) { var modifier = _a[_i]; + if (modifier.kind !== 128 /* ReadonlyKeyword */) { + if (node.kind === 144 /* PropertySignature */ || node.kind === 146 /* MethodSignature */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_type_member, ts.tokenToString(modifier.kind)); + } + if (node.kind === 153 /* IndexSignature */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_an_index_signature, ts.tokenToString(modifier.kind)); + } + } switch (modifier.kind) { + case 74 /* ConstKeyword */: + if (node.kind !== 224 /* EnumDeclaration */ && node.parent.kind === 221 /* ClassDeclaration */) { + return grammarErrorOnNode(node, ts.Diagnostics.A_class_member_cannot_have_the_0_keyword, ts.tokenToString(74 /* ConstKeyword */)); + } + break; case 112 /* PublicKeyword */: case 111 /* ProtectedKeyword */: case 110 /* PrivateKeyword */: - var text = void 0; - if (modifier.kind === 112 /* PublicKeyword */) { - text = "public"; - } - else if (modifier.kind === 111 /* ProtectedKeyword */) { - text = "protected"; + var text = visibilityToString(ts.modifierToFlag(modifier.kind)); + if (modifier.kind === 111 /* ProtectedKeyword */) { lastProtected = modifier; } - else { - text = "private"; + else if (modifier.kind === 110 /* PrivateKeyword */) { lastPrivate = modifier; } - if (flags & 56 /* AccessibilityModifier */) { + if (flags & 28 /* AccessibilityModifier */) { return grammarErrorOnNode(modifier, ts.Diagnostics.Accessibility_modifier_already_seen); } - else if (flags & 64 /* Static */) { + else if (flags & 32 /* Static */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "static"); } + else if (flags & 64 /* Readonly */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "readonly"); + } else if (flags & 256 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "async"); } - else if (node.parent.kind === 219 /* ModuleBlock */ || node.parent.kind === 248 /* SourceFile */) { - return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, text); + else if (node.parent.kind === 226 /* ModuleBlock */ || node.parent.kind === 256 /* SourceFile */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, text); } else if (flags & 128 /* Abstract */) { if (modifier.kind === 110 /* PrivateKeyword */) { @@ -27671,29 +31400,43 @@ var ts; flags |= ts.modifierToFlag(modifier.kind); break; case 113 /* StaticKeyword */: - if (flags & 64 /* Static */) { + if (flags & 32 /* Static */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "static"); } + else if (flags & 64 /* Readonly */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "readonly"); + } else if (flags & 256 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "async"); } - else if (node.parent.kind === 219 /* ModuleBlock */ || node.parent.kind === 248 /* SourceFile */) { - return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, "static"); + else if (node.parent.kind === 226 /* ModuleBlock */ || node.parent.kind === 256 /* SourceFile */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, "static"); } - else if (node.kind === 138 /* Parameter */) { + else if (node.kind === 142 /* Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static"); } else if (flags & 128 /* Abstract */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "static", "abstract"); } - flags |= 64 /* Static */; + flags |= 32 /* Static */; lastStatic = modifier; break; + case 128 /* ReadonlyKeyword */: + if (flags & 64 /* Readonly */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "readonly"); + } + else if (node.kind !== 145 /* PropertyDeclaration */ && node.kind !== 144 /* PropertySignature */ && node.kind !== 153 /* IndexSignature */ && node.kind !== 142 /* Parameter */) { + // If node.kind === SyntaxKind.Parameter, checkParameter report an error if it's not a parameter property. + return grammarErrorOnNode(modifier, ts.Diagnostics.readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature); + } + flags |= 64 /* Readonly */; + lastReadonly = modifier; + break; case 82 /* ExportKeyword */: - if (flags & 2 /* Export */) { + if (flags & 1 /* Export */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "export"); } - else if (flags & 4 /* Ambient */) { + else if (flags & 2 /* Ambient */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "declare"); } else if (flags & 128 /* Abstract */) { @@ -27702,48 +31445,51 @@ var ts; else if (flags & 256 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "async"); } - else if (node.parent.kind === 214 /* ClassDeclaration */) { + else if (node.parent.kind === 221 /* ClassDeclaration */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export"); } - else if (node.kind === 138 /* Parameter */) { + else if (node.kind === 142 /* Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export"); } - flags |= 2 /* Export */; + flags |= 1 /* Export */; break; case 122 /* DeclareKeyword */: - if (flags & 4 /* Ambient */) { + if (flags & 2 /* Ambient */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "declare"); } else if (flags & 256 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } - else if (node.parent.kind === 214 /* ClassDeclaration */) { + else if (node.parent.kind === 221 /* ClassDeclaration */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare"); } - else if (node.kind === 138 /* Parameter */) { + else if (node.kind === 142 /* Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); } - else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 219 /* ModuleBlock */) { + else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 226 /* ModuleBlock */) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); } - flags |= 4 /* Ambient */; + flags |= 2 /* Ambient */; lastDeclare = modifier; break; case 115 /* AbstractKeyword */: if (flags & 128 /* Abstract */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "abstract"); } - if (node.kind !== 214 /* ClassDeclaration */) { - if (node.kind !== 143 /* MethodDeclaration */) { - return grammarErrorOnNode(modifier, ts.Diagnostics.abstract_modifier_can_only_appear_on_a_class_or_method_declaration); + if (node.kind !== 221 /* ClassDeclaration */) { + if (node.kind !== 147 /* MethodDeclaration */ && + node.kind !== 145 /* PropertyDeclaration */ && + node.kind !== 149 /* GetAccessor */ && + node.kind !== 150 /* SetAccessor */) { + return grammarErrorOnNode(modifier, ts.Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration); } - if (!(node.parent.kind === 214 /* ClassDeclaration */ && node.parent.flags & 128 /* Abstract */)) { + if (!(node.parent.kind === 221 /* ClassDeclaration */ && node.parent.flags & 128 /* Abstract */)) { return grammarErrorOnNode(modifier, ts.Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class); } - if (flags & 64 /* Static */) { + if (flags & 32 /* Static */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "static", "abstract"); } - if (flags & 16 /* Private */) { + if (flags & 8 /* Private */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "private", "abstract"); } } @@ -27753,10 +31499,10 @@ var ts; if (flags & 256 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "async"); } - else if (flags & 4 /* Ambient */ || ts.isInAmbientContext(node.parent)) { + else if (flags & 2 /* Ambient */ || ts.isInAmbientContext(node.parent)) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } - else if (node.kind === 138 /* Parameter */) { + else if (node.kind === 142 /* Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "async"); } flags |= 256 /* Async */; @@ -27764,28 +31510,25 @@ var ts; break; } } - if (node.kind === 144 /* Constructor */) { - if (flags & 64 /* Static */) { + if (node.kind === 148 /* Constructor */) { + if (flags & 32 /* Static */) { return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static"); } if (flags & 128 /* Abstract */) { return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "abstract"); } - else if (flags & 32 /* Protected */) { - return grammarErrorOnNode(lastProtected, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "protected"); - } - else if (flags & 16 /* Private */) { - return grammarErrorOnNode(lastPrivate, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "private"); - } else if (flags & 256 /* Async */) { return grammarErrorOnNode(lastAsync, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "async"); } + else if (flags & 64 /* Readonly */) { + return grammarErrorOnNode(lastReadonly, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "readonly"); + } return; } - else if ((node.kind === 222 /* ImportDeclaration */ || node.kind === 221 /* ImportEqualsDeclaration */) && flags & 4 /* Ambient */) { + else if ((node.kind === 230 /* ImportDeclaration */ || node.kind === 229 /* ImportEqualsDeclaration */) && flags & 2 /* Ambient */) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare"); } - else if (node.kind === 138 /* Parameter */ && (flags & 56 /* AccessibilityModifier */) && ts.isBindingPattern(node.name)) { + else if (node.kind === 142 /* Parameter */ && (flags & 92 /* ParameterPropertyModifier */) && ts.isBindingPattern(node.name)) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_may_not_be_a_binding_pattern); } if (flags & 256 /* Async */) { @@ -27797,10 +31540,10 @@ var ts; return grammarErrorOnNode(asyncModifier, ts.Diagnostics.Async_functions_are_only_available_when_targeting_ECMAScript_6_and_higher); } switch (node.kind) { - case 143 /* MethodDeclaration */: - case 213 /* FunctionDeclaration */: - case 173 /* FunctionExpression */: - case 174 /* ArrowFunction */: + case 147 /* MethodDeclaration */: + case 220 /* FunctionDeclaration */: + case 179 /* FunctionExpression */: + case 180 /* ArrowFunction */: if (!node.asteriskToken) { return false; } @@ -27866,7 +31609,7 @@ var ts; checkGrammarParameterList(node.parameters) || checkGrammarArrowFunction(node, file); } function checkGrammarArrowFunction(node, file) { - if (node.kind === 174 /* ArrowFunction */) { + if (node.kind === 180 /* ArrowFunction */) { var arrowFunction = node; var startLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.pos).line; var endLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.end).line; @@ -27889,7 +31632,7 @@ var ts; if (parameter.dotDotDotToken) { return grammarErrorOnNode(parameter.dotDotDotToken, ts.Diagnostics.An_index_signature_cannot_have_a_rest_parameter); } - if (parameter.flags & 1022 /* Modifier */) { + if (parameter.flags & 1023 /* Modifier */) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_cannot_have_an_accessibility_modifier); } if (parameter.questionToken) { @@ -27901,21 +31644,16 @@ var ts; if (!parameter.type) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_must_have_a_type_annotation); } - if (parameter.type.kind !== 130 /* StringKeyword */ && parameter.type.kind !== 128 /* NumberKeyword */) { + if (parameter.type.kind !== 132 /* StringKeyword */ && parameter.type.kind !== 130 /* NumberKeyword */) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_must_be_string_or_number); } if (!node.type) { return grammarErrorOnNode(node, ts.Diagnostics.An_index_signature_must_have_a_type_annotation); } } - function checkGrammarForIndexSignatureModifier(node) { - if (node.flags & 1022 /* Modifier */) { - grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_not_permitted_on_index_signature_members); - } - } function checkGrammarIndexSignature(node) { // Prevent cascading error by short-circuit - return checkGrammarDecorators(node) || checkGrammarModifiers(node) || checkGrammarIndexSignatureParameters(node) || checkGrammarForIndexSignatureModifier(node); + return checkGrammarDecorators(node) || checkGrammarModifiers(node) || checkGrammarIndexSignatureParameters(node); } function checkGrammarForAtLeastOneTypeArgument(node, typeArguments) { if (typeArguments && typeArguments.length === 0) { @@ -27934,7 +31672,7 @@ var ts; var sourceFile = ts.getSourceFileOfNode(node); for (var _i = 0, args_1 = args; _i < args_1.length; _i++) { var arg = args_1[_i]; - if (arg.kind === 187 /* OmittedExpression */) { + if (arg.kind === 193 /* OmittedExpression */) { return grammarErrorAtPos(sourceFile, arg.pos, 0, ts.Diagnostics.Argument_expression_expected); } } @@ -28008,19 +31746,19 @@ var ts; } function checkGrammarComputedPropertyName(node) { // If node is not a computedPropertyName, just skip the grammar checking - if (node.kind !== 136 /* ComputedPropertyName */) { + if (node.kind !== 140 /* ComputedPropertyName */) { return false; } var computedPropertyName = node; - if (computedPropertyName.expression.kind === 181 /* BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 24 /* CommaToken */) { + if (computedPropertyName.expression.kind === 187 /* BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 24 /* CommaToken */) { return grammarErrorOnNode(computedPropertyName.expression, ts.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name); } } function checkGrammarForGenerator(node) { if (node.asteriskToken) { - ts.Debug.assert(node.kind === 213 /* FunctionDeclaration */ || - node.kind === 173 /* FunctionExpression */ || - node.kind === 143 /* MethodDeclaration */); + ts.Debug.assert(node.kind === 220 /* FunctionDeclaration */ || + node.kind === 179 /* FunctionExpression */ || + node.kind === 147 /* MethodDeclaration */); if (ts.isInAmbientContext(node)) { return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_not_allowed_in_an_ambient_context); } @@ -28041,23 +31779,28 @@ var ts; var seen = {}; var Property = 1; var GetAccessor = 2; - var SetAccesor = 4; - var GetOrSetAccessor = GetAccessor | SetAccesor; - for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { - var prop = _a[_i]; - var name_16 = prop.name; - if (prop.kind === 187 /* OmittedExpression */ || - name_16.kind === 136 /* ComputedPropertyName */) { + var SetAccessor = 4; + var GetOrSetAccessor = GetAccessor | SetAccessor; + var _loop_1 = function(prop) { + var name_20 = prop.name; + if (prop.kind === 193 /* OmittedExpression */ || + name_20.kind === 140 /* ComputedPropertyName */) { // If the name is not a ComputedPropertyName, the grammar checking will skip it - checkGrammarComputedPropertyName(name_16); - continue; + checkGrammarComputedPropertyName(name_20); + return "continue"; } - if (prop.kind === 246 /* ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) { + if (prop.kind === 254 /* ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) { // having objectAssignmentInitializer is only valid in ObjectAssignmentPattern // outside of destructuring it is a syntax error - return grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment); + return { value: grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment) }; } - // ECMA-262 11.1.5 Object Initialiser + // Modifiers are never allowed on properties except for 'async' on a method declaration + ts.forEach(prop.modifiers, function (mod) { + if (mod.kind !== 118 /* AsyncKeyword */ || prop.kind !== 147 /* MethodDeclaration */) { + grammarErrorOnNode(mod, ts.Diagnostics._0_modifier_cannot_be_used_here, ts.getTextOfNode(mod)); + } + }); + // ECMA-262 11.1.5 Object Initializer // If previous is not undefined then throw a SyntaxError exception if any of the following conditions are true // a.This production is contained in strict code and IsDataDescriptor(previous) is true and // IsDataDescriptor(propId.descriptor) is true. @@ -28066,65 +31809,70 @@ var ts; // d.IsAccessorDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true // and either both previous and propId.descriptor have[[Get]] fields or both previous and propId.descriptor have[[Set]] fields var currentKind = void 0; - if (prop.kind === 245 /* PropertyAssignment */ || prop.kind === 246 /* ShorthandPropertyAssignment */) { - // Grammar checking for computedPropertName and shorthandPropertyAssignment + if (prop.kind === 253 /* PropertyAssignment */ || prop.kind === 254 /* ShorthandPropertyAssignment */) { + // Grammar checking for computedPropertyName and shorthandPropertyAssignment checkGrammarForInvalidQuestionMark(prop, prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); - if (name_16.kind === 8 /* NumericLiteral */) { - checkGrammarNumericLiteral(name_16); + if (name_20.kind === 8 /* NumericLiteral */) { + checkGrammarNumericLiteral(name_20); } currentKind = Property; } - else if (prop.kind === 143 /* MethodDeclaration */) { + else if (prop.kind === 147 /* MethodDeclaration */) { currentKind = Property; } - else if (prop.kind === 145 /* GetAccessor */) { + else if (prop.kind === 149 /* GetAccessor */) { currentKind = GetAccessor; } - else if (prop.kind === 146 /* SetAccessor */) { - currentKind = SetAccesor; + else if (prop.kind === 150 /* SetAccessor */) { + currentKind = SetAccessor; } else { ts.Debug.fail("Unexpected syntax kind:" + prop.kind); } - if (!ts.hasProperty(seen, name_16.text)) { - seen[name_16.text] = currentKind; + if (!ts.hasProperty(seen, name_20.text)) { + seen[name_20.text] = currentKind; } else { - var existingKind = seen[name_16.text]; + var existingKind = seen[name_20.text]; if (currentKind === Property && existingKind === Property) { - continue; + return "continue"; } else if ((currentKind & GetOrSetAccessor) && (existingKind & GetOrSetAccessor)) { if (existingKind !== GetOrSetAccessor && currentKind !== existingKind) { - seen[name_16.text] = currentKind | existingKind; + seen[name_20.text] = currentKind | existingKind; } else { - return grammarErrorOnNode(name_16, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name); + return { value: grammarErrorOnNode(name_20, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name) }; } } else { - return grammarErrorOnNode(name_16, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name); + return { value: grammarErrorOnNode(name_20, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name) }; } } + }; + for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { + var prop = _a[_i]; + var state_2 = _loop_1(prop); + if (typeof state_2 === "object") return state_2.value; } } function checkGrammarJsxElement(node) { var seen = {}; for (var _i = 0, _a = node.attributes; _i < _a.length; _i++) { var attr = _a[_i]; - if (attr.kind === 239 /* JsxSpreadAttribute */) { + if (attr.kind === 247 /* JsxSpreadAttribute */) { continue; } var jsxAttr = attr; - var name_17 = jsxAttr.name; - if (!ts.hasProperty(seen, name_17.text)) { - seen[name_17.text] = true; + var name_21 = jsxAttr.name; + if (!ts.hasProperty(seen, name_21.text)) { + seen[name_21.text] = true; } else { - return grammarErrorOnNode(name_17, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); + return grammarErrorOnNode(name_21, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); } var initializer = jsxAttr.initializer; - if (initializer && initializer.kind === 240 /* JsxExpression */ && !initializer.expression) { + if (initializer && initializer.kind === 248 /* JsxExpression */ && !initializer.expression) { return grammarErrorOnNode(jsxAttr.initializer, ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression); } } @@ -28133,24 +31881,35 @@ var ts; if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { return true; } - if (forInOrOfStatement.initializer.kind === 212 /* VariableDeclarationList */) { + if (forInOrOfStatement.initializer.kind === 219 /* VariableDeclarationList */) { var variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { - if (variableList.declarations.length > 1) { - var diagnostic = forInOrOfStatement.kind === 200 /* ForInStatement */ + var declarations = variableList.declarations; + // declarations.length can be zero if there is an error in variable declaration in for-of or for-in + // See http://www.ecma-international.org/ecma-262/6.0/#sec-for-in-and-for-of-statements for details + // For example: + // var let = 10; + // for (let of [1,2,3]) {} // this is invalid ES6 syntax + // for (let in [1,2,3]) {} // this is invalid ES6 syntax + // We will then want to skip on grammar checking on variableList declaration + if (!declarations.length) { + return false; + } + if (declarations.length > 1) { + var diagnostic = forInOrOfStatement.kind === 207 /* ForInStatement */ ? ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement : ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement; return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic); } - var firstDeclaration = variableList.declarations[0]; + var firstDeclaration = declarations[0]; if (firstDeclaration.initializer) { - var diagnostic = forInOrOfStatement.kind === 200 /* ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 207 /* ForInStatement */ ? ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer : ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; return grammarErrorOnNode(firstDeclaration.name, diagnostic); } if (firstDeclaration.type) { - var diagnostic = forInOrOfStatement.kind === 200 /* ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 207 /* ForInStatement */ ? ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation : ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation; return grammarErrorOnNode(firstDeclaration, diagnostic); @@ -28167,30 +31926,26 @@ var ts; else if (ts.isInAmbientContext(accessor)) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_be_declared_in_an_ambient_context); } - else if (accessor.body === undefined) { + else if (accessor.body === undefined && !(accessor.flags & 128 /* Abstract */)) { return grammarErrorAtPos(ts.getSourceFileOfNode(accessor), accessor.end - 1, ";".length, ts.Diagnostics._0_expected, "{"); } else if (accessor.typeParameters) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters); } - else if (kind === 145 /* GetAccessor */ && accessor.parameters.length) { - return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_get_accessor_cannot_have_parameters); + else if (!doesAccessorHaveCorrectParameterCount(accessor)) { + return grammarErrorOnNode(accessor.name, kind === 149 /* GetAccessor */ ? + ts.Diagnostics.A_get_accessor_cannot_have_parameters : + ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter); } - else if (kind === 146 /* SetAccessor */) { + else if (kind === 150 /* SetAccessor */) { if (accessor.type) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation); } - else if (accessor.parameters.length !== 1) { - return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter); - } else { var parameter = accessor.parameters[0]; if (parameter.dotDotDotToken) { return grammarErrorOnNode(parameter.dotDotDotToken, ts.Diagnostics.A_set_accessor_cannot_have_rest_parameter); } - else if (parameter.flags & 1022 /* Modifier */) { - return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); - } else if (parameter.questionToken) { return grammarErrorOnNode(parameter.questionToken, ts.Diagnostics.A_set_accessor_cannot_have_an_optional_parameter); } @@ -28200,6 +31955,20 @@ var ts; } } } + /** Does the accessor have the right number of parameters? + + A get accessor has no parameters or a single `this` parameter. + A set accessor has one parameter or a `this` parameter and one more parameter */ + function doesAccessorHaveCorrectParameterCount(accessor) { + return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 149 /* GetAccessor */ ? 0 : 1); + } + function getAccessorThisParameter(accessor) { + if (accessor.parameters.length === (accessor.kind === 149 /* GetAccessor */ ? 1 : 2) && + accessor.parameters[0].name.kind === 69 /* Identifier */ && + accessor.parameters[0].name.originalKeywordKind === 97 /* ThisKeyword */) { + return accessor.parameters[0]; + } + } function checkGrammarForNonSymbolComputedProperty(node, message) { if (ts.isDynamicName(node)) { return grammarErrorOnNode(node, message); @@ -28211,18 +31980,15 @@ var ts; checkGrammarForGenerator(node)) { return true; } - if (node.parent.kind === 165 /* ObjectLiteralExpression */) { - if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional)) { + if (node.parent.kind === 171 /* ObjectLiteralExpression */) { + if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional)) { return true; } else if (node.body === undefined) { - return grammarErrorAtPos(getSourceFile(node), node.end - 1, ";".length, ts.Diagnostics._0_expected, "{"); + return grammarErrorAtPos(ts.getSourceFileOfNode(node), node.end - 1, ";".length, ts.Diagnostics._0_expected, "{"); } } if (ts.isClassLike(node.parent)) { - if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional)) { - return true; - } // Technically, computed properties in ambient contexts is disallowed // for property declarations and accessors too, not just methods. // However, property declarations disallow computed names in general, @@ -28235,10 +32001,10 @@ var ts; return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol); } } - else if (node.parent.kind === 215 /* InterfaceDeclaration */) { + else if (node.parent.kind === 222 /* InterfaceDeclaration */) { return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol); } - else if (node.parent.kind === 155 /* TypeLiteral */) { + else if (node.parent.kind === 159 /* TypeLiteral */) { return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol); } } @@ -28249,11 +32015,11 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); } switch (current.kind) { - case 207 /* LabeledStatement */: + case 214 /* LabeledStatement */: if (node.label && current.label.text === node.label.text) { // found matching label - verify that label usage is correct // continue can only target labels that are on iteration statements - var isMisplacedContinueLabel = node.kind === 202 /* ContinueStatement */ + var isMisplacedContinueLabel = node.kind === 209 /* ContinueStatement */ && !ts.isIterationStatement(current.statement, /*lookInLabeledStatement*/ true); if (isMisplacedContinueLabel) { return grammarErrorOnNode(node, ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement); @@ -28261,8 +32027,8 @@ var ts; return false; } break; - case 206 /* SwitchStatement */: - if (node.kind === 203 /* BreakStatement */ && !node.label) { + case 213 /* SwitchStatement */: + if (node.kind === 210 /* BreakStatement */ && !node.label) { // unlabeled break within switch statement - ok return false; } @@ -28277,13 +32043,13 @@ var ts; current = current.parent; } if (node.label) { - var message = node.kind === 203 /* BreakStatement */ + var message = node.kind === 210 /* BreakStatement */ ? ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement : ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); } else { - var message = node.kind === 203 /* BreakStatement */ + var message = node.kind === 210 /* BreakStatement */ ? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement : ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); @@ -28295,7 +32061,7 @@ var ts; if (node !== ts.lastOrUndefined(elements)) { return grammarErrorOnNode(node, ts.Diagnostics.A_rest_element_must_be_last_in_an_array_destructuring_pattern); } - if (node.name.kind === 162 /* ArrayBindingPattern */ || node.name.kind === 161 /* ObjectBindingPattern */) { + if (node.name.kind === 168 /* ArrayBindingPattern */ || node.name.kind === 167 /* ObjectBindingPattern */) { return grammarErrorOnNode(node.name, ts.Diagnostics.A_rest_element_cannot_contain_a_binding_pattern); } if (node.initializer) { @@ -28305,7 +32071,7 @@ var ts; } } function checkGrammarVariableDeclaration(node) { - if (node.parent.parent.kind !== 200 /* ForInStatement */ && node.parent.parent.kind !== 201 /* ForOfStatement */) { + if (node.parent.parent.kind !== 207 /* ForInStatement */ && node.parent.parent.kind !== 208 /* ForOfStatement */) { if (ts.isInAmbientContext(node)) { if (node.initializer) { // Error on equals token which immediate precedes the initializer @@ -28322,7 +32088,7 @@ var ts; } } } - var checkLetConstNames = languageVersion >= 2 /* ES6 */ && (ts.isLet(node) || ts.isConst(node)); + var checkLetConstNames = (ts.isLet(node) || ts.isConst(node)); // 1. LexicalDeclaration : LetOrConst BindingList ; // It is a Syntax Error if the BoundNames of BindingList contains "let". // 2. ForDeclaration: ForDeclaration : LetOrConst ForBinding @@ -28333,7 +32099,7 @@ var ts; } function checkGrammarNameInLetOrConstDeclarations(name) { if (name.kind === 69 /* Identifier */) { - if (name.text === "let") { + if (name.originalKeywordKind === 108 /* LetKeyword */) { return grammarErrorOnNode(name, ts.Diagnostics.let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations); } } @@ -28341,7 +32107,7 @@ var ts; var elements = name.elements; for (var _i = 0, elements_2 = elements; _i < elements_2.length; _i++) { var element = elements_2[_i]; - if (element.kind !== 187 /* OmittedExpression */) { + if (element.kind !== 193 /* OmittedExpression */) { checkGrammarNameInLetOrConstDeclarations(element.name); } } @@ -28358,15 +32124,15 @@ var ts; } function allowLetAndConstDeclarations(parent) { switch (parent.kind) { - case 196 /* IfStatement */: - case 197 /* DoStatement */: - case 198 /* WhileStatement */: - case 205 /* WithStatement */: - case 199 /* ForStatement */: - case 200 /* ForInStatement */: - case 201 /* ForOfStatement */: + case 203 /* IfStatement */: + case 204 /* DoStatement */: + case 205 /* WhileStatement */: + case 212 /* WithStatement */: + case 206 /* ForStatement */: + case 207 /* ForInStatement */: + case 208 /* ForOfStatement */: return false; - case 207 /* LabeledStatement */: + case 214 /* LabeledStatement */: return allowLetAndConstDeclarations(parent.parent); } return true; @@ -28381,23 +32147,6 @@ var ts; } } } - function isIntegerLiteral(expression) { - if (expression.kind === 179 /* PrefixUnaryExpression */) { - var unaryExpression = expression; - if (unaryExpression.operator === 35 /* PlusToken */ || unaryExpression.operator === 36 /* MinusToken */) { - expression = unaryExpression.operand; - } - } - if (expression.kind === 8 /* NumericLiteral */) { - // Allows for scientific notation since literalExpression.text was formed by - // coercing a number to a string. Sometimes this coercion can yield a string - // in scientific notation. - // We also don't need special logic for hex because a hex integer is converted - // to decimal when it is coerced. - return /^[0-9]+([eE]\+?[0-9]+)?$/.test(expression.text); - } - return false; - } function hasParseDiagnostics(sourceFile) { return sourceFile.parseDiagnostics.length > 0; } @@ -28422,10 +32171,6 @@ var ts; return true; } } - function isEvalOrArgumentsIdentifier(node) { - return node.kind === 69 /* Identifier */ && - (node.text === "eval" || node.text === "arguments"); - } function checkGrammarConstructorTypeParameters(node) { if (node.typeParameters) { return grammarErrorAtPos(ts.getSourceFileOfNode(node), node.typeParameters.pos, node.typeParameters.end - node.typeParameters.pos, ts.Diagnostics.Type_parameters_cannot_appear_on_a_constructor_declaration); @@ -28438,20 +32183,25 @@ var ts; } function checkGrammarProperty(node) { if (ts.isClassLike(node.parent)) { - if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional) || - checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol)) { + if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol)) { return true; } } - else if (node.parent.kind === 215 /* InterfaceDeclaration */) { + else if (node.parent.kind === 222 /* InterfaceDeclaration */) { if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol)) { return true; } + if (node.initializer) { + return grammarErrorOnNode(node.initializer, ts.Diagnostics.An_interface_property_cannot_have_an_initializer); + } } - else if (node.parent.kind === 155 /* TypeLiteral */) { + else if (node.parent.kind === 159 /* TypeLiteral */) { if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol)) { return true; } + if (node.initializer) { + return grammarErrorOnNode(node.initializer, ts.Diagnostics.A_type_literal_property_cannot_have_an_initializer); + } } if (ts.isInAmbientContext(node) && node.initializer) { return grammarErrorOnFirstToken(node.initializer, ts.Diagnostics.Initializers_are_not_allowed_in_ambient_contexts); @@ -28470,14 +32220,14 @@ var ts; // export_opt AmbientDeclaration // // TODO: The spec needs to be amended to reflect this grammar. - if (node.kind === 215 /* InterfaceDeclaration */ || - node.kind === 216 /* TypeAliasDeclaration */ || - node.kind === 222 /* ImportDeclaration */ || - node.kind === 221 /* ImportEqualsDeclaration */ || - node.kind === 228 /* ExportDeclaration */ || - node.kind === 227 /* ExportAssignment */ || - (node.flags & 4 /* Ambient */) || - (node.flags & (2 /* Export */ | 512 /* Default */))) { + if (node.kind === 222 /* InterfaceDeclaration */ || + node.kind === 223 /* TypeAliasDeclaration */ || + node.kind === 230 /* ImportDeclaration */ || + node.kind === 229 /* ImportEqualsDeclaration */ || + node.kind === 236 /* ExportDeclaration */ || + node.kind === 235 /* ExportAssignment */ || + (node.flags & 2 /* Ambient */) || + (node.flags & (1 /* Export */ | 512 /* Default */))) { return false; } return grammarErrorOnFirstToken(node, ts.Diagnostics.A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file); @@ -28485,7 +32235,7 @@ var ts; function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) { for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { var decl = _a[_i]; - if (ts.isDeclaration(decl) || decl.kind === 193 /* VariableStatement */) { + if (ts.isDeclaration(decl) || decl.kind === 200 /* VariableStatement */) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { return true; } @@ -28508,10 +32258,10 @@ var ts; } // We are either parented by another statement, or some sort of block. // If we're in a block, we only want to really report an error once - // to prevent noisyness. So use a bit on the block to indicate if + // to prevent noisiness. So use a bit on the block to indicate if // this has already been reported, and don't report if it has. // - if (node.parent.kind === 192 /* Block */ || node.parent.kind === 219 /* ModuleBlock */ || node.parent.kind === 248 /* SourceFile */) { + if (node.parent.kind === 199 /* Block */ || node.parent.kind === 226 /* ModuleBlock */ || node.parent.kind === 256 /* SourceFile */) { var links_1 = getNodeLinks(node.parent); // Check if the containing block ever report this error if (!links_1.hasReportedStatementInAmbientContext) { @@ -28524,7 +32274,7 @@ var ts; } function checkGrammarNumericLiteral(node) { // Grammar checking - if (node.flags & 32768 /* OctalLiteral */ && languageVersion >= 1 /* ES5 */) { + if (node.isOctalLiteral && languageVersion >= 1 /* ES5 */) { return grammarErrorOnNode(node, ts.Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher); } } @@ -28536,21 +32286,345 @@ var ts; return true; } } + var _a; } ts.createTypeChecker = createTypeChecker; })(ts || (ts = {})); /// /* @internal */ var ts; +(function (ts) { + var nullSourceMapWriter; + // Used for initialize lastEncodedSourceMapSpan and reset lastEncodedSourceMapSpan when updateLastEncodedAndRecordedSpans + var defaultLastEncodedSourceMapSpan = { + emittedLine: 1, + emittedColumn: 1, + sourceLine: 1, + sourceColumn: 1, + sourceIndex: 0 + }; + function getNullSourceMapWriter() { + if (nullSourceMapWriter === undefined) { + nullSourceMapWriter = { + getSourceMapData: function () { return undefined; }, + setSourceFile: function (sourceFile) { }, + emitStart: function (range) { }, + emitEnd: function (range, stopOverridingSpan) { }, + emitPos: function (pos) { }, + changeEmitSourcePos: function () { }, + getText: function () { return undefined; }, + getSourceMappingURL: function () { return undefined; }, + initialize: function (filePath, sourceMapFilePath, sourceFiles, isBundledEmit) { }, + reset: function () { } + }; + } + return nullSourceMapWriter; + } + ts.getNullSourceMapWriter = getNullSourceMapWriter; + function createSourceMapWriter(host, writer) { + var compilerOptions = host.getCompilerOptions(); + var currentSourceFile; + var sourceMapDir; // The directory in which sourcemap will be + var stopOverridingSpan = false; + var modifyLastSourcePos = false; + // Current source map file and its index in the sources list + var sourceMapSourceIndex; + // Last recorded and encoded spans + var lastRecordedSourceMapSpan; + var lastEncodedSourceMapSpan; + var lastEncodedNameIndex; + // Source map data + var sourceMapData; + return { + getSourceMapData: function () { return sourceMapData; }, + setSourceFile: setSourceFile, + emitPos: emitPos, + emitStart: emitStart, + emitEnd: emitEnd, + changeEmitSourcePos: changeEmitSourcePos, + getText: getText, + getSourceMappingURL: getSourceMappingURL, + initialize: initialize, + reset: reset + }; + function initialize(filePath, sourceMapFilePath, sourceFiles, isBundledEmit) { + if (sourceMapData) { + reset(); + } + currentSourceFile = undefined; + // Current source map file and its index in the sources list + sourceMapSourceIndex = -1; + // Last recorded and encoded spans + lastRecordedSourceMapSpan = undefined; + lastEncodedSourceMapSpan = defaultLastEncodedSourceMapSpan; + lastEncodedNameIndex = 0; + // Initialize source map data + sourceMapData = { + sourceMapFilePath: sourceMapFilePath, + jsSourceMappingURL: !compilerOptions.inlineSourceMap ? ts.getBaseFileName(ts.normalizeSlashes(sourceMapFilePath)) : undefined, + sourceMapFile: ts.getBaseFileName(ts.normalizeSlashes(filePath)), + sourceMapSourceRoot: compilerOptions.sourceRoot || "", + sourceMapSources: [], + inputSourceFileNames: [], + sourceMapNames: [], + sourceMapMappings: "", + sourceMapSourcesContent: compilerOptions.inlineSources ? [] : undefined, + sourceMapDecodedMappings: [] + }; + // Normalize source root and make sure it has trailing "/" so that it can be used to combine paths with the + // relative paths of the sources list in the sourcemap + sourceMapData.sourceMapSourceRoot = ts.normalizeSlashes(sourceMapData.sourceMapSourceRoot); + if (sourceMapData.sourceMapSourceRoot.length && sourceMapData.sourceMapSourceRoot.charCodeAt(sourceMapData.sourceMapSourceRoot.length - 1) !== 47 /* slash */) { + sourceMapData.sourceMapSourceRoot += ts.directorySeparator; + } + if (compilerOptions.mapRoot) { + sourceMapDir = ts.normalizeSlashes(compilerOptions.mapRoot); + if (!isBundledEmit) { + ts.Debug.assert(sourceFiles.length === 1); + // For modules or multiple emit files the mapRoot will have directory structure like the sources + // So if src\a.ts and src\lib\b.ts are compiled together user would be moving the maps into mapRoot\a.js.map and mapRoot\lib\b.js.map + sourceMapDir = ts.getDirectoryPath(ts.getSourceFilePathInNewDir(sourceFiles[0], host, sourceMapDir)); + } + if (!ts.isRootedDiskPath(sourceMapDir) && !ts.isUrl(sourceMapDir)) { + // The relative paths are relative to the common directory + sourceMapDir = ts.combinePaths(host.getCommonSourceDirectory(), sourceMapDir); + sourceMapData.jsSourceMappingURL = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizePath(filePath)), // get the relative sourceMapDir path based on jsFilePath + ts.combinePaths(sourceMapDir, sourceMapData.jsSourceMappingURL), // this is where user expects to see sourceMap + host.getCurrentDirectory(), host.getCanonicalFileName, + /*isAbsolutePathAnUrl*/ true); + } + else { + sourceMapData.jsSourceMappingURL = ts.combinePaths(sourceMapDir, sourceMapData.jsSourceMappingURL); + } + } + else { + sourceMapDir = ts.getDirectoryPath(ts.normalizePath(filePath)); + } + } + function reset() { + currentSourceFile = undefined; + sourceMapDir = undefined; + sourceMapSourceIndex = undefined; + lastRecordedSourceMapSpan = undefined; + lastEncodedSourceMapSpan = undefined; + lastEncodedNameIndex = undefined; + sourceMapData = undefined; + } + function updateLastEncodedAndRecordedSpans() { + if (modifyLastSourcePos) { + // Reset the source pos + modifyLastSourcePos = false; + // Change Last recorded Map with last encoded emit line and character + lastRecordedSourceMapSpan.emittedLine = lastEncodedSourceMapSpan.emittedLine; + lastRecordedSourceMapSpan.emittedColumn = lastEncodedSourceMapSpan.emittedColumn; + // Pop sourceMapDecodedMappings to remove last entry + sourceMapData.sourceMapDecodedMappings.pop(); + // Point the lastEncodedSourceMapSpace to the previous encoded sourceMapSpan + // If the list is empty which indicates that we are at the beginning of the file, + // we have to reset it to default value (same value when we first initialize sourceMapWriter) + lastEncodedSourceMapSpan = sourceMapData.sourceMapDecodedMappings.length ? + sourceMapData.sourceMapDecodedMappings[sourceMapData.sourceMapDecodedMappings.length - 1] : + defaultLastEncodedSourceMapSpan; + // TODO: Update lastEncodedNameIndex + // Since we dont support this any more, lets not worry about it right now. + // When we start supporting nameIndex, we will get back to this + // Change the encoded source map + var sourceMapMappings = sourceMapData.sourceMapMappings; + var lenthToSet = sourceMapMappings.length - 1; + for (; lenthToSet >= 0; lenthToSet--) { + var currentChar = sourceMapMappings.charAt(lenthToSet); + if (currentChar === ",") { + // Separator for the entry found + break; + } + if (currentChar === ";" && lenthToSet !== 0 && sourceMapMappings.charAt(lenthToSet - 1) !== ";") { + // Last line separator found + break; + } + } + sourceMapData.sourceMapMappings = sourceMapMappings.substr(0, Math.max(0, lenthToSet)); + } + } + // Encoding for sourcemap span + function encodeLastRecordedSourceMapSpan() { + if (!lastRecordedSourceMapSpan || lastRecordedSourceMapSpan === lastEncodedSourceMapSpan) { + return; + } + var prevEncodedEmittedColumn = lastEncodedSourceMapSpan.emittedColumn; + // Line/Comma delimiters + if (lastEncodedSourceMapSpan.emittedLine === lastRecordedSourceMapSpan.emittedLine) { + // Emit comma to separate the entry + if (sourceMapData.sourceMapMappings) { + sourceMapData.sourceMapMappings += ","; + } + } + else { + // Emit line delimiters + for (var encodedLine = lastEncodedSourceMapSpan.emittedLine; encodedLine < lastRecordedSourceMapSpan.emittedLine; encodedLine++) { + sourceMapData.sourceMapMappings += ";"; + } + prevEncodedEmittedColumn = 1; + } + // 1. Relative Column 0 based + sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.emittedColumn - prevEncodedEmittedColumn); + // 2. Relative sourceIndex + sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceIndex - lastEncodedSourceMapSpan.sourceIndex); + // 3. Relative sourceLine 0 based + sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceLine - lastEncodedSourceMapSpan.sourceLine); + // 4. Relative sourceColumn 0 based + sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceColumn - lastEncodedSourceMapSpan.sourceColumn); + // 5. Relative namePosition 0 based + if (lastRecordedSourceMapSpan.nameIndex >= 0) { + ts.Debug.assert(false, "We do not support name index right now, Make sure to update updateLastEncodedAndRecordedSpans when we start using this"); + sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.nameIndex - lastEncodedNameIndex); + lastEncodedNameIndex = lastRecordedSourceMapSpan.nameIndex; + } + lastEncodedSourceMapSpan = lastRecordedSourceMapSpan; + sourceMapData.sourceMapDecodedMappings.push(lastEncodedSourceMapSpan); + } + function emitPos(pos) { + if (pos === -1) { + return; + } + var sourceLinePos = ts.getLineAndCharacterOfPosition(currentSourceFile, pos); + // Convert the location to be one-based. + sourceLinePos.line++; + sourceLinePos.character++; + 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 || + lastRecordedSourceMapSpan.emittedColumn !== emittedColumn || + (lastRecordedSourceMapSpan.sourceIndex === sourceMapSourceIndex && + (lastRecordedSourceMapSpan.sourceLine > sourceLinePos.line || + (lastRecordedSourceMapSpan.sourceLine === sourceLinePos.line && lastRecordedSourceMapSpan.sourceColumn > sourceLinePos.character)))) { + // Encode the last recordedSpan before assigning new + encodeLastRecordedSourceMapSpan(); + // New span + lastRecordedSourceMapSpan = { + emittedLine: emittedLine, + emittedColumn: emittedColumn, + sourceLine: sourceLinePos.line, + sourceColumn: sourceLinePos.character, + sourceIndex: sourceMapSourceIndex + }; + stopOverridingSpan = false; + } + else if (!stopOverridingSpan) { + // Take the new pos instead since there is no change in emittedLine and column since last location + lastRecordedSourceMapSpan.sourceLine = sourceLinePos.line; + lastRecordedSourceMapSpan.sourceColumn = sourceLinePos.character; + lastRecordedSourceMapSpan.sourceIndex = sourceMapSourceIndex; + } + updateLastEncodedAndRecordedSpans(); + } + function getStartPos(range) { + var rangeHasDecorators = !!range.decorators; + return range.pos !== -1 ? ts.skipTrivia(currentSourceFile.text, rangeHasDecorators ? range.decorators.end : range.pos) : -1; + } + function emitStart(range) { + emitPos(getStartPos(range)); + } + function emitEnd(range, stopOverridingEnd) { + emitPos(range.end); + stopOverridingSpan = stopOverridingEnd; + } + function changeEmitSourcePos() { + ts.Debug.assert(!modifyLastSourcePos); + modifyLastSourcePos = true; + } + function setSourceFile(sourceFile) { + currentSourceFile = sourceFile; + // 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, currentSourceFile.fileName, host.getCurrentDirectory(), host.getCanonicalFileName, + /*isAbsolutePathAnUrl*/ true); + sourceMapSourceIndex = ts.indexOf(sourceMapData.sourceMapSources, 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(sourceFile.fileName); + if (compilerOptions.inlineSources) { + sourceMapData.sourceMapSourcesContent.push(sourceFile.text); + } + } + } + function getText() { + encodeLastRecordedSourceMapSpan(); + return ts.stringify({ + version: 3, + file: sourceMapData.sourceMapFile, + sourceRoot: sourceMapData.sourceMapSourceRoot, + sources: sourceMapData.sourceMapSources, + names: sourceMapData.sourceMapNames, + mappings: sourceMapData.sourceMapMappings, + sourcesContent: sourceMapData.sourceMapSourcesContent + }); + } + function getSourceMappingURL() { + if (compilerOptions.inlineSourceMap) { + // Encode the sourceMap into the sourceMap url + var base64SourceMapText = ts.convertToBase64(getText()); + return sourceMapData.jsSourceMappingURL = "data:application/json;base64," + base64SourceMapText; + } + else { + return sourceMapData.jsSourceMappingURL; + } + } + } + ts.createSourceMapWriter = createSourceMapWriter; + var base64Chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + function base64FormatEncode(inValue) { + if (inValue < 64) { + return base64Chars.charAt(inValue); + } + throw TypeError(inValue + ": not a 64 based value"); + } + function base64VLQFormatEncode(inValue) { + // Add a new least significant bit that has the sign of the value. + // if negative number the least significant bit that gets added to the number has value 1 + // else least significant bit value that gets added is 0 + // eg. -1 changes to binary : 01 [1] => 3 + // +1 changes to binary : 01 [0] => 2 + if (inValue < 0) { + inValue = ((-inValue) << 1) + 1; + } + else { + inValue = inValue << 1; + } + // Encode 5 bits at a time starting from least significant bits + var encodedStr = ""; + do { + var currentDigit = inValue & 31; // 11111 + inValue = inValue >> 5; + if (inValue > 0) { + // There are still more digits to decode, set the msb (6th bit) + currentDigit = currentDigit | 32; + } + encodedStr = encodedStr + base64FormatEncode(currentDigit); + } while (inValue > 0); + return encodedStr; + } +})(ts || (ts = {})); +/// +/* @internal */ +var ts; (function (ts) { function getDeclarationDiagnostics(host, resolver, targetSourceFile) { - var diagnostics = []; - var jsFilePath = ts.getOwnEmitOutputFilePath(targetSourceFile, host, ".js"); - emitDeclarations(host, resolver, diagnostics, jsFilePath, targetSourceFile); - return diagnostics; + var declarationDiagnostics = ts.createDiagnosticCollection(); + ts.forEachExpectedEmitFile(host, getDeclarationDiagnosticsFromFile, targetSourceFile); + return declarationDiagnostics.getDiagnostics(targetSourceFile ? targetSourceFile.fileName : undefined); + function getDeclarationDiagnosticsFromFile(_a, sources, isBundledEmit) { + var declarationFilePath = _a.declarationFilePath; + emitDeclarations(host, resolver, declarationDiagnostics, declarationFilePath, sources, isBundledEmit); + } } ts.getDeclarationDiagnostics = getDeclarationDiagnostics; - function emitDeclarations(host, resolver, diagnostics, jsFilePath, root) { + function emitDeclarations(host, resolver, emitterDiagnostics, declarationFilePath, sourceFiles, isBundledEmit) { var newLine = host.getNewLine(); var compilerOptions = host.getCompilerOptions(); var write; @@ -28558,8 +32632,10 @@ var ts; var increaseIndent; var decreaseIndent; var writeTextOfNode; - var writer = createAndSetNewTextWriterWithSymbolWriter(); + var writer; + createAndSetNewTextWriterWithSymbolWriter(); var enclosingDeclaration; + var resultHasExternalModuleIndicator; var currentText; var currentLineMap; var currentIdentifiers; @@ -28568,105 +32644,97 @@ var ts; var errorNameNode; var emitJsDocComments = compilerOptions.removeComments ? function (declaration) { } : writeJsDocComments; var emit = compilerOptions.stripInternal ? stripInternal : emitNode; - var noDeclare = !root; + var noDeclare; var moduleElementDeclarationEmitInfo = []; var asynchronousSubModuleDeclarationEmitInfo; // Contains the reference paths that needs to go in the declaration file. // Collecting this separately because reference paths need to be first thing in the declaration file // and we could be collecting these paths from multiple files into single one with --out option - var referencePathsOutput = ""; - if (root) { - // Emitting just a single file, so emit references in this file only + var referencesOutput = ""; + var usedTypeDirectiveReferences; + // Emit references corresponding to each file + var emittedReferencedFiles = []; + var addedGlobalFileReference = false; + var allSourcesModuleElementDeclarationEmitInfo = []; + ts.forEach(sourceFiles, function (sourceFile) { + // Dont emit for javascript file + if (ts.isSourceFileJavaScript(sourceFile)) { + return; + } + // Check what references need to be added if (!compilerOptions.noResolve) { - var addedGlobalFileReference = false; - ts.forEach(root.referencedFiles, function (fileReference) { - var referencedFile = ts.tryResolveScriptReference(host, root, fileReference); - // All the references that are not going to be part of same file - if (referencedFile && ((referencedFile.flags & 4096 /* DeclarationFile */) || - ts.shouldEmitToOwnFile(referencedFile, compilerOptions) || - !addedGlobalFileReference)) { - writeReferencePath(referencedFile); - if (!ts.isExternalModuleOrDeclarationFile(referencedFile)) { + ts.forEach(sourceFile.referencedFiles, function (fileReference) { + var referencedFile = ts.tryResolveScriptReference(host, sourceFile, fileReference); + // Emit reference in dts, if the file reference was not already emitted + if (referencedFile && !ts.contains(emittedReferencedFiles, referencedFile)) { + // Add a reference to generated dts file, + // global file reference is added only + // - if it is not bundled emit (because otherwise it would be self reference) + // - and it is not already added + if (writeReferencePath(referencedFile, !isBundledEmit && !addedGlobalFileReference)) { addedGlobalFileReference = true; } + emittedReferencedFiles.push(referencedFile); } }); } - emitSourceFile(root); + resultHasExternalModuleIndicator = false; + if (!isBundledEmit || !ts.isExternalModule(sourceFile)) { + noDeclare = false; + emitSourceFile(sourceFile); + } + else if (ts.isExternalModule(sourceFile)) { + noDeclare = true; + write("declare module \"" + ts.getResolvedExternalModuleName(host, sourceFile) + "\" {"); + writeLine(); + increaseIndent(); + emitSourceFile(sourceFile); + decreaseIndent(); + write("}"); + writeLine(); + } // create asynchronous output for the importDeclarations if (moduleElementDeclarationEmitInfo.length) { var oldWriter = writer; ts.forEach(moduleElementDeclarationEmitInfo, function (aliasEmitInfo) { - if (aliasEmitInfo.isVisible) { - ts.Debug.assert(aliasEmitInfo.node.kind === 222 /* ImportDeclaration */); + if (aliasEmitInfo.isVisible && !aliasEmitInfo.asynchronousOutput) { + ts.Debug.assert(aliasEmitInfo.node.kind === 230 /* ImportDeclaration */); createAndSetNewTextWriterWithSymbolWriter(); - ts.Debug.assert(aliasEmitInfo.indent === 0); + ts.Debug.assert(aliasEmitInfo.indent === 0 || (aliasEmitInfo.indent === 1 && isBundledEmit)); + for (var i = 0; i < aliasEmitInfo.indent; i++) { + increaseIndent(); + } writeImportDeclaration(aliasEmitInfo.node); aliasEmitInfo.asynchronousOutput = writer.getText(); + for (var i = 0; i < aliasEmitInfo.indent; i++) { + decreaseIndent(); + } } }); setWriter(oldWriter); + allSourcesModuleElementDeclarationEmitInfo = allSourcesModuleElementDeclarationEmitInfo.concat(moduleElementDeclarationEmitInfo); + moduleElementDeclarationEmitInfo = []; } - } - else { - // Emit references corresponding to this file - var emittedReferencedFiles = []; - var prevModuleElementDeclarationEmitInfo = []; - ts.forEach(host.getSourceFiles(), function (sourceFile) { - if (!ts.isDeclarationFile(sourceFile)) { - // Check what references need to be added - if (!compilerOptions.noResolve) { - ts.forEach(sourceFile.referencedFiles, function (fileReference) { - var referencedFile = ts.tryResolveScriptReference(host, sourceFile, fileReference); - // If the reference file is a declaration file, emit that reference - if (referencedFile && (ts.isDeclarationFile(referencedFile) && - !ts.contains(emittedReferencedFiles, referencedFile))) { - writeReferencePath(referencedFile); - emittedReferencedFiles.push(referencedFile); - } - }); - } + if (!isBundledEmit && ts.isExternalModule(sourceFile) && sourceFile.moduleAugmentations.length && !resultHasExternalModuleIndicator) { + // if file was external module with augmentations - this fact should be preserved in .d.ts as well. + // in case if we didn't write any external module specifiers in .d.ts we need to emit something + // that will force compiler to think that this file is an external module - 'export {}' is a reasonable choice here. + write("export {};"); + writeLine(); + } + }); + if (usedTypeDirectiveReferences) { + for (var directive in usedTypeDirectiveReferences) { + if (ts.hasProperty(usedTypeDirectiveReferences, directive)) { + referencesOutput += "/// " + newLine; } - if (!ts.isExternalModuleOrDeclarationFile(sourceFile)) { - noDeclare = false; - emitSourceFile(sourceFile); - } - else if (ts.isExternalModule(sourceFile)) { - noDeclare = true; - write("declare module \"" + ts.getResolvedExternalModuleName(host, sourceFile) + "\" {"); - writeLine(); - increaseIndent(); - emitSourceFile(sourceFile); - decreaseIndent(); - write("}"); - writeLine(); - // create asynchronous output for the importDeclarations - if (moduleElementDeclarationEmitInfo.length) { - var oldWriter = writer; - ts.forEach(moduleElementDeclarationEmitInfo, function (aliasEmitInfo) { - if (aliasEmitInfo.isVisible && !aliasEmitInfo.asynchronousOutput) { - ts.Debug.assert(aliasEmitInfo.node.kind === 222 /* ImportDeclaration */); - createAndSetNewTextWriterWithSymbolWriter(); - ts.Debug.assert(aliasEmitInfo.indent === 1); - increaseIndent(); - writeImportDeclaration(aliasEmitInfo.node); - aliasEmitInfo.asynchronousOutput = writer.getText(); - decreaseIndent(); - } - }); - setWriter(oldWriter); - } - prevModuleElementDeclarationEmitInfo = prevModuleElementDeclarationEmitInfo.concat(moduleElementDeclarationEmitInfo); - moduleElementDeclarationEmitInfo = []; - } - }); - moduleElementDeclarationEmitInfo = moduleElementDeclarationEmitInfo.concat(prevModuleElementDeclarationEmitInfo); + } } return { reportedDeclarationError: reportedDeclarationError, - moduleElementDeclarationEmitInfo: moduleElementDeclarationEmitInfo, + moduleElementDeclarationEmitInfo: allSourcesModuleElementDeclarationEmitInfo, synchronousDeclarationOutput: writer.getText(), - referencePathsOutput: referencePathsOutput + referencesOutput: referencesOutput }; function hasInternalAnnotation(range) { var comment = currentText.substring(range.pos, range.end); @@ -28693,7 +32761,6 @@ var ts; writer.writeParameter = writer.write; writer.writeSymbol = writer.write; setWriter(writer); - return writer; } function setWriter(newWriter) { writer = newWriter; @@ -28707,10 +32774,10 @@ var ts; var oldWriter = writer; ts.forEach(nodes, function (declaration) { var nodeToCheck; - if (declaration.kind === 211 /* VariableDeclaration */) { + if (declaration.kind === 218 /* VariableDeclaration */) { nodeToCheck = declaration.parent.parent; } - else if (declaration.kind === 225 /* NamedImports */ || declaration.kind === 226 /* ImportSpecifier */ || declaration.kind === 223 /* ImportClause */) { + else if (declaration.kind === 233 /* NamedImports */ || declaration.kind === 234 /* ImportSpecifier */ || declaration.kind === 231 /* ImportClause */) { ts.Debug.fail("We should be getting ImportDeclaration instead to write"); } else { @@ -28728,7 +32795,7 @@ var ts; // Writing of function bar would mark alias declaration foo as visible but we haven't yet visited that declaration so do nothing, // we would write alias foo declaration when we visit it since it would now be marked as visible if (moduleElementEmitInfo) { - if (moduleElementEmitInfo.node.kind === 222 /* ImportDeclaration */) { + if (moduleElementEmitInfo.node.kind === 230 /* ImportDeclaration */) { // we have to create asynchronous output only after we have collected complete information // because it is possible to enable multiple bindings as asynchronously visible moduleElementEmitInfo.isVisible = true; @@ -28738,12 +32805,12 @@ var ts; for (var declarationIndent = moduleElementEmitInfo.indent; declarationIndent; declarationIndent--) { increaseIndent(); } - if (nodeToCheck.kind === 218 /* ModuleDeclaration */) { + if (nodeToCheck.kind === 225 /* ModuleDeclaration */) { ts.Debug.assert(asynchronousSubModuleDeclarationEmitInfo === undefined); asynchronousSubModuleDeclarationEmitInfo = []; } writeModuleElement(nodeToCheck); - if (nodeToCheck.kind === 218 /* ModuleDeclaration */) { + if (nodeToCheck.kind === 225 /* ModuleDeclaration */) { moduleElementEmitInfo.subModuleElementDeclarationEmitInfo = asynchronousSubModuleDeclarationEmitInfo; asynchronousSubModuleDeclarationEmitInfo = undefined; } @@ -28753,33 +32820,49 @@ var ts; }); setWriter(oldWriter); } - function handleSymbolAccessibilityError(symbolAccesibilityResult) { - if (symbolAccesibilityResult.accessibility === 0 /* Accessible */) { + function recordTypeReferenceDirectivesIfNecessary(typeReferenceDirectives) { + if (!typeReferenceDirectives) { + return; + } + if (!usedTypeDirectiveReferences) { + usedTypeDirectiveReferences = {}; + } + for (var _i = 0, typeReferenceDirectives_1 = typeReferenceDirectives; _i < typeReferenceDirectives_1.length; _i++) { + var directive = typeReferenceDirectives_1[_i]; + if (!ts.hasProperty(usedTypeDirectiveReferences, directive)) { + usedTypeDirectiveReferences[directive] = directive; + } + } + } + function handleSymbolAccessibilityError(symbolAccessibilityResult) { + if (symbolAccessibilityResult.accessibility === 0 /* Accessible */) { // write the aliases - if (symbolAccesibilityResult && symbolAccesibilityResult.aliasesToMakeVisible) { - writeAsynchronousModuleElements(symbolAccesibilityResult.aliasesToMakeVisible); + if (symbolAccessibilityResult && symbolAccessibilityResult.aliasesToMakeVisible) { + writeAsynchronousModuleElements(symbolAccessibilityResult.aliasesToMakeVisible); } } else { // Report error reportedDeclarationError = true; - var errorInfo = writer.getSymbolAccessibilityDiagnostic(symbolAccesibilityResult); + var errorInfo = writer.getSymbolAccessibilityDiagnostic(symbolAccessibilityResult); if (errorInfo) { if (errorInfo.typeName) { - diagnostics.push(ts.createDiagnosticForNode(symbolAccesibilityResult.errorNode || errorInfo.errorNode, errorInfo.diagnosticMessage, ts.getTextOfNodeFromSourceText(currentText, errorInfo.typeName), symbolAccesibilityResult.errorSymbolName, symbolAccesibilityResult.errorModuleName)); + emitterDiagnostics.add(ts.createDiagnosticForNode(symbolAccessibilityResult.errorNode || errorInfo.errorNode, errorInfo.diagnosticMessage, ts.getTextOfNodeFromSourceText(currentText, errorInfo.typeName), symbolAccessibilityResult.errorSymbolName, symbolAccessibilityResult.errorModuleName)); } else { - diagnostics.push(ts.createDiagnosticForNode(symbolAccesibilityResult.errorNode || errorInfo.errorNode, errorInfo.diagnosticMessage, symbolAccesibilityResult.errorSymbolName, symbolAccesibilityResult.errorModuleName)); + emitterDiagnostics.add(ts.createDiagnosticForNode(symbolAccessibilityResult.errorNode || errorInfo.errorNode, errorInfo.diagnosticMessage, symbolAccessibilityResult.errorSymbolName, symbolAccessibilityResult.errorModuleName)); } } } } function trackSymbol(symbol, enclosingDeclaration, meaning) { handleSymbolAccessibilityError(resolver.isSymbolAccessible(symbol, enclosingDeclaration, meaning)); + recordTypeReferenceDirectivesIfNecessary(resolver.getTypeReferenceDirectivesForSymbol(symbol, meaning)); } function reportInaccessibleThisError() { if (errorNameNode) { - diagnostics.push(ts.createDiagnosticForNode(errorNameNode, ts.Diagnostics.The_inferred_type_of_0_references_an_inaccessible_this_type_A_type_annotation_is_necessary, ts.declarationNameToString(errorNameNode))); + reportedDeclarationError = true; + emitterDiagnostics.add(ts.createDiagnosticForNode(errorNameNode, ts.Diagnostics.The_inferred_type_of_0_references_an_inaccessible_this_type_A_type_annotation_is_necessary, ts.declarationNameToString(errorNameNode))); } } function writeTypeOfDeclaration(declaration, type, getSymbolAccessibilityDiagnostic) { @@ -28845,40 +32928,43 @@ var ts; function emitType(type) { switch (type.kind) { case 117 /* AnyKeyword */: - case 130 /* StringKeyword */: - case 128 /* NumberKeyword */: + case 132 /* StringKeyword */: + case 130 /* NumberKeyword */: case 120 /* BooleanKeyword */: - case 131 /* SymbolKeyword */: + case 133 /* SymbolKeyword */: case 103 /* VoidKeyword */: - case 97 /* ThisKeyword */: - case 9 /* StringLiteral */: + case 135 /* UndefinedKeyword */: + case 93 /* NullKeyword */: + case 127 /* NeverKeyword */: + case 165 /* ThisType */: + case 166 /* StringLiteralType */: return writeTextOfNode(currentText, type); - case 188 /* ExpressionWithTypeArguments */: + case 194 /* ExpressionWithTypeArguments */: return emitExpressionWithTypeArguments(type); - case 151 /* TypeReference */: + case 155 /* TypeReference */: return emitTypeReference(type); - case 154 /* TypeQuery */: + case 158 /* TypeQuery */: return emitTypeQuery(type); - case 156 /* ArrayType */: + case 160 /* ArrayType */: return emitArrayType(type); - case 157 /* TupleType */: + case 161 /* TupleType */: return emitTupleType(type); - case 158 /* UnionType */: + case 162 /* UnionType */: return emitUnionType(type); - case 159 /* IntersectionType */: + case 163 /* IntersectionType */: return emitIntersectionType(type); - case 160 /* ParenthesizedType */: + case 164 /* ParenthesizedType */: return emitParenType(type); - case 152 /* FunctionType */: - case 153 /* ConstructorType */: + case 156 /* FunctionType */: + case 157 /* ConstructorType */: return emitSignatureDeclarationWithJsDocComments(type); - case 155 /* TypeLiteral */: + case 159 /* TypeLiteral */: return emitTypeLiteral(type); case 69 /* Identifier */: return emitEntityName(type); - case 135 /* QualifiedName */: + case 139 /* QualifiedName */: return emitEntityName(type); - case 150 /* TypePredicate */: + case 154 /* TypePredicate */: return emitTypePredicate(type); } function writeEntityName(entityName) { @@ -28886,8 +32972,8 @@ var ts; writeTextOfNode(currentText, entityName); } else { - var left = entityName.kind === 135 /* QualifiedName */ ? entityName.left : entityName.expression; - var right = entityName.kind === 135 /* QualifiedName */ ? entityName.right : entityName.name; + var left = entityName.kind === 139 /* QualifiedName */ ? entityName.left : entityName.expression; + var right = entityName.kind === 139 /* QualifiedName */ ? entityName.right : entityName.name; writeEntityName(left); write("."); writeTextOfNode(currentText, right); @@ -28896,13 +32982,14 @@ var ts; function emitEntityName(entityName) { var visibilityResult = resolver.isEntityNameVisible(entityName, // Aliases can be written asynchronously so use correct enclosing declaration - entityName.parent.kind === 221 /* ImportEqualsDeclaration */ ? entityName.parent : enclosingDeclaration); + entityName.parent.kind === 229 /* ImportEqualsDeclaration */ ? entityName.parent : enclosingDeclaration); handleSymbolAccessibilityError(visibilityResult); + recordTypeReferenceDirectivesIfNecessary(resolver.getTypeReferenceDirectivesForEntityName(entityName)); writeEntityName(entityName); } function emitExpressionWithTypeArguments(node) { if (ts.isSupportedExpressionWithTypeArguments(node)) { - ts.Debug.assert(node.expression.kind === 69 /* Identifier */ || node.expression.kind === 166 /* PropertyAccessExpression */); + ts.Debug.assert(node.expression.kind === 69 /* Identifier */ || node.expression.kind === 172 /* PropertyAccessExpression */); emitEntityName(node.expression); if (node.typeArguments) { write("<"); @@ -28980,9 +33067,10 @@ var ts; } var count = 0; while (true) { - var name_18 = baseName + "_" + (++count); - if (!ts.hasProperty(currentIdentifiers, name_18)) { - return name_18; + count++; + var name_22 = baseName + "_" + count; + if (!ts.hasProperty(currentIdentifiers, name_22)) { + return name_22; } } } @@ -28994,7 +33082,10 @@ var ts; else { // Expression var tempVarName = getExportDefaultTempVariableName(); - write("declare var "); + if (!noDeclare) { + write("declare "); + } + write("var "); write(tempVarName); write(": "); writer.getSymbolAccessibilityDiagnostic = getDefaultExportAccessibilityDiagnostic; @@ -29026,10 +33117,10 @@ var ts; if (isModuleElementVisible) { writeModuleElement(node); } - else if (node.kind === 221 /* ImportEqualsDeclaration */ || - (node.parent.kind === 248 /* SourceFile */ && isCurrentFileExternalModule)) { - var isVisible; - if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 248 /* SourceFile */) { + else if (node.kind === 229 /* ImportEqualsDeclaration */ || + (node.parent.kind === 256 /* SourceFile */ && isCurrentFileExternalModule)) { + var isVisible = void 0; + if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 256 /* SourceFile */) { // Import declaration of another module that is visited async so lets put it in right spot asynchronousSubModuleDeclarationEmitInfo.push({ node: node, @@ -29039,7 +33130,7 @@ var ts; }); } else { - if (node.kind === 222 /* ImportDeclaration */) { + if (node.kind === 230 /* ImportDeclaration */) { var importDeclaration = node; if (importDeclaration.importClause) { isVisible = (importDeclaration.importClause.name && resolver.isDeclarationVisible(importDeclaration.importClause)) || @@ -29057,23 +33148,23 @@ var ts; } function writeModuleElement(node) { switch (node.kind) { - case 213 /* FunctionDeclaration */: + case 220 /* FunctionDeclaration */: return writeFunctionDeclaration(node); - case 193 /* VariableStatement */: + case 200 /* VariableStatement */: return writeVariableStatement(node); - case 215 /* InterfaceDeclaration */: + case 222 /* InterfaceDeclaration */: return writeInterfaceDeclaration(node); - case 214 /* ClassDeclaration */: + case 221 /* ClassDeclaration */: return writeClassDeclaration(node); - case 216 /* TypeAliasDeclaration */: + case 223 /* TypeAliasDeclaration */: return writeTypeAliasDeclaration(node); - case 217 /* EnumDeclaration */: + case 224 /* EnumDeclaration */: return writeEnumDeclaration(node); - case 218 /* ModuleDeclaration */: + case 225 /* ModuleDeclaration */: return writeModuleDeclaration(node); - case 221 /* ImportEqualsDeclaration */: + case 229 /* ImportEqualsDeclaration */: return writeImportEqualsDeclaration(node); - case 222 /* ImportDeclaration */: + case 230 /* ImportDeclaration */: return writeImportDeclaration(node); default: ts.Debug.fail("Unknown symbol kind"); @@ -29081,30 +33172,33 @@ var ts; } function emitModuleElementDeclarationFlags(node) { // If the node is parented in the current source file we need to emit export declare or just export - if (node.parent.kind === 248 /* SourceFile */) { + if (node.parent.kind === 256 /* SourceFile */) { // If the node is exported - if (node.flags & 2 /* Export */) { + if (node.flags & 1 /* Export */) { write("export "); } if (node.flags & 512 /* Default */) { write("default "); } - else if (node.kind !== 215 /* InterfaceDeclaration */ && !noDeclare) { + else if (node.kind !== 222 /* InterfaceDeclaration */ && !noDeclare) { write("declare "); } } } - function emitClassMemberDeclarationFlags(node) { - if (node.flags & 16 /* Private */) { + function emitClassMemberDeclarationFlags(flags) { + if (flags & 8 /* Private */) { write("private "); } - else if (node.flags & 32 /* Protected */) { + else if (flags & 16 /* Protected */) { write("protected "); } - if (node.flags & 64 /* Static */) { + if (flags & 32 /* Static */) { write("static "); } - if (node.flags & 128 /* Abstract */) { + if (flags & 64 /* Readonly */) { + write("readonly "); + } + if (flags & 128 /* Abstract */) { write("abstract "); } } @@ -29112,7 +33206,7 @@ var ts; // note usage of writer. methods instead of aliases created, just to make sure we are using // correct writer especially to handle asynchronous alias writing emitJsDocComments(node); - if (node.flags & 2 /* Export */) { + if (node.flags & 1 /* Export */) { write("export "); } write("import "); @@ -29124,11 +33218,11 @@ var ts; } else { write("require("); - writeTextOfNode(currentText, ts.getExternalModuleImportEqualsDeclarationExpression(node)); + emitExternalModuleSpecifier(node); write(");"); } writer.writeLine(); - function getImportEntityNameVisibilityError(symbolAccesibilityResult) { + function getImportEntityNameVisibilityError(symbolAccessibilityResult) { return { diagnosticMessage: ts.Diagnostics.Import_declaration_0_is_using_private_name_1, errorNode: node, @@ -29138,7 +33232,7 @@ var ts; } function isVisibleNamedBinding(namedBindings) { if (namedBindings) { - if (namedBindings.kind === 224 /* NamespaceImport */) { + if (namedBindings.kind === 232 /* NamespaceImport */) { return resolver.isDeclarationVisible(namedBindings); } else { @@ -29147,12 +33241,8 @@ var ts; } } function writeImportDeclaration(node) { - if (!node.importClause && !(node.flags & 2 /* Export */)) { - // do not write non-exported import declarations that don't have import clauses - return; - } emitJsDocComments(node); - if (node.flags & 2 /* Export */) { + if (node.flags & 1 /* Export */) { write("export "); } write("import "); @@ -29166,7 +33256,7 @@ var ts; // If the default binding was emitted, write the separated write(", "); } - if (node.importClause.namedBindings.kind === 224 /* NamespaceImport */) { + if (node.importClause.namedBindings.kind === 232 /* NamespaceImport */) { write("* as "); writeTextOfNode(currentText, node.importClause.namedBindings.name); } @@ -29178,17 +33268,34 @@ var ts; } write(" from "); } - emitExternalModuleSpecifier(node.moduleSpecifier); + emitExternalModuleSpecifier(node); write(";"); writer.writeLine(); } - function emitExternalModuleSpecifier(moduleSpecifier) { - if (moduleSpecifier.kind === 9 /* StringLiteral */ && (!root) && (compilerOptions.out || compilerOptions.outFile)) { - var moduleName = ts.getExternalModuleNameFromDeclaration(host, resolver, moduleSpecifier.parent); + function emitExternalModuleSpecifier(parent) { + // emitExternalModuleSpecifier is usually called when we emit something in the.d.ts file that will make it an external module (i.e. import/export declarations). + // the only case when it is not true is when we call it to emit correct name for module augmentation - d.ts files with just module augmentations are not considered + // external modules since they are indistinguishable from script files with ambient modules. To fix this in such d.ts files we'll emit top level 'export {}' + // so compiler will treat them as external modules. + resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || parent.kind !== 225 /* ModuleDeclaration */; + var moduleSpecifier; + if (parent.kind === 229 /* ImportEqualsDeclaration */) { + var node = parent; + moduleSpecifier = ts.getExternalModuleImportEqualsDeclarationExpression(node); + } + else if (parent.kind === 225 /* ModuleDeclaration */) { + moduleSpecifier = parent.name; + } + else { + var node = parent; + moduleSpecifier = node.moduleSpecifier; + } + if (moduleSpecifier.kind === 9 /* StringLiteral */ && isBundledEmit && (compilerOptions.out || compilerOptions.outFile)) { + var moduleName = ts.getExternalModuleNameFromDeclaration(host, resolver, parent); if (moduleName) { - write("\""); + write('"'); write(moduleName); - write("\""); + write('"'); return; } } @@ -29221,7 +33328,7 @@ var ts; } if (node.moduleSpecifier) { write(" from "); - emitExternalModuleSpecifier(node.moduleSpecifier); + emitExternalModuleSpecifier(node); } write(";"); writer.writeLine(); @@ -29229,14 +33336,24 @@ var ts; function writeModuleDeclaration(node) { emitJsDocComments(node); emitModuleElementDeclarationFlags(node); - if (node.flags & 65536 /* Namespace */) { - write("namespace "); + if (ts.isGlobalScopeAugmentation(node)) { + write("global "); } else { - write("module "); + if (node.flags & 4096 /* Namespace */) { + write("namespace "); + } + else { + write("module "); + } + if (ts.isExternalModuleAugmentation(node)) { + emitExternalModuleSpecifier(node); + } + else { + writeTextOfNode(currentText, node.name); + } } - writeTextOfNode(currentText, node.name); - while (node.body.kind !== 219 /* ModuleBlock */) { + while (node.body.kind !== 226 /* ModuleBlock */) { node = node.body; write("."); writeTextOfNode(currentText, node.name); @@ -29265,7 +33382,7 @@ var ts; write(";"); writeLine(); enclosingDeclaration = prevEnclosingDeclaration; - function getTypeAliasDeclarationVisibilityError(symbolAccesibilityResult) { + function getTypeAliasDeclarationVisibilityError(symbolAccessibilityResult) { return { diagnosticMessage: ts.Diagnostics.Exported_type_alias_0_has_or_is_using_private_name_1, errorNode: node.type, @@ -29301,7 +33418,7 @@ var ts; writeLine(); } function isPrivateMethodTypeParameter(node) { - return node.parent.kind === 143 /* MethodDeclaration */ && (node.parent.flags & 16 /* Private */); + return node.parent.kind === 147 /* MethodDeclaration */ && (node.parent.flags & 8 /* Private */); } function emitTypeParameters(typeParameters) { function emitTypeParameter(node) { @@ -29312,50 +33429,50 @@ var ts; // If there is constraint present and this is not a type parameter of the private method emit the constraint if (node.constraint && !isPrivateMethodTypeParameter(node)) { write(" extends "); - if (node.parent.kind === 152 /* FunctionType */ || - node.parent.kind === 153 /* ConstructorType */ || - (node.parent.parent && node.parent.parent.kind === 155 /* TypeLiteral */)) { - ts.Debug.assert(node.parent.kind === 143 /* MethodDeclaration */ || - node.parent.kind === 142 /* MethodSignature */ || - node.parent.kind === 152 /* FunctionType */ || - node.parent.kind === 153 /* ConstructorType */ || - node.parent.kind === 147 /* CallSignature */ || - node.parent.kind === 148 /* ConstructSignature */); + if (node.parent.kind === 156 /* FunctionType */ || + node.parent.kind === 157 /* ConstructorType */ || + (node.parent.parent && node.parent.parent.kind === 159 /* TypeLiteral */)) { + ts.Debug.assert(node.parent.kind === 147 /* MethodDeclaration */ || + node.parent.kind === 146 /* MethodSignature */ || + node.parent.kind === 156 /* FunctionType */ || + node.parent.kind === 157 /* ConstructorType */ || + node.parent.kind === 151 /* CallSignature */ || + node.parent.kind === 152 /* ConstructSignature */); emitType(node.constraint); } else { emitTypeWithNewGetSymbolAccessibilityDiagnostic(node.constraint, getTypeParameterConstraintVisibilityError); } } - function getTypeParameterConstraintVisibilityError(symbolAccesibilityResult) { + function getTypeParameterConstraintVisibilityError(symbolAccessibilityResult) { // Type parameter constraints are named by user so we should always be able to name it var diagnosticMessage; switch (node.parent.kind) { - case 214 /* ClassDeclaration */: + case 221 /* ClassDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; - case 215 /* InterfaceDeclaration */: + case 222 /* InterfaceDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; - case 148 /* ConstructSignature */: + case 152 /* ConstructSignature */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 147 /* CallSignature */: + case 151 /* CallSignature */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - if (node.parent.flags & 64 /* Static */) { + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: + if (node.parent.flags & 32 /* Static */) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 214 /* ClassDeclaration */) { + else if (node.parent.parent.kind === 221 /* ClassDeclaration */) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } break; - case 213 /* FunctionDeclaration */: + case 220 /* FunctionDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; default: @@ -29386,10 +33503,14 @@ var ts; else if (!isImplementsList && node.expression.kind === 93 /* NullKeyword */) { write("null"); } - function getHeritageClauseVisibilityError(symbolAccesibilityResult) { + else { + writer.getSymbolAccessibilityDiagnostic = getHeritageClauseVisibilityError; + resolver.writeBaseConstructorTypeOfClass(enclosingDeclaration, enclosingDeclaration, 2 /* UseTypeOfFunction */, writer); + } + function getHeritageClauseVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; // Heritage clause is written by user so it can always be named - if (node.parent.parent.kind === 214 /* ClassDeclaration */) { + if (node.parent.parent.kind === 221 /* ClassDeclaration */) { // Class or Interface implemented/extended is inaccessible diagnosticMessage = isImplementsList ? ts.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 : @@ -29411,7 +33532,7 @@ var ts; function emitParameterProperties(constructorDeclaration) { if (constructorDeclaration) { ts.forEach(constructorDeclaration.parameters, function (param) { - if (param.flags & 56 /* AccessibilityModifier */) { + if (param.flags & 92 /* ParameterPropertyModifier */) { emitPropertyDeclaration(param); } }); @@ -29465,7 +33586,7 @@ var ts; return; } emitJsDocComments(node); - emitClassMemberDeclarationFlags(node); + emitClassMemberDeclarationFlags(node.flags); emitVariableDeclaration(node); write(";"); writeLine(); @@ -29473,7 +33594,7 @@ var ts; function emitVariableDeclaration(node) { // If we are emitting property it isn't moduleElement and hence we already know it needs to be emitted // so there is no check needed to see if declaration is visible - if (node.kind !== 211 /* VariableDeclaration */ || resolver.isDeclarationVisible(node)) { + if (node.kind !== 218 /* VariableDeclaration */ || resolver.isDeclarationVisible(node)) { if (ts.isBindingPattern(node.name)) { emitBindingPattern(node.name); } @@ -29483,51 +33604,51 @@ var ts; // what we want, namely the name expression enclosed in brackets. writeTextOfNode(currentText, node.name); // If optional property emit ? - if ((node.kind === 141 /* PropertyDeclaration */ || node.kind === 140 /* PropertySignature */) && ts.hasQuestionToken(node)) { + if ((node.kind === 145 /* PropertyDeclaration */ || node.kind === 144 /* PropertySignature */ || node.kind === 142 /* Parameter */) && ts.hasQuestionToken(node)) { write("?"); } - if ((node.kind === 141 /* PropertyDeclaration */ || node.kind === 140 /* PropertySignature */) && node.parent.kind === 155 /* TypeLiteral */) { + if ((node.kind === 145 /* PropertyDeclaration */ || node.kind === 144 /* PropertySignature */) && node.parent.kind === 159 /* TypeLiteral */) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } - else if (!(node.flags & 16 /* Private */)) { + else if (!(node.flags & 8 /* Private */)) { writeTypeOfDeclaration(node, node.type, getVariableDeclarationTypeVisibilityError); } } } - function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult) { - if (node.kind === 211 /* VariableDeclaration */) { - return symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? + function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { + if (node.kind === 218 /* VariableDeclaration */) { + return symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Exported_variable_0_has_or_is_using_private_name_1; } - else if (node.kind === 141 /* PropertyDeclaration */ || node.kind === 140 /* PropertySignature */) { + else if (node.kind === 145 /* PropertyDeclaration */ || node.kind === 144 /* PropertySignature */) { // TODO(jfreeman): Deal with computed properties in error reporting. - if (node.flags & 64 /* Static */) { - return symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? + if (node.flags & 32 /* Static */) { + return symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.kind === 214 /* ClassDeclaration */) { - return symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? + else if (node.parent.kind === 221 /* ClassDeclaration */) { + return symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_private_name_1; } else { // Interfaces cannot have types that cannot be named - return symbolAccesibilityResult.errorModuleName ? + return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_private_name_1; } } } - function getVariableDeclarationTypeVisibilityError(symbolAccesibilityResult) { - var diagnosticMessage = getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult); + function getVariableDeclarationTypeVisibilityError(symbolAccessibilityResult) { + var diagnosticMessage = getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult); return diagnosticMessage !== undefined ? { diagnosticMessage: diagnosticMessage, errorNode: node, @@ -29543,15 +33664,15 @@ var ts; var elements = []; for (var _i = 0, _a = bindingPattern.elements; _i < _a.length; _i++) { var element = _a[_i]; - if (element.kind !== 187 /* OmittedExpression */) { + if (element.kind !== 193 /* OmittedExpression */) { elements.push(element); } } emitCommaList(elements, emitBindingElement); } function emitBindingElement(bindingElement) { - function getBindingElementTypeVisibilityError(symbolAccesibilityResult) { - var diagnosticMessage = getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult); + function getBindingElementTypeVisibilityError(symbolAccessibilityResult) { + var diagnosticMessage = getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult); return diagnosticMessage !== undefined ? { diagnosticMessage: diagnosticMessage, errorNode: bindingElement, @@ -29606,14 +33727,14 @@ var ts; if (node === accessors.firstAccessor) { emitJsDocComments(accessors.getAccessor); emitJsDocComments(accessors.setAccessor); - emitClassMemberDeclarationFlags(node); + emitClassMemberDeclarationFlags(node.flags | (accessors.setAccessor ? 0 : 64 /* Readonly */)); writeTextOfNode(currentText, node.name); - if (!(node.flags & 16 /* Private */)) { + if (!(node.flags & 8 /* Private */)) { accessorWithTypeAnnotation = node; var type = getTypeAnnotationFromAccessor(node); if (!type) { // couldn't get type for the first accessor, try the another one - var anotherAccessor = node.kind === 145 /* GetAccessor */ ? accessors.setAccessor : accessors.getAccessor; + var anotherAccessor = node.kind === 149 /* GetAccessor */ ? accessors.setAccessor : accessors.getAccessor; type = getTypeAnnotationFromAccessor(anotherAccessor); if (type) { accessorWithTypeAnnotation = anotherAccessor; @@ -29626,24 +33747,24 @@ var ts; } function getTypeAnnotationFromAccessor(accessor) { if (accessor) { - return accessor.kind === 145 /* GetAccessor */ + return accessor.kind === 149 /* GetAccessor */ ? accessor.type // Getter - return type : accessor.parameters.length > 0 ? accessor.parameters[0].type // Setter parameter type : undefined; } } - function getAccessorDeclarationTypeVisibilityError(symbolAccesibilityResult) { + function getAccessorDeclarationTypeVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; - if (accessorWithTypeAnnotation.kind === 146 /* SetAccessor */) { + if (accessorWithTypeAnnotation.kind === 150 /* SetAccessor */) { // Setters have to have type named and cannot infer it so, the type should always be named - if (accessorWithTypeAnnotation.parent.flags & 64 /* Static */) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + if (accessorWithTypeAnnotation.parent.flags & 32 /* Static */) { + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1; } else { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1; } @@ -29655,16 +33776,16 @@ var ts; }; } else { - if (accessorWithTypeAnnotation.flags & 64 /* Static */) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? + if (accessorWithTypeAnnotation.flags & 32 /* Static */) { + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0; } else { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0; @@ -29685,17 +33806,17 @@ var ts; // so no need to verify if the declaration is visible if (!resolver.isImplementationOfOverload(node)) { emitJsDocComments(node); - if (node.kind === 213 /* FunctionDeclaration */) { + if (node.kind === 220 /* FunctionDeclaration */) { emitModuleElementDeclarationFlags(node); } - else if (node.kind === 143 /* MethodDeclaration */) { - emitClassMemberDeclarationFlags(node); + else if (node.kind === 147 /* MethodDeclaration */ || node.kind === 148 /* Constructor */) { + emitClassMemberDeclarationFlags(node.flags); } - if (node.kind === 213 /* FunctionDeclaration */) { + if (node.kind === 220 /* FunctionDeclaration */) { write("function "); writeTextOfNode(currentText, node.name); } - else if (node.kind === 144 /* Constructor */) { + else if (node.kind === 148 /* Constructor */) { write("constructor"); } else { @@ -29712,37 +33833,50 @@ var ts; emitSignatureDeclaration(node); } function emitSignatureDeclaration(node) { - // Construct signature or constructor type write new Signature - if (node.kind === 148 /* ConstructSignature */ || node.kind === 153 /* ConstructorType */) { - write("new "); - } - emitTypeParameters(node.typeParameters); - if (node.kind === 149 /* IndexSignature */) { + var prevEnclosingDeclaration = enclosingDeclaration; + enclosingDeclaration = node; + var closeParenthesizedFunctionType = false; + if (node.kind === 153 /* IndexSignature */) { + // Index signature can have readonly modifier + emitClassMemberDeclarationFlags(node.flags); write("["); } else { + // Construct signature or constructor type write new Signature + if (node.kind === 152 /* ConstructSignature */ || node.kind === 157 /* ConstructorType */) { + write("new "); + } + else if (node.kind === 156 /* FunctionType */) { + var currentOutput = writer.getText(); + // Do not generate incorrect type when function type with type parameters is type argument + // This could happen if user used space between two '<' making it error free + // e.g var x: A< (a: Tany)=>Tany>; + if (node.typeParameters && currentOutput.charAt(currentOutput.length - 1) === "<") { + closeParenthesizedFunctionType = true; + write("("); + } + } + emitTypeParameters(node.typeParameters); write("("); } - var prevEnclosingDeclaration = enclosingDeclaration; - enclosingDeclaration = node; // Parameters emitCommaList(node.parameters, emitParameterDeclaration); - if (node.kind === 149 /* IndexSignature */) { + if (node.kind === 153 /* IndexSignature */) { write("]"); } else { write(")"); } // If this is not a constructor and is not private, emit the return type - var isFunctionTypeOrConstructorType = node.kind === 152 /* FunctionType */ || node.kind === 153 /* ConstructorType */; - if (isFunctionTypeOrConstructorType || node.parent.kind === 155 /* TypeLiteral */) { + var isFunctionTypeOrConstructorType = node.kind === 156 /* FunctionType */ || node.kind === 157 /* ConstructorType */; + if (isFunctionTypeOrConstructorType || node.parent.kind === 159 /* TypeLiteral */) { // Emit type literal signature return type only if specified if (node.type) { write(isFunctionTypeOrConstructorType ? " => " : ": "); emitType(node.type); } } - else if (node.kind !== 144 /* Constructor */ && !(node.flags & 16 /* Private */)) { + else if (node.kind !== 148 /* Constructor */ && !(node.flags & 8 /* Private */)) { writeReturnTypeAtSignature(node, getReturnTypeVisibilityError); } enclosingDeclaration = prevEnclosingDeclaration; @@ -29750,53 +33884,56 @@ var ts; write(";"); writeLine(); } - function getReturnTypeVisibilityError(symbolAccesibilityResult) { + else if (closeParenthesizedFunctionType) { + write(")"); + } + function getReturnTypeVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; switch (node.kind) { - case 148 /* ConstructSignature */: + case 152 /* ConstructSignature */: // Interfaces cannot have return types that cannot be named - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 147 /* CallSignature */: + case 151 /* CallSignature */: // Interfaces cannot have return types that cannot be named - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 149 /* IndexSignature */: + case 153 /* IndexSignature */: // Interfaces cannot have return types that cannot be named - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - if (node.flags & 64 /* Static */) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: + if (node.flags & 32 /* Static */) { + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0; } - else if (node.parent.kind === 214 /* ClassDeclaration */) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? + else if (node.parent.kind === 221 /* ClassDeclaration */) { + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0; } else { // Interfaces cannot have return types that cannot be named - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; - case 213 /* FunctionDeclaration */: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? + case 220 /* FunctionDeclaration */: + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_private_name_0; @@ -29829,65 +33966,65 @@ var ts; write("?"); } decreaseIndent(); - if (node.parent.kind === 152 /* FunctionType */ || - node.parent.kind === 153 /* ConstructorType */ || - node.parent.parent.kind === 155 /* TypeLiteral */) { + if (node.parent.kind === 156 /* FunctionType */ || + node.parent.kind === 157 /* ConstructorType */ || + node.parent.parent.kind === 159 /* TypeLiteral */) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } - else if (!(node.parent.flags & 16 /* Private */)) { + else if (!(node.parent.flags & 8 /* Private */)) { writeTypeOfDeclaration(node, node.type, getParameterDeclarationTypeVisibilityError); } - function getParameterDeclarationTypeVisibilityError(symbolAccesibilityResult) { - var diagnosticMessage = getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult); + function getParameterDeclarationTypeVisibilityError(symbolAccessibilityResult) { + var diagnosticMessage = getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult); return diagnosticMessage !== undefined ? { diagnosticMessage: diagnosticMessage, errorNode: node, typeName: node.name } : undefined; } - function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult) { + function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { switch (node.parent.kind) { - case 144 /* Constructor */: - return symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? + case 148 /* Constructor */: + return symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1; - case 148 /* ConstructSignature */: + case 152 /* ConstructSignature */: // Interfaces cannot have parameter types that cannot be named - return symbolAccesibilityResult.errorModuleName ? + return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; - case 147 /* CallSignature */: + case 151 /* CallSignature */: // Interfaces cannot have parameter types that cannot be named - return symbolAccesibilityResult.errorModuleName ? + return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - if (node.parent.flags & 64 /* Static */) { - return symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: + if (node.parent.flags & 32 /* Static */) { + return symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 214 /* ClassDeclaration */) { - return symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? + else if (node.parent.parent.kind === 221 /* ClassDeclaration */) { + return symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { // Interfaces cannot have parameter types that cannot be named - return symbolAccesibilityResult.errorModuleName ? + return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } - case 213 /* FunctionDeclaration */: - return symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? + case 220 /* FunctionDeclaration */: + return symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1; @@ -29897,12 +34034,12 @@ var ts; } function emitBindingPattern(bindingPattern) { // We have to explicitly emit square bracket and bracket because these tokens are not store inside the node. - if (bindingPattern.kind === 161 /* ObjectBindingPattern */) { + if (bindingPattern.kind === 167 /* ObjectBindingPattern */) { write("{"); emitCommaList(bindingPattern.elements, emitBindingElement); write("}"); } - else if (bindingPattern.kind === 162 /* ArrayBindingPattern */) { + else if (bindingPattern.kind === 168 /* ArrayBindingPattern */) { write("["); var elements = bindingPattern.elements; emitCommaList(elements, emitBindingElement); @@ -29913,15 +34050,7 @@ var ts; } } function emitBindingElement(bindingElement) { - function getBindingElementTypeVisibilityError(symbolAccesibilityResult) { - var diagnosticMessage = getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult); - return diagnosticMessage !== undefined ? { - diagnosticMessage: diagnosticMessage, - errorNode: bindingElement, - typeName: bindingElement.name - } : undefined; - } - if (bindingElement.kind === 187 /* OmittedExpression */) { + if (bindingElement.kind === 193 /* OmittedExpression */) { // If bindingElement is an omittedExpression (i.e. containing elision), // we will emit blank space (although this may differ from users' original code, // it allows emitSeparatedList to write separator appropriately) @@ -29930,7 +34059,7 @@ var ts; // emit : function foo([ , x, , ]) {} write(" "); } - else if (bindingElement.kind === 163 /* BindingElement */) { + else if (bindingElement.kind === 169 /* BindingElement */) { if (bindingElement.propertyName) { // bindingElement has propertyName property in the following case: // { y: [a,b,c] ...} -> bindingPattern will have a property called propertyName for "y" @@ -29969,64 +34098,86 @@ var ts; } function emitNode(node) { switch (node.kind) { - case 213 /* FunctionDeclaration */: - case 218 /* ModuleDeclaration */: - case 221 /* ImportEqualsDeclaration */: - case 215 /* InterfaceDeclaration */: - case 214 /* ClassDeclaration */: - case 216 /* TypeAliasDeclaration */: - case 217 /* EnumDeclaration */: + case 220 /* FunctionDeclaration */: + case 225 /* ModuleDeclaration */: + case 229 /* ImportEqualsDeclaration */: + case 222 /* InterfaceDeclaration */: + case 221 /* ClassDeclaration */: + case 223 /* TypeAliasDeclaration */: + case 224 /* EnumDeclaration */: return emitModuleElement(node, isModuleElementVisible(node)); - case 193 /* VariableStatement */: + case 200 /* VariableStatement */: return emitModuleElement(node, isVariableStatementVisible(node)); - case 222 /* ImportDeclaration */: + case 230 /* ImportDeclaration */: // Import declaration without import clause is visible, otherwise it is not visible return emitModuleElement(node, /*isModuleElementVisible*/ !node.importClause); - case 228 /* ExportDeclaration */: + case 236 /* ExportDeclaration */: return emitExportDeclaration(node); - case 144 /* Constructor */: - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: + case 148 /* Constructor */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: return writeFunctionDeclaration(node); - case 148 /* ConstructSignature */: - case 147 /* CallSignature */: - case 149 /* IndexSignature */: + case 152 /* ConstructSignature */: + case 151 /* CallSignature */: + case 153 /* IndexSignature */: return emitSignatureDeclarationWithJsDocComments(node); - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: return emitAccessorDeclaration(node); - case 141 /* PropertyDeclaration */: - case 140 /* PropertySignature */: + case 145 /* PropertyDeclaration */: + case 144 /* PropertySignature */: return emitPropertyDeclaration(node); - case 247 /* EnumMember */: + case 255 /* EnumMember */: return emitEnumMemberDeclaration(node); - case 227 /* ExportAssignment */: + case 235 /* ExportAssignment */: return emitExportAssignment(node); - case 248 /* SourceFile */: + case 256 /* SourceFile */: return emitSourceFile(node); } } - function writeReferencePath(referencedFile) { - var declFileName = referencedFile.flags & 4096 /* DeclarationFile */ - ? referencedFile.fileName // Declaration file, use declaration file name - : ts.shouldEmitToOwnFile(referencedFile, compilerOptions) - ? ts.getOwnEmitOutputFilePath(referencedFile, host, ".d.ts") // Own output file so get the .d.ts file - : ts.removeFileExtension(compilerOptions.outFile || compilerOptions.out) + ".d.ts"; // Global out file - declFileName = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizeSlashes(jsFilePath)), declFileName, host.getCurrentDirectory(), host.getCanonicalFileName, - /*isAbsolutePathAnUrl*/ false); - referencePathsOutput += "/// " + newLine; + /** + * Adds the reference to referenced file, returns true if global file reference was emitted + * @param referencedFile + * @param addBundledFileReference Determines if global file reference corresponding to bundled file should be emitted or not + */ + function writeReferencePath(referencedFile, addBundledFileReference) { + var declFileName; + var addedBundledEmitReference = false; + if (ts.isDeclarationFile(referencedFile)) { + // Declaration file, use declaration file name + declFileName = referencedFile.fileName; + } + else { + // Get the declaration file path + ts.forEachExpectedEmitFile(host, getDeclFileName, referencedFile); + } + if (declFileName) { + declFileName = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizeSlashes(declarationFilePath)), declFileName, host.getCurrentDirectory(), host.getCanonicalFileName, + /*isAbsolutePathAnUrl*/ false); + referencesOutput += "/// " + newLine; + } + return addedBundledEmitReference; + function getDeclFileName(emitFileNames, sourceFiles, isBundledEmit) { + // Dont add reference path to this file if it is a bundled emit and caller asked not emit bundled file path + if (isBundledEmit && !addBundledFileReference) { + return; + } + ts.Debug.assert(!!emitFileNames.declarationFilePath || ts.isSourceFileJavaScript(referencedFile), "Declaration file is not present only for javascript files"); + declFileName = emitFileNames.declarationFilePath || emitFileNames.jsFilePath; + addedBundledEmitReference = isBundledEmit; + } } } /* @internal */ - function writeDeclarationFile(jsFilePath, sourceFile, host, resolver, diagnostics) { - var emitDeclarationResult = emitDeclarations(host, resolver, diagnostics, jsFilePath, sourceFile); - // TODO(shkamat): Should we not write any declaration file if any of them can produce error, - // or should we just not write this file like we are doing now - if (!emitDeclarationResult.reportedDeclarationError) { - var declarationOutput = emitDeclarationResult.referencePathsOutput + function writeDeclarationFile(declarationFilePath, sourceFiles, isBundledEmit, host, resolver, emitterDiagnostics) { + var emitDeclarationResult = emitDeclarations(host, resolver, emitterDiagnostics, declarationFilePath, sourceFiles, isBundledEmit); + var emitSkipped = emitDeclarationResult.reportedDeclarationError || host.isEmitBlocked(declarationFilePath) || host.getCompilerOptions().noEmit; + if (!emitSkipped) { + var declarationOutput = emitDeclarationResult.referencesOutput + getDeclarationOutput(emitDeclarationResult.synchronousDeclarationOutput, emitDeclarationResult.moduleElementDeclarationEmitInfo); - ts.writeFile(host, diagnostics, ts.removeFileExtension(jsFilePath) + ".d.ts", declarationOutput, host.getCompilerOptions().emitBOM); + ts.writeFile(host, emitterDiagnostics, declarationFilePath, declarationOutput, host.getCompilerOptions().emitBOM, sourceFiles); } + return emitSkipped; function getDeclarationOutput(synchronousDeclarationOutput, moduleElementDeclarationEmitInfo) { var appliedSyncOutputPos = 0; var declarationOutput = ""; @@ -30045,14 +34196,11 @@ var ts; ts.writeDeclarationFile = writeDeclarationFile; })(ts || (ts = {})); /// +/// /// /* @internal */ var ts; (function (ts) { - function isExternalModuleOrDeclarationFile(sourceFile) { - return ts.isExternalModule(sourceFile) || ts.isDeclarationFile(sourceFile); - } - ts.isExternalModuleOrDeclarationFile = isExternalModuleOrDeclarationFile; function getResolvedExternalModuleName(host, file) { return file.moduleName || ts.getExternalModuleNameFromPath(host, file.fileName); } @@ -30333,55 +34481,37 @@ var ts; TempFlags[TempFlags["CountMask"] = 268435455] = "CountMask"; TempFlags[TempFlags["_i"] = 268435456] = "_i"; })(TempFlags || (TempFlags = {})); + var CopyDirection; + (function (CopyDirection) { + CopyDirection[CopyDirection["ToOriginal"] = 0] = "ToOriginal"; + CopyDirection[CopyDirection["ToOutParameter"] = 1] = "ToOutParameter"; + })(CopyDirection || (CopyDirection = {})); // targetSourceFile is when users only want one file in entire project to be emitted. This is used in compileOnSave feature function emitFiles(resolver, host, targetSourceFile) { // emit output for the __extends helper function var extendsHelper = "\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};"; + var assignHelper = "\nvar __assign = (this && this.__assign) || Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n};"; // emit output for the __decorate helper function var decorateHelper = "\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};"; // emit output for the __metadata helper function var metadataHelper = "\nvar __metadata = (this && this.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};"; // emit output for the __param helper function var paramHelper = "\nvar __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n};"; - var awaiterHelper = "\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promise, generator) {\n return new Promise(function (resolve, reject) {\n generator = generator.call(thisArg, _arguments);\n function cast(value) { return value instanceof Promise && value.constructor === Promise ? value : new Promise(function (resolve) { resolve(value); }); }\n function onfulfill(value) { try { step(\"next\", value); } catch (e) { reject(e); } }\n function onreject(value) { try { step(\"throw\", value); } catch (e) { reject(e); } }\n function step(verb, value) {\n var result = generator[verb](value);\n result.done ? resolve(result.value) : cast(result.value).then(onfulfill, onreject);\n }\n step(\"next\", void 0);\n });\n};"; + var awaiterHelper = "\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator.throw(value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments)).next());\n });\n};"; var compilerOptions = host.getCompilerOptions(); - var languageVersion = compilerOptions.target || 0 /* ES3 */; - var modulekind = compilerOptions.module ? compilerOptions.module : languageVersion === 2 /* ES6 */ ? 5 /* ES6 */ : 0 /* None */; + var languageVersion = ts.getEmitScriptTarget(compilerOptions); + var modulekind = ts.getEmitModuleKind(compilerOptions); var sourceMapDataList = compilerOptions.sourceMap || compilerOptions.inlineSourceMap ? [] : undefined; - var diagnostics = []; + var emittedFilesList = compilerOptions.listEmittedFiles ? [] : undefined; + var emitterDiagnostics = ts.createDiagnosticCollection(); + var emitSkipped = false; var newLine = host.getNewLine(); - var jsxDesugaring = host.getCompilerOptions().jsx !== 1 /* Preserve */; - var shouldEmitJsx = function (s) { return (s.languageVariant === 1 /* JSX */ && !jsxDesugaring); }; - var outFile = compilerOptions.outFile || compilerOptions.out; var emitJavaScript = createFileEmitter(); - if (targetSourceFile === undefined) { - if (outFile) { - emitFile(outFile); - } - else { - ts.forEach(host.getSourceFiles(), function (sourceFile) { - if (ts.shouldEmitToOwnFile(sourceFile, compilerOptions)) { - var jsFilePath = ts.getOwnEmitOutputFilePath(sourceFile, host, shouldEmitJsx(sourceFile) ? ".jsx" : ".js"); - emitFile(jsFilePath, sourceFile); - } - }); - } - } - else { - // targetSourceFile is specified (e.g calling emitter from language service or calling getSemanticDiagnostic from language service) - if (ts.shouldEmitToOwnFile(targetSourceFile, compilerOptions)) { - var jsFilePath = ts.getOwnEmitOutputFilePath(targetSourceFile, host, shouldEmitJsx(targetSourceFile) ? ".jsx" : ".js"); - emitFile(jsFilePath, targetSourceFile); - } - else if (!ts.isDeclarationFile(targetSourceFile) && outFile) { - emitFile(outFile); - } - } - // Sort and make the unique list of diagnostics - diagnostics = ts.sortAndDeduplicateDiagnostics(diagnostics); + ts.forEachExpectedEmitFile(host, emitFile, targetSourceFile); return { - emitSkipped: false, - diagnostics: diagnostics, + emitSkipped: emitSkipped, + diagnostics: emitterDiagnostics.getDiagnostics(), + emittedFiles: emittedFilesList, sourceMaps: sourceMapDataList }; function isUniqueLocalName(name, container) { @@ -30429,6 +34559,8 @@ var ts; function createFileEmitter() { var writer = ts.createTextWriter(newLine); var write = writer.write, writeTextOfNode = writer.writeTextOfNode, writeLine = writer.writeLine, increaseIndent = writer.increaseIndent, decreaseIndent = writer.decreaseIndent; + var sourceMap = compilerOptions.sourceMap || compilerOptions.inlineSourceMap ? ts.createSourceMapWriter(host, writer) : ts.getNullSourceMapWriter(); + var setSourceFile = sourceMap.setSourceFile, emitStart = sourceMap.emitStart, emitEnd = sourceMap.emitEnd, emitPos = sourceMap.emitPos; var currentSourceFile; var currentText; var currentLineMap; @@ -30443,125 +34575,110 @@ var ts; // => // var x;... exporter("x", x = 1) var exportFunctionForFile; + var contextObjectForFile; var generatedNameSet; var nodeToGeneratedName; var computedPropertyNamesToGeneratedNames; + var decoratedClassAliases; var convertedLoopState; var extendsEmitted; + var assignEmitted; var decorateEmitted; var paramEmitted; var awaiterEmitted; - var tempFlags; + var tempFlags = 0; var tempVariables; var tempParameters; var externalImports; var exportSpecifiers; var exportEquals; - var hasExportStars; - /** Write emitted output to disk */ - var writeEmittedFiles = writeJavaScriptFile; + var hasExportStarsToExportValues; var detachedCommentsInfo; - var writeComment = ts.writeCommentRange; - /** Emit a node */ - var emit = emitNodeWithCommentsAndWithoutSourcemap; - /** Called just before starting emit of a node */ - var emitStart = function (node) { }; - /** Called once the emit of the node is done */ - var emitEnd = function (node) { }; - /** Emit the text for the given token that comes after startPos - * This by default writes the text provided with the given tokenKind - * but if optional emitFn callback is provided the text is emitted using the callback instead of default text - * @param tokenKind the kind of the token to search and emit - * @param startPos the position in the source to start searching for the token - * @param emitFn if given will be invoked to emit the text instead of actual token emit */ - var emitToken = emitTokenText; - /** Called to before starting the lexical scopes as in function/class in the emitted code because of node - * @param scopeDeclaration node that starts the lexical scope - * @param scopeName Optional name of this scope instead of deducing one from the declaration node */ - var scopeEmitStart = function (scopeDeclaration, scopeName) { }; - /** Called after coming out of the scope */ - var scopeEmitEnd = function () { }; /** Sourcemap data that will get encoded */ var sourceMapData; - /** The root file passed to the emit function (if present) */ - var root; + /** Is the file being emitted into its own file */ + var isOwnFileEmit; /** If removeComments is true, no leading-comments needed to be emitted **/ var emitLeadingCommentsOfPosition = compilerOptions.removeComments ? function (pos) { } : emitLeadingCommentsOfPositionWorker; + var setSourceMapWriterEmit = compilerOptions.sourceMap || compilerOptions.inlineSourceMap ? changeSourceMapEmit : function (writer) { }; var moduleEmitDelegates = (_a = {}, - _a[5 /* ES6 */] = emitES6Module, - _a[2 /* AMD */] = emitAMDModule, - _a[4 /* System */] = emitSystemModule, - _a[3 /* UMD */] = emitUMDModule, - _a[1 /* CommonJS */] = emitCommonJSModule, + _a[ts.ModuleKind.ES6] = emitES6Module, + _a[ts.ModuleKind.AMD] = emitAMDModule, + _a[ts.ModuleKind.System] = emitSystemModule, + _a[ts.ModuleKind.UMD] = emitUMDModule, + _a[ts.ModuleKind.CommonJS] = emitCommonJSModule, _a ); var bundleEmitDelegates = (_b = {}, - _b[5 /* ES6 */] = function () { }, - _b[2 /* AMD */] = emitAMDModule, - _b[4 /* System */] = emitSystemModule, - _b[3 /* UMD */] = function () { }, - _b[1 /* CommonJS */] = function () { }, + _b[ts.ModuleKind.ES6] = function () { }, + _b[ts.ModuleKind.AMD] = emitAMDModule, + _b[ts.ModuleKind.System] = emitSystemModule, + _b[ts.ModuleKind.UMD] = function () { }, + _b[ts.ModuleKind.CommonJS] = function () { }, _b ); return doEmit; - function doEmit(jsFilePath, rootFile) { + function doEmit(jsFilePath, sourceMapFilePath, sourceFiles, isBundledEmit) { + sourceMap.initialize(jsFilePath, sourceMapFilePath, sourceFiles, isBundledEmit); + generatedNameSet = {}; + nodeToGeneratedName = []; + decoratedClassAliases = []; + isOwnFileEmit = !isBundledEmit; + // Emit helpers from all the files + if (isBundledEmit && modulekind) { + ts.forEach(sourceFiles, emitEmitHelpers); + } + // Do not call emit directly. It does not set the currentSourceFile. + ts.forEach(sourceFiles, emitSourceFile); + writeLine(); + var sourceMappingURL = sourceMap.getSourceMappingURL(); + if (sourceMappingURL) { + write("//# sourceMappingURL=" + sourceMappingURL); + } + writeEmittedFiles(writer.getText(), jsFilePath, sourceMapFilePath, /*writeByteOrderMark*/ compilerOptions.emitBOM, sourceFiles); // reset the state + sourceMap.reset(); writer.reset(); currentSourceFile = undefined; currentText = undefined; currentLineMap = undefined; exportFunctionForFile = undefined; - generatedNameSet = {}; - nodeToGeneratedName = []; + contextObjectForFile = undefined; + generatedNameSet = undefined; + nodeToGeneratedName = undefined; + decoratedClassAliases = undefined; computedPropertyNamesToGeneratedNames = undefined; convertedLoopState = undefined; extendsEmitted = false; decorateEmitted = false; paramEmitted = false; awaiterEmitted = false; + assignEmitted = false; tempFlags = 0; tempVariables = undefined; tempParameters = undefined; externalImports = undefined; exportSpecifiers = undefined; exportEquals = undefined; - hasExportStars = undefined; + hasExportStarsToExportValues = undefined; detachedCommentsInfo = undefined; sourceMapData = undefined; isEs6Module = false; renamedDependencies = undefined; isCurrentFileExternalModule = false; - root = rootFile; - if (compilerOptions.sourceMap || compilerOptions.inlineSourceMap) { - initializeEmitterWithSourceMaps(jsFilePath, root); - } - if (root) { - // Do not call emit directly. It does not set the currentSourceFile. - emitSourceFile(root); - } - else { - if (modulekind) { - ts.forEach(host.getSourceFiles(), emitEmitHelpers); - } - ts.forEach(host.getSourceFiles(), function (sourceFile) { - if ((!isExternalModuleOrDeclarationFile(sourceFile)) || (modulekind && ts.isExternalModule(sourceFile))) { - emitSourceFile(sourceFile); - } - }); - } - writeLine(); - writeEmittedFiles(writer.getText(), jsFilePath, /*writeByteOrderMark*/ compilerOptions.emitBOM); } function emitSourceFile(sourceFile) { currentSourceFile = sourceFile; currentText = sourceFile.text; currentLineMap = ts.getLineStarts(sourceFile); exportFunctionForFile = undefined; + contextObjectForFile = undefined; isEs6Module = sourceFile.symbol && sourceFile.symbol.exports && !!sourceFile.symbol.exports["___esModule"]; renamedDependencies = sourceFile.renamedDependencies; currentFileIdentifiers = sourceFile.identifiers; isCurrentFileExternalModule = ts.isExternalModule(sourceFile); - emit(sourceFile); + setSourceFile(sourceFile); + emitNodeWithCommentsAndWithoutSourcemap(sourceFile); } function isUniqueName(name) { return !resolver.hasGlobalName(name) && @@ -30573,10 +34690,10 @@ var ts; // Note that names generated by makeTempVariableName and makeUniqueName will never conflict. function makeTempVariableName(flags) { if (flags && !(tempFlags & flags)) { - var name_19 = flags === 268435456 /* _i */ ? "_i" : "_n"; - if (isUniqueName(name_19)) { + var name_23 = flags === 268435456 /* _i */ ? "_i" : "_n"; + if (isUniqueName(name_23)) { tempFlags |= flags; - return name_19; + return name_23; } } while (true) { @@ -30584,9 +34701,9 @@ var ts; tempFlags++; // Skip over 'i' and 'n' if (count !== 8 && count !== 13) { - var name_20 = count < 26 ? "_" + String.fromCharCode(97 /* a */ + count) : "_" + (count - 26); - if (isUniqueName(name_20)) { - return name_20; + var name_24 = count < 26 ? "_" + String.fromCharCode(97 /* a */ + count) : "_" + (count - 26); + if (isUniqueName(name_24)) { + return name_24; } } } @@ -30630,17 +34747,17 @@ var ts; switch (node.kind) { case 69 /* Identifier */: return makeUniqueName(node.text); - case 218 /* ModuleDeclaration */: - case 217 /* EnumDeclaration */: + case 225 /* ModuleDeclaration */: + case 224 /* EnumDeclaration */: return generateNameForModuleOrEnum(node); - case 222 /* ImportDeclaration */: - case 228 /* ExportDeclaration */: + case 230 /* ImportDeclaration */: + case 236 /* ExportDeclaration */: return generateNameForImportOrExportDeclaration(node); - case 213 /* FunctionDeclaration */: - case 214 /* ClassDeclaration */: - case 227 /* ExportAssignment */: + case 220 /* FunctionDeclaration */: + case 221 /* ClassDeclaration */: + case 235 /* ExportAssignment */: return generateNameForExportDefault(); - case 186 /* ClassExpression */: + case 192 /* ClassExpression */: return generateNameForClassExpression(); } } @@ -30648,338 +34765,15 @@ var ts; var id = ts.getNodeId(node); return nodeToGeneratedName[id] || (nodeToGeneratedName[id] = ts.unescapeIdentifier(generateNameForNode(node))); } - function initializeEmitterWithSourceMaps(jsFilePath, root) { - var sourceMapDir; // The directory in which sourcemap will be - // Current source map file and its index in the sources list - var sourceMapSourceIndex = -1; - // Names and its index map - var sourceMapNameIndexMap = {}; - var sourceMapNameIndices = []; - function getSourceMapNameIndex() { - return sourceMapNameIndices.length ? ts.lastOrUndefined(sourceMapNameIndices) : -1; + /** Write emitted output to disk */ + function writeEmittedFiles(emitOutput, jsFilePath, sourceMapFilePath, writeByteOrderMark, sourceFiles) { + if (compilerOptions.sourceMap && !compilerOptions.inlineSourceMap) { + ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap.getText(), /*writeByteOrderMark*/ false, sourceFiles); } - // Last recorded and encoded spans - var lastRecordedSourceMapSpan; - var lastEncodedSourceMapSpan = { - emittedLine: 1, - emittedColumn: 1, - sourceLine: 1, - sourceColumn: 1, - sourceIndex: 0 - }; - var lastEncodedNameIndex = 0; - // Encoding for sourcemap span - function encodeLastRecordedSourceMapSpan() { - if (!lastRecordedSourceMapSpan || lastRecordedSourceMapSpan === lastEncodedSourceMapSpan) { - return; - } - var prevEncodedEmittedColumn = lastEncodedSourceMapSpan.emittedColumn; - // Line/Comma delimiters - if (lastEncodedSourceMapSpan.emittedLine === lastRecordedSourceMapSpan.emittedLine) { - // Emit comma to separate the entry - if (sourceMapData.sourceMapMappings) { - sourceMapData.sourceMapMappings += ","; - } - } - else { - // Emit line delimiters - for (var encodedLine = lastEncodedSourceMapSpan.emittedLine; encodedLine < lastRecordedSourceMapSpan.emittedLine; encodedLine++) { - sourceMapData.sourceMapMappings += ";"; - } - prevEncodedEmittedColumn = 1; - } - // 1. Relative Column 0 based - sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.emittedColumn - prevEncodedEmittedColumn); - // 2. Relative sourceIndex - sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceIndex - lastEncodedSourceMapSpan.sourceIndex); - // 3. Relative sourceLine 0 based - sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceLine - lastEncodedSourceMapSpan.sourceLine); - // 4. Relative sourceColumn 0 based - sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceColumn - lastEncodedSourceMapSpan.sourceColumn); - // 5. Relative namePosition 0 based - if (lastRecordedSourceMapSpan.nameIndex >= 0) { - sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.nameIndex - lastEncodedNameIndex); - lastEncodedNameIndex = lastRecordedSourceMapSpan.nameIndex; - } - lastEncodedSourceMapSpan = lastRecordedSourceMapSpan; - sourceMapData.sourceMapDecodedMappings.push(lastEncodedSourceMapSpan); - function base64VLQFormatEncode(inValue) { - function base64FormatEncode(inValue) { - if (inValue < 64) { - return "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(inValue); - } - throw TypeError(inValue + ": not a 64 based value"); - } - // Add a new least significant bit that has the sign of the value. - // if negative number the least significant bit that gets added to the number has value 1 - // else least significant bit value that gets added is 0 - // eg. -1 changes to binary : 01 [1] => 3 - // +1 changes to binary : 01 [0] => 2 - if (inValue < 0) { - inValue = ((-inValue) << 1) + 1; - } - else { - inValue = inValue << 1; - } - // Encode 5 bits at a time starting from least significant bits - var encodedStr = ""; - do { - var currentDigit = inValue & 31; // 11111 - inValue = inValue >> 5; - if (inValue > 0) { - // There are still more digits to decode, set the msb (6th bit) - currentDigit = currentDigit | 32; - } - encodedStr = encodedStr + base64FormatEncode(currentDigit); - } while (inValue > 0); - return encodedStr; - } + if (sourceMapDataList) { + sourceMapDataList.push(sourceMap.getSourceMapData()); } - function recordSourceMapSpan(pos) { - var sourceLinePos = ts.computeLineAndCharacterOfPosition(currentLineMap, pos); - // Convert the location to be one-based. - sourceLinePos.line++; - sourceLinePos.character++; - 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 || - lastRecordedSourceMapSpan.emittedColumn !== emittedColumn || - (lastRecordedSourceMapSpan.sourceIndex === sourceMapSourceIndex && - (lastRecordedSourceMapSpan.sourceLine > sourceLinePos.line || - (lastRecordedSourceMapSpan.sourceLine === sourceLinePos.line && lastRecordedSourceMapSpan.sourceColumn > sourceLinePos.character)))) { - // Encode the last recordedSpan before assigning new - encodeLastRecordedSourceMapSpan(); - // New span - lastRecordedSourceMapSpan = { - emittedLine: emittedLine, - emittedColumn: emittedColumn, - sourceLine: sourceLinePos.line, - sourceColumn: sourceLinePos.character, - nameIndex: getSourceMapNameIndex(), - sourceIndex: sourceMapSourceIndex - }; - } - else { - // Take the new pos instead since there is no change in emittedLine and column since last location - lastRecordedSourceMapSpan.sourceLine = sourceLinePos.line; - lastRecordedSourceMapSpan.sourceColumn = sourceLinePos.character; - lastRecordedSourceMapSpan.sourceIndex = sourceMapSourceIndex; - } - } - function recordEmitNodeStartSpan(node) { - // Get the token pos after skipping to the token (ignoring the leading trivia) - recordSourceMapSpan(ts.skipTrivia(currentText, node.pos)); - } - function recordEmitNodeEndSpan(node) { - recordSourceMapSpan(node.end); - } - function writeTextWithSpanRecord(tokenKind, startPos, emitFn) { - var tokenStartPos = ts.skipTrivia(currentText, startPos); - recordSourceMapSpan(tokenStartPos); - var tokenEndPos = emitTokenText(tokenKind, tokenStartPos, emitFn); - recordSourceMapSpan(tokenEndPos); - return tokenEndPos; - } - function recordNewSourceFileStart(node) { - // 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; - sourceMapData.sourceMapSources.push(ts.getRelativePathToDirectoryOrUrl(sourcesDirectoryPath, node.fileName, host.getCurrentDirectory(), host.getCanonicalFileName, - /*isAbsolutePathAnUrl*/ true)); - sourceMapSourceIndex = sourceMapData.sourceMapSources.length - 1; - // The one that can be used from program to get the actual source file - sourceMapData.inputSourceFileNames.push(node.fileName); - if (compilerOptions.inlineSources) { - if (!sourceMapData.sourceMapSourcesContent) { - sourceMapData.sourceMapSourcesContent = []; - } - sourceMapData.sourceMapSourcesContent.push(node.text); - } - } - function recordScopeNameOfNode(node, scopeName) { - function recordScopeNameIndex(scopeNameIndex) { - sourceMapNameIndices.push(scopeNameIndex); - } - function recordScopeNameStart(scopeName) { - var scopeNameIndex = -1; - if (scopeName) { - var parentIndex = getSourceMapNameIndex(); - if (parentIndex !== -1) { - // Child scopes are always shown with a dot (even if they have no name), - // unless it is a computed property. Then it is shown with brackets, - // but the brackets are included in the name. - var name_21 = node.name; - if (!name_21 || name_21.kind !== 136 /* ComputedPropertyName */) { - scopeName = "." + scopeName; - } - scopeName = sourceMapData.sourceMapNames[parentIndex] + scopeName; - } - scopeNameIndex = ts.getProperty(sourceMapNameIndexMap, scopeName); - if (scopeNameIndex === undefined) { - scopeNameIndex = sourceMapData.sourceMapNames.length; - sourceMapData.sourceMapNames.push(scopeName); - sourceMapNameIndexMap[scopeName] = scopeNameIndex; - } - } - recordScopeNameIndex(scopeNameIndex); - } - if (scopeName) { - // The scope was already given a name use it - recordScopeNameStart(scopeName); - } - else if (node.kind === 213 /* FunctionDeclaration */ || - node.kind === 173 /* FunctionExpression */ || - node.kind === 143 /* MethodDeclaration */ || - node.kind === 142 /* MethodSignature */ || - node.kind === 145 /* GetAccessor */ || - node.kind === 146 /* SetAccessor */ || - node.kind === 218 /* ModuleDeclaration */ || - node.kind === 214 /* ClassDeclaration */ || - node.kind === 217 /* EnumDeclaration */) { - // Declaration and has associated name use it - if (node.name) { - var name_22 = node.name; - // For computed property names, the text will include the brackets - scopeName = name_22.kind === 136 /* ComputedPropertyName */ - ? ts.getTextOfNode(name_22) - : node.name.text; - } - recordScopeNameStart(scopeName); - } - else { - // Block just use the name from upper level scope - recordScopeNameIndex(getSourceMapNameIndex()); - } - } - function recordScopeNameEnd() { - sourceMapNameIndices.pop(); - } - ; - function writeCommentRangeWithMap(currentText, currentLineMap, writer, comment, newLine) { - recordSourceMapSpan(comment.pos); - ts.writeCommentRange(currentText, currentLineMap, writer, comment, newLine); - recordSourceMapSpan(comment.end); - } - function serializeSourceMapContents(version, file, sourceRoot, sources, names, mappings, sourcesContent) { - if (typeof JSON !== "undefined") { - var map_1 = { - version: version, - file: file, - sourceRoot: sourceRoot, - sources: sources, - names: names, - mappings: mappings - }; - if (sourcesContent !== undefined) { - map_1.sourcesContent = sourcesContent; - } - return JSON.stringify(map_1); - } - return "{\"version\":" + version + ",\"file\":\"" + ts.escapeString(file) + "\",\"sourceRoot\":\"" + ts.escapeString(sourceRoot) + "\",\"sources\":[" + serializeStringArray(sources) + "],\"names\":[" + serializeStringArray(names) + "],\"mappings\":\"" + ts.escapeString(mappings) + "\" " + (sourcesContent !== undefined ? ",\"sourcesContent\":[" + serializeStringArray(sourcesContent) + "]" : "") + "}"; - function serializeStringArray(list) { - var output = ""; - for (var i = 0, n = list.length; i < n; i++) { - if (i) { - output += ","; - } - output += "\"" + ts.escapeString(list[i]) + "\""; - } - return output; - } - } - function writeJavaScriptAndSourceMapFile(emitOutput, jsFilePath, writeByteOrderMark) { - encodeLastRecordedSourceMapSpan(); - var sourceMapText = serializeSourceMapContents(3, sourceMapData.sourceMapFile, sourceMapData.sourceMapSourceRoot, sourceMapData.sourceMapSources, sourceMapData.sourceMapNames, sourceMapData.sourceMapMappings, sourceMapData.sourceMapSourcesContent); - sourceMapDataList.push(sourceMapData); - var sourceMapUrl; - if (compilerOptions.inlineSourceMap) { - // Encode the sourceMap into the sourceMap url - var base64SourceMapText = ts.convertToBase64(sourceMapText); - sourceMapUrl = "//# sourceMappingURL=data:application/json;base64," + base64SourceMapText; - } - else { - // Write source map file - ts.writeFile(host, diagnostics, sourceMapData.sourceMapFilePath, sourceMapText, /*writeByteOrderMark*/ false); - sourceMapUrl = "//# sourceMappingURL=" + sourceMapData.jsSourceMappingURL; - } - // Write sourcemap url to the js file and write the js file - writeJavaScriptFile(emitOutput + sourceMapUrl, jsFilePath, writeByteOrderMark); - } - // Initialize source map data - var sourceMapJsFile = ts.getBaseFileName(ts.normalizeSlashes(jsFilePath)); - sourceMapData = { - sourceMapFilePath: jsFilePath + ".map", - jsSourceMappingURL: sourceMapJsFile + ".map", - sourceMapFile: sourceMapJsFile, - sourceMapSourceRoot: compilerOptions.sourceRoot || "", - sourceMapSources: [], - inputSourceFileNames: [], - sourceMapNames: [], - sourceMapMappings: "", - sourceMapSourcesContent: undefined, - sourceMapDecodedMappings: [] - }; - // Normalize source root and make sure it has trailing "/" so that it can be used to combine paths with the - // relative paths of the sources list in the sourcemap - sourceMapData.sourceMapSourceRoot = ts.normalizeSlashes(sourceMapData.sourceMapSourceRoot); - if (sourceMapData.sourceMapSourceRoot.length && sourceMapData.sourceMapSourceRoot.charCodeAt(sourceMapData.sourceMapSourceRoot.length - 1) !== 47 /* slash */) { - sourceMapData.sourceMapSourceRoot += ts.directorySeparator; - } - if (compilerOptions.mapRoot) { - sourceMapDir = ts.normalizeSlashes(compilerOptions.mapRoot); - if (root) { - // For modules or multiple emit files the mapRoot will have directory structure like the sources - // So if src\a.ts and src\lib\b.ts are compiled together user would be moving the maps into mapRoot\a.js.map and mapRoot\lib\b.js.map - sourceMapDir = ts.getDirectoryPath(ts.getSourceFilePathInNewDir(root, host, sourceMapDir)); - } - if (!ts.isRootedDiskPath(sourceMapDir) && !ts.isUrl(sourceMapDir)) { - // The relative paths are relative to the common directory - sourceMapDir = ts.combinePaths(host.getCommonSourceDirectory(), sourceMapDir); - sourceMapData.jsSourceMappingURL = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizePath(jsFilePath)), // get the relative sourceMapDir path based on jsFilePath - ts.combinePaths(sourceMapDir, sourceMapData.jsSourceMappingURL), // this is where user expects to see sourceMap - host.getCurrentDirectory(), host.getCanonicalFileName, - /*isAbsolutePathAnUrl*/ true); - } - else { - sourceMapData.jsSourceMappingURL = ts.combinePaths(sourceMapDir, sourceMapData.jsSourceMappingURL); - } - } - else { - sourceMapDir = ts.getDirectoryPath(ts.normalizePath(jsFilePath)); - } - function emitNodeWithSourceMap(node) { - if (node) { - if (ts.nodeIsSynthesized(node)) { - return emitNodeWithoutSourceMap(node); - } - if (node.kind !== 248 /* SourceFile */) { - recordEmitNodeStartSpan(node); - emitNodeWithoutSourceMap(node); - recordEmitNodeEndSpan(node); - } - else { - recordNewSourceFileStart(node); - emitNodeWithoutSourceMap(node); - } - } - } - function emitNodeWithCommentsAndWithSourcemap(node) { - emitNodeConsideringCommentsOption(node, emitNodeWithSourceMap); - } - writeEmittedFiles = writeJavaScriptAndSourceMapFile; - emit = emitNodeWithCommentsAndWithSourcemap; - emitStart = recordEmitNodeStartSpan; - emitEnd = recordEmitNodeEndSpan; - emitToken = writeTextWithSpanRecord; - scopeEmitStart = recordScopeNameOfNode; - scopeEmitEnd = recordScopeNameEnd; - writeComment = writeCommentRangeWithMap; - } - function writeJavaScriptFile(emitOutput, jsFilePath, writeByteOrderMark) { - ts.writeFile(host, diagnostics, jsFilePath, emitOutput, writeByteOrderMark); + ts.writeFile(host, emitterDiagnostics, jsFilePath, emitOutput, writeByteOrderMark, sourceFiles); } // Create a temporary variable with a unique unused name. function createTempVariable(flags) { @@ -31011,7 +34805,15 @@ var ts; write(";"); } } - function emitTokenText(tokenKind, startPos, emitFn) { + /** Emit the text for the given token that comes after startPos + * This by default writes the text provided with the given tokenKind + * but if optional emitFn callback is provided the text is emitted using the callback instead of default text + * @param tokenKind the kind of the token to search and emit + * @param startPos the position in the source to start searching for the token + * @param emitFn if given will be invoked to emit the text instead of actual token emit */ + function emitToken(tokenKind, startPos, emitFn) { + var tokenStartPos = ts.skipTrivia(currentText, startPos); + emitPos(tokenStartPos); var tokenString = ts.tokenToString(tokenKind); if (emitFn) { emitFn(); @@ -31019,7 +34821,9 @@ var ts; else { write(tokenString); } - return startPos + tokenString.length; + var tokenEndPos = tokenStartPos + tokenString.length; + emitPos(tokenEndPos); + return tokenEndPos; } function emitOptional(prefix, node) { if (node) { @@ -31036,11 +34840,6 @@ var ts; write(")"); } } - function emitTrailingCommaIfPresent(nodeList) { - if (nodeList.hasTrailingComma) { - write(","); - } - } function emitLinePreservingList(parent, nodes, allowTrailingComma, spacesBetweenBraces) { ts.Debug.assert(nodes.length > 0); increaseIndent(); @@ -31113,7 +34912,7 @@ var ts; } function emitCommaList(nodes) { if (nodes) { - emitList(nodes, 0, nodes.length, /*multiline*/ false, /*trailingComma*/ false); + emitList(nodes, 0, nodes.length, /*multiLine*/ false, /*trailingComma*/ false); } } function emitLines(nodes) { @@ -31153,7 +34952,7 @@ var ts; // Any template literal or string literal with an extended escape // (e.g. "\u{0067}") will need to be downleveled as a escaped string literal. if (languageVersion < 2 /* ES6 */ && (ts.isTemplateLiteralKind(node.kind) || node.hasExtendedUnicodeEscape)) { - return getQuotedEscapedLiteralText("\"", node.text, "\""); + return getQuotedEscapedLiteralText('"', node.text, '"'); } // 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. @@ -31164,7 +34963,7 @@ var ts; // or an escaped quoted form of the original text if it's string-like. switch (node.kind) { case 9 /* StringLiteral */: - return getQuotedEscapedLiteralText("\"", node.text, "\""); + return getQuotedEscapedLiteralText('"', node.text, '"'); case 11 /* NoSubstitutionTemplateLiteral */: return getQuotedEscapedLiteralText("`", node.text, "`"); case 12 /* TemplateHead */: @@ -31186,7 +34985,7 @@ var ts; // The raw strings contain the (escaped) strings of what the user wrote. // Examples: `\n` is converted to "\\n", a template string with a newline to "\n". var text = ts.getTextOfNodeFromSourceText(currentText, node); - // text contains the original source, it will also contain quotes ("`"), dolar signs and braces ("${" and "}"), + // text contains the original source, it will also contain quotes ("`"), dollar signs and braces ("${" and "}"), // thus we need to remove those characters. // First template piece starts with "`", others with "}" // Last template piece ends with "`", others with "${" @@ -31228,10 +35027,10 @@ var ts; write("("); emit(tempVariable); // Now we emit the expressions - if (node.template.kind === 183 /* TemplateExpression */) { + if (node.template.kind === 189 /* TemplateExpression */) { ts.forEach(node.template.templateSpans, function (templateSpan) { write(", "); - var needsParens = templateSpan.expression.kind === 181 /* BinaryExpression */ + var needsParens = templateSpan.expression.kind === 187 /* BinaryExpression */ && templateSpan.expression.operatorToken.kind === 24 /* CommaToken */; emitParenthesizedIf(templateSpan.expression, needsParens); }); @@ -31266,7 +35065,7 @@ var ts; // ("abc" + 1) << (2 + "") // rather than // "abc" + (1 << 2) + "" - var needsParens = templateSpan.expression.kind !== 172 /* ParenthesizedExpression */ + var needsParens = templateSpan.expression.kind !== 178 /* ParenthesizedExpression */ && comparePrecedenceToBinaryPlus(templateSpan.expression) !== 1 /* GreaterThan */; if (i > 0 || headEmitted) { // If this is the first span and the head was not emitted, then this templateSpan's @@ -31308,11 +35107,11 @@ var ts; } function templateNeedsParens(template, parent) { switch (parent.kind) { - case 168 /* CallExpression */: - case 169 /* NewExpression */: + case 174 /* CallExpression */: + case 175 /* NewExpression */: return parent.expression === template; - case 170 /* TaggedTemplateExpression */: - case 172 /* ParenthesizedExpression */: + case 176 /* TaggedTemplateExpression */: + case 178 /* ParenthesizedExpression */: return false; default: return comparePrecedenceToBinaryPlus(parent) !== -1 /* LessThan */; @@ -31333,7 +35132,7 @@ var ts; // TODO (drosen): Note that we need to account for the upcoming 'yield' and // spread ('...') unary operators that are anticipated for ES6. switch (expression.kind) { - case 181 /* BinaryExpression */: + case 187 /* BinaryExpression */: switch (expression.operatorToken.kind) { case 37 /* AsteriskToken */: case 39 /* SlashToken */: @@ -31345,8 +35144,8 @@ var ts; default: return -1 /* LessThan */; } - case 184 /* YieldExpression */: - case 182 /* ConditionalExpression */: + case 190 /* YieldExpression */: + case 188 /* ConditionalExpression */: return -1 /* LessThan */; default: return 1 /* GreaterThan */; @@ -31362,9 +35161,9 @@ var ts; /// 'Div' for upper-cased or dotted names function emitTagName(name) { if (name.kind === 69 /* Identifier */ && ts.isIntrinsicJsxName(name.text)) { - write("\""); + write('"'); emit(name); - write("\""); + write('"'); } else { emit(name); @@ -31374,13 +35173,13 @@ var ts; /// these emit into an object literal property name, we don't need to be worried /// about keywords, just non-identifier characters function emitAttributeName(name) { - if (/[A-Za-z_]+[\w*]/.test(name.text)) { - write("\""); + if (/^[A-Za-z_]\w*$/.test(name.text)) { emit(name); - write("\""); } else { + write('"'); emit(name); + write('"'); } } /// Emit an name/value pair for an attribute (e.g. "x: 3") @@ -31396,7 +35195,7 @@ var ts; } function emitJsxElement(openingNode, children) { var syntheticReactRef = ts.createSynthesizedNode(69 /* Identifier */); - syntheticReactRef.text = "React"; + syntheticReactRef.text = compilerOptions.reactNamespace ? compilerOptions.reactNamespace : "React"; syntheticReactRef.parent = openingNode; // Call React.createElement(tag, ... emitLeadingComments(openingNode); @@ -31411,40 +35210,39 @@ var ts; } else { // Either emit one big object literal (no spread attribs), or - // a call to React.__spread + // a call to the __assign helper var attrs = openingNode.attributes; - if (ts.forEach(attrs, function (attr) { return attr.kind === 239 /* JsxSpreadAttribute */; })) { - emitExpressionIdentifier(syntheticReactRef); - write(".__spread("); + if (ts.forEach(attrs, function (attr) { return attr.kind === 247 /* JsxSpreadAttribute */; })) { + write("__assign("); var haveOpenedObjectLiteral = false; - for (var i_1 = 0; i_1 < attrs.length; i_1++) { - if (attrs[i_1].kind === 239 /* JsxSpreadAttribute */) { + for (var i = 0; i < attrs.length; i++) { + if (attrs[i].kind === 247 /* JsxSpreadAttribute */) { // If this is the first argument, we need to emit a {} as the first argument - if (i_1 === 0) { + if (i === 0) { write("{}, "); } if (haveOpenedObjectLiteral) { write("}"); haveOpenedObjectLiteral = false; } - if (i_1 > 0) { + if (i > 0) { write(", "); } - emit(attrs[i_1].expression); + emit(attrs[i].expression); } else { - ts.Debug.assert(attrs[i_1].kind === 238 /* JsxAttribute */); + ts.Debug.assert(attrs[i].kind === 246 /* JsxAttribute */); if (haveOpenedObjectLiteral) { write(", "); } else { haveOpenedObjectLiteral = true; - if (i_1 > 0) { + if (i > 0) { write(", "); } write("{"); } - emitJsxAttribute(attrs[i_1]); + emitJsxAttribute(attrs[i]); } } if (haveOpenedObjectLiteral) @@ -31454,7 +35252,7 @@ var ts; else { // One object literal with all the attributes in them write("{"); - for (var i = 0; i < attrs.length; i++) { + for (var i = 0, n = attrs.length; i < n; i++) { if (i > 0) { write(", "); } @@ -31465,23 +35263,45 @@ var ts; } // Children if (children) { - for (var i = 0; i < children.length; i++) { - // Don't emit empty expressions - if (children[i].kind === 240 /* JsxExpression */ && !(children[i].expression)) { - continue; - } - // Don't emit empty strings - if (children[i].kind === 236 /* JsxText */) { - var text = getTextToEmit(children[i]); - if (text !== undefined) { - write(", \""); - write(text); - write("\""); + var firstChild = void 0; + var multipleEmittableChildren = false; + for (var i = 0, n = children.length; i < n; i++) { + var jsxChild = children[i]; + if (isJsxChildEmittable(jsxChild)) { + // we need to decide whether to emit in single line or multiple lines as indented list + // store firstChild reference, if we see another emittable child, then emit accordingly + if (!firstChild) { + write(", "); + firstChild = jsxChild; + } + else { + // more than one emittable child, emit indented list + if (!multipleEmittableChildren) { + multipleEmittableChildren = true; + increaseIndent(); + writeLine(); + emit(firstChild); + } + write(", "); + writeLine(); + emit(jsxChild); } } + } + if (multipleEmittableChildren) { + decreaseIndent(); + } + else if (firstChild) { + if (firstChild.kind !== 241 /* JsxElement */ && firstChild.kind !== 242 /* JsxSelfClosingElement */) { + emit(firstChild); + } else { - write(", "); - emit(children[i]); + // If the only child is jsx element, put it on a new indented line + increaseIndent(); + writeLine(); + emit(firstChild); + writeLine(); + decreaseIndent(); } } } @@ -31489,11 +35309,11 @@ var ts; write(")"); // closes "React.createElement(" emitTrailingComments(openingNode); } - if (node.kind === 233 /* JsxElement */) { + if (node.kind === 241 /* JsxElement */) { emitJsxElement(node.openingElement, node.children); } else { - ts.Debug.assert(node.kind === 234 /* JsxSelfClosingElement */); + ts.Debug.assert(node.kind === 242 /* JsxSelfClosingElement */); emitJsxElement(node); } } @@ -31515,11 +35335,11 @@ var ts; if (i > 0) { write(" "); } - if (attribs[i].kind === 239 /* JsxSpreadAttribute */) { + if (attribs[i].kind === 247 /* JsxSpreadAttribute */) { emitJsxSpreadAttribute(attribs[i]); } else { - ts.Debug.assert(attribs[i].kind === 238 /* JsxAttribute */); + ts.Debug.assert(attribs[i].kind === 246 /* JsxAttribute */); emitJsxAttribute(attribs[i]); } } @@ -31527,11 +35347,11 @@ var ts; function emitJsxOpeningOrSelfClosingElement(node) { write("<"); emit(node.tagName); - if (node.attributes.length > 0 || (node.kind === 234 /* JsxSelfClosingElement */)) { + if (node.attributes.length > 0 || (node.kind === 242 /* JsxSelfClosingElement */)) { write(" "); } emitAttributes(node.attributes); - if (node.kind === 234 /* JsxSelfClosingElement */) { + if (node.kind === 242 /* JsxSelfClosingElement */) { write("/>"); } else { @@ -31550,11 +35370,11 @@ var ts; } emitJsxClosingElement(node.closingElement); } - if (node.kind === 233 /* JsxElement */) { + if (node.kind === 241 /* JsxElement */) { emitJsxElement(node); } else { - ts.Debug.assert(node.kind === 234 /* JsxSelfClosingElement */); + ts.Debug.assert(node.kind === 242 /* JsxSelfClosingElement */); emitJsxOpeningOrSelfClosingElement(node); } } @@ -31562,11 +35382,11 @@ var ts; // In a sense, it does not actually emit identifiers as much as it declares a name for a specific property. // For example, this is utilized when feeding in a result to Object.defineProperty. function emitExpressionForPropertyName(node) { - ts.Debug.assert(node.kind !== 163 /* BindingElement */); + ts.Debug.assert(node.kind !== 169 /* BindingElement */); if (node.kind === 9 /* StringLiteral */) { emitLiteral(node); } - else if (node.kind === 136 /* ComputedPropertyName */) { + else if (node.kind === 140 /* ComputedPropertyName */) { // if this is a decorated computed property, we will need to capture the result // of the property expression so that we can apply decorators later. This is to ensure // we don't introduce unintended side effects: @@ -31597,88 +35417,87 @@ var ts; emit(node.expression); } else { - write("\""); + write('"'); if (node.kind === 8 /* NumericLiteral */) { write(node.text); } else { writeTextOfNode(currentText, node); } - write("\""); + write('"'); } } function isExpressionIdentifier(node) { var parent = node.parent; switch (parent.kind) { - case 164 /* ArrayLiteralExpression */: - case 189 /* AsExpression */: - case 181 /* BinaryExpression */: - case 168 /* CallExpression */: - case 241 /* CaseClause */: - case 136 /* ComputedPropertyName */: - case 182 /* ConditionalExpression */: - case 139 /* Decorator */: - case 175 /* DeleteExpression */: - case 197 /* DoStatement */: - case 167 /* ElementAccessExpression */: - case 227 /* ExportAssignment */: - case 195 /* ExpressionStatement */: - case 188 /* ExpressionWithTypeArguments */: - case 199 /* ForStatement */: - case 200 /* ForInStatement */: - case 201 /* ForOfStatement */: - case 196 /* IfStatement */: - case 234 /* JsxSelfClosingElement */: - case 235 /* JsxOpeningElement */: - case 239 /* JsxSpreadAttribute */: - case 240 /* JsxExpression */: - case 169 /* NewExpression */: - case 172 /* ParenthesizedExpression */: - case 180 /* PostfixUnaryExpression */: - case 179 /* PrefixUnaryExpression */: - case 204 /* ReturnStatement */: - case 246 /* ShorthandPropertyAssignment */: - case 185 /* SpreadElementExpression */: - case 206 /* SwitchStatement */: - case 170 /* TaggedTemplateExpression */: - case 190 /* TemplateSpan */: - case 208 /* ThrowStatement */: - case 171 /* TypeAssertionExpression */: - case 176 /* TypeOfExpression */: - case 177 /* VoidExpression */: - case 198 /* WhileStatement */: - case 205 /* WithStatement */: - case 184 /* YieldExpression */: + case 170 /* ArrayLiteralExpression */: + case 195 /* AsExpression */: + case 184 /* AwaitExpression */: + case 187 /* BinaryExpression */: + case 174 /* CallExpression */: + case 249 /* CaseClause */: + case 140 /* ComputedPropertyName */: + case 188 /* ConditionalExpression */: + case 143 /* Decorator */: + case 181 /* DeleteExpression */: + case 204 /* DoStatement */: + case 173 /* ElementAccessExpression */: + case 235 /* ExportAssignment */: + case 202 /* ExpressionStatement */: + case 194 /* ExpressionWithTypeArguments */: + case 206 /* ForStatement */: + case 207 /* ForInStatement */: + case 208 /* ForOfStatement */: + case 203 /* IfStatement */: + case 245 /* JsxClosingElement */: + case 242 /* JsxSelfClosingElement */: + case 243 /* JsxOpeningElement */: + case 247 /* JsxSpreadAttribute */: + case 248 /* JsxExpression */: + case 175 /* NewExpression */: + case 196 /* NonNullExpression */: + case 178 /* ParenthesizedExpression */: + case 186 /* PostfixUnaryExpression */: + case 185 /* PrefixUnaryExpression */: + case 211 /* ReturnStatement */: + case 254 /* ShorthandPropertyAssignment */: + case 191 /* SpreadElementExpression */: + case 213 /* SwitchStatement */: + case 176 /* TaggedTemplateExpression */: + case 197 /* TemplateSpan */: + case 215 /* ThrowStatement */: + case 177 /* TypeAssertionExpression */: + case 182 /* TypeOfExpression */: + case 183 /* VoidExpression */: + case 205 /* WhileStatement */: + case 212 /* WithStatement */: + case 190 /* YieldExpression */: return true; - case 163 /* BindingElement */: - case 247 /* EnumMember */: - case 138 /* Parameter */: - case 245 /* PropertyAssignment */: - case 141 /* PropertyDeclaration */: - case 211 /* VariableDeclaration */: + case 169 /* BindingElement */: + case 255 /* EnumMember */: + case 142 /* Parameter */: + case 253 /* PropertyAssignment */: + case 145 /* PropertyDeclaration */: + case 218 /* VariableDeclaration */: return parent.initializer === node; - case 166 /* PropertyAccessExpression */: + case 172 /* PropertyAccessExpression */: return parent.expression === node; - case 174 /* ArrowFunction */: - case 173 /* FunctionExpression */: + case 180 /* ArrowFunction */: + case 179 /* FunctionExpression */: return parent.body === node; - case 221 /* ImportEqualsDeclaration */: + case 229 /* ImportEqualsDeclaration */: return parent.moduleReference === node; - case 135 /* QualifiedName */: + case 139 /* QualifiedName */: return parent.left === node; } return false; } function emitExpressionIdentifier(node) { - if (resolver.getNodeCheckFlags(node) & 2048 /* LexicalArguments */) { - write("_arguments"); - return; - } var container = resolver.getReferencedExportContainer(node); if (container) { - if (container.kind === 248 /* SourceFile */) { + if (container.kind === 256 /* SourceFile */) { // Identifier references module export - if (modulekind !== 5 /* ES6 */ && modulekind !== 4 /* System */) { + if (modulekind !== ts.ModuleKind.ES6 && modulekind !== ts.ModuleKind.System) { write("exports."); } } @@ -31689,22 +35508,22 @@ var ts; } } else { - if (modulekind !== 5 /* ES6 */) { + if (modulekind !== ts.ModuleKind.ES6) { var declaration = resolver.getReferencedImportDeclaration(node); if (declaration) { - if (declaration.kind === 223 /* ImportClause */) { + if (declaration.kind === 231 /* ImportClause */) { // Identifier references default import write(getGeneratedNameForNode(declaration.parent)); - write(languageVersion === 0 /* ES3 */ ? "[\"default\"]" : ".default"); + write(languageVersion === 0 /* ES3 */ ? '["default"]' : ".default"); return; } - else if (declaration.kind === 226 /* ImportSpecifier */) { + else if (declaration.kind === 234 /* ImportSpecifier */) { // Identifier references named import write(getGeneratedNameForNode(declaration.parent.parent.parent)); - var name_23 = declaration.propertyName || declaration.name; - var identifier = ts.getTextOfNodeFromSourceText(currentText, name_23); + var name_25 = declaration.propertyName || declaration.name; + var identifier = ts.getTextOfNodeFromSourceText(currentText, name_25); if (languageVersion === 0 /* ES3 */ && identifier === "default") { - write("[\"default\"]"); + write('["default"]'); } else { write("."); @@ -31714,13 +35533,26 @@ var ts; } } } - if (languageVersion !== 2 /* ES6 */) { - var declaration = resolver.getReferencedNestedRedeclaration(node); + if (languageVersion < 2 /* ES6 */) { + var declaration = resolver.getReferencedDeclarationWithCollidingName(node); if (declaration) { write(getGeneratedNameForNode(declaration.name)); return; } } + else if (resolver.getNodeCheckFlags(node) & 1048576 /* BodyScopedClassBinding */) { + // Due to the emit for class decorators, any reference to the class from inside of the class body + // must instead be rewritten to point to a temporary variable to avoid issues with the double-bind + // behavior of class names in ES6. + var declaration = resolver.getReferencedValueDeclaration(node); + if (declaration) { + var classAlias = decoratedClassAliases[ts.getNodeId(declaration)]; + if (classAlias !== undefined) { + write(classAlias); + return; + } + } + } } if (ts.nodeIsSynthesized(node)) { write(node.text); @@ -31729,15 +35561,15 @@ var ts; writeTextOfNode(currentText, node); } } - function isNameOfNestedRedeclaration(node) { + function isNameOfNestedBlockScopedRedeclarationOrCapturedBinding(node) { if (languageVersion < 2 /* ES6 */) { - var parent_6 = node.parent; - switch (parent_6.kind) { - case 163 /* BindingElement */: - case 214 /* ClassDeclaration */: - case 217 /* EnumDeclaration */: - case 211 /* VariableDeclaration */: - return parent_6.name === node && resolver.isNestedRedeclaration(parent_6); + var parent_13 = node.parent; + switch (parent_13.kind) { + case 169 /* BindingElement */: + case 221 /* ClassDeclaration */: + case 224 /* EnumDeclaration */: + case 218 /* VariableDeclaration */: + return parent_13.name === node && resolver.isDeclarationWithCollidingName(parent_13); } } return false; @@ -31746,8 +35578,8 @@ var ts; if (convertedLoopState) { if (node.text == "arguments" && resolver.isArgumentsLocalBinding(node)) { // in converted loop body arguments cannot be used directly. - var name_24 = convertedLoopState.argumentsName || (convertedLoopState.argumentsName = makeUniqueName("arguments")); - write(name_24); + var name_26 = convertedLoopState.argumentsName || (convertedLoopState.argumentsName = makeUniqueName("arguments")); + write(name_26); return; } } @@ -31757,7 +35589,7 @@ var ts; else if (isExpressionIdentifier(node)) { emitExpressionIdentifier(node); } - else if (isNameOfNestedRedeclaration(node)) { + else if (isNameOfNestedBlockScopedRedeclarationOrCapturedBinding(node)) { write(getGeneratedNameForNode(node)); } else if (ts.nodeIsSynthesized(node)) { @@ -31771,6 +35603,9 @@ var ts; if (resolver.getNodeCheckFlags(node) & 2 /* LexicalThis */) { write("_this"); } + else if (convertedLoopState) { + write(convertedLoopState.thisName || (convertedLoopState.thisName = makeUniqueName("this"))); + } else { write("this"); } @@ -31844,10 +35679,10 @@ var ts; } } function needsParenthesisForAwaitExpressionAsYield(node) { - if (node.parent.kind === 181 /* BinaryExpression */ && !ts.isAssignmentOperator(node.parent.operatorToken.kind)) { + if (node.parent.kind === 187 /* BinaryExpression */ && !ts.isAssignmentOperator(node.parent.operatorToken.kind)) { return true; } - else if (node.parent.kind === 182 /* ConditionalExpression */ && node.parent.condition === node) { + else if (node.parent.kind === 188 /* ConditionalExpression */ && node.parent.condition === node) { return true; } return false; @@ -31855,11 +35690,11 @@ var ts; function needsParenthesisForPropertyAccessOrInvocation(node) { switch (node.kind) { case 69 /* Identifier */: - case 164 /* ArrayLiteralExpression */: - case 166 /* PropertyAccessExpression */: - case 167 /* ElementAccessExpression */: - case 168 /* CallExpression */: - case 172 /* ParenthesizedExpression */: + case 170 /* ArrayLiteralExpression */: + case 172 /* PropertyAccessExpression */: + case 173 /* ElementAccessExpression */: + case 174 /* CallExpression */: + case 178 /* ParenthesizedExpression */: // This list is not exhaustive and only includes those cases that are relevant // to the check in emitArrayLiteral. More cases can be added as needed. return false; @@ -31879,17 +35714,17 @@ var ts; write(", "); } var e = elements[pos]; - if (e.kind === 185 /* SpreadElementExpression */) { + if (e.kind === 191 /* SpreadElementExpression */) { e = e.expression; emitParenthesizedIf(e, /*parenthesized*/ group === 0 && needsParenthesisForPropertyAccessOrInvocation(e)); pos++; - if (pos === length && group === 0 && needsUniqueCopy && e.kind !== 164 /* ArrayLiteralExpression */) { + if (pos === length && group === 0 && needsUniqueCopy && e.kind !== 170 /* ArrayLiteralExpression */) { write(".slice()"); } } else { var i = pos; - while (i < length && elements[i].kind !== 185 /* SpreadElementExpression */) { + while (i < length && elements[i].kind !== 191 /* SpreadElementExpression */) { i++; } write("["); @@ -31912,7 +35747,7 @@ var ts; } } function isSpreadElementExpression(node) { - return node.kind === 185 /* SpreadElementExpression */; + return node.kind === 191 /* SpreadElementExpression */; } function emitArrayLiteral(node) { var elements = node.elements; @@ -31921,11 +35756,11 @@ var ts; } else if (languageVersion >= 2 /* ES6 */ || !ts.forEach(elements, isSpreadElementExpression)) { write("["); - emitLinePreservingList(node, node.elements, elements.hasTrailingComma, /*spacesBetweenBraces:*/ false); + emitLinePreservingList(node, node.elements, elements.hasTrailingComma, /*spacesBetweenBraces*/ false); write("]"); } else { - emitListWithSpread(elements, /*needsUniqueCopy*/ true, /*multiLine*/ (node.flags & 1024 /* MultiLine */) !== 0, + emitListWithSpread(elements, /*needsUniqueCopy*/ true, /*multiLine*/ node.multiLine, /*trailingComma*/ elements.hasTrailingComma, /*useConcat*/ true); } } @@ -31941,10 +35776,10 @@ var ts; // then try to preserve the original shape of the object literal. // Otherwise just try to preserve the formatting. if (numElements === properties.length) { - emitLinePreservingList(node, properties, /* allowTrailingComma */ languageVersion >= 1 /* ES5 */, /* spacesBetweenBraces */ true); + emitLinePreservingList(node, properties, /*allowTrailingComma*/ languageVersion >= 1 /* ES5 */, /*spacesBetweenBraces*/ true); } else { - var multiLine = (node.flags & 1024 /* MultiLine */) !== 0; + var multiLine = node.multiLine; if (!multiLine) { write(" "); } @@ -31963,7 +35798,7 @@ var ts; write("}"); } function emitDownlevelObjectLiteralWithComputedProperties(node, firstComputedPropertyIndex) { - var multiLine = (node.flags & 1024 /* MultiLine */) !== 0; + var multiLine = node.multiLine; var properties = node.properties; write("("); if (multiLine) { @@ -31982,7 +35817,7 @@ var ts; writeComma(); var property = properties[i]; emitStart(property); - if (property.kind === 145 /* GetAccessor */ || property.kind === 146 /* SetAccessor */) { + if (property.kind === 149 /* GetAccessor */ || property.kind === 150 /* SetAccessor */) { // TODO (drosen): Reconcile with 'emitMemberFunctions'. var accessors = ts.getAllAccessorDeclarations(node.properties, property); if (property !== accessors.firstAccessor) { @@ -31991,7 +35826,7 @@ var ts; write("Object.defineProperty("); emit(tempVar); write(", "); - emitStart(node.name); + emitStart(property.name); emitExpressionForPropertyName(property.name); emitEnd(property.name); write(", {"); @@ -32034,13 +35869,13 @@ var ts; emitMemberAccessForPropertyName(property.name); emitEnd(property.name); write(" = "); - if (property.kind === 245 /* PropertyAssignment */) { + if (property.kind === 253 /* PropertyAssignment */) { emit(property.initializer); } - else if (property.kind === 246 /* ShorthandPropertyAssignment */) { + else if (property.kind === 254 /* ShorthandPropertyAssignment */) { emitExpressionIdentifier(property.name); } - else if (property.kind === 143 /* MethodDeclaration */) { + else if (property.kind === 147 /* MethodDeclaration */) { emitFunctionDeclaration(property); } else { @@ -32074,7 +35909,7 @@ var ts; // Everything until that point can be emitted as part of the initial object literal. var numInitialNonComputedProperties = numProperties; for (var i = 0, n = properties.length; i < n; i++) { - if (properties[i].name.kind === 136 /* ComputedPropertyName */) { + if (properties[i].name.kind === 140 /* ComputedPropertyName */) { numInitialNonComputedProperties = i; break; } @@ -32090,21 +35925,21 @@ var ts; emitObjectLiteralBody(node, properties.length); } function createBinaryExpression(left, operator, right, startsOnNewLine) { - var result = ts.createSynthesizedNode(181 /* BinaryExpression */, startsOnNewLine); + var result = ts.createSynthesizedNode(187 /* BinaryExpression */, startsOnNewLine); result.operatorToken = ts.createSynthesizedNode(operator); result.left = left; result.right = right; return result; } function createPropertyAccessExpression(expression, name) { - var result = ts.createSynthesizedNode(166 /* PropertyAccessExpression */); + var result = ts.createSynthesizedNode(172 /* PropertyAccessExpression */); result.expression = parenthesizeForAccess(expression); result.dotToken = ts.createSynthesizedNode(21 /* DotToken */); result.name = name; return result; } function createElementAccessExpression(expression, argumentExpression) { - var result = ts.createSynthesizedNode(167 /* ElementAccessExpression */); + var result = ts.createSynthesizedNode(173 /* ElementAccessExpression */); result.expression = parenthesizeForAccess(expression); result.argumentExpression = argumentExpression; return result; @@ -32112,7 +35947,9 @@ var ts; function parenthesizeForAccess(expr) { // When diagnosing whether the expression needs parentheses, the decision should be based // on the innermost expression in a chain of nested type assertions. - while (expr.kind === 171 /* TypeAssertionExpression */ || expr.kind === 189 /* AsExpression */) { + while (expr.kind === 177 /* TypeAssertionExpression */ || + expr.kind === 195 /* AsExpression */ || + expr.kind === 196 /* NonNullExpression */) { expr = expr.expression; } // isLeftHandSideExpression is almost the correct criterion for when it is not necessary @@ -32124,11 +35961,11 @@ var ts; // 1.x -> not the same as (1).x // if (ts.isLeftHandSideExpression(expr) && - expr.kind !== 169 /* NewExpression */ && + expr.kind !== 175 /* NewExpression */ && expr.kind !== 8 /* NumericLiteral */) { return expr; } - var node = ts.createSynthesizedNode(172 /* ParenthesizedExpression */); + var node = ts.createSynthesizedNode(178 /* ParenthesizedExpression */); node.expression = expr; return node; } @@ -32163,7 +36000,12 @@ var ts; // Return true if identifier resolves to an exported member of a namespace function isNamespaceExportReference(node) { var container = resolver.getReferencedExportContainer(node); - return container && container.kind !== 248 /* SourceFile */; + return container && container.kind !== 256 /* SourceFile */; + } + // Return true if identifier resolves to an imported identifier + function isImportedReference(node) { + var declaration = resolver.getReferencedImportDeclaration(node); + return declaration && (declaration.kind === 231 /* ImportClause */ || declaration.kind === 234 /* ImportSpecifier */); } function emitShorthandPropertyAssignment(node) { // The name property of a short-hand property assignment is considered an expression position, so here @@ -32178,7 +36020,18 @@ var ts; // let obj = { y }; // } // Here we need to emit obj = { y : m.y } regardless of the output target. - if (modulekind !== 5 /* ES6 */ || isNamespaceExportReference(node.name)) { + // The same rules apply for imported identifiers when targeting module formats with indirect access to + // the imported identifiers. For example, when targeting CommonJS: + // + // import {foo} from './foo'; + // export const baz = { foo }; + // + // Must be transformed into: + // + // const foo_1 = require('./foo'); + // exports.baz = { foo: foo_1.foo }; + // + if (languageVersion < 2 /* ES6 */ || (modulekind !== ts.ModuleKind.ES6 && isImportedReference(node.name)) || isNamespaceExportReference(node.name)) { // Emit identifier as an identifier write(": "); emit(node.name); @@ -32193,7 +36046,7 @@ var ts; if (constantValue !== undefined) { write(constantValue.toString()); if (!compilerOptions.removeComments) { - var propertyName = node.kind === 166 /* PropertyAccessExpression */ ? ts.declarationNameToString(node.name) : ts.getTextOfNode(node.argumentExpression); + var propertyName = node.kind === 172 /* PropertyAccessExpression */ ? ts.declarationNameToString(node.name) : ts.getTextOfNode(node.argumentExpression); write(" /* " + propertyName + " */"); } return true; @@ -32204,7 +36057,7 @@ var ts; if (compilerOptions.isolatedModules) { return undefined; } - return node.kind === 166 /* PropertyAccessExpression */ || node.kind === 167 /* ElementAccessExpression */ + return node.kind === 172 /* PropertyAccessExpression */ || node.kind === 173 /* ElementAccessExpression */ ? resolver.getConstantValue(node) : undefined; } @@ -32231,6 +36084,14 @@ var ts; if (tryEmitConstantValue(node)) { return; } + if (languageVersion === 2 /* ES6 */ && + node.expression.kind === 95 /* SuperKeyword */ && + isInAsyncMethodWithSuperInES6(node)) { + var name_27 = ts.createSynthesizedNode(9 /* StringLiteral */); + name_27.text = node.name.text; + emitSuperAccessInAsyncMethod(node.expression, name_27); + return; + } emit(node.expression); var indentedBeforeDot = indentIfOnDifferentLines(node, node.expression, node.dotToken); // 1 .toString is a valid property access, emit a space after the literal @@ -32293,25 +36154,37 @@ var ts; } emitExpressionIdentifier(node); break; - case 135 /* QualifiedName */: + case 139 /* QualifiedName */: emitQualifiedNameAsExpression(node, useFallback); break; + default: + emitNodeWithoutSourceMap(node); + break; } } function emitIndexedAccess(node) { if (tryEmitConstantValue(node)) { return; } + if (languageVersion === 2 /* ES6 */ && + node.expression.kind === 95 /* SuperKeyword */ && + isInAsyncMethodWithSuperInES6(node)) { + emitSuperAccessInAsyncMethod(node.expression, node.argumentExpression); + return; + } emit(node.expression); write("["); emit(node.argumentExpression); write("]"); } function hasSpreadElement(elements) { - return ts.forEach(elements, function (e) { return e.kind === 185 /* SpreadElementExpression */; }); + return ts.forEach(elements, function (e) { return e.kind === 191 /* SpreadElementExpression */; }); } function skipParentheses(node) { - while (node.kind === 172 /* ParenthesizedExpression */ || node.kind === 171 /* TypeAssertionExpression */ || node.kind === 189 /* AsExpression */) { + while (node.kind === 178 /* ParenthesizedExpression */ || + node.kind === 177 /* TypeAssertionExpression */ || + node.kind === 195 /* AsExpression */ || + node.kind === 196 /* NonNullExpression */) { node = node.expression; } return node; @@ -32332,13 +36205,13 @@ var ts; function emitCallWithSpread(node) { var target; var expr = skipParentheses(node.expression); - if (expr.kind === 166 /* PropertyAccessExpression */) { + if (expr.kind === 172 /* PropertyAccessExpression */) { // Target will be emitted as "this" argument target = emitCallTarget(expr.expression); write("."); emit(expr.name); } - else if (expr.kind === 167 /* ElementAccessExpression */) { + else if (expr.kind === 173 /* ElementAccessExpression */) { // Target will be emitted as "this" argument target = emitCallTarget(expr.expression); write("["); @@ -32371,23 +36244,42 @@ var ts; emitListWithSpread(node.arguments, /*needsUniqueCopy*/ false, /*multiLine*/ false, /*trailingComma*/ false, /*useConcat*/ true); write(")"); } + function isInAsyncMethodWithSuperInES6(node) { + if (languageVersion === 2 /* ES6 */) { + var container = ts.getSuperContainer(node, /*includeFunctions*/ false); + if (container && resolver.getNodeCheckFlags(container) & (2048 /* AsyncMethodWithSuper */ | 4096 /* AsyncMethodWithSuperBinding */)) { + return true; + } + } + return false; + } + function emitSuperAccessInAsyncMethod(superNode, argumentExpression) { + var container = ts.getSuperContainer(superNode, /*includeFunctions*/ false); + var isSuperBinding = resolver.getNodeCheckFlags(container) & 4096 /* AsyncMethodWithSuperBinding */; + write("_super("); + emit(argumentExpression); + write(isSuperBinding ? ").value" : ")"); + } function emitCallExpression(node) { if (languageVersion < 2 /* ES6 */ && hasSpreadElement(node.arguments)) { emitCallWithSpread(node); return; } + var expression = node.expression; var superCall = false; - if (node.expression.kind === 95 /* SuperKeyword */) { - emitSuper(node.expression); + var isAsyncMethodWithSuper = false; + if (expression.kind === 95 /* SuperKeyword */) { + emitSuper(expression); superCall = true; } else { - emit(node.expression); - superCall = node.expression.kind === 166 /* PropertyAccessExpression */ && node.expression.expression.kind === 95 /* SuperKeyword */; + superCall = ts.isSuperPropertyOrElementAccess(expression); + isAsyncMethodWithSuper = superCall && isInAsyncMethodWithSuperInES6(node); + emit(expression); } - if (superCall && languageVersion < 2 /* ES6 */) { + if (superCall && (languageVersion < 2 /* ES6 */ || isAsyncMethodWithSuper)) { write(".call("); - emitThis(node.expression); + emitThis(expression); if (node.arguments.length) { write(", "); emitCommaList(node.arguments); @@ -32425,7 +36317,7 @@ var ts; write(".bind.apply("); emit(target); write(", [void 0].concat("); - emitListWithSpread(node.arguments, /*needsUniqueCopy*/ false, /*multiline*/ false, /*trailingComma*/ false, /*useConcat*/ false); + emitListWithSpread(node.arguments, /*needsUniqueCopy*/ false, /*multiLine*/ false, /*trailingComma*/ false, /*useConcat*/ false); write(")))"); write("()"); } @@ -32452,12 +36344,16 @@ var ts; // If the node is synthesized, it means the emitter put the parentheses there, // not the user. If we didn't want them, the emitter would not have put them // there. - if (!ts.nodeIsSynthesized(node) && node.parent.kind !== 174 /* ArrowFunction */) { - if (node.expression.kind === 171 /* TypeAssertionExpression */ || node.expression.kind === 189 /* AsExpression */) { + if (!ts.nodeIsSynthesized(node) && node.parent.kind !== 180 /* ArrowFunction */) { + if (node.expression.kind === 177 /* TypeAssertionExpression */ || + node.expression.kind === 195 /* AsExpression */ || + node.expression.kind === 196 /* NonNullExpression */) { var operand = node.expression.expression; // Make sure we consider all nested cast expressions, e.g.: // (-A).x; - while (operand.kind === 171 /* TypeAssertionExpression */ || operand.kind === 189 /* AsExpression */) { + while (operand.kind === 177 /* TypeAssertionExpression */ || + operand.kind === 195 /* AsExpression */ || + operand.kind === 196 /* NonNullExpression */) { operand = operand.expression; } // We have an expression of the form: (SubExpr) @@ -32468,15 +36364,15 @@ var ts; // (typeof A).toString() should be emitted as (typeof A).toString() and not typeof A.toString() // new (A()) should be emitted as new (A()) and not new A() // (function foo() { })() should be emitted as an IIF (function foo(){})() and not declaration function foo(){} () - if (operand.kind !== 179 /* PrefixUnaryExpression */ && - operand.kind !== 177 /* VoidExpression */ && - operand.kind !== 176 /* TypeOfExpression */ && - operand.kind !== 175 /* DeleteExpression */ && - operand.kind !== 180 /* PostfixUnaryExpression */ && - operand.kind !== 169 /* NewExpression */ && - !(operand.kind === 168 /* CallExpression */ && node.parent.kind === 169 /* NewExpression */) && - !(operand.kind === 173 /* FunctionExpression */ && node.parent.kind === 168 /* CallExpression */) && - !(operand.kind === 8 /* NumericLiteral */ && node.parent.kind === 166 /* PropertyAccessExpression */)) { + if (operand.kind !== 185 /* PrefixUnaryExpression */ && + operand.kind !== 183 /* VoidExpression */ && + operand.kind !== 182 /* TypeOfExpression */ && + operand.kind !== 181 /* DeleteExpression */ && + operand.kind !== 186 /* PostfixUnaryExpression */ && + operand.kind !== 175 /* NewExpression */ && + !(operand.kind === 174 /* CallExpression */ && node.parent.kind === 175 /* NewExpression */) && + !(operand.kind === 179 /* FunctionExpression */ && node.parent.kind === 174 /* CallExpression */) && + !(operand.kind === 8 /* NumericLiteral */ && node.parent.kind === 172 /* PropertyAccessExpression */)) { emit(operand); return; } @@ -32505,14 +36401,15 @@ var ts; if (!isCurrentFileSystemExternalModule() || node.kind !== 69 /* Identifier */ || ts.nodeIsSynthesized(node)) { return false; } - var isVariableDeclarationOrBindingElement = node.parent && (node.parent.kind === 211 /* VariableDeclaration */ || node.parent.kind === 163 /* BindingElement */); + var isVariableDeclarationOrBindingElement = node.parent && (node.parent.kind === 218 /* VariableDeclaration */ || node.parent.kind === 169 /* BindingElement */); var targetDeclaration = isVariableDeclarationOrBindingElement ? node.parent : resolver.getReferencedValueDeclaration(node); return isSourceFileLevelDeclarationInSystemJsModule(targetDeclaration, /*isExported*/ true); } function emitPrefixUnaryExpression(node) { - var exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.operand); + var exportChanged = (node.operator === 41 /* PlusPlusToken */ || node.operator === 42 /* MinusMinusToken */) && + isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.operand); if (exportChanged) { // emit // ++x @@ -32535,7 +36432,7 @@ var ts; // the resulting expression a prefix increment operation. And in the second, it will make the resulting // expression a prefix increment whose operand is a plus expression - (++(+x)) // The same is true of minus of course. - if (node.operand.kind === 179 /* PrefixUnaryExpression */) { + if (node.operand.kind === 185 /* PrefixUnaryExpression */) { var operand = node.operand; if (node.operator === 35 /* PlusToken */ && (operand.operator === 35 /* PlusToken */ || operand.operator === 41 /* PlusPlusToken */)) { write(" "); @@ -32589,12 +36486,12 @@ var ts; if (!node || !isCurrentFileSystemExternalModule()) { return false; } - var current = node; + var current = ts.getRootDeclaration(node).parent; while (current) { - if (current.kind === 248 /* SourceFile */) { - return !isExported || ((ts.getCombinedNodeFlags(node) & 2 /* Export */) !== 0); + if (current.kind === 256 /* SourceFile */) { + return !isExported || ((ts.getCombinedNodeFlags(node) & 1 /* Export */) !== 0); } - else if (ts.isFunctionLike(current) || current.kind === 219 /* ModuleBlock */) { + else if (ts.isDeclaration(current)) { return false; } else { @@ -32609,19 +36506,19 @@ var ts; function emitExponentiationOperator(node) { var leftHandSideExpression = node.left; if (node.operatorToken.kind === 60 /* AsteriskAsteriskEqualsToken */) { - var synthesizedLHS; + var synthesizedLHS = void 0; var shouldEmitParentheses = false; if (ts.isElementAccessExpression(leftHandSideExpression)) { shouldEmitParentheses = true; write("("); - synthesizedLHS = ts.createSynthesizedNode(167 /* ElementAccessExpression */, /*startsOnNewLine*/ false); - var identifier = emitTempVariableAssignment(leftHandSideExpression.expression, /*canDefinedTempVariablesInPlaces*/ false, /*shouldEmitCommaBeforeAssignment*/ false); + synthesizedLHS = ts.createSynthesizedNode(173 /* ElementAccessExpression */, /*startsOnNewLine*/ false); + var identifier = emitTempVariableAssignment(leftHandSideExpression.expression, /*canDefineTempVariablesInPlace*/ false, /*shouldEmitCommaBeforeAssignment*/ false); synthesizedLHS.expression = identifier; if (leftHandSideExpression.argumentExpression.kind !== 8 /* NumericLiteral */ && leftHandSideExpression.argumentExpression.kind !== 9 /* StringLiteral */) { var tempArgumentExpression = createAndRecordTempVariable(268435456 /* _i */); synthesizedLHS.argumentExpression = tempArgumentExpression; - emitAssignment(tempArgumentExpression, leftHandSideExpression.argumentExpression, /*shouldEmitCommaBeforeAssignment*/ true); + emitAssignment(tempArgumentExpression, leftHandSideExpression.argumentExpression, /*shouldEmitCommaBeforeAssignment*/ true, leftHandSideExpression.expression); } else { synthesizedLHS.argumentExpression = leftHandSideExpression.argumentExpression; @@ -32631,8 +36528,8 @@ var ts; else if (ts.isPropertyAccessExpression(leftHandSideExpression)) { shouldEmitParentheses = true; write("("); - synthesizedLHS = ts.createSynthesizedNode(166 /* PropertyAccessExpression */, /*startsOnNewLine*/ false); - var identifier = emitTempVariableAssignment(leftHandSideExpression.expression, /*canDefinedTempVariablesInPlaces*/ false, /*shouldemitCommaBeforeAssignment*/ false); + synthesizedLHS = ts.createSynthesizedNode(172 /* PropertyAccessExpression */, /*startsOnNewLine*/ false); + var identifier = emitTempVariableAssignment(leftHandSideExpression.expression, /*canDefineTempVariablesInPlace*/ false, /*shouldEmitCommaBeforeAssignment*/ false); synthesizedLHS.expression = identifier; synthesizedLHS.dotToken = leftHandSideExpression.dotToken; synthesizedLHS.name = leftHandSideExpression.name; @@ -32659,8 +36556,8 @@ var ts; } function emitBinaryExpression(node) { if (languageVersion < 2 /* ES6 */ && node.operatorToken.kind === 56 /* EqualsToken */ && - (node.left.kind === 165 /* ObjectLiteralExpression */ || node.left.kind === 164 /* ArrayLiteralExpression */)) { - emitDestructuring(node, node.parent.kind === 195 /* ExpressionStatement */); + (node.left.kind === 171 /* ObjectLiteralExpression */ || node.left.kind === 170 /* ArrayLiteralExpression */)) { + emitDestructuring(node, node.parent.kind === 202 /* ExpressionStatement */); } else { var exportChanged = node.operatorToken.kind >= 56 /* FirstAssignment */ && @@ -32725,7 +36622,7 @@ var ts; } } function isSingleLineEmptyBlock(node) { - if (node && node.kind === 192 /* Block */) { + if (node && node.kind === 199 /* Block */) { var block = node; return block.statements.length === 0 && nodeEndIsOnSameLineAsNodeStart(block, block); } @@ -32739,22 +36636,20 @@ var ts; } emitToken(15 /* OpenBraceToken */, node.pos); increaseIndent(); - scopeEmitStart(node.parent); - if (node.kind === 219 /* ModuleBlock */) { - ts.Debug.assert(node.parent.kind === 218 /* ModuleDeclaration */); + if (node.kind === 226 /* ModuleBlock */) { + ts.Debug.assert(node.parent.kind === 225 /* ModuleDeclaration */); emitCaptureThisForNodeIfNecessary(node.parent); } emitLines(node.statements); - if (node.kind === 219 /* ModuleBlock */) { + if (node.kind === 226 /* ModuleBlock */) { emitTempDeclarations(/*newLine*/ true); } decreaseIndent(); writeLine(); emitToken(16 /* CloseBraceToken */, node.statements.end); - scopeEmitEnd(); } function emitEmbeddedStatement(node) { - if (node.kind === 192 /* Block */) { + if (node.kind === 199 /* Block */) { write(" "); emit(node); } @@ -32766,7 +36661,7 @@ var ts; } } function emitExpressionStatement(node) { - emitParenthesizedIf(node.expression, /*parenthesized*/ node.expression.kind === 174 /* ArrowFunction */); + emitParenthesizedIf(node.expression, /*parenthesized*/ node.expression.kind === 180 /* ArrowFunction */); write(";"); } function emitIfStatement(node) { @@ -32779,7 +36674,7 @@ var ts; if (node.elseStatement) { writeLine(); emitToken(80 /* ElseKeyword */, node.thenStatement.end); - if (node.elseStatement.kind === 196 /* IfStatement */) { + if (node.elseStatement.kind === 203 /* IfStatement */) { write(" "); emit(node.elseStatement); } @@ -32794,12 +36689,12 @@ var ts; function emitDoStatementWorker(node, loop) { write("do"); if (loop) { - emitConvertedLoopCall(loop, /* emitAsBlock */ true); + emitConvertedLoopCall(loop, /*emitAsBlock*/ true); } else { - emitNormalLoopBody(node, /* emitAsEmbeddedStatement */ true); + emitNormalLoopBody(node, /*emitAsEmbeddedStatement*/ true); } - if (node.statement.kind === 192 /* Block */) { + if (node.statement.kind === 199 /* Block */) { write(" "); } else { @@ -32817,10 +36712,10 @@ var ts; emit(node.expression); write(")"); if (loop) { - emitConvertedLoopCall(loop, /* emitAsBlock */ true); + emitConvertedLoopCall(loop, /*emitAsBlock*/ true); } else { - emitNormalLoopBody(node, /* emitAsEmbeddedStatement */ true); + emitNormalLoopBody(node, /*emitAsEmbeddedStatement*/ true); } } /** @@ -32828,13 +36723,13 @@ var ts; * Returns false if nothing was written - this can happen for source file level variable declarations * in system modules where such variable declarations are hoisted. */ - function tryEmitStartOfVariableDeclarationList(decl, startPos) { + function tryEmitStartOfVariableDeclarationList(decl) { if (shouldHoistVariable(decl, /*checkIfSourceFileLevelDecl*/ true)) { // variables in variable declaration list were already hoisted return false; } - if (convertedLoopState && (ts.getCombinedNodeFlags(decl) & 24576 /* BlockScoped */) === 0) { - // we are inside a converted loop - this can only happen in downlevel scenarios + if (convertedLoopState && (ts.getCombinedNodeFlags(decl) & 3072 /* BlockScoped */) === 0) { + // we are inside a converted loop - this can only happen in downlevel scenarios // record names for all variable declarations for (var _a = 0, _b = decl.declarations; _a < _b.length; _a++) { var varDecl = _b[_a]; @@ -32842,32 +36737,23 @@ var ts; } return false; } - var tokenKind = 102 /* VarKeyword */; + emitStart(decl); if (decl && languageVersion >= 2 /* ES6 */) { if (ts.isLet(decl)) { - tokenKind = 108 /* LetKeyword */; + write("let "); } else if (ts.isConst(decl)) { - tokenKind = 74 /* ConstKeyword */; + write("const "); + } + else { + write("var "); } - } - if (startPos !== undefined) { - emitToken(tokenKind, startPos); - write(" "); } else { - switch (tokenKind) { - case 102 /* VarKeyword */: - write("var "); - break; - case 108 /* LetKeyword */: - write("let "); - break; - case 74 /* ConstKeyword */: - write("const "); - break; - } + write("var "); } + // Note here we specifically dont emit end so that if we are going to emit binding pattern + // we can alter the source map correctly return true; } function emitVariableDeclarationListSkippingUninitializedEntries(list) { @@ -32889,7 +36775,7 @@ var ts; } function shouldConvertLoopBody(node) { return languageVersion < 2 /* ES6 */ && - (resolver.getNodeCheckFlags(node) & 65536 /* LoopWithBlockScopedBindingCapturedInFunction */) !== 0; + (resolver.getNodeCheckFlags(node) & 65536 /* LoopWithCapturedBlockScopedBinding */) !== 0; } function emitLoop(node, loopEmitter) { var shouldConvert = shouldConvertLoopBody(node); @@ -32898,7 +36784,7 @@ var ts; } else { var loop = convertLoopBody(node); - if (node.parent.kind === 207 /* LabeledStatement */) { + if (node.parent.kind === 214 /* LabeledStatement */) { // if parent of the loop was labeled statement - attach the label to loop skipping converted loop body emitLabelAndColon(node.parent); } @@ -32909,34 +36795,31 @@ var ts; var functionName = makeUniqueName("_loop"); var loopInitializer; switch (node.kind) { - case 199 /* ForStatement */: - case 200 /* ForInStatement */: - case 201 /* ForOfStatement */: - if (node.initializer.kind === 212 /* VariableDeclarationList */) { + case 206 /* ForStatement */: + case 207 /* ForInStatement */: + case 208 /* ForOfStatement */: + var initializer = node.initializer; + if (initializer && initializer.kind === 219 /* VariableDeclarationList */) { loopInitializer = node.initializer; } break; } var loopParameters; - if (loopInitializer && (ts.getCombinedNodeFlags(loopInitializer) & 24576 /* BlockScoped */)) { + var loopOutParameters; + if (loopInitializer && (ts.getCombinedNodeFlags(loopInitializer) & 3072 /* BlockScoped */)) { // if loop initializer contains block scoped variables - they should be passed to converted loop body as parameters loopParameters = []; for (var _a = 0, _b = loopInitializer.declarations; _a < _b.length; _a++) { var varDeclaration = _b[_a]; - collectNames(varDeclaration.name); + processVariableDeclaration(varDeclaration.name); } } - var bodyIsBlock = node.statement.kind === 192 /* Block */; + var bodyIsBlock = node.statement.kind === 199 /* Block */; var paramList = loopParameters ? loopParameters.join(", ") : ""; writeLine(); write("var " + functionName + " = function(" + paramList + ")"); - if (!bodyIsBlock) { - write(" {"); - writeLine(); - increaseIndent(); - } var convertedOuterLoopState = convertedLoopState; - convertedLoopState = {}; + convertedLoopState = { loopOutParameters: loopOutParameters }; if (convertedOuterLoopState) { // convertedOuterLoopState !== undefined means that this converted loop is nested in another converted loop. // if outer converted loop has already accumulated some state - pass it through @@ -32945,20 +36828,45 @@ var ts; // use the same name in all nested loops convertedLoopState.argumentsName = convertedOuterLoopState.argumentsName; } + if (convertedOuterLoopState.thisName) { + // outer loop has already used 'this' so we've already have some name to alias it + // use the same name in all nested loops + convertedLoopState.thisName = convertedOuterLoopState.thisName; + } if (convertedOuterLoopState.hoistedLocalVariables) { // we've already collected some non-block scoped variable declarations in enclosing loop // use the same storage in nested loop convertedLoopState.hoistedLocalVariables = convertedOuterLoopState.hoistedLocalVariables; } } - emitEmbeddedStatement(node.statement); - if (!bodyIsBlock) { - decreaseIndent(); - writeLine(); - write("}"); - } - write(";"); + write(" {"); writeLine(); + increaseIndent(); + if (bodyIsBlock) { + emitLines(node.statement.statements); + } + else { + emit(node.statement); + } + writeLine(); + // end of loop body -> copy out parameter + copyLoopOutParameters(convertedLoopState, 1 /* ToOutParameter */, /*emitAsStatements*/ true); + decreaseIndent(); + writeLine(); + write("};"); + writeLine(); + if (loopOutParameters) { + // declare variables to hold out params for loop body + write("var "); + for (var i = 0; i < loopOutParameters.length; i++) { + if (i !== 0) { + write(", "); + } + write(loopOutParameters[i].outParamName); + } + write(";"); + writeLine(); + } if (convertedLoopState.argumentsName) { // if alias for arguments is set if (convertedOuterLoopState) { @@ -32971,6 +36879,21 @@ var ts; writeLine(); } } + if (convertedLoopState.thisName) { + // if alias for this is set + if (convertedOuterLoopState) { + // pass it to outer converted loop + convertedOuterLoopState.thisName = convertedLoopState.thisName; + } + else { + // this is top level converted loop so we need to create an alias for 'this' here + // NOTE: + // if converted loops were all nested in arrow function then we'll always emit '_this' so convertedLoopState.thisName will not be set. + // If it is set this means that all nested loops are not nested in arrow function and it is safe to capture 'this'. + write("var " + convertedLoopState.thisName + " = this;"); + writeLine(); + } + } if (convertedLoopState.hoistedLocalVariables) { // if hoistedLocalVariables !== undefined this means that we've possibly collected some variable declarations to be hoisted later if (convertedOuterLoopState) { @@ -32980,7 +36903,7 @@ var ts; else { // deduplicate and hoist collected variable declarations write("var "); - var seen; + var seen = void 0; for (var _c = 0, _d = convertedLoopState.hoistedLocalVariables; _c < _d.length; _c++) { var id = _d[_c]; // Don't initialize seen unless we have at least one element. @@ -33003,15 +36926,21 @@ var ts; var currentLoopState = convertedLoopState; convertedLoopState = convertedOuterLoopState; return { functionName: functionName, paramList: paramList, state: currentLoopState }; - function collectNames(name) { + function processVariableDeclaration(name) { if (name.kind === 69 /* Identifier */) { - var nameText = isNameOfNestedRedeclaration(name) ? getGeneratedNameForNode(name) : name.text; + var nameText = isNameOfNestedBlockScopedRedeclarationOrCapturedBinding(name) + ? getGeneratedNameForNode(name) + : name.text; loopParameters.push(nameText); + if (resolver.getNodeCheckFlags(name.parent) & 2097152 /* NeedsLoopOutParameter */) { + var reassignedVariable = { originalName: name, outParamName: makeUniqueName("out_" + nameText) }; + (loopOutParameters || (loopOutParameters = [])).push(reassignedVariable); + } } else { for (var _a = 0, _b = name.elements; _a < _b.length; _a++) { var element = _b[_a]; - collectNames(element.name); + processVariableDeclaration(element.name); } } } @@ -33027,7 +36956,7 @@ var ts; if (emitAsEmbeddedStatement) { emitEmbeddedStatement(node.statement); } - else if (node.statement.kind === 192 /* Block */) { + else if (node.statement.kind === 199 /* Block */) { emitLines(node.statement.statements); } else { @@ -33038,6 +36967,28 @@ var ts; convertedLoopState.allowedNonLabeledJumps = saveAllowedNonLabeledJumps; } } + function copyLoopOutParameters(state, copyDirection, emitAsStatements) { + if (state.loopOutParameters) { + for (var _a = 0, _b = state.loopOutParameters; _a < _b.length; _a++) { + var outParam = _b[_a]; + if (copyDirection === 0 /* ToOriginal */) { + emitIdentifier(outParam.originalName); + write(" = " + outParam.outParamName); + } + else { + write(outParam.outParamName + " = "); + emitIdentifier(outParam.originalName); + } + if (emitAsStatements) { + write(";"); + writeLine(); + } + else { + write(", "); + } + } + } + } function emitConvertedLoopCall(loop, emitAsBlock) { if (emitAsBlock) { write(" {"); @@ -33046,7 +36997,8 @@ var ts; } // loop is considered simple if it does not have any return statements or break\continue that transfer control outside of the loop // simple loops are emitted as just 'loop()'; - var isSimpleLoop = !loop.state.nonLocalJumps && + // NOTE: if loop uses only 'continue' it still will be emitted as simple loop + var isSimpleLoop = !(loop.state.nonLocalJumps & ~4 /* Continue */) && !loop.state.labeledNonLocalBreaks && !loop.state.labeledNonLocalContinues; var loopResult = makeUniqueName("state"); @@ -33054,6 +37006,8 @@ var ts; write("var " + loopResult + " = "); } write(loop.functionName + "(" + loop.paramList + ");"); + writeLine(); + copyLoopOutParameters(loop.state, 0 /* ToOriginal */, /*emitAsStatements*/ true); if (!isSimpleLoop) { // for non simple loops we need to store result returned from converted loop function and use it to do dispatching // converted loop function can return: @@ -33071,7 +37025,7 @@ var ts; } else { // top level converted loop - return unwrapped value - write("return " + loopResult + ".value"); + write("return " + loopResult + ".value;"); } writeLine(); } @@ -33079,10 +37033,6 @@ var ts; write("if (" + loopResult + " === \"break\") break;"); writeLine(); } - if (loop.state.nonLocalJumps & 4 /* Continue */) { - write("if (" + loopResult + " === \"continue\") continue;"); - writeLine(); - } // in case of labeled breaks emit code that either breaks to some known label inside outer loop or delegates jump decision to outer loop emitDispatchTableForLabeledJumps(loopResult, loop.state, convertedLoopState); } @@ -33097,8 +37047,8 @@ var ts; } write("switch(" + loopResultVariable + ") {"); increaseIndent(); - emitDispatchEntriesForLabeledJumps(currentLoop.labeledNonLocalBreaks, /* isBreak */ true, loopResultVariable, outerLoop); - emitDispatchEntriesForLabeledJumps(currentLoop.labeledNonLocalContinues, /* isBreak */ false, loopResultVariable, outerLoop); + emitDispatchEntriesForLabeledJumps(currentLoop.labeledNonLocalBreaks, /*isBreak*/ true, loopResultVariable, outerLoop); + emitDispatchEntriesForLabeledJumps(currentLoop.labeledNonLocalContinues, /*isBreak*/ false, loopResultVariable, outerLoop); decreaseIndent(); writeLine(); write("}"); @@ -33113,7 +37063,7 @@ var ts; write("case \"" + labelMarker + "\": "); // if there are no outer converted loop or outer label in question is located inside outer converted loop // then emit labeled break\continue - // otherwise propagate pair 'label -> marker' to outer converted loop and emit 'return labelMarker' so outer loop can later decide what to do + // otherwise propagate pair 'label -> marker' to outer converted loop and emit 'return labelMarker' so outer loop can later decide what to do if (!outerLoop || (outerLoop.labels && outerLoop.labels[labelText])) { if (isBreak) { write("break "); @@ -33137,9 +37087,9 @@ var ts; var endPos = emitToken(86 /* ForKeyword */, node.pos); write(" "); endPos = emitToken(17 /* OpenParenToken */, endPos); - if (node.initializer && node.initializer.kind === 212 /* VariableDeclarationList */) { + if (node.initializer && node.initializer.kind === 219 /* VariableDeclarationList */) { var variableDeclarationList = node.initializer; - var startIsEmitted = tryEmitStartOfVariableDeclarationList(variableDeclarationList, endPos); + var startIsEmitted = tryEmitStartOfVariableDeclarationList(variableDeclarationList); if (startIsEmitted) { emitCommaList(variableDeclarationList.declarations); } @@ -33156,14 +37106,14 @@ var ts; emitOptional(" ", node.incrementor); write(")"); if (loop) { - emitConvertedLoopCall(loop, /* emitAsBlock */ true); + emitConvertedLoopCall(loop, /*emitAsBlock*/ true); } else { - emitNormalLoopBody(node, /* emitAsEmbeddedStatement */ true); + emitNormalLoopBody(node, /*emitAsEmbeddedStatement*/ true); } } function emitForInOrForOfStatement(node) { - if (languageVersion < 2 /* ES6 */ && node.kind === 201 /* ForOfStatement */) { + if (languageVersion < 2 /* ES6 */ && node.kind === 208 /* ForOfStatement */) { emitLoop(node, emitDownLevelForOfStatementWorker); } else { @@ -33174,17 +37124,17 @@ var ts; var endPos = emitToken(86 /* ForKeyword */, node.pos); write(" "); endPos = emitToken(17 /* OpenParenToken */, endPos); - if (node.initializer.kind === 212 /* VariableDeclarationList */) { + if (node.initializer.kind === 219 /* VariableDeclarationList */) { var variableDeclarationList = node.initializer; if (variableDeclarationList.declarations.length >= 1) { - tryEmitStartOfVariableDeclarationList(variableDeclarationList, endPos); + tryEmitStartOfVariableDeclarationList(variableDeclarationList); emit(variableDeclarationList.declarations[0]); } } else { emit(node.initializer); } - if (node.kind === 200 /* ForInStatement */) { + if (node.kind === 207 /* ForInStatement */) { write(" in "); } else { @@ -33193,15 +37143,12 @@ var ts; emit(node.expression); emitToken(18 /* CloseParenToken */, node.expression.end); if (loop) { - emitConvertedLoopCall(loop, /* emitAsBlock */ true); + emitConvertedLoopCall(loop, /*emitAsBlock*/ true); } else { - emitNormalLoopBody(node, /* emitAsEmbeddedStatement */ true); + emitNormalLoopBody(node, /*emitAsEmbeddedStatement*/ true); } } - function emitDownLevelForOfStatement(node) { - emitLoop(node, emitDownLevelForOfStatementWorker); - } function emitDownLevelForOfStatementWorker(node, loop) { // The following ES6 code: // @@ -33256,18 +37203,18 @@ var ts; emitEnd(node.expression); write("; "); // _i < _a.length; - emitStart(node.initializer); + emitStart(node.expression); emitNodeWithoutSourceMap(counter); write(" < "); emitNodeWithCommentsAndWithoutSourcemap(rhsReference); write(".length"); - emitEnd(node.initializer); + emitEnd(node.expression); write("; "); // _i++) - emitStart(node.initializer); + emitStart(node.expression); emitNodeWithoutSourceMap(counter); write("++"); - emitEnd(node.initializer); + emitEnd(node.expression); emitToken(18 /* CloseParenToken */, node.expression.end); // Body write(" {"); @@ -33277,7 +37224,7 @@ var ts; // let v = _a[_i]; var rhsIterationValue = createElementAccessExpression(rhsReference, counter); emitStart(node.initializer); - if (node.initializer.kind === 212 /* VariableDeclarationList */) { + if (node.initializer.kind === 219 /* VariableDeclarationList */) { write("var "); var variableDeclarationList = node.initializer; if (variableDeclarationList.declarations.length > 0) { @@ -33307,7 +37254,7 @@ var ts; // Initializer is an expression. Emit the expression in the body, so that it's // evaluated on every iteration. var assignmentExpression = createBinaryExpression(node.initializer, 56 /* EqualsToken */, rhsIterationValue, /*startsOnNewLine*/ false); - if (node.initializer.kind === 164 /* ArrayLiteralExpression */ || node.initializer.kind === 165 /* ObjectLiteralExpression */) { + if (node.initializer.kind === 170 /* ArrayLiteralExpression */ || node.initializer.kind === 171 /* ObjectLiteralExpression */) { // This is a destructuring pattern, so call emitDestructuring instead of emit. Calling emit will not work, because it will cause // the BinaryExpression to be passed in instead of the expression statement, which will cause emitDestructuring to crash. emitDestructuring(assignmentExpression, /*isAssignmentExpressionStatement*/ true, /*value*/ undefined); @@ -33320,10 +37267,10 @@ var ts; write(";"); if (loop) { writeLine(); - emitConvertedLoopCall(loop, /* emitAsBlock */ false); + emitConvertedLoopCall(loop, /*emitAsBlock*/ false); } else { - emitNormalLoopBody(node, /* emitAsEmbeddedStatement */ false); + emitNormalLoopBody(node, /*emitAsEmbeddedStatement*/ false); } writeLine(); decreaseIndent(); @@ -33335,36 +37282,40 @@ var ts; // it is possible if either // - break\continue is statement labeled and label is located inside the converted loop // - break\continue is non-labeled and located in non-converted loop\switch statement - var jump = node.kind === 203 /* BreakStatement */ ? 2 /* Break */ : 4 /* Continue */; + var jump = node.kind === 210 /* BreakStatement */ ? 2 /* Break */ : 4 /* Continue */; var canUseBreakOrContinue = (node.label && convertedLoopState.labels && convertedLoopState.labels[node.label.text]) || (!node.label && (convertedLoopState.allowedNonLabeledJumps & jump)); if (!canUseBreakOrContinue) { + write("return "); + // explicit exit from loop -> copy out parameters + copyLoopOutParameters(convertedLoopState, 1 /* ToOutParameter */, /*emitAsStatements*/ false); if (!node.label) { - if (node.kind === 203 /* BreakStatement */) { + if (node.kind === 210 /* BreakStatement */) { convertedLoopState.nonLocalJumps |= 2 /* Break */; - write("return \"break\";"); + write("\"break\";"); } else { convertedLoopState.nonLocalJumps |= 4 /* Continue */; - write("return \"continue\";"); + // note: return value is emitted only to simplify debugging, call to converted loop body does not do any dispatching on it. + write("\"continue\";"); } } else { - var labelMarker; - if (node.kind === 203 /* BreakStatement */) { + var labelMarker = void 0; + if (node.kind === 210 /* BreakStatement */) { labelMarker = "break-" + node.label.text; - setLabeledJump(convertedLoopState, /* isBreak */ true, node.label.text, labelMarker); + setLabeledJump(convertedLoopState, /*isBreak*/ true, node.label.text, labelMarker); } else { labelMarker = "continue-" + node.label.text; - setLabeledJump(convertedLoopState, /* isBreak */ false, node.label.text, labelMarker); + setLabeledJump(convertedLoopState, /*isBreak*/ false, node.label.text, labelMarker); } - write("return \"" + labelMarker + "\";"); + write("\"" + labelMarker + "\";"); } return; } } - emitToken(node.kind === 203 /* BreakStatement */ ? 70 /* BreakKeyword */ : 75 /* ContinueKeyword */, node.pos); + emitToken(node.kind === 210 /* BreakStatement */ ? 70 /* BreakKeyword */ : 75 /* ContinueKeyword */, node.pos); emitOptional(" ", node.label); write(";"); } @@ -33430,7 +37381,7 @@ var ts; ts.getLineOfLocalPositionFromLineMap(currentLineMap, ts.skipTrivia(currentText, node2.pos)); } function emitCaseOrDefaultClause(node) { - if (node.kind === 241 /* CaseClause */) { + if (node.kind === 249 /* CaseClause */) { write("case "); emit(node.expression); write(":"); @@ -33499,7 +37450,7 @@ var ts; function getContainingModule(node) { do { node = node.parent; - } while (node && node.kind !== 218 /* ModuleDeclaration */); + } while (node && node.kind !== 225 /* ModuleDeclaration */); return node; } function emitContainingModuleName(node) { @@ -33508,13 +37459,13 @@ var ts; } function emitModuleMemberName(node) { emitStart(node.name); - if (ts.getCombinedNodeFlags(node) & 2 /* Export */) { + if (ts.getCombinedNodeFlags(node) & 1 /* Export */) { var container = getContainingModule(node); if (container) { write(getGeneratedNameForNode(container)); write("."); } - else if (modulekind !== 5 /* ES6 */ && modulekind !== 4 /* System */) { + else if (modulekind !== ts.ModuleKind.ES6 && modulekind !== ts.ModuleKind.System) { write("exports."); } } @@ -33524,22 +37475,22 @@ var ts; function createVoidZero() { var zero = ts.createSynthesizedNode(8 /* NumericLiteral */); zero.text = "0"; - var result = ts.createSynthesizedNode(177 /* VoidExpression */); + var result = ts.createSynthesizedNode(183 /* VoidExpression */); result.expression = zero; return result; } function emitEs6ExportDefaultCompat(node) { - if (node.parent.kind === 248 /* SourceFile */) { - ts.Debug.assert(!!(node.flags & 512 /* Default */) || node.kind === 227 /* ExportAssignment */); + if (node.parent.kind === 256 /* SourceFile */) { + ts.Debug.assert(!!(node.flags & 512 /* Default */) || node.kind === 235 /* ExportAssignment */); // only allow export default at a source file level - if (modulekind === 1 /* CommonJS */ || modulekind === 2 /* AMD */ || modulekind === 3 /* UMD */) { + if (modulekind === ts.ModuleKind.CommonJS || modulekind === ts.ModuleKind.AMD || modulekind === ts.ModuleKind.UMD) { if (!isEs6Module) { - if (languageVersion === 1 /* ES5 */) { + if (languageVersion !== 0 /* ES3 */) { // default value of configurable, enumerable, writable are `false`. - write("Object.defineProperty(exports, \"__esModule\", { value: true });"); + write('Object.defineProperty(exports, "__esModule", { value: true });'); writeLine(); } - else if (languageVersion === 0 /* ES3 */) { + else { write("exports.__esModule = true;"); writeLine(); } @@ -33548,11 +37499,11 @@ var ts; } } function emitExportMemberAssignment(node) { - if (node.flags & 2 /* Export */) { + if (node.flags & 1 /* Export */) { writeLine(); emitStart(node); // emit call to exporter only for top level nodes - if (modulekind === 4 /* System */ && node.parent === currentSourceFile) { + if (modulekind === ts.ModuleKind.System && node.parent === currentSourceFile) { // emit export default as // export("default", ) write(exportFunctionForFile + "(\""); @@ -33570,7 +37521,7 @@ var ts; if (node.flags & 512 /* Default */) { emitEs6ExportDefaultCompat(node); if (languageVersion === 0 /* ES3 */) { - write("exports[\"default\"]"); + write('exports["default"]'); } else { write("exports.default"); @@ -33587,7 +37538,7 @@ var ts; } } function emitExportMemberAssignments(name) { - if (modulekind === 4 /* System */) { + if (modulekind === ts.ModuleKind.System) { return; } if (!exportEquals && exportSpecifiers && ts.hasProperty(exportSpecifiers, name.text)) { @@ -33606,7 +37557,7 @@ var ts; } } function emitExportSpecifierInSystemModule(specifier) { - ts.Debug.assert(modulekind === 4 /* System */); + ts.Debug.assert(modulekind === ts.ModuleKind.System); if (!resolver.getReferencedValueDeclaration(specifier.propertyName || specifier.name) && !resolver.isValueAliasDeclaration(specifier)) { return; } @@ -33626,7 +37577,7 @@ var ts; * @param value an expression as a right-hand-side operand of the assignment * @param shouldEmitCommaBeforeAssignment a boolean indicating whether to prefix an assignment with comma */ - function emitAssignment(name, value, shouldEmitCommaBeforeAssignment) { + function emitAssignment(name, value, shouldEmitCommaBeforeAssignment, nodeForSourceMap) { if (shouldEmitCommaBeforeAssignment) { write(", "); } @@ -33636,15 +37587,21 @@ var ts; emitNodeWithCommentsAndWithoutSourcemap(name); write("\", "); } - var isVariableDeclarationOrBindingElement = name.parent && (name.parent.kind === 211 /* VariableDeclaration */ || name.parent.kind === 163 /* BindingElement */); - if (isVariableDeclarationOrBindingElement) { - emitModuleMemberName(name.parent); - } - else { - emit(name); - } - write(" = "); - emit(value); + var isVariableDeclarationOrBindingElement = name.parent && (name.parent.kind === 218 /* VariableDeclaration */ || name.parent.kind === 169 /* BindingElement */); + // If this is first var declaration, we need to start at var/let/const keyword instead + // otherwise use nodeForSourceMap as the start position + emitStart(isFirstVariableDeclaration(nodeForSourceMap) ? nodeForSourceMap.parent : nodeForSourceMap); + withTemporaryNoSourceMap(function () { + if (isVariableDeclarationOrBindingElement) { + emitModuleMemberName(name.parent); + } + else { + emit(name); + } + write(" = "); + emit(value); + }); + emitEnd(nodeForSourceMap, /*stopOverridingSpan*/ true); if (exportChanged) { write(")"); } @@ -33655,14 +37612,19 @@ var ts; * @param canDefineTempVariablesInPlace a boolean indicating whether you can define the temporary variable at an assignment location * @param shouldEmitCommaBeforeAssignment a boolean indicating whether an assignment should prefix with comma */ - function emitTempVariableAssignment(expression, canDefineTempVariablesInPlace, shouldEmitCommaBeforeAssignment) { + function emitTempVariableAssignment(expression, canDefineTempVariablesInPlace, shouldEmitCommaBeforeAssignment, sourceMapNode) { var identifier = createTempVariable(0 /* Auto */); if (!canDefineTempVariablesInPlace) { recordTempDeclaration(identifier); } - emitAssignment(identifier, expression, shouldEmitCommaBeforeAssignment); + emitAssignment(identifier, expression, shouldEmitCommaBeforeAssignment, sourceMapNode || expression.parent); return identifier; } + function isFirstVariableDeclaration(root) { + return root.kind === 218 /* VariableDeclaration */ && + root.parent.kind === 219 /* VariableDeclarationList */ && + root.parent.declarations[0] === root; + } function emitDestructuring(root, isAssignmentExpressionStatement, value) { var emitCount = 0; // An exported declaration is actually emitted as an assignment (to a property on the module object), so @@ -33670,19 +37632,24 @@ var ts; // Also temporary variables should be explicitly allocated for source level declarations when module target is system // because actual variable declarations are hoisted var canDefineTempVariablesInPlace = false; - if (root.kind === 211 /* VariableDeclaration */) { - var isExported = ts.getCombinedNodeFlags(root) & 2 /* Export */; + if (root.kind === 218 /* VariableDeclaration */) { + var isExported = ts.getCombinedNodeFlags(root) & 1 /* Export */; var isSourceLevelForSystemModuleKind = shouldHoistDeclarationInSystemJsModule(root); canDefineTempVariablesInPlace = !isExported && !isSourceLevelForSystemModuleKind; } - else if (root.kind === 138 /* Parameter */) { + else if (root.kind === 142 /* Parameter */) { canDefineTempVariablesInPlace = true; } - if (root.kind === 181 /* BinaryExpression */) { + if (root.kind === 187 /* BinaryExpression */) { emitAssignmentExpression(root); } else { ts.Debug.assert(!isAssignmentExpressionStatement); + // If first variable declaration of variable statement correct the start location + if (isFirstVariableDeclaration(root)) { + // Use emit location of "var " as next emit start entry + sourceMap.changeEmitSourcePos(); + } emitBindingElement(root, value); } /** @@ -33694,27 +37661,28 @@ var ts; * @param reuseIdentifierExpressions true if identifier expressions can simply be returned; * false if it is necessary to always emit an identifier. */ - function ensureIdentifier(expr, reuseIdentifierExpressions) { + function ensureIdentifier(expr, reuseIdentifierExpressions, sourceMapNode) { if (expr.kind === 69 /* Identifier */ && reuseIdentifierExpressions) { return expr; } - var identifier = emitTempVariableAssignment(expr, canDefineTempVariablesInPlace, emitCount > 0); + var identifier = emitTempVariableAssignment(expr, canDefineTempVariablesInPlace, emitCount > 0, sourceMapNode); emitCount++; return identifier; } - function createDefaultValueCheck(value, defaultValue) { + function createDefaultValueCheck(value, defaultValue, sourceMapNode) { // The value expression will be evaluated twice, so for anything but a simple identifier // we need to generate a temporary variable - value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true); + // If the temporary variable needs to be emitted use the source Map node for assignment of that statement + value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true, sourceMapNode); // Return the expression 'value === void 0 ? defaultValue : value' - var equals = ts.createSynthesizedNode(181 /* BinaryExpression */); + var equals = ts.createSynthesizedNode(187 /* BinaryExpression */); equals.left = value; equals.operatorToken = ts.createSynthesizedNode(32 /* EqualsEqualsEqualsToken */); equals.right = createVoidZero(); return createConditionalExpression(equals, defaultValue, value); } function createConditionalExpression(condition, whenTrue, whenFalse) { - var cond = ts.createSynthesizedNode(182 /* ConditionalExpression */); + var cond = ts.createSynthesizedNode(188 /* ConditionalExpression */); cond.condition = condition; cond.questionToken = ts.createSynthesizedNode(53 /* QuestionToken */); cond.whenTrue = whenTrue; @@ -33729,22 +37697,27 @@ var ts; } function createPropertyAccessForDestructuringProperty(object, propName) { var index; - var nameIsComputed = propName.kind === 136 /* ComputedPropertyName */; + var nameIsComputed = propName.kind === 140 /* ComputedPropertyName */; if (nameIsComputed) { - index = ensureIdentifier(propName.expression, /* reuseIdentifierExpression */ false); + // TODO to handle when we look into sourcemaps for computed properties, for now use propName + index = ensureIdentifier(propName.expression, /*reuseIdentifierExpressions*/ false, propName); } else { // We create a synthetic copy of the identifier in order to avoid the rewriting that might // otherwise occur when the identifier is emitted. index = ts.createSynthesizedNode(propName.kind); - index.text = propName.text; + // We need to unescape identifier here because when parsing an identifier prefixing with "__" + // the parser need to append "_" in order to escape colliding with magic identifiers such as "__proto__" + // Therefore, in order to correctly emit identifiers that are written in original TypeScript file, + // we will unescapeIdentifier to remove additional underscore (if no underscore is added, the function will return original input string) + index.text = ts.unescapeIdentifier(propName.text); } return !nameIsComputed && index.kind === 69 /* Identifier */ ? createPropertyAccessExpression(object, index) : createElementAccessExpression(object, index); } function createSliceCall(value, sliceIndex) { - var call = ts.createSynthesizedNode(168 /* CallExpression */); + var call = ts.createSynthesizedNode(174 /* CallExpression */); var sliceIdentifier = ts.createSynthesizedNode(69 /* Identifier */); sliceIdentifier.text = "slice"; call.expression = createPropertyAccessExpression(value, sliceIdentifier); @@ -33752,60 +37725,65 @@ var ts; call.arguments[0] = createNumericLiteral(sliceIndex); return call; } - function emitObjectLiteralAssignment(target, value) { + function emitObjectLiteralAssignment(target, value, sourceMapNode) { var properties = target.properties; if (properties.length !== 1) { // For anything but a single element destructuring we need to generate a temporary // to ensure value is evaluated exactly once. - value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true); + // When doing so we want to highlight the passed in source map node since thats the one needing this temp assignment + value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true, sourceMapNode); } for (var _a = 0, properties_5 = properties; _a < properties_5.length; _a++) { var p = properties_5[_a]; - if (p.kind === 245 /* PropertyAssignment */ || p.kind === 246 /* ShorthandPropertyAssignment */) { + if (p.kind === 253 /* PropertyAssignment */ || p.kind === 254 /* ShorthandPropertyAssignment */) { var propName = p.name; - var target_1 = p.kind === 246 /* ShorthandPropertyAssignment */ ? p : p.initializer || propName; - emitDestructuringAssignment(target_1, createPropertyAccessForDestructuringProperty(value, propName)); + var target_1 = p.kind === 254 /* ShorthandPropertyAssignment */ ? p : p.initializer || propName; + // Assignment for target = value.propName should highlight whole property, hence use p as source map node + emitDestructuringAssignment(target_1, createPropertyAccessForDestructuringProperty(value, propName), p); } } } - function emitArrayLiteralAssignment(target, value) { + function emitArrayLiteralAssignment(target, value, sourceMapNode) { var elements = target.elements; if (elements.length !== 1) { // For anything but a single element destructuring we need to generate a temporary // to ensure value is evaluated exactly once. - value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true); + // When doing so we want to highlight the passed in source map node since thats the one needing this temp assignment + value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true, sourceMapNode); } for (var i = 0; i < elements.length; i++) { var e = elements[i]; - if (e.kind !== 187 /* OmittedExpression */) { - if (e.kind !== 185 /* SpreadElementExpression */) { - emitDestructuringAssignment(e, createElementAccessExpression(value, createNumericLiteral(i))); + if (e.kind !== 193 /* OmittedExpression */) { + // Assignment for target = value.propName should highlight whole property, hence use e as source map node + if (e.kind !== 191 /* SpreadElementExpression */) { + emitDestructuringAssignment(e, createElementAccessExpression(value, createNumericLiteral(i)), e); } else if (i === elements.length - 1) { - emitDestructuringAssignment(e.expression, createSliceCall(value, i)); + emitDestructuringAssignment(e.expression, createSliceCall(value, i), e); } } } } - function emitDestructuringAssignment(target, value) { - if (target.kind === 246 /* ShorthandPropertyAssignment */) { + function emitDestructuringAssignment(target, value, sourceMapNode) { + // When emitting target = value use source map node to highlight, including any temporary assignments needed for this + if (target.kind === 254 /* ShorthandPropertyAssignment */) { if (target.objectAssignmentInitializer) { - value = createDefaultValueCheck(value, target.objectAssignmentInitializer); + value = createDefaultValueCheck(value, target.objectAssignmentInitializer, sourceMapNode); } target = target.name; } - else if (target.kind === 181 /* BinaryExpression */ && target.operatorToken.kind === 56 /* EqualsToken */) { - value = createDefaultValueCheck(value, target.right); + else if (target.kind === 187 /* BinaryExpression */ && target.operatorToken.kind === 56 /* EqualsToken */) { + value = createDefaultValueCheck(value, target.right, sourceMapNode); target = target.left; } - if (target.kind === 165 /* ObjectLiteralExpression */) { - emitObjectLiteralAssignment(target, value); + if (target.kind === 171 /* ObjectLiteralExpression */) { + emitObjectLiteralAssignment(target, value, sourceMapNode); } - else if (target.kind === 164 /* ArrayLiteralExpression */) { - emitArrayLiteralAssignment(target, value); + else if (target.kind === 170 /* ArrayLiteralExpression */) { + emitArrayLiteralAssignment(target, value, sourceMapNode); } else { - emitAssignment(target, value, /*shouldEmitCommaBeforeAssignment*/ emitCount > 0); + emitAssignment(target, value, /*shouldEmitCommaBeforeAssignment*/ emitCount > 0, sourceMapNode); emitCount++; } } @@ -33816,25 +37794,32 @@ var ts; emit(value); } else if (isAssignmentExpressionStatement) { - emitDestructuringAssignment(target, value); + // Source map node for root.left = root.right is root + // but if root is synthetic, which could be in below case, use the target which is { a } + // for ({a} of {a: string}) { + // } + emitDestructuringAssignment(target, value, ts.nodeIsSynthesized(root) ? target : root); } else { - if (root.parent.kind !== 172 /* ParenthesizedExpression */) { + if (root.parent.kind !== 178 /* ParenthesizedExpression */) { write("("); } - value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true); - emitDestructuringAssignment(target, value); + // Temporary assignment needed to emit root should highlight whole binary expression + value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true, root); + // Source map node for root.left = root.right is root + emitDestructuringAssignment(target, value, root); write(", "); emit(value); - if (root.parent.kind !== 172 /* ParenthesizedExpression */) { + if (root.parent.kind !== 178 /* ParenthesizedExpression */) { write(")"); } } } function emitBindingElement(target, value) { + // Any temporary assignments needed to emit target = value should point to target if (target.initializer) { // Combine value and initializer - value = value ? createDefaultValueCheck(value, target.initializer) : target.initializer; + value = value ? createDefaultValueCheck(value, target.initializer, target) : target.initializer; } else if (!value) { // Use 'void 0' in absence of value and initializer @@ -33849,16 +37834,16 @@ var ts; // to ensure value is evaluated exactly once. Additionally, if we have zero elements // we need to emit *something* to ensure that in case a 'var' keyword was already emitted, // so in that case, we'll intentionally create that temporary. - value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ numElements !== 0); + value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ numElements !== 0, target); } for (var i = 0; i < numElements; i++) { var element = elements[i]; - if (pattern.kind === 161 /* ObjectBindingPattern */) { + if (pattern.kind === 167 /* ObjectBindingPattern */) { // Rewrite element to a declaration with an initializer that fetches property var propName = element.propertyName || element.name; emitBindingElement(element, createPropertyAccessForDestructuringProperty(value, propName)); } - else if (element.kind !== 187 /* OmittedExpression */) { + else if (element.kind !== 193 /* OmittedExpression */) { if (!element.dotDotDotToken) { // Rewrite element to a declaration that accesses array element at index i emitBindingElement(element, createElementAccessExpression(value, createNumericLiteral(i))); @@ -33870,36 +37855,77 @@ var ts; } } else { - emitAssignment(target.name, value, /*shouldEmitCommaBeforeAssignment*/ emitCount > 0); + emitAssignment(target.name, value, /*shouldEmitCommaBeforeAssignment*/ emitCount > 0, target); emitCount++; } } } function emitVariableDeclaration(node) { if (ts.isBindingPattern(node.name)) { - if (languageVersion < 2 /* ES6 */) { - emitDestructuring(node, /*isAssignmentExpressionStatement*/ false); - } - else { + var isExported = ts.getCombinedNodeFlags(node) & 1 /* Export */; + if (languageVersion >= 2 /* ES6 */ && (!isExported || modulekind === ts.ModuleKind.ES6)) { + // emit ES6 destructuring only if target module is ES6 or variable is not exported + // exported variables in CJS/AMD are prefixed with 'exports.' so result javascript { exports.toString } = 1; is illegal + var isTopLevelDeclarationInSystemModule = modulekind === ts.ModuleKind.System && + shouldHoistVariable(node, /*checkIfSourceFileLevelDecl*/ true); + if (isTopLevelDeclarationInSystemModule) { + // In System modules top level variables are hoisted + // so variable declarations with destructuring are turned into destructuring assignments. + // As a result, they will need parentheses to disambiguate object binding assignments from blocks. + write("("); + } emit(node.name); emitOptional(" = ", node.initializer); + if (isTopLevelDeclarationInSystemModule) { + write(")"); + } + } + else { + emitDestructuring(node, /*isAssignmentExpressionStatement*/ false); } } else { var initializer = node.initializer; - if (!initializer && languageVersion < 2 /* ES6 */) { - // downlevel emit for non-initialized let bindings defined in loops - // for (...) { let x; } - // should be - // for (...) { var = void 0; } - // this is necessary to preserve ES6 semantic in scenarios like - // for (...) { let x; console.log(x); x = 1 } // assignment on one iteration should not affect other iterations - var isLetDefinedInLoop = (resolver.getNodeCheckFlags(node) & 16384 /* BlockScopedBindingInLoop */) && - (getCombinedFlagsForIdentifier(node.name) & 8192 /* Let */); - // NOTE: default initialization should not be added to let bindings in for-in\for-of statements - if (isLetDefinedInLoop && - node.parent.parent.kind !== 200 /* ForInStatement */ && - node.parent.parent.kind !== 201 /* ForOfStatement */) { + if (!initializer && + languageVersion < 2 /* ES6 */ && + // for names - binding patterns that lack initializer there is no point to emit explicit initializer + // since downlevel codegen for destructuring will fail in the absence of initializer so all binding elements will say uninitialized + node.name.kind === 69 /* Identifier */) { + var container = ts.getEnclosingBlockScopeContainer(node); + var flags = resolver.getNodeCheckFlags(node); + // nested let bindings might need to be initialized explicitly to preserve ES6 semantic + // { let x = 1; } + // { let x; } // x here should be undefined. not 1 + // NOTES: + // Top level bindings never collide with anything and thus don't require explicit initialization. + // As for nested let bindings there are two cases: + // - nested let bindings that were not renamed definitely should be initialized explicitly + // { let x = 1; } + // { let x; if (some-condition) { x = 1}; if (x) { /*1*/ } } + // Without explicit initialization code in /*1*/ can be executed even if some-condition is evaluated to false + // - renaming introduces fresh name that should not collide with any existing names, however renamed bindings sometimes also should be + // explicitly initialized. One particular case: non-captured binding declared inside loop body (but not in loop initializer) + // let x; + // for (;;) { + // let x; + // } + // in downlevel codegen inner 'x' will be renamed so it won't collide with outer 'x' however it will should be reset on every iteration + // as if it was declared anew. + // * Why non-captured binding - because if loop contains block scoped binding captured in some function then loop body will be rewritten + // to have a fresh scope on every iteration so everything will just work. + // * Why loop initializer is excluded - since we've introduced a fresh name it already will be undefined. + var isCapturedInFunction = flags & 131072 /* CapturedBlockScopedBinding */; + var isDeclaredInLoop = flags & 262144 /* BlockScopedBindingInLoop */; + var emittedAsTopLevel = ts.isBlockScopedContainerTopLevel(container) || + (isCapturedInFunction && isDeclaredInLoop && container.kind === 199 /* Block */ && ts.isIterationStatement(container.parent, /*lookInLabeledStatements*/ false)); + var emittedAsNestedLetDeclaration = ts.getCombinedNodeFlags(node) & 1024 /* Let */ && + !emittedAsTopLevel; + var emitExplicitInitializer = emittedAsNestedLetDeclaration && + container.kind !== 207 /* ForInStatement */ && + container.kind !== 208 /* ForOfStatement */ && + (!resolver.isDeclarationWithCollidingName(node) || + (isDeclaredInLoop && !isCapturedInFunction && !ts.isIterationStatement(container, /*lookInLabeledStatements*/ false))); + if (emitExplicitInitializer) { initializer = createVoidZero(); } } @@ -33917,7 +37943,7 @@ var ts; } } function emitExportVariableAssignments(node) { - if (node.kind === 187 /* OmittedExpression */) { + if (node.kind === 193 /* OmittedExpression */) { return; } var name = node.name; @@ -33928,20 +37954,14 @@ var ts; ts.forEach(name.elements, emitExportVariableAssignments); } } - function getCombinedFlagsForIdentifier(node) { - if (!node.parent || (node.parent.kind !== 211 /* VariableDeclaration */ && node.parent.kind !== 163 /* BindingElement */)) { - return 0; - } - return ts.getCombinedNodeFlags(node.parent); - } function isES6ExportedDeclaration(node) { - return !!(node.flags & 2 /* Export */) && - modulekind === 5 /* ES6 */ && - node.parent.kind === 248 /* SourceFile */; + return !!(node.flags & 1 /* Export */) && + modulekind === ts.ModuleKind.ES6 && + node.parent.kind === 256 /* SourceFile */; } function emitVariableStatement(node) { var startIsEmitted = false; - if (node.flags & 2 /* Export */) { + if (node.flags & 1 /* Export */) { if (isES6ExportedDeclaration(node)) { // Exported ES6 module member write("export "); @@ -33961,14 +37981,14 @@ var ts; write(";"); } } - if (modulekind !== 5 /* ES6 */ && node.parent === currentSourceFile) { + if (modulekind !== ts.ModuleKind.ES6 && node.parent === currentSourceFile) { ts.forEach(node.declarationList.declarations, emitExportVariableAssignments); } } function shouldEmitLeadingAndTrailingCommentsForVariableStatement(node) { // If we're not exporting the variables, there's nothing special here. // Always emit comments for these nodes. - if (!(node.flags & 2 /* Export */)) { + if (!(node.flags & 1 /* Export */)) { return true; } // If we are exporting, but it's a top-level ES6 module exports, @@ -33988,12 +38008,12 @@ var ts; function emitParameter(node) { if (languageVersion < 2 /* ES6 */) { if (ts.isBindingPattern(node.name)) { - var name_25 = createTempVariable(0 /* Auto */); + var name_28 = createTempVariable(0 /* Auto */); if (!tempParameters) { tempParameters = []; } - tempParameters.push(name_25); - emit(name_25); + tempParameters.push(name_28); + emit(name_28); } else { emit(node.name); @@ -34009,7 +38029,7 @@ var ts; } function emitDefaultValueAssignments(node) { if (languageVersion < 2 /* ES6 */) { - var tempIndex = 0; + var tempIndex_1 = 0; ts.forEach(node.parameters, function (parameter) { // A rest parameter cannot have a binding pattern or an initializer, // so let's just ignore it. @@ -34026,15 +38046,15 @@ var ts; writeLine(); write("var "); if (hasBindingElements) { - emitDestructuring(parameter, /*isAssignmentExpressionStatement*/ false, tempParameters[tempIndex]); + emitDestructuring(parameter, /*isAssignmentExpressionStatement*/ false, tempParameters[tempIndex_1]); } else { - emit(tempParameters[tempIndex]); + emit(tempParameters[tempIndex_1]); write(" = "); emit(initializer); } write(";"); - tempIndex++; + tempIndex_1++; } } else if (initializer) { @@ -34056,7 +38076,7 @@ var ts; } } function emitRestParameter(node) { - if (languageVersion < 2 /* ES6 */ && ts.hasRestParameter(node)) { + if (languageVersion < 2 /* ES6 */ && ts.hasDeclaredRestParameter(node)) { var restIndex = node.parameters.length - 1; var restParam = node.parameters[restIndex]; // A rest parameter cannot have a binding pattern, so let's just ignore it if it does. @@ -34098,12 +38118,12 @@ var ts; } } function emitAccessor(node) { - write(node.kind === 145 /* GetAccessor */ ? "get " : "set "); + write(node.kind === 149 /* GetAccessor */ ? "get " : "set "); emit(node.name); emitSignatureAndBody(node); } function shouldEmitAsArrowFunction(node) { - return node.kind === 174 /* ArrowFunction */ && languageVersion >= 2 /* ES6 */; + return node.kind === 180 /* ArrowFunction */ && languageVersion >= 2 /* ES6 */; } function emitDeclarationName(node) { if (node.name) { @@ -34114,13 +38134,13 @@ var ts; } } function shouldEmitFunctionName(node) { - if (node.kind === 173 /* FunctionExpression */) { + if (node.kind === 179 /* FunctionExpression */) { // Emit name if one is present return !!node.name; } - if (node.kind === 213 /* FunctionDeclaration */) { + if (node.kind === 220 /* FunctionDeclaration */) { // Emit name if one is present, or emit generated name in down-level case (for export default case) - return !!node.name || languageVersion < 2 /* ES6 */; + return !!node.name || modulekind !== ts.ModuleKind.ES6; } } function emitFunctionDeclaration(node) { @@ -34129,20 +38149,29 @@ var ts; } // TODO (yuisu) : we should not have special cases to condition emitting comments // but have one place to fix check for these conditions. - if (node.kind !== 143 /* MethodDeclaration */ && node.kind !== 142 /* MethodSignature */ && - node.parent && node.parent.kind !== 245 /* PropertyAssignment */ && - node.parent.kind !== 168 /* CallExpression */) { - // 1. Methods will emit the comments as part of emitting method declaration + var kind = node.kind, parent = node.parent; + if (kind !== 147 /* MethodDeclaration */ && + kind !== 146 /* MethodSignature */ && + parent && + parent.kind !== 253 /* PropertyAssignment */ && + parent.kind !== 174 /* CallExpression */ && + parent.kind !== 170 /* ArrayLiteralExpression */) { + // 1. Methods will emit comments at their assignment declaration sites. + // // 2. If the function is a property of object literal, emitting leading-comments - // is done by emitNodeWithoutSourceMap which then call this function. - // In particular, we would like to avoid emit comments twice in following case: - // For example: + // is done by emitNodeWithoutSourceMap which then call this function. + // In particular, we would like to avoid emit comments twice in following case: + // // var obj = { // id: // /*comment*/ () => void // } + // // 3. If the function is an argument in call expression, emitting of comments will be - // taken care of in emit list of arguments inside of emitCallexpression + // taken care of in emit list of arguments inside of 'emitCallExpression'. + // + // 4. If the function is in an array literal, 'emitLinePreservingList' will take care + // of leading comments. emitLeadingComments(node); } emitStart(node); @@ -34165,11 +38194,13 @@ var ts; emitDeclarationName(node); } emitSignatureAndBody(node); - if (modulekind !== 5 /* ES6 */ && node.kind === 213 /* FunctionDeclaration */ && node.parent === currentSourceFile && node.name) { + if (modulekind !== ts.ModuleKind.ES6 && kind === 220 /* FunctionDeclaration */ && parent === currentSourceFile && node.name) { emitExportMemberAssignments(node.name); } emitEnd(node); - if (node.kind !== 143 /* MethodDeclaration */ && node.kind !== 142 /* MethodSignature */) { + if (kind !== 147 /* MethodDeclaration */ && + kind !== 146 /* MethodSignature */ && + kind !== 180 /* ArrowFunction */) { emitTrailingComments(node); } } @@ -34186,8 +38217,9 @@ var ts; write("("); if (node) { var parameters = node.parameters; - var omitCount = languageVersion < 2 /* ES6 */ && ts.hasRestParameter(node) ? 1 : 0; - emitList(parameters, 0, parameters.length - omitCount, /*multiLine*/ false, /*trailingComma*/ false); + var skipCount = node.parameters.length && node.parameters[0].name.text === "this" ? 1 : 0; + var omitCount = languageVersion < 2 /* ES6 */ && ts.hasDeclaredRestParameter(node) ? 1 : 0; + emitList(parameters, skipCount, parameters.length - omitCount - skipCount, /*multiLine*/ false, /*trailingComma*/ false); } write(")"); decreaseIndent(); @@ -34202,8 +38234,8 @@ var ts; } function emitAsyncFunctionBodyForES6(node) { var promiseConstructor = ts.getEntityNameFromTypeNode(node.type); - var isArrowFunction = node.kind === 174 /* ArrowFunction */; - var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 4096 /* CaptureArguments */) !== 0; + var isArrowFunction = node.kind === 180 /* ArrowFunction */; + var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 8192 /* CaptureArguments */) !== 0; // An async function is emit as an outer function that calls an inner // generator function. To preserve lexical bindings, we pass the current // `this` and `arguments` objects to `__awaiter`. The generator function @@ -34281,29 +38313,31 @@ var ts; write(" {"); increaseIndent(); writeLine(); + if (resolver.getNodeCheckFlags(node) & 4096 /* AsyncMethodWithSuperBinding */) { + writeLines("\nconst _super = (function (geti, seti) {\n const cache = Object.create(null);\n return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });\n})(name => super[name], (name, value) => super[name] = value);"); + writeLine(); + } + else if (resolver.getNodeCheckFlags(node) & 2048 /* AsyncMethodWithSuper */) { + write("const _super = name => super[name];"); + writeLine(); + } write("return"); } write(" __awaiter(this"); if (hasLexicalArguments) { - write(", arguments"); + write(", arguments, "); } else { - write(", void 0"); + write(", void 0, "); } - if (promiseConstructor) { - write(", "); - emitNodeWithoutSourceMap(promiseConstructor); + if (languageVersion >= 2 /* ES6 */ || !promiseConstructor) { + write("void 0"); } else { - write(", Promise"); + emitEntityNameAsExpression(promiseConstructor, /*useFallback*/ false); } // Emit the call to __awaiter. - if (hasLexicalArguments) { - write(", function* (_arguments)"); - } - else { - write(", function* ()"); - } + write(", function* ()"); // Emit the signature and body for the inner generator function. emitFunctionBody(node); write(")"); @@ -34322,7 +38356,7 @@ var ts; write(" { }"); } else { - if (node.body.kind === 192 /* Block */) { + if (node.body.kind === 199 /* Block */) { emitBlockFunctionBody(node, node.body); } else { @@ -34348,7 +38382,7 @@ var ts; emitSignatureParameters(node); } var isAsync = ts.isAsyncFunctionLike(node); - if (isAsync && languageVersion === 2 /* ES6 */) { + if (isAsync) { emitAsyncFunctionBodyForES6(node); } else { @@ -34381,14 +38415,13 @@ var ts; write(" "); // Unwrap all type assertions. var current = body; - while (current.kind === 171 /* TypeAssertionExpression */) { + while (current.kind === 177 /* TypeAssertionExpression */) { current = current.expression; } - emitParenthesizedIf(body, current.kind === 165 /* ObjectLiteralExpression */); + emitParenthesizedIf(body, current.kind === 171 /* ObjectLiteralExpression */); } function emitDownLevelExpressionFunctionBody(node, body) { write(" {"); - scopeEmitStart(node); increaseIndent(); var outPos = writer.getTextPos(); emitDetachedCommentsAndUpdateCommentsInfo(node.body); @@ -34411,8 +38444,10 @@ var ts; increaseIndent(); writeLine(); emitLeadingComments(node.body); + emitStart(body); write("return "); emit(body); + emitEnd(body); write(";"); emitTrailingComments(node.body); emitTempDeclarations(/*newLine*/ true); @@ -34422,11 +38457,9 @@ var ts; emitStart(node.body); write("}"); emitEnd(node.body); - scopeEmitEnd(); } function emitBlockFunctionBody(node, body) { write(" {"); - scopeEmitStart(node); var initialTextPos = writer.getTextPos(); increaseIndent(); emitDetachedCommentsAndUpdateCommentsInfo(body.statements); @@ -34455,25 +38488,28 @@ var ts; decreaseIndent(); } emitToken(16 /* CloseBraceToken */, body.statements.end); - scopeEmitEnd(); } - function findInitialSuperCall(ctor) { - if (ctor.body) { - var statement = ctor.body.statements[0]; - if (statement && statement.kind === 195 /* ExpressionStatement */) { - var expr = statement.expression; - if (expr && expr.kind === 168 /* CallExpression */) { - var func = expr.expression; - if (func && func.kind === 95 /* SuperKeyword */) { - return statement; - } - } - } + /** + * Return the statement at a given index if it is a super-call statement + * @param ctor a constructor declaration + * @param index an index to constructor's body to check + */ + function getSuperCallAtGivenIndex(ctor, index) { + if (!ctor.body) { + return undefined; + } + var statements = ctor.body.statements; + if (!statements || index >= statements.length) { + return undefined; + } + var statement = statements[index]; + if (statement.kind === 202 /* ExpressionStatement */) { + return ts.isSuperCallExpression(statement.expression) ? statement : undefined; } } function emitParameterPropertyAssignments(node) { ts.forEach(node.parameters, function (param) { - if (param.flags & 56 /* AccessibilityModifier */) { + if (param.flags & 92 /* ParameterPropertyModifier */) { writeLine(); emitStart(param); emitStart(param.name); @@ -34496,7 +38532,7 @@ var ts; emitNodeWithCommentsAndWithoutSourcemap(memberName); write("]"); } - else if (memberName.kind === 136 /* ComputedPropertyName */) { + else if (memberName.kind === 140 /* ComputedPropertyName */) { emitComputedPropertyName(memberName); } else { @@ -34508,7 +38544,7 @@ var ts; var properties = []; for (var _a = 0, _b = node.members; _a < _b.length; _a++) { var member = _b[_a]; - if (member.kind === 141 /* PropertyDeclaration */ && isStatic === ((member.flags & 64 /* Static */) !== 0) && member.initializer) { + if (member.kind === 145 /* PropertyDeclaration */ && isStatic === ((member.flags & 32 /* Static */) !== 0) && member.initializer) { properties.push(member); } } @@ -34529,7 +38565,7 @@ var ts; emit(receiver); } else { - if (property.flags & 64 /* Static */) { + if (property.flags & 32 /* Static */) { emitDeclarationName(node); } else { @@ -34548,11 +38584,11 @@ var ts; } function emitMemberFunctionsForES5AndLower(node) { ts.forEach(node.members, function (member) { - if (member.kind === 191 /* SemicolonClassElement */) { + if (member.kind === 198 /* SemicolonClassElement */) { writeLine(); write(";"); } - else if (member.kind === 143 /* MethodDeclaration */ || node.kind === 142 /* MethodSignature */) { + else if (member.kind === 147 /* MethodDeclaration */ || node.kind === 146 /* MethodSignature */) { if (!member.body) { return emitCommentsOnNotEmittedNode(member); } @@ -34569,7 +38605,7 @@ var ts; write(";"); emitTrailingComments(member); } - else if (member.kind === 145 /* GetAccessor */ || member.kind === 146 /* SetAccessor */) { + else if (member.kind === 149 /* GetAccessor */ || member.kind === 150 /* SetAccessor */) { var accessors = ts.getAllAccessorDeclarations(node.members, member); if (member === accessors.firstAccessor) { writeLine(); @@ -34619,22 +38655,22 @@ var ts; function emitMemberFunctionsForES6AndHigher(node) { for (var _a = 0, _b = node.members; _a < _b.length; _a++) { var member = _b[_a]; - if ((member.kind === 143 /* MethodDeclaration */ || node.kind === 142 /* MethodSignature */) && !member.body) { + if ((member.kind === 147 /* MethodDeclaration */ || node.kind === 146 /* MethodSignature */) && !member.body) { emitCommentsOnNotEmittedNode(member); } - else if (member.kind === 143 /* MethodDeclaration */ || - member.kind === 145 /* GetAccessor */ || - member.kind === 146 /* SetAccessor */) { + else if (member.kind === 147 /* MethodDeclaration */ || + member.kind === 149 /* GetAccessor */ || + member.kind === 150 /* SetAccessor */) { writeLine(); emitLeadingComments(member); emitStart(member); - if (member.flags & 64 /* Static */) { + if (member.flags & 32 /* Static */) { write("static "); } - if (member.kind === 145 /* GetAccessor */) { + if (member.kind === 149 /* GetAccessor */) { write("get "); } - else if (member.kind === 146 /* SetAccessor */) { + else if (member.kind === 150 /* SetAccessor */) { write("set "); } if (member.asteriskToken) { @@ -34645,7 +38681,7 @@ var ts; emitEnd(member); emitTrailingComments(member); } - else if (member.kind === 191 /* SemicolonClassElement */) { + else if (member.kind === 198 /* SemicolonClassElement */) { writeLine(); write(";"); } @@ -34674,11 +38710,11 @@ var ts; var hasInstancePropertyWithInitializer = false; // Emit the constructor overload pinned comments ts.forEach(node.members, function (member) { - if (member.kind === 144 /* Constructor */ && !member.body) { + if (member.kind === 148 /* Constructor */ && !member.body) { emitCommentsOnNotEmittedNode(member); } // Check if there is any non-static property assignment - if (member.kind === 141 /* PropertyDeclaration */ && member.initializer && (member.flags & 64 /* Static */) === 0) { + if (member.kind === 145 /* PropertyDeclaration */ && member.initializer && (member.flags & 32 /* Static */) === 0) { hasInstancePropertyWithInitializer = true; } }); @@ -34719,7 +38755,6 @@ var ts; } var startIndex = 0; write(" {"); - scopeEmitStart(node, "constructor"); increaseIndent(); if (ctor) { // Emit all the directive prologues (like "use strict"). These have to come before @@ -34733,7 +38768,7 @@ var ts; emitDefaultValueAssignments(ctor); emitRestParameter(ctor); if (baseTypeElement) { - superCall = findInitialSuperCall(ctor); + superCall = getSuperCallAtGivenIndex(ctor, startIndex); if (superCall) { writeLine(); emit(superCall); @@ -34754,7 +38789,7 @@ var ts; emitEnd(baseTypeElement); } } - emitPropertyDeclarations(node, getInitializedProperties(node, /*static:*/ false)); + emitPropertyDeclarations(node, getInitializedProperties(node, /*isStatic*/ false)); if (ctor) { var statements = ctor.body.statements; if (superCall) { @@ -34769,7 +38804,6 @@ var ts; } decreaseIndent(); emitToken(16 /* CloseBraceToken */, ctor ? ctor.body.statements.end : node.members.end); - scopeEmitEnd(); emitEnd(ctor || node); if (ctor) { emitTrailingComments(ctor); @@ -34788,68 +38822,115 @@ var ts; else { emitClassLikeDeclarationForES6AndHigher(node); } - if (modulekind !== 5 /* ES6 */ && node.parent === currentSourceFile && node.name) { + if (modulekind !== ts.ModuleKind.ES6 && node.parent === currentSourceFile && node.name) { emitExportMemberAssignments(node.name); } } function emitClassLikeDeclarationForES6AndHigher(node) { - var thisNodeIsDecorated = ts.nodeIsDecorated(node); - if (node.kind === 214 /* ClassDeclaration */) { - if (thisNodeIsDecorated) { - // To preserve the correct runtime semantics when decorators are applied to the class, - // the emit needs to follow one of the following rules: + var decoratedClassAlias; + var isHoistedDeclarationInSystemModule = shouldHoistDeclarationInSystemJsModule(node); + var isDecorated = ts.nodeIsDecorated(node); + var rewriteAsClassExpression = isDecorated || isHoistedDeclarationInSystemModule; + if (node.kind === 221 /* ClassDeclaration */) { + if (rewriteAsClassExpression) { + // When we emit an ES6 class that has a class decorator, we must tailor the + // emit to certain specific cases. // - // * For a local class declaration: + // In the simplest case, we emit the class declaration as a let declaration, and + // evaluate decorators after the close of the class body: // - // @dec class C { - // } + // TypeScript | Javascript + // --------------------------------|------------------------------------ + // @dec | let C = class C { + // class C { | } + // } | C = __decorate([dec], C); + // --------------------------------|------------------------------------ + // @dec | export let C = class C { + // export class C { | } + // } | C = __decorate([dec], C); + // --------------------------------------------------------------------- + // [Example 1] // - // The emit should be: + // If a class declaration contains a reference to itself *inside* of the class body, + // this introduces two bindings to the class: One outside of the class body, and one + // inside of the class body. If we apply decorators as in [Example 1] above, there + // is the possibility that the decorator `dec` will return a new value for the + // constructor, which would result in the binding inside of the class no longer + // pointing to the same reference as the binding outside of the class. // - // let C = class { - // }; - // C = __decorate([dec], C); + // As a result, we must instead rewrite all references to the class *inside* of the + // class body to instead point to a local temporary alias for the class: // - // * For an exported class declaration: + // TypeScript | Javascript + // --------------------------------|------------------------------------ + // @dec | let C_1; + // class C { | let C = C_1 = class C { + // static x() { return C.y; } | static x() { return C_1.y; } + // static y = 1; | } + // } | C.y = 1; + // | C = C_1 = __decorate([dec], C); + // --------------------------------|------------------------------------ + // @dec | let C_1; + // export class C { | export let C = C_1 = class C { + // static x() { return C.y; } | static x() { return C_1.y; } + // static y = 1; | } + // } | C.y = 1; + // | C = C_1 = __decorate([dec], C); + // --------------------------------------------------------------------- + // [Example 2] // - // @dec export class C { - // } + // If a class declaration is the default export of a module, we instead emit + // the export after the decorated declaration: // - // The emit should be: + // TypeScript | Javascript + // --------------------------------|------------------------------------ + // @dec | let default_1 = class { + // export default class { | } + // } | default_1 = __decorate([dec], default_1); + // | export default default_1; + // --------------------------------|------------------------------------ + // @dec | let C = class C { + // export default class { | } + // } | C = __decorate([dec], C); + // | export default C; + // --------------------------------------------------------------------- + // [Example 3] // - // export let C = class { - // }; - // C = __decorate([dec], C); + // If the class declaration is the default export and a reference to itself + // inside of the class body, we must emit both an alias for the class *and* + // move the export after the declaration: // - // * For a default export of a class declaration with a name: - // - // @dec default export class C { - // } - // - // The emit should be: - // - // let C = class { - // } - // C = __decorate([dec], C); - // export default C; - // - // * For a default export of a class declaration without a name: - // - // @dec default export class { - // } - // - // The emit should be: - // - // let _default = class { - // } - // _default = __decorate([dec], _default); - // export default _default; + // TypeScript | Javascript + // --------------------------------|------------------------------------ + // @dec | let C_1; + // export default class C { | let C = C_1 = class C { + // static x() { return C.y; } | static x() { return C_1.y; } + // static y = 1; | } + // } | C.y = 1; + // | C = C_1 = __decorate([dec], C); + // | export default C; + // --------------------------------------------------------------------- + // [Example 4] // + // NOTE: we reuse the same rewriting logic for cases when targeting ES6 and module kind is System. + // Because of hoisting top level class declaration need to be emitted as class expressions. + // Double bind case is only required if node is decorated. + if (isDecorated && resolver.getNodeCheckFlags(node) & 524288 /* ClassWithBodyScopedClassBinding */) { + decoratedClassAlias = ts.unescapeIdentifier(makeUniqueName(node.name ? node.name.text : "default")); + decoratedClassAliases[ts.getNodeId(node)] = decoratedClassAlias; + write("let " + decoratedClassAlias + ";"); + writeLine(); + } if (isES6ExportedDeclaration(node) && !(node.flags & 512 /* Default */)) { write("export "); } - write("let "); + if (!isHoistedDeclarationInSystemModule) { + write("let "); + } emitDeclarationName(node); + if (decoratedClassAlias !== undefined) { + write(" = " + decoratedClassAlias); + } write(" = "); } else if (isES6ExportedDeclaration(node)) { @@ -34870,8 +38951,8 @@ var ts; // // This keeps the expression as an expression, while ensuring that the static parts // of it have been initialized by the time it is used. - var staticProperties = getInitializedProperties(node, /*static:*/ true); - var isClassExpressionWithStaticProperties = staticProperties.length > 0 && node.kind === 186 /* ClassExpression */; + var staticProperties = getInitializedProperties(node, /*isStatic*/ true); + var isClassExpressionWithStaticProperties = staticProperties.length > 0 && node.kind === 192 /* ClassExpression */; var tempVariable; if (isClassExpressionWithStaticProperties) { tempVariable = createAndRecordTempVariable(0 /* Auto */); @@ -34884,7 +38965,7 @@ var ts; // emit name if // - node has a name // - this is default export with static initializers - if ((node.name || (node.flags & 512 /* Default */ && staticProperties.length > 0)) && !thisNodeIsDecorated) { + if (node.name || (node.flags & 512 /* Default */ && (staticProperties.length > 0 || modulekind !== ts.ModuleKind.ES6) && !rewriteAsClassExpression)) { write(" "); emitDeclarationName(node); } @@ -34895,23 +38976,14 @@ var ts; } write(" {"); increaseIndent(); - scopeEmitStart(node); writeLine(); emitConstructor(node, baseTypeNode); emitMemberFunctionsForES6AndHigher(node); decreaseIndent(); writeLine(); emitToken(16 /* CloseBraceToken */, node.members.end); - scopeEmitEnd(); - // TODO(rbuckton): Need to go back to `let _a = class C {}` approach, removing the defineProperty call for now. - // For a decorated class, we need to assign its name (if it has one). This is because we emit - // the class as a class expression to avoid the double-binding of the identifier: - // - // let C = class { - // } - // Object.defineProperty(C, "name", { value: "C", configurable: true }); - // - if (thisNodeIsDecorated) { + if (rewriteAsClassExpression) { + decoratedClassAliases[ts.getNodeId(node)] = undefined; write(";"); } // Emit static property assignment. Because classDeclaration is lexically evaluated, @@ -34924,7 +38996,7 @@ var ts; var property = staticProperties_1[_a]; write(","); writeLine(); - emitPropertyDeclaration(node, property, /*receiver:*/ tempVariable, /*isExpression:*/ true); + emitPropertyDeclaration(node, property, /*receiver*/ tempVariable, /*isExpression*/ true); } write(","); writeLine(); @@ -34935,29 +39007,39 @@ var ts; else { writeLine(); emitPropertyDeclarations(node, staticProperties); - emitDecoratorsOfClass(node); + emitDecoratorsOfClass(node, decoratedClassAlias); } - // If this is an exported class, but not on the top level (i.e. on an internal - // module), export it - if (!isES6ExportedDeclaration(node) && (node.flags & 2 /* Export */)) { - writeLine(); - emitStart(node); - emitModuleMemberName(node); - write(" = "); - emitDeclarationName(node); - emitEnd(node); - write(";"); + if (!(node.flags & 1 /* Export */)) { + return; } - else if (isES6ExportedDeclaration(node) && (node.flags & 512 /* Default */) && thisNodeIsDecorated) { - // if this is a top level default export of decorated class, write the export after the declaration. - writeLine(); - write("export default "); - emitDeclarationName(node); - write(";"); + if (modulekind !== ts.ModuleKind.ES6) { + emitExportMemberAssignment(node); + } + else { + // If this is an exported class, but not on the top level (i.e. on an internal + // module), export it + if (node.flags & 512 /* Default */) { + // if this is a top level default export of decorated class, write the export after the declaration. + if (isDecorated) { + writeLine(); + write("export default "); + emitDeclarationName(node); + write(";"); + } + } + else if (node.parent.kind !== 256 /* SourceFile */) { + writeLine(); + emitStart(node); + emitModuleMemberName(node); + write(" = "); + emitDeclarationName(node); + emitEnd(node); + write(";"); + } } } function emitClassLikeDeclarationBelowES6(node) { - if (node.kind === 214 /* ClassDeclaration */) { + if (node.kind === 221 /* ClassDeclaration */) { // source file level classes in system modules are hoisted so 'var's for them are already defined if (!shouldHoistDeclarationInSystemJsModule(node)) { write("var "); @@ -34982,7 +39064,6 @@ var ts; tempParameters = undefined; computedPropertyNamesToGeneratedNames = undefined; increaseIndent(); - scopeEmitStart(node); if (baseTypeNode) { writeLine(); emitStart(baseTypeNode); @@ -34994,9 +39075,9 @@ var ts; writeLine(); emitConstructor(node, baseTypeNode); emitMemberFunctionsForES5AndLower(node); - emitPropertyDeclarations(node, getInitializedProperties(node, /*static:*/ true)); + emitPropertyDeclarations(node, getInitializedProperties(node, /*isStatic*/ true)); writeLine(); - emitDecoratorsOfClass(node); + emitDecoratorsOfClass(node, /*decoratedClassAlias*/ undefined); writeLine(); emitToken(16 /* CloseBraceToken */, node.members.end, function () { write("return "); @@ -35013,38 +39094,37 @@ var ts; decreaseIndent(); writeLine(); emitToken(16 /* CloseBraceToken */, node.members.end); - scopeEmitEnd(); emitStart(node); - write(")("); + write("("); if (baseTypeNode) { emit(baseTypeNode.expression); } - write(")"); - if (node.kind === 214 /* ClassDeclaration */) { + write("))"); + if (node.kind === 221 /* ClassDeclaration */) { write(";"); } emitEnd(node); - if (node.kind === 214 /* ClassDeclaration */) { + if (node.kind === 221 /* ClassDeclaration */) { emitExportMemberAssignment(node); } } function emitClassMemberPrefix(node, member) { emitDeclarationName(node); - if (!(member.flags & 64 /* Static */)) { + if (!(member.flags & 32 /* Static */)) { write(".prototype"); } } - function emitDecoratorsOfClass(node) { + function emitDecoratorsOfClass(node, decoratedClassAlias) { emitDecoratorsOfMembers(node, /*staticFlag*/ 0); - emitDecoratorsOfMembers(node, 64 /* Static */); - emitDecoratorsOfConstructor(node); + emitDecoratorsOfMembers(node, 32 /* Static */); + emitDecoratorsOfConstructor(node, decoratedClassAlias); } - function emitDecoratorsOfConstructor(node) { + function emitDecoratorsOfConstructor(node, decoratedClassAlias) { var decorators = node.decorators; var constructor = ts.getFirstConstructorWithBody(node); - var hasDecoratedParameters = constructor && ts.forEach(constructor.parameters, ts.nodeIsDecorated); + var firstParameterDecorator = constructor && ts.forEach(constructor.parameters, function (parameter) { return parameter.decorators; }); // skip decoration of the constructor if neither it nor its parameters are decorated - if (!decorators && !hasDecoratedParameters) { + if (!decorators && !firstParameterDecorator) { return; } // Emit the call to __decorate. Given the class: @@ -35058,42 +39138,40 @@ var ts; // C = __decorate([dec], C); // writeLine(); - emitStart(node); + emitStart(node.decorators || firstParameterDecorator); emitDeclarationName(node); + if (decoratedClassAlias !== undefined) { + write(" = " + decoratedClassAlias); + } write(" = __decorate(["); increaseIndent(); writeLine(); var decoratorCount = decorators ? decorators.length : 0; - var argumentsWritten = emitList(decorators, 0, decoratorCount, /*multiLine*/ true, /*trailingComma*/ false, /*leadingComma*/ false, /*noTrailingNewLine*/ true, function (decorator) { - emitStart(decorator); - emit(decorator.expression); - emitEnd(decorator); - }); - argumentsWritten += emitDecoratorsOfParameters(constructor, /*leadingComma*/ argumentsWritten > 0); + var argumentsWritten = emitList(decorators, 0, decoratorCount, /*multiLine*/ true, /*trailingComma*/ false, /*leadingComma*/ false, /*noTrailingNewLine*/ true, function (decorator) { return emit(decorator.expression); }); + if (firstParameterDecorator) { + argumentsWritten += emitDecoratorsOfParameters(constructor, /*leadingComma*/ argumentsWritten > 0); + } emitSerializedTypeMetadata(node, /*leadingComma*/ argumentsWritten >= 0); decreaseIndent(); writeLine(); write("], "); emitDeclarationName(node); - write(");"); - emitEnd(node); + write(")"); + emitEnd(node.decorators || firstParameterDecorator); + write(";"); writeLine(); } function emitDecoratorsOfMembers(node, staticFlag) { for (var _a = 0, _b = node.members; _a < _b.length; _a++) { var member = _b[_a]; // only emit members in the correct group - if ((member.flags & 64 /* Static */) !== staticFlag) { + if ((member.flags & 32 /* Static */) !== staticFlag) { continue; } // skip members that cannot be decorated (such as the constructor) if (!ts.nodeCanBeDecorated(member)) { continue; } - // skip a member if it or any of its parameters are not decorated - if (!ts.nodeOrChildIsDecorated(member)) { - continue; - } // skip an accessor declaration if it is not the first accessor var decorators = void 0; var functionLikeMember = void 0; @@ -35113,10 +39191,15 @@ var ts; else { decorators = member.decorators; // we only decorate the parameters here if this is a method - if (member.kind === 143 /* MethodDeclaration */) { + if (member.kind === 147 /* MethodDeclaration */) { functionLikeMember = member; } } + var firstParameterDecorator = functionLikeMember && ts.forEach(functionLikeMember.parameters, function (parameter) { return parameter.decorators; }); + // skip a member if it or any of its parameters are not decorated + if (!decorators && !firstParameterDecorator) { + continue; + } // Emit the call to __decorate. Given the following: // // class C { @@ -35148,28 +39231,24 @@ var ts; // ], C.prototype, "prop"); // writeLine(); - emitStart(member); + emitStart(decorators || firstParameterDecorator); write("__decorate(["); increaseIndent(); writeLine(); var decoratorCount = decorators ? decorators.length : 0; - var argumentsWritten = emitList(decorators, 0, decoratorCount, /*multiLine*/ true, /*trailingComma*/ false, /*leadingComma*/ false, /*noTrailingNewLine*/ true, function (decorator) { - emitStart(decorator); - emit(decorator.expression); - emitEnd(decorator); - }); - argumentsWritten += emitDecoratorsOfParameters(functionLikeMember, argumentsWritten > 0); + var argumentsWritten = emitList(decorators, 0, decoratorCount, /*multiLine*/ true, /*trailingComma*/ false, /*leadingComma*/ false, /*noTrailingNewLine*/ true, function (decorator) { return emit(decorator.expression); }); + if (firstParameterDecorator) { + argumentsWritten += emitDecoratorsOfParameters(functionLikeMember, argumentsWritten > 0); + } emitSerializedTypeMetadata(member, argumentsWritten > 0); decreaseIndent(); writeLine(); write("], "); - emitStart(member.name); emitClassMemberPrefix(node, member); write(", "); emitExpressionForPropertyName(member.name); - emitEnd(member.name); if (languageVersion > 0 /* ES3 */) { - if (member.kind !== 141 /* PropertyDeclaration */) { + if (member.kind !== 145 /* PropertyDeclaration */) { // We emit `null` here to indicate to `__decorate` that it can invoke `Object.getOwnPropertyDescriptor` directly. // We have this extra argument here so that we can inject an explicit property descriptor at a later date. write(", null"); @@ -35180,29 +39259,28 @@ var ts; write(", void 0"); } } - write(");"); - emitEnd(member); + write(")"); + emitEnd(decorators || firstParameterDecorator); + write(";"); writeLine(); } } function emitDecoratorsOfParameters(node, leadingComma) { var argumentsWritten = 0; if (node) { - var parameterIndex = 0; + var parameterIndex_1 = 0; for (var _a = 0, _b = node.parameters; _a < _b.length; _a++) { var parameter = _b[_a]; if (ts.nodeIsDecorated(parameter)) { var decorators = parameter.decorators; argumentsWritten += emitList(decorators, 0, decorators.length, /*multiLine*/ true, /*trailingComma*/ false, /*leadingComma*/ leadingComma, /*noTrailingNewLine*/ true, function (decorator) { - emitStart(decorator); - write("__param(" + parameterIndex + ", "); + write("__param(" + parameterIndex_1 + ", "); emit(decorator.expression); write(")"); - emitEnd(decorator); }); leadingComma = true; } - ++parameterIndex; + parameterIndex_1++; } } return argumentsWritten; @@ -35212,10 +39290,10 @@ var ts; // The caller should have already tested whether the node has decorators and whether the emitDecoratorMetadata // compiler option is set. switch (node.kind) { - case 143 /* MethodDeclaration */: - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: - case 141 /* PropertyDeclaration */: + case 147 /* MethodDeclaration */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: + case 145 /* PropertyDeclaration */: return true; } return false; @@ -35225,7 +39303,7 @@ var ts; // The caller should have already tested whether the node has decorators and whether the emitDecoratorMetadata // compiler option is set. switch (node.kind) { - case 143 /* MethodDeclaration */: + case 147 /* MethodDeclaration */: return true; } return false; @@ -35235,9 +39313,9 @@ var ts; // The caller should have already tested whether the node has decorators and whether the emitDecoratorMetadata // compiler option is set. switch (node.kind) { - case 214 /* ClassDeclaration */: - case 143 /* MethodDeclaration */: - case 146 /* SetAccessor */: + case 221 /* ClassDeclaration */: + case 147 /* MethodDeclaration */: + case 150 /* SetAccessor */: return true; } return false; @@ -35255,19 +39333,19 @@ var ts; // // For rules on serializing type annotations, see `serializeTypeNode`. switch (node.kind) { - case 214 /* ClassDeclaration */: + case 221 /* ClassDeclaration */: write("Function"); return; - case 141 /* PropertyDeclaration */: + case 145 /* PropertyDeclaration */: emitSerializedTypeNode(node.type); return; - case 138 /* Parameter */: + case 142 /* Parameter */: emitSerializedTypeNode(node.type); return; - case 145 /* GetAccessor */: + case 149 /* GetAccessor */: emitSerializedTypeNode(node.type); return; - case 146 /* SetAccessor */: + case 150 /* SetAccessor */: emitSerializedTypeNode(ts.getSetAccessorTypeAnnotationNode(node)); return; } @@ -35283,39 +39361,40 @@ var ts; case 103 /* VoidKeyword */: write("void 0"); return; - case 160 /* ParenthesizedType */: + case 164 /* ParenthesizedType */: emitSerializedTypeNode(node.type); return; - case 152 /* FunctionType */: - case 153 /* ConstructorType */: + case 156 /* FunctionType */: + case 157 /* ConstructorType */: write("Function"); return; - case 156 /* ArrayType */: - case 157 /* TupleType */: + case 160 /* ArrayType */: + case 161 /* TupleType */: write("Array"); return; - case 150 /* TypePredicate */: + case 154 /* TypePredicate */: case 120 /* BooleanKeyword */: write("Boolean"); return; - case 130 /* StringKeyword */: - case 9 /* StringLiteral */: + case 132 /* StringKeyword */: + case 166 /* StringLiteralType */: write("String"); return; - case 128 /* NumberKeyword */: + case 130 /* NumberKeyword */: write("Number"); return; - case 131 /* SymbolKeyword */: + case 133 /* SymbolKeyword */: write("Symbol"); return; - case 151 /* TypeReference */: + case 155 /* TypeReference */: emitSerializedTypeReferenceNode(node); return; - case 154 /* TypeQuery */: - case 155 /* TypeLiteral */: - case 158 /* UnionType */: - case 159 /* IntersectionType */: + case 158 /* TypeQuery */: + case 159 /* TypeLiteral */: + case 162 /* UnionType */: + case 163 /* IntersectionType */: case 117 /* AnyKeyword */: + case 165 /* ThisType */: break; default: ts.Debug.fail("Cannot serialize unexpected type node."); @@ -35331,8 +39410,7 @@ var ts; location = location.parent; } // Clone the type name and parent it to a location outside of the current declaration. - var typeName = ts.cloneEntityName(node.typeName); - typeName.parent = location; + var typeName = ts.cloneEntityName(node.typeName, location); var result = resolver.getTypeReferenceSerializationKind(typeName); switch (result) { case ts.TypeReferenceSerializationKind.Unknown: @@ -35388,8 +39466,8 @@ var ts; // // For the rules on serializing the type of each parameter declaration, see `serializeTypeOfDeclaration`. if (node) { - var valueDeclaration; - if (node.kind === 214 /* ClassDeclaration */) { + var valueDeclaration = void 0; + if (node.kind === 221 /* ClassDeclaration */) { valueDeclaration = ts.getFirstConstructorWithBody(node); } else if (ts.isFunctionLike(node) && ts.nodeIsPresent(node.body)) { @@ -35405,10 +39483,10 @@ var ts; } if (parameters[i].dotDotDotToken) { var parameterType = parameters[i].type; - if (parameterType.kind === 156 /* ArrayType */) { + if (parameterType.kind === 160 /* ArrayType */) { parameterType = parameterType.elementType; } - else if (parameterType.kind === 151 /* TypeReference */ && parameterType.typeArguments && parameterType.typeArguments.length === 1) { + else if (parameterType.kind === 155 /* TypeReference */ && parameterType.typeArguments && parameterType.typeArguments.length === 1) { parameterType = parameterType.typeArguments[0]; } else { @@ -35484,9 +39562,10 @@ var ts; } if (!shouldHoistDeclarationInSystemJsModule(node)) { // do not emit var if variable was already hoisted - if (!(node.flags & 2 /* Export */) || isES6ExportedDeclaration(node)) { + var isES6ExportedEnum = isES6ExportedDeclaration(node); + if (!(node.flags & 1 /* Export */) || (isES6ExportedEnum && isFirstDeclarationOfKind(node, node.symbol && node.symbol.declarations, 224 /* EnumDeclaration */))) { emitStart(node); - if (isES6ExportedDeclaration(node)) { + if (isES6ExportedEnum) { write("export "); } write("var "); @@ -35503,19 +39582,17 @@ var ts; emitEnd(node.name); write(") {"); increaseIndent(); - scopeEmitStart(node); emitLines(node.members); decreaseIndent(); writeLine(); emitToken(16 /* CloseBraceToken */, node.members.end); - scopeEmitEnd(); write(")("); emitModuleMemberName(node); write(" || ("); emitModuleMemberName(node); write(" = {}));"); emitEnd(node); - if (!isES6ExportedDeclaration(node) && node.flags & 2 /* Export */ && !shouldHoistDeclarationInSystemJsModule(node)) { + if (!isES6ExportedDeclaration(node) && node.flags & 1 /* Export */ && !shouldHoistDeclarationInSystemJsModule(node)) { // do not emit var if variable was already hoisted writeLine(); emitStart(node); @@ -35526,8 +39603,8 @@ var ts; emitEnd(node); write(";"); } - if (modulekind !== 5 /* ES6 */ && node.parent === currentSourceFile) { - if (modulekind === 4 /* System */ && (node.flags & 2 /* Export */)) { + if (modulekind !== ts.ModuleKind.ES6 && node.parent === currentSourceFile) { + if (modulekind === ts.ModuleKind.System && (node.flags & 1 /* Export */)) { // write the call to exporter for enum writeLine(); write(exportFunctionForFile + "(\""); @@ -35568,7 +39645,7 @@ var ts; } } function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { - if (moduleDeclaration.body.kind === 218 /* ModuleDeclaration */) { + if (moduleDeclaration.body.kind === 225 /* ModuleDeclaration */) { var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); return recursiveInnerModule || moduleDeclaration.body; } @@ -35579,6 +39656,9 @@ var ts; function isModuleMergedWithES6Class(node) { return languageVersion === 2 /* ES6 */ && !!(resolver.getNodeCheckFlags(node) & 32768 /* LexicalModuleMergesWithClass */); } + function isFirstDeclarationOfKind(node, declarations, kind) { + return !ts.forEach(declarations, function (declaration) { return declaration.kind === kind && declaration.pos < node.pos; }); + } function emitModuleDeclaration(node) { // Emit only if this module is non-ambient. var shouldEmit = shouldEmitModuleDeclaration(node); @@ -35588,15 +39668,18 @@ var ts; var hoistedInDeclarationScope = shouldHoistDeclarationInSystemJsModule(node); var emitVarForModule = !hoistedInDeclarationScope && !isModuleMergedWithES6Class(node); if (emitVarForModule) { - emitStart(node); - if (isES6ExportedDeclaration(node)) { - write("export "); + var isES6ExportedNamespace = isES6ExportedDeclaration(node); + if (!isES6ExportedNamespace || isFirstDeclarationOfKind(node, node.symbol && node.symbol.declarations, 225 /* ModuleDeclaration */)) { + emitStart(node); + if (isES6ExportedNamespace) { + write("export "); + } + write("var "); + emit(node.name); + write(";"); + emitEnd(node); + writeLine(); } - write("var "); - emit(node.name); - write(";"); - emitEnd(node); - writeLine(); } emitStart(node); write("(function ("); @@ -35604,7 +39687,7 @@ var ts; write(getGeneratedNameForNode(node)); emitEnd(node.name); write(") "); - if (node.body.kind === 219 /* ModuleBlock */) { + if (node.body.kind === 226 /* ModuleBlock */) { var saveConvertedLoopState = convertedLoopState; var saveTempFlags = tempFlags; var saveTempVariables = tempVariables; @@ -35620,7 +39703,6 @@ var ts; else { write("{"); increaseIndent(); - scopeEmitStart(node); emitCaptureThisForNodeIfNecessary(node); writeLine(); emit(node.body); @@ -35628,11 +39710,10 @@ var ts; writeLine(); var moduleBlock = getInnerMostModuleDeclarationFromDottedModule(node).body; emitToken(16 /* CloseBraceToken */, moduleBlock.statements.end); - scopeEmitEnd(); } write(")("); // write moduleDecl = containingModule.m only if it is not exported es6 module member - if ((node.flags & 2 /* Export */) && !isES6ExportedDeclaration(node)) { + if ((node.flags & 1 /* Export */) && !isES6ExportedDeclaration(node)) { emit(node.name); write(" = "); } @@ -35642,7 +39723,7 @@ var ts; write(" = {}));"); emitEnd(node); if (!isES6ExportedDeclaration(node) && node.name.kind === 69 /* Identifier */ && node.parent === currentSourceFile) { - if (modulekind === 4 /* System */ && (node.flags & 2 /* Export */)) { + if (modulekind === ts.ModuleKind.System && (node.flags & 1 /* Export */)) { writeLine(); write(exportFunctionForFile + "(\""); emitDeclarationName(node); @@ -35682,16 +39763,16 @@ var ts; } } function getNamespaceDeclarationNode(node) { - if (node.kind === 221 /* ImportEqualsDeclaration */) { + if (node.kind === 229 /* ImportEqualsDeclaration */) { return node; } var importClause = node.importClause; - if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 224 /* NamespaceImport */) { + if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 232 /* NamespaceImport */) { return importClause.namedBindings; } } function isDefaultImport(node) { - return node.kind === 222 /* ImportDeclaration */ && node.importClause && !!node.importClause.name; + return node.kind === 230 /* ImportDeclaration */ && node.importClause && !!node.importClause.name; } function emitExportImportAssignments(node) { if (ts.isAliasSymbolDeclaration(node) && resolver.isValueAliasDeclaration(node)) { @@ -35700,7 +39781,7 @@ var ts; ts.forEachChild(node, emitExportImportAssignments); } function emitImportDeclaration(node) { - if (modulekind !== 5 /* ES6 */) { + if (modulekind !== ts.ModuleKind.ES6) { return emitExternalImportDeclaration(node); } // ES6 import @@ -35719,7 +39800,7 @@ var ts; if (shouldEmitNamedBindings) { emitLeadingComments(node.importClause.namedBindings); emitStart(node.importClause.namedBindings); - if (node.importClause.namedBindings.kind === 224 /* NamespaceImport */) { + if (node.importClause.namedBindings.kind === 232 /* NamespaceImport */) { write("* as "); emit(node.importClause.namedBindings.name); } @@ -35745,16 +39826,19 @@ var ts; } function emitExternalImportDeclaration(node) { if (ts.contains(externalImports, node)) { - var isExportedImport = node.kind === 221 /* ImportEqualsDeclaration */ && (node.flags & 2 /* Export */) !== 0; + var isExportedImport = node.kind === 229 /* ImportEqualsDeclaration */ && (node.flags & 1 /* Export */) !== 0; var namespaceDeclaration = getNamespaceDeclarationNode(node); - if (modulekind !== 2 /* AMD */) { + var varOrConst = (languageVersion <= 1 /* ES5 */) ? "var " : "const "; + if (modulekind !== ts.ModuleKind.AMD) { emitLeadingComments(node); emitStart(node); if (namespaceDeclaration && !isDefaultImport(node)) { // import x = require("foo") // import * as x from "foo" - if (!isExportedImport) - write("var "); + if (!isExportedImport) { + write(varOrConst); + } + ; emitModuleMemberName(namespaceDeclaration); write(" = "); } @@ -35764,9 +39848,9 @@ var ts; // import { x, y } from "foo" // import d, * as x from "foo" // import d, { x, y } from "foo" - var isNakedImport = 222 /* ImportDeclaration */ && !node.importClause; + var isNakedImport = 230 /* ImportDeclaration */ && !node.importClause; if (!isNakedImport) { - write("var "); + write(varOrConst); write(getGeneratedNameForNode(node)); write(" = "); } @@ -35793,7 +39877,7 @@ var ts; } else if (namespaceDeclaration && isDefaultImport(node)) { // import d, * as x from "foo" - write("var "); + write(varOrConst); emitModuleMemberName(namespaceDeclaration); write(" = "); write(getGeneratedNameForNode(node)); @@ -35827,7 +39911,7 @@ var ts; write("export "); write("var "); } - else if (!(node.flags & 2 /* Export */)) { + else if (!(node.flags & 1 /* Export */)) { write("var "); } } @@ -35849,14 +39933,14 @@ var ts; } } function emitExportDeclaration(node) { - ts.Debug.assert(modulekind !== 4 /* System */); - if (modulekind !== 5 /* ES6 */) { + ts.Debug.assert(modulekind !== ts.ModuleKind.System); + if (modulekind !== ts.ModuleKind.ES6) { if (node.moduleSpecifier && (!node.exportClause || resolver.isValueAliasDeclaration(node))) { emitStart(node); var generatedName = getGeneratedNameForNode(node); if (node.exportClause) { // export { x, y, ... } from "foo" - if (modulekind !== 2 /* AMD */) { + if (modulekind !== ts.ModuleKind.AMD) { write("var "); write(generatedName); write(" = "); @@ -35882,15 +39966,17 @@ var ts; } else { // export * from "foo" - writeLine(); - write("__export("); - if (modulekind !== 2 /* AMD */) { - emitRequire(ts.getExternalModuleName(node)); + if (hasExportStarsToExportValues && resolver.moduleExportsSomeValue(node.moduleSpecifier)) { + writeLine(); + write("__export("); + if (modulekind !== ts.ModuleKind.AMD) { + emitRequire(ts.getExternalModuleName(node)); + } + else { + write(generatedName); + } + write(");"); } - else { - write(generatedName); - } - write(");"); } emitEnd(node); } @@ -35916,7 +40002,7 @@ var ts; } } function emitExportOrImportSpecifierList(specifiers, shouldEmit) { - ts.Debug.assert(modulekind === 5 /* ES6 */); + ts.Debug.assert(modulekind === ts.ModuleKind.ES6); var needsComma = false; for (var _a = 0, specifiers_1 = specifiers; _a < specifiers_1.length; _a++) { var specifier = specifiers_1[_a]; @@ -35935,14 +40021,14 @@ var ts; } function emitExportAssignment(node) { if (!node.isExportEquals && resolver.isValueAliasDeclaration(node)) { - if (modulekind === 5 /* ES6 */) { + if (modulekind === ts.ModuleKind.ES6) { writeLine(); emitStart(node); write("export default "); var expression = node.expression; emit(expression); - if (expression.kind !== 213 /* FunctionDeclaration */ && - expression.kind !== 214 /* ClassDeclaration */) { + if (expression.kind !== 220 /* FunctionDeclaration */ && + expression.kind !== 221 /* ClassDeclaration */) { write(";"); } emitEnd(node); @@ -35950,7 +40036,7 @@ var ts; else { writeLine(); emitStart(node); - if (modulekind === 4 /* System */) { + if (modulekind === ts.ModuleKind.System) { write(exportFunctionForFile + "(\"default\","); emit(node.expression); write(")"); @@ -35959,7 +40045,7 @@ var ts; emitEs6ExportDefaultCompat(node); emitContainingModuleName(node); if (languageVersion === 0 /* ES3 */) { - write("[\"default\"] = "); + write('["default"] = '); } else { write(".default = "); @@ -35975,11 +40061,11 @@ var ts; externalImports = []; exportSpecifiers = {}; exportEquals = undefined; - hasExportStars = false; + hasExportStarsToExportValues = false; for (var _a = 0, _b = sourceFile.statements; _a < _b.length; _a++) { var node = _b[_a]; switch (node.kind) { - case 222 /* ImportDeclaration */: + case 230 /* ImportDeclaration */: if (!node.importClause || resolver.isReferencedAliasDeclaration(node.importClause, /*checkChildren*/ true)) { // import "mod" @@ -35989,18 +40075,20 @@ var ts; externalImports.push(node); } break; - case 221 /* ImportEqualsDeclaration */: - if (node.moduleReference.kind === 232 /* ExternalModuleReference */ && resolver.isReferencedAliasDeclaration(node)) { + case 229 /* ImportEqualsDeclaration */: + if (node.moduleReference.kind === 240 /* ExternalModuleReference */ && resolver.isReferencedAliasDeclaration(node)) { // import x = require("mod") where x is referenced externalImports.push(node); } break; - case 228 /* ExportDeclaration */: + case 236 /* ExportDeclaration */: if (node.moduleSpecifier) { if (!node.exportClause) { // export * from "mod" - externalImports.push(node); - hasExportStars = true; + if (resolver.moduleExportsSomeValue(node.moduleSpecifier)) { + externalImports.push(node); + hasExportStarsToExportValues = true; + } } else if (resolver.isValueAliasDeclaration(node)) { // export { x, y } from "mod" where at least one export is a value symbol @@ -36011,12 +40099,12 @@ var ts; // export { x, y } for (var _c = 0, _d = node.exportClause.elements; _c < _d.length; _c++) { var specifier = _d[_c]; - var name_26 = (specifier.propertyName || specifier.name).text; - (exportSpecifiers[name_26] || (exportSpecifiers[name_26] = [])).push(specifier); + var name_29 = (specifier.propertyName || specifier.name).text; + (exportSpecifiers[name_29] || (exportSpecifiers[name_29] = [])).push(specifier); } } break; - case 227 /* ExportAssignment */: + case 235 /* ExportAssignment */: if (node.isExportEquals && !exportEquals) { // export = x exportEquals = node; @@ -36026,7 +40114,7 @@ var ts; } } function emitExportStarHelper() { - if (hasExportStars) { + if (hasExportStarsToExportValues) { writeLine(); write("function __export(m) {"); increaseIndent(); @@ -36042,14 +40130,20 @@ var ts; if (namespaceDeclaration && !isDefaultImport(node)) { return ts.getTextOfNodeFromSourceText(currentText, namespaceDeclaration.name); } - if (node.kind === 222 /* ImportDeclaration */ && node.importClause) { + if (node.kind === 230 /* ImportDeclaration */ && node.importClause) { return getGeneratedNameForNode(node); } - if (node.kind === 228 /* ExportDeclaration */ && node.moduleSpecifier) { + if (node.kind === 236 /* ExportDeclaration */ && node.moduleSpecifier) { return getGeneratedNameForNode(node); } } - function getExternalModuleNameText(importNode) { + function getExternalModuleNameText(importNode, emitRelativePathAsModuleName) { + if (emitRelativePathAsModuleName) { + var name_30 = getExternalModuleNameFromDeclaration(host, resolver, importNode); + if (name_30) { + return "\"" + name_30 + "\""; + } + } var moduleName = ts.getExternalModuleName(importNode); if (moduleName.kind === 9 /* StringLiteral */) { return tryRenameExternalModule(moduleName) || getLiteralText(moduleName); @@ -36065,8 +40159,8 @@ var ts; for (var _a = 0, externalImports_1 = externalImports; _a < externalImports_1.length; _a++) { var importNode = externalImports_1[_a]; // do not create variable declaration for exports and imports that lack import clause - var skipNode = importNode.kind === 228 /* ExportDeclaration */ || - (importNode.kind === 222 /* ImportDeclaration */ && !importNode.importClause); + var skipNode = importNode.kind === 236 /* ExportDeclaration */ || + (importNode.kind === 230 /* ImportDeclaration */ && !importNode.importClause); if (skipNode) { continue; } @@ -36087,8 +40181,8 @@ var ts; // when resolving exports local exported entries/indirect exported entries in the module // should always win over entries with similar names that were added via star exports // to support this we store names of local/indirect exported entries in a set. - // this set is used to filter names brought by star expors. - if (!hasExportStars) { + // this set is used to filter names brought by star exports. + if (!hasExportStarsToExportValues) { // local names set is needed only in presence of star exports return undefined; } @@ -36099,7 +40193,7 @@ var ts; var hasExportDeclarationWithExportClause = false; for (var _a = 0, externalImports_2 = externalImports; _a < externalImports_2.length; _a++) { var externalImport = externalImports_2[_a]; - if (externalImport.kind === 228 /* ExportDeclaration */ && externalImport.exportClause) { + if (externalImport.kind === 236 /* ExportDeclaration */ && externalImport.exportClause) { hasExportDeclarationWithExportClause = true; break; } @@ -36115,7 +40209,7 @@ var ts; increaseIndent(); var started = false; if (exportedDeclarations) { - for (var i = 0; i < exportedDeclarations.length; ++i) { + for (var i = 0; i < exportedDeclarations.length; i++) { // write name of exported declaration, i.e 'export var x...' writeExportedName(exportedDeclarations[i]); } @@ -36131,7 +40225,7 @@ var ts; } for (var _d = 0, externalImports_3 = externalImports; _d < externalImports_3.length; _d++) { var externalImport = externalImports_3[_d]; - if (externalImport.kind !== 228 /* ExportDeclaration */) { + if (externalImport.kind !== 236 /* ExportDeclaration */) { continue; } var exportDecl = externalImport; @@ -36217,14 +40311,14 @@ var ts; writeLine(); write("var "); var seen = {}; - for (var i = 0; i < hoistedVars.length; ++i) { + for (var i = 0; i < hoistedVars.length; i++) { var local = hoistedVars[i]; - var name_27 = local.kind === 69 /* Identifier */ + var name_31 = local.kind === 69 /* Identifier */ ? local : local.name; - if (name_27) { + if (name_31) { // do not emit duplicate entries (in case of declaration merging) in the list of hoisted variables - var text = ts.unescapeIdentifier(name_27.text); + var text = ts.unescapeIdentifier(name_31.text); if (ts.hasProperty(seen, text)) { continue; } @@ -36235,14 +40329,14 @@ var ts; if (i !== 0) { write(", "); } - if (local.kind === 214 /* ClassDeclaration */ || local.kind === 218 /* ModuleDeclaration */ || local.kind === 217 /* EnumDeclaration */) { + if (local.kind === 221 /* ClassDeclaration */ || local.kind === 225 /* ModuleDeclaration */ || local.kind === 224 /* EnumDeclaration */) { emitDeclarationName(local); } else { emit(local); } var flags = ts.getCombinedNodeFlags(local.kind === 69 /* Identifier */ ? local.parent : local); - if (flags & 2 /* Export */) { + if (flags & 1 /* Export */) { if (!exportedDeclarations) { exportedDeclarations = []; } @@ -36256,7 +40350,7 @@ var ts; var f = hoistedFunctionDeclarations_1[_a]; writeLine(); emit(f); - if (f.flags & 2 /* Export */) { + if (f.flags & 1 /* Export */) { if (!exportedDeclarations) { exportedDeclarations = []; } @@ -36266,24 +40360,24 @@ var ts; } return exportedDeclarations; function visit(node) { - if (node.flags & 4 /* Ambient */) { + if (node.flags & 2 /* Ambient */) { return; } - if (node.kind === 213 /* FunctionDeclaration */) { + if (node.kind === 220 /* FunctionDeclaration */) { if (!hoistedFunctionDeclarations) { hoistedFunctionDeclarations = []; } hoistedFunctionDeclarations.push(node); return; } - if (node.kind === 214 /* ClassDeclaration */) { + if (node.kind === 221 /* ClassDeclaration */) { if (!hoistedVars) { hoistedVars = []; } hoistedVars.push(node); return; } - if (node.kind === 217 /* EnumDeclaration */) { + if (node.kind === 224 /* EnumDeclaration */) { if (shouldEmitEnumDeclaration(node)) { if (!hoistedVars) { hoistedVars = []; @@ -36292,7 +40386,7 @@ var ts; } return; } - if (node.kind === 218 /* ModuleDeclaration */) { + if (node.kind === 225 /* ModuleDeclaration */) { if (shouldEmitModuleDeclaration(node)) { if (!hoistedVars) { hoistedVars = []; @@ -36301,17 +40395,17 @@ var ts; } return; } - if (node.kind === 211 /* VariableDeclaration */ || node.kind === 163 /* BindingElement */) { + if (node.kind === 218 /* VariableDeclaration */ || node.kind === 169 /* BindingElement */) { if (shouldHoistVariable(node, /*checkIfSourceFileLevelDecl*/ false)) { - var name_28 = node.name; - if (name_28.kind === 69 /* Identifier */) { + var name_32 = node.name; + if (name_32.kind === 69 /* Identifier */) { if (!hoistedVars) { hoistedVars = []; } - hoistedVars.push(name_28); + hoistedVars.push(name_32); } else { - ts.forEachChild(name_28, visit); + ts.forEachChild(name_32, visit); } } return; @@ -36341,11 +40435,11 @@ var ts; // - it is top level block scoped // if block scoped variables are nested in some another block then // no other functions can use them except ones that are defined at least in the same block - return (ts.getCombinedNodeFlags(node) & 24576 /* BlockScoped */) === 0 || - ts.getEnclosingBlockScopeContainer(node).kind === 248 /* SourceFile */; + return (ts.getCombinedNodeFlags(node) & 3072 /* BlockScoped */) === 0 || + ts.getEnclosingBlockScopeContainer(node).kind === 256 /* SourceFile */; } function isCurrentFileSystemExternalModule() { - return modulekind === 4 /* System */ && isCurrentFileExternalModule; + return modulekind === ts.ModuleKind.System && isCurrentFileExternalModule; } function emitSystemModuleBody(node, dependencyGroups, startIndex) { // shape of the body in system modules: @@ -36402,7 +40496,7 @@ var ts; } function emitSetters(exportStarFunction, dependencyGroups) { write("setters:["); - for (var i = 0; i < dependencyGroups.length; ++i) { + for (var i = 0; i < dependencyGroups.length; i++) { if (i !== 0) { write(","); } @@ -36417,21 +40511,21 @@ var ts; var entry = group_1[_a]; var importVariableName = getLocalNameForExternalImport(entry) || ""; switch (entry.kind) { - case 222 /* ImportDeclaration */: + case 230 /* ImportDeclaration */: if (!entry.importClause) { // 'import "..."' case // module is imported only for side-effects, no emit required break; } // fall-through - case 221 /* ImportEqualsDeclaration */: + case 229 /* ImportEqualsDeclaration */: ts.Debug.assert(importVariableName !== ""); writeLine(); // save import into the local write(importVariableName + " = " + parameterName + ";"); writeLine(); break; - case 228 /* ExportDeclaration */: + case 236 /* ExportDeclaration */: ts.Debug.assert(importVariableName !== ""); if (entry.exportClause) { // export {a, b as c} from 'foo' @@ -36444,12 +40538,12 @@ var ts; write(exportFunctionForFile + "({"); writeLine(); increaseIndent(); - for (var i_2 = 0, len = entry.exportClause.elements.length; i_2 < len; ++i_2) { - if (i_2 !== 0) { + for (var i_1 = 0, len = entry.exportClause.elements.length; i_1 < len; i_1++) { + if (i_1 !== 0) { write(","); writeLine(); } - var e = entry.exportClause.elements[i_2]; + var e = entry.exportClause.elements[i_1]; write("\""); emitNodeWithCommentsAndWithoutSourcemap(e.name); write("\": " + parameterName + "[\""); @@ -36461,6 +40555,8 @@ var ts; write("});"); } else { + // collectExternalModuleInfo prefilters star exports to keep only ones that export values + // this means that check 'resolver.moduleExportsSomeValue' is redundant and can be omitted here writeLine(); // export * from 'foo' // emit as: @@ -36481,17 +40577,17 @@ var ts; write("execute: function() {"); increaseIndent(); writeLine(); - for (var i = startIndex; i < node.statements.length; ++i) { + for (var i = startIndex; i < node.statements.length; i++) { var statement = node.statements[i]; switch (statement.kind) { // - function declarations are not emitted because they were already hoisted // - import declarations are not emitted since they are already handled in setters // - export declarations with module specifiers are not emitted since they were already written in setters // - export declarations without module specifiers are emitted preserving the order - case 213 /* FunctionDeclaration */: - case 222 /* ImportDeclaration */: + case 220 /* FunctionDeclaration */: + case 230 /* ImportDeclaration */: continue; - case 228 /* ExportDeclaration */: + case 236 /* ExportDeclaration */: if (!statement.moduleSpecifier) { for (var _a = 0, _b = statement.exportClause.elements; _a < _b.length; _a++) { var element = _b[_a]; @@ -36500,7 +40596,7 @@ var ts; } } continue; - case 221 /* ImportEqualsDeclaration */: + case 229 /* ImportEqualsDeclaration */: if (!ts.isInternalModuleImportEqualsDeclaration(statement)) { // - import equals declarations that import external modules are not emitted continue; @@ -36534,39 +40630,43 @@ var ts; ts.Debug.assert(!exportFunctionForFile); // make sure that name of 'exports' function does not conflict with existing identifiers exportFunctionForFile = makeUniqueName("exports"); + contextObjectForFile = makeUniqueName("context"); writeLine(); write("System.register("); writeModuleName(node, emitRelativePathAsModuleName); write("["); var groupIndices = {}; var dependencyGroups = []; - for (var i = 0; i < externalImports.length; ++i) { - var text = getExternalModuleNameText(externalImports[i]); - if (ts.hasProperty(groupIndices, text)) { + for (var i = 0; i < externalImports.length; i++) { + var text = getExternalModuleNameText(externalImports[i], emitRelativePathAsModuleName); + if (text === undefined) { + continue; + } + // text should be quoted string + // for deduplication purposes in key remove leading and trailing quotes so 'a' and "a" will be considered the same + var key = text.substr(1, text.length - 2); + if (ts.hasProperty(groupIndices, key)) { // deduplicate/group entries in dependency list by the dependency name - var groupIndex = groupIndices[text]; + var groupIndex = groupIndices[key]; dependencyGroups[groupIndex].push(externalImports[i]); continue; } else { - groupIndices[text] = dependencyGroups.length; + groupIndices[key] = dependencyGroups.length; dependencyGroups.push([externalImports[i]]); } if (i !== 0) { write(", "); } - if (emitRelativePathAsModuleName) { - var name_29 = getExternalModuleNameFromDeclaration(host, resolver, externalImports[i]); - if (name_29) { - text = "\"" + name_29 + "\""; - } - } write(text); } - write("], function(" + exportFunctionForFile + ") {"); + write("], function(" + exportFunctionForFile + ", " + contextObjectForFile + ") {"); writeLine(); increaseIndent(); - var startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ true); + var startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ true, /*ensureUseStrict*/ !compilerOptions.noImplicitUseStrict); + writeLine(); + write("var __moduleName = " + contextObjectForFile + " && " + contextObjectForFile + ".id;"); + writeLine(); emitEmitHelpers(node); emitCaptureThisForNodeIfNecessary(node); emitSystemModuleBody(node, dependencyGroups, startIndex); @@ -36586,23 +40686,17 @@ var ts; for (var _a = 0, _b = node.amdDependencies; _a < _b.length; _a++) { var amdDependency = _b[_a]; if (amdDependency.name) { - aliasedModuleNames.push("\"" + amdDependency.path + "\""); + aliasedModuleNames.push('"' + amdDependency.path + '"'); importAliasNames.push(amdDependency.name); } else { - unaliasedModuleNames.push("\"" + amdDependency.path + "\""); + unaliasedModuleNames.push('"' + amdDependency.path + '"'); } } for (var _c = 0, externalImports_4 = externalImports; _c < externalImports_4.length; _c++) { var importNode = externalImports_4[_c]; // Find the name of the external module - var externalModuleName = getExternalModuleNameText(importNode); - if (emitRelativePathAsModuleName) { - var name_30 = getExternalModuleNameFromDeclaration(host, resolver, importNode); - if (name_30) { - externalModuleName = "\"" + name_30 + "\""; - } - } + var externalModuleName = getExternalModuleNameText(importNode, emitRelativePathAsModuleName); // Find the name of the module alias, if there is one var importAliasName = getLocalNameForExternalImport(importNode); if (includeNonAmdDependencies && importAliasName) { @@ -36634,7 +40728,7 @@ var ts; } function emitAMDDependencyList(_a) { var aliasedModuleNames = _a.aliasedModuleNames, unaliasedModuleNames = _a.unaliasedModuleNames; - write("[\"require\", \"exports\""); + write('["require", "exports"'); if (aliasedModuleNames.length) { write(", "); write(aliasedModuleNames.join(", ")); @@ -36662,25 +40756,25 @@ var ts; writeModuleName(node, emitRelativePathAsModuleName); emitAMDDependencies(node, /*includeNonAmdDependencies*/ true, emitRelativePathAsModuleName); increaseIndent(); - var startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ true); + var startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ true, /*ensureUseStrict*/ !compilerOptions.noImplicitUseStrict); emitExportStarHelper(); emitCaptureThisForNodeIfNecessary(node); emitLinesStartingAt(node.statements, startIndex); - emitTempDeclarations(/*newLine*/ true); emitExportEquals(/*emitAsReturn*/ true); + emitTempDeclarations(/*newLine*/ true); decreaseIndent(); writeLine(); write("});"); } function emitCommonJSModule(node) { - var startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ false); + var startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ false, /*ensureUseStrict*/ !compilerOptions.noImplicitUseStrict); emitEmitHelpers(node); collectExternalModuleInfo(node); emitExportStarHelper(); emitCaptureThisForNodeIfNecessary(node); emitLinesStartingAt(node.statements, startIndex); - emitTempDeclarations(/*newLine*/ true); emitExportEquals(/*emitAsReturn*/ false); + emitTempDeclarations(/*newLine*/ true); } function emitUMDModule(node) { emitEmitHelpers(node); @@ -36693,12 +40787,12 @@ var ts; writeLines(" }\n})("); emitAMDFactoryHeader(dependencyNames); increaseIndent(); - var startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ true); + var startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ true, /*ensureUseStrict*/ !compilerOptions.noImplicitUseStrict); emitExportStarHelper(); emitCaptureThisForNodeIfNecessary(node); emitLinesStartingAt(node.statements, startIndex); - emitTempDeclarations(/*newLine*/ true); emitExportEquals(/*emitAsReturn*/ true); + emitTempDeclarations(/*newLine*/ true); decreaseIndent(); writeLine(); write("});"); @@ -36707,7 +40801,7 @@ var ts; externalImports = undefined; exportSpecifiers = undefined; exportEquals = undefined; - hasExportStars = false; + hasExportStarsToExportValues = false; var startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ false); emitEmitHelpers(node); emitCaptureThisForNodeIfNecessary(node); @@ -36770,7 +40864,9 @@ var ts; // Replace entities like   result = result.replace(/&(\w+);/g, function (s, m) { if (entities[m] !== undefined) { - return String.fromCharCode(entities[m]); + var ch = String.fromCharCode(entities[m]); + // " needs to be escaped + return ch === '"' ? "\\\"" : ch; } else { return s; @@ -36779,6 +40875,18 @@ var ts; } return result; } + function isJsxChildEmittable(child) { + if (child.kind === 248 /* JsxExpression */) { + // Don't emit empty expressions + return !!child.expression; + } + else if (child.kind === 244 /* JsxText */) { + // Don't emit empty strings + return !!getTextToEmit(child); + } + return true; + } + ; function getTextToEmit(node) { switch (compilerOptions.jsx) { case 2 /* React */: @@ -36797,9 +40905,9 @@ var ts; function emitJsxText(node) { switch (compilerOptions.jsx) { case 2 /* React */: - write("\""); + write('"'); write(trimReactWhitespaceAndApplyEntities(node)); - write("\""); + write('"'); break; case 1 /* Preserve */: default: @@ -36822,24 +40930,41 @@ var ts; } } } - function emitDirectivePrologues(statements, startWithNewLine) { - for (var i = 0; i < statements.length; ++i) { + function isUseStrictPrologue(node) { + return node.expression.text === "use strict"; + } + function ensureUseStrictPrologue(startWithNewLine, writeUseStrict) { + if (writeUseStrict) { + if (startWithNewLine) { + writeLine(); + } + write("\"use strict\";"); + } + } + function emitDirectivePrologues(statements, startWithNewLine, ensureUseStrict) { + var foundUseStrict = false; + for (var i = 0; i < statements.length; i++) { if (ts.isPrologueDirective(statements[i])) { + if (isUseStrictPrologue(statements[i])) { + foundUseStrict = true; + } if (startWithNewLine || i > 0) { writeLine(); } emit(statements[i]); } else { + ensureUseStrictPrologue(startWithNewLine || i > 0, !foundUseStrict && ensureUseStrict); // return index of the first non prologue directive return i; } } + ensureUseStrictPrologue(startWithNewLine, !foundUseStrict && ensureUseStrict); return statements.length; } function writeLines(text) { var lines = text.split(/\r\n|\r|\n/g); - for (var i = 0; i < lines.length; ++i) { + for (var i = 0; i < lines.length; i++) { var line = lines[i]; if (line.length) { writeLine(); @@ -36852,22 +40977,26 @@ var ts; if (!compilerOptions.noEmitHelpers) { // Only Emit __extends function when target ES5. // For target ES6 and above, we can emit classDeclaration as is. - if ((languageVersion < 2 /* ES6 */) && (!extendsEmitted && resolver.getNodeCheckFlags(node) & 8 /* EmitExtends */)) { + if (languageVersion < 2 /* ES6 */ && !extendsEmitted && node.flags & 262144 /* HasClassExtends */) { writeLines(extendsHelper); extendsEmitted = true; } - if (!decorateEmitted && resolver.getNodeCheckFlags(node) & 16 /* EmitDecorate */) { + if (compilerOptions.jsx !== 1 /* Preserve */ && !assignEmitted && (node.flags & 1073741824 /* HasJsxSpreadAttribute */)) { + writeLines(assignHelper); + assignEmitted = true; + } + if (!decorateEmitted && node.flags & 524288 /* HasDecorators */) { writeLines(decorateHelper); if (compilerOptions.emitDecoratorMetadata) { writeLines(metadataHelper); } decorateEmitted = true; } - if (!paramEmitted && resolver.getNodeCheckFlags(node) & 32 /* EmitParam */) { + if (!paramEmitted && node.flags & 1048576 /* HasParamDecorators */) { writeLines(paramHelper); paramEmitted = true; } - if (!awaiterEmitted && resolver.getNodeCheckFlags(node) & 64 /* EmitAwaiter */) { + if (!awaiterEmitted && node.flags & 2097152 /* HasAsyncFunctions */) { writeLines(awaiterHelper); awaiterEmitted = true; } @@ -36879,8 +41008,8 @@ var ts; emitShebang(); emitDetachedCommentsAndUpdateCommentsInfo(node); if (ts.isExternalModule(node) || compilerOptions.isolatedModules) { - if (root || (!ts.isExternalModule(node) && compilerOptions.isolatedModules)) { - var emitModule = moduleEmitDelegates[modulekind] || moduleEmitDelegates[1 /* CommonJS */]; + if (isOwnFileEmit || (!ts.isExternalModule(node) && compilerOptions.isolatedModules)) { + var emitModule = moduleEmitDelegates[modulekind] || moduleEmitDelegates[ts.ModuleKind.CommonJS]; emitModule(node); } else { @@ -36893,7 +41022,7 @@ var ts; externalImports = undefined; exportSpecifiers = undefined; exportEquals = undefined; - hasExportStars = false; + hasExportStarsToExportValues = false; emitEmitHelpers(node); emitCaptureThisForNodeIfNecessary(node); emitLinesStartingAt(node.statements, startIndex); @@ -36901,12 +41030,15 @@ var ts; } emitLeadingComments(node.endOfFileToken); } + function emit(node) { + emitNodeConsideringCommentsOption(node, emitNodeWithSourceMap); + } function emitNodeWithCommentsAndWithoutSourcemap(node) { emitNodeConsideringCommentsOption(node, emitNodeWithoutSourceMap); } function emitNodeConsideringCommentsOption(node, emitNodeConsideringSourcemap) { if (node) { - if (node.flags & 4 /* Ambient */) { + if (node.flags & 2 /* Ambient */) { return emitCommentsOnNotEmittedNode(node); } if (isSpecializedCommentHandling(node)) { @@ -36923,33 +41055,53 @@ var ts; } } } + function emitNodeWithSourceMap(node) { + if (node) { + emitStart(node); + emitNodeWithoutSourceMap(node); + emitEnd(node); + } + } function emitNodeWithoutSourceMap(node) { if (node) { emitJavaScriptWorker(node); } } + function changeSourceMapEmit(writer) { + sourceMap = writer; + emitStart = writer.emitStart; + emitEnd = writer.emitEnd; + emitPos = writer.emitPos; + setSourceFile = writer.setSourceFile; + } + function withTemporaryNoSourceMap(callback) { + var prevSourceMap = sourceMap; + setSourceMapWriterEmit(ts.getNullSourceMapWriter()); + callback(); + setSourceMapWriterEmit(prevSourceMap); + } function isSpecializedCommentHandling(node) { switch (node.kind) { // All of these entities are emitted in a specialized fashion. As such, we allow // the specialized methods for each to handle the comments on the nodes. - case 215 /* InterfaceDeclaration */: - case 213 /* FunctionDeclaration */: - case 222 /* ImportDeclaration */: - case 221 /* ImportEqualsDeclaration */: - case 216 /* TypeAliasDeclaration */: - case 227 /* ExportAssignment */: + case 222 /* InterfaceDeclaration */: + case 220 /* FunctionDeclaration */: + case 230 /* ImportDeclaration */: + case 229 /* ImportEqualsDeclaration */: + case 223 /* TypeAliasDeclaration */: + case 235 /* ExportAssignment */: return true; } } function shouldEmitLeadingAndTrailingComments(node) { switch (node.kind) { - case 193 /* VariableStatement */: + case 200 /* VariableStatement */: return shouldEmitLeadingAndTrailingCommentsForVariableStatement(node); - case 218 /* ModuleDeclaration */: + case 225 /* ModuleDeclaration */: // Only emit the leading/trailing comments for a module if we're actually // emitting the module as well. return shouldEmitModuleDeclaration(node); - case 217 /* EnumDeclaration */: + case 224 /* EnumDeclaration */: // Only emit the leading/trailing comments for an enum if we're actually // emitting the module as well. return shouldEmitEnumDeclaration(node); @@ -36961,11 +41113,11 @@ var ts; // then we don't want to emit comments when we emit the body. It will have already // been taken care of when we emitted the 'return' statement for the function // expression body. - if (node.kind !== 192 /* Block */ && + if (node.kind !== 199 /* Block */ && node.parent && - node.parent.kind === 174 /* ArrowFunction */ && + node.parent.kind === 180 /* ArrowFunction */ && node.parent.body === node && - compilerOptions.target <= 1 /* ES5 */) { + languageVersion <= 1 /* ES5 */) { return false; } // Emit comments for everything else. @@ -36976,13 +41128,13 @@ var ts; switch (node.kind) { case 69 /* Identifier */: return emitIdentifier(node); - case 138 /* Parameter */: + case 142 /* Parameter */: return emitParameter(node); - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: return emitMethod(node); - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: return emitAccessor(node); case 97 /* ThisKeyword */: return emitThis(node); @@ -37002,142 +41154,142 @@ var ts; case 13 /* TemplateMiddle */: case 14 /* TemplateTail */: return emitLiteral(node); - case 183 /* TemplateExpression */: + case 189 /* TemplateExpression */: return emitTemplateExpression(node); - case 190 /* TemplateSpan */: + case 197 /* TemplateSpan */: return emitTemplateSpan(node); - case 233 /* JsxElement */: - case 234 /* JsxSelfClosingElement */: + case 241 /* JsxElement */: + case 242 /* JsxSelfClosingElement */: return emitJsxElement(node); - case 236 /* JsxText */: + case 244 /* JsxText */: return emitJsxText(node); - case 240 /* JsxExpression */: + case 248 /* JsxExpression */: return emitJsxExpression(node); - case 135 /* QualifiedName */: + case 139 /* QualifiedName */: return emitQualifiedName(node); - case 161 /* ObjectBindingPattern */: + case 167 /* ObjectBindingPattern */: return emitObjectBindingPattern(node); - case 162 /* ArrayBindingPattern */: + case 168 /* ArrayBindingPattern */: return emitArrayBindingPattern(node); - case 163 /* BindingElement */: + case 169 /* BindingElement */: return emitBindingElement(node); - case 164 /* ArrayLiteralExpression */: + case 170 /* ArrayLiteralExpression */: return emitArrayLiteral(node); - case 165 /* ObjectLiteralExpression */: + case 171 /* ObjectLiteralExpression */: return emitObjectLiteral(node); - case 245 /* PropertyAssignment */: + case 253 /* PropertyAssignment */: return emitPropertyAssignment(node); - case 246 /* ShorthandPropertyAssignment */: + case 254 /* ShorthandPropertyAssignment */: return emitShorthandPropertyAssignment(node); - case 136 /* ComputedPropertyName */: + case 140 /* ComputedPropertyName */: return emitComputedPropertyName(node); - case 166 /* PropertyAccessExpression */: + case 172 /* PropertyAccessExpression */: return emitPropertyAccess(node); - case 167 /* ElementAccessExpression */: + case 173 /* ElementAccessExpression */: return emitIndexedAccess(node); - case 168 /* CallExpression */: + case 174 /* CallExpression */: return emitCallExpression(node); - case 169 /* NewExpression */: + case 175 /* NewExpression */: return emitNewExpression(node); - case 170 /* TaggedTemplateExpression */: + case 176 /* TaggedTemplateExpression */: return emitTaggedTemplateExpression(node); - case 171 /* TypeAssertionExpression */: + case 177 /* TypeAssertionExpression */: + case 195 /* AsExpression */: + case 196 /* NonNullExpression */: return emit(node.expression); - case 189 /* AsExpression */: - return emit(node.expression); - case 172 /* ParenthesizedExpression */: + case 178 /* ParenthesizedExpression */: return emitParenExpression(node); - case 213 /* FunctionDeclaration */: - case 173 /* FunctionExpression */: - case 174 /* ArrowFunction */: + case 220 /* FunctionDeclaration */: + case 179 /* FunctionExpression */: + case 180 /* ArrowFunction */: return emitFunctionDeclaration(node); - case 175 /* DeleteExpression */: + case 181 /* DeleteExpression */: return emitDeleteExpression(node); - case 176 /* TypeOfExpression */: + case 182 /* TypeOfExpression */: return emitTypeOfExpression(node); - case 177 /* VoidExpression */: + case 183 /* VoidExpression */: return emitVoidExpression(node); - case 178 /* AwaitExpression */: + case 184 /* AwaitExpression */: return emitAwaitExpression(node); - case 179 /* PrefixUnaryExpression */: + case 185 /* PrefixUnaryExpression */: return emitPrefixUnaryExpression(node); - case 180 /* PostfixUnaryExpression */: + case 186 /* PostfixUnaryExpression */: return emitPostfixUnaryExpression(node); - case 181 /* BinaryExpression */: + case 187 /* BinaryExpression */: return emitBinaryExpression(node); - case 182 /* ConditionalExpression */: + case 188 /* ConditionalExpression */: return emitConditionalExpression(node); - case 185 /* SpreadElementExpression */: + case 191 /* SpreadElementExpression */: return emitSpreadElementExpression(node); - case 184 /* YieldExpression */: + case 190 /* YieldExpression */: return emitYieldExpression(node); - case 187 /* OmittedExpression */: + case 193 /* OmittedExpression */: return; - case 192 /* Block */: - case 219 /* ModuleBlock */: + case 199 /* Block */: + case 226 /* ModuleBlock */: return emitBlock(node); - case 193 /* VariableStatement */: + case 200 /* VariableStatement */: return emitVariableStatement(node); - case 194 /* EmptyStatement */: + case 201 /* EmptyStatement */: return write(";"); - case 195 /* ExpressionStatement */: + case 202 /* ExpressionStatement */: return emitExpressionStatement(node); - case 196 /* IfStatement */: + case 203 /* IfStatement */: return emitIfStatement(node); - case 197 /* DoStatement */: + case 204 /* DoStatement */: return emitDoStatement(node); - case 198 /* WhileStatement */: + case 205 /* WhileStatement */: return emitWhileStatement(node); - case 199 /* ForStatement */: + case 206 /* ForStatement */: return emitForStatement(node); - case 201 /* ForOfStatement */: - case 200 /* ForInStatement */: + case 208 /* ForOfStatement */: + case 207 /* ForInStatement */: return emitForInOrForOfStatement(node); - case 202 /* ContinueStatement */: - case 203 /* BreakStatement */: + case 209 /* ContinueStatement */: + case 210 /* BreakStatement */: return emitBreakOrContinueStatement(node); - case 204 /* ReturnStatement */: + case 211 /* ReturnStatement */: return emitReturnStatement(node); - case 205 /* WithStatement */: + case 212 /* WithStatement */: return emitWithStatement(node); - case 206 /* SwitchStatement */: + case 213 /* SwitchStatement */: return emitSwitchStatement(node); - case 241 /* CaseClause */: - case 242 /* DefaultClause */: + case 249 /* CaseClause */: + case 250 /* DefaultClause */: return emitCaseOrDefaultClause(node); - case 207 /* LabeledStatement */: + case 214 /* LabeledStatement */: return emitLabeledStatement(node); - case 208 /* ThrowStatement */: + case 215 /* ThrowStatement */: return emitThrowStatement(node); - case 209 /* TryStatement */: + case 216 /* TryStatement */: return emitTryStatement(node); - case 244 /* CatchClause */: + case 252 /* CatchClause */: return emitCatchClause(node); - case 210 /* DebuggerStatement */: + case 217 /* DebuggerStatement */: return emitDebuggerStatement(node); - case 211 /* VariableDeclaration */: + case 218 /* VariableDeclaration */: return emitVariableDeclaration(node); - case 186 /* ClassExpression */: + case 192 /* ClassExpression */: return emitClassExpression(node); - case 214 /* ClassDeclaration */: + case 221 /* ClassDeclaration */: return emitClassDeclaration(node); - case 215 /* InterfaceDeclaration */: + case 222 /* InterfaceDeclaration */: return emitInterfaceDeclaration(node); - case 217 /* EnumDeclaration */: + case 224 /* EnumDeclaration */: return emitEnumDeclaration(node); - case 247 /* EnumMember */: + case 255 /* EnumMember */: return emitEnumMember(node); - case 218 /* ModuleDeclaration */: + case 225 /* ModuleDeclaration */: return emitModuleDeclaration(node); - case 222 /* ImportDeclaration */: + case 230 /* ImportDeclaration */: return emitImportDeclaration(node); - case 221 /* ImportEqualsDeclaration */: + case 229 /* ImportEqualsDeclaration */: return emitImportEqualsDeclaration(node); - case 228 /* ExportDeclaration */: + case 236 /* ExportDeclaration */: return emitExportDeclaration(node); - case 227 /* ExportAssignment */: + case 235 /* ExportAssignment */: return emitExportAssignment(node); - case 248 /* SourceFile */: + case 256 /* SourceFile */: return emitSourceFileNode(node); } } @@ -37176,7 +41328,7 @@ var ts; function getLeadingCommentsToEmit(node) { // Emit the leading comments only if the parent's pos doesn't match because parent should take care of emitting these comments if (node.parent) { - if (node.parent.kind === 248 /* SourceFile */ || node.pos !== node.parent.pos) { + if (node.parent.kind === 256 /* SourceFile */ || node.pos !== node.parent.pos) { if (hasDetachedComments(node.pos)) { // get comments without detached comments return getLeadingCommentsWithoutDetachedComments(); @@ -37191,7 +41343,7 @@ var ts; function getTrailingCommentsToEmit(node) { // Emit the trailing comments only if the parent's pos doesn't match because parent should take care of emitting these comments if (node.parent) { - if (node.parent.kind === 248 /* SourceFile */ || node.end !== node.parent.end) { + if (node.parent.kind === 256 /* SourceFile */ || node.end !== node.parent.end) { return ts.getTrailingCommentRanges(currentText, node.end); } } @@ -37200,10 +41352,10 @@ var ts; * Emit comments associated with node that will not be emitted into JS file */ function emitCommentsOnNotEmittedNode(node) { - emitLeadingCommentsWorker(node, /*isEmittedNode:*/ false); + emitLeadingCommentsWorker(node, /*isEmittedNode*/ false); } function emitLeadingComments(node) { - return emitLeadingCommentsWorker(node, /*isEmittedNode:*/ true); + return emitLeadingCommentsWorker(node, /*isEmittedNode*/ true); } function emitLeadingCommentsWorker(node, isEmittedNode) { if (compilerOptions.removeComments) { @@ -37221,14 +41373,14 @@ var ts; // declare var x; // /// // interface F {} - // The first /// will NOT be removed while the second one will be removed eventhough both node will not be emitted + // The first /// will NOT be removed while the second one will be removed even though both node will not be emitted if (node.pos === 0) { leadingComments = ts.filter(getLeadingCommentsToEmit(node), isTripleSlashComment); } } ts.emitNewLineBeforeLeadingComments(currentLineMap, writer, node, leadingComments); // Leading comments are emitted at /*leading comment1 */space/*leading comment*/space - ts.emitComments(currentText, currentLineMap, writer, leadingComments, /*trailingSeparator:*/ true, newLine, writeComment); + ts.emitComments(currentText, currentLineMap, writer, leadingComments, /*trailingSeparator*/ true, newLine, writeComment); } function emitTrailingComments(node) { if (compilerOptions.removeComments) { @@ -37280,18 +41432,40 @@ var ts; } } } + function writeComment(text, lineMap, writer, comment, newLine) { + emitPos(comment.pos); + ts.writeCommentRange(text, lineMap, writer, comment, newLine); + emitPos(comment.end); + } function emitShebang() { var shebang = ts.getShebang(currentText); if (shebang) { write(shebang); + writeLine(); } } var _a, _b; } - function emitFile(jsFilePath, sourceFile) { - emitJavaScript(jsFilePath, sourceFile); - if (compilerOptions.declaration) { - ts.writeDeclarationFile(jsFilePath, sourceFile, host, resolver, diagnostics); + function emitFile(_a, sourceFiles, isBundledEmit) { + var jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath; + // Make sure not to write js File and source map file if any of them cannot be written + if (!host.isEmitBlocked(jsFilePath) && !compilerOptions.noEmit) { + emitJavaScript(jsFilePath, sourceMapFilePath, sourceFiles, isBundledEmit); + } + else { + emitSkipped = true; + } + if (declarationFilePath) { + emitSkipped = ts.writeDeclarationFile(declarationFilePath, sourceFiles, isBundledEmit, host, resolver, emitterDiagnostics) || emitSkipped; + } + if (!emitSkipped && emittedFilesList) { + emittedFilesList.push(jsFilePath); + if (sourceMapFilePath) { + emittedFilesList.push(sourceMapFilePath); + } + if (declarationFilePath) { + emittedFilesList.push(declarationFilePath); + } } } } @@ -37308,11 +41482,16 @@ var ts; /* @internal */ ts.ioWriteTime = 0; /** The version of the TypeScript compiler release */ var emptyArray = []; - ts.version = "1.8.0"; - function findConfigFile(searchPath) { - var fileName = "tsconfig.json"; + var defaultLibrarySearchPaths = [ + "types/", + "node_modules/", + "node_modules/@types/", + ]; + ts.version = "1.9.0"; + function findConfigFile(searchPath, fileExists) { while (true) { - if (ts.sys.fileExists(fileName)) { + var fileName = ts.combinePaths(searchPath, "tsconfig.json"); + if (fileExists(fileName)) { return fileName; } var parentPath = ts.getDirectoryPath(searchPath); @@ -37320,7 +41499,6 @@ var ts; break; } searchPath = parentPath; - fileName = "../" + fileName; } return undefined; } @@ -37331,88 +41509,590 @@ var ts; return ts.normalizePath(referencedFileName); } ts.resolveTripleslashReference = resolveTripleslashReference; - function resolveModuleName(moduleName, containingFile, compilerOptions, host) { - var moduleResolution = compilerOptions.moduleResolution !== undefined - ? compilerOptions.moduleResolution - : compilerOptions.module === 1 /* CommonJS */ ? 2 /* NodeJs */ : 1 /* Classic */; - switch (moduleResolution) { - case 2 /* NodeJs */: return nodeModuleNameResolver(moduleName, containingFile, host); - case 1 /* Classic */: return classicNameResolver(moduleName, containingFile, compilerOptions, host); - } - } - ts.resolveModuleName = resolveModuleName; - function nodeModuleNameResolver(moduleName, containingFile, host) { - var containingDirectory = ts.getDirectoryPath(containingFile); - if (ts.getRootLength(moduleName) !== 0 || nameStartsWithDotSlashOrDotDotSlash(moduleName)) { - var failedLookupLocations = []; - var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); - var resolvedFileName = loadNodeModuleFromFile(ts.supportedJsExtensions, candidate, failedLookupLocations, host); - if (resolvedFileName) { - return { resolvedModule: { resolvedFileName: resolvedFileName }, failedLookupLocations: failedLookupLocations }; + /* @internal */ + function computeCommonSourceDirectoryOfFilenames(fileNames, currentDirectory, getCanonicalFileName) { + var commonPathComponents; + var failed = ts.forEach(fileNames, function (sourceFile) { + // Each file contributes into common source file path + var sourcePathComponents = ts.getNormalizedPathComponents(sourceFile, currentDirectory); + sourcePathComponents.pop(); // The base file name is not part of the common directory path + if (!commonPathComponents) { + // first file + commonPathComponents = sourcePathComponents; + return; + } + for (var i = 0, n = Math.min(commonPathComponents.length, sourcePathComponents.length); i < n; i++) { + if (getCanonicalFileName(commonPathComponents[i]) !== getCanonicalFileName(sourcePathComponents[i])) { + if (i === 0) { + // Failed to find any common path component + return true; + } + // New common path found that is 0 -> i-1 + commonPathComponents.length = i; + break; + } + } + // If the sourcePathComponents was shorter than the commonPathComponents, truncate to the sourcePathComponents + if (sourcePathComponents.length < commonPathComponents.length) { + commonPathComponents.length = sourcePathComponents.length; + } + }); + // A common path can not be found when paths span multiple drives on windows, for example + if (failed) { + return ""; + } + if (!commonPathComponents) { + return currentDirectory; + } + return ts.getNormalizedPathFromPathComponents(commonPathComponents); + } + ts.computeCommonSourceDirectoryOfFilenames = computeCommonSourceDirectoryOfFilenames; + function trace(host, message) { + host.trace(ts.formatMessage.apply(undefined, arguments)); + } + function isTraceEnabled(compilerOptions, host) { + return compilerOptions.traceResolution && host.trace !== undefined; + } + function hasZeroOrOneAsteriskCharacter(str) { + var seenAsterisk = false; + for (var i = 0; i < str.length; i++) { + if (str.charCodeAt(i) === 42 /* asterisk */) { + if (!seenAsterisk) { + seenAsterisk = true; + } + else { + // have already seen asterisk + return false; + } + } + } + return true; + } + function createResolvedModule(resolvedFileName, isExternalLibraryImport, failedLookupLocations) { + return { resolvedModule: resolvedFileName ? { resolvedFileName: resolvedFileName, isExternalLibraryImport: isExternalLibraryImport } : undefined, failedLookupLocations: failedLookupLocations }; + } + function moduleHasNonRelativeName(moduleName) { + if (ts.isRootedDiskPath(moduleName)) { + return false; + } + var i = moduleName.lastIndexOf("./", 1); + var startsWithDotSlashOrDotDotSlash = i === 0 || (i === 1 && moduleName.charCodeAt(0) === 46 /* dot */); + return !startsWithDotSlashOrDotDotSlash; + } + function tryReadTypesSection(packageJsonPath, baseDirectory, state) { + var jsonContent; + try { + var jsonText = state.host.readFile(packageJsonPath); + jsonContent = jsonText ? JSON.parse(jsonText) : {}; + } + catch (e) { + // gracefully handle if readFile fails or returns not JSON + jsonContent = {}; + } + var typesFile; + var fieldName; + // first try to read content of 'typings' section (backward compatibility) + if (jsonContent.typings) { + if (typeof jsonContent.typings === "string") { + fieldName = "typings"; + typesFile = jsonContent.typings; + } + else { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Expected_type_of_0_field_in_package_json_to_be_string_got_1, "typings", typeof jsonContent.typings); + } + } + } + // then read 'types' + if (!typesFile && jsonContent.types) { + if (typeof jsonContent.types === "string") { + fieldName = "types"; + typesFile = jsonContent.types; + } + else { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Expected_type_of_0_field_in_package_json_to_be_string_got_1, "types", typeof jsonContent.types); + } + } + } + if (typesFile) { + var typesFilePath = ts.normalizePath(ts.combinePaths(baseDirectory, typesFile)); + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.package_json_has_0_field_1_that_references_2, fieldName, typesFile, typesFilePath); + } + return typesFilePath; + } + return undefined; + } + var typeReferenceExtensions = [".d.ts"]; + /** + * @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, containingFile, options, host) { + var traceEnabled = isTraceEnabled(options, host); + var moduleResolutionState = { + compilerOptions: options, + host: host, + skipTsx: true, + traceEnabled: traceEnabled + }; + // use typesRoot and fallback to directory that contains tsconfig if typesRoot is not set + var rootDir = options.typesRoot || (options.configFilePath ? ts.getDirectoryPath(options.configFilePath) : undefined); + if (traceEnabled) { + if (containingFile === undefined) { + if (rootDir === undefined) { + trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set, typeReferenceDirectiveName); + } + else { + trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1, typeReferenceDirectiveName, rootDir); + } + } + else { + if (rootDir === undefined) { + trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set, typeReferenceDirectiveName, containingFile); + } + else { + trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_1_root_directory_2, typeReferenceDirectiveName, containingFile, rootDir); + } + } + } + var failedLookupLocations = []; + // Check primary library paths + if (rootDir !== undefined) { + var effectivePrimarySearchPaths = options.typesSearchPaths || defaultLibrarySearchPaths; + for (var _i = 0, effectivePrimarySearchPaths_1 = effectivePrimarySearchPaths; _i < effectivePrimarySearchPaths_1.length; _i++) { + var searchPath = effectivePrimarySearchPaths_1[_i]; + var primaryPath = ts.combinePaths(rootDir, searchPath); + if (traceEnabled) { + trace(host, ts.Diagnostics.Resolving_with_primary_search_path_0, primaryPath); + } + var candidate = ts.combinePaths(primaryPath, typeReferenceDirectiveName); + var candidateDirectory = ts.getDirectoryPath(candidate); + var resolvedFile_1 = loadNodeModuleFromDirectory(typeReferenceExtensions, candidate, failedLookupLocations, !directoryProbablyExists(candidateDirectory, host), moduleResolutionState); + if (resolvedFile_1) { + if (traceEnabled) { + trace(host, ts.Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2, typeReferenceDirectiveName, resolvedFile_1, true); + } + return { + resolvedTypeReferenceDirective: { primary: true, resolvedFileName: resolvedFile_1 }, + failedLookupLocations: failedLookupLocations + }; + } } - resolvedFileName = loadNodeModuleFromDirectory(ts.supportedJsExtensions, candidate, failedLookupLocations, host); - return resolvedFileName - ? { resolvedModule: { resolvedFileName: resolvedFileName }, failedLookupLocations: failedLookupLocations } - : { resolvedModule: undefined, failedLookupLocations: failedLookupLocations }; } else { - return loadModuleFromNodeModules(moduleName, containingDirectory, host); + if (traceEnabled) { + trace(host, ts.Diagnostics.Root_directory_cannot_be_determined_skipping_primary_search_paths); + } + } + var resolvedFile; + var initialLocationForSecondaryLookup; + if (containingFile) { + initialLocationForSecondaryLookup = ts.getDirectoryPath(containingFile); + } + else { + initialLocationForSecondaryLookup = rootDir; + } + if (initialLocationForSecondaryLookup !== undefined) { + // check secondary locations + if (traceEnabled) { + trace(host, ts.Diagnostics.Looking_up_in_node_modules_folder_initial_location_0, initialLocationForSecondaryLookup); + } + resolvedFile = loadModuleFromNodeModules(typeReferenceDirectiveName, initialLocationForSecondaryLookup, failedLookupLocations, moduleResolutionState); + if (traceEnabled) { + if (resolvedFile) { + trace(host, ts.Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2, typeReferenceDirectiveName, resolvedFile, false); + } + else { + trace(host, ts.Diagnostics.Type_reference_directive_0_was_not_resolved, typeReferenceDirectiveName); + } + } + } + else { + if (traceEnabled) { + trace(host, ts.Diagnostics.Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_modules_folder); + } + } + return { + resolvedTypeReferenceDirective: resolvedFile + ? { primary: false, resolvedFileName: resolvedFile } + : undefined, + failedLookupLocations: failedLookupLocations + }; + } + ts.resolveTypeReferenceDirective = resolveTypeReferenceDirective; + function resolveModuleName(moduleName, containingFile, compilerOptions, host) { + var traceEnabled = isTraceEnabled(compilerOptions, host); + if (traceEnabled) { + trace(host, ts.Diagnostics.Resolving_module_0_from_1, moduleName, containingFile); + } + var moduleResolution = compilerOptions.moduleResolution; + if (moduleResolution === undefined) { + moduleResolution = ts.getEmitModuleKind(compilerOptions) === ts.ModuleKind.CommonJS ? ts.ModuleResolutionKind.NodeJs : ts.ModuleResolutionKind.Classic; + if (traceEnabled) { + trace(host, ts.Diagnostics.Module_resolution_kind_is_not_specified_using_0, ts.ModuleResolutionKind[moduleResolution]); + } + } + else { + if (traceEnabled) { + trace(host, ts.Diagnostics.Explicitly_specified_module_resolution_kind_Colon_0, ts.ModuleResolutionKind[moduleResolution]); + } + } + var result; + switch (moduleResolution) { + case ts.ModuleResolutionKind.NodeJs: + result = nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host); + break; + case ts.ModuleResolutionKind.Classic: + result = classicNameResolver(moduleName, containingFile, compilerOptions, host); + break; + } + if (traceEnabled) { + if (result.resolvedModule) { + trace(host, ts.Diagnostics.Module_name_0_was_successfully_resolved_to_1, moduleName, result.resolvedModule.resolvedFileName); + } + else { + trace(host, ts.Diagnostics.Module_name_0_was_not_resolved, moduleName); + } + } + return result; + } + ts.resolveModuleName = resolveModuleName; + /** + * Any module resolution kind can be augmented with optional settings: 'baseUrl', 'paths' and 'rootDirs' - they are used to + * mitigate differences between design time structure of the project and its runtime counterpart so the same import name + * can be resolved successfully by TypeScript compiler and runtime module loader. + * If these settings are set then loading procedure will try to use them to resolve module name and it can of failure it will + * fallback to standard resolution routine. + * + * - baseUrl - this setting controls how non-relative module names are resolved. If this setting is specified then non-relative + * names will be resolved relative to baseUrl: i.e. if baseUrl is '/a/b' then candidate location to resolve module name 'c/d' will + * be '/a/b/c/d' + * - paths - this setting can only be used when baseUrl is specified. allows to tune how non-relative module names + * will be resolved based on the content of the module name. + * Structure of 'paths' compiler options + * 'paths': { + * pattern-1: [...substitutions], + * pattern-2: [...substitutions], + * ... + * pattern-n: [...substitutions] + * } + * Pattern here is a string that can contain zero or one '*' character. During module resolution module name will be matched against + * all patterns in the list. Matching for patterns that don't contain '*' means that module name must be equal to pattern respecting the case. + * If pattern contains '*' then to match pattern "*" module name must start with the and end with . + * denotes part of the module name between and . + * If module name can be matches with multiple patterns then pattern with the longest prefix will be picked. + * After selecting pattern we'll use list of substitutions to get candidate locations of the module and the try to load module + * from the candidate location. + * Substitution is a string that can contain zero or one '*'. To get candidate location from substitution we'll pick every + * substitution in the list and replace '*' with string. If candidate location is not rooted it + * will be converted to absolute using baseUrl. + * For example: + * baseUrl: /a/b/c + * "paths": { + * // match all module names + * "*": [ + * "*", // use matched name as is, + * // will be looked as /a/b/c/ + * + * "folder1/*" // substitution will convert matched name to 'folder1/', + * // since it is not rooted then final candidate location will be /a/b/c/folder1/ + * ], + * // match module names that start with 'components/' + * "components/*": [ "/root/components/*" ] // substitution will convert /components/folder1/ to '/root/components/folder1/', + * // it is rooted so it will be final candidate location + * } + * + * 'rootDirs' allows the project to be spreaded across multiple locations and resolve modules with relative names as if + * they were in the same location. For example lets say there are two files + * '/local/src/content/file1.ts' + * '/shared/components/contracts/src/content/protocols/file2.ts' + * After bundling content of '/shared/components/contracts/src' will be merged with '/local/src' so + * if file1 has the following import 'import {x} from "./protocols/file2"' it will be resolved successfully in runtime. + * 'rootDirs' provides the way to tell compiler that in order to get the whole project it should behave as if content of all + * root dirs were merged together. + * I.e. for the example above 'rootDirs' will have two entries: [ '/local/src', '/shared/components/contracts/src' ]. + * Compiler will first convert './protocols/file2' into absolute path relative to the location of containing file: + * '/local/src/content/protocols/file2' and try to load it - failure. + * Then it will search 'rootDirs' looking for a longest matching prefix of this absolute path and if such prefix is found - absolute path will + * be converted to a path relative to found rootDir entry './content/protocols/file2' (*). As a last step compiler will check all remaining + * entries in 'rootDirs', use them to build absolute path out of (*) and try to resolve module from this location. + */ + function tryLoadModuleUsingOptionalResolutionSettings(moduleName, containingDirectory, loader, failedLookupLocations, supportedExtensions, state) { + if (moduleHasNonRelativeName(moduleName)) { + return tryLoadModuleUsingBaseUrl(moduleName, loader, failedLookupLocations, supportedExtensions, state); + } + else { + return tryLoadModuleUsingRootDirs(moduleName, containingDirectory, loader, failedLookupLocations, supportedExtensions, state); } } + function tryLoadModuleUsingRootDirs(moduleName, containingDirectory, loader, failedLookupLocations, supportedExtensions, state) { + if (!state.compilerOptions.rootDirs) { + return undefined; + } + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0, moduleName); + } + var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); + var matchedRootDir; + var matchedNormalizedPrefix; + for (var _i = 0, _a = state.compilerOptions.rootDirs; _i < _a.length; _i++) { + var rootDir = _a[_i]; + // rootDirs are expected to be absolute + // in case of tsconfig.json this will happen automatically - compiler will expand relative names + // using location of tsconfig.json as base location + var normalizedRoot = ts.normalizePath(rootDir); + if (!ts.endsWith(normalizedRoot, ts.directorySeparator)) { + normalizedRoot += ts.directorySeparator; + } + var isLongestMatchingPrefix = ts.startsWith(candidate, normalizedRoot) && + (matchedNormalizedPrefix === undefined || matchedNormalizedPrefix.length < normalizedRoot.length); + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Checking_if_0_is_the_longest_matching_prefix_for_1_2, normalizedRoot, candidate, isLongestMatchingPrefix); + } + if (isLongestMatchingPrefix) { + matchedNormalizedPrefix = normalizedRoot; + matchedRootDir = rootDir; + } + } + if (matchedNormalizedPrefix) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Longest_matching_prefix_for_0_is_1, candidate, matchedNormalizedPrefix); + } + var suffix = candidate.substr(matchedNormalizedPrefix.length); + // first - try to load from a initial location + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Loading_0_from_the_root_dir_1_candidate_location_2, suffix, matchedNormalizedPrefix, candidate); + } + var resolvedFileName = loader(candidate, supportedExtensions, failedLookupLocations, !directoryProbablyExists(containingDirectory, state.host), state); + if (resolvedFileName) { + return resolvedFileName; + } + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Trying_other_entries_in_rootDirs); + } + // then try to resolve using remaining entries in rootDirs + for (var _b = 0, _c = state.compilerOptions.rootDirs; _b < _c.length; _b++) { + var rootDir = _c[_b]; + if (rootDir === matchedRootDir) { + // skip the initially matched entry + continue; + } + var candidate_1 = ts.combinePaths(ts.normalizePath(rootDir), suffix); + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Loading_0_from_the_root_dir_1_candidate_location_2, suffix, rootDir, candidate_1); + } + var baseDirectory = ts.getDirectoryPath(candidate_1); + var resolvedFileName_1 = loader(candidate_1, supportedExtensions, failedLookupLocations, !directoryProbablyExists(baseDirectory, state.host), state); + if (resolvedFileName_1) { + return resolvedFileName_1; + } + } + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Module_resolution_using_rootDirs_has_failed); + } + } + return undefined; + } + function tryLoadModuleUsingBaseUrl(moduleName, loader, failedLookupLocations, supportedExtensions, state) { + if (!state.compilerOptions.baseUrl) { + return undefined; + } + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1, state.compilerOptions.baseUrl, moduleName); + } + var longestMatchPrefixLength = -1; + var matchedPattern; + var matchedStar; + if (state.compilerOptions.paths) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.paths_option_is_specified_looking_for_a_pattern_to_match_module_name_0, moduleName); + } + for (var key in state.compilerOptions.paths) { + var pattern = key; + var indexOfStar = pattern.indexOf("*"); + if (indexOfStar !== -1) { + var prefix = pattern.substr(0, indexOfStar); + var suffix = pattern.substr(indexOfStar + 1); + if (moduleName.length >= prefix.length + suffix.length && + ts.startsWith(moduleName, prefix) && + ts.endsWith(moduleName, suffix)) { + // use length of prefix as betterness criteria + if (prefix.length > longestMatchPrefixLength) { + longestMatchPrefixLength = prefix.length; + matchedPattern = pattern; + matchedStar = moduleName.substr(prefix.length, moduleName.length - suffix.length); + } + } + } + else if (pattern === moduleName) { + // pattern was matched as is - no need to search further + matchedPattern = pattern; + matchedStar = undefined; + break; + } + } + } + if (matchedPattern) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Module_name_0_matched_pattern_1, moduleName, matchedPattern); + } + for (var _i = 0, _a = state.compilerOptions.paths[matchedPattern]; _i < _a.length; _i++) { + var subst = _a[_i]; + var path = matchedStar ? subst.replace("\*", matchedStar) : subst; + var candidate = ts.normalizePath(ts.combinePaths(state.compilerOptions.baseUrl, path)); + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Trying_substitution_0_candidate_module_location_Colon_1, subst, path); + } + var resolvedFileName = loader(candidate, supportedExtensions, failedLookupLocations, !directoryProbablyExists(ts.getDirectoryPath(candidate), state.host), state); + if (resolvedFileName) { + return resolvedFileName; + } + } + return undefined; + } + else { + var candidate = ts.normalizePath(ts.combinePaths(state.compilerOptions.baseUrl, moduleName)); + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Resolving_module_name_0_relative_to_base_url_1_2, moduleName, state.compilerOptions.baseUrl, candidate); + } + return loader(candidate, supportedExtensions, failedLookupLocations, !directoryProbablyExists(ts.getDirectoryPath(candidate), state.host), state); + } + } + function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host) { + var containingDirectory = ts.getDirectoryPath(containingFile); + var supportedExtensions = ts.getSupportedExtensions(compilerOptions); + var traceEnabled = isTraceEnabled(compilerOptions, host); + var failedLookupLocations = []; + var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled, skipTsx: false }; + var resolvedFileName = tryLoadModuleUsingOptionalResolutionSettings(moduleName, containingDirectory, nodeLoadModuleByRelativeName, failedLookupLocations, supportedExtensions, state); + var isExternalLibraryImport = false; + if (!resolvedFileName) { + if (moduleHasNonRelativeName(moduleName)) { + if (traceEnabled) { + trace(host, ts.Diagnostics.Loading_module_0_from_node_modules_folder, moduleName); + } + resolvedFileName = loadModuleFromNodeModules(moduleName, containingDirectory, failedLookupLocations, state); + isExternalLibraryImport = resolvedFileName !== undefined; + } + else { + var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); + resolvedFileName = nodeLoadModuleByRelativeName(candidate, supportedExtensions, failedLookupLocations, /*onlyRecordFailures*/ false, state); + } + } + if (resolvedFileName && host.realpath) { + var originalFileName = resolvedFileName; + resolvedFileName = ts.normalizePath(host.realpath(resolvedFileName)); + if (traceEnabled) { + trace(host, ts.Diagnostics.Resolving_real_path_for_0_result_1, originalFileName, resolvedFileName); + } + } + return createResolvedModule(resolvedFileName, isExternalLibraryImport, failedLookupLocations); + } ts.nodeModuleNameResolver = nodeModuleNameResolver; - function loadNodeModuleFromFile(extensions, candidate, failedLookupLocation, host) { + function nodeLoadModuleByRelativeName(candidate, supportedExtensions, failedLookupLocations, onlyRecordFailures, state) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Loading_module_as_file_Slash_folder_candidate_module_location_0, candidate); + } + var resolvedFileName = loadModuleFromFile(candidate, supportedExtensions, failedLookupLocations, onlyRecordFailures, state); + return resolvedFileName || loadNodeModuleFromDirectory(supportedExtensions, candidate, failedLookupLocations, onlyRecordFailures, state); + } + /* @internal */ + function directoryProbablyExists(directoryName, host) { + // if host does not support 'directoryExists' assume that directory will exist + return !host.directoryExists || host.directoryExists(directoryName); + } + ts.directoryProbablyExists = directoryProbablyExists; + /** + * @param {boolean} onlyRecordFailures - if true then function won't try to actually load files but instead record all attempts as failures. This flag is necessary + * in cases when we know upfront that all load attempts will fail (because containing folder does not exists) however we still need to record all failed lookup locations. + */ + function loadModuleFromFile(candidate, extensions, failedLookupLocation, onlyRecordFailures, state) { + if (!onlyRecordFailures) { + // check if containig folder exists - if it doesn't then just record failures for all supported extensions without disk probing + var directory = ts.getDirectoryPath(candidate); + if (directory) { + onlyRecordFailures = !directoryProbablyExists(directory, state.host); + } + } return ts.forEach(extensions, tryLoad); function tryLoad(ext) { + if (ext === ".tsx" && state.skipTsx) { + return undefined; + } var fileName = ts.fileExtensionIs(candidate, ext) ? candidate : candidate + ext; - if (host.fileExists(fileName)) { + if (!onlyRecordFailures && state.host.fileExists(fileName)) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.File_0_exist_use_it_as_a_name_resolution_result, fileName); + } return fileName; } else { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.File_0_does_not_exist, fileName); + } failedLookupLocation.push(fileName); return undefined; } } } - function loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocation, host) { + function loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocation, onlyRecordFailures, state) { var packageJsonPath = ts.combinePaths(candidate, "package.json"); - if (host.fileExists(packageJsonPath)) { - var jsonContent; - try { - var jsonText = host.readFile(packageJsonPath); - jsonContent = jsonText ? JSON.parse(jsonText) : { typings: undefined }; + var directoryExists = !onlyRecordFailures && directoryProbablyExists(candidate, state.host); + if (directoryExists && state.host.fileExists(packageJsonPath)) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Found_package_json_at_0, packageJsonPath); } - catch (e) { - // gracefully handle if readFile fails or returns not JSON - jsonContent = { typings: undefined }; - } - if (jsonContent.typings) { - var result = loadNodeModuleFromFile(extensions, ts.normalizePath(ts.combinePaths(candidate, jsonContent.typings)), failedLookupLocation, host); + var typesFile = tryReadTypesSection(packageJsonPath, candidate, state); + if (typesFile) { + var result = loadModuleFromFile(typesFile, extensions, failedLookupLocation, !directoryProbablyExists(ts.getDirectoryPath(typesFile), state.host), state); if (result) { return result; } } + else { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.package_json_does_not_have_types_field); + } + } } else { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.File_0_does_not_exist, packageJsonPath); + } // record package json as one of failed lookup locations - in the future if this file will appear it will invalidate resolution results failedLookupLocation.push(packageJsonPath); } - return loadNodeModuleFromFile(extensions, ts.combinePaths(candidate, "index"), failedLookupLocation, host); + return loadModuleFromFile(ts.combinePaths(candidate, "index"), extensions, failedLookupLocation, !directoryExists, state); } - function loadModuleFromNodeModules(moduleName, directory, host) { - var failedLookupLocations = []; + function loadModuleFromNodeModulesFolder(moduleName, directory, failedLookupLocations, state) { + var nodeModulesFolder = ts.combinePaths(directory, "node_modules"); + var nodeModulesFolderExists = directoryProbablyExists(nodeModulesFolder, state.host); + var candidate = ts.normalizePath(ts.combinePaths(nodeModulesFolder, moduleName)); + // Load only typescript files irrespective of allowJs option if loading from node modules + var result = loadModuleFromFile(candidate, ts.supportedTypeScriptExtensions, failedLookupLocations, !nodeModulesFolderExists, state); + if (result) { + return result; + } + result = loadNodeModuleFromDirectory(ts.supportedTypeScriptExtensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state); + if (result) { + return result; + } + } + function loadModuleFromNodeModules(moduleName, directory, failedLookupLocations, state) { directory = ts.normalizeSlashes(directory); while (true) { var baseName = ts.getBaseFileName(directory); if (baseName !== "node_modules") { - var nodeModulesFolder = ts.combinePaths(directory, "node_modules"); - var candidate = ts.normalizePath(ts.combinePaths(nodeModulesFolder, moduleName)); - var result = loadNodeModuleFromFile(ts.supportedExtensions, candidate, failedLookupLocations, host); + var result = + // first: try to load module as-is + loadModuleFromNodeModulesFolder(moduleName, directory, failedLookupLocations, state) || + // second: try to load module from the scope '@types' + loadModuleFromNodeModulesFolder(ts.combinePaths("@types", moduleName), directory, failedLookupLocations, state); if (result) { - return { resolvedModule: { resolvedFileName: result, isExternalLibraryImport: true }, failedLookupLocations: failedLookupLocations }; - } - result = loadNodeModuleFromDirectory(ts.supportedExtensions, candidate, failedLookupLocations, host); - if (result) { - return { resolvedModule: { resolvedFileName: result, isExternalLibraryImport: true }, failedLookupLocations: failedLookupLocations }; + return result; } } var parentPath = ts.getDirectoryPath(directory); @@ -37421,46 +42101,36 @@ var ts; } directory = parentPath; } - return { resolvedModule: undefined, failedLookupLocations: failedLookupLocations }; - } - function nameStartsWithDotSlashOrDotDotSlash(name) { - var i = name.lastIndexOf("./", 1); - return i === 0 || (i === 1 && name.charCodeAt(0) === 46 /* dot */); + return undefined; } function classicNameResolver(moduleName, containingFile, compilerOptions, host) { - // module names that contain '!' are used to reference resources and are not resolved to actual files on disk - if (moduleName.indexOf("!") != -1) { - return { resolvedModule: undefined, failedLookupLocations: [] }; - } - var searchPath = ts.getDirectoryPath(containingFile); - var searchName; + var traceEnabled = isTraceEnabled(compilerOptions, host); + var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled, skipTsx: !compilerOptions.jsx }; var failedLookupLocations = []; + var supportedExtensions = ts.getSupportedExtensions(compilerOptions); + var containingDirectory = ts.getDirectoryPath(containingFile); + var resolvedFileName = tryLoadModuleUsingOptionalResolutionSettings(moduleName, containingDirectory, loadModuleFromFile, failedLookupLocations, supportedExtensions, state); + if (resolvedFileName) { + return createResolvedModule(resolvedFileName, /*isExternalLibraryImport*/ false, failedLookupLocations); + } var referencedSourceFile; - var extensions = compilerOptions.allowNonTsExtensions ? ts.supportedJsExtensions : ts.supportedExtensions; - while (true) { - searchName = ts.normalizePath(ts.combinePaths(searchPath, moduleName)); - referencedSourceFile = ts.forEach(extensions, function (extension) { - if (extension === ".tsx" && !compilerOptions.jsx) { - // resolve .tsx files only if jsx support is enabled - // 'logical not' handles both undefined and None cases - return undefined; + if (moduleHasNonRelativeName(moduleName)) { + while (true) { + var searchName = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); + referencedSourceFile = loadModuleFromFile(searchName, supportedExtensions, failedLookupLocations, /*onlyRecordFailures*/ false, state); + if (referencedSourceFile) { + break; } - var candidate = searchName + extension; - if (host.fileExists(candidate)) { - return candidate; + var parentPath = ts.getDirectoryPath(containingDirectory); + if (parentPath === containingDirectory) { + break; } - else { - failedLookupLocations.push(candidate); - } - }); - if (referencedSourceFile) { - break; + containingDirectory = parentPath; } - var parentPath = ts.getDirectoryPath(searchPath); - if (parentPath === searchPath) { - break; - } - searchPath = parentPath; + } + else { + var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); + referencedSourceFile = loadModuleFromFile(candidate, supportedExtensions, failedLookupLocations, /*onlyRecordFailures*/ false, state); } return referencedSourceFile ? { resolvedModule: { resolvedFileName: referencedSourceFile }, failedLookupLocations: failedLookupLocations } @@ -37469,7 +42139,7 @@ var ts; ts.classicNameResolver = classicNameResolver; /* @internal */ ts.defaultInitCompilerOptions = { - module: 1 /* CommonJS */, + module: ts.ModuleKind.CommonJS, target: 1 /* ES5 */, noImplicitAny: false, sourceMap: false @@ -37517,11 +42187,40 @@ var ts; ts.sys.createDirectory(directoryPath); } } + var outputFingerprints; + function writeFileIfUpdated(fileName, data, writeByteOrderMark) { + if (!outputFingerprints) { + outputFingerprints = {}; + } + var hash = ts.sys.createHash(data); + var mtimeBefore = ts.sys.getModifiedTime(fileName); + if (mtimeBefore && ts.hasProperty(outputFingerprints, fileName)) { + var fingerprint = outputFingerprints[fileName]; + // If output has not been changed, and the file has no external modification + if (fingerprint.byteOrderMark === writeByteOrderMark && + fingerprint.hash === hash && + fingerprint.mtime.getTime() === mtimeBefore.getTime()) { + return; + } + } + ts.sys.writeFile(fileName, data, writeByteOrderMark); + var mtimeAfter = ts.sys.getModifiedTime(fileName); + outputFingerprints[fileName] = { + hash: hash, + byteOrderMark: writeByteOrderMark, + mtime: mtimeAfter + }; + } function writeFile(fileName, data, writeByteOrderMark, onError) { try { var start = new Date().getTime(); ensureDirectoriesExist(ts.getDirectoryPath(ts.normalizePath(fileName))); - ts.sys.writeFile(fileName, data, writeByteOrderMark); + if (ts.isWatchSet(options) && ts.sys.createHash && ts.sys.getModifiedTime) { + writeFileIfUpdated(fileName, data, writeByteOrderMark); + } + else { + ts.sys.writeFile(fileName, data, writeByteOrderMark); + } ts.ioWriteTime += new Date().getTime() - start; } catch (e) { @@ -37530,24 +42229,32 @@ var ts; } } } + function getDefaultLibLocation() { + return ts.getDirectoryPath(ts.normalizePath(ts.sys.getExecutingFilePath())); + } var newLine = ts.getNewLineCharacter(options); + var realpath = ts.sys.realpath && (function (path) { return ts.sys.realpath(path); }); return { getSourceFile: getSourceFile, - getDefaultLibFileName: function (options) { return ts.combinePaths(ts.getDirectoryPath(ts.normalizePath(ts.sys.getExecutingFilePath())), ts.getDefaultLibFileName(options)); }, + getDefaultLibLocation: getDefaultLibLocation, + getDefaultLibFileName: function (options) { return ts.combinePaths(getDefaultLibLocation(), ts.getDefaultLibFileName(options)); }, writeFile: writeFile, getCurrentDirectory: ts.memoize(function () { return ts.sys.getCurrentDirectory(); }), useCaseSensitiveFileNames: function () { return ts.sys.useCaseSensitiveFileNames; }, getCanonicalFileName: getCanonicalFileName, getNewLine: function () { return newLine; }, fileExists: function (fileName) { return ts.sys.fileExists(fileName); }, - readFile: function (fileName) { return ts.sys.readFile(fileName); } + readFile: function (fileName) { return ts.sys.readFile(fileName); }, + trace: function (s) { return ts.sys.write(s + newLine); }, + directoryExists: function (directoryName) { return ts.sys.directoryExists(directoryName); }, + realpath: realpath }; } ts.createCompilerHost = createCompilerHost; function getPreEmitDiagnostics(program, sourceFile, cancellationToken) { var diagnostics = program.getOptionsDiagnostics(cancellationToken).concat(program.getSyntacticDiagnostics(sourceFile, cancellationToken), program.getGlobalDiagnostics(cancellationToken), program.getSemanticDiagnostics(sourceFile, cancellationToken)); if (program.getCompilerOptions().declaration) { - diagnostics.concat(program.getDeclarationDiagnostics(sourceFile, cancellationToken)); + diagnostics = diagnostics.concat(program.getDeclarationDiagnostics(sourceFile, cancellationToken)); } return ts.sortAndDeduplicateDiagnostics(diagnostics); } @@ -37575,55 +42282,96 @@ var ts; } } ts.flattenDiagnosticMessageText = flattenDiagnosticMessageText; + function loadWithLocalCache(names, containingFile, loader) { + if (names.length === 0) { + return []; + } + var resolutions = []; + var cache = {}; + for (var _i = 0, names_1 = names; _i < names_1.length; _i++) { + var name_33 = names_1[_i]; + var result = void 0; + if (ts.hasProperty(cache, name_33)) { + result = cache[name_33]; + } + else { + result = loader(name_33, containingFile); + cache[name_33] = result; + } + resolutions.push(result); + } + return resolutions; + } function createProgram(rootNames, options, host, oldProgram) { var program; var files = []; - var fileProcessingDiagnostics = ts.createDiagnosticCollection(); - var programDiagnostics = ts.createDiagnosticCollection(); var commonSourceDirectory; var diagnosticsProducingTypeChecker; var noDiagnosticsTypeChecker; var classifiableNames; - var skipDefaultLib = options.noLib; + var resolvedTypeReferenceDirectives = {}; + var fileProcessingDiagnostics = ts.createDiagnosticCollection(); var start = new Date().getTime(); host = host || createCompilerHost(options); + var skipDefaultLib = options.noLib; + var programDiagnostics = ts.createDiagnosticCollection(); var currentDirectory = host.getCurrentDirectory(); - var resolveModuleNamesWorker = host.resolveModuleNames - ? (function (moduleNames, containingFile) { return host.resolveModuleNames(moduleNames, containingFile); }) - : (function (moduleNames, containingFile) { return ts.map(moduleNames, function (moduleName) { return resolveModuleName(moduleName, containingFile, options, host).resolvedModule; }); }); + var supportedExtensions = ts.getSupportedExtensions(options); + // Map storing if there is emit blocking diagnostics for given input + var hasEmitBlockingDiagnostics = ts.createFileMap(getCanonicalFileName); + var resolveModuleNamesWorker; + if (host.resolveModuleNames) { + resolveModuleNamesWorker = function (moduleNames, containingFile) { return host.resolveModuleNames(moduleNames, containingFile); }; + } + else { + var loader_1 = function (moduleName, containingFile) { return resolveModuleName(moduleName, containingFile, options, host).resolvedModule; }; + resolveModuleNamesWorker = function (moduleNames, containingFile) { return loadWithLocalCache(moduleNames, containingFile, loader_1); }; + } + var resolveTypeReferenceDirectiveNamesWorker; + if (host.resolveTypeReferenceDirectives) { + resolveTypeReferenceDirectiveNamesWorker = function (typeDirectiveNames, containingFile) { return host.resolveTypeReferenceDirectives(typeDirectiveNames, containingFile); }; + } + else { + var loader_2 = function (typesRef, containingFile) { return resolveTypeReferenceDirective(typesRef, containingFile, options, host).resolvedTypeReferenceDirective; }; + resolveTypeReferenceDirectiveNamesWorker = function (typeReferenceDirectiveNames, containingFile) { return loadWithLocalCache(typeReferenceDirectiveNames, containingFile, loader_2); }; + } var filesByName = ts.createFileMap(); // stores 'filename -> file association' ignoring case - // used to track cases when two file names differ only in casing + // used to track cases when two file names differ only in casing var filesByNameIgnoreCase = host.useCaseSensitiveFileNames() ? ts.createFileMap(function (fileName) { return fileName.toLowerCase(); }) : undefined; - if (oldProgram) { - // check properties that can affect structure of the program or module resolution strategy - // if any of these properties has changed - structure cannot be reused - var oldOptions = oldProgram.getCompilerOptions(); - if ((oldOptions.module !== options.module) || - (oldOptions.noResolve !== options.noResolve) || - (oldOptions.target !== options.target) || - (oldOptions.noLib !== options.noLib) || - (oldOptions.jsx !== options.jsx)) { - oldProgram = undefined; - } - } if (!tryReuseStructureFromOldProgram()) { - ts.forEach(rootNames, function (name) { return processRootFile(name, false); }); + // load type declarations specified via 'types' argument + if (options.types && options.types.length) { + var resolutions = resolveTypeReferenceDirectiveNamesWorker(options.types, /*containingFile*/ undefined); + for (var i = 0; i < options.types.length; i++) { + processTypeReferenceDirective(options.types[i], resolutions[i]); + } + } + ts.forEach(rootNames, function (name) { return processRootFile(name, /*isDefaultLib*/ false); }); // Do not process the default library if: // - The '--noLib' flag is used. // - A 'no-default-lib' reference comment is encountered in // processing the root files. if (!skipDefaultLib) { - processRootFile(host.getDefaultLibFileName(options), true); + // If '--lib' is not specified, include default library file according to '--target' + // otherwise, using options specified in '--lib' instead of '--target' default library file + if (!options.lib) { + processRootFile(host.getDefaultLibFileName(options), /*isDefaultLib*/ true); + } + else { + var libDirectory_1 = host.getDefaultLibLocation ? host.getDefaultLibLocation() : ts.getDirectoryPath(host.getDefaultLibFileName(options)); + ts.forEach(options.lib, function (libFileName) { + processRootFile(ts.combinePaths(libDirectory_1, libFileName), /*isDefaultLib*/ true); + }); + } } } - verifyCompilerOptions(); // unconditionally set oldProgram to undefined to prevent it from being captured in closure oldProgram = undefined; - ts.programTime += new Date().getTime() - start; program = { getRootFileNames: function () { return rootNames; }, getSourceFile: getSourceFile, + getSourceFileByPath: getSourceFileByPath, getSourceFiles: function () { return files; }, getCompilerOptions: function () { return options; }, getSyntacticDiagnostics: getSyntacticDiagnostics, @@ -37634,16 +42382,37 @@ var ts; getTypeChecker: getTypeChecker, getClassifiableNames: getClassifiableNames, getDiagnosticsProducingTypeChecker: getDiagnosticsProducingTypeChecker, - getCommonSourceDirectory: function () { return commonSourceDirectory; }, + getCommonSourceDirectory: getCommonSourceDirectory, emit: emit, getCurrentDirectory: function () { return currentDirectory; }, getNodeCount: function () { return getDiagnosticsProducingTypeChecker().getNodeCount(); }, getIdentifierCount: function () { return getDiagnosticsProducingTypeChecker().getIdentifierCount(); }, getSymbolCount: function () { return getDiagnosticsProducingTypeChecker().getSymbolCount(); }, getTypeCount: function () { return getDiagnosticsProducingTypeChecker().getTypeCount(); }, - getFileProcessingDiagnostics: function () { return fileProcessingDiagnostics; } + getFileProcessingDiagnostics: function () { return fileProcessingDiagnostics; }, + getResolvedTypeReferenceDirectives: function () { return resolvedTypeReferenceDirectives; } }; + verifyCompilerOptions(); + ts.programTime += new Date().getTime() - start; return program; + function getCommonSourceDirectory() { + if (typeof commonSourceDirectory === "undefined") { + if (options.rootDir && checkSourceFilesBelongToPath(files, options.rootDir)) { + // If a rootDir is specified and is valid use it as the commonSourceDirectory + commonSourceDirectory = ts.getNormalizedAbsolutePath(options.rootDir, currentDirectory); + } + else { + commonSourceDirectory = computeCommonSourceDirectory(files); + } + if (commonSourceDirectory && commonSourceDirectory[commonSourceDirectory.length - 1] !== ts.directorySeparator) { + // Make sure directory path ends with directory separator so this string can directly + // used to replace with "" to get the relative path of the source file and the relative path doesn't + // start with / making it rooted path + commonSourceDirectory += ts.directorySeparator; + } + } + return commonSourceDirectory; + } function getClassifiableNames() { if (!classifiableNames) { // Initialize a checker so that all our files are bound. @@ -37660,19 +42429,42 @@ var ts; if (!oldProgram) { return false; } + // check properties that can affect structure of the program or module resolution strategy + // if any of these properties has changed - structure cannot be reused + var oldOptions = oldProgram.getCompilerOptions(); + if ((oldOptions.module !== options.module) || + (oldOptions.noResolve !== options.noResolve) || + (oldOptions.target !== options.target) || + (oldOptions.noLib !== options.noLib) || + (oldOptions.jsx !== options.jsx) || + (oldOptions.allowJs !== options.allowJs) || + (oldOptions.rootDir !== options.rootDir) || + (oldOptions.typesSearchPaths !== options.typesSearchPaths) || + (oldOptions.configFilePath !== options.configFilePath) || + (oldOptions.baseUrl !== options.baseUrl) || + (oldOptions.typesRoot !== options.typesRoot) || + !ts.arrayIsEqualTo(oldOptions.rootDirs, options.rootDirs) || + !ts.mapIsEqualTo(oldOptions.paths, options.paths)) { + return false; + } ts.Debug.assert(!oldProgram.structureIsReused); // there is an old program, check if we can reuse its structure var oldRootNames = oldProgram.getRootFileNames(); if (!ts.arrayIsEqualTo(oldRootNames, rootNames)) { return false; } + if (!ts.arrayIsEqualTo(options.types, oldOptions.types)) { + return false; + } // check if program source files has changed in the way that can affect structure of the program var newSourceFiles = []; var filePaths = []; var modifiedSourceFiles = []; for (var _i = 0, _a = oldProgram.getSourceFiles(); _i < _a.length; _i++) { var oldSourceFile = _a[_i]; - var newSourceFile = host.getSourceFile(oldSourceFile.fileName, options.target); + var newSourceFile = host.getSourceFileByPath + ? host.getSourceFileByPath(oldSourceFile.fileName, oldSourceFile.path, options.target) + : host.getSourceFile(oldSourceFile.fileName, options.target); if (!newSourceFile) { return false; } @@ -37689,31 +42481,42 @@ var ts; // tripleslash references has changed return false; } - // check imports + // check imports and module augmentations collectExternalModuleReferences(newSourceFile); if (!ts.arrayIsEqualTo(oldSourceFile.imports, newSourceFile.imports, moduleNameIsEqualTo)) { // imports has changed return false; } + if (!ts.arrayIsEqualTo(oldSourceFile.moduleAugmentations, newSourceFile.moduleAugmentations, moduleNameIsEqualTo)) { + // moduleAugmentations has changed + return false; + } + if (!ts.arrayIsEqualTo(oldSourceFile.typeReferenceDirectives, newSourceFile.typeReferenceDirectives, fileReferenceIsEqualTo)) { + // 'types' references has changed + return false; + } + var newSourceFilePath = ts.getNormalizedAbsolutePath(newSourceFile.fileName, currentDirectory); if (resolveModuleNamesWorker) { - var moduleNames = ts.map(newSourceFile.imports, function (name) { return name.text; }); - var resolutions = resolveModuleNamesWorker(moduleNames, ts.getNormalizedAbsolutePath(newSourceFile.fileName, currentDirectory)); + var moduleNames = ts.map(ts.concatenate(newSourceFile.imports, newSourceFile.moduleAugmentations), getTextOfLiteral); + var resolutions = resolveModuleNamesWorker(moduleNames, newSourceFilePath); // ensure that module resolution results are still correct - for (var i = 0; i < moduleNames.length; ++i) { - var newResolution = resolutions[i]; - var oldResolution = ts.getResolvedModule(oldSourceFile, moduleNames[i]); - var resolutionChanged = oldResolution - ? !newResolution || - oldResolution.resolvedFileName !== newResolution.resolvedFileName || - !!oldResolution.isExternalLibraryImport !== !!newResolution.isExternalLibraryImport - : newResolution; - if (resolutionChanged) { - return false; - } + var resolutionsChanged = ts.hasChangesInResolutions(moduleNames, resolutions, oldSourceFile.resolvedModules, ts.moduleResolutionIsEqualTo); + if (resolutionsChanged) { + return false; } } - // pass the cache of module resolutions from the old source file + if (resolveTypeReferenceDirectiveNamesWorker) { + var typesReferenceDirectives = ts.map(newSourceFile.typeReferenceDirectives, function (x) { return x.fileName; }); + var resolutions = resolveTypeReferenceDirectiveNamesWorker(typesReferenceDirectives, newSourceFilePath); + // ensure that types resolutions are still correct + var resolutionsChanged = ts.hasChangesInResolutions(typesReferenceDirectives, resolutions, oldSourceFile.resolvedTypeReferenceDirectiveNames, ts.typeDirectiveIsEqualTo); + if (resolutionsChanged) { + return false; + } + } + // pass the cache of module/types resolutions from the old source file newSourceFile.resolvedModules = oldSourceFile.resolvedModules; + newSourceFile.resolvedTypeReferenceDirectiveNames = oldSourceFile.resolvedTypeReferenceDirectiveNames; modifiedSourceFiles.push(newSourceFile); } else { @@ -37724,7 +42527,7 @@ var ts; newSourceFiles.push(newSourceFile); } // update fileName -> file mapping - for (var i = 0, len = newSourceFiles.length; i < len; ++i) { + for (var i = 0, len = newSourceFiles.length; i < len; i++) { filesByName.set(filePaths[i], newSourceFiles[i]); } files = newSourceFiles; @@ -37733,6 +42536,7 @@ var ts; var modifiedFile = modifiedSourceFiles_1[_b]; fileProcessingDiagnostics.reattachFileDiagnostics(modifiedFile); } + resolvedTypeReferenceDirectives = oldProgram.getResolvedTypeReferenceDirectives(); oldProgram.structureIsReused = true; return true; } @@ -37744,8 +42548,10 @@ var ts; getCurrentDirectory: function () { return currentDirectory; }, getNewLine: function () { return host.getNewLine(); }, getSourceFile: program.getSourceFile, + getSourceFileByPath: program.getSourceFileByPath, getSourceFiles: program.getSourceFiles, - writeFile: writeFileCallback || (function (fileName, data, writeByteOrderMark, onError) { return host.writeFile(fileName, data, writeByteOrderMark, onError); }) + writeFile: writeFileCallback || (function (fileName, data, writeByteOrderMark, onError, sourceFiles) { return host.writeFile(fileName, data, writeByteOrderMark, onError, sourceFiles); }), + isEmitBlocked: isEmitBlocked }; } function getDiagnosticsProducingTypeChecker() { @@ -37758,12 +42564,30 @@ var ts; var _this = this; return runWithCancellationToken(function () { return emitWorker(_this, sourceFile, writeFileCallback, cancellationToken); }); } + function isEmitBlocked(emitFileName) { + return hasEmitBlockingDiagnostics.contains(ts.toPath(emitFileName, currentDirectory, getCanonicalFileName)); + } function emitWorker(program, sourceFile, writeFileCallback, cancellationToken) { + var declarationDiagnostics = []; + if (options.noEmit) { + return { diagnostics: declarationDiagnostics, sourceMaps: undefined, emittedFiles: undefined, emitSkipped: true }; + } // If the noEmitOnError flag is set, then check if we have any errors so far. If so, // immediately bail out. Note that we pass 'undefined' for 'sourceFile' so that we // get any preEmit diagnostics, not just the ones - if (options.noEmitOnError && getPreEmitDiagnostics(program, /*sourceFile:*/ undefined, cancellationToken).length > 0) { - return { diagnostics: [], sourceMaps: undefined, emitSkipped: true }; + if (options.noEmitOnError) { + var diagnostics = program.getOptionsDiagnostics(cancellationToken).concat(program.getSyntacticDiagnostics(sourceFile, cancellationToken), program.getGlobalDiagnostics(cancellationToken), program.getSemanticDiagnostics(sourceFile, cancellationToken)); + if (diagnostics.length === 0 && program.getCompilerOptions().declaration) { + declarationDiagnostics = program.getDeclarationDiagnostics(/*sourceFile*/ undefined, cancellationToken); + } + if (diagnostics.length > 0 || declarationDiagnostics.length > 0) { + return { + diagnostics: ts.concatenate(diagnostics, declarationDiagnostics), + sourceMaps: undefined, + emittedFiles: undefined, + emitSkipped: true + }; + } } // Create the emit resolver outside of the "emitTime" tracking code below. That way // any cost associated with it (like type checking) are appropriate associated with @@ -37780,7 +42604,10 @@ var ts; return emitResult; } function getSourceFile(fileName) { - return filesByName.get(ts.toPath(fileName, currentDirectory, getCanonicalFileName)); + return getSourceFileByPath(ts.toPath(fileName, currentDirectory, getCanonicalFileName)); + } + function getSourceFileByPath(path) { + return filesByName.get(path); } function getDiagnosticsHelper(sourceFile, getDiagnostics, cancellationToken) { if (sourceFile) { @@ -37802,7 +42629,14 @@ var ts; return getDiagnosticsHelper(sourceFile, getSemanticDiagnosticsForFile, cancellationToken); } function getDeclarationDiagnostics(sourceFile, cancellationToken) { - return getDiagnosticsHelper(sourceFile, getDeclarationDiagnosticsForFile, cancellationToken); + var options = program.getCompilerOptions(); + // collect diagnostics from the program only once if either no source file was specified or out/outFile is set (bundled emit) + if (!sourceFile || options.out || options.outFile) { + return getDeclarationDiagnosticsWorker(sourceFile, cancellationToken); + } + else { + return getDiagnosticsHelper(sourceFile, getDeclarationDiagnosticsForFile, cancellationToken); + } } function getSyntacticDiagnosticsForFile(sourceFile, cancellationToken) { return sourceFile.parseDiagnostics; @@ -37816,7 +42650,7 @@ var ts; // We were canceled while performing the operation. Because our type checker // might be a bad state, we need to throw it away. // - // Note: we are overly agressive here. We do not actually *have* to throw away + // Note: we are overly aggressive here. We do not actually *have* to throw away // the "noDiagnosticsTypeChecker". However, for simplicity, i'd like to keep // the lifetimes of these two TypeCheckers the same. Also, we generally only // cancel when the user has made a change anyways. And, in that case, we (the @@ -37833,22 +42667,181 @@ var ts; var typeChecker = getDiagnosticsProducingTypeChecker(); ts.Debug.assert(!!sourceFile.bindDiagnostics); var bindDiagnostics = sourceFile.bindDiagnostics; - var checkDiagnostics = typeChecker.getDiagnostics(sourceFile, cancellationToken); + // For JavaScript files, we don't want to report the normal typescript semantic errors. + // Instead, we just report errors for using TypeScript-only constructs from within a + // JavaScript file. + var checkDiagnostics = ts.isSourceFileJavaScript(sourceFile) ? + getJavaScriptSemanticDiagnosticsForFile(sourceFile, cancellationToken) : + typeChecker.getDiagnostics(sourceFile, cancellationToken); var fileProcessingDiagnosticsInFile = fileProcessingDiagnostics.getDiagnostics(sourceFile.fileName); var programDiagnosticsInFile = programDiagnostics.getDiagnostics(sourceFile.fileName); return bindDiagnostics.concat(checkDiagnostics).concat(fileProcessingDiagnosticsInFile).concat(programDiagnosticsInFile); }); } - function getDeclarationDiagnosticsForFile(sourceFile, cancellationToken) { + function getJavaScriptSemanticDiagnosticsForFile(sourceFile, cancellationToken) { return runWithCancellationToken(function () { - if (!ts.isDeclarationFile(sourceFile)) { - var resolver = getDiagnosticsProducingTypeChecker().getEmitResolver(sourceFile, cancellationToken); - // Don't actually write any files since we're just getting diagnostics. - var writeFile_1 = function () { }; - return ts.getDeclarationDiagnostics(getEmitHost(writeFile_1), resolver, sourceFile); + var diagnostics = []; + walk(sourceFile); + return diagnostics; + function walk(node) { + if (!node) { + return false; + } + switch (node.kind) { + case 229 /* ImportEqualsDeclaration */: + diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_a_ts_file)); + return true; + case 235 /* ExportAssignment */: + if (node.isExportEquals) { + diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.export_can_only_be_used_in_a_ts_file)); + return true; + } + break; + case 221 /* ClassDeclaration */: + var classDeclaration = node; + if (checkModifiers(classDeclaration.modifiers) || + checkTypeParameters(classDeclaration.typeParameters)) { + return true; + } + break; + case 251 /* HeritageClause */: + var heritageClause = node; + if (heritageClause.token === 106 /* ImplementsKeyword */) { + diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_a_ts_file)); + return true; + } + break; + case 222 /* InterfaceDeclaration */: + diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.interface_declarations_can_only_be_used_in_a_ts_file)); + return true; + case 225 /* ModuleDeclaration */: + diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.module_declarations_can_only_be_used_in_a_ts_file)); + return true; + case 223 /* TypeAliasDeclaration */: + diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.type_aliases_can_only_be_used_in_a_ts_file)); + return true; + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: + case 148 /* Constructor */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: + case 179 /* FunctionExpression */: + case 220 /* FunctionDeclaration */: + case 180 /* ArrowFunction */: + case 220 /* FunctionDeclaration */: + var functionDeclaration = node; + if (checkModifiers(functionDeclaration.modifiers) || + checkTypeParameters(functionDeclaration.typeParameters) || + checkTypeAnnotation(functionDeclaration.type)) { + return true; + } + break; + case 200 /* VariableStatement */: + var variableStatement = node; + if (checkModifiers(variableStatement.modifiers)) { + return true; + } + break; + case 218 /* VariableDeclaration */: + var variableDeclaration = node; + if (checkTypeAnnotation(variableDeclaration.type)) { + return true; + } + break; + case 174 /* CallExpression */: + case 175 /* NewExpression */: + var expression = node; + if (expression.typeArguments && expression.typeArguments.length > 0) { + var start_2 = expression.typeArguments.pos; + diagnostics.push(ts.createFileDiagnostic(sourceFile, start_2, expression.typeArguments.end - start_2, ts.Diagnostics.type_arguments_can_only_be_used_in_a_ts_file)); + return true; + } + break; + case 142 /* Parameter */: + var parameter = node; + if (parameter.modifiers) { + var start_3 = parameter.modifiers.pos; + diagnostics.push(ts.createFileDiagnostic(sourceFile, start_3, parameter.modifiers.end - start_3, ts.Diagnostics.parameter_modifiers_can_only_be_used_in_a_ts_file)); + return true; + } + if (parameter.questionToken) { + diagnostics.push(ts.createDiagnosticForNode(parameter.questionToken, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, "?")); + return true; + } + if (parameter.type) { + diagnostics.push(ts.createDiagnosticForNode(parameter.type, ts.Diagnostics.types_can_only_be_used_in_a_ts_file)); + return true; + } + break; + case 145 /* PropertyDeclaration */: + diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.property_declarations_can_only_be_used_in_a_ts_file)); + return true; + case 224 /* EnumDeclaration */: + diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.enum_declarations_can_only_be_used_in_a_ts_file)); + return true; + case 177 /* TypeAssertionExpression */: + var typeAssertionExpression = node; + diagnostics.push(ts.createDiagnosticForNode(typeAssertionExpression.type, ts.Diagnostics.type_assertion_expressions_can_only_be_used_in_a_ts_file)); + return true; + case 143 /* Decorator */: + if (!options.experimentalDecorators) { + diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning)); + } + return true; + } + return ts.forEachChild(node, walk); + } + function checkTypeParameters(typeParameters) { + if (typeParameters) { + var start_4 = typeParameters.pos; + diagnostics.push(ts.createFileDiagnostic(sourceFile, start_4, typeParameters.end - start_4, ts.Diagnostics.type_parameter_declarations_can_only_be_used_in_a_ts_file)); + return true; + } + return false; + } + function checkTypeAnnotation(type) { + if (type) { + diagnostics.push(ts.createDiagnosticForNode(type, ts.Diagnostics.types_can_only_be_used_in_a_ts_file)); + return true; + } + return false; + } + function checkModifiers(modifiers) { + if (modifiers) { + for (var _i = 0, modifiers_1 = modifiers; _i < modifiers_1.length; _i++) { + var modifier = modifiers_1[_i]; + switch (modifier.kind) { + case 112 /* PublicKeyword */: + case 110 /* PrivateKeyword */: + case 111 /* ProtectedKeyword */: + case 128 /* ReadonlyKeyword */: + case 122 /* DeclareKeyword */: + diagnostics.push(ts.createDiagnosticForNode(modifier, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, ts.tokenToString(modifier.kind))); + return true; + // These are all legal modifiers. + case 113 /* StaticKeyword */: + case 82 /* ExportKeyword */: + case 74 /* ConstKeyword */: + case 77 /* DefaultKeyword */: + case 115 /* AbstractKeyword */: + } + } + } + return false; } }); } + function getDeclarationDiagnosticsWorker(sourceFile, cancellationToken) { + return runWithCancellationToken(function () { + var resolver = getDiagnosticsProducingTypeChecker().getEmitResolver(sourceFile, cancellationToken); + // Don't actually write any files since we're just getting diagnostics. + var writeFile = function () { }; + return ts.getDeclarationDiagnostics(getEmitHost(writeFile), resolver, sourceFile); + }); + } + function getDeclarationDiagnosticsForFile(sourceFile, cancellationToken) { + return ts.isDeclarationFile(sourceFile) ? [] : getDeclarationDiagnosticsWorker(sourceFile, cancellationToken); + } function getOptionsDiagnostics() { var allDiagnostics = []; ts.addRange(allDiagnostics, fileProcessingDiagnostics.getGlobalDiagnostics()); @@ -37864,7 +42857,7 @@ var ts; return ts.getBaseFileName(fileName).indexOf(".") >= 0; } function processRootFile(fileName, isDefaultLib) { - processSourceFile(ts.normalizePath(fileName), isDefaultLib); + processSourceFile(ts.normalizePath(fileName), isDefaultLib, /*isReference*/ true); } function fileReferenceIsEqualTo(a, b) { return a.fileName === b.fileName; @@ -37872,71 +42865,92 @@ var ts; function moduleNameIsEqualTo(a, b) { return a.text === b.text; } + function getTextOfLiteral(literal) { + return literal.text; + } function collectExternalModuleReferences(file) { if (file.imports) { return; } var isJavaScriptFile = ts.isSourceFileJavaScript(file); + var isExternalModuleFile = ts.isExternalModule(file); var imports; + var moduleAugmentations; for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { var node = _a[_i]; - collect(node, /* allowRelativeModuleNames */ true, /* collectOnlyRequireCalls */ false); + collectModuleReferences(node, /*inAmbientModule*/ false); + if (isJavaScriptFile) { + collectRequireCalls(node); + } } file.imports = imports || emptyArray; + file.moduleAugmentations = moduleAugmentations || emptyArray; return; - function collect(node, allowRelativeModuleNames, collectOnlyRequireCalls) { - if (!collectOnlyRequireCalls) { - switch (node.kind) { - case 222 /* ImportDeclaration */: - case 221 /* ImportEqualsDeclaration */: - case 228 /* ExportDeclaration */: - var moduleNameExpr = ts.getExternalModuleName(node); - if (!moduleNameExpr || moduleNameExpr.kind !== 9 /* StringLiteral */) { - break; - } - if (!moduleNameExpr.text) { - break; - } - if (allowRelativeModuleNames || !ts.isExternalModuleNameRelative(moduleNameExpr.text)) { - (imports || (imports = [])).push(moduleNameExpr); - } + function collectModuleReferences(node, inAmbientModule) { + switch (node.kind) { + case 230 /* ImportDeclaration */: + case 229 /* ImportEqualsDeclaration */: + case 236 /* ExportDeclaration */: + var moduleNameExpr = ts.getExternalModuleName(node); + if (!moduleNameExpr || moduleNameExpr.kind !== 9 /* StringLiteral */) { break; - case 218 /* ModuleDeclaration */: - if (node.name.kind === 9 /* StringLiteral */ && (node.flags & 4 /* Ambient */ || ts.isDeclarationFile(file))) { - // TypeScript 1.0 spec (April 2014): 12.1.6 - // An AmbientExternalModuleDeclaration declares an external module. + } + if (!moduleNameExpr.text) { + break; + } + // TypeScript 1.0 spec (April 2014): 12.1.6 + // An ExternalImportDeclaration in an AmbientExternalModuleDeclaration may reference other external modules + // only through top - level external module names. Relative external module names are not permitted. + if (!inAmbientModule || !ts.isExternalModuleNameRelative(moduleNameExpr.text)) { + (imports || (imports = [])).push(moduleNameExpr); + } + break; + case 225 /* ModuleDeclaration */: + if (ts.isAmbientModule(node) && (inAmbientModule || node.flags & 2 /* Ambient */ || ts.isDeclarationFile(file))) { + var moduleName = node.name; + // Ambient module declarations can be interpreted as augmentations for some existing external modules. + // This will happen in two cases: + // - if current file is external module then module augmentation is a ambient module declaration defined in the top level scope + // - if current file is not external module then module augmentation is an ambient module declaration with non-relative module name + // immediately nested in top level ambient module declaration . + if (isExternalModuleFile || (inAmbientModule && !ts.isExternalModuleNameRelative(moduleName.text))) { + (moduleAugmentations || (moduleAugmentations = [])).push(moduleName); + } + else if (!inAmbientModule) { + // An AmbientExternalModuleDeclaration declares an external module. // This type of declaration is permitted only in the global module. // The StringLiteral must specify a top - level external module name. // Relative external module names are not permitted - ts.forEachChild(node.body, function (node) { - // TypeScript 1.0 spec (April 2014): 12.1.6 - // An ExternalImportDeclaration in anAmbientExternalModuleDeclaration may reference other external modules - // only through top - level external module names. Relative external module names are not permitted. - collect(node, /* allowRelativeModuleNames */ false, collectOnlyRequireCalls); - }); + // NOTE: body of ambient module is always a module block + for (var _i = 0, _a = node.body.statements; _i < _a.length; _i++) { + var statement = _a[_i]; + collectModuleReferences(statement, /*inAmbientModule*/ true); + } } - break; - } + } } - if (isJavaScriptFile) { - if (ts.isRequireCall(node)) { - (imports || (imports = [])).push(node.arguments[0]); - } - else { - ts.forEachChild(node, function (node) { return collect(node, allowRelativeModuleNames, /* collectOnlyRequireCalls */ true); }); - } + } + function collectRequireCalls(node) { + if (ts.isRequireCall(node, /*checkArgumentIsStringLiteral*/ true)) { + (imports || (imports = [])).push(node.arguments[0]); + } + else { + ts.forEachChild(node, collectRequireCalls); } } } - function processSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd) { + /** + * 'isReference' indicates whether the file was brought in via a reference directive (rather than an import declaration) + */ + function processSourceFile(fileName, isDefaultLib, isReference, refFile, refPos, refEnd) { var diagnosticArgument; var diagnostic; if (hasExtension(fileName)) { - if (!options.allowNonTsExtensions && !ts.forEach(ts.supportedExtensions, function (extension) { return ts.fileExtensionIs(host.getCanonicalFileName(fileName), extension); })) { + if (!options.allowNonTsExtensions && !ts.forEach(supportedExtensions, function (extension) { return ts.fileExtensionIs(host.getCanonicalFileName(fileName), extension); })) { diagnostic = ts.Diagnostics.File_0_has_unsupported_extension_The_only_supported_extensions_are_1; - diagnosticArgument = [fileName, "'" + ts.supportedExtensions.join("', '") + "'"]; + diagnosticArgument = [fileName, "'" + supportedExtensions.join("', '") + "'"]; } - else if (!findSourceFile(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName), isDefaultLib, refFile, refPos, refEnd)) { + else if (!findSourceFile(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName), isDefaultLib, isReference, refFile, refPos, refEnd)) { diagnostic = ts.Diagnostics.File_0_not_found; diagnosticArgument = [fileName]; } @@ -37946,13 +42960,13 @@ var ts; } } else { - var nonTsFile = options.allowNonTsExtensions && findSourceFile(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName), isDefaultLib, refFile, refPos, refEnd); + var nonTsFile = options.allowNonTsExtensions && findSourceFile(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName), isDefaultLib, isReference, refFile, refPos, refEnd); if (!nonTsFile) { if (options.allowNonTsExtensions) { diagnostic = ts.Diagnostics.File_0_not_found; diagnosticArgument = [fileName]; } - else if (!ts.forEach(ts.supportedExtensions, function (extension) { return findSourceFile(fileName + extension, ts.toPath(fileName + extension, currentDirectory, getCanonicalFileName), isDefaultLib, refFile, refPos, refEnd); })) { + else if (!ts.forEach(supportedExtensions, function (extension) { return findSourceFile(fileName + extension, ts.toPath(fileName + extension, currentDirectory, getCanonicalFileName), isDefaultLib, isReference, refFile, refPos, refEnd); })) { diagnostic = ts.Diagnostics.File_0_not_found; fileName += ".ts"; diagnosticArgument = [fileName]; @@ -37977,14 +42991,17 @@ var ts; } } // Get source file from normalized fileName - function findSourceFile(fileName, normalizedAbsolutePath, isDefaultLib, refFile, refPos, refEnd) { - if (filesByName.contains(normalizedAbsolutePath)) { - var file_1 = filesByName.get(normalizedAbsolutePath); + function findSourceFile(fileName, path, isDefaultLib, isReference, refFile, refPos, refEnd) { + if (filesByName.contains(path)) { + var file_1 = filesByName.get(path); // try to check if we've already seen this file but with a different casing in path // NOTE: this only makes sense for case-insensitive file systems - if (file_1 && options.forceConsistentCasingInFileNames && ts.getNormalizedAbsolutePath(file_1.fileName, currentDirectory) !== normalizedAbsolutePath) { + if (file_1 && options.forceConsistentCasingInFileNames && ts.getNormalizedAbsolutePath(file_1.fileName, currentDirectory) !== ts.getNormalizedAbsolutePath(fileName, currentDirectory)) { reportFileNamesDifferOnlyInCasingError(fileName, file_1.fileName, refFile, refPos, refEnd); } + if (file_1) { + file_1.wasReferenced = file_1.wasReferenced || isReference; + } return file_1; } // We haven't looked for this file, do so now and cache result @@ -37996,23 +43013,25 @@ var ts; fileProcessingDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage)); } }); - filesByName.set(normalizedAbsolutePath, file); + filesByName.set(path, file); if (file) { - file.path = normalizedAbsolutePath; + file.wasReferenced = file.wasReferenced || isReference; + file.path = path; if (host.useCaseSensitiveFileNames()) { // for case-sensitive file systems check if we've already seen some file with similar filename ignoring case - var existingFile = filesByNameIgnoreCase.get(normalizedAbsolutePath); + var existingFile = filesByNameIgnoreCase.get(path); if (existingFile) { reportFileNamesDifferOnlyInCasingError(fileName, existingFile.fileName, refFile, refPos, refEnd); } else { - filesByNameIgnoreCase.set(normalizedAbsolutePath, file); + filesByNameIgnoreCase.set(path, file); } } skipDefaultLib = skipDefaultLib || file.hasNoDefaultLib; var basePath = ts.getDirectoryPath(fileName); if (!options.noResolve) { - processReferencedFiles(file, basePath); + processReferencedFiles(file, basePath, isDefaultLib); + processTypeReferenceDirectives(file); } // always process imported modules to record module name resolutions processImportedModules(file, basePath); @@ -38025,30 +43044,98 @@ var ts; } return file; } - function processReferencedFiles(file, basePath) { + function processReferencedFiles(file, basePath, isDefaultLib) { ts.forEach(file.referencedFiles, function (ref) { var referencedFileName = resolveTripleslashReference(ref.fileName, file.fileName); - processSourceFile(referencedFileName, /* isDefaultLib */ false, file, ref.pos, ref.end); + processSourceFile(referencedFileName, isDefaultLib, /*isReference*/ true, file, ref.pos, ref.end); }); } + function processTypeReferenceDirectives(file) { + var typeDirectives = ts.map(file.typeReferenceDirectives, function (l) { return l.fileName; }); + var resolutions = resolveTypeReferenceDirectiveNamesWorker(typeDirectives, file.fileName); + for (var i = 0; i < typeDirectives.length; i++) { + var ref = file.typeReferenceDirectives[i]; + var resolvedTypeReferenceDirective = resolutions[i]; + // store resolved type directive on the file + ts.setResolvedTypeReferenceDirective(file, ref.fileName, resolvedTypeReferenceDirective); + processTypeReferenceDirective(ref.fileName, resolvedTypeReferenceDirective, file, ref.pos, ref.end); + } + } + function processTypeReferenceDirective(typeReferenceDirective, resolvedTypeReferenceDirective, refFile, refPos, refEnd) { + // If we already found this library as a primary reference - nothing to do + var previousResolution = resolvedTypeReferenceDirectives[typeReferenceDirective]; + if (previousResolution && previousResolution.primary) { + return; + } + var saveResolution = true; + if (resolvedTypeReferenceDirective) { + if (resolvedTypeReferenceDirective.primary) { + // resolved from the primary path + processSourceFile(resolvedTypeReferenceDirective.resolvedFileName, /*isDefaultLib*/ false, /*isReference*/ true, refFile, refPos, refEnd); + } + else { + // If we already resolved to this file, it must have been a secondary reference. Check file contents + // for sameness and possibly issue an error + if (previousResolution) { + var otherFileText = host.readFile(resolvedTypeReferenceDirective.resolvedFileName); + if (otherFileText !== getSourceFile(previousResolution.resolvedFileName).text) { + fileProcessingDiagnostics.add(createDiagnostic(refFile, refPos, refEnd, ts.Diagnostics.Conflicting_library_definitions_for_0_found_at_1_and_2_Copy_the_correct_file_to_the_typings_folder_to_resolve_this_conflict, typeReferenceDirective, resolvedTypeReferenceDirective.resolvedFileName, previousResolution.resolvedFileName)); + } + // don't overwrite previous resolution result + saveResolution = false; + } + else { + // First resolution of this library + processSourceFile(resolvedTypeReferenceDirective.resolvedFileName, /*isDefaultLib*/ false, /*isReference*/ true, refFile, refPos, refEnd); + } + } + } + else { + fileProcessingDiagnostics.add(createDiagnostic(refFile, refPos, refEnd, ts.Diagnostics.Cannot_find_name_0, typeReferenceDirective)); + } + if (saveResolution) { + resolvedTypeReferenceDirectives[typeReferenceDirective] = resolvedTypeReferenceDirective; + } + } + function createDiagnostic(refFile, refPos, refEnd, message) { + var args = []; + for (var _i = 4; _i < arguments.length; _i++) { + args[_i - 4] = arguments[_i]; + } + if (refFile === undefined || refPos === undefined || refEnd === undefined) { + return ts.createCompilerDiagnostic.apply(void 0, [message].concat(args)); + } + else { + return ts.createFileDiagnostic.apply(void 0, [refFile, refPos, refEnd - refPos, message].concat(args)); + } + } function getCanonicalFileName(fileName) { return host.getCanonicalFileName(fileName); } function processImportedModules(file, basePath) { collectExternalModuleReferences(file); - if (file.imports.length) { + if (file.imports.length || file.moduleAugmentations.length) { file.resolvedModules = {}; - var moduleNames = ts.map(file.imports, function (name) { return name.text; }); + var moduleNames = ts.map(ts.concatenate(file.imports, file.moduleAugmentations), getTextOfLiteral); var resolutions = resolveModuleNamesWorker(moduleNames, ts.getNormalizedAbsolutePath(file.fileName, currentDirectory)); - for (var i = 0; i < file.imports.length; ++i) { + for (var i = 0; i < moduleNames.length; i++) { var resolution = resolutions[i]; ts.setResolvedModule(file, moduleNames[i], resolution); - if (resolution && !options.noResolve) { - var importedFile = findSourceFile(resolution.resolvedFileName, ts.toPath(resolution.resolvedFileName, currentDirectory, getCanonicalFileName), /* isDefaultLib */ false, file, ts.skipTrivia(file.text, file.imports[i].pos), file.imports[i].end); + // add file to program only if: + // - resolution was successful + // - noResolve is falsy + // - module name comes from the list of imports + var shouldAddFile = resolution && + !options.noResolve && + i < file.imports.length; + if (shouldAddFile) { + var importedFile = findSourceFile(resolution.resolvedFileName, ts.toPath(resolution.resolvedFileName, currentDirectory, getCanonicalFileName), /*isDefaultLib*/ false, /*isReference*/ false, file, ts.skipTrivia(file.text, file.imports[i].pos), file.imports[i].end); if (importedFile && resolution.isExternalLibraryImport) { - if (!ts.isExternalModule(importedFile)) { - var start_2 = ts.getTokenPosOfNode(file.imports[i], file); - fileProcessingDiagnostics.add(ts.createFileDiagnostic(file, start_2, file.imports[i].end - start_2, ts.Diagnostics.Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_the_package_definition, importedFile.fileName)); + // Since currently irrespective of allowJs, we only look for supportedTypeScript extension external module files, + // this check is ok. Otherwise this would be never true for javascript file + if (!ts.isExternalModule(importedFile) && importedFile.statements.length) { + var start_5 = ts.getTokenPosOfNode(file.imports[i], file); + fileProcessingDiagnostics.add(ts.createFileDiagnostic(file, start_5, file.imports[i].end - start_5, ts.Diagnostics.Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_the_package_definition, importedFile.fileName)); } else if (importedFile.referencedFiles.length) { var firstRef = importedFile.referencedFiles[0]; @@ -38065,46 +43152,21 @@ var ts; return; } function computeCommonSourceDirectory(sourceFiles) { - var commonPathComponents; - ts.forEach(files, function (sourceFile) { - // Each file contributes into common source file path - if (ts.isDeclarationFile(sourceFile)) { - return; + var fileNames = []; + for (var _i = 0, sourceFiles_2 = sourceFiles; _i < sourceFiles_2.length; _i++) { + var file = sourceFiles_2[_i]; + if (!file.isDeclarationFile) { + fileNames.push(file.fileName); } - var sourcePathComponents = ts.getNormalizedPathComponents(sourceFile.fileName, currentDirectory); - sourcePathComponents.pop(); // The base file name is not part of the common directory path - if (!commonPathComponents) { - // first file - commonPathComponents = sourcePathComponents; - return; - } - for (var i = 0, n = Math.min(commonPathComponents.length, sourcePathComponents.length); i < n; i++) { - if (commonPathComponents[i] !== sourcePathComponents[i]) { - if (i === 0) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files)); - return; - } - // New common path found that is 0 -> i-1 - commonPathComponents.length = i; - break; - } - } - // If the sourcePathComponents was shorter than the commonPathComponents, truncate to the sourcePathComponents - if (sourcePathComponents.length < commonPathComponents.length) { - commonPathComponents.length = sourcePathComponents.length; - } - }); - if (!commonPathComponents) { - return currentDirectory; } - return ts.getNormalizedPathFromPathComponents(commonPathComponents); + return computeCommonSourceDirectoryOfFilenames(fileNames, currentDirectory, getCanonicalFileName); } function checkSourceFilesBelongToPath(sourceFiles, rootDirectory) { var allFilesBelongToPath = true; if (sourceFiles) { var absoluteRootDirectoryPath = host.getCanonicalFileName(ts.getNormalizedAbsolutePath(rootDirectory, currentDirectory)); - for (var _i = 0, sourceFiles_1 = sourceFiles; _i < sourceFiles_1.length; _i++) { - var sourceFile = sourceFiles_1[_i]; + for (var _i = 0, sourceFiles_3 = sourceFiles; _i < sourceFiles_3.length; _i++) { + var sourceFile = sourceFiles_3[_i]; if (!ts.isDeclarationFile(sourceFile)) { var absoluteSourceFilePath = host.getCanonicalFileName(ts.getNormalizedAbsolutePath(sourceFile.fileName, currentDirectory)); if (absoluteSourceFilePath.indexOf(absoluteRootDirectoryPath) !== 0) { @@ -38138,14 +43200,44 @@ var ts; if (options.mapRoot) { programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "mapRoot", "inlineSourceMap")); } - if (options.sourceRoot) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceRoot", "inlineSourceMap")); + } + if (options.paths && options.baseUrl === undefined) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_paths_cannot_be_used_without_specifying_baseUrl_option)); + } + if (options.paths) { + for (var key in options.paths) { + if (!ts.hasProperty(options.paths, key)) { + continue; + } + if (!hasZeroOrOneAsteriskCharacter(key)) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Pattern_0_can_have_at_most_one_Asterisk_character, key)); + } + if (ts.isArray(options.paths[key])) { + for (var _i = 0, _a = options.paths[key]; _i < _a.length; _i++) { + var subst = _a[_i]; + var typeOfSubst = typeof subst; + if (typeOfSubst === "string") { + if (!hasZeroOrOneAsteriskCharacter(subst)) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character, subst, key)); + } + } + else { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Substitution_0_for_pattern_1_has_incorrect_type_expected_string_got_2, subst, key, typeOfSubst)); + } + } + } + else { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Substututions_for_pattern_0_should_be_an_array, key)); + } } } if (options.inlineSources) { if (!options.sourceMap && !options.inlineSourceMap) { programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_inlineSources_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided)); } + if (options.sourceRoot) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceRoot", "inlineSources")); + } } if (options.out && options.outFile) { programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "outFile")); @@ -38155,16 +43247,26 @@ var ts; if (options.mapRoot) { programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "mapRoot", "sourceMap")); } - if (options.sourceRoot) { + if (options.sourceRoot && !options.inlineSourceMap) { programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "sourceRoot", "sourceMap")); } - return; + } + if (options.declarationDir) { + if (!options.declaration) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "declarationDir", "declaration")); + } + if (options.out || options.outFile) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "declarationDir", options.out ? "out" : "outFile")); + } + } + if (options.lib && options.noLib) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "lib", "noLib")); } var languageVersion = options.target || 0 /* ES3 */; var outFile = options.outFile || options.out; var firstExternalModuleSourceFile = ts.forEach(files, function (f) { return ts.isExternalModule(f) ? f : undefined; }); if (options.isolatedModules) { - if (!options.module && languageVersion < 2 /* ES6 */) { + if (options.module === ts.ModuleKind.None && languageVersion < 2 /* ES6 */) { programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES2015_or_higher)); } var firstNonExternalModuleSourceFile = ts.forEach(files, function (f) { return !ts.isExternalModule(f) && !ts.isDeclarationFile(f) ? f : undefined; }); @@ -38173,17 +43275,17 @@ var ts; programDiagnostics.add(ts.createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided)); } } - else if (firstExternalModuleSourceFile && languageVersion < 2 /* ES6 */ && !options.module) { + else if (firstExternalModuleSourceFile && languageVersion < 2 /* ES6 */ && options.module === ts.ModuleKind.None) { // We cannot use createDiagnosticFromNode because nodes do not have parents yet var span = ts.getErrorSpanForNode(firstExternalModuleSourceFile, firstExternalModuleSourceFile.externalModuleIndicator); - programDiagnostics.add(ts.createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_modules_unless_the_module_flag_is_provided)); + programDiagnostics.add(ts.createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_modules_unless_the_module_flag_is_provided_with_a_valid_module_type_Consider_setting_the_module_compiler_option_in_a_tsconfig_json_file)); } // Cannot specify module gen target of es6 when below es6 - if (options.module === 5 /* ES6 */ && languageVersion < 2 /* ES6 */) { + if (options.module === ts.ModuleKind.ES6 && languageVersion < 2 /* ES6 */) { programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_compile_modules_into_es2015_when_targeting_ES5_or_lower)); } // Cannot specify module gen that isn't amd or system with --out - if (outFile && options.module && !(options.module === 2 /* AMD */ || options.module === 4 /* System */)) { + if (outFile && options.module && !(options.module === ts.ModuleKind.AMD || options.module === ts.ModuleKind.System)) { programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Only_amd_and_system_modules_are_supported_alongside_0, options.out ? "out" : "outFile")); } // there has to be common source directory if user specified --outdir || --sourceRoot @@ -38191,39 +43293,54 @@ var ts; if (options.outDir || options.sourceRoot || options.mapRoot) { - if (options.rootDir && checkSourceFilesBelongToPath(files, options.rootDir)) { - // If a rootDir is specified and is valid use it as the commonSourceDirectory - commonSourceDirectory = ts.getNormalizedAbsolutePath(options.rootDir, currentDirectory); - } - else { - // Compute the commonSourceDirectory from the input files - commonSourceDirectory = computeCommonSourceDirectory(files); - } - if (commonSourceDirectory && commonSourceDirectory[commonSourceDirectory.length - 1] !== ts.directorySeparator) { - // Make sure directory path ends with directory separator so this string can directly - // used to replace with "" to get the relative path of the source file and the relative path doesn't - // start with / making it rooted path - commonSourceDirectory += ts.directorySeparator; + // Precalculate and cache the common source directory + var dir = getCommonSourceDirectory(); + // If we failed to find a good common directory, but outDir is specified and at least one of our files is on a windows drive/URL/other resource, add a failure + if (options.outDir && dir === "" && ts.forEach(files, function (file) { return ts.getRootLength(file.fileName) > 1; })) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files)); } } - if (options.noEmit) { - if (options.out) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "out")); - } - if (options.outFile) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outFile")); - } - if (options.outDir) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outDir")); - } - if (options.declaration) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "declaration")); - } + if (!options.noEmit && options.allowJs && options.declaration) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "allowJs", "declaration")); } if (options.emitDecoratorMetadata && !options.experimentalDecorators) { programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators")); } + if (options.reactNamespace && !ts.isIdentifier(options.reactNamespace, languageVersion)) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier, options.reactNamespace)); + } + // If the emit is enabled make sure that every output file is unique and not overwriting any of the input files + if (!options.noEmit && !options.suppressOutputPathCheck) { + var emitHost = getEmitHost(); + var emitFilesSeen_1 = ts.createFileMap(!host.useCaseSensitiveFileNames() ? function (key) { return key.toLocaleLowerCase(); } : undefined); + ts.forEachExpectedEmitFile(emitHost, function (emitFileNames, sourceFiles, isBundledEmit) { + verifyEmitFilePath(emitFileNames.jsFilePath, emitFilesSeen_1); + verifyEmitFilePath(emitFileNames.declarationFilePath, emitFilesSeen_1); + }); + } + // Verify that all the emit files are unique and don't overwrite input files + function verifyEmitFilePath(emitFileName, emitFilesSeen) { + if (emitFileName) { + var emitFilePath = ts.toPath(emitFileName, currentDirectory, getCanonicalFileName); + // Report error if the output overwrites input file + if (filesByName.contains(emitFilePath)) { + createEmitBlockingDiagnostics(emitFileName, emitFilePath, ts.Diagnostics.Cannot_write_file_0_because_it_would_overwrite_input_file); + } + // Report error if multiple files write into same file + if (emitFilesSeen.contains(emitFilePath)) { + // Already seen the same emit file - report error + createEmitBlockingDiagnostics(emitFileName, emitFilePath, ts.Diagnostics.Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files); + } + else { + emitFilesSeen.set(emitFilePath, true); + } + } + } + } + function createEmitBlockingDiagnostics(emitFileName, emitFilePath, message) { + hasEmitBlockingDiagnostics.set(ts.toPath(emitFileName, currentDirectory, getCanonicalFileName), true); + programDiagnostics.add(ts.createCompilerDiagnostic(message, emitFileName)); } } ts.createProgram = createProgram; @@ -38247,6 +43364,12 @@ var ts; type: "boolean", description: ts.Diagnostics.Generates_corresponding_d_ts_file }, + { + name: "declarationDir", + type: "string", + isFilePath: true, + paramType: ts.Diagnostics.DIRECTORY + }, { name: "diagnostics", type: "boolean" @@ -38281,8 +43404,12 @@ var ts; "react": 2 /* React */ }, paramType: ts.Diagnostics.KIND, - description: ts.Diagnostics.Specify_JSX_code_generation_Colon_preserve_or_react, - error: ts.Diagnostics.Argument_for_jsx_must_be_preserve_or_react + description: ts.Diagnostics.Specify_JSX_code_generation_Colon_preserve_or_react + }, + { + name: "reactNamespace", + type: "string", + description: ts.Diagnostics.Specify_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit }, { name: "listFiles", @@ -38296,23 +43423,23 @@ var ts; name: "mapRoot", type: "string", isFilePath: true, - description: ts.Diagnostics.Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations, + description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations, paramType: ts.Diagnostics.LOCATION }, { name: "module", shortName: "m", type: { - "commonjs": 1 /* CommonJS */, - "amd": 2 /* AMD */, - "system": 4 /* System */, - "umd": 3 /* UMD */, - "es6": 5 /* ES6 */, - "es2015": 5 /* ES2015 */ + "none": ts.ModuleKind.None, + "commonjs": ts.ModuleKind.CommonJS, + "amd": ts.ModuleKind.AMD, + "system": ts.ModuleKind.System, + "umd": ts.ModuleKind.UMD, + "es6": ts.ModuleKind.ES6, + "es2015": ts.ModuleKind.ES2015 }, description: ts.Diagnostics.Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015, - paramType: ts.Diagnostics.KIND, - error: ts.Diagnostics.Argument_for_module_option_must_be_commonjs_amd_system_umd_or_es2015 + paramType: ts.Diagnostics.KIND }, { name: "newLine", @@ -38320,9 +43447,8 @@ var ts; "crlf": 0 /* CarriageReturnLineFeed */, "lf": 1 /* LineFeed */ }, - description: ts.Diagnostics.Specifies_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix, - paramType: ts.Diagnostics.NEWLINE, - error: ts.Diagnostics.Argument_for_newLine_option_must_be_CRLF_or_LF + description: ts.Diagnostics.Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix, + paramType: ts.Diagnostics.NEWLINE }, { name: "noEmit", @@ -38343,6 +43469,11 @@ var ts; type: "boolean", description: ts.Diagnostics.Raise_error_on_expressions_and_declarations_with_an_implied_any_type }, + { + name: "noImplicitThis", + type: "boolean", + description: ts.Diagnostics.Raise_error_on_this_expressions_with_an_implied_any_type + }, { name: "noLib", type: "boolean" @@ -38383,7 +43514,6 @@ var ts; }, { name: "pretty", - paramType: ts.Diagnostics.KIND, description: ts.Diagnostics.Stylize_errors_and_messages_using_color_and_context_experimental, type: "boolean" }, @@ -38404,8 +43534,8 @@ var ts; name: "rootDir", type: "string", isFilePath: true, - description: ts.Diagnostics.Specifies_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir, - paramType: ts.Diagnostics.LOCATION + paramType: ts.Diagnostics.LOCATION, + description: ts.Diagnostics.Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir }, { name: "isolatedModules", @@ -38420,7 +43550,7 @@ var ts; name: "sourceRoot", type: "string", isFilePath: true, - description: ts.Diagnostics.Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations, + description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations, paramType: ts.Diagnostics.LOCATION }, { @@ -38449,9 +43579,8 @@ var ts; "es6": 2 /* ES6 */, "es2015": 2 /* ES2015 */ }, - description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015_experimental, - paramType: ts.Diagnostics.VERSION, - error: ts.Diagnostics.Argument_for_target_option_must_be_ES3_ES5_or_ES2015 + description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015, + paramType: ts.Diagnostics.VERSION }, { name: "version", @@ -38479,11 +43608,10 @@ var ts; { name: "moduleResolution", type: { - "node": 2 /* NodeJs */, - "classic": 1 /* Classic */ + "node": ts.ModuleResolutionKind.NodeJs, + "classic": ts.ModuleResolutionKind.Classic }, - description: ts.Diagnostics.Specifies_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6, - error: ts.Diagnostics.Argument_for_moduleResolution_option_must_be_node_or_classic + description: ts.Diagnostics.Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6 }, { name: "allowUnusedLabels", @@ -38509,6 +43637,139 @@ var ts; name: "forceConsistentCasingInFileNames", type: "boolean", description: ts.Diagnostics.Disallow_inconsistently_cased_references_to_the_same_file + }, + { + name: "baseUrl", + type: "string", + isFilePath: true, + description: ts.Diagnostics.Base_directory_to_resolve_non_absolute_module_names + }, + { + // this option can only be specified in tsconfig.json + // use type = object to copy the value as-is + name: "paths", + type: "object", + isTSConfigOnly: true + }, + { + // this option can only be specified in tsconfig.json + // use type = object to copy the value as-is + name: "rootDirs", + type: "list", + isTSConfigOnly: true, + element: { + name: "rootDirs", + type: "string", + isFilePath: true + } + }, + { + name: "typesSearchPaths", + type: "list", + isTSConfigOnly: true, + element: { + name: "typesSearchPaths", + type: "string", + isFilePath: true + } + }, + { + name: "typesRoot", + type: "string" + }, + { + name: "types", + type: "list", + element: { + name: "types", + type: "string" + }, + description: ts.Diagnostics.Type_declaration_files_to_be_included_in_compilation + }, + { + name: "traceResolution", + type: "boolean", + description: ts.Diagnostics.Enable_tracing_of_the_name_resolution_process + }, + { + name: "allowJs", + type: "boolean", + description: ts.Diagnostics.Allow_javascript_files_to_be_compiled + }, + { + name: "allowSyntheticDefaultImports", + type: "boolean", + description: ts.Diagnostics.Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typechecking + }, + { + name: "noImplicitUseStrict", + type: "boolean", + description: ts.Diagnostics.Do_not_emit_use_strict_directives_in_module_output + }, + { + name: "listEmittedFiles", + type: "boolean" + }, + { + name: "lib", + type: "list", + element: { + name: "lib", + type: { + // JavaScript only + "es5": "lib.es5.d.ts", + "es6": "lib.es2015.d.ts", + "es2015": "lib.es2015.d.ts", + "es7": "lib.es2016.d.ts", + "es2016": "lib.es2016.d.ts", + "es2017": "lib.es2017.d.ts", + // Host only + "dom": "lib.dom.d.ts", + "webworker": "lib.webworker.d.ts", + "scripthost": "lib.scripthost.d.ts", + // ES2015 Or ESNext By-feature options + "es2015.core": "lib.es2015.core.d.ts", + "es2015.collection": "lib.es2015.collection.d.ts", + "es2015.generator": "lib.es2015.generator.d.ts", + "es2015.iterable": "lib.es2015.iterable.d.ts", + "es2015.promise": "lib.es2015.promise.d.ts", + "es2015.proxy": "lib.es2015.proxy.d.ts", + "es2015.reflect": "lib.es2015.reflect.d.ts", + "es2015.symbol": "lib.es2015.symbol.d.ts", + "es2015.symbol.wellknown": "lib.es2015.symbol.wellknown.d.ts", + "es2016.array.include": "lib.es2016.array.include.d.ts", + "es2017.object": "lib.es2017.object.d.ts" + } + }, + description: ts.Diagnostics.Specify_library_files_to_be_included_in_the_compilation_Colon + }, + { + name: "strictNullChecks", + type: "boolean", + description: ts.Diagnostics.Enable_strict_null_checks + } + ]; + /* @internal */ + ts.typingOptionDeclarations = [ + { + name: "enableAutoDiscovery", + type: "boolean" + }, + { + name: "include", + type: "list", + element: { + name: "include", + type: "string" + } + }, + { + name: "exclude", + type: "list", + element: { + name: "exclude", + type: "string" + } } ]; var optionNameMapCache; @@ -38529,6 +43790,41 @@ var ts; return optionNameMapCache; } ts.getOptionNameMap = getOptionNameMap; + /* @internal */ + function createCompilerDiagnosticForInvalidCustomType(opt) { + var namesOfType = []; + ts.forEachKey(opt.type, function (key) { + namesOfType.push(" '" + key + "'"); + }); + return ts.createCompilerDiagnostic(ts.Diagnostics.Argument_for_0_option_must_be_Colon_1, "--" + opt.name, namesOfType); + } + ts.createCompilerDiagnosticForInvalidCustomType = createCompilerDiagnosticForInvalidCustomType; + /* @internal */ + function parseCustomTypeOption(opt, value, errors) { + var key = trimString((value || "")).toLowerCase(); + var map = opt.type; + if (ts.hasProperty(map, key)) { + return map[key]; + } + else { + errors.push(createCompilerDiagnosticForInvalidCustomType(opt)); + } + } + ts.parseCustomTypeOption = parseCustomTypeOption; + /* @internal */ + function parseListTypeOption(opt, value, errors) { + var values = trimString((value || "")).split(","); + switch (opt.element.type) { + case "number": + return ts.map(values, parseInt); + case "string": + return ts.map(values, function (v) { return v || ""; }); + default: + return ts.filter(ts.map(values, function (v) { return parseCustomTypeOption(opt.element, v, errors); }), function (v) { return !!v; }); + } + } + ts.parseListTypeOption = parseListTypeOption; + /* @internal */ function parseCommandLine(commandLine, readFile) { var options = {}; var fileNames = []; @@ -38543,7 +43839,8 @@ var ts; function parseStrings(args) { var i = 0; while (i < args.length) { - var s = args[i++]; + var s = args[i]; + i++; if (s.charCodeAt(0) === 64 /* at */) { parseResponseFile(s.slice(1)); } @@ -38555,30 +43852,36 @@ var ts; } if (ts.hasProperty(optionNameMap, s)) { var opt = optionNameMap[s]; - // Check to see if no argument was provided (e.g. "--locale" is the last command-line argument). - if (!args[i] && opt.type !== "boolean") { - errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_expects_an_argument, opt.name)); + if (opt.isTSConfigOnly) { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_can_only_be_specified_in_tsconfig_json_file, opt.name)); } - switch (opt.type) { - case "number": - options[opt.name] = parseInt(args[i++]); - break; - case "boolean": - options[opt.name] = true; - break; - case "string": - options[opt.name] = args[i++] || ""; - break; - // If not a primitive, the possible types are specified in what is effectively a map of options. - default: - var map_2 = opt.type; - var key = (args[i++] || "").toLowerCase(); - if (ts.hasProperty(map_2, key)) { - options[opt.name] = map_2[key]; - } - else { - errors.push(ts.createCompilerDiagnostic(opt.error)); - } + else { + // Check to see if no argument was provided (e.g. "--locale" is the last command-line argument). + if (!args[i] && opt.type !== "boolean") { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_expects_an_argument, opt.name)); + } + switch (opt.type) { + case "number": + options[opt.name] = parseInt(args[i]); + i++; + break; + case "boolean": + options[opt.name] = true; + break; + case "string": + options[opt.name] = args[i] || ""; + i++; + break; + case "list": + options[opt.name] = parseListTypeOption(opt, args[i], errors); + i++; + break; + // If not a primitive, the possible types are specified in what is effectively a map of options. + default: + options[opt.name] = parseCustomTypeOption(opt, args[i], errors); + i++; + break; + } } } else { @@ -38680,6 +43983,9 @@ var ts; } return output; } + // Skip over any minified JavaScript files (ending in ".min.js") + // Skip over dotted files and folders as well + var IgnoreFileNamePattern = /(\.min\.js$)|([\\/]\.[\w.])/; /** * Parse the contents of a config file (tsconfig.json). * @param json The contents of the config file to parse @@ -38687,17 +43993,25 @@ var ts; * @param basePath A root directory to resolve relative path entries in the config * file to. e.g. outDir */ - function parseJsonConfigFileContent(json, host, basePath) { - var _a = convertCompilerOptionsFromJson(json["compilerOptions"], basePath), options = _a.options, errors = _a.errors; + function parseJsonConfigFileContent(json, host, basePath, existingOptions, configFileName) { + if (existingOptions === void 0) { existingOptions = {}; } + var errors = []; + var compilerOptions = convertCompilerOptionsFromJsonWorker(json["compilerOptions"], basePath, errors, configFileName); + var options = ts.extend(existingOptions, compilerOptions); + var typingOptions = convertTypingOptionsFromJsonWorker(json["typingOptions"], basePath, errors, configFileName); + options.configFilePath = configFileName; + var fileNames = getFileNames(errors); return { options: options, - fileNames: getFileNames(), + fileNames: fileNames, + typingOptions: typingOptions, + raw: json, errors: errors }; - function getFileNames() { + function getFileNames(errors) { var fileNames = []; if (ts.hasProperty(json, "files")) { - if (json["files"] instanceof Array) { + if (ts.isArray(json["files"])) { fileNames = ts.map(json["files"], function (s) { return ts.combinePaths(basePath, s); }); } else { @@ -38705,73 +44019,134 @@ var ts; } } else { - var exclude = json["exclude"] instanceof Array ? ts.map(json["exclude"], ts.normalizeSlashes) : undefined; - var sysFiles = host.readDirectory(basePath, ".ts", exclude).concat(host.readDirectory(basePath, ".tsx", exclude)); - for (var i = 0; i < sysFiles.length; i++) { - var name_31 = sysFiles[i]; - if (ts.fileExtensionIs(name_31, ".d.ts")) { - var baseName = name_31.substr(0, name_31.length - ".d.ts".length); - if (!ts.contains(sysFiles, baseName + ".tsx") && !ts.contains(sysFiles, baseName + ".ts")) { - fileNames.push(name_31); + var filesSeen = {}; + var exclude = []; + if (ts.isArray(json["exclude"])) { + exclude = json["exclude"]; + } + else { + // by default exclude node_modules, and any specificied output directory + exclude = ["node_modules", "bower_components", "jspm_packages"]; + } + var outDir = json["compilerOptions"] && json["compilerOptions"]["outDir"]; + if (outDir) { + exclude.push(outDir); + } + exclude = ts.map(exclude, ts.normalizeSlashes); + var supportedExtensions = ts.getSupportedExtensions(options); + ts.Debug.assert(ts.indexOf(supportedExtensions, ".ts") < ts.indexOf(supportedExtensions, ".d.ts"), "Changed priority of extensions to pick"); + // Get files of supported extensions in their order of resolution + for (var _i = 0, supportedExtensions_1 = supportedExtensions; _i < supportedExtensions_1.length; _i++) { + var extension = supportedExtensions_1[_i]; + var filesInDirWithExtension = host.readDirectory(basePath, extension, exclude); + for (var _a = 0, filesInDirWithExtension_1 = filesInDirWithExtension; _a < filesInDirWithExtension_1.length; _a++) { + var fileName = filesInDirWithExtension_1[_a]; + // .ts extension would read the .d.ts extension files too but since .d.ts is lower priority extension, + // lets pick them when its turn comes up + if (extension === ".ts" && ts.fileExtensionIs(fileName, ".d.ts")) { + continue; } - } - else if (ts.fileExtensionIs(name_31, ".ts")) { - if (!ts.contains(sysFiles, name_31 + "x")) { - fileNames.push(name_31); + if (IgnoreFileNamePattern.test(fileName)) { + continue; } - } - else { - fileNames.push(name_31); + // If this is one of the output extension (which would be .d.ts and .js if we are allowing compilation of js files) + // do not include this file if we included .ts or .tsx file with same base name as it could be output of the earlier compilation + if (extension === ".d.ts" || (options.allowJs && ts.contains(ts.supportedJavascriptExtensions, extension))) { + var baseName = fileName.substr(0, fileName.length - extension.length); + if (ts.hasProperty(filesSeen, baseName + ".ts") || ts.hasProperty(filesSeen, baseName + ".tsx")) { + continue; + } + } + filesSeen[fileName] = true; + fileNames.push(fileName); } } } + if (ts.hasProperty(json, "excludes") && !ts.hasProperty(json, "exclude")) { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unknown_option_excludes_Did_you_mean_exclude)); + } return fileNames; } } ts.parseJsonConfigFileContent = parseJsonConfigFileContent; - function convertCompilerOptionsFromJson(jsonOptions, basePath) { - var options = {}; + function convertCompilerOptionsFromJson(jsonOptions, basePath, configFileName) { var errors = []; - if (!jsonOptions) { - return { options: options, errors: errors }; - } - var optionNameMap = ts.arrayToMap(ts.optionDeclarations, function (opt) { return opt.name; }); - for (var id in jsonOptions) { - if (ts.hasProperty(optionNameMap, id)) { - var opt = optionNameMap[id]; - var optType = opt.type; - var value = jsonOptions[id]; - var expectedType = typeof optType === "string" ? optType : "string"; - if (typeof value === expectedType) { - if (typeof optType !== "string") { - var key = value.toLowerCase(); - if (ts.hasProperty(optType, key)) { - value = optType[key]; - } - else { - errors.push(ts.createCompilerDiagnostic(opt.error)); - value = 0; - } - } - if (opt.isFilePath) { - value = ts.normalizePath(ts.combinePaths(basePath, value)); - if (value === "") { - value = "."; - } - } - options[opt.name] = value; - } - else { - errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, id, expectedType)); - } - } - else { - errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unknown_compiler_option_0, id)); - } - } + var options = convertCompilerOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName); return { options: options, errors: errors }; } ts.convertCompilerOptionsFromJson = convertCompilerOptionsFromJson; + function convertTypingOptionsFromJson(jsonOptions, basePath, configFileName) { + var errors = []; + var options = convertTypingOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName); + return { options: options, errors: errors }; + } + ts.convertTypingOptionsFromJson = convertTypingOptionsFromJson; + function convertCompilerOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName) { + var options = ts.getBaseFileName(configFileName) === "jsconfig.json" ? { allowJs: true } : {}; + convertOptionsFromJson(ts.optionDeclarations, jsonOptions, basePath, options, ts.Diagnostics.Unknown_compiler_option_0, errors); + return options; + } + function convertTypingOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName) { + var options = ts.getBaseFileName(configFileName) === "jsconfig.json" + ? { enableAutoDiscovery: true, include: [], exclude: [] } + : { enableAutoDiscovery: false, include: [], exclude: [] }; + convertOptionsFromJson(ts.typingOptionDeclarations, jsonOptions, basePath, options, ts.Diagnostics.Unknown_typing_option_0, errors); + return options; + } + function convertOptionsFromJson(optionDeclarations, jsonOptions, basePath, defaultOptions, diagnosticMessage, errors) { + if (!jsonOptions) { + return; + } + var optionNameMap = ts.arrayToMap(optionDeclarations, function (opt) { return opt.name; }); + for (var id in jsonOptions) { + if (ts.hasProperty(optionNameMap, id)) { + var opt = optionNameMap[id]; + defaultOptions[opt.name] = convertJsonOption(opt, jsonOptions[id], basePath, errors); + } + else { + errors.push(ts.createCompilerDiagnostic(diagnosticMessage, id)); + } + } + } + function convertJsonOption(opt, value, basePath, errors) { + var optType = opt.type; + var expectedType = typeof optType === "string" ? optType : "string"; + if (optType === "list" && ts.isArray(value)) { + return convertJsonOptionOfListType(opt, value, basePath, errors); + } + else if (typeof value === expectedType) { + if (typeof optType !== "string") { + return convertJsonOptionOfCustomType(opt, value, errors); + } + else { + if (opt.isFilePath) { + value = ts.normalizePath(ts.combinePaths(basePath, value)); + if (value === "") { + value = "."; + } + } + } + return value; + } + else { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, opt.name, expectedType)); + } + } + function convertJsonOptionOfCustomType(opt, value, errors) { + var key = value.toLowerCase(); + if (ts.hasProperty(opt.type, key)) { + return opt.type[key]; + } + else { + errors.push(createCompilerDiagnosticForInvalidCustomType(opt)); + } + } + function convertJsonOptionOfListType(option, values, basePath, errors) { + return ts.filter(ts.map(values, function (v) { return convertJsonOption(option.element, v, basePath, errors); }), function (v) { return !!v; }); + } + function trimString(s) { + return typeof s.trim === "function" ? s.trim() : s.replace(/^[\s]+|[\s]+$/g, ""); + } })(ts || (ts = {})); /* @internal */ var ts; @@ -38845,7 +44220,7 @@ var ts; } } function autoCollapse(node) { - return ts.isFunctionBlock(node) && node.parent.kind !== 174 /* ArrowFunction */; + return ts.isFunctionBlock(node) && node.parent.kind !== 180 /* ArrowFunction */; } var depth = 0; var maxDepth = 20; @@ -38857,30 +44232,30 @@ var ts; addOutliningForLeadingCommentsForNode(n); } switch (n.kind) { - case 192 /* Block */: + case 199 /* Block */: if (!ts.isFunctionBlock(n)) { - var parent_7 = n.parent; + var parent_14 = n.parent; var openBrace = ts.findChildOfKind(n, 15 /* OpenBraceToken */, sourceFile); var closeBrace = ts.findChildOfKind(n, 16 /* CloseBraceToken */, sourceFile); // Check if the block is standalone, or 'attached' to some parent statement. - // If the latter, we want to collaps the block, but consider its hint span + // If the latter, we want to collapse the block, but consider its hint span // to be the entire span of the parent. - if (parent_7.kind === 197 /* DoStatement */ || - parent_7.kind === 200 /* ForInStatement */ || - parent_7.kind === 201 /* ForOfStatement */ || - parent_7.kind === 199 /* ForStatement */ || - parent_7.kind === 196 /* IfStatement */ || - parent_7.kind === 198 /* WhileStatement */ || - parent_7.kind === 205 /* WithStatement */ || - parent_7.kind === 244 /* CatchClause */) { - addOutliningSpan(parent_7, openBrace, closeBrace, autoCollapse(n)); + if (parent_14.kind === 204 /* DoStatement */ || + parent_14.kind === 207 /* ForInStatement */ || + parent_14.kind === 208 /* ForOfStatement */ || + parent_14.kind === 206 /* ForStatement */ || + parent_14.kind === 203 /* IfStatement */ || + parent_14.kind === 205 /* WhileStatement */ || + parent_14.kind === 212 /* WithStatement */ || + parent_14.kind === 252 /* CatchClause */) { + addOutliningSpan(parent_14, openBrace, closeBrace, autoCollapse(n)); break; } - if (parent_7.kind === 209 /* TryStatement */) { + if (parent_14.kind === 216 /* TryStatement */) { // Could be the try-block, or the finally-block. - var tryStatement = parent_7; + var tryStatement = parent_14; if (tryStatement.tryBlock === n) { - addOutliningSpan(parent_7, openBrace, closeBrace, autoCollapse(n)); + addOutliningSpan(parent_14, openBrace, closeBrace, autoCollapse(n)); break; } else if (tryStatement.finallyBlock === n) { @@ -38903,23 +44278,23 @@ var ts; break; } // Fallthrough. - case 219 /* ModuleBlock */: { + case 226 /* ModuleBlock */: { var openBrace = ts.findChildOfKind(n, 15 /* OpenBraceToken */, sourceFile); var closeBrace = ts.findChildOfKind(n, 16 /* CloseBraceToken */, sourceFile); addOutliningSpan(n.parent, openBrace, closeBrace, autoCollapse(n)); break; } - case 214 /* ClassDeclaration */: - case 215 /* InterfaceDeclaration */: - case 217 /* EnumDeclaration */: - case 165 /* ObjectLiteralExpression */: - case 220 /* CaseBlock */: { + case 221 /* ClassDeclaration */: + case 222 /* InterfaceDeclaration */: + case 224 /* EnumDeclaration */: + case 171 /* ObjectLiteralExpression */: + case 227 /* CaseBlock */: { var openBrace = ts.findChildOfKind(n, 15 /* OpenBraceToken */, sourceFile); var closeBrace = ts.findChildOfKind(n, 16 /* CloseBraceToken */, sourceFile); addOutliningSpan(n, openBrace, closeBrace, autoCollapse(n)); break; } - case 164 /* ArrayLiteralExpression */: + case 170 /* ArrayLiteralExpression */: var openBracket = ts.findChildOfKind(n, 19 /* OpenBracketToken */, sourceFile); var closeBracket = ts.findChildOfKind(n, 20 /* CloseBracketToken */, sourceFile); addOutliningSpan(n, openBracket, closeBracket, autoCollapse(n)); @@ -38949,17 +44324,17 @@ var ts; ts.forEach(program.getSourceFiles(), function (sourceFile) { cancellationToken.throwIfCancellationRequested(); var nameToDeclarations = sourceFile.getNamedDeclarations(); - for (var name_32 in nameToDeclarations) { - var declarations = ts.getProperty(nameToDeclarations, name_32); + for (var name_34 in nameToDeclarations) { + var declarations = ts.getProperty(nameToDeclarations, name_34); if (declarations) { // First do a quick check to see if the name of the declaration matches the // last portion of the (possibly) dotted name they're searching for. - var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_32); + var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_34); if (!matches) { continue; } - for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) { - var declaration = declarations_6[_i]; + for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) { + var declaration = declarations_7[_i]; // It was a match! If the pattern has dots in it, then also see if the // declaration container matches as well. if (patternMatcher.patternContainsDots) { @@ -38967,14 +44342,14 @@ var ts; if (!containers) { return undefined; } - matches = patternMatcher.getMatches(containers, name_32); + matches = patternMatcher.getMatches(containers, name_34); if (!matches) { continue; } } var fileName = sourceFile.fileName; var matchKind = bestMatchKind(matches); - rawItems.push({ name: name_32, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); + rawItems.push({ name: name_34, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); } } } @@ -39012,8 +44387,8 @@ var ts; if (text !== undefined) { containers.unshift(text); } - else if (declaration.name.kind === 136 /* ComputedPropertyName */) { - return tryAddComputedPropertyName(declaration.name.expression, containers, /*includeLastPortion:*/ true); + else if (declaration.name.kind === 140 /* ComputedPropertyName */) { + return tryAddComputedPropertyName(declaration.name.expression, containers, /*includeLastPortion*/ true); } else { // Don't know how to add this. @@ -39033,12 +44408,12 @@ var ts; } return true; } - if (expression.kind === 166 /* PropertyAccessExpression */) { + if (expression.kind === 172 /* PropertyAccessExpression */) { var propertyAccess = expression; if (includeLastPortion) { containers.unshift(propertyAccess.name.text); } - return tryAddComputedPropertyName(propertyAccess.expression, containers, /*includeLastPortion:*/ true); + return tryAddComputedPropertyName(propertyAccess.expression, containers, /*includeLastPortion*/ true); } return false; } @@ -39046,8 +44421,8 @@ var ts; var containers = []; // First, if we started with a computed property name, then add all but the last // portion into the container array. - if (declaration.name.kind === 136 /* ComputedPropertyName */) { - if (!tryAddComputedPropertyName(declaration.name.expression, containers, /*includeLastPortion:*/ false)) { + if (declaration.name.kind === 140 /* ComputedPropertyName */) { + if (!tryAddComputedPropertyName(declaration.name.expression, containers, /*includeLastPortion*/ false)) { return undefined; } } @@ -39108,7 +44483,12 @@ var ts; (function (ts) { var NavigationBar; (function (NavigationBar) { - function getNavigationBarItems(sourceFile) { + function getNavigationBarItems(sourceFile, compilerOptions) { + // TODO: Handle JS files differently in 'navbar' calls for now, but ideally we should unify + // the 'navbar' and 'navto' logic for TypeScript and JavaScript. + if (ts.isSourceFileJavaScript(sourceFile)) { + return getJsNavigationBarItems(sourceFile, compilerOptions); + } // If the source file has any child items, then it included in the tree // and takes lexical ownership of all other top-level items. var hasGlobalNode = false; @@ -39120,17 +44500,17 @@ var ts; var current = node.parent; while (current) { switch (current.kind) { - case 218 /* ModuleDeclaration */: + case 225 /* ModuleDeclaration */: // If we have a module declared as A.B.C, it is more "intuitive" // to say it only has a single layer of depth do { current = current.parent; - } while (current.kind === 218 /* ModuleDeclaration */); + } while (current.kind === 225 /* ModuleDeclaration */); // fall through - case 214 /* ClassDeclaration */: - case 217 /* EnumDeclaration */: - case 215 /* InterfaceDeclaration */: - case 213 /* FunctionDeclaration */: + case 221 /* ClassDeclaration */: + case 224 /* EnumDeclaration */: + case 222 /* InterfaceDeclaration */: + case 220 /* FunctionDeclaration */: indent++; } current = current.parent; @@ -39141,21 +44521,21 @@ var ts; var childNodes = []; function visit(node) { switch (node.kind) { - case 193 /* VariableStatement */: + case 200 /* VariableStatement */: ts.forEach(node.declarationList.declarations, visit); break; - case 161 /* ObjectBindingPattern */: - case 162 /* ArrayBindingPattern */: + case 167 /* ObjectBindingPattern */: + case 168 /* ArrayBindingPattern */: ts.forEach(node.elements, visit); break; - case 228 /* ExportDeclaration */: + case 236 /* ExportDeclaration */: // Handle named exports case e.g.: // export {a, b as B} from "mod"; if (node.exportClause) { ts.forEach(node.exportClause.elements, visit); } break; - case 222 /* ImportDeclaration */: + case 230 /* ImportDeclaration */: var importClause = node.importClause; if (importClause) { // Handle default import case e.g.: @@ -39167,7 +44547,7 @@ var ts; // import * as NS from "mod"; // import {a, b as B} from "mod"; if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 224 /* NamespaceImport */) { + if (importClause.namedBindings.kind === 232 /* NamespaceImport */) { childNodes.push(importClause.namedBindings); } else { @@ -39176,26 +44556,26 @@ var ts; } } break; - case 163 /* BindingElement */: - case 211 /* VariableDeclaration */: + case 169 /* BindingElement */: + case 218 /* VariableDeclaration */: if (ts.isBindingPattern(node.name)) { visit(node.name); break; } // Fall through - case 214 /* ClassDeclaration */: - case 217 /* EnumDeclaration */: - case 215 /* InterfaceDeclaration */: - case 218 /* ModuleDeclaration */: - case 213 /* FunctionDeclaration */: - case 221 /* ImportEqualsDeclaration */: - case 226 /* ImportSpecifier */: - case 230 /* ExportSpecifier */: + case 221 /* ClassDeclaration */: + case 224 /* EnumDeclaration */: + case 222 /* InterfaceDeclaration */: + case 225 /* ModuleDeclaration */: + case 220 /* FunctionDeclaration */: + case 229 /* ImportEqualsDeclaration */: + case 234 /* ImportSpecifier */: + case 238 /* ExportSpecifier */: childNodes.push(node); break; } } - //for (let i = 0, n = nodes.length; i < n; i++) { + // for (let i = 0, n = nodes.length; i < n; i++) { // let node = nodes[i]; // if (node.kind === SyntaxKind.ClassDeclaration || // node.kind === SyntaxKind.EnumDeclaration || @@ -39207,7 +44587,7 @@ var ts; // else if (node.kind === SyntaxKind.VariableStatement) { // childNodes.push.apply(childNodes, (node).declarations); // } - //} + // } ts.forEach(nodes, visit); return sortNodes(childNodes); } @@ -39238,17 +44618,32 @@ var ts; for (var _i = 0, nodes_4 = nodes; _i < nodes_4.length; _i++) { var node = nodes_4[_i]; switch (node.kind) { - case 214 /* ClassDeclaration */: - case 217 /* EnumDeclaration */: - case 215 /* InterfaceDeclaration */: + case 221 /* ClassDeclaration */: + topLevelNodes.push(node); + for (var _a = 0, _b = node.members; _a < _b.length; _a++) { + var member = _b[_a]; + if (member.kind === 147 /* MethodDeclaration */ || member.kind === 148 /* Constructor */) { + if (member.body) { + // We do not include methods that does not have child functions in it, because of duplications. + if (hasNamedFunctionDeclarations(member.body.statements)) { + topLevelNodes.push(member); + } + addTopLevelNodes(member.body.statements, topLevelNodes); + } + } + } + break; + case 224 /* EnumDeclaration */: + case 222 /* InterfaceDeclaration */: + case 223 /* TypeAliasDeclaration */: topLevelNodes.push(node); break; - case 218 /* ModuleDeclaration */: + case 225 /* ModuleDeclaration */: var moduleDeclaration = node; topLevelNodes.push(node); addTopLevelNodes(getInnermostModule(moduleDeclaration).body.statements, topLevelNodes); break; - case 213 /* FunctionDeclaration */: + case 220 /* FunctionDeclaration */: var functionDeclaration = node; if (isTopLevelFunctionDeclaration(functionDeclaration)) { topLevelNodes.push(node); @@ -39258,20 +44653,36 @@ var ts; } } } + function hasNamedFunctionDeclarations(nodes) { + for (var _i = 0, nodes_5 = nodes; _i < nodes_5.length; _i++) { + var s = nodes_5[_i]; + if (s.kind === 220 /* FunctionDeclaration */ && !isEmpty(s.name.text)) { + return true; + } + } + return false; + } function isTopLevelFunctionDeclaration(functionDeclaration) { - if (functionDeclaration.kind === 213 /* FunctionDeclaration */) { - // A function declaration is 'top level' if it contains any function declarations - // within it. - if (functionDeclaration.body && functionDeclaration.body.kind === 192 /* Block */) { + if (functionDeclaration.kind === 220 /* FunctionDeclaration */) { + // A function declaration is 'top level' if it contains any function declarations + // within it. + if (functionDeclaration.body && functionDeclaration.body.kind === 199 /* Block */) { // Proper function declarations can only have identifier names - if (ts.forEach(functionDeclaration.body.statements, function (s) { return s.kind === 213 /* FunctionDeclaration */ && !isEmpty(s.name.text); })) { + if (hasNamedFunctionDeclarations(functionDeclaration.body.statements)) { return true; } - // Or if it is not parented by another function. i.e all functions - // at module scope are 'top level'. + // Or if it is not parented by another function. I.e all functions at module scope are 'top level'. if (!ts.isFunctionBlock(functionDeclaration.parent)) { return true; } + else { + // We have made sure that a grand parent node exists with 'isFunctionBlock()' above. + var grandParentKind = functionDeclaration.parent.parent.kind; + if (grandParentKind === 147 /* MethodDeclaration */ || + grandParentKind === 148 /* Constructor */) { + return true; + } + } } } return false; @@ -39279,8 +44690,8 @@ var ts; function getItemsWorker(nodes, createItem) { var items = []; var keyToItem = {}; - for (var _i = 0, nodes_5 = nodes; _i < nodes_5.length; _i++) { - var child = nodes_5[_i]; + for (var _i = 0, nodes_6 = nodes; _i < nodes_6.length; _i++) { + var child = nodes_6[_i]; var item = createItem(child); if (item !== undefined) { if (item.text.length > 0) { @@ -39324,44 +44735,44 @@ var ts; } function createChildItem(node) { switch (node.kind) { - case 138 /* Parameter */: + case 142 /* Parameter */: if (ts.isBindingPattern(node.name)) { break; } - if ((node.flags & 1022 /* Modifier */) === 0) { + if ((node.flags & 1023 /* Modifier */) === 0) { return undefined; } return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberFunctionElement); - case 145 /* GetAccessor */: + case 149 /* GetAccessor */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberGetAccessorElement); - case 146 /* SetAccessor */: + case 150 /* SetAccessor */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberSetAccessorElement); - case 149 /* IndexSignature */: + case 153 /* IndexSignature */: return createItem(node, "[]", ts.ScriptElementKind.indexSignatureElement); - case 247 /* EnumMember */: + case 255 /* EnumMember */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); - case 147 /* CallSignature */: + case 151 /* CallSignature */: return createItem(node, "()", ts.ScriptElementKind.callSignatureElement); - case 148 /* ConstructSignature */: + case 152 /* ConstructSignature */: return createItem(node, "new()", ts.ScriptElementKind.constructSignatureElement); - case 141 /* PropertyDeclaration */: - case 140 /* PropertySignature */: + case 145 /* PropertyDeclaration */: + case 144 /* PropertySignature */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); - case 213 /* FunctionDeclaration */: + case 220 /* FunctionDeclaration */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.functionElement); - case 211 /* VariableDeclaration */: - case 163 /* BindingElement */: - var variableDeclarationNode; - var name_33; - if (node.kind === 163 /* BindingElement */) { - name_33 = node.name; + case 218 /* VariableDeclaration */: + case 169 /* BindingElement */: + var variableDeclarationNode = void 0; + var name_35; + if (node.kind === 169 /* BindingElement */) { + name_35 = node.name; variableDeclarationNode = node; // binding elements are added only for variable declarations // bubble up to the containing variable declaration - while (variableDeclarationNode && variableDeclarationNode.kind !== 211 /* VariableDeclaration */) { + while (variableDeclarationNode && variableDeclarationNode.kind !== 218 /* VariableDeclaration */) { variableDeclarationNode = variableDeclarationNode.parent; } ts.Debug.assert(variableDeclarationNode !== undefined); @@ -39369,24 +44780,24 @@ var ts; else { ts.Debug.assert(!ts.isBindingPattern(node.name)); variableDeclarationNode = node; - name_33 = node.name; + name_35 = node.name; } if (ts.isConst(variableDeclarationNode)) { - return createItem(node, getTextOfNode(name_33), ts.ScriptElementKind.constElement); + return createItem(node, getTextOfNode(name_35), ts.ScriptElementKind.constElement); } else if (ts.isLet(variableDeclarationNode)) { - return createItem(node, getTextOfNode(name_33), ts.ScriptElementKind.letElement); + return createItem(node, getTextOfNode(name_35), ts.ScriptElementKind.letElement); } else { - return createItem(node, getTextOfNode(name_33), ts.ScriptElementKind.variableElement); + return createItem(node, getTextOfNode(name_35), ts.ScriptElementKind.variableElement); } - case 144 /* Constructor */: + case 148 /* Constructor */: return createItem(node, "constructor", ts.ScriptElementKind.constructorImplementationElement); - case 230 /* ExportSpecifier */: - case 226 /* ImportSpecifier */: - case 221 /* ImportEqualsDeclaration */: - case 223 /* ImportClause */: - case 224 /* NamespaceImport */: + case 238 /* ExportSpecifier */: + case 234 /* ImportSpecifier */: + case 229 /* ImportEqualsDeclaration */: + case 231 /* ImportClause */: + case 232 /* NamespaceImport */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.alias); } return undefined; @@ -39416,29 +44827,34 @@ var ts; } function createTopLevelItem(node) { switch (node.kind) { - case 248 /* SourceFile */: + case 256 /* SourceFile */: return createSourceFileItem(node); - case 214 /* ClassDeclaration */: + case 221 /* ClassDeclaration */: return createClassItem(node); - case 217 /* EnumDeclaration */: + case 147 /* MethodDeclaration */: + case 148 /* Constructor */: + return createMemberFunctionLikeItem(node); + case 224 /* EnumDeclaration */: return createEnumItem(node); - case 215 /* InterfaceDeclaration */: - return createIterfaceItem(node); - case 218 /* ModuleDeclaration */: + case 222 /* InterfaceDeclaration */: + return createInterfaceItem(node); + case 225 /* ModuleDeclaration */: return createModuleItem(node); - case 213 /* FunctionDeclaration */: + case 220 /* FunctionDeclaration */: return createFunctionItem(node); + case 223 /* TypeAliasDeclaration */: + return createTypeAliasItem(node); } return undefined; function getModuleName(moduleDeclaration) { // We want to maintain quotation marks. - if (moduleDeclaration.name.kind === 9 /* StringLiteral */) { + if (ts.isAmbientModule(moduleDeclaration)) { return getTextOfNode(moduleDeclaration.name); } // Otherwise, we need to aggregate each identifier to build up the qualified name. var result = []; result.push(moduleDeclaration.name.text); - while (moduleDeclaration.body && moduleDeclaration.body.kind === 218 /* ModuleDeclaration */) { + while (moduleDeclaration.body && moduleDeclaration.body.kind === 225 /* ModuleDeclaration */) { moduleDeclaration = moduleDeclaration.body; result.push(moduleDeclaration.name.text); } @@ -39450,12 +44866,32 @@ var ts; return getNavigationBarItem(moduleName, ts.ScriptElementKind.moduleElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } function createFunctionItem(node) { - if (node.body && node.body.kind === 192 /* Block */) { + if (node.body && node.body.kind === 199 /* Block */) { var childItems = getItemsWorker(sortNodes(node.body.statements), createChildItem); return getNavigationBarItem(!node.name ? "default" : node.name.text, ts.ScriptElementKind.functionElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } return undefined; } + function createTypeAliasItem(node) { + return getNavigationBarItem(node.name.text, ts.ScriptElementKind.typeElement, ts.getNodeModifiers(node), [getNodeSpan(node)], [], getIndent(node)); + } + function createMemberFunctionLikeItem(node) { + if (node.body && node.body.kind === 199 /* Block */) { + var childItems = getItemsWorker(sortNodes(node.body.statements), createChildItem); + var scriptElementKind = void 0; + var memberFunctionName = void 0; + if (node.kind === 147 /* MethodDeclaration */) { + memberFunctionName = ts.getPropertyNameForPropertyNameNode(node.name); + scriptElementKind = ts.ScriptElementKind.memberFunctionElement; + } + else { + memberFunctionName = "constructor"; + scriptElementKind = ts.ScriptElementKind.constructorImplementationElement; + } + return getNavigationBarItem(memberFunctionName, scriptElementKind, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); + } + return undefined; + } function createSourceFileItem(node) { var childItems = getItemsWorker(getChildNodes(node.statements), createChildItem); if (childItems === undefined || childItems.length === 0) { @@ -39471,7 +44907,7 @@ var ts; var childItems; if (node.members) { var constructor = ts.forEach(node.members, function (member) { - return member.kind === 144 /* Constructor */ && member; + return member.kind === 148 /* Constructor */ && member; }); // Add the constructor parameters in as children of the class (for property parameters). // Note that *all non-binding pattern named* parameters will be added to the nodes array, but parameters that @@ -39489,13 +44925,13 @@ var ts; var childItems = getItemsWorker(sortNodes(removeComputedProperties(node)), createChildItem); return getNavigationBarItem(node.name.text, ts.ScriptElementKind.enumElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } - function createIterfaceItem(node) { + function createInterfaceItem(node) { var childItems = getItemsWorker(sortNodes(removeDynamicallyNamedProperties(node)), createChildItem); return getNavigationBarItem(node.name.text, ts.ScriptElementKind.interfaceElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } } function removeComputedProperties(node) { - return ts.filter(node.members, function (member) { return member.name === undefined || member.name.kind !== 136 /* ComputedPropertyName */; }); + return ts.filter(node.members, function (member) { return member.name === undefined || member.name.kind !== 140 /* ComputedPropertyName */; }); } /** * Like removeComputedProperties, but retains the properties with well known symbol names @@ -39504,13 +44940,13 @@ var ts; return ts.filter(node.members, function (member) { return !ts.hasDynamicName(member); }); } function getInnermostModule(node) { - while (node.body.kind === 218 /* ModuleDeclaration */) { + while (node.body.kind === 225 /* ModuleDeclaration */) { node = node.body; } return node; } function getNodeSpan(node) { - return node.kind === 248 /* SourceFile */ + return node.kind === 256 /* SourceFile */ ? ts.createTextSpanFromBounds(node.getFullStart(), node.getEnd()) : ts.createTextSpanFromBounds(node.getStart(), node.getEnd()); } @@ -39519,6 +44955,185 @@ var ts; } } NavigationBar.getNavigationBarItems = getNavigationBarItems; + function getJsNavigationBarItems(sourceFile, compilerOptions) { + var anonFnText = ""; + var anonClassText = ""; + var indent = 0; + var rootName = ts.isExternalModule(sourceFile) ? + "\"" + ts.escapeString(ts.getBaseFileName(ts.removeFileExtension(ts.normalizePath(sourceFile.fileName)))) + "\"" + : ""; + var sourceFileItem = getNavBarItem(rootName, ts.ScriptElementKind.moduleElement, [getNodeSpan(sourceFile)]); + var topItem = sourceFileItem; + // Walk the whole file, because we want to also find function expressions - which may be in variable initializer, + // call arguments, expressions, etc... + ts.forEachChild(sourceFile, visitNode); + function visitNode(node) { + var newItem = createNavBarItem(node); + if (newItem) { + topItem.childItems.push(newItem); + } + // Add a level if traversing into a container + if (newItem && (ts.isFunctionLike(node) || ts.isClassLike(node))) { + var lastTop = topItem; + indent++; + topItem = newItem; + ts.forEachChild(node, visitNode); + topItem = lastTop; + indent--; + // If the last item added was an anonymous function expression, and it had no children, discard it. + if (newItem && newItem.text === anonFnText && newItem.childItems.length === 0) { + topItem.childItems.pop(); + } + } + else { + ts.forEachChild(node, visitNode); + } + } + function createNavBarItem(node) { + switch (node.kind) { + case 218 /* VariableDeclaration */: + // Only add to the navbar if at the top-level of the file + // Note: "const" and "let" are also SyntaxKind.VariableDeclarations + if (node.parent /*VariableDeclarationList*/.parent /*VariableStatement*/ + .parent /*SourceFile*/.kind !== 256 /* SourceFile */) { + return undefined; + } + // If it is initialized with a function expression, handle it when we reach the function expression node + var varDecl = node; + if (varDecl.initializer && (varDecl.initializer.kind === 179 /* FunctionExpression */ || + varDecl.initializer.kind === 180 /* ArrowFunction */ || + varDecl.initializer.kind === 192 /* ClassExpression */)) { + return undefined; + } + // Fall through + case 220 /* FunctionDeclaration */: + case 221 /* ClassDeclaration */: + case 148 /* Constructor */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: + // "export default function().." looks just like a regular function/class declaration, except with the 'default' flag + var name_36 = node.flags && (node.flags & 512 /* Default */) && !node.name ? "default" : + node.kind === 148 /* Constructor */ ? "constructor" : + ts.declarationNameToString(node.name); + return getNavBarItem(name_36, getScriptKindForElementKind(node.kind), [getNodeSpan(node)]); + case 179 /* FunctionExpression */: + case 180 /* ArrowFunction */: + case 192 /* ClassExpression */: + return getDefineModuleItem(node) || getFunctionOrClassExpressionItem(node); + case 147 /* MethodDeclaration */: + var methodDecl = node; + return getNavBarItem(ts.declarationNameToString(methodDecl.name), ts.ScriptElementKind.memberFunctionElement, [getNodeSpan(node)]); + case 235 /* ExportAssignment */: + // e.g. "export default " + return getNavBarItem("default", ts.ScriptElementKind.variableElement, [getNodeSpan(node)]); + case 231 /* ImportClause */: + if (!node.name) { + // No default import (this node is still a parent of named & namespace imports, which are handled below) + return undefined; + } + // fall through + case 234 /* ImportSpecifier */: // e.g. 'id' in: import {id} from 'mod' (in NamedImports, in ImportClause) + case 232 /* NamespaceImport */: // e.g. '* as ns' in: import * as ns from 'mod' (in ImportClause) + case 238 /* ExportSpecifier */: + // Export specifiers are only interesting if they are reexports from another module, or renamed, else they are already globals + if (node.kind === 238 /* ExportSpecifier */) { + if (!node.parent.parent.moduleSpecifier && !node.propertyName) { + return undefined; + } + } + var decl = node; + if (!decl.name) { + return undefined; + } + var declName = ts.declarationNameToString(decl.name); + return getNavBarItem(declName, ts.ScriptElementKind.constElement, [getNodeSpan(node)]); + default: + return undefined; + } + } + function getNavBarItem(text, kind, spans, kindModifiers) { + if (kindModifiers === void 0) { kindModifiers = ts.ScriptElementKindModifier.none; } + return { + text: text, kind: kind, kindModifiers: kindModifiers, spans: spans, childItems: [], indent: indent, bolded: false, grayed: false + }; + } + function getDefineModuleItem(node) { + if (node.kind !== 179 /* FunctionExpression */ && node.kind !== 180 /* ArrowFunction */) { + return undefined; + } + // No match if this is not a call expression to an identifier named 'define' + if (node.parent.kind !== 174 /* CallExpression */) { + return undefined; + } + var callExpr = node.parent; + if (callExpr.expression.kind !== 69 /* Identifier */ || callExpr.expression.getText() !== "define") { + return undefined; + } + // Return a module of either the given text in the first argument, or of the source file path + var defaultName = node.getSourceFile().fileName; + if (callExpr.arguments[0].kind === 9 /* StringLiteral */) { + defaultName = (callExpr.arguments[0]).text; + } + return getNavBarItem(defaultName, ts.ScriptElementKind.moduleElement, [getNodeSpan(node.parent)]); + } + function getFunctionOrClassExpressionItem(node) { + if (node.kind !== 179 /* FunctionExpression */ && + node.kind !== 180 /* ArrowFunction */ && + node.kind !== 192 /* ClassExpression */) { + return undefined; + } + var fnExpr = node; + var fnName; + if (fnExpr.name && ts.getFullWidth(fnExpr.name) > 0) { + // The expression has an identifier, so use that as the name + fnName = ts.declarationNameToString(fnExpr.name); + } + else { + // See if it is a var initializer. If so, use the var name. + if (fnExpr.parent.kind === 218 /* VariableDeclaration */) { + fnName = ts.declarationNameToString(fnExpr.parent.name); + } + else if (fnExpr.parent.kind === 187 /* BinaryExpression */ && + fnExpr.parent.operatorToken.kind === 56 /* EqualsToken */) { + fnName = fnExpr.parent.left.getText(); + } + else if (fnExpr.parent.kind === 253 /* PropertyAssignment */ && + fnExpr.parent.name) { + fnName = fnExpr.parent.name.getText(); + } + else { + fnName = node.kind === 192 /* ClassExpression */ ? anonClassText : anonFnText; + } + } + var scriptKind = node.kind === 192 /* ClassExpression */ ? ts.ScriptElementKind.classElement : ts.ScriptElementKind.functionElement; + return getNavBarItem(fnName, scriptKind, [getNodeSpan(node)]); + } + function getNodeSpan(node) { + return node.kind === 256 /* SourceFile */ + ? ts.createTextSpanFromBounds(node.getFullStart(), node.getEnd()) + : ts.createTextSpanFromBounds(node.getStart(), node.getEnd()); + } + function getScriptKindForElementKind(kind) { + switch (kind) { + case 218 /* VariableDeclaration */: + return ts.ScriptElementKind.variableElement; + case 220 /* FunctionDeclaration */: + return ts.ScriptElementKind.functionElement; + case 221 /* ClassDeclaration */: + return ts.ScriptElementKind.classElement; + case 148 /* Constructor */: + return ts.ScriptElementKind.constructorImplementationElement; + case 149 /* GetAccessor */: + return ts.ScriptElementKind.memberGetAccessorElement; + case 150 /* SetAccessor */: + return ts.ScriptElementKind.memberSetAccessorElement; + default: + return "unknown"; + } + } + return sourceFileItem.childItems; + } + NavigationBar.getJsNavigationBarItems = getJsNavigationBarItems; })(NavigationBar = ts.NavigationBar || (ts.NavigationBar = {})); })(ts || (ts = {})); /* @internal */ @@ -39542,12 +45157,11 @@ var ts; } function createPatternMatcher(pattern) { // We'll often see the same candidate string many times when searching (For example, when - // we see the name of a module that is used everywhere, or the name of an overload). As - // such, we cache the information we compute about the candidate for the life of this + // we see the name of a module that is used everywhere, or the name of an overload). As + // such, we cache the information we compute about the candidate for the life of this // pattern matcher so we don't have to compute it multiple times. var stringToWordSpans = {}; pattern = pattern.trim(); - var fullPatternSegment = createSegment(pattern); var dotSeparatedSegments = pattern.split(".").map(function (p) { return createSegment(p.trim()); }); var invalidPattern = dotSeparatedSegments.length === 0 || ts.forEach(dotSeparatedSegments, segmentIsInvalid); return { @@ -39587,7 +45201,7 @@ var ts; // So far so good. Now break up the container for the candidate and check if all // the dotted parts match up correctly. var totalMatch = candidateMatch; - for (var i = dotSeparatedSegments.length - 2, j = candidateContainers.length - 1; i >= 0; i--, j--) { + for (var i = dotSeparatedSegments.length - 2, j = candidateContainers.length - 1; i >= 0; i -= 1, j -= 1) { var segment = dotSeparatedSegments[i]; var containerName = candidateContainers[j]; var containerMatch = matchSegment(containerName, segment); @@ -39626,7 +45240,7 @@ var ts; if (index > 0) { // c) If the part is entirely lowercase, then check if it is contained anywhere in the // candidate in a case insensitive manner. If so, return that there was a substring - // match. + // match. // // Note: We only have a substring match if the lowercase part is prefix match of some // word part. That way we don't match something like 'Class' when the user types 'a'. @@ -39666,8 +45280,8 @@ var ts; if (isLowercase) { // f) Is the pattern a substring of the candidate starting on one of the candidate's word boundaries? // We could check every character boundary start of the candidate for the pattern. However, that's - // an m * n operation in the wost case. Instead, find the first instance of the pattern - // substring, and see if it starts on a capital letter. It seems unlikely that the user will try to + // an m * n operation in the wost case. Instead, find the first instance of the pattern + // substring, and see if it starts on a capital letter. It seems unlikely that the user will try to // filter the list based on a substring that starts on a capital letter and also with a lowercase one. // (Pattern: fogbar, Candidate: quuxfogbarFogBar). if (chunk.text.length < candidate.length) { @@ -39719,7 +45333,7 @@ var ts; // // c) If the word is entirely lowercase, then check if it is contained anywhere in the // candidate in a case insensitive manner. If so, return that there was a substring - // match. + // match. // // Note: We only have a substring match if the lowercase part is prefix match of // some word part. That way we don't match something like 'Class' when the user @@ -39733,7 +45347,7 @@ var ts; // e) If the word was not entirely lowercase, then attempt a camel cased match as // well. // - // f) The word is all lower case. Is it a case insensitive substring of the candidate starting + // f) The word is all lower case. Is it a case insensitive substring of the candidate starting // on a part boundary of the candidate? // // Only if all words have some sort of match is the pattern considered matched. @@ -39783,7 +45397,7 @@ var ts; // Note: we may have more pattern parts than candidate parts. This is because multiple // pattern parts may match a candidate part. For example "SiUI" against "SimpleUI". // We'll have 3 pattern parts Si/U/I against two candidate parts Simple/UI. However, U - // and I will both match in UI. + // and I will both match in UI. var currentCandidate = 0; var currentChunkSpan = 0; var firstMatch = undefined; @@ -39812,13 +45426,13 @@ var ts; // Consider the case of matching SiUI against SimpleUIElement. The candidate parts // will be Simple/UI/Element, and the pattern parts will be Si/U/I. We'll match 'Si' // against 'Simple' first. Then we'll match 'U' against 'UI'. However, we want to - // still keep matching pattern parts against that candidate part. + // still keep matching pattern parts against that candidate part. for (; currentChunkSpan < chunkCharacterSpans.length; currentChunkSpan++) { var chunkCharacterSpan = chunkCharacterSpans[currentChunkSpan]; if (gotOneMatchThisCandidate) { // We've already gotten one pattern part match in this candidate. We will // only continue trying to consumer pattern parts if the last part and this - // part are both upper case. + // part are both upper case. if (!isUpperCaseLetter(chunk.text.charCodeAt(chunkCharacterSpans[currentChunkSpan - 1].start)) || !isUpperCaseLetter(chunk.text.charCodeAt(chunkCharacterSpans[currentChunkSpan].start))) { break; @@ -39848,42 +45462,6 @@ var ts; } } ts.createPatternMatcher = createPatternMatcher; - // Helper function to compare two matches to determine which is better. Matches are first - // ordered by kind (so all prefix matches always beat all substring matches). Then, if the - // match is a camel case match, the relative weights of the match are used to determine - // which is better (with a greater weight being better). Then if the match is of the same - // type, then a case sensitive match is considered better than an insensitive one. - function patternMatchCompareTo(match1, match2) { - return compareType(match1, match2) || - compareCamelCase(match1, match2) || - compareCase(match1, match2) || - comparePunctuation(match1, match2); - } - function comparePunctuation(result1, result2) { - // Consider a match to be better if it was successful without stripping punctuation - // versus a match that had to strip punctuation to succeed. - if (result1.punctuationStripped !== result2.punctuationStripped) { - return result1.punctuationStripped ? 1 : -1; - } - return 0; - } - function compareCase(result1, result2) { - if (result1.isCaseSensitive !== result2.isCaseSensitive) { - return result1.isCaseSensitive ? -1 : 1; - } - return 0; - } - function compareType(result1, result2) { - return result1.kind - result2.kind; - } - function compareCamelCase(result1, result2) { - if (result1.kind === PatternMatchKind.camelCase && result2.kind === PatternMatchKind.camelCase) { - // Swap the values here. If result1 has a higher weight, then we want it to come - // first. - return result2.camelCaseWeight - result1.camelCaseWeight; - } - return 0; - } function createSegment(text) { return { totalTextChunk: createTextChunk(text), @@ -39902,7 +45480,7 @@ var ts; if (ch < 127 /* maxAsciiCharacter */ || !ts.isUnicodeIdentifierStart(ch, 2 /* Latest */)) { return false; } - // TODO: find a way to determine this for any unicode characters in a + // TODO: find a way to determine this for any unicode characters in a // non-allocating manner. var str = String.fromCharCode(ch); return str === str.toUpperCase(); @@ -39915,19 +45493,11 @@ var ts; if (ch < 127 /* maxAsciiCharacter */ || !ts.isUnicodeIdentifierStart(ch, 2 /* Latest */)) { return false; } - // TODO: find a way to determine this for any unicode characters in a + // TODO: find a way to determine this for any unicode characters in a // non-allocating manner. var str = String.fromCharCode(ch); return str === str.toLowerCase(); } - function containsUpperCaseLetter(string) { - for (var i = 0, n = string.length; i < n; i++) { - if (isUpperCaseLetter(string.charCodeAt(i))) { - return true; - } - } - return false; - } function startsWith(string, search) { for (var i = 0, n = search.length; i < n; i++) { if (string.charCodeAt(i) !== search.charCodeAt(i)) { @@ -39964,7 +45534,7 @@ var ts; if (ch < 127 /* maxAsciiCharacter */) { return ch; } - // TODO: find a way to compute this for any unicode characters in a + // TODO: find a way to compute this for any unicode characters in a // non-allocating manner. return String.fromCharCode(ch).toLowerCase().charCodeAt(0); } @@ -39982,9 +45552,10 @@ var ts; for (var i = 0; i < pattern.length; i++) { var ch = pattern.charCodeAt(i); if (isWordChar(ch)) { - if (wordLength++ === 0) { + if (wordLength === 0) { wordStart = i; } + wordLength++; } else { if (wordLength > 0) { @@ -40115,7 +45686,7 @@ var ts; var currentIsUpper = isUpperCaseLetter(identifier.charCodeAt(index)); // See if the casing indicates we're starting a new word. Note: if we're breaking on // words, then just seeing an upper case character isn't enough. Instead, it has to - // be uppercase and the previous character can't be uppercase. + // be uppercase and the previous character can't be uppercase. // // For example, breaking "AddMetadata" on words would make: Add Metadata // @@ -40179,7 +45750,7 @@ var ts; // break; // case TypeScript.SyntaxKind.GreaterThanGreaterThanGreaterThanToken: // stack++; - // // Intentaion fall through + // // Intentional fall through // case TypeScript.SyntaxKind.GreaterThanToken: // stack++; // break; @@ -40199,7 +45770,7 @@ var ts; // } // break; // case TypeScript.SyntaxKind.EqualsGreaterThanToken: - // // This can be a function type or a constructor type. In either case, we want to skip the function defintion + // // This can be a function type or a constructor type. In either case, we want to skip the function definition // token = previousToken(token, /*includeSkippedTokens*/ true); // if (token && token.kind() === TypeScript.SyntaxKind.CloseParenToken) { // // Skip untill the matching open paren token @@ -40218,7 +45789,7 @@ var ts; // } // } // else { - // // This is not a funtion type. exit the main loop + // // This is not a function type. exit the main loop // break whileLoop; // } // break; @@ -40305,7 +45876,7 @@ var ts; } return createSignatureHelpItems(candidates, resolvedSignature, argumentInfo); function createJavaScriptSignatureHelpItems(argumentInfo) { - if (argumentInfo.invocation.kind !== 168 /* CallExpression */) { + if (argumentInfo.invocation.kind !== 174 /* CallExpression */) { return undefined; } // See if we can find some symbol with the call expression name that has call signatures. @@ -40313,7 +45884,7 @@ var ts; var expression = callExpression.expression; var name = expression.kind === 69 /* Identifier */ ? expression - : expression.kind === 166 /* PropertyAccessExpression */ + : expression.kind === 172 /* PropertyAccessExpression */ ? expression.name : undefined; if (!name || !name.text) { @@ -40325,8 +45896,8 @@ var ts; var nameToDeclarations = sourceFile_1.getNamedDeclarations(); var declarations = ts.getProperty(nameToDeclarations, name.text); if (declarations) { - for (var _b = 0, declarations_7 = declarations; _b < declarations_7.length; _b++) { - var declaration = declarations_7[_b]; + for (var _b = 0, declarations_8 = declarations; _b < declarations_8.length; _b++) { + var declaration = declarations_8[_b]; var symbol = declaration.symbol; if (symbol) { var type = typeChecker.getTypeOfSymbolAtLocation(symbol, declaration); @@ -40346,7 +45917,7 @@ var ts; * in the argument of an invocation; returns undefined otherwise. */ function getImmediatelyContainingArgumentInfo(node) { - if (node.parent.kind === 168 /* CallExpression */ || node.parent.kind === 169 /* NewExpression */) { + if (node.parent.kind === 174 /* CallExpression */ || node.parent.kind === 175 /* NewExpression */) { var callExpression = node.parent; // There are 3 cases to handle: // 1. The token introduces a list, and should begin a sig help session @@ -40399,25 +45970,25 @@ var ts; }; } } - else if (node.kind === 11 /* NoSubstitutionTemplateLiteral */ && node.parent.kind === 170 /* TaggedTemplateExpression */) { + else if (node.kind === 11 /* NoSubstitutionTemplateLiteral */ && node.parent.kind === 176 /* TaggedTemplateExpression */) { // Check if we're actually inside the template; // otherwise we'll fall out and return undefined. if (ts.isInsideTemplateLiteral(node, position)) { return getArgumentListInfoForTemplate(node.parent, /*argumentIndex*/ 0); } } - else if (node.kind === 12 /* TemplateHead */ && node.parent.parent.kind === 170 /* TaggedTemplateExpression */) { + else if (node.kind === 12 /* TemplateHead */ && node.parent.parent.kind === 176 /* TaggedTemplateExpression */) { var templateExpression = node.parent; var tagExpression = templateExpression.parent; - ts.Debug.assert(templateExpression.kind === 183 /* TemplateExpression */); + ts.Debug.assert(templateExpression.kind === 189 /* TemplateExpression */); var argumentIndex = ts.isInsideTemplateLiteral(node, position) ? 0 : 1; return getArgumentListInfoForTemplate(tagExpression, argumentIndex); } - else if (node.parent.kind === 190 /* TemplateSpan */ && node.parent.parent.parent.kind === 170 /* TaggedTemplateExpression */) { + else if (node.parent.kind === 197 /* TemplateSpan */ && node.parent.parent.parent.kind === 176 /* TaggedTemplateExpression */) { var templateSpan = node.parent; var templateExpression = templateSpan.parent; var tagExpression = templateExpression.parent; - ts.Debug.assert(templateExpression.kind === 183 /* TemplateExpression */); + ts.Debug.assert(templateExpression.kind === 189 /* TemplateExpression */); // If we're just after a template tail, don't show signature help. if (node.kind === 14 /* TemplateTail */ && !ts.isInsideTemplateLiteral(node, position)) { return undefined; @@ -40535,7 +46106,7 @@ var ts; // // This is because a Missing node has no width. However, what we actually want is to include trivia // leading up to the next token in case the user is about to type in a TemplateMiddle or TemplateTail. - if (template.kind === 183 /* TemplateExpression */) { + if (template.kind === 189 /* TemplateExpression */) { var lastSpan = ts.lastOrUndefined(template.templateSpans); if (lastSpan.literal.getFullWidth() === 0) { applicableSpanEnd = ts.skipTrivia(sourceFile.text, applicableSpanEnd, /*stopAfterLineBreak*/ false); @@ -40544,7 +46115,7 @@ var ts; return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart); } function getContainingArgumentInfo(node) { - for (var n = node; n.kind !== 248 /* SourceFile */; n = n.parent) { + for (var n = node; n.kind !== 256 /* SourceFile */; n = n.parent) { if (ts.isFunctionBlock(n)) { return undefined; } @@ -40609,7 +46180,7 @@ var ts; signatureHelpParameters = typeParameters && typeParameters.length > 0 ? ts.map(typeParameters, createSignatureHelpParameterForTypeParameter) : emptyArray; suffixDisplayParts.push(ts.punctuationPart(27 /* GreaterThanToken */)); var parameterParts = ts.mapToDisplayParts(function (writer) { - return typeChecker.getSymbolDisplayBuilder().buildDisplayForParametersAndDelimiters(candidateSignature.parameters, writer, invocation); + return typeChecker.getSymbolDisplayBuilder().buildDisplayForParametersAndDelimiters(candidateSignature.thisType, candidateSignature.parameters, writer, invocation); }); ts.addRange(suffixDisplayParts, parameterParts); } @@ -40682,31 +46253,6 @@ var ts; /* @internal */ var ts; (function (ts) { - function getEndLinePosition(line, sourceFile) { - ts.Debug.assert(line >= 0); - var lineStarts = sourceFile.getLineStarts(); - var lineIndex = line; - if (lineIndex + 1 === lineStarts.length) { - // last line - return EOF - return sourceFile.text.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(sourceFile.text.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(sourceFile.text.charCodeAt(pos))) { - pos--; - } - return pos; - } - } - ts.getEndLinePosition = getEndLinePosition; function getLineStartPositionForPosition(position, sourceFile) { var lineStarts = sourceFile.getLineStarts(); var line = sourceFile.getLineAndCharacterOfPosition(position).line; @@ -40744,40 +46290,40 @@ var ts; return false; } switch (n.kind) { - case 214 /* ClassDeclaration */: - case 215 /* InterfaceDeclaration */: - case 217 /* EnumDeclaration */: - case 165 /* ObjectLiteralExpression */: - case 161 /* ObjectBindingPattern */: - case 155 /* TypeLiteral */: - case 192 /* Block */: - case 219 /* ModuleBlock */: - case 220 /* CaseBlock */: + case 221 /* ClassDeclaration */: + case 222 /* InterfaceDeclaration */: + case 224 /* EnumDeclaration */: + case 171 /* ObjectLiteralExpression */: + case 167 /* ObjectBindingPattern */: + case 159 /* TypeLiteral */: + case 199 /* Block */: + case 226 /* ModuleBlock */: + case 227 /* CaseBlock */: return nodeEndsWith(n, 16 /* CloseBraceToken */, sourceFile); - case 244 /* CatchClause */: + case 252 /* CatchClause */: return isCompletedNode(n.block, sourceFile); - case 169 /* NewExpression */: + case 175 /* NewExpression */: if (!n.arguments) { return true; } // fall through - case 168 /* CallExpression */: - case 172 /* ParenthesizedExpression */: - case 160 /* ParenthesizedType */: + case 174 /* CallExpression */: + case 178 /* ParenthesizedExpression */: + case 164 /* ParenthesizedType */: return nodeEndsWith(n, 18 /* CloseParenToken */, sourceFile); - case 152 /* FunctionType */: - case 153 /* ConstructorType */: + case 156 /* FunctionType */: + case 157 /* ConstructorType */: return isCompletedNode(n.type, sourceFile); - case 144 /* Constructor */: - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: - case 213 /* FunctionDeclaration */: - case 173 /* FunctionExpression */: - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - case 148 /* ConstructSignature */: - case 147 /* CallSignature */: - case 174 /* ArrowFunction */: + case 148 /* Constructor */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: + case 220 /* FunctionDeclaration */: + case 179 /* FunctionExpression */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: + case 152 /* ConstructSignature */: + case 151 /* CallSignature */: + case 180 /* ArrowFunction */: if (n.body) { return isCompletedNode(n.body, sourceFile); } @@ -40787,64 +46333,64 @@ var ts; // Even though type parameters can be unclosed, we can get away with // having at least a closing paren. return hasChildOfKind(n, 18 /* CloseParenToken */, sourceFile); - case 218 /* ModuleDeclaration */: + case 225 /* ModuleDeclaration */: return n.body && isCompletedNode(n.body, sourceFile); - case 196 /* IfStatement */: + case 203 /* IfStatement */: if (n.elseStatement) { return isCompletedNode(n.elseStatement, sourceFile); } return isCompletedNode(n.thenStatement, sourceFile); - case 195 /* ExpressionStatement */: + case 202 /* ExpressionStatement */: return isCompletedNode(n.expression, sourceFile) || hasChildOfKind(n, 23 /* SemicolonToken */); - case 164 /* ArrayLiteralExpression */: - case 162 /* ArrayBindingPattern */: - case 167 /* ElementAccessExpression */: - case 136 /* ComputedPropertyName */: - case 157 /* TupleType */: + case 170 /* ArrayLiteralExpression */: + case 168 /* ArrayBindingPattern */: + case 173 /* ElementAccessExpression */: + case 140 /* ComputedPropertyName */: + case 161 /* TupleType */: return nodeEndsWith(n, 20 /* CloseBracketToken */, sourceFile); - case 149 /* IndexSignature */: + case 153 /* IndexSignature */: if (n.type) { return isCompletedNode(n.type, sourceFile); } return hasChildOfKind(n, 20 /* CloseBracketToken */, sourceFile); - case 241 /* CaseClause */: - case 242 /* DefaultClause */: - // there is no such thing as terminator token for CaseClause/DefaultClause so for simplicitly always consider them non-completed + case 249 /* CaseClause */: + case 250 /* DefaultClause */: + // there is no such thing as terminator token for CaseClause/DefaultClause so for simplicity always consider them non-completed return false; - case 199 /* ForStatement */: - case 200 /* ForInStatement */: - case 201 /* ForOfStatement */: - case 198 /* WhileStatement */: + case 206 /* ForStatement */: + case 207 /* ForInStatement */: + case 208 /* ForOfStatement */: + case 205 /* WhileStatement */: return isCompletedNode(n.statement, sourceFile); - case 197 /* DoStatement */: + case 204 /* DoStatement */: // rough approximation: if DoStatement has While keyword - then if node is completed is checking the presence of ')'; var hasWhileKeyword = findChildOfKind(n, 104 /* WhileKeyword */, sourceFile); if (hasWhileKeyword) { return nodeEndsWith(n, 18 /* CloseParenToken */, sourceFile); } return isCompletedNode(n.statement, sourceFile); - case 154 /* TypeQuery */: + case 158 /* TypeQuery */: return isCompletedNode(n.exprName, sourceFile); - case 176 /* TypeOfExpression */: - case 175 /* DeleteExpression */: - case 177 /* VoidExpression */: - case 184 /* YieldExpression */: - case 185 /* SpreadElementExpression */: + case 182 /* TypeOfExpression */: + case 181 /* DeleteExpression */: + case 183 /* VoidExpression */: + case 190 /* YieldExpression */: + case 191 /* SpreadElementExpression */: var unaryWordExpression = n; return isCompletedNode(unaryWordExpression.expression, sourceFile); - case 170 /* TaggedTemplateExpression */: + case 176 /* TaggedTemplateExpression */: return isCompletedNode(n.template, sourceFile); - case 183 /* TemplateExpression */: + case 189 /* TemplateExpression */: var lastSpan = ts.lastOrUndefined(n.templateSpans); return isCompletedNode(lastSpan, sourceFile); - case 190 /* TemplateSpan */: + case 197 /* TemplateSpan */: return ts.nodeIsPresent(n.literal); - case 179 /* PrefixUnaryExpression */: + case 185 /* PrefixUnaryExpression */: return isCompletedNode(n.operand, sourceFile); - case 181 /* BinaryExpression */: + case 187 /* BinaryExpression */: return isCompletedNode(n.right, sourceFile); - case 182 /* ConditionalExpression */: + case 188 /* ConditionalExpression */: return isCompletedNode(n.whenFalse, sourceFile); default: return true; @@ -40900,7 +46446,7 @@ var ts; // for the position of the relevant node (or comma). var syntaxList = ts.forEach(node.parent.getChildren(), function (c) { // find syntax list that covers the span of the node - if (c.kind === 271 /* SyntaxList */ && c.pos <= node.pos && c.end >= node.end) { + if (c.kind === 279 /* SyntaxList */ && c.pos <= node.pos && c.end >= node.end) { return c; } }); @@ -40917,7 +46463,7 @@ var ts; } ts.getTouchingWord = getTouchingWord; /* Gets the token whose text has range [start, end) and position >= start - * and (position < end or (position === end && token is keyword or identifier or numeric\string litera)) + * and (position < end or (position === end && token is keyword or identifier or numeric/string literal)) */ function getTouchingPropertyName(sourceFile, position) { return getTouchingToken(sourceFile, position, function (n) { return isPropertyName(n.kind); }); @@ -41006,7 +46552,7 @@ var ts; function findPrecedingToken(position, sourceFile, startNode) { return find(startNode || sourceFile); function findRightmostToken(n) { - if (isToken(n) || n.kind === 236 /* JsxText */) { + if (isToken(n) || n.kind === 244 /* JsxText */) { return n; } var children = n.getChildren(); @@ -41014,7 +46560,7 @@ var ts; return candidate && findRightmostToken(candidate); } function find(n) { - if (isToken(n) || n.kind === 236 /* JsxText */) { + if (isToken(n) || n.kind === 244 /* JsxText */) { return n; } var children = n.getChildren(); @@ -41028,10 +46574,10 @@ var ts; // if no - position is in the node itself so we should recurse in it. // NOTE: JsxText is a weird kind of node that can contain only whitespaces (since they are not counted as trivia). // if this is the case - then we should assume that token in question is located in previous child. - if (position < child.end && (nodeHasTokens(child) || child.kind === 236 /* JsxText */)) { + if (position < child.end && (nodeHasTokens(child) || child.kind === 244 /* JsxText */)) { var start = child.getStart(sourceFile); var lookInPreviousChild = (start >= position) || - (child.kind === 236 /* JsxText */ && start === child.end); // whitespace only JsxText + (child.kind === 244 /* JsxText */ && start === child.end); // whitespace only JsxText if (lookInPreviousChild) { // actual start of the node is past the position - previous token should be at the end of previous child var candidate = findRightmostChildNodeWithTokens(children, /*exclusiveStartPosition*/ i); @@ -41043,8 +46589,8 @@ var ts; } } } - ts.Debug.assert(startNode !== undefined || n.kind === 248 /* SourceFile */); - // Here we know that none of child token nodes embrace the position, + ts.Debug.assert(startNode !== undefined || n.kind === 256 /* SourceFile */); + // Here we know that none of child token nodes embrace the position, // the only known case is when position is at the end of the file. // Try to find the rightmost token in the file without filtering. // Namely we are skipping the check: 'position < node.end' @@ -41065,20 +46611,54 @@ var ts; ts.findPrecedingToken = findPrecedingToken; function isInString(sourceFile, position) { var token = getTokenAtPosition(sourceFile, position); - return token && token.kind === 9 /* StringLiteral */ && position > token.getStart(); + return token && (token.kind === 9 /* StringLiteral */ || token.kind === 166 /* StringLiteralType */) && position > token.getStart(sourceFile); } ts.isInString = isInString; function isInComment(sourceFile, position) { return isInCommentHelper(sourceFile, position, /*predicate*/ undefined); } ts.isInComment = isInComment; + /** + * returns true if the position is in between the open and close elements of an JSX expression. + */ + function isInsideJsxElementOrAttribute(sourceFile, position) { + var token = getTokenAtPosition(sourceFile, position); + if (!token) { + return false; + } + //
Hello |
+ if (token.kind === 25 /* LessThanToken */ && token.parent.kind === 244 /* JsxText */) { + return true; + } + //
{ |
or
+ if (token.kind === 25 /* LessThanToken */ && token.parent.kind === 248 /* JsxExpression */) { + return true; + } + //
{ + // | + // } < /div> + if (token && token.kind === 16 /* CloseBraceToken */ && token.parent.kind === 248 /* JsxExpression */) { + return true; + } + //
|
+ if (token.kind === 25 /* LessThanToken */ && token.parent.kind === 245 /* JsxClosingElement */) { + return true; + } + return false; + } + ts.isInsideJsxElementOrAttribute = isInsideJsxElementOrAttribute; + function isInTemplateString(sourceFile, position) { + var token = getTokenAtPosition(sourceFile, position); + return ts.isTemplateLiteralKind(token.kind) && position > token.getStart(sourceFile); + } + ts.isInTemplateString = isInTemplateString; /** * Returns true if the cursor at position in sourceFile is within a comment that additionally * satisfies predicate, and false otherwise. */ function isInCommentHelper(sourceFile, position, predicate) { var token = getTokenAtPosition(sourceFile, position); - if (token && position <= token.getStart()) { + if (token && position <= token.getStart(sourceFile)) { var commentRanges = ts.getLeadingCommentRanges(sourceFile.text, token.pos); // The end marker of a single-line comment does not include the newline character. // In the following case, we are inside a comment (^ denotes the cursor position): @@ -41107,7 +46687,7 @@ var ts; return ts.forEach(commentRanges, jsDocPrefix); function jsDocPrefix(c) { var text = sourceFile.text; - return text.length >= c.pos + 3 && text[c.pos] === '/' && text[c.pos + 1] === '*' && text[c.pos + 2] === '*'; + return text.length >= c.pos + 3 && text[c.pos] === "/" && text[c.pos + 1] === "*" && text[c.pos + 2] === "*"; } } ts.hasDocComment = hasDocComment; @@ -41151,35 +46731,35 @@ var ts; function getNodeModifiers(node) { var flags = ts.getCombinedNodeFlags(node); var result = []; - if (flags & 16 /* Private */) + if (flags & 8 /* Private */) result.push(ts.ScriptElementKindModifier.privateMemberModifier); - if (flags & 32 /* Protected */) + if (flags & 16 /* Protected */) result.push(ts.ScriptElementKindModifier.protectedMemberModifier); - if (flags & 8 /* Public */) + if (flags & 4 /* Public */) result.push(ts.ScriptElementKindModifier.publicMemberModifier); - if (flags & 64 /* Static */) + if (flags & 32 /* Static */) result.push(ts.ScriptElementKindModifier.staticModifier); if (flags & 128 /* Abstract */) result.push(ts.ScriptElementKindModifier.abstractModifier); - if (flags & 2 /* Export */) + if (flags & 1 /* Export */) result.push(ts.ScriptElementKindModifier.exportedModifier); if (ts.isInAmbientContext(node)) result.push(ts.ScriptElementKindModifier.ambientModifier); - return result.length > 0 ? result.join(',') : ts.ScriptElementKindModifier.none; + return result.length > 0 ? result.join(",") : ts.ScriptElementKindModifier.none; } ts.getNodeModifiers = getNodeModifiers; function getTypeArgumentOrTypeParameterList(node) { - if (node.kind === 151 /* TypeReference */ || node.kind === 168 /* CallExpression */) { + if (node.kind === 155 /* TypeReference */ || node.kind === 174 /* CallExpression */) { return node.typeArguments; } - if (ts.isFunctionLike(node) || node.kind === 214 /* ClassDeclaration */ || node.kind === 215 /* InterfaceDeclaration */) { + if (ts.isFunctionLike(node) || node.kind === 221 /* ClassDeclaration */ || node.kind === 222 /* InterfaceDeclaration */) { return node.typeParameters; } return undefined; } ts.getTypeArgumentOrTypeParameterList = getTypeArgumentOrTypeParameterList; function isToken(n) { - return n.kind >= 0 /* FirstToken */ && n.kind <= 134 /* LastToken */; + return n.kind >= 0 /* FirstToken */ && n.kind <= 138 /* LastToken */; } ts.isToken = isToken; function isWord(kind) { @@ -41195,6 +46775,7 @@ var ts; ts.isComment = isComment; function isStringOrRegularExpressionOrTemplateLiteral(kind) { if (kind === 9 /* StringLiteral */ + || kind === 166 /* StringLiteralType */ || kind === 10 /* RegularExpressionLiteral */ || ts.isTemplateLiteralKind(kind)) { return true; @@ -41237,13 +46818,40 @@ var ts; return true; } ts.compareDataObjects = compareDataObjects; + function isArrayLiteralOrObjectLiteralDestructuringPattern(node) { + if (node.kind === 170 /* ArrayLiteralExpression */ || + node.kind === 171 /* ObjectLiteralExpression */) { + // [a,b,c] from: + // [a, b, c] = someExpression; + if (node.parent.kind === 187 /* BinaryExpression */ && + node.parent.left === node && + node.parent.operatorToken.kind === 56 /* EqualsToken */) { + return true; + } + // [a, b, c] from: + // for([a, b, c] of expression) + if (node.parent.kind === 208 /* ForOfStatement */ && + node.parent.initializer === node) { + return true; + } + // [a, b, c] of + // [x, [a, b, c] ] = someExpression + // or + // {x, a: {a, b, c} } = someExpression + if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 253 /* PropertyAssignment */ ? node.parent.parent : node.parent)) { + return true; + } + } + return false; + } + ts.isArrayLiteralOrObjectLiteralDestructuringPattern = isArrayLiteralOrObjectLiteralDestructuringPattern; })(ts || (ts = {})); // Display-part writer helpers /* @internal */ var ts; (function (ts) { function isFirstDeclarationOfSymbolParameter(symbol) { - return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 138 /* Parameter */; + return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 142 /* Parameter */; } ts.isFirstDeclarationOfSymbolParameter = isFirstDeclarationOfSymbolParameter; var displayPartWriter = getDisplayPartWriter(); @@ -41422,6 +47030,10 @@ var ts; if (isImportOrExportSpecifierName(location)) { return location.getText(); } + else if (ts.isStringOrNumericLiteral(location.kind) && + location.parent.kind === 140 /* ComputedPropertyName */) { + return location.text; + } // Try to get the local symbol if we're dealing with an 'export default' // since that symbol has the "true" name. var localExportDefaultSymbol = ts.getLocalSymbolForExportDefault(symbol); @@ -41431,7 +47043,7 @@ var ts; ts.getDeclaredName = getDeclaredName; function isImportOrExportSpecifierName(location) { return location.parent && - (location.parent.kind === 226 /* ImportSpecifier */ || location.parent.kind === 230 /* ExportSpecifier */) && + (location.parent.kind === 234 /* ImportSpecifier */ || location.parent.kind === 238 /* ExportSpecifier */) && location.parent.propertyName === location; } ts.isImportOrExportSpecifierName = isImportOrExportSpecifierName; @@ -41451,6 +47063,216 @@ var ts; return name; } ts.stripQuotes = stripQuotes; + function scriptKindIs(fileName, host) { + var scriptKinds = []; + for (var _i = 2; _i < arguments.length; _i++) { + scriptKinds[_i - 2] = arguments[_i]; + } + var scriptKind = getScriptKind(fileName, host); + return ts.forEach(scriptKinds, function (k) { return k === scriptKind; }); + } + ts.scriptKindIs = scriptKindIs; + function getScriptKind(fileName, host) { + // First check to see if the script kind was specified by the host. Chances are the host + // may override the default script kind for the file extension. + var scriptKind; + if (host && host.getScriptKind) { + scriptKind = host.getScriptKind(fileName); + } + if (!scriptKind || scriptKind === 0 /* Unknown */) { + scriptKind = ts.getScriptKindFromFileName(fileName); + } + return ts.ensureScriptKind(fileName, scriptKind); + } + ts.getScriptKind = getScriptKind; +})(ts || (ts = {})); +// Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. +// See LICENSE.txt in the project root for complete license information. +/// +/* @internal */ +var ts; +(function (ts) { + var JsTyping; + (function (JsTyping) { + ; + ; + // A map of loose file names to library names + // that we are confident require typings + var safeList; + /** + * @param host is the object providing I/O related operations. + * @param fileNames are the file names that belong to the same project + * @param projectRootPath is the path to the project root directory + * @param safeListPath is the path used to retrieve the safe list + * @param packageNameToTypingLocation is the map of package names to their cached typing locations + * @param typingOptions are used to customize the typing inference process + * @param compilerOptions are used as a source for typing inference + */ + function discoverTypings(host, fileNames, projectRootPath, safeListPath, packageNameToTypingLocation, typingOptions, compilerOptions) { + // A typing name to typing file path mapping + var inferredTypings = {}; + if (!typingOptions || !typingOptions.enableAutoDiscovery) { + return { cachedTypingPaths: [], newTypingNames: [], filesToWatch: [] }; + } + // Only infer typings for .js and .jsx files + fileNames = ts.filter(ts.map(fileNames, ts.normalizePath), function (f) { return ts.scriptKindIs(f, /*LanguageServiceHost*/ undefined, 1 /* JS */, 2 /* JSX */); }); + if (!safeList) { + var result = ts.readConfigFile(safeListPath, function (path) { return host.readFile(path); }); + if (result.config) { + safeList = result.config; + } + else { + safeList = {}; + } + ; + } + var filesToWatch = []; + // Directories to search for package.json, bower.json and other typing information + var searchDirs = []; + var exclude = []; + mergeTypings(typingOptions.include); + exclude = typingOptions.exclude || []; + var possibleSearchDirs = ts.map(fileNames, ts.getDirectoryPath); + if (projectRootPath !== undefined) { + possibleSearchDirs.push(projectRootPath); + } + searchDirs = ts.deduplicate(possibleSearchDirs); + for (var _i = 0, searchDirs_1 = searchDirs; _i < searchDirs_1.length; _i++) { + var searchDir = searchDirs_1[_i]; + var packageJsonPath = ts.combinePaths(searchDir, "package.json"); + getTypingNamesFromJson(packageJsonPath, filesToWatch); + var bowerJsonPath = ts.combinePaths(searchDir, "bower.json"); + getTypingNamesFromJson(bowerJsonPath, filesToWatch); + var nodeModulesPath = ts.combinePaths(searchDir, "node_modules"); + getTypingNamesFromNodeModuleFolder(nodeModulesPath); + } + getTypingNamesFromSourceFileNames(fileNames); + // Add the cached typing locations for inferred typings that are already installed + for (var name_37 in packageNameToTypingLocation) { + if (ts.hasProperty(inferredTypings, name_37) && !inferredTypings[name_37]) { + inferredTypings[name_37] = packageNameToTypingLocation[name_37]; + } + } + // Remove typings that the user has added to the exclude list + for (var _a = 0, exclude_1 = exclude; _a < exclude_1.length; _a++) { + var excludeTypingName = exclude_1[_a]; + delete inferredTypings[excludeTypingName]; + } + var newTypingNames = []; + var cachedTypingPaths = []; + for (var typing in inferredTypings) { + if (inferredTypings[typing] !== undefined) { + cachedTypingPaths.push(inferredTypings[typing]); + } + else { + newTypingNames.push(typing); + } + } + return { cachedTypingPaths: cachedTypingPaths, newTypingNames: newTypingNames, filesToWatch: filesToWatch }; + /** + * Merge a given list of typingNames to the inferredTypings map + */ + function mergeTypings(typingNames) { + if (!typingNames) { + return; + } + for (var _i = 0, typingNames_1 = typingNames; _i < typingNames_1.length; _i++) { + var typing = typingNames_1[_i]; + if (!ts.hasProperty(inferredTypings, typing)) { + inferredTypings[typing] = undefined; + } + } + } + /** + * Get the typing info from common package manager json files like package.json or bower.json + */ + function getTypingNamesFromJson(jsonPath, filesToWatch) { + var result = ts.readConfigFile(jsonPath, function (path) { return host.readFile(path); }); + if (result.config) { + var jsonConfig = result.config; + filesToWatch.push(jsonPath); + if (jsonConfig.dependencies) { + mergeTypings(ts.getKeys(jsonConfig.dependencies)); + } + if (jsonConfig.devDependencies) { + mergeTypings(ts.getKeys(jsonConfig.devDependencies)); + } + if (jsonConfig.optionalDependencies) { + mergeTypings(ts.getKeys(jsonConfig.optionalDependencies)); + } + if (jsonConfig.peerDependencies) { + mergeTypings(ts.getKeys(jsonConfig.peerDependencies)); + } + } + } + /** + * Infer typing names from given file names. For example, the file name "jquery-min.2.3.4.js" + * should be inferred to the 'jquery' typing name; and "angular-route.1.2.3.js" should be inferred + * to the 'angular-route' typing name. + * @param fileNames are the names for source files in the project + */ + function getTypingNamesFromSourceFileNames(fileNames) { + var jsFileNames = ts.filter(fileNames, ts.hasJavaScriptFileExtension); + var inferredTypingNames = ts.map(jsFileNames, function (f) { return ts.removeFileExtension(ts.getBaseFileName(f.toLowerCase())); }); + var cleanedTypingNames = ts.map(inferredTypingNames, function (f) { return f.replace(/((?:\.|-)min(?=\.|$))|((?:-|\.)\d+)/g, ""); }); + if (safeList === undefined) { + mergeTypings(cleanedTypingNames); + } + else { + mergeTypings(ts.filter(cleanedTypingNames, function (f) { return ts.hasProperty(safeList, f); })); + } + var hasJsxFile = ts.forEach(fileNames, function (f) { return ts.scriptKindIs(f, /*LanguageServiceHost*/ undefined, 2 /* JSX */); }); + if (hasJsxFile) { + mergeTypings(["react"]); + } + } + /** + * Infer typing names from node_module folder + * @param nodeModulesPath is the path to the "node_modules" folder + */ + function getTypingNamesFromNodeModuleFolder(nodeModulesPath) { + // Todo: add support for ModuleResolutionHost too + if (!host.directoryExists(nodeModulesPath)) { + return; + } + var typingNames = []; + var fileNames = host.readDirectory(nodeModulesPath, "*.json", /*exclude*/ undefined, /*depth*/ 2); + for (var _i = 0, fileNames_1 = fileNames; _i < fileNames_1.length; _i++) { + var fileName = fileNames_1[_i]; + var normalizedFileName = ts.normalizePath(fileName); + if (ts.getBaseFileName(normalizedFileName) !== "package.json") { + continue; + } + var result = ts.readConfigFile(normalizedFileName, function (path) { return host.readFile(path); }); + if (!result.config) { + continue; + } + var packageJson = result.config; + // npm 3's package.json contains a "_requiredBy" field + // we should include all the top level module names for npm 2, and only module names whose + // "_requiredBy" field starts with "#" or equals "/" for npm 3. + if (packageJson._requiredBy && + ts.filter(packageJson._requiredBy, function (r) { return r[0] === "#" || r === "/"; }).length === 0) { + continue; + } + // If the package has its own d.ts typings, those will take precedence. Otherwise the package name will be used + // to download d.ts files from DefinitelyTyped + if (!packageJson.name) { + continue; + } + if (packageJson.typings) { + var absolutePath = ts.getNormalizedAbsolutePath(packageJson.typings, ts.getDirectoryPath(normalizedFileName)); + inferredTypings[packageJson.name] = absolutePath; + } + else { + typingNames.push(packageJson.name); + } + } + mergeTypings(typingNames); + } + } + JsTyping.discoverTypings = discoverTypings; + })(JsTyping = ts.JsTyping || (ts.JsTyping = {})); })(ts || (ts = {})); /// /// @@ -41488,6 +47310,7 @@ var ts; advance: advance, readTokenInfo: readTokenInfo, isOnToken: isOnToken, + getCurrentLeadingTrivia: function () { return leadingTrivia; }, lastTrailingTriviaWasNewLine: function () { return wasNewLine; }, close: function () { ts.Debug.assert(scanner !== undefined); @@ -41553,10 +47376,10 @@ var ts; function shouldRescanJsxIdentifier(node) { if (node.parent) { switch (node.parent.kind) { - case 238 /* JsxAttribute */: - case 235 /* JsxOpeningElement */: - case 237 /* JsxClosingElement */: - case 234 /* JsxSelfClosingElement */: + case 246 /* JsxAttribute */: + case 243 /* JsxOpeningElement */: + case 245 /* JsxClosingElement */: + case 242 /* JsxSelfClosingElement */: return node.kind === 69 /* Identifier */; } } @@ -41597,7 +47420,7 @@ var ts; // readTokenInfo was called before with the same expected scan action. // No need to re-scan text, return existing 'lastTokenInfo' // it is ok to call fixTokenKind here since it does not affect - // what portion of text is consumed. In opposize rescanning can change it, + // what portion of text is consumed. In contrast rescanning can change it, // i.e. for '>=' when originally scanner eats just one character // and rescanning forces it to consume more. return fixTokenKind(lastTokenInfo, n); @@ -41763,7 +47586,7 @@ var ts; return false; }; return FormattingContext; - })(); + }()); formatting.FormattingContext = FormattingContext; })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); @@ -41802,7 +47625,7 @@ var ts; "flag=" + this.Flag + "]"; }; return Rule; - })(); + }()); formatting.Rule = Rule; })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); @@ -41849,7 +47672,7 @@ var ts; return new RuleDescriptor(left, right); }; return RuleDescriptor; - })(); + }()); formatting.RuleDescriptor = RuleDescriptor; })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); @@ -41891,7 +47714,7 @@ var ts; return result; }; return RuleOperation; - })(); + }()); formatting.RuleOperation = RuleOperation; })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); @@ -41926,7 +47749,7 @@ var ts; }; RuleOperationContext.Any = new RuleOperationContext(); return RuleOperationContext; - })(); + }()); formatting.RuleOperationContext = RuleOperationContext; })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); @@ -41945,25 +47768,25 @@ var ts; this.IgnoreBeforeComment = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.Comments), formatting.RuleOperation.create1(1 /* Ignore */)); this.IgnoreAfterLineComment = new formatting.Rule(formatting.RuleDescriptor.create3(2 /* SingleLineCommentTrivia */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create1(1 /* Ignore */)); // Space after keyword but not before ; or : or ? - this.NoSpaceBeforeSemicolon = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 23 /* SemicolonToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.NoSpaceBeforeColon = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 54 /* ColonToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8 /* Delete */)); - this.NoSpaceBeforeQuestionMark = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 53 /* QuestionToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8 /* Delete */)); - this.SpaceAfterColon = new formatting.Rule(formatting.RuleDescriptor.create3(54 /* ColonToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 2 /* Space */)); - this.SpaceAfterQuestionMarkInConditionalOperator = new formatting.Rule(formatting.RuleDescriptor.create3(53 /* QuestionToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsConditionalOperatorContext), 2 /* Space */)); - this.NoSpaceAfterQuestionMark = new formatting.Rule(formatting.RuleDescriptor.create3(53 /* QuestionToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.SpaceAfterSemicolon = new formatting.Rule(formatting.RuleDescriptor.create3(23 /* SemicolonToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.NoSpaceBeforeSemicolon = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 23 /* SemicolonToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceBeforeColon = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 54 /* ColonToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotBinaryOpContext), 8 /* Delete */)); + this.NoSpaceBeforeQuestionMark = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 53 /* QuestionToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotBinaryOpContext), 8 /* Delete */)); + this.SpaceAfterColon = new formatting.Rule(formatting.RuleDescriptor.create3(54 /* ColonToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotBinaryOpContext), 2 /* Space */)); + this.SpaceAfterQuestionMarkInConditionalOperator = new formatting.Rule(formatting.RuleDescriptor.create3(53 /* QuestionToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsConditionalOperatorContext), 2 /* Space */)); + this.NoSpaceAfterQuestionMark = new formatting.Rule(formatting.RuleDescriptor.create3(53 /* QuestionToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); + this.SpaceAfterSemicolon = new formatting.Rule(formatting.RuleDescriptor.create3(23 /* SemicolonToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); // Space after }. - this.SpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(16 /* CloseBraceToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsAfterCodeBlockContext), 2 /* Space */)); + this.SpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(16 /* CloseBraceToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsAfterCodeBlockContext), 2 /* Space */)); // Special case for (}, else) and (}, while) since else & while tokens are not part of the tree which makes SpaceAfterCloseBrace rule not applied - this.SpaceBetweenCloseBraceAndElse = new formatting.Rule(formatting.RuleDescriptor.create1(16 /* CloseBraceToken */, 80 /* ElseKeyword */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); - this.SpaceBetweenCloseBraceAndWhile = new formatting.Rule(formatting.RuleDescriptor.create1(16 /* CloseBraceToken */, 104 /* WhileKeyword */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); - this.NoSpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(16 /* CloseBraceToken */, formatting.Shared.TokenRange.FromTokens([18 /* CloseParenToken */, 20 /* CloseBracketToken */, 24 /* CommaToken */, 23 /* SemicolonToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.SpaceBetweenCloseBraceAndElse = new formatting.Rule(formatting.RuleDescriptor.create1(16 /* CloseBraceToken */, 80 /* ElseKeyword */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); + this.SpaceBetweenCloseBraceAndWhile = new formatting.Rule(formatting.RuleDescriptor.create1(16 /* CloseBraceToken */, 104 /* WhileKeyword */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); + this.NoSpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(16 /* CloseBraceToken */, formatting.Shared.TokenRange.FromTokens([18 /* CloseParenToken */, 20 /* CloseBracketToken */, 24 /* CommaToken */, 23 /* SemicolonToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); // No space for dot - this.NoSpaceBeforeDot = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 21 /* DotToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.NoSpaceAfterDot = new formatting.Rule(formatting.RuleDescriptor.create3(21 /* DotToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceBeforeDot = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 21 /* DotToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceAfterDot = new formatting.Rule(formatting.RuleDescriptor.create3(21 /* DotToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); // No space before and after indexer - this.NoSpaceBeforeOpenBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 19 /* OpenBracketToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.NoSpaceAfterCloseBracket = new formatting.Rule(formatting.RuleDescriptor.create3(20 /* CloseBracketToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBeforeBlockInFunctionDeclarationContext), 8 /* Delete */)); + this.NoSpaceBeforeOpenBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 19 /* OpenBracketToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceAfterCloseBracket = new formatting.Rule(formatting.RuleDescriptor.create3(20 /* CloseBracketToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotBeforeBlockInFunctionDeclarationContext), 8 /* Delete */)); // Place a space before open brace in a function declaration this.FunctionOpenBraceLeftTokenRange = formatting.Shared.TokenRange.AnyIncludingMultilineComments; this.SpaceBeforeOpenBraceInFunction = new formatting.Rule(formatting.RuleDescriptor.create2(this.FunctionOpenBraceLeftTokenRange, 15 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext, Rules.IsBeforeBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2 /* Space */), 1 /* CanDeleteNewLines */); @@ -41976,7 +47799,7 @@ var ts; // Insert a space after { and before } in single-line contexts, but remove space from empty object literals {}. this.SpaceAfterOpenBrace = new formatting.Rule(formatting.RuleDescriptor.create3(15 /* OpenBraceToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 2 /* Space */)); this.SpaceBeforeCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 16 /* CloseBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 2 /* Space */)); - this.NoSpaceBetweenEmptyBraceBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(15 /* OpenBraceToken */, 16 /* CloseBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsObjectContext), 8 /* Delete */)); + this.NoSpaceBetweenEmptyBraceBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(15 /* OpenBraceToken */, 16 /* CloseBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsObjectContext), 8 /* Delete */)); // Insert new line after { and before } in multi-line contexts. this.NewLineAfterOpenBraceInBlockContext = new formatting.Rule(formatting.RuleDescriptor.create3(15 /* OpenBraceToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsMultilineBlockContext), 4 /* NewLine */)); // For functions and control block place } on a new line [multi-line rule] @@ -41984,149 +47807,146 @@ var ts; // Special handling of unary operators. // Prefix operators generally shouldn't have a space between // them and their target unary expression. - this.NoSpaceAfterUnaryPrefixOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.UnaryPrefixOperators, formatting.Shared.TokenRange.UnaryPrefixExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8 /* Delete */)); - this.NoSpaceAfterUnaryPreincrementOperator = new formatting.Rule(formatting.RuleDescriptor.create3(41 /* PlusPlusToken */, formatting.Shared.TokenRange.UnaryPreincrementExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.NoSpaceAfterUnaryPredecrementOperator = new formatting.Rule(formatting.RuleDescriptor.create3(42 /* MinusMinusToken */, formatting.Shared.TokenRange.UnaryPredecrementExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.NoSpaceBeforeUnaryPostincrementOperator = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.UnaryPostincrementExpressions, 41 /* PlusPlusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.NoSpaceBeforeUnaryPostdecrementOperator = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.UnaryPostdecrementExpressions, 42 /* MinusMinusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceAfterUnaryPrefixOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.UnaryPrefixOperators, formatting.Shared.TokenRange.UnaryPrefixExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotBinaryOpContext), 8 /* Delete */)); + this.NoSpaceAfterUnaryPreincrementOperator = new formatting.Rule(formatting.RuleDescriptor.create3(41 /* PlusPlusToken */, formatting.Shared.TokenRange.UnaryPreincrementExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceAfterUnaryPredecrementOperator = new formatting.Rule(formatting.RuleDescriptor.create3(42 /* MinusMinusToken */, formatting.Shared.TokenRange.UnaryPredecrementExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceBeforeUnaryPostincrementOperator = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.UnaryPostincrementExpressions, 41 /* PlusPlusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceBeforeUnaryPostdecrementOperator = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.UnaryPostdecrementExpressions, 42 /* MinusMinusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); // More unary operator special-casing. // DevDiv 181814: Be careful when removing leading whitespace // around unary operators. Examples: // 1 - -2 --X--> 1--2 // a + ++b --X--> a+++b - this.SpaceAfterPostincrementWhenFollowedByAdd = new formatting.Rule(formatting.RuleDescriptor.create1(41 /* PlusPlusToken */, 35 /* PlusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); - this.SpaceAfterAddWhenFollowedByUnaryPlus = new formatting.Rule(formatting.RuleDescriptor.create1(35 /* PlusToken */, 35 /* PlusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); - this.SpaceAfterAddWhenFollowedByPreincrement = new formatting.Rule(formatting.RuleDescriptor.create1(35 /* PlusToken */, 41 /* PlusPlusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); - this.SpaceAfterPostdecrementWhenFollowedBySubtract = new formatting.Rule(formatting.RuleDescriptor.create1(42 /* MinusMinusToken */, 36 /* MinusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); - this.SpaceAfterSubtractWhenFollowedByUnaryMinus = new formatting.Rule(formatting.RuleDescriptor.create1(36 /* MinusToken */, 36 /* MinusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); - this.SpaceAfterSubtractWhenFollowedByPredecrement = new formatting.Rule(formatting.RuleDescriptor.create1(36 /* MinusToken */, 42 /* MinusMinusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); - this.NoSpaceBeforeComma = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 24 /* CommaToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.SpaceAfterCertainKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([102 /* VarKeyword */, 98 /* ThrowKeyword */, 92 /* NewKeyword */, 78 /* DeleteKeyword */, 94 /* ReturnKeyword */, 101 /* TypeOfKeyword */, 119 /* AwaitKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); - this.SpaceAfterLetConstInVariableDeclaration = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([108 /* LetKeyword */, 74 /* ConstKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsStartOfVariableDeclarationList), 2 /* Space */)); - this.NoSpaceBeforeOpenParenInFuncCall = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsFunctionCallOrNewContext, Rules.IsPreviousTokenNotComma), 8 /* Delete */)); + this.SpaceAfterPostincrementWhenFollowedByAdd = new formatting.Rule(formatting.RuleDescriptor.create1(41 /* PlusPlusToken */, 35 /* PlusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); + this.SpaceAfterAddWhenFollowedByUnaryPlus = new formatting.Rule(formatting.RuleDescriptor.create1(35 /* PlusToken */, 35 /* PlusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); + this.SpaceAfterAddWhenFollowedByPreincrement = new formatting.Rule(formatting.RuleDescriptor.create1(35 /* PlusToken */, 41 /* PlusPlusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); + this.SpaceAfterPostdecrementWhenFollowedBySubtract = new formatting.Rule(formatting.RuleDescriptor.create1(42 /* MinusMinusToken */, 36 /* MinusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); + this.SpaceAfterSubtractWhenFollowedByUnaryMinus = new formatting.Rule(formatting.RuleDescriptor.create1(36 /* MinusToken */, 36 /* MinusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); + this.SpaceAfterSubtractWhenFollowedByPredecrement = new formatting.Rule(formatting.RuleDescriptor.create1(36 /* MinusToken */, 42 /* MinusMinusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); + this.NoSpaceBeforeComma = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 24 /* CommaToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); + this.SpaceAfterCertainKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([102 /* VarKeyword */, 98 /* ThrowKeyword */, 92 /* NewKeyword */, 78 /* DeleteKeyword */, 94 /* ReturnKeyword */, 101 /* TypeOfKeyword */, 119 /* AwaitKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); + this.SpaceAfterLetConstInVariableDeclaration = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([108 /* LetKeyword */, 74 /* ConstKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsStartOfVariableDeclarationList), 2 /* Space */)); + this.NoSpaceBeforeOpenParenInFuncCall = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsFunctionCallOrNewContext, Rules.IsPreviousTokenNotComma), 8 /* Delete */)); this.SpaceAfterFunctionInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create3(87 /* FunctionKeyword */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2 /* Space */)); - this.NoSpaceBeforeOpenParenInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsFunctionDeclContext), 8 /* Delete */)); - this.SpaceAfterVoidOperator = new formatting.Rule(formatting.RuleDescriptor.create3(103 /* VoidKeyword */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsVoidOpContext), 2 /* Space */)); - this.NoSpaceBetweenReturnAndSemicolon = new formatting.Rule(formatting.RuleDescriptor.create1(94 /* ReturnKeyword */, 23 /* SemicolonToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceBeforeOpenParenInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsFunctionDeclContext), 8 /* Delete */)); + this.SpaceAfterVoidOperator = new formatting.Rule(formatting.RuleDescriptor.create3(103 /* VoidKeyword */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsVoidOpContext), 2 /* Space */)); + this.NoSpaceBetweenReturnAndSemicolon = new formatting.Rule(formatting.RuleDescriptor.create1(94 /* ReturnKeyword */, 23 /* SemicolonToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); // Add a space between statements. All keywords except (do,else,case) has open/close parens after them. // So, we have a rule to add a space for [),Any], [do,Any], [else,Any], and [case,Any] - this.SpaceBetweenStatements = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([18 /* CloseParenToken */, 79 /* DoKeyword */, 80 /* ElseKeyword */, 71 /* CaseKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotForContext), 2 /* Space */)); + this.SpaceBetweenStatements = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([18 /* CloseParenToken */, 79 /* DoKeyword */, 80 /* ElseKeyword */, 71 /* CaseKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotForContext), 2 /* Space */)); // This low-pri rule takes care of "try {" and "finally {" in case the rule SpaceBeforeOpenBraceInControl didn't execute on FormatOnEnter. - this.SpaceAfterTryFinally = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([100 /* TryKeyword */, 85 /* FinallyKeyword */]), 15 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.SpaceAfterTryFinally = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([100 /* TryKeyword */, 85 /* FinallyKeyword */]), 15 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); // get x() {} // set x(val) {} - this.SpaceAfterGetSetInMember = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([123 /* GetKeyword */, 129 /* SetKeyword */]), 69 /* Identifier */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2 /* Space */)); + this.SpaceAfterGetSetInMember = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([123 /* GetKeyword */, 131 /* SetKeyword */]), 69 /* Identifier */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2 /* Space */)); // Special case for binary operators (that are keywords). For these we have to add a space and shouldn't follow any user options. - this.SpaceBeforeBinaryKeywordOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.BinaryKeywordOperators), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); - this.SpaceAfterBinaryKeywordOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.BinaryKeywordOperators, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); + this.SpaceBeforeBinaryKeywordOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.BinaryKeywordOperators), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); + this.SpaceAfterBinaryKeywordOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.BinaryKeywordOperators, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); // TypeScript-specific higher priority rules // Treat constructor as an identifier in a function declaration, and remove spaces between constructor and following left parentheses - this.NoSpaceAfterConstructor = new formatting.Rule(formatting.RuleDescriptor.create1(121 /* ConstructorKeyword */, 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceAfterConstructor = new formatting.Rule(formatting.RuleDescriptor.create1(121 /* ConstructorKeyword */, 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); // Use of module as a function call. e.g.: import m2 = module("m2"); - this.NoSpaceAfterModuleImport = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([125 /* ModuleKeyword */, 127 /* RequireKeyword */]), 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceAfterModuleImport = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([125 /* ModuleKeyword */, 129 /* RequireKeyword */]), 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); // Add a space around certain TypeScript keywords - this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([115 /* AbstractKeyword */, 73 /* ClassKeyword */, 122 /* DeclareKeyword */, 77 /* DefaultKeyword */, 81 /* EnumKeyword */, 82 /* ExportKeyword */, 83 /* ExtendsKeyword */, 123 /* GetKeyword */, 106 /* ImplementsKeyword */, 89 /* ImportKeyword */, 107 /* InterfaceKeyword */, 125 /* ModuleKeyword */, 126 /* NamespaceKeyword */, 110 /* PrivateKeyword */, 112 /* PublicKeyword */, 111 /* ProtectedKeyword */, 129 /* SetKeyword */, 113 /* StaticKeyword */, 132 /* TypeKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); - this.SpaceBeforeCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([83 /* ExtendsKeyword */, 106 /* ImplementsKeyword */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([115 /* AbstractKeyword */, 73 /* ClassKeyword */, 122 /* DeclareKeyword */, 77 /* DefaultKeyword */, 81 /* EnumKeyword */, 82 /* ExportKeyword */, 83 /* ExtendsKeyword */, 123 /* GetKeyword */, 106 /* ImplementsKeyword */, 89 /* ImportKeyword */, 107 /* InterfaceKeyword */, 125 /* ModuleKeyword */, 126 /* NamespaceKeyword */, 110 /* PrivateKeyword */, 112 /* PublicKeyword */, 111 /* ProtectedKeyword */, 131 /* SetKeyword */, 113 /* StaticKeyword */, 134 /* TypeKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); + this.SpaceBeforeCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([83 /* ExtendsKeyword */, 106 /* ImplementsKeyword */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); // Treat string literals in module names as identifiers, and add a space between the literal and the opening Brace braces, e.g.: module "m2" { this.SpaceAfterModuleName = new formatting.Rule(formatting.RuleDescriptor.create1(9 /* StringLiteral */, 15 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsModuleDeclContext), 2 /* Space */)); // Lambda expressions - this.SpaceAfterArrow = new formatting.Rule(formatting.RuleDescriptor.create3(34 /* EqualsGreaterThanToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.SpaceBeforeArrow = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 34 /* EqualsGreaterThanToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); + this.SpaceAfterArrow = new formatting.Rule(formatting.RuleDescriptor.create3(34 /* EqualsGreaterThanToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); // Optional parameters and let args - this.NoSpaceAfterEllipsis = new formatting.Rule(formatting.RuleDescriptor.create1(22 /* DotDotDotToken */, 69 /* Identifier */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.NoSpaceAfterOptionalParameters = new formatting.Rule(formatting.RuleDescriptor.create3(53 /* QuestionToken */, formatting.Shared.TokenRange.FromTokens([18 /* CloseParenToken */, 24 /* CommaToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8 /* Delete */)); + this.NoSpaceAfterEllipsis = new formatting.Rule(formatting.RuleDescriptor.create1(22 /* DotDotDotToken */, 69 /* Identifier */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceAfterOptionalParameters = new formatting.Rule(formatting.RuleDescriptor.create3(53 /* QuestionToken */, formatting.Shared.TokenRange.FromTokens([18 /* CloseParenToken */, 24 /* CommaToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotBinaryOpContext), 8 /* Delete */)); // generics and type assertions - this.NoSpaceBeforeOpenAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.TypeNames, 25 /* LessThanToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8 /* Delete */)); - this.NoSpaceBetweenCloseParenAndAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create1(18 /* CloseParenToken */, 25 /* LessThanToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8 /* Delete */)); - this.NoSpaceAfterOpenAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create3(25 /* LessThanToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8 /* Delete */)); - this.NoSpaceBeforeCloseAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 27 /* GreaterThanToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8 /* Delete */)); - this.NoSpaceAfterCloseAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create3(27 /* GreaterThanToken */, formatting.Shared.TokenRange.FromTokens([17 /* OpenParenToken */, 19 /* OpenBracketToken */, 27 /* GreaterThanToken */, 24 /* CommaToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8 /* Delete */)); - this.NoSpaceAfterTypeAssertion = new formatting.Rule(formatting.RuleDescriptor.create3(27 /* GreaterThanToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeAssertionContext), 8 /* Delete */)); + this.NoSpaceBeforeOpenAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.TypeNames, 25 /* LessThanToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8 /* Delete */)); + this.NoSpaceBetweenCloseParenAndAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create1(18 /* CloseParenToken */, 25 /* LessThanToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8 /* Delete */)); + this.NoSpaceAfterOpenAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create3(25 /* LessThanToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8 /* Delete */)); + this.NoSpaceBeforeCloseAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 27 /* GreaterThanToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8 /* Delete */)); + this.NoSpaceAfterCloseAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create3(27 /* GreaterThanToken */, formatting.Shared.TokenRange.FromTokens([17 /* OpenParenToken */, 19 /* OpenBracketToken */, 27 /* GreaterThanToken */, 24 /* CommaToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8 /* Delete */)); + this.NoSpaceAfterTypeAssertion = new formatting.Rule(formatting.RuleDescriptor.create3(27 /* GreaterThanToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeAssertionContext), 8 /* Delete */)); // Remove spaces in empty interface literals. e.g.: x: {} - this.NoSpaceBetweenEmptyInterfaceBraceBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(15 /* OpenBraceToken */, 16 /* CloseBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsObjectTypeContext), 8 /* Delete */)); + this.NoSpaceBetweenEmptyInterfaceBraceBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(15 /* OpenBraceToken */, 16 /* CloseBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsObjectTypeContext), 8 /* Delete */)); // decorators - this.SpaceBeforeAt = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 55 /* AtToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); - this.NoSpaceAfterAt = new formatting.Rule(formatting.RuleDescriptor.create3(55 /* AtToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.SpaceAfterDecorator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([115 /* AbstractKeyword */, 69 /* Identifier */, 82 /* ExportKeyword */, 77 /* DefaultKeyword */, 73 /* ClassKeyword */, 113 /* StaticKeyword */, 112 /* PublicKeyword */, 110 /* PrivateKeyword */, 111 /* ProtectedKeyword */, 123 /* GetKeyword */, 129 /* SetKeyword */, 19 /* OpenBracketToken */, 37 /* AsteriskToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsEndOfDecoratorContextOnSameLine), 2 /* Space */)); + this.SpaceBeforeAt = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 55 /* AtToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); + this.NoSpaceAfterAt = new formatting.Rule(formatting.RuleDescriptor.create3(55 /* AtToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); + this.SpaceAfterDecorator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([115 /* AbstractKeyword */, 69 /* Identifier */, 82 /* ExportKeyword */, 77 /* DefaultKeyword */, 73 /* ClassKeyword */, 113 /* StaticKeyword */, 112 /* PublicKeyword */, 110 /* PrivateKeyword */, 111 /* ProtectedKeyword */, 123 /* GetKeyword */, 131 /* SetKeyword */, 19 /* OpenBracketToken */, 37 /* AsteriskToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsEndOfDecoratorContextOnSameLine), 2 /* Space */)); this.NoSpaceBetweenFunctionKeywordAndStar = new formatting.Rule(formatting.RuleDescriptor.create1(87 /* FunctionKeyword */, 37 /* AsteriskToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), 8 /* Delete */)); this.SpaceAfterStarInGeneratorDeclaration = new formatting.Rule(formatting.RuleDescriptor.create3(37 /* AsteriskToken */, formatting.Shared.TokenRange.FromTokens([69 /* Identifier */, 17 /* OpenParenToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), 2 /* Space */)); - this.NoSpaceBetweenYieldKeywordAndStar = new formatting.Rule(formatting.RuleDescriptor.create1(114 /* YieldKeyword */, 37 /* AsteriskToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), 8 /* Delete */)); - this.SpaceBetweenYieldOrYieldStarAndOperand = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([114 /* YieldKeyword */, 37 /* AsteriskToken */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), 2 /* Space */)); + this.NoSpaceBetweenYieldKeywordAndStar = new formatting.Rule(formatting.RuleDescriptor.create1(114 /* YieldKeyword */, 37 /* AsteriskToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), 8 /* Delete */)); + this.SpaceBetweenYieldOrYieldStarAndOperand = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([114 /* YieldKeyword */, 37 /* AsteriskToken */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), 2 /* Space */)); // Async-await - this.SpaceBetweenAsyncAndOpenParen = new formatting.Rule(formatting.RuleDescriptor.create1(118 /* AsyncKeyword */, 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsArrowFunctionContext, Rules.IsSameLineTokenContext), 2 /* Space */)); - this.SpaceBetweenAsyncAndFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(118 /* AsyncKeyword */, 87 /* FunctionKeyword */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.SpaceBetweenAsyncAndOpenParen = new formatting.Rule(formatting.RuleDescriptor.create1(118 /* AsyncKeyword */, 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsArrowFunctionContext, Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); + this.SpaceBetweenAsyncAndFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(118 /* AsyncKeyword */, 87 /* FunctionKeyword */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); // template string - this.SpaceBetweenTagAndTemplateString = new formatting.Rule(formatting.RuleDescriptor.create3(69 /* Identifier */, formatting.Shared.TokenRange.FromTokens([11 /* NoSubstitutionTemplateLiteral */, 12 /* TemplateHead */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); - this.NoSpaceAfterTemplateHeadAndMiddle = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([12 /* TemplateHead */, 13 /* TemplateMiddle */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.NoSpaceBeforeTemplateMiddleAndTail = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([13 /* TemplateMiddle */, 14 /* TemplateTail */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceBetweenTagAndTemplateString = new formatting.Rule(formatting.RuleDescriptor.create3(69 /* Identifier */, formatting.Shared.TokenRange.FromTokens([11 /* NoSubstitutionTemplateLiteral */, 12 /* TemplateHead */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); // These rules are higher in priority than user-configurable rules. - this.HighPriorityCommonRules = - [ - this.IgnoreBeforeComment, this.IgnoreAfterLineComment, - this.NoSpaceBeforeColon, this.SpaceAfterColon, this.NoSpaceBeforeQuestionMark, this.SpaceAfterQuestionMarkInConditionalOperator, - this.NoSpaceAfterQuestionMark, - this.NoSpaceBeforeDot, this.NoSpaceAfterDot, - this.NoSpaceAfterUnaryPrefixOperator, - this.NoSpaceAfterUnaryPreincrementOperator, this.NoSpaceAfterUnaryPredecrementOperator, - this.NoSpaceBeforeUnaryPostincrementOperator, this.NoSpaceBeforeUnaryPostdecrementOperator, - this.SpaceAfterPostincrementWhenFollowedByAdd, - this.SpaceAfterAddWhenFollowedByUnaryPlus, this.SpaceAfterAddWhenFollowedByPreincrement, - this.SpaceAfterPostdecrementWhenFollowedBySubtract, - this.SpaceAfterSubtractWhenFollowedByUnaryMinus, this.SpaceAfterSubtractWhenFollowedByPredecrement, - this.NoSpaceAfterCloseBrace, - this.SpaceAfterOpenBrace, this.SpaceBeforeCloseBrace, this.NewLineBeforeCloseBraceInBlockContext, - this.SpaceAfterCloseBrace, this.SpaceBetweenCloseBraceAndElse, this.SpaceBetweenCloseBraceAndWhile, this.NoSpaceBetweenEmptyBraceBrackets, - this.NoSpaceBetweenFunctionKeywordAndStar, this.SpaceAfterStarInGeneratorDeclaration, - this.SpaceAfterFunctionInFuncDecl, this.NewLineAfterOpenBraceInBlockContext, this.SpaceAfterGetSetInMember, - this.NoSpaceBetweenYieldKeywordAndStar, this.SpaceBetweenYieldOrYieldStarAndOperand, - this.NoSpaceBetweenReturnAndSemicolon, - this.SpaceAfterCertainKeywords, - this.SpaceAfterLetConstInVariableDeclaration, - this.NoSpaceBeforeOpenParenInFuncCall, - this.SpaceBeforeBinaryKeywordOperator, this.SpaceAfterBinaryKeywordOperator, - this.SpaceAfterVoidOperator, - this.SpaceBetweenAsyncAndOpenParen, this.SpaceBetweenAsyncAndFunctionKeyword, - this.SpaceBetweenTagAndTemplateString, this.NoSpaceAfterTemplateHeadAndMiddle, this.NoSpaceBeforeTemplateMiddleAndTail, - // TypeScript-specific rules - this.NoSpaceAfterConstructor, this.NoSpaceAfterModuleImport, - this.SpaceAfterCertainTypeScriptKeywords, this.SpaceBeforeCertainTypeScriptKeywords, - this.SpaceAfterModuleName, - this.SpaceAfterArrow, - this.NoSpaceAfterEllipsis, - this.NoSpaceAfterOptionalParameters, - this.NoSpaceBetweenEmptyInterfaceBraceBrackets, - this.NoSpaceBeforeOpenAngularBracket, - this.NoSpaceBetweenCloseParenAndAngularBracket, - this.NoSpaceAfterOpenAngularBracket, - this.NoSpaceBeforeCloseAngularBracket, - this.NoSpaceAfterCloseAngularBracket, - this.NoSpaceAfterTypeAssertion, - this.SpaceBeforeAt, - this.NoSpaceAfterAt, - this.SpaceAfterDecorator, - ]; + this.HighPriorityCommonRules = [ + this.IgnoreBeforeComment, this.IgnoreAfterLineComment, + this.NoSpaceBeforeColon, this.SpaceAfterColon, this.NoSpaceBeforeQuestionMark, this.SpaceAfterQuestionMarkInConditionalOperator, + this.NoSpaceAfterQuestionMark, + this.NoSpaceBeforeDot, this.NoSpaceAfterDot, + this.NoSpaceAfterUnaryPrefixOperator, + this.NoSpaceAfterUnaryPreincrementOperator, this.NoSpaceAfterUnaryPredecrementOperator, + this.NoSpaceBeforeUnaryPostincrementOperator, this.NoSpaceBeforeUnaryPostdecrementOperator, + this.SpaceAfterPostincrementWhenFollowedByAdd, + this.SpaceAfterAddWhenFollowedByUnaryPlus, this.SpaceAfterAddWhenFollowedByPreincrement, + this.SpaceAfterPostdecrementWhenFollowedBySubtract, + this.SpaceAfterSubtractWhenFollowedByUnaryMinus, this.SpaceAfterSubtractWhenFollowedByPredecrement, + this.NoSpaceAfterCloseBrace, + this.SpaceAfterOpenBrace, this.SpaceBeforeCloseBrace, this.NewLineBeforeCloseBraceInBlockContext, + this.SpaceAfterCloseBrace, this.SpaceBetweenCloseBraceAndElse, this.SpaceBetweenCloseBraceAndWhile, this.NoSpaceBetweenEmptyBraceBrackets, + this.NoSpaceBetweenFunctionKeywordAndStar, this.SpaceAfterStarInGeneratorDeclaration, + this.SpaceAfterFunctionInFuncDecl, this.NewLineAfterOpenBraceInBlockContext, this.SpaceAfterGetSetInMember, + this.NoSpaceBetweenYieldKeywordAndStar, this.SpaceBetweenYieldOrYieldStarAndOperand, + this.NoSpaceBetweenReturnAndSemicolon, + this.SpaceAfterCertainKeywords, + this.SpaceAfterLetConstInVariableDeclaration, + this.NoSpaceBeforeOpenParenInFuncCall, + this.SpaceBeforeBinaryKeywordOperator, this.SpaceAfterBinaryKeywordOperator, + this.SpaceAfterVoidOperator, + this.SpaceBetweenAsyncAndOpenParen, this.SpaceBetweenAsyncAndFunctionKeyword, + this.NoSpaceBetweenTagAndTemplateString, + // TypeScript-specific rules + this.NoSpaceAfterConstructor, this.NoSpaceAfterModuleImport, + this.SpaceAfterCertainTypeScriptKeywords, this.SpaceBeforeCertainTypeScriptKeywords, + this.SpaceAfterModuleName, + this.SpaceBeforeArrow, this.SpaceAfterArrow, + this.NoSpaceAfterEllipsis, + this.NoSpaceAfterOptionalParameters, + this.NoSpaceBetweenEmptyInterfaceBraceBrackets, + this.NoSpaceBeforeOpenAngularBracket, + this.NoSpaceBetweenCloseParenAndAngularBracket, + this.NoSpaceAfterOpenAngularBracket, + this.NoSpaceBeforeCloseAngularBracket, + this.NoSpaceAfterCloseAngularBracket, + this.NoSpaceAfterTypeAssertion, + this.SpaceBeforeAt, + this.NoSpaceAfterAt, + this.SpaceAfterDecorator, + ]; // These rules are lower in priority than user-configurable rules. - this.LowPriorityCommonRules = - [ - this.NoSpaceBeforeSemicolon, - this.SpaceBeforeOpenBraceInControl, this.SpaceBeforeOpenBraceInFunction, this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock, - this.NoSpaceBeforeComma, - this.NoSpaceBeforeOpenBracket, - this.NoSpaceAfterCloseBracket, - this.SpaceAfterSemicolon, - this.NoSpaceBeforeOpenParenInFuncDecl, - this.SpaceBetweenStatements, this.SpaceAfterTryFinally - ]; + this.LowPriorityCommonRules = [ + this.NoSpaceBeforeSemicolon, + this.SpaceBeforeOpenBraceInControl, this.SpaceBeforeOpenBraceInFunction, this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock, + this.NoSpaceBeforeComma, + this.NoSpaceBeforeOpenBracket, + this.NoSpaceAfterCloseBracket, + this.SpaceAfterSemicolon, + this.NoSpaceBeforeOpenParenInFuncDecl, + this.SpaceBetweenStatements, this.SpaceAfterTryFinally + ]; /// /// Rules controlled by user options /// // Insert space after comma delimiter - this.SpaceAfterComma = new formatting.Rule(formatting.RuleDescriptor.create3(24 /* CommaToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); - this.NoSpaceAfterComma = new formatting.Rule(formatting.RuleDescriptor.create3(24 /* CommaToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.SpaceAfterComma = new formatting.Rule(formatting.RuleDescriptor.create3(24 /* CommaToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNextTokenNotCloseBracket), 2 /* Space */)); + this.NoSpaceAfterComma = new formatting.Rule(formatting.RuleDescriptor.create3(24 /* CommaToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); // Insert space before and after binary operators - this.SpaceBeforeBinaryOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.BinaryOperators), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); - this.SpaceAfterBinaryOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.BinaryOperators, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); - this.NoSpaceBeforeBinaryOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.BinaryOperators), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 8 /* Delete */)); - this.NoSpaceAfterBinaryOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.BinaryOperators, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 8 /* Delete */)); + this.SpaceBeforeBinaryOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.BinaryOperators), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); + this.SpaceAfterBinaryOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.BinaryOperators, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); + this.NoSpaceBeforeBinaryOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.BinaryOperators), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 8 /* Delete */)); + this.NoSpaceAfterBinaryOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.BinaryOperators, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 8 /* Delete */)); // Insert space after keywords in control flow statements this.SpaceAfterKeywordInControl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Keywords, 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext), 2 /* Space */)); this.NoSpaceAfterKeywordInControl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Keywords, 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext), 8 /* Delete */)); @@ -42138,29 +47958,34 @@ var ts; // Open Brace braces after control block this.NewLineBeforeOpenBraceInControl = new formatting.Rule(formatting.RuleDescriptor.create2(this.ControlOpenBraceLeftTokenRange, 15 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext, Rules.IsBeforeMultilineBlockContext), 4 /* NewLine */), 1 /* CanDeleteNewLines */); // Insert space after semicolon in for statement - this.SpaceAfterSemicolonInFor = new formatting.Rule(formatting.RuleDescriptor.create3(23 /* SemicolonToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsForContext), 2 /* Space */)); - this.NoSpaceAfterSemicolonInFor = new formatting.Rule(formatting.RuleDescriptor.create3(23 /* SemicolonToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsForContext), 8 /* Delete */)); + this.SpaceAfterSemicolonInFor = new formatting.Rule(formatting.RuleDescriptor.create3(23 /* SemicolonToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsForContext), 2 /* Space */)); + this.NoSpaceAfterSemicolonInFor = new formatting.Rule(formatting.RuleDescriptor.create3(23 /* SemicolonToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsForContext), 8 /* Delete */)); // Insert space after opening and before closing nonempty parenthesis - this.SpaceAfterOpenParen = new formatting.Rule(formatting.RuleDescriptor.create3(17 /* OpenParenToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); - this.SpaceBeforeCloseParen = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 18 /* CloseParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); - this.NoSpaceBetweenParens = new formatting.Rule(formatting.RuleDescriptor.create1(17 /* OpenParenToken */, 18 /* CloseParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.NoSpaceAfterOpenParen = new formatting.Rule(formatting.RuleDescriptor.create3(17 /* OpenParenToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.NoSpaceBeforeCloseParen = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 18 /* CloseParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.SpaceAfterOpenParen = new formatting.Rule(formatting.RuleDescriptor.create3(17 /* OpenParenToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); + this.SpaceBeforeCloseParen = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 18 /* CloseParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); + this.NoSpaceBetweenParens = new formatting.Rule(formatting.RuleDescriptor.create1(17 /* OpenParenToken */, 18 /* CloseParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceAfterOpenParen = new formatting.Rule(formatting.RuleDescriptor.create3(17 /* OpenParenToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceBeforeCloseParen = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 18 /* CloseParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); // Insert space after opening and before closing nonempty brackets - this.SpaceAfterOpenBracket = new formatting.Rule(formatting.RuleDescriptor.create3(19 /* OpenBracketToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); - this.SpaceBeforeCloseBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 20 /* CloseBracketToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); - this.NoSpaceBetweenBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(19 /* OpenBracketToken */, 20 /* CloseBracketToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.NoSpaceAfterOpenBracket = new formatting.Rule(formatting.RuleDescriptor.create3(19 /* OpenBracketToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.NoSpaceBeforeCloseBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 20 /* CloseBracketToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.SpaceAfterOpenBracket = new formatting.Rule(formatting.RuleDescriptor.create3(19 /* OpenBracketToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); + this.SpaceBeforeCloseBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 20 /* CloseBracketToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); + this.NoSpaceBetweenBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(19 /* OpenBracketToken */, 20 /* CloseBracketToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceAfterOpenBracket = new formatting.Rule(formatting.RuleDescriptor.create3(19 /* OpenBracketToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceBeforeCloseBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 20 /* CloseBracketToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); + // Insert space after opening and before closing template string braces + this.NoSpaceAfterTemplateHeadAndMiddle = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([12 /* TemplateHead */, 13 /* TemplateMiddle */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); + this.SpaceAfterTemplateHeadAndMiddle = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([12 /* TemplateHead */, 13 /* TemplateMiddle */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); + this.NoSpaceBeforeTemplateMiddleAndTail = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([13 /* TemplateMiddle */, 14 /* TemplateTail */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); + this.SpaceBeforeTemplateMiddleAndTail = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([13 /* TemplateMiddle */, 14 /* TemplateTail */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); // Insert space after function keyword for anonymous functions this.SpaceAfterAnonymousFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(87 /* FunctionKeyword */, 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2 /* Space */)); this.NoSpaceAfterAnonymousFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(87 /* FunctionKeyword */, 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 8 /* Delete */)); } Rules.prototype.getRuleName = function (rule) { var o = this; - for (var name_34 in o) { - if (o[name_34] === rule) { - return name_34; + for (var name_38 in o) { + if (o[name_38] === rule) { + return name_38; } } throw new Error("Unknown rule"); @@ -42169,40 +47994,40 @@ var ts; /// Contexts /// Rules.IsForContext = function (context) { - return context.contextNode.kind === 199 /* ForStatement */; + return context.contextNode.kind === 206 /* ForStatement */; }; Rules.IsNotForContext = function (context) { return !Rules.IsForContext(context); }; Rules.IsBinaryOpContext = function (context) { switch (context.contextNode.kind) { - case 181 /* BinaryExpression */: - case 182 /* ConditionalExpression */: - case 189 /* AsExpression */: - case 150 /* TypePredicate */: - case 158 /* UnionType */: - case 159 /* IntersectionType */: + case 187 /* BinaryExpression */: + case 188 /* ConditionalExpression */: + case 195 /* AsExpression */: + case 154 /* TypePredicate */: + case 162 /* UnionType */: + case 163 /* IntersectionType */: return true; // equals in binding elements: function foo([[x, y] = [1, 2]]) - case 163 /* BindingElement */: + case 169 /* BindingElement */: // equals in type X = ... - case 216 /* TypeAliasDeclaration */: + case 223 /* TypeAliasDeclaration */: // equal in import a = module('a'); - case 221 /* ImportEqualsDeclaration */: + case 229 /* ImportEqualsDeclaration */: // equal in let a = 0; - case 211 /* VariableDeclaration */: + case 218 /* VariableDeclaration */: // equal in p = 0; - case 138 /* Parameter */: - case 247 /* EnumMember */: - case 141 /* PropertyDeclaration */: - case 140 /* PropertySignature */: + case 142 /* Parameter */: + case 255 /* EnumMember */: + case 145 /* PropertyDeclaration */: + case 144 /* PropertySignature */: return context.currentTokenSpan.kind === 56 /* EqualsToken */ || context.nextTokenSpan.kind === 56 /* EqualsToken */; // "in" keyword in for (let x in []) { } - case 200 /* ForInStatement */: + case 207 /* ForInStatement */: return context.currentTokenSpan.kind === 90 /* InKeyword */ || context.nextTokenSpan.kind === 90 /* InKeyword */; // Technically, "of" is not a binary operator, but format it the same way as "in" - case 201 /* ForOfStatement */: - return context.currentTokenSpan.kind === 134 /* OfKeyword */ || context.nextTokenSpan.kind === 134 /* OfKeyword */; + case 208 /* ForOfStatement */: + return context.currentTokenSpan.kind === 138 /* OfKeyword */ || context.nextTokenSpan.kind === 138 /* OfKeyword */; } return false; }; @@ -42210,7 +48035,7 @@ var ts; return !Rules.IsBinaryOpContext(context); }; Rules.IsConditionalOperatorContext = function (context) { - return context.contextNode.kind === 182 /* ConditionalExpression */; + return context.contextNode.kind === 188 /* ConditionalExpression */; }; Rules.IsSameLineTokenOrBeforeMultilineBlockContext = function (context) { //// This check is mainly used inside SpaceBeforeOpenBraceInControl and SpaceBeforeOpenBraceInFunction. @@ -42222,13 +48047,13 @@ var ts; //// Ex: //// if (1) //// { ... } - //// * ) and { are on differnet lines. We only need to format if the block is multiline context. So in this case we don't format. + //// * ) and { are on different lines. We only need to format if the block is multiline context. So in this case we don't format. //// //// Ex: //// if (1) //// { ... //// } - //// * ) and { are on differnet lines. We only need to format if the block is multiline context. So in this case we format. + //// * ) and { are on different lines. We only need to format if the block is multiline context. So in this case we format. return context.TokensAreOnSameLine() || Rules.IsBeforeMultilineBlockContext(context); }; // This check is done before an open brace in a control construct, a function, or a typescript block declaration @@ -42254,93 +48079,93 @@ var ts; return true; } switch (node.kind) { - case 192 /* Block */: - case 220 /* CaseBlock */: - case 165 /* ObjectLiteralExpression */: - case 219 /* ModuleBlock */: + case 199 /* Block */: + case 227 /* CaseBlock */: + case 171 /* ObjectLiteralExpression */: + case 226 /* ModuleBlock */: return true; } return false; }; Rules.IsFunctionDeclContext = function (context) { switch (context.contextNode.kind) { - case 213 /* FunctionDeclaration */: - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: + case 220 /* FunctionDeclaration */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: //case SyntaxKind.MemberFunctionDeclaration: - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: ///case SyntaxKind.MethodSignature: - case 147 /* CallSignature */: - case 173 /* FunctionExpression */: - case 144 /* Constructor */: - case 174 /* ArrowFunction */: + case 151 /* CallSignature */: + case 179 /* FunctionExpression */: + case 148 /* Constructor */: + case 180 /* ArrowFunction */: //case SyntaxKind.ConstructorDeclaration: //case SyntaxKind.SimpleArrowFunctionExpression: //case SyntaxKind.ParenthesizedArrowFunctionExpression: - case 215 /* InterfaceDeclaration */: + case 222 /* InterfaceDeclaration */: return true; } return false; }; Rules.IsFunctionDeclarationOrFunctionExpressionContext = function (context) { - return context.contextNode.kind === 213 /* FunctionDeclaration */ || context.contextNode.kind === 173 /* FunctionExpression */; + return context.contextNode.kind === 220 /* FunctionDeclaration */ || context.contextNode.kind === 179 /* FunctionExpression */; }; Rules.IsTypeScriptDeclWithBlockContext = function (context) { return Rules.NodeIsTypeScriptDeclWithBlockContext(context.contextNode); }; Rules.NodeIsTypeScriptDeclWithBlockContext = function (node) { switch (node.kind) { - case 214 /* ClassDeclaration */: - case 186 /* ClassExpression */: - case 215 /* InterfaceDeclaration */: - case 217 /* EnumDeclaration */: - case 155 /* TypeLiteral */: - case 218 /* ModuleDeclaration */: + case 221 /* ClassDeclaration */: + case 192 /* ClassExpression */: + case 222 /* InterfaceDeclaration */: + case 224 /* EnumDeclaration */: + case 159 /* TypeLiteral */: + case 225 /* ModuleDeclaration */: return true; } return false; }; Rules.IsAfterCodeBlockContext = function (context) { switch (context.currentTokenParent.kind) { - case 214 /* ClassDeclaration */: - case 218 /* ModuleDeclaration */: - case 217 /* EnumDeclaration */: - case 192 /* Block */: - case 244 /* CatchClause */: - case 219 /* ModuleBlock */: - case 206 /* SwitchStatement */: + case 221 /* ClassDeclaration */: + case 225 /* ModuleDeclaration */: + case 224 /* EnumDeclaration */: + case 199 /* Block */: + case 252 /* CatchClause */: + case 226 /* ModuleBlock */: + case 213 /* SwitchStatement */: return true; } return false; }; Rules.IsControlDeclContext = function (context) { switch (context.contextNode.kind) { - case 196 /* IfStatement */: - case 206 /* SwitchStatement */: - case 199 /* ForStatement */: - case 200 /* ForInStatement */: - case 201 /* ForOfStatement */: - case 198 /* WhileStatement */: - case 209 /* TryStatement */: - case 197 /* DoStatement */: - case 205 /* WithStatement */: + case 203 /* IfStatement */: + case 213 /* SwitchStatement */: + case 206 /* ForStatement */: + case 207 /* ForInStatement */: + case 208 /* ForOfStatement */: + case 205 /* WhileStatement */: + case 216 /* TryStatement */: + case 204 /* DoStatement */: + case 212 /* WithStatement */: // TODO // case SyntaxKind.ElseClause: - case 244 /* CatchClause */: + case 252 /* CatchClause */: return true; default: return false; } }; Rules.IsObjectContext = function (context) { - return context.contextNode.kind === 165 /* ObjectLiteralExpression */; + return context.contextNode.kind === 171 /* ObjectLiteralExpression */; }; Rules.IsFunctionCallContext = function (context) { - return context.contextNode.kind === 168 /* CallExpression */; + return context.contextNode.kind === 174 /* CallExpression */; }; Rules.IsNewContext = function (context) { - return context.contextNode.kind === 169 /* NewExpression */; + return context.contextNode.kind === 175 /* NewExpression */; }; Rules.IsFunctionCallOrNewContext = function (context) { return Rules.IsFunctionCallContext(context) || Rules.IsNewContext(context); @@ -42348,11 +48173,14 @@ var ts; Rules.IsPreviousTokenNotComma = function (context) { return context.currentTokenSpan.kind !== 24 /* CommaToken */; }; - Rules.IsArrowFunctionContext = function (context) { - return context.contextNode.kind === 174 /* ArrowFunction */; + Rules.IsNextTokenNotCloseBracket = function (context) { + return context.nextTokenSpan.kind !== 20 /* CloseBracketToken */; }; - Rules.IsSameLineTokenContext = function (context) { - return context.TokensAreOnSameLine(); + Rules.IsArrowFunctionContext = function (context) { + return context.contextNode.kind === 180 /* ArrowFunction */; + }; + Rules.IsNonJsxSameLineTokenContext = function (context) { + return context.TokensAreOnSameLine() && context.contextNode.kind !== 244 /* JsxText */; }; Rules.IsNotBeforeBlockInFunctionDeclarationContext = function (context) { return !Rules.IsFunctionDeclContext(context) && !Rules.IsBeforeBlockContext(context); @@ -42367,41 +48195,41 @@ var ts; while (ts.isExpression(node)) { node = node.parent; } - return node.kind === 139 /* Decorator */; + return node.kind === 143 /* Decorator */; }; Rules.IsStartOfVariableDeclarationList = function (context) { - return context.currentTokenParent.kind === 212 /* VariableDeclarationList */ && + return context.currentTokenParent.kind === 219 /* VariableDeclarationList */ && context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos; }; Rules.IsNotFormatOnEnter = function (context) { return context.formattingRequestKind !== 2 /* FormatOnEnter */; }; Rules.IsModuleDeclContext = function (context) { - return context.contextNode.kind === 218 /* ModuleDeclaration */; + return context.contextNode.kind === 225 /* ModuleDeclaration */; }; Rules.IsObjectTypeContext = function (context) { - return context.contextNode.kind === 155 /* TypeLiteral */; // && context.contextNode.parent.kind !== SyntaxKind.InterfaceDeclaration; + return context.contextNode.kind === 159 /* TypeLiteral */; // && context.contextNode.parent.kind !== SyntaxKind.InterfaceDeclaration; }; Rules.IsTypeArgumentOrParameterOrAssertion = function (token, parent) { if (token.kind !== 25 /* LessThanToken */ && token.kind !== 27 /* GreaterThanToken */) { return false; } switch (parent.kind) { - case 151 /* TypeReference */: - case 171 /* TypeAssertionExpression */: - case 214 /* ClassDeclaration */: - case 186 /* ClassExpression */: - case 215 /* InterfaceDeclaration */: - case 213 /* FunctionDeclaration */: - case 173 /* FunctionExpression */: - case 174 /* ArrowFunction */: - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - case 147 /* CallSignature */: - case 148 /* ConstructSignature */: - case 168 /* CallExpression */: - case 169 /* NewExpression */: - case 188 /* ExpressionWithTypeArguments */: + case 155 /* TypeReference */: + case 177 /* TypeAssertionExpression */: + case 221 /* ClassDeclaration */: + case 192 /* ClassExpression */: + case 222 /* InterfaceDeclaration */: + case 220 /* FunctionDeclaration */: + case 179 /* FunctionExpression */: + case 180 /* ArrowFunction */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: + case 151 /* CallSignature */: + case 152 /* ConstructSignature */: + case 174 /* CallExpression */: + case 175 /* NewExpression */: + case 194 /* ExpressionWithTypeArguments */: return true; default: return false; @@ -42412,16 +48240,16 @@ var ts; Rules.IsTypeArgumentOrParameterOrAssertion(context.nextTokenSpan, context.nextTokenParent); }; Rules.IsTypeAssertionContext = function (context) { - return context.contextNode.kind === 171 /* TypeAssertionExpression */; + return context.contextNode.kind === 177 /* TypeAssertionExpression */; }; Rules.IsVoidOpContext = function (context) { - return context.currentTokenSpan.kind === 103 /* VoidKeyword */ && context.currentTokenParent.kind === 177 /* VoidExpression */; + return context.currentTokenSpan.kind === 103 /* VoidKeyword */ && context.currentTokenParent.kind === 183 /* VoidExpression */; }; Rules.IsYieldOrYieldStarWithOperand = function (context) { - return context.contextNode.kind === 184 /* YieldExpression */ && context.contextNode.expression !== undefined; + return context.contextNode.kind === 190 /* YieldExpression */ && context.contextNode.expression !== undefined; }; return Rules; - })(); + }()); formatting.Rules = Rules; })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); @@ -42442,7 +48270,7 @@ var ts; return result; }; RulesMap.prototype.Initialize = function (rules) { - this.mapRowLength = 134 /* LastToken */ + 1; + this.mapRowLength = 138 /* LastToken */ + 1; this.map = new Array(this.mapRowLength * this.mapRowLength); //new Array(this.mapRowLength * this.mapRowLength); // This array is used only during construction of the rulesbucket in the map var rulesBucketConstructionStateList = new Array(this.map.length); //new Array(this.map.length); @@ -42489,7 +48317,7 @@ var ts; return null; }; return RulesMap; - })(); + }()); formatting.RulesMap = RulesMap; var MaskBitSize = 5; var Mask = 0x1f; @@ -42541,7 +48369,7 @@ var ts; this.rulesInsertionIndexBitmap = temp; }; return RulesBucketConstructionState; - })(); + }()); formatting.RulesBucketConstructionState = RulesBucketConstructionState; var RulesBucket = (function () { function RulesBucket() { @@ -42576,7 +48404,7 @@ var ts; state.IncreaseInsertionIndex(position); }; return RulesBucket; - })(); + }()); formatting.RulesBucket = RulesBucket; })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); @@ -42604,7 +48432,7 @@ var ts; return this.tokens.indexOf(token) >= 0; }; return TokenRangeAccess; - })(); + }()); Shared.TokenRangeAccess = TokenRangeAccess; var TokenValuesAccess = (function () { function TokenValuesAccess(tks) { @@ -42617,7 +48445,7 @@ var ts; return this.tokens.indexOf(token) >= 0; }; return TokenValuesAccess; - })(); + }()); Shared.TokenValuesAccess = TokenValuesAccess; var TokenSingleValueAccess = (function () { function TokenSingleValueAccess(token) { @@ -42630,14 +48458,14 @@ var ts; return tokenValue === this.token; }; return TokenSingleValueAccess; - })(); + }()); Shared.TokenSingleValueAccess = TokenSingleValueAccess; var TokenAllAccess = (function () { function TokenAllAccess() { } TokenAllAccess.prototype.GetTokens = function () { var result = []; - for (var token = 0 /* FirstToken */; token <= 134 /* LastToken */; token++) { + for (var token = 0 /* FirstToken */; token <= 138 /* LastToken */; token++) { result.push(token); } return result; @@ -42649,7 +48477,7 @@ var ts; return "[allTokens]"; }; return TokenAllAccess; - })(); + }()); Shared.TokenAllAccess = TokenAllAccess; var TokenRange = (function () { function TokenRange(tokenAccess) { @@ -42679,9 +48507,9 @@ var ts; }; TokenRange.Any = TokenRange.AllTokens(); TokenRange.AnyIncludingMultilineComments = TokenRange.FromTokens(TokenRange.Any.GetTokens().concat([3 /* MultiLineCommentTrivia */])); - TokenRange.Keywords = TokenRange.FromRange(70 /* FirstKeyword */, 134 /* LastKeyword */); + TokenRange.Keywords = TokenRange.FromRange(70 /* FirstKeyword */, 138 /* LastKeyword */); TokenRange.BinaryOperators = TokenRange.FromRange(25 /* FirstBinaryOperator */, 68 /* LastBinaryOperator */); - TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([90 /* InKeyword */, 91 /* InstanceOfKeyword */, 134 /* OfKeyword */, 116 /* AsKeyword */, 124 /* IsKeyword */]); + TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([90 /* InKeyword */, 91 /* InstanceOfKeyword */, 138 /* OfKeyword */, 116 /* AsKeyword */, 124 /* IsKeyword */]); TokenRange.UnaryPrefixOperators = TokenRange.FromTokens([41 /* PlusPlusToken */, 42 /* MinusMinusToken */, 50 /* TildeToken */, 49 /* ExclamationToken */]); TokenRange.UnaryPrefixExpressions = TokenRange.FromTokens([8 /* NumericLiteral */, 69 /* Identifier */, 17 /* OpenParenToken */, 19 /* OpenBracketToken */, 15 /* OpenBraceToken */, 97 /* ThisKeyword */, 92 /* NewKeyword */]); TokenRange.UnaryPreincrementExpressions = TokenRange.FromTokens([69 /* Identifier */, 17 /* OpenParenToken */, 97 /* ThisKeyword */, 92 /* NewKeyword */]); @@ -42689,9 +48517,9 @@ var ts; TokenRange.UnaryPredecrementExpressions = TokenRange.FromTokens([69 /* Identifier */, 17 /* OpenParenToken */, 97 /* ThisKeyword */, 92 /* NewKeyword */]); TokenRange.UnaryPostdecrementExpressions = TokenRange.FromTokens([69 /* Identifier */, 18 /* CloseParenToken */, 20 /* CloseBracketToken */, 92 /* NewKeyword */]); TokenRange.Comments = TokenRange.FromTokens([2 /* SingleLineCommentTrivia */, 3 /* MultiLineCommentTrivia */]); - TokenRange.TypeNames = TokenRange.FromTokens([69 /* Identifier */, 128 /* NumberKeyword */, 130 /* StringKeyword */, 120 /* BooleanKeyword */, 131 /* SymbolKeyword */, 103 /* VoidKeyword */, 117 /* AnyKeyword */]); + TokenRange.TypeNames = TokenRange.FromTokens([69 /* Identifier */, 130 /* NumberKeyword */, 132 /* StringKeyword */, 120 /* BooleanKeyword */, 133 /* SymbolKeyword */, 103 /* VoidKeyword */, 117 /* AnyKeyword */]); return TokenRange; - })(); + }()); Shared.TokenRange = TokenRange; })(Shared = formatting.Shared || (formatting.Shared = {})); })(formatting = ts.formatting || (ts.formatting = {})); @@ -42777,6 +48605,14 @@ var ts; rules.push(this.globalRules.NoSpaceBeforeCloseBracket); rules.push(this.globalRules.NoSpaceBetweenBrackets); } + if (options.InsertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces) { + rules.push(this.globalRules.SpaceAfterTemplateHeadAndMiddle); + rules.push(this.globalRules.SpaceBeforeTemplateMiddleAndTail); + } + else { + rules.push(this.globalRules.NoSpaceAfterTemplateHeadAndMiddle); + rules.push(this.globalRules.NoSpaceBeforeTemplateMiddleAndTail); + } if (options.InsertSpaceAfterSemicolonInForStatements) { rules.push(this.globalRules.SpaceAfterSemicolonInFor); } @@ -42802,7 +48638,7 @@ var ts; return rules; }; return RulesProvider; - })(); + }()); formatting.RulesProvider = RulesProvider; })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); @@ -42824,12 +48660,20 @@ var ts; if (line === 0) { return []; } - // get the span for the previous\current line + // After the enter key, the cursor is now at a new line. The new line may or may not contain non-whitespace characters. + // If the new line has only whitespaces, we won't want to format this line, because that would remove the indentation as + // trailing whitespaces. So the end of the formatting span should be the later one between: + // 1. the end of the previous line + // 2. the last non-whitespace character in the current line + var endOfFormatSpan = ts.getEndLinePosition(line, sourceFile); + while (ts.isWhiteSpace(sourceFile.text.charCodeAt(endOfFormatSpan)) && !ts.isLineBreak(sourceFile.text.charCodeAt(endOfFormatSpan))) { + endOfFormatSpan--; + } var span = { // get start position for the previous line pos: ts.getStartPositionOfLine(line - 1, sourceFile), - // get end position for the current line (end value is exclusive so add 1 to the result) - end: ts.getEndLinePosition(line, sourceFile) + 1 + // end value is exclusive so add 1 to the result + end: endOfFormatSpan + 1 }; return formatSpan(span, sourceFile, options, rulesProvider, 2 /* FormatOnEnter */); } @@ -42872,9 +48716,9 @@ var ts; } function findOutermostParent(position, expectedTokenKind, sourceFile) { var precedingToken = ts.findPrecedingToken(position, sourceFile); - // when it is claimed that trigger character was typed at given position + // when it is claimed that trigger character was typed at given position // we verify that there is a token with a matching kind whose end is equal to position (because the character was just typed). - // If this condition is not hold - then trigger character was typed in some other context, + // If this condition is not hold - then trigger character was typed in some other context, // i.e.in comment and thus should not trigger autoformatting if (!precedingToken || precedingToken.kind !== expectedTokenKind || @@ -42883,12 +48727,12 @@ var ts; } // walk up and search for the parent node that ends at the same position with precedingToken. // for cases like this - // + // // let x = 1; // while (true) { - // } + // } // after typing close curly in while statement we want to reformat just the while statement. - // However if we just walk upwards searching for the parent that has the same end value - + // However if we just walk upwards searching for the parent that has the same end value - // we'll end up with the whole source file. isListElement allows to stop on the list element level var current = precedingToken; while (current && @@ -42903,17 +48747,17 @@ var ts; // i.e. parent is class declaration with the list of members and node is one of members. function isListElement(parent, node) { switch (parent.kind) { - case 214 /* ClassDeclaration */: - case 215 /* InterfaceDeclaration */: + case 221 /* ClassDeclaration */: + case 222 /* InterfaceDeclaration */: return ts.rangeContainsRange(parent.members, node); - case 218 /* ModuleDeclaration */: + case 225 /* ModuleDeclaration */: var body = parent.body; - return body && body.kind === 192 /* Block */ && ts.rangeContainsRange(body.statements, node); - case 248 /* SourceFile */: - case 192 /* Block */: - case 219 /* ModuleBlock */: + return body && body.kind === 199 /* Block */ && ts.rangeContainsRange(body.statements, node); + case 256 /* SourceFile */: + case 199 /* Block */: + case 226 /* ModuleBlock */: return ts.rangeContainsRange(parent.statements, node); - case 244 /* CatchClause */: + case 252 /* CatchClause */: return ts.rangeContainsRange(parent.block.statements, node); } return false; @@ -42953,7 +48797,7 @@ var ts; // 'index' tracks the index of the most recent error that was checked. while (true) { if (index >= sorted.length) { - // all errors in the range were already checked -> no error in specified range + // all errors in the range were already checked -> no error in specified range return false; } var error = sorted[index]; @@ -42987,7 +48831,7 @@ var ts; // no preceding token found - start from the beginning of enclosing node return enclosingNode.pos; } - // preceding token ends after the start of original range (i.e when originaRange.pos falls in the middle of literal) + // preceding token ends after the start of original range (i.e when originalRange.pos falls in the middle of literal) // start from the beginning of enclosingNode to handle the entire 'originalRange' if (precedingToken.end >= originalRange.pos) { return enclosingNode.pos; @@ -43011,17 +48855,17 @@ var ts; */ function getOwnOrInheritedDelta(n, options, sourceFile) { var previousLine = -1 /* Unknown */; - var childKind = 0 /* Unknown */; + var child; while (n) { var line = sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)).line; if (previousLine !== -1 /* Unknown */ && line !== previousLine) { break; } - if (formatting.SmartIndenter.shouldIndentChildNode(n.kind, childKind)) { + if (formatting.SmartIndenter.shouldIndentChildNode(n, child)) { return options.IndentSize; } previousLine = line; - childKind = n.kind; + child = n; n = n.parent; } return 0; @@ -43051,6 +48895,13 @@ var ts; var delta = getOwnOrInheritedDelta(enclosingNode, options, sourceFile); processNode(enclosingNode, enclosingNode, startLine, undecoratedStartLine, initialIndentation, delta); } + if (!formattingScanner.isOnToken()) { + var leadingTrivia = formattingScanner.getCurrentLeadingTrivia(); + if (leadingTrivia) { + processTrivia(leadingTrivia, enclosingNode, enclosingNode, undefined); + trimTrailingWhitespacesForRemainingRange(); + } + } formattingScanner.close(); return edits; // local functions @@ -43062,7 +48913,8 @@ var ts; * to inherited indentation from its predecessors. */ function tryComputeIndentationForListItem(startPos, endPos, parentStartLine, range, inheritedIndentation) { - if (ts.rangeOverlapsWithStartEnd(range, startPos, endPos)) { + if (ts.rangeOverlapsWithStartEnd(range, startPos, endPos) || + ts.rangeContainsStartEnd(range, startPos, endPos) /* Not to miss zero-range nodes e.g. JsxText */) { if (inheritedIndentation !== -1 /* Unknown */) { return inheritedIndentation; } @@ -43079,32 +48931,7 @@ var ts; } function computeIndentation(node, startLine, inheritedIndentation, parent, parentDynamicIndentation, effectiveParentStartLine) { var indentation = inheritedIndentation; - if (indentation === -1 /* Unknown */) { - if (isSomeBlock(node.kind)) { - // blocks should be indented in - // - other blocks - // - source file - // - switch\default clauses - if (isSomeBlock(parent.kind) || - parent.kind === 248 /* SourceFile */ || - parent.kind === 241 /* CaseClause */ || - parent.kind === 242 /* DefaultClause */) { - indentation = parentDynamicIndentation.getIndentation() + parentDynamicIndentation.getDelta(); - } - else { - indentation = parentDynamicIndentation.getIndentation(); - } - } - else { - if (formatting.SmartIndenter.childStartsOnTheSameLineWithElseInIfStatement(parent, node, startLine, sourceFile)) { - indentation = parentDynamicIndentation.getIndentation(); - } - else { - indentation = parentDynamicIndentation.getIndentation() + parentDynamicIndentation.getDelta(); - } - } - } - var delta = formatting.SmartIndenter.shouldIndentChildNode(node.kind, 0 /* Unknown */) ? options.IndentSize : 0; + var delta = formatting.SmartIndenter.shouldIndentChildNode(node) ? options.IndentSize : 0; if (effectiveParentStartLine === startLine) { // if node is located on the same line with the parent // - inherit indentation from the parent @@ -43112,7 +48939,15 @@ var ts; indentation = startLine === lastIndentedLine ? indentationOnLastIndentedLine : parentDynamicIndentation.getIndentation(); - delta = Math.min(options.IndentSize, parentDynamicIndentation.getDelta() + delta); + delta = Math.min(options.IndentSize, parentDynamicIndentation.getDelta(node) + delta); + } + else if (indentation === -1 /* Unknown */) { + if (formatting.SmartIndenter.childStartsOnTheSameLineWithElseInIfStatement(parent, node, startLine, sourceFile)) { + indentation = parentDynamicIndentation.getIndentation(); + } + else { + indentation = parentDynamicIndentation.getIndentation() + parentDynamicIndentation.getDelta(node); + } } return { indentation: indentation, @@ -43124,25 +48959,25 @@ var ts; return node.modifiers[0].kind; } switch (node.kind) { - case 214 /* ClassDeclaration */: return 73 /* ClassKeyword */; - case 215 /* InterfaceDeclaration */: return 107 /* InterfaceKeyword */; - case 213 /* FunctionDeclaration */: return 87 /* FunctionKeyword */; - case 217 /* EnumDeclaration */: return 217 /* EnumDeclaration */; - case 145 /* GetAccessor */: return 123 /* GetKeyword */; - case 146 /* SetAccessor */: return 129 /* SetKeyword */; - case 143 /* MethodDeclaration */: + case 221 /* ClassDeclaration */: return 73 /* ClassKeyword */; + case 222 /* InterfaceDeclaration */: return 107 /* InterfaceKeyword */; + case 220 /* FunctionDeclaration */: return 87 /* FunctionKeyword */; + case 224 /* EnumDeclaration */: return 224 /* EnumDeclaration */; + case 149 /* GetAccessor */: return 123 /* GetKeyword */; + case 150 /* SetAccessor */: return 131 /* SetKeyword */; + case 147 /* MethodDeclaration */: if (node.asteriskToken) { return 37 /* AsteriskToken */; } // fall-through - case 141 /* PropertyDeclaration */: - case 138 /* Parameter */: + case 145 /* PropertyDeclaration */: + case 142 /* Parameter */: return node.name.kind; } } function getDynamicIndentation(node, nodeStartLine, indentation, delta) { return { - getIndentationForComment: function (kind, tokenIndentation) { + getIndentationForComment: function (kind, tokenIndentation, container) { switch (kind) { // preceding comment to the token that closes the indentation scope inherits the indentation from the scope // .. { @@ -43151,11 +48986,11 @@ var ts; case 16 /* CloseBraceToken */: case 20 /* CloseBracketToken */: case 18 /* CloseParenToken */: - return indentation + delta; + return indentation + getEffectiveDelta(delta, container); } return tokenIndentation !== -1 /* Unknown */ ? tokenIndentation : indentation; }, - getIndentationForToken: function (line, kind) { + getIndentationForToken: function (line, kind, container) { if (nodeStartLine !== line && node.decorators) { if (kind === getFirstNonDecoratorTokenOfNode(node)) { // if this token is the first token following the list of decorators, we do not need to indent @@ -43176,20 +49011,20 @@ var ts; return indentation; default: // if token line equals to the line of containing node (this is a first token in the node) - use node indentation - return nodeStartLine !== line ? indentation + delta : indentation; + return nodeStartLine !== line ? indentation + getEffectiveDelta(delta, container) : indentation; } }, getIndentation: function () { return indentation; }, - getDelta: function () { return delta; }, + getDelta: function (child) { return getEffectiveDelta(delta, child); }, recomputeIndentation: function (lineAdded) { - if (node.parent && formatting.SmartIndenter.shouldIndentChildNode(node.parent.kind, node.kind)) { + if (node.parent && formatting.SmartIndenter.shouldIndentChildNode(node.parent, node)) { if (lineAdded) { indentation += options.IndentSize; } else { indentation -= options.IndentSize; } - if (formatting.SmartIndenter.shouldIndentChildNode(node.kind, 0 /* Unknown */)) { + if (formatting.SmartIndenter.shouldIndentChildNode(node)) { delta = options.IndentSize; } else { @@ -43198,6 +49033,10 @@ var ts; } } }; + function getEffectiveDelta(delta, child) { + // Delta value should be zero when the node explicitly prevents indentation of the child node + return formatting.SmartIndenter.nodeWillIndentChild(node, child, true) ? delta : 0; + } } function processNode(node, contextNode, nodeStartLine, undecoratedNodeStartLine, indentation, delta) { if (!ts.rangeOverlapsWithStartEnd(originalRange, node.getStart(sourceFile), node.getEnd())) { @@ -43207,12 +49046,12 @@ var ts; // a useful observations when tracking context node // / // [a] - // / | \ + // / | \ // [b] [c] [d] - // node 'a' is a context node for nodes 'b', 'c', 'd' + // node 'a' is a context node for nodes 'b', 'c', 'd' // except for the leftmost leaf token in [b] - in this case context node ('e') is located somewhere above 'a' // this rule can be applied recursively to child nodes of 'a'. - // + // // context node is set to parent node value after processing every child node // context node is set to parent of the token after processing every token var childContextNode = contextNode; @@ -43231,7 +49070,7 @@ var ts; } consumeTokenAndAdvanceScanner(tokenInfo, node, nodeDynamicIndentation); } - function processChildNode(child, inheritedIndentation, parent, parentDynamicIndentation, parentStartLine, undecoratedParentStartLine, isListItem) { + function processChildNode(child, inheritedIndentation, parent, parentDynamicIndentation, parentStartLine, undecoratedParentStartLine, isListItem, isFirstListItem) { var childStartPos = child.getStart(sourceFile); var childStartLine = sourceFile.getLineAndCharacterOfPosition(childStartPos).line; var undecoratedChildStartLine = childStartLine; @@ -43269,13 +49108,16 @@ var ts; // if child node is a token, it does not impact indentation, proceed it using parent indentation scope rules var tokenInfo = formattingScanner.readTokenInfo(child); ts.Debug.assert(tokenInfo.token.end === child.end); - consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation); + consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation, child); return inheritedIndentation; } - var effectiveParentStartLine = child.kind === 139 /* Decorator */ ? childStartLine : undecoratedParentStartLine; + var effectiveParentStartLine = child.kind === 143 /* Decorator */ ? childStartLine : undecoratedParentStartLine; var childIndentation = computeIndentation(child, childStartLine, childIndentationAmount, node, parentDynamicIndentation, effectiveParentStartLine); processNode(child, childContextNode, childStartLine, undecoratedChildStartLine, childIndentation.indentation, childIndentation.delta); childContextNode = node; + if (isFirstListItem && parent.kind === 170 /* ArrayLiteralExpression */ && inheritedIndentation === -1 /* Unknown */) { + inheritedIndentation = childIndentation.indentation; + } return inheritedIndentation; } function processChildNodes(nodes, parent, parentStartLine, parentDynamicIndentation) { @@ -43305,16 +49147,16 @@ var ts; } } var inheritedIndentation = -1 /* Unknown */; - for (var _i = 0, nodes_6 = nodes; _i < nodes_6.length; _i++) { - var child = nodes_6[_i]; - inheritedIndentation = processChildNode(child, inheritedIndentation, node, listDynamicIndentation, startLine, startLine, /*isListElement*/ true); + for (var i = 0; i < nodes.length; i++) { + var child = nodes[i]; + inheritedIndentation = processChildNode(child, inheritedIndentation, node, listDynamicIndentation, startLine, startLine, /*isListElement*/ true, /*isFirstListItem*/ i === 0); } if (listEndToken !== 0 /* Unknown */) { if (formattingScanner.isOnToken()) { var tokenInfo = formattingScanner.readTokenInfo(parent); // consume the list end token only if it is still belong to the parent // there might be the case when current token matches end token but does not considered as one - // function (x: function) <-- + // function (x: function) <-- // without this check close paren will be interpreted as list end token for function expression which is wrong if (tokenInfo.token.kind === listEndToken && ts.rangeContainsRange(parent, tokenInfo.token)) { // consume list end token @@ -43323,7 +49165,7 @@ var ts; } } } - function consumeTokenAndAdvanceScanner(currentTokenInfo, parent, dynamicIndentation) { + function consumeTokenAndAdvanceScanner(currentTokenInfo, parent, dynamicIndentation, container) { ts.Debug.assert(ts.rangeContainsRange(parent, currentTokenInfo.token)); var lastTriviaWasNewLine = formattingScanner.lastTrailingTriviaWasNewLine(); var indentToken = false; @@ -43358,26 +49200,26 @@ var ts; } if (indentToken) { var tokenIndentation = (isTokenInRange && !rangeContainsError(currentTokenInfo.token)) ? - dynamicIndentation.getIndentationForToken(tokenStart.line, currentTokenInfo.token.kind) : + dynamicIndentation.getIndentationForToken(tokenStart.line, currentTokenInfo.token.kind, container) : -1 /* Unknown */; + var indentNextTokenOrTrivia = true; if (currentTokenInfo.leadingTrivia) { - var commentIndentation = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind, tokenIndentation); - var indentNextTokenOrTrivia = true; + var commentIndentation = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind, tokenIndentation, container); for (var _i = 0, _a = currentTokenInfo.leadingTrivia; _i < _a.length; _i++) { var triviaItem = _a[_i]; - if (!ts.rangeContainsRange(originalRange, triviaItem)) { - continue; - } + var triviaInRange = ts.rangeContainsRange(originalRange, triviaItem); switch (triviaItem.kind) { case 3 /* MultiLineCommentTrivia */: - indentMultilineComment(triviaItem, commentIndentation, /*firstLineIsIndented*/ !indentNextTokenOrTrivia); + if (triviaInRange) { + indentMultilineComment(triviaItem, commentIndentation, /*firstLineIsIndented*/ !indentNextTokenOrTrivia); + } indentNextTokenOrTrivia = false; break; case 2 /* SingleLineCommentTrivia */: - if (indentNextTokenOrTrivia) { + if (indentNextTokenOrTrivia && triviaInRange) { insertIndentation(triviaItem.pos, commentIndentation, /*lineAdded*/ false); - indentNextTokenOrTrivia = false; } + indentNextTokenOrTrivia = false; break; case 4 /* NewLineTrivia */: indentNextTokenOrTrivia = true; @@ -43386,7 +49228,7 @@ var ts; } } // indent token only if is it is in target range and does not overlap with any error ranges - if (tokenIndentation !== -1 /* Unknown */) { + if (tokenIndentation !== -1 /* Unknown */ && indentNextTokenOrTrivia) { insertIndentation(currentTokenInfo.token.pos, tokenIndentation, lineAdded); lastIndentedLine = tokenStart.line; indentationOnLastIndentedLine = tokenIndentation; @@ -43434,7 +49276,7 @@ var ts; applyRuleEdits(rule, previousItem, previousStartLine, currentItem, currentStartLine); if (rule.Operation.Action & (2 /* Space */ | 8 /* Delete */) && currentStartLine !== previousStartLine) { lineAdded = false; - // Handle the case where the next line is moved to be the end of this line. + // Handle the case where the next line is moved to be the end of this line. // In this case we don't indent the next line in the next pass. if (currentParent.getStart(sourceFile) === currentItem.pos) { dynamicIndentation.recomputeIndentation(/*lineAdded*/ false); @@ -43442,7 +49284,7 @@ var ts; } else if (rule.Operation.Action & 4 /* NewLine */ && currentStartLine === previousStartLine) { lineAdded = true; - // Handle the case where token2 is moved to the new line. + // Handle the case where token2 is moved to the new line. // In this case we indent token2 in the next pass but we set // sameLineIndent flag to notify the indenter that the indentation is within the line. if (currentParent.getStart(sourceFile) === currentItem.pos) { @@ -43450,9 +49292,7 @@ var ts; } } // We need to trim trailing whitespace between the tokens if they were on different lines, and no rule was applied to put them on the same line - trimTrailingWhitespaces = - (rule.Operation.Action & (4 /* NewLine */ | 2 /* Space */)) && - rule.Flag !== 1 /* CanDeleteNewLines */; + trimTrailingWhitespaces = !(rule.Operation.Action & 8 /* Delete */) && rule.Flag !== 1 /* CanDeleteNewLines */; } else { trimTrailingWhitespaces = true; @@ -43472,12 +49312,15 @@ var ts; } else { var tokenStart = sourceFile.getLineAndCharacterOfPosition(pos); - if (indentation !== tokenStart.character) { - var startLinePosition = ts.getStartPositionOfLine(tokenStart.line, sourceFile); + var startLinePosition = ts.getStartPositionOfLine(tokenStart.line, sourceFile); + if (indentation !== tokenStart.character || indentationIsDifferent(indentationString, startLinePosition)) { recordReplace(startLinePosition, tokenStart.character, indentationString); } } } + function indentationIsDifferent(indentationString, startLinePosition) { + return indentationString !== sourceFile.text.substr(startLinePosition, indentationString.length); + } function indentMultilineComment(commentRange, indentation, firstLineIsIndented) { // split comment in lines var startLine = sourceFile.getLineAndCharacterOfPosition(commentRange.pos).line; @@ -43535,16 +49378,36 @@ var ts; if (range && (ts.isComment(range.kind) || ts.isStringOrRegularExpressionOrTemplateLiteral(range.kind)) && range.pos <= lineEndPosition && range.end > lineEndPosition) { continue; } - var pos = lineEndPosition; - while (pos >= lineStartPosition && ts.isWhiteSpace(sourceFile.text.charCodeAt(pos))) { - pos--; - } - if (pos !== lineEndPosition) { - ts.Debug.assert(pos === lineStartPosition || !ts.isWhiteSpace(sourceFile.text.charCodeAt(pos))); - recordDelete(pos + 1, lineEndPosition - pos); + var whitespaceStart = getTrailingWhitespaceStartPosition(lineStartPosition, lineEndPosition); + if (whitespaceStart !== -1) { + ts.Debug.assert(whitespaceStart === lineStartPosition || !ts.isWhiteSpace(sourceFile.text.charCodeAt(whitespaceStart - 1))); + recordDelete(whitespaceStart, lineEndPosition + 1 - whitespaceStart); } } } + /** + * @param start The position of the first character in range + * @param end The position of the last character in range + */ + function getTrailingWhitespaceStartPosition(start, end) { + var pos = end; + while (pos >= start && ts.isWhiteSpace(sourceFile.text.charCodeAt(pos))) { + pos--; + } + if (pos !== end) { + return pos + 1; + } + return -1; + } + /** + * Trimming will be done for lines after the previous range + */ + function trimTrailingWhitespacesForRemainingRange() { + var startPosition = previousRange ? previousRange.end : originalRange.pos; + var startLine = sourceFile.getLineAndCharacterOfPosition(startPosition).line; + var endLine = sourceFile.getLineAndCharacterOfPosition(originalRange.end).line; + trimTrailingWhitespacesForLines(startLine, endLine + 1, previousRange); + } function newTextChange(start, len, newText) { return { span: ts.createTextSpan(start, len), newText: newText }; } @@ -43598,20 +49461,20 @@ var ts; } function isSomeBlock(kind) { switch (kind) { - case 192 /* Block */: - case 219 /* ModuleBlock */: + case 199 /* Block */: + case 226 /* ModuleBlock */: return true; } return false; } function getOpenTokenForList(node, list) { switch (node.kind) { - case 144 /* Constructor */: - case 213 /* FunctionDeclaration */: - case 173 /* FunctionExpression */: - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - case 174 /* ArrowFunction */: + case 148 /* Constructor */: + case 220 /* FunctionDeclaration */: + case 179 /* FunctionExpression */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: + case 180 /* ArrowFunction */: if (node.typeParameters === list) { return 25 /* LessThanToken */; } @@ -43619,8 +49482,8 @@ var ts; return 17 /* OpenParenToken */; } break; - case 168 /* CallExpression */: - case 169 /* NewExpression */: + case 174 /* CallExpression */: + case 175 /* NewExpression */: if (node.typeArguments === list) { return 25 /* LessThanToken */; } @@ -43628,7 +49491,7 @@ var ts; return 17 /* OpenParenToken */; } break; - case 151 /* TypeReference */: + case 155 /* TypeReference */: if (node.typeArguments === list) { return 25 /* LessThanToken */; } @@ -43657,7 +49520,7 @@ var ts; if (!options.ConvertTabsToSpaces) { var tabs = Math.floor(indentation / options.TabSize); var spaces = indentation - tabs * options.TabSize; - var tabString; + var tabString = void 0; if (!internedTabsIndentation) { internedTabsIndentation = []; } @@ -43670,7 +49533,7 @@ var ts; return spaces ? tabString + repeat(" ", spaces) : tabString; } else { - var spacesString; + var spacesString = void 0; var quotient = Math.floor(indentation / options.IndentSize); var remainder = indentation % options.IndentSize; if (!internedSpacesIndentation) { @@ -43744,7 +49607,7 @@ var ts; var lineStart = ts.getLineStartPositionForPosition(current_1, sourceFile); return SmartIndenter.findFirstNonWhitespaceColumn(lineStart, current_1, sourceFile, options); } - if (precedingToken.kind === 24 /* CommaToken */ && precedingToken.parent.kind !== 181 /* BinaryExpression */) { + if (precedingToken.kind === 24 /* CommaToken */ && precedingToken.parent.kind !== 187 /* BinaryExpression */) { // previous token is comma that separates items in list - find the previous item and try to derive indentation from it var actualIndentation = getActualIndentationForListItemBeforeComma(precedingToken, sourceFile, options); if (actualIndentation !== -1 /* Unknown */) { @@ -43758,7 +49621,7 @@ var ts; var currentStart; var indentationDelta; while (current) { - if (ts.positionBelongsToNode(current, position, sourceFile) && shouldIndentChildNode(current.kind, previous ? previous.kind : 0 /* Unknown */)) { + if (ts.positionBelongsToNode(current, position, sourceFile) && shouldIndentChildNode(current, previous)) { currentStart = getStartLineAndCharacterForNode(current, sourceFile); if (nextTokenIsCurlyBraceOnSameLineAsCursor(precedingToken, current, lineAtPosition, sourceFile)) { indentationDelta = 0; @@ -43825,7 +49688,7 @@ var ts; } } // increase indentation if parent node wants its content to be indented and parent and child nodes don't start on the same line - if (shouldIndentChildNode(parent.kind, current.kind) && !parentAndChildShareLine) { + if (shouldIndentChildNode(parent, current) && !parentAndChildShareLine) { indentationDelta += options.IndentSize; } current = parent; @@ -43863,7 +49726,7 @@ var ts; // - parent is SourceFile - by default immediate children of SourceFile are not indented except when user indents them manually // - parent and child are not on the same line var useActualIndentation = (ts.isDeclaration(current) || ts.isStatement(current)) && - (parent.kind === 248 /* SourceFile */ || !parentAndChildShareLine); + (parent.kind === 256 /* SourceFile */ || !parentAndChildShareLine); if (!useActualIndentation) { return -1 /* Unknown */; } @@ -43896,7 +49759,7 @@ var ts; return sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)); } function childStartsOnTheSameLineWithElseInIfStatement(parent, child, childStartLine, sourceFile) { - if (parent.kind === 196 /* IfStatement */ && parent.elseStatement === child) { + if (parent.kind === 203 /* IfStatement */ && parent.elseStatement === child) { var elseKeyword = ts.findChildOfKind(parent, 80 /* ElseKeyword */, sourceFile); ts.Debug.assert(elseKeyword !== undefined); var elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line; @@ -43908,23 +49771,23 @@ var ts; function getContainingList(node, sourceFile) { if (node.parent) { switch (node.parent.kind) { - case 151 /* TypeReference */: + case 155 /* TypeReference */: if (node.parent.typeArguments && ts.rangeContainsStartEnd(node.parent.typeArguments, node.getStart(sourceFile), node.getEnd())) { return node.parent.typeArguments; } break; - case 165 /* ObjectLiteralExpression */: + case 171 /* ObjectLiteralExpression */: return node.parent.properties; - case 164 /* ArrayLiteralExpression */: + case 170 /* ArrayLiteralExpression */: return node.parent.elements; - case 213 /* FunctionDeclaration */: - case 173 /* FunctionExpression */: - case 174 /* ArrowFunction */: - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - case 147 /* CallSignature */: - case 148 /* ConstructSignature */: { + case 220 /* FunctionDeclaration */: + case 179 /* FunctionExpression */: + case 180 /* ArrowFunction */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: + case 151 /* CallSignature */: + case 152 /* ConstructSignature */: { var start = node.getStart(sourceFile); if (node.parent.typeParameters && ts.rangeContainsStartEnd(node.parent.typeParameters, start, node.getEnd())) { @@ -43935,8 +49798,8 @@ var ts; } break; } - case 169 /* NewExpression */: - case 168 /* CallExpression */: { + case 175 /* NewExpression */: + case 174 /* CallExpression */: { var start = node.getStart(sourceFile); if (node.parent.typeArguments && ts.rangeContainsStartEnd(node.parent.typeArguments, start, node.getEnd())) { @@ -43966,8 +49829,8 @@ var ts; if (node.kind === 18 /* CloseParenToken */) { return -1 /* Unknown */; } - if (node.parent && (node.parent.kind === 168 /* CallExpression */ || - node.parent.kind === 169 /* NewExpression */) && + if (node.parent && (node.parent.kind === 174 /* CallExpression */ || + node.parent.kind === 175 /* NewExpression */) && node.parent.expression !== node) { var fullCallOrNewExpression = node.parent.expression; var startingExpression = getStartingExpression(fullCallOrNewExpression); @@ -43985,10 +49848,10 @@ var ts; function getStartingExpression(node) { while (true) { switch (node.kind) { - case 168 /* CallExpression */: - case 169 /* NewExpression */: - case 166 /* PropertyAccessExpression */: - case 167 /* ElementAccessExpression */: + case 174 /* CallExpression */: + case 175 /* NewExpression */: + case 172 /* PropertyAccessExpression */: + case 173 /* ElementAccessExpression */: node = node.expression; break; default: @@ -44052,80 +49915,85 @@ var ts; SmartIndenter.findFirstNonWhitespaceColumn = findFirstNonWhitespaceColumn; function nodeContentIsAlwaysIndented(kind) { switch (kind) { - case 195 /* ExpressionStatement */: - case 214 /* ClassDeclaration */: - case 186 /* ClassExpression */: - case 215 /* InterfaceDeclaration */: - case 217 /* EnumDeclaration */: - case 216 /* TypeAliasDeclaration */: - case 164 /* ArrayLiteralExpression */: - case 192 /* Block */: - case 219 /* ModuleBlock */: - case 165 /* ObjectLiteralExpression */: - case 155 /* TypeLiteral */: - case 157 /* TupleType */: - case 220 /* CaseBlock */: - case 242 /* DefaultClause */: - case 241 /* CaseClause */: - case 172 /* ParenthesizedExpression */: - case 166 /* PropertyAccessExpression */: - case 168 /* CallExpression */: - case 169 /* NewExpression */: - case 193 /* VariableStatement */: - case 211 /* VariableDeclaration */: - case 227 /* ExportAssignment */: - case 204 /* ReturnStatement */: - case 182 /* ConditionalExpression */: - case 162 /* ArrayBindingPattern */: - case 161 /* ObjectBindingPattern */: - case 233 /* JsxElement */: - case 234 /* JsxSelfClosingElement */: - case 142 /* MethodSignature */: - case 147 /* CallSignature */: - case 148 /* ConstructSignature */: - case 138 /* Parameter */: - case 152 /* FunctionType */: - case 153 /* ConstructorType */: - case 160 /* ParenthesizedType */: - case 170 /* TaggedTemplateExpression */: - case 178 /* AwaitExpression */: + case 202 /* ExpressionStatement */: + case 221 /* ClassDeclaration */: + case 192 /* ClassExpression */: + case 222 /* InterfaceDeclaration */: + case 224 /* EnumDeclaration */: + case 223 /* TypeAliasDeclaration */: + case 170 /* ArrayLiteralExpression */: + case 199 /* Block */: + case 226 /* ModuleBlock */: + case 171 /* ObjectLiteralExpression */: + case 159 /* TypeLiteral */: + case 161 /* TupleType */: + case 227 /* CaseBlock */: + case 250 /* DefaultClause */: + case 249 /* CaseClause */: + case 178 /* ParenthesizedExpression */: + case 172 /* PropertyAccessExpression */: + case 174 /* CallExpression */: + case 175 /* NewExpression */: + case 200 /* VariableStatement */: + case 218 /* VariableDeclaration */: + case 235 /* ExportAssignment */: + case 211 /* ReturnStatement */: + case 188 /* ConditionalExpression */: + case 168 /* ArrayBindingPattern */: + case 167 /* ObjectBindingPattern */: + case 243 /* JsxOpeningElement */: + case 242 /* JsxSelfClosingElement */: + case 248 /* JsxExpression */: + case 146 /* MethodSignature */: + case 151 /* CallSignature */: + case 152 /* ConstructSignature */: + case 142 /* Parameter */: + case 156 /* FunctionType */: + case 157 /* ConstructorType */: + case 164 /* ParenthesizedType */: + case 176 /* TaggedTemplateExpression */: + case 184 /* AwaitExpression */: + case 233 /* NamedImports */: return true; } return false; } + /* @internal */ + function nodeWillIndentChild(parent, child, indentByDefault) { + var childKind = child ? child.kind : 0 /* Unknown */; + switch (parent.kind) { + case 204 /* DoStatement */: + case 205 /* WhileStatement */: + case 207 /* ForInStatement */: + case 208 /* ForOfStatement */: + case 206 /* ForStatement */: + case 203 /* IfStatement */: + case 220 /* FunctionDeclaration */: + case 179 /* FunctionExpression */: + case 147 /* MethodDeclaration */: + case 180 /* ArrowFunction */: + case 148 /* Constructor */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: + return childKind !== 199 /* Block */; + case 241 /* JsxElement */: + return childKind !== 245 /* JsxClosingElement */; + } + // No explicit rule for given nodes so the result will follow the default value argument + return indentByDefault; + } + SmartIndenter.nodeWillIndentChild = nodeWillIndentChild; + /* + Function returns true when the parent node should indent the given child by an explicit rule + */ function shouldIndentChildNode(parent, child) { - if (nodeContentIsAlwaysIndented(parent)) { - return true; - } - switch (parent) { - case 197 /* DoStatement */: - case 198 /* WhileStatement */: - case 200 /* ForInStatement */: - case 201 /* ForOfStatement */: - case 199 /* ForStatement */: - case 196 /* IfStatement */: - case 213 /* FunctionDeclaration */: - case 173 /* FunctionExpression */: - case 143 /* MethodDeclaration */: - case 174 /* ArrowFunction */: - case 144 /* Constructor */: - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: - return child !== 192 /* Block */; - default: - return false; - } + return nodeContentIsAlwaysIndented(parent.kind) || nodeWillIndentChild(parent, child, false); } SmartIndenter.shouldIndentChildNode = shouldIndentChildNode; })(SmartIndenter = formatting.SmartIndenter || (formatting.SmartIndenter = {})); })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); /// -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; /// /// /// @@ -44133,12 +50001,13 @@ var __extends = (this && this.__extends) || function (d, b) { /// /// /// +/// /// /// var ts; (function (ts) { /** The version of the language service API */ - ts.servicesVersion = "0.4"; + ts.servicesVersion = "0.5"; var ScriptSnapshot; (function (ScriptSnapshot) { var StringScriptSnapshot = (function () { @@ -44157,7 +50026,7 @@ var ts; return undefined; }; return StringScriptSnapshot; - })(); + }()); function fromString(text) { return new StringScriptSnapshot(text); } @@ -44250,13 +50119,13 @@ var ts; while (pos < end) { var token = scanner.scan(); var textPos = scanner.getTextPos(); - nodes.push(createNode(token, pos, textPos, 2048 /* Synthetic */, this)); + nodes.push(createNode(token, pos, textPos, 0, this)); pos = textPos; } return pos; }; NodeObject.prototype.createSyntaxList = function (nodes) { - var list = createNode(271 /* SyntaxList */, nodes.pos, nodes.end, 2048 /* Synthetic */, this); + var list = createNode(279 /* SyntaxList */, nodes.pos, nodes.end, 0, this); list._children = []; var pos = nodes.pos; for (var _i = 0, nodes_7 = nodes; _i < nodes_7.length; _i++) { @@ -44275,27 +50144,27 @@ var ts; NodeObject.prototype.createChildren = function (sourceFile) { var _this = this; var children; - if (this.kind >= 135 /* FirstNode */) { + if (this.kind >= 139 /* FirstNode */) { scanner.setText((sourceFile || this.getSourceFile()).text); children = []; - var pos = this.pos; + var pos_3 = this.pos; var processNode = function (node) { - if (pos < node.pos) { - pos = _this.addSyntheticNodes(children, pos, node.pos); + if (pos_3 < node.pos) { + pos_3 = _this.addSyntheticNodes(children, pos_3, node.pos); } children.push(node); - pos = node.end; + pos_3 = node.end; }; var processNodes = function (nodes) { - if (pos < nodes.pos) { - pos = _this.addSyntheticNodes(children, pos, nodes.pos); + if (pos_3 < nodes.pos) { + pos_3 = _this.addSyntheticNodes(children, pos_3, nodes.pos); } children.push(_this.createSyntaxList(nodes)); - pos = nodes.end; + pos_3 = nodes.end; }; ts.forEachChild(this, processNode, processNodes); - if (pos < this.end) { - this.addSyntheticNodes(children, pos, this.end); + if (pos_3 < this.end) { + this.addSyntheticNodes(children, pos_3, this.end); } scanner.setText(undefined); } @@ -44322,7 +50191,7 @@ var ts; return undefined; } var child = children[0]; - return child.kind < 135 /* FirstNode */ ? child : child.getFirstToken(sourceFile); + return child.kind < 139 /* FirstNode */ ? child : child.getFirstToken(sourceFile); }; NodeObject.prototype.getLastToken = function (sourceFile) { var children = this.getChildren(sourceFile); @@ -44330,10 +50199,10 @@ var ts; if (!child) { return undefined; } - return child.kind < 135 /* FirstNode */ ? child : child.getLastToken(sourceFile); + return child.kind < 139 /* FirstNode */ ? child : child.getLastToken(sourceFile); }; return NodeObject; - })(); + }()); var SymbolObject = (function () { function SymbolObject(flags, name) { this.flags = flags; @@ -44355,7 +50224,7 @@ var ts; return this.documentationComment; }; return SymbolObject; - })(); + }()); function getJsDocCommentsFromDeclarations(declarations, name, canUseParsedParamTagComments) { var documentationComment = []; var docComments = getJsDocCommentsSeparatedByNewLines(); @@ -44373,31 +50242,31 @@ var ts; // Make sure we are collecting doc comment from declaration once, // In case of union property there might be same declaration multiple times // which only varies in type parameter - // Eg. let a: Array | Array; a.length + // Eg. const a: Array | Array; a.length // The property length will have two declarations of property length coming // from Array - Array and Array if (ts.indexOf(declarations, declaration) === indexOfDeclaration) { - var sourceFileOfDeclaration = ts.getSourceFileOfNode(declaration); + var sourceFileOfDeclaration_1 = ts.getSourceFileOfNode(declaration); // If it is parameter - try and get the jsDoc comment with @param tag from function declaration's jsDoc comments - if (canUseParsedParamTagComments && declaration.kind === 138 /* Parameter */) { - ts.forEach(getJsDocCommentTextRange(declaration.parent, sourceFileOfDeclaration), function (jsDocCommentTextRange) { - var cleanedParamJsDocComment = getCleanedParamJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration); + if (canUseParsedParamTagComments && declaration.kind === 142 /* Parameter */) { + ts.forEach(getJsDocCommentTextRange(declaration.parent, sourceFileOfDeclaration_1), function (jsDocCommentTextRange) { + var cleanedParamJsDocComment = getCleanedParamJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration_1); if (cleanedParamJsDocComment) { ts.addRange(jsDocCommentParts, cleanedParamJsDocComment); } }); } // If this is left side of dotted module declaration, there is no doc comments associated with this node - if (declaration.kind === 218 /* ModuleDeclaration */ && declaration.body.kind === 218 /* ModuleDeclaration */) { + if (declaration.kind === 225 /* ModuleDeclaration */ && declaration.body.kind === 225 /* ModuleDeclaration */) { return; } // If this is dotted module name, get the doc comments from the parent - while (declaration.kind === 218 /* ModuleDeclaration */ && declaration.parent.kind === 218 /* ModuleDeclaration */) { + while (declaration.kind === 225 /* ModuleDeclaration */ && declaration.parent.kind === 225 /* ModuleDeclaration */) { declaration = declaration.parent; } // Get the cleaned js doc comment text from the declaration - ts.forEach(getJsDocCommentTextRange(declaration.kind === 211 /* VariableDeclaration */ ? declaration.parent.parent : declaration, sourceFileOfDeclaration), function (jsDocCommentTextRange) { - var cleanedJsDocComment = getCleanedJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration); + ts.forEach(getJsDocCommentTextRange(declaration.kind === 218 /* VariableDeclaration */ ? declaration.parent.parent : declaration, sourceFileOfDeclaration_1), function (jsDocCommentTextRange) { + var cleanedJsDocComment = getCleanedJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration_1); if (cleanedJsDocComment) { ts.addRange(jsDocCommentParts, cleanedJsDocComment); } @@ -44444,7 +50313,8 @@ var ts; } function pushDocCommentLineText(docComments, text, blankLineCount) { // Add the empty lines in between texts - while (blankLineCount--) { + while (blankLineCount) { + blankLineCount--; docComments.push(ts.textPart("")); } docComments.push(ts.textPart(text)); @@ -44470,7 +50340,7 @@ var ts; else if (spacesToRemoveAfterAsterisk === undefined) { spacesToRemoveAfterAsterisk = 0; } - // Analyse text on this line + // Analyze text on this line while (pos < end && !ts.isLineBreak(sourceFile.text.charCodeAt(pos))) { var ch = sourceFile.text.charAt(pos); if (ch === "@") { @@ -44590,7 +50460,7 @@ var ts; } paramHelpStringMargin = undefined; } - // If this is the start of another tag, continue with the loop in seach of param tag with symbol name + // If this is the start of another tag, continue with the loop in search of param tag with symbol name if (sourceFile.text.charCodeAt(pos) === 64 /* at */) { continue; } @@ -44669,8 +50539,11 @@ var ts; ? this.checker.getBaseTypes(this) : undefined; }; + TypeObject.prototype.getNonNullableType = function () { + return this.checker.getNonNullableType(this); + }; return TypeObject; - })(); + }()); var SignatureObject = (function () { function SignatureObject(checker) { this.checker = checker; @@ -44696,7 +50569,7 @@ var ts; return this.documentationComment; }; return SignatureObject; - })(); + }()); var SourceFileObject = (function (_super) { __extends(SourceFileObject, _super); function SourceFileObject(kind, pos, end) { @@ -44740,9 +50613,9 @@ var ts; if (result_2 !== undefined) { return result_2; } - if (declaration.name.kind === 136 /* ComputedPropertyName */) { + if (declaration.name.kind === 140 /* ComputedPropertyName */) { var expr = declaration.name.expression; - if (expr.kind === 166 /* PropertyAccessExpression */) { + if (expr.kind === 172 /* PropertyAccessExpression */) { return expr.name.text; } return getTextOfIdentifierOrLiteral(expr); @@ -44762,9 +50635,10 @@ var ts; } function visit(node) { switch (node.kind) { - case 213 /* FunctionDeclaration */: - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: + case 220 /* FunctionDeclaration */: + case 179 /* FunctionExpression */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: var functionDeclaration = node; var declarationName = getDeclarationName(functionDeclaration); if (declarationName) { @@ -44784,60 +50658,53 @@ var ts; ts.forEachChild(node, visit); } break; - case 214 /* ClassDeclaration */: - case 215 /* InterfaceDeclaration */: - case 216 /* TypeAliasDeclaration */: - case 217 /* EnumDeclaration */: - case 218 /* ModuleDeclaration */: - case 221 /* ImportEqualsDeclaration */: - case 230 /* ExportSpecifier */: - case 226 /* ImportSpecifier */: - case 221 /* ImportEqualsDeclaration */: - case 223 /* ImportClause */: - case 224 /* NamespaceImport */: - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: - case 155 /* TypeLiteral */: + case 221 /* ClassDeclaration */: + case 192 /* ClassExpression */: + case 222 /* InterfaceDeclaration */: + case 223 /* TypeAliasDeclaration */: + case 224 /* EnumDeclaration */: + case 225 /* ModuleDeclaration */: + case 229 /* ImportEqualsDeclaration */: + case 238 /* ExportSpecifier */: + case 234 /* ImportSpecifier */: + case 229 /* ImportEqualsDeclaration */: + case 231 /* ImportClause */: + case 232 /* NamespaceImport */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: + case 159 /* TypeLiteral */: addDeclaration(node); - // fall through - case 144 /* Constructor */: - case 193 /* VariableStatement */: - case 212 /* VariableDeclarationList */: - case 161 /* ObjectBindingPattern */: - case 162 /* ArrayBindingPattern */: - case 219 /* ModuleBlock */: ts.forEachChild(node, visit); break; - case 192 /* Block */: - if (ts.isFunctionBlock(node)) { - ts.forEachChild(node, visit); - } - break; - case 138 /* Parameter */: - // Only consider properties defined as constructor parameters - if (!(node.flags & 56 /* AccessibilityModifier */)) { + case 142 /* Parameter */: + // Only consider parameter properties + if (!(node.flags & 92 /* ParameterPropertyModifier */)) { break; } // fall through - case 211 /* VariableDeclaration */: - case 163 /* BindingElement */: - if (ts.isBindingPattern(node.name)) { - ts.forEachChild(node.name, visit); + case 218 /* VariableDeclaration */: + case 169 /* BindingElement */: { + var decl = node; + if (ts.isBindingPattern(decl.name)) { + ts.forEachChild(decl.name, visit); break; } - case 247 /* EnumMember */: - case 141 /* PropertyDeclaration */: - case 140 /* PropertySignature */: + if (decl.initializer) + visit(decl.initializer); + } + case 255 /* EnumMember */: + case 145 /* PropertyDeclaration */: + case 144 /* PropertySignature */: addDeclaration(node); break; - case 228 /* ExportDeclaration */: + case 236 /* ExportDeclaration */: // Handle named exports case e.g.: // export {a, b as B} from "mod"; if (node.exportClause) { ts.forEach(node.exportClause.elements, visit); } break; - case 222 /* ImportDeclaration */: + case 230 /* ImportDeclaration */: var importClause = node.importClause; if (importClause) { // Handle default import case e.g.: @@ -44849,7 +50716,7 @@ var ts; // import * as NS from "mod"; // import {a, b as B} from "mod"; if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 224 /* NamespaceImport */) { + if (importClause.namedBindings.kind === 232 /* NamespaceImport */) { addDeclaration(importClause.namedBindings); } else { @@ -44858,16 +50725,18 @@ var ts; } } break; + default: + ts.forEachChild(node, visit); } } }; return SourceFileObject; - })(NodeObject); + }(NodeObject)); var TextChange = (function () { function TextChange() { } return TextChange; - })(); + }()); ts.TextChange = TextChange; var HighlightSpanKind; (function (HighlightSpanKind) { @@ -44957,7 +50826,7 @@ var ts; // enum E ScriptElementKind.enumElement = "enum"; // Inside module and script only - // let v = .. + // const v = .. ScriptElementKind.variableElement = "var"; // Inside function ScriptElementKind.localVariableElement = "local var"; @@ -45025,8 +50894,11 @@ var ts; ClassificationTypeNames.jsxOpenTagName = "jsx open tag name"; ClassificationTypeNames.jsxCloseTagName = "jsx close tag name"; ClassificationTypeNames.jsxSelfClosingTagName = "jsx self closing tag name"; + ClassificationTypeNames.jsxAttribute = "jsx attribute"; + ClassificationTypeNames.jsxText = "jsx text"; + ClassificationTypeNames.jsxAttributeStringLiteralValue = "jsx attribute string literal value"; return ClassificationTypeNames; - })(); + }()); ts.ClassificationTypeNames = ClassificationTypeNames; (function (ClassificationType) { ClassificationType[ClassificationType["comment"] = 1] = "comment"; @@ -45050,6 +50922,9 @@ var ts; ClassificationType[ClassificationType["jsxOpenTagName"] = 19] = "jsxOpenTagName"; ClassificationType[ClassificationType["jsxCloseTagName"] = 20] = "jsxCloseTagName"; ClassificationType[ClassificationType["jsxSelfClosingTagName"] = 21] = "jsxSelfClosingTagName"; + ClassificationType[ClassificationType["jsxAttribute"] = 22] = "jsxAttribute"; + ClassificationType[ClassificationType["jsxText"] = 23] = "jsxText"; + ClassificationType[ClassificationType["jsxAttributeStringLiteralValue"] = 24] = "jsxAttributeStringLiteralValue"; })(ts.ClassificationType || (ts.ClassificationType = {})); var ClassificationType = ts.ClassificationType; function displayPartsToString(displayParts) { @@ -45065,16 +50940,16 @@ var ts; } return ts.forEach(symbol.declarations, function (declaration) { // Function expressions are local - if (declaration.kind === 173 /* FunctionExpression */) { + if (declaration.kind === 179 /* FunctionExpression */) { return true; } - if (declaration.kind !== 211 /* VariableDeclaration */ && declaration.kind !== 213 /* FunctionDeclaration */) { + if (declaration.kind !== 218 /* VariableDeclaration */ && declaration.kind !== 220 /* FunctionDeclaration */) { return false; } // If the parent is not sourceFile or module block it is local variable - for (var parent_8 = declaration.parent; !ts.isFunctionBlock(parent_8); parent_8 = parent_8.parent) { + for (var parent_15 = declaration.parent; !ts.isFunctionBlock(parent_15); parent_15 = parent_15.parent) { // Reached source file or module block - if (parent_8.kind === 248 /* SourceFile */ || parent_8.kind === 219 /* ModuleBlock */) { + if (parent_15.kind === 256 /* SourceFile */ || parent_15.kind === 226 /* ModuleBlock */) { return false; } } @@ -45086,7 +50961,6 @@ var ts; // Always default to "ScriptTarget.ES5" for the language service return { target: 1 /* ES5 */, - module: 0 /* None */, jsx: 1 /* Preserve */ }; } @@ -45120,7 +50994,8 @@ var ts; entry = { hostFileName: fileName, version: this.host.getScriptVersion(fileName), - scriptSnapshot: scriptSnapshot + scriptSnapshot: scriptSnapshot, + scriptKind: ts.getScriptKind(fileName, this.host) }; } this.fileNameToEntry.set(path, entry); @@ -45134,10 +51009,12 @@ var ts; }; HostCache.prototype.getOrCreateEntry = function (fileName) { var path = ts.toPath(fileName, this.currentDirectory, this.getCanonicalFileName); - if (this.contains(path)) { - return this.getEntry(path); - } - return this.createEntry(fileName, path); + return this.getOrCreateEntryByPath(fileName, path); + }; + HostCache.prototype.getOrCreateEntryByPath = function (fileName, path) { + return this.contains(path) + ? this.getEntry(path) + : this.createEntry(fileName, path); }; HostCache.prototype.getRootFileNames = function () { var fileNames = []; @@ -45157,7 +51034,7 @@ var ts; return file && file.scriptSnapshot; }; return HostCache; - })(); + }()); var SyntaxTreeCache = (function () { function SyntaxTreeCache(host) { this.host = host; @@ -45168,11 +51045,12 @@ var ts; // The host does not know about this file. throw new Error("Could not find file: '" + fileName + "'."); } + var scriptKind = ts.getScriptKind(fileName, this.host); var version = this.host.getScriptVersion(fileName); var sourceFile; if (this.currentFileName !== fileName) { // This is a new file, just parse it - sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, 2 /* Latest */, version, /*setNodeParents:*/ true); + sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, 2 /* Latest */, version, /*setNodeParents*/ true, scriptKind); } else if (this.currentFileVersion !== version) { // This is the same file, just a newer version. Incrementally parse the file. @@ -45189,7 +51067,7 @@ var ts; return this.currentSourceFile; }; return SyntaxTreeCache; - })(); + }()); function setSourceFileFields(sourceFile, scriptSnapshot, version) { sourceFile.version = version; sourceFile.scriptSnapshot = scriptSnapshot; @@ -45206,6 +51084,8 @@ var ts; function transpileModule(input, transpileOptions) { var options = transpileOptions.compilerOptions ? ts.clone(transpileOptions.compilerOptions) : getDefaultCompilerOptions(); options.isolatedModules = true; + // transpileModule does not write anything to disk so there is no need to verify that there are no conflicts between input and output paths. + options.suppressOutputPathCheck = true; // Filename can be non-ts file. options.allowNonTsExtensions = true; // We are not returning a sourceFile for lib file when asked by the program, @@ -45227,14 +51107,14 @@ var ts; var sourceMapText; // Create a compilerHost object to allow the compiler to read and write files var compilerHost = { - getSourceFile: function (fileName, target) { return fileName === ts.normalizeSlashes(inputFileName) ? sourceFile : undefined; }, + getSourceFile: function (fileName, target) { return fileName === ts.normalizePath(inputFileName) ? sourceFile : undefined; }, writeFile: function (name, text, writeByteOrderMark) { if (ts.fileExtensionIs(name, ".map")) { ts.Debug.assert(sourceMapText === undefined, "Unexpected multiple source map outputs for the file '" + name + "'"); sourceMapText = text; } else { - ts.Debug.assert(outputText === undefined, "Unexpected multiple outputs for the file: " + name); + ts.Debug.assert(outputText === undefined, "Unexpected multiple outputs for the file: '" + name + "'"); outputText = text; } }, @@ -45244,7 +51124,8 @@ var ts; getCurrentDirectory: function () { return ""; }, getNewLine: function () { return newLine; }, fileExists: function (fileName) { return fileName === inputFileName; }, - readFile: function (fileName) { return ""; } + readFile: function (fileName) { return ""; }, + directoryExists: function (directoryExists) { return true; } }; var program = ts.createProgram([inputFileName], options, compilerHost); var diagnostics; @@ -45269,12 +51150,10 @@ var ts; return output.outputText; } ts.transpile = transpile; - function createLanguageServiceSourceFile(fileName, scriptSnapshot, scriptTarget, version, setNodeParents) { + function createLanguageServiceSourceFile(fileName, scriptSnapshot, scriptTarget, version, setNodeParents, scriptKind) { var text = scriptSnapshot.getText(0, scriptSnapshot.getLength()); - var sourceFile = ts.createSourceFile(fileName, text, scriptTarget, setNodeParents); + var sourceFile = ts.createSourceFile(fileName, text, scriptTarget, setNodeParents, scriptKind); setSourceFileFields(sourceFile, scriptSnapshot, version); - // after full parsing we can use table with interned strings as name table - sourceFile.nameTable = sourceFile.identifiers; return sourceFile; } ts.createLanguageServiceSourceFile = createLanguageServiceSourceFile; @@ -45286,7 +51165,7 @@ var ts; if (version !== sourceFile.version) { // Once incremental parsing is ready, then just call into this function. if (!ts.disableIncrementalParsing) { - var newText; + var newText = void 0; // grab the fragment from the beginning of the original text to the beginning of the span var prefix = textChangeRange.span.start !== 0 ? sourceFile.text.substr(0, textChangeRange.span.start) @@ -45326,26 +51205,19 @@ var ts; } } // Otherwise, just create a new source file. - return createLanguageServiceSourceFile(sourceFile.fileName, scriptSnapshot, sourceFile.languageVersion, version, /*setNodeParents:*/ true); + return createLanguageServiceSourceFile(sourceFile.fileName, scriptSnapshot, sourceFile.languageVersion, version, /*setNodeParents*/ true, sourceFile.scriptKind); } ts.updateLanguageServiceSourceFile = updateLanguageServiceSourceFile; - function createGetCanonicalFileName(useCaseSensitivefileNames) { - return useCaseSensitivefileNames - ? (function (fileName) { return fileName; }) - : (function (fileName) { return fileName.toLowerCase(); }); - } - ts.createGetCanonicalFileName = createGetCanonicalFileName; function createDocumentRegistry(useCaseSensitiveFileNames, currentDirectory) { if (currentDirectory === void 0) { currentDirectory = ""; } // Maps from compiler setting target (ES3, ES5, etc.) to all the cached documents we have // for those settings. var buckets = {}; - var getCanonicalFileName = createGetCanonicalFileName(!!useCaseSensitiveFileNames); - function getKeyFromCompilationSettings(settings) { - return "_" + settings.target + "|" + settings.module + "|" + settings.noResolve + "|" + settings.jsx; + var getCanonicalFileName = ts.createGetCanonicalFileName(!!useCaseSensitiveFileNames); + function getKeyForCompilationSettings(settings) { + return ("_" + settings.target + "|" + settings.module + "|" + settings.noResolve + "|" + settings.jsx + "|" + settings.allowJs + "|" + settings.baseUrl + "|" + settings.typesRoot + "|" + settings.typesSearchPaths + "|" + JSON.stringify(settings.rootDirs) + "|" + JSON.stringify(settings.paths)); } - function getBucketForCompilationSettings(settings, createIfMissing) { - var key = getKeyFromCompilationSettings(settings); + function getBucketForCompilationSettings(key, createIfMissing) { var bucket = ts.lookUp(buckets, key); if (!bucket && createIfMissing) { buckets[key] = bucket = ts.createFileMap(); @@ -45353,7 +51225,7 @@ var ts; return bucket; } function reportStats() { - var bucketInfoArray = Object.keys(buckets).filter(function (name) { return name && name.charAt(0) === '_'; }).map(function (name) { + var bucketInfoArray = Object.keys(buckets).filter(function (name) { return name && name.charAt(0) === "_"; }).map(function (name) { var entries = ts.lookUp(buckets, name); var sourceFiles = []; entries.forEachValue(function (key, entry) { @@ -45369,22 +51241,31 @@ var ts; sourceFiles: sourceFiles }; }); - return JSON.stringify(bucketInfoArray, null, 2); + return JSON.stringify(bucketInfoArray, undefined, 2); } - function acquireDocument(fileName, compilationSettings, scriptSnapshot, version) { - return acquireOrUpdateDocument(fileName, compilationSettings, scriptSnapshot, version, /*acquiring:*/ true); - } - function updateDocument(fileName, compilationSettings, scriptSnapshot, version) { - return acquireOrUpdateDocument(fileName, compilationSettings, scriptSnapshot, version, /*acquiring:*/ false); - } - function acquireOrUpdateDocument(fileName, compilationSettings, scriptSnapshot, version, acquiring) { - var bucket = getBucketForCompilationSettings(compilationSettings, /*createIfMissing*/ true); + function acquireDocument(fileName, compilationSettings, scriptSnapshot, version, scriptKind) { var path = ts.toPath(fileName, currentDirectory, getCanonicalFileName); + var key = getKeyForCompilationSettings(compilationSettings); + return acquireDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind); + } + function acquireDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind) { + return acquireOrUpdateDocument(fileName, path, compilationSettings, key, scriptSnapshot, version, /*acquiring*/ true, scriptKind); + } + function updateDocument(fileName, compilationSettings, scriptSnapshot, version, scriptKind) { + var path = ts.toPath(fileName, currentDirectory, getCanonicalFileName); + var key = getKeyForCompilationSettings(compilationSettings); + return updateDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind); + } + function updateDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind) { + return acquireOrUpdateDocument(fileName, path, compilationSettings, key, scriptSnapshot, version, /*acquiring*/ false, scriptKind); + } + function acquireOrUpdateDocument(fileName, path, compilationSettings, key, scriptSnapshot, version, acquiring, scriptKind) { + var bucket = getBucketForCompilationSettings(key, /*createIfMissing*/ true); var entry = bucket.get(path); if (!entry) { ts.Debug.assert(acquiring, "How could we be trying to update a document that the registry doesn't have?"); // Have never seen this file with these settings. Create a new source file for it. - var sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, compilationSettings.target, version, /*setNodeParents:*/ false); + var sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, compilationSettings.target, version, /*setNodeParents*/ false, scriptKind); entry = { sourceFile: sourceFile, languageServiceRefCount: 0, @@ -45411,9 +51292,13 @@ var ts; return entry.sourceFile; } function releaseDocument(fileName, compilationSettings) { - var bucket = getBucketForCompilationSettings(compilationSettings, false); - ts.Debug.assert(bucket !== undefined); var path = ts.toPath(fileName, currentDirectory, getCanonicalFileName); + var key = getKeyForCompilationSettings(compilationSettings); + return releaseDocumentWithKey(path, key); + } + function releaseDocumentWithKey(path, key) { + var bucket = getBucketForCompilationSettings(key, /*createIfMissing*/ false); + ts.Debug.assert(bucket !== undefined); var entry = bucket.get(path); entry.languageServiceRefCount--; ts.Debug.assert(entry.languageServiceRefCount >= 0); @@ -45423,9 +51308,13 @@ var ts; } return { acquireDocument: acquireDocument, + acquireDocumentWithKey: acquireDocumentWithKey, updateDocument: updateDocument, + updateDocumentWithKey: updateDocumentWithKey, releaseDocument: releaseDocument, - reportStats: reportStats + releaseDocumentWithKey: releaseDocumentWithKey, + reportStats: reportStats, + getKeyForCompilationSettings: getKeyForCompilationSettings }; } ts.createDocumentRegistry = createDocumentRegistry; @@ -45433,9 +51322,24 @@ var ts; if (readImportFiles === void 0) { readImportFiles = true; } if (detectJavaScriptImports === void 0) { detectJavaScriptImports = false; } var referencedFiles = []; + var typeReferenceDirectives = []; var importedFiles = []; var ambientExternalModules; var isNoDefaultLib = false; + var braceNesting = 0; + // assume that text represent an external module if it contains at least one top level import/export + // ambient modules that are found inside external modules are interpreted as module augmentations + var externalModule = false; + function nextToken() { + var token = scanner.scan(); + if (token === 15 /* OpenBraceToken */) { + braceNesting++; + } + else if (token === 16 /* CloseBraceToken */) { + braceNesting--; + } + return token; + } function processTripleSlashDirectives() { var commentRanges = ts.getLeadingCommentRanges(sourceText, 0); ts.forEach(commentRanges, function (commentRange) { @@ -45445,25 +51349,37 @@ var ts; isNoDefaultLib = referencePathMatchResult.isNoDefaultLib; var fileReference = referencePathMatchResult.fileReference; if (fileReference) { - referencedFiles.push(fileReference); + var collection = referencePathMatchResult.isTypeReferenceDirective + ? typeReferenceDirectives + : referencedFiles; + collection.push(fileReference); } } }); } + function getFileReference() { + var file = scanner.getTokenValue(); + var pos = scanner.getTokenPos(); + return { + fileName: file, + pos: pos, + end: pos + file.length + }; + } function recordAmbientExternalModule() { if (!ambientExternalModules) { ambientExternalModules = []; } - ambientExternalModules.push(scanner.getTokenValue()); + ambientExternalModules.push({ ref: getFileReference(), depth: braceNesting }); } function recordModuleName() { - var importPath = scanner.getTokenValue(); - var pos = scanner.getTokenPos(); - importedFiles.push({ - fileName: importPath, - pos: pos, - end: pos + importPath.length - }); + importedFiles.push(getFileReference()); + markAsExternalModuleIfTopLevel(); + } + function markAsExternalModuleIfTopLevel() { + if (braceNesting === 0) { + externalModule = true; + } } /** * Returns true if at least one token was consumed from the stream @@ -45472,9 +51388,9 @@ var ts; var token = scanner.getToken(); if (token === 122 /* DeclareKeyword */) { // declare module "mod" - token = scanner.scan(); + token = nextToken(); if (token === 125 /* ModuleKeyword */) { - token = scanner.scan(); + token = nextToken(); if (token === 9 /* StringLiteral */) { recordAmbientExternalModule(); } @@ -45489,7 +51405,7 @@ var ts; function tryConsumeImport() { var token = scanner.getToken(); if (token === 89 /* ImportKeyword */) { - token = scanner.scan(); + token = nextToken(); if (token === 9 /* StringLiteral */) { // import "mod"; recordModuleName(); @@ -45497,9 +51413,9 @@ var ts; } else { if (token === 69 /* Identifier */ || ts.isKeyword(token)) { - token = scanner.scan(); - if (token === 133 /* FromKeyword */) { - token = scanner.scan(); + token = nextToken(); + if (token === 136 /* FromKeyword */) { + token = nextToken(); if (token === 9 /* StringLiteral */) { // import d from "mod"; recordModuleName(); @@ -45507,13 +51423,13 @@ var ts; } } else if (token === 56 /* EqualsToken */) { - if (tryConsumeRequireCall(/* skipCurrentToken */ true)) { + if (tryConsumeRequireCall(/*skipCurrentToken*/ true)) { return true; } } else if (token === 24 /* CommaToken */) { // consume comma and keep going - token = scanner.scan(); + token = nextToken(); } else { // unknown syntax @@ -45521,16 +51437,16 @@ var ts; } } if (token === 15 /* OpenBraceToken */) { - token = scanner.scan(); + token = nextToken(); // consume "{ a as B, c, d as D}" clauses // make sure that it stops on EOF while (token !== 16 /* CloseBraceToken */ && token !== 1 /* EndOfFileToken */) { - token = scanner.scan(); + token = nextToken(); } if (token === 16 /* CloseBraceToken */) { - token = scanner.scan(); - if (token === 133 /* FromKeyword */) { - token = scanner.scan(); + token = nextToken(); + if (token === 136 /* FromKeyword */) { + token = nextToken(); if (token === 9 /* StringLiteral */) { // import {a as A} from "mod"; // import d, {a, b as B} from "mod" @@ -45540,13 +51456,13 @@ var ts; } } else if (token === 37 /* AsteriskToken */) { - token = scanner.scan(); + token = nextToken(); if (token === 116 /* AsKeyword */) { - token = scanner.scan(); + token = nextToken(); if (token === 69 /* Identifier */ || ts.isKeyword(token)) { - token = scanner.scan(); - if (token === 133 /* FromKeyword */) { - token = scanner.scan(); + token = nextToken(); + if (token === 136 /* FromKeyword */) { + token = nextToken(); if (token === 9 /* StringLiteral */) { // import * as NS from "mod" // import d, * as NS from "mod" @@ -45564,18 +51480,19 @@ var ts; function tryConsumeExport() { var token = scanner.getToken(); if (token === 82 /* ExportKeyword */) { - token = scanner.scan(); + markAsExternalModuleIfTopLevel(); + token = nextToken(); if (token === 15 /* OpenBraceToken */) { - token = scanner.scan(); + token = nextToken(); // consume "{ a as B, c, d as D}" clauses // make sure it stops on EOF while (token !== 16 /* CloseBraceToken */ && token !== 1 /* EndOfFileToken */) { - token = scanner.scan(); + token = nextToken(); } if (token === 16 /* CloseBraceToken */) { - token = scanner.scan(); - if (token === 133 /* FromKeyword */) { - token = scanner.scan(); + token = nextToken(); + if (token === 136 /* FromKeyword */) { + token = nextToken(); if (token === 9 /* StringLiteral */) { // export {a as A} from "mod"; // export {a, b as B} from "mod" @@ -45585,9 +51502,9 @@ var ts; } } else if (token === 37 /* AsteriskToken */) { - token = scanner.scan(); - if (token === 133 /* FromKeyword */) { - token = scanner.scan(); + token = nextToken(); + if (token === 136 /* FromKeyword */) { + token = nextToken(); if (token === 9 /* StringLiteral */) { // export * from "mod" recordModuleName(); @@ -45595,11 +51512,11 @@ var ts; } } else if (token === 89 /* ImportKeyword */) { - token = scanner.scan(); + token = nextToken(); if (token === 69 /* Identifier */ || ts.isKeyword(token)) { - token = scanner.scan(); + token = nextToken(); if (token === 56 /* EqualsToken */) { - if (tryConsumeRequireCall(/* skipCurrentToken */ true)) { + if (tryConsumeRequireCall(/*skipCurrentToken*/ true)) { return true; } } @@ -45610,11 +51527,11 @@ var ts; return false; } function tryConsumeRequireCall(skipCurrentToken) { - var token = skipCurrentToken ? scanner.scan() : scanner.getToken(); - if (token === 127 /* RequireKeyword */) { - token = scanner.scan(); + var token = skipCurrentToken ? nextToken() : scanner.getToken(); + if (token === 129 /* RequireKeyword */) { + token = nextToken(); if (token === 17 /* OpenParenToken */) { - token = scanner.scan(); + token = nextToken(); if (token === 9 /* StringLiteral */) { // require("mod"); recordModuleName(); @@ -45627,16 +51544,16 @@ var ts; function tryConsumeDefine() { var token = scanner.getToken(); if (token === 69 /* Identifier */ && scanner.getTokenValue() === "define") { - token = scanner.scan(); + token = nextToken(); if (token !== 17 /* OpenParenToken */) { return true; } - token = scanner.scan(); + token = nextToken(); if (token === 9 /* StringLiteral */) { // looks like define ("modname", ... - skip string literal and comma - token = scanner.scan(); + token = nextToken(); if (token === 24 /* CommaToken */) { - token = scanner.scan(); + token = nextToken(); } else { // unexpected token @@ -45648,7 +51565,7 @@ var ts; return true; } // skip open bracket - token = scanner.scan(); + token = nextToken(); var i = 0; // scan until ']' or EOF while (token !== 20 /* CloseBracketToken */ && token !== 1 /* EndOfFileToken */) { @@ -45657,7 +51574,7 @@ var ts; recordModuleName(); i++; } - token = scanner.scan(); + token = nextToken(); } return true; } @@ -45665,7 +51582,7 @@ var ts; } function processImports() { scanner.setText(sourceText); - scanner.scan(); + nextToken(); // Look for: // import "mod"; // import d from "mod" @@ -45686,11 +51603,11 @@ var ts; if (tryConsumeDeclare() || tryConsumeImport() || tryConsumeExport() || - (detectJavaScriptImports && (tryConsumeRequireCall(/* skipCurrentToken */ false) || tryConsumeDefine()))) { + (detectJavaScriptImports && (tryConsumeRequireCall(/*skipCurrentToken*/ false) || tryConsumeDefine()))) { continue; } else { - scanner.scan(); + nextToken(); } } scanner.setText(undefined); @@ -45699,13 +51616,42 @@ var ts; processImports(); } processTripleSlashDirectives(); - return { referencedFiles: referencedFiles, importedFiles: importedFiles, isLibFile: isNoDefaultLib, ambientExternalModules: ambientExternalModules }; + if (externalModule) { + // for external modules module all nested ambient modules are augmentations + if (ambientExternalModules) { + // move all detected ambient modules to imported files since they need to be resolved + for (var _i = 0, ambientExternalModules_1 = ambientExternalModules; _i < ambientExternalModules_1.length; _i++) { + var decl = ambientExternalModules_1[_i]; + importedFiles.push(decl.ref); + } + } + return { referencedFiles: referencedFiles, typeReferenceDirectives: typeReferenceDirectives, importedFiles: importedFiles, isLibFile: isNoDefaultLib, ambientExternalModules: undefined }; + } + else { + // for global scripts ambient modules still can have augmentations - look for ambient modules with depth > 0 + var ambientModuleNames = void 0; + if (ambientExternalModules) { + for (var _a = 0, ambientExternalModules_2 = ambientExternalModules; _a < ambientExternalModules_2.length; _a++) { + var decl = ambientExternalModules_2[_a]; + if (decl.depth === 0) { + if (!ambientModuleNames) { + ambientModuleNames = []; + } + ambientModuleNames.push(decl.ref.fileName); + } + else { + importedFiles.push(decl.ref); + } + } + } + return { referencedFiles: referencedFiles, typeReferenceDirectives: typeReferenceDirectives, importedFiles: importedFiles, isLibFile: isNoDefaultLib, ambientExternalModules: ambientModuleNames }; + } } ts.preProcessFile = preProcessFile; /// Helpers function getTargetLabel(referenceNode, labelName) { while (referenceNode) { - if (referenceNode.kind === 207 /* LabeledStatement */ && referenceNode.label.text === labelName) { + if (referenceNode.kind === 214 /* LabeledStatement */ && referenceNode.label.text === labelName) { return referenceNode.label; } referenceNode = referenceNode.parent; @@ -45714,12 +51660,12 @@ var ts; } function isJumpStatementTarget(node) { return node.kind === 69 /* Identifier */ && - (node.parent.kind === 203 /* BreakStatement */ || node.parent.kind === 202 /* ContinueStatement */) && + (node.parent.kind === 210 /* BreakStatement */ || node.parent.kind === 209 /* ContinueStatement */) && node.parent.label === node; } function isLabelOfLabeledStatement(node) { return node.kind === 69 /* Identifier */ && - node.parent.kind === 207 /* LabeledStatement */ && + node.parent.kind === 214 /* LabeledStatement */ && node.parent.label === node; } /** @@ -45727,7 +51673,7 @@ var ts; * Note: 'node' cannot be a SourceFile. */ function isLabeledBy(node, labelName) { - for (var owner = node.parent; owner.kind === 207 /* LabeledStatement */; owner = owner.parent) { + for (var owner = node.parent; owner.kind === 214 /* LabeledStatement */; owner = owner.parent) { if (owner.label.text === labelName) { return true; } @@ -45738,50 +51684,74 @@ var ts; return isLabelOfLabeledStatement(node) || isJumpStatementTarget(node); } function isRightSideOfQualifiedName(node) { - return node.parent.kind === 135 /* QualifiedName */ && node.parent.right === node; + return node.parent.kind === 139 /* QualifiedName */ && node.parent.right === node; } function isRightSideOfPropertyAccess(node) { - return node && node.parent && node.parent.kind === 166 /* PropertyAccessExpression */ && node.parent.name === node; + return node && node.parent && node.parent.kind === 172 /* PropertyAccessExpression */ && node.parent.name === node; } function isCallExpressionTarget(node) { if (isRightSideOfPropertyAccess(node)) { node = node.parent; } - return node && node.parent && node.parent.kind === 168 /* CallExpression */ && node.parent.expression === node; + return node && node.parent && node.parent.kind === 174 /* CallExpression */ && node.parent.expression === node; } function isNewExpressionTarget(node) { if (isRightSideOfPropertyAccess(node)) { node = node.parent; } - return node && node.parent && node.parent.kind === 169 /* NewExpression */ && node.parent.expression === node; + return node && node.parent && node.parent.kind === 175 /* NewExpression */ && node.parent.expression === node; } function isNameOfModuleDeclaration(node) { - return node.parent.kind === 218 /* ModuleDeclaration */ && node.parent.name === node; + return node.parent.kind === 225 /* ModuleDeclaration */ && node.parent.name === node; } function isNameOfFunctionDeclaration(node) { return node.kind === 69 /* Identifier */ && ts.isFunctionLike(node.parent) && node.parent.name === node; } - /** Returns true if node is a name of an object literal property, e.g. "a" in x = { "a": 1 } */ - function isNameOfPropertyAssignment(node) { - return (node.kind === 69 /* Identifier */ || node.kind === 9 /* StringLiteral */ || node.kind === 8 /* NumericLiteral */) && - (node.parent.kind === 245 /* PropertyAssignment */ || node.parent.kind === 246 /* ShorthandPropertyAssignment */) && node.parent.name === node; + function isObjectLiteralPropertyDeclaration(node) { + switch (node.kind) { + case 253 /* PropertyAssignment */: + case 254 /* ShorthandPropertyAssignment */: + case 147 /* MethodDeclaration */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: + return true; + } + return false; + } + /** + * Returns the containing object literal property declaration given a possible name node, e.g. "a" in x = { "a": 1 } + */ + function getContainingObjectLiteralElement(node) { + switch (node.kind) { + case 9 /* StringLiteral */: + case 8 /* NumericLiteral */: + if (node.parent.kind === 140 /* ComputedPropertyName */) { + return isObjectLiteralPropertyDeclaration(node.parent.parent) ? node.parent.parent : undefined; + } + // intential fall through + case 69 /* Identifier */: + return isObjectLiteralPropertyDeclaration(node.parent) && node.parent.name === node ? node.parent : undefined; + } + return undefined; } function isLiteralNameOfPropertyDeclarationOrIndexAccess(node) { if (node.kind === 9 /* StringLiteral */ || node.kind === 8 /* NumericLiteral */) { switch (node.parent.kind) { - case 141 /* PropertyDeclaration */: - case 140 /* PropertySignature */: - case 245 /* PropertyAssignment */: - case 247 /* EnumMember */: - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: - case 218 /* ModuleDeclaration */: + case 145 /* PropertyDeclaration */: + case 144 /* PropertySignature */: + case 253 /* PropertyAssignment */: + case 255 /* EnumMember */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: + case 225 /* ModuleDeclaration */: return node.parent.name === node; - case 167 /* ElementAccessExpression */: + case 173 /* ElementAccessExpression */: return node.parent.argumentExpression === node; + case 140 /* ComputedPropertyName */: + return true; } } return false; @@ -45839,7 +51809,7 @@ var ts; })(BreakContinueSearchType || (BreakContinueSearchType = {})); // A cache of completion entries for keywords, these do not change between sessions var keywordCompletions = []; - for (var i = 70 /* FirstKeyword */; i <= 134 /* LastKeyword */; i++) { + for (var i = 70 /* FirstKeyword */; i <= 138 /* LastKeyword */; i++) { keywordCompletions.push({ name: ts.tokenToString(i), kind: ScriptElementKind.keyword, @@ -45854,17 +51824,17 @@ var ts; return undefined; } switch (node.kind) { - case 248 /* SourceFile */: - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - case 213 /* FunctionDeclaration */: - case 173 /* FunctionExpression */: - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: - case 214 /* ClassDeclaration */: - case 215 /* InterfaceDeclaration */: - case 217 /* EnumDeclaration */: - case 218 /* ModuleDeclaration */: + case 256 /* SourceFile */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: + case 220 /* FunctionDeclaration */: + case 179 /* FunctionExpression */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: + case 221 /* ClassDeclaration */: + case 222 /* InterfaceDeclaration */: + case 224 /* EnumDeclaration */: + case 225 /* ModuleDeclaration */: return node; } } @@ -45872,38 +51842,42 @@ var ts; ts.getContainerNode = getContainerNode; /* @internal */ function getNodeKind(node) { switch (node.kind) { - case 218 /* ModuleDeclaration */: return ScriptElementKind.moduleElement; - case 214 /* ClassDeclaration */: return ScriptElementKind.classElement; - case 215 /* InterfaceDeclaration */: return ScriptElementKind.interfaceElement; - case 216 /* TypeAliasDeclaration */: return ScriptElementKind.typeElement; - case 217 /* EnumDeclaration */: return ScriptElementKind.enumElement; - case 211 /* VariableDeclaration */: + case 225 /* ModuleDeclaration */: return ScriptElementKind.moduleElement; + case 221 /* ClassDeclaration */: + case 192 /* ClassExpression */: + return ScriptElementKind.classElement; + case 222 /* InterfaceDeclaration */: return ScriptElementKind.interfaceElement; + case 223 /* TypeAliasDeclaration */: return ScriptElementKind.typeElement; + case 224 /* EnumDeclaration */: return ScriptElementKind.enumElement; + case 218 /* VariableDeclaration */: return ts.isConst(node) ? ScriptElementKind.constElement : ts.isLet(node) ? ScriptElementKind.letElement : ScriptElementKind.variableElement; - case 213 /* FunctionDeclaration */: return ScriptElementKind.functionElement; - case 145 /* GetAccessor */: return ScriptElementKind.memberGetAccessorElement; - case 146 /* SetAccessor */: return ScriptElementKind.memberSetAccessorElement; - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: + case 220 /* FunctionDeclaration */: + case 179 /* FunctionExpression */: + return ScriptElementKind.functionElement; + case 149 /* GetAccessor */: return ScriptElementKind.memberGetAccessorElement; + case 150 /* SetAccessor */: return ScriptElementKind.memberSetAccessorElement; + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: return ScriptElementKind.memberFunctionElement; - case 141 /* PropertyDeclaration */: - case 140 /* PropertySignature */: + case 145 /* PropertyDeclaration */: + case 144 /* PropertySignature */: return ScriptElementKind.memberVariableElement; - case 149 /* IndexSignature */: return ScriptElementKind.indexSignatureElement; - case 148 /* ConstructSignature */: return ScriptElementKind.constructSignatureElement; - case 147 /* CallSignature */: return ScriptElementKind.callSignatureElement; - case 144 /* Constructor */: return ScriptElementKind.constructorImplementationElement; - case 137 /* TypeParameter */: return ScriptElementKind.typeParameterElement; - case 247 /* EnumMember */: return ScriptElementKind.variableElement; - case 138 /* Parameter */: return (node.flags & 56 /* AccessibilityModifier */) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; - case 221 /* ImportEqualsDeclaration */: - case 226 /* ImportSpecifier */: - case 223 /* ImportClause */: - case 230 /* ExportSpecifier */: - case 224 /* NamespaceImport */: + case 153 /* IndexSignature */: return ScriptElementKind.indexSignatureElement; + case 152 /* ConstructSignature */: return ScriptElementKind.constructSignatureElement; + case 151 /* CallSignature */: return ScriptElementKind.callSignatureElement; + case 148 /* Constructor */: return ScriptElementKind.constructorImplementationElement; + case 141 /* TypeParameter */: return ScriptElementKind.typeParameterElement; + case 255 /* EnumMember */: return ScriptElementKind.variableElement; + case 142 /* Parameter */: return (node.flags & 92 /* ParameterPropertyModifier */) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; + case 229 /* ImportEqualsDeclaration */: + case 234 /* ImportSpecifier */: + case 231 /* ImportClause */: + case 238 /* ExportSpecifier */: + case 232 /* NamespaceImport */: return ScriptElementKind.alias; } return ScriptElementKind.unknown; @@ -45922,7 +51896,7 @@ var ts; } }; return CancellationTokenObject; - })(); + }()); function createLanguageService(host, documentRegistry) { if (documentRegistry === void 0) { documentRegistry = createDocumentRegistry(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames(), host.getCurrentDirectory()); } var syntaxTreeCache = new SyntaxTreeCache(host); @@ -45941,7 +51915,7 @@ var ts; host.log(message); } } - var getCanonicalFileName = createGetCanonicalFileName(useCaseSensitivefileNames); + var getCanonicalFileName = ts.createGetCanonicalFileName(useCaseSensitivefileNames); function getValidSourceFile(fileName) { var sourceFile = program.getSourceFile(fileName); if (!sourceFile) { @@ -45985,10 +51959,12 @@ var ts; (oldSettings.target !== newSettings.target || oldSettings.module !== newSettings.module || oldSettings.noResolve !== newSettings.noResolve || - oldSettings.jsx !== newSettings.jsx); + oldSettings.jsx !== newSettings.jsx || + oldSettings.allowJs !== newSettings.allowJs); // Now create a new compiler var compilerHost = { getSourceFile: getOrCreateSourceFile, + getSourceFileByPath: getOrCreateSourceFileByPath, getCancellationToken: function () { return cancellationToken; }, getCanonicalFileName: getCanonicalFileName, useCaseSensitiveFileNames: function () { return useCaseSensitivefileNames; }, @@ -45998,27 +51974,41 @@ var ts; getCurrentDirectory: function () { return currentDirectory; }, fileExists: function (fileName) { // stub missing host functionality - ts.Debug.assert(!host.resolveModuleNames); + ts.Debug.assert(!host.resolveModuleNames || !host.resolveTypeReferenceDirectives); return hostCache.getOrCreateEntry(fileName) !== undefined; }, readFile: function (fileName) { // stub missing host functionality var entry = hostCache.getOrCreateEntry(fileName); return entry && entry.scriptSnapshot.getText(0, entry.scriptSnapshot.getLength()); + }, + directoryExists: function (directoryName) { + ts.Debug.assert(!host.resolveModuleNames || !host.resolveTypeReferenceDirectives); + return ts.directoryProbablyExists(directoryName, host); } }; + if (host.trace) { + compilerHost.trace = function (message) { return host.trace(message); }; + } if (host.resolveModuleNames) { compilerHost.resolveModuleNames = function (moduleNames, containingFile) { return host.resolveModuleNames(moduleNames, containingFile); }; } + if (host.resolveTypeReferenceDirectives) { + compilerHost.resolveTypeReferenceDirectives = function (typeReferenceDirectiveNames, containingFile) { + return host.resolveTypeReferenceDirectives(typeReferenceDirectiveNames, containingFile); + }; + } + var documentRegistryBucketKey = documentRegistry.getKeyForCompilationSettings(newSettings); var newProgram = ts.createProgram(hostCache.getRootFileNames(), newSettings, compilerHost, program); // Release any files we have acquired in the old program but are // not part of the new program. if (program) { var oldSourceFiles = program.getSourceFiles(); + var oldSettingsKey = documentRegistry.getKeyForCompilationSettings(oldSettings); for (var _i = 0, oldSourceFiles_1 = oldSourceFiles; _i < oldSourceFiles_1.length; _i++) { var oldSourceFile = oldSourceFiles_1[_i]; if (!newProgram.getSourceFile(oldSourceFile.fileName) || changesInCompilationSettingsAffectSyntax) { - documentRegistry.releaseDocument(oldSourceFile.fileName, oldSettings); + documentRegistry.releaseDocumentWithKey(oldSourceFile.path, oldSettingsKey); } } } @@ -46031,24 +52021,27 @@ var ts; program.getTypeChecker(); return; function getOrCreateSourceFile(fileName) { + return getOrCreateSourceFileByPath(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName)); + } + function getOrCreateSourceFileByPath(fileName, path) { ts.Debug.assert(hostCache !== undefined); // The program is asking for this file, check first if the host can locate it. // If the host can not locate the file, then it does not exist. return undefined // to the program to allow reporting of errors for missing files. - var hostFileInformation = hostCache.getOrCreateEntry(fileName); + var hostFileInformation = hostCache.getOrCreateEntryByPath(fileName, path); if (!hostFileInformation) { return undefined; } // Check if the language version has changed since we last created a program; if they are the same, - // it is safe to reuse the souceFiles; if not, then the shape of the AST can change, and the oldSourceFile + // it is safe to reuse the sourceFiles; if not, then the shape of the AST can change, and the oldSourceFile // can not be reused. we have to dump all syntax trees and create new ones. if (!changesInCompilationSettingsAffectSyntax) { // Check if the old program had this file already - var oldSourceFile = program && program.getSourceFile(fileName); + var oldSourceFile = program && program.getSourceFileByPath(path); if (oldSourceFile) { // We already had a source file for this file name. Go to the registry to // ensure that we get the right up to date version of it. We need this to - // address the following 'race'. Specifically, say we have the following: + // address the following race-condition. Specifically, say we have the following: // // LS1 // \ @@ -46067,15 +52060,22 @@ var ts; // it's source file any more, and instead defers to DocumentRegistry to get // either version 1, version 2 (or some other version) depending on what the // host says should be used. - return documentRegistry.updateDocument(fileName, newSettings, hostFileInformation.scriptSnapshot, hostFileInformation.version); + // We do not support the scenario where a host can modify a registered + // file's script kind, i.e. in one project some file is treated as ".ts" + // and in another as ".js" + ts.Debug.assert(hostFileInformation.scriptKind === oldSourceFile.scriptKind, "Registered script kind (" + oldSourceFile.scriptKind + ") should match new script kind (" + hostFileInformation.scriptKind + ") for file: " + path); + return documentRegistry.updateDocumentWithKey(fileName, path, newSettings, documentRegistryBucketKey, hostFileInformation.scriptSnapshot, hostFileInformation.version, hostFileInformation.scriptKind); } } // Could not find this file in the old program, create a new SourceFile for it. - return documentRegistry.acquireDocument(fileName, newSettings, hostFileInformation.scriptSnapshot, hostFileInformation.version); + return documentRegistry.acquireDocumentWithKey(fileName, path, newSettings, documentRegistryBucketKey, hostFileInformation.scriptSnapshot, hostFileInformation.version, hostFileInformation.scriptKind); } function sourceFileUpToDate(sourceFile) { + if (!sourceFile) { + return false; + } var path = sourceFile.path || ts.toPath(sourceFile.fileName, currentDirectory, getCanonicalFileName); - return sourceFile && sourceFile.version === hostCache.getVersion(path); + return sourceFile.version === hostCache.getVersion(path); } function programUpToDate() { // If we haven't create a program yet, then it is not up-to-date @@ -46118,18 +52118,12 @@ var ts; return program.getSyntacticDiagnostics(getValidSourceFile(fileName), cancellationToken); } /** - * getSemanticDiagnostiscs return array of Diagnostics. If '-d' is not enabled, only report semantic errors + * getSemanticDiagnostics return array of Diagnostics. If '-d' is not enabled, only report semantic errors * If '-d' enabled, report both semantic and emitter errors */ function getSemanticDiagnostics(fileName) { synchronizeHostData(); var targetSourceFile = getValidSourceFile(fileName); - // For JavaScript files, we don't want to report the normal typescript semantic errors. - // Instead, we just report errors for using TypeScript-only constructs from within a - // JavaScript file. - if (ts.isSourceFileJavaScript(targetSourceFile)) { - return getJavaScriptSemanticDiagnostics(targetSourceFile); - } // Only perform the action per file regardless of '-out' flag as LanguageServiceHost is expected to call this function per file. // Therefore only get diagnostics for given file. var semanticDiagnostics = program.getSemanticDiagnostics(targetSourceFile, cancellationToken); @@ -46140,151 +52134,6 @@ var ts; var declarationDiagnostics = program.getDeclarationDiagnostics(targetSourceFile, cancellationToken); return ts.concatenate(semanticDiagnostics, declarationDiagnostics); } - function getJavaScriptSemanticDiagnostics(sourceFile) { - var diagnostics = []; - walk(sourceFile); - return diagnostics; - function walk(node) { - if (!node) { - return false; - } - switch (node.kind) { - case 221 /* ImportEqualsDeclaration */: - diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_a_ts_file)); - return true; - case 227 /* ExportAssignment */: - diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.export_can_only_be_used_in_a_ts_file)); - return true; - case 214 /* ClassDeclaration */: - var classDeclaration = node; - if (checkModifiers(classDeclaration.modifiers) || - checkTypeParameters(classDeclaration.typeParameters)) { - return true; - } - break; - case 243 /* HeritageClause */: - var heritageClause = node; - if (heritageClause.token === 106 /* ImplementsKeyword */) { - diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_a_ts_file)); - return true; - } - break; - case 215 /* InterfaceDeclaration */: - diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.interface_declarations_can_only_be_used_in_a_ts_file)); - return true; - case 218 /* ModuleDeclaration */: - diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.module_declarations_can_only_be_used_in_a_ts_file)); - return true; - case 216 /* TypeAliasDeclaration */: - diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.type_aliases_can_only_be_used_in_a_ts_file)); - return true; - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - case 144 /* Constructor */: - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: - case 173 /* FunctionExpression */: - case 213 /* FunctionDeclaration */: - case 174 /* ArrowFunction */: - case 213 /* FunctionDeclaration */: - var functionDeclaration = node; - if (checkModifiers(functionDeclaration.modifiers) || - checkTypeParameters(functionDeclaration.typeParameters) || - checkTypeAnnotation(functionDeclaration.type)) { - return true; - } - break; - case 193 /* VariableStatement */: - var variableStatement = node; - if (checkModifiers(variableStatement.modifiers)) { - return true; - } - break; - case 211 /* VariableDeclaration */: - var variableDeclaration = node; - if (checkTypeAnnotation(variableDeclaration.type)) { - return true; - } - break; - case 168 /* CallExpression */: - case 169 /* NewExpression */: - var expression = node; - if (expression.typeArguments && expression.typeArguments.length > 0) { - var start = expression.typeArguments.pos; - diagnostics.push(ts.createFileDiagnostic(sourceFile, start, expression.typeArguments.end - start, ts.Diagnostics.type_arguments_can_only_be_used_in_a_ts_file)); - return true; - } - break; - case 138 /* Parameter */: - var parameter = node; - if (parameter.modifiers) { - var start = parameter.modifiers.pos; - diagnostics.push(ts.createFileDiagnostic(sourceFile, start, parameter.modifiers.end - start, ts.Diagnostics.parameter_modifiers_can_only_be_used_in_a_ts_file)); - return true; - } - if (parameter.questionToken) { - diagnostics.push(ts.createDiagnosticForNode(parameter.questionToken, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, '?')); - return true; - } - if (parameter.type) { - diagnostics.push(ts.createDiagnosticForNode(parameter.type, ts.Diagnostics.types_can_only_be_used_in_a_ts_file)); - return true; - } - break; - case 141 /* PropertyDeclaration */: - diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.property_declarations_can_only_be_used_in_a_ts_file)); - return true; - case 217 /* EnumDeclaration */: - diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.enum_declarations_can_only_be_used_in_a_ts_file)); - return true; - case 171 /* TypeAssertionExpression */: - var typeAssertionExpression = node; - diagnostics.push(ts.createDiagnosticForNode(typeAssertionExpression.type, ts.Diagnostics.type_assertion_expressions_can_only_be_used_in_a_ts_file)); - return true; - case 139 /* Decorator */: - diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.decorators_can_only_be_used_in_a_ts_file)); - return true; - } - return ts.forEachChild(node, walk); - } - function checkTypeParameters(typeParameters) { - if (typeParameters) { - var start = typeParameters.pos; - diagnostics.push(ts.createFileDiagnostic(sourceFile, start, typeParameters.end - start, ts.Diagnostics.type_parameter_declarations_can_only_be_used_in_a_ts_file)); - return true; - } - return false; - } - function checkTypeAnnotation(type) { - if (type) { - diagnostics.push(ts.createDiagnosticForNode(type, ts.Diagnostics.types_can_only_be_used_in_a_ts_file)); - return true; - } - return false; - } - function checkModifiers(modifiers) { - if (modifiers) { - for (var _i = 0, modifiers_1 = modifiers; _i < modifiers_1.length; _i++) { - var modifier = modifiers_1[_i]; - switch (modifier.kind) { - case 112 /* PublicKeyword */: - case 110 /* PrivateKeyword */: - case 111 /* ProtectedKeyword */: - case 122 /* DeclareKeyword */: - diagnostics.push(ts.createDiagnosticForNode(modifier, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, ts.tokenToString(modifier.kind))); - return true; - // These are all legal modifiers. - case 113 /* StaticKeyword */: - case 82 /* ExportKeyword */: - case 74 /* ConstKeyword */: - case 77 /* DefaultKeyword */: - case 115 /* AbstractKeyword */: - } - } - } - return false; - } - } function getCompilerOptionsDiagnostics() { synchronizeHostData(); return program.getOptionsDiagnostics(cancellationToken).concat(program.getGlobalDiagnostics(cancellationToken)); @@ -46301,7 +52150,7 @@ var ts; // First check of the displayName is not external module; if it is an external module, it is not valid entry if ((symbol.flags & 1536 /* Namespace */) && (firstCharCode === 39 /* singleQuote */ || firstCharCode === 34 /* doubleQuote */)) { // If the symbol is external module, don't show it in the completion list - // (i.e declare module "http" { let x; } | // <= request completion here, "http" should not be there) + // (i.e declare module "http" { const x; } | // <= request completion here, "http" should not be there) return undefined; } } @@ -46324,20 +52173,14 @@ var ts; // e.g "b a" is valid quoted name but when we strip off the quotes, it is invalid. // We, thus, need to check if whatever was inside the quotes is actually a valid identifier name. if (performCharacterChecks) { - if (!ts.isIdentifierStart(name.charCodeAt(0), target)) { + if (!ts.isIdentifier(name, target)) { return undefined; } - for (var i = 1, n = name.length; i < n; i++) { - if (!ts.isIdentifierPart(name.charCodeAt(i), target)) { - return undefined; - } - } } return name; } function getCompletionData(fileName, position) { var typeChecker = program.getTypeChecker(); - var syntacticStart = new Date().getTime(); var sourceFile = getValidSourceFile(fileName); var isJavaScriptFile = ts.isSourceFileJavaScript(sourceFile); var isJsDocTagName = false; @@ -46349,7 +52192,7 @@ var ts; var insideComment = isInsideComment(sourceFile, currentToken, position); log("getCompletionData: Is inside comment: " + (new Date().getTime() - start)); if (insideComment) { - // The current position is next to the '@' sign, when no tag name being provided yet. + // The current position is next to the '@' sign, when no tag name being provided yet. // Provide a full list of tag names if (ts.hasDocComment(sourceFile, position) && sourceFile.text.charCodeAt(position - 1) === 64 /* at */) { isJsDocTagName = true; @@ -46364,9 +52207,9 @@ var ts; isJsDocTagName = true; } switch (tag.kind) { - case 269 /* JSDocTypeTag */: - case 267 /* JSDocParameterTag */: - case 268 /* JSDocReturnTag */: + case 277 /* JSDocTypeTag */: + case 275 /* JSDocParameterTag */: + case 276 /* JSDocReturnTag */: var tagWithExpression = tag; if (tagWithExpression.typeExpression) { insideJsDocTagExpression = tagWithExpression.typeExpression.pos < position && position < tagWithExpression.typeExpression.end; @@ -46378,7 +52221,7 @@ var ts; return { symbols: undefined, isMemberCompletion: false, isNewIdentifierLocation: false, location: undefined, isRightOfDot: false, isJsDocTagName: isJsDocTagName }; } if (!insideJsDocTagExpression) { - // Proceed if the current position is in jsDoc tag expression; otherwise it is a normal + // Proceed if the current position is in jsDoc tag expression; otherwise it is a normal // comment or the plain text part of a jsDoc comment, so no completion should be available log("Returning an empty list because completion was inside a regular comment or plain text part of a JsDoc comment."); return undefined; @@ -46393,9 +52236,9 @@ var ts; // Check if the caret is at the end of an identifier; this is a partial identifier that we want to complete: e.g. a.toS| // Skip this partial identifier and adjust the contextToken to the token that precedes it. if (contextToken && position <= contextToken.end && ts.isWord(contextToken.kind)) { - var start_3 = new Date().getTime(); + var start_6 = new Date().getTime(); contextToken = ts.findPrecedingToken(contextToken.getFullStart(), sourceFile); - log("getCompletionData: Get previous token 2: " + (new Date().getTime() - start_3)); + log("getCompletionData: Get previous token 2: " + (new Date().getTime() - start_6)); } // Find the node where completion is requested on. // Also determine whether we are trying to complete with members of that node @@ -46411,13 +52254,13 @@ var ts; log("Returning an empty list because completion was requested in an invalid position."); return undefined; } - var parent_9 = contextToken.parent, kind = contextToken.kind; + var parent_16 = contextToken.parent, kind = contextToken.kind; if (kind === 21 /* DotToken */) { - if (parent_9.kind === 166 /* PropertyAccessExpression */) { + if (parent_16.kind === 172 /* PropertyAccessExpression */) { node = contextToken.parent.expression; isRightOfDot = true; } - else if (parent_9.kind === 135 /* QualifiedName */) { + else if (parent_16.kind === 139 /* QualifiedName */) { node = contextToken.parent.left; isRightOfDot = true; } @@ -46432,8 +52275,9 @@ var ts; isRightOfOpenTag = true; location = contextToken; } - else if (kind === 39 /* SlashToken */ && contextToken.parent.kind === 237 /* JsxClosingElement */) { + else if (kind === 39 /* SlashToken */ && contextToken.parent.kind === 245 /* JsxClosingElement */) { isStartingCloseTag = true; + location = contextToken; } } } @@ -46447,7 +52291,7 @@ var ts; else if (isRightOfOpenTag) { var tagSymbols = typeChecker.getJsxIntrinsicTagNames(); if (tryGetGlobalSymbols()) { - symbols = tagSymbols.concat(symbols.filter(function (s) { return !!(s.flags & 107455 /* Value */); })); + symbols = tagSymbols.concat(symbols.filter(function (s) { return !!(s.flags & (107455 /* Value */ | 8388608 /* Alias */)); })); } else { symbols = tagSymbols; @@ -46457,7 +52301,10 @@ var ts; } else if (isStartingCloseTag) { var tagName = contextToken.parent.parent.openingElement.tagName; - symbols = [typeChecker.getSymbolAtLocation(tagName)]; + var tagSymbol = typeChecker.getSymbolAtLocation(tagName); + if (!typeChecker.isUnknownSymbol(tagSymbol)) { + symbols = [tagSymbol]; + } isMemberCompletion = true; isNewIdentifierLocation = false; } @@ -46475,7 +52322,7 @@ var ts; // Right of dot member completion list isMemberCompletion = true; isNewIdentifierLocation = false; - if (node.kind === 69 /* Identifier */ || node.kind === 135 /* QualifiedName */ || node.kind === 166 /* PropertyAccessExpression */) { + if (node.kind === 69 /* Identifier */ || node.kind === 139 /* QualifiedName */ || node.kind === 172 /* PropertyAccessExpression */) { var symbol = typeChecker.getSymbolAtLocation(node); // This is an alias, follow what it aliases if (symbol && symbol.flags & 8388608 /* Alias */) { @@ -46530,8 +52377,8 @@ var ts; return tryGetImportOrExportClauseCompletionSymbols(namedImportsOrExports); } if (jsxContainer = tryGetContainingJsxElement(contextToken)) { - var attrsType; - if ((jsxContainer.kind === 234 /* JsxSelfClosingElement */) || (jsxContainer.kind === 235 /* JsxOpeningElement */)) { + var attrsType = void 0; + if ((jsxContainer.kind === 242 /* JsxSelfClosingElement */) || (jsxContainer.kind === 243 /* JsxOpeningElement */)) { // Cursor is inside a JSX self-closing element or opening element attrsType = typeChecker.getJsxElementAttributesType(jsxContainer); if (attrsType) { @@ -46603,15 +52450,15 @@ var ts; return result; } function isInJsxText(contextToken) { - if (contextToken.kind === 236 /* JsxText */) { + if (contextToken.kind === 244 /* JsxText */) { return true; } if (contextToken.kind === 27 /* GreaterThanToken */ && contextToken.parent) { - if (contextToken.parent.kind === 235 /* JsxOpeningElement */) { + if (contextToken.parent.kind === 243 /* JsxOpeningElement */) { return true; } - if (contextToken.parent.kind === 237 /* JsxClosingElement */ || contextToken.parent.kind === 234 /* JsxSelfClosingElement */) { - return contextToken.parent.parent && contextToken.parent.parent.kind === 233 /* JsxElement */; + if (contextToken.parent.kind === 245 /* JsxClosingElement */ || contextToken.parent.kind === 242 /* JsxSelfClosingElement */) { + return contextToken.parent.parent && contextToken.parent.parent.kind === 241 /* JsxElement */; } } return false; @@ -46621,40 +52468,40 @@ var ts; var containingNodeKind = previousToken.parent.kind; switch (previousToken.kind) { case 24 /* CommaToken */: - return containingNodeKind === 168 /* CallExpression */ // func( a, | - || containingNodeKind === 144 /* Constructor */ // constructor( a, | /* public, protected, private keywords are allowed here, so show completion */ - || containingNodeKind === 169 /* NewExpression */ // new C(a, | - || containingNodeKind === 164 /* ArrayLiteralExpression */ // [a, | - || containingNodeKind === 181 /* BinaryExpression */ // let x = (a, | - || containingNodeKind === 152 /* FunctionType */; // var x: (s: string, list| + return containingNodeKind === 174 /* CallExpression */ // func( a, | + || containingNodeKind === 148 /* Constructor */ // constructor( a, | /* public, protected, private keywords are allowed here, so show completion */ + || containingNodeKind === 175 /* NewExpression */ // new C(a, | + || containingNodeKind === 170 /* ArrayLiteralExpression */ // [a, | + || containingNodeKind === 187 /* BinaryExpression */ // const x = (a, | + || containingNodeKind === 156 /* FunctionType */; // var x: (s: string, list| case 17 /* OpenParenToken */: - return containingNodeKind === 168 /* CallExpression */ // func( | - || containingNodeKind === 144 /* Constructor */ // constructor( | - || containingNodeKind === 169 /* NewExpression */ // new C(a| - || containingNodeKind === 172 /* ParenthesizedExpression */ // let x = (a| - || containingNodeKind === 160 /* ParenthesizedType */; // function F(pred: (a| /* this can become an arrow function, where 'a' is the argument */ + return containingNodeKind === 174 /* CallExpression */ // func( | + || containingNodeKind === 148 /* Constructor */ // constructor( | + || containingNodeKind === 175 /* NewExpression */ // new C(a| + || containingNodeKind === 178 /* ParenthesizedExpression */ // const x = (a| + || containingNodeKind === 164 /* ParenthesizedType */; // function F(pred: (a| /* this can become an arrow function, where 'a' is the argument */ case 19 /* OpenBracketToken */: - return containingNodeKind === 164 /* ArrayLiteralExpression */ // [ | - || containingNodeKind === 149 /* IndexSignature */ // [ | : string ] - || containingNodeKind === 136 /* ComputedPropertyName */; // [ | /* this can become an index signature */ + return containingNodeKind === 170 /* ArrayLiteralExpression */ // [ | + || containingNodeKind === 153 /* IndexSignature */ // [ | : string ] + || containingNodeKind === 140 /* ComputedPropertyName */; // [ | /* this can become an index signature */ case 125 /* ModuleKeyword */: // module | case 126 /* NamespaceKeyword */: return true; case 21 /* DotToken */: - return containingNodeKind === 218 /* ModuleDeclaration */; // module A.| + return containingNodeKind === 225 /* ModuleDeclaration */; // module A.| case 15 /* OpenBraceToken */: - return containingNodeKind === 214 /* ClassDeclaration */; // class A{ | + return containingNodeKind === 221 /* ClassDeclaration */; // class A{ | case 56 /* EqualsToken */: - return containingNodeKind === 211 /* VariableDeclaration */ // let x = a| - || containingNodeKind === 181 /* BinaryExpression */; // x = a| + return containingNodeKind === 218 /* VariableDeclaration */ // const x = a| + || containingNodeKind === 187 /* BinaryExpression */; // x = a| case 12 /* TemplateHead */: - return containingNodeKind === 183 /* TemplateExpression */; // `aa ${| + return containingNodeKind === 189 /* TemplateExpression */; // `aa ${| case 13 /* TemplateMiddle */: - return containingNodeKind === 190 /* TemplateSpan */; // `aa ${10} dd ${| + return containingNodeKind === 197 /* TemplateSpan */; // `aa ${10} dd ${| case 112 /* PublicKeyword */: case 110 /* PrivateKeyword */: case 111 /* ProtectedKeyword */: - return containingNodeKind === 141 /* PropertyDeclaration */; // class A{ public | + return containingNodeKind === 145 /* PropertyDeclaration */; // class A{ public | } // Previous token may have been a keyword that was converted to an identifier. switch (previousToken.getText()) { @@ -46668,15 +52515,16 @@ var ts; } function isInStringOrRegularExpressionOrTemplateLiteral(contextToken) { if (contextToken.kind === 9 /* StringLiteral */ + || contextToken.kind === 166 /* StringLiteralType */ || contextToken.kind === 10 /* RegularExpressionLiteral */ || ts.isTemplateLiteralKind(contextToken.kind)) { - var start_4 = contextToken.getStart(); + var start_7 = contextToken.getStart(); var end = contextToken.getEnd(); // To be "in" one of these literals, the position has to be: // 1. entirely within the token text. // 2. at the end position of an unterminated token. // 3. at the end of a regular expression (due to trailing flags like '/foo/g'). - if (start_4 < position && position < end) { + if (start_7 < position && position < end) { return true; } if (position === end) { @@ -46697,14 +52545,14 @@ var ts; isMemberCompletion = true; var typeForObject; var existingMembers; - if (objectLikeContainer.kind === 165 /* ObjectLiteralExpression */) { + if (objectLikeContainer.kind === 171 /* ObjectLiteralExpression */) { // We are completing on contextual types, but may also include properties // other than those within the declared type. isNewIdentifierLocation = true; typeForObject = typeChecker.getContextualType(objectLikeContainer); existingMembers = objectLikeContainer.properties; } - else if (objectLikeContainer.kind === 161 /* ObjectBindingPattern */) { + else if (objectLikeContainer.kind === 167 /* ObjectBindingPattern */) { // We are *only* completing on properties from the type being destructured. isNewIdentifierLocation = false; var rootDeclaration = ts.getRootDeclaration(objectLikeContainer.parent); @@ -46712,7 +52560,18 @@ var ts; // We don't want to complete using the type acquired by the shape // of the binding pattern; we are only interested in types acquired // through type declaration or inference. - if (rootDeclaration.initializer || rootDeclaration.type) { + // Also proceed if rootDeclaration is parameter and if its containing function expression\arrow function is contextually typed - + // type of parameter will flow in from the contextual type of the function + var canGetType = !!(rootDeclaration.initializer || rootDeclaration.type); + if (!canGetType && rootDeclaration.kind === 142 /* Parameter */) { + if (ts.isExpression(rootDeclaration.parent)) { + canGetType = !!typeChecker.getContextualType(rootDeclaration.parent); + } + else if (rootDeclaration.parent.kind === 147 /* MethodDeclaration */ || rootDeclaration.parent.kind === 150 /* SetAccessor */) { + canGetType = ts.isExpression(rootDeclaration.parent.parent) && !!typeChecker.getContextualType(rootDeclaration.parent.parent); + } + } + if (canGetType) { typeForObject = typeChecker.getTypeAtLocation(objectLikeContainer); existingMembers = objectLikeContainer.elements; } @@ -46750,9 +52609,9 @@ var ts; * @returns true if 'symbols' was successfully populated; false otherwise. */ function tryGetImportOrExportClauseCompletionSymbols(namedImportsOrExports) { - var declarationKind = namedImportsOrExports.kind === 225 /* NamedImports */ ? - 222 /* ImportDeclaration */ : - 228 /* ExportDeclaration */; + var declarationKind = namedImportsOrExports.kind === 233 /* NamedImports */ ? + 230 /* ImportDeclaration */ : + 236 /* ExportDeclaration */; var importOrExportDeclaration = ts.getAncestor(namedImportsOrExports, declarationKind); var moduleSpecifier = importOrExportDeclaration.moduleSpecifier; if (!moduleSpecifier) { @@ -46775,11 +52634,11 @@ var ts; function tryGetObjectLikeCompletionContainer(contextToken) { if (contextToken) { switch (contextToken.kind) { - case 15 /* OpenBraceToken */: // let x = { | + case 15 /* OpenBraceToken */: // const x = { | case 24 /* CommaToken */: - var parent_10 = contextToken.parent; - if (parent_10 && (parent_10.kind === 165 /* ObjectLiteralExpression */ || parent_10.kind === 161 /* ObjectBindingPattern */)) { - return parent_10; + var parent_17 = contextToken.parent; + if (parent_17 && (parent_17.kind === 171 /* ObjectLiteralExpression */ || parent_17.kind === 167 /* ObjectBindingPattern */)) { + return parent_17; } break; } @@ -46796,8 +52655,8 @@ var ts; case 15 /* OpenBraceToken */: // import { | case 24 /* CommaToken */: switch (contextToken.parent.kind) { - case 225 /* NamedImports */: - case 229 /* NamedExports */: + case 233 /* NamedImports */: + case 237 /* NamedExports */: return contextToken.parent; } } @@ -46806,37 +52665,37 @@ var ts; } function tryGetContainingJsxElement(contextToken) { if (contextToken) { - var parent_11 = contextToken.parent; + var parent_18 = contextToken.parent; switch (contextToken.kind) { case 26 /* LessThanSlashToken */: case 39 /* SlashToken */: case 69 /* Identifier */: - case 238 /* JsxAttribute */: - case 239 /* JsxSpreadAttribute */: - if (parent_11 && (parent_11.kind === 234 /* JsxSelfClosingElement */ || parent_11.kind === 235 /* JsxOpeningElement */)) { - return parent_11; + case 246 /* JsxAttribute */: + case 247 /* JsxSpreadAttribute */: + if (parent_18 && (parent_18.kind === 242 /* JsxSelfClosingElement */ || parent_18.kind === 243 /* JsxOpeningElement */)) { + return parent_18; } - else if (parent_11.kind === 238 /* JsxAttribute */) { - return parent_11.parent; + else if (parent_18.kind === 246 /* JsxAttribute */) { + return parent_18.parent; } break; // The context token is the closing } or " of an attribute, which means // its parent is a JsxExpression, whose parent is a JsxAttribute, // whose parent is a JsxOpeningLikeElement case 9 /* StringLiteral */: - if (parent_11 && ((parent_11.kind === 238 /* JsxAttribute */) || (parent_11.kind === 239 /* JsxSpreadAttribute */))) { - return parent_11.parent; + if (parent_18 && ((parent_18.kind === 246 /* JsxAttribute */) || (parent_18.kind === 247 /* JsxSpreadAttribute */))) { + return parent_18.parent; } break; case 16 /* CloseBraceToken */: - if (parent_11 && - parent_11.kind === 240 /* JsxExpression */ && - parent_11.parent && - (parent_11.parent.kind === 238 /* JsxAttribute */)) { - return parent_11.parent.parent; + if (parent_18 && + parent_18.kind === 248 /* JsxExpression */ && + parent_18.parent && + (parent_18.parent.kind === 246 /* JsxAttribute */)) { + return parent_18.parent.parent; } - if (parent_11 && parent_11.kind === 239 /* JsxSpreadAttribute */) { - return parent_11.parent; + if (parent_18 && parent_18.kind === 247 /* JsxSpreadAttribute */) { + return parent_18.parent; } break; } @@ -46845,16 +52704,16 @@ var ts; } function isFunction(kind) { switch (kind) { - case 173 /* FunctionExpression */: - case 174 /* ArrowFunction */: - case 213 /* FunctionDeclaration */: - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: - case 147 /* CallSignature */: - case 148 /* ConstructSignature */: - case 149 /* IndexSignature */: + case 179 /* FunctionExpression */: + case 180 /* ArrowFunction */: + case 220 /* FunctionDeclaration */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: + case 151 /* CallSignature */: + case 152 /* ConstructSignature */: + case 153 /* IndexSignature */: return true; } return false; @@ -46866,66 +52725,66 @@ var ts; var containingNodeKind = contextToken.parent.kind; switch (contextToken.kind) { case 24 /* CommaToken */: - return containingNodeKind === 211 /* VariableDeclaration */ || - containingNodeKind === 212 /* VariableDeclarationList */ || - containingNodeKind === 193 /* VariableStatement */ || - containingNodeKind === 217 /* EnumDeclaration */ || + return containingNodeKind === 218 /* VariableDeclaration */ || + containingNodeKind === 219 /* VariableDeclarationList */ || + containingNodeKind === 200 /* VariableStatement */ || + containingNodeKind === 224 /* EnumDeclaration */ || isFunction(containingNodeKind) || - containingNodeKind === 214 /* ClassDeclaration */ || - containingNodeKind === 186 /* ClassExpression */ || - containingNodeKind === 215 /* InterfaceDeclaration */ || - containingNodeKind === 162 /* ArrayBindingPattern */ || - containingNodeKind === 216 /* TypeAliasDeclaration */; // type Map, K, | + containingNodeKind === 221 /* ClassDeclaration */ || + containingNodeKind === 192 /* ClassExpression */ || + containingNodeKind === 222 /* InterfaceDeclaration */ || + containingNodeKind === 168 /* ArrayBindingPattern */ || + containingNodeKind === 223 /* TypeAliasDeclaration */; // type Map, K, | case 21 /* DotToken */: - return containingNodeKind === 162 /* ArrayBindingPattern */; // var [.| + return containingNodeKind === 168 /* ArrayBindingPattern */; // var [.| case 54 /* ColonToken */: - return containingNodeKind === 163 /* BindingElement */; // var {x :html| + return containingNodeKind === 169 /* BindingElement */; // var {x :html| case 19 /* OpenBracketToken */: - return containingNodeKind === 162 /* ArrayBindingPattern */; // var [x| + return containingNodeKind === 168 /* ArrayBindingPattern */; // var [x| case 17 /* OpenParenToken */: - return containingNodeKind === 244 /* CatchClause */ || + return containingNodeKind === 252 /* CatchClause */ || isFunction(containingNodeKind); case 15 /* OpenBraceToken */: - return containingNodeKind === 217 /* EnumDeclaration */ || - containingNodeKind === 215 /* InterfaceDeclaration */ || - containingNodeKind === 155 /* TypeLiteral */; // let x : { | + return containingNodeKind === 224 /* EnumDeclaration */ || + containingNodeKind === 222 /* InterfaceDeclaration */ || + containingNodeKind === 159 /* TypeLiteral */; // const x : { | case 23 /* SemicolonToken */: - return containingNodeKind === 140 /* PropertySignature */ && + return containingNodeKind === 144 /* PropertySignature */ && contextToken.parent && contextToken.parent.parent && - (contextToken.parent.parent.kind === 215 /* InterfaceDeclaration */ || - contextToken.parent.parent.kind === 155 /* TypeLiteral */); // let x : { a; | + (contextToken.parent.parent.kind === 222 /* InterfaceDeclaration */ || + contextToken.parent.parent.kind === 159 /* TypeLiteral */); // const x : { a; | case 25 /* LessThanToken */: - return containingNodeKind === 214 /* ClassDeclaration */ || - containingNodeKind === 186 /* ClassExpression */ || - containingNodeKind === 215 /* InterfaceDeclaration */ || - containingNodeKind === 216 /* TypeAliasDeclaration */ || + return containingNodeKind === 221 /* ClassDeclaration */ || + containingNodeKind === 192 /* ClassExpression */ || + containingNodeKind === 222 /* InterfaceDeclaration */ || + containingNodeKind === 223 /* TypeAliasDeclaration */ || isFunction(containingNodeKind); case 113 /* StaticKeyword */: - return containingNodeKind === 141 /* PropertyDeclaration */; + return containingNodeKind === 145 /* PropertyDeclaration */; case 22 /* DotDotDotToken */: - return containingNodeKind === 138 /* Parameter */ || + return containingNodeKind === 142 /* Parameter */ || (contextToken.parent && contextToken.parent.parent && - contextToken.parent.parent.kind === 162 /* ArrayBindingPattern */); // var [...z| + contextToken.parent.parent.kind === 168 /* ArrayBindingPattern */); // var [...z| case 112 /* PublicKeyword */: case 110 /* PrivateKeyword */: case 111 /* ProtectedKeyword */: - return containingNodeKind === 138 /* Parameter */; + return containingNodeKind === 142 /* Parameter */; case 116 /* AsKeyword */: - return containingNodeKind === 226 /* ImportSpecifier */ || - containingNodeKind === 230 /* ExportSpecifier */ || - containingNodeKind === 224 /* NamespaceImport */; + return containingNodeKind === 234 /* ImportSpecifier */ || + containingNodeKind === 238 /* ExportSpecifier */ || + containingNodeKind === 232 /* NamespaceImport */; case 73 /* ClassKeyword */: case 81 /* EnumKeyword */: case 107 /* InterfaceKeyword */: case 87 /* FunctionKeyword */: case 102 /* VarKeyword */: case 123 /* GetKeyword */: - case 129 /* SetKeyword */: + case 131 /* SetKeyword */: case 89 /* ImportKeyword */: case 108 /* LetKeyword */: case 74 /* ConstKeyword */: case 114 /* YieldKeyword */: - case 132 /* TypeKeyword */: + case 134 /* TypeKeyword */: return true; } // Previous token may have been a keyword that was converted to an identifier. @@ -46966,20 +52825,20 @@ var ts; * do not occur at the current position and have not otherwise been typed. */ function filterNamedImportOrExportCompletionItems(exportsOfModule, namedImportsOrExports) { - var exisingImportsOrExports = {}; + var existingImportsOrExports = {}; for (var _i = 0, namedImportsOrExports_1 = namedImportsOrExports; _i < namedImportsOrExports_1.length; _i++) { var element = namedImportsOrExports_1[_i]; // If this is the current item we are editing right now, do not filter it out if (element.getStart() <= position && position <= element.getEnd()) { continue; } - var name_35 = element.propertyName || element.name; - exisingImportsOrExports[name_35.text] = true; + var name_39 = element.propertyName || element.name; + existingImportsOrExports[name_39.text] = true; } - if (ts.isEmpty(exisingImportsOrExports)) { - return exportsOfModule; + if (ts.isEmpty(existingImportsOrExports)) { + return ts.filter(exportsOfModule, function (e) { return e.name !== "default"; }); } - return ts.filter(exportsOfModule, function (e) { return !ts.lookUp(exisingImportsOrExports, e.name); }); + return ts.filter(exportsOfModule, function (e) { return e.name !== "default" && !ts.lookUp(existingImportsOrExports, e.name); }); } /** * Filters out completion suggestions for named imports or exports. @@ -46995,9 +52854,10 @@ var ts; for (var _i = 0, existingMembers_1 = existingMembers; _i < existingMembers_1.length; _i++) { var m = existingMembers_1[_i]; // Ignore omitted expressions for missing members - if (m.kind !== 245 /* PropertyAssignment */ && - m.kind !== 246 /* ShorthandPropertyAssignment */ && - m.kind !== 163 /* BindingElement */) { + if (m.kind !== 253 /* PropertyAssignment */ && + m.kind !== 254 /* ShorthandPropertyAssignment */ && + m.kind !== 169 /* BindingElement */ && + m.kind !== 147 /* MethodDeclaration */) { continue; } // If this is the current item we are editing right now, do not filter it out @@ -47005,7 +52865,7 @@ var ts; continue; } var existingName = void 0; - if (m.kind === 163 /* BindingElement */ && m.propertyName) { + if (m.kind === 169 /* BindingElement */ && m.propertyName) { // include only identifiers in completion list if (m.propertyName.kind === 69 /* Identifier */) { existingName = m.propertyName.text; @@ -47035,7 +52895,7 @@ var ts; if (attr.getStart() <= position && position <= attr.getEnd()) { continue; } - if (attr.kind === 238 /* JsxAttribute */) { + if (attr.kind === 246 /* JsxAttribute */) { seenNames[attr.name.text] = true; } } @@ -47048,20 +52908,36 @@ var ts; if (!completionData) { return undefined; } - var symbols = completionData.symbols, isMemberCompletion = completionData.isMemberCompletion, isNewIdentifierLocation = completionData.isNewIdentifierLocation, location = completionData.location, isRightOfDot = completionData.isRightOfDot, isJsDocTagName = completionData.isJsDocTagName; + var symbols = completionData.symbols, isMemberCompletion = completionData.isMemberCompletion, isNewIdentifierLocation = completionData.isNewIdentifierLocation, location = completionData.location, isJsDocTagName = completionData.isJsDocTagName; if (isJsDocTagName) { // If the current position is a jsDoc tag name, only tag names should be provided for completion return { isMemberCompletion: false, isNewIdentifierLocation: false, entries: getAllJsDocCompletionEntries() }; } var sourceFile = getValidSourceFile(fileName); var entries = []; - if (isRightOfDot && ts.isSourceFileJavaScript(sourceFile)) { + if (ts.isSourceFileJavaScript(sourceFile)) { var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries); - ts.addRange(entries, getJavaScriptCompletionEntries(sourceFile, uniqueNames)); + ts.addRange(entries, getJavaScriptCompletionEntries(sourceFile, location.pos, uniqueNames)); } else { if (!symbols || symbols.length === 0) { - return undefined; + if (sourceFile.languageVariant === 1 /* JSX */ && + location.parent && location.parent.kind === 245 /* JsxClosingElement */) { + // In the TypeScript JSX element, if such element is not defined. When users query for completion at closing tag, + // instead of simply giving unknown value, the completion will return the tag-name of an associated opening-element. + // For example: + // var x =
completion list at "1" will contain "div" with type any + var tagName = location.parent.parent.openingElement.tagName; + entries.push({ + name: tagName.text, + kind: undefined, + kindModifiers: undefined, + sortText: "0" + }); + } + else { + return undefined; + } } getCompletionEntriesFromSymbols(symbols, entries); } @@ -47070,14 +52946,18 @@ var ts; ts.addRange(entries, keywordCompletions); } return { isMemberCompletion: isMemberCompletion, isNewIdentifierLocation: isNewIdentifierLocation, entries: entries }; - function getJavaScriptCompletionEntries(sourceFile, uniqueNames) { + function getJavaScriptCompletionEntries(sourceFile, position, uniqueNames) { var entries = []; var target = program.getCompilerOptions().target; var nameTable = getNameTable(sourceFile); - for (var name_36 in nameTable) { - if (!uniqueNames[name_36]) { - uniqueNames[name_36] = name_36; - var displayName = getCompletionEntryDisplayName(name_36, target, /*performCharacterChecks:*/ true); + for (var name_40 in nameTable) { + // Skip identifiers produced only from the current location + if (nameTable[name_40] === position) { + continue; + } + if (!uniqueNames[name_40]) { + uniqueNames[name_40] = name_40; + var displayName = getCompletionEntryDisplayName(name_40, target, /*performCharacterChecks*/ true); if (displayName) { var entry = { name: displayName, @@ -47105,7 +52985,7 @@ var ts; // Try to get a valid display name for this symbol, if we could not find one, then ignore it. // We would like to only show things that can be added after a dot, so for instance numeric properties can // not be accessed with a dot (a.1 <- invalid) - var displayName = getCompletionEntryDisplayNameForSymbol(symbol, program.getCompilerOptions().target, /*performCharacterChecks:*/ true, location); + var displayName = getCompletionEntryDisplayNameForSymbol(symbol, program.getCompilerOptions().target, /*performCharacterChecks*/ true, location); if (!displayName) { return undefined; } @@ -47127,8 +53007,8 @@ var ts; var start = new Date().getTime(); var uniqueNames = {}; if (symbols) { - for (var _i = 0, symbols_3 = symbols; _i < symbols_3.length; _i++) { - var symbol = symbols_3[_i]; + for (var _i = 0, symbols_4 = symbols; _i < symbols_4.length; _i++) { + var symbol = symbols_4[_i]; var entry = createCompletionEntry(symbol, location); if (entry) { var id = ts.escapeIdentifier(entry.name); @@ -47150,11 +53030,11 @@ var ts; if (completionData) { var symbols = completionData.symbols, location_2 = completionData.location; // Find the symbol with the matching entry name. - var target = program.getCompilerOptions().target; + var target_2 = program.getCompilerOptions().target; // We don't need to perform character checks here because we're only comparing the // name against 'entryName' (which is known to be good), not building a new // completion entry. - var symbol = ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(s, target, /*performCharacterChecks:*/ false, location_2) === entryName ? s : undefined; }); + var symbol = ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(s, target_2, /*performCharacterChecks*/ false, location_2) === entryName ? s : undefined; }); if (symbol) { var _a = getSymbolDisplayPartsDocumentationAndSymbolKind(symbol, getValidSourceFile(fileName), location_2, location_2, 7 /* All */), displayParts = _a.displayParts, documentation = _a.documentation, symbolKind = _a.symbolKind; return { @@ -47183,7 +53063,7 @@ var ts; function getSymbolKind(symbol, location) { var flags = symbol.getFlags(); if (flags & 32 /* Class */) - return ts.getDeclarationOfKind(symbol, 186 /* ClassExpression */) ? + return ts.getDeclarationOfKind(symbol, 192 /* ClassExpression */) ? ScriptElementKind.localClassElement : ScriptElementKind.classElement; if (flags & 384 /* Enum */) return ScriptElementKind.enumElement; @@ -47214,6 +53094,9 @@ var ts; if (typeChecker.isArgumentsSymbol(symbol)) { return ScriptElementKind.localVariableElement; } + if (location.kind === 97 /* ThisKeyword */ && ts.isExpression(location)) { + return ScriptElementKind.parameterElement; + } if (flags & 3 /* Variable */) { if (ts.isFirstDeclarationOfSymbolParameter(symbol)) { return ScriptElementKind.parameterElement; @@ -47248,7 +53131,7 @@ var ts; }); if (!unionPropertyKind) { // If this was union of all methods, - //make sure it has call signatures before we can label it as method + // make sure it has call signatures before we can label it as method var typeOfUnionProperty = typeChecker.getTypeOfSymbolAtLocation(symbol, location); if (typeOfUnionProperty.getCallSignatures().length) { return ScriptElementKind.memberFunctionElement; @@ -47275,6 +53158,7 @@ var ts; var symbolFlags = symbol.flags; var symbolKind = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(symbol, symbolFlags, location); var hasAddedSymbolInfo; + var isThisExpression = location.kind === 97 /* ThisKeyword */ && ts.isExpression(location); var type; // Class at constructor site need to be shown as constructor apart from property,method, vars if (symbolKind !== ScriptElementKind.unknown || symbolFlags & 32 /* Class */ || symbolFlags & 8388608 /* Alias */) { @@ -47282,10 +53166,10 @@ var ts; if (symbolKind === ScriptElementKind.memberGetAccessorElement || symbolKind === ScriptElementKind.memberSetAccessorElement) { symbolKind = ScriptElementKind.memberVariableElement; } - var signature; - type = typeChecker.getTypeOfSymbolAtLocation(symbol, location); + var signature = void 0; + type = isThisExpression ? typeChecker.getTypeAtLocation(location) : typeChecker.getTypeOfSymbolAtLocation(symbol, location); if (type) { - if (location.parent && location.parent.kind === 166 /* PropertyAccessExpression */) { + if (location.parent && location.parent.kind === 172 /* PropertyAccessExpression */) { var right = location.parent.name; // Either the location is on the right of a property access, or on the left and the right is missing if (right === location || (right && right.getFullWidth() === 0)) { @@ -47293,8 +53177,8 @@ var ts; } } // try get the call/construct signature from the type if it matches - var callExpression; - if (location.kind === 168 /* CallExpression */ || location.kind === 169 /* NewExpression */) { + var callExpression = void 0; + if (location.kind === 174 /* CallExpression */ || location.kind === 175 /* NewExpression */) { callExpression = location; } else if (isCallExpressionTarget(location) || isNewExpressionTarget(location)) { @@ -47307,7 +53191,7 @@ var ts; // Use the first candidate: signature = candidateSignatures[0]; } - var useConstructSignatures = callExpression.kind === 169 /* NewExpression */ || callExpression.expression.kind === 95 /* SuperKeyword */; + var useConstructSignatures = callExpression.kind === 175 /* NewExpression */ || callExpression.expression.kind === 95 /* SuperKeyword */; var allSignatures = useConstructSignatures ? type.getConstructSignatures() : type.getCallSignatures(); if (!ts.contains(allSignatures, signature.target) && !ts.contains(allSignatures, signature)) { // Get the first signature if there is one -- allSignatures may contain @@ -47341,16 +53225,16 @@ var ts; case ScriptElementKind.parameterElement: case ScriptElementKind.localVariableElement: // If it is call or construct signature of lambda's write type name - displayParts.push(ts.punctuationPart(ts.SyntaxKind.ColonToken)); + displayParts.push(ts.punctuationPart(54 /* ColonToken */)); displayParts.push(ts.spacePart()); if (useConstructSignatures) { - displayParts.push(ts.keywordPart(ts.SyntaxKind.NewKeyword)); + displayParts.push(ts.keywordPart(92 /* NewKeyword */)); displayParts.push(ts.spacePart()); } - if (!(type.flags & ts.TypeFlags.Anonymous)) { - ts.addRange(displayParts, ts.symbolToDisplayParts(typeChecker, type.symbol, enclosingDeclaration, /*meaning*/ undefined, ts.SymbolFormatFlags.WriteTypeParametersOrArguments)); + if (!(type.flags & 65536 /* Anonymous */) && type.symbol) { + ts.addRange(displayParts, ts.symbolToDisplayParts(typeChecker, type.symbol, enclosingDeclaration, /*meaning*/ undefined, 1 /* WriteTypeParametersOrArguments */)); } - addSignatureDisplayParts(signature, allSignatures, ts.TypeFormatFlags.WriteArrowStyleSignature); + addSignatureDisplayParts(signature, allSignatures, 8 /* WriteArrowStyleSignature */); break; default: // Just signature @@ -47360,24 +53244,24 @@ var ts; } } else if ((isNameOfFunctionDeclaration(location) && !(symbol.flags & 98304 /* Accessor */)) || - (location.kind === 121 /* ConstructorKeyword */ && location.parent.kind === 144 /* Constructor */)) { + (location.kind === 121 /* ConstructorKeyword */ && location.parent.kind === 148 /* Constructor */)) { // get the signature from the declaration and write it var functionDeclaration = location.parent; - var allSignatures = functionDeclaration.kind === 144 /* Constructor */ ? type.getConstructSignatures() : type.getCallSignatures(); + var allSignatures = functionDeclaration.kind === 148 /* Constructor */ ? type.getNonNullableType().getConstructSignatures() : type.getNonNullableType().getCallSignatures(); if (!typeChecker.isImplementationOfOverload(functionDeclaration)) { signature = typeChecker.getSignatureFromDeclaration(functionDeclaration); } else { signature = allSignatures[0]; } - if (functionDeclaration.kind === 144 /* Constructor */) { + if (functionDeclaration.kind === 148 /* Constructor */) { // show (constructor) Type(...) signature symbolKind = ScriptElementKind.constructorImplementationElement; addPrefixForAnyFunctionOrVar(type.symbol, symbolKind); } else { // (function/method) symbol(..signature) - addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 147 /* CallSignature */ && + addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 151 /* CallSignature */ && !(type.symbol.flags & 2048 /* TypeLiteral */ || type.symbol.flags & 4096 /* ObjectLiteral */) ? type.symbol : symbol, symbolKind); } addSignatureDisplayParts(signature, allSignatures); @@ -47385,8 +53269,8 @@ var ts; } } } - if (symbolFlags & 32 /* Class */ && !hasAddedSymbolInfo) { - if (ts.getDeclarationOfKind(symbol, 186 /* ClassExpression */)) { + if (symbolFlags & 32 /* Class */ && !hasAddedSymbolInfo && !isThisExpression) { + if (ts.getDeclarationOfKind(symbol, 192 /* ClassExpression */)) { // Special case for class expressions because we would like to indicate that // the class name is local to the class body (similar to function expression) // (local class) class @@ -47409,7 +53293,7 @@ var ts; } if (symbolFlags & 524288 /* TypeAlias */) { addNewLineIfDisplayPartsExist(); - displayParts.push(ts.keywordPart(132 /* TypeKeyword */)); + displayParts.push(ts.keywordPart(134 /* TypeKeyword */)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); writeTypeParametersOfSymbol(symbol, sourceFile); @@ -47430,7 +53314,7 @@ var ts; } if (symbolFlags & 1536 /* Module */) { addNewLineIfDisplayPartsExist(); - var declaration = ts.getDeclarationOfKind(symbol, 218 /* ModuleDeclaration */); + var declaration = ts.getDeclarationOfKind(symbol, 225 /* ModuleDeclaration */); var isNamespace = declaration && declaration.name && declaration.name.kind === 69 /* Identifier */; displayParts.push(ts.keywordPart(isNamespace ? 126 /* NamespaceKeyword */ : 125 /* ModuleKeyword */)); displayParts.push(ts.spacePart()); @@ -47453,35 +53337,37 @@ var ts; } else { // Method/function type parameter - var container = ts.getContainingFunction(location); - if (container) { - var signatureDeclaration = ts.getDeclarationOfKind(symbol, 137 /* TypeParameter */).parent; - var signature = typeChecker.getSignatureFromDeclaration(signatureDeclaration); - if (signatureDeclaration.kind === 148 /* ConstructSignature */) { - displayParts.push(ts.keywordPart(92 /* NewKeyword */)); + var declaration = ts.getDeclarationOfKind(symbol, 141 /* TypeParameter */); + ts.Debug.assert(declaration !== undefined); + declaration = declaration.parent; + if (declaration) { + if (ts.isFunctionLikeKind(declaration.kind)) { + var signature = typeChecker.getSignatureFromDeclaration(declaration); + if (declaration.kind === 152 /* ConstructSignature */) { + displayParts.push(ts.keywordPart(92 /* NewKeyword */)); + displayParts.push(ts.spacePart()); + } + else if (declaration.kind !== 151 /* CallSignature */ && declaration.name) { + addFullSymbolName(declaration.symbol); + } + ts.addRange(displayParts, ts.signatureToDisplayParts(typeChecker, signature, sourceFile, 32 /* WriteTypeArgumentsOfSignature */)); + } + else { + // Type alias type parameter + // For example + // type list = T[]; // Both T will go through same code path + displayParts.push(ts.keywordPart(134 /* TypeKeyword */)); displayParts.push(ts.spacePart()); + addFullSymbolName(declaration.symbol); + writeTypeParametersOfSymbol(declaration.symbol, sourceFile); } - else if (signatureDeclaration.kind !== 147 /* CallSignature */ && signatureDeclaration.name) { - addFullSymbolName(signatureDeclaration.symbol); - } - ts.addRange(displayParts, ts.signatureToDisplayParts(typeChecker, signature, sourceFile, 32 /* WriteTypeArgumentsOfSignature */)); - } - else { - // Type aliash type parameter - // For example - // type list = T[]; // Both T will go through same code path - var declaration = ts.getDeclarationOfKind(symbol, 137 /* TypeParameter */).parent; - displayParts.push(ts.keywordPart(132 /* TypeKeyword */)); - displayParts.push(ts.spacePart()); - addFullSymbolName(declaration.symbol); - writeTypeParametersOfSymbol(declaration.symbol, sourceFile); } } } if (symbolFlags & 8 /* EnumMember */) { addPrefixForAnyFunctionOrVar(symbol, "enum member"); var declaration = symbol.declarations[0]; - if (declaration.kind === 247 /* EnumMember */) { + if (declaration.kind === 255 /* EnumMember */) { var constantValue = typeChecker.getConstantValue(declaration); if (constantValue !== undefined) { displayParts.push(ts.spacePart()); @@ -47497,13 +53383,13 @@ var ts; displayParts.push(ts.spacePart()); addFullSymbolName(symbol); ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 221 /* ImportEqualsDeclaration */) { + if (declaration.kind === 229 /* ImportEqualsDeclaration */) { var importEqualsDeclaration = declaration; if (ts.isExternalModuleImportEqualsDeclaration(importEqualsDeclaration)) { displayParts.push(ts.spacePart()); displayParts.push(ts.operatorPart(56 /* EqualsToken */)); displayParts.push(ts.spacePart()); - displayParts.push(ts.keywordPart(127 /* RequireKeyword */)); + displayParts.push(ts.keywordPart(129 /* RequireKeyword */)); displayParts.push(ts.punctuationPart(17 /* OpenParenToken */)); displayParts.push(ts.displayPart(ts.getTextOfNode(ts.getExternalModuleImportEqualsDeclarationExpression(importEqualsDeclaration)), SymbolDisplayPartKind.stringLiteral)); displayParts.push(ts.punctuationPart(18 /* CloseParenToken */)); @@ -47524,11 +53410,18 @@ var ts; if (!hasAddedSymbolInfo) { if (symbolKind !== ScriptElementKind.unknown) { if (type) { - addPrefixForAnyFunctionOrVar(symbol, symbolKind); + if (isThisExpression) { + addNewLineIfDisplayPartsExist(); + displayParts.push(ts.keywordPart(97 /* ThisKeyword */)); + } + else { + addPrefixForAnyFunctionOrVar(symbol, symbolKind); + } // For properties, variables and local vars: show the type if (symbolKind === ScriptElementKind.memberVariableElement || symbolFlags & 3 /* Variable */ || - symbolKind === ScriptElementKind.localVariableElement) { + symbolKind === ScriptElementKind.localVariableElement || + isThisExpression) { displayParts.push(ts.punctuationPart(54 /* ColonToken */)); displayParts.push(ts.spacePart()); // If the type is type parameter, format it specially @@ -47548,7 +53441,7 @@ var ts; symbolFlags & 131072 /* Signature */ || symbolFlags & 98304 /* Accessor */ || symbolKind === ScriptElementKind.memberFunctionElement) { - var allSignatures = type.getCallSignatures(); + var allSignatures = type.getNonNullableType().getCallSignatures(); addSignatureDisplayParts(allSignatures[0], allSignatures); } } @@ -47618,7 +53511,7 @@ var ts; synchronizeHostData(); var sourceFile = getValidSourceFile(fileName); var node = ts.getTouchingPropertyName(sourceFile, position); - if (!node) { + if (node === sourceFile) { return undefined; } if (isLabelName(node)) { @@ -47626,13 +53519,14 @@ var ts; } var typeChecker = program.getTypeChecker(); var symbol = typeChecker.getSymbolAtLocation(node); - if (!symbol) { + if (!symbol || typeChecker.isUnknownSymbol(symbol)) { // Try getting just type at this position and show switch (node.kind) { case 69 /* Identifier */: - case 166 /* PropertyAccessExpression */: - case 135 /* QualifiedName */: + case 172 /* PropertyAccessExpression */: + case 139 /* QualifiedName */: case 97 /* ThisKeyword */: + case 165 /* ThisType */: case 95 /* SuperKeyword */: // For the identifiers/this/super etc get the type at position var type = typeChecker.getTypeAtLocation(node); @@ -47711,8 +53605,8 @@ var ts; var declarations = []; var definition; ts.forEach(signatureDeclarations, function (d) { - if ((selectConstructors && d.kind === 144 /* Constructor */) || - (!selectConstructors && (d.kind === 213 /* FunctionDeclaration */ || d.kind === 143 /* MethodDeclaration */ || d.kind === 142 /* MethodSignature */))) { + if ((selectConstructors && d.kind === 148 /* Constructor */) || + (!selectConstructors && (d.kind === 220 /* FunctionDeclaration */ || d.kind === 147 /* MethodDeclaration */ || d.kind === 146 /* MethodSignature */))) { declarations.push(d); if (d.body) definition = d; @@ -47729,12 +53623,49 @@ var ts; return false; } } + function findReferenceInPosition(refs, pos) { + for (var _i = 0, refs_1 = refs; _i < refs_1.length; _i++) { + var ref = refs_1[_i]; + if (ref.pos <= pos && pos < ref.end) { + return ref; + } + } + return undefined; + } + function getDefinitionInfoForFileReference(name, targetFileName) { + return { + fileName: targetFileName, + textSpan: ts.createTextSpanFromBounds(0, 0), + kind: ScriptElementKind.scriptElement, + name: name, + containerName: undefined, + containerKind: undefined + }; + } /// Goto definition function getDefinitionAtPosition(fileName, position) { synchronizeHostData(); var sourceFile = getValidSourceFile(fileName); + /// Triple slash reference comments + var comment = findReferenceInPosition(sourceFile.referencedFiles, position); + if (comment) { + var referenceFile = ts.tryResolveScriptReference(program, sourceFile, comment); + if (referenceFile) { + return [getDefinitionInfoForFileReference(comment.fileName, referenceFile.fileName)]; + } + return undefined; + } + // Type reference directives + var typeReferenceDirective = findReferenceInPosition(sourceFile.typeReferenceDirectives, position); + if (typeReferenceDirective) { + var referenceFile = ts.lookUp(program.getResolvedTypeReferenceDirectives(), typeReferenceDirective.fileName); + if (referenceFile && referenceFile.resolvedFileName) { + return [getDefinitionInfoForFileReference(typeReferenceDirective.fileName, referenceFile.resolvedFileName)]; + } + return undefined; + } var node = ts.getTouchingPropertyName(sourceFile, position); - if (!node) { + if (node === sourceFile) { return undefined; } // Labels @@ -47743,22 +53674,6 @@ var ts; var label = getTargetLabel(node.parent, node.text); return label ? [createDefinitionInfo(label, ScriptElementKind.label, labelName, /*containerName*/ undefined)] : undefined; } - /// Triple slash reference comments - var comment = ts.forEach(sourceFile.referencedFiles, function (r) { return (r.pos <= position && position < r.end) ? r : undefined; }); - if (comment) { - var referenceFile = ts.tryResolveScriptReference(program, sourceFile, comment); - if (referenceFile) { - return [{ - fileName: referenceFile.fileName, - textSpan: ts.createTextSpanFromBounds(0, 0), - kind: ScriptElementKind.scriptElement, - name: comment.fileName, - containerName: undefined, - containerKind: undefined - }]; - } - return undefined; - } var typeChecker = program.getTypeChecker(); var symbol = typeChecker.getSymbolAtLocation(node); // Could not find a symbol e.g. node is string or number keyword, @@ -47772,7 +53687,14 @@ var ts; // to jump to the implementation directly. if (symbol.flags & 8388608 /* Alias */) { var declaration = symbol.declarations[0]; - if (node.kind === 69 /* Identifier */ && node.parent === declaration) { + // Go to the original declaration for cases: + // + // (1) when the aliased symbol was declared in the location(parent). + // (2) when the aliased symbol is originating from a named import. + // + if (node.kind === 69 /* Identifier */ && + (node.parent === declaration || + (declaration.kind === 234 /* ImportSpecifier */ && declaration.parent && declaration.parent.kind === 233 /* NamedImports */))) { symbol = typeChecker.getAliasedSymbol(symbol); } } @@ -47781,16 +53703,16 @@ var ts; // go to the declaration of the property name (in this case stay at the same position). However, if go-to-definition // is performed at the location of property access, we would like to go to definition of the property in the short-hand // assignment. This case and others are handled by the following code. - if (node.parent.kind === 246 /* ShorthandPropertyAssignment */) { + if (node.parent.kind === 254 /* ShorthandPropertyAssignment */) { var shorthandSymbol = typeChecker.getShorthandAssignmentValueSymbol(symbol.valueDeclaration); if (!shorthandSymbol) { return []; } var shorthandDeclarations = shorthandSymbol.getDeclarations(); - var shorthandSymbolKind = getSymbolKind(shorthandSymbol, node); - var shorthandSymbolName = typeChecker.symbolToString(shorthandSymbol); - var shorthandContainerName = typeChecker.symbolToString(symbol.parent, node); - return ts.map(shorthandDeclarations, function (declaration) { return createDefinitionInfo(declaration, shorthandSymbolKind, shorthandSymbolName, shorthandContainerName); }); + var shorthandSymbolKind_1 = getSymbolKind(shorthandSymbol, node); + var shorthandSymbolName_1 = typeChecker.symbolToString(shorthandSymbol); + var shorthandContainerName_1 = typeChecker.symbolToString(symbol.parent, node); + return ts.map(shorthandDeclarations, function (declaration) { return createDefinitionInfo(declaration, shorthandSymbolKind_1, shorthandSymbolName_1, shorthandContainerName_1); }); } return getDefinitionFromSymbol(symbol, node); } @@ -47799,7 +53721,7 @@ var ts; synchronizeHostData(); var sourceFile = getValidSourceFile(fileName); var node = ts.getTouchingPropertyName(sourceFile, position); - if (!node) { + if (node === sourceFile) { return undefined; } var typeChecker = program.getTypeChecker(); @@ -47812,13 +53734,13 @@ var ts; return undefined; } if (type.flags & 16384 /* Union */) { - var result = []; + var result_3 = []; ts.forEach(type.types, function (t) { if (t.symbol) { - ts.addRange(/*to*/ result, /*from*/ getDefinitionFromSymbol(t.symbol, node)); + ts.addRange(/*to*/ result_3, /*from*/ getDefinitionFromSymbol(t.symbol, node)); } }); - return result; + return result_3; } if (!type.symbol) { return undefined; @@ -47828,10 +53750,10 @@ var ts; function getOccurrencesAtPosition(fileName, position) { var results = getOccurrencesAtPositionCore(fileName, position); if (results) { - var sourceFile = getCanonicalFileName(ts.normalizeSlashes(fileName)); + var sourceFile_2 = getCanonicalFileName(ts.normalizeSlashes(fileName)); // Get occurrences only supports reporting occurrences for the file queried. So // filter down to that list. - results = ts.filter(results, function (r) { return getCanonicalFileName(ts.normalizeSlashes(r.fileName)) === sourceFile; }); + results = ts.filter(results, function (r) { return getCanonicalFileName(ts.normalizeSlashes(r.fileName)) === sourceFile_2; }); } return results; } @@ -47857,10 +53779,11 @@ var ts; function getSemanticDocumentHighlights(node) { if (node.kind === 69 /* Identifier */ || node.kind === 97 /* ThisKeyword */ || + node.kind === 165 /* ThisType */ || node.kind === 95 /* SuperKeyword */ || - isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || - isNameOfExternalModuleImportOrDeclaration(node)) { - var referencedSymbols = getReferencedSymbolsForNode(node, sourceFilesToSearch, /*findInStrings:*/ false, /*findInComments:*/ false); + node.kind === 9 /* StringLiteral */ || + isLiteralNameOfPropertyDeclarationOrIndexAccess(node)) { + var referencedSymbols = getReferencedSymbolsForNode(node, sourceFilesToSearch, /*findInStrings*/ false, /*findInComments*/ false); return convertReferencedSymbols(referencedSymbols); } return undefined; @@ -47910,75 +53833,75 @@ var ts; switch (node.kind) { case 88 /* IfKeyword */: case 80 /* ElseKeyword */: - if (hasKind(node.parent, 196 /* IfStatement */)) { + if (hasKind(node.parent, 203 /* IfStatement */)) { return getIfElseOccurrences(node.parent); } break; case 94 /* ReturnKeyword */: - if (hasKind(node.parent, 204 /* ReturnStatement */)) { + if (hasKind(node.parent, 211 /* ReturnStatement */)) { return getReturnOccurrences(node.parent); } break; case 98 /* ThrowKeyword */: - if (hasKind(node.parent, 208 /* ThrowStatement */)) { + if (hasKind(node.parent, 215 /* ThrowStatement */)) { return getThrowOccurrences(node.parent); } break; case 72 /* CatchKeyword */: - if (hasKind(parent(parent(node)), 209 /* TryStatement */)) { + if (hasKind(parent(parent(node)), 216 /* TryStatement */)) { return getTryCatchFinallyOccurrences(node.parent.parent); } break; case 100 /* TryKeyword */: case 85 /* FinallyKeyword */: - if (hasKind(parent(node), 209 /* TryStatement */)) { + if (hasKind(parent(node), 216 /* TryStatement */)) { return getTryCatchFinallyOccurrences(node.parent); } break; case 96 /* SwitchKeyword */: - if (hasKind(node.parent, 206 /* SwitchStatement */)) { + if (hasKind(node.parent, 213 /* SwitchStatement */)) { return getSwitchCaseDefaultOccurrences(node.parent); } break; case 71 /* CaseKeyword */: case 77 /* DefaultKeyword */: - if (hasKind(parent(parent(parent(node))), 206 /* SwitchStatement */)) { + if (hasKind(parent(parent(parent(node))), 213 /* SwitchStatement */)) { return getSwitchCaseDefaultOccurrences(node.parent.parent.parent); } break; case 70 /* BreakKeyword */: case 75 /* ContinueKeyword */: - if (hasKind(node.parent, 203 /* BreakStatement */) || hasKind(node.parent, 202 /* ContinueStatement */)) { + if (hasKind(node.parent, 210 /* BreakStatement */) || hasKind(node.parent, 209 /* ContinueStatement */)) { return getBreakOrContinueStatementOccurrences(node.parent); } break; case 86 /* ForKeyword */: - if (hasKind(node.parent, 199 /* ForStatement */) || - hasKind(node.parent, 200 /* ForInStatement */) || - hasKind(node.parent, 201 /* ForOfStatement */)) { + if (hasKind(node.parent, 206 /* ForStatement */) || + hasKind(node.parent, 207 /* ForInStatement */) || + hasKind(node.parent, 208 /* ForOfStatement */)) { return getLoopBreakContinueOccurrences(node.parent); } break; case 104 /* WhileKeyword */: case 79 /* DoKeyword */: - if (hasKind(node.parent, 198 /* WhileStatement */) || hasKind(node.parent, 197 /* DoStatement */)) { + if (hasKind(node.parent, 205 /* WhileStatement */) || hasKind(node.parent, 204 /* DoStatement */)) { return getLoopBreakContinueOccurrences(node.parent); } break; case 121 /* ConstructorKeyword */: - if (hasKind(node.parent, 144 /* Constructor */)) { + if (hasKind(node.parent, 148 /* Constructor */)) { return getConstructorOccurrences(node.parent); } break; case 123 /* GetKeyword */: - case 129 /* SetKeyword */: - if (hasKind(node.parent, 145 /* GetAccessor */) || hasKind(node.parent, 146 /* SetAccessor */)) { + case 131 /* SetKeyword */: + if (hasKind(node.parent, 149 /* GetAccessor */) || hasKind(node.parent, 150 /* SetAccessor */)) { return getGetAndSetOccurrences(node.parent); } break; default: - if (ts.isModifier(node.kind) && node.parent && - (ts.isDeclaration(node.parent) || node.parent.kind === 193 /* VariableStatement */)) { + if (ts.isModifierKind(node.kind) && node.parent && + (ts.isDeclaration(node.parent) || node.parent.kind === 200 /* VariableStatement */)) { return getModifierOccurrences(node.kind, node.parent); } } @@ -47994,10 +53917,10 @@ var ts; aggregate(node); return statementAccumulator; function aggregate(node) { - if (node.kind === 208 /* ThrowStatement */) { + if (node.kind === 215 /* ThrowStatement */) { statementAccumulator.push(node); } - else if (node.kind === 209 /* TryStatement */) { + else if (node.kind === 216 /* TryStatement */) { var tryStatement = node; if (tryStatement.catchClause) { aggregate(tryStatement.catchClause); @@ -48024,19 +53947,19 @@ var ts; function getThrowStatementOwner(throwStatement) { var child = throwStatement; while (child.parent) { - var parent_12 = child.parent; - if (ts.isFunctionBlock(parent_12) || parent_12.kind === 248 /* SourceFile */) { - return parent_12; + var parent_19 = child.parent; + if (ts.isFunctionBlock(parent_19) || parent_19.kind === 256 /* SourceFile */) { + return parent_19; } // A throw-statement is only owned by a try-statement if the try-statement has // a catch clause, and if the throw-statement occurs within the try block. - if (parent_12.kind === 209 /* TryStatement */) { - var tryStatement = parent_12; + if (parent_19.kind === 216 /* TryStatement */) { + var tryStatement = parent_19; if (tryStatement.tryBlock === child && tryStatement.catchClause) { return child; } } - child = parent_12; + child = parent_19; } return undefined; } @@ -48045,7 +53968,7 @@ var ts; aggregate(node); return statementAccumulator; function aggregate(node) { - if (node.kind === 203 /* BreakStatement */ || node.kind === 202 /* ContinueStatement */) { + if (node.kind === 210 /* BreakStatement */ || node.kind === 209 /* ContinueStatement */) { statementAccumulator.push(node); } else if (!ts.isFunctionLike(node)) { @@ -48058,25 +53981,25 @@ var ts; return actualOwner && actualOwner === owner; } function getBreakOrContinueOwner(statement) { - for (var node_2 = statement.parent; node_2; node_2 = node_2.parent) { - switch (node_2.kind) { - case 206 /* SwitchStatement */: - if (statement.kind === 202 /* ContinueStatement */) { + for (var node_1 = statement.parent; node_1; node_1 = node_1.parent) { + switch (node_1.kind) { + case 213 /* SwitchStatement */: + if (statement.kind === 209 /* ContinueStatement */) { continue; } // Fall through. - case 199 /* ForStatement */: - case 200 /* ForInStatement */: - case 201 /* ForOfStatement */: - case 198 /* WhileStatement */: - case 197 /* DoStatement */: - if (!statement.label || isLabeledBy(node_2, statement.label.text)) { - return node_2; + case 206 /* ForStatement */: + case 207 /* ForInStatement */: + case 208 /* ForOfStatement */: + case 205 /* WhileStatement */: + case 204 /* DoStatement */: + if (!statement.label || isLabeledBy(node_1, statement.label.text)) { + return node_1; } break; default: // Don't cross function boundaries. - if (ts.isFunctionLike(node_2)) { + if (ts.isFunctionLike(node_1)) { return undefined; } break; @@ -48088,24 +54011,24 @@ var ts; var container = declaration.parent; // Make sure we only highlight the keyword when it makes sense to do so. if (ts.isAccessibilityModifier(modifier)) { - if (!(container.kind === 214 /* ClassDeclaration */ || - container.kind === 186 /* ClassExpression */ || - (declaration.kind === 138 /* Parameter */ && hasKind(container, 144 /* Constructor */)))) { + if (!(container.kind === 221 /* ClassDeclaration */ || + container.kind === 192 /* ClassExpression */ || + (declaration.kind === 142 /* Parameter */ && hasKind(container, 148 /* Constructor */)))) { return undefined; } } else if (modifier === 113 /* StaticKeyword */) { - if (!(container.kind === 214 /* ClassDeclaration */ || container.kind === 186 /* ClassExpression */)) { + if (!(container.kind === 221 /* ClassDeclaration */ || container.kind === 192 /* ClassExpression */)) { return undefined; } } else if (modifier === 82 /* ExportKeyword */ || modifier === 122 /* DeclareKeyword */) { - if (!(container.kind === 219 /* ModuleBlock */ || container.kind === 248 /* SourceFile */)) { + if (!(container.kind === 226 /* ModuleBlock */ || container.kind === 256 /* SourceFile */)) { return undefined; } } else if (modifier === 115 /* AbstractKeyword */) { - if (!(container.kind === 214 /* ClassDeclaration */ || declaration.kind === 214 /* ClassDeclaration */)) { + if (!(container.kind === 221 /* ClassDeclaration */ || declaration.kind === 221 /* ClassDeclaration */)) { return undefined; } } @@ -48117,8 +54040,8 @@ var ts; var modifierFlag = getFlagFromModifier(modifier); var nodes; switch (container.kind) { - case 219 /* ModuleBlock */: - case 248 /* SourceFile */: + case 226 /* ModuleBlock */: + case 256 /* SourceFile */: // Container is either a class declaration or the declaration is a classDeclaration if (modifierFlag & 128 /* Abstract */) { nodes = declaration.members.concat(declaration); @@ -48127,17 +54050,17 @@ var ts; nodes = container.statements; } break; - case 144 /* Constructor */: + case 148 /* Constructor */: nodes = container.parameters.concat(container.parent.members); break; - case 214 /* ClassDeclaration */: - case 186 /* ClassExpression */: + case 221 /* ClassDeclaration */: + case 192 /* ClassExpression */: nodes = container.members; // If we're an accessibility modifier, we're in an instance member and should search // the constructor's parameter list for instance members as well. - if (modifierFlag & 56 /* AccessibilityModifier */) { + if (modifierFlag & 28 /* AccessibilityModifier */) { var constructor = ts.forEach(container.members, function (member) { - return member.kind === 144 /* Constructor */ && member; + return member.kind === 148 /* Constructor */ && member; }); if (constructor) { nodes = nodes.concat(constructor.parameters); @@ -48159,17 +54082,17 @@ var ts; function getFlagFromModifier(modifier) { switch (modifier) { case 112 /* PublicKeyword */: - return 8 /* Public */; + return 4 /* Public */; case 110 /* PrivateKeyword */: - return 16 /* Private */; + return 8 /* Private */; case 111 /* ProtectedKeyword */: - return 32 /* Protected */; + return 16 /* Protected */; case 113 /* StaticKeyword */: - return 64 /* Static */; + return 32 /* Static */; case 82 /* ExportKeyword */: - return 2 /* Export */; + return 1 /* Export */; case 122 /* DeclareKeyword */: - return 4 /* Ambient */; + return 2 /* Ambient */; case 115 /* AbstractKeyword */: return 128 /* Abstract */; default: @@ -48190,13 +54113,13 @@ var ts; } function getGetAndSetOccurrences(accessorDeclaration) { var keywords = []; - tryPushAccessorKeyword(accessorDeclaration.symbol, 145 /* GetAccessor */); - tryPushAccessorKeyword(accessorDeclaration.symbol, 146 /* SetAccessor */); + tryPushAccessorKeyword(accessorDeclaration.symbol, 149 /* GetAccessor */); + tryPushAccessorKeyword(accessorDeclaration.symbol, 150 /* SetAccessor */); return ts.map(keywords, getHighlightSpanForNode); function tryPushAccessorKeyword(accessorSymbol, accessorKind) { var accessor = ts.getDeclarationOfKind(accessorSymbol, accessorKind); if (accessor) { - ts.forEach(accessor.getChildren(), function (child) { return pushKeywordIf(keywords, child, 123 /* GetKeyword */, 129 /* SetKeyword */); }); + ts.forEach(accessor.getChildren(), function (child) { return pushKeywordIf(keywords, child, 123 /* GetKeyword */, 131 /* SetKeyword */); }); } } } @@ -48214,7 +54137,7 @@ var ts; var keywords = []; if (pushKeywordIf(keywords, loopNode.getFirstToken(), 86 /* ForKeyword */, 104 /* WhileKeyword */, 79 /* DoKeyword */)) { // If we succeeded and got a do-while loop, then start looking for a 'while' keyword. - if (loopNode.kind === 197 /* DoStatement */) { + if (loopNode.kind === 204 /* DoStatement */) { var loopTokens = loopNode.getChildren(); for (var i = loopTokens.length - 1; i >= 0; i--) { if (pushKeywordIf(keywords, loopTokens[i], 104 /* WhileKeyword */)) { @@ -48235,13 +54158,13 @@ var ts; var owner = getBreakOrContinueOwner(breakOrContinueStatement); if (owner) { switch (owner.kind) { - case 199 /* ForStatement */: - case 200 /* ForInStatement */: - case 201 /* ForOfStatement */: - case 197 /* DoStatement */: - case 198 /* WhileStatement */: + case 206 /* ForStatement */: + case 207 /* ForInStatement */: + case 208 /* ForOfStatement */: + case 204 /* DoStatement */: + case 205 /* WhileStatement */: return getLoopBreakContinueOccurrences(owner); - case 206 /* SwitchStatement */: + case 213 /* SwitchStatement */: return getSwitchCaseDefaultOccurrences(owner); } } @@ -48295,7 +54218,7 @@ var ts; function getReturnOccurrences(returnStatement) { var func = ts.getContainingFunction(returnStatement); // If we didn't find a containing function with a block body, bail out. - if (!(func && hasKind(func.body, 192 /* Block */))) { + if (!(func && hasKind(func.body, 199 /* Block */))) { return undefined; } var keywords = []; @@ -48311,7 +54234,7 @@ var ts; function getIfElseOccurrences(ifStatement) { var keywords = []; // Traverse upwards through all parent if-statements linked by their else-branches. - while (hasKind(ifStatement.parent, 196 /* IfStatement */) && ifStatement.parent.elseStatement === ifStatement) { + while (hasKind(ifStatement.parent, 203 /* IfStatement */) && ifStatement.parent.elseStatement === ifStatement) { ifStatement = ifStatement.parent; } // Now traverse back down through the else branches, aggregating if/else keywords of if-statements. @@ -48324,7 +54247,7 @@ var ts; break; } } - if (!hasKind(ifStatement.elseStatement, 196 /* IfStatement */)) { + if (!hasKind(ifStatement.elseStatement, 203 /* IfStatement */)) { break; } ifStatement = ifStatement.elseStatement; @@ -48400,11 +54323,11 @@ var ts; return convertReferences(referencedSymbols); } function getReferencesAtPosition(fileName, position) { - var referencedSymbols = findReferencedSymbols(fileName, position, /*findInStrings:*/ false, /*findInComments:*/ false); + var referencedSymbols = findReferencedSymbols(fileName, position, /*findInStrings*/ false, /*findInComments*/ false); return convertReferences(referencedSymbols); } function findReferences(fileName, position) { - var referencedSymbols = findReferencedSymbols(fileName, position, /*findInStrings:*/ false, /*findInComments:*/ false); + var referencedSymbols = findReferencedSymbols(fileName, position, /*findInStrings*/ false, /*findInComments*/ false); // Only include referenced symbols that have a valid definition. return ts.filter(referencedSymbols, function (rs) { return !!rs.definition; }); } @@ -48412,15 +54335,15 @@ var ts; synchronizeHostData(); var sourceFile = getValidSourceFile(fileName); var node = ts.getTouchingPropertyName(sourceFile, position); - if (!node) { + if (node === sourceFile) { return undefined; } if (node.kind !== 69 /* Identifier */ && // TODO (drosen): This should be enabled in a later release - currently breaks rename. - //node.kind !== SyntaxKind.ThisKeyword && - //node.kind !== SyntaxKind.SuperKeyword && - !isLiteralNameOfPropertyDeclarationOrIndexAccess(node) && - !isNameOfExternalModuleImportOrDeclaration(node)) { + // node.kind !== SyntaxKind.ThisKeyword && + // node.kind !== SyntaxKind.SuperKeyword && + node.kind !== 9 /* StringLiteral */ && + !isLiteralNameOfPropertyDeclarationOrIndexAccess(node)) { return undefined; } ts.Debug.assert(node.kind === 69 /* Identifier */ || node.kind === 8 /* NumericLiteral */ || node.kind === 9 /* StringLiteral */); @@ -48441,13 +54364,16 @@ var ts; return getLabelReferencesInNode(node.parent, node); } } - if (node.kind === 97 /* ThisKeyword */) { + if (node.kind === 97 /* ThisKeyword */ || node.kind === 165 /* ThisType */) { return getReferencesForThisKeyword(node, sourceFiles); } if (node.kind === 95 /* SuperKeyword */) { return getReferencesForSuperKeyword(node); } var symbol = typeChecker.getSymbolAtLocation(node); + if (!symbol && node.kind === 9 /* StringLiteral */) { + return getReferencesForStringLiteral(node, sourceFiles); + } // Could not find a symbol e.g. unknown identifier if (!symbol) { // Can't have references to something that we have no symbol for. @@ -48475,11 +54401,11 @@ var ts; } else { var internedName = getInternedName(symbol, node, declarations); - for (var _i = 0, sourceFiles_2 = sourceFiles; _i < sourceFiles_2.length; _i++) { - var sourceFile = sourceFiles_2[_i]; + for (var _i = 0, sourceFiles_4 = sourceFiles; _i < sourceFiles_4.length; _i++) { + var sourceFile = sourceFiles_4[_i]; cancellationToken.throwIfCancellationRequested(); var nameTable = getNameTable(sourceFile); - if (ts.lookUp(nameTable, internedName)) { + if (ts.lookUp(nameTable, internedName) !== undefined) { result = result || []; getReferencesInNode(sourceFile, symbol, declaredName, node, searchMeaning, findInStrings, findInComments, result, symbolToIndex); } @@ -48502,10 +54428,46 @@ var ts; textSpan: ts.createTextSpan(declarations[0].getStart(), 0) }; } - function isImportOrExportSpecifierImportSymbol(symbol) { - return (symbol.flags & 8388608 /* Alias */) && ts.forEach(symbol.declarations, function (declaration) { - return declaration.kind === 226 /* ImportSpecifier */ || declaration.kind === 230 /* ExportSpecifier */; - }); + function getAliasSymbolForPropertyNameSymbol(symbol, location) { + if (symbol.flags & 8388608 /* Alias */) { + // Default import get alias + var defaultImport = ts.getDeclarationOfKind(symbol, 231 /* ImportClause */); + if (defaultImport) { + return typeChecker.getAliasedSymbol(symbol); + } + var importOrExportSpecifier = ts.forEach(symbol.declarations, function (declaration) { return (declaration.kind === 234 /* ImportSpecifier */ || + declaration.kind === 238 /* ExportSpecifier */) ? declaration : undefined; }); + if (importOrExportSpecifier && + // export { a } + (!importOrExportSpecifier.propertyName || + // export {a as class } where a is location + importOrExportSpecifier.propertyName === location)) { + // If Import specifier -> get alias + // else Export specifier -> get local target + return importOrExportSpecifier.kind === 234 /* ImportSpecifier */ ? + typeChecker.getAliasedSymbol(symbol) : + typeChecker.getExportSpecifierLocalTargetSymbol(importOrExportSpecifier); + } + } + return undefined; + } + function getPropertySymbolOfDestructuringAssignment(location) { + return ts.isArrayLiteralOrObjectLiteralDestructuringPattern(location.parent.parent) && + typeChecker.getPropertySymbolOfDestructuringAssignment(location); + } + function isObjectBindingPatternElementWithoutPropertyName(symbol) { + var bindingElement = ts.getDeclarationOfKind(symbol, 169 /* BindingElement */); + return bindingElement && + bindingElement.parent.kind === 167 /* ObjectBindingPattern */ && + !bindingElement.propertyName; + } + function getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol) { + if (isObjectBindingPatternElementWithoutPropertyName(symbol)) { + var bindingElement = ts.getDeclarationOfKind(symbol, 169 /* BindingElement */); + var typeOfPattern = typeChecker.getTypeAtLocation(bindingElement.parent); + return typeOfPattern && typeChecker.getPropertyOfType(typeOfPattern, bindingElement.name.text); + } + return undefined; } function getInternedName(symbol, location, declarations) { // If this is an export or import specifier it could have been renamed using the 'as' syntax. @@ -48531,31 +54493,36 @@ var ts; // If this is the symbol of a named function expression or named class expression, // then named references are limited to its own scope. var valueDeclaration = symbol.valueDeclaration; - if (valueDeclaration && (valueDeclaration.kind === 173 /* FunctionExpression */ || valueDeclaration.kind === 186 /* ClassExpression */)) { + if (valueDeclaration && (valueDeclaration.kind === 179 /* FunctionExpression */ || valueDeclaration.kind === 192 /* ClassExpression */)) { return valueDeclaration; } // If this is private property or method, the scope is the containing class if (symbol.flags & (4 /* Property */ | 8192 /* Method */)) { - var privateDeclaration = ts.forEach(symbol.getDeclarations(), function (d) { return (d.flags & 16 /* Private */) ? d : undefined; }); + var privateDeclaration = ts.forEach(symbol.getDeclarations(), function (d) { return (d.flags & 8 /* Private */) ? d : undefined; }); if (privateDeclaration) { - return ts.getAncestor(privateDeclaration, 214 /* ClassDeclaration */); + return ts.getAncestor(privateDeclaration, 221 /* ClassDeclaration */); } } // If the symbol is an import we would like to find it if we are looking for what it imports. - // So consider it visibile outside its declaration scope. + // So consider it visible outside its declaration scope. if (symbol.flags & 8388608 /* Alias */) { return undefined; } + // If symbol is of object binding pattern element without property name we would want to + // look for property too and that could be anywhere + if (isObjectBindingPatternElementWithoutPropertyName(symbol)) { + return undefined; + } // if this symbol is visible from its parent container, e.g. exported, then bail out // if symbol correspond to the union property - bail out if (symbol.parent || (symbol.flags & 268435456 /* SyntheticProperty */)) { return undefined; } - var scope = undefined; + var scope; var declarations = symbol.getDeclarations(); if (declarations) { - for (var _i = 0, declarations_8 = declarations; _i < declarations_8.length; _i++) { - var declaration = declarations_8[_i]; + for (var _i = 0, declarations_9 = declarations; _i < declarations_9.length; _i++) { + var declaration = declarations_9[_i]; var container = getContainerNode(declaration); if (!container) { return undefined; @@ -48564,7 +54531,7 @@ var ts; // Different declarations have different containers, bail out return undefined; } - if (container.kind === 248 /* SourceFile */ && !ts.isExternalModule(container)) { + if (container.kind === 256 /* SourceFile */ && !ts.isExternalModule(container)) { // This is a global variable and not an external module, any declaration defined // within this scope is visible outside the file return undefined; @@ -48663,7 +54630,7 @@ var ts; var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, searchText, container.getStart(), container.getEnd()); if (possiblePositions.length) { // Build the set of symbols to search for, initially it has only the current symbol - var searchSymbols = populateSearchSymbolSet(searchSymbol, searchLocation); + var searchSymbols_1 = populateSearchSymbolSet(searchSymbol, searchLocation); ts.forEach(possiblePositions, function (position) { cancellationToken.throwIfCancellationRequested(); var referenceLocation = ts.getTouchingPropertyName(sourceFile, position); @@ -48695,12 +54662,12 @@ var ts; if (referenceSymbol) { var referenceSymbolDeclaration = referenceSymbol.valueDeclaration; var shorthandValueSymbol = typeChecker.getShorthandAssignmentValueSymbol(referenceSymbolDeclaration); - var relatedSymbol = getRelatedSymbol(searchSymbols, referenceSymbol, referenceLocation); + var relatedSymbol = getRelatedSymbol(searchSymbols_1, referenceSymbol, referenceLocation); if (relatedSymbol) { var referencedSymbol = getReferencedSymbol(relatedSymbol); referencedSymbol.references.push(getReferenceEntryFromNode(referenceLocation)); } - else if (!(referenceSymbol.flags & 67108864 /* Transient */) && searchSymbols.indexOf(shorthandValueSymbol) >= 0) { + else if (!(referenceSymbol.flags & 67108864 /* Transient */) && searchSymbols_1.indexOf(shorthandValueSymbol) >= 0) { var referencedSymbol = getReferencedSymbol(shorthandValueSymbol); referencedSymbol.references.push(getReferenceEntryFromNode(referenceSymbolDeclaration.name)); } @@ -48730,20 +54697,20 @@ var ts; } } function getReferencesForSuperKeyword(superKeyword) { - var searchSpaceNode = ts.getSuperContainer(superKeyword, /*includeFunctions*/ false); + var searchSpaceNode = ts.getSuperContainer(superKeyword, /*stopOnFunctions*/ false); if (!searchSpaceNode) { return undefined; } // Whether 'super' occurs in a static context within a class. - var staticFlag = 64 /* Static */; + var staticFlag = 32 /* Static */; switch (searchSpaceNode.kind) { - case 141 /* PropertyDeclaration */: - case 140 /* PropertySignature */: - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - case 144 /* Constructor */: - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: + case 145 /* PropertyDeclaration */: + case 144 /* PropertySignature */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: + case 148 /* Constructor */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: staticFlag &= searchSpaceNode.flags; searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class break; @@ -48759,11 +54726,11 @@ var ts; if (!node || node.kind !== 95 /* SuperKeyword */) { return; } - var container = ts.getSuperContainer(node, /*includeFunctions*/ false); + var container = ts.getSuperContainer(node, /*stopOnFunctions*/ false); // If we have a 'super' container, we must have an enclosing class. // Now make sure the owning class is the same as the search-space // and has the same static qualifier as the original 'super's owner. - if (container && (64 /* Static */ & container.flags) === staticFlag && container.parent.symbol === searchSpaceNode.symbol) { + if (container && (32 /* Static */ & container.flags) === staticFlag && container.parent.symbol === searchSpaceNode.symbol) { references.push(getReferenceEntryFromNode(node)); } }); @@ -48773,29 +54740,29 @@ var ts; function getReferencesForThisKeyword(thisOrSuperKeyword, sourceFiles) { var searchSpaceNode = ts.getThisContainer(thisOrSuperKeyword, /* includeArrowFunctions */ false); // Whether 'this' occurs in a static context within a class. - var staticFlag = 64 /* Static */; + var staticFlag = 32 /* Static */; switch (searchSpaceNode.kind) { - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: if (ts.isObjectLiteralMethod(searchSpaceNode)) { break; } // fall through - case 141 /* PropertyDeclaration */: - case 140 /* PropertySignature */: - case 144 /* Constructor */: - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: + case 145 /* PropertyDeclaration */: + case 144 /* PropertySignature */: + case 148 /* Constructor */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: staticFlag &= searchSpaceNode.flags; searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class break; - case 248 /* SourceFile */: + case 256 /* SourceFile */: if (ts.isExternalModule(searchSpaceNode)) { return undefined; } // Fall through - case 213 /* FunctionDeclaration */: - case 173 /* FunctionExpression */: + case 220 /* FunctionDeclaration */: + case 179 /* FunctionExpression */: break; // Computed properties in classes are not handled here because references to this are illegal, // so there is no point finding references to them. @@ -48804,7 +54771,7 @@ var ts; } var references = []; var possiblePositions; - if (searchSpaceNode.kind === 248 /* SourceFile */) { + if (searchSpaceNode.kind === 256 /* SourceFile */) { ts.forEach(sourceFiles, function (sourceFile) { possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", sourceFile.getStart(), sourceFile.getEnd()); getThisReferencesInFile(sourceFile, sourceFile, possiblePositions, references); @@ -48830,33 +54797,33 @@ var ts; ts.forEach(possiblePositions, function (position) { cancellationToken.throwIfCancellationRequested(); var node = ts.getTouchingWord(sourceFile, position); - if (!node || node.kind !== 97 /* ThisKeyword */) { + if (!node || (node.kind !== 97 /* ThisKeyword */ && node.kind !== 165 /* ThisType */)) { return; } var container = ts.getThisContainer(node, /* includeArrowFunctions */ false); switch (searchSpaceNode.kind) { - case 173 /* FunctionExpression */: - case 213 /* FunctionDeclaration */: + case 179 /* FunctionExpression */: + case 220 /* FunctionDeclaration */: if (searchSpaceNode.symbol === container.symbol) { result.push(getReferenceEntryFromNode(node)); } break; - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: if (ts.isObjectLiteralMethod(searchSpaceNode) && searchSpaceNode.symbol === container.symbol) { result.push(getReferenceEntryFromNode(node)); } break; - case 186 /* ClassExpression */: - case 214 /* ClassDeclaration */: + case 192 /* ClassExpression */: + case 221 /* ClassDeclaration */: // Make sure the container belongs to the same class // and has the appropriate static modifier from the original container. - if (container.parent && searchSpaceNode.symbol === container.parent.symbol && (container.flags & 64 /* Static */) === staticFlag) { + if (container.parent && searchSpaceNode.symbol === container.parent.symbol && (container.flags & 32 /* Static */) === staticFlag) { result.push(getReferenceEntryFromNode(node)); } break; - case 248 /* SourceFile */: - if (container.kind === 248 /* SourceFile */ && !ts.isExternalModule(container)) { + case 256 /* SourceFile */: + if (container.kind === 256 /* SourceFile */ && !ts.isExternalModule(container)) { result.push(getReferenceEntryFromNode(node)); } break; @@ -48864,18 +54831,78 @@ var ts; }); } } + function getReferencesForStringLiteral(node, sourceFiles) { + var typeChecker = program.getTypeChecker(); + var type = getStringLiteralTypeForNode(node, typeChecker); + if (!type) { + // nothing to do here. moving on + return undefined; + } + var references = []; + for (var _i = 0, sourceFiles_5 = sourceFiles; _i < sourceFiles_5.length; _i++) { + var sourceFile = sourceFiles_5[_i]; + var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, type.text, sourceFile.getStart(), sourceFile.getEnd()); + getReferencesForStringLiteralInFile(sourceFile, type, possiblePositions, references); + } + return [{ + definition: { + containerKind: "", + containerName: "", + fileName: node.getSourceFile().fileName, + kind: ScriptElementKind.variableElement, + name: type.text, + textSpan: ts.createTextSpanFromBounds(node.getStart(), node.getEnd()) + }, + references: references + }]; + function getReferencesForStringLiteralInFile(sourceFile, searchType, possiblePositions, references) { + for (var _i = 0, possiblePositions_1 = possiblePositions; _i < possiblePositions_1.length; _i++) { + var position = possiblePositions_1[_i]; + cancellationToken.throwIfCancellationRequested(); + var node_2 = ts.getTouchingWord(sourceFile, position); + if (!node_2 || node_2.kind !== 9 /* StringLiteral */) { + return; + } + var type_1 = getStringLiteralTypeForNode(node_2, typeChecker); + if (type_1 === searchType) { + references.push(getReferenceEntryFromNode(node_2)); + } + } + } + } function populateSearchSymbolSet(symbol, location) { // The search set contains at least the current symbol var result = [symbol]; - // If the symbol is an alias, add what it alaises to the list - if (isImportOrExportSpecifierImportSymbol(symbol)) { - result.push(typeChecker.getAliasedSymbol(symbol)); + // If the location is name of property symbol from object literal destructuring pattern + // Search the property symbol + // for ( { property: p2 } of elems) { } + var containingObjectLiteralElement = getContainingObjectLiteralElement(location); + if (containingObjectLiteralElement && containingObjectLiteralElement.kind !== 254 /* ShorthandPropertyAssignment */) { + var propertySymbol = getPropertySymbolOfDestructuringAssignment(location); + if (propertySymbol) { + result.push(propertySymbol); + } + } + // If the symbol is an alias, add what it aliases to the list + // import {a} from "mod"; + // export {a} + // If the symbol is an alias to default declaration, add what it aliases to the list + // declare "mod" { export default class B { } } + // import B from "mod"; + //// For export specifiers, the exported name can be referring to a local symbol, e.g.: + //// import {a} from "mod"; + //// export {a as somethingElse} + //// We want the *local* declaration of 'a' as declared in the import, + //// *not* as declared within "mod" (or farther) + var aliasSymbol = getAliasSymbolForPropertyNameSymbol(symbol, location); + if (aliasSymbol) { + result = result.concat(populateSearchSymbolSet(aliasSymbol, location)); } // If the location is in a context sensitive location (i.e. in an object literal) try // to get a contextual type for it, and add the property symbol from the contextual // type to the search set - if (isNameOfPropertyAssignment(location)) { - ts.forEach(getPropertySymbolsFromContextualType(location), function (contextualSymbol) { + if (containingObjectLiteralElement) { + ts.forEach(getPropertySymbolsFromContextualType(containingObjectLiteralElement), function (contextualSymbol) { ts.addRange(result, typeChecker.getRootSymbols(contextualSymbol)); }); /* Because in short-hand property assignment, location has two meaning : property name and as value of the property @@ -48883,8 +54910,8 @@ var ts; * property name and variable declaration of the identifier. * Like in below example, when querying for all references for an identifier 'name', of the property assignment, the language service * should show both 'name' in 'obj' and 'name' in variable declaration - * let name = "Foo"; - * let obj = { name }; + * const name = "Foo"; + * const obj = { name }; * In order to do that, we will populate the search set with the value symbol of the identifier as a value of the property assignment * so that when matching with potential reference symbol, both symbols from property declaration and variable declaration * will be included correctly. @@ -48894,6 +54921,20 @@ var ts; result.push(shorthandValueSymbol); } } + // If the symbol.valueDeclaration is a property parameter declaration, + // we should include both parameter declaration symbol and property declaration symbol + // Parameter Declaration symbol is only visible within function scope, so the symbol is stored in constructor.locals. + // Property Declaration symbol is a member of the class, so the symbol is stored in its class Declaration.symbol.members + if (symbol.valueDeclaration && symbol.valueDeclaration.kind === 142 /* Parameter */ && + ts.isParameterPropertyDeclaration(symbol.valueDeclaration)) { + result = result.concat(typeChecker.getSymbolsOfParameterPropertyDeclaration(symbol.valueDeclaration, symbol.name)); + } + // If this is symbol of binding element without propertyName declaration in Object binding pattern + // Include the property in the search + var bindingElementPropertySymbol = getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol); + if (bindingElementPropertySymbol) { + result.push(bindingElementPropertySymbol); + } // If this is a union property, add all the symbols from all its source symbols in all unioned types. // If the symbol is an instantiation from a another symbol (e.g. widened symbol) , add the root the list ts.forEach(typeChecker.getRootSymbols(symbol), function (rootSymbol) { @@ -48902,19 +54943,44 @@ var ts; } // Add symbol of properties/methods of the same name in base classes and implemented interfaces definitions if (rootSymbol.parent && rootSymbol.parent.flags & (32 /* Class */ | 64 /* Interface */)) { - getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result); + getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result, /*previousIterationSymbolsCache*/ {}); } }); return result; } - function getPropertySymbolsFromBaseTypes(symbol, propertyName, result) { - if (symbol && symbol.flags & (32 /* Class */ | 64 /* Interface */)) { + /** + * Find symbol of the given property-name and add the symbol to the given result array + * @param symbol a symbol to start searching for the given propertyName + * @param propertyName a name of property to search for + * @param result an array of symbol of found property symbols + * @param previousIterationSymbolsCache a cache of symbol from previous iterations of calling this function to prevent infinite revisiting of the same symbol. + * The value of previousIterationSymbol is undefined when the function is first called. + */ + function getPropertySymbolsFromBaseTypes(symbol, propertyName, result, previousIterationSymbolsCache) { + if (!symbol) { + return; + } + // If the current symbol is the same as the previous-iteration symbol, we can just return the symbol that has already been visited + // This is particularly important for the following cases, so that we do not infinitely visit the same symbol. + // For example: + // interface C extends C { + // /*findRef*/propName: string; + // } + // The first time getPropertySymbolsFromBaseTypes is called when finding-all-references at propName, + // the symbol argument will be the symbol of an interface "C" and previousIterationSymbol is undefined, + // the function will add any found symbol of the property-name, then its sub-routine will call + // getPropertySymbolsFromBaseTypes again to walk up any base types to prevent revisiting already + // visited symbol, interface "C", the sub-routine will pass the current symbol as previousIterationSymbol. + if (ts.hasProperty(previousIterationSymbolsCache, symbol.name)) { + return; + } + if (symbol.flags & (32 /* Class */ | 64 /* Interface */)) { ts.forEach(symbol.getDeclarations(), function (declaration) { - if (declaration.kind === 214 /* ClassDeclaration */) { + if (ts.isClassLike(declaration)) { getPropertySymbolFromTypeReference(ts.getClassExtendsHeritageClauseElement(declaration)); ts.forEach(ts.getClassImplementsHeritageClauseElements(declaration), getPropertySymbolFromTypeReference); } - else if (declaration.kind === 215 /* InterfaceDeclaration */) { + else if (declaration.kind === 222 /* InterfaceDeclaration */) { ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), getPropertySymbolFromTypeReference); } }); @@ -48926,10 +54992,11 @@ var ts; if (type) { var propertySymbol = typeChecker.getPropertyOfType(type, propertyName); if (propertySymbol) { - result.push(propertySymbol); + result.push.apply(result, typeChecker.getRootSymbols(propertySymbol)); } // Visit the typeReference as well to see if it directly or indirectly use that property - getPropertySymbolsFromBaseTypes(type.symbol, propertyName, result); + previousIterationSymbolsCache[symbol.name] = symbol; + getPropertySymbolsFromBaseTypes(type.symbol, propertyName, result, previousIterationSymbolsCache); } } } @@ -48939,20 +55006,37 @@ var ts; return referenceSymbol; } // If the reference symbol is an alias, check if what it is aliasing is one of the search - // symbols. - if (isImportOrExportSpecifierImportSymbol(referenceSymbol)) { - var aliasedSymbol = typeChecker.getAliasedSymbol(referenceSymbol); - if (searchSymbols.indexOf(aliasedSymbol) >= 0) { - return aliasedSymbol; - } + // symbols but by looking up for related symbol of this alias so it can handle multiple level of indirectness. + var aliasSymbol = getAliasSymbolForPropertyNameSymbol(referenceSymbol, referenceLocation); + if (aliasSymbol) { + return getRelatedSymbol(searchSymbols, aliasSymbol, referenceLocation); } // If the reference location is in an object literal, try to get the contextual type for the // object literal, lookup the property symbol in the contextual type, and use this symbol to // compare to our searchSymbol - if (isNameOfPropertyAssignment(referenceLocation)) { - return ts.forEach(getPropertySymbolsFromContextualType(referenceLocation), function (contextualSymbol) { + var containingObjectLiteralElement = getContainingObjectLiteralElement(referenceLocation); + if (containingObjectLiteralElement) { + var contextualSymbol = ts.forEach(getPropertySymbolsFromContextualType(containingObjectLiteralElement), function (contextualSymbol) { return ts.forEach(typeChecker.getRootSymbols(contextualSymbol), function (s) { return searchSymbols.indexOf(s) >= 0 ? s : undefined; }); }); + if (contextualSymbol) { + return contextualSymbol; + } + // If the reference location is the name of property from object literal destructuring pattern + // Get the property symbol from the object literal's type and look if thats the search symbol + // In below eg. get 'property' from type of elems iterating type + // for ( { property: p2 } of elems) { } + var propertySymbol = getPropertySymbolOfDestructuringAssignment(referenceLocation); + if (propertySymbol && searchSymbols.indexOf(propertySymbol) >= 0) { + return propertySymbol; + } + } + // If the reference location is the binding element and doesn't have property name + // then include the binding element in the related symbols + // let { a } : { a }; + var bindingElementPropertySymbol = getPropertySymbolOfObjectBindingPatternWithoutPropertyName(referenceSymbol); + if (bindingElementPropertySymbol && searchSymbols.indexOf(bindingElementPropertySymbol) >= 0) { + return bindingElementPropertySymbol; } // Unwrap symbols to get to the root (e.g. transient symbols as a result of widening) // Or a union property, use its underlying unioned symbols @@ -48964,44 +55048,43 @@ var ts; // Finally, try all properties with the same name in any type the containing type extended or implemented, and // see if any is in the list if (rootSymbol.parent && rootSymbol.parent.flags & (32 /* Class */ | 64 /* Interface */)) { - var result_3 = []; - getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result_3); - return ts.forEach(result_3, function (s) { return searchSymbols.indexOf(s) >= 0 ? s : undefined; }); + var result_4 = []; + getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result_4, /*previousIterationSymbolsCache*/ {}); + return ts.forEach(result_4, function (s) { return searchSymbols.indexOf(s) >= 0 ? s : undefined; }); } return undefined; }); } - function getPropertySymbolsFromContextualType(node) { - if (isNameOfPropertyAssignment(node)) { - var objectLiteral = node.parent.parent; - var contextualType = typeChecker.getContextualType(objectLiteral); - var name_37 = node.text; - if (contextualType) { - if (contextualType.flags & 16384 /* Union */) { - // This is a union type, first see if the property we are looking for is a union property (i.e. exists in all types) - // if not, search the constituent types for the property - var unionProperty = contextualType.getProperty(name_37); - if (unionProperty) { - return [unionProperty]; - } - else { - var result_4 = []; - ts.forEach(contextualType.types, function (t) { - var symbol = t.getProperty(name_37); - if (symbol) { - result_4.push(symbol); - } - }); - return result_4; - } - } - else { - var symbol_1 = contextualType.getProperty(name_37); - if (symbol_1) { - return [symbol_1]; - } - } + function getNameFromObjectLiteralElement(node) { + if (node.name.kind === 140 /* ComputedPropertyName */) { + var nameExpression = node.name.expression; + // treat computed property names where expression is string/numeric literal as just string/numeric literal + if (ts.isStringOrNumericLiteral(nameExpression.kind)) { + return nameExpression.text; } + return undefined; + } + return node.name.text; + } + function getPropertySymbolsFromContextualType(node) { + var objectLiteral = node.parent; + var contextualType = typeChecker.getContextualType(objectLiteral); + var name = getNameFromObjectLiteralElement(node); + if (name && contextualType) { + var result_5 = []; + var symbol_1 = contextualType.getProperty(name); + if (symbol_1) { + result_5.push(symbol_1); + } + if (contextualType.flags & 16384 /* Union */) { + ts.forEach(contextualType.types, function (t) { + var symbol = t.getProperty(name); + if (symbol) { + result_5.push(symbol); + } + }); + } + return result_5; } return undefined; } @@ -49014,7 +55097,7 @@ var ts; */ function getIntersectingMeaningFromDeclarations(meaning, declarations) { if (declarations) { - var lastIterationMeaning; + var lastIterationMeaning = void 0; do { // The result is order-sensitive, for instance if initialMeaning === Namespace, and declarations = [class, instantiated module] // we need to consider both as they initialMeaning intersects with the module in the namespace space, and the module @@ -49022,8 +55105,8 @@ var ts; // To achieve that we will keep iterating until the result stabilizes. // Remember the last meaning lastIterationMeaning = meaning; - for (var _i = 0, declarations_9 = declarations; _i < declarations_9.length; _i++) { - var declaration = declarations_9[_i]; + for (var _i = 0, declarations_10 = declarations; _i < declarations_10.length; _i++) { + var declaration = declarations_10[_i]; var declarationMeaning = getMeaningFromDeclaration(declaration); if (declarationMeaning & meaning) { meaning |= declarationMeaning; @@ -49054,10 +55137,10 @@ var ts; } var parent = node.parent; if (parent) { - if (parent.kind === 180 /* PostfixUnaryExpression */ || parent.kind === 179 /* PrefixUnaryExpression */) { + if (parent.kind === 186 /* PostfixUnaryExpression */ || parent.kind === 185 /* PrefixUnaryExpression */) { return true; } - else if (parent.kind === 181 /* BinaryExpression */ && parent.left === node) { + else if (parent.kind === 187 /* BinaryExpression */ && parent.left === node) { var operator = parent.operatorToken.kind; return 56 /* FirstAssignment */ <= operator && operator <= 68 /* LastAssignment */; } @@ -49069,9 +55152,6 @@ var ts; synchronizeHostData(); return ts.NavigateTo.getNavigateToItems(program, cancellationToken, searchValue, maxResultCount); } - function containErrors(diagnostics) { - return ts.forEach(diagnostics, function (diagnostic) { return diagnostic.category === ts.DiagnosticCategory.Error; }); - } function getEmitOutput(fileName) { synchronizeHostData(); var sourceFile = getValidSourceFile(fileName); @@ -49091,34 +55171,34 @@ var ts; } function getMeaningFromDeclaration(node) { switch (node.kind) { - case 138 /* Parameter */: - case 211 /* VariableDeclaration */: - case 163 /* BindingElement */: - case 141 /* PropertyDeclaration */: - case 140 /* PropertySignature */: - case 245 /* PropertyAssignment */: - case 246 /* ShorthandPropertyAssignment */: - case 247 /* EnumMember */: - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - case 144 /* Constructor */: - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: - case 213 /* FunctionDeclaration */: - case 173 /* FunctionExpression */: - case 174 /* ArrowFunction */: - case 244 /* CatchClause */: + case 142 /* Parameter */: + case 218 /* VariableDeclaration */: + case 169 /* BindingElement */: + case 145 /* PropertyDeclaration */: + case 144 /* PropertySignature */: + case 253 /* PropertyAssignment */: + case 254 /* ShorthandPropertyAssignment */: + case 255 /* EnumMember */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: + case 148 /* Constructor */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: + case 220 /* FunctionDeclaration */: + case 179 /* FunctionExpression */: + case 180 /* ArrowFunction */: + case 252 /* CatchClause */: return 1 /* Value */; - case 137 /* TypeParameter */: - case 215 /* InterfaceDeclaration */: - case 216 /* TypeAliasDeclaration */: - case 155 /* TypeLiteral */: + case 141 /* TypeParameter */: + case 222 /* InterfaceDeclaration */: + case 223 /* TypeAliasDeclaration */: + case 159 /* TypeLiteral */: return 2 /* Type */; - case 214 /* ClassDeclaration */: - case 217 /* EnumDeclaration */: + case 221 /* ClassDeclaration */: + case 224 /* EnumDeclaration */: return 1 /* Value */ | 2 /* Type */; - case 218 /* ModuleDeclaration */: - if (node.name.kind === 9 /* StringLiteral */) { + case 225 /* ModuleDeclaration */: + if (ts.isAmbientModule(node)) { return 4 /* Namespace */ | 1 /* Value */; } else if (ts.getModuleInstanceState(node) === 1 /* Instantiated */) { @@ -49127,15 +55207,15 @@ var ts; else { return 4 /* Namespace */; } - case 225 /* NamedImports */: - case 226 /* ImportSpecifier */: - case 221 /* ImportEqualsDeclaration */: - case 222 /* ImportDeclaration */: - case 227 /* ExportAssignment */: - case 228 /* ExportDeclaration */: + case 233 /* NamedImports */: + case 234 /* ImportSpecifier */: + case 229 /* ImportEqualsDeclaration */: + case 230 /* ImportDeclaration */: + case 235 /* ExportAssignment */: + case 236 /* ExportDeclaration */: return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; // An external module can be a Value - case 248 /* SourceFile */: + case 256 /* SourceFile */: return 4 /* Namespace */ | 1 /* Value */; } return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; @@ -49144,9 +55224,10 @@ var ts; if (ts.isRightSideOfQualifiedNameOrPropertyAccess(node)) { node = node.parent; } - return node.parent.kind === 151 /* TypeReference */ || - (node.parent.kind === 188 /* ExpressionWithTypeArguments */ && !ts.isExpressionWithTypeArgumentsInClassExtendsClause(node.parent)) || - node.kind === 97 /* ThisKeyword */ && !ts.isExpression(node); + return node.parent.kind === 155 /* TypeReference */ || + (node.parent.kind === 194 /* ExpressionWithTypeArguments */ && !ts.isExpressionWithTypeArgumentsInClassExtendsClause(node.parent)) || + (node.kind === 97 /* ThisKeyword */ && !ts.isExpression(node)) || + node.kind === 165 /* ThisType */; } function isNamespaceReference(node) { return isQualifiedNameNamespaceReference(node) || isPropertyAccessNamespaceReference(node); @@ -49154,32 +55235,32 @@ var ts; function isPropertyAccessNamespaceReference(node) { var root = node; var isLastClause = true; - if (root.parent.kind === 166 /* PropertyAccessExpression */) { - while (root.parent && root.parent.kind === 166 /* PropertyAccessExpression */) { + if (root.parent.kind === 172 /* PropertyAccessExpression */) { + while (root.parent && root.parent.kind === 172 /* PropertyAccessExpression */) { root = root.parent; } isLastClause = root.name === node; } - if (!isLastClause && root.parent.kind === 188 /* ExpressionWithTypeArguments */ && root.parent.parent.kind === 243 /* HeritageClause */) { + if (!isLastClause && root.parent.kind === 194 /* ExpressionWithTypeArguments */ && root.parent.parent.kind === 251 /* HeritageClause */) { var decl = root.parent.parent.parent; - return (decl.kind === 214 /* ClassDeclaration */ && root.parent.parent.token === 106 /* ImplementsKeyword */) || - (decl.kind === 215 /* InterfaceDeclaration */ && root.parent.parent.token === 83 /* ExtendsKeyword */); + return (decl.kind === 221 /* ClassDeclaration */ && root.parent.parent.token === 106 /* ImplementsKeyword */) || + (decl.kind === 222 /* InterfaceDeclaration */ && root.parent.parent.token === 83 /* ExtendsKeyword */); } return false; } function isQualifiedNameNamespaceReference(node) { var root = node; var isLastClause = true; - if (root.parent.kind === 135 /* QualifiedName */) { - while (root.parent && root.parent.kind === 135 /* QualifiedName */) { + if (root.parent.kind === 139 /* QualifiedName */) { + while (root.parent && root.parent.kind === 139 /* QualifiedName */) { root = root.parent; } isLastClause = root.right === node; } - return root.parent.kind === 151 /* TypeReference */ && !isLastClause; + return root.parent.kind === 155 /* TypeReference */ && !isLastClause; } function isInRightSideOfImport(node) { - while (node.parent.kind === 135 /* QualifiedName */) { + while (node.parent.kind === 139 /* QualifiedName */) { node = node.parent; } return ts.isInternalModuleImportEqualsDeclaration(node.parent) && node.parent.moduleReference === node; @@ -49189,15 +55270,15 @@ var ts; // import a = |b|; // Namespace // import a = |b.c|; // Value, type, namespace // import a = |b.c|.d; // Namespace - if (node.parent.kind === 135 /* QualifiedName */ && + if (node.parent.kind === 139 /* QualifiedName */ && node.parent.right === node && - node.parent.parent.kind === 221 /* ImportEqualsDeclaration */) { + node.parent.parent.kind === 229 /* ImportEqualsDeclaration */) { return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; } return 4 /* Namespace */; } function getMeaningFromLocation(node) { - if (node.parent.kind === 227 /* ExportAssignment */) { + if (node.parent.kind === 235 /* ExportAssignment */) { return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; } else if (isInRightSideOfImport(node)) { @@ -49226,25 +55307,27 @@ var ts; return ts.SignatureHelp.getSignatureHelpItems(program, sourceFile, position, cancellationToken); } /// Syntactic features - function getSourceFile(fileName) { + function getNonBoundSourceFile(fileName) { return syntaxTreeCache.getCurrentSourceFile(fileName); } function getNameOrDottedNameSpan(fileName, startPos, endPos) { var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); // Get node at the location var node = ts.getTouchingPropertyName(sourceFile, startPos); - if (!node) { + if (node === sourceFile) { return; } switch (node.kind) { - case 166 /* PropertyAccessExpression */: - case 135 /* QualifiedName */: + case 172 /* PropertyAccessExpression */: + case 139 /* QualifiedName */: case 9 /* StringLiteral */: + case 166 /* StringLiteralType */: case 84 /* FalseKeyword */: case 99 /* TrueKeyword */: case 93 /* NullKeyword */: case 95 /* SuperKeyword */: case 97 /* ThisKeyword */: + case 165 /* ThisType */: case 69 /* Identifier */: break; // Cant create the text span @@ -49261,7 +55344,7 @@ var ts; // If this is name of a module declarations, check if this is right side of dotted module name // If parent of the module declaration which is parent of this node is module declaration and its body is the module declaration that this node is name of // Then this name is name from dotted module - if (nodeForStartPos.parent.parent.kind === 218 /* ModuleDeclaration */ && + if (nodeForStartPos.parent.parent.kind === 225 /* ModuleDeclaration */ && nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { // Use parent module declarations name for start pos nodeForStartPos = nodeForStartPos.parent.parent.name; @@ -49285,7 +55368,7 @@ var ts; } function getNavigationBarItems(fileName) { var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); - return ts.NavigationBar.getNavigationBarItems(sourceFile); + return ts.NavigationBar.getNavigationBarItems(sourceFile, host.getCompilationSettings()); } function getSemanticClassifications(fileName, span) { return convertClassifications(getEncodedSemanticClassifications(fileName, span)); @@ -49302,10 +55385,10 @@ var ts; // That means we're calling back into the host around every 1.2k of the file we process. // Lib.d.ts has similar numbers. switch (kind) { - case 218 /* ModuleDeclaration */: - case 214 /* ClassDeclaration */: - case 215 /* InterfaceDeclaration */: - case 213 /* FunctionDeclaration */: + case 225 /* ModuleDeclaration */: + case 221 /* ClassDeclaration */: + case 222 /* InterfaceDeclaration */: + case 220 /* FunctionDeclaration */: cancellationToken.throwIfCancellationRequested(); } } @@ -49359,7 +55442,7 @@ var ts; */ function hasValueSideModule(symbol) { return ts.forEach(symbol.declarations, function (declaration) { - return declaration.kind === 218 /* ModuleDeclaration */ && + return declaration.kind === 225 /* ModuleDeclaration */ && ts.getModuleInstanceState(declaration) === 1 /* Instantiated */; }); } @@ -49410,6 +55493,9 @@ var ts; case 19 /* jsxOpenTagName */: return ClassificationTypeNames.jsxOpenTagName; case 20 /* jsxCloseTagName */: return ClassificationTypeNames.jsxCloseTagName; case 21 /* jsxSelfClosingTagName */: return ClassificationTypeNames.jsxSelfClosingTagName; + case 22 /* jsxAttribute */: return ClassificationTypeNames.jsxAttribute; + case 23 /* jsxText */: return ClassificationTypeNames.jsxText; + case 24 /* jsxAttributeStringLiteralValue */: return ClassificationTypeNames.jsxAttributeStringLiteralValue; } } function convertClassifications(classifications) { @@ -49433,8 +55519,8 @@ var ts; var spanStart = span.start; var spanLength = span.length; // Make a scanner we can get trivia from. - var triviaScanner = ts.createScanner(2 /* Latest */, /*skipTrivia:*/ false, sourceFile.languageVariant, sourceFile.text); - var mergeConflictScanner = ts.createScanner(2 /* Latest */, /*skipTrivia:*/ false, sourceFile.languageVariant, sourceFile.text); + var triviaScanner = ts.createScanner(2 /* Latest */, /*skipTrivia*/ false, sourceFile.languageVariant, sourceFile.text); + var mergeConflictScanner = ts.createScanner(2 /* Latest */, /*skipTrivia*/ false, sourceFile.languageVariant, sourceFile.text); var result = []; processElement(sourceFile); return { spans: result, endOfLineState: 0 /* None */ }; @@ -49517,16 +55603,16 @@ var ts; pushClassification(tag.tagName.pos, tag.tagName.end - tag.tagName.pos, 18 /* docCommentTagName */); pos = tag.tagName.end; switch (tag.kind) { - case 267 /* JSDocParameterTag */: + case 275 /* JSDocParameterTag */: processJSDocParameterTag(tag); break; - case 270 /* JSDocTemplateTag */: + case 278 /* JSDocTemplateTag */: processJSDocTemplateTag(tag); break; - case 269 /* JSDocTypeTag */: + case 277 /* JSDocTypeTag */: processElement(tag.typeExpression); break; - case 268 /* JSDocReturnTag */: + case 276 /* JSDocReturnTag */: processElement(tag.typeExpression); break; } @@ -49563,7 +55649,8 @@ var ts; function classifyDisabledMergeCode(text, start, end) { // Classify the line that the ======= marker is on as a comment. Then just lex // all further tokens and add them to the result. - for (var i = start; i < end; i++) { + var i; + for (i = start; i < end; i++) { if (ts.isLineBreak(text.charCodeAt(i))) { break; } @@ -49583,19 +55670,53 @@ var ts; pushClassification(start, end - start, type); } } - function classifyToken(token) { - if (ts.nodeIsMissing(token)) { - return; + /** + * Returns true if node should be treated as classified and no further processing is required. + * False will mean that node is not classified and traverse routine should recurse into node contents. + */ + function tryClassifyNode(node) { + if (ts.nodeIsMissing(node)) { + return true; } - var tokenStart = classifyLeadingTriviaAndGetTokenStart(token); - var tokenWidth = token.end - tokenStart; + var classifiedElementName = tryClassifyJsxElementName(node); + if (!ts.isToken(node) && node.kind !== 244 /* JsxText */ && classifiedElementName === undefined) { + return false; + } + var tokenStart = node.kind === 244 /* JsxText */ ? node.pos : classifyLeadingTriviaAndGetTokenStart(node); + var tokenWidth = node.end - tokenStart; ts.Debug.assert(tokenWidth >= 0); if (tokenWidth > 0) { - var type = classifyTokenType(token.kind, token); + var type = classifiedElementName || classifyTokenType(node.kind, node); if (type) { pushClassification(tokenStart, tokenWidth, type); } } + return true; + } + function tryClassifyJsxElementName(token) { + switch (token.parent && token.parent.kind) { + case 243 /* JsxOpeningElement */: + if (token.parent.tagName === token) { + return 19 /* jsxOpenTagName */; + } + break; + case 245 /* JsxClosingElement */: + if (token.parent.tagName === token) { + return 20 /* jsxCloseTagName */; + } + break; + case 242 /* JsxSelfClosingElement */: + if (token.parent.tagName === token) { + return 21 /* jsxSelfClosingTagName */; + } + break; + case 246 /* JsxAttribute */: + if (token.parent.name === token) { + return 22 /* jsxAttribute */; + } + break; + } + return undefined; } // for accurate classification, the actual token should be passed in. however, for // cases like 'disabled merge code' classification, we just get the token kind and @@ -49617,16 +55738,17 @@ var ts; if (token) { if (tokenKind === 56 /* EqualsToken */) { // the '=' in a variable declaration is special cased here. - if (token.parent.kind === 211 /* VariableDeclaration */ || - token.parent.kind === 141 /* PropertyDeclaration */ || - token.parent.kind === 138 /* Parameter */) { + if (token.parent.kind === 218 /* VariableDeclaration */ || + token.parent.kind === 145 /* PropertyDeclaration */ || + token.parent.kind === 142 /* Parameter */ || + token.parent.kind === 246 /* JsxAttribute */) { return 5 /* operator */; } } - if (token.parent.kind === 181 /* BinaryExpression */ || - token.parent.kind === 179 /* PrefixUnaryExpression */ || - token.parent.kind === 180 /* PostfixUnaryExpression */ || - token.parent.kind === 182 /* ConditionalExpression */) { + if (token.parent.kind === 187 /* BinaryExpression */ || + token.parent.kind === 185 /* PrefixUnaryExpression */ || + token.parent.kind === 186 /* PostfixUnaryExpression */ || + token.parent.kind === 188 /* ConditionalExpression */) { return 5 /* operator */; } } @@ -49635,8 +55757,8 @@ var ts; else if (tokenKind === 8 /* NumericLiteral */) { return 4 /* numericLiteral */; } - else if (tokenKind === 9 /* StringLiteral */) { - return 6 /* stringLiteral */; + else if (tokenKind === 9 /* StringLiteral */ || tokenKind === 166 /* StringLiteralType */) { + return token.parent.kind === 246 /* JsxAttribute */ ? 24 /* jsxAttributeStringLiteralValue */ : 6 /* stringLiteral */; } else if (tokenKind === 10 /* RegularExpressionLiteral */) { // TODO: we should get another classification type for these literals. @@ -49646,54 +55768,42 @@ var ts; // TODO (drosen): we should *also* get another classification type for these literals. return 6 /* stringLiteral */; } + else if (tokenKind === 244 /* JsxText */) { + return 23 /* jsxText */; + } else if (tokenKind === 69 /* Identifier */) { if (token) { switch (token.parent.kind) { - case 214 /* ClassDeclaration */: + case 221 /* ClassDeclaration */: if (token.parent.name === token) { return 11 /* className */; } return; - case 137 /* TypeParameter */: + case 141 /* TypeParameter */: if (token.parent.name === token) { return 15 /* typeParameterName */; } return; - case 215 /* InterfaceDeclaration */: + case 222 /* InterfaceDeclaration */: if (token.parent.name === token) { return 13 /* interfaceName */; } return; - case 217 /* EnumDeclaration */: + case 224 /* EnumDeclaration */: if (token.parent.name === token) { return 12 /* enumName */; } return; - case 218 /* ModuleDeclaration */: + case 225 /* ModuleDeclaration */: if (token.parent.name === token) { return 14 /* moduleName */; } return; - case 138 /* Parameter */: + case 142 /* Parameter */: if (token.parent.name === token) { return 17 /* parameterName */; } return; - case 235 /* JsxOpeningElement */: - if (token.parent.tagName === token) { - return 19 /* jsxOpenTagName */; - } - return; - case 237 /* JsxClosingElement */: - if (token.parent.tagName === token) { - return 20 /* jsxCloseTagName */; - } - return; - case 234 /* JsxSelfClosingElement */: - if (token.parent.tagName === token) { - return 21 /* jsxSelfClosingTagName */; - } - return; } } return 2 /* identifier */; @@ -49709,10 +55819,7 @@ var ts; var children = element.getChildren(sourceFile); for (var i = 0, n = children.length; i < n; i++) { var child = children[i]; - if (ts.isToken(child)) { - classifyToken(child); - } - else { + if (!tryClassifyNode(child)) { // Recurse into our child nodes. processElement(child); } @@ -49818,7 +55925,6 @@ var ts; * be performed. */ function getDocCommentTemplateAtPosition(fileName, position) { - var start = new Date().getTime(); var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); // Check if in a context where we don't want to perform any insertion if (ts.isInString(sourceFile, position) || ts.isInComment(sourceFile, position) || ts.hasDocComment(sourceFile, position)) { @@ -49837,19 +55943,19 @@ var ts; var commentOwner; findOwner: for (commentOwner = tokenAtPos; commentOwner; commentOwner = commentOwner.parent) { switch (commentOwner.kind) { - case 213 /* FunctionDeclaration */: - case 143 /* MethodDeclaration */: - case 144 /* Constructor */: - case 214 /* ClassDeclaration */: - case 193 /* VariableStatement */: + case 220 /* FunctionDeclaration */: + case 147 /* MethodDeclaration */: + case 148 /* Constructor */: + case 221 /* ClassDeclaration */: + case 200 /* VariableStatement */: break findOwner; - case 248 /* SourceFile */: + case 256 /* SourceFile */: return undefined; - case 218 /* ModuleDeclaration */: + case 225 /* ModuleDeclaration */: // If in walking up the tree, we hit a a nested namespace declaration, // then we must be somewhere within a dotted namespace name; however we don't // want to give back a JSDoc template for the 'b' or 'c' in 'namespace a.b.c { }'. - if (commentOwner.parent.kind === 218 /* ModuleDeclaration */) { + if (commentOwner.parent.kind === 225 /* ModuleDeclaration */) { return undefined; } break findOwner; @@ -49862,8 +55968,7 @@ var ts; var posLineAndChar = sourceFile.getLineAndCharacterOfPosition(position); var lineStart = sourceFile.getLineStarts()[posLineAndChar.line]; var indentationStr = sourceFile.text.substr(lineStart, posLineAndChar.character); - // TODO: call a helper method instead once PR #4133 gets merged in. - var newLine = host.getNewLine ? host.getNewLine() : "\r\n"; + var newLine = ts.getNewLineOrDefaultFromHost(host); var docParams = ""; for (var i = 0, numParams = parameters.length; i < numParams; i++) { var currentName = parameters[i].name; @@ -49887,11 +55992,34 @@ var ts; (tokenStart === position ? newLine + indentationStr : ""); return { newText: result, caretOffset: preamble.length }; } + function isValidBraceCompletionAtPostion(fileName, position, openingBrace) { + // '<' is currently not supported, figuring out if we're in a Generic Type vs. a comparison is too + // expensive to do during typing scenarios + // i.e. whether we're dealing with: + // var x = new foo<| ( with class foo{} ) + // or + // var y = 3 <| + if (openingBrace === 60 /* lessThan */) { + return false; + } + var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); + // Check if in a context where we don't want to perform any insertion + if (ts.isInString(sourceFile, position) || ts.isInComment(sourceFile, position)) { + return false; + } + if (ts.isInsideJsxElementOrAttribute(sourceFile, position)) { + return openingBrace === 123 /* openBrace */; + } + if (ts.isInTemplateString(sourceFile, position)) { + return false; + } + return true; + } function getParametersForJsDocOwningNode(commentOwner) { if (ts.isFunctionLike(commentOwner)) { return commentOwner.parameters; } - if (commentOwner.kind === 193 /* VariableStatement */) { + if (commentOwner.kind === 200 /* VariableStatement */) { var varStatement = commentOwner; var varDeclarations = varStatement.declarationList.declarations; if (varDeclarations.length === 1 && varDeclarations[0].initializer) { @@ -49909,17 +56037,17 @@ var ts; * @returns the parameters of a signature found on the RHS if one exists; otherwise 'emptyArray'. */ function getParametersFromRightHandSideOfAssignment(rightHandSide) { - while (rightHandSide.kind === 172 /* ParenthesizedExpression */) { + while (rightHandSide.kind === 178 /* ParenthesizedExpression */) { rightHandSide = rightHandSide.expression; } switch (rightHandSide.kind) { - case 173 /* FunctionExpression */: - case 174 /* ArrowFunction */: + case 179 /* FunctionExpression */: + case 180 /* ArrowFunction */: return rightHandSide.parameters; - case 186 /* ClassExpression */: + case 192 /* ClassExpression */: for (var _i = 0, _a = rightHandSide.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.kind === 144 /* Constructor */) { + if (member.kind === 148 /* Constructor */) { return member.parameters; } } @@ -49941,7 +56069,7 @@ var ts; var result = []; if (descriptors.length > 0) { var regExp = getTodoCommentsRegExp(); - var matchArray; + var matchArray = void 0; while (matchArray = regExp.exec(fileContents)) { cancellationToken.throwIfCancellationRequested(); // If we got a match, here is what the match array will look like. Say the source text is: @@ -50012,11 +56140,11 @@ var ts; // comment portion. var singleLineCommentStart = /(?:\/\/+\s*)/.source; var multiLineCommentStart = /(?:\/\*+\s*)/.source; - var anyNumberOfSpacesAndAsterixesAtStartOfLine = /(?:^(?:\s|\*)*)/.source; + var anyNumberOfSpacesAndAsterisksAtStartOfLine = /(?:^(?:\s|\*)*)/.source; // Match any of the above three TODO comment start regexps. // Note that the outermost group *is* a capture group. We want to capture the preamble // so that we can determine the starting position of the TODO comment match. - var preamble = "(" + anyNumberOfSpacesAndAsterixesAtStartOfLine + "|" + singleLineCommentStart + "|" + multiLineCommentStart + ")"; + var preamble = "(" + anyNumberOfSpacesAndAsterisksAtStartOfLine + "|" + singleLineCommentStart + "|" + multiLineCommentStart + ")"; // Takes the descriptors and forms a regexp that matches them as if they were literals. // For example, if the descriptors are "TODO(jason)" and "HACK", then this will be: // @@ -50051,42 +56179,68 @@ var ts; (char >= 48 /* _0 */ && char <= 57 /* _9 */); } } + function getStringLiteralTypeForNode(node, typeChecker) { + var searchNode = node.parent.kind === 166 /* StringLiteralType */ ? node.parent : node; + var type = typeChecker.getTypeAtLocation(searchNode); + if (type && type.flags & 256 /* StringLiteral */) { + return type; + } + return undefined; + } function getRenameInfo(fileName, position) { synchronizeHostData(); var sourceFile = getValidSourceFile(fileName); var typeChecker = program.getTypeChecker(); + var defaultLibFileName = host.getDefaultLibFileName(host.getCompilationSettings()); + var canonicalDefaultLibName = getCanonicalFileName(ts.normalizePath(defaultLibFileName)); var node = ts.getTouchingWord(sourceFile, position); // Can only rename an identifier. - if (node && node.kind === 69 /* Identifier */) { - var symbol = typeChecker.getSymbolAtLocation(node); - // Only allow a symbol to be renamed if it actually has at least one declaration. - if (symbol) { - var declarations = symbol.getDeclarations(); - if (declarations && declarations.length > 0) { - // Disallow rename for elements that are defined in the standard TypeScript library. - var defaultLibFileName = host.getDefaultLibFileName(host.getCompilationSettings()); - if (defaultLibFileName) { - for (var _i = 0, declarations_10 = declarations; _i < declarations_10.length; _i++) { - var current = declarations_10[_i]; - var sourceFile_2 = current.getSourceFile(); - var canonicalName = getCanonicalFileName(ts.normalizePath(sourceFile_2.fileName)); - if (sourceFile_2 && getCanonicalFileName(ts.normalizePath(sourceFile_2.fileName)) === getCanonicalFileName(ts.normalizePath(defaultLibFileName))) { - return getRenameInfoError(ts.getLocaleSpecificMessage(ts.Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library)); - } + if (node) { + if (node.kind === 69 /* Identifier */ || + node.kind === 9 /* StringLiteral */ || + isLiteralNameOfPropertyDeclarationOrIndexAccess(node)) { + var symbol = typeChecker.getSymbolAtLocation(node); + // Only allow a symbol to be renamed if it actually has at least one declaration. + if (symbol) { + var declarations = symbol.getDeclarations(); + if (declarations && declarations.length > 0) { + // Disallow rename for elements that are defined in the standard TypeScript library. + if (ts.forEach(declarations, isDefinedInLibraryFile)) { + return getRenameInfoError(ts.getLocaleSpecificMessage(ts.Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library)); + } + var displayName = ts.stripQuotes(ts.getDeclaredName(typeChecker, symbol, node)); + var kind = getSymbolKind(symbol, node); + if (kind) { + return { + canRename: true, + kind: kind, + displayName: displayName, + localizedErrorMessage: undefined, + fullDisplayName: typeChecker.getFullyQualifiedName(symbol), + kindModifiers: getSymbolModifiers(symbol), + triggerSpan: createTriggerSpanForNode(node, sourceFile) + }; } } - var displayName = ts.stripQuotes(ts.getDeclaredName(typeChecker, symbol, node)); - var kind = getSymbolKind(symbol, node); - if (kind) { - return { - canRename: true, - localizedErrorMessage: undefined, - displayName: displayName, - fullDisplayName: typeChecker.getFullyQualifiedName(symbol), - kind: kind, - kindModifiers: getSymbolModifiers(symbol), - triggerSpan: ts.createTextSpan(node.getStart(), node.getWidth()) - }; + } + else if (node.kind === 9 /* StringLiteral */) { + var type = getStringLiteralTypeForNode(node, typeChecker); + if (type) { + if (isDefinedInLibraryFile(node)) { + return getRenameInfoError(ts.getLocaleSpecificMessage(ts.Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library)); + } + else { + var displayName = ts.stripQuotes(type.text); + return { + canRename: true, + kind: ScriptElementKind.variableElement, + displayName: displayName, + localizedErrorMessage: undefined, + fullDisplayName: displayName, + kindModifiers: ScriptElementKindModifier.none, + triggerSpan: createTriggerSpanForNode(node, sourceFile) + }; + } } } } @@ -50103,6 +56257,26 @@ var ts; triggerSpan: undefined }; } + function isDefinedInLibraryFile(declaration) { + if (defaultLibFileName) { + var sourceFile_3 = declaration.getSourceFile(); + var canonicalName = getCanonicalFileName(ts.normalizePath(sourceFile_3.fileName)); + if (canonicalName === canonicalDefaultLibName) { + return true; + } + } + return false; + } + function createTriggerSpanForNode(node, sourceFile) { + var start = node.getStart(sourceFile); + var width = node.getWidth(sourceFile); + if (node.kind === 9 /* StringLiteral */) { + // Exclude the quotes + start += 1; + width -= 2; + } + return ts.createTextSpan(start, width); + } } return { dispose: dispose, @@ -50138,8 +56312,9 @@ var ts; getFormattingEditsForDocument: getFormattingEditsForDocument, getFormattingEditsAfterKeystroke: getFormattingEditsAfterKeystroke, getDocCommentTemplateAtPosition: getDocCommentTemplateAtPosition, + isValidBraceCompletionAtPostion: isValidBraceCompletionAtPostion, getEmitOutput: getEmitOutput, - getSourceFile: getSourceFile, + getNonBoundSourceFile: getNonBoundSourceFile, getProgram: getProgram }; } @@ -50159,7 +56334,7 @@ var ts; function walk(node) { switch (node.kind) { case 69 /* Identifier */: - nameTable[node.text] = node.text; + nameTable[node.text] = nameTable[node.text] === undefined ? node.pos : -1; break; case 9 /* StringLiteral */: case 8 /* NumericLiteral */: @@ -50168,9 +56343,10 @@ var ts; // then we want 'something' to be in the name table. Similarly, if we have // "a['propname']" then we want to store "propname" in the name table. if (ts.isDeclarationName(node) || - node.parent.kind === 232 /* ExternalModuleReference */ || - isArgumentOfElementAccessExpression(node)) { - nameTable[node.text] = node.text; + node.parent.kind === 240 /* ExternalModuleReference */ || + isArgumentOfElementAccessExpression(node) || + ts.isLiteralComputedPropertyDeclarationName(node)) { + nameTable[node.text] = nameTable[node.text] === undefined ? node.pos : -1; } break; default: @@ -50181,7 +56357,7 @@ var ts; function isArgumentOfElementAccessExpression(node) { return node && node.parent && - node.parent.kind === 167 /* ElementAccessExpression */ && + node.parent.kind === 173 /* ElementAccessExpression */ && node.parent.argumentExpression === node; } /// Classifier @@ -50229,7 +56405,7 @@ var ts; function canFollow(keyword1, keyword2) { if (ts.isAccessibilityModifier(keyword1)) { if (keyword2 === 123 /* GetKeyword */ || - keyword2 === 129 /* SetKeyword */ || + keyword2 === 131 /* SetKeyword */ || keyword2 === 121 /* ConstructorKeyword */ || keyword2 === 113 /* StaticKeyword */) { // Allow things like "public get", "public constructor" and "public static". @@ -50310,7 +56486,7 @@ var ts; // (and a newline). That way when we lex we'll think we're still in a multiline comment. switch (lexState) { case 3 /* InDoubleQuoteStringLiteral */: - text = '"\\\n' + text; + text = "\"\\\n" + text; offset = 3; break; case 2 /* InSingleQuoteStringLiteral */: @@ -50388,10 +56564,10 @@ var ts; angleBracketStack--; } else if (token === 117 /* AnyKeyword */ || - token === 130 /* StringKeyword */ || - token === 128 /* NumberKeyword */ || + token === 132 /* StringKeyword */ || + token === 130 /* NumberKeyword */ || token === 120 /* BooleanKeyword */ || - token === 131 /* SymbolKeyword */) { + token === 133 /* SymbolKeyword */) { if (angleBracketStack > 0 && !syntacticClassifierAbsent) { // If it looks like we're could be in something generic, don't classify this // as a keyword. We may just get overwritten by the syntactic classifier, @@ -50440,7 +56616,7 @@ var ts; var end = scanner.getTextPos(); addResult(start, end, classFromKind(token)); if (end >= text.length) { - if (token === 9 /* StringLiteral */) { + if (token === 9 /* StringLiteral */ || token === 166 /* StringLiteralType */) { // Check to see if we finished up on a multiline string literal. var tokenText = scanner.getTokenText(); if (scanner.isUnterminated()) { @@ -50563,7 +56739,7 @@ var ts; } } function isKeyword(token) { - return token >= 70 /* FirstKeyword */ && token <= 134 /* LastKeyword */; + return token >= 70 /* FirstKeyword */ && token <= 138 /* LastKeyword */; } function classFromKind(token) { if (isKeyword(token)) { @@ -50579,6 +56755,7 @@ var ts; case 8 /* NumericLiteral */: return 4 /* numericLiteral */; case 9 /* StringLiteral */: + case 166 /* StringLiteralType */: return 6 /* stringLiteral */; case 10 /* RegularExpressionLiteral */: return 7 /* regularExpressionLiteral */; @@ -50640,19 +56817,19 @@ var ts; */ function spanInSourceFileAtLocation(sourceFile, position) { // Cannot set breakpoint in dts file - if (sourceFile.flags & 4096 /* DeclarationFile */) { + if (sourceFile.isDeclarationFile) { return undefined; } var tokenAtLocation = ts.getTokenAtPosition(sourceFile, position); var lineOfPosition = sourceFile.getLineAndCharacterOfPosition(position).line; - if (sourceFile.getLineAndCharacterOfPosition(tokenAtLocation.getStart()).line > lineOfPosition) { + if (sourceFile.getLineAndCharacterOfPosition(tokenAtLocation.getStart(sourceFile)).line > lineOfPosition) { // Get previous token if the token is returned starts on new line // eg: let x =10; |--- cursor is here // let y = 10; // token at position will return let keyword on second line as the token but we would like to use // token on same line if trailing trivia (comments or white spaces on same line) part of the last token on that line tokenAtLocation = ts.findPrecedingToken(tokenAtLocation.pos, sourceFile); - // Its a blank line + // It's a blank line if (!tokenAtLocation || sourceFile.getLineAndCharacterOfPosition(tokenAtLocation.getEnd()).line !== lineOfPosition) { return undefined; } @@ -50664,14 +56841,23 @@ var ts; // Get the span in the node based on its syntax return spanInNode(tokenAtLocation); function textSpan(startNode, endNode) { - return ts.createTextSpanFromBounds(startNode.getStart(), (endNode || startNode).getEnd()); + var start = startNode.decorators ? + ts.skipTrivia(sourceFile.text, startNode.decorators.end) : + startNode.getStart(sourceFile); + return ts.createTextSpanFromBounds(start, (endNode || startNode).getEnd()); + } + function textSpanEndingAtNextToken(startNode, previousTokenToFindNextEndToken) { + return textSpan(startNode, ts.findNextToken(previousTokenToFindNextEndToken, previousTokenToFindNextEndToken.parent)); } function spanInNodeIfStartsOnSameLine(node, otherwiseOnNode) { - if (node && lineOfPosition === sourceFile.getLineAndCharacterOfPosition(node.getStart()).line) { + if (node && lineOfPosition === sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile)).line) { return spanInNode(node); } return spanInNode(otherwiseOnNode); } + function spanInNodeArray(nodeArray) { + return ts.createTextSpanFromBounds(ts.skipTrivia(sourceFile.text, nodeArray.pos), nodeArray.end); + } function spanInPreviousNode(node) { return spanInNode(ts.findPrecedingToken(node.pos, sourceFile)); } @@ -50680,126 +56866,114 @@ var ts; } function spanInNode(node) { if (node) { - if (ts.isExpression(node)) { - if (node.parent.kind === 197 /* DoStatement */) { - // Set span as if on while keyword - return spanInPreviousNode(node); - } - if (node.parent.kind === 199 /* ForStatement */) { - // For now lets set the span on this expression, fix it later - return textSpan(node); - } - if (node.parent.kind === 181 /* BinaryExpression */ && node.parent.operatorToken.kind === 24 /* CommaToken */) { - // if this is comma expression, the breakpoint is possible in this expression - return textSpan(node); - } - if (node.parent.kind === 174 /* ArrowFunction */ && node.parent.body === node) { - // If this is body of arrow function, it is allowed to have the breakpoint - return textSpan(node); - } - } switch (node.kind) { - case 193 /* VariableStatement */: + case 200 /* VariableStatement */: // Span on first variable declaration return spanInVariableDeclaration(node.declarationList.declarations[0]); - case 211 /* VariableDeclaration */: - case 141 /* PropertyDeclaration */: - case 140 /* PropertySignature */: + case 218 /* VariableDeclaration */: + case 145 /* PropertyDeclaration */: + case 144 /* PropertySignature */: return spanInVariableDeclaration(node); - case 138 /* Parameter */: + case 142 /* Parameter */: return spanInParameterDeclaration(node); - case 213 /* FunctionDeclaration */: - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: - case 144 /* Constructor */: - case 173 /* FunctionExpression */: - case 174 /* ArrowFunction */: + case 220 /* FunctionDeclaration */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: + case 148 /* Constructor */: + case 179 /* FunctionExpression */: + case 180 /* ArrowFunction */: return spanInFunctionDeclaration(node); - case 192 /* Block */: + case 199 /* Block */: if (ts.isFunctionBlock(node)) { return spanInFunctionBlock(node); } // Fall through - case 219 /* ModuleBlock */: + case 226 /* ModuleBlock */: return spanInBlock(node); - case 244 /* CatchClause */: + case 252 /* CatchClause */: return spanInBlock(node.block); - case 195 /* ExpressionStatement */: + case 202 /* ExpressionStatement */: // span on the expression return textSpan(node.expression); - case 204 /* ReturnStatement */: + case 211 /* ReturnStatement */: // span on return keyword and expression if present return textSpan(node.getChildAt(0), node.expression); - case 198 /* WhileStatement */: + case 205 /* WhileStatement */: // Span on while(...) - return textSpan(node, ts.findNextToken(node.expression, node)); - case 197 /* DoStatement */: + return textSpanEndingAtNextToken(node, node.expression); + case 204 /* DoStatement */: // span in statement of the do statement return spanInNode(node.statement); - case 210 /* DebuggerStatement */: + case 217 /* DebuggerStatement */: // span on debugger keyword return textSpan(node.getChildAt(0)); - case 196 /* IfStatement */: + case 203 /* IfStatement */: // set on if(..) span - return textSpan(node, ts.findNextToken(node.expression, node)); - case 207 /* LabeledStatement */: + return textSpanEndingAtNextToken(node, node.expression); + case 214 /* LabeledStatement */: // span in statement return spanInNode(node.statement); - case 203 /* BreakStatement */: - case 202 /* ContinueStatement */: + case 210 /* BreakStatement */: + case 209 /* ContinueStatement */: // On break or continue keyword and label if present return textSpan(node.getChildAt(0), node.label); - case 199 /* ForStatement */: + case 206 /* ForStatement */: return spanInForStatement(node); - case 200 /* ForInStatement */: - case 201 /* ForOfStatement */: - // span on for (a in ...) - return textSpan(node, ts.findNextToken(node.expression, node)); - case 206 /* SwitchStatement */: + case 207 /* ForInStatement */: + // span of for (a in ...) + return textSpanEndingAtNextToken(node, node.expression); + case 208 /* ForOfStatement */: + // span in initializer + return spanInInitializerOfForLike(node); + case 213 /* SwitchStatement */: // span on switch(...) - return textSpan(node, ts.findNextToken(node.expression, node)); - case 241 /* CaseClause */: - case 242 /* DefaultClause */: + return textSpanEndingAtNextToken(node, node.expression); + case 249 /* CaseClause */: + case 250 /* DefaultClause */: // span in first statement of the clause return spanInNode(node.statements[0]); - case 209 /* TryStatement */: + case 216 /* TryStatement */: // span in try block return spanInBlock(node.tryBlock); - case 208 /* ThrowStatement */: + case 215 /* ThrowStatement */: // span in throw ... return textSpan(node, node.expression); - case 227 /* ExportAssignment */: + case 235 /* ExportAssignment */: // span on export = id return textSpan(node, node.expression); - case 221 /* ImportEqualsDeclaration */: + case 229 /* ImportEqualsDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleReference); - case 222 /* ImportDeclaration */: + case 230 /* ImportDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleSpecifier); - case 228 /* ExportDeclaration */: + case 236 /* ExportDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleSpecifier); - case 218 /* ModuleDeclaration */: + case 225 /* ModuleDeclaration */: // span on complete module if it is instantiated if (ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { return undefined; } - case 214 /* ClassDeclaration */: - case 217 /* EnumDeclaration */: - case 247 /* EnumMember */: - case 168 /* CallExpression */: - case 169 /* NewExpression */: + case 221 /* ClassDeclaration */: + case 224 /* EnumDeclaration */: + case 255 /* EnumMember */: + case 169 /* BindingElement */: // span on complete node return textSpan(node); - case 205 /* WithStatement */: + case 212 /* WithStatement */: // span in statement return spanInNode(node.statement); + case 143 /* Decorator */: + return spanInNodeArray(node.parent.decorators); + case 167 /* ObjectBindingPattern */: + case 168 /* ArrayBindingPattern */: + return spanInBindingPattern(node); // No breakpoint in interface, type alias - case 215 /* InterfaceDeclaration */: - case 216 /* TypeAliasDeclaration */: + case 222 /* InterfaceDeclaration */: + case 223 /* TypeAliasDeclaration */: return undefined; // Tokens: case 23 /* SemicolonToken */: @@ -50811,6 +56985,8 @@ var ts; return spanInOpenBraceToken(node); case 16 /* CloseBraceToken */: return spanInCloseBraceToken(node); + case 20 /* CloseBracketToken */: + return spanInCloseBracketToken(node); case 17 /* OpenParenToken */: return spanInOpenParenToken(node); case 18 /* CloseParenToken */: @@ -50827,67 +57003,155 @@ var ts; case 72 /* CatchKeyword */: case 85 /* FinallyKeyword */: return spanInNextNode(node); + case 138 /* OfKeyword */: + return spanInOfKeyword(node); default: + // Destructuring pattern in destructuring assignment + // [a, b, c] of + // [a, b, c] = expression + if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node)) { + return spanInArrayLiteralOrObjectLiteralDestructuringPattern(node); + } + // Set breakpoint on identifier element of destructuring pattern + // a or ...c or d: x from + // [a, b, ...c] or { a, b } or { d: x } from destructuring pattern + if ((node.kind === 69 /* Identifier */ || + node.kind == 191 /* SpreadElementExpression */ || + node.kind === 253 /* PropertyAssignment */ || + node.kind === 254 /* ShorthandPropertyAssignment */) && + ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent)) { + return textSpan(node); + } + if (node.kind === 187 /* BinaryExpression */) { + var binaryExpression = node; + // Set breakpoint in destructuring pattern if its destructuring assignment + // [a, b, c] or {a, b, c} of + // [a, b, c] = expression or + // {a, b, c} = expression + if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(binaryExpression.left)) { + return spanInArrayLiteralOrObjectLiteralDestructuringPattern(binaryExpression.left); + } + if (binaryExpression.operatorToken.kind === 56 /* EqualsToken */ && + ts.isArrayLiteralOrObjectLiteralDestructuringPattern(binaryExpression.parent)) { + // Set breakpoint on assignment expression element of destructuring pattern + // a = expression of + // [a = expression, b, c] = someExpression or + // { a = expression, b, c } = someExpression + return textSpan(node); + } + if (binaryExpression.operatorToken.kind === 24 /* CommaToken */) { + return spanInNode(binaryExpression.left); + } + } + if (ts.isExpression(node)) { + switch (node.parent.kind) { + case 204 /* DoStatement */: + // Set span as if on while keyword + return spanInPreviousNode(node); + case 143 /* Decorator */: + // Set breakpoint on the decorator emit + return spanInNode(node.parent); + case 206 /* ForStatement */: + case 208 /* ForOfStatement */: + return textSpan(node); + case 187 /* BinaryExpression */: + if (node.parent.operatorToken.kind === 24 /* CommaToken */) { + // If this is a comma expression, the breakpoint is possible in this expression + return textSpan(node); + } + break; + case 180 /* ArrowFunction */: + if (node.parent.body === node) { + // If this is body of arrow function, it is allowed to have the breakpoint + return textSpan(node); + } + break; + } + } // If this is name of property assignment, set breakpoint in the initializer - if (node.parent.kind === 245 /* PropertyAssignment */ && node.parent.name === node) { + if (node.parent.kind === 253 /* PropertyAssignment */ && + node.parent.name === node && + !ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.parent)) { return spanInNode(node.parent.initializer); } // Breakpoint in type assertion goes to its operand - if (node.parent.kind === 171 /* TypeAssertionExpression */ && node.parent.type === node) { - return spanInNode(node.parent.expression); + if (node.parent.kind === 177 /* TypeAssertionExpression */ && node.parent.type === node) { + return spanInNextNode(node.parent.type); } // return type of function go to previous token if (ts.isFunctionLike(node.parent) && node.parent.type === node) { return spanInPreviousNode(node); } + // initializer of variable/parameter declaration go to previous node + if ((node.parent.kind === 218 /* VariableDeclaration */ || + node.parent.kind === 142 /* Parameter */)) { + var paramOrVarDecl = node.parent; + if (paramOrVarDecl.initializer === node || + paramOrVarDecl.type === node || + ts.isAssignmentOperator(node.kind)) { + return spanInPreviousNode(node); + } + } + if (node.parent.kind === 187 /* BinaryExpression */) { + var binaryExpression = node.parent; + if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(binaryExpression.left) && + (binaryExpression.right === node || + binaryExpression.operatorToken === node)) { + // If initializer of destructuring assignment move to previous token + return spanInPreviousNode(node); + } + } // Default go to parent to set the breakpoint return spanInNode(node.parent); } } + function textSpanFromVariableDeclaration(variableDeclaration) { + var declarations = variableDeclaration.parent.declarations; + if (declarations && declarations[0] === variableDeclaration) { + // First declaration - include let keyword + return textSpan(ts.findPrecedingToken(variableDeclaration.pos, sourceFile, variableDeclaration.parent), variableDeclaration); + } + else { + // Span only on this declaration + return textSpan(variableDeclaration); + } + } function spanInVariableDeclaration(variableDeclaration) { // If declaration of for in statement, just set the span in parent - if (variableDeclaration.parent.parent.kind === 200 /* ForInStatement */ || - variableDeclaration.parent.parent.kind === 201 /* ForOfStatement */) { + if (variableDeclaration.parent.parent.kind === 207 /* ForInStatement */) { return spanInNode(variableDeclaration.parent.parent); } - var isParentVariableStatement = variableDeclaration.parent.parent.kind === 193 /* VariableStatement */; - var isDeclarationOfForStatement = variableDeclaration.parent.parent.kind === 199 /* ForStatement */ && ts.contains(variableDeclaration.parent.parent.initializer.declarations, variableDeclaration); - var declarations = isParentVariableStatement - ? variableDeclaration.parent.parent.declarationList.declarations - : isDeclarationOfForStatement - ? variableDeclaration.parent.parent.initializer.declarations - : undefined; - // Breakpoint is possible in variableDeclaration only if there is initialization - if (variableDeclaration.initializer || (variableDeclaration.flags & 2 /* Export */)) { - if (declarations && declarations[0] === variableDeclaration) { - if (isParentVariableStatement) { - // First declaration - include let keyword - return textSpan(variableDeclaration.parent, variableDeclaration); - } - else { - ts.Debug.assert(isDeclarationOfForStatement); - // Include let keyword from for statement declarations in the span - return textSpan(ts.findPrecedingToken(variableDeclaration.pos, sourceFile, variableDeclaration.parent), variableDeclaration); - } - } - else { - // Span only on this declaration - return textSpan(variableDeclaration); - } + // If this is a destructuring pattern, set breakpoint in binding pattern + if (ts.isBindingPattern(variableDeclaration.name)) { + return spanInBindingPattern(variableDeclaration.name); } - else if (declarations && declarations[0] !== variableDeclaration) { - // If we cant set breakpoint on this declaration, set it on previous one - var indexOfCurrentDeclaration = ts.indexOf(declarations, variableDeclaration); - return spanInVariableDeclaration(declarations[indexOfCurrentDeclaration - 1]); + // Breakpoint is possible in variableDeclaration only if there is initialization + // or its declaration from 'for of' + if (variableDeclaration.initializer || + (variableDeclaration.flags & 1 /* Export */) || + variableDeclaration.parent.parent.kind === 208 /* ForOfStatement */) { + return textSpanFromVariableDeclaration(variableDeclaration); + } + var declarations = variableDeclaration.parent.declarations; + if (declarations && declarations[0] !== variableDeclaration) { + // If we cannot set breakpoint on this declaration, set it on previous one + // Because the variable declaration may be binding pattern and + // we would like to set breakpoint in last binding element if that's the case, + // use preceding token instead + return spanInNode(ts.findPrecedingToken(variableDeclaration.pos, sourceFile, variableDeclaration.parent)); } } function canHaveSpanInParameterDeclaration(parameter) { // Breakpoint is possible on parameter only if it has initializer, is a rest parameter, or has public or private modifier return !!parameter.initializer || parameter.dotDotDotToken !== undefined || - !!(parameter.flags & 8 /* Public */) || !!(parameter.flags & 16 /* Private */); + !!(parameter.flags & 4 /* Public */) || !!(parameter.flags & 8 /* Private */); } function spanInParameterDeclaration(parameter) { - if (canHaveSpanInParameterDeclaration(parameter)) { + if (ts.isBindingPattern(parameter.name)) { + // Set breakpoint in binding pattern + return spanInBindingPattern(parameter.name); + } + else if (canHaveSpanInParameterDeclaration(parameter)) { return textSpan(parameter); } else { @@ -50904,8 +57168,8 @@ var ts; } } function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) { - return !!(functionDeclaration.flags & 2 /* Export */) || - (functionDeclaration.parent.kind === 214 /* ClassDeclaration */ && functionDeclaration.kind !== 144 /* Constructor */); + return !!(functionDeclaration.flags & 1 /* Export */) || + (functionDeclaration.parent.kind === 221 /* ClassDeclaration */ && functionDeclaration.kind !== 148 /* Constructor */); } function spanInFunctionDeclaration(functionDeclaration) { // No breakpoints in the function signature @@ -50928,34 +57192,39 @@ var ts; } function spanInBlock(block) { switch (block.parent.kind) { - case 218 /* ModuleDeclaration */: + case 225 /* ModuleDeclaration */: if (ts.getModuleInstanceState(block.parent) !== 1 /* Instantiated */) { return undefined; } // Set on parent if on same line otherwise on first statement - case 198 /* WhileStatement */: - case 196 /* IfStatement */: - case 200 /* ForInStatement */: - case 201 /* ForOfStatement */: + case 205 /* WhileStatement */: + case 203 /* IfStatement */: + case 207 /* ForInStatement */: return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]); // Set span on previous token if it starts on same line otherwise on the first statement of the block - case 199 /* ForStatement */: + case 206 /* ForStatement */: + case 208 /* ForOfStatement */: return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(block.pos, sourceFile, block.parent), block.statements[0]); } // Default action is to set on first statement return spanInNode(block.statements[0]); } + function spanInInitializerOfForLike(forLikeStatement) { + if (forLikeStatement.initializer.kind === 219 /* VariableDeclarationList */) { + // Declaration list - set breakpoint in first declaration + var variableDeclarationList = forLikeStatement.initializer; + if (variableDeclarationList.declarations.length > 0) { + return spanInNode(variableDeclarationList.declarations[0]); + } + } + else { + // Expression - set breakpoint in it + return spanInNode(forLikeStatement.initializer); + } + } function spanInForStatement(forStatement) { if (forStatement.initializer) { - if (forStatement.initializer.kind === 212 /* VariableDeclarationList */) { - var variableDeclarationList = forStatement.initializer; - if (variableDeclarationList.declarations.length > 0) { - return spanInNode(variableDeclarationList.declarations[0]); - } - } - else { - return spanInNode(forStatement.initializer); - } + return spanInInitializerOfForLike(forStatement); } if (forStatement.condition) { return textSpan(forStatement.condition); @@ -50964,16 +57233,44 @@ var ts; return textSpan(forStatement.incrementor); } } + function spanInBindingPattern(bindingPattern) { + // Set breakpoint in first binding element + var firstBindingElement = ts.forEach(bindingPattern.elements, function (element) { return element.kind !== 193 /* OmittedExpression */ ? element : undefined; }); + if (firstBindingElement) { + return spanInNode(firstBindingElement); + } + // Empty binding pattern of binding element, set breakpoint on binding element + if (bindingPattern.parent.kind === 169 /* BindingElement */) { + return textSpan(bindingPattern.parent); + } + // Variable declaration is used as the span + return textSpanFromVariableDeclaration(bindingPattern.parent); + } + function spanInArrayLiteralOrObjectLiteralDestructuringPattern(node) { + ts.Debug.assert(node.kind !== 168 /* ArrayBindingPattern */ && node.kind !== 167 /* ObjectBindingPattern */); + var elements = node.kind === 170 /* ArrayLiteralExpression */ ? + node.elements : + node.properties; + var firstBindingElement = ts.forEach(elements, function (element) { return element.kind !== 193 /* OmittedExpression */ ? element : undefined; }); + if (firstBindingElement) { + return spanInNode(firstBindingElement); + } + // Could be ArrayLiteral from destructuring assignment or + // just nested element in another destructuring assignment + // set breakpoint on assignment when parent is destructuring assignment + // Otherwise set breakpoint for this element + return textSpan(node.parent.kind === 187 /* BinaryExpression */ ? node.parent : node); + } // Tokens: function spanInOpenBraceToken(node) { switch (node.parent.kind) { - case 217 /* EnumDeclaration */: + case 224 /* EnumDeclaration */: var enumDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), enumDeclaration.members.length ? enumDeclaration.members[0] : enumDeclaration.getLastToken(sourceFile)); - case 214 /* ClassDeclaration */: + case 221 /* ClassDeclaration */: var classDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile)); - case 220 /* CaseBlock */: + case 227 /* CaseBlock */: return spanInNodeIfStartsOnSameLine(node.parent.parent, node.parent.clauses[0]); } // Default to parent node @@ -50981,24 +57278,24 @@ var ts; } function spanInCloseBraceToken(node) { switch (node.parent.kind) { - case 219 /* ModuleBlock */: - // If this is not instantiated module block no bp span + case 226 /* ModuleBlock */: + // If this is not an instantiated module block, no bp span if (ts.getModuleInstanceState(node.parent.parent) !== 1 /* Instantiated */) { return undefined; } - case 217 /* EnumDeclaration */: - case 214 /* ClassDeclaration */: + case 224 /* EnumDeclaration */: + case 221 /* ClassDeclaration */: // Span on close brace token return textSpan(node); - case 192 /* Block */: + case 199 /* Block */: if (ts.isFunctionBlock(node.parent)) { // Span on close brace token return textSpan(node); } - // fall through. - case 244 /* CatchClause */: + // fall through + case 252 /* CatchClause */: return spanInNode(ts.lastOrUndefined(node.parent.statements)); - case 220 /* CaseBlock */: + case 227 /* CaseBlock */: // breakpoint in last statement of the last clause var caseBlock = node.parent; var lastClause = ts.lastOrUndefined(caseBlock.clauses); @@ -51006,33 +57303,66 @@ var ts; return spanInNode(ts.lastOrUndefined(lastClause.statements)); } return undefined; + case 167 /* ObjectBindingPattern */: + // Breakpoint in last binding element or binding pattern if it contains no elements + var bindingPattern = node.parent; + return spanInNode(ts.lastOrUndefined(bindingPattern.elements) || bindingPattern); // Default to parent node default: + if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent)) { + // Breakpoint in last binding element or binding pattern if it contains no elements + var objectLiteral = node.parent; + return textSpan(ts.lastOrUndefined(objectLiteral.properties) || objectLiteral); + } + return spanInNode(node.parent); + } + } + function spanInCloseBracketToken(node) { + switch (node.parent.kind) { + case 168 /* ArrayBindingPattern */: + // Breakpoint in last binding element or binding pattern if it contains no elements + var bindingPattern = node.parent; + return textSpan(ts.lastOrUndefined(bindingPattern.elements) || bindingPattern); + default: + if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent)) { + // Breakpoint in last binding element or binding pattern if it contains no elements + var arrayLiteral = node.parent; + return textSpan(ts.lastOrUndefined(arrayLiteral.elements) || arrayLiteral); + } + // Default to parent node return spanInNode(node.parent); } } function spanInOpenParenToken(node) { - if (node.parent.kind === 197 /* DoStatement */) { - // Go to while keyword and do action instead + if (node.parent.kind === 204 /* DoStatement */ || + node.parent.kind === 174 /* CallExpression */ || + node.parent.kind === 175 /* NewExpression */) { return spanInPreviousNode(node); } + if (node.parent.kind === 178 /* ParenthesizedExpression */) { + return spanInNextNode(node); + } // Default to parent node return spanInNode(node.parent); } function spanInCloseParenToken(node) { // Is this close paren token of parameter list, set span in previous token switch (node.parent.kind) { - case 173 /* FunctionExpression */: - case 213 /* FunctionDeclaration */: - case 174 /* ArrowFunction */: - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: - case 144 /* Constructor */: - case 198 /* WhileStatement */: - case 197 /* DoStatement */: - case 199 /* ForStatement */: + case 179 /* FunctionExpression */: + case 220 /* FunctionDeclaration */: + case 180 /* ArrowFunction */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: + case 148 /* Constructor */: + case 205 /* WhileStatement */: + case 204 /* DoStatement */: + case 206 /* ForStatement */: + case 208 /* ForOfStatement */: + case 174 /* CallExpression */: + case 175 /* NewExpression */: + case 178 /* ParenthesizedExpression */: return spanInPreviousNode(node); // Default to parent node default: @@ -51041,21 +57371,31 @@ var ts; } function spanInColonToken(node) { // Is this : specifying return annotation of the function declaration - if (ts.isFunctionLike(node.parent) || node.parent.kind === 245 /* PropertyAssignment */) { + if (ts.isFunctionLike(node.parent) || + node.parent.kind === 253 /* PropertyAssignment */ || + node.parent.kind === 142 /* Parameter */) { return spanInPreviousNode(node); } return spanInNode(node.parent); } function spanInGreaterThanOrLessThanToken(node) { - if (node.parent.kind === 171 /* TypeAssertionExpression */) { - return spanInNode(node.parent.expression); + if (node.parent.kind === 177 /* TypeAssertionExpression */) { + return spanInNextNode(node); } return spanInNode(node.parent); } function spanInWhileKeyword(node) { - if (node.parent.kind === 197 /* DoStatement */) { + if (node.parent.kind === 204 /* DoStatement */) { // Set span on while expression - return textSpan(node, ts.findNextToken(node.parent.expression, node.parent)); + return textSpanEndingAtNextToken(node, node.parent.expression); + } + // Default to parent node + return spanInNode(node.parent); + } + function spanInOfKeyword(node) { + if (node.parent.kind === 208 /* ForOfStatement */) { + // Set using next token + return spanInNextNode(node); } // Default to parent node return spanInNode(node.parent); @@ -51082,6 +57422,9 @@ var ts; /// /* @internal */ var debugObjectHost = this; +// We need to use 'null' to interface with the managed side. +/* tslint:disable:no-null-keyword */ +/* tslint:disable:no-in-operator */ /* @internal */ var ts; (function (ts) { @@ -51093,7 +57436,6 @@ var ts; var ScriptSnapshotShimAdapter = (function () { function ScriptSnapshotShimAdapter(scriptSnapshotShim) { this.scriptSnapshotShim = scriptSnapshotShim; - this.lineStartPositions = null; } ScriptSnapshotShimAdapter.prototype.getText = function (start, end) { return this.scriptSnapshotShim.getText(start, end); @@ -51119,7 +57461,7 @@ var ts; } }; return ScriptSnapshotShimAdapter; - })(); + }()); var LanguageServiceShimHostAdapter = (function () { function LanguageServiceShimHostAdapter(shimHost) { var _this = this; @@ -51137,6 +57479,15 @@ var ts; }); }; } + if ("directoryExists" in this.shimHost) { + this.directoryExists = function (directoryName) { return _this.shimHost.directoryExists(directoryName); }; + } + if ("getTypeReferenceDirectiveResolutionsForFile" in this.shimHost) { + this.resolveTypeReferenceDirectives = function (typeDirectiveNames, containingFile) { + var typeDirectivesForFile = JSON.parse(_this.shimHost.getTypeReferenceDirectiveResolutionsForFile(containingFile)); + return ts.map(typeDirectiveNames, function (name) { return ts.lookUp(typeDirectivesForFile, name); }); + }; + } } LanguageServiceShimHostAdapter.prototype.log = function (s) { if (this.loggingEnabled) { @@ -51174,14 +57525,17 @@ var ts; return this.files = JSON.parse(encoded); }; LanguageServiceShimHostAdapter.prototype.getScriptSnapshot = function (fileName) { - // Shim the API changes for 1.5 release. This should be removed once - // TypeScript 1.5 has shipped. - if (this.files && this.files.indexOf(fileName) < 0) { - return undefined; - } var scriptSnapshot = this.shimHost.getScriptSnapshot(fileName); return scriptSnapshot && new ScriptSnapshotShimAdapter(scriptSnapshot); }; + LanguageServiceShimHostAdapter.prototype.getScriptKind = function (fileName) { + if ("getScriptKind" in this.shimHost) { + return this.shimHost.getScriptKind(fileName); + } + else { + return 0 /* Unknown */; + } + }; LanguageServiceShimHostAdapter.prototype.getScriptVersion = function (fileName) { return this.shimHost.getScriptVersion(fileName); }; @@ -51206,17 +57560,10 @@ var ts; return this.shimHost.getCurrentDirectory(); }; LanguageServiceShimHostAdapter.prototype.getDefaultLibFileName = function (options) { - // Wrap the API changes for 1.5 release. This try/catch - // should be removed once TypeScript 1.5 has shipped. - try { - return this.shimHost.getDefaultLibFileName(JSON.stringify(options)); - } - catch (e) { - return ""; - } + return this.shimHost.getDefaultLibFileName(JSON.stringify(options)); }; return LanguageServiceShimHostAdapter; - })(); + }()); ts.LanguageServiceShimHostAdapter = LanguageServiceShimHostAdapter; /** A cancellation that throttles calls to the host */ var ThrottledCancellationToken = (function () { @@ -51238,22 +57585,27 @@ var ts; return false; }; return ThrottledCancellationToken; - })(); + }()); var CoreServicesShimHostAdapter = (function () { function CoreServicesShimHostAdapter(shimHost) { + var _this = this; this.shimHost = shimHost; + if ("directoryExists" in this.shimHost) { + this.directoryExists = function (directoryName) { return _this.shimHost.directoryExists(directoryName); }; + } + if ("realpath" in this.shimHost) { + this.realpath = function (path) { return _this.shimHost.realpath(path); }; + } } - CoreServicesShimHostAdapter.prototype.readDirectory = function (rootDir, extension, exclude) { - // Wrap the API changes for 1.5 release. This try/catch - // should be removed once TypeScript 1.5 has shipped. - // Also consider removing the optional designation for - // the exclude param at this time. + CoreServicesShimHostAdapter.prototype.readDirectory = function (rootDir, extension, exclude, depth) { + // Wrap the API changes for 2.0 release. This try/catch + // should be removed once TypeScript 2.0 has shipped. var encoded; try { - encoded = this.shimHost.readDirectory(rootDir, extension, JSON.stringify(exclude)); + encoded = this.shimHost.readDirectory(rootDir, extension, JSON.stringify(exclude), depth); } catch (e) { - encoded = this.shimHost.readDirectory(rootDir, extension); + encoded = this.shimHost.readDirectory(rootDir, extension, JSON.stringify(exclude)); } return JSON.parse(encoded); }; @@ -51264,18 +57616,19 @@ var ts; return this.shimHost.readFile(fileName); }; return CoreServicesShimHostAdapter; - })(); + }()); ts.CoreServicesShimHostAdapter = CoreServicesShimHostAdapter; function simpleForwardCall(logger, actionDescription, action, logPerformance) { + var start; if (logPerformance) { logger.log(actionDescription); - var start = Date.now(); + start = Date.now(); } var result = action(); if (logPerformance) { var end = Date.now(); logger.log(actionDescription + " completed in " + (end - start) + " msec"); - if (typeof (result) === "string") { + if (typeof result === "string") { var str = result; if (str.length > 128) { str = str.substring(0, 128) + "..."; @@ -51308,7 +57661,7 @@ var ts; this.factory.unregisterShim(this); }; return ShimBase; - })(); + }()); function realizeDiagnostics(diagnostics, newLine) { return diagnostics.map(function (d) { return realizeDiagnostic(d, newLine); }); } @@ -51357,9 +57710,7 @@ var ts; * Update the list of scripts known to the compiler */ LanguageServiceShimObject.prototype.refresh = function (throwOnError) { - this.forwardJSONCall("refresh(" + throwOnError + ")", function () { - return null; - }); + this.forwardJSONCall("refresh(" + throwOnError + ")", function () { return null; }); }; LanguageServiceShimObject.prototype.cleanupSemanticCache = function () { var _this = this; @@ -51374,33 +57725,25 @@ var ts; }; LanguageServiceShimObject.prototype.getSyntacticClassifications = function (fileName, start, length) { var _this = this; - return this.forwardJSONCall("getSyntacticClassifications('" + fileName + "', " + start + ", " + length + ")", function () { - var classifications = _this.languageService.getSyntacticClassifications(fileName, ts.createTextSpan(start, length)); - return classifications; - }); + return this.forwardJSONCall("getSyntacticClassifications('" + fileName + "', " + start + ", " + length + ")", function () { return _this.languageService.getSyntacticClassifications(fileName, ts.createTextSpan(start, length)); }); }; LanguageServiceShimObject.prototype.getSemanticClassifications = function (fileName, start, length) { var _this = this; - return this.forwardJSONCall("getSemanticClassifications('" + fileName + "', " + start + ", " + length + ")", function () { - var classifications = _this.languageService.getSemanticClassifications(fileName, ts.createTextSpan(start, length)); - return classifications; - }); + return this.forwardJSONCall("getSemanticClassifications('" + fileName + "', " + start + ", " + length + ")", function () { return _this.languageService.getSemanticClassifications(fileName, ts.createTextSpan(start, length)); }); }; LanguageServiceShimObject.prototype.getEncodedSyntacticClassifications = function (fileName, start, length) { var _this = this; - return this.forwardJSONCall("getEncodedSyntacticClassifications('" + fileName + "', " + start + ", " + length + ")", function () { - // directly serialize the spans out to a string. This is much faster to decode - // on the managed side versus a full JSON array. - return convertClassifications(_this.languageService.getEncodedSyntacticClassifications(fileName, ts.createTextSpan(start, length))); - }); + return this.forwardJSONCall("getEncodedSyntacticClassifications('" + fileName + "', " + start + ", " + length + ")", + // directly serialize the spans out to a string. This is much faster to decode + // on the managed side versus a full JSON array. + function () { return convertClassifications(_this.languageService.getEncodedSyntacticClassifications(fileName, ts.createTextSpan(start, length))); }); }; LanguageServiceShimObject.prototype.getEncodedSemanticClassifications = function (fileName, start, length) { var _this = this; - return this.forwardJSONCall("getEncodedSemanticClassifications('" + fileName + "', " + start + ", " + length + ")", function () { - // directly serialize the spans out to a string. This is much faster to decode - // on the managed side versus a full JSON array. - return convertClassifications(_this.languageService.getEncodedSemanticClassifications(fileName, ts.createTextSpan(start, length))); - }); + return this.forwardJSONCall("getEncodedSemanticClassifications('" + fileName + "', " + start + ", " + length + ")", + // directly serialize the spans out to a string. This is much faster to decode + // on the managed side versus a full JSON array. + function () { return convertClassifications(_this.languageService.getEncodedSemanticClassifications(fileName, ts.createTextSpan(start, length))); }); }; LanguageServiceShimObject.prototype.getSyntacticDiagnostics = function (fileName) { var _this = this; @@ -51430,10 +57773,7 @@ var ts; */ LanguageServiceShimObject.prototype.getQuickInfoAtPosition = function (fileName, position) { var _this = this; - return this.forwardJSONCall("getQuickInfoAtPosition('" + fileName + "', " + position + ")", function () { - var quickInfo = _this.languageService.getQuickInfoAtPosition(fileName, position); - return quickInfo; - }); + return this.forwardJSONCall("getQuickInfoAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getQuickInfoAtPosition(fileName, position); }); }; /// NAMEORDOTTEDNAMESPAN /** @@ -51442,10 +57782,7 @@ var ts; */ LanguageServiceShimObject.prototype.getNameOrDottedNameSpan = function (fileName, startPos, endPos) { var _this = this; - return this.forwardJSONCall("getNameOrDottedNameSpan('" + fileName + "', " + startPos + ", " + endPos + ")", function () { - var spanInfo = _this.languageService.getNameOrDottedNameSpan(fileName, startPos, endPos); - return spanInfo; - }); + return this.forwardJSONCall("getNameOrDottedNameSpan('" + fileName + "', " + startPos + ", " + endPos + ")", function () { return _this.languageService.getNameOrDottedNameSpan(fileName, startPos, endPos); }); }; /** * STATEMENTSPAN @@ -51453,18 +57790,12 @@ var ts; */ LanguageServiceShimObject.prototype.getBreakpointStatementAtPosition = function (fileName, position) { var _this = this; - return this.forwardJSONCall("getBreakpointStatementAtPosition('" + fileName + "', " + position + ")", function () { - var spanInfo = _this.languageService.getBreakpointStatementAtPosition(fileName, position); - return spanInfo; - }); + return this.forwardJSONCall("getBreakpointStatementAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getBreakpointStatementAtPosition(fileName, position); }); }; /// SIGNATUREHELP LanguageServiceShimObject.prototype.getSignatureHelpItems = function (fileName, position) { var _this = this; - return this.forwardJSONCall("getSignatureHelpItems('" + fileName + "', " + position + ")", function () { - var signatureInfo = _this.languageService.getSignatureHelpItems(fileName, position); - return signatureInfo; - }); + return this.forwardJSONCall("getSignatureHelpItems('" + fileName + "', " + position + ")", function () { return _this.languageService.getSignatureHelpItems(fileName, position); }); }; /// GOTO DEFINITION /** @@ -51473,9 +57804,7 @@ var ts; */ LanguageServiceShimObject.prototype.getDefinitionAtPosition = function (fileName, position) { var _this = this; - return this.forwardJSONCall("getDefinitionAtPosition('" + fileName + "', " + position + ")", function () { - return _this.languageService.getDefinitionAtPosition(fileName, position); - }); + return this.forwardJSONCall("getDefinitionAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getDefinitionAtPosition(fileName, position); }); }; /// GOTO Type /** @@ -51484,29 +57813,24 @@ var ts; */ LanguageServiceShimObject.prototype.getTypeDefinitionAtPosition = function (fileName, position) { var _this = this; - return this.forwardJSONCall("getTypeDefinitionAtPosition('" + fileName + "', " + position + ")", function () { - return _this.languageService.getTypeDefinitionAtPosition(fileName, position); - }); + return this.forwardJSONCall("getTypeDefinitionAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getTypeDefinitionAtPosition(fileName, position); }); }; LanguageServiceShimObject.prototype.getRenameInfo = function (fileName, position) { var _this = this; - return this.forwardJSONCall("getRenameInfo('" + fileName + "', " + position + ")", function () { - return _this.languageService.getRenameInfo(fileName, position); - }); + return this.forwardJSONCall("getRenameInfo('" + fileName + "', " + position + ")", function () { return _this.languageService.getRenameInfo(fileName, position); }); }; LanguageServiceShimObject.prototype.findRenameLocations = function (fileName, position, findInStrings, findInComments) { var _this = this; - return this.forwardJSONCall("findRenameLocations('" + fileName + "', " + position + ", " + findInStrings + ", " + findInComments + ")", function () { - return _this.languageService.findRenameLocations(fileName, position, findInStrings, findInComments); - }); + return this.forwardJSONCall("findRenameLocations('" + fileName + "', " + position + ", " + findInStrings + ", " + findInComments + ")", function () { return _this.languageService.findRenameLocations(fileName, position, findInStrings, findInComments); }); }; /// GET BRACE MATCHING LanguageServiceShimObject.prototype.getBraceMatchingAtPosition = function (fileName, position) { var _this = this; - return this.forwardJSONCall("getBraceMatchingAtPosition('" + fileName + "', " + position + ")", function () { - var textRanges = _this.languageService.getBraceMatchingAtPosition(fileName, position); - return textRanges; - }); + return this.forwardJSONCall("getBraceMatchingAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getBraceMatchingAtPosition(fileName, position); }); + }; + LanguageServiceShimObject.prototype.isValidBraceCompletionAtPostion = function (fileName, position, openingBrace) { + var _this = this; + return this.forwardJSONCall("isValidBraceCompletionAtPostion('" + fileName + "', " + position + ", " + openingBrace + ")", function () { return _this.languageService.isValidBraceCompletionAtPostion(fileName, position, openingBrace); }); }; /// GET SMART INDENT LanguageServiceShimObject.prototype.getIndentationAtPosition = function (fileName, position, options /*Services.EditorOptions*/) { @@ -51519,27 +57843,21 @@ var ts; /// GET REFERENCES LanguageServiceShimObject.prototype.getReferencesAtPosition = function (fileName, position) { var _this = this; - return this.forwardJSONCall("getReferencesAtPosition('" + fileName + "', " + position + ")", function () { - return _this.languageService.getReferencesAtPosition(fileName, position); - }); + return this.forwardJSONCall("getReferencesAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getReferencesAtPosition(fileName, position); }); }; LanguageServiceShimObject.prototype.findReferences = function (fileName, position) { var _this = this; - return this.forwardJSONCall("findReferences('" + fileName + "', " + position + ")", function () { - return _this.languageService.findReferences(fileName, position); - }); + return this.forwardJSONCall("findReferences('" + fileName + "', " + position + ")", function () { return _this.languageService.findReferences(fileName, position); }); }; LanguageServiceShimObject.prototype.getOccurrencesAtPosition = function (fileName, position) { var _this = this; - return this.forwardJSONCall("getOccurrencesAtPosition('" + fileName + "', " + position + ")", function () { - return _this.languageService.getOccurrencesAtPosition(fileName, position); - }); + return this.forwardJSONCall("getOccurrencesAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getOccurrencesAtPosition(fileName, position); }); }; LanguageServiceShimObject.prototype.getDocumentHighlights = function (fileName, position, filesToSearch) { var _this = this; return this.forwardJSONCall("getDocumentHighlights('" + fileName + "', " + position + ")", function () { var results = _this.languageService.getDocumentHighlights(fileName, position, JSON.parse(filesToSearch)); - // workaround for VS document higlighting issue - keep only items from the initial file + // workaround for VS document highlighting issue - keep only items from the initial file var normalizedName = ts.normalizeSlashes(fileName).toLowerCase(); return ts.filter(results, function (r) { return ts.normalizeSlashes(r.fileName).toLowerCase() === normalizedName; }); }); @@ -51552,41 +57870,32 @@ var ts; */ LanguageServiceShimObject.prototype.getCompletionsAtPosition = function (fileName, position) { var _this = this; - return this.forwardJSONCall("getCompletionsAtPosition('" + fileName + "', " + position + ")", function () { - var completion = _this.languageService.getCompletionsAtPosition(fileName, position); - return completion; - }); + return this.forwardJSONCall("getCompletionsAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getCompletionsAtPosition(fileName, position); }); }; /** Get a string based representation of a completion list entry details */ LanguageServiceShimObject.prototype.getCompletionEntryDetails = function (fileName, position, entryName) { var _this = this; - return this.forwardJSONCall("getCompletionEntryDetails('" + fileName + "', " + position + ", " + entryName + ")", function () { - var details = _this.languageService.getCompletionEntryDetails(fileName, position, entryName); - return details; - }); + return this.forwardJSONCall("getCompletionEntryDetails('" + fileName + "', " + position + ", '" + entryName + "')", function () { return _this.languageService.getCompletionEntryDetails(fileName, position, entryName); }); }; LanguageServiceShimObject.prototype.getFormattingEditsForRange = function (fileName, start, end, options /*Services.FormatCodeOptions*/) { var _this = this; return this.forwardJSONCall("getFormattingEditsForRange('" + fileName + "', " + start + ", " + end + ")", function () { var localOptions = JSON.parse(options); - var edits = _this.languageService.getFormattingEditsForRange(fileName, start, end, localOptions); - return edits; + return _this.languageService.getFormattingEditsForRange(fileName, start, end, localOptions); }); }; LanguageServiceShimObject.prototype.getFormattingEditsForDocument = function (fileName, options /*Services.FormatCodeOptions*/) { var _this = this; return this.forwardJSONCall("getFormattingEditsForDocument('" + fileName + "')", function () { var localOptions = JSON.parse(options); - var edits = _this.languageService.getFormattingEditsForDocument(fileName, localOptions); - return edits; + return _this.languageService.getFormattingEditsForDocument(fileName, localOptions); }); }; LanguageServiceShimObject.prototype.getFormattingEditsAfterKeystroke = function (fileName, position, key, options /*Services.FormatCodeOptions*/) { var _this = this; return this.forwardJSONCall("getFormattingEditsAfterKeystroke('" + fileName + "', " + position + ", '" + key + "')", function () { var localOptions = JSON.parse(options); - var edits = _this.languageService.getFormattingEditsAfterKeystroke(fileName, position, key, localOptions); - return edits; + return _this.languageService.getFormattingEditsAfterKeystroke(fileName, position, key, localOptions); }); }; LanguageServiceShimObject.prototype.getDocCommentTemplateAtPosition = function (fileName, position) { @@ -51597,45 +57906,27 @@ var ts; /** Return a list of symbols that are interesting to navigate to */ LanguageServiceShimObject.prototype.getNavigateToItems = function (searchValue, maxResultCount) { var _this = this; - return this.forwardJSONCall("getNavigateToItems('" + searchValue + "', " + maxResultCount + ")", function () { - var items = _this.languageService.getNavigateToItems(searchValue, maxResultCount); - return items; - }); + return this.forwardJSONCall("getNavigateToItems('" + searchValue + "', " + maxResultCount + ")", function () { return _this.languageService.getNavigateToItems(searchValue, maxResultCount); }); }; LanguageServiceShimObject.prototype.getNavigationBarItems = function (fileName) { var _this = this; - return this.forwardJSONCall("getNavigationBarItems('" + fileName + "')", function () { - var items = _this.languageService.getNavigationBarItems(fileName); - return items; - }); + return this.forwardJSONCall("getNavigationBarItems('" + fileName + "')", function () { return _this.languageService.getNavigationBarItems(fileName); }); }; LanguageServiceShimObject.prototype.getOutliningSpans = function (fileName) { var _this = this; - return this.forwardJSONCall("getOutliningSpans('" + fileName + "')", function () { - var items = _this.languageService.getOutliningSpans(fileName); - return items; - }); + return this.forwardJSONCall("getOutliningSpans('" + fileName + "')", function () { return _this.languageService.getOutliningSpans(fileName); }); }; LanguageServiceShimObject.prototype.getTodoComments = function (fileName, descriptors) { var _this = this; - return this.forwardJSONCall("getTodoComments('" + fileName + "')", function () { - var items = _this.languageService.getTodoComments(fileName, JSON.parse(descriptors)); - return items; - }); + return this.forwardJSONCall("getTodoComments('" + fileName + "')", function () { return _this.languageService.getTodoComments(fileName, JSON.parse(descriptors)); }); }; /// Emit LanguageServiceShimObject.prototype.getEmitOutput = function (fileName) { var _this = this; - return this.forwardJSONCall("getEmitOutput('" + fileName + "')", function () { - var output = _this.languageService.getEmitOutput(fileName); - // Shim the API changes for 1.5 release. This should be removed once - // TypeScript 1.5 has shipped. - output.emitOutputStatus = output.emitSkipped ? 1 : 0; - return output; - }); + return this.forwardJSONCall("getEmitOutput('" + fileName + "')", function () { return _this.languageService.getEmitOutput(fileName); }); }; return LanguageServiceShimObject; - })(ShimBase); + }(ShimBase)); function convertClassifications(classifications) { return { spans: classifications.spans.join(","), endOfLineState: classifications.endOfLineState }; } @@ -51654,17 +57945,17 @@ var ts; /// COLORIZATION ClassifierShimObject.prototype.getClassificationsForLine = function (text, lexState, classifyKeywordsInGenerics) { var classification = this.classifier.getClassificationsForLine(text, lexState, classifyKeywordsInGenerics); - var items = classification.entries; var result = ""; - for (var i = 0; i < items.length; i++) { - result += items[i].length + "\n"; - result += items[i].classification + "\n"; + for (var _i = 0, _a = classification.entries; _i < _a.length; _i++) { + var item = _a[_i]; + result += item.length + "\n"; + result += item.classification + "\n"; } result += classification.finalLexState; return result; }; return ClassifierShimObject; - })(ShimBase); + }(ShimBase)); var CoreServicesShimObject = (function (_super) { __extends(CoreServicesShimObject, _super); function CoreServicesShimObject(factory, logger, host) { @@ -51687,33 +57978,47 @@ var ts; }; }); }; + CoreServicesShimObject.prototype.resolveTypeReferenceDirective = function (fileName, typeReferenceDirective, compilerOptionsJson) { + var _this = this; + return this.forwardJSONCall("resolveTypeReferenceDirective(" + fileName + ")", function () { + var compilerOptions = JSON.parse(compilerOptionsJson); + var result = ts.resolveTypeReferenceDirective(typeReferenceDirective, ts.normalizeSlashes(fileName), compilerOptions, _this.host); + return { + resolvedFileName: result.resolvedTypeReferenceDirective ? result.resolvedTypeReferenceDirective.resolvedFileName : undefined, + primary: result.resolvedTypeReferenceDirective ? result.resolvedTypeReferenceDirective.primary : true, + failedLookupLocations: result.failedLookupLocations + }; + }); + }; CoreServicesShimObject.prototype.getPreProcessedFileInfo = function (fileName, sourceTextSnapshot) { + var _this = this; return this.forwardJSONCall("getPreProcessedFileInfo('" + fileName + "')", function () { // for now treat files as JavaScript var result = ts.preProcessFile(sourceTextSnapshot.getText(0, sourceTextSnapshot.getLength()), /* readImportFiles */ true, /* detectJavaScriptImports */ true); - var convertResult = { - referencedFiles: [], - importedFiles: [], + return { + referencedFiles: _this.convertFileReferences(result.referencedFiles), + importedFiles: _this.convertFileReferences(result.importedFiles), ambientExternalModules: result.ambientExternalModules, - isLibFile: result.isLibFile + isLibFile: result.isLibFile, + typeReferenceDirectives: _this.convertFileReferences(result.typeReferenceDirectives) }; - ts.forEach(result.referencedFiles, function (refFile) { - convertResult.referencedFiles.push({ - path: ts.normalizePath(refFile.fileName), - position: refFile.pos, - length: refFile.end - refFile.pos - }); - }); - ts.forEach(result.importedFiles, function (importedFile) { - convertResult.importedFiles.push({ - path: ts.normalizeSlashes(importedFile.fileName), - position: importedFile.pos, - length: importedFile.end - importedFile.pos - }); - }); - return convertResult; }); }; + CoreServicesShimObject.prototype.convertFileReferences = function (refs) { + if (!refs) { + return undefined; + } + var result = []; + for (var _i = 0, refs_2 = refs; _i < refs_2.length; _i++) { + var ref = refs_2[_i]; + result.push({ + path: ts.normalizeSlashes(ref.fileName), + position: ref.pos, + length: ref.end - ref.pos + }); + } + return result; + }; CoreServicesShimObject.prototype.getTSConfigFileInfo = function (fileName, sourceTextSnapshot) { var _this = this; return this.forwardJSONCall("getTSConfigFileInfo('" + fileName + "')", function () { @@ -51722,25 +58027,36 @@ var ts; if (result.error) { return { options: {}, + typingOptions: {}, files: [], - errors: [realizeDiagnostic(result.error, '\r\n')] + raw: {}, + errors: [realizeDiagnostic(result.error, "\r\n")] }; } - var configFile = ts.parseJsonConfigFileContent(result.config, _this.host, ts.getDirectoryPath(ts.normalizeSlashes(fileName))); + var normalizedFileName = ts.normalizeSlashes(fileName); + var configFile = ts.parseJsonConfigFileContent(result.config, _this.host, ts.getDirectoryPath(normalizedFileName), /*existingOptions*/ {}, normalizedFileName); return { options: configFile.options, + typingOptions: configFile.typingOptions, files: configFile.fileNames, - errors: realizeDiagnostics(configFile.errors, '\r\n') + raw: configFile.raw, + errors: realizeDiagnostics(configFile.errors, "\r\n") }; }); }; CoreServicesShimObject.prototype.getDefaultCompilationSettings = function () { - return this.forwardJSONCall("getDefaultCompilationSettings()", function () { - return ts.getDefaultCompilerOptions(); + return this.forwardJSONCall("getDefaultCompilationSettings()", function () { return ts.getDefaultCompilerOptions(); }); + }; + CoreServicesShimObject.prototype.discoverTypings = function (discoverTypingsJson) { + var _this = this; + var getCanonicalFileName = ts.createGetCanonicalFileName(/*useCaseSensitivefileNames:*/ false); + return this.forwardJSONCall("discoverTypings()", function () { + var info = JSON.parse(discoverTypingsJson); + return ts.JsTyping.discoverTypings(_this.host, info.fileNames, ts.toPath(info.projectRootPath, info.projectRootPath, getCanonicalFileName), ts.toPath(info.safeListPath, info.safeListPath, getCanonicalFileName), info.packageNameToTypingLocation, info.typingOptions, info.compilerOptions); }); }; return CoreServicesShimObject; - })(ShimBase); + }(ShimBase)); var TypeScriptServicesFactory = (function () { function TypeScriptServicesFactory() { this._shims = []; @@ -51802,12 +58118,14 @@ var ts; throw new Error("Invalid operation"); }; return TypeScriptServicesFactory; - })(); + }()); ts.TypeScriptServicesFactory = TypeScriptServicesFactory; if (typeof module !== "undefined" && module.exports) { module.exports = ts; } })(ts || (ts = {})); +/* tslint:enable:no-in-operator */ +/* tslint:enable:no-null */ /// TODO: this is used by VS, clean this up on both sides of the interface /* @internal */ var TypeScript; @@ -51817,5 +58135,9 @@ var TypeScript; Services.TypeScriptServicesFactory = ts.TypeScriptServicesFactory; })(Services = TypeScript.Services || (TypeScript.Services = {})); })(TypeScript || (TypeScript = {})); +/* tslint:disable:no-unused-variable */ +// 'toolsVersion' gets consumed by the managed side, so it's not unused. +// TODO: it should be moved into a namespace though. /* @internal */ -var toolsVersion = "1.6"; +var toolsVersion = "1.9"; +/* tslint:enable:no-unused-variable */ diff --git a/lib/typescriptServices.d.ts b/lib/typescriptServices.d.ts index af9a8bffe35..cd459201d8b 100644 --- a/lib/typescriptServices.d.ts +++ b/lib/typescriptServices.d.ts @@ -160,166 +160,174 @@ declare namespace ts { IsKeyword = 124, ModuleKeyword = 125, NamespaceKeyword = 126, - RequireKeyword = 127, - NumberKeyword = 128, - SetKeyword = 129, - StringKeyword = 130, - SymbolKeyword = 131, - TypeKeyword = 132, - FromKeyword = 133, - OfKeyword = 134, - QualifiedName = 135, - ComputedPropertyName = 136, - TypeParameter = 137, - Parameter = 138, - Decorator = 139, - PropertySignature = 140, - PropertyDeclaration = 141, - MethodSignature = 142, - MethodDeclaration = 143, - Constructor = 144, - GetAccessor = 145, - SetAccessor = 146, - CallSignature = 147, - ConstructSignature = 148, - IndexSignature = 149, - TypePredicate = 150, - TypeReference = 151, - FunctionType = 152, - ConstructorType = 153, - TypeQuery = 154, - TypeLiteral = 155, - ArrayType = 156, - TupleType = 157, - UnionType = 158, - IntersectionType = 159, - ParenthesizedType = 160, - ObjectBindingPattern = 161, - ArrayBindingPattern = 162, - BindingElement = 163, - ArrayLiteralExpression = 164, - ObjectLiteralExpression = 165, - PropertyAccessExpression = 166, - ElementAccessExpression = 167, - CallExpression = 168, - NewExpression = 169, - TaggedTemplateExpression = 170, - TypeAssertionExpression = 171, - ParenthesizedExpression = 172, - FunctionExpression = 173, - ArrowFunction = 174, - DeleteExpression = 175, - TypeOfExpression = 176, - VoidExpression = 177, - AwaitExpression = 178, - PrefixUnaryExpression = 179, - PostfixUnaryExpression = 180, - BinaryExpression = 181, - ConditionalExpression = 182, - TemplateExpression = 183, - YieldExpression = 184, - SpreadElementExpression = 185, - ClassExpression = 186, - OmittedExpression = 187, - ExpressionWithTypeArguments = 188, - AsExpression = 189, - TemplateSpan = 190, - SemicolonClassElement = 191, - Block = 192, - VariableStatement = 193, - EmptyStatement = 194, - ExpressionStatement = 195, - IfStatement = 196, - DoStatement = 197, - WhileStatement = 198, - ForStatement = 199, - ForInStatement = 200, - ForOfStatement = 201, - ContinueStatement = 202, - BreakStatement = 203, - ReturnStatement = 204, - WithStatement = 205, - SwitchStatement = 206, - LabeledStatement = 207, - ThrowStatement = 208, - TryStatement = 209, - DebuggerStatement = 210, - VariableDeclaration = 211, - VariableDeclarationList = 212, - FunctionDeclaration = 213, - ClassDeclaration = 214, - InterfaceDeclaration = 215, - TypeAliasDeclaration = 216, - EnumDeclaration = 217, - ModuleDeclaration = 218, - ModuleBlock = 219, - CaseBlock = 220, - ImportEqualsDeclaration = 221, - ImportDeclaration = 222, - ImportClause = 223, - NamespaceImport = 224, - NamedImports = 225, - ImportSpecifier = 226, - ExportAssignment = 227, - ExportDeclaration = 228, - NamedExports = 229, - ExportSpecifier = 230, - MissingDeclaration = 231, - ExternalModuleReference = 232, - JsxElement = 233, - JsxSelfClosingElement = 234, - JsxOpeningElement = 235, - JsxText = 236, - JsxClosingElement = 237, - JsxAttribute = 238, - JsxSpreadAttribute = 239, - JsxExpression = 240, - CaseClause = 241, - DefaultClause = 242, - HeritageClause = 243, - CatchClause = 244, - PropertyAssignment = 245, - ShorthandPropertyAssignment = 246, - EnumMember = 247, - SourceFile = 248, - JSDocTypeExpression = 249, - JSDocAllType = 250, - JSDocUnknownType = 251, - JSDocArrayType = 252, - JSDocUnionType = 253, - JSDocTupleType = 254, - JSDocNullableType = 255, - JSDocNonNullableType = 256, - JSDocRecordType = 257, - JSDocRecordMember = 258, - JSDocTypeReference = 259, - JSDocOptionalType = 260, - JSDocFunctionType = 261, - JSDocVariadicType = 262, - JSDocConstructorType = 263, - JSDocThisType = 264, - JSDocComment = 265, - JSDocTag = 266, - JSDocParameterTag = 267, - JSDocReturnTag = 268, - JSDocTypeTag = 269, - JSDocTemplateTag = 270, - SyntaxList = 271, - Count = 272, + NeverKeyword = 127, + ReadonlyKeyword = 128, + RequireKeyword = 129, + NumberKeyword = 130, + SetKeyword = 131, + StringKeyword = 132, + SymbolKeyword = 133, + TypeKeyword = 134, + UndefinedKeyword = 135, + FromKeyword = 136, + GlobalKeyword = 137, + OfKeyword = 138, + QualifiedName = 139, + ComputedPropertyName = 140, + TypeParameter = 141, + Parameter = 142, + Decorator = 143, + PropertySignature = 144, + PropertyDeclaration = 145, + MethodSignature = 146, + MethodDeclaration = 147, + Constructor = 148, + GetAccessor = 149, + SetAccessor = 150, + CallSignature = 151, + ConstructSignature = 152, + IndexSignature = 153, + TypePredicate = 154, + TypeReference = 155, + FunctionType = 156, + ConstructorType = 157, + TypeQuery = 158, + TypeLiteral = 159, + ArrayType = 160, + TupleType = 161, + UnionType = 162, + IntersectionType = 163, + ParenthesizedType = 164, + ThisType = 165, + StringLiteralType = 166, + ObjectBindingPattern = 167, + ArrayBindingPattern = 168, + BindingElement = 169, + ArrayLiteralExpression = 170, + ObjectLiteralExpression = 171, + PropertyAccessExpression = 172, + ElementAccessExpression = 173, + CallExpression = 174, + NewExpression = 175, + TaggedTemplateExpression = 176, + TypeAssertionExpression = 177, + ParenthesizedExpression = 178, + FunctionExpression = 179, + ArrowFunction = 180, + DeleteExpression = 181, + TypeOfExpression = 182, + VoidExpression = 183, + AwaitExpression = 184, + PrefixUnaryExpression = 185, + PostfixUnaryExpression = 186, + BinaryExpression = 187, + ConditionalExpression = 188, + TemplateExpression = 189, + YieldExpression = 190, + SpreadElementExpression = 191, + ClassExpression = 192, + OmittedExpression = 193, + ExpressionWithTypeArguments = 194, + AsExpression = 195, + NonNullExpression = 196, + TemplateSpan = 197, + SemicolonClassElement = 198, + Block = 199, + VariableStatement = 200, + EmptyStatement = 201, + ExpressionStatement = 202, + IfStatement = 203, + DoStatement = 204, + WhileStatement = 205, + ForStatement = 206, + ForInStatement = 207, + ForOfStatement = 208, + ContinueStatement = 209, + BreakStatement = 210, + ReturnStatement = 211, + WithStatement = 212, + SwitchStatement = 213, + LabeledStatement = 214, + ThrowStatement = 215, + TryStatement = 216, + DebuggerStatement = 217, + VariableDeclaration = 218, + VariableDeclarationList = 219, + FunctionDeclaration = 220, + ClassDeclaration = 221, + InterfaceDeclaration = 222, + TypeAliasDeclaration = 223, + EnumDeclaration = 224, + ModuleDeclaration = 225, + ModuleBlock = 226, + CaseBlock = 227, + GlobalModuleExportDeclaration = 228, + ImportEqualsDeclaration = 229, + ImportDeclaration = 230, + ImportClause = 231, + NamespaceImport = 232, + NamedImports = 233, + ImportSpecifier = 234, + ExportAssignment = 235, + ExportDeclaration = 236, + NamedExports = 237, + ExportSpecifier = 238, + MissingDeclaration = 239, + ExternalModuleReference = 240, + JsxElement = 241, + JsxSelfClosingElement = 242, + JsxOpeningElement = 243, + JsxText = 244, + JsxClosingElement = 245, + JsxAttribute = 246, + JsxSpreadAttribute = 247, + JsxExpression = 248, + CaseClause = 249, + DefaultClause = 250, + HeritageClause = 251, + CatchClause = 252, + PropertyAssignment = 253, + ShorthandPropertyAssignment = 254, + EnumMember = 255, + SourceFile = 256, + JSDocTypeExpression = 257, + JSDocAllType = 258, + JSDocUnknownType = 259, + JSDocArrayType = 260, + JSDocUnionType = 261, + JSDocTupleType = 262, + JSDocNullableType = 263, + JSDocNonNullableType = 264, + JSDocRecordType = 265, + JSDocRecordMember = 266, + JSDocTypeReference = 267, + JSDocOptionalType = 268, + JSDocFunctionType = 269, + JSDocVariadicType = 270, + JSDocConstructorType = 271, + JSDocThisType = 272, + JSDocComment = 273, + JSDocTag = 274, + JSDocParameterTag = 275, + JSDocReturnTag = 276, + JSDocTypeTag = 277, + JSDocTemplateTag = 278, + SyntaxList = 279, + Count = 280, FirstAssignment = 56, LastAssignment = 68, FirstReservedWord = 70, LastReservedWord = 105, FirstKeyword = 70, - LastKeyword = 134, + LastKeyword = 138, FirstFutureReservedWord = 106, LastFutureReservedWord = 114, - FirstTypeNode = 151, - LastTypeNode = 160, + FirstTypeNode = 154, + LastTypeNode = 166, FirstPunctuation = 15, LastPunctuation = 68, FirstToken = 0, - LastToken = 134, + LastToken = 138, FirstTriviaToken = 2, LastTriviaToken = 7, FirstLiteralToken = 8, @@ -328,41 +336,56 @@ declare namespace ts { LastTemplateToken = 14, FirstBinaryOperator = 25, LastBinaryOperator = 68, - FirstNode = 135, + FirstNode = 139, } enum NodeFlags { None = 0, - Export = 2, - Ambient = 4, - Public = 8, - Private = 16, - Protected = 32, - Static = 64, + Export = 1, + Ambient = 2, + Public = 4, + Private = 8, + Protected = 16, + Static = 32, + Readonly = 64, Abstract = 128, Async = 256, Default = 512, - MultiLine = 1024, - Synthetic = 2048, - DeclarationFile = 4096, - Let = 8192, - Const = 16384, - OctalLiteral = 32768, - Namespace = 65536, - ExportContext = 131072, - ContainsThis = 262144, - HasImplicitReturn = 524288, - HasExplicitReturn = 1048576, - Modifier = 1022, - AccessibilityModifier = 56, - BlockScoped = 24576, - ReachabilityCheckFlags = 1572864, + Let = 1024, + Const = 2048, + Namespace = 4096, + ExportContext = 8192, + ContainsThis = 16384, + HasImplicitReturn = 32768, + HasExplicitReturn = 65536, + GlobalAugmentation = 131072, + HasClassExtends = 262144, + HasDecorators = 524288, + HasParamDecorators = 1048576, + HasAsyncFunctions = 2097152, + DisallowInContext = 4194304, + YieldContext = 8388608, + DecoratorContext = 16777216, + AwaitContext = 33554432, + ThisNodeHasError = 67108864, + JavaScriptFile = 134217728, + ThisNodeOrAnySubNodesHasError = 268435456, + HasAggregatedChildData = 536870912, + HasJsxSpreadAttribute = 1073741824, + Modifier = 1023, + AccessibilityModifier = 28, + ParameterPropertyModifier = 92, + BlockScoped = 3072, + ReachabilityCheckFlags = 98304, + EmitHelperFlags = 3932160, + ContextFlags = 197132288, + TypeExcludesFlags = 41943040, } 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, - ClassElement = 4, - UnknownElement = 8, IntrinsicElement = 3, } interface Node extends TextRange { @@ -375,9 +398,11 @@ declare namespace ts { interface NodeArray extends Array, TextRange { hasTrailingComma?: boolean; } - interface ModifiersArray extends NodeArray { + interface ModifiersArray extends NodeArray { flags: number; } + interface Modifier extends Node { + } interface Identifier extends PrimaryExpression { text: string; originalKeywordKind?: SyntaxKind; @@ -393,6 +418,9 @@ declare namespace ts { _declarationBrand: any; name?: DeclarationName; } + interface DeclarationStatement extends Declaration, Statement { + name?: Identifier; + } interface ComputedPropertyName extends Node { expression: Expression; } @@ -405,10 +433,15 @@ declare namespace ts { expression?: Expression; } interface SignatureDeclaration extends Declaration { + name?: PropertyName; typeParameters?: NodeArray; parameters: NodeArray; type?: TypeNode; } + interface CallSignatureDeclaration extends SignatureDeclaration, TypeElement { + } + interface ConstructSignatureDeclaration extends SignatureDeclaration, TypeElement { + } interface VariableDeclaration extends Declaration { parent?: VariableDeclarationList; name: Identifier | BindingPattern; @@ -431,18 +464,25 @@ declare namespace ts { name: Identifier | BindingPattern; initializer?: Expression; } - interface PropertyDeclaration extends Declaration, ClassElement { - name: DeclarationName; + interface PropertySignature extends TypeElement { + name: PropertyName; questionToken?: Node; type?: TypeNode; initializer?: Expression; } + interface PropertyDeclaration extends ClassElement { + questionToken?: Node; + name: PropertyName; + type?: TypeNode; + initializer?: Expression; + } interface ObjectLiteralElement extends Declaration { _objectLiteralBrandBrand: any; + name?: PropertyName; } interface PropertyAssignment extends ObjectLiteralElement { _propertyAssignmentBrand: any; - name: DeclarationName; + name: PropertyName; questionToken?: Node; initializer: Expression; } @@ -460,9 +500,16 @@ declare namespace ts { type?: TypeNode; initializer?: Expression; } + interface PropertyLikeDeclaration extends Declaration { + name: PropertyName; + } interface BindingPattern extends Node { elements: NodeArray; } + interface ObjectBindingPattern extends BindingPattern { + } + interface ArrayBindingPattern extends BindingPattern { + } /** * Several node kinds share function-like features such as a signature, * a name, and a body. These nodes should extend FunctionLikeDeclaration. @@ -477,45 +524,61 @@ declare namespace ts { questionToken?: Node; body?: Block | Expression; } - interface FunctionDeclaration extends FunctionLikeDeclaration, Statement { + interface FunctionDeclaration extends FunctionLikeDeclaration, DeclarationStatement { name?: Identifier; - body?: Block; + body?: FunctionBody; + } + interface MethodSignature extends SignatureDeclaration, TypeElement { + name: PropertyName; } interface MethodDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement { - body?: Block; + name: PropertyName; + body?: FunctionBody; } interface ConstructorDeclaration extends FunctionLikeDeclaration, ClassElement { - body?: Block; + body?: FunctionBody; } interface SemicolonClassElement extends ClassElement { _semicolonClassElementBrand: any; } interface AccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement { _accessorDeclarationBrand: any; - body: Block; + name: PropertyName; + body: FunctionBody; } - interface IndexSignatureDeclaration extends SignatureDeclaration, ClassElement { + interface GetAccessorDeclaration extends AccessorDeclaration { + } + interface SetAccessorDeclaration extends AccessorDeclaration { + } + interface IndexSignatureDeclaration extends SignatureDeclaration, ClassElement, TypeElement { _indexSignatureDeclarationBrand: any; } interface TypeNode extends Node { _typeNodeBrand: any; } + interface ThisTypeNode extends TypeNode { + _thisTypeNodeBrand: any; + } interface FunctionOrConstructorTypeNode extends TypeNode, SignatureDeclaration { _functionOrConstructorTypeNodeBrand: any; } + interface FunctionTypeNode extends FunctionOrConstructorTypeNode { + } + interface ConstructorTypeNode extends FunctionOrConstructorTypeNode { + } interface TypeReferenceNode extends TypeNode { typeName: EntityName; typeArguments?: NodeArray; } interface TypePredicateNode extends TypeNode { - parameterName: Identifier; + parameterName: Identifier | ThisTypeNode; type: TypeNode; } interface TypeQueryNode extends TypeNode { exprName: EntityName; } interface TypeLiteralNode extends TypeNode, Declaration { - members: NodeArray; + members: NodeArray; } interface ArrayTypeNode extends TypeNode { elementType: TypeNode; @@ -533,13 +596,18 @@ declare namespace ts { interface ParenthesizedTypeNode extends TypeNode { type: TypeNode; } - interface StringLiteral extends LiteralExpression, TypeNode { + interface StringLiteralTypeNode extends LiteralLikeNode, TypeNode { + _stringLiteralTypeBrand: any; + } + interface StringLiteral extends LiteralExpression { _stringLiteralBrand: any; } interface Expression extends Node { _expressionBrand: any; contextualType?: Type; } + interface OmittedExpression extends Expression { + } interface UnaryExpression extends Expression { _unaryExpressionBrand: any; } @@ -594,25 +662,34 @@ declare namespace ts { colonToken: Node; whenFalse: Expression; } + type FunctionBody = Block; + type ConciseBody = FunctionBody | Expression; interface FunctionExpression extends PrimaryExpression, FunctionLikeDeclaration { name?: Identifier; - body: Block | Expression; + body: FunctionBody; } interface ArrowFunction extends Expression, FunctionLikeDeclaration { equalsGreaterThanToken: Node; + body: ConciseBody; } - interface LiteralExpression extends PrimaryExpression { + interface LiteralLikeNode extends Node { text: string; isUnterminated?: boolean; hasExtendedUnicodeEscape?: boolean; } + interface LiteralExpression extends LiteralLikeNode, PrimaryExpression { + _literalExpressionBrand: any; + } + interface TemplateLiteralFragment extends LiteralLikeNode { + _templateLiteralFragmentBrand: any; + } interface TemplateExpression extends PrimaryExpression { - head: LiteralExpression; + head: TemplateLiteralFragment; templateSpans: NodeArray; } interface TemplateSpan extends Node { expression: Expression; - literal: LiteralExpression; + literal: TemplateLiteralFragment; } interface ParenthesizedExpression extends PrimaryExpression { expression: Expression; @@ -631,11 +708,12 @@ declare namespace ts { dotToken: Node; name: Identifier; } + type IdentifierOrPropertyAccess = Identifier | PropertyAccessExpression; interface ElementAccessExpression extends MemberExpression { expression: LeftHandSideExpression; argumentExpression?: Expression; } - interface CallExpression extends LeftHandSideExpression { + interface CallExpression extends LeftHandSideExpression, Declaration { expression: LeftHandSideExpression; typeArguments?: NodeArray; arguments: NodeArray; @@ -660,6 +738,9 @@ declare namespace ts { expression: UnaryExpression; } type AssertionExpression = TypeAssertion | AsExpression; + interface NonNullExpression extends LeftHandSideExpression { + expression: Expression; + } interface JsxElement extends PrimaryExpression { openingElement: JsxOpeningElement; children: NodeArray; @@ -694,6 +775,14 @@ declare namespace ts { interface Statement extends Node { _statementBrand: any; } + interface EmptyStatement extends Statement { + } + interface DebuggerStatement extends Statement { + } + interface MissingDeclaration extends DeclarationStatement, ClassElement, ObjectLiteralElement, TypeElement { + name?: Identifier; + } + type BlockLike = SourceFile | Block | ModuleBlock | CaseClause; interface Block extends Statement { statements: NodeArray; } @@ -730,9 +819,13 @@ declare namespace ts { initializer: VariableDeclarationList | Expression; expression: Expression; } - interface BreakOrContinueStatement extends Statement { + interface BreakStatement extends Statement { label?: Identifier; } + interface ContinueStatement extends Statement { + label?: Identifier; + } + type BreakOrContinueStatement = BreakStatement | ContinueStatement; interface ReturnStatement extends Statement { expression?: Expression; } @@ -748,7 +841,7 @@ declare namespace ts { clauses: NodeArray; } interface CaseClause extends Node { - expression?: Expression; + expression: Expression; statements: NodeArray; } interface DefaultClause extends Node { @@ -771,30 +864,38 @@ declare namespace ts { variableDeclaration: VariableDeclaration; block: Block; } + type DeclarationWithTypeParameters = SignatureDeclaration | ClassLikeDeclaration | InterfaceDeclaration | TypeAliasDeclaration; interface ClassLikeDeclaration extends Declaration { name?: Identifier; typeParameters?: NodeArray; heritageClauses?: NodeArray; members: NodeArray; } - interface ClassDeclaration extends ClassLikeDeclaration, Statement { + interface ClassDeclaration extends ClassLikeDeclaration, DeclarationStatement { + name?: Identifier; } interface ClassExpression extends ClassLikeDeclaration, PrimaryExpression { } interface ClassElement extends Declaration { _classElementBrand: any; + name?: PropertyName; } - interface InterfaceDeclaration extends Declaration, Statement { + interface TypeElement extends Declaration { + _typeElementBrand: any; + name?: PropertyName; + questionToken?: Node; + } + interface InterfaceDeclaration extends DeclarationStatement { name: Identifier; typeParameters?: NodeArray; heritageClauses?: NodeArray; - members: NodeArray; + members: NodeArray; } interface HeritageClause extends Node { token: SyntaxKind; types?: NodeArray; } - interface TypeAliasDeclaration extends Declaration, Statement { + interface TypeAliasDeclaration extends DeclarationStatement { name: Identifier; typeParameters?: NodeArray; type: TypeNode; @@ -803,18 +904,19 @@ declare namespace ts { name: DeclarationName; initializer?: Expression; } - interface EnumDeclaration extends Declaration, Statement { + interface EnumDeclaration extends DeclarationStatement { name: Identifier; members: NodeArray; } - interface ModuleDeclaration extends Declaration, Statement { + type ModuleBody = ModuleBlock | ModuleDeclaration; + interface ModuleDeclaration extends DeclarationStatement { name: Identifier | LiteralExpression; body: ModuleBlock | ModuleDeclaration; } interface ModuleBlock extends Node, Statement { statements: NodeArray; } - interface ImportEqualsDeclaration extends Declaration, Statement { + interface ImportEqualsDeclaration extends DeclarationStatement { name: Identifier; moduleReference: EntityName | ExternalModuleReference; } @@ -832,22 +934,31 @@ declare namespace ts { interface NamespaceImport extends Declaration { name: Identifier; } - interface ExportDeclaration extends Declaration, Statement { + interface GlobalModuleExportDeclaration extends DeclarationStatement { + name: Identifier; + moduleReference: LiteralLikeNode; + } + interface ExportDeclaration extends DeclarationStatement { exportClause?: NamedExports; moduleSpecifier?: Expression; } - interface NamedImportsOrExports extends Node { - elements: NodeArray; + interface NamedImports extends Node { + elements: NodeArray; } - type NamedImports = NamedImportsOrExports; - type NamedExports = NamedImportsOrExports; - interface ImportOrExportSpecifier extends Declaration { + interface NamedExports extends Node { + elements: NodeArray; + } + type NamedImportsOrExports = NamedImports | NamedExports; + interface ImportSpecifier extends Declaration { propertyName?: Identifier; name: Identifier; } - type ImportSpecifier = ImportOrExportSpecifier; - type ExportSpecifier = ImportOrExportSpecifier; - interface ExportAssignment extends Declaration, Statement { + interface ExportSpecifier extends Declaration { + propertyName?: Identifier; + name: Identifier; + } + type ImportOrExportSpecifier = ImportSpecifier | ExportSpecifier; + interface ExportAssignment extends DeclarationStatement { isExportEquals?: boolean; expression: Expression; } @@ -908,7 +1019,8 @@ declare namespace ts { interface JSDocThisType extends JSDocType { type: JSDocType; } - interface JSDocRecordMember extends PropertyDeclaration { + type JSDocTypeReferencingNode = JSDocThisType | JSDocConstructorType | JSDocVariadicType | JSDocOptionalType | JSDocNullableType | JSDocNonNullableType; + interface JSDocRecordMember extends PropertySignature { name: Identifier | LiteralExpression; type?: JSDocType; } @@ -934,19 +1046,50 @@ declare namespace ts { postParameterName?: Identifier; isBracketed: boolean; } + enum FlowFlags { + Unreachable = 1, + Start = 2, + BranchLabel = 4, + LoopLabel = 8, + Assignment = 16, + TrueCondition = 32, + FalseCondition = 64, + Referenced = 128, + Shared = 256, + Label = 12, + Condition = 96, + } + interface FlowNode { + flags: FlowFlags; + id?: number; + } + interface FlowLabel extends FlowNode { + antecedents: FlowNode[]; + } + interface FlowAssignment extends FlowNode { + node: Expression | VariableDeclaration | BindingElement; + antecedent: FlowNode; + } + interface FlowCondition extends FlowNode { + expression: Expression; + antecedent: FlowNode; + } + interface AmdDependency { + path: string; + name: string; + } interface SourceFile extends Declaration { statements: NodeArray; endOfFileToken: Node; fileName: string; path: Path; text: string; - amdDependencies: { - path: string; - name: string; - }[]; + amdDependencies: AmdDependency[]; moduleName: string; referencedFiles: FileReference[]; + typeReferenceDirectives: FileReference[]; languageVariant: LanguageVariant; + isDeclarationFile: boolean; /** * lib.d.ts should have a reference comment like * @@ -961,13 +1104,14 @@ declare namespace ts { interface ScriptReferenceHost { getCompilerOptions(): CompilerOptions; getSourceFile(fileName: string): SourceFile; + getSourceFileByPath(path: Path): SourceFile; getCurrentDirectory(): string; } interface ParseConfigHost { readDirectory(rootDir: string, extension: string, exclude: string[]): string[]; } interface WriteFileCallback { - (fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void): void; + (fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void, sourceFiles?: SourceFile[]): void; } class OperationCanceledException { } @@ -1040,7 +1184,9 @@ declare namespace ts { } interface EmitResult { emitSkipped: boolean; + /** Contains declaration emit diagnostics */ diagnostics: Diagnostic[]; + emittedFiles: string[]; } interface TypeChecker { getTypeOfSymbolAtLocation(symbol: Symbol, node: Node): Type; @@ -1051,9 +1197,13 @@ declare namespace ts { getIndexTypeOfType(type: Type, kind: IndexKind): Type; getBaseTypes(type: InterfaceType): ObjectType[]; getReturnTypeOfSignature(signature: Signature): Type; + getNonNullableType(type: Type): Type; getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[]; getSymbolAtLocation(node: Node): Symbol; + getSymbolsOfParameterPropertyDeclaration(parameter: ParameterDeclaration, parameterName: string): Symbol[]; getShorthandAssignmentValueSymbol(location: Node): Symbol; + getExportSpecifierLocalTargetSymbol(location: ExportSpecifier): Symbol; + getPropertySymbolOfDestructuringAssignment(location: Identifier): Symbol; getTypeAtLocation(node: Node): Type; typeToString(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string; symbolToString(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): string; @@ -1067,6 +1217,7 @@ declare namespace ts { isImplementationOfOverload(node: FunctionLikeDeclaration): boolean; isUndefinedSymbol(symbol: Symbol): boolean; isArgumentsSymbol(symbol: Symbol): boolean; + isUnknownSymbol(symbol: Symbol): boolean; getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number; isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName, propertyName: string): boolean; getAliasedSymbol(symbol: Symbol): Symbol; @@ -1078,11 +1229,12 @@ declare namespace ts { interface SymbolDisplayBuilder { buildTypeDisplay(type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; buildSymbolDisplay(symbol: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags): void; - buildSignatureDisplay(signatures: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; + buildSignatureDisplay(signatures: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags, kind?: SignatureKind): void; buildParameterDisplay(parameter: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; buildTypeParameterDisplay(tp: TypeParameter, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; - buildTypeParameterDisplayFromSymbol(symbol: Symbol, writer: SymbolWriter, enclosingDeclaraiton?: Node, flags?: TypeFormatFlags): void; - buildDisplayForParametersAndDelimiters(parameters: Symbol[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; + buildTypePredicateDisplay(predicate: TypePredicate, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; + buildTypeParameterDisplayFromSymbol(symbol: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; + buildDisplayForParametersAndDelimiters(thisType: Type, 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; } @@ -1111,17 +1263,29 @@ declare namespace ts { WriteTypeArgumentsOfSignature = 32, InElementType = 64, UseFullyQualifiedType = 128, + InFirstTypeArgument = 256, } enum SymbolFormatFlags { None = 0, WriteTypeParametersOrArguments = 1, UseOnlyExternalAliasing = 2, } - interface TypePredicate { - parameterName: string; - parameterIndex: number; + enum TypePredicateKind { + This = 0, + Identifier = 1, + } + interface TypePredicateBase { + kind: TypePredicateKind; type: Type; } + interface ThisTypePredicate extends TypePredicateBase { + _thisTypePredicateBrand: any; + } + interface IdentifierTypePredicate extends TypePredicateBase { + parameterName: string; + parameterIndex: number; + } + type TypePredicate = IdentifierTypePredicate | ThisTypePredicate; enum SymbolFlags { None = 0, FunctionScopedVariable = 1, @@ -1195,6 +1359,7 @@ declare namespace ts { valueDeclaration?: Declaration; members?: SymbolTable; exports?: SymbolTable; + globalExports?: SymbolTable; } interface SymbolTable { [index: string]: Symbol; @@ -1222,11 +1387,13 @@ declare namespace ts { ESSymbol = 16777216, ThisType = 33554432, ObjectLiteralPatternWithComputedProperties = 67108864, + Never = 134217728, StringLike = 258, NumberLike = 132, ObjectType = 80896, UnionOrIntersection = 49152, StructuredType = 130048, + Narrowable = 97793, } type DestructuringPattern = BindingPattern | ObjectLiteralExpression | ArrayLiteralExpression; interface Type { @@ -1249,8 +1416,8 @@ declare namespace ts { declaredProperties: Symbol[]; declaredCallSignatures: Signature[]; declaredConstructSignatures: Signature[]; - declaredStringIndexType: Type; - declaredNumberIndexType: Type; + declaredStringIndexInfo: IndexInfo; + declaredNumberIndexInfo: IndexInfo; } interface TypeReference extends ObjectType { target: GenericType; @@ -1279,12 +1446,17 @@ declare namespace ts { declaration: SignatureDeclaration; typeParameters: TypeParameter[]; parameters: Symbol[]; - typePredicate?: TypePredicate; + thisType?: Type; } enum IndexKind { String = 0, Number = 1, } + interface IndexInfo { + type: Type; + isReadonly: boolean; + declaration?: SignatureDeclaration; + } interface DiagnosticMessage { key: string; category: DiagnosticCategory; @@ -1320,10 +1492,15 @@ declare namespace ts { Classic = 1, NodeJs = 2, } + type RootPaths = string[]; + type PathSubstitutions = Map; + type TsConfigOnlyOptions = RootPaths | PathSubstitutions; + type CompilerOptionsValue = string | number | boolean | (string | number)[] | TsConfigOnlyOptions; interface CompilerOptions { allowNonTsExtensions?: boolean; charset?: string; declaration?: boolean; + declarationDir?: string; diagnostics?: boolean; emitBOM?: boolean; help?: boolean; @@ -1331,7 +1508,9 @@ declare namespace ts { inlineSourceMap?: boolean; inlineSources?: boolean; jsx?: JsxEmit; + reactNamespace?: string; listFiles?: boolean; + typesSearchPaths?: string[]; locale?: string; mapRoot?: string; module?: ModuleKind; @@ -1341,6 +1520,7 @@ declare namespace ts { noEmitOnError?: boolean; noErrorTruncation?: boolean; noImplicitAny?: boolean; + noImplicitThis?: boolean; noLib?: boolean; noResolve?: boolean; out?: string; @@ -1366,7 +1546,33 @@ declare namespace ts { noImplicitReturns?: boolean; noFallthroughCasesInSwitch?: boolean; forceConsistentCasingInFileNames?: boolean; - [option: string]: string | number | boolean; + baseUrl?: string; + paths?: PathSubstitutions; + rootDirs?: RootPaths; + traceResolution?: boolean; + allowSyntheticDefaultImports?: boolean; + allowJs?: boolean; + noImplicitUseStrict?: boolean; + strictNullChecks?: boolean; + listEmittedFiles?: boolean; + lib?: string[]; + types?: string[]; + list?: string[]; + [option: string]: CompilerOptionsValue | undefined; + } + interface TypingOptions { + enableAutoDiscovery?: boolean; + include?: string[]; + exclude?: string[]; + [option: string]: string[] | boolean | undefined; + } + interface DiscoverTypingsInfo { + fileNames: string[]; + projectRootPath: string; + safeListPath: string; + packageNameToTypingLocation: Map; + typingOptions: TypingOptions; + compilerOptions: CompilerOptions; } enum ModuleKind { None = 0, @@ -1390,6 +1596,13 @@ declare namespace ts { line: number; character: number; } + enum ScriptKind { + Unknown = 0, + JS = 1, + JSX = 2, + TS = 3, + TSX = 4, + } enum ScriptTarget { ES3 = 0, ES5 = 1, @@ -1403,12 +1616,17 @@ declare namespace ts { } interface ParsedCommandLine { options: CompilerOptions; + typingOptions?: TypingOptions; fileNames: string[]; + raw?: any; errors: Diagnostic[]; } interface ModuleResolutionHost { fileExists(fileName: string): boolean; readFile(fileName: string): string; + trace?(s: string): void; + directoryExists?(directoryName: string): boolean; + realpath?(path: string): string; } interface ResolvedModule { resolvedFileName: string; @@ -1418,16 +1636,30 @@ declare namespace ts { resolvedModule: ResolvedModule; failedLookupLocations: string[]; } + interface ResolvedTypeReferenceDirective { + primary: boolean; + resolvedFileName?: string; + } + interface ResolvedTypeReferenceDirectiveWithFailedLookupLocations { + resolvedTypeReferenceDirective: ResolvedTypeReferenceDirective; + failedLookupLocations: string[]; + } interface CompilerHost extends ModuleResolutionHost { getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile; + getSourceFileByPath?(fileName: string, path: Path, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile; getCancellationToken?(): CancellationToken; getDefaultLibFileName(options: CompilerOptions): string; + getDefaultLibLocation?(): string; writeFile: WriteFileCallback; getCurrentDirectory(): string; getCanonicalFileName(fileName: string): string; useCaseSensitiveFileNames(): boolean; getNewLine(): string; resolveModuleNames?(moduleNames: string[], containingFile: string): ResolvedModule[]; + /** + * 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[]; } interface TextSpan { start: number; @@ -1439,6 +1671,13 @@ declare namespace ts { } } declare namespace ts { + type FileWatcherCallback = (fileName: string, removed?: boolean) => void; + type DirectoryWatcherCallback = (directoryName: string) => void; + interface WatchedFile { + fileName: string; + callback: FileWatcherCallback; + mtime?: Date; + } interface System { args: string[]; newLine: string; @@ -1446,8 +1685,8 @@ declare namespace ts { write(s: string): void; readFile(path: string, encoding?: string): string; writeFile(path: string, data: string, writeByteOrderMark?: boolean): void; - watchFile?(path: string, callback: (path: string, removed?: boolean) => void): FileWatcher; - watchDirectory?(path: string, callback: (path: string) => void, recursive?: boolean): FileWatcher; + watchFile?(path: string, callback: FileWatcherCallback): FileWatcher; + watchDirectory?(path: string, callback: DirectoryWatcherCallback, recursive?: boolean): FileWatcher; resolvePath(path: string): string; fileExists(path: string): boolean; directoryExists(path: string): boolean; @@ -1455,12 +1694,19 @@ declare namespace ts { getExecutingFilePath(): string; getCurrentDirectory(): string; readDirectory(path: string, extension?: string, exclude?: string[]): string[]; + getModifiedTime?(path: string): Date; + createHash?(data: string): string; getMemoryUsage?(): number; exit(exitCode?: number): void; + realpath?(path: string): string; } interface FileWatcher { close(): void; } + interface DirectoryWatcher extends FileWatcher { + directoryName: string; + referenceCount: number; + } var sys: System; } declare namespace ts { @@ -1485,6 +1731,7 @@ declare namespace ts { scanJsxIdentifier(): SyntaxKind; reScanJsxToken(): SyntaxKind; scanJsxToken(): SyntaxKind; + scanJSDocToken(): SyntaxKind; scan(): SyntaxKind; setText(text: string, start?: number, length?: number): void; setOnError(onError: ErrorCallback): void; @@ -1492,6 +1739,7 @@ declare namespace ts { setLanguageVariant(variant: LanguageVariant): void; setTextPos(textPos: number): void; lookAhead(callback: () => T): T; + scanRange(start: number, length: number, callback: () => T): T; tryScan(callback: () => T): T; } function tokenToString(t: SyntaxKind): string; @@ -1537,19 +1785,29 @@ declare namespace ts { */ function collapseTextChangeRangesAcrossMultipleVersions(changes: TextChangeRange[]): TextChangeRange; function getTypeParameterOwner(d: Declaration): Declaration; + function isParameterPropertyDeclaration(node: ParameterDeclaration): boolean; + function startsWith(str: string, prefix: string): boolean; + function endsWith(str: string, suffix: string): boolean; } declare namespace ts { function createNode(kind: SyntaxKind, pos?: number, end?: number): Node; function forEachChild(node: Node, cbNode: (node: Node) => T, cbNodeArray?: (nodes: Node[]) => T): T; - function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean): SourceFile; + function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean, scriptKind?: ScriptKind): SourceFile; + function isExternalModule(file: SourceFile): boolean; function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile; } declare namespace ts { const version: string; - function findConfigFile(searchPath: string): string; + function findConfigFile(searchPath: string, fileExists: (fileName: string) => boolean): string; function resolveTripleslashReference(moduleName: string, containingFile: string): string; + /** + * @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, options: CompilerOptions, host: ModuleResolutionHost): ResolvedTypeReferenceDirectiveWithFailedLookupLocations; function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations; - function nodeModuleNameResolver(moduleName: string, containingFile: string, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations; + function nodeModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations; function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations; function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost; function getPreEmitDiagnostics(program: Program, sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[]; @@ -1557,7 +1815,6 @@ declare namespace ts { function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost, oldProgram?: Program): Program; } declare namespace ts { - function parseCommandLine(commandLine: string[], readFile?: (path: string) => string): ParsedCommandLine; /** * Read tsconfig.json file * @param fileName The path to the config file @@ -1582,15 +1839,19 @@ declare namespace ts { * @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): ParsedCommandLine; - function convertCompilerOptionsFromJson(jsonOptions: any, basePath: string): { + function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string): ParsedCommandLine; + function convertCompilerOptionsFromJson(jsonOptions: any, basePath: string, configFileName?: string): { + options: CompilerOptions; + errors: Diagnostic[]; + }; + function convertTypingOptionsFromJson(jsonOptions: any, basePath: string, configFileName?: string): { options: CompilerOptions; errors: Diagnostic[]; }; } declare namespace ts { /** The version of the language service API */ - let servicesVersion: string; + const servicesVersion: string; interface Node { getSourceFile(): SourceFile; getChildCount(sourceFile?: SourceFile): number; @@ -1624,6 +1885,7 @@ declare namespace ts { getStringIndexType(): Type; getNumberIndexType(): Type; getBaseTypes(): ObjectType[]; + getNonNullableType(): Type; } interface Signature { getDeclaration(): SignatureDeclaration; @@ -1659,11 +1921,12 @@ declare namespace ts { /** Releases all resources held by this script snapshot */ dispose?(): void; } - module ScriptSnapshot { + namespace ScriptSnapshot { function fromString(text: string): IScriptSnapshot; } interface PreProcessedFileInfo { referencedFiles: FileReference[]; + typeReferenceDirectives: FileReference[]; importedFiles: FileReference[]; ambientExternalModules: string[]; isLibFile: boolean; @@ -1676,8 +1939,9 @@ declare namespace ts { getNewLine?(): string; getProjectVersion?(): string; getScriptFileNames(): string[]; + getScriptKind?(fileName: string): ScriptKind; getScriptVersion(fileName: string): string; - getScriptSnapshot(fileName: string): IScriptSnapshot; + getScriptSnapshot(fileName: string): IScriptSnapshot | undefined; getLocalizedDiagnosticMessages?(): any; getCancellationToken?(): HostCancellationToken; getCurrentDirectory(): string; @@ -1687,6 +1951,8 @@ declare namespace ts { error?(s: string): void; useCaseSensitiveFileNames?(): boolean; resolveModuleNames?(moduleNames: string[], containingFile: string): ResolvedModule[]; + resolveTypeReferenceDirectives?(typeDirectiveNames: string[], containingFile: string): ResolvedTypeReferenceDirective[]; + directoryExists?(directoryName: string): boolean; } interface LanguageService { cleanupSemanticCache(): void; @@ -1728,9 +1994,9 @@ declare namespace ts { getFormattingEditsForDocument(fileName: string, options: FormatCodeOptions): TextChange[]; getFormattingEditsAfterKeystroke(fileName: string, position: number, key: string, options: FormatCodeOptions): TextChange[]; getDocCommentTemplateAtPosition(fileName: string, position: number): TextInsertion; + isValidBraceCompletionAtPostion(fileName: string, position: number, openingBrace: number): boolean; getEmitOutput(fileName: string): EmitOutput; getProgram(): Program; - getSourceFile(fileName: string): SourceFile; dispose(): void; } interface Classifications { @@ -1782,7 +2048,7 @@ declare namespace ts { fileName: string; highlightSpans: HighlightSpan[]; } - module HighlightSpanKind { + namespace HighlightSpanKind { const none: string; const definition: string; const reference: string; @@ -1824,6 +2090,7 @@ declare namespace ts { InsertSpaceAfterFunctionKeywordForAnonymousFunctions: boolean; InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean; InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: boolean; + InsertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: boolean; PlaceOpenBraceOnNewLineForFunctions: boolean; PlaceOpenBraceOnNewLineForControlBlocks: boolean; [s: string]: boolean | number | string; @@ -2042,7 +2309,8 @@ declare namespace ts { * @parm version Current version of the file. Only used if the file was not found * in the registry and a new one was created. */ - acquireDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string): SourceFile; + 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 @@ -2055,7 +2323,9 @@ declare namespace ts { * @param scriptSnapshot Text of the file. * @param version Current version of the file. */ - updateDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string): SourceFile; + 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. * @@ -2066,9 +2336,13 @@ declare namespace ts { * @param compilationSettings The compilation settings used to acquire the file */ releaseDocument(fileName: string, compilationSettings: CompilerOptions): void; + releaseDocumentWithKey(path: Path, key: DocumentRegistryBucketKey): void; reportStats(): string; } - module ScriptElementKind { + type DocumentRegistryBucketKey = string & { + __bucketKey: any; + }; + namespace ScriptElementKind { const unknown: string; const warning: string; const keyword: string; @@ -2099,7 +2373,7 @@ declare namespace ts { const constElement: string; const letElement: string; } - module ScriptElementKindModifier { + namespace ScriptElementKindModifier { const none: string; const publicMemberModifier: string; const privateMemberModifier: string; @@ -2130,6 +2404,9 @@ declare namespace ts { static jsxOpenTagName: string; static jsxCloseTagName: string; static jsxSelfClosingTagName: string; + static jsxAttribute: string; + static jsxText: string; + static jsxAttributeStringLiteralValue: string; } enum ClassificationType { comment = 1, @@ -2153,6 +2430,9 @@ declare namespace ts { jsxOpenTagName = 19, jsxCloseTagName = 20, jsxSelfClosingTagName = 21, + jsxAttribute = 22, + jsxText = 23, + jsxAttributeStringLiteralValue = 24, } interface DisplayPartsSymbolWriter extends SymbolWriter { displayParts(): SymbolDisplayPart[]; @@ -2173,10 +2453,9 @@ declare namespace ts { } function transpileModule(input: string, transpileOptions: TranspileOptions): TranspileOutput; function transpile(input: string, compilerOptions?: CompilerOptions, fileName?: string, diagnostics?: Diagnostic[], moduleName?: string): string; - function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile; + function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean, scriptKind?: ScriptKind): SourceFile; let disableIncrementalParsing: boolean; function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile; - function createGetCanonicalFileName(useCaseSensitivefileNames: boolean): (fileName: string) => string; function createDocumentRegistry(useCaseSensitiveFileNames?: boolean, currentDirectory?: string): DocumentRegistry; function preProcessFile(sourceText: string, readImportFiles?: boolean, detectJavaScriptImports?: boolean): PreProcessedFileInfo; function createLanguageService(host: LanguageServiceHost, documentRegistry?: DocumentRegistry): LanguageService; diff --git a/lib/typescriptServices.js b/lib/typescriptServices.js index 498ddc37860..e78eda7b0bb 100644 --- a/lib/typescriptServices.js +++ b/lib/typescriptServices.js @@ -13,6 +13,11 @@ See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; var ts; (function (ts) { // token > SyntaxKind.Identifer => token is a keyword @@ -156,187 +161,195 @@ var ts; SyntaxKind[SyntaxKind["IsKeyword"] = 124] = "IsKeyword"; SyntaxKind[SyntaxKind["ModuleKeyword"] = 125] = "ModuleKeyword"; SyntaxKind[SyntaxKind["NamespaceKeyword"] = 126] = "NamespaceKeyword"; - SyntaxKind[SyntaxKind["RequireKeyword"] = 127] = "RequireKeyword"; - SyntaxKind[SyntaxKind["NumberKeyword"] = 128] = "NumberKeyword"; - SyntaxKind[SyntaxKind["SetKeyword"] = 129] = "SetKeyword"; - SyntaxKind[SyntaxKind["StringKeyword"] = 130] = "StringKeyword"; - SyntaxKind[SyntaxKind["SymbolKeyword"] = 131] = "SymbolKeyword"; - SyntaxKind[SyntaxKind["TypeKeyword"] = 132] = "TypeKeyword"; - SyntaxKind[SyntaxKind["FromKeyword"] = 133] = "FromKeyword"; - SyntaxKind[SyntaxKind["OfKeyword"] = 134] = "OfKeyword"; + SyntaxKind[SyntaxKind["NeverKeyword"] = 127] = "NeverKeyword"; + SyntaxKind[SyntaxKind["ReadonlyKeyword"] = 128] = "ReadonlyKeyword"; + SyntaxKind[SyntaxKind["RequireKeyword"] = 129] = "RequireKeyword"; + SyntaxKind[SyntaxKind["NumberKeyword"] = 130] = "NumberKeyword"; + SyntaxKind[SyntaxKind["SetKeyword"] = 131] = "SetKeyword"; + SyntaxKind[SyntaxKind["StringKeyword"] = 132] = "StringKeyword"; + SyntaxKind[SyntaxKind["SymbolKeyword"] = 133] = "SymbolKeyword"; + SyntaxKind[SyntaxKind["TypeKeyword"] = 134] = "TypeKeyword"; + SyntaxKind[SyntaxKind["UndefinedKeyword"] = 135] = "UndefinedKeyword"; + SyntaxKind[SyntaxKind["FromKeyword"] = 136] = "FromKeyword"; + SyntaxKind[SyntaxKind["GlobalKeyword"] = 137] = "GlobalKeyword"; + SyntaxKind[SyntaxKind["OfKeyword"] = 138] = "OfKeyword"; // Parse tree nodes // Names - SyntaxKind[SyntaxKind["QualifiedName"] = 135] = "QualifiedName"; - SyntaxKind[SyntaxKind["ComputedPropertyName"] = 136] = "ComputedPropertyName"; + SyntaxKind[SyntaxKind["QualifiedName"] = 139] = "QualifiedName"; + SyntaxKind[SyntaxKind["ComputedPropertyName"] = 140] = "ComputedPropertyName"; // Signature elements - SyntaxKind[SyntaxKind["TypeParameter"] = 137] = "TypeParameter"; - SyntaxKind[SyntaxKind["Parameter"] = 138] = "Parameter"; - SyntaxKind[SyntaxKind["Decorator"] = 139] = "Decorator"; + SyntaxKind[SyntaxKind["TypeParameter"] = 141] = "TypeParameter"; + SyntaxKind[SyntaxKind["Parameter"] = 142] = "Parameter"; + SyntaxKind[SyntaxKind["Decorator"] = 143] = "Decorator"; // TypeMember - SyntaxKind[SyntaxKind["PropertySignature"] = 140] = "PropertySignature"; - SyntaxKind[SyntaxKind["PropertyDeclaration"] = 141] = "PropertyDeclaration"; - SyntaxKind[SyntaxKind["MethodSignature"] = 142] = "MethodSignature"; - SyntaxKind[SyntaxKind["MethodDeclaration"] = 143] = "MethodDeclaration"; - SyntaxKind[SyntaxKind["Constructor"] = 144] = "Constructor"; - SyntaxKind[SyntaxKind["GetAccessor"] = 145] = "GetAccessor"; - SyntaxKind[SyntaxKind["SetAccessor"] = 146] = "SetAccessor"; - SyntaxKind[SyntaxKind["CallSignature"] = 147] = "CallSignature"; - SyntaxKind[SyntaxKind["ConstructSignature"] = 148] = "ConstructSignature"; - SyntaxKind[SyntaxKind["IndexSignature"] = 149] = "IndexSignature"; + SyntaxKind[SyntaxKind["PropertySignature"] = 144] = "PropertySignature"; + SyntaxKind[SyntaxKind["PropertyDeclaration"] = 145] = "PropertyDeclaration"; + SyntaxKind[SyntaxKind["MethodSignature"] = 146] = "MethodSignature"; + SyntaxKind[SyntaxKind["MethodDeclaration"] = 147] = "MethodDeclaration"; + SyntaxKind[SyntaxKind["Constructor"] = 148] = "Constructor"; + SyntaxKind[SyntaxKind["GetAccessor"] = 149] = "GetAccessor"; + SyntaxKind[SyntaxKind["SetAccessor"] = 150] = "SetAccessor"; + SyntaxKind[SyntaxKind["CallSignature"] = 151] = "CallSignature"; + SyntaxKind[SyntaxKind["ConstructSignature"] = 152] = "ConstructSignature"; + SyntaxKind[SyntaxKind["IndexSignature"] = 153] = "IndexSignature"; // Type - SyntaxKind[SyntaxKind["TypePredicate"] = 150] = "TypePredicate"; - SyntaxKind[SyntaxKind["TypeReference"] = 151] = "TypeReference"; - SyntaxKind[SyntaxKind["FunctionType"] = 152] = "FunctionType"; - SyntaxKind[SyntaxKind["ConstructorType"] = 153] = "ConstructorType"; - SyntaxKind[SyntaxKind["TypeQuery"] = 154] = "TypeQuery"; - SyntaxKind[SyntaxKind["TypeLiteral"] = 155] = "TypeLiteral"; - SyntaxKind[SyntaxKind["ArrayType"] = 156] = "ArrayType"; - SyntaxKind[SyntaxKind["TupleType"] = 157] = "TupleType"; - SyntaxKind[SyntaxKind["UnionType"] = 158] = "UnionType"; - SyntaxKind[SyntaxKind["IntersectionType"] = 159] = "IntersectionType"; - SyntaxKind[SyntaxKind["ParenthesizedType"] = 160] = "ParenthesizedType"; + SyntaxKind[SyntaxKind["TypePredicate"] = 154] = "TypePredicate"; + SyntaxKind[SyntaxKind["TypeReference"] = 155] = "TypeReference"; + SyntaxKind[SyntaxKind["FunctionType"] = 156] = "FunctionType"; + SyntaxKind[SyntaxKind["ConstructorType"] = 157] = "ConstructorType"; + SyntaxKind[SyntaxKind["TypeQuery"] = 158] = "TypeQuery"; + SyntaxKind[SyntaxKind["TypeLiteral"] = 159] = "TypeLiteral"; + SyntaxKind[SyntaxKind["ArrayType"] = 160] = "ArrayType"; + SyntaxKind[SyntaxKind["TupleType"] = 161] = "TupleType"; + SyntaxKind[SyntaxKind["UnionType"] = 162] = "UnionType"; + SyntaxKind[SyntaxKind["IntersectionType"] = 163] = "IntersectionType"; + SyntaxKind[SyntaxKind["ParenthesizedType"] = 164] = "ParenthesizedType"; + SyntaxKind[SyntaxKind["ThisType"] = 165] = "ThisType"; + SyntaxKind[SyntaxKind["StringLiteralType"] = 166] = "StringLiteralType"; // Binding patterns - SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 161] = "ObjectBindingPattern"; - SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 162] = "ArrayBindingPattern"; - SyntaxKind[SyntaxKind["BindingElement"] = 163] = "BindingElement"; + SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 167] = "ObjectBindingPattern"; + SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 168] = "ArrayBindingPattern"; + SyntaxKind[SyntaxKind["BindingElement"] = 169] = "BindingElement"; // Expression - SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 164] = "ArrayLiteralExpression"; - SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 165] = "ObjectLiteralExpression"; - SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 166] = "PropertyAccessExpression"; - SyntaxKind[SyntaxKind["ElementAccessExpression"] = 167] = "ElementAccessExpression"; - SyntaxKind[SyntaxKind["CallExpression"] = 168] = "CallExpression"; - SyntaxKind[SyntaxKind["NewExpression"] = 169] = "NewExpression"; - SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 170] = "TaggedTemplateExpression"; - SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 171] = "TypeAssertionExpression"; - SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 172] = "ParenthesizedExpression"; - SyntaxKind[SyntaxKind["FunctionExpression"] = 173] = "FunctionExpression"; - SyntaxKind[SyntaxKind["ArrowFunction"] = 174] = "ArrowFunction"; - SyntaxKind[SyntaxKind["DeleteExpression"] = 175] = "DeleteExpression"; - SyntaxKind[SyntaxKind["TypeOfExpression"] = 176] = "TypeOfExpression"; - SyntaxKind[SyntaxKind["VoidExpression"] = 177] = "VoidExpression"; - SyntaxKind[SyntaxKind["AwaitExpression"] = 178] = "AwaitExpression"; - SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 179] = "PrefixUnaryExpression"; - SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 180] = "PostfixUnaryExpression"; - SyntaxKind[SyntaxKind["BinaryExpression"] = 181] = "BinaryExpression"; - SyntaxKind[SyntaxKind["ConditionalExpression"] = 182] = "ConditionalExpression"; - SyntaxKind[SyntaxKind["TemplateExpression"] = 183] = "TemplateExpression"; - SyntaxKind[SyntaxKind["YieldExpression"] = 184] = "YieldExpression"; - SyntaxKind[SyntaxKind["SpreadElementExpression"] = 185] = "SpreadElementExpression"; - SyntaxKind[SyntaxKind["ClassExpression"] = 186] = "ClassExpression"; - SyntaxKind[SyntaxKind["OmittedExpression"] = 187] = "OmittedExpression"; - SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 188] = "ExpressionWithTypeArguments"; - SyntaxKind[SyntaxKind["AsExpression"] = 189] = "AsExpression"; + SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 170] = "ArrayLiteralExpression"; + SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 171] = "ObjectLiteralExpression"; + SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 172] = "PropertyAccessExpression"; + SyntaxKind[SyntaxKind["ElementAccessExpression"] = 173] = "ElementAccessExpression"; + SyntaxKind[SyntaxKind["CallExpression"] = 174] = "CallExpression"; + SyntaxKind[SyntaxKind["NewExpression"] = 175] = "NewExpression"; + SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 176] = "TaggedTemplateExpression"; + SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 177] = "TypeAssertionExpression"; + SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 178] = "ParenthesizedExpression"; + SyntaxKind[SyntaxKind["FunctionExpression"] = 179] = "FunctionExpression"; + SyntaxKind[SyntaxKind["ArrowFunction"] = 180] = "ArrowFunction"; + SyntaxKind[SyntaxKind["DeleteExpression"] = 181] = "DeleteExpression"; + SyntaxKind[SyntaxKind["TypeOfExpression"] = 182] = "TypeOfExpression"; + SyntaxKind[SyntaxKind["VoidExpression"] = 183] = "VoidExpression"; + SyntaxKind[SyntaxKind["AwaitExpression"] = 184] = "AwaitExpression"; + SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 185] = "PrefixUnaryExpression"; + SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 186] = "PostfixUnaryExpression"; + SyntaxKind[SyntaxKind["BinaryExpression"] = 187] = "BinaryExpression"; + SyntaxKind[SyntaxKind["ConditionalExpression"] = 188] = "ConditionalExpression"; + SyntaxKind[SyntaxKind["TemplateExpression"] = 189] = "TemplateExpression"; + SyntaxKind[SyntaxKind["YieldExpression"] = 190] = "YieldExpression"; + SyntaxKind[SyntaxKind["SpreadElementExpression"] = 191] = "SpreadElementExpression"; + SyntaxKind[SyntaxKind["ClassExpression"] = 192] = "ClassExpression"; + SyntaxKind[SyntaxKind["OmittedExpression"] = 193] = "OmittedExpression"; + SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 194] = "ExpressionWithTypeArguments"; + SyntaxKind[SyntaxKind["AsExpression"] = 195] = "AsExpression"; + SyntaxKind[SyntaxKind["NonNullExpression"] = 196] = "NonNullExpression"; // Misc - SyntaxKind[SyntaxKind["TemplateSpan"] = 190] = "TemplateSpan"; - SyntaxKind[SyntaxKind["SemicolonClassElement"] = 191] = "SemicolonClassElement"; + SyntaxKind[SyntaxKind["TemplateSpan"] = 197] = "TemplateSpan"; + SyntaxKind[SyntaxKind["SemicolonClassElement"] = 198] = "SemicolonClassElement"; // Element - SyntaxKind[SyntaxKind["Block"] = 192] = "Block"; - SyntaxKind[SyntaxKind["VariableStatement"] = 193] = "VariableStatement"; - SyntaxKind[SyntaxKind["EmptyStatement"] = 194] = "EmptyStatement"; - SyntaxKind[SyntaxKind["ExpressionStatement"] = 195] = "ExpressionStatement"; - SyntaxKind[SyntaxKind["IfStatement"] = 196] = "IfStatement"; - SyntaxKind[SyntaxKind["DoStatement"] = 197] = "DoStatement"; - SyntaxKind[SyntaxKind["WhileStatement"] = 198] = "WhileStatement"; - SyntaxKind[SyntaxKind["ForStatement"] = 199] = "ForStatement"; - SyntaxKind[SyntaxKind["ForInStatement"] = 200] = "ForInStatement"; - SyntaxKind[SyntaxKind["ForOfStatement"] = 201] = "ForOfStatement"; - SyntaxKind[SyntaxKind["ContinueStatement"] = 202] = "ContinueStatement"; - SyntaxKind[SyntaxKind["BreakStatement"] = 203] = "BreakStatement"; - SyntaxKind[SyntaxKind["ReturnStatement"] = 204] = "ReturnStatement"; - SyntaxKind[SyntaxKind["WithStatement"] = 205] = "WithStatement"; - SyntaxKind[SyntaxKind["SwitchStatement"] = 206] = "SwitchStatement"; - SyntaxKind[SyntaxKind["LabeledStatement"] = 207] = "LabeledStatement"; - SyntaxKind[SyntaxKind["ThrowStatement"] = 208] = "ThrowStatement"; - SyntaxKind[SyntaxKind["TryStatement"] = 209] = "TryStatement"; - SyntaxKind[SyntaxKind["DebuggerStatement"] = 210] = "DebuggerStatement"; - SyntaxKind[SyntaxKind["VariableDeclaration"] = 211] = "VariableDeclaration"; - SyntaxKind[SyntaxKind["VariableDeclarationList"] = 212] = "VariableDeclarationList"; - SyntaxKind[SyntaxKind["FunctionDeclaration"] = 213] = "FunctionDeclaration"; - SyntaxKind[SyntaxKind["ClassDeclaration"] = 214] = "ClassDeclaration"; - SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 215] = "InterfaceDeclaration"; - SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 216] = "TypeAliasDeclaration"; - SyntaxKind[SyntaxKind["EnumDeclaration"] = 217] = "EnumDeclaration"; - SyntaxKind[SyntaxKind["ModuleDeclaration"] = 218] = "ModuleDeclaration"; - SyntaxKind[SyntaxKind["ModuleBlock"] = 219] = "ModuleBlock"; - SyntaxKind[SyntaxKind["CaseBlock"] = 220] = "CaseBlock"; - SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 221] = "ImportEqualsDeclaration"; - SyntaxKind[SyntaxKind["ImportDeclaration"] = 222] = "ImportDeclaration"; - SyntaxKind[SyntaxKind["ImportClause"] = 223] = "ImportClause"; - SyntaxKind[SyntaxKind["NamespaceImport"] = 224] = "NamespaceImport"; - SyntaxKind[SyntaxKind["NamedImports"] = 225] = "NamedImports"; - SyntaxKind[SyntaxKind["ImportSpecifier"] = 226] = "ImportSpecifier"; - SyntaxKind[SyntaxKind["ExportAssignment"] = 227] = "ExportAssignment"; - SyntaxKind[SyntaxKind["ExportDeclaration"] = 228] = "ExportDeclaration"; - SyntaxKind[SyntaxKind["NamedExports"] = 229] = "NamedExports"; - SyntaxKind[SyntaxKind["ExportSpecifier"] = 230] = "ExportSpecifier"; - SyntaxKind[SyntaxKind["MissingDeclaration"] = 231] = "MissingDeclaration"; + SyntaxKind[SyntaxKind["Block"] = 199] = "Block"; + SyntaxKind[SyntaxKind["VariableStatement"] = 200] = "VariableStatement"; + SyntaxKind[SyntaxKind["EmptyStatement"] = 201] = "EmptyStatement"; + SyntaxKind[SyntaxKind["ExpressionStatement"] = 202] = "ExpressionStatement"; + SyntaxKind[SyntaxKind["IfStatement"] = 203] = "IfStatement"; + SyntaxKind[SyntaxKind["DoStatement"] = 204] = "DoStatement"; + SyntaxKind[SyntaxKind["WhileStatement"] = 205] = "WhileStatement"; + SyntaxKind[SyntaxKind["ForStatement"] = 206] = "ForStatement"; + SyntaxKind[SyntaxKind["ForInStatement"] = 207] = "ForInStatement"; + SyntaxKind[SyntaxKind["ForOfStatement"] = 208] = "ForOfStatement"; + SyntaxKind[SyntaxKind["ContinueStatement"] = 209] = "ContinueStatement"; + SyntaxKind[SyntaxKind["BreakStatement"] = 210] = "BreakStatement"; + SyntaxKind[SyntaxKind["ReturnStatement"] = 211] = "ReturnStatement"; + SyntaxKind[SyntaxKind["WithStatement"] = 212] = "WithStatement"; + SyntaxKind[SyntaxKind["SwitchStatement"] = 213] = "SwitchStatement"; + SyntaxKind[SyntaxKind["LabeledStatement"] = 214] = "LabeledStatement"; + SyntaxKind[SyntaxKind["ThrowStatement"] = 215] = "ThrowStatement"; + SyntaxKind[SyntaxKind["TryStatement"] = 216] = "TryStatement"; + SyntaxKind[SyntaxKind["DebuggerStatement"] = 217] = "DebuggerStatement"; + SyntaxKind[SyntaxKind["VariableDeclaration"] = 218] = "VariableDeclaration"; + SyntaxKind[SyntaxKind["VariableDeclarationList"] = 219] = "VariableDeclarationList"; + SyntaxKind[SyntaxKind["FunctionDeclaration"] = 220] = "FunctionDeclaration"; + SyntaxKind[SyntaxKind["ClassDeclaration"] = 221] = "ClassDeclaration"; + SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 222] = "InterfaceDeclaration"; + SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 223] = "TypeAliasDeclaration"; + SyntaxKind[SyntaxKind["EnumDeclaration"] = 224] = "EnumDeclaration"; + SyntaxKind[SyntaxKind["ModuleDeclaration"] = 225] = "ModuleDeclaration"; + SyntaxKind[SyntaxKind["ModuleBlock"] = 226] = "ModuleBlock"; + SyntaxKind[SyntaxKind["CaseBlock"] = 227] = "CaseBlock"; + SyntaxKind[SyntaxKind["GlobalModuleExportDeclaration"] = 228] = "GlobalModuleExportDeclaration"; + SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 229] = "ImportEqualsDeclaration"; + SyntaxKind[SyntaxKind["ImportDeclaration"] = 230] = "ImportDeclaration"; + SyntaxKind[SyntaxKind["ImportClause"] = 231] = "ImportClause"; + SyntaxKind[SyntaxKind["NamespaceImport"] = 232] = "NamespaceImport"; + SyntaxKind[SyntaxKind["NamedImports"] = 233] = "NamedImports"; + SyntaxKind[SyntaxKind["ImportSpecifier"] = 234] = "ImportSpecifier"; + SyntaxKind[SyntaxKind["ExportAssignment"] = 235] = "ExportAssignment"; + SyntaxKind[SyntaxKind["ExportDeclaration"] = 236] = "ExportDeclaration"; + SyntaxKind[SyntaxKind["NamedExports"] = 237] = "NamedExports"; + SyntaxKind[SyntaxKind["ExportSpecifier"] = 238] = "ExportSpecifier"; + SyntaxKind[SyntaxKind["MissingDeclaration"] = 239] = "MissingDeclaration"; // Module references - SyntaxKind[SyntaxKind["ExternalModuleReference"] = 232] = "ExternalModuleReference"; + SyntaxKind[SyntaxKind["ExternalModuleReference"] = 240] = "ExternalModuleReference"; // JSX - SyntaxKind[SyntaxKind["JsxElement"] = 233] = "JsxElement"; - SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 234] = "JsxSelfClosingElement"; - SyntaxKind[SyntaxKind["JsxOpeningElement"] = 235] = "JsxOpeningElement"; - SyntaxKind[SyntaxKind["JsxText"] = 236] = "JsxText"; - SyntaxKind[SyntaxKind["JsxClosingElement"] = 237] = "JsxClosingElement"; - SyntaxKind[SyntaxKind["JsxAttribute"] = 238] = "JsxAttribute"; - SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 239] = "JsxSpreadAttribute"; - SyntaxKind[SyntaxKind["JsxExpression"] = 240] = "JsxExpression"; + SyntaxKind[SyntaxKind["JsxElement"] = 241] = "JsxElement"; + SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 242] = "JsxSelfClosingElement"; + SyntaxKind[SyntaxKind["JsxOpeningElement"] = 243] = "JsxOpeningElement"; + SyntaxKind[SyntaxKind["JsxText"] = 244] = "JsxText"; + SyntaxKind[SyntaxKind["JsxClosingElement"] = 245] = "JsxClosingElement"; + SyntaxKind[SyntaxKind["JsxAttribute"] = 246] = "JsxAttribute"; + SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 247] = "JsxSpreadAttribute"; + SyntaxKind[SyntaxKind["JsxExpression"] = 248] = "JsxExpression"; // Clauses - SyntaxKind[SyntaxKind["CaseClause"] = 241] = "CaseClause"; - SyntaxKind[SyntaxKind["DefaultClause"] = 242] = "DefaultClause"; - SyntaxKind[SyntaxKind["HeritageClause"] = 243] = "HeritageClause"; - SyntaxKind[SyntaxKind["CatchClause"] = 244] = "CatchClause"; + SyntaxKind[SyntaxKind["CaseClause"] = 249] = "CaseClause"; + SyntaxKind[SyntaxKind["DefaultClause"] = 250] = "DefaultClause"; + SyntaxKind[SyntaxKind["HeritageClause"] = 251] = "HeritageClause"; + SyntaxKind[SyntaxKind["CatchClause"] = 252] = "CatchClause"; // Property assignments - SyntaxKind[SyntaxKind["PropertyAssignment"] = 245] = "PropertyAssignment"; - SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 246] = "ShorthandPropertyAssignment"; + SyntaxKind[SyntaxKind["PropertyAssignment"] = 253] = "PropertyAssignment"; + SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 254] = "ShorthandPropertyAssignment"; // Enum - SyntaxKind[SyntaxKind["EnumMember"] = 247] = "EnumMember"; + SyntaxKind[SyntaxKind["EnumMember"] = 255] = "EnumMember"; // Top-level nodes - SyntaxKind[SyntaxKind["SourceFile"] = 248] = "SourceFile"; - // JSDoc nodes. - SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 249] = "JSDocTypeExpression"; - // The * type. - SyntaxKind[SyntaxKind["JSDocAllType"] = 250] = "JSDocAllType"; - // The ? type. - SyntaxKind[SyntaxKind["JSDocUnknownType"] = 251] = "JSDocUnknownType"; - SyntaxKind[SyntaxKind["JSDocArrayType"] = 252] = "JSDocArrayType"; - SyntaxKind[SyntaxKind["JSDocUnionType"] = 253] = "JSDocUnionType"; - SyntaxKind[SyntaxKind["JSDocTupleType"] = 254] = "JSDocTupleType"; - SyntaxKind[SyntaxKind["JSDocNullableType"] = 255] = "JSDocNullableType"; - SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 256] = "JSDocNonNullableType"; - SyntaxKind[SyntaxKind["JSDocRecordType"] = 257] = "JSDocRecordType"; - SyntaxKind[SyntaxKind["JSDocRecordMember"] = 258] = "JSDocRecordMember"; - SyntaxKind[SyntaxKind["JSDocTypeReference"] = 259] = "JSDocTypeReference"; - SyntaxKind[SyntaxKind["JSDocOptionalType"] = 260] = "JSDocOptionalType"; - SyntaxKind[SyntaxKind["JSDocFunctionType"] = 261] = "JSDocFunctionType"; - SyntaxKind[SyntaxKind["JSDocVariadicType"] = 262] = "JSDocVariadicType"; - SyntaxKind[SyntaxKind["JSDocConstructorType"] = 263] = "JSDocConstructorType"; - SyntaxKind[SyntaxKind["JSDocThisType"] = 264] = "JSDocThisType"; - SyntaxKind[SyntaxKind["JSDocComment"] = 265] = "JSDocComment"; - SyntaxKind[SyntaxKind["JSDocTag"] = 266] = "JSDocTag"; - SyntaxKind[SyntaxKind["JSDocParameterTag"] = 267] = "JSDocParameterTag"; - SyntaxKind[SyntaxKind["JSDocReturnTag"] = 268] = "JSDocReturnTag"; - SyntaxKind[SyntaxKind["JSDocTypeTag"] = 269] = "JSDocTypeTag"; - SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 270] = "JSDocTemplateTag"; + SyntaxKind[SyntaxKind["SourceFile"] = 256] = "SourceFile"; + // JSDoc nodes + SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 257] = "JSDocTypeExpression"; + // The * type + SyntaxKind[SyntaxKind["JSDocAllType"] = 258] = "JSDocAllType"; + // The ? type + SyntaxKind[SyntaxKind["JSDocUnknownType"] = 259] = "JSDocUnknownType"; + SyntaxKind[SyntaxKind["JSDocArrayType"] = 260] = "JSDocArrayType"; + SyntaxKind[SyntaxKind["JSDocUnionType"] = 261] = "JSDocUnionType"; + SyntaxKind[SyntaxKind["JSDocTupleType"] = 262] = "JSDocTupleType"; + SyntaxKind[SyntaxKind["JSDocNullableType"] = 263] = "JSDocNullableType"; + SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 264] = "JSDocNonNullableType"; + SyntaxKind[SyntaxKind["JSDocRecordType"] = 265] = "JSDocRecordType"; + SyntaxKind[SyntaxKind["JSDocRecordMember"] = 266] = "JSDocRecordMember"; + SyntaxKind[SyntaxKind["JSDocTypeReference"] = 267] = "JSDocTypeReference"; + SyntaxKind[SyntaxKind["JSDocOptionalType"] = 268] = "JSDocOptionalType"; + SyntaxKind[SyntaxKind["JSDocFunctionType"] = 269] = "JSDocFunctionType"; + SyntaxKind[SyntaxKind["JSDocVariadicType"] = 270] = "JSDocVariadicType"; + SyntaxKind[SyntaxKind["JSDocConstructorType"] = 271] = "JSDocConstructorType"; + SyntaxKind[SyntaxKind["JSDocThisType"] = 272] = "JSDocThisType"; + SyntaxKind[SyntaxKind["JSDocComment"] = 273] = "JSDocComment"; + SyntaxKind[SyntaxKind["JSDocTag"] = 274] = "JSDocTag"; + SyntaxKind[SyntaxKind["JSDocParameterTag"] = 275] = "JSDocParameterTag"; + SyntaxKind[SyntaxKind["JSDocReturnTag"] = 276] = "JSDocReturnTag"; + SyntaxKind[SyntaxKind["JSDocTypeTag"] = 277] = "JSDocTypeTag"; + SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 278] = "JSDocTemplateTag"; // Synthesized list - SyntaxKind[SyntaxKind["SyntaxList"] = 271] = "SyntaxList"; + SyntaxKind[SyntaxKind["SyntaxList"] = 279] = "SyntaxList"; // Enum value count - SyntaxKind[SyntaxKind["Count"] = 272] = "Count"; + SyntaxKind[SyntaxKind["Count"] = 280] = "Count"; // Markers SyntaxKind[SyntaxKind["FirstAssignment"] = 56] = "FirstAssignment"; SyntaxKind[SyntaxKind["LastAssignment"] = 68] = "LastAssignment"; SyntaxKind[SyntaxKind["FirstReservedWord"] = 70] = "FirstReservedWord"; SyntaxKind[SyntaxKind["LastReservedWord"] = 105] = "LastReservedWord"; SyntaxKind[SyntaxKind["FirstKeyword"] = 70] = "FirstKeyword"; - SyntaxKind[SyntaxKind["LastKeyword"] = 134] = "LastKeyword"; + SyntaxKind[SyntaxKind["LastKeyword"] = 138] = "LastKeyword"; SyntaxKind[SyntaxKind["FirstFutureReservedWord"] = 106] = "FirstFutureReservedWord"; SyntaxKind[SyntaxKind["LastFutureReservedWord"] = 114] = "LastFutureReservedWord"; - SyntaxKind[SyntaxKind["FirstTypeNode"] = 151] = "FirstTypeNode"; - SyntaxKind[SyntaxKind["LastTypeNode"] = 160] = "LastTypeNode"; + SyntaxKind[SyntaxKind["FirstTypeNode"] = 154] = "FirstTypeNode"; + SyntaxKind[SyntaxKind["LastTypeNode"] = 166] = "LastTypeNode"; SyntaxKind[SyntaxKind["FirstPunctuation"] = 15] = "FirstPunctuation"; SyntaxKind[SyntaxKind["LastPunctuation"] = 68] = "LastPunctuation"; SyntaxKind[SyntaxKind["FirstToken"] = 0] = "FirstToken"; - SyntaxKind[SyntaxKind["LastToken"] = 134] = "LastToken"; + SyntaxKind[SyntaxKind["LastToken"] = 138] = "LastToken"; SyntaxKind[SyntaxKind["FirstTriviaToken"] = 2] = "FirstTriviaToken"; SyntaxKind[SyntaxKind["LastTriviaToken"] = 7] = "LastTriviaToken"; SyntaxKind[SyntaxKind["FirstLiteralToken"] = 8] = "FirstLiteralToken"; @@ -345,73 +358,61 @@ var ts; SyntaxKind[SyntaxKind["LastTemplateToken"] = 14] = "LastTemplateToken"; SyntaxKind[SyntaxKind["FirstBinaryOperator"] = 25] = "FirstBinaryOperator"; SyntaxKind[SyntaxKind["LastBinaryOperator"] = 68] = "LastBinaryOperator"; - SyntaxKind[SyntaxKind["FirstNode"] = 135] = "FirstNode"; + SyntaxKind[SyntaxKind["FirstNode"] = 139] = "FirstNode"; })(ts.SyntaxKind || (ts.SyntaxKind = {})); var SyntaxKind = ts.SyntaxKind; (function (NodeFlags) { NodeFlags[NodeFlags["None"] = 0] = "None"; - NodeFlags[NodeFlags["Export"] = 2] = "Export"; - NodeFlags[NodeFlags["Ambient"] = 4] = "Ambient"; - NodeFlags[NodeFlags["Public"] = 8] = "Public"; - NodeFlags[NodeFlags["Private"] = 16] = "Private"; - NodeFlags[NodeFlags["Protected"] = 32] = "Protected"; - NodeFlags[NodeFlags["Static"] = 64] = "Static"; + NodeFlags[NodeFlags["Export"] = 1] = "Export"; + NodeFlags[NodeFlags["Ambient"] = 2] = "Ambient"; + NodeFlags[NodeFlags["Public"] = 4] = "Public"; + NodeFlags[NodeFlags["Private"] = 8] = "Private"; + NodeFlags[NodeFlags["Protected"] = 16] = "Protected"; + NodeFlags[NodeFlags["Static"] = 32] = "Static"; + NodeFlags[NodeFlags["Readonly"] = 64] = "Readonly"; NodeFlags[NodeFlags["Abstract"] = 128] = "Abstract"; NodeFlags[NodeFlags["Async"] = 256] = "Async"; NodeFlags[NodeFlags["Default"] = 512] = "Default"; - NodeFlags[NodeFlags["MultiLine"] = 1024] = "MultiLine"; - NodeFlags[NodeFlags["Synthetic"] = 2048] = "Synthetic"; - NodeFlags[NodeFlags["DeclarationFile"] = 4096] = "DeclarationFile"; - NodeFlags[NodeFlags["Let"] = 8192] = "Let"; - NodeFlags[NodeFlags["Const"] = 16384] = "Const"; - NodeFlags[NodeFlags["OctalLiteral"] = 32768] = "OctalLiteral"; - NodeFlags[NodeFlags["Namespace"] = 65536] = "Namespace"; - NodeFlags[NodeFlags["ExportContext"] = 131072] = "ExportContext"; - NodeFlags[NodeFlags["ContainsThis"] = 262144] = "ContainsThis"; - NodeFlags[NodeFlags["HasImplicitReturn"] = 524288] = "HasImplicitReturn"; - NodeFlags[NodeFlags["HasExplicitReturn"] = 1048576] = "HasExplicitReturn"; - NodeFlags[NodeFlags["Modifier"] = 1022] = "Modifier"; - NodeFlags[NodeFlags["AccessibilityModifier"] = 56] = "AccessibilityModifier"; - NodeFlags[NodeFlags["BlockScoped"] = 24576] = "BlockScoped"; - NodeFlags[NodeFlags["ReachabilityCheckFlags"] = 1572864] = "ReachabilityCheckFlags"; + NodeFlags[NodeFlags["Let"] = 1024] = "Let"; + NodeFlags[NodeFlags["Const"] = 2048] = "Const"; + NodeFlags[NodeFlags["Namespace"] = 4096] = "Namespace"; + NodeFlags[NodeFlags["ExportContext"] = 8192] = "ExportContext"; + NodeFlags[NodeFlags["ContainsThis"] = 16384] = "ContainsThis"; + NodeFlags[NodeFlags["HasImplicitReturn"] = 32768] = "HasImplicitReturn"; + NodeFlags[NodeFlags["HasExplicitReturn"] = 65536] = "HasExplicitReturn"; + NodeFlags[NodeFlags["GlobalAugmentation"] = 131072] = "GlobalAugmentation"; + NodeFlags[NodeFlags["HasClassExtends"] = 262144] = "HasClassExtends"; + NodeFlags[NodeFlags["HasDecorators"] = 524288] = "HasDecorators"; + NodeFlags[NodeFlags["HasParamDecorators"] = 1048576] = "HasParamDecorators"; + NodeFlags[NodeFlags["HasAsyncFunctions"] = 2097152] = "HasAsyncFunctions"; + NodeFlags[NodeFlags["DisallowInContext"] = 4194304] = "DisallowInContext"; + NodeFlags[NodeFlags["YieldContext"] = 8388608] = "YieldContext"; + NodeFlags[NodeFlags["DecoratorContext"] = 16777216] = "DecoratorContext"; + NodeFlags[NodeFlags["AwaitContext"] = 33554432] = "AwaitContext"; + NodeFlags[NodeFlags["ThisNodeHasError"] = 67108864] = "ThisNodeHasError"; + NodeFlags[NodeFlags["JavaScriptFile"] = 134217728] = "JavaScriptFile"; + NodeFlags[NodeFlags["ThisNodeOrAnySubNodesHasError"] = 268435456] = "ThisNodeOrAnySubNodesHasError"; + NodeFlags[NodeFlags["HasAggregatedChildData"] = 536870912] = "HasAggregatedChildData"; + NodeFlags[NodeFlags["HasJsxSpreadAttribute"] = 1073741824] = "HasJsxSpreadAttribute"; + NodeFlags[NodeFlags["Modifier"] = 1023] = "Modifier"; + NodeFlags[NodeFlags["AccessibilityModifier"] = 28] = "AccessibilityModifier"; + // Accessibility modifiers and 'readonly' can be attached to a parameter in a constructor to make it a property. + NodeFlags[NodeFlags["ParameterPropertyModifier"] = 92] = "ParameterPropertyModifier"; + NodeFlags[NodeFlags["BlockScoped"] = 3072] = "BlockScoped"; + NodeFlags[NodeFlags["ReachabilityCheckFlags"] = 98304] = "ReachabilityCheckFlags"; + NodeFlags[NodeFlags["EmitHelperFlags"] = 3932160] = "EmitHelperFlags"; + // Parsing context flags + NodeFlags[NodeFlags["ContextFlags"] = 197132288] = "ContextFlags"; + // Exclude these flags when parsing a Type + NodeFlags[NodeFlags["TypeExcludesFlags"] = 41943040] = "TypeExcludesFlags"; })(ts.NodeFlags || (ts.NodeFlags = {})); var NodeFlags = ts.NodeFlags; - /* @internal */ - (function (ParserContextFlags) { - ParserContextFlags[ParserContextFlags["None"] = 0] = "None"; - // If this node was parsed in a context where 'in-expressions' are not allowed. - ParserContextFlags[ParserContextFlags["DisallowIn"] = 1] = "DisallowIn"; - // If this node was parsed in the 'yield' context created when parsing a generator. - ParserContextFlags[ParserContextFlags["Yield"] = 2] = "Yield"; - // If this node was parsed as part of a decorator - ParserContextFlags[ParserContextFlags["Decorator"] = 4] = "Decorator"; - // If this node was parsed in the 'await' context created when parsing an async function. - ParserContextFlags[ParserContextFlags["Await"] = 8] = "Await"; - // If the parser encountered an error when parsing the code that created this node. Note - // the parser only sets this directly on the node it creates right after encountering the - // error. - ParserContextFlags[ParserContextFlags["ThisNodeHasError"] = 16] = "ThisNodeHasError"; - // This node was parsed in a JavaScript file and can be processed differently. For example - // its type can be specified usign a JSDoc comment. - ParserContextFlags[ParserContextFlags["JavaScriptFile"] = 32] = "JavaScriptFile"; - // Context flags set directly by the parser. - ParserContextFlags[ParserContextFlags["ParserGeneratedFlags"] = 31] = "ParserGeneratedFlags"; - // Exclude these flags when parsing a Type - ParserContextFlags[ParserContextFlags["TypeExcludesFlags"] = 10] = "TypeExcludesFlags"; - // Context flags computed by aggregating child flags upwards. - // Used during incremental parsing to determine if this node or any of its children had an - // error. Computed only once and then cached. - ParserContextFlags[ParserContextFlags["ThisNodeOrAnySubNodesHasError"] = 64] = "ThisNodeOrAnySubNodesHasError"; - // Used to know if we've computed data from children and cached it in this node. - ParserContextFlags[ParserContextFlags["HasAggregatedChildData"] = 128] = "HasAggregatedChildData"; - })(ts.ParserContextFlags || (ts.ParserContextFlags = {})); - var ParserContextFlags = ts.ParserContextFlags; (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["ClassElement"] = 4] = "ClassElement"; - JsxFlags[JsxFlags["UnknownElement"] = 8] = "UnknownElement"; JsxFlags[JsxFlags["IntrinsicElement"] = 3] = "IntrinsicElement"; })(ts.JsxFlags || (ts.JsxFlags = {})); var JsxFlags = ts.JsxFlags; @@ -422,11 +423,25 @@ var ts; RelationComparisonResult[RelationComparisonResult["FailedAndReported"] = 3] = "FailedAndReported"; })(ts.RelationComparisonResult || (ts.RelationComparisonResult = {})); var RelationComparisonResult = ts.RelationComparisonResult; + (function (FlowFlags) { + FlowFlags[FlowFlags["Unreachable"] = 1] = "Unreachable"; + FlowFlags[FlowFlags["Start"] = 2] = "Start"; + FlowFlags[FlowFlags["BranchLabel"] = 4] = "BranchLabel"; + FlowFlags[FlowFlags["LoopLabel"] = 8] = "LoopLabel"; + FlowFlags[FlowFlags["Assignment"] = 16] = "Assignment"; + FlowFlags[FlowFlags["TrueCondition"] = 32] = "TrueCondition"; + FlowFlags[FlowFlags["FalseCondition"] = 64] = "FalseCondition"; + FlowFlags[FlowFlags["Referenced"] = 128] = "Referenced"; + FlowFlags[FlowFlags["Shared"] = 256] = "Shared"; + FlowFlags[FlowFlags["Label"] = 12] = "Label"; + FlowFlags[FlowFlags["Condition"] = 96] = "Condition"; + })(ts.FlowFlags || (ts.FlowFlags = {})); + var FlowFlags = ts.FlowFlags; var OperationCanceledException = (function () { function OperationCanceledException() { } return OperationCanceledException; - })(); + }()); ts.OperationCanceledException = OperationCanceledException; /** Return code used by getEmitOutput function to indicate status of the function */ (function (ExitStatus) { @@ -450,6 +465,7 @@ var ts; TypeFormatFlags[TypeFormatFlags["WriteTypeArgumentsOfSignature"] = 32] = "WriteTypeArgumentsOfSignature"; TypeFormatFlags[TypeFormatFlags["InElementType"] = 64] = "InElementType"; TypeFormatFlags[TypeFormatFlags["UseFullyQualifiedType"] = 128] = "UseFullyQualifiedType"; + TypeFormatFlags[TypeFormatFlags["InFirstTypeArgument"] = 256] = "InFirstTypeArgument"; })(ts.TypeFormatFlags || (ts.TypeFormatFlags = {})); var TypeFormatFlags = ts.TypeFormatFlags; (function (SymbolFormatFlags) { @@ -472,6 +488,11 @@ var ts; SymbolAccessibility[SymbolAccessibility["CannotBeNamed"] = 2] = "CannotBeNamed"; })(ts.SymbolAccessibility || (ts.SymbolAccessibility = {})); var SymbolAccessibility = ts.SymbolAccessibility; + (function (TypePredicateKind) { + TypePredicateKind[TypePredicateKind["This"] = 0] = "This"; + TypePredicateKind[TypePredicateKind["Identifier"] = 1] = "Identifier"; + })(ts.TypePredicateKind || (ts.TypePredicateKind = {})); + var TypePredicateKind = ts.TypePredicateKind; /** Indicates how to serialize the name for a TypeReferenceNode when emitting decorator * metadata */ /* @internal */ @@ -573,21 +594,20 @@ var ts; NodeCheckFlags[NodeCheckFlags["TypeChecked"] = 1] = "TypeChecked"; NodeCheckFlags[NodeCheckFlags["LexicalThis"] = 2] = "LexicalThis"; NodeCheckFlags[NodeCheckFlags["CaptureThis"] = 4] = "CaptureThis"; - NodeCheckFlags[NodeCheckFlags["EmitExtends"] = 8] = "EmitExtends"; - NodeCheckFlags[NodeCheckFlags["EmitDecorate"] = 16] = "EmitDecorate"; - NodeCheckFlags[NodeCheckFlags["EmitParam"] = 32] = "EmitParam"; - NodeCheckFlags[NodeCheckFlags["EmitAwaiter"] = 64] = "EmitAwaiter"; - NodeCheckFlags[NodeCheckFlags["EmitGenerator"] = 128] = "EmitGenerator"; NodeCheckFlags[NodeCheckFlags["SuperInstance"] = 256] = "SuperInstance"; NodeCheckFlags[NodeCheckFlags["SuperStatic"] = 512] = "SuperStatic"; NodeCheckFlags[NodeCheckFlags["ContextChecked"] = 1024] = "ContextChecked"; - NodeCheckFlags[NodeCheckFlags["LexicalArguments"] = 2048] = "LexicalArguments"; - NodeCheckFlags[NodeCheckFlags["CaptureArguments"] = 4096] = "CaptureArguments"; - // Values for enum members have been computed, and any errors have been reported for them. - NodeCheckFlags[NodeCheckFlags["EnumValuesComputed"] = 8192] = "EnumValuesComputed"; - NodeCheckFlags[NodeCheckFlags["BlockScopedBindingInLoop"] = 16384] = "BlockScopedBindingInLoop"; + NodeCheckFlags[NodeCheckFlags["AsyncMethodWithSuper"] = 2048] = "AsyncMethodWithSuper"; + NodeCheckFlags[NodeCheckFlags["AsyncMethodWithSuperBinding"] = 4096] = "AsyncMethodWithSuperBinding"; + NodeCheckFlags[NodeCheckFlags["CaptureArguments"] = 8192] = "CaptureArguments"; + NodeCheckFlags[NodeCheckFlags["EnumValuesComputed"] = 16384] = "EnumValuesComputed"; NodeCheckFlags[NodeCheckFlags["LexicalModuleMergesWithClass"] = 32768] = "LexicalModuleMergesWithClass"; - NodeCheckFlags[NodeCheckFlags["LoopWithBlockScopedBindingCapturedInFunction"] = 65536] = "LoopWithBlockScopedBindingCapturedInFunction"; + NodeCheckFlags[NodeCheckFlags["LoopWithCapturedBlockScopedBinding"] = 65536] = "LoopWithCapturedBlockScopedBinding"; + NodeCheckFlags[NodeCheckFlags["CapturedBlockScopedBinding"] = 131072] = "CapturedBlockScopedBinding"; + NodeCheckFlags[NodeCheckFlags["BlockScopedBindingInLoop"] = 262144] = "BlockScopedBindingInLoop"; + NodeCheckFlags[NodeCheckFlags["ClassWithBodyScopedClassBinding"] = 524288] = "ClassWithBodyScopedClassBinding"; + NodeCheckFlags[NodeCheckFlags["BodyScopedClassBinding"] = 1048576] = "BodyScopedClassBinding"; + NodeCheckFlags[NodeCheckFlags["NeedsLoopOutParameter"] = 2097152] = "NeedsLoopOutParameter"; })(ts.NodeCheckFlags || (ts.NodeCheckFlags = {})); var NodeCheckFlags = ts.NodeCheckFlags; (function (TypeFlags) { @@ -623,8 +643,11 @@ var ts; TypeFlags[TypeFlags["ESSymbol"] = 16777216] = "ESSymbol"; TypeFlags[TypeFlags["ThisType"] = 33554432] = "ThisType"; TypeFlags[TypeFlags["ObjectLiteralPatternWithComputedProperties"] = 67108864] = "ObjectLiteralPatternWithComputedProperties"; + TypeFlags[TypeFlags["Never"] = 134217728] = "Never"; /* @internal */ - TypeFlags[TypeFlags["Intrinsic"] = 16777343] = "Intrinsic"; + TypeFlags[TypeFlags["Nullable"] = 96] = "Nullable"; + /* @internal */ + TypeFlags[TypeFlags["Intrinsic"] = 150995071] = "Intrinsic"; /* @internal */ TypeFlags[TypeFlags["Primitive"] = 16777726] = "Primitive"; TypeFlags[TypeFlags["StringLike"] = 258] = "StringLike"; @@ -632,6 +655,7 @@ var ts; TypeFlags[TypeFlags["ObjectType"] = 80896] = "ObjectType"; TypeFlags[TypeFlags["UnionOrIntersection"] = 49152] = "UnionOrIntersection"; TypeFlags[TypeFlags["StructuredType"] = 130048] = "StructuredType"; + TypeFlags[TypeFlags["Narrowable"] = 97793] = "Narrowable"; /* @internal */ TypeFlags[TypeFlags["RequiresWidening"] = 6291456] = "RequiresWidening"; /* @internal */ @@ -648,6 +672,19 @@ var ts; IndexKind[IndexKind["Number"] = 1] = "Number"; })(ts.IndexKind || (ts.IndexKind = {})); var IndexKind = ts.IndexKind; + /* @internal */ + (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"; + })(ts.SpecialPropertyAssignmentKind || (ts.SpecialPropertyAssignmentKind = {})); + var SpecialPropertyAssignmentKind = ts.SpecialPropertyAssignmentKind; (function (DiagnosticCategory) { DiagnosticCategory[DiagnosticCategory["Warning"] = 0] = "Warning"; DiagnosticCategory[DiagnosticCategory["Error"] = 1] = "Error"; @@ -680,6 +717,14 @@ var ts; NewLineKind[NewLineKind["LineFeed"] = 1] = "LineFeed"; })(ts.NewLineKind || (ts.NewLineKind = {})); var NewLineKind = ts.NewLineKind; + (function (ScriptKind) { + ScriptKind[ScriptKind["Unknown"] = 0] = "Unknown"; + ScriptKind[ScriptKind["JS"] = 1] = "JS"; + ScriptKind[ScriptKind["JSX"] = 2] = "JSX"; + ScriptKind[ScriptKind["TS"] = 3] = "TS"; + ScriptKind[ScriptKind["TSX"] = 4] = "TSX"; + })(ts.ScriptKind || (ts.ScriptKind = {})); + var ScriptKind = ts.ScriptKind; (function (ScriptTarget) { ScriptTarget[ScriptTarget["ES3"] = 0] = "ES3"; ScriptTarget[ScriptTarget["ES5"] = 1] = "ES5"; @@ -915,11 +960,11 @@ var ts; return undefined; } ts.forEach = forEach; - function contains(array, value) { + function contains(array, value, areEqual) { if (array) { for (var _i = 0, array_1 = array; _i < array_1.length; _i++) { var v = array_1[_i]; - if (v === value) { + if (areEqual ? areEqual(v, value) : v === value) { return true; } } @@ -985,13 +1030,13 @@ var ts; return array1.concat(array2); } ts.concatenate = concatenate; - function deduplicate(array) { + function deduplicate(array, areEqual) { var result; if (array) { result = []; for (var _i = 0, array_5 = array; _i < array_5.length; _i++) { var item = array_5[_i]; - if (!contains(result, item)) { + if (!contains(result, item, areEqual)) { result.push(item); } } @@ -1068,9 +1113,17 @@ var ts; var count = array.length; if (count > 0) { var pos = 0; - var result = arguments.length <= 2 ? array[pos++] : initial; + var result = void 0; + if (arguments.length <= 2) { + result = array[pos]; + pos++; + } + else { + result = initial; + } while (pos < count) { - result = f(result, array[pos++]); + result = f(result, array[pos]); + pos++; } return result; } @@ -1082,9 +1135,17 @@ var ts; if (array) { var pos = array.length - 1; if (pos >= 0) { - var result = arguments.length <= 2 ? array[pos--] : initial; + var result = void 0; + if (arguments.length <= 2) { + result = array[pos]; + pos--; + } + else { + result = initial; + } while (pos >= 0) { - result = f(result, array[pos--]); + result = f(result, array[pos]); + pos--; } return result; } @@ -1097,6 +1158,14 @@ var ts; return hasOwnProperty.call(map, key); } ts.hasProperty = hasProperty; + function getKeys(map) { + var keys = []; + for (var key in map) { + keys.push(key); + } + return keys; + } + ts.getKeys = getKeys; function getProperty(map, key) { return hasOwnProperty.call(map, key) ? map[key] : undefined; } @@ -1177,6 +1246,32 @@ var ts; return result; } ts.arrayToMap = arrayToMap; + /** + * Reduce the properties of a map. + * + * @param map The map to reduce + * @param callback An aggregation function that is called for each entry in the map + * @param initial The initial value for the reduction. + */ + function reduceProperties(map, callback, initial) { + var result = initial; + if (map) { + for (var key in map) { + if (hasProperty(map, key)) { + result = callback(result, map[key], String(key)); + } + } + } + return result; + } + ts.reduceProperties = reduceProperties; + /** + * Tests whether a value is an array. + */ + function isArray(value) { + return Array.isArray ? Array.isArray(value) : value instanceof Array; + } + ts.isArray = isArray; function memoize(callback) { var value; return function () { @@ -1221,6 +1316,15 @@ var ts; }; } ts.createFileDiagnostic = createFileDiagnostic; + /* internal */ + function formatMessage(dummy, message) { + var text = getLocaleSpecificMessage(message); + if (arguments.length > 2) { + text = formatStringFromArgs(text, arguments, 2); + } + return text; + } + ts.formatMessage = formatMessage; function createCompilerDiagnostic(message) { var text = getLocaleSpecificMessage(message); if (arguments.length > 1) { @@ -1423,7 +1527,7 @@ var ts; } ts.getNormalizedPathFromPathComponents = getNormalizedPathFromPathComponents; function getNormalizedPathComponentsOfUrl(url) { - // Get root length of http://www.website.com/folder1/foler2/ + // Get root length of http://www.website.com/folder1/folder2/ // In this example the root is: http://www.website.com/ // normalized path components should be ["http://www.website.com/", "folder1", "folder2"] var urlLength = url.length; @@ -1448,7 +1552,7 @@ var ts; var indexOfNextSlash = url.indexOf(ts.directorySeparator, rootLength); if (indexOfNextSlash !== -1) { // Found the "/" after the website.com so the root is length of http://www.website.com/ - // and get components afetr the root normally like any other folder components + // and get components after the root normally like any other folder components rootLength = indexOfNextSlash + 1; return normalizedPathComponents(url, rootLength); } @@ -1477,7 +1581,8 @@ var ts; directoryComponents.length--; } // Find the component that differs - for (var joinStartIndex = 0; joinStartIndex < pathComponents.length && joinStartIndex < directoryComponents.length; joinStartIndex++) { + var joinStartIndex; + for (joinStartIndex = 0; joinStartIndex < pathComponents.length && joinStartIndex < directoryComponents.length; joinStartIndex++) { if (getCanonicalFileName(directoryComponents[joinStartIndex]) !== getCanonicalFileName(pathComponents[joinStartIndex])) { break; } @@ -1502,7 +1607,7 @@ var ts; } ts.getRelativePathToDirectoryOrUrl = getRelativePathToDirectoryOrUrl; function getBaseFileName(path) { - if (!path) { + if (path === undefined) { return undefined; } var i = path.lastIndexOf(ts.directorySeparator); @@ -1527,17 +1632,48 @@ var ts; return pathLen > extLen && path.substr(pathLen - extLen, extLen) === extension; } ts.fileExtensionIs = fileExtensionIs; + 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 */; + } + ts.ensureScriptKind = ensureScriptKind; + function getScriptKindFromFileName(fileName) { + var ext = fileName.substr(fileName.lastIndexOf(".")); + switch (ext.toLowerCase()) { + case ".js": + return 1 /* JS */; + case ".jsx": + return 2 /* JSX */; + case ".ts": + return 3 /* TS */; + case ".tsx": + return 4 /* TSX */; + default: + return 0 /* Unknown */; + } + } + ts.getScriptKindFromFileName = getScriptKindFromFileName; /** * List of supported extensions in order of file resolution precedence. */ - ts.supportedExtensions = [".ts", ".tsx", ".d.ts"]; - ts.supportedJsExtensions = ts.supportedExtensions.concat(".js", ".jsx"); - function isSupportedSourceFileName(fileName) { + ts.supportedTypeScriptExtensions = [".ts", ".tsx", ".d.ts"]; + ts.supportedJavascriptExtensions = [".js", ".jsx"]; + var allSupportedExtensions = ts.supportedTypeScriptExtensions.concat(ts.supportedJavascriptExtensions); + function getSupportedExtensions(options) { + return options && options.allowJs ? allSupportedExtensions : ts.supportedTypeScriptExtensions; + } + ts.getSupportedExtensions = getSupportedExtensions; + function isSupportedSourceFileName(fileName, compilerOptions) { if (!fileName) { return false; } - for (var _i = 0, supportedExtensions_1 = ts.supportedExtensions; _i < supportedExtensions_1.length; _i++) { - var extension = supportedExtensions_1[_i]; + for (var _i = 0, _a = getSupportedExtensions(compilerOptions); _i < _a.length; _i++) { + var extension = _a[_i]; if (fileExtensionIs(fileName, extension)) { return true; } @@ -1556,22 +1692,6 @@ var ts; return path; } ts.removeFileExtension = removeFileExtension; - var backslashOrDoubleQuote = /[\"\\]/g; - var escapedCharsRegExp = /[\u0000-\u001f\t\v\f\b\r\n\u2028\u2029\u0085]/g; - var escapedCharsMap = { - "\0": "\\0", - "\t": "\\t", - "\v": "\\v", - "\f": "\\f", - "\b": "\\b", - "\r": "\\r", - "\n": "\\n", - "\\": "\\\\", - "\"": "\\\"", - "\u2028": "\\u2028", - "\u2029": "\\u2029", - "\u0085": "\\u0085" // nextLine - }; function Symbol(flags, name) { this.flags = flags; this.name = name; @@ -1622,7 +1742,7 @@ var ts; } Debug.assert = assert; function fail(message) { - Debug.assert(false, message); + Debug.assert(/*expression*/ false, message); } Debug.fail = fail; })(Debug = ts.Debug || (ts.Debug = {})); @@ -1637,6 +1757,12 @@ var ts; return copiedList; } ts.copyListRemovingItem = copyListRemovingItem; + function createGetCanonicalFileName(useCaseSensitivefileNames) { + return useCaseSensitivefileNames + ? (function (fileName) { return fileName; }) + : (function (fileName) { return fileName.toLowerCase(); }); + } + ts.createGetCanonicalFileName = createGetCanonicalFileName; })(ts || (ts = {})); /// var ts; @@ -1783,91 +1909,77 @@ var ts; var _fs = require("fs"); var _path = require("path"); var _os = require("os"); - var _tty = require("tty"); - // average async stat takes about 30 microseconds - // set chunk size to do 30 files in < 1 millisecond - function createWatchedFileSet(interval, chunkSize) { - if (interval === void 0) { interval = 2500; } - if (chunkSize === void 0) { chunkSize = 30; } - var watchedFiles = []; - var nextFileToCheck = 0; - var watchTimer; - function getModifiedTime(fileName) { - return _fs.statSync(fileName).mtime; + var _crypto = require("crypto"); + var useNonPollingWatchers = process.env["TSC_NONPOLLING_WATCHER"]; + function createWatchedFileSet() { + var dirWatchers = {}; + // One file can have multiple watchers + var fileWatcherCallbacks = {}; + return { addFile: addFile, removeFile: removeFile }; + function reduceDirWatcherRefCountForFile(fileName) { + var dirName = ts.getDirectoryPath(fileName); + if (ts.hasProperty(dirWatchers, dirName)) { + var watcher = dirWatchers[dirName]; + watcher.referenceCount -= 1; + if (watcher.referenceCount <= 0) { + watcher.close(); + delete dirWatchers[dirName]; + } + } } - function poll(checkedIndex) { - var watchedFile = watchedFiles[checkedIndex]; - if (!watchedFile) { + function addDirWatcher(dirPath) { + if (ts.hasProperty(dirWatchers, dirPath)) { + var watcher_1 = dirWatchers[dirPath]; + watcher_1.referenceCount += 1; return; } - _fs.stat(watchedFile.fileName, function (err, stats) { - if (err) { - watchedFile.callback(watchedFile.fileName); - } - else if (watchedFile.mtime.getTime() !== stats.mtime.getTime()) { - watchedFile.mtime = getModifiedTime(watchedFile.fileName); - watchedFile.callback(watchedFile.fileName, watchedFile.mtime.getTime() === 0); - } - }); + var watcher = _fs.watch(dirPath, { persistent: true }, function (eventName, relativeFileName) { return fileEventHandler(eventName, relativeFileName, dirPath); }); + watcher.referenceCount = 1; + dirWatchers[dirPath] = watcher; + return; } - // this implementation uses polling and - // stat due to inconsistencies of fs.watch - // and efficiency of stat on modern filesystems - function startWatchTimer() { - watchTimer = setInterval(function () { - var count = 0; - var nextToCheck = nextFileToCheck; - var firstCheck = -1; - while ((count < chunkSize) && (nextToCheck !== firstCheck)) { - poll(nextToCheck); - if (firstCheck < 0) { - firstCheck = nextToCheck; - } - nextToCheck++; - if (nextToCheck === watchedFiles.length) { - nextToCheck = 0; - } - count++; - } - nextFileToCheck = nextToCheck; - }, interval); + function addFileWatcherCallback(filePath, callback) { + if (ts.hasProperty(fileWatcherCallbacks, filePath)) { + fileWatcherCallbacks[filePath].push(callback); + } + else { + fileWatcherCallbacks[filePath] = [callback]; + } } function addFile(fileName, callback) { - var file = { - fileName: fileName, - callback: callback, - mtime: getModifiedTime(fileName) - }; - watchedFiles.push(file); - if (watchedFiles.length === 1) { - startWatchTimer(); + addFileWatcherCallback(fileName, callback); + addDirWatcher(ts.getDirectoryPath(fileName)); + return { fileName: fileName, callback: callback }; + } + function removeFile(watchedFile) { + removeFileWatcherCallback(watchedFile.fileName, watchedFile.callback); + reduceDirWatcherRefCountForFile(watchedFile.fileName); + } + function removeFileWatcherCallback(filePath, callback) { + if (ts.hasProperty(fileWatcherCallbacks, filePath)) { + var newCallbacks = ts.copyListRemovingItem(callback, fileWatcherCallbacks[filePath]); + if (newCallbacks.length === 0) { + delete fileWatcherCallbacks[filePath]; + } + else { + fileWatcherCallbacks[filePath] = newCallbacks; + } } - return file; } - function removeFile(file) { - watchedFiles = ts.copyListRemovingItem(file, watchedFiles); + function fileEventHandler(eventName, relativeFileName, baseDirPath) { + // When files are deleted from disk, the triggered "rename" event would have a relativefileName of "undefined" + var fileName = typeof relativeFileName !== "string" + ? undefined + : ts.getNormalizedAbsolutePath(relativeFileName, baseDirPath); + // Some applications save a working file via rename operations + if ((eventName === "change" || eventName === "rename") && ts.hasProperty(fileWatcherCallbacks, fileName)) { + for (var _i = 0, _a = fileWatcherCallbacks[fileName]; _i < _a.length; _i++) { + var fileCallback = _a[_i]; + fileCallback(fileName); + } + } } - return { - getModifiedTime: getModifiedTime, - poll: poll, - startWatchTimer: startWatchTimer, - addFile: addFile, - removeFile: removeFile - }; } - // 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 watchedFileSet = createWatchedFileSet(); function isNode4OrLater() { return parseInt(process.version.charAt(1)) >= 4; @@ -1876,7 +1988,7 @@ var ts; // win32\win64 are case insensitive platforms, MacOS (darwin) by default is also case insensitive var useCaseSensitiveFileNames = platform !== "win32" && platform !== "win64" && platform !== "darwin"; function readFile(fileName, encoding) { - if (!_fs.existsSync(fileName)) { + if (!fileExists(fileName)) { return undefined; } var buffer = _fs.readFileSync(fileName); @@ -1920,7 +2032,30 @@ var ts; } } function getCanonicalPath(path) { - return useCaseSensitiveFileNames ? path.toLowerCase() : path; + return useCaseSensitiveFileNames ? path : path.toLowerCase(); + } + var FileSystemEntryKind; + (function (FileSystemEntryKind) { + FileSystemEntryKind[FileSystemEntryKind["File"] = 0] = "File"; + FileSystemEntryKind[FileSystemEntryKind["Directory"] = 1] = "Directory"; + })(FileSystemEntryKind || (FileSystemEntryKind = {})); + function fileSystemEntryExists(path, entryKind) { + try { + var stat = _fs.statSync(path); + switch (entryKind) { + case 0 /* File */: return stat.isFile(); + case 1 /* Directory */: return stat.isDirectory(); + } + } + catch (e) { + return false; + } + } + function fileExists(path) { + return fileSystemEntryExists(path, 0 /* File */); + } + function directoryExists(path) { + return fileSystemEntryExists(path, 1 /* Directory */); } function readDirectory(path, extension, exclude) { var result = []; @@ -1932,6 +2067,11 @@ var ts; var directories = []; for (var _i = 0, files_2 = files; _i < files_2.length; _i++) { var current = files_2[_i]; + // This is necessary because on some file system node fails to exclude + // "." and "..". See https://github.com/nodejs/node/issues/4002 + if (current === "." || current === "..") { + continue; + } var name_3 = ts.combinePaths(path, current); if (!ts.contains(exclude, getCanonicalPath(name_3))) { var stat = _fs.statSync(name_3); @@ -1961,29 +2101,42 @@ var ts; readFile: readFile, writeFile: writeFile, watchFile: function (fileName, callback) { - // Node 4.0 stablized the `fs.watch` function on Windows which avoids polling - // and is more efficient than `fs.watchFile` (ref: https://github.com/nodejs/node/pull/2649 - // and https://github.com/Microsoft/TypeScript/issues/4643), therefore - // if the current node.js version is newer than 4, use `fs.watch` instead. - if (isNode4OrLater()) { - // Note: in node the callback of fs.watch is given only the relative file name as a parameter - return _fs.watch(fileName, function (eventName, relativeFileName) { return callback(fileName); }); + if (useNonPollingWatchers) { + var watchedFile_1 = watchedFileSet.addFile(fileName, callback); + return { + close: function () { return watchedFileSet.removeFile(watchedFile_1); } + }; + } + else { + _fs.watchFile(fileName, { persistent: true, interval: 250 }, fileChanged); + return { + close: function () { return _fs.unwatchFile(fileName, fileChanged); } + }; + } + function fileChanged(curr, prev) { + if (+curr.mtime <= +prev.mtime) { + return; + } + callback(fileName); } - var watchedFile = watchedFileSet.addFile(fileName, callback); - return { - close: function () { return watchedFileSet.removeFile(watchedFile); } - }; }, - watchDirectory: function (path, callback, recursive) { - // Node 4.0 `fs.watch` function supports the "recursive" option on both OSX and Windows + watchDirectory: function (directoryName, callback, recursive) { + // 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) - return _fs.watch(path, { persistent: true, recursive: !!recursive }, function (eventName, relativeFileName) { + var options; + if (isNode4OrLater() && (process.platform === "win32" || process.platform === "darwin")) { + options = { persistent: true, recursive: !!recursive }; + } + else { + options = { persistent: true }; + } + return _fs.watch(directoryName, options, 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 ? relativeFileName : ts.normalizePath(ts.combinePaths(path, relativeFileName))); + callback(!relativeFileName ? relativeFileName : ts.normalizePath(ts.combinePaths(directoryName, relativeFileName))); } ; }); @@ -1991,12 +2144,8 @@ var ts; resolvePath: function (path) { return _path.resolve(path); }, - fileExists: function (path) { - return _fs.existsSync(path); - }, - directoryExists: function (path) { - return _fs.existsSync(path) && _fs.statSync(path).isDirectory(); - }, + fileExists: fileExists, + directoryExists: directoryExists, createDirectory: function (directoryName) { if (!this.directoryExists(directoryName)) { _fs.mkdirSync(directoryName); @@ -2009,6 +2158,19 @@ var ts; return process.cwd(); }, readDirectory: readDirectory, + getModifiedTime: function (path) { + try { + return _fs.statSync(path).mtime; + } + catch (e) { + return undefined; + } + }, + createHash: function (data) { + var hash = _crypto.createHash("md5"); + hash.update(data); + return hash.digest("hex"); + }, getMemoryUsage: function () { if (global.gc) { global.gc(); @@ -2017,10 +2179,45 @@ var ts; }, exit: function (exitCode) { process.exit(exitCode); + }, + realpath: function (path) { + return _fs.realpathSync(path); } }; } - if (typeof WScript !== "undefined" && typeof ActiveXObject === "function") { + function getChakraSystem() { + var realpath = ChakraHost.realpath && (function (path) { return ChakraHost.realpath(path); }); + return { + newLine: ChakraHost.newLine || "\r\n", + args: ChakraHost.args, + 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 = "\uFEFF" + data; + } + ChakraHost.writeFile(path, data); + }, + resolvePath: ChakraHost.resolvePath, + fileExists: ChakraHost.fileExists, + directoryExists: ChakraHost.directoryExists, + createDirectory: ChakraHost.createDirectory, + getExecutingFilePath: function () { return ChakraHost.executingFile; }, + getCurrentDirectory: function () { return ChakraHost.currentDirectory; }, + readDirectory: ChakraHost.readDirectory, + exit: ChakraHost.quit, + realpath: realpath + }; + } + if (typeof ChakraHost !== "undefined") { + return getChakraSystem(); + } + else if (typeof WScript !== "undefined" && typeof ActiveXObject === "function") { return getWScriptSystem(); } else if (typeof process !== "undefined" && process.nextTick && !process.browser && typeof require !== "undefined") { @@ -2056,6 +2253,7 @@ var ts; An_index_signature_must_have_a_type_annotation: { code: 1021, category: ts.DiagnosticCategory.Error, key: "An_index_signature_must_have_a_type_annotation_1021", message: "An index signature must have a type annotation." }, An_index_signature_parameter_must_have_a_type_annotation: { code: 1022, category: ts.DiagnosticCategory.Error, key: "An_index_signature_parameter_must_have_a_type_annotation_1022", message: "An index signature parameter must have a type annotation." }, An_index_signature_parameter_type_must_be_string_or_number: { code: 1023, category: ts.DiagnosticCategory.Error, key: "An_index_signature_parameter_type_must_be_string_or_number_1023", message: "An index signature parameter type must be 'string' or 'number'." }, + readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature: { code: 1024, category: ts.DiagnosticCategory.Error, key: "readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature_1024", message: "'readonly' modifier can only appear on a property declaration or index signature." }, Accessibility_modifier_already_seen: { code: 1028, category: ts.DiagnosticCategory.Error, key: "Accessibility_modifier_already_seen_1028", message: "Accessibility modifier already seen." }, _0_modifier_must_precede_1_modifier: { code: 1029, category: ts.DiagnosticCategory.Error, key: "_0_modifier_must_precede_1_modifier_1029", message: "'{0}' modifier must precede '{1}' modifier." }, _0_modifier_already_seen: { code: 1030, category: ts.DiagnosticCategory.Error, key: "_0_modifier_already_seen_1030", message: "'{0}' modifier already seen." }, @@ -2069,7 +2267,7 @@ var ts; _0_modifier_cannot_be_used_with_a_class_declaration: { code: 1041, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_be_used_with_a_class_declaration_1041", message: "'{0}' modifier cannot be used with a class declaration." }, _0_modifier_cannot_be_used_here: { code: 1042, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_be_used_here_1042", message: "'{0}' modifier cannot be used here." }, _0_modifier_cannot_appear_on_a_data_property: { code: 1043, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_appear_on_a_data_property_1043", message: "'{0}' modifier cannot appear on a data property." }, - _0_modifier_cannot_appear_on_a_module_element: { code: 1044, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_appear_on_a_module_element_1044", message: "'{0}' modifier cannot appear on a module element." }, + _0_modifier_cannot_appear_on_a_module_or_namespace_element: { code: 1044, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_appear_on_a_module_or_namespace_element_1044", message: "'{0}' modifier cannot appear on a module or namespace element." }, A_0_modifier_cannot_be_used_with_an_interface_declaration: { code: 1045, category: ts.DiagnosticCategory.Error, key: "A_0_modifier_cannot_be_used_with_an_interface_declaration_1045", message: "A '{0}' modifier cannot be used with an interface declaration." }, A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file: { code: 1046, category: ts.DiagnosticCategory.Error, key: "A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file_1046", message: "A 'declare' modifier is required for a top level declaration in a .d.ts file." }, A_rest_parameter_cannot_be_optional: { code: 1047, category: ts.DiagnosticCategory.Error, key: "A_rest_parameter_cannot_be_optional_1047", message: "A rest parameter cannot be optional." }, @@ -2088,8 +2286,11 @@ var ts; Enum_member_must_have_initializer: { code: 1061, category: ts.DiagnosticCategory.Error, key: "Enum_member_must_have_initializer_1061", message: "Enum member must have initializer." }, _0_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method: { code: 1062, category: ts.DiagnosticCategory.Error, key: "_0_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method_1062", message: "{0} is referenced directly or indirectly in the fulfillment callback of its own 'then' method." }, An_export_assignment_cannot_be_used_in_a_namespace: { code: 1063, category: ts.DiagnosticCategory.Error, key: "An_export_assignment_cannot_be_used_in_a_namespace_1063", message: "An export assignment cannot be used in a namespace." }, + The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type: { code: 1064, category: ts.DiagnosticCategory.Error, key: "The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_1064", message: "The return type of an async function or method must be the global Promise type." }, In_ambient_enum_declarations_member_initializer_must_be_constant_expression: { code: 1066, category: ts.DiagnosticCategory.Error, key: "In_ambient_enum_declarations_member_initializer_must_be_constant_expression_1066", message: "In ambient enum declarations member initializer must be constant expression." }, Unexpected_token_A_constructor_method_accessor_or_property_was_expected: { code: 1068, category: ts.DiagnosticCategory.Error, key: "Unexpected_token_A_constructor_method_accessor_or_property_was_expected_1068", message: "Unexpected token. A constructor, method, accessor, or property was expected." }, + _0_modifier_cannot_appear_on_a_type_member: { code: 1070, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_appear_on_a_type_member_1070", message: "'{0}' modifier cannot appear on a type member." }, + _0_modifier_cannot_appear_on_an_index_signature: { code: 1071, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_appear_on_an_index_signature_1071", message: "'{0}' modifier cannot appear on an index signature." }, A_0_modifier_cannot_be_used_with_an_import_declaration: { code: 1079, category: ts.DiagnosticCategory.Error, key: "A_0_modifier_cannot_be_used_with_an_import_declaration_1079", message: "A '{0}' modifier cannot be used with an import declaration." }, Invalid_reference_directive_syntax: { code: 1084, category: ts.DiagnosticCategory.Error, key: "Invalid_reference_directive_syntax_1084", message: "Invalid 'reference' directive syntax." }, Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher: { code: 1085, category: ts.DiagnosticCategory.Error, key: "Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_1085", message: "Octal literals are not available when targeting ECMAScript 5 and higher." }, @@ -2114,7 +2315,6 @@ var ts; A_return_statement_can_only_be_used_within_a_function_body: { code: 1108, category: ts.DiagnosticCategory.Error, key: "A_return_statement_can_only_be_used_within_a_function_body_1108", message: "A 'return' statement can only be used within a function body." }, Expression_expected: { code: 1109, category: ts.DiagnosticCategory.Error, key: "Expression_expected_1109", message: "Expression expected." }, Type_expected: { code: 1110, category: ts.DiagnosticCategory.Error, key: "Type_expected_1110", message: "Type expected." }, - A_class_member_cannot_be_declared_optional: { code: 1112, category: ts.DiagnosticCategory.Error, key: "A_class_member_cannot_be_declared_optional_1112", message: "A class member cannot be declared optional." }, A_default_clause_cannot_appear_more_than_once_in_a_switch_statement: { code: 1113, category: ts.DiagnosticCategory.Error, key: "A_default_clause_cannot_appear_more_than_once_in_a_switch_statement_1113", message: "A 'default' clause cannot appear more than once in a 'switch' statement." }, Duplicate_label_0: { code: 1114, category: ts.DiagnosticCategory.Error, key: "Duplicate_label_0_1114", message: "Duplicate label '{0}'" }, A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement: { code: 1115, category: ts.DiagnosticCategory.Error, key: "A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement_1115", message: "A 'continue' statement can only jump to a label of an enclosing iteration statement." }, @@ -2145,10 +2345,9 @@ var ts; String_literal_expected: { code: 1141, category: ts.DiagnosticCategory.Error, key: "String_literal_expected_1141", message: "String literal expected." }, Line_break_not_permitted_here: { code: 1142, category: ts.DiagnosticCategory.Error, key: "Line_break_not_permitted_here_1142", message: "Line break not permitted here." }, or_expected: { code: 1144, category: ts.DiagnosticCategory.Error, key: "or_expected_1144", message: "'{' or ';' expected." }, - Modifiers_not_permitted_on_index_signature_members: { code: 1145, category: ts.DiagnosticCategory.Error, key: "Modifiers_not_permitted_on_index_signature_members_1145", message: "Modifiers not permitted on index signature members." }, Declaration_expected: { code: 1146, category: ts.DiagnosticCategory.Error, key: "Declaration_expected_1146", message: "Declaration expected." }, Import_declarations_in_a_namespace_cannot_reference_a_module: { code: 1147, category: ts.DiagnosticCategory.Error, key: "Import_declarations_in_a_namespace_cannot_reference_a_module_1147", message: "Import declarations in a namespace cannot reference a module." }, - Cannot_compile_modules_unless_the_module_flag_is_provided: { code: 1148, category: ts.DiagnosticCategory.Error, key: "Cannot_compile_modules_unless_the_module_flag_is_provided_1148", message: "Cannot compile modules unless the '--module' flag is provided." }, + Cannot_compile_modules_unless_the_module_flag_is_provided_with_a_valid_module_type_Consider_setting_the_module_compiler_option_in_a_tsconfig_json_file: { code: 1148, category: ts.DiagnosticCategory.Error, key: "Cannot_compile_modules_unless_the_module_flag_is_provided_with_a_valid_module_type_Consider_setting__1148", message: "Cannot compile modules unless the '--module' flag is provided with a valid module type. Consider setting the 'module' compiler option in a 'tsconfig.json' file." }, File_name_0_differs_from_already_included_file_name_1_only_in_casing: { code: 1149, category: ts.DiagnosticCategory.Error, key: "File_name_0_differs_from_already_included_file_name_1_only_in_casing_1149", message: "File name '{0}' differs from already included file name '{1}' only in casing" }, new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead: { code: 1150, category: ts.DiagnosticCategory.Error, key: "new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead_1150", message: "'new T[]' cannot be used to create an array. Use 'new Array()' instead." }, const_declarations_must_be_initialized: { code: 1155, category: ts.DiagnosticCategory.Error, key: "const_declarations_must_be_initialized_1155", message: "'const' declarations must be initialized" }, @@ -2208,7 +2407,7 @@ var ts; Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode: { code: 1214, category: ts.DiagnosticCategory.Error, key: "Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode_1214", message: "Identifier expected. '{0}' is a reserved word in strict mode. Modules are automatically in strict mode." }, Invalid_use_of_0_Modules_are_automatically_in_strict_mode: { code: 1215, category: ts.DiagnosticCategory.Error, key: "Invalid_use_of_0_Modules_are_automatically_in_strict_mode_1215", message: "Invalid use of '{0}'. Modules are automatically in strict mode." }, Export_assignment_is_not_supported_when_module_flag_is_system: { code: 1218, category: ts.DiagnosticCategory.Error, key: "Export_assignment_is_not_supported_when_module_flag_is_system_1218", message: "Export assignment is not supported when '--module' flag is 'system'." }, - Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Specify_experimentalDecorators_to_remove_this_warning: { code: 1219, category: ts.DiagnosticCategory.Error, key: "Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Speci_1219", message: "Experimental support for decorators is a feature that is subject to change in a future release. Specify '--experimentalDecorators' to remove this warning." }, + Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning: { code: 1219, category: ts.DiagnosticCategory.Error, key: "Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_t_1219", message: "Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning." }, Generators_are_only_available_when_targeting_ECMAScript_6_or_higher: { code: 1220, category: ts.DiagnosticCategory.Error, key: "Generators_are_only_available_when_targeting_ECMAScript_6_or_higher_1220", message: "Generators are only available when targeting ECMAScript 6 or higher." }, Generators_are_not_allowed_in_an_ambient_context: { code: 1221, category: ts.DiagnosticCategory.Error, key: "Generators_are_not_allowed_in_an_ambient_context_1221", message: "Generators are not allowed in an ambient context." }, An_overload_signature_cannot_be_declared_as_a_generator: { code: 1222, category: ts.DiagnosticCategory.Error, key: "An_overload_signature_cannot_be_declared_as_a_generator_1222", message: "An overload signature cannot be declared as a generator." }, @@ -2231,15 +2430,25 @@ var ts; Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression: { code: 1239, category: ts.DiagnosticCategory.Error, key: "Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression_1239", message: "Unable to resolve signature of parameter decorator when called as an expression." }, Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression: { code: 1240, category: ts.DiagnosticCategory.Error, key: "Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression_1240", message: "Unable to resolve signature of property decorator when called as an expression." }, Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression: { code: 1241, category: ts.DiagnosticCategory.Error, key: "Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression_1241", message: "Unable to resolve signature of method decorator when called as an expression." }, - abstract_modifier_can_only_appear_on_a_class_or_method_declaration: { code: 1242, category: ts.DiagnosticCategory.Error, key: "abstract_modifier_can_only_appear_on_a_class_or_method_declaration_1242", message: "'abstract' modifier can only appear on a class or method declaration." }, + abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration: { code: 1242, category: ts.DiagnosticCategory.Error, key: "abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration_1242", message: "'abstract' modifier can only appear on a class, method, or property declaration." }, _0_modifier_cannot_be_used_with_1_modifier: { code: 1243, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_be_used_with_1_modifier_1243", message: "'{0}' modifier cannot be used with '{1}' modifier." }, Abstract_methods_can_only_appear_within_an_abstract_class: { code: 1244, category: ts.DiagnosticCategory.Error, key: "Abstract_methods_can_only_appear_within_an_abstract_class_1244", message: "Abstract methods can only appear within an abstract class." }, Method_0_cannot_have_an_implementation_because_it_is_marked_abstract: { code: 1245, category: ts.DiagnosticCategory.Error, key: "Method_0_cannot_have_an_implementation_because_it_is_marked_abstract_1245", message: "Method '{0}' cannot have an implementation because it is marked abstract." }, + An_interface_property_cannot_have_an_initializer: { code: 1246, category: ts.DiagnosticCategory.Error, key: "An_interface_property_cannot_have_an_initializer_1246", message: "An interface property cannot have an initializer." }, + A_type_literal_property_cannot_have_an_initializer: { code: 1247, category: ts.DiagnosticCategory.Error, key: "A_type_literal_property_cannot_have_an_initializer_1247", message: "A type literal property cannot have an initializer." }, + A_class_member_cannot_have_the_0_keyword: { code: 1248, category: ts.DiagnosticCategory.Error, key: "A_class_member_cannot_have_the_0_keyword_1248", message: "A class member cannot have the '{0}' keyword." }, + A_decorator_can_only_decorate_a_method_implementation_not_an_overload: { code: 1249, category: ts.DiagnosticCategory.Error, key: "A_decorator_can_only_decorate_a_method_implementation_not_an_overload_1249", message: "A decorator can only decorate a method implementation, not an overload." }, + Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5: { code: 1250, category: ts.DiagnosticCategory.Error, key: "Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_1250", message: "Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'." }, + Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Class_definitions_are_automatically_in_strict_mode: { code: 1251, category: ts.DiagnosticCategory.Error, key: "Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Class_d_1251", message: "Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. Class definitions are automatically in strict mode." }, + Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Modules_are_automatically_in_strict_mode: { code: 1252, category: ts.DiagnosticCategory.Error, key: "Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Modules_1252", message: "Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. Modules are automatically in strict mode." }, with_statements_are_not_allowed_in_an_async_function_block: { code: 1300, category: ts.DiagnosticCategory.Error, key: "with_statements_are_not_allowed_in_an_async_function_block_1300", message: "'with' statements are not allowed in an async function block." }, await_expression_is_only_allowed_within_an_async_function: { code: 1308, category: ts.DiagnosticCategory.Error, key: "await_expression_is_only_allowed_within_an_async_function_1308", message: "'await' expression is only allowed within an async function." }, Async_functions_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1311, category: ts.DiagnosticCategory.Error, key: "Async_functions_are_only_available_when_targeting_ECMAScript_6_and_higher_1311", message: "Async functions are only available when targeting ECMAScript 6 and higher." }, can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment: { code: 1312, category: ts.DiagnosticCategory.Error, key: "can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment_1312", message: "'=' can only be used in an object literal property inside a destructuring assignment." }, The_body_of_an_if_statement_cannot_be_the_empty_statement: { code: 1313, category: ts.DiagnosticCategory.Error, key: "The_body_of_an_if_statement_cannot_be_the_empty_statement_1313", message: "The body of an 'if' statement cannot be the empty statement." }, + Global_module_exports_may_only_appear_in_module_files: { code: 1314, category: ts.DiagnosticCategory.Error, key: "Global_module_exports_may_only_appear_in_module_files_1314", message: "Global module exports may only appear in module files." }, + Global_module_exports_may_only_appear_in_declaration_files: { code: 1315, category: ts.DiagnosticCategory.Error, key: "Global_module_exports_may_only_appear_in_declaration_files_1315", message: "Global module exports may only appear in declaration files." }, + Global_module_exports_may_only_appear_at_top_level: { code: 1316, category: ts.DiagnosticCategory.Error, key: "Global_module_exports_may_only_appear_at_top_level_1316", message: "Global module exports may only appear at top level." }, Duplicate_identifier_0: { code: 2300, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_0_2300", message: "Duplicate identifier '{0}'." }, Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: ts.DiagnosticCategory.Error, key: "Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301", message: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, Static_members_cannot_reference_class_type_parameters: { code: 2302, category: ts.DiagnosticCategory.Error, key: "Static_members_cannot_reference_class_type_parameters_2302", message: "Static members cannot reference class type parameters." }, @@ -2248,11 +2457,12 @@ var ts; Module_0_has_no_exported_member_1: { code: 2305, category: ts.DiagnosticCategory.Error, key: "Module_0_has_no_exported_member_1_2305", message: "Module '{0}' has no exported member '{1}'." }, File_0_is_not_a_module: { code: 2306, category: ts.DiagnosticCategory.Error, key: "File_0_is_not_a_module_2306", message: "File '{0}' is not a module." }, Cannot_find_module_0: { code: 2307, category: ts.DiagnosticCategory.Error, key: "Cannot_find_module_0_2307", message: "Cannot find module '{0}'." }, + Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambiguity: { code: 2308, category: ts.DiagnosticCategory.Error, key: "Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambig_2308", message: "Module {0} has already exported a member named '{1}'. Consider explicitly re-exporting to resolve the ambiguity." }, An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements: { code: 2309, category: ts.DiagnosticCategory.Error, key: "An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements_2309", message: "An export assignment cannot be used in a module with other exported elements." }, Type_0_recursively_references_itself_as_a_base_type: { code: 2310, category: ts.DiagnosticCategory.Error, key: "Type_0_recursively_references_itself_as_a_base_type_2310", message: "Type '{0}' recursively references itself as a base type." }, A_class_may_only_extend_another_class: { code: 2311, category: ts.DiagnosticCategory.Error, key: "A_class_may_only_extend_another_class_2311", message: "A class may only extend another class." }, An_interface_may_only_extend_a_class_or_another_interface: { code: 2312, category: ts.DiagnosticCategory.Error, key: "An_interface_may_only_extend_a_class_or_another_interface_2312", message: "An interface may only extend a class or another interface." }, - Constraint_of_a_type_parameter_cannot_reference_any_type_parameter_from_the_same_type_parameter_list: { code: 2313, category: ts.DiagnosticCategory.Error, key: "Constraint_of_a_type_parameter_cannot_reference_any_type_parameter_from_the_same_type_parameter_list_2313", message: "Constraint of a type parameter cannot reference any type parameter from the same type parameter list." }, + Type_parameter_0_has_a_circular_constraint: { code: 2313, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_has_a_circular_constraint_2313", message: "Type parameter '{0}' has a circular constraint." }, Generic_type_0_requires_1_type_argument_s: { code: 2314, category: ts.DiagnosticCategory.Error, key: "Generic_type_0_requires_1_type_argument_s_2314", message: "Generic type '{0}' requires {1} type argument(s)." }, Type_0_is_not_generic: { code: 2315, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_generic_2315", message: "Type '{0}' is not generic." }, Global_type_0_must_be_a_class_or_interface_type: { code: 2316, category: ts.DiagnosticCategory.Error, key: "Global_type_0_must_be_a_class_or_interface_type_2316", message: "Global type '{0}' must be a class or interface type." }, @@ -2262,6 +2472,7 @@ var ts; Interface_0_cannot_simultaneously_extend_types_1_and_2: { code: 2320, category: ts.DiagnosticCategory.Error, key: "Interface_0_cannot_simultaneously_extend_types_1_and_2_2320", message: "Interface '{0}' cannot simultaneously extend types '{1}' and '{2}'." }, Excessive_stack_depth_comparing_types_0_and_1: { code: 2321, category: ts.DiagnosticCategory.Error, key: "Excessive_stack_depth_comparing_types_0_and_1_2321", message: "Excessive stack depth comparing types '{0}' and '{1}'." }, Type_0_is_not_assignable_to_type_1: { code: 2322, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_assignable_to_type_1_2322", message: "Type '{0}' is not assignable to type '{1}'." }, + Cannot_redeclare_exported_variable_0: { code: 2323, category: ts.DiagnosticCategory.Error, key: "Cannot_redeclare_exported_variable_0_2323", message: "Cannot redeclare exported variable '{0}'." }, Property_0_is_missing_in_type_1: { code: 2324, category: ts.DiagnosticCategory.Error, key: "Property_0_is_missing_in_type_1_2324", message: "Property '{0}' is missing in type '{1}'." }, Property_0_is_private_in_type_1_but_not_in_type_2: { code: 2325, category: ts.DiagnosticCategory.Error, key: "Property_0_is_private_in_type_1_but_not_in_type_2_2325", message: "Property '{0}' is private in type '{1}' but not in type '{2}'." }, Types_of_property_0_are_incompatible: { code: 2326, category: ts.DiagnosticCategory.Error, key: "Types_of_property_0_are_incompatible_2326", message: "Types of property '{0}' are incompatible." }, @@ -2289,7 +2500,7 @@ var ts; Cannot_invoke_an_expression_whose_type_lacks_a_call_signature: { code: 2349, category: ts.DiagnosticCategory.Error, key: "Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_2349", message: "Cannot invoke an expression whose type lacks a call signature." }, Only_a_void_function_can_be_called_with_the_new_keyword: { code: 2350, category: ts.DiagnosticCategory.Error, key: "Only_a_void_function_can_be_called_with_the_new_keyword_2350", message: "Only a void function can be called with the 'new' keyword." }, Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature: { code: 2351, category: ts.DiagnosticCategory.Error, key: "Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature_2351", message: "Cannot use 'new' with an expression whose type lacks a call or construct signature." }, - Neither_type_0_nor_type_1_is_assignable_to_the_other: { code: 2352, category: ts.DiagnosticCategory.Error, key: "Neither_type_0_nor_type_1_is_assignable_to_the_other_2352", message: "Neither type '{0}' nor type '{1}' is assignable to the other." }, + Type_0_cannot_be_converted_to_type_1: { code: 2352, category: ts.DiagnosticCategory.Error, key: "Type_0_cannot_be_converted_to_type_1_2352", message: "Type '{0}' cannot be converted to type '{1}'." }, Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1: { code: 2353, category: ts.DiagnosticCategory.Error, key: "Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1_2353", message: "Object literal may only specify known properties, and '{0}' does not exist in type '{1}'." }, No_best_common_type_exists_among_return_expressions: { code: 2354, category: ts.DiagnosticCategory.Error, key: "No_best_common_type_exists_among_return_expressions_2354", message: "No best common type exists among return expressions." }, A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value: { code: 2355, category: ts.DiagnosticCategory.Error, key: "A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_2355", message: "A function whose declared type is neither 'void' nor 'any' must return a value." }, @@ -2303,6 +2514,7 @@ var ts; The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2363, category: ts.DiagnosticCategory.Error, key: "The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type_2363", message: "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, Invalid_left_hand_side_of_assignment_expression: { code: 2364, category: ts.DiagnosticCategory.Error, key: "Invalid_left_hand_side_of_assignment_expression_2364", message: "Invalid left-hand side of assignment expression." }, Operator_0_cannot_be_applied_to_types_1_and_2: { code: 2365, category: ts.DiagnosticCategory.Error, key: "Operator_0_cannot_be_applied_to_types_1_and_2_2365", message: "Operator '{0}' cannot be applied to types '{1}' and '{2}'." }, + Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined: { code: 2366, category: ts.DiagnosticCategory.Error, key: "Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined_2366", message: "Function lacks ending return statement and return type does not include 'undefined'." }, Type_parameter_name_cannot_be_0: { code: 2368, category: ts.DiagnosticCategory.Error, key: "Type_parameter_name_cannot_be_0_2368", message: "Type parameter name cannot be '{0}'" }, A_parameter_property_is_only_allowed_in_a_constructor_implementation: { code: 2369, category: ts.DiagnosticCategory.Error, key: "A_parameter_property_is_only_allowed_in_a_constructor_implementation_2369", message: "A parameter property is only allowed in a constructor implementation." }, A_rest_parameter_must_be_of_an_array_type: { code: 2370, category: ts.DiagnosticCategory.Error, key: "A_rest_parameter_must_be_of_an_array_type_2370", message: "A rest parameter must be of an array type." }, @@ -2318,7 +2530,7 @@ var ts; get_and_set_accessor_must_have_the_same_type: { code: 2380, category: ts.DiagnosticCategory.Error, key: "get_and_set_accessor_must_have_the_same_type_2380", message: "'get' and 'set' accessor must have the same type." }, A_signature_with_an_implementation_cannot_use_a_string_literal_type: { code: 2381, category: ts.DiagnosticCategory.Error, key: "A_signature_with_an_implementation_cannot_use_a_string_literal_type_2381", message: "A signature with an implementation cannot use a string literal type." }, Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature: { code: 2382, category: ts.DiagnosticCategory.Error, key: "Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature_2382", message: "Specialized overload signature is not assignable to any non-specialized signature." }, - Overload_signatures_must_all_be_exported_or_not_exported: { code: 2383, category: ts.DiagnosticCategory.Error, key: "Overload_signatures_must_all_be_exported_or_not_exported_2383", message: "Overload signatures must all be exported or not exported." }, + Overload_signatures_must_all_be_exported_or_non_exported: { code: 2383, category: ts.DiagnosticCategory.Error, key: "Overload_signatures_must_all_be_exported_or_non_exported_2383", message: "Overload signatures must all be exported or non-exported." }, Overload_signatures_must_all_be_ambient_or_non_ambient: { code: 2384, category: ts.DiagnosticCategory.Error, key: "Overload_signatures_must_all_be_ambient_or_non_ambient_2384", message: "Overload signatures must all be ambient or non-ambient." }, Overload_signatures_must_all_be_public_private_or_protected: { code: 2385, category: ts.DiagnosticCategory.Error, key: "Overload_signatures_must_all_be_public_private_or_protected_2385", message: "Overload signatures must all be public, private or protected." }, Overload_signatures_must_all_be_optional_or_required: { code: 2386, category: ts.DiagnosticCategory.Error, key: "Overload_signatures_must_all_be_optional_or_required_2386", message: "Overload signatures must all be optional or required." }, @@ -2332,6 +2544,7 @@ var ts; Overload_signature_is_not_compatible_with_function_implementation: { code: 2394, category: ts.DiagnosticCategory.Error, key: "Overload_signature_is_not_compatible_with_function_implementation_2394", message: "Overload signature is not compatible with function implementation." }, Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local: { code: 2395, category: ts.DiagnosticCategory.Error, key: "Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local_2395", message: "Individual declarations in merged declaration '{0}' must be all exported or all local." }, Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters: { code: 2396, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters_2396", message: "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters." }, + Declaration_name_conflicts_with_built_in_global_identifier_0: { code: 2397, category: ts.DiagnosticCategory.Error, key: "Declaration_name_conflicts_with_built_in_global_identifier_0_2397", message: "Declaration name conflicts with built-in global identifier '{0}'." }, Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference: { code: 2399, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference_2399", message: "Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference." }, Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference: { code: 2400, category: ts.DiagnosticCategory.Error, key: "Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference_2400", message: "Expression resolves to variable declaration '_this' that compiler uses to capture 'this' reference." }, Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference: { code: 2401, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference_2401", message: "Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference." }, @@ -2350,7 +2563,6 @@ var ts; Class_name_cannot_be_0: { code: 2414, category: ts.DiagnosticCategory.Error, key: "Class_name_cannot_be_0_2414", message: "Class name cannot be '{0}'" }, Class_0_incorrectly_extends_base_class_1: { code: 2415, category: ts.DiagnosticCategory.Error, key: "Class_0_incorrectly_extends_base_class_1_2415", message: "Class '{0}' incorrectly extends base class '{1}'." }, Class_static_side_0_incorrectly_extends_base_class_static_side_1: { code: 2417, category: ts.DiagnosticCategory.Error, key: "Class_static_side_0_incorrectly_extends_base_class_static_side_1_2417", message: "Class static side '{0}' incorrectly extends base class static side '{1}'." }, - Type_name_0_in_extends_clause_does_not_reference_constructor_function_for_0: { code: 2419, category: ts.DiagnosticCategory.Error, key: "Type_name_0_in_extends_clause_does_not_reference_constructor_function_for_0_2419", message: "Type name '{0}' in extends clause does not reference constructor function for '{0}'." }, Class_0_incorrectly_implements_interface_1: { code: 2420, category: ts.DiagnosticCategory.Error, key: "Class_0_incorrectly_implements_interface_1_2420", message: "Class '{0}' incorrectly implements interface '{1}'." }, A_class_may_only_implement_another_class_or_interface: { code: 2422, category: ts.DiagnosticCategory.Error, key: "A_class_may_only_implement_another_class_or_interface_2422", message: "A class may only implement another class or interface." }, Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor: { code: 2423, category: ts.DiagnosticCategory.Error, key: "Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_access_2423", message: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor." }, @@ -2358,7 +2570,7 @@ var ts; Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 2425, category: ts.DiagnosticCategory.Error, key: "Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_functi_2425", message: "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function." }, Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 2426, category: ts.DiagnosticCategory.Error, key: "Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_functi_2426", message: "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function." }, Interface_name_cannot_be_0: { code: 2427, category: ts.DiagnosticCategory.Error, key: "Interface_name_cannot_be_0_2427", message: "Interface name cannot be '{0}'" }, - All_declarations_of_an_interface_must_have_identical_type_parameters: { code: 2428, category: ts.DiagnosticCategory.Error, key: "All_declarations_of_an_interface_must_have_identical_type_parameters_2428", message: "All declarations of an interface must have identical type parameters." }, + All_declarations_of_0_must_have_identical_type_parameters: { code: 2428, category: ts.DiagnosticCategory.Error, key: "All_declarations_of_0_must_have_identical_type_parameters_2428", message: "All declarations of '{0}' must have identical type parameters." }, Interface_0_incorrectly_extends_interface_1: { code: 2430, category: ts.DiagnosticCategory.Error, key: "Interface_0_incorrectly_extends_interface_1_2430", message: "Interface '{0}' incorrectly extends interface '{1}'." }, Enum_name_cannot_be_0: { code: 2431, category: ts.DiagnosticCategory.Error, key: "Enum_name_cannot_be_0_2431", message: "Enum name cannot be '{0}'" }, In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element: { code: 2432, category: ts.DiagnosticCategory.Error, key: "In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enu_2432", message: "In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element." }, @@ -2378,11 +2590,12 @@ var ts; Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1: { code: 2446, category: ts.DiagnosticCategory.Error, key: "Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1_2446", message: "Property '{0}' is protected and only accessible through an instance of class '{1}'." }, The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead: { code: 2447, category: ts.DiagnosticCategory.Error, key: "The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead_2447", message: "The '{0}' operator is not allowed for boolean types. Consider using '{1}' instead." }, Block_scoped_variable_0_used_before_its_declaration: { code: 2448, category: ts.DiagnosticCategory.Error, key: "Block_scoped_variable_0_used_before_its_declaration_2448", message: "Block-scoped variable '{0}' used before its declaration." }, - The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant: { code: 2449, category: ts.DiagnosticCategory.Error, key: "The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant_2449", message: "The operand of an increment or decrement operator cannot be a constant." }, - Left_hand_side_of_assignment_expression_cannot_be_a_constant: { code: 2450, category: ts.DiagnosticCategory.Error, key: "Left_hand_side_of_assignment_expression_cannot_be_a_constant_2450", message: "Left-hand side of assignment expression cannot be a constant." }, + The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant_or_a_read_only_property: { code: 2449, category: ts.DiagnosticCategory.Error, key: "The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant_or_a_read_only_property_2449", message: "The operand of an increment or decrement operator cannot be a constant or a read-only property." }, + Left_hand_side_of_assignment_expression_cannot_be_a_constant_or_a_read_only_property: { code: 2450, category: ts.DiagnosticCategory.Error, key: "Left_hand_side_of_assignment_expression_cannot_be_a_constant_or_a_read_only_property_2450", message: "Left-hand side of assignment expression cannot be a constant or a read-only property." }, Cannot_redeclare_block_scoped_variable_0: { code: 2451, category: ts.DiagnosticCategory.Error, key: "Cannot_redeclare_block_scoped_variable_0_2451", message: "Cannot redeclare block-scoped variable '{0}'." }, An_enum_member_cannot_have_a_numeric_name: { code: 2452, category: ts.DiagnosticCategory.Error, key: "An_enum_member_cannot_have_a_numeric_name_2452", message: "An enum member cannot have a numeric name." }, The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly: { code: 2453, category: ts.DiagnosticCategory.Error, key: "The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_typ_2453", message: "The type argument for type parameter '{0}' cannot be inferred from the usage. Consider specifying the type arguments explicitly." }, + Variable_0_is_used_before_being_assigned: { code: 2454, category: ts.DiagnosticCategory.Error, key: "Variable_0_is_used_before_being_assigned_2454", message: "Variable '{0}' is used before being assigned." }, Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0: { code: 2455, category: ts.DiagnosticCategory.Error, key: "Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0_2455", message: "Type argument candidate '{1}' is not a valid type argument because it is not a supertype of candidate '{0}'." }, Type_alias_0_circularly_references_itself: { code: 2456, category: ts.DiagnosticCategory.Error, key: "Type_alias_0_circularly_references_itself_2456", message: "Type alias '{0}' circularly references itself." }, Type_alias_name_cannot_be_0: { code: 2457, category: ts.DiagnosticCategory.Error, key: "Type_alias_name_cannot_be_0_2457", message: "Type alias name cannot be '{0}'" }, @@ -2412,8 +2625,8 @@ var ts; Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1: { code: 2481, category: ts.DiagnosticCategory.Error, key: "Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1_2481", message: "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'." }, The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation: { code: 2483, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation_2483", message: "The left-hand side of a 'for...of' statement cannot use a type annotation." }, Export_declaration_conflicts_with_exported_declaration_of_0: { code: 2484, category: ts.DiagnosticCategory.Error, key: "Export_declaration_conflicts_with_exported_declaration_of_0_2484", message: "Export declaration conflicts with exported declaration of '{0}'" }, - The_left_hand_side_of_a_for_of_statement_cannot_be_a_previously_defined_constant: { code: 2485, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_of_statement_cannot_be_a_previously_defined_constant_2485", message: "The left-hand side of a 'for...of' statement cannot be a previously defined constant." }, - The_left_hand_side_of_a_for_in_statement_cannot_be_a_previously_defined_constant: { code: 2486, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_in_statement_cannot_be_a_previously_defined_constant_2486", message: "The left-hand side of a 'for...in' statement cannot be a previously defined constant." }, + The_left_hand_side_of_a_for_of_statement_cannot_be_a_constant_or_a_read_only_property: { code: 2485, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_of_statement_cannot_be_a_constant_or_a_read_only_property_2485", message: "The left-hand side of a 'for...of' statement cannot be a constant or a read-only property." }, + The_left_hand_side_of_a_for_in_statement_cannot_be_a_constant_or_a_read_only_property: { code: 2486, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_in_statement_cannot_be_a_constant_or_a_read_only_property_2486", message: "The left-hand side of a 'for...in' statement cannot be a constant or a read-only property." }, Invalid_left_hand_side_in_for_of_statement: { code: 2487, category: ts.DiagnosticCategory.Error, key: "Invalid_left_hand_side_in_for_of_statement_2487", message: "Invalid left-hand side in 'for...of' statement." }, Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator: { code: 2488, category: ts.DiagnosticCategory.Error, key: "Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator_2488", message: "Type must have a '[Symbol.iterator]()' method that returns an iterator." }, An_iterator_must_have_a_next_method: { code: 2489, category: ts.DiagnosticCategory.Error, key: "An_iterator_must_have_a_next_method_2489", message: "An iterator must have a 'next()' method." }, @@ -2439,12 +2652,13 @@ var ts; Base_constructor_return_type_0_is_not_a_class_or_interface_type: { code: 2509, category: ts.DiagnosticCategory.Error, key: "Base_constructor_return_type_0_is_not_a_class_or_interface_type_2509", message: "Base constructor return type '{0}' is not a class or interface type." }, Base_constructors_must_all_have_the_same_return_type: { code: 2510, category: ts.DiagnosticCategory.Error, key: "Base_constructors_must_all_have_the_same_return_type_2510", message: "Base constructors must all have the same return type." }, Cannot_create_an_instance_of_the_abstract_class_0: { code: 2511, category: ts.DiagnosticCategory.Error, key: "Cannot_create_an_instance_of_the_abstract_class_0_2511", message: "Cannot create an instance of the abstract class '{0}'." }, - Overload_signatures_must_all_be_abstract_or_not_abstract: { code: 2512, category: ts.DiagnosticCategory.Error, key: "Overload_signatures_must_all_be_abstract_or_not_abstract_2512", message: "Overload signatures must all be abstract or not abstract." }, + Overload_signatures_must_all_be_abstract_or_non_abstract: { code: 2512, category: ts.DiagnosticCategory.Error, key: "Overload_signatures_must_all_be_abstract_or_non_abstract_2512", message: "Overload signatures must all be abstract or non-abstract." }, Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression: { code: 2513, category: ts.DiagnosticCategory.Error, key: "Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression_2513", message: "Abstract method '{0}' in class '{1}' cannot be accessed via super expression." }, Classes_containing_abstract_methods_must_be_marked_abstract: { code: 2514, category: ts.DiagnosticCategory.Error, key: "Classes_containing_abstract_methods_must_be_marked_abstract_2514", message: "Classes containing abstract methods must be marked abstract." }, Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2: { code: 2515, category: ts.DiagnosticCategory.Error, key: "Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2_2515", message: "Non-abstract class '{0}' does not implement inherited abstract member '{1}' from class '{2}'." }, All_declarations_of_an_abstract_method_must_be_consecutive: { code: 2516, category: ts.DiagnosticCategory.Error, key: "All_declarations_of_an_abstract_method_must_be_consecutive_2516", message: "All declarations of an abstract method must be consecutive." }, Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type: { code: 2517, category: ts.DiagnosticCategory.Error, key: "Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type_2517", message: "Cannot assign an abstract constructor type to a non-abstract constructor type." }, + A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard: { code: 2518, category: ts.DiagnosticCategory.Error, key: "A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard_2518", message: "A 'this'-based type guard is not compatible with a parameter-based type guard." }, Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions: { code: 2520, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions_2520", message: "Duplicate identifier '{0}'. Compiler uses declaration '{1}' to support async functions." }, Expression_resolves_to_variable_declaration_0_that_compiler_uses_to_support_async_functions: { code: 2521, category: ts.DiagnosticCategory.Error, key: "Expression_resolves_to_variable_declaration_0_that_compiler_uses_to_support_async_functions_2521", message: "Expression resolves to variable declaration '{0}' that compiler uses to support async functions." }, The_arguments_object_cannot_be_referenced_in_an_async_arrow_function_Consider_using_a_standard_async_function_expression: { code: 2522, category: ts.DiagnosticCategory.Error, key: "The_arguments_object_cannot_be_referenced_in_an_async_arrow_function_Consider_using_a_standard_async_2522", message: "The 'arguments' object cannot be referenced in an async arrow function. Consider using a standard async function expression." }, @@ -2454,7 +2668,13 @@ var ts; A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface: { code: 2526, category: ts.DiagnosticCategory.Error, key: "A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface_2526", message: "A 'this' type is available only in a non-static member of a class or interface." }, The_inferred_type_of_0_references_an_inaccessible_this_type_A_type_annotation_is_necessary: { code: 2527, category: ts.DiagnosticCategory.Error, key: "The_inferred_type_of_0_references_an_inaccessible_this_type_A_type_annotation_is_necessary_2527", message: "The inferred type of '{0}' references an inaccessible 'this' type. A type annotation is necessary." }, A_module_cannot_have_multiple_default_exports: { code: 2528, category: ts.DiagnosticCategory.Error, key: "A_module_cannot_have_multiple_default_exports_2528", message: "A module cannot have multiple default exports." }, - JSX_element_attributes_type_0_must_be_an_object_type: { code: 2600, category: ts.DiagnosticCategory.Error, key: "JSX_element_attributes_type_0_must_be_an_object_type_2600", message: "JSX element attributes type '{0}' must be an object type." }, + Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions: { code: 2529, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_func_2529", message: "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of a module containing async functions." }, + Property_0_is_incompatible_with_index_signature: { code: 2530, category: ts.DiagnosticCategory.Error, key: "Property_0_is_incompatible_with_index_signature_2530", message: "Property '{0}' is incompatible with index signature." }, + Object_is_possibly_null: { code: 2531, category: ts.DiagnosticCategory.Error, key: "Object_is_possibly_null_2531", message: "Object is possibly 'null'." }, + Object_is_possibly_undefined: { code: 2532, category: ts.DiagnosticCategory.Error, key: "Object_is_possibly_undefined_2532", message: "Object is possibly 'undefined'." }, + Object_is_possibly_null_or_undefined: { code: 2533, category: ts.DiagnosticCategory.Error, key: "Object_is_possibly_null_or_undefined_2533", message: "Object is possibly 'null' or 'undefined'." }, + A_function_returning_never_cannot_have_a_reachable_end_point: { code: 2534, category: ts.DiagnosticCategory.Error, key: "A_function_returning_never_cannot_have_a_reachable_end_point_2534", message: "A function returning 'never' cannot have a reachable end point." }, + JSX_element_attributes_type_0_may_not_be_a_union_type: { code: 2600, category: ts.DiagnosticCategory.Error, key: "JSX_element_attributes_type_0_may_not_be_a_union_type_2600", message: "JSX element attributes type '{0}' may not be a union type." }, The_return_type_of_a_JSX_element_constructor_must_return_an_object_type: { code: 2601, category: ts.DiagnosticCategory.Error, key: "The_return_type_of_a_JSX_element_constructor_must_return_an_object_type_2601", message: "The return type of a JSX element constructor must return an object type." }, JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist: { code: 2602, category: ts.DiagnosticCategory.Error, key: "JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist_2602", message: "JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist." }, Property_0_in_type_1_is_not_assignable_to_type_2: { code: 2603, category: ts.DiagnosticCategory.Error, key: "Property_0_in_type_1_is_not_assignable_to_type_2_2603", message: "Property '{0}' in type '{1}' is not assignable to type '{2}'" }, @@ -2470,6 +2690,33 @@ var ts; Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_package_author_to_update_the_package_definition: { code: 2654, category: ts.DiagnosticCategory.Error, key: "Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_pack_2654", message: "Exported external package typings file cannot contain tripleslash references. Please contact the package author to update the package definition." }, Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_the_package_definition: { code: 2656, category: ts.DiagnosticCategory.Error, key: "Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_2656", message: "Exported external package typings file '{0}' is not a module. Please contact the package author to update the package definition." }, JSX_expressions_must_have_one_parent_element: { code: 2657, category: ts.DiagnosticCategory.Error, key: "JSX_expressions_must_have_one_parent_element_2657", message: "JSX expressions must have one parent element" }, + Type_0_provides_no_match_for_the_signature_1: { code: 2658, category: ts.DiagnosticCategory.Error, key: "Type_0_provides_no_match_for_the_signature_1_2658", message: "Type '{0}' provides no match for the signature '{1}'" }, + super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher: { code: 2659, category: ts.DiagnosticCategory.Error, key: "super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_highe_2659", message: "'super' is only allowed in members of object literal expressions when option 'target' is 'ES2015' or higher." }, + super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions: { code: 2660, category: ts.DiagnosticCategory.Error, key: "super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions_2660", message: "'super' can only be referenced in members of derived classes or object literal expressions." }, + Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module: { code: 2661, category: ts.DiagnosticCategory.Error, key: "Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module_2661", message: "Cannot export '{0}'. Only local declarations can be exported from a module." }, + Cannot_find_name_0_Did_you_mean_the_static_member_1_0: { code: 2662, category: ts.DiagnosticCategory.Error, key: "Cannot_find_name_0_Did_you_mean_the_static_member_1_0_2662", message: "Cannot find name '{0}'. Did you mean the static member '{1}.{0}'?" }, + Cannot_find_name_0_Did_you_mean_the_instance_member_this_0: { code: 2663, category: ts.DiagnosticCategory.Error, key: "Cannot_find_name_0_Did_you_mean_the_instance_member_this_0_2663", message: "Cannot find name '{0}'. Did you mean the instance member 'this.{0}'?" }, + Invalid_module_name_in_augmentation_module_0_cannot_be_found: { code: 2664, category: ts.DiagnosticCategory.Error, key: "Invalid_module_name_in_augmentation_module_0_cannot_be_found_2664", message: "Invalid module name in augmentation, module '{0}' cannot be found." }, + Exports_and_export_assignments_are_not_permitted_in_module_augmentations: { code: 2666, category: ts.DiagnosticCategory.Error, key: "Exports_and_export_assignments_are_not_permitted_in_module_augmentations_2666", message: "Exports and export assignments are not permitted in module augmentations." }, + Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module: { code: 2667, category: ts.DiagnosticCategory.Error, key: "Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_mod_2667", message: "Imports are not permitted in module augmentations. Consider moving them to the enclosing external module." }, + export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always_visible: { code: 2668, category: ts.DiagnosticCategory.Error, key: "export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always__2668", message: "'export' modifier cannot be applied to ambient modules and module augmentations since they are always visible." }, + Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_declarations: { code: 2669, category: ts.DiagnosticCategory.Error, key: "Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_2669", message: "Augmentations for the global scope can only be directly nested in external modules or ambient module declarations." }, + Augmentations_for_the_global_scope_should_have_declare_modifier_unless_they_appear_in_already_ambient_context: { code: 2670, category: ts.DiagnosticCategory.Error, key: "Augmentations_for_the_global_scope_should_have_declare_modifier_unless_they_appear_in_already_ambien_2670", message: "Augmentations for the global scope should have 'declare' modifier unless they appear in already ambient context." }, + Cannot_augment_module_0_because_it_resolves_to_a_non_module_entity: { code: 2671, category: ts.DiagnosticCategory.Error, key: "Cannot_augment_module_0_because_it_resolves_to_a_non_module_entity_2671", message: "Cannot augment module '{0}' because it resolves to a non-module entity." }, + Cannot_assign_a_0_constructor_type_to_a_1_constructor_type: { code: 2672, category: ts.DiagnosticCategory.Error, key: "Cannot_assign_a_0_constructor_type_to_a_1_constructor_type_2672", message: "Cannot assign a '{0}' constructor type to a '{1}' constructor type." }, + Constructor_of_class_0_is_private_and_only_accessible_within_the_class_declaration: { code: 2673, category: ts.DiagnosticCategory.Error, key: "Constructor_of_class_0_is_private_and_only_accessible_within_the_class_declaration_2673", message: "Constructor of class '{0}' is private and only accessible within the class declaration." }, + Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration: { code: 2674, category: ts.DiagnosticCategory.Error, key: "Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration_2674", message: "Constructor of class '{0}' is protected and only accessible within the class declaration." }, + Cannot_extend_a_class_0_Class_constructor_is_marked_as_private: { code: 2675, category: ts.DiagnosticCategory.Error, key: "Cannot_extend_a_class_0_Class_constructor_is_marked_as_private_2675", message: "Cannot extend a class '{0}'. Class constructor is marked as private." }, + Accessors_must_both_be_abstract_or_non_abstract: { code: 2676, category: ts.DiagnosticCategory.Error, key: "Accessors_must_both_be_abstract_or_non_abstract_2676", message: "Accessors must both be abstract or non-abstract." }, + A_type_predicate_s_type_must_be_assignable_to_its_parameter_s_type: { code: 2677, category: ts.DiagnosticCategory.Error, key: "A_type_predicate_s_type_must_be_assignable_to_its_parameter_s_type_2677", message: "A type predicate's type must be assignable to its parameter's type." }, + Type_0_is_not_comparable_to_type_1: { code: 2678, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_comparable_to_type_1_2678", message: "Type '{0}' is not comparable to type '{1}'." }, + A_function_that_is_called_with_the_new_keyword_cannot_have_a_this_type_that_is_void: { code: 2679, category: ts.DiagnosticCategory.Error, key: "A_function_that_is_called_with_the_new_keyword_cannot_have_a_this_type_that_is_void_2679", message: "A function that is called with the 'new' keyword cannot have a 'this' type that is 'void'." }, + A_this_parameter_must_be_the_first_parameter: { code: 2680, category: ts.DiagnosticCategory.Error, key: "A_this_parameter_must_be_the_first_parameter_2680", message: "A 'this' parameter must be the first parameter." }, + A_constructor_cannot_have_a_this_parameter: { code: 2681, category: ts.DiagnosticCategory.Error, key: "A_constructor_cannot_have_a_this_parameter_2681", message: "A constructor cannot have a 'this' parameter." }, + get_and_set_accessor_must_have_the_same_this_type: { code: 2682, category: ts.DiagnosticCategory.Error, key: "get_and_set_accessor_must_have_the_same_this_type_2682", message: "'get' and 'set' accessor must have the same 'this' type." }, + this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation: { code: 2683, category: ts.DiagnosticCategory.Error, key: "this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_2683", message: "'this' implicitly has type 'any' because it does not have a type annotation." }, + The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1: { code: 2684, category: ts.DiagnosticCategory.Error, key: "The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1_2684", message: "The 'this' context of type '{0}' is not assignable to method's 'this' of type '{1}'." }, + The_this_types_of_each_signature_are_incompatible: { code: 2685, category: ts.DiagnosticCategory.Error, key: "The_this_types_of_each_signature_are_incompatible_2685", message: "The 'this' types of each signature are incompatible." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import_declaration_0_is_using_private_name_1_4000", message: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", message: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", message: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, @@ -2540,6 +2787,7 @@ var ts; Parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4078, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_exported_function_has_or_is_using_private_name_1_4078", message: "Parameter '{0}' of exported function has or is using private name '{1}'." }, Exported_type_alias_0_has_or_is_using_private_name_1: { code: 4081, category: ts.DiagnosticCategory.Error, key: "Exported_type_alias_0_has_or_is_using_private_name_1_4081", message: "Exported type alias '{0}' has or is using private name '{1}'." }, Default_export_of_the_module_has_or_is_using_private_name_0: { code: 4082, category: ts.DiagnosticCategory.Error, key: "Default_export_of_the_module_has_or_is_using_private_name_0_4082", message: "Default export of the module has or is using private name '{0}'." }, + Conflicting_library_definitions_for_0_found_at_1_and_2_Copy_the_correct_file_to_the_typings_folder_to_resolve_this_conflict: { code: 4090, category: ts.DiagnosticCategory.Message, key: "Conflicting_library_definitions_for_0_found_at_1_and_2_Copy_the_correct_file_to_the_typings_folder_t_4090", message: "Conflicting library definitions for '{0}' found at '{1}' and '{2}'. Copy the correct file to the 'typings' folder to resolve this conflict." }, The_current_host_does_not_support_the_0_option: { code: 5001, category: ts.DiagnosticCategory.Error, key: "The_current_host_does_not_support_the_0_option_5001", message: "The current host does not support the '{0}' option." }, Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: ts.DiagnosticCategory.Error, key: "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", message: "Cannot find the common subdirectory path for the input files." }, Cannot_read_file_0_Colon_1: { code: 5012, category: ts.DiagnosticCategory.Error, key: "Cannot_read_file_0_Colon_1_5012", message: "Cannot read file '{0}': {1}" }, @@ -2554,17 +2802,28 @@ var ts; Option_0_cannot_be_specified_without_specifying_option_1: { code: 5052, category: ts.DiagnosticCategory.Error, key: "Option_0_cannot_be_specified_without_specifying_option_1_5052", message: "Option '{0}' cannot be specified without specifying option '{1}'." }, Option_0_cannot_be_specified_with_option_1: { code: 5053, category: ts.DiagnosticCategory.Error, key: "Option_0_cannot_be_specified_with_option_1_5053", message: "Option '{0}' cannot be specified with option '{1}'." }, A_tsconfig_json_file_is_already_defined_at_Colon_0: { code: 5054, category: ts.DiagnosticCategory.Error, key: "A_tsconfig_json_file_is_already_defined_at_Colon_0_5054", message: "A 'tsconfig.json' file is already defined at: '{0}'." }, + Cannot_write_file_0_because_it_would_overwrite_input_file: { code: 5055, category: ts.DiagnosticCategory.Error, key: "Cannot_write_file_0_because_it_would_overwrite_input_file_5055", message: "Cannot write file '{0}' because it would overwrite input file." }, + Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files: { code: 5056, category: ts.DiagnosticCategory.Error, key: "Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files_5056", message: "Cannot write file '{0}' because it would be overwritten by multiple input files." }, + Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0: { code: 5057, category: ts.DiagnosticCategory.Error, key: "Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0_5057", message: "Cannot find a tsconfig.json file at the specified directory: '{0}'" }, + The_specified_path_does_not_exist_Colon_0: { code: 5058, category: ts.DiagnosticCategory.Error, key: "The_specified_path_does_not_exist_Colon_0_5058", message: "The specified path does not exist: '{0}'" }, + Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier: { code: 5059, category: ts.DiagnosticCategory.Error, key: "Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier_5059", message: "Invalid value for '--reactNamespace'. '{0}' is not a valid identifier." }, + Option_paths_cannot_be_used_without_specifying_baseUrl_option: { code: 5060, category: ts.DiagnosticCategory.Error, key: "Option_paths_cannot_be_used_without_specifying_baseUrl_option_5060", message: "Option 'paths' cannot be used without specifying '--baseUrl' option." }, + Pattern_0_can_have_at_most_one_Asterisk_character: { code: 5061, category: ts.DiagnosticCategory.Error, key: "Pattern_0_can_have_at_most_one_Asterisk_character_5061", message: "Pattern '{0}' can have at most one '*' character" }, + Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character: { code: 5062, category: ts.DiagnosticCategory.Error, key: "Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character_5062", message: "Substitution '{0}' in pattern '{1}' in can have at most one '*' character" }, + Substututions_for_pattern_0_should_be_an_array: { code: 5063, category: ts.DiagnosticCategory.Error, key: "Substututions_for_pattern_0_should_be_an_array_5063", message: "Substututions for pattern '{0}' should be an array." }, + Substitution_0_for_pattern_1_has_incorrect_type_expected_string_got_2: { code: 5064, category: ts.DiagnosticCategory.Error, key: "Substitution_0_for_pattern_1_has_incorrect_type_expected_string_got_2_5064", message: "Substitution '{0}' for pattern '{1}' has incorrect type, expected 'string', got '{2}'." }, Concatenate_and_emit_output_to_single_file: { code: 6001, category: ts.DiagnosticCategory.Message, key: "Concatenate_and_emit_output_to_single_file_6001", message: "Concatenate and emit output to single file." }, Generates_corresponding_d_ts_file: { code: 6002, category: ts.DiagnosticCategory.Message, key: "Generates_corresponding_d_ts_file_6002", message: "Generates corresponding '.d.ts' file." }, - Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { code: 6003, category: ts.DiagnosticCategory.Message, key: "Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations_6003", message: "Specifies the location where debugger should locate map files instead of generated locations." }, - Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations: { code: 6004, category: ts.DiagnosticCategory.Message, key: "Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations_6004", message: "Specifies the location where debugger should locate TypeScript files instead of source locations." }, + Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { code: 6003, category: ts.DiagnosticCategory.Message, key: "Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations_6003", message: "Specify the location where debugger should locate map files instead of generated locations." }, + Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations: { code: 6004, category: ts.DiagnosticCategory.Message, key: "Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations_6004", message: "Specify the location where debugger should locate TypeScript files instead of source locations." }, Watch_input_files: { code: 6005, category: ts.DiagnosticCategory.Message, key: "Watch_input_files_6005", message: "Watch input files." }, Redirect_output_structure_to_the_directory: { code: 6006, category: ts.DiagnosticCategory.Message, key: "Redirect_output_structure_to_the_directory_6006", message: "Redirect output structure to the directory." }, Do_not_erase_const_enum_declarations_in_generated_code: { code: 6007, category: ts.DiagnosticCategory.Message, key: "Do_not_erase_const_enum_declarations_in_generated_code_6007", message: "Do not erase const enum declarations in generated code." }, Do_not_emit_outputs_if_any_errors_were_reported: { code: 6008, category: ts.DiagnosticCategory.Message, key: "Do_not_emit_outputs_if_any_errors_were_reported_6008", message: "Do not emit outputs if any errors were reported." }, Do_not_emit_comments_to_output: { code: 6009, category: ts.DiagnosticCategory.Message, key: "Do_not_emit_comments_to_output_6009", message: "Do not emit comments to output." }, Do_not_emit_outputs: { code: 6010, category: ts.DiagnosticCategory.Message, key: "Do_not_emit_outputs_6010", message: "Do not emit outputs." }, - Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015_experimental: { code: 6015, category: ts.DiagnosticCategory.Message, key: "Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015_experimental_6015", message: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES2015' (experimental)" }, + Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typechecking: { code: 6011, category: ts.DiagnosticCategory.Message, key: "Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typech_6011", message: "Allow default imports from modules with no default export. This does not affect code emit, just typechecking." }, + Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015: { code: 6015, category: ts.DiagnosticCategory.Message, key: "Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015_6015", message: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES2015'" }, Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015: { code: 6016, category: ts.DiagnosticCategory.Message, key: "Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015_6016", message: "Specify module code generation: 'commonjs', 'amd', 'system', 'umd' or 'es2015'" }, Print_this_message: { code: 6017, category: ts.DiagnosticCategory.Message, key: "Print_this_message_6017", message: "Print this message." }, Print_the_compiler_s_version: { code: 6019, category: ts.DiagnosticCategory.Message, key: "Print_the_compiler_s_version_6019", message: "Print the compiler's version." }, @@ -2586,8 +2845,7 @@ var ts; Generates_corresponding_map_file: { code: 6043, category: ts.DiagnosticCategory.Message, key: "Generates_corresponding_map_file_6043", message: "Generates corresponding '.map' file." }, Compiler_option_0_expects_an_argument: { code: 6044, category: ts.DiagnosticCategory.Error, key: "Compiler_option_0_expects_an_argument_6044", message: "Compiler option '{0}' expects an argument." }, Unterminated_quoted_string_in_response_file_0: { code: 6045, category: ts.DiagnosticCategory.Error, key: "Unterminated_quoted_string_in_response_file_0_6045", message: "Unterminated quoted string in response file '{0}'." }, - Argument_for_module_option_must_be_commonjs_amd_system_umd_or_es2015: { code: 6046, category: ts.DiagnosticCategory.Error, key: "Argument_for_module_option_must_be_commonjs_amd_system_umd_or_es2015_6046", message: "Argument for '--module' option must be 'commonjs', 'amd', 'system', 'umd', or 'es2015'." }, - Argument_for_target_option_must_be_ES3_ES5_or_ES2015: { code: 6047, category: ts.DiagnosticCategory.Error, key: "Argument_for_target_option_must_be_ES3_ES5_or_ES2015_6047", message: "Argument for '--target' option must be 'ES3', 'ES5', or 'ES2015'." }, + Argument_for_0_option_must_be_Colon_1: { code: 6046, category: ts.DiagnosticCategory.Error, key: "Argument_for_0_option_must_be_Colon_1_6046", message: "Argument for '{0}' option must be: {1}" }, Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: { code: 6048, category: ts.DiagnosticCategory.Error, key: "Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1_6048", message: "Locale must be of the form or -. For example '{0}' or '{1}'." }, Unsupported_locale_0: { code: 6049, category: ts.DiagnosticCategory.Error, key: "Unsupported_locale_0_6049", message: "Unsupported locale '{0}'." }, Unable_to_open_file_0: { code: 6050, category: ts.DiagnosticCategory.Error, key: "Unable_to_open_file_0_6050", message: "Unable to open file '{0}'." }, @@ -2597,16 +2855,15 @@ var ts; File_0_has_unsupported_extension_The_only_supported_extensions_are_1: { code: 6054, category: ts.DiagnosticCategory.Error, key: "File_0_has_unsupported_extension_The_only_supported_extensions_are_1_6054", message: "File '{0}' has unsupported extension. The only supported extensions are {1}." }, Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures: { code: 6055, category: ts.DiagnosticCategory.Message, key: "Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures_6055", message: "Suppress noImplicitAny errors for indexing objects lacking index signatures." }, Do_not_emit_declarations_for_code_that_has_an_internal_annotation: { code: 6056, category: ts.DiagnosticCategory.Message, key: "Do_not_emit_declarations_for_code_that_has_an_internal_annotation_6056", message: "Do not emit declarations for code that has an '@internal' annotation." }, - Specifies_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir: { code: 6058, category: ts.DiagnosticCategory.Message, key: "Specifies_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDi_6058", message: "Specifies the root directory of input files. Use to control the output directory structure with --outDir." }, + Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir: { code: 6058, category: ts.DiagnosticCategory.Message, key: "Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir_6058", message: "Specify the root directory of input files. Use to control the output directory structure with --outDir." }, File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files: { code: 6059, category: ts.DiagnosticCategory.Error, key: "File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files_6059", message: "File '{0}' is not under 'rootDir' '{1}'. 'rootDir' is expected to contain all source files." }, - Specifies_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix: { code: 6060, category: ts.DiagnosticCategory.Message, key: "Specifies_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix_6060", message: "Specifies the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix)." }, + Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix: { code: 6060, category: ts.DiagnosticCategory.Message, key: "Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix_6060", message: "Specify the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix)." }, NEWLINE: { code: 6061, category: ts.DiagnosticCategory.Message, key: "NEWLINE_6061", message: "NEWLINE" }, - Argument_for_newLine_option_must_be_CRLF_or_LF: { code: 6062, category: ts.DiagnosticCategory.Error, key: "Argument_for_newLine_option_must_be_CRLF_or_LF_6062", message: "Argument for '--newLine' option must be 'CRLF' or 'LF'." }, - Argument_for_moduleResolution_option_must_be_node_or_classic: { code: 6063, category: ts.DiagnosticCategory.Error, key: "Argument_for_moduleResolution_option_must_be_node_or_classic_6063", message: "Argument for '--moduleResolution' option must be 'node' or 'classic'." }, + Option_0_can_only_be_specified_in_tsconfig_json_file: { code: 6064, category: ts.DiagnosticCategory.Error, key: "Option_0_can_only_be_specified_in_tsconfig_json_file_6064", message: "Option '{0}' can only be specified in 'tsconfig.json' file." }, Enables_experimental_support_for_ES7_decorators: { code: 6065, category: ts.DiagnosticCategory.Message, key: "Enables_experimental_support_for_ES7_decorators_6065", message: "Enables experimental support for ES7 decorators." }, Enables_experimental_support_for_emitting_type_metadata_for_decorators: { code: 6066, category: ts.DiagnosticCategory.Message, key: "Enables_experimental_support_for_emitting_type_metadata_for_decorators_6066", message: "Enables experimental support for emitting type metadata for decorators." }, Enables_experimental_support_for_ES7_async_functions: { code: 6068, category: ts.DiagnosticCategory.Message, key: "Enables_experimental_support_for_ES7_async_functions_6068", message: "Enables experimental support for ES7 async functions." }, - Specifies_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6: { code: 6069, category: ts.DiagnosticCategory.Message, key: "Specifies_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6_6069", message: "Specifies module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6)." }, + Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6: { code: 6069, category: ts.DiagnosticCategory.Message, key: "Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6_6069", message: "Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6)." }, Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file: { code: 6070, category: ts.DiagnosticCategory.Message, key: "Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file_6070", message: "Initializes a TypeScript project and creates a tsconfig.json file." }, Successfully_created_a_tsconfig_json_file: { code: 6071, category: ts.DiagnosticCategory.Message, key: "Successfully_created_a_tsconfig_json_file_6071", message: "Successfully created a tsconfig.json file." }, Suppress_excess_property_checks_for_object_literals: { code: 6072, category: ts.DiagnosticCategory.Message, key: "Suppress_excess_property_checks_for_object_literals_6072", message: "Suppress excess property checks for object literals." }, @@ -2616,9 +2873,57 @@ var ts; Report_errors_for_fallthrough_cases_in_switch_statement: { code: 6076, category: ts.DiagnosticCategory.Message, key: "Report_errors_for_fallthrough_cases_in_switch_statement_6076", message: "Report errors for fallthrough cases in switch statement." }, Do_not_report_errors_on_unreachable_code: { code: 6077, category: ts.DiagnosticCategory.Message, key: "Do_not_report_errors_on_unreachable_code_6077", message: "Do not report errors on unreachable code." }, Disallow_inconsistently_cased_references_to_the_same_file: { code: 6078, category: ts.DiagnosticCategory.Message, key: "Disallow_inconsistently_cased_references_to_the_same_file_6078", message: "Disallow inconsistently-cased references to the same file." }, + Specify_library_files_to_be_included_in_the_compilation_Colon: { code: 6079, category: ts.DiagnosticCategory.Message, key: "Specify_library_files_to_be_included_in_the_compilation_Colon_6079", message: "Specify library files to be included in the compilation: " }, Specify_JSX_code_generation_Colon_preserve_or_react: { code: 6080, category: ts.DiagnosticCategory.Message, key: "Specify_JSX_code_generation_Colon_preserve_or_react_6080", message: "Specify JSX code generation: 'preserve' or 'react'" }, - Argument_for_jsx_must_be_preserve_or_react: { code: 6081, category: ts.DiagnosticCategory.Message, key: "Argument_for_jsx_must_be_preserve_or_react_6081", message: "Argument for '--jsx' must be 'preserve' or 'react'." }, Only_amd_and_system_modules_are_supported_alongside_0: { code: 6082, category: ts.DiagnosticCategory.Error, key: "Only_amd_and_system_modules_are_supported_alongside_0_6082", message: "Only 'amd' and 'system' modules are supported alongside --{0}." }, + Base_directory_to_resolve_non_absolute_module_names: { code: 6083, category: ts.DiagnosticCategory.Message, key: "Base_directory_to_resolve_non_absolute_module_names_6083", message: "Base directory to resolve non-absolute module names." }, + Specify_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit: { code: 6084, category: ts.DiagnosticCategory.Message, key: "Specify_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit_6084", message: "Specify the object invoked for createElement and __spread when targeting 'react' JSX emit" }, + Enable_tracing_of_the_name_resolution_process: { code: 6085, category: ts.DiagnosticCategory.Message, key: "Enable_tracing_of_the_name_resolution_process_6085", message: "Enable tracing of the name resolution process." }, + Resolving_module_0_from_1: { code: 6086, category: ts.DiagnosticCategory.Message, key: "Resolving_module_0_from_1_6086", message: "======== Resolving module '{0}' from '{1}'. ========" }, + Explicitly_specified_module_resolution_kind_Colon_0: { code: 6087, category: ts.DiagnosticCategory.Message, key: "Explicitly_specified_module_resolution_kind_Colon_0_6087", message: "Explicitly specified module resolution kind: '{0}'." }, + Module_resolution_kind_is_not_specified_using_0: { code: 6088, category: ts.DiagnosticCategory.Message, key: "Module_resolution_kind_is_not_specified_using_0_6088", message: "Module resolution kind is not specified, using '{0}'." }, + Module_name_0_was_successfully_resolved_to_1: { code: 6089, category: ts.DiagnosticCategory.Message, key: "Module_name_0_was_successfully_resolved_to_1_6089", message: "======== Module name '{0}' was successfully resolved to '{1}'. ========" }, + Module_name_0_was_not_resolved: { code: 6090, category: ts.DiagnosticCategory.Message, key: "Module_name_0_was_not_resolved_6090", message: "======== Module name '{0}' was not resolved. ========" }, + paths_option_is_specified_looking_for_a_pattern_to_match_module_name_0: { code: 6091, category: ts.DiagnosticCategory.Message, key: "paths_option_is_specified_looking_for_a_pattern_to_match_module_name_0_6091", message: "'paths' option is specified, looking for a pattern to match module name '{0}'." }, + Module_name_0_matched_pattern_1: { code: 6092, category: ts.DiagnosticCategory.Message, key: "Module_name_0_matched_pattern_1_6092", message: "Module name '{0}', matched pattern '{1}'." }, + Trying_substitution_0_candidate_module_location_Colon_1: { code: 6093, category: ts.DiagnosticCategory.Message, key: "Trying_substitution_0_candidate_module_location_Colon_1_6093", message: "Trying substitution '{0}', candidate module location: '{1}'." }, + Resolving_module_name_0_relative_to_base_url_1_2: { code: 6094, category: ts.DiagnosticCategory.Message, key: "Resolving_module_name_0_relative_to_base_url_1_2_6094", message: "Resolving module name '{0}' relative to base url '{1}' - '{2}'." }, + Loading_module_as_file_Slash_folder_candidate_module_location_0: { code: 6095, category: ts.DiagnosticCategory.Message, key: "Loading_module_as_file_Slash_folder_candidate_module_location_0_6095", message: "Loading module as file / folder, candidate module location '{0}'." }, + File_0_does_not_exist: { code: 6096, category: ts.DiagnosticCategory.Message, key: "File_0_does_not_exist_6096", message: "File '{0}' does not exist." }, + File_0_exist_use_it_as_a_name_resolution_result: { code: 6097, category: ts.DiagnosticCategory.Message, key: "File_0_exist_use_it_as_a_name_resolution_result_6097", message: "File '{0}' exist - use it as a name resolution result." }, + Loading_module_0_from_node_modules_folder: { code: 6098, category: ts.DiagnosticCategory.Message, key: "Loading_module_0_from_node_modules_folder_6098", message: "Loading module '{0}' from 'node_modules' folder." }, + Found_package_json_at_0: { code: 6099, category: ts.DiagnosticCategory.Message, key: "Found_package_json_at_0_6099", message: "Found 'package.json' at '{0}'." }, + package_json_does_not_have_types_field: { code: 6100, category: ts.DiagnosticCategory.Message, key: "package_json_does_not_have_types_field_6100", message: "'package.json' does not have 'types' field." }, + package_json_has_0_field_1_that_references_2: { code: 6101, category: ts.DiagnosticCategory.Message, key: "package_json_has_0_field_1_that_references_2_6101", message: "'package.json' has '{0}' field '{1}' that references '{2}'." }, + Allow_javascript_files_to_be_compiled: { code: 6102, category: ts.DiagnosticCategory.Message, key: "Allow_javascript_files_to_be_compiled_6102", message: "Allow javascript files to be compiled." }, + Option_0_should_have_array_of_strings_as_a_value: { code: 6103, category: ts.DiagnosticCategory.Error, key: "Option_0_should_have_array_of_strings_as_a_value_6103", message: "Option '{0}' should have array of strings as a value." }, + Checking_if_0_is_the_longest_matching_prefix_for_1_2: { code: 6104, category: ts.DiagnosticCategory.Message, key: "Checking_if_0_is_the_longest_matching_prefix_for_1_2_6104", message: "Checking if '{0}' is the longest matching prefix for '{1}' - '{2}'." }, + Expected_type_of_0_field_in_package_json_to_be_string_got_1: { code: 6105, category: ts.DiagnosticCategory.Message, key: "Expected_type_of_0_field_in_package_json_to_be_string_got_1_6105", message: "Expected type of '{0}' field in 'package.json' to be 'string', got '{1}'." }, + baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1: { code: 6106, category: ts.DiagnosticCategory.Message, key: "baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1_6106", message: "'baseUrl' option is set to '{0}', using this value to resolve non-relative module name '{1}'" }, + rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0: { code: 6107, category: ts.DiagnosticCategory.Message, key: "rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0_6107", message: "'rootDirs' option is set, using it to resolve relative module name '{0}'" }, + Longest_matching_prefix_for_0_is_1: { code: 6108, category: ts.DiagnosticCategory.Message, key: "Longest_matching_prefix_for_0_is_1_6108", message: "Longest matching prefix for '{0}' is '{1}'" }, + Loading_0_from_the_root_dir_1_candidate_location_2: { code: 6109, category: ts.DiagnosticCategory.Message, key: "Loading_0_from_the_root_dir_1_candidate_location_2_6109", message: "Loading '{0}' from the root dir '{1}', candidate location '{2}'" }, + Trying_other_entries_in_rootDirs: { code: 6110, category: ts.DiagnosticCategory.Message, key: "Trying_other_entries_in_rootDirs_6110", message: "Trying other entries in 'rootDirs'" }, + Module_resolution_using_rootDirs_has_failed: { code: 6111, category: ts.DiagnosticCategory.Message, key: "Module_resolution_using_rootDirs_has_failed_6111", message: "Module resolution using 'rootDirs' has failed" }, + Do_not_emit_use_strict_directives_in_module_output: { code: 6112, category: ts.DiagnosticCategory.Message, key: "Do_not_emit_use_strict_directives_in_module_output_6112", message: "Do not emit 'use strict' directives in module output." }, + Enable_strict_null_checks: { code: 6113, category: ts.DiagnosticCategory.Message, key: "Enable_strict_null_checks_6113", message: "Enable strict null checks." }, + Unknown_option_excludes_Did_you_mean_exclude: { code: 6114, category: ts.DiagnosticCategory.Error, key: "Unknown_option_excludes_Did_you_mean_exclude_6114", message: "Unknown option 'excludes'. Did you mean 'exclude'?" }, + Raise_error_on_this_expressions_with_an_implied_any_type: { code: 6115, category: ts.DiagnosticCategory.Message, key: "Raise_error_on_this_expressions_with_an_implied_any_type_6115", message: "Raise error on 'this' expressions with an implied 'any' type." }, + Resolving_type_reference_directive_0_containing_file_1_root_directory_2: { code: 6116, category: ts.DiagnosticCategory.Message, key: "Resolving_type_reference_directive_0_containing_file_1_root_directory_2_6116", message: "======== Resolving type reference directive '{0}', containing file '{1}', root directory '{2}'. ========" }, + Resolving_using_primary_search_paths: { code: 6117, category: ts.DiagnosticCategory.Message, key: "Resolving_using_primary_search_paths_6117", message: "Resolving using primary search paths..." }, + Resolving_from_node_modules_folder: { code: 6118, category: ts.DiagnosticCategory.Message, key: "Resolving_from_node_modules_folder_6118", message: "Resolving from node_modules folder..." }, + Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2: { code: 6119, category: ts.DiagnosticCategory.Message, key: "Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2_6119", message: "======== Type reference directive '{0}' was successfully resolved to '{1}', primary: {2}. ========" }, + Type_reference_directive_0_was_not_resolved: { code: 6120, category: ts.DiagnosticCategory.Message, key: "Type_reference_directive_0_was_not_resolved_6120", message: "======== Type reference directive '{0}' was not resolved. ========" }, + Resolving_with_primary_search_path_0: { code: 6121, category: ts.DiagnosticCategory.Message, key: "Resolving_with_primary_search_path_0_6121", message: "Resolving with primary search path '{0}'" }, + Root_directory_cannot_be_determined_skipping_primary_search_paths: { code: 6122, category: ts.DiagnosticCategory.Message, key: "Root_directory_cannot_be_determined_skipping_primary_search_paths_6122", message: "Root directory cannot be determined, skipping primary search paths." }, + Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set: { code: 6123, category: ts.DiagnosticCategory.Message, key: "Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set_6123", message: "======== Resolving type reference directive '{0}', containing file '{1}', root directory not set. ========" }, + Type_declaration_files_to_be_included_in_compilation: { code: 6124, category: ts.DiagnosticCategory.Message, key: "Type_declaration_files_to_be_included_in_compilation_6124", message: "Type declaration files to be included in compilation." }, + Looking_up_in_node_modules_folder_initial_location_0: { code: 6125, category: ts.DiagnosticCategory.Message, key: "Looking_up_in_node_modules_folder_initial_location_0_6125", message: "Looking up in 'node_modules' folder, initial location '{0}'" }, + Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_modules_folder: { code: 6126, category: ts.DiagnosticCategory.Message, key: "Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_mod_6126", message: "Containing file is not specified and root directory cannot be determined, skipping lookup in 'node_modules' folder." }, + Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1: { code: 6127, category: ts.DiagnosticCategory.Message, key: "Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1_6127", message: "======== Resolving type reference directive '{0}', containing file not set, root directory '{1}'. ========" }, + Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set: { code: 6128, category: ts.DiagnosticCategory.Message, key: "Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set_6128", message: "======== Resolving type reference directive '{0}', containing file not set, root directory not set. ========" }, + The_config_file_0_found_doesn_t_contain_any_source_files: { code: 6129, category: ts.DiagnosticCategory.Error, key: "The_config_file_0_found_doesn_t_contain_any_source_files_6129", message: "The config file '{0}' found doesn't contain any source files." }, + Resolving_real_path_for_0_result_1: { code: 6130, category: ts.DiagnosticCategory.Message, key: "Resolving_real_path_for_0_result_1_6130", message: "Resolving real path for '{0}', result '{1}'" }, Variable_0_implicitly_has_an_1_type: { code: 7005, category: ts.DiagnosticCategory.Error, key: "Variable_0_implicitly_has_an_1_type_7005", message: "Variable '{0}' implicitly has an '{1}' type." }, Parameter_0_implicitly_has_an_1_type: { code: 7006, category: ts.DiagnosticCategory.Error, key: "Parameter_0_implicitly_has_an_1_type_7006", message: "Parameter '{0}' implicitly has an '{1}' type." }, Member_0_implicitly_has_an_1_type: { code: 7008, category: ts.DiagnosticCategory.Error, key: "Member_0_implicitly_has_an_1_type_7008", message: "Member '{0}' implicitly has an '{1}' type." }, @@ -2626,6 +2931,7 @@ var ts; _0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type: { code: 7010, category: ts.DiagnosticCategory.Error, key: "_0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type_7010", message: "'{0}', which lacks return-type annotation, implicitly has an '{1}' return type." }, Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type: { code: 7011, category: ts.DiagnosticCategory.Error, key: "Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type_7011", message: "Function expression, which lacks return-type annotation, implicitly has an '{0}' return type." }, Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7013, category: ts.DiagnosticCategory.Error, key: "Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type_7013", message: "Construct signature, which lacks return-type annotation, implicitly has an 'any' return type." }, + Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number: { code: 7015, category: ts.DiagnosticCategory.Error, key: "Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number_7015", message: "Element implicitly has an 'any' type because index expression is not of type 'number'." }, Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_type_annotation: { code: 7016, category: ts.DiagnosticCategory.Error, key: "Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_type_annotation_7016", message: "Property '{0}' implicitly has type 'any', because its 'set' accessor lacks a type annotation." }, Index_signature_of_object_type_implicitly_has_an_any_type: { code: 7017, category: ts.DiagnosticCategory.Error, key: "Index_signature_of_object_type_implicitly_has_an_any_type_7017", message: "Index signature of object type implicitly has an 'any' type." }, Object_literal_s_property_0_implicitly_has_an_1_type: { code: 7018, category: ts.DiagnosticCategory.Error, key: "Object_literal_s_property_0_implicitly_has_an_1_type_7018", message: "Object literal's property '{0}' implicitly has an '{1}' type." }, @@ -2640,6 +2946,7 @@ var ts; Unused_label: { code: 7028, category: ts.DiagnosticCategory.Error, key: "Unused_label_7028", message: "Unused label." }, Fallthrough_case_in_switch: { code: 7029, category: ts.DiagnosticCategory.Error, key: "Fallthrough_case_in_switch_7029", message: "Fallthrough case in switch." }, Not_all_code_paths_return_a_value: { code: 7030, category: ts.DiagnosticCategory.Error, key: "Not_all_code_paths_return_a_value_7030", message: "Not all code paths return a value." }, + Binding_element_0_implicitly_has_an_1_type: { code: 7031, category: ts.DiagnosticCategory.Error, key: "Binding_element_0_implicitly_has_an_1_type_7031", message: "Binding element '{0}' implicitly has an '{1}' type." }, You_cannot_rename_this_element: { code: 8000, category: ts.DiagnosticCategory.Error, key: "You_cannot_rename_this_element_8000", message: "You cannot rename this element." }, You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: { code: 8001, category: ts.DiagnosticCategory.Error, key: "You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library_8001", message: "You cannot rename elements that are defined in the standard TypeScript library." }, import_can_only_be_used_in_a_ts_file: { code: 8002, category: ts.DiagnosticCategory.Error, key: "import_can_only_be_used_in_a_ts_file_8002", message: "'import ... =' can only be used in a .ts file." }, @@ -2656,7 +2963,6 @@ var ts; property_declarations_can_only_be_used_in_a_ts_file: { code: 8014, category: ts.DiagnosticCategory.Error, key: "property_declarations_can_only_be_used_in_a_ts_file_8014", message: "'property declarations' can only be used in a .ts file." }, enum_declarations_can_only_be_used_in_a_ts_file: { code: 8015, category: ts.DiagnosticCategory.Error, key: "enum_declarations_can_only_be_used_in_a_ts_file_8015", message: "'enum declarations' can only be used in a .ts file." }, type_assertion_expressions_can_only_be_used_in_a_ts_file: { code: 8016, category: ts.DiagnosticCategory.Error, key: "type_assertion_expressions_can_only_be_used_in_a_ts_file_8016", message: "'type assertion expressions' can only be used in a .ts file." }, - decorators_can_only_be_used_in_a_ts_file: { code: 8017, category: ts.DiagnosticCategory.Error, key: "decorators_can_only_be_used_in_a_ts_file_8017", message: "'decorators' can only be used in a .ts file." }, Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_class_extends_clauses: { code: 9002, category: ts.DiagnosticCategory.Error, key: "Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_clas_9002", message: "Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses." }, class_expressions_are_not_currently_supported: { code: 9003, category: ts.DiagnosticCategory.Error, key: "class_expressions_are_not_currently_supported_9003", message: "'class' expressions are not currently supported." }, JSX_attributes_must_only_be_assigned_a_non_empty_expression: { code: 17000, category: ts.DiagnosticCategory.Error, key: "JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000", message: "JSX attributes must only be assigned a non-empty 'expression'." }, @@ -2666,7 +2972,10 @@ var ts; Cannot_use_JSX_unless_the_jsx_flag_is_provided: { code: 17004, category: ts.DiagnosticCategory.Error, key: "Cannot_use_JSX_unless_the_jsx_flag_is_provided_17004", message: "Cannot use JSX unless the '--jsx' flag is provided." }, A_constructor_cannot_contain_a_super_call_when_its_class_extends_null: { code: 17005, category: ts.DiagnosticCategory.Error, key: "A_constructor_cannot_contain_a_super_call_when_its_class_extends_null_17005", message: "A constructor cannot contain a 'super' call when its class extends 'null'" }, An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: { code: 17006, category: ts.DiagnosticCategory.Error, key: "An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_ex_17006", message: "An unary expression with the '{0}' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses." }, - A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: { code: 17007, category: ts.DiagnosticCategory.Error, key: "A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Con_17007", message: "A type assertion expression is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses." } + A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: { code: 17007, category: ts.DiagnosticCategory.Error, key: "A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Con_17007", message: "A type assertion expression is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses." }, + JSX_element_0_has_no_corresponding_closing_tag: { code: 17008, category: ts.DiagnosticCategory.Error, key: "JSX_element_0_has_no_corresponding_closing_tag_17008", message: "JSX element '{0}' has no corresponding closing tag." }, + super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class: { code: 17009, category: ts.DiagnosticCategory.Error, key: "super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class_17009", message: "'super' must be called before accessing 'this' in the constructor of a derived class." }, + Unknown_typing_option_0: { code: 17010, category: ts.DiagnosticCategory.Error, key: "Unknown_typing_option_0_17010", message: "Unknown typing option '{0}'." } }; })(ts || (ts = {})); /// @@ -2702,7 +3011,7 @@ var ts; "false": 84 /* FalseKeyword */, "finally": 85 /* FinallyKeyword */, "for": 86 /* ForKeyword */, - "from": 133 /* FromKeyword */, + "from": 136 /* FromKeyword */, "function": 87 /* FunctionKeyword */, "get": 123 /* GetKeyword */, "if": 88 /* IfKeyword */, @@ -2715,27 +3024,31 @@ var ts; "let": 108 /* LetKeyword */, "module": 125 /* ModuleKeyword */, "namespace": 126 /* NamespaceKeyword */, + "never": 127 /* NeverKeyword */, "new": 92 /* NewKeyword */, "null": 93 /* NullKeyword */, - "number": 128 /* NumberKeyword */, + "number": 130 /* NumberKeyword */, "package": 109 /* PackageKeyword */, "private": 110 /* PrivateKeyword */, "protected": 111 /* ProtectedKeyword */, "public": 112 /* PublicKeyword */, - "require": 127 /* RequireKeyword */, + "readonly": 128 /* ReadonlyKeyword */, + "require": 129 /* RequireKeyword */, + "global": 137 /* GlobalKeyword */, "return": 94 /* ReturnKeyword */, - "set": 129 /* SetKeyword */, + "set": 131 /* SetKeyword */, "static": 113 /* StaticKeyword */, - "string": 130 /* StringKeyword */, + "string": 132 /* StringKeyword */, "super": 95 /* SuperKeyword */, "switch": 96 /* SwitchKeyword */, - "symbol": 131 /* SymbolKeyword */, + "symbol": 133 /* SymbolKeyword */, "this": 97 /* ThisKeyword */, "throw": 98 /* ThrowKeyword */, "true": 99 /* TrueKeyword */, "try": 100 /* TryKeyword */, - "type": 132 /* TypeKeyword */, + "type": 134 /* TypeKeyword */, "typeof": 101 /* TypeOfKeyword */, + "undefined": 135 /* UndefinedKeyword */, "var": 102 /* VarKeyword */, "void": 103 /* VoidKeyword */, "while": 104 /* WhileKeyword */, @@ -2743,7 +3056,7 @@ var ts; "yield": 114 /* YieldKeyword */, "async": 118 /* AsyncKeyword */, "await": 119 /* AwaitKeyword */, - "of": 134 /* OfKeyword */, + "of": 138 /* OfKeyword */, "{": 15 /* OpenBraceToken */, "}": 16 /* CloseBraceToken */, "(": 17 /* OpenParenToken */, @@ -2906,7 +3219,8 @@ var ts; var pos = 0; var lineStart = 0; while (pos < text.length) { - var ch = text.charCodeAt(pos++); + var ch = text.charCodeAt(pos); + pos++; switch (ch) { case 13 /* carriageReturn */: if (text.charCodeAt(pos) === 10 /* lineFeed */) { @@ -3040,6 +3354,11 @@ var ts; ts.couldStartTrivia = couldStartTrivia; /* @internal */ function skipTrivia(text, pos, stopAfterLineBreak) { + // Using ! with a greater than test is a fast way of testing the following conditions: + // pos === undefined || pos === null || isNaN(pos) || pos < 0; + if (!(pos >= 0)) { + return pos; + } // Keep in sync with couldStartTrivia while (true) { var ch = text.charCodeAt(pos); @@ -3109,7 +3428,7 @@ 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 followd by a space. + // a <<<<<<< or >>>>>>> marker then it is also followed by a space. var mergeConflictMarkerLength = "<<<<<<<".length; function isConflictMarkerTrivia(text, pos) { ts.Debug.assert(pos >= 0); @@ -3141,7 +3460,7 @@ var ts; } else { ts.Debug.assert(ch === 61 /* equals */); - // Consume everything from the start of the mid-conlict marker to the start of the next + // Consume everything from the start of the mid-conflict marker to the start of the next // end-conflict marker. while (pos < len) { var ch_1 = text.charCodeAt(pos); @@ -3276,6 +3595,19 @@ var ts; ch > 127 /* maxAsciiCharacter */ && isUnicodeIdentifierPart(ch, languageVersion); } ts.isIdentifierPart = isIdentifierPart; + /* @internal */ + function isIdentifier(name, languageVersion) { + if (!isIdentifierStart(name.charCodeAt(0), languageVersion)) { + return false; + } + for (var i = 1, n = name.length; i < n; i++) { + if (!isIdentifierPart(name.charCodeAt(i), languageVersion)) { + return false; + } + } + return true; + } + ts.isIdentifier = isIdentifier; // Creates a scanner over a (possibly unspecified) range of a piece of text. function createScanner(languageVersion, skipTrivia, languageVariant, text, onError, start, length) { if (languageVariant === void 0) { languageVariant = 0 /* Standard */; } @@ -3311,6 +3643,7 @@ var ts; scanJsxIdentifier: scanJsxIdentifier, reScanJsxToken: reScanJsxToken, scanJsxToken: scanJsxToken, + scanJSDocToken: scanJSDocToken, scan: scan, setText: setText, setScriptTarget: setScriptTarget, @@ -3318,7 +3651,8 @@ var ts; setOnError: setOnError, setTextPos: setTextPos, tryScan: tryScan, - lookAhead: lookAhead + lookAhead: lookAhead, + scanRange: scanRange }; function error(message, length) { if (onError) { @@ -3398,7 +3732,8 @@ var ts; return value; } function scanString() { - var quote = text.charCodeAt(pos++); + var quote = text.charCodeAt(pos); + pos++; var result = ""; var start = pos; while (true) { @@ -3494,7 +3829,8 @@ var ts; error(ts.Diagnostics.Unexpected_end_of_text); return ""; } - var ch = text.charCodeAt(pos++); + var ch = text.charCodeAt(pos); + pos++; switch (ch) { case 48 /* _0 */: return "\0"; @@ -3721,7 +4057,8 @@ var ts; } return pos += 2, token = 31 /* ExclamationEqualsToken */; } - return pos++, token = 49 /* ExclamationToken */; + pos++; + return token = 49 /* ExclamationToken */; case 34 /* doubleQuote */: case 39 /* singleQuote */: tokenValue = scanString(); @@ -3732,7 +4069,8 @@ var ts; if (text.charCodeAt(pos + 1) === 61 /* equals */) { return pos += 2, token = 62 /* PercentEqualsToken */; } - return pos++, token = 40 /* PercentToken */; + pos++; + return token = 40 /* PercentToken */; case 38 /* ampersand */: if (text.charCodeAt(pos + 1) === 38 /* ampersand */) { return pos += 2, token = 51 /* AmpersandAmpersandToken */; @@ -3740,11 +4078,14 @@ var ts; if (text.charCodeAt(pos + 1) === 61 /* equals */) { return pos += 2, token = 66 /* AmpersandEqualsToken */; } - return pos++, token = 46 /* AmpersandToken */; + pos++; + return token = 46 /* AmpersandToken */; case 40 /* openParen */: - return pos++, token = 17 /* OpenParenToken */; + pos++; + return token = 17 /* OpenParenToken */; case 41 /* closeParen */: - return pos++, token = 18 /* CloseParenToken */; + pos++; + return token = 18 /* CloseParenToken */; case 42 /* asterisk */: if (text.charCodeAt(pos + 1) === 61 /* equals */) { return pos += 2, token = 59 /* AsteriskEqualsToken */; @@ -3755,7 +4096,8 @@ var ts; } return pos += 2, token = 38 /* AsteriskAsteriskToken */; } - return pos++, token = 37 /* AsteriskToken */; + pos++; + return token = 37 /* AsteriskToken */; case 43 /* plus */: if (text.charCodeAt(pos + 1) === 43 /* plus */) { return pos += 2, token = 41 /* PlusPlusToken */; @@ -3763,9 +4105,11 @@ var ts; if (text.charCodeAt(pos + 1) === 61 /* equals */) { return pos += 2, token = 57 /* PlusEqualsToken */; } - return pos++, token = 35 /* PlusToken */; + pos++; + return token = 35 /* PlusToken */; case 44 /* comma */: - return pos++, token = 24 /* CommaToken */; + pos++; + return token = 24 /* CommaToken */; case 45 /* minus */: if (text.charCodeAt(pos + 1) === 45 /* minus */) { return pos += 2, token = 42 /* MinusMinusToken */; @@ -3773,7 +4117,8 @@ var ts; if (text.charCodeAt(pos + 1) === 61 /* equals */) { return pos += 2, token = 58 /* MinusEqualsToken */; } - return pos++, token = 36 /* MinusToken */; + pos++; + return token = 36 /* MinusToken */; case 46 /* dot */: if (isDigit(text.charCodeAt(pos + 1))) { tokenValue = scanNumber(); @@ -3782,7 +4127,8 @@ var ts; if (text.charCodeAt(pos + 1) === 46 /* dot */ && text.charCodeAt(pos + 2) === 46 /* dot */) { return pos += 3, token = 22 /* DotDotDotToken */; } - return pos++, token = 21 /* DotToken */; + pos++; + return token = 21 /* DotToken */; case 47 /* slash */: // Single-line comment if (text.charCodeAt(pos + 1) === 47 /* slash */) { @@ -3830,7 +4176,8 @@ var ts; if (text.charCodeAt(pos + 1) === 61 /* equals */) { return pos += 2, token = 61 /* SlashEqualsToken */; } - return pos++, token = 39 /* SlashToken */; + pos++; + return token = 39 /* SlashToken */; case 48 /* _0 */: if (pos + 2 < end && (text.charCodeAt(pos + 1) === 88 /* X */ || text.charCodeAt(pos + 1) === 120 /* x */)) { pos += 2; @@ -3882,9 +4229,11 @@ var ts; tokenValue = scanNumber(); return token = 8 /* NumericLiteral */; case 58 /* colon */: - return pos++, token = 54 /* ColonToken */; + pos++; + return token = 54 /* ColonToken */; case 59 /* semicolon */: - return pos++, token = 23 /* SemicolonToken */; + pos++; + return token = 23 /* SemicolonToken */; case 60 /* lessThan */: if (isConflictMarkerTrivia(text, pos)) { pos = scanConflictMarkerTrivia(text, pos, error); @@ -3909,7 +4258,8 @@ var ts; text.charCodeAt(pos + 2) !== 42 /* asterisk */) { return pos += 2, token = 26 /* LessThanSlashToken */; } - return pos++, token = 25 /* LessThanToken */; + pos++; + return token = 25 /* LessThanToken */; case 61 /* equals */: if (isConflictMarkerTrivia(text, pos)) { pos = scanConflictMarkerTrivia(text, pos, error); @@ -3929,7 +4279,8 @@ var ts; if (text.charCodeAt(pos + 1) === 62 /* greaterThan */) { return pos += 2, token = 34 /* EqualsGreaterThanToken */; } - return pos++, token = 56 /* EqualsToken */; + pos++; + return token = 56 /* EqualsToken */; case 62 /* greaterThan */: if (isConflictMarkerTrivia(text, pos)) { pos = scanConflictMarkerTrivia(text, pos, error); @@ -3940,20 +4291,26 @@ var ts; return token = 7 /* ConflictMarkerTrivia */; } } - return pos++, token = 27 /* GreaterThanToken */; + pos++; + return token = 27 /* GreaterThanToken */; case 63 /* question */: - return pos++, token = 53 /* QuestionToken */; + pos++; + return token = 53 /* QuestionToken */; case 91 /* openBracket */: - return pos++, token = 19 /* OpenBracketToken */; + pos++; + return token = 19 /* OpenBracketToken */; case 93 /* closeBracket */: - return pos++, token = 20 /* CloseBracketToken */; + pos++; + return token = 20 /* CloseBracketToken */; case 94 /* caret */: if (text.charCodeAt(pos + 1) === 61 /* equals */) { return pos += 2, token = 68 /* CaretEqualsToken */; } - return pos++, token = 48 /* CaretToken */; + pos++; + return token = 48 /* CaretToken */; case 123 /* openBrace */: - return pos++, token = 15 /* OpenBraceToken */; + pos++; + return token = 15 /* OpenBraceToken */; case 124 /* bar */: if (text.charCodeAt(pos + 1) === 124 /* bar */) { return pos += 2, token = 52 /* BarBarToken */; @@ -3961,13 +4318,17 @@ var ts; if (text.charCodeAt(pos + 1) === 61 /* equals */) { return pos += 2, token = 67 /* BarEqualsToken */; } - return pos++, token = 47 /* BarToken */; + pos++; + return token = 47 /* BarToken */; case 125 /* closeBrace */: - return pos++, token = 16 /* CloseBraceToken */; + pos++; + return token = 16 /* CloseBraceToken */; case 126 /* tilde */: - return pos++, token = 50 /* TildeToken */; + pos++; + return token = 50 /* TildeToken */; case 64 /* at */: - return pos++, token = 55 /* AtToken */; + pos++; + return token = 55 /* AtToken */; case 92 /* backslash */: var cookedChar = peekUnicodeEscape(); if (cookedChar >= 0 && isIdentifierStart(cookedChar, languageVersion)) { @@ -3976,7 +4337,8 @@ var ts; return token = getIdentifierToken(); } error(ts.Diagnostics.Invalid_character); - return pos++, token = 0 /* Unknown */; + pos++; + return token = 0 /* Unknown */; default: if (isIdentifierStart(ch, languageVersion)) { pos++; @@ -3998,7 +4360,8 @@ var ts; continue; } error(ts.Diagnostics.Invalid_character); - return pos++, token = 0 /* Unknown */; + pos++; + return token = 0 /* Unknown */; } } } @@ -4014,10 +4377,12 @@ var ts; if (text.charCodeAt(pos + 1) === 61 /* equals */) { return pos += 2, token = 64 /* GreaterThanGreaterThanEqualsToken */; } - return pos++, token = 44 /* GreaterThanGreaterThanToken */; + pos++; + return token = 44 /* GreaterThanGreaterThanToken */; } if (text.charCodeAt(pos) === 61 /* equals */) { - return pos++, token = 29 /* GreaterThanEqualsToken */; + pos++; + return token = 29 /* GreaterThanEqualsToken */; } } return token; @@ -4109,7 +4474,7 @@ var ts; break; } } - return token = 236 /* JsxText */; + return token = 244 /* JsxText */; } // Scans a JSX identifier; these differ from normal identifiers in that // they allow dashes @@ -4129,6 +4494,55 @@ var ts; } return token; } + function scanJSDocToken() { + if (pos >= end) { + return token = 1 /* EndOfFileToken */; + } + startPos = pos; + // Eat leading whitespace + var ch = text.charCodeAt(pos); + while (pos < end) { + ch = text.charCodeAt(pos); + if (isWhiteSpace(ch)) { + pos++; + } + else { + break; + } + } + tokenPos = pos; + switch (ch) { + case 64 /* at */: + return pos += 1, token = 55 /* AtToken */; + case 10 /* lineFeed */: + case 13 /* carriageReturn */: + return pos += 1, token = 4 /* NewLineTrivia */; + case 42 /* asterisk */: + return pos += 1, token = 37 /* AsteriskToken */; + case 123 /* openBrace */: + return pos += 1, token = 15 /* OpenBraceToken */; + case 125 /* closeBrace */: + return pos += 1, token = 16 /* CloseBraceToken */; + case 91 /* openBracket */: + return pos += 1, token = 19 /* OpenBracketToken */; + case 93 /* closeBracket */: + return pos += 1, token = 20 /* CloseBracketToken */; + case 61 /* equals */: + return pos += 1, token = 56 /* EqualsToken */; + case 44 /* comma */: + return pos += 1, token = 24 /* CommaToken */; + } + if (isIdentifierStart(ch, 2 /* Latest */)) { + pos++; + while (isIdentifierPart(text.charCodeAt(pos), 2 /* Latest */) && pos < end) { + pos++; + } + return token = 69 /* Identifier */; + } + else { + return pos += 1, token = 0 /* Unknown */; + } + } function speculationHelper(callback, isLookahead) { var savePos = pos; var saveStartPos = startPos; @@ -4149,11 +4563,34 @@ var ts; } return result; } + function scanRange(start, length, callback) { + var saveEnd = end; + var savePos = pos; + var saveStartPos = startPos; + var saveTokenPos = tokenPos; + var saveToken = token; + var savePrecedingLineBreak = precedingLineBreak; + var saveTokenValue = tokenValue; + var saveHasExtendedUnicodeEscape = hasExtendedUnicodeEscape; + var saveTokenIsUnterminated = tokenIsUnterminated; + setText(text, start, length); + var result = callback(); + end = saveEnd; + pos = savePos; + startPos = saveStartPos; + tokenPos = saveTokenPos; + token = saveToken; + precedingLineBreak = savePrecedingLineBreak; + tokenValue = saveTokenValue; + hasExtendedUnicodeEscape = saveHasExtendedUnicodeEscape; + tokenIsUnterminated = saveTokenIsUnterminated; + return result; + } function lookAhead(callback) { - return speculationHelper(callback, /*isLookahead:*/ true); + return speculationHelper(callback, /*isLookahead*/ true); } function tryScan(callback) { - return speculationHelper(callback, /*isLookahead:*/ false); + return speculationHelper(callback, /*isLookahead*/ false); } function setText(newText, start, length) { text = newText || ""; @@ -4204,10 +4641,10 @@ var ts; var stringWriters = []; function getSingleLineStringWriter() { if (stringWriters.length === 0) { - var str = ""; - var writeText = function (text) { return str += text; }; + var str_1 = ""; + var writeText = function (text) { return str_1 += text; }; return { - string: function () { return str; }, + string: function () { return str_1; }, writeKeyword: writeText, writeOperator: writeText, writePunctuation: writeText, @@ -4217,10 +4654,10 @@ var ts; writeSymbol: writeText, // Completely ignore indentation for string writers. And map newlines to // a single space. - writeLine: function () { return str += " "; }, + writeLine: function () { return str_1 += " "; }, increaseIndent: function () { }, decreaseIndent: function () { }, - clear: function () { return str = ""; }, + clear: function () { return str_1 = ""; }, trackSymbol: function () { }, reportInaccessibleThisError: function () { } }; @@ -4237,6 +4674,24 @@ var ts; return node.end - node.pos; } ts.getFullWidth = getFullWidth; + function mapIsEqualTo(map1, map2) { + if (!map1 || !map2) { + return map1 === map2; + } + return containsAll(map1, map2) && containsAll(map2, map1); + } + ts.mapIsEqualTo = mapIsEqualTo; + function containsAll(map, other) { + for (var key in map) { + if (!ts.hasProperty(map, key)) { + continue; + } + if (!ts.hasProperty(other, key) || map[key] !== other[key]) { + return false; + } + } + return true; + } function arrayIsEqualTo(array1, array2, equaler) { if (!array1 || !array2) { return array1 === array2; @@ -4244,7 +4699,7 @@ var ts; if (array1.length !== array2.length) { return false; } - for (var i = 0; i < array1.length; ++i) { + for (var i = 0; i < array1.length; i++) { var equals = equaler ? equaler(array1[i], array2[i]) : array1[i] === array2[i]; if (!equals) { return false; @@ -4268,36 +4723,83 @@ var ts; sourceFile.resolvedModules[moduleNameText] = resolvedModule; } ts.setResolvedModule = setResolvedModule; + function setResolvedTypeReferenceDirective(sourceFile, typeReferenceDirectiveName, resolvedTypeReferenceDirective) { + if (!sourceFile.resolvedTypeReferenceDirectiveNames) { + sourceFile.resolvedTypeReferenceDirectiveNames = {}; + } + sourceFile.resolvedTypeReferenceDirectiveNames[typeReferenceDirectiveName] = resolvedTypeReferenceDirective; + } + ts.setResolvedTypeReferenceDirective = setResolvedTypeReferenceDirective; + /* @internal */ + function moduleResolutionIsEqualTo(oldResolution, newResolution) { + return oldResolution.resolvedFileName === newResolution.resolvedFileName && oldResolution.isExternalLibraryImport === newResolution.isExternalLibraryImport; + } + ts.moduleResolutionIsEqualTo = moduleResolutionIsEqualTo; + /* @internal */ + function typeDirectiveIsEqualTo(oldResolution, newResolution) { + return oldResolution.resolvedFileName === newResolution.resolvedFileName && oldResolution.primary === newResolution.primary; + } + ts.typeDirectiveIsEqualTo = typeDirectiveIsEqualTo; + /* @internal */ + function hasChangesInResolutions(names, newResolutions, oldResolutions, comparer) { + if (names.length !== newResolutions.length) { + return false; + } + for (var i = 0; i < names.length; i++) { + var newResolution = newResolutions[i]; + var oldResolution = oldResolutions && ts.hasProperty(oldResolutions, names[i]) ? oldResolutions[names[i]] : undefined; + var changed = oldResolution + ? !newResolution || !comparer(oldResolution, newResolution) + : newResolution; + if (changed) { + return true; + } + } + return false; + } + ts.hasChangesInResolutions = hasChangesInResolutions; // Returns true if this node contains a parse error anywhere underneath it. function containsParseError(node) { aggregateChildData(node); - return (node.parserContextFlags & 64 /* ThisNodeOrAnySubNodesHasError */) !== 0; + return (node.flags & 268435456 /* ThisNodeOrAnySubNodesHasError */) !== 0; } ts.containsParseError = containsParseError; function aggregateChildData(node) { - if (!(node.parserContextFlags & 128 /* HasAggregatedChildData */)) { + if (!(node.flags & 536870912 /* 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.parserContextFlags & 16 /* ThisNodeHasError */) !== 0) || + var thisNodeOrAnySubNodesHasError = ((node.flags & 67108864 /* ThisNodeHasError */) !== 0) || ts.forEachChild(node, containsParseError); // If so, mark ourselves accordingly. if (thisNodeOrAnySubNodesHasError) { - node.parserContextFlags |= 64 /* ThisNodeOrAnySubNodesHasError */; + node.flags |= 268435456 /* ThisNodeOrAnySubNodesHasError */; } - // Also mark that we've propogated the child information to this node. This way we can + // 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.parserContextFlags |= 128 /* HasAggregatedChildData */; + node.flags |= 536870912 /* HasAggregatedChildData */; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 248 /* SourceFile */) { + while (node && node.kind !== 256 /* SourceFile */) { node = node.parent; } return node; } ts.getSourceFileOfNode = getSourceFileOfNode; + function isStatementWithLocals(node) { + switch (node.kind) { + case 199 /* Block */: + case 227 /* CaseBlock */: + case 206 /* ForStatement */: + case 207 /* ForInStatement */: + case 208 /* ForOfStatement */: + return true; + } + return false; + } + ts.isStatementWithLocals = isStatementWithLocals; function getStartPositionOfLine(line, sourceFile) { ts.Debug.assert(line >= 0); return ts.getLineStarts(sourceFile)[line]; @@ -4314,6 +4816,32 @@ var ts; return node.pos; } ts.getStartPosOfNode = getStartPosOfNode; + function getEndLinePosition(line, sourceFile) { + ts.Debug.assert(line >= 0); + var lineStarts = ts.getLineStarts(sourceFile); + 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--; + } + return pos; + } + } + ts.getEndLinePosition = getEndLinePosition; // 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 @@ -4391,10 +4919,42 @@ var ts; } ts.makeIdentifierFromModuleName = makeIdentifierFromModuleName; function isBlockOrCatchScoped(declaration) { - return (getCombinedNodeFlags(declaration) & 24576 /* BlockScoped */) !== 0 || + return (getCombinedNodeFlags(declaration) & 3072 /* BlockScoped */) !== 0 || isCatchClauseVariableDeclaration(declaration); } ts.isBlockOrCatchScoped = isBlockOrCatchScoped; + function isAmbientModule(node) { + return node && node.kind === 225 /* ModuleDeclaration */ && + (node.name.kind === 9 /* StringLiteral */ || isGlobalScopeAugmentation(node)); + } + ts.isAmbientModule = isAmbientModule; + function isBlockScopedContainerTopLevel(node) { + return node.kind === 256 /* SourceFile */ || + node.kind === 225 /* ModuleDeclaration */ || + isFunctionLike(node) || + isFunctionBlock(node); + } + ts.isBlockScopedContainerTopLevel = isBlockScopedContainerTopLevel; + function isGlobalScopeAugmentation(module) { + return !!(module.flags & 131072 /* GlobalAugmentation */); + } + ts.isGlobalScopeAugmentation = isGlobalScopeAugmentation; + function isExternalModuleAugmentation(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 + if (!node || !isAmbientModule(node)) { + return false; + } + switch (node.parent.kind) { + case 256 /* SourceFile */: + return ts.isExternalModule(node.parent); + case 226 /* ModuleBlock */: + return isAmbientModule(node.parent.parent) && !ts.isExternalModule(node.parent.parent.parent); + } + return false; + } + ts.isExternalModuleAugmentation = isExternalModuleAugmentation; // Gets the nearest enclosing block scope container that has the provided node // as a descendant, that is not the provided node. function getEnclosingBlockScopeContainer(node) { @@ -4404,15 +4964,15 @@ var ts; return current; } switch (current.kind) { - case 248 /* SourceFile */: - case 220 /* CaseBlock */: - case 244 /* CatchClause */: - case 218 /* ModuleDeclaration */: - case 199 /* ForStatement */: - case 200 /* ForInStatement */: - case 201 /* ForOfStatement */: + case 256 /* SourceFile */: + case 227 /* CaseBlock */: + case 252 /* CatchClause */: + case 225 /* ModuleDeclaration */: + case 206 /* ForStatement */: + case 207 /* ForInStatement */: + case 208 /* ForOfStatement */: return current; - case 192 /* Block */: + case 199 /* Block */: // function block is not considered block-scope container // see comment in binder.ts: bind(...), case for SyntaxKind.Block if (!isFunctionLike(current.parent)) { @@ -4425,9 +4985,9 @@ var ts; ts.getEnclosingBlockScopeContainer = getEnclosingBlockScopeContainer; function isCatchClauseVariableDeclaration(declaration) { return declaration && - declaration.kind === 211 /* VariableDeclaration */ && + declaration.kind === 218 /* VariableDeclaration */ && declaration.parent && - declaration.parent.kind === 244 /* CatchClause */; + declaration.parent.kind === 252 /* CatchClause */; } ts.isCatchClauseVariableDeclaration = isCatchClauseVariableDeclaration; // Return display name of an identifier @@ -4463,10 +5023,23 @@ var ts; return ts.createTextSpanFromBounds(start, scanner.getTextPos()); } ts.getSpanOfTokenAtPosition = getSpanOfTokenAtPosition; + function getErrorSpanForArrowFunction(sourceFile, node) { + var pos = ts.skipTrivia(sourceFile.text, node.pos); + if (node.body && node.body.kind === 199 /* Block */) { + 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); + } + } + return ts.createTextSpanFromBounds(pos, node.end); + } function getErrorSpanForNode(sourceFile, node) { var errorNode = node; switch (node.kind) { - case 248 /* SourceFile */: + case 256 /* SourceFile */: var pos_1 = ts.skipTrivia(sourceFile.text, 0, /*stopAfterLineBreak*/ false); if (pos_1 === sourceFile.text.length) { // file is empty - return span for the beginning of the file @@ -4475,18 +5048,24 @@ var ts; return getSpanOfTokenAtPosition(sourceFile, pos_1); // This list is a work in progress. Add missing node kinds to improve their error // spans. - case 211 /* VariableDeclaration */: - case 163 /* BindingElement */: - case 214 /* ClassDeclaration */: - case 186 /* ClassExpression */: - case 215 /* InterfaceDeclaration */: - case 218 /* ModuleDeclaration */: - case 217 /* EnumDeclaration */: - case 247 /* EnumMember */: - case 213 /* FunctionDeclaration */: - case 173 /* FunctionExpression */: + case 218 /* VariableDeclaration */: + case 169 /* BindingElement */: + case 221 /* ClassDeclaration */: + case 192 /* ClassExpression */: + case 222 /* InterfaceDeclaration */: + case 225 /* ModuleDeclaration */: + case 224 /* EnumDeclaration */: + case 255 /* EnumMember */: + case 220 /* FunctionDeclaration */: + case 179 /* FunctionExpression */: + case 147 /* MethodDeclaration */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: + case 223 /* TypeAliasDeclaration */: errorNode = node.name; break; + case 180 /* ArrowFunction */: + 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 @@ -4499,24 +5078,20 @@ var ts; return ts.createTextSpanFromBounds(pos, errorNode.end); } ts.getErrorSpanForNode = getErrorSpanForNode; - function isExternalModule(file) { - return file.externalModuleIndicator !== undefined; - } - ts.isExternalModule = isExternalModule; function isExternalOrCommonJsModule(file) { return (file.externalModuleIndicator || file.commonJsModuleIndicator) !== undefined; } ts.isExternalOrCommonJsModule = isExternalOrCommonJsModule; function isDeclarationFile(file) { - return (file.flags & 4096 /* DeclarationFile */) !== 0; + return file.isDeclarationFile; } ts.isDeclarationFile = isDeclarationFile; function isConstEnumDeclaration(node) { - return node.kind === 217 /* EnumDeclaration */ && isConst(node); + return node.kind === 224 /* EnumDeclaration */ && isConst(node); } ts.isConstEnumDeclaration = isConstEnumDeclaration; function walkUpBindingElementsAndPatterns(node) { - while (node && (node.kind === 163 /* BindingElement */ || isBindingPattern(node))) { + while (node && (node.kind === 169 /* BindingElement */ || isBindingPattern(node))) { node = node.parent; } return node; @@ -4531,29 +5106,33 @@ var ts; function getCombinedNodeFlags(node) { node = walkUpBindingElementsAndPatterns(node); var flags = node.flags; - if (node.kind === 211 /* VariableDeclaration */) { + if (node.kind === 218 /* VariableDeclaration */) { node = node.parent; } - if (node && node.kind === 212 /* VariableDeclarationList */) { + if (node && node.kind === 219 /* VariableDeclarationList */) { flags |= node.flags; node = node.parent; } - if (node && node.kind === 193 /* VariableStatement */) { + if (node && node.kind === 200 /* VariableStatement */) { flags |= node.flags; } return flags; } ts.getCombinedNodeFlags = getCombinedNodeFlags; function isConst(node) { - return !!(getCombinedNodeFlags(node) & 16384 /* Const */); + return !!(getCombinedNodeFlags(node) & 2048 /* Const */); } ts.isConst = isConst; function isLet(node) { - return !!(getCombinedNodeFlags(node) & 8192 /* Let */); + return !!(getCombinedNodeFlags(node) & 1024 /* Let */); } ts.isLet = isLet; + function isSuperCallExpression(n) { + return n.kind === 174 /* CallExpression */ && n.expression.kind === 95 /* SuperKeyword */; + } + ts.isSuperCallExpression = isSuperCallExpression; function isPrologueDirective(node) { - return node.kind === 195 /* ExpressionStatement */ && node.expression.kind === 9 /* StringLiteral */; + return node.kind === 202 /* ExpressionStatement */ && node.expression.kind === 9 /* StringLiteral */; } ts.isPrologueDirective = isPrologueDirective; function getLeadingCommentRangesOfNode(node, sourceFileOfNode) { @@ -4569,7 +5148,7 @@ var ts; } ts.getJsDocComments = getJsDocComments; function getJsDocCommentsFromText(node, text) { - var commentRanges = (node.kind === 138 /* Parameter */ || node.kind === 137 /* TypeParameter */) ? + var commentRanges = (node.kind === 142 /* Parameter */ || node.kind === 141 /* TypeParameter */) ? ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) : getLeadingCommentRangesOfNodeFromText(node, text); return ts.filter(commentRanges, isJsDocComment); @@ -4582,42 +5161,42 @@ var ts; } ts.getJsDocCommentsFromText = getJsDocCommentsFromText; ts.fullTripleSlashReferencePathRegEx = /^(\/\/\/\s*/; + ts.fullTripleSlashReferenceTypeReferenceDirectiveRegEx = /^(\/\/\/\s*/; ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*/; function isTypeNode(node) { - if (151 /* FirstTypeNode */ <= node.kind && node.kind <= 160 /* LastTypeNode */) { + if (154 /* FirstTypeNode */ <= node.kind && node.kind <= 166 /* LastTypeNode */) { return true; } switch (node.kind) { case 117 /* AnyKeyword */: - case 128 /* NumberKeyword */: - case 130 /* StringKeyword */: + case 130 /* NumberKeyword */: + case 132 /* StringKeyword */: case 120 /* BooleanKeyword */: - case 131 /* SymbolKeyword */: + case 133 /* SymbolKeyword */: + case 135 /* UndefinedKeyword */: + case 127 /* NeverKeyword */: return true; case 103 /* VoidKeyword */: - return node.parent.kind !== 177 /* VoidExpression */; - case 9 /* StringLiteral */: - // Specialized signatures can have string literals as their parameters' type names - return node.parent.kind === 138 /* Parameter */; - case 188 /* ExpressionWithTypeArguments */: + return node.parent.kind !== 183 /* VoidExpression */; + case 194 /* ExpressionWithTypeArguments */: return !isExpressionWithTypeArgumentsInClassExtendsClause(node); // Identifiers and qualified names may be type nodes, depending on their context. Climb // above them to find the lowest container case 69 /* Identifier */: // If the identifier is the RHS of a qualified name, then it's a type iff its parent is. - if (node.parent.kind === 135 /* QualifiedName */ && node.parent.right === node) { + if (node.parent.kind === 139 /* QualifiedName */ && node.parent.right === node) { node = node.parent; } - else if (node.parent.kind === 166 /* PropertyAccessExpression */ && node.parent.name === node) { + else if (node.parent.kind === 172 /* PropertyAccessExpression */ && node.parent.name === node) { node = node.parent; } // At this point, node is either a qualified name or an identifier - ts.Debug.assert(node.kind === 69 /* Identifier */ || node.kind === 135 /* QualifiedName */ || node.kind === 166 /* PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isTypeNode'."); - case 135 /* QualifiedName */: - case 166 /* PropertyAccessExpression */: + ts.Debug.assert(node.kind === 69 /* Identifier */ || node.kind === 139 /* QualifiedName */ || node.kind === 172 /* PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isTypeNode'."); + case 139 /* QualifiedName */: + case 172 /* PropertyAccessExpression */: case 97 /* ThisKeyword */: var parent_1 = node.parent; - if (parent_1.kind === 154 /* TypeQuery */) { + if (parent_1.kind === 158 /* TypeQuery */) { return false; } // Do not recursively call isTypeNode on the parent. In the example: @@ -4626,38 +5205,38 @@ var ts; // // Calling isTypeNode would consider the qualified name A.B a type node. Only C or // A.B.C is a type node. - if (151 /* FirstTypeNode */ <= parent_1.kind && parent_1.kind <= 160 /* LastTypeNode */) { + if (154 /* FirstTypeNode */ <= parent_1.kind && parent_1.kind <= 166 /* LastTypeNode */) { return true; } switch (parent_1.kind) { - case 188 /* ExpressionWithTypeArguments */: + case 194 /* ExpressionWithTypeArguments */: return !isExpressionWithTypeArgumentsInClassExtendsClause(parent_1); - case 137 /* TypeParameter */: + case 141 /* TypeParameter */: return node === parent_1.constraint; - case 141 /* PropertyDeclaration */: - case 140 /* PropertySignature */: - case 138 /* Parameter */: - case 211 /* VariableDeclaration */: + case 145 /* PropertyDeclaration */: + case 144 /* PropertySignature */: + case 142 /* Parameter */: + case 218 /* VariableDeclaration */: return node === parent_1.type; - case 213 /* FunctionDeclaration */: - case 173 /* FunctionExpression */: - case 174 /* ArrowFunction */: - case 144 /* Constructor */: - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: + case 220 /* FunctionDeclaration */: + case 179 /* FunctionExpression */: + case 180 /* ArrowFunction */: + case 148 /* Constructor */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: return node === parent_1.type; - case 147 /* CallSignature */: - case 148 /* ConstructSignature */: - case 149 /* IndexSignature */: + case 151 /* CallSignature */: + case 152 /* ConstructSignature */: + case 153 /* IndexSignature */: return node === parent_1.type; - case 171 /* TypeAssertionExpression */: + case 177 /* TypeAssertionExpression */: return node === parent_1.type; - case 168 /* CallExpression */: - case 169 /* NewExpression */: + case 174 /* CallExpression */: + case 175 /* NewExpression */: return parent_1.typeArguments && ts.indexOf(parent_1.typeArguments, node) >= 0; - case 170 /* TaggedTemplateExpression */: + case 176 /* TaggedTemplateExpression */: // TODO (drosen): TaggedTemplateExpressions may eventually support type arguments. return false; } @@ -4671,23 +5250,23 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 204 /* ReturnStatement */: + case 211 /* ReturnStatement */: return visitor(node); - case 220 /* CaseBlock */: - case 192 /* Block */: - case 196 /* IfStatement */: - case 197 /* DoStatement */: - case 198 /* WhileStatement */: - case 199 /* ForStatement */: - case 200 /* ForInStatement */: - case 201 /* ForOfStatement */: - case 205 /* WithStatement */: - case 206 /* SwitchStatement */: - case 241 /* CaseClause */: - case 242 /* DefaultClause */: - case 207 /* LabeledStatement */: - case 209 /* TryStatement */: - case 244 /* CatchClause */: + case 227 /* CaseBlock */: + case 199 /* Block */: + case 203 /* IfStatement */: + case 204 /* DoStatement */: + case 205 /* WhileStatement */: + case 206 /* ForStatement */: + case 207 /* ForInStatement */: + case 208 /* ForOfStatement */: + case 212 /* WithStatement */: + case 213 /* SwitchStatement */: + case 249 /* CaseClause */: + case 250 /* DefaultClause */: + case 214 /* LabeledStatement */: + case 216 /* TryStatement */: + case 252 /* CatchClause */: return ts.forEachChild(node, traverse); } } @@ -4697,18 +5276,18 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 184 /* YieldExpression */: + case 190 /* YieldExpression */: visitor(node); var operand = node.expression; if (operand) { traverse(operand); } - case 217 /* EnumDeclaration */: - case 215 /* InterfaceDeclaration */: - case 218 /* ModuleDeclaration */: - case 216 /* TypeAliasDeclaration */: - case 214 /* ClassDeclaration */: - case 186 /* ClassExpression */: + case 224 /* EnumDeclaration */: + case 222 /* InterfaceDeclaration */: + case 225 /* ModuleDeclaration */: + case 223 /* TypeAliasDeclaration */: + case 221 /* ClassDeclaration */: + case 192 /* 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. @@ -4716,7 +5295,7 @@ var ts; default: if (isFunctionLike(node)) { var name_5 = node.name; - if (name_5 && name_5.kind === 136 /* ComputedPropertyName */) { + if (name_5 && name_5.kind === 140 /* 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. traverse(name_5.expression); @@ -4735,14 +5314,14 @@ var ts; function isVariableLike(node) { if (node) { switch (node.kind) { - case 163 /* BindingElement */: - case 247 /* EnumMember */: - case 138 /* Parameter */: - case 245 /* PropertyAssignment */: - case 141 /* PropertyDeclaration */: - case 140 /* PropertySignature */: - case 246 /* ShorthandPropertyAssignment */: - case 211 /* VariableDeclaration */: + case 169 /* BindingElement */: + case 255 /* EnumMember */: + case 142 /* Parameter */: + case 253 /* PropertyAssignment */: + case 145 /* PropertyDeclaration */: + case 144 /* PropertySignature */: + case 254 /* ShorthandPropertyAssignment */: + case 218 /* VariableDeclaration */: return true; } } @@ -4750,11 +5329,11 @@ var ts; } ts.isVariableLike = isVariableLike; function isAccessor(node) { - return node && (node.kind === 145 /* GetAccessor */ || node.kind === 146 /* SetAccessor */); + return node && (node.kind === 149 /* GetAccessor */ || node.kind === 150 /* SetAccessor */); } ts.isAccessor = isAccessor; function isClassLike(node) { - return node && (node.kind === 214 /* ClassDeclaration */ || node.kind === 186 /* ClassExpression */); + return node && (node.kind === 221 /* ClassDeclaration */ || node.kind === 192 /* ClassExpression */); } ts.isClassLike = isClassLike; function isFunctionLike(node) { @@ -4763,32 +5342,32 @@ var ts; ts.isFunctionLike = isFunctionLike; function isFunctionLikeKind(kind) { switch (kind) { - case 144 /* Constructor */: - case 173 /* FunctionExpression */: - case 213 /* FunctionDeclaration */: - case 174 /* ArrowFunction */: - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: - case 147 /* CallSignature */: - case 148 /* ConstructSignature */: - case 149 /* IndexSignature */: - case 152 /* FunctionType */: - case 153 /* ConstructorType */: + case 148 /* Constructor */: + case 179 /* FunctionExpression */: + case 220 /* FunctionDeclaration */: + case 180 /* ArrowFunction */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: + case 151 /* CallSignature */: + case 152 /* ConstructSignature */: + case 153 /* IndexSignature */: + case 156 /* FunctionType */: + case 157 /* ConstructorType */: return true; } } ts.isFunctionLikeKind = isFunctionLikeKind; function introducesArgumentsExoticObject(node) { switch (node.kind) { - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - case 144 /* Constructor */: - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: - case 213 /* FunctionDeclaration */: - case 173 /* FunctionExpression */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: + case 148 /* Constructor */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: + case 220 /* FunctionDeclaration */: + case 179 /* FunctionExpression */: return true; } return false; @@ -4796,26 +5375,34 @@ var ts; ts.introducesArgumentsExoticObject = introducesArgumentsExoticObject; function isIterationStatement(node, lookInLabeledStatements) { switch (node.kind) { - case 199 /* ForStatement */: - case 200 /* ForInStatement */: - case 201 /* ForOfStatement */: - case 197 /* DoStatement */: - case 198 /* WhileStatement */: + case 206 /* ForStatement */: + case 207 /* ForInStatement */: + case 208 /* ForOfStatement */: + case 204 /* DoStatement */: + case 205 /* WhileStatement */: return true; - case 207 /* LabeledStatement */: + case 214 /* LabeledStatement */: return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); } return false; } ts.isIterationStatement = isIterationStatement; function isFunctionBlock(node) { - return node && node.kind === 192 /* Block */ && isFunctionLike(node.parent); + return node && node.kind === 199 /* Block */ && isFunctionLike(node.parent); } ts.isFunctionBlock = isFunctionBlock; function isObjectLiteralMethod(node) { - return node && node.kind === 143 /* MethodDeclaration */ && node.parent.kind === 165 /* ObjectLiteralExpression */; + return node && node.kind === 147 /* MethodDeclaration */ && node.parent.kind === 171 /* ObjectLiteralExpression */; } ts.isObjectLiteralMethod = isObjectLiteralMethod; + function isIdentifierTypePredicate(predicate) { + return predicate && predicate.kind === 1 /* Identifier */; + } + ts.isIdentifierTypePredicate = isIdentifierTypePredicate; + function isThisTypePredicate(predicate) { + return predicate && predicate.kind === 0 /* This */; + } + ts.isThisTypePredicate = isThisTypePredicate; function getContainingFunction(node) { while (true) { node = node.parent; @@ -4825,6 +5412,15 @@ var ts; } } ts.getContainingFunction = getContainingFunction; + function getContainingFunctionOrModule(node) { + while (true) { + node = node.parent; + if (isFunctionLike(node) || node.kind === 225 /* ModuleDeclaration */ || node.kind === 256 /* SourceFile */) { + return node; + } + } + } + ts.getContainingFunctionOrModule = getContainingFunctionOrModule; function getContainingClass(node) { while (true) { node = node.parent; @@ -4841,7 +5437,7 @@ var ts; return undefined; } switch (node.kind) { - case 136 /* ComputedPropertyName */: + case 140 /* 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 @@ -4856,9 +5452,9 @@ var ts; // the *body* of the container. node = node.parent; break; - case 139 /* Decorator */: + case 143 /* Decorator */: // Decorators are always applied outside of the body of a class or method. - if (node.parent.kind === 138 /* Parameter */ && isClassElement(node.parent.parent)) { + if (node.parent.kind === 142 /* Parameter */ && isClassElement(node.parent.parent)) { // If the decorator's parent is a Parameter, we resolve the this container from // the grandparent class declaration. node = node.parent.parent; @@ -4869,55 +5465,66 @@ var ts; node = node.parent; } break; - case 174 /* ArrowFunction */: + case 180 /* ArrowFunction */: if (!includeArrowFunctions) { continue; } // Fall through - case 213 /* FunctionDeclaration */: - case 173 /* FunctionExpression */: - case 218 /* ModuleDeclaration */: - case 141 /* PropertyDeclaration */: - case 140 /* PropertySignature */: - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - case 144 /* Constructor */: - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: - case 147 /* CallSignature */: - case 148 /* ConstructSignature */: - case 149 /* IndexSignature */: - case 217 /* EnumDeclaration */: - case 248 /* SourceFile */: + case 220 /* FunctionDeclaration */: + case 179 /* FunctionExpression */: + case 225 /* ModuleDeclaration */: + case 145 /* PropertyDeclaration */: + case 144 /* PropertySignature */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: + case 148 /* Constructor */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: + case 151 /* CallSignature */: + case 152 /* ConstructSignature */: + case 153 /* IndexSignature */: + case 224 /* EnumDeclaration */: + case 256 /* SourceFile */: return node; } } } ts.getThisContainer = getThisContainer; - function getSuperContainer(node, includeFunctions) { + /** + * Given an super call\property node returns a closest node where either + * - super call\property 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. + * - node is arrow function (so caller might need to call getSuperContainer in case it needs to climb higher) + * - super call\property is definitely illegal in the node (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; - if (!node) + if (!node) { return node; + } switch (node.kind) { - case 136 /* ComputedPropertyName */: - // If the grandparent node is an object literal (as opposed to a class), - // then the computed property is not a 'super' container. - // A computed property name in a class needs to be a super container - // so that we can error on it. - if (isClassLike(node.parent.parent)) { - return node; - } - // If this is a computed property, then the parent should not - // make it a super 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 super container, the reference must be in - // the *body* of the container. + case 140 /* ComputedPropertyName */: node = node.parent; break; - case 139 /* Decorator */: + case 220 /* FunctionDeclaration */: + case 179 /* FunctionExpression */: + case 180 /* ArrowFunction */: + if (!stopOnFunctions) { + continue; + } + case 145 /* PropertyDeclaration */: + case 144 /* PropertySignature */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: + case 148 /* Constructor */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: + return node; + case 143 /* Decorator */: // Decorators are always applied outside of the body of a class or method. - if (node.parent.kind === 138 /* Parameter */ && isClassElement(node.parent.parent)) { + if (node.parent.kind === 142 /* Parameter */ && isClassElement(node.parent.parent)) { // If the decorator's parent is a Parameter, we resolve the this container from // the grandparent class declaration. node = node.parent.parent; @@ -4928,33 +5535,28 @@ var ts; node = node.parent; } break; - case 213 /* FunctionDeclaration */: - case 173 /* FunctionExpression */: - case 174 /* ArrowFunction */: - if (!includeFunctions) { - continue; - } - case 141 /* PropertyDeclaration */: - case 140 /* PropertySignature */: - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - case 144 /* Constructor */: - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: - return node; } } } ts.getSuperContainer = getSuperContainer; + /** + * Determines whether a node is a property or element access expression for super. + */ + function isSuperPropertyOrElementAccess(node) { + return (node.kind === 172 /* PropertyAccessExpression */ + || node.kind === 173 /* ElementAccessExpression */) + && node.expression.kind === 95 /* SuperKeyword */; + } + ts.isSuperPropertyOrElementAccess = isSuperPropertyOrElementAccess; function getEntityNameFromTypeNode(node) { if (node) { switch (node.kind) { - case 151 /* TypeReference */: + case 155 /* TypeReference */: return node.typeName; - case 188 /* ExpressionWithTypeArguments */: + case 194 /* ExpressionWithTypeArguments */: return node.expression; case 69 /* Identifier */: - case 135 /* QualifiedName */: + case 139 /* QualifiedName */: return node; } } @@ -4962,7 +5564,7 @@ var ts; } ts.getEntityNameFromTypeNode = getEntityNameFromTypeNode; function getInvokedExpression(node) { - if (node.kind === 170 /* TaggedTemplateExpression */) { + if (node.kind === 176 /* TaggedTemplateExpression */) { return node.tag; } // Will either be a CallExpression, NewExpression, or Decorator. @@ -4971,118 +5573,97 @@ var ts; ts.getInvokedExpression = getInvokedExpression; function nodeCanBeDecorated(node) { switch (node.kind) { - case 214 /* ClassDeclaration */: + case 221 /* ClassDeclaration */: // classes are valid targets return true; - case 141 /* PropertyDeclaration */: + case 145 /* PropertyDeclaration */: // property declarations are valid if their parent is a class declaration. - return node.parent.kind === 214 /* ClassDeclaration */; - case 138 /* Parameter */: - // if the parameter's parent has a body and its grandparent is a class declaration, this is a valid target; - return node.parent.body && node.parent.parent.kind === 214 /* ClassDeclaration */; - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: - case 143 /* MethodDeclaration */: + return node.parent.kind === 221 /* ClassDeclaration */; + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: + case 147 /* MethodDeclaration */: // if this method has a body and its parent is a class declaration, this is a valid target. - return node.body && node.parent.kind === 214 /* ClassDeclaration */; + return node.body !== undefined + && node.parent.kind === 221 /* ClassDeclaration */; + case 142 /* Parameter */: + // if the parameter's parent has a body and its grandparent is a class declaration, this is a valid target; + return node.parent.body !== undefined + && (node.parent.kind === 148 /* Constructor */ + || node.parent.kind === 147 /* MethodDeclaration */ + || node.parent.kind === 150 /* SetAccessor */) + && node.parent.parent.kind === 221 /* ClassDeclaration */; } return false; } ts.nodeCanBeDecorated = nodeCanBeDecorated; function nodeIsDecorated(node) { - switch (node.kind) { - case 214 /* ClassDeclaration */: - if (node.decorators) { - return true; - } - return false; - case 141 /* PropertyDeclaration */: - case 138 /* Parameter */: - if (node.decorators) { - return true; - } - return false; - case 145 /* GetAccessor */: - if (node.body && node.decorators) { - return true; - } - return false; - case 143 /* MethodDeclaration */: - case 146 /* SetAccessor */: - if (node.body && node.decorators) { - return true; - } - return false; - } - return false; + return node.decorators !== undefined + && nodeCanBeDecorated(node); } ts.nodeIsDecorated = nodeIsDecorated; - function childIsDecorated(node) { - switch (node.kind) { - case 214 /* ClassDeclaration */: - return ts.forEach(node.members, nodeOrChildIsDecorated); - case 143 /* MethodDeclaration */: - case 146 /* SetAccessor */: - return ts.forEach(node.parameters, nodeIsDecorated); - } - return false; - } - ts.childIsDecorated = childIsDecorated; - function nodeOrChildIsDecorated(node) { - return nodeIsDecorated(node) || childIsDecorated(node); - } - ts.nodeOrChildIsDecorated = nodeOrChildIsDecorated; function isPropertyAccessExpression(node) { - return node.kind === 166 /* PropertyAccessExpression */; + return node.kind === 172 /* PropertyAccessExpression */; } ts.isPropertyAccessExpression = isPropertyAccessExpression; function isElementAccessExpression(node) { - return node.kind === 167 /* ElementAccessExpression */; + return node.kind === 173 /* ElementAccessExpression */; } ts.isElementAccessExpression = isElementAccessExpression; + function isJSXTagName(node) { + var parent = node.parent; + if (parent.kind === 243 /* JsxOpeningElement */ || + parent.kind === 242 /* JsxSelfClosingElement */ || + parent.kind === 245 /* JsxClosingElement */) { + return parent.tagName === node; + } + return false; + } + ts.isJSXTagName = isJSXTagName; function isExpression(node) { switch (node.kind) { + case 97 /* ThisKeyword */: case 95 /* SuperKeyword */: case 93 /* NullKeyword */: case 99 /* TrueKeyword */: case 84 /* FalseKeyword */: case 10 /* RegularExpressionLiteral */: - case 164 /* ArrayLiteralExpression */: - case 165 /* ObjectLiteralExpression */: - case 166 /* PropertyAccessExpression */: - case 167 /* ElementAccessExpression */: - case 168 /* CallExpression */: - case 169 /* NewExpression */: - case 170 /* TaggedTemplateExpression */: - case 189 /* AsExpression */: - case 171 /* TypeAssertionExpression */: - case 172 /* ParenthesizedExpression */: - case 173 /* FunctionExpression */: - case 186 /* ClassExpression */: - case 174 /* ArrowFunction */: - case 177 /* VoidExpression */: - case 175 /* DeleteExpression */: - case 176 /* TypeOfExpression */: - case 179 /* PrefixUnaryExpression */: - case 180 /* PostfixUnaryExpression */: - case 181 /* BinaryExpression */: - case 182 /* ConditionalExpression */: - case 185 /* SpreadElementExpression */: - case 183 /* TemplateExpression */: + case 170 /* ArrayLiteralExpression */: + case 171 /* ObjectLiteralExpression */: + case 172 /* PropertyAccessExpression */: + case 173 /* ElementAccessExpression */: + case 174 /* CallExpression */: + case 175 /* NewExpression */: + case 176 /* TaggedTemplateExpression */: + case 195 /* AsExpression */: + case 177 /* TypeAssertionExpression */: + case 196 /* NonNullExpression */: + case 178 /* ParenthesizedExpression */: + case 179 /* FunctionExpression */: + case 192 /* ClassExpression */: + case 180 /* ArrowFunction */: + case 183 /* VoidExpression */: + case 181 /* DeleteExpression */: + case 182 /* TypeOfExpression */: + case 185 /* PrefixUnaryExpression */: + case 186 /* PostfixUnaryExpression */: + case 187 /* BinaryExpression */: + case 188 /* ConditionalExpression */: + case 191 /* SpreadElementExpression */: + case 189 /* TemplateExpression */: case 11 /* NoSubstitutionTemplateLiteral */: - case 187 /* OmittedExpression */: - case 233 /* JsxElement */: - case 234 /* JsxSelfClosingElement */: - case 184 /* YieldExpression */: - case 178 /* AwaitExpression */: + case 193 /* OmittedExpression */: + case 241 /* JsxElement */: + case 242 /* JsxSelfClosingElement */: + case 190 /* YieldExpression */: + case 184 /* AwaitExpression */: return true; - case 135 /* QualifiedName */: - while (node.parent.kind === 135 /* QualifiedName */) { + case 139 /* QualifiedName */: + while (node.parent.kind === 139 /* QualifiedName */) { node = node.parent; } - return node.parent.kind === 154 /* TypeQuery */; + return node.parent.kind === 158 /* TypeQuery */ || isJSXTagName(node); case 69 /* Identifier */: - if (node.parent.kind === 154 /* TypeQuery */) { + if (node.parent.kind === 158 /* TypeQuery */ || isJSXTagName(node)) { return true; } // fall through @@ -5091,47 +5672,47 @@ var ts; case 97 /* ThisKeyword */: var parent_2 = node.parent; switch (parent_2.kind) { - case 211 /* VariableDeclaration */: - case 138 /* Parameter */: - case 141 /* PropertyDeclaration */: - case 140 /* PropertySignature */: - case 247 /* EnumMember */: - case 245 /* PropertyAssignment */: - case 163 /* BindingElement */: + case 218 /* VariableDeclaration */: + case 142 /* Parameter */: + case 145 /* PropertyDeclaration */: + case 144 /* PropertySignature */: + case 255 /* EnumMember */: + case 253 /* PropertyAssignment */: + case 169 /* BindingElement */: return parent_2.initializer === node; - case 195 /* ExpressionStatement */: - case 196 /* IfStatement */: - case 197 /* DoStatement */: - case 198 /* WhileStatement */: - case 204 /* ReturnStatement */: - case 205 /* WithStatement */: - case 206 /* SwitchStatement */: - case 241 /* CaseClause */: - case 208 /* ThrowStatement */: - case 206 /* SwitchStatement */: + case 202 /* ExpressionStatement */: + case 203 /* IfStatement */: + case 204 /* DoStatement */: + case 205 /* WhileStatement */: + case 211 /* ReturnStatement */: + case 212 /* WithStatement */: + case 213 /* SwitchStatement */: + case 249 /* CaseClause */: + case 215 /* ThrowStatement */: + case 213 /* SwitchStatement */: return parent_2.expression === node; - case 199 /* ForStatement */: + case 206 /* ForStatement */: var forStatement = parent_2; - return (forStatement.initializer === node && forStatement.initializer.kind !== 212 /* VariableDeclarationList */) || + return (forStatement.initializer === node && forStatement.initializer.kind !== 219 /* VariableDeclarationList */) || forStatement.condition === node || forStatement.incrementor === node; - case 200 /* ForInStatement */: - case 201 /* ForOfStatement */: + case 207 /* ForInStatement */: + case 208 /* ForOfStatement */: var forInStatement = parent_2; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 212 /* VariableDeclarationList */) || + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 219 /* VariableDeclarationList */) || forInStatement.expression === node; - case 171 /* TypeAssertionExpression */: - case 189 /* AsExpression */: + case 177 /* TypeAssertionExpression */: + case 195 /* AsExpression */: return node === parent_2.expression; - case 190 /* TemplateSpan */: + case 197 /* TemplateSpan */: return node === parent_2.expression; - case 136 /* ComputedPropertyName */: + case 140 /* ComputedPropertyName */: return node === parent_2.expression; - case 139 /* Decorator */: - case 240 /* JsxExpression */: - case 239 /* JsxSpreadAttribute */: + case 143 /* Decorator */: + case 248 /* JsxExpression */: + case 247 /* JsxSpreadAttribute */: return true; - case 188 /* ExpressionWithTypeArguments */: + case 194 /* ExpressionWithTypeArguments */: return parent_2.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent_2); default: if (isExpression(parent_2)) { @@ -5155,7 +5736,7 @@ var ts; } ts.isInstantiatedModule = isInstantiatedModule; function isExternalModuleImportEqualsDeclaration(node) { - return node.kind === 221 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 232 /* ExternalModuleReference */; + return node.kind === 229 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 240 /* ExternalModuleReference */; } ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration; function getExternalModuleImportEqualsDeclarationExpression(node) { @@ -5164,7 +5745,7 @@ var ts; } ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression; function isInternalModuleImportEqualsDeclaration(node) { - return node.kind === 221 /* ImportEqualsDeclaration */ && node.moduleReference.kind !== 232 /* ExternalModuleReference */; + return node.kind === 229 /* ImportEqualsDeclaration */ && node.moduleReference.kind !== 240 /* ExternalModuleReference */; } ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration; function isSourceFileJavaScript(file) { @@ -5172,77 +5753,100 @@ var ts; } ts.isSourceFileJavaScript = isSourceFileJavaScript; function isInJavaScriptFile(node) { - return node && !!(node.parserContextFlags & 32 /* JavaScriptFile */); + return node && !!(node.flags & 134217728 /* JavaScriptFile */); } ts.isInJavaScriptFile = isInJavaScriptFile; /** * Returns true if the node is a CallExpression to the identifier 'require' with - * exactly one string literal argument. + * exactly one argument. * This function does not test if the node is in a JavaScript file or not. */ - function isRequireCall(expression) { + function isRequireCall(expression, checkArgumentIsStringLiteral) { // of the form 'require("name")' - return expression.kind === 168 /* CallExpression */ && + var isRequire = expression.kind === 174 /* CallExpression */ && expression.expression.kind === 69 /* Identifier */ && expression.expression.text === "require" && - expression.arguments.length === 1 && - expression.arguments[0].kind === 9 /* StringLiteral */; + expression.arguments.length === 1; + return isRequire && (!checkArgumentIsStringLiteral || expression.arguments[0].kind === 9 /* StringLiteral */); } ts.isRequireCall = isRequireCall; - /** - * Returns true if the node is an assignment to a property on the identifier 'exports'. - * This function does not test if the node is in a JavaScript file or not. - */ - function isExportsPropertyAssignment(expression) { - // of the form 'exports.name = expr' where 'name' and 'expr' are arbitrary - return isInJavaScriptFile(expression) && - (expression.kind === 181 /* BinaryExpression */) && - (expression.operatorToken.kind === 56 /* EqualsToken */) && - (expression.left.kind === 166 /* PropertyAccessExpression */) && - (expression.left.expression.kind === 69 /* Identifier */) && - ((expression.left.expression).text === "exports"); + function isSingleOrDoubleQuote(charCode) { + return charCode === 39 /* singleQuote */ || charCode === 34 /* doubleQuote */; } - ts.isExportsPropertyAssignment = isExportsPropertyAssignment; - /** - * Returns true if the node is an assignment to the property access expression 'module.exports'. - * This function does not test if the node is in a JavaScript file or not. - */ - function isModuleExportsAssignment(expression) { - // of the form 'module.exports = expr' where 'expr' is arbitrary - return isInJavaScriptFile(expression) && - (expression.kind === 181 /* BinaryExpression */) && - (expression.operatorToken.kind === 56 /* EqualsToken */) && - (expression.left.kind === 166 /* PropertyAccessExpression */) && - (expression.left.expression.kind === 69 /* Identifier */) && - ((expression.left.expression).text === "module") && - (expression.left.name.text === "exports"); + ts.isSingleOrDoubleQuote = isSingleOrDoubleQuote; + /// Given a BinaryExpression, returns SpecialPropertyAssignmentKind for the various kinds of property + /// assignments we treat as special in the binder + function getSpecialPropertyAssignmentKind(expression) { + if (!isInJavaScriptFile(expression)) { + return 0 /* None */; + } + if (expression.kind !== 187 /* BinaryExpression */) { + return 0 /* None */; + } + var expr = expression; + if (expr.operatorToken.kind !== 56 /* EqualsToken */ || expr.left.kind !== 172 /* PropertyAccessExpression */) { + return 0 /* None */; + } + var lhs = expr.left; + if (lhs.expression.kind === 69 /* Identifier */) { + var lhsId = lhs.expression; + if (lhsId.text === "exports") { + // exports.name = expr + return 1 /* ExportsProperty */; + } + else if (lhsId.text === "module" && lhs.name.text === "exports") { + // module.exports = expr + return 2 /* ModuleExports */; + } + } + else if (lhs.expression.kind === 97 /* ThisKeyword */) { + return 4 /* ThisProperty */; + } + else if (lhs.expression.kind === 172 /* PropertyAccessExpression */) { + // chained dot, e.g. x.y.z = expr; this var is the 'x.y' part + var innerPropertyAccess = lhs.expression; + if (innerPropertyAccess.expression.kind === 69 /* Identifier */) { + // module.exports.name = expr + var innerPropertyAccessIdentifier = innerPropertyAccess.expression; + if (innerPropertyAccessIdentifier.text === "module" && innerPropertyAccess.name.text === "exports") { + return 1 /* ExportsProperty */; + } + if (innerPropertyAccess.name.text === "prototype") { + return 3 /* PrototypeProperty */; + } + } + } + return 0 /* None */; } - ts.isModuleExportsAssignment = isModuleExportsAssignment; + ts.getSpecialPropertyAssignmentKind = getSpecialPropertyAssignmentKind; function getExternalModuleName(node) { - if (node.kind === 222 /* ImportDeclaration */) { + if (node.kind === 230 /* ImportDeclaration */) { return node.moduleSpecifier; } - if (node.kind === 221 /* ImportEqualsDeclaration */) { + if (node.kind === 229 /* ImportEqualsDeclaration */) { var reference = node.moduleReference; - if (reference.kind === 232 /* ExternalModuleReference */) { + if (reference.kind === 240 /* ExternalModuleReference */) { return reference.expression; } } - if (node.kind === 228 /* ExportDeclaration */) { + if (node.kind === 236 /* ExportDeclaration */) { return node.moduleSpecifier; } + if (node.kind === 225 /* ModuleDeclaration */ && node.name.kind === 9 /* StringLiteral */) { + return node.name; + } } ts.getExternalModuleName = getExternalModuleName; function hasQuestionToken(node) { if (node) { switch (node.kind) { - case 138 /* Parameter */: - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - case 246 /* ShorthandPropertyAssignment */: - case 245 /* PropertyAssignment */: - case 141 /* PropertyDeclaration */: - case 140 /* PropertySignature */: + case 142 /* Parameter */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: + case 254 /* ShorthandPropertyAssignment */: + case 253 /* PropertyAssignment */: + case 145 /* PropertyDeclaration */: + case 144 /* PropertySignature */: return node.questionToken !== undefined; } } @@ -5250,31 +5854,70 @@ var ts; } ts.hasQuestionToken = hasQuestionToken; function isJSDocConstructSignature(node) { - return node.kind === 261 /* JSDocFunctionType */ && + return node.kind === 269 /* JSDocFunctionType */ && node.parameters.length > 0 && - node.parameters[0].type.kind === 263 /* JSDocConstructorType */; + node.parameters[0].type.kind === 271 /* JSDocConstructorType */; } ts.isJSDocConstructSignature = isJSDocConstructSignature; - function getJSDocTag(node, kind) { - if (node && node.jsDocComment) { - for (var _i = 0, _a = node.jsDocComment.tags; _i < _a.length; _i++) { - var tag = _a[_i]; - if (tag.kind === kind) { - return tag; - } + function getJSDocTag(node, kind, checkParentVariableStatement) { + if (!node) { + return undefined; + } + var jsDocComment = getJSDocComment(node, checkParentVariableStatement); + if (!jsDocComment) { + return undefined; + } + for (var _i = 0, _a = jsDocComment.tags; _i < _a.length; _i++) { + var tag = _a[_i]; + if (tag.kind === kind) { + return tag; } } } + function getJSDocComment(node, checkParentVariableStatement) { + if (node.jsDocComment) { + return node.jsDocComment; + } + // 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 (checkParentVariableStatement) { + var isInitializerOfVariableDeclarationInStatement = node.parent.kind === 218 /* VariableDeclaration */ && + node.parent.initializer === node && + node.parent.parent.parent.kind === 200 /* VariableStatement */; + var variableStatementNode = isInitializerOfVariableDeclarationInStatement ? node.parent.parent.parent : undefined; + if (variableStatementNode) { + return variableStatementNode.jsDocComment; + } + // Also recognize when the node is the RHS of an assignment expression + var parent_3 = node.parent; + var isSourceOfAssignmentExpressionStatement = parent_3 && parent_3.parent && + parent_3.kind === 187 /* BinaryExpression */ && + parent_3.operatorToken.kind === 56 /* EqualsToken */ && + parent_3.parent.kind === 202 /* ExpressionStatement */; + if (isSourceOfAssignmentExpressionStatement) { + return parent_3.parent.jsDocComment; + } + var isPropertyAssignmentExpression = parent_3 && parent_3.kind === 253 /* PropertyAssignment */; + if (isPropertyAssignmentExpression) { + return parent_3.jsDocComment; + } + } + return undefined; + } function getJSDocTypeTag(node) { - return getJSDocTag(node, 269 /* JSDocTypeTag */); + return getJSDocTag(node, 277 /* JSDocTypeTag */, /*checkParentVariableStatement*/ false); } ts.getJSDocTypeTag = getJSDocTypeTag; function getJSDocReturnTag(node) { - return getJSDocTag(node, 268 /* JSDocReturnTag */); + return getJSDocTag(node, 276 /* JSDocReturnTag */, /*checkParentVariableStatement*/ true); } ts.getJSDocReturnTag = getJSDocReturnTag; function getJSDocTemplateTag(node) { - return getJSDocTag(node, 270 /* JSDocTemplateTag */); + return getJSDocTag(node, 278 /* JSDocTemplateTag */, /*checkParentVariableStatement*/ false); } ts.getJSDocTemplateTag = getJSDocTemplateTag; function getCorrespondingJSDocParameterTag(parameter) { @@ -5282,41 +5925,48 @@ var ts; // If it's a parameter, see if the parent has a jsdoc comment with an @param // annotation. var parameterName = parameter.name.text; - var docComment = parameter.parent.jsDocComment; - if (docComment) { - return ts.forEach(docComment.tags, function (t) { - if (t.kind === 267 /* JSDocParameterTag */) { - var parameterTag = t; + var jsDocComment = getJSDocComment(parameter.parent, /*checkParentVariableStatement*/ true); + if (jsDocComment) { + for (var _i = 0, _a = jsDocComment.tags; _i < _a.length; _i++) { + var tag = _a[_i]; + if (tag.kind === 275 /* JSDocParameterTag */) { + var parameterTag = tag; var name_6 = parameterTag.preParameterName || parameterTag.postParameterName; if (name_6.text === parameterName) { - return t; + return parameterTag; } } - }); + } } } + return undefined; } ts.getCorrespondingJSDocParameterTag = getCorrespondingJSDocParameterTag; function hasRestParameter(s) { return isRestParameter(ts.lastOrUndefined(s.parameters)); } ts.hasRestParameter = hasRestParameter; + function hasDeclaredRestParameter(s) { + return isDeclaredRestParam(ts.lastOrUndefined(s.parameters)); + } + ts.hasDeclaredRestParameter = hasDeclaredRestParameter; function isRestParameter(node) { - if (node) { - if (node.parserContextFlags & 32 /* JavaScriptFile */) { - if (node.type && node.type.kind === 262 /* JSDocVariadicType */) { - return true; - } - var paramTag = getCorrespondingJSDocParameterTag(node); - if (paramTag && paramTag.typeExpression) { - return paramTag.typeExpression.type.kind === 262 /* JSDocVariadicType */; - } + if (node && (node.flags & 134217728 /* JavaScriptFile */)) { + if (node.type && node.type.kind === 270 /* JSDocVariadicType */) { + return true; + } + var paramTag = getCorrespondingJSDocParameterTag(node); + if (paramTag && paramTag.typeExpression) { + return paramTag.typeExpression.type.kind === 270 /* JSDocVariadicType */; } - return node.dotDotDotToken !== undefined; } - return false; + return isDeclaredRestParam(node); } ts.isRestParameter = isRestParameter; + function isDeclaredRestParam(node) { + return node && node.dotDotDotToken !== undefined; + } + ts.isDeclaredRestParam = isDeclaredRestParam; function isLiteralKind(kind) { return 8 /* FirstLiteralToken */ <= kind && kind <= 11 /* LastLiteralToken */; } @@ -5330,9 +5980,34 @@ var ts; } ts.isTemplateLiteralKind = isTemplateLiteralKind; function isBindingPattern(node) { - return !!node && (node.kind === 162 /* ArrayBindingPattern */ || node.kind === 161 /* ObjectBindingPattern */); + return !!node && (node.kind === 168 /* ArrayBindingPattern */ || node.kind === 167 /* ObjectBindingPattern */); } ts.isBindingPattern = isBindingPattern; + // 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', '[{ p: a}] = xxx'. + function isAssignmentTarget(node) { + while (node.parent.kind === 178 /* ParenthesizedExpression */) { + node = node.parent; + } + while (true) { + var parent_4 = node.parent; + if (parent_4.kind === 170 /* ArrayLiteralExpression */ || parent_4.kind === 191 /* SpreadElementExpression */) { + node = parent_4; + continue; + } + if (parent_4.kind === 253 /* PropertyAssignment */ || parent_4.kind === 254 /* ShorthandPropertyAssignment */) { + node = parent_4.parent; + continue; + } + return parent_4.kind === 187 /* BinaryExpression */ && + parent_4.operatorToken.kind === 56 /* EqualsToken */ && + parent_4.left === node || + (parent_4.kind === 207 /* ForInStatement */ || parent_4.kind === 208 /* ForOfStatement */) && + parent_4.initializer === node; + } + } + ts.isAssignmentTarget = isAssignmentTarget; function isNodeDescendentOf(node, ancestor) { while (node) { if (node === ancestor) @@ -5344,7 +6019,7 @@ var ts; ts.isNodeDescendentOf = isNodeDescendentOf; function isInAmbientContext(node) { while (node) { - if (node.flags & (4 /* Ambient */ | 4096 /* DeclarationFile */)) { + if (node.flags & 2 /* Ambient */ || (node.kind === 256 /* SourceFile */ && node.isDeclarationFile)) { return true; } node = node.parent; @@ -5354,34 +6029,34 @@ var ts; ts.isInAmbientContext = isInAmbientContext; function isDeclaration(node) { switch (node.kind) { - case 174 /* ArrowFunction */: - case 163 /* BindingElement */: - case 214 /* ClassDeclaration */: - case 186 /* ClassExpression */: - case 144 /* Constructor */: - case 217 /* EnumDeclaration */: - case 247 /* EnumMember */: - case 230 /* ExportSpecifier */: - case 213 /* FunctionDeclaration */: - case 173 /* FunctionExpression */: - case 145 /* GetAccessor */: - case 223 /* ImportClause */: - case 221 /* ImportEqualsDeclaration */: - case 226 /* ImportSpecifier */: - case 215 /* InterfaceDeclaration */: - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - case 218 /* ModuleDeclaration */: - case 224 /* NamespaceImport */: - case 138 /* Parameter */: - case 245 /* PropertyAssignment */: - case 141 /* PropertyDeclaration */: - case 140 /* PropertySignature */: - case 146 /* SetAccessor */: - case 246 /* ShorthandPropertyAssignment */: - case 216 /* TypeAliasDeclaration */: - case 137 /* TypeParameter */: - case 211 /* VariableDeclaration */: + case 180 /* ArrowFunction */: + case 169 /* BindingElement */: + case 221 /* ClassDeclaration */: + case 192 /* ClassExpression */: + case 148 /* Constructor */: + case 224 /* EnumDeclaration */: + case 255 /* EnumMember */: + case 238 /* ExportSpecifier */: + case 220 /* FunctionDeclaration */: + case 179 /* FunctionExpression */: + case 149 /* GetAccessor */: + case 231 /* ImportClause */: + case 229 /* ImportEqualsDeclaration */: + case 234 /* ImportSpecifier */: + case 222 /* InterfaceDeclaration */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: + case 225 /* ModuleDeclaration */: + case 232 /* NamespaceImport */: + case 142 /* Parameter */: + case 253 /* PropertyAssignment */: + case 145 /* PropertyDeclaration */: + case 144 /* PropertySignature */: + case 150 /* SetAccessor */: + case 254 /* ShorthandPropertyAssignment */: + case 223 /* TypeAliasDeclaration */: + case 141 /* TypeParameter */: + case 218 /* VariableDeclaration */: return true; } return false; @@ -5389,25 +6064,25 @@ var ts; ts.isDeclaration = isDeclaration; function isStatement(n) { switch (n.kind) { - case 203 /* BreakStatement */: - case 202 /* ContinueStatement */: - case 210 /* DebuggerStatement */: - case 197 /* DoStatement */: - case 195 /* ExpressionStatement */: - case 194 /* EmptyStatement */: - case 200 /* ForInStatement */: - case 201 /* ForOfStatement */: - case 199 /* ForStatement */: - case 196 /* IfStatement */: - case 207 /* LabeledStatement */: - case 204 /* ReturnStatement */: - case 206 /* SwitchStatement */: - case 208 /* ThrowStatement */: - case 209 /* TryStatement */: - case 193 /* VariableStatement */: - case 198 /* WhileStatement */: - case 205 /* WithStatement */: - case 227 /* ExportAssignment */: + case 210 /* BreakStatement */: + case 209 /* ContinueStatement */: + case 217 /* DebuggerStatement */: + case 204 /* DoStatement */: + case 202 /* ExpressionStatement */: + case 201 /* EmptyStatement */: + case 207 /* ForInStatement */: + case 208 /* ForOfStatement */: + case 206 /* ForStatement */: + case 203 /* IfStatement */: + case 214 /* LabeledStatement */: + case 211 /* ReturnStatement */: + case 213 /* SwitchStatement */: + case 215 /* ThrowStatement */: + case 216 /* TryStatement */: + case 200 /* VariableStatement */: + case 205 /* WhileStatement */: + case 212 /* WithStatement */: + case 235 /* ExportAssignment */: return true; default: return false; @@ -5416,13 +6091,13 @@ var ts; ts.isStatement = isStatement; function isClassElement(n) { switch (n.kind) { - case 144 /* Constructor */: - case 141 /* PropertyDeclaration */: - case 143 /* MethodDeclaration */: - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: - case 142 /* MethodSignature */: - case 149 /* IndexSignature */: + case 148 /* Constructor */: + case 145 /* PropertyDeclaration */: + case 147 /* MethodDeclaration */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: + case 146 /* MethodSignature */: + case 153 /* IndexSignature */: return true; default: return false; @@ -5435,7 +6110,7 @@ var ts; return false; } var parent = name.parent; - if (parent.kind === 226 /* ImportSpecifier */ || parent.kind === 230 /* ExportSpecifier */) { + if (parent.kind === 234 /* ImportSpecifier */ || parent.kind === 238 /* ExportSpecifier */) { if (parent.propertyName) { return true; } @@ -5446,35 +6121,41 @@ var ts; return false; } ts.isDeclarationName = isDeclarationName; + function isLiteralComputedPropertyDeclarationName(node) { + return (node.kind === 9 /* StringLiteral */ || node.kind === 8 /* NumericLiteral */) && + node.parent.kind === 140 /* ComputedPropertyName */ && + 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 141 /* PropertyDeclaration */: - case 140 /* PropertySignature */: - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: - case 247 /* EnumMember */: - case 245 /* PropertyAssignment */: - case 166 /* PropertyAccessExpression */: + case 145 /* PropertyDeclaration */: + case 144 /* PropertySignature */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: + case 255 /* EnumMember */: + case 253 /* PropertyAssignment */: + case 172 /* PropertyAccessExpression */: // Name in member declaration or property name in property access return parent.name === node; - case 135 /* QualifiedName */: + case 139 /* QualifiedName */: // Name on right hand side of dot in a type query if (parent.right === node) { - while (parent.kind === 135 /* QualifiedName */) { + while (parent.kind === 139 /* QualifiedName */) { parent = parent.parent; } - return parent.kind === 154 /* TypeQuery */; + return parent.kind === 158 /* TypeQuery */; } return false; - case 163 /* BindingElement */: - case 226 /* ImportSpecifier */: + case 169 /* BindingElement */: + case 234 /* ImportSpecifier */: // Property name in binding element or import specifier return parent.propertyName === node; - case 230 /* ExportSpecifier */: + case 238 /* ExportSpecifier */: // Any name in an export specifier return true; } @@ -5490,12 +6171,13 @@ var ts; // export = ... // export default ... function isAliasSymbolDeclaration(node) { - return node.kind === 221 /* ImportEqualsDeclaration */ || - node.kind === 223 /* ImportClause */ && !!node.name || - node.kind === 224 /* NamespaceImport */ || - node.kind === 226 /* ImportSpecifier */ || - node.kind === 230 /* ExportSpecifier */ || - node.kind === 227 /* ExportAssignment */ && node.expression.kind === 69 /* Identifier */; + return node.kind === 229 /* ImportEqualsDeclaration */ || + node.kind === 228 /* GlobalModuleExportDeclaration */ || + node.kind === 231 /* ImportClause */ && !!node.name || + node.kind === 232 /* NamespaceImport */ || + node.kind === 234 /* ImportSpecifier */ || + node.kind === 238 /* ExportSpecifier */ || + node.kind === 235 /* ExportAssignment */ && node.expression.kind === 69 /* Identifier */; } ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration; function getClassExtendsHeritageClauseElement(node) { @@ -5552,32 +6234,32 @@ var ts; }; } else { - var matchResult = ts.fullTripleSlashReferencePathRegEx.exec(comment); - if (matchResult) { + var refMatchResult = ts.fullTripleSlashReferencePathRegEx.exec(comment); + var refLibResult = !refMatchResult && ts.fullTripleSlashReferenceTypeReferenceDirectiveRegEx.exec(comment); + if (refMatchResult || refLibResult) { var start = commentRange.pos; var end = commentRange.end; return { fileReference: { pos: start, end: end, - fileName: matchResult[3] + fileName: (refMatchResult || refLibResult)[3] }, - isNoDefaultLib: false - }; - } - else { - return { - diagnosticMessage: ts.Diagnostics.Invalid_reference_directive_syntax, - isNoDefaultLib: false + isNoDefaultLib: false, + isTypeReferenceDirective: !!refLibResult }; } + return { + diagnosticMessage: ts.Diagnostics.Invalid_reference_directive_syntax, + isNoDefaultLib: false + }; } } return undefined; } ts.getFileReferenceFromReferencePath = getFileReferenceFromReferencePath; function isKeyword(token) { - return 70 /* FirstKeyword */ <= token && token <= 134 /* LastKeyword */; + return 70 /* FirstKeyword */ <= token && token <= 138 /* LastKeyword */; } ts.isKeyword = isKeyword; function isTrivia(token) { @@ -5604,7 +6286,7 @@ var ts; } ts.hasDynamicName = hasDynamicName; function isDynamicName(name) { - return name.kind === 136 /* ComputedPropertyName */ && + return name.kind === 140 /* ComputedPropertyName */ && !isStringOrNumericLiteral(name.expression.kind) && !isWellKnownSymbolSyntactically(name.expression); } @@ -5622,12 +6304,15 @@ var ts; if (name.kind === 69 /* Identifier */ || name.kind === 9 /* StringLiteral */ || name.kind === 8 /* NumericLiteral */) { return name.text; } - if (name.kind === 136 /* ComputedPropertyName */) { + if (name.kind === 140 /* ComputedPropertyName */) { var nameExpression = name.expression; if (isWellKnownSymbolSyntactically(nameExpression)) { var rightHandSideName = nameExpression.name.text; return getPropertyNameForKnownSymbolName(rightHandSideName); } + else if (nameExpression.kind === 9 /* StringLiteral */ || nameExpression.kind === 8 /* NumericLiteral */) { + return nameExpression.text; + } } return undefined; } @@ -5643,7 +6328,7 @@ var ts; return node.kind === 69 /* Identifier */ && node.text === "Symbol"; } ts.isESSymbolIdentifier = isESSymbolIdentifier; - function isModifier(token) { + function isModifierKind(token) { switch (token) { case 115 /* AbstractKeyword */: case 118 /* AsyncKeyword */: @@ -5654,44 +6339,79 @@ var ts; case 112 /* PublicKeyword */: case 110 /* PrivateKeyword */: case 111 /* ProtectedKeyword */: + case 128 /* ReadonlyKeyword */: case 113 /* StaticKeyword */: return true; } return false; } - ts.isModifier = isModifier; + ts.isModifierKind = isModifierKind; function isParameterDeclaration(node) { var root = getRootDeclaration(node); - return root.kind === 138 /* Parameter */; + return root.kind === 142 /* Parameter */; } ts.isParameterDeclaration = isParameterDeclaration; function getRootDeclaration(node) { - while (node.kind === 163 /* BindingElement */) { + while (node.kind === 169 /* BindingElement */) { node = node.parent.parent; } return node; } ts.getRootDeclaration = getRootDeclaration; function nodeStartsNewLexicalEnvironment(n) { - return isFunctionLike(n) || n.kind === 218 /* ModuleDeclaration */ || n.kind === 248 /* SourceFile */; + return isFunctionLike(n) || n.kind === 225 /* ModuleDeclaration */ || n.kind === 256 /* SourceFile */; } ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; - function cloneEntityName(node) { - if (node.kind === 69 /* Identifier */) { - var clone_1 = createSynthesizedNode(69 /* Identifier */); - clone_1.text = node.text; - return clone_1; + /** + * Creates a shallow, memberwise clone of a node. The "kind", "pos", "end", "flags", and "parent" + * properties are excluded by default, and can be provided via the "location", "flags", and + * "parent" parameters. + * @param node The node to clone. + * @param location An optional TextRange to use to supply the new position. + * @param flags The NodeFlags to use for the cloned node. + * @param parent The parent for the new node. + */ + function cloneNode(node, location, flags, parent) { + // We don't use "clone" from core.ts here, as we need to preserve the prototype chain of + // the original node. We also need to exclude specific properties and only include own- + // properties (to skip members already defined on the shared prototype). + var clone = location !== undefined + ? ts.createNode(node.kind, location.pos, location.end) + : createSynthesizedNode(node.kind); + for (var key in node) { + if (clone.hasOwnProperty(key) || !node.hasOwnProperty(key)) { + continue; + } + clone[key] = node[key]; } - else { - var clone_2 = createSynthesizedNode(135 /* QualifiedName */); - clone_2.left = cloneEntityName(node.left); - clone_2.left.parent = clone_2; - clone_2.right = cloneEntityName(node.right); - clone_2.right.parent = clone_2; - return clone_2; + if (flags !== undefined) { + clone.flags = flags; } + if (parent !== undefined) { + clone.parent = parent; + } + return clone; + } + ts.cloneNode = cloneNode; + /** + * Creates a deep clone of an EntityName, with new parent pointers. + * @param node The EntityName to clone. + * @param parent The parent for the cloned node. + */ + function cloneEntityName(node, parent) { + var clone = cloneNode(node, node, node.flags, parent); + if (isQualifiedName(clone)) { + var left = clone.left, right = clone.right; + clone.left = cloneEntityName(left, clone); + clone.right = cloneNode(right, right, right.flags, parent); + } + return clone; } ts.cloneEntityName = cloneEntityName; + function isQualifiedName(node) { + return node.kind === 139 /* QualifiedName */; + } + ts.isQualifiedName = isQualifiedName; function nodeIsSynthesized(node) { return node.pos === -1; } @@ -5906,8 +6626,8 @@ var ts; writeTextOfNode: writeTextOfNode, writeLiteral: writeLiteral, writeLine: writeLine, - increaseIndent: function () { return indent++; }, - decreaseIndent: function () { return indent--; }, + increaseIndent: function () { indent++; }, + decreaseIndent: function () { indent--; }, getIndent: function () { return indent; }, getTextPos: function () { return output.length; }, getLine: function () { return lineCount + 1; }, @@ -5921,8 +6641,10 @@ var ts; * Resolves a local path to a path which is absolute to the base of the emit */ function getExternalModuleNameFromPath(host, fileName) { - var dir = host.getCurrentDirectory(); - var relativePath = ts.getRelativePathToDirectoryOrUrl(dir, fileName, dir, function (f) { return host.getCanonicalFileName(f); }, /*isAbsolutePathAnUrl*/ false); + var getCanonicalFileName = function (f) { return host.getCanonicalFileName(f); }; + var dir = ts.toPath(host.getCommonSourceDirectory(), host.getCurrentDirectory(), getCanonicalFileName); + var filePath = ts.getNormalizedAbsolutePath(fileName, host.getCurrentDirectory()); + var relativePath = ts.getRelativePathToDirectoryOrUrl(dir, filePath, dir, getCanonicalFileName, /*isAbsolutePathAnUrl*/ false); return ts.removeFileExtension(relativePath); } ts.getExternalModuleNameFromPath = getExternalModuleNameFromPath; @@ -5938,16 +6660,97 @@ var ts; return emitOutputFilePathWithoutExtension + extension; } ts.getOwnEmitOutputFilePath = getOwnEmitOutputFilePath; + function getDeclarationEmitOutputFilePath(sourceFile, host) { + var options = host.getCompilerOptions(); + var outputDir = options.declarationDir || options.outDir; // Prefer declaration folder if specified + if (options.declaration) { + var path = outputDir + ? getSourceFilePathInNewDir(sourceFile, host, outputDir) + : sourceFile.fileName; + return ts.removeFileExtension(path) + ".d.ts"; + } + } + ts.getDeclarationEmitOutputFilePath = getDeclarationEmitOutputFilePath; + function getEmitScriptTarget(compilerOptions) { + return compilerOptions.target || 0 /* ES3 */; + } + ts.getEmitScriptTarget = getEmitScriptTarget; + function getEmitModuleKind(compilerOptions) { + return typeof compilerOptions.module === "number" ? + compilerOptions.module : + getEmitScriptTarget(compilerOptions) === 2 /* ES6 */ ? ts.ModuleKind.ES6 : ts.ModuleKind.CommonJS; + } + ts.getEmitModuleKind = getEmitModuleKind; + function forEachExpectedEmitFile(host, action, targetSourceFile) { + var options = host.getCompilerOptions(); + // Emit on each source file + if (options.outFile || options.out) { + onBundledEmit(host); + } + else { + var sourceFiles = targetSourceFile === undefined ? host.getSourceFiles() : [targetSourceFile]; + for (var _i = 0, sourceFiles_1 = sourceFiles; _i < sourceFiles_1.length; _i++) { + var sourceFile = sourceFiles_1[_i]; + if (!isDeclarationFile(sourceFile)) { + onSingleFileEmit(host, sourceFile); + } + } + } + function onSingleFileEmit(host, sourceFile) { + // JavaScript files are always LanguageVariant.JSX, as JSX syntax is allowed in .js files also. + // So for JavaScript files, '.jsx' is only emitted if the input was '.jsx', and JsxEmit.Preserve. + // For TypeScript, the only time to emit with a '.jsx' extension, is on JSX input, and JsxEmit.Preserve + var extension = ".js"; + if (options.jsx === 1 /* Preserve */) { + if (isSourceFileJavaScript(sourceFile)) { + if (ts.fileExtensionIs(sourceFile.fileName, ".jsx")) { + extension = ".jsx"; + } + } + else if (sourceFile.languageVariant === 1 /* JSX */) { + // TypeScript source file preserving JSX syntax + extension = ".jsx"; + } + } + var jsFilePath = getOwnEmitOutputFilePath(sourceFile, host, extension); + var emitFileNames = { + jsFilePath: jsFilePath, + sourceMapFilePath: getSourceMapFilePath(jsFilePath, options), + declarationFilePath: !isSourceFileJavaScript(sourceFile) ? getDeclarationEmitOutputFilePath(sourceFile, host) : undefined + }; + action(emitFileNames, [sourceFile], /*isBundledEmit*/ false); + } + function onBundledEmit(host) { + // Can emit only sources that are not declaration file and are either non module code or module with --module or --target es6 specified + var bundledSources = ts.filter(host.getSourceFiles(), function (sourceFile) { + return !isDeclarationFile(sourceFile) // Not a declaration file + && (!ts.isExternalModule(sourceFile) || !!getEmitModuleKind(options)); + }); // and not a module, unless module emit enabled + if (bundledSources.length) { + var jsFilePath = options.outFile || options.out; + var emitFileNames = { + jsFilePath: jsFilePath, + sourceMapFilePath: getSourceMapFilePath(jsFilePath, options), + declarationFilePath: options.declaration ? ts.removeFileExtension(jsFilePath) + ".d.ts" : undefined + }; + action(emitFileNames, bundledSources, /*isBundledEmit*/ true); + } + } + function getSourceMapFilePath(jsFilePath, options) { + return options.sourceMap ? jsFilePath + ".map" : undefined; + } + } + ts.forEachExpectedEmitFile = forEachExpectedEmitFile; function getSourceFilePathInNewDir(sourceFile, host, newDirPath) { var sourceFilePath = ts.getNormalizedAbsolutePath(sourceFile.fileName, host.getCurrentDirectory()); sourceFilePath = sourceFilePath.replace(host.getCommonSourceDirectory(), ""); return ts.combinePaths(newDirPath, sourceFilePath); } ts.getSourceFilePathInNewDir = getSourceFilePathInNewDir; - function writeFile(host, diagnostics, fileName, data, writeByteOrderMark) { + function writeFile(host, diagnostics, fileName, data, writeByteOrderMark, sourceFiles) { host.writeFile(fileName, data, writeByteOrderMark, function (hostErrorMessage) { - diagnostics.push(ts.createCompilerDiagnostic(ts.Diagnostics.Could_not_write_file_0_Colon_1, fileName, hostErrorMessage)); - }); + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Could_not_write_file_0_Colon_1, fileName, hostErrorMessage)); + }, sourceFiles); } ts.writeFile = writeFile; function getLineOfLocalPosition(currentSourceFile, pos) { @@ -5960,28 +6763,21 @@ var ts; ts.getLineOfLocalPositionFromLineMap = getLineOfLocalPositionFromLineMap; function getFirstConstructorWithBody(node) { return ts.forEach(node.members, function (member) { - if (member.kind === 144 /* Constructor */ && nodeIsPresent(member.body)) { + if (member.kind === 148 /* Constructor */ && nodeIsPresent(member.body)) { return member; } }); } ts.getFirstConstructorWithBody = getFirstConstructorWithBody; function getSetAccessorTypeAnnotationNode(accessor) { - return accessor && accessor.parameters.length > 0 && accessor.parameters[0].type; + if (accessor && accessor.parameters.length > 0) { + var hasThis = accessor.parameters.length === 2 && + accessor.parameters[0].name.kind === 69 /* Identifier */ && + accessor.parameters[0].name.originalKeywordKind === 97 /* ThisKeyword */; + return accessor.parameters[hasThis ? 1 : 0].type; + } } ts.getSetAccessorTypeAnnotationNode = getSetAccessorTypeAnnotationNode; - function shouldEmitToOwnFile(sourceFile, compilerOptions) { - if (!isDeclarationFile(sourceFile)) { - if ((isExternalModule(sourceFile) || !(compilerOptions.outFile || compilerOptions.out))) { - // 1. in-browser single file compilation scenario - // 2. non .js file - return compilerOptions.isolatedModules || !ts.fileExtensionIs(sourceFile.fileName, ".js"); - } - return false; - } - return false; - } - ts.shouldEmitToOwnFile = shouldEmitToOwnFile; function getAllAccessorDeclarations(declarations, accessor) { var firstAccessor; var secondAccessor; @@ -5989,10 +6785,10 @@ var ts; var setAccessor; if (hasDynamicName(accessor)) { firstAccessor = accessor; - if (accessor.kind === 145 /* GetAccessor */) { + if (accessor.kind === 149 /* GetAccessor */) { getAccessor = accessor; } - else if (accessor.kind === 146 /* SetAccessor */) { + else if (accessor.kind === 150 /* SetAccessor */) { setAccessor = accessor; } else { @@ -6001,8 +6797,8 @@ var ts; } else { ts.forEach(declarations, function (member) { - if ((member.kind === 145 /* GetAccessor */ || member.kind === 146 /* SetAccessor */) - && (member.flags & 64 /* Static */) === (accessor.flags & 64 /* Static */)) { + if ((member.kind === 149 /* GetAccessor */ || member.kind === 150 /* SetAccessor */) + && (member.flags & 32 /* Static */) === (accessor.flags & 32 /* Static */)) { var memberName = getPropertyNameForPropertyNameNode(member.name); var accessorName = getPropertyNameForPropertyNameNode(accessor.name); if (memberName === accessorName) { @@ -6012,10 +6808,10 @@ var ts; else if (!secondAccessor) { secondAccessor = member; } - if (member.kind === 145 /* GetAccessor */ && !getAccessor) { + if (member.kind === 149 /* GetAccessor */ && !getAccessor) { getAccessor = member; } - if (member.kind === 146 /* SetAccessor */ && !setAccessor) { + if (member.kind === 150 /* SetAccessor */ && !setAccessor) { setAccessor = member; } } @@ -6082,7 +6878,7 @@ var ts; } if (leadingComments) { var detachedComments = []; - var lastComment; + var lastComment = void 0; for (var _i = 0, leadingComments_1 = leadingComments; _i < leadingComments_1.length; _i++) { var comment = leadingComments_1[_i]; if (lastComment) { @@ -6123,7 +6919,7 @@ var ts; if (text.charCodeAt(comment.pos + 1) === 42 /* asterisk */) { var firstCommentLineAndCharacter = ts.computeLineAndCharacterOfPosition(lineMap, comment.pos); var lineCount = lineMap.length; - var firstCommentLineIndent; + var firstCommentLineIndent = void 0; for (var pos = comment.pos, currentLine = firstCommentLineAndCharacter.line; pos < comment.end; currentLine++) { var nextLineStart = (currentLine + 1) === lineCount ? text.length + 1 @@ -6208,16 +7004,17 @@ var ts; } function modifierToFlag(token) { switch (token) { - case 113 /* StaticKeyword */: return 64 /* Static */; - case 112 /* PublicKeyword */: return 8 /* Public */; - case 111 /* ProtectedKeyword */: return 32 /* Protected */; - case 110 /* PrivateKeyword */: return 16 /* Private */; + case 113 /* StaticKeyword */: return 32 /* Static */; + case 112 /* PublicKeyword */: return 4 /* Public */; + case 111 /* ProtectedKeyword */: return 16 /* Protected */; + case 110 /* PrivateKeyword */: return 8 /* Private */; case 115 /* AbstractKeyword */: return 128 /* Abstract */; - case 82 /* ExportKeyword */: return 2 /* Export */; - case 122 /* DeclareKeyword */: return 4 /* Ambient */; - case 74 /* ConstKeyword */: return 16384 /* Const */; + case 82 /* ExportKeyword */: return 1 /* Export */; + case 122 /* DeclareKeyword */: return 2 /* Ambient */; + case 74 /* ConstKeyword */: return 2048 /* Const */; case 77 /* DefaultKeyword */: return 512 /* Default */; case 118 /* AsyncKeyword */: return 256 /* Async */; + case 128 /* ReadonlyKeyword */: return 64 /* Readonly */; } return 0; } @@ -6225,24 +7022,25 @@ var ts; function isLeftHandSideExpression(expr) { if (expr) { switch (expr.kind) { - case 166 /* PropertyAccessExpression */: - case 167 /* ElementAccessExpression */: - case 169 /* NewExpression */: - case 168 /* CallExpression */: - case 233 /* JsxElement */: - case 234 /* JsxSelfClosingElement */: - case 170 /* TaggedTemplateExpression */: - case 164 /* ArrayLiteralExpression */: - case 172 /* ParenthesizedExpression */: - case 165 /* ObjectLiteralExpression */: - case 186 /* ClassExpression */: - case 173 /* FunctionExpression */: + case 172 /* PropertyAccessExpression */: + case 173 /* ElementAccessExpression */: + case 175 /* NewExpression */: + case 174 /* CallExpression */: + case 196 /* NonNullExpression */: + case 241 /* JsxElement */: + case 242 /* JsxSelfClosingElement */: + case 176 /* TaggedTemplateExpression */: + case 170 /* ArrayLiteralExpression */: + case 178 /* ParenthesizedExpression */: + case 171 /* ObjectLiteralExpression */: + case 192 /* ClassExpression */: + case 179 /* FunctionExpression */: case 69 /* Identifier */: case 10 /* RegularExpressionLiteral */: case 8 /* NumericLiteral */: case 9 /* StringLiteral */: case 11 /* NoSubstitutionTemplateLiteral */: - case 183 /* TemplateExpression */: + case 189 /* TemplateExpression */: case 84 /* FalseKeyword */: case 93 /* NullKeyword */: case 97 /* ThisKeyword */: @@ -6259,7 +7057,7 @@ var ts; } ts.isAssignmentOperator = isAssignmentOperator; function isExpressionWithTypeArgumentsInClassExtendsClause(node) { - return node.kind === 188 /* ExpressionWithTypeArguments */ && + return node.kind === 194 /* ExpressionWithTypeArguments */ && node.parent.token === 83 /* ExtendsKeyword */ && isClassLike(node.parent.parent); } @@ -6282,16 +7080,16 @@ var ts; } } function isRightSideOfQualifiedNameOrPropertyAccess(node) { - return (node.parent.kind === 135 /* QualifiedName */ && node.parent.right === node) || - (node.parent.kind === 166 /* PropertyAccessExpression */ && node.parent.name === node); + return (node.parent.kind === 139 /* QualifiedName */ && node.parent.right === node) || + (node.parent.kind === 172 /* PropertyAccessExpression */ && node.parent.name === node); } ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess; function isEmptyObjectLiteralOrArrayLiteral(expression) { var kind = expression.kind; - if (kind === 165 /* ObjectLiteralExpression */) { + if (kind === 171 /* ObjectLiteralExpression */) { return expression.properties.length === 0; } - if (kind === 164 /* ArrayLiteralExpression */) { + if (kind === 170 /* ArrayLiteralExpression */) { return expression.elements.length === 0; } return false; @@ -6302,13 +7100,9 @@ var ts; } ts.getLocalSymbolForExportDefault = getLocalSymbolForExportDefault; function hasJavaScriptFileExtension(fileName) { - return ts.fileExtensionIs(fileName, ".js") || ts.fileExtensionIs(fileName, ".jsx"); + return ts.forEach(ts.supportedJavascriptExtensions, function (extension) { return ts.fileExtensionIs(fileName, extension); }); } ts.hasJavaScriptFileExtension = hasJavaScriptFileExtension; - function allowsJsxExpressions(fileName) { - return ts.fileExtensionIs(fileName, ".tsx") || ts.fileExtensionIs(fileName, ".jsx"); - } - ts.allowsJsxExpressions = allowsJsxExpressions; /** * 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. @@ -6343,6 +7137,47 @@ var ts; } return output; } + /** + * Serialize an object graph into a JSON string. This is intended only for use on an acyclic graph + * as the fallback implementation does not check for circular references by default. + */ + ts.stringify = typeof JSON !== "undefined" && JSON.stringify + ? JSON.stringify + : stringifyFallback; + /** + * Serialize an object graph into a JSON string. + */ + function stringifyFallback(value) { + // JSON.stringify returns `undefined` here, instead of the string "undefined". + return value === undefined ? undefined : stringifyValue(value); + } + function stringifyValue(value) { + return typeof value === "string" ? "\"" + escapeString(value) + "\"" + : typeof value === "number" ? isFinite(value) ? String(value) : "null" + : typeof value === "boolean" ? value ? "true" : "false" + : typeof value === "object" && value ? ts.isArray(value) ? cycleCheck(stringifyArray, value) : cycleCheck(stringifyObject, value) + : "null"; + } + function cycleCheck(cb, value) { + ts.Debug.assert(!value.hasOwnProperty("__cycle"), "Converting circular structure to JSON"); + value.__cycle = true; + var result = cb(value); + delete value.__cycle; + return result; + } + function stringifyArray(value) { + return "[" + ts.reduceLeft(value, stringifyElement, "") + "]"; + } + function stringifyElement(memo, value) { + return (memo ? memo + "," : memo) + stringifyValue(value); + } + function stringifyObject(value) { + return "{" + ts.reduceProperties(value, stringifyProperty, "") + "}"; + } + function stringifyProperty(memo, value, key) { + return value === undefined || typeof value === "function" || key === "__cycle" ? memo + : (memo ? memo + "," : memo) + ("\"" + escapeString(key) + "\":" + stringifyValue(value)); + } var base64Digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; /** * Converts a string to a base-64 encoded ASCII string. @@ -6368,7 +7203,7 @@ var ts; else if (i + 2 >= length) { byte4 = 64; } - // Write to the ouput + // Write to the output result += base64Digits.charAt(byte1) + base64Digits.charAt(byte2) + base64Digits.charAt(byte3) + base64Digits.charAt(byte4); i += 3; } @@ -6396,6 +7231,11 @@ var ts; return carriageReturnLineFeed; } ts.getNewLineCharacter = getNewLineCharacter; + function isWatchSet(options) { + // Firefox has Object.prototype.watch + return options.watch && options.hasOwnProperty("watch"); + } + ts.isWatchSet = isWatchSet; })(ts || (ts = {})); var ts; (function (ts) { @@ -6554,9 +7394,9 @@ var ts; // . | \ // ----------------------------------------------------------------------*-------------------------------- // - // (Note the dots represent the newly inferrred start. + // (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 asterixes, and the relative change between the dollar signs. Basically, we see + // 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: // @@ -6579,8 +7419,8 @@ var ts; // 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 rahter - // than pusing the first edit forward to match the second, we'll push the second edit forward to match the + // 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 @@ -6609,15 +7449,28 @@ var ts; } ts.collapseTextChangeRangesAcrossMultipleVersions = collapseTextChangeRangesAcrossMultipleVersions; function getTypeParameterOwner(d) { - if (d && d.kind === 137 /* TypeParameter */) { + if (d && d.kind === 141 /* TypeParameter */) { for (var current = d; current; current = current.parent) { - if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 215 /* InterfaceDeclaration */) { + if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 222 /* InterfaceDeclaration */) { return current; } } } } ts.getTypeParameterOwner = getTypeParameterOwner; + function isParameterPropertyDeclaration(node) { + return node.flags & 92 /* ParameterPropertyModifier */ && node.parent.kind === 148 /* Constructor */ && ts.isClassLike(node.parent.parent); + } + ts.isParameterPropertyDeclaration = isParameterPropertyDeclaration; + function startsWith(str, prefix) { + return str.lastIndexOf(prefix, 0) === 0; + } + ts.startsWith = startsWith; + function endsWith(str, suffix) { + var expectedPos = str.length - suffix.length; + return str.indexOf(suffix, expectedPos) === expectedPos; + } + ts.endsWith = endsWith; })(ts || (ts = {})); /// /// @@ -6627,7 +7480,7 @@ var ts; var NodeConstructor; var SourceFileConstructor; function createNode(kind, pos, end) { - if (kind === 248 /* SourceFile */) { + if (kind === 256 /* SourceFile */) { return new (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor()))(kind, pos, end); } else { @@ -6670,26 +7523,26 @@ var ts; var visitNodes = cbNodeArray ? visitNodeArray : visitEachNode; var cbNodes = cbNodeArray || cbNode; switch (node.kind) { - case 135 /* QualifiedName */: + case 139 /* QualifiedName */: return visitNode(cbNode, node.left) || visitNode(cbNode, node.right); - case 137 /* TypeParameter */: + case 141 /* TypeParameter */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.constraint) || visitNode(cbNode, node.expression); - case 246 /* ShorthandPropertyAssignment */: + case 254 /* ShorthandPropertyAssignment */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.equalsToken) || visitNode(cbNode, node.objectAssignmentInitializer); - case 138 /* Parameter */: - case 141 /* PropertyDeclaration */: - case 140 /* PropertySignature */: - case 245 /* PropertyAssignment */: - case 211 /* VariableDeclaration */: - case 163 /* BindingElement */: + case 142 /* Parameter */: + case 145 /* PropertyDeclaration */: + case 144 /* PropertySignature */: + case 253 /* PropertyAssignment */: + case 218 /* VariableDeclaration */: + case 169 /* BindingElement */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.propertyName) || @@ -6698,24 +7551,24 @@ var ts; visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.type) || visitNode(cbNode, node.initializer); - case 152 /* FunctionType */: - case 153 /* ConstructorType */: - case 147 /* CallSignature */: - case 148 /* ConstructSignature */: - case 149 /* IndexSignature */: + case 156 /* FunctionType */: + case 157 /* ConstructorType */: + case 151 /* CallSignature */: + case 152 /* ConstructSignature */: + case 153 /* IndexSignature */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type); - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - case 144 /* Constructor */: - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: - case 173 /* FunctionExpression */: - case 213 /* FunctionDeclaration */: - case 174 /* ArrowFunction */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: + case 148 /* Constructor */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: + case 179 /* FunctionExpression */: + case 220 /* FunctionDeclaration */: + case 180 /* ArrowFunction */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.asteriskToken) || @@ -6726,302 +7579,310 @@ var ts; visitNode(cbNode, node.type) || visitNode(cbNode, node.equalsGreaterThanToken) || visitNode(cbNode, node.body); - case 151 /* TypeReference */: + case 155 /* TypeReference */: return visitNode(cbNode, node.typeName) || visitNodes(cbNodes, node.typeArguments); - case 150 /* TypePredicate */: + case 154 /* TypePredicate */: return visitNode(cbNode, node.parameterName) || visitNode(cbNode, node.type); - case 154 /* TypeQuery */: + case 158 /* TypeQuery */: return visitNode(cbNode, node.exprName); - case 155 /* TypeLiteral */: + case 159 /* TypeLiteral */: return visitNodes(cbNodes, node.members); - case 156 /* ArrayType */: + case 160 /* ArrayType */: return visitNode(cbNode, node.elementType); - case 157 /* TupleType */: + case 161 /* TupleType */: return visitNodes(cbNodes, node.elementTypes); - case 158 /* UnionType */: - case 159 /* IntersectionType */: + case 162 /* UnionType */: + case 163 /* IntersectionType */: return visitNodes(cbNodes, node.types); - case 160 /* ParenthesizedType */: + case 164 /* ParenthesizedType */: return visitNode(cbNode, node.type); - case 161 /* ObjectBindingPattern */: - case 162 /* ArrayBindingPattern */: + case 167 /* ObjectBindingPattern */: + case 168 /* ArrayBindingPattern */: return visitNodes(cbNodes, node.elements); - case 164 /* ArrayLiteralExpression */: + case 170 /* ArrayLiteralExpression */: return visitNodes(cbNodes, node.elements); - case 165 /* ObjectLiteralExpression */: + case 171 /* ObjectLiteralExpression */: return visitNodes(cbNodes, node.properties); - case 166 /* PropertyAccessExpression */: + case 172 /* PropertyAccessExpression */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.dotToken) || visitNode(cbNode, node.name); - case 167 /* ElementAccessExpression */: + case 173 /* ElementAccessExpression */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.argumentExpression); - case 168 /* CallExpression */: - case 169 /* NewExpression */: + case 174 /* CallExpression */: + case 175 /* NewExpression */: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments) || visitNodes(cbNodes, node.arguments); - case 170 /* TaggedTemplateExpression */: + case 176 /* TaggedTemplateExpression */: return visitNode(cbNode, node.tag) || visitNode(cbNode, node.template); - case 171 /* TypeAssertionExpression */: + case 177 /* TypeAssertionExpression */: return visitNode(cbNode, node.type) || visitNode(cbNode, node.expression); - case 172 /* ParenthesizedExpression */: + case 178 /* ParenthesizedExpression */: return visitNode(cbNode, node.expression); - case 175 /* DeleteExpression */: + case 181 /* DeleteExpression */: return visitNode(cbNode, node.expression); - case 176 /* TypeOfExpression */: + case 182 /* TypeOfExpression */: return visitNode(cbNode, node.expression); - case 177 /* VoidExpression */: + case 183 /* VoidExpression */: return visitNode(cbNode, node.expression); - case 179 /* PrefixUnaryExpression */: + case 185 /* PrefixUnaryExpression */: return visitNode(cbNode, node.operand); - case 184 /* YieldExpression */: + case 190 /* YieldExpression */: return visitNode(cbNode, node.asteriskToken) || visitNode(cbNode, node.expression); - case 178 /* AwaitExpression */: + case 184 /* AwaitExpression */: return visitNode(cbNode, node.expression); - case 180 /* PostfixUnaryExpression */: + case 186 /* PostfixUnaryExpression */: return visitNode(cbNode, node.operand); - case 181 /* BinaryExpression */: + case 187 /* BinaryExpression */: return visitNode(cbNode, node.left) || visitNode(cbNode, node.operatorToken) || visitNode(cbNode, node.right); - case 189 /* AsExpression */: + case 195 /* AsExpression */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.type); - case 182 /* ConditionalExpression */: + case 196 /* NonNullExpression */: + return visitNode(cbNode, node.expression); + case 188 /* ConditionalExpression */: return visitNode(cbNode, node.condition) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.whenTrue) || visitNode(cbNode, node.colonToken) || visitNode(cbNode, node.whenFalse); - case 185 /* SpreadElementExpression */: + case 191 /* SpreadElementExpression */: return visitNode(cbNode, node.expression); - case 192 /* Block */: - case 219 /* ModuleBlock */: + case 199 /* Block */: + case 226 /* ModuleBlock */: return visitNodes(cbNodes, node.statements); - case 248 /* SourceFile */: + case 256 /* SourceFile */: return visitNodes(cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); - case 193 /* VariableStatement */: + case 200 /* VariableStatement */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.declarationList); - case 212 /* VariableDeclarationList */: + case 219 /* VariableDeclarationList */: return visitNodes(cbNodes, node.declarations); - case 195 /* ExpressionStatement */: + case 202 /* ExpressionStatement */: return visitNode(cbNode, node.expression); - case 196 /* IfStatement */: + case 203 /* IfStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.thenStatement) || visitNode(cbNode, node.elseStatement); - case 197 /* DoStatement */: + case 204 /* DoStatement */: return visitNode(cbNode, node.statement) || visitNode(cbNode, node.expression); - case 198 /* WhileStatement */: + case 205 /* WhileStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 199 /* ForStatement */: + case 206 /* ForStatement */: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.condition) || visitNode(cbNode, node.incrementor) || visitNode(cbNode, node.statement); - case 200 /* ForInStatement */: + case 207 /* ForInStatement */: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 201 /* ForOfStatement */: + case 208 /* ForOfStatement */: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 202 /* ContinueStatement */: - case 203 /* BreakStatement */: + case 209 /* ContinueStatement */: + case 210 /* BreakStatement */: return visitNode(cbNode, node.label); - case 204 /* ReturnStatement */: + case 211 /* ReturnStatement */: return visitNode(cbNode, node.expression); - case 205 /* WithStatement */: + case 212 /* WithStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 206 /* SwitchStatement */: + case 213 /* SwitchStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.caseBlock); - case 220 /* CaseBlock */: + case 227 /* CaseBlock */: return visitNodes(cbNodes, node.clauses); - case 241 /* CaseClause */: + case 249 /* CaseClause */: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.statements); - case 242 /* DefaultClause */: + case 250 /* DefaultClause */: return visitNodes(cbNodes, node.statements); - case 207 /* LabeledStatement */: + case 214 /* LabeledStatement */: return visitNode(cbNode, node.label) || visitNode(cbNode, node.statement); - case 208 /* ThrowStatement */: + case 215 /* ThrowStatement */: return visitNode(cbNode, node.expression); - case 209 /* TryStatement */: + case 216 /* TryStatement */: return visitNode(cbNode, node.tryBlock) || visitNode(cbNode, node.catchClause) || visitNode(cbNode, node.finallyBlock); - case 244 /* CatchClause */: + case 252 /* CatchClause */: return visitNode(cbNode, node.variableDeclaration) || visitNode(cbNode, node.block); - case 139 /* Decorator */: + case 143 /* Decorator */: return visitNode(cbNode, node.expression); - case 214 /* ClassDeclaration */: - case 186 /* ClassExpression */: + case 221 /* ClassDeclaration */: + case 192 /* ClassExpression */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.heritageClauses) || visitNodes(cbNodes, node.members); - case 215 /* InterfaceDeclaration */: + case 222 /* InterfaceDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.heritageClauses) || visitNodes(cbNodes, node.members); - case 216 /* TypeAliasDeclaration */: + case 223 /* TypeAliasDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNode(cbNode, node.type); - case 217 /* EnumDeclaration */: + case 224 /* EnumDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.members); - case 247 /* EnumMember */: + case 255 /* EnumMember */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 218 /* ModuleDeclaration */: + case 225 /* ModuleDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.body); - case 221 /* ImportEqualsDeclaration */: + case 229 /* ImportEqualsDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); - case 222 /* ImportDeclaration */: + case 230 /* ImportDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.importClause) || visitNode(cbNode, node.moduleSpecifier); - case 223 /* ImportClause */: + case 231 /* ImportClause */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.namedBindings); - case 224 /* NamespaceImport */: + case 228 /* GlobalModuleExportDeclaration */: return visitNode(cbNode, node.name); - case 225 /* NamedImports */: - case 229 /* NamedExports */: + case 232 /* NamespaceImport */: + return visitNode(cbNode, node.name); + case 233 /* NamedImports */: + case 237 /* NamedExports */: return visitNodes(cbNodes, node.elements); - case 228 /* ExportDeclaration */: + case 236 /* ExportDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.exportClause) || visitNode(cbNode, node.moduleSpecifier); - case 226 /* ImportSpecifier */: - case 230 /* ExportSpecifier */: + case 234 /* ImportSpecifier */: + case 238 /* ExportSpecifier */: return visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.name); - case 227 /* ExportAssignment */: + case 235 /* ExportAssignment */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.expression); - case 183 /* TemplateExpression */: + case 189 /* TemplateExpression */: return visitNode(cbNode, node.head) || visitNodes(cbNodes, node.templateSpans); - case 190 /* TemplateSpan */: + case 197 /* TemplateSpan */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal); - case 136 /* ComputedPropertyName */: + case 140 /* ComputedPropertyName */: return visitNode(cbNode, node.expression); - case 243 /* HeritageClause */: + case 251 /* HeritageClause */: return visitNodes(cbNodes, node.types); - case 188 /* ExpressionWithTypeArguments */: + case 194 /* ExpressionWithTypeArguments */: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments); - case 232 /* ExternalModuleReference */: + case 240 /* ExternalModuleReference */: return visitNode(cbNode, node.expression); - case 231 /* MissingDeclaration */: + case 239 /* MissingDeclaration */: return visitNodes(cbNodes, node.decorators); - case 233 /* JsxElement */: + case 241 /* JsxElement */: return visitNode(cbNode, node.openingElement) || visitNodes(cbNodes, node.children) || visitNode(cbNode, node.closingElement); - case 234 /* JsxSelfClosingElement */: - case 235 /* JsxOpeningElement */: + case 242 /* JsxSelfClosingElement */: + case 243 /* JsxOpeningElement */: return visitNode(cbNode, node.tagName) || visitNodes(cbNodes, node.attributes); - case 238 /* JsxAttribute */: + case 246 /* JsxAttribute */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 239 /* JsxSpreadAttribute */: + case 247 /* JsxSpreadAttribute */: return visitNode(cbNode, node.expression); - case 240 /* JsxExpression */: + case 248 /* JsxExpression */: return visitNode(cbNode, node.expression); - case 237 /* JsxClosingElement */: + case 245 /* JsxClosingElement */: return visitNode(cbNode, node.tagName); - case 249 /* JSDocTypeExpression */: + case 257 /* JSDocTypeExpression */: return visitNode(cbNode, node.type); - case 253 /* JSDocUnionType */: + case 261 /* JSDocUnionType */: return visitNodes(cbNodes, node.types); - case 254 /* JSDocTupleType */: + case 262 /* JSDocTupleType */: return visitNodes(cbNodes, node.types); - case 252 /* JSDocArrayType */: + case 260 /* JSDocArrayType */: return visitNode(cbNode, node.elementType); - case 256 /* JSDocNonNullableType */: + case 264 /* JSDocNonNullableType */: return visitNode(cbNode, node.type); - case 255 /* JSDocNullableType */: + case 263 /* JSDocNullableType */: return visitNode(cbNode, node.type); - case 257 /* JSDocRecordType */: + case 265 /* JSDocRecordType */: return visitNodes(cbNodes, node.members); - case 259 /* JSDocTypeReference */: + case 267 /* JSDocTypeReference */: return visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeArguments); - case 260 /* JSDocOptionalType */: + case 268 /* JSDocOptionalType */: return visitNode(cbNode, node.type); - case 261 /* JSDocFunctionType */: + case 269 /* JSDocFunctionType */: return visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type); - case 262 /* JSDocVariadicType */: + case 270 /* JSDocVariadicType */: return visitNode(cbNode, node.type); - case 263 /* JSDocConstructorType */: + case 271 /* JSDocConstructorType */: return visitNode(cbNode, node.type); - case 264 /* JSDocThisType */: + case 272 /* JSDocThisType */: return visitNode(cbNode, node.type); - case 258 /* JSDocRecordMember */: + case 266 /* JSDocRecordMember */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.type); - case 265 /* JSDocComment */: + case 273 /* JSDocComment */: return visitNodes(cbNodes, node.tags); - case 267 /* JSDocParameterTag */: + case 275 /* JSDocParameterTag */: return visitNode(cbNode, node.preParameterName) || visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.postParameterName); - case 268 /* JSDocReturnTag */: + case 276 /* JSDocReturnTag */: return visitNode(cbNode, node.typeExpression); - case 269 /* JSDocTypeTag */: + case 277 /* JSDocTypeTag */: return visitNode(cbNode, node.typeExpression); - case 270 /* JSDocTemplateTag */: + case 278 /* JSDocTemplateTag */: return visitNodes(cbNodes, node.typeParameters); } } ts.forEachChild = forEachChild; - function createSourceFile(fileName, sourceText, languageVersion, setParentNodes) { + function createSourceFile(fileName, sourceText, languageVersion, setParentNodes, scriptKind) { if (setParentNodes === void 0) { setParentNodes = false; } var start = new Date().getTime(); - var result = Parser.parseSourceFile(fileName, sourceText, languageVersion, /*syntaxCursor*/ undefined, setParentNodes); + var result = Parser.parseSourceFile(fileName, sourceText, languageVersion, /*syntaxCursor*/ undefined, setParentNodes, scriptKind); ts.parseTime += new Date().getTime() - start; return result; } ts.createSourceFile = createSourceFile; + 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 @@ -7054,7 +7915,7 @@ var ts; // 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(2 /* Latest */, /*skipTrivia*/ true); - var disallowInAndDecoratorContext = 1 /* DisallowIn */ | 4 /* Decorator */; + var disallowInAndDecoratorContext = 4194304 /* DisallowInContext */ | 16777216 /* DecoratorContext */; // capture constructors in 'initializeState' to avoid null checks var NodeConstructor; var SourceFileConstructor; @@ -7142,15 +8003,19 @@ var ts; // 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) { - var isJavaScriptFile = ts.hasJavaScriptFileExtension(fileName) || _sourceText.lastIndexOf("// @language=javascript", 0) === 0; - initializeState(fileName, _sourceText, languageVersion, isJavaScriptFile, _syntaxCursor); - var result = parseSourceFileWorker(fileName, languageVersion, setParentNodes); + function parseSourceFile(fileName, _sourceText, languageVersion, _syntaxCursor, setParentNodes, scriptKind) { + scriptKind = ts.ensureScriptKind(fileName, scriptKind); + initializeState(fileName, _sourceText, languageVersion, _syntaxCursor, scriptKind); + var result = parseSourceFileWorker(fileName, languageVersion, setParentNodes, scriptKind); clearState(); return result; } Parser.parseSourceFile = parseSourceFile; - function initializeState(fileName, _sourceText, languageVersion, isJavaScriptFile, _syntaxCursor) { + function getLanguageVariant(scriptKind) { + // .tsx and .jsx files are treated as jsx language variant. + return scriptKind === 4 /* TSX */ || scriptKind === 2 /* JSX */ || scriptKind === 1 /* JS */ ? 1 /* JSX */ : 0 /* Standard */; + } + function initializeState(fileName, _sourceText, languageVersion, _syntaxCursor, scriptKind) { NodeConstructor = ts.objectAllocator.getNodeConstructor(); SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor(); sourceText = _sourceText; @@ -7160,30 +8025,28 @@ var ts; identifiers = {}; identifierCount = 0; nodeCount = 0; - contextFlags = isJavaScriptFile ? 32 /* JavaScriptFile */ : 0 /* None */; + contextFlags = scriptKind === 1 /* JS */ || scriptKind === 2 /* JSX */ ? 134217728 /* JavaScriptFile */ : 0 /* None */; parseErrorBeforeNextFinishedNode = false; // Initialize and prime the scanner before parsing the source elements. scanner.setText(sourceText); scanner.setOnError(scanError); scanner.setScriptTarget(languageVersion); - scanner.setLanguageVariant(ts.allowsJsxExpressions(fileName) ? 1 /* JSX */ : 0 /* Standard */); + 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 accidently hold onto it for too long. + // Clear any data. We don't want to accidentally hold onto it for too long. parseDiagnostics = undefined; sourceFile = undefined; identifiers = undefined; syntaxCursor = undefined; sourceText = undefined; } - function parseSourceFileWorker(fileName, languageVersion, setParentNodes) { - sourceFile = createSourceFile(fileName, languageVersion); - if (contextFlags & 32 /* JavaScriptFile */) { - sourceFile.parserContextFlags = 32 /* JavaScriptFile */; - } + function parseSourceFileWorker(fileName, languageVersion, setParentNodes, scriptKind) { + sourceFile = createSourceFile(fileName, languageVersion, scriptKind); + sourceFile.flags = contextFlags; // Prime the scanner. token = nextToken(); processReferenceComments(sourceFile); @@ -7198,40 +8061,22 @@ var ts; if (setParentNodes) { fixupParentReferences(sourceFile); } - // If this is a javascript file, proactively see if we can get JSDoc comments for - // relevant nodes in the file. We'll use these to provide typing informaion if they're - // available. - if (ts.isSourceFileJavaScript(sourceFile)) { - addJSDocComments(); - } return sourceFile; } - function addJSDocComments() { - forEachChild(sourceFile, visit); - return; - function visit(node) { - // Add additional cases as necessary depending on how we see JSDoc comments used - // in the wild. - switch (node.kind) { - case 193 /* VariableStatement */: - case 213 /* FunctionDeclaration */: - case 138 /* Parameter */: - addJSDocComment(node); - } - forEachChild(node, visit); - } - } function addJSDocComment(node) { - var comments = ts.getLeadingCommentRangesOfNode(node, sourceFile); - if (comments) { - for (var _i = 0, comments_1 = comments; _i < comments_1.length; _i++) { - var comment = comments_1[_i]; - var jsDocComment = JSDocParser.parseJSDocComment(node, comment.pos, comment.end - comment.pos); - if (jsDocComment) { - node.jsDocComment = jsDocComment; + if (contextFlags & 134217728 /* JavaScriptFile */) { + var comments = ts.getLeadingCommentRangesOfNode(node, sourceFile); + if (comments) { + for (var _i = 0, comments_1 = comments; _i < comments_1.length; _i++) { + var comment = comments_1[_i]; + var jsDocComment = JSDocParser.parseJSDocComment(node, comment.pos, comment.end - comment.pos); + if (jsDocComment) { + node.jsDocComment = jsDocComment; + } } } } + return node; } function fixupParentReferences(sourceFile) { // normally parent references are set during binding. However, for clients that only need @@ -7255,17 +8100,18 @@ var ts; } } Parser.fixupParentReferences = fixupParentReferences; - function createSourceFile(fileName, languageVersion) { + function createSourceFile(fileName, languageVersion, scriptKind) { // 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(248 /* SourceFile */, /*pos*/ 0, /* end */ sourceText.length); + var sourceFile = new SourceFileConstructor(256 /* SourceFile */, /*pos*/ 0, /* end */ sourceText.length); nodeCount++; sourceFile.text = sourceText; sourceFile.bindDiagnostics = []; sourceFile.languageVersion = languageVersion; sourceFile.fileName = ts.normalizePath(fileName); - sourceFile.flags = ts.fileExtensionIs(sourceFile.fileName, ".d.ts") ? 4096 /* DeclarationFile */ : 0; - sourceFile.languageVariant = ts.allowsJsxExpressions(sourceFile.fileName) ? 1 /* JSX */ : 0 /* Standard */; + sourceFile.languageVariant = getLanguageVariant(scriptKind); + sourceFile.isDeclarationFile = ts.fileExtensionIs(sourceFile.fileName, ".d.ts"); + sourceFile.scriptKind = scriptKind; return sourceFile; } function setContextFlag(val, flag) { @@ -7277,16 +8123,16 @@ var ts; } } function setDisallowInContext(val) { - setContextFlag(val, 1 /* DisallowIn */); + setContextFlag(val, 4194304 /* DisallowInContext */); } function setYieldContext(val) { - setContextFlag(val, 2 /* Yield */); + setContextFlag(val, 8388608 /* YieldContext */); } function setDecoratorContext(val) { - setContextFlag(val, 4 /* Decorator */); + setContextFlag(val, 16777216 /* DecoratorContext */); } function setAwaitContext(val) { - setContextFlag(val, 8 /* Await */); + setContextFlag(val, 33554432 /* AwaitContext */); } function doOutsideOfContext(context, func) { // contextFlagsToClear will contain only the context flags that are @@ -7298,10 +8144,10 @@ var ts; var contextFlagsToClear = context & contextFlags; if (contextFlagsToClear) { // clear the requested context flags - setContextFlag(false, contextFlagsToClear); + setContextFlag(/*val*/ false, contextFlagsToClear); var result = func(); // restore the context flags we just cleared - setContextFlag(true, contextFlagsToClear); + setContextFlag(/*val*/ true, contextFlagsToClear); return result; } // no need to do anything special as we are not in any of the requested contexts @@ -7317,56 +8163,50 @@ var ts; var contextFlagsToSet = context & ~contextFlags; if (contextFlagsToSet) { // set the requested context flags - setContextFlag(true, contextFlagsToSet); + setContextFlag(/*val*/ true, contextFlagsToSet); var result = func(); // reset the context flags we just set - setContextFlag(false, contextFlagsToSet); + setContextFlag(/*val*/ 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(1 /* DisallowIn */, func); + return doOutsideOfContext(4194304 /* DisallowInContext */, func); } function disallowInAnd(func) { - return doInsideOfContext(1 /* DisallowIn */, func); + return doInsideOfContext(4194304 /* DisallowInContext */, func); } function doInYieldContext(func) { - return doInsideOfContext(2 /* Yield */, func); - } - function doOutsideOfYieldContext(func) { - return doOutsideOfContext(2 /* Yield */, func); + return doInsideOfContext(8388608 /* YieldContext */, func); } function doInDecoratorContext(func) { - return doInsideOfContext(4 /* Decorator */, func); + return doInsideOfContext(16777216 /* DecoratorContext */, func); } function doInAwaitContext(func) { - return doInsideOfContext(8 /* Await */, func); + return doInsideOfContext(33554432 /* AwaitContext */, func); } function doOutsideOfAwaitContext(func) { - return doOutsideOfContext(8 /* Await */, func); + return doOutsideOfContext(33554432 /* AwaitContext */, func); } function doInYieldAndAwaitContext(func) { - return doInsideOfContext(2 /* Yield */ | 8 /* Await */, func); - } - function doOutsideOfYieldAndAwaitContext(func) { - return doOutsideOfContext(2 /* Yield */ | 8 /* Await */, func); + return doInsideOfContext(8388608 /* YieldContext */ | 33554432 /* AwaitContext */, func); } function inContext(flags) { return (contextFlags & flags) !== 0; } function inYieldContext() { - return inContext(2 /* Yield */); + return inContext(8388608 /* YieldContext */); } function inDisallowInContext() { - return inContext(1 /* DisallowIn */); + return inContext(4194304 /* DisallowInContext */); } function inDecoratorContext() { - return inContext(4 /* Decorator */); + return inContext(16777216 /* DecoratorContext */); } function inAwaitContext() { - return inContext(8 /* Await */); + return inContext(33554432 /* AwaitContext */); } function parseErrorAtCurrentToken(message, arg0) { var start = scanner.getTokenPos(); @@ -7396,9 +8236,6 @@ var ts; function nextToken() { return token = scanner.scan(); } - function getTokenPos(pos) { - return ts.skipTrivia(sourceText, pos); - } function reScanGreaterToken() { return token = scanner.reScanGreaterToken(); } @@ -7441,16 +8278,18 @@ 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. + /** 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); } - // 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. + /** 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); } @@ -7541,14 +8380,14 @@ var ts; function finishNode(node, end) { node.end = end === undefined ? scanner.getStartPos() : end; if (contextFlags) { - node.parserContextFlags = 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.parserContextFlags |= 16 /* ThisNodeHasError */; + node.flags |= 67108864 /* ThisNodeHasError */; } return node; } @@ -7605,10 +8444,10 @@ var ts; return parseIdentifierName(); } function parsePropertyName() { - return parsePropertyNameWorker(/*allowComputedPropertyNames:*/ true); + return parsePropertyNameWorker(/*allowComputedPropertyNames*/ true); } function parseSimplePropertyName() { - return parsePropertyNameWorker(/*allowComputedPropertyNames:*/ false); + return parsePropertyNameWorker(/*allowComputedPropertyNames*/ false); } function isSimplePropertyName() { return token === 9 /* StringLiteral */ || token === 8 /* NumericLiteral */ || ts.tokenIsIdentifierOrKeyword(token); @@ -7617,7 +8456,7 @@ var ts; // PropertyName [Yield]: // LiteralPropertyName // ComputedPropertyName[?Yield] - var node = createNode(136 /* ComputedPropertyName */); + var node = createNode(140 /* ComputedPropertyName */); parseExpected(19 /* OpenBracketToken */); // We parse any expression (including a comma expression). But the grammar // says that only an assignment expression is allowed, so the grammar checker @@ -7629,6 +8468,13 @@ var ts; function parseContextualModifier(t) { return token === t && tryParse(nextTokenCanFollowModifier); } + function nextTokenIsOnSameLineAndCanFollowModifier() { + nextToken(); + if (scanner.hasPrecedingLineBreak()) { + return false; + } + return canFollowModifier(); + } function nextTokenCanFollowModifier() { if (token === 74 /* ConstKeyword */) { // 'const' is only a modifier if followed by 'enum'. @@ -7639,7 +8485,7 @@ var ts; if (token === 77 /* DefaultKeyword */) { return lookAhead(nextTokenIsClassOrFunction); } - return token !== 37 /* AsteriskToken */ && token !== 15 /* OpenBraceToken */ && canFollowModifier(); + return token !== 37 /* AsteriskToken */ && token !== 116 /* AsKeyword */ && token !== 15 /* OpenBraceToken */ && canFollowModifier(); } if (token === 77 /* DefaultKeyword */) { return nextTokenIsClassOrFunction(); @@ -7648,14 +8494,10 @@ var ts; nextToken(); return canFollowModifier(); } - nextToken(); - if (scanner.hasPrecedingLineBreak()) { - return false; - } - return canFollowModifier(); + return nextTokenIsOnSameLineAndCanFollowModifier(); } function parseAnyContextualModifier() { - return ts.isModifier(token) && tryParse(nextTokenCanFollowModifier); + return ts.isModifierKind(token) && tryParse(nextTokenCanFollowModifier); } function canFollowModifier() { return token === 19 /* OpenBracketToken */ @@ -7687,7 +8529,7 @@ var ts; case 2 /* SwitchClauses */: return token === 71 /* CaseKeyword */ || token === 77 /* DefaultKeyword */; case 4 /* TypeMembers */: - return isStartOfTypeMember(); + 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 @@ -7861,7 +8703,7 @@ var ts; function isInSomeParsingContext() { for (var kind = 0; kind < 26 /* Count */; kind++) { if (parsingContext & (1 << kind)) { - if (isListElement(kind, /* inErrorRecovery */ true) || isListTerminator(kind)) { + if (isListElement(kind, /*inErrorRecovery*/ true) || isListTerminator(kind)) { return true; } } @@ -7875,7 +8717,7 @@ var ts; var result = []; result.pos = getNodePos(); while (!isListTerminator(kind)) { - if (isListElement(kind, /* inErrorRecovery */ false)) { + if (isListElement(kind, /*inErrorRecovery*/ false)) { var element = parseListElement(kind, parseElement); result.push(element); continue; @@ -7927,20 +8769,20 @@ var ts; // 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 presense of strict mode may cause us to parse the tokens in the file - // differetly. + // 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.parserContextFlags & 31 /* ParserGeneratedFlags */; + var nodeContextFlags = node.flags & 197132288 /* ContextFlags */; 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 currest list parsing context that we're currently at. + // in the current list parsing context that we're currently at. if (!canReuseNode(node, parsingContext)) { return undefined; } @@ -8015,14 +8857,14 @@ var ts; function isReusableClassMember(node) { if (node) { switch (node.kind) { - case 144 /* Constructor */: - case 149 /* IndexSignature */: - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: - case 141 /* PropertyDeclaration */: - case 191 /* SemicolonClassElement */: + case 148 /* Constructor */: + case 153 /* IndexSignature */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: + case 145 /* PropertyDeclaration */: + case 198 /* SemicolonClassElement */: return true; - case 143 /* MethodDeclaration */: + case 147 /* 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. @@ -8037,8 +8879,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 241 /* CaseClause */: - case 242 /* DefaultClause */: + case 249 /* CaseClause */: + case 250 /* DefaultClause */: return true; } } @@ -8047,58 +8889,58 @@ var ts; function isReusableStatement(node) { if (node) { switch (node.kind) { - case 213 /* FunctionDeclaration */: - case 193 /* VariableStatement */: - case 192 /* Block */: - case 196 /* IfStatement */: - case 195 /* ExpressionStatement */: - case 208 /* ThrowStatement */: - case 204 /* ReturnStatement */: - case 206 /* SwitchStatement */: - case 203 /* BreakStatement */: - case 202 /* ContinueStatement */: - case 200 /* ForInStatement */: - case 201 /* ForOfStatement */: - case 199 /* ForStatement */: - case 198 /* WhileStatement */: - case 205 /* WithStatement */: - case 194 /* EmptyStatement */: - case 209 /* TryStatement */: - case 207 /* LabeledStatement */: - case 197 /* DoStatement */: - case 210 /* DebuggerStatement */: - case 222 /* ImportDeclaration */: - case 221 /* ImportEqualsDeclaration */: - case 228 /* ExportDeclaration */: - case 227 /* ExportAssignment */: - case 218 /* ModuleDeclaration */: - case 214 /* ClassDeclaration */: - case 215 /* InterfaceDeclaration */: - case 217 /* EnumDeclaration */: - case 216 /* TypeAliasDeclaration */: + case 220 /* FunctionDeclaration */: + case 200 /* VariableStatement */: + case 199 /* Block */: + case 203 /* IfStatement */: + case 202 /* ExpressionStatement */: + case 215 /* ThrowStatement */: + case 211 /* ReturnStatement */: + case 213 /* SwitchStatement */: + case 210 /* BreakStatement */: + case 209 /* ContinueStatement */: + case 207 /* ForInStatement */: + case 208 /* ForOfStatement */: + case 206 /* ForStatement */: + case 205 /* WhileStatement */: + case 212 /* WithStatement */: + case 201 /* EmptyStatement */: + case 216 /* TryStatement */: + case 214 /* LabeledStatement */: + case 204 /* DoStatement */: + case 217 /* DebuggerStatement */: + case 230 /* ImportDeclaration */: + case 229 /* ImportEqualsDeclaration */: + case 236 /* ExportDeclaration */: + case 235 /* ExportAssignment */: + case 225 /* ModuleDeclaration */: + case 221 /* ClassDeclaration */: + case 222 /* InterfaceDeclaration */: + case 224 /* EnumDeclaration */: + case 223 /* TypeAliasDeclaration */: return true; } } return false; } function isReusableEnumMember(node) { - return node.kind === 247 /* EnumMember */; + return node.kind === 255 /* EnumMember */; } function isReusableTypeMember(node) { if (node) { switch (node.kind) { - case 148 /* ConstructSignature */: - case 142 /* MethodSignature */: - case 149 /* IndexSignature */: - case 140 /* PropertySignature */: - case 147 /* CallSignature */: + case 152 /* ConstructSignature */: + case 146 /* MethodSignature */: + case 153 /* IndexSignature */: + case 144 /* PropertySignature */: + case 151 /* CallSignature */: return true; } } return false; } function isReusableVariableDeclaration(node) { - if (node.kind !== 211 /* VariableDeclaration */) { + if (node.kind !== 218 /* VariableDeclaration */) { return false; } // Very subtle incremental parsing bug. Consider the following code: @@ -8119,7 +8961,7 @@ var ts; return variableDeclarator.initializer === undefined; } function isReusableParameter(node) { - if (node.kind !== 138 /* Parameter */) { + if (node.kind !== 142 /* Parameter */) { return false; } // See the comment in isReusableVariableDeclaration for why we do this. @@ -8167,14 +9009,14 @@ var ts; } ; // Parses a comma-delimited list of elements - function parseDelimitedList(kind, parseElement, considerSemicolonAsDelimeter) { + function parseDelimitedList(kind, parseElement, considerSemicolonAsDelimiter) { var saveParsingContext = parsingContext; parsingContext |= 1 << kind; var result = []; result.pos = getNodePos(); var commaStart = -1; // Meaning the previous token was not a comma while (true) { - if (isListElement(kind, /* inErrorRecovery */ false)) { + if (isListElement(kind, /*inErrorRecovery*/ false)) { result.push(parseListElement(kind, parseElement)); commaStart = scanner.getTokenPos(); if (parseOptional(24 /* CommaToken */)) { @@ -8192,7 +9034,7 @@ var ts; // parse errors. For example, this can happen when people do things like use // a semicolon to delimit object literal members. Note: we'll have already // reported an error when we called parseExpected above. - if (considerSemicolonAsDelimeter && token === 23 /* SemicolonToken */ && !scanner.hasPrecedingLineBreak()) { + if (considerSemicolonAsDelimiter && token === 23 /* SemicolonToken */ && !scanner.hasPrecedingLineBreak()) { nextToken(); } continue; @@ -8236,7 +9078,7 @@ var ts; function parseEntityName(allowReservedWords, diagnosticMessage) { var entity = parseIdentifier(diagnosticMessage); while (parseOptional(21 /* DotToken */)) { - var node = createNode(135 /* QualifiedName */, entity.pos); + var node = createNode(139 /* QualifiedName */, entity.pos); // !!! node.left = entity; node.right = parseRightSideOfDot(allowReservedWords); entity = finishNode(node); @@ -8269,14 +9111,14 @@ var ts; // 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(69 /* Identifier */, /*reportAtCurrentToken*/ true, ts.Diagnostics.Identifier_expected); + return createMissingNode(69 /* Identifier */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Identifier_expected); } } return allowIdentifierNames ? parseIdentifierName() : parseIdentifier(); } function parseTemplateExpression() { - var template = createNode(183 /* TemplateExpression */); - template.head = parseLiteralNode(); + var template = createNode(189 /* TemplateExpression */); + template.head = parseTemplateLiteralFragment(); ts.Debug.assert(template.head.kind === 12 /* TemplateHead */, "Template head has wrong token kind"); var templateSpans = []; templateSpans.pos = getNodePos(); @@ -8288,12 +9130,12 @@ var ts; return finishNode(template); } function parseTemplateSpan() { - var span = createNode(190 /* TemplateSpan */); + var span = createNode(197 /* TemplateSpan */); span.expression = allowInAnd(parseExpression); var literal; if (token === 16 /* CloseBraceToken */) { reScanTemplateToken(); - literal = parseLiteralNode(); + literal = parseTemplateLiteralFragment(); } else { literal = parseExpectedToken(14 /* TemplateTail */, /*reportAtCurrentPosition*/ false, ts.Diagnostics._0_expected, ts.tokenToString(16 /* CloseBraceToken */)); @@ -8301,8 +9143,17 @@ var ts; span.literal = literal; return finishNode(span); } + function parseStringLiteralTypeNode() { + return parseLiteralLikeNode(166 /* StringLiteralType */, /*internName*/ true); + } function parseLiteralNode(internName) { - var node = createNode(token); + return parseLiteralLikeNode(token, internName); + } + function parseTemplateLiteralFragment() { + return parseLiteralLikeNode(token, /*internName*/ false); + } + function parseLiteralLikeNode(kind, internName) { + var node = createNode(kind); var text = scanner.getTokenValue(); node.text = internName ? internIdentifier(text) : text; if (scanner.hasExtendedUnicodeEscape()) { @@ -8323,35 +9174,40 @@ var ts; if (node.kind === 8 /* NumericLiteral */ && sourceText.charCodeAt(tokenPos) === 48 /* _0 */ && ts.isOctalDigit(sourceText.charCodeAt(tokenPos + 1))) { - node.flags |= 32768 /* OctalLiteral */; + node.isOctalLiteral = true; } return node; } // TYPES - function parseTypeReferenceOrTypePredicate() { + function parseTypeReference() { var typeName = parseEntityName(/*allowReservedWords*/ false, ts.Diagnostics.Type_expected); - if (typeName.kind === 69 /* Identifier */ && token === 124 /* IsKeyword */ && !scanner.hasPrecedingLineBreak()) { - nextToken(); - var node_1 = createNode(150 /* TypePredicate */, typeName.pos); - node_1.parameterName = typeName; - node_1.type = parseType(); - return finishNode(node_1); - } - var node = createNode(151 /* TypeReference */, typeName.pos); + var node = createNode(155 /* TypeReference */, typeName.pos); node.typeName = typeName; if (!scanner.hasPrecedingLineBreak() && token === 25 /* LessThanToken */) { node.typeArguments = parseBracketedList(18 /* TypeArguments */, parseType, 25 /* LessThanToken */, 27 /* GreaterThanToken */); } return finishNode(node); } + function parseThisTypePredicate(lhs) { + nextToken(); + var node = createNode(154 /* TypePredicate */, lhs.pos); + node.parameterName = lhs; + node.type = parseType(); + return finishNode(node); + } + function parseThisTypeNode() { + var node = createNode(165 /* ThisType */); + nextToken(); + return finishNode(node); + } function parseTypeQuery() { - var node = createNode(154 /* TypeQuery */); + var node = createNode(158 /* TypeQuery */); parseExpected(101 /* TypeOfKeyword */); node.exprName = parseEntityName(/*allowReservedWords*/ true); return finishNode(node); } function parseTypeParameter() { - var node = createNode(137 /* TypeParameter */); + var node = createNode(141 /* TypeParameter */); node.name = parseIdentifier(); if (parseOptional(83 /* ExtendsKeyword */)) { // It's not uncommon for people to write improper constraints to a generic. If the @@ -8386,7 +9242,7 @@ var ts; return undefined; } function isStartOfParameter() { - return token === 22 /* DotDotDotToken */ || isIdentifierOrPattern() || ts.isModifier(token) || token === 55 /* AtToken */; + return token === 22 /* DotDotDotToken */ || isIdentifierOrPattern() || ts.isModifierKind(token) || token === 55 /* AtToken */ || token === 97 /* ThisKeyword */; } function setModifiers(node, modifiers) { if (modifiers) { @@ -8395,14 +9251,19 @@ var ts; } } function parseParameter() { - var node = createNode(138 /* Parameter */); + var node = createNode(142 /* Parameter */); + if (token === 97 /* ThisKeyword */) { + node.name = createIdentifier(/*isIdentifier*/ true, undefined); + node.type = parseParameterType(); + return finishNode(node); + } node.decorators = parseDecorators(); setModifiers(node, parseModifiers()); node.dotDotDotToken = parseOptionalToken(22 /* DotDotDotToken */); // FormalParameter [Yield,Await]: // BindingElement[?Yield,?Await] node.name = parseIdentifierOrPattern(); - if (ts.getFullWidth(node.name) === 0 && node.flags === 0 && ts.isModifier(token)) { + if (ts.getFullWidth(node.name) === 0 && node.flags === 0 && ts.isModifierKind(token)) { // in cases like // 'use strict' // function foo(static) @@ -8424,7 +9285,7 @@ var ts; // contexts. In addition, parameter initializers are semantically disallowed in // overload signatures. So parameter initializers are transitively disallowed in // ambient contexts. - return finishNode(node); + return addJSDocComment(finishNode(node)); } function parseBindingElementInitializer(inParameter) { return inParameter ? parseParameterInitializer() : parseNonParameterInitializer(); @@ -8438,10 +9299,10 @@ var ts; signature.parameters = parseParameterList(yieldContext, awaitContext, requireCompleteParameterList); if (returnTokenRequired) { parseExpected(returnToken); - signature.type = parseType(); + signature.type = parseTypeOrTypePredicate(); } else if (parseOptional(returnToken)) { - signature.type = parseType(); + signature.type = parseTypeOrTypePredicate(); } } function parseParameterList(yieldContext, awaitContext, requireCompleteParameterList) { @@ -8489,7 +9350,7 @@ var ts; } function parseSignatureMember(kind) { var node = createNode(kind); - if (kind === 148 /* ConstructSignature */) { + if (kind === 152 /* ConstructSignature */) { parseExpected(92 /* NewKeyword */); } fillSignature(54 /* ColonToken */, /*yieldContext*/ false, /*awaitContext*/ false, /*requireCompleteParameterList*/ false, node); @@ -8523,7 +9384,7 @@ var ts; if (token === 22 /* DotDotDotToken */ || token === 20 /* CloseBracketToken */) { return true; } - if (ts.isModifier(token)) { + if (ts.isModifierKind(token)) { nextToken(); if (isIdentifier()) { return true; @@ -8553,7 +9414,7 @@ var ts; return token === 54 /* ColonToken */ || token === 24 /* CommaToken */ || token === 20 /* CloseBracketToken */; } function parseIndexSignatureDeclaration(fullStart, decorators, modifiers) { - var node = createNode(149 /* IndexSignature */, fullStart); + var node = createNode(153 /* IndexSignature */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.parameters = parseBracketedList(16 /* Parameters */, parseParameter, 19 /* OpenBracketToken */, 20 /* CloseBracketToken */); @@ -8561,109 +9422,87 @@ var ts; parseTypeMemberSemicolon(); return finishNode(node); } - function parsePropertyOrMethodSignature() { - var fullStart = scanner.getStartPos(); + function parsePropertyOrMethodSignature(fullStart, modifiers) { var name = parsePropertyName(); var questionToken = parseOptionalToken(53 /* QuestionToken */); if (token === 17 /* OpenParenToken */ || token === 25 /* LessThanToken */) { - var method = createNode(142 /* MethodSignature */, fullStart); + var method = createNode(146 /* MethodSignature */, fullStart); + setModifiers(method, modifiers); method.name = name; method.questionToken = questionToken; - // Method signatues don't exist in expression contexts. So they have neither + // Method signatures don't exist in expression contexts. So they have neither // [Yield] nor [Await] fillSignature(54 /* ColonToken */, /*yieldContext*/ false, /*awaitContext*/ false, /*requireCompleteParameterList*/ false, method); parseTypeMemberSemicolon(); return finishNode(method); } else { - var property = createNode(140 /* PropertySignature */, fullStart); + var property = createNode(144 /* PropertySignature */, fullStart); + setModifiers(property, modifiers); property.name = name; property.questionToken = questionToken; property.type = parseTypeAnnotation(); + if (token === 56 /* 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. + property.initializer = parseNonParameterInitializer(); + } parseTypeMemberSemicolon(); return finishNode(property); } } - function isStartOfTypeMember() { - switch (token) { - case 17 /* OpenParenToken */: - case 25 /* LessThanToken */: - case 19 /* OpenBracketToken */: - return true; - default: - if (ts.isModifier(token)) { - var result = lookAhead(isStartOfIndexSignatureDeclaration); - if (result) { - return result; - } - } - return isLiteralPropertyName() && lookAhead(isTypeMemberWithLiteralPropertyName); + function isTypeMemberStart() { + var idToken; + // Return true if we have the start of a signature member + if (token === 17 /* OpenParenToken */ || token === 25 /* LessThanToken */) { + return true; } - } - function isStartOfIndexSignatureDeclaration() { - while (ts.isModifier(token)) { + // Eat up all modifiers, but hold on to the last one in case it is actually an identifier + while (ts.isModifierKind(token)) { + idToken = token; nextToken(); } - return isIndexSignature(); - } - function isTypeMemberWithLiteralPropertyName() { - nextToken(); - return token === 17 /* OpenParenToken */ || - token === 25 /* LessThanToken */ || - token === 53 /* QuestionToken */ || - token === 54 /* ColonToken */ || - canParseSemicolon(); + // Index signatures and computed property names are type members + if (token === 19 /* OpenBracketToken */) { + return true; + } + // Try to get the first property-like token following all modifiers + if (isLiteralPropertyName()) { + idToken = token; + nextToken(); + } + // If we were able to get any potential identifier, check that it is + // the start of a member declaration + if (idToken) { + return token === 17 /* OpenParenToken */ || + token === 25 /* LessThanToken */ || + token === 53 /* QuestionToken */ || + token === 54 /* ColonToken */ || + canParseSemicolon(); + } + return false; } function parseTypeMember() { - switch (token) { - case 17 /* OpenParenToken */: - case 25 /* LessThanToken */: - return parseSignatureMember(147 /* CallSignature */); - case 19 /* OpenBracketToken */: - // Indexer or computed property - return isIndexSignature() - ? parseIndexSignatureDeclaration(scanner.getStartPos(), /*decorators*/ undefined, /*modifiers*/ undefined) - : parsePropertyOrMethodSignature(); - case 92 /* NewKeyword */: - if (lookAhead(isStartOfConstructSignature)) { - return parseSignatureMember(148 /* ConstructSignature */); - } - // fall through. - case 9 /* StringLiteral */: - case 8 /* NumericLiteral */: - return parsePropertyOrMethodSignature(); - default: - // Index declaration as allowed as a type member. But as per the grammar, - // they also allow modifiers. So we have to check for an index declaration - // that might be following modifiers. This ensures that things work properly - // when incrementally parsing as the parser will produce the Index declaration - // if it has the same text regardless of whether it is inside a class or an - // object type. - if (ts.isModifier(token)) { - var result = tryParse(parseIndexSignatureWithModifiers); - if (result) { - return result; - } - } - if (ts.tokenIsIdentifierOrKeyword(token)) { - return parsePropertyOrMethodSignature(); - } + if (token === 17 /* OpenParenToken */ || token === 25 /* LessThanToken */) { + return parseSignatureMember(151 /* CallSignature */); } - } - function parseIndexSignatureWithModifiers() { - var fullStart = scanner.getStartPos(); - var decorators = parseDecorators(); + if (token === 92 /* NewKeyword */ && lookAhead(isStartOfConstructSignature)) { + return parseSignatureMember(152 /* ConstructSignature */); + } + var fullStart = getNodePos(); var modifiers = parseModifiers(); - return isIndexSignature() - ? parseIndexSignatureDeclaration(fullStart, decorators, modifiers) - : undefined; + if (isIndexSignature()) { + return parseIndexSignatureDeclaration(fullStart, /*decorators*/ undefined, modifiers); + } + return parsePropertyOrMethodSignature(fullStart, modifiers); } function isStartOfConstructSignature() { nextToken(); return token === 17 /* OpenParenToken */ || token === 25 /* LessThanToken */; } function parseTypeLiteral() { - var node = createNode(155 /* TypeLiteral */); + var node = createNode(159 /* TypeLiteral */); node.members = parseObjectTypeMembers(); return finishNode(node); } @@ -8679,12 +9518,12 @@ var ts; return members; } function parseTupleType() { - var node = createNode(157 /* TupleType */); + var node = createNode(161 /* TupleType */); node.elementTypes = parseBracketedList(19 /* TupleElementTypes */, parseType, 19 /* OpenBracketToken */, 20 /* CloseBracketToken */); return finishNode(node); } function parseParenthesizedType() { - var node = createNode(160 /* ParenthesizedType */); + var node = createNode(164 /* ParenthesizedType */); parseExpected(17 /* OpenParenToken */); node.type = parseType(); parseExpected(18 /* CloseParenToken */); @@ -8692,7 +9531,7 @@ var ts; } function parseFunctionOrConstructorType(kind) { var node = createNode(kind); - if (kind === 153 /* ConstructorType */) { + if (kind === 157 /* ConstructorType */) { parseExpected(92 /* NewKeyword */); } fillSignature(34 /* EqualsGreaterThanToken */, /*yieldContext*/ false, /*awaitContext*/ false, /*requireCompleteParameterList*/ false, node); @@ -8705,18 +9544,29 @@ var ts; function parseNonArrayType() { switch (token) { case 117 /* AnyKeyword */: - case 130 /* StringKeyword */: - case 128 /* NumberKeyword */: + case 132 /* StringKeyword */: + case 130 /* NumberKeyword */: case 120 /* BooleanKeyword */: - case 131 /* SymbolKeyword */: + case 133 /* SymbolKeyword */: + case 135 /* UndefinedKeyword */: + case 127 /* NeverKeyword */: // If these are followed by a dot, then parse these out as a dotted type reference instead. var node = tryParse(parseKeywordAndNoDot); - return node || parseTypeReferenceOrTypePredicate(); + return node || parseTypeReference(); case 9 /* StringLiteral */: - return parseLiteralNode(/*internName*/ true); + return parseStringLiteralTypeNode(); case 103 /* VoidKeyword */: - case 97 /* ThisKeyword */: + case 93 /* NullKeyword */: return parseTokenNode(); + case 97 /* ThisKeyword */: { + var thisKeyword = parseThisTypeNode(); + if (token === 124 /* IsKeyword */ && !scanner.hasPrecedingLineBreak()) { + return parseThisTypePredicate(thisKeyword); + } + else { + return thisKeyword; + } + } case 101 /* TypeOfKeyword */: return parseTypeQuery(); case 15 /* OpenBraceToken */: @@ -8726,19 +9576,22 @@ var ts; case 17 /* OpenParenToken */: return parseParenthesizedType(); default: - return parseTypeReferenceOrTypePredicate(); + return parseTypeReference(); } } function isStartOfType() { switch (token) { case 117 /* AnyKeyword */: - case 130 /* StringKeyword */: - case 128 /* NumberKeyword */: + case 132 /* StringKeyword */: + case 130 /* NumberKeyword */: case 120 /* BooleanKeyword */: - case 131 /* SymbolKeyword */: + case 133 /* SymbolKeyword */: case 103 /* VoidKeyword */: + case 135 /* UndefinedKeyword */: + case 93 /* NullKeyword */: case 97 /* ThisKeyword */: case 101 /* TypeOfKeyword */: + case 127 /* NeverKeyword */: case 15 /* OpenBraceToken */: case 19 /* OpenBracketToken */: case 25 /* LessThanToken */: @@ -8761,7 +9614,7 @@ var ts; var type = parseNonArrayType(); while (!scanner.hasPrecedingLineBreak() && parseOptional(19 /* OpenBracketToken */)) { parseExpected(20 /* CloseBracketToken */); - var node = createNode(156 /* ArrayType */, type.pos); + var node = createNode(160 /* ArrayType */, type.pos); node.elementType = type; type = finishNode(node); } @@ -8783,10 +9636,10 @@ var ts; return type; } function parseIntersectionTypeOrHigher() { - return parseUnionOrIntersectionType(159 /* IntersectionType */, parseArrayTypeOrHigher, 46 /* AmpersandToken */); + return parseUnionOrIntersectionType(163 /* IntersectionType */, parseArrayTypeOrHigher, 46 /* AmpersandToken */); } function parseUnionTypeOrHigher() { - return parseUnionOrIntersectionType(158 /* UnionType */, parseIntersectionTypeOrHigher, 47 /* BarToken */); + return parseUnionOrIntersectionType(162 /* UnionType */, parseIntersectionTypeOrHigher, 47 /* BarToken */); } function isStartOfFunctionType() { if (token === 25 /* LessThanToken */) { @@ -8794,6 +9647,23 @@ var ts; } return token === 17 /* OpenParenToken */ && lookAhead(isUnambiguouslyStartOfFunctionType); } + function skipParameterStart() { + if (ts.isModifierKind(token)) { + // Skip modifiers + parseModifiers(); + } + if (isIdentifier() || token === 97 /* ThisKeyword */) { + nextToken(); + return true; + } + if (token === 19 /* OpenBracketToken */ || token === 15 /* OpenBraceToken */) { + // Return true if we can parse an array or object binding pattern with no errors + var previousErrorCount = parseDiagnostics.length; + parseIdentifierOrPattern(); + return previousErrorCount === parseDiagnostics.length; + } + return false; + } function isUnambiguouslyStartOfFunctionType() { nextToken(); if (token === 18 /* CloseParenToken */ || token === 22 /* DotDotDotToken */) { @@ -8801,39 +9671,58 @@ var ts; // ( ... return true; } - if (isIdentifier() || ts.isModifier(token)) { - nextToken(); + 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 === 54 /* ColonToken */ || token === 24 /* CommaToken */ || - token === 53 /* QuestionToken */ || token === 56 /* EqualsToken */ || - isIdentifier() || ts.isModifier(token)) { - // ( id : - // ( id , - // ( id ? - // ( id = - // ( modifier id + token === 53 /* QuestionToken */ || token === 56 /* EqualsToken */) { + // ( xxx : + // ( xxx , + // ( xxx ? + // ( xxx = return true; } if (token === 18 /* CloseParenToken */) { nextToken(); if (token === 34 /* EqualsGreaterThanToken */) { - // ( id ) => + // ( xxx ) => return true; } } } return false; } + function parseTypeOrTypePredicate() { + var typePredicateVariable = isIdentifier() && tryParse(parseTypePredicatePrefix); + var type = parseType(); + if (typePredicateVariable) { + var node = createNode(154 /* TypePredicate */, typePredicateVariable.pos); + node.parameterName = typePredicateVariable; + node.type = type; + return finishNode(node); + } + else { + return type; + } + } + function parseTypePredicatePrefix() { + var id = parseIdentifier(); + if (token === 124 /* IsKeyword */ && !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(10 /* TypeExcludesFlags */, parseTypeWorker); + return doOutsideOfContext(41943040 /* TypeExcludesFlags */, parseTypeWorker); } function parseTypeWorker() { if (isStartOfFunctionType()) { - return parseFunctionOrConstructorType(152 /* FunctionType */); + return parseFunctionOrConstructorType(156 /* FunctionType */); } if (token === 92 /* NewKeyword */) { - return parseFunctionOrConstructorType(153 /* ConstructorType */); + return parseFunctionOrConstructorType(157 /* ConstructorType */); } return parseUnionTypeOrHigher(); } @@ -8906,9 +9795,6 @@ var ts; token !== 55 /* AtToken */ && isStartOfExpression(); } - function allowInAndParseExpression() { - return allowInAnd(parseExpression); - } function parseExpression() { // Expression[in]: // AssignmentExpression[in] @@ -8916,7 +9802,7 @@ var ts; // clear the decorator context when parsing Expression, as it should be unambiguous when parsing a decorator var saveDecoratorContext = inDecoratorContext(); if (saveDecoratorContext) { - setDecoratorContext(false); + setDecoratorContext(/*val*/ false); } var expr = parseAssignmentExpressionOrHigher(); var operatorToken; @@ -8924,7 +9810,7 @@ var ts; expr = makeBinaryExpression(expr, operatorToken, parseAssignmentExpressionOrHigher()); } if (saveDecoratorContext) { - setDecoratorContext(true); + setDecoratorContext(/*val*/ true); } return expr; } @@ -8955,7 +9841,8 @@ var ts; // 2) LeftHandSideExpression = AssignmentExpression[?in,?yield] // 3) LeftHandSideExpression AssignmentOperator AssignmentExpression[?in,?yield] // 4) ArrowFunctionExpression[?in,?yield] - // 5) [+Yield] YieldExpression[?In] + // 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). @@ -8963,11 +9850,18 @@ var ts; if (isYieldExpression()) { return parseYieldExpression(); } - // Then, check if we have an arrow function (production '4') that starts with a parenthesized - // parameter list. If we do, we must *not* recurse for productions 1, 2 or 3. An ArrowFunction is + // 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(); + var arrowExpression = tryParseParenthesizedArrowFunctionExpression() || tryParseAsyncSimpleArrowFunctionExpression(); if (arrowExpression) { return arrowExpression; } @@ -9001,7 +9895,7 @@ var ts; } function isYieldExpression() { if (token === 114 /* YieldKeyword */) { - // If we have a 'yield' keyword, and htis is a context where yield expressions are + // If we have a 'yield' keyword, and this is a context where yield expressions are // allowed, then definitely parse out a yield expression. if (inYieldContext()) { return true; @@ -9019,7 +9913,7 @@ var ts; // // 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 accidently consume something legal. + // don't accidentally consume something legal. return lookAhead(nextTokenIsIdentifierOrKeywordOrNumberOnSameLine); } return false; @@ -9029,7 +9923,7 @@ var ts; return !scanner.hasPrecedingLineBreak() && isIdentifier(); } function parseYieldExpression() { - var node = createNode(184 /* YieldExpression */); + var node = createNode(190 /* YieldExpression */); // YieldExpression[In] : // yield // yield [no LineTerminator here] [Lexical goal InputElementRegExp]AssignmentExpression[?In, Yield] @@ -9043,21 +9937,28 @@ var ts; } else { // if the next token is not on the same line as yield. or we don't have an '*' or - // the start of an expressin, then this is just a simple "yield" expression. + // the start of an expression, then this is just a simple "yield" expression. return finishNode(node); } } - function parseSimpleArrowFunctionExpression(identifier) { + function parseSimpleArrowFunctionExpression(identifier, asyncModifier) { ts.Debug.assert(token === 34 /* EqualsGreaterThanToken */, "parseSimpleArrowFunctionExpression should only have been called if we had a =>"); - var node = createNode(174 /* ArrowFunction */, identifier.pos); - var parameter = createNode(138 /* Parameter */, identifier.pos); + var node; + if (asyncModifier) { + node = createNode(180 /* ArrowFunction */, asyncModifier.pos); + setModifiers(node, asyncModifier); + } + else { + node = createNode(180 /* ArrowFunction */, identifier.pos); + } + var parameter = createNode(142 /* Parameter */, identifier.pos); parameter.name = identifier; finishNode(parameter); node.parameters = [parameter]; node.parameters.pos = parameter.pos; node.parameters.end = parameter.end; - node.equalsGreaterThanToken = parseExpectedToken(34 /* EqualsGreaterThanToken */, false, ts.Diagnostics._0_expected, "=>"); - node.body = parseArrowFunctionExpressionBody(/*isAsync*/ false); + node.equalsGreaterThanToken = parseExpectedToken(34 /* EqualsGreaterThanToken */, /*reportAtCurrentPosition*/ false, ts.Diagnostics._0_expected, "=>"); + node.body = parseArrowFunctionExpressionBody(/*isAsync*/ !!asyncModifier); return finishNode(node); } function tryParseParenthesizedArrowFunctionExpression() { @@ -9160,7 +10061,7 @@ var ts; return 1 /* True */; } // This *could* be a parenthesized arrow function. - // Return Unknown to const the caller know. + // Return Unknown to let the caller know. return 2 /* Unknown */; } else { @@ -9201,8 +10102,39 @@ var ts; function parsePossibleParenthesizedArrowFunctionExpressionHead() { return parseParenthesizedArrowFunctionExpressionHead(/*allowAmbiguity*/ false); } + function tryParseAsyncSimpleArrowFunctionExpression() { + // We do a check here so that we won't be doing unnecessarily call to "lookAhead" + if (token === 118 /* AsyncKeyword */) { + var isUnParenthesizedAsyncArrowFunction = lookAhead(isUnParenthesizedAsyncArrowFunctionWorker); + if (isUnParenthesizedAsyncArrowFunction === 1 /* True */) { + var asyncModifier = parseModifiersForArrowFunction(); + var expr = parseBinaryExpressionOrHigher(/*precedence*/ 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 === 118 /* AsyncKeyword */) { + nextToken(); + // If the "async" is followed by "=>" token then it is not a begining of an async arrow-function + // but instead a simple arrow-function which will be parsed inside "parseAssignmentExpressionOrHigher" + if (scanner.hasPrecedingLineBreak() || token === 34 /* EqualsGreaterThanToken */) { + return 0 /* False */; + } + // Check for un-parenthesized AsyncArrowFunction + var expr = parseBinaryExpressionOrHigher(/*precedence*/ 0); + if (!scanner.hasPrecedingLineBreak() && expr.kind === 69 /* Identifier */ && token === 34 /* EqualsGreaterThanToken */) { + return 1 /* True */; + } + } + return 0 /* False */; + } function parseParenthesizedArrowFunctionExpressionHead(allowAmbiguity) { - var node = createNode(174 /* ArrowFunction */); + var node = createNode(180 /* ArrowFunction */); setModifiers(node, parseModifiersForArrowFunction()); var isAsync = !!(node.flags & 256 /* Async */); // Arrow functions are never generators. @@ -9246,7 +10178,7 @@ var ts; // user meant to supply a block. For example, if the user wrote: // // a => - // const v = 0; + // let v = 0; // } // // they may be missing an open brace. Check to see if that's the case so we can @@ -9268,7 +10200,7 @@ var ts; } // Note: we explicitly 'allowIn' in the whenTrue part of the condition expression, and // we do not that for the 'whenFalse' part. - var node = createNode(182 /* ConditionalExpression */, leftOperand.pos); + var node = createNode(188 /* ConditionalExpression */, leftOperand.pos); node.condition = leftOperand; node.questionToken = questionToken; node.whenTrue = doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher); @@ -9281,7 +10213,7 @@ var ts; return parseBinaryExpressionRest(precedence, leftOperand); } function isInOrOfKeyword(t) { - return t === 90 /* InKeyword */ || t === 134 /* OfKeyword */; + return t === 90 /* InKeyword */ || t === 138 /* OfKeyword */; } function parseBinaryExpressionRest(precedence, leftOperand) { while (true) { @@ -9292,7 +10224,7 @@ var ts; // 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 precendence of the operator is greater then or equal to the current precendence. + // 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 @@ -9301,8 +10233,8 @@ var ts; // 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 precendence of - // the operator is strictly grater than the current precendence + // 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 @@ -9389,39 +10321,39 @@ var ts; return -1; } function makeBinaryExpression(left, operatorToken, right) { - var node = createNode(181 /* BinaryExpression */, left.pos); + var node = createNode(187 /* BinaryExpression */, left.pos); node.left = left; node.operatorToken = operatorToken; node.right = right; return finishNode(node); } function makeAsExpression(left, right) { - var node = createNode(189 /* AsExpression */, left.pos); + var node = createNode(195 /* AsExpression */, left.pos); node.expression = left; node.type = right; return finishNode(node); } function parsePrefixUnaryExpression() { - var node = createNode(179 /* PrefixUnaryExpression */); + var node = createNode(185 /* PrefixUnaryExpression */); node.operator = token; nextToken(); node.operand = parseSimpleUnaryExpression(); return finishNode(node); } function parseDeleteExpression() { - var node = createNode(175 /* DeleteExpression */); + var node = createNode(181 /* DeleteExpression */); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); } function parseTypeOfExpression() { - var node = createNode(176 /* TypeOfExpression */); + var node = createNode(182 /* TypeOfExpression */); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); } function parseVoidExpression() { - var node = createNode(177 /* VoidExpression */); + var node = createNode(183 /* VoidExpression */); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); @@ -9437,7 +10369,7 @@ var ts; return false; } function parseAwaitExpression() { - var node = createNode(178 /* AwaitExpression */); + var node = createNode(184 /* AwaitExpression */); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); @@ -9463,7 +10395,7 @@ var ts; var simpleUnaryExpression = parseSimpleUnaryExpression(); if (token === 38 /* AsteriskAsteriskToken */) { var start = ts.skipTrivia(sourceText, simpleUnaryExpression.pos); - if (simpleUnaryExpression.kind === 171 /* TypeAssertionExpression */) { + if (simpleUnaryExpression.kind === 177 /* TypeAssertionExpression */) { parseErrorAtPosition(start, simpleUnaryExpression.end - start, 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 { @@ -9519,7 +10451,7 @@ var ts; */ function isIncrementExpression() { // This function is called inside parseUnaryExpression to decide - // whether to call parseSimpleUnaryExpression or call parseIncrmentExpression directly + // whether to call parseSimpleUnaryExpression or call parseIncrementExpression directly switch (token) { case 35 /* PlusToken */: case 36 /* MinusToken */: @@ -9553,7 +10485,7 @@ var ts; */ function parseIncrementExpression() { if (token === 41 /* PlusPlusToken */ || token === 42 /* MinusMinusToken */) { - var node = createNode(179 /* PrefixUnaryExpression */); + var node = createNode(185 /* PrefixUnaryExpression */); node.operator = token; nextToken(); node.operand = parseLeftHandSideExpressionOrHigher(); @@ -9566,7 +10498,7 @@ var ts; var expression = parseLeftHandSideExpressionOrHigher(); ts.Debug.assert(ts.isLeftHandSideExpression(expression)); if ((token === 41 /* PlusPlusToken */ || token === 42 /* MinusMinusToken */) && !scanner.hasPrecedingLineBreak()) { - var node = createNode(180 /* PostfixUnaryExpression */, expression.pos); + var node = createNode(186 /* PostfixUnaryExpression */, expression.pos); node.operand = expression; node.operator = token; nextToken(); @@ -9670,24 +10602,37 @@ var ts; } // 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(166 /* PropertyAccessExpression */, expression.pos); + var node = createNode(172 /* PropertyAccessExpression */, expression.pos); node.expression = expression; node.dotToken = parseExpectedToken(21 /* DotToken */, /*reportAtCurrentPosition*/ false, ts.Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access); node.name = parseRightSideOfDot(/*allowIdentifierNames*/ true); return finishNode(node); } + function tagNamesAreEquivalent(lhs, rhs) { + if (lhs.kind !== rhs.kind) { + return false; + } + if (lhs.kind === 69 /* Identifier */) { + return lhs.text === rhs.text; + } + return lhs.right.text === rhs.right.text && + tagNamesAreEquivalent(lhs.left, rhs.left); + } function parseJsxElementOrSelfClosingElement(inExpressionContext) { var opening = parseJsxOpeningOrSelfClosingElement(inExpressionContext); var result; - if (opening.kind === 235 /* JsxOpeningElement */) { - var node = createNode(233 /* JsxElement */, opening.pos); + if (opening.kind === 243 /* JsxOpeningElement */) { + var node = createNode(241 /* JsxElement */, opening.pos); node.openingElement = opening; node.children = parseJsxChildren(node.openingElement.tagName); node.closingElement = parseJsxClosingElement(inExpressionContext); + if (!tagNamesAreEquivalent(node.openingElement.tagName, node.closingElement.tagName)) { + parseErrorAtPosition(node.closingElement.pos, node.closingElement.end - node.closingElement.pos, ts.Diagnostics.Expected_corresponding_JSX_closing_tag_for_0, ts.getTextOfNodeFromSourceText(sourceText, node.openingElement.tagName)); + } result = finishNode(node); } else { - ts.Debug.assert(opening.kind === 234 /* JsxSelfClosingElement */); + ts.Debug.assert(opening.kind === 242 /* JsxSelfClosingElement */); // Nothing else to do for self-closing elements result = opening; } @@ -9702,7 +10647,7 @@ var ts; var invalidElement = tryParse(function () { return parseJsxElementOrSelfClosingElement(/*inExpressionContext*/ true); }); if (invalidElement) { parseErrorAtCurrentToken(ts.Diagnostics.JSX_expressions_must_have_one_parent_element); - var badNode = createNode(181 /* BinaryExpression */, result.pos); + var badNode = createNode(187 /* BinaryExpression */, result.pos); badNode.end = invalidElement.end; badNode.left = result; badNode.right = invalidElement; @@ -9714,13 +10659,13 @@ var ts; return result; } function parseJsxText() { - var node = createNode(236 /* JsxText */, scanner.getStartPos()); + var node = createNode(244 /* JsxText */, scanner.getStartPos()); token = scanner.scanJsxToken(); return finishNode(node); } function parseJsxChild() { switch (token) { - case 236 /* JsxText */: + case 244 /* JsxText */: return parseJsxText(); case 15 /* OpenBraceToken */: return parseJsxExpression(/*inExpressionContext*/ false); @@ -9737,10 +10682,13 @@ var ts; while (true) { token = scanner.reScanJsxToken(); if (token === 26 /* LessThanSlashToken */) { + // Closing tag break; } else if (token === 1 /* EndOfFileToken */) { - parseErrorAtCurrentToken(ts.Diagnostics.Expected_corresponding_JSX_closing_tag_for_0, ts.getTextOfNodeFromSourceText(sourceText, openingTagName)); + // 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) + parseErrorAtPosition(openingTagName.pos, openingTagName.end - openingTagName.pos, ts.Diagnostics.JSX_element_0_has_no_corresponding_closing_tag, ts.getTextOfNodeFromSourceText(sourceText, openingTagName)); break; } result.push(parseJsxChild()); @@ -9759,7 +10707,7 @@ var ts; // 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(235 /* JsxOpeningElement */, fullStart); + node = createNode(243 /* JsxOpeningElement */, fullStart); scanJsxText(); } else { @@ -9768,10 +10716,10 @@ var ts; parseExpected(27 /* GreaterThanToken */); } else { - parseExpected(27 /* GreaterThanToken */, /*diagnostic*/ undefined, /*advance*/ false); + parseExpected(27 /* GreaterThanToken */, /*diagnostic*/ undefined, /*shouldAdvance*/ false); scanJsxText(); } - node = createNode(234 /* JsxSelfClosingElement */, fullStart); + node = createNode(242 /* JsxSelfClosingElement */, fullStart); } node.tagName = tagName; node.attributes = attributes; @@ -9782,7 +10730,7 @@ var ts; var elementName = parseIdentifierName(); while (parseOptional(21 /* DotToken */)) { scanJsxIdentifier(); - var node = createNode(135 /* QualifiedName */, elementName.pos); + var node = createNode(139 /* QualifiedName */, elementName.pos); // !!! node.left = elementName; node.right = parseIdentifierName(); elementName = finishNode(node); @@ -9790,16 +10738,16 @@ var ts; return elementName; } function parseJsxExpression(inExpressionContext) { - var node = createNode(240 /* JsxExpression */); + var node = createNode(248 /* JsxExpression */); parseExpected(15 /* OpenBraceToken */); if (token !== 16 /* CloseBraceToken */) { - node.expression = parseExpression(); + node.expression = parseAssignmentExpressionOrHigher(); } if (inExpressionContext) { parseExpected(16 /* CloseBraceToken */); } else { - parseExpected(16 /* CloseBraceToken */, /*message*/ undefined, /*advance*/ false); + parseExpected(16 /* CloseBraceToken */, /*message*/ undefined, /*shouldAdvance*/ false); scanJsxText(); } return finishNode(node); @@ -9809,7 +10757,7 @@ var ts; return parseJsxSpreadAttribute(); } scanJsxIdentifier(); - var node = createNode(238 /* JsxAttribute */); + var node = createNode(246 /* JsxAttribute */); node.name = parseIdentifierName(); if (parseOptional(56 /* EqualsToken */)) { switch (token) { @@ -9824,7 +10772,7 @@ var ts; return finishNode(node); } function parseJsxSpreadAttribute() { - var node = createNode(239 /* JsxSpreadAttribute */); + var node = createNode(247 /* JsxSpreadAttribute */); parseExpected(15 /* OpenBraceToken */); parseExpected(22 /* DotDotDotToken */); node.expression = parseExpression(); @@ -9832,20 +10780,20 @@ var ts; return finishNode(node); } function parseJsxClosingElement(inExpressionContext) { - var node = createNode(237 /* JsxClosingElement */); + var node = createNode(245 /* JsxClosingElement */); parseExpected(26 /* LessThanSlashToken */); node.tagName = parseJsxElementName(); if (inExpressionContext) { parseExpected(27 /* GreaterThanToken */); } else { - parseExpected(27 /* GreaterThanToken */, /*diagnostic*/ undefined, /*advance*/ false); + parseExpected(27 /* GreaterThanToken */, /*diagnostic*/ undefined, /*shouldAdvance*/ false); scanJsxText(); } return finishNode(node); } function parseTypeAssertion() { - var node = createNode(171 /* TypeAssertionExpression */); + var node = createNode(177 /* TypeAssertionExpression */); parseExpected(25 /* LessThanToken */); node.type = parseType(); parseExpected(27 /* GreaterThanToken */); @@ -9856,16 +10804,23 @@ var ts; while (true) { var dotToken = parseOptionalToken(21 /* DotToken */); if (dotToken) { - var propertyAccess = createNode(166 /* PropertyAccessExpression */, expression.pos); + var propertyAccess = createNode(172 /* PropertyAccessExpression */, expression.pos); propertyAccess.expression = expression; propertyAccess.dotToken = dotToken; propertyAccess.name = parseRightSideOfDot(/*allowIdentifierNames*/ true); expression = finishNode(propertyAccess); continue; } + if (token === 49 /* ExclamationToken */ && !scanner.hasPrecedingLineBreak()) { + nextToken(); + var nonNullExpression = createNode(196 /* NonNullExpression */, 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(19 /* OpenBracketToken */)) { - var indexedAccess = createNode(167 /* ElementAccessExpression */, expression.pos); + var indexedAccess = createNode(173 /* ElementAccessExpression */, expression.pos); indexedAccess.expression = expression; // It's not uncommon for a user to write: "new Type[]". // Check for that common pattern and report a better error message. @@ -9881,7 +10836,7 @@ var ts; continue; } if (token === 11 /* NoSubstitutionTemplateLiteral */ || token === 12 /* TemplateHead */) { - var tagExpression = createNode(170 /* TaggedTemplateExpression */, expression.pos); + var tagExpression = createNode(176 /* TaggedTemplateExpression */, expression.pos); tagExpression.tag = expression; tagExpression.template = token === 11 /* NoSubstitutionTemplateLiteral */ ? parseLiteralNode() @@ -9904,7 +10859,7 @@ var ts; if (!typeArguments) { return expression; } - var callExpr = createNode(168 /* CallExpression */, expression.pos); + var callExpr = createNode(174 /* CallExpression */, expression.pos); callExpr.expression = expression; callExpr.typeArguments = typeArguments; callExpr.arguments = parseArgumentList(); @@ -9912,7 +10867,7 @@ var ts; continue; } else if (token === 17 /* OpenParenToken */) { - var callExpr = createNode(168 /* CallExpression */, expression.pos); + var callExpr = createNode(174 /* CallExpression */, expression.pos); callExpr.expression = expression; callExpr.arguments = parseArgumentList(); expression = finishNode(callExpr); @@ -9936,7 +10891,7 @@ var ts; // If it doesn't have the closing > then it's definitely not an type argument list. return undefined; } - // If we have a '<', then only parse this as a arugment list if the type arguments + // 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 @@ -10022,41 +10977,42 @@ var ts; return parseIdentifier(ts.Diagnostics.Expression_expected); } function parseParenthesizedExpression() { - var node = createNode(172 /* ParenthesizedExpression */); + var node = createNode(178 /* ParenthesizedExpression */); parseExpected(17 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); parseExpected(18 /* CloseParenToken */); return finishNode(node); } function parseSpreadElement() { - var node = createNode(185 /* SpreadElementExpression */); + var node = createNode(191 /* SpreadElementExpression */); parseExpected(22 /* DotDotDotToken */); node.expression = parseAssignmentExpressionOrHigher(); return finishNode(node); } function parseArgumentOrArrayLiteralElement() { return token === 22 /* DotDotDotToken */ ? parseSpreadElement() : - token === 24 /* CommaToken */ ? createNode(187 /* OmittedExpression */) : + token === 24 /* CommaToken */ ? createNode(193 /* OmittedExpression */) : parseAssignmentExpressionOrHigher(); } function parseArgumentExpression() { return doOutsideOfContext(disallowInAndDecoratorContext, parseArgumentOrArrayLiteralElement); } function parseArrayLiteralExpression() { - var node = createNode(164 /* ArrayLiteralExpression */); + var node = createNode(170 /* ArrayLiteralExpression */); parseExpected(19 /* OpenBracketToken */); - if (scanner.hasPrecedingLineBreak()) - node.flags |= 1024 /* MultiLine */; + if (scanner.hasPrecedingLineBreak()) { + node.multiLine = true; + } node.elements = parseDelimitedList(15 /* ArrayLiteralMembers */, parseArgumentOrArrayLiteralElement); parseExpected(20 /* CloseBracketToken */); return finishNode(node); } function tryParseAccessorDeclaration(fullStart, decorators, modifiers) { if (parseContextualModifier(123 /* GetKeyword */)) { - return parseAccessorDeclaration(145 /* GetAccessor */, fullStart, decorators, modifiers); + return addJSDocComment(parseAccessorDeclaration(149 /* GetAccessor */, fullStart, decorators, modifiers)); } - else if (parseContextualModifier(129 /* SetKeyword */)) { - return parseAccessorDeclaration(146 /* SetAccessor */, fullStart, decorators, modifiers); + else if (parseContextualModifier(131 /* SetKeyword */)) { + return parseAccessorDeclaration(150 /* SetAccessor */, fullStart, decorators, modifiers); } return undefined; } @@ -10070,7 +11026,6 @@ var ts; } var asteriskToken = parseOptionalToken(37 /* AsteriskToken */); var tokenIsIdentifier = isIdentifier(); - var nameToken = token; var propertyName = parsePropertyName(); // Disallowing of optional property assignments happens in the grammar checker. var questionToken = parseOptionalToken(53 /* QuestionToken */); @@ -10084,7 +11039,7 @@ var ts; // this is necessary because ObjectLiteral productions are also used to cover grammar for ObjectAssignmentPattern var isShorthandPropertyAssignment = tokenIsIdentifier && (token === 24 /* CommaToken */ || token === 16 /* CloseBraceToken */ || token === 56 /* EqualsToken */); if (isShorthandPropertyAssignment) { - var shorthandDeclaration = createNode(246 /* ShorthandPropertyAssignment */, fullStart); + var shorthandDeclaration = createNode(254 /* ShorthandPropertyAssignment */, fullStart); shorthandDeclaration.name = propertyName; shorthandDeclaration.questionToken = questionToken; var equalsToken = parseOptionalToken(56 /* EqualsToken */); @@ -10092,24 +11047,25 @@ var ts; shorthandDeclaration.equalsToken = equalsToken; shorthandDeclaration.objectAssignmentInitializer = allowInAnd(parseAssignmentExpressionOrHigher); } - return finishNode(shorthandDeclaration); + return addJSDocComment(finishNode(shorthandDeclaration)); } else { - var propertyAssignment = createNode(245 /* PropertyAssignment */, fullStart); + var propertyAssignment = createNode(253 /* PropertyAssignment */, fullStart); + propertyAssignment.modifiers = modifiers; propertyAssignment.name = propertyName; propertyAssignment.questionToken = questionToken; parseExpected(54 /* ColonToken */); propertyAssignment.initializer = allowInAnd(parseAssignmentExpressionOrHigher); - return finishNode(propertyAssignment); + return addJSDocComment(finishNode(propertyAssignment)); } } function parseObjectLiteralExpression() { - var node = createNode(165 /* ObjectLiteralExpression */); + var node = createNode(171 /* ObjectLiteralExpression */); parseExpected(15 /* OpenBraceToken */); if (scanner.hasPrecedingLineBreak()) { - node.flags |= 1024 /* MultiLine */; + node.multiLine = true; } - node.properties = parseDelimitedList(12 /* ObjectLiteralMembers */, parseObjectLiteralElement, /*considerSemicolonAsDelimeter*/ true); + node.properties = parseDelimitedList(12 /* ObjectLiteralMembers */, parseObjectLiteralElement, /*considerSemicolonAsDelimiter*/ true); parseExpected(16 /* CloseBraceToken */); return finishNode(node); } @@ -10121,9 +11077,9 @@ var ts; // function BindingIdentifier[opt](FormalParameters){ FunctionBody } var saveDecoratorContext = inDecoratorContext(); if (saveDecoratorContext) { - setDecoratorContext(false); + setDecoratorContext(/*val*/ false); } - var node = createNode(173 /* FunctionExpression */); + var node = createNode(179 /* FunctionExpression */); setModifiers(node, parseModifiers()); parseExpected(87 /* FunctionKeyword */); node.asteriskToken = parseOptionalToken(37 /* AsteriskToken */); @@ -10137,15 +11093,15 @@ var ts; fillSignature(54 /* ColonToken */, /*yieldContext*/ isGenerator, /*awaitContext*/ isAsync, /*requireCompleteParameterList*/ false, node); node.body = parseFunctionBlock(/*allowYield*/ isGenerator, /*allowAwait*/ isAsync, /*ignoreMissingOpenBrace*/ false); if (saveDecoratorContext) { - setDecoratorContext(true); + setDecoratorContext(/*val*/ true); } - return finishNode(node); + return addJSDocComment(finishNode(node)); } function parseOptionalIdentifier() { return isIdentifier() ? parseIdentifier() : undefined; } function parseNewExpression() { - var node = createNode(169 /* NewExpression */); + var node = createNode(175 /* NewExpression */); parseExpected(92 /* NewKeyword */); node.expression = parseMemberExpressionOrHigher(); node.typeArguments = tryParse(parseTypeArgumentsInExpression); @@ -10156,7 +11112,7 @@ var ts; } // STATEMENTS function parseBlock(ignoreMissingOpenBrace, diagnosticMessage) { - var node = createNode(192 /* Block */); + var node = createNode(199 /* Block */); if (parseExpected(15 /* OpenBraceToken */, diagnosticMessage) || ignoreMissingOpenBrace) { node.statements = parseList(1 /* BlockStatements */, parseStatement); parseExpected(16 /* CloseBraceToken */); @@ -10175,23 +11131,23 @@ var ts; // arrow function. The body of the function is not in [Decorator] context. var saveDecoratorContext = inDecoratorContext(); if (saveDecoratorContext) { - setDecoratorContext(false); + setDecoratorContext(/*val*/ false); } var block = parseBlock(ignoreMissingOpenBrace, diagnosticMessage); if (saveDecoratorContext) { - setDecoratorContext(true); + setDecoratorContext(/*val*/ true); } setYieldContext(savedYieldContext); setAwaitContext(savedAwaitContext); return block; } function parseEmptyStatement() { - var node = createNode(194 /* EmptyStatement */); + var node = createNode(201 /* EmptyStatement */); parseExpected(23 /* SemicolonToken */); return finishNode(node); } function parseIfStatement() { - var node = createNode(196 /* IfStatement */); + var node = createNode(203 /* IfStatement */); parseExpected(88 /* IfKeyword */); parseExpected(17 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); @@ -10201,7 +11157,7 @@ var ts; return finishNode(node); } function parseDoStatement() { - var node = createNode(197 /* DoStatement */); + var node = createNode(204 /* DoStatement */); parseExpected(79 /* DoKeyword */); node.statement = parseStatement(); parseExpected(104 /* WhileKeyword */); @@ -10216,7 +11172,7 @@ var ts; return finishNode(node); } function parseWhileStatement() { - var node = createNode(198 /* WhileStatement */); + var node = createNode(205 /* WhileStatement */); parseExpected(104 /* WhileKeyword */); parseExpected(17 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); @@ -10239,21 +11195,21 @@ var ts; } var forOrForInOrForOfStatement; if (parseOptional(90 /* InKeyword */)) { - var forInStatement = createNode(200 /* ForInStatement */, pos); + var forInStatement = createNode(207 /* ForInStatement */, pos); forInStatement.initializer = initializer; forInStatement.expression = allowInAnd(parseExpression); parseExpected(18 /* CloseParenToken */); forOrForInOrForOfStatement = forInStatement; } - else if (parseOptional(134 /* OfKeyword */)) { - var forOfStatement = createNode(201 /* ForOfStatement */, pos); + else if (parseOptional(138 /* OfKeyword */)) { + var forOfStatement = createNode(208 /* ForOfStatement */, pos); forOfStatement.initializer = initializer; forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher); parseExpected(18 /* CloseParenToken */); forOrForInOrForOfStatement = forOfStatement; } else { - var forStatement = createNode(199 /* ForStatement */, pos); + var forStatement = createNode(206 /* ForStatement */, pos); forStatement.initializer = initializer; parseExpected(23 /* SemicolonToken */); if (token !== 23 /* SemicolonToken */ && token !== 18 /* CloseParenToken */) { @@ -10271,7 +11227,7 @@ var ts; } function parseBreakOrContinueStatement(kind) { var node = createNode(kind); - parseExpected(kind === 203 /* BreakStatement */ ? 70 /* BreakKeyword */ : 75 /* ContinueKeyword */); + parseExpected(kind === 210 /* BreakStatement */ ? 70 /* BreakKeyword */ : 75 /* ContinueKeyword */); if (!canParseSemicolon()) { node.label = parseIdentifier(); } @@ -10279,7 +11235,7 @@ var ts; return finishNode(node); } function parseReturnStatement() { - var node = createNode(204 /* ReturnStatement */); + var node = createNode(211 /* ReturnStatement */); parseExpected(94 /* ReturnKeyword */); if (!canParseSemicolon()) { node.expression = allowInAnd(parseExpression); @@ -10288,7 +11244,7 @@ var ts; return finishNode(node); } function parseWithStatement() { - var node = createNode(205 /* WithStatement */); + var node = createNode(212 /* WithStatement */); parseExpected(105 /* WithKeyword */); parseExpected(17 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); @@ -10297,7 +11253,7 @@ var ts; return finishNode(node); } function parseCaseClause() { - var node = createNode(241 /* CaseClause */); + var node = createNode(249 /* CaseClause */); parseExpected(71 /* CaseKeyword */); node.expression = allowInAnd(parseExpression); parseExpected(54 /* ColonToken */); @@ -10305,7 +11261,7 @@ var ts; return finishNode(node); } function parseDefaultClause() { - var node = createNode(242 /* DefaultClause */); + var node = createNode(250 /* DefaultClause */); parseExpected(77 /* DefaultKeyword */); parseExpected(54 /* ColonToken */); node.statements = parseList(3 /* SwitchClauseStatements */, parseStatement); @@ -10315,12 +11271,12 @@ var ts; return token === 71 /* CaseKeyword */ ? parseCaseClause() : parseDefaultClause(); } function parseSwitchStatement() { - var node = createNode(206 /* SwitchStatement */); + var node = createNode(213 /* SwitchStatement */); parseExpected(96 /* SwitchKeyword */); parseExpected(17 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); parseExpected(18 /* CloseParenToken */); - var caseBlock = createNode(220 /* CaseBlock */, scanner.getStartPos()); + var caseBlock = createNode(227 /* CaseBlock */, scanner.getStartPos()); parseExpected(15 /* OpenBraceToken */); caseBlock.clauses = parseList(2 /* SwitchClauses */, parseCaseOrDefaultClause); parseExpected(16 /* CloseBraceToken */); @@ -10335,7 +11291,7 @@ var ts; // directly as that might consume an expression on the following line. // We just return 'undefined' in that case. The actual error will be reported in the // grammar walker. - var node = createNode(208 /* ThrowStatement */); + var node = createNode(215 /* ThrowStatement */); parseExpected(98 /* ThrowKeyword */); node.expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression); parseSemicolon(); @@ -10343,7 +11299,7 @@ var ts; } // TODO: Review for error recovery function parseTryStatement() { - var node = createNode(209 /* TryStatement */); + var node = createNode(216 /* TryStatement */); parseExpected(100 /* TryKeyword */); node.tryBlock = parseBlock(/*ignoreMissingOpenBrace*/ false); node.catchClause = token === 72 /* CatchKeyword */ ? parseCatchClause() : undefined; @@ -10356,7 +11312,7 @@ var ts; return finishNode(node); } function parseCatchClause() { - var result = createNode(244 /* CatchClause */); + var result = createNode(252 /* CatchClause */); parseExpected(72 /* CatchKeyword */); if (parseExpected(17 /* OpenParenToken */)) { result.variableDeclaration = parseVariableDeclaration(); @@ -10366,7 +11322,7 @@ var ts; return finishNode(result); } function parseDebuggerStatement() { - var node = createNode(210 /* DebuggerStatement */); + var node = createNode(217 /* DebuggerStatement */); parseExpected(76 /* DebuggerKeyword */); parseSemicolon(); return finishNode(node); @@ -10378,16 +11334,16 @@ var ts; var fullStart = scanner.getStartPos(); var expression = allowInAnd(parseExpression); if (expression.kind === 69 /* Identifier */ && parseOptional(54 /* ColonToken */)) { - var labeledStatement = createNode(207 /* LabeledStatement */, fullStart); + var labeledStatement = createNode(214 /* LabeledStatement */, fullStart); labeledStatement.label = expression; labeledStatement.statement = parseStatement(); - return finishNode(labeledStatement); + return addJSDocComment(finishNode(labeledStatement)); } else { - var expressionStatement = createNode(195 /* ExpressionStatement */, fullStart); + var expressionStatement = createNode(202 /* ExpressionStatement */, fullStart); expressionStatement.expression = expression; parseSemicolon(); - return finishNode(expressionStatement); + return addJSDocComment(finishNode(expressionStatement)); } } function nextTokenIsIdentifierOrKeywordOnSameLine() { @@ -10434,7 +11390,7 @@ var ts; // // could be legal, it would add complexity for very little gain. case 107 /* InterfaceKeyword */: - case 132 /* TypeKeyword */: + case 134 /* TypeKeyword */: return nextTokenIsIdentifierOnSameLine(); case 125 /* ModuleKeyword */: case 126 /* NamespaceKeyword */: @@ -10445,12 +11401,16 @@ var ts; case 110 /* PrivateKeyword */: case 111 /* ProtectedKeyword */: case 112 /* PublicKeyword */: + case 128 /* ReadonlyKeyword */: nextToken(); // ASI takes effect for this modifier. if (scanner.hasPrecedingLineBreak()) { return false; } continue; + case 137 /* GlobalKeyword */: + nextToken(); + return token === 15 /* OpenBraceToken */ || token === 69 /* Identifier */ || token === 82 /* ExportKeyword */; case 89 /* ImportKeyword */: nextToken(); return token === 9 /* StringLiteral */ || token === 37 /* AsteriskToken */ || @@ -10458,7 +11418,8 @@ var ts; case 82 /* ExportKeyword */: nextToken(); if (token === 56 /* EqualsToken */ || token === 37 /* AsteriskToken */ || - token === 15 /* OpenBraceToken */ || token === 77 /* DefaultKeyword */) { + token === 15 /* OpenBraceToken */ || token === 77 /* DefaultKeyword */ || + token === 116 /* AsKeyword */) { return true; } continue; @@ -10509,13 +11470,15 @@ var ts; case 107 /* InterfaceKeyword */: case 125 /* ModuleKeyword */: case 126 /* NamespaceKeyword */: - case 132 /* TypeKeyword */: + case 134 /* TypeKeyword */: + case 137 /* GlobalKeyword */: // When these don't start a declaration, they're an identifier in an expression statement return true; case 112 /* PublicKeyword */: case 110 /* PrivateKeyword */: case 111 /* ProtectedKeyword */: case 113 /* StaticKeyword */: + case 128 /* ReadonlyKeyword */: // When these don't start a declaration, they may be the start of a class member if an identifier // immediately follows. Otherwise they're an identifier in an expression statement. return isStartOfDeclaration() || !lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine); @@ -10558,9 +11521,9 @@ var ts; case 86 /* ForKeyword */: return parseForOrForInOrForOfStatement(); case 75 /* ContinueKeyword */: - return parseBreakOrContinueStatement(202 /* ContinueStatement */); + return parseBreakOrContinueStatement(209 /* ContinueStatement */); case 70 /* BreakKeyword */: - return parseBreakOrContinueStatement(203 /* BreakStatement */); + return parseBreakOrContinueStatement(210 /* BreakStatement */); case 94 /* ReturnKeyword */: return parseReturnStatement(); case 105 /* WithKeyword */: @@ -10580,7 +11543,7 @@ var ts; return parseDeclaration(); case 118 /* AsyncKeyword */: case 107 /* InterfaceKeyword */: - case 132 /* TypeKeyword */: + case 134 /* TypeKeyword */: case 125 /* ModuleKeyword */: case 126 /* NamespaceKeyword */: case 122 /* DeclareKeyword */: @@ -10593,6 +11556,8 @@ var ts; case 112 /* PublicKeyword */: case 115 /* AbstractKeyword */: case 113 /* StaticKeyword */: + case 128 /* ReadonlyKeyword */: + case 137 /* GlobalKeyword */: if (isStartOfDeclaration()) { return parseDeclaration(); } @@ -10615,10 +11580,11 @@ var ts; return parseClassDeclaration(fullStart, decorators, modifiers); case 107 /* InterfaceKeyword */: return parseInterfaceDeclaration(fullStart, decorators, modifiers); - case 132 /* TypeKeyword */: + case 134 /* TypeKeyword */: return parseTypeAliasDeclaration(fullStart, decorators, modifiers); case 81 /* EnumKeyword */: return parseEnumDeclaration(fullStart, decorators, modifiers); + case 137 /* GlobalKeyword */: case 125 /* ModuleKeyword */: case 126 /* NamespaceKeyword */: return parseModuleDeclaration(fullStart, decorators, modifiers); @@ -10626,14 +11592,20 @@ var ts; return parseImportDeclarationOrImportEqualsDeclaration(fullStart, decorators, modifiers); case 82 /* ExportKeyword */: nextToken(); - return token === 77 /* DefaultKeyword */ || token === 56 /* EqualsToken */ ? - parseExportAssignment(fullStart, decorators, modifiers) : - parseExportDeclaration(fullStart, decorators, modifiers); + switch (token) { + case 77 /* DefaultKeyword */: + case 56 /* EqualsToken */: + return parseExportAssignment(fullStart, decorators, modifiers); + case 116 /* AsKeyword */: + return parseGlobalModuleExportDeclaration(fullStart, decorators, modifiers); + default: + return parseExportDeclaration(fullStart, decorators, modifiers); + } default: if (decorators || modifiers) { // We reached this point because we encountered decorators and/or modifiers and assumed a declaration // would follow. For recovery and error reporting purposes, return an incomplete declaration. - var node = createMissingNode(231 /* MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); + var node = createMissingNode(239 /* MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); node.pos = fullStart; node.decorators = decorators; setModifiers(node, modifiers); @@ -10655,16 +11627,16 @@ var ts; // DECLARATIONS function parseArrayBindingElement() { if (token === 24 /* CommaToken */) { - return createNode(187 /* OmittedExpression */); + return createNode(193 /* OmittedExpression */); } - var node = createNode(163 /* BindingElement */); + var node = createNode(169 /* BindingElement */); node.dotDotDotToken = parseOptionalToken(22 /* DotDotDotToken */); node.name = parseIdentifierOrPattern(); node.initializer = parseBindingElementInitializer(/*inParameter*/ false); return finishNode(node); } function parseObjectBindingElement() { - var node = createNode(163 /* BindingElement */); + var node = createNode(169 /* BindingElement */); var tokenIsIdentifier = isIdentifier(); var propertyName = parsePropertyName(); if (tokenIsIdentifier && token !== 54 /* ColonToken */) { @@ -10679,14 +11651,14 @@ var ts; return finishNode(node); } function parseObjectBindingPattern() { - var node = createNode(161 /* ObjectBindingPattern */); + var node = createNode(167 /* ObjectBindingPattern */); parseExpected(15 /* OpenBraceToken */); node.elements = parseDelimitedList(9 /* ObjectBindingElements */, parseObjectBindingElement); parseExpected(16 /* CloseBraceToken */); return finishNode(node); } function parseArrayBindingPattern() { - var node = createNode(162 /* ArrayBindingPattern */); + var node = createNode(168 /* ArrayBindingPattern */); parseExpected(19 /* OpenBracketToken */); node.elements = parseDelimitedList(10 /* ArrayBindingElements */, parseArrayBindingElement); parseExpected(20 /* CloseBracketToken */); @@ -10705,7 +11677,7 @@ var ts; return parseIdentifier(); } function parseVariableDeclaration() { - var node = createNode(211 /* VariableDeclaration */); + var node = createNode(218 /* VariableDeclaration */); node.name = parseIdentifierOrPattern(); node.type = parseTypeAnnotation(); if (!isInOrOfKeyword(token)) { @@ -10714,15 +11686,15 @@ var ts; return finishNode(node); } function parseVariableDeclarationList(inForStatementInitializer) { - var node = createNode(212 /* VariableDeclarationList */); + var node = createNode(219 /* VariableDeclarationList */); switch (token) { case 102 /* VarKeyword */: break; case 108 /* LetKeyword */: - node.flags |= 8192 /* Let */; + node.flags |= 1024 /* Let */; break; case 74 /* ConstKeyword */: - node.flags |= 16384 /* Const */; + node.flags |= 2048 /* Const */; break; default: ts.Debug.fail(); @@ -10737,7 +11709,7 @@ var ts; // So we need to look ahead to determine if 'of' should be treated as a keyword in // this context. // The checker will then give an error that there is an empty declaration list. - if (token === 134 /* OfKeyword */ && lookAhead(canFollowContextualOfKeyword)) { + if (token === 138 /* OfKeyword */ && lookAhead(canFollowContextualOfKeyword)) { node.declarations = createMissingList(); } else { @@ -10752,15 +11724,15 @@ var ts; return nextTokenIsIdentifier() && nextToken() === 18 /* CloseParenToken */; } function parseVariableStatement(fullStart, decorators, modifiers) { - var node = createNode(193 /* VariableStatement */, fullStart); + var node = createNode(200 /* VariableStatement */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.declarationList = parseVariableDeclarationList(/*inForStatementInitializer*/ false); parseSemicolon(); - return finishNode(node); + return addJSDocComment(finishNode(node)); } function parseFunctionDeclaration(fullStart, decorators, modifiers) { - var node = createNode(213 /* FunctionDeclaration */, fullStart); + var node = createNode(220 /* FunctionDeclaration */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(87 /* FunctionKeyword */); @@ -10770,19 +11742,19 @@ var ts; var isAsync = !!(node.flags & 256 /* Async */); fillSignature(54 /* ColonToken */, /*yieldContext*/ isGenerator, /*awaitContext*/ isAsync, /*requireCompleteParameterList*/ false, node); node.body = parseFunctionBlockOrSemicolon(isGenerator, isAsync, ts.Diagnostics.or_expected); - return finishNode(node); + return addJSDocComment(finishNode(node)); } function parseConstructorDeclaration(pos, decorators, modifiers) { - var node = createNode(144 /* Constructor */, pos); + var node = createNode(148 /* Constructor */, pos); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(121 /* ConstructorKeyword */); fillSignature(54 /* ColonToken */, /*yieldContext*/ false, /*awaitContext*/ false, /*requireCompleteParameterList*/ false, node); node.body = parseFunctionBlockOrSemicolon(/*isGenerator*/ false, /*isAsync*/ false, ts.Diagnostics.or_expected); - return finishNode(node); + return addJSDocComment(finishNode(node)); } function parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, name, questionToken, diagnosticMessage) { - var method = createNode(143 /* MethodDeclaration */, fullStart); + var method = createNode(147 /* MethodDeclaration */, fullStart); method.decorators = decorators; setModifiers(method, modifiers); method.asteriskToken = asteriskToken; @@ -10792,10 +11764,10 @@ var ts; var isAsync = !!(method.flags & 256 /* Async */); fillSignature(54 /* ColonToken */, /*yieldContext*/ isGenerator, /*awaitContext*/ isAsync, /*requireCompleteParameterList*/ false, method); method.body = parseFunctionBlockOrSemicolon(isGenerator, isAsync, diagnosticMessage); - return finishNode(method); + return addJSDocComment(finishNode(method)); } function parsePropertyDeclaration(fullStart, decorators, modifiers, name, questionToken) { - var property = createNode(141 /* PropertyDeclaration */, fullStart); + var property = createNode(145 /* PropertyDeclaration */, fullStart); property.decorators = decorators; setModifiers(property, modifiers); property.name = name; @@ -10806,13 +11778,13 @@ var ts; // off. The grammar would look something like this: // // MemberVariableDeclaration[Yield]: - // AccessibilityModifier_opt PropertyName TypeAnnotation_opt Initialiser_opt[In]; - // AccessibilityModifier_opt static_opt PropertyName TypeAnnotation_opt Initialiser_opt[In, ?Yield]; + // AccessibilityModifier_opt PropertyName TypeAnnotation_opt Initializer_opt[In]; + // AccessibilityModifier_opt static_opt PropertyName TypeAnnotation_opt Initializer_opt[In, ?Yield]; // // The checker may still error in the static case to explicitly disallow the yield expression. - property.initializer = modifiers && modifiers.flags & 64 /* Static */ + property.initializer = modifiers && modifiers.flags & 32 /* Static */ ? allowInAnd(parseNonParameterInitializer) - : doOutsideOfContext(2 /* Yield */ | 1 /* DisallowIn */, parseNonParameterInitializer); + : doOutsideOfContext(8388608 /* YieldContext */ | 4194304 /* DisallowInContext */, parseNonParameterInitializer); parseSemicolon(); return finishNode(property); } @@ -10847,6 +11819,7 @@ var ts; case 110 /* PrivateKeyword */: case 111 /* ProtectedKeyword */: case 113 /* StaticKeyword */: + case 128 /* ReadonlyKeyword */: return true; default: return false; @@ -10858,7 +11831,7 @@ var ts; return true; } // Eat up all modifiers, but hold on to the last one in case it is actually an identifier. - while (ts.isModifier(token)) { + while (ts.isModifierKind(token)) { idToken = token; // If the idToken is a class modifier (protected, private, public, and static), it is // certain that we are starting to parse class member. This allows better error recovery @@ -10887,7 +11860,7 @@ var ts; // If we were able to get any potential identifier... if (idToken !== undefined) { // If we have a non-keyword identifier, or if we have an accessor, then it's safe to parse. - if (!ts.isKeyword(idToken) || idToken === 129 /* SetKeyword */ || idToken === 123 /* GetKeyword */) { + if (!ts.isKeyword(idToken) || idToken === 131 /* SetKeyword */ || idToken === 123 /* GetKeyword */) { return true; } // If it *is* a keyword, but not an accessor, check a little farther along @@ -10919,9 +11892,9 @@ var ts; } if (!decorators) { decorators = []; - decorators.pos = scanner.getStartPos(); + decorators.pos = decoratorStart; } - var decorator = createNode(139 /* Decorator */, decoratorStart); + var decorator = createNode(143 /* Decorator */, decoratorStart); decorator.expression = doInDecoratorContext(parseLeftHandSideExpressionOrHigher); decorators.push(finishNode(decorator)); } @@ -10930,14 +11903,30 @@ var ts; } return decorators; } - function parseModifiers() { + /* + * There are situations in which a modifier like 'const' will appear unexpectedly, such as on a class member. + * In those situations, if we are entirely sure that 'const' is not valid on its own (such as when ASI takes effect + * and turns it into a standalone declaration), then it is better to parse it and report an error later. + * + * In such situations, 'permitInvalidConstAsModifier' should be set to true. + */ + function parseModifiers(permitInvalidConstAsModifier) { var flags = 0; var modifiers; while (true) { var modifierStart = scanner.getStartPos(); var modifierKind = token; - if (!parseAnyContextualModifier()) { - break; + if (token === 74 /* ConstKeyword */ && permitInvalidConstAsModifier) { + // We need to ensure that any subsequent modifiers appear on the same line + // so that when 'const' is a standalone declaration, we don't issue an error. + if (!tryParse(nextTokenIsOnSameLineAndCanFollowModifier)) { + break; + } + } + else { + if (!parseAnyContextualModifier()) { + break; + } } if (!modifiers) { modifiers = []; @@ -10970,13 +11959,13 @@ var ts; } function parseClassElement() { if (token === 23 /* SemicolonToken */) { - var result = createNode(191 /* SemicolonClassElement */); + var result = createNode(198 /* SemicolonClassElement */); nextToken(); return finishNode(result); } var fullStart = getNodePos(); var decorators = parseDecorators(); - var modifiers = parseModifiers(); + var modifiers = parseModifiers(/*permitInvalidConstAsModifier*/ true); var accessor = tryParseAccessorDeclaration(fullStart, decorators, modifiers); if (accessor) { return accessor; @@ -11008,10 +11997,10 @@ var ts; return parseClassDeclarationOrExpression( /*fullStart*/ scanner.getStartPos(), /*decorators*/ undefined, - /*modifiers*/ undefined, 186 /* ClassExpression */); + /*modifiers*/ undefined, 192 /* ClassExpression */); } function parseClassDeclaration(fullStart, decorators, modifiers) { - return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 214 /* ClassDeclaration */); + return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 221 /* ClassDeclaration */); } function parseClassDeclarationOrExpression(fullStart, decorators, modifiers, kind) { var node = createNode(kind, fullStart); @@ -11036,8 +12025,8 @@ var ts; // implements is a future reserved word so // 'class implements' might mean either // - class expression with omitted name, 'implements' starts heritage clause - // - class with name 'implements' - // 'isImplementsClause' helps to disambiguate between these two cases + // - class with name 'implements' + // 'isImplementsClause' helps to disambiguate between these two cases return isIdentifier() && !isImplementsClause() ? parseIdentifier() : undefined; @@ -11053,12 +12042,9 @@ var ts; } return undefined; } - function parseHeritageClausesWorker() { - return parseList(20 /* HeritageClauses */, parseHeritageClause); - } function parseHeritageClause() { if (token === 83 /* ExtendsKeyword */ || token === 106 /* ImplementsKeyword */) { - var node = createNode(243 /* HeritageClause */); + var node = createNode(251 /* HeritageClause */); node.token = token; nextToken(); node.types = parseDelimitedList(7 /* HeritageClauseElement */, parseExpressionWithTypeArguments); @@ -11067,7 +12053,7 @@ var ts; return undefined; } function parseExpressionWithTypeArguments() { - var node = createNode(188 /* ExpressionWithTypeArguments */); + var node = createNode(194 /* ExpressionWithTypeArguments */); node.expression = parseLeftHandSideExpressionOrHigher(); if (token === 25 /* LessThanToken */) { node.typeArguments = parseBracketedList(18 /* TypeArguments */, parseType, 25 /* LessThanToken */, 27 /* GreaterThanToken */); @@ -11081,7 +12067,7 @@ var ts; return parseList(5 /* ClassMembers */, parseClassElement); } function parseInterfaceDeclaration(fullStart, decorators, modifiers) { - var node = createNode(215 /* InterfaceDeclaration */, fullStart); + var node = createNode(222 /* InterfaceDeclaration */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(107 /* InterfaceKeyword */); @@ -11092,10 +12078,10 @@ var ts; return finishNode(node); } function parseTypeAliasDeclaration(fullStart, decorators, modifiers) { - var node = createNode(216 /* TypeAliasDeclaration */, fullStart); + var node = createNode(223 /* TypeAliasDeclaration */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - parseExpected(132 /* TypeKeyword */); + parseExpected(134 /* TypeKeyword */); node.name = parseIdentifier(); node.typeParameters = parseTypeParameters(); parseExpected(56 /* EqualsToken */); @@ -11108,13 +12094,13 @@ var ts; // ConstantEnumMemberSection, which starts at the beginning of an enum declaration // or any time an integer literal initializer is encountered. function parseEnumMember() { - var node = createNode(247 /* EnumMember */, scanner.getStartPos()); + var node = createNode(255 /* EnumMember */, scanner.getStartPos()); node.name = parsePropertyName(); node.initializer = allowInAnd(parseNonParameterInitializer); return finishNode(node); } function parseEnumDeclaration(fullStart, decorators, modifiers) { - var node = createNode(217 /* EnumDeclaration */, fullStart); + var node = createNode(224 /* EnumDeclaration */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(81 /* EnumKeyword */); @@ -11129,7 +12115,7 @@ var ts; return finishNode(node); } function parseModuleBlock() { - var node = createNode(219 /* ModuleBlock */, scanner.getStartPos()); + var node = createNode(226 /* ModuleBlock */, scanner.getStartPos()); if (parseExpected(15 /* OpenBraceToken */)) { node.statements = parseList(1 /* BlockStatements */, parseStatement); parseExpected(16 /* CloseBraceToken */); @@ -11140,31 +12126,42 @@ var ts; return finishNode(node); } function parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags) { - var node = createNode(218 /* ModuleDeclaration */, fullStart); + var node = createNode(225 /* ModuleDeclaration */, fullStart); // If we are parsing a dotted namespace name, we want to // propagate the 'Namespace' flag across the names if set. - var namespaceFlag = flags & 65536 /* Namespace */; + var namespaceFlag = flags & 4096 /* Namespace */; node.decorators = decorators; setModifiers(node, modifiers); node.flags |= flags; node.name = parseIdentifier(); node.body = parseOptional(21 /* DotToken */) - ? parseModuleOrNamespaceDeclaration(getNodePos(), /*decorators*/ undefined, /*modifiers*/ undefined, 2 /* Export */ | namespaceFlag) + ? parseModuleOrNamespaceDeclaration(getNodePos(), /*decorators*/ undefined, /*modifiers*/ undefined, 1 /* Export */ | namespaceFlag) : parseModuleBlock(); return finishNode(node); } function parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers) { - var node = createNode(218 /* ModuleDeclaration */, fullStart); + var node = createNode(225 /* ModuleDeclaration */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - node.name = parseLiteralNode(/*internName*/ true); + if (token === 137 /* GlobalKeyword */) { + // parse 'global' as name of global scope augmentation + node.name = parseIdentifier(); + node.flags |= 131072 /* GlobalAugmentation */; + } + else { + node.name = parseLiteralNode(/*internName*/ true); + } node.body = parseModuleBlock(); return finishNode(node); } function parseModuleDeclaration(fullStart, decorators, modifiers) { var flags = modifiers ? modifiers.flags : 0; - if (parseOptional(126 /* NamespaceKeyword */)) { - flags |= 65536 /* Namespace */; + if (token === 137 /* GlobalKeyword */) { + // global augmentation + return parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers); + } + else if (parseOptional(126 /* NamespaceKeyword */)) { + flags |= 4096 /* Namespace */; } else { parseExpected(125 /* ModuleKeyword */); @@ -11175,7 +12172,7 @@ var ts; return parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags); } function isExternalModuleReference() { - return token === 127 /* RequireKeyword */ && + return token === 129 /* RequireKeyword */ && lookAhead(nextTokenIsOpenParen); } function nextTokenIsOpenParen() { @@ -11184,10 +12181,15 @@ var ts; function nextTokenIsSlash() { return nextToken() === 39 /* SlashToken */; } - function nextTokenIsCommaOrFromKeyword() { - nextToken(); - return token === 24 /* CommaToken */ || - token === 133 /* FromKeyword */; + function parseGlobalModuleExportDeclaration(fullStart, decorators, modifiers) { + var exportDeclaration = createNode(228 /* GlobalModuleExportDeclaration */, fullStart); + exportDeclaration.decorators = decorators; + exportDeclaration.modifiers = modifiers; + parseExpected(116 /* AsKeyword */); + parseExpected(126 /* NamespaceKeyword */); + exportDeclaration.name = parseIdentifier(); + parseExpected(23 /* SemicolonToken */); + return finishNode(exportDeclaration); } function parseImportDeclarationOrImportEqualsDeclaration(fullStart, decorators, modifiers) { parseExpected(89 /* ImportKeyword */); @@ -11195,11 +12197,11 @@ var ts; var identifier; if (isIdentifier()) { identifier = parseIdentifier(); - if (token !== 24 /* CommaToken */ && token !== 133 /* FromKeyword */) { + if (token !== 24 /* CommaToken */ && token !== 136 /* FromKeyword */) { // ImportEquals declaration of type: // import x = require("mod"); or // import x = M.x; - var importEqualsDeclaration = createNode(221 /* ImportEqualsDeclaration */, fullStart); + var importEqualsDeclaration = createNode(229 /* ImportEqualsDeclaration */, fullStart); importEqualsDeclaration.decorators = decorators; setModifiers(importEqualsDeclaration, modifiers); importEqualsDeclaration.name = identifier; @@ -11210,7 +12212,7 @@ var ts; } } // Import statement - var importDeclaration = createNode(222 /* ImportDeclaration */, fullStart); + var importDeclaration = createNode(230 /* ImportDeclaration */, fullStart); importDeclaration.decorators = decorators; setModifiers(importDeclaration, modifiers); // ImportDeclaration: @@ -11220,7 +12222,7 @@ var ts; token === 37 /* AsteriskToken */ || token === 15 /* OpenBraceToken */) { importDeclaration.importClause = parseImportClause(identifier, afterImportPos); - parseExpected(133 /* FromKeyword */); + parseExpected(136 /* FromKeyword */); } importDeclaration.moduleSpecifier = parseModuleSpecifier(); parseSemicolon(); @@ -11233,7 +12235,7 @@ var ts; // NamedImports // ImportedDefaultBinding, NameSpaceImport // ImportedDefaultBinding, NamedImports - var importClause = createNode(223 /* ImportClause */, fullStart); + var importClause = createNode(231 /* ImportClause */, fullStart); if (identifier) { // ImportedDefaultBinding: // ImportedBinding @@ -11243,7 +12245,7 @@ var ts; // parse namespace or named imports if (!importClause.name || parseOptional(24 /* CommaToken */)) { - importClause.namedBindings = token === 37 /* AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(225 /* NamedImports */); + importClause.namedBindings = token === 37 /* AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(233 /* NamedImports */); } return finishNode(importClause); } @@ -11253,29 +12255,30 @@ var ts; : parseEntityName(/*allowReservedWords*/ false); } function parseExternalModuleReference() { - var node = createNode(232 /* ExternalModuleReference */); - parseExpected(127 /* RequireKeyword */); + var node = createNode(240 /* ExternalModuleReference */); + parseExpected(129 /* RequireKeyword */); parseExpected(17 /* OpenParenToken */); node.expression = parseModuleSpecifier(); parseExpected(18 /* CloseParenToken */); return finishNode(node); } function parseModuleSpecifier() { - // We allow arbitrary expressions here, even though the grammar only allows string - // literals. We check to ensure that it is only a string literal later in the grammar - // walker. - var result = parseExpression(); - // Ensure the string being required is in our 'identifier' table. This will ensure - // that features like 'find refs' will look inside this file when search for its name. - if (result.kind === 9 /* StringLiteral */) { + if (token === 9 /* StringLiteral */) { + var result = parseLiteralNode(); internIdentifier(result.text); + return result; + } + else { + // We allow arbitrary expressions here, even though the grammar only allows string + // literals. We check to ensure that it is only a string literal later in the grammar + // check pass. + return parseExpression(); } - return result; } function parseNamespaceImport() { // NameSpaceImport: // * as ImportedBinding - var namespaceImport = createNode(224 /* NamespaceImport */); + var namespaceImport = createNode(232 /* NamespaceImport */); parseExpected(37 /* AsteriskToken */); parseExpected(116 /* AsKeyword */); namespaceImport.name = parseIdentifier(); @@ -11290,21 +12293,21 @@ var ts; // ImportsList: // ImportSpecifier // ImportsList, ImportSpecifier - node.elements = parseBracketedList(21 /* ImportOrExportSpecifiers */, kind === 225 /* NamedImports */ ? parseImportSpecifier : parseExportSpecifier, 15 /* OpenBraceToken */, 16 /* CloseBraceToken */); + node.elements = parseBracketedList(21 /* ImportOrExportSpecifiers */, kind === 233 /* NamedImports */ ? parseImportSpecifier : parseExportSpecifier, 15 /* OpenBraceToken */, 16 /* CloseBraceToken */); return finishNode(node); } function parseExportSpecifier() { - return parseImportOrExportSpecifier(230 /* ExportSpecifier */); + return parseImportOrExportSpecifier(238 /* ExportSpecifier */); } function parseImportSpecifier() { - return parseImportOrExportSpecifier(226 /* ImportSpecifier */); + return parseImportOrExportSpecifier(234 /* ImportSpecifier */); } function parseImportOrExportSpecifier(kind) { var node = createNode(kind); // ImportSpecifier: // BindingIdentifier // IdentifierName as BindingIdentifier - // ExportSpecififer: + // ExportSpecifier: // IdentifierName // IdentifierName as IdentifierName var checkIdentifierIsKeyword = ts.isKeyword(token) && !isIdentifier(); @@ -11322,27 +12325,27 @@ var ts; else { node.name = identifierName; } - if (kind === 226 /* ImportSpecifier */ && checkIdentifierIsKeyword) { + if (kind === 234 /* ImportSpecifier */ && checkIdentifierIsKeyword) { // Report error identifier expected parseErrorAtPosition(checkIdentifierStart, checkIdentifierEnd - checkIdentifierStart, ts.Diagnostics.Identifier_expected); } return finishNode(node); } function parseExportDeclaration(fullStart, decorators, modifiers) { - var node = createNode(228 /* ExportDeclaration */, fullStart); + var node = createNode(236 /* ExportDeclaration */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); if (parseOptional(37 /* AsteriskToken */)) { - parseExpected(133 /* FromKeyword */); + parseExpected(136 /* FromKeyword */); node.moduleSpecifier = parseModuleSpecifier(); } else { - node.exportClause = parseNamedImportsOrExports(229 /* NamedExports */); + node.exportClause = parseNamedImportsOrExports(237 /* NamedExports */); // It is not uncommon to accidentally omit the 'from' keyword. Additionally, in editing scenarios, // the 'from' keyword can be parsed as a named export when the export clause is unterminated (i.e. `export { from "moduleName";`) // If we don't have a 'from' keyword, see if we have a string literal such that ASI won't take effect. - if (token === 133 /* FromKeyword */ || (token === 9 /* StringLiteral */ && !scanner.hasPrecedingLineBreak())) { - parseExpected(133 /* FromKeyword */); + if (token === 136 /* FromKeyword */ || (token === 9 /* StringLiteral */ && !scanner.hasPrecedingLineBreak())) { + parseExpected(136 /* FromKeyword */); node.moduleSpecifier = parseModuleSpecifier(); } } @@ -11350,7 +12353,7 @@ var ts; return finishNode(node); } function parseExportAssignment(fullStart, decorators, modifiers) { - var node = createNode(227 /* ExportAssignment */, fullStart); + var node = createNode(235 /* ExportAssignment */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); if (parseOptional(56 /* EqualsToken */)) { @@ -11366,6 +12369,7 @@ var ts; function processReferenceComments(sourceFile) { var triviaScanner = ts.createScanner(sourceFile.languageVersion, /*skipTrivia*/ false, 0 /* Standard */, sourceText); var referencedFiles = []; + var typeReferenceDirectives = []; var amdDependencies = []; var amdModuleName; // Keep scanning all the leading trivia in the file until we get to something that @@ -11373,11 +12377,13 @@ var ts; // reference comment. while (true) { var kind = triviaScanner.scan(); - if (kind === 5 /* WhitespaceTrivia */ || kind === 4 /* NewLineTrivia */ || kind === 3 /* MultiLineCommentTrivia */) { - continue; - } if (kind !== 2 /* SingleLineCommentTrivia */) { - break; + if (ts.isTrivia(kind)) { + continue; + } + else { + break; + } } var range = { pos: triviaScanner.getTokenPos(), end: triviaScanner.getTextPos(), kind: triviaScanner.getToken() }; var comment = sourceText.substring(range.pos, range.end); @@ -11387,7 +12393,12 @@ var ts; sourceFile.hasNoDefaultLib = referencePathMatchResult.isNoDefaultLib; var diagnosticMessage = referencePathMatchResult.diagnosticMessage; if (fileReference) { - referencedFiles.push(fileReference); + if (referencePathMatchResult.isTypeReferenceDirective) { + typeReferenceDirectives.push(fileReference); + } + else { + referencedFiles.push(fileReference); + } } if (diagnosticMessage) { parseDiagnostics.push(ts.createFileDiagnostic(sourceFile, range.pos, range.end - range.pos, diagnosticMessage)); @@ -11417,16 +12428,17 @@ var ts; } } sourceFile.referencedFiles = referencedFiles; + sourceFile.typeReferenceDirectives = typeReferenceDirectives; sourceFile.amdDependencies = amdDependencies; sourceFile.moduleName = amdModuleName; } function setExternalModuleIndicator(sourceFile) { sourceFile.externalModuleIndicator = ts.forEach(sourceFile.statements, function (node) { - return node.flags & 2 /* Export */ - || node.kind === 221 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 232 /* ExternalModuleReference */ - || node.kind === 222 /* ImportDeclaration */ - || node.kind === 227 /* ExportAssignment */ - || node.kind === 228 /* ExportDeclaration */ + return node.flags & 1 /* Export */ + || node.kind === 229 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 240 /* ExternalModuleReference */ + || node.kind === 230 /* ImportDeclaration */ + || node.kind === 235 /* ExportAssignment */ + || node.kind === 236 /* ExportDeclaration */ ? node : undefined; }); @@ -11487,21 +12499,19 @@ var ts; } JSDocParser.isJSDocType = isJSDocType; function parseJSDocTypeExpressionForTests(content, start, length) { - initializeState("file.js", content, 2 /* Latest */, /*isJavaScriptFile*/ true, /*_syntaxCursor:*/ undefined); - var jsDocTypeExpression = parseJSDocTypeExpression(start, length); + initializeState("file.js", content, 2 /* Latest */, /*_syntaxCursor:*/ undefined, 1 /* JS */); + scanner.setText(content, start, length); + token = scanner.scan(); + var jsDocTypeExpression = parseJSDocTypeExpression(); var diagnostics = parseDiagnostics; clearState(); return jsDocTypeExpression ? { jsDocTypeExpression: jsDocTypeExpression, diagnostics: diagnostics } : undefined; } JSDocParser.parseJSDocTypeExpressionForTests = parseJSDocTypeExpressionForTests; - // Parses out a JSDoc type expression. The starting position should be right at the open - // curly in the type expression. Returns 'undefined' if it encounters any errors while parsing. + // Parses out a JSDoc type expression. /* @internal */ - function parseJSDocTypeExpression(start, length) { - scanner.setText(sourceText, start, length); - // Prime the first token for us to start processing. - token = nextToken(); - var result = createNode(249 /* JSDocTypeExpression */); + function parseJSDocTypeExpression() { + var result = createNode(257 /* JSDocTypeExpression */, scanner.getTokenPos()); parseExpected(15 /* OpenBraceToken */); result.type = parseJSDocTopLevelType(); parseExpected(16 /* CloseBraceToken */); @@ -11512,12 +12522,12 @@ var ts; function parseJSDocTopLevelType() { var type = parseJSDocType(); if (token === 47 /* BarToken */) { - var unionType = createNode(253 /* JSDocUnionType */, type.pos); + var unionType = createNode(261 /* JSDocUnionType */, type.pos); unionType.types = parseJSDocTypeList(type); type = finishNode(unionType); } if (token === 56 /* EqualsToken */) { - var optionalType = createNode(260 /* JSDocOptionalType */, type.pos); + var optionalType = createNode(268 /* JSDocOptionalType */, type.pos); nextToken(); optionalType.type = type; type = finishNode(optionalType); @@ -11528,20 +12538,20 @@ var ts; var type = parseBasicTypeExpression(); while (true) { if (token === 19 /* OpenBracketToken */) { - var arrayType = createNode(252 /* JSDocArrayType */, type.pos); + var arrayType = createNode(260 /* JSDocArrayType */, type.pos); arrayType.elementType = type; nextToken(); parseExpected(20 /* CloseBracketToken */); type = finishNode(arrayType); } else if (token === 53 /* QuestionToken */) { - var nullableType = createNode(255 /* JSDocNullableType */, type.pos); + var nullableType = createNode(263 /* JSDocNullableType */, type.pos); nullableType.type = type; nextToken(); type = finishNode(nullableType); } else if (token === 49 /* ExclamationToken */) { - var nonNullableType = createNode(256 /* JSDocNonNullableType */, type.pos); + var nonNullableType = createNode(264 /* JSDocNonNullableType */, type.pos); nonNullableType.type = type; nextToken(); type = finishNode(nonNullableType); @@ -11575,10 +12585,10 @@ var ts; case 97 /* ThisKeyword */: return parseJSDocThisType(); case 117 /* AnyKeyword */: - case 130 /* StringKeyword */: - case 128 /* NumberKeyword */: + case 132 /* StringKeyword */: + case 130 /* NumberKeyword */: case 120 /* BooleanKeyword */: - case 131 /* SymbolKeyword */: + case 133 /* SymbolKeyword */: case 103 /* VoidKeyword */: return parseTokenNode(); } @@ -11586,27 +12596,27 @@ var ts; return parseJSDocTypeReference(); } function parseJSDocThisType() { - var result = createNode(264 /* JSDocThisType */); + var result = createNode(272 /* JSDocThisType */); nextToken(); parseExpected(54 /* ColonToken */); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocConstructorType() { - var result = createNode(263 /* JSDocConstructorType */); + var result = createNode(271 /* JSDocConstructorType */); nextToken(); parseExpected(54 /* ColonToken */); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocVariadicType() { - var result = createNode(262 /* JSDocVariadicType */); + var result = createNode(270 /* JSDocVariadicType */); nextToken(); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocFunctionType() { - var result = createNode(261 /* JSDocFunctionType */); + var result = createNode(269 /* JSDocFunctionType */); nextToken(); parseExpected(17 /* OpenParenToken */); result.parameters = parseDelimitedList(22 /* JSDocFunctionParameters */, parseJSDocParameter); @@ -11619,26 +12629,28 @@ var ts; return finishNode(result); } function parseJSDocParameter() { - var parameter = createNode(138 /* Parameter */); + var parameter = createNode(142 /* Parameter */); parameter.type = parseJSDocType(); + if (parseOptional(56 /* EqualsToken */)) { + parameter.questionToken = createNode(56 /* EqualsToken */); + } return finishNode(parameter); } - function parseJSDocOptionalType(type) { - var result = createNode(260 /* JSDocOptionalType */, type.pos); - nextToken(); - result.type = type; - return finishNode(result); - } function parseJSDocTypeReference() { - var result = createNode(259 /* JSDocTypeReference */); + var result = createNode(267 /* JSDocTypeReference */); result.name = parseSimplePropertyName(); - while (parseOptional(21 /* DotToken */)) { - if (token === 25 /* LessThanToken */) { - result.typeArguments = parseTypeArguments(); - break; - } - else { - result.name = parseQualifiedName(result.name); + if (token === 25 /* LessThanToken */) { + result.typeArguments = parseTypeArguments(); + } + else { + while (parseOptional(21 /* DotToken */)) { + if (token === 25 /* LessThanToken */) { + result.typeArguments = parseTypeArguments(); + break; + } + else { + result.name = parseQualifiedName(result.name); + } } } return finishNode(result); @@ -11660,13 +12672,13 @@ var ts; } } function parseQualifiedName(left) { - var result = createNode(135 /* QualifiedName */, left.pos); + var result = createNode(139 /* QualifiedName */, left.pos); result.left = left; result.right = parseIdentifierName(); return finishNode(result); } function parseJSDocRecordType() { - var result = createNode(257 /* JSDocRecordType */); + var result = createNode(265 /* JSDocRecordType */); nextToken(); result.members = parseDelimitedList(24 /* JSDocRecordMembers */, parseJSDocRecordMember); checkForTrailingComma(result.members); @@ -11674,7 +12686,7 @@ var ts; return finishNode(result); } function parseJSDocRecordMember() { - var result = createNode(258 /* JSDocRecordMember */); + var result = createNode(266 /* JSDocRecordMember */); result.name = parseSimplePropertyName(); if (token === 54 /* ColonToken */) { nextToken(); @@ -11683,13 +12695,13 @@ var ts; return finishNode(result); } function parseJSDocNonNullableType() { - var result = createNode(256 /* JSDocNonNullableType */); + var result = createNode(264 /* JSDocNonNullableType */); nextToken(); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocTupleType() { - var result = createNode(254 /* JSDocTupleType */); + var result = createNode(262 /* JSDocTupleType */); nextToken(); result.types = parseDelimitedList(25 /* JSDocTupleTypes */, parseJSDocType); checkForTrailingComma(result.types); @@ -11703,7 +12715,7 @@ var ts; } } function parseJSDocUnionType() { - var result = createNode(253 /* JSDocUnionType */); + var result = createNode(261 /* JSDocUnionType */); nextToken(); result.types = parseJSDocTypeList(parseJSDocType()); parseExpected(18 /* CloseParenToken */); @@ -11721,7 +12733,7 @@ var ts; return types; } function parseJSDocAllType() { - var result = createNode(250 /* JSDocAllType */); + var result = createNode(258 /* JSDocAllType */); nextToken(); return finishNode(result); } @@ -11744,29 +12756,35 @@ var ts; token === 27 /* GreaterThanToken */ || token === 56 /* EqualsToken */ || token === 47 /* BarToken */) { - var result = createNode(251 /* JSDocUnknownType */, pos); + var result = createNode(259 /* JSDocUnknownType */, pos); return finishNode(result); } else { - var result = createNode(255 /* JSDocNullableType */, pos); + var result = createNode(263 /* JSDocNullableType */, pos); result.type = parseJSDocType(); return finishNode(result); } } function parseIsolatedJSDocComment(content, start, length) { - initializeState("file.js", content, 2 /* Latest */, /*isJavaScriptFile*/ true, /*_syntaxCursor:*/ undefined); - var jsDocComment = parseJSDocComment(/*parent:*/ undefined, start, length); + initializeState("file.js", content, 2 /* Latest */, /*_syntaxCursor:*/ undefined, 1 /* JS */); + sourceFile = { languageVariant: 0 /* Standard */, text: content }; + var jsDocComment = parseJSDocCommentWorker(start, length); var diagnostics = parseDiagnostics; clearState(); return jsDocComment ? { jsDocComment: jsDocComment, diagnostics: diagnostics } : undefined; } JSDocParser.parseIsolatedJSDocComment = parseIsolatedJSDocComment; function parseJSDocComment(parent, start, length) { + var saveToken = token; + var saveParseDiagnosticsLength = parseDiagnostics.length; + var saveParseErrorBeforeNextFinishedNode = parseErrorBeforeNextFinishedNode; var comment = parseJSDocCommentWorker(start, length); if (comment) { - fixupParentReferences(comment); comment.parent = parent; } + token = saveToken; + parseDiagnostics.length = saveParseDiagnosticsLength; + parseErrorBeforeNextFinishedNode = saveParseErrorBeforeNextFinishedNode; return comment; } JSDocParser.parseJSDocComment = parseJSDocComment; @@ -11779,77 +12797,75 @@ var ts; ts.Debug.assert(start <= end); ts.Debug.assert(end <= content.length); var tags; - var pos; - // NOTE(cyrusn): This is essentially a handwritten scanner for JSDocComments. I - // considered using an actual Scanner, but this would complicate things. The - // scanner would need to know it was in a Doc Comment. Otherwise, it would then - // produce comments *inside* the doc comment. In the end it was just easier to - // write a simple scanner rather than go that route. - if (length >= "/** */".length) { - if (content.charCodeAt(start) === 47 /* slash */ && - content.charCodeAt(start + 1) === 42 /* asterisk */ && - content.charCodeAt(start + 2) === 42 /* asterisk */ && - content.charCodeAt(start + 3) !== 42 /* asterisk */) { + var result; + // Check for /** (JSDoc opening part) + if (content.charCodeAt(start) === 47 /* slash */ && + content.charCodeAt(start + 1) === 42 /* asterisk */ && + content.charCodeAt(start + 2) === 42 /* asterisk */ && + content.charCodeAt(start + 3) !== 42 /* asterisk */) { + // + 3 for leading /**, - 5 in total for /** */ + scanner.scanRange(start + 3, length - 5, function () { // Initially we can parse out a tag. We also have seen a starting asterisk. // This is so that /** * @type */ doesn't parse. var canParseTag = true; var seenAsterisk = true; - for (pos = start + "/**".length; pos < end;) { - var ch = content.charCodeAt(pos); - pos++; - if (ch === 64 /* at */ && canParseTag) { - parseTag(); - // Once we parse out a tag, we cannot keep parsing out tags on this line. - canParseTag = false; - continue; - } - if (ts.isLineBreak(ch)) { - // After a line break, we can parse a tag, and we haven't seen as asterisk - // on the next line yet. - canParseTag = true; - seenAsterisk = false; - continue; - } - if (ts.isWhiteSpace(ch)) { - // Whitespace doesn't affect any of our parsing. - continue; - } - // Ignore the first asterisk on a line. - if (ch === 42 /* asterisk */) { - if (seenAsterisk) { - // If we've already seen an asterisk, then we can no longer parse a tag - // on this line. + nextJSDocToken(); + while (token !== 1 /* EndOfFileToken */) { + switch (token) { + case 55 /* AtToken */: + if (canParseTag) { + parseTag(); + } + // This will take us to the end of the line, so it's OK to parse a tag on the next pass through the loop + seenAsterisk = false; + break; + case 4 /* NewLineTrivia */: + // After a line break, we can parse a tag, and we haven't seen an asterisk on the next line yet + canParseTag = true; + seenAsterisk = false; + break; + case 37 /* AsteriskToken */: + if (seenAsterisk) { + // If we've already seen an asterisk, then we can no longer parse a tag on this line + canParseTag = false; + } + // Ignore the first asterisk on a line + seenAsterisk = true; + break; + case 69 /* Identifier */: + // Anything else is doc comment text. We can't do anything with it. Because it + // wasn't a tag, we can no longer parse a tag on this line until we hit the next + // line break. canParseTag = false; - } - seenAsterisk = true; - continue; + break; + case 1 /* EndOfFileToken */: + break; } - // Anything else is doc comment text. We can't do anything with it. Because it - // wasn't a tag, we can no longer parse a tag on this line until we hit the next - // line break. - canParseTag = false; + nextJSDocToken(); } - } + result = createJSDocComment(); + }); } - return createJSDocComment(); + return result; function createJSDocComment() { if (!tags) { return undefined; } - var result = createNode(265 /* JSDocComment */, start); + var result = createNode(273 /* JSDocComment */, start); result.tags = tags; return finishNode(result, end); } function skipWhitespace() { - while (pos < end && ts.isWhiteSpace(content.charCodeAt(pos))) { - pos++; + while (token === 5 /* WhitespaceTrivia */ || token === 4 /* NewLineTrivia */) { + nextJSDocToken(); } } function parseTag() { - ts.Debug.assert(content.charCodeAt(pos - 1) === 64 /* at */); - var atToken = createNode(55 /* AtToken */, pos - 1); - atToken.end = pos; - var tagName = scanIdentifier(); + ts.Debug.assert(token === 55 /* AtToken */); + var atToken = createNode(55 /* AtToken */, scanner.getTokenPos()); + atToken.end = scanner.getTextPos(); + nextJSDocToken(); + var tagName = parseJSDocIdentifierName(); if (!tagName) { return; } @@ -11873,10 +12889,10 @@ var ts; return undefined; } function handleUnknownTag(atToken, tagName) { - var result = createNode(266 /* JSDocTag */, atToken.pos); + var result = createNode(274 /* JSDocTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; - return finishNode(result, pos); + return finishNode(result); } function addTag(tag) { if (tag) { @@ -11889,12 +12905,10 @@ var ts; } } function tryParseTypeExpression() { - skipWhitespace(); - if (content.charCodeAt(pos) !== 123 /* openBrace */) { + if (token !== 15 /* OpenBraceToken */) { return undefined; } - var typeExpression = parseJSDocTypeExpression(pos, end - pos); - pos = typeExpression.end; + var typeExpression = parseJSDocTypeExpression(); return typeExpression; } function handleParamTag(atToken, tagName) { @@ -11902,17 +12916,22 @@ var ts; skipWhitespace(); var name; var isBracketed; - if (content.charCodeAt(pos) === 91 /* openBracket */) { - pos++; - skipWhitespace(); - name = scanIdentifier(); + // Looking for something like '[foo]' or 'foo' + if (parseOptionalToken(19 /* OpenBracketToken */)) { + name = parseJSDocIdentifierName(); isBracketed = true; + // May have an optional default, e.g. '[foo = 42]' + if (parseOptionalToken(56 /* EqualsToken */)) { + parseExpression(); + } + parseExpected(20 /* CloseBracketToken */); } - else { - name = scanIdentifier(); + else if (ts.tokenIsIdentifierOrKeyword(token)) { + name = parseJSDocIdentifierName(); } if (!name) { - parseErrorAtPosition(pos, 0, ts.Diagnostics.Identifier_expected); + parseErrorAtPosition(scanner.getStartPos(), 0, ts.Diagnostics.Identifier_expected); + return undefined; } var preName, postName; if (typeExpression) { @@ -11924,84 +12943,85 @@ var ts; if (!typeExpression) { typeExpression = tryParseTypeExpression(); } - var result = createNode(267 /* JSDocParameterTag */, atToken.pos); + var result = createNode(275 /* JSDocParameterTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.preParameterName = preName; result.typeExpression = typeExpression; result.postParameterName = postName; result.isBracketed = isBracketed; - return finishNode(result, pos); + return finishNode(result); } function handleReturnTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 268 /* JSDocReturnTag */; })) { - parseErrorAtPosition(tagName.pos, pos - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); + if (ts.forEach(tags, function (t) { return t.kind === 276 /* JSDocReturnTag */; })) { + parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } - var result = createNode(268 /* JSDocReturnTag */, atToken.pos); + var result = createNode(276 /* JSDocReturnTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); - return finishNode(result, pos); + return finishNode(result); } function handleTypeTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 269 /* JSDocTypeTag */; })) { - parseErrorAtPosition(tagName.pos, pos - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); + if (ts.forEach(tags, function (t) { return t.kind === 277 /* JSDocTypeTag */; })) { + parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } - var result = createNode(269 /* JSDocTypeTag */, atToken.pos); + var result = createNode(277 /* JSDocTypeTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); - return finishNode(result, pos); + return finishNode(result); } function handleTemplateTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 270 /* JSDocTemplateTag */; })) { - parseErrorAtPosition(tagName.pos, pos - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); + if (ts.forEach(tags, function (t) { return t.kind === 278 /* JSDocTemplateTag */; })) { + parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } + // Type parameter list looks like '@template T,U,V' var typeParameters = []; - typeParameters.pos = pos; + typeParameters.pos = scanner.getStartPos(); while (true) { - skipWhitespace(); - var startPos = pos; - var name_8 = scanIdentifier(); + var name_8 = parseJSDocIdentifierName(); if (!name_8) { - parseErrorAtPosition(startPos, 0, ts.Diagnostics.Identifier_expected); + parseErrorAtPosition(scanner.getStartPos(), 0, ts.Diagnostics.Identifier_expected); return undefined; } - var typeParameter = createNode(137 /* TypeParameter */, name_8.pos); + var typeParameter = createNode(141 /* TypeParameter */, name_8.pos); typeParameter.name = name_8; - finishNode(typeParameter, pos); + finishNode(typeParameter); typeParameters.push(typeParameter); - skipWhitespace(); - if (content.charCodeAt(pos) !== 44 /* comma */) { + if (token === 24 /* CommaToken */) { + nextJSDocToken(); + } + else { break; } - pos++; } - typeParameters.end = pos; - var result = createNode(270 /* JSDocTemplateTag */, atToken.pos); + var result = createNode(278 /* JSDocTemplateTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeParameters = typeParameters; - return finishNode(result, pos); + finishNode(result); + typeParameters.end = result.end; + return result; } - function scanIdentifier() { - var startPos = pos; - for (; pos < end; pos++) { - var ch = content.charCodeAt(pos); - if (pos === startPos && ts.isIdentifierStart(ch, 2 /* Latest */)) { - continue; - } - else if (pos > startPos && ts.isIdentifierPart(ch, 2 /* Latest */)) { - continue; - } - break; - } - if (startPos === pos) { + function nextJSDocToken() { + return token = scanner.scanJSDocToken(); + } + function parseJSDocIdentifierName() { + return createJSDocIdentifier(ts.tokenIsIdentifierOrKeyword(token)); + } + function createJSDocIdentifier(isIdentifier) { + if (!isIdentifier) { + parseErrorAtCurrentToken(ts.Diagnostics.Identifier_expected); return undefined; } - var result = createNode(69 /* Identifier */, startPos); - result.text = content.substring(startPos, pos); - return finishNode(result, pos); + var pos = scanner.getTokenPos(); + var end = scanner.getTextPos(); + var result = createNode(69 /* Identifier */, pos); + result.text = content.substring(pos, end); + finishNode(result, end); + nextJSDocToken(); + return result; } } JSDocParser.parseJSDocCommentWorker = parseJSDocCommentWorker; @@ -12019,10 +13039,10 @@ var ts; if (sourceFile.statements.length === 0) { // If we don't have any statements in the current source file, then there's no real // way to incrementally parse. So just do a full parse instead. - return Parser.parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, /*syntaxCursor*/ undefined, /*setNodeParents*/ true); + return Parser.parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, /*syntaxCursor*/ undefined, /*setParentNodes*/ true, sourceFile.scriptKind); } // Make sure we're not trying to incrementally update a source file more than once. Once - // we do an update the original source file is considered unusbale from that point onwards. + // we do an update the original source file is considered unusable from that point onwards. // // This is because we do incremental parsing in-place. i.e. we take nodes from the old // tree and give them new positions and parents. From that point on, trusting the old @@ -12075,7 +13095,7 @@ var ts; // inconsistent tree. Setting the parents on the new tree should be very fast. We // will immediately bail out of walking any subtrees when we can see that their parents // are already correct. - var result = Parser.parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, syntaxCursor, /* setParentNode */ true); + var result = Parser.parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, syntaxCursor, /*setParentNodes*/ true, sourceFile.scriptKind); return result; } IncrementalParser.updateSourceFile = updateSourceFile; @@ -12134,7 +13154,7 @@ var ts; // We have an element that intersects the change range in some way. It may have its // start, or its end (or both) in the changed range. We want to adjust any part // that intersects such that the final tree is in a consistent state. i.e. all - // chlidren have spans within the span of their parent, and all siblings are ordered + // children have spans within the span of their parent, and all siblings are ordered // properly. // We may need to update both the 'pos' and the 'end' of the element. // If the 'pos' is before the start of the change, then we don't need to touch it. @@ -12154,7 +13174,7 @@ var ts; // -------------------ZZZ----------------- // // In this case, any element that started in the 'X' range will keep its position. - // However any element htat started after that will have their pos adjusted to be + // However any element that started after that will have their pos adjusted to be // at the end of the new range. i.e. any node that started in the 'Y' range will // be adjusted to have their start at the end of the 'Z' range. // @@ -12178,7 +13198,7 @@ var ts; // -------------------ZZZ----------------- // // In this case, any element that ended in the 'X' range will keep its position. - // However any element htat ended after that will have their pos adjusted to be + // However any element that ended after that will have their pos adjusted to be // at the end of the new range. i.e. any node that ended in the 'Y' range will // be adjusted to have their end at the end of the 'Z' range. if (element.end >= changeRangeOldEnd) { @@ -12198,12 +13218,12 @@ var ts; } function checkNodePositions(node, aggressiveChecks) { if (aggressiveChecks) { - var pos = node.pos; + var pos_2 = node.pos; forEachChild(node, function (child) { - ts.Debug.assert(child.pos >= pos); - pos = child.end; + ts.Debug.assert(child.pos >= pos_2); + pos_2 = child.end; }); - ts.Debug.assert(pos <= node.end); + ts.Debug.assert(pos_2 <= node.end); } } function updateTokenPositionsAndMarkElements(sourceFile, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta, oldText, newText, aggressiveChecks) { @@ -12437,7 +13457,7 @@ var ts; if (position >= node.pos && position < node.end) { // Position was within this node. Keep searching deeper to find the node. forEachChild(node, visitNode, visitArray); - // don't procede any futher in the search. + // don't proceed any further in the search. return true; } // position wasn't in this node, have to keep searching. @@ -12491,34 +13511,20 @@ var ts; ModuleInstanceState[ModuleInstanceState["ConstEnumOnly"] = 2] = "ConstEnumOnly"; })(ts.ModuleInstanceState || (ts.ModuleInstanceState = {})); var ModuleInstanceState = ts.ModuleInstanceState; - var Reachability; - (function (Reachability) { - Reachability[Reachability["Unintialized"] = 1] = "Unintialized"; - Reachability[Reachability["Reachable"] = 2] = "Reachable"; - Reachability[Reachability["Unreachable"] = 4] = "Unreachable"; - Reachability[Reachability["ReportedUnreachable"] = 8] = "ReportedUnreachable"; - })(Reachability || (Reachability = {})); - function or(state1, state2) { - return (state1 | state2) & 2 /* Reachable */ - ? 2 /* Reachable */ - : (state1 & state2) & 8 /* ReportedUnreachable */ - ? 8 /* ReportedUnreachable */ - : 4 /* Unreachable */; - } function getModuleInstanceState(node) { // A module is uninstantiated if it contains only // 1. interface declarations, type alias declarations - if (node.kind === 215 /* InterfaceDeclaration */ || node.kind === 216 /* TypeAliasDeclaration */) { + if (node.kind === 222 /* InterfaceDeclaration */ || node.kind === 223 /* TypeAliasDeclaration */) { return 0 /* NonInstantiated */; } else if (ts.isConstEnumDeclaration(node)) { return 2 /* ConstEnumOnly */; } - else if ((node.kind === 222 /* ImportDeclaration */ || node.kind === 221 /* ImportEqualsDeclaration */) && !(node.flags & 2 /* Export */)) { + else if ((node.kind === 230 /* ImportDeclaration */ || node.kind === 229 /* ImportEqualsDeclaration */) && !(node.flags & 1 /* Export */)) { return 0 /* NonInstantiated */; } - else if (node.kind === 219 /* ModuleBlock */) { - var state = 0 /* NonInstantiated */; + else if (node.kind === 226 /* ModuleBlock */) { + var state_1 = 0 /* NonInstantiated */; ts.forEachChild(node, function (n) { switch (getModuleInstanceState(n)) { case 0 /* NonInstantiated */: @@ -12526,17 +13532,17 @@ var ts; return false; case 2 /* ConstEnumOnly */: // child is const enum only - record state and continue searching - state = 2 /* ConstEnumOnly */; + state_1 = 2 /* ConstEnumOnly */; return false; case 1 /* Instantiated */: // child is instantiated - record state and stop - state = 1 /* Instantiated */; + state_1 = 1 /* Instantiated */; return true; } }); - return state; + return state_1; } - else if (node.kind === 218 /* ModuleDeclaration */) { + else if (node.kind === 225 /* ModuleDeclaration */) { return getModuleInstanceState(node.body); } else { @@ -12575,6 +13581,7 @@ var ts; function createBinder() { var file; var options; + var languageVersion; var parent; var container; var blockScopeContainer; @@ -12582,10 +13589,19 @@ var ts; var seenThisKeyword; // state used by reachability checks var hasExplicitReturn; - var currentReachabilityState; - var labelStack; - var labelIndexMap; - var implicitLabels; + var currentFlow; + var currentBreakTarget; + var currentContinueTarget; + var currentTrueTarget; + var currentFalseTarget; + var preSwitchCaseFlow; + var activeLabels; + // state used for emit helpers + var hasClassExtends; + var hasAsyncFunctions; + var hasDecorators; + var hasParameterDecorators; + var hasJsxSpreadAttribute; // If this file is an external module, then it is automatically in strict-mode according to // ES6. If it is not an external module, then we'll determine if it is in strict mode or // not depending on if we see "use strict" in certain places (or if we hit a class/namespace). @@ -12593,26 +13609,41 @@ var ts; var symbolCount = 0; var Symbol; var classifiableNames; + var unreachableFlow = { flags: 1 /* Unreachable */ }; + var reportedUnreachableFlow = { flags: 1 /* Unreachable */ }; function bindSourceFile(f, opts) { file = f; options = opts; + languageVersion = ts.getEmitScriptTarget(options); inStrictMode = !!file.externalModuleIndicator; classifiableNames = {}; + symbolCount = 0; Symbol = ts.objectAllocator.getSymbolConstructor(); if (!file.locals) { bind(file); file.symbolCount = symbolCount; file.classifiableNames = classifiableNames; } + file = undefined; + options = undefined; + languageVersion = undefined; parent = undefined; container = undefined; blockScopeContainer = undefined; lastContainer = undefined; seenThisKeyword = false; hasExplicitReturn = false; - labelStack = undefined; - labelIndexMap = undefined; - implicitLabels = undefined; + currentFlow = undefined; + currentBreakTarget = undefined; + currentContinueTarget = undefined; + currentTrueTarget = undefined; + currentFalseTarget = undefined; + activeLabels = undefined; + hasClassExtends = false; + hasAsyncFunctions = false; + hasDecorators = false; + hasParameterDecorators = false; + hasJsxSpreadAttribute = false; } return bindSourceFile; function createSymbol(flags, name) { @@ -12632,20 +13663,25 @@ var ts; if (symbolFlags & 6240 /* HasMembers */ && !symbol.members) { symbol.members = {}; } - if (symbolFlags & 107455 /* Value */ && !symbol.valueDeclaration) { - symbol.valueDeclaration = node; + if (symbolFlags & 107455 /* Value */) { + var valueDeclaration = symbol.valueDeclaration; + if (!valueDeclaration || + (valueDeclaration.kind !== node.kind && valueDeclaration.kind === 225 /* ModuleDeclaration */)) { + // other kinds of value declarations take precedence over modules + symbol.valueDeclaration = node; + } } } // Should not be called on a declaration with a computed property name, // unless it is a well known Symbol. function getDeclarationName(node) { if (node.name) { - if (node.kind === 218 /* ModuleDeclaration */ && node.name.kind === 9 /* StringLiteral */) { - return "\"" + node.name.text + "\""; + if (ts.isAmbientModule(node)) { + return ts.isGlobalScopeAugmentation(node) ? "__global" : "\"" + node.name.text + "\""; } - if (node.name.kind === 136 /* ComputedPropertyName */) { + if (node.name.kind === 140 /* ComputedPropertyName */) { var nameExpression = node.name.expression; - // treat computed property names where expression is string/numeric literal as just string/numeric literal + // treat computed property names where expression is string/numeric literal as just string/numeric literal if (ts.isStringOrNumericLiteral(nameExpression.kind)) { return nameExpression.text; } @@ -12655,26 +13691,47 @@ var ts; return node.name.text; } switch (node.kind) { - case 144 /* Constructor */: + case 148 /* Constructor */: return "__constructor"; - case 152 /* FunctionType */: - case 147 /* CallSignature */: + case 156 /* FunctionType */: + case 151 /* CallSignature */: return "__call"; - case 153 /* ConstructorType */: - case 148 /* ConstructSignature */: + case 157 /* ConstructorType */: + case 152 /* ConstructSignature */: return "__new"; - case 149 /* IndexSignature */: + case 153 /* IndexSignature */: return "__index"; - case 228 /* ExportDeclaration */: + case 236 /* ExportDeclaration */: return "__export"; - case 227 /* ExportAssignment */: + case 235 /* ExportAssignment */: return node.isExportEquals ? "export=" : "default"; - case 181 /* BinaryExpression */: - // Binary expression case is for JS module 'module.exports = expr' - return "export="; - case 213 /* FunctionDeclaration */: - case 214 /* ClassDeclaration */: + case 187 /* BinaryExpression */: + switch (ts.getSpecialPropertyAssignmentKind(node)) { + case 2 /* ModuleExports */: + // module.exports = ... + return "export="; + case 1 /* ExportsProperty */: + case 4 /* ThisProperty */: + // exports.x = ... or this.y = ... + return node.left.name.text; + case 3 /* PrototypeProperty */: + // className.prototype.methodName = ... + return node.left.expression.name.text; + } + ts.Debug.fail("Unknown binary declaration kind"); + break; + case 220 /* FunctionDeclaration */: + case 221 /* ClassDeclaration */: return node.flags & 512 /* Default */ ? "default" : undefined; + case 269 /* JSDocFunctionType */: + return ts.isJSDocConstructSignature(node) ? "__new" : "__call"; + case 142 /* Parameter */: + // Parameters with names are handled at the top of this function. Parameters + // without names can only come from JSDocFunctionTypes. + ts.Debug.assert(node.parent.kind === 269 /* JSDocFunctionType */); + var functionType = node.parent; + var index = ts.indexOf(functionType.parameters, node); + return "p" + index; } } function getDisplayName(node) { @@ -12725,18 +13782,18 @@ var ts; } // Report errors every position with duplicate declaration // Report errors on previous encountered declarations - var message = symbol.flags & 2 /* BlockScopedVariable */ + var message_1 = symbol.flags & 2 /* BlockScopedVariable */ ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0; ts.forEach(symbol.declarations, function (declaration) { if (declaration.flags & 512 /* Default */) { - message = ts.Diagnostics.A_module_cannot_have_multiple_default_exports; + message_1 = ts.Diagnostics.A_module_cannot_have_multiple_default_exports; } }); ts.forEach(symbol.declarations, function (declaration) { - file.bindDiagnostics.push(ts.createDiagnosticForNode(declaration.name || declaration, message, getDisplayName(declaration))); + file.bindDiagnostics.push(ts.createDiagnosticForNode(declaration.name || declaration, message_1, getDisplayName(declaration))); }); - file.bindDiagnostics.push(ts.createDiagnosticForNode(node.name || node, message, getDisplayName(node))); + file.bindDiagnostics.push(ts.createDiagnosticForNode(node.name || node, message_1, getDisplayName(node))); symbol = createSymbol(0 /* None */, name); } } @@ -12748,9 +13805,9 @@ var ts; return symbol; } function declareModuleMember(node, symbolFlags, symbolExcludes) { - var hasExportModifier = ts.getCombinedNodeFlags(node) & 2 /* Export */; + var hasExportModifier = ts.getCombinedNodeFlags(node) & 1 /* Export */; if (symbolFlags & 8388608 /* Alias */) { - if (node.kind === 230 /* ExportSpecifier */ || (node.kind === 221 /* ImportEqualsDeclaration */ && hasExportModifier)) { + if (node.kind === 238 /* ExportSpecifier */ || (node.kind === 229 /* ImportEqualsDeclaration */ && hasExportModifier)) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); } else { @@ -12769,7 +13826,11 @@ var ts; // 2. When we checkIdentifier in the checker, we set its resolved symbol to the local symbol, // but return the export symbol (by calling getExportSymbolOfValueSymbolIfExported). That way // when the emitter comes back to it, it knows not to qualify the name if it was found in a containing scope. - if (hasExportModifier || container.flags & 131072 /* ExportContext */) { + // NOTE: Nested ambient modules always should go to to 'locals' table to prevent their automatic merge + // during global merging in the checker. Why? The only case when ambient module is permitted inside another module is module augmentation + // and this case is specially handled. Module augmentations should only be merged with original module definition + // and should never be merged directly with other augmentation, and the latter case would be possible if automatic merge is allowed. + if (!ts.isAmbientModule(node) && (hasExportModifier || container.flags & 8192 /* ExportContext */)) { var exportKind = (symbolFlags & 107455 /* Value */ ? 1048576 /* ExportValue */ : 0) | (symbolFlags & 793056 /* Type */ ? 2097152 /* ExportType */ : 0) | (symbolFlags & 1536 /* Namespace */ ? 4194304 /* ExportNamespace */ : 0); @@ -12787,7 +13848,7 @@ var ts; // the getLocalNameOfContainer function in the type checker to validate that the local name // used for a container is unique. function bindChildren(node) { - // Before we recurse into a node's chilren, we first save the existing parent, container + // Before we recurse into a node's children, we first save the existing parent, container // and block-container. Then after we pop out of processing the children, we restore // these saved values. var saveParent = parent; @@ -12810,7 +13871,7 @@ var ts; // Finally, if this is a block-container, then we clear out any existing .locals object // it may contain within it. This happens in incremental scenarios. Because we can be // reusing a node from a previous compilation, that node may have had 'locals' created - // for it. We must clear this so we don't accidently move any stale data forward from + // for it. We must clear this so we don't accidentally move any stale data forward from // a previous compilation. var containerFlags = getContainerFlags(node); if (containerFlags & 1 /* IsContainer */) { @@ -12824,46 +13885,70 @@ var ts; blockScopeContainer = node; blockScopeContainer.locals = undefined; } - var savedReachabilityState; - var savedLabelStack; - var savedLabels; - var savedImplicitLabels; var savedHasExplicitReturn; + var savedCurrentFlow; + var savedBreakTarget; + var savedContinueTarget; + var savedActiveLabels; var kind = node.kind; var flags = node.flags; // reset all reachability check related flags on node (for incremental scenarios) - flags &= ~1572864 /* ReachabilityCheckFlags */; - if (kind === 215 /* InterfaceDeclaration */) { + flags &= ~98304 /* ReachabilityCheckFlags */; + // reset all emit helper flags on node (for incremental scenarios) + flags &= ~3932160 /* EmitHelperFlags */; + if (kind === 222 /* InterfaceDeclaration */) { seenThisKeyword = false; } - var saveState = kind === 248 /* SourceFile */ || kind === 219 /* ModuleBlock */ || ts.isFunctionLikeKind(kind); + var saveState = kind === 256 /* SourceFile */ || kind === 226 /* ModuleBlock */ || ts.isFunctionLikeKind(kind); if (saveState) { - savedReachabilityState = currentReachabilityState; - savedLabelStack = labelStack; - savedLabels = labelIndexMap; - savedImplicitLabels = implicitLabels; savedHasExplicitReturn = hasExplicitReturn; - currentReachabilityState = 2 /* Reachable */; + savedCurrentFlow = currentFlow; + savedBreakTarget = currentBreakTarget; + savedContinueTarget = currentContinueTarget; + savedActiveLabels = activeLabels; hasExplicitReturn = false; - labelStack = labelIndexMap = implicitLabels = undefined; + currentFlow = { flags: 2 /* Start */ }; + currentBreakTarget = undefined; + currentContinueTarget = undefined; + activeLabels = undefined; + } + if (ts.isInJavaScriptFile(node) && node.jsDocComment) { + bind(node.jsDocComment); } bindReachableStatement(node); - if (currentReachabilityState === 2 /* Reachable */ && ts.isFunctionLikeKind(kind) && ts.nodeIsPresent(node.body)) { - flags |= 524288 /* HasImplicitReturn */; + if (!(currentFlow.flags & 1 /* Unreachable */) && ts.isFunctionLikeKind(kind) && ts.nodeIsPresent(node.body)) { + flags |= 32768 /* HasImplicitReturn */; if (hasExplicitReturn) { - flags |= 1048576 /* HasExplicitReturn */; + flags |= 65536 /* HasExplicitReturn */; } } - if (kind === 215 /* InterfaceDeclaration */) { - flags = seenThisKeyword ? flags | 262144 /* ContainsThis */ : flags & ~262144 /* ContainsThis */; + if (kind === 222 /* InterfaceDeclaration */) { + flags = seenThisKeyword ? flags | 16384 /* ContainsThis */ : flags & ~16384 /* ContainsThis */; + } + if (kind === 256 /* SourceFile */) { + if (hasClassExtends) { + flags |= 262144 /* HasClassExtends */; + } + if (hasDecorators) { + flags |= 524288 /* HasDecorators */; + } + if (hasParameterDecorators) { + flags |= 1048576 /* HasParamDecorators */; + } + if (hasAsyncFunctions) { + flags |= 2097152 /* HasAsyncFunctions */; + } + if (hasJsxSpreadAttribute) { + flags |= 1073741824 /* HasJsxSpreadAttribute */; + } } node.flags = flags; if (saveState) { hasExplicitReturn = savedHasExplicitReturn; - currentReachabilityState = savedReachabilityState; - labelStack = savedLabelStack; - labelIndexMap = savedLabels; - implicitLabels = savedImplicitLabels; + currentFlow = savedCurrentFlow; + currentBreakTarget = savedBreakTarget; + currentContinueTarget = savedContinueTarget; + activeLabels = savedActiveLabels; } container = saveContainer; parent = saveParent; @@ -12879,209 +13964,566 @@ var ts; return; } switch (node.kind) { - case 198 /* WhileStatement */: + case 205 /* WhileStatement */: bindWhileStatement(node); break; - case 197 /* DoStatement */: + case 204 /* DoStatement */: bindDoStatement(node); break; - case 199 /* ForStatement */: + case 206 /* ForStatement */: bindForStatement(node); break; - case 200 /* ForInStatement */: - case 201 /* ForOfStatement */: + case 207 /* ForInStatement */: + case 208 /* ForOfStatement */: bindForInOrForOfStatement(node); break; - case 196 /* IfStatement */: + case 203 /* IfStatement */: bindIfStatement(node); break; - case 204 /* ReturnStatement */: - case 208 /* ThrowStatement */: + case 211 /* ReturnStatement */: + case 215 /* ThrowStatement */: bindReturnOrThrow(node); break; - case 203 /* BreakStatement */: - case 202 /* ContinueStatement */: + case 210 /* BreakStatement */: + case 209 /* ContinueStatement */: bindBreakOrContinueStatement(node); break; - case 209 /* TryStatement */: + case 216 /* TryStatement */: bindTryStatement(node); break; - case 206 /* SwitchStatement */: + case 213 /* SwitchStatement */: bindSwitchStatement(node); break; - case 220 /* CaseBlock */: + case 227 /* CaseBlock */: bindCaseBlock(node); break; - case 207 /* LabeledStatement */: + case 214 /* LabeledStatement */: bindLabeledStatement(node); break; + case 185 /* PrefixUnaryExpression */: + bindPrefixUnaryExpressionFlow(node); + break; + case 187 /* BinaryExpression */: + bindBinaryExpressionFlow(node); + break; + case 181 /* DeleteExpression */: + bindDeleteExpressionFlow(node); + break; + case 188 /* ConditionalExpression */: + bindConditionalExpressionFlow(node); + break; + case 218 /* VariableDeclaration */: + bindVariableDeclarationFlow(node); + break; default: ts.forEachChild(node, bind); break; } } - function bindWhileStatement(n) { - var preWhileState = n.expression.kind === 84 /* FalseKeyword */ ? 4 /* Unreachable */ : currentReachabilityState; - var postWhileState = n.expression.kind === 99 /* TrueKeyword */ ? 4 /* Unreachable */ : currentReachabilityState; - // bind expressions (don't affect reachability) - bind(n.expression); - currentReachabilityState = preWhileState; - var postWhileLabel = pushImplicitLabel(); - bind(n.statement); - popImplicitLabel(postWhileLabel, postWhileState); + function isNarrowableReference(expr) { + return expr.kind === 69 /* Identifier */ || + expr.kind === 97 /* ThisKeyword */ || + expr.kind === 172 /* PropertyAccessExpression */ && isNarrowableReference(expr.expression); } - function bindDoStatement(n) { - var preDoState = currentReachabilityState; - var postDoLabel = pushImplicitLabel(); - bind(n.statement); - var postDoState = n.expression.kind === 99 /* TrueKeyword */ ? 4 /* Unreachable */ : preDoState; - popImplicitLabel(postDoLabel, postDoState); - // bind expressions (don't affect reachability) - bind(n.expression); - } - function bindForStatement(n) { - var preForState = currentReachabilityState; - var postForLabel = pushImplicitLabel(); - // bind expressions (don't affect reachability) - bind(n.initializer); - bind(n.condition); - bind(n.incrementor); - bind(n.statement); - // for statement is considered infinite when it condition is either omitted or is true keyword - // - for(..;;..) - // - for(..;true;..) - var isInfiniteLoop = (!n.condition || n.condition.kind === 99 /* TrueKeyword */); - var postForState = isInfiniteLoop ? 4 /* Unreachable */ : preForState; - popImplicitLabel(postForLabel, postForState); - } - function bindForInOrForOfStatement(n) { - var preStatementState = currentReachabilityState; - var postStatementLabel = pushImplicitLabel(); - // bind expressions (don't affect reachability) - bind(n.initializer); - bind(n.expression); - bind(n.statement); - popImplicitLabel(postStatementLabel, preStatementState); - } - function bindIfStatement(n) { - // denotes reachability state when entering 'thenStatement' part of the if statement: - // i.e. if condition is false then thenStatement is unreachable - var ifTrueState = n.expression.kind === 84 /* FalseKeyword */ ? 4 /* Unreachable */ : currentReachabilityState; - // denotes reachability state when entering 'elseStatement': - // i.e. if condition is true then elseStatement is unreachable - var ifFalseState = n.expression.kind === 99 /* TrueKeyword */ ? 4 /* Unreachable */ : currentReachabilityState; - currentReachabilityState = ifTrueState; - // bind expression (don't affect reachability) - bind(n.expression); - bind(n.thenStatement); - if (n.elseStatement) { - var preElseState = currentReachabilityState; - currentReachabilityState = ifFalseState; - bind(n.elseStatement); - currentReachabilityState = or(currentReachabilityState, preElseState); + function isNarrowingExpression(expr) { + switch (expr.kind) { + case 69 /* Identifier */: + case 97 /* ThisKeyword */: + case 172 /* PropertyAccessExpression */: + return isNarrowableReference(expr); + case 174 /* CallExpression */: + return true; + case 178 /* ParenthesizedExpression */: + return isNarrowingExpression(expr.expression); + case 187 /* BinaryExpression */: + return isNarrowingBinaryExpression(expr); + case 185 /* PrefixUnaryExpression */: + return expr.operator === 49 /* ExclamationToken */ && isNarrowingExpression(expr.operand); } - else { - currentReachabilityState = or(currentReachabilityState, ifFalseState); + return false; + } + function isNarrowingBinaryExpression(expr) { + switch (expr.operatorToken.kind) { + case 56 /* EqualsToken */: + return isNarrowableReference(expr.left); + case 30 /* EqualsEqualsToken */: + case 31 /* ExclamationEqualsToken */: + case 32 /* EqualsEqualsEqualsToken */: + case 33 /* ExclamationEqualsEqualsToken */: + if (isNarrowingExpression(expr.left) && (expr.right.kind === 93 /* NullKeyword */ || expr.right.kind === 69 /* Identifier */)) { + return true; + } + if (expr.left.kind === 182 /* TypeOfExpression */ && isNarrowingExpression(expr.left.expression) && expr.right.kind === 9 /* StringLiteral */) { + return true; + } + return false; + case 91 /* InstanceOfKeyword */: + return isNarrowingExpression(expr.left); + case 24 /* CommaToken */: + return isNarrowingExpression(expr.right); + } + return false; + } + function createBranchLabel() { + return { + flags: 4 /* BranchLabel */, + antecedents: undefined + }; + } + function createLoopLabel() { + return { + flags: 8 /* LoopLabel */, + antecedents: undefined + }; + } + function setFlowNodeReferenced(flow) { + // On first reference we set the Referenced flag, thereafter we set the Shared flag + flow.flags |= flow.flags & 128 /* Referenced */ ? 256 /* Shared */ : 128 /* Referenced */; + } + function addAntecedent(label, antecedent) { + if (!(antecedent.flags & 1 /* Unreachable */) && !ts.contains(label.antecedents, antecedent)) { + (label.antecedents || (label.antecedents = [])).push(antecedent); + setFlowNodeReferenced(antecedent); } } - function bindReturnOrThrow(n) { - // bind expression (don't affect reachability) - bind(n.expression); - if (n.kind === 204 /* ReturnStatement */) { - hasExplicitReturn = true; + function createFlowCondition(flags, antecedent, expression) { + if (antecedent.flags & 1 /* Unreachable */) { + return antecedent; } - currentReachabilityState = 4 /* Unreachable */; - } - function bindBreakOrContinueStatement(n) { - // call bind on label (don't affect reachability) - bind(n.label); - // for continue case touch label so it will be marked a used - var isValidJump = jumpToLabel(n.label, n.kind === 203 /* BreakStatement */ ? currentReachabilityState : 4 /* Unreachable */); - if (isValidJump) { - currentReachabilityState = 4 /* Unreachable */; + if (!expression) { + return flags & 32 /* TrueCondition */ ? antecedent : unreachableFlow; } + if (expression.kind === 99 /* TrueKeyword */ && flags & 64 /* FalseCondition */ || + expression.kind === 84 /* FalseKeyword */ && flags & 32 /* TrueCondition */) { + return unreachableFlow; + } + if (!isNarrowingExpression(expression)) { + return antecedent; + } + setFlowNodeReferenced(antecedent); + return { + flags: flags, + antecedent: antecedent, + expression: expression + }; } - function bindTryStatement(n) { - // catch\finally blocks has the same reachability as try block - var preTryState = currentReachabilityState; - bind(n.tryBlock); - var postTryState = currentReachabilityState; - currentReachabilityState = preTryState; - bind(n.catchClause); - var postCatchState = currentReachabilityState; - currentReachabilityState = preTryState; - bind(n.finallyBlock); - // post catch/finally state is reachable if - // - post try state is reachable - control flow can fall out of try block - // - post catch state is reachable - control flow can fall out of catch block - currentReachabilityState = or(postTryState, postCatchState); + function createFlowAssignment(antecedent, node) { + setFlowNodeReferenced(antecedent); + return { + flags: 16 /* Assignment */, + antecedent: antecedent, + node: node + }; } - function bindSwitchStatement(n) { - var preSwitchState = currentReachabilityState; - var postSwitchLabel = pushImplicitLabel(); - // bind expression (don't affect reachability) - bind(n.expression); - bind(n.caseBlock); - var hasDefault = ts.forEach(n.caseBlock.clauses, function (c) { return c.kind === 242 /* DefaultClause */; }); - // post switch state is unreachable if switch is exaustive (has a default case ) and does not have fallthrough from the last case - var postSwitchState = hasDefault && currentReachabilityState !== 2 /* Reachable */ ? 4 /* Unreachable */ : preSwitchState; - popImplicitLabel(postSwitchLabel, postSwitchState); + function finishFlowLabel(flow) { + var antecedents = flow.antecedents; + if (!antecedents) { + return unreachableFlow; + } + if (antecedents.length === 1) { + return antecedents[0]; + } + return flow; } - function bindCaseBlock(n) { - var startState = currentReachabilityState; - for (var _i = 0, _a = n.clauses; _i < _a.length; _i++) { - var clause = _a[_i]; - currentReachabilityState = startState; - bind(clause); - if (clause.statements.length && currentReachabilityState === 2 /* Reachable */ && options.noFallthroughCasesInSwitch) { - errorOnFirstToken(clause, ts.Diagnostics.Fallthrough_case_in_switch); + function isStatementCondition(node) { + var parent = node.parent; + switch (parent.kind) { + case 203 /* IfStatement */: + case 205 /* WhileStatement */: + case 204 /* DoStatement */: + return parent.expression === node; + case 206 /* ForStatement */: + case 188 /* ConditionalExpression */: + return parent.condition === node; + } + return false; + } + function isLogicalExpression(node) { + while (true) { + if (node.kind === 178 /* ParenthesizedExpression */) { + node = node.expression; + } + else if (node.kind === 185 /* PrefixUnaryExpression */ && node.operator === 49 /* ExclamationToken */) { + node = node.operand; + } + else { + return node.kind === 187 /* BinaryExpression */ && (node.operatorToken.kind === 51 /* AmpersandAmpersandToken */ || + node.operatorToken.kind === 52 /* BarBarToken */); } } } - function bindLabeledStatement(n) { - // call bind on label (don't affect reachability) - bind(n.label); - var ok = pushNamedLabel(n.label); - bind(n.statement); - if (ok) { - popNamedLabel(n.label, currentReachabilityState); + function isTopLevelLogicalExpression(node) { + while (node.parent.kind === 178 /* ParenthesizedExpression */ || + node.parent.kind === 185 /* PrefixUnaryExpression */ && + node.parent.operator === 49 /* ExclamationToken */) { + node = node.parent; + } + return !isStatementCondition(node) && !isLogicalExpression(node.parent); + } + function bindCondition(node, trueTarget, falseTarget) { + var saveTrueTarget = currentTrueTarget; + var saveFalseTarget = currentFalseTarget; + currentTrueTarget = trueTarget; + currentFalseTarget = falseTarget; + bind(node); + currentTrueTarget = saveTrueTarget; + currentFalseTarget = saveFalseTarget; + if (!node || !isLogicalExpression(node)) { + addAntecedent(trueTarget, createFlowCondition(32 /* TrueCondition */, currentFlow, node)); + addAntecedent(falseTarget, createFlowCondition(64 /* FalseCondition */, currentFlow, node)); + } + } + function bindIterativeStatement(node, breakTarget, continueTarget) { + var saveBreakTarget = currentBreakTarget; + var saveContinueTarget = currentContinueTarget; + currentBreakTarget = breakTarget; + currentContinueTarget = continueTarget; + bind(node); + currentBreakTarget = saveBreakTarget; + currentContinueTarget = saveContinueTarget; + } + function bindWhileStatement(node) { + var preWhileLabel = createLoopLabel(); + var preBodyLabel = createBranchLabel(); + var postWhileLabel = createBranchLabel(); + addAntecedent(preWhileLabel, currentFlow); + currentFlow = preWhileLabel; + bindCondition(node.expression, preBodyLabel, postWhileLabel); + currentFlow = finishFlowLabel(preBodyLabel); + bindIterativeStatement(node.statement, postWhileLabel, preWhileLabel); + addAntecedent(preWhileLabel, currentFlow); + currentFlow = finishFlowLabel(postWhileLabel); + } + function bindDoStatement(node) { + var preDoLabel = createLoopLabel(); + var preConditionLabel = createBranchLabel(); + var postDoLabel = createBranchLabel(); + addAntecedent(preDoLabel, currentFlow); + currentFlow = preDoLabel; + bindIterativeStatement(node.statement, postDoLabel, preConditionLabel); + addAntecedent(preConditionLabel, currentFlow); + currentFlow = finishFlowLabel(preConditionLabel); + bindCondition(node.expression, preDoLabel, postDoLabel); + currentFlow = finishFlowLabel(postDoLabel); + } + function bindForStatement(node) { + var preLoopLabel = createLoopLabel(); + var preBodyLabel = createBranchLabel(); + var postLoopLabel = createBranchLabel(); + bind(node.initializer); + addAntecedent(preLoopLabel, currentFlow); + currentFlow = preLoopLabel; + bindCondition(node.condition, preBodyLabel, postLoopLabel); + currentFlow = finishFlowLabel(preBodyLabel); + bindIterativeStatement(node.statement, postLoopLabel, preLoopLabel); + bind(node.incrementor); + addAntecedent(preLoopLabel, currentFlow); + currentFlow = finishFlowLabel(postLoopLabel); + } + function bindForInOrForOfStatement(node) { + var preLoopLabel = createLoopLabel(); + var postLoopLabel = createBranchLabel(); + addAntecedent(preLoopLabel, currentFlow); + currentFlow = preLoopLabel; + bind(node.expression); + addAntecedent(postLoopLabel, currentFlow); + bind(node.initializer); + if (node.initializer.kind !== 219 /* VariableDeclarationList */) { + bindAssignmentTargetFlow(node.initializer); + } + bindIterativeStatement(node.statement, postLoopLabel, preLoopLabel); + addAntecedent(preLoopLabel, currentFlow); + currentFlow = finishFlowLabel(postLoopLabel); + } + function bindIfStatement(node) { + var thenLabel = createBranchLabel(); + var elseLabel = createBranchLabel(); + var postIfLabel = createBranchLabel(); + bindCondition(node.expression, thenLabel, elseLabel); + currentFlow = finishFlowLabel(thenLabel); + bind(node.thenStatement); + addAntecedent(postIfLabel, currentFlow); + currentFlow = finishFlowLabel(elseLabel); + bind(node.elseStatement); + addAntecedent(postIfLabel, currentFlow); + currentFlow = finishFlowLabel(postIfLabel); + } + function bindReturnOrThrow(node) { + bind(node.expression); + if (node.kind === 211 /* ReturnStatement */) { + hasExplicitReturn = true; + } + currentFlow = unreachableFlow; + } + function findActiveLabel(name) { + if (activeLabels) { + for (var _i = 0, activeLabels_1 = activeLabels; _i < activeLabels_1.length; _i++) { + var label = activeLabels_1[_i]; + if (label.name === name) { + return label; + } + } + } + return undefined; + } + function bindbreakOrContinueFlow(node, breakTarget, continueTarget) { + var flowLabel = node.kind === 210 /* BreakStatement */ ? breakTarget : continueTarget; + if (flowLabel) { + addAntecedent(flowLabel, currentFlow); + currentFlow = unreachableFlow; + } + } + function bindBreakOrContinueStatement(node) { + bind(node.label); + if (node.label) { + var activeLabel = findActiveLabel(node.label.text); + if (activeLabel) { + activeLabel.referenced = true; + bindbreakOrContinueFlow(node, activeLabel.breakTarget, activeLabel.continueTarget); + } + } + else { + bindbreakOrContinueFlow(node, currentBreakTarget, currentContinueTarget); + } + } + function bindTryStatement(node) { + var postFinallyLabel = createBranchLabel(); + var preTryFlow = currentFlow; + // TODO: Every statement in try block is potentially an exit point! + bind(node.tryBlock); + addAntecedent(postFinallyLabel, currentFlow); + if (node.catchClause) { + currentFlow = preTryFlow; + bind(node.catchClause); + addAntecedent(postFinallyLabel, currentFlow); + } + if (node.finallyBlock) { + currentFlow = preTryFlow; + bind(node.finallyBlock); + } + currentFlow = finishFlowLabel(postFinallyLabel); + } + function bindSwitchStatement(node) { + var postSwitchLabel = createBranchLabel(); + bind(node.expression); + var saveBreakTarget = currentBreakTarget; + var savePreSwitchCaseFlow = preSwitchCaseFlow; + currentBreakTarget = postSwitchLabel; + preSwitchCaseFlow = currentFlow; + bind(node.caseBlock); + addAntecedent(postSwitchLabel, currentFlow); + var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 250 /* DefaultClause */; }); + if (!hasDefault) { + addAntecedent(postSwitchLabel, preSwitchCaseFlow); + } + currentBreakTarget = saveBreakTarget; + preSwitchCaseFlow = savePreSwitchCaseFlow; + currentFlow = finishFlowLabel(postSwitchLabel); + } + function bindCaseBlock(node) { + var clauses = node.clauses; + for (var i = 0; i < clauses.length; i++) { + var clause = clauses[i]; + if (clause.statements.length) { + if (currentFlow.flags & 1 /* Unreachable */) { + currentFlow = preSwitchCaseFlow; + } + else { + var preCaseLabel = createBranchLabel(); + addAntecedent(preCaseLabel, preSwitchCaseFlow); + addAntecedent(preCaseLabel, currentFlow); + currentFlow = finishFlowLabel(preCaseLabel); + } + bind(clause); + if (!(currentFlow.flags & 1 /* Unreachable */) && i !== clauses.length - 1 && options.noFallthroughCasesInSwitch) { + errorOnFirstToken(clause, ts.Diagnostics.Fallthrough_case_in_switch); + } + } + else { + bind(clause); + } + } + } + function pushActiveLabel(name, breakTarget, continueTarget) { + var activeLabel = { + name: name, + breakTarget: breakTarget, + continueTarget: continueTarget, + referenced: false + }; + (activeLabels || (activeLabels = [])).push(activeLabel); + return activeLabel; + } + function popActiveLabel() { + activeLabels.pop(); + } + function bindLabeledStatement(node) { + var preStatementLabel = createLoopLabel(); + var postStatementLabel = createBranchLabel(); + bind(node.label); + addAntecedent(preStatementLabel, currentFlow); + var activeLabel = pushActiveLabel(node.label.text, postStatementLabel, preStatementLabel); + bind(node.statement); + popActiveLabel(); + if (!activeLabel.referenced && !options.allowUnusedLabels) { + file.bindDiagnostics.push(ts.createDiagnosticForNode(node.label, ts.Diagnostics.Unused_label)); + } + addAntecedent(postStatementLabel, currentFlow); + currentFlow = finishFlowLabel(postStatementLabel); + } + function bindDestructuringTargetFlow(node) { + if (node.kind === 187 /* BinaryExpression */ && node.operatorToken.kind === 56 /* EqualsToken */) { + bindAssignmentTargetFlow(node.left); + } + else { + bindAssignmentTargetFlow(node); + } + } + function bindAssignmentTargetFlow(node) { + if (isNarrowableReference(node)) { + currentFlow = createFlowAssignment(currentFlow, node); + } + else if (node.kind === 170 /* ArrayLiteralExpression */) { + for (var _i = 0, _a = node.elements; _i < _a.length; _i++) { + var e = _a[_i]; + if (e.kind === 191 /* SpreadElementExpression */) { + bindAssignmentTargetFlow(e.expression); + } + else { + bindDestructuringTargetFlow(e); + } + } + } + else if (node.kind === 171 /* ObjectLiteralExpression */) { + for (var _b = 0, _c = node.properties; _b < _c.length; _b++) { + var p = _c[_b]; + if (p.kind === 253 /* PropertyAssignment */) { + bindDestructuringTargetFlow(p.initializer); + } + else if (p.kind === 254 /* ShorthandPropertyAssignment */) { + bindAssignmentTargetFlow(p.name); + } + } + } + } + function bindLogicalExpression(node, trueTarget, falseTarget) { + var preRightLabel = createBranchLabel(); + if (node.operatorToken.kind === 51 /* AmpersandAmpersandToken */) { + bindCondition(node.left, preRightLabel, falseTarget); + } + else { + bindCondition(node.left, trueTarget, preRightLabel); + } + currentFlow = finishFlowLabel(preRightLabel); + bind(node.operatorToken); + bindCondition(node.right, trueTarget, falseTarget); + } + function bindPrefixUnaryExpressionFlow(node) { + if (node.operator === 49 /* ExclamationToken */) { + var saveTrueTarget = currentTrueTarget; + currentTrueTarget = currentFalseTarget; + currentFalseTarget = saveTrueTarget; + ts.forEachChild(node, bind); + currentFalseTarget = currentTrueTarget; + currentTrueTarget = saveTrueTarget; + } + else { + ts.forEachChild(node, bind); + } + } + function bindBinaryExpressionFlow(node) { + var operator = node.operatorToken.kind; + if (operator === 51 /* AmpersandAmpersandToken */ || operator === 52 /* BarBarToken */) { + if (isTopLevelLogicalExpression(node)) { + var postExpressionLabel = createBranchLabel(); + bindLogicalExpression(node, postExpressionLabel, postExpressionLabel); + currentFlow = finishFlowLabel(postExpressionLabel); + } + else { + bindLogicalExpression(node, currentTrueTarget, currentFalseTarget); + } + } + else { + ts.forEachChild(node, bind); + if (operator === 56 /* EqualsToken */ && !ts.isAssignmentTarget(node)) { + bindAssignmentTargetFlow(node.left); + } + } + } + function bindDeleteExpressionFlow(node) { + ts.forEachChild(node, bind); + if (node.expression.kind === 172 /* PropertyAccessExpression */) { + bindAssignmentTargetFlow(node.expression); + } + } + function bindConditionalExpressionFlow(node) { + var trueLabel = createBranchLabel(); + var falseLabel = createBranchLabel(); + var postExpressionLabel = createBranchLabel(); + bindCondition(node.condition, trueLabel, falseLabel); + currentFlow = finishFlowLabel(trueLabel); + bind(node.whenTrue); + addAntecedent(postExpressionLabel, currentFlow); + currentFlow = finishFlowLabel(falseLabel); + bind(node.whenFalse); + addAntecedent(postExpressionLabel, currentFlow); + currentFlow = finishFlowLabel(postExpressionLabel); + } + function bindInitializedVariableFlow(node) { + var name = node.name; + if (ts.isBindingPattern(name)) { + for (var _i = 0, _a = name.elements; _i < _a.length; _i++) { + var child = _a[_i]; + bindInitializedVariableFlow(child); + } + } + else { + currentFlow = createFlowAssignment(currentFlow, node); + } + } + function bindVariableDeclarationFlow(node) { + ts.forEachChild(node, bind); + if (node.initializer || node.parent.parent.kind === 207 /* ForInStatement */ || node.parent.parent.kind === 208 /* ForOfStatement */) { + bindInitializedVariableFlow(node); } } function getContainerFlags(node) { switch (node.kind) { - case 186 /* ClassExpression */: - case 214 /* ClassDeclaration */: - case 215 /* InterfaceDeclaration */: - case 217 /* EnumDeclaration */: - case 155 /* TypeLiteral */: - case 165 /* ObjectLiteralExpression */: + case 192 /* ClassExpression */: + case 221 /* ClassDeclaration */: + case 222 /* InterfaceDeclaration */: + case 224 /* EnumDeclaration */: + case 171 /* ObjectLiteralExpression */: + case 159 /* TypeLiteral */: + case 265 /* JSDocRecordType */: return 1 /* IsContainer */; - case 147 /* CallSignature */: - case 148 /* ConstructSignature */: - case 149 /* IndexSignature */: - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - case 213 /* FunctionDeclaration */: - case 144 /* Constructor */: - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: - case 152 /* FunctionType */: - case 153 /* ConstructorType */: - case 173 /* FunctionExpression */: - case 174 /* ArrowFunction */: - case 218 /* ModuleDeclaration */: - case 248 /* SourceFile */: - case 216 /* TypeAliasDeclaration */: + case 151 /* CallSignature */: + case 152 /* ConstructSignature */: + case 153 /* IndexSignature */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: + case 220 /* FunctionDeclaration */: + case 148 /* Constructor */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: + case 156 /* FunctionType */: + case 269 /* JSDocFunctionType */: + case 157 /* ConstructorType */: + case 179 /* FunctionExpression */: + case 180 /* ArrowFunction */: + case 225 /* ModuleDeclaration */: + case 256 /* SourceFile */: + case 223 /* TypeAliasDeclaration */: return 5 /* IsContainerWithLocals */; - case 244 /* CatchClause */: - case 199 /* ForStatement */: - case 200 /* ForInStatement */: - case 201 /* ForOfStatement */: - case 220 /* CaseBlock */: + case 252 /* CatchClause */: + case 206 /* ForStatement */: + case 207 /* ForInStatement */: + case 208 /* ForOfStatement */: + case 227 /* CaseBlock */: return 2 /* IsBlockScopedContainer */; - case 192 /* Block */: + case 199 /* Block */: // do not treat blocks directly inside a function as a block-scoped-container. - // Locals that reside in this block should go to the function locals. Othewise 'x' + // Locals that reside in this block should go to the function locals. Otherwise 'x' // would not appear to be a redeclaration of a block scoped local in the following // example: // @@ -13116,38 +14558,40 @@ var ts; // members are declared (for example, a member of a class will go into a specific // symbol table depending on if it is static or not). We defer to specialized // handlers to take care of declaring these child members. - case 218 /* ModuleDeclaration */: + case 225 /* ModuleDeclaration */: return declareModuleMember(node, symbolFlags, symbolExcludes); - case 248 /* SourceFile */: + case 256 /* SourceFile */: return declareSourceFileMember(node, symbolFlags, symbolExcludes); - case 186 /* ClassExpression */: - case 214 /* ClassDeclaration */: + case 192 /* ClassExpression */: + case 221 /* ClassDeclaration */: return declareClassMember(node, symbolFlags, symbolExcludes); - case 217 /* EnumDeclaration */: + case 224 /* EnumDeclaration */: return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); - case 155 /* TypeLiteral */: - case 165 /* ObjectLiteralExpression */: - case 215 /* InterfaceDeclaration */: + case 159 /* TypeLiteral */: + case 171 /* ObjectLiteralExpression */: + case 222 /* InterfaceDeclaration */: + case 265 /* JSDocRecordType */: // Interface/Object-types always have their children added to the 'members' of // their container. They are only accessible through an instance of their // container, and are never in scope otherwise (even inside the body of the // object / type / interface declaring them). An exception is type parameters, // which are in scope without qualification (similar to 'locals'). return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); - case 152 /* FunctionType */: - case 153 /* ConstructorType */: - case 147 /* CallSignature */: - case 148 /* ConstructSignature */: - case 149 /* IndexSignature */: - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - case 144 /* Constructor */: - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: - case 213 /* FunctionDeclaration */: - case 173 /* FunctionExpression */: - case 174 /* ArrowFunction */: - case 216 /* TypeAliasDeclaration */: + case 156 /* FunctionType */: + case 157 /* ConstructorType */: + case 151 /* CallSignature */: + case 152 /* ConstructSignature */: + case 153 /* IndexSignature */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: + case 148 /* Constructor */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: + case 220 /* FunctionDeclaration */: + case 179 /* FunctionExpression */: + case 180 /* ArrowFunction */: + case 269 /* JSDocFunctionType */: + case 223 /* TypeAliasDeclaration */: // All the children of these container types are never visible through another // symbol (i.e. through another symbol's 'exports' or 'members'). Instead, // they're only accessed 'lexically' (i.e. from code that exists underneath @@ -13158,7 +14602,7 @@ var ts; } } function declareClassMember(node, symbolFlags, symbolExcludes) { - return node.flags & 64 /* Static */ + return node.flags & 32 /* Static */ ? declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes) : declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); } @@ -13168,11 +14612,11 @@ var ts; : declareSymbol(file.locals, undefined, node, symbolFlags, symbolExcludes); } function hasExportDeclarations(node) { - var body = node.kind === 248 /* SourceFile */ ? node : node.body; - if (body.kind === 248 /* SourceFile */ || body.kind === 219 /* ModuleBlock */) { + var body = node.kind === 256 /* SourceFile */ ? node : node.body; + if (body.kind === 256 /* SourceFile */ || body.kind === 226 /* ModuleBlock */) { for (var _i = 0, _a = body.statements; _i < _a.length; _i++) { var stat = _a[_i]; - if (stat.kind === 228 /* ExportDeclaration */ || stat.kind === 227 /* ExportAssignment */) { + if (stat.kind === 236 /* ExportDeclaration */ || stat.kind === 235 /* ExportAssignment */) { return true; } } @@ -13183,16 +14627,24 @@ var ts; // A declaration source file or ambient module declaration that contains no export declarations (but possibly regular // declarations with export modifiers) is an export context in which declarations are implicitly exported. if (ts.isInAmbientContext(node) && !hasExportDeclarations(node)) { - node.flags |= 131072 /* ExportContext */; + node.flags |= 8192 /* ExportContext */; } else { - node.flags &= ~131072 /* ExportContext */; + node.flags &= ~8192 /* ExportContext */; } } function bindModuleDeclaration(node) { setExportContextFlag(node); - if (node.name.kind === 9 /* StringLiteral */) { - declareSymbolAndAddToSymbolTable(node, 512 /* ValueModule */, 106639 /* ValueModuleExcludes */); + if (ts.isAmbientModule(node)) { + if (node.flags & 1 /* Export */) { + errorOnFirstToken(node, ts.Diagnostics.export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always_visible); + } + if (ts.isExternalModuleAugmentation(node)) { + declareSymbolAndAddToSymbolTable(node, 1024 /* NamespaceModule */, 0 /* NamespaceModuleExcludes */); + } + else { + declareSymbolAndAddToSymbolTable(node, 512 /* ValueModule */, 106639 /* ValueModuleExcludes */); + } } else { var state = getModuleInstanceState(node); @@ -13248,7 +14700,7 @@ var ts; continue; } var identifier = prop.name; - // ECMA-262 11.1.5 Object Initialiser + // ECMA-262 11.1.5 Object Initializer // If previous is not undefined then throw a SyntaxError exception if any of the following conditions are true // a.This production is contained in strict code and IsDataDescriptor(previous) is true and // IsDataDescriptor(propId.descriptor) is true. @@ -13256,7 +14708,7 @@ var ts; // c.IsAccessorDescriptor(previous) is true and IsDataDescriptor(propId.descriptor) is true. // d.IsAccessorDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true // and either both previous and propId.descriptor have[[Get]] fields or both previous and propId.descriptor have[[Set]] fields - var currentKind = prop.kind === 245 /* PropertyAssignment */ || prop.kind === 246 /* ShorthandPropertyAssignment */ || prop.kind === 143 /* MethodDeclaration */ + var currentKind = prop.kind === 253 /* PropertyAssignment */ || prop.kind === 254 /* ShorthandPropertyAssignment */ || prop.kind === 147 /* MethodDeclaration */ ? 1 /* Property */ : 2 /* Accessor */; var existingKind = seen[identifier.text]; @@ -13278,10 +14730,10 @@ var ts; } function bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) { switch (blockScopeContainer.kind) { - case 218 /* ModuleDeclaration */: + case 225 /* ModuleDeclaration */: declareModuleMember(node, symbolFlags, symbolExcludes); break; - case 248 /* SourceFile */: + case 256 /* SourceFile */: if (ts.isExternalModule(container)) { declareModuleMember(node, symbolFlags, symbolExcludes); break; @@ -13304,7 +14756,8 @@ var ts; if (inStrictMode && node.originalKeywordKind >= 106 /* FirstFutureReservedWord */ && node.originalKeywordKind <= 114 /* LastFutureReservedWord */ && - !ts.isIdentifierName(node)) { + !ts.isIdentifierName(node) && + !ts.isInAmbientContext(node)) { // Report error only if there are no parse errors in file if (!file.parseDiagnostics.length) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, getStrictModeIdentifierMessage(node), ts.declarationNameToString(node))); @@ -13377,8 +14830,32 @@ var ts; checkStrictModeEvalOrArguments(node, node.name); } } + function getStrictModeBlockScopeFunctionDeclarationMessage(node) { + // Provide specialized messages to help the user understand why we think they're in + // strict mode. + if (ts.getContainingClass(node)) { + return ts.Diagnostics.Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Class_definitions_are_automatically_in_strict_mode; + } + if (file.externalModuleIndicator) { + return ts.Diagnostics.Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Modules_are_automatically_in_strict_mode; + } + return ts.Diagnostics.Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5; + } + function checkStrictModeFunctionDeclaration(node) { + if (languageVersion < 2 /* ES6 */) { + // Report error if function is not top level function declaration + if (blockScopeContainer.kind !== 256 /* SourceFile */ && + blockScopeContainer.kind !== 225 /* ModuleDeclaration */ && + !ts.isFunctionLike(blockScopeContainer)) { + // We check first if the name is inside class declaration or class expression; if so give explicit message + // otherwise report generic error message. + var errorSpan = ts.getErrorSpanForNode(file, node); + file.bindDiagnostics.push(ts.createFileDiagnostic(file, errorSpan.start, errorSpan.length, getStrictModeBlockScopeFunctionDeclarationMessage(node))); + } + } + } function checkStrictModeNumericLiteral(node) { - if (inStrictMode && node.flags & 32768 /* OctalLiteral */) { + if (inStrictMode && node.isOctalLiteral) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Octal_literals_are_not_allowed_in_strict_mode)); } } @@ -13441,17 +14918,17 @@ var ts; } function updateStrictMode(node) { switch (node.kind) { - case 248 /* SourceFile */: - case 219 /* ModuleBlock */: + case 256 /* SourceFile */: + case 226 /* ModuleBlock */: updateStrictModeStatementList(node.statements); return; - case 192 /* Block */: + case 199 /* Block */: if (ts.isFunctionLike(node.parent)) { updateStrictModeStatementList(node.statements); } return; - case 214 /* ClassDeclaration */: - case 186 /* ClassExpression */: + case 221 /* ClassDeclaration */: + case 192 /* ClassExpression */: // All classes are automatically in strict mode in ES6. inStrictMode = true; return; @@ -13474,118 +14951,158 @@ var ts; var nodeText = ts.getTextOfNodeFromSourceText(file.text, node.expression); // Note: the node text must be exactly "use strict" or 'use strict'. It is not ok for the // string to contain unicode escapes (as per ES5). - return nodeText === "\"use strict\"" || nodeText === "'use strict'"; + return nodeText === '"use strict"' || nodeText === "'use strict'"; } function bindWorker(node) { switch (node.kind) { /* Strict mode checks */ case 69 /* Identifier */: + case 97 /* ThisKeyword */: + if (currentFlow && (ts.isExpression(node) || parent.kind === 254 /* ShorthandPropertyAssignment */)) { + node.flowNode = currentFlow; + } return checkStrictModeIdentifier(node); - case 181 /* BinaryExpression */: + case 172 /* PropertyAccessExpression */: + if (currentFlow && isNarrowableReference(node)) { + node.flowNode = currentFlow; + } + break; + case 187 /* BinaryExpression */: if (ts.isInJavaScriptFile(node)) { - if (ts.isExportsPropertyAssignment(node)) { - bindExportsPropertyAssignment(node); - } - else if (ts.isModuleExportsAssignment(node)) { - bindModuleExportsAssignment(node); + var specialKind = ts.getSpecialPropertyAssignmentKind(node); + switch (specialKind) { + case 1 /* ExportsProperty */: + bindExportsPropertyAssignment(node); + break; + case 2 /* ModuleExports */: + bindModuleExportsAssignment(node); + break; + case 3 /* PrototypeProperty */: + bindPrototypePropertyAssignment(node); + break; + case 4 /* ThisProperty */: + bindThisPropertyAssignment(node); + break; + case 0 /* None */: + // Nothing to do + break; + default: + ts.Debug.fail("Unknown special property assignment kind"); } } return checkStrictModeBinaryExpression(node); - case 244 /* CatchClause */: + case 252 /* CatchClause */: return checkStrictModeCatchClause(node); - case 175 /* DeleteExpression */: + case 181 /* DeleteExpression */: return checkStrictModeDeleteExpression(node); case 8 /* NumericLiteral */: return checkStrictModeNumericLiteral(node); - case 180 /* PostfixUnaryExpression */: + case 186 /* PostfixUnaryExpression */: return checkStrictModePostfixUnaryExpression(node); - case 179 /* PrefixUnaryExpression */: + case 185 /* PrefixUnaryExpression */: return checkStrictModePrefixUnaryExpression(node); - case 205 /* WithStatement */: + case 212 /* WithStatement */: return checkStrictModeWithStatement(node); - case 97 /* ThisKeyword */: + case 165 /* ThisType */: seenThisKeyword = true; return; - case 137 /* TypeParameter */: + case 154 /* TypePredicate */: + return checkTypePredicate(node); + case 141 /* TypeParameter */: return declareSymbolAndAddToSymbolTable(node, 262144 /* TypeParameter */, 530912 /* TypeParameterExcludes */); - case 138 /* Parameter */: + case 142 /* Parameter */: return bindParameter(node); - case 211 /* VariableDeclaration */: - case 163 /* BindingElement */: + case 218 /* VariableDeclaration */: + case 169 /* BindingElement */: return bindVariableDeclarationOrBindingElement(node); - case 141 /* PropertyDeclaration */: - case 140 /* PropertySignature */: + case 145 /* PropertyDeclaration */: + case 144 /* PropertySignature */: + case 266 /* JSDocRecordMember */: return bindPropertyOrMethodOrAccessor(node, 4 /* Property */ | (node.questionToken ? 536870912 /* Optional */ : 0 /* None */), 107455 /* PropertyExcludes */); - case 245 /* PropertyAssignment */: - case 246 /* ShorthandPropertyAssignment */: + case 253 /* PropertyAssignment */: + case 254 /* ShorthandPropertyAssignment */: return bindPropertyOrMethodOrAccessor(node, 4 /* Property */, 107455 /* PropertyExcludes */); - case 247 /* EnumMember */: + case 255 /* EnumMember */: return bindPropertyOrMethodOrAccessor(node, 8 /* EnumMember */, 107455 /* EnumMemberExcludes */); - case 147 /* CallSignature */: - case 148 /* ConstructSignature */: - case 149 /* IndexSignature */: + case 247 /* JsxSpreadAttribute */: + hasJsxSpreadAttribute = true; + return; + case 151 /* CallSignature */: + case 152 /* ConstructSignature */: + case 153 /* IndexSignature */: return declareSymbolAndAddToSymbolTable(node, 131072 /* Signature */, 0 /* None */); - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: // If this is an ObjectLiteralExpression method, then it sits in the same space // as other properties in the object literal. So we use SymbolFlags.PropertyExcludes // so that it will conflict with any other object literal members with the same // name. return bindPropertyOrMethodOrAccessor(node, 8192 /* Method */ | (node.questionToken ? 536870912 /* Optional */ : 0 /* None */), ts.isObjectLiteralMethod(node) ? 107455 /* PropertyExcludes */ : 99263 /* MethodExcludes */); - case 213 /* FunctionDeclaration */: - checkStrictModeFunctionName(node); - return declareSymbolAndAddToSymbolTable(node, 16 /* Function */, 106927 /* FunctionExcludes */); - case 144 /* Constructor */: + case 220 /* FunctionDeclaration */: + return bindFunctionDeclaration(node); + case 148 /* Constructor */: return declareSymbolAndAddToSymbolTable(node, 16384 /* Constructor */, /*symbolExcludes:*/ 0 /* None */); - case 145 /* GetAccessor */: + case 149 /* GetAccessor */: return bindPropertyOrMethodOrAccessor(node, 32768 /* GetAccessor */, 41919 /* GetAccessorExcludes */); - case 146 /* SetAccessor */: + case 150 /* SetAccessor */: return bindPropertyOrMethodOrAccessor(node, 65536 /* SetAccessor */, 74687 /* SetAccessorExcludes */); - case 152 /* FunctionType */: - case 153 /* ConstructorType */: + case 156 /* FunctionType */: + case 157 /* ConstructorType */: + case 269 /* JSDocFunctionType */: return bindFunctionOrConstructorType(node); - case 155 /* TypeLiteral */: + case 159 /* TypeLiteral */: + case 265 /* JSDocRecordType */: return bindAnonymousDeclaration(node, 2048 /* TypeLiteral */, "__type"); - case 165 /* ObjectLiteralExpression */: + case 171 /* ObjectLiteralExpression */: return bindObjectLiteralExpression(node); - case 173 /* FunctionExpression */: - case 174 /* ArrowFunction */: - checkStrictModeFunctionName(node); - var bindingName = node.name ? node.name.text : "__function"; - return bindAnonymousDeclaration(node, 16 /* Function */, bindingName); - case 168 /* CallExpression */: + case 179 /* FunctionExpression */: + case 180 /* ArrowFunction */: + return bindFunctionExpression(node); + case 174 /* CallExpression */: if (ts.isInJavaScriptFile(node)) { bindCallExpression(node); } break; // Members of classes, interfaces, and modules - case 186 /* ClassExpression */: - case 214 /* ClassDeclaration */: + case 192 /* ClassExpression */: + case 221 /* ClassDeclaration */: return bindClassLikeDeclaration(node); - case 215 /* InterfaceDeclaration */: + case 222 /* InterfaceDeclaration */: return bindBlockScopedDeclaration(node, 64 /* Interface */, 792960 /* InterfaceExcludes */); - case 216 /* TypeAliasDeclaration */: + case 223 /* TypeAliasDeclaration */: return bindBlockScopedDeclaration(node, 524288 /* TypeAlias */, 793056 /* TypeAliasExcludes */); - case 217 /* EnumDeclaration */: + case 224 /* EnumDeclaration */: return bindEnumDeclaration(node); - case 218 /* ModuleDeclaration */: + case 225 /* ModuleDeclaration */: return bindModuleDeclaration(node); // Imports and exports - case 221 /* ImportEqualsDeclaration */: - case 224 /* NamespaceImport */: - case 226 /* ImportSpecifier */: - case 230 /* ExportSpecifier */: + case 229 /* ImportEqualsDeclaration */: + case 232 /* NamespaceImport */: + case 234 /* ImportSpecifier */: + case 238 /* ExportSpecifier */: return declareSymbolAndAddToSymbolTable(node, 8388608 /* Alias */, 8388608 /* AliasExcludes */); - case 223 /* ImportClause */: + case 228 /* GlobalModuleExportDeclaration */: + return bindGlobalModuleExportDeclaration(node); + case 231 /* ImportClause */: return bindImportClause(node); - case 228 /* ExportDeclaration */: + case 236 /* ExportDeclaration */: return bindExportDeclaration(node); - case 227 /* ExportAssignment */: + case 235 /* ExportAssignment */: return bindExportAssignment(node); - case 248 /* SourceFile */: + case 256 /* SourceFile */: return bindSourceFileIfExternalModule(); } } + function checkTypePredicate(node) { + var parameterName = node.parameterName, type = node.type; + if (parameterName && parameterName.kind === 69 /* Identifier */) { + checkStrictModeIdentifier(parameterName); + } + if (parameterName && parameterName.kind === 165 /* ThisType */) { + seenThisKeyword = true; + } + bind(type); + } function bindSourceFileIfExternalModule() { setExportContextFlag(file); if (ts.isExternalModule(file)) { @@ -13596,12 +15113,12 @@ var ts; bindAnonymousDeclaration(file, 512 /* ValueModule */, "\"" + ts.removeFileExtension(file.fileName) + "\""); } function bindExportAssignment(node) { - var boundExpression = node.kind === 227 /* ExportAssignment */ ? node.expression : node.right; + var boundExpression = node.kind === 235 /* ExportAssignment */ ? node.expression : node.right; if (!container.symbol || !container.symbol.exports) { // Export assignment in some sort of block construct bindAnonymousDeclaration(node, 8388608 /* Alias */, getDeclarationName(node)); } - else if (boundExpression.kind === 69 /* Identifier */) { + else if (boundExpression.kind === 69 /* Identifier */ && node.kind === 235 /* ExportAssignment */) { // An export default clause with an identifier exports all meanings of that identifier declareSymbol(container.symbol.exports, container.symbol, node, 8388608 /* Alias */, 107455 /* PropertyExcludes */ | 8388608 /* AliasExcludes */); } @@ -13610,6 +15127,28 @@ var ts; declareSymbol(container.symbol.exports, container.symbol, node, 4 /* Property */, 107455 /* PropertyExcludes */ | 8388608 /* AliasExcludes */); } } + function bindGlobalModuleExportDeclaration(node) { + if (node.modifiers && node.modifiers.length) { + file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Modifiers_cannot_appear_here)); + } + if (node.parent.kind !== 256 /* SourceFile */) { + file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_at_top_level)); + return; + } + else { + var parent_5 = node.parent; + if (!ts.isExternalModule(parent_5)) { + file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_in_module_files)); + return; + } + if (!parent_5.isDeclarationFile) { + file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_in_declaration_files)); + return; + } + } + file.symbol.globalExports = file.symbol.globalExports || {}; + declareSymbol(file.symbol.globalExports, file.symbol, node, 8388608 /* Alias */, 8388608 /* AliasExcludes */); + } function bindExportDeclaration(node) { if (!container.symbol || !container.symbol.exports) { // Export * in some sort of block construct @@ -13640,17 +15179,55 @@ var ts; function bindModuleExportsAssignment(node) { // 'module.exports = expr' assignment setCommonJsModuleIndicator(node); - bindExportAssignment(node); + declareSymbol(file.symbol.exports, file.symbol, node, 4 /* Property */ | 7340032 /* Export */ | 512 /* ValueModule */, 0 /* None */); + } + function bindThisPropertyAssignment(node) { + // Declare a 'member' in case it turns out the container was an ES5 class + if (container.kind === 179 /* FunctionExpression */ || container.kind === 220 /* FunctionDeclaration */) { + container.symbol.members = container.symbol.members || {}; + // It's acceptable for multiple 'this' assignments of the same identifier to occur + declareSymbol(container.symbol.members, container.symbol, node, 4 /* Property */, 107455 /* PropertyExcludes */ & ~4 /* Property */); + } + } + function bindPrototypePropertyAssignment(node) { + // We saw a node of the form 'x.prototype.y = z'. Declare a 'member' y on x if x was a function. + // Look up the function in the local scope, since prototype assignments should + // follow the function declaration + var leftSideOfAssignment = node.left; + var classPrototype = leftSideOfAssignment.expression; + var constructorFunction = classPrototype.expression; + // Fix up parent pointers since we're going to use these nodes before we bind into them + leftSideOfAssignment.parent = node; + constructorFunction.parent = classPrototype; + classPrototype.parent = leftSideOfAssignment; + var funcSymbol = container.locals[constructorFunction.text]; + if (!funcSymbol || !(funcSymbol.flags & 16 /* Function */)) { + return; + } + // Set up the members collection if it doesn't exist already + if (!funcSymbol.members) { + funcSymbol.members = {}; + } + // Declare the method/property + declareSymbol(funcSymbol.members, funcSymbol, leftSideOfAssignment, 4 /* Property */, 107455 /* PropertyExcludes */); } function bindCallExpression(node) { // We're only inspecting call expressions to detect CommonJS modules, so we can skip // this check if we've already seen the module indicator - if (!file.commonJsModuleIndicator && ts.isRequireCall(node)) { + if (!file.commonJsModuleIndicator && ts.isRequireCall(node, /*checkArgumentIsStringLiteral*/ false)) { setCommonJsModuleIndicator(node); } } function bindClassLikeDeclaration(node) { - if (node.kind === 214 /* ClassDeclaration */) { + if (!ts.isDeclarationFile(file) && !ts.isInAmbientContext(node)) { + if (ts.getClassExtendsHeritageClauseElement(node) !== undefined) { + hasClassExtends = true; + } + if (ts.nodeIsDecorated(node)) { + hasDecorators = true; + } + } + if (node.kind === 221 /* ClassDeclaration */) { bindBlockScopedDeclaration(node, 32 /* Class */, 899519 /* ClassExcludes */); } else { @@ -13712,6 +15289,12 @@ var ts; } } function bindParameter(node) { + if (!ts.isDeclarationFile(file) && + !ts.isInAmbientContext(node) && + ts.nodeIsDecorated(node)) { + hasDecorators = true; + hasParameterDecorators = true; + } if (inStrictMode) { // It is a SyntaxError if the identifier eval or arguments appears within a FormalParameterList of a // strict mode FunctionLikeDeclaration or FunctionExpression(13.1) @@ -13725,123 +15308,90 @@ var ts; } // If this is a property-parameter, then also declare the property symbol into the // containing class. - if (node.flags & 56 /* AccessibilityModifier */ && - node.parent.kind === 144 /* Constructor */ && - ts.isClassLike(node.parent.parent)) { + if (ts.isParameterPropertyDeclaration(node)) { var classDeclaration = node.parent.parent; declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, 4 /* Property */, 107455 /* PropertyExcludes */); } } + function bindFunctionDeclaration(node) { + if (!ts.isDeclarationFile(file) && !ts.isInAmbientContext(node)) { + if (ts.isAsyncFunctionLike(node)) { + hasAsyncFunctions = true; + } + } + checkStrictModeFunctionName(node); + if (inStrictMode) { + checkStrictModeFunctionDeclaration(node); + return bindBlockScopedDeclaration(node, 16 /* Function */, 106927 /* FunctionExcludes */); + } + else { + return declareSymbolAndAddToSymbolTable(node, 16 /* Function */, 106927 /* FunctionExcludes */); + } + } + function bindFunctionExpression(node) { + if (!ts.isDeclarationFile(file) && !ts.isInAmbientContext(node)) { + if (ts.isAsyncFunctionLike(node)) { + hasAsyncFunctions = true; + } + } + checkStrictModeFunctionName(node); + var bindingName = node.name ? node.name.text : "__function"; + return bindAnonymousDeclaration(node, 16 /* Function */, bindingName); + } function bindPropertyOrMethodOrAccessor(node, symbolFlags, symbolExcludes) { + if (!ts.isDeclarationFile(file) && !ts.isInAmbientContext(node)) { + if (ts.isAsyncFunctionLike(node)) { + hasAsyncFunctions = true; + } + if (ts.nodeIsDecorated(node)) { + hasDecorators = true; + } + } return ts.hasDynamicName(node) ? bindAnonymousDeclaration(node, symbolFlags, "__computed") : declareSymbolAndAddToSymbolTable(node, symbolFlags, symbolExcludes); } // reachability checks - function pushNamedLabel(name) { - initializeReachabilityStateIfNecessary(); - if (ts.hasProperty(labelIndexMap, name.text)) { - return false; - } - labelIndexMap[name.text] = labelStack.push(1 /* Unintialized */) - 1; - return true; - } - function pushImplicitLabel() { - initializeReachabilityStateIfNecessary(); - var index = labelStack.push(1 /* Unintialized */) - 1; - implicitLabels.push(index); - return index; - } - function popNamedLabel(label, outerState) { - var index = labelIndexMap[label.text]; - ts.Debug.assert(index !== undefined); - ts.Debug.assert(labelStack.length == index + 1); - labelIndexMap[label.text] = undefined; - setCurrentStateAtLabel(labelStack.pop(), outerState, label); - } - function popImplicitLabel(implicitLabelIndex, outerState) { - if (labelStack.length !== implicitLabelIndex + 1) { - ts.Debug.assert(false, "Label stack: " + labelStack.length + ", index:" + implicitLabelIndex); - } - var i = implicitLabels.pop(); - if (implicitLabelIndex !== i) { - ts.Debug.assert(false, "i: " + i + ", index: " + implicitLabelIndex); - } - setCurrentStateAtLabel(labelStack.pop(), outerState, /*name*/ undefined); - } - function setCurrentStateAtLabel(innerMergedState, outerState, label) { - if (innerMergedState === 1 /* Unintialized */) { - if (label && !options.allowUnusedLabels) { - file.bindDiagnostics.push(ts.createDiagnosticForNode(label, ts.Diagnostics.Unused_label)); - } - currentReachabilityState = outerState; - } - else { - currentReachabilityState = or(innerMergedState, outerState); - } - } - function jumpToLabel(label, outerState) { - initializeReachabilityStateIfNecessary(); - var index = label ? labelIndexMap[label.text] : ts.lastOrUndefined(implicitLabels); - if (index === undefined) { - // reference to unknown label or - // break/continue used outside of loops - return false; - } - var stateAtLabel = labelStack[index]; - labelStack[index] = stateAtLabel === 1 /* Unintialized */ ? outerState : or(stateAtLabel, outerState); - return true; + function shouldReportErrorOnModuleDeclaration(node) { + var instanceState = getModuleInstanceState(node); + return instanceState === 1 /* Instantiated */ || (instanceState === 2 /* ConstEnumOnly */ && options.preserveConstEnums); } function checkUnreachable(node) { - switch (currentReachabilityState) { - case 4 /* Unreachable */: - var reportError = - // report error on all statements except empty ones - (ts.isStatement(node) && node.kind !== 194 /* EmptyStatement */) || - // report error on class declarations - node.kind === 214 /* ClassDeclaration */ || - // report error on instantiated modules or const-enums only modules if preserveConstEnums is set - (node.kind === 218 /* ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node)) || - // report error on regular enums and const enums if preserveConstEnums is set - (node.kind === 217 /* EnumDeclaration */ && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums)); - if (reportError) { - currentReachabilityState = 8 /* ReportedUnreachable */; - // unreachable code is reported if - // - user has explicitly asked about it AND - // - statement is in not ambient context (statements in ambient context is already an error - // so we should not report extras) AND - // - node is not variable statement OR - // - node is block scoped variable statement OR - // - node is not block scoped variable statement and at least one variable declaration has initializer - // Rationale: we don't want to report errors on non-initialized var's since they are hoisted - // On the other side we do want to report errors on non-initialized 'lets' because of TDZ - var reportUnreachableCode = !options.allowUnreachableCode && - !ts.isInAmbientContext(node) && - (node.kind !== 193 /* VariableStatement */ || - ts.getCombinedNodeFlags(node.declarationList) & 24576 /* BlockScoped */ || - ts.forEach(node.declarationList.declarations, function (d) { return d.initializer; })); - if (reportUnreachableCode) { - errorOnFirstToken(node, ts.Diagnostics.Unreachable_code_detected); - } + if (!(currentFlow.flags & 1 /* Unreachable */)) { + return false; + } + if (currentFlow === unreachableFlow) { + var reportError = + // report error on all statements except empty ones + (ts.isStatement(node) && node.kind !== 201 /* EmptyStatement */) || + // report error on class declarations + node.kind === 221 /* ClassDeclaration */ || + // report error on instantiated modules or const-enums only modules if preserveConstEnums is set + (node.kind === 225 /* ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node)) || + // report error on regular enums and const enums if preserveConstEnums is set + (node.kind === 224 /* EnumDeclaration */ && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums)); + if (reportError) { + currentFlow = reportedUnreachableFlow; + // unreachable code is reported if + // - user has explicitly asked about it AND + // - statement is in not ambient context (statements in ambient context is already an error + // so we should not report extras) AND + // - node is not variable statement OR + // - node is block scoped variable statement OR + // - node is not block scoped variable statement and at least one variable declaration has initializer + // Rationale: we don't want to report errors on non-initialized var's since they are hoisted + // On the other side we do want to report errors on non-initialized 'lets' because of TDZ + var reportUnreachableCode = !options.allowUnreachableCode && + !ts.isInAmbientContext(node) && + (node.kind !== 200 /* VariableStatement */ || + ts.getCombinedNodeFlags(node.declarationList) & 3072 /* BlockScoped */ || + ts.forEach(node.declarationList.declarations, function (d) { return d.initializer; })); + if (reportUnreachableCode) { + errorOnFirstToken(node, ts.Diagnostics.Unreachable_code_detected); } - case 8 /* ReportedUnreachable */: - return true; - default: - return false; + } } - function shouldReportErrorOnModuleDeclaration(node) { - var instanceState = getModuleInstanceState(node); - return instanceState === 1 /* Instantiated */ || (instanceState === 2 /* ConstEnumOnly */ && options.preserveConstEnums); - } - } - function initializeReachabilityStateIfNecessary() { - if (labelIndexMap) { - return; - } - currentReachabilityState = 2 /* Reachable */; - labelIndexMap = {}; - labelStack = []; - implicitLabels = []; + return true; } } })(ts || (ts = {})); @@ -13852,16 +15402,20 @@ var ts; var nextSymbolId = 1; var nextNodeId = 1; var nextMergeId = 1; + var nextFlowId = 1; function getNodeId(node) { - if (!node.id) - node.id = nextNodeId++; + if (!node.id) { + node.id = nextNodeId; + nextNodeId++; + } return node.id; } ts.getNodeId = getNodeId; ts.checkTime = 0; function getSymbolId(symbol) { if (!symbol.id) { - symbol.id = nextSymbolId++; + symbol.id = nextSymbolId; + nextSymbolId++; } return symbol.id; } @@ -13886,9 +15440,12 @@ var ts; var emptySymbols = {}; var compilerOptions = host.getCompilerOptions(); var languageVersion = compilerOptions.target || 0 /* ES3 */; - var modulekind = compilerOptions.module ? compilerOptions.module : languageVersion === 2 /* ES6 */ ? 5 /* ES6 */ : 0 /* None */; + var modulekind = ts.getEmitModuleKind(compilerOptions); + var allowSyntheticDefaultImports = typeof compilerOptions.allowSyntheticDefaultImports !== "undefined" ? compilerOptions.allowSyntheticDefaultImports : modulekind === ts.ModuleKind.System; + var strictNullChecks = compilerOptions.strictNullChecks; var emitResolver = createResolver(); var undefinedSymbol = createSymbol(4 /* Property */ | 67108864 /* Transient */, "undefined"); + undefinedSymbol.declarations = []; var argumentsSymbol = createSymbol(4 /* Property */ | 67108864 /* Transient */, "arguments"); var checker = { getNodeCount: function () { return ts.sum(host.getSourceFiles(), "nodeCount"); }, @@ -13897,11 +15454,11 @@ var ts; getTypeCount: function () { return typeCount; }, isUndefinedSymbol: function (symbol) { return symbol === undefinedSymbol; }, isArgumentsSymbol: function (symbol) { return symbol === argumentsSymbol; }, + isUnknownSymbol: function (symbol) { return symbol === unknownSymbol; }, getDiagnostics: getDiagnostics, getGlobalDiagnostics: getGlobalDiagnostics, - // The language service will always care about the narrowed type of a symbol, because that is - // the type the language says the symbol should have. - getTypeOfSymbolAtLocation: getNarrowedTypeOfSymbol, + getTypeOfSymbolAtLocation: getTypeOfSymbolAtLocation, + getSymbolsOfParameterPropertyDeclaration: getSymbolsOfParameterPropertyDeclaration, getDeclaredTypeOfSymbol: getDeclaredTypeOfSymbol, getPropertiesOfType: getPropertiesOfType, getPropertyOfType: getPropertyOfType, @@ -13909,16 +15466,19 @@ var ts; getIndexTypeOfType: getIndexTypeOfType, getBaseTypes: getBaseTypes, getReturnTypeOfSignature: getReturnTypeOfSignature, + getNonNullableType: getNonNullableType, getSymbolsInScope: getSymbolsInScope, getSymbolAtLocation: getSymbolAtLocation, getShorthandAssignmentValueSymbol: getShorthandAssignmentValueSymbol, + getExportSpecifierLocalTargetSymbol: getExportSpecifierLocalTargetSymbol, getTypeAtLocation: getTypeOfNode, + getPropertySymbolOfDestructuringAssignment: getPropertySymbolOfDestructuringAssignment, typeToString: typeToString, getSymbolDisplayBuilder: getSymbolDisplayBuilder, symbolToString: symbolToString, getAugmentedPropertiesOfType: getAugmentedPropertiesOfType, getRootSymbols: getRootSymbols, - getContextualType: getApparentTypeOfContextualType, + getContextualType: getContextualType, getFullyQualifiedName: getFullyQualifiedName, getResolvedSignature: getResolvedSignature, getConstantValue: getConstantValue, @@ -13934,16 +15494,18 @@ var ts; }; var unknownSymbol = createSymbol(4 /* Property */ | 67108864 /* Transient */, "unknown"); var resolvingSymbol = createSymbol(67108864 /* Transient */, "__resolving__"); + var nullableWideningFlags = strictNullChecks ? 0 : 2097152 /* ContainsUndefinedOrNull */; var anyType = createIntrinsicType(1 /* Any */, "any"); var stringType = createIntrinsicType(2 /* String */, "string"); var numberType = createIntrinsicType(4 /* Number */, "number"); var booleanType = createIntrinsicType(8 /* Boolean */, "boolean"); var esSymbolType = createIntrinsicType(16777216 /* ESSymbol */, "symbol"); var voidType = createIntrinsicType(16 /* Void */, "void"); - var undefinedType = createIntrinsicType(32 /* Undefined */ | 2097152 /* ContainsUndefinedOrNull */, "undefined"); - var nullType = createIntrinsicType(64 /* Null */ | 2097152 /* ContainsUndefinedOrNull */, "null"); + var undefinedType = createIntrinsicType(32 /* Undefined */ | nullableWideningFlags, "undefined"); + var nullType = createIntrinsicType(64 /* Null */ | nullableWideningFlags, "null"); + var emptyArrayElementType = createIntrinsicType(32 /* Undefined */ | 2097152 /* ContainsUndefinedOrNull */, "undefined"); var unknownType = createIntrinsicType(1 /* Any */, "unknown"); - var circularType = createIntrinsicType(1 /* Any */, "__circular__"); + var neverType = createIntrinsicType(134217728 /* Never */, "never"); var emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); var emptyGenericType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); emptyGenericType.instantiations = {}; @@ -13952,27 +15514,30 @@ var ts; // in getPropagatingFlagsOfTypes, and it is checked in inferFromTypes. anyFunctionType.flags |= 8388608 /* ContainsAnyFunctionType */; var noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); - var anySignature = createSignature(undefined, undefined, emptyArray, anyType, undefined, 0, false, false); - var unknownSignature = createSignature(undefined, undefined, emptyArray, unknownType, undefined, 0, false, false); + var anySignature = createSignature(undefined, undefined, undefined, emptyArray, anyType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasStringLiterals*/ false); + var unknownSignature = createSignature(undefined, undefined, undefined, emptyArray, unknownType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasStringLiterals*/ false); + var enumNumberIndexInfo = createIndexInfo(stringType, /*isReadonly*/ true); var globals = {}; - var globalESSymbolConstructorSymbol; + var getGlobalESSymbolConstructorSymbol; var getGlobalPromiseConstructorSymbol; var globalObjectType; var globalFunctionType; var globalArrayType; + var globalReadonlyArrayType; var globalStringType; var globalNumberType; var globalBooleanType; var globalRegExpType; - var globalTemplateStringsArrayType; - var globalESSymbolType; - var jsxElementType; - /** Lazily loaded, use getJsxIntrinsicElementType() */ - var jsxIntrinsicElementsType; - var globalIterableType; - var globalIteratorType; - var globalIterableIteratorType; var anyArrayType; + var anyReadonlyArrayType; + // The library files are only loaded when the feature is used. + // This allows users to just specify library files they want to used through --lib + // and they will not get an error from not having unrelated library files + var getGlobalTemplateStringsArrayType; + var getGlobalESSymbolType; + var getGlobalIterableType; + var getGlobalIteratorType; + var getGlobalIterableIteratorType; var getGlobalClassDecoratorType; var getGlobalParameterDecoratorType; var getGlobalPropertyDecoratorType; @@ -13985,51 +15550,113 @@ var ts; var getGlobalPromiseConstructorLikeType; var getGlobalThenableType; var jsxElementClassType; + var deferredNodes; + var flowLoopStart = 0; + var flowLoopCount = 0; + var visitedFlowCount = 0; var tupleTypes = {}; var unionTypes = {}; var intersectionTypes = {}; var stringLiteralTypes = {}; - var emitExtends = false; - var emitDecorate = false; - var emitParam = false; - var emitAwaiter = false; - var emitGenerator = false; var resolutionTargets = []; var resolutionResults = []; var resolutionPropertyNames = []; var mergedSymbols = []; var symbolLinks = []; var nodeLinks = []; + var flowLoopCaches = []; + var flowLoopNodes = []; + var flowLoopKeys = []; + var flowLoopTypes = []; + var visitedFlowNodes = []; + var visitedFlowTypes = []; var potentialThisCollisions = []; var awaitedTypeStack = []; var diagnostics = ts.createDiagnosticCollection(); - var primitiveTypeInfo = { - "string": { - type: stringType, - flags: 258 /* StringLike */ - }, - "number": { - type: numberType, - flags: 132 /* NumberLike */ - }, - "boolean": { - type: booleanType, - flags: 8 /* Boolean */ - }, - "symbol": { - type: esSymbolType, - flags: 16777216 /* ESSymbol */ - } + var TypeFacts; + (function (TypeFacts) { + TypeFacts[TypeFacts["None"] = 0] = "None"; + TypeFacts[TypeFacts["TypeofEQString"] = 1] = "TypeofEQString"; + TypeFacts[TypeFacts["TypeofEQNumber"] = 2] = "TypeofEQNumber"; + TypeFacts[TypeFacts["TypeofEQBoolean"] = 4] = "TypeofEQBoolean"; + TypeFacts[TypeFacts["TypeofEQSymbol"] = 8] = "TypeofEQSymbol"; + TypeFacts[TypeFacts["TypeofEQObject"] = 16] = "TypeofEQObject"; + TypeFacts[TypeFacts["TypeofEQFunction"] = 32] = "TypeofEQFunction"; + TypeFacts[TypeFacts["TypeofEQHostObject"] = 64] = "TypeofEQHostObject"; + TypeFacts[TypeFacts["TypeofNEString"] = 128] = "TypeofNEString"; + TypeFacts[TypeFacts["TypeofNENumber"] = 256] = "TypeofNENumber"; + TypeFacts[TypeFacts["TypeofNEBoolean"] = 512] = "TypeofNEBoolean"; + TypeFacts[TypeFacts["TypeofNESymbol"] = 1024] = "TypeofNESymbol"; + TypeFacts[TypeFacts["TypeofNEObject"] = 2048] = "TypeofNEObject"; + TypeFacts[TypeFacts["TypeofNEFunction"] = 4096] = "TypeofNEFunction"; + TypeFacts[TypeFacts["TypeofNEHostObject"] = 8192] = "TypeofNEHostObject"; + TypeFacts[TypeFacts["EQUndefined"] = 16384] = "EQUndefined"; + TypeFacts[TypeFacts["EQNull"] = 32768] = "EQNull"; + TypeFacts[TypeFacts["EQUndefinedOrNull"] = 65536] = "EQUndefinedOrNull"; + TypeFacts[TypeFacts["NEUndefined"] = 131072] = "NEUndefined"; + TypeFacts[TypeFacts["NENull"] = 262144] = "NENull"; + TypeFacts[TypeFacts["NEUndefinedOrNull"] = 524288] = "NEUndefinedOrNull"; + TypeFacts[TypeFacts["Truthy"] = 1048576] = "Truthy"; + TypeFacts[TypeFacts["Falsy"] = 2097152] = "Falsy"; + TypeFacts[TypeFacts["All"] = 4194303] = "All"; + // The following members encode facts about particular kinds of types for use in the getTypeFacts function. + // The presence of a particular fact means that the given test is true for some (and possibly all) values + // of that kind of type. + TypeFacts[TypeFacts["StringStrictFacts"] = 4079361] = "StringStrictFacts"; + TypeFacts[TypeFacts["StringFacts"] = 4194049] = "StringFacts"; + TypeFacts[TypeFacts["NumberStrictFacts"] = 4079234] = "NumberStrictFacts"; + TypeFacts[TypeFacts["NumberFacts"] = 4193922] = "NumberFacts"; + TypeFacts[TypeFacts["BooleanStrictFacts"] = 4078980] = "BooleanStrictFacts"; + TypeFacts[TypeFacts["BooleanFacts"] = 4193668] = "BooleanFacts"; + TypeFacts[TypeFacts["SymbolStrictFacts"] = 1981320] = "SymbolStrictFacts"; + TypeFacts[TypeFacts["SymbolFacts"] = 4193160] = "SymbolFacts"; + TypeFacts[TypeFacts["ObjectStrictFacts"] = 1972176] = "ObjectStrictFacts"; + TypeFacts[TypeFacts["ObjectFacts"] = 4184016] = "ObjectFacts"; + TypeFacts[TypeFacts["FunctionStrictFacts"] = 1970144] = "FunctionStrictFacts"; + TypeFacts[TypeFacts["FunctionFacts"] = 4181984] = "FunctionFacts"; + TypeFacts[TypeFacts["UndefinedFacts"] = 2457472] = "UndefinedFacts"; + TypeFacts[TypeFacts["NullFacts"] = 2340752] = "NullFacts"; + })(TypeFacts || (TypeFacts = {})); + var typeofEQFacts = { + "string": 1 /* TypeofEQString */, + "number": 2 /* TypeofEQNumber */, + "boolean": 4 /* TypeofEQBoolean */, + "symbol": 8 /* TypeofEQSymbol */, + "undefined": 16384 /* EQUndefined */, + "object": 16 /* TypeofEQObject */, + "function": 32 /* TypeofEQFunction */ }; + var typeofNEFacts = { + "string": 128 /* TypeofNEString */, + "number": 256 /* TypeofNENumber */, + "boolean": 512 /* TypeofNEBoolean */, + "symbol": 1024 /* TypeofNESymbol */, + "undefined": 131072 /* NEUndefined */, + "object": 2048 /* TypeofNEObject */, + "function": 4096 /* TypeofNEFunction */ + }; + var typeofTypesByName = { + "string": stringType, + "number": numberType, + "boolean": booleanType, + "symbol": esSymbolType, + "undefined": undefinedType + }; + var jsxElementType; + /** Things we lazy load from the JSX namespace */ + var jsxTypes = {}; var JsxNames = { JSX: "JSX", IntrinsicElements: "IntrinsicElements", ElementClass: "ElementClass", ElementAttributesPropertyNameContainer: "ElementAttributesProperty", - Element: "Element" + Element: "Element", + IntrinsicAttributes: "IntrinsicAttributes", + IntrinsicClassAttributes: "IntrinsicClassAttributes" }; var subtypeRelation = {}; var assignableRelation = {}; + var comparableRelation = {}; var identityRelation = {}; // This is for caching the result of getSymbolDisplayBuilder. Do not access directly. var _displayBuilder; @@ -14040,6 +15667,10 @@ var ts; TypeSystemPropertyName[TypeSystemPropertyName["DeclaredType"] = 2] = "DeclaredType"; TypeSystemPropertyName[TypeSystemPropertyName["ResolvedReturnType"] = 3] = "ResolvedReturnType"; })(TypeSystemPropertyName || (TypeSystemPropertyName = {})); + var builtinGlobals = (_a = {}, + _a[undefinedSymbol.name] = undefinedSymbol, + _a + ); initializeTypeChecker(); return checker; function getEmitResolver(sourceFile, cancellationToken) { @@ -14095,8 +15726,10 @@ var ts; return result; } function recordMergedSymbol(target, source) { - if (!source.mergeId) - source.mergeId = nextMergeId++; + if (!source.mergeId) { + source.mergeId = nextMergeId; + nextMergeId++; + } mergedSymbols[source.mergeId] = target; } function cloneSymbol(symbol) { @@ -14121,8 +15754,12 @@ var ts; target.constEnumOnlyModule = false; } target.flags |= source.flags; - if (!target.valueDeclaration && source.valueDeclaration) + if (source.valueDeclaration && + (!target.valueDeclaration || + (target.valueDeclaration.kind === 225 /* ModuleDeclaration */ && source.valueDeclaration.kind !== 225 /* ModuleDeclaration */))) { + // other kinds of value declarations take precedence over modules target.valueDeclaration = source.valueDeclaration; + } ts.forEach(source.declarations, function (node) { target.declarations.push(node); }); @@ -14139,13 +15776,13 @@ var ts; recordMergedSymbol(target, source); } else { - var message = target.flags & 2 /* BlockScopedVariable */ || source.flags & 2 /* BlockScopedVariable */ + var message_2 = target.flags & 2 /* BlockScopedVariable */ || source.flags & 2 /* BlockScopedVariable */ ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0; ts.forEach(source.declarations, function (node) { - error(node.name ? node.name : node, message, symbolToString(source)); + error(node.name ? node.name : node, message_2, symbolToString(source)); }); ts.forEach(target.declarations, function (node) { - error(node.name ? node.name : node, message, symbolToString(source)); + error(node.name ? node.name : node, message_2, symbolToString(source)); }); } } @@ -14174,6 +15811,57 @@ var ts; } } } + function mergeModuleAugmentation(moduleName) { + var moduleAugmentation = moduleName.parent; + if (moduleAugmentation.symbol.declarations[0] !== moduleAugmentation) { + // this is a combined symbol for multiple augmentations within the same file. + // its symbol already has accumulated information for all declarations + // so we need to add it just once - do the work only for first declaration + ts.Debug.assert(moduleAugmentation.symbol.declarations.length > 1); + return; + } + if (ts.isGlobalScopeAugmentation(moduleAugmentation)) { + mergeSymbolTable(globals, moduleAugmentation.symbol.exports); + } + else { + // find a module that about to be augmented + // do not validate names of augmentations that are defined in ambient context + var moduleNotFoundError = !ts.isInAmbientContext(moduleName.parent.parent) + ? ts.Diagnostics.Invalid_module_name_in_augmentation_module_0_cannot_be_found + : undefined; + var mainModule = resolveExternalModuleNameWorker(moduleName, moduleName, moduleNotFoundError); + if (!mainModule) { + return; + } + // obtain item referenced by 'export=' + mainModule = resolveExternalModuleSymbol(mainModule); + if (mainModule.flags & 1536 /* Namespace */) { + // if module symbol has already been merged - it is safe to use it. + // otherwise clone it + mainModule = mainModule.flags & 33554432 /* Merged */ ? mainModule : cloneSymbol(mainModule); + mergeSymbol(mainModule, moduleAugmentation.symbol); + } + else { + error(moduleName, ts.Diagnostics.Cannot_augment_module_0_because_it_resolves_to_a_non_module_entity, moduleName.text); + } + } + } + function addToSymbolTable(target, source, message) { + for (var id in source) { + if (ts.hasProperty(source, id)) { + if (ts.hasProperty(target, id)) { + // Error on redeclarations + ts.forEach(target[id].declarations, addDeclarationDiagnostic(id, message)); + } + else { + target[id] = source[id]; + } + } + } + function addDeclarationDiagnostic(id, message) { + return function (declaration) { return diagnostics.add(ts.createDiagnosticForNode(declaration, message, id)); }; + } + } function getSymbolLinks(symbol) { if (symbol.flags & 67108864 /* Transient */) return symbol; @@ -14184,11 +15872,8 @@ var ts; var nodeId = getNodeId(node); return nodeLinks[nodeId] || (nodeLinks[nodeId] = {}); } - function getSourceFile(node) { - return ts.getAncestor(node, 248 /* SourceFile */); - } function isGlobalSourceFile(node) { - return node.kind === 248 /* SourceFile */ && !ts.isExternalOrCommonJsModule(node); + return node.kind === 256 /* SourceFile */ && !ts.isExternalOrCommonJsModule(node); } function getSymbol(symbols, name, meaning) { if (meaning && ts.hasProperty(symbols, name)) { @@ -14207,6 +15892,22 @@ var ts; } // return undefined if we can't find a symbol. } + /** + * Get symbols that represent parameter-property-declaration as parameter and as property declaration + * @param parameter a parameterDeclaration node + * @param parameterName a name of the parameter to get the symbols for. + * @return a tuple of two symbols + */ + function getSymbolsOfParameterPropertyDeclaration(parameter, parameterName) { + var constructorDeclaration = parameter.parent; + var classDeclaration = parameter.parent.parent; + var parameterSymbol = getSymbol(constructorDeclaration.locals, parameterName, 107455 /* Value */); + var propertySymbol = getSymbol(classDeclaration.symbol.members, parameterName, 107455 /* Value */); + if (parameterSymbol && propertySymbol) { + return [parameterSymbol, propertySymbol]; + } + ts.Debug.fail("There should exist two symbols, one as property declaration and one as parameter declaration"); + } function isBlockScopedNameDeclaredBeforeUse(declaration, usage) { var declarationFile = ts.getSourceFileOfNode(declaration); var useFile = ts.getSourceFileOfNode(usage); @@ -14221,7 +15922,7 @@ var ts; if (declaration.pos <= usage.pos) { // declaration is before usage // still might be illegal if usage is in the initializer of the variable declaration - return declaration.kind !== 211 /* VariableDeclaration */ || + return declaration.kind !== 218 /* VariableDeclaration */ || !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage); } // declaration is after usage @@ -14229,18 +15930,26 @@ var ts; return isUsedInFunctionOrNonStaticProperty(declaration, usage); function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage) { var container = ts.getEnclosingBlockScopeContainer(declaration); - if (declaration.parent.parent.kind === 193 /* VariableStatement */ || - declaration.parent.parent.kind === 199 /* ForStatement */) { - // variable statement/for statement case, - // use site should not be inside variable declaration (initializer of declaration or binding element) - return isSameScopeDescendentOf(usage, declaration, container); + switch (declaration.parent.parent.kind) { + case 200 /* VariableStatement */: + case 206 /* ForStatement */: + case 208 /* ForOfStatement */: + // variable statement/for/for-of statement case, + // use site should not be inside variable declaration (initializer of declaration or binding element) + if (isSameScopeDescendentOf(usage, declaration, container)) { + return true; + } + break; } - else if (declaration.parent.parent.kind === 201 /* ForOfStatement */ || - declaration.parent.parent.kind === 200 /* ForInStatement */) { - // ForIn/ForOf case - use site should not be used in expression part - var expression = declaration.parent.parent.expression; - return isSameScopeDescendentOf(usage, expression, container); + switch (declaration.parent.parent.kind) { + case 207 /* ForInStatement */: + case 208 /* ForOfStatement */: + // ForIn/ForOf case - use site should not be used in expression part + if (isSameScopeDescendentOf(usage, declaration.parent.parent.expression, container)) { + return true; + } } + return false; } function isUsedInFunctionOrNonStaticProperty(declaration, usage) { var container = ts.getEnclosingBlockScopeContainer(declaration); @@ -14253,8 +15962,8 @@ var ts; return true; } var initializerOfNonStaticProperty = current.parent && - current.parent.kind === 141 /* PropertyDeclaration */ && - (current.parent.flags & 64 /* Static */) === 0 && + current.parent.kind === 145 /* PropertyDeclaration */ && + (current.parent.flags & 32 /* Static */) === 0 && current.parent.initializer === current; if (initializerOfNonStaticProperty) { return true; @@ -14277,25 +15986,47 @@ var ts; // Locals of a source file are not in scope (because they get merged into the global symbol table) if (location.locals && !isGlobalSourceFile(location)) { if (result = getSymbol(location.locals, name, meaning)) { - // Type parameters of a function are in scope in the entire function declaration, including the parameter - // list and return type. However, local types are only in scope in the function body. - if (!(meaning & 793056 /* Type */) || - !(result.flags & (793056 /* Type */ & ~262144 /* TypeParameter */)) || - !ts.isFunctionLike(location) || - lastLocation === location.body) { + var useResult = true; + if (ts.isFunctionLike(location) && lastLocation && lastLocation !== location.body) { + // symbol lookup restrictions for function-like declarations + // - Type parameters of a function are in scope in the entire function declaration, including the parameter + // list and return type. However, local types are only in scope in the function body. + // - parameters are only in the scope of function body + // This restriction does not apply to JSDoc comment types because they are parented + // at a higher level than type parameters would normally be + if (meaning & result.flags & 793056 /* Type */ && lastLocation.kind !== 273 /* JSDocComment */) { + useResult = result.flags & 262144 /* TypeParameter */ + ? lastLocation === location.type || + lastLocation.kind === 142 /* Parameter */ || + lastLocation.kind === 141 /* TypeParameter */ + : false; + } + if (meaning & 107455 /* Value */ && result.flags & 1 /* FunctionScopedVariable */) { + // parameters are visible only inside function body, parameter list and return type + // technically for parameter list case here we might mix parameters and variables declared in function, + // however it is detected separately when checking initializers of parameters + // to make sure that they reference no variables declared after them. + useResult = + lastLocation.kind === 142 /* Parameter */ || + (lastLocation === location.type && + result.valueDeclaration.kind === 142 /* Parameter */); + } + } + if (useResult) { break loop; } - result = undefined; + else { + result = undefined; + } } } switch (location.kind) { - case 248 /* SourceFile */: + case 256 /* SourceFile */: if (!ts.isExternalOrCommonJsModule(location)) break; - case 218 /* ModuleDeclaration */: + case 225 /* ModuleDeclaration */: var moduleExports = getSymbolOfNode(location).exports; - if (location.kind === 248 /* SourceFile */ || - (location.kind === 218 /* ModuleDeclaration */ && location.name.kind === 9 /* StringLiteral */)) { + if (location.kind === 256 /* SourceFile */ || ts.isAmbientModule(location)) { // It's an external module. First see if the module has an export default and if the local // name of that export default matches. if (result = moduleExports["default"]) { @@ -14306,7 +16037,7 @@ var ts; result = undefined; } // Because of module/namespace merging, a module's exports are in scope, - // yet we never want to treat an export specifier as putting a member in scope. + // yet we never want to treat an export specifier as putting a member in scope. // Therefore, if the name we find is purely an export specifier, it is not actually considered in scope. // Two things to note about this: // 1. We have to check this without calling getSymbol. The problem with calling getSymbol @@ -14318,7 +16049,7 @@ var ts; // which is not the desired behavior. if (ts.hasProperty(moduleExports, name) && moduleExports[name].flags === 8388608 /* Alias */ && - ts.getDeclarationOfKind(moduleExports[name], 230 /* ExportSpecifier */)) { + ts.getDeclarationOfKind(moduleExports[name], 238 /* ExportSpecifier */)) { break; } } @@ -14326,20 +16057,20 @@ var ts; break loop; } break; - case 217 /* EnumDeclaration */: + case 224 /* EnumDeclaration */: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8 /* EnumMember */)) { break loop; } break; - case 141 /* PropertyDeclaration */: - case 140 /* PropertySignature */: + case 145 /* PropertyDeclaration */: + case 144 /* PropertySignature */: // TypeScript 1.0 spec (April 2014): 8.4.1 // Initializer expressions for instance member variables are evaluated in the scope // of the class constructor body but are not permitted to reference parameters or // local variables of the constructor. This effectively means that entities from outer scopes // by the same name as a constructor parameter or local variable are inaccessible // in initializer expressions for instance member variables. - if (ts.isClassLike(location.parent) && !(location.flags & 64 /* Static */)) { + if (ts.isClassLike(location.parent) && !(location.flags & 32 /* Static */)) { var ctor = findConstructorDeclaration(location.parent); if (ctor && ctor.locals) { if (getSymbol(ctor.locals, name, meaning & 107455 /* Value */)) { @@ -14349,11 +16080,11 @@ var ts; } } break; - case 214 /* ClassDeclaration */: - case 186 /* ClassExpression */: - case 215 /* InterfaceDeclaration */: + case 221 /* ClassDeclaration */: + case 192 /* ClassExpression */: + case 222 /* InterfaceDeclaration */: if (result = getSymbol(getSymbolOfNode(location).members, name, meaning & 793056 /* Type */)) { - if (lastLocation && lastLocation.flags & 64 /* Static */) { + if (lastLocation && lastLocation.flags & 32 /* Static */) { // TypeScript 1.0 spec (April 2014): 3.4.1 // The scope of a type parameter extends over the entire declaration with which the type // parameter list is associated, with the exception of static member declarations in classes. @@ -14362,7 +16093,7 @@ var ts; } break loop; } - if (location.kind === 186 /* ClassExpression */ && meaning & 32 /* Class */) { + if (location.kind === 192 /* ClassExpression */ && meaning & 32 /* Class */) { var className = location.name; if (className && name === className.text) { result = location.symbol; @@ -14378,9 +16109,9 @@ var ts; // [foo()]() { } // <-- Reference to T from class's own computed property // } // - case 136 /* ComputedPropertyName */: + case 140 /* ComputedPropertyName */: grandparent = location.parent.parent; - if (ts.isClassLike(grandparent) || grandparent.kind === 215 /* InterfaceDeclaration */) { + if (ts.isClassLike(grandparent) || grandparent.kind === 222 /* InterfaceDeclaration */) { // A reference to this grandparent's type parameters would be an error if (result = getSymbol(getSymbolOfNode(grandparent).members, name, meaning & 793056 /* Type */)) { error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); @@ -14388,19 +16119,19 @@ var ts; } } break; - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - case 144 /* Constructor */: - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: - case 213 /* FunctionDeclaration */: - case 174 /* ArrowFunction */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: + case 148 /* Constructor */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: + case 220 /* FunctionDeclaration */: + case 180 /* ArrowFunction */: if (meaning & 3 /* Variable */ && name === "arguments") { result = argumentsSymbol; break loop; } break; - case 173 /* FunctionExpression */: + case 179 /* FunctionExpression */: if (meaning & 3 /* Variable */ && name === "arguments") { result = argumentsSymbol; break loop; @@ -14413,7 +16144,7 @@ var ts; } } break; - case 139 /* Decorator */: + case 143 /* Decorator */: // Decorators are resolved at the class declaration. Resolving at the parameter // or member would result in looking up locals in the method. // @@ -14422,7 +16153,7 @@ var ts; // method(@y x, y) {} // <-- decorator y should be resolved at the class declaration, not the parameter. // } // - if (location.parent && location.parent.kind === 138 /* Parameter */) { + if (location.parent && location.parent.kind === 142 /* Parameter */) { location = location.parent; } // @@ -14444,7 +16175,9 @@ var ts; } if (!result) { if (nameNotFoundMessage) { - error(errorLocation, nameNotFoundMessage, typeof nameArg === "string" ? nameArg : ts.declarationNameToString(nameArg)); + if (!checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg)) { + error(errorLocation, nameNotFoundMessage, typeof nameArg === "string" ? nameArg : ts.declarationNameToString(nameArg)); + } } return undefined; } @@ -14477,12 +16210,44 @@ var ts; } return result; } + function checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) { + if (!errorLocation || (errorLocation.kind === 69 /* Identifier */ && (isTypeReferenceIdentifier(errorLocation)) || isInTypeQuery(errorLocation))) { + return false; + } + var container = ts.getThisContainer(errorLocation, /* includeArrowFunctions */ true); + var location = container; + while (location) { + if (ts.isClassLike(location.parent)) { + var classSymbol = getSymbolOfNode(location.parent); + if (!classSymbol) { + break; + } + // Check to see if a static member exists. + var constructorType = getTypeOfSymbol(classSymbol); + if (getPropertyOfType(constructorType, name)) { + error(errorLocation, ts.Diagnostics.Cannot_find_name_0_Did_you_mean_the_static_member_1_0, typeof nameArg === "string" ? nameArg : ts.declarationNameToString(nameArg), symbolToString(classSymbol)); + return true; + } + // No static member is present. + // Check if we're in an instance method and look for a relevant instance member. + if (location === container && !(location.flags & 32 /* Static */)) { + var instanceType = getDeclaredTypeOfSymbol(classSymbol).thisType; + if (getPropertyOfType(instanceType, name)) { + error(errorLocation, ts.Diagnostics.Cannot_find_name_0_Did_you_mean_the_instance_member_this_0, typeof nameArg === "string" ? nameArg : ts.declarationNameToString(nameArg)); + return true; + } + } + } + location = location.parent; + } + return false; + } function checkResolvedBlockScopedVariable(result, errorLocation) { ts.Debug.assert((result.flags & 2 /* BlockScopedVariable */) !== 0); // Block-scoped variables cannot be used before their definition var declaration = ts.forEach(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) ? d : undefined; }); ts.Debug.assert(declaration !== undefined, "Block-scoped variable declaration is undefined"); - if (!isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 211 /* VariableDeclaration */), errorLocation)) { + if (!isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 218 /* VariableDeclaration */), errorLocation)) { error(errorLocation, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, ts.declarationNameToString(declaration.name)); } } @@ -14503,10 +16268,10 @@ var ts; } function getAnyImportSyntax(node) { if (ts.isAliasSymbolDeclaration(node)) { - if (node.kind === 221 /* ImportEqualsDeclaration */) { + if (node.kind === 229 /* ImportEqualsDeclaration */) { return node; } - while (node && node.kind !== 222 /* ImportDeclaration */) { + while (node && node.kind !== 230 /* ImportDeclaration */) { node = node.parent; } return node; @@ -14516,7 +16281,7 @@ var ts; return ts.forEach(symbol.declarations, function (d) { return ts.isAliasSymbolDeclaration(d) ? d : undefined; }); } function getTargetOfImportEqualsDeclaration(node) { - if (node.moduleReference.kind === 232 /* ExternalModuleReference */) { + if (node.moduleReference.kind === 240 /* ExternalModuleReference */) { return resolveExternalModuleSymbol(resolveExternalModuleName(node, ts.getExternalModuleImportEqualsDeclarationExpression(node))); } return getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference, node); @@ -14524,10 +16289,15 @@ var ts; function getTargetOfImportClause(node) { var moduleSymbol = resolveExternalModuleName(node, node.parent.moduleSpecifier); if (moduleSymbol) { - var exportDefaultSymbol = resolveSymbol(moduleSymbol.exports["default"]); - if (!exportDefaultSymbol) { + var exportDefaultSymbol = moduleSymbol.exports["export="] ? + getPropertyOfType(getTypeOfSymbol(moduleSymbol.exports["export="]), "default") : + resolveSymbol(moduleSymbol.exports["default"]); + if (!exportDefaultSymbol && !allowSyntheticDefaultImports) { error(node.name, ts.Diagnostics.Module_0_has_no_default_export, symbolToString(moduleSymbol)); } + else if (!exportDefaultSymbol && allowSyntheticDefaultImports) { + return resolveExternalModuleSymbol(moduleSymbol) || resolveSymbol(moduleSymbol); + } return exportDefaultSymbol; } } @@ -14535,14 +16305,6 @@ var ts; var moduleSpecifier = node.parent.parent.moduleSpecifier; return resolveESModuleSymbol(resolveExternalModuleName(node, moduleSpecifier), moduleSpecifier); } - function getMemberOfModuleVariable(moduleSymbol, name) { - if (moduleSymbol.flags & 3 /* Variable */) { - var typeAnnotation = moduleSymbol.valueDeclaration.type; - if (typeAnnotation) { - return getPropertyOfType(getTypeFromTypeNode(typeAnnotation), name); - } - } - } // This function creates a synthetic symbol that combines the value side of one symbol with the // type/namespace side of another symbol. Consider this example: // @@ -14598,8 +16360,17 @@ var ts; if (targetSymbol) { var name_9 = specifier.propertyName || specifier.name; if (name_9.text) { + var symbolFromVariable = void 0; + // First check if module was specified with "export=". If so, get the member from the resolved type + if (moduleSymbol && moduleSymbol.exports && moduleSymbol.exports["export="]) { + symbolFromVariable = getPropertyOfType(getTypeOfSymbol(targetSymbol), name_9.text); + } + else { + symbolFromVariable = getPropertyOfVariable(targetSymbol, name_9.text); + } + // if symbolFromVariable is export - get its final target + symbolFromVariable = resolveSymbol(symbolFromVariable); var symbolFromModule = getExportOfModule(targetSymbol, name_9.text); - var symbolFromVariable = getPropertyOfVariable(targetSymbol, name_9.text); var symbol = symbolFromModule && symbolFromVariable ? combineValueAndTypeSymbols(symbolFromVariable, symbolFromModule) : symbolFromModule || symbolFromVariable; @@ -14613,6 +16384,9 @@ var ts; function getTargetOfImportSpecifier(node) { return getExternalModuleMember(node.parent.parent.parent, node); } + function getTargetOfGlobalModuleExportDeclaration(node) { + return resolveExternalModuleSymbol(node.parent.symbol); + } function getTargetOfExportSpecifier(node) { return node.parent.parent.moduleSpecifier ? getExternalModuleMember(node.parent.parent, node) : @@ -14623,18 +16397,20 @@ var ts; } function getTargetOfAliasDeclaration(node) { switch (node.kind) { - case 221 /* ImportEqualsDeclaration */: + case 229 /* ImportEqualsDeclaration */: return getTargetOfImportEqualsDeclaration(node); - case 223 /* ImportClause */: + case 231 /* ImportClause */: return getTargetOfImportClause(node); - case 224 /* NamespaceImport */: + case 232 /* NamespaceImport */: return getTargetOfNamespaceImport(node); - case 226 /* ImportSpecifier */: + case 234 /* ImportSpecifier */: return getTargetOfImportSpecifier(node); - case 230 /* ExportSpecifier */: + case 238 /* ExportSpecifier */: return getTargetOfExportSpecifier(node); - case 227 /* ExportAssignment */: + case 235 /* ExportAssignment */: return getTargetOfExportAssignment(node); + case 228 /* GlobalModuleExportDeclaration */: + return getTargetOfGlobalModuleExportDeclaration(node); } } function resolveSymbol(symbol) { @@ -14663,8 +16439,8 @@ var ts; var symbol = getSymbolOfNode(node); var target = resolveAlias(symbol); if (target) { - var markAlias = (target === unknownSymbol && compilerOptions.isolatedModules) || - (target !== unknownSymbol && (target.flags & 107455 /* Value */) && !isConstEnumOrConstEnumOnlyModule(target)); + var markAlias = target === unknownSymbol || + ((target.flags & 107455 /* Value */) && !isConstEnumOrConstEnumOnlyModule(target)); if (markAlias) { markAliasSymbolAsReferenced(symbol); } @@ -14678,11 +16454,11 @@ var ts; if (!links.referenced) { links.referenced = true; var node = getDeclarationOfAliasSymbol(symbol); - if (node.kind === 227 /* ExportAssignment */) { + if (node.kind === 235 /* ExportAssignment */) { // export default checkExpressionCached(node.expression); } - else if (node.kind === 230 /* ExportSpecifier */) { + else if (node.kind === 238 /* ExportSpecifier */) { // export { } or export { as foo } checkExpressionCached(node.propertyName || node.name); } @@ -14695,7 +16471,7 @@ var ts; // This function is only for imports with entity names function getSymbolOfPartOfRightHandSideOfImportEquals(entityName, importDeclaration) { if (!importDeclaration) { - importDeclaration = ts.getAncestor(entityName, 221 /* ImportEqualsDeclaration */); + importDeclaration = ts.getAncestor(entityName, 229 /* ImportEqualsDeclaration */); ts.Debug.assert(importDeclaration !== undefined); } // There are three things we might try to look for. In the following examples, @@ -14708,13 +16484,13 @@ var ts; entityName = entityName.parent; } // Check for case 1 and 3 in the above example - if (entityName.kind === 69 /* Identifier */ || entityName.parent.kind === 135 /* QualifiedName */) { + if (entityName.kind === 69 /* Identifier */ || entityName.parent.kind === 139 /* QualifiedName */) { return resolveEntityName(entityName, 1536 /* Namespace */); } else { // Case 2 in above example // entityName.kind could be a QualifiedName or a Missing identifier - ts.Debug.assert(entityName.parent.kind === 221 /* ImportEqualsDeclaration */); + ts.Debug.assert(entityName.parent.kind === 229 /* ImportEqualsDeclaration */); return resolveEntityName(entityName, 107455 /* Value */ | 793056 /* Type */ | 1536 /* Namespace */); } } @@ -14734,9 +16510,9 @@ var ts; return undefined; } } - else if (name.kind === 135 /* QualifiedName */ || name.kind === 166 /* PropertyAccessExpression */) { - var left = name.kind === 135 /* QualifiedName */ ? name.left : name.expression; - var right = name.kind === 135 /* QualifiedName */ ? name.right : name.name; + else if (name.kind === 139 /* QualifiedName */ || name.kind === 172 /* PropertyAccessExpression */) { + var left = name.kind === 139 /* QualifiedName */ ? name.left : name.expression; + var right = name.kind === 139 /* QualifiedName */ ? name.right : name.name; var namespace = resolveEntityName(left, 1536 /* Namespace */, ignoreErrors); if (!namespace || namespace === unknownSymbol || ts.nodeIsMissing(right)) { return undefined; @@ -14756,42 +16532,50 @@ var ts; return symbol.flags & meaning ? symbol : resolveAlias(symbol); } function resolveExternalModuleName(location, moduleReferenceExpression) { + return resolveExternalModuleNameWorker(location, moduleReferenceExpression, ts.Diagnostics.Cannot_find_module_0); + } + function resolveExternalModuleNameWorker(location, moduleReferenceExpression, moduleNotFoundError) { if (moduleReferenceExpression.kind !== 9 /* StringLiteral */) { return; } var moduleReferenceLiteral = moduleReferenceExpression; - var searchPath = ts.getDirectoryPath(getSourceFile(location).fileName); // Module names are escaped in our symbol table. However, string literal values aren't. // Escape the name in the "require(...)" clause to ensure we find the right symbol. var moduleName = ts.escapeIdentifier(moduleReferenceLiteral.text); if (moduleName === undefined) { return; } - if (moduleName.indexOf("!") >= 0) { - moduleName = moduleName.substr(0, moduleName.indexOf("!")); - } var isRelative = ts.isExternalModuleNameRelative(moduleName); if (!isRelative) { - var symbol = getSymbol(globals, "\"" + moduleName + "\"", 512 /* ValueModule */); + var symbol = getSymbol(globals, '"' + moduleName + '"', 512 /* ValueModule */); if (symbol) { - return symbol; + // merged symbol is module declaration symbol combined with all augmentations + return getMergedSymbol(symbol); } } - var resolvedModule = ts.getResolvedModule(getSourceFile(location), moduleReferenceLiteral.text); + var resolvedModule = ts.getResolvedModule(ts.getSourceFileOfNode(location), moduleReferenceLiteral.text); var sourceFile = resolvedModule && host.getSourceFile(resolvedModule.resolvedFileName); if (sourceFile) { if (sourceFile.symbol) { - return sourceFile.symbol; + // merged symbol is module declaration symbol combined with all augmentations + return getMergedSymbol(sourceFile.symbol); } - error(moduleReferenceLiteral, ts.Diagnostics.File_0_is_not_a_module, sourceFile.fileName); - return; + if (moduleNotFoundError) { + // report errors only if it was requested + error(moduleReferenceLiteral, ts.Diagnostics.File_0_is_not_a_module, sourceFile.fileName); + } + return undefined; } - error(moduleReferenceLiteral, ts.Diagnostics.Cannot_find_module_0, moduleName); + if (moduleNotFoundError) { + // report errors only if it was requested + error(moduleReferenceLiteral, moduleNotFoundError, moduleName); + } + return undefined; } // An external module with an 'export =' declaration resolves to the target of the 'export =' declaration, // and an external module with no 'export =' declaration resolves to the module itself. function resolveExternalModuleSymbol(moduleSymbol) { - return moduleSymbol && resolveSymbol(moduleSymbol.exports["export="]) || moduleSymbol; + return moduleSymbol && getMergedSymbol(resolveSymbol(moduleSymbol.exports["export="])) || moduleSymbol; } // An external module with an 'export =' declaration may be referenced as an ES6 module provided the 'export =' // references a symbol that is at least declared as a module or a variable. The target of the 'export =' may @@ -14804,8 +16588,8 @@ var ts; } return symbol; } - function getExportAssignmentSymbol(moduleSymbol) { - return moduleSymbol.exports["export="]; + function hasExportAssignmentSymbol(moduleSymbol) { + return moduleSymbol.exports["export="] !== undefined; } function getExportsOfModuleAsArray(moduleSymbol) { return symbolsToArray(getExportsOfModule(moduleSymbol)); @@ -14817,38 +16601,66 @@ var ts; var links = getSymbolLinks(moduleSymbol); return links.resolvedExports || (links.resolvedExports = getExportsForModule(moduleSymbol)); } - function extendExportSymbols(target, source) { + /** + * Extends one symbol table with another while collecting information on name collisions for error message generation into the `lookupTable` argument + * Not passing `lookupTable` and `exportNode` disables this collection, and just extends the tables + */ + function extendExportSymbols(target, source, lookupTable, exportNode) { for (var id in source) { if (id !== "default" && !ts.hasProperty(target, id)) { target[id] = source[id]; + if (lookupTable && exportNode) { + lookupTable[id] = { + specifierText: ts.getTextOfNode(exportNode.moduleSpecifier) + }; + } + } + else if (lookupTable && exportNode && id !== "default" && ts.hasProperty(target, id) && resolveSymbol(target[id]) !== resolveSymbol(source[id])) { + if (!lookupTable[id].exportsWithDuplicate) { + lookupTable[id].exportsWithDuplicate = [exportNode]; + } + else { + lookupTable[id].exportsWithDuplicate.push(exportNode); + } } } } function getExportsForModule(moduleSymbol) { - var result; var visitedSymbols = []; - visit(moduleSymbol); - return result || moduleSymbol.exports; + return visit(moduleSymbol) || moduleSymbol.exports; // The ES6 spec permits export * declarations in a module to circularly reference the module itself. For example, // module 'a' can 'export * from "b"' and 'b' can 'export * from "a"' without error. function visit(symbol) { - if (symbol && symbol.flags & 1952 /* HasExports */ && !ts.contains(visitedSymbols, symbol)) { - visitedSymbols.push(symbol); - if (symbol !== moduleSymbol) { - if (!result) { - result = cloneSymbolTable(moduleSymbol.exports); - } - extendExportSymbols(result, symbol.exports); - } - // All export * declarations are collected in an __export symbol by the binder - var exportStars = symbol.exports["__export"]; - if (exportStars) { - for (var _i = 0, _a = exportStars.declarations; _i < _a.length; _i++) { - var node = _a[_i]; - visit(resolveExternalModuleName(node, node.moduleSpecifier)); - } - } + if (!(symbol && symbol.flags & 1952 /* HasExports */ && !ts.contains(visitedSymbols, symbol))) { + return; } + visitedSymbols.push(symbol); + var symbols = cloneSymbolTable(symbol.exports); + // All export * declarations are collected in an __export symbol by the binder + var exportStars = symbol.exports["__export"]; + if (exportStars) { + var nestedSymbols = {}; + var lookupTable = {}; + for (var _i = 0, _a = exportStars.declarations; _i < _a.length; _i++) { + var node = _a[_i]; + var resolvedModule = resolveExternalModuleName(node, node.moduleSpecifier); + var exportedSymbols = visit(resolvedModule); + extendExportSymbols(nestedSymbols, exportedSymbols, lookupTable, node); + } + for (var id in lookupTable) { + var exportsWithDuplicate = lookupTable[id].exportsWithDuplicate; + // It's not an error if the file with multiple `export *`s with duplicate names exports a member with that name itself + if (id === "export=" || !(exportsWithDuplicate && exportsWithDuplicate.length) || ts.hasProperty(symbols, id)) { + continue; + } + for (var _b = 0, exportsWithDuplicate_1 = exportsWithDuplicate; _b < exportsWithDuplicate_1.length; _b++) { + var node = exportsWithDuplicate_1[_b]; + diagnostics.add(ts.createDiagnosticForNode(node, ts.Diagnostics.Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambiguity, lookupTable[id].specifierText, id)); + } + } + extendExportSymbols(symbols, nestedSymbols); + } + return symbols; } } function getMergedSymbol(symbol) { @@ -14886,14 +16698,15 @@ var ts; var members = node.members; for (var _i = 0, members_1 = members; _i < members_1.length; _i++) { var member = members_1[_i]; - if (member.kind === 144 /* Constructor */ && ts.nodeIsPresent(member.body)) { + if (member.kind === 148 /* Constructor */ && ts.nodeIsPresent(member.body)) { return member; } } } function createType(flags) { var result = new Type(checker, flags); - result.id = typeCount++; + result.id = typeCount; + typeCount++; return result; } function createIntrinsicType(kind, intrinsicName) { @@ -14932,19 +16745,19 @@ var ts; } return result || emptyArray; } - function setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexType, numberIndexType) { + function setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo) { type.members = members; type.properties = getNamedMembers(members); type.callSignatures = callSignatures; type.constructSignatures = constructSignatures; - if (stringIndexType) - type.stringIndexType = stringIndexType; - if (numberIndexType) - type.numberIndexType = numberIndexType; + if (stringIndexInfo) + type.stringIndexInfo = stringIndexInfo; + if (numberIndexInfo) + type.numberIndexInfo = numberIndexInfo; return type; } - function createAnonymousType(symbol, members, callSignatures, constructSignatures, stringIndexType, numberIndexType) { - return setObjectTypeMembers(createObjectType(65536 /* Anonymous */, symbol), members, callSignatures, constructSignatures, stringIndexType, numberIndexType); + function createAnonymousType(symbol, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo) { + return setObjectTypeMembers(createObjectType(65536 /* Anonymous */, symbol), members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo); } function forEachSymbolTableInScope(enclosingDeclaration, callback) { var result; @@ -14956,21 +16769,15 @@ var ts; } } switch (location_1.kind) { - case 248 /* SourceFile */: + case 256 /* SourceFile */: if (!ts.isExternalOrCommonJsModule(location_1)) { break; } - case 218 /* ModuleDeclaration */: + case 225 /* ModuleDeclaration */: if (result = callback(getSymbolOfNode(location_1).exports)) { return result; } break; - case 214 /* ClassDeclaration */: - case 215 /* InterfaceDeclaration */: - if (result = callback(getSymbolOfNode(location_1).members)) { - return result; - } - break; } } return callback(globals); @@ -14993,7 +16800,7 @@ var ts; function isAccessible(symbolFromSymbolTable, resolvedAliasSymbol) { if (symbol === (resolvedAliasSymbol || symbolFromSymbolTable)) { // if the symbolFromSymbolTable is not external module (it could be if it was determined as ambient external module and would be in globals table) - // and if symbolfrom symbolTable or alias resolution matches the symbol, + // and if symbolFromSymbolTable or alias resolution matches the symbol, // check the symbol can be qualified, it is only then this symbol is accessible return !ts.forEach(symbolFromSymbolTable.declarations, hasExternalModuleSymbol) && canQualifySymbol(symbolFromSymbolTable, meaning); @@ -15007,7 +16814,7 @@ var ts; return ts.forEachValue(symbols, function (symbolFromSymbolTable) { if (symbolFromSymbolTable.flags & 8388608 /* Alias */ && symbolFromSymbolTable.name !== "export=" - && !ts.getDeclarationOfKind(symbolFromSymbolTable, 230 /* ExportSpecifier */)) { + && !ts.getDeclarationOfKind(symbolFromSymbolTable, 238 /* ExportSpecifier */)) { if (!useOnlyExternalAliasing || // Is this external alias, then use it to name ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { @@ -15026,7 +16833,9 @@ var ts; }); } if (symbol) { - return forEachSymbolTableInScope(enclosingDeclaration, getAccessibleSymbolChainFromSymbolTable); + if (!(isPropertyOrMethodDeclarationSymbol(symbol))) { + return forEachSymbolTableInScope(enclosingDeclaration, getAccessibleSymbolChainFromSymbolTable); + } } } function needsQualification(symbol, enclosingDeclaration, meaning) { @@ -15044,7 +16853,7 @@ var ts; return true; } // Qualify if the symbol from symbol table has same meaning as expected - symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608 /* Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 230 /* ExportSpecifier */)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; + symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608 /* Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 238 /* ExportSpecifier */)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; if (symbolFromSymbolTable.flags & meaning) { qualify = true; return true; @@ -15054,6 +16863,24 @@ var ts; }); return qualify; } + function isPropertyOrMethodDeclarationSymbol(symbol) { + if (symbol.declarations && symbol.declarations.length) { + for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { + var declaration = _a[_i]; + switch (declaration.kind) { + case 145 /* PropertyDeclaration */: + case 147 /* MethodDeclaration */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: + continue; + default: + return false; + } + } + return true; + } + return false; + } function isSymbolAccessible(symbol, enclosingDeclaration, meaning) { if (symbol && enclosingDeclaration && !(symbol.flags & 262144 /* TypeParameter */)) { var initialSymbol = symbol; @@ -15117,8 +16944,7 @@ var ts; } } function hasExternalModuleSymbol(declaration) { - return (declaration.kind === 218 /* ModuleDeclaration */ && declaration.name.kind === 9 /* StringLiteral */) || - (declaration.kind === 248 /* SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); + return ts.isAmbientModule(declaration) || (declaration.kind === 256 /* SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); } function hasVisibleDeclarations(symbol) { var aliasesToMakeVisible; @@ -15132,7 +16958,7 @@ var ts; // because these kind of aliases can be used to name types in declaration file var anyImportSyntax = getAnyImportSyntax(declaration); if (anyImportSyntax && - !(anyImportSyntax.flags & 2 /* Export */) && + !(anyImportSyntax.flags & 1 /* Export */) && isDeclarationVisible(anyImportSyntax.parent)) { getNodeLinks(declaration).isVisible = true; if (aliasesToMakeVisible) { @@ -15154,12 +16980,12 @@ var ts; function isEntityNameVisible(entityName, enclosingDeclaration) { // get symbol of the first identifier of the entityName var meaning; - if (entityName.parent.kind === 154 /* TypeQuery */) { + if (entityName.parent.kind === 158 /* TypeQuery */ || ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) { // Typeof value meaning = 107455 /* Value */ | 1048576 /* ExportValue */; } - else if (entityName.kind === 135 /* QualifiedName */ || entityName.kind === 166 /* PropertyAccessExpression */ || - entityName.parent.kind === 221 /* ImportEqualsDeclaration */) { + else if (entityName.kind === 139 /* QualifiedName */ || entityName.kind === 172 /* PropertyAccessExpression */ || + entityName.parent.kind === 229 /* ImportEqualsDeclaration */) { // Left identifier from type reference or TypeAlias // Entity name of the import declaration meaning = 1536 /* Namespace */; @@ -15193,9 +17019,9 @@ var ts; ts.releaseStringWriter(writer); return result; } - function signatureToString(signature, enclosingDeclaration, flags) { + function signatureToString(signature, enclosingDeclaration, flags, kind) { var writer = ts.getSingleLineStringWriter(); - getSymbolDisplayBuilder().buildSignatureDisplay(signature, writer, enclosingDeclaration, flags); + getSymbolDisplayBuilder().buildSignatureDisplay(signature, writer, enclosingDeclaration, flags, kind); var result = writer.string(); ts.releaseStringWriter(writer); return result; @@ -15211,18 +17037,39 @@ var ts; } return result; } + function typePredicateToString(typePredicate, enclosingDeclaration, flags) { + var writer = ts.getSingleLineStringWriter(); + getSymbolDisplayBuilder().buildTypePredicateDisplay(typePredicate, writer, enclosingDeclaration, flags); + var result = writer.string(); + ts.releaseStringWriter(writer); + return result; + } + function visibilityToString(flags) { + if (flags === 8 /* Private */) { + return "private"; + } + if (flags === 16 /* Protected */) { + return "protected"; + } + return "public"; + } function getTypeAliasForTypeLiteral(type) { if (type.symbol && type.symbol.flags & 2048 /* TypeLiteral */) { var node = type.symbol.declarations[0].parent; - while (node.kind === 160 /* ParenthesizedType */) { + while (node.kind === 164 /* ParenthesizedType */) { node = node.parent; } - if (node.kind === 216 /* TypeAliasDeclaration */) { + if (node.kind === 223 /* TypeAliasDeclaration */) { return getSymbolOfNode(node); } } return undefined; } + function isTopLevelInExternalModuleAugmentation(node) { + return node && node.parent && + node.parent.kind === 226 /* ModuleBlock */ && + ts.isExternalModuleAugmentation(node.parent.parent); + } function getSymbolDisplayBuilder() { function getNameOfSymbol(symbol) { if (symbol.declarations && symbol.declarations.length) { @@ -15231,10 +17078,10 @@ var ts; return ts.declarationNameToString(declaration.name); } switch (declaration.kind) { - case 186 /* ClassExpression */: + case 192 /* ClassExpression */: return "(Anonymous class)"; - case 173 /* FunctionExpression */: - case 174 /* ArrowFunction */: + case 179 /* FunctionExpression */: + case 180 /* ArrowFunction */: return "(Anonymous function)"; } } @@ -15242,11 +17089,35 @@ var ts; } /** * Writes only the name of the symbol out to the writer. Uses the original source text - * for the name of the symbol if it is available to match how the user inputted the name. + * for the name of the symbol if it is available to match how the user wrote the name. */ function appendSymbolNameOnly(symbol, writer) { writer.writeSymbol(getNameOfSymbol(symbol), symbol); } + /** + * Writes a property access or element access with the name of the symbol out to the writer. + * Uses the original source text for the name of the symbol if it is available to match how the user wrote the name, + * ensuring that any names written with literals use element accesses. + */ + function appendPropertyOrElementAccessForSymbol(symbol, writer) { + var symbolName = getNameOfSymbol(symbol); + var firstChar = symbolName.charCodeAt(0); + var needsElementAccess = !ts.isIdentifierStart(firstChar, languageVersion); + if (needsElementAccess) { + writePunctuation(writer, 19 /* OpenBracketToken */); + if (ts.isSingleOrDoubleQuote(firstChar)) { + writer.writeStringLiteral(symbolName); + } + else { + writer.writeSymbol(symbolName, symbol); + } + writePunctuation(writer, 20 /* CloseBracketToken */); + } + else { + writePunctuation(writer, 21 /* DotToken */); + writer.writeSymbol(symbolName, symbol); + } + } /** * Enclosing declaration is optional when we don't want to get qualified name in the enclosing declaration scope * Meaning needs to be specified if the enclosing declaration is given @@ -15264,10 +17135,12 @@ var ts; buildTypeParameterDisplayFromSymbol(parentSymbol, writer, enclosingDeclaration); } } - writePunctuation(writer, 21 /* DotToken */); + appendPropertyOrElementAccessForSymbol(symbol, writer); + } + else { + appendSymbolNameOnly(symbol, writer); } parentSymbol = symbol; - appendSymbolNameOnly(symbol, writer); } // const the writer know we just wrote out a symbol. The declaration emitter writer uses // this to determine if an import it has previously seen (and not written out) needs @@ -15321,7 +17194,7 @@ var ts; return writeType(type, globalFlags); function writeType(type, flags) { // Write undefined/null type as any - if (type.flags & 16777343 /* Intrinsic */) { + if (type.flags & 150995071 /* Intrinsic */) { // Special handling for unknown / resolving types, they should show up as any and not unknown or __resolving writer.writeKeyword(!(globalFlags & 16 /* WriteOwnNameForAnyLike */) && isTypeAny(type) ? "any" @@ -15381,11 +17254,13 @@ var ts; } if (pos < end) { writePunctuation(writer, 25 /* LessThanToken */); - writeType(typeArguments[pos++], 0 /* None */); + writeType(typeArguments[pos], 256 /* InFirstTypeArgument */); + pos++; while (pos < end) { writePunctuation(writer, 24 /* CommaToken */); writeSpace(writer); - writeType(typeArguments[pos++], 0 /* None */); + writeType(typeArguments[pos], 0 /* None */); + pos++; } writePunctuation(writer, 27 /* GreaterThanToken */); } @@ -15408,14 +17283,14 @@ var ts; while (i < length_1) { // Find group of type arguments for type parameters with the same declaring container. var start = i; - var parent_3 = getParentSymbolOfTypeParameter(outerTypeParameters[i]); + var parent_6 = getParentSymbolOfTypeParameter(outerTypeParameters[i]); do { i++; - } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent_3); + } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent_6); // When type parameters are their own type arguments for the whole group (i.e. we have // the default outer type arguments), we don't show the group. if (!ts.rangeEquals(outerTypeParameters, typeArguments, start, i)) { - writeSymbolTypeReference(parent_3, typeArguments, start, i, flags); + writeSymbolTypeReference(parent_6, typeArguments, start, i, flags); writePunctuation(writer, 21 /* DotToken */); } } @@ -15443,10 +17318,10 @@ var ts; if (symbol) { // Always use 'typeof T' for type of class, enum, and module objects if (symbol.flags & (32 /* Class */ | 384 /* Enum */ | 512 /* ValueModule */)) { - writeTypeofSymbol(type, flags); + writeTypeOfSymbol(type, flags); } else if (shouldWriteTypeOfFunctionSymbol()) { - writeTypeofSymbol(type, flags); + writeTypeOfSymbol(type, flags); } else if (ts.contains(symbolStack, symbol)) { // If type is an anonymous type literal in a type alias declaration, use type alias name @@ -15477,11 +17352,11 @@ var ts; } function shouldWriteTypeOfFunctionSymbol() { var isStaticMethodSymbol = !!(symbol.flags & 8192 /* Method */ && - ts.forEach(symbol.declarations, function (declaration) { return declaration.flags & 64 /* Static */; })); + ts.forEach(symbol.declarations, function (declaration) { return declaration.flags & 32 /* Static */; })); var isNonLocalFunctionSymbol = !!(symbol.flags & 16 /* Function */) && (symbol.parent || ts.forEach(symbol.declarations, function (declaration) { - return declaration.parent.kind === 248 /* SourceFile */ || declaration.parent.kind === 219 /* ModuleBlock */; + return declaration.parent.kind === 256 /* SourceFile */ || declaration.parent.kind === 226 /* ModuleBlock */; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { // typeof is allowed only for static/non local functions @@ -15490,35 +17365,67 @@ var ts; } } } - function writeTypeofSymbol(type, typeFormatFlags) { + function writeTypeOfSymbol(type, typeFormatFlags) { writeKeyword(writer, 101 /* TypeOfKeyword */); writeSpace(writer); buildSymbolDisplay(type.symbol, writer, enclosingDeclaration, 107455 /* Value */, 0 /* None */, typeFormatFlags); } - function getIndexerParameterName(type, indexKind, fallbackName) { - var declaration = getIndexDeclarationOfSymbol(type.symbol, indexKind); - if (!declaration) { - // declaration might not be found if indexer was added from the contextual type. - // in this case use fallback name - return fallbackName; + function writeIndexSignature(info, keyword) { + if (info) { + if (info.isReadonly) { + writeKeyword(writer, 128 /* ReadonlyKeyword */); + writeSpace(writer); + } + writePunctuation(writer, 19 /* OpenBracketToken */); + writer.writeParameter(info.declaration ? ts.declarationNameToString(info.declaration.parameters[0].name) : "x"); + writePunctuation(writer, 54 /* ColonToken */); + writeSpace(writer); + writeKeyword(writer, keyword); + writePunctuation(writer, 20 /* CloseBracketToken */); + writePunctuation(writer, 54 /* ColonToken */); + writeSpace(writer); + writeType(info.type, 0 /* None */); + writePunctuation(writer, 23 /* SemicolonToken */); + writer.writeLine(); } - ts.Debug.assert(declaration.parameters.length !== 0); - return ts.declarationNameToString(declaration.parameters[0].name); + } + function writePropertyWithModifiers(prop) { + if (isReadonlySymbol(prop)) { + writeKeyword(writer, 128 /* ReadonlyKeyword */); + writeSpace(writer); + } + buildSymbolDisplay(prop, writer); + if (prop.flags & 536870912 /* Optional */) { + writePunctuation(writer, 53 /* QuestionToken */); + } + } + function shouldAddParenthesisAroundFunctionType(callSignature, flags) { + if (flags & 64 /* InElementType */) { + return true; + } + else if (flags & 256 /* InFirstTypeArgument */) { + // Add parenthesis around function type for the first type argument to avoid ambiguity + var typeParameters = callSignature.target && (flags & 32 /* WriteTypeArgumentsOfSignature */) ? + callSignature.target.typeParameters : callSignature.typeParameters; + return typeParameters && typeParameters.length !== 0; + } + return false; } function writeLiteralType(type, flags) { var resolved = resolveStructuredTypeMembers(type); - if (!resolved.properties.length && !resolved.stringIndexType && !resolved.numberIndexType) { + if (!resolved.properties.length && !resolved.stringIndexInfo && !resolved.numberIndexInfo) { if (!resolved.callSignatures.length && !resolved.constructSignatures.length) { writePunctuation(writer, 15 /* OpenBraceToken */); writePunctuation(writer, 16 /* CloseBraceToken */); return; } if (resolved.callSignatures.length === 1 && !resolved.constructSignatures.length) { - if (flags & 64 /* InElementType */) { + var parenthesizeSignature = shouldAddParenthesisAroundFunctionType(resolved.callSignatures[0], flags); + if (parenthesizeSignature) { writePunctuation(writer, 17 /* OpenParenToken */); } - buildSignatureDisplay(resolved.callSignatures[0], writer, enclosingDeclaration, globalFlagsToPass | 8 /* WriteArrowStyleSignature */, symbolStack); - if (flags & 64 /* InElementType */) { + buildSignatureDisplay(resolved.callSignatures[0], writer, enclosingDeclaration, globalFlagsToPass | 8 /* WriteArrowStyleSignature */, /*kind*/ undefined, symbolStack); + if (parenthesizeSignature) { writePunctuation(writer, 18 /* CloseParenToken */); } return; @@ -15529,7 +17436,7 @@ var ts; } writeKeyword(writer, 92 /* NewKeyword */); writeSpace(writer); - buildSignatureDisplay(resolved.constructSignatures[0], writer, enclosingDeclaration, globalFlagsToPass | 8 /* WriteArrowStyleSignature */, symbolStack); + buildSignatureDisplay(resolved.constructSignatures[0], writer, enclosingDeclaration, globalFlagsToPass | 8 /* WriteArrowStyleSignature */, /*kind*/ undefined, symbolStack); if (flags & 64 /* InElementType */) { writePunctuation(writer, 18 /* CloseParenToken */); } @@ -15543,46 +17450,18 @@ var ts; writer.increaseIndent(); for (var _i = 0, _a = resolved.callSignatures; _i < _a.length; _i++) { var signature = _a[_i]; - buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, symbolStack); + buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, /*kind*/ undefined, symbolStack); writePunctuation(writer, 23 /* SemicolonToken */); writer.writeLine(); } for (var _b = 0, _c = resolved.constructSignatures; _b < _c.length; _b++) { var signature = _c[_b]; - writeKeyword(writer, 92 /* NewKeyword */); - writeSpace(writer); - buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, symbolStack); - writePunctuation(writer, 23 /* SemicolonToken */); - writer.writeLine(); - } - if (resolved.stringIndexType) { - // [x: string]: - writePunctuation(writer, 19 /* OpenBracketToken */); - writer.writeParameter(getIndexerParameterName(resolved, 0 /* String */, /*fallbackName*/ "x")); - writePunctuation(writer, 54 /* ColonToken */); - writeSpace(writer); - writeKeyword(writer, 130 /* StringKeyword */); - writePunctuation(writer, 20 /* CloseBracketToken */); - writePunctuation(writer, 54 /* ColonToken */); - writeSpace(writer); - writeType(resolved.stringIndexType, 0 /* None */); - writePunctuation(writer, 23 /* SemicolonToken */); - writer.writeLine(); - } - if (resolved.numberIndexType) { - // [x: number]: - writePunctuation(writer, 19 /* OpenBracketToken */); - writer.writeParameter(getIndexerParameterName(resolved, 1 /* Number */, /*fallbackName*/ "x")); - writePunctuation(writer, 54 /* ColonToken */); - writeSpace(writer); - writeKeyword(writer, 128 /* NumberKeyword */); - writePunctuation(writer, 20 /* CloseBracketToken */); - writePunctuation(writer, 54 /* ColonToken */); - writeSpace(writer); - writeType(resolved.numberIndexType, 0 /* None */); + buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, 1 /* Construct */, symbolStack); writePunctuation(writer, 23 /* SemicolonToken */); writer.writeLine(); } + writeIndexSignature(resolved.stringIndexInfo, 132 /* StringKeyword */); + writeIndexSignature(resolved.numberIndexInfo, 130 /* NumberKeyword */); for (var _d = 0, _e = resolved.properties; _d < _e.length; _d++) { var p = _e[_d]; var t = getTypeOfSymbol(p); @@ -15590,20 +17469,14 @@ var ts; var signatures = getSignaturesOfType(t, 0 /* Call */); for (var _f = 0, signatures_1 = signatures; _f < signatures_1.length; _f++) { var signature = signatures_1[_f]; - buildSymbolDisplay(p, writer); - if (p.flags & 536870912 /* Optional */) { - writePunctuation(writer, 53 /* QuestionToken */); - } - buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, symbolStack); + writePropertyWithModifiers(p); + buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, /*kind*/ undefined, symbolStack); writePunctuation(writer, 23 /* SemicolonToken */); writer.writeLine(); } } else { - buildSymbolDisplay(p, writer); - if (p.flags & 536870912 /* Optional */) { - writePunctuation(writer, 53 /* QuestionToken */); - } + writePropertyWithModifiers(p); writePunctuation(writer, 54 /* ColonToken */); writeSpace(writer); writeType(t, 0 /* None */); @@ -15616,10 +17489,10 @@ var ts; inObjectTypeLiteral = saveInObjectTypeLiteral; } } - function buildTypeParameterDisplayFromSymbol(symbol, writer, enclosingDeclaraiton, flags) { + function buildTypeParameterDisplayFromSymbol(symbol, writer, enclosingDeclaration, flags) { var targetSymbol = getTargetSymbol(symbol); if (targetSymbol.flags & 32 /* Class */ || targetSymbol.flags & 64 /* Interface */ || targetSymbol.flags & 524288 /* TypeAlias */) { - buildDisplayForTypeParametersAndDelimiters(getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol), writer, enclosingDeclaraiton, flags); + buildDisplayForTypeParametersAndDelimiters(getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol), writer, enclosingDeclaration, flags); } } function buildTypeParameterDisplay(tp, writer, enclosingDeclaration, flags, symbolStack) { @@ -15637,7 +17510,12 @@ var ts; if (ts.isRestParameter(parameterNode)) { writePunctuation(writer, 22 /* DotDotDotToken */); } - appendSymbolNameOnly(p, writer); + if (ts.isBindingPattern(parameterNode.name)) { + buildBindingPatternDisplay(parameterNode.name, writer, enclosingDeclaration, flags, symbolStack); + } + else { + appendSymbolNameOnly(p, writer); + } if (isOptionalParameter(parameterNode)) { writePunctuation(writer, 53 /* QuestionToken */); } @@ -15645,36 +17523,84 @@ var ts; writeSpace(writer); buildTypeDisplay(getTypeOfSymbol(p), writer, enclosingDeclaration, flags, symbolStack); } + function buildBindingPatternDisplay(bindingPattern, writer, enclosingDeclaration, flags, symbolStack) { + // We have to explicitly emit square bracket and bracket because these tokens are not stored inside the node. + if (bindingPattern.kind === 167 /* ObjectBindingPattern */) { + writePunctuation(writer, 15 /* OpenBraceToken */); + buildDisplayForCommaSeparatedList(bindingPattern.elements, writer, function (e) { return buildBindingElementDisplay(e, writer, enclosingDeclaration, flags, symbolStack); }); + writePunctuation(writer, 16 /* CloseBraceToken */); + } + else if (bindingPattern.kind === 168 /* ArrayBindingPattern */) { + writePunctuation(writer, 19 /* OpenBracketToken */); + var elements = bindingPattern.elements; + buildDisplayForCommaSeparatedList(elements, writer, function (e) { return buildBindingElementDisplay(e, writer, enclosingDeclaration, flags, symbolStack); }); + if (elements && elements.hasTrailingComma) { + writePunctuation(writer, 24 /* CommaToken */); + } + writePunctuation(writer, 20 /* CloseBracketToken */); + } + } + function buildBindingElementDisplay(bindingElement, writer, enclosingDeclaration, flags, symbolStack) { + if (bindingElement.kind === 193 /* OmittedExpression */) { + return; + } + ts.Debug.assert(bindingElement.kind === 169 /* BindingElement */); + if (bindingElement.propertyName) { + writer.writeSymbol(ts.getTextOfNode(bindingElement.propertyName), bindingElement.symbol); + writePunctuation(writer, 54 /* ColonToken */); + writeSpace(writer); + } + if (ts.isBindingPattern(bindingElement.name)) { + buildBindingPatternDisplay(bindingElement.name, writer, enclosingDeclaration, flags, symbolStack); + } + else { + if (bindingElement.dotDotDotToken) { + writePunctuation(writer, 22 /* DotDotDotToken */); + } + appendSymbolNameOnly(bindingElement.symbol, writer); + } + } function buildDisplayForTypeParametersAndDelimiters(typeParameters, writer, enclosingDeclaration, flags, symbolStack) { if (typeParameters && typeParameters.length) { writePunctuation(writer, 25 /* LessThanToken */); - for (var i = 0; i < typeParameters.length; i++) { - if (i > 0) { - writePunctuation(writer, 24 /* CommaToken */); - writeSpace(writer); - } - buildTypeParameterDisplay(typeParameters[i], writer, enclosingDeclaration, flags, symbolStack); - } + buildDisplayForCommaSeparatedList(typeParameters, writer, function (p) { return buildTypeParameterDisplay(p, writer, enclosingDeclaration, flags, symbolStack); }); writePunctuation(writer, 27 /* GreaterThanToken */); } } + function buildDisplayForCommaSeparatedList(list, writer, action) { + for (var i = 0; i < list.length; i++) { + if (i > 0) { + writePunctuation(writer, 24 /* CommaToken */); + writeSpace(writer); + } + action(list[i]); + } + } function buildDisplayForTypeArgumentsAndDelimiters(typeParameters, mapper, writer, enclosingDeclaration, flags, symbolStack) { if (typeParameters && typeParameters.length) { writePunctuation(writer, 25 /* LessThanToken */); + var flags_1 = 256 /* InFirstTypeArgument */; for (var i = 0; i < typeParameters.length; i++) { if (i > 0) { writePunctuation(writer, 24 /* CommaToken */); writeSpace(writer); + flags_1 = 0 /* None */; } - buildTypeDisplay(mapper(typeParameters[i]), writer, enclosingDeclaration, 0 /* None */); + buildTypeDisplay(mapper(typeParameters[i]), writer, enclosingDeclaration, flags_1); } writePunctuation(writer, 27 /* GreaterThanToken */); } } - function buildDisplayForParametersAndDelimiters(parameters, writer, enclosingDeclaration, flags, symbolStack) { + function buildDisplayForParametersAndDelimiters(thisType, parameters, writer, enclosingDeclaration, flags, symbolStack) { writePunctuation(writer, 17 /* OpenParenToken */); + if (thisType) { + writeKeyword(writer, 97 /* ThisKeyword */); + writePunctuation(writer, 54 /* ColonToken */); + writeSpace(writer); + buildTypeDisplay(thisType, writer, enclosingDeclaration, flags, symbolStack); + } for (var i = 0; i < parameters.length; i++) { - if (i > 0) { + if (i > 0 || thisType) { writePunctuation(writer, 24 /* CommaToken */); writeSpace(writer); } @@ -15682,6 +17608,18 @@ var ts; } writePunctuation(writer, 18 /* CloseParenToken */); } + function buildTypePredicateDisplay(predicate, writer, enclosingDeclaration, flags, symbolStack) { + if (ts.isIdentifierTypePredicate(predicate)) { + writer.writeParameter(predicate.parameterName); + } + else { + writeKeyword(writer, 97 /* ThisKeyword */); + } + writeSpace(writer); + writeKeyword(writer, 124 /* IsKeyword */); + writeSpace(writer); + buildTypeDisplay(predicate.type, writer, enclosingDeclaration, flags, symbolStack); + } function buildReturnTypeDisplay(signature, writer, enclosingDeclaration, flags, symbolStack) { if (flags & 8 /* WriteArrowStyleSignature */) { writeSpace(writer); @@ -15691,20 +17629,19 @@ var ts; writePunctuation(writer, 54 /* ColonToken */); } writeSpace(writer); - var returnType; if (signature.typePredicate) { - writer.writeParameter(signature.typePredicate.parameterName); - writeSpace(writer); - writeKeyword(writer, 124 /* IsKeyword */); - writeSpace(writer); - returnType = signature.typePredicate.type; + buildTypePredicateDisplay(signature.typePredicate, writer, enclosingDeclaration, flags, symbolStack); } else { - returnType = getReturnTypeOfSignature(signature); + var returnType = getReturnTypeOfSignature(signature); + buildTypeDisplay(returnType, writer, enclosingDeclaration, flags, symbolStack); } - buildTypeDisplay(returnType, writer, enclosingDeclaration, flags, symbolStack); } - function buildSignatureDisplay(signature, writer, enclosingDeclaration, flags, symbolStack) { + function buildSignatureDisplay(signature, writer, enclosingDeclaration, flags, kind, symbolStack) { + if (kind === 1 /* Construct */) { + writeKeyword(writer, 92 /* NewKeyword */); + writeSpace(writer); + } if (signature.target && (flags & 32 /* WriteTypeArgumentsOfSignature */)) { // Instantiated signature, write type arguments instead // This is achieved by passing in the mapper separately @@ -15713,13 +17650,14 @@ var ts; else { buildDisplayForTypeParametersAndDelimiters(signature.typeParameters, writer, enclosingDeclaration, flags, symbolStack); } - buildDisplayForParametersAndDelimiters(signature.parameters, writer, enclosingDeclaration, flags, symbolStack); + buildDisplayForParametersAndDelimiters(signature.thisType, signature.parameters, writer, enclosingDeclaration, flags, symbolStack); buildReturnTypeDisplay(signature, writer, enclosingDeclaration, flags, symbolStack); } return _displayBuilder || (_displayBuilder = { buildSymbolDisplay: buildSymbolDisplay, buildTypeDisplay: buildTypeDisplay, buildTypeParameterDisplay: buildTypeParameterDisplay, + buildTypePredicateDisplay: buildTypePredicateDisplay, buildParameterDisplay: buildParameterDisplay, buildDisplayForParametersAndDelimiters: buildDisplayForParametersAndDelimiters, buildDisplayForTypeParametersAndDelimiters: buildDisplayForTypeParametersAndDelimiters, @@ -15729,131 +17667,6 @@ var ts; }); } function isDeclarationVisible(node) { - function getContainingExternalModule(node) { - for (; node; node = node.parent) { - if (node.kind === 218 /* ModuleDeclaration */) { - if (node.name.kind === 9 /* StringLiteral */) { - return node; - } - } - else if (node.kind === 248 /* SourceFile */) { - return ts.isExternalOrCommonJsModule(node) ? node : undefined; - } - } - ts.Debug.fail("getContainingModule cant reach here"); - } - function isUsedInExportAssignment(node) { - // Get source File and see if it is external module and has export assigned symbol - var externalModule = getContainingExternalModule(node); - var exportAssignmentSymbol; - var resolvedExportSymbol; - if (externalModule) { - // This is export assigned symbol node - var externalModuleSymbol = getSymbolOfNode(externalModule); - exportAssignmentSymbol = getExportAssignmentSymbol(externalModuleSymbol); - var symbolOfNode = getSymbolOfNode(node); - if (isSymbolUsedInExportAssignment(symbolOfNode)) { - return true; - } - // if symbolOfNode is alias declaration, resolve the symbol declaration and check - if (symbolOfNode.flags & 8388608 /* Alias */) { - return isSymbolUsedInExportAssignment(resolveAlias(symbolOfNode)); - } - } - // Check if the symbol is used in export assignment - function isSymbolUsedInExportAssignment(symbol) { - if (exportAssignmentSymbol === symbol) { - return true; - } - if (exportAssignmentSymbol && !!(exportAssignmentSymbol.flags & 8388608 /* Alias */)) { - // if export assigned symbol is alias declaration, resolve the alias - resolvedExportSymbol = resolvedExportSymbol || resolveAlias(exportAssignmentSymbol); - if (resolvedExportSymbol === symbol) { - return true; - } - // Container of resolvedExportSymbol is visible - return ts.forEach(resolvedExportSymbol.declarations, function (current) { - while (current) { - if (current === node) { - return true; - } - current = current.parent; - } - }); - } - } - } - function determineIfDeclarationIsVisible() { - switch (node.kind) { - case 163 /* BindingElement */: - return isDeclarationVisible(node.parent.parent); - case 211 /* VariableDeclaration */: - if (ts.isBindingPattern(node.name) && - !node.name.elements.length) { - // If the binding pattern is empty, this variable declaration is not visible - return false; - } - // Otherwise fall through - case 218 /* ModuleDeclaration */: - case 214 /* ClassDeclaration */: - case 215 /* InterfaceDeclaration */: - case 216 /* TypeAliasDeclaration */: - case 213 /* FunctionDeclaration */: - case 217 /* EnumDeclaration */: - case 221 /* ImportEqualsDeclaration */: - var parent_4 = getDeclarationContainer(node); - // If the node is not exported or it is not ambient module element (except import declaration) - if (!(ts.getCombinedNodeFlags(node) & 2 /* Export */) && - !(node.kind !== 221 /* ImportEqualsDeclaration */ && parent_4.kind !== 248 /* SourceFile */ && ts.isInAmbientContext(parent_4))) { - return isGlobalSourceFile(parent_4); - } - // Exported members/ambient module elements (exception import declaration) are visible if parent is visible - return isDeclarationVisible(parent_4); - case 141 /* PropertyDeclaration */: - case 140 /* PropertySignature */: - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - if (node.flags & (16 /* Private */ | 32 /* Protected */)) { - // Private/protected properties/methods are not visible - return false; - } - // Public properties/methods are visible if its parents are visible, so const it fall into next case statement - case 144 /* Constructor */: - case 148 /* ConstructSignature */: - case 147 /* CallSignature */: - case 149 /* IndexSignature */: - case 138 /* Parameter */: - case 219 /* ModuleBlock */: - case 152 /* FunctionType */: - case 153 /* ConstructorType */: - case 155 /* TypeLiteral */: - case 151 /* TypeReference */: - case 156 /* ArrayType */: - case 157 /* TupleType */: - case 158 /* UnionType */: - case 159 /* IntersectionType */: - case 160 /* ParenthesizedType */: - return isDeclarationVisible(node.parent); - // Default binding, import specifier and namespace import is visible - // only on demand so by default it is not visible - case 223 /* ImportClause */: - case 224 /* NamespaceImport */: - case 226 /* ImportSpecifier */: - return false; - // Type parameters are always visible - case 137 /* TypeParameter */: - // Source file is always visible - case 248 /* SourceFile */: - return true; - // Export assignments do not create name bindings outside the module - case 227 /* ExportAssignment */: - return false; - default: - ts.Debug.fail("isDeclarationVisible unknown: SyntaxKind: " + node.kind); - } - } if (node) { var links = getNodeLinks(node); if (links.isVisible === undefined) { @@ -15861,13 +17674,89 @@ var ts; } return links.isVisible; } + return false; + function determineIfDeclarationIsVisible() { + switch (node.kind) { + case 169 /* BindingElement */: + return isDeclarationVisible(node.parent.parent); + case 218 /* VariableDeclaration */: + if (ts.isBindingPattern(node.name) && + !node.name.elements.length) { + // If the binding pattern is empty, this variable declaration is not visible + return false; + } + // Otherwise fall through + case 225 /* ModuleDeclaration */: + case 221 /* ClassDeclaration */: + case 222 /* InterfaceDeclaration */: + case 223 /* TypeAliasDeclaration */: + case 220 /* FunctionDeclaration */: + case 224 /* EnumDeclaration */: + case 229 /* ImportEqualsDeclaration */: + // external module augmentation is always visible + if (ts.isExternalModuleAugmentation(node)) { + return true; + } + var parent_7 = getDeclarationContainer(node); + // If the node is not exported or it is not ambient module element (except import declaration) + if (!(ts.getCombinedNodeFlags(node) & 1 /* Export */) && + !(node.kind !== 229 /* ImportEqualsDeclaration */ && parent_7.kind !== 256 /* SourceFile */ && ts.isInAmbientContext(parent_7))) { + return isGlobalSourceFile(parent_7); + } + // Exported members/ambient module elements (exception import declaration) are visible if parent is visible + return isDeclarationVisible(parent_7); + case 145 /* PropertyDeclaration */: + case 144 /* PropertySignature */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: + if (node.flags & (8 /* Private */ | 16 /* Protected */)) { + // Private/protected properties/methods are not visible + return false; + } + // Public properties/methods are visible if its parents are visible, so const it fall into next case statement + case 148 /* Constructor */: + case 152 /* ConstructSignature */: + case 151 /* CallSignature */: + case 153 /* IndexSignature */: + case 142 /* Parameter */: + case 226 /* ModuleBlock */: + case 156 /* FunctionType */: + case 157 /* ConstructorType */: + case 159 /* TypeLiteral */: + case 155 /* TypeReference */: + case 160 /* ArrayType */: + case 161 /* TupleType */: + case 162 /* UnionType */: + case 163 /* IntersectionType */: + case 164 /* ParenthesizedType */: + return isDeclarationVisible(node.parent); + // Default binding, import specifier and namespace import is visible + // only on demand so by default it is not visible + case 231 /* ImportClause */: + case 232 /* NamespaceImport */: + case 234 /* ImportSpecifier */: + return false; + // Type parameters are always visible + case 141 /* TypeParameter */: + // Source file is always visible + case 256 /* SourceFile */: + return true; + // Export assignments do not create name bindings outside the module + case 235 /* ExportAssignment */: + return false; + default: + return false; + } + } } function collectLinkedAliases(node) { var exportSymbol; - if (node.parent && node.parent.kind === 227 /* ExportAssignment */) { + if (node.parent && node.parent.kind === 235 /* ExportAssignment */) { exportSymbol = resolveName(node.parent, node.text, 107455 /* Value */ | 793056 /* Type */ | 1536 /* Namespace */ | 8388608 /* Alias */, ts.Diagnostics.Cannot_find_name_0, node); } - else if (node.parent.kind === 230 /* ExportSpecifier */) { + else if (node.parent.kind === 238 /* ExportSpecifier */) { var exportSpecifier = node.parent; exportSymbol = exportSpecifier.parent.parent.moduleSpecifier ? getExternalModuleMember(exportSpecifier.parent.parent, exportSpecifier) : @@ -15889,8 +17778,10 @@ var ts; // Add the referenced top container visible var internalModuleReference = declaration.moduleReference; var firstIdentifier = getFirstIdentifier(internalModuleReference); - var importSymbol = resolveName(declaration, firstIdentifier.text, 107455 /* Value */ | 793056 /* Type */ | 1536 /* Namespace */, ts.Diagnostics.Cannot_find_name_0, firstIdentifier); - buildVisibleNodeList(importSymbol.declarations); + var importSymbol = resolveName(declaration, firstIdentifier.text, 107455 /* Value */ | 793056 /* Type */ | 1536 /* Namespace */, undefined, undefined); + if (importSymbol) { + buildVisibleNodeList(importSymbol.declarations); + } } }); } @@ -15917,7 +17808,7 @@ var ts; return false; } resolutionTargets.push(target); - resolutionResults.push(true); + resolutionResults.push(/*items*/ true); resolutionPropertyNames.push(propertyName); return true; } @@ -15957,16 +17848,27 @@ var ts; } function getDeclarationContainer(node) { node = ts.getRootDeclaration(node); - // Parent chain: - // VaribleDeclaration -> VariableDeclarationList -> VariableStatement -> 'Declaration Container' - return node.kind === 211 /* VariableDeclaration */ ? node.parent.parent.parent : node.parent; + while (node) { + switch (node.kind) { + case 218 /* VariableDeclaration */: + case 219 /* VariableDeclarationList */: + case 234 /* ImportSpecifier */: + case 233 /* NamedImports */: + case 232 /* NamespaceImport */: + case 231 /* ImportClause */: + node = node.parent; + break; + default: + return node.parent; + } + } } function getTypeOfPrototypeProperty(prototype) { // TypeScript 1.0 spec (April 2014): 8.4 // Every class automatically contains a static property member named 'prototype', // the type of which is an instantiation of the class type with type Any supplied as a type argument for each type parameter. // It is an error to explicitly declare a static property member with the name 'prototype'. - var classType = getDeclaredTypeOfSymbol(prototype.parent); + var classType = getDeclaredTypeOfSymbol(getParentOfSymbol(prototype)); return classType.typeParameters ? createTypeReference(classType, ts.map(classType.typeParameters, function (_) { return anyType; })) : classType; } // Return the type of the given property in the given type, or undefined if no such property exists @@ -15990,7 +17892,7 @@ var ts; case 9 /* StringLiteral */: case 8 /* NumericLiteral */: return name.text; - case 136 /* ComputedPropertyName */: + case 140 /* ComputedPropertyName */: if (ts.isStringOrNumericLiteral(name.expression.kind)) { return name.expression.text; } @@ -15998,9 +17900,9 @@ var ts; return undefined; } function isComputedNonLiteralName(name) { - return name.kind === 136 /* ComputedPropertyName */ && !ts.isStringOrNumericLiteral(name.expression.kind); + return name.kind === 140 /* ComputedPropertyName */ && !ts.isStringOrNumericLiteral(name.expression.kind); } - // Return the inferred type for a binding element + /** Return the inferred type for a binding element */ function getTypeForBindingElement(declaration) { var pattern = declaration.parent; var parentType = getTypeForBindingElementParent(pattern.parent); @@ -16018,13 +17920,16 @@ var ts; return parentType; } var type; - if (pattern.kind === 161 /* ObjectBindingPattern */) { + if (pattern.kind === 167 /* ObjectBindingPattern */) { // Use explicitly specified property name ({ p: xxx } form), or otherwise the implied name ({ p } form) var name_10 = declaration.propertyName || declaration.name; if (isComputedNonLiteralName(name_10)) { // computed properties with non-literal names are treated as 'any' return anyType; } + if (declaration.initializer) { + getContextualType(declaration.initializer); + } // Use type of the specified property, or otherwise, for a numeric name, the type of the numeric index signature, // or otherwise the type of the string index signature. var text = getTextOfPropertyName(name_10); @@ -16062,15 +17967,63 @@ var ts; type = createArrayType(elementType); } } + // In strict null checking mode, if a default value of a non-undefined type is specified, remove + // undefined from the final type. + if (strictNullChecks && declaration.initializer && !(getNullableKind(checkExpressionCached(declaration.initializer)) & 32 /* Undefined */)) { + type = getTypeWithFacts(type, 131072 /* NEUndefined */); + } return type; } + function getTypeForVariableLikeDeclarationFromJSDocComment(declaration) { + var jsDocType = getJSDocTypeForVariableLikeDeclarationFromJSDocComment(declaration); + if (jsDocType) { + return getTypeFromTypeNode(jsDocType); + } + } + function getJSDocTypeForVariableLikeDeclarationFromJSDocComment(declaration) { + // First, see if this node has an @type annotation on it directly. + var typeTag = ts.getJSDocTypeTag(declaration); + if (typeTag && typeTag.typeExpression) { + return typeTag.typeExpression.type; + } + if (declaration.kind === 218 /* VariableDeclaration */ && + declaration.parent.kind === 219 /* VariableDeclarationList */ && + declaration.parent.parent.kind === 200 /* VariableStatement */) { + // @type annotation might have been on the variable statement, try that instead. + var annotation = ts.getJSDocTypeTag(declaration.parent.parent); + if (annotation && annotation.typeExpression) { + return annotation.typeExpression.type; + } + } + else if (declaration.kind === 142 /* Parameter */) { + // If it's a parameter, see if the parent has a jsdoc comment with an @param + // annotation. + var paramTag = ts.getCorrespondingJSDocParameterTag(declaration); + if (paramTag && paramTag.typeExpression) { + return paramTag.typeExpression.type; + } + } + return undefined; + } + function addOptionality(type, optional) { + return strictNullChecks && optional ? addNullableKind(type, 32 /* Undefined */) : type; + } // Return the inferred type for a variable, parameter, or property declaration function getTypeForVariableLikeDeclaration(declaration) { - // A variable declared in a for..in statement is always of type any - if (declaration.parent.parent.kind === 200 /* ForInStatement */) { - return anyType; + if (declaration.flags & 134217728 /* JavaScriptFile */) { + // If this is a variable in a JavaScript file, then use the JSDoc type (if it has + // one as its type), otherwise fallback to the below standard TS codepaths to + // try to figure it out. + var type = getTypeForVariableLikeDeclarationFromJSDocComment(declaration); + if (type && type !== unknownType) { + return type; + } } - if (declaration.parent.parent.kind === 201 /* ForOfStatement */) { + // A variable declared in a for..in statement is always of type string + if (declaration.parent.parent.kind === 207 /* ForInStatement */) { + return stringType; + } + if (declaration.parent.parent.kind === 208 /* ForOfStatement */) { // checkRightHandSideOfForOf will return undefined if the for-of expression type was // missing properties/signatures required to get its iteratedType (like // [Symbol.iterator] or next). This may be because we accessed properties from anyType, @@ -16082,29 +18035,36 @@ var ts; } // Use type from type annotation if one is present if (declaration.type) { - return getTypeFromTypeNode(declaration.type); + return addOptionality(getTypeFromTypeNode(declaration.type), /*optional*/ !!declaration.questionToken); } - if (declaration.kind === 138 /* Parameter */) { + if (declaration.kind === 142 /* Parameter */) { var func = declaration.parent; // For a parameter of a set accessor, use the type of the get accessor if one is present - if (func.kind === 146 /* SetAccessor */ && !ts.hasDynamicName(func)) { - var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 145 /* GetAccessor */); + if (func.kind === 150 /* SetAccessor */ && !ts.hasDynamicName(func)) { + var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 149 /* GetAccessor */); if (getter) { - return getReturnTypeOfSignature(getSignatureFromDeclaration(getter)); + var signature = getSignatureFromDeclaration(getter); + var thisParameter = getAccessorThisParameter(func); + if (thisParameter && declaration === thisParameter) { + return signature.thisType; + } + return getReturnTypeOfSignature(signature); } } // Use contextual parameter type if one is available - var type = getContextuallyTypedParameterType(declaration); + var type = declaration.symbol.name === "this" + ? getContextuallyTypedThisType(func) + : getContextuallyTypedParameterType(declaration); if (type) { - return type; + return addOptionality(type, /*optional*/ !!declaration.questionToken); } } // Use the type of the initializer expression if one is present if (declaration.initializer) { - return checkExpressionCached(declaration.initializer); + return addOptionality(checkExpressionCached(declaration.initializer), /*optional*/ !!declaration.questionToken); } // If it is a short-hand property assignment, use the type of the identifier - if (declaration.kind === 246 /* ShorthandPropertyAssignment */) { + if (declaration.kind === 254 /* ShorthandPropertyAssignment */) { return checkIdentifier(declaration.name); } // If the declaration specifies a binding pattern, use the type implied by the binding pattern @@ -16119,11 +18079,16 @@ var ts; // pattern. Otherwise, it is the type any. function getTypeFromBindingElement(element, includePatternInType) { if (element.initializer) { - return getWidenedType(checkExpressionCached(element.initializer)); + var type = checkExpressionCached(element.initializer); + reportErrorsFromWidening(element, type); + return getWidenedType(type); } if (ts.isBindingPattern(element.name)) { return getTypeFromBindingPattern(element.name, includePatternInType); } + if (compilerOptions.noImplicitAny && !declarationBelongsToPrivateAmbientMember(element)) { + reportImplicitAnyError(element, anyType); + } return anyType; } // Return the type implied by an object binding pattern @@ -16160,7 +18125,7 @@ var ts; return languageVersion >= 2 /* ES6 */ ? createIterableType(anyType) : anyArrayType; } // If the pattern has at least one element, and no rest element, then it should imply a tuple type. - var elementTypes = ts.map(elements, function (e) { return e.kind === 187 /* OmittedExpression */ ? anyType : getTypeFromBindingElement(e, includePatternInType); }); + var elementTypes = ts.map(elements, function (e) { return e.kind === 193 /* OmittedExpression */ ? anyType : getTypeFromBindingElement(e, includePatternInType); }); if (includePatternInType) { var result = createNewTupleType(elementTypes); result.pattern = pattern; @@ -16176,7 +18141,7 @@ var ts; // parameter with no type annotation or initializer, the type implied by the binding pattern becomes the type of // the parameter. function getTypeFromBindingPattern(pattern, includePatternInType) { - return pattern.kind === 161 /* ObjectBindingPattern */ + return pattern.kind === 167 /* ObjectBindingPattern */ ? getTypeFromObjectBindingPattern(pattern, includePatternInType) : getTypeFromArrayBindingPattern(pattern, includePatternInType); } @@ -16198,19 +18163,26 @@ var ts; // During a normal type check we'll never get to here with a property assignment (the check of the containing // object literal uses a different path). We exclude widening only so that language services and type verification // tools see the actual type. - return declaration.kind !== 245 /* PropertyAssignment */ ? getWidenedType(type) : type; + if (declaration.kind === 253 /* PropertyAssignment */) { + return type; + } + return getWidenedType(type); } // Rest parameters default to type any[], other parameters default to type any type = declaration.dotDotDotToken ? anyArrayType : anyType; // Report implicit any errors unless this is a private property within an ambient declaration if (reportErrors && compilerOptions.noImplicitAny) { - var root = ts.getRootDeclaration(declaration); - if (!isPrivateWithinAmbient(root) && !(root.kind === 138 /* Parameter */ && isPrivateWithinAmbient(root.parent))) { + if (!declarationBelongsToPrivateAmbientMember(declaration)) { reportImplicitAnyError(declaration, type); } } return type; } + function declarationBelongsToPrivateAmbientMember(declaration) { + var root = ts.getRootDeclaration(declaration); + var memberDeclaration = root.kind === 142 /* Parameter */ ? root.parent : root; + return isPrivateWithinAmbient(memberDeclaration); + } function getTypeOfVariableOrParameterOrProperty(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { @@ -16220,20 +18192,24 @@ var ts; } // Handle catch clause variables var declaration = symbol.valueDeclaration; - if (declaration.parent.kind === 244 /* CatchClause */) { + if (declaration.parent.kind === 252 /* CatchClause */) { return links.type = anyType; } // Handle export default expressions - if (declaration.kind === 227 /* ExportAssignment */) { + if (declaration.kind === 235 /* ExportAssignment */) { return links.type = checkExpression(declaration.expression); } // Handle module.exports = expr - if (declaration.kind === 181 /* BinaryExpression */) { - return links.type = checkExpression(declaration.right); + if (declaration.kind === 187 /* BinaryExpression */) { + return links.type = getUnionType(ts.map(symbol.declarations, function (decl) { return checkExpressionCached(decl.right); })); } - // Handle exports.p = expr - if (declaration.kind === 166 /* PropertyAccessExpression */) { - return checkExpressionCached(declaration.parent.right); + if (declaration.kind === 172 /* PropertyAccessExpression */) { + // Declarations only exist for property access expressions for certain + // special assignment kinds + if (declaration.parent.kind === 187 /* BinaryExpression */) { + // Handle exports.p = expr or this.p = expr or className.prototype.method = expr + return links.type = checkExpressionCached(declaration.parent.right); + } } // Handle variable, parameter or property if (!pushTypeResolution(symbol, 0 /* Type */)) { @@ -16260,7 +18236,7 @@ var ts; } function getAnnotatedAccessorType(accessor) { if (accessor) { - if (accessor.kind === 145 /* GetAccessor */) { + if (accessor.kind === 149 /* GetAccessor */) { return accessor.type && getTypeFromTypeNode(accessor.type); } else { @@ -16270,15 +18246,30 @@ var ts; } return undefined; } + function getAnnotatedAccessorThisType(accessor) { + if (accessor) { + var parameter = getAccessorThisParameter(accessor); + if (parameter && parameter.type) { + return getTypeFromTypeNode(accessor.parameters[0].type); + } + } + return undefined; + } function getTypeOfAccessors(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { + var getter = ts.getDeclarationOfKind(symbol, 149 /* GetAccessor */); + var setter = ts.getDeclarationOfKind(symbol, 150 /* SetAccessor */); + if (getter && getter.flags & 134217728 /* JavaScriptFile */) { + var jsDocType = getTypeForVariableLikeDeclarationFromJSDocComment(getter); + if (jsDocType) { + return links.type = jsDocType; + } + } if (!pushTypeResolution(symbol, 0 /* Type */)) { return unknownType; } - var getter = ts.getDeclarationOfKind(symbol, 145 /* GetAccessor */); - var setter = ts.getDeclarationOfKind(symbol, 146 /* SetAccessor */); - var type; + var type = void 0; // First try to see if the user specified a return type on the get-accessor. var getterReturnType = getAnnotatedAccessorType(getter); if (getterReturnType) { @@ -16306,7 +18297,7 @@ var ts; if (!popTypeResolution()) { type = anyType; if (compilerOptions.noImplicitAny) { - var getter_1 = ts.getDeclarationOfKind(symbol, 145 /* GetAccessor */); + var getter_1 = ts.getDeclarationOfKind(symbol, 149 /* GetAccessor */); error(getter_1, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol)); } } @@ -16317,7 +18308,9 @@ var ts; function getTypeOfFuncClassEnumModule(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { - links.type = createObjectType(65536 /* Anonymous */, symbol); + var type = createObjectType(65536 /* Anonymous */, symbol); + links.type = strictNullChecks && symbol.flags & 536870912 /* Optional */ ? + addNullableKind(type, 32 /* Undefined */) : type; } return links.type; } @@ -16406,9 +18399,9 @@ var ts; if (!node) { return typeParameters; } - if (node.kind === 214 /* ClassDeclaration */ || node.kind === 186 /* ClassExpression */ || - node.kind === 213 /* FunctionDeclaration */ || node.kind === 173 /* FunctionExpression */ || - node.kind === 143 /* MethodDeclaration */ || node.kind === 174 /* ArrowFunction */) { + if (node.kind === 221 /* ClassDeclaration */ || node.kind === 192 /* ClassExpression */ || + node.kind === 220 /* FunctionDeclaration */ || node.kind === 179 /* FunctionExpression */ || + node.kind === 147 /* MethodDeclaration */ || node.kind === 180 /* ArrowFunction */) { var declarations = node.typeParameters; if (declarations) { return appendTypeParameters(appendOuterTypeParameters(typeParameters, node), declarations); @@ -16418,7 +18411,7 @@ var ts; } // The outer type parameters are those defined by enclosing generic classes, methods, or functions. function getOuterTypeParametersOfClassOrInterface(symbol) { - var declaration = symbol.flags & 32 /* Class */ ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 215 /* InterfaceDeclaration */); + var declaration = symbol.flags & 32 /* Class */ ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 222 /* InterfaceDeclaration */); return appendOuterTypeParameters(undefined, declaration); } // The local type parameters are the combined set of type parameters from all declarations of the class, @@ -16427,8 +18420,8 @@ var ts; var result; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var node = _a[_i]; - if (node.kind === 215 /* InterfaceDeclaration */ || node.kind === 214 /* ClassDeclaration */ || - node.kind === 186 /* ClassExpression */ || node.kind === 216 /* TypeAliasDeclaration */) { + if (node.kind === 222 /* InterfaceDeclaration */ || node.kind === 221 /* ClassDeclaration */ || + node.kind === 192 /* ClassExpression */ || node.kind === 223 /* TypeAliasDeclaration */) { var declaration = node; if (declaration.typeParameters) { result = appendTypeParameters(result, declaration.typeParameters); @@ -16455,8 +18448,8 @@ var ts; function getInstantiatedConstructorsForTypeArguments(type, typeArgumentNodes) { var signatures = getConstructorsForTypeArguments(type, typeArgumentNodes); if (typeArgumentNodes) { - var typeArguments = ts.map(typeArgumentNodes, getTypeFromTypeNode); - signatures = ts.map(signatures, function (sig) { return getSignatureInstantiation(sig, typeArguments); }); + var typeArguments_1 = ts.map(typeArgumentNodes, getTypeFromTypeNode); + signatures = ts.map(signatures, function (sig) { return getSignatureInstantiation(sig, typeArguments_1); }); } return signatures; } @@ -16492,9 +18485,6 @@ var ts; } return type.resolvedBaseConstructorType; } - function hasClassBaseType(type) { - return !!ts.forEach(getBaseTypes(type), function (t) { return !!(t.symbol.flags & 32 /* Class */); }); - } function getBaseTypes(type) { var isClass = type.symbol.flags & 32 /* Class */; var isInterface = type.symbol.flags & 64 /* Interface */; @@ -16571,7 +18561,7 @@ var ts; type.resolvedBaseTypes = type.resolvedBaseTypes || emptyArray; for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 215 /* InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) { + if (declaration.kind === 222 /* InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) { for (var _b = 0, _c = ts.getInterfaceBaseTypeNodes(declaration); _b < _c.length; _b++) { var node = _c[_b]; var baseType = getTypeFromTypeNode(node); @@ -16603,8 +18593,8 @@ var ts; function isIndependentInterface(symbol) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 215 /* InterfaceDeclaration */) { - if (declaration.flags & 262144 /* ContainsThis */) { + if (declaration.kind === 222 /* InterfaceDeclaration */) { + if (declaration.flags & 16384 /* ContainsThis */) { return false; } var baseTypeNodes = ts.getInterfaceBaseTypeNodes(declaration); @@ -16659,7 +18649,7 @@ var ts; if (!pushTypeResolution(symbol, 2 /* DeclaredType */)) { return unknownType; } - var declaration = ts.getDeclarationOfKind(symbol, 216 /* TypeAliasDeclaration */); + var declaration = ts.getDeclarationOfKind(symbol, 223 /* TypeAliasDeclaration */); var type = getTypeFromTypeNode(declaration.type); if (popTypeResolution()) { links.typeParameters = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol); @@ -16692,7 +18682,7 @@ var ts; if (!links.declaredType) { var type = createType(512 /* TypeParameter */); type.symbol = symbol; - if (!ts.getDeclarationOfKind(symbol, 137 /* TypeParameter */).constraint) { + if (!ts.getDeclarationOfKind(symbol, 141 /* TypeParameter */).constraint) { type.constraint = noConstraintType; } links.declaredType = type; @@ -16743,16 +18733,19 @@ var ts; function isIndependentType(node) { switch (node.kind) { case 117 /* AnyKeyword */: - case 130 /* StringKeyword */: - case 128 /* NumberKeyword */: + case 132 /* StringKeyword */: + case 130 /* NumberKeyword */: case 120 /* BooleanKeyword */: - case 131 /* SymbolKeyword */: + case 133 /* SymbolKeyword */: case 103 /* VoidKeyword */: - case 9 /* StringLiteral */: + case 135 /* UndefinedKeyword */: + case 93 /* NullKeyword */: + case 127 /* NeverKeyword */: + case 166 /* StringLiteralType */: return true; - case 156 /* ArrayType */: + case 160 /* ArrayType */: return isIndependentType(node.elementType); - case 151 /* TypeReference */: + case 155 /* TypeReference */: return isIndependentTypeReference(node); } return false; @@ -16765,7 +18758,7 @@ var ts; // A function-like declaration is considered independent (free of this references) if it has a return type // annotation that is considered independent and if each parameter is considered independent. function isIndependentFunctionLikeDeclaration(node) { - if (node.kind !== 144 /* Constructor */ && (!node.type || !isIndependentType(node.type))) { + if (node.kind !== 148 /* Constructor */ && (!node.type || !isIndependentType(node.type))) { return false; } for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) { @@ -16779,19 +18772,19 @@ var ts; // Returns true if the class or interface member given by the symbol is free of "this" references. The // function may return false for symbols that are actually free of "this" references because it is not // feasible to perform a complete analysis in all cases. In particular, property members with types - // inferred from their initializers and function members with inferred return types are convervatively + // inferred from their initializers and function members with inferred return types are conservatively // assumed not to be free of "this" references. function isIndependentMember(symbol) { if (symbol.declarations && symbol.declarations.length === 1) { var declaration = symbol.declarations[0]; if (declaration) { switch (declaration.kind) { - case 141 /* PropertyDeclaration */: - case 140 /* PropertySignature */: + case 145 /* PropertyDeclaration */: + case 144 /* PropertySignature */: return isIndependentVariableLikeDeclaration(declaration); - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - case 144 /* Constructor */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: + case 148 /* Constructor */: return isIndependentFunctionLikeDeclaration(declaration); } } @@ -16824,22 +18817,14 @@ var ts; } } } - function addInheritedSignatures(signatures, baseSignatures) { - if (baseSignatures) { - for (var _i = 0, baseSignatures_1 = baseSignatures; _i < baseSignatures_1.length; _i++) { - var signature = baseSignatures_1[_i]; - signatures.push(signature); - } - } - } function resolveDeclaredMembers(type) { if (!type.declaredProperties) { var symbol = type.symbol; type.declaredProperties = getNamedMembers(symbol.members); type.declaredCallSignatures = getSignaturesOfSymbol(symbol.members["__call"]); type.declaredConstructSignatures = getSignaturesOfSymbol(symbol.members["__new"]); - type.declaredStringIndexType = getIndexTypeOfSymbol(symbol, 0 /* String */); - type.declaredNumberIndexType = getIndexTypeOfSymbol(symbol, 1 /* Number */); + type.declaredStringIndexInfo = getIndexInfoOfSymbol(symbol, 0 /* String */); + type.declaredNumberIndexInfo = getIndexInfoOfSymbol(symbol, 1 /* Number */); } return type; } @@ -16854,15 +18839,15 @@ var ts; var members = source.symbol.members; var callSignatures = source.declaredCallSignatures; var constructSignatures = source.declaredConstructSignatures; - var stringIndexType = source.declaredStringIndexType; - var numberIndexType = source.declaredNumberIndexType; + var stringIndexInfo = source.declaredStringIndexInfo; + var numberIndexInfo = source.declaredNumberIndexInfo; if (!ts.rangeEquals(typeParameters, typeArguments, 0, typeParameters.length)) { mapper = createTypeMapper(typeParameters, typeArguments); members = createInstantiatedSymbolTable(source.declaredProperties, mapper, /*mappingThisOnly*/ typeParameters.length === 1); callSignatures = instantiateList(source.declaredCallSignatures, mapper, instantiateSignature); constructSignatures = instantiateList(source.declaredConstructSignatures, mapper, instantiateSignature); - stringIndexType = instantiateType(source.declaredStringIndexType, mapper); - numberIndexType = instantiateType(source.declaredNumberIndexType, mapper); + stringIndexInfo = instantiateIndexInfo(source.declaredStringIndexInfo, mapper); + numberIndexInfo = instantiateIndexInfo(source.declaredNumberIndexInfo, mapper); } var baseTypes = getBaseTypes(source); if (baseTypes.length) { @@ -16876,11 +18861,11 @@ var ts; addInheritedMembers(members, getPropertiesOfObjectType(instantiatedBaseType)); callSignatures = ts.concatenate(callSignatures, getSignaturesOfType(instantiatedBaseType, 0 /* Call */)); constructSignatures = ts.concatenate(constructSignatures, getSignaturesOfType(instantiatedBaseType, 1 /* Construct */)); - stringIndexType = stringIndexType || getIndexTypeOfType(instantiatedBaseType, 0 /* String */); - numberIndexType = numberIndexType || getIndexTypeOfType(instantiatedBaseType, 1 /* Number */); + stringIndexInfo = stringIndexInfo || getIndexInfoOfType(instantiatedBaseType, 0 /* String */); + numberIndexInfo = numberIndexInfo || getIndexInfoOfType(instantiatedBaseType, 1 /* Number */); } } - setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexType, numberIndexType); + setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo); } function resolveClassOrInterfaceMembers(type) { resolveObjectTypeMembers(type, resolveDeclaredMembers(type), emptyArray, emptyArray); @@ -16892,11 +18877,12 @@ var ts; type.typeArguments : ts.concatenate(type.typeArguments, [type]); resolveObjectTypeMembers(type, source, typeParameters, typeArguments); } - function createSignature(declaration, typeParameters, parameters, resolvedReturnType, typePredicate, minArgumentCount, hasRestParameter, hasStringLiterals) { + function createSignature(declaration, typeParameters, thisType, parameters, resolvedReturnType, typePredicate, minArgumentCount, hasRestParameter, hasStringLiterals) { var sig = new Signature(checker); sig.declaration = declaration; sig.typeParameters = typeParameters; sig.parameters = parameters; + sig.thisType = thisType; sig.resolvedReturnType = resolvedReturnType; sig.typePredicate = typePredicate; sig.minArgumentCount = minArgumentCount; @@ -16905,20 +18891,20 @@ var ts; return sig; } function cloneSignature(sig) { - return createSignature(sig.declaration, sig.typeParameters, sig.parameters, sig.resolvedReturnType, sig.typePredicate, sig.minArgumentCount, sig.hasRestParameter, sig.hasStringLiterals); + return createSignature(sig.declaration, sig.typeParameters, sig.thisType, sig.parameters, sig.resolvedReturnType, sig.typePredicate, sig.minArgumentCount, sig.hasRestParameter, sig.hasStringLiterals); } function getDefaultConstructSignatures(classType) { - if (!hasClassBaseType(classType)) { - return [createSignature(undefined, classType.localTypeParameters, emptyArray, classType, undefined, 0, false, false)]; - } var baseConstructorType = getBaseConstructorTypeOfClass(classType); var baseSignatures = getSignaturesOfType(baseConstructorType, 1 /* Construct */); + if (baseSignatures.length === 0) { + return [createSignature(undefined, classType.localTypeParameters, undefined, emptyArray, classType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasStringLiterals*/ false)]; + } var baseTypeNode = getBaseTypeNodeOfClass(classType); var typeArguments = ts.map(baseTypeNode.typeArguments, getTypeFromTypeNode); var typeArgCount = typeArguments ? typeArguments.length : 0; var result = []; - for (var _i = 0, baseSignatures_2 = baseSignatures; _i < baseSignatures_2.length; _i++) { - var baseSig = baseSignatures_2[_i]; + for (var _i = 0, baseSignatures_1 = baseSignatures; _i < baseSignatures_1.length; _i++) { + var baseSig = baseSignatures_1[_i]; var typeParamCount = baseSig.typeParameters ? baseSig.typeParameters.length : 0; if (typeParamCount === typeArgCount) { var sig = typeParamCount ? getSignatureInstantiation(baseSig, typeArguments) : cloneSignature(baseSig); @@ -16944,12 +18930,12 @@ var ts; var arrayType = resolveStructuredTypeMembers(createTypeFromGenericGlobalType(globalArrayType, [arrayElementType, type])); var members = createTupleTypeMemberSymbols(type.elementTypes); addInheritedMembers(members, arrayType.properties); - setObjectTypeMembers(type, members, arrayType.callSignatures, arrayType.constructSignatures, arrayType.stringIndexType, arrayType.numberIndexType); + setObjectTypeMembers(type, members, arrayType.callSignatures, arrayType.constructSignatures, arrayType.stringIndexInfo, arrayType.numberIndexInfo); } - function findMatchingSignature(signatureList, signature, partialMatch, ignoreReturnTypes) { + function findMatchingSignature(signatureList, signature, partialMatch, ignoreThisTypes, ignoreReturnTypes) { for (var _i = 0, signatureList_1 = signatureList; _i < signatureList_1.length; _i++) { var s = signatureList_1[_i]; - if (compareSignatures(s, signature, partialMatch, ignoreReturnTypes, compareTypes)) { + if (compareSignaturesIdentical(s, signature, partialMatch, ignoreThisTypes, ignoreReturnTypes, compareTypesIdentical)) { return s; } } @@ -16962,7 +18948,7 @@ var ts; return undefined; } for (var i = 1; i < signatureLists.length; i++) { - if (!findMatchingSignature(signatureLists[i], signature, /*partialMatch*/ false, /*ignoreReturnTypes*/ false)) { + if (!findMatchingSignature(signatureLists[i], signature, /*partialMatch*/ false, /*ignoreThisTypes*/ false, /*ignoreReturnTypes*/ false)) { return undefined; } } @@ -16971,7 +18957,7 @@ var ts; var result = undefined; for (var i = 0; i < signatureLists.length; i++) { // Allow matching non-generic signatures to have excess parameters and different return types - var match = i === listIndex ? signature : findMatchingSignature(signatureLists[i], signature, /*partialMatch*/ true, /*ignoreReturnTypes*/ true); + var match = i === listIndex ? signature : findMatchingSignature(signatureLists[i], signature, /*partialMatch*/ true, /*ignoreThisTypes*/ true, /*ignoreReturnTypes*/ true); if (!match) { return undefined; } @@ -16992,13 +18978,16 @@ var ts; for (var _i = 0, _a = signatureLists[i]; _i < _a.length; _i++) { var signature = _a[_i]; // Only process signatures with parameter lists that aren't already in the result list - if (!result || !findMatchingSignature(result, signature, /*partialMatch*/ false, /*ignoreReturnTypes*/ true)) { + if (!result || !findMatchingSignature(result, signature, /*partialMatch*/ false, /*ignoreThisTypes*/ true, /*ignoreReturnTypes*/ true)) { var unionSignatures = findMatchingSignatures(signatureLists, signature, i); if (unionSignatures) { var s = signature; // Union the result types when more than one signature matches if (unionSignatures.length > 1) { s = cloneSignature(signature); + if (ts.forEach(unionSignatures, function (sig) { return sig.thisType; })) { + s.thisType = getUnionType(ts.map(unionSignatures, function (sig) { return sig.thisType || anyType; })); + } // Clear resolved return type we possibly got from cloneSignature s.resolvedReturnType = undefined; s.unionSignatures = unionSignatures; @@ -17010,78 +18999,76 @@ var ts; } return result || emptyArray; } - function getUnionIndexType(types, kind) { + function getUnionIndexInfo(types, kind) { var indexTypes = []; + var isAnyReadonly = false; for (var _i = 0, types_1 = types; _i < types_1.length; _i++) { var type = types_1[_i]; - var indexType = getIndexTypeOfType(type, kind); - if (!indexType) { + var indexInfo = getIndexInfoOfType(type, kind); + if (!indexInfo) { return undefined; } - indexTypes.push(indexType); + indexTypes.push(indexInfo.type); + isAnyReadonly = isAnyReadonly || indexInfo.isReadonly; } - return getUnionType(indexTypes); + return createIndexInfo(getUnionType(indexTypes), isAnyReadonly); } function resolveUnionTypeMembers(type) { // The members and properties collections are empty for union types. To get all properties of a union // type use getPropertiesOfType (only the language service uses this). var callSignatures = getUnionSignatures(type.types, 0 /* Call */); var constructSignatures = getUnionSignatures(type.types, 1 /* Construct */); - var stringIndexType = getUnionIndexType(type.types, 0 /* String */); - var numberIndexType = getUnionIndexType(type.types, 1 /* Number */); - setObjectTypeMembers(type, emptySymbols, callSignatures, constructSignatures, stringIndexType, numberIndexType); + var stringIndexInfo = getUnionIndexInfo(type.types, 0 /* String */); + var numberIndexInfo = getUnionIndexInfo(type.types, 1 /* Number */); + setObjectTypeMembers(type, emptySymbols, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo); } function intersectTypes(type1, type2) { return !type1 ? type2 : !type2 ? type1 : getIntersectionType([type1, type2]); } + function intersectIndexInfos(info1, info2) { + return !info1 ? info2 : !info2 ? info1 : createIndexInfo(getIntersectionType([info1.type, info2.type]), info1.isReadonly && info2.isReadonly); + } function resolveIntersectionTypeMembers(type) { // The members and properties collections are empty for intersection types. To get all properties of an // intersection type use getPropertiesOfType (only the language service uses this). var callSignatures = emptyArray; var constructSignatures = emptyArray; - var stringIndexType = undefined; - var numberIndexType = undefined; + var stringIndexInfo = undefined; + var numberIndexInfo = undefined; for (var _i = 0, _a = type.types; _i < _a.length; _i++) { var t = _a[_i]; callSignatures = ts.concatenate(callSignatures, getSignaturesOfType(t, 0 /* Call */)); constructSignatures = ts.concatenate(constructSignatures, getSignaturesOfType(t, 1 /* Construct */)); - stringIndexType = intersectTypes(stringIndexType, getIndexTypeOfType(t, 0 /* String */)); - numberIndexType = intersectTypes(numberIndexType, getIndexTypeOfType(t, 1 /* Number */)); + stringIndexInfo = intersectIndexInfos(stringIndexInfo, getIndexInfoOfType(t, 0 /* String */)); + numberIndexInfo = intersectIndexInfos(numberIndexInfo, getIndexInfoOfType(t, 1 /* Number */)); } - setObjectTypeMembers(type, emptySymbols, callSignatures, constructSignatures, stringIndexType, numberIndexType); + setObjectTypeMembers(type, emptySymbols, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo); } function resolveAnonymousTypeMembers(type) { var symbol = type.symbol; - var members; - var callSignatures; - var constructSignatures; - var stringIndexType; - var numberIndexType; if (type.target) { - members = createInstantiatedSymbolTable(getPropertiesOfObjectType(type.target), type.mapper, /*mappingThisOnly*/ false); - callSignatures = instantiateList(getSignaturesOfType(type.target, 0 /* Call */), type.mapper, instantiateSignature); - constructSignatures = instantiateList(getSignaturesOfType(type.target, 1 /* Construct */), type.mapper, instantiateSignature); - stringIndexType = instantiateType(getIndexTypeOfType(type.target, 0 /* String */), type.mapper); - numberIndexType = instantiateType(getIndexTypeOfType(type.target, 1 /* Number */), type.mapper); + var members = createInstantiatedSymbolTable(getPropertiesOfObjectType(type.target), type.mapper, /*mappingThisOnly*/ false); + var callSignatures = instantiateList(getSignaturesOfType(type.target, 0 /* Call */), type.mapper, instantiateSignature); + var constructSignatures = instantiateList(getSignaturesOfType(type.target, 1 /* Construct */), type.mapper, instantiateSignature); + var stringIndexInfo = instantiateIndexInfo(getIndexInfoOfType(type.target, 0 /* String */), type.mapper); + var numberIndexInfo = instantiateIndexInfo(getIndexInfoOfType(type.target, 1 /* Number */), type.mapper); + setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo); } else if (symbol.flags & 2048 /* TypeLiteral */) { - members = symbol.members; - callSignatures = getSignaturesOfSymbol(members["__call"]); - constructSignatures = getSignaturesOfSymbol(members["__new"]); - stringIndexType = getIndexTypeOfSymbol(symbol, 0 /* String */); - numberIndexType = getIndexTypeOfSymbol(symbol, 1 /* Number */); + var members = symbol.members; + var callSignatures = getSignaturesOfSymbol(members["__call"]); + var constructSignatures = getSignaturesOfSymbol(members["__new"]); + var stringIndexInfo = getIndexInfoOfSymbol(symbol, 0 /* String */); + var numberIndexInfo = getIndexInfoOfSymbol(symbol, 1 /* Number */); + setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo); } else { // Combinations of function, class, enum and module - members = emptySymbols; - callSignatures = emptyArray; - constructSignatures = emptyArray; + var members = emptySymbols; + var constructSignatures = emptyArray; if (symbol.flags & 1952 /* HasExports */) { members = getExportsOfSymbol(symbol); } - if (symbol.flags & (16 /* Function */ | 8192 /* Method */)) { - callSignatures = getSignaturesOfSymbol(symbol); - } if (symbol.flags & 32 /* Class */) { var classType = getDeclaredTypeOfClassOrInterface(symbol); constructSignatures = getSignaturesOfSymbol(symbol.members["__constructor"]); @@ -17094,10 +19081,16 @@ var ts; addInheritedMembers(members, getPropertiesOfObjectType(baseConstructorType)); } } - stringIndexType = undefined; - numberIndexType = (symbol.flags & 384 /* Enum */) ? stringType : undefined; + var numberIndexInfo = symbol.flags & 384 /* Enum */ ? enumNumberIndexInfo : undefined; + setObjectTypeMembers(type, members, emptyArray, constructSignatures, undefined, numberIndexInfo); + // We resolve the members before computing the signatures because a signature may use + // typeof with a qualified name expression that circularly references the type we are + // in the process of resolving (see issue #6072). The temporarily empty signature list + // will never be observed because a qualified name can't reference signatures. + if (symbol.flags & (16 /* Function */ | 8192 /* Method */)) { + type.callSignatures = getSignaturesOfSymbol(symbol); + } } - setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexType, numberIndexType); } function resolveStructuredTypeMembers(type) { if (!type.members) { @@ -17122,15 +19115,15 @@ var ts; } return type; } - // Return properties of an object type or an empty array for other types + /** Return properties of an object type or an empty array for other types */ function getPropertiesOfObjectType(type) { if (type.flags & 80896 /* ObjectType */) { return resolveStructuredTypeMembers(type).properties; } return emptyArray; } - // If the given type is an object type and that type has a property by the given name, - // return the symbol for that property.Otherwise return undefined. + /** If the given type is an object type and that type has a property by the given name, + * return the symbol for that property. Otherwise return undefined. */ function getPropertyOfObjectType(type, name) { if (type.flags & 80896 /* ObjectType */) { var resolved = resolveStructuredTypeMembers(type); @@ -17194,19 +19187,22 @@ var ts; type = globalBooleanType; } else if (type.flags & 16777216 /* ESSymbol */) { - type = globalESSymbolType; + type = getGlobalESSymbolType(); } return type; } function createUnionOrIntersectionProperty(containingType, name) { var types = containingType.types; var props; + // Flags we want to propagate to the result if they exist in all source symbols + var commonFlags = (containingType.flags & 32768 /* Intersection */) ? 536870912 /* Optional */ : 0 /* None */; for (var _i = 0, types_2 = types; _i < types_2.length; _i++) { var current = types_2[_i]; var type = getApparentType(current); if (type !== unknownType) { var prop = getPropertyOfType(type, name); - if (prop && !(getDeclarationFlagsFromSymbol(prop) & (16 /* Private */ | 32 /* Protected */))) { + if (prop && !(getDeclarationFlagsFromSymbol(prop) & (8 /* Private */ | 16 /* Protected */))) { + commonFlags &= prop.flags; if (!props) { props = [prop]; } @@ -17235,7 +19231,10 @@ var ts; } propTypes.push(getTypeOfSymbol(prop)); } - var result = createSymbol(4 /* Property */ | 67108864 /* Transient */ | 268435456 /* SyntheticProperty */, name); + var result = createSymbol(4 /* Property */ | + 67108864 /* Transient */ | + 268435456 /* SyntheticProperty */ | + commonFlags, name); result.containingType = containingType; result.declarations = declarations; result.type = containingType.flags & 16384 /* Union */ ? getUnionType(propTypes) : getIntersectionType(propTypes); @@ -17292,33 +19291,50 @@ var ts; function getSignaturesOfType(type, kind) { return getSignaturesOfStructuredType(getApparentType(type), kind); } - function typeHasConstructSignatures(type) { - var apparentType = getApparentType(type); - if (apparentType.flags & (80896 /* ObjectType */ | 16384 /* Union */)) { - var resolved = resolveStructuredTypeMembers(type); - return resolved.constructSignatures.length > 0; - } - return false; - } - function typeHasCallOrConstructSignatures(type) { - var apparentType = getApparentType(type); - if (apparentType.flags & 130048 /* StructuredType */) { - var resolved = resolveStructuredTypeMembers(type); - return resolved.callSignatures.length > 0 || resolved.constructSignatures.length > 0; - } - return false; - } - function getIndexTypeOfStructuredType(type, kind) { + function getIndexInfoOfStructuredType(type, kind) { if (type.flags & 130048 /* StructuredType */) { var resolved = resolveStructuredTypeMembers(type); - return kind === 0 /* String */ ? resolved.stringIndexType : resolved.numberIndexType; + return kind === 0 /* String */ ? resolved.stringIndexInfo : resolved.numberIndexInfo; } } + function getIndexTypeOfStructuredType(type, kind) { + var info = getIndexInfoOfStructuredType(type, kind); + return info && info.type; + } + // Return the indexing info of the given kind in the given type. Creates synthetic union index types when necessary and + // maps primitive types and type parameters are to their apparent types. + function getIndexInfoOfType(type, kind) { + return getIndexInfoOfStructuredType(getApparentType(type), kind); + } // Return the index type of the given kind in the given type. Creates synthetic union index types when necessary and // maps primitive types and type parameters are to their apparent types. function getIndexTypeOfType(type, kind) { return getIndexTypeOfStructuredType(getApparentType(type), kind); } + function getImplicitIndexTypeOfType(type, kind) { + if (isObjectLiteralType(type)) { + var propTypes = []; + for (var _i = 0, _a = getPropertiesOfType(type); _i < _a.length; _i++) { + var prop = _a[_i]; + if (kind === 0 /* String */ || isNumericLiteralName(prop.name)) { + propTypes.push(getTypeOfSymbol(prop)); + } + } + if (propTypes.length) { + return getUnionType(propTypes); + } + } + return undefined; + } + function getTypeParametersFromJSDocTemplate(declaration) { + if (declaration.flags & 134217728 /* JavaScriptFile */) { + var templateTag = ts.getJSDocTemplateTag(declaration); + if (templateTag) { + return getTypeParametersFromDeclaration(templateTag.typeParameters); + } + } + return undefined; + } // Return list of type parameters with duplicates removed (duplicate identifier errors are generated in the actual // type checking functions). function getTypeParametersFromDeclaration(typeParameterDeclarations) { @@ -17341,6 +19357,20 @@ var ts; return result; } function isOptionalParameter(node) { + if (node.flags & 134217728 /* JavaScriptFile */) { + if (node.type && node.type.kind === 268 /* JSDocOptionalType */) { + return true; + } + var paramTag = ts.getCorrespondingJSDocParameterTag(node); + if (paramTag) { + if (paramTag.isBracketed) { + return true; + } + if (paramTag.typeExpression) { + return paramTag.typeExpression.type.kind === 268 /* JSDocOptionalType */; + } + } + } if (ts.hasQuestionToken(node)) { return true; } @@ -17353,26 +19383,56 @@ var ts; } return false; } + function createTypePredicateFromTypePredicateNode(node) { + if (node.parameterName.kind === 69 /* Identifier */) { + var parameterName = node.parameterName; + return { + kind: 1 /* Identifier */, + parameterName: parameterName ? parameterName.text : undefined, + parameterIndex: parameterName ? getTypePredicateParameterIndex(node.parent.parameters, parameterName) : undefined, + type: getTypeFromTypeNode(node.type) + }; + } + else { + return { + kind: 0 /* This */, + type: getTypeFromTypeNode(node.type) + }; + } + } function getSignatureFromDeclaration(declaration) { var links = getNodeLinks(declaration); if (!links.resolvedSignature) { - var classType = declaration.kind === 144 /* Constructor */ ? - getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol)) - : undefined; - var typeParameters = classType ? classType.localTypeParameters : - declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : undefined; var parameters = []; var hasStringLiterals = false; var minArgumentCount = -1; - for (var i = 0, n = declaration.parameters.length; i < n; i++) { + var thisType = undefined; + var hasThisParameter = void 0; + var isJSConstructSignature = ts.isJSDocConstructSignature(declaration); + // If this is a JSDoc construct signature, then skip the first parameter in the + // parameter list. The first parameter represents the return type of the construct + // signature. + for (var i = isJSConstructSignature ? 1 : 0, n = declaration.parameters.length; i < n; i++) { var param = declaration.parameters[i]; - parameters.push(param.symbol); - if (param.type && param.type.kind === 9 /* StringLiteral */) { + var paramSymbol = param.symbol; + // Include parameter symbol instead of property symbol in the signature + if (paramSymbol && !!(paramSymbol.flags & 4 /* Property */) && !ts.isBindingPattern(param.name)) { + var resolvedSymbol = resolveName(param, paramSymbol.name, 107455 /* Value */, undefined, undefined); + paramSymbol = resolvedSymbol; + } + if (i === 0 && paramSymbol.name === "this") { + hasThisParameter = true; + thisType = param.type ? getTypeFromTypeNode(param.type) : unknownType; + } + else { + parameters.push(paramSymbol); + } + if (param.type && param.type.kind === 166 /* StringLiteralType */) { hasStringLiterals = true; } if (param.initializer || param.questionToken || param.dotDotDotToken) { if (minArgumentCount < 0) { - minArgumentCount = i; + minArgumentCount = i - (hasThisParameter ? 1 : 0); } } else { @@ -17380,40 +19440,60 @@ var ts; minArgumentCount = -1; } } + // If only one accessor includes a this-type annotation, the other behaves as if it had the same type annotation + if ((declaration.kind === 149 /* GetAccessor */ || declaration.kind === 150 /* SetAccessor */) && + !ts.hasDynamicName(declaration) && + (!hasThisParameter || thisType === unknownType)) { + var otherKind = declaration.kind === 149 /* GetAccessor */ ? 150 /* SetAccessor */ : 149 /* GetAccessor */; + var setter = ts.getDeclarationOfKind(declaration.symbol, otherKind); + thisType = getAnnotatedAccessorThisType(setter); + } if (minArgumentCount < 0) { - minArgumentCount = declaration.parameters.length; + minArgumentCount = declaration.parameters.length - (hasThisParameter ? 1 : 0); } - var returnType; - var typePredicate; - if (classType) { - returnType = classType; + if (isJSConstructSignature) { + minArgumentCount--; } - else if (declaration.type) { - returnType = getTypeFromTypeNode(declaration.type); - if (declaration.type.kind === 150 /* TypePredicate */) { - var typePredicateNode = declaration.type; - typePredicate = { - parameterName: typePredicateNode.parameterName ? typePredicateNode.parameterName.text : undefined, - parameterIndex: typePredicateNode.parameterName ? getTypePredicateParameterIndex(declaration.parameters, typePredicateNode.parameterName) : undefined, - type: getTypeFromTypeNode(typePredicateNode.type) - }; - } - } - else { - // TypeScript 1.0 spec (April 2014): - // If only one accessor includes a type annotation, the other behaves as if it had the same type annotation. - if (declaration.kind === 145 /* GetAccessor */ && !ts.hasDynamicName(declaration)) { - var setter = ts.getDeclarationOfKind(declaration.symbol, 146 /* SetAccessor */); - returnType = getAnnotatedAccessorType(setter); - } - if (!returnType && ts.nodeIsMissing(declaration.body)) { - returnType = anyType; - } - } - links.resolvedSignature = createSignature(declaration, typeParameters, parameters, returnType, typePredicate, minArgumentCount, ts.hasRestParameter(declaration), hasStringLiterals); + var classType = declaration.kind === 148 /* Constructor */ ? + getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol)) + : undefined; + var typeParameters = classType ? classType.localTypeParameters : + declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : + getTypeParametersFromJSDocTemplate(declaration); + var returnType = getSignatureReturnTypeFromDeclaration(declaration, minArgumentCount, isJSConstructSignature, classType); + var typePredicate = declaration.type && declaration.type.kind === 154 /* TypePredicate */ ? + createTypePredicateFromTypePredicateNode(declaration.type) : + undefined; + links.resolvedSignature = createSignature(declaration, typeParameters, thisType, parameters, returnType, typePredicate, minArgumentCount, ts.hasRestParameter(declaration), hasStringLiterals); } return links.resolvedSignature; } + function getSignatureReturnTypeFromDeclaration(declaration, minArgumentCount, isJSConstructSignature, classType) { + if (isJSConstructSignature) { + return getTypeFromTypeNode(declaration.parameters[0].type); + } + else if (classType) { + return classType; + } + else if (declaration.type) { + return getTypeFromTypeNode(declaration.type); + } + if (declaration.flags & 134217728 /* JavaScriptFile */) { + var type = getReturnTypeFromJSDocComment(declaration); + if (type && type !== unknownType) { + return type; + } + } + // TypeScript 1.0 spec (April 2014): + // If only one accessor includes a type annotation, the other behaves as if it had the same type annotation. + if (declaration.kind === 149 /* GetAccessor */ && !ts.hasDynamicName(declaration)) { + var setter = ts.getDeclarationOfKind(declaration.symbol, 150 /* SetAccessor */); + return getAnnotatedAccessorType(setter); + } + if (ts.nodeIsMissing(declaration.body)) { + return anyType; + } + } function getSignaturesOfSymbol(symbol) { if (!symbol) return emptyArray; @@ -17421,19 +19501,20 @@ var ts; for (var i = 0, len = symbol.declarations.length; i < len; i++) { var node = symbol.declarations[i]; switch (node.kind) { - case 152 /* FunctionType */: - case 153 /* ConstructorType */: - case 213 /* FunctionDeclaration */: - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - case 144 /* Constructor */: - case 147 /* CallSignature */: - case 148 /* ConstructSignature */: - case 149 /* IndexSignature */: - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: - case 173 /* FunctionExpression */: - case 174 /* ArrowFunction */: + case 156 /* FunctionType */: + case 157 /* ConstructorType */: + case 220 /* FunctionDeclaration */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: + case 148 /* Constructor */: + case 151 /* CallSignature */: + case 152 /* ConstructSignature */: + case 153 /* IndexSignature */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: + case 179 /* FunctionExpression */: + case 180 /* ArrowFunction */: + case 269 /* JSDocFunctionType */: // Don't include signature if node is the implementation of an overloaded function. A node is considered // an implementation node if it has a body and the previous node is of the same kind and immediately // precedes the implementation node (i.e. has the same parent and ends where the implementation starts). @@ -17463,7 +19544,7 @@ var ts; if (!pushTypeResolution(signature, 3 /* ResolvedReturnType */)) { return unknownType; } - var type; + var type = void 0; if (signature.target) { type = instantiateType(getReturnTypeOfSignature(signature.target), signature.mapper); } @@ -17499,18 +19580,13 @@ var ts; return anyType; } function getSignatureInstantiation(signature, typeArguments) { - return instantiateSignature(signature, createTypeMapper(signature.typeParameters, typeArguments), true); + return instantiateSignature(signature, createTypeMapper(signature.typeParameters, typeArguments), /*eraseTypeParameters*/ true); } function getErasedSignature(signature) { if (!signature.typeParameters) return signature; if (!signature.erasedSignatureCache) { - if (signature.target) { - signature.erasedSignatureCache = instantiateSignature(getErasedSignature(signature.target), signature.mapper); - } - else { - signature.erasedSignatureCache = instantiateSignature(signature, createTypeEraser(signature.typeParameters), true); - } + signature.erasedSignatureCache = instantiateSignature(signature, createTypeEraser(signature.typeParameters), /*eraseTypeParameters*/ true); } return signature.erasedSignatureCache; } @@ -17520,7 +19596,7 @@ var ts; // object type literal or interface (using the new keyword). Each way of declaring a constructor // will result in a different declaration kind. if (!signature.isolatedSignatureType) { - var isConstructor = signature.declaration.kind === 144 /* Constructor */ || signature.declaration.kind === 148 /* ConstructSignature */; + var isConstructor = signature.declaration.kind === 148 /* Constructor */ || signature.declaration.kind === 152 /* ConstructSignature */; var type = createObjectType(65536 /* Anonymous */ | 262144 /* FromSignature */); type.members = emptySymbols; type.properties = emptyArray; @@ -17534,7 +19610,7 @@ var ts; return symbol.members["__index"]; } function getIndexDeclarationOfSymbol(symbol, kind) { - var syntaxKind = kind === 1 /* Number */ ? 128 /* NumberKeyword */ : 130 /* StringKeyword */; + var syntaxKind = kind === 1 /* Number */ ? 130 /* NumberKeyword */ : 132 /* StringKeyword */; var indexSymbol = getIndexSymbol(symbol); if (indexSymbol) { for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { @@ -17550,26 +19626,51 @@ var ts; } return undefined; } - function getIndexTypeOfSymbol(symbol, kind) { - var declaration = getIndexDeclarationOfSymbol(symbol, kind); - return declaration - ? declaration.type ? getTypeFromTypeNode(declaration.type) : anyType - : undefined; + function createIndexInfo(type, isReadonly, declaration) { + return { type: type, isReadonly: isReadonly, declaration: declaration }; } - function getConstraintOfTypeParameter(type) { - if (!type.constraint) { - if (type.target) { - var targetConstraint = getConstraintOfTypeParameter(type.target); - type.constraint = targetConstraint ? instantiateType(targetConstraint, type.mapper) : noConstraintType; + function getIndexInfoOfSymbol(symbol, kind) { + var declaration = getIndexDeclarationOfSymbol(symbol, kind); + if (declaration) { + return createIndexInfo(declaration.type ? getTypeFromTypeNode(declaration.type) : anyType, (declaration.flags & 64 /* Readonly */) !== 0, declaration); + } + return undefined; + } + function getConstraintDeclaration(type) { + return ts.getDeclarationOfKind(type.symbol, 141 /* TypeParameter */).constraint; + } + function hasConstraintReferenceTo(type, target) { + var checked; + while (type && !(type.flags & 33554432 /* ThisType */) && type.flags & 512 /* TypeParameter */ && !ts.contains(checked, type)) { + if (type === target) { + return true; + } + (checked || (checked = [])).push(type); + var constraintDeclaration = getConstraintDeclaration(type); + type = constraintDeclaration && getTypeFromTypeNode(constraintDeclaration); + } + return false; + } + function getConstraintOfTypeParameter(typeParameter) { + if (!typeParameter.constraint) { + if (typeParameter.target) { + var targetConstraint = getConstraintOfTypeParameter(typeParameter.target); + typeParameter.constraint = targetConstraint ? instantiateType(targetConstraint, typeParameter.mapper) : noConstraintType; } else { - type.constraint = getTypeFromTypeNode(ts.getDeclarationOfKind(type.symbol, 137 /* TypeParameter */).constraint); + var constraintDeclaration = getConstraintDeclaration(typeParameter); + var constraint = getTypeFromTypeNode(constraintDeclaration); + if (hasConstraintReferenceTo(constraint, typeParameter)) { + error(constraintDeclaration, ts.Diagnostics.Type_parameter_0_has_a_circular_constraint, typeToString(typeParameter)); + constraint = unknownType; + } + typeParameter.constraint = constraint; } } - return type.constraint === noConstraintType ? undefined : type.constraint; + return typeParameter.constraint === noConstraintType ? undefined : typeParameter.constraint; } function getParentSymbolOfTypeParameter(typeParameter) { - return getSymbolOfNode(ts.getDeclarationOfKind(typeParameter.symbol, 137 /* TypeParameter */).parent); + return getSymbolOfNode(ts.getDeclarationOfKind(typeParameter.symbol, 141 /* TypeParameter */).parent); } function getTypeListId(types) { if (types) { @@ -17595,11 +19696,13 @@ var ts; // It is only necessary to do so if a constituent type might be the undefined type, the null type, the type // of an object literal or the anyFunctionType. This is because there are operations in the type checker // that care about the presence of such types at arbitrary depth in a containing type. - function getPropagatingFlagsOfTypes(types) { + function getPropagatingFlagsOfTypes(types, excludeKinds) { var result = 0; for (var _i = 0, types_3 = types; _i < types_3.length; _i++) { var type = types_3[_i]; - result |= type.flags; + if (!(type.flags & excludeKinds)) { + result |= type.flags; + } } return result & 14680064 /* PropagatingFlags */; } @@ -17607,60 +19710,17 @@ var ts; var id = getTypeListId(typeArguments); var type = target.instantiations[id]; if (!type) { - var flags = 4096 /* Reference */ | (typeArguments ? getPropagatingFlagsOfTypes(typeArguments) : 0); + var propagatedFlags = typeArguments ? getPropagatingFlagsOfTypes(typeArguments, /*excludeKinds*/ 0) : 0; + var flags = 4096 /* Reference */ | propagatedFlags; type = target.instantiations[id] = createObjectType(flags, target.symbol); type.target = target; type.typeArguments = typeArguments; } return type; } - function isTypeParameterReferenceIllegalInConstraint(typeReferenceNode, typeParameterSymbol) { - var links = getNodeLinks(typeReferenceNode); - if (links.isIllegalTypeReferenceInConstraint !== undefined) { - return links.isIllegalTypeReferenceInConstraint; - } - // bubble up to the declaration - var currentNode = typeReferenceNode; - // forEach === exists - while (!ts.forEach(typeParameterSymbol.declarations, function (d) { return d.parent === currentNode.parent; })) { - currentNode = currentNode.parent; - } - // if last step was made from the type parameter this means that path has started somewhere in constraint which is illegal - links.isIllegalTypeReferenceInConstraint = currentNode.kind === 137 /* TypeParameter */; - return links.isIllegalTypeReferenceInConstraint; - } - function checkTypeParameterHasIllegalReferencesInConstraint(typeParameter) { - var typeParameterSymbol; - function check(n) { - if (n.kind === 151 /* TypeReference */ && n.typeName.kind === 69 /* Identifier */) { - var links = getNodeLinks(n); - if (links.isIllegalTypeReferenceInConstraint === undefined) { - var symbol = resolveName(typeParameter, n.typeName.text, 793056 /* Type */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined); - if (symbol && (symbol.flags & 262144 /* TypeParameter */)) { - // TypeScript 1.0 spec (April 2014): 3.4.1 - // Type parameters declared in a particular type parameter list - // may not be referenced in constraints in that type parameter list - // symbol.declaration.parent === typeParameter.parent - // -> typeParameter and symbol.declaration originate from the same type parameter list - // -> illegal for all declarations in symbol - // forEach === exists - links.isIllegalTypeReferenceInConstraint = ts.forEach(symbol.declarations, function (d) { return d.parent === typeParameter.parent; }); - } - } - if (links.isIllegalTypeReferenceInConstraint) { - error(typeParameter, ts.Diagnostics.Constraint_of_a_type_parameter_cannot_reference_any_type_parameter_from_the_same_type_parameter_list); - } - } - ts.forEachChild(n, check); - } - if (typeParameter.constraint) { - typeParameterSymbol = getSymbolOfNode(typeParameter); - check(typeParameter.constraint); - } - } // Get type from reference to class or interface function getTypeFromClassOrInterfaceReference(node, symbol) { - var type = getDeclaredTypeOfSymbol(symbol); + var type = getDeclaredTypeOfSymbol(getMergedSymbol(symbol)); var typeParameters = type.localTypeParameters; if (typeParameters) { if (!node.typeArguments || node.typeArguments.length !== typeParameters.length) { @@ -17702,31 +19762,74 @@ var ts; } // Get type from reference to named type that cannot be generic (enum or type parameter) function getTypeFromNonGenericTypeReference(node, symbol) { - if (symbol.flags & 262144 /* TypeParameter */ && isTypeParameterReferenceIllegalInConstraint(node, symbol)) { - // TypeScript 1.0 spec (April 2014): 3.4.1 - // Type parameters declared in a particular type parameter list - // may not be referenced in constraints in that type parameter list - // Implementation: such type references are resolved to 'unknown' type that usually denotes error - return unknownType; - } if (node.typeArguments) { error(node, ts.Diagnostics.Type_0_is_not_generic, symbolToString(symbol)); return unknownType; } return getDeclaredTypeOfSymbol(symbol); } + function getTypeReferenceName(node) { + switch (node.kind) { + case 155 /* TypeReference */: + return node.typeName; + case 267 /* JSDocTypeReference */: + return node.name; + case 194 /* ExpressionWithTypeArguments */: + // We only support expressions that are simple qualified names. For other + // expressions this produces undefined. + if (ts.isSupportedExpressionWithTypeArguments(node)) { + return node.expression; + } + } + return undefined; + } + function resolveTypeReferenceName(node, typeReferenceName) { + if (!typeReferenceName) { + return unknownSymbol; + } + return resolveEntityName(typeReferenceName, 793056 /* Type */) || unknownSymbol; + } + function getTypeReferenceType(node, symbol) { + if (symbol === unknownSymbol) { + return unknownType; + } + if (symbol.flags & (32 /* Class */ | 64 /* Interface */)) { + return getTypeFromClassOrInterfaceReference(node, symbol); + } + if (symbol.flags & 524288 /* TypeAlias */) { + return getTypeFromTypeAliasReference(node, symbol); + } + if (symbol.flags & 107455 /* Value */ && node.kind === 267 /* JSDocTypeReference */) { + // A JSDocTypeReference may have resolved to a value (as opposed to a type). In + // that case, the type of this reference is just the type of the value we resolved + // to. + return getTypeOfSymbol(symbol); + } + return getTypeFromNonGenericTypeReference(node, symbol); + } function getTypeFromTypeReference(node) { var links = getNodeLinks(node); if (!links.resolvedType) { - // We only support expressions that are simple qualified names. For other expressions this produces undefined. - var typeNameOrExpression = node.kind === 151 /* TypeReference */ ? node.typeName : - ts.isSupportedExpressionWithTypeArguments(node) ? node.expression : - undefined; - var symbol = typeNameOrExpression && resolveEntityName(typeNameOrExpression, 793056 /* Type */) || unknownSymbol; - var type = symbol === unknownSymbol ? unknownType : - symbol.flags & (32 /* Class */ | 64 /* Interface */) ? getTypeFromClassOrInterfaceReference(node, symbol) : - symbol.flags & 524288 /* TypeAlias */ ? getTypeFromTypeAliasReference(node, symbol) : - getTypeFromNonGenericTypeReference(node, symbol); + var symbol = void 0; + var type = void 0; + if (node.kind === 267 /* JSDocTypeReference */) { + var typeReferenceName = getTypeReferenceName(node); + symbol = resolveTypeReferenceName(node, typeReferenceName); + type = getTypeReferenceType(node, symbol); + links.resolvedSymbol = symbol; + links.resolvedType = type; + } + else { + // We only support expressions that are simple qualified names. For other expressions this produces undefined. + var typeNameOrExpression = node.kind === 155 /* TypeReference */ ? node.typeName : + ts.isSupportedExpressionWithTypeArguments(node) ? node.expression : + undefined; + symbol = typeNameOrExpression && resolveEntityName(typeNameOrExpression, 793056 /* Type */) || unknownSymbol; + type = symbol === unknownSymbol ? unknownType : + symbol.flags & (32 /* Class */ | 64 /* Interface */) ? getTypeFromClassOrInterfaceReference(node, symbol) : + symbol.flags & 524288 /* TypeAlias */ ? getTypeFromTypeAliasReference(node, symbol) : + getTypeFromNonGenericTypeReference(node, symbol); + } // Cache both the resolved symbol and the resolved type. The resolved symbol is needed in when we check the // type reference in checkTypeReferenceOrExpressionWithTypeArguments. links.resolvedSymbol = symbol; @@ -17751,9 +19854,9 @@ var ts; for (var _i = 0, declarations_3 = declarations; _i < declarations_3.length; _i++) { var declaration = declarations_3[_i]; switch (declaration.kind) { - case 214 /* ClassDeclaration */: - case 215 /* InterfaceDeclaration */: - case 217 /* EnumDeclaration */: + case 221 /* ClassDeclaration */: + case 222 /* InterfaceDeclaration */: + case 224 /* EnumDeclaration */: return declaration; } } @@ -17785,10 +19888,6 @@ var ts; if (arity === void 0) { arity = 0; } return getTypeOfGlobalSymbol(getGlobalTypeSymbol(name), arity); } - function tryGetGlobalType(name, arity) { - if (arity === void 0) { arity = 0; } - return getTypeOfGlobalSymbol(getGlobalSymbol(name, 793056 /* Type */, /*diagnostic*/ undefined), arity); - } /** * Returns a type that is inside a namespace at the global scope, e.g. * getExportedTypeFromNamespace('JSX', 'Element') returns the JSX.Element type @@ -17798,9 +19897,6 @@ var ts; var typeSymbol = namespaceSymbol && getSymbol(namespaceSymbol.exports, name, 793056 /* Type */); return typeSymbol && getDeclaredTypeOfSymbol(typeSymbol); } - function getGlobalESSymbolConstructorSymbol() { - return globalESSymbolConstructorSymbol || (globalESSymbolConstructorSymbol = getGlobalValueSymbol("Symbol")); - } /** * Creates a TypeReference for a generic `TypedPropertyDescriptor`. */ @@ -17817,10 +19913,10 @@ var ts; return genericGlobalType !== emptyGenericType ? createTypeReference(genericGlobalType, typeArguments) : emptyObjectType; } function createIterableType(elementType) { - return createTypeFromGenericGlobalType(globalIterableType, [elementType]); + return createTypeFromGenericGlobalType(getGlobalIterableType(), [elementType]); } function createIterableIteratorType(elementType) { - return createTypeFromGenericGlobalType(globalIterableIteratorType, [elementType]); + return createTypeFromGenericGlobalType(getGlobalIterableIteratorType(), [elementType]); } function createArrayType(elementType) { return createTypeFromGenericGlobalType(globalArrayType, [elementType]); @@ -17837,7 +19933,8 @@ var ts; return tupleTypes[id] || (tupleTypes[id] = createNewTupleType(elementTypes)); } function createNewTupleType(elementTypes) { - var type = createObjectType(8192 /* Tuple */ | getPropagatingFlagsOfTypes(elementTypes)); + var propagatedFlags = getPropagatingFlagsOfTypes(elementTypes, /*excludeKinds*/ 0); + var type = createObjectType(8192 /* Tuple */ | propagatedFlags); type.elementTypes = elementTypes; return type; } @@ -17852,7 +19949,15 @@ var ts; if (type.flags & typeSetKind) { addTypesToSet(typeSet, type.types, typeSetKind); } - else if (!ts.contains(typeSet, type)) { + else if (type.flags & (1 /* Any */ | 32 /* Undefined */ | 64 /* Null */)) { + if (type.flags & 1 /* Any */) + typeSet.containsAny = true; + if (type.flags & 32 /* Undefined */) + typeSet.containsUndefined = true; + if (type.flags & 64 /* Null */) + typeSet.containsNull = true; + } + else if (type !== neverType && !ts.contains(typeSet, type)) { typeSet.push(type); } } @@ -17881,24 +19986,6 @@ var ts; } } } - function containsTypeAny(types) { - for (var _i = 0, types_5 = types; _i < types_5.length; _i++) { - var type = types_5[_i]; - if (isTypeAny(type)) { - return true; - } - } - return false; - } - function removeAllButLast(types, typeToRemove) { - var i = types.length; - while (i > 0 && types.length > 1) { - i--; - if (types[i] === typeToRemove) { - types.splice(i, 1); - } - } - } // We reduce the constituent type set to only include types that aren't subtypes of other types, unless // the noSubtypeReduction flag is specified, in which case we perform a simple deduplication based on // object identity. Subtype reduction is possible only when union types are known not to circularly @@ -17908,27 +19995,38 @@ var ts; // a named type that circularly references itself. function getUnionType(types, noSubtypeReduction) { if (types.length === 0) { - return emptyObjectType; + return neverType; + } + if (types.length === 1) { + return types[0]; } var typeSet = []; addTypesToSet(typeSet, types, 16384 /* Union */); - if (containsTypeAny(typeSet)) { + if (typeSet.containsAny) { return anyType; } - if (noSubtypeReduction) { - removeAllButLast(typeSet, undefinedType); - removeAllButLast(typeSet, nullType); + if (strictNullChecks) { + if (typeSet.containsNull) + typeSet.push(nullType); + if (typeSet.containsUndefined) + typeSet.push(undefinedType); } - else { + if (!noSubtypeReduction) { removeSubtypes(typeSet); } - if (typeSet.length === 1) { + if (typeSet.length === 0) { + return typeSet.containsNull ? nullType : + typeSet.containsUndefined ? undefinedType : + neverType; + } + else if (typeSet.length === 1) { return typeSet[0]; } var id = getTypeListId(typeSet); var type = unionTypes[id]; if (!type) { - type = unionTypes[id] = createObjectType(16384 /* Union */ | getPropagatingFlagsOfTypes(typeSet)); + var propagatedFlags = getPropagatingFlagsOfTypes(typeSet, /*excludeKinds*/ 96 /* Nullable */); + type = unionTypes[id] = createObjectType(16384 /* Union */ | propagatedFlags); type.types = typeSet; } return type; @@ -17951,16 +20049,23 @@ var ts; } var typeSet = []; addTypesToSet(typeSet, types, 32768 /* Intersection */); - if (containsTypeAny(typeSet)) { + if (typeSet.containsAny) { return anyType; } + if (strictNullChecks) { + if (typeSet.containsNull) + typeSet.push(nullType); + if (typeSet.containsUndefined) + typeSet.push(undefinedType); + } if (typeSet.length === 1) { return typeSet[0]; } var id = getTypeListId(typeSet); var type = intersectionTypes[id]; if (!type) { - type = intersectionTypes[id] = createObjectType(32768 /* Intersection */ | getPropagatingFlagsOfTypes(typeSet)); + var propagatedFlags = getPropagatingFlagsOfTypes(typeSet, /*excludeKinds*/ 96 /* Nullable */); + type = intersectionTypes[id] = createObjectType(32768 /* Intersection */ | propagatedFlags); type.types = typeSet; } return type; @@ -17980,8 +20085,7 @@ var ts; } return links.resolvedType; } - function getStringLiteralType(node) { - var text = node.text; + function getStringLiteralTypeForText(text) { if (ts.hasProperty(stringLiteralTypes, text)) { return stringLiteralTypes[text]; } @@ -17989,19 +20093,35 @@ var ts; type.text = text; return type; } - function getTypeFromStringLiteral(node) { + function getTypeFromStringLiteralTypeNode(node) { var links = getNodeLinks(node); if (!links.resolvedType) { - links.resolvedType = getStringLiteralType(node); + links.resolvedType = getStringLiteralTypeForText(ts.unescapeIdentifier(node.text)); + } + return links.resolvedType; + } + function getTypeFromJSDocVariadicType(node) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + var type = getTypeFromTypeNode(node.type); + links.resolvedType = type ? createArrayType(type) : unknownType; + } + return links.resolvedType; + } + function getTypeFromJSDocTupleType(node) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + var types = ts.map(node.types, getTypeFromTypeNode); + links.resolvedType = createTupleType(types); } return links.resolvedType; } function getThisType(node) { var container = ts.getThisContainer(node, /*includeArrowFunctions*/ false); var parent = container && container.parent; - if (parent && (ts.isClassLike(parent) || parent.kind === 215 /* InterfaceDeclaration */)) { - if (!(container.flags & 64 /* Static */) && - (container.kind !== 144 /* Constructor */ || ts.isNodeDescendentOf(node, container.body))) { + if (parent && (ts.isClassLike(parent) || parent.kind === 222 /* InterfaceDeclaration */)) { + if (!(container.flags & 32 /* Static */) && + (container.kind !== 148 /* Constructor */ || ts.isNodeDescendentOf(node, container.body))) { return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent)).thisType; } } @@ -18018,49 +20138,72 @@ var ts; function getTypeFromTypeNode(node) { switch (node.kind) { case 117 /* AnyKeyword */: + case 258 /* JSDocAllType */: + case 259 /* JSDocUnknownType */: return anyType; - case 130 /* StringKeyword */: + case 132 /* StringKeyword */: return stringType; - case 128 /* NumberKeyword */: + case 130 /* NumberKeyword */: return numberType; case 120 /* BooleanKeyword */: return booleanType; - case 131 /* SymbolKeyword */: + case 133 /* SymbolKeyword */: return esSymbolType; case 103 /* VoidKeyword */: return voidType; + case 135 /* UndefinedKeyword */: + return undefinedType; + case 93 /* NullKeyword */: + return nullType; + case 127 /* NeverKeyword */: + return neverType; + case 165 /* ThisType */: case 97 /* ThisKeyword */: return getTypeFromThisTypeNode(node); - case 9 /* StringLiteral */: - return getTypeFromStringLiteral(node); - case 151 /* TypeReference */: + case 166 /* StringLiteralType */: + return getTypeFromStringLiteralTypeNode(node); + case 155 /* TypeReference */: + case 267 /* JSDocTypeReference */: return getTypeFromTypeReference(node); - case 150 /* TypePredicate */: + case 154 /* TypePredicate */: return booleanType; - case 188 /* ExpressionWithTypeArguments */: + case 194 /* ExpressionWithTypeArguments */: return getTypeFromTypeReference(node); - case 154 /* TypeQuery */: + case 158 /* TypeQuery */: return getTypeFromTypeQueryNode(node); - case 156 /* ArrayType */: + case 160 /* ArrayType */: + case 260 /* JSDocArrayType */: return getTypeFromArrayTypeNode(node); - case 157 /* TupleType */: + case 161 /* TupleType */: return getTypeFromTupleTypeNode(node); - case 158 /* UnionType */: + case 162 /* UnionType */: + case 261 /* JSDocUnionType */: return getTypeFromUnionTypeNode(node); - case 159 /* IntersectionType */: + case 163 /* IntersectionType */: return getTypeFromIntersectionTypeNode(node); - case 160 /* ParenthesizedType */: + case 164 /* ParenthesizedType */: + case 263 /* JSDocNullableType */: + case 264 /* JSDocNonNullableType */: + case 271 /* JSDocConstructorType */: + case 272 /* JSDocThisType */: + case 268 /* JSDocOptionalType */: return getTypeFromTypeNode(node.type); - case 152 /* FunctionType */: - case 153 /* ConstructorType */: - case 155 /* TypeLiteral */: + case 156 /* FunctionType */: + case 157 /* ConstructorType */: + case 159 /* TypeLiteral */: + case 269 /* JSDocFunctionType */: + case 265 /* JSDocRecordType */: return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); // This function assumes that an identifier or qualified name is a type expression // Callers should first ensure this by calling isTypeNode case 69 /* Identifier */: - case 135 /* QualifiedName */: + case 139 /* QualifiedName */: var symbol = getSymbolAtLocation(node); return symbol && getDeclaredTypeOfSymbol(symbol); + case 262 /* JSDocTupleType */: + return getTypeFromJSDocTupleType(node); + case 270 /* JSDocVariadicType */: + return getTypeFromJSDocVariadicType(node); default: return unknownType; } @@ -18082,87 +20225,93 @@ var ts; function createBinaryTypeMapper(source1, target1, source2, target2) { return function (t) { return t === source1 ? target1 : t === source2 ? target2 : t; }; } - function createTypeMapper(sources, targets) { - switch (sources.length) { - case 1: return createUnaryTypeMapper(sources[0], targets[0]); - case 2: return createBinaryTypeMapper(sources[0], targets[0], sources[1], targets[1]); - } + function createArrayTypeMapper(sources, targets) { return function (t) { for (var i = 0; i < sources.length; i++) { if (t === sources[i]) { - return targets[i]; + return targets ? targets[i] : anyType; } } return t; }; } - function createUnaryTypeEraser(source) { - return function (t) { return t === source ? anyType : t; }; - } - function createBinaryTypeEraser(source1, source2) { - return function (t) { return t === source1 || t === source2 ? anyType : t; }; + function createTypeMapper(sources, targets) { + var count = sources.length; + var mapper = count == 1 ? createUnaryTypeMapper(sources[0], targets ? targets[0] : anyType) : + count == 2 ? createBinaryTypeMapper(sources[0], targets ? targets[0] : anyType, sources[1], targets ? targets[1] : anyType) : + createArrayTypeMapper(sources, targets); + mapper.mappedTypes = sources; + return mapper; } function createTypeEraser(sources) { - switch (sources.length) { - case 1: return createUnaryTypeEraser(sources[0]); - case 2: return createBinaryTypeEraser(sources[0], sources[1]); - } - return function (t) { - for (var _i = 0, sources_1 = sources; _i < sources_1.length; _i++) { - var source = sources_1[_i]; - if (t === source) { - return anyType; - } - } - return t; - }; + return createTypeMapper(sources, undefined); } - function createInferenceMapper(context) { - var mapper = function (t) { - for (var i = 0; i < context.typeParameters.length; i++) { - if (t === context.typeParameters[i]) { - context.inferences[i].isFixed = true; - return getInferredType(context, i); + function getInferenceMapper(context) { + if (!context.mapper) { + var mapper = function (t) { + var typeParameters = context.typeParameters; + for (var i = 0; i < typeParameters.length; i++) { + if (t === typeParameters[i]) { + context.inferences[i].isFixed = true; + return getInferredType(context, i); + } } - } - return t; - }; - mapper.context = context; - return mapper; + return t; + }; + mapper.mappedTypes = context.typeParameters; + mapper.context = context; + context.mapper = mapper; + } + return context.mapper; } function identityMapper(type) { return type; } function combineTypeMappers(mapper1, mapper2) { - return function (t) { return instantiateType(mapper1(t), mapper2); }; + var mapper = function (t) { return instantiateType(mapper1(t), mapper2); }; + mapper.mappedTypes = mapper1.mappedTypes; + return mapper; } - function instantiateTypeParameter(typeParameter, mapper) { + function cloneTypeParameter(typeParameter) { var result = createType(512 /* TypeParameter */); result.symbol = typeParameter.symbol; - if (typeParameter.constraint) { - result.constraint = instantiateType(typeParameter.constraint, mapper); + result.target = typeParameter; + return result; + } + function cloneTypePredicate(predicate, mapper) { + if (ts.isIdentifierTypePredicate(predicate)) { + return { + kind: 1 /* Identifier */, + parameterName: predicate.parameterName, + parameterIndex: predicate.parameterIndex, + type: instantiateType(predicate.type, mapper) + }; } else { - result.target = typeParameter; - result.mapper = mapper; + return { + kind: 0 /* This */, + type: instantiateType(predicate.type, mapper) + }; } - return result; } function instantiateSignature(signature, mapper, eraseTypeParameters) { var freshTypeParameters; var freshTypePredicate; if (signature.typeParameters && !eraseTypeParameters) { - freshTypeParameters = instantiateList(signature.typeParameters, mapper, instantiateTypeParameter); + // First create a fresh set of type parameters, then include a mapping from the old to the + // new type parameters in the mapper function. Finally store this mapper in the new type + // parameters such that we can use it when instantiating constraints. + freshTypeParameters = ts.map(signature.typeParameters, cloneTypeParameter); mapper = combineTypeMappers(createTypeMapper(signature.typeParameters, freshTypeParameters), mapper); + for (var _i = 0, freshTypeParameters_1 = freshTypeParameters; _i < freshTypeParameters_1.length; _i++) { + var tp = freshTypeParameters_1[_i]; + tp.mapper = mapper; + } } if (signature.typePredicate) { - freshTypePredicate = { - parameterName: signature.typePredicate.parameterName, - parameterIndex: signature.typePredicate.parameterIndex, - type: instantiateType(signature.typePredicate.type, mapper) - }; + freshTypePredicate = cloneTypePredicate(signature.typePredicate, mapper); } - var result = createSignature(signature.declaration, freshTypeParameters, instantiateList(signature.parameters, mapper, instantiateSymbol), instantiateType(signature.resolvedReturnType, mapper), freshTypePredicate, signature.minArgumentCount, signature.hasRestParameter, signature.hasStringLiterals); + var result = createSignature(signature.declaration, freshTypeParameters, signature.thisType && instantiateType(signature.thisType, mapper), instantiateList(signature.parameters, mapper, instantiateSymbol), instantiateType(signature.resolvedReturnType, mapper), freshTypePredicate, signature.minArgumentCount, signature.hasRestParameter, signature.hasStringLiterals); result.target = signature; result.mapper = mapper; return result; @@ -18205,13 +20354,70 @@ var ts; mapper.instantiations[type.id] = result; return result; } + function isSymbolInScopeOfMappedTypeParameter(symbol, mapper) { + var mappedTypes = mapper.mappedTypes; + // Starting with the parent of the symbol's declaration, check if the mapper maps any of + // the type parameters introduced by enclosing declarations. We just pick the first + // declaration since multiple declarations will all have the same parent anyway. + var node = symbol.declarations[0].parent; + while (node) { + switch (node.kind) { + case 156 /* FunctionType */: + case 157 /* ConstructorType */: + case 220 /* FunctionDeclaration */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: + case 148 /* Constructor */: + case 151 /* CallSignature */: + case 152 /* ConstructSignature */: + case 153 /* IndexSignature */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: + case 179 /* FunctionExpression */: + case 180 /* ArrowFunction */: + case 221 /* ClassDeclaration */: + case 192 /* ClassExpression */: + case 222 /* InterfaceDeclaration */: + case 223 /* TypeAliasDeclaration */: + var declaration = node; + if (declaration.typeParameters) { + for (var _i = 0, _a = declaration.typeParameters; _i < _a.length; _i++) { + var d = _a[_i]; + if (ts.contains(mappedTypes, getDeclaredTypeOfTypeParameter(getSymbolOfNode(d)))) { + return true; + } + } + } + if (ts.isClassLike(node) || node.kind === 222 /* InterfaceDeclaration */) { + var thisType = getDeclaredTypeOfClassOrInterface(getSymbolOfNode(node)).thisType; + if (thisType && ts.contains(mappedTypes, thisType)) { + return true; + } + } + break; + case 225 /* ModuleDeclaration */: + case 256 /* SourceFile */: + return false; + } + node = node.parent; + } + return false; + } function instantiateType(type, mapper) { if (type && mapper !== identityMapper) { if (type.flags & 512 /* TypeParameter */) { return mapper(type); } if (type.flags & 65536 /* Anonymous */) { - return type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) ? + // If the anonymous type originates in a declaration of a function, method, class, or + // interface, in an object type literal, or in an object literal expression, we may need + // to instantiate the type because it might reference a type parameter. We skip instantiation + // if none of the type parameters that are in scope in the type's declaration are mapped by + // the given mapper, however we can only do that analysis if the type isn't itself an + // instantiation. + return type.symbol && + type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && + (type.flags & 131072 /* Instantiated */ || isSymbolInScopeOfMappedTypeParameter(type.symbol, mapper)) ? instantiateAnonymousType(type, mapper) : type; } if (type.flags & 4096 /* Reference */) { @@ -18229,36 +20435,44 @@ var ts; } return type; } + function instantiateIndexInfo(info, mapper) { + return info && createIndexInfo(instantiateType(info.type, mapper), info.isReadonly, info.declaration); + } // Returns true if the given expression contains (at any level of nesting) a function or arrow expression // that is subject to contextual typing. function isContextSensitive(node) { - ts.Debug.assert(node.kind !== 143 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 147 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); switch (node.kind) { - case 173 /* FunctionExpression */: - case 174 /* ArrowFunction */: + case 179 /* FunctionExpression */: + case 180 /* ArrowFunction */: return isContextSensitiveFunctionLikeDeclaration(node); - case 165 /* ObjectLiteralExpression */: + case 171 /* ObjectLiteralExpression */: return ts.forEach(node.properties, isContextSensitive); - case 164 /* ArrayLiteralExpression */: + case 170 /* ArrayLiteralExpression */: return ts.forEach(node.elements, isContextSensitive); - case 182 /* ConditionalExpression */: + case 188 /* ConditionalExpression */: return isContextSensitive(node.whenTrue) || isContextSensitive(node.whenFalse); - case 181 /* BinaryExpression */: + case 187 /* BinaryExpression */: return node.operatorToken.kind === 52 /* BarBarToken */ && (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 245 /* PropertyAssignment */: + case 253 /* PropertyAssignment */: return isContextSensitive(node.initializer); - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: return isContextSensitiveFunctionLikeDeclaration(node); - case 172 /* ParenthesizedExpression */: + case 178 /* ParenthesizedExpression */: return isContextSensitive(node.expression); } return false; } function isContextSensitiveFunctionLikeDeclaration(node) { - return !node.typeParameters && node.parameters.length && !ts.forEach(node.parameters, function (p) { return p.type; }); + var areAllParametersUntyped = !ts.forEach(node.parameters, function (p) { return p.type; }); + var isNullaryArrow = node.kind === 180 /* ArrowFunction */ && !node.parameters.length; + return !node.typeParameters && areAllParametersUntyped && !isNullaryArrow; + } + function isContextSensitiveFunctionOrObjectLiteralMethod(func) { + return (isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) && isContextSensitiveFunctionLikeDeclaration(func); } function getTypeWithoutSignatures(type) { if (type.flags & 80896 /* ObjectType */) { @@ -18278,31 +20492,177 @@ var ts; function isTypeIdenticalTo(source, target) { return checkTypeRelatedTo(source, target, identityRelation, /*errorNode*/ undefined); } - function compareTypes(source, target) { + function compareTypesIdentical(source, target) { return checkTypeRelatedTo(source, target, identityRelation, /*errorNode*/ undefined) ? -1 /* True */ : 0 /* False */; } + function compareTypesAssignable(source, target) { + return checkTypeRelatedTo(source, target, assignableRelation, /*errorNode*/ undefined) ? -1 /* True */ : 0 /* False */; + } function isTypeSubtypeOf(source, target) { return checkTypeSubtypeOf(source, target, /*errorNode*/ undefined); } function isTypeAssignableTo(source, target) { return checkTypeAssignableTo(source, target, /*errorNode*/ undefined); } + /** + * This is *not* a bi-directional relationship. + * If one needs to check both directions for comparability, use a second call to this function or 'checkTypeComparableTo'. + */ + function isTypeComparableTo(source, target) { + return checkTypeComparableTo(source, target, /*errorNode*/ undefined); + } function checkTypeSubtypeOf(source, target, errorNode, headMessage, containingMessageChain) { return checkTypeRelatedTo(source, target, subtypeRelation, errorNode, headMessage, containingMessageChain); } function checkTypeAssignableTo(source, target, errorNode, headMessage, containingMessageChain) { return checkTypeRelatedTo(source, target, assignableRelation, errorNode, headMessage, containingMessageChain); } - function isSignatureAssignableTo(source, target) { - var sourceType = getOrCreateTypeFromSignature(source); - var targetType = getOrCreateTypeFromSignature(target); - return checkTypeRelatedTo(sourceType, targetType, assignableRelation, /*errorNode*/ undefined); + /** + * This is *not* a bi-directional relationship. + * If one needs to check both directions for comparability, use a second call to this function or 'isTypeComparableTo'. + */ + function checkTypeComparableTo(source, target, errorNode, headMessage, containingMessageChain) { + return checkTypeRelatedTo(source, target, comparableRelation, errorNode, headMessage, containingMessageChain); + } + function isSignatureAssignableTo(source, target, ignoreReturnTypes) { + return compareSignaturesRelated(source, target, ignoreReturnTypes, /*reportErrors*/ false, /*errorReporter*/ undefined, compareTypesAssignable) !== 0 /* False */; + } + /** + * See signatureRelatedTo, compareSignaturesIdentical + */ + function compareSignaturesRelated(source, target, ignoreReturnTypes, reportErrors, errorReporter, compareTypes) { + // TODO (drosen): De-duplicate code between related functions. + if (source === target) { + return -1 /* True */; + } + if (!target.hasRestParameter && source.minArgumentCount > target.parameters.length) { + return 0 /* False */; + } + // Spec 1.0 Section 3.8.3 & 3.8.4: + // M and N (the signatures) are instantiated using type Any as the type argument for all type parameters declared by M and N + source = getErasedSignature(source); + target = getErasedSignature(target); + var result = -1 /* True */; + if (source.thisType && target.thisType && source.thisType !== voidType) { + // void sources are assignable to anything. + var related = compareTypes(source.thisType, target.thisType, /*reportErrors*/ false) + || compareTypes(target.thisType, source.thisType, reportErrors); + if (!related) { + if (reportErrors) { + errorReporter(ts.Diagnostics.The_this_types_of_each_signature_are_incompatible); + } + return 0 /* False */; + } + result &= related; + } + var sourceMax = getNumNonRestParameters(source); + var targetMax = getNumNonRestParameters(target); + var checkCount = getNumParametersToCheckForSignatureRelatability(source, sourceMax, target, targetMax); + var sourceParams = source.parameters; + var targetParams = target.parameters; + for (var i = 0; i < checkCount; i++) { + var s = i < sourceMax ? getTypeOfParameter(sourceParams[i]) : getRestTypeOfSignature(source); + var t = i < targetMax ? getTypeOfParameter(targetParams[i]) : getRestTypeOfSignature(target); + var related = compareTypes(s, t, /*reportErrors*/ false) || compareTypes(t, s, reportErrors); + if (!related) { + if (reportErrors) { + errorReporter(ts.Diagnostics.Types_of_parameters_0_and_1_are_incompatible, sourceParams[i < sourceMax ? i : sourceMax].name, targetParams[i < targetMax ? i : targetMax].name); + } + return 0 /* False */; + } + result &= related; + } + if (!ignoreReturnTypes) { + var targetReturnType = getReturnTypeOfSignature(target); + if (targetReturnType === voidType) { + return result; + } + var sourceReturnType = getReturnTypeOfSignature(source); + // The following block preserves behavior forbidding boolean returning functions from being assignable to type guard returning functions + if (target.typePredicate) { + if (source.typePredicate) { + result &= compareTypePredicateRelatedTo(source.typePredicate, target.typePredicate, reportErrors, errorReporter, compareTypes); + } + else if (ts.isIdentifierTypePredicate(target.typePredicate)) { + if (reportErrors) { + errorReporter(ts.Diagnostics.Signature_0_must_have_a_type_predicate, signatureToString(source)); + } + return 0 /* False */; + } + } + else { + result &= compareTypes(sourceReturnType, targetReturnType, reportErrors); + } + } + return result; + } + function compareTypePredicateRelatedTo(source, target, reportErrors, errorReporter, compareTypes) { + if (source.kind !== target.kind) { + if (reportErrors) { + errorReporter(ts.Diagnostics.A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard); + errorReporter(ts.Diagnostics.Type_predicate_0_is_not_assignable_to_1, typePredicateToString(source), typePredicateToString(target)); + } + return 0 /* False */; + } + if (source.kind === 1 /* Identifier */) { + var sourceIdentifierPredicate = source; + var targetIdentifierPredicate = target; + if (sourceIdentifierPredicate.parameterIndex !== targetIdentifierPredicate.parameterIndex) { + if (reportErrors) { + errorReporter(ts.Diagnostics.Parameter_0_is_not_in_the_same_position_as_parameter_1, sourceIdentifierPredicate.parameterName, targetIdentifierPredicate.parameterName); + errorReporter(ts.Diagnostics.Type_predicate_0_is_not_assignable_to_1, typePredicateToString(source), typePredicateToString(target)); + } + return 0 /* False */; + } + } + var related = compareTypes(source.type, target.type, reportErrors); + if (related === 0 /* False */ && reportErrors) { + errorReporter(ts.Diagnostics.Type_predicate_0_is_not_assignable_to_1, typePredicateToString(source), typePredicateToString(target)); + } + return related; + } + function isImplementationCompatibleWithOverload(implementation, overload) { + var erasedSource = getErasedSignature(implementation); + var erasedTarget = getErasedSignature(overload); + // First see if the return types are compatible in either direction. + var sourceReturnType = getReturnTypeOfSignature(erasedSource); + var targetReturnType = getReturnTypeOfSignature(erasedTarget); + if (targetReturnType === voidType + || checkTypeRelatedTo(targetReturnType, sourceReturnType, assignableRelation, /*errorNode*/ undefined) + || checkTypeRelatedTo(sourceReturnType, targetReturnType, assignableRelation, /*errorNode*/ undefined)) { + return isSignatureAssignableTo(erasedSource, erasedTarget, /*ignoreReturnTypes*/ true); + } + return false; + } + function getNumNonRestParameters(signature) { + var numParams = signature.parameters.length; + return signature.hasRestParameter ? + numParams - 1 : + numParams; + } + function getNumParametersToCheckForSignatureRelatability(source, sourceNonRestParamCount, target, targetNonRestParamCount) { + if (source.hasRestParameter === target.hasRestParameter) { + if (source.hasRestParameter) { + // If both have rest parameters, get the max and add 1 to + // compensate for the rest parameter. + return Math.max(sourceNonRestParamCount, targetNonRestParamCount) + 1; + } + else { + return Math.min(sourceNonRestParamCount, targetNonRestParamCount); + } + } + else { + // Return the count for whichever signature doesn't have rest parameters. + return source.hasRestParameter ? + targetNonRestParamCount : + sourceNonRestParamCount; + } } /** * Checks if 'source' is related to 'target' (e.g.: is a assignable to). * @param source The left-hand-side of the relation. * @param target The right-hand-side of the relation. - * @param relation The relation considered. One of 'identityRelation', 'assignableRelation', or 'subTypeRelation'. + * @param relation The relation considered. One of 'identityRelation', 'subtypeRelation', 'assignableRelation', or 'comparableRelation'. * Used as both to determine which checks are performed and as a cache of previously computed results. * @param errorNode The suggested node upon which all errors will be reported, if defined. This may or may not be the actual node used. * @param headMessage If the error chain should be prepended by a head message, then headMessage will be used. @@ -18316,22 +20676,12 @@ var ts; var expandingFlags; var depth = 0; var overflow = false; - var elaborateErrors = false; ts.Debug.assert(relation !== identityRelation || !errorNode, "no error reporting in identity checking"); - var result = isRelatedTo(source, target, errorNode !== undefined, headMessage); + var result = isRelatedTo(source, target, /*reportErrors*/ !!errorNode, headMessage); if (overflow) { error(errorNode, ts.Diagnostics.Excessive_stack_depth_comparing_types_0_and_1, typeToString(source), typeToString(target)); } else if (errorInfo) { - // If we already computed this relation, but in a context where we didn't want to report errors (e.g. overload resolution), - // then we'll only have a top-level error (e.g. 'Class X does not implement interface Y') without any details. If this happened, - // request a recompuation to get a complete error message. This will be skipped if we've already done this computation in a context - // where errors were being reported. - if (errorInfo.next === undefined) { - errorInfo = undefined; - elaborateErrors = true; - isRelatedTo(source, target, errorNode !== undefined, headMessage); - } if (containingMessageChain) { errorInfo = ts.concatenateDiagnosticMessageChains(containingMessageChain, errorInfo); } @@ -18339,6 +20689,7 @@ var ts; } return result !== 0 /* False */; function reportError(message, arg0, arg1, arg2) { + ts.Debug.assert(!!errorNode); errorInfo = ts.chainDiagnosticMessages(errorInfo, message, arg0, arg1, arg2); } function reportRelationError(message, source, target) { @@ -18348,7 +20699,12 @@ var ts; sourceType = typeToString(source, /*enclosingDeclaration*/ undefined, 128 /* UseFullyQualifiedType */); targetType = typeToString(target, /*enclosingDeclaration*/ undefined, 128 /* UseFullyQualifiedType */); } - reportError(message || ts.Diagnostics.Type_0_is_not_assignable_to_type_1, sourceType, targetType); + if (!message) { + message = relation === comparableRelation ? + ts.Diagnostics.Type_0_is_not_comparable_to_type_1 : + ts.Diagnostics.Type_0_is_not_assignable_to_type_1; + } + reportError(message, sourceType, targetType); } // Compare two types and return // Ternary.True if they are related with no assumptions, @@ -18362,21 +20718,35 @@ var ts; if (relation === identityRelation) { return isIdenticalTo(source, target); } - if (isTypeAny(target)) - return -1 /* True */; - if (source === undefinedType) - return -1 /* True */; - if (source === nullType && target !== undefinedType) - return -1 /* True */; - if (source.flags & 128 /* Enum */ && target === numberType) - return -1 /* True */; - if (source.flags & 256 /* StringLiteral */ && target === stringType) - return -1 /* True */; - if (relation === assignableRelation) { - if (isTypeAny(source)) + if (!(target.flags & 134217728 /* Never */)) { + if (target.flags & 1 /* Any */) return -1 /* True */; - if (source === numberType && target.flags & 128 /* Enum */) + if (source.flags & 32 /* Undefined */) { + if (!strictNullChecks || target.flags & (32 /* Undefined */ | 16 /* Void */) || source === emptyArrayElementType) + return -1 /* True */; + } + if (source.flags & 64 /* Null */) { + if (!strictNullChecks || target.flags & 64 /* Null */) + return -1 /* True */; + } + if (source.flags & 128 /* Enum */ && target === numberType) return -1 /* True */; + if (source.flags & 128 /* Enum */ && target.flags & 128 /* Enum */) { + if (result = enumRelatedTo(source, target, reportErrors)) { + return result; + } + } + if (source.flags & 256 /* StringLiteral */ && target === stringType) + return -1 /* True */; + if (relation === assignableRelation || relation === comparableRelation) { + if (source.flags & (1 /* Any */ | 134217728 /* Never */)) + return -1 /* True */; + if (source === numberType && target.flags & 128 /* Enum */) + return -1 /* True */; + } + if (source.flags & 8 /* Boolean */ && target.flags & 8 /* Boolean */) { + return -1 /* True */; + } } if (source.flags & 1048576 /* FreshObjectLiteral */) { if (hasExcessProperties(source, target, reportErrors)) { @@ -18394,29 +20764,48 @@ var ts; } } var saveErrorInfo = errorInfo; - // Note that the "each" checks must precede the "some" checks to produce the correct results + // Note that these checks are specifically ordered to produce correct results. if (source.flags & 16384 /* Union */) { - if (result = eachTypeRelatedToType(source, target, reportErrors)) { + if (relation === comparableRelation) { + result = someTypeRelatedToType(source, target, reportErrors); + } + else { + result = eachTypeRelatedToType(source, target, reportErrors); + } + if (result) { return result; } } else if (target.flags & 32768 /* Intersection */) { - if (result = typeRelatedToEachType(source, target, reportErrors)) { + result = typeRelatedToEachType(source, target, reportErrors); + if (result) { return result; } } else { - // It is necessary to try "some" checks on both sides because there may be nested "each" checks + // It is necessary to try these "some" checks on both sides because there may be nested "each" checks // on either side that need to be prioritized. For example, A | B = (A | B) & (C | D) or // A & B = (A & B) | (C & D). if (source.flags & 32768 /* Intersection */) { - // If target is a union type the following check will report errors so we suppress them here - if (result = someTypeRelatedToType(source, target, reportErrors && !(target.flags & 16384 /* Union */))) { + // Check to see if any constituents of the intersection are immediately related to the target. + // + // Don't report errors though. Checking whether a constituent is related to the source is not actually + // useful and leads to some confusing error messages. Instead it is better to let the below checks + // take care of this, or to not elaborate at all. For instance, + // + // - For an object type (such as 'C = A & B'), users are usually more interested in structural errors. + // + // - For a union type (such as '(A | B) = (C & D)'), it's better to hold onto the whole intersection + // than to report that 'D' is not assignable to 'A' or 'B'. + // + // - For a primitive type or type parameter (such as 'number = A & B') there is no point in + // breaking the intersection apart. + if (result = someTypeRelatedToType(source, target, /*reportErrors*/ false)) { return result; } } if (target.flags & 16384 /* Union */) { - if (result = typeRelatedToSomeType(source, target, reportErrors)) { + if (result = typeRelatedToSomeType(source, target, reportErrors && !(source.flags & 16777726 /* Primitive */))) { return result; } } @@ -18426,6 +20815,8 @@ var ts; if (!constraint || constraint.flags & 1 /* Any */) { constraint = emptyObjectType; } + // The constraint may need to be further instantiated with its 'this' type. + constraint = getTypeWithThisArgument(constraint, source); // Report constraint errors only if the constraint is not the empty object type var reportConstraintErrors = reportErrors && constraint !== emptyObjectType; if (result = isRelatedTo(constraint, target, reportConstraintErrors)) { @@ -18442,14 +20833,14 @@ var ts; } // Even if relationship doesn't hold for unions, intersections, or generic type references, // it may hold in a structural comparison. - var apparentType = getApparentType(source); + var apparentSource = getApparentType(source); // In a check of the form X = A & B, we will have previously checked if A relates to X or B relates // to X. Failing both of those we want to check if the aggregation of A and B's members structurally // relates to X. Thus, we include intersection types on the source side here. - if (apparentType.flags & (80896 /* ObjectType */ | 32768 /* Intersection */) && target.flags & 80896 /* ObjectType */) { + if (apparentSource.flags & (80896 /* ObjectType */ | 32768 /* Intersection */) && target.flags & 80896 /* ObjectType */) { // Report structural errors only if we haven't reported any errors yet - var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo; - if (result = objectTypeRelatedTo(apparentType, source, target, reportStructuralErrors)) { + var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo && !(source.flags & 16777726 /* Primitive */); + if (result = objectTypeRelatedTo(apparentSource, source, target, reportStructuralErrors)) { errorInfo = saveErrorInfo; return result; } @@ -18471,13 +20862,10 @@ var ts; } return objectTypeRelatedTo(source, source, target, /*reportErrors*/ false); } - if (source.flags & 512 /* TypeParameter */ && target.flags & 512 /* TypeParameter */) { - return typeParameterIdenticalTo(source, target); - } if (source.flags & 16384 /* Union */ && target.flags & 16384 /* Union */ || source.flags & 32768 /* Intersection */ && target.flags & 32768 /* Intersection */) { - if (result = eachTypeRelatedToSomeType(source, target)) { - if (result &= eachTypeRelatedToSomeType(target, source)) { + if (result = eachTypeRelatedToSomeType(source, target, /*reportErrors*/ false)) { + if (result &= eachTypeRelatedToSomeType(target, source, /*reportErrors*/ false)) { return result; } } @@ -18491,8 +20879,9 @@ var ts; function isKnownProperty(type, name) { if (type.flags & 80896 /* ObjectType */) { var resolved = resolveStructuredTypeMembers(type); - if (relation === assignableRelation && (type === globalObjectType || resolved.properties.length === 0) || - resolved.stringIndexType || resolved.numberIndexType || getPropertyOfType(type, name)) { + if ((relation === assignableRelation || relation === comparableRelation) && + (type === globalObjectType || isEmptyObjectType(resolved)) || + resolved.stringIndexInfo || resolved.numberIndexInfo || getPropertyOfType(type, name)) { return true; } } @@ -18506,8 +20895,15 @@ var ts; } return false; } + function isEmptyObjectType(t) { + return t.properties.length === 0 && + t.callSignatures.length === 0 && + t.constructSignatures.length === 0 && + !t.stringIndexInfo && + !t.numberIndexInfo; + } function hasExcessProperties(source, target, reportErrors) { - if (!(target.flags & 67108864 /* ObjectLiteralPatternWithComputedProperties */) && someConstituentTypeHasKind(target, 80896 /* ObjectType */)) { + if (!(target.flags & 67108864 /* ObjectLiteralPatternWithComputedProperties */) && maybeTypeOfKind(target, 80896 /* ObjectType */)) { for (var _i = 0, _a = getPropertiesOfObjectType(source); _i < _a.length; _i++) { var prop = _a[_i]; if (!isKnownProperty(target, prop.name)) { @@ -18515,6 +20911,7 @@ var ts; // We know *exactly* where things went wrong when comparing the types. // Use this property as the error node as this will be more helpful in // reasoning about what went wrong. + ts.Debug.assert(!!errorNode); errorNode = prop.valueDeclaration; reportError(ts.Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1, symbolToString(prop), typeToString(target)); } @@ -18524,12 +20921,12 @@ var ts; } return false; } - function eachTypeRelatedToSomeType(source, target) { + function eachTypeRelatedToSomeType(source, target, reportErrors) { var result = -1 /* True */; var sourceTypes = source.types; for (var _i = 0, sourceTypes_1 = sourceTypes; _i < sourceTypes_1.length; _i++) { var sourceType = sourceTypes_1[_i]; - var related = typeRelatedToSomeType(sourceType, target, false); + var related = typeRelatedToSomeType(sourceType, target, /*reportErrors*/ false); if (!related) { return 0 /* False */; } @@ -18539,7 +20936,19 @@ var ts; } function typeRelatedToSomeType(source, target, reportErrors) { var targetTypes = target.types; - for (var i = 0, len = targetTypes.length; i < len; i++) { + var len = targetTypes.length; + // The null and undefined types are guaranteed to be at the end of the constituent type list. In order + // to produce the best possible errors we first check the nullable types, such that the last type we + // check and report errors from is a non-nullable type if one is present. + while (len >= 2 && targetTypes[len - 1].flags & 96 /* Nullable */) { + var related = isRelatedTo(source, targetTypes[len - 1], /*reportErrors*/ false); + if (related) { + return related; + } + len--; + } + // Now check the non-nullable types and report errors on the last one. + for (var i = 0; i < len; i++) { var related = isRelatedTo(source, targetTypes[i], reportErrors && i === len - 1); if (related) { return related; @@ -18562,7 +20971,19 @@ var ts; } function someTypeRelatedToType(source, target, reportErrors) { var sourceTypes = source.types; - for (var i = 0, len = sourceTypes.length; i < len; i++) { + var len = sourceTypes.length; + // The null and undefined types are guaranteed to be at the end of the constituent type list. In order + // to produce the best possible errors we first check the nullable types, such that the last type we + // check and report errors from is a non-nullable type if one is present. + while (len >= 2 && sourceTypes[len - 1].flags & 96 /* Nullable */) { + var related = isRelatedTo(sourceTypes[len - 1], target, /*reportErrors*/ false); + if (related) { + return related; + } + len--; + } + // Now check the non-nullable types and report errors on the last one. + for (var i = 0; i < len; i++) { var related = isRelatedTo(sourceTypes[i], target, reportErrors && i === len - 1); if (related) { return related; @@ -18589,8 +21010,9 @@ var ts; if (sources.length !== targets.length && relation === identityRelation) { return 0 /* False */; } + var length = sources.length <= targets.length ? sources.length : targets.length; var result = -1 /* True */; - for (var i = 0; i < targets.length; i++) { + for (var i = 0; i < length; i++) { var related = isRelatedTo(sources[i], targets[i], reportErrors); if (!related) { return 0 /* False */; @@ -18599,31 +21021,24 @@ var ts; } return result; } - function typeParameterIdenticalTo(source, target) { - // covers case when both type parameters does not have constraint (both equal to noConstraintType) - if (source.constraint === target.constraint) { - return -1 /* True */; - } - if (source.constraint === noConstraintType || target.constraint === noConstraintType) { - return 0 /* False */; - } - return isIdenticalTo(source.constraint, target.constraint); - } // Determine if two object types are related by structure. First, check if the result is already available in the global cache. // Second, check if we have already started a comparison of the given two types in which case we assume the result to be true. // Third, check if both types are part of deeply nested chains of generic type instantiations and if so assume the types are // equal and infinitely expanding. Fourth, if we have reached a depth of 100 nested comparisons, assume we have runaway recursion // and issue an error. Otherwise, actually compare the structure of the two types. - function objectTypeRelatedTo(apparentSource, originalSource, target, reportErrors) { + function objectTypeRelatedTo(source, originalSource, target, reportErrors) { if (overflow) { return 0 /* False */; } - var id = relation !== identityRelation || apparentSource.id < target.id ? apparentSource.id + "," + target.id : target.id + "," + apparentSource.id; + var id = relation !== identityRelation || source.id < target.id ? source.id + "," + target.id : target.id + "," + source.id; var related = relation[id]; if (related !== undefined) { - // If we computed this relation already and it was failed and reported, or if we're not being asked to elaborate - // errors, we can use the cached value. Otherwise, recompute the relation - if (!elaborateErrors || (related === 3 /* FailedAndReported */)) { + if (reportErrors && related === 2 /* Failed */) { + // We are elaborating errors and the cached result is an unreported failure. Record the result as a reported + // failure and continue computing the relation such that errors get reported. + relation[id] = 3 /* FailedAndReported */; + } + else { return related === 1 /* Succeeded */ ? -1 /* True */ : 0 /* False */; } } @@ -18645,13 +21060,13 @@ var ts; maybeStack = []; expandingFlags = 0; } - sourceStack[depth] = apparentSource; + sourceStack[depth] = source; targetStack[depth] = target; maybeStack[depth] = {}; maybeStack[depth][id] = 1 /* Succeeded */; depth++; var saveExpandingFlags = expandingFlags; - if (!(expandingFlags & 1) && isDeeplyNestedGeneric(apparentSource, sourceStack, depth)) + if (!(expandingFlags & 1) && isDeeplyNestedGeneric(source, sourceStack, depth)) expandingFlags |= 1; if (!(expandingFlags & 2) && isDeeplyNestedGeneric(target, targetStack, depth)) expandingFlags |= 2; @@ -18660,15 +21075,15 @@ var ts; result = 1 /* Maybe */; } else { - result = propertiesRelatedTo(apparentSource, target, reportErrors); + result = propertiesRelatedTo(source, target, reportErrors); if (result) { - result &= signaturesRelatedTo(apparentSource, target, 0 /* Call */, reportErrors); + result &= signaturesRelatedTo(source, target, 0 /* Call */, reportErrors); if (result) { - result &= signaturesRelatedTo(apparentSource, target, 1 /* Construct */, reportErrors); + result &= signaturesRelatedTo(source, target, 1 /* Construct */, reportErrors); if (result) { - result &= stringIndexTypesRelatedTo(apparentSource, originalSource, target, reportErrors); + result &= indexTypesRelatedTo(source, originalSource, target, 0 /* String */, reportErrors); if (result) { - result &= numberIndexTypesRelatedTo(apparentSource, originalSource, target, reportErrors); + result &= indexTypesRelatedTo(source, originalSource, target, 1 /* Number */, reportErrors); } } } @@ -18711,23 +21126,23 @@ var ts; else if (!(targetProp.flags & 134217728 /* Prototype */)) { var sourcePropFlags = getDeclarationFlagsFromSymbol(sourceProp); var targetPropFlags = getDeclarationFlagsFromSymbol(targetProp); - if (sourcePropFlags & 16 /* Private */ || targetPropFlags & 16 /* Private */) { + if (sourcePropFlags & 8 /* Private */ || targetPropFlags & 8 /* Private */) { if (sourceProp.valueDeclaration !== targetProp.valueDeclaration) { if (reportErrors) { - if (sourcePropFlags & 16 /* Private */ && targetPropFlags & 16 /* Private */) { + if (sourcePropFlags & 8 /* Private */ && targetPropFlags & 8 /* Private */) { reportError(ts.Diagnostics.Types_have_separate_declarations_of_a_private_property_0, symbolToString(targetProp)); } else { - reportError(ts.Diagnostics.Property_0_is_private_in_type_1_but_not_in_type_2, symbolToString(targetProp), typeToString(sourcePropFlags & 16 /* Private */ ? source : target), typeToString(sourcePropFlags & 16 /* Private */ ? target : source)); + reportError(ts.Diagnostics.Property_0_is_private_in_type_1_but_not_in_type_2, symbolToString(targetProp), typeToString(sourcePropFlags & 8 /* Private */ ? source : target), typeToString(sourcePropFlags & 8 /* Private */ ? target : source)); } } return 0 /* False */; } } - else if (targetPropFlags & 32 /* Protected */) { + else if (targetPropFlags & 16 /* Protected */) { var sourceDeclaredInClass = sourceProp.parent && sourceProp.parent.flags & 32 /* Class */; - var sourceClass = sourceDeclaredInClass ? getDeclaredTypeOfSymbol(sourceProp.parent) : undefined; - var targetClass = getDeclaredTypeOfSymbol(targetProp.parent); + var sourceClass = sourceDeclaredInClass ? getDeclaredTypeOfSymbol(getParentOfSymbol(sourceProp)) : undefined; + var targetClass = getDeclaredTypeOfSymbol(getParentOfSymbol(targetProp)); if (!sourceClass || !hasBaseType(sourceClass, targetClass)) { if (reportErrors) { reportError(ts.Diagnostics.Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2, symbolToString(targetProp), typeToString(sourceClass || source), typeToString(targetClass)); @@ -18735,7 +21150,7 @@ var ts; return 0 /* False */; } } - else if (sourcePropFlags & 32 /* Protected */) { + else if (sourcePropFlags & 16 /* Protected */) { if (reportErrors) { reportError(ts.Diagnostics.Property_0_is_protected_in_type_1_but_public_in_type_2, symbolToString(targetProp), typeToString(source), typeToString(target)); } @@ -18800,154 +21215,49 @@ var ts; } var sourceSignatures = getSignaturesOfType(source, kind); var targetSignatures = getSignaturesOfType(target, kind); + if (kind === 1 /* Construct */ && sourceSignatures.length && targetSignatures.length) { + if (isAbstractConstructorType(source) && !isAbstractConstructorType(target)) { + // An abstract constructor type is not assignable to a non-abstract constructor type + // as it would otherwise be possible to new an abstract class. Note that the assignability + // check we perform for an extends clause excludes construct signatures from the target, + // so this check never proceeds. + if (reportErrors) { + reportError(ts.Diagnostics.Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type); + } + return 0 /* False */; + } + if (!constructorVisibilitiesAreCompatible(sourceSignatures[0], targetSignatures[0], reportErrors)) { + return 0 /* False */; + } + } var result = -1 /* True */; var saveErrorInfo = errorInfo; - if (kind === 1 /* Construct */) { - // Only want to compare the construct signatures for abstractness guarantees. - // Because the "abstractness" of a class is the same across all construct signatures - // (internally we are checking the corresponding declaration), it is enough to perform - // the check and report an error once over all pairs of source and target construct signatures. - // - // sourceSig and targetSig are (possibly) undefined. - // - // Note that in an extends-clause, targetSignatures is stripped, so the check never proceeds. - var sourceSig = sourceSignatures[0]; - var targetSig = targetSignatures[0]; - result &= abstractSignatureRelatedTo(source, sourceSig, target, targetSig); - if (result !== -1 /* True */) { - return result; - } - } outer: for (var _i = 0, targetSignatures_1 = targetSignatures; _i < targetSignatures_1.length; _i++) { var t = targetSignatures_1[_i]; - if (!t.hasStringLiterals || target.flags & 262144 /* FromSignature */) { - var localErrors = reportErrors; - var checkedAbstractAssignability = false; - for (var _a = 0, sourceSignatures_1 = sourceSignatures; _a < sourceSignatures_1.length; _a++) { - var s = sourceSignatures_1[_a]; - if (!s.hasStringLiterals || source.flags & 262144 /* FromSignature */) { - var related = signatureRelatedTo(s, t, localErrors); - if (related) { - result &= related; - errorInfo = saveErrorInfo; - continue outer; - } - // Only report errors from the first failure - localErrors = false; - } + // Only elaborate errors from the first failure + var shouldElaborateErrors = reportErrors; + for (var _a = 0, sourceSignatures_1 = sourceSignatures; _a < sourceSignatures_1.length; _a++) { + var s = sourceSignatures_1[_a]; + var related = signatureRelatedTo(s, t, shouldElaborateErrors); + if (related) { + result &= related; + errorInfo = saveErrorInfo; + continue outer; } - return 0 /* False */; + shouldElaborateErrors = false; } + if (shouldElaborateErrors) { + reportError(ts.Diagnostics.Type_0_provides_no_match_for_the_signature_1, typeToString(source), signatureToString(t, /*enclosingDeclaration*/ undefined, /*flags*/ undefined, kind)); + } + return 0 /* False */; } return result; - function abstractSignatureRelatedTo(source, sourceSig, target, targetSig) { - if (sourceSig && targetSig) { - var sourceDecl = source.symbol && getClassLikeDeclarationOfSymbol(source.symbol); - var targetDecl = target.symbol && getClassLikeDeclarationOfSymbol(target.symbol); - if (!sourceDecl) { - // If the source object isn't itself a class declaration, it can be freely assigned, regardless - // of whether the constructed object is abstract or not. - return -1 /* True */; - } - var sourceErasedSignature = getErasedSignature(sourceSig); - var targetErasedSignature = getErasedSignature(targetSig); - var sourceReturnType = sourceErasedSignature && getReturnTypeOfSignature(sourceErasedSignature); - var targetReturnType = targetErasedSignature && getReturnTypeOfSignature(targetErasedSignature); - var sourceReturnDecl = sourceReturnType && sourceReturnType.symbol && getClassLikeDeclarationOfSymbol(sourceReturnType.symbol); - var targetReturnDecl = targetReturnType && targetReturnType.symbol && getClassLikeDeclarationOfSymbol(targetReturnType.symbol); - var sourceIsAbstract = sourceReturnDecl && sourceReturnDecl.flags & 128 /* Abstract */; - var targetIsAbstract = targetReturnDecl && targetReturnDecl.flags & 128 /* Abstract */; - if (sourceIsAbstract && !(targetIsAbstract && targetDecl)) { - // if target isn't a class-declaration type, then it can be new'd, so we forbid the assignment. - if (reportErrors) { - reportError(ts.Diagnostics.Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type); - } - return 0 /* False */; - } - } - return -1 /* True */; - } } + /** + * See signatureAssignableTo, compareSignaturesIdentical + */ function signatureRelatedTo(source, target, reportErrors) { - if (source === target) { - return -1 /* True */; - } - if (!target.hasRestParameter && source.minArgumentCount > target.parameters.length) { - return 0 /* False */; - } - var sourceMax = source.parameters.length; - var targetMax = target.parameters.length; - var checkCount; - if (source.hasRestParameter && target.hasRestParameter) { - checkCount = sourceMax > targetMax ? sourceMax : targetMax; - sourceMax--; - targetMax--; - } - else if (source.hasRestParameter) { - sourceMax--; - checkCount = targetMax; - } - else if (target.hasRestParameter) { - targetMax--; - checkCount = sourceMax; - } - else { - checkCount = sourceMax < targetMax ? sourceMax : targetMax; - } - // Spec 1.0 Section 3.8.3 & 3.8.4: - // M and N (the signatures) are instantiated using type Any as the type argument for all type parameters declared by M and N - source = getErasedSignature(source); - target = getErasedSignature(target); - var result = -1 /* True */; - for (var i = 0; i < checkCount; i++) { - var s = i < sourceMax ? getTypeOfSymbol(source.parameters[i]) : getRestTypeOfSignature(source); - var t = i < targetMax ? getTypeOfSymbol(target.parameters[i]) : getRestTypeOfSignature(target); - var saveErrorInfo = errorInfo; - var related = isRelatedTo(s, t, reportErrors); - if (!related) { - related = isRelatedTo(t, s, false); - if (!related) { - if (reportErrors) { - reportError(ts.Diagnostics.Types_of_parameters_0_and_1_are_incompatible, source.parameters[i < sourceMax ? i : sourceMax].name, target.parameters[i < targetMax ? i : targetMax].name); - } - return 0 /* False */; - } - errorInfo = saveErrorInfo; - } - result &= related; - } - if (source.typePredicate && target.typePredicate) { - var hasDifferentParameterIndex = source.typePredicate.parameterIndex !== target.typePredicate.parameterIndex; - var hasDifferentTypes; - if (hasDifferentParameterIndex || - (hasDifferentTypes = !isTypeIdenticalTo(source.typePredicate.type, target.typePredicate.type))) { - if (reportErrors) { - var sourceParamText = source.typePredicate.parameterName; - var targetParamText = target.typePredicate.parameterName; - var sourceTypeText = typeToString(source.typePredicate.type); - var targetTypeText = typeToString(target.typePredicate.type); - if (hasDifferentParameterIndex) { - reportError(ts.Diagnostics.Parameter_0_is_not_in_the_same_position_as_parameter_1, sourceParamText, targetParamText); - } - else if (hasDifferentTypes) { - reportError(ts.Diagnostics.Type_0_is_not_assignable_to_type_1, sourceTypeText, targetTypeText); - } - reportError(ts.Diagnostics.Type_predicate_0_is_not_assignable_to_1, sourceParamText + " is " + sourceTypeText, targetParamText + " is " + targetTypeText); - } - return 0 /* False */; - } - } - else if (!source.typePredicate && target.typePredicate) { - if (reportErrors) { - reportError(ts.Diagnostics.Signature_0_must_have_a_type_predicate, signatureToString(source)); - } - return 0 /* False */; - } - var targetReturnType = getReturnTypeOfSignature(target); - if (targetReturnType === voidType) - return result; - var sourceReturnType = getReturnTypeOfSignature(source); - return result & isRelatedTo(sourceReturnType, targetReturnType, reportErrors); + return compareSignaturesRelated(source, target, /*ignoreReturnTypes*/ false, reportErrors, reportError, isRelatedTo); } function signaturesIdenticalTo(source, target, kind) { var sourceSignatures = getSignaturesOfType(source, kind); @@ -18956,8 +21266,8 @@ var ts; return 0 /* False */; } var result = -1 /* True */; - for (var i = 0, len = sourceSignatures.length; i < len; ++i) { - var related = compareSignatures(sourceSignatures[i], targetSignatures[i], /*partialMatch*/ false, /*ignoreReturnTypes*/ false, isRelatedTo); + for (var i = 0, len = sourceSignatures.length; i < len; i++) { + var related = compareSignaturesIdentical(sourceSignatures[i], targetSignatures[i], /*partialMatch*/ false, /*ignoreThisTypes*/ false, /*ignoreReturnTypes*/ false, isRelatedTo); if (!related) { return 0 /* False */; } @@ -18965,83 +21275,130 @@ var ts; } return result; } - function stringIndexTypesRelatedTo(source, originalSource, target, reportErrors) { - if (relation === identityRelation) { - return indexTypesIdenticalTo(0 /* String */, source, target); - } - var targetType = getIndexTypeOfType(target, 0 /* String */); - if (targetType) { - if ((targetType.flags & 1 /* Any */) && !(originalSource.flags & 16777726 /* Primitive */)) { - // non-primitive assignment to any is always allowed, eg - // `var x: { [index: string]: any } = { property: 12 };` - return -1 /* True */; - } - var sourceType = getIndexTypeOfType(source, 0 /* String */); - if (!sourceType) { - if (reportErrors) { - reportError(ts.Diagnostics.Index_signature_is_missing_in_type_0, typeToString(source)); + function eachPropertyRelatedTo(source, target, kind, reportErrors) { + var result = -1 /* True */; + for (var _i = 0, _a = getPropertiesOfObjectType(source); _i < _a.length; _i++) { + var prop = _a[_i]; + if (kind === 0 /* String */ || isNumericLiteralName(prop.name)) { + var related = isRelatedTo(getTypeOfSymbol(prop), target, reportErrors); + if (!related) { + if (reportErrors) { + reportError(ts.Diagnostics.Property_0_is_incompatible_with_index_signature, symbolToString(prop)); + } + return 0 /* False */; } - return 0 /* False */; + result &= related; } - var related = isRelatedTo(sourceType, targetType, reportErrors); - if (!related) { - if (reportErrors) { - reportError(ts.Diagnostics.Index_signatures_are_incompatible); - } - return 0 /* False */; - } - return related; } - return -1 /* True */; + return result; } - function numberIndexTypesRelatedTo(source, originalSource, target, reportErrors) { - if (relation === identityRelation) { - return indexTypesIdenticalTo(1 /* Number */, source, target); + function indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors) { + var related = isRelatedTo(sourceInfo.type, targetInfo.type, reportErrors); + if (!related && reportErrors) { + reportError(ts.Diagnostics.Index_signatures_are_incompatible); } - var targetType = getIndexTypeOfType(target, 1 /* Number */); - if (targetType) { - if ((targetType.flags & 1 /* Any */) && !(originalSource.flags & 16777726 /* Primitive */)) { - // non-primitive assignment to any is always allowed, eg - // `var x: { [index: number]: any } = { property: 12 };` - return -1 /* True */; - } - var sourceStringType = getIndexTypeOfType(source, 0 /* String */); - var sourceNumberType = getIndexTypeOfType(source, 1 /* Number */); - if (!(sourceStringType || sourceNumberType)) { - if (reportErrors) { - reportError(ts.Diagnostics.Index_signature_is_missing_in_type_0, typeToString(source)); - } - return 0 /* False */; - } - var related; - if (sourceStringType && sourceNumberType) { - // If we know for sure we're testing both string and numeric index types then only report errors from the second one - related = isRelatedTo(sourceStringType, targetType, false) || isRelatedTo(sourceNumberType, targetType, reportErrors); - } - else { - related = isRelatedTo(sourceStringType || sourceNumberType, targetType, reportErrors); - } - if (!related) { - if (reportErrors) { - reportError(ts.Diagnostics.Index_signatures_are_incompatible); - } - return 0 /* False */; - } - return related; - } - return -1 /* True */; + return related; } - function indexTypesIdenticalTo(indexKind, source, target) { - var targetType = getIndexTypeOfType(target, indexKind); - var sourceType = getIndexTypeOfType(source, indexKind); - if (!sourceType && !targetType) { + function indexTypesRelatedTo(source, originalSource, target, kind, reportErrors) { + if (relation === identityRelation) { + return indexTypesIdenticalTo(source, target, kind); + } + var targetInfo = getIndexInfoOfType(target, kind); + if (!targetInfo || ((targetInfo.type.flags & 1 /* Any */) && !(originalSource.flags & 16777726 /* Primitive */))) { + // Index signature of type any permits assignment from everything but primitives return -1 /* True */; } - if (sourceType && targetType) { - return isRelatedTo(sourceType, targetType); + var sourceInfo = getIndexInfoOfType(source, kind) || + kind === 1 /* Number */ && getIndexInfoOfType(source, 0 /* String */); + if (sourceInfo) { + return indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors); + } + if (isObjectLiteralType(source)) { + var related = -1 /* True */; + if (kind === 0 /* String */) { + var sourceNumberInfo = getIndexInfoOfType(source, 1 /* Number */); + if (sourceNumberInfo) { + related = indexInfoRelatedTo(sourceNumberInfo, targetInfo, reportErrors); + } + } + if (related) { + related &= eachPropertyRelatedTo(source, targetInfo.type, kind, reportErrors); + } + return related; + } + if (reportErrors) { + reportError(ts.Diagnostics.Index_signature_is_missing_in_type_0, typeToString(source)); } return 0 /* False */; } + function indexTypesIdenticalTo(source, target, indexKind) { + var targetInfo = getIndexInfoOfType(target, indexKind); + var sourceInfo = getIndexInfoOfType(source, indexKind); + if (!sourceInfo && !targetInfo) { + return -1 /* True */; + } + if (sourceInfo && targetInfo && sourceInfo.isReadonly === targetInfo.isReadonly) { + return isRelatedTo(sourceInfo.type, targetInfo.type); + } + return 0 /* False */; + } + function enumRelatedTo(source, target, reportErrors) { + if (source.symbol.name !== target.symbol.name || + source.symbol.flags & 128 /* ConstEnum */ || + target.symbol.flags & 128 /* ConstEnum */) { + return 0 /* False */; + } + var targetEnumType = getTypeOfSymbol(target.symbol); + for (var _i = 0, _a = getPropertiesOfType(getTypeOfSymbol(source.symbol)); _i < _a.length; _i++) { + var property = _a[_i]; + if (property.flags & 8 /* EnumMember */) { + var targetProperty = getPropertyOfType(targetEnumType, property.name); + if (!targetProperty || !(targetProperty.flags & 8 /* EnumMember */)) { + if (reportErrors) { + reportError(ts.Diagnostics.Property_0_is_missing_in_type_1, property.name, typeToString(target, /*enclosingDeclaration*/ undefined, 128 /* UseFullyQualifiedType */)); + } + return 0 /* False */; + } + } + } + return -1 /* True */; + } + function constructorVisibilitiesAreCompatible(sourceSignature, targetSignature, reportErrors) { + if (!sourceSignature.declaration || !targetSignature.declaration) { + return true; + } + var sourceAccessibility = sourceSignature.declaration.flags & (8 /* Private */ | 16 /* Protected */); + var targetAccessibility = targetSignature.declaration.flags & (8 /* Private */ | 16 /* Protected */); + // A public, protected and private signature is assignable to a private signature. + if (targetAccessibility === 8 /* Private */) { + return true; + } + // A public and protected signature is assignable to a protected signature. + if (targetAccessibility === 16 /* Protected */ && sourceAccessibility !== 8 /* Private */) { + return true; + } + // Only a public signature is assignable to public signature. + if (targetAccessibility !== 16 /* Protected */ && !sourceAccessibility) { + return true; + } + if (reportErrors) { + reportError(ts.Diagnostics.Cannot_assign_a_0_constructor_type_to_a_1_constructor_type, visibilityToString(sourceAccessibility), visibilityToString(targetAccessibility)); + } + return false; + } + } + // Return true if the given type is the constructor type for an abstract class + function isAbstractConstructorType(type) { + if (type.flags & 65536 /* Anonymous */) { + var symbol = type.symbol; + if (symbol && symbol.flags & 32 /* Class */) { + var declaration = getClassLikeDeclarationOfSymbol(symbol); + if (declaration && declaration.flags & 128 /* Abstract */) { + return true; + } + } + } + return false; } // Return true if the given type is part of a deeply nested chain of generic instantiations. We consider this to be the case // when structural type comparisons have been started for 10 or more instantiations of the same generic type. It is possible, @@ -19065,7 +21422,7 @@ var ts; return false; } function isPropertyIdenticalTo(sourceProp, targetProp) { - return compareProperties(sourceProp, targetProp, compareTypes) !== 0 /* False */; + return compareProperties(sourceProp, targetProp, compareTypesIdentical) !== 0 /* False */; } function compareProperties(sourceProp, targetProp, compareTypes) { // Two members are considered identical when @@ -19074,8 +21431,8 @@ var ts; if (sourceProp === targetProp) { return -1 /* True */; } - var sourcePropAccessibility = getDeclarationFlagsFromSymbol(sourceProp) & (16 /* Private */ | 32 /* Protected */); - var targetPropAccessibility = getDeclarationFlagsFromSymbol(targetProp) & (16 /* Private */ | 32 /* Protected */); + var sourcePropAccessibility = getDeclarationFlagsFromSymbol(sourceProp) & (8 /* Private */ | 16 /* Protected */); + var targetPropAccessibility = getDeclarationFlagsFromSymbol(targetProp) & (8 /* Private */ | 16 /* Protected */); if (sourcePropAccessibility !== targetPropAccessibility) { return 0 /* False */; } @@ -19089,6 +21446,9 @@ var ts; return 0 /* False */; } } + if (isReadonlySymbol(sourceProp) !== isReadonlySymbol(targetProp)) { + return 0 /* False */; + } return compareTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp)); } function isMatchingSignature(source, target, partialMatch) { @@ -19108,37 +21468,41 @@ var ts; } return false; } - function compareSignatures(source, target, partialMatch, ignoreReturnTypes, compareTypes) { + /** + * See signatureRelatedTo, compareSignaturesIdentical + */ + function compareSignaturesIdentical(source, target, partialMatch, ignoreThisTypes, ignoreReturnTypes, compareTypes) { + // TODO (drosen): De-duplicate code between related functions. if (source === target) { return -1 /* True */; } if (!(isMatchingSignature(source, target, partialMatch))) { return 0 /* False */; } - var result = -1 /* True */; - if (source.typeParameters && target.typeParameters) { - if (source.typeParameters.length !== target.typeParameters.length) { - return 0 /* False */; - } - for (var i = 0, len = source.typeParameters.length; i < len; ++i) { - var related = compareTypes(source.typeParameters[i], target.typeParameters[i]); - if (!related) { - return 0 /* False */; - } - result &= related; - } - } - else if (source.typeParameters || target.typeParameters) { + // Check that the two signatures have the same number of type parameters. We might consider + // also checking that any type parameter constraints match, but that would require instantiating + // the constraints with a common set of type arguments to get relatable entities in places where + // type parameters occur in the constraints. The complexity of doing that doesn't seem worthwhile, + // particularly as we're comparing erased versions of the signatures below. + if ((source.typeParameters ? source.typeParameters.length : 0) !== (target.typeParameters ? target.typeParameters.length : 0)) { return 0 /* False */; } // Spec 1.0 Section 3.8.3 & 3.8.4: // M and N (the signatures) are instantiated using type Any as the type argument for all type parameters declared by M and N source = getErasedSignature(source); target = getErasedSignature(target); + var result = -1 /* True */; + if (!ignoreThisTypes && source.thisType && target.thisType) { + var related = compareTypes(source.thisType, target.thisType); + if (!related) { + return 0 /* False */; + } + result &= related; + } var targetLen = target.parameters.length; for (var i = 0; i < targetLen; i++) { - var s = isRestParameterIndex(source, i) ? getRestTypeOfSignature(source) : getTypeOfSymbol(source.parameters[i]); - var t = isRestParameterIndex(target, i) ? getRestTypeOfSignature(target) : getTypeOfSymbol(target.parameters[i]); + var s = isRestParameterIndex(source, i) ? getRestTypeOfSignature(source) : getTypeOfParameter(source.parameters[i]); + var t = isRestParameterIndex(target, i) ? getRestTypeOfSignature(target) : getTypeOfParameter(target.parameters[i]); var related = compareTypes(s, t); if (!related) { return 0 /* False */; @@ -19154,15 +21518,31 @@ var ts; return signature.hasRestParameter && parameterIndex >= signature.parameters.length - 1; } function isSupertypeOfEach(candidate, types) { - for (var _i = 0, types_6 = types; _i < types_6.length; _i++) { - var type = types_6[_i]; - if (candidate !== type && !isTypeSubtypeOf(type, candidate)) + for (var _i = 0, types_5 = types; _i < types_5.length; _i++) { + var t = types_5[_i]; + if (candidate !== t && !isTypeSubtypeOf(t, candidate)) return false; } return true; } + function getCombinedFlagsOfTypes(types) { + var flags = 0; + for (var _i = 0, types_6 = types; _i < types_6.length; _i++) { + var t = types_6[_i]; + flags |= t.flags; + } + return flags; + } function getCommonSupertype(types) { - return ts.forEach(types, function (t) { return isSupertypeOfEach(t, types) ? t : undefined; }); + if (!strictNullChecks) { + return ts.forEach(types, function (t) { return isSupertypeOfEach(t, types) ? t : undefined; }); + } + var primaryTypes = ts.filter(types, function (t) { return !(t.flags & 96 /* Nullable */); }); + if (!primaryTypes.length) { + return getUnionType(types); + } + var supertype = ts.forEach(primaryTypes, function (t) { return isSupertypeOfEach(t, primaryTypes) ? t : undefined; }); + return supertype && addNullableKind(supertype, getCombinedFlagsOfTypes(types) & 96 /* Nullable */); } function reportNoCommonSupertypeError(types, errorLocation, errorMessageChainHead) { // The downfallType/bestSupertypeDownfallType is the first type that caused a particular candidate @@ -19201,8 +21581,10 @@ var ts; return type.flags & 4096 /* Reference */ && type.target === globalArrayType; } function isArrayLikeType(type) { - // A type is array-like if it is not the undefined or null type and if it is assignable to any[] - return !(type.flags & (32 /* Undefined */ | 64 /* Null */)) && isTypeAssignableTo(type, anyArrayType); + // A type is array-like if it is a reference to the global Array or global ReadonlyArray type, + // or if it is not the undefined or null type and if it is assignable to ReadonlyArray + return type.flags & 4096 /* Reference */ && (type.target === globalArrayType || type.target === globalReadonlyArrayType) || + !(type.flags & 96 /* Nullable */) && isTypeAssignableTo(type, anyReadonlyArrayType); } function isTupleLikeType(type) { return !!getPropertyOfType(type, "0"); @@ -19217,6 +21599,41 @@ var ts; function isTupleType(type) { return !!(type.flags & 8192 /* Tuple */); } + function getNullableKind(type) { + var flags = type.flags; + if (flags & 16384 /* Union */) { + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var t = _a[_i]; + flags |= t.flags; + } + } + return flags & 96 /* Nullable */; + } + function addNullableKind(type, kind) { + if ((getNullableKind(type) & kind) !== kind) { + var types = [type]; + if (kind & 32 /* Undefined */) { + types.push(undefinedType); + } + if (kind & 64 /* Null */) { + types.push(nullType); + } + type = getUnionType(types); + } + return type; + } + function getNonNullableType(type) { + return strictNullChecks ? getTypeWithFacts(type, 524288 /* NEUndefinedOrNull */) : type; + } + /** + * Return true if type was inferred from an object literal or written as an object type literal + * with no call or construct signatures. + */ + function isObjectLiteralType(type) { + return type.symbol && (type.symbol.flags & (4096 /* ObjectLiteral */ | 2048 /* TypeLiteral */)) !== 0 && + getSignaturesOfType(type, 0 /* Call */).length === 0 && + getSignaturesOfType(type, 1 /* Construct */).length === 0; + } function getRegularTypeOfObjectLiteral(type) { if (type.flags & 1048576 /* FreshObjectLiteral */) { var regularType = type.regularType; @@ -19227,8 +21644,8 @@ var ts; regularType.properties = type.properties; regularType.callSignatures = type.callSignatures; regularType.constructSignatures = type.constructSignatures; - regularType.stringIndexType = type.stringIndexType; - regularType.numberIndexType = type.numberIndexType; + regularType.stringIndexInfo = type.stringIndexInfo; + regularType.numberIndexInfo = type.numberIndexInfo; type.regularType = regularType; } return regularType; @@ -19253,24 +21670,23 @@ var ts; } members[p.name] = p; }); - var stringIndexType = getIndexTypeOfType(type, 0 /* String */); - var numberIndexType = getIndexTypeOfType(type, 1 /* Number */); - if (stringIndexType) - stringIndexType = getWidenedType(stringIndexType); - if (numberIndexType) - numberIndexType = getWidenedType(numberIndexType); - return createAnonymousType(type.symbol, members, emptyArray, emptyArray, stringIndexType, numberIndexType); + var stringIndexInfo = getIndexInfoOfType(type, 0 /* String */); + var numberIndexInfo = getIndexInfoOfType(type, 1 /* Number */); + return createAnonymousType(type.symbol, members, emptyArray, emptyArray, stringIndexInfo && createIndexInfo(getWidenedType(stringIndexInfo.type), stringIndexInfo.isReadonly), numberIndexInfo && createIndexInfo(getWidenedType(numberIndexInfo.type), numberIndexInfo.isReadonly)); + } + function getWidenedConstituentType(type) { + return type.flags & 96 /* Nullable */ ? type : getWidenedType(type); } function getWidenedType(type) { if (type.flags & 6291456 /* RequiresWidening */) { - if (type.flags & (32 /* Undefined */ | 64 /* Null */)) { + if (type.flags & 96 /* Nullable */) { return anyType; } if (type.flags & 524288 /* ObjectLiteral */) { return getWidenedTypeOfObjectLiteral(type); } if (type.flags & 16384 /* Union */) { - return getUnionType(ts.map(type.types, getWidenedType), /*noSubtypeReduction*/ true); + return getUnionType(ts.map(type.types, getWidenedConstituentType), /*noSubtypeReduction*/ true); } if (isArrayType(type)) { return createArrayType(getWidenedType(type.typeArguments[0])); @@ -19331,22 +21747,25 @@ var ts; var typeAsString = typeToString(getWidenedType(type)); var diagnostic; switch (declaration.kind) { - case 141 /* PropertyDeclaration */: - case 140 /* PropertySignature */: + case 145 /* PropertyDeclaration */: + case 144 /* PropertySignature */: diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type; break; - case 138 /* Parameter */: + case 142 /* Parameter */: diagnostic = declaration.dotDotDotToken ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; break; - case 213 /* FunctionDeclaration */: - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: - case 173 /* FunctionExpression */: - case 174 /* ArrowFunction */: + case 169 /* BindingElement */: + diagnostic = ts.Diagnostics.Binding_element_0_implicitly_has_an_1_type; + break; + case 220 /* FunctionDeclaration */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: + case 179 /* FunctionExpression */: + case 180 /* ArrowFunction */: if (!declaration.name) { error(declaration, ts.Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString); return; @@ -19371,35 +21790,23 @@ var ts; var targetMax = target.parameters.length; var count; if (source.hasRestParameter && target.hasRestParameter) { - count = sourceMax > targetMax ? sourceMax : targetMax; - sourceMax--; - targetMax--; + count = Math.max(sourceMax, targetMax); } else if (source.hasRestParameter) { - sourceMax--; count = targetMax; } else if (target.hasRestParameter) { - targetMax--; count = sourceMax; } else { - count = sourceMax < targetMax ? sourceMax : targetMax; + count = Math.min(sourceMax, targetMax); } for (var i = 0; i < count; i++) { - var s = i < sourceMax ? getTypeOfSymbol(source.parameters[i]) : getRestTypeOfSignature(source); - var t = i < targetMax ? getTypeOfSymbol(target.parameters[i]) : getRestTypeOfSignature(target); - callback(s, t); + callback(getTypeAtPosition(source, i), getTypeAtPosition(target, i)); } } function createInferenceContext(typeParameters, inferUnionTypes) { - var inferences = []; - for (var _i = 0, typeParameters_1 = typeParameters; _i < typeParameters_1.length; _i++) { - var unused = typeParameters_1[_i]; - inferences.push({ - primary: undefined, secondary: undefined, isFixed: false - }); - } + var inferences = ts.map(typeParameters, createTypeInferencesObject); return { typeParameters: typeParameters, inferUnionTypes: inferUnionTypes, @@ -19407,11 +21814,19 @@ var ts; inferredTypes: new Array(typeParameters.length) }; } + function createTypeInferencesObject() { + return { + primary: undefined, + secondary: undefined, + isFixed: false + }; + } function inferTypes(context, source, target) { var sourceStack; var targetStack; var depth = 0; var inferiority = 0; + var visited = {}; inferFromTypes(source, target); function isInProcess(source, target) { for (var i = 0; i < depth; i++) { @@ -19422,6 +21837,29 @@ var ts; return false; } function inferFromTypes(source, target) { + if (source.flags & 16384 /* Union */ && target.flags & 16384 /* Union */ || + source.flags & 32768 /* Intersection */ && target.flags & 32768 /* Intersection */) { + // Source and target are both unions or both intersections. First, find each + // target constituent type that has an identically matching source constituent + // type, and for each such target constituent type infer from the type to itself. + // When inferring from a type to itself we effectively find all type parameter + // occurrences within that type and infer themselves as their type arguments. + var matchingTypes = void 0; + for (var _i = 0, _a = target.types; _i < _a.length; _i++) { + var t = _a[_i]; + if (typeIdenticalToSomeType(t, source.types)) { + (matchingTypes || (matchingTypes = [])).push(t); + inferFromTypes(t, t); + } + } + // Next, to improve the quality of inferences, reduce the source and target types by + // removing the identically matched constituents. For example, when inferring from + // 'string | string[]' to 'string | T' we reduce the types to 'string[]' and 'T'. + if (matchingTypes) { + source = removeTypesFromUnionOrIntersection(source, matchingTypes); + target = removeTypesFromUnionOrIntersection(target, matchingTypes); + } + } if (target.flags & 512 /* TypeParameter */) { // If target is a type parameter, make an inference, unless the source type contains // the anyFunctionType (the wildcard type that's used to avoid contextually typing functions). @@ -19474,10 +21912,10 @@ var ts; else if (target.flags & 49152 /* UnionOrIntersection */) { var targetTypes = target.types; var typeParameterCount = 0; - var typeParameter; + var typeParameter = void 0; // First infer to each type in union or intersection that isn't a type parameter - for (var _i = 0, targetTypes_2 = targetTypes; _i < targetTypes_2.length; _i++) { - var t = targetTypes_2[_i]; + for (var _b = 0, targetTypes_2 = targetTypes; _b < targetTypes_2.length; _b++) { + var t = targetTypes_2[_b]; if (t.flags & 512 /* TypeParameter */ && ts.contains(context.typeParameters, t)) { typeParameter = t; typeParameterCount++; @@ -19497,24 +21935,31 @@ var ts; } } else if (source.flags & 49152 /* UnionOrIntersection */) { - // Source is a union or intersection type, infer from each consituent type + // Source is a union or intersection type, infer from each constituent type var sourceTypes = source.types; - for (var _a = 0, sourceTypes_3 = sourceTypes; _a < sourceTypes_3.length; _a++) { - var sourceType = sourceTypes_3[_a]; + for (var _c = 0, sourceTypes_3 = sourceTypes; _c < sourceTypes_3.length; _c++) { + var sourceType = sourceTypes_3[_c]; inferFromTypes(sourceType, target); } } else { source = getApparentType(source); - if (source.flags & 80896 /* ObjectType */ && (target.flags & (4096 /* Reference */ | 8192 /* Tuple */) || - (target.flags & 65536 /* Anonymous */) && target.symbol && target.symbol.flags & (8192 /* Method */ | 2048 /* TypeLiteral */ | 32 /* Class */))) { - // If source is an object type, and target is a type reference, a tuple type, the type of a method, or a type literal, infer from members + if (source.flags & 80896 /* ObjectType */ && (target.flags & 4096 /* Reference */ && target.typeArguments || + target.flags & 8192 /* Tuple */ || + target.flags & 65536 /* Anonymous */ && target.symbol && target.symbol.flags & (8192 /* Method */ | 2048 /* TypeLiteral */ | 32 /* Class */))) { + // If source is an object type, and target is a type reference with type arguments, a tuple type, + // the type of a method, or a type literal, infer from members if (isInProcess(source, target)) { return; } if (isDeeplyNestedGeneric(source, sourceStack, depth) && isDeeplyNestedGeneric(target, targetStack, depth)) { return; } + var key = source.id + "," + target.id; + if (ts.hasProperty(visited, key)) { + return; + } + visited[key] = true; if (depth === 0) { sourceStack = []; targetStack = []; @@ -19525,9 +21970,7 @@ var ts; inferFromProperties(source, target); inferFromSignatures(source, target, 0 /* Call */); inferFromSignatures(source, target, 1 /* Construct */); - inferFromIndexTypes(source, target, 0 /* String */, 0 /* String */); - inferFromIndexTypes(source, target, 1 /* Number */, 1 /* Number */); - inferFromIndexTypes(source, target, 0 /* String */, 1 /* Number */); + inferFromIndexTypes(source, target); depth--; } } @@ -19554,28 +21997,56 @@ var ts; } function inferFromSignature(source, target) { forEachMatchingParameterType(source, target, inferFromTypes); - if (source.typePredicate && target.typePredicate) { - if (target.typePredicate.parameterIndex === source.typePredicate.parameterIndex) { - // Return types from type predicates are treated as booleans. In order to infer types - // from type predicates we would need to infer using the type within the type predicate - // (i.e. 'Foo' from 'x is Foo'). - inferFromTypes(source.typePredicate.type, target.typePredicate.type); - } + if (source.typePredicate && target.typePredicate && source.typePredicate.kind === target.typePredicate.kind) { + inferFromTypes(source.typePredicate.type, target.typePredicate.type); } else { inferFromTypes(getReturnTypeOfSignature(source), getReturnTypeOfSignature(target)); } } - function inferFromIndexTypes(source, target, sourceKind, targetKind) { - var targetIndexType = getIndexTypeOfType(target, targetKind); - if (targetIndexType) { - var sourceIndexType = getIndexTypeOfType(source, sourceKind); + function inferFromIndexTypes(source, target) { + var targetStringIndexType = getIndexTypeOfType(target, 0 /* String */); + if (targetStringIndexType) { + var sourceIndexType = getIndexTypeOfType(source, 0 /* String */) || + getImplicitIndexTypeOfType(source, 0 /* String */); if (sourceIndexType) { - inferFromTypes(sourceIndexType, targetIndexType); + inferFromTypes(sourceIndexType, targetStringIndexType); + } + } + var targetNumberIndexType = getIndexTypeOfType(target, 1 /* Number */); + if (targetNumberIndexType) { + var sourceIndexType = getIndexTypeOfType(source, 1 /* Number */) || + getIndexTypeOfType(source, 0 /* String */) || + getImplicitIndexTypeOfType(source, 1 /* Number */); + if (sourceIndexType) { + inferFromTypes(sourceIndexType, targetNumberIndexType); } } } } + function typeIdenticalToSomeType(type, types) { + for (var _i = 0, types_7 = types; _i < types_7.length; _i++) { + var t = types_7[_i]; + if (isTypeIdenticalTo(t, type)) { + return true; + } + } + return false; + } + /** + * Return a new union or intersection type computed by removing a given set of types + * from a given union or intersection type. + */ + function removeTypesFromUnionOrIntersection(type, typesToRemove) { + var reducedTypes = []; + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var t = _a[_i]; + if (!typeIdenticalToSomeType(t, typesToRemove)) { + reducedTypes.push(t); + } + } + return type.flags & 16384 /* Union */ ? getUnionType(reducedTypes, /*noSubtypeReduction*/ true) : getIntersectionType(reducedTypes); + } function getInferenceCandidates(context, index) { var inferences = context.inferences[index]; return inferences.primary || inferences.secondary || emptyArray; @@ -19599,10 +22070,16 @@ var ts; inferredType = emptyObjectType; inferenceSucceeded = true; } + context.inferredTypes[index] = inferredType; // Only do the constraint check if inference succeeded (to prevent cascading errors) if (inferenceSucceeded) { var constraint = getConstraintOfTypeParameter(context.typeParameters[index]); - inferredType = constraint && !isTypeAssignableTo(inferredType, constraint) ? constraint : inferredType; + if (constraint) { + var instantiatedConstraint = instantiateType(constraint, getInferenceMapper(context)); + if (!isTypeAssignableTo(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) { + context.inferredTypes[index] = inferredType = instantiatedConstraint; + } + } } else if (context.failedTypeParameterIndex === undefined || context.failedTypeParameterIndex > index) { // If inference failed, it is necessary to record the index of the failed type parameter (the one we are on). @@ -19610,7 +22087,6 @@ var ts; // So if this failure is on preceding type parameter, this type parameter is the new failure index. context.failedTypeParameterIndex = index; } - context.inferredTypes[index] = inferredType; } return inferredType; } @@ -19620,14 +22096,11 @@ var ts; } return context.inferredTypes; } - function hasAncestor(node, kind) { - return ts.getAncestor(node, kind) !== undefined; - } // EXPRESSION TYPE CHECKING function getResolvedSymbol(node) { var links = getNodeLinks(node); if (!links.resolvedSymbol) { - links.resolvedSymbol = (!ts.nodeIsMissing(node) && resolveName(node, node.text, 107455 /* Value */ | 1048576 /* ExportValue */, ts.Diagnostics.Cannot_find_name_0, node)) || unknownSymbol; + links.resolvedSymbol = !ts.nodeIsMissing(node) && resolveName(node, node.text, 107455 /* Value */ | 1048576 /* ExportValue */, ts.Diagnostics.Cannot_find_name_0, node) || unknownSymbol; } return links.resolvedSymbol; } @@ -19637,10 +22110,10 @@ var ts; // The expression is restricted to a single identifier or a sequence of identifiers separated by periods while (node) { switch (node.kind) { - case 154 /* TypeQuery */: + case 158 /* TypeQuery */: return true; case 69 /* Identifier */: - case 135 /* QualifiedName */: + case 139 /* QualifiedName */: node = node.parent; continue; default: @@ -19649,240 +22122,523 @@ var ts; } ts.Debug.fail("should not get here"); } - // For a union type, remove all constituent types that are of the given type kind (when isOfTypeKind is true) - // or not of the given type kind (when isOfTypeKind is false) - function removeTypesFromUnionType(type, typeKind, isOfTypeKind, allowEmptyUnionResult) { - if (type.flags & 16384 /* Union */) { - var types = type.types; - if (ts.forEach(types, function (t) { return !!(t.flags & typeKind) === isOfTypeKind; })) { - // Above we checked if we have anything to remove, now use the opposite test to do the removal - var narrowedType = getUnionType(ts.filter(types, function (t) { return !(t.flags & typeKind) === isOfTypeKind; })); - if (allowEmptyUnionResult || narrowedType !== emptyObjectType) { - return narrowedType; - } + // Return the flow cache key for a "dotted name" (i.e. a sequence of identifiers + // separated by dots). The key consists of the id of the symbol referenced by the + // leftmost identifier followed by zero or more property names separated by dots. + // The result is undefined if the reference isn't a dotted name. + function getFlowCacheKey(node) { + if (node.kind === 69 /* Identifier */) { + var symbol = getResolvedSymbol(node); + return symbol !== unknownSymbol ? "" + getSymbolId(symbol) : undefined; + } + if (node.kind === 97 /* ThisKeyword */) { + return "0"; + } + if (node.kind === 172 /* PropertyAccessExpression */) { + var key = getFlowCacheKey(node.expression); + return key && key + "." + node.name.text; + } + return undefined; + } + function isNullOrUndefinedLiteral(node) { + return node.kind === 93 /* NullKeyword */ || + node.kind === 69 /* Identifier */ && getResolvedSymbol(node) === undefinedSymbol; + } + function getLeftmostIdentifierOrThis(node) { + switch (node.kind) { + case 69 /* Identifier */: + case 97 /* ThisKeyword */: + return node; + case 172 /* PropertyAccessExpression */: + return getLeftmostIdentifierOrThis(node.expression); + } + return undefined; + } + function isMatchingReference(source, target) { + if (source.kind === target.kind) { + switch (source.kind) { + case 69 /* Identifier */: + return getResolvedSymbol(source) === getResolvedSymbol(target); + case 97 /* ThisKeyword */: + return true; + case 172 /* PropertyAccessExpression */: + return source.name.text === target.name.text && + isMatchingReference(source.expression, target.expression); } } - else if (allowEmptyUnionResult && !!(type.flags & typeKind) === isOfTypeKind) { - // Use getUnionType(emptyArray) instead of emptyObjectType in case the way empty union types - // are represented ever changes. - return getUnionType(emptyArray); - } - return type; + return false; } - function hasInitializer(node) { - return !!(node.initializer || ts.isBindingPattern(node.parent) && hasInitializer(node.parent.parent)); - } - // Check if a given variable is assigned within a given syntax node - function isVariableAssignedWithin(symbol, node) { - var links = getNodeLinks(node); - if (links.assignmentChecks) { - var cachedResult = links.assignmentChecks[symbol.id]; - if (cachedResult !== undefined) { - return cachedResult; + function containsMatchingReference(source, target) { + while (source.kind === 172 /* PropertyAccessExpression */) { + source = source.expression; + if (isMatchingReference(source, target)) { + return true; } } - else { - links.assignmentChecks = {}; - } - return links.assignmentChecks[symbol.id] = isAssignedIn(node); - function isAssignedInBinaryExpression(node) { - if (node.operatorToken.kind >= 56 /* FirstAssignment */ && node.operatorToken.kind <= 68 /* LastAssignment */) { - var n = node.left; - while (n.kind === 172 /* ParenthesizedExpression */) { - n = n.expression; - } - if (n.kind === 69 /* Identifier */ && getResolvedSymbol(n) === symbol) { + return false; + } + function isOrContainsMatchingReference(source, target) { + return isMatchingReference(source, target) || containsMatchingReference(source, target); + } + function hasMatchingArgument(callExpression, reference) { + if (callExpression.arguments) { + for (var _i = 0, _a = callExpression.arguments; _i < _a.length; _i++) { + var argument = _a[_i]; + if (isOrContainsMatchingReference(reference, argument)) { return true; } } - return ts.forEachChild(node, isAssignedIn); } - function isAssignedInVariableDeclaration(node) { - if (!ts.isBindingPattern(node.name) && getSymbolOfNode(node) === symbol && hasInitializer(node)) { + if (callExpression.expression.kind === 172 /* PropertyAccessExpression */ && + isOrContainsMatchingReference(reference, callExpression.expression.expression)) { + return true; + } + return false; + } + function getFlowNodeId(flow) { + if (!flow.id) { + flow.id = nextFlowId; + nextFlowId++; + } + return flow.id; + } + function typeMaybeAssignableTo(source, target) { + if (!(source.flags & 16384 /* Union */)) { + return isTypeAssignableTo(source, target); + } + for (var _i = 0, _a = source.types; _i < _a.length; _i++) { + var t = _a[_i]; + if (isTypeAssignableTo(t, target)) { return true; } - return ts.forEachChild(node, isAssignedIn); - } - function isAssignedIn(node) { - switch (node.kind) { - case 181 /* BinaryExpression */: - return isAssignedInBinaryExpression(node); - case 211 /* VariableDeclaration */: - case 163 /* BindingElement */: - return isAssignedInVariableDeclaration(node); - case 161 /* ObjectBindingPattern */: - case 162 /* ArrayBindingPattern */: - case 164 /* ArrayLiteralExpression */: - case 165 /* ObjectLiteralExpression */: - case 166 /* PropertyAccessExpression */: - case 167 /* ElementAccessExpression */: - case 168 /* CallExpression */: - case 169 /* NewExpression */: - case 171 /* TypeAssertionExpression */: - case 189 /* AsExpression */: - case 172 /* ParenthesizedExpression */: - case 179 /* PrefixUnaryExpression */: - case 175 /* DeleteExpression */: - case 178 /* AwaitExpression */: - case 176 /* TypeOfExpression */: - case 177 /* VoidExpression */: - case 180 /* PostfixUnaryExpression */: - case 184 /* YieldExpression */: - case 182 /* ConditionalExpression */: - case 185 /* SpreadElementExpression */: - case 192 /* Block */: - case 193 /* VariableStatement */: - case 195 /* ExpressionStatement */: - case 196 /* IfStatement */: - case 197 /* DoStatement */: - case 198 /* WhileStatement */: - case 199 /* ForStatement */: - case 200 /* ForInStatement */: - case 201 /* ForOfStatement */: - case 204 /* ReturnStatement */: - case 205 /* WithStatement */: - case 206 /* SwitchStatement */: - case 241 /* CaseClause */: - case 242 /* DefaultClause */: - case 207 /* LabeledStatement */: - case 208 /* ThrowStatement */: - case 209 /* TryStatement */: - case 244 /* CatchClause */: - case 233 /* JsxElement */: - case 234 /* JsxSelfClosingElement */: - case 238 /* JsxAttribute */: - case 239 /* JsxSpreadAttribute */: - case 235 /* JsxOpeningElement */: - case 240 /* JsxExpression */: - return ts.forEachChild(node, isAssignedIn); - } - return false; } + return false; } - // Get the narrowed type of a given symbol at a given location - function getNarrowedTypeOfSymbol(symbol, node) { - var type = getTypeOfSymbol(symbol); - // Only narrow when symbol is variable of type any or an object, union, or type parameter type - if (node && symbol.flags & 3 /* Variable */) { - if (isTypeAny(type) || type.flags & (80896 /* ObjectType */ | 16384 /* Union */ | 512 /* TypeParameter */)) { - loop: while (node.parent) { - var child = node; - node = node.parent; - var narrowedType = type; - switch (node.kind) { - case 196 /* IfStatement */: - // In a branch of an if statement, narrow based on controlling expression - if (child !== node.expression) { - narrowedType = narrowType(type, node.expression, /*assumeTrue*/ child === node.thenStatement); - } - break; - case 182 /* ConditionalExpression */: - // In a branch of a conditional expression, narrow based on controlling condition - if (child !== node.condition) { - narrowedType = narrowType(type, node.condition, /*assumeTrue*/ child === node.whenTrue); - } - break; - case 181 /* BinaryExpression */: - // In the right operand of an && or ||, narrow based on left operand - if (child === node.right) { - if (node.operatorToken.kind === 51 /* AmpersandAmpersandToken */) { - narrowedType = narrowType(type, node.left, /*assumeTrue*/ true); - } - else if (node.operatorToken.kind === 52 /* BarBarToken */) { - narrowedType = narrowType(type, node.left, /*assumeTrue*/ false); - } - } - break; - case 248 /* SourceFile */: - case 218 /* ModuleDeclaration */: - case 213 /* FunctionDeclaration */: - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: - case 144 /* Constructor */: - // Stop at the first containing function or module declaration - break loop; - } - // Use narrowed type if construct contains no assignments to variable - if (narrowedType !== type) { - if (isVariableAssignedWithin(symbol, node)) { - break; - } - type = narrowedType; + // Remove those constituent types of declaredType to which no constituent type of assignedType is assignable. + // For example, when a variable of type number | string | boolean is assigned a value of type number | boolean, + // we remove type string. + function getAssignmentReducedType(declaredType, assignedType) { + if (declaredType !== assignedType && declaredType.flags & 16384 /* Union */) { + var reducedTypes = ts.filter(declaredType.types, function (t) { return typeMaybeAssignableTo(assignedType, t); }); + if (reducedTypes.length) { + return reducedTypes.length === 1 ? reducedTypes[0] : getUnionType(reducedTypes); + } + } + return declaredType; + } + function getTypeFacts(type) { + var flags = type.flags; + if (flags & 258 /* StringLike */) { + return strictNullChecks ? 4079361 /* StringStrictFacts */ : 4194049 /* StringFacts */; + } + if (flags & 132 /* NumberLike */) { + return strictNullChecks ? 4079234 /* NumberStrictFacts */ : 4193922 /* NumberFacts */; + } + if (flags & 8 /* Boolean */) { + return strictNullChecks ? 4078980 /* BooleanStrictFacts */ : 4193668 /* BooleanFacts */; + } + if (flags & 80896 /* ObjectType */) { + var resolved = resolveStructuredTypeMembers(type); + return resolved.callSignatures.length || resolved.constructSignatures.length || isTypeSubtypeOf(type, globalFunctionType) ? + strictNullChecks ? 1970144 /* FunctionStrictFacts */ : 4181984 /* FunctionFacts */ : + strictNullChecks ? 1972176 /* ObjectStrictFacts */ : 4184016 /* ObjectFacts */; + } + if (flags & (16 /* Void */ | 32 /* Undefined */)) { + return 2457472 /* UndefinedFacts */; + } + if (flags & 64 /* Null */) { + return 2340752 /* NullFacts */; + } + if (flags & 16777216 /* ESSymbol */) { + return strictNullChecks ? 1981320 /* SymbolStrictFacts */ : 4193160 /* SymbolFacts */; + } + if (flags & 512 /* TypeParameter */) { + var constraint = getConstraintOfTypeParameter(type); + return constraint ? getTypeFacts(constraint) : 4194303 /* All */; + } + if (flags & 32768 /* Intersection */) { + return ts.reduceLeft(type.types, function (flags, type) { return flags |= getTypeFacts(type); }, 0 /* None */); + } + return 4194303 /* All */; + } + function getTypeWithFacts(type, include) { + if (!(type.flags & 16384 /* Union */)) { + return getTypeFacts(type) & include ? type : neverType; + } + var firstType; + var types; + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var t = _a[_i]; + if (getTypeFacts(t) & include) { + if (!firstType) { + firstType = t; + } + else { + if (!types) { + types = [firstType]; } + types.push(t); } } } + return firstType ? types ? getUnionType(types, /*noSubtypeReduction*/ true) : firstType : neverType; + } + function getTypeWithDefault(type, defaultExpression) { + if (defaultExpression) { + var defaultType = checkExpression(defaultExpression); + return getUnionType([getTypeWithFacts(type, 131072 /* NEUndefined */), defaultType]); + } return type; - function narrowTypeByEquality(type, expr, assumeTrue) { - // Check that we have 'typeof ' on the left and string literal on the right - if (expr.left.kind !== 176 /* TypeOfExpression */ || expr.right.kind !== 9 /* StringLiteral */) { + } + function getTypeOfDestructuredProperty(type, name) { + var text = getTextOfPropertyName(name); + return getTypeOfPropertyOfType(type, text) || + isNumericLiteralName(text) && getIndexTypeOfType(type, 1 /* Number */) || + getIndexTypeOfType(type, 0 /* String */) || + unknownType; + } + function getTypeOfDestructuredArrayElement(type, index) { + return isTupleLikeType(type) && getTypeOfPropertyOfType(type, "" + index) || + checkIteratedTypeOrElementType(type, /*errorNode*/ undefined, /*allowStringInput*/ false) || + unknownType; + } + function getTypeOfDestructuredSpreadElement(type) { + return createArrayType(checkIteratedTypeOrElementType(type, /*errorNode*/ undefined, /*allowStringInput*/ false) || unknownType); + } + function getAssignedTypeOfBinaryExpression(node) { + return node.parent.kind === 170 /* ArrayLiteralExpression */ || node.parent.kind === 253 /* PropertyAssignment */ ? + getTypeWithDefault(getAssignedType(node), node.right) : + checkExpression(node.right); + } + function getAssignedTypeOfArrayLiteralElement(node, element) { + return getTypeOfDestructuredArrayElement(getAssignedType(node), ts.indexOf(node.elements, element)); + } + function getAssignedTypeOfSpreadElement(node) { + return getTypeOfDestructuredSpreadElement(getAssignedType(node.parent)); + } + function getAssignedTypeOfPropertyAssignment(node) { + return getTypeOfDestructuredProperty(getAssignedType(node.parent), node.name); + } + function getAssignedTypeOfShorthandPropertyAssignment(node) { + return getTypeWithDefault(getAssignedTypeOfPropertyAssignment(node), node.objectAssignmentInitializer); + } + function getAssignedType(node) { + var parent = node.parent; + switch (parent.kind) { + case 207 /* ForInStatement */: + return stringType; + case 208 /* ForOfStatement */: + return checkRightHandSideOfForOf(parent.expression) || unknownType; + case 187 /* BinaryExpression */: + return getAssignedTypeOfBinaryExpression(parent); + case 181 /* DeleteExpression */: + return undefinedType; + case 170 /* ArrayLiteralExpression */: + return getAssignedTypeOfArrayLiteralElement(parent, node); + case 191 /* SpreadElementExpression */: + return getAssignedTypeOfSpreadElement(parent); + case 253 /* PropertyAssignment */: + return getAssignedTypeOfPropertyAssignment(parent); + case 254 /* ShorthandPropertyAssignment */: + return getAssignedTypeOfShorthandPropertyAssignment(parent); + } + return unknownType; + } + function getInitialTypeOfBindingElement(node) { + var pattern = node.parent; + var parentType = getInitialType(pattern.parent); + var type = pattern.kind === 167 /* ObjectBindingPattern */ ? + getTypeOfDestructuredProperty(parentType, node.propertyName || node.name) : + !node.dotDotDotToken ? + getTypeOfDestructuredArrayElement(parentType, ts.indexOf(pattern.elements, node)) : + getTypeOfDestructuredSpreadElement(parentType); + return getTypeWithDefault(type, node.initializer); + } + function getTypeOfInitializer(node) { + // Return the cached type if one is available. If the type of the variable was inferred + // from its initializer, we'll already have cached the type. Otherwise we compute it now + // without caching such that transient types are reflected. + var links = getNodeLinks(node); + return links.resolvedType || checkExpression(node); + } + function getInitialTypeOfVariableDeclaration(node) { + if (node.initializer) { + return getTypeOfInitializer(node.initializer); + } + if (node.parent.parent.kind === 207 /* ForInStatement */) { + return stringType; + } + if (node.parent.parent.kind === 208 /* ForOfStatement */) { + return checkRightHandSideOfForOf(node.parent.parent.expression) || unknownType; + } + return unknownType; + } + function getInitialType(node) { + return node.kind === 218 /* VariableDeclaration */ ? + getInitialTypeOfVariableDeclaration(node) : + getInitialTypeOfBindingElement(node); + } + function getFlowTypeOfReference(reference, declaredType, assumeInitialized) { + var key; + if (!reference.flowNode || assumeInitialized && !(declaredType.flags & 97793 /* Narrowable */)) { + return declaredType; + } + var initialType = assumeInitialized ? declaredType : addNullableKind(declaredType, 32 /* Undefined */); + var visitedFlowStart = visitedFlowCount; + var result = getTypeAtFlowNode(reference.flowNode); + visitedFlowCount = visitedFlowStart; + if (reference.parent.kind === 196 /* NonNullExpression */ && getTypeWithFacts(result, 524288 /* NEUndefinedOrNull */) === neverType) { + return declaredType; + } + return result; + function getTypeAtFlowNode(flow) { + while (true) { + if (flow.flags & 256 /* Shared */) { + // We cache results of flow type resolution for shared nodes that were previously visited in + // the same getFlowTypeOfReference invocation. A node is considered shared when it is the + // antecedent of more than one node. + for (var i = visitedFlowStart; i < visitedFlowCount; i++) { + if (visitedFlowNodes[i] === flow) { + return visitedFlowTypes[i]; + } + } + } + var type = void 0; + if (flow.flags & 16 /* Assignment */) { + type = getTypeAtFlowAssignment(flow); + if (!type) { + flow = flow.antecedent; + continue; + } + } + else if (flow.flags & 96 /* Condition */) { + type = getTypeAtFlowCondition(flow); + } + else if (flow.flags & 12 /* Label */) { + if (flow.antecedents.length === 1) { + flow = flow.antecedents[0]; + continue; + } + type = flow.flags & 4 /* BranchLabel */ ? + getTypeAtFlowBranchLabel(flow) : + getTypeAtFlowLoopLabel(flow); + } + else if (flow.flags & 1 /* Unreachable */) { + // Unreachable code errors are reported in the binding phase. Here we + // simply return the declared type to reduce follow-on errors. + type = declaredType; + } + else { + // At the top of the flow we have the initial type. + type = initialType; + } + if (flow.flags & 256 /* Shared */) { + // Record visited node and the associated type in the cache. + visitedFlowNodes[visitedFlowCount] = flow; + visitedFlowTypes[visitedFlowCount] = type; + visitedFlowCount++; + } return type; } - var left = expr.left; - var right = expr.right; - if (left.expression.kind !== 69 /* Identifier */ || getResolvedSymbol(left.expression) !== symbol) { - return type; + } + function getTypeAtFlowAssignment(flow) { + var node = flow.node; + // Assignments only narrow the computed type if the declared type is a union type. Thus, we + // only need to evaluate the assigned type if the declared type is a union type. + if ((node.kind === 218 /* VariableDeclaration */ || node.kind === 169 /* BindingElement */) && + reference.kind === 69 /* Identifier */ && + getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(reference)) === getSymbolOfNode(node)) { + return declaredType.flags & 16384 /* Union */ ? + getAssignmentReducedType(declaredType, getInitialType(node)) : + declaredType; } - var typeInfo = primitiveTypeInfo[right.text]; - if (expr.operatorToken.kind === 33 /* ExclamationEqualsEqualsToken */) { + // If the node is not a variable declaration or binding element, it is an identifier + // or a dotted name that is the target of an assignment. If we have a match, reduce + // the declared type by the assigned type. + if (isMatchingReference(reference, node)) { + return declaredType.flags & 16384 /* Union */ ? + getAssignmentReducedType(declaredType, getAssignedType(node)) : + declaredType; + } + // We didn't have a direct match. However, if the reference is a dotted name, this + // may be an assignment to a left hand part of the reference. For example, for a + // reference 'x.y.z', we may be at an assignment to 'x.y' or 'x'. In that case, + // return the declared type. + if (containsMatchingReference(reference, node)) { + return declaredType; + } + // Assignment doesn't affect reference + return undefined; + } + function getTypeAtFlowCondition(flow) { + var type = getTypeAtFlowNode(flow.antecedent); + if (type !== neverType) { + // If we have an antecedent type (meaning we're reachable in some way), we first + // attempt to narrow the antecedent type. If that produces the nothing type, then + // we take the type guard as an indication that control could reach here in a + // manner not understood by the control flow analyzer (e.g. a function argument + // has an invalid type, or a nested function has possibly made an assignment to a + // captured variable). We proceed by reverting to the declared type and then + // narrow that. + var assumeTrue = (flow.flags & 32 /* TrueCondition */) !== 0; + type = narrowType(type, flow.expression, assumeTrue); + if (type === neverType) { + type = narrowType(declaredType, flow.expression, assumeTrue); + } + } + return type; + } + function getTypeAtFlowBranchLabel(flow) { + var antecedentTypes = []; + for (var _i = 0, _a = flow.antecedents; _i < _a.length; _i++) { + var antecedent = _a[_i]; + var type = getTypeAtFlowNode(antecedent); + // If the type at a particular antecedent path is the declared type and the + // reference is known to always be assigned (i.e. when declared and initial types + // are the same), there is no reason to process more antecedents since the only + // possible outcome is subtypes that will be removed in the final union type anyway. + if (type === declaredType && declaredType === initialType) { + return type; + } + if (!ts.contains(antecedentTypes, type)) { + antecedentTypes.push(type); + } + } + return getUnionType(antecedentTypes); + } + function getTypeAtFlowLoopLabel(flow) { + // If we have previously computed the control flow type for the reference at + // this flow loop junction, return the cached type. + var id = getFlowNodeId(flow); + var cache = flowLoopCaches[id] || (flowLoopCaches[id] = {}); + if (!key) { + key = getFlowCacheKey(reference); + } + if (cache[key]) { + return cache[key]; + } + // If this flow loop junction and reference are already being processed, return + // the union of the types computed for each branch so far. We should never see + // an empty array here because the first antecedent of a loop junction is always + // the non-looping control flow path that leads to the top. + for (var i = flowLoopStart; i < flowLoopCount; i++) { + if (flowLoopNodes[i] === flow && flowLoopKeys[i] === key) { + return getUnionType(flowLoopTypes[i]); + } + } + // Add the flow loop junction and reference to the in-process stack and analyze + // each antecedent code path. + var antecedentTypes = []; + flowLoopNodes[flowLoopCount] = flow; + flowLoopKeys[flowLoopCount] = key; + flowLoopTypes[flowLoopCount] = antecedentTypes; + for (var _i = 0, _a = flow.antecedents; _i < _a.length; _i++) { + var antecedent = _a[_i]; + flowLoopCount++; + var type = getTypeAtFlowNode(antecedent); + flowLoopCount--; + // If we see a value appear in the cache it is a sign that control flow analysis + // was restarted and completed by checkExpressionCached. We can simply pick up + // the resulting type and bail out. + if (cache[key]) { + return cache[key]; + } + if (!ts.contains(antecedentTypes, type)) { + antecedentTypes.push(type); + } + // If the type at a particular antecedent path is the declared type there is no + // reason to process more antecedents since the only possible outcome is subtypes + // that will be removed in the final union type anyway. + if (type === declaredType) { + break; + } + } + return cache[key] = getUnionType(antecedentTypes); + } + function narrowTypeByTruthiness(type, expr, assumeTrue) { + return isMatchingReference(reference, expr) ? getTypeWithFacts(type, assumeTrue ? 1048576 /* Truthy */ : 2097152 /* Falsy */) : type; + } + function narrowTypeByBinaryExpression(type, expr, assumeTrue) { + switch (expr.operatorToken.kind) { + case 56 /* EqualsToken */: + return narrowTypeByTruthiness(type, expr.left, assumeTrue); + case 30 /* EqualsEqualsToken */: + case 31 /* ExclamationEqualsToken */: + case 32 /* EqualsEqualsEqualsToken */: + case 33 /* ExclamationEqualsEqualsToken */: + if (isNullOrUndefinedLiteral(expr.right)) { + return narrowTypeByNullCheck(type, expr, assumeTrue); + } + if (expr.left.kind === 182 /* TypeOfExpression */ && expr.right.kind === 9 /* StringLiteral */) { + return narrowTypeByTypeof(type, expr, assumeTrue); + } + break; + case 91 /* InstanceOfKeyword */: + return narrowTypeByInstanceof(type, expr, assumeTrue); + case 24 /* CommaToken */: + return narrowType(type, expr.right, assumeTrue); + } + return type; + } + function narrowTypeByNullCheck(type, expr, assumeTrue) { + // We have '==', '!=', '===', or '!==' operator with 'null' or 'undefined' on the right + var operator = expr.operatorToken.kind; + if (operator === 31 /* ExclamationEqualsToken */ || operator === 33 /* ExclamationEqualsEqualsToken */) { assumeTrue = !assumeTrue; } - if (assumeTrue) { - // Assumed result is true. If check was not for a primitive type, remove all primitive types - if (!typeInfo) { - return removeTypesFromUnionType(type, /*typeKind*/ 258 /* StringLike */ | 132 /* NumberLike */ | 8 /* Boolean */ | 16777216 /* ESSymbol */, - /*isOfTypeKind*/ true, /*allowEmptyUnionResult*/ false); - } - // Check was for a primitive type, return that primitive type if it is a subtype - if (isTypeSubtypeOf(typeInfo.type, type)) { - return typeInfo.type; - } - // Otherwise, remove all types that aren't of the primitive type kind. This can happen when the type is - // union of enum types and other types. - return removeTypesFromUnionType(type, /*typeKind*/ typeInfo.flags, /*isOfTypeKind*/ false, /*allowEmptyUnionResult*/ false); - } - else { - // Assumed result is false. If check was for a primitive type, remove that primitive type - if (typeInfo) { - return removeTypesFromUnionType(type, /*typeKind*/ typeInfo.flags, /*isOfTypeKind*/ true, /*allowEmptyUnionResult*/ false); - } - // Otherwise we don't have enough information to do anything. + if (!strictNullChecks || !isMatchingReference(reference, expr.left)) { return type; } + var doubleEquals = operator === 30 /* EqualsEqualsToken */ || operator === 31 /* ExclamationEqualsToken */; + var facts = doubleEquals ? + assumeTrue ? 65536 /* EQUndefinedOrNull */ : 524288 /* NEUndefinedOrNull */ : + expr.right.kind === 93 /* NullKeyword */ ? + assumeTrue ? 32768 /* EQNull */ : 262144 /* NENull */ : + assumeTrue ? 16384 /* EQUndefined */ : 131072 /* NEUndefined */; + return getTypeWithFacts(type, facts); } - function narrowTypeByAnd(type, expr, assumeTrue) { - if (assumeTrue) { - // The assumed result is true, therefore we narrow assuming each operand to be true. - return narrowType(narrowType(type, expr.left, /*assumeTrue*/ true), expr.right, /*assumeTrue*/ true); + function narrowTypeByTypeof(type, expr, assumeTrue) { + // We have '==', '!=', '====', or !==' operator with 'typeof xxx' on the left + // and string literal on the right + var left = expr.left; + var right = expr.right; + if (!isMatchingReference(reference, left.expression)) { + // For a reference of the form 'x.y', a 'typeof x === ...' type guard resets the + // narrowed type of 'y' to its declared type. + if (containsMatchingReference(reference, left.expression)) { + return declaredType; + } + return type; } - else { - // The assumed result is false. This means either the first operand was false, or the first operand was true - // and the second operand was false. We narrow with those assumptions and union the two resulting types. - return getUnionType([ - narrowType(type, expr.left, /*assumeTrue*/ false), - narrowType(narrowType(type, expr.left, /*assumeTrue*/ true), expr.right, /*assumeTrue*/ false) - ]); + if (expr.operatorToken.kind === 31 /* ExclamationEqualsToken */ || + expr.operatorToken.kind === 33 /* ExclamationEqualsEqualsToken */) { + assumeTrue = !assumeTrue; } - } - function narrowTypeByOr(type, expr, assumeTrue) { - if (assumeTrue) { - // The assumed result is true. This means either the first operand was true, or the first operand was false - // and the second operand was true. We narrow with those assumptions and union the two resulting types. - return getUnionType([ - narrowType(type, expr.left, /*assumeTrue*/ true), - narrowType(narrowType(type, expr.left, /*assumeTrue*/ false), expr.right, /*assumeTrue*/ true) - ]); - } - else { - // The assumed result is false, therefore we narrow assuming each operand to be false. - return narrowType(narrowType(type, expr.left, /*assumeTrue*/ false), expr.right, /*assumeTrue*/ false); + if (assumeTrue && !(type.flags & 16384 /* Union */)) { + // We narrow a non-union type to an exact primitive type if the non-union type + // is a supertype of that primtive type. For example, type 'any' can be narrowed + // to one of the primitive types. + var targetType = ts.getProperty(typeofTypesByName, right.text); + if (targetType && isTypeSubtypeOf(targetType, type)) { + return targetType; + } } + var facts = assumeTrue ? + ts.getProperty(typeofEQFacts, right.text) || 64 /* TypeofEQHostObject */ : + ts.getProperty(typeofNEFacts, right.text) || 8192 /* TypeofNEHostObject */; + return getTypeWithFacts(type, facts); } function narrowTypeByInstanceof(type, expr, assumeTrue) { - // Check that type is not any, assumed result is true, and we have variable symbol on the left - if (isTypeAny(type) || expr.left.kind !== 69 /* Identifier */ || getResolvedSymbol(expr.left) !== symbol) { + if (!isMatchingReference(reference, expr.left)) { + // For a reference of the form 'x.y', an 'x instanceof T' type guard resets the + // narrowed type of 'y' to its declared type. + if (containsMatchingReference(reference, expr.left)) { + return declaredType; + } + return type; + } + // We never narrow type any in an instanceof guard + if (isTypeAny(type)) { return type; } // Check that right operand is a function type with a prototype property @@ -19901,7 +22657,7 @@ var ts; } if (!targetType) { // Target type is type of construct signature - var constructSignatures; + var constructSignatures = void 0; if (rightType.flags & 2048 /* Interface */) { constructSignatures = resolveDeclaredMembers(rightType).declaredConstructSignatures; } @@ -19913,46 +22669,64 @@ var ts; } } if (targetType) { - if (!assumeTrue) { - if (type.flags & 16384 /* Union */) { - return getUnionType(ts.filter(type.types, function (t) { return !isTypeSubtypeOf(t, targetType); })); - } - return type; - } - return getNarrowedType(type, targetType); + return getNarrowedType(type, targetType, assumeTrue); } return type; } - function getNarrowedType(originalType, narrowedTypeCandidate) { - // If the current type is a union type, remove all constituents that aren't assignable to target. If that produces - // 0 candidates, fall back to the assignability check - if (originalType.flags & 16384 /* Union */) { - var assignableConstituents = ts.filter(originalType.types, function (t) { return isTypeAssignableTo(t, narrowedTypeCandidate); }); + function getNarrowedType(type, candidate, assumeTrue) { + if (!assumeTrue) { + return type.flags & 16384 /* Union */ ? + getUnionType(ts.filter(type.types, function (t) { return !isTypeSubtypeOf(t, candidate); })) : + type; + } + // If the current type is a union type, remove all constituents that aren't assignable to + // the candidate type. If one or more constituents remain, return a union of those. + if (type.flags & 16384 /* Union */) { + var assignableConstituents = ts.filter(type.types, function (t) { return isTypeAssignableTo(t, candidate); }); if (assignableConstituents.length) { return getUnionType(assignableConstituents); } } - if (isTypeAssignableTo(narrowedTypeCandidate, originalType)) { - // Narrow to the target type if it's assignable to the current type - return narrowedTypeCandidate; - } - return originalType; + // If the candidate type is assignable to the target type, narrow to the candidate type. + // Otherwise, if the current type is assignable to the candidate, keep the current type. + // Otherwise, the types are completely unrelated, so narrow to the empty type. + var targetType = type.flags & 512 /* TypeParameter */ ? getApparentType(type) : type; + return isTypeAssignableTo(candidate, targetType) ? candidate : + isTypeAssignableTo(type, candidate) ? type : + neverType; } - function narrowTypeByTypePredicate(type, expr, assumeTrue) { - if (type.flags & 1 /* Any */) { + function narrowTypeByTypePredicate(type, callExpression, assumeTrue) { + if (type.flags & 1 /* Any */ || !hasMatchingArgument(callExpression, reference)) { return type; } - var signature = getResolvedSignature(expr); - if (signature.typePredicate && - expr.arguments[signature.typePredicate.parameterIndex] && - getSymbolAtLocation(expr.arguments[signature.typePredicate.parameterIndex]) === symbol) { - if (!assumeTrue) { - if (type.flags & 16384 /* Union */) { - return getUnionType(ts.filter(type.types, function (t) { return !isTypeSubtypeOf(t, signature.typePredicate.type); })); + var signature = getResolvedSignature(callExpression); + var predicate = signature.typePredicate; + if (!predicate) { + return type; + } + if (ts.isIdentifierTypePredicate(predicate)) { + var predicateArgument = callExpression.arguments[predicate.parameterIndex]; + if (predicateArgument) { + if (isMatchingReference(reference, predicateArgument)) { + return getNarrowedType(type, predicate.type, assumeTrue); + } + if (containsMatchingReference(reference, predicateArgument)) { + return declaredType; + } + } + } + else { + var invokedExpression = skipParenthesizedNodes(callExpression.expression); + if (invokedExpression.kind === 173 /* ElementAccessExpression */ || invokedExpression.kind === 172 /* PropertyAccessExpression */) { + var accessExpression = invokedExpression; + var possibleReference = skipParenthesizedNodes(accessExpression.expression); + if (isMatchingReference(reference, possibleReference)) { + return getNarrowedType(type, predicate.type, assumeTrue); + } + if (containsMatchingReference(reference, possibleReference)) { + return declaredType; } - return type; } - return getNarrowedType(type, signature.typePredicate.type); } return type; } @@ -19960,26 +22734,17 @@ var ts; // will be a subtype or the same type as the argument. function narrowType(type, expr, assumeTrue) { switch (expr.kind) { - case 168 /* CallExpression */: + case 69 /* Identifier */: + case 97 /* ThisKeyword */: + case 172 /* PropertyAccessExpression */: + return narrowTypeByTruthiness(type, expr, assumeTrue); + case 174 /* CallExpression */: return narrowTypeByTypePredicate(type, expr, assumeTrue); - case 172 /* ParenthesizedExpression */: + case 178 /* ParenthesizedExpression */: return narrowType(type, expr.expression, assumeTrue); - case 181 /* BinaryExpression */: - var operator = expr.operatorToken.kind; - if (operator === 32 /* EqualsEqualsEqualsToken */ || operator === 33 /* ExclamationEqualsEqualsToken */) { - return narrowTypeByEquality(type, expr, assumeTrue); - } - else if (operator === 51 /* AmpersandAmpersandToken */) { - return narrowTypeByAnd(type, expr, assumeTrue); - } - else if (operator === 52 /* BarBarToken */) { - return narrowTypeByOr(type, expr, assumeTrue); - } - else if (operator === 91 /* InstanceOfKeyword */) { - return narrowTypeByInstanceof(type, expr, assumeTrue); - } - break; - case 179 /* PrefixUnaryExpression */: + case 187 /* BinaryExpression */: + return narrowTypeByBinaryExpression(type, expr, assumeTrue); + case 185 /* PrefixUnaryExpression */: if (expr.operator === 49 /* ExclamationToken */) { return narrowType(type, expr.operand, !assumeTrue); } @@ -19988,6 +22753,35 @@ var ts; return type; } } + function getTypeOfSymbolAtLocation(symbol, location) { + // If we have an identifier or a property access at the given location, if the location is + // an dotted name expression, and if the location is not an assignment target, obtain the type + // of the expression (which will reflect control flow analysis). If the expression indeed + // resolved to the given symbol, return the narrowed type. + if (location.kind === 69 /* Identifier */) { + if (ts.isRightSideOfQualifiedNameOrPropertyAccess(location)) { + location = location.parent; + } + if (ts.isExpression(location) && !ts.isAssignmentTarget(location)) { + var type = checkExpression(location); + if (getExportSymbolOfValueSymbolIfExported(getNodeLinks(location).resolvedSymbol) === symbol) { + return type; + } + } + } + // The location isn't a reference to the given symbol, meaning we're being asked + // a hypothetical question of what type the symbol would have if there was a reference + // to it at the given location. Since we have no control flow information for the + // hypotherical reference (control flow information is created and attached by the + // binder), we simply return the declared type of the symbol. + return getTypeOfSymbol(symbol); + } + function skipParenthesizedNodes(expression) { + while (expression.kind === 178 /* ParenthesizedExpression */) { + expression = expression.expression; + } + return expression; + } function checkIdentifier(node) { var symbol = getResolvedSymbol(node); // As noted in ECMAScript 6 language spec, arrow functions never have an arguments objects. @@ -19998,23 +22792,54 @@ var ts; // can explicitly bound arguments objects if (symbol === argumentsSymbol) { var container = ts.getContainingFunction(node); - if (container.kind === 174 /* ArrowFunction */) { + if (container.kind === 180 /* ArrowFunction */) { if (languageVersion < 2 /* ES6 */) { error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression); } } - if (node.parserContextFlags & 8 /* Await */) { - getNodeLinks(container).flags |= 4096 /* CaptureArguments */; - getNodeLinks(node).flags |= 2048 /* LexicalArguments */; + if (node.flags & 33554432 /* AwaitContext */) { + getNodeLinks(container).flags |= 8192 /* CaptureArguments */; } } if (symbol.flags & 8388608 /* Alias */ && !isInTypeQuery(node) && !isConstEnumOrConstEnumOnlyModule(resolveAlias(symbol))) { markAliasSymbolAsReferenced(symbol); } + var localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol); + // Due to the emit for class decorators, any reference to the class from inside of the class body + // must instead be rewritten to point to a temporary variable to avoid issues with the double-bind + // behavior of class names in ES6. + if (languageVersion === 2 /* ES6 */ + && localOrExportSymbol.flags & 32 /* Class */ + && localOrExportSymbol.valueDeclaration.kind === 221 /* ClassDeclaration */ + && ts.nodeIsDecorated(localOrExportSymbol.valueDeclaration)) { + var container = ts.getContainingClass(node); + while (container !== undefined) { + if (container === localOrExportSymbol.valueDeclaration && container.name !== node) { + getNodeLinks(container).flags |= 524288 /* ClassWithBodyScopedClassBinding */; + getNodeLinks(node).flags |= 1048576 /* BodyScopedClassBinding */; + break; + } + container = ts.getContainingClass(container); + } + } checkCollisionWithCapturedSuperVariable(node, node); checkCollisionWithCapturedThisVariable(node, node); - checkBlockScopedBindingCapturedInLoop(node, symbol); - return getNarrowedTypeOfSymbol(getExportSymbolOfValueSymbolIfExported(symbol), node); + checkNestedBlockScopedBinding(node, symbol); + var type = getTypeOfSymbol(localOrExportSymbol); + if (!(localOrExportSymbol.flags & 3 /* Variable */) || ts.isAssignmentTarget(node)) { + return type; + } + var declaration = localOrExportSymbol.valueDeclaration; + var assumeInitialized = !strictNullChecks || (type.flags & 1 /* Any */) !== 0 || !declaration || + ts.getRootDeclaration(declaration).kind === 142 /* Parameter */ || ts.isInAmbientContext(declaration) || + ts.getContainingFunctionOrModule(declaration) !== ts.getContainingFunctionOrModule(node); + var flowType = getFlowTypeOfReference(node, type, assumeInitialized); + if (!assumeInitialized && !(getNullableKind(type) & 32 /* Undefined */) && getNullableKind(flowType) & 32 /* Undefined */) { + error(node, ts.Diagnostics.Variable_0_is_used_before_being_assigned, symbolToString(symbol)); + // Return the declared type to reduce follow-on errors + return type; + } + return flowType; } function isInsideFunction(node, threshold) { var current = node; @@ -20026,52 +22851,79 @@ var ts; } return false; } - function checkBlockScopedBindingCapturedInLoop(node, symbol) { + function checkNestedBlockScopedBinding(node, symbol) { if (languageVersion >= 2 /* ES6 */ || (symbol.flags & (2 /* BlockScopedVariable */ | 32 /* Class */)) === 0 || - symbol.valueDeclaration.parent.kind === 244 /* CatchClause */) { + symbol.valueDeclaration.parent.kind === 252 /* CatchClause */) { return; } // 1. walk from the use site up to the declaration and check // if there is anything function like between declaration and use-site (is binding/class is captured in function). // 2. walk from the declaration up to the boundary of lexical environment and check // if there is an iteration statement in between declaration and boundary (is binding/class declared inside iteration statement) - var container; - if (symbol.flags & 32 /* Class */) { - // get parent of class declaration - container = getClassLikeDeclarationOfSymbol(symbol).parent; - } - else { - // nesting structure: - // (variable declaration or binding element) -> variable declaration list -> container - container = symbol.valueDeclaration; - while (container.kind !== 212 /* VariableDeclarationList */) { - container = container.parent; - } - // get the parent of variable declaration list - container = container.parent; - if (container.kind === 193 /* VariableStatement */) { - // if parent is variable statement - get its parent - container = container.parent; - } - } - var inFunction = isInsideFunction(node.parent, container); + var container = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration); + var usedInFunction = isInsideFunction(node.parent, container); var current = container; + var containedInIterationStatement = false; while (current && !ts.nodeStartsNewLexicalEnvironment(current)) { if (ts.isIterationStatement(current, /*lookInLabeledStatements*/ false)) { - if (inFunction) { - getNodeLinks(current).flags |= 65536 /* LoopWithBlockScopedBindingCapturedInFunction */; - } - // mark value declaration so during emit they can have a special handling - getNodeLinks(symbol.valueDeclaration).flags |= 16384 /* BlockScopedBindingInLoop */; + containedInIterationStatement = true; break; } current = current.parent; } + if (containedInIterationStatement) { + if (usedInFunction) { + // mark iteration statement as containing block-scoped binding captured in some function + getNodeLinks(current).flags |= 65536 /* LoopWithCapturedBlockScopedBinding */; + } + // mark variables that are declared in loop initializer and reassigned inside the body of ForStatement. + // if body of ForStatement will be converted to function then we'll need a extra machinery to propagate reassigned values back. + if (container.kind === 206 /* ForStatement */ && + ts.getAncestor(symbol.valueDeclaration, 219 /* VariableDeclarationList */).parent === container && + isAssignedInBodyOfForStatement(node, container)) { + getNodeLinks(symbol.valueDeclaration).flags |= 2097152 /* NeedsLoopOutParameter */; + } + // set 'declared inside loop' bit on the block-scoped binding + getNodeLinks(symbol.valueDeclaration).flags |= 262144 /* BlockScopedBindingInLoop */; + } + if (usedInFunction) { + getNodeLinks(symbol.valueDeclaration).flags |= 131072 /* CapturedBlockScopedBinding */; + } + } + function isAssignedInBodyOfForStatement(node, container) { + var current = node; + // skip parenthesized nodes + while (current.parent.kind === 178 /* ParenthesizedExpression */) { + current = current.parent; + } + // check if node is used as LHS in some assignment expression + var isAssigned = false; + if (ts.isAssignmentTarget(current)) { + isAssigned = true; + } + else if ((current.parent.kind === 185 /* PrefixUnaryExpression */ || current.parent.kind === 186 /* PostfixUnaryExpression */)) { + var expr = current.parent; + isAssigned = expr.operator === 41 /* PlusPlusToken */ || expr.operator === 42 /* MinusMinusToken */; + } + if (!isAssigned) { + return false; + } + // at this point we know that node is the target of assignment + // now check that modification happens inside the statement part of the ForStatement + while (current !== container) { + if (current === container.statement) { + return true; + } + else { + current = current.parent; + } + } + return false; } function captureLexicalThis(node, container) { getNodeLinks(node).flags |= 2 /* LexicalThis */; - if (container.kind === 141 /* PropertyDeclaration */ || container.kind === 144 /* Constructor */) { + if (container.kind === 145 /* PropertyDeclaration */ || container.kind === 148 /* Constructor */) { var classNode = container.parent; getNodeLinks(classNode).flags |= 4 /* CaptureThis */; } @@ -20079,109 +22931,293 @@ var ts; getNodeLinks(container).flags |= 4 /* CaptureThis */; } } + function findFirstSuperCall(n) { + if (ts.isSuperCallExpression(n)) { + return n; + } + else if (ts.isFunctionLike(n)) { + return undefined; + } + return ts.forEachChild(n, findFirstSuperCall); + } + /** + * Return a cached result if super-statement is already found. + * Otherwise, find a super statement in a given constructor function and cache the result in the node-links of the constructor + * + * @param constructor constructor-function to look for super statement + */ + function getSuperCallInConstructor(constructor) { + var links = getNodeLinks(constructor); + // Only trying to find super-call if we haven't yet tried to find one. Once we try, we will record the result + if (links.hasSuperCall === undefined) { + links.superCall = findFirstSuperCall(constructor.body); + links.hasSuperCall = links.superCall ? true : false; + } + return links.superCall; + } + /** + * Check if the given class-declaration extends null then return true. + * Otherwise, return false + * @param classDecl a class declaration to check if it extends null + */ + function classDeclarationExtendsNull(classDecl) { + var classSymbol = getSymbolOfNode(classDecl); + var classInstanceType = getDeclaredTypeOfSymbol(classSymbol); + var baseConstructorType = getBaseConstructorTypeOfClass(classInstanceType); + return baseConstructorType === nullType; + } function checkThisExpression(node) { // Stop at the first arrow function so that we can // tell whether 'this' needs to be captured. var container = ts.getThisContainer(node, /* includeArrowFunctions */ true); var needToCaptureLexicalThis = false; + if (container.kind === 148 /* Constructor */) { + var containingClassDecl = container.parent; + var baseTypeNode = ts.getClassExtendsHeritageClauseElement(containingClassDecl); + // If a containing class does not have extends clause or the class extends null + // skip checking whether super statement is called before "this" accessing. + if (baseTypeNode && !classDeclarationExtendsNull(containingClassDecl)) { + var superCall = getSuperCallInConstructor(container); + // We should give an error in the following cases: + // - No super-call + // - "this" is accessing before super-call. + // i.e super(this) + // this.x; super(); + // We want to make sure that super-call is done before accessing "this" so that + // "this" is not accessed as a parameter of the super-call. + if (!superCall || superCall.end > node.pos) { + // In ES6, super inside constructor of class-declaration has to precede "this" accessing + error(node, ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class); + } + } + } // Now skip arrow functions to get the "real" owner of 'this'. - if (container.kind === 174 /* ArrowFunction */) { + if (container.kind === 180 /* ArrowFunction */) { container = ts.getThisContainer(container, /* includeArrowFunctions */ false); // When targeting es6, arrow function lexically bind "this" so we do not need to do the work of binding "this" in emitted code needToCaptureLexicalThis = (languageVersion < 2 /* ES6 */); } switch (container.kind) { - case 218 /* ModuleDeclaration */: + case 225 /* ModuleDeclaration */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body); // do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks break; - case 217 /* EnumDeclaration */: + case 224 /* EnumDeclaration */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location); // do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks break; - case 144 /* Constructor */: + case 148 /* Constructor */: if (isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_constructor_arguments); } break; - case 141 /* PropertyDeclaration */: - case 140 /* PropertySignature */: - if (container.flags & 64 /* Static */) { + case 145 /* PropertyDeclaration */: + case 144 /* PropertySignature */: + if (container.flags & 32 /* Static */) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_static_property_initializer); } break; - case 136 /* ComputedPropertyName */: + case 140 /* ComputedPropertyName */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_computed_property_name); break; } if (needToCaptureLexicalThis) { captureLexicalThis(node, container); } + if (ts.isFunctionLike(container)) { + // If this is a function in a JS file, it might be a class method. Check if it's the RHS + // of a x.prototype.y = function [name]() { .... } + if (container.kind === 179 /* FunctionExpression */ && + ts.isInJavaScriptFile(container.parent) && + ts.getSpecialPropertyAssignmentKind(container.parent) === 3 /* PrototypeProperty */) { + // Get the 'x' of 'x.prototype.y = f' (here, 'f' is 'container') + var className = container.parent // x.prototype.y = f + .left // x.prototype.y + .expression // x.prototype + .expression; // x + var classSymbol = checkExpression(className).symbol; + if (classSymbol && classSymbol.members && (classSymbol.flags & 16 /* Function */)) { + return getInferredClassType(classSymbol); + } + } + var type = getContextuallyTypedThisType(container); + if (type) { + return type; + } + var signature = getSignatureFromDeclaration(container); + if (signature.thisType) { + return signature.thisType; + } + } if (ts.isClassLike(container.parent)) { var symbol = getSymbolOfNode(container.parent); - return container.flags & 64 /* Static */ ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol).thisType; + var type = container.flags & 32 /* Static */ ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol).thisType; + return getFlowTypeOfReference(node, type, /*assumeInitialized*/ true); + } + if (ts.isInJavaScriptFile(node)) { + var type = getTypeForThisExpressionFromJSDoc(container); + if (type && type !== unknownType) { + return type; + } + } + if (compilerOptions.noImplicitThis) { + // With noImplicitThis, functions may not reference 'this' if it has type 'any' + error(node, ts.Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation); } return anyType; } + function getTypeForThisExpressionFromJSDoc(node) { + var typeTag = ts.getJSDocTypeTag(node); + if (typeTag && typeTag.typeExpression && typeTag.typeExpression.type && typeTag.typeExpression.type.kind === 269 /* JSDocFunctionType */) { + var jsDocFunctionType = typeTag.typeExpression.type; + if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].type.kind === 272 /* JSDocThisType */) { + return getTypeFromTypeNode(jsDocFunctionType.parameters[0].type); + } + } + } function isInConstructorArgumentInitializer(node, constructorDecl) { for (var n = node; n && n !== constructorDecl; n = n.parent) { - if (n.kind === 138 /* Parameter */) { + if (n.kind === 142 /* Parameter */) { return true; } } return false; } function checkSuperExpression(node) { - var isCallExpression = node.parent.kind === 168 /* CallExpression */ && node.parent.expression === node; - var classDeclaration = ts.getContainingClass(node); - var classType = classDeclaration && getDeclaredTypeOfSymbol(getSymbolOfNode(classDeclaration)); - var baseClassType = classType && getBaseTypes(classType)[0]; - var container = ts.getSuperContainer(node, /*includeFunctions*/ true); + var isCallExpression = node.parent.kind === 174 /* CallExpression */ && node.parent.expression === node; + var container = ts.getSuperContainer(node, /*stopOnFunctions*/ true); var needToCaptureLexicalThis = false; if (!isCallExpression) { // adjust the container reference in case if super is used inside arrow functions with arbitrary deep nesting - while (container && container.kind === 174 /* ArrowFunction */) { - container = ts.getSuperContainer(container, /*includeFunctions*/ true); + while (container && container.kind === 180 /* ArrowFunction */) { + container = ts.getSuperContainer(container, /*stopOnFunctions*/ true); needToCaptureLexicalThis = languageVersion < 2 /* ES6 */; } } var canUseSuperExpression = isLegalUsageOfSuperExpression(container); var nodeCheckFlag = 0; - // always set NodeCheckFlags for 'super' expression node - if (canUseSuperExpression) { - if ((container.flags & 64 /* Static */) || isCallExpression) { - nodeCheckFlag = 512 /* SuperStatic */; - } - else { - nodeCheckFlag = 256 /* SuperInstance */; - } - getNodeLinks(node).flags |= nodeCheckFlag; - if (needToCaptureLexicalThis) { - // call expressions are allowed only in constructors so they should always capture correct 'this' - // super property access expressions can also appear in arrow functions - - // in this case they should also use correct lexical this - captureLexicalThis(node.parent, container); - } - } - if (!baseClassType) { - if (!classDeclaration || !ts.getClassExtendsHeritageClauseElement(classDeclaration)) { - error(node, ts.Diagnostics.super_can_only_be_referenced_in_a_derived_class); - } - return unknownType; - } if (!canUseSuperExpression) { - if (container && container.kind === 136 /* ComputedPropertyName */) { + // issue more specific error if super is used in computed property name + // class A { foo() { return "1" }} + // class B { + // [super.foo()]() {} + // } + var current = node; + while (current && current !== container && current.kind !== 140 /* ComputedPropertyName */) { + current = current.parent; + } + if (current && current.kind === 140 /* ComputedPropertyName */) { error(node, ts.Diagnostics.super_cannot_be_referenced_in_a_computed_property_name); } else if (isCallExpression) { error(node, ts.Diagnostics.Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors); } + else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 171 /* ObjectLiteralExpression */)) { + error(node, ts.Diagnostics.super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions); + } else { error(node, ts.Diagnostics.super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class); } return unknownType; } - if (container.kind === 144 /* Constructor */ && isInConstructorArgumentInitializer(node, container)) { + if ((container.flags & 32 /* Static */) || isCallExpression) { + nodeCheckFlag = 512 /* SuperStatic */; + } + else { + nodeCheckFlag = 256 /* SuperInstance */; + } + getNodeLinks(node).flags |= nodeCheckFlag; + // Due to how we emit async functions, we need to specialize the emit for an async method that contains a `super` reference. + // This is due to the fact that we emit the body of an async function inside of a generator function. As generator + // functions cannot reference `super`, we emit a helper inside of the method body, but outside of the generator. This helper + // uses an arrow function, which is permitted to reference `super`. + // + // There are two primary ways we can access `super` from within an async method. The first is getting the value of a property + // or indexed access on super, either as part of a right-hand-side expression or call expression. The second is when setting the value + // of a property or indexed access, either as part of an assignment expression or destructuring assignment. + // + // The simplest case is reading a value, in which case we will emit something like the following: + // + // // ts + // ... + // async asyncMethod() { + // let x = await super.asyncMethod(); + // return x; + // } + // ... + // + // // js + // ... + // asyncMethod() { + // const _super = name => super[name]; + // return __awaiter(this, arguments, Promise, function *() { + // let x = yield _super("asyncMethod").call(this); + // return x; + // }); + // } + // ... + // + // The more complex case is when we wish to assign a value, especially as part of a destructuring assignment. As both cases + // are legal in ES6, but also likely less frequent, we emit the same more complex helper for both scenarios: + // + // // ts + // ... + // async asyncMethod(ar: Promise) { + // [super.a, super.b] = await ar; + // } + // ... + // + // // js + // ... + // asyncMethod(ar) { + // const _super = (function (geti, seti) { + // const cache = Object.create(null); + // return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } }); + // })(name => super[name], (name, value) => super[name] = value); + // return __awaiter(this, arguments, Promise, function *() { + // [_super("a").value, _super("b").value] = yield ar; + // }); + // } + // ... + // + // This helper creates an object with a "value" property that wraps the `super` property or indexed access for both get and set. + // This is required for destructuring assignments, as a call expression cannot be used as the target of a destructuring assignment + // while a property access can. + if (container.kind === 147 /* MethodDeclaration */ && container.flags & 256 /* Async */) { + if (ts.isSuperPropertyOrElementAccess(node.parent) && ts.isAssignmentTarget(node.parent)) { + getNodeLinks(container).flags |= 4096 /* AsyncMethodWithSuperBinding */; + } + else { + getNodeLinks(container).flags |= 2048 /* AsyncMethodWithSuper */; + } + } + if (needToCaptureLexicalThis) { + // call expressions are allowed only in constructors so they should always capture correct 'this' + // super property access expressions can also appear in arrow functions - + // in this case they should also use correct lexical this + captureLexicalThis(node.parent, container); + } + if (container.parent.kind === 171 /* ObjectLiteralExpression */) { + if (languageVersion < 2 /* ES6 */) { + error(node, ts.Diagnostics.super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher); + return unknownType; + } + else { + // for object literal assume that type of 'super' is 'any' + return anyType; + } + } + // at this point the only legal case for parent is ClassLikeDeclaration + var classLikeDeclaration = container.parent; + var classType = getDeclaredTypeOfSymbol(getSymbolOfNode(classLikeDeclaration)); + var baseClassType = classType && getBaseTypes(classType)[0]; + if (!baseClassType) { + if (!ts.getClassExtendsHeritageClauseElement(classLikeDeclaration)) { + error(node, ts.Diagnostics.super_can_only_be_referenced_in_a_derived_class); + } + return unknownType; + } + if (container.kind === 148 /* Constructor */ && isInConstructorArgumentInitializer(node, container)) { // issue custom error message for super property access in constructor arguments (to be aligned with old compiler) error(node, ts.Diagnostics.super_cannot_be_referenced_in_constructor_arguments); return unknownType; @@ -20196,71 +23232,113 @@ var ts; if (isCallExpression) { // TS 1.0 SPEC (April 2014): 4.8.1 // Super calls are only permitted in constructors of derived classes - return container.kind === 144 /* Constructor */; + return container.kind === 148 /* Constructor */; } else { // TS 1.0 SPEC (April 2014) // 'super' property access is allowed // - In a constructor, instance member function, instance member accessor, or instance member variable initializer where this references a derived class instance // - In a static member function or static member accessor - // topmost container must be something that is directly nested in the class declaration - if (container && ts.isClassLike(container.parent)) { - if (container.flags & 64 /* Static */) { - return container.kind === 143 /* MethodDeclaration */ || - container.kind === 142 /* MethodSignature */ || - container.kind === 145 /* GetAccessor */ || - container.kind === 146 /* SetAccessor */; + // topmost container must be something that is directly nested in the class declaration\object literal expression + if (ts.isClassLike(container.parent) || container.parent.kind === 171 /* ObjectLiteralExpression */) { + if (container.flags & 32 /* Static */) { + return container.kind === 147 /* MethodDeclaration */ || + container.kind === 146 /* MethodSignature */ || + container.kind === 149 /* GetAccessor */ || + container.kind === 150 /* SetAccessor */; } else { - return container.kind === 143 /* MethodDeclaration */ || - container.kind === 142 /* MethodSignature */ || - container.kind === 145 /* GetAccessor */ || - container.kind === 146 /* SetAccessor */ || - container.kind === 141 /* PropertyDeclaration */ || - container.kind === 140 /* PropertySignature */ || - container.kind === 144 /* Constructor */; + return container.kind === 147 /* MethodDeclaration */ || + container.kind === 146 /* MethodSignature */ || + container.kind === 149 /* GetAccessor */ || + container.kind === 150 /* SetAccessor */ || + container.kind === 145 /* PropertyDeclaration */ || + container.kind === 144 /* PropertySignature */ || + container.kind === 148 /* Constructor */; } } } return false; } } + function getContextuallyTypedThisType(func) { + if (isContextSensitiveFunctionOrObjectLiteralMethod(func) && func.kind !== 180 /* ArrowFunction */) { + var contextualSignature = getContextualSignature(func); + if (contextualSignature) { + return contextualSignature.thisType; + } + } + return undefined; + } // Return contextual type of parameter or undefined if no contextual type is available function getContextuallyTypedParameterType(parameter) { var func = parameter.parent; - if (isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) { - if (isContextSensitive(func)) { - var contextualSignature = getContextualSignature(func); - if (contextualSignature) { - var funcHasRestParameters = ts.hasRestParameter(func); - var len = func.parameters.length - (funcHasRestParameters ? 1 : 0); - var indexOfParameter = ts.indexOf(func.parameters, parameter); - if (indexOfParameter < len) { - return getTypeAtPosition(contextualSignature, indexOfParameter); - } - // If last parameter is contextually rest parameter get its type - if (funcHasRestParameters && - indexOfParameter === (func.parameters.length - 1) && - isRestParameterIndex(contextualSignature, func.parameters.length - 1)) { - return getTypeOfSymbol(ts.lastOrUndefined(contextualSignature.parameters)); + if (isContextSensitiveFunctionOrObjectLiteralMethod(func)) { + var iife = getImmediatelyInvokedFunctionExpression(func); + if (iife) { + var indexOfParameter = ts.indexOf(func.parameters, parameter); + if (iife.arguments && indexOfParameter < iife.arguments.length) { + if (parameter.dotDotDotToken) { + var restTypes = []; + for (var i = indexOfParameter; i < iife.arguments.length; i++) { + restTypes.push(getTypeOfExpression(iife.arguments[i])); + } + return createArrayType(getUnionType(restTypes)); } + var links = getNodeLinks(iife); + var cached = links.resolvedSignature; + links.resolvedSignature = anySignature; + var type = checkExpression(iife.arguments[indexOfParameter]); + links.resolvedSignature = cached; + return type; + } + } + var contextualSignature = getContextualSignature(func); + if (contextualSignature) { + var funcHasRestParameters = ts.hasRestParameter(func); + var len = func.parameters.length - (funcHasRestParameters ? 1 : 0); + var indexOfParameter = ts.indexOf(func.parameters, parameter); + if (indexOfParameter < len) { + return getTypeAtPosition(contextualSignature, indexOfParameter); + } + // If last parameter is contextually rest parameter get its type + if (funcHasRestParameters && + indexOfParameter === (func.parameters.length - 1) && + isRestParameterIndex(contextualSignature, func.parameters.length - 1)) { + return getTypeOfSymbol(ts.lastOrUndefined(contextualSignature.parameters)); } } } return undefined; } - // In a variable, parameter or property declaration with a type annotation, the contextual type of an initializer - // expression is the type of the variable, parameter or property. Otherwise, in a parameter declaration of a - // contextually typed function expression, the contextual type of an initializer expression is the contextual type - // of the parameter. Otherwise, in a variable or parameter declaration with a binding pattern name, the contextual - // type of an initializer expression is the type implied by the binding pattern. + function getImmediatelyInvokedFunctionExpression(func) { + if (isFunctionExpressionOrArrowFunction(func)) { + var prev = func; + var parent_8 = func.parent; + while (parent_8.kind === 178 /* ParenthesizedExpression */) { + prev = parent_8; + parent_8 = parent_8.parent; + } + if (parent_8.kind === 174 /* CallExpression */ && parent_8.expression === prev) { + return parent_8; + } + } + } + // In a variable, parameter or property declaration with a type annotation, + // the contextual type of an initializer expression is the type of the variable, parameter or property. + // Otherwise, in a parameter declaration of a contextually typed function expression, + // the contextual type of an initializer expression is the contextual type of the parameter. + // Otherwise, in a variable or parameter declaration with a binding pattern name, + // the contextual type of an initializer expression is the type implied by the binding pattern. + // Otherwise, in a binding pattern inside a variable or parameter declaration, + // the contextual type of an initializer expression is the type annotation of the containing declaration, if present. function getContextualTypeForInitializerExpression(node) { var declaration = node.parent; if (node === declaration.initializer) { if (declaration.type) { return getTypeFromTypeNode(declaration.type); } - if (declaration.kind === 138 /* Parameter */) { + if (declaration.kind === 142 /* Parameter */) { var type = getContextuallyTypedParameterType(declaration); if (type) { return type; @@ -20269,6 +23347,18 @@ var ts; if (ts.isBindingPattern(declaration.name)) { return getTypeFromBindingPattern(declaration.name, /*includePatternInType*/ true); } + if (ts.isBindingPattern(declaration.parent)) { + var parentDeclaration = declaration.parent.parent; + var name_11 = declaration.propertyName || declaration.name; + if (ts.isVariableLike(parentDeclaration) && + parentDeclaration.type && + !ts.isBindingPattern(name_11)) { + var text = getTextOfPropertyName(name_11); + if (text) { + return getTypeOfPropertyOfType(getTypeFromTypeNode(parentDeclaration.type), text); + } + } + } } return undefined; } @@ -20293,7 +23383,7 @@ var ts; } function isInParameterInitializerBeforeContainingFunction(node) { while (node.parent && !ts.isFunctionLike(node.parent)) { - if (node.parent.kind === 138 /* Parameter */ && node.parent.initializer === node) { + if (node.parent.kind === 142 /* Parameter */ && node.parent.initializer === node) { return true; } node = node.parent; @@ -20304,8 +23394,8 @@ var ts; // If the containing function has a return type annotation, is a constructor, or is a get accessor whose // corresponding set accessor has a type annotation, return statements in the function are contextually typed if (functionDecl.type || - functionDecl.kind === 144 /* Constructor */ || - functionDecl.kind === 145 /* GetAccessor */ && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(functionDecl.symbol, 146 /* SetAccessor */))) { + functionDecl.kind === 148 /* Constructor */ || + functionDecl.kind === 149 /* GetAccessor */ && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(functionDecl.symbol, 150 /* SetAccessor */))) { return getReturnTypeOfSignature(getSignatureFromDeclaration(functionDecl)); } // Otherwise, if the containing function is contextually typed by a function type with exactly one call signature @@ -20321,13 +23411,13 @@ var ts; var args = getEffectiveCallArguments(callTarget); var argIndex = ts.indexOf(args, arg); if (argIndex >= 0) { - var signature = getResolvedSignature(callTarget); + var signature = getResolvedOrAnySignature(callTarget); return getTypeAtPosition(signature, argIndex); } return undefined; } function getContextualTypeForSubstitutionExpression(template, substitutionExpression) { - if (template.parent.kind === 170 /* TaggedTemplateExpression */) { + if (template.parent.kind === 176 /* TaggedTemplateExpression */) { return getContextualTypeForArgument(template.parent, substitutionExpression); } return undefined; @@ -20350,6 +23440,11 @@ var ts; } return type; } + else if (operator === 51 /* AmpersandAmpersandToken */ || operator === 24 /* CommaToken */) { + if (node === binaryExpression.right) { + return getContextualType(binaryExpression); + } + } return undefined; } // Apply a mapping function to a contextual type and return the resulting type. If the contextual type @@ -20362,8 +23457,8 @@ var ts; var types = type.types; var mappedType; var mappedTypes; - for (var _i = 0, types_7 = types; _i < types_7.length; _i++) { - var current = types_7[_i]; + for (var _i = 0, types_8 = types; _i < types_8.length; _i++) { + var current = types_8[_i]; var t = mapper(current); if (t) { if (!mappedType) { @@ -20395,10 +23490,6 @@ var ts; function contextualTypeIsTupleLikeType(type) { return !!(type.flags & 16384 /* Union */ ? ts.forEach(type.types, isTupleLikeType) : isTupleLikeType(type)); } - // Return true if the given contextual type provides an index signature of the given kind - function contextualTypeHasIndexSignature(type, kind) { - return !!(type.flags & 16384 /* Union */ ? ts.forEach(type.types, function (t) { return getIndexTypeOfStructuredType(t, kind); }) : getIndexTypeOfStructuredType(type, kind)); - } // In an object literal contextually typed by a type T, the contextual type of a property assignment is the type of // the matching property in T, if one exists. Otherwise, it is the type of the numeric index signature in T, if one // exists. Otherwise, it is the type of the string index signature in T, if one exists. @@ -20449,22 +23540,20 @@ var ts; var conditional = node.parent; return node === conditional.whenTrue || node === conditional.whenFalse ? getContextualType(conditional) : undefined; } - function getContextualTypeForJsxExpression(expr) { - // Contextual type only applies to JSX expressions that are in attribute assignments (not in 'Children' positions) - if (expr.parent.kind === 238 /* JsxAttribute */) { - var attrib = expr.parent; - var attrsType = getJsxElementAttributesType(attrib.parent); + function getContextualTypeForJsxAttribute(attribute) { + var kind = attribute.kind; + var jsxElement = attribute.parent; + var attrsType = getJsxElementAttributesType(jsxElement); + if (attribute.kind === 246 /* JsxAttribute */) { if (!attrsType || isTypeAny(attrsType)) { return undefined; } - else { - return getTypeOfPropertyOfType(attrsType, attrib.name.text); - } + return getTypeOfPropertyOfType(attrsType, attribute.name.text); } - if (expr.kind === 239 /* JsxSpreadAttribute */) { - return getJsxElementAttributesType(expr.parent); + else if (attribute.kind === 247 /* JsxSpreadAttribute */) { + return attrsType; } - return undefined; + ts.Debug.fail("Expected JsxAttribute or JsxSpreadAttribute, got ts.SyntaxKind[" + kind + "]"); } // Return the contextual type for a given expression node. During overload resolution, a contextual type may temporarily // be "pushed" onto a node using the contextualType property. @@ -20481,7 +23570,7 @@ var ts; * Otherwise this may not be very useful. * * In cases where you *are* working on this function, you should understand - * when it is appropriate to use 'getContextualType' and 'getApparentTypeOfContetxualType'. + * when it is appropriate to use 'getContextualType' and 'getApparentTypeOfContextualType'. * * - Use 'getContextualType' when you are simply going to propagate the result to the expression. * - Use 'getApparentTypeOfContextualType' when you're going to need the members of the type. @@ -20499,39 +23588,41 @@ var ts; } var parent = node.parent; switch (parent.kind) { - case 211 /* VariableDeclaration */: - case 138 /* Parameter */: - case 141 /* PropertyDeclaration */: - case 140 /* PropertySignature */: - case 163 /* BindingElement */: + case 218 /* VariableDeclaration */: + case 142 /* Parameter */: + case 145 /* PropertyDeclaration */: + case 144 /* PropertySignature */: + case 169 /* BindingElement */: return getContextualTypeForInitializerExpression(node); - case 174 /* ArrowFunction */: - case 204 /* ReturnStatement */: + case 180 /* ArrowFunction */: + case 211 /* ReturnStatement */: return getContextualTypeForReturnExpression(node); - case 184 /* YieldExpression */: + case 190 /* YieldExpression */: return getContextualTypeForYieldOperand(parent); - case 168 /* CallExpression */: - case 169 /* NewExpression */: + case 174 /* CallExpression */: + case 175 /* NewExpression */: return getContextualTypeForArgument(parent, node); - case 171 /* TypeAssertionExpression */: - case 189 /* AsExpression */: + case 177 /* TypeAssertionExpression */: + case 195 /* AsExpression */: return getTypeFromTypeNode(parent.type); - case 181 /* BinaryExpression */: + case 187 /* BinaryExpression */: return getContextualTypeForBinaryOperand(node); - case 245 /* PropertyAssignment */: + case 253 /* PropertyAssignment */: return getContextualTypeForObjectLiteralElement(parent); - case 164 /* ArrayLiteralExpression */: + case 170 /* ArrayLiteralExpression */: return getContextualTypeForElementExpression(node); - case 182 /* ConditionalExpression */: + case 188 /* ConditionalExpression */: return getContextualTypeForConditionalOperand(node); - case 190 /* TemplateSpan */: - ts.Debug.assert(parent.parent.kind === 183 /* TemplateExpression */); + case 197 /* TemplateSpan */: + ts.Debug.assert(parent.parent.kind === 189 /* TemplateExpression */); return getContextualTypeForSubstitutionExpression(parent.parent, node); - case 172 /* ParenthesizedExpression */: + case 178 /* ParenthesizedExpression */: return getContextualType(parent); - case 240 /* JsxExpression */: - case 239 /* JsxSpreadAttribute */: - return getContextualTypeForJsxExpression(parent); + case 248 /* JsxExpression */: + return getContextualType(parent); + case 246 /* JsxAttribute */: + case 247 /* JsxSpreadAttribute */: + return getContextualTypeForJsxAttribute(parent); } return undefined; } @@ -20547,7 +23638,7 @@ var ts; } } function isFunctionExpressionOrArrowFunction(node) { - return node.kind === 173 /* FunctionExpression */ || node.kind === 174 /* ArrowFunction */; + return node.kind === 179 /* FunctionExpression */ || node.kind === 180 /* ArrowFunction */; } function getContextualSignatureForFunctionLikeDeclaration(node) { // Only function expressions, arrow functions, and object literal methods are contextually typed. @@ -20555,16 +23646,19 @@ var ts; ? getContextualSignature(node) : undefined; } + function getContextualTypeForFunctionLikeDeclaration(node) { + return ts.isObjectLiteralMethod(node) ? + getContextualTypeForObjectLiteralMethod(node) : + getApparentTypeOfContextualType(node); + } // Return the contextual signature for a given expression node. A contextual type provides a // contextual signature if it has a single call signature and if that call signature is non-generic. // If the contextual type is a union type, get the signature from each type possible and if they are // all identical ignoring their return type, the result is same signature but with return type as // union type of return types from these signatures function getContextualSignature(node) { - ts.Debug.assert(node.kind !== 143 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); - var type = ts.isObjectLiteralMethod(node) - ? getContextualTypeForObjectLiteralMethod(node) - : getApparentTypeOfContextualType(node); + ts.Debug.assert(node.kind !== 147 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + var type = getContextualTypeForFunctionLikeDeclaration(node); if (!type) { return undefined; } @@ -20573,15 +23667,15 @@ var ts; } var signatureList; var types = type.types; - for (var _i = 0, types_8 = types; _i < types_8.length; _i++) { - var current = types_8[_i]; + for (var _i = 0, types_9 = types; _i < types_9.length; _i++) { + var current = types_9[_i]; var signature = getNonGenericSignature(current); if (signature) { if (!signatureList) { // This signature will contribute to contextual union signature signatureList = [signature]; } - else if (!compareSignatures(signatureList[0], signature, /*partialMatch*/ false, /*ignoreReturnTypes*/ true, compareTypes)) { + else if (!compareSignaturesIdentical(signatureList[0], signature, /*partialMatch*/ false, /*ignoreThisTypes*/ true, /*ignoreReturnTypes*/ true, compareTypesIdentical)) { // Signatures aren't identical, do not use return undefined; } @@ -20619,22 +23713,6 @@ var ts; function isInferentialContext(mapper) { return mapper && mapper.context; } - // 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', '[{ p: a}] = xxx'. - function isAssignmentTarget(node) { - var parent = node.parent; - if (parent.kind === 181 /* BinaryExpression */ && parent.operatorToken.kind === 56 /* EqualsToken */ && parent.left === node) { - return true; - } - if (parent.kind === 245 /* PropertyAssignment */) { - return isAssignmentTarget(parent.parent); - } - if (parent.kind === 164 /* ArrayLiteralExpression */) { - return isAssignmentTarget(parent); - } - return false; - } function checkSpreadElementExpression(node, contextualMapper) { // It is usually not safe to call checkExpressionCached if we can be contextually typing. // You can tell that we are contextually typing because of the contextualMapper parameter. @@ -20646,17 +23724,17 @@ var ts; return checkIteratedTypeOrElementType(arrayOrIterableType, node.expression, /*allowStringInput*/ false); } function hasDefaultValue(node) { - return (node.kind === 163 /* BindingElement */ && !!node.initializer) || - (node.kind === 181 /* BinaryExpression */ && node.operatorToken.kind === 56 /* EqualsToken */); + return (node.kind === 169 /* BindingElement */ && !!node.initializer) || + (node.kind === 187 /* BinaryExpression */ && node.operatorToken.kind === 56 /* EqualsToken */); } function checkArrayLiteral(node, contextualMapper) { var elements = node.elements; var hasSpreadElement = false; var elementTypes = []; - var inDestructuringPattern = isAssignmentTarget(node); + var inDestructuringPattern = ts.isAssignmentTarget(node); for (var _i = 0, elements_1 = elements; _i < elements_1.length; _i++) { var e = elements_1[_i]; - if (inDestructuringPattern && e.kind === 185 /* SpreadElementExpression */) { + if (inDestructuringPattern && e.kind === 191 /* SpreadElementExpression */) { // Given the following situation: // var c: {}; // [...c] = ["", 0]; @@ -20680,7 +23758,7 @@ var ts; var type = checkExpression(e, contextualMapper); elementTypes.push(type); } - hasSpreadElement = hasSpreadElement || e.kind === 185 /* SpreadElementExpression */; + hasSpreadElement = hasSpreadElement || e.kind === 191 /* SpreadElementExpression */; } if (!hasSpreadElement) { // If array literal is actually a destructuring pattern, mark it as an implied type. We do this such @@ -20695,7 +23773,7 @@ var ts; var pattern = contextualType.pattern; // If array literal is contextually typed by a binding pattern or an assignment pattern, pad the resulting // tuple type with the corresponding binding or assignment element types to make the lengths equal. - if (pattern && (pattern.kind === 162 /* ArrayBindingPattern */ || pattern.kind === 164 /* ArrayLiteralExpression */)) { + if (pattern && (pattern.kind === 168 /* ArrayBindingPattern */ || pattern.kind === 170 /* ArrayLiteralExpression */)) { var patternElements = pattern.elements; for (var i = elementTypes.length; i < patternElements.length; i++) { var patternElement = patternElements[i]; @@ -20703,7 +23781,7 @@ var ts; elementTypes.push(contextualType.elementTypes[i]); } else { - if (patternElement.kind !== 187 /* OmittedExpression */) { + if (patternElement.kind !== 193 /* OmittedExpression */) { error(patternElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); } elementTypes.push(unknownType); @@ -20715,10 +23793,10 @@ var ts; } } } - return createArrayType(elementTypes.length ? getUnionType(elementTypes) : undefinedType); + return createArrayType(elementTypes.length ? getUnionType(elementTypes) : emptyArrayElementType); } function isNumericName(name) { - return name.kind === 136 /* ComputedPropertyName */ ? isNumericComputedName(name) : isNumericLiteralName(name.text); + return name.kind === 140 /* ComputedPropertyName */ ? isNumericComputedName(name) : isNumericLiteralName(name.text); } function isNumericComputedName(name) { // It seems odd to consider an expression of type Any to result in a numeric name, @@ -20726,7 +23804,7 @@ var ts; return isTypeAnyOrAllConstituentTypesHaveKind(checkComputedPropertyName(name), 132 /* NumberLike */); } function isTypeAnyOrAllConstituentTypesHaveKind(type, kind) { - return isTypeAny(type) || allConstituentTypesHaveKind(type, kind); + return isTypeAny(type) || isTypeOfKind(type, kind); } function isNumericLiteralName(name) { // The intent of numeric names is that @@ -20767,32 +23845,44 @@ var ts; } return links.resolvedType; } + function getObjectLiteralIndexInfo(node, properties, kind) { + var propTypes = []; + for (var i = 0; i < properties.length; i++) { + if (kind === 0 /* String */ || isNumericName(node.properties[i].name)) { + propTypes.push(getTypeOfSymbol(properties[i])); + } + } + var unionType = propTypes.length ? getUnionType(propTypes) : undefinedType; + return createIndexInfo(unionType, /*isReadonly*/ false); + } function checkObjectLiteral(node, contextualMapper) { - var inDestructuringPattern = isAssignmentTarget(node); + var inDestructuringPattern = ts.isAssignmentTarget(node); // Grammar checking checkGrammarObjectLiteralExpression(node, inDestructuringPattern); var propertiesTable = {}; var propertiesArray = []; var contextualType = getApparentTypeOfContextualType(node); var contextualTypeHasPattern = contextualType && contextualType.pattern && - (contextualType.pattern.kind === 161 /* ObjectBindingPattern */ || contextualType.pattern.kind === 165 /* ObjectLiteralExpression */); + (contextualType.pattern.kind === 167 /* ObjectBindingPattern */ || contextualType.pattern.kind === 171 /* ObjectLiteralExpression */); var typeFlags = 0; var patternWithComputedProperties = false; + var hasComputedStringProperty = false; + var hasComputedNumberProperty = false; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var memberDecl = _a[_i]; var member = memberDecl.symbol; - if (memberDecl.kind === 245 /* PropertyAssignment */ || - memberDecl.kind === 246 /* ShorthandPropertyAssignment */ || + if (memberDecl.kind === 253 /* PropertyAssignment */ || + memberDecl.kind === 254 /* ShorthandPropertyAssignment */ || ts.isObjectLiteralMethod(memberDecl)) { var type = void 0; - if (memberDecl.kind === 245 /* PropertyAssignment */) { + if (memberDecl.kind === 253 /* PropertyAssignment */) { type = checkPropertyAssignment(memberDecl, contextualMapper); } - else if (memberDecl.kind === 143 /* MethodDeclaration */) { + else if (memberDecl.kind === 147 /* MethodDeclaration */) { type = checkObjectLiteralMethod(memberDecl, contextualMapper); } else { - ts.Debug.assert(memberDecl.kind === 246 /* ShorthandPropertyAssignment */); + ts.Debug.assert(memberDecl.kind === 254 /* ShorthandPropertyAssignment */); type = checkExpression(memberDecl.name, contextualMapper); } typeFlags |= type.flags; @@ -20800,8 +23890,8 @@ var ts; if (inDestructuringPattern) { // If object literal is an assignment pattern and if the assignment pattern specifies a default value // for the property, make the property optional. - var isOptional = (memberDecl.kind === 245 /* PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) || - (memberDecl.kind === 246 /* ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer); + var isOptional = (memberDecl.kind === 253 /* PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) || + (memberDecl.kind === 254 /* ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer); if (isOptional) { prop.flags |= 536870912 /* Optional */; } @@ -20835,10 +23925,18 @@ var ts; // an ordinary function declaration(section 6.1) with no parameters. // A set accessor declaration is processed in the same manner // as an ordinary function declaration with a single parameter and a Void return type. - ts.Debug.assert(memberDecl.kind === 145 /* GetAccessor */ || memberDecl.kind === 146 /* SetAccessor */); + ts.Debug.assert(memberDecl.kind === 149 /* GetAccessor */ || memberDecl.kind === 150 /* SetAccessor */); checkAccessorDeclaration(memberDecl); } - if (!ts.hasDynamicName(memberDecl)) { + if (ts.hasDynamicName(memberDecl)) { + if (isNumericName(memberDecl.name)) { + hasComputedNumberProperty = true; + } + else { + hasComputedStringProperty = true; + } + } + else { propertiesTable[member.name] = member; } propertiesArray.push(member); @@ -20857,74 +23955,41 @@ var ts; } } } - var stringIndexType = getIndexType(0 /* String */); - var numberIndexType = getIndexType(1 /* Number */); - var result = createAnonymousType(node.symbol, propertiesTable, emptyArray, emptyArray, stringIndexType, numberIndexType); + var stringIndexInfo = hasComputedStringProperty ? getObjectLiteralIndexInfo(node, propertiesArray, 0 /* String */) : undefined; + var numberIndexInfo = hasComputedNumberProperty ? getObjectLiteralIndexInfo(node, propertiesArray, 1 /* Number */) : undefined; + var result = createAnonymousType(node.symbol, propertiesTable, emptyArray, emptyArray, stringIndexInfo, numberIndexInfo); var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 1048576 /* FreshObjectLiteral */; result.flags |= 524288 /* ObjectLiteral */ | 4194304 /* ContainsObjectLiteral */ | freshObjectLiteralFlag | (typeFlags & 14680064 /* PropagatingFlags */) | (patternWithComputedProperties ? 67108864 /* ObjectLiteralPatternWithComputedProperties */ : 0); if (inDestructuringPattern) { result.pattern = node; } return result; - function getIndexType(kind) { - if (contextualType && contextualTypeHasIndexSignature(contextualType, kind)) { - var propTypes = []; - for (var i = 0; i < propertiesArray.length; i++) { - var propertyDecl = node.properties[i]; - if (kind === 0 /* String */ || isNumericName(propertyDecl.name)) { - // Do not call getSymbolOfNode(propertyDecl), as that will get the - // original symbol for the node. We actually want to get the symbol - // created by checkObjectLiteral, since that will be appropriately - // contextually typed and resolved. - var type = getTypeOfSymbol(propertiesArray[i]); - if (!ts.contains(propTypes, type)) { - propTypes.push(type); - } - } - } - var result_1 = propTypes.length ? getUnionType(propTypes) : undefinedType; - typeFlags |= result_1.flags; - return result_1; - } - return undefined; - } } function checkJsxSelfClosingElement(node) { checkJsxOpeningLikeElement(node); return jsxElementType || anyType; } - function tagNamesAreEquivalent(lhs, rhs) { - if (lhs.kind !== rhs.kind) { - return false; - } - if (lhs.kind === 69 /* Identifier */) { - return lhs.text === rhs.text; - } - return lhs.right.text === rhs.right.text && - tagNamesAreEquivalent(lhs.left, rhs.left); - } function checkJsxElement(node) { // Check attributes checkJsxOpeningLikeElement(node.openingElement); - // Check that the closing tag matches - if (!tagNamesAreEquivalent(node.openingElement.tagName, node.closingElement.tagName)) { - error(node.closingElement, ts.Diagnostics.Expected_corresponding_JSX_closing_tag_for_0, ts.getTextOfNode(node.openingElement.tagName)); + // Perform resolution on the closing tag so that rename/go to definition/etc work + if (isJsxIntrinsicIdentifier(node.closingElement.tagName)) { + getIntrinsicTagSymbol(node.closingElement); } else { - // Perform resolution on the closing tag so that rename/go to definition/etc work - getJsxElementTagSymbol(node.closingElement); + checkExpression(node.closingElement.tagName); } // Check children for (var _i = 0, _a = node.children; _i < _a.length; _i++) { var child = _a[_i]; switch (child.kind) { - case 240 /* JsxExpression */: + case 248 /* JsxExpression */: checkJsxExpression(child); break; - case 233 /* JsxElement */: + case 241 /* JsxElement */: checkJsxElement(child); break; - case 234 /* JsxSelfClosingElement */: + case 242 /* JsxSelfClosingElement */: checkJsxSelfClosingElement(child); break; } @@ -20942,7 +24007,7 @@ var ts; * Returns true iff React would emit this tag name as a string rather than an identifier or qualified name */ function isJsxIntrinsicIdentifier(tagName) { - if (tagName.kind === 135 /* QualifiedName */) { + if (tagName.kind === 139 /* QualifiedName */) { return false; } else { @@ -21006,98 +24071,60 @@ var ts; } return type; } - /// Returns the type JSX.IntrinsicElements. May return `unknownType` if that type is not present. - function getJsxIntrinsicElementsType() { - if (!jsxIntrinsicElementsType) { - jsxIntrinsicElementsType = getExportedTypeFromNamespace(JsxNames.JSX, JsxNames.IntrinsicElements) || unknownType; + function getJsxType(name) { + if (jsxTypes[name] === undefined) { + return jsxTypes[name] = getExportedTypeFromNamespace(JsxNames.JSX, name) || unknownType; } - return jsxIntrinsicElementsType; + return jsxTypes[name]; } - /// Given a JSX opening element or self-closing element, return the symbol of the property that the tag name points to if - /// this is an intrinsic tag. This might be a named - /// property of the IntrinsicElements interface, or its string indexer. - /// If this is a class-based tag (otherwise returns undefined), returns the symbol of the class - /// type or factory function. - /// Otherwise, returns unknownSymbol. - function getJsxElementTagSymbol(node) { - var flags = 8 /* UnknownElement */; + /** + * Looks up an intrinsic tag name and returns a symbol that either points to an intrinsic + * property (in which case nodeLinks.jsxFlags will be IntrinsicNamedElement) or an intrinsic + * string index signature (in which case nodeLinks.jsxFlags will be IntrinsicIndexedElement). + * May also return unknownSymbol if both of these lookups fail. + */ + function getIntrinsicTagSymbol(node) { var links = getNodeLinks(node); if (!links.resolvedSymbol) { - if (isJsxIntrinsicIdentifier(node.tagName)) { - links.resolvedSymbol = lookupIntrinsicTag(node); - } - else { - links.resolvedSymbol = lookupClassTag(node); - } - } - return links.resolvedSymbol; - function lookupIntrinsicTag(node) { - var intrinsicElementsType = getJsxIntrinsicElementsType(); + var intrinsicElementsType = getJsxType(JsxNames.IntrinsicElements); if (intrinsicElementsType !== unknownType) { // Property case var intrinsicProp = getPropertyOfType(intrinsicElementsType, node.tagName.text); if (intrinsicProp) { links.jsxFlags |= 1 /* IntrinsicNamedElement */; - return intrinsicProp; + return links.resolvedSymbol = intrinsicProp; } // Intrinsic string indexer case var indexSignatureType = getIndexTypeOfType(intrinsicElementsType, 0 /* String */); if (indexSignatureType) { links.jsxFlags |= 2 /* IntrinsicIndexedElement */; - return intrinsicElementsType.symbol; + return links.resolvedSymbol = intrinsicElementsType.symbol; } // Wasn't found error(node, ts.Diagnostics.Property_0_does_not_exist_on_type_1, node.tagName.text, "JSX." + JsxNames.IntrinsicElements); - return unknownSymbol; + return links.resolvedSymbol = unknownSymbol; } else { if (compilerOptions.noImplicitAny) { error(node, ts.Diagnostics.JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists, JsxNames.IntrinsicElements); } + return links.resolvedSymbol = unknownSymbol; } } - function lookupClassTag(node) { - var valueSymbol = resolveJsxTagName(node); - // Look up the value in the current scope - if (valueSymbol && valueSymbol !== unknownSymbol) { - links.jsxFlags |= 4 /* ClassElement */; - if (valueSymbol.flags & 8388608 /* Alias */) { - markAliasSymbolAsReferenced(valueSymbol); - } - } - return valueSymbol || unknownSymbol; - } - function resolveJsxTagName(node) { - if (node.tagName.kind === 69 /* Identifier */) { - var tag = node.tagName; - var sym = getResolvedSymbol(tag); - return sym.exportSymbol || sym; - } - else { - return checkQualifiedName(node.tagName).symbol; - } - } + return links.resolvedSymbol; } /** * Given a JSX element that is a class element, finds the Element Instance Type. If the * element is not a class element, or the class element type cannot be determined, returns 'undefined'. * For example, in the element , the element instance type is `MyClass` (not `typeof MyClass`). */ - function getJsxElementInstanceType(node) { - // There is no such thing as an instance type for a non-class element. This - // line shouldn't be hit. - ts.Debug.assert(!!(getNodeLinks(node).jsxFlags & 4 /* ClassElement */), "Should not call getJsxElementInstanceType on non-class Element"); - var classSymbol = getJsxElementTagSymbol(node); - if (classSymbol === unknownSymbol) { - // Couldn't find the class instance type. Error has already been issued - return anyType; - } - var valueType = getTypeOfSymbol(classSymbol); + function getJsxElementInstanceType(node, valueType) { + ts.Debug.assert(!(valueType.flags & 16384 /* Union */)); if (isTypeAny(valueType)) { // Short-circuit if the class tag is using an element type 'any' return anyType; } - // Resolve the signatures, preferring constructors + // Resolve the signatures, preferring constructor var signatures = getSignaturesOfType(valueType, 1 /* Construct */); if (signatures.length === 0) { // No construct signatures, try call signatures @@ -21108,19 +24135,13 @@ var ts; return unknownType; } } - var returnType = getUnionType(signatures.map(getReturnTypeOfSignature)); - // Issue an error if this return type isn't assignable to JSX.ElementClass - var elemClassType = getJsxGlobalElementClassType(); - if (elemClassType) { - checkTypeRelatedTo(returnType, elemClassType, assignableRelation, node, ts.Diagnostics.JSX_element_type_0_is_not_a_constructor_function_for_JSX_elements); - } - return returnType; + return getUnionType(signatures.map(getReturnTypeOfSignature)); } /// e.g. "props" for React.d.ts, - /// or 'undefined' if ElementAttributesPropery doesn't exist (which means all + /// or 'undefined' if ElementAttributesProperty doesn't exist (which means all /// non-intrinsic elements' attributes type is 'any'), /// or '' if it has 0 properties (which means every - /// non-instrinsic elements' attributes type is the element instance type) + /// non-intrinsic elements' attributes type is the element instance type) function getJsxElementPropertiesName() { // JSX var jsxNamespace = getGlobalSymbol(JsxNames.JSX, 1536 /* Namespace */, /*diagnosticMessage*/ undefined); @@ -21128,7 +24149,7 @@ var ts; var attribsPropTypeSym = jsxNamespace && getSymbol(jsxNamespace.exports, JsxNames.ElementAttributesPropertyNameContainer, 793056 /* Type */); // JSX.ElementAttributesProperty [type] var attribPropType = attribsPropTypeSym && getDeclaredTypeOfSymbol(attribsPropTypeSym); - // The properites of JSX.ElementAttributesProperty + // The properties of JSX.ElementAttributesProperty var attribProperties = attribPropType && getPropertiesOfType(attribPropType); if (attribProperties) { // Element Attributes has zero properties, so the element attributes type will be the class instance type @@ -21148,6 +24169,94 @@ var ts; return undefined; } } + /** + * Given React element instance type and the class type, resolve the Jsx type + * Pass elemType to handle individual type in the union typed element type. + */ + function getResolvedJsxType(node, elemType, elemClassType) { + if (!elemType) { + elemType = checkExpression(node.tagName); + } + if (elemType.flags & 16384 /* Union */) { + var types = elemType.types; + return getUnionType(types.map(function (type) { + return getResolvedJsxType(node, type, elemClassType); + })); + } + // Get the element instance type (the result of newing or invoking this tag) + var elemInstanceType = getJsxElementInstanceType(node, elemType); + if (!elemClassType || !isTypeAssignableTo(elemInstanceType, elemClassType)) { + // Is this is a stateless function component? See if its single signature's return type is + // assignable to the JSX Element Type + if (jsxElementType) { + var callSignatures = elemType && getSignaturesOfType(elemType, 0 /* Call */); + var callSignature = callSignatures && callSignatures.length > 0 && callSignatures[0]; + var callReturnType = callSignature && getReturnTypeOfSignature(callSignature); + var paramType = callReturnType && (callSignature.parameters.length === 0 ? emptyObjectType : getTypeOfSymbol(callSignature.parameters[0])); + if (callReturnType && isTypeAssignableTo(callReturnType, jsxElementType)) { + // Intersect in JSX.IntrinsicAttributes if it exists + var intrinsicAttributes = getJsxType(JsxNames.IntrinsicAttributes); + if (intrinsicAttributes !== unknownType) { + paramType = intersectTypes(intrinsicAttributes, paramType); + } + return paramType; + } + } + } + // Issue an error if this return type isn't assignable to JSX.ElementClass + if (elemClassType) { + checkTypeRelatedTo(elemInstanceType, elemClassType, assignableRelation, node, ts.Diagnostics.JSX_element_type_0_is_not_a_constructor_function_for_JSX_elements); + } + if (isTypeAny(elemInstanceType)) { + return elemInstanceType; + } + var propsName = getJsxElementPropertiesName(); + if (propsName === undefined) { + // There is no type ElementAttributesProperty, return 'any' + return anyType; + } + else if (propsName === "") { + // If there is no e.g. 'props' member in ElementAttributesProperty, use the element class type instead + return elemInstanceType; + } + else { + var attributesType = getTypeOfPropertyOfType(elemInstanceType, propsName); + if (!attributesType) { + // There is no property named 'props' on this instance type + return emptyObjectType; + } + else if (isTypeAny(attributesType) || (attributesType === unknownType)) { + // Props is of type 'any' or unknown + return attributesType; + } + else if (attributesType.flags & 16384 /* Union */) { + // Props cannot be a union type + error(node.tagName, ts.Diagnostics.JSX_element_attributes_type_0_may_not_be_a_union_type, typeToString(attributesType)); + return anyType; + } + else { + // Normal case -- add in IntrinsicClassElements and IntrinsicElements + var apparentAttributesType = attributesType; + var intrinsicClassAttribs = getJsxType(JsxNames.IntrinsicClassAttributes); + if (intrinsicClassAttribs !== unknownType) { + var typeParams = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(intrinsicClassAttribs.symbol); + if (typeParams) { + if (typeParams.length === 1) { + apparentAttributesType = intersectTypes(createTypeReference(intrinsicClassAttribs, [elemInstanceType]), apparentAttributesType); + } + } + else { + apparentAttributesType = intersectTypes(attributesType, intrinsicClassAttribs); + } + } + var intrinsicAttribs = getJsxType(JsxNames.IntrinsicAttributes); + if (intrinsicAttribs !== unknownType) { + apparentAttributesType = intersectTypes(intrinsicAttribs, apparentAttributesType); + } + return apparentAttributesType; + } + } + } /** * Given an opening/self-closing element, get the 'element attributes type', i.e. the type that tells * us which attributes are valid on a given element. @@ -21155,48 +24264,21 @@ var ts; function getJsxElementAttributesType(node) { var links = getNodeLinks(node); if (!links.resolvedJsxType) { - var sym = getJsxElementTagSymbol(node); - if (links.jsxFlags & 4 /* ClassElement */) { - var elemInstanceType = getJsxElementInstanceType(node); - if (isTypeAny(elemInstanceType)) { - return links.resolvedJsxType = elemInstanceType; + if (isJsxIntrinsicIdentifier(node.tagName)) { + var symbol = getIntrinsicTagSymbol(node); + if (links.jsxFlags & 1 /* IntrinsicNamedElement */) { + return links.resolvedJsxType = getTypeOfSymbol(symbol); } - var propsName = getJsxElementPropertiesName(); - if (propsName === undefined) { - // There is no type ElementAttributesProperty, return 'any' - return links.resolvedJsxType = anyType; - } - else if (propsName === "") { - // If there is no e.g. 'props' member in ElementAttributesProperty, use the element class type instead - return links.resolvedJsxType = elemInstanceType; + else if (links.jsxFlags & 2 /* IntrinsicIndexedElement */) { + return links.resolvedJsxType = getIndexInfoOfSymbol(symbol, 0 /* String */).type; } else { - var attributesType = getTypeOfPropertyOfType(elemInstanceType, propsName); - if (!attributesType) { - // There is no property named 'props' on this instance type - return links.resolvedJsxType = emptyObjectType; - } - else if (isTypeAny(attributesType) || (attributesType === unknownType)) { - return links.resolvedJsxType = attributesType; - } - else if (!(attributesType.flags & 80896 /* ObjectType */)) { - error(node.tagName, ts.Diagnostics.JSX_element_attributes_type_0_must_be_an_object_type, typeToString(attributesType)); - return links.resolvedJsxType = anyType; - } - else { - return links.resolvedJsxType = attributesType; - } + return links.resolvedJsxType = unknownType; } } - else if (links.jsxFlags & 1 /* IntrinsicNamedElement */) { - return links.resolvedJsxType = getTypeOfSymbol(sym); - } - else if (links.jsxFlags & 2 /* IntrinsicIndexedElement */) { - return links.resolvedJsxType = getIndexTypeOfSymbol(sym, 0 /* String */); - } else { - // Resolution failed, so we don't know - return links.resolvedJsxType = anyType; + var elemClassType = getJsxGlobalElementClassType(); + return links.resolvedJsxType = getResolvedJsxType(node, undefined, elemClassType); } } return links.resolvedJsxType; @@ -21219,7 +24301,7 @@ var ts; } /// Returns all the properties of the Jsx.IntrinsicElements interface function getJsxIntrinsicTagNames() { - var intrinsics = getJsxIntrinsicElementsType(); + var intrinsics = getJsxType(JsxNames.IntrinsicElements); return intrinsics ? getPropertiesOfType(intrinsics) : emptyArray; } function checkJsxPreconditions(errorNode) { @@ -21236,14 +24318,13 @@ var ts; function checkJsxOpeningLikeElement(node) { checkGrammarJsxElement(node); checkJsxPreconditions(node); - // If we're compiling under --jsx react, the symbol 'React' should - // be marked as 'used' so we don't incorrectly elide its import. And if there - // is no 'React' symbol in scope, we should issue an error. - if (compilerOptions.jsx === 2 /* React */) { - var reactSym = resolveName(node.tagName, "React", 107455 /* Value */, ts.Diagnostics.Cannot_find_name_0, "React"); - if (reactSym) { - getSymbolLinks(reactSym).referenced = true; - } + // The reactNamespace symbol should be marked as 'used' so we don't incorrectly elide its import. And if there + // is no reactNamespace symbol in scope when targeting React emit, we should issue an error. + var reactRefErr = compilerOptions.jsx === 2 /* React */ ? ts.Diagnostics.Cannot_find_name_0 : undefined; + var reactNamespace = compilerOptions.reactNamespace ? compilerOptions.reactNamespace : "React"; + var reactSym = resolveName(node.tagName, reactNamespace, 107455 /* Value */, reactRefErr, reactNamespace); + if (reactSym) { + getSymbolLinks(reactSym).referenced = true; } var targetAttributesType = getJsxElementAttributesType(node); var nameTable = {}; @@ -21252,11 +24333,11 @@ var ts; // thus should have their types ignored var sawSpreadedAny = false; for (var i = node.attributes.length - 1; i >= 0; i--) { - if (node.attributes[i].kind === 238 /* JsxAttribute */) { + if (node.attributes[i].kind === 246 /* JsxAttribute */) { checkJsxAttribute((node.attributes[i]), targetAttributesType, nameTable); } else { - ts.Debug.assert(node.attributes[i].kind === 239 /* JsxSpreadAttribute */); + ts.Debug.assert(node.attributes[i].kind === 247 /* JsxSpreadAttribute */); var spreadType = checkJsxSpreadAttribute((node.attributes[i]), targetAttributesType, nameTable); if (isTypeAny(spreadType)) { sawSpreadedAny = true; @@ -21286,10 +24367,10 @@ var ts; // If a symbol is a synthesized symbol with no value declaration, we assume it is a property. Example of this are the synthesized // '.prototype' property as well as synthesized tuple index properties. function getDeclarationKindFromSymbol(s) { - return s.valueDeclaration ? s.valueDeclaration.kind : 141 /* PropertyDeclaration */; + return s.valueDeclaration ? s.valueDeclaration.kind : 145 /* PropertyDeclaration */; } function getDeclarationFlagsFromSymbol(s) { - return s.valueDeclaration ? ts.getCombinedNodeFlags(s.valueDeclaration) : s.flags & 134217728 /* Prototype */ ? 8 /* Public */ | 64 /* Static */ : 0; + return s.valueDeclaration ? ts.getCombinedNodeFlags(s.valueDeclaration) : s.flags & 134217728 /* Prototype */ ? 4 /* Public */ | 32 /* Static */ : 0; } /** * Check whether the requested property access is valid. @@ -21301,11 +24382,11 @@ var ts; */ function checkClassPropertyAccess(node, left, type, prop) { var flags = getDeclarationFlagsFromSymbol(prop); - var declaringClass = getDeclaredTypeOfSymbol(prop.parent); + var declaringClass = getDeclaredTypeOfSymbol(getParentOfSymbol(prop)); + var errorNode = node.kind === 172 /* PropertyAccessExpression */ || node.kind === 218 /* VariableDeclaration */ ? + node.name : + node.right; if (left.kind === 95 /* SuperKeyword */) { - var errorNode = node.kind === 166 /* PropertyAccessExpression */ ? - node.name : - node.right; // TS 1.0 spec (April 2014): 4.8.2 // - In a constructor, instance member function, instance member accessor, or // instance member variable initializer where this references a derived class instance, @@ -21313,7 +24394,7 @@ var ts; // - In a static member function or static member accessor // where this references the constructor function object of a derived class, // a super property access is permitted and must specify a public static member function of the base class. - if (getDeclarationKindFromSymbol(prop) !== 143 /* MethodDeclaration */) { + if (languageVersion < 2 /* ES6 */ && getDeclarationKindFromSymbol(prop) !== 147 /* MethodDeclaration */) { // `prop` refers to a *property* declared in the super class // rather than a *method*, so it does not satisfy the above criteria. error(errorNode, ts.Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword); @@ -21329,17 +24410,15 @@ var ts; } } // Public properties are otherwise accessible. - if (!(flags & (16 /* Private */ | 32 /* Protected */))) { + if (!(flags & (8 /* Private */ | 16 /* Protected */))) { return true; } // Property is known to be private or protected at this point - // Get the declaring and enclosing class instance types - var enclosingClassDeclaration = ts.getContainingClass(node); - var enclosingClass = enclosingClassDeclaration ? getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingClassDeclaration)) : undefined; - // Private property is accessible if declaring and enclosing class are the same - if (flags & 16 /* Private */) { - if (declaringClass !== enclosingClass) { - error(node, ts.Diagnostics.Property_0_is_private_and_only_accessible_within_class_1, symbolToString(prop), typeToString(declaringClass)); + // Private property is accessible if the property is within the declaring class + if (flags & 8 /* Private */) { + var declaringClassDeclaration = getClassLikeDeclarationOfSymbol(getParentOfSymbol(prop)); + if (!isNodeWithinClass(node, declaringClassDeclaration)) { + error(errorNode, ts.Diagnostics.Property_0_is_private_and_only_accessible_within_class_1, symbolToString(prop), typeToString(declaringClass)); return false; } return true; @@ -21349,13 +24428,18 @@ var ts; if (left.kind === 95 /* SuperKeyword */) { return true; } - // A protected property is accessible in the declaring class and classes derived from it - if (!enclosingClass || !hasBaseType(enclosingClass, declaringClass)) { - error(node, ts.Diagnostics.Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses, symbolToString(prop), typeToString(declaringClass)); + // Get the enclosing class that has the declaring class as its base type + var enclosingClass = forEachEnclosingClass(node, function (enclosingDeclaration) { + var enclosingClass = getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingDeclaration)); + return hasBaseType(enclosingClass, declaringClass) ? enclosingClass : undefined; + }); + // A protected property is accessible if the property is within the declaring class or classes derived from it + if (!enclosingClass) { + error(errorNode, ts.Diagnostics.Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses, symbolToString(prop), typeToString(declaringClass)); return false; } // No further restrictions for static properties - if (flags & 64 /* Static */) { + if (flags & 32 /* Static */) { return true; } // An instance property must be accessed through an instance of the enclosing class @@ -21365,11 +24449,25 @@ var ts; } // TODO: why is the first part of this check here? if (!(getTargetType(type).flags & (1024 /* Class */ | 2048 /* Interface */) && hasBaseType(type, enclosingClass))) { - error(node, ts.Diagnostics.Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1, symbolToString(prop), typeToString(enclosingClass)); + error(errorNode, ts.Diagnostics.Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1, symbolToString(prop), typeToString(enclosingClass)); return false; } return true; } + function checkNonNullExpression(node) { + var type = checkExpression(node); + if (strictNullChecks) { + var kind = getNullableKind(type); + if (kind) { + error(node, kind & 32 /* Undefined */ ? kind & 64 /* Null */ ? + ts.Diagnostics.Object_is_possibly_null_or_undefined : + ts.Diagnostics.Object_is_possibly_undefined : + ts.Diagnostics.Object_is_possibly_null); + } + return getNonNullableType(type); + } + return type; + } function checkPropertyAccessExpression(node) { return checkPropertyAccessExpressionOrQualifiedName(node, node.expression, node.name); } @@ -21377,7 +24475,7 @@ var ts; return checkPropertyAccessExpressionOrQualifiedName(node, node.left, node.right); } function checkPropertyAccessExpressionOrQualifiedName(node, left, right) { - var type = checkExpression(left); + var type = checkNonNullExpression(left); if (isTypeAny(type)) { return type; } @@ -21397,10 +24495,29 @@ var ts; if (prop.parent && prop.parent.flags & 32 /* Class */) { checkClassPropertyAccess(node, left, apparentType, prop); } - return getTypeOfSymbol(prop); + var propType = getTypeOfSymbol(prop); + if (node.kind !== 172 /* PropertyAccessExpression */ || ts.isAssignmentTarget(node) || + !(propType.flags & 16384 /* Union */) && !(prop.flags & (3 /* Variable */ | 4 /* Property */ | 98304 /* Accessor */))) { + return propType; + } + var leftmostNode = getLeftmostIdentifierOrThis(node); + if (!leftmostNode) { + return propType; + } + if (leftmostNode.kind === 69 /* Identifier */) { + var leftmostSymbol = getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(leftmostNode)); + if (!leftmostSymbol) { + return propType; + } + var declaration = leftmostSymbol.valueDeclaration; + if (!declaration || declaration.kind !== 218 /* VariableDeclaration */ && declaration.kind !== 142 /* Parameter */ && declaration.kind !== 169 /* BindingElement */) { + return propType; + } + } + return getFlowTypeOfReference(node, propType, /*assumeInitialized*/ true); } function isValidPropertyAccess(node, propertyName) { - var left = node.kind === 166 /* PropertyAccessExpression */ + var left = node.kind === 172 /* PropertyAccessExpression */ ? node.expression : node.left; var type = checkExpression(left); @@ -21412,11 +24529,58 @@ var ts; } return true; } + /** + * Return the symbol of the for-in variable declared or referenced by the given for-in statement. + */ + function getForInVariableSymbol(node) { + var initializer = node.initializer; + if (initializer.kind === 219 /* VariableDeclarationList */) { + var variable = initializer.declarations[0]; + if (variable && !ts.isBindingPattern(variable.name)) { + return getSymbolOfNode(variable); + } + } + else if (initializer.kind === 69 /* Identifier */) { + return getResolvedSymbol(initializer); + } + return undefined; + } + /** + * Return true if the given type is considered to have numeric property names. + */ + function hasNumericPropertyNames(type) { + return getIndexTypeOfType(type, 1 /* Number */) && !getIndexTypeOfType(type, 0 /* String */); + } + /** + * Return true if given node is an expression consisting of an identifier (possibly parenthesized) + * that references a for-in variable for an object with numeric property names. + */ + function isForInVariableForNumericPropertyNames(expr) { + var e = skipParenthesizedNodes(expr); + if (e.kind === 69 /* Identifier */) { + var symbol = getResolvedSymbol(e); + if (symbol.flags & 3 /* Variable */) { + var child = expr; + var node = expr.parent; + while (node) { + if (node.kind === 207 /* ForInStatement */ && + child === node.statement && + getForInVariableSymbol(node) === symbol && + hasNumericPropertyNames(checkExpression(node.expression))) { + return true; + } + child = node; + node = node.parent; + } + } + } + return false; + } function checkIndexedAccess(node) { // Grammar checking if (!node.argumentExpression) { - var sourceFile = getSourceFile(node); - if (node.parent.kind === 169 /* NewExpression */ && node.parent.expression === node) { + var sourceFile = ts.getSourceFileOfNode(node); + if (node.parent.kind === 175 /* NewExpression */ && node.parent.expression === node) { var start = ts.skipTrivia(sourceFile.text, node.expression.end); var end = node.end; grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead); @@ -21428,7 +24592,7 @@ var ts; } } // Obtain base constraint such that we can bail out if the constraint is an unknown type - var objectType = getApparentType(checkExpression(node.expression)); + var objectType = getApparentType(checkNonNullExpression(node.expression)); var indexType = node.argumentExpression ? checkExpression(node.argumentExpression) : unknownType; if (objectType === unknownType) { return unknownType; @@ -21449,15 +24613,15 @@ var ts; // - Otherwise, if IndexExpr is of type Any, the String or Number primitive type, or an enum type, the property access is of type Any. // See if we can index as a property. if (node.argumentExpression) { - var name_11 = getPropertyNameForIndexedAccess(node.argumentExpression, indexType); - if (name_11 !== undefined) { - var prop = getPropertyOfType(objectType, name_11); + var name_12 = getPropertyNameForIndexedAccess(node.argumentExpression, indexType); + if (name_12 !== undefined) { + var prop = getPropertyOfType(objectType, name_12); if (prop) { getNodeLinks(node).resolvedSymbol = prop; return getTypeOfSymbol(prop); } else if (isConstEnum) { - error(node.argumentExpression, ts.Diagnostics.Property_0_does_not_exist_on_const_enum_1, name_11, symbolToString(objectType.symbol)); + error(node.argumentExpression, ts.Diagnostics.Property_0_does_not_exist_on_const_enum_1, name_12, symbolToString(objectType.symbol)); return unknownType; } } @@ -21465,20 +24629,24 @@ var ts; // Check for compatible indexer types. if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, 258 /* StringLike */ | 132 /* NumberLike */ | 16777216 /* ESSymbol */)) { // Try to use a number indexer. - if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, 132 /* NumberLike */)) { - var numberIndexType = getIndexTypeOfType(objectType, 1 /* Number */); - if (numberIndexType) { - return numberIndexType; + if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, 132 /* NumberLike */) || isForInVariableForNumericPropertyNames(node.argumentExpression)) { + var numberIndexInfo = getIndexInfoOfType(objectType, 1 /* Number */); + if (numberIndexInfo) { + getNodeLinks(node).resolvedIndexInfo = numberIndexInfo; + return numberIndexInfo.type; } } // Try to use string indexing. - var stringIndexType = getIndexTypeOfType(objectType, 0 /* String */); - if (stringIndexType) { - return stringIndexType; + var stringIndexInfo = getIndexInfoOfType(objectType, 0 /* String */); + if (stringIndexInfo) { + getNodeLinks(node).resolvedIndexInfo = stringIndexInfo; + return stringIndexInfo.type; } // Fall back to any. if (compilerOptions.noImplicitAny && !compilerOptions.suppressImplicitAnyIndexErrors && !isTypeAny(objectType)) { - error(node, ts.Diagnostics.Index_signature_of_object_type_implicitly_has_an_any_type); + error(node, getIndexTypeOfType(objectType, 1 /* Number */) ? + ts.Diagnostics.Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number : + ts.Diagnostics.Index_signature_of_object_type_implicitly_has_an_any_type); } return anyType; } @@ -21497,7 +24665,7 @@ var ts; if (indexArgumentExpression.kind === 9 /* StringLiteral */ || indexArgumentExpression.kind === 8 /* NumericLiteral */) { return indexArgumentExpression.text; } - if (indexArgumentExpression.kind === 167 /* ElementAccessExpression */ || indexArgumentExpression.kind === 166 /* PropertyAccessExpression */) { + if (indexArgumentExpression.kind === 173 /* ElementAccessExpression */ || indexArgumentExpression.kind === 172 /* PropertyAccessExpression */) { var value = getConstantValue(indexArgumentExpression); if (value !== undefined) { return value.toString(); @@ -21552,10 +24720,10 @@ var ts; return true; } function resolveUntypedCall(node) { - if (node.kind === 170 /* TaggedTemplateExpression */) { + if (node.kind === 176 /* TaggedTemplateExpression */) { checkExpression(node.template); } - else if (node.kind !== 139 /* Decorator */) { + else if (node.kind !== 143 /* Decorator */) { ts.forEach(node.arguments, function (argument) { checkExpression(argument); }); @@ -21585,13 +24753,13 @@ var ts; for (var _i = 0, signatures_2 = signatures; _i < signatures_2.length; _i++) { var signature = signatures_2[_i]; var symbol = signature.declaration && getSymbolOfNode(signature.declaration); - var parent_5 = signature.declaration && signature.declaration.parent; + var parent_9 = signature.declaration && signature.declaration.parent; if (!lastSymbol || symbol === lastSymbol) { - if (lastParent && parent_5 === lastParent) { + if (lastParent && parent_9 === lastParent) { index++; } else { - lastParent = parent_5; + lastParent = parent_9; index = cutoffIndex; } } @@ -21599,7 +24767,7 @@ var ts; // current declaration belongs to a different symbol // set cutoffIndex so re-orderings in the future won't change result set from 0 to cutoffIndex index = cutoffIndex = result.length; - lastParent = parent_5; + lastParent = parent_9; } lastSymbol = symbol; // specialized signatures always need to be placed before non-specialized signatures regardless @@ -21621,7 +24789,7 @@ var ts; function getSpreadArgumentIndex(args) { for (var i = 0; i < args.length; i++) { var arg = args[i]; - if (arg && arg.kind === 185 /* SpreadElementExpression */) { + if (arg && arg.kind === 191 /* SpreadElementExpression */) { return i; } } @@ -21633,13 +24801,13 @@ var ts; var callIsIncomplete; // In incomplete call we want to be lenient when we have too few arguments var isDecorator; var spreadArgIndex = -1; - if (node.kind === 170 /* TaggedTemplateExpression */) { + if (node.kind === 176 /* TaggedTemplateExpression */) { var tagExpression = node; // Even if the call is incomplete, we'll have a missing expression as our last argument, // so we can say the count is just the arg list length adjustedArgCount = args.length; typeArguments = undefined; - if (tagExpression.template.kind === 183 /* TemplateExpression */) { + if (tagExpression.template.kind === 189 /* TemplateExpression */) { // If a tagged template expression lacks a tail literal, the call is incomplete. // Specifically, a template only can end in a TemplateTail or a Missing literal. var templateExpression = tagExpression.template; @@ -21656,7 +24824,7 @@ var ts; callIsIncomplete = !!templateLiteral.isUnterminated; } } - else if (node.kind === 139 /* Decorator */) { + else if (node.kind === 143 /* Decorator */) { isDecorator = true; typeArguments = undefined; adjustedArgCount = getEffectiveArgumentCount(node, /*args*/ undefined, signature); @@ -21665,7 +24833,7 @@ var ts; var callExpression = node; if (!callExpression.arguments) { // This only happens when we have something of the form: 'new C' - ts.Debug.assert(callExpression.kind === 169 /* NewExpression */); + ts.Debug.assert(callExpression.kind === 175 /* NewExpression */); return signature.minArgumentCount === 0; } // For IDE scenarios we may have an incomplete call, so a trailing comma is tantamount to adding another argument. @@ -21700,7 +24868,7 @@ var ts; if (type.flags & 80896 /* ObjectType */) { var resolved = resolveStructuredTypeMembers(type); if (resolved.callSignatures.length === 1 && resolved.constructSignatures.length === 0 && - resolved.properties.length === 0 && !resolved.stringIndexType && !resolved.numberIndexType) { + resolved.properties.length === 0 && !resolved.stringIndexInfo && !resolved.numberIndexInfo) { return resolved.callSignatures[0]; } } @@ -21717,7 +24885,7 @@ var ts; } function inferTypeArguments(node, signature, args, excludeArgument, context) { var typeParameters = signature.typeParameters; - var inferenceMapper = createInferenceMapper(context); + var inferenceMapper = getInferenceMapper(context); // Clear out all the inference results from the last time inferTypeArguments was called on this context for (var i = 0; i < typeParameters.length; i++) { // As an optimization, we don't have to clear (and later recompute) inferred types @@ -21738,13 +24906,18 @@ var ts; if (context.failedTypeParameterIndex !== undefined && !context.inferences[context.failedTypeParameterIndex].isFixed) { context.failedTypeParameterIndex = undefined; } + if (signature.thisType) { + var thisArgumentNode = getThisArgumentOfCall(node); + var thisArgumentType = thisArgumentNode ? checkExpression(thisArgumentNode) : voidType; + inferTypes(context, thisArgumentType, signature.thisType); + } // We perform two passes over the arguments. In the first pass we infer from all arguments, but use // wildcards for all context sensitive function expressions. var argCount = getEffectiveArgumentCount(node, args, signature); for (var i = 0; i < argCount; i++) { var arg = getEffectiveArgument(node, args, i); // If the effective argument is 'undefined', then it is an argument that is present but is synthetic. - if (arg === undefined || arg.kind !== 187 /* OmittedExpression */) { + if (arg === undefined || arg.kind !== 193 /* OmittedExpression */) { var paramType = getTypeAtPosition(signature, i); var argType = getEffectiveArgumentType(node, i, arg); // If the effective argument type is 'undefined', there is no synthetic type @@ -21765,7 +24938,7 @@ var ts; // Tagged template expressions will always have `undefined` for `excludeArgument[0]`. if (excludeArgument) { for (var i = 0; i < argCount; i++) { - // No need to check for omitted args and template expressions, their exlusion value is always undefined + // No need to check for omitted args and template expressions, their exclusion value is always undefined if (excludeArgument[i] === false) { var arg = args[i]; var paramType = getTypeAtPosition(signature, i); @@ -21775,14 +24948,11 @@ var ts; } getInferredTypes(context); } - function checkTypeArguments(signature, typeArguments, typeArgumentResultTypes, reportErrors, headMessage) { + function checkTypeArguments(signature, typeArgumentNodes, typeArgumentTypes, reportErrors, headMessage) { var typeParameters = signature.typeParameters; var typeArgumentsAreAssignable = true; + var mapper; for (var i = 0; i < typeParameters.length; i++) { - var typeArgNode = typeArguments[i]; - var typeArgument = getTypeFromTypeNode(typeArgNode); - // Do not push on this array! It has a preallocated length - typeArgumentResultTypes[i] = typeArgument; if (typeArgumentsAreAssignable /* so far */) { var constraint = getConstraintOfTypeParameter(typeParameters[i]); if (constraint) { @@ -21792,18 +24962,35 @@ var ts; errorInfo = ts.chainDiagnosticMessages(errorInfo, typeArgumentHeadMessage); typeArgumentHeadMessage = headMessage; } - typeArgumentsAreAssignable = checkTypeAssignableTo(typeArgument, constraint, reportErrors ? typeArgNode : undefined, typeArgumentHeadMessage, errorInfo); + if (!mapper) { + mapper = createTypeMapper(typeParameters, typeArgumentTypes); + } + var typeArgument = typeArgumentTypes[i]; + typeArgumentsAreAssignable = checkTypeAssignableTo(typeArgument, getTypeWithThisArgument(instantiateType(constraint, mapper), typeArgument), reportErrors ? typeArgumentNodes[i] : undefined, typeArgumentHeadMessage, errorInfo); } } } return typeArgumentsAreAssignable; } function checkApplicableSignature(node, args, signature, relation, excludeArgument, reportErrors) { + if (signature.thisType && signature.thisType !== voidType && node.kind !== 175 /* NewExpression */) { + // If the called expression is not of the form `x.f` or `x["f"]`, then sourceType = voidType + // If the signature's 'this' type is voidType, then the check is skipped -- anything is compatible. + // If the expression is a new expression, then the check is skipped. + var thisArgumentNode = getThisArgumentOfCall(node); + var thisArgumentType = thisArgumentNode ? checkExpression(thisArgumentNode) : voidType; + var errorNode = reportErrors ? (thisArgumentNode || node) : undefined; + var headMessage_1 = ts.Diagnostics.The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1; + if (!checkTypeRelatedTo(thisArgumentType, signature.thisType, relation, errorNode, headMessage_1)) { + return false; + } + } + var headMessage = ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1; var argCount = getEffectiveArgumentCount(node, args, signature); for (var i = 0; i < argCount; i++) { var arg = getEffectiveArgument(node, args, i); // If the effective argument is 'undefined', then it is an argument that is present but is synthetic. - if (arg === undefined || arg.kind !== 187 /* OmittedExpression */) { + if (arg === undefined || arg.kind !== 193 /* OmittedExpression */) { // Check spread elements against rest type (from arity check we know spread argument corresponds to a rest parameter) var paramType = getTypeAtPosition(signature, i); var argType = getEffectiveArgumentType(node, i, arg); @@ -21811,12 +24998,11 @@ var ts; // for the argument. In that case, we should check the argument. if (argType === undefined) { argType = arg.kind === 9 /* StringLiteral */ && !reportErrors - ? getStringLiteralType(arg) + ? getStringLiteralTypeForText(arg.text) : checkExpressionWithContextualType(arg, paramType, excludeArgument && excludeArgument[i] ? identityMapper : undefined); } // Use argument expression as error location when reporting errors var errorNode = reportErrors ? getEffectiveArgumentErrorNode(node, i, arg) : undefined; - var headMessage = ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1; if (!checkTypeRelatedTo(argType, paramType, relation, errorNode, headMessage)) { return false; } @@ -21824,6 +25010,20 @@ var ts; } return true; } + /** + * Returns the this argument in calls like x.f(...) and x[f](...). Undefined otherwise. + */ + function getThisArgumentOfCall(node) { + if (node.kind === 174 /* CallExpression */) { + var callee = node.expression; + if (callee.kind === 172 /* PropertyAccessExpression */) { + return callee.expression; + } + else if (callee.kind === 173 /* ElementAccessExpression */) { + return callee.expression; + } + } + } /** * Returns the effective arguments for an expression that works like a function invocation. * @@ -21835,16 +25035,16 @@ var ts; */ function getEffectiveCallArguments(node) { var args; - if (node.kind === 170 /* TaggedTemplateExpression */) { + if (node.kind === 176 /* TaggedTemplateExpression */) { var template = node.template; args = [undefined]; - if (template.kind === 183 /* TemplateExpression */) { + if (template.kind === 189 /* TemplateExpression */) { ts.forEach(template.templateSpans, function (span) { args.push(span.expression); }); } } - else if (node.kind === 139 /* Decorator */) { + else if (node.kind === 143 /* Decorator */) { // For a decorator, we return undefined as we will determine // the number and types of arguments for a decorator using // `getEffectiveArgumentCount` and `getEffectiveArgumentType` below. @@ -21869,19 +25069,19 @@ var ts; * Otherwise, the argument count is the length of the 'args' array. */ function getEffectiveArgumentCount(node, args, signature) { - if (node.kind === 139 /* Decorator */) { + if (node.kind === 143 /* Decorator */) { switch (node.parent.kind) { - case 214 /* ClassDeclaration */: - case 186 /* ClassExpression */: + case 221 /* ClassDeclaration */: + case 192 /* ClassExpression */: // A class decorator will have one argument (see `ClassDecorator` in core.d.ts) return 1; - case 141 /* PropertyDeclaration */: + case 145 /* PropertyDeclaration */: // A property declaration decorator will have two arguments (see // `PropertyDecorator` in core.d.ts) return 2; - case 143 /* MethodDeclaration */: - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: + case 147 /* MethodDeclaration */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: // A method or accessor declaration decorator will have two or three arguments (see // `PropertyDecorator` and `MethodDecorator` in core.d.ts) // If we are emitting decorators for ES3, we will only pass two arguments. @@ -21891,7 +25091,7 @@ var ts; // If the method decorator signature only accepts a target and a key, we will only // type check those arguments. return signature.parameters.length >= 3 ? 3 : 2; - case 138 /* Parameter */: + case 142 /* Parameter */: // A parameter declaration decorator will have three arguments (see // `ParameterDecorator` in core.d.ts) return 3; @@ -21915,25 +25115,25 @@ var ts; */ function getEffectiveDecoratorFirstArgumentType(node) { // The first argument to a decorator is its `target`. - if (node.kind === 214 /* ClassDeclaration */) { + if (node.kind === 221 /* ClassDeclaration */) { // For a class decorator, the `target` is the type of the class (e.g. the // "static" or "constructor" side of the class) var classSymbol = getSymbolOfNode(node); return getTypeOfSymbol(classSymbol); } - if (node.kind === 138 /* Parameter */) { + if (node.kind === 142 /* Parameter */) { // For a parameter decorator, the `target` is the parent type of the // parameter's containing method. node = node.parent; - if (node.kind === 144 /* Constructor */) { + if (node.kind === 148 /* Constructor */) { var classSymbol = getSymbolOfNode(node); return getTypeOfSymbol(classSymbol); } } - if (node.kind === 141 /* PropertyDeclaration */ || - node.kind === 143 /* MethodDeclaration */ || - node.kind === 145 /* GetAccessor */ || - node.kind === 146 /* SetAccessor */) { + if (node.kind === 145 /* PropertyDeclaration */ || + node.kind === 147 /* MethodDeclaration */ || + node.kind === 149 /* GetAccessor */ || + node.kind === 150 /* SetAccessor */) { // For a property or method decorator, the `target` is the // "static"-side type of the parent of the member if the member is // declared "static"; otherwise, it is the "instance"-side type of the @@ -21960,21 +25160,21 @@ var ts; */ function getEffectiveDecoratorSecondArgumentType(node) { // The second argument to a decorator is its `propertyKey` - if (node.kind === 214 /* ClassDeclaration */) { + if (node.kind === 221 /* ClassDeclaration */) { ts.Debug.fail("Class decorators should not have a second synthetic argument."); return unknownType; } - if (node.kind === 138 /* Parameter */) { + if (node.kind === 142 /* Parameter */) { node = node.parent; - if (node.kind === 144 /* Constructor */) { + if (node.kind === 148 /* Constructor */) { // For a constructor parameter decorator, the `propertyKey` will be `undefined`. return anyType; } } - if (node.kind === 141 /* PropertyDeclaration */ || - node.kind === 143 /* MethodDeclaration */ || - node.kind === 145 /* GetAccessor */ || - node.kind === 146 /* SetAccessor */) { + if (node.kind === 145 /* PropertyDeclaration */ || + node.kind === 147 /* MethodDeclaration */ || + node.kind === 149 /* GetAccessor */ || + node.kind === 150 /* SetAccessor */) { // The `propertyKey` for a property or method decorator will be a // string literal type if the member name is an identifier, number, or string; // otherwise, if the member name is a computed property name it will @@ -21984,10 +25184,10 @@ var ts; case 69 /* Identifier */: case 8 /* NumericLiteral */: case 9 /* StringLiteral */: - return getStringLiteralType(element.name); - case 136 /* ComputedPropertyName */: + return getStringLiteralTypeForText(element.name.text); + case 140 /* ComputedPropertyName */: var nameType = checkComputedPropertyName(element.name); - if (allConstituentTypesHaveKind(nameType, 16777216 /* ESSymbol */)) { + if (isTypeOfKind(nameType, 16777216 /* ESSymbol */)) { return nameType; } else { @@ -22010,22 +25210,22 @@ var ts; */ function getEffectiveDecoratorThirdArgumentType(node) { // The third argument to a decorator is either its `descriptor` for a method decorator - // or its `parameterIndex` for a paramter decorator - if (node.kind === 214 /* ClassDeclaration */) { + // or its `parameterIndex` for a parameter decorator + if (node.kind === 221 /* ClassDeclaration */) { ts.Debug.fail("Class decorators should not have a third synthetic argument."); return unknownType; } - if (node.kind === 138 /* Parameter */) { + if (node.kind === 142 /* Parameter */) { // The `parameterIndex` for a parameter decorator is always a number return numberType; } - if (node.kind === 141 /* PropertyDeclaration */) { + if (node.kind === 145 /* PropertyDeclaration */) { ts.Debug.fail("Property decorators should not have a third synthetic argument."); return unknownType; } - if (node.kind === 143 /* MethodDeclaration */ || - node.kind === 145 /* GetAccessor */ || - node.kind === 146 /* SetAccessor */) { + if (node.kind === 147 /* MethodDeclaration */ || + node.kind === 149 /* GetAccessor */ || + node.kind === 150 /* SetAccessor */) { // The `descriptor` for a method decorator will be a `TypedPropertyDescriptor` // for the type of the member. var propertyType = getTypeOfNode(node); @@ -22057,11 +25257,11 @@ var ts; // Decorators provide special arguments, a tagged template expression provides // a special first argument, and string literals get string literal types // unless we're reporting errors - if (node.kind === 139 /* Decorator */) { + if (node.kind === 143 /* Decorator */) { return getEffectiveDecoratorArgumentType(node, argIndex); } - else if (argIndex === 0 && node.kind === 170 /* TaggedTemplateExpression */) { - return globalTemplateStringsArrayType; + else if (argIndex === 0 && node.kind === 176 /* TaggedTemplateExpression */) { + return getGlobalTemplateStringsArrayType(); } // This is not a synthetic argument, so we return 'undefined' // to signal that the caller needs to check the argument. @@ -22072,8 +25272,8 @@ var ts; */ function getEffectiveArgument(node, args, argIndex) { // For a decorator or the first argument of a tagged template expression we return undefined. - if (node.kind === 139 /* Decorator */ || - (argIndex === 0 && node.kind === 170 /* TaggedTemplateExpression */)) { + if (node.kind === 143 /* Decorator */ || + (argIndex === 0 && node.kind === 176 /* TaggedTemplateExpression */)) { return undefined; } return args[argIndex]; @@ -22082,11 +25282,11 @@ var ts; * Gets the error node to use when reporting errors for an effective argument. */ function getEffectiveArgumentErrorNode(node, argIndex, arg) { - if (node.kind === 139 /* Decorator */) { + if (node.kind === 143 /* Decorator */) { // For a decorator, we use the expression of the decorator for error reporting. return node.expression; } - else if (argIndex === 0 && node.kind === 170 /* TaggedTemplateExpression */) { + else if (argIndex === 0 && node.kind === 176 /* TaggedTemplateExpression */) { // For a the first argument of a tagged template expression, we use the template of the tag for error reporting. return node.template; } @@ -22095,8 +25295,8 @@ var ts; } } function resolveCall(node, signatures, candidatesOutArray, headMessage) { - var isTaggedTemplate = node.kind === 170 /* TaggedTemplateExpression */; - var isDecorator = node.kind === 139 /* Decorator */; + var isTaggedTemplate = node.kind === 176 /* TaggedTemplateExpression */; + var isDecorator = node.kind === 143 /* Decorator */; var typeArguments; if (!isTaggedTemplate && !isDecorator) { typeArguments = node.typeArguments; @@ -22202,7 +25402,8 @@ var ts; } else if (candidateForTypeArgumentError) { if (!isTaggedTemplate && !isDecorator && typeArguments) { - checkTypeArguments(candidateForTypeArgumentError, node.typeArguments, [], /*reportErrors*/ true, headMessage); + var typeArguments_2 = node.typeArguments; + checkTypeArguments(candidateForTypeArgumentError, typeArguments_2, ts.map(typeArguments_2, getTypeFromTypeNode), /*reportErrors*/ true, headMessage); } else { ts.Debug.assert(resultOfFailedInference.failedTypeParameterIndex >= 0); @@ -22260,7 +25461,7 @@ var ts; if (candidate.typeParameters) { var typeArgumentTypes = void 0; if (typeArguments) { - typeArgumentTypes = new Array(candidate.typeParameters.length); + typeArgumentTypes = ts.map(typeArguments, getTypeFromTypeNode); typeArgumentsAreValid = checkTypeArguments(candidate, typeArguments, typeArgumentTypes, /*reportErrors*/ false); } else { @@ -22314,12 +25515,14 @@ var ts; // In super call, the candidate signatures are the matching arity signatures of the base constructor function instantiated // with the type arguments specified in the extends clause. var baseTypeNode = ts.getClassExtendsHeritageClauseElement(ts.getContainingClass(node)); - var baseConstructors = getInstantiatedConstructorsForTypeArguments(superType, baseTypeNode.typeArguments); - return resolveCall(node, baseConstructors, candidatesOutArray); + if (baseTypeNode) { + var baseConstructors = getInstantiatedConstructorsForTypeArguments(superType, baseTypeNode.typeArguments); + return resolveCall(node, baseConstructors, candidatesOutArray); + } } return resolveUntypedCall(node); } - var funcType = checkExpression(node.expression); + var funcType = checkNonNullExpression(node.expression); var apparentType = getApparentType(funcType); if (apparentType === unknownType) { // Another error has already been reported @@ -22339,7 +25542,7 @@ var ts; // We exclude union types because we may have a union of function types that happen to have // no common signatures. if (isTypeAny(funcType) || (!callSignatures.length && !constructSignatures.length && !(funcType.flags & 16384 /* Union */) && isTypeAssignableTo(funcType, globalFunctionType))) { - // The unknownType indicates that an error already occured (and was reported). No + // The unknownType indicates that an error already occurred (and was reported). No // need to report another error in this case. if (funcType !== unknownType && node.typeArguments) { error(node, ts.Diagnostics.Untyped_function_calls_may_not_accept_type_arguments); @@ -22367,7 +25570,7 @@ var ts; error(node.arguments[spreadIndex], ts.Diagnostics.Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_5_and_higher); } } - var expressionType = checkExpression(node.expression); + var expressionType = checkNonNullExpression(node.expression); // If expressionType's apparent type(section 3.8.1) is an object type with one or // more construct signatures, the expression is processed in the same manner as a // function call, but using the construct signatures as the initial set of candidate @@ -22402,23 +25605,53 @@ var ts; // that the user will not add any. var constructSignatures = getSignaturesOfType(expressionType, 1 /* Construct */); if (constructSignatures.length) { + if (!isConstructorAccessible(node, constructSignatures[0])) { + return resolveErrorCall(node); + } return resolveCall(node, constructSignatures, candidatesOutArray); } // If expressionType's apparent type is an object type with no construct signatures but // one or more call signatures, the expression is processed as a function call. A compile-time // error occurs if the result of the function call is not Void. The type of the result of the - // operation is Any. + // operation is Any. It is an error to have a Void this type. var callSignatures = getSignaturesOfType(expressionType, 0 /* Call */); if (callSignatures.length) { var signature = resolveCall(node, callSignatures, candidatesOutArray); if (getReturnTypeOfSignature(signature) !== voidType) { error(node, ts.Diagnostics.Only_a_void_function_can_be_called_with_the_new_keyword); } + if (signature.thisType === voidType) { + error(node, ts.Diagnostics.A_function_that_is_called_with_the_new_keyword_cannot_have_a_this_type_that_is_void); + } return signature; } error(node, ts.Diagnostics.Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature); return resolveErrorCall(node); } + function isConstructorAccessible(node, signature) { + if (!signature || !signature.declaration) { + return true; + } + var declaration = signature.declaration; + var flags = declaration.flags; + // Public constructor is accessible. + if (!(flags & (8 /* Private */ | 16 /* Protected */))) { + return true; + } + var declaringClassDeclaration = getClassLikeDeclarationOfSymbol(declaration.parent.symbol); + var declaringClass = getDeclaredTypeOfSymbol(declaration.parent.symbol); + // A private or protected constructor can only be instantiated within it's own class + if (!isNodeWithinClass(node, declaringClassDeclaration)) { + if (flags & 8 /* Private */) { + error(node, ts.Diagnostics.Constructor_of_class_0_is_private_and_only_accessible_within_the_class_declaration, typeToString(declaringClass)); + } + if (flags & 16 /* Protected */) { + error(node, ts.Diagnostics.Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration, typeToString(declaringClass)); + } + return false; + } + return true; + } function resolveTaggedTemplateExpression(node, candidatesOutArray) { var tagType = checkExpression(node.tag); var apparentType = getApparentType(tagType); @@ -22441,16 +25674,16 @@ var ts; */ function getDiagnosticHeadMessageForDecoratorResolution(node) { switch (node.parent.kind) { - case 214 /* ClassDeclaration */: - case 186 /* ClassExpression */: + case 221 /* ClassDeclaration */: + case 192 /* ClassExpression */: return ts.Diagnostics.Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression; - case 138 /* Parameter */: + case 142 /* Parameter */: return ts.Diagnostics.Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression; - case 141 /* PropertyDeclaration */: + case 145 /* PropertyDeclaration */: return ts.Diagnostics.Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression; - case 143 /* MethodDeclaration */: - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: + case 147 /* MethodDeclaration */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: return ts.Diagnostics.Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression; } } @@ -22469,7 +25702,7 @@ var ts; } var headMessage = getDiagnosticHeadMessageForDecoratorResolution(node); if (!callSignatures.length) { - var errorInfo; + var errorInfo = void 0; errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature); errorInfo = ts.chainDiagnosticMessages(errorInfo, headMessage); diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(node, errorInfo)); @@ -22477,6 +25710,19 @@ var ts; } return resolveCall(node, callSignatures, candidatesOutArray, headMessage); } + function resolveSignature(node, candidatesOutArray) { + switch (node.kind) { + case 174 /* CallExpression */: + return resolveCallExpression(node, candidatesOutArray); + case 175 /* NewExpression */: + return resolveNewExpression(node, candidatesOutArray); + case 176 /* TaggedTemplateExpression */: + return resolveTaggedTemplateExpression(node, candidatesOutArray); + case 143 /* Decorator */: + return resolveDecorator(node, candidatesOutArray); + } + ts.Debug.fail("Branch in 'resolveSignature' should be unreachable."); + } // candidatesOutArray is passed by signature help in the language service, and collectCandidates // must fill it up with the appropriate candidate signatures function getResolvedSignature(node, candidatesOutArray) { @@ -22485,25 +25731,29 @@ var ts; // However, it is possible that either candidatesOutArray was not passed in the first time, // or that a different candidatesOutArray was passed in. Therefore, we need to redo the work // to correctly fill the candidatesOutArray. - if (!links.resolvedSignature || candidatesOutArray) { - links.resolvedSignature = anySignature; - if (node.kind === 168 /* CallExpression */) { - links.resolvedSignature = resolveCallExpression(node, candidatesOutArray); - } - else if (node.kind === 169 /* NewExpression */) { - links.resolvedSignature = resolveNewExpression(node, candidatesOutArray); - } - else if (node.kind === 170 /* TaggedTemplateExpression */) { - links.resolvedSignature = resolveTaggedTemplateExpression(node, candidatesOutArray); - } - else if (node.kind === 139 /* Decorator */) { - links.resolvedSignature = resolveDecorator(node, candidatesOutArray); - } - else { - ts.Debug.fail("Branch in 'getResolvedSignature' should be unreachable."); - } + var cached = links.resolvedSignature; + if (cached && cached !== anySignature && !candidatesOutArray) { + return cached; } - return links.resolvedSignature; + links.resolvedSignature = anySignature; + var result = resolveSignature(node, candidatesOutArray); + // If signature resolution originated in control flow type analysis (for example to compute the + // assigned type in a flow assignment) we don't cache the result as it may be based on temporary + // types from the control flow analysis. + links.resolvedSignature = flowLoopStart === flowLoopCount ? result : cached; + return result; + } + function getResolvedOrAnySignature(node) { + // If we're already in the process of resolving the given signature, don't resolve again as + // that could cause infinite recursion. Instead, return anySignature. + return getNodeLinks(node).resolvedSignature === anySignature ? anySignature : getResolvedSignature(node); + } + function getInferredClassType(symbol) { + var links = getSymbolLinks(symbol); + if (!links.inferredClassType) { + links.inferredClassType = createAnonymousType(undefined, symbol.members, emptyArray, emptyArray, /*stringIndexType*/ undefined, /*numberIndexType*/ undefined); + } + return links.inferredClassType; } /** * Syntactically and semantically checks a call or new expression. @@ -22517,21 +25767,28 @@ var ts; if (node.expression.kind === 95 /* SuperKeyword */) { return voidType; } - if (node.kind === 169 /* NewExpression */) { + if (node.kind === 175 /* NewExpression */) { var declaration = signature.declaration; if (declaration && - declaration.kind !== 144 /* Constructor */ && - declaration.kind !== 148 /* ConstructSignature */ && - declaration.kind !== 153 /* ConstructorType */) { - // When resolved signature is a call signature (and not a construct signature) the result type is any - if (compilerOptions.noImplicitAny) { + declaration.kind !== 148 /* Constructor */ && + declaration.kind !== 152 /* ConstructSignature */ && + declaration.kind !== 157 /* ConstructorType */ && + !ts.isJSDocConstructSignature(declaration)) { + // When resolved signature is a call signature (and not a construct signature) the result type is any, unless + // the declaring function had members created through 'x.prototype.y = expr' or 'this.y = expr' psuedodeclarations + // in a JS file + var funcSymbol = checkExpression(node.expression).symbol; + if (funcSymbol && funcSymbol.members && (funcSymbol.flags & 16 /* Function */)) { + return getInferredClassType(funcSymbol); + } + else if (compilerOptions.noImplicitAny) { error(node, ts.Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type); } return anyType; } } // In JavaScript files, calls to any identifier 'require' are treated as external module imports - if (ts.isInJavaScriptFile(node) && ts.isRequireCall(node)) { + if (ts.isInJavaScriptFile(node) && ts.isRequireCall(node, /*checkArgumentIsStringLiteral*/ true)) { return resolveExternalModuleTypeByLiteral(node.arguments[0]); } return getReturnTypeOfSignature(signature); @@ -22544,19 +25801,29 @@ var ts; var targetType = getTypeFromTypeNode(node.type); if (produceDiagnostics && targetType !== unknownType) { var widenedType = getWidenedType(exprType); - // Permit 'number[] | "foo"' to be asserted to 'string'. - var bothAreStringLike = someConstituentTypeHasKind(targetType, 258 /* StringLike */) && - someConstituentTypeHasKind(widenedType, 258 /* StringLike */); - if (!bothAreStringLike && !(isTypeAssignableTo(targetType, widenedType))) { - checkTypeAssignableTo(exprType, targetType, node, ts.Diagnostics.Neither_type_0_nor_type_1_is_assignable_to_the_other); + if (!isTypeComparableTo(targetType, widenedType)) { + checkTypeComparableTo(exprType, targetType, node, ts.Diagnostics.Type_0_cannot_be_converted_to_type_1); } } return targetType; } + function checkNonNullAssertion(node) { + return getNonNullableType(checkExpression(node.expression)); + } + function getTypeOfParameter(symbol) { + var type = getTypeOfSymbol(symbol); + if (strictNullChecks) { + var declaration = symbol.valueDeclaration; + if (declaration && declaration.initializer) { + return addNullableKind(type, 32 /* Undefined */); + } + } + return type; + } function getTypeAtPosition(signature, pos) { return signature.hasRestParameter ? - pos < signature.parameters.length - 1 ? getTypeOfSymbol(signature.parameters[pos]) : getRestTypeOfSignature(signature) : - pos < signature.parameters.length ? getTypeOfSymbol(signature.parameters[pos]) : anyType; + pos < signature.parameters.length - 1 ? getTypeOfParameter(signature.parameters[pos]) : getRestTypeOfSignature(signature) : + pos < signature.parameters.length ? getTypeOfParameter(signature.parameters[pos]) : anyType; } function assignContextualParameterTypes(signature, context, mapper) { var len = signature.parameters.length - (signature.hasRestParameter ? 1 : 0); @@ -22577,7 +25844,7 @@ var ts; if (ts.isBindingPattern(node.name)) { for (var _i = 0, _a = node.name.elements; _i < _a.length; _i++) { var element = _a[_i]; - if (element.kind !== 187 /* OmittedExpression */) { + if (element.kind !== 193 /* OmittedExpression */) { if (element.name.kind === 69 /* Identifier */) { getSymbolLinks(getSymbolOfNode(element)).type = getTypeForBindingElement(element); } @@ -22590,6 +25857,12 @@ var ts; var links = getSymbolLinks(parameter); if (!links.type) { links.type = instantiateType(contextualType, mapper); + // if inference didn't come up with anything but {}, fall back to the binding pattern if present. + if (links.type === emptyObjectType && + (parameter.valueDeclaration.name.kind === 167 /* ObjectBindingPattern */ || + parameter.valueDeclaration.name.kind === 168 /* ArrayBindingPattern */)) { + links.type = getTypeFromBindingPattern(parameter.valueDeclaration.name); + } assignBindingElementTypes(parameter.valueDeclaration); } else if (isInferentialContext(mapper)) { @@ -22625,6 +25898,13 @@ var ts; inferTypes(mapper.context, links.type, instantiateType(contextualType, mapper)); } } + function getReturnTypeFromJSDocComment(func) { + var returnTag = ts.getJSDocReturnTag(func); + if (returnTag && returnTag.typeExpression) { + return getTypeFromTypeNode(returnTag.typeExpression.type); + } + return undefined; + } function createPromiseType(promisedType) { // creates a `Promise` type where `T` is the promisedType argument var globalPromiseType = getGlobalPromiseType(); @@ -22642,7 +25922,7 @@ var ts; } var isAsync = ts.isAsyncFunctionLike(func); var type; - if (func.body.kind !== 192 /* Block */) { + if (func.body.kind !== 199 /* Block */) { type = checkExpressionCached(func.body, contextualMapper); if (isAsync) { // From within an async function you can return either a non-promise value or a promise. Any @@ -22653,7 +25933,7 @@ var ts; } } else { - var types; + var types = void 0; var funcIsGenerator = !!func.asteriskToken; if (funcIsGenerator) { types = checkAndAggregateYieldOperandTypes(func.body, contextualMapper); @@ -22666,7 +25946,11 @@ var ts; } } else { - types = checkAndAggregateReturnExpressionTypes(func.body, contextualMapper, isAsync); + var hasImplicitReturn = !!(func.flags & 32768 /* HasImplicitReturn */); + types = checkAndAggregateReturnExpressionTypes(func.body, contextualMapper, isAsync, hasImplicitReturn); + if (!types) { + return neverType; + } if (types.length === 0) { if (isAsync) { // For an async function, the return type will not be void, but rather a Promise for void. @@ -22677,9 +25961,7 @@ var ts; } return promiseType; } - else { - return voidType; - } + return voidType; } } // When yield/return statements are contextually typed we allow the return type to be a union type. @@ -22692,7 +25974,8 @@ var ts; } else { error(func, ts.Diagnostics.No_best_common_type_exists_among_return_expressions); - return unknownType; + // Defer to unioning the return types so we get a) downstream errors earlier and b) better Salsa experience + return getUnionType(types); } } if (funcIsGenerator) { @@ -22735,8 +26018,9 @@ var ts; }); return aggregatedTypes; } - function checkAndAggregateReturnExpressionTypes(body, contextualMapper, isAsync) { + function checkAndAggregateReturnExpressionTypes(body, contextualMapper, isAsync, hasImplicitReturn) { var aggregatedTypes = []; + var hasOmittedExpressions = false; ts.forEachReturnStatement(body, function (returnStatement) { var expr = returnStatement.expression; if (expr) { @@ -22748,55 +26032,87 @@ var ts; // the native Promise type by the caller. type = checkAwaitedType(type, body.parent, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member); } - if (!ts.contains(aggregatedTypes, type)) { + if (type !== neverType && !ts.contains(aggregatedTypes, type)) { aggregatedTypes.push(type); } } + else { + hasOmittedExpressions = true; + } }); + if (aggregatedTypes.length === 0 && !hasOmittedExpressions && !hasImplicitReturn) { + return undefined; + } + if (strictNullChecks && aggregatedTypes.length && (hasOmittedExpressions || hasImplicitReturn)) { + if (!ts.contains(aggregatedTypes, undefinedType)) { + aggregatedTypes.push(undefinedType); + } + } return aggregatedTypes; } - // TypeScript Specification 1.0 (6.3) - July 2014 - // An explicitly typed function whose return type isn't the Void or the Any type - // must have at least one return statement somewhere in its body. - // An exception to this rule is if the function implementation consists of a single 'throw' statement. + /** + * TypeScript Specification 1.0 (6.3) - July 2014 + * An explicitly typed function whose return type isn't the Void type, + * the Any type, or a union type containing the Void or Any type as a constituent + * must have at least one return statement somewhere in its body. + * An exception to this rule is if the function implementation consists of a single 'throw' statement. + * + * @param returnType - return type of the function, can be undefined if return type is not explicitly specified + */ function checkAllCodePathsInNonVoidFunctionReturnOrThrow(func, returnType) { if (!produceDiagnostics) { return; } - // Functions that return 'void' or 'any' don't need any return expressions. - if (returnType === voidType || isTypeAny(returnType)) { + // Functions with with an explicitly specified 'void' or 'any' return type don't need any return expressions. + if (returnType && maybeTypeOfKind(returnType, 1 /* Any */ | 16 /* Void */)) { return; } // If all we have is a function signature, or an arrow function with an expression body, then there is nothing to check. - // also if HasImplicitReturnValue flags is not set this means that all codepaths in function body end with return of throw - if (ts.nodeIsMissing(func.body) || func.body.kind !== 192 /* Block */ || !(func.flags & 524288 /* HasImplicitReturn */)) { + // also if HasImplicitReturn flag is not set this means that all codepaths in function body end with return or throw + if (ts.nodeIsMissing(func.body) || func.body.kind !== 199 /* Block */ || !(func.flags & 32768 /* HasImplicitReturn */)) { return; } - if (func.flags & 1048576 /* HasExplicitReturn */) { - if (compilerOptions.noImplicitReturns) { - error(func.type, ts.Diagnostics.Not_all_code_paths_return_a_value); - } + var hasExplicitReturn = func.flags & 65536 /* HasExplicitReturn */; + if (returnType === neverType) { + error(func.type, ts.Diagnostics.A_function_returning_never_cannot_have_a_reachable_end_point); } - else { - // This function does not conform to the specification. + else if (returnType && !hasExplicitReturn) { + // minimal check: function has syntactic return type annotation and no explicit return statements in the body + // this function does not conform to the specification. + // NOTE: having returnType !== undefined is a precondition for entering this branch so func.type will always be present error(func.type, ts.Diagnostics.A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value); } + else if (returnType && strictNullChecks && !isTypeAssignableTo(undefinedType, returnType)) { + error(func.type, ts.Diagnostics.Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined); + } + else if (compilerOptions.noImplicitReturns) { + if (!returnType) { + // If return type annotation is omitted check if function has any explicit return statements. + // If it does not have any - its inferred return type is void - don't do any checks. + // Otherwise get inferred return type from function body and report error only if it is not void / anytype + if (!hasExplicitReturn) { + return; + } + var inferredReturnType = getReturnTypeOfSignature(getSignatureFromDeclaration(func)); + if (isUnwrappedReturnTypeVoidOrAny(func, inferredReturnType)) { + return; + } + } + error(func.type || func, ts.Diagnostics.Not_all_code_paths_return_a_value); + } } function checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper) { - ts.Debug.assert(node.kind !== 143 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 147 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); // Grammar checking var hasGrammarError = checkGrammarFunctionLikeDeclaration(node); - if (!hasGrammarError && node.kind === 173 /* FunctionExpression */) { + if (!hasGrammarError && node.kind === 179 /* FunctionExpression */) { checkGrammarForGenerator(node); } // The identityMapper object is used to indicate that function expressions are wildcards if (contextualMapper === identityMapper && isContextSensitive(node)) { + checkNodeDeferred(node); return anyFunctionType; } - var isAsync = ts.isAsyncFunctionLike(node); - if (isAsync) { - emitAwaiter = true; - } var links = getNodeLinks(node); var type = getTypeOfSymbol(node.symbol); var contextSensitive = isContextSensitive(node); @@ -22826,28 +26142,23 @@ var ts; } if (!contextChecked) { checkSignatureDeclaration(node); + checkNodeDeferred(node); } } } - if (produceDiagnostics && node.kind !== 143 /* MethodDeclaration */ && node.kind !== 142 /* MethodSignature */) { + if (produceDiagnostics && node.kind !== 147 /* MethodDeclaration */ && node.kind !== 146 /* MethodSignature */) { checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); } return type; } - function checkFunctionExpressionOrObjectLiteralMethodBody(node) { - ts.Debug.assert(node.kind !== 143 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + function checkFunctionExpressionOrObjectLiteralMethodDeferred(node) { + ts.Debug.assert(node.kind !== 147 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); var isAsync = ts.isAsyncFunctionLike(node); - if (isAsync) { - emitAwaiter = true; - } - var returnType = node.type && getTypeFromTypeNode(node.type); - var promisedType; - if (returnType && isAsync) { - promisedType = checkAsyncFunctionReturnType(node); - } - if (returnType && !node.asteriskToken) { - checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, isAsync ? promisedType : returnType); + var returnOrPromisedType = node.type && (isAsync ? checkAsyncFunctionReturnType(node) : getTypeFromTypeNode(node.type)); + if (!node.asteriskToken) { + // return is not necessary in the body of generators + checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnOrPromisedType); } if (node.body) { if (!node.type) { @@ -22858,7 +26169,7 @@ var ts; // checkFunctionExpressionBodies). So it must be done now. getReturnTypeOfSignature(getSignatureFromDeclaration(node)); } - if (node.body.kind === 192 /* Block */) { + if (node.body.kind === 199 /* Block */) { checkSourceElement(node.body); } else { @@ -22868,16 +26179,15 @@ var ts; // check assignability of the awaited type of the expression body against the promised type of // its return type annotation. var exprType = checkExpression(node.body); - if (returnType) { + if (returnOrPromisedType) { if (isAsync) { var awaitedType = checkAwaitedType(exprType, node.body, ts.Diagnostics.Expression_body_for_async_arrow_function_does_not_have_a_valid_callable_then_member); - checkTypeAssignableTo(awaitedType, promisedType, node.body); + checkTypeAssignableTo(awaitedType, returnOrPromisedType, node.body); } else { - checkTypeAssignableTo(exprType, returnType, node.body); + checkTypeAssignableTo(exprType, returnOrPromisedType, node.body); } } - checkFunctionAndClassExpressionBodies(node.body); } } } @@ -22888,75 +26198,74 @@ var ts; } return true; } - function checkReferenceExpression(n, invalidReferenceMessage, constantVariableMessage) { - function findSymbol(n) { - var symbol = getNodeLinks(n).resolvedSymbol; - // Because we got the symbol from the resolvedSymbol property, it might be of kind - // SymbolFlags.ExportValue. In this case it is necessary to get the actual export - // symbol, which will have the correct flags set on it. - return symbol && getExportSymbolOfValueSymbolIfExported(symbol); + function isReadonlySymbol(symbol) { + // The following symbols are considered read-only: + // Properties with a 'readonly' modifier + // Variables declared with 'const' + // Get accessors without matching set accessors + // Enum members + return symbol.flags & 4 /* Property */ && (getDeclarationFlagsFromSymbol(symbol) & 64 /* Readonly */) !== 0 || + symbol.flags & 3 /* Variable */ && (getDeclarationFlagsFromSymbol(symbol) & 2048 /* Const */) !== 0 || + symbol.flags & 98304 /* Accessor */ && !(symbol.flags & 65536 /* SetAccessor */) || + (symbol.flags & 8 /* EnumMember */) !== 0; + } + function isReferenceToReadonlyEntity(expr, symbol) { + if (isReadonlySymbol(symbol)) { + // Allow assignments to readonly properties within constructors of the same class declaration. + if (symbol.flags & 4 /* Property */ && + (expr.kind === 172 /* PropertyAccessExpression */ || expr.kind === 173 /* ElementAccessExpression */) && + expr.expression.kind === 97 /* ThisKeyword */) { + var func = ts.getContainingFunction(expr); + return !(func && func.kind === 148 /* Constructor */ && func.parent === symbol.valueDeclaration.parent); + } + return true; } - function isReferenceOrErrorExpression(n) { - // TypeScript 1.0 spec (April 2014): - // Expressions are classified as values or references. - // References are the subset of expressions that are permitted as the target of an assignment. - // Specifically, references are combinations of identifiers(section 4.3), parentheses(section 4.7), - // and property accesses(section 4.10). - // All other expression constructs described in this chapter are classified as values. - switch (n.kind) { - case 69 /* Identifier */: { - var symbol = findSymbol(n); - // TypeScript 1.0 spec (April 2014): 4.3 - // An identifier expression that references a variable or parameter is classified as a reference. - // An identifier expression that references any other kind of entity is classified as a value(and therefore cannot be the target of an assignment). - return !symbol || symbol === unknownSymbol || symbol === argumentsSymbol || (symbol.flags & 3 /* Variable */) !== 0; + return false; + } + function isReferenceThroughNamespaceImport(expr) { + if (expr.kind === 172 /* PropertyAccessExpression */ || expr.kind === 173 /* ElementAccessExpression */) { + var node = skipParenthesizedNodes(expr.expression); + if (node.kind === 69 /* Identifier */) { + var symbol = getNodeLinks(node).resolvedSymbol; + if (symbol.flags & 8388608 /* Alias */) { + var declaration = getDeclarationOfAliasSymbol(symbol); + return declaration && declaration.kind === 232 /* NamespaceImport */; } - case 166 /* PropertyAccessExpression */: { - var symbol = findSymbol(n); - // TypeScript 1.0 spec (April 2014): 4.10 - // A property access expression is always classified as a reference. - // NOTE (not in spec): assignment to enum members should not be allowed - return !symbol || symbol === unknownSymbol || (symbol.flags & ~8 /* EnumMember */) !== 0; - } - case 167 /* ElementAccessExpression */: - // old compiler doesn't check indexed access - return true; - case 172 /* ParenthesizedExpression */: - return isReferenceOrErrorExpression(n.expression); - default: - return false; } } - function isConstVariableReference(n) { - switch (n.kind) { - case 69 /* Identifier */: - case 166 /* PropertyAccessExpression */: { - var symbol = findSymbol(n); - return symbol && (symbol.flags & 3 /* Variable */) !== 0 && (getDeclarationFlagsFromSymbol(symbol) & 16384 /* Const */) !== 0; - } - case 167 /* ElementAccessExpression */: { - var index = n.argumentExpression; - var symbol = findSymbol(n.expression); - if (symbol && index && index.kind === 9 /* StringLiteral */) { - var name_12 = index.text; - var prop = getPropertyOfType(getTypeOfSymbol(symbol), name_12); - return prop && (prop.flags & 3 /* Variable */) !== 0 && (getDeclarationFlagsFromSymbol(prop) & 16384 /* Const */) !== 0; - } + return false; + } + function checkReferenceExpression(expr, invalidReferenceMessage, constantVariableMessage) { + // References are combinations of identifiers, parentheses, and property accesses. + var node = skipParenthesizedNodes(expr); + if (node.kind !== 69 /* Identifier */ && node.kind !== 172 /* PropertyAccessExpression */ && node.kind !== 173 /* ElementAccessExpression */) { + error(expr, invalidReferenceMessage); + return false; + } + // Because we get the symbol from the resolvedSymbol property, it might be of kind + // SymbolFlags.ExportValue. In this case it is necessary to get the actual export + // symbol, which will have the correct flags set on it. + var links = getNodeLinks(node); + var symbol = getExportSymbolOfValueSymbolIfExported(links.resolvedSymbol); + if (symbol) { + if (symbol !== unknownSymbol && symbol !== argumentsSymbol) { + // Only variables (and not functions, classes, namespaces, enum objects, or enum members) + // are considered references when referenced using a simple identifier. + if (node.kind === 69 /* Identifier */ && !(symbol.flags & 3 /* Variable */)) { + error(expr, invalidReferenceMessage); return false; } - case 172 /* ParenthesizedExpression */: - return isConstVariableReference(n.expression); - default: + if (isReferenceToReadonlyEntity(node, symbol) || isReferenceThroughNamespaceImport(node)) { + error(expr, constantVariableMessage); return false; + } } } - if (!isReferenceOrErrorExpression(n)) { - error(n, invalidReferenceMessage); - return false; - } - if (isConstVariableReference(n)) { - error(n, constantVariableMessage); - return false; + else if (node.kind === 173 /* ElementAccessExpression */) { + if (links.resolvedIndexInfo && links.resolvedIndexInfo.isReadonly) { + error(expr, constantVariableMessage); + return false; + } } return true; } @@ -22975,7 +26284,7 @@ var ts; function checkAwaitExpression(node) { // Grammar checking if (produceDiagnostics) { - if (!(node.parserContextFlags & 8 /* Await */)) { + if (!(node.flags & 33554432 /* AwaitContext */)) { grammarErrorOnFirstToken(node, ts.Diagnostics.await_expression_is_only_allowed_within_an_async_function); } if (isInParameterInitializerBeforeContainingFunction(node)) { @@ -22991,7 +26300,7 @@ var ts; case 35 /* PlusToken */: case 36 /* MinusToken */: case 50 /* TildeToken */: - if (someConstituentTypeHasKind(operandType, 16777216 /* ESSymbol */)) { + if (maybeTypeOfKind(operandType, 16777216 /* ESSymbol */)) { error(node.operand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(node.operator)); } return numberType; @@ -22999,10 +26308,10 @@ var ts; return booleanType; case 41 /* PlusPlusToken */: case 42 /* MinusMinusToken */: - var ok = checkArithmeticOperandType(node.operand, operandType, ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); + var ok = checkArithmeticOperandType(node.operand, getNonNullableType(operandType), ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); if (ok) { // run check only if former checks succeeded to avoid reporting cascading errors - checkReferenceExpression(node.operand, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant); + checkReferenceExpression(node.operand, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant_or_a_read_only_property); } return numberType; } @@ -23010,46 +26319,56 @@ var ts; } function checkPostfixUnaryExpression(node) { var operandType = checkExpression(node.operand); - var ok = checkArithmeticOperandType(node.operand, operandType, ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); + var ok = checkArithmeticOperandType(node.operand, getNonNullableType(operandType), ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); if (ok) { // run check only if former checks succeeded to avoid reporting cascading errors - checkReferenceExpression(node.operand, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant); + checkReferenceExpression(node.operand, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant_or_a_read_only_property); } return numberType; } - // Just like isTypeOfKind below, except that it returns true if *any* constituent - // has this kind. - function someConstituentTypeHasKind(type, kind) { - if (type.flags & kind) { - return true; - } - if (type.flags & 49152 /* UnionOrIntersection */) { - var types = type.types; - for (var _i = 0, types_9 = types; _i < types_9.length; _i++) { - var current = types_9[_i]; - if (current.flags & kind) { - return true; - } - } - return false; - } - return false; - } - // Return true if type has the given flags, or is a union or intersection type composed of types that all have those flags. - function allConstituentTypesHaveKind(type, kind) { + // Return true if type might be of the given kind. A union or intersection type might be of a given + // kind if at least one constituent type is of the given kind. + function maybeTypeOfKind(type, kind) { if (type.flags & kind) { return true; } if (type.flags & 49152 /* UnionOrIntersection */) { var types = type.types; for (var _i = 0, types_10 = types; _i < types_10.length; _i++) { - var current = types_10[_i]; - if (!(current.flags & kind)) { + var t = types_10[_i]; + if (maybeTypeOfKind(t, kind)) { + return true; + } + } + } + return false; + } + // Return true if type is of the given kind. A union type is of a given kind if all constituent types + // are of the given kind. An intersection type is of a given kind if at least one constituent type is + // of the given kind. + function isTypeOfKind(type, kind) { + if (type.flags & kind) { + return true; + } + if (type.flags & 16384 /* Union */) { + var types = type.types; + for (var _i = 0, types_11 = types; _i < types_11.length; _i++) { + var t = types_11[_i]; + if (!isTypeOfKind(t, kind)) { return false; } } return true; } + if (type.flags & 32768 /* Intersection */) { + var types = type.types; + for (var _a = 0, types_12 = types; _a < types_12.length; _a++) { + var t = types_12[_a]; + if (isTypeOfKind(t, kind)) { + return true; + } + } + } return false; } function isConstEnumObjectType(type) { @@ -23064,7 +26383,7 @@ var ts; // and the right operand to be of type Any or a subtype of the 'Function' interface type. // The result is always of the Boolean primitive type. // NOTE: do not raise error if leftType is unknown as related error was already reported - if (allConstituentTypesHaveKind(leftType, 16777726 /* Primitive */)) { + if (isTypeOfKind(leftType, 16777726 /* Primitive */)) { error(left, ts.Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); } // NOTE: do not raise error if right is unknown as related error was already reported @@ -23090,38 +26409,41 @@ var ts; var properties = node.properties; for (var _i = 0, properties_3 = properties; _i < properties_3.length; _i++) { var p = properties_3[_i]; - if (p.kind === 245 /* PropertyAssignment */ || p.kind === 246 /* ShorthandPropertyAssignment */) { - var name_13 = p.name; - if (name_13.kind === 136 /* ComputedPropertyName */) { - checkComputedPropertyName(name_13); - } - if (isComputedNonLiteralName(name_13)) { - continue; - } - var text = getTextOfPropertyName(name_13); - var type = isTypeAny(sourceType) - ? sourceType - : getTypeOfPropertyOfType(sourceType, text) || - isNumericLiteralName(text) && getIndexTypeOfType(sourceType, 1 /* Number */) || - getIndexTypeOfType(sourceType, 0 /* String */); - if (type) { - if (p.kind === 246 /* ShorthandPropertyAssignment */) { - checkDestructuringAssignment(p, type); - } - else { - // non-shorthand property assignments should always have initializers - checkDestructuringAssignment(p.initializer, type); - } + checkObjectLiteralDestructuringPropertyAssignment(sourceType, p, contextualMapper); + } + return sourceType; + } + function checkObjectLiteralDestructuringPropertyAssignment(objectLiteralType, property, contextualMapper) { + if (property.kind === 253 /* PropertyAssignment */ || property.kind === 254 /* ShorthandPropertyAssignment */) { + var name_13 = property.name; + if (name_13.kind === 140 /* ComputedPropertyName */) { + checkComputedPropertyName(name_13); + } + if (isComputedNonLiteralName(name_13)) { + return undefined; + } + var text = getTextOfPropertyName(name_13); + var type = isTypeAny(objectLiteralType) + ? objectLiteralType + : getTypeOfPropertyOfType(objectLiteralType, text) || + isNumericLiteralName(text) && getIndexTypeOfType(objectLiteralType, 1 /* Number */) || + getIndexTypeOfType(objectLiteralType, 0 /* String */); + if (type) { + if (property.kind === 254 /* ShorthandPropertyAssignment */) { + return checkDestructuringAssignment(property, type); } else { - error(name_13, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(sourceType), ts.declarationNameToString(name_13)); + // non-shorthand property assignments should always have initializers + return checkDestructuringAssignment(property.initializer, type); } } else { - error(p, ts.Diagnostics.Property_assignment_expected); + error(name_13, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(objectLiteralType), ts.declarationNameToString(name_13)); } } - return sourceType; + else { + error(property, ts.Diagnostics.Property_assignment_expected); + } } function checkArrayLiteralAssignment(node, sourceType, contextualMapper) { // This elementType will be used if the specific property corresponding to this index is not @@ -23130,48 +26452,53 @@ var ts; var elementType = checkIteratedTypeOrElementType(sourceType, node, /*allowStringInput*/ false) || unknownType; var elements = node.elements; for (var i = 0; i < elements.length; i++) { - var e = elements[i]; - if (e.kind !== 187 /* OmittedExpression */) { - if (e.kind !== 185 /* SpreadElementExpression */) { - var propName = "" + i; - var type = isTypeAny(sourceType) - ? sourceType - : isTupleLikeType(sourceType) - ? getTypeOfPropertyOfType(sourceType, propName) - : elementType; - if (type) { - checkDestructuringAssignment(e, type, contextualMapper); - } - else { - if (isTupleType(sourceType)) { - error(e, ts.Diagnostics.Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2, typeToString(sourceType), sourceType.elementTypes.length, elements.length); - } - else { - error(e, ts.Diagnostics.Type_0_has_no_property_1, typeToString(sourceType), propName); - } - } + checkArrayLiteralDestructuringElementAssignment(node, sourceType, i, elementType, contextualMapper); + } + return sourceType; + } + function checkArrayLiteralDestructuringElementAssignment(node, sourceType, elementIndex, elementType, contextualMapper) { + var elements = node.elements; + var element = elements[elementIndex]; + if (element.kind !== 193 /* OmittedExpression */) { + if (element.kind !== 191 /* SpreadElementExpression */) { + var propName = "" + elementIndex; + var type = isTypeAny(sourceType) + ? sourceType + : isTupleLikeType(sourceType) + ? getTypeOfPropertyOfType(sourceType, propName) + : elementType; + if (type) { + return checkDestructuringAssignment(element, type, contextualMapper); } else { - if (i < elements.length - 1) { - error(e, ts.Diagnostics.A_rest_element_must_be_last_in_an_array_destructuring_pattern); + if (isTupleType(sourceType)) { + error(element, ts.Diagnostics.Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2, typeToString(sourceType), sourceType.elementTypes.length, elements.length); } else { - var restExpression = e.expression; - if (restExpression.kind === 181 /* BinaryExpression */ && restExpression.operatorToken.kind === 56 /* EqualsToken */) { - error(restExpression.operatorToken, ts.Diagnostics.A_rest_element_cannot_have_an_initializer); - } - else { - checkDestructuringAssignment(restExpression, createArrayType(elementType), contextualMapper); - } + error(element, ts.Diagnostics.Type_0_has_no_property_1, typeToString(sourceType), propName); + } + } + } + else { + if (elementIndex < elements.length - 1) { + error(element, ts.Diagnostics.A_rest_element_must_be_last_in_an_array_destructuring_pattern); + } + else { + var restExpression = element.expression; + if (restExpression.kind === 187 /* BinaryExpression */ && restExpression.operatorToken.kind === 56 /* EqualsToken */) { + error(restExpression.operatorToken, ts.Diagnostics.A_rest_element_cannot_have_an_initializer); + } + else { + return checkDestructuringAssignment(restExpression, createArrayType(elementType), contextualMapper); } } } } - return sourceType; + return undefined; } function checkDestructuringAssignment(exprOrAssignment, sourceType, contextualMapper) { var target; - if (exprOrAssignment.kind === 246 /* ShorthandPropertyAssignment */) { + if (exprOrAssignment.kind === 254 /* ShorthandPropertyAssignment */) { var prop = exprOrAssignment; if (prop.objectAssignmentInitializer) { checkBinaryLikeExpression(prop.name, prop.equalsToken, prop.objectAssignmentInitializer, contextualMapper); @@ -23181,31 +26508,34 @@ var ts; else { target = exprOrAssignment; } - if (target.kind === 181 /* BinaryExpression */ && target.operatorToken.kind === 56 /* EqualsToken */) { + if (target.kind === 187 /* BinaryExpression */ && target.operatorToken.kind === 56 /* EqualsToken */) { checkBinaryExpression(target, contextualMapper); target = target.left; } - if (target.kind === 165 /* ObjectLiteralExpression */) { + if (target.kind === 171 /* ObjectLiteralExpression */) { return checkObjectLiteralAssignment(target, sourceType, contextualMapper); } - if (target.kind === 164 /* ArrayLiteralExpression */) { + if (target.kind === 170 /* ArrayLiteralExpression */) { return checkArrayLiteralAssignment(target, sourceType, contextualMapper); } return checkReferenceAssignment(target, sourceType, contextualMapper); } function checkReferenceAssignment(target, sourceType, contextualMapper) { var targetType = checkExpression(target, contextualMapper); - if (checkReferenceExpression(target, ts.Diagnostics.Invalid_left_hand_side_of_assignment_expression, ts.Diagnostics.Left_hand_side_of_assignment_expression_cannot_be_a_constant)) { + if (checkReferenceExpression(target, ts.Diagnostics.Invalid_left_hand_side_of_assignment_expression, ts.Diagnostics.Left_hand_side_of_assignment_expression_cannot_be_a_constant_or_a_read_only_property)) { checkTypeAssignableTo(sourceType, targetType, target, /*headMessage*/ undefined); } return sourceType; } + function isTypeEqualityComparableTo(source, target) { + return (target.flags & 96 /* Nullable */) !== 0 || isTypeComparableTo(source, target); + } function checkBinaryExpression(node, contextualMapper) { return checkBinaryLikeExpression(node.left, node.operatorToken, node.right, contextualMapper, node); } function checkBinaryLikeExpression(left, operatorToken, right, contextualMapper, errorNode) { var operator = operatorToken.kind; - if (operator === 56 /* EqualsToken */ && (left.kind === 165 /* ObjectLiteralExpression */ || left.kind === 164 /* ArrayLiteralExpression */)) { + if (operator === 56 /* EqualsToken */ && (left.kind === 171 /* ObjectLiteralExpression */ || left.kind === 170 /* ArrayLiteralExpression */)) { return checkDestructuringAssignment(left, checkExpression(right, contextualMapper), contextualMapper); } var leftType = checkExpression(left, contextualMapper); @@ -23239,11 +26569,13 @@ var ts; // as having the primitive type Number. If one operand is the null or undefined value, // it is treated as having the type of the other operand. // The result is always of the Number primitive type. - if (leftType.flags & (32 /* Undefined */ | 64 /* Null */)) + if (leftType.flags & 96 /* Nullable */) leftType = rightType; - if (rightType.flags & (32 /* Undefined */ | 64 /* Null */)) + if (rightType.flags & 96 /* Nullable */) rightType = leftType; - var suggestedOperator; + leftType = getNonNullableType(leftType); + rightType = getNonNullableType(rightType); + var suggestedOperator = void 0; // if a user tries to apply a bitwise operator to 2 boolean operands // try and return them a helpful suggestion if ((leftType.flags & 8 /* Boolean */) && @@ -23266,18 +26598,20 @@ var ts; // The binary + operator requires both operands to be of the Number primitive type or an enum type, // or at least one of the operands to be of type Any or the String primitive type. // If one operand is the null or undefined value, it is treated as having the type of the other operand. - if (leftType.flags & (32 /* Undefined */ | 64 /* Null */)) + if (leftType.flags & 96 /* Nullable */) leftType = rightType; - if (rightType.flags & (32 /* Undefined */ | 64 /* Null */)) + if (rightType.flags & 96 /* Nullable */) rightType = leftType; - var resultType; - if (allConstituentTypesHaveKind(leftType, 132 /* NumberLike */) && allConstituentTypesHaveKind(rightType, 132 /* NumberLike */)) { + leftType = getNonNullableType(leftType); + rightType = getNonNullableType(rightType); + var resultType = void 0; + if (isTypeOfKind(leftType, 132 /* NumberLike */) && isTypeOfKind(rightType, 132 /* NumberLike */)) { // Operands of an enum type are treated as having the primitive type Number. // If both operands are of the Number primitive type, the result is of the Number primitive type. resultType = numberType; } else { - if (allConstituentTypesHaveKind(leftType, 258 /* StringLike */) || allConstituentTypesHaveKind(rightType, 258 /* StringLike */)) { + if (isTypeOfKind(leftType, 258 /* StringLike */) || isTypeOfKind(rightType, 258 /* StringLike */)) { // If one or both operands are of the String primitive type, the result is of the String primitive type. resultType = stringType; } @@ -23303,19 +26637,17 @@ var ts; case 27 /* GreaterThanToken */: case 28 /* LessThanEqualsToken */: case 29 /* GreaterThanEqualsToken */: - if (!checkForDisallowedESSymbolOperand(operator)) { - return booleanType; + if (checkForDisallowedESSymbolOperand(operator)) { + if (!isTypeComparableTo(leftType, rightType) && !isTypeComparableTo(rightType, leftType)) { + reportOperatorError(); + } } - // Fall through + return booleanType; case 30 /* EqualsEqualsToken */: case 31 /* ExclamationEqualsToken */: case 32 /* EqualsEqualsEqualsToken */: case 33 /* ExclamationEqualsEqualsToken */: - // Permit 'number[] | "foo"' to be asserted to 'string'. - if (someConstituentTypeHasKind(leftType, 258 /* StringLike */) && someConstituentTypeHasKind(rightType, 258 /* StringLike */)) { - return booleanType; - } - if (!isTypeAssignableTo(leftType, rightType) && !isTypeAssignableTo(rightType, leftType)) { + if (!isTypeEqualityComparableTo(leftType, rightType) && !isTypeEqualityComparableTo(rightType, leftType)) { reportOperatorError(); } return booleanType; @@ -23324,9 +26656,9 @@ var ts; case 90 /* InKeyword */: return checkInExpression(left, right, leftType, rightType); case 51 /* AmpersandAmpersandToken */: - return rightType; + return addNullableKind(rightType, getNullableKind(leftType)); case 52 /* BarBarToken */: - return getUnionType([leftType, rightType]); + return getUnionType([getNonNullableType(leftType), rightType]); case 56 /* EqualsToken */: checkAssignmentOperator(rightType); return getRegularTypeOfObjectLiteral(rightType); @@ -23335,8 +26667,8 @@ var ts; } // Return true if there was no error, false if there was an error. function checkForDisallowedESSymbolOperand(operator) { - var offendingSymbolOperand = someConstituentTypeHasKind(leftType, 16777216 /* ESSymbol */) ? left : - someConstituentTypeHasKind(rightType, 16777216 /* ESSymbol */) ? right : + var offendingSymbolOperand = maybeTypeOfKind(leftType, 16777216 /* ESSymbol */) ? left : + maybeTypeOfKind(rightType, 16777216 /* ESSymbol */) ? right : undefined; if (offendingSymbolOperand) { error(offendingSymbolOperand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(operator)); @@ -23367,7 +26699,7 @@ var ts; // requires VarExpr to be classified as a reference // A compound assignment furthermore requires VarExpr to be classified as a reference (section 4.1) // and the type of the non - compound operation to be assignable to the type of VarExpr. - var ok = checkReferenceExpression(left, ts.Diagnostics.Invalid_left_hand_side_of_assignment_expression, ts.Diagnostics.Left_hand_side_of_assignment_expression_cannot_be_a_constant); + var ok = checkReferenceExpression(left, ts.Diagnostics.Invalid_left_hand_side_of_assignment_expression, ts.Diagnostics.Left_hand_side_of_assignment_expression_cannot_be_a_constant_or_a_read_only_property); // Use default messages if (ok) { // to avoid cascading errors check assignability only if 'isReference' check succeeded and no errors were reported @@ -23397,7 +26729,7 @@ var ts; function checkYieldExpression(node) { // Grammar checking if (produceDiagnostics) { - if (!(node.parserContextFlags & 2 /* Yield */) || isYieldExpressionInClass(node)) { + if (!(node.flags & 8388608 /* YieldContext */) || isYieldExpressionInClass(node)) { grammarErrorOnFirstToken(node, ts.Diagnostics.A_yield_expression_is_only_allowed_in_a_generator_body); } if (isInParameterInitializerBeforeContainingFunction(node)) { @@ -23410,7 +26742,7 @@ var ts; // we are in a yield context. if (func && func.asteriskToken) { var expressionType = checkExpressionCached(node.expression, /*contextualMapper*/ undefined); - var expressionElementType; + var expressionElementType = void 0; var nodeIsYieldStar = !!node.asteriskToken; if (nodeIsYieldStar) { expressionElementType = checkElementTypeOfIterable(expressionType, node.expression); @@ -23441,7 +26773,7 @@ var ts; function checkStringLiteralExpression(node) { var contextualType = getContextualType(node); if (contextualType && contextualTypeIsStringLiteralType(contextualType)) { - return getStringLiteralType(node); + return getStringLiteralTypeForText(node.text); } return stringType; } @@ -23466,7 +26798,13 @@ var ts; function checkExpressionCached(node, contextualMapper) { var links = getNodeLinks(node); if (!links.resolvedType) { + // When computing a type that we're going to cache, we need to ignore any ongoing control flow + // analysis because variables may have transient types in indeterminable states. Moving flowLoopStart + // to the top of the stack ensures all transient types are computed from a known point. + var saveFlowLoopStart = flowLoopStart; + flowLoopStart = flowLoopCount; links.resolvedType = checkExpression(node, contextualMapper); + flowLoopStart = saveFlowLoopStart; } return links.resolvedType; } @@ -23474,7 +26812,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 136 /* ComputedPropertyName */) { + if (node.name.kind === 140 /* ComputedPropertyName */) { checkComputedPropertyName(node.name); } return checkExpression(node.initializer, contextualMapper); @@ -23485,7 +26823,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 136 /* ComputedPropertyName */) { + if (node.name.kind === 140 /* ComputedPropertyName */) { checkComputedPropertyName(node.name); } var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); @@ -23508,14 +26846,14 @@ var ts; } // Checks an expression and returns its type. The contextualMapper parameter serves two purposes: When // contextualMapper is not undefined and not equal to the identityMapper function object it indicates that the - // expression is being inferentially typed (section 4.12.2 in spec) and provides the type mapper to use in + // expression is being inferentially typed (section 4.15.2 in spec) and provides the type mapper to use in // conjunction with the generic contextual type. When contextualMapper is equal to the identityMapper function // object, it serves as an indicator that all contained function and arrow expressions should be considered to // have the wildcard function type; this form of type check is used during overload resolution to exclude // contextually typed function and arrow expressions in the initial phase. function checkExpression(node, contextualMapper) { var type; - if (node.kind === 135 /* QualifiedName */) { + if (node.kind === 139 /* QualifiedName */) { type = checkQualifiedName(node); } else { @@ -23527,9 +26865,9 @@ var ts; // - 'left' in property access // - 'object' in indexed access // - target in rhs of import statement - var ok = (node.parent.kind === 166 /* PropertyAccessExpression */ && node.parent.expression === node) || - (node.parent.kind === 167 /* ElementAccessExpression */ && node.parent.expression === node) || - ((node.kind === 69 /* Identifier */ || node.kind === 135 /* QualifiedName */) && isInRightSideOfImportOrExportAssignment(node)); + var ok = (node.parent.kind === 172 /* PropertyAccessExpression */ && node.parent.expression === node) || + (node.parent.kind === 173 /* ElementAccessExpression */ && node.parent.expression === node) || + ((node.kind === 69 /* Identifier */ || node.kind === 139 /* QualifiedName */) && isInRightSideOfImportOrExportAssignment(node)); if (!ok) { error(node, ts.Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment); } @@ -23556,7 +26894,7 @@ var ts; return booleanType; case 8 /* NumericLiteral */: return checkNumericLiteral(node); - case 183 /* TemplateExpression */: + case 189 /* TemplateExpression */: return checkTemplateExpression(node); case 9 /* StringLiteral */: return checkStringLiteralExpression(node); @@ -23564,58 +26902,60 @@ var ts; return stringType; case 10 /* RegularExpressionLiteral */: return globalRegExpType; - case 164 /* ArrayLiteralExpression */: + case 170 /* ArrayLiteralExpression */: return checkArrayLiteral(node, contextualMapper); - case 165 /* ObjectLiteralExpression */: + case 171 /* ObjectLiteralExpression */: return checkObjectLiteral(node, contextualMapper); - case 166 /* PropertyAccessExpression */: + case 172 /* PropertyAccessExpression */: return checkPropertyAccessExpression(node); - case 167 /* ElementAccessExpression */: + case 173 /* ElementAccessExpression */: return checkIndexedAccess(node); - case 168 /* CallExpression */: - case 169 /* NewExpression */: + case 174 /* CallExpression */: + case 175 /* NewExpression */: return checkCallExpression(node); - case 170 /* TaggedTemplateExpression */: + case 176 /* TaggedTemplateExpression */: return checkTaggedTemplateExpression(node); - case 172 /* ParenthesizedExpression */: + case 178 /* ParenthesizedExpression */: return checkExpression(node.expression, contextualMapper); - case 186 /* ClassExpression */: + case 192 /* ClassExpression */: return checkClassExpression(node); - case 173 /* FunctionExpression */: - case 174 /* ArrowFunction */: + case 179 /* FunctionExpression */: + case 180 /* ArrowFunction */: return checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); - case 176 /* TypeOfExpression */: + case 182 /* TypeOfExpression */: return checkTypeOfExpression(node); - case 171 /* TypeAssertionExpression */: - case 189 /* AsExpression */: + case 177 /* TypeAssertionExpression */: + case 195 /* AsExpression */: return checkAssertion(node); - case 175 /* DeleteExpression */: + case 196 /* NonNullExpression */: + return checkNonNullAssertion(node); + case 181 /* DeleteExpression */: return checkDeleteExpression(node); - case 177 /* VoidExpression */: + case 183 /* VoidExpression */: return checkVoidExpression(node); - case 178 /* AwaitExpression */: + case 184 /* AwaitExpression */: return checkAwaitExpression(node); - case 179 /* PrefixUnaryExpression */: + case 185 /* PrefixUnaryExpression */: return checkPrefixUnaryExpression(node); - case 180 /* PostfixUnaryExpression */: + case 186 /* PostfixUnaryExpression */: return checkPostfixUnaryExpression(node); - case 181 /* BinaryExpression */: + case 187 /* BinaryExpression */: return checkBinaryExpression(node, contextualMapper); - case 182 /* ConditionalExpression */: + case 188 /* ConditionalExpression */: return checkConditionalExpression(node, contextualMapper); - case 185 /* SpreadElementExpression */: + case 191 /* SpreadElementExpression */: return checkSpreadElementExpression(node, contextualMapper); - case 187 /* OmittedExpression */: + case 193 /* OmittedExpression */: return undefinedType; - case 184 /* YieldExpression */: + case 190 /* YieldExpression */: return checkYieldExpression(node); - case 240 /* JsxExpression */: + case 248 /* JsxExpression */: return checkJsxExpression(node); - case 233 /* JsxElement */: + case 241 /* JsxElement */: return checkJsxElement(node); - case 234 /* JsxSelfClosingElement */: + case 242 /* JsxSelfClosingElement */: return checkJsxSelfClosingElement(node); - case 235 /* JsxOpeningElement */: + case 243 /* JsxOpeningElement */: ts.Debug.fail("Shouldn't ever directly check a JsxOpeningElement"); } return unknownType; @@ -23627,11 +26967,10 @@ var ts; grammarErrorOnFirstToken(node.expression, ts.Diagnostics.Type_expected); } checkSourceElement(node.constraint); + getConstraintOfTypeParameter(getDeclaredTypeOfTypeParameter(getSymbolOfNode(node))); if (produceDiagnostics) { - checkTypeParameterHasIllegalReferencesInConstraint(node); checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_parameter_name_cannot_be_0); } - // TODO: Check multiple declarations are identical } function checkParameter(node) { // Grammar checking @@ -23642,15 +26981,23 @@ var ts; checkGrammarDecorators(node) || checkGrammarModifiers(node); checkVariableLikeDeclaration(node); var func = ts.getContainingFunction(node); - if (node.flags & 56 /* AccessibilityModifier */) { + if (node.flags & 92 /* ParameterPropertyModifier */) { func = ts.getContainingFunction(node); - if (!(func.kind === 144 /* Constructor */ && ts.nodeIsPresent(func.body))) { + if (!(func.kind === 148 /* Constructor */ && ts.nodeIsPresent(func.body))) { error(node, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); } } if (node.questionToken && ts.isBindingPattern(node.name) && func.body) { error(node, ts.Diagnostics.A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature); } + if (node.name.text === "this") { + if (ts.indexOf(func.parameters, node) !== 0) { + error(node, ts.Diagnostics.A_this_parameter_must_be_the_first_parameter); + } + if (func.kind === 148 /* Constructor */ || func.kind === 152 /* ConstructSignature */ || func.kind === 157 /* ConstructorType */) { + error(node, ts.Diagnostics.A_constructor_cannot_have_a_this_parameter); + } + } // Only check rest parameter type if it's not a binding pattern. Since binding patterns are // not allowed in a rest parameter, we already have an error from checkGrammarParameterList. if (node.dotDotDotToken && !ts.isBindingPattern(node.name) && !isArrayType(getTypeOfSymbol(node.symbol))) { @@ -23661,9 +27008,9 @@ var ts; if (!node.asteriskToken || !node.body) { return false; } - return node.kind === 143 /* MethodDeclaration */ || - node.kind === 213 /* FunctionDeclaration */ || - node.kind === 173 /* FunctionExpression */; + return node.kind === 147 /* MethodDeclaration */ || + node.kind === 220 /* FunctionDeclaration */ || + node.kind === 179 /* FunctionExpression */; } function getTypePredicateParameterIndex(parameterList, parameter) { if (parameterList) { @@ -23677,91 +27024,102 @@ var ts; } return -1; } - function isInLegalTypePredicatePosition(node) { - switch (node.parent.kind) { - case 174 /* ArrowFunction */: - case 147 /* CallSignature */: - case 213 /* FunctionDeclaration */: - case 173 /* FunctionExpression */: - case 152 /* FunctionType */: - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - return node === node.parent.type; + function checkTypePredicate(node) { + var parent = getTypePredicateParent(node); + if (!parent) { + // The parent must not be valid. + error(node, ts.Diagnostics.A_type_predicate_is_only_allowed_in_return_type_position_for_functions_and_methods); + return; + } + var typePredicate = getSignatureFromDeclaration(parent).typePredicate; + if (!typePredicate) { + return; + } + var parameterName = node.parameterName; + if (ts.isThisTypePredicate(typePredicate)) { + getTypeFromThisTypeNode(parameterName); + } + else { + if (typePredicate.parameterIndex >= 0) { + if (parent.parameters[typePredicate.parameterIndex].dotDotDotToken) { + error(parameterName, ts.Diagnostics.A_type_predicate_cannot_reference_a_rest_parameter); + } + else { + var leadingError = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.A_type_predicate_s_type_must_be_assignable_to_its_parameter_s_type); + checkTypeAssignableTo(typePredicate.type, getTypeOfNode(parent.parameters[typePredicate.parameterIndex]), node.type, + /*headMessage*/ undefined, leadingError); + } + } + else if (parameterName) { + var hasReportedError = false; + for (var _i = 0, _a = parent.parameters; _i < _a.length; _i++) { + var name_14 = _a[_i].name; + if (ts.isBindingPattern(name_14) && + checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_14, parameterName, typePredicate.parameterName)) { + hasReportedError = true; + break; + } + } + if (!hasReportedError) { + error(node.parameterName, ts.Diagnostics.Cannot_find_parameter_0, typePredicate.parameterName); + } + } + } + } + function getTypePredicateParent(node) { + switch (node.parent.kind) { + case 180 /* ArrowFunction */: + case 151 /* CallSignature */: + case 220 /* FunctionDeclaration */: + case 179 /* FunctionExpression */: + case 156 /* FunctionType */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: + var parent_10 = node.parent; + if (node === parent_10.type) { + return parent_10; + } + } + } + function checkIfTypePredicateVariableIsDeclaredInBindingPattern(pattern, predicateVariableNode, predicateVariableName) { + for (var _i = 0, _a = pattern.elements; _i < _a.length; _i++) { + var name_15 = _a[_i].name; + if (name_15.kind === 69 /* Identifier */ && + name_15.text === predicateVariableName) { + error(predicateVariableNode, ts.Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, predicateVariableName); + return true; + } + else if (name_15.kind === 168 /* ArrayBindingPattern */ || + name_15.kind === 167 /* ObjectBindingPattern */) { + if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_15, predicateVariableNode, predicateVariableName)) { + return true; + } + } } - return false; } function checkSignatureDeclaration(node) { // Grammar checking - if (node.kind === 149 /* IndexSignature */) { + if (node.kind === 153 /* IndexSignature */) { checkGrammarIndexSignature(node); } - else if (node.kind === 152 /* FunctionType */ || node.kind === 213 /* FunctionDeclaration */ || node.kind === 153 /* ConstructorType */ || - node.kind === 147 /* CallSignature */ || node.kind === 144 /* Constructor */ || - node.kind === 148 /* ConstructSignature */) { + else if (node.kind === 156 /* FunctionType */ || node.kind === 220 /* FunctionDeclaration */ || node.kind === 157 /* ConstructorType */ || + node.kind === 151 /* CallSignature */ || node.kind === 148 /* Constructor */ || + node.kind === 152 /* ConstructSignature */) { checkGrammarFunctionLikeDeclaration(node); } checkTypeParameters(node.typeParameters); ts.forEach(node.parameters, checkParameter); if (node.type) { - if (node.type.kind === 150 /* TypePredicate */) { - var typePredicate = getSignatureFromDeclaration(node).typePredicate; - var typePredicateNode = node.type; - if (isInLegalTypePredicatePosition(typePredicateNode)) { - if (typePredicate.parameterIndex >= 0) { - if (node.parameters[typePredicate.parameterIndex].dotDotDotToken) { - error(typePredicateNode.parameterName, ts.Diagnostics.A_type_predicate_cannot_reference_a_rest_parameter); - } - else { - checkTypeAssignableTo(typePredicate.type, getTypeOfNode(node.parameters[typePredicate.parameterIndex]), typePredicateNode.type); - } - } - else if (typePredicateNode.parameterName) { - var hasReportedError = false; - for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) { - var param = _a[_i]; - if (hasReportedError) { - break; - } - if (param.name.kind === 161 /* ObjectBindingPattern */ || - param.name.kind === 162 /* ArrayBindingPattern */) { - (function checkBindingPattern(pattern) { - for (var _i = 0, _a = pattern.elements; _i < _a.length; _i++) { - var element = _a[_i]; - if (element.name.kind === 69 /* Identifier */ && - element.name.text === typePredicate.parameterName) { - error(typePredicateNode.parameterName, ts.Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, typePredicate.parameterName); - hasReportedError = true; - break; - } - else if (element.name.kind === 162 /* ArrayBindingPattern */ || - element.name.kind === 161 /* ObjectBindingPattern */) { - checkBindingPattern(element.name); - } - } - })(param.name); - } - } - if (!hasReportedError) { - error(typePredicateNode.parameterName, ts.Diagnostics.Cannot_find_parameter_0, typePredicate.parameterName); - } - } - } - else { - error(typePredicateNode, ts.Diagnostics.A_type_predicate_is_only_allowed_in_return_type_position_for_functions_and_methods); - } - } - else { - checkSourceElement(node.type); - } + checkSourceElement(node.type); } if (produceDiagnostics) { checkCollisionWithArgumentsInGeneratedCode(node); if (compilerOptions.noImplicitAny && !node.type) { switch (node.kind) { - case 148 /* ConstructSignature */: + case 152 /* ConstructSignature */: error(node, ts.Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; - case 147 /* CallSignature */: + case 151 /* CallSignature */: error(node, ts.Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; } @@ -23784,12 +27142,14 @@ var ts; checkTypeAssignableTo(iterableIteratorInstantiation, returnType, node.type); } } + else if (ts.isAsyncFunctionLike(node)) { + checkAsyncFunctionReturnType(node); + } } } - checkSpecializedSignatureDeclaration(node); } function checkTypeForDuplicateIndexSignatures(node) { - if (node.kind === 215 /* InterfaceDeclaration */) { + if (node.kind === 222 /* InterfaceDeclaration */) { var nodeSymbol = getSymbolOfNode(node); // in case of merging interface declaration it is possible that we'll enter this check procedure several times for every declaration // to prevent this run check only for the first declaration of a given kind @@ -23809,7 +27169,7 @@ var ts; var declaration = decl; if (declaration.parameters.length === 1 && declaration.parameters[0].type) { switch (declaration.parameters[0].type.kind) { - case 130 /* StringKeyword */: + case 132 /* StringKeyword */: if (!seenStringIndexer) { seenStringIndexer = true; } @@ -23817,7 +27177,7 @@ var ts; error(declaration, ts.Diagnostics.Duplicate_string_index_signature); } break; - case 128 /* NumberKeyword */: + case 130 /* NumberKeyword */: if (!seenNumericIndexer) { seenNumericIndexer = true; } @@ -23839,7 +27199,7 @@ var ts; // Grammar checking checkGrammarMethod(node) || checkGrammarComputedPropertyName(node.name); // Grammar checking for modifiers is done inside the function checkGrammarFunctionLikeDeclaration - checkFunctionLikeDeclaration(node); + checkFunctionOrMethodDeclaration(node); // Abstract methods cannot have an implementation. // Extra checks are to avoid reporting multiple errors relating to the "abstractness" of the node. if (node.flags & 128 /* Abstract */ && node.body) { @@ -23849,7 +27209,7 @@ var ts; function checkConstructorDeclaration(node) { // Grammar check on signature of constructor and modifier of the constructor is done in checkSignatureDeclaration function. checkSignatureDeclaration(node); - // Grammar check for checking only related to constructoDeclaration + // Grammar check for checking only related to constructorDeclaration checkGrammarConstructorTypeParameters(node) || checkGrammarConstructorTypeAnnotation(node); checkSourceElement(node.body); var symbol = getSymbolOfNode(node); @@ -23865,14 +27225,11 @@ var ts; if (!produceDiagnostics) { return; } - function isSuperCallExpression(n) { - return n.kind === 168 /* CallExpression */ && n.expression.kind === 95 /* SuperKeyword */; - } function containsSuperCallAsComputedPropertyName(n) { return n.name && containsSuperCall(n.name); } function containsSuperCall(n) { - if (isSuperCallExpression(n)) { + if (ts.isSuperCallExpression(n)) { return true; } else if (ts.isFunctionLike(n)) { @@ -23887,13 +27244,13 @@ var ts; if (n.kind === 97 /* ThisKeyword */) { error(n, ts.Diagnostics.this_cannot_be_referenced_in_current_location); } - else if (n.kind !== 173 /* FunctionExpression */ && n.kind !== 213 /* FunctionDeclaration */) { + else if (n.kind !== 179 /* FunctionExpression */ && n.kind !== 220 /* FunctionDeclaration */) { ts.forEachChild(n, markThisReferencesAsErrors); } } function isInstancePropertyWithInitializer(n) { - return n.kind === 141 /* PropertyDeclaration */ && - !(n.flags & 64 /* Static */) && + return n.kind === 145 /* PropertyDeclaration */ && + !(n.flags & 32 /* Static */) && !!n.initializer; } // TS 1.0 spec (April 2014): 8.3.2 @@ -23901,12 +27258,11 @@ var ts; // constructors of derived classes must contain at least one super call somewhere in their function body. var containingClassDecl = node.parent; if (ts.getClassExtendsHeritageClauseElement(containingClassDecl)) { - var containingClassSymbol = getSymbolOfNode(containingClassDecl); - var containingClassInstanceType = getDeclaredTypeOfSymbol(containingClassSymbol); - var baseConstructorType = getBaseConstructorTypeOfClass(containingClassInstanceType); - if (containsSuperCall(node.body)) { - if (baseConstructorType === nullType) { - error(node, ts.Diagnostics.A_constructor_cannot_contain_a_super_call_when_its_class_extends_null); + var classExtendsNull = classDeclarationExtendsNull(containingClassDecl); + var superCall = getSuperCallInConstructor(node); + if (superCall) { + if (classExtendsNull) { + error(superCall, ts.Diagnostics.A_constructor_cannot_contain_a_super_call_when_its_class_extends_null); } // The first statement in the body of a constructor (excluding prologue directives) must be a super call // if both of the following are true: @@ -23914,15 +27270,15 @@ var ts; // - The constructor declares parameter properties // or the containing class declares instance member variables with initializers. var superCallShouldBeFirst = ts.forEach(node.parent.members, isInstancePropertyWithInitializer) || - ts.forEach(node.parameters, function (p) { return p.flags & (8 /* Public */ | 16 /* Private */ | 32 /* Protected */); }); + ts.forEach(node.parameters, function (p) { return p.flags & 92 /* ParameterPropertyModifier */; }); // Skip past any prologue directives to find the first statement // to ensure that it was a super call. if (superCallShouldBeFirst) { var statements = node.body.statements; - var superCallStatement; + var superCallStatement = void 0; for (var _i = 0, statements_2 = statements; _i < statements_2.length; _i++) { var statement = statements_2[_i]; - if (statement.kind === 195 /* ExpressionStatement */ && isSuperCallExpression(statement.expression)) { + if (statement.kind === 202 /* ExpressionStatement */ && ts.isSuperCallExpression(statement.expression)) { superCallStatement = statement; break; } @@ -23933,13 +27289,9 @@ var ts; if (!superCallStatement) { error(node, ts.Diagnostics.A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties); } - else { - // In such a required super call, it is a compile-time error for argument expressions to reference this. - markThisReferencesAsErrors(superCallStatement.expression); - } } } - else if (baseConstructorType !== nullType) { + else if (!classExtendsNull) { error(node, ts.Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call); } } @@ -23948,9 +27300,11 @@ var ts; if (produceDiagnostics) { // Grammar checking accessors checkGrammarFunctionLikeDeclaration(node) || checkGrammarAccessor(node) || checkGrammarComputedPropertyName(node.name); - if (node.kind === 145 /* GetAccessor */) { - if (!ts.isInAmbientContext(node) && ts.nodeIsPresent(node.body) && (node.flags & 524288 /* HasImplicitReturn */)) { - if (node.flags & 1048576 /* HasExplicitReturn */) { + checkDecorators(node); + checkSignatureDeclaration(node); + if (node.kind === 149 /* GetAccessor */) { + if (!ts.isInAmbientContext(node) && ts.nodeIsPresent(node.body) && (node.flags & 32768 /* HasImplicitReturn */)) { + if (node.flags & 65536 /* HasExplicitReturn */) { if (compilerOptions.noImplicitReturns) { error(node.name, ts.Diagnostics.Not_all_code_paths_return_a_value); } @@ -23960,40 +27314,65 @@ var ts; } } } + // Do not use hasDynamicName here, because that returns false for well known symbols. + // We want to perform checkComputedPropertyName for all computed properties, including + // well known symbols. + if (node.name.kind === 140 /* ComputedPropertyName */) { + checkComputedPropertyName(node.name); + } if (!ts.hasDynamicName(node)) { // TypeScript 1.0 spec (April 2014): 8.4.3 // Accessors for the same member name must specify the same accessibility. - var otherKind = node.kind === 145 /* GetAccessor */ ? 146 /* SetAccessor */ : 145 /* GetAccessor */; + var otherKind = node.kind === 149 /* GetAccessor */ ? 150 /* SetAccessor */ : 149 /* GetAccessor */; var otherAccessor = ts.getDeclarationOfKind(node.symbol, otherKind); if (otherAccessor) { - if (((node.flags & 56 /* AccessibilityModifier */) !== (otherAccessor.flags & 56 /* AccessibilityModifier */))) { + if (((node.flags & 28 /* AccessibilityModifier */) !== (otherAccessor.flags & 28 /* AccessibilityModifier */))) { error(node.name, ts.Diagnostics.Getter_and_setter_accessors_do_not_agree_in_visibility); } - var currentAccessorType = getAnnotatedAccessorType(node); - var otherAccessorType = getAnnotatedAccessorType(otherAccessor); + if (((node.flags & 128 /* Abstract */) !== (otherAccessor.flags & 128 /* Abstract */))) { + error(node.name, ts.Diagnostics.Accessors_must_both_be_abstract_or_non_abstract); + } // TypeScript 1.0 spec (April 2014): 4.5 // If both accessors include type annotations, the specified types must be identical. - if (currentAccessorType && otherAccessorType) { - if (!isTypeIdenticalTo(currentAccessorType, otherAccessorType)) { - error(node, ts.Diagnostics.get_and_set_accessor_must_have_the_same_type); - } - } + checkAccessorDeclarationTypesIdentical(node, otherAccessor, getAnnotatedAccessorType, ts.Diagnostics.get_and_set_accessor_must_have_the_same_type); + checkAccessorDeclarationTypesIdentical(node, otherAccessor, getAnnotatedAccessorThisType, ts.Diagnostics.get_and_set_accessor_must_have_the_same_this_type); } } getTypeOfAccessors(getSymbolOfNode(node)); } - checkFunctionLikeDeclaration(node); + if (node.parent.kind !== 171 /* ObjectLiteralExpression */) { + checkSourceElement(node.body); + } + else { + checkNodeDeferred(node); + } + } + function checkAccessorDeclarationTypesIdentical(first, second, getAnnotatedType, message) { + var firstType = getAnnotatedType(first); + var secondType = getAnnotatedType(second); + if (firstType && secondType && !isTypeIdenticalTo(firstType, secondType)) { + error(first, message); + } + } + function checkAccessorDeferred(node) { + checkSourceElement(node.body); } function checkMissingDeclaration(node) { checkDecorators(node); } - function checkTypeArgumentConstraints(typeParameters, typeArguments) { + function checkTypeArgumentConstraints(typeParameters, typeArgumentNodes) { + var typeArguments; + var mapper; var result = true; for (var i = 0; i < typeParameters.length; i++) { var constraint = getConstraintOfTypeParameter(typeParameters[i]); if (constraint) { + if (!typeArguments) { + typeArguments = ts.map(typeArgumentNodes, getTypeFromTypeNode); + mapper = createTypeMapper(typeParameters, typeArguments); + } var typeArgument = typeArguments[i]; - result = result && checkTypeAssignableTo(getTypeFromTypeNode(typeArgument), constraint, typeArgument, ts.Diagnostics.Type_0_does_not_satisfy_the_constraint_1); + result = result && checkTypeAssignableTo(typeArgument, getTypeWithThisArgument(instantiateType(constraint, mapper), typeArgument), typeArgumentNodes[i], ts.Diagnostics.Type_0_does_not_satisfy_the_constraint_1); } } return result; @@ -24037,59 +27416,21 @@ var ts; ts.forEach(node.types, checkSourceElement); } function isPrivateWithinAmbient(node) { - return (node.flags & 16 /* Private */) && ts.isInAmbientContext(node); - } - function checkSpecializedSignatureDeclaration(signatureDeclarationNode) { - if (!produceDiagnostics) { - return; - } - var signature = getSignatureFromDeclaration(signatureDeclarationNode); - if (!signature.hasStringLiterals) { - return; - } - // TypeScript 1.0 spec (April 2014): 3.7.2.2 - // Specialized signatures are not permitted in conjunction with a function body - if (ts.nodeIsPresent(signatureDeclarationNode.body)) { - error(signatureDeclarationNode, ts.Diagnostics.A_signature_with_an_implementation_cannot_use_a_string_literal_type); - return; - } - // TypeScript 1.0 spec (April 2014): 3.7.2.4 - // Every specialized call or construct signature in an object type must be assignable - // to at least one non-specialized call or construct signature in the same object type - var signaturesToCheck; - // Unnamed (call\construct) signatures in interfaces are inherited and not shadowed so examining just node symbol won't give complete answer. - // Use declaring type to obtain full list of signatures. - if (!signatureDeclarationNode.name && signatureDeclarationNode.parent && signatureDeclarationNode.parent.kind === 215 /* InterfaceDeclaration */) { - ts.Debug.assert(signatureDeclarationNode.kind === 147 /* CallSignature */ || signatureDeclarationNode.kind === 148 /* ConstructSignature */); - var signatureKind = signatureDeclarationNode.kind === 147 /* CallSignature */ ? 0 /* Call */ : 1 /* Construct */; - var containingSymbol = getSymbolOfNode(signatureDeclarationNode.parent); - var containingType = getDeclaredTypeOfSymbol(containingSymbol); - signaturesToCheck = getSignaturesOfType(containingType, signatureKind); - } - else { - signaturesToCheck = getSignaturesOfSymbol(getSymbolOfNode(signatureDeclarationNode)); - } - for (var _i = 0, signaturesToCheck_1 = signaturesToCheck; _i < signaturesToCheck_1.length; _i++) { - var otherSignature = signaturesToCheck_1[_i]; - if (!otherSignature.hasStringLiterals && isSignatureAssignableTo(signature, otherSignature)) { - return; - } - } - error(signatureDeclarationNode, ts.Diagnostics.Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature); + return (node.flags & 8 /* Private */) && ts.isInAmbientContext(node); } function getEffectiveDeclarationFlags(n, flagsToCheck) { var flags = ts.getCombinedNodeFlags(n); // children of classes (even ambient classes) should not be marked as ambient or export // because those flags have no useful semantics there. - if (n.parent.kind !== 215 /* InterfaceDeclaration */ && - n.parent.kind !== 214 /* ClassDeclaration */ && - n.parent.kind !== 186 /* ClassExpression */ && + if (n.parent.kind !== 222 /* InterfaceDeclaration */ && + n.parent.kind !== 221 /* ClassDeclaration */ && + n.parent.kind !== 192 /* ClassExpression */ && ts.isInAmbientContext(n)) { - if (!(flags & 4 /* Ambient */)) { + if (!(flags & 2 /* Ambient */)) { // It is nested in an ambient context, which means it is automatically exported - flags |= 2 /* Export */; + flags |= 1 /* Export */; } - flags |= 4 /* Ambient */; + flags |= 2 /* Ambient */; } return flags & flagsToCheck; } @@ -24111,36 +27452,36 @@ var ts; // deviations, we XOR someOverloadFlags with allOverloadFlags var someButNotAllOverloadFlags = someOverloadFlags ^ allOverloadFlags; if (someButNotAllOverloadFlags !== 0) { - var canonicalFlags = getEffectiveDeclarationFlags(getCanonicalOverload(overloads, implementation), flagsToCheck); + var canonicalFlags_1 = getEffectiveDeclarationFlags(getCanonicalOverload(overloads, implementation), flagsToCheck); ts.forEach(overloads, function (o) { - var deviation = getEffectiveDeclarationFlags(o, flagsToCheck) ^ canonicalFlags; - if (deviation & 2 /* Export */) { - error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_exported_or_not_exported); + var deviation = getEffectiveDeclarationFlags(o, flagsToCheck) ^ canonicalFlags_1; + if (deviation & 1 /* Export */) { + error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_exported_or_non_exported); } - else if (deviation & 4 /* Ambient */) { + else if (deviation & 2 /* Ambient */) { error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_ambient_or_non_ambient); } - else if (deviation & (16 /* Private */ | 32 /* Protected */)) { - error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_public_private_or_protected); + else if (deviation & (8 /* Private */ | 16 /* Protected */)) { + error(o.name || o, ts.Diagnostics.Overload_signatures_must_all_be_public_private_or_protected); } else if (deviation & 128 /* Abstract */) { - error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_abstract_or_not_abstract); + error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_abstract_or_non_abstract); } }); } } function checkQuestionTokenAgreementBetweenOverloads(overloads, implementation, someHaveQuestionToken, allHaveQuestionToken) { if (someHaveQuestionToken !== allHaveQuestionToken) { - var canonicalHasQuestionToken = ts.hasQuestionToken(getCanonicalOverload(overloads, implementation)); + var canonicalHasQuestionToken_1 = ts.hasQuestionToken(getCanonicalOverload(overloads, implementation)); ts.forEach(overloads, function (o) { - var deviation = ts.hasQuestionToken(o) !== canonicalHasQuestionToken; + var deviation = ts.hasQuestionToken(o) !== canonicalHasQuestionToken_1; if (deviation) { error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_optional_or_required); } }); } } - var flagsToCheck = 2 /* Export */ | 4 /* Ambient */ | 16 /* Private */ | 32 /* Protected */ | 128 /* Abstract */; + var flagsToCheck = 1 /* Export */ | 2 /* Ambient */ | 8 /* Private */ | 16 /* Protected */ | 128 /* Abstract */; var someNodeFlags = 0; var allNodeFlags = flagsToCheck; var someHaveQuestionToken = false; @@ -24164,16 +27505,23 @@ var ts; seen = c === node; } }); - if (subsequentNode) { + // We may be here because of some extra nodes between overloads that could not be parsed into a valid node. + // In this case the subsequent node is not really consecutive (.pos !== node.end), and we must ignore it here. + if (subsequentNode && subsequentNode.pos === node.end) { if (subsequentNode.kind === node.kind) { var errorNode_1 = subsequentNode.name || subsequentNode; // TODO(jfreeman): These are methods, so handle computed name case if (node.name && subsequentNode.name && node.name.text === subsequentNode.name.text) { - // the only situation when this is possible (same kind\same name but different symbol) - mixed static and instance class members - ts.Debug.assert(node.kind === 143 /* MethodDeclaration */ || node.kind === 142 /* MethodSignature */); - ts.Debug.assert((node.flags & 64 /* Static */) !== (subsequentNode.flags & 64 /* Static */)); - var diagnostic = node.flags & 64 /* Static */ ? ts.Diagnostics.Function_overload_must_be_static : ts.Diagnostics.Function_overload_must_not_be_static; - error(errorNode_1, diagnostic); + var reportError = (node.kind === 147 /* MethodDeclaration */ || node.kind === 146 /* MethodSignature */) && + (node.flags & 32 /* Static */) !== (subsequentNode.flags & 32 /* Static */); + // we can get here in two cases + // 1. mixed static and instance class members + // 2. something with the same name was defined before the set of overloads that prevents them from merging + // here we'll report error only for the first case since for second we should already report error in binder + if (reportError) { + var diagnostic = node.flags & 32 /* Static */ ? ts.Diagnostics.Function_overload_must_be_static : ts.Diagnostics.Function_overload_must_not_be_static; + error(errorNode_1, diagnostic); + } return; } else if (ts.nodeIsPresent(subsequentNode.body)) { @@ -24206,7 +27554,7 @@ var ts; var current = declarations_4[_i]; var node = current; var inAmbientContext = ts.isInAmbientContext(node); - var inAmbientContextOrInterface = node.parent.kind === 215 /* InterfaceDeclaration */ || node.parent.kind === 155 /* TypeLiteral */ || inAmbientContext; + var inAmbientContextOrInterface = node.parent.kind === 222 /* InterfaceDeclaration */ || node.parent.kind === 159 /* TypeLiteral */ || inAmbientContext; if (inAmbientContextOrInterface) { // check if declarations are consecutive only if they are non-ambient // 1. ambient declarations can be interleaved @@ -24217,7 +27565,7 @@ var ts; // 2. mixing ambient and non-ambient declarations is a separate error that will be reported - do not want to report an extra one previousDeclaration = undefined; } - if (node.kind === 213 /* FunctionDeclaration */ || node.kind === 143 /* MethodDeclaration */ || node.kind === 142 /* MethodSignature */ || node.kind === 144 /* Constructor */) { + if (node.kind === 220 /* FunctionDeclaration */ || node.kind === 147 /* MethodDeclaration */ || node.kind === 146 /* MethodSignature */ || node.kind === 148 /* Constructor */) { var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; allNodeFlags &= currentNodeFlags; @@ -24260,7 +27608,7 @@ var ts; } // Abstract methods can't have an implementation -- in particular, they don't need one. if (!isExportSymbolInsideModule && lastSeenNonAmbientDeclaration && !lastSeenNonAmbientDeclaration.body && - !(lastSeenNonAmbientDeclaration.flags & 128 /* Abstract */)) { + !(lastSeenNonAmbientDeclaration.flags & 128 /* Abstract */) && !lastSeenNonAmbientDeclaration.questionToken) { reportImplementationExpectedError(lastSeenNonAmbientDeclaration); } if (hasOverloads) { @@ -24269,29 +27617,11 @@ var ts; if (bodyDeclaration) { var signatures = getSignaturesOfSymbol(symbol); var bodySignature = getSignatureFromDeclaration(bodyDeclaration); - // If the implementation signature has string literals, we will have reported an error in - // checkSpecializedSignatureDeclaration - if (!bodySignature.hasStringLiterals) { - // TypeScript 1.0 spec (April 2014): 6.1 - // If a function declaration includes overloads, the overloads determine the call - // signatures of the type given to the function object - // and the function implementation signature must be assignable to that type - // - // TypeScript 1.0 spec (April 2014): 3.8.4 - // Note that specialized call and construct signatures (section 3.7.2.4) are not significant when determining assignment compatibility - // Consider checking against specialized signatures too. Not doing so creates a type hole: - // - // function g(x: "hi", y: boolean); - // function g(x: string, y: {}); - // function g(x: string, y: string) { } - // - // The implementation is completely unrelated to the specialized signature, yet we do not check this. - for (var _a = 0, signatures_3 = signatures; _a < signatures_3.length; _a++) { - var signature = signatures_3[_a]; - if (!signature.hasStringLiterals && !isSignatureAssignableTo(bodySignature, signature)) { - error(signature.declaration, ts.Diagnostics.Overload_signature_is_not_compatible_with_function_implementation); - break; - } + for (var _a = 0, signatures_3 = signatures; _a < signatures_3.length; _a++) { + var signature = signatures_3[_a]; + if (!isImplementationCompatibleWithOverload(bodySignature, signature)) { + error(signature.declaration, ts.Diagnostics.Overload_signature_is_not_compatible_with_function_implementation); + break; } } } @@ -24324,8 +27654,8 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var d = _a[_i]; var declarationSpaces = getDeclarationSpaces(d); - var effectiveDeclarationFlags = getEffectiveDeclarationFlags(d, 2 /* Export */ | 512 /* Default */); - if (effectiveDeclarationFlags & 2 /* Export */) { + var effectiveDeclarationFlags = getEffectiveDeclarationFlags(d, 1 /* Export */ | 512 /* Default */); + if (effectiveDeclarationFlags & 1 /* Export */) { if (effectiveDeclarationFlags & 512 /* Default */) { defaultExportedDeclarationSpaces |= declarationSpaces; } @@ -24337,7 +27667,7 @@ var ts; nonExportedDeclarationSpaces |= declarationSpaces; } } - // Spaces for anyting not declared a 'default export'. + // Spaces for anything not declared a 'default export'. var nonDefaultExportedDeclarationSpaces = exportedDeclarationSpaces | nonExportedDeclarationSpaces; var commonDeclarationSpacesForExportsAndLocals = exportedDeclarationSpaces & nonExportedDeclarationSpaces; var commonDeclarationSpacesForDefaultAndNonDefault = defaultExportedDeclarationSpaces & nonDefaultExportedDeclarationSpaces; @@ -24346,7 +27676,7 @@ var ts; for (var _b = 0, _c = symbol.declarations; _b < _c.length; _b++) { var d = _c[_b]; var declarationSpaces = getDeclarationSpaces(d); - // Only error on the declarations that conributed to the intersecting spaces. + // Only error on the declarations that contributed to the intersecting spaces. if (declarationSpaces & commonDeclarationSpacesForDefaultAndNonDefault) { error(d.name, ts.Diagnostics.Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead, ts.declarationNameToString(d.name)); } @@ -24357,20 +27687,20 @@ var ts; } function getDeclarationSpaces(d) { switch (d.kind) { - case 215 /* InterfaceDeclaration */: + case 222 /* InterfaceDeclaration */: return 2097152 /* ExportType */; - case 218 /* ModuleDeclaration */: - return d.name.kind === 9 /* StringLiteral */ || ts.getModuleInstanceState(d) !== 0 /* NonInstantiated */ + case 225 /* ModuleDeclaration */: + return ts.isAmbientModule(d) || ts.getModuleInstanceState(d) !== 0 /* NonInstantiated */ ? 4194304 /* ExportNamespace */ | 1048576 /* ExportValue */ : 4194304 /* ExportNamespace */; - case 214 /* ClassDeclaration */: - case 217 /* EnumDeclaration */: + case 221 /* ClassDeclaration */: + case 224 /* EnumDeclaration */: return 2097152 /* ExportType */ | 1048576 /* ExportValue */; - case 221 /* ImportEqualsDeclaration */: - var result = 0; + case 229 /* ImportEqualsDeclaration */: + var result_1 = 0; var target = resolveAlias(getSymbolOfNode(d)); - ts.forEach(target.declarations, function (d) { result |= getDeclarationSpaces(d); }); - return result; + ts.forEach(target.declarations, function (d) { result_1 |= getDeclarationSpaces(d); }); + return result_1; default: return 1048576 /* ExportValue */; } @@ -24422,7 +27752,7 @@ var ts; if (thenSignatures.length === 0) { return undefined; } - var onfulfilledParameterType = getUnionType(ts.map(thenSignatures, getTypeOfFirstParameterOfSignature)); + var onfulfilledParameterType = getTypeWithFacts(getUnionType(ts.map(thenSignatures, getTypeOfFirstParameterOfSignature)), 131072 /* NEUndefined */); if (onfulfilledParameterType.flags & 1 /* Any */) { return undefined; } @@ -24478,7 +27808,7 @@ var ts; return checkNonThenableType(type, location, message); } else { - if (type.id === promisedType.id || awaitedTypeStack.indexOf(promisedType.id) >= 0) { + if (type.id === promisedType.id || ts.indexOf(awaitedTypeStack, promisedType.id) >= 0) { // We have a bad actor in the form of a promise whose promised type is // the same promise type, or a mutually recursive promise. Return the // unknown type as we cannot guess the shape. If this were the actual @@ -24527,6 +27857,33 @@ var ts; } } } + /** + * Checks that the return type provided is an instantiation of the global Promise type + * and returns the awaited type of the return type. + * + * @param returnType The return type of a FunctionLikeDeclaration + * @param location The node on which to report the error. + */ + function checkCorrectPromiseType(returnType, location) { + if (returnType === unknownType) { + // The return type already had some other error, so we ignore and return + // the unknown type. + return unknownType; + } + var globalPromiseType = getGlobalPromiseType(); + if (globalPromiseType === emptyGenericType + || globalPromiseType === getTargetType(returnType)) { + // Either we couldn't resolve the global promise type, which would have already + // reported an error, or we could resolve it and the return type is a valid type + // reference to the global type. In either case, we return the awaited type for + // the return type. + return checkAwaitedType(returnType, location, ts.Diagnostics.An_async_function_or_method_must_have_a_valid_awaitable_return_type); + } + // The promise type was not a valid type reference to the global promise type, so we + // report an error and return the unknown type. + error(location, ts.Diagnostics.The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type); + return unknownType; + } /** * Checks the return type of an async function to ensure it is a compatible * Promise implementation. @@ -24541,6 +27898,10 @@ var ts; * callable `then` signature. */ function checkAsyncFunctionReturnType(node) { + if (languageVersion >= 2 /* ES6 */) { + var returnType = getTypeFromTypeNode(node.type); + return checkCorrectPromiseType(returnType, node.type); + } var globalPromiseConstructorLikeType = getGlobalPromiseConstructorLikeType(); if (globalPromiseConstructorLikeType === emptyObjectType) { // If we couldn't resolve the global PromiseConstructorLike type we cannot verify @@ -24587,6 +27948,8 @@ var ts; error(node, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type, typeName); return unknownType; } + // If the Promise constructor, resolved locally, is an alias symbol we should mark it as referenced. + checkReturnTypeAnnotationAsExpression(node); // Validate the promise constructor type. var promiseConstructorType = getTypeOfSymbol(promiseConstructor); if (!checkTypeAssignableTo(promiseConstructorType, globalPromiseConstructorLikeType, node, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type)) { @@ -24594,10 +27957,10 @@ var ts; } // Verify there is no local declaration that could collide with the promise constructor. var promiseName = ts.getEntityNameFromTypeNode(node.type); - var root = getFirstIdentifier(promiseName); - var rootSymbol = getSymbol(node.locals, root.text, 107455 /* Value */); + var promiseNameOrNamespaceRoot = getFirstIdentifier(promiseName); + var rootSymbol = getSymbol(node.locals, promiseNameOrNamespaceRoot.text, 107455 /* Value */); if (rootSymbol) { - error(rootSymbol.valueDeclaration, ts.Diagnostics.Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions, root.text, getFullyQualifiedName(promiseConstructor)); + error(rootSymbol.valueDeclaration, ts.Diagnostics.Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions, promiseNameOrNamespaceRoot.text, getFullyQualifiedName(promiseConstructor)); return unknownType; } // Get and return the awaited type of the return type. @@ -24614,22 +27977,22 @@ var ts; var headMessage = getDiagnosticHeadMessageForDecoratorResolution(node); var errorInfo; switch (node.parent.kind) { - case 214 /* ClassDeclaration */: + case 221 /* ClassDeclaration */: var classSymbol = getSymbolOfNode(node.parent); var classConstructorType = getTypeOfSymbol(classSymbol); expectedReturnType = getUnionType([classConstructorType, voidType]); break; - case 138 /* Parameter */: + case 142 /* Parameter */: expectedReturnType = voidType; errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any); break; - case 141 /* PropertyDeclaration */: + case 145 /* PropertyDeclaration */: expectedReturnType = voidType; errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.The_return_type_of_a_property_decorator_function_must_be_either_void_or_any); break; - case 143 /* MethodDeclaration */: - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: + case 147 /* MethodDeclaration */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: var methodType = getTypeOfNode(node.parent); var descriptorType = createTypedPropertyDescriptorType(methodType); expectedReturnType = getUnionType([descriptorType, voidType]); @@ -24642,9 +28005,9 @@ var ts; // When we are emitting type metadata for decorators, we need to try to check the type // as if it were an expression so that we can emit the type in a value position when we // serialize the type metadata. - if (node && node.kind === 151 /* TypeReference */) { + if (node && node.kind === 155 /* TypeReference */) { var root = getFirstIdentifier(node.typeName); - var meaning = root.parent.kind === 151 /* TypeReference */ ? 793056 /* Type */ : 1536 /* Namespace */; + var meaning = root.parent.kind === 155 /* TypeReference */ ? 793056 /* Type */ : 1536 /* Namespace */; // Resolve type so we know which symbol is referenced var rootSymbol = resolveName(root, root.text, meaning | 8388608 /* Alias */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined); // Resolved symbol is alias @@ -24662,23 +28025,10 @@ var ts; * an expression if it is a type reference to a type with a value declaration. */ function checkTypeAnnotationAsExpression(node) { - switch (node.kind) { - case 141 /* PropertyDeclaration */: - checkTypeNodeAsExpression(node.type); - break; - case 138 /* Parameter */: - checkTypeNodeAsExpression(node.type); - break; - case 143 /* MethodDeclaration */: - checkTypeNodeAsExpression(node.type); - break; - case 145 /* GetAccessor */: - checkTypeNodeAsExpression(node.type); - break; - case 146 /* SetAccessor */: - checkTypeNodeAsExpression(ts.getSetAccessorTypeAnnotationNode(node)); - break; - } + checkTypeNodeAsExpression(node.type); + } + function checkReturnTypeAnnotationAsExpression(node) { + checkTypeNodeAsExpression(node.type); } /** Checks the type annotation of the parameters of a function/method or the constructor of a class as expressions */ function checkParameterTypeAnnotationsAsExpressions(node) { @@ -24699,53 +28049,48 @@ var ts; return; } if (!compilerOptions.experimentalDecorators) { - error(node, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Specify_experimentalDecorators_to_remove_this_warning); + error(node, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning); } if (compilerOptions.emitDecoratorMetadata) { // we only need to perform these checks if we are emitting serialized type metadata for the target of a decorator. switch (node.kind) { - case 214 /* ClassDeclaration */: + case 221 /* ClassDeclaration */: var constructor = ts.getFirstConstructorWithBody(node); if (constructor) { checkParameterTypeAnnotationsAsExpressions(constructor); } break; - case 143 /* MethodDeclaration */: + case 147 /* MethodDeclaration */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: checkParameterTypeAnnotationsAsExpressions(node); - // fall-through - case 146 /* SetAccessor */: - case 145 /* GetAccessor */: - case 141 /* PropertyDeclaration */: - case 138 /* Parameter */: + checkReturnTypeAnnotationAsExpression(node); + break; + case 145 /* PropertyDeclaration */: + case 142 /* Parameter */: checkTypeAnnotationAsExpression(node); break; } } - emitDecorate = true; - if (node.kind === 138 /* Parameter */) { - emitParam = true; - } ts.forEach(node.decorators, checkDecorator); } function checkFunctionDeclaration(node) { if (produceDiagnostics) { - checkFunctionLikeDeclaration(node) || checkGrammarForGenerator(node); + checkFunctionOrMethodDeclaration(node) || checkGrammarForGenerator(node); checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); + checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); } } - function checkFunctionLikeDeclaration(node) { + function checkFunctionOrMethodDeclaration(node) { checkDecorators(node); checkSignatureDeclaration(node); var isAsync = ts.isAsyncFunctionLike(node); - if (isAsync) { - emitAwaiter = true; - } // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name && node.name.kind === 136 /* ComputedPropertyName */) { + if (node.name && node.name.kind === 140 /* ComputedPropertyName */) { // This check will account for methods in class/interface declarations, // as well as accessors in classes/object literals checkComputedPropertyName(node.name); @@ -24756,7 +28101,13 @@ var ts; // - if node.localSymbol === undefined - this node is non-exported so we can just pick the result of getSymbolOfNode var symbol = getSymbolOfNode(node); var localSymbol = node.localSymbol || symbol; - var firstDeclaration = ts.getDeclarationOfKind(localSymbol, node.kind); + // Since the javascript won't do semantic analysis like typescript, + // if the javascript file comes before the typescript file and both contain same name functions, + // checkFunctionOrConstructorSymbol wouldn't be called if we didnt ignore javascript function. + var firstDeclaration = ts.forEach(localSymbol.declarations, + // Get first non javascript function declaration + function (declaration) { return declaration.kind === node.kind && !ts.isSourceFileJavaScript(ts.getSourceFileOfNode(declaration)) ? + declaration : undefined; }); // Only type check the symbol once if (node === firstDeclaration) { checkFunctionOrConstructorSymbol(localSymbol); @@ -24770,13 +28121,9 @@ var ts; } } checkSourceElement(node.body); - if (node.type && !isAccessor(node.kind) && !node.asteriskToken) { - var returnType = getTypeFromTypeNode(node.type); - var promisedType; - if (isAsync) { - promisedType = checkAsyncFunctionReturnType(node); - } - checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, isAsync ? promisedType : returnType); + if (!node.asteriskToken) { + var returnOrPromisedType = node.type && (isAsync ? checkAsyncFunctionReturnType(node) : getTypeFromTypeNode(node.type)); + checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnOrPromisedType); } if (produceDiagnostics && !node.type) { // Report an implicit any error if there is no body, no explicit return type, and node is not a private method @@ -24794,17 +28141,14 @@ var ts; } function checkBlock(node) { // Grammar checking for SyntaxKind.Block - if (node.kind === 192 /* Block */) { + if (node.kind === 199 /* Block */) { checkGrammarStatementInAmbientContext(node); } ts.forEach(node.statements, checkSourceElement); - if (ts.isFunctionBlock(node) || node.kind === 219 /* ModuleBlock */) { - checkFunctionAndClassExpressionBodies(node); - } } function checkCollisionWithArgumentsInGeneratedCode(node) { // no rest parameters \ declaration context \ overload - no codegen impact - if (!ts.hasRestParameter(node) || ts.isInAmbientContext(node) || ts.nodeIsMissing(node.body)) { + if (!ts.hasDeclaredRestParameter(node) || ts.isInAmbientContext(node) || ts.nodeIsMissing(node.body)) { return; } ts.forEach(node.parameters, function (p) { @@ -24817,12 +28161,12 @@ var ts; if (!(identifier && identifier.text === name)) { return false; } - if (node.kind === 141 /* PropertyDeclaration */ || - node.kind === 140 /* PropertySignature */ || - node.kind === 143 /* MethodDeclaration */ || - node.kind === 142 /* MethodSignature */ || - node.kind === 145 /* GetAccessor */ || - node.kind === 146 /* SetAccessor */) { + if (node.kind === 145 /* PropertyDeclaration */ || + node.kind === 144 /* PropertySignature */ || + node.kind === 147 /* MethodDeclaration */ || + node.kind === 146 /* MethodSignature */ || + node.kind === 149 /* GetAccessor */ || + node.kind === 150 /* SetAccessor */) { // it is ok to have member named '_super' or '_this' - member access is always qualified return false; } @@ -24831,7 +28175,7 @@ var ts; return false; } var root = ts.getRootDeclaration(node); - if (root.kind === 138 /* Parameter */ && ts.nodeIsMissing(root.parent.body)) { + if (root.kind === 142 /* Parameter */ && ts.nodeIsMissing(root.parent.body)) { // just an overload - no codegen impact return false; } @@ -24884,16 +28228,31 @@ var ts; return; } // Uninstantiated modules shouldnt do this check - if (node.kind === 218 /* ModuleDeclaration */ && ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { + if (node.kind === 225 /* ModuleDeclaration */ && ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { return; } // In case of variable declaration, node.parent is variable statement so look at the variable statement's parent var parent = getDeclarationContainer(node); - if (parent.kind === 248 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent)) { + if (parent.kind === 256 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent)) { // If the declaration happens to be in external module, report error that require and exports are reserved keywords error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } } + function checkCollisionWithGlobalPromiseInGeneratedCode(node, name) { + if (!needCollisionCheckForIdentifier(node, name, "Promise")) { + return; + } + // Uninstantiated modules shouldnt do this check + if (node.kind === 225 /* ModuleDeclaration */ && ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { + return; + } + // In case of variable declaration, node.parent is variable statement so look at the variable statement's parent + var parent = getDeclarationContainer(node); + if (parent.kind === 256 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent) && parent.flags & 2097152 /* HasAsyncFunctions */) { + // If the declaration happens to be in external module, report error that Promise is a reserved identifier. + error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions, ts.declarationNameToString(name), ts.declarationNameToString(name)); + } + } function checkVarDeclaredNamesNotShadowed(node) { // - ScriptBody : StatementList // It is a Syntax Error if any element of the LexicallyDeclaredNames of StatementList @@ -24918,13 +28277,13 @@ var ts; // const x = 0; // symbol for this declaration will be 'symbol' // } // skip block-scoped variables and parameters - if ((ts.getCombinedNodeFlags(node) & 24576 /* BlockScoped */) !== 0 || ts.isParameterDeclaration(node)) { + if ((ts.getCombinedNodeFlags(node) & 3072 /* BlockScoped */) !== 0 || ts.isParameterDeclaration(node)) { return; } // skip variable declarations that don't have initializers // NOTE: in ES6 spec initializer is required in variable declarations where name is binding pattern // so we'll always treat binding elements as initialized - if (node.kind === 211 /* VariableDeclaration */ && !node.initializer) { + if (node.kind === 218 /* VariableDeclaration */ && !node.initializer) { return; } var symbol = getSymbolOfNode(node); @@ -24933,25 +28292,25 @@ var ts; if (localDeclarationSymbol && localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2 /* BlockScopedVariable */) { - if (getDeclarationFlagsFromSymbol(localDeclarationSymbol) & 24576 /* BlockScoped */) { - var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 212 /* VariableDeclarationList */); - var container = varDeclList.parent.kind === 193 /* VariableStatement */ && varDeclList.parent.parent + if (getDeclarationFlagsFromSymbol(localDeclarationSymbol) & 3072 /* BlockScoped */) { + var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 219 /* VariableDeclarationList */); + var container = varDeclList.parent.kind === 200 /* VariableStatement */ && varDeclList.parent.parent ? varDeclList.parent.parent : undefined; // names of block-scoped and function scoped variables can collide only // if block scoped variable is defined in the function\module\source file scope (because of variable hoisting) var namesShareScope = container && - (container.kind === 192 /* Block */ && ts.isFunctionLike(container.parent) || - container.kind === 219 /* ModuleBlock */ || - container.kind === 218 /* ModuleDeclaration */ || - container.kind === 248 /* SourceFile */); + (container.kind === 199 /* Block */ && ts.isFunctionLike(container.parent) || + container.kind === 226 /* ModuleBlock */ || + container.kind === 225 /* ModuleDeclaration */ || + container.kind === 256 /* SourceFile */); // here we know that function scoped variable is shadowed by block scoped one // if they are defined in the same scope - binder has already reported redeclaration error // otherwise if variable has an initializer - show error that initialization will fail // since LHS will be block scoped name instead of function scoped if (!namesShareScope) { - var name_14 = symbolToString(localDeclarationSymbol); - error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name_14, name_14); + var name_16 = symbolToString(localDeclarationSymbol); + error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name_16, name_16); } } } @@ -24959,32 +28318,63 @@ var ts; } // Check that a parameter initializer contains no references to parameters declared to the right of itself function checkParameterInitializer(node) { - if (ts.getRootDeclaration(node).kind !== 138 /* Parameter */) { + if (ts.getRootDeclaration(node).kind !== 142 /* Parameter */) { return; } var func = ts.getContainingFunction(node); visit(node.initializer); function visit(n) { - if (n.kind === 69 /* Identifier */) { - var referencedSymbol = getNodeLinks(n).resolvedSymbol; + if (ts.isTypeNode(n) || ts.isDeclarationName(n)) { + // do not dive in types + // skip declaration names (i.e. in object literal expressions) + return; + } + if (n.kind === 172 /* PropertyAccessExpression */) { + // skip property names in property access expression + return visit(n.expression); + } + else if (n.kind === 69 /* Identifier */) { // check FunctionLikeDeclaration.locals (stores parameters\function local variable) - // if it contains entry with a specified name and if this entry matches the resolved symbol - if (referencedSymbol && referencedSymbol !== unknownSymbol && getSymbol(func.locals, referencedSymbol.name, 107455 /* Value */) === referencedSymbol) { - if (referencedSymbol.valueDeclaration.kind === 138 /* Parameter */) { - if (referencedSymbol.valueDeclaration === node) { - error(n, ts.Diagnostics.Parameter_0_cannot_be_referenced_in_its_initializer, ts.declarationNameToString(node.name)); + // if it contains entry with a specified name + var symbol = resolveName(n, n.text, 107455 /* Value */ | 8388608 /* Alias */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined); + if (!symbol || symbol === unknownSymbol || !symbol.valueDeclaration) { + return; + } + if (symbol.valueDeclaration === node) { + error(n, ts.Diagnostics.Parameter_0_cannot_be_referenced_in_its_initializer, ts.declarationNameToString(node.name)); + return; + } + // locals map for function contain both parameters and function locals + // so we need to do a bit of extra work to check if reference is legal + var enclosingContainer = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration); + if (enclosingContainer === func) { + if (symbol.valueDeclaration.kind === 142 /* Parameter */) { + // it is ok to reference parameter in initializer if either + // - parameter is located strictly on the left of current parameter declaration + if (symbol.valueDeclaration.pos < node.pos) { return; } - if (referencedSymbol.valueDeclaration.pos < node.pos) { - // legal case - parameter initializer references some parameter strictly on left of current parameter declaration - return; + // - parameter is wrapped in function-like entity + var current = n; + while (current !== node.initializer) { + if (ts.isFunctionLike(current.parent)) { + return; + } + // computed property names/initializers in instance property declaration of class like entities + // are executed in constructor and thus deferred + if (current.parent.kind === 145 /* PropertyDeclaration */ && + !(current.parent.flags & 32 /* Static */) && + ts.isClassLike(current.parent.parent)) { + return; + } + current = current.parent; } } error(n, ts.Diagnostics.Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it, ts.declarationNameToString(node.name), ts.declarationNameToString(n)); } } else { - ts.forEachChild(n, visit); + return ts.forEachChild(n, visit); } } } @@ -24996,30 +28386,39 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 136 /* ComputedPropertyName */) { + if (node.name.kind === 140 /* ComputedPropertyName */) { checkComputedPropertyName(node.name); if (node.initializer) { checkExpressionCached(node.initializer); } } - if (node.kind === 163 /* BindingElement */) { + if (node.kind === 169 /* BindingElement */) { // check computed properties inside property names of binding elements - if (node.propertyName && node.propertyName.kind === 136 /* ComputedPropertyName */) { + if (node.propertyName && node.propertyName.kind === 140 /* ComputedPropertyName */) { checkComputedPropertyName(node.propertyName); } + // check private/protected variable access + var parent_11 = node.parent.parent; + var parentType = getTypeForBindingElementParent(parent_11); + var name_17 = node.propertyName || node.name; + var property = getPropertyOfType(parentType, getTextOfPropertyName(name_17)); + if (parent_11.initializer && property && getParentOfSymbol(property)) { + checkClassPropertyAccess(parent_11, parent_11.initializer, parentType, property); + } } // For a binding pattern, check contained binding elements if (ts.isBindingPattern(node.name)) { ts.forEach(node.name.elements, checkSourceElement); } // For a parameter declaration with an initializer, error and exit if the containing function doesn't have a body - if (node.initializer && ts.getRootDeclaration(node).kind === 138 /* Parameter */ && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { + if (node.initializer && ts.getRootDeclaration(node).kind === 142 /* Parameter */ && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { error(node, ts.Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation); return; } // For a binding pattern, validate the initializer and exit if (ts.isBindingPattern(node.name)) { - if (node.initializer) { + // Don't validate for-in initializer as it is already an error + if (node.initializer && node.parent.parent.kind !== 207 /* ForInStatement */) { checkTypeAssignableTo(checkExpressionCached(node.initializer), getWidenedTypeForVariableLikeDeclaration(node), node, /*headMessage*/ undefined); checkParameterInitializer(node); } @@ -25029,7 +28428,8 @@ var ts; var type = getTypeOfVariableOrParameterOrProperty(symbol); if (node === symbol.valueDeclaration) { // Node is the primary declaration of the symbol, just validate the initializer - if (node.initializer) { + // Don't validate for-in initializer as it is already an error + if (node.initializer && node.parent.parent.kind !== 207 /* ForInStatement */) { checkTypeAssignableTo(checkExpressionCached(node.initializer), type, node, /*headMessage*/ undefined); checkParameterInitializer(node); } @@ -25045,15 +28445,16 @@ var ts; checkTypeAssignableTo(checkExpressionCached(node.initializer), declarationType, node, /*headMessage*/ undefined); } } - if (node.kind !== 141 /* PropertyDeclaration */ && node.kind !== 140 /* PropertySignature */) { + if (node.kind !== 145 /* PropertyDeclaration */ && node.kind !== 144 /* PropertySignature */) { // We know we don't have a binding pattern or computed name here checkExportsOnMergedDeclarations(node); - if (node.kind === 211 /* VariableDeclaration */ || node.kind === 163 /* BindingElement */) { + if (node.kind === 218 /* VariableDeclaration */ || node.kind === 169 /* BindingElement */) { checkVarDeclaredNamesNotShadowed(node); } checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); + checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); } } function checkVariableDeclaration(node) { @@ -25071,7 +28472,7 @@ var ts; } function checkGrammarDisallowedModifiersOnObjectLiteralExpressionMethod(node) { // We only disallow modifier on a method declaration if it is a property of object-literal-expression - if (node.modifiers && node.parent.kind === 165 /* ObjectLiteralExpression */) { + if (node.modifiers && node.parent.kind === 171 /* ObjectLiteralExpression */) { if (ts.isAsyncFunctionLike(node)) { if (node.modifiers.length > 1) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); @@ -25092,7 +28493,7 @@ var ts; checkGrammarStatementInAmbientContext(node); checkExpression(node.expression); checkSourceElement(node.thenStatement); - if (node.thenStatement.kind === 194 /* EmptyStatement */) { + if (node.thenStatement.kind === 201 /* EmptyStatement */) { error(node.thenStatement, ts.Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement); } checkSourceElement(node.elseStatement); @@ -25112,12 +28513,12 @@ var ts; function checkForStatement(node) { // Grammar checking if (!checkGrammarStatementInAmbientContext(node)) { - if (node.initializer && node.initializer.kind === 212 /* VariableDeclarationList */) { + if (node.initializer && node.initializer.kind === 219 /* VariableDeclarationList */) { checkGrammarVariableDeclarationList(node.initializer); } } if (node.initializer) { - if (node.initializer.kind === 212 /* VariableDeclarationList */) { + if (node.initializer.kind === 219 /* VariableDeclarationList */) { ts.forEach(node.initializer.declarations, checkVariableDeclaration); } else { @@ -25137,14 +28538,14 @@ var ts; // via checkRightHandSideOfForOf. // If the LHS is an expression, check the LHS, as a destructuring assignment or as a reference. // Then check that the RHS is assignable to it. - if (node.initializer.kind === 212 /* VariableDeclarationList */) { + if (node.initializer.kind === 219 /* VariableDeclarationList */) { checkForInOrForOfVariableDeclaration(node); } else { var varExpr = node.initializer; var iteratedType = checkRightHandSideOfForOf(node.expression); // There may be a destructuring assignment on the left side - if (varExpr.kind === 164 /* ArrayLiteralExpression */ || varExpr.kind === 165 /* ObjectLiteralExpression */) { + if (varExpr.kind === 170 /* ArrayLiteralExpression */ || varExpr.kind === 171 /* ObjectLiteralExpression */) { // iteratedType may be undefined. In this case, we still want to check the structure of // varExpr, in particular making sure it's a valid LeftHandSideExpression. But we'd like // to short circuit the type relation checking as much as possible, so we pass the unknownType. @@ -25153,7 +28554,7 @@ var ts; else { var leftType = checkExpression(varExpr); checkReferenceExpression(varExpr, /*invalidReferenceMessage*/ ts.Diagnostics.Invalid_left_hand_side_in_for_of_statement, - /*constantVariableMessage*/ ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_be_a_previously_defined_constant); + /*constantVariableMessage*/ ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_be_a_constant_or_a_read_only_property); // iteratedType will be undefined if the rightType was missing properties/signatures // required to get its iteratedType (like [Symbol.iterator] or next). This may be // because we accessed properties from anyType, or it may have led to an error inside @@ -25173,7 +28574,7 @@ var ts; // for (let VarDecl in Expr) Statement // VarDecl must be a variable declaration without a type annotation that declares a variable of type Any, // and Expr must be an expression of type Any, an object type, or a type parameter type. - if (node.initializer.kind === 212 /* VariableDeclarationList */) { + if (node.initializer.kind === 219 /* VariableDeclarationList */) { var variable = node.initializer.declarations[0]; if (variable && ts.isBindingPattern(variable.name)) { error(variable.name, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); @@ -25187,7 +28588,7 @@ var ts; // and Expr must be an expression of type Any, an object type, or a type parameter type. var varExpr = node.initializer; var leftType = checkExpression(varExpr); - if (varExpr.kind === 164 /* ArrayLiteralExpression */ || varExpr.kind === 165 /* ObjectLiteralExpression */) { + if (varExpr.kind === 170 /* ArrayLiteralExpression */ || varExpr.kind === 171 /* ObjectLiteralExpression */) { error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); } else if (!isTypeAnyOrAllConstituentTypesHaveKind(leftType, 258 /* StringLike */)) { @@ -25195,10 +28596,10 @@ var ts; } else { // run check only former check succeeded to avoid cascading errors - checkReferenceExpression(varExpr, ts.Diagnostics.Invalid_left_hand_side_in_for_in_statement, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_previously_defined_constant); + checkReferenceExpression(varExpr, ts.Diagnostics.Invalid_left_hand_side_in_for_in_statement, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_constant_or_a_read_only_property); } } - var rightType = checkExpression(node.expression); + var rightType = checkNonNullExpression(node.expression); // unknownType is returned i.e. if node.expression is identifier whose name cannot be resolved // in this case error about missing name is already reported - do not report extra one if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 80896 /* ObjectType */ | 512 /* TypeParameter */)) { @@ -25215,7 +28616,7 @@ var ts; } } function checkRightHandSideOfForOf(rhsExpression) { - var expressionType = getTypeOfExpression(rhsExpression); + var expressionType = checkNonNullExpression(rhsExpression); return checkIteratedTypeOrElementType(expressionType, rhsExpression, /*allowStringInput*/ true); } function checkIteratedTypeOrElementType(inputType, errorNode, allowStringInput) { @@ -25234,7 +28635,9 @@ var ts; return indexType; } } - error(errorNode, ts.Diagnostics.Type_0_is_not_an_array_type, typeToString(inputType)); + if (errorNode) { + error(errorNode, ts.Diagnostics.Type_0_is_not_an_array_type, typeToString(inputType)); + } return unknownType; } /** @@ -25278,7 +28681,7 @@ var ts; if (!typeAsIterable.iterableElementType) { // As an optimization, if the type is instantiated directly using the globalIterableType (Iterable), // then just grab its type argument. - if ((type.flags & 4096 /* Reference */) && type.target === globalIterableType) { + if ((type.flags & 4096 /* Reference */) && type.target === getGlobalIterableType()) { typeAsIterable.iterableElementType = type.typeArguments[0]; } else { @@ -25319,7 +28722,7 @@ var ts; if (!typeAsIterator.iteratorElementType) { // As an optimization, if the type is instantiated directly using the globalIteratorType (Iterator), // then just grab its type argument. - if ((type.flags & 4096 /* Reference */) && type.target === globalIteratorType) { + if ((type.flags & 4096 /* Reference */) && type.target === getGlobalIteratorType()) { typeAsIterator.iteratorElementType = type.typeArguments[0]; } else { @@ -25356,7 +28759,7 @@ var ts; } // As an optimization, if the type is instantiated directly using the globalIterableIteratorType (IterableIterator), // then just grab its type argument. - if ((type.flags & 4096 /* Reference */) && type.target === globalIterableIteratorType) { + if ((type.flags & 4096 /* Reference */) && type.target === getGlobalIterableIteratorType()) { return type.typeArguments[0]; } return getElementTypeOfIterable(type, /*errorNode*/ undefined) || @@ -25366,7 +28769,7 @@ var ts; * This function does the following steps: * 1. Break up arrayOrStringType (possibly a union) into its string constituents and array constituents. * 2. Take the element types of the array constituents. - * 3. Return the union of the element types, and string if there was a string constitutent. + * 3. Return the union of the element types, and string if there was a string constituent. * * For example: * string -> string @@ -25383,7 +28786,13 @@ var ts; ts.Debug.assert(languageVersion < 2 /* ES6 */); // After we remove all types that are StringLike, we will know if there was a string constituent // based on whether the remaining type is the same as the initial type. - var arrayType = removeTypesFromUnionType(arrayOrStringType, 258 /* StringLike */, /*isTypeOfKind*/ true, /*allowEmptyUnionResult*/ true); + var arrayType = arrayOrStringType; + if (arrayOrStringType.flags & 16384 /* Union */) { + arrayType = getUnionType(ts.filter(arrayOrStringType.types, function (t) { return !(t.flags & 258 /* StringLike */); })); + } + else if (arrayOrStringType.flags & 258 /* StringLike */) { + arrayType = neverType; + } var hasStringConstituent = arrayOrStringType !== arrayType; var reportedError = false; if (hasStringConstituent) { @@ -25393,7 +28802,7 @@ var ts; } // Now that we've removed all the StringLike types, if no constituents remain, then the entire // arrayOrStringType was a string. - if (arrayType === emptyObjectType) { + if (arrayType === neverType) { return stringType; } } @@ -25425,8 +28834,12 @@ var ts; checkGrammarStatementInAmbientContext(node) || checkGrammarBreakOrContinueStatement(node); // TODO: Check that target label is valid } - function isGetAccessorWithAnnotatatedSetAccessor(node) { - return !!(node.kind === 145 /* GetAccessor */ && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 146 /* SetAccessor */))); + function isGetAccessorWithAnnotatedSetAccessor(node) { + return !!(node.kind === 149 /* GetAccessor */ && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 150 /* SetAccessor */))); + } + function isUnwrappedReturnTypeVoidOrAny(func, returnType) { + var unwrappedReturnType = ts.isAsyncFunctionLike(func) ? getPromisedType(returnType) : returnType; + return maybeTypeOfKind(unwrappedReturnType, 16 /* Void */ | 1 /* Any */); } function checkReturnStatement(node) { // Grammar checking @@ -25436,12 +28849,12 @@ var ts; grammarErrorOnFirstToken(node, ts.Diagnostics.A_return_statement_can_only_be_used_within_a_function_body); } } - if (node.expression) { - var func = ts.getContainingFunction(node); - if (func) { - var signature = getSignatureFromDeclaration(func); - var returnType = getReturnTypeOfSignature(signature); - var exprType = checkExpressionCached(node.expression); + var func = ts.getContainingFunction(node); + if (func) { + var signature = getSignatureFromDeclaration(func); + var returnType = getReturnTypeOfSignature(signature); + if (strictNullChecks || node.expression || returnType === neverType) { + var exprType = node.expression ? checkExpressionCached(node.expression) : undefinedType; if (func.asteriskToken) { // A generator does not need its return expressions checked against its return type. // Instead, the yield expressions are checked against the element type. @@ -25449,36 +28862,42 @@ var ts; // for generators. return; } - if (func.kind === 146 /* SetAccessor */) { - error(node.expression, ts.Diagnostics.Setters_cannot_return_a_value); + if (func.kind === 150 /* SetAccessor */) { + if (node.expression) { + error(node.expression, ts.Diagnostics.Setters_cannot_return_a_value); + } } - else if (func.kind === 144 /* Constructor */) { - if (!checkTypeAssignableTo(exprType, returnType, node.expression)) { + else if (func.kind === 148 /* Constructor */) { + if (node.expression && !checkTypeAssignableTo(exprType, returnType, node.expression)) { error(node.expression, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); } } - else if (func.type || isGetAccessorWithAnnotatatedSetAccessor(func) || signature.typePredicate) { + else if (func.type || isGetAccessorWithAnnotatedSetAccessor(func)) { if (ts.isAsyncFunctionLike(func)) { var promisedType = getPromisedType(returnType); - var awaitedType = checkAwaitedType(exprType, node.expression, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member); + var awaitedType = checkAwaitedType(exprType, node.expression || node, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member); if (promisedType) { // If the function has a return type, but promisedType is // undefined, an error will be reported in checkAsyncFunctionReturnType // so we don't need to report one here. - checkTypeAssignableTo(awaitedType, promisedType, node.expression); + checkTypeAssignableTo(awaitedType, promisedType, node.expression || node); } } else { - checkTypeAssignableTo(exprType, returnType, node.expression); + checkTypeAssignableTo(exprType, returnType, node.expression || node); } } } + else if (func.kind !== 148 /* Constructor */ && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(func, returnType)) { + // The function has a return type, but the return statement doesn't have an expression. + error(node, ts.Diagnostics.Not_all_code_paths_return_a_value); + } } } function checkWithStatement(node) { // Grammar checking for withStatement if (!checkGrammarStatementInAmbientContext(node)) { - if (node.parserContextFlags & 8 /* Await */) { + if (node.flags & 33554432 /* AwaitContext */) { grammarErrorOnFirstToken(node, ts.Diagnostics.with_statements_are_not_allowed_in_an_async_function_block); } } @@ -25491,10 +28910,9 @@ var ts; var firstDefaultClause; var hasDuplicateDefaultClause = false; var expressionType = checkExpression(node.expression); - var expressionTypeIsStringLike = someConstituentTypeHasKind(expressionType, 258 /* StringLike */); ts.forEach(node.caseBlock.clauses, function (clause) { // Grammar check for duplicate default clauses, skip if we already report duplicate default clause - if (clause.kind === 242 /* DefaultClause */ && !hasDuplicateDefaultClause) { + if (clause.kind === 250 /* DefaultClause */ && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -25506,18 +28924,15 @@ var ts; hasDuplicateDefaultClause = true; } } - if (produceDiagnostics && clause.kind === 241 /* CaseClause */) { + if (produceDiagnostics && clause.kind === 249 /* CaseClause */) { var caseClause = clause; - // TypeScript 1.0 spec (April 2014):5.9 - // In a 'switch' statement, each 'case' expression must be of a type that is assignable to or from the type of the 'switch' expression. + // TypeScript 1.0 spec (April 2014): 5.9 + // In a 'switch' statement, each 'case' expression must be of a type that is comparable + // to or from the type of the 'switch' expression. var caseType = checkExpression(caseClause.expression); - // Permit 'number[] | "foo"' to be asserted to 'string'. - if (expressionTypeIsStringLike && someConstituentTypeHasKind(caseType, 258 /* StringLike */)) { - return; - } - if (!isTypeAssignableTo(expressionType, caseType)) { - // check 'expressionType isAssignableTo caseType' failed, try the reversed check and report errors if it fails - checkTypeAssignableTo(caseType, expressionType, caseClause.expression, /*headMessage*/ undefined); + if (!isTypeComparableTo(expressionType, caseType)) { + // expressionType is not comparable to caseType, try the reversed check and report errors if it fails + checkTypeComparableTo(caseType, expressionType, caseClause.expression, /*headMessage*/ undefined); } } ts.forEach(clause.statements, checkSourceElement); @@ -25531,7 +28946,7 @@ var ts; if (ts.isFunctionLike(current)) { break; } - if (current.kind === 207 /* LabeledStatement */ && current.label.text === node.label.text) { + if (current.kind === 214 /* LabeledStatement */ && current.label.text === node.label.text) { var sourceFile = ts.getSourceFileOfNode(node); grammarErrorOnNode(node.label, ts.Diagnostics.Duplicate_label_0, ts.getTextOfNodeFromSourceText(sourceFile.text, node.label)); break; @@ -25605,7 +29020,7 @@ var ts; // Only process instance properties with computed names here. // Static properties cannot be in conflict with indexers, // and properties with literal names were already checked. - if (!(member.flags & 64 /* Static */) && ts.hasDynamicName(member)) { + if (!(member.flags & 32 /* Static */) && ts.hasDynamicName(member)) { var propType = getTypeOfSymbol(member.symbol); checkIndexConstraintForProperty(member.symbol, propType, type, declaredStringIndexer, stringIndexType, 0 /* String */); checkIndexConstraintForProperty(member.symbol, propType, type, declaredNumberIndexer, numberIndexType, 1 /* Number */); @@ -25636,7 +29051,7 @@ var ts; // perform property check if property or indexer is declared in 'type' // this allows to rule out cases when both property and indexer are inherited from the base class var errorNode; - if (prop.valueDeclaration.name.kind === 136 /* ComputedPropertyName */ || prop.parent === containingType.symbol) { + if (prop.valueDeclaration.name.kind === 140 /* ComputedPropertyName */ || prop.parent === containingType.symbol) { errorNode = prop.valueDeclaration; } else if (indexDeclaration) { @@ -25670,7 +29085,7 @@ var ts; error(name, message, name.text); } } - // Check each type parameter and check that list has no duplicate type parameter declarations + /** Check each type parameter and check that type parameters have no duplicate type parameter declarations */ function checkTypeParameters(typeParameterDeclarations) { if (typeParameterDeclarations) { for (var i = 0, n = typeParameterDeclarations.length; i < n; i++) { @@ -25686,10 +29101,32 @@ var ts; } } } + /** Check that type parameter lists are identical across multiple declarations */ + function checkTypeParameterListsIdentical(node, symbol) { + if (symbol.declarations.length === 1) { + return; + } + var firstDecl; + for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { + var declaration = _a[_i]; + if (declaration.kind === 221 /* ClassDeclaration */ || declaration.kind === 222 /* InterfaceDeclaration */) { + if (!firstDecl) { + firstDecl = declaration; + } + else if (!areTypeParametersIdentical(firstDecl.typeParameters, node.typeParameters)) { + error(node.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_type_parameters, node.name.text); + } + } + } + } function checkClassExpression(node) { checkClassLikeDeclaration(node); + checkNodeDeferred(node); return getTypeOfSymbol(getSymbolOfNode(node)); } + function checkClassExpressionDeferred(node) { + ts.forEach(node.members, checkSourceElement); + } function checkClassDeclaration(node) { if (!node.name && !(node.flags & 512 /* Default */)) { grammarErrorOnFirstToken(node, ts.Diagnostics.A_class_declaration_without_the_default_modifier_must_have_a_name); @@ -25704,6 +29141,7 @@ var ts; checkTypeNameIsReserved(node.name, ts.Diagnostics.Class_name_cannot_be_0); checkCollisionWithCapturedThisVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); + checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); } checkTypeParameters(node.typeParameters); checkExportsOnMergedDeclarations(node); @@ -25711,13 +29149,14 @@ var ts; var type = getDeclaredTypeOfSymbol(symbol); var typeWithThis = getTypeWithThisArgument(type); var staticType = getTypeOfSymbol(symbol); + checkTypeParameterListsIdentical(node, symbol); var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { - emitExtends = emitExtends || !ts.isInAmbientContext(node); var baseTypes = getBaseTypes(type); if (baseTypes.length && produceDiagnostics) { - var baseType = baseTypes[0]; + var baseType_1 = baseTypes[0]; var staticBaseType = getBaseConstructorTypeOfClass(type); + checkBaseTypeAccessibility(staticBaseType, baseTypeNode); checkSourceElement(baseTypeNode.expression); if (baseTypeNode.typeArguments) { ts.forEach(baseTypeNode.typeArguments, checkSourceElement); @@ -25728,7 +29167,7 @@ var ts; } } } - checkTypeAssignableTo(typeWithThis, getTypeWithThisArgument(baseType, type.thisType), node.name || node, ts.Diagnostics.Class_0_incorrectly_extends_base_class_1); + checkTypeAssignableTo(typeWithThis, getTypeWithThisArgument(baseType_1, type.thisType), node.name || node, ts.Diagnostics.Class_0_incorrectly_extends_base_class_1); checkTypeAssignableTo(staticType, getTypeWithoutSignatures(staticBaseType), node.name || node, ts.Diagnostics.Class_static_side_0_incorrectly_extends_base_class_static_side_1); if (!(staticBaseType.symbol && staticBaseType.symbol.flags & 32 /* Class */)) { // When the static base type is a "class-like" constructor function (but not actually a class), we verify @@ -25736,11 +29175,11 @@ var ts; // references (as opposed to checking the structure of the types) because elsewhere we have already checked // that the base type is a class or interface type (and not, for example, an anonymous object type). var constructors = getInstantiatedConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments); - if (ts.forEach(constructors, function (sig) { return getReturnTypeOfSignature(sig) !== baseType; })) { + if (ts.forEach(constructors, function (sig) { return getReturnTypeOfSignature(sig) !== baseType_1; })) { error(baseTypeNode.expression, ts.Diagnostics.Base_constructors_must_all_have_the_same_return_type); } } - checkKindsOfPropertyMemberOverrides(type, baseType); + checkKindsOfPropertyMemberOverrides(type, baseType_1); } } var implementedTypeNodes = ts.getClassImplementsHeritageClauseElements(node); @@ -25770,6 +29209,18 @@ var ts; checkTypeForDuplicateIndexSignatures(node); } } + function checkBaseTypeAccessibility(type, node) { + var signatures = getSignaturesOfType(type, 1 /* Construct */); + if (signatures.length) { + var declaration = signatures[0].declaration; + if (declaration && declaration.flags & 8 /* Private */) { + var typeClassDeclaration = getClassLikeDeclarationOfSymbol(type.symbol); + if (!isNodeWithinClass(node, typeClassDeclaration)) { + error(node, ts.Diagnostics.Cannot_extend_a_class_0_Class_constructor_is_marked_as_private, node.expression.text); + } + } + } + } function getTargetSymbol(s) { // if symbol is instantiated its flags are not copied from the 'target' // so we'll need to get back original 'target' symbol to work with correct set of flags @@ -25804,7 +29255,7 @@ var ts; var baseDeclarationFlags = getDeclarationFlagsFromSymbol(base); ts.Debug.assert(!!derived, "derived should point to something, even if it is the base class' declaration."); if (derived) { - // In order to resolve whether the inherited method was overriden in the base class or not, + // In order to resolve whether the inherited method was overridden in the base class or not, // we compare the Symbols obtained. Since getTargetSymbol returns the symbol on the *uninstantiated* // type declaration, derived and base resolve to the same symbol even in the case of generic classes. if (derived === base) { @@ -25814,7 +29265,7 @@ var ts; // If there is no declaration for the derived class (as in the case of class expressions), // then the class cannot be declared abstract. if (baseDeclarationFlags & 128 /* Abstract */ && (!derivedClassDecl || !(derivedClassDecl.flags & 128 /* Abstract */))) { - if (derivedClassDecl.kind === 186 /* ClassExpression */) { + if (derivedClassDecl.kind === 192 /* ClassExpression */) { error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType)); } else { @@ -25825,11 +29276,11 @@ var ts; else { // derived overrides base. var derivedDeclarationFlags = getDeclarationFlagsFromSymbol(derived); - if ((baseDeclarationFlags & 16 /* Private */) || (derivedDeclarationFlags & 16 /* Private */)) { + if ((baseDeclarationFlags & 8 /* Private */) || (derivedDeclarationFlags & 8 /* Private */)) { // either base or derived property is private - not override, skip it continue; } - if ((baseDeclarationFlags & 64 /* Static */) !== (derivedDeclarationFlags & 64 /* Static */)) { + if ((baseDeclarationFlags & 32 /* Static */) !== (derivedDeclarationFlags & 32 /* Static */)) { // value of 'static' is not the same for properties - not override, skip it continue; } @@ -25862,7 +29313,7 @@ var ts; } } function isAccessor(kind) { - return kind === 145 /* GetAccessor */ || kind === 146 /* SetAccessor */; + return kind === 149 /* GetAccessor */ || kind === 150 /* SetAccessor */; } function areTypeParametersIdentical(list1, list2) { if (!list1 && !list2) { @@ -25932,13 +29383,9 @@ var ts; checkTypeNameIsReserved(node.name, ts.Diagnostics.Interface_name_cannot_be_0); checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); - var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 215 /* InterfaceDeclaration */); - if (symbol.declarations.length > 1) { - if (node !== firstInterfaceDecl && !areTypeParametersIdentical(firstInterfaceDecl.typeParameters, node.typeParameters)) { - error(node.name, ts.Diagnostics.All_declarations_of_an_interface_must_have_identical_type_parameters); - } - } + checkTypeParameterListsIdentical(node, symbol); // Only check this symbol once + var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 222 /* InterfaceDeclaration */); if (node === firstInterfaceDecl) { var type = getDeclaredTypeOfSymbol(symbol); var typeWithThis = getTypeWithThisArgument(type); @@ -25971,7 +29418,7 @@ var ts; } function computeEnumMemberValues(node) { var nodeLinks = getNodeLinks(node); - if (!(nodeLinks.flags & 8192 /* EnumValuesComputed */)) { + if (!(nodeLinks.flags & 16384 /* EnumValuesComputed */)) { var enumSymbol = getSymbolOfNode(node); var enumType = getDeclaredTypeOfSymbol(enumSymbol); var autoValue = 0; // set to undefined when enum member is non-constant @@ -26006,10 +29453,11 @@ var ts; error(member.name, ts.Diagnostics.Enum_member_must_have_initializer); } if (autoValue !== undefined) { - getNodeLinks(member).enumMemberValue = autoValue++; + getNodeLinks(member).enumMemberValue = autoValue; + autoValue++; } } - nodeLinks.flags |= 8192 /* EnumValuesComputed */; + nodeLinks.flags |= 16384 /* EnumValuesComputed */; } function computeConstantValueForEnumMemberInitializer(initializer, enumType, enumIsConst, ambient) { // Controls if error should be reported after evaluation of constant value is completed @@ -26041,7 +29489,7 @@ var ts; return value; function evalConstant(e) { switch (e.kind) { - case 179 /* PrefixUnaryExpression */: + case 185 /* PrefixUnaryExpression */: var value_1 = evalConstant(e.operand); if (value_1 === undefined) { return undefined; @@ -26052,7 +29500,7 @@ var ts; case 50 /* TildeToken */: return ~value_1; } return undefined; - case 181 /* BinaryExpression */: + case 187 /* BinaryExpression */: var left = evalConstant(e.left); if (left === undefined) { return undefined; @@ -26077,15 +29525,15 @@ var ts; return undefined; case 8 /* NumericLiteral */: return +e.text; - case 172 /* ParenthesizedExpression */: + case 178 /* ParenthesizedExpression */: return evalConstant(e.expression); case 69 /* Identifier */: - case 167 /* ElementAccessExpression */: - case 166 /* PropertyAccessExpression */: + case 173 /* ElementAccessExpression */: + case 172 /* PropertyAccessExpression */: var member = initializer.parent; var currentType = getTypeOfSymbol(getSymbolOfNode(member.parent)); var enumType_1; - var propertyName; + var propertyName = void 0; if (e.kind === 69 /* Identifier */) { // unqualified names can refer to member that reside in different declaration of the enum so just doing name resolution won't work. // instead pick current enum type and later try to fetch member from the type @@ -26093,8 +29541,8 @@ var ts; propertyName = e.text; } else { - var expression; - if (e.kind === 167 /* ElementAccessExpression */) { + var expression = void 0; + if (e.kind === 173 /* ElementAccessExpression */) { if (e.argumentExpression === undefined || e.argumentExpression.kind !== 9 /* StringLiteral */) { return undefined; @@ -26112,7 +29560,7 @@ var ts; if (current.kind === 69 /* Identifier */) { break; } - else if (current.kind === 166 /* PropertyAccessExpression */) { + else if (current.kind === 172 /* PropertyAccessExpression */) { current = current.expression; } else { @@ -26157,6 +29605,7 @@ var ts; checkTypeNameIsReserved(node.name, ts.Diagnostics.Enum_name_cannot_be_0); checkCollisionWithCapturedThisVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); + checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); checkExportsOnMergedDeclarations(node); computeEnumMemberValues(node); var enumIsConst = ts.isConst(node); @@ -26180,10 +29629,10 @@ var ts; } }); } - var seenEnumMissingInitialInitializer = false; + var seenEnumMissingInitialInitializer_1 = false; ts.forEach(enumSymbol.declarations, function (declaration) { // return true if we hit a violation of the rule, false otherwise - if (declaration.kind !== 217 /* EnumDeclaration */) { + if (declaration.kind !== 224 /* EnumDeclaration */) { return false; } var enumDeclaration = declaration; @@ -26192,11 +29641,11 @@ var ts; } var firstEnumMember = enumDeclaration.members[0]; if (!firstEnumMember.initializer) { - if (seenEnumMissingInitialInitializer) { + if (seenEnumMissingInitialInitializer_1) { error(firstEnumMember.name, ts.Diagnostics.In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element); } else { - seenEnumMissingInitialInitializer = true; + seenEnumMissingInitialInitializer_1 = true; } } }); @@ -26206,8 +29655,8 @@ var ts; var declarations = symbol.declarations; for (var _i = 0, declarations_5 = declarations; _i < declarations_5.length; _i++) { var declaration = declarations_5[_i]; - if ((declaration.kind === 214 /* ClassDeclaration */ || - (declaration.kind === 213 /* FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) && + if ((declaration.kind === 221 /* ClassDeclaration */ || + (declaration.kind === 220 /* FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { return declaration; } @@ -26230,7 +29679,12 @@ var ts; function checkModuleDeclaration(node) { if (produceDiagnostics) { // Grammar checking - var isAmbientExternalModule = node.name.kind === 9 /* StringLiteral */; + var isGlobalAugmentation = ts.isGlobalScopeAugmentation(node); + var inAmbientContext = ts.isInAmbientContext(node); + if (isGlobalAugmentation && !inAmbientContext) { + error(node.name, ts.Diagnostics.Augmentations_for_the_global_scope_should_have_declare_modifier_unless_they_appear_in_already_ambient_context); + } + var isAmbientExternalModule = ts.isAmbientModule(node); var contextErrorMessage = isAmbientExternalModule ? ts.Diagnostics.An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file : ts.Diagnostics.A_namespace_declaration_is_only_allowed_in_a_namespace_or_module; @@ -26239,18 +29693,19 @@ var ts; return; } if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node)) { - if (!ts.isInAmbientContext(node) && node.name.kind === 9 /* StringLiteral */) { + if (!inAmbientContext && node.name.kind === 9 /* StringLiteral */) { grammarErrorOnNode(node.name, ts.Diagnostics.Only_ambient_modules_can_use_quoted_names); } } checkCollisionWithCapturedThisVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); + checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); // The following checks only apply on a non-ambient instantiated module declaration. if (symbol.flags & 512 /* ValueModule */ && symbol.declarations.length > 1 - && !ts.isInAmbientContext(node) + && !inAmbientContext && ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums || compilerOptions.isolatedModules)) { var firstNonAmbientClassOrFunc = getFirstNonAmbientClassOrFunctionDeclaration(symbol); if (firstNonAmbientClassOrFunc) { @@ -26263,30 +29718,109 @@ var ts; } // if the module merges with a class declaration in the same lexical scope, // we need to track this to ensure the correct emit. - var mergedClass = ts.getDeclarationOfKind(symbol, 214 /* ClassDeclaration */); + var mergedClass = ts.getDeclarationOfKind(symbol, 221 /* ClassDeclaration */); if (mergedClass && inSameLexicalScope(node, mergedClass)) { getNodeLinks(node).flags |= 32768 /* LexicalModuleMergesWithClass */; } } - // Checks for ambient external modules. if (isAmbientExternalModule) { - if (!isGlobalSourceFile(node.parent)) { - error(node.name, ts.Diagnostics.Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces); + if (ts.isExternalModuleAugmentation(node)) { + // body of the augmentation should be checked for consistency only if augmentation was applied to its target (either global scope or module) + // otherwise we'll be swamped in cascading errors. + // We can detect if augmentation was applied using following rules: + // - augmentation for a global scope is always applied + // - augmentation for some external module is applied if symbol for augmentation is merged (it was combined with target module). + var checkBody = isGlobalAugmentation || (getSymbolOfNode(node).flags & 33554432 /* Merged */); + if (checkBody) { + // body of ambient external module is always a module block + for (var _i = 0, _a = node.body.statements; _i < _a.length; _i++) { + var statement = _a[_i]; + checkModuleAugmentationElement(statement, isGlobalAugmentation); + } + } } - if (ts.isExternalModuleNameRelative(node.name.text)) { - error(node.name, ts.Diagnostics.Ambient_module_declaration_cannot_specify_relative_module_name); + else if (isGlobalSourceFile(node.parent)) { + if (isGlobalAugmentation) { + error(node.name, ts.Diagnostics.Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_declarations); + } + else if (ts.isExternalModuleNameRelative(node.name.text)) { + error(node.name, ts.Diagnostics.Ambient_module_declaration_cannot_specify_relative_module_name); + } + } + else { + if (isGlobalAugmentation) { + error(node.name, ts.Diagnostics.Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_declarations); + } + else { + // Node is not an augmentation and is not located on the script level. + // This means that this is declaration of ambient module that is located in other module or namespace which is prohibited. + error(node.name, ts.Diagnostics.Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces); + } } } } checkSourceElement(node.body); } + function checkModuleAugmentationElement(node, isGlobalAugmentation) { + switch (node.kind) { + case 200 /* VariableStatement */: + // error each individual name in variable statement instead of marking the entire variable statement + for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { + var decl = _a[_i]; + checkModuleAugmentationElement(decl, isGlobalAugmentation); + } + break; + case 235 /* ExportAssignment */: + case 236 /* ExportDeclaration */: + grammarErrorOnFirstToken(node, ts.Diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations); + break; + case 229 /* ImportEqualsDeclaration */: + case 230 /* ImportDeclaration */: + grammarErrorOnFirstToken(node, ts.Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module); + break; + case 169 /* BindingElement */: + case 218 /* VariableDeclaration */: + var name_18 = node.name; + if (ts.isBindingPattern(name_18)) { + for (var _b = 0, _c = name_18.elements; _b < _c.length; _b++) { + var el = _c[_b]; + // mark individual names in binding pattern + checkModuleAugmentationElement(el, isGlobalAugmentation); + } + break; + } + // fallthrough + case 221 /* ClassDeclaration */: + case 224 /* EnumDeclaration */: + case 220 /* FunctionDeclaration */: + case 222 /* InterfaceDeclaration */: + case 225 /* ModuleDeclaration */: + case 223 /* TypeAliasDeclaration */: + if (isGlobalAugmentation) { + return; + } + var symbol = getSymbolOfNode(node); + if (symbol) { + // module augmentations cannot introduce new names on the top level scope of the module + // this is done it two steps + // 1. quick check - if symbol for node is not merged - this is local symbol to this augmentation - report error + // 2. main check - report error if value declaration of the parent symbol is module augmentation) + var reportError = !(symbol.flags & 33554432 /* Merged */); + if (!reportError) { + // symbol should not originate in augmentation + reportError = ts.isExternalModuleAugmentation(symbol.parent.declarations[0]); + } + } + break; + } + } function getFirstIdentifier(node) { while (true) { - if (node.kind === 135 /* QualifiedName */) { + if (node.kind === 139 /* QualifiedName */) { node = node.left; } - else if (node.kind === 166 /* PropertyAccessExpression */) { + else if (node.kind === 172 /* PropertyAccessExpression */) { node = node.expression; } else { @@ -26302,20 +29836,24 @@ var ts; error(moduleName, ts.Diagnostics.String_literal_expected); return false; } - var inAmbientExternalModule = node.parent.kind === 219 /* ModuleBlock */ && node.parent.parent.name.kind === 9 /* StringLiteral */; - if (node.parent.kind !== 248 /* SourceFile */ && !inAmbientExternalModule) { - error(moduleName, node.kind === 228 /* ExportDeclaration */ ? + var inAmbientExternalModule = node.parent.kind === 226 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent); + if (node.parent.kind !== 256 /* SourceFile */ && !inAmbientExternalModule) { + error(moduleName, node.kind === 236 /* ExportDeclaration */ ? ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace : ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module); return false; } if (inAmbientExternalModule && ts.isExternalModuleNameRelative(moduleName.text)) { - // TypeScript 1.0 spec (April 2013): 12.1.6 - // An ExternalImportDeclaration in an AmbientExternalModuleDeclaration may reference - // other external modules only through top - level external module names. - // Relative external module names are not permitted. - error(node, ts.Diagnostics.Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relative_module_name); - return false; + // we have already reported errors on top level imports\exports in external module augmentations in checkModuleDeclaration + // no need to do this again. + if (!isTopLevelInExternalModuleAugmentation(node)) { + // TypeScript 1.0 spec (April 2013): 12.1.6 + // An ExternalImportDeclaration in an AmbientExternalModuleDeclaration may reference + // other external modules only through top - level external module names. + // Relative external module names are not permitted. + error(node, ts.Diagnostics.Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relative_module_name); + return false; + } } return true; } @@ -26323,11 +29861,17 @@ var ts; var symbol = getSymbolOfNode(node); var target = resolveAlias(symbol); if (target !== unknownSymbol) { - var excludedMeanings = (symbol.flags & 107455 /* Value */ ? 107455 /* Value */ : 0) | + // For external modules symbol represent local symbol for an alias. + // This local symbol will merge any other local declarations (excluding other aliases) + // and symbol.flags will contains combined representation for all merged declaration. + // Based on symbol.flags we can compute a set of excluded meanings (meaning that resolved alias should not have, + // otherwise it will conflict with some local declaration). Note that in addition to normal flags we include matching SymbolFlags.Export* + // in order to prevent collisions with declarations that were exported from the current module (they still contribute to local names). + var excludedMeanings = (symbol.flags & (107455 /* Value */ | 1048576 /* ExportValue */) ? 107455 /* Value */ : 0) | (symbol.flags & 793056 /* Type */ ? 793056 /* Type */ : 0) | (symbol.flags & 1536 /* Namespace */ ? 1536 /* Namespace */ : 0); if (target.flags & excludedMeanings) { - var message = node.kind === 230 /* ExportSpecifier */ ? + var message = node.kind === 238 /* ExportSpecifier */ ? ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0; error(node, message, symbolToString(symbol)); @@ -26337,6 +29881,7 @@ var ts; function checkImportBinding(node) { checkCollisionWithCapturedThisVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); + checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); checkAliasSymbol(node); } function checkImportDeclaration(node) { @@ -26344,7 +29889,7 @@ var ts; // If we hit an import declaration in an illegal context, just bail out to avoid cascading errors. return; } - if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && (node.flags & 1022 /* Modifier */)) { + if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && (node.flags & 1023 /* Modifier */)) { grammarErrorOnFirstToken(node, ts.Diagnostics.An_import_declaration_cannot_have_modifiers); } if (checkExternalImportOrExportDeclaration(node)) { @@ -26354,7 +29899,7 @@ var ts; checkImportBinding(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 224 /* NamespaceImport */) { + if (importClause.namedBindings.kind === 232 /* NamespaceImport */) { checkImportBinding(importClause.namedBindings); } else { @@ -26372,7 +29917,7 @@ var ts; checkGrammarDecorators(node) || checkGrammarModifiers(node); if (ts.isInternalModuleImportEqualsDeclaration(node) || checkExternalImportOrExportDeclaration(node)) { checkImportBinding(node); - if (node.flags & 2 /* Export */) { + if (node.flags & 1 /* Export */) { markExportAsReferenced(node); } if (ts.isInternalModuleImportEqualsDeclaration(node)) { @@ -26391,7 +29936,7 @@ var ts; } } else { - if (modulekind === 5 /* ES6 */ && !ts.isInAmbientContext(node)) { + if (modulekind === ts.ModuleKind.ES6 && !ts.isInAmbientContext(node)) { // Import equals declaration is deprecated in es6 or above grammarErrorOnNode(node, ts.Diagnostics.Import_assignment_cannot_be_used_when_targeting_ECMAScript_6_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead); } @@ -26403,7 +29948,7 @@ var ts; // If we hit an export in an illegal context, just bail out to avoid cascading errors. return; } - if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && (node.flags & 1022 /* Modifier */)) { + if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && (node.flags & 1023 /* Modifier */)) { grammarErrorOnFirstToken(node, ts.Diagnostics.An_export_declaration_cannot_have_modifiers); } if (!node.moduleSpecifier || checkExternalImportOrExportDeclaration(node)) { @@ -26411,29 +29956,38 @@ var ts; // export { x, y } // export { x, y } from "foo" ts.forEach(node.exportClause.elements, checkExportSpecifier); - var inAmbientExternalModule = node.parent.kind === 219 /* ModuleBlock */ && node.parent.parent.name.kind === 9 /* StringLiteral */; - if (node.parent.kind !== 248 /* SourceFile */ && !inAmbientExternalModule) { + var inAmbientExternalModule = node.parent.kind === 226 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent); + if (node.parent.kind !== 256 /* SourceFile */ && !inAmbientExternalModule) { error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace); } } else { // export * from "foo" var moduleSymbol = resolveExternalModuleName(node, node.moduleSpecifier); - if (moduleSymbol && moduleSymbol.exports["export="]) { + if (moduleSymbol && hasExportAssignmentSymbol(moduleSymbol)) { error(node.moduleSpecifier, ts.Diagnostics.Module_0_uses_export_and_cannot_be_used_with_export_Asterisk, symbolToString(moduleSymbol)); } } } } function checkGrammarModuleElementContext(node, errorMessage) { - if (node.parent.kind !== 248 /* SourceFile */ && node.parent.kind !== 219 /* ModuleBlock */ && node.parent.kind !== 218 /* ModuleDeclaration */) { + if (node.parent.kind !== 256 /* SourceFile */ && node.parent.kind !== 226 /* ModuleBlock */ && node.parent.kind !== 225 /* ModuleDeclaration */) { return grammarErrorOnFirstToken(node, errorMessage); } } function checkExportSpecifier(node) { checkAliasSymbol(node); if (!node.parent.parent.moduleSpecifier) { - markExportAsReferenced(node); + var exportedName = node.propertyName || node.name; + // find immediate value referenced by exported name (SymbolFlags.Alias is set so we don't chase down aliases) + var symbol = resolveName(exportedName, exportedName.text, 107455 /* Value */ | 793056 /* Type */ | 1536 /* Namespace */ | 8388608 /* Alias */, + /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined); + if (symbol && (symbol === undefinedSymbol || isGlobalSourceFile(getDeclarationContainer(symbol.declarations[0])))) { + error(exportedName, ts.Diagnostics.Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module, exportedName.text); + } + else { + markExportAsReferenced(node); + } } } function checkExportAssignment(node) { @@ -26441,13 +29995,13 @@ var ts; // If we hit an export assignment in an illegal context, just bail out to avoid cascading errors. return; } - var container = node.parent.kind === 248 /* SourceFile */ ? node.parent : node.parent.parent; - if (container.kind === 218 /* ModuleDeclaration */ && container.name.kind === 69 /* Identifier */) { + var container = node.parent.kind === 256 /* SourceFile */ ? node.parent : node.parent.parent; + if (container.kind === 225 /* ModuleDeclaration */ && !ts.isAmbientModule(container)) { error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); return; } // Grammar checking - if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && (node.flags & 1022 /* Modifier */)) { + if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && (node.flags & 1023 /* Modifier */)) { grammarErrorOnFirstToken(node, ts.Diagnostics.An_export_assignment_cannot_have_modifiers); } if (node.expression.kind === 69 /* Identifier */) { @@ -26458,25 +30012,16 @@ var ts; } checkExternalModuleExports(container); if (node.isExportEquals && !ts.isInAmbientContext(node)) { - if (modulekind === 5 /* ES6 */) { + if (modulekind === ts.ModuleKind.ES6) { // export assignment is not supported in es6 modules grammarErrorOnNode(node, ts.Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_6_modules_Consider_using_export_default_or_another_module_format_instead); } - else if (modulekind === 4 /* System */) { + else if (modulekind === ts.ModuleKind.System) { // system modules does not support export assignment grammarErrorOnNode(node, ts.Diagnostics.Export_assignment_is_not_supported_when_module_flag_is_system); } } } - function getModuleStatements(node) { - if (node.kind === 248 /* SourceFile */) { - return node.statements; - } - if (node.kind === 218 /* ModuleDeclaration */ && node.body.kind === 219 /* ModuleBlock */) { - return node.body.statements; - } - return emptyArray; - } function hasExportedMembers(moduleSymbol) { for (var id in moduleSymbol.exports) { if (id !== "export=") { @@ -26492,14 +30037,41 @@ var ts; var exportEqualsSymbol = moduleSymbol.exports["export="]; if (exportEqualsSymbol && hasExportedMembers(moduleSymbol)) { var declaration = getDeclarationOfAliasSymbol(exportEqualsSymbol) || exportEqualsSymbol.valueDeclaration; - error(declaration, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements); + if (!isTopLevelInExternalModuleAugmentation(declaration)) { + error(declaration, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements); + } + } + // Checks for export * conflicts + var exports = getExportsOfModule(moduleSymbol); + for (var id in exports) { + if (id === "__export") { + continue; + } + var _a = exports[id], declarations = _a.declarations, flags = _a.flags; + // ECMA262: 15.2.1.1 It is a Syntax Error if the ExportedNames of ModuleItemList contains any duplicate entries. + // (TS Exceptions: namespaces, function overloads, enums, and interfaces) + if (flags & (1536 /* Namespace */ | 64 /* Interface */ | 384 /* Enum */)) { + continue; + } + var exportedDeclarationsCount = ts.countWhere(declarations, isNotOverload); + if (flags & 524288 /* TypeAlias */ && exportedDeclarationsCount <= 2) { + // it is legal to merge type alias with other values + // so count should be either 1 (just type alias) or 2 (type alias + merged value) + continue; + } + if (exportedDeclarationsCount > 1) { + for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) { + var declaration = declarations_6[_i]; + if (isNotOverload(declaration)) { + diagnostics.add(ts.createDiagnosticForNode(declaration, ts.Diagnostics.Cannot_redeclare_exported_variable_0, id)); + } + } + } } links.exportsChecked = true; } - } - function checkTypePredicate(node) { - if (!isInLegalTypePredicatePosition(node)) { - error(node, ts.Diagnostics.A_type_predicate_is_only_allowed_in_return_type_position_for_functions_and_methods); + function isNotOverload(declaration) { + return declaration.kind !== 220 /* FunctionDeclaration */ || !!declaration.body; } } function checkSourceElement(node) { @@ -26508,121 +30080,121 @@ var ts; } var kind = node.kind; if (cancellationToken) { - // Only bother checking on a few construct kinds. We don't want to be excessivly + // Only bother checking on a few construct kinds. We don't want to be excessively // hitting the cancellation token on every node we check. switch (kind) { - case 218 /* ModuleDeclaration */: - case 214 /* ClassDeclaration */: - case 215 /* InterfaceDeclaration */: - case 213 /* FunctionDeclaration */: + case 225 /* ModuleDeclaration */: + case 221 /* ClassDeclaration */: + case 222 /* InterfaceDeclaration */: + case 220 /* FunctionDeclaration */: cancellationToken.throwIfCancellationRequested(); } } switch (kind) { - case 137 /* TypeParameter */: + case 141 /* TypeParameter */: return checkTypeParameter(node); - case 138 /* Parameter */: + case 142 /* Parameter */: return checkParameter(node); - case 141 /* PropertyDeclaration */: - case 140 /* PropertySignature */: + case 145 /* PropertyDeclaration */: + case 144 /* PropertySignature */: return checkPropertyDeclaration(node); - case 152 /* FunctionType */: - case 153 /* ConstructorType */: - case 147 /* CallSignature */: - case 148 /* ConstructSignature */: + case 156 /* FunctionType */: + case 157 /* ConstructorType */: + case 151 /* CallSignature */: + case 152 /* ConstructSignature */: return checkSignatureDeclaration(node); - case 149 /* IndexSignature */: + case 153 /* IndexSignature */: return checkSignatureDeclaration(node); - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: return checkMethodDeclaration(node); - case 144 /* Constructor */: + case 148 /* Constructor */: return checkConstructorDeclaration(node); - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: return checkAccessorDeclaration(node); - case 151 /* TypeReference */: + case 155 /* TypeReference */: return checkTypeReferenceNode(node); - case 150 /* TypePredicate */: + case 154 /* TypePredicate */: return checkTypePredicate(node); - case 154 /* TypeQuery */: + case 158 /* TypeQuery */: return checkTypeQuery(node); - case 155 /* TypeLiteral */: + case 159 /* TypeLiteral */: return checkTypeLiteral(node); - case 156 /* ArrayType */: + case 160 /* ArrayType */: return checkArrayType(node); - case 157 /* TupleType */: + case 161 /* TupleType */: return checkTupleType(node); - case 158 /* UnionType */: - case 159 /* IntersectionType */: + case 162 /* UnionType */: + case 163 /* IntersectionType */: return checkUnionOrIntersectionType(node); - case 160 /* ParenthesizedType */: + case 164 /* ParenthesizedType */: return checkSourceElement(node.type); - case 213 /* FunctionDeclaration */: + case 220 /* FunctionDeclaration */: return checkFunctionDeclaration(node); - case 192 /* Block */: - case 219 /* ModuleBlock */: + case 199 /* Block */: + case 226 /* ModuleBlock */: return checkBlock(node); - case 193 /* VariableStatement */: + case 200 /* VariableStatement */: return checkVariableStatement(node); - case 195 /* ExpressionStatement */: + case 202 /* ExpressionStatement */: return checkExpressionStatement(node); - case 196 /* IfStatement */: + case 203 /* IfStatement */: return checkIfStatement(node); - case 197 /* DoStatement */: + case 204 /* DoStatement */: return checkDoStatement(node); - case 198 /* WhileStatement */: + case 205 /* WhileStatement */: return checkWhileStatement(node); - case 199 /* ForStatement */: + case 206 /* ForStatement */: return checkForStatement(node); - case 200 /* ForInStatement */: + case 207 /* ForInStatement */: return checkForInStatement(node); - case 201 /* ForOfStatement */: + case 208 /* ForOfStatement */: return checkForOfStatement(node); - case 202 /* ContinueStatement */: - case 203 /* BreakStatement */: + case 209 /* ContinueStatement */: + case 210 /* BreakStatement */: return checkBreakOrContinueStatement(node); - case 204 /* ReturnStatement */: + case 211 /* ReturnStatement */: return checkReturnStatement(node); - case 205 /* WithStatement */: + case 212 /* WithStatement */: return checkWithStatement(node); - case 206 /* SwitchStatement */: + case 213 /* SwitchStatement */: return checkSwitchStatement(node); - case 207 /* LabeledStatement */: + case 214 /* LabeledStatement */: return checkLabeledStatement(node); - case 208 /* ThrowStatement */: + case 215 /* ThrowStatement */: return checkThrowStatement(node); - case 209 /* TryStatement */: + case 216 /* TryStatement */: return checkTryStatement(node); - case 211 /* VariableDeclaration */: + case 218 /* VariableDeclaration */: return checkVariableDeclaration(node); - case 163 /* BindingElement */: + case 169 /* BindingElement */: return checkBindingElement(node); - case 214 /* ClassDeclaration */: + case 221 /* ClassDeclaration */: return checkClassDeclaration(node); - case 215 /* InterfaceDeclaration */: + case 222 /* InterfaceDeclaration */: return checkInterfaceDeclaration(node); - case 216 /* TypeAliasDeclaration */: + case 223 /* TypeAliasDeclaration */: return checkTypeAliasDeclaration(node); - case 217 /* EnumDeclaration */: + case 224 /* EnumDeclaration */: return checkEnumDeclaration(node); - case 218 /* ModuleDeclaration */: + case 225 /* ModuleDeclaration */: return checkModuleDeclaration(node); - case 222 /* ImportDeclaration */: + case 230 /* ImportDeclaration */: return checkImportDeclaration(node); - case 221 /* ImportEqualsDeclaration */: + case 229 /* ImportEqualsDeclaration */: return checkImportEqualsDeclaration(node); - case 228 /* ExportDeclaration */: + case 236 /* ExportDeclaration */: return checkExportDeclaration(node); - case 227 /* ExportAssignment */: + case 235 /* ExportAssignment */: return checkExportAssignment(node); - case 194 /* EmptyStatement */: + case 201 /* EmptyStatement */: checkGrammarStatementInAmbientContext(node); return; - case 210 /* DebuggerStatement */: + case 217 /* DebuggerStatement */: checkGrammarStatementInAmbientContext(node); return; - case 231 /* MissingDeclaration */: + case 239 /* MissingDeclaration */: return checkMissingDeclaration(node); } } @@ -26635,102 +30207,29 @@ var ts; // Here, performing a full type check of the body of the function expression whilst in the process of // determining the type of foo would cause foo to be given type any because of the recursive reference. // Delaying the type check of the body ensures foo has been assigned a type. - function checkFunctionAndClassExpressionBodies(node) { - switch (node.kind) { - case 173 /* FunctionExpression */: - case 174 /* ArrowFunction */: - ts.forEach(node.parameters, checkFunctionAndClassExpressionBodies); - checkFunctionExpressionOrObjectLiteralMethodBody(node); - break; - case 186 /* ClassExpression */: - ts.forEach(node.members, checkSourceElement); - ts.forEachChild(node, checkFunctionAndClassExpressionBodies); - break; - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - ts.forEach(node.decorators, checkFunctionAndClassExpressionBodies); - ts.forEach(node.parameters, checkFunctionAndClassExpressionBodies); - if (ts.isObjectLiteralMethod(node)) { - checkFunctionExpressionOrObjectLiteralMethodBody(node); - } - break; - case 144 /* Constructor */: - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: - case 213 /* FunctionDeclaration */: - ts.forEach(node.parameters, checkFunctionAndClassExpressionBodies); - break; - case 205 /* WithStatement */: - checkFunctionAndClassExpressionBodies(node.expression); - break; - case 139 /* Decorator */: - case 138 /* Parameter */: - case 141 /* PropertyDeclaration */: - case 140 /* PropertySignature */: - case 161 /* ObjectBindingPattern */: - case 162 /* ArrayBindingPattern */: - case 163 /* BindingElement */: - case 164 /* ArrayLiteralExpression */: - case 165 /* ObjectLiteralExpression */: - case 245 /* PropertyAssignment */: - case 166 /* PropertyAccessExpression */: - case 167 /* ElementAccessExpression */: - case 168 /* CallExpression */: - case 169 /* NewExpression */: - case 170 /* TaggedTemplateExpression */: - case 183 /* TemplateExpression */: - case 190 /* TemplateSpan */: - case 171 /* TypeAssertionExpression */: - case 189 /* AsExpression */: - case 172 /* ParenthesizedExpression */: - case 176 /* TypeOfExpression */: - case 177 /* VoidExpression */: - case 178 /* AwaitExpression */: - case 175 /* DeleteExpression */: - case 179 /* PrefixUnaryExpression */: - case 180 /* PostfixUnaryExpression */: - case 181 /* BinaryExpression */: - case 182 /* ConditionalExpression */: - case 185 /* SpreadElementExpression */: - case 184 /* YieldExpression */: - case 192 /* Block */: - case 219 /* ModuleBlock */: - case 193 /* VariableStatement */: - case 195 /* ExpressionStatement */: - case 196 /* IfStatement */: - case 197 /* DoStatement */: - case 198 /* WhileStatement */: - case 199 /* ForStatement */: - case 200 /* ForInStatement */: - case 201 /* ForOfStatement */: - case 202 /* ContinueStatement */: - case 203 /* BreakStatement */: - case 204 /* ReturnStatement */: - case 206 /* SwitchStatement */: - case 220 /* CaseBlock */: - case 241 /* CaseClause */: - case 242 /* DefaultClause */: - case 207 /* LabeledStatement */: - case 208 /* ThrowStatement */: - case 209 /* TryStatement */: - case 244 /* CatchClause */: - case 211 /* VariableDeclaration */: - case 212 /* VariableDeclarationList */: - case 214 /* ClassDeclaration */: - case 243 /* HeritageClause */: - case 188 /* ExpressionWithTypeArguments */: - case 217 /* EnumDeclaration */: - case 247 /* EnumMember */: - case 227 /* ExportAssignment */: - case 248 /* SourceFile */: - case 240 /* JsxExpression */: - case 233 /* JsxElement */: - case 234 /* JsxSelfClosingElement */: - case 238 /* JsxAttribute */: - case 239 /* JsxSpreadAttribute */: - case 235 /* JsxOpeningElement */: - ts.forEachChild(node, checkFunctionAndClassExpressionBodies); - break; + function checkNodeDeferred(node) { + if (deferredNodes) { + deferredNodes.push(node); + } + } + function checkDeferredNodes() { + for (var _i = 0, deferredNodes_1 = deferredNodes; _i < deferredNodes_1.length; _i++) { + var node = deferredNodes_1[_i]; + switch (node.kind) { + case 179 /* FunctionExpression */: + case 180 /* ArrowFunction */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: + checkFunctionExpressionOrObjectLiteralMethodDeferred(node); + break; + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: + checkAccessorDeferred(node); + break; + case 192 /* ClassExpression */: + checkClassExpressionDeferred(node); + break; + } } } function checkSourceFile(node) { @@ -26753,12 +30252,11 @@ var ts; } // Grammar checking checkGrammarSourceFile(node); - emitExtends = false; - emitDecorate = false; - emitParam = false; potentialThisCollisions.length = 0; + deferredNodes = []; ts.forEach(node.statements, checkSourceElement); - checkFunctionAndClassExpressionBodies(node); + checkDeferredNodes(); + deferredNodes = undefined; if (ts.isExternalOrCommonJsModule(node)) { checkExternalModuleExports(node); } @@ -26766,21 +30264,6 @@ var ts; ts.forEach(potentialThisCollisions, checkIfThisIsCapturedInEnclosingScope); potentialThisCollisions.length = 0; } - if (emitExtends) { - links.flags |= 8 /* EmitExtends */; - } - if (emitDecorate) { - links.flags |= 16 /* EmitDecorate */; - } - if (emitParam) { - links.flags |= 32 /* EmitParam */; - } - if (emitAwaiter) { - links.flags |= 64 /* EmitAwaiter */; - } - if (emitGenerator || (emitAwaiter && languageVersion < 2 /* ES6 */)) { - links.flags |= 128 /* EmitGenerator */; - } links.flags |= 1 /* TypeChecked */; } } @@ -26818,7 +30301,7 @@ var ts; function isInsideWithStatementBody(node) { if (node) { while (node.parent) { - if (node.parent.kind === 205 /* WithStatement */ && node.parent.statement === node) { + if (node.parent.kind === 212 /* WithStatement */ && node.parent.statement === node) { return true; } node = node.parent; @@ -26841,34 +30324,34 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 248 /* SourceFile */: + case 256 /* SourceFile */: if (!ts.isExternalOrCommonJsModule(location)) { break; } - case 218 /* ModuleDeclaration */: + case 225 /* ModuleDeclaration */: copySymbols(getSymbolOfNode(location).exports, meaning & 8914931 /* ModuleMember */); break; - case 217 /* EnumDeclaration */: + case 224 /* EnumDeclaration */: copySymbols(getSymbolOfNode(location).exports, meaning & 8 /* EnumMember */); break; - case 186 /* ClassExpression */: + case 192 /* ClassExpression */: var className = location.name; if (className) { copySymbol(location.symbol, meaning); } // fall through; this fall-through is necessary because we would like to handle // type parameter inside class expression similar to how we handle it in classDeclaration and interface Declaration - case 214 /* ClassDeclaration */: - case 215 /* InterfaceDeclaration */: + case 221 /* ClassDeclaration */: + case 222 /* InterfaceDeclaration */: // If we didn't come from static member of class or interface, // add the type parameters into the symbol table // (type parameters of classDeclaration/classExpression and interface are in member property of the symbol. // Note: that the memberFlags come from previous iteration. - if (!(memberFlags & 64 /* Static */)) { + if (!(memberFlags & 32 /* Static */)) { copySymbols(getSymbolOfNode(location).members, meaning & 793056 /* Type */); } break; - case 173 /* FunctionExpression */: + case 179 /* FunctionExpression */: var funcName = location.name; if (funcName) { copySymbol(location.symbol, meaning); @@ -26917,37 +30400,51 @@ var ts; } function isTypeDeclaration(node) { switch (node.kind) { - case 137 /* TypeParameter */: - case 214 /* ClassDeclaration */: - case 215 /* InterfaceDeclaration */: - case 216 /* TypeAliasDeclaration */: - case 217 /* EnumDeclaration */: + case 141 /* TypeParameter */: + case 221 /* ClassDeclaration */: + case 222 /* InterfaceDeclaration */: + case 223 /* TypeAliasDeclaration */: + case 224 /* EnumDeclaration */: return true; } } // True if the given identifier is part of a type reference function isTypeReferenceIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 135 /* QualifiedName */) { + while (node.parent && node.parent.kind === 139 /* QualifiedName */) { node = node.parent; } - return node.parent && node.parent.kind === 151 /* TypeReference */; + return node.parent && node.parent.kind === 155 /* TypeReference */; } function isHeritageClauseElementIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 166 /* PropertyAccessExpression */) { + while (node.parent && node.parent.kind === 172 /* PropertyAccessExpression */) { node = node.parent; } - return node.parent && node.parent.kind === 188 /* ExpressionWithTypeArguments */; + return node.parent && node.parent.kind === 194 /* ExpressionWithTypeArguments */; + } + function forEachEnclosingClass(node, callback) { + var result; + while (true) { + node = ts.getContainingClass(node); + if (!node) + break; + if (result = callback(node)) + break; + } + return result; + } + function isNodeWithinClass(node, classDeclaration) { + return !!forEachEnclosingClass(node, function (n) { return n === classDeclaration; }); } function getLeftSideOfImportEqualsOrExportAssignment(nodeOnRightSide) { - while (nodeOnRightSide.parent.kind === 135 /* QualifiedName */) { + while (nodeOnRightSide.parent.kind === 139 /* QualifiedName */) { nodeOnRightSide = nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 221 /* ImportEqualsDeclaration */) { + if (nodeOnRightSide.parent.kind === 229 /* ImportEqualsDeclaration */) { return nodeOnRightSide.parent.moduleReference === nodeOnRightSide && nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 227 /* ExportAssignment */) { + if (nodeOnRightSide.parent.kind === 235 /* ExportAssignment */) { return nodeOnRightSide.parent.expression === nodeOnRightSide && nodeOnRightSide.parent; } return undefined; @@ -26959,11 +30456,23 @@ var ts; if (ts.isDeclarationName(entityName)) { return getSymbolOfNode(entityName.parent); } - if (entityName.parent.kind === 227 /* ExportAssignment */) { + if (ts.isInJavaScriptFile(entityName) && entityName.parent.kind === 172 /* PropertyAccessExpression */) { + var specialPropertyAssignmentKind = ts.getSpecialPropertyAssignmentKind(entityName.parent.parent); + switch (specialPropertyAssignmentKind) { + case 1 /* ExportsProperty */: + case 3 /* PrototypeProperty */: + return getSymbolOfNode(entityName.parent); + case 4 /* ThisProperty */: + case 2 /* ModuleExports */: + return getSymbolOfNode(entityName.parent.parent); + default: + } + } + if (entityName.parent.kind === 235 /* ExportAssignment */) { return resolveEntityName(entityName, /*all meanings*/ 107455 /* Value */ | 793056 /* Type */ | 1536 /* Namespace */ | 8388608 /* Alias */); } - if (entityName.kind !== 166 /* PropertyAccessExpression */) { + if (entityName.kind !== 172 /* PropertyAccessExpression */) { if (isInRightSideOfImportOrExportAssignment(entityName)) { // Since we already checked for ExportAssignment, this really could only be an Import return getSymbolOfPartOfRightHandSideOfImportEquals(entityName); @@ -26975,7 +30484,7 @@ var ts; if (isHeritageClauseElementIdentifier(entityName)) { var meaning = 0 /* None */; // In an interface or class, we're definitely interested in a type. - if (entityName.parent.kind === 188 /* ExpressionWithTypeArguments */) { + if (entityName.parent.kind === 194 /* ExpressionWithTypeArguments */) { meaning = 793056 /* Type */; // In a class 'extends' clause we are also looking for a value. if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) { @@ -26988,30 +30497,28 @@ var ts; meaning |= 8388608 /* Alias */; return resolveEntityName(entityName, meaning); } - else if ((entityName.parent.kind === 235 /* JsxOpeningElement */) || - (entityName.parent.kind === 234 /* JsxSelfClosingElement */) || - (entityName.parent.kind === 237 /* JsxClosingElement */)) { - return getJsxElementTagSymbol(entityName.parent); - } else if (ts.isExpression(entityName)) { if (ts.nodeIsMissing(entityName)) { // Missing entity name. return undefined; } if (entityName.kind === 69 /* Identifier */) { + if (ts.isJSXTagName(entityName) && isJsxIntrinsicIdentifier(entityName)) { + return getIntrinsicTagSymbol(entityName.parent); + } // Include aliases in the meaning, this ensures that we do not follow aliases to where they point and instead // return the alias symbol. var meaning = 107455 /* Value */ | 8388608 /* Alias */; return resolveEntityName(entityName, meaning); } - else if (entityName.kind === 166 /* PropertyAccessExpression */) { + else if (entityName.kind === 172 /* PropertyAccessExpression */) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkPropertyAccessExpression(entityName); } return getNodeLinks(entityName).resolvedSymbol; } - else if (entityName.kind === 135 /* QualifiedName */) { + else if (entityName.kind === 139 /* QualifiedName */) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkQualifiedName(entityName); @@ -27020,22 +30527,25 @@ var ts; } } else if (isTypeReferenceIdentifier(entityName)) { - var meaning = entityName.parent.kind === 151 /* TypeReference */ ? 793056 /* Type */ : 1536 /* Namespace */; + var meaning = entityName.parent.kind === 155 /* TypeReference */ ? 793056 /* Type */ : 1536 /* Namespace */; // Include aliases in the meaning, this ensures that we do not follow aliases to where they point and instead // return the alias symbol. meaning |= 8388608 /* Alias */; return resolveEntityName(entityName, meaning); } - else if (entityName.parent.kind === 238 /* JsxAttribute */) { + else if (entityName.parent.kind === 246 /* JsxAttribute */) { return getJsxAttributePropertySymbol(entityName.parent); } - if (entityName.parent.kind === 150 /* TypePredicate */) { + if (entityName.parent.kind === 154 /* TypePredicate */) { return resolveEntityName(entityName, /*meaning*/ 1 /* FunctionScopedVariable */); } // Do we want to return undefined here? return undefined; } function getSymbolAtLocation(node) { + if (node.kind === 256 /* SourceFile */) { + return ts.isExternalModule(node) ? getMergedSymbol(node.symbol) : undefined; + } if (isInsideWithStatementBody(node)) { // We cannot answer semantic questions within a with block, do not proceed any further return undefined; @@ -27044,14 +30554,17 @@ var ts; // This is a declaration, call getSymbolOfNode return getSymbolOfNode(node.parent); } + else if (ts.isLiteralComputedPropertyDeclarationName(node)) { + return getSymbolOfNode(node.parent.parent); + } if (node.kind === 69 /* Identifier */) { if (isInRightSideOfImportOrExportAssignment(node)) { - return node.parent.kind === 227 /* ExportAssignment */ + return node.parent.kind === 235 /* ExportAssignment */ ? getSymbolOfEntityNameOrPropertyAccessExpression(node) : getSymbolOfPartOfRightHandSideOfImportEquals(node); } - else if (node.parent.kind === 163 /* BindingElement */ && - node.parent.parent.kind === 161 /* ObjectBindingPattern */ && + else if (node.parent.kind === 169 /* BindingElement */ && + node.parent.parent.kind === 167 /* ObjectBindingPattern */ && node === node.parent.propertyName) { var typeOfPattern = getTypeOfNode(node.parent.parent); var propertyDeclaration = typeOfPattern && getPropertyOfType(typeOfPattern, node.text); @@ -27062,17 +30575,19 @@ var ts; } switch (node.kind) { case 69 /* Identifier */: - case 166 /* PropertyAccessExpression */: - case 135 /* QualifiedName */: + case 172 /* PropertyAccessExpression */: + case 139 /* QualifiedName */: return getSymbolOfEntityNameOrPropertyAccessExpression(node); case 97 /* ThisKeyword */: case 95 /* SuperKeyword */: var type = ts.isExpression(node) ? checkExpression(node) : getTypeFromTypeNode(node); return type.symbol; + case 165 /* ThisType */: + return getTypeFromTypeNode(node).symbol; case 121 /* ConstructorKeyword */: // constructor keyword for an overload, should take us to the definition if it exist var constructorDeclaration = node.parent; - if (constructorDeclaration && constructorDeclaration.kind === 144 /* Constructor */) { + if (constructorDeclaration && constructorDeclaration.kind === 148 /* Constructor */) { return constructorDeclaration.parent.symbol; } return undefined; @@ -27080,14 +30595,14 @@ var ts; // External module name in an import declaration if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || - ((node.parent.kind === 222 /* ImportDeclaration */ || node.parent.kind === 228 /* ExportDeclaration */) && + ((node.parent.kind === 230 /* ImportDeclaration */ || node.parent.kind === 236 /* ExportDeclaration */) && node.parent.moduleSpecifier === node)) { return resolveExternalModuleName(node, node); } // Fall through case 8 /* NumericLiteral */: // index access - if (node.parent.kind === 167 /* ElementAccessExpression */ && node.parent.argumentExpression === node) { + if (node.parent.kind === 173 /* ElementAccessExpression */ && node.parent.argumentExpression === node) { var objectType = checkExpression(node.parent.expression); if (objectType === unknownType) return undefined; @@ -27104,11 +30619,17 @@ var ts; // The function returns a value 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. - if (location && location.kind === 246 /* ShorthandPropertyAssignment */) { - return resolveEntityName(location.name, 107455 /* Value */); + if (location && location.kind === 254 /* ShorthandPropertyAssignment */) { + return resolveEntityName(location.name, 107455 /* Value */ | 8388608 /* Alias */); } return undefined; } + /** Returns the target of an export specifier without following aliases */ + function getExportSpecifierLocalTargetSymbol(node) { + return node.parent.parent.moduleSpecifier ? + getExternalModuleMember(node.parent.parent, node) : + resolveEntityName(node.propertyName || node.name, 107455 /* Value */ | 793056 /* Type */ | 1536 /* Namespace */ | 8388608 /* Alias */); + } function getTypeOfNode(node) { if (isInsideWithStatementBody(node)) { // We cannot answer semantic questions within a with block, do not proceed any further @@ -27153,6 +30674,51 @@ var ts; } return unknownType; } + // Gets the type of object literal or array literal of destructuring assignment. + // { a } from + // for ( { a } of elems) { + // } + // [ a ] from + // [a] = [ some array ...] + function getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr) { + ts.Debug.assert(expr.kind === 171 /* ObjectLiteralExpression */ || expr.kind === 170 /* ArrayLiteralExpression */); + // If this is from "for of" + // for ( { a } of elems) { + // } + if (expr.parent.kind === 208 /* ForOfStatement */) { + var iteratedType = checkRightHandSideOfForOf(expr.parent.expression); + return checkDestructuringAssignment(expr, iteratedType || unknownType); + } + // If this is from "for" initializer + // for ({a } = elems[0];.....) { } + if (expr.parent.kind === 187 /* BinaryExpression */) { + var iteratedType = checkExpression(expr.parent.right); + return checkDestructuringAssignment(expr, iteratedType || unknownType); + } + // If this is from nested object binding pattern + // for ({ skills: { primary, secondary } } = multiRobot, i = 0; i < 1; i++) { + if (expr.parent.kind === 253 /* PropertyAssignment */) { + var typeOfParentObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent.parent); + return checkObjectLiteralDestructuringPropertyAssignment(typeOfParentObjectLiteral || unknownType, expr.parent); + } + // Array literal assignment - array destructuring pattern + ts.Debug.assert(expr.parent.kind === 170 /* ArrayLiteralExpression */); + // [{ property1: p1, property2 }] = elems; + var typeOfArrayLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent); + var elementType = checkIteratedTypeOrElementType(typeOfArrayLiteral || unknownType, expr.parent, /*allowStringInput*/ false) || unknownType; + return checkArrayLiteralDestructuringElementAssignment(expr.parent, typeOfArrayLiteral, ts.indexOf(expr.parent.elements, expr), elementType || unknownType); + } + // Gets the property symbol corresponding to the property in destructuring assignment + // 'property1' from + // for ( { property1: a } of elems) { + // } + // 'property1' at location 'a' from: + // [a] = [ property1, property2 ] + function getPropertySymbolOfDestructuringAssignment(location) { + // Get the type of the object or array literal and then look for property of given name in the type + var typeOfObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(location.parent.parent); + return typeOfObjectLiteral && getPropertyOfType(typeOfObjectLiteral, location.text); + } function getTypeOfExpression(expr) { if (ts.isRightSideOfQualifiedNameOrPropertyAccess(expr)) { expr = expr.parent; @@ -27165,7 +30731,7 @@ var ts; */ function getParentTypeOfClassElement(node) { var classSymbol = getSymbolOfNode(node.parent); - return node.flags & 64 /* Static */ + return node.flags & 32 /* Static */ ? getTypeOfSymbol(classSymbol) : getDeclaredTypeOfSymbol(classSymbol); } @@ -27185,18 +30751,22 @@ var ts; } function getRootSymbols(symbol) { if (symbol.flags & 268435456 /* SyntheticProperty */) { - var symbols = []; - var name_15 = symbol.name; + var symbols_3 = []; + var name_19 = symbol.name; ts.forEach(getSymbolLinks(symbol).containingType.types, function (t) { - var symbol = getPropertyOfType(t, name_15); + var symbol = getPropertyOfType(t, name_19); if (symbol) { - symbols.push(symbol); + symbols_3.push(symbol); } }); - return symbols; + return symbols_3; } else if (symbol.flags & 67108864 /* Transient */) { - var target = getSymbolLinks(symbol).target; + var target = void 0; + var next = symbol; + while (next = getSymbolLinks(next).target) { + target = next; + } if (target) { return [target]; } @@ -27207,6 +30777,30 @@ var ts; function isArgumentsLocalBinding(node) { return getReferencedValueSymbol(node) === argumentsSymbol; } + function moduleExportsSomeValue(moduleReferenceExpression) { + var moduleSymbol = resolveExternalModuleName(moduleReferenceExpression.parent, moduleReferenceExpression); + if (!moduleSymbol) { + // module not found - be conservative + return true; + } + var hasExportAssignment = hasExportAssignmentSymbol(moduleSymbol); + // if module has export assignment then 'resolveExternalModuleSymbol' will return resolved symbol for export assignment + // otherwise it will return moduleSymbol itself + moduleSymbol = resolveExternalModuleSymbol(moduleSymbol); + var symbolLinks = getSymbolLinks(moduleSymbol); + if (symbolLinks.exportsSomeValue === undefined) { + // for export assignments - check if resolved symbol for RHS is itself a value + // otherwise - check if at least one export is value + symbolLinks.exportsSomeValue = hasExportAssignment + ? !!(moduleSymbol.flags & 107455 /* Value */) + : ts.forEachValue(getExportsOfModule(moduleSymbol), isValue); + } + return symbolLinks.exportsSomeValue; + function isValue(s) { + s = resolveSymbol(s); + return s && !!(s.flags & 107455 /* Value */); + } + } // When resolved as an expression identifier, if the given node references an exported entity, return the declaration // node of the exported entity's container. Otherwise, return undefined. function getReferencedExportContainer(node) { @@ -27224,11 +30818,11 @@ var ts; } var parentSymbol = getParentOfSymbol(symbol); if (parentSymbol) { - if (parentSymbol.flags & 512 /* ValueModule */ && parentSymbol.valueDeclaration.kind === 248 /* SourceFile */) { + if (parentSymbol.flags & 512 /* ValueModule */ && parentSymbol.valueDeclaration.kind === 256 /* SourceFile */) { return parentSymbol.valueDeclaration; } for (var n = node.parent; n; n = n.parent) { - if ((n.kind === 218 /* ModuleDeclaration */ || n.kind === 217 /* EnumDeclaration */) && getSymbolOfNode(n) === parentSymbol) { + if ((n.kind === 225 /* ModuleDeclaration */ || n.kind === 224 /* EnumDeclaration */) && getSymbolOfNode(n) === parentSymbol) { return n; } } @@ -27241,58 +30835,77 @@ var ts; var symbol = getReferencedValueSymbol(node); return symbol && symbol.flags & 8388608 /* Alias */ ? getDeclarationOfAliasSymbol(symbol) : undefined; } - function isStatementWithLocals(node) { - switch (node.kind) { - case 192 /* Block */: - case 220 /* CaseBlock */: - case 199 /* ForStatement */: - case 200 /* ForInStatement */: - case 201 /* ForOfStatement */: - return true; - } - return false; - } - function isNestedRedeclarationSymbol(symbol) { + function isSymbolOfDeclarationWithCollidingName(symbol) { if (symbol.flags & 418 /* BlockScoped */) { var links = getSymbolLinks(symbol); - if (links.isNestedRedeclaration === undefined) { + if (links.isDeclarationWithCollidingName === undefined) { var container = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration); - links.isNestedRedeclaration = isStatementWithLocals(container) && - !!resolveName(container.parent, symbol.name, 107455 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined); + if (ts.isStatementWithLocals(container)) { + var nodeLinks_1 = getNodeLinks(symbol.valueDeclaration); + if (!!resolveName(container.parent, symbol.name, 107455 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined)) { + // redeclaration - always should be renamed + links.isDeclarationWithCollidingName = true; + } + else if (nodeLinks_1.flags & 131072 /* CapturedBlockScopedBinding */) { + // binding is captured in the function + // should be renamed if: + // - binding is not top level - top level bindings never collide with anything + // AND + // - binding is not declared in loop, should be renamed to avoid name reuse across siblings + // let a, b + // { let x = 1; a = () => x; } + // { let x = 100; b = () => x; } + // console.log(a()); // should print '1' + // console.log(b()); // should print '100' + // OR + // - binding is declared inside loop but not in inside initializer of iteration statement or directly inside loop body + // * variables from initializer are passed to rewritten loop body as parameters so they are not captured directly + // * variables that are declared immediately in loop body will become top level variable after loop is rewritten and thus + // they will not collide with anything + var isDeclaredInLoop = nodeLinks_1.flags & 262144 /* BlockScopedBindingInLoop */; + var inLoopInitializer = ts.isIterationStatement(container, /*lookInLabeledStatements*/ false); + var inLoopBodyBlock = container.kind === 199 /* Block */ && ts.isIterationStatement(container.parent, /*lookInLabeledStatements*/ false); + links.isDeclarationWithCollidingName = !ts.isBlockScopedContainerTopLevel(container) && (!isDeclaredInLoop || (!inLoopInitializer && !inLoopBodyBlock)); + } + else { + links.isDeclarationWithCollidingName = false; + } + } } - return links.isNestedRedeclaration; + return links.isDeclarationWithCollidingName; } return false; } // When resolved as an expression identifier, if the given node references a nested block scoped entity with - // a name that hides an existing name, return the declaration of that entity. Otherwise, return undefined. - function getReferencedNestedRedeclaration(node) { + // a name that either hides an existing name or might hide it when compiled downlevel, + // return the declaration of that entity. Otherwise, return undefined. + function getReferencedDeclarationWithCollidingName(node) { var symbol = getReferencedValueSymbol(node); - return symbol && isNestedRedeclarationSymbol(symbol) ? symbol.valueDeclaration : undefined; + return symbol && isSymbolOfDeclarationWithCollidingName(symbol) ? symbol.valueDeclaration : undefined; } - // Return true if the given node is a declaration of a nested block scoped entity with a name that hides an - // existing name. - function isNestedRedeclaration(node) { - return isNestedRedeclarationSymbol(getSymbolOfNode(node)); + // Return true if the given node is a declaration of a nested block scoped entity with a name that either hides an + // existing name or might hide a name when compiled downlevel + function isDeclarationWithCollidingName(node) { + return isSymbolOfDeclarationWithCollidingName(getSymbolOfNode(node)); } function isValueAliasDeclaration(node) { switch (node.kind) { - case 221 /* ImportEqualsDeclaration */: - case 223 /* ImportClause */: - case 224 /* NamespaceImport */: - case 226 /* ImportSpecifier */: - case 230 /* ExportSpecifier */: + case 229 /* ImportEqualsDeclaration */: + case 231 /* ImportClause */: + case 232 /* NamespaceImport */: + case 234 /* ImportSpecifier */: + case 238 /* ExportSpecifier */: return isAliasResolvedToValue(getSymbolOfNode(node)); - case 228 /* ExportDeclaration */: + case 236 /* ExportDeclaration */: var exportClause = node.exportClause; return exportClause && ts.forEach(exportClause.elements, isValueAliasDeclaration); - case 227 /* ExportAssignment */: + case 235 /* ExportAssignment */: return node.expression && node.expression.kind === 69 /* Identifier */ ? isAliasResolvedToValue(getSymbolOfNode(node)) : true; } return false; } function isTopLevelValueImportEqualsWithEntityName(node) { - if (node.parent.kind !== 248 /* SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) { + if (node.parent.kind !== 256 /* SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) { // parent is not source file or it is not reference to internal module return false; } @@ -27301,14 +30914,12 @@ var ts; } function isAliasResolvedToValue(symbol) { var target = resolveAlias(symbol); - if (target === unknownSymbol && compilerOptions.isolatedModules) { + if (target === unknownSymbol) { return true; } - // const enums and modules that contain only const enums are not considered values from the emit perespective + // const enums and modules that contain only const enums are not considered values from the emit perspective // unless 'preserveConstEnums' option is set to true - return target !== unknownSymbol && - target && - target.flags & 107455 /* Value */ && + return target.flags & 107455 /* Value */ && (compilerOptions.preserveConstEnums || !isConstEnumOrConstEnumOnlyModule(target)); } function isConstEnumOrConstEnumOnlyModule(s) { @@ -27354,7 +30965,7 @@ var ts; return getNodeLinks(node).enumMemberValue; } function getConstantValue(node) { - if (node.kind === 247 /* EnumMember */) { + if (node.kind === 255 /* EnumMember */) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; @@ -27389,22 +31000,22 @@ var ts; else if (type.flags & 1 /* Any */) { return ts.TypeReferenceSerializationKind.ObjectType; } - else if (allConstituentTypesHaveKind(type, 16 /* Void */)) { + else if (isTypeOfKind(type, 16 /* Void */)) { return ts.TypeReferenceSerializationKind.VoidType; } - else if (allConstituentTypesHaveKind(type, 8 /* Boolean */)) { + else if (isTypeOfKind(type, 8 /* Boolean */)) { return ts.TypeReferenceSerializationKind.BooleanType; } - else if (allConstituentTypesHaveKind(type, 132 /* NumberLike */)) { + else if (isTypeOfKind(type, 132 /* NumberLike */)) { return ts.TypeReferenceSerializationKind.NumberLikeType; } - else if (allConstituentTypesHaveKind(type, 258 /* StringLike */)) { + else if (isTypeOfKind(type, 258 /* StringLike */)) { return ts.TypeReferenceSerializationKind.StringLikeType; } - else if (allConstituentTypesHaveKind(type, 8192 /* Tuple */)) { + else if (isTypeOfKind(type, 8192 /* Tuple */)) { return ts.TypeReferenceSerializationKind.ArrayLikeType; } - else if (allConstituentTypesHaveKind(type, 16777216 /* ESSymbol */)) { + else if (isTypeOfKind(type, 16777216 /* ESSymbol */)) { return ts.TypeReferenceSerializationKind.ESSymbolType; } else if (isFunctionType(type)) { @@ -27430,9 +31041,15 @@ var ts; getSymbolDisplayBuilder().buildTypeDisplay(getReturnTypeOfSignature(signature), writer, enclosingDeclaration, flags); } function writeTypeOfExpression(expr, enclosingDeclaration, flags, writer) { - var type = getTypeOfExpression(expr); + var type = getWidenedType(getTypeOfExpression(expr)); getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags); } + function writeBaseConstructorTypeOfClass(node, enclosingDeclaration, flags, writer) { + var classType = getDeclaredTypeOfSymbol(getSymbolOfNode(node)); + resolveBaseTypesOfClass(classType); + var baseType = classType.resolvedBaseTypes.length ? classType.resolvedBaseTypes[0] : unknownType; + getSymbolDisplayBuilder().buildTypeDisplay(baseType, writer, enclosingDeclaration, flags); + } function hasGlobalName(name) { return ts.hasProperty(globals, name); } @@ -27446,23 +31063,31 @@ var ts; var symbol = getReferencedValueSymbol(reference); return symbol && getExportSymbolOfValueSymbolIfExported(symbol).valueDeclaration; } - function instantiateSingleCallFunctionType(functionType, typeArguments) { - if (functionType === unknownType) { - return unknownType; - } - var signature = getSingleCallSignature(functionType); - if (!signature) { - return unknownType; - } - var instantiatedSignature = getSignatureInstantiation(signature, typeArguments); - return getOrCreateTypeFromSignature(instantiatedSignature); - } function createResolver() { + // this variable and functions that use it are deliberately moved here from the outer scope + // to avoid scope pollution + var resolvedTypeReferenceDirectives = host.getResolvedTypeReferenceDirectives(); + var fileToDirective; + if (resolvedTypeReferenceDirectives) { + // populate reverse mapping: file path -> type reference directive that was resolved to this file + fileToDirective = ts.createFileMap(); + for (var key in resolvedTypeReferenceDirectives) { + if (!ts.hasProperty(resolvedTypeReferenceDirectives, key)) { + continue; + } + var resolvedDirective = resolvedTypeReferenceDirectives[key]; + if (!resolvedDirective) { + continue; + } + var file = host.getSourceFile(resolvedDirective.resolvedFileName); + fileToDirective.set(file.path, key); + } + } return { getReferencedExportContainer: getReferencedExportContainer, getReferencedImportDeclaration: getReferencedImportDeclaration, - getReferencedNestedRedeclaration: getReferencedNestedRedeclaration, - isNestedRedeclaration: isNestedRedeclaration, + getReferencedDeclarationWithCollidingName: getReferencedDeclarationWithCollidingName, + isDeclarationWithCollidingName: isDeclarationWithCollidingName, isValueAliasDeclaration: isValueAliasDeclaration, hasGlobalName: hasGlobalName, isReferencedAliasDeclaration: isReferencedAliasDeclaration, @@ -27473,6 +31098,7 @@ var ts; writeTypeOfDeclaration: writeTypeOfDeclaration, writeReturnTypeOfSignatureDeclaration: writeReturnTypeOfSignatureDeclaration, writeTypeOfExpression: writeTypeOfExpression, + writeBaseConstructorTypeOfClass: writeBaseConstructorTypeOfClass, isSymbolAccessible: isSymbolAccessible, isEntityNameVisible: isEntityNameVisible, getConstantValue: getConstantValue, @@ -27480,33 +31106,124 @@ var ts; getReferencedValueDeclaration: getReferencedValueDeclaration, getTypeReferenceSerializationKind: getTypeReferenceSerializationKind, isOptionalParameter: isOptionalParameter, + moduleExportsSomeValue: moduleExportsSomeValue, isArgumentsLocalBinding: isArgumentsLocalBinding, - getExternalModuleFileFromDeclaration: getExternalModuleFileFromDeclaration + getExternalModuleFileFromDeclaration: getExternalModuleFileFromDeclaration, + getTypeReferenceDirectivesForEntityName: getTypeReferenceDirectivesForEntityName, + getTypeReferenceDirectivesForSymbol: getTypeReferenceDirectivesForSymbol }; + // defined here to avoid outer scope pollution + function getTypeReferenceDirectivesForEntityName(node) { + // program does not have any files with type reference directives - bail out + if (!fileToDirective) { + return undefined; + } + // property access can only be used as values + // qualified names can only be used as types\namespaces + // identifiers are treated as values only if they appear in type queries + var meaning = (node.kind === 172 /* PropertyAccessExpression */) || (node.kind === 69 /* Identifier */ && isInTypeQuery(node)) + ? 107455 /* Value */ | 1048576 /* ExportValue */ + : 793056 /* Type */ | 1536 /* Namespace */; + var symbol = resolveEntityName(node, meaning, /*ignoreErrors*/ true); + return symbol && symbol !== unknownSymbol ? getTypeReferenceDirectivesForSymbol(symbol, meaning) : undefined; + } + // defined here to avoid outer scope pollution + function getTypeReferenceDirectivesForSymbol(symbol, meaning) { + // program does not have any files with type reference directives - bail out + if (!fileToDirective) { + return undefined; + } + if (!isSymbolFromTypeDeclarationFile(symbol)) { + return undefined; + } + // check what declarations in the symbol can contribute to the target meaning + var typeReferenceDirectives; + for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { + var decl = _a[_i]; + // check meaning of the local symbol to see if declaration needs to be analyzed further + if (decl.symbol && decl.symbol.flags & meaning) { + var file = ts.getSourceFileOfNode(decl); + var typeReferenceDirective = fileToDirective.get(file.path); + if (typeReferenceDirective) { + (typeReferenceDirectives || (typeReferenceDirectives = [])).push(typeReferenceDirective); + } + } + } + return typeReferenceDirectives; + } + function isSymbolFromTypeDeclarationFile(symbol) { + // bail out if symbol does not have associated declarations (i.e. this is transient symbol created for property in binding pattern) + if (!symbol.declarations) { + return false; + } + // walk the parent chain for symbols to make sure that top level parent symbol is in the global scope + // external modules cannot define or contribute to type declaration files + var current = symbol; + while (true) { + var parent_12 = getParentOfSymbol(current); + if (parent_12) { + current = parent_12; + } + else { + break; + } + } + if (current.valueDeclaration && current.valueDeclaration.kind === 256 /* SourceFile */ && current.flags & 512 /* ValueModule */) { + return false; + } + // check that at least one declaration of top level symbol originates from type declaration file + for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { + var decl = _a[_i]; + var file = ts.getSourceFileOfNode(decl); + if (fileToDirective.contains(file.path)) { + return true; + } + } + return false; + } } function getExternalModuleFileFromDeclaration(declaration) { var specifier = ts.getExternalModuleName(declaration); - var moduleSymbol = getSymbolAtLocation(specifier); + var moduleSymbol = resolveExternalModuleNameWorker(specifier, specifier, /*moduleNotFoundError*/ undefined); if (!moduleSymbol) { return undefined; } - return ts.getDeclarationOfKind(moduleSymbol, 248 /* SourceFile */); + return ts.getDeclarationOfKind(moduleSymbol, 256 /* SourceFile */); } function initializeTypeChecker() { // Bind all source files and propagate errors ts.forEach(host.getSourceFiles(), function (file) { ts.bindSourceFile(file, compilerOptions); }); + var augmentations; // Initialize global symbol table ts.forEach(host.getSourceFiles(), function (file) { if (!ts.isExternalOrCommonJsModule(file)) { mergeSymbolTable(globals, file.locals); } + if (file.moduleAugmentations.length) { + (augmentations || (augmentations = [])).push(file.moduleAugmentations); + } + if (file.wasReferenced && file.symbol && file.symbol.globalExports) { + mergeSymbolTable(globals, file.symbol.globalExports); + } }); + if (augmentations) { + // merge module augmentations. + // this needs to be done after global symbol table is initialized to make sure that all ambient modules are indexed + for (var _i = 0, augmentations_1 = augmentations; _i < augmentations_1.length; _i++) { + var list = augmentations_1[_i]; + for (var _a = 0, list_2 = list; _a < list_2.length; _a++) { + var augmentation = list_2[_a]; + mergeModuleAugmentation(augmentation); + } + } + } + // Setup global builtins + addToSymbolTable(globals, builtinGlobals, ts.Diagnostics.Declaration_name_conflicts_with_built_in_global_identifier_0); getSymbolLinks(undefinedSymbol).type = undefinedType; getSymbolLinks(argumentsSymbol).type = getGlobalType("IArguments"); getSymbolLinks(unknownSymbol).type = unknownType; - globals[undefinedSymbol.name] = undefinedSymbol; // Initialize special types globalArrayType = getGlobalType("Array", /*arity*/ 1); globalObjectType = getGlobalType("Object"); @@ -27521,6 +31238,7 @@ var ts; getGlobalMethodDecoratorType = ts.memoize(function () { return getGlobalType("MethodDecorator"); }); getGlobalParameterDecoratorType = ts.memoize(function () { return getGlobalType("ParameterDecorator"); }); getGlobalTypedPropertyDescriptorType = ts.memoize(function () { return getGlobalType("TypedPropertyDescriptor", /*arity*/ 1); }); + getGlobalESSymbolConstructorSymbol = ts.memoize(function () { return getGlobalValueSymbol("Symbol"); }); getGlobalPromiseType = ts.memoize(function () { return getGlobalType("Promise", /*arity*/ 1); }); tryGetGlobalPromiseType = ts.memoize(function () { return getGlobalSymbol("Promise", 793056 /* Type */, /*diagnostic*/ undefined) && getGlobalPromiseType(); }); getGlobalPromiseLikeType = ts.memoize(function () { return getGlobalType("PromiseLike", /*arity*/ 1); }); @@ -27528,28 +31246,23 @@ var ts; getGlobalPromiseConstructorSymbol = ts.memoize(function () { return getGlobalValueSymbol("Promise"); }); getGlobalPromiseConstructorLikeType = ts.memoize(function () { return getGlobalType("PromiseConstructorLike"); }); getGlobalThenableType = ts.memoize(createThenableType); - // If we're in ES6 mode, load the TemplateStringsArray. - // Otherwise, default to 'unknown' for the purposes of type checking in LS scenarios. + getGlobalTemplateStringsArrayType = ts.memoize(function () { return getGlobalType("TemplateStringsArray"); }); if (languageVersion >= 2 /* ES6 */) { - globalTemplateStringsArrayType = getGlobalType("TemplateStringsArray"); - globalESSymbolType = getGlobalType("Symbol"); - globalESSymbolConstructorSymbol = getGlobalValueSymbol("Symbol"); - globalIterableType = getGlobalType("Iterable", /*arity*/ 1); - globalIteratorType = getGlobalType("Iterator", /*arity*/ 1); - globalIterableIteratorType = getGlobalType("IterableIterator", /*arity*/ 1); + getGlobalESSymbolType = ts.memoize(function () { return getGlobalType("Symbol"); }); + getGlobalIterableType = ts.memoize(function () { return getGlobalType("Iterable", /*arity*/ 1); }); + getGlobalIteratorType = ts.memoize(function () { return getGlobalType("Iterator", /*arity*/ 1); }); + getGlobalIterableIteratorType = ts.memoize(function () { return getGlobalType("IterableIterator", /*arity*/ 1); }); } else { - globalTemplateStringsArrayType = unknownType; - // Consider putting Symbol interface in lib.d.ts. On the plus side, putting it in lib.d.ts would make it - // extensible for Polyfilling Symbols. But putting it into lib.d.ts could also break users that have - // a global Symbol already, particularly if it is a class. - globalESSymbolType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); - globalESSymbolConstructorSymbol = undefined; - globalIterableType = emptyGenericType; - globalIteratorType = emptyGenericType; - globalIterableIteratorType = emptyGenericType; + getGlobalESSymbolType = ts.memoize(function () { return emptyObjectType; }); + getGlobalIterableType = ts.memoize(function () { return emptyGenericType; }); + getGlobalIteratorType = ts.memoize(function () { return emptyGenericType; }); + getGlobalIterableIteratorType = ts.memoize(function () { return emptyGenericType; }); } anyArrayType = createArrayType(anyType); + var symbol = getGlobalSymbol("ReadonlyArray", 793056 /* Type */, /*diagnostic*/ undefined); + globalReadonlyArrayType = symbol && getTypeOfGlobalSymbol(symbol, /*arity*/ 1); + anyReadonlyArrayType = globalReadonlyArrayType ? createTypeFromGenericGlobalType(globalReadonlyArrayType, [anyType]) : anyArrayType; } function createInstantiatedPromiseLikeType() { var promiseLikeType = getGlobalPromiseLikeType(); @@ -27575,9 +31288,14 @@ var ts; return false; } if (!ts.nodeCanBeDecorated(node)) { - return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_are_not_valid_here); + if (node.kind === 147 /* MethodDeclaration */ && !ts.nodeIsPresent(node.body)) { + return grammarErrorOnFirstToken(node, ts.Diagnostics.A_decorator_can_only_decorate_a_method_implementation_not_an_overload); + } + else { + return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_are_not_valid_here); + } } - else if (node.kind === 145 /* GetAccessor */ || node.kind === 146 /* SetAccessor */) { + else if (node.kind === 149 /* GetAccessor */ || node.kind === 150 /* SetAccessor */) { var accessors = ts.getAllAccessorDeclarations(node.parent.members, node); if (accessors.firstAccessor.decorators && node === accessors.secondAccessor) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name); @@ -27587,38 +31305,38 @@ var ts; } function checkGrammarModifiers(node) { switch (node.kind) { - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: - case 144 /* Constructor */: - case 141 /* PropertyDeclaration */: - case 140 /* PropertySignature */: - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - case 149 /* IndexSignature */: - case 218 /* ModuleDeclaration */: - case 222 /* ImportDeclaration */: - case 221 /* ImportEqualsDeclaration */: - case 228 /* ExportDeclaration */: - case 227 /* ExportAssignment */: - case 138 /* Parameter */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: + case 148 /* Constructor */: + case 145 /* PropertyDeclaration */: + case 144 /* PropertySignature */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: + case 153 /* IndexSignature */: + case 225 /* ModuleDeclaration */: + case 230 /* ImportDeclaration */: + case 229 /* ImportEqualsDeclaration */: + case 236 /* ExportDeclaration */: + case 235 /* ExportAssignment */: + case 142 /* Parameter */: break; - case 213 /* FunctionDeclaration */: + case 220 /* FunctionDeclaration */: if (node.modifiers && (node.modifiers.length > 1 || node.modifiers[0].kind !== 118 /* AsyncKeyword */) && - node.parent.kind !== 219 /* ModuleBlock */ && node.parent.kind !== 248 /* SourceFile */) { + node.parent.kind !== 226 /* ModuleBlock */ && node.parent.kind !== 256 /* SourceFile */) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); } break; - case 214 /* ClassDeclaration */: - case 215 /* InterfaceDeclaration */: - case 193 /* VariableStatement */: - case 216 /* TypeAliasDeclaration */: - if (node.modifiers && node.parent.kind !== 219 /* ModuleBlock */ && node.parent.kind !== 248 /* SourceFile */) { + case 221 /* ClassDeclaration */: + case 222 /* InterfaceDeclaration */: + case 200 /* VariableStatement */: + case 223 /* TypeAliasDeclaration */: + if (node.modifiers && node.parent.kind !== 226 /* ModuleBlock */ && node.parent.kind !== 256 /* SourceFile */) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); } break; - case 217 /* EnumDeclaration */: + case 224 /* EnumDeclaration */: if (node.modifiers && (node.modifiers.length > 1 || node.modifiers[0].kind !== 74 /* ConstKeyword */) && - node.parent.kind !== 219 /* ModuleBlock */ && node.parent.kind !== 248 /* SourceFile */) { + node.parent.kind !== 226 /* ModuleBlock */ && node.parent.kind !== 256 /* SourceFile */) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); } break; @@ -27628,37 +31346,48 @@ var ts; if (!node.modifiers) { return; } - var lastStatic, lastPrivate, lastProtected, lastDeclare, lastAsync; + var lastStatic, lastPrivate, lastProtected, lastDeclare, lastAsync, lastReadonly; var flags = 0; for (var _i = 0, _a = node.modifiers; _i < _a.length; _i++) { var modifier = _a[_i]; + if (modifier.kind !== 128 /* ReadonlyKeyword */) { + if (node.kind === 144 /* PropertySignature */ || node.kind === 146 /* MethodSignature */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_type_member, ts.tokenToString(modifier.kind)); + } + if (node.kind === 153 /* IndexSignature */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_an_index_signature, ts.tokenToString(modifier.kind)); + } + } switch (modifier.kind) { + case 74 /* ConstKeyword */: + if (node.kind !== 224 /* EnumDeclaration */ && node.parent.kind === 221 /* ClassDeclaration */) { + return grammarErrorOnNode(node, ts.Diagnostics.A_class_member_cannot_have_the_0_keyword, ts.tokenToString(74 /* ConstKeyword */)); + } + break; case 112 /* PublicKeyword */: case 111 /* ProtectedKeyword */: case 110 /* PrivateKeyword */: - var text = void 0; - if (modifier.kind === 112 /* PublicKeyword */) { - text = "public"; - } - else if (modifier.kind === 111 /* ProtectedKeyword */) { - text = "protected"; + var text = visibilityToString(ts.modifierToFlag(modifier.kind)); + if (modifier.kind === 111 /* ProtectedKeyword */) { lastProtected = modifier; } - else { - text = "private"; + else if (modifier.kind === 110 /* PrivateKeyword */) { lastPrivate = modifier; } - if (flags & 56 /* AccessibilityModifier */) { + if (flags & 28 /* AccessibilityModifier */) { return grammarErrorOnNode(modifier, ts.Diagnostics.Accessibility_modifier_already_seen); } - else if (flags & 64 /* Static */) { + else if (flags & 32 /* Static */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "static"); } + else if (flags & 64 /* Readonly */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "readonly"); + } else if (flags & 256 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "async"); } - else if (node.parent.kind === 219 /* ModuleBlock */ || node.parent.kind === 248 /* SourceFile */) { - return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, text); + else if (node.parent.kind === 226 /* ModuleBlock */ || node.parent.kind === 256 /* SourceFile */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, text); } else if (flags & 128 /* Abstract */) { if (modifier.kind === 110 /* PrivateKeyword */) { @@ -27671,29 +31400,43 @@ var ts; flags |= ts.modifierToFlag(modifier.kind); break; case 113 /* StaticKeyword */: - if (flags & 64 /* Static */) { + if (flags & 32 /* Static */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "static"); } + else if (flags & 64 /* Readonly */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "readonly"); + } else if (flags & 256 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "async"); } - else if (node.parent.kind === 219 /* ModuleBlock */ || node.parent.kind === 248 /* SourceFile */) { - return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, "static"); + else if (node.parent.kind === 226 /* ModuleBlock */ || node.parent.kind === 256 /* SourceFile */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, "static"); } - else if (node.kind === 138 /* Parameter */) { + else if (node.kind === 142 /* Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static"); } else if (flags & 128 /* Abstract */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "static", "abstract"); } - flags |= 64 /* Static */; + flags |= 32 /* Static */; lastStatic = modifier; break; + case 128 /* ReadonlyKeyword */: + if (flags & 64 /* Readonly */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "readonly"); + } + else if (node.kind !== 145 /* PropertyDeclaration */ && node.kind !== 144 /* PropertySignature */ && node.kind !== 153 /* IndexSignature */ && node.kind !== 142 /* Parameter */) { + // If node.kind === SyntaxKind.Parameter, checkParameter report an error if it's not a parameter property. + return grammarErrorOnNode(modifier, ts.Diagnostics.readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature); + } + flags |= 64 /* Readonly */; + lastReadonly = modifier; + break; case 82 /* ExportKeyword */: - if (flags & 2 /* Export */) { + if (flags & 1 /* Export */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "export"); } - else if (flags & 4 /* Ambient */) { + else if (flags & 2 /* Ambient */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "declare"); } else if (flags & 128 /* Abstract */) { @@ -27702,48 +31445,51 @@ var ts; else if (flags & 256 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "async"); } - else if (node.parent.kind === 214 /* ClassDeclaration */) { + else if (node.parent.kind === 221 /* ClassDeclaration */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export"); } - else if (node.kind === 138 /* Parameter */) { + else if (node.kind === 142 /* Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export"); } - flags |= 2 /* Export */; + flags |= 1 /* Export */; break; case 122 /* DeclareKeyword */: - if (flags & 4 /* Ambient */) { + if (flags & 2 /* Ambient */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "declare"); } else if (flags & 256 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } - else if (node.parent.kind === 214 /* ClassDeclaration */) { + else if (node.parent.kind === 221 /* ClassDeclaration */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare"); } - else if (node.kind === 138 /* Parameter */) { + else if (node.kind === 142 /* Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); } - else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 219 /* ModuleBlock */) { + else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 226 /* ModuleBlock */) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); } - flags |= 4 /* Ambient */; + flags |= 2 /* Ambient */; lastDeclare = modifier; break; case 115 /* AbstractKeyword */: if (flags & 128 /* Abstract */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "abstract"); } - if (node.kind !== 214 /* ClassDeclaration */) { - if (node.kind !== 143 /* MethodDeclaration */) { - return grammarErrorOnNode(modifier, ts.Diagnostics.abstract_modifier_can_only_appear_on_a_class_or_method_declaration); + if (node.kind !== 221 /* ClassDeclaration */) { + if (node.kind !== 147 /* MethodDeclaration */ && + node.kind !== 145 /* PropertyDeclaration */ && + node.kind !== 149 /* GetAccessor */ && + node.kind !== 150 /* SetAccessor */) { + return grammarErrorOnNode(modifier, ts.Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration); } - if (!(node.parent.kind === 214 /* ClassDeclaration */ && node.parent.flags & 128 /* Abstract */)) { + if (!(node.parent.kind === 221 /* ClassDeclaration */ && node.parent.flags & 128 /* Abstract */)) { return grammarErrorOnNode(modifier, ts.Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class); } - if (flags & 64 /* Static */) { + if (flags & 32 /* Static */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "static", "abstract"); } - if (flags & 16 /* Private */) { + if (flags & 8 /* Private */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "private", "abstract"); } } @@ -27753,10 +31499,10 @@ var ts; if (flags & 256 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "async"); } - else if (flags & 4 /* Ambient */ || ts.isInAmbientContext(node.parent)) { + else if (flags & 2 /* Ambient */ || ts.isInAmbientContext(node.parent)) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } - else if (node.kind === 138 /* Parameter */) { + else if (node.kind === 142 /* Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "async"); } flags |= 256 /* Async */; @@ -27764,28 +31510,25 @@ var ts; break; } } - if (node.kind === 144 /* Constructor */) { - if (flags & 64 /* Static */) { + if (node.kind === 148 /* Constructor */) { + if (flags & 32 /* Static */) { return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static"); } if (flags & 128 /* Abstract */) { return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "abstract"); } - else if (flags & 32 /* Protected */) { - return grammarErrorOnNode(lastProtected, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "protected"); - } - else if (flags & 16 /* Private */) { - return grammarErrorOnNode(lastPrivate, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "private"); - } else if (flags & 256 /* Async */) { return grammarErrorOnNode(lastAsync, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "async"); } + else if (flags & 64 /* Readonly */) { + return grammarErrorOnNode(lastReadonly, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "readonly"); + } return; } - else if ((node.kind === 222 /* ImportDeclaration */ || node.kind === 221 /* ImportEqualsDeclaration */) && flags & 4 /* Ambient */) { + else if ((node.kind === 230 /* ImportDeclaration */ || node.kind === 229 /* ImportEqualsDeclaration */) && flags & 2 /* Ambient */) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare"); } - else if (node.kind === 138 /* Parameter */ && (flags & 56 /* AccessibilityModifier */) && ts.isBindingPattern(node.name)) { + else if (node.kind === 142 /* Parameter */ && (flags & 92 /* ParameterPropertyModifier */) && ts.isBindingPattern(node.name)) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_may_not_be_a_binding_pattern); } if (flags & 256 /* Async */) { @@ -27797,10 +31540,10 @@ var ts; return grammarErrorOnNode(asyncModifier, ts.Diagnostics.Async_functions_are_only_available_when_targeting_ECMAScript_6_and_higher); } switch (node.kind) { - case 143 /* MethodDeclaration */: - case 213 /* FunctionDeclaration */: - case 173 /* FunctionExpression */: - case 174 /* ArrowFunction */: + case 147 /* MethodDeclaration */: + case 220 /* FunctionDeclaration */: + case 179 /* FunctionExpression */: + case 180 /* ArrowFunction */: if (!node.asteriskToken) { return false; } @@ -27866,7 +31609,7 @@ var ts; checkGrammarParameterList(node.parameters) || checkGrammarArrowFunction(node, file); } function checkGrammarArrowFunction(node, file) { - if (node.kind === 174 /* ArrowFunction */) { + if (node.kind === 180 /* ArrowFunction */) { var arrowFunction = node; var startLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.pos).line; var endLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.end).line; @@ -27889,7 +31632,7 @@ var ts; if (parameter.dotDotDotToken) { return grammarErrorOnNode(parameter.dotDotDotToken, ts.Diagnostics.An_index_signature_cannot_have_a_rest_parameter); } - if (parameter.flags & 1022 /* Modifier */) { + if (parameter.flags & 1023 /* Modifier */) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_cannot_have_an_accessibility_modifier); } if (parameter.questionToken) { @@ -27901,21 +31644,16 @@ var ts; if (!parameter.type) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_must_have_a_type_annotation); } - if (parameter.type.kind !== 130 /* StringKeyword */ && parameter.type.kind !== 128 /* NumberKeyword */) { + if (parameter.type.kind !== 132 /* StringKeyword */ && parameter.type.kind !== 130 /* NumberKeyword */) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_must_be_string_or_number); } if (!node.type) { return grammarErrorOnNode(node, ts.Diagnostics.An_index_signature_must_have_a_type_annotation); } } - function checkGrammarForIndexSignatureModifier(node) { - if (node.flags & 1022 /* Modifier */) { - grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_not_permitted_on_index_signature_members); - } - } function checkGrammarIndexSignature(node) { // Prevent cascading error by short-circuit - return checkGrammarDecorators(node) || checkGrammarModifiers(node) || checkGrammarIndexSignatureParameters(node) || checkGrammarForIndexSignatureModifier(node); + return checkGrammarDecorators(node) || checkGrammarModifiers(node) || checkGrammarIndexSignatureParameters(node); } function checkGrammarForAtLeastOneTypeArgument(node, typeArguments) { if (typeArguments && typeArguments.length === 0) { @@ -27934,7 +31672,7 @@ var ts; var sourceFile = ts.getSourceFileOfNode(node); for (var _i = 0, args_1 = args; _i < args_1.length; _i++) { var arg = args_1[_i]; - if (arg.kind === 187 /* OmittedExpression */) { + if (arg.kind === 193 /* OmittedExpression */) { return grammarErrorAtPos(sourceFile, arg.pos, 0, ts.Diagnostics.Argument_expression_expected); } } @@ -28008,19 +31746,19 @@ var ts; } function checkGrammarComputedPropertyName(node) { // If node is not a computedPropertyName, just skip the grammar checking - if (node.kind !== 136 /* ComputedPropertyName */) { + if (node.kind !== 140 /* ComputedPropertyName */) { return false; } var computedPropertyName = node; - if (computedPropertyName.expression.kind === 181 /* BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 24 /* CommaToken */) { + if (computedPropertyName.expression.kind === 187 /* BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 24 /* CommaToken */) { return grammarErrorOnNode(computedPropertyName.expression, ts.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name); } } function checkGrammarForGenerator(node) { if (node.asteriskToken) { - ts.Debug.assert(node.kind === 213 /* FunctionDeclaration */ || - node.kind === 173 /* FunctionExpression */ || - node.kind === 143 /* MethodDeclaration */); + ts.Debug.assert(node.kind === 220 /* FunctionDeclaration */ || + node.kind === 179 /* FunctionExpression */ || + node.kind === 147 /* MethodDeclaration */); if (ts.isInAmbientContext(node)) { return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_not_allowed_in_an_ambient_context); } @@ -28041,23 +31779,28 @@ var ts; var seen = {}; var Property = 1; var GetAccessor = 2; - var SetAccesor = 4; - var GetOrSetAccessor = GetAccessor | SetAccesor; - for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { - var prop = _a[_i]; - var name_16 = prop.name; - if (prop.kind === 187 /* OmittedExpression */ || - name_16.kind === 136 /* ComputedPropertyName */) { + var SetAccessor = 4; + var GetOrSetAccessor = GetAccessor | SetAccessor; + var _loop_1 = function(prop) { + var name_20 = prop.name; + if (prop.kind === 193 /* OmittedExpression */ || + name_20.kind === 140 /* ComputedPropertyName */) { // If the name is not a ComputedPropertyName, the grammar checking will skip it - checkGrammarComputedPropertyName(name_16); - continue; + checkGrammarComputedPropertyName(name_20); + return "continue"; } - if (prop.kind === 246 /* ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) { + if (prop.kind === 254 /* ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) { // having objectAssignmentInitializer is only valid in ObjectAssignmentPattern // outside of destructuring it is a syntax error - return grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment); + return { value: grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment) }; } - // ECMA-262 11.1.5 Object Initialiser + // Modifiers are never allowed on properties except for 'async' on a method declaration + ts.forEach(prop.modifiers, function (mod) { + if (mod.kind !== 118 /* AsyncKeyword */ || prop.kind !== 147 /* MethodDeclaration */) { + grammarErrorOnNode(mod, ts.Diagnostics._0_modifier_cannot_be_used_here, ts.getTextOfNode(mod)); + } + }); + // ECMA-262 11.1.5 Object Initializer // If previous is not undefined then throw a SyntaxError exception if any of the following conditions are true // a.This production is contained in strict code and IsDataDescriptor(previous) is true and // IsDataDescriptor(propId.descriptor) is true. @@ -28066,65 +31809,70 @@ var ts; // d.IsAccessorDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true // and either both previous and propId.descriptor have[[Get]] fields or both previous and propId.descriptor have[[Set]] fields var currentKind = void 0; - if (prop.kind === 245 /* PropertyAssignment */ || prop.kind === 246 /* ShorthandPropertyAssignment */) { - // Grammar checking for computedPropertName and shorthandPropertyAssignment + if (prop.kind === 253 /* PropertyAssignment */ || prop.kind === 254 /* ShorthandPropertyAssignment */) { + // Grammar checking for computedPropertyName and shorthandPropertyAssignment checkGrammarForInvalidQuestionMark(prop, prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); - if (name_16.kind === 8 /* NumericLiteral */) { - checkGrammarNumericLiteral(name_16); + if (name_20.kind === 8 /* NumericLiteral */) { + checkGrammarNumericLiteral(name_20); } currentKind = Property; } - else if (prop.kind === 143 /* MethodDeclaration */) { + else if (prop.kind === 147 /* MethodDeclaration */) { currentKind = Property; } - else if (prop.kind === 145 /* GetAccessor */) { + else if (prop.kind === 149 /* GetAccessor */) { currentKind = GetAccessor; } - else if (prop.kind === 146 /* SetAccessor */) { - currentKind = SetAccesor; + else if (prop.kind === 150 /* SetAccessor */) { + currentKind = SetAccessor; } else { ts.Debug.fail("Unexpected syntax kind:" + prop.kind); } - if (!ts.hasProperty(seen, name_16.text)) { - seen[name_16.text] = currentKind; + if (!ts.hasProperty(seen, name_20.text)) { + seen[name_20.text] = currentKind; } else { - var existingKind = seen[name_16.text]; + var existingKind = seen[name_20.text]; if (currentKind === Property && existingKind === Property) { - continue; + return "continue"; } else if ((currentKind & GetOrSetAccessor) && (existingKind & GetOrSetAccessor)) { if (existingKind !== GetOrSetAccessor && currentKind !== existingKind) { - seen[name_16.text] = currentKind | existingKind; + seen[name_20.text] = currentKind | existingKind; } else { - return grammarErrorOnNode(name_16, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name); + return { value: grammarErrorOnNode(name_20, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name) }; } } else { - return grammarErrorOnNode(name_16, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name); + return { value: grammarErrorOnNode(name_20, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name) }; } } + }; + for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { + var prop = _a[_i]; + var state_2 = _loop_1(prop); + if (typeof state_2 === "object") return state_2.value; } } function checkGrammarJsxElement(node) { var seen = {}; for (var _i = 0, _a = node.attributes; _i < _a.length; _i++) { var attr = _a[_i]; - if (attr.kind === 239 /* JsxSpreadAttribute */) { + if (attr.kind === 247 /* JsxSpreadAttribute */) { continue; } var jsxAttr = attr; - var name_17 = jsxAttr.name; - if (!ts.hasProperty(seen, name_17.text)) { - seen[name_17.text] = true; + var name_21 = jsxAttr.name; + if (!ts.hasProperty(seen, name_21.text)) { + seen[name_21.text] = true; } else { - return grammarErrorOnNode(name_17, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); + return grammarErrorOnNode(name_21, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); } var initializer = jsxAttr.initializer; - if (initializer && initializer.kind === 240 /* JsxExpression */ && !initializer.expression) { + if (initializer && initializer.kind === 248 /* JsxExpression */ && !initializer.expression) { return grammarErrorOnNode(jsxAttr.initializer, ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression); } } @@ -28133,24 +31881,35 @@ var ts; if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { return true; } - if (forInOrOfStatement.initializer.kind === 212 /* VariableDeclarationList */) { + if (forInOrOfStatement.initializer.kind === 219 /* VariableDeclarationList */) { var variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { - if (variableList.declarations.length > 1) { - var diagnostic = forInOrOfStatement.kind === 200 /* ForInStatement */ + var declarations = variableList.declarations; + // declarations.length can be zero if there is an error in variable declaration in for-of or for-in + // See http://www.ecma-international.org/ecma-262/6.0/#sec-for-in-and-for-of-statements for details + // For example: + // var let = 10; + // for (let of [1,2,3]) {} // this is invalid ES6 syntax + // for (let in [1,2,3]) {} // this is invalid ES6 syntax + // We will then want to skip on grammar checking on variableList declaration + if (!declarations.length) { + return false; + } + if (declarations.length > 1) { + var diagnostic = forInOrOfStatement.kind === 207 /* ForInStatement */ ? ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement : ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement; return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic); } - var firstDeclaration = variableList.declarations[0]; + var firstDeclaration = declarations[0]; if (firstDeclaration.initializer) { - var diagnostic = forInOrOfStatement.kind === 200 /* ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 207 /* ForInStatement */ ? ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer : ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; return grammarErrorOnNode(firstDeclaration.name, diagnostic); } if (firstDeclaration.type) { - var diagnostic = forInOrOfStatement.kind === 200 /* ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 207 /* ForInStatement */ ? ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation : ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation; return grammarErrorOnNode(firstDeclaration, diagnostic); @@ -28167,30 +31926,26 @@ var ts; else if (ts.isInAmbientContext(accessor)) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_be_declared_in_an_ambient_context); } - else if (accessor.body === undefined) { + else if (accessor.body === undefined && !(accessor.flags & 128 /* Abstract */)) { return grammarErrorAtPos(ts.getSourceFileOfNode(accessor), accessor.end - 1, ";".length, ts.Diagnostics._0_expected, "{"); } else if (accessor.typeParameters) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters); } - else if (kind === 145 /* GetAccessor */ && accessor.parameters.length) { - return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_get_accessor_cannot_have_parameters); + else if (!doesAccessorHaveCorrectParameterCount(accessor)) { + return grammarErrorOnNode(accessor.name, kind === 149 /* GetAccessor */ ? + ts.Diagnostics.A_get_accessor_cannot_have_parameters : + ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter); } - else if (kind === 146 /* SetAccessor */) { + else if (kind === 150 /* SetAccessor */) { if (accessor.type) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation); } - else if (accessor.parameters.length !== 1) { - return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter); - } else { var parameter = accessor.parameters[0]; if (parameter.dotDotDotToken) { return grammarErrorOnNode(parameter.dotDotDotToken, ts.Diagnostics.A_set_accessor_cannot_have_rest_parameter); } - else if (parameter.flags & 1022 /* Modifier */) { - return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); - } else if (parameter.questionToken) { return grammarErrorOnNode(parameter.questionToken, ts.Diagnostics.A_set_accessor_cannot_have_an_optional_parameter); } @@ -28200,6 +31955,20 @@ var ts; } } } + /** Does the accessor have the right number of parameters? + + A get accessor has no parameters or a single `this` parameter. + A set accessor has one parameter or a `this` parameter and one more parameter */ + function doesAccessorHaveCorrectParameterCount(accessor) { + return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 149 /* GetAccessor */ ? 0 : 1); + } + function getAccessorThisParameter(accessor) { + if (accessor.parameters.length === (accessor.kind === 149 /* GetAccessor */ ? 1 : 2) && + accessor.parameters[0].name.kind === 69 /* Identifier */ && + accessor.parameters[0].name.originalKeywordKind === 97 /* ThisKeyword */) { + return accessor.parameters[0]; + } + } function checkGrammarForNonSymbolComputedProperty(node, message) { if (ts.isDynamicName(node)) { return grammarErrorOnNode(node, message); @@ -28211,18 +31980,15 @@ var ts; checkGrammarForGenerator(node)) { return true; } - if (node.parent.kind === 165 /* ObjectLiteralExpression */) { - if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional)) { + if (node.parent.kind === 171 /* ObjectLiteralExpression */) { + if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional)) { return true; } else if (node.body === undefined) { - return grammarErrorAtPos(getSourceFile(node), node.end - 1, ";".length, ts.Diagnostics._0_expected, "{"); + return grammarErrorAtPos(ts.getSourceFileOfNode(node), node.end - 1, ";".length, ts.Diagnostics._0_expected, "{"); } } if (ts.isClassLike(node.parent)) { - if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional)) { - return true; - } // Technically, computed properties in ambient contexts is disallowed // for property declarations and accessors too, not just methods. // However, property declarations disallow computed names in general, @@ -28235,10 +32001,10 @@ var ts; return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol); } } - else if (node.parent.kind === 215 /* InterfaceDeclaration */) { + else if (node.parent.kind === 222 /* InterfaceDeclaration */) { return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol); } - else if (node.parent.kind === 155 /* TypeLiteral */) { + else if (node.parent.kind === 159 /* TypeLiteral */) { return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol); } } @@ -28249,11 +32015,11 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); } switch (current.kind) { - case 207 /* LabeledStatement */: + case 214 /* LabeledStatement */: if (node.label && current.label.text === node.label.text) { // found matching label - verify that label usage is correct // continue can only target labels that are on iteration statements - var isMisplacedContinueLabel = node.kind === 202 /* ContinueStatement */ + var isMisplacedContinueLabel = node.kind === 209 /* ContinueStatement */ && !ts.isIterationStatement(current.statement, /*lookInLabeledStatement*/ true); if (isMisplacedContinueLabel) { return grammarErrorOnNode(node, ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement); @@ -28261,8 +32027,8 @@ var ts; return false; } break; - case 206 /* SwitchStatement */: - if (node.kind === 203 /* BreakStatement */ && !node.label) { + case 213 /* SwitchStatement */: + if (node.kind === 210 /* BreakStatement */ && !node.label) { // unlabeled break within switch statement - ok return false; } @@ -28277,13 +32043,13 @@ var ts; current = current.parent; } if (node.label) { - var message = node.kind === 203 /* BreakStatement */ + var message = node.kind === 210 /* BreakStatement */ ? ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement : ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); } else { - var message = node.kind === 203 /* BreakStatement */ + var message = node.kind === 210 /* BreakStatement */ ? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement : ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); @@ -28295,7 +32061,7 @@ var ts; if (node !== ts.lastOrUndefined(elements)) { return grammarErrorOnNode(node, ts.Diagnostics.A_rest_element_must_be_last_in_an_array_destructuring_pattern); } - if (node.name.kind === 162 /* ArrayBindingPattern */ || node.name.kind === 161 /* ObjectBindingPattern */) { + if (node.name.kind === 168 /* ArrayBindingPattern */ || node.name.kind === 167 /* ObjectBindingPattern */) { return grammarErrorOnNode(node.name, ts.Diagnostics.A_rest_element_cannot_contain_a_binding_pattern); } if (node.initializer) { @@ -28305,7 +32071,7 @@ var ts; } } function checkGrammarVariableDeclaration(node) { - if (node.parent.parent.kind !== 200 /* ForInStatement */ && node.parent.parent.kind !== 201 /* ForOfStatement */) { + if (node.parent.parent.kind !== 207 /* ForInStatement */ && node.parent.parent.kind !== 208 /* ForOfStatement */) { if (ts.isInAmbientContext(node)) { if (node.initializer) { // Error on equals token which immediate precedes the initializer @@ -28322,7 +32088,7 @@ var ts; } } } - var checkLetConstNames = languageVersion >= 2 /* ES6 */ && (ts.isLet(node) || ts.isConst(node)); + var checkLetConstNames = (ts.isLet(node) || ts.isConst(node)); // 1. LexicalDeclaration : LetOrConst BindingList ; // It is a Syntax Error if the BoundNames of BindingList contains "let". // 2. ForDeclaration: ForDeclaration : LetOrConst ForBinding @@ -28333,7 +32099,7 @@ var ts; } function checkGrammarNameInLetOrConstDeclarations(name) { if (name.kind === 69 /* Identifier */) { - if (name.text === "let") { + if (name.originalKeywordKind === 108 /* LetKeyword */) { return grammarErrorOnNode(name, ts.Diagnostics.let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations); } } @@ -28341,7 +32107,7 @@ var ts; var elements = name.elements; for (var _i = 0, elements_2 = elements; _i < elements_2.length; _i++) { var element = elements_2[_i]; - if (element.kind !== 187 /* OmittedExpression */) { + if (element.kind !== 193 /* OmittedExpression */) { checkGrammarNameInLetOrConstDeclarations(element.name); } } @@ -28358,15 +32124,15 @@ var ts; } function allowLetAndConstDeclarations(parent) { switch (parent.kind) { - case 196 /* IfStatement */: - case 197 /* DoStatement */: - case 198 /* WhileStatement */: - case 205 /* WithStatement */: - case 199 /* ForStatement */: - case 200 /* ForInStatement */: - case 201 /* ForOfStatement */: + case 203 /* IfStatement */: + case 204 /* DoStatement */: + case 205 /* WhileStatement */: + case 212 /* WithStatement */: + case 206 /* ForStatement */: + case 207 /* ForInStatement */: + case 208 /* ForOfStatement */: return false; - case 207 /* LabeledStatement */: + case 214 /* LabeledStatement */: return allowLetAndConstDeclarations(parent.parent); } return true; @@ -28381,23 +32147,6 @@ var ts; } } } - function isIntegerLiteral(expression) { - if (expression.kind === 179 /* PrefixUnaryExpression */) { - var unaryExpression = expression; - if (unaryExpression.operator === 35 /* PlusToken */ || unaryExpression.operator === 36 /* MinusToken */) { - expression = unaryExpression.operand; - } - } - if (expression.kind === 8 /* NumericLiteral */) { - // Allows for scientific notation since literalExpression.text was formed by - // coercing a number to a string. Sometimes this coercion can yield a string - // in scientific notation. - // We also don't need special logic for hex because a hex integer is converted - // to decimal when it is coerced. - return /^[0-9]+([eE]\+?[0-9]+)?$/.test(expression.text); - } - return false; - } function hasParseDiagnostics(sourceFile) { return sourceFile.parseDiagnostics.length > 0; } @@ -28422,10 +32171,6 @@ var ts; return true; } } - function isEvalOrArgumentsIdentifier(node) { - return node.kind === 69 /* Identifier */ && - (node.text === "eval" || node.text === "arguments"); - } function checkGrammarConstructorTypeParameters(node) { if (node.typeParameters) { return grammarErrorAtPos(ts.getSourceFileOfNode(node), node.typeParameters.pos, node.typeParameters.end - node.typeParameters.pos, ts.Diagnostics.Type_parameters_cannot_appear_on_a_constructor_declaration); @@ -28438,20 +32183,25 @@ var ts; } function checkGrammarProperty(node) { if (ts.isClassLike(node.parent)) { - if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional) || - checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol)) { + if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol)) { return true; } } - else if (node.parent.kind === 215 /* InterfaceDeclaration */) { + else if (node.parent.kind === 222 /* InterfaceDeclaration */) { if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol)) { return true; } + if (node.initializer) { + return grammarErrorOnNode(node.initializer, ts.Diagnostics.An_interface_property_cannot_have_an_initializer); + } } - else if (node.parent.kind === 155 /* TypeLiteral */) { + else if (node.parent.kind === 159 /* TypeLiteral */) { if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol)) { return true; } + if (node.initializer) { + return grammarErrorOnNode(node.initializer, ts.Diagnostics.A_type_literal_property_cannot_have_an_initializer); + } } if (ts.isInAmbientContext(node) && node.initializer) { return grammarErrorOnFirstToken(node.initializer, ts.Diagnostics.Initializers_are_not_allowed_in_ambient_contexts); @@ -28470,14 +32220,14 @@ var ts; // export_opt AmbientDeclaration // // TODO: The spec needs to be amended to reflect this grammar. - if (node.kind === 215 /* InterfaceDeclaration */ || - node.kind === 216 /* TypeAliasDeclaration */ || - node.kind === 222 /* ImportDeclaration */ || - node.kind === 221 /* ImportEqualsDeclaration */ || - node.kind === 228 /* ExportDeclaration */ || - node.kind === 227 /* ExportAssignment */ || - (node.flags & 4 /* Ambient */) || - (node.flags & (2 /* Export */ | 512 /* Default */))) { + if (node.kind === 222 /* InterfaceDeclaration */ || + node.kind === 223 /* TypeAliasDeclaration */ || + node.kind === 230 /* ImportDeclaration */ || + node.kind === 229 /* ImportEqualsDeclaration */ || + node.kind === 236 /* ExportDeclaration */ || + node.kind === 235 /* ExportAssignment */ || + (node.flags & 2 /* Ambient */) || + (node.flags & (1 /* Export */ | 512 /* Default */))) { return false; } return grammarErrorOnFirstToken(node, ts.Diagnostics.A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file); @@ -28485,7 +32235,7 @@ var ts; function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) { for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { var decl = _a[_i]; - if (ts.isDeclaration(decl) || decl.kind === 193 /* VariableStatement */) { + if (ts.isDeclaration(decl) || decl.kind === 200 /* VariableStatement */) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { return true; } @@ -28508,10 +32258,10 @@ var ts; } // We are either parented by another statement, or some sort of block. // If we're in a block, we only want to really report an error once - // to prevent noisyness. So use a bit on the block to indicate if + // to prevent noisiness. So use a bit on the block to indicate if // this has already been reported, and don't report if it has. // - if (node.parent.kind === 192 /* Block */ || node.parent.kind === 219 /* ModuleBlock */ || node.parent.kind === 248 /* SourceFile */) { + if (node.parent.kind === 199 /* Block */ || node.parent.kind === 226 /* ModuleBlock */ || node.parent.kind === 256 /* SourceFile */) { var links_1 = getNodeLinks(node.parent); // Check if the containing block ever report this error if (!links_1.hasReportedStatementInAmbientContext) { @@ -28524,7 +32274,7 @@ var ts; } function checkGrammarNumericLiteral(node) { // Grammar checking - if (node.flags & 32768 /* OctalLiteral */ && languageVersion >= 1 /* ES5 */) { + if (node.isOctalLiteral && languageVersion >= 1 /* ES5 */) { return grammarErrorOnNode(node, ts.Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher); } } @@ -28536,21 +32286,345 @@ var ts; return true; } } + var _a; } ts.createTypeChecker = createTypeChecker; })(ts || (ts = {})); /// /* @internal */ var ts; +(function (ts) { + var nullSourceMapWriter; + // Used for initialize lastEncodedSourceMapSpan and reset lastEncodedSourceMapSpan when updateLastEncodedAndRecordedSpans + var defaultLastEncodedSourceMapSpan = { + emittedLine: 1, + emittedColumn: 1, + sourceLine: 1, + sourceColumn: 1, + sourceIndex: 0 + }; + function getNullSourceMapWriter() { + if (nullSourceMapWriter === undefined) { + nullSourceMapWriter = { + getSourceMapData: function () { return undefined; }, + setSourceFile: function (sourceFile) { }, + emitStart: function (range) { }, + emitEnd: function (range, stopOverridingSpan) { }, + emitPos: function (pos) { }, + changeEmitSourcePos: function () { }, + getText: function () { return undefined; }, + getSourceMappingURL: function () { return undefined; }, + initialize: function (filePath, sourceMapFilePath, sourceFiles, isBundledEmit) { }, + reset: function () { } + }; + } + return nullSourceMapWriter; + } + ts.getNullSourceMapWriter = getNullSourceMapWriter; + function createSourceMapWriter(host, writer) { + var compilerOptions = host.getCompilerOptions(); + var currentSourceFile; + var sourceMapDir; // The directory in which sourcemap will be + var stopOverridingSpan = false; + var modifyLastSourcePos = false; + // Current source map file and its index in the sources list + var sourceMapSourceIndex; + // Last recorded and encoded spans + var lastRecordedSourceMapSpan; + var lastEncodedSourceMapSpan; + var lastEncodedNameIndex; + // Source map data + var sourceMapData; + return { + getSourceMapData: function () { return sourceMapData; }, + setSourceFile: setSourceFile, + emitPos: emitPos, + emitStart: emitStart, + emitEnd: emitEnd, + changeEmitSourcePos: changeEmitSourcePos, + getText: getText, + getSourceMappingURL: getSourceMappingURL, + initialize: initialize, + reset: reset + }; + function initialize(filePath, sourceMapFilePath, sourceFiles, isBundledEmit) { + if (sourceMapData) { + reset(); + } + currentSourceFile = undefined; + // Current source map file and its index in the sources list + sourceMapSourceIndex = -1; + // Last recorded and encoded spans + lastRecordedSourceMapSpan = undefined; + lastEncodedSourceMapSpan = defaultLastEncodedSourceMapSpan; + lastEncodedNameIndex = 0; + // Initialize source map data + sourceMapData = { + sourceMapFilePath: sourceMapFilePath, + jsSourceMappingURL: !compilerOptions.inlineSourceMap ? ts.getBaseFileName(ts.normalizeSlashes(sourceMapFilePath)) : undefined, + sourceMapFile: ts.getBaseFileName(ts.normalizeSlashes(filePath)), + sourceMapSourceRoot: compilerOptions.sourceRoot || "", + sourceMapSources: [], + inputSourceFileNames: [], + sourceMapNames: [], + sourceMapMappings: "", + sourceMapSourcesContent: compilerOptions.inlineSources ? [] : undefined, + sourceMapDecodedMappings: [] + }; + // Normalize source root and make sure it has trailing "/" so that it can be used to combine paths with the + // relative paths of the sources list in the sourcemap + sourceMapData.sourceMapSourceRoot = ts.normalizeSlashes(sourceMapData.sourceMapSourceRoot); + if (sourceMapData.sourceMapSourceRoot.length && sourceMapData.sourceMapSourceRoot.charCodeAt(sourceMapData.sourceMapSourceRoot.length - 1) !== 47 /* slash */) { + sourceMapData.sourceMapSourceRoot += ts.directorySeparator; + } + if (compilerOptions.mapRoot) { + sourceMapDir = ts.normalizeSlashes(compilerOptions.mapRoot); + if (!isBundledEmit) { + ts.Debug.assert(sourceFiles.length === 1); + // For modules or multiple emit files the mapRoot will have directory structure like the sources + // So if src\a.ts and src\lib\b.ts are compiled together user would be moving the maps into mapRoot\a.js.map and mapRoot\lib\b.js.map + sourceMapDir = ts.getDirectoryPath(ts.getSourceFilePathInNewDir(sourceFiles[0], host, sourceMapDir)); + } + if (!ts.isRootedDiskPath(sourceMapDir) && !ts.isUrl(sourceMapDir)) { + // The relative paths are relative to the common directory + sourceMapDir = ts.combinePaths(host.getCommonSourceDirectory(), sourceMapDir); + sourceMapData.jsSourceMappingURL = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizePath(filePath)), // get the relative sourceMapDir path based on jsFilePath + ts.combinePaths(sourceMapDir, sourceMapData.jsSourceMappingURL), // this is where user expects to see sourceMap + host.getCurrentDirectory(), host.getCanonicalFileName, + /*isAbsolutePathAnUrl*/ true); + } + else { + sourceMapData.jsSourceMappingURL = ts.combinePaths(sourceMapDir, sourceMapData.jsSourceMappingURL); + } + } + else { + sourceMapDir = ts.getDirectoryPath(ts.normalizePath(filePath)); + } + } + function reset() { + currentSourceFile = undefined; + sourceMapDir = undefined; + sourceMapSourceIndex = undefined; + lastRecordedSourceMapSpan = undefined; + lastEncodedSourceMapSpan = undefined; + lastEncodedNameIndex = undefined; + sourceMapData = undefined; + } + function updateLastEncodedAndRecordedSpans() { + if (modifyLastSourcePos) { + // Reset the source pos + modifyLastSourcePos = false; + // Change Last recorded Map with last encoded emit line and character + lastRecordedSourceMapSpan.emittedLine = lastEncodedSourceMapSpan.emittedLine; + lastRecordedSourceMapSpan.emittedColumn = lastEncodedSourceMapSpan.emittedColumn; + // Pop sourceMapDecodedMappings to remove last entry + sourceMapData.sourceMapDecodedMappings.pop(); + // Point the lastEncodedSourceMapSpace to the previous encoded sourceMapSpan + // If the list is empty which indicates that we are at the beginning of the file, + // we have to reset it to default value (same value when we first initialize sourceMapWriter) + lastEncodedSourceMapSpan = sourceMapData.sourceMapDecodedMappings.length ? + sourceMapData.sourceMapDecodedMappings[sourceMapData.sourceMapDecodedMappings.length - 1] : + defaultLastEncodedSourceMapSpan; + // TODO: Update lastEncodedNameIndex + // Since we dont support this any more, lets not worry about it right now. + // When we start supporting nameIndex, we will get back to this + // Change the encoded source map + var sourceMapMappings = sourceMapData.sourceMapMappings; + var lenthToSet = sourceMapMappings.length - 1; + for (; lenthToSet >= 0; lenthToSet--) { + var currentChar = sourceMapMappings.charAt(lenthToSet); + if (currentChar === ",") { + // Separator for the entry found + break; + } + if (currentChar === ";" && lenthToSet !== 0 && sourceMapMappings.charAt(lenthToSet - 1) !== ";") { + // Last line separator found + break; + } + } + sourceMapData.sourceMapMappings = sourceMapMappings.substr(0, Math.max(0, lenthToSet)); + } + } + // Encoding for sourcemap span + function encodeLastRecordedSourceMapSpan() { + if (!lastRecordedSourceMapSpan || lastRecordedSourceMapSpan === lastEncodedSourceMapSpan) { + return; + } + var prevEncodedEmittedColumn = lastEncodedSourceMapSpan.emittedColumn; + // Line/Comma delimiters + if (lastEncodedSourceMapSpan.emittedLine === lastRecordedSourceMapSpan.emittedLine) { + // Emit comma to separate the entry + if (sourceMapData.sourceMapMappings) { + sourceMapData.sourceMapMappings += ","; + } + } + else { + // Emit line delimiters + for (var encodedLine = lastEncodedSourceMapSpan.emittedLine; encodedLine < lastRecordedSourceMapSpan.emittedLine; encodedLine++) { + sourceMapData.sourceMapMappings += ";"; + } + prevEncodedEmittedColumn = 1; + } + // 1. Relative Column 0 based + sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.emittedColumn - prevEncodedEmittedColumn); + // 2. Relative sourceIndex + sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceIndex - lastEncodedSourceMapSpan.sourceIndex); + // 3. Relative sourceLine 0 based + sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceLine - lastEncodedSourceMapSpan.sourceLine); + // 4. Relative sourceColumn 0 based + sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceColumn - lastEncodedSourceMapSpan.sourceColumn); + // 5. Relative namePosition 0 based + if (lastRecordedSourceMapSpan.nameIndex >= 0) { + ts.Debug.assert(false, "We do not support name index right now, Make sure to update updateLastEncodedAndRecordedSpans when we start using this"); + sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.nameIndex - lastEncodedNameIndex); + lastEncodedNameIndex = lastRecordedSourceMapSpan.nameIndex; + } + lastEncodedSourceMapSpan = lastRecordedSourceMapSpan; + sourceMapData.sourceMapDecodedMappings.push(lastEncodedSourceMapSpan); + } + function emitPos(pos) { + if (pos === -1) { + return; + } + var sourceLinePos = ts.getLineAndCharacterOfPosition(currentSourceFile, pos); + // Convert the location to be one-based. + sourceLinePos.line++; + sourceLinePos.character++; + 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 || + lastRecordedSourceMapSpan.emittedColumn !== emittedColumn || + (lastRecordedSourceMapSpan.sourceIndex === sourceMapSourceIndex && + (lastRecordedSourceMapSpan.sourceLine > sourceLinePos.line || + (lastRecordedSourceMapSpan.sourceLine === sourceLinePos.line && lastRecordedSourceMapSpan.sourceColumn > sourceLinePos.character)))) { + // Encode the last recordedSpan before assigning new + encodeLastRecordedSourceMapSpan(); + // New span + lastRecordedSourceMapSpan = { + emittedLine: emittedLine, + emittedColumn: emittedColumn, + sourceLine: sourceLinePos.line, + sourceColumn: sourceLinePos.character, + sourceIndex: sourceMapSourceIndex + }; + stopOverridingSpan = false; + } + else if (!stopOverridingSpan) { + // Take the new pos instead since there is no change in emittedLine and column since last location + lastRecordedSourceMapSpan.sourceLine = sourceLinePos.line; + lastRecordedSourceMapSpan.sourceColumn = sourceLinePos.character; + lastRecordedSourceMapSpan.sourceIndex = sourceMapSourceIndex; + } + updateLastEncodedAndRecordedSpans(); + } + function getStartPos(range) { + var rangeHasDecorators = !!range.decorators; + return range.pos !== -1 ? ts.skipTrivia(currentSourceFile.text, rangeHasDecorators ? range.decorators.end : range.pos) : -1; + } + function emitStart(range) { + emitPos(getStartPos(range)); + } + function emitEnd(range, stopOverridingEnd) { + emitPos(range.end); + stopOverridingSpan = stopOverridingEnd; + } + function changeEmitSourcePos() { + ts.Debug.assert(!modifyLastSourcePos); + modifyLastSourcePos = true; + } + function setSourceFile(sourceFile) { + currentSourceFile = sourceFile; + // 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, currentSourceFile.fileName, host.getCurrentDirectory(), host.getCanonicalFileName, + /*isAbsolutePathAnUrl*/ true); + sourceMapSourceIndex = ts.indexOf(sourceMapData.sourceMapSources, 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(sourceFile.fileName); + if (compilerOptions.inlineSources) { + sourceMapData.sourceMapSourcesContent.push(sourceFile.text); + } + } + } + function getText() { + encodeLastRecordedSourceMapSpan(); + return ts.stringify({ + version: 3, + file: sourceMapData.sourceMapFile, + sourceRoot: sourceMapData.sourceMapSourceRoot, + sources: sourceMapData.sourceMapSources, + names: sourceMapData.sourceMapNames, + mappings: sourceMapData.sourceMapMappings, + sourcesContent: sourceMapData.sourceMapSourcesContent + }); + } + function getSourceMappingURL() { + if (compilerOptions.inlineSourceMap) { + // Encode the sourceMap into the sourceMap url + var base64SourceMapText = ts.convertToBase64(getText()); + return sourceMapData.jsSourceMappingURL = "data:application/json;base64," + base64SourceMapText; + } + else { + return sourceMapData.jsSourceMappingURL; + } + } + } + ts.createSourceMapWriter = createSourceMapWriter; + var base64Chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + function base64FormatEncode(inValue) { + if (inValue < 64) { + return base64Chars.charAt(inValue); + } + throw TypeError(inValue + ": not a 64 based value"); + } + function base64VLQFormatEncode(inValue) { + // Add a new least significant bit that has the sign of the value. + // if negative number the least significant bit that gets added to the number has value 1 + // else least significant bit value that gets added is 0 + // eg. -1 changes to binary : 01 [1] => 3 + // +1 changes to binary : 01 [0] => 2 + if (inValue < 0) { + inValue = ((-inValue) << 1) + 1; + } + else { + inValue = inValue << 1; + } + // Encode 5 bits at a time starting from least significant bits + var encodedStr = ""; + do { + var currentDigit = inValue & 31; // 11111 + inValue = inValue >> 5; + if (inValue > 0) { + // There are still more digits to decode, set the msb (6th bit) + currentDigit = currentDigit | 32; + } + encodedStr = encodedStr + base64FormatEncode(currentDigit); + } while (inValue > 0); + return encodedStr; + } +})(ts || (ts = {})); +/// +/* @internal */ +var ts; (function (ts) { function getDeclarationDiagnostics(host, resolver, targetSourceFile) { - var diagnostics = []; - var jsFilePath = ts.getOwnEmitOutputFilePath(targetSourceFile, host, ".js"); - emitDeclarations(host, resolver, diagnostics, jsFilePath, targetSourceFile); - return diagnostics; + var declarationDiagnostics = ts.createDiagnosticCollection(); + ts.forEachExpectedEmitFile(host, getDeclarationDiagnosticsFromFile, targetSourceFile); + return declarationDiagnostics.getDiagnostics(targetSourceFile ? targetSourceFile.fileName : undefined); + function getDeclarationDiagnosticsFromFile(_a, sources, isBundledEmit) { + var declarationFilePath = _a.declarationFilePath; + emitDeclarations(host, resolver, declarationDiagnostics, declarationFilePath, sources, isBundledEmit); + } } ts.getDeclarationDiagnostics = getDeclarationDiagnostics; - function emitDeclarations(host, resolver, diagnostics, jsFilePath, root) { + function emitDeclarations(host, resolver, emitterDiagnostics, declarationFilePath, sourceFiles, isBundledEmit) { var newLine = host.getNewLine(); var compilerOptions = host.getCompilerOptions(); var write; @@ -28558,8 +32632,10 @@ var ts; var increaseIndent; var decreaseIndent; var writeTextOfNode; - var writer = createAndSetNewTextWriterWithSymbolWriter(); + var writer; + createAndSetNewTextWriterWithSymbolWriter(); var enclosingDeclaration; + var resultHasExternalModuleIndicator; var currentText; var currentLineMap; var currentIdentifiers; @@ -28568,105 +32644,97 @@ var ts; var errorNameNode; var emitJsDocComments = compilerOptions.removeComments ? function (declaration) { } : writeJsDocComments; var emit = compilerOptions.stripInternal ? stripInternal : emitNode; - var noDeclare = !root; + var noDeclare; var moduleElementDeclarationEmitInfo = []; var asynchronousSubModuleDeclarationEmitInfo; // Contains the reference paths that needs to go in the declaration file. // Collecting this separately because reference paths need to be first thing in the declaration file // and we could be collecting these paths from multiple files into single one with --out option - var referencePathsOutput = ""; - if (root) { - // Emitting just a single file, so emit references in this file only + var referencesOutput = ""; + var usedTypeDirectiveReferences; + // Emit references corresponding to each file + var emittedReferencedFiles = []; + var addedGlobalFileReference = false; + var allSourcesModuleElementDeclarationEmitInfo = []; + ts.forEach(sourceFiles, function (sourceFile) { + // Dont emit for javascript file + if (ts.isSourceFileJavaScript(sourceFile)) { + return; + } + // Check what references need to be added if (!compilerOptions.noResolve) { - var addedGlobalFileReference = false; - ts.forEach(root.referencedFiles, function (fileReference) { - var referencedFile = ts.tryResolveScriptReference(host, root, fileReference); - // All the references that are not going to be part of same file - if (referencedFile && ((referencedFile.flags & 4096 /* DeclarationFile */) || - ts.shouldEmitToOwnFile(referencedFile, compilerOptions) || - !addedGlobalFileReference)) { - writeReferencePath(referencedFile); - if (!ts.isExternalModuleOrDeclarationFile(referencedFile)) { + ts.forEach(sourceFile.referencedFiles, function (fileReference) { + var referencedFile = ts.tryResolveScriptReference(host, sourceFile, fileReference); + // Emit reference in dts, if the file reference was not already emitted + if (referencedFile && !ts.contains(emittedReferencedFiles, referencedFile)) { + // Add a reference to generated dts file, + // global file reference is added only + // - if it is not bundled emit (because otherwise it would be self reference) + // - and it is not already added + if (writeReferencePath(referencedFile, !isBundledEmit && !addedGlobalFileReference)) { addedGlobalFileReference = true; } + emittedReferencedFiles.push(referencedFile); } }); } - emitSourceFile(root); + resultHasExternalModuleIndicator = false; + if (!isBundledEmit || !ts.isExternalModule(sourceFile)) { + noDeclare = false; + emitSourceFile(sourceFile); + } + else if (ts.isExternalModule(sourceFile)) { + noDeclare = true; + write("declare module \"" + ts.getResolvedExternalModuleName(host, sourceFile) + "\" {"); + writeLine(); + increaseIndent(); + emitSourceFile(sourceFile); + decreaseIndent(); + write("}"); + writeLine(); + } // create asynchronous output for the importDeclarations if (moduleElementDeclarationEmitInfo.length) { var oldWriter = writer; ts.forEach(moduleElementDeclarationEmitInfo, function (aliasEmitInfo) { - if (aliasEmitInfo.isVisible) { - ts.Debug.assert(aliasEmitInfo.node.kind === 222 /* ImportDeclaration */); + if (aliasEmitInfo.isVisible && !aliasEmitInfo.asynchronousOutput) { + ts.Debug.assert(aliasEmitInfo.node.kind === 230 /* ImportDeclaration */); createAndSetNewTextWriterWithSymbolWriter(); - ts.Debug.assert(aliasEmitInfo.indent === 0); + ts.Debug.assert(aliasEmitInfo.indent === 0 || (aliasEmitInfo.indent === 1 && isBundledEmit)); + for (var i = 0; i < aliasEmitInfo.indent; i++) { + increaseIndent(); + } writeImportDeclaration(aliasEmitInfo.node); aliasEmitInfo.asynchronousOutput = writer.getText(); + for (var i = 0; i < aliasEmitInfo.indent; i++) { + decreaseIndent(); + } } }); setWriter(oldWriter); + allSourcesModuleElementDeclarationEmitInfo = allSourcesModuleElementDeclarationEmitInfo.concat(moduleElementDeclarationEmitInfo); + moduleElementDeclarationEmitInfo = []; } - } - else { - // Emit references corresponding to this file - var emittedReferencedFiles = []; - var prevModuleElementDeclarationEmitInfo = []; - ts.forEach(host.getSourceFiles(), function (sourceFile) { - if (!ts.isDeclarationFile(sourceFile)) { - // Check what references need to be added - if (!compilerOptions.noResolve) { - ts.forEach(sourceFile.referencedFiles, function (fileReference) { - var referencedFile = ts.tryResolveScriptReference(host, sourceFile, fileReference); - // If the reference file is a declaration file, emit that reference - if (referencedFile && (ts.isDeclarationFile(referencedFile) && - !ts.contains(emittedReferencedFiles, referencedFile))) { - writeReferencePath(referencedFile); - emittedReferencedFiles.push(referencedFile); - } - }); - } + if (!isBundledEmit && ts.isExternalModule(sourceFile) && sourceFile.moduleAugmentations.length && !resultHasExternalModuleIndicator) { + // if file was external module with augmentations - this fact should be preserved in .d.ts as well. + // in case if we didn't write any external module specifiers in .d.ts we need to emit something + // that will force compiler to think that this file is an external module - 'export {}' is a reasonable choice here. + write("export {};"); + writeLine(); + } + }); + if (usedTypeDirectiveReferences) { + for (var directive in usedTypeDirectiveReferences) { + if (ts.hasProperty(usedTypeDirectiveReferences, directive)) { + referencesOutput += "/// " + newLine; } - if (!ts.isExternalModuleOrDeclarationFile(sourceFile)) { - noDeclare = false; - emitSourceFile(sourceFile); - } - else if (ts.isExternalModule(sourceFile)) { - noDeclare = true; - write("declare module \"" + ts.getResolvedExternalModuleName(host, sourceFile) + "\" {"); - writeLine(); - increaseIndent(); - emitSourceFile(sourceFile); - decreaseIndent(); - write("}"); - writeLine(); - // create asynchronous output for the importDeclarations - if (moduleElementDeclarationEmitInfo.length) { - var oldWriter = writer; - ts.forEach(moduleElementDeclarationEmitInfo, function (aliasEmitInfo) { - if (aliasEmitInfo.isVisible && !aliasEmitInfo.asynchronousOutput) { - ts.Debug.assert(aliasEmitInfo.node.kind === 222 /* ImportDeclaration */); - createAndSetNewTextWriterWithSymbolWriter(); - ts.Debug.assert(aliasEmitInfo.indent === 1); - increaseIndent(); - writeImportDeclaration(aliasEmitInfo.node); - aliasEmitInfo.asynchronousOutput = writer.getText(); - decreaseIndent(); - } - }); - setWriter(oldWriter); - } - prevModuleElementDeclarationEmitInfo = prevModuleElementDeclarationEmitInfo.concat(moduleElementDeclarationEmitInfo); - moduleElementDeclarationEmitInfo = []; - } - }); - moduleElementDeclarationEmitInfo = moduleElementDeclarationEmitInfo.concat(prevModuleElementDeclarationEmitInfo); + } } return { reportedDeclarationError: reportedDeclarationError, - moduleElementDeclarationEmitInfo: moduleElementDeclarationEmitInfo, + moduleElementDeclarationEmitInfo: allSourcesModuleElementDeclarationEmitInfo, synchronousDeclarationOutput: writer.getText(), - referencePathsOutput: referencePathsOutput + referencesOutput: referencesOutput }; function hasInternalAnnotation(range) { var comment = currentText.substring(range.pos, range.end); @@ -28693,7 +32761,6 @@ var ts; writer.writeParameter = writer.write; writer.writeSymbol = writer.write; setWriter(writer); - return writer; } function setWriter(newWriter) { writer = newWriter; @@ -28707,10 +32774,10 @@ var ts; var oldWriter = writer; ts.forEach(nodes, function (declaration) { var nodeToCheck; - if (declaration.kind === 211 /* VariableDeclaration */) { + if (declaration.kind === 218 /* VariableDeclaration */) { nodeToCheck = declaration.parent.parent; } - else if (declaration.kind === 225 /* NamedImports */ || declaration.kind === 226 /* ImportSpecifier */ || declaration.kind === 223 /* ImportClause */) { + else if (declaration.kind === 233 /* NamedImports */ || declaration.kind === 234 /* ImportSpecifier */ || declaration.kind === 231 /* ImportClause */) { ts.Debug.fail("We should be getting ImportDeclaration instead to write"); } else { @@ -28728,7 +32795,7 @@ var ts; // Writing of function bar would mark alias declaration foo as visible but we haven't yet visited that declaration so do nothing, // we would write alias foo declaration when we visit it since it would now be marked as visible if (moduleElementEmitInfo) { - if (moduleElementEmitInfo.node.kind === 222 /* ImportDeclaration */) { + if (moduleElementEmitInfo.node.kind === 230 /* ImportDeclaration */) { // we have to create asynchronous output only after we have collected complete information // because it is possible to enable multiple bindings as asynchronously visible moduleElementEmitInfo.isVisible = true; @@ -28738,12 +32805,12 @@ var ts; for (var declarationIndent = moduleElementEmitInfo.indent; declarationIndent; declarationIndent--) { increaseIndent(); } - if (nodeToCheck.kind === 218 /* ModuleDeclaration */) { + if (nodeToCheck.kind === 225 /* ModuleDeclaration */) { ts.Debug.assert(asynchronousSubModuleDeclarationEmitInfo === undefined); asynchronousSubModuleDeclarationEmitInfo = []; } writeModuleElement(nodeToCheck); - if (nodeToCheck.kind === 218 /* ModuleDeclaration */) { + if (nodeToCheck.kind === 225 /* ModuleDeclaration */) { moduleElementEmitInfo.subModuleElementDeclarationEmitInfo = asynchronousSubModuleDeclarationEmitInfo; asynchronousSubModuleDeclarationEmitInfo = undefined; } @@ -28753,33 +32820,49 @@ var ts; }); setWriter(oldWriter); } - function handleSymbolAccessibilityError(symbolAccesibilityResult) { - if (symbolAccesibilityResult.accessibility === 0 /* Accessible */) { + function recordTypeReferenceDirectivesIfNecessary(typeReferenceDirectives) { + if (!typeReferenceDirectives) { + return; + } + if (!usedTypeDirectiveReferences) { + usedTypeDirectiveReferences = {}; + } + for (var _i = 0, typeReferenceDirectives_1 = typeReferenceDirectives; _i < typeReferenceDirectives_1.length; _i++) { + var directive = typeReferenceDirectives_1[_i]; + if (!ts.hasProperty(usedTypeDirectiveReferences, directive)) { + usedTypeDirectiveReferences[directive] = directive; + } + } + } + function handleSymbolAccessibilityError(symbolAccessibilityResult) { + if (symbolAccessibilityResult.accessibility === 0 /* Accessible */) { // write the aliases - if (symbolAccesibilityResult && symbolAccesibilityResult.aliasesToMakeVisible) { - writeAsynchronousModuleElements(symbolAccesibilityResult.aliasesToMakeVisible); + if (symbolAccessibilityResult && symbolAccessibilityResult.aliasesToMakeVisible) { + writeAsynchronousModuleElements(symbolAccessibilityResult.aliasesToMakeVisible); } } else { // Report error reportedDeclarationError = true; - var errorInfo = writer.getSymbolAccessibilityDiagnostic(symbolAccesibilityResult); + var errorInfo = writer.getSymbolAccessibilityDiagnostic(symbolAccessibilityResult); if (errorInfo) { if (errorInfo.typeName) { - diagnostics.push(ts.createDiagnosticForNode(symbolAccesibilityResult.errorNode || errorInfo.errorNode, errorInfo.diagnosticMessage, ts.getTextOfNodeFromSourceText(currentText, errorInfo.typeName), symbolAccesibilityResult.errorSymbolName, symbolAccesibilityResult.errorModuleName)); + emitterDiagnostics.add(ts.createDiagnosticForNode(symbolAccessibilityResult.errorNode || errorInfo.errorNode, errorInfo.diagnosticMessage, ts.getTextOfNodeFromSourceText(currentText, errorInfo.typeName), symbolAccessibilityResult.errorSymbolName, symbolAccessibilityResult.errorModuleName)); } else { - diagnostics.push(ts.createDiagnosticForNode(symbolAccesibilityResult.errorNode || errorInfo.errorNode, errorInfo.diagnosticMessage, symbolAccesibilityResult.errorSymbolName, symbolAccesibilityResult.errorModuleName)); + emitterDiagnostics.add(ts.createDiagnosticForNode(symbolAccessibilityResult.errorNode || errorInfo.errorNode, errorInfo.diagnosticMessage, symbolAccessibilityResult.errorSymbolName, symbolAccessibilityResult.errorModuleName)); } } } } function trackSymbol(symbol, enclosingDeclaration, meaning) { handleSymbolAccessibilityError(resolver.isSymbolAccessible(symbol, enclosingDeclaration, meaning)); + recordTypeReferenceDirectivesIfNecessary(resolver.getTypeReferenceDirectivesForSymbol(symbol, meaning)); } function reportInaccessibleThisError() { if (errorNameNode) { - diagnostics.push(ts.createDiagnosticForNode(errorNameNode, ts.Diagnostics.The_inferred_type_of_0_references_an_inaccessible_this_type_A_type_annotation_is_necessary, ts.declarationNameToString(errorNameNode))); + reportedDeclarationError = true; + emitterDiagnostics.add(ts.createDiagnosticForNode(errorNameNode, ts.Diagnostics.The_inferred_type_of_0_references_an_inaccessible_this_type_A_type_annotation_is_necessary, ts.declarationNameToString(errorNameNode))); } } function writeTypeOfDeclaration(declaration, type, getSymbolAccessibilityDiagnostic) { @@ -28845,40 +32928,43 @@ var ts; function emitType(type) { switch (type.kind) { case 117 /* AnyKeyword */: - case 130 /* StringKeyword */: - case 128 /* NumberKeyword */: + case 132 /* StringKeyword */: + case 130 /* NumberKeyword */: case 120 /* BooleanKeyword */: - case 131 /* SymbolKeyword */: + case 133 /* SymbolKeyword */: case 103 /* VoidKeyword */: - case 97 /* ThisKeyword */: - case 9 /* StringLiteral */: + case 135 /* UndefinedKeyword */: + case 93 /* NullKeyword */: + case 127 /* NeverKeyword */: + case 165 /* ThisType */: + case 166 /* StringLiteralType */: return writeTextOfNode(currentText, type); - case 188 /* ExpressionWithTypeArguments */: + case 194 /* ExpressionWithTypeArguments */: return emitExpressionWithTypeArguments(type); - case 151 /* TypeReference */: + case 155 /* TypeReference */: return emitTypeReference(type); - case 154 /* TypeQuery */: + case 158 /* TypeQuery */: return emitTypeQuery(type); - case 156 /* ArrayType */: + case 160 /* ArrayType */: return emitArrayType(type); - case 157 /* TupleType */: + case 161 /* TupleType */: return emitTupleType(type); - case 158 /* UnionType */: + case 162 /* UnionType */: return emitUnionType(type); - case 159 /* IntersectionType */: + case 163 /* IntersectionType */: return emitIntersectionType(type); - case 160 /* ParenthesizedType */: + case 164 /* ParenthesizedType */: return emitParenType(type); - case 152 /* FunctionType */: - case 153 /* ConstructorType */: + case 156 /* FunctionType */: + case 157 /* ConstructorType */: return emitSignatureDeclarationWithJsDocComments(type); - case 155 /* TypeLiteral */: + case 159 /* TypeLiteral */: return emitTypeLiteral(type); case 69 /* Identifier */: return emitEntityName(type); - case 135 /* QualifiedName */: + case 139 /* QualifiedName */: return emitEntityName(type); - case 150 /* TypePredicate */: + case 154 /* TypePredicate */: return emitTypePredicate(type); } function writeEntityName(entityName) { @@ -28886,8 +32972,8 @@ var ts; writeTextOfNode(currentText, entityName); } else { - var left = entityName.kind === 135 /* QualifiedName */ ? entityName.left : entityName.expression; - var right = entityName.kind === 135 /* QualifiedName */ ? entityName.right : entityName.name; + var left = entityName.kind === 139 /* QualifiedName */ ? entityName.left : entityName.expression; + var right = entityName.kind === 139 /* QualifiedName */ ? entityName.right : entityName.name; writeEntityName(left); write("."); writeTextOfNode(currentText, right); @@ -28896,13 +32982,14 @@ var ts; function emitEntityName(entityName) { var visibilityResult = resolver.isEntityNameVisible(entityName, // Aliases can be written asynchronously so use correct enclosing declaration - entityName.parent.kind === 221 /* ImportEqualsDeclaration */ ? entityName.parent : enclosingDeclaration); + entityName.parent.kind === 229 /* ImportEqualsDeclaration */ ? entityName.parent : enclosingDeclaration); handleSymbolAccessibilityError(visibilityResult); + recordTypeReferenceDirectivesIfNecessary(resolver.getTypeReferenceDirectivesForEntityName(entityName)); writeEntityName(entityName); } function emitExpressionWithTypeArguments(node) { if (ts.isSupportedExpressionWithTypeArguments(node)) { - ts.Debug.assert(node.expression.kind === 69 /* Identifier */ || node.expression.kind === 166 /* PropertyAccessExpression */); + ts.Debug.assert(node.expression.kind === 69 /* Identifier */ || node.expression.kind === 172 /* PropertyAccessExpression */); emitEntityName(node.expression); if (node.typeArguments) { write("<"); @@ -28980,9 +33067,10 @@ var ts; } var count = 0; while (true) { - var name_18 = baseName + "_" + (++count); - if (!ts.hasProperty(currentIdentifiers, name_18)) { - return name_18; + count++; + var name_22 = baseName + "_" + count; + if (!ts.hasProperty(currentIdentifiers, name_22)) { + return name_22; } } } @@ -28994,7 +33082,10 @@ var ts; else { // Expression var tempVarName = getExportDefaultTempVariableName(); - write("declare var "); + if (!noDeclare) { + write("declare "); + } + write("var "); write(tempVarName); write(": "); writer.getSymbolAccessibilityDiagnostic = getDefaultExportAccessibilityDiagnostic; @@ -29026,10 +33117,10 @@ var ts; if (isModuleElementVisible) { writeModuleElement(node); } - else if (node.kind === 221 /* ImportEqualsDeclaration */ || - (node.parent.kind === 248 /* SourceFile */ && isCurrentFileExternalModule)) { - var isVisible; - if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 248 /* SourceFile */) { + else if (node.kind === 229 /* ImportEqualsDeclaration */ || + (node.parent.kind === 256 /* SourceFile */ && isCurrentFileExternalModule)) { + var isVisible = void 0; + if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 256 /* SourceFile */) { // Import declaration of another module that is visited async so lets put it in right spot asynchronousSubModuleDeclarationEmitInfo.push({ node: node, @@ -29039,7 +33130,7 @@ var ts; }); } else { - if (node.kind === 222 /* ImportDeclaration */) { + if (node.kind === 230 /* ImportDeclaration */) { var importDeclaration = node; if (importDeclaration.importClause) { isVisible = (importDeclaration.importClause.name && resolver.isDeclarationVisible(importDeclaration.importClause)) || @@ -29057,23 +33148,23 @@ var ts; } function writeModuleElement(node) { switch (node.kind) { - case 213 /* FunctionDeclaration */: + case 220 /* FunctionDeclaration */: return writeFunctionDeclaration(node); - case 193 /* VariableStatement */: + case 200 /* VariableStatement */: return writeVariableStatement(node); - case 215 /* InterfaceDeclaration */: + case 222 /* InterfaceDeclaration */: return writeInterfaceDeclaration(node); - case 214 /* ClassDeclaration */: + case 221 /* ClassDeclaration */: return writeClassDeclaration(node); - case 216 /* TypeAliasDeclaration */: + case 223 /* TypeAliasDeclaration */: return writeTypeAliasDeclaration(node); - case 217 /* EnumDeclaration */: + case 224 /* EnumDeclaration */: return writeEnumDeclaration(node); - case 218 /* ModuleDeclaration */: + case 225 /* ModuleDeclaration */: return writeModuleDeclaration(node); - case 221 /* ImportEqualsDeclaration */: + case 229 /* ImportEqualsDeclaration */: return writeImportEqualsDeclaration(node); - case 222 /* ImportDeclaration */: + case 230 /* ImportDeclaration */: return writeImportDeclaration(node); default: ts.Debug.fail("Unknown symbol kind"); @@ -29081,30 +33172,33 @@ var ts; } function emitModuleElementDeclarationFlags(node) { // If the node is parented in the current source file we need to emit export declare or just export - if (node.parent.kind === 248 /* SourceFile */) { + if (node.parent.kind === 256 /* SourceFile */) { // If the node is exported - if (node.flags & 2 /* Export */) { + if (node.flags & 1 /* Export */) { write("export "); } if (node.flags & 512 /* Default */) { write("default "); } - else if (node.kind !== 215 /* InterfaceDeclaration */ && !noDeclare) { + else if (node.kind !== 222 /* InterfaceDeclaration */ && !noDeclare) { write("declare "); } } } - function emitClassMemberDeclarationFlags(node) { - if (node.flags & 16 /* Private */) { + function emitClassMemberDeclarationFlags(flags) { + if (flags & 8 /* Private */) { write("private "); } - else if (node.flags & 32 /* Protected */) { + else if (flags & 16 /* Protected */) { write("protected "); } - if (node.flags & 64 /* Static */) { + if (flags & 32 /* Static */) { write("static "); } - if (node.flags & 128 /* Abstract */) { + if (flags & 64 /* Readonly */) { + write("readonly "); + } + if (flags & 128 /* Abstract */) { write("abstract "); } } @@ -29112,7 +33206,7 @@ var ts; // note usage of writer. methods instead of aliases created, just to make sure we are using // correct writer especially to handle asynchronous alias writing emitJsDocComments(node); - if (node.flags & 2 /* Export */) { + if (node.flags & 1 /* Export */) { write("export "); } write("import "); @@ -29124,11 +33218,11 @@ var ts; } else { write("require("); - writeTextOfNode(currentText, ts.getExternalModuleImportEqualsDeclarationExpression(node)); + emitExternalModuleSpecifier(node); write(");"); } writer.writeLine(); - function getImportEntityNameVisibilityError(symbolAccesibilityResult) { + function getImportEntityNameVisibilityError(symbolAccessibilityResult) { return { diagnosticMessage: ts.Diagnostics.Import_declaration_0_is_using_private_name_1, errorNode: node, @@ -29138,7 +33232,7 @@ var ts; } function isVisibleNamedBinding(namedBindings) { if (namedBindings) { - if (namedBindings.kind === 224 /* NamespaceImport */) { + if (namedBindings.kind === 232 /* NamespaceImport */) { return resolver.isDeclarationVisible(namedBindings); } else { @@ -29147,12 +33241,8 @@ var ts; } } function writeImportDeclaration(node) { - if (!node.importClause && !(node.flags & 2 /* Export */)) { - // do not write non-exported import declarations that don't have import clauses - return; - } emitJsDocComments(node); - if (node.flags & 2 /* Export */) { + if (node.flags & 1 /* Export */) { write("export "); } write("import "); @@ -29166,7 +33256,7 @@ var ts; // If the default binding was emitted, write the separated write(", "); } - if (node.importClause.namedBindings.kind === 224 /* NamespaceImport */) { + if (node.importClause.namedBindings.kind === 232 /* NamespaceImport */) { write("* as "); writeTextOfNode(currentText, node.importClause.namedBindings.name); } @@ -29178,17 +33268,34 @@ var ts; } write(" from "); } - emitExternalModuleSpecifier(node.moduleSpecifier); + emitExternalModuleSpecifier(node); write(";"); writer.writeLine(); } - function emitExternalModuleSpecifier(moduleSpecifier) { - if (moduleSpecifier.kind === 9 /* StringLiteral */ && (!root) && (compilerOptions.out || compilerOptions.outFile)) { - var moduleName = ts.getExternalModuleNameFromDeclaration(host, resolver, moduleSpecifier.parent); + function emitExternalModuleSpecifier(parent) { + // emitExternalModuleSpecifier is usually called when we emit something in the.d.ts file that will make it an external module (i.e. import/export declarations). + // the only case when it is not true is when we call it to emit correct name for module augmentation - d.ts files with just module augmentations are not considered + // external modules since they are indistinguishable from script files with ambient modules. To fix this in such d.ts files we'll emit top level 'export {}' + // so compiler will treat them as external modules. + resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || parent.kind !== 225 /* ModuleDeclaration */; + var moduleSpecifier; + if (parent.kind === 229 /* ImportEqualsDeclaration */) { + var node = parent; + moduleSpecifier = ts.getExternalModuleImportEqualsDeclarationExpression(node); + } + else if (parent.kind === 225 /* ModuleDeclaration */) { + moduleSpecifier = parent.name; + } + else { + var node = parent; + moduleSpecifier = node.moduleSpecifier; + } + if (moduleSpecifier.kind === 9 /* StringLiteral */ && isBundledEmit && (compilerOptions.out || compilerOptions.outFile)) { + var moduleName = ts.getExternalModuleNameFromDeclaration(host, resolver, parent); if (moduleName) { - write("\""); + write('"'); write(moduleName); - write("\""); + write('"'); return; } } @@ -29221,7 +33328,7 @@ var ts; } if (node.moduleSpecifier) { write(" from "); - emitExternalModuleSpecifier(node.moduleSpecifier); + emitExternalModuleSpecifier(node); } write(";"); writer.writeLine(); @@ -29229,14 +33336,24 @@ var ts; function writeModuleDeclaration(node) { emitJsDocComments(node); emitModuleElementDeclarationFlags(node); - if (node.flags & 65536 /* Namespace */) { - write("namespace "); + if (ts.isGlobalScopeAugmentation(node)) { + write("global "); } else { - write("module "); + if (node.flags & 4096 /* Namespace */) { + write("namespace "); + } + else { + write("module "); + } + if (ts.isExternalModuleAugmentation(node)) { + emitExternalModuleSpecifier(node); + } + else { + writeTextOfNode(currentText, node.name); + } } - writeTextOfNode(currentText, node.name); - while (node.body.kind !== 219 /* ModuleBlock */) { + while (node.body.kind !== 226 /* ModuleBlock */) { node = node.body; write("."); writeTextOfNode(currentText, node.name); @@ -29265,7 +33382,7 @@ var ts; write(";"); writeLine(); enclosingDeclaration = prevEnclosingDeclaration; - function getTypeAliasDeclarationVisibilityError(symbolAccesibilityResult) { + function getTypeAliasDeclarationVisibilityError(symbolAccessibilityResult) { return { diagnosticMessage: ts.Diagnostics.Exported_type_alias_0_has_or_is_using_private_name_1, errorNode: node.type, @@ -29301,7 +33418,7 @@ var ts; writeLine(); } function isPrivateMethodTypeParameter(node) { - return node.parent.kind === 143 /* MethodDeclaration */ && (node.parent.flags & 16 /* Private */); + return node.parent.kind === 147 /* MethodDeclaration */ && (node.parent.flags & 8 /* Private */); } function emitTypeParameters(typeParameters) { function emitTypeParameter(node) { @@ -29312,50 +33429,50 @@ var ts; // If there is constraint present and this is not a type parameter of the private method emit the constraint if (node.constraint && !isPrivateMethodTypeParameter(node)) { write(" extends "); - if (node.parent.kind === 152 /* FunctionType */ || - node.parent.kind === 153 /* ConstructorType */ || - (node.parent.parent && node.parent.parent.kind === 155 /* TypeLiteral */)) { - ts.Debug.assert(node.parent.kind === 143 /* MethodDeclaration */ || - node.parent.kind === 142 /* MethodSignature */ || - node.parent.kind === 152 /* FunctionType */ || - node.parent.kind === 153 /* ConstructorType */ || - node.parent.kind === 147 /* CallSignature */ || - node.parent.kind === 148 /* ConstructSignature */); + if (node.parent.kind === 156 /* FunctionType */ || + node.parent.kind === 157 /* ConstructorType */ || + (node.parent.parent && node.parent.parent.kind === 159 /* TypeLiteral */)) { + ts.Debug.assert(node.parent.kind === 147 /* MethodDeclaration */ || + node.parent.kind === 146 /* MethodSignature */ || + node.parent.kind === 156 /* FunctionType */ || + node.parent.kind === 157 /* ConstructorType */ || + node.parent.kind === 151 /* CallSignature */ || + node.parent.kind === 152 /* ConstructSignature */); emitType(node.constraint); } else { emitTypeWithNewGetSymbolAccessibilityDiagnostic(node.constraint, getTypeParameterConstraintVisibilityError); } } - function getTypeParameterConstraintVisibilityError(symbolAccesibilityResult) { + function getTypeParameterConstraintVisibilityError(symbolAccessibilityResult) { // Type parameter constraints are named by user so we should always be able to name it var diagnosticMessage; switch (node.parent.kind) { - case 214 /* ClassDeclaration */: + case 221 /* ClassDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; - case 215 /* InterfaceDeclaration */: + case 222 /* InterfaceDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; - case 148 /* ConstructSignature */: + case 152 /* ConstructSignature */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 147 /* CallSignature */: + case 151 /* CallSignature */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - if (node.parent.flags & 64 /* Static */) { + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: + if (node.parent.flags & 32 /* Static */) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 214 /* ClassDeclaration */) { + else if (node.parent.parent.kind === 221 /* ClassDeclaration */) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } break; - case 213 /* FunctionDeclaration */: + case 220 /* FunctionDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; default: @@ -29386,10 +33503,14 @@ var ts; else if (!isImplementsList && node.expression.kind === 93 /* NullKeyword */) { write("null"); } - function getHeritageClauseVisibilityError(symbolAccesibilityResult) { + else { + writer.getSymbolAccessibilityDiagnostic = getHeritageClauseVisibilityError; + resolver.writeBaseConstructorTypeOfClass(enclosingDeclaration, enclosingDeclaration, 2 /* UseTypeOfFunction */, writer); + } + function getHeritageClauseVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; // Heritage clause is written by user so it can always be named - if (node.parent.parent.kind === 214 /* ClassDeclaration */) { + if (node.parent.parent.kind === 221 /* ClassDeclaration */) { // Class or Interface implemented/extended is inaccessible diagnosticMessage = isImplementsList ? ts.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 : @@ -29411,7 +33532,7 @@ var ts; function emitParameterProperties(constructorDeclaration) { if (constructorDeclaration) { ts.forEach(constructorDeclaration.parameters, function (param) { - if (param.flags & 56 /* AccessibilityModifier */) { + if (param.flags & 92 /* ParameterPropertyModifier */) { emitPropertyDeclaration(param); } }); @@ -29465,7 +33586,7 @@ var ts; return; } emitJsDocComments(node); - emitClassMemberDeclarationFlags(node); + emitClassMemberDeclarationFlags(node.flags); emitVariableDeclaration(node); write(";"); writeLine(); @@ -29473,7 +33594,7 @@ var ts; function emitVariableDeclaration(node) { // If we are emitting property it isn't moduleElement and hence we already know it needs to be emitted // so there is no check needed to see if declaration is visible - if (node.kind !== 211 /* VariableDeclaration */ || resolver.isDeclarationVisible(node)) { + if (node.kind !== 218 /* VariableDeclaration */ || resolver.isDeclarationVisible(node)) { if (ts.isBindingPattern(node.name)) { emitBindingPattern(node.name); } @@ -29483,51 +33604,51 @@ var ts; // what we want, namely the name expression enclosed in brackets. writeTextOfNode(currentText, node.name); // If optional property emit ? - if ((node.kind === 141 /* PropertyDeclaration */ || node.kind === 140 /* PropertySignature */) && ts.hasQuestionToken(node)) { + if ((node.kind === 145 /* PropertyDeclaration */ || node.kind === 144 /* PropertySignature */ || node.kind === 142 /* Parameter */) && ts.hasQuestionToken(node)) { write("?"); } - if ((node.kind === 141 /* PropertyDeclaration */ || node.kind === 140 /* PropertySignature */) && node.parent.kind === 155 /* TypeLiteral */) { + if ((node.kind === 145 /* PropertyDeclaration */ || node.kind === 144 /* PropertySignature */) && node.parent.kind === 159 /* TypeLiteral */) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } - else if (!(node.flags & 16 /* Private */)) { + else if (!(node.flags & 8 /* Private */)) { writeTypeOfDeclaration(node, node.type, getVariableDeclarationTypeVisibilityError); } } } - function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult) { - if (node.kind === 211 /* VariableDeclaration */) { - return symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? + function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { + if (node.kind === 218 /* VariableDeclaration */) { + return symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Exported_variable_0_has_or_is_using_private_name_1; } - else if (node.kind === 141 /* PropertyDeclaration */ || node.kind === 140 /* PropertySignature */) { + else if (node.kind === 145 /* PropertyDeclaration */ || node.kind === 144 /* PropertySignature */) { // TODO(jfreeman): Deal with computed properties in error reporting. - if (node.flags & 64 /* Static */) { - return symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? + if (node.flags & 32 /* Static */) { + return symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.kind === 214 /* ClassDeclaration */) { - return symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? + else if (node.parent.kind === 221 /* ClassDeclaration */) { + return symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_private_name_1; } else { // Interfaces cannot have types that cannot be named - return symbolAccesibilityResult.errorModuleName ? + return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_private_name_1; } } } - function getVariableDeclarationTypeVisibilityError(symbolAccesibilityResult) { - var diagnosticMessage = getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult); + function getVariableDeclarationTypeVisibilityError(symbolAccessibilityResult) { + var diagnosticMessage = getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult); return diagnosticMessage !== undefined ? { diagnosticMessage: diagnosticMessage, errorNode: node, @@ -29543,15 +33664,15 @@ var ts; var elements = []; for (var _i = 0, _a = bindingPattern.elements; _i < _a.length; _i++) { var element = _a[_i]; - if (element.kind !== 187 /* OmittedExpression */) { + if (element.kind !== 193 /* OmittedExpression */) { elements.push(element); } } emitCommaList(elements, emitBindingElement); } function emitBindingElement(bindingElement) { - function getBindingElementTypeVisibilityError(symbolAccesibilityResult) { - var diagnosticMessage = getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult); + function getBindingElementTypeVisibilityError(symbolAccessibilityResult) { + var diagnosticMessage = getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult); return diagnosticMessage !== undefined ? { diagnosticMessage: diagnosticMessage, errorNode: bindingElement, @@ -29606,14 +33727,14 @@ var ts; if (node === accessors.firstAccessor) { emitJsDocComments(accessors.getAccessor); emitJsDocComments(accessors.setAccessor); - emitClassMemberDeclarationFlags(node); + emitClassMemberDeclarationFlags(node.flags | (accessors.setAccessor ? 0 : 64 /* Readonly */)); writeTextOfNode(currentText, node.name); - if (!(node.flags & 16 /* Private */)) { + if (!(node.flags & 8 /* Private */)) { accessorWithTypeAnnotation = node; var type = getTypeAnnotationFromAccessor(node); if (!type) { // couldn't get type for the first accessor, try the another one - var anotherAccessor = node.kind === 145 /* GetAccessor */ ? accessors.setAccessor : accessors.getAccessor; + var anotherAccessor = node.kind === 149 /* GetAccessor */ ? accessors.setAccessor : accessors.getAccessor; type = getTypeAnnotationFromAccessor(anotherAccessor); if (type) { accessorWithTypeAnnotation = anotherAccessor; @@ -29626,24 +33747,24 @@ var ts; } function getTypeAnnotationFromAccessor(accessor) { if (accessor) { - return accessor.kind === 145 /* GetAccessor */ + return accessor.kind === 149 /* GetAccessor */ ? accessor.type // Getter - return type : accessor.parameters.length > 0 ? accessor.parameters[0].type // Setter parameter type : undefined; } } - function getAccessorDeclarationTypeVisibilityError(symbolAccesibilityResult) { + function getAccessorDeclarationTypeVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; - if (accessorWithTypeAnnotation.kind === 146 /* SetAccessor */) { + if (accessorWithTypeAnnotation.kind === 150 /* SetAccessor */) { // Setters have to have type named and cannot infer it so, the type should always be named - if (accessorWithTypeAnnotation.parent.flags & 64 /* Static */) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + if (accessorWithTypeAnnotation.parent.flags & 32 /* Static */) { + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1; } else { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1; } @@ -29655,16 +33776,16 @@ var ts; }; } else { - if (accessorWithTypeAnnotation.flags & 64 /* Static */) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? + if (accessorWithTypeAnnotation.flags & 32 /* Static */) { + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0; } else { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0; @@ -29685,17 +33806,17 @@ var ts; // so no need to verify if the declaration is visible if (!resolver.isImplementationOfOverload(node)) { emitJsDocComments(node); - if (node.kind === 213 /* FunctionDeclaration */) { + if (node.kind === 220 /* FunctionDeclaration */) { emitModuleElementDeclarationFlags(node); } - else if (node.kind === 143 /* MethodDeclaration */) { - emitClassMemberDeclarationFlags(node); + else if (node.kind === 147 /* MethodDeclaration */ || node.kind === 148 /* Constructor */) { + emitClassMemberDeclarationFlags(node.flags); } - if (node.kind === 213 /* FunctionDeclaration */) { + if (node.kind === 220 /* FunctionDeclaration */) { write("function "); writeTextOfNode(currentText, node.name); } - else if (node.kind === 144 /* Constructor */) { + else if (node.kind === 148 /* Constructor */) { write("constructor"); } else { @@ -29712,37 +33833,50 @@ var ts; emitSignatureDeclaration(node); } function emitSignatureDeclaration(node) { - // Construct signature or constructor type write new Signature - if (node.kind === 148 /* ConstructSignature */ || node.kind === 153 /* ConstructorType */) { - write("new "); - } - emitTypeParameters(node.typeParameters); - if (node.kind === 149 /* IndexSignature */) { + var prevEnclosingDeclaration = enclosingDeclaration; + enclosingDeclaration = node; + var closeParenthesizedFunctionType = false; + if (node.kind === 153 /* IndexSignature */) { + // Index signature can have readonly modifier + emitClassMemberDeclarationFlags(node.flags); write("["); } else { + // Construct signature or constructor type write new Signature + if (node.kind === 152 /* ConstructSignature */ || node.kind === 157 /* ConstructorType */) { + write("new "); + } + else if (node.kind === 156 /* FunctionType */) { + var currentOutput = writer.getText(); + // Do not generate incorrect type when function type with type parameters is type argument + // This could happen if user used space between two '<' making it error free + // e.g var x: A< (a: Tany)=>Tany>; + if (node.typeParameters && currentOutput.charAt(currentOutput.length - 1) === "<") { + closeParenthesizedFunctionType = true; + write("("); + } + } + emitTypeParameters(node.typeParameters); write("("); } - var prevEnclosingDeclaration = enclosingDeclaration; - enclosingDeclaration = node; // Parameters emitCommaList(node.parameters, emitParameterDeclaration); - if (node.kind === 149 /* IndexSignature */) { + if (node.kind === 153 /* IndexSignature */) { write("]"); } else { write(")"); } // If this is not a constructor and is not private, emit the return type - var isFunctionTypeOrConstructorType = node.kind === 152 /* FunctionType */ || node.kind === 153 /* ConstructorType */; - if (isFunctionTypeOrConstructorType || node.parent.kind === 155 /* TypeLiteral */) { + var isFunctionTypeOrConstructorType = node.kind === 156 /* FunctionType */ || node.kind === 157 /* ConstructorType */; + if (isFunctionTypeOrConstructorType || node.parent.kind === 159 /* TypeLiteral */) { // Emit type literal signature return type only if specified if (node.type) { write(isFunctionTypeOrConstructorType ? " => " : ": "); emitType(node.type); } } - else if (node.kind !== 144 /* Constructor */ && !(node.flags & 16 /* Private */)) { + else if (node.kind !== 148 /* Constructor */ && !(node.flags & 8 /* Private */)) { writeReturnTypeAtSignature(node, getReturnTypeVisibilityError); } enclosingDeclaration = prevEnclosingDeclaration; @@ -29750,53 +33884,56 @@ var ts; write(";"); writeLine(); } - function getReturnTypeVisibilityError(symbolAccesibilityResult) { + else if (closeParenthesizedFunctionType) { + write(")"); + } + function getReturnTypeVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; switch (node.kind) { - case 148 /* ConstructSignature */: + case 152 /* ConstructSignature */: // Interfaces cannot have return types that cannot be named - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 147 /* CallSignature */: + case 151 /* CallSignature */: // Interfaces cannot have return types that cannot be named - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 149 /* IndexSignature */: + case 153 /* IndexSignature */: // Interfaces cannot have return types that cannot be named - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - if (node.flags & 64 /* Static */) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: + if (node.flags & 32 /* Static */) { + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0; } - else if (node.parent.kind === 214 /* ClassDeclaration */) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? + else if (node.parent.kind === 221 /* ClassDeclaration */) { + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0; } else { // Interfaces cannot have return types that cannot be named - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; - case 213 /* FunctionDeclaration */: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? + case 220 /* FunctionDeclaration */: + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_private_name_0; @@ -29829,65 +33966,65 @@ var ts; write("?"); } decreaseIndent(); - if (node.parent.kind === 152 /* FunctionType */ || - node.parent.kind === 153 /* ConstructorType */ || - node.parent.parent.kind === 155 /* TypeLiteral */) { + if (node.parent.kind === 156 /* FunctionType */ || + node.parent.kind === 157 /* ConstructorType */ || + node.parent.parent.kind === 159 /* TypeLiteral */) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } - else if (!(node.parent.flags & 16 /* Private */)) { + else if (!(node.parent.flags & 8 /* Private */)) { writeTypeOfDeclaration(node, node.type, getParameterDeclarationTypeVisibilityError); } - function getParameterDeclarationTypeVisibilityError(symbolAccesibilityResult) { - var diagnosticMessage = getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult); + function getParameterDeclarationTypeVisibilityError(symbolAccessibilityResult) { + var diagnosticMessage = getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult); return diagnosticMessage !== undefined ? { diagnosticMessage: diagnosticMessage, errorNode: node, typeName: node.name } : undefined; } - function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult) { + function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { switch (node.parent.kind) { - case 144 /* Constructor */: - return symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? + case 148 /* Constructor */: + return symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1; - case 148 /* ConstructSignature */: + case 152 /* ConstructSignature */: // Interfaces cannot have parameter types that cannot be named - return symbolAccesibilityResult.errorModuleName ? + return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; - case 147 /* CallSignature */: + case 151 /* CallSignature */: // Interfaces cannot have parameter types that cannot be named - return symbolAccesibilityResult.errorModuleName ? + return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - if (node.parent.flags & 64 /* Static */) { - return symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: + if (node.parent.flags & 32 /* Static */) { + return symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 214 /* ClassDeclaration */) { - return symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? + else if (node.parent.parent.kind === 221 /* ClassDeclaration */) { + return symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { // Interfaces cannot have parameter types that cannot be named - return symbolAccesibilityResult.errorModuleName ? + return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } - case 213 /* FunctionDeclaration */: - return symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? + case 220 /* FunctionDeclaration */: + return symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1; @@ -29897,12 +34034,12 @@ var ts; } function emitBindingPattern(bindingPattern) { // We have to explicitly emit square bracket and bracket because these tokens are not store inside the node. - if (bindingPattern.kind === 161 /* ObjectBindingPattern */) { + if (bindingPattern.kind === 167 /* ObjectBindingPattern */) { write("{"); emitCommaList(bindingPattern.elements, emitBindingElement); write("}"); } - else if (bindingPattern.kind === 162 /* ArrayBindingPattern */) { + else if (bindingPattern.kind === 168 /* ArrayBindingPattern */) { write("["); var elements = bindingPattern.elements; emitCommaList(elements, emitBindingElement); @@ -29913,15 +34050,7 @@ var ts; } } function emitBindingElement(bindingElement) { - function getBindingElementTypeVisibilityError(symbolAccesibilityResult) { - var diagnosticMessage = getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult); - return diagnosticMessage !== undefined ? { - diagnosticMessage: diagnosticMessage, - errorNode: bindingElement, - typeName: bindingElement.name - } : undefined; - } - if (bindingElement.kind === 187 /* OmittedExpression */) { + if (bindingElement.kind === 193 /* OmittedExpression */) { // If bindingElement is an omittedExpression (i.e. containing elision), // we will emit blank space (although this may differ from users' original code, // it allows emitSeparatedList to write separator appropriately) @@ -29930,7 +34059,7 @@ var ts; // emit : function foo([ , x, , ]) {} write(" "); } - else if (bindingElement.kind === 163 /* BindingElement */) { + else if (bindingElement.kind === 169 /* BindingElement */) { if (bindingElement.propertyName) { // bindingElement has propertyName property in the following case: // { y: [a,b,c] ...} -> bindingPattern will have a property called propertyName for "y" @@ -29969,64 +34098,86 @@ var ts; } function emitNode(node) { switch (node.kind) { - case 213 /* FunctionDeclaration */: - case 218 /* ModuleDeclaration */: - case 221 /* ImportEqualsDeclaration */: - case 215 /* InterfaceDeclaration */: - case 214 /* ClassDeclaration */: - case 216 /* TypeAliasDeclaration */: - case 217 /* EnumDeclaration */: + case 220 /* FunctionDeclaration */: + case 225 /* ModuleDeclaration */: + case 229 /* ImportEqualsDeclaration */: + case 222 /* InterfaceDeclaration */: + case 221 /* ClassDeclaration */: + case 223 /* TypeAliasDeclaration */: + case 224 /* EnumDeclaration */: return emitModuleElement(node, isModuleElementVisible(node)); - case 193 /* VariableStatement */: + case 200 /* VariableStatement */: return emitModuleElement(node, isVariableStatementVisible(node)); - case 222 /* ImportDeclaration */: + case 230 /* ImportDeclaration */: // Import declaration without import clause is visible, otherwise it is not visible return emitModuleElement(node, /*isModuleElementVisible*/ !node.importClause); - case 228 /* ExportDeclaration */: + case 236 /* ExportDeclaration */: return emitExportDeclaration(node); - case 144 /* Constructor */: - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: + case 148 /* Constructor */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: return writeFunctionDeclaration(node); - case 148 /* ConstructSignature */: - case 147 /* CallSignature */: - case 149 /* IndexSignature */: + case 152 /* ConstructSignature */: + case 151 /* CallSignature */: + case 153 /* IndexSignature */: return emitSignatureDeclarationWithJsDocComments(node); - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: return emitAccessorDeclaration(node); - case 141 /* PropertyDeclaration */: - case 140 /* PropertySignature */: + case 145 /* PropertyDeclaration */: + case 144 /* PropertySignature */: return emitPropertyDeclaration(node); - case 247 /* EnumMember */: + case 255 /* EnumMember */: return emitEnumMemberDeclaration(node); - case 227 /* ExportAssignment */: + case 235 /* ExportAssignment */: return emitExportAssignment(node); - case 248 /* SourceFile */: + case 256 /* SourceFile */: return emitSourceFile(node); } } - function writeReferencePath(referencedFile) { - var declFileName = referencedFile.flags & 4096 /* DeclarationFile */ - ? referencedFile.fileName // Declaration file, use declaration file name - : ts.shouldEmitToOwnFile(referencedFile, compilerOptions) - ? ts.getOwnEmitOutputFilePath(referencedFile, host, ".d.ts") // Own output file so get the .d.ts file - : ts.removeFileExtension(compilerOptions.outFile || compilerOptions.out) + ".d.ts"; // Global out file - declFileName = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizeSlashes(jsFilePath)), declFileName, host.getCurrentDirectory(), host.getCanonicalFileName, - /*isAbsolutePathAnUrl*/ false); - referencePathsOutput += "/// " + newLine; + /** + * Adds the reference to referenced file, returns true if global file reference was emitted + * @param referencedFile + * @param addBundledFileReference Determines if global file reference corresponding to bundled file should be emitted or not + */ + function writeReferencePath(referencedFile, addBundledFileReference) { + var declFileName; + var addedBundledEmitReference = false; + if (ts.isDeclarationFile(referencedFile)) { + // Declaration file, use declaration file name + declFileName = referencedFile.fileName; + } + else { + // Get the declaration file path + ts.forEachExpectedEmitFile(host, getDeclFileName, referencedFile); + } + if (declFileName) { + declFileName = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizeSlashes(declarationFilePath)), declFileName, host.getCurrentDirectory(), host.getCanonicalFileName, + /*isAbsolutePathAnUrl*/ false); + referencesOutput += "/// " + newLine; + } + return addedBundledEmitReference; + function getDeclFileName(emitFileNames, sourceFiles, isBundledEmit) { + // Dont add reference path to this file if it is a bundled emit and caller asked not emit bundled file path + if (isBundledEmit && !addBundledFileReference) { + return; + } + ts.Debug.assert(!!emitFileNames.declarationFilePath || ts.isSourceFileJavaScript(referencedFile), "Declaration file is not present only for javascript files"); + declFileName = emitFileNames.declarationFilePath || emitFileNames.jsFilePath; + addedBundledEmitReference = isBundledEmit; + } } } /* @internal */ - function writeDeclarationFile(jsFilePath, sourceFile, host, resolver, diagnostics) { - var emitDeclarationResult = emitDeclarations(host, resolver, diagnostics, jsFilePath, sourceFile); - // TODO(shkamat): Should we not write any declaration file if any of them can produce error, - // or should we just not write this file like we are doing now - if (!emitDeclarationResult.reportedDeclarationError) { - var declarationOutput = emitDeclarationResult.referencePathsOutput + function writeDeclarationFile(declarationFilePath, sourceFiles, isBundledEmit, host, resolver, emitterDiagnostics) { + var emitDeclarationResult = emitDeclarations(host, resolver, emitterDiagnostics, declarationFilePath, sourceFiles, isBundledEmit); + var emitSkipped = emitDeclarationResult.reportedDeclarationError || host.isEmitBlocked(declarationFilePath) || host.getCompilerOptions().noEmit; + if (!emitSkipped) { + var declarationOutput = emitDeclarationResult.referencesOutput + getDeclarationOutput(emitDeclarationResult.synchronousDeclarationOutput, emitDeclarationResult.moduleElementDeclarationEmitInfo); - ts.writeFile(host, diagnostics, ts.removeFileExtension(jsFilePath) + ".d.ts", declarationOutput, host.getCompilerOptions().emitBOM); + ts.writeFile(host, emitterDiagnostics, declarationFilePath, declarationOutput, host.getCompilerOptions().emitBOM, sourceFiles); } + return emitSkipped; function getDeclarationOutput(synchronousDeclarationOutput, moduleElementDeclarationEmitInfo) { var appliedSyncOutputPos = 0; var declarationOutput = ""; @@ -30045,14 +34196,11 @@ var ts; ts.writeDeclarationFile = writeDeclarationFile; })(ts || (ts = {})); /// +/// /// /* @internal */ var ts; (function (ts) { - function isExternalModuleOrDeclarationFile(sourceFile) { - return ts.isExternalModule(sourceFile) || ts.isDeclarationFile(sourceFile); - } - ts.isExternalModuleOrDeclarationFile = isExternalModuleOrDeclarationFile; function getResolvedExternalModuleName(host, file) { return file.moduleName || ts.getExternalModuleNameFromPath(host, file.fileName); } @@ -30333,55 +34481,37 @@ var ts; TempFlags[TempFlags["CountMask"] = 268435455] = "CountMask"; TempFlags[TempFlags["_i"] = 268435456] = "_i"; })(TempFlags || (TempFlags = {})); + var CopyDirection; + (function (CopyDirection) { + CopyDirection[CopyDirection["ToOriginal"] = 0] = "ToOriginal"; + CopyDirection[CopyDirection["ToOutParameter"] = 1] = "ToOutParameter"; + })(CopyDirection || (CopyDirection = {})); // targetSourceFile is when users only want one file in entire project to be emitted. This is used in compileOnSave feature function emitFiles(resolver, host, targetSourceFile) { // emit output for the __extends helper function var extendsHelper = "\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};"; + var assignHelper = "\nvar __assign = (this && this.__assign) || Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n};"; // emit output for the __decorate helper function var decorateHelper = "\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};"; // emit output for the __metadata helper function var metadataHelper = "\nvar __metadata = (this && this.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};"; // emit output for the __param helper function var paramHelper = "\nvar __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n};"; - var awaiterHelper = "\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promise, generator) {\n return new Promise(function (resolve, reject) {\n generator = generator.call(thisArg, _arguments);\n function cast(value) { return value instanceof Promise && value.constructor === Promise ? value : new Promise(function (resolve) { resolve(value); }); }\n function onfulfill(value) { try { step(\"next\", value); } catch (e) { reject(e); } }\n function onreject(value) { try { step(\"throw\", value); } catch (e) { reject(e); } }\n function step(verb, value) {\n var result = generator[verb](value);\n result.done ? resolve(result.value) : cast(result.value).then(onfulfill, onreject);\n }\n step(\"next\", void 0);\n });\n};"; + var awaiterHelper = "\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator.throw(value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments)).next());\n });\n};"; var compilerOptions = host.getCompilerOptions(); - var languageVersion = compilerOptions.target || 0 /* ES3 */; - var modulekind = compilerOptions.module ? compilerOptions.module : languageVersion === 2 /* ES6 */ ? 5 /* ES6 */ : 0 /* None */; + var languageVersion = ts.getEmitScriptTarget(compilerOptions); + var modulekind = ts.getEmitModuleKind(compilerOptions); var sourceMapDataList = compilerOptions.sourceMap || compilerOptions.inlineSourceMap ? [] : undefined; - var diagnostics = []; + var emittedFilesList = compilerOptions.listEmittedFiles ? [] : undefined; + var emitterDiagnostics = ts.createDiagnosticCollection(); + var emitSkipped = false; var newLine = host.getNewLine(); - var jsxDesugaring = host.getCompilerOptions().jsx !== 1 /* Preserve */; - var shouldEmitJsx = function (s) { return (s.languageVariant === 1 /* JSX */ && !jsxDesugaring); }; - var outFile = compilerOptions.outFile || compilerOptions.out; var emitJavaScript = createFileEmitter(); - if (targetSourceFile === undefined) { - if (outFile) { - emitFile(outFile); - } - else { - ts.forEach(host.getSourceFiles(), function (sourceFile) { - if (ts.shouldEmitToOwnFile(sourceFile, compilerOptions)) { - var jsFilePath = ts.getOwnEmitOutputFilePath(sourceFile, host, shouldEmitJsx(sourceFile) ? ".jsx" : ".js"); - emitFile(jsFilePath, sourceFile); - } - }); - } - } - else { - // targetSourceFile is specified (e.g calling emitter from language service or calling getSemanticDiagnostic from language service) - if (ts.shouldEmitToOwnFile(targetSourceFile, compilerOptions)) { - var jsFilePath = ts.getOwnEmitOutputFilePath(targetSourceFile, host, shouldEmitJsx(targetSourceFile) ? ".jsx" : ".js"); - emitFile(jsFilePath, targetSourceFile); - } - else if (!ts.isDeclarationFile(targetSourceFile) && outFile) { - emitFile(outFile); - } - } - // Sort and make the unique list of diagnostics - diagnostics = ts.sortAndDeduplicateDiagnostics(diagnostics); + ts.forEachExpectedEmitFile(host, emitFile, targetSourceFile); return { - emitSkipped: false, - diagnostics: diagnostics, + emitSkipped: emitSkipped, + diagnostics: emitterDiagnostics.getDiagnostics(), + emittedFiles: emittedFilesList, sourceMaps: sourceMapDataList }; function isUniqueLocalName(name, container) { @@ -30429,6 +34559,8 @@ var ts; function createFileEmitter() { var writer = ts.createTextWriter(newLine); var write = writer.write, writeTextOfNode = writer.writeTextOfNode, writeLine = writer.writeLine, increaseIndent = writer.increaseIndent, decreaseIndent = writer.decreaseIndent; + var sourceMap = compilerOptions.sourceMap || compilerOptions.inlineSourceMap ? ts.createSourceMapWriter(host, writer) : ts.getNullSourceMapWriter(); + var setSourceFile = sourceMap.setSourceFile, emitStart = sourceMap.emitStart, emitEnd = sourceMap.emitEnd, emitPos = sourceMap.emitPos; var currentSourceFile; var currentText; var currentLineMap; @@ -30443,125 +34575,110 @@ var ts; // => // var x;... exporter("x", x = 1) var exportFunctionForFile; + var contextObjectForFile; var generatedNameSet; var nodeToGeneratedName; var computedPropertyNamesToGeneratedNames; + var decoratedClassAliases; var convertedLoopState; var extendsEmitted; + var assignEmitted; var decorateEmitted; var paramEmitted; var awaiterEmitted; - var tempFlags; + var tempFlags = 0; var tempVariables; var tempParameters; var externalImports; var exportSpecifiers; var exportEquals; - var hasExportStars; - /** Write emitted output to disk */ - var writeEmittedFiles = writeJavaScriptFile; + var hasExportStarsToExportValues; var detachedCommentsInfo; - var writeComment = ts.writeCommentRange; - /** Emit a node */ - var emit = emitNodeWithCommentsAndWithoutSourcemap; - /** Called just before starting emit of a node */ - var emitStart = function (node) { }; - /** Called once the emit of the node is done */ - var emitEnd = function (node) { }; - /** Emit the text for the given token that comes after startPos - * This by default writes the text provided with the given tokenKind - * but if optional emitFn callback is provided the text is emitted using the callback instead of default text - * @param tokenKind the kind of the token to search and emit - * @param startPos the position in the source to start searching for the token - * @param emitFn if given will be invoked to emit the text instead of actual token emit */ - var emitToken = emitTokenText; - /** Called to before starting the lexical scopes as in function/class in the emitted code because of node - * @param scopeDeclaration node that starts the lexical scope - * @param scopeName Optional name of this scope instead of deducing one from the declaration node */ - var scopeEmitStart = function (scopeDeclaration, scopeName) { }; - /** Called after coming out of the scope */ - var scopeEmitEnd = function () { }; /** Sourcemap data that will get encoded */ var sourceMapData; - /** The root file passed to the emit function (if present) */ - var root; + /** Is the file being emitted into its own file */ + var isOwnFileEmit; /** If removeComments is true, no leading-comments needed to be emitted **/ var emitLeadingCommentsOfPosition = compilerOptions.removeComments ? function (pos) { } : emitLeadingCommentsOfPositionWorker; + var setSourceMapWriterEmit = compilerOptions.sourceMap || compilerOptions.inlineSourceMap ? changeSourceMapEmit : function (writer) { }; var moduleEmitDelegates = (_a = {}, - _a[5 /* ES6 */] = emitES6Module, - _a[2 /* AMD */] = emitAMDModule, - _a[4 /* System */] = emitSystemModule, - _a[3 /* UMD */] = emitUMDModule, - _a[1 /* CommonJS */] = emitCommonJSModule, + _a[ts.ModuleKind.ES6] = emitES6Module, + _a[ts.ModuleKind.AMD] = emitAMDModule, + _a[ts.ModuleKind.System] = emitSystemModule, + _a[ts.ModuleKind.UMD] = emitUMDModule, + _a[ts.ModuleKind.CommonJS] = emitCommonJSModule, _a ); var bundleEmitDelegates = (_b = {}, - _b[5 /* ES6 */] = function () { }, - _b[2 /* AMD */] = emitAMDModule, - _b[4 /* System */] = emitSystemModule, - _b[3 /* UMD */] = function () { }, - _b[1 /* CommonJS */] = function () { }, + _b[ts.ModuleKind.ES6] = function () { }, + _b[ts.ModuleKind.AMD] = emitAMDModule, + _b[ts.ModuleKind.System] = emitSystemModule, + _b[ts.ModuleKind.UMD] = function () { }, + _b[ts.ModuleKind.CommonJS] = function () { }, _b ); return doEmit; - function doEmit(jsFilePath, rootFile) { + function doEmit(jsFilePath, sourceMapFilePath, sourceFiles, isBundledEmit) { + sourceMap.initialize(jsFilePath, sourceMapFilePath, sourceFiles, isBundledEmit); + generatedNameSet = {}; + nodeToGeneratedName = []; + decoratedClassAliases = []; + isOwnFileEmit = !isBundledEmit; + // Emit helpers from all the files + if (isBundledEmit && modulekind) { + ts.forEach(sourceFiles, emitEmitHelpers); + } + // Do not call emit directly. It does not set the currentSourceFile. + ts.forEach(sourceFiles, emitSourceFile); + writeLine(); + var sourceMappingURL = sourceMap.getSourceMappingURL(); + if (sourceMappingURL) { + write("//# sourceMappingURL=" + sourceMappingURL); + } + writeEmittedFiles(writer.getText(), jsFilePath, sourceMapFilePath, /*writeByteOrderMark*/ compilerOptions.emitBOM, sourceFiles); // reset the state + sourceMap.reset(); writer.reset(); currentSourceFile = undefined; currentText = undefined; currentLineMap = undefined; exportFunctionForFile = undefined; - generatedNameSet = {}; - nodeToGeneratedName = []; + contextObjectForFile = undefined; + generatedNameSet = undefined; + nodeToGeneratedName = undefined; + decoratedClassAliases = undefined; computedPropertyNamesToGeneratedNames = undefined; convertedLoopState = undefined; extendsEmitted = false; decorateEmitted = false; paramEmitted = false; awaiterEmitted = false; + assignEmitted = false; tempFlags = 0; tempVariables = undefined; tempParameters = undefined; externalImports = undefined; exportSpecifiers = undefined; exportEquals = undefined; - hasExportStars = undefined; + hasExportStarsToExportValues = undefined; detachedCommentsInfo = undefined; sourceMapData = undefined; isEs6Module = false; renamedDependencies = undefined; isCurrentFileExternalModule = false; - root = rootFile; - if (compilerOptions.sourceMap || compilerOptions.inlineSourceMap) { - initializeEmitterWithSourceMaps(jsFilePath, root); - } - if (root) { - // Do not call emit directly. It does not set the currentSourceFile. - emitSourceFile(root); - } - else { - if (modulekind) { - ts.forEach(host.getSourceFiles(), emitEmitHelpers); - } - ts.forEach(host.getSourceFiles(), function (sourceFile) { - if ((!isExternalModuleOrDeclarationFile(sourceFile)) || (modulekind && ts.isExternalModule(sourceFile))) { - emitSourceFile(sourceFile); - } - }); - } - writeLine(); - writeEmittedFiles(writer.getText(), jsFilePath, /*writeByteOrderMark*/ compilerOptions.emitBOM); } function emitSourceFile(sourceFile) { currentSourceFile = sourceFile; currentText = sourceFile.text; currentLineMap = ts.getLineStarts(sourceFile); exportFunctionForFile = undefined; + contextObjectForFile = undefined; isEs6Module = sourceFile.symbol && sourceFile.symbol.exports && !!sourceFile.symbol.exports["___esModule"]; renamedDependencies = sourceFile.renamedDependencies; currentFileIdentifiers = sourceFile.identifiers; isCurrentFileExternalModule = ts.isExternalModule(sourceFile); - emit(sourceFile); + setSourceFile(sourceFile); + emitNodeWithCommentsAndWithoutSourcemap(sourceFile); } function isUniqueName(name) { return !resolver.hasGlobalName(name) && @@ -30573,10 +34690,10 @@ var ts; // Note that names generated by makeTempVariableName and makeUniqueName will never conflict. function makeTempVariableName(flags) { if (flags && !(tempFlags & flags)) { - var name_19 = flags === 268435456 /* _i */ ? "_i" : "_n"; - if (isUniqueName(name_19)) { + var name_23 = flags === 268435456 /* _i */ ? "_i" : "_n"; + if (isUniqueName(name_23)) { tempFlags |= flags; - return name_19; + return name_23; } } while (true) { @@ -30584,9 +34701,9 @@ var ts; tempFlags++; // Skip over 'i' and 'n' if (count !== 8 && count !== 13) { - var name_20 = count < 26 ? "_" + String.fromCharCode(97 /* a */ + count) : "_" + (count - 26); - if (isUniqueName(name_20)) { - return name_20; + var name_24 = count < 26 ? "_" + String.fromCharCode(97 /* a */ + count) : "_" + (count - 26); + if (isUniqueName(name_24)) { + return name_24; } } } @@ -30630,17 +34747,17 @@ var ts; switch (node.kind) { case 69 /* Identifier */: return makeUniqueName(node.text); - case 218 /* ModuleDeclaration */: - case 217 /* EnumDeclaration */: + case 225 /* ModuleDeclaration */: + case 224 /* EnumDeclaration */: return generateNameForModuleOrEnum(node); - case 222 /* ImportDeclaration */: - case 228 /* ExportDeclaration */: + case 230 /* ImportDeclaration */: + case 236 /* ExportDeclaration */: return generateNameForImportOrExportDeclaration(node); - case 213 /* FunctionDeclaration */: - case 214 /* ClassDeclaration */: - case 227 /* ExportAssignment */: + case 220 /* FunctionDeclaration */: + case 221 /* ClassDeclaration */: + case 235 /* ExportAssignment */: return generateNameForExportDefault(); - case 186 /* ClassExpression */: + case 192 /* ClassExpression */: return generateNameForClassExpression(); } } @@ -30648,338 +34765,15 @@ var ts; var id = ts.getNodeId(node); return nodeToGeneratedName[id] || (nodeToGeneratedName[id] = ts.unescapeIdentifier(generateNameForNode(node))); } - function initializeEmitterWithSourceMaps(jsFilePath, root) { - var sourceMapDir; // The directory in which sourcemap will be - // Current source map file and its index in the sources list - var sourceMapSourceIndex = -1; - // Names and its index map - var sourceMapNameIndexMap = {}; - var sourceMapNameIndices = []; - function getSourceMapNameIndex() { - return sourceMapNameIndices.length ? ts.lastOrUndefined(sourceMapNameIndices) : -1; + /** Write emitted output to disk */ + function writeEmittedFiles(emitOutput, jsFilePath, sourceMapFilePath, writeByteOrderMark, sourceFiles) { + if (compilerOptions.sourceMap && !compilerOptions.inlineSourceMap) { + ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap.getText(), /*writeByteOrderMark*/ false, sourceFiles); } - // Last recorded and encoded spans - var lastRecordedSourceMapSpan; - var lastEncodedSourceMapSpan = { - emittedLine: 1, - emittedColumn: 1, - sourceLine: 1, - sourceColumn: 1, - sourceIndex: 0 - }; - var lastEncodedNameIndex = 0; - // Encoding for sourcemap span - function encodeLastRecordedSourceMapSpan() { - if (!lastRecordedSourceMapSpan || lastRecordedSourceMapSpan === lastEncodedSourceMapSpan) { - return; - } - var prevEncodedEmittedColumn = lastEncodedSourceMapSpan.emittedColumn; - // Line/Comma delimiters - if (lastEncodedSourceMapSpan.emittedLine === lastRecordedSourceMapSpan.emittedLine) { - // Emit comma to separate the entry - if (sourceMapData.sourceMapMappings) { - sourceMapData.sourceMapMappings += ","; - } - } - else { - // Emit line delimiters - for (var encodedLine = lastEncodedSourceMapSpan.emittedLine; encodedLine < lastRecordedSourceMapSpan.emittedLine; encodedLine++) { - sourceMapData.sourceMapMappings += ";"; - } - prevEncodedEmittedColumn = 1; - } - // 1. Relative Column 0 based - sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.emittedColumn - prevEncodedEmittedColumn); - // 2. Relative sourceIndex - sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceIndex - lastEncodedSourceMapSpan.sourceIndex); - // 3. Relative sourceLine 0 based - sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceLine - lastEncodedSourceMapSpan.sourceLine); - // 4. Relative sourceColumn 0 based - sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceColumn - lastEncodedSourceMapSpan.sourceColumn); - // 5. Relative namePosition 0 based - if (lastRecordedSourceMapSpan.nameIndex >= 0) { - sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.nameIndex - lastEncodedNameIndex); - lastEncodedNameIndex = lastRecordedSourceMapSpan.nameIndex; - } - lastEncodedSourceMapSpan = lastRecordedSourceMapSpan; - sourceMapData.sourceMapDecodedMappings.push(lastEncodedSourceMapSpan); - function base64VLQFormatEncode(inValue) { - function base64FormatEncode(inValue) { - if (inValue < 64) { - return "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(inValue); - } - throw TypeError(inValue + ": not a 64 based value"); - } - // Add a new least significant bit that has the sign of the value. - // if negative number the least significant bit that gets added to the number has value 1 - // else least significant bit value that gets added is 0 - // eg. -1 changes to binary : 01 [1] => 3 - // +1 changes to binary : 01 [0] => 2 - if (inValue < 0) { - inValue = ((-inValue) << 1) + 1; - } - else { - inValue = inValue << 1; - } - // Encode 5 bits at a time starting from least significant bits - var encodedStr = ""; - do { - var currentDigit = inValue & 31; // 11111 - inValue = inValue >> 5; - if (inValue > 0) { - // There are still more digits to decode, set the msb (6th bit) - currentDigit = currentDigit | 32; - } - encodedStr = encodedStr + base64FormatEncode(currentDigit); - } while (inValue > 0); - return encodedStr; - } + if (sourceMapDataList) { + sourceMapDataList.push(sourceMap.getSourceMapData()); } - function recordSourceMapSpan(pos) { - var sourceLinePos = ts.computeLineAndCharacterOfPosition(currentLineMap, pos); - // Convert the location to be one-based. - sourceLinePos.line++; - sourceLinePos.character++; - 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 || - lastRecordedSourceMapSpan.emittedColumn !== emittedColumn || - (lastRecordedSourceMapSpan.sourceIndex === sourceMapSourceIndex && - (lastRecordedSourceMapSpan.sourceLine > sourceLinePos.line || - (lastRecordedSourceMapSpan.sourceLine === sourceLinePos.line && lastRecordedSourceMapSpan.sourceColumn > sourceLinePos.character)))) { - // Encode the last recordedSpan before assigning new - encodeLastRecordedSourceMapSpan(); - // New span - lastRecordedSourceMapSpan = { - emittedLine: emittedLine, - emittedColumn: emittedColumn, - sourceLine: sourceLinePos.line, - sourceColumn: sourceLinePos.character, - nameIndex: getSourceMapNameIndex(), - sourceIndex: sourceMapSourceIndex - }; - } - else { - // Take the new pos instead since there is no change in emittedLine and column since last location - lastRecordedSourceMapSpan.sourceLine = sourceLinePos.line; - lastRecordedSourceMapSpan.sourceColumn = sourceLinePos.character; - lastRecordedSourceMapSpan.sourceIndex = sourceMapSourceIndex; - } - } - function recordEmitNodeStartSpan(node) { - // Get the token pos after skipping to the token (ignoring the leading trivia) - recordSourceMapSpan(ts.skipTrivia(currentText, node.pos)); - } - function recordEmitNodeEndSpan(node) { - recordSourceMapSpan(node.end); - } - function writeTextWithSpanRecord(tokenKind, startPos, emitFn) { - var tokenStartPos = ts.skipTrivia(currentText, startPos); - recordSourceMapSpan(tokenStartPos); - var tokenEndPos = emitTokenText(tokenKind, tokenStartPos, emitFn); - recordSourceMapSpan(tokenEndPos); - return tokenEndPos; - } - function recordNewSourceFileStart(node) { - // 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; - sourceMapData.sourceMapSources.push(ts.getRelativePathToDirectoryOrUrl(sourcesDirectoryPath, node.fileName, host.getCurrentDirectory(), host.getCanonicalFileName, - /*isAbsolutePathAnUrl*/ true)); - sourceMapSourceIndex = sourceMapData.sourceMapSources.length - 1; - // The one that can be used from program to get the actual source file - sourceMapData.inputSourceFileNames.push(node.fileName); - if (compilerOptions.inlineSources) { - if (!sourceMapData.sourceMapSourcesContent) { - sourceMapData.sourceMapSourcesContent = []; - } - sourceMapData.sourceMapSourcesContent.push(node.text); - } - } - function recordScopeNameOfNode(node, scopeName) { - function recordScopeNameIndex(scopeNameIndex) { - sourceMapNameIndices.push(scopeNameIndex); - } - function recordScopeNameStart(scopeName) { - var scopeNameIndex = -1; - if (scopeName) { - var parentIndex = getSourceMapNameIndex(); - if (parentIndex !== -1) { - // Child scopes are always shown with a dot (even if they have no name), - // unless it is a computed property. Then it is shown with brackets, - // but the brackets are included in the name. - var name_21 = node.name; - if (!name_21 || name_21.kind !== 136 /* ComputedPropertyName */) { - scopeName = "." + scopeName; - } - scopeName = sourceMapData.sourceMapNames[parentIndex] + scopeName; - } - scopeNameIndex = ts.getProperty(sourceMapNameIndexMap, scopeName); - if (scopeNameIndex === undefined) { - scopeNameIndex = sourceMapData.sourceMapNames.length; - sourceMapData.sourceMapNames.push(scopeName); - sourceMapNameIndexMap[scopeName] = scopeNameIndex; - } - } - recordScopeNameIndex(scopeNameIndex); - } - if (scopeName) { - // The scope was already given a name use it - recordScopeNameStart(scopeName); - } - else if (node.kind === 213 /* FunctionDeclaration */ || - node.kind === 173 /* FunctionExpression */ || - node.kind === 143 /* MethodDeclaration */ || - node.kind === 142 /* MethodSignature */ || - node.kind === 145 /* GetAccessor */ || - node.kind === 146 /* SetAccessor */ || - node.kind === 218 /* ModuleDeclaration */ || - node.kind === 214 /* ClassDeclaration */ || - node.kind === 217 /* EnumDeclaration */) { - // Declaration and has associated name use it - if (node.name) { - var name_22 = node.name; - // For computed property names, the text will include the brackets - scopeName = name_22.kind === 136 /* ComputedPropertyName */ - ? ts.getTextOfNode(name_22) - : node.name.text; - } - recordScopeNameStart(scopeName); - } - else { - // Block just use the name from upper level scope - recordScopeNameIndex(getSourceMapNameIndex()); - } - } - function recordScopeNameEnd() { - sourceMapNameIndices.pop(); - } - ; - function writeCommentRangeWithMap(currentText, currentLineMap, writer, comment, newLine) { - recordSourceMapSpan(comment.pos); - ts.writeCommentRange(currentText, currentLineMap, writer, comment, newLine); - recordSourceMapSpan(comment.end); - } - function serializeSourceMapContents(version, file, sourceRoot, sources, names, mappings, sourcesContent) { - if (typeof JSON !== "undefined") { - var map_1 = { - version: version, - file: file, - sourceRoot: sourceRoot, - sources: sources, - names: names, - mappings: mappings - }; - if (sourcesContent !== undefined) { - map_1.sourcesContent = sourcesContent; - } - return JSON.stringify(map_1); - } - return "{\"version\":" + version + ",\"file\":\"" + ts.escapeString(file) + "\",\"sourceRoot\":\"" + ts.escapeString(sourceRoot) + "\",\"sources\":[" + serializeStringArray(sources) + "],\"names\":[" + serializeStringArray(names) + "],\"mappings\":\"" + ts.escapeString(mappings) + "\" " + (sourcesContent !== undefined ? ",\"sourcesContent\":[" + serializeStringArray(sourcesContent) + "]" : "") + "}"; - function serializeStringArray(list) { - var output = ""; - for (var i = 0, n = list.length; i < n; i++) { - if (i) { - output += ","; - } - output += "\"" + ts.escapeString(list[i]) + "\""; - } - return output; - } - } - function writeJavaScriptAndSourceMapFile(emitOutput, jsFilePath, writeByteOrderMark) { - encodeLastRecordedSourceMapSpan(); - var sourceMapText = serializeSourceMapContents(3, sourceMapData.sourceMapFile, sourceMapData.sourceMapSourceRoot, sourceMapData.sourceMapSources, sourceMapData.sourceMapNames, sourceMapData.sourceMapMappings, sourceMapData.sourceMapSourcesContent); - sourceMapDataList.push(sourceMapData); - var sourceMapUrl; - if (compilerOptions.inlineSourceMap) { - // Encode the sourceMap into the sourceMap url - var base64SourceMapText = ts.convertToBase64(sourceMapText); - sourceMapUrl = "//# sourceMappingURL=data:application/json;base64," + base64SourceMapText; - } - else { - // Write source map file - ts.writeFile(host, diagnostics, sourceMapData.sourceMapFilePath, sourceMapText, /*writeByteOrderMark*/ false); - sourceMapUrl = "//# sourceMappingURL=" + sourceMapData.jsSourceMappingURL; - } - // Write sourcemap url to the js file and write the js file - writeJavaScriptFile(emitOutput + sourceMapUrl, jsFilePath, writeByteOrderMark); - } - // Initialize source map data - var sourceMapJsFile = ts.getBaseFileName(ts.normalizeSlashes(jsFilePath)); - sourceMapData = { - sourceMapFilePath: jsFilePath + ".map", - jsSourceMappingURL: sourceMapJsFile + ".map", - sourceMapFile: sourceMapJsFile, - sourceMapSourceRoot: compilerOptions.sourceRoot || "", - sourceMapSources: [], - inputSourceFileNames: [], - sourceMapNames: [], - sourceMapMappings: "", - sourceMapSourcesContent: undefined, - sourceMapDecodedMappings: [] - }; - // Normalize source root and make sure it has trailing "/" so that it can be used to combine paths with the - // relative paths of the sources list in the sourcemap - sourceMapData.sourceMapSourceRoot = ts.normalizeSlashes(sourceMapData.sourceMapSourceRoot); - if (sourceMapData.sourceMapSourceRoot.length && sourceMapData.sourceMapSourceRoot.charCodeAt(sourceMapData.sourceMapSourceRoot.length - 1) !== 47 /* slash */) { - sourceMapData.sourceMapSourceRoot += ts.directorySeparator; - } - if (compilerOptions.mapRoot) { - sourceMapDir = ts.normalizeSlashes(compilerOptions.mapRoot); - if (root) { - // For modules or multiple emit files the mapRoot will have directory structure like the sources - // So if src\a.ts and src\lib\b.ts are compiled together user would be moving the maps into mapRoot\a.js.map and mapRoot\lib\b.js.map - sourceMapDir = ts.getDirectoryPath(ts.getSourceFilePathInNewDir(root, host, sourceMapDir)); - } - if (!ts.isRootedDiskPath(sourceMapDir) && !ts.isUrl(sourceMapDir)) { - // The relative paths are relative to the common directory - sourceMapDir = ts.combinePaths(host.getCommonSourceDirectory(), sourceMapDir); - sourceMapData.jsSourceMappingURL = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizePath(jsFilePath)), // get the relative sourceMapDir path based on jsFilePath - ts.combinePaths(sourceMapDir, sourceMapData.jsSourceMappingURL), // this is where user expects to see sourceMap - host.getCurrentDirectory(), host.getCanonicalFileName, - /*isAbsolutePathAnUrl*/ true); - } - else { - sourceMapData.jsSourceMappingURL = ts.combinePaths(sourceMapDir, sourceMapData.jsSourceMappingURL); - } - } - else { - sourceMapDir = ts.getDirectoryPath(ts.normalizePath(jsFilePath)); - } - function emitNodeWithSourceMap(node) { - if (node) { - if (ts.nodeIsSynthesized(node)) { - return emitNodeWithoutSourceMap(node); - } - if (node.kind !== 248 /* SourceFile */) { - recordEmitNodeStartSpan(node); - emitNodeWithoutSourceMap(node); - recordEmitNodeEndSpan(node); - } - else { - recordNewSourceFileStart(node); - emitNodeWithoutSourceMap(node); - } - } - } - function emitNodeWithCommentsAndWithSourcemap(node) { - emitNodeConsideringCommentsOption(node, emitNodeWithSourceMap); - } - writeEmittedFiles = writeJavaScriptAndSourceMapFile; - emit = emitNodeWithCommentsAndWithSourcemap; - emitStart = recordEmitNodeStartSpan; - emitEnd = recordEmitNodeEndSpan; - emitToken = writeTextWithSpanRecord; - scopeEmitStart = recordScopeNameOfNode; - scopeEmitEnd = recordScopeNameEnd; - writeComment = writeCommentRangeWithMap; - } - function writeJavaScriptFile(emitOutput, jsFilePath, writeByteOrderMark) { - ts.writeFile(host, diagnostics, jsFilePath, emitOutput, writeByteOrderMark); + ts.writeFile(host, emitterDiagnostics, jsFilePath, emitOutput, writeByteOrderMark, sourceFiles); } // Create a temporary variable with a unique unused name. function createTempVariable(flags) { @@ -31011,7 +34805,15 @@ var ts; write(";"); } } - function emitTokenText(tokenKind, startPos, emitFn) { + /** Emit the text for the given token that comes after startPos + * This by default writes the text provided with the given tokenKind + * but if optional emitFn callback is provided the text is emitted using the callback instead of default text + * @param tokenKind the kind of the token to search and emit + * @param startPos the position in the source to start searching for the token + * @param emitFn if given will be invoked to emit the text instead of actual token emit */ + function emitToken(tokenKind, startPos, emitFn) { + var tokenStartPos = ts.skipTrivia(currentText, startPos); + emitPos(tokenStartPos); var tokenString = ts.tokenToString(tokenKind); if (emitFn) { emitFn(); @@ -31019,7 +34821,9 @@ var ts; else { write(tokenString); } - return startPos + tokenString.length; + var tokenEndPos = tokenStartPos + tokenString.length; + emitPos(tokenEndPos); + return tokenEndPos; } function emitOptional(prefix, node) { if (node) { @@ -31036,11 +34840,6 @@ var ts; write(")"); } } - function emitTrailingCommaIfPresent(nodeList) { - if (nodeList.hasTrailingComma) { - write(","); - } - } function emitLinePreservingList(parent, nodes, allowTrailingComma, spacesBetweenBraces) { ts.Debug.assert(nodes.length > 0); increaseIndent(); @@ -31113,7 +34912,7 @@ var ts; } function emitCommaList(nodes) { if (nodes) { - emitList(nodes, 0, nodes.length, /*multiline*/ false, /*trailingComma*/ false); + emitList(nodes, 0, nodes.length, /*multiLine*/ false, /*trailingComma*/ false); } } function emitLines(nodes) { @@ -31153,7 +34952,7 @@ var ts; // Any template literal or string literal with an extended escape // (e.g. "\u{0067}") will need to be downleveled as a escaped string literal. if (languageVersion < 2 /* ES6 */ && (ts.isTemplateLiteralKind(node.kind) || node.hasExtendedUnicodeEscape)) { - return getQuotedEscapedLiteralText("\"", node.text, "\""); + return getQuotedEscapedLiteralText('"', node.text, '"'); } // 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. @@ -31164,7 +34963,7 @@ var ts; // or an escaped quoted form of the original text if it's string-like. switch (node.kind) { case 9 /* StringLiteral */: - return getQuotedEscapedLiteralText("\"", node.text, "\""); + return getQuotedEscapedLiteralText('"', node.text, '"'); case 11 /* NoSubstitutionTemplateLiteral */: return getQuotedEscapedLiteralText("`", node.text, "`"); case 12 /* TemplateHead */: @@ -31186,7 +34985,7 @@ var ts; // The raw strings contain the (escaped) strings of what the user wrote. // Examples: `\n` is converted to "\\n", a template string with a newline to "\n". var text = ts.getTextOfNodeFromSourceText(currentText, node); - // text contains the original source, it will also contain quotes ("`"), dolar signs and braces ("${" and "}"), + // text contains the original source, it will also contain quotes ("`"), dollar signs and braces ("${" and "}"), // thus we need to remove those characters. // First template piece starts with "`", others with "}" // Last template piece ends with "`", others with "${" @@ -31228,10 +35027,10 @@ var ts; write("("); emit(tempVariable); // Now we emit the expressions - if (node.template.kind === 183 /* TemplateExpression */) { + if (node.template.kind === 189 /* TemplateExpression */) { ts.forEach(node.template.templateSpans, function (templateSpan) { write(", "); - var needsParens = templateSpan.expression.kind === 181 /* BinaryExpression */ + var needsParens = templateSpan.expression.kind === 187 /* BinaryExpression */ && templateSpan.expression.operatorToken.kind === 24 /* CommaToken */; emitParenthesizedIf(templateSpan.expression, needsParens); }); @@ -31266,7 +35065,7 @@ var ts; // ("abc" + 1) << (2 + "") // rather than // "abc" + (1 << 2) + "" - var needsParens = templateSpan.expression.kind !== 172 /* ParenthesizedExpression */ + var needsParens = templateSpan.expression.kind !== 178 /* ParenthesizedExpression */ && comparePrecedenceToBinaryPlus(templateSpan.expression) !== 1 /* GreaterThan */; if (i > 0 || headEmitted) { // If this is the first span and the head was not emitted, then this templateSpan's @@ -31308,11 +35107,11 @@ var ts; } function templateNeedsParens(template, parent) { switch (parent.kind) { - case 168 /* CallExpression */: - case 169 /* NewExpression */: + case 174 /* CallExpression */: + case 175 /* NewExpression */: return parent.expression === template; - case 170 /* TaggedTemplateExpression */: - case 172 /* ParenthesizedExpression */: + case 176 /* TaggedTemplateExpression */: + case 178 /* ParenthesizedExpression */: return false; default: return comparePrecedenceToBinaryPlus(parent) !== -1 /* LessThan */; @@ -31333,7 +35132,7 @@ var ts; // TODO (drosen): Note that we need to account for the upcoming 'yield' and // spread ('...') unary operators that are anticipated for ES6. switch (expression.kind) { - case 181 /* BinaryExpression */: + case 187 /* BinaryExpression */: switch (expression.operatorToken.kind) { case 37 /* AsteriskToken */: case 39 /* SlashToken */: @@ -31345,8 +35144,8 @@ var ts; default: return -1 /* LessThan */; } - case 184 /* YieldExpression */: - case 182 /* ConditionalExpression */: + case 190 /* YieldExpression */: + case 188 /* ConditionalExpression */: return -1 /* LessThan */; default: return 1 /* GreaterThan */; @@ -31362,9 +35161,9 @@ var ts; /// 'Div' for upper-cased or dotted names function emitTagName(name) { if (name.kind === 69 /* Identifier */ && ts.isIntrinsicJsxName(name.text)) { - write("\""); + write('"'); emit(name); - write("\""); + write('"'); } else { emit(name); @@ -31374,13 +35173,13 @@ var ts; /// these emit into an object literal property name, we don't need to be worried /// about keywords, just non-identifier characters function emitAttributeName(name) { - if (/[A-Za-z_]+[\w*]/.test(name.text)) { - write("\""); + if (/^[A-Za-z_]\w*$/.test(name.text)) { emit(name); - write("\""); } else { + write('"'); emit(name); + write('"'); } } /// Emit an name/value pair for an attribute (e.g. "x: 3") @@ -31396,7 +35195,7 @@ var ts; } function emitJsxElement(openingNode, children) { var syntheticReactRef = ts.createSynthesizedNode(69 /* Identifier */); - syntheticReactRef.text = "React"; + syntheticReactRef.text = compilerOptions.reactNamespace ? compilerOptions.reactNamespace : "React"; syntheticReactRef.parent = openingNode; // Call React.createElement(tag, ... emitLeadingComments(openingNode); @@ -31411,40 +35210,39 @@ var ts; } else { // Either emit one big object literal (no spread attribs), or - // a call to React.__spread + // a call to the __assign helper var attrs = openingNode.attributes; - if (ts.forEach(attrs, function (attr) { return attr.kind === 239 /* JsxSpreadAttribute */; })) { - emitExpressionIdentifier(syntheticReactRef); - write(".__spread("); + if (ts.forEach(attrs, function (attr) { return attr.kind === 247 /* JsxSpreadAttribute */; })) { + write("__assign("); var haveOpenedObjectLiteral = false; - for (var i_1 = 0; i_1 < attrs.length; i_1++) { - if (attrs[i_1].kind === 239 /* JsxSpreadAttribute */) { + for (var i = 0; i < attrs.length; i++) { + if (attrs[i].kind === 247 /* JsxSpreadAttribute */) { // If this is the first argument, we need to emit a {} as the first argument - if (i_1 === 0) { + if (i === 0) { write("{}, "); } if (haveOpenedObjectLiteral) { write("}"); haveOpenedObjectLiteral = false; } - if (i_1 > 0) { + if (i > 0) { write(", "); } - emit(attrs[i_1].expression); + emit(attrs[i].expression); } else { - ts.Debug.assert(attrs[i_1].kind === 238 /* JsxAttribute */); + ts.Debug.assert(attrs[i].kind === 246 /* JsxAttribute */); if (haveOpenedObjectLiteral) { write(", "); } else { haveOpenedObjectLiteral = true; - if (i_1 > 0) { + if (i > 0) { write(", "); } write("{"); } - emitJsxAttribute(attrs[i_1]); + emitJsxAttribute(attrs[i]); } } if (haveOpenedObjectLiteral) @@ -31454,7 +35252,7 @@ var ts; else { // One object literal with all the attributes in them write("{"); - for (var i = 0; i < attrs.length; i++) { + for (var i = 0, n = attrs.length; i < n; i++) { if (i > 0) { write(", "); } @@ -31465,23 +35263,45 @@ var ts; } // Children if (children) { - for (var i = 0; i < children.length; i++) { - // Don't emit empty expressions - if (children[i].kind === 240 /* JsxExpression */ && !(children[i].expression)) { - continue; - } - // Don't emit empty strings - if (children[i].kind === 236 /* JsxText */) { - var text = getTextToEmit(children[i]); - if (text !== undefined) { - write(", \""); - write(text); - write("\""); + var firstChild = void 0; + var multipleEmittableChildren = false; + for (var i = 0, n = children.length; i < n; i++) { + var jsxChild = children[i]; + if (isJsxChildEmittable(jsxChild)) { + // we need to decide whether to emit in single line or multiple lines as indented list + // store firstChild reference, if we see another emittable child, then emit accordingly + if (!firstChild) { + write(", "); + firstChild = jsxChild; + } + else { + // more than one emittable child, emit indented list + if (!multipleEmittableChildren) { + multipleEmittableChildren = true; + increaseIndent(); + writeLine(); + emit(firstChild); + } + write(", "); + writeLine(); + emit(jsxChild); } } + } + if (multipleEmittableChildren) { + decreaseIndent(); + } + else if (firstChild) { + if (firstChild.kind !== 241 /* JsxElement */ && firstChild.kind !== 242 /* JsxSelfClosingElement */) { + emit(firstChild); + } else { - write(", "); - emit(children[i]); + // If the only child is jsx element, put it on a new indented line + increaseIndent(); + writeLine(); + emit(firstChild); + writeLine(); + decreaseIndent(); } } } @@ -31489,11 +35309,11 @@ var ts; write(")"); // closes "React.createElement(" emitTrailingComments(openingNode); } - if (node.kind === 233 /* JsxElement */) { + if (node.kind === 241 /* JsxElement */) { emitJsxElement(node.openingElement, node.children); } else { - ts.Debug.assert(node.kind === 234 /* JsxSelfClosingElement */); + ts.Debug.assert(node.kind === 242 /* JsxSelfClosingElement */); emitJsxElement(node); } } @@ -31515,11 +35335,11 @@ var ts; if (i > 0) { write(" "); } - if (attribs[i].kind === 239 /* JsxSpreadAttribute */) { + if (attribs[i].kind === 247 /* JsxSpreadAttribute */) { emitJsxSpreadAttribute(attribs[i]); } else { - ts.Debug.assert(attribs[i].kind === 238 /* JsxAttribute */); + ts.Debug.assert(attribs[i].kind === 246 /* JsxAttribute */); emitJsxAttribute(attribs[i]); } } @@ -31527,11 +35347,11 @@ var ts; function emitJsxOpeningOrSelfClosingElement(node) { write("<"); emit(node.tagName); - if (node.attributes.length > 0 || (node.kind === 234 /* JsxSelfClosingElement */)) { + if (node.attributes.length > 0 || (node.kind === 242 /* JsxSelfClosingElement */)) { write(" "); } emitAttributes(node.attributes); - if (node.kind === 234 /* JsxSelfClosingElement */) { + if (node.kind === 242 /* JsxSelfClosingElement */) { write("/>"); } else { @@ -31550,11 +35370,11 @@ var ts; } emitJsxClosingElement(node.closingElement); } - if (node.kind === 233 /* JsxElement */) { + if (node.kind === 241 /* JsxElement */) { emitJsxElement(node); } else { - ts.Debug.assert(node.kind === 234 /* JsxSelfClosingElement */); + ts.Debug.assert(node.kind === 242 /* JsxSelfClosingElement */); emitJsxOpeningOrSelfClosingElement(node); } } @@ -31562,11 +35382,11 @@ var ts; // In a sense, it does not actually emit identifiers as much as it declares a name for a specific property. // For example, this is utilized when feeding in a result to Object.defineProperty. function emitExpressionForPropertyName(node) { - ts.Debug.assert(node.kind !== 163 /* BindingElement */); + ts.Debug.assert(node.kind !== 169 /* BindingElement */); if (node.kind === 9 /* StringLiteral */) { emitLiteral(node); } - else if (node.kind === 136 /* ComputedPropertyName */) { + else if (node.kind === 140 /* ComputedPropertyName */) { // if this is a decorated computed property, we will need to capture the result // of the property expression so that we can apply decorators later. This is to ensure // we don't introduce unintended side effects: @@ -31597,88 +35417,87 @@ var ts; emit(node.expression); } else { - write("\""); + write('"'); if (node.kind === 8 /* NumericLiteral */) { write(node.text); } else { writeTextOfNode(currentText, node); } - write("\""); + write('"'); } } function isExpressionIdentifier(node) { var parent = node.parent; switch (parent.kind) { - case 164 /* ArrayLiteralExpression */: - case 189 /* AsExpression */: - case 181 /* BinaryExpression */: - case 168 /* CallExpression */: - case 241 /* CaseClause */: - case 136 /* ComputedPropertyName */: - case 182 /* ConditionalExpression */: - case 139 /* Decorator */: - case 175 /* DeleteExpression */: - case 197 /* DoStatement */: - case 167 /* ElementAccessExpression */: - case 227 /* ExportAssignment */: - case 195 /* ExpressionStatement */: - case 188 /* ExpressionWithTypeArguments */: - case 199 /* ForStatement */: - case 200 /* ForInStatement */: - case 201 /* ForOfStatement */: - case 196 /* IfStatement */: - case 234 /* JsxSelfClosingElement */: - case 235 /* JsxOpeningElement */: - case 239 /* JsxSpreadAttribute */: - case 240 /* JsxExpression */: - case 169 /* NewExpression */: - case 172 /* ParenthesizedExpression */: - case 180 /* PostfixUnaryExpression */: - case 179 /* PrefixUnaryExpression */: - case 204 /* ReturnStatement */: - case 246 /* ShorthandPropertyAssignment */: - case 185 /* SpreadElementExpression */: - case 206 /* SwitchStatement */: - case 170 /* TaggedTemplateExpression */: - case 190 /* TemplateSpan */: - case 208 /* ThrowStatement */: - case 171 /* TypeAssertionExpression */: - case 176 /* TypeOfExpression */: - case 177 /* VoidExpression */: - case 198 /* WhileStatement */: - case 205 /* WithStatement */: - case 184 /* YieldExpression */: + case 170 /* ArrayLiteralExpression */: + case 195 /* AsExpression */: + case 184 /* AwaitExpression */: + case 187 /* BinaryExpression */: + case 174 /* CallExpression */: + case 249 /* CaseClause */: + case 140 /* ComputedPropertyName */: + case 188 /* ConditionalExpression */: + case 143 /* Decorator */: + case 181 /* DeleteExpression */: + case 204 /* DoStatement */: + case 173 /* ElementAccessExpression */: + case 235 /* ExportAssignment */: + case 202 /* ExpressionStatement */: + case 194 /* ExpressionWithTypeArguments */: + case 206 /* ForStatement */: + case 207 /* ForInStatement */: + case 208 /* ForOfStatement */: + case 203 /* IfStatement */: + case 245 /* JsxClosingElement */: + case 242 /* JsxSelfClosingElement */: + case 243 /* JsxOpeningElement */: + case 247 /* JsxSpreadAttribute */: + case 248 /* JsxExpression */: + case 175 /* NewExpression */: + case 196 /* NonNullExpression */: + case 178 /* ParenthesizedExpression */: + case 186 /* PostfixUnaryExpression */: + case 185 /* PrefixUnaryExpression */: + case 211 /* ReturnStatement */: + case 254 /* ShorthandPropertyAssignment */: + case 191 /* SpreadElementExpression */: + case 213 /* SwitchStatement */: + case 176 /* TaggedTemplateExpression */: + case 197 /* TemplateSpan */: + case 215 /* ThrowStatement */: + case 177 /* TypeAssertionExpression */: + case 182 /* TypeOfExpression */: + case 183 /* VoidExpression */: + case 205 /* WhileStatement */: + case 212 /* WithStatement */: + case 190 /* YieldExpression */: return true; - case 163 /* BindingElement */: - case 247 /* EnumMember */: - case 138 /* Parameter */: - case 245 /* PropertyAssignment */: - case 141 /* PropertyDeclaration */: - case 211 /* VariableDeclaration */: + case 169 /* BindingElement */: + case 255 /* EnumMember */: + case 142 /* Parameter */: + case 253 /* PropertyAssignment */: + case 145 /* PropertyDeclaration */: + case 218 /* VariableDeclaration */: return parent.initializer === node; - case 166 /* PropertyAccessExpression */: + case 172 /* PropertyAccessExpression */: return parent.expression === node; - case 174 /* ArrowFunction */: - case 173 /* FunctionExpression */: + case 180 /* ArrowFunction */: + case 179 /* FunctionExpression */: return parent.body === node; - case 221 /* ImportEqualsDeclaration */: + case 229 /* ImportEqualsDeclaration */: return parent.moduleReference === node; - case 135 /* QualifiedName */: + case 139 /* QualifiedName */: return parent.left === node; } return false; } function emitExpressionIdentifier(node) { - if (resolver.getNodeCheckFlags(node) & 2048 /* LexicalArguments */) { - write("_arguments"); - return; - } var container = resolver.getReferencedExportContainer(node); if (container) { - if (container.kind === 248 /* SourceFile */) { + if (container.kind === 256 /* SourceFile */) { // Identifier references module export - if (modulekind !== 5 /* ES6 */ && modulekind !== 4 /* System */) { + if (modulekind !== ts.ModuleKind.ES6 && modulekind !== ts.ModuleKind.System) { write("exports."); } } @@ -31689,22 +35508,22 @@ var ts; } } else { - if (modulekind !== 5 /* ES6 */) { + if (modulekind !== ts.ModuleKind.ES6) { var declaration = resolver.getReferencedImportDeclaration(node); if (declaration) { - if (declaration.kind === 223 /* ImportClause */) { + if (declaration.kind === 231 /* ImportClause */) { // Identifier references default import write(getGeneratedNameForNode(declaration.parent)); - write(languageVersion === 0 /* ES3 */ ? "[\"default\"]" : ".default"); + write(languageVersion === 0 /* ES3 */ ? '["default"]' : ".default"); return; } - else if (declaration.kind === 226 /* ImportSpecifier */) { + else if (declaration.kind === 234 /* ImportSpecifier */) { // Identifier references named import write(getGeneratedNameForNode(declaration.parent.parent.parent)); - var name_23 = declaration.propertyName || declaration.name; - var identifier = ts.getTextOfNodeFromSourceText(currentText, name_23); + var name_25 = declaration.propertyName || declaration.name; + var identifier = ts.getTextOfNodeFromSourceText(currentText, name_25); if (languageVersion === 0 /* ES3 */ && identifier === "default") { - write("[\"default\"]"); + write('["default"]'); } else { write("."); @@ -31714,13 +35533,26 @@ var ts; } } } - if (languageVersion !== 2 /* ES6 */) { - var declaration = resolver.getReferencedNestedRedeclaration(node); + if (languageVersion < 2 /* ES6 */) { + var declaration = resolver.getReferencedDeclarationWithCollidingName(node); if (declaration) { write(getGeneratedNameForNode(declaration.name)); return; } } + else if (resolver.getNodeCheckFlags(node) & 1048576 /* BodyScopedClassBinding */) { + // Due to the emit for class decorators, any reference to the class from inside of the class body + // must instead be rewritten to point to a temporary variable to avoid issues with the double-bind + // behavior of class names in ES6. + var declaration = resolver.getReferencedValueDeclaration(node); + if (declaration) { + var classAlias = decoratedClassAliases[ts.getNodeId(declaration)]; + if (classAlias !== undefined) { + write(classAlias); + return; + } + } + } } if (ts.nodeIsSynthesized(node)) { write(node.text); @@ -31729,15 +35561,15 @@ var ts; writeTextOfNode(currentText, node); } } - function isNameOfNestedRedeclaration(node) { + function isNameOfNestedBlockScopedRedeclarationOrCapturedBinding(node) { if (languageVersion < 2 /* ES6 */) { - var parent_6 = node.parent; - switch (parent_6.kind) { - case 163 /* BindingElement */: - case 214 /* ClassDeclaration */: - case 217 /* EnumDeclaration */: - case 211 /* VariableDeclaration */: - return parent_6.name === node && resolver.isNestedRedeclaration(parent_6); + var parent_13 = node.parent; + switch (parent_13.kind) { + case 169 /* BindingElement */: + case 221 /* ClassDeclaration */: + case 224 /* EnumDeclaration */: + case 218 /* VariableDeclaration */: + return parent_13.name === node && resolver.isDeclarationWithCollidingName(parent_13); } } return false; @@ -31746,8 +35578,8 @@ var ts; if (convertedLoopState) { if (node.text == "arguments" && resolver.isArgumentsLocalBinding(node)) { // in converted loop body arguments cannot be used directly. - var name_24 = convertedLoopState.argumentsName || (convertedLoopState.argumentsName = makeUniqueName("arguments")); - write(name_24); + var name_26 = convertedLoopState.argumentsName || (convertedLoopState.argumentsName = makeUniqueName("arguments")); + write(name_26); return; } } @@ -31757,7 +35589,7 @@ var ts; else if (isExpressionIdentifier(node)) { emitExpressionIdentifier(node); } - else if (isNameOfNestedRedeclaration(node)) { + else if (isNameOfNestedBlockScopedRedeclarationOrCapturedBinding(node)) { write(getGeneratedNameForNode(node)); } else if (ts.nodeIsSynthesized(node)) { @@ -31771,6 +35603,9 @@ var ts; if (resolver.getNodeCheckFlags(node) & 2 /* LexicalThis */) { write("_this"); } + else if (convertedLoopState) { + write(convertedLoopState.thisName || (convertedLoopState.thisName = makeUniqueName("this"))); + } else { write("this"); } @@ -31844,10 +35679,10 @@ var ts; } } function needsParenthesisForAwaitExpressionAsYield(node) { - if (node.parent.kind === 181 /* BinaryExpression */ && !ts.isAssignmentOperator(node.parent.operatorToken.kind)) { + if (node.parent.kind === 187 /* BinaryExpression */ && !ts.isAssignmentOperator(node.parent.operatorToken.kind)) { return true; } - else if (node.parent.kind === 182 /* ConditionalExpression */ && node.parent.condition === node) { + else if (node.parent.kind === 188 /* ConditionalExpression */ && node.parent.condition === node) { return true; } return false; @@ -31855,11 +35690,11 @@ var ts; function needsParenthesisForPropertyAccessOrInvocation(node) { switch (node.kind) { case 69 /* Identifier */: - case 164 /* ArrayLiteralExpression */: - case 166 /* PropertyAccessExpression */: - case 167 /* ElementAccessExpression */: - case 168 /* CallExpression */: - case 172 /* ParenthesizedExpression */: + case 170 /* ArrayLiteralExpression */: + case 172 /* PropertyAccessExpression */: + case 173 /* ElementAccessExpression */: + case 174 /* CallExpression */: + case 178 /* ParenthesizedExpression */: // This list is not exhaustive and only includes those cases that are relevant // to the check in emitArrayLiteral. More cases can be added as needed. return false; @@ -31879,17 +35714,17 @@ var ts; write(", "); } var e = elements[pos]; - if (e.kind === 185 /* SpreadElementExpression */) { + if (e.kind === 191 /* SpreadElementExpression */) { e = e.expression; emitParenthesizedIf(e, /*parenthesized*/ group === 0 && needsParenthesisForPropertyAccessOrInvocation(e)); pos++; - if (pos === length && group === 0 && needsUniqueCopy && e.kind !== 164 /* ArrayLiteralExpression */) { + if (pos === length && group === 0 && needsUniqueCopy && e.kind !== 170 /* ArrayLiteralExpression */) { write(".slice()"); } } else { var i = pos; - while (i < length && elements[i].kind !== 185 /* SpreadElementExpression */) { + while (i < length && elements[i].kind !== 191 /* SpreadElementExpression */) { i++; } write("["); @@ -31912,7 +35747,7 @@ var ts; } } function isSpreadElementExpression(node) { - return node.kind === 185 /* SpreadElementExpression */; + return node.kind === 191 /* SpreadElementExpression */; } function emitArrayLiteral(node) { var elements = node.elements; @@ -31921,11 +35756,11 @@ var ts; } else if (languageVersion >= 2 /* ES6 */ || !ts.forEach(elements, isSpreadElementExpression)) { write("["); - emitLinePreservingList(node, node.elements, elements.hasTrailingComma, /*spacesBetweenBraces:*/ false); + emitLinePreservingList(node, node.elements, elements.hasTrailingComma, /*spacesBetweenBraces*/ false); write("]"); } else { - emitListWithSpread(elements, /*needsUniqueCopy*/ true, /*multiLine*/ (node.flags & 1024 /* MultiLine */) !== 0, + emitListWithSpread(elements, /*needsUniqueCopy*/ true, /*multiLine*/ node.multiLine, /*trailingComma*/ elements.hasTrailingComma, /*useConcat*/ true); } } @@ -31941,10 +35776,10 @@ var ts; // then try to preserve the original shape of the object literal. // Otherwise just try to preserve the formatting. if (numElements === properties.length) { - emitLinePreservingList(node, properties, /* allowTrailingComma */ languageVersion >= 1 /* ES5 */, /* spacesBetweenBraces */ true); + emitLinePreservingList(node, properties, /*allowTrailingComma*/ languageVersion >= 1 /* ES5 */, /*spacesBetweenBraces*/ true); } else { - var multiLine = (node.flags & 1024 /* MultiLine */) !== 0; + var multiLine = node.multiLine; if (!multiLine) { write(" "); } @@ -31963,7 +35798,7 @@ var ts; write("}"); } function emitDownlevelObjectLiteralWithComputedProperties(node, firstComputedPropertyIndex) { - var multiLine = (node.flags & 1024 /* MultiLine */) !== 0; + var multiLine = node.multiLine; var properties = node.properties; write("("); if (multiLine) { @@ -31982,7 +35817,7 @@ var ts; writeComma(); var property = properties[i]; emitStart(property); - if (property.kind === 145 /* GetAccessor */ || property.kind === 146 /* SetAccessor */) { + if (property.kind === 149 /* GetAccessor */ || property.kind === 150 /* SetAccessor */) { // TODO (drosen): Reconcile with 'emitMemberFunctions'. var accessors = ts.getAllAccessorDeclarations(node.properties, property); if (property !== accessors.firstAccessor) { @@ -31991,7 +35826,7 @@ var ts; write("Object.defineProperty("); emit(tempVar); write(", "); - emitStart(node.name); + emitStart(property.name); emitExpressionForPropertyName(property.name); emitEnd(property.name); write(", {"); @@ -32034,13 +35869,13 @@ var ts; emitMemberAccessForPropertyName(property.name); emitEnd(property.name); write(" = "); - if (property.kind === 245 /* PropertyAssignment */) { + if (property.kind === 253 /* PropertyAssignment */) { emit(property.initializer); } - else if (property.kind === 246 /* ShorthandPropertyAssignment */) { + else if (property.kind === 254 /* ShorthandPropertyAssignment */) { emitExpressionIdentifier(property.name); } - else if (property.kind === 143 /* MethodDeclaration */) { + else if (property.kind === 147 /* MethodDeclaration */) { emitFunctionDeclaration(property); } else { @@ -32074,7 +35909,7 @@ var ts; // Everything until that point can be emitted as part of the initial object literal. var numInitialNonComputedProperties = numProperties; for (var i = 0, n = properties.length; i < n; i++) { - if (properties[i].name.kind === 136 /* ComputedPropertyName */) { + if (properties[i].name.kind === 140 /* ComputedPropertyName */) { numInitialNonComputedProperties = i; break; } @@ -32090,21 +35925,21 @@ var ts; emitObjectLiteralBody(node, properties.length); } function createBinaryExpression(left, operator, right, startsOnNewLine) { - var result = ts.createSynthesizedNode(181 /* BinaryExpression */, startsOnNewLine); + var result = ts.createSynthesizedNode(187 /* BinaryExpression */, startsOnNewLine); result.operatorToken = ts.createSynthesizedNode(operator); result.left = left; result.right = right; return result; } function createPropertyAccessExpression(expression, name) { - var result = ts.createSynthesizedNode(166 /* PropertyAccessExpression */); + var result = ts.createSynthesizedNode(172 /* PropertyAccessExpression */); result.expression = parenthesizeForAccess(expression); result.dotToken = ts.createSynthesizedNode(21 /* DotToken */); result.name = name; return result; } function createElementAccessExpression(expression, argumentExpression) { - var result = ts.createSynthesizedNode(167 /* ElementAccessExpression */); + var result = ts.createSynthesizedNode(173 /* ElementAccessExpression */); result.expression = parenthesizeForAccess(expression); result.argumentExpression = argumentExpression; return result; @@ -32112,7 +35947,9 @@ var ts; function parenthesizeForAccess(expr) { // When diagnosing whether the expression needs parentheses, the decision should be based // on the innermost expression in a chain of nested type assertions. - while (expr.kind === 171 /* TypeAssertionExpression */ || expr.kind === 189 /* AsExpression */) { + while (expr.kind === 177 /* TypeAssertionExpression */ || + expr.kind === 195 /* AsExpression */ || + expr.kind === 196 /* NonNullExpression */) { expr = expr.expression; } // isLeftHandSideExpression is almost the correct criterion for when it is not necessary @@ -32124,11 +35961,11 @@ var ts; // 1.x -> not the same as (1).x // if (ts.isLeftHandSideExpression(expr) && - expr.kind !== 169 /* NewExpression */ && + expr.kind !== 175 /* NewExpression */ && expr.kind !== 8 /* NumericLiteral */) { return expr; } - var node = ts.createSynthesizedNode(172 /* ParenthesizedExpression */); + var node = ts.createSynthesizedNode(178 /* ParenthesizedExpression */); node.expression = expr; return node; } @@ -32163,7 +36000,12 @@ var ts; // Return true if identifier resolves to an exported member of a namespace function isNamespaceExportReference(node) { var container = resolver.getReferencedExportContainer(node); - return container && container.kind !== 248 /* SourceFile */; + return container && container.kind !== 256 /* SourceFile */; + } + // Return true if identifier resolves to an imported identifier + function isImportedReference(node) { + var declaration = resolver.getReferencedImportDeclaration(node); + return declaration && (declaration.kind === 231 /* ImportClause */ || declaration.kind === 234 /* ImportSpecifier */); } function emitShorthandPropertyAssignment(node) { // The name property of a short-hand property assignment is considered an expression position, so here @@ -32178,7 +36020,18 @@ var ts; // let obj = { y }; // } // Here we need to emit obj = { y : m.y } regardless of the output target. - if (modulekind !== 5 /* ES6 */ || isNamespaceExportReference(node.name)) { + // The same rules apply for imported identifiers when targeting module formats with indirect access to + // the imported identifiers. For example, when targeting CommonJS: + // + // import {foo} from './foo'; + // export const baz = { foo }; + // + // Must be transformed into: + // + // const foo_1 = require('./foo'); + // exports.baz = { foo: foo_1.foo }; + // + if (languageVersion < 2 /* ES6 */ || (modulekind !== ts.ModuleKind.ES6 && isImportedReference(node.name)) || isNamespaceExportReference(node.name)) { // Emit identifier as an identifier write(": "); emit(node.name); @@ -32193,7 +36046,7 @@ var ts; if (constantValue !== undefined) { write(constantValue.toString()); if (!compilerOptions.removeComments) { - var propertyName = node.kind === 166 /* PropertyAccessExpression */ ? ts.declarationNameToString(node.name) : ts.getTextOfNode(node.argumentExpression); + var propertyName = node.kind === 172 /* PropertyAccessExpression */ ? ts.declarationNameToString(node.name) : ts.getTextOfNode(node.argumentExpression); write(" /* " + propertyName + " */"); } return true; @@ -32204,7 +36057,7 @@ var ts; if (compilerOptions.isolatedModules) { return undefined; } - return node.kind === 166 /* PropertyAccessExpression */ || node.kind === 167 /* ElementAccessExpression */ + return node.kind === 172 /* PropertyAccessExpression */ || node.kind === 173 /* ElementAccessExpression */ ? resolver.getConstantValue(node) : undefined; } @@ -32231,6 +36084,14 @@ var ts; if (tryEmitConstantValue(node)) { return; } + if (languageVersion === 2 /* ES6 */ && + node.expression.kind === 95 /* SuperKeyword */ && + isInAsyncMethodWithSuperInES6(node)) { + var name_27 = ts.createSynthesizedNode(9 /* StringLiteral */); + name_27.text = node.name.text; + emitSuperAccessInAsyncMethod(node.expression, name_27); + return; + } emit(node.expression); var indentedBeforeDot = indentIfOnDifferentLines(node, node.expression, node.dotToken); // 1 .toString is a valid property access, emit a space after the literal @@ -32293,25 +36154,37 @@ var ts; } emitExpressionIdentifier(node); break; - case 135 /* QualifiedName */: + case 139 /* QualifiedName */: emitQualifiedNameAsExpression(node, useFallback); break; + default: + emitNodeWithoutSourceMap(node); + break; } } function emitIndexedAccess(node) { if (tryEmitConstantValue(node)) { return; } + if (languageVersion === 2 /* ES6 */ && + node.expression.kind === 95 /* SuperKeyword */ && + isInAsyncMethodWithSuperInES6(node)) { + emitSuperAccessInAsyncMethod(node.expression, node.argumentExpression); + return; + } emit(node.expression); write("["); emit(node.argumentExpression); write("]"); } function hasSpreadElement(elements) { - return ts.forEach(elements, function (e) { return e.kind === 185 /* SpreadElementExpression */; }); + return ts.forEach(elements, function (e) { return e.kind === 191 /* SpreadElementExpression */; }); } function skipParentheses(node) { - while (node.kind === 172 /* ParenthesizedExpression */ || node.kind === 171 /* TypeAssertionExpression */ || node.kind === 189 /* AsExpression */) { + while (node.kind === 178 /* ParenthesizedExpression */ || + node.kind === 177 /* TypeAssertionExpression */ || + node.kind === 195 /* AsExpression */ || + node.kind === 196 /* NonNullExpression */) { node = node.expression; } return node; @@ -32332,13 +36205,13 @@ var ts; function emitCallWithSpread(node) { var target; var expr = skipParentheses(node.expression); - if (expr.kind === 166 /* PropertyAccessExpression */) { + if (expr.kind === 172 /* PropertyAccessExpression */) { // Target will be emitted as "this" argument target = emitCallTarget(expr.expression); write("."); emit(expr.name); } - else if (expr.kind === 167 /* ElementAccessExpression */) { + else if (expr.kind === 173 /* ElementAccessExpression */) { // Target will be emitted as "this" argument target = emitCallTarget(expr.expression); write("["); @@ -32371,23 +36244,42 @@ var ts; emitListWithSpread(node.arguments, /*needsUniqueCopy*/ false, /*multiLine*/ false, /*trailingComma*/ false, /*useConcat*/ true); write(")"); } + function isInAsyncMethodWithSuperInES6(node) { + if (languageVersion === 2 /* ES6 */) { + var container = ts.getSuperContainer(node, /*includeFunctions*/ false); + if (container && resolver.getNodeCheckFlags(container) & (2048 /* AsyncMethodWithSuper */ | 4096 /* AsyncMethodWithSuperBinding */)) { + return true; + } + } + return false; + } + function emitSuperAccessInAsyncMethod(superNode, argumentExpression) { + var container = ts.getSuperContainer(superNode, /*includeFunctions*/ false); + var isSuperBinding = resolver.getNodeCheckFlags(container) & 4096 /* AsyncMethodWithSuperBinding */; + write("_super("); + emit(argumentExpression); + write(isSuperBinding ? ").value" : ")"); + } function emitCallExpression(node) { if (languageVersion < 2 /* ES6 */ && hasSpreadElement(node.arguments)) { emitCallWithSpread(node); return; } + var expression = node.expression; var superCall = false; - if (node.expression.kind === 95 /* SuperKeyword */) { - emitSuper(node.expression); + var isAsyncMethodWithSuper = false; + if (expression.kind === 95 /* SuperKeyword */) { + emitSuper(expression); superCall = true; } else { - emit(node.expression); - superCall = node.expression.kind === 166 /* PropertyAccessExpression */ && node.expression.expression.kind === 95 /* SuperKeyword */; + superCall = ts.isSuperPropertyOrElementAccess(expression); + isAsyncMethodWithSuper = superCall && isInAsyncMethodWithSuperInES6(node); + emit(expression); } - if (superCall && languageVersion < 2 /* ES6 */) { + if (superCall && (languageVersion < 2 /* ES6 */ || isAsyncMethodWithSuper)) { write(".call("); - emitThis(node.expression); + emitThis(expression); if (node.arguments.length) { write(", "); emitCommaList(node.arguments); @@ -32425,7 +36317,7 @@ var ts; write(".bind.apply("); emit(target); write(", [void 0].concat("); - emitListWithSpread(node.arguments, /*needsUniqueCopy*/ false, /*multiline*/ false, /*trailingComma*/ false, /*useConcat*/ false); + emitListWithSpread(node.arguments, /*needsUniqueCopy*/ false, /*multiLine*/ false, /*trailingComma*/ false, /*useConcat*/ false); write(")))"); write("()"); } @@ -32452,12 +36344,16 @@ var ts; // If the node is synthesized, it means the emitter put the parentheses there, // not the user. If we didn't want them, the emitter would not have put them // there. - if (!ts.nodeIsSynthesized(node) && node.parent.kind !== 174 /* ArrowFunction */) { - if (node.expression.kind === 171 /* TypeAssertionExpression */ || node.expression.kind === 189 /* AsExpression */) { + if (!ts.nodeIsSynthesized(node) && node.parent.kind !== 180 /* ArrowFunction */) { + if (node.expression.kind === 177 /* TypeAssertionExpression */ || + node.expression.kind === 195 /* AsExpression */ || + node.expression.kind === 196 /* NonNullExpression */) { var operand = node.expression.expression; // Make sure we consider all nested cast expressions, e.g.: // (-A).x; - while (operand.kind === 171 /* TypeAssertionExpression */ || operand.kind === 189 /* AsExpression */) { + while (operand.kind === 177 /* TypeAssertionExpression */ || + operand.kind === 195 /* AsExpression */ || + operand.kind === 196 /* NonNullExpression */) { operand = operand.expression; } // We have an expression of the form: (SubExpr) @@ -32468,15 +36364,15 @@ var ts; // (typeof A).toString() should be emitted as (typeof A).toString() and not typeof A.toString() // new (A()) should be emitted as new (A()) and not new A() // (function foo() { })() should be emitted as an IIF (function foo(){})() and not declaration function foo(){} () - if (operand.kind !== 179 /* PrefixUnaryExpression */ && - operand.kind !== 177 /* VoidExpression */ && - operand.kind !== 176 /* TypeOfExpression */ && - operand.kind !== 175 /* DeleteExpression */ && - operand.kind !== 180 /* PostfixUnaryExpression */ && - operand.kind !== 169 /* NewExpression */ && - !(operand.kind === 168 /* CallExpression */ && node.parent.kind === 169 /* NewExpression */) && - !(operand.kind === 173 /* FunctionExpression */ && node.parent.kind === 168 /* CallExpression */) && - !(operand.kind === 8 /* NumericLiteral */ && node.parent.kind === 166 /* PropertyAccessExpression */)) { + if (operand.kind !== 185 /* PrefixUnaryExpression */ && + operand.kind !== 183 /* VoidExpression */ && + operand.kind !== 182 /* TypeOfExpression */ && + operand.kind !== 181 /* DeleteExpression */ && + operand.kind !== 186 /* PostfixUnaryExpression */ && + operand.kind !== 175 /* NewExpression */ && + !(operand.kind === 174 /* CallExpression */ && node.parent.kind === 175 /* NewExpression */) && + !(operand.kind === 179 /* FunctionExpression */ && node.parent.kind === 174 /* CallExpression */) && + !(operand.kind === 8 /* NumericLiteral */ && node.parent.kind === 172 /* PropertyAccessExpression */)) { emit(operand); return; } @@ -32505,14 +36401,15 @@ var ts; if (!isCurrentFileSystemExternalModule() || node.kind !== 69 /* Identifier */ || ts.nodeIsSynthesized(node)) { return false; } - var isVariableDeclarationOrBindingElement = node.parent && (node.parent.kind === 211 /* VariableDeclaration */ || node.parent.kind === 163 /* BindingElement */); + var isVariableDeclarationOrBindingElement = node.parent && (node.parent.kind === 218 /* VariableDeclaration */ || node.parent.kind === 169 /* BindingElement */); var targetDeclaration = isVariableDeclarationOrBindingElement ? node.parent : resolver.getReferencedValueDeclaration(node); return isSourceFileLevelDeclarationInSystemJsModule(targetDeclaration, /*isExported*/ true); } function emitPrefixUnaryExpression(node) { - var exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.operand); + var exportChanged = (node.operator === 41 /* PlusPlusToken */ || node.operator === 42 /* MinusMinusToken */) && + isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.operand); if (exportChanged) { // emit // ++x @@ -32535,7 +36432,7 @@ var ts; // the resulting expression a prefix increment operation. And in the second, it will make the resulting // expression a prefix increment whose operand is a plus expression - (++(+x)) // The same is true of minus of course. - if (node.operand.kind === 179 /* PrefixUnaryExpression */) { + if (node.operand.kind === 185 /* PrefixUnaryExpression */) { var operand = node.operand; if (node.operator === 35 /* PlusToken */ && (operand.operator === 35 /* PlusToken */ || operand.operator === 41 /* PlusPlusToken */)) { write(" "); @@ -32589,12 +36486,12 @@ var ts; if (!node || !isCurrentFileSystemExternalModule()) { return false; } - var current = node; + var current = ts.getRootDeclaration(node).parent; while (current) { - if (current.kind === 248 /* SourceFile */) { - return !isExported || ((ts.getCombinedNodeFlags(node) & 2 /* Export */) !== 0); + if (current.kind === 256 /* SourceFile */) { + return !isExported || ((ts.getCombinedNodeFlags(node) & 1 /* Export */) !== 0); } - else if (ts.isFunctionLike(current) || current.kind === 219 /* ModuleBlock */) { + else if (ts.isDeclaration(current)) { return false; } else { @@ -32609,19 +36506,19 @@ var ts; function emitExponentiationOperator(node) { var leftHandSideExpression = node.left; if (node.operatorToken.kind === 60 /* AsteriskAsteriskEqualsToken */) { - var synthesizedLHS; + var synthesizedLHS = void 0; var shouldEmitParentheses = false; if (ts.isElementAccessExpression(leftHandSideExpression)) { shouldEmitParentheses = true; write("("); - synthesizedLHS = ts.createSynthesizedNode(167 /* ElementAccessExpression */, /*startsOnNewLine*/ false); - var identifier = emitTempVariableAssignment(leftHandSideExpression.expression, /*canDefinedTempVariablesInPlaces*/ false, /*shouldEmitCommaBeforeAssignment*/ false); + synthesizedLHS = ts.createSynthesizedNode(173 /* ElementAccessExpression */, /*startsOnNewLine*/ false); + var identifier = emitTempVariableAssignment(leftHandSideExpression.expression, /*canDefineTempVariablesInPlace*/ false, /*shouldEmitCommaBeforeAssignment*/ false); synthesizedLHS.expression = identifier; if (leftHandSideExpression.argumentExpression.kind !== 8 /* NumericLiteral */ && leftHandSideExpression.argumentExpression.kind !== 9 /* StringLiteral */) { var tempArgumentExpression = createAndRecordTempVariable(268435456 /* _i */); synthesizedLHS.argumentExpression = tempArgumentExpression; - emitAssignment(tempArgumentExpression, leftHandSideExpression.argumentExpression, /*shouldEmitCommaBeforeAssignment*/ true); + emitAssignment(tempArgumentExpression, leftHandSideExpression.argumentExpression, /*shouldEmitCommaBeforeAssignment*/ true, leftHandSideExpression.expression); } else { synthesizedLHS.argumentExpression = leftHandSideExpression.argumentExpression; @@ -32631,8 +36528,8 @@ var ts; else if (ts.isPropertyAccessExpression(leftHandSideExpression)) { shouldEmitParentheses = true; write("("); - synthesizedLHS = ts.createSynthesizedNode(166 /* PropertyAccessExpression */, /*startsOnNewLine*/ false); - var identifier = emitTempVariableAssignment(leftHandSideExpression.expression, /*canDefinedTempVariablesInPlaces*/ false, /*shouldemitCommaBeforeAssignment*/ false); + synthesizedLHS = ts.createSynthesizedNode(172 /* PropertyAccessExpression */, /*startsOnNewLine*/ false); + var identifier = emitTempVariableAssignment(leftHandSideExpression.expression, /*canDefineTempVariablesInPlace*/ false, /*shouldEmitCommaBeforeAssignment*/ false); synthesizedLHS.expression = identifier; synthesizedLHS.dotToken = leftHandSideExpression.dotToken; synthesizedLHS.name = leftHandSideExpression.name; @@ -32659,8 +36556,8 @@ var ts; } function emitBinaryExpression(node) { if (languageVersion < 2 /* ES6 */ && node.operatorToken.kind === 56 /* EqualsToken */ && - (node.left.kind === 165 /* ObjectLiteralExpression */ || node.left.kind === 164 /* ArrayLiteralExpression */)) { - emitDestructuring(node, node.parent.kind === 195 /* ExpressionStatement */); + (node.left.kind === 171 /* ObjectLiteralExpression */ || node.left.kind === 170 /* ArrayLiteralExpression */)) { + emitDestructuring(node, node.parent.kind === 202 /* ExpressionStatement */); } else { var exportChanged = node.operatorToken.kind >= 56 /* FirstAssignment */ && @@ -32725,7 +36622,7 @@ var ts; } } function isSingleLineEmptyBlock(node) { - if (node && node.kind === 192 /* Block */) { + if (node && node.kind === 199 /* Block */) { var block = node; return block.statements.length === 0 && nodeEndIsOnSameLineAsNodeStart(block, block); } @@ -32739,22 +36636,20 @@ var ts; } emitToken(15 /* OpenBraceToken */, node.pos); increaseIndent(); - scopeEmitStart(node.parent); - if (node.kind === 219 /* ModuleBlock */) { - ts.Debug.assert(node.parent.kind === 218 /* ModuleDeclaration */); + if (node.kind === 226 /* ModuleBlock */) { + ts.Debug.assert(node.parent.kind === 225 /* ModuleDeclaration */); emitCaptureThisForNodeIfNecessary(node.parent); } emitLines(node.statements); - if (node.kind === 219 /* ModuleBlock */) { + if (node.kind === 226 /* ModuleBlock */) { emitTempDeclarations(/*newLine*/ true); } decreaseIndent(); writeLine(); emitToken(16 /* CloseBraceToken */, node.statements.end); - scopeEmitEnd(); } function emitEmbeddedStatement(node) { - if (node.kind === 192 /* Block */) { + if (node.kind === 199 /* Block */) { write(" "); emit(node); } @@ -32766,7 +36661,7 @@ var ts; } } function emitExpressionStatement(node) { - emitParenthesizedIf(node.expression, /*parenthesized*/ node.expression.kind === 174 /* ArrowFunction */); + emitParenthesizedIf(node.expression, /*parenthesized*/ node.expression.kind === 180 /* ArrowFunction */); write(";"); } function emitIfStatement(node) { @@ -32779,7 +36674,7 @@ var ts; if (node.elseStatement) { writeLine(); emitToken(80 /* ElseKeyword */, node.thenStatement.end); - if (node.elseStatement.kind === 196 /* IfStatement */) { + if (node.elseStatement.kind === 203 /* IfStatement */) { write(" "); emit(node.elseStatement); } @@ -32794,12 +36689,12 @@ var ts; function emitDoStatementWorker(node, loop) { write("do"); if (loop) { - emitConvertedLoopCall(loop, /* emitAsBlock */ true); + emitConvertedLoopCall(loop, /*emitAsBlock*/ true); } else { - emitNormalLoopBody(node, /* emitAsEmbeddedStatement */ true); + emitNormalLoopBody(node, /*emitAsEmbeddedStatement*/ true); } - if (node.statement.kind === 192 /* Block */) { + if (node.statement.kind === 199 /* Block */) { write(" "); } else { @@ -32817,10 +36712,10 @@ var ts; emit(node.expression); write(")"); if (loop) { - emitConvertedLoopCall(loop, /* emitAsBlock */ true); + emitConvertedLoopCall(loop, /*emitAsBlock*/ true); } else { - emitNormalLoopBody(node, /* emitAsEmbeddedStatement */ true); + emitNormalLoopBody(node, /*emitAsEmbeddedStatement*/ true); } } /** @@ -32828,13 +36723,13 @@ var ts; * Returns false if nothing was written - this can happen for source file level variable declarations * in system modules where such variable declarations are hoisted. */ - function tryEmitStartOfVariableDeclarationList(decl, startPos) { + function tryEmitStartOfVariableDeclarationList(decl) { if (shouldHoistVariable(decl, /*checkIfSourceFileLevelDecl*/ true)) { // variables in variable declaration list were already hoisted return false; } - if (convertedLoopState && (ts.getCombinedNodeFlags(decl) & 24576 /* BlockScoped */) === 0) { - // we are inside a converted loop - this can only happen in downlevel scenarios + if (convertedLoopState && (ts.getCombinedNodeFlags(decl) & 3072 /* BlockScoped */) === 0) { + // we are inside a converted loop - this can only happen in downlevel scenarios // record names for all variable declarations for (var _a = 0, _b = decl.declarations; _a < _b.length; _a++) { var varDecl = _b[_a]; @@ -32842,32 +36737,23 @@ var ts; } return false; } - var tokenKind = 102 /* VarKeyword */; + emitStart(decl); if (decl && languageVersion >= 2 /* ES6 */) { if (ts.isLet(decl)) { - tokenKind = 108 /* LetKeyword */; + write("let "); } else if (ts.isConst(decl)) { - tokenKind = 74 /* ConstKeyword */; + write("const "); + } + else { + write("var "); } - } - if (startPos !== undefined) { - emitToken(tokenKind, startPos); - write(" "); } else { - switch (tokenKind) { - case 102 /* VarKeyword */: - write("var "); - break; - case 108 /* LetKeyword */: - write("let "); - break; - case 74 /* ConstKeyword */: - write("const "); - break; - } + write("var "); } + // Note here we specifically dont emit end so that if we are going to emit binding pattern + // we can alter the source map correctly return true; } function emitVariableDeclarationListSkippingUninitializedEntries(list) { @@ -32889,7 +36775,7 @@ var ts; } function shouldConvertLoopBody(node) { return languageVersion < 2 /* ES6 */ && - (resolver.getNodeCheckFlags(node) & 65536 /* LoopWithBlockScopedBindingCapturedInFunction */) !== 0; + (resolver.getNodeCheckFlags(node) & 65536 /* LoopWithCapturedBlockScopedBinding */) !== 0; } function emitLoop(node, loopEmitter) { var shouldConvert = shouldConvertLoopBody(node); @@ -32898,7 +36784,7 @@ var ts; } else { var loop = convertLoopBody(node); - if (node.parent.kind === 207 /* LabeledStatement */) { + if (node.parent.kind === 214 /* LabeledStatement */) { // if parent of the loop was labeled statement - attach the label to loop skipping converted loop body emitLabelAndColon(node.parent); } @@ -32909,34 +36795,31 @@ var ts; var functionName = makeUniqueName("_loop"); var loopInitializer; switch (node.kind) { - case 199 /* ForStatement */: - case 200 /* ForInStatement */: - case 201 /* ForOfStatement */: - if (node.initializer.kind === 212 /* VariableDeclarationList */) { + case 206 /* ForStatement */: + case 207 /* ForInStatement */: + case 208 /* ForOfStatement */: + var initializer = node.initializer; + if (initializer && initializer.kind === 219 /* VariableDeclarationList */) { loopInitializer = node.initializer; } break; } var loopParameters; - if (loopInitializer && (ts.getCombinedNodeFlags(loopInitializer) & 24576 /* BlockScoped */)) { + var loopOutParameters; + if (loopInitializer && (ts.getCombinedNodeFlags(loopInitializer) & 3072 /* BlockScoped */)) { // if loop initializer contains block scoped variables - they should be passed to converted loop body as parameters loopParameters = []; for (var _a = 0, _b = loopInitializer.declarations; _a < _b.length; _a++) { var varDeclaration = _b[_a]; - collectNames(varDeclaration.name); + processVariableDeclaration(varDeclaration.name); } } - var bodyIsBlock = node.statement.kind === 192 /* Block */; + var bodyIsBlock = node.statement.kind === 199 /* Block */; var paramList = loopParameters ? loopParameters.join(", ") : ""; writeLine(); write("var " + functionName + " = function(" + paramList + ")"); - if (!bodyIsBlock) { - write(" {"); - writeLine(); - increaseIndent(); - } var convertedOuterLoopState = convertedLoopState; - convertedLoopState = {}; + convertedLoopState = { loopOutParameters: loopOutParameters }; if (convertedOuterLoopState) { // convertedOuterLoopState !== undefined means that this converted loop is nested in another converted loop. // if outer converted loop has already accumulated some state - pass it through @@ -32945,20 +36828,45 @@ var ts; // use the same name in all nested loops convertedLoopState.argumentsName = convertedOuterLoopState.argumentsName; } + if (convertedOuterLoopState.thisName) { + // outer loop has already used 'this' so we've already have some name to alias it + // use the same name in all nested loops + convertedLoopState.thisName = convertedOuterLoopState.thisName; + } if (convertedOuterLoopState.hoistedLocalVariables) { // we've already collected some non-block scoped variable declarations in enclosing loop // use the same storage in nested loop convertedLoopState.hoistedLocalVariables = convertedOuterLoopState.hoistedLocalVariables; } } - emitEmbeddedStatement(node.statement); - if (!bodyIsBlock) { - decreaseIndent(); - writeLine(); - write("}"); - } - write(";"); + write(" {"); writeLine(); + increaseIndent(); + if (bodyIsBlock) { + emitLines(node.statement.statements); + } + else { + emit(node.statement); + } + writeLine(); + // end of loop body -> copy out parameter + copyLoopOutParameters(convertedLoopState, 1 /* ToOutParameter */, /*emitAsStatements*/ true); + decreaseIndent(); + writeLine(); + write("};"); + writeLine(); + if (loopOutParameters) { + // declare variables to hold out params for loop body + write("var "); + for (var i = 0; i < loopOutParameters.length; i++) { + if (i !== 0) { + write(", "); + } + write(loopOutParameters[i].outParamName); + } + write(";"); + writeLine(); + } if (convertedLoopState.argumentsName) { // if alias for arguments is set if (convertedOuterLoopState) { @@ -32971,6 +36879,21 @@ var ts; writeLine(); } } + if (convertedLoopState.thisName) { + // if alias for this is set + if (convertedOuterLoopState) { + // pass it to outer converted loop + convertedOuterLoopState.thisName = convertedLoopState.thisName; + } + else { + // this is top level converted loop so we need to create an alias for 'this' here + // NOTE: + // if converted loops were all nested in arrow function then we'll always emit '_this' so convertedLoopState.thisName will not be set. + // If it is set this means that all nested loops are not nested in arrow function and it is safe to capture 'this'. + write("var " + convertedLoopState.thisName + " = this;"); + writeLine(); + } + } if (convertedLoopState.hoistedLocalVariables) { // if hoistedLocalVariables !== undefined this means that we've possibly collected some variable declarations to be hoisted later if (convertedOuterLoopState) { @@ -32980,7 +36903,7 @@ var ts; else { // deduplicate and hoist collected variable declarations write("var "); - var seen; + var seen = void 0; for (var _c = 0, _d = convertedLoopState.hoistedLocalVariables; _c < _d.length; _c++) { var id = _d[_c]; // Don't initialize seen unless we have at least one element. @@ -33003,15 +36926,21 @@ var ts; var currentLoopState = convertedLoopState; convertedLoopState = convertedOuterLoopState; return { functionName: functionName, paramList: paramList, state: currentLoopState }; - function collectNames(name) { + function processVariableDeclaration(name) { if (name.kind === 69 /* Identifier */) { - var nameText = isNameOfNestedRedeclaration(name) ? getGeneratedNameForNode(name) : name.text; + var nameText = isNameOfNestedBlockScopedRedeclarationOrCapturedBinding(name) + ? getGeneratedNameForNode(name) + : name.text; loopParameters.push(nameText); + if (resolver.getNodeCheckFlags(name.parent) & 2097152 /* NeedsLoopOutParameter */) { + var reassignedVariable = { originalName: name, outParamName: makeUniqueName("out_" + nameText) }; + (loopOutParameters || (loopOutParameters = [])).push(reassignedVariable); + } } else { for (var _a = 0, _b = name.elements; _a < _b.length; _a++) { var element = _b[_a]; - collectNames(element.name); + processVariableDeclaration(element.name); } } } @@ -33027,7 +36956,7 @@ var ts; if (emitAsEmbeddedStatement) { emitEmbeddedStatement(node.statement); } - else if (node.statement.kind === 192 /* Block */) { + else if (node.statement.kind === 199 /* Block */) { emitLines(node.statement.statements); } else { @@ -33038,6 +36967,28 @@ var ts; convertedLoopState.allowedNonLabeledJumps = saveAllowedNonLabeledJumps; } } + function copyLoopOutParameters(state, copyDirection, emitAsStatements) { + if (state.loopOutParameters) { + for (var _a = 0, _b = state.loopOutParameters; _a < _b.length; _a++) { + var outParam = _b[_a]; + if (copyDirection === 0 /* ToOriginal */) { + emitIdentifier(outParam.originalName); + write(" = " + outParam.outParamName); + } + else { + write(outParam.outParamName + " = "); + emitIdentifier(outParam.originalName); + } + if (emitAsStatements) { + write(";"); + writeLine(); + } + else { + write(", "); + } + } + } + } function emitConvertedLoopCall(loop, emitAsBlock) { if (emitAsBlock) { write(" {"); @@ -33046,7 +36997,8 @@ var ts; } // loop is considered simple if it does not have any return statements or break\continue that transfer control outside of the loop // simple loops are emitted as just 'loop()'; - var isSimpleLoop = !loop.state.nonLocalJumps && + // NOTE: if loop uses only 'continue' it still will be emitted as simple loop + var isSimpleLoop = !(loop.state.nonLocalJumps & ~4 /* Continue */) && !loop.state.labeledNonLocalBreaks && !loop.state.labeledNonLocalContinues; var loopResult = makeUniqueName("state"); @@ -33054,6 +37006,8 @@ var ts; write("var " + loopResult + " = "); } write(loop.functionName + "(" + loop.paramList + ");"); + writeLine(); + copyLoopOutParameters(loop.state, 0 /* ToOriginal */, /*emitAsStatements*/ true); if (!isSimpleLoop) { // for non simple loops we need to store result returned from converted loop function and use it to do dispatching // converted loop function can return: @@ -33071,7 +37025,7 @@ var ts; } else { // top level converted loop - return unwrapped value - write("return " + loopResult + ".value"); + write("return " + loopResult + ".value;"); } writeLine(); } @@ -33079,10 +37033,6 @@ var ts; write("if (" + loopResult + " === \"break\") break;"); writeLine(); } - if (loop.state.nonLocalJumps & 4 /* Continue */) { - write("if (" + loopResult + " === \"continue\") continue;"); - writeLine(); - } // in case of labeled breaks emit code that either breaks to some known label inside outer loop or delegates jump decision to outer loop emitDispatchTableForLabeledJumps(loopResult, loop.state, convertedLoopState); } @@ -33097,8 +37047,8 @@ var ts; } write("switch(" + loopResultVariable + ") {"); increaseIndent(); - emitDispatchEntriesForLabeledJumps(currentLoop.labeledNonLocalBreaks, /* isBreak */ true, loopResultVariable, outerLoop); - emitDispatchEntriesForLabeledJumps(currentLoop.labeledNonLocalContinues, /* isBreak */ false, loopResultVariable, outerLoop); + emitDispatchEntriesForLabeledJumps(currentLoop.labeledNonLocalBreaks, /*isBreak*/ true, loopResultVariable, outerLoop); + emitDispatchEntriesForLabeledJumps(currentLoop.labeledNonLocalContinues, /*isBreak*/ false, loopResultVariable, outerLoop); decreaseIndent(); writeLine(); write("}"); @@ -33113,7 +37063,7 @@ var ts; write("case \"" + labelMarker + "\": "); // if there are no outer converted loop or outer label in question is located inside outer converted loop // then emit labeled break\continue - // otherwise propagate pair 'label -> marker' to outer converted loop and emit 'return labelMarker' so outer loop can later decide what to do + // otherwise propagate pair 'label -> marker' to outer converted loop and emit 'return labelMarker' so outer loop can later decide what to do if (!outerLoop || (outerLoop.labels && outerLoop.labels[labelText])) { if (isBreak) { write("break "); @@ -33137,9 +37087,9 @@ var ts; var endPos = emitToken(86 /* ForKeyword */, node.pos); write(" "); endPos = emitToken(17 /* OpenParenToken */, endPos); - if (node.initializer && node.initializer.kind === 212 /* VariableDeclarationList */) { + if (node.initializer && node.initializer.kind === 219 /* VariableDeclarationList */) { var variableDeclarationList = node.initializer; - var startIsEmitted = tryEmitStartOfVariableDeclarationList(variableDeclarationList, endPos); + var startIsEmitted = tryEmitStartOfVariableDeclarationList(variableDeclarationList); if (startIsEmitted) { emitCommaList(variableDeclarationList.declarations); } @@ -33156,14 +37106,14 @@ var ts; emitOptional(" ", node.incrementor); write(")"); if (loop) { - emitConvertedLoopCall(loop, /* emitAsBlock */ true); + emitConvertedLoopCall(loop, /*emitAsBlock*/ true); } else { - emitNormalLoopBody(node, /* emitAsEmbeddedStatement */ true); + emitNormalLoopBody(node, /*emitAsEmbeddedStatement*/ true); } } function emitForInOrForOfStatement(node) { - if (languageVersion < 2 /* ES6 */ && node.kind === 201 /* ForOfStatement */) { + if (languageVersion < 2 /* ES6 */ && node.kind === 208 /* ForOfStatement */) { emitLoop(node, emitDownLevelForOfStatementWorker); } else { @@ -33174,17 +37124,17 @@ var ts; var endPos = emitToken(86 /* ForKeyword */, node.pos); write(" "); endPos = emitToken(17 /* OpenParenToken */, endPos); - if (node.initializer.kind === 212 /* VariableDeclarationList */) { + if (node.initializer.kind === 219 /* VariableDeclarationList */) { var variableDeclarationList = node.initializer; if (variableDeclarationList.declarations.length >= 1) { - tryEmitStartOfVariableDeclarationList(variableDeclarationList, endPos); + tryEmitStartOfVariableDeclarationList(variableDeclarationList); emit(variableDeclarationList.declarations[0]); } } else { emit(node.initializer); } - if (node.kind === 200 /* ForInStatement */) { + if (node.kind === 207 /* ForInStatement */) { write(" in "); } else { @@ -33193,15 +37143,12 @@ var ts; emit(node.expression); emitToken(18 /* CloseParenToken */, node.expression.end); if (loop) { - emitConvertedLoopCall(loop, /* emitAsBlock */ true); + emitConvertedLoopCall(loop, /*emitAsBlock*/ true); } else { - emitNormalLoopBody(node, /* emitAsEmbeddedStatement */ true); + emitNormalLoopBody(node, /*emitAsEmbeddedStatement*/ true); } } - function emitDownLevelForOfStatement(node) { - emitLoop(node, emitDownLevelForOfStatementWorker); - } function emitDownLevelForOfStatementWorker(node, loop) { // The following ES6 code: // @@ -33256,18 +37203,18 @@ var ts; emitEnd(node.expression); write("; "); // _i < _a.length; - emitStart(node.initializer); + emitStart(node.expression); emitNodeWithoutSourceMap(counter); write(" < "); emitNodeWithCommentsAndWithoutSourcemap(rhsReference); write(".length"); - emitEnd(node.initializer); + emitEnd(node.expression); write("; "); // _i++) - emitStart(node.initializer); + emitStart(node.expression); emitNodeWithoutSourceMap(counter); write("++"); - emitEnd(node.initializer); + emitEnd(node.expression); emitToken(18 /* CloseParenToken */, node.expression.end); // Body write(" {"); @@ -33277,7 +37224,7 @@ var ts; // let v = _a[_i]; var rhsIterationValue = createElementAccessExpression(rhsReference, counter); emitStart(node.initializer); - if (node.initializer.kind === 212 /* VariableDeclarationList */) { + if (node.initializer.kind === 219 /* VariableDeclarationList */) { write("var "); var variableDeclarationList = node.initializer; if (variableDeclarationList.declarations.length > 0) { @@ -33307,7 +37254,7 @@ var ts; // Initializer is an expression. Emit the expression in the body, so that it's // evaluated on every iteration. var assignmentExpression = createBinaryExpression(node.initializer, 56 /* EqualsToken */, rhsIterationValue, /*startsOnNewLine*/ false); - if (node.initializer.kind === 164 /* ArrayLiteralExpression */ || node.initializer.kind === 165 /* ObjectLiteralExpression */) { + if (node.initializer.kind === 170 /* ArrayLiteralExpression */ || node.initializer.kind === 171 /* ObjectLiteralExpression */) { // This is a destructuring pattern, so call emitDestructuring instead of emit. Calling emit will not work, because it will cause // the BinaryExpression to be passed in instead of the expression statement, which will cause emitDestructuring to crash. emitDestructuring(assignmentExpression, /*isAssignmentExpressionStatement*/ true, /*value*/ undefined); @@ -33320,10 +37267,10 @@ var ts; write(";"); if (loop) { writeLine(); - emitConvertedLoopCall(loop, /* emitAsBlock */ false); + emitConvertedLoopCall(loop, /*emitAsBlock*/ false); } else { - emitNormalLoopBody(node, /* emitAsEmbeddedStatement */ false); + emitNormalLoopBody(node, /*emitAsEmbeddedStatement*/ false); } writeLine(); decreaseIndent(); @@ -33335,36 +37282,40 @@ var ts; // it is possible if either // - break\continue is statement labeled and label is located inside the converted loop // - break\continue is non-labeled and located in non-converted loop\switch statement - var jump = node.kind === 203 /* BreakStatement */ ? 2 /* Break */ : 4 /* Continue */; + var jump = node.kind === 210 /* BreakStatement */ ? 2 /* Break */ : 4 /* Continue */; var canUseBreakOrContinue = (node.label && convertedLoopState.labels && convertedLoopState.labels[node.label.text]) || (!node.label && (convertedLoopState.allowedNonLabeledJumps & jump)); if (!canUseBreakOrContinue) { + write("return "); + // explicit exit from loop -> copy out parameters + copyLoopOutParameters(convertedLoopState, 1 /* ToOutParameter */, /*emitAsStatements*/ false); if (!node.label) { - if (node.kind === 203 /* BreakStatement */) { + if (node.kind === 210 /* BreakStatement */) { convertedLoopState.nonLocalJumps |= 2 /* Break */; - write("return \"break\";"); + write("\"break\";"); } else { convertedLoopState.nonLocalJumps |= 4 /* Continue */; - write("return \"continue\";"); + // note: return value is emitted only to simplify debugging, call to converted loop body does not do any dispatching on it. + write("\"continue\";"); } } else { - var labelMarker; - if (node.kind === 203 /* BreakStatement */) { + var labelMarker = void 0; + if (node.kind === 210 /* BreakStatement */) { labelMarker = "break-" + node.label.text; - setLabeledJump(convertedLoopState, /* isBreak */ true, node.label.text, labelMarker); + setLabeledJump(convertedLoopState, /*isBreak*/ true, node.label.text, labelMarker); } else { labelMarker = "continue-" + node.label.text; - setLabeledJump(convertedLoopState, /* isBreak */ false, node.label.text, labelMarker); + setLabeledJump(convertedLoopState, /*isBreak*/ false, node.label.text, labelMarker); } - write("return \"" + labelMarker + "\";"); + write("\"" + labelMarker + "\";"); } return; } } - emitToken(node.kind === 203 /* BreakStatement */ ? 70 /* BreakKeyword */ : 75 /* ContinueKeyword */, node.pos); + emitToken(node.kind === 210 /* BreakStatement */ ? 70 /* BreakKeyword */ : 75 /* ContinueKeyword */, node.pos); emitOptional(" ", node.label); write(";"); } @@ -33430,7 +37381,7 @@ var ts; ts.getLineOfLocalPositionFromLineMap(currentLineMap, ts.skipTrivia(currentText, node2.pos)); } function emitCaseOrDefaultClause(node) { - if (node.kind === 241 /* CaseClause */) { + if (node.kind === 249 /* CaseClause */) { write("case "); emit(node.expression); write(":"); @@ -33499,7 +37450,7 @@ var ts; function getContainingModule(node) { do { node = node.parent; - } while (node && node.kind !== 218 /* ModuleDeclaration */); + } while (node && node.kind !== 225 /* ModuleDeclaration */); return node; } function emitContainingModuleName(node) { @@ -33508,13 +37459,13 @@ var ts; } function emitModuleMemberName(node) { emitStart(node.name); - if (ts.getCombinedNodeFlags(node) & 2 /* Export */) { + if (ts.getCombinedNodeFlags(node) & 1 /* Export */) { var container = getContainingModule(node); if (container) { write(getGeneratedNameForNode(container)); write("."); } - else if (modulekind !== 5 /* ES6 */ && modulekind !== 4 /* System */) { + else if (modulekind !== ts.ModuleKind.ES6 && modulekind !== ts.ModuleKind.System) { write("exports."); } } @@ -33524,22 +37475,22 @@ var ts; function createVoidZero() { var zero = ts.createSynthesizedNode(8 /* NumericLiteral */); zero.text = "0"; - var result = ts.createSynthesizedNode(177 /* VoidExpression */); + var result = ts.createSynthesizedNode(183 /* VoidExpression */); result.expression = zero; return result; } function emitEs6ExportDefaultCompat(node) { - if (node.parent.kind === 248 /* SourceFile */) { - ts.Debug.assert(!!(node.flags & 512 /* Default */) || node.kind === 227 /* ExportAssignment */); + if (node.parent.kind === 256 /* SourceFile */) { + ts.Debug.assert(!!(node.flags & 512 /* Default */) || node.kind === 235 /* ExportAssignment */); // only allow export default at a source file level - if (modulekind === 1 /* CommonJS */ || modulekind === 2 /* AMD */ || modulekind === 3 /* UMD */) { + if (modulekind === ts.ModuleKind.CommonJS || modulekind === ts.ModuleKind.AMD || modulekind === ts.ModuleKind.UMD) { if (!isEs6Module) { - if (languageVersion === 1 /* ES5 */) { + if (languageVersion !== 0 /* ES3 */) { // default value of configurable, enumerable, writable are `false`. - write("Object.defineProperty(exports, \"__esModule\", { value: true });"); + write('Object.defineProperty(exports, "__esModule", { value: true });'); writeLine(); } - else if (languageVersion === 0 /* ES3 */) { + else { write("exports.__esModule = true;"); writeLine(); } @@ -33548,11 +37499,11 @@ var ts; } } function emitExportMemberAssignment(node) { - if (node.flags & 2 /* Export */) { + if (node.flags & 1 /* Export */) { writeLine(); emitStart(node); // emit call to exporter only for top level nodes - if (modulekind === 4 /* System */ && node.parent === currentSourceFile) { + if (modulekind === ts.ModuleKind.System && node.parent === currentSourceFile) { // emit export default as // export("default", ) write(exportFunctionForFile + "(\""); @@ -33570,7 +37521,7 @@ var ts; if (node.flags & 512 /* Default */) { emitEs6ExportDefaultCompat(node); if (languageVersion === 0 /* ES3 */) { - write("exports[\"default\"]"); + write('exports["default"]'); } else { write("exports.default"); @@ -33587,7 +37538,7 @@ var ts; } } function emitExportMemberAssignments(name) { - if (modulekind === 4 /* System */) { + if (modulekind === ts.ModuleKind.System) { return; } if (!exportEquals && exportSpecifiers && ts.hasProperty(exportSpecifiers, name.text)) { @@ -33606,7 +37557,7 @@ var ts; } } function emitExportSpecifierInSystemModule(specifier) { - ts.Debug.assert(modulekind === 4 /* System */); + ts.Debug.assert(modulekind === ts.ModuleKind.System); if (!resolver.getReferencedValueDeclaration(specifier.propertyName || specifier.name) && !resolver.isValueAliasDeclaration(specifier)) { return; } @@ -33626,7 +37577,7 @@ var ts; * @param value an expression as a right-hand-side operand of the assignment * @param shouldEmitCommaBeforeAssignment a boolean indicating whether to prefix an assignment with comma */ - function emitAssignment(name, value, shouldEmitCommaBeforeAssignment) { + function emitAssignment(name, value, shouldEmitCommaBeforeAssignment, nodeForSourceMap) { if (shouldEmitCommaBeforeAssignment) { write(", "); } @@ -33636,15 +37587,21 @@ var ts; emitNodeWithCommentsAndWithoutSourcemap(name); write("\", "); } - var isVariableDeclarationOrBindingElement = name.parent && (name.parent.kind === 211 /* VariableDeclaration */ || name.parent.kind === 163 /* BindingElement */); - if (isVariableDeclarationOrBindingElement) { - emitModuleMemberName(name.parent); - } - else { - emit(name); - } - write(" = "); - emit(value); + var isVariableDeclarationOrBindingElement = name.parent && (name.parent.kind === 218 /* VariableDeclaration */ || name.parent.kind === 169 /* BindingElement */); + // If this is first var declaration, we need to start at var/let/const keyword instead + // otherwise use nodeForSourceMap as the start position + emitStart(isFirstVariableDeclaration(nodeForSourceMap) ? nodeForSourceMap.parent : nodeForSourceMap); + withTemporaryNoSourceMap(function () { + if (isVariableDeclarationOrBindingElement) { + emitModuleMemberName(name.parent); + } + else { + emit(name); + } + write(" = "); + emit(value); + }); + emitEnd(nodeForSourceMap, /*stopOverridingSpan*/ true); if (exportChanged) { write(")"); } @@ -33655,14 +37612,19 @@ var ts; * @param canDefineTempVariablesInPlace a boolean indicating whether you can define the temporary variable at an assignment location * @param shouldEmitCommaBeforeAssignment a boolean indicating whether an assignment should prefix with comma */ - function emitTempVariableAssignment(expression, canDefineTempVariablesInPlace, shouldEmitCommaBeforeAssignment) { + function emitTempVariableAssignment(expression, canDefineTempVariablesInPlace, shouldEmitCommaBeforeAssignment, sourceMapNode) { var identifier = createTempVariable(0 /* Auto */); if (!canDefineTempVariablesInPlace) { recordTempDeclaration(identifier); } - emitAssignment(identifier, expression, shouldEmitCommaBeforeAssignment); + emitAssignment(identifier, expression, shouldEmitCommaBeforeAssignment, sourceMapNode || expression.parent); return identifier; } + function isFirstVariableDeclaration(root) { + return root.kind === 218 /* VariableDeclaration */ && + root.parent.kind === 219 /* VariableDeclarationList */ && + root.parent.declarations[0] === root; + } function emitDestructuring(root, isAssignmentExpressionStatement, value) { var emitCount = 0; // An exported declaration is actually emitted as an assignment (to a property on the module object), so @@ -33670,19 +37632,24 @@ var ts; // Also temporary variables should be explicitly allocated for source level declarations when module target is system // because actual variable declarations are hoisted var canDefineTempVariablesInPlace = false; - if (root.kind === 211 /* VariableDeclaration */) { - var isExported = ts.getCombinedNodeFlags(root) & 2 /* Export */; + if (root.kind === 218 /* VariableDeclaration */) { + var isExported = ts.getCombinedNodeFlags(root) & 1 /* Export */; var isSourceLevelForSystemModuleKind = shouldHoistDeclarationInSystemJsModule(root); canDefineTempVariablesInPlace = !isExported && !isSourceLevelForSystemModuleKind; } - else if (root.kind === 138 /* Parameter */) { + else if (root.kind === 142 /* Parameter */) { canDefineTempVariablesInPlace = true; } - if (root.kind === 181 /* BinaryExpression */) { + if (root.kind === 187 /* BinaryExpression */) { emitAssignmentExpression(root); } else { ts.Debug.assert(!isAssignmentExpressionStatement); + // If first variable declaration of variable statement correct the start location + if (isFirstVariableDeclaration(root)) { + // Use emit location of "var " as next emit start entry + sourceMap.changeEmitSourcePos(); + } emitBindingElement(root, value); } /** @@ -33694,27 +37661,28 @@ var ts; * @param reuseIdentifierExpressions true if identifier expressions can simply be returned; * false if it is necessary to always emit an identifier. */ - function ensureIdentifier(expr, reuseIdentifierExpressions) { + function ensureIdentifier(expr, reuseIdentifierExpressions, sourceMapNode) { if (expr.kind === 69 /* Identifier */ && reuseIdentifierExpressions) { return expr; } - var identifier = emitTempVariableAssignment(expr, canDefineTempVariablesInPlace, emitCount > 0); + var identifier = emitTempVariableAssignment(expr, canDefineTempVariablesInPlace, emitCount > 0, sourceMapNode); emitCount++; return identifier; } - function createDefaultValueCheck(value, defaultValue) { + function createDefaultValueCheck(value, defaultValue, sourceMapNode) { // The value expression will be evaluated twice, so for anything but a simple identifier // we need to generate a temporary variable - value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true); + // If the temporary variable needs to be emitted use the source Map node for assignment of that statement + value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true, sourceMapNode); // Return the expression 'value === void 0 ? defaultValue : value' - var equals = ts.createSynthesizedNode(181 /* BinaryExpression */); + var equals = ts.createSynthesizedNode(187 /* BinaryExpression */); equals.left = value; equals.operatorToken = ts.createSynthesizedNode(32 /* EqualsEqualsEqualsToken */); equals.right = createVoidZero(); return createConditionalExpression(equals, defaultValue, value); } function createConditionalExpression(condition, whenTrue, whenFalse) { - var cond = ts.createSynthesizedNode(182 /* ConditionalExpression */); + var cond = ts.createSynthesizedNode(188 /* ConditionalExpression */); cond.condition = condition; cond.questionToken = ts.createSynthesizedNode(53 /* QuestionToken */); cond.whenTrue = whenTrue; @@ -33729,22 +37697,27 @@ var ts; } function createPropertyAccessForDestructuringProperty(object, propName) { var index; - var nameIsComputed = propName.kind === 136 /* ComputedPropertyName */; + var nameIsComputed = propName.kind === 140 /* ComputedPropertyName */; if (nameIsComputed) { - index = ensureIdentifier(propName.expression, /* reuseIdentifierExpression */ false); + // TODO to handle when we look into sourcemaps for computed properties, for now use propName + index = ensureIdentifier(propName.expression, /*reuseIdentifierExpressions*/ false, propName); } else { // We create a synthetic copy of the identifier in order to avoid the rewriting that might // otherwise occur when the identifier is emitted. index = ts.createSynthesizedNode(propName.kind); - index.text = propName.text; + // We need to unescape identifier here because when parsing an identifier prefixing with "__" + // the parser need to append "_" in order to escape colliding with magic identifiers such as "__proto__" + // Therefore, in order to correctly emit identifiers that are written in original TypeScript file, + // we will unescapeIdentifier to remove additional underscore (if no underscore is added, the function will return original input string) + index.text = ts.unescapeIdentifier(propName.text); } return !nameIsComputed && index.kind === 69 /* Identifier */ ? createPropertyAccessExpression(object, index) : createElementAccessExpression(object, index); } function createSliceCall(value, sliceIndex) { - var call = ts.createSynthesizedNode(168 /* CallExpression */); + var call = ts.createSynthesizedNode(174 /* CallExpression */); var sliceIdentifier = ts.createSynthesizedNode(69 /* Identifier */); sliceIdentifier.text = "slice"; call.expression = createPropertyAccessExpression(value, sliceIdentifier); @@ -33752,60 +37725,65 @@ var ts; call.arguments[0] = createNumericLiteral(sliceIndex); return call; } - function emitObjectLiteralAssignment(target, value) { + function emitObjectLiteralAssignment(target, value, sourceMapNode) { var properties = target.properties; if (properties.length !== 1) { // For anything but a single element destructuring we need to generate a temporary // to ensure value is evaluated exactly once. - value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true); + // When doing so we want to highlight the passed in source map node since thats the one needing this temp assignment + value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true, sourceMapNode); } for (var _a = 0, properties_5 = properties; _a < properties_5.length; _a++) { var p = properties_5[_a]; - if (p.kind === 245 /* PropertyAssignment */ || p.kind === 246 /* ShorthandPropertyAssignment */) { + if (p.kind === 253 /* PropertyAssignment */ || p.kind === 254 /* ShorthandPropertyAssignment */) { var propName = p.name; - var target_1 = p.kind === 246 /* ShorthandPropertyAssignment */ ? p : p.initializer || propName; - emitDestructuringAssignment(target_1, createPropertyAccessForDestructuringProperty(value, propName)); + var target_1 = p.kind === 254 /* ShorthandPropertyAssignment */ ? p : p.initializer || propName; + // Assignment for target = value.propName should highlight whole property, hence use p as source map node + emitDestructuringAssignment(target_1, createPropertyAccessForDestructuringProperty(value, propName), p); } } } - function emitArrayLiteralAssignment(target, value) { + function emitArrayLiteralAssignment(target, value, sourceMapNode) { var elements = target.elements; if (elements.length !== 1) { // For anything but a single element destructuring we need to generate a temporary // to ensure value is evaluated exactly once. - value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true); + // When doing so we want to highlight the passed in source map node since thats the one needing this temp assignment + value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true, sourceMapNode); } for (var i = 0; i < elements.length; i++) { var e = elements[i]; - if (e.kind !== 187 /* OmittedExpression */) { - if (e.kind !== 185 /* SpreadElementExpression */) { - emitDestructuringAssignment(e, createElementAccessExpression(value, createNumericLiteral(i))); + if (e.kind !== 193 /* OmittedExpression */) { + // Assignment for target = value.propName should highlight whole property, hence use e as source map node + if (e.kind !== 191 /* SpreadElementExpression */) { + emitDestructuringAssignment(e, createElementAccessExpression(value, createNumericLiteral(i)), e); } else if (i === elements.length - 1) { - emitDestructuringAssignment(e.expression, createSliceCall(value, i)); + emitDestructuringAssignment(e.expression, createSliceCall(value, i), e); } } } } - function emitDestructuringAssignment(target, value) { - if (target.kind === 246 /* ShorthandPropertyAssignment */) { + function emitDestructuringAssignment(target, value, sourceMapNode) { + // When emitting target = value use source map node to highlight, including any temporary assignments needed for this + if (target.kind === 254 /* ShorthandPropertyAssignment */) { if (target.objectAssignmentInitializer) { - value = createDefaultValueCheck(value, target.objectAssignmentInitializer); + value = createDefaultValueCheck(value, target.objectAssignmentInitializer, sourceMapNode); } target = target.name; } - else if (target.kind === 181 /* BinaryExpression */ && target.operatorToken.kind === 56 /* EqualsToken */) { - value = createDefaultValueCheck(value, target.right); + else if (target.kind === 187 /* BinaryExpression */ && target.operatorToken.kind === 56 /* EqualsToken */) { + value = createDefaultValueCheck(value, target.right, sourceMapNode); target = target.left; } - if (target.kind === 165 /* ObjectLiteralExpression */) { - emitObjectLiteralAssignment(target, value); + if (target.kind === 171 /* ObjectLiteralExpression */) { + emitObjectLiteralAssignment(target, value, sourceMapNode); } - else if (target.kind === 164 /* ArrayLiteralExpression */) { - emitArrayLiteralAssignment(target, value); + else if (target.kind === 170 /* ArrayLiteralExpression */) { + emitArrayLiteralAssignment(target, value, sourceMapNode); } else { - emitAssignment(target, value, /*shouldEmitCommaBeforeAssignment*/ emitCount > 0); + emitAssignment(target, value, /*shouldEmitCommaBeforeAssignment*/ emitCount > 0, sourceMapNode); emitCount++; } } @@ -33816,25 +37794,32 @@ var ts; emit(value); } else if (isAssignmentExpressionStatement) { - emitDestructuringAssignment(target, value); + // Source map node for root.left = root.right is root + // but if root is synthetic, which could be in below case, use the target which is { a } + // for ({a} of {a: string}) { + // } + emitDestructuringAssignment(target, value, ts.nodeIsSynthesized(root) ? target : root); } else { - if (root.parent.kind !== 172 /* ParenthesizedExpression */) { + if (root.parent.kind !== 178 /* ParenthesizedExpression */) { write("("); } - value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true); - emitDestructuringAssignment(target, value); + // Temporary assignment needed to emit root should highlight whole binary expression + value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true, root); + // Source map node for root.left = root.right is root + emitDestructuringAssignment(target, value, root); write(", "); emit(value); - if (root.parent.kind !== 172 /* ParenthesizedExpression */) { + if (root.parent.kind !== 178 /* ParenthesizedExpression */) { write(")"); } } } function emitBindingElement(target, value) { + // Any temporary assignments needed to emit target = value should point to target if (target.initializer) { // Combine value and initializer - value = value ? createDefaultValueCheck(value, target.initializer) : target.initializer; + value = value ? createDefaultValueCheck(value, target.initializer, target) : target.initializer; } else if (!value) { // Use 'void 0' in absence of value and initializer @@ -33849,16 +37834,16 @@ var ts; // to ensure value is evaluated exactly once. Additionally, if we have zero elements // we need to emit *something* to ensure that in case a 'var' keyword was already emitted, // so in that case, we'll intentionally create that temporary. - value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ numElements !== 0); + value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ numElements !== 0, target); } for (var i = 0; i < numElements; i++) { var element = elements[i]; - if (pattern.kind === 161 /* ObjectBindingPattern */) { + if (pattern.kind === 167 /* ObjectBindingPattern */) { // Rewrite element to a declaration with an initializer that fetches property var propName = element.propertyName || element.name; emitBindingElement(element, createPropertyAccessForDestructuringProperty(value, propName)); } - else if (element.kind !== 187 /* OmittedExpression */) { + else if (element.kind !== 193 /* OmittedExpression */) { if (!element.dotDotDotToken) { // Rewrite element to a declaration that accesses array element at index i emitBindingElement(element, createElementAccessExpression(value, createNumericLiteral(i))); @@ -33870,36 +37855,77 @@ var ts; } } else { - emitAssignment(target.name, value, /*shouldEmitCommaBeforeAssignment*/ emitCount > 0); + emitAssignment(target.name, value, /*shouldEmitCommaBeforeAssignment*/ emitCount > 0, target); emitCount++; } } } function emitVariableDeclaration(node) { if (ts.isBindingPattern(node.name)) { - if (languageVersion < 2 /* ES6 */) { - emitDestructuring(node, /*isAssignmentExpressionStatement*/ false); - } - else { + var isExported = ts.getCombinedNodeFlags(node) & 1 /* Export */; + if (languageVersion >= 2 /* ES6 */ && (!isExported || modulekind === ts.ModuleKind.ES6)) { + // emit ES6 destructuring only if target module is ES6 or variable is not exported + // exported variables in CJS/AMD are prefixed with 'exports.' so result javascript { exports.toString } = 1; is illegal + var isTopLevelDeclarationInSystemModule = modulekind === ts.ModuleKind.System && + shouldHoistVariable(node, /*checkIfSourceFileLevelDecl*/ true); + if (isTopLevelDeclarationInSystemModule) { + // In System modules top level variables are hoisted + // so variable declarations with destructuring are turned into destructuring assignments. + // As a result, they will need parentheses to disambiguate object binding assignments from blocks. + write("("); + } emit(node.name); emitOptional(" = ", node.initializer); + if (isTopLevelDeclarationInSystemModule) { + write(")"); + } + } + else { + emitDestructuring(node, /*isAssignmentExpressionStatement*/ false); } } else { var initializer = node.initializer; - if (!initializer && languageVersion < 2 /* ES6 */) { - // downlevel emit for non-initialized let bindings defined in loops - // for (...) { let x; } - // should be - // for (...) { var = void 0; } - // this is necessary to preserve ES6 semantic in scenarios like - // for (...) { let x; console.log(x); x = 1 } // assignment on one iteration should not affect other iterations - var isLetDefinedInLoop = (resolver.getNodeCheckFlags(node) & 16384 /* BlockScopedBindingInLoop */) && - (getCombinedFlagsForIdentifier(node.name) & 8192 /* Let */); - // NOTE: default initialization should not be added to let bindings in for-in\for-of statements - if (isLetDefinedInLoop && - node.parent.parent.kind !== 200 /* ForInStatement */ && - node.parent.parent.kind !== 201 /* ForOfStatement */) { + if (!initializer && + languageVersion < 2 /* ES6 */ && + // for names - binding patterns that lack initializer there is no point to emit explicit initializer + // since downlevel codegen for destructuring will fail in the absence of initializer so all binding elements will say uninitialized + node.name.kind === 69 /* Identifier */) { + var container = ts.getEnclosingBlockScopeContainer(node); + var flags = resolver.getNodeCheckFlags(node); + // nested let bindings might need to be initialized explicitly to preserve ES6 semantic + // { let x = 1; } + // { let x; } // x here should be undefined. not 1 + // NOTES: + // Top level bindings never collide with anything and thus don't require explicit initialization. + // As for nested let bindings there are two cases: + // - nested let bindings that were not renamed definitely should be initialized explicitly + // { let x = 1; } + // { let x; if (some-condition) { x = 1}; if (x) { /*1*/ } } + // Without explicit initialization code in /*1*/ can be executed even if some-condition is evaluated to false + // - renaming introduces fresh name that should not collide with any existing names, however renamed bindings sometimes also should be + // explicitly initialized. One particular case: non-captured binding declared inside loop body (but not in loop initializer) + // let x; + // for (;;) { + // let x; + // } + // in downlevel codegen inner 'x' will be renamed so it won't collide with outer 'x' however it will should be reset on every iteration + // as if it was declared anew. + // * Why non-captured binding - because if loop contains block scoped binding captured in some function then loop body will be rewritten + // to have a fresh scope on every iteration so everything will just work. + // * Why loop initializer is excluded - since we've introduced a fresh name it already will be undefined. + var isCapturedInFunction = flags & 131072 /* CapturedBlockScopedBinding */; + var isDeclaredInLoop = flags & 262144 /* BlockScopedBindingInLoop */; + var emittedAsTopLevel = ts.isBlockScopedContainerTopLevel(container) || + (isCapturedInFunction && isDeclaredInLoop && container.kind === 199 /* Block */ && ts.isIterationStatement(container.parent, /*lookInLabeledStatements*/ false)); + var emittedAsNestedLetDeclaration = ts.getCombinedNodeFlags(node) & 1024 /* Let */ && + !emittedAsTopLevel; + var emitExplicitInitializer = emittedAsNestedLetDeclaration && + container.kind !== 207 /* ForInStatement */ && + container.kind !== 208 /* ForOfStatement */ && + (!resolver.isDeclarationWithCollidingName(node) || + (isDeclaredInLoop && !isCapturedInFunction && !ts.isIterationStatement(container, /*lookInLabeledStatements*/ false))); + if (emitExplicitInitializer) { initializer = createVoidZero(); } } @@ -33917,7 +37943,7 @@ var ts; } } function emitExportVariableAssignments(node) { - if (node.kind === 187 /* OmittedExpression */) { + if (node.kind === 193 /* OmittedExpression */) { return; } var name = node.name; @@ -33928,20 +37954,14 @@ var ts; ts.forEach(name.elements, emitExportVariableAssignments); } } - function getCombinedFlagsForIdentifier(node) { - if (!node.parent || (node.parent.kind !== 211 /* VariableDeclaration */ && node.parent.kind !== 163 /* BindingElement */)) { - return 0; - } - return ts.getCombinedNodeFlags(node.parent); - } function isES6ExportedDeclaration(node) { - return !!(node.flags & 2 /* Export */) && - modulekind === 5 /* ES6 */ && - node.parent.kind === 248 /* SourceFile */; + return !!(node.flags & 1 /* Export */) && + modulekind === ts.ModuleKind.ES6 && + node.parent.kind === 256 /* SourceFile */; } function emitVariableStatement(node) { var startIsEmitted = false; - if (node.flags & 2 /* Export */) { + if (node.flags & 1 /* Export */) { if (isES6ExportedDeclaration(node)) { // Exported ES6 module member write("export "); @@ -33961,14 +37981,14 @@ var ts; write(";"); } } - if (modulekind !== 5 /* ES6 */ && node.parent === currentSourceFile) { + if (modulekind !== ts.ModuleKind.ES6 && node.parent === currentSourceFile) { ts.forEach(node.declarationList.declarations, emitExportVariableAssignments); } } function shouldEmitLeadingAndTrailingCommentsForVariableStatement(node) { // If we're not exporting the variables, there's nothing special here. // Always emit comments for these nodes. - if (!(node.flags & 2 /* Export */)) { + if (!(node.flags & 1 /* Export */)) { return true; } // If we are exporting, but it's a top-level ES6 module exports, @@ -33988,12 +38008,12 @@ var ts; function emitParameter(node) { if (languageVersion < 2 /* ES6 */) { if (ts.isBindingPattern(node.name)) { - var name_25 = createTempVariable(0 /* Auto */); + var name_28 = createTempVariable(0 /* Auto */); if (!tempParameters) { tempParameters = []; } - tempParameters.push(name_25); - emit(name_25); + tempParameters.push(name_28); + emit(name_28); } else { emit(node.name); @@ -34009,7 +38029,7 @@ var ts; } function emitDefaultValueAssignments(node) { if (languageVersion < 2 /* ES6 */) { - var tempIndex = 0; + var tempIndex_1 = 0; ts.forEach(node.parameters, function (parameter) { // A rest parameter cannot have a binding pattern or an initializer, // so let's just ignore it. @@ -34026,15 +38046,15 @@ var ts; writeLine(); write("var "); if (hasBindingElements) { - emitDestructuring(parameter, /*isAssignmentExpressionStatement*/ false, tempParameters[tempIndex]); + emitDestructuring(parameter, /*isAssignmentExpressionStatement*/ false, tempParameters[tempIndex_1]); } else { - emit(tempParameters[tempIndex]); + emit(tempParameters[tempIndex_1]); write(" = "); emit(initializer); } write(";"); - tempIndex++; + tempIndex_1++; } } else if (initializer) { @@ -34056,7 +38076,7 @@ var ts; } } function emitRestParameter(node) { - if (languageVersion < 2 /* ES6 */ && ts.hasRestParameter(node)) { + if (languageVersion < 2 /* ES6 */ && ts.hasDeclaredRestParameter(node)) { var restIndex = node.parameters.length - 1; var restParam = node.parameters[restIndex]; // A rest parameter cannot have a binding pattern, so let's just ignore it if it does. @@ -34098,12 +38118,12 @@ var ts; } } function emitAccessor(node) { - write(node.kind === 145 /* GetAccessor */ ? "get " : "set "); + write(node.kind === 149 /* GetAccessor */ ? "get " : "set "); emit(node.name); emitSignatureAndBody(node); } function shouldEmitAsArrowFunction(node) { - return node.kind === 174 /* ArrowFunction */ && languageVersion >= 2 /* ES6 */; + return node.kind === 180 /* ArrowFunction */ && languageVersion >= 2 /* ES6 */; } function emitDeclarationName(node) { if (node.name) { @@ -34114,13 +38134,13 @@ var ts; } } function shouldEmitFunctionName(node) { - if (node.kind === 173 /* FunctionExpression */) { + if (node.kind === 179 /* FunctionExpression */) { // Emit name if one is present return !!node.name; } - if (node.kind === 213 /* FunctionDeclaration */) { + if (node.kind === 220 /* FunctionDeclaration */) { // Emit name if one is present, or emit generated name in down-level case (for export default case) - return !!node.name || languageVersion < 2 /* ES6 */; + return !!node.name || modulekind !== ts.ModuleKind.ES6; } } function emitFunctionDeclaration(node) { @@ -34129,20 +38149,29 @@ var ts; } // TODO (yuisu) : we should not have special cases to condition emitting comments // but have one place to fix check for these conditions. - if (node.kind !== 143 /* MethodDeclaration */ && node.kind !== 142 /* MethodSignature */ && - node.parent && node.parent.kind !== 245 /* PropertyAssignment */ && - node.parent.kind !== 168 /* CallExpression */) { - // 1. Methods will emit the comments as part of emitting method declaration + var kind = node.kind, parent = node.parent; + if (kind !== 147 /* MethodDeclaration */ && + kind !== 146 /* MethodSignature */ && + parent && + parent.kind !== 253 /* PropertyAssignment */ && + parent.kind !== 174 /* CallExpression */ && + parent.kind !== 170 /* ArrayLiteralExpression */) { + // 1. Methods will emit comments at their assignment declaration sites. + // // 2. If the function is a property of object literal, emitting leading-comments - // is done by emitNodeWithoutSourceMap which then call this function. - // In particular, we would like to avoid emit comments twice in following case: - // For example: + // is done by emitNodeWithoutSourceMap which then call this function. + // In particular, we would like to avoid emit comments twice in following case: + // // var obj = { // id: // /*comment*/ () => void // } + // // 3. If the function is an argument in call expression, emitting of comments will be - // taken care of in emit list of arguments inside of emitCallexpression + // taken care of in emit list of arguments inside of 'emitCallExpression'. + // + // 4. If the function is in an array literal, 'emitLinePreservingList' will take care + // of leading comments. emitLeadingComments(node); } emitStart(node); @@ -34165,11 +38194,13 @@ var ts; emitDeclarationName(node); } emitSignatureAndBody(node); - if (modulekind !== 5 /* ES6 */ && node.kind === 213 /* FunctionDeclaration */ && node.parent === currentSourceFile && node.name) { + if (modulekind !== ts.ModuleKind.ES6 && kind === 220 /* FunctionDeclaration */ && parent === currentSourceFile && node.name) { emitExportMemberAssignments(node.name); } emitEnd(node); - if (node.kind !== 143 /* MethodDeclaration */ && node.kind !== 142 /* MethodSignature */) { + if (kind !== 147 /* MethodDeclaration */ && + kind !== 146 /* MethodSignature */ && + kind !== 180 /* ArrowFunction */) { emitTrailingComments(node); } } @@ -34186,8 +38217,9 @@ var ts; write("("); if (node) { var parameters = node.parameters; - var omitCount = languageVersion < 2 /* ES6 */ && ts.hasRestParameter(node) ? 1 : 0; - emitList(parameters, 0, parameters.length - omitCount, /*multiLine*/ false, /*trailingComma*/ false); + var skipCount = node.parameters.length && node.parameters[0].name.text === "this" ? 1 : 0; + var omitCount = languageVersion < 2 /* ES6 */ && ts.hasDeclaredRestParameter(node) ? 1 : 0; + emitList(parameters, skipCount, parameters.length - omitCount - skipCount, /*multiLine*/ false, /*trailingComma*/ false); } write(")"); decreaseIndent(); @@ -34202,8 +38234,8 @@ var ts; } function emitAsyncFunctionBodyForES6(node) { var promiseConstructor = ts.getEntityNameFromTypeNode(node.type); - var isArrowFunction = node.kind === 174 /* ArrowFunction */; - var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 4096 /* CaptureArguments */) !== 0; + var isArrowFunction = node.kind === 180 /* ArrowFunction */; + var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 8192 /* CaptureArguments */) !== 0; // An async function is emit as an outer function that calls an inner // generator function. To preserve lexical bindings, we pass the current // `this` and `arguments` objects to `__awaiter`. The generator function @@ -34281,29 +38313,31 @@ var ts; write(" {"); increaseIndent(); writeLine(); + if (resolver.getNodeCheckFlags(node) & 4096 /* AsyncMethodWithSuperBinding */) { + writeLines("\nconst _super = (function (geti, seti) {\n const cache = Object.create(null);\n return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });\n})(name => super[name], (name, value) => super[name] = value);"); + writeLine(); + } + else if (resolver.getNodeCheckFlags(node) & 2048 /* AsyncMethodWithSuper */) { + write("const _super = name => super[name];"); + writeLine(); + } write("return"); } write(" __awaiter(this"); if (hasLexicalArguments) { - write(", arguments"); + write(", arguments, "); } else { - write(", void 0"); + write(", void 0, "); } - if (promiseConstructor) { - write(", "); - emitNodeWithoutSourceMap(promiseConstructor); + if (languageVersion >= 2 /* ES6 */ || !promiseConstructor) { + write("void 0"); } else { - write(", Promise"); + emitEntityNameAsExpression(promiseConstructor, /*useFallback*/ false); } // Emit the call to __awaiter. - if (hasLexicalArguments) { - write(", function* (_arguments)"); - } - else { - write(", function* ()"); - } + write(", function* ()"); // Emit the signature and body for the inner generator function. emitFunctionBody(node); write(")"); @@ -34322,7 +38356,7 @@ var ts; write(" { }"); } else { - if (node.body.kind === 192 /* Block */) { + if (node.body.kind === 199 /* Block */) { emitBlockFunctionBody(node, node.body); } else { @@ -34348,7 +38382,7 @@ var ts; emitSignatureParameters(node); } var isAsync = ts.isAsyncFunctionLike(node); - if (isAsync && languageVersion === 2 /* ES6 */) { + if (isAsync) { emitAsyncFunctionBodyForES6(node); } else { @@ -34381,14 +38415,13 @@ var ts; write(" "); // Unwrap all type assertions. var current = body; - while (current.kind === 171 /* TypeAssertionExpression */) { + while (current.kind === 177 /* TypeAssertionExpression */) { current = current.expression; } - emitParenthesizedIf(body, current.kind === 165 /* ObjectLiteralExpression */); + emitParenthesizedIf(body, current.kind === 171 /* ObjectLiteralExpression */); } function emitDownLevelExpressionFunctionBody(node, body) { write(" {"); - scopeEmitStart(node); increaseIndent(); var outPos = writer.getTextPos(); emitDetachedCommentsAndUpdateCommentsInfo(node.body); @@ -34411,8 +38444,10 @@ var ts; increaseIndent(); writeLine(); emitLeadingComments(node.body); + emitStart(body); write("return "); emit(body); + emitEnd(body); write(";"); emitTrailingComments(node.body); emitTempDeclarations(/*newLine*/ true); @@ -34422,11 +38457,9 @@ var ts; emitStart(node.body); write("}"); emitEnd(node.body); - scopeEmitEnd(); } function emitBlockFunctionBody(node, body) { write(" {"); - scopeEmitStart(node); var initialTextPos = writer.getTextPos(); increaseIndent(); emitDetachedCommentsAndUpdateCommentsInfo(body.statements); @@ -34455,25 +38488,28 @@ var ts; decreaseIndent(); } emitToken(16 /* CloseBraceToken */, body.statements.end); - scopeEmitEnd(); } - function findInitialSuperCall(ctor) { - if (ctor.body) { - var statement = ctor.body.statements[0]; - if (statement && statement.kind === 195 /* ExpressionStatement */) { - var expr = statement.expression; - if (expr && expr.kind === 168 /* CallExpression */) { - var func = expr.expression; - if (func && func.kind === 95 /* SuperKeyword */) { - return statement; - } - } - } + /** + * Return the statement at a given index if it is a super-call statement + * @param ctor a constructor declaration + * @param index an index to constructor's body to check + */ + function getSuperCallAtGivenIndex(ctor, index) { + if (!ctor.body) { + return undefined; + } + var statements = ctor.body.statements; + if (!statements || index >= statements.length) { + return undefined; + } + var statement = statements[index]; + if (statement.kind === 202 /* ExpressionStatement */) { + return ts.isSuperCallExpression(statement.expression) ? statement : undefined; } } function emitParameterPropertyAssignments(node) { ts.forEach(node.parameters, function (param) { - if (param.flags & 56 /* AccessibilityModifier */) { + if (param.flags & 92 /* ParameterPropertyModifier */) { writeLine(); emitStart(param); emitStart(param.name); @@ -34496,7 +38532,7 @@ var ts; emitNodeWithCommentsAndWithoutSourcemap(memberName); write("]"); } - else if (memberName.kind === 136 /* ComputedPropertyName */) { + else if (memberName.kind === 140 /* ComputedPropertyName */) { emitComputedPropertyName(memberName); } else { @@ -34508,7 +38544,7 @@ var ts; var properties = []; for (var _a = 0, _b = node.members; _a < _b.length; _a++) { var member = _b[_a]; - if (member.kind === 141 /* PropertyDeclaration */ && isStatic === ((member.flags & 64 /* Static */) !== 0) && member.initializer) { + if (member.kind === 145 /* PropertyDeclaration */ && isStatic === ((member.flags & 32 /* Static */) !== 0) && member.initializer) { properties.push(member); } } @@ -34529,7 +38565,7 @@ var ts; emit(receiver); } else { - if (property.flags & 64 /* Static */) { + if (property.flags & 32 /* Static */) { emitDeclarationName(node); } else { @@ -34548,11 +38584,11 @@ var ts; } function emitMemberFunctionsForES5AndLower(node) { ts.forEach(node.members, function (member) { - if (member.kind === 191 /* SemicolonClassElement */) { + if (member.kind === 198 /* SemicolonClassElement */) { writeLine(); write(";"); } - else if (member.kind === 143 /* MethodDeclaration */ || node.kind === 142 /* MethodSignature */) { + else if (member.kind === 147 /* MethodDeclaration */ || node.kind === 146 /* MethodSignature */) { if (!member.body) { return emitCommentsOnNotEmittedNode(member); } @@ -34569,7 +38605,7 @@ var ts; write(";"); emitTrailingComments(member); } - else if (member.kind === 145 /* GetAccessor */ || member.kind === 146 /* SetAccessor */) { + else if (member.kind === 149 /* GetAccessor */ || member.kind === 150 /* SetAccessor */) { var accessors = ts.getAllAccessorDeclarations(node.members, member); if (member === accessors.firstAccessor) { writeLine(); @@ -34619,22 +38655,22 @@ var ts; function emitMemberFunctionsForES6AndHigher(node) { for (var _a = 0, _b = node.members; _a < _b.length; _a++) { var member = _b[_a]; - if ((member.kind === 143 /* MethodDeclaration */ || node.kind === 142 /* MethodSignature */) && !member.body) { + if ((member.kind === 147 /* MethodDeclaration */ || node.kind === 146 /* MethodSignature */) && !member.body) { emitCommentsOnNotEmittedNode(member); } - else if (member.kind === 143 /* MethodDeclaration */ || - member.kind === 145 /* GetAccessor */ || - member.kind === 146 /* SetAccessor */) { + else if (member.kind === 147 /* MethodDeclaration */ || + member.kind === 149 /* GetAccessor */ || + member.kind === 150 /* SetAccessor */) { writeLine(); emitLeadingComments(member); emitStart(member); - if (member.flags & 64 /* Static */) { + if (member.flags & 32 /* Static */) { write("static "); } - if (member.kind === 145 /* GetAccessor */) { + if (member.kind === 149 /* GetAccessor */) { write("get "); } - else if (member.kind === 146 /* SetAccessor */) { + else if (member.kind === 150 /* SetAccessor */) { write("set "); } if (member.asteriskToken) { @@ -34645,7 +38681,7 @@ var ts; emitEnd(member); emitTrailingComments(member); } - else if (member.kind === 191 /* SemicolonClassElement */) { + else if (member.kind === 198 /* SemicolonClassElement */) { writeLine(); write(";"); } @@ -34674,11 +38710,11 @@ var ts; var hasInstancePropertyWithInitializer = false; // Emit the constructor overload pinned comments ts.forEach(node.members, function (member) { - if (member.kind === 144 /* Constructor */ && !member.body) { + if (member.kind === 148 /* Constructor */ && !member.body) { emitCommentsOnNotEmittedNode(member); } // Check if there is any non-static property assignment - if (member.kind === 141 /* PropertyDeclaration */ && member.initializer && (member.flags & 64 /* Static */) === 0) { + if (member.kind === 145 /* PropertyDeclaration */ && member.initializer && (member.flags & 32 /* Static */) === 0) { hasInstancePropertyWithInitializer = true; } }); @@ -34719,7 +38755,6 @@ var ts; } var startIndex = 0; write(" {"); - scopeEmitStart(node, "constructor"); increaseIndent(); if (ctor) { // Emit all the directive prologues (like "use strict"). These have to come before @@ -34733,7 +38768,7 @@ var ts; emitDefaultValueAssignments(ctor); emitRestParameter(ctor); if (baseTypeElement) { - superCall = findInitialSuperCall(ctor); + superCall = getSuperCallAtGivenIndex(ctor, startIndex); if (superCall) { writeLine(); emit(superCall); @@ -34754,7 +38789,7 @@ var ts; emitEnd(baseTypeElement); } } - emitPropertyDeclarations(node, getInitializedProperties(node, /*static:*/ false)); + emitPropertyDeclarations(node, getInitializedProperties(node, /*isStatic*/ false)); if (ctor) { var statements = ctor.body.statements; if (superCall) { @@ -34769,7 +38804,6 @@ var ts; } decreaseIndent(); emitToken(16 /* CloseBraceToken */, ctor ? ctor.body.statements.end : node.members.end); - scopeEmitEnd(); emitEnd(ctor || node); if (ctor) { emitTrailingComments(ctor); @@ -34788,68 +38822,115 @@ var ts; else { emitClassLikeDeclarationForES6AndHigher(node); } - if (modulekind !== 5 /* ES6 */ && node.parent === currentSourceFile && node.name) { + if (modulekind !== ts.ModuleKind.ES6 && node.parent === currentSourceFile && node.name) { emitExportMemberAssignments(node.name); } } function emitClassLikeDeclarationForES6AndHigher(node) { - var thisNodeIsDecorated = ts.nodeIsDecorated(node); - if (node.kind === 214 /* ClassDeclaration */) { - if (thisNodeIsDecorated) { - // To preserve the correct runtime semantics when decorators are applied to the class, - // the emit needs to follow one of the following rules: + var decoratedClassAlias; + var isHoistedDeclarationInSystemModule = shouldHoistDeclarationInSystemJsModule(node); + var isDecorated = ts.nodeIsDecorated(node); + var rewriteAsClassExpression = isDecorated || isHoistedDeclarationInSystemModule; + if (node.kind === 221 /* ClassDeclaration */) { + if (rewriteAsClassExpression) { + // When we emit an ES6 class that has a class decorator, we must tailor the + // emit to certain specific cases. // - // * For a local class declaration: + // In the simplest case, we emit the class declaration as a let declaration, and + // evaluate decorators after the close of the class body: // - // @dec class C { - // } + // TypeScript | Javascript + // --------------------------------|------------------------------------ + // @dec | let C = class C { + // class C { | } + // } | C = __decorate([dec], C); + // --------------------------------|------------------------------------ + // @dec | export let C = class C { + // export class C { | } + // } | C = __decorate([dec], C); + // --------------------------------------------------------------------- + // [Example 1] // - // The emit should be: + // If a class declaration contains a reference to itself *inside* of the class body, + // this introduces two bindings to the class: One outside of the class body, and one + // inside of the class body. If we apply decorators as in [Example 1] above, there + // is the possibility that the decorator `dec` will return a new value for the + // constructor, which would result in the binding inside of the class no longer + // pointing to the same reference as the binding outside of the class. // - // let C = class { - // }; - // C = __decorate([dec], C); + // As a result, we must instead rewrite all references to the class *inside* of the + // class body to instead point to a local temporary alias for the class: // - // * For an exported class declaration: + // TypeScript | Javascript + // --------------------------------|------------------------------------ + // @dec | let C_1; + // class C { | let C = C_1 = class C { + // static x() { return C.y; } | static x() { return C_1.y; } + // static y = 1; | } + // } | C.y = 1; + // | C = C_1 = __decorate([dec], C); + // --------------------------------|------------------------------------ + // @dec | let C_1; + // export class C { | export let C = C_1 = class C { + // static x() { return C.y; } | static x() { return C_1.y; } + // static y = 1; | } + // } | C.y = 1; + // | C = C_1 = __decorate([dec], C); + // --------------------------------------------------------------------- + // [Example 2] // - // @dec export class C { - // } + // If a class declaration is the default export of a module, we instead emit + // the export after the decorated declaration: // - // The emit should be: + // TypeScript | Javascript + // --------------------------------|------------------------------------ + // @dec | let default_1 = class { + // export default class { | } + // } | default_1 = __decorate([dec], default_1); + // | export default default_1; + // --------------------------------|------------------------------------ + // @dec | let C = class C { + // export default class { | } + // } | C = __decorate([dec], C); + // | export default C; + // --------------------------------------------------------------------- + // [Example 3] // - // export let C = class { - // }; - // C = __decorate([dec], C); + // If the class declaration is the default export and a reference to itself + // inside of the class body, we must emit both an alias for the class *and* + // move the export after the declaration: // - // * For a default export of a class declaration with a name: - // - // @dec default export class C { - // } - // - // The emit should be: - // - // let C = class { - // } - // C = __decorate([dec], C); - // export default C; - // - // * For a default export of a class declaration without a name: - // - // @dec default export class { - // } - // - // The emit should be: - // - // let _default = class { - // } - // _default = __decorate([dec], _default); - // export default _default; + // TypeScript | Javascript + // --------------------------------|------------------------------------ + // @dec | let C_1; + // export default class C { | let C = C_1 = class C { + // static x() { return C.y; } | static x() { return C_1.y; } + // static y = 1; | } + // } | C.y = 1; + // | C = C_1 = __decorate([dec], C); + // | export default C; + // --------------------------------------------------------------------- + // [Example 4] // + // NOTE: we reuse the same rewriting logic for cases when targeting ES6 and module kind is System. + // Because of hoisting top level class declaration need to be emitted as class expressions. + // Double bind case is only required if node is decorated. + if (isDecorated && resolver.getNodeCheckFlags(node) & 524288 /* ClassWithBodyScopedClassBinding */) { + decoratedClassAlias = ts.unescapeIdentifier(makeUniqueName(node.name ? node.name.text : "default")); + decoratedClassAliases[ts.getNodeId(node)] = decoratedClassAlias; + write("let " + decoratedClassAlias + ";"); + writeLine(); + } if (isES6ExportedDeclaration(node) && !(node.flags & 512 /* Default */)) { write("export "); } - write("let "); + if (!isHoistedDeclarationInSystemModule) { + write("let "); + } emitDeclarationName(node); + if (decoratedClassAlias !== undefined) { + write(" = " + decoratedClassAlias); + } write(" = "); } else if (isES6ExportedDeclaration(node)) { @@ -34870,8 +38951,8 @@ var ts; // // This keeps the expression as an expression, while ensuring that the static parts // of it have been initialized by the time it is used. - var staticProperties = getInitializedProperties(node, /*static:*/ true); - var isClassExpressionWithStaticProperties = staticProperties.length > 0 && node.kind === 186 /* ClassExpression */; + var staticProperties = getInitializedProperties(node, /*isStatic*/ true); + var isClassExpressionWithStaticProperties = staticProperties.length > 0 && node.kind === 192 /* ClassExpression */; var tempVariable; if (isClassExpressionWithStaticProperties) { tempVariable = createAndRecordTempVariable(0 /* Auto */); @@ -34884,7 +38965,7 @@ var ts; // emit name if // - node has a name // - this is default export with static initializers - if ((node.name || (node.flags & 512 /* Default */ && staticProperties.length > 0)) && !thisNodeIsDecorated) { + if (node.name || (node.flags & 512 /* Default */ && (staticProperties.length > 0 || modulekind !== ts.ModuleKind.ES6) && !rewriteAsClassExpression)) { write(" "); emitDeclarationName(node); } @@ -34895,23 +38976,14 @@ var ts; } write(" {"); increaseIndent(); - scopeEmitStart(node); writeLine(); emitConstructor(node, baseTypeNode); emitMemberFunctionsForES6AndHigher(node); decreaseIndent(); writeLine(); emitToken(16 /* CloseBraceToken */, node.members.end); - scopeEmitEnd(); - // TODO(rbuckton): Need to go back to `let _a = class C {}` approach, removing the defineProperty call for now. - // For a decorated class, we need to assign its name (if it has one). This is because we emit - // the class as a class expression to avoid the double-binding of the identifier: - // - // let C = class { - // } - // Object.defineProperty(C, "name", { value: "C", configurable: true }); - // - if (thisNodeIsDecorated) { + if (rewriteAsClassExpression) { + decoratedClassAliases[ts.getNodeId(node)] = undefined; write(";"); } // Emit static property assignment. Because classDeclaration is lexically evaluated, @@ -34924,7 +38996,7 @@ var ts; var property = staticProperties_1[_a]; write(","); writeLine(); - emitPropertyDeclaration(node, property, /*receiver:*/ tempVariable, /*isExpression:*/ true); + emitPropertyDeclaration(node, property, /*receiver*/ tempVariable, /*isExpression*/ true); } write(","); writeLine(); @@ -34935,29 +39007,39 @@ var ts; else { writeLine(); emitPropertyDeclarations(node, staticProperties); - emitDecoratorsOfClass(node); + emitDecoratorsOfClass(node, decoratedClassAlias); } - // If this is an exported class, but not on the top level (i.e. on an internal - // module), export it - if (!isES6ExportedDeclaration(node) && (node.flags & 2 /* Export */)) { - writeLine(); - emitStart(node); - emitModuleMemberName(node); - write(" = "); - emitDeclarationName(node); - emitEnd(node); - write(";"); + if (!(node.flags & 1 /* Export */)) { + return; } - else if (isES6ExportedDeclaration(node) && (node.flags & 512 /* Default */) && thisNodeIsDecorated) { - // if this is a top level default export of decorated class, write the export after the declaration. - writeLine(); - write("export default "); - emitDeclarationName(node); - write(";"); + if (modulekind !== ts.ModuleKind.ES6) { + emitExportMemberAssignment(node); + } + else { + // If this is an exported class, but not on the top level (i.e. on an internal + // module), export it + if (node.flags & 512 /* Default */) { + // if this is a top level default export of decorated class, write the export after the declaration. + if (isDecorated) { + writeLine(); + write("export default "); + emitDeclarationName(node); + write(";"); + } + } + else if (node.parent.kind !== 256 /* SourceFile */) { + writeLine(); + emitStart(node); + emitModuleMemberName(node); + write(" = "); + emitDeclarationName(node); + emitEnd(node); + write(";"); + } } } function emitClassLikeDeclarationBelowES6(node) { - if (node.kind === 214 /* ClassDeclaration */) { + if (node.kind === 221 /* ClassDeclaration */) { // source file level classes in system modules are hoisted so 'var's for them are already defined if (!shouldHoistDeclarationInSystemJsModule(node)) { write("var "); @@ -34982,7 +39064,6 @@ var ts; tempParameters = undefined; computedPropertyNamesToGeneratedNames = undefined; increaseIndent(); - scopeEmitStart(node); if (baseTypeNode) { writeLine(); emitStart(baseTypeNode); @@ -34994,9 +39075,9 @@ var ts; writeLine(); emitConstructor(node, baseTypeNode); emitMemberFunctionsForES5AndLower(node); - emitPropertyDeclarations(node, getInitializedProperties(node, /*static:*/ true)); + emitPropertyDeclarations(node, getInitializedProperties(node, /*isStatic*/ true)); writeLine(); - emitDecoratorsOfClass(node); + emitDecoratorsOfClass(node, /*decoratedClassAlias*/ undefined); writeLine(); emitToken(16 /* CloseBraceToken */, node.members.end, function () { write("return "); @@ -35013,38 +39094,37 @@ var ts; decreaseIndent(); writeLine(); emitToken(16 /* CloseBraceToken */, node.members.end); - scopeEmitEnd(); emitStart(node); - write(")("); + write("("); if (baseTypeNode) { emit(baseTypeNode.expression); } - write(")"); - if (node.kind === 214 /* ClassDeclaration */) { + write("))"); + if (node.kind === 221 /* ClassDeclaration */) { write(";"); } emitEnd(node); - if (node.kind === 214 /* ClassDeclaration */) { + if (node.kind === 221 /* ClassDeclaration */) { emitExportMemberAssignment(node); } } function emitClassMemberPrefix(node, member) { emitDeclarationName(node); - if (!(member.flags & 64 /* Static */)) { + if (!(member.flags & 32 /* Static */)) { write(".prototype"); } } - function emitDecoratorsOfClass(node) { + function emitDecoratorsOfClass(node, decoratedClassAlias) { emitDecoratorsOfMembers(node, /*staticFlag*/ 0); - emitDecoratorsOfMembers(node, 64 /* Static */); - emitDecoratorsOfConstructor(node); + emitDecoratorsOfMembers(node, 32 /* Static */); + emitDecoratorsOfConstructor(node, decoratedClassAlias); } - function emitDecoratorsOfConstructor(node) { + function emitDecoratorsOfConstructor(node, decoratedClassAlias) { var decorators = node.decorators; var constructor = ts.getFirstConstructorWithBody(node); - var hasDecoratedParameters = constructor && ts.forEach(constructor.parameters, ts.nodeIsDecorated); + var firstParameterDecorator = constructor && ts.forEach(constructor.parameters, function (parameter) { return parameter.decorators; }); // skip decoration of the constructor if neither it nor its parameters are decorated - if (!decorators && !hasDecoratedParameters) { + if (!decorators && !firstParameterDecorator) { return; } // Emit the call to __decorate. Given the class: @@ -35058,42 +39138,40 @@ var ts; // C = __decorate([dec], C); // writeLine(); - emitStart(node); + emitStart(node.decorators || firstParameterDecorator); emitDeclarationName(node); + if (decoratedClassAlias !== undefined) { + write(" = " + decoratedClassAlias); + } write(" = __decorate(["); increaseIndent(); writeLine(); var decoratorCount = decorators ? decorators.length : 0; - var argumentsWritten = emitList(decorators, 0, decoratorCount, /*multiLine*/ true, /*trailingComma*/ false, /*leadingComma*/ false, /*noTrailingNewLine*/ true, function (decorator) { - emitStart(decorator); - emit(decorator.expression); - emitEnd(decorator); - }); - argumentsWritten += emitDecoratorsOfParameters(constructor, /*leadingComma*/ argumentsWritten > 0); + var argumentsWritten = emitList(decorators, 0, decoratorCount, /*multiLine*/ true, /*trailingComma*/ false, /*leadingComma*/ false, /*noTrailingNewLine*/ true, function (decorator) { return emit(decorator.expression); }); + if (firstParameterDecorator) { + argumentsWritten += emitDecoratorsOfParameters(constructor, /*leadingComma*/ argumentsWritten > 0); + } emitSerializedTypeMetadata(node, /*leadingComma*/ argumentsWritten >= 0); decreaseIndent(); writeLine(); write("], "); emitDeclarationName(node); - write(");"); - emitEnd(node); + write(")"); + emitEnd(node.decorators || firstParameterDecorator); + write(";"); writeLine(); } function emitDecoratorsOfMembers(node, staticFlag) { for (var _a = 0, _b = node.members; _a < _b.length; _a++) { var member = _b[_a]; // only emit members in the correct group - if ((member.flags & 64 /* Static */) !== staticFlag) { + if ((member.flags & 32 /* Static */) !== staticFlag) { continue; } // skip members that cannot be decorated (such as the constructor) if (!ts.nodeCanBeDecorated(member)) { continue; } - // skip a member if it or any of its parameters are not decorated - if (!ts.nodeOrChildIsDecorated(member)) { - continue; - } // skip an accessor declaration if it is not the first accessor var decorators = void 0; var functionLikeMember = void 0; @@ -35113,10 +39191,15 @@ var ts; else { decorators = member.decorators; // we only decorate the parameters here if this is a method - if (member.kind === 143 /* MethodDeclaration */) { + if (member.kind === 147 /* MethodDeclaration */) { functionLikeMember = member; } } + var firstParameterDecorator = functionLikeMember && ts.forEach(functionLikeMember.parameters, function (parameter) { return parameter.decorators; }); + // skip a member if it or any of its parameters are not decorated + if (!decorators && !firstParameterDecorator) { + continue; + } // Emit the call to __decorate. Given the following: // // class C { @@ -35148,28 +39231,24 @@ var ts; // ], C.prototype, "prop"); // writeLine(); - emitStart(member); + emitStart(decorators || firstParameterDecorator); write("__decorate(["); increaseIndent(); writeLine(); var decoratorCount = decorators ? decorators.length : 0; - var argumentsWritten = emitList(decorators, 0, decoratorCount, /*multiLine*/ true, /*trailingComma*/ false, /*leadingComma*/ false, /*noTrailingNewLine*/ true, function (decorator) { - emitStart(decorator); - emit(decorator.expression); - emitEnd(decorator); - }); - argumentsWritten += emitDecoratorsOfParameters(functionLikeMember, argumentsWritten > 0); + var argumentsWritten = emitList(decorators, 0, decoratorCount, /*multiLine*/ true, /*trailingComma*/ false, /*leadingComma*/ false, /*noTrailingNewLine*/ true, function (decorator) { return emit(decorator.expression); }); + if (firstParameterDecorator) { + argumentsWritten += emitDecoratorsOfParameters(functionLikeMember, argumentsWritten > 0); + } emitSerializedTypeMetadata(member, argumentsWritten > 0); decreaseIndent(); writeLine(); write("], "); - emitStart(member.name); emitClassMemberPrefix(node, member); write(", "); emitExpressionForPropertyName(member.name); - emitEnd(member.name); if (languageVersion > 0 /* ES3 */) { - if (member.kind !== 141 /* PropertyDeclaration */) { + if (member.kind !== 145 /* PropertyDeclaration */) { // We emit `null` here to indicate to `__decorate` that it can invoke `Object.getOwnPropertyDescriptor` directly. // We have this extra argument here so that we can inject an explicit property descriptor at a later date. write(", null"); @@ -35180,29 +39259,28 @@ var ts; write(", void 0"); } } - write(");"); - emitEnd(member); + write(")"); + emitEnd(decorators || firstParameterDecorator); + write(";"); writeLine(); } } function emitDecoratorsOfParameters(node, leadingComma) { var argumentsWritten = 0; if (node) { - var parameterIndex = 0; + var parameterIndex_1 = 0; for (var _a = 0, _b = node.parameters; _a < _b.length; _a++) { var parameter = _b[_a]; if (ts.nodeIsDecorated(parameter)) { var decorators = parameter.decorators; argumentsWritten += emitList(decorators, 0, decorators.length, /*multiLine*/ true, /*trailingComma*/ false, /*leadingComma*/ leadingComma, /*noTrailingNewLine*/ true, function (decorator) { - emitStart(decorator); - write("__param(" + parameterIndex + ", "); + write("__param(" + parameterIndex_1 + ", "); emit(decorator.expression); write(")"); - emitEnd(decorator); }); leadingComma = true; } - ++parameterIndex; + parameterIndex_1++; } } return argumentsWritten; @@ -35212,10 +39290,10 @@ var ts; // The caller should have already tested whether the node has decorators and whether the emitDecoratorMetadata // compiler option is set. switch (node.kind) { - case 143 /* MethodDeclaration */: - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: - case 141 /* PropertyDeclaration */: + case 147 /* MethodDeclaration */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: + case 145 /* PropertyDeclaration */: return true; } return false; @@ -35225,7 +39303,7 @@ var ts; // The caller should have already tested whether the node has decorators and whether the emitDecoratorMetadata // compiler option is set. switch (node.kind) { - case 143 /* MethodDeclaration */: + case 147 /* MethodDeclaration */: return true; } return false; @@ -35235,9 +39313,9 @@ var ts; // The caller should have already tested whether the node has decorators and whether the emitDecoratorMetadata // compiler option is set. switch (node.kind) { - case 214 /* ClassDeclaration */: - case 143 /* MethodDeclaration */: - case 146 /* SetAccessor */: + case 221 /* ClassDeclaration */: + case 147 /* MethodDeclaration */: + case 150 /* SetAccessor */: return true; } return false; @@ -35255,19 +39333,19 @@ var ts; // // For rules on serializing type annotations, see `serializeTypeNode`. switch (node.kind) { - case 214 /* ClassDeclaration */: + case 221 /* ClassDeclaration */: write("Function"); return; - case 141 /* PropertyDeclaration */: + case 145 /* PropertyDeclaration */: emitSerializedTypeNode(node.type); return; - case 138 /* Parameter */: + case 142 /* Parameter */: emitSerializedTypeNode(node.type); return; - case 145 /* GetAccessor */: + case 149 /* GetAccessor */: emitSerializedTypeNode(node.type); return; - case 146 /* SetAccessor */: + case 150 /* SetAccessor */: emitSerializedTypeNode(ts.getSetAccessorTypeAnnotationNode(node)); return; } @@ -35283,39 +39361,40 @@ var ts; case 103 /* VoidKeyword */: write("void 0"); return; - case 160 /* ParenthesizedType */: + case 164 /* ParenthesizedType */: emitSerializedTypeNode(node.type); return; - case 152 /* FunctionType */: - case 153 /* ConstructorType */: + case 156 /* FunctionType */: + case 157 /* ConstructorType */: write("Function"); return; - case 156 /* ArrayType */: - case 157 /* TupleType */: + case 160 /* ArrayType */: + case 161 /* TupleType */: write("Array"); return; - case 150 /* TypePredicate */: + case 154 /* TypePredicate */: case 120 /* BooleanKeyword */: write("Boolean"); return; - case 130 /* StringKeyword */: - case 9 /* StringLiteral */: + case 132 /* StringKeyword */: + case 166 /* StringLiteralType */: write("String"); return; - case 128 /* NumberKeyword */: + case 130 /* NumberKeyword */: write("Number"); return; - case 131 /* SymbolKeyword */: + case 133 /* SymbolKeyword */: write("Symbol"); return; - case 151 /* TypeReference */: + case 155 /* TypeReference */: emitSerializedTypeReferenceNode(node); return; - case 154 /* TypeQuery */: - case 155 /* TypeLiteral */: - case 158 /* UnionType */: - case 159 /* IntersectionType */: + case 158 /* TypeQuery */: + case 159 /* TypeLiteral */: + case 162 /* UnionType */: + case 163 /* IntersectionType */: case 117 /* AnyKeyword */: + case 165 /* ThisType */: break; default: ts.Debug.fail("Cannot serialize unexpected type node."); @@ -35331,8 +39410,7 @@ var ts; location = location.parent; } // Clone the type name and parent it to a location outside of the current declaration. - var typeName = ts.cloneEntityName(node.typeName); - typeName.parent = location; + var typeName = ts.cloneEntityName(node.typeName, location); var result = resolver.getTypeReferenceSerializationKind(typeName); switch (result) { case ts.TypeReferenceSerializationKind.Unknown: @@ -35388,8 +39466,8 @@ var ts; // // For the rules on serializing the type of each parameter declaration, see `serializeTypeOfDeclaration`. if (node) { - var valueDeclaration; - if (node.kind === 214 /* ClassDeclaration */) { + var valueDeclaration = void 0; + if (node.kind === 221 /* ClassDeclaration */) { valueDeclaration = ts.getFirstConstructorWithBody(node); } else if (ts.isFunctionLike(node) && ts.nodeIsPresent(node.body)) { @@ -35405,10 +39483,10 @@ var ts; } if (parameters[i].dotDotDotToken) { var parameterType = parameters[i].type; - if (parameterType.kind === 156 /* ArrayType */) { + if (parameterType.kind === 160 /* ArrayType */) { parameterType = parameterType.elementType; } - else if (parameterType.kind === 151 /* TypeReference */ && parameterType.typeArguments && parameterType.typeArguments.length === 1) { + else if (parameterType.kind === 155 /* TypeReference */ && parameterType.typeArguments && parameterType.typeArguments.length === 1) { parameterType = parameterType.typeArguments[0]; } else { @@ -35484,9 +39562,10 @@ var ts; } if (!shouldHoistDeclarationInSystemJsModule(node)) { // do not emit var if variable was already hoisted - if (!(node.flags & 2 /* Export */) || isES6ExportedDeclaration(node)) { + var isES6ExportedEnum = isES6ExportedDeclaration(node); + if (!(node.flags & 1 /* Export */) || (isES6ExportedEnum && isFirstDeclarationOfKind(node, node.symbol && node.symbol.declarations, 224 /* EnumDeclaration */))) { emitStart(node); - if (isES6ExportedDeclaration(node)) { + if (isES6ExportedEnum) { write("export "); } write("var "); @@ -35503,19 +39582,17 @@ var ts; emitEnd(node.name); write(") {"); increaseIndent(); - scopeEmitStart(node); emitLines(node.members); decreaseIndent(); writeLine(); emitToken(16 /* CloseBraceToken */, node.members.end); - scopeEmitEnd(); write(")("); emitModuleMemberName(node); write(" || ("); emitModuleMemberName(node); write(" = {}));"); emitEnd(node); - if (!isES6ExportedDeclaration(node) && node.flags & 2 /* Export */ && !shouldHoistDeclarationInSystemJsModule(node)) { + if (!isES6ExportedDeclaration(node) && node.flags & 1 /* Export */ && !shouldHoistDeclarationInSystemJsModule(node)) { // do not emit var if variable was already hoisted writeLine(); emitStart(node); @@ -35526,8 +39603,8 @@ var ts; emitEnd(node); write(";"); } - if (modulekind !== 5 /* ES6 */ && node.parent === currentSourceFile) { - if (modulekind === 4 /* System */ && (node.flags & 2 /* Export */)) { + if (modulekind !== ts.ModuleKind.ES6 && node.parent === currentSourceFile) { + if (modulekind === ts.ModuleKind.System && (node.flags & 1 /* Export */)) { // write the call to exporter for enum writeLine(); write(exportFunctionForFile + "(\""); @@ -35568,7 +39645,7 @@ var ts; } } function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { - if (moduleDeclaration.body.kind === 218 /* ModuleDeclaration */) { + if (moduleDeclaration.body.kind === 225 /* ModuleDeclaration */) { var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); return recursiveInnerModule || moduleDeclaration.body; } @@ -35579,6 +39656,9 @@ var ts; function isModuleMergedWithES6Class(node) { return languageVersion === 2 /* ES6 */ && !!(resolver.getNodeCheckFlags(node) & 32768 /* LexicalModuleMergesWithClass */); } + function isFirstDeclarationOfKind(node, declarations, kind) { + return !ts.forEach(declarations, function (declaration) { return declaration.kind === kind && declaration.pos < node.pos; }); + } function emitModuleDeclaration(node) { // Emit only if this module is non-ambient. var shouldEmit = shouldEmitModuleDeclaration(node); @@ -35588,15 +39668,18 @@ var ts; var hoistedInDeclarationScope = shouldHoistDeclarationInSystemJsModule(node); var emitVarForModule = !hoistedInDeclarationScope && !isModuleMergedWithES6Class(node); if (emitVarForModule) { - emitStart(node); - if (isES6ExportedDeclaration(node)) { - write("export "); + var isES6ExportedNamespace = isES6ExportedDeclaration(node); + if (!isES6ExportedNamespace || isFirstDeclarationOfKind(node, node.symbol && node.symbol.declarations, 225 /* ModuleDeclaration */)) { + emitStart(node); + if (isES6ExportedNamespace) { + write("export "); + } + write("var "); + emit(node.name); + write(";"); + emitEnd(node); + writeLine(); } - write("var "); - emit(node.name); - write(";"); - emitEnd(node); - writeLine(); } emitStart(node); write("(function ("); @@ -35604,7 +39687,7 @@ var ts; write(getGeneratedNameForNode(node)); emitEnd(node.name); write(") "); - if (node.body.kind === 219 /* ModuleBlock */) { + if (node.body.kind === 226 /* ModuleBlock */) { var saveConvertedLoopState = convertedLoopState; var saveTempFlags = tempFlags; var saveTempVariables = tempVariables; @@ -35620,7 +39703,6 @@ var ts; else { write("{"); increaseIndent(); - scopeEmitStart(node); emitCaptureThisForNodeIfNecessary(node); writeLine(); emit(node.body); @@ -35628,11 +39710,10 @@ var ts; writeLine(); var moduleBlock = getInnerMostModuleDeclarationFromDottedModule(node).body; emitToken(16 /* CloseBraceToken */, moduleBlock.statements.end); - scopeEmitEnd(); } write(")("); // write moduleDecl = containingModule.m only if it is not exported es6 module member - if ((node.flags & 2 /* Export */) && !isES6ExportedDeclaration(node)) { + if ((node.flags & 1 /* Export */) && !isES6ExportedDeclaration(node)) { emit(node.name); write(" = "); } @@ -35642,7 +39723,7 @@ var ts; write(" = {}));"); emitEnd(node); if (!isES6ExportedDeclaration(node) && node.name.kind === 69 /* Identifier */ && node.parent === currentSourceFile) { - if (modulekind === 4 /* System */ && (node.flags & 2 /* Export */)) { + if (modulekind === ts.ModuleKind.System && (node.flags & 1 /* Export */)) { writeLine(); write(exportFunctionForFile + "(\""); emitDeclarationName(node); @@ -35682,16 +39763,16 @@ var ts; } } function getNamespaceDeclarationNode(node) { - if (node.kind === 221 /* ImportEqualsDeclaration */) { + if (node.kind === 229 /* ImportEqualsDeclaration */) { return node; } var importClause = node.importClause; - if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 224 /* NamespaceImport */) { + if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 232 /* NamespaceImport */) { return importClause.namedBindings; } } function isDefaultImport(node) { - return node.kind === 222 /* ImportDeclaration */ && node.importClause && !!node.importClause.name; + return node.kind === 230 /* ImportDeclaration */ && node.importClause && !!node.importClause.name; } function emitExportImportAssignments(node) { if (ts.isAliasSymbolDeclaration(node) && resolver.isValueAliasDeclaration(node)) { @@ -35700,7 +39781,7 @@ var ts; ts.forEachChild(node, emitExportImportAssignments); } function emitImportDeclaration(node) { - if (modulekind !== 5 /* ES6 */) { + if (modulekind !== ts.ModuleKind.ES6) { return emitExternalImportDeclaration(node); } // ES6 import @@ -35719,7 +39800,7 @@ var ts; if (shouldEmitNamedBindings) { emitLeadingComments(node.importClause.namedBindings); emitStart(node.importClause.namedBindings); - if (node.importClause.namedBindings.kind === 224 /* NamespaceImport */) { + if (node.importClause.namedBindings.kind === 232 /* NamespaceImport */) { write("* as "); emit(node.importClause.namedBindings.name); } @@ -35745,16 +39826,19 @@ var ts; } function emitExternalImportDeclaration(node) { if (ts.contains(externalImports, node)) { - var isExportedImport = node.kind === 221 /* ImportEqualsDeclaration */ && (node.flags & 2 /* Export */) !== 0; + var isExportedImport = node.kind === 229 /* ImportEqualsDeclaration */ && (node.flags & 1 /* Export */) !== 0; var namespaceDeclaration = getNamespaceDeclarationNode(node); - if (modulekind !== 2 /* AMD */) { + var varOrConst = (languageVersion <= 1 /* ES5 */) ? "var " : "const "; + if (modulekind !== ts.ModuleKind.AMD) { emitLeadingComments(node); emitStart(node); if (namespaceDeclaration && !isDefaultImport(node)) { // import x = require("foo") // import * as x from "foo" - if (!isExportedImport) - write("var "); + if (!isExportedImport) { + write(varOrConst); + } + ; emitModuleMemberName(namespaceDeclaration); write(" = "); } @@ -35764,9 +39848,9 @@ var ts; // import { x, y } from "foo" // import d, * as x from "foo" // import d, { x, y } from "foo" - var isNakedImport = 222 /* ImportDeclaration */ && !node.importClause; + var isNakedImport = 230 /* ImportDeclaration */ && !node.importClause; if (!isNakedImport) { - write("var "); + write(varOrConst); write(getGeneratedNameForNode(node)); write(" = "); } @@ -35793,7 +39877,7 @@ var ts; } else if (namespaceDeclaration && isDefaultImport(node)) { // import d, * as x from "foo" - write("var "); + write(varOrConst); emitModuleMemberName(namespaceDeclaration); write(" = "); write(getGeneratedNameForNode(node)); @@ -35827,7 +39911,7 @@ var ts; write("export "); write("var "); } - else if (!(node.flags & 2 /* Export */)) { + else if (!(node.flags & 1 /* Export */)) { write("var "); } } @@ -35849,14 +39933,14 @@ var ts; } } function emitExportDeclaration(node) { - ts.Debug.assert(modulekind !== 4 /* System */); - if (modulekind !== 5 /* ES6 */) { + ts.Debug.assert(modulekind !== ts.ModuleKind.System); + if (modulekind !== ts.ModuleKind.ES6) { if (node.moduleSpecifier && (!node.exportClause || resolver.isValueAliasDeclaration(node))) { emitStart(node); var generatedName = getGeneratedNameForNode(node); if (node.exportClause) { // export { x, y, ... } from "foo" - if (modulekind !== 2 /* AMD */) { + if (modulekind !== ts.ModuleKind.AMD) { write("var "); write(generatedName); write(" = "); @@ -35882,15 +39966,17 @@ var ts; } else { // export * from "foo" - writeLine(); - write("__export("); - if (modulekind !== 2 /* AMD */) { - emitRequire(ts.getExternalModuleName(node)); + if (hasExportStarsToExportValues && resolver.moduleExportsSomeValue(node.moduleSpecifier)) { + writeLine(); + write("__export("); + if (modulekind !== ts.ModuleKind.AMD) { + emitRequire(ts.getExternalModuleName(node)); + } + else { + write(generatedName); + } + write(");"); } - else { - write(generatedName); - } - write(");"); } emitEnd(node); } @@ -35916,7 +40002,7 @@ var ts; } } function emitExportOrImportSpecifierList(specifiers, shouldEmit) { - ts.Debug.assert(modulekind === 5 /* ES6 */); + ts.Debug.assert(modulekind === ts.ModuleKind.ES6); var needsComma = false; for (var _a = 0, specifiers_1 = specifiers; _a < specifiers_1.length; _a++) { var specifier = specifiers_1[_a]; @@ -35935,14 +40021,14 @@ var ts; } function emitExportAssignment(node) { if (!node.isExportEquals && resolver.isValueAliasDeclaration(node)) { - if (modulekind === 5 /* ES6 */) { + if (modulekind === ts.ModuleKind.ES6) { writeLine(); emitStart(node); write("export default "); var expression = node.expression; emit(expression); - if (expression.kind !== 213 /* FunctionDeclaration */ && - expression.kind !== 214 /* ClassDeclaration */) { + if (expression.kind !== 220 /* FunctionDeclaration */ && + expression.kind !== 221 /* ClassDeclaration */) { write(";"); } emitEnd(node); @@ -35950,7 +40036,7 @@ var ts; else { writeLine(); emitStart(node); - if (modulekind === 4 /* System */) { + if (modulekind === ts.ModuleKind.System) { write(exportFunctionForFile + "(\"default\","); emit(node.expression); write(")"); @@ -35959,7 +40045,7 @@ var ts; emitEs6ExportDefaultCompat(node); emitContainingModuleName(node); if (languageVersion === 0 /* ES3 */) { - write("[\"default\"] = "); + write('["default"] = '); } else { write(".default = "); @@ -35975,11 +40061,11 @@ var ts; externalImports = []; exportSpecifiers = {}; exportEquals = undefined; - hasExportStars = false; + hasExportStarsToExportValues = false; for (var _a = 0, _b = sourceFile.statements; _a < _b.length; _a++) { var node = _b[_a]; switch (node.kind) { - case 222 /* ImportDeclaration */: + case 230 /* ImportDeclaration */: if (!node.importClause || resolver.isReferencedAliasDeclaration(node.importClause, /*checkChildren*/ true)) { // import "mod" @@ -35989,18 +40075,20 @@ var ts; externalImports.push(node); } break; - case 221 /* ImportEqualsDeclaration */: - if (node.moduleReference.kind === 232 /* ExternalModuleReference */ && resolver.isReferencedAliasDeclaration(node)) { + case 229 /* ImportEqualsDeclaration */: + if (node.moduleReference.kind === 240 /* ExternalModuleReference */ && resolver.isReferencedAliasDeclaration(node)) { // import x = require("mod") where x is referenced externalImports.push(node); } break; - case 228 /* ExportDeclaration */: + case 236 /* ExportDeclaration */: if (node.moduleSpecifier) { if (!node.exportClause) { // export * from "mod" - externalImports.push(node); - hasExportStars = true; + if (resolver.moduleExportsSomeValue(node.moduleSpecifier)) { + externalImports.push(node); + hasExportStarsToExportValues = true; + } } else if (resolver.isValueAliasDeclaration(node)) { // export { x, y } from "mod" where at least one export is a value symbol @@ -36011,12 +40099,12 @@ var ts; // export { x, y } for (var _c = 0, _d = node.exportClause.elements; _c < _d.length; _c++) { var specifier = _d[_c]; - var name_26 = (specifier.propertyName || specifier.name).text; - (exportSpecifiers[name_26] || (exportSpecifiers[name_26] = [])).push(specifier); + var name_29 = (specifier.propertyName || specifier.name).text; + (exportSpecifiers[name_29] || (exportSpecifiers[name_29] = [])).push(specifier); } } break; - case 227 /* ExportAssignment */: + case 235 /* ExportAssignment */: if (node.isExportEquals && !exportEquals) { // export = x exportEquals = node; @@ -36026,7 +40114,7 @@ var ts; } } function emitExportStarHelper() { - if (hasExportStars) { + if (hasExportStarsToExportValues) { writeLine(); write("function __export(m) {"); increaseIndent(); @@ -36042,14 +40130,20 @@ var ts; if (namespaceDeclaration && !isDefaultImport(node)) { return ts.getTextOfNodeFromSourceText(currentText, namespaceDeclaration.name); } - if (node.kind === 222 /* ImportDeclaration */ && node.importClause) { + if (node.kind === 230 /* ImportDeclaration */ && node.importClause) { return getGeneratedNameForNode(node); } - if (node.kind === 228 /* ExportDeclaration */ && node.moduleSpecifier) { + if (node.kind === 236 /* ExportDeclaration */ && node.moduleSpecifier) { return getGeneratedNameForNode(node); } } - function getExternalModuleNameText(importNode) { + function getExternalModuleNameText(importNode, emitRelativePathAsModuleName) { + if (emitRelativePathAsModuleName) { + var name_30 = getExternalModuleNameFromDeclaration(host, resolver, importNode); + if (name_30) { + return "\"" + name_30 + "\""; + } + } var moduleName = ts.getExternalModuleName(importNode); if (moduleName.kind === 9 /* StringLiteral */) { return tryRenameExternalModule(moduleName) || getLiteralText(moduleName); @@ -36065,8 +40159,8 @@ var ts; for (var _a = 0, externalImports_1 = externalImports; _a < externalImports_1.length; _a++) { var importNode = externalImports_1[_a]; // do not create variable declaration for exports and imports that lack import clause - var skipNode = importNode.kind === 228 /* ExportDeclaration */ || - (importNode.kind === 222 /* ImportDeclaration */ && !importNode.importClause); + var skipNode = importNode.kind === 236 /* ExportDeclaration */ || + (importNode.kind === 230 /* ImportDeclaration */ && !importNode.importClause); if (skipNode) { continue; } @@ -36087,8 +40181,8 @@ var ts; // when resolving exports local exported entries/indirect exported entries in the module // should always win over entries with similar names that were added via star exports // to support this we store names of local/indirect exported entries in a set. - // this set is used to filter names brought by star expors. - if (!hasExportStars) { + // this set is used to filter names brought by star exports. + if (!hasExportStarsToExportValues) { // local names set is needed only in presence of star exports return undefined; } @@ -36099,7 +40193,7 @@ var ts; var hasExportDeclarationWithExportClause = false; for (var _a = 0, externalImports_2 = externalImports; _a < externalImports_2.length; _a++) { var externalImport = externalImports_2[_a]; - if (externalImport.kind === 228 /* ExportDeclaration */ && externalImport.exportClause) { + if (externalImport.kind === 236 /* ExportDeclaration */ && externalImport.exportClause) { hasExportDeclarationWithExportClause = true; break; } @@ -36115,7 +40209,7 @@ var ts; increaseIndent(); var started = false; if (exportedDeclarations) { - for (var i = 0; i < exportedDeclarations.length; ++i) { + for (var i = 0; i < exportedDeclarations.length; i++) { // write name of exported declaration, i.e 'export var x...' writeExportedName(exportedDeclarations[i]); } @@ -36131,7 +40225,7 @@ var ts; } for (var _d = 0, externalImports_3 = externalImports; _d < externalImports_3.length; _d++) { var externalImport = externalImports_3[_d]; - if (externalImport.kind !== 228 /* ExportDeclaration */) { + if (externalImport.kind !== 236 /* ExportDeclaration */) { continue; } var exportDecl = externalImport; @@ -36217,14 +40311,14 @@ var ts; writeLine(); write("var "); var seen = {}; - for (var i = 0; i < hoistedVars.length; ++i) { + for (var i = 0; i < hoistedVars.length; i++) { var local = hoistedVars[i]; - var name_27 = local.kind === 69 /* Identifier */ + var name_31 = local.kind === 69 /* Identifier */ ? local : local.name; - if (name_27) { + if (name_31) { // do not emit duplicate entries (in case of declaration merging) in the list of hoisted variables - var text = ts.unescapeIdentifier(name_27.text); + var text = ts.unescapeIdentifier(name_31.text); if (ts.hasProperty(seen, text)) { continue; } @@ -36235,14 +40329,14 @@ var ts; if (i !== 0) { write(", "); } - if (local.kind === 214 /* ClassDeclaration */ || local.kind === 218 /* ModuleDeclaration */ || local.kind === 217 /* EnumDeclaration */) { + if (local.kind === 221 /* ClassDeclaration */ || local.kind === 225 /* ModuleDeclaration */ || local.kind === 224 /* EnumDeclaration */) { emitDeclarationName(local); } else { emit(local); } var flags = ts.getCombinedNodeFlags(local.kind === 69 /* Identifier */ ? local.parent : local); - if (flags & 2 /* Export */) { + if (flags & 1 /* Export */) { if (!exportedDeclarations) { exportedDeclarations = []; } @@ -36256,7 +40350,7 @@ var ts; var f = hoistedFunctionDeclarations_1[_a]; writeLine(); emit(f); - if (f.flags & 2 /* Export */) { + if (f.flags & 1 /* Export */) { if (!exportedDeclarations) { exportedDeclarations = []; } @@ -36266,24 +40360,24 @@ var ts; } return exportedDeclarations; function visit(node) { - if (node.flags & 4 /* Ambient */) { + if (node.flags & 2 /* Ambient */) { return; } - if (node.kind === 213 /* FunctionDeclaration */) { + if (node.kind === 220 /* FunctionDeclaration */) { if (!hoistedFunctionDeclarations) { hoistedFunctionDeclarations = []; } hoistedFunctionDeclarations.push(node); return; } - if (node.kind === 214 /* ClassDeclaration */) { + if (node.kind === 221 /* ClassDeclaration */) { if (!hoistedVars) { hoistedVars = []; } hoistedVars.push(node); return; } - if (node.kind === 217 /* EnumDeclaration */) { + if (node.kind === 224 /* EnumDeclaration */) { if (shouldEmitEnumDeclaration(node)) { if (!hoistedVars) { hoistedVars = []; @@ -36292,7 +40386,7 @@ var ts; } return; } - if (node.kind === 218 /* ModuleDeclaration */) { + if (node.kind === 225 /* ModuleDeclaration */) { if (shouldEmitModuleDeclaration(node)) { if (!hoistedVars) { hoistedVars = []; @@ -36301,17 +40395,17 @@ var ts; } return; } - if (node.kind === 211 /* VariableDeclaration */ || node.kind === 163 /* BindingElement */) { + if (node.kind === 218 /* VariableDeclaration */ || node.kind === 169 /* BindingElement */) { if (shouldHoistVariable(node, /*checkIfSourceFileLevelDecl*/ false)) { - var name_28 = node.name; - if (name_28.kind === 69 /* Identifier */) { + var name_32 = node.name; + if (name_32.kind === 69 /* Identifier */) { if (!hoistedVars) { hoistedVars = []; } - hoistedVars.push(name_28); + hoistedVars.push(name_32); } else { - ts.forEachChild(name_28, visit); + ts.forEachChild(name_32, visit); } } return; @@ -36341,11 +40435,11 @@ var ts; // - it is top level block scoped // if block scoped variables are nested in some another block then // no other functions can use them except ones that are defined at least in the same block - return (ts.getCombinedNodeFlags(node) & 24576 /* BlockScoped */) === 0 || - ts.getEnclosingBlockScopeContainer(node).kind === 248 /* SourceFile */; + return (ts.getCombinedNodeFlags(node) & 3072 /* BlockScoped */) === 0 || + ts.getEnclosingBlockScopeContainer(node).kind === 256 /* SourceFile */; } function isCurrentFileSystemExternalModule() { - return modulekind === 4 /* System */ && isCurrentFileExternalModule; + return modulekind === ts.ModuleKind.System && isCurrentFileExternalModule; } function emitSystemModuleBody(node, dependencyGroups, startIndex) { // shape of the body in system modules: @@ -36402,7 +40496,7 @@ var ts; } function emitSetters(exportStarFunction, dependencyGroups) { write("setters:["); - for (var i = 0; i < dependencyGroups.length; ++i) { + for (var i = 0; i < dependencyGroups.length; i++) { if (i !== 0) { write(","); } @@ -36417,21 +40511,21 @@ var ts; var entry = group_1[_a]; var importVariableName = getLocalNameForExternalImport(entry) || ""; switch (entry.kind) { - case 222 /* ImportDeclaration */: + case 230 /* ImportDeclaration */: if (!entry.importClause) { // 'import "..."' case // module is imported only for side-effects, no emit required break; } // fall-through - case 221 /* ImportEqualsDeclaration */: + case 229 /* ImportEqualsDeclaration */: ts.Debug.assert(importVariableName !== ""); writeLine(); // save import into the local write(importVariableName + " = " + parameterName + ";"); writeLine(); break; - case 228 /* ExportDeclaration */: + case 236 /* ExportDeclaration */: ts.Debug.assert(importVariableName !== ""); if (entry.exportClause) { // export {a, b as c} from 'foo' @@ -36444,12 +40538,12 @@ var ts; write(exportFunctionForFile + "({"); writeLine(); increaseIndent(); - for (var i_2 = 0, len = entry.exportClause.elements.length; i_2 < len; ++i_2) { - if (i_2 !== 0) { + for (var i_1 = 0, len = entry.exportClause.elements.length; i_1 < len; i_1++) { + if (i_1 !== 0) { write(","); writeLine(); } - var e = entry.exportClause.elements[i_2]; + var e = entry.exportClause.elements[i_1]; write("\""); emitNodeWithCommentsAndWithoutSourcemap(e.name); write("\": " + parameterName + "[\""); @@ -36461,6 +40555,8 @@ var ts; write("});"); } else { + // collectExternalModuleInfo prefilters star exports to keep only ones that export values + // this means that check 'resolver.moduleExportsSomeValue' is redundant and can be omitted here writeLine(); // export * from 'foo' // emit as: @@ -36481,17 +40577,17 @@ var ts; write("execute: function() {"); increaseIndent(); writeLine(); - for (var i = startIndex; i < node.statements.length; ++i) { + for (var i = startIndex; i < node.statements.length; i++) { var statement = node.statements[i]; switch (statement.kind) { // - function declarations are not emitted because they were already hoisted // - import declarations are not emitted since they are already handled in setters // - export declarations with module specifiers are not emitted since they were already written in setters // - export declarations without module specifiers are emitted preserving the order - case 213 /* FunctionDeclaration */: - case 222 /* ImportDeclaration */: + case 220 /* FunctionDeclaration */: + case 230 /* ImportDeclaration */: continue; - case 228 /* ExportDeclaration */: + case 236 /* ExportDeclaration */: if (!statement.moduleSpecifier) { for (var _a = 0, _b = statement.exportClause.elements; _a < _b.length; _a++) { var element = _b[_a]; @@ -36500,7 +40596,7 @@ var ts; } } continue; - case 221 /* ImportEqualsDeclaration */: + case 229 /* ImportEqualsDeclaration */: if (!ts.isInternalModuleImportEqualsDeclaration(statement)) { // - import equals declarations that import external modules are not emitted continue; @@ -36534,39 +40630,43 @@ var ts; ts.Debug.assert(!exportFunctionForFile); // make sure that name of 'exports' function does not conflict with existing identifiers exportFunctionForFile = makeUniqueName("exports"); + contextObjectForFile = makeUniqueName("context"); writeLine(); write("System.register("); writeModuleName(node, emitRelativePathAsModuleName); write("["); var groupIndices = {}; var dependencyGroups = []; - for (var i = 0; i < externalImports.length; ++i) { - var text = getExternalModuleNameText(externalImports[i]); - if (ts.hasProperty(groupIndices, text)) { + for (var i = 0; i < externalImports.length; i++) { + var text = getExternalModuleNameText(externalImports[i], emitRelativePathAsModuleName); + if (text === undefined) { + continue; + } + // text should be quoted string + // for deduplication purposes in key remove leading and trailing quotes so 'a' and "a" will be considered the same + var key = text.substr(1, text.length - 2); + if (ts.hasProperty(groupIndices, key)) { // deduplicate/group entries in dependency list by the dependency name - var groupIndex = groupIndices[text]; + var groupIndex = groupIndices[key]; dependencyGroups[groupIndex].push(externalImports[i]); continue; } else { - groupIndices[text] = dependencyGroups.length; + groupIndices[key] = dependencyGroups.length; dependencyGroups.push([externalImports[i]]); } if (i !== 0) { write(", "); } - if (emitRelativePathAsModuleName) { - var name_29 = getExternalModuleNameFromDeclaration(host, resolver, externalImports[i]); - if (name_29) { - text = "\"" + name_29 + "\""; - } - } write(text); } - write("], function(" + exportFunctionForFile + ") {"); + write("], function(" + exportFunctionForFile + ", " + contextObjectForFile + ") {"); writeLine(); increaseIndent(); - var startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ true); + var startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ true, /*ensureUseStrict*/ !compilerOptions.noImplicitUseStrict); + writeLine(); + write("var __moduleName = " + contextObjectForFile + " && " + contextObjectForFile + ".id;"); + writeLine(); emitEmitHelpers(node); emitCaptureThisForNodeIfNecessary(node); emitSystemModuleBody(node, dependencyGroups, startIndex); @@ -36586,23 +40686,17 @@ var ts; for (var _a = 0, _b = node.amdDependencies; _a < _b.length; _a++) { var amdDependency = _b[_a]; if (amdDependency.name) { - aliasedModuleNames.push("\"" + amdDependency.path + "\""); + aliasedModuleNames.push('"' + amdDependency.path + '"'); importAliasNames.push(amdDependency.name); } else { - unaliasedModuleNames.push("\"" + amdDependency.path + "\""); + unaliasedModuleNames.push('"' + amdDependency.path + '"'); } } for (var _c = 0, externalImports_4 = externalImports; _c < externalImports_4.length; _c++) { var importNode = externalImports_4[_c]; // Find the name of the external module - var externalModuleName = getExternalModuleNameText(importNode); - if (emitRelativePathAsModuleName) { - var name_30 = getExternalModuleNameFromDeclaration(host, resolver, importNode); - if (name_30) { - externalModuleName = "\"" + name_30 + "\""; - } - } + var externalModuleName = getExternalModuleNameText(importNode, emitRelativePathAsModuleName); // Find the name of the module alias, if there is one var importAliasName = getLocalNameForExternalImport(importNode); if (includeNonAmdDependencies && importAliasName) { @@ -36634,7 +40728,7 @@ var ts; } function emitAMDDependencyList(_a) { var aliasedModuleNames = _a.aliasedModuleNames, unaliasedModuleNames = _a.unaliasedModuleNames; - write("[\"require\", \"exports\""); + write('["require", "exports"'); if (aliasedModuleNames.length) { write(", "); write(aliasedModuleNames.join(", ")); @@ -36662,25 +40756,25 @@ var ts; writeModuleName(node, emitRelativePathAsModuleName); emitAMDDependencies(node, /*includeNonAmdDependencies*/ true, emitRelativePathAsModuleName); increaseIndent(); - var startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ true); + var startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ true, /*ensureUseStrict*/ !compilerOptions.noImplicitUseStrict); emitExportStarHelper(); emitCaptureThisForNodeIfNecessary(node); emitLinesStartingAt(node.statements, startIndex); - emitTempDeclarations(/*newLine*/ true); emitExportEquals(/*emitAsReturn*/ true); + emitTempDeclarations(/*newLine*/ true); decreaseIndent(); writeLine(); write("});"); } function emitCommonJSModule(node) { - var startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ false); + var startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ false, /*ensureUseStrict*/ !compilerOptions.noImplicitUseStrict); emitEmitHelpers(node); collectExternalModuleInfo(node); emitExportStarHelper(); emitCaptureThisForNodeIfNecessary(node); emitLinesStartingAt(node.statements, startIndex); - emitTempDeclarations(/*newLine*/ true); emitExportEquals(/*emitAsReturn*/ false); + emitTempDeclarations(/*newLine*/ true); } function emitUMDModule(node) { emitEmitHelpers(node); @@ -36693,12 +40787,12 @@ var ts; writeLines(" }\n})("); emitAMDFactoryHeader(dependencyNames); increaseIndent(); - var startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ true); + var startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ true, /*ensureUseStrict*/ !compilerOptions.noImplicitUseStrict); emitExportStarHelper(); emitCaptureThisForNodeIfNecessary(node); emitLinesStartingAt(node.statements, startIndex); - emitTempDeclarations(/*newLine*/ true); emitExportEquals(/*emitAsReturn*/ true); + emitTempDeclarations(/*newLine*/ true); decreaseIndent(); writeLine(); write("});"); @@ -36707,7 +40801,7 @@ var ts; externalImports = undefined; exportSpecifiers = undefined; exportEquals = undefined; - hasExportStars = false; + hasExportStarsToExportValues = false; var startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ false); emitEmitHelpers(node); emitCaptureThisForNodeIfNecessary(node); @@ -36770,7 +40864,9 @@ var ts; // Replace entities like   result = result.replace(/&(\w+);/g, function (s, m) { if (entities[m] !== undefined) { - return String.fromCharCode(entities[m]); + var ch = String.fromCharCode(entities[m]); + // " needs to be escaped + return ch === '"' ? "\\\"" : ch; } else { return s; @@ -36779,6 +40875,18 @@ var ts; } return result; } + function isJsxChildEmittable(child) { + if (child.kind === 248 /* JsxExpression */) { + // Don't emit empty expressions + return !!child.expression; + } + else if (child.kind === 244 /* JsxText */) { + // Don't emit empty strings + return !!getTextToEmit(child); + } + return true; + } + ; function getTextToEmit(node) { switch (compilerOptions.jsx) { case 2 /* React */: @@ -36797,9 +40905,9 @@ var ts; function emitJsxText(node) { switch (compilerOptions.jsx) { case 2 /* React */: - write("\""); + write('"'); write(trimReactWhitespaceAndApplyEntities(node)); - write("\""); + write('"'); break; case 1 /* Preserve */: default: @@ -36822,24 +40930,41 @@ var ts; } } } - function emitDirectivePrologues(statements, startWithNewLine) { - for (var i = 0; i < statements.length; ++i) { + function isUseStrictPrologue(node) { + return node.expression.text === "use strict"; + } + function ensureUseStrictPrologue(startWithNewLine, writeUseStrict) { + if (writeUseStrict) { + if (startWithNewLine) { + writeLine(); + } + write("\"use strict\";"); + } + } + function emitDirectivePrologues(statements, startWithNewLine, ensureUseStrict) { + var foundUseStrict = false; + for (var i = 0; i < statements.length; i++) { if (ts.isPrologueDirective(statements[i])) { + if (isUseStrictPrologue(statements[i])) { + foundUseStrict = true; + } if (startWithNewLine || i > 0) { writeLine(); } emit(statements[i]); } else { + ensureUseStrictPrologue(startWithNewLine || i > 0, !foundUseStrict && ensureUseStrict); // return index of the first non prologue directive return i; } } + ensureUseStrictPrologue(startWithNewLine, !foundUseStrict && ensureUseStrict); return statements.length; } function writeLines(text) { var lines = text.split(/\r\n|\r|\n/g); - for (var i = 0; i < lines.length; ++i) { + for (var i = 0; i < lines.length; i++) { var line = lines[i]; if (line.length) { writeLine(); @@ -36852,22 +40977,26 @@ var ts; if (!compilerOptions.noEmitHelpers) { // Only Emit __extends function when target ES5. // For target ES6 and above, we can emit classDeclaration as is. - if ((languageVersion < 2 /* ES6 */) && (!extendsEmitted && resolver.getNodeCheckFlags(node) & 8 /* EmitExtends */)) { + if (languageVersion < 2 /* ES6 */ && !extendsEmitted && node.flags & 262144 /* HasClassExtends */) { writeLines(extendsHelper); extendsEmitted = true; } - if (!decorateEmitted && resolver.getNodeCheckFlags(node) & 16 /* EmitDecorate */) { + if (compilerOptions.jsx !== 1 /* Preserve */ && !assignEmitted && (node.flags & 1073741824 /* HasJsxSpreadAttribute */)) { + writeLines(assignHelper); + assignEmitted = true; + } + if (!decorateEmitted && node.flags & 524288 /* HasDecorators */) { writeLines(decorateHelper); if (compilerOptions.emitDecoratorMetadata) { writeLines(metadataHelper); } decorateEmitted = true; } - if (!paramEmitted && resolver.getNodeCheckFlags(node) & 32 /* EmitParam */) { + if (!paramEmitted && node.flags & 1048576 /* HasParamDecorators */) { writeLines(paramHelper); paramEmitted = true; } - if (!awaiterEmitted && resolver.getNodeCheckFlags(node) & 64 /* EmitAwaiter */) { + if (!awaiterEmitted && node.flags & 2097152 /* HasAsyncFunctions */) { writeLines(awaiterHelper); awaiterEmitted = true; } @@ -36879,8 +41008,8 @@ var ts; emitShebang(); emitDetachedCommentsAndUpdateCommentsInfo(node); if (ts.isExternalModule(node) || compilerOptions.isolatedModules) { - if (root || (!ts.isExternalModule(node) && compilerOptions.isolatedModules)) { - var emitModule = moduleEmitDelegates[modulekind] || moduleEmitDelegates[1 /* CommonJS */]; + if (isOwnFileEmit || (!ts.isExternalModule(node) && compilerOptions.isolatedModules)) { + var emitModule = moduleEmitDelegates[modulekind] || moduleEmitDelegates[ts.ModuleKind.CommonJS]; emitModule(node); } else { @@ -36893,7 +41022,7 @@ var ts; externalImports = undefined; exportSpecifiers = undefined; exportEquals = undefined; - hasExportStars = false; + hasExportStarsToExportValues = false; emitEmitHelpers(node); emitCaptureThisForNodeIfNecessary(node); emitLinesStartingAt(node.statements, startIndex); @@ -36901,12 +41030,15 @@ var ts; } emitLeadingComments(node.endOfFileToken); } + function emit(node) { + emitNodeConsideringCommentsOption(node, emitNodeWithSourceMap); + } function emitNodeWithCommentsAndWithoutSourcemap(node) { emitNodeConsideringCommentsOption(node, emitNodeWithoutSourceMap); } function emitNodeConsideringCommentsOption(node, emitNodeConsideringSourcemap) { if (node) { - if (node.flags & 4 /* Ambient */) { + if (node.flags & 2 /* Ambient */) { return emitCommentsOnNotEmittedNode(node); } if (isSpecializedCommentHandling(node)) { @@ -36923,33 +41055,53 @@ var ts; } } } + function emitNodeWithSourceMap(node) { + if (node) { + emitStart(node); + emitNodeWithoutSourceMap(node); + emitEnd(node); + } + } function emitNodeWithoutSourceMap(node) { if (node) { emitJavaScriptWorker(node); } } + function changeSourceMapEmit(writer) { + sourceMap = writer; + emitStart = writer.emitStart; + emitEnd = writer.emitEnd; + emitPos = writer.emitPos; + setSourceFile = writer.setSourceFile; + } + function withTemporaryNoSourceMap(callback) { + var prevSourceMap = sourceMap; + setSourceMapWriterEmit(ts.getNullSourceMapWriter()); + callback(); + setSourceMapWriterEmit(prevSourceMap); + } function isSpecializedCommentHandling(node) { switch (node.kind) { // All of these entities are emitted in a specialized fashion. As such, we allow // the specialized methods for each to handle the comments on the nodes. - case 215 /* InterfaceDeclaration */: - case 213 /* FunctionDeclaration */: - case 222 /* ImportDeclaration */: - case 221 /* ImportEqualsDeclaration */: - case 216 /* TypeAliasDeclaration */: - case 227 /* ExportAssignment */: + case 222 /* InterfaceDeclaration */: + case 220 /* FunctionDeclaration */: + case 230 /* ImportDeclaration */: + case 229 /* ImportEqualsDeclaration */: + case 223 /* TypeAliasDeclaration */: + case 235 /* ExportAssignment */: return true; } } function shouldEmitLeadingAndTrailingComments(node) { switch (node.kind) { - case 193 /* VariableStatement */: + case 200 /* VariableStatement */: return shouldEmitLeadingAndTrailingCommentsForVariableStatement(node); - case 218 /* ModuleDeclaration */: + case 225 /* ModuleDeclaration */: // Only emit the leading/trailing comments for a module if we're actually // emitting the module as well. return shouldEmitModuleDeclaration(node); - case 217 /* EnumDeclaration */: + case 224 /* EnumDeclaration */: // Only emit the leading/trailing comments for an enum if we're actually // emitting the module as well. return shouldEmitEnumDeclaration(node); @@ -36961,11 +41113,11 @@ var ts; // then we don't want to emit comments when we emit the body. It will have already // been taken care of when we emitted the 'return' statement for the function // expression body. - if (node.kind !== 192 /* Block */ && + if (node.kind !== 199 /* Block */ && node.parent && - node.parent.kind === 174 /* ArrowFunction */ && + node.parent.kind === 180 /* ArrowFunction */ && node.parent.body === node && - compilerOptions.target <= 1 /* ES5 */) { + languageVersion <= 1 /* ES5 */) { return false; } // Emit comments for everything else. @@ -36976,13 +41128,13 @@ var ts; switch (node.kind) { case 69 /* Identifier */: return emitIdentifier(node); - case 138 /* Parameter */: + case 142 /* Parameter */: return emitParameter(node); - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: return emitMethod(node); - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: return emitAccessor(node); case 97 /* ThisKeyword */: return emitThis(node); @@ -37002,142 +41154,142 @@ var ts; case 13 /* TemplateMiddle */: case 14 /* TemplateTail */: return emitLiteral(node); - case 183 /* TemplateExpression */: + case 189 /* TemplateExpression */: return emitTemplateExpression(node); - case 190 /* TemplateSpan */: + case 197 /* TemplateSpan */: return emitTemplateSpan(node); - case 233 /* JsxElement */: - case 234 /* JsxSelfClosingElement */: + case 241 /* JsxElement */: + case 242 /* JsxSelfClosingElement */: return emitJsxElement(node); - case 236 /* JsxText */: + case 244 /* JsxText */: return emitJsxText(node); - case 240 /* JsxExpression */: + case 248 /* JsxExpression */: return emitJsxExpression(node); - case 135 /* QualifiedName */: + case 139 /* QualifiedName */: return emitQualifiedName(node); - case 161 /* ObjectBindingPattern */: + case 167 /* ObjectBindingPattern */: return emitObjectBindingPattern(node); - case 162 /* ArrayBindingPattern */: + case 168 /* ArrayBindingPattern */: return emitArrayBindingPattern(node); - case 163 /* BindingElement */: + case 169 /* BindingElement */: return emitBindingElement(node); - case 164 /* ArrayLiteralExpression */: + case 170 /* ArrayLiteralExpression */: return emitArrayLiteral(node); - case 165 /* ObjectLiteralExpression */: + case 171 /* ObjectLiteralExpression */: return emitObjectLiteral(node); - case 245 /* PropertyAssignment */: + case 253 /* PropertyAssignment */: return emitPropertyAssignment(node); - case 246 /* ShorthandPropertyAssignment */: + case 254 /* ShorthandPropertyAssignment */: return emitShorthandPropertyAssignment(node); - case 136 /* ComputedPropertyName */: + case 140 /* ComputedPropertyName */: return emitComputedPropertyName(node); - case 166 /* PropertyAccessExpression */: + case 172 /* PropertyAccessExpression */: return emitPropertyAccess(node); - case 167 /* ElementAccessExpression */: + case 173 /* ElementAccessExpression */: return emitIndexedAccess(node); - case 168 /* CallExpression */: + case 174 /* CallExpression */: return emitCallExpression(node); - case 169 /* NewExpression */: + case 175 /* NewExpression */: return emitNewExpression(node); - case 170 /* TaggedTemplateExpression */: + case 176 /* TaggedTemplateExpression */: return emitTaggedTemplateExpression(node); - case 171 /* TypeAssertionExpression */: + case 177 /* TypeAssertionExpression */: + case 195 /* AsExpression */: + case 196 /* NonNullExpression */: return emit(node.expression); - case 189 /* AsExpression */: - return emit(node.expression); - case 172 /* ParenthesizedExpression */: + case 178 /* ParenthesizedExpression */: return emitParenExpression(node); - case 213 /* FunctionDeclaration */: - case 173 /* FunctionExpression */: - case 174 /* ArrowFunction */: + case 220 /* FunctionDeclaration */: + case 179 /* FunctionExpression */: + case 180 /* ArrowFunction */: return emitFunctionDeclaration(node); - case 175 /* DeleteExpression */: + case 181 /* DeleteExpression */: return emitDeleteExpression(node); - case 176 /* TypeOfExpression */: + case 182 /* TypeOfExpression */: return emitTypeOfExpression(node); - case 177 /* VoidExpression */: + case 183 /* VoidExpression */: return emitVoidExpression(node); - case 178 /* AwaitExpression */: + case 184 /* AwaitExpression */: return emitAwaitExpression(node); - case 179 /* PrefixUnaryExpression */: + case 185 /* PrefixUnaryExpression */: return emitPrefixUnaryExpression(node); - case 180 /* PostfixUnaryExpression */: + case 186 /* PostfixUnaryExpression */: return emitPostfixUnaryExpression(node); - case 181 /* BinaryExpression */: + case 187 /* BinaryExpression */: return emitBinaryExpression(node); - case 182 /* ConditionalExpression */: + case 188 /* ConditionalExpression */: return emitConditionalExpression(node); - case 185 /* SpreadElementExpression */: + case 191 /* SpreadElementExpression */: return emitSpreadElementExpression(node); - case 184 /* YieldExpression */: + case 190 /* YieldExpression */: return emitYieldExpression(node); - case 187 /* OmittedExpression */: + case 193 /* OmittedExpression */: return; - case 192 /* Block */: - case 219 /* ModuleBlock */: + case 199 /* Block */: + case 226 /* ModuleBlock */: return emitBlock(node); - case 193 /* VariableStatement */: + case 200 /* VariableStatement */: return emitVariableStatement(node); - case 194 /* EmptyStatement */: + case 201 /* EmptyStatement */: return write(";"); - case 195 /* ExpressionStatement */: + case 202 /* ExpressionStatement */: return emitExpressionStatement(node); - case 196 /* IfStatement */: + case 203 /* IfStatement */: return emitIfStatement(node); - case 197 /* DoStatement */: + case 204 /* DoStatement */: return emitDoStatement(node); - case 198 /* WhileStatement */: + case 205 /* WhileStatement */: return emitWhileStatement(node); - case 199 /* ForStatement */: + case 206 /* ForStatement */: return emitForStatement(node); - case 201 /* ForOfStatement */: - case 200 /* ForInStatement */: + case 208 /* ForOfStatement */: + case 207 /* ForInStatement */: return emitForInOrForOfStatement(node); - case 202 /* ContinueStatement */: - case 203 /* BreakStatement */: + case 209 /* ContinueStatement */: + case 210 /* BreakStatement */: return emitBreakOrContinueStatement(node); - case 204 /* ReturnStatement */: + case 211 /* ReturnStatement */: return emitReturnStatement(node); - case 205 /* WithStatement */: + case 212 /* WithStatement */: return emitWithStatement(node); - case 206 /* SwitchStatement */: + case 213 /* SwitchStatement */: return emitSwitchStatement(node); - case 241 /* CaseClause */: - case 242 /* DefaultClause */: + case 249 /* CaseClause */: + case 250 /* DefaultClause */: return emitCaseOrDefaultClause(node); - case 207 /* LabeledStatement */: + case 214 /* LabeledStatement */: return emitLabeledStatement(node); - case 208 /* ThrowStatement */: + case 215 /* ThrowStatement */: return emitThrowStatement(node); - case 209 /* TryStatement */: + case 216 /* TryStatement */: return emitTryStatement(node); - case 244 /* CatchClause */: + case 252 /* CatchClause */: return emitCatchClause(node); - case 210 /* DebuggerStatement */: + case 217 /* DebuggerStatement */: return emitDebuggerStatement(node); - case 211 /* VariableDeclaration */: + case 218 /* VariableDeclaration */: return emitVariableDeclaration(node); - case 186 /* ClassExpression */: + case 192 /* ClassExpression */: return emitClassExpression(node); - case 214 /* ClassDeclaration */: + case 221 /* ClassDeclaration */: return emitClassDeclaration(node); - case 215 /* InterfaceDeclaration */: + case 222 /* InterfaceDeclaration */: return emitInterfaceDeclaration(node); - case 217 /* EnumDeclaration */: + case 224 /* EnumDeclaration */: return emitEnumDeclaration(node); - case 247 /* EnumMember */: + case 255 /* EnumMember */: return emitEnumMember(node); - case 218 /* ModuleDeclaration */: + case 225 /* ModuleDeclaration */: return emitModuleDeclaration(node); - case 222 /* ImportDeclaration */: + case 230 /* ImportDeclaration */: return emitImportDeclaration(node); - case 221 /* ImportEqualsDeclaration */: + case 229 /* ImportEqualsDeclaration */: return emitImportEqualsDeclaration(node); - case 228 /* ExportDeclaration */: + case 236 /* ExportDeclaration */: return emitExportDeclaration(node); - case 227 /* ExportAssignment */: + case 235 /* ExportAssignment */: return emitExportAssignment(node); - case 248 /* SourceFile */: + case 256 /* SourceFile */: return emitSourceFileNode(node); } } @@ -37176,7 +41328,7 @@ var ts; function getLeadingCommentsToEmit(node) { // Emit the leading comments only if the parent's pos doesn't match because parent should take care of emitting these comments if (node.parent) { - if (node.parent.kind === 248 /* SourceFile */ || node.pos !== node.parent.pos) { + if (node.parent.kind === 256 /* SourceFile */ || node.pos !== node.parent.pos) { if (hasDetachedComments(node.pos)) { // get comments without detached comments return getLeadingCommentsWithoutDetachedComments(); @@ -37191,7 +41343,7 @@ var ts; function getTrailingCommentsToEmit(node) { // Emit the trailing comments only if the parent's pos doesn't match because parent should take care of emitting these comments if (node.parent) { - if (node.parent.kind === 248 /* SourceFile */ || node.end !== node.parent.end) { + if (node.parent.kind === 256 /* SourceFile */ || node.end !== node.parent.end) { return ts.getTrailingCommentRanges(currentText, node.end); } } @@ -37200,10 +41352,10 @@ var ts; * Emit comments associated with node that will not be emitted into JS file */ function emitCommentsOnNotEmittedNode(node) { - emitLeadingCommentsWorker(node, /*isEmittedNode:*/ false); + emitLeadingCommentsWorker(node, /*isEmittedNode*/ false); } function emitLeadingComments(node) { - return emitLeadingCommentsWorker(node, /*isEmittedNode:*/ true); + return emitLeadingCommentsWorker(node, /*isEmittedNode*/ true); } function emitLeadingCommentsWorker(node, isEmittedNode) { if (compilerOptions.removeComments) { @@ -37221,14 +41373,14 @@ var ts; // declare var x; // /// // interface F {} - // The first /// will NOT be removed while the second one will be removed eventhough both node will not be emitted + // The first /// will NOT be removed while the second one will be removed even though both node will not be emitted if (node.pos === 0) { leadingComments = ts.filter(getLeadingCommentsToEmit(node), isTripleSlashComment); } } ts.emitNewLineBeforeLeadingComments(currentLineMap, writer, node, leadingComments); // Leading comments are emitted at /*leading comment1 */space/*leading comment*/space - ts.emitComments(currentText, currentLineMap, writer, leadingComments, /*trailingSeparator:*/ true, newLine, writeComment); + ts.emitComments(currentText, currentLineMap, writer, leadingComments, /*trailingSeparator*/ true, newLine, writeComment); } function emitTrailingComments(node) { if (compilerOptions.removeComments) { @@ -37280,18 +41432,40 @@ var ts; } } } + function writeComment(text, lineMap, writer, comment, newLine) { + emitPos(comment.pos); + ts.writeCommentRange(text, lineMap, writer, comment, newLine); + emitPos(comment.end); + } function emitShebang() { var shebang = ts.getShebang(currentText); if (shebang) { write(shebang); + writeLine(); } } var _a, _b; } - function emitFile(jsFilePath, sourceFile) { - emitJavaScript(jsFilePath, sourceFile); - if (compilerOptions.declaration) { - ts.writeDeclarationFile(jsFilePath, sourceFile, host, resolver, diagnostics); + function emitFile(_a, sourceFiles, isBundledEmit) { + var jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath; + // Make sure not to write js File and source map file if any of them cannot be written + if (!host.isEmitBlocked(jsFilePath) && !compilerOptions.noEmit) { + emitJavaScript(jsFilePath, sourceMapFilePath, sourceFiles, isBundledEmit); + } + else { + emitSkipped = true; + } + if (declarationFilePath) { + emitSkipped = ts.writeDeclarationFile(declarationFilePath, sourceFiles, isBundledEmit, host, resolver, emitterDiagnostics) || emitSkipped; + } + if (!emitSkipped && emittedFilesList) { + emittedFilesList.push(jsFilePath); + if (sourceMapFilePath) { + emittedFilesList.push(sourceMapFilePath); + } + if (declarationFilePath) { + emittedFilesList.push(declarationFilePath); + } } } } @@ -37308,11 +41482,16 @@ var ts; /* @internal */ ts.ioWriteTime = 0; /** The version of the TypeScript compiler release */ var emptyArray = []; - ts.version = "1.8.0"; - function findConfigFile(searchPath) { - var fileName = "tsconfig.json"; + var defaultLibrarySearchPaths = [ + "types/", + "node_modules/", + "node_modules/@types/", + ]; + ts.version = "1.9.0"; + function findConfigFile(searchPath, fileExists) { while (true) { - if (ts.sys.fileExists(fileName)) { + var fileName = ts.combinePaths(searchPath, "tsconfig.json"); + if (fileExists(fileName)) { return fileName; } var parentPath = ts.getDirectoryPath(searchPath); @@ -37320,7 +41499,6 @@ var ts; break; } searchPath = parentPath; - fileName = "../" + fileName; } return undefined; } @@ -37331,88 +41509,590 @@ var ts; return ts.normalizePath(referencedFileName); } ts.resolveTripleslashReference = resolveTripleslashReference; - function resolveModuleName(moduleName, containingFile, compilerOptions, host) { - var moduleResolution = compilerOptions.moduleResolution !== undefined - ? compilerOptions.moduleResolution - : compilerOptions.module === 1 /* CommonJS */ ? 2 /* NodeJs */ : 1 /* Classic */; - switch (moduleResolution) { - case 2 /* NodeJs */: return nodeModuleNameResolver(moduleName, containingFile, host); - case 1 /* Classic */: return classicNameResolver(moduleName, containingFile, compilerOptions, host); - } - } - ts.resolveModuleName = resolveModuleName; - function nodeModuleNameResolver(moduleName, containingFile, host) { - var containingDirectory = ts.getDirectoryPath(containingFile); - if (ts.getRootLength(moduleName) !== 0 || nameStartsWithDotSlashOrDotDotSlash(moduleName)) { - var failedLookupLocations = []; - var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); - var resolvedFileName = loadNodeModuleFromFile(ts.supportedJsExtensions, candidate, failedLookupLocations, host); - if (resolvedFileName) { - return { resolvedModule: { resolvedFileName: resolvedFileName }, failedLookupLocations: failedLookupLocations }; + /* @internal */ + function computeCommonSourceDirectoryOfFilenames(fileNames, currentDirectory, getCanonicalFileName) { + var commonPathComponents; + var failed = ts.forEach(fileNames, function (sourceFile) { + // Each file contributes into common source file path + var sourcePathComponents = ts.getNormalizedPathComponents(sourceFile, currentDirectory); + sourcePathComponents.pop(); // The base file name is not part of the common directory path + if (!commonPathComponents) { + // first file + commonPathComponents = sourcePathComponents; + return; + } + for (var i = 0, n = Math.min(commonPathComponents.length, sourcePathComponents.length); i < n; i++) { + if (getCanonicalFileName(commonPathComponents[i]) !== getCanonicalFileName(sourcePathComponents[i])) { + if (i === 0) { + // Failed to find any common path component + return true; + } + // New common path found that is 0 -> i-1 + commonPathComponents.length = i; + break; + } + } + // If the sourcePathComponents was shorter than the commonPathComponents, truncate to the sourcePathComponents + if (sourcePathComponents.length < commonPathComponents.length) { + commonPathComponents.length = sourcePathComponents.length; + } + }); + // A common path can not be found when paths span multiple drives on windows, for example + if (failed) { + return ""; + } + if (!commonPathComponents) { + return currentDirectory; + } + return ts.getNormalizedPathFromPathComponents(commonPathComponents); + } + ts.computeCommonSourceDirectoryOfFilenames = computeCommonSourceDirectoryOfFilenames; + function trace(host, message) { + host.trace(ts.formatMessage.apply(undefined, arguments)); + } + function isTraceEnabled(compilerOptions, host) { + return compilerOptions.traceResolution && host.trace !== undefined; + } + function hasZeroOrOneAsteriskCharacter(str) { + var seenAsterisk = false; + for (var i = 0; i < str.length; i++) { + if (str.charCodeAt(i) === 42 /* asterisk */) { + if (!seenAsterisk) { + seenAsterisk = true; + } + else { + // have already seen asterisk + return false; + } + } + } + return true; + } + function createResolvedModule(resolvedFileName, isExternalLibraryImport, failedLookupLocations) { + return { resolvedModule: resolvedFileName ? { resolvedFileName: resolvedFileName, isExternalLibraryImport: isExternalLibraryImport } : undefined, failedLookupLocations: failedLookupLocations }; + } + function moduleHasNonRelativeName(moduleName) { + if (ts.isRootedDiskPath(moduleName)) { + return false; + } + var i = moduleName.lastIndexOf("./", 1); + var startsWithDotSlashOrDotDotSlash = i === 0 || (i === 1 && moduleName.charCodeAt(0) === 46 /* dot */); + return !startsWithDotSlashOrDotDotSlash; + } + function tryReadTypesSection(packageJsonPath, baseDirectory, state) { + var jsonContent; + try { + var jsonText = state.host.readFile(packageJsonPath); + jsonContent = jsonText ? JSON.parse(jsonText) : {}; + } + catch (e) { + // gracefully handle if readFile fails or returns not JSON + jsonContent = {}; + } + var typesFile; + var fieldName; + // first try to read content of 'typings' section (backward compatibility) + if (jsonContent.typings) { + if (typeof jsonContent.typings === "string") { + fieldName = "typings"; + typesFile = jsonContent.typings; + } + else { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Expected_type_of_0_field_in_package_json_to_be_string_got_1, "typings", typeof jsonContent.typings); + } + } + } + // then read 'types' + if (!typesFile && jsonContent.types) { + if (typeof jsonContent.types === "string") { + fieldName = "types"; + typesFile = jsonContent.types; + } + else { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Expected_type_of_0_field_in_package_json_to_be_string_got_1, "types", typeof jsonContent.types); + } + } + } + if (typesFile) { + var typesFilePath = ts.normalizePath(ts.combinePaths(baseDirectory, typesFile)); + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.package_json_has_0_field_1_that_references_2, fieldName, typesFile, typesFilePath); + } + return typesFilePath; + } + return undefined; + } + var typeReferenceExtensions = [".d.ts"]; + /** + * @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, containingFile, options, host) { + var traceEnabled = isTraceEnabled(options, host); + var moduleResolutionState = { + compilerOptions: options, + host: host, + skipTsx: true, + traceEnabled: traceEnabled + }; + // use typesRoot and fallback to directory that contains tsconfig if typesRoot is not set + var rootDir = options.typesRoot || (options.configFilePath ? ts.getDirectoryPath(options.configFilePath) : undefined); + if (traceEnabled) { + if (containingFile === undefined) { + if (rootDir === undefined) { + trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set, typeReferenceDirectiveName); + } + else { + trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1, typeReferenceDirectiveName, rootDir); + } + } + else { + if (rootDir === undefined) { + trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set, typeReferenceDirectiveName, containingFile); + } + else { + trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_1_root_directory_2, typeReferenceDirectiveName, containingFile, rootDir); + } + } + } + var failedLookupLocations = []; + // Check primary library paths + if (rootDir !== undefined) { + var effectivePrimarySearchPaths = options.typesSearchPaths || defaultLibrarySearchPaths; + for (var _i = 0, effectivePrimarySearchPaths_1 = effectivePrimarySearchPaths; _i < effectivePrimarySearchPaths_1.length; _i++) { + var searchPath = effectivePrimarySearchPaths_1[_i]; + var primaryPath = ts.combinePaths(rootDir, searchPath); + if (traceEnabled) { + trace(host, ts.Diagnostics.Resolving_with_primary_search_path_0, primaryPath); + } + var candidate = ts.combinePaths(primaryPath, typeReferenceDirectiveName); + var candidateDirectory = ts.getDirectoryPath(candidate); + var resolvedFile_1 = loadNodeModuleFromDirectory(typeReferenceExtensions, candidate, failedLookupLocations, !directoryProbablyExists(candidateDirectory, host), moduleResolutionState); + if (resolvedFile_1) { + if (traceEnabled) { + trace(host, ts.Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2, typeReferenceDirectiveName, resolvedFile_1, true); + } + return { + resolvedTypeReferenceDirective: { primary: true, resolvedFileName: resolvedFile_1 }, + failedLookupLocations: failedLookupLocations + }; + } } - resolvedFileName = loadNodeModuleFromDirectory(ts.supportedJsExtensions, candidate, failedLookupLocations, host); - return resolvedFileName - ? { resolvedModule: { resolvedFileName: resolvedFileName }, failedLookupLocations: failedLookupLocations } - : { resolvedModule: undefined, failedLookupLocations: failedLookupLocations }; } else { - return loadModuleFromNodeModules(moduleName, containingDirectory, host); + if (traceEnabled) { + trace(host, ts.Diagnostics.Root_directory_cannot_be_determined_skipping_primary_search_paths); + } + } + var resolvedFile; + var initialLocationForSecondaryLookup; + if (containingFile) { + initialLocationForSecondaryLookup = ts.getDirectoryPath(containingFile); + } + else { + initialLocationForSecondaryLookup = rootDir; + } + if (initialLocationForSecondaryLookup !== undefined) { + // check secondary locations + if (traceEnabled) { + trace(host, ts.Diagnostics.Looking_up_in_node_modules_folder_initial_location_0, initialLocationForSecondaryLookup); + } + resolvedFile = loadModuleFromNodeModules(typeReferenceDirectiveName, initialLocationForSecondaryLookup, failedLookupLocations, moduleResolutionState); + if (traceEnabled) { + if (resolvedFile) { + trace(host, ts.Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2, typeReferenceDirectiveName, resolvedFile, false); + } + else { + trace(host, ts.Diagnostics.Type_reference_directive_0_was_not_resolved, typeReferenceDirectiveName); + } + } + } + else { + if (traceEnabled) { + trace(host, ts.Diagnostics.Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_modules_folder); + } + } + return { + resolvedTypeReferenceDirective: resolvedFile + ? { primary: false, resolvedFileName: resolvedFile } + : undefined, + failedLookupLocations: failedLookupLocations + }; + } + ts.resolveTypeReferenceDirective = resolveTypeReferenceDirective; + function resolveModuleName(moduleName, containingFile, compilerOptions, host) { + var traceEnabled = isTraceEnabled(compilerOptions, host); + if (traceEnabled) { + trace(host, ts.Diagnostics.Resolving_module_0_from_1, moduleName, containingFile); + } + var moduleResolution = compilerOptions.moduleResolution; + if (moduleResolution === undefined) { + moduleResolution = ts.getEmitModuleKind(compilerOptions) === ts.ModuleKind.CommonJS ? ts.ModuleResolutionKind.NodeJs : ts.ModuleResolutionKind.Classic; + if (traceEnabled) { + trace(host, ts.Diagnostics.Module_resolution_kind_is_not_specified_using_0, ts.ModuleResolutionKind[moduleResolution]); + } + } + else { + if (traceEnabled) { + trace(host, ts.Diagnostics.Explicitly_specified_module_resolution_kind_Colon_0, ts.ModuleResolutionKind[moduleResolution]); + } + } + var result; + switch (moduleResolution) { + case ts.ModuleResolutionKind.NodeJs: + result = nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host); + break; + case ts.ModuleResolutionKind.Classic: + result = classicNameResolver(moduleName, containingFile, compilerOptions, host); + break; + } + if (traceEnabled) { + if (result.resolvedModule) { + trace(host, ts.Diagnostics.Module_name_0_was_successfully_resolved_to_1, moduleName, result.resolvedModule.resolvedFileName); + } + else { + trace(host, ts.Diagnostics.Module_name_0_was_not_resolved, moduleName); + } + } + return result; + } + ts.resolveModuleName = resolveModuleName; + /** + * Any module resolution kind can be augmented with optional settings: 'baseUrl', 'paths' and 'rootDirs' - they are used to + * mitigate differences between design time structure of the project and its runtime counterpart so the same import name + * can be resolved successfully by TypeScript compiler and runtime module loader. + * If these settings are set then loading procedure will try to use them to resolve module name and it can of failure it will + * fallback to standard resolution routine. + * + * - baseUrl - this setting controls how non-relative module names are resolved. If this setting is specified then non-relative + * names will be resolved relative to baseUrl: i.e. if baseUrl is '/a/b' then candidate location to resolve module name 'c/d' will + * be '/a/b/c/d' + * - paths - this setting can only be used when baseUrl is specified. allows to tune how non-relative module names + * will be resolved based on the content of the module name. + * Structure of 'paths' compiler options + * 'paths': { + * pattern-1: [...substitutions], + * pattern-2: [...substitutions], + * ... + * pattern-n: [...substitutions] + * } + * Pattern here is a string that can contain zero or one '*' character. During module resolution module name will be matched against + * all patterns in the list. Matching for patterns that don't contain '*' means that module name must be equal to pattern respecting the case. + * If pattern contains '*' then to match pattern "*" module name must start with the and end with . + * denotes part of the module name between and . + * If module name can be matches with multiple patterns then pattern with the longest prefix will be picked. + * After selecting pattern we'll use list of substitutions to get candidate locations of the module and the try to load module + * from the candidate location. + * Substitution is a string that can contain zero or one '*'. To get candidate location from substitution we'll pick every + * substitution in the list and replace '*' with string. If candidate location is not rooted it + * will be converted to absolute using baseUrl. + * For example: + * baseUrl: /a/b/c + * "paths": { + * // match all module names + * "*": [ + * "*", // use matched name as is, + * // will be looked as /a/b/c/ + * + * "folder1/*" // substitution will convert matched name to 'folder1/', + * // since it is not rooted then final candidate location will be /a/b/c/folder1/ + * ], + * // match module names that start with 'components/' + * "components/*": [ "/root/components/*" ] // substitution will convert /components/folder1/ to '/root/components/folder1/', + * // it is rooted so it will be final candidate location + * } + * + * 'rootDirs' allows the project to be spreaded across multiple locations and resolve modules with relative names as if + * they were in the same location. For example lets say there are two files + * '/local/src/content/file1.ts' + * '/shared/components/contracts/src/content/protocols/file2.ts' + * After bundling content of '/shared/components/contracts/src' will be merged with '/local/src' so + * if file1 has the following import 'import {x} from "./protocols/file2"' it will be resolved successfully in runtime. + * 'rootDirs' provides the way to tell compiler that in order to get the whole project it should behave as if content of all + * root dirs were merged together. + * I.e. for the example above 'rootDirs' will have two entries: [ '/local/src', '/shared/components/contracts/src' ]. + * Compiler will first convert './protocols/file2' into absolute path relative to the location of containing file: + * '/local/src/content/protocols/file2' and try to load it - failure. + * Then it will search 'rootDirs' looking for a longest matching prefix of this absolute path and if such prefix is found - absolute path will + * be converted to a path relative to found rootDir entry './content/protocols/file2' (*). As a last step compiler will check all remaining + * entries in 'rootDirs', use them to build absolute path out of (*) and try to resolve module from this location. + */ + function tryLoadModuleUsingOptionalResolutionSettings(moduleName, containingDirectory, loader, failedLookupLocations, supportedExtensions, state) { + if (moduleHasNonRelativeName(moduleName)) { + return tryLoadModuleUsingBaseUrl(moduleName, loader, failedLookupLocations, supportedExtensions, state); + } + else { + return tryLoadModuleUsingRootDirs(moduleName, containingDirectory, loader, failedLookupLocations, supportedExtensions, state); } } + function tryLoadModuleUsingRootDirs(moduleName, containingDirectory, loader, failedLookupLocations, supportedExtensions, state) { + if (!state.compilerOptions.rootDirs) { + return undefined; + } + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0, moduleName); + } + var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); + var matchedRootDir; + var matchedNormalizedPrefix; + for (var _i = 0, _a = state.compilerOptions.rootDirs; _i < _a.length; _i++) { + var rootDir = _a[_i]; + // rootDirs are expected to be absolute + // in case of tsconfig.json this will happen automatically - compiler will expand relative names + // using location of tsconfig.json as base location + var normalizedRoot = ts.normalizePath(rootDir); + if (!ts.endsWith(normalizedRoot, ts.directorySeparator)) { + normalizedRoot += ts.directorySeparator; + } + var isLongestMatchingPrefix = ts.startsWith(candidate, normalizedRoot) && + (matchedNormalizedPrefix === undefined || matchedNormalizedPrefix.length < normalizedRoot.length); + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Checking_if_0_is_the_longest_matching_prefix_for_1_2, normalizedRoot, candidate, isLongestMatchingPrefix); + } + if (isLongestMatchingPrefix) { + matchedNormalizedPrefix = normalizedRoot; + matchedRootDir = rootDir; + } + } + if (matchedNormalizedPrefix) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Longest_matching_prefix_for_0_is_1, candidate, matchedNormalizedPrefix); + } + var suffix = candidate.substr(matchedNormalizedPrefix.length); + // first - try to load from a initial location + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Loading_0_from_the_root_dir_1_candidate_location_2, suffix, matchedNormalizedPrefix, candidate); + } + var resolvedFileName = loader(candidate, supportedExtensions, failedLookupLocations, !directoryProbablyExists(containingDirectory, state.host), state); + if (resolvedFileName) { + return resolvedFileName; + } + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Trying_other_entries_in_rootDirs); + } + // then try to resolve using remaining entries in rootDirs + for (var _b = 0, _c = state.compilerOptions.rootDirs; _b < _c.length; _b++) { + var rootDir = _c[_b]; + if (rootDir === matchedRootDir) { + // skip the initially matched entry + continue; + } + var candidate_1 = ts.combinePaths(ts.normalizePath(rootDir), suffix); + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Loading_0_from_the_root_dir_1_candidate_location_2, suffix, rootDir, candidate_1); + } + var baseDirectory = ts.getDirectoryPath(candidate_1); + var resolvedFileName_1 = loader(candidate_1, supportedExtensions, failedLookupLocations, !directoryProbablyExists(baseDirectory, state.host), state); + if (resolvedFileName_1) { + return resolvedFileName_1; + } + } + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Module_resolution_using_rootDirs_has_failed); + } + } + return undefined; + } + function tryLoadModuleUsingBaseUrl(moduleName, loader, failedLookupLocations, supportedExtensions, state) { + if (!state.compilerOptions.baseUrl) { + return undefined; + } + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1, state.compilerOptions.baseUrl, moduleName); + } + var longestMatchPrefixLength = -1; + var matchedPattern; + var matchedStar; + if (state.compilerOptions.paths) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.paths_option_is_specified_looking_for_a_pattern_to_match_module_name_0, moduleName); + } + for (var key in state.compilerOptions.paths) { + var pattern = key; + var indexOfStar = pattern.indexOf("*"); + if (indexOfStar !== -1) { + var prefix = pattern.substr(0, indexOfStar); + var suffix = pattern.substr(indexOfStar + 1); + if (moduleName.length >= prefix.length + suffix.length && + ts.startsWith(moduleName, prefix) && + ts.endsWith(moduleName, suffix)) { + // use length of prefix as betterness criteria + if (prefix.length > longestMatchPrefixLength) { + longestMatchPrefixLength = prefix.length; + matchedPattern = pattern; + matchedStar = moduleName.substr(prefix.length, moduleName.length - suffix.length); + } + } + } + else if (pattern === moduleName) { + // pattern was matched as is - no need to search further + matchedPattern = pattern; + matchedStar = undefined; + break; + } + } + } + if (matchedPattern) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Module_name_0_matched_pattern_1, moduleName, matchedPattern); + } + for (var _i = 0, _a = state.compilerOptions.paths[matchedPattern]; _i < _a.length; _i++) { + var subst = _a[_i]; + var path = matchedStar ? subst.replace("\*", matchedStar) : subst; + var candidate = ts.normalizePath(ts.combinePaths(state.compilerOptions.baseUrl, path)); + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Trying_substitution_0_candidate_module_location_Colon_1, subst, path); + } + var resolvedFileName = loader(candidate, supportedExtensions, failedLookupLocations, !directoryProbablyExists(ts.getDirectoryPath(candidate), state.host), state); + if (resolvedFileName) { + return resolvedFileName; + } + } + return undefined; + } + else { + var candidate = ts.normalizePath(ts.combinePaths(state.compilerOptions.baseUrl, moduleName)); + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Resolving_module_name_0_relative_to_base_url_1_2, moduleName, state.compilerOptions.baseUrl, candidate); + } + return loader(candidate, supportedExtensions, failedLookupLocations, !directoryProbablyExists(ts.getDirectoryPath(candidate), state.host), state); + } + } + function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host) { + var containingDirectory = ts.getDirectoryPath(containingFile); + var supportedExtensions = ts.getSupportedExtensions(compilerOptions); + var traceEnabled = isTraceEnabled(compilerOptions, host); + var failedLookupLocations = []; + var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled, skipTsx: false }; + var resolvedFileName = tryLoadModuleUsingOptionalResolutionSettings(moduleName, containingDirectory, nodeLoadModuleByRelativeName, failedLookupLocations, supportedExtensions, state); + var isExternalLibraryImport = false; + if (!resolvedFileName) { + if (moduleHasNonRelativeName(moduleName)) { + if (traceEnabled) { + trace(host, ts.Diagnostics.Loading_module_0_from_node_modules_folder, moduleName); + } + resolvedFileName = loadModuleFromNodeModules(moduleName, containingDirectory, failedLookupLocations, state); + isExternalLibraryImport = resolvedFileName !== undefined; + } + else { + var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); + resolvedFileName = nodeLoadModuleByRelativeName(candidate, supportedExtensions, failedLookupLocations, /*onlyRecordFailures*/ false, state); + } + } + if (resolvedFileName && host.realpath) { + var originalFileName = resolvedFileName; + resolvedFileName = ts.normalizePath(host.realpath(resolvedFileName)); + if (traceEnabled) { + trace(host, ts.Diagnostics.Resolving_real_path_for_0_result_1, originalFileName, resolvedFileName); + } + } + return createResolvedModule(resolvedFileName, isExternalLibraryImport, failedLookupLocations); + } ts.nodeModuleNameResolver = nodeModuleNameResolver; - function loadNodeModuleFromFile(extensions, candidate, failedLookupLocation, host) { + function nodeLoadModuleByRelativeName(candidate, supportedExtensions, failedLookupLocations, onlyRecordFailures, state) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Loading_module_as_file_Slash_folder_candidate_module_location_0, candidate); + } + var resolvedFileName = loadModuleFromFile(candidate, supportedExtensions, failedLookupLocations, onlyRecordFailures, state); + return resolvedFileName || loadNodeModuleFromDirectory(supportedExtensions, candidate, failedLookupLocations, onlyRecordFailures, state); + } + /* @internal */ + function directoryProbablyExists(directoryName, host) { + // if host does not support 'directoryExists' assume that directory will exist + return !host.directoryExists || host.directoryExists(directoryName); + } + ts.directoryProbablyExists = directoryProbablyExists; + /** + * @param {boolean} onlyRecordFailures - if true then function won't try to actually load files but instead record all attempts as failures. This flag is necessary + * in cases when we know upfront that all load attempts will fail (because containing folder does not exists) however we still need to record all failed lookup locations. + */ + function loadModuleFromFile(candidate, extensions, failedLookupLocation, onlyRecordFailures, state) { + if (!onlyRecordFailures) { + // check if containig folder exists - if it doesn't then just record failures for all supported extensions without disk probing + var directory = ts.getDirectoryPath(candidate); + if (directory) { + onlyRecordFailures = !directoryProbablyExists(directory, state.host); + } + } return ts.forEach(extensions, tryLoad); function tryLoad(ext) { + if (ext === ".tsx" && state.skipTsx) { + return undefined; + } var fileName = ts.fileExtensionIs(candidate, ext) ? candidate : candidate + ext; - if (host.fileExists(fileName)) { + if (!onlyRecordFailures && state.host.fileExists(fileName)) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.File_0_exist_use_it_as_a_name_resolution_result, fileName); + } return fileName; } else { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.File_0_does_not_exist, fileName); + } failedLookupLocation.push(fileName); return undefined; } } } - function loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocation, host) { + function loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocation, onlyRecordFailures, state) { var packageJsonPath = ts.combinePaths(candidate, "package.json"); - if (host.fileExists(packageJsonPath)) { - var jsonContent; - try { - var jsonText = host.readFile(packageJsonPath); - jsonContent = jsonText ? JSON.parse(jsonText) : { typings: undefined }; + var directoryExists = !onlyRecordFailures && directoryProbablyExists(candidate, state.host); + if (directoryExists && state.host.fileExists(packageJsonPath)) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Found_package_json_at_0, packageJsonPath); } - catch (e) { - // gracefully handle if readFile fails or returns not JSON - jsonContent = { typings: undefined }; - } - if (jsonContent.typings) { - var result = loadNodeModuleFromFile(extensions, ts.normalizePath(ts.combinePaths(candidate, jsonContent.typings)), failedLookupLocation, host); + var typesFile = tryReadTypesSection(packageJsonPath, candidate, state); + if (typesFile) { + var result = loadModuleFromFile(typesFile, extensions, failedLookupLocation, !directoryProbablyExists(ts.getDirectoryPath(typesFile), state.host), state); if (result) { return result; } } + else { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.package_json_does_not_have_types_field); + } + } } else { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.File_0_does_not_exist, packageJsonPath); + } // record package json as one of failed lookup locations - in the future if this file will appear it will invalidate resolution results failedLookupLocation.push(packageJsonPath); } - return loadNodeModuleFromFile(extensions, ts.combinePaths(candidate, "index"), failedLookupLocation, host); + return loadModuleFromFile(ts.combinePaths(candidate, "index"), extensions, failedLookupLocation, !directoryExists, state); } - function loadModuleFromNodeModules(moduleName, directory, host) { - var failedLookupLocations = []; + function loadModuleFromNodeModulesFolder(moduleName, directory, failedLookupLocations, state) { + var nodeModulesFolder = ts.combinePaths(directory, "node_modules"); + var nodeModulesFolderExists = directoryProbablyExists(nodeModulesFolder, state.host); + var candidate = ts.normalizePath(ts.combinePaths(nodeModulesFolder, moduleName)); + // Load only typescript files irrespective of allowJs option if loading from node modules + var result = loadModuleFromFile(candidate, ts.supportedTypeScriptExtensions, failedLookupLocations, !nodeModulesFolderExists, state); + if (result) { + return result; + } + result = loadNodeModuleFromDirectory(ts.supportedTypeScriptExtensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state); + if (result) { + return result; + } + } + function loadModuleFromNodeModules(moduleName, directory, failedLookupLocations, state) { directory = ts.normalizeSlashes(directory); while (true) { var baseName = ts.getBaseFileName(directory); if (baseName !== "node_modules") { - var nodeModulesFolder = ts.combinePaths(directory, "node_modules"); - var candidate = ts.normalizePath(ts.combinePaths(nodeModulesFolder, moduleName)); - var result = loadNodeModuleFromFile(ts.supportedExtensions, candidate, failedLookupLocations, host); + var result = + // first: try to load module as-is + loadModuleFromNodeModulesFolder(moduleName, directory, failedLookupLocations, state) || + // second: try to load module from the scope '@types' + loadModuleFromNodeModulesFolder(ts.combinePaths("@types", moduleName), directory, failedLookupLocations, state); if (result) { - return { resolvedModule: { resolvedFileName: result, isExternalLibraryImport: true }, failedLookupLocations: failedLookupLocations }; - } - result = loadNodeModuleFromDirectory(ts.supportedExtensions, candidate, failedLookupLocations, host); - if (result) { - return { resolvedModule: { resolvedFileName: result, isExternalLibraryImport: true }, failedLookupLocations: failedLookupLocations }; + return result; } } var parentPath = ts.getDirectoryPath(directory); @@ -37421,46 +42101,36 @@ var ts; } directory = parentPath; } - return { resolvedModule: undefined, failedLookupLocations: failedLookupLocations }; - } - function nameStartsWithDotSlashOrDotDotSlash(name) { - var i = name.lastIndexOf("./", 1); - return i === 0 || (i === 1 && name.charCodeAt(0) === 46 /* dot */); + return undefined; } function classicNameResolver(moduleName, containingFile, compilerOptions, host) { - // module names that contain '!' are used to reference resources and are not resolved to actual files on disk - if (moduleName.indexOf("!") != -1) { - return { resolvedModule: undefined, failedLookupLocations: [] }; - } - var searchPath = ts.getDirectoryPath(containingFile); - var searchName; + var traceEnabled = isTraceEnabled(compilerOptions, host); + var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled, skipTsx: !compilerOptions.jsx }; var failedLookupLocations = []; + var supportedExtensions = ts.getSupportedExtensions(compilerOptions); + var containingDirectory = ts.getDirectoryPath(containingFile); + var resolvedFileName = tryLoadModuleUsingOptionalResolutionSettings(moduleName, containingDirectory, loadModuleFromFile, failedLookupLocations, supportedExtensions, state); + if (resolvedFileName) { + return createResolvedModule(resolvedFileName, /*isExternalLibraryImport*/ false, failedLookupLocations); + } var referencedSourceFile; - var extensions = compilerOptions.allowNonTsExtensions ? ts.supportedJsExtensions : ts.supportedExtensions; - while (true) { - searchName = ts.normalizePath(ts.combinePaths(searchPath, moduleName)); - referencedSourceFile = ts.forEach(extensions, function (extension) { - if (extension === ".tsx" && !compilerOptions.jsx) { - // resolve .tsx files only if jsx support is enabled - // 'logical not' handles both undefined and None cases - return undefined; + if (moduleHasNonRelativeName(moduleName)) { + while (true) { + var searchName = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); + referencedSourceFile = loadModuleFromFile(searchName, supportedExtensions, failedLookupLocations, /*onlyRecordFailures*/ false, state); + if (referencedSourceFile) { + break; } - var candidate = searchName + extension; - if (host.fileExists(candidate)) { - return candidate; + var parentPath = ts.getDirectoryPath(containingDirectory); + if (parentPath === containingDirectory) { + break; } - else { - failedLookupLocations.push(candidate); - } - }); - if (referencedSourceFile) { - break; + containingDirectory = parentPath; } - var parentPath = ts.getDirectoryPath(searchPath); - if (parentPath === searchPath) { - break; - } - searchPath = parentPath; + } + else { + var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); + referencedSourceFile = loadModuleFromFile(candidate, supportedExtensions, failedLookupLocations, /*onlyRecordFailures*/ false, state); } return referencedSourceFile ? { resolvedModule: { resolvedFileName: referencedSourceFile }, failedLookupLocations: failedLookupLocations } @@ -37469,7 +42139,7 @@ var ts; ts.classicNameResolver = classicNameResolver; /* @internal */ ts.defaultInitCompilerOptions = { - module: 1 /* CommonJS */, + module: ts.ModuleKind.CommonJS, target: 1 /* ES5 */, noImplicitAny: false, sourceMap: false @@ -37517,11 +42187,40 @@ var ts; ts.sys.createDirectory(directoryPath); } } + var outputFingerprints; + function writeFileIfUpdated(fileName, data, writeByteOrderMark) { + if (!outputFingerprints) { + outputFingerprints = {}; + } + var hash = ts.sys.createHash(data); + var mtimeBefore = ts.sys.getModifiedTime(fileName); + if (mtimeBefore && ts.hasProperty(outputFingerprints, fileName)) { + var fingerprint = outputFingerprints[fileName]; + // If output has not been changed, and the file has no external modification + if (fingerprint.byteOrderMark === writeByteOrderMark && + fingerprint.hash === hash && + fingerprint.mtime.getTime() === mtimeBefore.getTime()) { + return; + } + } + ts.sys.writeFile(fileName, data, writeByteOrderMark); + var mtimeAfter = ts.sys.getModifiedTime(fileName); + outputFingerprints[fileName] = { + hash: hash, + byteOrderMark: writeByteOrderMark, + mtime: mtimeAfter + }; + } function writeFile(fileName, data, writeByteOrderMark, onError) { try { var start = new Date().getTime(); ensureDirectoriesExist(ts.getDirectoryPath(ts.normalizePath(fileName))); - ts.sys.writeFile(fileName, data, writeByteOrderMark); + if (ts.isWatchSet(options) && ts.sys.createHash && ts.sys.getModifiedTime) { + writeFileIfUpdated(fileName, data, writeByteOrderMark); + } + else { + ts.sys.writeFile(fileName, data, writeByteOrderMark); + } ts.ioWriteTime += new Date().getTime() - start; } catch (e) { @@ -37530,24 +42229,32 @@ var ts; } } } + function getDefaultLibLocation() { + return ts.getDirectoryPath(ts.normalizePath(ts.sys.getExecutingFilePath())); + } var newLine = ts.getNewLineCharacter(options); + var realpath = ts.sys.realpath && (function (path) { return ts.sys.realpath(path); }); return { getSourceFile: getSourceFile, - getDefaultLibFileName: function (options) { return ts.combinePaths(ts.getDirectoryPath(ts.normalizePath(ts.sys.getExecutingFilePath())), ts.getDefaultLibFileName(options)); }, + getDefaultLibLocation: getDefaultLibLocation, + getDefaultLibFileName: function (options) { return ts.combinePaths(getDefaultLibLocation(), ts.getDefaultLibFileName(options)); }, writeFile: writeFile, getCurrentDirectory: ts.memoize(function () { return ts.sys.getCurrentDirectory(); }), useCaseSensitiveFileNames: function () { return ts.sys.useCaseSensitiveFileNames; }, getCanonicalFileName: getCanonicalFileName, getNewLine: function () { return newLine; }, fileExists: function (fileName) { return ts.sys.fileExists(fileName); }, - readFile: function (fileName) { return ts.sys.readFile(fileName); } + readFile: function (fileName) { return ts.sys.readFile(fileName); }, + trace: function (s) { return ts.sys.write(s + newLine); }, + directoryExists: function (directoryName) { return ts.sys.directoryExists(directoryName); }, + realpath: realpath }; } ts.createCompilerHost = createCompilerHost; function getPreEmitDiagnostics(program, sourceFile, cancellationToken) { var diagnostics = program.getOptionsDiagnostics(cancellationToken).concat(program.getSyntacticDiagnostics(sourceFile, cancellationToken), program.getGlobalDiagnostics(cancellationToken), program.getSemanticDiagnostics(sourceFile, cancellationToken)); if (program.getCompilerOptions().declaration) { - diagnostics.concat(program.getDeclarationDiagnostics(sourceFile, cancellationToken)); + diagnostics = diagnostics.concat(program.getDeclarationDiagnostics(sourceFile, cancellationToken)); } return ts.sortAndDeduplicateDiagnostics(diagnostics); } @@ -37575,55 +42282,96 @@ var ts; } } ts.flattenDiagnosticMessageText = flattenDiagnosticMessageText; + function loadWithLocalCache(names, containingFile, loader) { + if (names.length === 0) { + return []; + } + var resolutions = []; + var cache = {}; + for (var _i = 0, names_1 = names; _i < names_1.length; _i++) { + var name_33 = names_1[_i]; + var result = void 0; + if (ts.hasProperty(cache, name_33)) { + result = cache[name_33]; + } + else { + result = loader(name_33, containingFile); + cache[name_33] = result; + } + resolutions.push(result); + } + return resolutions; + } function createProgram(rootNames, options, host, oldProgram) { var program; var files = []; - var fileProcessingDiagnostics = ts.createDiagnosticCollection(); - var programDiagnostics = ts.createDiagnosticCollection(); var commonSourceDirectory; var diagnosticsProducingTypeChecker; var noDiagnosticsTypeChecker; var classifiableNames; - var skipDefaultLib = options.noLib; + var resolvedTypeReferenceDirectives = {}; + var fileProcessingDiagnostics = ts.createDiagnosticCollection(); var start = new Date().getTime(); host = host || createCompilerHost(options); + var skipDefaultLib = options.noLib; + var programDiagnostics = ts.createDiagnosticCollection(); var currentDirectory = host.getCurrentDirectory(); - var resolveModuleNamesWorker = host.resolveModuleNames - ? (function (moduleNames, containingFile) { return host.resolveModuleNames(moduleNames, containingFile); }) - : (function (moduleNames, containingFile) { return ts.map(moduleNames, function (moduleName) { return resolveModuleName(moduleName, containingFile, options, host).resolvedModule; }); }); + var supportedExtensions = ts.getSupportedExtensions(options); + // Map storing if there is emit blocking diagnostics for given input + var hasEmitBlockingDiagnostics = ts.createFileMap(getCanonicalFileName); + var resolveModuleNamesWorker; + if (host.resolveModuleNames) { + resolveModuleNamesWorker = function (moduleNames, containingFile) { return host.resolveModuleNames(moduleNames, containingFile); }; + } + else { + var loader_1 = function (moduleName, containingFile) { return resolveModuleName(moduleName, containingFile, options, host).resolvedModule; }; + resolveModuleNamesWorker = function (moduleNames, containingFile) { return loadWithLocalCache(moduleNames, containingFile, loader_1); }; + } + var resolveTypeReferenceDirectiveNamesWorker; + if (host.resolveTypeReferenceDirectives) { + resolveTypeReferenceDirectiveNamesWorker = function (typeDirectiveNames, containingFile) { return host.resolveTypeReferenceDirectives(typeDirectiveNames, containingFile); }; + } + else { + var loader_2 = function (typesRef, containingFile) { return resolveTypeReferenceDirective(typesRef, containingFile, options, host).resolvedTypeReferenceDirective; }; + resolveTypeReferenceDirectiveNamesWorker = function (typeReferenceDirectiveNames, containingFile) { return loadWithLocalCache(typeReferenceDirectiveNames, containingFile, loader_2); }; + } var filesByName = ts.createFileMap(); // stores 'filename -> file association' ignoring case - // used to track cases when two file names differ only in casing + // used to track cases when two file names differ only in casing var filesByNameIgnoreCase = host.useCaseSensitiveFileNames() ? ts.createFileMap(function (fileName) { return fileName.toLowerCase(); }) : undefined; - if (oldProgram) { - // check properties that can affect structure of the program or module resolution strategy - // if any of these properties has changed - structure cannot be reused - var oldOptions = oldProgram.getCompilerOptions(); - if ((oldOptions.module !== options.module) || - (oldOptions.noResolve !== options.noResolve) || - (oldOptions.target !== options.target) || - (oldOptions.noLib !== options.noLib) || - (oldOptions.jsx !== options.jsx)) { - oldProgram = undefined; - } - } if (!tryReuseStructureFromOldProgram()) { - ts.forEach(rootNames, function (name) { return processRootFile(name, false); }); + // load type declarations specified via 'types' argument + if (options.types && options.types.length) { + var resolutions = resolveTypeReferenceDirectiveNamesWorker(options.types, /*containingFile*/ undefined); + for (var i = 0; i < options.types.length; i++) { + processTypeReferenceDirective(options.types[i], resolutions[i]); + } + } + ts.forEach(rootNames, function (name) { return processRootFile(name, /*isDefaultLib*/ false); }); // Do not process the default library if: // - The '--noLib' flag is used. // - A 'no-default-lib' reference comment is encountered in // processing the root files. if (!skipDefaultLib) { - processRootFile(host.getDefaultLibFileName(options), true); + // If '--lib' is not specified, include default library file according to '--target' + // otherwise, using options specified in '--lib' instead of '--target' default library file + if (!options.lib) { + processRootFile(host.getDefaultLibFileName(options), /*isDefaultLib*/ true); + } + else { + var libDirectory_1 = host.getDefaultLibLocation ? host.getDefaultLibLocation() : ts.getDirectoryPath(host.getDefaultLibFileName(options)); + ts.forEach(options.lib, function (libFileName) { + processRootFile(ts.combinePaths(libDirectory_1, libFileName), /*isDefaultLib*/ true); + }); + } } } - verifyCompilerOptions(); // unconditionally set oldProgram to undefined to prevent it from being captured in closure oldProgram = undefined; - ts.programTime += new Date().getTime() - start; program = { getRootFileNames: function () { return rootNames; }, getSourceFile: getSourceFile, + getSourceFileByPath: getSourceFileByPath, getSourceFiles: function () { return files; }, getCompilerOptions: function () { return options; }, getSyntacticDiagnostics: getSyntacticDiagnostics, @@ -37634,16 +42382,37 @@ var ts; getTypeChecker: getTypeChecker, getClassifiableNames: getClassifiableNames, getDiagnosticsProducingTypeChecker: getDiagnosticsProducingTypeChecker, - getCommonSourceDirectory: function () { return commonSourceDirectory; }, + getCommonSourceDirectory: getCommonSourceDirectory, emit: emit, getCurrentDirectory: function () { return currentDirectory; }, getNodeCount: function () { return getDiagnosticsProducingTypeChecker().getNodeCount(); }, getIdentifierCount: function () { return getDiagnosticsProducingTypeChecker().getIdentifierCount(); }, getSymbolCount: function () { return getDiagnosticsProducingTypeChecker().getSymbolCount(); }, getTypeCount: function () { return getDiagnosticsProducingTypeChecker().getTypeCount(); }, - getFileProcessingDiagnostics: function () { return fileProcessingDiagnostics; } + getFileProcessingDiagnostics: function () { return fileProcessingDiagnostics; }, + getResolvedTypeReferenceDirectives: function () { return resolvedTypeReferenceDirectives; } }; + verifyCompilerOptions(); + ts.programTime += new Date().getTime() - start; return program; + function getCommonSourceDirectory() { + if (typeof commonSourceDirectory === "undefined") { + if (options.rootDir && checkSourceFilesBelongToPath(files, options.rootDir)) { + // If a rootDir is specified and is valid use it as the commonSourceDirectory + commonSourceDirectory = ts.getNormalizedAbsolutePath(options.rootDir, currentDirectory); + } + else { + commonSourceDirectory = computeCommonSourceDirectory(files); + } + if (commonSourceDirectory && commonSourceDirectory[commonSourceDirectory.length - 1] !== ts.directorySeparator) { + // Make sure directory path ends with directory separator so this string can directly + // used to replace with "" to get the relative path of the source file and the relative path doesn't + // start with / making it rooted path + commonSourceDirectory += ts.directorySeparator; + } + } + return commonSourceDirectory; + } function getClassifiableNames() { if (!classifiableNames) { // Initialize a checker so that all our files are bound. @@ -37660,19 +42429,42 @@ var ts; if (!oldProgram) { return false; } + // check properties that can affect structure of the program or module resolution strategy + // if any of these properties has changed - structure cannot be reused + var oldOptions = oldProgram.getCompilerOptions(); + if ((oldOptions.module !== options.module) || + (oldOptions.noResolve !== options.noResolve) || + (oldOptions.target !== options.target) || + (oldOptions.noLib !== options.noLib) || + (oldOptions.jsx !== options.jsx) || + (oldOptions.allowJs !== options.allowJs) || + (oldOptions.rootDir !== options.rootDir) || + (oldOptions.typesSearchPaths !== options.typesSearchPaths) || + (oldOptions.configFilePath !== options.configFilePath) || + (oldOptions.baseUrl !== options.baseUrl) || + (oldOptions.typesRoot !== options.typesRoot) || + !ts.arrayIsEqualTo(oldOptions.rootDirs, options.rootDirs) || + !ts.mapIsEqualTo(oldOptions.paths, options.paths)) { + return false; + } ts.Debug.assert(!oldProgram.structureIsReused); // there is an old program, check if we can reuse its structure var oldRootNames = oldProgram.getRootFileNames(); if (!ts.arrayIsEqualTo(oldRootNames, rootNames)) { return false; } + if (!ts.arrayIsEqualTo(options.types, oldOptions.types)) { + return false; + } // check if program source files has changed in the way that can affect structure of the program var newSourceFiles = []; var filePaths = []; var modifiedSourceFiles = []; for (var _i = 0, _a = oldProgram.getSourceFiles(); _i < _a.length; _i++) { var oldSourceFile = _a[_i]; - var newSourceFile = host.getSourceFile(oldSourceFile.fileName, options.target); + var newSourceFile = host.getSourceFileByPath + ? host.getSourceFileByPath(oldSourceFile.fileName, oldSourceFile.path, options.target) + : host.getSourceFile(oldSourceFile.fileName, options.target); if (!newSourceFile) { return false; } @@ -37689,31 +42481,42 @@ var ts; // tripleslash references has changed return false; } - // check imports + // check imports and module augmentations collectExternalModuleReferences(newSourceFile); if (!ts.arrayIsEqualTo(oldSourceFile.imports, newSourceFile.imports, moduleNameIsEqualTo)) { // imports has changed return false; } + if (!ts.arrayIsEqualTo(oldSourceFile.moduleAugmentations, newSourceFile.moduleAugmentations, moduleNameIsEqualTo)) { + // moduleAugmentations has changed + return false; + } + if (!ts.arrayIsEqualTo(oldSourceFile.typeReferenceDirectives, newSourceFile.typeReferenceDirectives, fileReferenceIsEqualTo)) { + // 'types' references has changed + return false; + } + var newSourceFilePath = ts.getNormalizedAbsolutePath(newSourceFile.fileName, currentDirectory); if (resolveModuleNamesWorker) { - var moduleNames = ts.map(newSourceFile.imports, function (name) { return name.text; }); - var resolutions = resolveModuleNamesWorker(moduleNames, ts.getNormalizedAbsolutePath(newSourceFile.fileName, currentDirectory)); + var moduleNames = ts.map(ts.concatenate(newSourceFile.imports, newSourceFile.moduleAugmentations), getTextOfLiteral); + var resolutions = resolveModuleNamesWorker(moduleNames, newSourceFilePath); // ensure that module resolution results are still correct - for (var i = 0; i < moduleNames.length; ++i) { - var newResolution = resolutions[i]; - var oldResolution = ts.getResolvedModule(oldSourceFile, moduleNames[i]); - var resolutionChanged = oldResolution - ? !newResolution || - oldResolution.resolvedFileName !== newResolution.resolvedFileName || - !!oldResolution.isExternalLibraryImport !== !!newResolution.isExternalLibraryImport - : newResolution; - if (resolutionChanged) { - return false; - } + var resolutionsChanged = ts.hasChangesInResolutions(moduleNames, resolutions, oldSourceFile.resolvedModules, ts.moduleResolutionIsEqualTo); + if (resolutionsChanged) { + return false; } } - // pass the cache of module resolutions from the old source file + if (resolveTypeReferenceDirectiveNamesWorker) { + var typesReferenceDirectives = ts.map(newSourceFile.typeReferenceDirectives, function (x) { return x.fileName; }); + var resolutions = resolveTypeReferenceDirectiveNamesWorker(typesReferenceDirectives, newSourceFilePath); + // ensure that types resolutions are still correct + var resolutionsChanged = ts.hasChangesInResolutions(typesReferenceDirectives, resolutions, oldSourceFile.resolvedTypeReferenceDirectiveNames, ts.typeDirectiveIsEqualTo); + if (resolutionsChanged) { + return false; + } + } + // pass the cache of module/types resolutions from the old source file newSourceFile.resolvedModules = oldSourceFile.resolvedModules; + newSourceFile.resolvedTypeReferenceDirectiveNames = oldSourceFile.resolvedTypeReferenceDirectiveNames; modifiedSourceFiles.push(newSourceFile); } else { @@ -37724,7 +42527,7 @@ var ts; newSourceFiles.push(newSourceFile); } // update fileName -> file mapping - for (var i = 0, len = newSourceFiles.length; i < len; ++i) { + for (var i = 0, len = newSourceFiles.length; i < len; i++) { filesByName.set(filePaths[i], newSourceFiles[i]); } files = newSourceFiles; @@ -37733,6 +42536,7 @@ var ts; var modifiedFile = modifiedSourceFiles_1[_b]; fileProcessingDiagnostics.reattachFileDiagnostics(modifiedFile); } + resolvedTypeReferenceDirectives = oldProgram.getResolvedTypeReferenceDirectives(); oldProgram.structureIsReused = true; return true; } @@ -37744,8 +42548,10 @@ var ts; getCurrentDirectory: function () { return currentDirectory; }, getNewLine: function () { return host.getNewLine(); }, getSourceFile: program.getSourceFile, + getSourceFileByPath: program.getSourceFileByPath, getSourceFiles: program.getSourceFiles, - writeFile: writeFileCallback || (function (fileName, data, writeByteOrderMark, onError) { return host.writeFile(fileName, data, writeByteOrderMark, onError); }) + writeFile: writeFileCallback || (function (fileName, data, writeByteOrderMark, onError, sourceFiles) { return host.writeFile(fileName, data, writeByteOrderMark, onError, sourceFiles); }), + isEmitBlocked: isEmitBlocked }; } function getDiagnosticsProducingTypeChecker() { @@ -37758,12 +42564,30 @@ var ts; var _this = this; return runWithCancellationToken(function () { return emitWorker(_this, sourceFile, writeFileCallback, cancellationToken); }); } + function isEmitBlocked(emitFileName) { + return hasEmitBlockingDiagnostics.contains(ts.toPath(emitFileName, currentDirectory, getCanonicalFileName)); + } function emitWorker(program, sourceFile, writeFileCallback, cancellationToken) { + var declarationDiagnostics = []; + if (options.noEmit) { + return { diagnostics: declarationDiagnostics, sourceMaps: undefined, emittedFiles: undefined, emitSkipped: true }; + } // If the noEmitOnError flag is set, then check if we have any errors so far. If so, // immediately bail out. Note that we pass 'undefined' for 'sourceFile' so that we // get any preEmit diagnostics, not just the ones - if (options.noEmitOnError && getPreEmitDiagnostics(program, /*sourceFile:*/ undefined, cancellationToken).length > 0) { - return { diagnostics: [], sourceMaps: undefined, emitSkipped: true }; + if (options.noEmitOnError) { + var diagnostics = program.getOptionsDiagnostics(cancellationToken).concat(program.getSyntacticDiagnostics(sourceFile, cancellationToken), program.getGlobalDiagnostics(cancellationToken), program.getSemanticDiagnostics(sourceFile, cancellationToken)); + if (diagnostics.length === 0 && program.getCompilerOptions().declaration) { + declarationDiagnostics = program.getDeclarationDiagnostics(/*sourceFile*/ undefined, cancellationToken); + } + if (diagnostics.length > 0 || declarationDiagnostics.length > 0) { + return { + diagnostics: ts.concatenate(diagnostics, declarationDiagnostics), + sourceMaps: undefined, + emittedFiles: undefined, + emitSkipped: true + }; + } } // Create the emit resolver outside of the "emitTime" tracking code below. That way // any cost associated with it (like type checking) are appropriate associated with @@ -37780,7 +42604,10 @@ var ts; return emitResult; } function getSourceFile(fileName) { - return filesByName.get(ts.toPath(fileName, currentDirectory, getCanonicalFileName)); + return getSourceFileByPath(ts.toPath(fileName, currentDirectory, getCanonicalFileName)); + } + function getSourceFileByPath(path) { + return filesByName.get(path); } function getDiagnosticsHelper(sourceFile, getDiagnostics, cancellationToken) { if (sourceFile) { @@ -37802,7 +42629,14 @@ var ts; return getDiagnosticsHelper(sourceFile, getSemanticDiagnosticsForFile, cancellationToken); } function getDeclarationDiagnostics(sourceFile, cancellationToken) { - return getDiagnosticsHelper(sourceFile, getDeclarationDiagnosticsForFile, cancellationToken); + var options = program.getCompilerOptions(); + // collect diagnostics from the program only once if either no source file was specified or out/outFile is set (bundled emit) + if (!sourceFile || options.out || options.outFile) { + return getDeclarationDiagnosticsWorker(sourceFile, cancellationToken); + } + else { + return getDiagnosticsHelper(sourceFile, getDeclarationDiagnosticsForFile, cancellationToken); + } } function getSyntacticDiagnosticsForFile(sourceFile, cancellationToken) { return sourceFile.parseDiagnostics; @@ -37816,7 +42650,7 @@ var ts; // We were canceled while performing the operation. Because our type checker // might be a bad state, we need to throw it away. // - // Note: we are overly agressive here. We do not actually *have* to throw away + // Note: we are overly aggressive here. We do not actually *have* to throw away // the "noDiagnosticsTypeChecker". However, for simplicity, i'd like to keep // the lifetimes of these two TypeCheckers the same. Also, we generally only // cancel when the user has made a change anyways. And, in that case, we (the @@ -37833,22 +42667,181 @@ var ts; var typeChecker = getDiagnosticsProducingTypeChecker(); ts.Debug.assert(!!sourceFile.bindDiagnostics); var bindDiagnostics = sourceFile.bindDiagnostics; - var checkDiagnostics = typeChecker.getDiagnostics(sourceFile, cancellationToken); + // For JavaScript files, we don't want to report the normal typescript semantic errors. + // Instead, we just report errors for using TypeScript-only constructs from within a + // JavaScript file. + var checkDiagnostics = ts.isSourceFileJavaScript(sourceFile) ? + getJavaScriptSemanticDiagnosticsForFile(sourceFile, cancellationToken) : + typeChecker.getDiagnostics(sourceFile, cancellationToken); var fileProcessingDiagnosticsInFile = fileProcessingDiagnostics.getDiagnostics(sourceFile.fileName); var programDiagnosticsInFile = programDiagnostics.getDiagnostics(sourceFile.fileName); return bindDiagnostics.concat(checkDiagnostics).concat(fileProcessingDiagnosticsInFile).concat(programDiagnosticsInFile); }); } - function getDeclarationDiagnosticsForFile(sourceFile, cancellationToken) { + function getJavaScriptSemanticDiagnosticsForFile(sourceFile, cancellationToken) { return runWithCancellationToken(function () { - if (!ts.isDeclarationFile(sourceFile)) { - var resolver = getDiagnosticsProducingTypeChecker().getEmitResolver(sourceFile, cancellationToken); - // Don't actually write any files since we're just getting diagnostics. - var writeFile_1 = function () { }; - return ts.getDeclarationDiagnostics(getEmitHost(writeFile_1), resolver, sourceFile); + var diagnostics = []; + walk(sourceFile); + return diagnostics; + function walk(node) { + if (!node) { + return false; + } + switch (node.kind) { + case 229 /* ImportEqualsDeclaration */: + diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_a_ts_file)); + return true; + case 235 /* ExportAssignment */: + if (node.isExportEquals) { + diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.export_can_only_be_used_in_a_ts_file)); + return true; + } + break; + case 221 /* ClassDeclaration */: + var classDeclaration = node; + if (checkModifiers(classDeclaration.modifiers) || + checkTypeParameters(classDeclaration.typeParameters)) { + return true; + } + break; + case 251 /* HeritageClause */: + var heritageClause = node; + if (heritageClause.token === 106 /* ImplementsKeyword */) { + diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_a_ts_file)); + return true; + } + break; + case 222 /* InterfaceDeclaration */: + diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.interface_declarations_can_only_be_used_in_a_ts_file)); + return true; + case 225 /* ModuleDeclaration */: + diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.module_declarations_can_only_be_used_in_a_ts_file)); + return true; + case 223 /* TypeAliasDeclaration */: + diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.type_aliases_can_only_be_used_in_a_ts_file)); + return true; + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: + case 148 /* Constructor */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: + case 179 /* FunctionExpression */: + case 220 /* FunctionDeclaration */: + case 180 /* ArrowFunction */: + case 220 /* FunctionDeclaration */: + var functionDeclaration = node; + if (checkModifiers(functionDeclaration.modifiers) || + checkTypeParameters(functionDeclaration.typeParameters) || + checkTypeAnnotation(functionDeclaration.type)) { + return true; + } + break; + case 200 /* VariableStatement */: + var variableStatement = node; + if (checkModifiers(variableStatement.modifiers)) { + return true; + } + break; + case 218 /* VariableDeclaration */: + var variableDeclaration = node; + if (checkTypeAnnotation(variableDeclaration.type)) { + return true; + } + break; + case 174 /* CallExpression */: + case 175 /* NewExpression */: + var expression = node; + if (expression.typeArguments && expression.typeArguments.length > 0) { + var start_2 = expression.typeArguments.pos; + diagnostics.push(ts.createFileDiagnostic(sourceFile, start_2, expression.typeArguments.end - start_2, ts.Diagnostics.type_arguments_can_only_be_used_in_a_ts_file)); + return true; + } + break; + case 142 /* Parameter */: + var parameter = node; + if (parameter.modifiers) { + var start_3 = parameter.modifiers.pos; + diagnostics.push(ts.createFileDiagnostic(sourceFile, start_3, parameter.modifiers.end - start_3, ts.Diagnostics.parameter_modifiers_can_only_be_used_in_a_ts_file)); + return true; + } + if (parameter.questionToken) { + diagnostics.push(ts.createDiagnosticForNode(parameter.questionToken, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, "?")); + return true; + } + if (parameter.type) { + diagnostics.push(ts.createDiagnosticForNode(parameter.type, ts.Diagnostics.types_can_only_be_used_in_a_ts_file)); + return true; + } + break; + case 145 /* PropertyDeclaration */: + diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.property_declarations_can_only_be_used_in_a_ts_file)); + return true; + case 224 /* EnumDeclaration */: + diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.enum_declarations_can_only_be_used_in_a_ts_file)); + return true; + case 177 /* TypeAssertionExpression */: + var typeAssertionExpression = node; + diagnostics.push(ts.createDiagnosticForNode(typeAssertionExpression.type, ts.Diagnostics.type_assertion_expressions_can_only_be_used_in_a_ts_file)); + return true; + case 143 /* Decorator */: + if (!options.experimentalDecorators) { + diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning)); + } + return true; + } + return ts.forEachChild(node, walk); + } + function checkTypeParameters(typeParameters) { + if (typeParameters) { + var start_4 = typeParameters.pos; + diagnostics.push(ts.createFileDiagnostic(sourceFile, start_4, typeParameters.end - start_4, ts.Diagnostics.type_parameter_declarations_can_only_be_used_in_a_ts_file)); + return true; + } + return false; + } + function checkTypeAnnotation(type) { + if (type) { + diagnostics.push(ts.createDiagnosticForNode(type, ts.Diagnostics.types_can_only_be_used_in_a_ts_file)); + return true; + } + return false; + } + function checkModifiers(modifiers) { + if (modifiers) { + for (var _i = 0, modifiers_1 = modifiers; _i < modifiers_1.length; _i++) { + var modifier = modifiers_1[_i]; + switch (modifier.kind) { + case 112 /* PublicKeyword */: + case 110 /* PrivateKeyword */: + case 111 /* ProtectedKeyword */: + case 128 /* ReadonlyKeyword */: + case 122 /* DeclareKeyword */: + diagnostics.push(ts.createDiagnosticForNode(modifier, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, ts.tokenToString(modifier.kind))); + return true; + // These are all legal modifiers. + case 113 /* StaticKeyword */: + case 82 /* ExportKeyword */: + case 74 /* ConstKeyword */: + case 77 /* DefaultKeyword */: + case 115 /* AbstractKeyword */: + } + } + } + return false; } }); } + function getDeclarationDiagnosticsWorker(sourceFile, cancellationToken) { + return runWithCancellationToken(function () { + var resolver = getDiagnosticsProducingTypeChecker().getEmitResolver(sourceFile, cancellationToken); + // Don't actually write any files since we're just getting diagnostics. + var writeFile = function () { }; + return ts.getDeclarationDiagnostics(getEmitHost(writeFile), resolver, sourceFile); + }); + } + function getDeclarationDiagnosticsForFile(sourceFile, cancellationToken) { + return ts.isDeclarationFile(sourceFile) ? [] : getDeclarationDiagnosticsWorker(sourceFile, cancellationToken); + } function getOptionsDiagnostics() { var allDiagnostics = []; ts.addRange(allDiagnostics, fileProcessingDiagnostics.getGlobalDiagnostics()); @@ -37864,7 +42857,7 @@ var ts; return ts.getBaseFileName(fileName).indexOf(".") >= 0; } function processRootFile(fileName, isDefaultLib) { - processSourceFile(ts.normalizePath(fileName), isDefaultLib); + processSourceFile(ts.normalizePath(fileName), isDefaultLib, /*isReference*/ true); } function fileReferenceIsEqualTo(a, b) { return a.fileName === b.fileName; @@ -37872,71 +42865,92 @@ var ts; function moduleNameIsEqualTo(a, b) { return a.text === b.text; } + function getTextOfLiteral(literal) { + return literal.text; + } function collectExternalModuleReferences(file) { if (file.imports) { return; } var isJavaScriptFile = ts.isSourceFileJavaScript(file); + var isExternalModuleFile = ts.isExternalModule(file); var imports; + var moduleAugmentations; for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { var node = _a[_i]; - collect(node, /* allowRelativeModuleNames */ true, /* collectOnlyRequireCalls */ false); + collectModuleReferences(node, /*inAmbientModule*/ false); + if (isJavaScriptFile) { + collectRequireCalls(node); + } } file.imports = imports || emptyArray; + file.moduleAugmentations = moduleAugmentations || emptyArray; return; - function collect(node, allowRelativeModuleNames, collectOnlyRequireCalls) { - if (!collectOnlyRequireCalls) { - switch (node.kind) { - case 222 /* ImportDeclaration */: - case 221 /* ImportEqualsDeclaration */: - case 228 /* ExportDeclaration */: - var moduleNameExpr = ts.getExternalModuleName(node); - if (!moduleNameExpr || moduleNameExpr.kind !== 9 /* StringLiteral */) { - break; - } - if (!moduleNameExpr.text) { - break; - } - if (allowRelativeModuleNames || !ts.isExternalModuleNameRelative(moduleNameExpr.text)) { - (imports || (imports = [])).push(moduleNameExpr); - } + function collectModuleReferences(node, inAmbientModule) { + switch (node.kind) { + case 230 /* ImportDeclaration */: + case 229 /* ImportEqualsDeclaration */: + case 236 /* ExportDeclaration */: + var moduleNameExpr = ts.getExternalModuleName(node); + if (!moduleNameExpr || moduleNameExpr.kind !== 9 /* StringLiteral */) { break; - case 218 /* ModuleDeclaration */: - if (node.name.kind === 9 /* StringLiteral */ && (node.flags & 4 /* Ambient */ || ts.isDeclarationFile(file))) { - // TypeScript 1.0 spec (April 2014): 12.1.6 - // An AmbientExternalModuleDeclaration declares an external module. + } + if (!moduleNameExpr.text) { + break; + } + // TypeScript 1.0 spec (April 2014): 12.1.6 + // An ExternalImportDeclaration in an AmbientExternalModuleDeclaration may reference other external modules + // only through top - level external module names. Relative external module names are not permitted. + if (!inAmbientModule || !ts.isExternalModuleNameRelative(moduleNameExpr.text)) { + (imports || (imports = [])).push(moduleNameExpr); + } + break; + case 225 /* ModuleDeclaration */: + if (ts.isAmbientModule(node) && (inAmbientModule || node.flags & 2 /* Ambient */ || ts.isDeclarationFile(file))) { + var moduleName = node.name; + // Ambient module declarations can be interpreted as augmentations for some existing external modules. + // This will happen in two cases: + // - if current file is external module then module augmentation is a ambient module declaration defined in the top level scope + // - if current file is not external module then module augmentation is an ambient module declaration with non-relative module name + // immediately nested in top level ambient module declaration . + if (isExternalModuleFile || (inAmbientModule && !ts.isExternalModuleNameRelative(moduleName.text))) { + (moduleAugmentations || (moduleAugmentations = [])).push(moduleName); + } + else if (!inAmbientModule) { + // An AmbientExternalModuleDeclaration declares an external module. // This type of declaration is permitted only in the global module. // The StringLiteral must specify a top - level external module name. // Relative external module names are not permitted - ts.forEachChild(node.body, function (node) { - // TypeScript 1.0 spec (April 2014): 12.1.6 - // An ExternalImportDeclaration in anAmbientExternalModuleDeclaration may reference other external modules - // only through top - level external module names. Relative external module names are not permitted. - collect(node, /* allowRelativeModuleNames */ false, collectOnlyRequireCalls); - }); + // NOTE: body of ambient module is always a module block + for (var _i = 0, _a = node.body.statements; _i < _a.length; _i++) { + var statement = _a[_i]; + collectModuleReferences(statement, /*inAmbientModule*/ true); + } } - break; - } + } } - if (isJavaScriptFile) { - if (ts.isRequireCall(node)) { - (imports || (imports = [])).push(node.arguments[0]); - } - else { - ts.forEachChild(node, function (node) { return collect(node, allowRelativeModuleNames, /* collectOnlyRequireCalls */ true); }); - } + } + function collectRequireCalls(node) { + if (ts.isRequireCall(node, /*checkArgumentIsStringLiteral*/ true)) { + (imports || (imports = [])).push(node.arguments[0]); + } + else { + ts.forEachChild(node, collectRequireCalls); } } } - function processSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd) { + /** + * 'isReference' indicates whether the file was brought in via a reference directive (rather than an import declaration) + */ + function processSourceFile(fileName, isDefaultLib, isReference, refFile, refPos, refEnd) { var diagnosticArgument; var diagnostic; if (hasExtension(fileName)) { - if (!options.allowNonTsExtensions && !ts.forEach(ts.supportedExtensions, function (extension) { return ts.fileExtensionIs(host.getCanonicalFileName(fileName), extension); })) { + if (!options.allowNonTsExtensions && !ts.forEach(supportedExtensions, function (extension) { return ts.fileExtensionIs(host.getCanonicalFileName(fileName), extension); })) { diagnostic = ts.Diagnostics.File_0_has_unsupported_extension_The_only_supported_extensions_are_1; - diagnosticArgument = [fileName, "'" + ts.supportedExtensions.join("', '") + "'"]; + diagnosticArgument = [fileName, "'" + supportedExtensions.join("', '") + "'"]; } - else if (!findSourceFile(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName), isDefaultLib, refFile, refPos, refEnd)) { + else if (!findSourceFile(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName), isDefaultLib, isReference, refFile, refPos, refEnd)) { diagnostic = ts.Diagnostics.File_0_not_found; diagnosticArgument = [fileName]; } @@ -37946,13 +42960,13 @@ var ts; } } else { - var nonTsFile = options.allowNonTsExtensions && findSourceFile(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName), isDefaultLib, refFile, refPos, refEnd); + var nonTsFile = options.allowNonTsExtensions && findSourceFile(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName), isDefaultLib, isReference, refFile, refPos, refEnd); if (!nonTsFile) { if (options.allowNonTsExtensions) { diagnostic = ts.Diagnostics.File_0_not_found; diagnosticArgument = [fileName]; } - else if (!ts.forEach(ts.supportedExtensions, function (extension) { return findSourceFile(fileName + extension, ts.toPath(fileName + extension, currentDirectory, getCanonicalFileName), isDefaultLib, refFile, refPos, refEnd); })) { + else if (!ts.forEach(supportedExtensions, function (extension) { return findSourceFile(fileName + extension, ts.toPath(fileName + extension, currentDirectory, getCanonicalFileName), isDefaultLib, isReference, refFile, refPos, refEnd); })) { diagnostic = ts.Diagnostics.File_0_not_found; fileName += ".ts"; diagnosticArgument = [fileName]; @@ -37977,14 +42991,17 @@ var ts; } } // Get source file from normalized fileName - function findSourceFile(fileName, normalizedAbsolutePath, isDefaultLib, refFile, refPos, refEnd) { - if (filesByName.contains(normalizedAbsolutePath)) { - var file_1 = filesByName.get(normalizedAbsolutePath); + function findSourceFile(fileName, path, isDefaultLib, isReference, refFile, refPos, refEnd) { + if (filesByName.contains(path)) { + var file_1 = filesByName.get(path); // try to check if we've already seen this file but with a different casing in path // NOTE: this only makes sense for case-insensitive file systems - if (file_1 && options.forceConsistentCasingInFileNames && ts.getNormalizedAbsolutePath(file_1.fileName, currentDirectory) !== normalizedAbsolutePath) { + if (file_1 && options.forceConsistentCasingInFileNames && ts.getNormalizedAbsolutePath(file_1.fileName, currentDirectory) !== ts.getNormalizedAbsolutePath(fileName, currentDirectory)) { reportFileNamesDifferOnlyInCasingError(fileName, file_1.fileName, refFile, refPos, refEnd); } + if (file_1) { + file_1.wasReferenced = file_1.wasReferenced || isReference; + } return file_1; } // We haven't looked for this file, do so now and cache result @@ -37996,23 +43013,25 @@ var ts; fileProcessingDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage)); } }); - filesByName.set(normalizedAbsolutePath, file); + filesByName.set(path, file); if (file) { - file.path = normalizedAbsolutePath; + file.wasReferenced = file.wasReferenced || isReference; + file.path = path; if (host.useCaseSensitiveFileNames()) { // for case-sensitive file systems check if we've already seen some file with similar filename ignoring case - var existingFile = filesByNameIgnoreCase.get(normalizedAbsolutePath); + var existingFile = filesByNameIgnoreCase.get(path); if (existingFile) { reportFileNamesDifferOnlyInCasingError(fileName, existingFile.fileName, refFile, refPos, refEnd); } else { - filesByNameIgnoreCase.set(normalizedAbsolutePath, file); + filesByNameIgnoreCase.set(path, file); } } skipDefaultLib = skipDefaultLib || file.hasNoDefaultLib; var basePath = ts.getDirectoryPath(fileName); if (!options.noResolve) { - processReferencedFiles(file, basePath); + processReferencedFiles(file, basePath, isDefaultLib); + processTypeReferenceDirectives(file); } // always process imported modules to record module name resolutions processImportedModules(file, basePath); @@ -38025,30 +43044,98 @@ var ts; } return file; } - function processReferencedFiles(file, basePath) { + function processReferencedFiles(file, basePath, isDefaultLib) { ts.forEach(file.referencedFiles, function (ref) { var referencedFileName = resolveTripleslashReference(ref.fileName, file.fileName); - processSourceFile(referencedFileName, /* isDefaultLib */ false, file, ref.pos, ref.end); + processSourceFile(referencedFileName, isDefaultLib, /*isReference*/ true, file, ref.pos, ref.end); }); } + function processTypeReferenceDirectives(file) { + var typeDirectives = ts.map(file.typeReferenceDirectives, function (l) { return l.fileName; }); + var resolutions = resolveTypeReferenceDirectiveNamesWorker(typeDirectives, file.fileName); + for (var i = 0; i < typeDirectives.length; i++) { + var ref = file.typeReferenceDirectives[i]; + var resolvedTypeReferenceDirective = resolutions[i]; + // store resolved type directive on the file + ts.setResolvedTypeReferenceDirective(file, ref.fileName, resolvedTypeReferenceDirective); + processTypeReferenceDirective(ref.fileName, resolvedTypeReferenceDirective, file, ref.pos, ref.end); + } + } + function processTypeReferenceDirective(typeReferenceDirective, resolvedTypeReferenceDirective, refFile, refPos, refEnd) { + // If we already found this library as a primary reference - nothing to do + var previousResolution = resolvedTypeReferenceDirectives[typeReferenceDirective]; + if (previousResolution && previousResolution.primary) { + return; + } + var saveResolution = true; + if (resolvedTypeReferenceDirective) { + if (resolvedTypeReferenceDirective.primary) { + // resolved from the primary path + processSourceFile(resolvedTypeReferenceDirective.resolvedFileName, /*isDefaultLib*/ false, /*isReference*/ true, refFile, refPos, refEnd); + } + else { + // If we already resolved to this file, it must have been a secondary reference. Check file contents + // for sameness and possibly issue an error + if (previousResolution) { + var otherFileText = host.readFile(resolvedTypeReferenceDirective.resolvedFileName); + if (otherFileText !== getSourceFile(previousResolution.resolvedFileName).text) { + fileProcessingDiagnostics.add(createDiagnostic(refFile, refPos, refEnd, ts.Diagnostics.Conflicting_library_definitions_for_0_found_at_1_and_2_Copy_the_correct_file_to_the_typings_folder_to_resolve_this_conflict, typeReferenceDirective, resolvedTypeReferenceDirective.resolvedFileName, previousResolution.resolvedFileName)); + } + // don't overwrite previous resolution result + saveResolution = false; + } + else { + // First resolution of this library + processSourceFile(resolvedTypeReferenceDirective.resolvedFileName, /*isDefaultLib*/ false, /*isReference*/ true, refFile, refPos, refEnd); + } + } + } + else { + fileProcessingDiagnostics.add(createDiagnostic(refFile, refPos, refEnd, ts.Diagnostics.Cannot_find_name_0, typeReferenceDirective)); + } + if (saveResolution) { + resolvedTypeReferenceDirectives[typeReferenceDirective] = resolvedTypeReferenceDirective; + } + } + function createDiagnostic(refFile, refPos, refEnd, message) { + var args = []; + for (var _i = 4; _i < arguments.length; _i++) { + args[_i - 4] = arguments[_i]; + } + if (refFile === undefined || refPos === undefined || refEnd === undefined) { + return ts.createCompilerDiagnostic.apply(void 0, [message].concat(args)); + } + else { + return ts.createFileDiagnostic.apply(void 0, [refFile, refPos, refEnd - refPos, message].concat(args)); + } + } function getCanonicalFileName(fileName) { return host.getCanonicalFileName(fileName); } function processImportedModules(file, basePath) { collectExternalModuleReferences(file); - if (file.imports.length) { + if (file.imports.length || file.moduleAugmentations.length) { file.resolvedModules = {}; - var moduleNames = ts.map(file.imports, function (name) { return name.text; }); + var moduleNames = ts.map(ts.concatenate(file.imports, file.moduleAugmentations), getTextOfLiteral); var resolutions = resolveModuleNamesWorker(moduleNames, ts.getNormalizedAbsolutePath(file.fileName, currentDirectory)); - for (var i = 0; i < file.imports.length; ++i) { + for (var i = 0; i < moduleNames.length; i++) { var resolution = resolutions[i]; ts.setResolvedModule(file, moduleNames[i], resolution); - if (resolution && !options.noResolve) { - var importedFile = findSourceFile(resolution.resolvedFileName, ts.toPath(resolution.resolvedFileName, currentDirectory, getCanonicalFileName), /* isDefaultLib */ false, file, ts.skipTrivia(file.text, file.imports[i].pos), file.imports[i].end); + // add file to program only if: + // - resolution was successful + // - noResolve is falsy + // - module name comes from the list of imports + var shouldAddFile = resolution && + !options.noResolve && + i < file.imports.length; + if (shouldAddFile) { + var importedFile = findSourceFile(resolution.resolvedFileName, ts.toPath(resolution.resolvedFileName, currentDirectory, getCanonicalFileName), /*isDefaultLib*/ false, /*isReference*/ false, file, ts.skipTrivia(file.text, file.imports[i].pos), file.imports[i].end); if (importedFile && resolution.isExternalLibraryImport) { - if (!ts.isExternalModule(importedFile)) { - var start_2 = ts.getTokenPosOfNode(file.imports[i], file); - fileProcessingDiagnostics.add(ts.createFileDiagnostic(file, start_2, file.imports[i].end - start_2, ts.Diagnostics.Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_the_package_definition, importedFile.fileName)); + // Since currently irrespective of allowJs, we only look for supportedTypeScript extension external module files, + // this check is ok. Otherwise this would be never true for javascript file + if (!ts.isExternalModule(importedFile) && importedFile.statements.length) { + var start_5 = ts.getTokenPosOfNode(file.imports[i], file); + fileProcessingDiagnostics.add(ts.createFileDiagnostic(file, start_5, file.imports[i].end - start_5, ts.Diagnostics.Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_the_package_definition, importedFile.fileName)); } else if (importedFile.referencedFiles.length) { var firstRef = importedFile.referencedFiles[0]; @@ -38065,46 +43152,21 @@ var ts; return; } function computeCommonSourceDirectory(sourceFiles) { - var commonPathComponents; - ts.forEach(files, function (sourceFile) { - // Each file contributes into common source file path - if (ts.isDeclarationFile(sourceFile)) { - return; + var fileNames = []; + for (var _i = 0, sourceFiles_2 = sourceFiles; _i < sourceFiles_2.length; _i++) { + var file = sourceFiles_2[_i]; + if (!file.isDeclarationFile) { + fileNames.push(file.fileName); } - var sourcePathComponents = ts.getNormalizedPathComponents(sourceFile.fileName, currentDirectory); - sourcePathComponents.pop(); // The base file name is not part of the common directory path - if (!commonPathComponents) { - // first file - commonPathComponents = sourcePathComponents; - return; - } - for (var i = 0, n = Math.min(commonPathComponents.length, sourcePathComponents.length); i < n; i++) { - if (commonPathComponents[i] !== sourcePathComponents[i]) { - if (i === 0) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files)); - return; - } - // New common path found that is 0 -> i-1 - commonPathComponents.length = i; - break; - } - } - // If the sourcePathComponents was shorter than the commonPathComponents, truncate to the sourcePathComponents - if (sourcePathComponents.length < commonPathComponents.length) { - commonPathComponents.length = sourcePathComponents.length; - } - }); - if (!commonPathComponents) { - return currentDirectory; } - return ts.getNormalizedPathFromPathComponents(commonPathComponents); + return computeCommonSourceDirectoryOfFilenames(fileNames, currentDirectory, getCanonicalFileName); } function checkSourceFilesBelongToPath(sourceFiles, rootDirectory) { var allFilesBelongToPath = true; if (sourceFiles) { var absoluteRootDirectoryPath = host.getCanonicalFileName(ts.getNormalizedAbsolutePath(rootDirectory, currentDirectory)); - for (var _i = 0, sourceFiles_1 = sourceFiles; _i < sourceFiles_1.length; _i++) { - var sourceFile = sourceFiles_1[_i]; + for (var _i = 0, sourceFiles_3 = sourceFiles; _i < sourceFiles_3.length; _i++) { + var sourceFile = sourceFiles_3[_i]; if (!ts.isDeclarationFile(sourceFile)) { var absoluteSourceFilePath = host.getCanonicalFileName(ts.getNormalizedAbsolutePath(sourceFile.fileName, currentDirectory)); if (absoluteSourceFilePath.indexOf(absoluteRootDirectoryPath) !== 0) { @@ -38138,14 +43200,44 @@ var ts; if (options.mapRoot) { programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "mapRoot", "inlineSourceMap")); } - if (options.sourceRoot) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceRoot", "inlineSourceMap")); + } + if (options.paths && options.baseUrl === undefined) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_paths_cannot_be_used_without_specifying_baseUrl_option)); + } + if (options.paths) { + for (var key in options.paths) { + if (!ts.hasProperty(options.paths, key)) { + continue; + } + if (!hasZeroOrOneAsteriskCharacter(key)) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Pattern_0_can_have_at_most_one_Asterisk_character, key)); + } + if (ts.isArray(options.paths[key])) { + for (var _i = 0, _a = options.paths[key]; _i < _a.length; _i++) { + var subst = _a[_i]; + var typeOfSubst = typeof subst; + if (typeOfSubst === "string") { + if (!hasZeroOrOneAsteriskCharacter(subst)) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character, subst, key)); + } + } + else { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Substitution_0_for_pattern_1_has_incorrect_type_expected_string_got_2, subst, key, typeOfSubst)); + } + } + } + else { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Substututions_for_pattern_0_should_be_an_array, key)); + } } } if (options.inlineSources) { if (!options.sourceMap && !options.inlineSourceMap) { programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_inlineSources_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided)); } + if (options.sourceRoot) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceRoot", "inlineSources")); + } } if (options.out && options.outFile) { programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "outFile")); @@ -38155,16 +43247,26 @@ var ts; if (options.mapRoot) { programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "mapRoot", "sourceMap")); } - if (options.sourceRoot) { + if (options.sourceRoot && !options.inlineSourceMap) { programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "sourceRoot", "sourceMap")); } - return; + } + if (options.declarationDir) { + if (!options.declaration) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "declarationDir", "declaration")); + } + if (options.out || options.outFile) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "declarationDir", options.out ? "out" : "outFile")); + } + } + if (options.lib && options.noLib) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "lib", "noLib")); } var languageVersion = options.target || 0 /* ES3 */; var outFile = options.outFile || options.out; var firstExternalModuleSourceFile = ts.forEach(files, function (f) { return ts.isExternalModule(f) ? f : undefined; }); if (options.isolatedModules) { - if (!options.module && languageVersion < 2 /* ES6 */) { + if (options.module === ts.ModuleKind.None && languageVersion < 2 /* ES6 */) { programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES2015_or_higher)); } var firstNonExternalModuleSourceFile = ts.forEach(files, function (f) { return !ts.isExternalModule(f) && !ts.isDeclarationFile(f) ? f : undefined; }); @@ -38173,17 +43275,17 @@ var ts; programDiagnostics.add(ts.createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided)); } } - else if (firstExternalModuleSourceFile && languageVersion < 2 /* ES6 */ && !options.module) { + else if (firstExternalModuleSourceFile && languageVersion < 2 /* ES6 */ && options.module === ts.ModuleKind.None) { // We cannot use createDiagnosticFromNode because nodes do not have parents yet var span = ts.getErrorSpanForNode(firstExternalModuleSourceFile, firstExternalModuleSourceFile.externalModuleIndicator); - programDiagnostics.add(ts.createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_modules_unless_the_module_flag_is_provided)); + programDiagnostics.add(ts.createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_modules_unless_the_module_flag_is_provided_with_a_valid_module_type_Consider_setting_the_module_compiler_option_in_a_tsconfig_json_file)); } // Cannot specify module gen target of es6 when below es6 - if (options.module === 5 /* ES6 */ && languageVersion < 2 /* ES6 */) { + if (options.module === ts.ModuleKind.ES6 && languageVersion < 2 /* ES6 */) { programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_compile_modules_into_es2015_when_targeting_ES5_or_lower)); } // Cannot specify module gen that isn't amd or system with --out - if (outFile && options.module && !(options.module === 2 /* AMD */ || options.module === 4 /* System */)) { + if (outFile && options.module && !(options.module === ts.ModuleKind.AMD || options.module === ts.ModuleKind.System)) { programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Only_amd_and_system_modules_are_supported_alongside_0, options.out ? "out" : "outFile")); } // there has to be common source directory if user specified --outdir || --sourceRoot @@ -38191,39 +43293,54 @@ var ts; if (options.outDir || options.sourceRoot || options.mapRoot) { - if (options.rootDir && checkSourceFilesBelongToPath(files, options.rootDir)) { - // If a rootDir is specified and is valid use it as the commonSourceDirectory - commonSourceDirectory = ts.getNormalizedAbsolutePath(options.rootDir, currentDirectory); - } - else { - // Compute the commonSourceDirectory from the input files - commonSourceDirectory = computeCommonSourceDirectory(files); - } - if (commonSourceDirectory && commonSourceDirectory[commonSourceDirectory.length - 1] !== ts.directorySeparator) { - // Make sure directory path ends with directory separator so this string can directly - // used to replace with "" to get the relative path of the source file and the relative path doesn't - // start with / making it rooted path - commonSourceDirectory += ts.directorySeparator; + // Precalculate and cache the common source directory + var dir = getCommonSourceDirectory(); + // If we failed to find a good common directory, but outDir is specified and at least one of our files is on a windows drive/URL/other resource, add a failure + if (options.outDir && dir === "" && ts.forEach(files, function (file) { return ts.getRootLength(file.fileName) > 1; })) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files)); } } - if (options.noEmit) { - if (options.out) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "out")); - } - if (options.outFile) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outFile")); - } - if (options.outDir) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outDir")); - } - if (options.declaration) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "declaration")); - } + if (!options.noEmit && options.allowJs && options.declaration) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "allowJs", "declaration")); } if (options.emitDecoratorMetadata && !options.experimentalDecorators) { programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators")); } + if (options.reactNamespace && !ts.isIdentifier(options.reactNamespace, languageVersion)) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier, options.reactNamespace)); + } + // If the emit is enabled make sure that every output file is unique and not overwriting any of the input files + if (!options.noEmit && !options.suppressOutputPathCheck) { + var emitHost = getEmitHost(); + var emitFilesSeen_1 = ts.createFileMap(!host.useCaseSensitiveFileNames() ? function (key) { return key.toLocaleLowerCase(); } : undefined); + ts.forEachExpectedEmitFile(emitHost, function (emitFileNames, sourceFiles, isBundledEmit) { + verifyEmitFilePath(emitFileNames.jsFilePath, emitFilesSeen_1); + verifyEmitFilePath(emitFileNames.declarationFilePath, emitFilesSeen_1); + }); + } + // Verify that all the emit files are unique and don't overwrite input files + function verifyEmitFilePath(emitFileName, emitFilesSeen) { + if (emitFileName) { + var emitFilePath = ts.toPath(emitFileName, currentDirectory, getCanonicalFileName); + // Report error if the output overwrites input file + if (filesByName.contains(emitFilePath)) { + createEmitBlockingDiagnostics(emitFileName, emitFilePath, ts.Diagnostics.Cannot_write_file_0_because_it_would_overwrite_input_file); + } + // Report error if multiple files write into same file + if (emitFilesSeen.contains(emitFilePath)) { + // Already seen the same emit file - report error + createEmitBlockingDiagnostics(emitFileName, emitFilePath, ts.Diagnostics.Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files); + } + else { + emitFilesSeen.set(emitFilePath, true); + } + } + } + } + function createEmitBlockingDiagnostics(emitFileName, emitFilePath, message) { + hasEmitBlockingDiagnostics.set(ts.toPath(emitFileName, currentDirectory, getCanonicalFileName), true); + programDiagnostics.add(ts.createCompilerDiagnostic(message, emitFileName)); } } ts.createProgram = createProgram; @@ -38247,6 +43364,12 @@ var ts; type: "boolean", description: ts.Diagnostics.Generates_corresponding_d_ts_file }, + { + name: "declarationDir", + type: "string", + isFilePath: true, + paramType: ts.Diagnostics.DIRECTORY + }, { name: "diagnostics", type: "boolean" @@ -38281,8 +43404,12 @@ var ts; "react": 2 /* React */ }, paramType: ts.Diagnostics.KIND, - description: ts.Diagnostics.Specify_JSX_code_generation_Colon_preserve_or_react, - error: ts.Diagnostics.Argument_for_jsx_must_be_preserve_or_react + description: ts.Diagnostics.Specify_JSX_code_generation_Colon_preserve_or_react + }, + { + name: "reactNamespace", + type: "string", + description: ts.Diagnostics.Specify_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit }, { name: "listFiles", @@ -38296,23 +43423,23 @@ var ts; name: "mapRoot", type: "string", isFilePath: true, - description: ts.Diagnostics.Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations, + description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations, paramType: ts.Diagnostics.LOCATION }, { name: "module", shortName: "m", type: { - "commonjs": 1 /* CommonJS */, - "amd": 2 /* AMD */, - "system": 4 /* System */, - "umd": 3 /* UMD */, - "es6": 5 /* ES6 */, - "es2015": 5 /* ES2015 */ + "none": ts.ModuleKind.None, + "commonjs": ts.ModuleKind.CommonJS, + "amd": ts.ModuleKind.AMD, + "system": ts.ModuleKind.System, + "umd": ts.ModuleKind.UMD, + "es6": ts.ModuleKind.ES6, + "es2015": ts.ModuleKind.ES2015 }, description: ts.Diagnostics.Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015, - paramType: ts.Diagnostics.KIND, - error: ts.Diagnostics.Argument_for_module_option_must_be_commonjs_amd_system_umd_or_es2015 + paramType: ts.Diagnostics.KIND }, { name: "newLine", @@ -38320,9 +43447,8 @@ var ts; "crlf": 0 /* CarriageReturnLineFeed */, "lf": 1 /* LineFeed */ }, - description: ts.Diagnostics.Specifies_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix, - paramType: ts.Diagnostics.NEWLINE, - error: ts.Diagnostics.Argument_for_newLine_option_must_be_CRLF_or_LF + description: ts.Diagnostics.Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix, + paramType: ts.Diagnostics.NEWLINE }, { name: "noEmit", @@ -38343,6 +43469,11 @@ var ts; type: "boolean", description: ts.Diagnostics.Raise_error_on_expressions_and_declarations_with_an_implied_any_type }, + { + name: "noImplicitThis", + type: "boolean", + description: ts.Diagnostics.Raise_error_on_this_expressions_with_an_implied_any_type + }, { name: "noLib", type: "boolean" @@ -38383,7 +43514,6 @@ var ts; }, { name: "pretty", - paramType: ts.Diagnostics.KIND, description: ts.Diagnostics.Stylize_errors_and_messages_using_color_and_context_experimental, type: "boolean" }, @@ -38404,8 +43534,8 @@ var ts; name: "rootDir", type: "string", isFilePath: true, - description: ts.Diagnostics.Specifies_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir, - paramType: ts.Diagnostics.LOCATION + paramType: ts.Diagnostics.LOCATION, + description: ts.Diagnostics.Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir }, { name: "isolatedModules", @@ -38420,7 +43550,7 @@ var ts; name: "sourceRoot", type: "string", isFilePath: true, - description: ts.Diagnostics.Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations, + description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations, paramType: ts.Diagnostics.LOCATION }, { @@ -38449,9 +43579,8 @@ var ts; "es6": 2 /* ES6 */, "es2015": 2 /* ES2015 */ }, - description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015_experimental, - paramType: ts.Diagnostics.VERSION, - error: ts.Diagnostics.Argument_for_target_option_must_be_ES3_ES5_or_ES2015 + description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015, + paramType: ts.Diagnostics.VERSION }, { name: "version", @@ -38479,11 +43608,10 @@ var ts; { name: "moduleResolution", type: { - "node": 2 /* NodeJs */, - "classic": 1 /* Classic */ + "node": ts.ModuleResolutionKind.NodeJs, + "classic": ts.ModuleResolutionKind.Classic }, - description: ts.Diagnostics.Specifies_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6, - error: ts.Diagnostics.Argument_for_moduleResolution_option_must_be_node_or_classic + description: ts.Diagnostics.Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6 }, { name: "allowUnusedLabels", @@ -38509,6 +43637,139 @@ var ts; name: "forceConsistentCasingInFileNames", type: "boolean", description: ts.Diagnostics.Disallow_inconsistently_cased_references_to_the_same_file + }, + { + name: "baseUrl", + type: "string", + isFilePath: true, + description: ts.Diagnostics.Base_directory_to_resolve_non_absolute_module_names + }, + { + // this option can only be specified in tsconfig.json + // use type = object to copy the value as-is + name: "paths", + type: "object", + isTSConfigOnly: true + }, + { + // this option can only be specified in tsconfig.json + // use type = object to copy the value as-is + name: "rootDirs", + type: "list", + isTSConfigOnly: true, + element: { + name: "rootDirs", + type: "string", + isFilePath: true + } + }, + { + name: "typesSearchPaths", + type: "list", + isTSConfigOnly: true, + element: { + name: "typesSearchPaths", + type: "string", + isFilePath: true + } + }, + { + name: "typesRoot", + type: "string" + }, + { + name: "types", + type: "list", + element: { + name: "types", + type: "string" + }, + description: ts.Diagnostics.Type_declaration_files_to_be_included_in_compilation + }, + { + name: "traceResolution", + type: "boolean", + description: ts.Diagnostics.Enable_tracing_of_the_name_resolution_process + }, + { + name: "allowJs", + type: "boolean", + description: ts.Diagnostics.Allow_javascript_files_to_be_compiled + }, + { + name: "allowSyntheticDefaultImports", + type: "boolean", + description: ts.Diagnostics.Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typechecking + }, + { + name: "noImplicitUseStrict", + type: "boolean", + description: ts.Diagnostics.Do_not_emit_use_strict_directives_in_module_output + }, + { + name: "listEmittedFiles", + type: "boolean" + }, + { + name: "lib", + type: "list", + element: { + name: "lib", + type: { + // JavaScript only + "es5": "lib.es5.d.ts", + "es6": "lib.es2015.d.ts", + "es2015": "lib.es2015.d.ts", + "es7": "lib.es2016.d.ts", + "es2016": "lib.es2016.d.ts", + "es2017": "lib.es2017.d.ts", + // Host only + "dom": "lib.dom.d.ts", + "webworker": "lib.webworker.d.ts", + "scripthost": "lib.scripthost.d.ts", + // ES2015 Or ESNext By-feature options + "es2015.core": "lib.es2015.core.d.ts", + "es2015.collection": "lib.es2015.collection.d.ts", + "es2015.generator": "lib.es2015.generator.d.ts", + "es2015.iterable": "lib.es2015.iterable.d.ts", + "es2015.promise": "lib.es2015.promise.d.ts", + "es2015.proxy": "lib.es2015.proxy.d.ts", + "es2015.reflect": "lib.es2015.reflect.d.ts", + "es2015.symbol": "lib.es2015.symbol.d.ts", + "es2015.symbol.wellknown": "lib.es2015.symbol.wellknown.d.ts", + "es2016.array.include": "lib.es2016.array.include.d.ts", + "es2017.object": "lib.es2017.object.d.ts" + } + }, + description: ts.Diagnostics.Specify_library_files_to_be_included_in_the_compilation_Colon + }, + { + name: "strictNullChecks", + type: "boolean", + description: ts.Diagnostics.Enable_strict_null_checks + } + ]; + /* @internal */ + ts.typingOptionDeclarations = [ + { + name: "enableAutoDiscovery", + type: "boolean" + }, + { + name: "include", + type: "list", + element: { + name: "include", + type: "string" + } + }, + { + name: "exclude", + type: "list", + element: { + name: "exclude", + type: "string" + } } ]; var optionNameMapCache; @@ -38529,6 +43790,41 @@ var ts; return optionNameMapCache; } ts.getOptionNameMap = getOptionNameMap; + /* @internal */ + function createCompilerDiagnosticForInvalidCustomType(opt) { + var namesOfType = []; + ts.forEachKey(opt.type, function (key) { + namesOfType.push(" '" + key + "'"); + }); + return ts.createCompilerDiagnostic(ts.Diagnostics.Argument_for_0_option_must_be_Colon_1, "--" + opt.name, namesOfType); + } + ts.createCompilerDiagnosticForInvalidCustomType = createCompilerDiagnosticForInvalidCustomType; + /* @internal */ + function parseCustomTypeOption(opt, value, errors) { + var key = trimString((value || "")).toLowerCase(); + var map = opt.type; + if (ts.hasProperty(map, key)) { + return map[key]; + } + else { + errors.push(createCompilerDiagnosticForInvalidCustomType(opt)); + } + } + ts.parseCustomTypeOption = parseCustomTypeOption; + /* @internal */ + function parseListTypeOption(opt, value, errors) { + var values = trimString((value || "")).split(","); + switch (opt.element.type) { + case "number": + return ts.map(values, parseInt); + case "string": + return ts.map(values, function (v) { return v || ""; }); + default: + return ts.filter(ts.map(values, function (v) { return parseCustomTypeOption(opt.element, v, errors); }), function (v) { return !!v; }); + } + } + ts.parseListTypeOption = parseListTypeOption; + /* @internal */ function parseCommandLine(commandLine, readFile) { var options = {}; var fileNames = []; @@ -38543,7 +43839,8 @@ var ts; function parseStrings(args) { var i = 0; while (i < args.length) { - var s = args[i++]; + var s = args[i]; + i++; if (s.charCodeAt(0) === 64 /* at */) { parseResponseFile(s.slice(1)); } @@ -38555,30 +43852,36 @@ var ts; } if (ts.hasProperty(optionNameMap, s)) { var opt = optionNameMap[s]; - // Check to see if no argument was provided (e.g. "--locale" is the last command-line argument). - if (!args[i] && opt.type !== "boolean") { - errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_expects_an_argument, opt.name)); + if (opt.isTSConfigOnly) { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_can_only_be_specified_in_tsconfig_json_file, opt.name)); } - switch (opt.type) { - case "number": - options[opt.name] = parseInt(args[i++]); - break; - case "boolean": - options[opt.name] = true; - break; - case "string": - options[opt.name] = args[i++] || ""; - break; - // If not a primitive, the possible types are specified in what is effectively a map of options. - default: - var map_2 = opt.type; - var key = (args[i++] || "").toLowerCase(); - if (ts.hasProperty(map_2, key)) { - options[opt.name] = map_2[key]; - } - else { - errors.push(ts.createCompilerDiagnostic(opt.error)); - } + else { + // Check to see if no argument was provided (e.g. "--locale" is the last command-line argument). + if (!args[i] && opt.type !== "boolean") { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_expects_an_argument, opt.name)); + } + switch (opt.type) { + case "number": + options[opt.name] = parseInt(args[i]); + i++; + break; + case "boolean": + options[opt.name] = true; + break; + case "string": + options[opt.name] = args[i] || ""; + i++; + break; + case "list": + options[opt.name] = parseListTypeOption(opt, args[i], errors); + i++; + break; + // If not a primitive, the possible types are specified in what is effectively a map of options. + default: + options[opt.name] = parseCustomTypeOption(opt, args[i], errors); + i++; + break; + } } } else { @@ -38680,6 +43983,9 @@ var ts; } return output; } + // Skip over any minified JavaScript files (ending in ".min.js") + // Skip over dotted files and folders as well + var IgnoreFileNamePattern = /(\.min\.js$)|([\\/]\.[\w.])/; /** * Parse the contents of a config file (tsconfig.json). * @param json The contents of the config file to parse @@ -38687,17 +43993,25 @@ var ts; * @param basePath A root directory to resolve relative path entries in the config * file to. e.g. outDir */ - function parseJsonConfigFileContent(json, host, basePath) { - var _a = convertCompilerOptionsFromJson(json["compilerOptions"], basePath), options = _a.options, errors = _a.errors; + function parseJsonConfigFileContent(json, host, basePath, existingOptions, configFileName) { + if (existingOptions === void 0) { existingOptions = {}; } + var errors = []; + var compilerOptions = convertCompilerOptionsFromJsonWorker(json["compilerOptions"], basePath, errors, configFileName); + var options = ts.extend(existingOptions, compilerOptions); + var typingOptions = convertTypingOptionsFromJsonWorker(json["typingOptions"], basePath, errors, configFileName); + options.configFilePath = configFileName; + var fileNames = getFileNames(errors); return { options: options, - fileNames: getFileNames(), + fileNames: fileNames, + typingOptions: typingOptions, + raw: json, errors: errors }; - function getFileNames() { + function getFileNames(errors) { var fileNames = []; if (ts.hasProperty(json, "files")) { - if (json["files"] instanceof Array) { + if (ts.isArray(json["files"])) { fileNames = ts.map(json["files"], function (s) { return ts.combinePaths(basePath, s); }); } else { @@ -38705,73 +44019,134 @@ var ts; } } else { - var exclude = json["exclude"] instanceof Array ? ts.map(json["exclude"], ts.normalizeSlashes) : undefined; - var sysFiles = host.readDirectory(basePath, ".ts", exclude).concat(host.readDirectory(basePath, ".tsx", exclude)); - for (var i = 0; i < sysFiles.length; i++) { - var name_31 = sysFiles[i]; - if (ts.fileExtensionIs(name_31, ".d.ts")) { - var baseName = name_31.substr(0, name_31.length - ".d.ts".length); - if (!ts.contains(sysFiles, baseName + ".tsx") && !ts.contains(sysFiles, baseName + ".ts")) { - fileNames.push(name_31); + var filesSeen = {}; + var exclude = []; + if (ts.isArray(json["exclude"])) { + exclude = json["exclude"]; + } + else { + // by default exclude node_modules, and any specificied output directory + exclude = ["node_modules", "bower_components", "jspm_packages"]; + } + var outDir = json["compilerOptions"] && json["compilerOptions"]["outDir"]; + if (outDir) { + exclude.push(outDir); + } + exclude = ts.map(exclude, ts.normalizeSlashes); + var supportedExtensions = ts.getSupportedExtensions(options); + ts.Debug.assert(ts.indexOf(supportedExtensions, ".ts") < ts.indexOf(supportedExtensions, ".d.ts"), "Changed priority of extensions to pick"); + // Get files of supported extensions in their order of resolution + for (var _i = 0, supportedExtensions_1 = supportedExtensions; _i < supportedExtensions_1.length; _i++) { + var extension = supportedExtensions_1[_i]; + var filesInDirWithExtension = host.readDirectory(basePath, extension, exclude); + for (var _a = 0, filesInDirWithExtension_1 = filesInDirWithExtension; _a < filesInDirWithExtension_1.length; _a++) { + var fileName = filesInDirWithExtension_1[_a]; + // .ts extension would read the .d.ts extension files too but since .d.ts is lower priority extension, + // lets pick them when its turn comes up + if (extension === ".ts" && ts.fileExtensionIs(fileName, ".d.ts")) { + continue; } - } - else if (ts.fileExtensionIs(name_31, ".ts")) { - if (!ts.contains(sysFiles, name_31 + "x")) { - fileNames.push(name_31); + if (IgnoreFileNamePattern.test(fileName)) { + continue; } - } - else { - fileNames.push(name_31); + // If this is one of the output extension (which would be .d.ts and .js if we are allowing compilation of js files) + // do not include this file if we included .ts or .tsx file with same base name as it could be output of the earlier compilation + if (extension === ".d.ts" || (options.allowJs && ts.contains(ts.supportedJavascriptExtensions, extension))) { + var baseName = fileName.substr(0, fileName.length - extension.length); + if (ts.hasProperty(filesSeen, baseName + ".ts") || ts.hasProperty(filesSeen, baseName + ".tsx")) { + continue; + } + } + filesSeen[fileName] = true; + fileNames.push(fileName); } } } + if (ts.hasProperty(json, "excludes") && !ts.hasProperty(json, "exclude")) { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unknown_option_excludes_Did_you_mean_exclude)); + } return fileNames; } } ts.parseJsonConfigFileContent = parseJsonConfigFileContent; - function convertCompilerOptionsFromJson(jsonOptions, basePath) { - var options = {}; + function convertCompilerOptionsFromJson(jsonOptions, basePath, configFileName) { var errors = []; - if (!jsonOptions) { - return { options: options, errors: errors }; - } - var optionNameMap = ts.arrayToMap(ts.optionDeclarations, function (opt) { return opt.name; }); - for (var id in jsonOptions) { - if (ts.hasProperty(optionNameMap, id)) { - var opt = optionNameMap[id]; - var optType = opt.type; - var value = jsonOptions[id]; - var expectedType = typeof optType === "string" ? optType : "string"; - if (typeof value === expectedType) { - if (typeof optType !== "string") { - var key = value.toLowerCase(); - if (ts.hasProperty(optType, key)) { - value = optType[key]; - } - else { - errors.push(ts.createCompilerDiagnostic(opt.error)); - value = 0; - } - } - if (opt.isFilePath) { - value = ts.normalizePath(ts.combinePaths(basePath, value)); - if (value === "") { - value = "."; - } - } - options[opt.name] = value; - } - else { - errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, id, expectedType)); - } - } - else { - errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unknown_compiler_option_0, id)); - } - } + var options = convertCompilerOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName); return { options: options, errors: errors }; } ts.convertCompilerOptionsFromJson = convertCompilerOptionsFromJson; + function convertTypingOptionsFromJson(jsonOptions, basePath, configFileName) { + var errors = []; + var options = convertTypingOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName); + return { options: options, errors: errors }; + } + ts.convertTypingOptionsFromJson = convertTypingOptionsFromJson; + function convertCompilerOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName) { + var options = ts.getBaseFileName(configFileName) === "jsconfig.json" ? { allowJs: true } : {}; + convertOptionsFromJson(ts.optionDeclarations, jsonOptions, basePath, options, ts.Diagnostics.Unknown_compiler_option_0, errors); + return options; + } + function convertTypingOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName) { + var options = ts.getBaseFileName(configFileName) === "jsconfig.json" + ? { enableAutoDiscovery: true, include: [], exclude: [] } + : { enableAutoDiscovery: false, include: [], exclude: [] }; + convertOptionsFromJson(ts.typingOptionDeclarations, jsonOptions, basePath, options, ts.Diagnostics.Unknown_typing_option_0, errors); + return options; + } + function convertOptionsFromJson(optionDeclarations, jsonOptions, basePath, defaultOptions, diagnosticMessage, errors) { + if (!jsonOptions) { + return; + } + var optionNameMap = ts.arrayToMap(optionDeclarations, function (opt) { return opt.name; }); + for (var id in jsonOptions) { + if (ts.hasProperty(optionNameMap, id)) { + var opt = optionNameMap[id]; + defaultOptions[opt.name] = convertJsonOption(opt, jsonOptions[id], basePath, errors); + } + else { + errors.push(ts.createCompilerDiagnostic(diagnosticMessage, id)); + } + } + } + function convertJsonOption(opt, value, basePath, errors) { + var optType = opt.type; + var expectedType = typeof optType === "string" ? optType : "string"; + if (optType === "list" && ts.isArray(value)) { + return convertJsonOptionOfListType(opt, value, basePath, errors); + } + else if (typeof value === expectedType) { + if (typeof optType !== "string") { + return convertJsonOptionOfCustomType(opt, value, errors); + } + else { + if (opt.isFilePath) { + value = ts.normalizePath(ts.combinePaths(basePath, value)); + if (value === "") { + value = "."; + } + } + } + return value; + } + else { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, opt.name, expectedType)); + } + } + function convertJsonOptionOfCustomType(opt, value, errors) { + var key = value.toLowerCase(); + if (ts.hasProperty(opt.type, key)) { + return opt.type[key]; + } + else { + errors.push(createCompilerDiagnosticForInvalidCustomType(opt)); + } + } + function convertJsonOptionOfListType(option, values, basePath, errors) { + return ts.filter(ts.map(values, function (v) { return convertJsonOption(option.element, v, basePath, errors); }), function (v) { return !!v; }); + } + function trimString(s) { + return typeof s.trim === "function" ? s.trim() : s.replace(/^[\s]+|[\s]+$/g, ""); + } })(ts || (ts = {})); /* @internal */ var ts; @@ -38845,7 +44220,7 @@ var ts; } } function autoCollapse(node) { - return ts.isFunctionBlock(node) && node.parent.kind !== 174 /* ArrowFunction */; + return ts.isFunctionBlock(node) && node.parent.kind !== 180 /* ArrowFunction */; } var depth = 0; var maxDepth = 20; @@ -38857,30 +44232,30 @@ var ts; addOutliningForLeadingCommentsForNode(n); } switch (n.kind) { - case 192 /* Block */: + case 199 /* Block */: if (!ts.isFunctionBlock(n)) { - var parent_7 = n.parent; + var parent_14 = n.parent; var openBrace = ts.findChildOfKind(n, 15 /* OpenBraceToken */, sourceFile); var closeBrace = ts.findChildOfKind(n, 16 /* CloseBraceToken */, sourceFile); // Check if the block is standalone, or 'attached' to some parent statement. - // If the latter, we want to collaps the block, but consider its hint span + // If the latter, we want to collapse the block, but consider its hint span // to be the entire span of the parent. - if (parent_7.kind === 197 /* DoStatement */ || - parent_7.kind === 200 /* ForInStatement */ || - parent_7.kind === 201 /* ForOfStatement */ || - parent_7.kind === 199 /* ForStatement */ || - parent_7.kind === 196 /* IfStatement */ || - parent_7.kind === 198 /* WhileStatement */ || - parent_7.kind === 205 /* WithStatement */ || - parent_7.kind === 244 /* CatchClause */) { - addOutliningSpan(parent_7, openBrace, closeBrace, autoCollapse(n)); + if (parent_14.kind === 204 /* DoStatement */ || + parent_14.kind === 207 /* ForInStatement */ || + parent_14.kind === 208 /* ForOfStatement */ || + parent_14.kind === 206 /* ForStatement */ || + parent_14.kind === 203 /* IfStatement */ || + parent_14.kind === 205 /* WhileStatement */ || + parent_14.kind === 212 /* WithStatement */ || + parent_14.kind === 252 /* CatchClause */) { + addOutliningSpan(parent_14, openBrace, closeBrace, autoCollapse(n)); break; } - if (parent_7.kind === 209 /* TryStatement */) { + if (parent_14.kind === 216 /* TryStatement */) { // Could be the try-block, or the finally-block. - var tryStatement = parent_7; + var tryStatement = parent_14; if (tryStatement.tryBlock === n) { - addOutliningSpan(parent_7, openBrace, closeBrace, autoCollapse(n)); + addOutliningSpan(parent_14, openBrace, closeBrace, autoCollapse(n)); break; } else if (tryStatement.finallyBlock === n) { @@ -38903,23 +44278,23 @@ var ts; break; } // Fallthrough. - case 219 /* ModuleBlock */: { + case 226 /* ModuleBlock */: { var openBrace = ts.findChildOfKind(n, 15 /* OpenBraceToken */, sourceFile); var closeBrace = ts.findChildOfKind(n, 16 /* CloseBraceToken */, sourceFile); addOutliningSpan(n.parent, openBrace, closeBrace, autoCollapse(n)); break; } - case 214 /* ClassDeclaration */: - case 215 /* InterfaceDeclaration */: - case 217 /* EnumDeclaration */: - case 165 /* ObjectLiteralExpression */: - case 220 /* CaseBlock */: { + case 221 /* ClassDeclaration */: + case 222 /* InterfaceDeclaration */: + case 224 /* EnumDeclaration */: + case 171 /* ObjectLiteralExpression */: + case 227 /* CaseBlock */: { var openBrace = ts.findChildOfKind(n, 15 /* OpenBraceToken */, sourceFile); var closeBrace = ts.findChildOfKind(n, 16 /* CloseBraceToken */, sourceFile); addOutliningSpan(n, openBrace, closeBrace, autoCollapse(n)); break; } - case 164 /* ArrayLiteralExpression */: + case 170 /* ArrayLiteralExpression */: var openBracket = ts.findChildOfKind(n, 19 /* OpenBracketToken */, sourceFile); var closeBracket = ts.findChildOfKind(n, 20 /* CloseBracketToken */, sourceFile); addOutliningSpan(n, openBracket, closeBracket, autoCollapse(n)); @@ -38949,17 +44324,17 @@ var ts; ts.forEach(program.getSourceFiles(), function (sourceFile) { cancellationToken.throwIfCancellationRequested(); var nameToDeclarations = sourceFile.getNamedDeclarations(); - for (var name_32 in nameToDeclarations) { - var declarations = ts.getProperty(nameToDeclarations, name_32); + for (var name_34 in nameToDeclarations) { + var declarations = ts.getProperty(nameToDeclarations, name_34); if (declarations) { // First do a quick check to see if the name of the declaration matches the // last portion of the (possibly) dotted name they're searching for. - var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_32); + var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_34); if (!matches) { continue; } - for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) { - var declaration = declarations_6[_i]; + for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) { + var declaration = declarations_7[_i]; // It was a match! If the pattern has dots in it, then also see if the // declaration container matches as well. if (patternMatcher.patternContainsDots) { @@ -38967,14 +44342,14 @@ var ts; if (!containers) { return undefined; } - matches = patternMatcher.getMatches(containers, name_32); + matches = patternMatcher.getMatches(containers, name_34); if (!matches) { continue; } } var fileName = sourceFile.fileName; var matchKind = bestMatchKind(matches); - rawItems.push({ name: name_32, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); + rawItems.push({ name: name_34, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); } } } @@ -39012,8 +44387,8 @@ var ts; if (text !== undefined) { containers.unshift(text); } - else if (declaration.name.kind === 136 /* ComputedPropertyName */) { - return tryAddComputedPropertyName(declaration.name.expression, containers, /*includeLastPortion:*/ true); + else if (declaration.name.kind === 140 /* ComputedPropertyName */) { + return tryAddComputedPropertyName(declaration.name.expression, containers, /*includeLastPortion*/ true); } else { // Don't know how to add this. @@ -39033,12 +44408,12 @@ var ts; } return true; } - if (expression.kind === 166 /* PropertyAccessExpression */) { + if (expression.kind === 172 /* PropertyAccessExpression */) { var propertyAccess = expression; if (includeLastPortion) { containers.unshift(propertyAccess.name.text); } - return tryAddComputedPropertyName(propertyAccess.expression, containers, /*includeLastPortion:*/ true); + return tryAddComputedPropertyName(propertyAccess.expression, containers, /*includeLastPortion*/ true); } return false; } @@ -39046,8 +44421,8 @@ var ts; var containers = []; // First, if we started with a computed property name, then add all but the last // portion into the container array. - if (declaration.name.kind === 136 /* ComputedPropertyName */) { - if (!tryAddComputedPropertyName(declaration.name.expression, containers, /*includeLastPortion:*/ false)) { + if (declaration.name.kind === 140 /* ComputedPropertyName */) { + if (!tryAddComputedPropertyName(declaration.name.expression, containers, /*includeLastPortion*/ false)) { return undefined; } } @@ -39108,7 +44483,12 @@ var ts; (function (ts) { var NavigationBar; (function (NavigationBar) { - function getNavigationBarItems(sourceFile) { + function getNavigationBarItems(sourceFile, compilerOptions) { + // TODO: Handle JS files differently in 'navbar' calls for now, but ideally we should unify + // the 'navbar' and 'navto' logic for TypeScript and JavaScript. + if (ts.isSourceFileJavaScript(sourceFile)) { + return getJsNavigationBarItems(sourceFile, compilerOptions); + } // If the source file has any child items, then it included in the tree // and takes lexical ownership of all other top-level items. var hasGlobalNode = false; @@ -39120,17 +44500,17 @@ var ts; var current = node.parent; while (current) { switch (current.kind) { - case 218 /* ModuleDeclaration */: + case 225 /* ModuleDeclaration */: // If we have a module declared as A.B.C, it is more "intuitive" // to say it only has a single layer of depth do { current = current.parent; - } while (current.kind === 218 /* ModuleDeclaration */); + } while (current.kind === 225 /* ModuleDeclaration */); // fall through - case 214 /* ClassDeclaration */: - case 217 /* EnumDeclaration */: - case 215 /* InterfaceDeclaration */: - case 213 /* FunctionDeclaration */: + case 221 /* ClassDeclaration */: + case 224 /* EnumDeclaration */: + case 222 /* InterfaceDeclaration */: + case 220 /* FunctionDeclaration */: indent++; } current = current.parent; @@ -39141,21 +44521,21 @@ var ts; var childNodes = []; function visit(node) { switch (node.kind) { - case 193 /* VariableStatement */: + case 200 /* VariableStatement */: ts.forEach(node.declarationList.declarations, visit); break; - case 161 /* ObjectBindingPattern */: - case 162 /* ArrayBindingPattern */: + case 167 /* ObjectBindingPattern */: + case 168 /* ArrayBindingPattern */: ts.forEach(node.elements, visit); break; - case 228 /* ExportDeclaration */: + case 236 /* ExportDeclaration */: // Handle named exports case e.g.: // export {a, b as B} from "mod"; if (node.exportClause) { ts.forEach(node.exportClause.elements, visit); } break; - case 222 /* ImportDeclaration */: + case 230 /* ImportDeclaration */: var importClause = node.importClause; if (importClause) { // Handle default import case e.g.: @@ -39167,7 +44547,7 @@ var ts; // import * as NS from "mod"; // import {a, b as B} from "mod"; if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 224 /* NamespaceImport */) { + if (importClause.namedBindings.kind === 232 /* NamespaceImport */) { childNodes.push(importClause.namedBindings); } else { @@ -39176,26 +44556,26 @@ var ts; } } break; - case 163 /* BindingElement */: - case 211 /* VariableDeclaration */: + case 169 /* BindingElement */: + case 218 /* VariableDeclaration */: if (ts.isBindingPattern(node.name)) { visit(node.name); break; } // Fall through - case 214 /* ClassDeclaration */: - case 217 /* EnumDeclaration */: - case 215 /* InterfaceDeclaration */: - case 218 /* ModuleDeclaration */: - case 213 /* FunctionDeclaration */: - case 221 /* ImportEqualsDeclaration */: - case 226 /* ImportSpecifier */: - case 230 /* ExportSpecifier */: + case 221 /* ClassDeclaration */: + case 224 /* EnumDeclaration */: + case 222 /* InterfaceDeclaration */: + case 225 /* ModuleDeclaration */: + case 220 /* FunctionDeclaration */: + case 229 /* ImportEqualsDeclaration */: + case 234 /* ImportSpecifier */: + case 238 /* ExportSpecifier */: childNodes.push(node); break; } } - //for (let i = 0, n = nodes.length; i < n; i++) { + // for (let i = 0, n = nodes.length; i < n; i++) { // let node = nodes[i]; // if (node.kind === SyntaxKind.ClassDeclaration || // node.kind === SyntaxKind.EnumDeclaration || @@ -39207,7 +44587,7 @@ var ts; // else if (node.kind === SyntaxKind.VariableStatement) { // childNodes.push.apply(childNodes, (node).declarations); // } - //} + // } ts.forEach(nodes, visit); return sortNodes(childNodes); } @@ -39238,17 +44618,32 @@ var ts; for (var _i = 0, nodes_4 = nodes; _i < nodes_4.length; _i++) { var node = nodes_4[_i]; switch (node.kind) { - case 214 /* ClassDeclaration */: - case 217 /* EnumDeclaration */: - case 215 /* InterfaceDeclaration */: + case 221 /* ClassDeclaration */: + topLevelNodes.push(node); + for (var _a = 0, _b = node.members; _a < _b.length; _a++) { + var member = _b[_a]; + if (member.kind === 147 /* MethodDeclaration */ || member.kind === 148 /* Constructor */) { + if (member.body) { + // We do not include methods that does not have child functions in it, because of duplications. + if (hasNamedFunctionDeclarations(member.body.statements)) { + topLevelNodes.push(member); + } + addTopLevelNodes(member.body.statements, topLevelNodes); + } + } + } + break; + case 224 /* EnumDeclaration */: + case 222 /* InterfaceDeclaration */: + case 223 /* TypeAliasDeclaration */: topLevelNodes.push(node); break; - case 218 /* ModuleDeclaration */: + case 225 /* ModuleDeclaration */: var moduleDeclaration = node; topLevelNodes.push(node); addTopLevelNodes(getInnermostModule(moduleDeclaration).body.statements, topLevelNodes); break; - case 213 /* FunctionDeclaration */: + case 220 /* FunctionDeclaration */: var functionDeclaration = node; if (isTopLevelFunctionDeclaration(functionDeclaration)) { topLevelNodes.push(node); @@ -39258,20 +44653,36 @@ var ts; } } } + function hasNamedFunctionDeclarations(nodes) { + for (var _i = 0, nodes_5 = nodes; _i < nodes_5.length; _i++) { + var s = nodes_5[_i]; + if (s.kind === 220 /* FunctionDeclaration */ && !isEmpty(s.name.text)) { + return true; + } + } + return false; + } function isTopLevelFunctionDeclaration(functionDeclaration) { - if (functionDeclaration.kind === 213 /* FunctionDeclaration */) { - // A function declaration is 'top level' if it contains any function declarations - // within it. - if (functionDeclaration.body && functionDeclaration.body.kind === 192 /* Block */) { + if (functionDeclaration.kind === 220 /* FunctionDeclaration */) { + // A function declaration is 'top level' if it contains any function declarations + // within it. + if (functionDeclaration.body && functionDeclaration.body.kind === 199 /* Block */) { // Proper function declarations can only have identifier names - if (ts.forEach(functionDeclaration.body.statements, function (s) { return s.kind === 213 /* FunctionDeclaration */ && !isEmpty(s.name.text); })) { + if (hasNamedFunctionDeclarations(functionDeclaration.body.statements)) { return true; } - // Or if it is not parented by another function. i.e all functions - // at module scope are 'top level'. + // Or if it is not parented by another function. I.e all functions at module scope are 'top level'. if (!ts.isFunctionBlock(functionDeclaration.parent)) { return true; } + else { + // We have made sure that a grand parent node exists with 'isFunctionBlock()' above. + var grandParentKind = functionDeclaration.parent.parent.kind; + if (grandParentKind === 147 /* MethodDeclaration */ || + grandParentKind === 148 /* Constructor */) { + return true; + } + } } } return false; @@ -39279,8 +44690,8 @@ var ts; function getItemsWorker(nodes, createItem) { var items = []; var keyToItem = {}; - for (var _i = 0, nodes_5 = nodes; _i < nodes_5.length; _i++) { - var child = nodes_5[_i]; + for (var _i = 0, nodes_6 = nodes; _i < nodes_6.length; _i++) { + var child = nodes_6[_i]; var item = createItem(child); if (item !== undefined) { if (item.text.length > 0) { @@ -39324,44 +44735,44 @@ var ts; } function createChildItem(node) { switch (node.kind) { - case 138 /* Parameter */: + case 142 /* Parameter */: if (ts.isBindingPattern(node.name)) { break; } - if ((node.flags & 1022 /* Modifier */) === 0) { + if ((node.flags & 1023 /* Modifier */) === 0) { return undefined; } return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberFunctionElement); - case 145 /* GetAccessor */: + case 149 /* GetAccessor */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberGetAccessorElement); - case 146 /* SetAccessor */: + case 150 /* SetAccessor */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberSetAccessorElement); - case 149 /* IndexSignature */: + case 153 /* IndexSignature */: return createItem(node, "[]", ts.ScriptElementKind.indexSignatureElement); - case 247 /* EnumMember */: + case 255 /* EnumMember */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); - case 147 /* CallSignature */: + case 151 /* CallSignature */: return createItem(node, "()", ts.ScriptElementKind.callSignatureElement); - case 148 /* ConstructSignature */: + case 152 /* ConstructSignature */: return createItem(node, "new()", ts.ScriptElementKind.constructSignatureElement); - case 141 /* PropertyDeclaration */: - case 140 /* PropertySignature */: + case 145 /* PropertyDeclaration */: + case 144 /* PropertySignature */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); - case 213 /* FunctionDeclaration */: + case 220 /* FunctionDeclaration */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.functionElement); - case 211 /* VariableDeclaration */: - case 163 /* BindingElement */: - var variableDeclarationNode; - var name_33; - if (node.kind === 163 /* BindingElement */) { - name_33 = node.name; + case 218 /* VariableDeclaration */: + case 169 /* BindingElement */: + var variableDeclarationNode = void 0; + var name_35; + if (node.kind === 169 /* BindingElement */) { + name_35 = node.name; variableDeclarationNode = node; // binding elements are added only for variable declarations // bubble up to the containing variable declaration - while (variableDeclarationNode && variableDeclarationNode.kind !== 211 /* VariableDeclaration */) { + while (variableDeclarationNode && variableDeclarationNode.kind !== 218 /* VariableDeclaration */) { variableDeclarationNode = variableDeclarationNode.parent; } ts.Debug.assert(variableDeclarationNode !== undefined); @@ -39369,24 +44780,24 @@ var ts; else { ts.Debug.assert(!ts.isBindingPattern(node.name)); variableDeclarationNode = node; - name_33 = node.name; + name_35 = node.name; } if (ts.isConst(variableDeclarationNode)) { - return createItem(node, getTextOfNode(name_33), ts.ScriptElementKind.constElement); + return createItem(node, getTextOfNode(name_35), ts.ScriptElementKind.constElement); } else if (ts.isLet(variableDeclarationNode)) { - return createItem(node, getTextOfNode(name_33), ts.ScriptElementKind.letElement); + return createItem(node, getTextOfNode(name_35), ts.ScriptElementKind.letElement); } else { - return createItem(node, getTextOfNode(name_33), ts.ScriptElementKind.variableElement); + return createItem(node, getTextOfNode(name_35), ts.ScriptElementKind.variableElement); } - case 144 /* Constructor */: + case 148 /* Constructor */: return createItem(node, "constructor", ts.ScriptElementKind.constructorImplementationElement); - case 230 /* ExportSpecifier */: - case 226 /* ImportSpecifier */: - case 221 /* ImportEqualsDeclaration */: - case 223 /* ImportClause */: - case 224 /* NamespaceImport */: + case 238 /* ExportSpecifier */: + case 234 /* ImportSpecifier */: + case 229 /* ImportEqualsDeclaration */: + case 231 /* ImportClause */: + case 232 /* NamespaceImport */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.alias); } return undefined; @@ -39416,29 +44827,34 @@ var ts; } function createTopLevelItem(node) { switch (node.kind) { - case 248 /* SourceFile */: + case 256 /* SourceFile */: return createSourceFileItem(node); - case 214 /* ClassDeclaration */: + case 221 /* ClassDeclaration */: return createClassItem(node); - case 217 /* EnumDeclaration */: + case 147 /* MethodDeclaration */: + case 148 /* Constructor */: + return createMemberFunctionLikeItem(node); + case 224 /* EnumDeclaration */: return createEnumItem(node); - case 215 /* InterfaceDeclaration */: - return createIterfaceItem(node); - case 218 /* ModuleDeclaration */: + case 222 /* InterfaceDeclaration */: + return createInterfaceItem(node); + case 225 /* ModuleDeclaration */: return createModuleItem(node); - case 213 /* FunctionDeclaration */: + case 220 /* FunctionDeclaration */: return createFunctionItem(node); + case 223 /* TypeAliasDeclaration */: + return createTypeAliasItem(node); } return undefined; function getModuleName(moduleDeclaration) { // We want to maintain quotation marks. - if (moduleDeclaration.name.kind === 9 /* StringLiteral */) { + if (ts.isAmbientModule(moduleDeclaration)) { return getTextOfNode(moduleDeclaration.name); } // Otherwise, we need to aggregate each identifier to build up the qualified name. var result = []; result.push(moduleDeclaration.name.text); - while (moduleDeclaration.body && moduleDeclaration.body.kind === 218 /* ModuleDeclaration */) { + while (moduleDeclaration.body && moduleDeclaration.body.kind === 225 /* ModuleDeclaration */) { moduleDeclaration = moduleDeclaration.body; result.push(moduleDeclaration.name.text); } @@ -39450,12 +44866,32 @@ var ts; return getNavigationBarItem(moduleName, ts.ScriptElementKind.moduleElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } function createFunctionItem(node) { - if (node.body && node.body.kind === 192 /* Block */) { + if (node.body && node.body.kind === 199 /* Block */) { var childItems = getItemsWorker(sortNodes(node.body.statements), createChildItem); return getNavigationBarItem(!node.name ? "default" : node.name.text, ts.ScriptElementKind.functionElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } return undefined; } + function createTypeAliasItem(node) { + return getNavigationBarItem(node.name.text, ts.ScriptElementKind.typeElement, ts.getNodeModifiers(node), [getNodeSpan(node)], [], getIndent(node)); + } + function createMemberFunctionLikeItem(node) { + if (node.body && node.body.kind === 199 /* Block */) { + var childItems = getItemsWorker(sortNodes(node.body.statements), createChildItem); + var scriptElementKind = void 0; + var memberFunctionName = void 0; + if (node.kind === 147 /* MethodDeclaration */) { + memberFunctionName = ts.getPropertyNameForPropertyNameNode(node.name); + scriptElementKind = ts.ScriptElementKind.memberFunctionElement; + } + else { + memberFunctionName = "constructor"; + scriptElementKind = ts.ScriptElementKind.constructorImplementationElement; + } + return getNavigationBarItem(memberFunctionName, scriptElementKind, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); + } + return undefined; + } function createSourceFileItem(node) { var childItems = getItemsWorker(getChildNodes(node.statements), createChildItem); if (childItems === undefined || childItems.length === 0) { @@ -39471,7 +44907,7 @@ var ts; var childItems; if (node.members) { var constructor = ts.forEach(node.members, function (member) { - return member.kind === 144 /* Constructor */ && member; + return member.kind === 148 /* Constructor */ && member; }); // Add the constructor parameters in as children of the class (for property parameters). // Note that *all non-binding pattern named* parameters will be added to the nodes array, but parameters that @@ -39489,13 +44925,13 @@ var ts; var childItems = getItemsWorker(sortNodes(removeComputedProperties(node)), createChildItem); return getNavigationBarItem(node.name.text, ts.ScriptElementKind.enumElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } - function createIterfaceItem(node) { + function createInterfaceItem(node) { var childItems = getItemsWorker(sortNodes(removeDynamicallyNamedProperties(node)), createChildItem); return getNavigationBarItem(node.name.text, ts.ScriptElementKind.interfaceElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } } function removeComputedProperties(node) { - return ts.filter(node.members, function (member) { return member.name === undefined || member.name.kind !== 136 /* ComputedPropertyName */; }); + return ts.filter(node.members, function (member) { return member.name === undefined || member.name.kind !== 140 /* ComputedPropertyName */; }); } /** * Like removeComputedProperties, but retains the properties with well known symbol names @@ -39504,13 +44940,13 @@ var ts; return ts.filter(node.members, function (member) { return !ts.hasDynamicName(member); }); } function getInnermostModule(node) { - while (node.body.kind === 218 /* ModuleDeclaration */) { + while (node.body.kind === 225 /* ModuleDeclaration */) { node = node.body; } return node; } function getNodeSpan(node) { - return node.kind === 248 /* SourceFile */ + return node.kind === 256 /* SourceFile */ ? ts.createTextSpanFromBounds(node.getFullStart(), node.getEnd()) : ts.createTextSpanFromBounds(node.getStart(), node.getEnd()); } @@ -39519,6 +44955,185 @@ var ts; } } NavigationBar.getNavigationBarItems = getNavigationBarItems; + function getJsNavigationBarItems(sourceFile, compilerOptions) { + var anonFnText = ""; + var anonClassText = ""; + var indent = 0; + var rootName = ts.isExternalModule(sourceFile) ? + "\"" + ts.escapeString(ts.getBaseFileName(ts.removeFileExtension(ts.normalizePath(sourceFile.fileName)))) + "\"" + : ""; + var sourceFileItem = getNavBarItem(rootName, ts.ScriptElementKind.moduleElement, [getNodeSpan(sourceFile)]); + var topItem = sourceFileItem; + // Walk the whole file, because we want to also find function expressions - which may be in variable initializer, + // call arguments, expressions, etc... + ts.forEachChild(sourceFile, visitNode); + function visitNode(node) { + var newItem = createNavBarItem(node); + if (newItem) { + topItem.childItems.push(newItem); + } + // Add a level if traversing into a container + if (newItem && (ts.isFunctionLike(node) || ts.isClassLike(node))) { + var lastTop = topItem; + indent++; + topItem = newItem; + ts.forEachChild(node, visitNode); + topItem = lastTop; + indent--; + // If the last item added was an anonymous function expression, and it had no children, discard it. + if (newItem && newItem.text === anonFnText && newItem.childItems.length === 0) { + topItem.childItems.pop(); + } + } + else { + ts.forEachChild(node, visitNode); + } + } + function createNavBarItem(node) { + switch (node.kind) { + case 218 /* VariableDeclaration */: + // Only add to the navbar if at the top-level of the file + // Note: "const" and "let" are also SyntaxKind.VariableDeclarations + if (node.parent /*VariableDeclarationList*/.parent /*VariableStatement*/ + .parent /*SourceFile*/.kind !== 256 /* SourceFile */) { + return undefined; + } + // If it is initialized with a function expression, handle it when we reach the function expression node + var varDecl = node; + if (varDecl.initializer && (varDecl.initializer.kind === 179 /* FunctionExpression */ || + varDecl.initializer.kind === 180 /* ArrowFunction */ || + varDecl.initializer.kind === 192 /* ClassExpression */)) { + return undefined; + } + // Fall through + case 220 /* FunctionDeclaration */: + case 221 /* ClassDeclaration */: + case 148 /* Constructor */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: + // "export default function().." looks just like a regular function/class declaration, except with the 'default' flag + var name_36 = node.flags && (node.flags & 512 /* Default */) && !node.name ? "default" : + node.kind === 148 /* Constructor */ ? "constructor" : + ts.declarationNameToString(node.name); + return getNavBarItem(name_36, getScriptKindForElementKind(node.kind), [getNodeSpan(node)]); + case 179 /* FunctionExpression */: + case 180 /* ArrowFunction */: + case 192 /* ClassExpression */: + return getDefineModuleItem(node) || getFunctionOrClassExpressionItem(node); + case 147 /* MethodDeclaration */: + var methodDecl = node; + return getNavBarItem(ts.declarationNameToString(methodDecl.name), ts.ScriptElementKind.memberFunctionElement, [getNodeSpan(node)]); + case 235 /* ExportAssignment */: + // e.g. "export default " + return getNavBarItem("default", ts.ScriptElementKind.variableElement, [getNodeSpan(node)]); + case 231 /* ImportClause */: + if (!node.name) { + // No default import (this node is still a parent of named & namespace imports, which are handled below) + return undefined; + } + // fall through + case 234 /* ImportSpecifier */: // e.g. 'id' in: import {id} from 'mod' (in NamedImports, in ImportClause) + case 232 /* NamespaceImport */: // e.g. '* as ns' in: import * as ns from 'mod' (in ImportClause) + case 238 /* ExportSpecifier */: + // Export specifiers are only interesting if they are reexports from another module, or renamed, else they are already globals + if (node.kind === 238 /* ExportSpecifier */) { + if (!node.parent.parent.moduleSpecifier && !node.propertyName) { + return undefined; + } + } + var decl = node; + if (!decl.name) { + return undefined; + } + var declName = ts.declarationNameToString(decl.name); + return getNavBarItem(declName, ts.ScriptElementKind.constElement, [getNodeSpan(node)]); + default: + return undefined; + } + } + function getNavBarItem(text, kind, spans, kindModifiers) { + if (kindModifiers === void 0) { kindModifiers = ts.ScriptElementKindModifier.none; } + return { + text: text, kind: kind, kindModifiers: kindModifiers, spans: spans, childItems: [], indent: indent, bolded: false, grayed: false + }; + } + function getDefineModuleItem(node) { + if (node.kind !== 179 /* FunctionExpression */ && node.kind !== 180 /* ArrowFunction */) { + return undefined; + } + // No match if this is not a call expression to an identifier named 'define' + if (node.parent.kind !== 174 /* CallExpression */) { + return undefined; + } + var callExpr = node.parent; + if (callExpr.expression.kind !== 69 /* Identifier */ || callExpr.expression.getText() !== "define") { + return undefined; + } + // Return a module of either the given text in the first argument, or of the source file path + var defaultName = node.getSourceFile().fileName; + if (callExpr.arguments[0].kind === 9 /* StringLiteral */) { + defaultName = (callExpr.arguments[0]).text; + } + return getNavBarItem(defaultName, ts.ScriptElementKind.moduleElement, [getNodeSpan(node.parent)]); + } + function getFunctionOrClassExpressionItem(node) { + if (node.kind !== 179 /* FunctionExpression */ && + node.kind !== 180 /* ArrowFunction */ && + node.kind !== 192 /* ClassExpression */) { + return undefined; + } + var fnExpr = node; + var fnName; + if (fnExpr.name && ts.getFullWidth(fnExpr.name) > 0) { + // The expression has an identifier, so use that as the name + fnName = ts.declarationNameToString(fnExpr.name); + } + else { + // See if it is a var initializer. If so, use the var name. + if (fnExpr.parent.kind === 218 /* VariableDeclaration */) { + fnName = ts.declarationNameToString(fnExpr.parent.name); + } + else if (fnExpr.parent.kind === 187 /* BinaryExpression */ && + fnExpr.parent.operatorToken.kind === 56 /* EqualsToken */) { + fnName = fnExpr.parent.left.getText(); + } + else if (fnExpr.parent.kind === 253 /* PropertyAssignment */ && + fnExpr.parent.name) { + fnName = fnExpr.parent.name.getText(); + } + else { + fnName = node.kind === 192 /* ClassExpression */ ? anonClassText : anonFnText; + } + } + var scriptKind = node.kind === 192 /* ClassExpression */ ? ts.ScriptElementKind.classElement : ts.ScriptElementKind.functionElement; + return getNavBarItem(fnName, scriptKind, [getNodeSpan(node)]); + } + function getNodeSpan(node) { + return node.kind === 256 /* SourceFile */ + ? ts.createTextSpanFromBounds(node.getFullStart(), node.getEnd()) + : ts.createTextSpanFromBounds(node.getStart(), node.getEnd()); + } + function getScriptKindForElementKind(kind) { + switch (kind) { + case 218 /* VariableDeclaration */: + return ts.ScriptElementKind.variableElement; + case 220 /* FunctionDeclaration */: + return ts.ScriptElementKind.functionElement; + case 221 /* ClassDeclaration */: + return ts.ScriptElementKind.classElement; + case 148 /* Constructor */: + return ts.ScriptElementKind.constructorImplementationElement; + case 149 /* GetAccessor */: + return ts.ScriptElementKind.memberGetAccessorElement; + case 150 /* SetAccessor */: + return ts.ScriptElementKind.memberSetAccessorElement; + default: + return "unknown"; + } + } + return sourceFileItem.childItems; + } + NavigationBar.getJsNavigationBarItems = getJsNavigationBarItems; })(NavigationBar = ts.NavigationBar || (ts.NavigationBar = {})); })(ts || (ts = {})); /* @internal */ @@ -39542,12 +45157,11 @@ var ts; } function createPatternMatcher(pattern) { // We'll often see the same candidate string many times when searching (For example, when - // we see the name of a module that is used everywhere, or the name of an overload). As - // such, we cache the information we compute about the candidate for the life of this + // we see the name of a module that is used everywhere, or the name of an overload). As + // such, we cache the information we compute about the candidate for the life of this // pattern matcher so we don't have to compute it multiple times. var stringToWordSpans = {}; pattern = pattern.trim(); - var fullPatternSegment = createSegment(pattern); var dotSeparatedSegments = pattern.split(".").map(function (p) { return createSegment(p.trim()); }); var invalidPattern = dotSeparatedSegments.length === 0 || ts.forEach(dotSeparatedSegments, segmentIsInvalid); return { @@ -39587,7 +45201,7 @@ var ts; // So far so good. Now break up the container for the candidate and check if all // the dotted parts match up correctly. var totalMatch = candidateMatch; - for (var i = dotSeparatedSegments.length - 2, j = candidateContainers.length - 1; i >= 0; i--, j--) { + for (var i = dotSeparatedSegments.length - 2, j = candidateContainers.length - 1; i >= 0; i -= 1, j -= 1) { var segment = dotSeparatedSegments[i]; var containerName = candidateContainers[j]; var containerMatch = matchSegment(containerName, segment); @@ -39626,7 +45240,7 @@ var ts; if (index > 0) { // c) If the part is entirely lowercase, then check if it is contained anywhere in the // candidate in a case insensitive manner. If so, return that there was a substring - // match. + // match. // // Note: We only have a substring match if the lowercase part is prefix match of some // word part. That way we don't match something like 'Class' when the user types 'a'. @@ -39666,8 +45280,8 @@ var ts; if (isLowercase) { // f) Is the pattern a substring of the candidate starting on one of the candidate's word boundaries? // We could check every character boundary start of the candidate for the pattern. However, that's - // an m * n operation in the wost case. Instead, find the first instance of the pattern - // substring, and see if it starts on a capital letter. It seems unlikely that the user will try to + // an m * n operation in the wost case. Instead, find the first instance of the pattern + // substring, and see if it starts on a capital letter. It seems unlikely that the user will try to // filter the list based on a substring that starts on a capital letter and also with a lowercase one. // (Pattern: fogbar, Candidate: quuxfogbarFogBar). if (chunk.text.length < candidate.length) { @@ -39719,7 +45333,7 @@ var ts; // // c) If the word is entirely lowercase, then check if it is contained anywhere in the // candidate in a case insensitive manner. If so, return that there was a substring - // match. + // match. // // Note: We only have a substring match if the lowercase part is prefix match of // some word part. That way we don't match something like 'Class' when the user @@ -39733,7 +45347,7 @@ var ts; // e) If the word was not entirely lowercase, then attempt a camel cased match as // well. // - // f) The word is all lower case. Is it a case insensitive substring of the candidate starting + // f) The word is all lower case. Is it a case insensitive substring of the candidate starting // on a part boundary of the candidate? // // Only if all words have some sort of match is the pattern considered matched. @@ -39783,7 +45397,7 @@ var ts; // Note: we may have more pattern parts than candidate parts. This is because multiple // pattern parts may match a candidate part. For example "SiUI" against "SimpleUI". // We'll have 3 pattern parts Si/U/I against two candidate parts Simple/UI. However, U - // and I will both match in UI. + // and I will both match in UI. var currentCandidate = 0; var currentChunkSpan = 0; var firstMatch = undefined; @@ -39812,13 +45426,13 @@ var ts; // Consider the case of matching SiUI against SimpleUIElement. The candidate parts // will be Simple/UI/Element, and the pattern parts will be Si/U/I. We'll match 'Si' // against 'Simple' first. Then we'll match 'U' against 'UI'. However, we want to - // still keep matching pattern parts against that candidate part. + // still keep matching pattern parts against that candidate part. for (; currentChunkSpan < chunkCharacterSpans.length; currentChunkSpan++) { var chunkCharacterSpan = chunkCharacterSpans[currentChunkSpan]; if (gotOneMatchThisCandidate) { // We've already gotten one pattern part match in this candidate. We will // only continue trying to consumer pattern parts if the last part and this - // part are both upper case. + // part are both upper case. if (!isUpperCaseLetter(chunk.text.charCodeAt(chunkCharacterSpans[currentChunkSpan - 1].start)) || !isUpperCaseLetter(chunk.text.charCodeAt(chunkCharacterSpans[currentChunkSpan].start))) { break; @@ -39848,42 +45462,6 @@ var ts; } } ts.createPatternMatcher = createPatternMatcher; - // Helper function to compare two matches to determine which is better. Matches are first - // ordered by kind (so all prefix matches always beat all substring matches). Then, if the - // match is a camel case match, the relative weights of the match are used to determine - // which is better (with a greater weight being better). Then if the match is of the same - // type, then a case sensitive match is considered better than an insensitive one. - function patternMatchCompareTo(match1, match2) { - return compareType(match1, match2) || - compareCamelCase(match1, match2) || - compareCase(match1, match2) || - comparePunctuation(match1, match2); - } - function comparePunctuation(result1, result2) { - // Consider a match to be better if it was successful without stripping punctuation - // versus a match that had to strip punctuation to succeed. - if (result1.punctuationStripped !== result2.punctuationStripped) { - return result1.punctuationStripped ? 1 : -1; - } - return 0; - } - function compareCase(result1, result2) { - if (result1.isCaseSensitive !== result2.isCaseSensitive) { - return result1.isCaseSensitive ? -1 : 1; - } - return 0; - } - function compareType(result1, result2) { - return result1.kind - result2.kind; - } - function compareCamelCase(result1, result2) { - if (result1.kind === PatternMatchKind.camelCase && result2.kind === PatternMatchKind.camelCase) { - // Swap the values here. If result1 has a higher weight, then we want it to come - // first. - return result2.camelCaseWeight - result1.camelCaseWeight; - } - return 0; - } function createSegment(text) { return { totalTextChunk: createTextChunk(text), @@ -39902,7 +45480,7 @@ var ts; if (ch < 127 /* maxAsciiCharacter */ || !ts.isUnicodeIdentifierStart(ch, 2 /* Latest */)) { return false; } - // TODO: find a way to determine this for any unicode characters in a + // TODO: find a way to determine this for any unicode characters in a // non-allocating manner. var str = String.fromCharCode(ch); return str === str.toUpperCase(); @@ -39915,19 +45493,11 @@ var ts; if (ch < 127 /* maxAsciiCharacter */ || !ts.isUnicodeIdentifierStart(ch, 2 /* Latest */)) { return false; } - // TODO: find a way to determine this for any unicode characters in a + // TODO: find a way to determine this for any unicode characters in a // non-allocating manner. var str = String.fromCharCode(ch); return str === str.toLowerCase(); } - function containsUpperCaseLetter(string) { - for (var i = 0, n = string.length; i < n; i++) { - if (isUpperCaseLetter(string.charCodeAt(i))) { - return true; - } - } - return false; - } function startsWith(string, search) { for (var i = 0, n = search.length; i < n; i++) { if (string.charCodeAt(i) !== search.charCodeAt(i)) { @@ -39964,7 +45534,7 @@ var ts; if (ch < 127 /* maxAsciiCharacter */) { return ch; } - // TODO: find a way to compute this for any unicode characters in a + // TODO: find a way to compute this for any unicode characters in a // non-allocating manner. return String.fromCharCode(ch).toLowerCase().charCodeAt(0); } @@ -39982,9 +45552,10 @@ var ts; for (var i = 0; i < pattern.length; i++) { var ch = pattern.charCodeAt(i); if (isWordChar(ch)) { - if (wordLength++ === 0) { + if (wordLength === 0) { wordStart = i; } + wordLength++; } else { if (wordLength > 0) { @@ -40115,7 +45686,7 @@ var ts; var currentIsUpper = isUpperCaseLetter(identifier.charCodeAt(index)); // See if the casing indicates we're starting a new word. Note: if we're breaking on // words, then just seeing an upper case character isn't enough. Instead, it has to - // be uppercase and the previous character can't be uppercase. + // be uppercase and the previous character can't be uppercase. // // For example, breaking "AddMetadata" on words would make: Add Metadata // @@ -40179,7 +45750,7 @@ var ts; // break; // case TypeScript.SyntaxKind.GreaterThanGreaterThanGreaterThanToken: // stack++; - // // Intentaion fall through + // // Intentional fall through // case TypeScript.SyntaxKind.GreaterThanToken: // stack++; // break; @@ -40199,7 +45770,7 @@ var ts; // } // break; // case TypeScript.SyntaxKind.EqualsGreaterThanToken: - // // This can be a function type or a constructor type. In either case, we want to skip the function defintion + // // This can be a function type or a constructor type. In either case, we want to skip the function definition // token = previousToken(token, /*includeSkippedTokens*/ true); // if (token && token.kind() === TypeScript.SyntaxKind.CloseParenToken) { // // Skip untill the matching open paren token @@ -40218,7 +45789,7 @@ var ts; // } // } // else { - // // This is not a funtion type. exit the main loop + // // This is not a function type. exit the main loop // break whileLoop; // } // break; @@ -40305,7 +45876,7 @@ var ts; } return createSignatureHelpItems(candidates, resolvedSignature, argumentInfo); function createJavaScriptSignatureHelpItems(argumentInfo) { - if (argumentInfo.invocation.kind !== 168 /* CallExpression */) { + if (argumentInfo.invocation.kind !== 174 /* CallExpression */) { return undefined; } // See if we can find some symbol with the call expression name that has call signatures. @@ -40313,7 +45884,7 @@ var ts; var expression = callExpression.expression; var name = expression.kind === 69 /* Identifier */ ? expression - : expression.kind === 166 /* PropertyAccessExpression */ + : expression.kind === 172 /* PropertyAccessExpression */ ? expression.name : undefined; if (!name || !name.text) { @@ -40325,8 +45896,8 @@ var ts; var nameToDeclarations = sourceFile_1.getNamedDeclarations(); var declarations = ts.getProperty(nameToDeclarations, name.text); if (declarations) { - for (var _b = 0, declarations_7 = declarations; _b < declarations_7.length; _b++) { - var declaration = declarations_7[_b]; + for (var _b = 0, declarations_8 = declarations; _b < declarations_8.length; _b++) { + var declaration = declarations_8[_b]; var symbol = declaration.symbol; if (symbol) { var type = typeChecker.getTypeOfSymbolAtLocation(symbol, declaration); @@ -40346,7 +45917,7 @@ var ts; * in the argument of an invocation; returns undefined otherwise. */ function getImmediatelyContainingArgumentInfo(node) { - if (node.parent.kind === 168 /* CallExpression */ || node.parent.kind === 169 /* NewExpression */) { + if (node.parent.kind === 174 /* CallExpression */ || node.parent.kind === 175 /* NewExpression */) { var callExpression = node.parent; // There are 3 cases to handle: // 1. The token introduces a list, and should begin a sig help session @@ -40399,25 +45970,25 @@ var ts; }; } } - else if (node.kind === 11 /* NoSubstitutionTemplateLiteral */ && node.parent.kind === 170 /* TaggedTemplateExpression */) { + else if (node.kind === 11 /* NoSubstitutionTemplateLiteral */ && node.parent.kind === 176 /* TaggedTemplateExpression */) { // Check if we're actually inside the template; // otherwise we'll fall out and return undefined. if (ts.isInsideTemplateLiteral(node, position)) { return getArgumentListInfoForTemplate(node.parent, /*argumentIndex*/ 0); } } - else if (node.kind === 12 /* TemplateHead */ && node.parent.parent.kind === 170 /* TaggedTemplateExpression */) { + else if (node.kind === 12 /* TemplateHead */ && node.parent.parent.kind === 176 /* TaggedTemplateExpression */) { var templateExpression = node.parent; var tagExpression = templateExpression.parent; - ts.Debug.assert(templateExpression.kind === 183 /* TemplateExpression */); + ts.Debug.assert(templateExpression.kind === 189 /* TemplateExpression */); var argumentIndex = ts.isInsideTemplateLiteral(node, position) ? 0 : 1; return getArgumentListInfoForTemplate(tagExpression, argumentIndex); } - else if (node.parent.kind === 190 /* TemplateSpan */ && node.parent.parent.parent.kind === 170 /* TaggedTemplateExpression */) { + else if (node.parent.kind === 197 /* TemplateSpan */ && node.parent.parent.parent.kind === 176 /* TaggedTemplateExpression */) { var templateSpan = node.parent; var templateExpression = templateSpan.parent; var tagExpression = templateExpression.parent; - ts.Debug.assert(templateExpression.kind === 183 /* TemplateExpression */); + ts.Debug.assert(templateExpression.kind === 189 /* TemplateExpression */); // If we're just after a template tail, don't show signature help. if (node.kind === 14 /* TemplateTail */ && !ts.isInsideTemplateLiteral(node, position)) { return undefined; @@ -40535,7 +46106,7 @@ var ts; // // This is because a Missing node has no width. However, what we actually want is to include trivia // leading up to the next token in case the user is about to type in a TemplateMiddle or TemplateTail. - if (template.kind === 183 /* TemplateExpression */) { + if (template.kind === 189 /* TemplateExpression */) { var lastSpan = ts.lastOrUndefined(template.templateSpans); if (lastSpan.literal.getFullWidth() === 0) { applicableSpanEnd = ts.skipTrivia(sourceFile.text, applicableSpanEnd, /*stopAfterLineBreak*/ false); @@ -40544,7 +46115,7 @@ var ts; return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart); } function getContainingArgumentInfo(node) { - for (var n = node; n.kind !== 248 /* SourceFile */; n = n.parent) { + for (var n = node; n.kind !== 256 /* SourceFile */; n = n.parent) { if (ts.isFunctionBlock(n)) { return undefined; } @@ -40609,7 +46180,7 @@ var ts; signatureHelpParameters = typeParameters && typeParameters.length > 0 ? ts.map(typeParameters, createSignatureHelpParameterForTypeParameter) : emptyArray; suffixDisplayParts.push(ts.punctuationPart(27 /* GreaterThanToken */)); var parameterParts = ts.mapToDisplayParts(function (writer) { - return typeChecker.getSymbolDisplayBuilder().buildDisplayForParametersAndDelimiters(candidateSignature.parameters, writer, invocation); + return typeChecker.getSymbolDisplayBuilder().buildDisplayForParametersAndDelimiters(candidateSignature.thisType, candidateSignature.parameters, writer, invocation); }); ts.addRange(suffixDisplayParts, parameterParts); } @@ -40682,31 +46253,6 @@ var ts; /* @internal */ var ts; (function (ts) { - function getEndLinePosition(line, sourceFile) { - ts.Debug.assert(line >= 0); - var lineStarts = sourceFile.getLineStarts(); - var lineIndex = line; - if (lineIndex + 1 === lineStarts.length) { - // last line - return EOF - return sourceFile.text.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(sourceFile.text.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(sourceFile.text.charCodeAt(pos))) { - pos--; - } - return pos; - } - } - ts.getEndLinePosition = getEndLinePosition; function getLineStartPositionForPosition(position, sourceFile) { var lineStarts = sourceFile.getLineStarts(); var line = sourceFile.getLineAndCharacterOfPosition(position).line; @@ -40744,40 +46290,40 @@ var ts; return false; } switch (n.kind) { - case 214 /* ClassDeclaration */: - case 215 /* InterfaceDeclaration */: - case 217 /* EnumDeclaration */: - case 165 /* ObjectLiteralExpression */: - case 161 /* ObjectBindingPattern */: - case 155 /* TypeLiteral */: - case 192 /* Block */: - case 219 /* ModuleBlock */: - case 220 /* CaseBlock */: + case 221 /* ClassDeclaration */: + case 222 /* InterfaceDeclaration */: + case 224 /* EnumDeclaration */: + case 171 /* ObjectLiteralExpression */: + case 167 /* ObjectBindingPattern */: + case 159 /* TypeLiteral */: + case 199 /* Block */: + case 226 /* ModuleBlock */: + case 227 /* CaseBlock */: return nodeEndsWith(n, 16 /* CloseBraceToken */, sourceFile); - case 244 /* CatchClause */: + case 252 /* CatchClause */: return isCompletedNode(n.block, sourceFile); - case 169 /* NewExpression */: + case 175 /* NewExpression */: if (!n.arguments) { return true; } // fall through - case 168 /* CallExpression */: - case 172 /* ParenthesizedExpression */: - case 160 /* ParenthesizedType */: + case 174 /* CallExpression */: + case 178 /* ParenthesizedExpression */: + case 164 /* ParenthesizedType */: return nodeEndsWith(n, 18 /* CloseParenToken */, sourceFile); - case 152 /* FunctionType */: - case 153 /* ConstructorType */: + case 156 /* FunctionType */: + case 157 /* ConstructorType */: return isCompletedNode(n.type, sourceFile); - case 144 /* Constructor */: - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: - case 213 /* FunctionDeclaration */: - case 173 /* FunctionExpression */: - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - case 148 /* ConstructSignature */: - case 147 /* CallSignature */: - case 174 /* ArrowFunction */: + case 148 /* Constructor */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: + case 220 /* FunctionDeclaration */: + case 179 /* FunctionExpression */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: + case 152 /* ConstructSignature */: + case 151 /* CallSignature */: + case 180 /* ArrowFunction */: if (n.body) { return isCompletedNode(n.body, sourceFile); } @@ -40787,64 +46333,64 @@ var ts; // Even though type parameters can be unclosed, we can get away with // having at least a closing paren. return hasChildOfKind(n, 18 /* CloseParenToken */, sourceFile); - case 218 /* ModuleDeclaration */: + case 225 /* ModuleDeclaration */: return n.body && isCompletedNode(n.body, sourceFile); - case 196 /* IfStatement */: + case 203 /* IfStatement */: if (n.elseStatement) { return isCompletedNode(n.elseStatement, sourceFile); } return isCompletedNode(n.thenStatement, sourceFile); - case 195 /* ExpressionStatement */: + case 202 /* ExpressionStatement */: return isCompletedNode(n.expression, sourceFile) || hasChildOfKind(n, 23 /* SemicolonToken */); - case 164 /* ArrayLiteralExpression */: - case 162 /* ArrayBindingPattern */: - case 167 /* ElementAccessExpression */: - case 136 /* ComputedPropertyName */: - case 157 /* TupleType */: + case 170 /* ArrayLiteralExpression */: + case 168 /* ArrayBindingPattern */: + case 173 /* ElementAccessExpression */: + case 140 /* ComputedPropertyName */: + case 161 /* TupleType */: return nodeEndsWith(n, 20 /* CloseBracketToken */, sourceFile); - case 149 /* IndexSignature */: + case 153 /* IndexSignature */: if (n.type) { return isCompletedNode(n.type, sourceFile); } return hasChildOfKind(n, 20 /* CloseBracketToken */, sourceFile); - case 241 /* CaseClause */: - case 242 /* DefaultClause */: - // there is no such thing as terminator token for CaseClause/DefaultClause so for simplicitly always consider them non-completed + case 249 /* CaseClause */: + case 250 /* DefaultClause */: + // there is no such thing as terminator token for CaseClause/DefaultClause so for simplicity always consider them non-completed return false; - case 199 /* ForStatement */: - case 200 /* ForInStatement */: - case 201 /* ForOfStatement */: - case 198 /* WhileStatement */: + case 206 /* ForStatement */: + case 207 /* ForInStatement */: + case 208 /* ForOfStatement */: + case 205 /* WhileStatement */: return isCompletedNode(n.statement, sourceFile); - case 197 /* DoStatement */: + case 204 /* DoStatement */: // rough approximation: if DoStatement has While keyword - then if node is completed is checking the presence of ')'; var hasWhileKeyword = findChildOfKind(n, 104 /* WhileKeyword */, sourceFile); if (hasWhileKeyword) { return nodeEndsWith(n, 18 /* CloseParenToken */, sourceFile); } return isCompletedNode(n.statement, sourceFile); - case 154 /* TypeQuery */: + case 158 /* TypeQuery */: return isCompletedNode(n.exprName, sourceFile); - case 176 /* TypeOfExpression */: - case 175 /* DeleteExpression */: - case 177 /* VoidExpression */: - case 184 /* YieldExpression */: - case 185 /* SpreadElementExpression */: + case 182 /* TypeOfExpression */: + case 181 /* DeleteExpression */: + case 183 /* VoidExpression */: + case 190 /* YieldExpression */: + case 191 /* SpreadElementExpression */: var unaryWordExpression = n; return isCompletedNode(unaryWordExpression.expression, sourceFile); - case 170 /* TaggedTemplateExpression */: + case 176 /* TaggedTemplateExpression */: return isCompletedNode(n.template, sourceFile); - case 183 /* TemplateExpression */: + case 189 /* TemplateExpression */: var lastSpan = ts.lastOrUndefined(n.templateSpans); return isCompletedNode(lastSpan, sourceFile); - case 190 /* TemplateSpan */: + case 197 /* TemplateSpan */: return ts.nodeIsPresent(n.literal); - case 179 /* PrefixUnaryExpression */: + case 185 /* PrefixUnaryExpression */: return isCompletedNode(n.operand, sourceFile); - case 181 /* BinaryExpression */: + case 187 /* BinaryExpression */: return isCompletedNode(n.right, sourceFile); - case 182 /* ConditionalExpression */: + case 188 /* ConditionalExpression */: return isCompletedNode(n.whenFalse, sourceFile); default: return true; @@ -40900,7 +46446,7 @@ var ts; // for the position of the relevant node (or comma). var syntaxList = ts.forEach(node.parent.getChildren(), function (c) { // find syntax list that covers the span of the node - if (c.kind === 271 /* SyntaxList */ && c.pos <= node.pos && c.end >= node.end) { + if (c.kind === 279 /* SyntaxList */ && c.pos <= node.pos && c.end >= node.end) { return c; } }); @@ -40917,7 +46463,7 @@ var ts; } ts.getTouchingWord = getTouchingWord; /* Gets the token whose text has range [start, end) and position >= start - * and (position < end or (position === end && token is keyword or identifier or numeric\string litera)) + * and (position < end or (position === end && token is keyword or identifier or numeric/string literal)) */ function getTouchingPropertyName(sourceFile, position) { return getTouchingToken(sourceFile, position, function (n) { return isPropertyName(n.kind); }); @@ -41006,7 +46552,7 @@ var ts; function findPrecedingToken(position, sourceFile, startNode) { return find(startNode || sourceFile); function findRightmostToken(n) { - if (isToken(n) || n.kind === 236 /* JsxText */) { + if (isToken(n) || n.kind === 244 /* JsxText */) { return n; } var children = n.getChildren(); @@ -41014,7 +46560,7 @@ var ts; return candidate && findRightmostToken(candidate); } function find(n) { - if (isToken(n) || n.kind === 236 /* JsxText */) { + if (isToken(n) || n.kind === 244 /* JsxText */) { return n; } var children = n.getChildren(); @@ -41028,10 +46574,10 @@ var ts; // if no - position is in the node itself so we should recurse in it. // NOTE: JsxText is a weird kind of node that can contain only whitespaces (since they are not counted as trivia). // if this is the case - then we should assume that token in question is located in previous child. - if (position < child.end && (nodeHasTokens(child) || child.kind === 236 /* JsxText */)) { + if (position < child.end && (nodeHasTokens(child) || child.kind === 244 /* JsxText */)) { var start = child.getStart(sourceFile); var lookInPreviousChild = (start >= position) || - (child.kind === 236 /* JsxText */ && start === child.end); // whitespace only JsxText + (child.kind === 244 /* JsxText */ && start === child.end); // whitespace only JsxText if (lookInPreviousChild) { // actual start of the node is past the position - previous token should be at the end of previous child var candidate = findRightmostChildNodeWithTokens(children, /*exclusiveStartPosition*/ i); @@ -41043,8 +46589,8 @@ var ts; } } } - ts.Debug.assert(startNode !== undefined || n.kind === 248 /* SourceFile */); - // Here we know that none of child token nodes embrace the position, + ts.Debug.assert(startNode !== undefined || n.kind === 256 /* SourceFile */); + // Here we know that none of child token nodes embrace the position, // the only known case is when position is at the end of the file. // Try to find the rightmost token in the file without filtering. // Namely we are skipping the check: 'position < node.end' @@ -41065,20 +46611,54 @@ var ts; ts.findPrecedingToken = findPrecedingToken; function isInString(sourceFile, position) { var token = getTokenAtPosition(sourceFile, position); - return token && token.kind === 9 /* StringLiteral */ && position > token.getStart(); + return token && (token.kind === 9 /* StringLiteral */ || token.kind === 166 /* StringLiteralType */) && position > token.getStart(sourceFile); } ts.isInString = isInString; function isInComment(sourceFile, position) { return isInCommentHelper(sourceFile, position, /*predicate*/ undefined); } ts.isInComment = isInComment; + /** + * returns true if the position is in between the open and close elements of an JSX expression. + */ + function isInsideJsxElementOrAttribute(sourceFile, position) { + var token = getTokenAtPosition(sourceFile, position); + if (!token) { + return false; + } + //
Hello |
+ if (token.kind === 25 /* LessThanToken */ && token.parent.kind === 244 /* JsxText */) { + return true; + } + //
{ |
or
+ if (token.kind === 25 /* LessThanToken */ && token.parent.kind === 248 /* JsxExpression */) { + return true; + } + //
{ + // | + // } < /div> + if (token && token.kind === 16 /* CloseBraceToken */ && token.parent.kind === 248 /* JsxExpression */) { + return true; + } + //
|
+ if (token.kind === 25 /* LessThanToken */ && token.parent.kind === 245 /* JsxClosingElement */) { + return true; + } + return false; + } + ts.isInsideJsxElementOrAttribute = isInsideJsxElementOrAttribute; + function isInTemplateString(sourceFile, position) { + var token = getTokenAtPosition(sourceFile, position); + return ts.isTemplateLiteralKind(token.kind) && position > token.getStart(sourceFile); + } + ts.isInTemplateString = isInTemplateString; /** * Returns true if the cursor at position in sourceFile is within a comment that additionally * satisfies predicate, and false otherwise. */ function isInCommentHelper(sourceFile, position, predicate) { var token = getTokenAtPosition(sourceFile, position); - if (token && position <= token.getStart()) { + if (token && position <= token.getStart(sourceFile)) { var commentRanges = ts.getLeadingCommentRanges(sourceFile.text, token.pos); // The end marker of a single-line comment does not include the newline character. // In the following case, we are inside a comment (^ denotes the cursor position): @@ -41107,7 +46687,7 @@ var ts; return ts.forEach(commentRanges, jsDocPrefix); function jsDocPrefix(c) { var text = sourceFile.text; - return text.length >= c.pos + 3 && text[c.pos] === '/' && text[c.pos + 1] === '*' && text[c.pos + 2] === '*'; + return text.length >= c.pos + 3 && text[c.pos] === "/" && text[c.pos + 1] === "*" && text[c.pos + 2] === "*"; } } ts.hasDocComment = hasDocComment; @@ -41151,35 +46731,35 @@ var ts; function getNodeModifiers(node) { var flags = ts.getCombinedNodeFlags(node); var result = []; - if (flags & 16 /* Private */) + if (flags & 8 /* Private */) result.push(ts.ScriptElementKindModifier.privateMemberModifier); - if (flags & 32 /* Protected */) + if (flags & 16 /* Protected */) result.push(ts.ScriptElementKindModifier.protectedMemberModifier); - if (flags & 8 /* Public */) + if (flags & 4 /* Public */) result.push(ts.ScriptElementKindModifier.publicMemberModifier); - if (flags & 64 /* Static */) + if (flags & 32 /* Static */) result.push(ts.ScriptElementKindModifier.staticModifier); if (flags & 128 /* Abstract */) result.push(ts.ScriptElementKindModifier.abstractModifier); - if (flags & 2 /* Export */) + if (flags & 1 /* Export */) result.push(ts.ScriptElementKindModifier.exportedModifier); if (ts.isInAmbientContext(node)) result.push(ts.ScriptElementKindModifier.ambientModifier); - return result.length > 0 ? result.join(',') : ts.ScriptElementKindModifier.none; + return result.length > 0 ? result.join(",") : ts.ScriptElementKindModifier.none; } ts.getNodeModifiers = getNodeModifiers; function getTypeArgumentOrTypeParameterList(node) { - if (node.kind === 151 /* TypeReference */ || node.kind === 168 /* CallExpression */) { + if (node.kind === 155 /* TypeReference */ || node.kind === 174 /* CallExpression */) { return node.typeArguments; } - if (ts.isFunctionLike(node) || node.kind === 214 /* ClassDeclaration */ || node.kind === 215 /* InterfaceDeclaration */) { + if (ts.isFunctionLike(node) || node.kind === 221 /* ClassDeclaration */ || node.kind === 222 /* InterfaceDeclaration */) { return node.typeParameters; } return undefined; } ts.getTypeArgumentOrTypeParameterList = getTypeArgumentOrTypeParameterList; function isToken(n) { - return n.kind >= 0 /* FirstToken */ && n.kind <= 134 /* LastToken */; + return n.kind >= 0 /* FirstToken */ && n.kind <= 138 /* LastToken */; } ts.isToken = isToken; function isWord(kind) { @@ -41195,6 +46775,7 @@ var ts; ts.isComment = isComment; function isStringOrRegularExpressionOrTemplateLiteral(kind) { if (kind === 9 /* StringLiteral */ + || kind === 166 /* StringLiteralType */ || kind === 10 /* RegularExpressionLiteral */ || ts.isTemplateLiteralKind(kind)) { return true; @@ -41237,13 +46818,40 @@ var ts; return true; } ts.compareDataObjects = compareDataObjects; + function isArrayLiteralOrObjectLiteralDestructuringPattern(node) { + if (node.kind === 170 /* ArrayLiteralExpression */ || + node.kind === 171 /* ObjectLiteralExpression */) { + // [a,b,c] from: + // [a, b, c] = someExpression; + if (node.parent.kind === 187 /* BinaryExpression */ && + node.parent.left === node && + node.parent.operatorToken.kind === 56 /* EqualsToken */) { + return true; + } + // [a, b, c] from: + // for([a, b, c] of expression) + if (node.parent.kind === 208 /* ForOfStatement */ && + node.parent.initializer === node) { + return true; + } + // [a, b, c] of + // [x, [a, b, c] ] = someExpression + // or + // {x, a: {a, b, c} } = someExpression + if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 253 /* PropertyAssignment */ ? node.parent.parent : node.parent)) { + return true; + } + } + return false; + } + ts.isArrayLiteralOrObjectLiteralDestructuringPattern = isArrayLiteralOrObjectLiteralDestructuringPattern; })(ts || (ts = {})); // Display-part writer helpers /* @internal */ var ts; (function (ts) { function isFirstDeclarationOfSymbolParameter(symbol) { - return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 138 /* Parameter */; + return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 142 /* Parameter */; } ts.isFirstDeclarationOfSymbolParameter = isFirstDeclarationOfSymbolParameter; var displayPartWriter = getDisplayPartWriter(); @@ -41422,6 +47030,10 @@ var ts; if (isImportOrExportSpecifierName(location)) { return location.getText(); } + else if (ts.isStringOrNumericLiteral(location.kind) && + location.parent.kind === 140 /* ComputedPropertyName */) { + return location.text; + } // Try to get the local symbol if we're dealing with an 'export default' // since that symbol has the "true" name. var localExportDefaultSymbol = ts.getLocalSymbolForExportDefault(symbol); @@ -41431,7 +47043,7 @@ var ts; ts.getDeclaredName = getDeclaredName; function isImportOrExportSpecifierName(location) { return location.parent && - (location.parent.kind === 226 /* ImportSpecifier */ || location.parent.kind === 230 /* ExportSpecifier */) && + (location.parent.kind === 234 /* ImportSpecifier */ || location.parent.kind === 238 /* ExportSpecifier */) && location.parent.propertyName === location; } ts.isImportOrExportSpecifierName = isImportOrExportSpecifierName; @@ -41451,6 +47063,216 @@ var ts; return name; } ts.stripQuotes = stripQuotes; + function scriptKindIs(fileName, host) { + var scriptKinds = []; + for (var _i = 2; _i < arguments.length; _i++) { + scriptKinds[_i - 2] = arguments[_i]; + } + var scriptKind = getScriptKind(fileName, host); + return ts.forEach(scriptKinds, function (k) { return k === scriptKind; }); + } + ts.scriptKindIs = scriptKindIs; + function getScriptKind(fileName, host) { + // First check to see if the script kind was specified by the host. Chances are the host + // may override the default script kind for the file extension. + var scriptKind; + if (host && host.getScriptKind) { + scriptKind = host.getScriptKind(fileName); + } + if (!scriptKind || scriptKind === 0 /* Unknown */) { + scriptKind = ts.getScriptKindFromFileName(fileName); + } + return ts.ensureScriptKind(fileName, scriptKind); + } + ts.getScriptKind = getScriptKind; +})(ts || (ts = {})); +// Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. +// See LICENSE.txt in the project root for complete license information. +/// +/* @internal */ +var ts; +(function (ts) { + var JsTyping; + (function (JsTyping) { + ; + ; + // A map of loose file names to library names + // that we are confident require typings + var safeList; + /** + * @param host is the object providing I/O related operations. + * @param fileNames are the file names that belong to the same project + * @param projectRootPath is the path to the project root directory + * @param safeListPath is the path used to retrieve the safe list + * @param packageNameToTypingLocation is the map of package names to their cached typing locations + * @param typingOptions are used to customize the typing inference process + * @param compilerOptions are used as a source for typing inference + */ + function discoverTypings(host, fileNames, projectRootPath, safeListPath, packageNameToTypingLocation, typingOptions, compilerOptions) { + // A typing name to typing file path mapping + var inferredTypings = {}; + if (!typingOptions || !typingOptions.enableAutoDiscovery) { + return { cachedTypingPaths: [], newTypingNames: [], filesToWatch: [] }; + } + // Only infer typings for .js and .jsx files + fileNames = ts.filter(ts.map(fileNames, ts.normalizePath), function (f) { return ts.scriptKindIs(f, /*LanguageServiceHost*/ undefined, 1 /* JS */, 2 /* JSX */); }); + if (!safeList) { + var result = ts.readConfigFile(safeListPath, function (path) { return host.readFile(path); }); + if (result.config) { + safeList = result.config; + } + else { + safeList = {}; + } + ; + } + var filesToWatch = []; + // Directories to search for package.json, bower.json and other typing information + var searchDirs = []; + var exclude = []; + mergeTypings(typingOptions.include); + exclude = typingOptions.exclude || []; + var possibleSearchDirs = ts.map(fileNames, ts.getDirectoryPath); + if (projectRootPath !== undefined) { + possibleSearchDirs.push(projectRootPath); + } + searchDirs = ts.deduplicate(possibleSearchDirs); + for (var _i = 0, searchDirs_1 = searchDirs; _i < searchDirs_1.length; _i++) { + var searchDir = searchDirs_1[_i]; + var packageJsonPath = ts.combinePaths(searchDir, "package.json"); + getTypingNamesFromJson(packageJsonPath, filesToWatch); + var bowerJsonPath = ts.combinePaths(searchDir, "bower.json"); + getTypingNamesFromJson(bowerJsonPath, filesToWatch); + var nodeModulesPath = ts.combinePaths(searchDir, "node_modules"); + getTypingNamesFromNodeModuleFolder(nodeModulesPath); + } + getTypingNamesFromSourceFileNames(fileNames); + // Add the cached typing locations for inferred typings that are already installed + for (var name_37 in packageNameToTypingLocation) { + if (ts.hasProperty(inferredTypings, name_37) && !inferredTypings[name_37]) { + inferredTypings[name_37] = packageNameToTypingLocation[name_37]; + } + } + // Remove typings that the user has added to the exclude list + for (var _a = 0, exclude_1 = exclude; _a < exclude_1.length; _a++) { + var excludeTypingName = exclude_1[_a]; + delete inferredTypings[excludeTypingName]; + } + var newTypingNames = []; + var cachedTypingPaths = []; + for (var typing in inferredTypings) { + if (inferredTypings[typing] !== undefined) { + cachedTypingPaths.push(inferredTypings[typing]); + } + else { + newTypingNames.push(typing); + } + } + return { cachedTypingPaths: cachedTypingPaths, newTypingNames: newTypingNames, filesToWatch: filesToWatch }; + /** + * Merge a given list of typingNames to the inferredTypings map + */ + function mergeTypings(typingNames) { + if (!typingNames) { + return; + } + for (var _i = 0, typingNames_1 = typingNames; _i < typingNames_1.length; _i++) { + var typing = typingNames_1[_i]; + if (!ts.hasProperty(inferredTypings, typing)) { + inferredTypings[typing] = undefined; + } + } + } + /** + * Get the typing info from common package manager json files like package.json or bower.json + */ + function getTypingNamesFromJson(jsonPath, filesToWatch) { + var result = ts.readConfigFile(jsonPath, function (path) { return host.readFile(path); }); + if (result.config) { + var jsonConfig = result.config; + filesToWatch.push(jsonPath); + if (jsonConfig.dependencies) { + mergeTypings(ts.getKeys(jsonConfig.dependencies)); + } + if (jsonConfig.devDependencies) { + mergeTypings(ts.getKeys(jsonConfig.devDependencies)); + } + if (jsonConfig.optionalDependencies) { + mergeTypings(ts.getKeys(jsonConfig.optionalDependencies)); + } + if (jsonConfig.peerDependencies) { + mergeTypings(ts.getKeys(jsonConfig.peerDependencies)); + } + } + } + /** + * Infer typing names from given file names. For example, the file name "jquery-min.2.3.4.js" + * should be inferred to the 'jquery' typing name; and "angular-route.1.2.3.js" should be inferred + * to the 'angular-route' typing name. + * @param fileNames are the names for source files in the project + */ + function getTypingNamesFromSourceFileNames(fileNames) { + var jsFileNames = ts.filter(fileNames, ts.hasJavaScriptFileExtension); + var inferredTypingNames = ts.map(jsFileNames, function (f) { return ts.removeFileExtension(ts.getBaseFileName(f.toLowerCase())); }); + var cleanedTypingNames = ts.map(inferredTypingNames, function (f) { return f.replace(/((?:\.|-)min(?=\.|$))|((?:-|\.)\d+)/g, ""); }); + if (safeList === undefined) { + mergeTypings(cleanedTypingNames); + } + else { + mergeTypings(ts.filter(cleanedTypingNames, function (f) { return ts.hasProperty(safeList, f); })); + } + var hasJsxFile = ts.forEach(fileNames, function (f) { return ts.scriptKindIs(f, /*LanguageServiceHost*/ undefined, 2 /* JSX */); }); + if (hasJsxFile) { + mergeTypings(["react"]); + } + } + /** + * Infer typing names from node_module folder + * @param nodeModulesPath is the path to the "node_modules" folder + */ + function getTypingNamesFromNodeModuleFolder(nodeModulesPath) { + // Todo: add support for ModuleResolutionHost too + if (!host.directoryExists(nodeModulesPath)) { + return; + } + var typingNames = []; + var fileNames = host.readDirectory(nodeModulesPath, "*.json", /*exclude*/ undefined, /*depth*/ 2); + for (var _i = 0, fileNames_1 = fileNames; _i < fileNames_1.length; _i++) { + var fileName = fileNames_1[_i]; + var normalizedFileName = ts.normalizePath(fileName); + if (ts.getBaseFileName(normalizedFileName) !== "package.json") { + continue; + } + var result = ts.readConfigFile(normalizedFileName, function (path) { return host.readFile(path); }); + if (!result.config) { + continue; + } + var packageJson = result.config; + // npm 3's package.json contains a "_requiredBy" field + // we should include all the top level module names for npm 2, and only module names whose + // "_requiredBy" field starts with "#" or equals "/" for npm 3. + if (packageJson._requiredBy && + ts.filter(packageJson._requiredBy, function (r) { return r[0] === "#" || r === "/"; }).length === 0) { + continue; + } + // If the package has its own d.ts typings, those will take precedence. Otherwise the package name will be used + // to download d.ts files from DefinitelyTyped + if (!packageJson.name) { + continue; + } + if (packageJson.typings) { + var absolutePath = ts.getNormalizedAbsolutePath(packageJson.typings, ts.getDirectoryPath(normalizedFileName)); + inferredTypings[packageJson.name] = absolutePath; + } + else { + typingNames.push(packageJson.name); + } + } + mergeTypings(typingNames); + } + } + JsTyping.discoverTypings = discoverTypings; + })(JsTyping = ts.JsTyping || (ts.JsTyping = {})); })(ts || (ts = {})); /// /// @@ -41488,6 +47310,7 @@ var ts; advance: advance, readTokenInfo: readTokenInfo, isOnToken: isOnToken, + getCurrentLeadingTrivia: function () { return leadingTrivia; }, lastTrailingTriviaWasNewLine: function () { return wasNewLine; }, close: function () { ts.Debug.assert(scanner !== undefined); @@ -41553,10 +47376,10 @@ var ts; function shouldRescanJsxIdentifier(node) { if (node.parent) { switch (node.parent.kind) { - case 238 /* JsxAttribute */: - case 235 /* JsxOpeningElement */: - case 237 /* JsxClosingElement */: - case 234 /* JsxSelfClosingElement */: + case 246 /* JsxAttribute */: + case 243 /* JsxOpeningElement */: + case 245 /* JsxClosingElement */: + case 242 /* JsxSelfClosingElement */: return node.kind === 69 /* Identifier */; } } @@ -41597,7 +47420,7 @@ var ts; // readTokenInfo was called before with the same expected scan action. // No need to re-scan text, return existing 'lastTokenInfo' // it is ok to call fixTokenKind here since it does not affect - // what portion of text is consumed. In opposize rescanning can change it, + // what portion of text is consumed. In contrast rescanning can change it, // i.e. for '>=' when originally scanner eats just one character // and rescanning forces it to consume more. return fixTokenKind(lastTokenInfo, n); @@ -41763,7 +47586,7 @@ var ts; return false; }; return FormattingContext; - })(); + }()); formatting.FormattingContext = FormattingContext; })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); @@ -41802,7 +47625,7 @@ var ts; "flag=" + this.Flag + "]"; }; return Rule; - })(); + }()); formatting.Rule = Rule; })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); @@ -41849,7 +47672,7 @@ var ts; return new RuleDescriptor(left, right); }; return RuleDescriptor; - })(); + }()); formatting.RuleDescriptor = RuleDescriptor; })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); @@ -41891,7 +47714,7 @@ var ts; return result; }; return RuleOperation; - })(); + }()); formatting.RuleOperation = RuleOperation; })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); @@ -41926,7 +47749,7 @@ var ts; }; RuleOperationContext.Any = new RuleOperationContext(); return RuleOperationContext; - })(); + }()); formatting.RuleOperationContext = RuleOperationContext; })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); @@ -41945,25 +47768,25 @@ var ts; this.IgnoreBeforeComment = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.Comments), formatting.RuleOperation.create1(1 /* Ignore */)); this.IgnoreAfterLineComment = new formatting.Rule(formatting.RuleDescriptor.create3(2 /* SingleLineCommentTrivia */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create1(1 /* Ignore */)); // Space after keyword but not before ; or : or ? - this.NoSpaceBeforeSemicolon = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 23 /* SemicolonToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.NoSpaceBeforeColon = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 54 /* ColonToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8 /* Delete */)); - this.NoSpaceBeforeQuestionMark = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 53 /* QuestionToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8 /* Delete */)); - this.SpaceAfterColon = new formatting.Rule(formatting.RuleDescriptor.create3(54 /* ColonToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 2 /* Space */)); - this.SpaceAfterQuestionMarkInConditionalOperator = new formatting.Rule(formatting.RuleDescriptor.create3(53 /* QuestionToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsConditionalOperatorContext), 2 /* Space */)); - this.NoSpaceAfterQuestionMark = new formatting.Rule(formatting.RuleDescriptor.create3(53 /* QuestionToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.SpaceAfterSemicolon = new formatting.Rule(formatting.RuleDescriptor.create3(23 /* SemicolonToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.NoSpaceBeforeSemicolon = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 23 /* SemicolonToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceBeforeColon = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 54 /* ColonToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotBinaryOpContext), 8 /* Delete */)); + this.NoSpaceBeforeQuestionMark = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 53 /* QuestionToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotBinaryOpContext), 8 /* Delete */)); + this.SpaceAfterColon = new formatting.Rule(formatting.RuleDescriptor.create3(54 /* ColonToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotBinaryOpContext), 2 /* Space */)); + this.SpaceAfterQuestionMarkInConditionalOperator = new formatting.Rule(formatting.RuleDescriptor.create3(53 /* QuestionToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsConditionalOperatorContext), 2 /* Space */)); + this.NoSpaceAfterQuestionMark = new formatting.Rule(formatting.RuleDescriptor.create3(53 /* QuestionToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); + this.SpaceAfterSemicolon = new formatting.Rule(formatting.RuleDescriptor.create3(23 /* SemicolonToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); // Space after }. - this.SpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(16 /* CloseBraceToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsAfterCodeBlockContext), 2 /* Space */)); + this.SpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(16 /* CloseBraceToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsAfterCodeBlockContext), 2 /* Space */)); // Special case for (}, else) and (}, while) since else & while tokens are not part of the tree which makes SpaceAfterCloseBrace rule not applied - this.SpaceBetweenCloseBraceAndElse = new formatting.Rule(formatting.RuleDescriptor.create1(16 /* CloseBraceToken */, 80 /* ElseKeyword */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); - this.SpaceBetweenCloseBraceAndWhile = new formatting.Rule(formatting.RuleDescriptor.create1(16 /* CloseBraceToken */, 104 /* WhileKeyword */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); - this.NoSpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(16 /* CloseBraceToken */, formatting.Shared.TokenRange.FromTokens([18 /* CloseParenToken */, 20 /* CloseBracketToken */, 24 /* CommaToken */, 23 /* SemicolonToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.SpaceBetweenCloseBraceAndElse = new formatting.Rule(formatting.RuleDescriptor.create1(16 /* CloseBraceToken */, 80 /* ElseKeyword */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); + this.SpaceBetweenCloseBraceAndWhile = new formatting.Rule(formatting.RuleDescriptor.create1(16 /* CloseBraceToken */, 104 /* WhileKeyword */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); + this.NoSpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(16 /* CloseBraceToken */, formatting.Shared.TokenRange.FromTokens([18 /* CloseParenToken */, 20 /* CloseBracketToken */, 24 /* CommaToken */, 23 /* SemicolonToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); // No space for dot - this.NoSpaceBeforeDot = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 21 /* DotToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.NoSpaceAfterDot = new formatting.Rule(formatting.RuleDescriptor.create3(21 /* DotToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceBeforeDot = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 21 /* DotToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceAfterDot = new formatting.Rule(formatting.RuleDescriptor.create3(21 /* DotToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); // No space before and after indexer - this.NoSpaceBeforeOpenBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 19 /* OpenBracketToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.NoSpaceAfterCloseBracket = new formatting.Rule(formatting.RuleDescriptor.create3(20 /* CloseBracketToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBeforeBlockInFunctionDeclarationContext), 8 /* Delete */)); + this.NoSpaceBeforeOpenBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 19 /* OpenBracketToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceAfterCloseBracket = new formatting.Rule(formatting.RuleDescriptor.create3(20 /* CloseBracketToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotBeforeBlockInFunctionDeclarationContext), 8 /* Delete */)); // Place a space before open brace in a function declaration this.FunctionOpenBraceLeftTokenRange = formatting.Shared.TokenRange.AnyIncludingMultilineComments; this.SpaceBeforeOpenBraceInFunction = new formatting.Rule(formatting.RuleDescriptor.create2(this.FunctionOpenBraceLeftTokenRange, 15 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext, Rules.IsBeforeBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2 /* Space */), 1 /* CanDeleteNewLines */); @@ -41976,7 +47799,7 @@ var ts; // Insert a space after { and before } in single-line contexts, but remove space from empty object literals {}. this.SpaceAfterOpenBrace = new formatting.Rule(formatting.RuleDescriptor.create3(15 /* OpenBraceToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 2 /* Space */)); this.SpaceBeforeCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 16 /* CloseBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 2 /* Space */)); - this.NoSpaceBetweenEmptyBraceBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(15 /* OpenBraceToken */, 16 /* CloseBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsObjectContext), 8 /* Delete */)); + this.NoSpaceBetweenEmptyBraceBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(15 /* OpenBraceToken */, 16 /* CloseBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsObjectContext), 8 /* Delete */)); // Insert new line after { and before } in multi-line contexts. this.NewLineAfterOpenBraceInBlockContext = new formatting.Rule(formatting.RuleDescriptor.create3(15 /* OpenBraceToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsMultilineBlockContext), 4 /* NewLine */)); // For functions and control block place } on a new line [multi-line rule] @@ -41984,149 +47807,146 @@ var ts; // Special handling of unary operators. // Prefix operators generally shouldn't have a space between // them and their target unary expression. - this.NoSpaceAfterUnaryPrefixOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.UnaryPrefixOperators, formatting.Shared.TokenRange.UnaryPrefixExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8 /* Delete */)); - this.NoSpaceAfterUnaryPreincrementOperator = new formatting.Rule(formatting.RuleDescriptor.create3(41 /* PlusPlusToken */, formatting.Shared.TokenRange.UnaryPreincrementExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.NoSpaceAfterUnaryPredecrementOperator = new formatting.Rule(formatting.RuleDescriptor.create3(42 /* MinusMinusToken */, formatting.Shared.TokenRange.UnaryPredecrementExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.NoSpaceBeforeUnaryPostincrementOperator = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.UnaryPostincrementExpressions, 41 /* PlusPlusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.NoSpaceBeforeUnaryPostdecrementOperator = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.UnaryPostdecrementExpressions, 42 /* MinusMinusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceAfterUnaryPrefixOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.UnaryPrefixOperators, formatting.Shared.TokenRange.UnaryPrefixExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotBinaryOpContext), 8 /* Delete */)); + this.NoSpaceAfterUnaryPreincrementOperator = new formatting.Rule(formatting.RuleDescriptor.create3(41 /* PlusPlusToken */, formatting.Shared.TokenRange.UnaryPreincrementExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceAfterUnaryPredecrementOperator = new formatting.Rule(formatting.RuleDescriptor.create3(42 /* MinusMinusToken */, formatting.Shared.TokenRange.UnaryPredecrementExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceBeforeUnaryPostincrementOperator = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.UnaryPostincrementExpressions, 41 /* PlusPlusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceBeforeUnaryPostdecrementOperator = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.UnaryPostdecrementExpressions, 42 /* MinusMinusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); // More unary operator special-casing. // DevDiv 181814: Be careful when removing leading whitespace // around unary operators. Examples: // 1 - -2 --X--> 1--2 // a + ++b --X--> a+++b - this.SpaceAfterPostincrementWhenFollowedByAdd = new formatting.Rule(formatting.RuleDescriptor.create1(41 /* PlusPlusToken */, 35 /* PlusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); - this.SpaceAfterAddWhenFollowedByUnaryPlus = new formatting.Rule(formatting.RuleDescriptor.create1(35 /* PlusToken */, 35 /* PlusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); - this.SpaceAfterAddWhenFollowedByPreincrement = new formatting.Rule(formatting.RuleDescriptor.create1(35 /* PlusToken */, 41 /* PlusPlusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); - this.SpaceAfterPostdecrementWhenFollowedBySubtract = new formatting.Rule(formatting.RuleDescriptor.create1(42 /* MinusMinusToken */, 36 /* MinusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); - this.SpaceAfterSubtractWhenFollowedByUnaryMinus = new formatting.Rule(formatting.RuleDescriptor.create1(36 /* MinusToken */, 36 /* MinusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); - this.SpaceAfterSubtractWhenFollowedByPredecrement = new formatting.Rule(formatting.RuleDescriptor.create1(36 /* MinusToken */, 42 /* MinusMinusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); - this.NoSpaceBeforeComma = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 24 /* CommaToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.SpaceAfterCertainKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([102 /* VarKeyword */, 98 /* ThrowKeyword */, 92 /* NewKeyword */, 78 /* DeleteKeyword */, 94 /* ReturnKeyword */, 101 /* TypeOfKeyword */, 119 /* AwaitKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); - this.SpaceAfterLetConstInVariableDeclaration = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([108 /* LetKeyword */, 74 /* ConstKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsStartOfVariableDeclarationList), 2 /* Space */)); - this.NoSpaceBeforeOpenParenInFuncCall = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsFunctionCallOrNewContext, Rules.IsPreviousTokenNotComma), 8 /* Delete */)); + this.SpaceAfterPostincrementWhenFollowedByAdd = new formatting.Rule(formatting.RuleDescriptor.create1(41 /* PlusPlusToken */, 35 /* PlusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); + this.SpaceAfterAddWhenFollowedByUnaryPlus = new formatting.Rule(formatting.RuleDescriptor.create1(35 /* PlusToken */, 35 /* PlusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); + this.SpaceAfterAddWhenFollowedByPreincrement = new formatting.Rule(formatting.RuleDescriptor.create1(35 /* PlusToken */, 41 /* PlusPlusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); + this.SpaceAfterPostdecrementWhenFollowedBySubtract = new formatting.Rule(formatting.RuleDescriptor.create1(42 /* MinusMinusToken */, 36 /* MinusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); + this.SpaceAfterSubtractWhenFollowedByUnaryMinus = new formatting.Rule(formatting.RuleDescriptor.create1(36 /* MinusToken */, 36 /* MinusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); + this.SpaceAfterSubtractWhenFollowedByPredecrement = new formatting.Rule(formatting.RuleDescriptor.create1(36 /* MinusToken */, 42 /* MinusMinusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); + this.NoSpaceBeforeComma = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 24 /* CommaToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); + this.SpaceAfterCertainKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([102 /* VarKeyword */, 98 /* ThrowKeyword */, 92 /* NewKeyword */, 78 /* DeleteKeyword */, 94 /* ReturnKeyword */, 101 /* TypeOfKeyword */, 119 /* AwaitKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); + this.SpaceAfterLetConstInVariableDeclaration = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([108 /* LetKeyword */, 74 /* ConstKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsStartOfVariableDeclarationList), 2 /* Space */)); + this.NoSpaceBeforeOpenParenInFuncCall = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsFunctionCallOrNewContext, Rules.IsPreviousTokenNotComma), 8 /* Delete */)); this.SpaceAfterFunctionInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create3(87 /* FunctionKeyword */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2 /* Space */)); - this.NoSpaceBeforeOpenParenInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsFunctionDeclContext), 8 /* Delete */)); - this.SpaceAfterVoidOperator = new formatting.Rule(formatting.RuleDescriptor.create3(103 /* VoidKeyword */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsVoidOpContext), 2 /* Space */)); - this.NoSpaceBetweenReturnAndSemicolon = new formatting.Rule(formatting.RuleDescriptor.create1(94 /* ReturnKeyword */, 23 /* SemicolonToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceBeforeOpenParenInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsFunctionDeclContext), 8 /* Delete */)); + this.SpaceAfterVoidOperator = new formatting.Rule(formatting.RuleDescriptor.create3(103 /* VoidKeyword */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsVoidOpContext), 2 /* Space */)); + this.NoSpaceBetweenReturnAndSemicolon = new formatting.Rule(formatting.RuleDescriptor.create1(94 /* ReturnKeyword */, 23 /* SemicolonToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); // Add a space between statements. All keywords except (do,else,case) has open/close parens after them. // So, we have a rule to add a space for [),Any], [do,Any], [else,Any], and [case,Any] - this.SpaceBetweenStatements = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([18 /* CloseParenToken */, 79 /* DoKeyword */, 80 /* ElseKeyword */, 71 /* CaseKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotForContext), 2 /* Space */)); + this.SpaceBetweenStatements = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([18 /* CloseParenToken */, 79 /* DoKeyword */, 80 /* ElseKeyword */, 71 /* CaseKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotForContext), 2 /* Space */)); // This low-pri rule takes care of "try {" and "finally {" in case the rule SpaceBeforeOpenBraceInControl didn't execute on FormatOnEnter. - this.SpaceAfterTryFinally = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([100 /* TryKeyword */, 85 /* FinallyKeyword */]), 15 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.SpaceAfterTryFinally = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([100 /* TryKeyword */, 85 /* FinallyKeyword */]), 15 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); // get x() {} // set x(val) {} - this.SpaceAfterGetSetInMember = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([123 /* GetKeyword */, 129 /* SetKeyword */]), 69 /* Identifier */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2 /* Space */)); + this.SpaceAfterGetSetInMember = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([123 /* GetKeyword */, 131 /* SetKeyword */]), 69 /* Identifier */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2 /* Space */)); // Special case for binary operators (that are keywords). For these we have to add a space and shouldn't follow any user options. - this.SpaceBeforeBinaryKeywordOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.BinaryKeywordOperators), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); - this.SpaceAfterBinaryKeywordOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.BinaryKeywordOperators, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); + this.SpaceBeforeBinaryKeywordOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.BinaryKeywordOperators), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); + this.SpaceAfterBinaryKeywordOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.BinaryKeywordOperators, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); // TypeScript-specific higher priority rules // Treat constructor as an identifier in a function declaration, and remove spaces between constructor and following left parentheses - this.NoSpaceAfterConstructor = new formatting.Rule(formatting.RuleDescriptor.create1(121 /* ConstructorKeyword */, 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceAfterConstructor = new formatting.Rule(formatting.RuleDescriptor.create1(121 /* ConstructorKeyword */, 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); // Use of module as a function call. e.g.: import m2 = module("m2"); - this.NoSpaceAfterModuleImport = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([125 /* ModuleKeyword */, 127 /* RequireKeyword */]), 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceAfterModuleImport = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([125 /* ModuleKeyword */, 129 /* RequireKeyword */]), 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); // Add a space around certain TypeScript keywords - this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([115 /* AbstractKeyword */, 73 /* ClassKeyword */, 122 /* DeclareKeyword */, 77 /* DefaultKeyword */, 81 /* EnumKeyword */, 82 /* ExportKeyword */, 83 /* ExtendsKeyword */, 123 /* GetKeyword */, 106 /* ImplementsKeyword */, 89 /* ImportKeyword */, 107 /* InterfaceKeyword */, 125 /* ModuleKeyword */, 126 /* NamespaceKeyword */, 110 /* PrivateKeyword */, 112 /* PublicKeyword */, 111 /* ProtectedKeyword */, 129 /* SetKeyword */, 113 /* StaticKeyword */, 132 /* TypeKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); - this.SpaceBeforeCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([83 /* ExtendsKeyword */, 106 /* ImplementsKeyword */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([115 /* AbstractKeyword */, 73 /* ClassKeyword */, 122 /* DeclareKeyword */, 77 /* DefaultKeyword */, 81 /* EnumKeyword */, 82 /* ExportKeyword */, 83 /* ExtendsKeyword */, 123 /* GetKeyword */, 106 /* ImplementsKeyword */, 89 /* ImportKeyword */, 107 /* InterfaceKeyword */, 125 /* ModuleKeyword */, 126 /* NamespaceKeyword */, 110 /* PrivateKeyword */, 112 /* PublicKeyword */, 111 /* ProtectedKeyword */, 131 /* SetKeyword */, 113 /* StaticKeyword */, 134 /* TypeKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); + this.SpaceBeforeCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([83 /* ExtendsKeyword */, 106 /* ImplementsKeyword */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); // Treat string literals in module names as identifiers, and add a space between the literal and the opening Brace braces, e.g.: module "m2" { this.SpaceAfterModuleName = new formatting.Rule(formatting.RuleDescriptor.create1(9 /* StringLiteral */, 15 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsModuleDeclContext), 2 /* Space */)); // Lambda expressions - this.SpaceAfterArrow = new formatting.Rule(formatting.RuleDescriptor.create3(34 /* EqualsGreaterThanToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.SpaceBeforeArrow = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 34 /* EqualsGreaterThanToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); + this.SpaceAfterArrow = new formatting.Rule(formatting.RuleDescriptor.create3(34 /* EqualsGreaterThanToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); // Optional parameters and let args - this.NoSpaceAfterEllipsis = new formatting.Rule(formatting.RuleDescriptor.create1(22 /* DotDotDotToken */, 69 /* Identifier */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.NoSpaceAfterOptionalParameters = new formatting.Rule(formatting.RuleDescriptor.create3(53 /* QuestionToken */, formatting.Shared.TokenRange.FromTokens([18 /* CloseParenToken */, 24 /* CommaToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8 /* Delete */)); + this.NoSpaceAfterEllipsis = new formatting.Rule(formatting.RuleDescriptor.create1(22 /* DotDotDotToken */, 69 /* Identifier */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceAfterOptionalParameters = new formatting.Rule(formatting.RuleDescriptor.create3(53 /* QuestionToken */, formatting.Shared.TokenRange.FromTokens([18 /* CloseParenToken */, 24 /* CommaToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotBinaryOpContext), 8 /* Delete */)); // generics and type assertions - this.NoSpaceBeforeOpenAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.TypeNames, 25 /* LessThanToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8 /* Delete */)); - this.NoSpaceBetweenCloseParenAndAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create1(18 /* CloseParenToken */, 25 /* LessThanToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8 /* Delete */)); - this.NoSpaceAfterOpenAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create3(25 /* LessThanToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8 /* Delete */)); - this.NoSpaceBeforeCloseAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 27 /* GreaterThanToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8 /* Delete */)); - this.NoSpaceAfterCloseAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create3(27 /* GreaterThanToken */, formatting.Shared.TokenRange.FromTokens([17 /* OpenParenToken */, 19 /* OpenBracketToken */, 27 /* GreaterThanToken */, 24 /* CommaToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8 /* Delete */)); - this.NoSpaceAfterTypeAssertion = new formatting.Rule(formatting.RuleDescriptor.create3(27 /* GreaterThanToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeAssertionContext), 8 /* Delete */)); + this.NoSpaceBeforeOpenAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.TypeNames, 25 /* LessThanToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8 /* Delete */)); + this.NoSpaceBetweenCloseParenAndAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create1(18 /* CloseParenToken */, 25 /* LessThanToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8 /* Delete */)); + this.NoSpaceAfterOpenAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create3(25 /* LessThanToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8 /* Delete */)); + this.NoSpaceBeforeCloseAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 27 /* GreaterThanToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8 /* Delete */)); + this.NoSpaceAfterCloseAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create3(27 /* GreaterThanToken */, formatting.Shared.TokenRange.FromTokens([17 /* OpenParenToken */, 19 /* OpenBracketToken */, 27 /* GreaterThanToken */, 24 /* CommaToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8 /* Delete */)); + this.NoSpaceAfterTypeAssertion = new formatting.Rule(formatting.RuleDescriptor.create3(27 /* GreaterThanToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeAssertionContext), 8 /* Delete */)); // Remove spaces in empty interface literals. e.g.: x: {} - this.NoSpaceBetweenEmptyInterfaceBraceBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(15 /* OpenBraceToken */, 16 /* CloseBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsObjectTypeContext), 8 /* Delete */)); + this.NoSpaceBetweenEmptyInterfaceBraceBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(15 /* OpenBraceToken */, 16 /* CloseBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsObjectTypeContext), 8 /* Delete */)); // decorators - this.SpaceBeforeAt = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 55 /* AtToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); - this.NoSpaceAfterAt = new formatting.Rule(formatting.RuleDescriptor.create3(55 /* AtToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.SpaceAfterDecorator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([115 /* AbstractKeyword */, 69 /* Identifier */, 82 /* ExportKeyword */, 77 /* DefaultKeyword */, 73 /* ClassKeyword */, 113 /* StaticKeyword */, 112 /* PublicKeyword */, 110 /* PrivateKeyword */, 111 /* ProtectedKeyword */, 123 /* GetKeyword */, 129 /* SetKeyword */, 19 /* OpenBracketToken */, 37 /* AsteriskToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsEndOfDecoratorContextOnSameLine), 2 /* Space */)); + this.SpaceBeforeAt = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 55 /* AtToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); + this.NoSpaceAfterAt = new formatting.Rule(formatting.RuleDescriptor.create3(55 /* AtToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); + this.SpaceAfterDecorator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([115 /* AbstractKeyword */, 69 /* Identifier */, 82 /* ExportKeyword */, 77 /* DefaultKeyword */, 73 /* ClassKeyword */, 113 /* StaticKeyword */, 112 /* PublicKeyword */, 110 /* PrivateKeyword */, 111 /* ProtectedKeyword */, 123 /* GetKeyword */, 131 /* SetKeyword */, 19 /* OpenBracketToken */, 37 /* AsteriskToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsEndOfDecoratorContextOnSameLine), 2 /* Space */)); this.NoSpaceBetweenFunctionKeywordAndStar = new formatting.Rule(formatting.RuleDescriptor.create1(87 /* FunctionKeyword */, 37 /* AsteriskToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), 8 /* Delete */)); this.SpaceAfterStarInGeneratorDeclaration = new formatting.Rule(formatting.RuleDescriptor.create3(37 /* AsteriskToken */, formatting.Shared.TokenRange.FromTokens([69 /* Identifier */, 17 /* OpenParenToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), 2 /* Space */)); - this.NoSpaceBetweenYieldKeywordAndStar = new formatting.Rule(formatting.RuleDescriptor.create1(114 /* YieldKeyword */, 37 /* AsteriskToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), 8 /* Delete */)); - this.SpaceBetweenYieldOrYieldStarAndOperand = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([114 /* YieldKeyword */, 37 /* AsteriskToken */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), 2 /* Space */)); + this.NoSpaceBetweenYieldKeywordAndStar = new formatting.Rule(formatting.RuleDescriptor.create1(114 /* YieldKeyword */, 37 /* AsteriskToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), 8 /* Delete */)); + this.SpaceBetweenYieldOrYieldStarAndOperand = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([114 /* YieldKeyword */, 37 /* AsteriskToken */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), 2 /* Space */)); // Async-await - this.SpaceBetweenAsyncAndOpenParen = new formatting.Rule(formatting.RuleDescriptor.create1(118 /* AsyncKeyword */, 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsArrowFunctionContext, Rules.IsSameLineTokenContext), 2 /* Space */)); - this.SpaceBetweenAsyncAndFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(118 /* AsyncKeyword */, 87 /* FunctionKeyword */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.SpaceBetweenAsyncAndOpenParen = new formatting.Rule(formatting.RuleDescriptor.create1(118 /* AsyncKeyword */, 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsArrowFunctionContext, Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); + this.SpaceBetweenAsyncAndFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(118 /* AsyncKeyword */, 87 /* FunctionKeyword */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); // template string - this.SpaceBetweenTagAndTemplateString = new formatting.Rule(formatting.RuleDescriptor.create3(69 /* Identifier */, formatting.Shared.TokenRange.FromTokens([11 /* NoSubstitutionTemplateLiteral */, 12 /* TemplateHead */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); - this.NoSpaceAfterTemplateHeadAndMiddle = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([12 /* TemplateHead */, 13 /* TemplateMiddle */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.NoSpaceBeforeTemplateMiddleAndTail = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([13 /* TemplateMiddle */, 14 /* TemplateTail */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceBetweenTagAndTemplateString = new formatting.Rule(formatting.RuleDescriptor.create3(69 /* Identifier */, formatting.Shared.TokenRange.FromTokens([11 /* NoSubstitutionTemplateLiteral */, 12 /* TemplateHead */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); // These rules are higher in priority than user-configurable rules. - this.HighPriorityCommonRules = - [ - this.IgnoreBeforeComment, this.IgnoreAfterLineComment, - this.NoSpaceBeforeColon, this.SpaceAfterColon, this.NoSpaceBeforeQuestionMark, this.SpaceAfterQuestionMarkInConditionalOperator, - this.NoSpaceAfterQuestionMark, - this.NoSpaceBeforeDot, this.NoSpaceAfterDot, - this.NoSpaceAfterUnaryPrefixOperator, - this.NoSpaceAfterUnaryPreincrementOperator, this.NoSpaceAfterUnaryPredecrementOperator, - this.NoSpaceBeforeUnaryPostincrementOperator, this.NoSpaceBeforeUnaryPostdecrementOperator, - this.SpaceAfterPostincrementWhenFollowedByAdd, - this.SpaceAfterAddWhenFollowedByUnaryPlus, this.SpaceAfterAddWhenFollowedByPreincrement, - this.SpaceAfterPostdecrementWhenFollowedBySubtract, - this.SpaceAfterSubtractWhenFollowedByUnaryMinus, this.SpaceAfterSubtractWhenFollowedByPredecrement, - this.NoSpaceAfterCloseBrace, - this.SpaceAfterOpenBrace, this.SpaceBeforeCloseBrace, this.NewLineBeforeCloseBraceInBlockContext, - this.SpaceAfterCloseBrace, this.SpaceBetweenCloseBraceAndElse, this.SpaceBetweenCloseBraceAndWhile, this.NoSpaceBetweenEmptyBraceBrackets, - this.NoSpaceBetweenFunctionKeywordAndStar, this.SpaceAfterStarInGeneratorDeclaration, - this.SpaceAfterFunctionInFuncDecl, this.NewLineAfterOpenBraceInBlockContext, this.SpaceAfterGetSetInMember, - this.NoSpaceBetweenYieldKeywordAndStar, this.SpaceBetweenYieldOrYieldStarAndOperand, - this.NoSpaceBetweenReturnAndSemicolon, - this.SpaceAfterCertainKeywords, - this.SpaceAfterLetConstInVariableDeclaration, - this.NoSpaceBeforeOpenParenInFuncCall, - this.SpaceBeforeBinaryKeywordOperator, this.SpaceAfterBinaryKeywordOperator, - this.SpaceAfterVoidOperator, - this.SpaceBetweenAsyncAndOpenParen, this.SpaceBetweenAsyncAndFunctionKeyword, - this.SpaceBetweenTagAndTemplateString, this.NoSpaceAfterTemplateHeadAndMiddle, this.NoSpaceBeforeTemplateMiddleAndTail, - // TypeScript-specific rules - this.NoSpaceAfterConstructor, this.NoSpaceAfterModuleImport, - this.SpaceAfterCertainTypeScriptKeywords, this.SpaceBeforeCertainTypeScriptKeywords, - this.SpaceAfterModuleName, - this.SpaceAfterArrow, - this.NoSpaceAfterEllipsis, - this.NoSpaceAfterOptionalParameters, - this.NoSpaceBetweenEmptyInterfaceBraceBrackets, - this.NoSpaceBeforeOpenAngularBracket, - this.NoSpaceBetweenCloseParenAndAngularBracket, - this.NoSpaceAfterOpenAngularBracket, - this.NoSpaceBeforeCloseAngularBracket, - this.NoSpaceAfterCloseAngularBracket, - this.NoSpaceAfterTypeAssertion, - this.SpaceBeforeAt, - this.NoSpaceAfterAt, - this.SpaceAfterDecorator, - ]; + this.HighPriorityCommonRules = [ + this.IgnoreBeforeComment, this.IgnoreAfterLineComment, + this.NoSpaceBeforeColon, this.SpaceAfterColon, this.NoSpaceBeforeQuestionMark, this.SpaceAfterQuestionMarkInConditionalOperator, + this.NoSpaceAfterQuestionMark, + this.NoSpaceBeforeDot, this.NoSpaceAfterDot, + this.NoSpaceAfterUnaryPrefixOperator, + this.NoSpaceAfterUnaryPreincrementOperator, this.NoSpaceAfterUnaryPredecrementOperator, + this.NoSpaceBeforeUnaryPostincrementOperator, this.NoSpaceBeforeUnaryPostdecrementOperator, + this.SpaceAfterPostincrementWhenFollowedByAdd, + this.SpaceAfterAddWhenFollowedByUnaryPlus, this.SpaceAfterAddWhenFollowedByPreincrement, + this.SpaceAfterPostdecrementWhenFollowedBySubtract, + this.SpaceAfterSubtractWhenFollowedByUnaryMinus, this.SpaceAfterSubtractWhenFollowedByPredecrement, + this.NoSpaceAfterCloseBrace, + this.SpaceAfterOpenBrace, this.SpaceBeforeCloseBrace, this.NewLineBeforeCloseBraceInBlockContext, + this.SpaceAfterCloseBrace, this.SpaceBetweenCloseBraceAndElse, this.SpaceBetweenCloseBraceAndWhile, this.NoSpaceBetweenEmptyBraceBrackets, + this.NoSpaceBetweenFunctionKeywordAndStar, this.SpaceAfterStarInGeneratorDeclaration, + this.SpaceAfterFunctionInFuncDecl, this.NewLineAfterOpenBraceInBlockContext, this.SpaceAfterGetSetInMember, + this.NoSpaceBetweenYieldKeywordAndStar, this.SpaceBetweenYieldOrYieldStarAndOperand, + this.NoSpaceBetweenReturnAndSemicolon, + this.SpaceAfterCertainKeywords, + this.SpaceAfterLetConstInVariableDeclaration, + this.NoSpaceBeforeOpenParenInFuncCall, + this.SpaceBeforeBinaryKeywordOperator, this.SpaceAfterBinaryKeywordOperator, + this.SpaceAfterVoidOperator, + this.SpaceBetweenAsyncAndOpenParen, this.SpaceBetweenAsyncAndFunctionKeyword, + this.NoSpaceBetweenTagAndTemplateString, + // TypeScript-specific rules + this.NoSpaceAfterConstructor, this.NoSpaceAfterModuleImport, + this.SpaceAfterCertainTypeScriptKeywords, this.SpaceBeforeCertainTypeScriptKeywords, + this.SpaceAfterModuleName, + this.SpaceBeforeArrow, this.SpaceAfterArrow, + this.NoSpaceAfterEllipsis, + this.NoSpaceAfterOptionalParameters, + this.NoSpaceBetweenEmptyInterfaceBraceBrackets, + this.NoSpaceBeforeOpenAngularBracket, + this.NoSpaceBetweenCloseParenAndAngularBracket, + this.NoSpaceAfterOpenAngularBracket, + this.NoSpaceBeforeCloseAngularBracket, + this.NoSpaceAfterCloseAngularBracket, + this.NoSpaceAfterTypeAssertion, + this.SpaceBeforeAt, + this.NoSpaceAfterAt, + this.SpaceAfterDecorator, + ]; // These rules are lower in priority than user-configurable rules. - this.LowPriorityCommonRules = - [ - this.NoSpaceBeforeSemicolon, - this.SpaceBeforeOpenBraceInControl, this.SpaceBeforeOpenBraceInFunction, this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock, - this.NoSpaceBeforeComma, - this.NoSpaceBeforeOpenBracket, - this.NoSpaceAfterCloseBracket, - this.SpaceAfterSemicolon, - this.NoSpaceBeforeOpenParenInFuncDecl, - this.SpaceBetweenStatements, this.SpaceAfterTryFinally - ]; + this.LowPriorityCommonRules = [ + this.NoSpaceBeforeSemicolon, + this.SpaceBeforeOpenBraceInControl, this.SpaceBeforeOpenBraceInFunction, this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock, + this.NoSpaceBeforeComma, + this.NoSpaceBeforeOpenBracket, + this.NoSpaceAfterCloseBracket, + this.SpaceAfterSemicolon, + this.NoSpaceBeforeOpenParenInFuncDecl, + this.SpaceBetweenStatements, this.SpaceAfterTryFinally + ]; /// /// Rules controlled by user options /// // Insert space after comma delimiter - this.SpaceAfterComma = new formatting.Rule(formatting.RuleDescriptor.create3(24 /* CommaToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); - this.NoSpaceAfterComma = new formatting.Rule(formatting.RuleDescriptor.create3(24 /* CommaToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.SpaceAfterComma = new formatting.Rule(formatting.RuleDescriptor.create3(24 /* CommaToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNextTokenNotCloseBracket), 2 /* Space */)); + this.NoSpaceAfterComma = new formatting.Rule(formatting.RuleDescriptor.create3(24 /* CommaToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); // Insert space before and after binary operators - this.SpaceBeforeBinaryOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.BinaryOperators), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); - this.SpaceAfterBinaryOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.BinaryOperators, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); - this.NoSpaceBeforeBinaryOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.BinaryOperators), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 8 /* Delete */)); - this.NoSpaceAfterBinaryOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.BinaryOperators, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 8 /* Delete */)); + this.SpaceBeforeBinaryOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.BinaryOperators), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); + this.SpaceAfterBinaryOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.BinaryOperators, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); + this.NoSpaceBeforeBinaryOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.BinaryOperators), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 8 /* Delete */)); + this.NoSpaceAfterBinaryOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.BinaryOperators, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 8 /* Delete */)); // Insert space after keywords in control flow statements this.SpaceAfterKeywordInControl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Keywords, 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext), 2 /* Space */)); this.NoSpaceAfterKeywordInControl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Keywords, 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext), 8 /* Delete */)); @@ -42138,29 +47958,34 @@ var ts; // Open Brace braces after control block this.NewLineBeforeOpenBraceInControl = new formatting.Rule(formatting.RuleDescriptor.create2(this.ControlOpenBraceLeftTokenRange, 15 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext, Rules.IsBeforeMultilineBlockContext), 4 /* NewLine */), 1 /* CanDeleteNewLines */); // Insert space after semicolon in for statement - this.SpaceAfterSemicolonInFor = new formatting.Rule(formatting.RuleDescriptor.create3(23 /* SemicolonToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsForContext), 2 /* Space */)); - this.NoSpaceAfterSemicolonInFor = new formatting.Rule(formatting.RuleDescriptor.create3(23 /* SemicolonToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsForContext), 8 /* Delete */)); + this.SpaceAfterSemicolonInFor = new formatting.Rule(formatting.RuleDescriptor.create3(23 /* SemicolonToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsForContext), 2 /* Space */)); + this.NoSpaceAfterSemicolonInFor = new formatting.Rule(formatting.RuleDescriptor.create3(23 /* SemicolonToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsForContext), 8 /* Delete */)); // Insert space after opening and before closing nonempty parenthesis - this.SpaceAfterOpenParen = new formatting.Rule(formatting.RuleDescriptor.create3(17 /* OpenParenToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); - this.SpaceBeforeCloseParen = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 18 /* CloseParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); - this.NoSpaceBetweenParens = new formatting.Rule(formatting.RuleDescriptor.create1(17 /* OpenParenToken */, 18 /* CloseParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.NoSpaceAfterOpenParen = new formatting.Rule(formatting.RuleDescriptor.create3(17 /* OpenParenToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.NoSpaceBeforeCloseParen = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 18 /* CloseParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.SpaceAfterOpenParen = new formatting.Rule(formatting.RuleDescriptor.create3(17 /* OpenParenToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); + this.SpaceBeforeCloseParen = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 18 /* CloseParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); + this.NoSpaceBetweenParens = new formatting.Rule(formatting.RuleDescriptor.create1(17 /* OpenParenToken */, 18 /* CloseParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceAfterOpenParen = new formatting.Rule(formatting.RuleDescriptor.create3(17 /* OpenParenToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceBeforeCloseParen = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 18 /* CloseParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); // Insert space after opening and before closing nonempty brackets - this.SpaceAfterOpenBracket = new formatting.Rule(formatting.RuleDescriptor.create3(19 /* OpenBracketToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); - this.SpaceBeforeCloseBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 20 /* CloseBracketToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); - this.NoSpaceBetweenBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(19 /* OpenBracketToken */, 20 /* CloseBracketToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.NoSpaceAfterOpenBracket = new formatting.Rule(formatting.RuleDescriptor.create3(19 /* OpenBracketToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.NoSpaceBeforeCloseBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 20 /* CloseBracketToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.SpaceAfterOpenBracket = new formatting.Rule(formatting.RuleDescriptor.create3(19 /* OpenBracketToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); + this.SpaceBeforeCloseBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 20 /* CloseBracketToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); + this.NoSpaceBetweenBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(19 /* OpenBracketToken */, 20 /* CloseBracketToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceAfterOpenBracket = new formatting.Rule(formatting.RuleDescriptor.create3(19 /* OpenBracketToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceBeforeCloseBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 20 /* CloseBracketToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); + // Insert space after opening and before closing template string braces + this.NoSpaceAfterTemplateHeadAndMiddle = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([12 /* TemplateHead */, 13 /* TemplateMiddle */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); + this.SpaceAfterTemplateHeadAndMiddle = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([12 /* TemplateHead */, 13 /* TemplateMiddle */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); + this.NoSpaceBeforeTemplateMiddleAndTail = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([13 /* TemplateMiddle */, 14 /* TemplateTail */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); + this.SpaceBeforeTemplateMiddleAndTail = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([13 /* TemplateMiddle */, 14 /* TemplateTail */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); // Insert space after function keyword for anonymous functions this.SpaceAfterAnonymousFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(87 /* FunctionKeyword */, 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2 /* Space */)); this.NoSpaceAfterAnonymousFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(87 /* FunctionKeyword */, 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 8 /* Delete */)); } Rules.prototype.getRuleName = function (rule) { var o = this; - for (var name_34 in o) { - if (o[name_34] === rule) { - return name_34; + for (var name_38 in o) { + if (o[name_38] === rule) { + return name_38; } } throw new Error("Unknown rule"); @@ -42169,40 +47994,40 @@ var ts; /// Contexts /// Rules.IsForContext = function (context) { - return context.contextNode.kind === 199 /* ForStatement */; + return context.contextNode.kind === 206 /* ForStatement */; }; Rules.IsNotForContext = function (context) { return !Rules.IsForContext(context); }; Rules.IsBinaryOpContext = function (context) { switch (context.contextNode.kind) { - case 181 /* BinaryExpression */: - case 182 /* ConditionalExpression */: - case 189 /* AsExpression */: - case 150 /* TypePredicate */: - case 158 /* UnionType */: - case 159 /* IntersectionType */: + case 187 /* BinaryExpression */: + case 188 /* ConditionalExpression */: + case 195 /* AsExpression */: + case 154 /* TypePredicate */: + case 162 /* UnionType */: + case 163 /* IntersectionType */: return true; // equals in binding elements: function foo([[x, y] = [1, 2]]) - case 163 /* BindingElement */: + case 169 /* BindingElement */: // equals in type X = ... - case 216 /* TypeAliasDeclaration */: + case 223 /* TypeAliasDeclaration */: // equal in import a = module('a'); - case 221 /* ImportEqualsDeclaration */: + case 229 /* ImportEqualsDeclaration */: // equal in let a = 0; - case 211 /* VariableDeclaration */: + case 218 /* VariableDeclaration */: // equal in p = 0; - case 138 /* Parameter */: - case 247 /* EnumMember */: - case 141 /* PropertyDeclaration */: - case 140 /* PropertySignature */: + case 142 /* Parameter */: + case 255 /* EnumMember */: + case 145 /* PropertyDeclaration */: + case 144 /* PropertySignature */: return context.currentTokenSpan.kind === 56 /* EqualsToken */ || context.nextTokenSpan.kind === 56 /* EqualsToken */; // "in" keyword in for (let x in []) { } - case 200 /* ForInStatement */: + case 207 /* ForInStatement */: return context.currentTokenSpan.kind === 90 /* InKeyword */ || context.nextTokenSpan.kind === 90 /* InKeyword */; // Technically, "of" is not a binary operator, but format it the same way as "in" - case 201 /* ForOfStatement */: - return context.currentTokenSpan.kind === 134 /* OfKeyword */ || context.nextTokenSpan.kind === 134 /* OfKeyword */; + case 208 /* ForOfStatement */: + return context.currentTokenSpan.kind === 138 /* OfKeyword */ || context.nextTokenSpan.kind === 138 /* OfKeyword */; } return false; }; @@ -42210,7 +48035,7 @@ var ts; return !Rules.IsBinaryOpContext(context); }; Rules.IsConditionalOperatorContext = function (context) { - return context.contextNode.kind === 182 /* ConditionalExpression */; + return context.contextNode.kind === 188 /* ConditionalExpression */; }; Rules.IsSameLineTokenOrBeforeMultilineBlockContext = function (context) { //// This check is mainly used inside SpaceBeforeOpenBraceInControl and SpaceBeforeOpenBraceInFunction. @@ -42222,13 +48047,13 @@ var ts; //// Ex: //// if (1) //// { ... } - //// * ) and { are on differnet lines. We only need to format if the block is multiline context. So in this case we don't format. + //// * ) and { are on different lines. We only need to format if the block is multiline context. So in this case we don't format. //// //// Ex: //// if (1) //// { ... //// } - //// * ) and { are on differnet lines. We only need to format if the block is multiline context. So in this case we format. + //// * ) and { are on different lines. We only need to format if the block is multiline context. So in this case we format. return context.TokensAreOnSameLine() || Rules.IsBeforeMultilineBlockContext(context); }; // This check is done before an open brace in a control construct, a function, or a typescript block declaration @@ -42254,93 +48079,93 @@ var ts; return true; } switch (node.kind) { - case 192 /* Block */: - case 220 /* CaseBlock */: - case 165 /* ObjectLiteralExpression */: - case 219 /* ModuleBlock */: + case 199 /* Block */: + case 227 /* CaseBlock */: + case 171 /* ObjectLiteralExpression */: + case 226 /* ModuleBlock */: return true; } return false; }; Rules.IsFunctionDeclContext = function (context) { switch (context.contextNode.kind) { - case 213 /* FunctionDeclaration */: - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: + case 220 /* FunctionDeclaration */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: //case SyntaxKind.MemberFunctionDeclaration: - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: ///case SyntaxKind.MethodSignature: - case 147 /* CallSignature */: - case 173 /* FunctionExpression */: - case 144 /* Constructor */: - case 174 /* ArrowFunction */: + case 151 /* CallSignature */: + case 179 /* FunctionExpression */: + case 148 /* Constructor */: + case 180 /* ArrowFunction */: //case SyntaxKind.ConstructorDeclaration: //case SyntaxKind.SimpleArrowFunctionExpression: //case SyntaxKind.ParenthesizedArrowFunctionExpression: - case 215 /* InterfaceDeclaration */: + case 222 /* InterfaceDeclaration */: return true; } return false; }; Rules.IsFunctionDeclarationOrFunctionExpressionContext = function (context) { - return context.contextNode.kind === 213 /* FunctionDeclaration */ || context.contextNode.kind === 173 /* FunctionExpression */; + return context.contextNode.kind === 220 /* FunctionDeclaration */ || context.contextNode.kind === 179 /* FunctionExpression */; }; Rules.IsTypeScriptDeclWithBlockContext = function (context) { return Rules.NodeIsTypeScriptDeclWithBlockContext(context.contextNode); }; Rules.NodeIsTypeScriptDeclWithBlockContext = function (node) { switch (node.kind) { - case 214 /* ClassDeclaration */: - case 186 /* ClassExpression */: - case 215 /* InterfaceDeclaration */: - case 217 /* EnumDeclaration */: - case 155 /* TypeLiteral */: - case 218 /* ModuleDeclaration */: + case 221 /* ClassDeclaration */: + case 192 /* ClassExpression */: + case 222 /* InterfaceDeclaration */: + case 224 /* EnumDeclaration */: + case 159 /* TypeLiteral */: + case 225 /* ModuleDeclaration */: return true; } return false; }; Rules.IsAfterCodeBlockContext = function (context) { switch (context.currentTokenParent.kind) { - case 214 /* ClassDeclaration */: - case 218 /* ModuleDeclaration */: - case 217 /* EnumDeclaration */: - case 192 /* Block */: - case 244 /* CatchClause */: - case 219 /* ModuleBlock */: - case 206 /* SwitchStatement */: + case 221 /* ClassDeclaration */: + case 225 /* ModuleDeclaration */: + case 224 /* EnumDeclaration */: + case 199 /* Block */: + case 252 /* CatchClause */: + case 226 /* ModuleBlock */: + case 213 /* SwitchStatement */: return true; } return false; }; Rules.IsControlDeclContext = function (context) { switch (context.contextNode.kind) { - case 196 /* IfStatement */: - case 206 /* SwitchStatement */: - case 199 /* ForStatement */: - case 200 /* ForInStatement */: - case 201 /* ForOfStatement */: - case 198 /* WhileStatement */: - case 209 /* TryStatement */: - case 197 /* DoStatement */: - case 205 /* WithStatement */: + case 203 /* IfStatement */: + case 213 /* SwitchStatement */: + case 206 /* ForStatement */: + case 207 /* ForInStatement */: + case 208 /* ForOfStatement */: + case 205 /* WhileStatement */: + case 216 /* TryStatement */: + case 204 /* DoStatement */: + case 212 /* WithStatement */: // TODO // case SyntaxKind.ElseClause: - case 244 /* CatchClause */: + case 252 /* CatchClause */: return true; default: return false; } }; Rules.IsObjectContext = function (context) { - return context.contextNode.kind === 165 /* ObjectLiteralExpression */; + return context.contextNode.kind === 171 /* ObjectLiteralExpression */; }; Rules.IsFunctionCallContext = function (context) { - return context.contextNode.kind === 168 /* CallExpression */; + return context.contextNode.kind === 174 /* CallExpression */; }; Rules.IsNewContext = function (context) { - return context.contextNode.kind === 169 /* NewExpression */; + return context.contextNode.kind === 175 /* NewExpression */; }; Rules.IsFunctionCallOrNewContext = function (context) { return Rules.IsFunctionCallContext(context) || Rules.IsNewContext(context); @@ -42348,11 +48173,14 @@ var ts; Rules.IsPreviousTokenNotComma = function (context) { return context.currentTokenSpan.kind !== 24 /* CommaToken */; }; - Rules.IsArrowFunctionContext = function (context) { - return context.contextNode.kind === 174 /* ArrowFunction */; + Rules.IsNextTokenNotCloseBracket = function (context) { + return context.nextTokenSpan.kind !== 20 /* CloseBracketToken */; }; - Rules.IsSameLineTokenContext = function (context) { - return context.TokensAreOnSameLine(); + Rules.IsArrowFunctionContext = function (context) { + return context.contextNode.kind === 180 /* ArrowFunction */; + }; + Rules.IsNonJsxSameLineTokenContext = function (context) { + return context.TokensAreOnSameLine() && context.contextNode.kind !== 244 /* JsxText */; }; Rules.IsNotBeforeBlockInFunctionDeclarationContext = function (context) { return !Rules.IsFunctionDeclContext(context) && !Rules.IsBeforeBlockContext(context); @@ -42367,41 +48195,41 @@ var ts; while (ts.isExpression(node)) { node = node.parent; } - return node.kind === 139 /* Decorator */; + return node.kind === 143 /* Decorator */; }; Rules.IsStartOfVariableDeclarationList = function (context) { - return context.currentTokenParent.kind === 212 /* VariableDeclarationList */ && + return context.currentTokenParent.kind === 219 /* VariableDeclarationList */ && context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos; }; Rules.IsNotFormatOnEnter = function (context) { return context.formattingRequestKind !== 2 /* FormatOnEnter */; }; Rules.IsModuleDeclContext = function (context) { - return context.contextNode.kind === 218 /* ModuleDeclaration */; + return context.contextNode.kind === 225 /* ModuleDeclaration */; }; Rules.IsObjectTypeContext = function (context) { - return context.contextNode.kind === 155 /* TypeLiteral */; // && context.contextNode.parent.kind !== SyntaxKind.InterfaceDeclaration; + return context.contextNode.kind === 159 /* TypeLiteral */; // && context.contextNode.parent.kind !== SyntaxKind.InterfaceDeclaration; }; Rules.IsTypeArgumentOrParameterOrAssertion = function (token, parent) { if (token.kind !== 25 /* LessThanToken */ && token.kind !== 27 /* GreaterThanToken */) { return false; } switch (parent.kind) { - case 151 /* TypeReference */: - case 171 /* TypeAssertionExpression */: - case 214 /* ClassDeclaration */: - case 186 /* ClassExpression */: - case 215 /* InterfaceDeclaration */: - case 213 /* FunctionDeclaration */: - case 173 /* FunctionExpression */: - case 174 /* ArrowFunction */: - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - case 147 /* CallSignature */: - case 148 /* ConstructSignature */: - case 168 /* CallExpression */: - case 169 /* NewExpression */: - case 188 /* ExpressionWithTypeArguments */: + case 155 /* TypeReference */: + case 177 /* TypeAssertionExpression */: + case 221 /* ClassDeclaration */: + case 192 /* ClassExpression */: + case 222 /* InterfaceDeclaration */: + case 220 /* FunctionDeclaration */: + case 179 /* FunctionExpression */: + case 180 /* ArrowFunction */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: + case 151 /* CallSignature */: + case 152 /* ConstructSignature */: + case 174 /* CallExpression */: + case 175 /* NewExpression */: + case 194 /* ExpressionWithTypeArguments */: return true; default: return false; @@ -42412,16 +48240,16 @@ var ts; Rules.IsTypeArgumentOrParameterOrAssertion(context.nextTokenSpan, context.nextTokenParent); }; Rules.IsTypeAssertionContext = function (context) { - return context.contextNode.kind === 171 /* TypeAssertionExpression */; + return context.contextNode.kind === 177 /* TypeAssertionExpression */; }; Rules.IsVoidOpContext = function (context) { - return context.currentTokenSpan.kind === 103 /* VoidKeyword */ && context.currentTokenParent.kind === 177 /* VoidExpression */; + return context.currentTokenSpan.kind === 103 /* VoidKeyword */ && context.currentTokenParent.kind === 183 /* VoidExpression */; }; Rules.IsYieldOrYieldStarWithOperand = function (context) { - return context.contextNode.kind === 184 /* YieldExpression */ && context.contextNode.expression !== undefined; + return context.contextNode.kind === 190 /* YieldExpression */ && context.contextNode.expression !== undefined; }; return Rules; - })(); + }()); formatting.Rules = Rules; })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); @@ -42442,7 +48270,7 @@ var ts; return result; }; RulesMap.prototype.Initialize = function (rules) { - this.mapRowLength = 134 /* LastToken */ + 1; + this.mapRowLength = 138 /* LastToken */ + 1; this.map = new Array(this.mapRowLength * this.mapRowLength); //new Array(this.mapRowLength * this.mapRowLength); // This array is used only during construction of the rulesbucket in the map var rulesBucketConstructionStateList = new Array(this.map.length); //new Array(this.map.length); @@ -42489,7 +48317,7 @@ var ts; return null; }; return RulesMap; - })(); + }()); formatting.RulesMap = RulesMap; var MaskBitSize = 5; var Mask = 0x1f; @@ -42541,7 +48369,7 @@ var ts; this.rulesInsertionIndexBitmap = temp; }; return RulesBucketConstructionState; - })(); + }()); formatting.RulesBucketConstructionState = RulesBucketConstructionState; var RulesBucket = (function () { function RulesBucket() { @@ -42576,7 +48404,7 @@ var ts; state.IncreaseInsertionIndex(position); }; return RulesBucket; - })(); + }()); formatting.RulesBucket = RulesBucket; })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); @@ -42604,7 +48432,7 @@ var ts; return this.tokens.indexOf(token) >= 0; }; return TokenRangeAccess; - })(); + }()); Shared.TokenRangeAccess = TokenRangeAccess; var TokenValuesAccess = (function () { function TokenValuesAccess(tks) { @@ -42617,7 +48445,7 @@ var ts; return this.tokens.indexOf(token) >= 0; }; return TokenValuesAccess; - })(); + }()); Shared.TokenValuesAccess = TokenValuesAccess; var TokenSingleValueAccess = (function () { function TokenSingleValueAccess(token) { @@ -42630,14 +48458,14 @@ var ts; return tokenValue === this.token; }; return TokenSingleValueAccess; - })(); + }()); Shared.TokenSingleValueAccess = TokenSingleValueAccess; var TokenAllAccess = (function () { function TokenAllAccess() { } TokenAllAccess.prototype.GetTokens = function () { var result = []; - for (var token = 0 /* FirstToken */; token <= 134 /* LastToken */; token++) { + for (var token = 0 /* FirstToken */; token <= 138 /* LastToken */; token++) { result.push(token); } return result; @@ -42649,7 +48477,7 @@ var ts; return "[allTokens]"; }; return TokenAllAccess; - })(); + }()); Shared.TokenAllAccess = TokenAllAccess; var TokenRange = (function () { function TokenRange(tokenAccess) { @@ -42679,9 +48507,9 @@ var ts; }; TokenRange.Any = TokenRange.AllTokens(); TokenRange.AnyIncludingMultilineComments = TokenRange.FromTokens(TokenRange.Any.GetTokens().concat([3 /* MultiLineCommentTrivia */])); - TokenRange.Keywords = TokenRange.FromRange(70 /* FirstKeyword */, 134 /* LastKeyword */); + TokenRange.Keywords = TokenRange.FromRange(70 /* FirstKeyword */, 138 /* LastKeyword */); TokenRange.BinaryOperators = TokenRange.FromRange(25 /* FirstBinaryOperator */, 68 /* LastBinaryOperator */); - TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([90 /* InKeyword */, 91 /* InstanceOfKeyword */, 134 /* OfKeyword */, 116 /* AsKeyword */, 124 /* IsKeyword */]); + TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([90 /* InKeyword */, 91 /* InstanceOfKeyword */, 138 /* OfKeyword */, 116 /* AsKeyword */, 124 /* IsKeyword */]); TokenRange.UnaryPrefixOperators = TokenRange.FromTokens([41 /* PlusPlusToken */, 42 /* MinusMinusToken */, 50 /* TildeToken */, 49 /* ExclamationToken */]); TokenRange.UnaryPrefixExpressions = TokenRange.FromTokens([8 /* NumericLiteral */, 69 /* Identifier */, 17 /* OpenParenToken */, 19 /* OpenBracketToken */, 15 /* OpenBraceToken */, 97 /* ThisKeyword */, 92 /* NewKeyword */]); TokenRange.UnaryPreincrementExpressions = TokenRange.FromTokens([69 /* Identifier */, 17 /* OpenParenToken */, 97 /* ThisKeyword */, 92 /* NewKeyword */]); @@ -42689,9 +48517,9 @@ var ts; TokenRange.UnaryPredecrementExpressions = TokenRange.FromTokens([69 /* Identifier */, 17 /* OpenParenToken */, 97 /* ThisKeyword */, 92 /* NewKeyword */]); TokenRange.UnaryPostdecrementExpressions = TokenRange.FromTokens([69 /* Identifier */, 18 /* CloseParenToken */, 20 /* CloseBracketToken */, 92 /* NewKeyword */]); TokenRange.Comments = TokenRange.FromTokens([2 /* SingleLineCommentTrivia */, 3 /* MultiLineCommentTrivia */]); - TokenRange.TypeNames = TokenRange.FromTokens([69 /* Identifier */, 128 /* NumberKeyword */, 130 /* StringKeyword */, 120 /* BooleanKeyword */, 131 /* SymbolKeyword */, 103 /* VoidKeyword */, 117 /* AnyKeyword */]); + TokenRange.TypeNames = TokenRange.FromTokens([69 /* Identifier */, 130 /* NumberKeyword */, 132 /* StringKeyword */, 120 /* BooleanKeyword */, 133 /* SymbolKeyword */, 103 /* VoidKeyword */, 117 /* AnyKeyword */]); return TokenRange; - })(); + }()); Shared.TokenRange = TokenRange; })(Shared = formatting.Shared || (formatting.Shared = {})); })(formatting = ts.formatting || (ts.formatting = {})); @@ -42777,6 +48605,14 @@ var ts; rules.push(this.globalRules.NoSpaceBeforeCloseBracket); rules.push(this.globalRules.NoSpaceBetweenBrackets); } + if (options.InsertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces) { + rules.push(this.globalRules.SpaceAfterTemplateHeadAndMiddle); + rules.push(this.globalRules.SpaceBeforeTemplateMiddleAndTail); + } + else { + rules.push(this.globalRules.NoSpaceAfterTemplateHeadAndMiddle); + rules.push(this.globalRules.NoSpaceBeforeTemplateMiddleAndTail); + } if (options.InsertSpaceAfterSemicolonInForStatements) { rules.push(this.globalRules.SpaceAfterSemicolonInFor); } @@ -42802,7 +48638,7 @@ var ts; return rules; }; return RulesProvider; - })(); + }()); formatting.RulesProvider = RulesProvider; })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); @@ -42824,12 +48660,20 @@ var ts; if (line === 0) { return []; } - // get the span for the previous\current line + // After the enter key, the cursor is now at a new line. The new line may or may not contain non-whitespace characters. + // If the new line has only whitespaces, we won't want to format this line, because that would remove the indentation as + // trailing whitespaces. So the end of the formatting span should be the later one between: + // 1. the end of the previous line + // 2. the last non-whitespace character in the current line + var endOfFormatSpan = ts.getEndLinePosition(line, sourceFile); + while (ts.isWhiteSpace(sourceFile.text.charCodeAt(endOfFormatSpan)) && !ts.isLineBreak(sourceFile.text.charCodeAt(endOfFormatSpan))) { + endOfFormatSpan--; + } var span = { // get start position for the previous line pos: ts.getStartPositionOfLine(line - 1, sourceFile), - // get end position for the current line (end value is exclusive so add 1 to the result) - end: ts.getEndLinePosition(line, sourceFile) + 1 + // end value is exclusive so add 1 to the result + end: endOfFormatSpan + 1 }; return formatSpan(span, sourceFile, options, rulesProvider, 2 /* FormatOnEnter */); } @@ -42872,9 +48716,9 @@ var ts; } function findOutermostParent(position, expectedTokenKind, sourceFile) { var precedingToken = ts.findPrecedingToken(position, sourceFile); - // when it is claimed that trigger character was typed at given position + // when it is claimed that trigger character was typed at given position // we verify that there is a token with a matching kind whose end is equal to position (because the character was just typed). - // If this condition is not hold - then trigger character was typed in some other context, + // If this condition is not hold - then trigger character was typed in some other context, // i.e.in comment and thus should not trigger autoformatting if (!precedingToken || precedingToken.kind !== expectedTokenKind || @@ -42883,12 +48727,12 @@ var ts; } // walk up and search for the parent node that ends at the same position with precedingToken. // for cases like this - // + // // let x = 1; // while (true) { - // } + // } // after typing close curly in while statement we want to reformat just the while statement. - // However if we just walk upwards searching for the parent that has the same end value - + // However if we just walk upwards searching for the parent that has the same end value - // we'll end up with the whole source file. isListElement allows to stop on the list element level var current = precedingToken; while (current && @@ -42903,17 +48747,17 @@ var ts; // i.e. parent is class declaration with the list of members and node is one of members. function isListElement(parent, node) { switch (parent.kind) { - case 214 /* ClassDeclaration */: - case 215 /* InterfaceDeclaration */: + case 221 /* ClassDeclaration */: + case 222 /* InterfaceDeclaration */: return ts.rangeContainsRange(parent.members, node); - case 218 /* ModuleDeclaration */: + case 225 /* ModuleDeclaration */: var body = parent.body; - return body && body.kind === 192 /* Block */ && ts.rangeContainsRange(body.statements, node); - case 248 /* SourceFile */: - case 192 /* Block */: - case 219 /* ModuleBlock */: + return body && body.kind === 199 /* Block */ && ts.rangeContainsRange(body.statements, node); + case 256 /* SourceFile */: + case 199 /* Block */: + case 226 /* ModuleBlock */: return ts.rangeContainsRange(parent.statements, node); - case 244 /* CatchClause */: + case 252 /* CatchClause */: return ts.rangeContainsRange(parent.block.statements, node); } return false; @@ -42953,7 +48797,7 @@ var ts; // 'index' tracks the index of the most recent error that was checked. while (true) { if (index >= sorted.length) { - // all errors in the range were already checked -> no error in specified range + // all errors in the range were already checked -> no error in specified range return false; } var error = sorted[index]; @@ -42987,7 +48831,7 @@ var ts; // no preceding token found - start from the beginning of enclosing node return enclosingNode.pos; } - // preceding token ends after the start of original range (i.e when originaRange.pos falls in the middle of literal) + // preceding token ends after the start of original range (i.e when originalRange.pos falls in the middle of literal) // start from the beginning of enclosingNode to handle the entire 'originalRange' if (precedingToken.end >= originalRange.pos) { return enclosingNode.pos; @@ -43011,17 +48855,17 @@ var ts; */ function getOwnOrInheritedDelta(n, options, sourceFile) { var previousLine = -1 /* Unknown */; - var childKind = 0 /* Unknown */; + var child; while (n) { var line = sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)).line; if (previousLine !== -1 /* Unknown */ && line !== previousLine) { break; } - if (formatting.SmartIndenter.shouldIndentChildNode(n.kind, childKind)) { + if (formatting.SmartIndenter.shouldIndentChildNode(n, child)) { return options.IndentSize; } previousLine = line; - childKind = n.kind; + child = n; n = n.parent; } return 0; @@ -43051,6 +48895,13 @@ var ts; var delta = getOwnOrInheritedDelta(enclosingNode, options, sourceFile); processNode(enclosingNode, enclosingNode, startLine, undecoratedStartLine, initialIndentation, delta); } + if (!formattingScanner.isOnToken()) { + var leadingTrivia = formattingScanner.getCurrentLeadingTrivia(); + if (leadingTrivia) { + processTrivia(leadingTrivia, enclosingNode, enclosingNode, undefined); + trimTrailingWhitespacesForRemainingRange(); + } + } formattingScanner.close(); return edits; // local functions @@ -43062,7 +48913,8 @@ var ts; * to inherited indentation from its predecessors. */ function tryComputeIndentationForListItem(startPos, endPos, parentStartLine, range, inheritedIndentation) { - if (ts.rangeOverlapsWithStartEnd(range, startPos, endPos)) { + if (ts.rangeOverlapsWithStartEnd(range, startPos, endPos) || + ts.rangeContainsStartEnd(range, startPos, endPos) /* Not to miss zero-range nodes e.g. JsxText */) { if (inheritedIndentation !== -1 /* Unknown */) { return inheritedIndentation; } @@ -43079,32 +48931,7 @@ var ts; } function computeIndentation(node, startLine, inheritedIndentation, parent, parentDynamicIndentation, effectiveParentStartLine) { var indentation = inheritedIndentation; - if (indentation === -1 /* Unknown */) { - if (isSomeBlock(node.kind)) { - // blocks should be indented in - // - other blocks - // - source file - // - switch\default clauses - if (isSomeBlock(parent.kind) || - parent.kind === 248 /* SourceFile */ || - parent.kind === 241 /* CaseClause */ || - parent.kind === 242 /* DefaultClause */) { - indentation = parentDynamicIndentation.getIndentation() + parentDynamicIndentation.getDelta(); - } - else { - indentation = parentDynamicIndentation.getIndentation(); - } - } - else { - if (formatting.SmartIndenter.childStartsOnTheSameLineWithElseInIfStatement(parent, node, startLine, sourceFile)) { - indentation = parentDynamicIndentation.getIndentation(); - } - else { - indentation = parentDynamicIndentation.getIndentation() + parentDynamicIndentation.getDelta(); - } - } - } - var delta = formatting.SmartIndenter.shouldIndentChildNode(node.kind, 0 /* Unknown */) ? options.IndentSize : 0; + var delta = formatting.SmartIndenter.shouldIndentChildNode(node) ? options.IndentSize : 0; if (effectiveParentStartLine === startLine) { // if node is located on the same line with the parent // - inherit indentation from the parent @@ -43112,7 +48939,15 @@ var ts; indentation = startLine === lastIndentedLine ? indentationOnLastIndentedLine : parentDynamicIndentation.getIndentation(); - delta = Math.min(options.IndentSize, parentDynamicIndentation.getDelta() + delta); + delta = Math.min(options.IndentSize, parentDynamicIndentation.getDelta(node) + delta); + } + else if (indentation === -1 /* Unknown */) { + if (formatting.SmartIndenter.childStartsOnTheSameLineWithElseInIfStatement(parent, node, startLine, sourceFile)) { + indentation = parentDynamicIndentation.getIndentation(); + } + else { + indentation = parentDynamicIndentation.getIndentation() + parentDynamicIndentation.getDelta(node); + } } return { indentation: indentation, @@ -43124,25 +48959,25 @@ var ts; return node.modifiers[0].kind; } switch (node.kind) { - case 214 /* ClassDeclaration */: return 73 /* ClassKeyword */; - case 215 /* InterfaceDeclaration */: return 107 /* InterfaceKeyword */; - case 213 /* FunctionDeclaration */: return 87 /* FunctionKeyword */; - case 217 /* EnumDeclaration */: return 217 /* EnumDeclaration */; - case 145 /* GetAccessor */: return 123 /* GetKeyword */; - case 146 /* SetAccessor */: return 129 /* SetKeyword */; - case 143 /* MethodDeclaration */: + case 221 /* ClassDeclaration */: return 73 /* ClassKeyword */; + case 222 /* InterfaceDeclaration */: return 107 /* InterfaceKeyword */; + case 220 /* FunctionDeclaration */: return 87 /* FunctionKeyword */; + case 224 /* EnumDeclaration */: return 224 /* EnumDeclaration */; + case 149 /* GetAccessor */: return 123 /* GetKeyword */; + case 150 /* SetAccessor */: return 131 /* SetKeyword */; + case 147 /* MethodDeclaration */: if (node.asteriskToken) { return 37 /* AsteriskToken */; } // fall-through - case 141 /* PropertyDeclaration */: - case 138 /* Parameter */: + case 145 /* PropertyDeclaration */: + case 142 /* Parameter */: return node.name.kind; } } function getDynamicIndentation(node, nodeStartLine, indentation, delta) { return { - getIndentationForComment: function (kind, tokenIndentation) { + getIndentationForComment: function (kind, tokenIndentation, container) { switch (kind) { // preceding comment to the token that closes the indentation scope inherits the indentation from the scope // .. { @@ -43151,11 +48986,11 @@ var ts; case 16 /* CloseBraceToken */: case 20 /* CloseBracketToken */: case 18 /* CloseParenToken */: - return indentation + delta; + return indentation + getEffectiveDelta(delta, container); } return tokenIndentation !== -1 /* Unknown */ ? tokenIndentation : indentation; }, - getIndentationForToken: function (line, kind) { + getIndentationForToken: function (line, kind, container) { if (nodeStartLine !== line && node.decorators) { if (kind === getFirstNonDecoratorTokenOfNode(node)) { // if this token is the first token following the list of decorators, we do not need to indent @@ -43176,20 +49011,20 @@ var ts; return indentation; default: // if token line equals to the line of containing node (this is a first token in the node) - use node indentation - return nodeStartLine !== line ? indentation + delta : indentation; + return nodeStartLine !== line ? indentation + getEffectiveDelta(delta, container) : indentation; } }, getIndentation: function () { return indentation; }, - getDelta: function () { return delta; }, + getDelta: function (child) { return getEffectiveDelta(delta, child); }, recomputeIndentation: function (lineAdded) { - if (node.parent && formatting.SmartIndenter.shouldIndentChildNode(node.parent.kind, node.kind)) { + if (node.parent && formatting.SmartIndenter.shouldIndentChildNode(node.parent, node)) { if (lineAdded) { indentation += options.IndentSize; } else { indentation -= options.IndentSize; } - if (formatting.SmartIndenter.shouldIndentChildNode(node.kind, 0 /* Unknown */)) { + if (formatting.SmartIndenter.shouldIndentChildNode(node)) { delta = options.IndentSize; } else { @@ -43198,6 +49033,10 @@ var ts; } } }; + function getEffectiveDelta(delta, child) { + // Delta value should be zero when the node explicitly prevents indentation of the child node + return formatting.SmartIndenter.nodeWillIndentChild(node, child, true) ? delta : 0; + } } function processNode(node, contextNode, nodeStartLine, undecoratedNodeStartLine, indentation, delta) { if (!ts.rangeOverlapsWithStartEnd(originalRange, node.getStart(sourceFile), node.getEnd())) { @@ -43207,12 +49046,12 @@ var ts; // a useful observations when tracking context node // / // [a] - // / | \ + // / | \ // [b] [c] [d] - // node 'a' is a context node for nodes 'b', 'c', 'd' + // node 'a' is a context node for nodes 'b', 'c', 'd' // except for the leftmost leaf token in [b] - in this case context node ('e') is located somewhere above 'a' // this rule can be applied recursively to child nodes of 'a'. - // + // // context node is set to parent node value after processing every child node // context node is set to parent of the token after processing every token var childContextNode = contextNode; @@ -43231,7 +49070,7 @@ var ts; } consumeTokenAndAdvanceScanner(tokenInfo, node, nodeDynamicIndentation); } - function processChildNode(child, inheritedIndentation, parent, parentDynamicIndentation, parentStartLine, undecoratedParentStartLine, isListItem) { + function processChildNode(child, inheritedIndentation, parent, parentDynamicIndentation, parentStartLine, undecoratedParentStartLine, isListItem, isFirstListItem) { var childStartPos = child.getStart(sourceFile); var childStartLine = sourceFile.getLineAndCharacterOfPosition(childStartPos).line; var undecoratedChildStartLine = childStartLine; @@ -43269,13 +49108,16 @@ var ts; // if child node is a token, it does not impact indentation, proceed it using parent indentation scope rules var tokenInfo = formattingScanner.readTokenInfo(child); ts.Debug.assert(tokenInfo.token.end === child.end); - consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation); + consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation, child); return inheritedIndentation; } - var effectiveParentStartLine = child.kind === 139 /* Decorator */ ? childStartLine : undecoratedParentStartLine; + var effectiveParentStartLine = child.kind === 143 /* Decorator */ ? childStartLine : undecoratedParentStartLine; var childIndentation = computeIndentation(child, childStartLine, childIndentationAmount, node, parentDynamicIndentation, effectiveParentStartLine); processNode(child, childContextNode, childStartLine, undecoratedChildStartLine, childIndentation.indentation, childIndentation.delta); childContextNode = node; + if (isFirstListItem && parent.kind === 170 /* ArrayLiteralExpression */ && inheritedIndentation === -1 /* Unknown */) { + inheritedIndentation = childIndentation.indentation; + } return inheritedIndentation; } function processChildNodes(nodes, parent, parentStartLine, parentDynamicIndentation) { @@ -43305,16 +49147,16 @@ var ts; } } var inheritedIndentation = -1 /* Unknown */; - for (var _i = 0, nodes_6 = nodes; _i < nodes_6.length; _i++) { - var child = nodes_6[_i]; - inheritedIndentation = processChildNode(child, inheritedIndentation, node, listDynamicIndentation, startLine, startLine, /*isListElement*/ true); + for (var i = 0; i < nodes.length; i++) { + var child = nodes[i]; + inheritedIndentation = processChildNode(child, inheritedIndentation, node, listDynamicIndentation, startLine, startLine, /*isListElement*/ true, /*isFirstListItem*/ i === 0); } if (listEndToken !== 0 /* Unknown */) { if (formattingScanner.isOnToken()) { var tokenInfo = formattingScanner.readTokenInfo(parent); // consume the list end token only if it is still belong to the parent // there might be the case when current token matches end token but does not considered as one - // function (x: function) <-- + // function (x: function) <-- // without this check close paren will be interpreted as list end token for function expression which is wrong if (tokenInfo.token.kind === listEndToken && ts.rangeContainsRange(parent, tokenInfo.token)) { // consume list end token @@ -43323,7 +49165,7 @@ var ts; } } } - function consumeTokenAndAdvanceScanner(currentTokenInfo, parent, dynamicIndentation) { + function consumeTokenAndAdvanceScanner(currentTokenInfo, parent, dynamicIndentation, container) { ts.Debug.assert(ts.rangeContainsRange(parent, currentTokenInfo.token)); var lastTriviaWasNewLine = formattingScanner.lastTrailingTriviaWasNewLine(); var indentToken = false; @@ -43358,26 +49200,26 @@ var ts; } if (indentToken) { var tokenIndentation = (isTokenInRange && !rangeContainsError(currentTokenInfo.token)) ? - dynamicIndentation.getIndentationForToken(tokenStart.line, currentTokenInfo.token.kind) : + dynamicIndentation.getIndentationForToken(tokenStart.line, currentTokenInfo.token.kind, container) : -1 /* Unknown */; + var indentNextTokenOrTrivia = true; if (currentTokenInfo.leadingTrivia) { - var commentIndentation = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind, tokenIndentation); - var indentNextTokenOrTrivia = true; + var commentIndentation = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind, tokenIndentation, container); for (var _i = 0, _a = currentTokenInfo.leadingTrivia; _i < _a.length; _i++) { var triviaItem = _a[_i]; - if (!ts.rangeContainsRange(originalRange, triviaItem)) { - continue; - } + var triviaInRange = ts.rangeContainsRange(originalRange, triviaItem); switch (triviaItem.kind) { case 3 /* MultiLineCommentTrivia */: - indentMultilineComment(triviaItem, commentIndentation, /*firstLineIsIndented*/ !indentNextTokenOrTrivia); + if (triviaInRange) { + indentMultilineComment(triviaItem, commentIndentation, /*firstLineIsIndented*/ !indentNextTokenOrTrivia); + } indentNextTokenOrTrivia = false; break; case 2 /* SingleLineCommentTrivia */: - if (indentNextTokenOrTrivia) { + if (indentNextTokenOrTrivia && triviaInRange) { insertIndentation(triviaItem.pos, commentIndentation, /*lineAdded*/ false); - indentNextTokenOrTrivia = false; } + indentNextTokenOrTrivia = false; break; case 4 /* NewLineTrivia */: indentNextTokenOrTrivia = true; @@ -43386,7 +49228,7 @@ var ts; } } // indent token only if is it is in target range and does not overlap with any error ranges - if (tokenIndentation !== -1 /* Unknown */) { + if (tokenIndentation !== -1 /* Unknown */ && indentNextTokenOrTrivia) { insertIndentation(currentTokenInfo.token.pos, tokenIndentation, lineAdded); lastIndentedLine = tokenStart.line; indentationOnLastIndentedLine = tokenIndentation; @@ -43434,7 +49276,7 @@ var ts; applyRuleEdits(rule, previousItem, previousStartLine, currentItem, currentStartLine); if (rule.Operation.Action & (2 /* Space */ | 8 /* Delete */) && currentStartLine !== previousStartLine) { lineAdded = false; - // Handle the case where the next line is moved to be the end of this line. + // Handle the case where the next line is moved to be the end of this line. // In this case we don't indent the next line in the next pass. if (currentParent.getStart(sourceFile) === currentItem.pos) { dynamicIndentation.recomputeIndentation(/*lineAdded*/ false); @@ -43442,7 +49284,7 @@ var ts; } else if (rule.Operation.Action & 4 /* NewLine */ && currentStartLine === previousStartLine) { lineAdded = true; - // Handle the case where token2 is moved to the new line. + // Handle the case where token2 is moved to the new line. // In this case we indent token2 in the next pass but we set // sameLineIndent flag to notify the indenter that the indentation is within the line. if (currentParent.getStart(sourceFile) === currentItem.pos) { @@ -43450,9 +49292,7 @@ var ts; } } // We need to trim trailing whitespace between the tokens if they were on different lines, and no rule was applied to put them on the same line - trimTrailingWhitespaces = - (rule.Operation.Action & (4 /* NewLine */ | 2 /* Space */)) && - rule.Flag !== 1 /* CanDeleteNewLines */; + trimTrailingWhitespaces = !(rule.Operation.Action & 8 /* Delete */) && rule.Flag !== 1 /* CanDeleteNewLines */; } else { trimTrailingWhitespaces = true; @@ -43472,12 +49312,15 @@ var ts; } else { var tokenStart = sourceFile.getLineAndCharacterOfPosition(pos); - if (indentation !== tokenStart.character) { - var startLinePosition = ts.getStartPositionOfLine(tokenStart.line, sourceFile); + var startLinePosition = ts.getStartPositionOfLine(tokenStart.line, sourceFile); + if (indentation !== tokenStart.character || indentationIsDifferent(indentationString, startLinePosition)) { recordReplace(startLinePosition, tokenStart.character, indentationString); } } } + function indentationIsDifferent(indentationString, startLinePosition) { + return indentationString !== sourceFile.text.substr(startLinePosition, indentationString.length); + } function indentMultilineComment(commentRange, indentation, firstLineIsIndented) { // split comment in lines var startLine = sourceFile.getLineAndCharacterOfPosition(commentRange.pos).line; @@ -43535,16 +49378,36 @@ var ts; if (range && (ts.isComment(range.kind) || ts.isStringOrRegularExpressionOrTemplateLiteral(range.kind)) && range.pos <= lineEndPosition && range.end > lineEndPosition) { continue; } - var pos = lineEndPosition; - while (pos >= lineStartPosition && ts.isWhiteSpace(sourceFile.text.charCodeAt(pos))) { - pos--; - } - if (pos !== lineEndPosition) { - ts.Debug.assert(pos === lineStartPosition || !ts.isWhiteSpace(sourceFile.text.charCodeAt(pos))); - recordDelete(pos + 1, lineEndPosition - pos); + var whitespaceStart = getTrailingWhitespaceStartPosition(lineStartPosition, lineEndPosition); + if (whitespaceStart !== -1) { + ts.Debug.assert(whitespaceStart === lineStartPosition || !ts.isWhiteSpace(sourceFile.text.charCodeAt(whitespaceStart - 1))); + recordDelete(whitespaceStart, lineEndPosition + 1 - whitespaceStart); } } } + /** + * @param start The position of the first character in range + * @param end The position of the last character in range + */ + function getTrailingWhitespaceStartPosition(start, end) { + var pos = end; + while (pos >= start && ts.isWhiteSpace(sourceFile.text.charCodeAt(pos))) { + pos--; + } + if (pos !== end) { + return pos + 1; + } + return -1; + } + /** + * Trimming will be done for lines after the previous range + */ + function trimTrailingWhitespacesForRemainingRange() { + var startPosition = previousRange ? previousRange.end : originalRange.pos; + var startLine = sourceFile.getLineAndCharacterOfPosition(startPosition).line; + var endLine = sourceFile.getLineAndCharacterOfPosition(originalRange.end).line; + trimTrailingWhitespacesForLines(startLine, endLine + 1, previousRange); + } function newTextChange(start, len, newText) { return { span: ts.createTextSpan(start, len), newText: newText }; } @@ -43598,20 +49461,20 @@ var ts; } function isSomeBlock(kind) { switch (kind) { - case 192 /* Block */: - case 219 /* ModuleBlock */: + case 199 /* Block */: + case 226 /* ModuleBlock */: return true; } return false; } function getOpenTokenForList(node, list) { switch (node.kind) { - case 144 /* Constructor */: - case 213 /* FunctionDeclaration */: - case 173 /* FunctionExpression */: - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - case 174 /* ArrowFunction */: + case 148 /* Constructor */: + case 220 /* FunctionDeclaration */: + case 179 /* FunctionExpression */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: + case 180 /* ArrowFunction */: if (node.typeParameters === list) { return 25 /* LessThanToken */; } @@ -43619,8 +49482,8 @@ var ts; return 17 /* OpenParenToken */; } break; - case 168 /* CallExpression */: - case 169 /* NewExpression */: + case 174 /* CallExpression */: + case 175 /* NewExpression */: if (node.typeArguments === list) { return 25 /* LessThanToken */; } @@ -43628,7 +49491,7 @@ var ts; return 17 /* OpenParenToken */; } break; - case 151 /* TypeReference */: + case 155 /* TypeReference */: if (node.typeArguments === list) { return 25 /* LessThanToken */; } @@ -43657,7 +49520,7 @@ var ts; if (!options.ConvertTabsToSpaces) { var tabs = Math.floor(indentation / options.TabSize); var spaces = indentation - tabs * options.TabSize; - var tabString; + var tabString = void 0; if (!internedTabsIndentation) { internedTabsIndentation = []; } @@ -43670,7 +49533,7 @@ var ts; return spaces ? tabString + repeat(" ", spaces) : tabString; } else { - var spacesString; + var spacesString = void 0; var quotient = Math.floor(indentation / options.IndentSize); var remainder = indentation % options.IndentSize; if (!internedSpacesIndentation) { @@ -43744,7 +49607,7 @@ var ts; var lineStart = ts.getLineStartPositionForPosition(current_1, sourceFile); return SmartIndenter.findFirstNonWhitespaceColumn(lineStart, current_1, sourceFile, options); } - if (precedingToken.kind === 24 /* CommaToken */ && precedingToken.parent.kind !== 181 /* BinaryExpression */) { + if (precedingToken.kind === 24 /* CommaToken */ && precedingToken.parent.kind !== 187 /* BinaryExpression */) { // previous token is comma that separates items in list - find the previous item and try to derive indentation from it var actualIndentation = getActualIndentationForListItemBeforeComma(precedingToken, sourceFile, options); if (actualIndentation !== -1 /* Unknown */) { @@ -43758,7 +49621,7 @@ var ts; var currentStart; var indentationDelta; while (current) { - if (ts.positionBelongsToNode(current, position, sourceFile) && shouldIndentChildNode(current.kind, previous ? previous.kind : 0 /* Unknown */)) { + if (ts.positionBelongsToNode(current, position, sourceFile) && shouldIndentChildNode(current, previous)) { currentStart = getStartLineAndCharacterForNode(current, sourceFile); if (nextTokenIsCurlyBraceOnSameLineAsCursor(precedingToken, current, lineAtPosition, sourceFile)) { indentationDelta = 0; @@ -43825,7 +49688,7 @@ var ts; } } // increase indentation if parent node wants its content to be indented and parent and child nodes don't start on the same line - if (shouldIndentChildNode(parent.kind, current.kind) && !parentAndChildShareLine) { + if (shouldIndentChildNode(parent, current) && !parentAndChildShareLine) { indentationDelta += options.IndentSize; } current = parent; @@ -43863,7 +49726,7 @@ var ts; // - parent is SourceFile - by default immediate children of SourceFile are not indented except when user indents them manually // - parent and child are not on the same line var useActualIndentation = (ts.isDeclaration(current) || ts.isStatement(current)) && - (parent.kind === 248 /* SourceFile */ || !parentAndChildShareLine); + (parent.kind === 256 /* SourceFile */ || !parentAndChildShareLine); if (!useActualIndentation) { return -1 /* Unknown */; } @@ -43896,7 +49759,7 @@ var ts; return sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)); } function childStartsOnTheSameLineWithElseInIfStatement(parent, child, childStartLine, sourceFile) { - if (parent.kind === 196 /* IfStatement */ && parent.elseStatement === child) { + if (parent.kind === 203 /* IfStatement */ && parent.elseStatement === child) { var elseKeyword = ts.findChildOfKind(parent, 80 /* ElseKeyword */, sourceFile); ts.Debug.assert(elseKeyword !== undefined); var elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line; @@ -43908,23 +49771,23 @@ var ts; function getContainingList(node, sourceFile) { if (node.parent) { switch (node.parent.kind) { - case 151 /* TypeReference */: + case 155 /* TypeReference */: if (node.parent.typeArguments && ts.rangeContainsStartEnd(node.parent.typeArguments, node.getStart(sourceFile), node.getEnd())) { return node.parent.typeArguments; } break; - case 165 /* ObjectLiteralExpression */: + case 171 /* ObjectLiteralExpression */: return node.parent.properties; - case 164 /* ArrayLiteralExpression */: + case 170 /* ArrayLiteralExpression */: return node.parent.elements; - case 213 /* FunctionDeclaration */: - case 173 /* FunctionExpression */: - case 174 /* ArrowFunction */: - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - case 147 /* CallSignature */: - case 148 /* ConstructSignature */: { + case 220 /* FunctionDeclaration */: + case 179 /* FunctionExpression */: + case 180 /* ArrowFunction */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: + case 151 /* CallSignature */: + case 152 /* ConstructSignature */: { var start = node.getStart(sourceFile); if (node.parent.typeParameters && ts.rangeContainsStartEnd(node.parent.typeParameters, start, node.getEnd())) { @@ -43935,8 +49798,8 @@ var ts; } break; } - case 169 /* NewExpression */: - case 168 /* CallExpression */: { + case 175 /* NewExpression */: + case 174 /* CallExpression */: { var start = node.getStart(sourceFile); if (node.parent.typeArguments && ts.rangeContainsStartEnd(node.parent.typeArguments, start, node.getEnd())) { @@ -43966,8 +49829,8 @@ var ts; if (node.kind === 18 /* CloseParenToken */) { return -1 /* Unknown */; } - if (node.parent && (node.parent.kind === 168 /* CallExpression */ || - node.parent.kind === 169 /* NewExpression */) && + if (node.parent && (node.parent.kind === 174 /* CallExpression */ || + node.parent.kind === 175 /* NewExpression */) && node.parent.expression !== node) { var fullCallOrNewExpression = node.parent.expression; var startingExpression = getStartingExpression(fullCallOrNewExpression); @@ -43985,10 +49848,10 @@ var ts; function getStartingExpression(node) { while (true) { switch (node.kind) { - case 168 /* CallExpression */: - case 169 /* NewExpression */: - case 166 /* PropertyAccessExpression */: - case 167 /* ElementAccessExpression */: + case 174 /* CallExpression */: + case 175 /* NewExpression */: + case 172 /* PropertyAccessExpression */: + case 173 /* ElementAccessExpression */: node = node.expression; break; default: @@ -44052,80 +49915,85 @@ var ts; SmartIndenter.findFirstNonWhitespaceColumn = findFirstNonWhitespaceColumn; function nodeContentIsAlwaysIndented(kind) { switch (kind) { - case 195 /* ExpressionStatement */: - case 214 /* ClassDeclaration */: - case 186 /* ClassExpression */: - case 215 /* InterfaceDeclaration */: - case 217 /* EnumDeclaration */: - case 216 /* TypeAliasDeclaration */: - case 164 /* ArrayLiteralExpression */: - case 192 /* Block */: - case 219 /* ModuleBlock */: - case 165 /* ObjectLiteralExpression */: - case 155 /* TypeLiteral */: - case 157 /* TupleType */: - case 220 /* CaseBlock */: - case 242 /* DefaultClause */: - case 241 /* CaseClause */: - case 172 /* ParenthesizedExpression */: - case 166 /* PropertyAccessExpression */: - case 168 /* CallExpression */: - case 169 /* NewExpression */: - case 193 /* VariableStatement */: - case 211 /* VariableDeclaration */: - case 227 /* ExportAssignment */: - case 204 /* ReturnStatement */: - case 182 /* ConditionalExpression */: - case 162 /* ArrayBindingPattern */: - case 161 /* ObjectBindingPattern */: - case 233 /* JsxElement */: - case 234 /* JsxSelfClosingElement */: - case 142 /* MethodSignature */: - case 147 /* CallSignature */: - case 148 /* ConstructSignature */: - case 138 /* Parameter */: - case 152 /* FunctionType */: - case 153 /* ConstructorType */: - case 160 /* ParenthesizedType */: - case 170 /* TaggedTemplateExpression */: - case 178 /* AwaitExpression */: + case 202 /* ExpressionStatement */: + case 221 /* ClassDeclaration */: + case 192 /* ClassExpression */: + case 222 /* InterfaceDeclaration */: + case 224 /* EnumDeclaration */: + case 223 /* TypeAliasDeclaration */: + case 170 /* ArrayLiteralExpression */: + case 199 /* Block */: + case 226 /* ModuleBlock */: + case 171 /* ObjectLiteralExpression */: + case 159 /* TypeLiteral */: + case 161 /* TupleType */: + case 227 /* CaseBlock */: + case 250 /* DefaultClause */: + case 249 /* CaseClause */: + case 178 /* ParenthesizedExpression */: + case 172 /* PropertyAccessExpression */: + case 174 /* CallExpression */: + case 175 /* NewExpression */: + case 200 /* VariableStatement */: + case 218 /* VariableDeclaration */: + case 235 /* ExportAssignment */: + case 211 /* ReturnStatement */: + case 188 /* ConditionalExpression */: + case 168 /* ArrayBindingPattern */: + case 167 /* ObjectBindingPattern */: + case 243 /* JsxOpeningElement */: + case 242 /* JsxSelfClosingElement */: + case 248 /* JsxExpression */: + case 146 /* MethodSignature */: + case 151 /* CallSignature */: + case 152 /* ConstructSignature */: + case 142 /* Parameter */: + case 156 /* FunctionType */: + case 157 /* ConstructorType */: + case 164 /* ParenthesizedType */: + case 176 /* TaggedTemplateExpression */: + case 184 /* AwaitExpression */: + case 233 /* NamedImports */: return true; } return false; } + /* @internal */ + function nodeWillIndentChild(parent, child, indentByDefault) { + var childKind = child ? child.kind : 0 /* Unknown */; + switch (parent.kind) { + case 204 /* DoStatement */: + case 205 /* WhileStatement */: + case 207 /* ForInStatement */: + case 208 /* ForOfStatement */: + case 206 /* ForStatement */: + case 203 /* IfStatement */: + case 220 /* FunctionDeclaration */: + case 179 /* FunctionExpression */: + case 147 /* MethodDeclaration */: + case 180 /* ArrowFunction */: + case 148 /* Constructor */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: + return childKind !== 199 /* Block */; + case 241 /* JsxElement */: + return childKind !== 245 /* JsxClosingElement */; + } + // No explicit rule for given nodes so the result will follow the default value argument + return indentByDefault; + } + SmartIndenter.nodeWillIndentChild = nodeWillIndentChild; + /* + Function returns true when the parent node should indent the given child by an explicit rule + */ function shouldIndentChildNode(parent, child) { - if (nodeContentIsAlwaysIndented(parent)) { - return true; - } - switch (parent) { - case 197 /* DoStatement */: - case 198 /* WhileStatement */: - case 200 /* ForInStatement */: - case 201 /* ForOfStatement */: - case 199 /* ForStatement */: - case 196 /* IfStatement */: - case 213 /* FunctionDeclaration */: - case 173 /* FunctionExpression */: - case 143 /* MethodDeclaration */: - case 174 /* ArrowFunction */: - case 144 /* Constructor */: - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: - return child !== 192 /* Block */; - default: - return false; - } + return nodeContentIsAlwaysIndented(parent.kind) || nodeWillIndentChild(parent, child, false); } SmartIndenter.shouldIndentChildNode = shouldIndentChildNode; })(SmartIndenter = formatting.SmartIndenter || (formatting.SmartIndenter = {})); })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); /// -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; /// /// /// @@ -44133,12 +50001,13 @@ var __extends = (this && this.__extends) || function (d, b) { /// /// /// +/// /// /// var ts; (function (ts) { /** The version of the language service API */ - ts.servicesVersion = "0.4"; + ts.servicesVersion = "0.5"; var ScriptSnapshot; (function (ScriptSnapshot) { var StringScriptSnapshot = (function () { @@ -44157,7 +50026,7 @@ var ts; return undefined; }; return StringScriptSnapshot; - })(); + }()); function fromString(text) { return new StringScriptSnapshot(text); } @@ -44250,13 +50119,13 @@ var ts; while (pos < end) { var token = scanner.scan(); var textPos = scanner.getTextPos(); - nodes.push(createNode(token, pos, textPos, 2048 /* Synthetic */, this)); + nodes.push(createNode(token, pos, textPos, 0, this)); pos = textPos; } return pos; }; NodeObject.prototype.createSyntaxList = function (nodes) { - var list = createNode(271 /* SyntaxList */, nodes.pos, nodes.end, 2048 /* Synthetic */, this); + var list = createNode(279 /* SyntaxList */, nodes.pos, nodes.end, 0, this); list._children = []; var pos = nodes.pos; for (var _i = 0, nodes_7 = nodes; _i < nodes_7.length; _i++) { @@ -44275,27 +50144,27 @@ var ts; NodeObject.prototype.createChildren = function (sourceFile) { var _this = this; var children; - if (this.kind >= 135 /* FirstNode */) { + if (this.kind >= 139 /* FirstNode */) { scanner.setText((sourceFile || this.getSourceFile()).text); children = []; - var pos = this.pos; + var pos_3 = this.pos; var processNode = function (node) { - if (pos < node.pos) { - pos = _this.addSyntheticNodes(children, pos, node.pos); + if (pos_3 < node.pos) { + pos_3 = _this.addSyntheticNodes(children, pos_3, node.pos); } children.push(node); - pos = node.end; + pos_3 = node.end; }; var processNodes = function (nodes) { - if (pos < nodes.pos) { - pos = _this.addSyntheticNodes(children, pos, nodes.pos); + if (pos_3 < nodes.pos) { + pos_3 = _this.addSyntheticNodes(children, pos_3, nodes.pos); } children.push(_this.createSyntaxList(nodes)); - pos = nodes.end; + pos_3 = nodes.end; }; ts.forEachChild(this, processNode, processNodes); - if (pos < this.end) { - this.addSyntheticNodes(children, pos, this.end); + if (pos_3 < this.end) { + this.addSyntheticNodes(children, pos_3, this.end); } scanner.setText(undefined); } @@ -44322,7 +50191,7 @@ var ts; return undefined; } var child = children[0]; - return child.kind < 135 /* FirstNode */ ? child : child.getFirstToken(sourceFile); + return child.kind < 139 /* FirstNode */ ? child : child.getFirstToken(sourceFile); }; NodeObject.prototype.getLastToken = function (sourceFile) { var children = this.getChildren(sourceFile); @@ -44330,10 +50199,10 @@ var ts; if (!child) { return undefined; } - return child.kind < 135 /* FirstNode */ ? child : child.getLastToken(sourceFile); + return child.kind < 139 /* FirstNode */ ? child : child.getLastToken(sourceFile); }; return NodeObject; - })(); + }()); var SymbolObject = (function () { function SymbolObject(flags, name) { this.flags = flags; @@ -44355,7 +50224,7 @@ var ts; return this.documentationComment; }; return SymbolObject; - })(); + }()); function getJsDocCommentsFromDeclarations(declarations, name, canUseParsedParamTagComments) { var documentationComment = []; var docComments = getJsDocCommentsSeparatedByNewLines(); @@ -44373,31 +50242,31 @@ var ts; // Make sure we are collecting doc comment from declaration once, // In case of union property there might be same declaration multiple times // which only varies in type parameter - // Eg. let a: Array | Array; a.length + // Eg. const a: Array | Array; a.length // The property length will have two declarations of property length coming // from Array - Array and Array if (ts.indexOf(declarations, declaration) === indexOfDeclaration) { - var sourceFileOfDeclaration = ts.getSourceFileOfNode(declaration); + var sourceFileOfDeclaration_1 = ts.getSourceFileOfNode(declaration); // If it is parameter - try and get the jsDoc comment with @param tag from function declaration's jsDoc comments - if (canUseParsedParamTagComments && declaration.kind === 138 /* Parameter */) { - ts.forEach(getJsDocCommentTextRange(declaration.parent, sourceFileOfDeclaration), function (jsDocCommentTextRange) { - var cleanedParamJsDocComment = getCleanedParamJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration); + if (canUseParsedParamTagComments && declaration.kind === 142 /* Parameter */) { + ts.forEach(getJsDocCommentTextRange(declaration.parent, sourceFileOfDeclaration_1), function (jsDocCommentTextRange) { + var cleanedParamJsDocComment = getCleanedParamJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration_1); if (cleanedParamJsDocComment) { ts.addRange(jsDocCommentParts, cleanedParamJsDocComment); } }); } // If this is left side of dotted module declaration, there is no doc comments associated with this node - if (declaration.kind === 218 /* ModuleDeclaration */ && declaration.body.kind === 218 /* ModuleDeclaration */) { + if (declaration.kind === 225 /* ModuleDeclaration */ && declaration.body.kind === 225 /* ModuleDeclaration */) { return; } // If this is dotted module name, get the doc comments from the parent - while (declaration.kind === 218 /* ModuleDeclaration */ && declaration.parent.kind === 218 /* ModuleDeclaration */) { + while (declaration.kind === 225 /* ModuleDeclaration */ && declaration.parent.kind === 225 /* ModuleDeclaration */) { declaration = declaration.parent; } // Get the cleaned js doc comment text from the declaration - ts.forEach(getJsDocCommentTextRange(declaration.kind === 211 /* VariableDeclaration */ ? declaration.parent.parent : declaration, sourceFileOfDeclaration), function (jsDocCommentTextRange) { - var cleanedJsDocComment = getCleanedJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration); + ts.forEach(getJsDocCommentTextRange(declaration.kind === 218 /* VariableDeclaration */ ? declaration.parent.parent : declaration, sourceFileOfDeclaration_1), function (jsDocCommentTextRange) { + var cleanedJsDocComment = getCleanedJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration_1); if (cleanedJsDocComment) { ts.addRange(jsDocCommentParts, cleanedJsDocComment); } @@ -44444,7 +50313,8 @@ var ts; } function pushDocCommentLineText(docComments, text, blankLineCount) { // Add the empty lines in between texts - while (blankLineCount--) { + while (blankLineCount) { + blankLineCount--; docComments.push(ts.textPart("")); } docComments.push(ts.textPart(text)); @@ -44470,7 +50340,7 @@ var ts; else if (spacesToRemoveAfterAsterisk === undefined) { spacesToRemoveAfterAsterisk = 0; } - // Analyse text on this line + // Analyze text on this line while (pos < end && !ts.isLineBreak(sourceFile.text.charCodeAt(pos))) { var ch = sourceFile.text.charAt(pos); if (ch === "@") { @@ -44590,7 +50460,7 @@ var ts; } paramHelpStringMargin = undefined; } - // If this is the start of another tag, continue with the loop in seach of param tag with symbol name + // If this is the start of another tag, continue with the loop in search of param tag with symbol name if (sourceFile.text.charCodeAt(pos) === 64 /* at */) { continue; } @@ -44669,8 +50539,11 @@ var ts; ? this.checker.getBaseTypes(this) : undefined; }; + TypeObject.prototype.getNonNullableType = function () { + return this.checker.getNonNullableType(this); + }; return TypeObject; - })(); + }()); var SignatureObject = (function () { function SignatureObject(checker) { this.checker = checker; @@ -44696,7 +50569,7 @@ var ts; return this.documentationComment; }; return SignatureObject; - })(); + }()); var SourceFileObject = (function (_super) { __extends(SourceFileObject, _super); function SourceFileObject(kind, pos, end) { @@ -44740,9 +50613,9 @@ var ts; if (result_2 !== undefined) { return result_2; } - if (declaration.name.kind === 136 /* ComputedPropertyName */) { + if (declaration.name.kind === 140 /* ComputedPropertyName */) { var expr = declaration.name.expression; - if (expr.kind === 166 /* PropertyAccessExpression */) { + if (expr.kind === 172 /* PropertyAccessExpression */) { return expr.name.text; } return getTextOfIdentifierOrLiteral(expr); @@ -44762,9 +50635,10 @@ var ts; } function visit(node) { switch (node.kind) { - case 213 /* FunctionDeclaration */: - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: + case 220 /* FunctionDeclaration */: + case 179 /* FunctionExpression */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: var functionDeclaration = node; var declarationName = getDeclarationName(functionDeclaration); if (declarationName) { @@ -44784,60 +50658,53 @@ var ts; ts.forEachChild(node, visit); } break; - case 214 /* ClassDeclaration */: - case 215 /* InterfaceDeclaration */: - case 216 /* TypeAliasDeclaration */: - case 217 /* EnumDeclaration */: - case 218 /* ModuleDeclaration */: - case 221 /* ImportEqualsDeclaration */: - case 230 /* ExportSpecifier */: - case 226 /* ImportSpecifier */: - case 221 /* ImportEqualsDeclaration */: - case 223 /* ImportClause */: - case 224 /* NamespaceImport */: - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: - case 155 /* TypeLiteral */: + case 221 /* ClassDeclaration */: + case 192 /* ClassExpression */: + case 222 /* InterfaceDeclaration */: + case 223 /* TypeAliasDeclaration */: + case 224 /* EnumDeclaration */: + case 225 /* ModuleDeclaration */: + case 229 /* ImportEqualsDeclaration */: + case 238 /* ExportSpecifier */: + case 234 /* ImportSpecifier */: + case 229 /* ImportEqualsDeclaration */: + case 231 /* ImportClause */: + case 232 /* NamespaceImport */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: + case 159 /* TypeLiteral */: addDeclaration(node); - // fall through - case 144 /* Constructor */: - case 193 /* VariableStatement */: - case 212 /* VariableDeclarationList */: - case 161 /* ObjectBindingPattern */: - case 162 /* ArrayBindingPattern */: - case 219 /* ModuleBlock */: ts.forEachChild(node, visit); break; - case 192 /* Block */: - if (ts.isFunctionBlock(node)) { - ts.forEachChild(node, visit); - } - break; - case 138 /* Parameter */: - // Only consider properties defined as constructor parameters - if (!(node.flags & 56 /* AccessibilityModifier */)) { + case 142 /* Parameter */: + // Only consider parameter properties + if (!(node.flags & 92 /* ParameterPropertyModifier */)) { break; } // fall through - case 211 /* VariableDeclaration */: - case 163 /* BindingElement */: - if (ts.isBindingPattern(node.name)) { - ts.forEachChild(node.name, visit); + case 218 /* VariableDeclaration */: + case 169 /* BindingElement */: { + var decl = node; + if (ts.isBindingPattern(decl.name)) { + ts.forEachChild(decl.name, visit); break; } - case 247 /* EnumMember */: - case 141 /* PropertyDeclaration */: - case 140 /* PropertySignature */: + if (decl.initializer) + visit(decl.initializer); + } + case 255 /* EnumMember */: + case 145 /* PropertyDeclaration */: + case 144 /* PropertySignature */: addDeclaration(node); break; - case 228 /* ExportDeclaration */: + case 236 /* ExportDeclaration */: // Handle named exports case e.g.: // export {a, b as B} from "mod"; if (node.exportClause) { ts.forEach(node.exportClause.elements, visit); } break; - case 222 /* ImportDeclaration */: + case 230 /* ImportDeclaration */: var importClause = node.importClause; if (importClause) { // Handle default import case e.g.: @@ -44849,7 +50716,7 @@ var ts; // import * as NS from "mod"; // import {a, b as B} from "mod"; if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 224 /* NamespaceImport */) { + if (importClause.namedBindings.kind === 232 /* NamespaceImport */) { addDeclaration(importClause.namedBindings); } else { @@ -44858,16 +50725,18 @@ var ts; } } break; + default: + ts.forEachChild(node, visit); } } }; return SourceFileObject; - })(NodeObject); + }(NodeObject)); var TextChange = (function () { function TextChange() { } return TextChange; - })(); + }()); ts.TextChange = TextChange; var HighlightSpanKind; (function (HighlightSpanKind) { @@ -44957,7 +50826,7 @@ var ts; // enum E ScriptElementKind.enumElement = "enum"; // Inside module and script only - // let v = .. + // const v = .. ScriptElementKind.variableElement = "var"; // Inside function ScriptElementKind.localVariableElement = "local var"; @@ -45025,8 +50894,11 @@ var ts; ClassificationTypeNames.jsxOpenTagName = "jsx open tag name"; ClassificationTypeNames.jsxCloseTagName = "jsx close tag name"; ClassificationTypeNames.jsxSelfClosingTagName = "jsx self closing tag name"; + ClassificationTypeNames.jsxAttribute = "jsx attribute"; + ClassificationTypeNames.jsxText = "jsx text"; + ClassificationTypeNames.jsxAttributeStringLiteralValue = "jsx attribute string literal value"; return ClassificationTypeNames; - })(); + }()); ts.ClassificationTypeNames = ClassificationTypeNames; (function (ClassificationType) { ClassificationType[ClassificationType["comment"] = 1] = "comment"; @@ -45050,6 +50922,9 @@ var ts; ClassificationType[ClassificationType["jsxOpenTagName"] = 19] = "jsxOpenTagName"; ClassificationType[ClassificationType["jsxCloseTagName"] = 20] = "jsxCloseTagName"; ClassificationType[ClassificationType["jsxSelfClosingTagName"] = 21] = "jsxSelfClosingTagName"; + ClassificationType[ClassificationType["jsxAttribute"] = 22] = "jsxAttribute"; + ClassificationType[ClassificationType["jsxText"] = 23] = "jsxText"; + ClassificationType[ClassificationType["jsxAttributeStringLiteralValue"] = 24] = "jsxAttributeStringLiteralValue"; })(ts.ClassificationType || (ts.ClassificationType = {})); var ClassificationType = ts.ClassificationType; function displayPartsToString(displayParts) { @@ -45065,16 +50940,16 @@ var ts; } return ts.forEach(symbol.declarations, function (declaration) { // Function expressions are local - if (declaration.kind === 173 /* FunctionExpression */) { + if (declaration.kind === 179 /* FunctionExpression */) { return true; } - if (declaration.kind !== 211 /* VariableDeclaration */ && declaration.kind !== 213 /* FunctionDeclaration */) { + if (declaration.kind !== 218 /* VariableDeclaration */ && declaration.kind !== 220 /* FunctionDeclaration */) { return false; } // If the parent is not sourceFile or module block it is local variable - for (var parent_8 = declaration.parent; !ts.isFunctionBlock(parent_8); parent_8 = parent_8.parent) { + for (var parent_15 = declaration.parent; !ts.isFunctionBlock(parent_15); parent_15 = parent_15.parent) { // Reached source file or module block - if (parent_8.kind === 248 /* SourceFile */ || parent_8.kind === 219 /* ModuleBlock */) { + if (parent_15.kind === 256 /* SourceFile */ || parent_15.kind === 226 /* ModuleBlock */) { return false; } } @@ -45086,7 +50961,6 @@ var ts; // Always default to "ScriptTarget.ES5" for the language service return { target: 1 /* ES5 */, - module: 0 /* None */, jsx: 1 /* Preserve */ }; } @@ -45120,7 +50994,8 @@ var ts; entry = { hostFileName: fileName, version: this.host.getScriptVersion(fileName), - scriptSnapshot: scriptSnapshot + scriptSnapshot: scriptSnapshot, + scriptKind: ts.getScriptKind(fileName, this.host) }; } this.fileNameToEntry.set(path, entry); @@ -45134,10 +51009,12 @@ var ts; }; HostCache.prototype.getOrCreateEntry = function (fileName) { var path = ts.toPath(fileName, this.currentDirectory, this.getCanonicalFileName); - if (this.contains(path)) { - return this.getEntry(path); - } - return this.createEntry(fileName, path); + return this.getOrCreateEntryByPath(fileName, path); + }; + HostCache.prototype.getOrCreateEntryByPath = function (fileName, path) { + return this.contains(path) + ? this.getEntry(path) + : this.createEntry(fileName, path); }; HostCache.prototype.getRootFileNames = function () { var fileNames = []; @@ -45157,7 +51034,7 @@ var ts; return file && file.scriptSnapshot; }; return HostCache; - })(); + }()); var SyntaxTreeCache = (function () { function SyntaxTreeCache(host) { this.host = host; @@ -45168,11 +51045,12 @@ var ts; // The host does not know about this file. throw new Error("Could not find file: '" + fileName + "'."); } + var scriptKind = ts.getScriptKind(fileName, this.host); var version = this.host.getScriptVersion(fileName); var sourceFile; if (this.currentFileName !== fileName) { // This is a new file, just parse it - sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, 2 /* Latest */, version, /*setNodeParents:*/ true); + sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, 2 /* Latest */, version, /*setNodeParents*/ true, scriptKind); } else if (this.currentFileVersion !== version) { // This is the same file, just a newer version. Incrementally parse the file. @@ -45189,7 +51067,7 @@ var ts; return this.currentSourceFile; }; return SyntaxTreeCache; - })(); + }()); function setSourceFileFields(sourceFile, scriptSnapshot, version) { sourceFile.version = version; sourceFile.scriptSnapshot = scriptSnapshot; @@ -45206,6 +51084,8 @@ var ts; function transpileModule(input, transpileOptions) { var options = transpileOptions.compilerOptions ? ts.clone(transpileOptions.compilerOptions) : getDefaultCompilerOptions(); options.isolatedModules = true; + // transpileModule does not write anything to disk so there is no need to verify that there are no conflicts between input and output paths. + options.suppressOutputPathCheck = true; // Filename can be non-ts file. options.allowNonTsExtensions = true; // We are not returning a sourceFile for lib file when asked by the program, @@ -45227,14 +51107,14 @@ var ts; var sourceMapText; // Create a compilerHost object to allow the compiler to read and write files var compilerHost = { - getSourceFile: function (fileName, target) { return fileName === ts.normalizeSlashes(inputFileName) ? sourceFile : undefined; }, + getSourceFile: function (fileName, target) { return fileName === ts.normalizePath(inputFileName) ? sourceFile : undefined; }, writeFile: function (name, text, writeByteOrderMark) { if (ts.fileExtensionIs(name, ".map")) { ts.Debug.assert(sourceMapText === undefined, "Unexpected multiple source map outputs for the file '" + name + "'"); sourceMapText = text; } else { - ts.Debug.assert(outputText === undefined, "Unexpected multiple outputs for the file: " + name); + ts.Debug.assert(outputText === undefined, "Unexpected multiple outputs for the file: '" + name + "'"); outputText = text; } }, @@ -45244,7 +51124,8 @@ var ts; getCurrentDirectory: function () { return ""; }, getNewLine: function () { return newLine; }, fileExists: function (fileName) { return fileName === inputFileName; }, - readFile: function (fileName) { return ""; } + readFile: function (fileName) { return ""; }, + directoryExists: function (directoryExists) { return true; } }; var program = ts.createProgram([inputFileName], options, compilerHost); var diagnostics; @@ -45269,12 +51150,10 @@ var ts; return output.outputText; } ts.transpile = transpile; - function createLanguageServiceSourceFile(fileName, scriptSnapshot, scriptTarget, version, setNodeParents) { + function createLanguageServiceSourceFile(fileName, scriptSnapshot, scriptTarget, version, setNodeParents, scriptKind) { var text = scriptSnapshot.getText(0, scriptSnapshot.getLength()); - var sourceFile = ts.createSourceFile(fileName, text, scriptTarget, setNodeParents); + var sourceFile = ts.createSourceFile(fileName, text, scriptTarget, setNodeParents, scriptKind); setSourceFileFields(sourceFile, scriptSnapshot, version); - // after full parsing we can use table with interned strings as name table - sourceFile.nameTable = sourceFile.identifiers; return sourceFile; } ts.createLanguageServiceSourceFile = createLanguageServiceSourceFile; @@ -45286,7 +51165,7 @@ var ts; if (version !== sourceFile.version) { // Once incremental parsing is ready, then just call into this function. if (!ts.disableIncrementalParsing) { - var newText; + var newText = void 0; // grab the fragment from the beginning of the original text to the beginning of the span var prefix = textChangeRange.span.start !== 0 ? sourceFile.text.substr(0, textChangeRange.span.start) @@ -45326,26 +51205,19 @@ var ts; } } // Otherwise, just create a new source file. - return createLanguageServiceSourceFile(sourceFile.fileName, scriptSnapshot, sourceFile.languageVersion, version, /*setNodeParents:*/ true); + return createLanguageServiceSourceFile(sourceFile.fileName, scriptSnapshot, sourceFile.languageVersion, version, /*setNodeParents*/ true, sourceFile.scriptKind); } ts.updateLanguageServiceSourceFile = updateLanguageServiceSourceFile; - function createGetCanonicalFileName(useCaseSensitivefileNames) { - return useCaseSensitivefileNames - ? (function (fileName) { return fileName; }) - : (function (fileName) { return fileName.toLowerCase(); }); - } - ts.createGetCanonicalFileName = createGetCanonicalFileName; function createDocumentRegistry(useCaseSensitiveFileNames, currentDirectory) { if (currentDirectory === void 0) { currentDirectory = ""; } // Maps from compiler setting target (ES3, ES5, etc.) to all the cached documents we have // for those settings. var buckets = {}; - var getCanonicalFileName = createGetCanonicalFileName(!!useCaseSensitiveFileNames); - function getKeyFromCompilationSettings(settings) { - return "_" + settings.target + "|" + settings.module + "|" + settings.noResolve + "|" + settings.jsx; + var getCanonicalFileName = ts.createGetCanonicalFileName(!!useCaseSensitiveFileNames); + function getKeyForCompilationSettings(settings) { + return ("_" + settings.target + "|" + settings.module + "|" + settings.noResolve + "|" + settings.jsx + "|" + settings.allowJs + "|" + settings.baseUrl + "|" + settings.typesRoot + "|" + settings.typesSearchPaths + "|" + JSON.stringify(settings.rootDirs) + "|" + JSON.stringify(settings.paths)); } - function getBucketForCompilationSettings(settings, createIfMissing) { - var key = getKeyFromCompilationSettings(settings); + function getBucketForCompilationSettings(key, createIfMissing) { var bucket = ts.lookUp(buckets, key); if (!bucket && createIfMissing) { buckets[key] = bucket = ts.createFileMap(); @@ -45353,7 +51225,7 @@ var ts; return bucket; } function reportStats() { - var bucketInfoArray = Object.keys(buckets).filter(function (name) { return name && name.charAt(0) === '_'; }).map(function (name) { + var bucketInfoArray = Object.keys(buckets).filter(function (name) { return name && name.charAt(0) === "_"; }).map(function (name) { var entries = ts.lookUp(buckets, name); var sourceFiles = []; entries.forEachValue(function (key, entry) { @@ -45369,22 +51241,31 @@ var ts; sourceFiles: sourceFiles }; }); - return JSON.stringify(bucketInfoArray, null, 2); + return JSON.stringify(bucketInfoArray, undefined, 2); } - function acquireDocument(fileName, compilationSettings, scriptSnapshot, version) { - return acquireOrUpdateDocument(fileName, compilationSettings, scriptSnapshot, version, /*acquiring:*/ true); - } - function updateDocument(fileName, compilationSettings, scriptSnapshot, version) { - return acquireOrUpdateDocument(fileName, compilationSettings, scriptSnapshot, version, /*acquiring:*/ false); - } - function acquireOrUpdateDocument(fileName, compilationSettings, scriptSnapshot, version, acquiring) { - var bucket = getBucketForCompilationSettings(compilationSettings, /*createIfMissing*/ true); + function acquireDocument(fileName, compilationSettings, scriptSnapshot, version, scriptKind) { var path = ts.toPath(fileName, currentDirectory, getCanonicalFileName); + var key = getKeyForCompilationSettings(compilationSettings); + return acquireDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind); + } + function acquireDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind) { + return acquireOrUpdateDocument(fileName, path, compilationSettings, key, scriptSnapshot, version, /*acquiring*/ true, scriptKind); + } + function updateDocument(fileName, compilationSettings, scriptSnapshot, version, scriptKind) { + var path = ts.toPath(fileName, currentDirectory, getCanonicalFileName); + var key = getKeyForCompilationSettings(compilationSettings); + return updateDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind); + } + function updateDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind) { + return acquireOrUpdateDocument(fileName, path, compilationSettings, key, scriptSnapshot, version, /*acquiring*/ false, scriptKind); + } + function acquireOrUpdateDocument(fileName, path, compilationSettings, key, scriptSnapshot, version, acquiring, scriptKind) { + var bucket = getBucketForCompilationSettings(key, /*createIfMissing*/ true); var entry = bucket.get(path); if (!entry) { ts.Debug.assert(acquiring, "How could we be trying to update a document that the registry doesn't have?"); // Have never seen this file with these settings. Create a new source file for it. - var sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, compilationSettings.target, version, /*setNodeParents:*/ false); + var sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, compilationSettings.target, version, /*setNodeParents*/ false, scriptKind); entry = { sourceFile: sourceFile, languageServiceRefCount: 0, @@ -45411,9 +51292,13 @@ var ts; return entry.sourceFile; } function releaseDocument(fileName, compilationSettings) { - var bucket = getBucketForCompilationSettings(compilationSettings, false); - ts.Debug.assert(bucket !== undefined); var path = ts.toPath(fileName, currentDirectory, getCanonicalFileName); + var key = getKeyForCompilationSettings(compilationSettings); + return releaseDocumentWithKey(path, key); + } + function releaseDocumentWithKey(path, key) { + var bucket = getBucketForCompilationSettings(key, /*createIfMissing*/ false); + ts.Debug.assert(bucket !== undefined); var entry = bucket.get(path); entry.languageServiceRefCount--; ts.Debug.assert(entry.languageServiceRefCount >= 0); @@ -45423,9 +51308,13 @@ var ts; } return { acquireDocument: acquireDocument, + acquireDocumentWithKey: acquireDocumentWithKey, updateDocument: updateDocument, + updateDocumentWithKey: updateDocumentWithKey, releaseDocument: releaseDocument, - reportStats: reportStats + releaseDocumentWithKey: releaseDocumentWithKey, + reportStats: reportStats, + getKeyForCompilationSettings: getKeyForCompilationSettings }; } ts.createDocumentRegistry = createDocumentRegistry; @@ -45433,9 +51322,24 @@ var ts; if (readImportFiles === void 0) { readImportFiles = true; } if (detectJavaScriptImports === void 0) { detectJavaScriptImports = false; } var referencedFiles = []; + var typeReferenceDirectives = []; var importedFiles = []; var ambientExternalModules; var isNoDefaultLib = false; + var braceNesting = 0; + // assume that text represent an external module if it contains at least one top level import/export + // ambient modules that are found inside external modules are interpreted as module augmentations + var externalModule = false; + function nextToken() { + var token = scanner.scan(); + if (token === 15 /* OpenBraceToken */) { + braceNesting++; + } + else if (token === 16 /* CloseBraceToken */) { + braceNesting--; + } + return token; + } function processTripleSlashDirectives() { var commentRanges = ts.getLeadingCommentRanges(sourceText, 0); ts.forEach(commentRanges, function (commentRange) { @@ -45445,25 +51349,37 @@ var ts; isNoDefaultLib = referencePathMatchResult.isNoDefaultLib; var fileReference = referencePathMatchResult.fileReference; if (fileReference) { - referencedFiles.push(fileReference); + var collection = referencePathMatchResult.isTypeReferenceDirective + ? typeReferenceDirectives + : referencedFiles; + collection.push(fileReference); } } }); } + function getFileReference() { + var file = scanner.getTokenValue(); + var pos = scanner.getTokenPos(); + return { + fileName: file, + pos: pos, + end: pos + file.length + }; + } function recordAmbientExternalModule() { if (!ambientExternalModules) { ambientExternalModules = []; } - ambientExternalModules.push(scanner.getTokenValue()); + ambientExternalModules.push({ ref: getFileReference(), depth: braceNesting }); } function recordModuleName() { - var importPath = scanner.getTokenValue(); - var pos = scanner.getTokenPos(); - importedFiles.push({ - fileName: importPath, - pos: pos, - end: pos + importPath.length - }); + importedFiles.push(getFileReference()); + markAsExternalModuleIfTopLevel(); + } + function markAsExternalModuleIfTopLevel() { + if (braceNesting === 0) { + externalModule = true; + } } /** * Returns true if at least one token was consumed from the stream @@ -45472,9 +51388,9 @@ var ts; var token = scanner.getToken(); if (token === 122 /* DeclareKeyword */) { // declare module "mod" - token = scanner.scan(); + token = nextToken(); if (token === 125 /* ModuleKeyword */) { - token = scanner.scan(); + token = nextToken(); if (token === 9 /* StringLiteral */) { recordAmbientExternalModule(); } @@ -45489,7 +51405,7 @@ var ts; function tryConsumeImport() { var token = scanner.getToken(); if (token === 89 /* ImportKeyword */) { - token = scanner.scan(); + token = nextToken(); if (token === 9 /* StringLiteral */) { // import "mod"; recordModuleName(); @@ -45497,9 +51413,9 @@ var ts; } else { if (token === 69 /* Identifier */ || ts.isKeyword(token)) { - token = scanner.scan(); - if (token === 133 /* FromKeyword */) { - token = scanner.scan(); + token = nextToken(); + if (token === 136 /* FromKeyword */) { + token = nextToken(); if (token === 9 /* StringLiteral */) { // import d from "mod"; recordModuleName(); @@ -45507,13 +51423,13 @@ var ts; } } else if (token === 56 /* EqualsToken */) { - if (tryConsumeRequireCall(/* skipCurrentToken */ true)) { + if (tryConsumeRequireCall(/*skipCurrentToken*/ true)) { return true; } } else if (token === 24 /* CommaToken */) { // consume comma and keep going - token = scanner.scan(); + token = nextToken(); } else { // unknown syntax @@ -45521,16 +51437,16 @@ var ts; } } if (token === 15 /* OpenBraceToken */) { - token = scanner.scan(); + token = nextToken(); // consume "{ a as B, c, d as D}" clauses // make sure that it stops on EOF while (token !== 16 /* CloseBraceToken */ && token !== 1 /* EndOfFileToken */) { - token = scanner.scan(); + token = nextToken(); } if (token === 16 /* CloseBraceToken */) { - token = scanner.scan(); - if (token === 133 /* FromKeyword */) { - token = scanner.scan(); + token = nextToken(); + if (token === 136 /* FromKeyword */) { + token = nextToken(); if (token === 9 /* StringLiteral */) { // import {a as A} from "mod"; // import d, {a, b as B} from "mod" @@ -45540,13 +51456,13 @@ var ts; } } else if (token === 37 /* AsteriskToken */) { - token = scanner.scan(); + token = nextToken(); if (token === 116 /* AsKeyword */) { - token = scanner.scan(); + token = nextToken(); if (token === 69 /* Identifier */ || ts.isKeyword(token)) { - token = scanner.scan(); - if (token === 133 /* FromKeyword */) { - token = scanner.scan(); + token = nextToken(); + if (token === 136 /* FromKeyword */) { + token = nextToken(); if (token === 9 /* StringLiteral */) { // import * as NS from "mod" // import d, * as NS from "mod" @@ -45564,18 +51480,19 @@ var ts; function tryConsumeExport() { var token = scanner.getToken(); if (token === 82 /* ExportKeyword */) { - token = scanner.scan(); + markAsExternalModuleIfTopLevel(); + token = nextToken(); if (token === 15 /* OpenBraceToken */) { - token = scanner.scan(); + token = nextToken(); // consume "{ a as B, c, d as D}" clauses // make sure it stops on EOF while (token !== 16 /* CloseBraceToken */ && token !== 1 /* EndOfFileToken */) { - token = scanner.scan(); + token = nextToken(); } if (token === 16 /* CloseBraceToken */) { - token = scanner.scan(); - if (token === 133 /* FromKeyword */) { - token = scanner.scan(); + token = nextToken(); + if (token === 136 /* FromKeyword */) { + token = nextToken(); if (token === 9 /* StringLiteral */) { // export {a as A} from "mod"; // export {a, b as B} from "mod" @@ -45585,9 +51502,9 @@ var ts; } } else if (token === 37 /* AsteriskToken */) { - token = scanner.scan(); - if (token === 133 /* FromKeyword */) { - token = scanner.scan(); + token = nextToken(); + if (token === 136 /* FromKeyword */) { + token = nextToken(); if (token === 9 /* StringLiteral */) { // export * from "mod" recordModuleName(); @@ -45595,11 +51512,11 @@ var ts; } } else if (token === 89 /* ImportKeyword */) { - token = scanner.scan(); + token = nextToken(); if (token === 69 /* Identifier */ || ts.isKeyword(token)) { - token = scanner.scan(); + token = nextToken(); if (token === 56 /* EqualsToken */) { - if (tryConsumeRequireCall(/* skipCurrentToken */ true)) { + if (tryConsumeRequireCall(/*skipCurrentToken*/ true)) { return true; } } @@ -45610,11 +51527,11 @@ var ts; return false; } function tryConsumeRequireCall(skipCurrentToken) { - var token = skipCurrentToken ? scanner.scan() : scanner.getToken(); - if (token === 127 /* RequireKeyword */) { - token = scanner.scan(); + var token = skipCurrentToken ? nextToken() : scanner.getToken(); + if (token === 129 /* RequireKeyword */) { + token = nextToken(); if (token === 17 /* OpenParenToken */) { - token = scanner.scan(); + token = nextToken(); if (token === 9 /* StringLiteral */) { // require("mod"); recordModuleName(); @@ -45627,16 +51544,16 @@ var ts; function tryConsumeDefine() { var token = scanner.getToken(); if (token === 69 /* Identifier */ && scanner.getTokenValue() === "define") { - token = scanner.scan(); + token = nextToken(); if (token !== 17 /* OpenParenToken */) { return true; } - token = scanner.scan(); + token = nextToken(); if (token === 9 /* StringLiteral */) { // looks like define ("modname", ... - skip string literal and comma - token = scanner.scan(); + token = nextToken(); if (token === 24 /* CommaToken */) { - token = scanner.scan(); + token = nextToken(); } else { // unexpected token @@ -45648,7 +51565,7 @@ var ts; return true; } // skip open bracket - token = scanner.scan(); + token = nextToken(); var i = 0; // scan until ']' or EOF while (token !== 20 /* CloseBracketToken */ && token !== 1 /* EndOfFileToken */) { @@ -45657,7 +51574,7 @@ var ts; recordModuleName(); i++; } - token = scanner.scan(); + token = nextToken(); } return true; } @@ -45665,7 +51582,7 @@ var ts; } function processImports() { scanner.setText(sourceText); - scanner.scan(); + nextToken(); // Look for: // import "mod"; // import d from "mod" @@ -45686,11 +51603,11 @@ var ts; if (tryConsumeDeclare() || tryConsumeImport() || tryConsumeExport() || - (detectJavaScriptImports && (tryConsumeRequireCall(/* skipCurrentToken */ false) || tryConsumeDefine()))) { + (detectJavaScriptImports && (tryConsumeRequireCall(/*skipCurrentToken*/ false) || tryConsumeDefine()))) { continue; } else { - scanner.scan(); + nextToken(); } } scanner.setText(undefined); @@ -45699,13 +51616,42 @@ var ts; processImports(); } processTripleSlashDirectives(); - return { referencedFiles: referencedFiles, importedFiles: importedFiles, isLibFile: isNoDefaultLib, ambientExternalModules: ambientExternalModules }; + if (externalModule) { + // for external modules module all nested ambient modules are augmentations + if (ambientExternalModules) { + // move all detected ambient modules to imported files since they need to be resolved + for (var _i = 0, ambientExternalModules_1 = ambientExternalModules; _i < ambientExternalModules_1.length; _i++) { + var decl = ambientExternalModules_1[_i]; + importedFiles.push(decl.ref); + } + } + return { referencedFiles: referencedFiles, typeReferenceDirectives: typeReferenceDirectives, importedFiles: importedFiles, isLibFile: isNoDefaultLib, ambientExternalModules: undefined }; + } + else { + // for global scripts ambient modules still can have augmentations - look for ambient modules with depth > 0 + var ambientModuleNames = void 0; + if (ambientExternalModules) { + for (var _a = 0, ambientExternalModules_2 = ambientExternalModules; _a < ambientExternalModules_2.length; _a++) { + var decl = ambientExternalModules_2[_a]; + if (decl.depth === 0) { + if (!ambientModuleNames) { + ambientModuleNames = []; + } + ambientModuleNames.push(decl.ref.fileName); + } + else { + importedFiles.push(decl.ref); + } + } + } + return { referencedFiles: referencedFiles, typeReferenceDirectives: typeReferenceDirectives, importedFiles: importedFiles, isLibFile: isNoDefaultLib, ambientExternalModules: ambientModuleNames }; + } } ts.preProcessFile = preProcessFile; /// Helpers function getTargetLabel(referenceNode, labelName) { while (referenceNode) { - if (referenceNode.kind === 207 /* LabeledStatement */ && referenceNode.label.text === labelName) { + if (referenceNode.kind === 214 /* LabeledStatement */ && referenceNode.label.text === labelName) { return referenceNode.label; } referenceNode = referenceNode.parent; @@ -45714,12 +51660,12 @@ var ts; } function isJumpStatementTarget(node) { return node.kind === 69 /* Identifier */ && - (node.parent.kind === 203 /* BreakStatement */ || node.parent.kind === 202 /* ContinueStatement */) && + (node.parent.kind === 210 /* BreakStatement */ || node.parent.kind === 209 /* ContinueStatement */) && node.parent.label === node; } function isLabelOfLabeledStatement(node) { return node.kind === 69 /* Identifier */ && - node.parent.kind === 207 /* LabeledStatement */ && + node.parent.kind === 214 /* LabeledStatement */ && node.parent.label === node; } /** @@ -45727,7 +51673,7 @@ var ts; * Note: 'node' cannot be a SourceFile. */ function isLabeledBy(node, labelName) { - for (var owner = node.parent; owner.kind === 207 /* LabeledStatement */; owner = owner.parent) { + for (var owner = node.parent; owner.kind === 214 /* LabeledStatement */; owner = owner.parent) { if (owner.label.text === labelName) { return true; } @@ -45738,50 +51684,74 @@ var ts; return isLabelOfLabeledStatement(node) || isJumpStatementTarget(node); } function isRightSideOfQualifiedName(node) { - return node.parent.kind === 135 /* QualifiedName */ && node.parent.right === node; + return node.parent.kind === 139 /* QualifiedName */ && node.parent.right === node; } function isRightSideOfPropertyAccess(node) { - return node && node.parent && node.parent.kind === 166 /* PropertyAccessExpression */ && node.parent.name === node; + return node && node.parent && node.parent.kind === 172 /* PropertyAccessExpression */ && node.parent.name === node; } function isCallExpressionTarget(node) { if (isRightSideOfPropertyAccess(node)) { node = node.parent; } - return node && node.parent && node.parent.kind === 168 /* CallExpression */ && node.parent.expression === node; + return node && node.parent && node.parent.kind === 174 /* CallExpression */ && node.parent.expression === node; } function isNewExpressionTarget(node) { if (isRightSideOfPropertyAccess(node)) { node = node.parent; } - return node && node.parent && node.parent.kind === 169 /* NewExpression */ && node.parent.expression === node; + return node && node.parent && node.parent.kind === 175 /* NewExpression */ && node.parent.expression === node; } function isNameOfModuleDeclaration(node) { - return node.parent.kind === 218 /* ModuleDeclaration */ && node.parent.name === node; + return node.parent.kind === 225 /* ModuleDeclaration */ && node.parent.name === node; } function isNameOfFunctionDeclaration(node) { return node.kind === 69 /* Identifier */ && ts.isFunctionLike(node.parent) && node.parent.name === node; } - /** Returns true if node is a name of an object literal property, e.g. "a" in x = { "a": 1 } */ - function isNameOfPropertyAssignment(node) { - return (node.kind === 69 /* Identifier */ || node.kind === 9 /* StringLiteral */ || node.kind === 8 /* NumericLiteral */) && - (node.parent.kind === 245 /* PropertyAssignment */ || node.parent.kind === 246 /* ShorthandPropertyAssignment */) && node.parent.name === node; + function isObjectLiteralPropertyDeclaration(node) { + switch (node.kind) { + case 253 /* PropertyAssignment */: + case 254 /* ShorthandPropertyAssignment */: + case 147 /* MethodDeclaration */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: + return true; + } + return false; + } + /** + * Returns the containing object literal property declaration given a possible name node, e.g. "a" in x = { "a": 1 } + */ + function getContainingObjectLiteralElement(node) { + switch (node.kind) { + case 9 /* StringLiteral */: + case 8 /* NumericLiteral */: + if (node.parent.kind === 140 /* ComputedPropertyName */) { + return isObjectLiteralPropertyDeclaration(node.parent.parent) ? node.parent.parent : undefined; + } + // intential fall through + case 69 /* Identifier */: + return isObjectLiteralPropertyDeclaration(node.parent) && node.parent.name === node ? node.parent : undefined; + } + return undefined; } function isLiteralNameOfPropertyDeclarationOrIndexAccess(node) { if (node.kind === 9 /* StringLiteral */ || node.kind === 8 /* NumericLiteral */) { switch (node.parent.kind) { - case 141 /* PropertyDeclaration */: - case 140 /* PropertySignature */: - case 245 /* PropertyAssignment */: - case 247 /* EnumMember */: - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: - case 218 /* ModuleDeclaration */: + case 145 /* PropertyDeclaration */: + case 144 /* PropertySignature */: + case 253 /* PropertyAssignment */: + case 255 /* EnumMember */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: + case 225 /* ModuleDeclaration */: return node.parent.name === node; - case 167 /* ElementAccessExpression */: + case 173 /* ElementAccessExpression */: return node.parent.argumentExpression === node; + case 140 /* ComputedPropertyName */: + return true; } } return false; @@ -45839,7 +51809,7 @@ var ts; })(BreakContinueSearchType || (BreakContinueSearchType = {})); // A cache of completion entries for keywords, these do not change between sessions var keywordCompletions = []; - for (var i = 70 /* FirstKeyword */; i <= 134 /* LastKeyword */; i++) { + for (var i = 70 /* FirstKeyword */; i <= 138 /* LastKeyword */; i++) { keywordCompletions.push({ name: ts.tokenToString(i), kind: ScriptElementKind.keyword, @@ -45854,17 +51824,17 @@ var ts; return undefined; } switch (node.kind) { - case 248 /* SourceFile */: - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - case 213 /* FunctionDeclaration */: - case 173 /* FunctionExpression */: - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: - case 214 /* ClassDeclaration */: - case 215 /* InterfaceDeclaration */: - case 217 /* EnumDeclaration */: - case 218 /* ModuleDeclaration */: + case 256 /* SourceFile */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: + case 220 /* FunctionDeclaration */: + case 179 /* FunctionExpression */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: + case 221 /* ClassDeclaration */: + case 222 /* InterfaceDeclaration */: + case 224 /* EnumDeclaration */: + case 225 /* ModuleDeclaration */: return node; } } @@ -45872,38 +51842,42 @@ var ts; ts.getContainerNode = getContainerNode; /* @internal */ function getNodeKind(node) { switch (node.kind) { - case 218 /* ModuleDeclaration */: return ScriptElementKind.moduleElement; - case 214 /* ClassDeclaration */: return ScriptElementKind.classElement; - case 215 /* InterfaceDeclaration */: return ScriptElementKind.interfaceElement; - case 216 /* TypeAliasDeclaration */: return ScriptElementKind.typeElement; - case 217 /* EnumDeclaration */: return ScriptElementKind.enumElement; - case 211 /* VariableDeclaration */: + case 225 /* ModuleDeclaration */: return ScriptElementKind.moduleElement; + case 221 /* ClassDeclaration */: + case 192 /* ClassExpression */: + return ScriptElementKind.classElement; + case 222 /* InterfaceDeclaration */: return ScriptElementKind.interfaceElement; + case 223 /* TypeAliasDeclaration */: return ScriptElementKind.typeElement; + case 224 /* EnumDeclaration */: return ScriptElementKind.enumElement; + case 218 /* VariableDeclaration */: return ts.isConst(node) ? ScriptElementKind.constElement : ts.isLet(node) ? ScriptElementKind.letElement : ScriptElementKind.variableElement; - case 213 /* FunctionDeclaration */: return ScriptElementKind.functionElement; - case 145 /* GetAccessor */: return ScriptElementKind.memberGetAccessorElement; - case 146 /* SetAccessor */: return ScriptElementKind.memberSetAccessorElement; - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: + case 220 /* FunctionDeclaration */: + case 179 /* FunctionExpression */: + return ScriptElementKind.functionElement; + case 149 /* GetAccessor */: return ScriptElementKind.memberGetAccessorElement; + case 150 /* SetAccessor */: return ScriptElementKind.memberSetAccessorElement; + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: return ScriptElementKind.memberFunctionElement; - case 141 /* PropertyDeclaration */: - case 140 /* PropertySignature */: + case 145 /* PropertyDeclaration */: + case 144 /* PropertySignature */: return ScriptElementKind.memberVariableElement; - case 149 /* IndexSignature */: return ScriptElementKind.indexSignatureElement; - case 148 /* ConstructSignature */: return ScriptElementKind.constructSignatureElement; - case 147 /* CallSignature */: return ScriptElementKind.callSignatureElement; - case 144 /* Constructor */: return ScriptElementKind.constructorImplementationElement; - case 137 /* TypeParameter */: return ScriptElementKind.typeParameterElement; - case 247 /* EnumMember */: return ScriptElementKind.variableElement; - case 138 /* Parameter */: return (node.flags & 56 /* AccessibilityModifier */) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; - case 221 /* ImportEqualsDeclaration */: - case 226 /* ImportSpecifier */: - case 223 /* ImportClause */: - case 230 /* ExportSpecifier */: - case 224 /* NamespaceImport */: + case 153 /* IndexSignature */: return ScriptElementKind.indexSignatureElement; + case 152 /* ConstructSignature */: return ScriptElementKind.constructSignatureElement; + case 151 /* CallSignature */: return ScriptElementKind.callSignatureElement; + case 148 /* Constructor */: return ScriptElementKind.constructorImplementationElement; + case 141 /* TypeParameter */: return ScriptElementKind.typeParameterElement; + case 255 /* EnumMember */: return ScriptElementKind.variableElement; + case 142 /* Parameter */: return (node.flags & 92 /* ParameterPropertyModifier */) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; + case 229 /* ImportEqualsDeclaration */: + case 234 /* ImportSpecifier */: + case 231 /* ImportClause */: + case 238 /* ExportSpecifier */: + case 232 /* NamespaceImport */: return ScriptElementKind.alias; } return ScriptElementKind.unknown; @@ -45922,7 +51896,7 @@ var ts; } }; return CancellationTokenObject; - })(); + }()); function createLanguageService(host, documentRegistry) { if (documentRegistry === void 0) { documentRegistry = createDocumentRegistry(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames(), host.getCurrentDirectory()); } var syntaxTreeCache = new SyntaxTreeCache(host); @@ -45941,7 +51915,7 @@ var ts; host.log(message); } } - var getCanonicalFileName = createGetCanonicalFileName(useCaseSensitivefileNames); + var getCanonicalFileName = ts.createGetCanonicalFileName(useCaseSensitivefileNames); function getValidSourceFile(fileName) { var sourceFile = program.getSourceFile(fileName); if (!sourceFile) { @@ -45985,10 +51959,12 @@ var ts; (oldSettings.target !== newSettings.target || oldSettings.module !== newSettings.module || oldSettings.noResolve !== newSettings.noResolve || - oldSettings.jsx !== newSettings.jsx); + oldSettings.jsx !== newSettings.jsx || + oldSettings.allowJs !== newSettings.allowJs); // Now create a new compiler var compilerHost = { getSourceFile: getOrCreateSourceFile, + getSourceFileByPath: getOrCreateSourceFileByPath, getCancellationToken: function () { return cancellationToken; }, getCanonicalFileName: getCanonicalFileName, useCaseSensitiveFileNames: function () { return useCaseSensitivefileNames; }, @@ -45998,27 +51974,41 @@ var ts; getCurrentDirectory: function () { return currentDirectory; }, fileExists: function (fileName) { // stub missing host functionality - ts.Debug.assert(!host.resolveModuleNames); + ts.Debug.assert(!host.resolveModuleNames || !host.resolveTypeReferenceDirectives); return hostCache.getOrCreateEntry(fileName) !== undefined; }, readFile: function (fileName) { // stub missing host functionality var entry = hostCache.getOrCreateEntry(fileName); return entry && entry.scriptSnapshot.getText(0, entry.scriptSnapshot.getLength()); + }, + directoryExists: function (directoryName) { + ts.Debug.assert(!host.resolveModuleNames || !host.resolveTypeReferenceDirectives); + return ts.directoryProbablyExists(directoryName, host); } }; + if (host.trace) { + compilerHost.trace = function (message) { return host.trace(message); }; + } if (host.resolveModuleNames) { compilerHost.resolveModuleNames = function (moduleNames, containingFile) { return host.resolveModuleNames(moduleNames, containingFile); }; } + if (host.resolveTypeReferenceDirectives) { + compilerHost.resolveTypeReferenceDirectives = function (typeReferenceDirectiveNames, containingFile) { + return host.resolveTypeReferenceDirectives(typeReferenceDirectiveNames, containingFile); + }; + } + var documentRegistryBucketKey = documentRegistry.getKeyForCompilationSettings(newSettings); var newProgram = ts.createProgram(hostCache.getRootFileNames(), newSettings, compilerHost, program); // Release any files we have acquired in the old program but are // not part of the new program. if (program) { var oldSourceFiles = program.getSourceFiles(); + var oldSettingsKey = documentRegistry.getKeyForCompilationSettings(oldSettings); for (var _i = 0, oldSourceFiles_1 = oldSourceFiles; _i < oldSourceFiles_1.length; _i++) { var oldSourceFile = oldSourceFiles_1[_i]; if (!newProgram.getSourceFile(oldSourceFile.fileName) || changesInCompilationSettingsAffectSyntax) { - documentRegistry.releaseDocument(oldSourceFile.fileName, oldSettings); + documentRegistry.releaseDocumentWithKey(oldSourceFile.path, oldSettingsKey); } } } @@ -46031,24 +52021,27 @@ var ts; program.getTypeChecker(); return; function getOrCreateSourceFile(fileName) { + return getOrCreateSourceFileByPath(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName)); + } + function getOrCreateSourceFileByPath(fileName, path) { ts.Debug.assert(hostCache !== undefined); // The program is asking for this file, check first if the host can locate it. // If the host can not locate the file, then it does not exist. return undefined // to the program to allow reporting of errors for missing files. - var hostFileInformation = hostCache.getOrCreateEntry(fileName); + var hostFileInformation = hostCache.getOrCreateEntryByPath(fileName, path); if (!hostFileInformation) { return undefined; } // Check if the language version has changed since we last created a program; if they are the same, - // it is safe to reuse the souceFiles; if not, then the shape of the AST can change, and the oldSourceFile + // it is safe to reuse the sourceFiles; if not, then the shape of the AST can change, and the oldSourceFile // can not be reused. we have to dump all syntax trees and create new ones. if (!changesInCompilationSettingsAffectSyntax) { // Check if the old program had this file already - var oldSourceFile = program && program.getSourceFile(fileName); + var oldSourceFile = program && program.getSourceFileByPath(path); if (oldSourceFile) { // We already had a source file for this file name. Go to the registry to // ensure that we get the right up to date version of it. We need this to - // address the following 'race'. Specifically, say we have the following: + // address the following race-condition. Specifically, say we have the following: // // LS1 // \ @@ -46067,15 +52060,22 @@ var ts; // it's source file any more, and instead defers to DocumentRegistry to get // either version 1, version 2 (or some other version) depending on what the // host says should be used. - return documentRegistry.updateDocument(fileName, newSettings, hostFileInformation.scriptSnapshot, hostFileInformation.version); + // We do not support the scenario where a host can modify a registered + // file's script kind, i.e. in one project some file is treated as ".ts" + // and in another as ".js" + ts.Debug.assert(hostFileInformation.scriptKind === oldSourceFile.scriptKind, "Registered script kind (" + oldSourceFile.scriptKind + ") should match new script kind (" + hostFileInformation.scriptKind + ") for file: " + path); + return documentRegistry.updateDocumentWithKey(fileName, path, newSettings, documentRegistryBucketKey, hostFileInformation.scriptSnapshot, hostFileInformation.version, hostFileInformation.scriptKind); } } // Could not find this file in the old program, create a new SourceFile for it. - return documentRegistry.acquireDocument(fileName, newSettings, hostFileInformation.scriptSnapshot, hostFileInformation.version); + return documentRegistry.acquireDocumentWithKey(fileName, path, newSettings, documentRegistryBucketKey, hostFileInformation.scriptSnapshot, hostFileInformation.version, hostFileInformation.scriptKind); } function sourceFileUpToDate(sourceFile) { + if (!sourceFile) { + return false; + } var path = sourceFile.path || ts.toPath(sourceFile.fileName, currentDirectory, getCanonicalFileName); - return sourceFile && sourceFile.version === hostCache.getVersion(path); + return sourceFile.version === hostCache.getVersion(path); } function programUpToDate() { // If we haven't create a program yet, then it is not up-to-date @@ -46118,18 +52118,12 @@ var ts; return program.getSyntacticDiagnostics(getValidSourceFile(fileName), cancellationToken); } /** - * getSemanticDiagnostiscs return array of Diagnostics. If '-d' is not enabled, only report semantic errors + * getSemanticDiagnostics return array of Diagnostics. If '-d' is not enabled, only report semantic errors * If '-d' enabled, report both semantic and emitter errors */ function getSemanticDiagnostics(fileName) { synchronizeHostData(); var targetSourceFile = getValidSourceFile(fileName); - // For JavaScript files, we don't want to report the normal typescript semantic errors. - // Instead, we just report errors for using TypeScript-only constructs from within a - // JavaScript file. - if (ts.isSourceFileJavaScript(targetSourceFile)) { - return getJavaScriptSemanticDiagnostics(targetSourceFile); - } // Only perform the action per file regardless of '-out' flag as LanguageServiceHost is expected to call this function per file. // Therefore only get diagnostics for given file. var semanticDiagnostics = program.getSemanticDiagnostics(targetSourceFile, cancellationToken); @@ -46140,151 +52134,6 @@ var ts; var declarationDiagnostics = program.getDeclarationDiagnostics(targetSourceFile, cancellationToken); return ts.concatenate(semanticDiagnostics, declarationDiagnostics); } - function getJavaScriptSemanticDiagnostics(sourceFile) { - var diagnostics = []; - walk(sourceFile); - return diagnostics; - function walk(node) { - if (!node) { - return false; - } - switch (node.kind) { - case 221 /* ImportEqualsDeclaration */: - diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_a_ts_file)); - return true; - case 227 /* ExportAssignment */: - diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.export_can_only_be_used_in_a_ts_file)); - return true; - case 214 /* ClassDeclaration */: - var classDeclaration = node; - if (checkModifiers(classDeclaration.modifiers) || - checkTypeParameters(classDeclaration.typeParameters)) { - return true; - } - break; - case 243 /* HeritageClause */: - var heritageClause = node; - if (heritageClause.token === 106 /* ImplementsKeyword */) { - diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_a_ts_file)); - return true; - } - break; - case 215 /* InterfaceDeclaration */: - diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.interface_declarations_can_only_be_used_in_a_ts_file)); - return true; - case 218 /* ModuleDeclaration */: - diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.module_declarations_can_only_be_used_in_a_ts_file)); - return true; - case 216 /* TypeAliasDeclaration */: - diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.type_aliases_can_only_be_used_in_a_ts_file)); - return true; - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - case 144 /* Constructor */: - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: - case 173 /* FunctionExpression */: - case 213 /* FunctionDeclaration */: - case 174 /* ArrowFunction */: - case 213 /* FunctionDeclaration */: - var functionDeclaration = node; - if (checkModifiers(functionDeclaration.modifiers) || - checkTypeParameters(functionDeclaration.typeParameters) || - checkTypeAnnotation(functionDeclaration.type)) { - return true; - } - break; - case 193 /* VariableStatement */: - var variableStatement = node; - if (checkModifiers(variableStatement.modifiers)) { - return true; - } - break; - case 211 /* VariableDeclaration */: - var variableDeclaration = node; - if (checkTypeAnnotation(variableDeclaration.type)) { - return true; - } - break; - case 168 /* CallExpression */: - case 169 /* NewExpression */: - var expression = node; - if (expression.typeArguments && expression.typeArguments.length > 0) { - var start = expression.typeArguments.pos; - diagnostics.push(ts.createFileDiagnostic(sourceFile, start, expression.typeArguments.end - start, ts.Diagnostics.type_arguments_can_only_be_used_in_a_ts_file)); - return true; - } - break; - case 138 /* Parameter */: - var parameter = node; - if (parameter.modifiers) { - var start = parameter.modifiers.pos; - diagnostics.push(ts.createFileDiagnostic(sourceFile, start, parameter.modifiers.end - start, ts.Diagnostics.parameter_modifiers_can_only_be_used_in_a_ts_file)); - return true; - } - if (parameter.questionToken) { - diagnostics.push(ts.createDiagnosticForNode(parameter.questionToken, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, '?')); - return true; - } - if (parameter.type) { - diagnostics.push(ts.createDiagnosticForNode(parameter.type, ts.Diagnostics.types_can_only_be_used_in_a_ts_file)); - return true; - } - break; - case 141 /* PropertyDeclaration */: - diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.property_declarations_can_only_be_used_in_a_ts_file)); - return true; - case 217 /* EnumDeclaration */: - diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.enum_declarations_can_only_be_used_in_a_ts_file)); - return true; - case 171 /* TypeAssertionExpression */: - var typeAssertionExpression = node; - diagnostics.push(ts.createDiagnosticForNode(typeAssertionExpression.type, ts.Diagnostics.type_assertion_expressions_can_only_be_used_in_a_ts_file)); - return true; - case 139 /* Decorator */: - diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.decorators_can_only_be_used_in_a_ts_file)); - return true; - } - return ts.forEachChild(node, walk); - } - function checkTypeParameters(typeParameters) { - if (typeParameters) { - var start = typeParameters.pos; - diagnostics.push(ts.createFileDiagnostic(sourceFile, start, typeParameters.end - start, ts.Diagnostics.type_parameter_declarations_can_only_be_used_in_a_ts_file)); - return true; - } - return false; - } - function checkTypeAnnotation(type) { - if (type) { - diagnostics.push(ts.createDiagnosticForNode(type, ts.Diagnostics.types_can_only_be_used_in_a_ts_file)); - return true; - } - return false; - } - function checkModifiers(modifiers) { - if (modifiers) { - for (var _i = 0, modifiers_1 = modifiers; _i < modifiers_1.length; _i++) { - var modifier = modifiers_1[_i]; - switch (modifier.kind) { - case 112 /* PublicKeyword */: - case 110 /* PrivateKeyword */: - case 111 /* ProtectedKeyword */: - case 122 /* DeclareKeyword */: - diagnostics.push(ts.createDiagnosticForNode(modifier, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, ts.tokenToString(modifier.kind))); - return true; - // These are all legal modifiers. - case 113 /* StaticKeyword */: - case 82 /* ExportKeyword */: - case 74 /* ConstKeyword */: - case 77 /* DefaultKeyword */: - case 115 /* AbstractKeyword */: - } - } - } - return false; - } - } function getCompilerOptionsDiagnostics() { synchronizeHostData(); return program.getOptionsDiagnostics(cancellationToken).concat(program.getGlobalDiagnostics(cancellationToken)); @@ -46301,7 +52150,7 @@ var ts; // First check of the displayName is not external module; if it is an external module, it is not valid entry if ((symbol.flags & 1536 /* Namespace */) && (firstCharCode === 39 /* singleQuote */ || firstCharCode === 34 /* doubleQuote */)) { // If the symbol is external module, don't show it in the completion list - // (i.e declare module "http" { let x; } | // <= request completion here, "http" should not be there) + // (i.e declare module "http" { const x; } | // <= request completion here, "http" should not be there) return undefined; } } @@ -46324,20 +52173,14 @@ var ts; // e.g "b a" is valid quoted name but when we strip off the quotes, it is invalid. // We, thus, need to check if whatever was inside the quotes is actually a valid identifier name. if (performCharacterChecks) { - if (!ts.isIdentifierStart(name.charCodeAt(0), target)) { + if (!ts.isIdentifier(name, target)) { return undefined; } - for (var i = 1, n = name.length; i < n; i++) { - if (!ts.isIdentifierPart(name.charCodeAt(i), target)) { - return undefined; - } - } } return name; } function getCompletionData(fileName, position) { var typeChecker = program.getTypeChecker(); - var syntacticStart = new Date().getTime(); var sourceFile = getValidSourceFile(fileName); var isJavaScriptFile = ts.isSourceFileJavaScript(sourceFile); var isJsDocTagName = false; @@ -46349,7 +52192,7 @@ var ts; var insideComment = isInsideComment(sourceFile, currentToken, position); log("getCompletionData: Is inside comment: " + (new Date().getTime() - start)); if (insideComment) { - // The current position is next to the '@' sign, when no tag name being provided yet. + // The current position is next to the '@' sign, when no tag name being provided yet. // Provide a full list of tag names if (ts.hasDocComment(sourceFile, position) && sourceFile.text.charCodeAt(position - 1) === 64 /* at */) { isJsDocTagName = true; @@ -46364,9 +52207,9 @@ var ts; isJsDocTagName = true; } switch (tag.kind) { - case 269 /* JSDocTypeTag */: - case 267 /* JSDocParameterTag */: - case 268 /* JSDocReturnTag */: + case 277 /* JSDocTypeTag */: + case 275 /* JSDocParameterTag */: + case 276 /* JSDocReturnTag */: var tagWithExpression = tag; if (tagWithExpression.typeExpression) { insideJsDocTagExpression = tagWithExpression.typeExpression.pos < position && position < tagWithExpression.typeExpression.end; @@ -46378,7 +52221,7 @@ var ts; return { symbols: undefined, isMemberCompletion: false, isNewIdentifierLocation: false, location: undefined, isRightOfDot: false, isJsDocTagName: isJsDocTagName }; } if (!insideJsDocTagExpression) { - // Proceed if the current position is in jsDoc tag expression; otherwise it is a normal + // Proceed if the current position is in jsDoc tag expression; otherwise it is a normal // comment or the plain text part of a jsDoc comment, so no completion should be available log("Returning an empty list because completion was inside a regular comment or plain text part of a JsDoc comment."); return undefined; @@ -46393,9 +52236,9 @@ var ts; // Check if the caret is at the end of an identifier; this is a partial identifier that we want to complete: e.g. a.toS| // Skip this partial identifier and adjust the contextToken to the token that precedes it. if (contextToken && position <= contextToken.end && ts.isWord(contextToken.kind)) { - var start_3 = new Date().getTime(); + var start_6 = new Date().getTime(); contextToken = ts.findPrecedingToken(contextToken.getFullStart(), sourceFile); - log("getCompletionData: Get previous token 2: " + (new Date().getTime() - start_3)); + log("getCompletionData: Get previous token 2: " + (new Date().getTime() - start_6)); } // Find the node where completion is requested on. // Also determine whether we are trying to complete with members of that node @@ -46411,13 +52254,13 @@ var ts; log("Returning an empty list because completion was requested in an invalid position."); return undefined; } - var parent_9 = contextToken.parent, kind = contextToken.kind; + var parent_16 = contextToken.parent, kind = contextToken.kind; if (kind === 21 /* DotToken */) { - if (parent_9.kind === 166 /* PropertyAccessExpression */) { + if (parent_16.kind === 172 /* PropertyAccessExpression */) { node = contextToken.parent.expression; isRightOfDot = true; } - else if (parent_9.kind === 135 /* QualifiedName */) { + else if (parent_16.kind === 139 /* QualifiedName */) { node = contextToken.parent.left; isRightOfDot = true; } @@ -46432,8 +52275,9 @@ var ts; isRightOfOpenTag = true; location = contextToken; } - else if (kind === 39 /* SlashToken */ && contextToken.parent.kind === 237 /* JsxClosingElement */) { + else if (kind === 39 /* SlashToken */ && contextToken.parent.kind === 245 /* JsxClosingElement */) { isStartingCloseTag = true; + location = contextToken; } } } @@ -46447,7 +52291,7 @@ var ts; else if (isRightOfOpenTag) { var tagSymbols = typeChecker.getJsxIntrinsicTagNames(); if (tryGetGlobalSymbols()) { - symbols = tagSymbols.concat(symbols.filter(function (s) { return !!(s.flags & 107455 /* Value */); })); + symbols = tagSymbols.concat(symbols.filter(function (s) { return !!(s.flags & (107455 /* Value */ | 8388608 /* Alias */)); })); } else { symbols = tagSymbols; @@ -46457,7 +52301,10 @@ var ts; } else if (isStartingCloseTag) { var tagName = contextToken.parent.parent.openingElement.tagName; - symbols = [typeChecker.getSymbolAtLocation(tagName)]; + var tagSymbol = typeChecker.getSymbolAtLocation(tagName); + if (!typeChecker.isUnknownSymbol(tagSymbol)) { + symbols = [tagSymbol]; + } isMemberCompletion = true; isNewIdentifierLocation = false; } @@ -46475,7 +52322,7 @@ var ts; // Right of dot member completion list isMemberCompletion = true; isNewIdentifierLocation = false; - if (node.kind === 69 /* Identifier */ || node.kind === 135 /* QualifiedName */ || node.kind === 166 /* PropertyAccessExpression */) { + if (node.kind === 69 /* Identifier */ || node.kind === 139 /* QualifiedName */ || node.kind === 172 /* PropertyAccessExpression */) { var symbol = typeChecker.getSymbolAtLocation(node); // This is an alias, follow what it aliases if (symbol && symbol.flags & 8388608 /* Alias */) { @@ -46530,8 +52377,8 @@ var ts; return tryGetImportOrExportClauseCompletionSymbols(namedImportsOrExports); } if (jsxContainer = tryGetContainingJsxElement(contextToken)) { - var attrsType; - if ((jsxContainer.kind === 234 /* JsxSelfClosingElement */) || (jsxContainer.kind === 235 /* JsxOpeningElement */)) { + var attrsType = void 0; + if ((jsxContainer.kind === 242 /* JsxSelfClosingElement */) || (jsxContainer.kind === 243 /* JsxOpeningElement */)) { // Cursor is inside a JSX self-closing element or opening element attrsType = typeChecker.getJsxElementAttributesType(jsxContainer); if (attrsType) { @@ -46603,15 +52450,15 @@ var ts; return result; } function isInJsxText(contextToken) { - if (contextToken.kind === 236 /* JsxText */) { + if (contextToken.kind === 244 /* JsxText */) { return true; } if (contextToken.kind === 27 /* GreaterThanToken */ && contextToken.parent) { - if (contextToken.parent.kind === 235 /* JsxOpeningElement */) { + if (contextToken.parent.kind === 243 /* JsxOpeningElement */) { return true; } - if (contextToken.parent.kind === 237 /* JsxClosingElement */ || contextToken.parent.kind === 234 /* JsxSelfClosingElement */) { - return contextToken.parent.parent && contextToken.parent.parent.kind === 233 /* JsxElement */; + if (contextToken.parent.kind === 245 /* JsxClosingElement */ || contextToken.parent.kind === 242 /* JsxSelfClosingElement */) { + return contextToken.parent.parent && contextToken.parent.parent.kind === 241 /* JsxElement */; } } return false; @@ -46621,40 +52468,40 @@ var ts; var containingNodeKind = previousToken.parent.kind; switch (previousToken.kind) { case 24 /* CommaToken */: - return containingNodeKind === 168 /* CallExpression */ // func( a, | - || containingNodeKind === 144 /* Constructor */ // constructor( a, | /* public, protected, private keywords are allowed here, so show completion */ - || containingNodeKind === 169 /* NewExpression */ // new C(a, | - || containingNodeKind === 164 /* ArrayLiteralExpression */ // [a, | - || containingNodeKind === 181 /* BinaryExpression */ // let x = (a, | - || containingNodeKind === 152 /* FunctionType */; // var x: (s: string, list| + return containingNodeKind === 174 /* CallExpression */ // func( a, | + || containingNodeKind === 148 /* Constructor */ // constructor( a, | /* public, protected, private keywords are allowed here, so show completion */ + || containingNodeKind === 175 /* NewExpression */ // new C(a, | + || containingNodeKind === 170 /* ArrayLiteralExpression */ // [a, | + || containingNodeKind === 187 /* BinaryExpression */ // const x = (a, | + || containingNodeKind === 156 /* FunctionType */; // var x: (s: string, list| case 17 /* OpenParenToken */: - return containingNodeKind === 168 /* CallExpression */ // func( | - || containingNodeKind === 144 /* Constructor */ // constructor( | - || containingNodeKind === 169 /* NewExpression */ // new C(a| - || containingNodeKind === 172 /* ParenthesizedExpression */ // let x = (a| - || containingNodeKind === 160 /* ParenthesizedType */; // function F(pred: (a| /* this can become an arrow function, where 'a' is the argument */ + return containingNodeKind === 174 /* CallExpression */ // func( | + || containingNodeKind === 148 /* Constructor */ // constructor( | + || containingNodeKind === 175 /* NewExpression */ // new C(a| + || containingNodeKind === 178 /* ParenthesizedExpression */ // const x = (a| + || containingNodeKind === 164 /* ParenthesizedType */; // function F(pred: (a| /* this can become an arrow function, where 'a' is the argument */ case 19 /* OpenBracketToken */: - return containingNodeKind === 164 /* ArrayLiteralExpression */ // [ | - || containingNodeKind === 149 /* IndexSignature */ // [ | : string ] - || containingNodeKind === 136 /* ComputedPropertyName */; // [ | /* this can become an index signature */ + return containingNodeKind === 170 /* ArrayLiteralExpression */ // [ | + || containingNodeKind === 153 /* IndexSignature */ // [ | : string ] + || containingNodeKind === 140 /* ComputedPropertyName */; // [ | /* this can become an index signature */ case 125 /* ModuleKeyword */: // module | case 126 /* NamespaceKeyword */: return true; case 21 /* DotToken */: - return containingNodeKind === 218 /* ModuleDeclaration */; // module A.| + return containingNodeKind === 225 /* ModuleDeclaration */; // module A.| case 15 /* OpenBraceToken */: - return containingNodeKind === 214 /* ClassDeclaration */; // class A{ | + return containingNodeKind === 221 /* ClassDeclaration */; // class A{ | case 56 /* EqualsToken */: - return containingNodeKind === 211 /* VariableDeclaration */ // let x = a| - || containingNodeKind === 181 /* BinaryExpression */; // x = a| + return containingNodeKind === 218 /* VariableDeclaration */ // const x = a| + || containingNodeKind === 187 /* BinaryExpression */; // x = a| case 12 /* TemplateHead */: - return containingNodeKind === 183 /* TemplateExpression */; // `aa ${| + return containingNodeKind === 189 /* TemplateExpression */; // `aa ${| case 13 /* TemplateMiddle */: - return containingNodeKind === 190 /* TemplateSpan */; // `aa ${10} dd ${| + return containingNodeKind === 197 /* TemplateSpan */; // `aa ${10} dd ${| case 112 /* PublicKeyword */: case 110 /* PrivateKeyword */: case 111 /* ProtectedKeyword */: - return containingNodeKind === 141 /* PropertyDeclaration */; // class A{ public | + return containingNodeKind === 145 /* PropertyDeclaration */; // class A{ public | } // Previous token may have been a keyword that was converted to an identifier. switch (previousToken.getText()) { @@ -46668,15 +52515,16 @@ var ts; } function isInStringOrRegularExpressionOrTemplateLiteral(contextToken) { if (contextToken.kind === 9 /* StringLiteral */ + || contextToken.kind === 166 /* StringLiteralType */ || contextToken.kind === 10 /* RegularExpressionLiteral */ || ts.isTemplateLiteralKind(contextToken.kind)) { - var start_4 = contextToken.getStart(); + var start_7 = contextToken.getStart(); var end = contextToken.getEnd(); // To be "in" one of these literals, the position has to be: // 1. entirely within the token text. // 2. at the end position of an unterminated token. // 3. at the end of a regular expression (due to trailing flags like '/foo/g'). - if (start_4 < position && position < end) { + if (start_7 < position && position < end) { return true; } if (position === end) { @@ -46697,14 +52545,14 @@ var ts; isMemberCompletion = true; var typeForObject; var existingMembers; - if (objectLikeContainer.kind === 165 /* ObjectLiteralExpression */) { + if (objectLikeContainer.kind === 171 /* ObjectLiteralExpression */) { // We are completing on contextual types, but may also include properties // other than those within the declared type. isNewIdentifierLocation = true; typeForObject = typeChecker.getContextualType(objectLikeContainer); existingMembers = objectLikeContainer.properties; } - else if (objectLikeContainer.kind === 161 /* ObjectBindingPattern */) { + else if (objectLikeContainer.kind === 167 /* ObjectBindingPattern */) { // We are *only* completing on properties from the type being destructured. isNewIdentifierLocation = false; var rootDeclaration = ts.getRootDeclaration(objectLikeContainer.parent); @@ -46712,7 +52560,18 @@ var ts; // We don't want to complete using the type acquired by the shape // of the binding pattern; we are only interested in types acquired // through type declaration or inference. - if (rootDeclaration.initializer || rootDeclaration.type) { + // Also proceed if rootDeclaration is parameter and if its containing function expression\arrow function is contextually typed - + // type of parameter will flow in from the contextual type of the function + var canGetType = !!(rootDeclaration.initializer || rootDeclaration.type); + if (!canGetType && rootDeclaration.kind === 142 /* Parameter */) { + if (ts.isExpression(rootDeclaration.parent)) { + canGetType = !!typeChecker.getContextualType(rootDeclaration.parent); + } + else if (rootDeclaration.parent.kind === 147 /* MethodDeclaration */ || rootDeclaration.parent.kind === 150 /* SetAccessor */) { + canGetType = ts.isExpression(rootDeclaration.parent.parent) && !!typeChecker.getContextualType(rootDeclaration.parent.parent); + } + } + if (canGetType) { typeForObject = typeChecker.getTypeAtLocation(objectLikeContainer); existingMembers = objectLikeContainer.elements; } @@ -46750,9 +52609,9 @@ var ts; * @returns true if 'symbols' was successfully populated; false otherwise. */ function tryGetImportOrExportClauseCompletionSymbols(namedImportsOrExports) { - var declarationKind = namedImportsOrExports.kind === 225 /* NamedImports */ ? - 222 /* ImportDeclaration */ : - 228 /* ExportDeclaration */; + var declarationKind = namedImportsOrExports.kind === 233 /* NamedImports */ ? + 230 /* ImportDeclaration */ : + 236 /* ExportDeclaration */; var importOrExportDeclaration = ts.getAncestor(namedImportsOrExports, declarationKind); var moduleSpecifier = importOrExportDeclaration.moduleSpecifier; if (!moduleSpecifier) { @@ -46775,11 +52634,11 @@ var ts; function tryGetObjectLikeCompletionContainer(contextToken) { if (contextToken) { switch (contextToken.kind) { - case 15 /* OpenBraceToken */: // let x = { | + case 15 /* OpenBraceToken */: // const x = { | case 24 /* CommaToken */: - var parent_10 = contextToken.parent; - if (parent_10 && (parent_10.kind === 165 /* ObjectLiteralExpression */ || parent_10.kind === 161 /* ObjectBindingPattern */)) { - return parent_10; + var parent_17 = contextToken.parent; + if (parent_17 && (parent_17.kind === 171 /* ObjectLiteralExpression */ || parent_17.kind === 167 /* ObjectBindingPattern */)) { + return parent_17; } break; } @@ -46796,8 +52655,8 @@ var ts; case 15 /* OpenBraceToken */: // import { | case 24 /* CommaToken */: switch (contextToken.parent.kind) { - case 225 /* NamedImports */: - case 229 /* NamedExports */: + case 233 /* NamedImports */: + case 237 /* NamedExports */: return contextToken.parent; } } @@ -46806,37 +52665,37 @@ var ts; } function tryGetContainingJsxElement(contextToken) { if (contextToken) { - var parent_11 = contextToken.parent; + var parent_18 = contextToken.parent; switch (contextToken.kind) { case 26 /* LessThanSlashToken */: case 39 /* SlashToken */: case 69 /* Identifier */: - case 238 /* JsxAttribute */: - case 239 /* JsxSpreadAttribute */: - if (parent_11 && (parent_11.kind === 234 /* JsxSelfClosingElement */ || parent_11.kind === 235 /* JsxOpeningElement */)) { - return parent_11; + case 246 /* JsxAttribute */: + case 247 /* JsxSpreadAttribute */: + if (parent_18 && (parent_18.kind === 242 /* JsxSelfClosingElement */ || parent_18.kind === 243 /* JsxOpeningElement */)) { + return parent_18; } - else if (parent_11.kind === 238 /* JsxAttribute */) { - return parent_11.parent; + else if (parent_18.kind === 246 /* JsxAttribute */) { + return parent_18.parent; } break; // The context token is the closing } or " of an attribute, which means // its parent is a JsxExpression, whose parent is a JsxAttribute, // whose parent is a JsxOpeningLikeElement case 9 /* StringLiteral */: - if (parent_11 && ((parent_11.kind === 238 /* JsxAttribute */) || (parent_11.kind === 239 /* JsxSpreadAttribute */))) { - return parent_11.parent; + if (parent_18 && ((parent_18.kind === 246 /* JsxAttribute */) || (parent_18.kind === 247 /* JsxSpreadAttribute */))) { + return parent_18.parent; } break; case 16 /* CloseBraceToken */: - if (parent_11 && - parent_11.kind === 240 /* JsxExpression */ && - parent_11.parent && - (parent_11.parent.kind === 238 /* JsxAttribute */)) { - return parent_11.parent.parent; + if (parent_18 && + parent_18.kind === 248 /* JsxExpression */ && + parent_18.parent && + (parent_18.parent.kind === 246 /* JsxAttribute */)) { + return parent_18.parent.parent; } - if (parent_11 && parent_11.kind === 239 /* JsxSpreadAttribute */) { - return parent_11.parent; + if (parent_18 && parent_18.kind === 247 /* JsxSpreadAttribute */) { + return parent_18.parent; } break; } @@ -46845,16 +52704,16 @@ var ts; } function isFunction(kind) { switch (kind) { - case 173 /* FunctionExpression */: - case 174 /* ArrowFunction */: - case 213 /* FunctionDeclaration */: - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: - case 147 /* CallSignature */: - case 148 /* ConstructSignature */: - case 149 /* IndexSignature */: + case 179 /* FunctionExpression */: + case 180 /* ArrowFunction */: + case 220 /* FunctionDeclaration */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: + case 151 /* CallSignature */: + case 152 /* ConstructSignature */: + case 153 /* IndexSignature */: return true; } return false; @@ -46866,66 +52725,66 @@ var ts; var containingNodeKind = contextToken.parent.kind; switch (contextToken.kind) { case 24 /* CommaToken */: - return containingNodeKind === 211 /* VariableDeclaration */ || - containingNodeKind === 212 /* VariableDeclarationList */ || - containingNodeKind === 193 /* VariableStatement */ || - containingNodeKind === 217 /* EnumDeclaration */ || + return containingNodeKind === 218 /* VariableDeclaration */ || + containingNodeKind === 219 /* VariableDeclarationList */ || + containingNodeKind === 200 /* VariableStatement */ || + containingNodeKind === 224 /* EnumDeclaration */ || isFunction(containingNodeKind) || - containingNodeKind === 214 /* ClassDeclaration */ || - containingNodeKind === 186 /* ClassExpression */ || - containingNodeKind === 215 /* InterfaceDeclaration */ || - containingNodeKind === 162 /* ArrayBindingPattern */ || - containingNodeKind === 216 /* TypeAliasDeclaration */; // type Map, K, | + containingNodeKind === 221 /* ClassDeclaration */ || + containingNodeKind === 192 /* ClassExpression */ || + containingNodeKind === 222 /* InterfaceDeclaration */ || + containingNodeKind === 168 /* ArrayBindingPattern */ || + containingNodeKind === 223 /* TypeAliasDeclaration */; // type Map, K, | case 21 /* DotToken */: - return containingNodeKind === 162 /* ArrayBindingPattern */; // var [.| + return containingNodeKind === 168 /* ArrayBindingPattern */; // var [.| case 54 /* ColonToken */: - return containingNodeKind === 163 /* BindingElement */; // var {x :html| + return containingNodeKind === 169 /* BindingElement */; // var {x :html| case 19 /* OpenBracketToken */: - return containingNodeKind === 162 /* ArrayBindingPattern */; // var [x| + return containingNodeKind === 168 /* ArrayBindingPattern */; // var [x| case 17 /* OpenParenToken */: - return containingNodeKind === 244 /* CatchClause */ || + return containingNodeKind === 252 /* CatchClause */ || isFunction(containingNodeKind); case 15 /* OpenBraceToken */: - return containingNodeKind === 217 /* EnumDeclaration */ || - containingNodeKind === 215 /* InterfaceDeclaration */ || - containingNodeKind === 155 /* TypeLiteral */; // let x : { | + return containingNodeKind === 224 /* EnumDeclaration */ || + containingNodeKind === 222 /* InterfaceDeclaration */ || + containingNodeKind === 159 /* TypeLiteral */; // const x : { | case 23 /* SemicolonToken */: - return containingNodeKind === 140 /* PropertySignature */ && + return containingNodeKind === 144 /* PropertySignature */ && contextToken.parent && contextToken.parent.parent && - (contextToken.parent.parent.kind === 215 /* InterfaceDeclaration */ || - contextToken.parent.parent.kind === 155 /* TypeLiteral */); // let x : { a; | + (contextToken.parent.parent.kind === 222 /* InterfaceDeclaration */ || + contextToken.parent.parent.kind === 159 /* TypeLiteral */); // const x : { a; | case 25 /* LessThanToken */: - return containingNodeKind === 214 /* ClassDeclaration */ || - containingNodeKind === 186 /* ClassExpression */ || - containingNodeKind === 215 /* InterfaceDeclaration */ || - containingNodeKind === 216 /* TypeAliasDeclaration */ || + return containingNodeKind === 221 /* ClassDeclaration */ || + containingNodeKind === 192 /* ClassExpression */ || + containingNodeKind === 222 /* InterfaceDeclaration */ || + containingNodeKind === 223 /* TypeAliasDeclaration */ || isFunction(containingNodeKind); case 113 /* StaticKeyword */: - return containingNodeKind === 141 /* PropertyDeclaration */; + return containingNodeKind === 145 /* PropertyDeclaration */; case 22 /* DotDotDotToken */: - return containingNodeKind === 138 /* Parameter */ || + return containingNodeKind === 142 /* Parameter */ || (contextToken.parent && contextToken.parent.parent && - contextToken.parent.parent.kind === 162 /* ArrayBindingPattern */); // var [...z| + contextToken.parent.parent.kind === 168 /* ArrayBindingPattern */); // var [...z| case 112 /* PublicKeyword */: case 110 /* PrivateKeyword */: case 111 /* ProtectedKeyword */: - return containingNodeKind === 138 /* Parameter */; + return containingNodeKind === 142 /* Parameter */; case 116 /* AsKeyword */: - return containingNodeKind === 226 /* ImportSpecifier */ || - containingNodeKind === 230 /* ExportSpecifier */ || - containingNodeKind === 224 /* NamespaceImport */; + return containingNodeKind === 234 /* ImportSpecifier */ || + containingNodeKind === 238 /* ExportSpecifier */ || + containingNodeKind === 232 /* NamespaceImport */; case 73 /* ClassKeyword */: case 81 /* EnumKeyword */: case 107 /* InterfaceKeyword */: case 87 /* FunctionKeyword */: case 102 /* VarKeyword */: case 123 /* GetKeyword */: - case 129 /* SetKeyword */: + case 131 /* SetKeyword */: case 89 /* ImportKeyword */: case 108 /* LetKeyword */: case 74 /* ConstKeyword */: case 114 /* YieldKeyword */: - case 132 /* TypeKeyword */: + case 134 /* TypeKeyword */: return true; } // Previous token may have been a keyword that was converted to an identifier. @@ -46966,20 +52825,20 @@ var ts; * do not occur at the current position and have not otherwise been typed. */ function filterNamedImportOrExportCompletionItems(exportsOfModule, namedImportsOrExports) { - var exisingImportsOrExports = {}; + var existingImportsOrExports = {}; for (var _i = 0, namedImportsOrExports_1 = namedImportsOrExports; _i < namedImportsOrExports_1.length; _i++) { var element = namedImportsOrExports_1[_i]; // If this is the current item we are editing right now, do not filter it out if (element.getStart() <= position && position <= element.getEnd()) { continue; } - var name_35 = element.propertyName || element.name; - exisingImportsOrExports[name_35.text] = true; + var name_39 = element.propertyName || element.name; + existingImportsOrExports[name_39.text] = true; } - if (ts.isEmpty(exisingImportsOrExports)) { - return exportsOfModule; + if (ts.isEmpty(existingImportsOrExports)) { + return ts.filter(exportsOfModule, function (e) { return e.name !== "default"; }); } - return ts.filter(exportsOfModule, function (e) { return !ts.lookUp(exisingImportsOrExports, e.name); }); + return ts.filter(exportsOfModule, function (e) { return e.name !== "default" && !ts.lookUp(existingImportsOrExports, e.name); }); } /** * Filters out completion suggestions for named imports or exports. @@ -46995,9 +52854,10 @@ var ts; for (var _i = 0, existingMembers_1 = existingMembers; _i < existingMembers_1.length; _i++) { var m = existingMembers_1[_i]; // Ignore omitted expressions for missing members - if (m.kind !== 245 /* PropertyAssignment */ && - m.kind !== 246 /* ShorthandPropertyAssignment */ && - m.kind !== 163 /* BindingElement */) { + if (m.kind !== 253 /* PropertyAssignment */ && + m.kind !== 254 /* ShorthandPropertyAssignment */ && + m.kind !== 169 /* BindingElement */ && + m.kind !== 147 /* MethodDeclaration */) { continue; } // If this is the current item we are editing right now, do not filter it out @@ -47005,7 +52865,7 @@ var ts; continue; } var existingName = void 0; - if (m.kind === 163 /* BindingElement */ && m.propertyName) { + if (m.kind === 169 /* BindingElement */ && m.propertyName) { // include only identifiers in completion list if (m.propertyName.kind === 69 /* Identifier */) { existingName = m.propertyName.text; @@ -47035,7 +52895,7 @@ var ts; if (attr.getStart() <= position && position <= attr.getEnd()) { continue; } - if (attr.kind === 238 /* JsxAttribute */) { + if (attr.kind === 246 /* JsxAttribute */) { seenNames[attr.name.text] = true; } } @@ -47048,20 +52908,36 @@ var ts; if (!completionData) { return undefined; } - var symbols = completionData.symbols, isMemberCompletion = completionData.isMemberCompletion, isNewIdentifierLocation = completionData.isNewIdentifierLocation, location = completionData.location, isRightOfDot = completionData.isRightOfDot, isJsDocTagName = completionData.isJsDocTagName; + var symbols = completionData.symbols, isMemberCompletion = completionData.isMemberCompletion, isNewIdentifierLocation = completionData.isNewIdentifierLocation, location = completionData.location, isJsDocTagName = completionData.isJsDocTagName; if (isJsDocTagName) { // If the current position is a jsDoc tag name, only tag names should be provided for completion return { isMemberCompletion: false, isNewIdentifierLocation: false, entries: getAllJsDocCompletionEntries() }; } var sourceFile = getValidSourceFile(fileName); var entries = []; - if (isRightOfDot && ts.isSourceFileJavaScript(sourceFile)) { + if (ts.isSourceFileJavaScript(sourceFile)) { var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries); - ts.addRange(entries, getJavaScriptCompletionEntries(sourceFile, uniqueNames)); + ts.addRange(entries, getJavaScriptCompletionEntries(sourceFile, location.pos, uniqueNames)); } else { if (!symbols || symbols.length === 0) { - return undefined; + if (sourceFile.languageVariant === 1 /* JSX */ && + location.parent && location.parent.kind === 245 /* JsxClosingElement */) { + // In the TypeScript JSX element, if such element is not defined. When users query for completion at closing tag, + // instead of simply giving unknown value, the completion will return the tag-name of an associated opening-element. + // For example: + // var x =
completion list at "1" will contain "div" with type any + var tagName = location.parent.parent.openingElement.tagName; + entries.push({ + name: tagName.text, + kind: undefined, + kindModifiers: undefined, + sortText: "0" + }); + } + else { + return undefined; + } } getCompletionEntriesFromSymbols(symbols, entries); } @@ -47070,14 +52946,18 @@ var ts; ts.addRange(entries, keywordCompletions); } return { isMemberCompletion: isMemberCompletion, isNewIdentifierLocation: isNewIdentifierLocation, entries: entries }; - function getJavaScriptCompletionEntries(sourceFile, uniqueNames) { + function getJavaScriptCompletionEntries(sourceFile, position, uniqueNames) { var entries = []; var target = program.getCompilerOptions().target; var nameTable = getNameTable(sourceFile); - for (var name_36 in nameTable) { - if (!uniqueNames[name_36]) { - uniqueNames[name_36] = name_36; - var displayName = getCompletionEntryDisplayName(name_36, target, /*performCharacterChecks:*/ true); + for (var name_40 in nameTable) { + // Skip identifiers produced only from the current location + if (nameTable[name_40] === position) { + continue; + } + if (!uniqueNames[name_40]) { + uniqueNames[name_40] = name_40; + var displayName = getCompletionEntryDisplayName(name_40, target, /*performCharacterChecks*/ true); if (displayName) { var entry = { name: displayName, @@ -47105,7 +52985,7 @@ var ts; // Try to get a valid display name for this symbol, if we could not find one, then ignore it. // We would like to only show things that can be added after a dot, so for instance numeric properties can // not be accessed with a dot (a.1 <- invalid) - var displayName = getCompletionEntryDisplayNameForSymbol(symbol, program.getCompilerOptions().target, /*performCharacterChecks:*/ true, location); + var displayName = getCompletionEntryDisplayNameForSymbol(symbol, program.getCompilerOptions().target, /*performCharacterChecks*/ true, location); if (!displayName) { return undefined; } @@ -47127,8 +53007,8 @@ var ts; var start = new Date().getTime(); var uniqueNames = {}; if (symbols) { - for (var _i = 0, symbols_3 = symbols; _i < symbols_3.length; _i++) { - var symbol = symbols_3[_i]; + for (var _i = 0, symbols_4 = symbols; _i < symbols_4.length; _i++) { + var symbol = symbols_4[_i]; var entry = createCompletionEntry(symbol, location); if (entry) { var id = ts.escapeIdentifier(entry.name); @@ -47150,11 +53030,11 @@ var ts; if (completionData) { var symbols = completionData.symbols, location_2 = completionData.location; // Find the symbol with the matching entry name. - var target = program.getCompilerOptions().target; + var target_2 = program.getCompilerOptions().target; // We don't need to perform character checks here because we're only comparing the // name against 'entryName' (which is known to be good), not building a new // completion entry. - var symbol = ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(s, target, /*performCharacterChecks:*/ false, location_2) === entryName ? s : undefined; }); + var symbol = ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(s, target_2, /*performCharacterChecks*/ false, location_2) === entryName ? s : undefined; }); if (symbol) { var _a = getSymbolDisplayPartsDocumentationAndSymbolKind(symbol, getValidSourceFile(fileName), location_2, location_2, 7 /* All */), displayParts = _a.displayParts, documentation = _a.documentation, symbolKind = _a.symbolKind; return { @@ -47183,7 +53063,7 @@ var ts; function getSymbolKind(symbol, location) { var flags = symbol.getFlags(); if (flags & 32 /* Class */) - return ts.getDeclarationOfKind(symbol, 186 /* ClassExpression */) ? + return ts.getDeclarationOfKind(symbol, 192 /* ClassExpression */) ? ScriptElementKind.localClassElement : ScriptElementKind.classElement; if (flags & 384 /* Enum */) return ScriptElementKind.enumElement; @@ -47214,6 +53094,9 @@ var ts; if (typeChecker.isArgumentsSymbol(symbol)) { return ScriptElementKind.localVariableElement; } + if (location.kind === 97 /* ThisKeyword */ && ts.isExpression(location)) { + return ScriptElementKind.parameterElement; + } if (flags & 3 /* Variable */) { if (ts.isFirstDeclarationOfSymbolParameter(symbol)) { return ScriptElementKind.parameterElement; @@ -47248,7 +53131,7 @@ var ts; }); if (!unionPropertyKind) { // If this was union of all methods, - //make sure it has call signatures before we can label it as method + // make sure it has call signatures before we can label it as method var typeOfUnionProperty = typeChecker.getTypeOfSymbolAtLocation(symbol, location); if (typeOfUnionProperty.getCallSignatures().length) { return ScriptElementKind.memberFunctionElement; @@ -47275,6 +53158,7 @@ var ts; var symbolFlags = symbol.flags; var symbolKind = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(symbol, symbolFlags, location); var hasAddedSymbolInfo; + var isThisExpression = location.kind === 97 /* ThisKeyword */ && ts.isExpression(location); var type; // Class at constructor site need to be shown as constructor apart from property,method, vars if (symbolKind !== ScriptElementKind.unknown || symbolFlags & 32 /* Class */ || symbolFlags & 8388608 /* Alias */) { @@ -47282,10 +53166,10 @@ var ts; if (symbolKind === ScriptElementKind.memberGetAccessorElement || symbolKind === ScriptElementKind.memberSetAccessorElement) { symbolKind = ScriptElementKind.memberVariableElement; } - var signature; - type = typeChecker.getTypeOfSymbolAtLocation(symbol, location); + var signature = void 0; + type = isThisExpression ? typeChecker.getTypeAtLocation(location) : typeChecker.getTypeOfSymbolAtLocation(symbol, location); if (type) { - if (location.parent && location.parent.kind === 166 /* PropertyAccessExpression */) { + if (location.parent && location.parent.kind === 172 /* PropertyAccessExpression */) { var right = location.parent.name; // Either the location is on the right of a property access, or on the left and the right is missing if (right === location || (right && right.getFullWidth() === 0)) { @@ -47293,8 +53177,8 @@ var ts; } } // try get the call/construct signature from the type if it matches - var callExpression; - if (location.kind === 168 /* CallExpression */ || location.kind === 169 /* NewExpression */) { + var callExpression = void 0; + if (location.kind === 174 /* CallExpression */ || location.kind === 175 /* NewExpression */) { callExpression = location; } else if (isCallExpressionTarget(location) || isNewExpressionTarget(location)) { @@ -47307,7 +53191,7 @@ var ts; // Use the first candidate: signature = candidateSignatures[0]; } - var useConstructSignatures = callExpression.kind === 169 /* NewExpression */ || callExpression.expression.kind === 95 /* SuperKeyword */; + var useConstructSignatures = callExpression.kind === 175 /* NewExpression */ || callExpression.expression.kind === 95 /* SuperKeyword */; var allSignatures = useConstructSignatures ? type.getConstructSignatures() : type.getCallSignatures(); if (!ts.contains(allSignatures, signature.target) && !ts.contains(allSignatures, signature)) { // Get the first signature if there is one -- allSignatures may contain @@ -47341,16 +53225,16 @@ var ts; case ScriptElementKind.parameterElement: case ScriptElementKind.localVariableElement: // If it is call or construct signature of lambda's write type name - displayParts.push(ts.punctuationPart(ts.SyntaxKind.ColonToken)); + displayParts.push(ts.punctuationPart(54 /* ColonToken */)); displayParts.push(ts.spacePart()); if (useConstructSignatures) { - displayParts.push(ts.keywordPart(ts.SyntaxKind.NewKeyword)); + displayParts.push(ts.keywordPart(92 /* NewKeyword */)); displayParts.push(ts.spacePart()); } - if (!(type.flags & ts.TypeFlags.Anonymous)) { - ts.addRange(displayParts, ts.symbolToDisplayParts(typeChecker, type.symbol, enclosingDeclaration, /*meaning*/ undefined, ts.SymbolFormatFlags.WriteTypeParametersOrArguments)); + if (!(type.flags & 65536 /* Anonymous */) && type.symbol) { + ts.addRange(displayParts, ts.symbolToDisplayParts(typeChecker, type.symbol, enclosingDeclaration, /*meaning*/ undefined, 1 /* WriteTypeParametersOrArguments */)); } - addSignatureDisplayParts(signature, allSignatures, ts.TypeFormatFlags.WriteArrowStyleSignature); + addSignatureDisplayParts(signature, allSignatures, 8 /* WriteArrowStyleSignature */); break; default: // Just signature @@ -47360,24 +53244,24 @@ var ts; } } else if ((isNameOfFunctionDeclaration(location) && !(symbol.flags & 98304 /* Accessor */)) || - (location.kind === 121 /* ConstructorKeyword */ && location.parent.kind === 144 /* Constructor */)) { + (location.kind === 121 /* ConstructorKeyword */ && location.parent.kind === 148 /* Constructor */)) { // get the signature from the declaration and write it var functionDeclaration = location.parent; - var allSignatures = functionDeclaration.kind === 144 /* Constructor */ ? type.getConstructSignatures() : type.getCallSignatures(); + var allSignatures = functionDeclaration.kind === 148 /* Constructor */ ? type.getNonNullableType().getConstructSignatures() : type.getNonNullableType().getCallSignatures(); if (!typeChecker.isImplementationOfOverload(functionDeclaration)) { signature = typeChecker.getSignatureFromDeclaration(functionDeclaration); } else { signature = allSignatures[0]; } - if (functionDeclaration.kind === 144 /* Constructor */) { + if (functionDeclaration.kind === 148 /* Constructor */) { // show (constructor) Type(...) signature symbolKind = ScriptElementKind.constructorImplementationElement; addPrefixForAnyFunctionOrVar(type.symbol, symbolKind); } else { // (function/method) symbol(..signature) - addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 147 /* CallSignature */ && + addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 151 /* CallSignature */ && !(type.symbol.flags & 2048 /* TypeLiteral */ || type.symbol.flags & 4096 /* ObjectLiteral */) ? type.symbol : symbol, symbolKind); } addSignatureDisplayParts(signature, allSignatures); @@ -47385,8 +53269,8 @@ var ts; } } } - if (symbolFlags & 32 /* Class */ && !hasAddedSymbolInfo) { - if (ts.getDeclarationOfKind(symbol, 186 /* ClassExpression */)) { + if (symbolFlags & 32 /* Class */ && !hasAddedSymbolInfo && !isThisExpression) { + if (ts.getDeclarationOfKind(symbol, 192 /* ClassExpression */)) { // Special case for class expressions because we would like to indicate that // the class name is local to the class body (similar to function expression) // (local class) class @@ -47409,7 +53293,7 @@ var ts; } if (symbolFlags & 524288 /* TypeAlias */) { addNewLineIfDisplayPartsExist(); - displayParts.push(ts.keywordPart(132 /* TypeKeyword */)); + displayParts.push(ts.keywordPart(134 /* TypeKeyword */)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); writeTypeParametersOfSymbol(symbol, sourceFile); @@ -47430,7 +53314,7 @@ var ts; } if (symbolFlags & 1536 /* Module */) { addNewLineIfDisplayPartsExist(); - var declaration = ts.getDeclarationOfKind(symbol, 218 /* ModuleDeclaration */); + var declaration = ts.getDeclarationOfKind(symbol, 225 /* ModuleDeclaration */); var isNamespace = declaration && declaration.name && declaration.name.kind === 69 /* Identifier */; displayParts.push(ts.keywordPart(isNamespace ? 126 /* NamespaceKeyword */ : 125 /* ModuleKeyword */)); displayParts.push(ts.spacePart()); @@ -47453,35 +53337,37 @@ var ts; } else { // Method/function type parameter - var container = ts.getContainingFunction(location); - if (container) { - var signatureDeclaration = ts.getDeclarationOfKind(symbol, 137 /* TypeParameter */).parent; - var signature = typeChecker.getSignatureFromDeclaration(signatureDeclaration); - if (signatureDeclaration.kind === 148 /* ConstructSignature */) { - displayParts.push(ts.keywordPart(92 /* NewKeyword */)); + var declaration = ts.getDeclarationOfKind(symbol, 141 /* TypeParameter */); + ts.Debug.assert(declaration !== undefined); + declaration = declaration.parent; + if (declaration) { + if (ts.isFunctionLikeKind(declaration.kind)) { + var signature = typeChecker.getSignatureFromDeclaration(declaration); + if (declaration.kind === 152 /* ConstructSignature */) { + displayParts.push(ts.keywordPart(92 /* NewKeyword */)); + displayParts.push(ts.spacePart()); + } + else if (declaration.kind !== 151 /* CallSignature */ && declaration.name) { + addFullSymbolName(declaration.symbol); + } + ts.addRange(displayParts, ts.signatureToDisplayParts(typeChecker, signature, sourceFile, 32 /* WriteTypeArgumentsOfSignature */)); + } + else { + // Type alias type parameter + // For example + // type list = T[]; // Both T will go through same code path + displayParts.push(ts.keywordPart(134 /* TypeKeyword */)); displayParts.push(ts.spacePart()); + addFullSymbolName(declaration.symbol); + writeTypeParametersOfSymbol(declaration.symbol, sourceFile); } - else if (signatureDeclaration.kind !== 147 /* CallSignature */ && signatureDeclaration.name) { - addFullSymbolName(signatureDeclaration.symbol); - } - ts.addRange(displayParts, ts.signatureToDisplayParts(typeChecker, signature, sourceFile, 32 /* WriteTypeArgumentsOfSignature */)); - } - else { - // Type aliash type parameter - // For example - // type list = T[]; // Both T will go through same code path - var declaration = ts.getDeclarationOfKind(symbol, 137 /* TypeParameter */).parent; - displayParts.push(ts.keywordPart(132 /* TypeKeyword */)); - displayParts.push(ts.spacePart()); - addFullSymbolName(declaration.symbol); - writeTypeParametersOfSymbol(declaration.symbol, sourceFile); } } } if (symbolFlags & 8 /* EnumMember */) { addPrefixForAnyFunctionOrVar(symbol, "enum member"); var declaration = symbol.declarations[0]; - if (declaration.kind === 247 /* EnumMember */) { + if (declaration.kind === 255 /* EnumMember */) { var constantValue = typeChecker.getConstantValue(declaration); if (constantValue !== undefined) { displayParts.push(ts.spacePart()); @@ -47497,13 +53383,13 @@ var ts; displayParts.push(ts.spacePart()); addFullSymbolName(symbol); ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 221 /* ImportEqualsDeclaration */) { + if (declaration.kind === 229 /* ImportEqualsDeclaration */) { var importEqualsDeclaration = declaration; if (ts.isExternalModuleImportEqualsDeclaration(importEqualsDeclaration)) { displayParts.push(ts.spacePart()); displayParts.push(ts.operatorPart(56 /* EqualsToken */)); displayParts.push(ts.spacePart()); - displayParts.push(ts.keywordPart(127 /* RequireKeyword */)); + displayParts.push(ts.keywordPart(129 /* RequireKeyword */)); displayParts.push(ts.punctuationPart(17 /* OpenParenToken */)); displayParts.push(ts.displayPart(ts.getTextOfNode(ts.getExternalModuleImportEqualsDeclarationExpression(importEqualsDeclaration)), SymbolDisplayPartKind.stringLiteral)); displayParts.push(ts.punctuationPart(18 /* CloseParenToken */)); @@ -47524,11 +53410,18 @@ var ts; if (!hasAddedSymbolInfo) { if (symbolKind !== ScriptElementKind.unknown) { if (type) { - addPrefixForAnyFunctionOrVar(symbol, symbolKind); + if (isThisExpression) { + addNewLineIfDisplayPartsExist(); + displayParts.push(ts.keywordPart(97 /* ThisKeyword */)); + } + else { + addPrefixForAnyFunctionOrVar(symbol, symbolKind); + } // For properties, variables and local vars: show the type if (symbolKind === ScriptElementKind.memberVariableElement || symbolFlags & 3 /* Variable */ || - symbolKind === ScriptElementKind.localVariableElement) { + symbolKind === ScriptElementKind.localVariableElement || + isThisExpression) { displayParts.push(ts.punctuationPart(54 /* ColonToken */)); displayParts.push(ts.spacePart()); // If the type is type parameter, format it specially @@ -47548,7 +53441,7 @@ var ts; symbolFlags & 131072 /* Signature */ || symbolFlags & 98304 /* Accessor */ || symbolKind === ScriptElementKind.memberFunctionElement) { - var allSignatures = type.getCallSignatures(); + var allSignatures = type.getNonNullableType().getCallSignatures(); addSignatureDisplayParts(allSignatures[0], allSignatures); } } @@ -47618,7 +53511,7 @@ var ts; synchronizeHostData(); var sourceFile = getValidSourceFile(fileName); var node = ts.getTouchingPropertyName(sourceFile, position); - if (!node) { + if (node === sourceFile) { return undefined; } if (isLabelName(node)) { @@ -47626,13 +53519,14 @@ var ts; } var typeChecker = program.getTypeChecker(); var symbol = typeChecker.getSymbolAtLocation(node); - if (!symbol) { + if (!symbol || typeChecker.isUnknownSymbol(symbol)) { // Try getting just type at this position and show switch (node.kind) { case 69 /* Identifier */: - case 166 /* PropertyAccessExpression */: - case 135 /* QualifiedName */: + case 172 /* PropertyAccessExpression */: + case 139 /* QualifiedName */: case 97 /* ThisKeyword */: + case 165 /* ThisType */: case 95 /* SuperKeyword */: // For the identifiers/this/super etc get the type at position var type = typeChecker.getTypeAtLocation(node); @@ -47711,8 +53605,8 @@ var ts; var declarations = []; var definition; ts.forEach(signatureDeclarations, function (d) { - if ((selectConstructors && d.kind === 144 /* Constructor */) || - (!selectConstructors && (d.kind === 213 /* FunctionDeclaration */ || d.kind === 143 /* MethodDeclaration */ || d.kind === 142 /* MethodSignature */))) { + if ((selectConstructors && d.kind === 148 /* Constructor */) || + (!selectConstructors && (d.kind === 220 /* FunctionDeclaration */ || d.kind === 147 /* MethodDeclaration */ || d.kind === 146 /* MethodSignature */))) { declarations.push(d); if (d.body) definition = d; @@ -47729,12 +53623,49 @@ var ts; return false; } } + function findReferenceInPosition(refs, pos) { + for (var _i = 0, refs_1 = refs; _i < refs_1.length; _i++) { + var ref = refs_1[_i]; + if (ref.pos <= pos && pos < ref.end) { + return ref; + } + } + return undefined; + } + function getDefinitionInfoForFileReference(name, targetFileName) { + return { + fileName: targetFileName, + textSpan: ts.createTextSpanFromBounds(0, 0), + kind: ScriptElementKind.scriptElement, + name: name, + containerName: undefined, + containerKind: undefined + }; + } /// Goto definition function getDefinitionAtPosition(fileName, position) { synchronizeHostData(); var sourceFile = getValidSourceFile(fileName); + /// Triple slash reference comments + var comment = findReferenceInPosition(sourceFile.referencedFiles, position); + if (comment) { + var referenceFile = ts.tryResolveScriptReference(program, sourceFile, comment); + if (referenceFile) { + return [getDefinitionInfoForFileReference(comment.fileName, referenceFile.fileName)]; + } + return undefined; + } + // Type reference directives + var typeReferenceDirective = findReferenceInPosition(sourceFile.typeReferenceDirectives, position); + if (typeReferenceDirective) { + var referenceFile = ts.lookUp(program.getResolvedTypeReferenceDirectives(), typeReferenceDirective.fileName); + if (referenceFile && referenceFile.resolvedFileName) { + return [getDefinitionInfoForFileReference(typeReferenceDirective.fileName, referenceFile.resolvedFileName)]; + } + return undefined; + } var node = ts.getTouchingPropertyName(sourceFile, position); - if (!node) { + if (node === sourceFile) { return undefined; } // Labels @@ -47743,22 +53674,6 @@ var ts; var label = getTargetLabel(node.parent, node.text); return label ? [createDefinitionInfo(label, ScriptElementKind.label, labelName, /*containerName*/ undefined)] : undefined; } - /// Triple slash reference comments - var comment = ts.forEach(sourceFile.referencedFiles, function (r) { return (r.pos <= position && position < r.end) ? r : undefined; }); - if (comment) { - var referenceFile = ts.tryResolveScriptReference(program, sourceFile, comment); - if (referenceFile) { - return [{ - fileName: referenceFile.fileName, - textSpan: ts.createTextSpanFromBounds(0, 0), - kind: ScriptElementKind.scriptElement, - name: comment.fileName, - containerName: undefined, - containerKind: undefined - }]; - } - return undefined; - } var typeChecker = program.getTypeChecker(); var symbol = typeChecker.getSymbolAtLocation(node); // Could not find a symbol e.g. node is string or number keyword, @@ -47772,7 +53687,14 @@ var ts; // to jump to the implementation directly. if (symbol.flags & 8388608 /* Alias */) { var declaration = symbol.declarations[0]; - if (node.kind === 69 /* Identifier */ && node.parent === declaration) { + // Go to the original declaration for cases: + // + // (1) when the aliased symbol was declared in the location(parent). + // (2) when the aliased symbol is originating from a named import. + // + if (node.kind === 69 /* Identifier */ && + (node.parent === declaration || + (declaration.kind === 234 /* ImportSpecifier */ && declaration.parent && declaration.parent.kind === 233 /* NamedImports */))) { symbol = typeChecker.getAliasedSymbol(symbol); } } @@ -47781,16 +53703,16 @@ var ts; // go to the declaration of the property name (in this case stay at the same position). However, if go-to-definition // is performed at the location of property access, we would like to go to definition of the property in the short-hand // assignment. This case and others are handled by the following code. - if (node.parent.kind === 246 /* ShorthandPropertyAssignment */) { + if (node.parent.kind === 254 /* ShorthandPropertyAssignment */) { var shorthandSymbol = typeChecker.getShorthandAssignmentValueSymbol(symbol.valueDeclaration); if (!shorthandSymbol) { return []; } var shorthandDeclarations = shorthandSymbol.getDeclarations(); - var shorthandSymbolKind = getSymbolKind(shorthandSymbol, node); - var shorthandSymbolName = typeChecker.symbolToString(shorthandSymbol); - var shorthandContainerName = typeChecker.symbolToString(symbol.parent, node); - return ts.map(shorthandDeclarations, function (declaration) { return createDefinitionInfo(declaration, shorthandSymbolKind, shorthandSymbolName, shorthandContainerName); }); + var shorthandSymbolKind_1 = getSymbolKind(shorthandSymbol, node); + var shorthandSymbolName_1 = typeChecker.symbolToString(shorthandSymbol); + var shorthandContainerName_1 = typeChecker.symbolToString(symbol.parent, node); + return ts.map(shorthandDeclarations, function (declaration) { return createDefinitionInfo(declaration, shorthandSymbolKind_1, shorthandSymbolName_1, shorthandContainerName_1); }); } return getDefinitionFromSymbol(symbol, node); } @@ -47799,7 +53721,7 @@ var ts; synchronizeHostData(); var sourceFile = getValidSourceFile(fileName); var node = ts.getTouchingPropertyName(sourceFile, position); - if (!node) { + if (node === sourceFile) { return undefined; } var typeChecker = program.getTypeChecker(); @@ -47812,13 +53734,13 @@ var ts; return undefined; } if (type.flags & 16384 /* Union */) { - var result = []; + var result_3 = []; ts.forEach(type.types, function (t) { if (t.symbol) { - ts.addRange(/*to*/ result, /*from*/ getDefinitionFromSymbol(t.symbol, node)); + ts.addRange(/*to*/ result_3, /*from*/ getDefinitionFromSymbol(t.symbol, node)); } }); - return result; + return result_3; } if (!type.symbol) { return undefined; @@ -47828,10 +53750,10 @@ var ts; function getOccurrencesAtPosition(fileName, position) { var results = getOccurrencesAtPositionCore(fileName, position); if (results) { - var sourceFile = getCanonicalFileName(ts.normalizeSlashes(fileName)); + var sourceFile_2 = getCanonicalFileName(ts.normalizeSlashes(fileName)); // Get occurrences only supports reporting occurrences for the file queried. So // filter down to that list. - results = ts.filter(results, function (r) { return getCanonicalFileName(ts.normalizeSlashes(r.fileName)) === sourceFile; }); + results = ts.filter(results, function (r) { return getCanonicalFileName(ts.normalizeSlashes(r.fileName)) === sourceFile_2; }); } return results; } @@ -47857,10 +53779,11 @@ var ts; function getSemanticDocumentHighlights(node) { if (node.kind === 69 /* Identifier */ || node.kind === 97 /* ThisKeyword */ || + node.kind === 165 /* ThisType */ || node.kind === 95 /* SuperKeyword */ || - isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || - isNameOfExternalModuleImportOrDeclaration(node)) { - var referencedSymbols = getReferencedSymbolsForNode(node, sourceFilesToSearch, /*findInStrings:*/ false, /*findInComments:*/ false); + node.kind === 9 /* StringLiteral */ || + isLiteralNameOfPropertyDeclarationOrIndexAccess(node)) { + var referencedSymbols = getReferencedSymbolsForNode(node, sourceFilesToSearch, /*findInStrings*/ false, /*findInComments*/ false); return convertReferencedSymbols(referencedSymbols); } return undefined; @@ -47910,75 +53833,75 @@ var ts; switch (node.kind) { case 88 /* IfKeyword */: case 80 /* ElseKeyword */: - if (hasKind(node.parent, 196 /* IfStatement */)) { + if (hasKind(node.parent, 203 /* IfStatement */)) { return getIfElseOccurrences(node.parent); } break; case 94 /* ReturnKeyword */: - if (hasKind(node.parent, 204 /* ReturnStatement */)) { + if (hasKind(node.parent, 211 /* ReturnStatement */)) { return getReturnOccurrences(node.parent); } break; case 98 /* ThrowKeyword */: - if (hasKind(node.parent, 208 /* ThrowStatement */)) { + if (hasKind(node.parent, 215 /* ThrowStatement */)) { return getThrowOccurrences(node.parent); } break; case 72 /* CatchKeyword */: - if (hasKind(parent(parent(node)), 209 /* TryStatement */)) { + if (hasKind(parent(parent(node)), 216 /* TryStatement */)) { return getTryCatchFinallyOccurrences(node.parent.parent); } break; case 100 /* TryKeyword */: case 85 /* FinallyKeyword */: - if (hasKind(parent(node), 209 /* TryStatement */)) { + if (hasKind(parent(node), 216 /* TryStatement */)) { return getTryCatchFinallyOccurrences(node.parent); } break; case 96 /* SwitchKeyword */: - if (hasKind(node.parent, 206 /* SwitchStatement */)) { + if (hasKind(node.parent, 213 /* SwitchStatement */)) { return getSwitchCaseDefaultOccurrences(node.parent); } break; case 71 /* CaseKeyword */: case 77 /* DefaultKeyword */: - if (hasKind(parent(parent(parent(node))), 206 /* SwitchStatement */)) { + if (hasKind(parent(parent(parent(node))), 213 /* SwitchStatement */)) { return getSwitchCaseDefaultOccurrences(node.parent.parent.parent); } break; case 70 /* BreakKeyword */: case 75 /* ContinueKeyword */: - if (hasKind(node.parent, 203 /* BreakStatement */) || hasKind(node.parent, 202 /* ContinueStatement */)) { + if (hasKind(node.parent, 210 /* BreakStatement */) || hasKind(node.parent, 209 /* ContinueStatement */)) { return getBreakOrContinueStatementOccurrences(node.parent); } break; case 86 /* ForKeyword */: - if (hasKind(node.parent, 199 /* ForStatement */) || - hasKind(node.parent, 200 /* ForInStatement */) || - hasKind(node.parent, 201 /* ForOfStatement */)) { + if (hasKind(node.parent, 206 /* ForStatement */) || + hasKind(node.parent, 207 /* ForInStatement */) || + hasKind(node.parent, 208 /* ForOfStatement */)) { return getLoopBreakContinueOccurrences(node.parent); } break; case 104 /* WhileKeyword */: case 79 /* DoKeyword */: - if (hasKind(node.parent, 198 /* WhileStatement */) || hasKind(node.parent, 197 /* DoStatement */)) { + if (hasKind(node.parent, 205 /* WhileStatement */) || hasKind(node.parent, 204 /* DoStatement */)) { return getLoopBreakContinueOccurrences(node.parent); } break; case 121 /* ConstructorKeyword */: - if (hasKind(node.parent, 144 /* Constructor */)) { + if (hasKind(node.parent, 148 /* Constructor */)) { return getConstructorOccurrences(node.parent); } break; case 123 /* GetKeyword */: - case 129 /* SetKeyword */: - if (hasKind(node.parent, 145 /* GetAccessor */) || hasKind(node.parent, 146 /* SetAccessor */)) { + case 131 /* SetKeyword */: + if (hasKind(node.parent, 149 /* GetAccessor */) || hasKind(node.parent, 150 /* SetAccessor */)) { return getGetAndSetOccurrences(node.parent); } break; default: - if (ts.isModifier(node.kind) && node.parent && - (ts.isDeclaration(node.parent) || node.parent.kind === 193 /* VariableStatement */)) { + if (ts.isModifierKind(node.kind) && node.parent && + (ts.isDeclaration(node.parent) || node.parent.kind === 200 /* VariableStatement */)) { return getModifierOccurrences(node.kind, node.parent); } } @@ -47994,10 +53917,10 @@ var ts; aggregate(node); return statementAccumulator; function aggregate(node) { - if (node.kind === 208 /* ThrowStatement */) { + if (node.kind === 215 /* ThrowStatement */) { statementAccumulator.push(node); } - else if (node.kind === 209 /* TryStatement */) { + else if (node.kind === 216 /* TryStatement */) { var tryStatement = node; if (tryStatement.catchClause) { aggregate(tryStatement.catchClause); @@ -48024,19 +53947,19 @@ var ts; function getThrowStatementOwner(throwStatement) { var child = throwStatement; while (child.parent) { - var parent_12 = child.parent; - if (ts.isFunctionBlock(parent_12) || parent_12.kind === 248 /* SourceFile */) { - return parent_12; + var parent_19 = child.parent; + if (ts.isFunctionBlock(parent_19) || parent_19.kind === 256 /* SourceFile */) { + return parent_19; } // A throw-statement is only owned by a try-statement if the try-statement has // a catch clause, and if the throw-statement occurs within the try block. - if (parent_12.kind === 209 /* TryStatement */) { - var tryStatement = parent_12; + if (parent_19.kind === 216 /* TryStatement */) { + var tryStatement = parent_19; if (tryStatement.tryBlock === child && tryStatement.catchClause) { return child; } } - child = parent_12; + child = parent_19; } return undefined; } @@ -48045,7 +53968,7 @@ var ts; aggregate(node); return statementAccumulator; function aggregate(node) { - if (node.kind === 203 /* BreakStatement */ || node.kind === 202 /* ContinueStatement */) { + if (node.kind === 210 /* BreakStatement */ || node.kind === 209 /* ContinueStatement */) { statementAccumulator.push(node); } else if (!ts.isFunctionLike(node)) { @@ -48058,25 +53981,25 @@ var ts; return actualOwner && actualOwner === owner; } function getBreakOrContinueOwner(statement) { - for (var node_2 = statement.parent; node_2; node_2 = node_2.parent) { - switch (node_2.kind) { - case 206 /* SwitchStatement */: - if (statement.kind === 202 /* ContinueStatement */) { + for (var node_1 = statement.parent; node_1; node_1 = node_1.parent) { + switch (node_1.kind) { + case 213 /* SwitchStatement */: + if (statement.kind === 209 /* ContinueStatement */) { continue; } // Fall through. - case 199 /* ForStatement */: - case 200 /* ForInStatement */: - case 201 /* ForOfStatement */: - case 198 /* WhileStatement */: - case 197 /* DoStatement */: - if (!statement.label || isLabeledBy(node_2, statement.label.text)) { - return node_2; + case 206 /* ForStatement */: + case 207 /* ForInStatement */: + case 208 /* ForOfStatement */: + case 205 /* WhileStatement */: + case 204 /* DoStatement */: + if (!statement.label || isLabeledBy(node_1, statement.label.text)) { + return node_1; } break; default: // Don't cross function boundaries. - if (ts.isFunctionLike(node_2)) { + if (ts.isFunctionLike(node_1)) { return undefined; } break; @@ -48088,24 +54011,24 @@ var ts; var container = declaration.parent; // Make sure we only highlight the keyword when it makes sense to do so. if (ts.isAccessibilityModifier(modifier)) { - if (!(container.kind === 214 /* ClassDeclaration */ || - container.kind === 186 /* ClassExpression */ || - (declaration.kind === 138 /* Parameter */ && hasKind(container, 144 /* Constructor */)))) { + if (!(container.kind === 221 /* ClassDeclaration */ || + container.kind === 192 /* ClassExpression */ || + (declaration.kind === 142 /* Parameter */ && hasKind(container, 148 /* Constructor */)))) { return undefined; } } else if (modifier === 113 /* StaticKeyword */) { - if (!(container.kind === 214 /* ClassDeclaration */ || container.kind === 186 /* ClassExpression */)) { + if (!(container.kind === 221 /* ClassDeclaration */ || container.kind === 192 /* ClassExpression */)) { return undefined; } } else if (modifier === 82 /* ExportKeyword */ || modifier === 122 /* DeclareKeyword */) { - if (!(container.kind === 219 /* ModuleBlock */ || container.kind === 248 /* SourceFile */)) { + if (!(container.kind === 226 /* ModuleBlock */ || container.kind === 256 /* SourceFile */)) { return undefined; } } else if (modifier === 115 /* AbstractKeyword */) { - if (!(container.kind === 214 /* ClassDeclaration */ || declaration.kind === 214 /* ClassDeclaration */)) { + if (!(container.kind === 221 /* ClassDeclaration */ || declaration.kind === 221 /* ClassDeclaration */)) { return undefined; } } @@ -48117,8 +54040,8 @@ var ts; var modifierFlag = getFlagFromModifier(modifier); var nodes; switch (container.kind) { - case 219 /* ModuleBlock */: - case 248 /* SourceFile */: + case 226 /* ModuleBlock */: + case 256 /* SourceFile */: // Container is either a class declaration or the declaration is a classDeclaration if (modifierFlag & 128 /* Abstract */) { nodes = declaration.members.concat(declaration); @@ -48127,17 +54050,17 @@ var ts; nodes = container.statements; } break; - case 144 /* Constructor */: + case 148 /* Constructor */: nodes = container.parameters.concat(container.parent.members); break; - case 214 /* ClassDeclaration */: - case 186 /* ClassExpression */: + case 221 /* ClassDeclaration */: + case 192 /* ClassExpression */: nodes = container.members; // If we're an accessibility modifier, we're in an instance member and should search // the constructor's parameter list for instance members as well. - if (modifierFlag & 56 /* AccessibilityModifier */) { + if (modifierFlag & 28 /* AccessibilityModifier */) { var constructor = ts.forEach(container.members, function (member) { - return member.kind === 144 /* Constructor */ && member; + return member.kind === 148 /* Constructor */ && member; }); if (constructor) { nodes = nodes.concat(constructor.parameters); @@ -48159,17 +54082,17 @@ var ts; function getFlagFromModifier(modifier) { switch (modifier) { case 112 /* PublicKeyword */: - return 8 /* Public */; + return 4 /* Public */; case 110 /* PrivateKeyword */: - return 16 /* Private */; + return 8 /* Private */; case 111 /* ProtectedKeyword */: - return 32 /* Protected */; + return 16 /* Protected */; case 113 /* StaticKeyword */: - return 64 /* Static */; + return 32 /* Static */; case 82 /* ExportKeyword */: - return 2 /* Export */; + return 1 /* Export */; case 122 /* DeclareKeyword */: - return 4 /* Ambient */; + return 2 /* Ambient */; case 115 /* AbstractKeyword */: return 128 /* Abstract */; default: @@ -48190,13 +54113,13 @@ var ts; } function getGetAndSetOccurrences(accessorDeclaration) { var keywords = []; - tryPushAccessorKeyword(accessorDeclaration.symbol, 145 /* GetAccessor */); - tryPushAccessorKeyword(accessorDeclaration.symbol, 146 /* SetAccessor */); + tryPushAccessorKeyword(accessorDeclaration.symbol, 149 /* GetAccessor */); + tryPushAccessorKeyword(accessorDeclaration.symbol, 150 /* SetAccessor */); return ts.map(keywords, getHighlightSpanForNode); function tryPushAccessorKeyword(accessorSymbol, accessorKind) { var accessor = ts.getDeclarationOfKind(accessorSymbol, accessorKind); if (accessor) { - ts.forEach(accessor.getChildren(), function (child) { return pushKeywordIf(keywords, child, 123 /* GetKeyword */, 129 /* SetKeyword */); }); + ts.forEach(accessor.getChildren(), function (child) { return pushKeywordIf(keywords, child, 123 /* GetKeyword */, 131 /* SetKeyword */); }); } } } @@ -48214,7 +54137,7 @@ var ts; var keywords = []; if (pushKeywordIf(keywords, loopNode.getFirstToken(), 86 /* ForKeyword */, 104 /* WhileKeyword */, 79 /* DoKeyword */)) { // If we succeeded and got a do-while loop, then start looking for a 'while' keyword. - if (loopNode.kind === 197 /* DoStatement */) { + if (loopNode.kind === 204 /* DoStatement */) { var loopTokens = loopNode.getChildren(); for (var i = loopTokens.length - 1; i >= 0; i--) { if (pushKeywordIf(keywords, loopTokens[i], 104 /* WhileKeyword */)) { @@ -48235,13 +54158,13 @@ var ts; var owner = getBreakOrContinueOwner(breakOrContinueStatement); if (owner) { switch (owner.kind) { - case 199 /* ForStatement */: - case 200 /* ForInStatement */: - case 201 /* ForOfStatement */: - case 197 /* DoStatement */: - case 198 /* WhileStatement */: + case 206 /* ForStatement */: + case 207 /* ForInStatement */: + case 208 /* ForOfStatement */: + case 204 /* DoStatement */: + case 205 /* WhileStatement */: return getLoopBreakContinueOccurrences(owner); - case 206 /* SwitchStatement */: + case 213 /* SwitchStatement */: return getSwitchCaseDefaultOccurrences(owner); } } @@ -48295,7 +54218,7 @@ var ts; function getReturnOccurrences(returnStatement) { var func = ts.getContainingFunction(returnStatement); // If we didn't find a containing function with a block body, bail out. - if (!(func && hasKind(func.body, 192 /* Block */))) { + if (!(func && hasKind(func.body, 199 /* Block */))) { return undefined; } var keywords = []; @@ -48311,7 +54234,7 @@ var ts; function getIfElseOccurrences(ifStatement) { var keywords = []; // Traverse upwards through all parent if-statements linked by their else-branches. - while (hasKind(ifStatement.parent, 196 /* IfStatement */) && ifStatement.parent.elseStatement === ifStatement) { + while (hasKind(ifStatement.parent, 203 /* IfStatement */) && ifStatement.parent.elseStatement === ifStatement) { ifStatement = ifStatement.parent; } // Now traverse back down through the else branches, aggregating if/else keywords of if-statements. @@ -48324,7 +54247,7 @@ var ts; break; } } - if (!hasKind(ifStatement.elseStatement, 196 /* IfStatement */)) { + if (!hasKind(ifStatement.elseStatement, 203 /* IfStatement */)) { break; } ifStatement = ifStatement.elseStatement; @@ -48400,11 +54323,11 @@ var ts; return convertReferences(referencedSymbols); } function getReferencesAtPosition(fileName, position) { - var referencedSymbols = findReferencedSymbols(fileName, position, /*findInStrings:*/ false, /*findInComments:*/ false); + var referencedSymbols = findReferencedSymbols(fileName, position, /*findInStrings*/ false, /*findInComments*/ false); return convertReferences(referencedSymbols); } function findReferences(fileName, position) { - var referencedSymbols = findReferencedSymbols(fileName, position, /*findInStrings:*/ false, /*findInComments:*/ false); + var referencedSymbols = findReferencedSymbols(fileName, position, /*findInStrings*/ false, /*findInComments*/ false); // Only include referenced symbols that have a valid definition. return ts.filter(referencedSymbols, function (rs) { return !!rs.definition; }); } @@ -48412,15 +54335,15 @@ var ts; synchronizeHostData(); var sourceFile = getValidSourceFile(fileName); var node = ts.getTouchingPropertyName(sourceFile, position); - if (!node) { + if (node === sourceFile) { return undefined; } if (node.kind !== 69 /* Identifier */ && // TODO (drosen): This should be enabled in a later release - currently breaks rename. - //node.kind !== SyntaxKind.ThisKeyword && - //node.kind !== SyntaxKind.SuperKeyword && - !isLiteralNameOfPropertyDeclarationOrIndexAccess(node) && - !isNameOfExternalModuleImportOrDeclaration(node)) { + // node.kind !== SyntaxKind.ThisKeyword && + // node.kind !== SyntaxKind.SuperKeyword && + node.kind !== 9 /* StringLiteral */ && + !isLiteralNameOfPropertyDeclarationOrIndexAccess(node)) { return undefined; } ts.Debug.assert(node.kind === 69 /* Identifier */ || node.kind === 8 /* NumericLiteral */ || node.kind === 9 /* StringLiteral */); @@ -48441,13 +54364,16 @@ var ts; return getLabelReferencesInNode(node.parent, node); } } - if (node.kind === 97 /* ThisKeyword */) { + if (node.kind === 97 /* ThisKeyword */ || node.kind === 165 /* ThisType */) { return getReferencesForThisKeyword(node, sourceFiles); } if (node.kind === 95 /* SuperKeyword */) { return getReferencesForSuperKeyword(node); } var symbol = typeChecker.getSymbolAtLocation(node); + if (!symbol && node.kind === 9 /* StringLiteral */) { + return getReferencesForStringLiteral(node, sourceFiles); + } // Could not find a symbol e.g. unknown identifier if (!symbol) { // Can't have references to something that we have no symbol for. @@ -48475,11 +54401,11 @@ var ts; } else { var internedName = getInternedName(symbol, node, declarations); - for (var _i = 0, sourceFiles_2 = sourceFiles; _i < sourceFiles_2.length; _i++) { - var sourceFile = sourceFiles_2[_i]; + for (var _i = 0, sourceFiles_4 = sourceFiles; _i < sourceFiles_4.length; _i++) { + var sourceFile = sourceFiles_4[_i]; cancellationToken.throwIfCancellationRequested(); var nameTable = getNameTable(sourceFile); - if (ts.lookUp(nameTable, internedName)) { + if (ts.lookUp(nameTable, internedName) !== undefined) { result = result || []; getReferencesInNode(sourceFile, symbol, declaredName, node, searchMeaning, findInStrings, findInComments, result, symbolToIndex); } @@ -48502,10 +54428,46 @@ var ts; textSpan: ts.createTextSpan(declarations[0].getStart(), 0) }; } - function isImportOrExportSpecifierImportSymbol(symbol) { - return (symbol.flags & 8388608 /* Alias */) && ts.forEach(symbol.declarations, function (declaration) { - return declaration.kind === 226 /* ImportSpecifier */ || declaration.kind === 230 /* ExportSpecifier */; - }); + function getAliasSymbolForPropertyNameSymbol(symbol, location) { + if (symbol.flags & 8388608 /* Alias */) { + // Default import get alias + var defaultImport = ts.getDeclarationOfKind(symbol, 231 /* ImportClause */); + if (defaultImport) { + return typeChecker.getAliasedSymbol(symbol); + } + var importOrExportSpecifier = ts.forEach(symbol.declarations, function (declaration) { return (declaration.kind === 234 /* ImportSpecifier */ || + declaration.kind === 238 /* ExportSpecifier */) ? declaration : undefined; }); + if (importOrExportSpecifier && + // export { a } + (!importOrExportSpecifier.propertyName || + // export {a as class } where a is location + importOrExportSpecifier.propertyName === location)) { + // If Import specifier -> get alias + // else Export specifier -> get local target + return importOrExportSpecifier.kind === 234 /* ImportSpecifier */ ? + typeChecker.getAliasedSymbol(symbol) : + typeChecker.getExportSpecifierLocalTargetSymbol(importOrExportSpecifier); + } + } + return undefined; + } + function getPropertySymbolOfDestructuringAssignment(location) { + return ts.isArrayLiteralOrObjectLiteralDestructuringPattern(location.parent.parent) && + typeChecker.getPropertySymbolOfDestructuringAssignment(location); + } + function isObjectBindingPatternElementWithoutPropertyName(symbol) { + var bindingElement = ts.getDeclarationOfKind(symbol, 169 /* BindingElement */); + return bindingElement && + bindingElement.parent.kind === 167 /* ObjectBindingPattern */ && + !bindingElement.propertyName; + } + function getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol) { + if (isObjectBindingPatternElementWithoutPropertyName(symbol)) { + var bindingElement = ts.getDeclarationOfKind(symbol, 169 /* BindingElement */); + var typeOfPattern = typeChecker.getTypeAtLocation(bindingElement.parent); + return typeOfPattern && typeChecker.getPropertyOfType(typeOfPattern, bindingElement.name.text); + } + return undefined; } function getInternedName(symbol, location, declarations) { // If this is an export or import specifier it could have been renamed using the 'as' syntax. @@ -48531,31 +54493,36 @@ var ts; // If this is the symbol of a named function expression or named class expression, // then named references are limited to its own scope. var valueDeclaration = symbol.valueDeclaration; - if (valueDeclaration && (valueDeclaration.kind === 173 /* FunctionExpression */ || valueDeclaration.kind === 186 /* ClassExpression */)) { + if (valueDeclaration && (valueDeclaration.kind === 179 /* FunctionExpression */ || valueDeclaration.kind === 192 /* ClassExpression */)) { return valueDeclaration; } // If this is private property or method, the scope is the containing class if (symbol.flags & (4 /* Property */ | 8192 /* Method */)) { - var privateDeclaration = ts.forEach(symbol.getDeclarations(), function (d) { return (d.flags & 16 /* Private */) ? d : undefined; }); + var privateDeclaration = ts.forEach(symbol.getDeclarations(), function (d) { return (d.flags & 8 /* Private */) ? d : undefined; }); if (privateDeclaration) { - return ts.getAncestor(privateDeclaration, 214 /* ClassDeclaration */); + return ts.getAncestor(privateDeclaration, 221 /* ClassDeclaration */); } } // If the symbol is an import we would like to find it if we are looking for what it imports. - // So consider it visibile outside its declaration scope. + // So consider it visible outside its declaration scope. if (symbol.flags & 8388608 /* Alias */) { return undefined; } + // If symbol is of object binding pattern element without property name we would want to + // look for property too and that could be anywhere + if (isObjectBindingPatternElementWithoutPropertyName(symbol)) { + return undefined; + } // if this symbol is visible from its parent container, e.g. exported, then bail out // if symbol correspond to the union property - bail out if (symbol.parent || (symbol.flags & 268435456 /* SyntheticProperty */)) { return undefined; } - var scope = undefined; + var scope; var declarations = symbol.getDeclarations(); if (declarations) { - for (var _i = 0, declarations_8 = declarations; _i < declarations_8.length; _i++) { - var declaration = declarations_8[_i]; + for (var _i = 0, declarations_9 = declarations; _i < declarations_9.length; _i++) { + var declaration = declarations_9[_i]; var container = getContainerNode(declaration); if (!container) { return undefined; @@ -48564,7 +54531,7 @@ var ts; // Different declarations have different containers, bail out return undefined; } - if (container.kind === 248 /* SourceFile */ && !ts.isExternalModule(container)) { + if (container.kind === 256 /* SourceFile */ && !ts.isExternalModule(container)) { // This is a global variable and not an external module, any declaration defined // within this scope is visible outside the file return undefined; @@ -48663,7 +54630,7 @@ var ts; var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, searchText, container.getStart(), container.getEnd()); if (possiblePositions.length) { // Build the set of symbols to search for, initially it has only the current symbol - var searchSymbols = populateSearchSymbolSet(searchSymbol, searchLocation); + var searchSymbols_1 = populateSearchSymbolSet(searchSymbol, searchLocation); ts.forEach(possiblePositions, function (position) { cancellationToken.throwIfCancellationRequested(); var referenceLocation = ts.getTouchingPropertyName(sourceFile, position); @@ -48695,12 +54662,12 @@ var ts; if (referenceSymbol) { var referenceSymbolDeclaration = referenceSymbol.valueDeclaration; var shorthandValueSymbol = typeChecker.getShorthandAssignmentValueSymbol(referenceSymbolDeclaration); - var relatedSymbol = getRelatedSymbol(searchSymbols, referenceSymbol, referenceLocation); + var relatedSymbol = getRelatedSymbol(searchSymbols_1, referenceSymbol, referenceLocation); if (relatedSymbol) { var referencedSymbol = getReferencedSymbol(relatedSymbol); referencedSymbol.references.push(getReferenceEntryFromNode(referenceLocation)); } - else if (!(referenceSymbol.flags & 67108864 /* Transient */) && searchSymbols.indexOf(shorthandValueSymbol) >= 0) { + else if (!(referenceSymbol.flags & 67108864 /* Transient */) && searchSymbols_1.indexOf(shorthandValueSymbol) >= 0) { var referencedSymbol = getReferencedSymbol(shorthandValueSymbol); referencedSymbol.references.push(getReferenceEntryFromNode(referenceSymbolDeclaration.name)); } @@ -48730,20 +54697,20 @@ var ts; } } function getReferencesForSuperKeyword(superKeyword) { - var searchSpaceNode = ts.getSuperContainer(superKeyword, /*includeFunctions*/ false); + var searchSpaceNode = ts.getSuperContainer(superKeyword, /*stopOnFunctions*/ false); if (!searchSpaceNode) { return undefined; } // Whether 'super' occurs in a static context within a class. - var staticFlag = 64 /* Static */; + var staticFlag = 32 /* Static */; switch (searchSpaceNode.kind) { - case 141 /* PropertyDeclaration */: - case 140 /* PropertySignature */: - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - case 144 /* Constructor */: - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: + case 145 /* PropertyDeclaration */: + case 144 /* PropertySignature */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: + case 148 /* Constructor */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: staticFlag &= searchSpaceNode.flags; searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class break; @@ -48759,11 +54726,11 @@ var ts; if (!node || node.kind !== 95 /* SuperKeyword */) { return; } - var container = ts.getSuperContainer(node, /*includeFunctions*/ false); + var container = ts.getSuperContainer(node, /*stopOnFunctions*/ false); // If we have a 'super' container, we must have an enclosing class. // Now make sure the owning class is the same as the search-space // and has the same static qualifier as the original 'super's owner. - if (container && (64 /* Static */ & container.flags) === staticFlag && container.parent.symbol === searchSpaceNode.symbol) { + if (container && (32 /* Static */ & container.flags) === staticFlag && container.parent.symbol === searchSpaceNode.symbol) { references.push(getReferenceEntryFromNode(node)); } }); @@ -48773,29 +54740,29 @@ var ts; function getReferencesForThisKeyword(thisOrSuperKeyword, sourceFiles) { var searchSpaceNode = ts.getThisContainer(thisOrSuperKeyword, /* includeArrowFunctions */ false); // Whether 'this' occurs in a static context within a class. - var staticFlag = 64 /* Static */; + var staticFlag = 32 /* Static */; switch (searchSpaceNode.kind) { - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: if (ts.isObjectLiteralMethod(searchSpaceNode)) { break; } // fall through - case 141 /* PropertyDeclaration */: - case 140 /* PropertySignature */: - case 144 /* Constructor */: - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: + case 145 /* PropertyDeclaration */: + case 144 /* PropertySignature */: + case 148 /* Constructor */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: staticFlag &= searchSpaceNode.flags; searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class break; - case 248 /* SourceFile */: + case 256 /* SourceFile */: if (ts.isExternalModule(searchSpaceNode)) { return undefined; } // Fall through - case 213 /* FunctionDeclaration */: - case 173 /* FunctionExpression */: + case 220 /* FunctionDeclaration */: + case 179 /* FunctionExpression */: break; // Computed properties in classes are not handled here because references to this are illegal, // so there is no point finding references to them. @@ -48804,7 +54771,7 @@ var ts; } var references = []; var possiblePositions; - if (searchSpaceNode.kind === 248 /* SourceFile */) { + if (searchSpaceNode.kind === 256 /* SourceFile */) { ts.forEach(sourceFiles, function (sourceFile) { possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", sourceFile.getStart(), sourceFile.getEnd()); getThisReferencesInFile(sourceFile, sourceFile, possiblePositions, references); @@ -48830,33 +54797,33 @@ var ts; ts.forEach(possiblePositions, function (position) { cancellationToken.throwIfCancellationRequested(); var node = ts.getTouchingWord(sourceFile, position); - if (!node || node.kind !== 97 /* ThisKeyword */) { + if (!node || (node.kind !== 97 /* ThisKeyword */ && node.kind !== 165 /* ThisType */)) { return; } var container = ts.getThisContainer(node, /* includeArrowFunctions */ false); switch (searchSpaceNode.kind) { - case 173 /* FunctionExpression */: - case 213 /* FunctionDeclaration */: + case 179 /* FunctionExpression */: + case 220 /* FunctionDeclaration */: if (searchSpaceNode.symbol === container.symbol) { result.push(getReferenceEntryFromNode(node)); } break; - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: if (ts.isObjectLiteralMethod(searchSpaceNode) && searchSpaceNode.symbol === container.symbol) { result.push(getReferenceEntryFromNode(node)); } break; - case 186 /* ClassExpression */: - case 214 /* ClassDeclaration */: + case 192 /* ClassExpression */: + case 221 /* ClassDeclaration */: // Make sure the container belongs to the same class // and has the appropriate static modifier from the original container. - if (container.parent && searchSpaceNode.symbol === container.parent.symbol && (container.flags & 64 /* Static */) === staticFlag) { + if (container.parent && searchSpaceNode.symbol === container.parent.symbol && (container.flags & 32 /* Static */) === staticFlag) { result.push(getReferenceEntryFromNode(node)); } break; - case 248 /* SourceFile */: - if (container.kind === 248 /* SourceFile */ && !ts.isExternalModule(container)) { + case 256 /* SourceFile */: + if (container.kind === 256 /* SourceFile */ && !ts.isExternalModule(container)) { result.push(getReferenceEntryFromNode(node)); } break; @@ -48864,18 +54831,78 @@ var ts; }); } } + function getReferencesForStringLiteral(node, sourceFiles) { + var typeChecker = program.getTypeChecker(); + var type = getStringLiteralTypeForNode(node, typeChecker); + if (!type) { + // nothing to do here. moving on + return undefined; + } + var references = []; + for (var _i = 0, sourceFiles_5 = sourceFiles; _i < sourceFiles_5.length; _i++) { + var sourceFile = sourceFiles_5[_i]; + var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, type.text, sourceFile.getStart(), sourceFile.getEnd()); + getReferencesForStringLiteralInFile(sourceFile, type, possiblePositions, references); + } + return [{ + definition: { + containerKind: "", + containerName: "", + fileName: node.getSourceFile().fileName, + kind: ScriptElementKind.variableElement, + name: type.text, + textSpan: ts.createTextSpanFromBounds(node.getStart(), node.getEnd()) + }, + references: references + }]; + function getReferencesForStringLiteralInFile(sourceFile, searchType, possiblePositions, references) { + for (var _i = 0, possiblePositions_1 = possiblePositions; _i < possiblePositions_1.length; _i++) { + var position = possiblePositions_1[_i]; + cancellationToken.throwIfCancellationRequested(); + var node_2 = ts.getTouchingWord(sourceFile, position); + if (!node_2 || node_2.kind !== 9 /* StringLiteral */) { + return; + } + var type_1 = getStringLiteralTypeForNode(node_2, typeChecker); + if (type_1 === searchType) { + references.push(getReferenceEntryFromNode(node_2)); + } + } + } + } function populateSearchSymbolSet(symbol, location) { // The search set contains at least the current symbol var result = [symbol]; - // If the symbol is an alias, add what it alaises to the list - if (isImportOrExportSpecifierImportSymbol(symbol)) { - result.push(typeChecker.getAliasedSymbol(symbol)); + // If the location is name of property symbol from object literal destructuring pattern + // Search the property symbol + // for ( { property: p2 } of elems) { } + var containingObjectLiteralElement = getContainingObjectLiteralElement(location); + if (containingObjectLiteralElement && containingObjectLiteralElement.kind !== 254 /* ShorthandPropertyAssignment */) { + var propertySymbol = getPropertySymbolOfDestructuringAssignment(location); + if (propertySymbol) { + result.push(propertySymbol); + } + } + // If the symbol is an alias, add what it aliases to the list + // import {a} from "mod"; + // export {a} + // If the symbol is an alias to default declaration, add what it aliases to the list + // declare "mod" { export default class B { } } + // import B from "mod"; + //// For export specifiers, the exported name can be referring to a local symbol, e.g.: + //// import {a} from "mod"; + //// export {a as somethingElse} + //// We want the *local* declaration of 'a' as declared in the import, + //// *not* as declared within "mod" (or farther) + var aliasSymbol = getAliasSymbolForPropertyNameSymbol(symbol, location); + if (aliasSymbol) { + result = result.concat(populateSearchSymbolSet(aliasSymbol, location)); } // If the location is in a context sensitive location (i.e. in an object literal) try // to get a contextual type for it, and add the property symbol from the contextual // type to the search set - if (isNameOfPropertyAssignment(location)) { - ts.forEach(getPropertySymbolsFromContextualType(location), function (contextualSymbol) { + if (containingObjectLiteralElement) { + ts.forEach(getPropertySymbolsFromContextualType(containingObjectLiteralElement), function (contextualSymbol) { ts.addRange(result, typeChecker.getRootSymbols(contextualSymbol)); }); /* Because in short-hand property assignment, location has two meaning : property name and as value of the property @@ -48883,8 +54910,8 @@ var ts; * property name and variable declaration of the identifier. * Like in below example, when querying for all references for an identifier 'name', of the property assignment, the language service * should show both 'name' in 'obj' and 'name' in variable declaration - * let name = "Foo"; - * let obj = { name }; + * const name = "Foo"; + * const obj = { name }; * In order to do that, we will populate the search set with the value symbol of the identifier as a value of the property assignment * so that when matching with potential reference symbol, both symbols from property declaration and variable declaration * will be included correctly. @@ -48894,6 +54921,20 @@ var ts; result.push(shorthandValueSymbol); } } + // If the symbol.valueDeclaration is a property parameter declaration, + // we should include both parameter declaration symbol and property declaration symbol + // Parameter Declaration symbol is only visible within function scope, so the symbol is stored in constructor.locals. + // Property Declaration symbol is a member of the class, so the symbol is stored in its class Declaration.symbol.members + if (symbol.valueDeclaration && symbol.valueDeclaration.kind === 142 /* Parameter */ && + ts.isParameterPropertyDeclaration(symbol.valueDeclaration)) { + result = result.concat(typeChecker.getSymbolsOfParameterPropertyDeclaration(symbol.valueDeclaration, symbol.name)); + } + // If this is symbol of binding element without propertyName declaration in Object binding pattern + // Include the property in the search + var bindingElementPropertySymbol = getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol); + if (bindingElementPropertySymbol) { + result.push(bindingElementPropertySymbol); + } // If this is a union property, add all the symbols from all its source symbols in all unioned types. // If the symbol is an instantiation from a another symbol (e.g. widened symbol) , add the root the list ts.forEach(typeChecker.getRootSymbols(symbol), function (rootSymbol) { @@ -48902,19 +54943,44 @@ var ts; } // Add symbol of properties/methods of the same name in base classes and implemented interfaces definitions if (rootSymbol.parent && rootSymbol.parent.flags & (32 /* Class */ | 64 /* Interface */)) { - getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result); + getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result, /*previousIterationSymbolsCache*/ {}); } }); return result; } - function getPropertySymbolsFromBaseTypes(symbol, propertyName, result) { - if (symbol && symbol.flags & (32 /* Class */ | 64 /* Interface */)) { + /** + * Find symbol of the given property-name and add the symbol to the given result array + * @param symbol a symbol to start searching for the given propertyName + * @param propertyName a name of property to search for + * @param result an array of symbol of found property symbols + * @param previousIterationSymbolsCache a cache of symbol from previous iterations of calling this function to prevent infinite revisiting of the same symbol. + * The value of previousIterationSymbol is undefined when the function is first called. + */ + function getPropertySymbolsFromBaseTypes(symbol, propertyName, result, previousIterationSymbolsCache) { + if (!symbol) { + return; + } + // If the current symbol is the same as the previous-iteration symbol, we can just return the symbol that has already been visited + // This is particularly important for the following cases, so that we do not infinitely visit the same symbol. + // For example: + // interface C extends C { + // /*findRef*/propName: string; + // } + // The first time getPropertySymbolsFromBaseTypes is called when finding-all-references at propName, + // the symbol argument will be the symbol of an interface "C" and previousIterationSymbol is undefined, + // the function will add any found symbol of the property-name, then its sub-routine will call + // getPropertySymbolsFromBaseTypes again to walk up any base types to prevent revisiting already + // visited symbol, interface "C", the sub-routine will pass the current symbol as previousIterationSymbol. + if (ts.hasProperty(previousIterationSymbolsCache, symbol.name)) { + return; + } + if (symbol.flags & (32 /* Class */ | 64 /* Interface */)) { ts.forEach(symbol.getDeclarations(), function (declaration) { - if (declaration.kind === 214 /* ClassDeclaration */) { + if (ts.isClassLike(declaration)) { getPropertySymbolFromTypeReference(ts.getClassExtendsHeritageClauseElement(declaration)); ts.forEach(ts.getClassImplementsHeritageClauseElements(declaration), getPropertySymbolFromTypeReference); } - else if (declaration.kind === 215 /* InterfaceDeclaration */) { + else if (declaration.kind === 222 /* InterfaceDeclaration */) { ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), getPropertySymbolFromTypeReference); } }); @@ -48926,10 +54992,11 @@ var ts; if (type) { var propertySymbol = typeChecker.getPropertyOfType(type, propertyName); if (propertySymbol) { - result.push(propertySymbol); + result.push.apply(result, typeChecker.getRootSymbols(propertySymbol)); } // Visit the typeReference as well to see if it directly or indirectly use that property - getPropertySymbolsFromBaseTypes(type.symbol, propertyName, result); + previousIterationSymbolsCache[symbol.name] = symbol; + getPropertySymbolsFromBaseTypes(type.symbol, propertyName, result, previousIterationSymbolsCache); } } } @@ -48939,20 +55006,37 @@ var ts; return referenceSymbol; } // If the reference symbol is an alias, check if what it is aliasing is one of the search - // symbols. - if (isImportOrExportSpecifierImportSymbol(referenceSymbol)) { - var aliasedSymbol = typeChecker.getAliasedSymbol(referenceSymbol); - if (searchSymbols.indexOf(aliasedSymbol) >= 0) { - return aliasedSymbol; - } + // symbols but by looking up for related symbol of this alias so it can handle multiple level of indirectness. + var aliasSymbol = getAliasSymbolForPropertyNameSymbol(referenceSymbol, referenceLocation); + if (aliasSymbol) { + return getRelatedSymbol(searchSymbols, aliasSymbol, referenceLocation); } // If the reference location is in an object literal, try to get the contextual type for the // object literal, lookup the property symbol in the contextual type, and use this symbol to // compare to our searchSymbol - if (isNameOfPropertyAssignment(referenceLocation)) { - return ts.forEach(getPropertySymbolsFromContextualType(referenceLocation), function (contextualSymbol) { + var containingObjectLiteralElement = getContainingObjectLiteralElement(referenceLocation); + if (containingObjectLiteralElement) { + var contextualSymbol = ts.forEach(getPropertySymbolsFromContextualType(containingObjectLiteralElement), function (contextualSymbol) { return ts.forEach(typeChecker.getRootSymbols(contextualSymbol), function (s) { return searchSymbols.indexOf(s) >= 0 ? s : undefined; }); }); + if (contextualSymbol) { + return contextualSymbol; + } + // If the reference location is the name of property from object literal destructuring pattern + // Get the property symbol from the object literal's type and look if thats the search symbol + // In below eg. get 'property' from type of elems iterating type + // for ( { property: p2 } of elems) { } + var propertySymbol = getPropertySymbolOfDestructuringAssignment(referenceLocation); + if (propertySymbol && searchSymbols.indexOf(propertySymbol) >= 0) { + return propertySymbol; + } + } + // If the reference location is the binding element and doesn't have property name + // then include the binding element in the related symbols + // let { a } : { a }; + var bindingElementPropertySymbol = getPropertySymbolOfObjectBindingPatternWithoutPropertyName(referenceSymbol); + if (bindingElementPropertySymbol && searchSymbols.indexOf(bindingElementPropertySymbol) >= 0) { + return bindingElementPropertySymbol; } // Unwrap symbols to get to the root (e.g. transient symbols as a result of widening) // Or a union property, use its underlying unioned symbols @@ -48964,44 +55048,43 @@ var ts; // Finally, try all properties with the same name in any type the containing type extended or implemented, and // see if any is in the list if (rootSymbol.parent && rootSymbol.parent.flags & (32 /* Class */ | 64 /* Interface */)) { - var result_3 = []; - getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result_3); - return ts.forEach(result_3, function (s) { return searchSymbols.indexOf(s) >= 0 ? s : undefined; }); + var result_4 = []; + getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result_4, /*previousIterationSymbolsCache*/ {}); + return ts.forEach(result_4, function (s) { return searchSymbols.indexOf(s) >= 0 ? s : undefined; }); } return undefined; }); } - function getPropertySymbolsFromContextualType(node) { - if (isNameOfPropertyAssignment(node)) { - var objectLiteral = node.parent.parent; - var contextualType = typeChecker.getContextualType(objectLiteral); - var name_37 = node.text; - if (contextualType) { - if (contextualType.flags & 16384 /* Union */) { - // This is a union type, first see if the property we are looking for is a union property (i.e. exists in all types) - // if not, search the constituent types for the property - var unionProperty = contextualType.getProperty(name_37); - if (unionProperty) { - return [unionProperty]; - } - else { - var result_4 = []; - ts.forEach(contextualType.types, function (t) { - var symbol = t.getProperty(name_37); - if (symbol) { - result_4.push(symbol); - } - }); - return result_4; - } - } - else { - var symbol_1 = contextualType.getProperty(name_37); - if (symbol_1) { - return [symbol_1]; - } - } + function getNameFromObjectLiteralElement(node) { + if (node.name.kind === 140 /* ComputedPropertyName */) { + var nameExpression = node.name.expression; + // treat computed property names where expression is string/numeric literal as just string/numeric literal + if (ts.isStringOrNumericLiteral(nameExpression.kind)) { + return nameExpression.text; } + return undefined; + } + return node.name.text; + } + function getPropertySymbolsFromContextualType(node) { + var objectLiteral = node.parent; + var contextualType = typeChecker.getContextualType(objectLiteral); + var name = getNameFromObjectLiteralElement(node); + if (name && contextualType) { + var result_5 = []; + var symbol_1 = contextualType.getProperty(name); + if (symbol_1) { + result_5.push(symbol_1); + } + if (contextualType.flags & 16384 /* Union */) { + ts.forEach(contextualType.types, function (t) { + var symbol = t.getProperty(name); + if (symbol) { + result_5.push(symbol); + } + }); + } + return result_5; } return undefined; } @@ -49014,7 +55097,7 @@ var ts; */ function getIntersectingMeaningFromDeclarations(meaning, declarations) { if (declarations) { - var lastIterationMeaning; + var lastIterationMeaning = void 0; do { // The result is order-sensitive, for instance if initialMeaning === Namespace, and declarations = [class, instantiated module] // we need to consider both as they initialMeaning intersects with the module in the namespace space, and the module @@ -49022,8 +55105,8 @@ var ts; // To achieve that we will keep iterating until the result stabilizes. // Remember the last meaning lastIterationMeaning = meaning; - for (var _i = 0, declarations_9 = declarations; _i < declarations_9.length; _i++) { - var declaration = declarations_9[_i]; + for (var _i = 0, declarations_10 = declarations; _i < declarations_10.length; _i++) { + var declaration = declarations_10[_i]; var declarationMeaning = getMeaningFromDeclaration(declaration); if (declarationMeaning & meaning) { meaning |= declarationMeaning; @@ -49054,10 +55137,10 @@ var ts; } var parent = node.parent; if (parent) { - if (parent.kind === 180 /* PostfixUnaryExpression */ || parent.kind === 179 /* PrefixUnaryExpression */) { + if (parent.kind === 186 /* PostfixUnaryExpression */ || parent.kind === 185 /* PrefixUnaryExpression */) { return true; } - else if (parent.kind === 181 /* BinaryExpression */ && parent.left === node) { + else if (parent.kind === 187 /* BinaryExpression */ && parent.left === node) { var operator = parent.operatorToken.kind; return 56 /* FirstAssignment */ <= operator && operator <= 68 /* LastAssignment */; } @@ -49069,9 +55152,6 @@ var ts; synchronizeHostData(); return ts.NavigateTo.getNavigateToItems(program, cancellationToken, searchValue, maxResultCount); } - function containErrors(diagnostics) { - return ts.forEach(diagnostics, function (diagnostic) { return diagnostic.category === ts.DiagnosticCategory.Error; }); - } function getEmitOutput(fileName) { synchronizeHostData(); var sourceFile = getValidSourceFile(fileName); @@ -49091,34 +55171,34 @@ var ts; } function getMeaningFromDeclaration(node) { switch (node.kind) { - case 138 /* Parameter */: - case 211 /* VariableDeclaration */: - case 163 /* BindingElement */: - case 141 /* PropertyDeclaration */: - case 140 /* PropertySignature */: - case 245 /* PropertyAssignment */: - case 246 /* ShorthandPropertyAssignment */: - case 247 /* EnumMember */: - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - case 144 /* Constructor */: - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: - case 213 /* FunctionDeclaration */: - case 173 /* FunctionExpression */: - case 174 /* ArrowFunction */: - case 244 /* CatchClause */: + case 142 /* Parameter */: + case 218 /* VariableDeclaration */: + case 169 /* BindingElement */: + case 145 /* PropertyDeclaration */: + case 144 /* PropertySignature */: + case 253 /* PropertyAssignment */: + case 254 /* ShorthandPropertyAssignment */: + case 255 /* EnumMember */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: + case 148 /* Constructor */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: + case 220 /* FunctionDeclaration */: + case 179 /* FunctionExpression */: + case 180 /* ArrowFunction */: + case 252 /* CatchClause */: return 1 /* Value */; - case 137 /* TypeParameter */: - case 215 /* InterfaceDeclaration */: - case 216 /* TypeAliasDeclaration */: - case 155 /* TypeLiteral */: + case 141 /* TypeParameter */: + case 222 /* InterfaceDeclaration */: + case 223 /* TypeAliasDeclaration */: + case 159 /* TypeLiteral */: return 2 /* Type */; - case 214 /* ClassDeclaration */: - case 217 /* EnumDeclaration */: + case 221 /* ClassDeclaration */: + case 224 /* EnumDeclaration */: return 1 /* Value */ | 2 /* Type */; - case 218 /* ModuleDeclaration */: - if (node.name.kind === 9 /* StringLiteral */) { + case 225 /* ModuleDeclaration */: + if (ts.isAmbientModule(node)) { return 4 /* Namespace */ | 1 /* Value */; } else if (ts.getModuleInstanceState(node) === 1 /* Instantiated */) { @@ -49127,15 +55207,15 @@ var ts; else { return 4 /* Namespace */; } - case 225 /* NamedImports */: - case 226 /* ImportSpecifier */: - case 221 /* ImportEqualsDeclaration */: - case 222 /* ImportDeclaration */: - case 227 /* ExportAssignment */: - case 228 /* ExportDeclaration */: + case 233 /* NamedImports */: + case 234 /* ImportSpecifier */: + case 229 /* ImportEqualsDeclaration */: + case 230 /* ImportDeclaration */: + case 235 /* ExportAssignment */: + case 236 /* ExportDeclaration */: return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; // An external module can be a Value - case 248 /* SourceFile */: + case 256 /* SourceFile */: return 4 /* Namespace */ | 1 /* Value */; } return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; @@ -49144,9 +55224,10 @@ var ts; if (ts.isRightSideOfQualifiedNameOrPropertyAccess(node)) { node = node.parent; } - return node.parent.kind === 151 /* TypeReference */ || - (node.parent.kind === 188 /* ExpressionWithTypeArguments */ && !ts.isExpressionWithTypeArgumentsInClassExtendsClause(node.parent)) || - node.kind === 97 /* ThisKeyword */ && !ts.isExpression(node); + return node.parent.kind === 155 /* TypeReference */ || + (node.parent.kind === 194 /* ExpressionWithTypeArguments */ && !ts.isExpressionWithTypeArgumentsInClassExtendsClause(node.parent)) || + (node.kind === 97 /* ThisKeyword */ && !ts.isExpression(node)) || + node.kind === 165 /* ThisType */; } function isNamespaceReference(node) { return isQualifiedNameNamespaceReference(node) || isPropertyAccessNamespaceReference(node); @@ -49154,32 +55235,32 @@ var ts; function isPropertyAccessNamespaceReference(node) { var root = node; var isLastClause = true; - if (root.parent.kind === 166 /* PropertyAccessExpression */) { - while (root.parent && root.parent.kind === 166 /* PropertyAccessExpression */) { + if (root.parent.kind === 172 /* PropertyAccessExpression */) { + while (root.parent && root.parent.kind === 172 /* PropertyAccessExpression */) { root = root.parent; } isLastClause = root.name === node; } - if (!isLastClause && root.parent.kind === 188 /* ExpressionWithTypeArguments */ && root.parent.parent.kind === 243 /* HeritageClause */) { + if (!isLastClause && root.parent.kind === 194 /* ExpressionWithTypeArguments */ && root.parent.parent.kind === 251 /* HeritageClause */) { var decl = root.parent.parent.parent; - return (decl.kind === 214 /* ClassDeclaration */ && root.parent.parent.token === 106 /* ImplementsKeyword */) || - (decl.kind === 215 /* InterfaceDeclaration */ && root.parent.parent.token === 83 /* ExtendsKeyword */); + return (decl.kind === 221 /* ClassDeclaration */ && root.parent.parent.token === 106 /* ImplementsKeyword */) || + (decl.kind === 222 /* InterfaceDeclaration */ && root.parent.parent.token === 83 /* ExtendsKeyword */); } return false; } function isQualifiedNameNamespaceReference(node) { var root = node; var isLastClause = true; - if (root.parent.kind === 135 /* QualifiedName */) { - while (root.parent && root.parent.kind === 135 /* QualifiedName */) { + if (root.parent.kind === 139 /* QualifiedName */) { + while (root.parent && root.parent.kind === 139 /* QualifiedName */) { root = root.parent; } isLastClause = root.right === node; } - return root.parent.kind === 151 /* TypeReference */ && !isLastClause; + return root.parent.kind === 155 /* TypeReference */ && !isLastClause; } function isInRightSideOfImport(node) { - while (node.parent.kind === 135 /* QualifiedName */) { + while (node.parent.kind === 139 /* QualifiedName */) { node = node.parent; } return ts.isInternalModuleImportEqualsDeclaration(node.parent) && node.parent.moduleReference === node; @@ -49189,15 +55270,15 @@ var ts; // import a = |b|; // Namespace // import a = |b.c|; // Value, type, namespace // import a = |b.c|.d; // Namespace - if (node.parent.kind === 135 /* QualifiedName */ && + if (node.parent.kind === 139 /* QualifiedName */ && node.parent.right === node && - node.parent.parent.kind === 221 /* ImportEqualsDeclaration */) { + node.parent.parent.kind === 229 /* ImportEqualsDeclaration */) { return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; } return 4 /* Namespace */; } function getMeaningFromLocation(node) { - if (node.parent.kind === 227 /* ExportAssignment */) { + if (node.parent.kind === 235 /* ExportAssignment */) { return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; } else if (isInRightSideOfImport(node)) { @@ -49226,25 +55307,27 @@ var ts; return ts.SignatureHelp.getSignatureHelpItems(program, sourceFile, position, cancellationToken); } /// Syntactic features - function getSourceFile(fileName) { + function getNonBoundSourceFile(fileName) { return syntaxTreeCache.getCurrentSourceFile(fileName); } function getNameOrDottedNameSpan(fileName, startPos, endPos) { var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); // Get node at the location var node = ts.getTouchingPropertyName(sourceFile, startPos); - if (!node) { + if (node === sourceFile) { return; } switch (node.kind) { - case 166 /* PropertyAccessExpression */: - case 135 /* QualifiedName */: + case 172 /* PropertyAccessExpression */: + case 139 /* QualifiedName */: case 9 /* StringLiteral */: + case 166 /* StringLiteralType */: case 84 /* FalseKeyword */: case 99 /* TrueKeyword */: case 93 /* NullKeyword */: case 95 /* SuperKeyword */: case 97 /* ThisKeyword */: + case 165 /* ThisType */: case 69 /* Identifier */: break; // Cant create the text span @@ -49261,7 +55344,7 @@ var ts; // If this is name of a module declarations, check if this is right side of dotted module name // If parent of the module declaration which is parent of this node is module declaration and its body is the module declaration that this node is name of // Then this name is name from dotted module - if (nodeForStartPos.parent.parent.kind === 218 /* ModuleDeclaration */ && + if (nodeForStartPos.parent.parent.kind === 225 /* ModuleDeclaration */ && nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { // Use parent module declarations name for start pos nodeForStartPos = nodeForStartPos.parent.parent.name; @@ -49285,7 +55368,7 @@ var ts; } function getNavigationBarItems(fileName) { var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); - return ts.NavigationBar.getNavigationBarItems(sourceFile); + return ts.NavigationBar.getNavigationBarItems(sourceFile, host.getCompilationSettings()); } function getSemanticClassifications(fileName, span) { return convertClassifications(getEncodedSemanticClassifications(fileName, span)); @@ -49302,10 +55385,10 @@ var ts; // That means we're calling back into the host around every 1.2k of the file we process. // Lib.d.ts has similar numbers. switch (kind) { - case 218 /* ModuleDeclaration */: - case 214 /* ClassDeclaration */: - case 215 /* InterfaceDeclaration */: - case 213 /* FunctionDeclaration */: + case 225 /* ModuleDeclaration */: + case 221 /* ClassDeclaration */: + case 222 /* InterfaceDeclaration */: + case 220 /* FunctionDeclaration */: cancellationToken.throwIfCancellationRequested(); } } @@ -49359,7 +55442,7 @@ var ts; */ function hasValueSideModule(symbol) { return ts.forEach(symbol.declarations, function (declaration) { - return declaration.kind === 218 /* ModuleDeclaration */ && + return declaration.kind === 225 /* ModuleDeclaration */ && ts.getModuleInstanceState(declaration) === 1 /* Instantiated */; }); } @@ -49410,6 +55493,9 @@ var ts; case 19 /* jsxOpenTagName */: return ClassificationTypeNames.jsxOpenTagName; case 20 /* jsxCloseTagName */: return ClassificationTypeNames.jsxCloseTagName; case 21 /* jsxSelfClosingTagName */: return ClassificationTypeNames.jsxSelfClosingTagName; + case 22 /* jsxAttribute */: return ClassificationTypeNames.jsxAttribute; + case 23 /* jsxText */: return ClassificationTypeNames.jsxText; + case 24 /* jsxAttributeStringLiteralValue */: return ClassificationTypeNames.jsxAttributeStringLiteralValue; } } function convertClassifications(classifications) { @@ -49433,8 +55519,8 @@ var ts; var spanStart = span.start; var spanLength = span.length; // Make a scanner we can get trivia from. - var triviaScanner = ts.createScanner(2 /* Latest */, /*skipTrivia:*/ false, sourceFile.languageVariant, sourceFile.text); - var mergeConflictScanner = ts.createScanner(2 /* Latest */, /*skipTrivia:*/ false, sourceFile.languageVariant, sourceFile.text); + var triviaScanner = ts.createScanner(2 /* Latest */, /*skipTrivia*/ false, sourceFile.languageVariant, sourceFile.text); + var mergeConflictScanner = ts.createScanner(2 /* Latest */, /*skipTrivia*/ false, sourceFile.languageVariant, sourceFile.text); var result = []; processElement(sourceFile); return { spans: result, endOfLineState: 0 /* None */ }; @@ -49517,16 +55603,16 @@ var ts; pushClassification(tag.tagName.pos, tag.tagName.end - tag.tagName.pos, 18 /* docCommentTagName */); pos = tag.tagName.end; switch (tag.kind) { - case 267 /* JSDocParameterTag */: + case 275 /* JSDocParameterTag */: processJSDocParameterTag(tag); break; - case 270 /* JSDocTemplateTag */: + case 278 /* JSDocTemplateTag */: processJSDocTemplateTag(tag); break; - case 269 /* JSDocTypeTag */: + case 277 /* JSDocTypeTag */: processElement(tag.typeExpression); break; - case 268 /* JSDocReturnTag */: + case 276 /* JSDocReturnTag */: processElement(tag.typeExpression); break; } @@ -49563,7 +55649,8 @@ var ts; function classifyDisabledMergeCode(text, start, end) { // Classify the line that the ======= marker is on as a comment. Then just lex // all further tokens and add them to the result. - for (var i = start; i < end; i++) { + var i; + for (i = start; i < end; i++) { if (ts.isLineBreak(text.charCodeAt(i))) { break; } @@ -49583,19 +55670,53 @@ var ts; pushClassification(start, end - start, type); } } - function classifyToken(token) { - if (ts.nodeIsMissing(token)) { - return; + /** + * Returns true if node should be treated as classified and no further processing is required. + * False will mean that node is not classified and traverse routine should recurse into node contents. + */ + function tryClassifyNode(node) { + if (ts.nodeIsMissing(node)) { + return true; } - var tokenStart = classifyLeadingTriviaAndGetTokenStart(token); - var tokenWidth = token.end - tokenStart; + var classifiedElementName = tryClassifyJsxElementName(node); + if (!ts.isToken(node) && node.kind !== 244 /* JsxText */ && classifiedElementName === undefined) { + return false; + } + var tokenStart = node.kind === 244 /* JsxText */ ? node.pos : classifyLeadingTriviaAndGetTokenStart(node); + var tokenWidth = node.end - tokenStart; ts.Debug.assert(tokenWidth >= 0); if (tokenWidth > 0) { - var type = classifyTokenType(token.kind, token); + var type = classifiedElementName || classifyTokenType(node.kind, node); if (type) { pushClassification(tokenStart, tokenWidth, type); } } + return true; + } + function tryClassifyJsxElementName(token) { + switch (token.parent && token.parent.kind) { + case 243 /* JsxOpeningElement */: + if (token.parent.tagName === token) { + return 19 /* jsxOpenTagName */; + } + break; + case 245 /* JsxClosingElement */: + if (token.parent.tagName === token) { + return 20 /* jsxCloseTagName */; + } + break; + case 242 /* JsxSelfClosingElement */: + if (token.parent.tagName === token) { + return 21 /* jsxSelfClosingTagName */; + } + break; + case 246 /* JsxAttribute */: + if (token.parent.name === token) { + return 22 /* jsxAttribute */; + } + break; + } + return undefined; } // for accurate classification, the actual token should be passed in. however, for // cases like 'disabled merge code' classification, we just get the token kind and @@ -49617,16 +55738,17 @@ var ts; if (token) { if (tokenKind === 56 /* EqualsToken */) { // the '=' in a variable declaration is special cased here. - if (token.parent.kind === 211 /* VariableDeclaration */ || - token.parent.kind === 141 /* PropertyDeclaration */ || - token.parent.kind === 138 /* Parameter */) { + if (token.parent.kind === 218 /* VariableDeclaration */ || + token.parent.kind === 145 /* PropertyDeclaration */ || + token.parent.kind === 142 /* Parameter */ || + token.parent.kind === 246 /* JsxAttribute */) { return 5 /* operator */; } } - if (token.parent.kind === 181 /* BinaryExpression */ || - token.parent.kind === 179 /* PrefixUnaryExpression */ || - token.parent.kind === 180 /* PostfixUnaryExpression */ || - token.parent.kind === 182 /* ConditionalExpression */) { + if (token.parent.kind === 187 /* BinaryExpression */ || + token.parent.kind === 185 /* PrefixUnaryExpression */ || + token.parent.kind === 186 /* PostfixUnaryExpression */ || + token.parent.kind === 188 /* ConditionalExpression */) { return 5 /* operator */; } } @@ -49635,8 +55757,8 @@ var ts; else if (tokenKind === 8 /* NumericLiteral */) { return 4 /* numericLiteral */; } - else if (tokenKind === 9 /* StringLiteral */) { - return 6 /* stringLiteral */; + else if (tokenKind === 9 /* StringLiteral */ || tokenKind === 166 /* StringLiteralType */) { + return token.parent.kind === 246 /* JsxAttribute */ ? 24 /* jsxAttributeStringLiteralValue */ : 6 /* stringLiteral */; } else if (tokenKind === 10 /* RegularExpressionLiteral */) { // TODO: we should get another classification type for these literals. @@ -49646,54 +55768,42 @@ var ts; // TODO (drosen): we should *also* get another classification type for these literals. return 6 /* stringLiteral */; } + else if (tokenKind === 244 /* JsxText */) { + return 23 /* jsxText */; + } else if (tokenKind === 69 /* Identifier */) { if (token) { switch (token.parent.kind) { - case 214 /* ClassDeclaration */: + case 221 /* ClassDeclaration */: if (token.parent.name === token) { return 11 /* className */; } return; - case 137 /* TypeParameter */: + case 141 /* TypeParameter */: if (token.parent.name === token) { return 15 /* typeParameterName */; } return; - case 215 /* InterfaceDeclaration */: + case 222 /* InterfaceDeclaration */: if (token.parent.name === token) { return 13 /* interfaceName */; } return; - case 217 /* EnumDeclaration */: + case 224 /* EnumDeclaration */: if (token.parent.name === token) { return 12 /* enumName */; } return; - case 218 /* ModuleDeclaration */: + case 225 /* ModuleDeclaration */: if (token.parent.name === token) { return 14 /* moduleName */; } return; - case 138 /* Parameter */: + case 142 /* Parameter */: if (token.parent.name === token) { return 17 /* parameterName */; } return; - case 235 /* JsxOpeningElement */: - if (token.parent.tagName === token) { - return 19 /* jsxOpenTagName */; - } - return; - case 237 /* JsxClosingElement */: - if (token.parent.tagName === token) { - return 20 /* jsxCloseTagName */; - } - return; - case 234 /* JsxSelfClosingElement */: - if (token.parent.tagName === token) { - return 21 /* jsxSelfClosingTagName */; - } - return; } } return 2 /* identifier */; @@ -49709,10 +55819,7 @@ var ts; var children = element.getChildren(sourceFile); for (var i = 0, n = children.length; i < n; i++) { var child = children[i]; - if (ts.isToken(child)) { - classifyToken(child); - } - else { + if (!tryClassifyNode(child)) { // Recurse into our child nodes. processElement(child); } @@ -49818,7 +55925,6 @@ var ts; * be performed. */ function getDocCommentTemplateAtPosition(fileName, position) { - var start = new Date().getTime(); var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); // Check if in a context where we don't want to perform any insertion if (ts.isInString(sourceFile, position) || ts.isInComment(sourceFile, position) || ts.hasDocComment(sourceFile, position)) { @@ -49837,19 +55943,19 @@ var ts; var commentOwner; findOwner: for (commentOwner = tokenAtPos; commentOwner; commentOwner = commentOwner.parent) { switch (commentOwner.kind) { - case 213 /* FunctionDeclaration */: - case 143 /* MethodDeclaration */: - case 144 /* Constructor */: - case 214 /* ClassDeclaration */: - case 193 /* VariableStatement */: + case 220 /* FunctionDeclaration */: + case 147 /* MethodDeclaration */: + case 148 /* Constructor */: + case 221 /* ClassDeclaration */: + case 200 /* VariableStatement */: break findOwner; - case 248 /* SourceFile */: + case 256 /* SourceFile */: return undefined; - case 218 /* ModuleDeclaration */: + case 225 /* ModuleDeclaration */: // If in walking up the tree, we hit a a nested namespace declaration, // then we must be somewhere within a dotted namespace name; however we don't // want to give back a JSDoc template for the 'b' or 'c' in 'namespace a.b.c { }'. - if (commentOwner.parent.kind === 218 /* ModuleDeclaration */) { + if (commentOwner.parent.kind === 225 /* ModuleDeclaration */) { return undefined; } break findOwner; @@ -49862,8 +55968,7 @@ var ts; var posLineAndChar = sourceFile.getLineAndCharacterOfPosition(position); var lineStart = sourceFile.getLineStarts()[posLineAndChar.line]; var indentationStr = sourceFile.text.substr(lineStart, posLineAndChar.character); - // TODO: call a helper method instead once PR #4133 gets merged in. - var newLine = host.getNewLine ? host.getNewLine() : "\r\n"; + var newLine = ts.getNewLineOrDefaultFromHost(host); var docParams = ""; for (var i = 0, numParams = parameters.length; i < numParams; i++) { var currentName = parameters[i].name; @@ -49887,11 +55992,34 @@ var ts; (tokenStart === position ? newLine + indentationStr : ""); return { newText: result, caretOffset: preamble.length }; } + function isValidBraceCompletionAtPostion(fileName, position, openingBrace) { + // '<' is currently not supported, figuring out if we're in a Generic Type vs. a comparison is too + // expensive to do during typing scenarios + // i.e. whether we're dealing with: + // var x = new foo<| ( with class foo{} ) + // or + // var y = 3 <| + if (openingBrace === 60 /* lessThan */) { + return false; + } + var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); + // Check if in a context where we don't want to perform any insertion + if (ts.isInString(sourceFile, position) || ts.isInComment(sourceFile, position)) { + return false; + } + if (ts.isInsideJsxElementOrAttribute(sourceFile, position)) { + return openingBrace === 123 /* openBrace */; + } + if (ts.isInTemplateString(sourceFile, position)) { + return false; + } + return true; + } function getParametersForJsDocOwningNode(commentOwner) { if (ts.isFunctionLike(commentOwner)) { return commentOwner.parameters; } - if (commentOwner.kind === 193 /* VariableStatement */) { + if (commentOwner.kind === 200 /* VariableStatement */) { var varStatement = commentOwner; var varDeclarations = varStatement.declarationList.declarations; if (varDeclarations.length === 1 && varDeclarations[0].initializer) { @@ -49909,17 +56037,17 @@ var ts; * @returns the parameters of a signature found on the RHS if one exists; otherwise 'emptyArray'. */ function getParametersFromRightHandSideOfAssignment(rightHandSide) { - while (rightHandSide.kind === 172 /* ParenthesizedExpression */) { + while (rightHandSide.kind === 178 /* ParenthesizedExpression */) { rightHandSide = rightHandSide.expression; } switch (rightHandSide.kind) { - case 173 /* FunctionExpression */: - case 174 /* ArrowFunction */: + case 179 /* FunctionExpression */: + case 180 /* ArrowFunction */: return rightHandSide.parameters; - case 186 /* ClassExpression */: + case 192 /* ClassExpression */: for (var _i = 0, _a = rightHandSide.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.kind === 144 /* Constructor */) { + if (member.kind === 148 /* Constructor */) { return member.parameters; } } @@ -49941,7 +56069,7 @@ var ts; var result = []; if (descriptors.length > 0) { var regExp = getTodoCommentsRegExp(); - var matchArray; + var matchArray = void 0; while (matchArray = regExp.exec(fileContents)) { cancellationToken.throwIfCancellationRequested(); // If we got a match, here is what the match array will look like. Say the source text is: @@ -50012,11 +56140,11 @@ var ts; // comment portion. var singleLineCommentStart = /(?:\/\/+\s*)/.source; var multiLineCommentStart = /(?:\/\*+\s*)/.source; - var anyNumberOfSpacesAndAsterixesAtStartOfLine = /(?:^(?:\s|\*)*)/.source; + var anyNumberOfSpacesAndAsterisksAtStartOfLine = /(?:^(?:\s|\*)*)/.source; // Match any of the above three TODO comment start regexps. // Note that the outermost group *is* a capture group. We want to capture the preamble // so that we can determine the starting position of the TODO comment match. - var preamble = "(" + anyNumberOfSpacesAndAsterixesAtStartOfLine + "|" + singleLineCommentStart + "|" + multiLineCommentStart + ")"; + var preamble = "(" + anyNumberOfSpacesAndAsterisksAtStartOfLine + "|" + singleLineCommentStart + "|" + multiLineCommentStart + ")"; // Takes the descriptors and forms a regexp that matches them as if they were literals. // For example, if the descriptors are "TODO(jason)" and "HACK", then this will be: // @@ -50051,42 +56179,68 @@ var ts; (char >= 48 /* _0 */ && char <= 57 /* _9 */); } } + function getStringLiteralTypeForNode(node, typeChecker) { + var searchNode = node.parent.kind === 166 /* StringLiteralType */ ? node.parent : node; + var type = typeChecker.getTypeAtLocation(searchNode); + if (type && type.flags & 256 /* StringLiteral */) { + return type; + } + return undefined; + } function getRenameInfo(fileName, position) { synchronizeHostData(); var sourceFile = getValidSourceFile(fileName); var typeChecker = program.getTypeChecker(); + var defaultLibFileName = host.getDefaultLibFileName(host.getCompilationSettings()); + var canonicalDefaultLibName = getCanonicalFileName(ts.normalizePath(defaultLibFileName)); var node = ts.getTouchingWord(sourceFile, position); // Can only rename an identifier. - if (node && node.kind === 69 /* Identifier */) { - var symbol = typeChecker.getSymbolAtLocation(node); - // Only allow a symbol to be renamed if it actually has at least one declaration. - if (symbol) { - var declarations = symbol.getDeclarations(); - if (declarations && declarations.length > 0) { - // Disallow rename for elements that are defined in the standard TypeScript library. - var defaultLibFileName = host.getDefaultLibFileName(host.getCompilationSettings()); - if (defaultLibFileName) { - for (var _i = 0, declarations_10 = declarations; _i < declarations_10.length; _i++) { - var current = declarations_10[_i]; - var sourceFile_2 = current.getSourceFile(); - var canonicalName = getCanonicalFileName(ts.normalizePath(sourceFile_2.fileName)); - if (sourceFile_2 && getCanonicalFileName(ts.normalizePath(sourceFile_2.fileName)) === getCanonicalFileName(ts.normalizePath(defaultLibFileName))) { - return getRenameInfoError(ts.getLocaleSpecificMessage(ts.Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library)); - } + if (node) { + if (node.kind === 69 /* Identifier */ || + node.kind === 9 /* StringLiteral */ || + isLiteralNameOfPropertyDeclarationOrIndexAccess(node)) { + var symbol = typeChecker.getSymbolAtLocation(node); + // Only allow a symbol to be renamed if it actually has at least one declaration. + if (symbol) { + var declarations = symbol.getDeclarations(); + if (declarations && declarations.length > 0) { + // Disallow rename for elements that are defined in the standard TypeScript library. + if (ts.forEach(declarations, isDefinedInLibraryFile)) { + return getRenameInfoError(ts.getLocaleSpecificMessage(ts.Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library)); + } + var displayName = ts.stripQuotes(ts.getDeclaredName(typeChecker, symbol, node)); + var kind = getSymbolKind(symbol, node); + if (kind) { + return { + canRename: true, + kind: kind, + displayName: displayName, + localizedErrorMessage: undefined, + fullDisplayName: typeChecker.getFullyQualifiedName(symbol), + kindModifiers: getSymbolModifiers(symbol), + triggerSpan: createTriggerSpanForNode(node, sourceFile) + }; } } - var displayName = ts.stripQuotes(ts.getDeclaredName(typeChecker, symbol, node)); - var kind = getSymbolKind(symbol, node); - if (kind) { - return { - canRename: true, - localizedErrorMessage: undefined, - displayName: displayName, - fullDisplayName: typeChecker.getFullyQualifiedName(symbol), - kind: kind, - kindModifiers: getSymbolModifiers(symbol), - triggerSpan: ts.createTextSpan(node.getStart(), node.getWidth()) - }; + } + else if (node.kind === 9 /* StringLiteral */) { + var type = getStringLiteralTypeForNode(node, typeChecker); + if (type) { + if (isDefinedInLibraryFile(node)) { + return getRenameInfoError(ts.getLocaleSpecificMessage(ts.Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library)); + } + else { + var displayName = ts.stripQuotes(type.text); + return { + canRename: true, + kind: ScriptElementKind.variableElement, + displayName: displayName, + localizedErrorMessage: undefined, + fullDisplayName: displayName, + kindModifiers: ScriptElementKindModifier.none, + triggerSpan: createTriggerSpanForNode(node, sourceFile) + }; + } } } } @@ -50103,6 +56257,26 @@ var ts; triggerSpan: undefined }; } + function isDefinedInLibraryFile(declaration) { + if (defaultLibFileName) { + var sourceFile_3 = declaration.getSourceFile(); + var canonicalName = getCanonicalFileName(ts.normalizePath(sourceFile_3.fileName)); + if (canonicalName === canonicalDefaultLibName) { + return true; + } + } + return false; + } + function createTriggerSpanForNode(node, sourceFile) { + var start = node.getStart(sourceFile); + var width = node.getWidth(sourceFile); + if (node.kind === 9 /* StringLiteral */) { + // Exclude the quotes + start += 1; + width -= 2; + } + return ts.createTextSpan(start, width); + } } return { dispose: dispose, @@ -50138,8 +56312,9 @@ var ts; getFormattingEditsForDocument: getFormattingEditsForDocument, getFormattingEditsAfterKeystroke: getFormattingEditsAfterKeystroke, getDocCommentTemplateAtPosition: getDocCommentTemplateAtPosition, + isValidBraceCompletionAtPostion: isValidBraceCompletionAtPostion, getEmitOutput: getEmitOutput, - getSourceFile: getSourceFile, + getNonBoundSourceFile: getNonBoundSourceFile, getProgram: getProgram }; } @@ -50159,7 +56334,7 @@ var ts; function walk(node) { switch (node.kind) { case 69 /* Identifier */: - nameTable[node.text] = node.text; + nameTable[node.text] = nameTable[node.text] === undefined ? node.pos : -1; break; case 9 /* StringLiteral */: case 8 /* NumericLiteral */: @@ -50168,9 +56343,10 @@ var ts; // then we want 'something' to be in the name table. Similarly, if we have // "a['propname']" then we want to store "propname" in the name table. if (ts.isDeclarationName(node) || - node.parent.kind === 232 /* ExternalModuleReference */ || - isArgumentOfElementAccessExpression(node)) { - nameTable[node.text] = node.text; + node.parent.kind === 240 /* ExternalModuleReference */ || + isArgumentOfElementAccessExpression(node) || + ts.isLiteralComputedPropertyDeclarationName(node)) { + nameTable[node.text] = nameTable[node.text] === undefined ? node.pos : -1; } break; default: @@ -50181,7 +56357,7 @@ var ts; function isArgumentOfElementAccessExpression(node) { return node && node.parent && - node.parent.kind === 167 /* ElementAccessExpression */ && + node.parent.kind === 173 /* ElementAccessExpression */ && node.parent.argumentExpression === node; } /// Classifier @@ -50229,7 +56405,7 @@ var ts; function canFollow(keyword1, keyword2) { if (ts.isAccessibilityModifier(keyword1)) { if (keyword2 === 123 /* GetKeyword */ || - keyword2 === 129 /* SetKeyword */ || + keyword2 === 131 /* SetKeyword */ || keyword2 === 121 /* ConstructorKeyword */ || keyword2 === 113 /* StaticKeyword */) { // Allow things like "public get", "public constructor" and "public static". @@ -50310,7 +56486,7 @@ var ts; // (and a newline). That way when we lex we'll think we're still in a multiline comment. switch (lexState) { case 3 /* InDoubleQuoteStringLiteral */: - text = '"\\\n' + text; + text = "\"\\\n" + text; offset = 3; break; case 2 /* InSingleQuoteStringLiteral */: @@ -50388,10 +56564,10 @@ var ts; angleBracketStack--; } else if (token === 117 /* AnyKeyword */ || - token === 130 /* StringKeyword */ || - token === 128 /* NumberKeyword */ || + token === 132 /* StringKeyword */ || + token === 130 /* NumberKeyword */ || token === 120 /* BooleanKeyword */ || - token === 131 /* SymbolKeyword */) { + token === 133 /* SymbolKeyword */) { if (angleBracketStack > 0 && !syntacticClassifierAbsent) { // If it looks like we're could be in something generic, don't classify this // as a keyword. We may just get overwritten by the syntactic classifier, @@ -50440,7 +56616,7 @@ var ts; var end = scanner.getTextPos(); addResult(start, end, classFromKind(token)); if (end >= text.length) { - if (token === 9 /* StringLiteral */) { + if (token === 9 /* StringLiteral */ || token === 166 /* StringLiteralType */) { // Check to see if we finished up on a multiline string literal. var tokenText = scanner.getTokenText(); if (scanner.isUnterminated()) { @@ -50563,7 +56739,7 @@ var ts; } } function isKeyword(token) { - return token >= 70 /* FirstKeyword */ && token <= 134 /* LastKeyword */; + return token >= 70 /* FirstKeyword */ && token <= 138 /* LastKeyword */; } function classFromKind(token) { if (isKeyword(token)) { @@ -50579,6 +56755,7 @@ var ts; case 8 /* NumericLiteral */: return 4 /* numericLiteral */; case 9 /* StringLiteral */: + case 166 /* StringLiteralType */: return 6 /* stringLiteral */; case 10 /* RegularExpressionLiteral */: return 7 /* regularExpressionLiteral */; @@ -50640,19 +56817,19 @@ var ts; */ function spanInSourceFileAtLocation(sourceFile, position) { // Cannot set breakpoint in dts file - if (sourceFile.flags & 4096 /* DeclarationFile */) { + if (sourceFile.isDeclarationFile) { return undefined; } var tokenAtLocation = ts.getTokenAtPosition(sourceFile, position); var lineOfPosition = sourceFile.getLineAndCharacterOfPosition(position).line; - if (sourceFile.getLineAndCharacterOfPosition(tokenAtLocation.getStart()).line > lineOfPosition) { + if (sourceFile.getLineAndCharacterOfPosition(tokenAtLocation.getStart(sourceFile)).line > lineOfPosition) { // Get previous token if the token is returned starts on new line // eg: let x =10; |--- cursor is here // let y = 10; // token at position will return let keyword on second line as the token but we would like to use // token on same line if trailing trivia (comments or white spaces on same line) part of the last token on that line tokenAtLocation = ts.findPrecedingToken(tokenAtLocation.pos, sourceFile); - // Its a blank line + // It's a blank line if (!tokenAtLocation || sourceFile.getLineAndCharacterOfPosition(tokenAtLocation.getEnd()).line !== lineOfPosition) { return undefined; } @@ -50664,14 +56841,23 @@ var ts; // Get the span in the node based on its syntax return spanInNode(tokenAtLocation); function textSpan(startNode, endNode) { - return ts.createTextSpanFromBounds(startNode.getStart(), (endNode || startNode).getEnd()); + var start = startNode.decorators ? + ts.skipTrivia(sourceFile.text, startNode.decorators.end) : + startNode.getStart(sourceFile); + return ts.createTextSpanFromBounds(start, (endNode || startNode).getEnd()); + } + function textSpanEndingAtNextToken(startNode, previousTokenToFindNextEndToken) { + return textSpan(startNode, ts.findNextToken(previousTokenToFindNextEndToken, previousTokenToFindNextEndToken.parent)); } function spanInNodeIfStartsOnSameLine(node, otherwiseOnNode) { - if (node && lineOfPosition === sourceFile.getLineAndCharacterOfPosition(node.getStart()).line) { + if (node && lineOfPosition === sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile)).line) { return spanInNode(node); } return spanInNode(otherwiseOnNode); } + function spanInNodeArray(nodeArray) { + return ts.createTextSpanFromBounds(ts.skipTrivia(sourceFile.text, nodeArray.pos), nodeArray.end); + } function spanInPreviousNode(node) { return spanInNode(ts.findPrecedingToken(node.pos, sourceFile)); } @@ -50680,126 +56866,114 @@ var ts; } function spanInNode(node) { if (node) { - if (ts.isExpression(node)) { - if (node.parent.kind === 197 /* DoStatement */) { - // Set span as if on while keyword - return spanInPreviousNode(node); - } - if (node.parent.kind === 199 /* ForStatement */) { - // For now lets set the span on this expression, fix it later - return textSpan(node); - } - if (node.parent.kind === 181 /* BinaryExpression */ && node.parent.operatorToken.kind === 24 /* CommaToken */) { - // if this is comma expression, the breakpoint is possible in this expression - return textSpan(node); - } - if (node.parent.kind === 174 /* ArrowFunction */ && node.parent.body === node) { - // If this is body of arrow function, it is allowed to have the breakpoint - return textSpan(node); - } - } switch (node.kind) { - case 193 /* VariableStatement */: + case 200 /* VariableStatement */: // Span on first variable declaration return spanInVariableDeclaration(node.declarationList.declarations[0]); - case 211 /* VariableDeclaration */: - case 141 /* PropertyDeclaration */: - case 140 /* PropertySignature */: + case 218 /* VariableDeclaration */: + case 145 /* PropertyDeclaration */: + case 144 /* PropertySignature */: return spanInVariableDeclaration(node); - case 138 /* Parameter */: + case 142 /* Parameter */: return spanInParameterDeclaration(node); - case 213 /* FunctionDeclaration */: - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: - case 144 /* Constructor */: - case 173 /* FunctionExpression */: - case 174 /* ArrowFunction */: + case 220 /* FunctionDeclaration */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: + case 148 /* Constructor */: + case 179 /* FunctionExpression */: + case 180 /* ArrowFunction */: return spanInFunctionDeclaration(node); - case 192 /* Block */: + case 199 /* Block */: if (ts.isFunctionBlock(node)) { return spanInFunctionBlock(node); } // Fall through - case 219 /* ModuleBlock */: + case 226 /* ModuleBlock */: return spanInBlock(node); - case 244 /* CatchClause */: + case 252 /* CatchClause */: return spanInBlock(node.block); - case 195 /* ExpressionStatement */: + case 202 /* ExpressionStatement */: // span on the expression return textSpan(node.expression); - case 204 /* ReturnStatement */: + case 211 /* ReturnStatement */: // span on return keyword and expression if present return textSpan(node.getChildAt(0), node.expression); - case 198 /* WhileStatement */: + case 205 /* WhileStatement */: // Span on while(...) - return textSpan(node, ts.findNextToken(node.expression, node)); - case 197 /* DoStatement */: + return textSpanEndingAtNextToken(node, node.expression); + case 204 /* DoStatement */: // span in statement of the do statement return spanInNode(node.statement); - case 210 /* DebuggerStatement */: + case 217 /* DebuggerStatement */: // span on debugger keyword return textSpan(node.getChildAt(0)); - case 196 /* IfStatement */: + case 203 /* IfStatement */: // set on if(..) span - return textSpan(node, ts.findNextToken(node.expression, node)); - case 207 /* LabeledStatement */: + return textSpanEndingAtNextToken(node, node.expression); + case 214 /* LabeledStatement */: // span in statement return spanInNode(node.statement); - case 203 /* BreakStatement */: - case 202 /* ContinueStatement */: + case 210 /* BreakStatement */: + case 209 /* ContinueStatement */: // On break or continue keyword and label if present return textSpan(node.getChildAt(0), node.label); - case 199 /* ForStatement */: + case 206 /* ForStatement */: return spanInForStatement(node); - case 200 /* ForInStatement */: - case 201 /* ForOfStatement */: - // span on for (a in ...) - return textSpan(node, ts.findNextToken(node.expression, node)); - case 206 /* SwitchStatement */: + case 207 /* ForInStatement */: + // span of for (a in ...) + return textSpanEndingAtNextToken(node, node.expression); + case 208 /* ForOfStatement */: + // span in initializer + return spanInInitializerOfForLike(node); + case 213 /* SwitchStatement */: // span on switch(...) - return textSpan(node, ts.findNextToken(node.expression, node)); - case 241 /* CaseClause */: - case 242 /* DefaultClause */: + return textSpanEndingAtNextToken(node, node.expression); + case 249 /* CaseClause */: + case 250 /* DefaultClause */: // span in first statement of the clause return spanInNode(node.statements[0]); - case 209 /* TryStatement */: + case 216 /* TryStatement */: // span in try block return spanInBlock(node.tryBlock); - case 208 /* ThrowStatement */: + case 215 /* ThrowStatement */: // span in throw ... return textSpan(node, node.expression); - case 227 /* ExportAssignment */: + case 235 /* ExportAssignment */: // span on export = id return textSpan(node, node.expression); - case 221 /* ImportEqualsDeclaration */: + case 229 /* ImportEqualsDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleReference); - case 222 /* ImportDeclaration */: + case 230 /* ImportDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleSpecifier); - case 228 /* ExportDeclaration */: + case 236 /* ExportDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleSpecifier); - case 218 /* ModuleDeclaration */: + case 225 /* ModuleDeclaration */: // span on complete module if it is instantiated if (ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { return undefined; } - case 214 /* ClassDeclaration */: - case 217 /* EnumDeclaration */: - case 247 /* EnumMember */: - case 168 /* CallExpression */: - case 169 /* NewExpression */: + case 221 /* ClassDeclaration */: + case 224 /* EnumDeclaration */: + case 255 /* EnumMember */: + case 169 /* BindingElement */: // span on complete node return textSpan(node); - case 205 /* WithStatement */: + case 212 /* WithStatement */: // span in statement return spanInNode(node.statement); + case 143 /* Decorator */: + return spanInNodeArray(node.parent.decorators); + case 167 /* ObjectBindingPattern */: + case 168 /* ArrayBindingPattern */: + return spanInBindingPattern(node); // No breakpoint in interface, type alias - case 215 /* InterfaceDeclaration */: - case 216 /* TypeAliasDeclaration */: + case 222 /* InterfaceDeclaration */: + case 223 /* TypeAliasDeclaration */: return undefined; // Tokens: case 23 /* SemicolonToken */: @@ -50811,6 +56985,8 @@ var ts; return spanInOpenBraceToken(node); case 16 /* CloseBraceToken */: return spanInCloseBraceToken(node); + case 20 /* CloseBracketToken */: + return spanInCloseBracketToken(node); case 17 /* OpenParenToken */: return spanInOpenParenToken(node); case 18 /* CloseParenToken */: @@ -50827,67 +57003,155 @@ var ts; case 72 /* CatchKeyword */: case 85 /* FinallyKeyword */: return spanInNextNode(node); + case 138 /* OfKeyword */: + return spanInOfKeyword(node); default: + // Destructuring pattern in destructuring assignment + // [a, b, c] of + // [a, b, c] = expression + if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node)) { + return spanInArrayLiteralOrObjectLiteralDestructuringPattern(node); + } + // Set breakpoint on identifier element of destructuring pattern + // a or ...c or d: x from + // [a, b, ...c] or { a, b } or { d: x } from destructuring pattern + if ((node.kind === 69 /* Identifier */ || + node.kind == 191 /* SpreadElementExpression */ || + node.kind === 253 /* PropertyAssignment */ || + node.kind === 254 /* ShorthandPropertyAssignment */) && + ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent)) { + return textSpan(node); + } + if (node.kind === 187 /* BinaryExpression */) { + var binaryExpression = node; + // Set breakpoint in destructuring pattern if its destructuring assignment + // [a, b, c] or {a, b, c} of + // [a, b, c] = expression or + // {a, b, c} = expression + if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(binaryExpression.left)) { + return spanInArrayLiteralOrObjectLiteralDestructuringPattern(binaryExpression.left); + } + if (binaryExpression.operatorToken.kind === 56 /* EqualsToken */ && + ts.isArrayLiteralOrObjectLiteralDestructuringPattern(binaryExpression.parent)) { + // Set breakpoint on assignment expression element of destructuring pattern + // a = expression of + // [a = expression, b, c] = someExpression or + // { a = expression, b, c } = someExpression + return textSpan(node); + } + if (binaryExpression.operatorToken.kind === 24 /* CommaToken */) { + return spanInNode(binaryExpression.left); + } + } + if (ts.isExpression(node)) { + switch (node.parent.kind) { + case 204 /* DoStatement */: + // Set span as if on while keyword + return spanInPreviousNode(node); + case 143 /* Decorator */: + // Set breakpoint on the decorator emit + return spanInNode(node.parent); + case 206 /* ForStatement */: + case 208 /* ForOfStatement */: + return textSpan(node); + case 187 /* BinaryExpression */: + if (node.parent.operatorToken.kind === 24 /* CommaToken */) { + // If this is a comma expression, the breakpoint is possible in this expression + return textSpan(node); + } + break; + case 180 /* ArrowFunction */: + if (node.parent.body === node) { + // If this is body of arrow function, it is allowed to have the breakpoint + return textSpan(node); + } + break; + } + } // If this is name of property assignment, set breakpoint in the initializer - if (node.parent.kind === 245 /* PropertyAssignment */ && node.parent.name === node) { + if (node.parent.kind === 253 /* PropertyAssignment */ && + node.parent.name === node && + !ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.parent)) { return spanInNode(node.parent.initializer); } // Breakpoint in type assertion goes to its operand - if (node.parent.kind === 171 /* TypeAssertionExpression */ && node.parent.type === node) { - return spanInNode(node.parent.expression); + if (node.parent.kind === 177 /* TypeAssertionExpression */ && node.parent.type === node) { + return spanInNextNode(node.parent.type); } // return type of function go to previous token if (ts.isFunctionLike(node.parent) && node.parent.type === node) { return spanInPreviousNode(node); } + // initializer of variable/parameter declaration go to previous node + if ((node.parent.kind === 218 /* VariableDeclaration */ || + node.parent.kind === 142 /* Parameter */)) { + var paramOrVarDecl = node.parent; + if (paramOrVarDecl.initializer === node || + paramOrVarDecl.type === node || + ts.isAssignmentOperator(node.kind)) { + return spanInPreviousNode(node); + } + } + if (node.parent.kind === 187 /* BinaryExpression */) { + var binaryExpression = node.parent; + if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(binaryExpression.left) && + (binaryExpression.right === node || + binaryExpression.operatorToken === node)) { + // If initializer of destructuring assignment move to previous token + return spanInPreviousNode(node); + } + } // Default go to parent to set the breakpoint return spanInNode(node.parent); } } + function textSpanFromVariableDeclaration(variableDeclaration) { + var declarations = variableDeclaration.parent.declarations; + if (declarations && declarations[0] === variableDeclaration) { + // First declaration - include let keyword + return textSpan(ts.findPrecedingToken(variableDeclaration.pos, sourceFile, variableDeclaration.parent), variableDeclaration); + } + else { + // Span only on this declaration + return textSpan(variableDeclaration); + } + } function spanInVariableDeclaration(variableDeclaration) { // If declaration of for in statement, just set the span in parent - if (variableDeclaration.parent.parent.kind === 200 /* ForInStatement */ || - variableDeclaration.parent.parent.kind === 201 /* ForOfStatement */) { + if (variableDeclaration.parent.parent.kind === 207 /* ForInStatement */) { return spanInNode(variableDeclaration.parent.parent); } - var isParentVariableStatement = variableDeclaration.parent.parent.kind === 193 /* VariableStatement */; - var isDeclarationOfForStatement = variableDeclaration.parent.parent.kind === 199 /* ForStatement */ && ts.contains(variableDeclaration.parent.parent.initializer.declarations, variableDeclaration); - var declarations = isParentVariableStatement - ? variableDeclaration.parent.parent.declarationList.declarations - : isDeclarationOfForStatement - ? variableDeclaration.parent.parent.initializer.declarations - : undefined; - // Breakpoint is possible in variableDeclaration only if there is initialization - if (variableDeclaration.initializer || (variableDeclaration.flags & 2 /* Export */)) { - if (declarations && declarations[0] === variableDeclaration) { - if (isParentVariableStatement) { - // First declaration - include let keyword - return textSpan(variableDeclaration.parent, variableDeclaration); - } - else { - ts.Debug.assert(isDeclarationOfForStatement); - // Include let keyword from for statement declarations in the span - return textSpan(ts.findPrecedingToken(variableDeclaration.pos, sourceFile, variableDeclaration.parent), variableDeclaration); - } - } - else { - // Span only on this declaration - return textSpan(variableDeclaration); - } + // If this is a destructuring pattern, set breakpoint in binding pattern + if (ts.isBindingPattern(variableDeclaration.name)) { + return spanInBindingPattern(variableDeclaration.name); } - else if (declarations && declarations[0] !== variableDeclaration) { - // If we cant set breakpoint on this declaration, set it on previous one - var indexOfCurrentDeclaration = ts.indexOf(declarations, variableDeclaration); - return spanInVariableDeclaration(declarations[indexOfCurrentDeclaration - 1]); + // Breakpoint is possible in variableDeclaration only if there is initialization + // or its declaration from 'for of' + if (variableDeclaration.initializer || + (variableDeclaration.flags & 1 /* Export */) || + variableDeclaration.parent.parent.kind === 208 /* ForOfStatement */) { + return textSpanFromVariableDeclaration(variableDeclaration); + } + var declarations = variableDeclaration.parent.declarations; + if (declarations && declarations[0] !== variableDeclaration) { + // If we cannot set breakpoint on this declaration, set it on previous one + // Because the variable declaration may be binding pattern and + // we would like to set breakpoint in last binding element if that's the case, + // use preceding token instead + return spanInNode(ts.findPrecedingToken(variableDeclaration.pos, sourceFile, variableDeclaration.parent)); } } function canHaveSpanInParameterDeclaration(parameter) { // Breakpoint is possible on parameter only if it has initializer, is a rest parameter, or has public or private modifier return !!parameter.initializer || parameter.dotDotDotToken !== undefined || - !!(parameter.flags & 8 /* Public */) || !!(parameter.flags & 16 /* Private */); + !!(parameter.flags & 4 /* Public */) || !!(parameter.flags & 8 /* Private */); } function spanInParameterDeclaration(parameter) { - if (canHaveSpanInParameterDeclaration(parameter)) { + if (ts.isBindingPattern(parameter.name)) { + // Set breakpoint in binding pattern + return spanInBindingPattern(parameter.name); + } + else if (canHaveSpanInParameterDeclaration(parameter)) { return textSpan(parameter); } else { @@ -50904,8 +57168,8 @@ var ts; } } function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) { - return !!(functionDeclaration.flags & 2 /* Export */) || - (functionDeclaration.parent.kind === 214 /* ClassDeclaration */ && functionDeclaration.kind !== 144 /* Constructor */); + return !!(functionDeclaration.flags & 1 /* Export */) || + (functionDeclaration.parent.kind === 221 /* ClassDeclaration */ && functionDeclaration.kind !== 148 /* Constructor */); } function spanInFunctionDeclaration(functionDeclaration) { // No breakpoints in the function signature @@ -50928,34 +57192,39 @@ var ts; } function spanInBlock(block) { switch (block.parent.kind) { - case 218 /* ModuleDeclaration */: + case 225 /* ModuleDeclaration */: if (ts.getModuleInstanceState(block.parent) !== 1 /* Instantiated */) { return undefined; } // Set on parent if on same line otherwise on first statement - case 198 /* WhileStatement */: - case 196 /* IfStatement */: - case 200 /* ForInStatement */: - case 201 /* ForOfStatement */: + case 205 /* WhileStatement */: + case 203 /* IfStatement */: + case 207 /* ForInStatement */: return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]); // Set span on previous token if it starts on same line otherwise on the first statement of the block - case 199 /* ForStatement */: + case 206 /* ForStatement */: + case 208 /* ForOfStatement */: return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(block.pos, sourceFile, block.parent), block.statements[0]); } // Default action is to set on first statement return spanInNode(block.statements[0]); } + function spanInInitializerOfForLike(forLikeStatement) { + if (forLikeStatement.initializer.kind === 219 /* VariableDeclarationList */) { + // Declaration list - set breakpoint in first declaration + var variableDeclarationList = forLikeStatement.initializer; + if (variableDeclarationList.declarations.length > 0) { + return spanInNode(variableDeclarationList.declarations[0]); + } + } + else { + // Expression - set breakpoint in it + return spanInNode(forLikeStatement.initializer); + } + } function spanInForStatement(forStatement) { if (forStatement.initializer) { - if (forStatement.initializer.kind === 212 /* VariableDeclarationList */) { - var variableDeclarationList = forStatement.initializer; - if (variableDeclarationList.declarations.length > 0) { - return spanInNode(variableDeclarationList.declarations[0]); - } - } - else { - return spanInNode(forStatement.initializer); - } + return spanInInitializerOfForLike(forStatement); } if (forStatement.condition) { return textSpan(forStatement.condition); @@ -50964,16 +57233,44 @@ var ts; return textSpan(forStatement.incrementor); } } + function spanInBindingPattern(bindingPattern) { + // Set breakpoint in first binding element + var firstBindingElement = ts.forEach(bindingPattern.elements, function (element) { return element.kind !== 193 /* OmittedExpression */ ? element : undefined; }); + if (firstBindingElement) { + return spanInNode(firstBindingElement); + } + // Empty binding pattern of binding element, set breakpoint on binding element + if (bindingPattern.parent.kind === 169 /* BindingElement */) { + return textSpan(bindingPattern.parent); + } + // Variable declaration is used as the span + return textSpanFromVariableDeclaration(bindingPattern.parent); + } + function spanInArrayLiteralOrObjectLiteralDestructuringPattern(node) { + ts.Debug.assert(node.kind !== 168 /* ArrayBindingPattern */ && node.kind !== 167 /* ObjectBindingPattern */); + var elements = node.kind === 170 /* ArrayLiteralExpression */ ? + node.elements : + node.properties; + var firstBindingElement = ts.forEach(elements, function (element) { return element.kind !== 193 /* OmittedExpression */ ? element : undefined; }); + if (firstBindingElement) { + return spanInNode(firstBindingElement); + } + // Could be ArrayLiteral from destructuring assignment or + // just nested element in another destructuring assignment + // set breakpoint on assignment when parent is destructuring assignment + // Otherwise set breakpoint for this element + return textSpan(node.parent.kind === 187 /* BinaryExpression */ ? node.parent : node); + } // Tokens: function spanInOpenBraceToken(node) { switch (node.parent.kind) { - case 217 /* EnumDeclaration */: + case 224 /* EnumDeclaration */: var enumDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), enumDeclaration.members.length ? enumDeclaration.members[0] : enumDeclaration.getLastToken(sourceFile)); - case 214 /* ClassDeclaration */: + case 221 /* ClassDeclaration */: var classDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile)); - case 220 /* CaseBlock */: + case 227 /* CaseBlock */: return spanInNodeIfStartsOnSameLine(node.parent.parent, node.parent.clauses[0]); } // Default to parent node @@ -50981,24 +57278,24 @@ var ts; } function spanInCloseBraceToken(node) { switch (node.parent.kind) { - case 219 /* ModuleBlock */: - // If this is not instantiated module block no bp span + case 226 /* ModuleBlock */: + // If this is not an instantiated module block, no bp span if (ts.getModuleInstanceState(node.parent.parent) !== 1 /* Instantiated */) { return undefined; } - case 217 /* EnumDeclaration */: - case 214 /* ClassDeclaration */: + case 224 /* EnumDeclaration */: + case 221 /* ClassDeclaration */: // Span on close brace token return textSpan(node); - case 192 /* Block */: + case 199 /* Block */: if (ts.isFunctionBlock(node.parent)) { // Span on close brace token return textSpan(node); } - // fall through. - case 244 /* CatchClause */: + // fall through + case 252 /* CatchClause */: return spanInNode(ts.lastOrUndefined(node.parent.statements)); - case 220 /* CaseBlock */: + case 227 /* CaseBlock */: // breakpoint in last statement of the last clause var caseBlock = node.parent; var lastClause = ts.lastOrUndefined(caseBlock.clauses); @@ -51006,33 +57303,66 @@ var ts; return spanInNode(ts.lastOrUndefined(lastClause.statements)); } return undefined; + case 167 /* ObjectBindingPattern */: + // Breakpoint in last binding element or binding pattern if it contains no elements + var bindingPattern = node.parent; + return spanInNode(ts.lastOrUndefined(bindingPattern.elements) || bindingPattern); // Default to parent node default: + if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent)) { + // Breakpoint in last binding element or binding pattern if it contains no elements + var objectLiteral = node.parent; + return textSpan(ts.lastOrUndefined(objectLiteral.properties) || objectLiteral); + } + return spanInNode(node.parent); + } + } + function spanInCloseBracketToken(node) { + switch (node.parent.kind) { + case 168 /* ArrayBindingPattern */: + // Breakpoint in last binding element or binding pattern if it contains no elements + var bindingPattern = node.parent; + return textSpan(ts.lastOrUndefined(bindingPattern.elements) || bindingPattern); + default: + if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent)) { + // Breakpoint in last binding element or binding pattern if it contains no elements + var arrayLiteral = node.parent; + return textSpan(ts.lastOrUndefined(arrayLiteral.elements) || arrayLiteral); + } + // Default to parent node return spanInNode(node.parent); } } function spanInOpenParenToken(node) { - if (node.parent.kind === 197 /* DoStatement */) { - // Go to while keyword and do action instead + if (node.parent.kind === 204 /* DoStatement */ || + node.parent.kind === 174 /* CallExpression */ || + node.parent.kind === 175 /* NewExpression */) { return spanInPreviousNode(node); } + if (node.parent.kind === 178 /* ParenthesizedExpression */) { + return spanInNextNode(node); + } // Default to parent node return spanInNode(node.parent); } function spanInCloseParenToken(node) { // Is this close paren token of parameter list, set span in previous token switch (node.parent.kind) { - case 173 /* FunctionExpression */: - case 213 /* FunctionDeclaration */: - case 174 /* ArrowFunction */: - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: - case 144 /* Constructor */: - case 198 /* WhileStatement */: - case 197 /* DoStatement */: - case 199 /* ForStatement */: + case 179 /* FunctionExpression */: + case 220 /* FunctionDeclaration */: + case 180 /* ArrowFunction */: + case 147 /* MethodDeclaration */: + case 146 /* MethodSignature */: + case 149 /* GetAccessor */: + case 150 /* SetAccessor */: + case 148 /* Constructor */: + case 205 /* WhileStatement */: + case 204 /* DoStatement */: + case 206 /* ForStatement */: + case 208 /* ForOfStatement */: + case 174 /* CallExpression */: + case 175 /* NewExpression */: + case 178 /* ParenthesizedExpression */: return spanInPreviousNode(node); // Default to parent node default: @@ -51041,21 +57371,31 @@ var ts; } function spanInColonToken(node) { // Is this : specifying return annotation of the function declaration - if (ts.isFunctionLike(node.parent) || node.parent.kind === 245 /* PropertyAssignment */) { + if (ts.isFunctionLike(node.parent) || + node.parent.kind === 253 /* PropertyAssignment */ || + node.parent.kind === 142 /* Parameter */) { return spanInPreviousNode(node); } return spanInNode(node.parent); } function spanInGreaterThanOrLessThanToken(node) { - if (node.parent.kind === 171 /* TypeAssertionExpression */) { - return spanInNode(node.parent.expression); + if (node.parent.kind === 177 /* TypeAssertionExpression */) { + return spanInNextNode(node); } return spanInNode(node.parent); } function spanInWhileKeyword(node) { - if (node.parent.kind === 197 /* DoStatement */) { + if (node.parent.kind === 204 /* DoStatement */) { // Set span on while expression - return textSpan(node, ts.findNextToken(node.parent.expression, node.parent)); + return textSpanEndingAtNextToken(node, node.parent.expression); + } + // Default to parent node + return spanInNode(node.parent); + } + function spanInOfKeyword(node) { + if (node.parent.kind === 208 /* ForOfStatement */) { + // Set using next token + return spanInNextNode(node); } // Default to parent node return spanInNode(node.parent); @@ -51082,6 +57422,9 @@ var ts; /// /* @internal */ var debugObjectHost = this; +// We need to use 'null' to interface with the managed side. +/* tslint:disable:no-null-keyword */ +/* tslint:disable:no-in-operator */ /* @internal */ var ts; (function (ts) { @@ -51093,7 +57436,6 @@ var ts; var ScriptSnapshotShimAdapter = (function () { function ScriptSnapshotShimAdapter(scriptSnapshotShim) { this.scriptSnapshotShim = scriptSnapshotShim; - this.lineStartPositions = null; } ScriptSnapshotShimAdapter.prototype.getText = function (start, end) { return this.scriptSnapshotShim.getText(start, end); @@ -51119,7 +57461,7 @@ var ts; } }; return ScriptSnapshotShimAdapter; - })(); + }()); var LanguageServiceShimHostAdapter = (function () { function LanguageServiceShimHostAdapter(shimHost) { var _this = this; @@ -51137,6 +57479,15 @@ var ts; }); }; } + if ("directoryExists" in this.shimHost) { + this.directoryExists = function (directoryName) { return _this.shimHost.directoryExists(directoryName); }; + } + if ("getTypeReferenceDirectiveResolutionsForFile" in this.shimHost) { + this.resolveTypeReferenceDirectives = function (typeDirectiveNames, containingFile) { + var typeDirectivesForFile = JSON.parse(_this.shimHost.getTypeReferenceDirectiveResolutionsForFile(containingFile)); + return ts.map(typeDirectiveNames, function (name) { return ts.lookUp(typeDirectivesForFile, name); }); + }; + } } LanguageServiceShimHostAdapter.prototype.log = function (s) { if (this.loggingEnabled) { @@ -51174,14 +57525,17 @@ var ts; return this.files = JSON.parse(encoded); }; LanguageServiceShimHostAdapter.prototype.getScriptSnapshot = function (fileName) { - // Shim the API changes for 1.5 release. This should be removed once - // TypeScript 1.5 has shipped. - if (this.files && this.files.indexOf(fileName) < 0) { - return undefined; - } var scriptSnapshot = this.shimHost.getScriptSnapshot(fileName); return scriptSnapshot && new ScriptSnapshotShimAdapter(scriptSnapshot); }; + LanguageServiceShimHostAdapter.prototype.getScriptKind = function (fileName) { + if ("getScriptKind" in this.shimHost) { + return this.shimHost.getScriptKind(fileName); + } + else { + return 0 /* Unknown */; + } + }; LanguageServiceShimHostAdapter.prototype.getScriptVersion = function (fileName) { return this.shimHost.getScriptVersion(fileName); }; @@ -51206,17 +57560,10 @@ var ts; return this.shimHost.getCurrentDirectory(); }; LanguageServiceShimHostAdapter.prototype.getDefaultLibFileName = function (options) { - // Wrap the API changes for 1.5 release. This try/catch - // should be removed once TypeScript 1.5 has shipped. - try { - return this.shimHost.getDefaultLibFileName(JSON.stringify(options)); - } - catch (e) { - return ""; - } + return this.shimHost.getDefaultLibFileName(JSON.stringify(options)); }; return LanguageServiceShimHostAdapter; - })(); + }()); ts.LanguageServiceShimHostAdapter = LanguageServiceShimHostAdapter; /** A cancellation that throttles calls to the host */ var ThrottledCancellationToken = (function () { @@ -51238,22 +57585,27 @@ var ts; return false; }; return ThrottledCancellationToken; - })(); + }()); var CoreServicesShimHostAdapter = (function () { function CoreServicesShimHostAdapter(shimHost) { + var _this = this; this.shimHost = shimHost; + if ("directoryExists" in this.shimHost) { + this.directoryExists = function (directoryName) { return _this.shimHost.directoryExists(directoryName); }; + } + if ("realpath" in this.shimHost) { + this.realpath = function (path) { return _this.shimHost.realpath(path); }; + } } - CoreServicesShimHostAdapter.prototype.readDirectory = function (rootDir, extension, exclude) { - // Wrap the API changes for 1.5 release. This try/catch - // should be removed once TypeScript 1.5 has shipped. - // Also consider removing the optional designation for - // the exclude param at this time. + CoreServicesShimHostAdapter.prototype.readDirectory = function (rootDir, extension, exclude, depth) { + // Wrap the API changes for 2.0 release. This try/catch + // should be removed once TypeScript 2.0 has shipped. var encoded; try { - encoded = this.shimHost.readDirectory(rootDir, extension, JSON.stringify(exclude)); + encoded = this.shimHost.readDirectory(rootDir, extension, JSON.stringify(exclude), depth); } catch (e) { - encoded = this.shimHost.readDirectory(rootDir, extension); + encoded = this.shimHost.readDirectory(rootDir, extension, JSON.stringify(exclude)); } return JSON.parse(encoded); }; @@ -51264,18 +57616,19 @@ var ts; return this.shimHost.readFile(fileName); }; return CoreServicesShimHostAdapter; - })(); + }()); ts.CoreServicesShimHostAdapter = CoreServicesShimHostAdapter; function simpleForwardCall(logger, actionDescription, action, logPerformance) { + var start; if (logPerformance) { logger.log(actionDescription); - var start = Date.now(); + start = Date.now(); } var result = action(); if (logPerformance) { var end = Date.now(); logger.log(actionDescription + " completed in " + (end - start) + " msec"); - if (typeof (result) === "string") { + if (typeof result === "string") { var str = result; if (str.length > 128) { str = str.substring(0, 128) + "..."; @@ -51308,7 +57661,7 @@ var ts; this.factory.unregisterShim(this); }; return ShimBase; - })(); + }()); function realizeDiagnostics(diagnostics, newLine) { return diagnostics.map(function (d) { return realizeDiagnostic(d, newLine); }); } @@ -51357,9 +57710,7 @@ var ts; * Update the list of scripts known to the compiler */ LanguageServiceShimObject.prototype.refresh = function (throwOnError) { - this.forwardJSONCall("refresh(" + throwOnError + ")", function () { - return null; - }); + this.forwardJSONCall("refresh(" + throwOnError + ")", function () { return null; }); }; LanguageServiceShimObject.prototype.cleanupSemanticCache = function () { var _this = this; @@ -51374,33 +57725,25 @@ var ts; }; LanguageServiceShimObject.prototype.getSyntacticClassifications = function (fileName, start, length) { var _this = this; - return this.forwardJSONCall("getSyntacticClassifications('" + fileName + "', " + start + ", " + length + ")", function () { - var classifications = _this.languageService.getSyntacticClassifications(fileName, ts.createTextSpan(start, length)); - return classifications; - }); + return this.forwardJSONCall("getSyntacticClassifications('" + fileName + "', " + start + ", " + length + ")", function () { return _this.languageService.getSyntacticClassifications(fileName, ts.createTextSpan(start, length)); }); }; LanguageServiceShimObject.prototype.getSemanticClassifications = function (fileName, start, length) { var _this = this; - return this.forwardJSONCall("getSemanticClassifications('" + fileName + "', " + start + ", " + length + ")", function () { - var classifications = _this.languageService.getSemanticClassifications(fileName, ts.createTextSpan(start, length)); - return classifications; - }); + return this.forwardJSONCall("getSemanticClassifications('" + fileName + "', " + start + ", " + length + ")", function () { return _this.languageService.getSemanticClassifications(fileName, ts.createTextSpan(start, length)); }); }; LanguageServiceShimObject.prototype.getEncodedSyntacticClassifications = function (fileName, start, length) { var _this = this; - return this.forwardJSONCall("getEncodedSyntacticClassifications('" + fileName + "', " + start + ", " + length + ")", function () { - // directly serialize the spans out to a string. This is much faster to decode - // on the managed side versus a full JSON array. - return convertClassifications(_this.languageService.getEncodedSyntacticClassifications(fileName, ts.createTextSpan(start, length))); - }); + return this.forwardJSONCall("getEncodedSyntacticClassifications('" + fileName + "', " + start + ", " + length + ")", + // directly serialize the spans out to a string. This is much faster to decode + // on the managed side versus a full JSON array. + function () { return convertClassifications(_this.languageService.getEncodedSyntacticClassifications(fileName, ts.createTextSpan(start, length))); }); }; LanguageServiceShimObject.prototype.getEncodedSemanticClassifications = function (fileName, start, length) { var _this = this; - return this.forwardJSONCall("getEncodedSemanticClassifications('" + fileName + "', " + start + ", " + length + ")", function () { - // directly serialize the spans out to a string. This is much faster to decode - // on the managed side versus a full JSON array. - return convertClassifications(_this.languageService.getEncodedSemanticClassifications(fileName, ts.createTextSpan(start, length))); - }); + return this.forwardJSONCall("getEncodedSemanticClassifications('" + fileName + "', " + start + ", " + length + ")", + // directly serialize the spans out to a string. This is much faster to decode + // on the managed side versus a full JSON array. + function () { return convertClassifications(_this.languageService.getEncodedSemanticClassifications(fileName, ts.createTextSpan(start, length))); }); }; LanguageServiceShimObject.prototype.getSyntacticDiagnostics = function (fileName) { var _this = this; @@ -51430,10 +57773,7 @@ var ts; */ LanguageServiceShimObject.prototype.getQuickInfoAtPosition = function (fileName, position) { var _this = this; - return this.forwardJSONCall("getQuickInfoAtPosition('" + fileName + "', " + position + ")", function () { - var quickInfo = _this.languageService.getQuickInfoAtPosition(fileName, position); - return quickInfo; - }); + return this.forwardJSONCall("getQuickInfoAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getQuickInfoAtPosition(fileName, position); }); }; /// NAMEORDOTTEDNAMESPAN /** @@ -51442,10 +57782,7 @@ var ts; */ LanguageServiceShimObject.prototype.getNameOrDottedNameSpan = function (fileName, startPos, endPos) { var _this = this; - return this.forwardJSONCall("getNameOrDottedNameSpan('" + fileName + "', " + startPos + ", " + endPos + ")", function () { - var spanInfo = _this.languageService.getNameOrDottedNameSpan(fileName, startPos, endPos); - return spanInfo; - }); + return this.forwardJSONCall("getNameOrDottedNameSpan('" + fileName + "', " + startPos + ", " + endPos + ")", function () { return _this.languageService.getNameOrDottedNameSpan(fileName, startPos, endPos); }); }; /** * STATEMENTSPAN @@ -51453,18 +57790,12 @@ var ts; */ LanguageServiceShimObject.prototype.getBreakpointStatementAtPosition = function (fileName, position) { var _this = this; - return this.forwardJSONCall("getBreakpointStatementAtPosition('" + fileName + "', " + position + ")", function () { - var spanInfo = _this.languageService.getBreakpointStatementAtPosition(fileName, position); - return spanInfo; - }); + return this.forwardJSONCall("getBreakpointStatementAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getBreakpointStatementAtPosition(fileName, position); }); }; /// SIGNATUREHELP LanguageServiceShimObject.prototype.getSignatureHelpItems = function (fileName, position) { var _this = this; - return this.forwardJSONCall("getSignatureHelpItems('" + fileName + "', " + position + ")", function () { - var signatureInfo = _this.languageService.getSignatureHelpItems(fileName, position); - return signatureInfo; - }); + return this.forwardJSONCall("getSignatureHelpItems('" + fileName + "', " + position + ")", function () { return _this.languageService.getSignatureHelpItems(fileName, position); }); }; /// GOTO DEFINITION /** @@ -51473,9 +57804,7 @@ var ts; */ LanguageServiceShimObject.prototype.getDefinitionAtPosition = function (fileName, position) { var _this = this; - return this.forwardJSONCall("getDefinitionAtPosition('" + fileName + "', " + position + ")", function () { - return _this.languageService.getDefinitionAtPosition(fileName, position); - }); + return this.forwardJSONCall("getDefinitionAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getDefinitionAtPosition(fileName, position); }); }; /// GOTO Type /** @@ -51484,29 +57813,24 @@ var ts; */ LanguageServiceShimObject.prototype.getTypeDefinitionAtPosition = function (fileName, position) { var _this = this; - return this.forwardJSONCall("getTypeDefinitionAtPosition('" + fileName + "', " + position + ")", function () { - return _this.languageService.getTypeDefinitionAtPosition(fileName, position); - }); + return this.forwardJSONCall("getTypeDefinitionAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getTypeDefinitionAtPosition(fileName, position); }); }; LanguageServiceShimObject.prototype.getRenameInfo = function (fileName, position) { var _this = this; - return this.forwardJSONCall("getRenameInfo('" + fileName + "', " + position + ")", function () { - return _this.languageService.getRenameInfo(fileName, position); - }); + return this.forwardJSONCall("getRenameInfo('" + fileName + "', " + position + ")", function () { return _this.languageService.getRenameInfo(fileName, position); }); }; LanguageServiceShimObject.prototype.findRenameLocations = function (fileName, position, findInStrings, findInComments) { var _this = this; - return this.forwardJSONCall("findRenameLocations('" + fileName + "', " + position + ", " + findInStrings + ", " + findInComments + ")", function () { - return _this.languageService.findRenameLocations(fileName, position, findInStrings, findInComments); - }); + return this.forwardJSONCall("findRenameLocations('" + fileName + "', " + position + ", " + findInStrings + ", " + findInComments + ")", function () { return _this.languageService.findRenameLocations(fileName, position, findInStrings, findInComments); }); }; /// GET BRACE MATCHING LanguageServiceShimObject.prototype.getBraceMatchingAtPosition = function (fileName, position) { var _this = this; - return this.forwardJSONCall("getBraceMatchingAtPosition('" + fileName + "', " + position + ")", function () { - var textRanges = _this.languageService.getBraceMatchingAtPosition(fileName, position); - return textRanges; - }); + return this.forwardJSONCall("getBraceMatchingAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getBraceMatchingAtPosition(fileName, position); }); + }; + LanguageServiceShimObject.prototype.isValidBraceCompletionAtPostion = function (fileName, position, openingBrace) { + var _this = this; + return this.forwardJSONCall("isValidBraceCompletionAtPostion('" + fileName + "', " + position + ", " + openingBrace + ")", function () { return _this.languageService.isValidBraceCompletionAtPostion(fileName, position, openingBrace); }); }; /// GET SMART INDENT LanguageServiceShimObject.prototype.getIndentationAtPosition = function (fileName, position, options /*Services.EditorOptions*/) { @@ -51519,27 +57843,21 @@ var ts; /// GET REFERENCES LanguageServiceShimObject.prototype.getReferencesAtPosition = function (fileName, position) { var _this = this; - return this.forwardJSONCall("getReferencesAtPosition('" + fileName + "', " + position + ")", function () { - return _this.languageService.getReferencesAtPosition(fileName, position); - }); + return this.forwardJSONCall("getReferencesAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getReferencesAtPosition(fileName, position); }); }; LanguageServiceShimObject.prototype.findReferences = function (fileName, position) { var _this = this; - return this.forwardJSONCall("findReferences('" + fileName + "', " + position + ")", function () { - return _this.languageService.findReferences(fileName, position); - }); + return this.forwardJSONCall("findReferences('" + fileName + "', " + position + ")", function () { return _this.languageService.findReferences(fileName, position); }); }; LanguageServiceShimObject.prototype.getOccurrencesAtPosition = function (fileName, position) { var _this = this; - return this.forwardJSONCall("getOccurrencesAtPosition('" + fileName + "', " + position + ")", function () { - return _this.languageService.getOccurrencesAtPosition(fileName, position); - }); + return this.forwardJSONCall("getOccurrencesAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getOccurrencesAtPosition(fileName, position); }); }; LanguageServiceShimObject.prototype.getDocumentHighlights = function (fileName, position, filesToSearch) { var _this = this; return this.forwardJSONCall("getDocumentHighlights('" + fileName + "', " + position + ")", function () { var results = _this.languageService.getDocumentHighlights(fileName, position, JSON.parse(filesToSearch)); - // workaround for VS document higlighting issue - keep only items from the initial file + // workaround for VS document highlighting issue - keep only items from the initial file var normalizedName = ts.normalizeSlashes(fileName).toLowerCase(); return ts.filter(results, function (r) { return ts.normalizeSlashes(r.fileName).toLowerCase() === normalizedName; }); }); @@ -51552,41 +57870,32 @@ var ts; */ LanguageServiceShimObject.prototype.getCompletionsAtPosition = function (fileName, position) { var _this = this; - return this.forwardJSONCall("getCompletionsAtPosition('" + fileName + "', " + position + ")", function () { - var completion = _this.languageService.getCompletionsAtPosition(fileName, position); - return completion; - }); + return this.forwardJSONCall("getCompletionsAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getCompletionsAtPosition(fileName, position); }); }; /** Get a string based representation of a completion list entry details */ LanguageServiceShimObject.prototype.getCompletionEntryDetails = function (fileName, position, entryName) { var _this = this; - return this.forwardJSONCall("getCompletionEntryDetails('" + fileName + "', " + position + ", " + entryName + ")", function () { - var details = _this.languageService.getCompletionEntryDetails(fileName, position, entryName); - return details; - }); + return this.forwardJSONCall("getCompletionEntryDetails('" + fileName + "', " + position + ", '" + entryName + "')", function () { return _this.languageService.getCompletionEntryDetails(fileName, position, entryName); }); }; LanguageServiceShimObject.prototype.getFormattingEditsForRange = function (fileName, start, end, options /*Services.FormatCodeOptions*/) { var _this = this; return this.forwardJSONCall("getFormattingEditsForRange('" + fileName + "', " + start + ", " + end + ")", function () { var localOptions = JSON.parse(options); - var edits = _this.languageService.getFormattingEditsForRange(fileName, start, end, localOptions); - return edits; + return _this.languageService.getFormattingEditsForRange(fileName, start, end, localOptions); }); }; LanguageServiceShimObject.prototype.getFormattingEditsForDocument = function (fileName, options /*Services.FormatCodeOptions*/) { var _this = this; return this.forwardJSONCall("getFormattingEditsForDocument('" + fileName + "')", function () { var localOptions = JSON.parse(options); - var edits = _this.languageService.getFormattingEditsForDocument(fileName, localOptions); - return edits; + return _this.languageService.getFormattingEditsForDocument(fileName, localOptions); }); }; LanguageServiceShimObject.prototype.getFormattingEditsAfterKeystroke = function (fileName, position, key, options /*Services.FormatCodeOptions*/) { var _this = this; return this.forwardJSONCall("getFormattingEditsAfterKeystroke('" + fileName + "', " + position + ", '" + key + "')", function () { var localOptions = JSON.parse(options); - var edits = _this.languageService.getFormattingEditsAfterKeystroke(fileName, position, key, localOptions); - return edits; + return _this.languageService.getFormattingEditsAfterKeystroke(fileName, position, key, localOptions); }); }; LanguageServiceShimObject.prototype.getDocCommentTemplateAtPosition = function (fileName, position) { @@ -51597,45 +57906,27 @@ var ts; /** Return a list of symbols that are interesting to navigate to */ LanguageServiceShimObject.prototype.getNavigateToItems = function (searchValue, maxResultCount) { var _this = this; - return this.forwardJSONCall("getNavigateToItems('" + searchValue + "', " + maxResultCount + ")", function () { - var items = _this.languageService.getNavigateToItems(searchValue, maxResultCount); - return items; - }); + return this.forwardJSONCall("getNavigateToItems('" + searchValue + "', " + maxResultCount + ")", function () { return _this.languageService.getNavigateToItems(searchValue, maxResultCount); }); }; LanguageServiceShimObject.prototype.getNavigationBarItems = function (fileName) { var _this = this; - return this.forwardJSONCall("getNavigationBarItems('" + fileName + "')", function () { - var items = _this.languageService.getNavigationBarItems(fileName); - return items; - }); + return this.forwardJSONCall("getNavigationBarItems('" + fileName + "')", function () { return _this.languageService.getNavigationBarItems(fileName); }); }; LanguageServiceShimObject.prototype.getOutliningSpans = function (fileName) { var _this = this; - return this.forwardJSONCall("getOutliningSpans('" + fileName + "')", function () { - var items = _this.languageService.getOutliningSpans(fileName); - return items; - }); + return this.forwardJSONCall("getOutliningSpans('" + fileName + "')", function () { return _this.languageService.getOutliningSpans(fileName); }); }; LanguageServiceShimObject.prototype.getTodoComments = function (fileName, descriptors) { var _this = this; - return this.forwardJSONCall("getTodoComments('" + fileName + "')", function () { - var items = _this.languageService.getTodoComments(fileName, JSON.parse(descriptors)); - return items; - }); + return this.forwardJSONCall("getTodoComments('" + fileName + "')", function () { return _this.languageService.getTodoComments(fileName, JSON.parse(descriptors)); }); }; /// Emit LanguageServiceShimObject.prototype.getEmitOutput = function (fileName) { var _this = this; - return this.forwardJSONCall("getEmitOutput('" + fileName + "')", function () { - var output = _this.languageService.getEmitOutput(fileName); - // Shim the API changes for 1.5 release. This should be removed once - // TypeScript 1.5 has shipped. - output.emitOutputStatus = output.emitSkipped ? 1 : 0; - return output; - }); + return this.forwardJSONCall("getEmitOutput('" + fileName + "')", function () { return _this.languageService.getEmitOutput(fileName); }); }; return LanguageServiceShimObject; - })(ShimBase); + }(ShimBase)); function convertClassifications(classifications) { return { spans: classifications.spans.join(","), endOfLineState: classifications.endOfLineState }; } @@ -51654,17 +57945,17 @@ var ts; /// COLORIZATION ClassifierShimObject.prototype.getClassificationsForLine = function (text, lexState, classifyKeywordsInGenerics) { var classification = this.classifier.getClassificationsForLine(text, lexState, classifyKeywordsInGenerics); - var items = classification.entries; var result = ""; - for (var i = 0; i < items.length; i++) { - result += items[i].length + "\n"; - result += items[i].classification + "\n"; + for (var _i = 0, _a = classification.entries; _i < _a.length; _i++) { + var item = _a[_i]; + result += item.length + "\n"; + result += item.classification + "\n"; } result += classification.finalLexState; return result; }; return ClassifierShimObject; - })(ShimBase); + }(ShimBase)); var CoreServicesShimObject = (function (_super) { __extends(CoreServicesShimObject, _super); function CoreServicesShimObject(factory, logger, host) { @@ -51687,33 +57978,47 @@ var ts; }; }); }; + CoreServicesShimObject.prototype.resolveTypeReferenceDirective = function (fileName, typeReferenceDirective, compilerOptionsJson) { + var _this = this; + return this.forwardJSONCall("resolveTypeReferenceDirective(" + fileName + ")", function () { + var compilerOptions = JSON.parse(compilerOptionsJson); + var result = ts.resolveTypeReferenceDirective(typeReferenceDirective, ts.normalizeSlashes(fileName), compilerOptions, _this.host); + return { + resolvedFileName: result.resolvedTypeReferenceDirective ? result.resolvedTypeReferenceDirective.resolvedFileName : undefined, + primary: result.resolvedTypeReferenceDirective ? result.resolvedTypeReferenceDirective.primary : true, + failedLookupLocations: result.failedLookupLocations + }; + }); + }; CoreServicesShimObject.prototype.getPreProcessedFileInfo = function (fileName, sourceTextSnapshot) { + var _this = this; return this.forwardJSONCall("getPreProcessedFileInfo('" + fileName + "')", function () { // for now treat files as JavaScript var result = ts.preProcessFile(sourceTextSnapshot.getText(0, sourceTextSnapshot.getLength()), /* readImportFiles */ true, /* detectJavaScriptImports */ true); - var convertResult = { - referencedFiles: [], - importedFiles: [], + return { + referencedFiles: _this.convertFileReferences(result.referencedFiles), + importedFiles: _this.convertFileReferences(result.importedFiles), ambientExternalModules: result.ambientExternalModules, - isLibFile: result.isLibFile + isLibFile: result.isLibFile, + typeReferenceDirectives: _this.convertFileReferences(result.typeReferenceDirectives) }; - ts.forEach(result.referencedFiles, function (refFile) { - convertResult.referencedFiles.push({ - path: ts.normalizePath(refFile.fileName), - position: refFile.pos, - length: refFile.end - refFile.pos - }); - }); - ts.forEach(result.importedFiles, function (importedFile) { - convertResult.importedFiles.push({ - path: ts.normalizeSlashes(importedFile.fileName), - position: importedFile.pos, - length: importedFile.end - importedFile.pos - }); - }); - return convertResult; }); }; + CoreServicesShimObject.prototype.convertFileReferences = function (refs) { + if (!refs) { + return undefined; + } + var result = []; + for (var _i = 0, refs_2 = refs; _i < refs_2.length; _i++) { + var ref = refs_2[_i]; + result.push({ + path: ts.normalizeSlashes(ref.fileName), + position: ref.pos, + length: ref.end - ref.pos + }); + } + return result; + }; CoreServicesShimObject.prototype.getTSConfigFileInfo = function (fileName, sourceTextSnapshot) { var _this = this; return this.forwardJSONCall("getTSConfigFileInfo('" + fileName + "')", function () { @@ -51722,25 +58027,36 @@ var ts; if (result.error) { return { options: {}, + typingOptions: {}, files: [], - errors: [realizeDiagnostic(result.error, '\r\n')] + raw: {}, + errors: [realizeDiagnostic(result.error, "\r\n")] }; } - var configFile = ts.parseJsonConfigFileContent(result.config, _this.host, ts.getDirectoryPath(ts.normalizeSlashes(fileName))); + var normalizedFileName = ts.normalizeSlashes(fileName); + var configFile = ts.parseJsonConfigFileContent(result.config, _this.host, ts.getDirectoryPath(normalizedFileName), /*existingOptions*/ {}, normalizedFileName); return { options: configFile.options, + typingOptions: configFile.typingOptions, files: configFile.fileNames, - errors: realizeDiagnostics(configFile.errors, '\r\n') + raw: configFile.raw, + errors: realizeDiagnostics(configFile.errors, "\r\n") }; }); }; CoreServicesShimObject.prototype.getDefaultCompilationSettings = function () { - return this.forwardJSONCall("getDefaultCompilationSettings()", function () { - return ts.getDefaultCompilerOptions(); + return this.forwardJSONCall("getDefaultCompilationSettings()", function () { return ts.getDefaultCompilerOptions(); }); + }; + CoreServicesShimObject.prototype.discoverTypings = function (discoverTypingsJson) { + var _this = this; + var getCanonicalFileName = ts.createGetCanonicalFileName(/*useCaseSensitivefileNames:*/ false); + return this.forwardJSONCall("discoverTypings()", function () { + var info = JSON.parse(discoverTypingsJson); + return ts.JsTyping.discoverTypings(_this.host, info.fileNames, ts.toPath(info.projectRootPath, info.projectRootPath, getCanonicalFileName), ts.toPath(info.safeListPath, info.safeListPath, getCanonicalFileName), info.packageNameToTypingLocation, info.typingOptions, info.compilerOptions); }); }; return CoreServicesShimObject; - })(ShimBase); + }(ShimBase)); var TypeScriptServicesFactory = (function () { function TypeScriptServicesFactory() { this._shims = []; @@ -51802,12 +58118,14 @@ var ts; throw new Error("Invalid operation"); }; return TypeScriptServicesFactory; - })(); + }()); ts.TypeScriptServicesFactory = TypeScriptServicesFactory; if (typeof module !== "undefined" && module.exports) { module.exports = ts; } })(ts || (ts = {})); +/* tslint:enable:no-in-operator */ +/* tslint:enable:no-null */ /// TODO: this is used by VS, clean this up on both sides of the interface /* @internal */ var TypeScript; @@ -51817,5 +58135,9 @@ var TypeScript; Services.TypeScriptServicesFactory = ts.TypeScriptServicesFactory; })(Services = TypeScript.Services || (TypeScript.Services = {})); })(TypeScript || (TypeScript = {})); +/* tslint:disable:no-unused-variable */ +// 'toolsVersion' gets consumed by the managed side, so it's not unused. +// TODO: it should be moved into a namespace though. /* @internal */ -var toolsVersion = "1.6"; +var toolsVersion = "1.9"; +/* tslint:enable:no-unused-variable */ diff --git a/package.json b/package.json index 261cdfa64b7..bb476070286 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "typescript", "author": "Microsoft Corp.", "homepage": "http://typescriptlang.org/", - "version": "1.8.0", + "version": "1.9.0", "license": "Apache-2.0", "description": "TypeScript is a language for application scale JavaScript development", "keywords": [ @@ -45,6 +45,7 @@ "build": "npm run build:compiler && npm run build:tests", "build:compiler": "jake local", "build:tests": "jake tests", + "start": "node lib/tsc", "clean": "jake clean", "jake": "jake", "lint": "jake lint", diff --git a/pull_request_template.md b/pull_request_template.md new file mode 100644 index 00000000000..683e6acbf89 --- /dev/null +++ b/pull_request_template.md @@ -0,0 +1,16 @@ + + +Fixes # diff --git a/scripts/configureNightly.ts b/scripts/configureNightly.ts index 640f330b376..8553c15ebd0 100644 --- a/scripts/configureNightly.ts +++ b/scripts/configureNightly.ts @@ -67,7 +67,7 @@ function getNightlyVersionString(versionString: string): string { const now = new Date(); const timeStr = now.toISOString().replace(/:|T|\.|-/g, "").slice(0, 8); - return `${versionString}-dev.${timeStr}`; + return `${versionString}-dev.${timeStr}-1.0`; } main(); \ No newline at end of file diff --git a/scripts/ior.ts b/scripts/ior.ts index f0c142a266c..eb67e62a275 100644 --- a/scripts/ior.ts +++ b/scripts/ior.ts @@ -76,8 +76,11 @@ module Commands { fs.mkdirSync(directoryPath); } } + function normalizeSlashes(path: string): string { + return path.replace(/\\/g, "/"); + } function transalatePath(outputFolder:string, path: string): string { - return outputFolder + directorySeparator + path.replace(":", ""); + return normalizeSlashes(outputFolder + directorySeparator + path.replace(":", "")); } function fileExists(path: string): boolean { return fs.existsSync(path); @@ -86,7 +89,7 @@ module Commands { var filename = transalatePath(outputFolder, f.path); ensureDirectoriesExist(getDirectoryPath(filename)); console.log("writing filename: " + filename); - fs.writeFile(filename, f.result.contents, (err) => { }); + fs.writeFileSync(filename, f.result.contents); }); console.log("Command: tsc "); diff --git a/scripts/tslint/noNullRule.ts b/scripts/tslint/noNullRule.ts deleted file mode 100644 index 8e9deca996b..00000000000 --- a/scripts/tslint/noNullRule.ts +++ /dev/null @@ -1,20 +0,0 @@ -import * as Lint from "tslint/lib/lint"; -import * as ts from "typescript"; - - -export class Rule extends Lint.Rules.AbstractRule { - public static FAILURE_STRING = "Don't use the 'null' keyword - use 'undefined' for missing values instead"; - - public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] { - return this.applyWithWalker(new NullWalker(sourceFile, this.getOptions())); - } -} - -class NullWalker extends Lint.RuleWalker { - visitNode(node: ts.Node) { - super.visitNode(node); - if (node.kind === ts.SyntaxKind.NullKeyword) { - this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.FAILURE_STRING)); - } - } -} diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index f7108c5d2d7..304e77271a7 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -11,19 +11,11 @@ namespace ts { ConstEnumOnly = 2 } - const enum Reachability { - Unintialized = 1 << 0, - Reachable = 1 << 1, - Unreachable = 1 << 2, - ReportedUnreachable = 1 << 3 - } - - function or(state1: Reachability, state2: Reachability): Reachability { - return (state1 | state2) & Reachability.Reachable - ? Reachability.Reachable - : (state1 & state2) & Reachability.ReportedUnreachable - ? Reachability.ReportedUnreachable - : Reachability.Unreachable; + interface ActiveLabel { + name: string; + breakTarget: FlowLabel; + continueTarget: FlowLabel; + referenced: boolean; } export function getModuleInstanceState(node: Node): ModuleInstanceState { @@ -104,6 +96,7 @@ namespace ts { function createBinder(): (file: SourceFile, options: CompilerOptions) => void { let file: SourceFile; let options: CompilerOptions; + let languageVersion: ScriptTarget; let parent: Node; let container: Node; let blockScopeContainer: Node; @@ -112,10 +105,20 @@ namespace ts { // state used by reachability checks let hasExplicitReturn: boolean; - let currentReachabilityState: Reachability; - let labelStack: Reachability[]; - let labelIndexMap: Map; - let implicitLabels: number[]; + let currentFlow: FlowNode; + let currentBreakTarget: FlowLabel; + let currentContinueTarget: FlowLabel; + let currentTrueTarget: FlowLabel; + let currentFalseTarget: FlowLabel; + let preSwitchCaseFlow: FlowNode; + let activeLabels: ActiveLabel[]; + + // state used for emit helpers + let hasClassExtends: boolean; + let hasAsyncFunctions: boolean; + let hasDecorators: boolean; + let hasParameterDecorators: boolean; + let hasJsxSpreadAttribute: boolean; // If this file is an external module, then it is automatically in strict-mode according to // ES6. If it is not an external module, then we'll determine if it is in strict mode or @@ -126,11 +129,17 @@ namespace ts { let Symbol: { new (flags: SymbolFlags, name: string): Symbol }; let classifiableNames: Map; + const unreachableFlow: FlowNode = { flags: FlowFlags.Unreachable }; + const reportedUnreachableFlow: FlowNode = { flags: FlowFlags.Unreachable }; + function bindSourceFile(f: SourceFile, opts: CompilerOptions) { file = f; options = opts; + languageVersion = getEmitScriptTarget(options); inStrictMode = !!file.externalModuleIndicator; classifiableNames = {}; + symbolCount = 0; + Symbol = objectAllocator.getSymbolConstructor(); if (!file.locals) { @@ -141,15 +150,24 @@ namespace ts { file = undefined; options = undefined; + languageVersion = undefined; parent = undefined; container = undefined; blockScopeContainer = undefined; lastContainer = undefined; seenThisKeyword = false; hasExplicitReturn = false; - labelStack = undefined; - labelIndexMap = undefined; - implicitLabels = undefined; + currentFlow = undefined; + currentBreakTarget = undefined; + currentContinueTarget = undefined; + currentTrueTarget = undefined; + currentFalseTarget = undefined; + activeLabels = undefined; + hasClassExtends = false; + hasAsyncFunctions = false; + hasDecorators = false; + hasParameterDecorators = false; + hasJsxSpreadAttribute = false; } return bindSourceFile; @@ -191,8 +209,8 @@ namespace ts { // unless it is a well known Symbol. function getDeclarationName(node: Declaration): string { if (node.name) { - if (node.kind === SyntaxKind.ModuleDeclaration && node.name.kind === SyntaxKind.StringLiteral) { - return `"${(node.name).text}"`; + if (isAmbientModule(node)) { + return isGlobalScopeAugmentation(node) ? "__global" : `"${(node.name).text}"`; } if (node.name.kind === SyntaxKind.ComputedPropertyName) { const nameExpression = (node.name).expression; @@ -240,6 +258,15 @@ namespace ts { case SyntaxKind.FunctionDeclaration: case SyntaxKind.ClassDeclaration: return node.flags & NodeFlags.Default ? "default" : undefined; + case SyntaxKind.JSDocFunctionType: + return isJSDocConstructSignature(node) ? "__new" : "__call"; + case SyntaxKind.Parameter: + // Parameters with names are handled at the top of this function. Parameters + // without names can only come from JSDocFunctionTypes. + Debug.assert(node.parent.kind === SyntaxKind.JSDocFunctionType); + let functionType = node.parent; + let index = indexOf(functionType.parameters, node); + return "p" + index; } } @@ -259,6 +286,7 @@ namespace ts { Debug.assert(!hasDynamicName(node)); const isDefaultExport = node.flags & NodeFlags.Default; + // The exported symbol for an export default function/class node is always named "default" const name = isDefaultExport && parent ? "default" : getDeclarationName(node); @@ -348,7 +376,12 @@ namespace ts { // 2. When we checkIdentifier in the checker, we set its resolved symbol to the local symbol, // but return the export symbol (by calling getExportSymbolOfValueSymbolIfExported). That way // when the emitter comes back to it, it knows not to qualify the name if it was found in a containing scope. - if (hasExportModifier || container.flags & NodeFlags.ExportContext) { + + // NOTE: Nested ambient modules always should go to to 'locals' table to prevent their automatic merge + // during global merging in the checker. Why? The only case when ambient module is permitted inside another module is module augmentation + // and this case is specially handled. Module augmentations should only be merged with original module definition + // and should never be merged directly with other augmentation, and the latter case would be possible if automatic merge is allowed. + if (!isAmbientModule(node) && (hasExportModifier || container.flags & NodeFlags.ExportContext)) { const exportKind = (symbolFlags & SymbolFlags.Value ? SymbolFlags.ExportValue : 0) | (symbolFlags & SymbolFlags.Type ? SymbolFlags.ExportType : 0) | @@ -368,7 +401,7 @@ namespace ts { // the getLocalNameOfContainer function in the type checker to validate that the local name // used for a container is unique. function bindChildren(node: Node) { - // Before we recurse into a node's chilren, we first save the existing parent, container + // Before we recurse into a node's children, we first save the existing parent, container // and block-container. Then after we pop out of processing the children, we restore // these saved values. const saveParent = parent; @@ -393,7 +426,7 @@ namespace ts { // Finally, if this is a block-container, then we clear out any existing .locals object // it may contain within it. This happens in incremental scenarios. Because we can be // reusing a node from a previous compilation, that node may have had 'locals' created - // for it. We must clear this so we don't accidently move any stale data forward from + // for it. We must clear this so we don't accidentally move any stale data forward from // a previous compilation. const containerFlags = getContainerFlags(node); if (containerFlags & ContainerFlags.IsContainer) { @@ -405,17 +438,16 @@ namespace ts { addToContainerChain(container); } - else if (containerFlags & ContainerFlags.IsBlockScopedContainer) { blockScopeContainer = node; blockScopeContainer.locals = undefined; } - let savedReachabilityState: Reachability; - let savedLabelStack: Reachability[]; - let savedLabels: Map; - let savedImplicitLabels: number[]; let savedHasExplicitReturn: boolean; + let savedCurrentFlow: FlowNode; + let savedBreakTarget: FlowLabel; + let savedContinueTarget: FlowLabel; + let savedActiveLabels: ActiveLabel[]; const kind = node.kind; let flags = node.flags; @@ -423,26 +455,35 @@ namespace ts { // reset all reachability check related flags on node (for incremental scenarios) flags &= ~NodeFlags.ReachabilityCheckFlags; + // reset all emit helper flags on node (for incremental scenarios) + flags &= ~NodeFlags.EmitHelperFlags; + if (kind === SyntaxKind.InterfaceDeclaration) { seenThisKeyword = false; } const saveState = kind === SyntaxKind.SourceFile || kind === SyntaxKind.ModuleBlock || isFunctionLikeKind(kind); if (saveState) { - savedReachabilityState = currentReachabilityState; - savedLabelStack = labelStack; - savedLabels = labelIndexMap; - savedImplicitLabels = implicitLabels; savedHasExplicitReturn = hasExplicitReturn; + savedCurrentFlow = currentFlow; + savedBreakTarget = currentBreakTarget; + savedContinueTarget = currentContinueTarget; + savedActiveLabels = activeLabels; - currentReachabilityState = Reachability.Reachable; hasExplicitReturn = false; - labelStack = labelIndexMap = implicitLabels = undefined; + currentFlow = { flags: FlowFlags.Start }; + currentBreakTarget = undefined; + currentContinueTarget = undefined; + activeLabels = undefined; + } + + if (isInJavaScriptFile(node) && node.jsDocComment) { + bind(node.jsDocComment); } bindReachableStatement(node); - if (currentReachabilityState === Reachability.Reachable && isFunctionLikeKind(kind) && nodeIsPresent((node).body)) { + if (!(currentFlow.flags & FlowFlags.Unreachable) && isFunctionLikeKind(kind) && nodeIsPresent((node).body)) { flags |= NodeFlags.HasImplicitReturn; if (hasExplicitReturn) { flags |= NodeFlags.HasExplicitReturn; @@ -453,14 +494,32 @@ namespace ts { flags = seenThisKeyword ? flags | NodeFlags.ContainsThis : flags & ~NodeFlags.ContainsThis; } + if (kind === SyntaxKind.SourceFile) { + if (hasClassExtends) { + flags |= NodeFlags.HasClassExtends; + } + if (hasDecorators) { + flags |= NodeFlags.HasDecorators; + } + if (hasParameterDecorators) { + flags |= NodeFlags.HasParamDecorators; + } + if (hasAsyncFunctions) { + flags |= NodeFlags.HasAsyncFunctions; + } + if (hasJsxSpreadAttribute) { + flags |= NodeFlags.HasJsxSpreadAttribute; + } + } + node.flags = flags; if (saveState) { hasExplicitReturn = savedHasExplicitReturn; - currentReachabilityState = savedReachabilityState; - labelStack = savedLabelStack; - labelIndexMap = savedLabels; - implicitLabels = savedImplicitLabels; + currentFlow = savedCurrentFlow; + currentBreakTarget = savedBreakTarget; + currentContinueTarget = savedContinueTarget; + activeLabels = savedActiveLabels; } container = saveContainer; @@ -515,170 +574,527 @@ namespace ts { case SyntaxKind.LabeledStatement: bindLabeledStatement(node); break; + case SyntaxKind.PrefixUnaryExpression: + bindPrefixUnaryExpressionFlow(node); + break; + case SyntaxKind.BinaryExpression: + bindBinaryExpressionFlow(node); + break; + case SyntaxKind.DeleteExpression: + bindDeleteExpressionFlow(node); + break; + case SyntaxKind.ConditionalExpression: + bindConditionalExpressionFlow(node); + break; + case SyntaxKind.VariableDeclaration: + bindVariableDeclarationFlow(node); + break; default: forEachChild(node, bind); break; } } - function bindWhileStatement(n: WhileStatement): void { - const preWhileState = - n.expression.kind === SyntaxKind.FalseKeyword ? Reachability.Unreachable : currentReachabilityState; - const postWhileState = - n.expression.kind === SyntaxKind.TrueKeyword ? Reachability.Unreachable : currentReachabilityState; - - // bind expressions (don't affect reachability) - bind(n.expression); - - currentReachabilityState = preWhileState; - const postWhileLabel = pushImplicitLabel(); - bind(n.statement); - popImplicitLabel(postWhileLabel, postWhileState); + function isNarrowableReference(expr: Expression): boolean { + return expr.kind === SyntaxKind.Identifier || + expr.kind === SyntaxKind.ThisKeyword || + expr.kind === SyntaxKind.PropertyAccessExpression && isNarrowableReference((expr).expression); } - function bindDoStatement(n: DoStatement): void { - const preDoState = currentReachabilityState; - - const postDoLabel = pushImplicitLabel(); - bind(n.statement); - const postDoState = n.expression.kind === SyntaxKind.TrueKeyword ? Reachability.Unreachable : preDoState; - popImplicitLabel(postDoLabel, postDoState); - - // bind expressions (don't affect reachability) - bind(n.expression); - } - - function bindForStatement(n: ForStatement): void { - const preForState = currentReachabilityState; - const postForLabel = pushImplicitLabel(); - - // bind expressions (don't affect reachability) - bind(n.initializer); - bind(n.condition); - bind(n.incrementor); - - bind(n.statement); - - // for statement is considered infinite when it condition is either omitted or is true keyword - // - for(..;;..) - // - for(..;true;..) - const isInfiniteLoop = (!n.condition || n.condition.kind === SyntaxKind.TrueKeyword); - const postForState = isInfiniteLoop ? Reachability.Unreachable : preForState; - popImplicitLabel(postForLabel, postForState); - } - - function bindForInOrForOfStatement(n: ForInStatement | ForOfStatement): void { - const preStatementState = currentReachabilityState; - const postStatementLabel = pushImplicitLabel(); - - // bind expressions (don't affect reachability) - bind(n.initializer); - bind(n.expression); - - bind(n.statement); - popImplicitLabel(postStatementLabel, preStatementState); - } - - function bindIfStatement(n: IfStatement): void { - // denotes reachability state when entering 'thenStatement' part of the if statement: - // i.e. if condition is false then thenStatement is unreachable - const ifTrueState = n.expression.kind === SyntaxKind.FalseKeyword ? Reachability.Unreachable : currentReachabilityState; - // denotes reachability state when entering 'elseStatement': - // i.e. if condition is true then elseStatement is unreachable - const ifFalseState = n.expression.kind === SyntaxKind.TrueKeyword ? Reachability.Unreachable : currentReachabilityState; - - currentReachabilityState = ifTrueState; - - // bind expression (don't affect reachability) - bind(n.expression); - - bind(n.thenStatement); - if (n.elseStatement) { - const preElseState = currentReachabilityState; - currentReachabilityState = ifFalseState; - bind(n.elseStatement); - currentReachabilityState = or(currentReachabilityState, preElseState); + function isNarrowingExpression(expr: Expression): boolean { + switch (expr.kind) { + case SyntaxKind.Identifier: + case SyntaxKind.ThisKeyword: + case SyntaxKind.PropertyAccessExpression: + return isNarrowableReference(expr); + case SyntaxKind.CallExpression: + return true; + case SyntaxKind.ParenthesizedExpression: + return isNarrowingExpression((expr).expression); + case SyntaxKind.BinaryExpression: + return isNarrowingBinaryExpression(expr); + case SyntaxKind.PrefixUnaryExpression: + return (expr).operator === SyntaxKind.ExclamationToken && isNarrowingExpression((expr).operand); } - else { - currentReachabilityState = or(currentReachabilityState, ifFalseState); + return false; + } + + function isNarrowingBinaryExpression(expr: BinaryExpression) { + switch (expr.operatorToken.kind) { + case SyntaxKind.EqualsToken: + return isNarrowableReference(expr.left); + case SyntaxKind.EqualsEqualsToken: + case SyntaxKind.ExclamationEqualsToken: + case SyntaxKind.EqualsEqualsEqualsToken: + case SyntaxKind.ExclamationEqualsEqualsToken: + if (isNarrowingExpression(expr.left) && (expr.right.kind === SyntaxKind.NullKeyword || expr.right.kind === SyntaxKind.Identifier)) { + return true; + } + if (expr.left.kind === SyntaxKind.TypeOfExpression && isNarrowingExpression((expr.left).expression) && expr.right.kind === SyntaxKind.StringLiteral) { + return true; + } + return false; + case SyntaxKind.InstanceOfKeyword: + return isNarrowingExpression(expr.left); + case SyntaxKind.CommaToken: + return isNarrowingExpression(expr.right); + } + return false; + } + + function createBranchLabel(): FlowLabel { + return { + flags: FlowFlags.BranchLabel, + antecedents: undefined + }; + } + + function createLoopLabel(): FlowLabel { + return { + flags: FlowFlags.LoopLabel, + antecedents: undefined + }; + } + + function setFlowNodeReferenced(flow: FlowNode) { + // On first reference we set the Referenced flag, thereafter we set the Shared flag + flow.flags |= flow.flags & FlowFlags.Referenced ? FlowFlags.Shared : FlowFlags.Referenced; + } + + function addAntecedent(label: FlowLabel, antecedent: FlowNode): void { + if (!(antecedent.flags & FlowFlags.Unreachable) && !contains(label.antecedents, antecedent)) { + (label.antecedents || (label.antecedents = [])).push(antecedent); + setFlowNodeReferenced(antecedent); } } - function bindReturnOrThrow(n: ReturnStatement | ThrowStatement): void { - // bind expression (don't affect reachability) - bind(n.expression); - if (n.kind === SyntaxKind.ReturnStatement) { - hasExplicitReturn = true; + function createFlowCondition(flags: FlowFlags, antecedent: FlowNode, expression: Expression): FlowNode { + if (antecedent.flags & FlowFlags.Unreachable) { + return antecedent; } - currentReachabilityState = Reachability.Unreachable; - } - - function bindBreakOrContinueStatement(n: BreakOrContinueStatement): void { - // call bind on label (don't affect reachability) - bind(n.label); - // for continue case touch label so it will be marked a used - const isValidJump = jumpToLabel(n.label, n.kind === SyntaxKind.BreakStatement ? currentReachabilityState : Reachability.Unreachable); - if (isValidJump) { - currentReachabilityState = Reachability.Unreachable; + if (!expression) { + return flags & FlowFlags.TrueCondition ? antecedent : unreachableFlow; } + if (expression.kind === SyntaxKind.TrueKeyword && flags & FlowFlags.FalseCondition || + expression.kind === SyntaxKind.FalseKeyword && flags & FlowFlags.TrueCondition) { + return unreachableFlow; + } + if (!isNarrowingExpression(expression)) { + return antecedent; + } + setFlowNodeReferenced(antecedent); + return { + flags, + antecedent, + expression, + }; } - function bindTryStatement(n: TryStatement): void { - // catch\finally blocks has the same reachability as try block - const preTryState = currentReachabilityState; - bind(n.tryBlock); - const postTryState = currentReachabilityState; - - currentReachabilityState = preTryState; - bind(n.catchClause); - const postCatchState = currentReachabilityState; - - currentReachabilityState = preTryState; - bind(n.finallyBlock); - - // post catch/finally state is reachable if - // - post try state is reachable - control flow can fall out of try block - // - post catch state is reachable - control flow can fall out of catch block - currentReachabilityState = or(postTryState, postCatchState); + function createFlowAssignment(antecedent: FlowNode, node: Expression | VariableDeclaration | BindingElement): FlowNode { + setFlowNodeReferenced(antecedent); + return { + flags: FlowFlags.Assignment, + antecedent, + node + }; } - function bindSwitchStatement(n: SwitchStatement): void { - const preSwitchState = currentReachabilityState; - const postSwitchLabel = pushImplicitLabel(); - - // bind expression (don't affect reachability) - bind(n.expression); - - bind(n.caseBlock); - - const hasDefault = forEach(n.caseBlock.clauses, c => c.kind === SyntaxKind.DefaultClause); - - // post switch state is unreachable if switch is exaustive (has a default case ) and does not have fallthrough from the last case - const postSwitchState = hasDefault && currentReachabilityState !== Reachability.Reachable ? Reachability.Unreachable : preSwitchState; - - popImplicitLabel(postSwitchLabel, postSwitchState); + function finishFlowLabel(flow: FlowLabel): FlowNode { + const antecedents = flow.antecedents; + if (!antecedents) { + return unreachableFlow; + } + if (antecedents.length === 1) { + return antecedents[0]; + } + return flow; } - function bindCaseBlock(n: CaseBlock): void { - const startState = currentReachabilityState; + function isStatementCondition(node: Node) { + const parent = node.parent; + switch (parent.kind) { + case SyntaxKind.IfStatement: + case SyntaxKind.WhileStatement: + case SyntaxKind.DoStatement: + return (parent).expression === node; + case SyntaxKind.ForStatement: + case SyntaxKind.ConditionalExpression: + return (parent).condition === node; + } + return false; + } - for (const clause of n.clauses) { - currentReachabilityState = startState; - bind(clause); - if (clause.statements.length && currentReachabilityState === Reachability.Reachable && options.noFallthroughCasesInSwitch) { - errorOnFirstToken(clause, Diagnostics.Fallthrough_case_in_switch); + function isLogicalExpression(node: Node) { + while (true) { + if (node.kind === SyntaxKind.ParenthesizedExpression) { + node = (node).expression; + } + else if (node.kind === SyntaxKind.PrefixUnaryExpression && (node).operator === SyntaxKind.ExclamationToken) { + node = (node).operand; + } + else { + return node.kind === SyntaxKind.BinaryExpression && ( + (node).operatorToken.kind === SyntaxKind.AmpersandAmpersandToken || + (node).operatorToken.kind === SyntaxKind.BarBarToken); } } } - function bindLabeledStatement(n: LabeledStatement): void { - // call bind on label (don't affect reachability) - bind(n.label); + function isTopLevelLogicalExpression(node: Node): boolean { + while (node.parent.kind === SyntaxKind.ParenthesizedExpression || + node.parent.kind === SyntaxKind.PrefixUnaryExpression && + (node.parent).operator === SyntaxKind.ExclamationToken) { + node = node.parent; + } + return !isStatementCondition(node) && !isLogicalExpression(node.parent); + } - const ok = pushNamedLabel(n.label); - bind(n.statement); - if (ok) { - popNamedLabel(n.label, currentReachabilityState); + function bindCondition(node: Expression, trueTarget: FlowLabel, falseTarget: FlowLabel) { + const saveTrueTarget = currentTrueTarget; + const saveFalseTarget = currentFalseTarget; + currentTrueTarget = trueTarget; + currentFalseTarget = falseTarget; + bind(node); + currentTrueTarget = saveTrueTarget; + currentFalseTarget = saveFalseTarget; + if (!node || !isLogicalExpression(node)) { + addAntecedent(trueTarget, createFlowCondition(FlowFlags.TrueCondition, currentFlow, node)); + addAntecedent(falseTarget, createFlowCondition(FlowFlags.FalseCondition, currentFlow, node)); + } + } + + function bindIterativeStatement(node: Statement, breakTarget: FlowLabel, continueTarget: FlowLabel): void { + const saveBreakTarget = currentBreakTarget; + const saveContinueTarget = currentContinueTarget; + currentBreakTarget = breakTarget; + currentContinueTarget = continueTarget; + bind(node); + currentBreakTarget = saveBreakTarget; + currentContinueTarget = saveContinueTarget; + } + + function bindWhileStatement(node: WhileStatement): void { + const preWhileLabel = createLoopLabel(); + const preBodyLabel = createBranchLabel(); + const postWhileLabel = createBranchLabel(); + addAntecedent(preWhileLabel, currentFlow); + currentFlow = preWhileLabel; + bindCondition(node.expression, preBodyLabel, postWhileLabel); + currentFlow = finishFlowLabel(preBodyLabel); + bindIterativeStatement(node.statement, postWhileLabel, preWhileLabel); + addAntecedent(preWhileLabel, currentFlow); + currentFlow = finishFlowLabel(postWhileLabel); + } + + function bindDoStatement(node: DoStatement): void { + const preDoLabel = createLoopLabel(); + const preConditionLabel = createBranchLabel(); + const postDoLabel = createBranchLabel(); + addAntecedent(preDoLabel, currentFlow); + currentFlow = preDoLabel; + bindIterativeStatement(node.statement, postDoLabel, preConditionLabel); + addAntecedent(preConditionLabel, currentFlow); + currentFlow = finishFlowLabel(preConditionLabel); + bindCondition(node.expression, preDoLabel, postDoLabel); + currentFlow = finishFlowLabel(postDoLabel); + } + + function bindForStatement(node: ForStatement): void { + const preLoopLabel = createLoopLabel(); + const preBodyLabel = createBranchLabel(); + const postLoopLabel = createBranchLabel(); + bind(node.initializer); + addAntecedent(preLoopLabel, currentFlow); + currentFlow = preLoopLabel; + bindCondition(node.condition, preBodyLabel, postLoopLabel); + currentFlow = finishFlowLabel(preBodyLabel); + bindIterativeStatement(node.statement, postLoopLabel, preLoopLabel); + bind(node.incrementor); + addAntecedent(preLoopLabel, currentFlow); + currentFlow = finishFlowLabel(postLoopLabel); + } + + function bindForInOrForOfStatement(node: ForInStatement | ForOfStatement): void { + const preLoopLabel = createLoopLabel(); + const postLoopLabel = createBranchLabel(); + addAntecedent(preLoopLabel, currentFlow); + currentFlow = preLoopLabel; + bind(node.expression); + addAntecedent(postLoopLabel, currentFlow); + bind(node.initializer); + if (node.initializer.kind !== SyntaxKind.VariableDeclarationList) { + bindAssignmentTargetFlow(node.initializer); + } + bindIterativeStatement(node.statement, postLoopLabel, preLoopLabel); + addAntecedent(preLoopLabel, currentFlow); + currentFlow = finishFlowLabel(postLoopLabel); + } + + function bindIfStatement(node: IfStatement): void { + const thenLabel = createBranchLabel(); + const elseLabel = createBranchLabel(); + const postIfLabel = createBranchLabel(); + bindCondition(node.expression, thenLabel, elseLabel); + currentFlow = finishFlowLabel(thenLabel); + bind(node.thenStatement); + addAntecedent(postIfLabel, currentFlow); + currentFlow = finishFlowLabel(elseLabel); + bind(node.elseStatement); + addAntecedent(postIfLabel, currentFlow); + currentFlow = finishFlowLabel(postIfLabel); + } + + function bindReturnOrThrow(node: ReturnStatement | ThrowStatement): void { + bind(node.expression); + if (node.kind === SyntaxKind.ReturnStatement) { + hasExplicitReturn = true; + } + currentFlow = unreachableFlow; + } + + function findActiveLabel(name: string) { + if (activeLabels) { + for (const label of activeLabels) { + if (label.name === name) { + return label; + } + } + } + return undefined; + } + + function bindbreakOrContinueFlow(node: BreakOrContinueStatement, breakTarget: FlowLabel, continueTarget: FlowLabel) { + const flowLabel = node.kind === SyntaxKind.BreakStatement ? breakTarget : continueTarget; + if (flowLabel) { + addAntecedent(flowLabel, currentFlow); + currentFlow = unreachableFlow; + } + } + + function bindBreakOrContinueStatement(node: BreakOrContinueStatement): void { + bind(node.label); + if (node.label) { + const activeLabel = findActiveLabel(node.label.text); + if (activeLabel) { + activeLabel.referenced = true; + bindbreakOrContinueFlow(node, activeLabel.breakTarget, activeLabel.continueTarget); + } + } + else { + bindbreakOrContinueFlow(node, currentBreakTarget, currentContinueTarget); + } + } + + function bindTryStatement(node: TryStatement): void { + const postFinallyLabel = createBranchLabel(); + const preTryFlow = currentFlow; + // TODO: Every statement in try block is potentially an exit point! + bind(node.tryBlock); + addAntecedent(postFinallyLabel, currentFlow); + if (node.catchClause) { + currentFlow = preTryFlow; + bind(node.catchClause); + addAntecedent(postFinallyLabel, currentFlow); + } + if (node.finallyBlock) { + currentFlow = preTryFlow; + bind(node.finallyBlock); + } + currentFlow = finishFlowLabel(postFinallyLabel); + } + + function bindSwitchStatement(node: SwitchStatement): void { + const postSwitchLabel = createBranchLabel(); + bind(node.expression); + const saveBreakTarget = currentBreakTarget; + const savePreSwitchCaseFlow = preSwitchCaseFlow; + currentBreakTarget = postSwitchLabel; + preSwitchCaseFlow = currentFlow; + bind(node.caseBlock); + addAntecedent(postSwitchLabel, currentFlow); + const hasDefault = forEach(node.caseBlock.clauses, c => c.kind === SyntaxKind.DefaultClause); + if (!hasDefault) { + addAntecedent(postSwitchLabel, preSwitchCaseFlow); + } + currentBreakTarget = saveBreakTarget; + preSwitchCaseFlow = savePreSwitchCaseFlow; + currentFlow = finishFlowLabel(postSwitchLabel); + } + + function bindCaseBlock(node: CaseBlock): void { + const clauses = node.clauses; + for (let i = 0; i < clauses.length; i++) { + const clause = clauses[i]; + if (clause.statements.length) { + if (currentFlow.flags & FlowFlags.Unreachable) { + currentFlow = preSwitchCaseFlow; + } + else { + const preCaseLabel = createBranchLabel(); + addAntecedent(preCaseLabel, preSwitchCaseFlow); + addAntecedent(preCaseLabel, currentFlow); + currentFlow = finishFlowLabel(preCaseLabel); + } + bind(clause); + if (!(currentFlow.flags & FlowFlags.Unreachable) && i !== clauses.length - 1 && options.noFallthroughCasesInSwitch) { + errorOnFirstToken(clause, Diagnostics.Fallthrough_case_in_switch); + } + } + else { + bind(clause); + } + } + } + + function pushActiveLabel(name: string, breakTarget: FlowLabel, continueTarget: FlowLabel): ActiveLabel { + const activeLabel = { + name, + breakTarget, + continueTarget, + referenced: false + }; + (activeLabels || (activeLabels = [])).push(activeLabel); + return activeLabel; + } + + function popActiveLabel() { + activeLabels.pop(); + } + + function bindLabeledStatement(node: LabeledStatement): void { + const preStatementLabel = createLoopLabel(); + const postStatementLabel = createBranchLabel(); + bind(node.label); + addAntecedent(preStatementLabel, currentFlow); + const activeLabel = pushActiveLabel(node.label.text, postStatementLabel, preStatementLabel); + bind(node.statement); + popActiveLabel(); + if (!activeLabel.referenced && !options.allowUnusedLabels) { + file.bindDiagnostics.push(createDiagnosticForNode(node.label, Diagnostics.Unused_label)); + } + addAntecedent(postStatementLabel, currentFlow); + currentFlow = finishFlowLabel(postStatementLabel); + } + + function bindDestructuringTargetFlow(node: Expression) { + if (node.kind === SyntaxKind.BinaryExpression && (node).operatorToken.kind === SyntaxKind.EqualsToken) { + bindAssignmentTargetFlow((node).left); + } + else { + bindAssignmentTargetFlow(node); + } + } + + function bindAssignmentTargetFlow(node: Expression) { + if (isNarrowableReference(node)) { + currentFlow = createFlowAssignment(currentFlow, node); + } + else if (node.kind === SyntaxKind.ArrayLiteralExpression) { + for (const e of (node).elements) { + if (e.kind === SyntaxKind.SpreadElementExpression) { + bindAssignmentTargetFlow((e).expression); + } + else { + bindDestructuringTargetFlow(e); + } + } + } + else if (node.kind === SyntaxKind.ObjectLiteralExpression) { + for (const p of (node).properties) { + if (p.kind === SyntaxKind.PropertyAssignment) { + bindDestructuringTargetFlow((p).initializer); + } + else if (p.kind === SyntaxKind.ShorthandPropertyAssignment) { + bindAssignmentTargetFlow((p).name); + } + } + } + } + + function bindLogicalExpression(node: BinaryExpression, trueTarget: FlowLabel, falseTarget: FlowLabel) { + const preRightLabel = createBranchLabel(); + if (node.operatorToken.kind === SyntaxKind.AmpersandAmpersandToken) { + bindCondition(node.left, preRightLabel, falseTarget); + } + else { + bindCondition(node.left, trueTarget, preRightLabel); + } + currentFlow = finishFlowLabel(preRightLabel); + bind(node.operatorToken); + bindCondition(node.right, trueTarget, falseTarget); + } + + function bindPrefixUnaryExpressionFlow(node: PrefixUnaryExpression) { + if (node.operator === SyntaxKind.ExclamationToken) { + const saveTrueTarget = currentTrueTarget; + currentTrueTarget = currentFalseTarget; + currentFalseTarget = saveTrueTarget; + forEachChild(node, bind); + currentFalseTarget = currentTrueTarget; + currentTrueTarget = saveTrueTarget; + } + else { + forEachChild(node, bind); + } + } + + function bindBinaryExpressionFlow(node: BinaryExpression) { + const operator = node.operatorToken.kind; + if (operator === SyntaxKind.AmpersandAmpersandToken || operator === SyntaxKind.BarBarToken) { + if (isTopLevelLogicalExpression(node)) { + const postExpressionLabel = createBranchLabel(); + bindLogicalExpression(node, postExpressionLabel, postExpressionLabel); + currentFlow = finishFlowLabel(postExpressionLabel); + } + else { + bindLogicalExpression(node, currentTrueTarget, currentFalseTarget); + } + } + else { + forEachChild(node, bind); + if (operator === SyntaxKind.EqualsToken && !isAssignmentTarget(node)) { + bindAssignmentTargetFlow(node.left); + } + } + } + + function bindDeleteExpressionFlow(node: DeleteExpression) { + forEachChild(node, bind); + if (node.expression.kind === SyntaxKind.PropertyAccessExpression) { + bindAssignmentTargetFlow(node.expression); + } + } + + function bindConditionalExpressionFlow(node: ConditionalExpression) { + const trueLabel = createBranchLabel(); + const falseLabel = createBranchLabel(); + const postExpressionLabel = createBranchLabel(); + bindCondition(node.condition, trueLabel, falseLabel); + currentFlow = finishFlowLabel(trueLabel); + bind(node.whenTrue); + addAntecedent(postExpressionLabel, currentFlow); + currentFlow = finishFlowLabel(falseLabel); + bind(node.whenFalse); + addAntecedent(postExpressionLabel, currentFlow); + currentFlow = finishFlowLabel(postExpressionLabel); + } + + function bindInitializedVariableFlow(node: VariableDeclaration | BindingElement) { + const name = node.name; + if (isBindingPattern(name)) { + for (const child of name.elements) { + bindInitializedVariableFlow(child); + } + } + else { + currentFlow = createFlowAssignment(currentFlow, node); + } + } + + function bindVariableDeclarationFlow(node: VariableDeclaration) { + forEachChild(node, bind); + if (node.initializer || node.parent.parent.kind === SyntaxKind.ForInStatement || node.parent.parent.kind === SyntaxKind.ForOfStatement) { + bindInitializedVariableFlow(node); } } @@ -688,8 +1104,9 @@ namespace ts { case SyntaxKind.ClassDeclaration: case SyntaxKind.InterfaceDeclaration: case SyntaxKind.EnumDeclaration: - case SyntaxKind.TypeLiteral: case SyntaxKind.ObjectLiteralExpression: + case SyntaxKind.TypeLiteral: + case SyntaxKind.JSDocRecordType: return ContainerFlags.IsContainer; case SyntaxKind.CallSignature: @@ -702,6 +1119,7 @@ namespace ts { case SyntaxKind.GetAccessor: case SyntaxKind.SetAccessor: case SyntaxKind.FunctionType: + case SyntaxKind.JSDocFunctionType: case SyntaxKind.ConstructorType: case SyntaxKind.FunctionExpression: case SyntaxKind.ArrowFunction: @@ -719,7 +1137,7 @@ namespace ts { case SyntaxKind.Block: // do not treat blocks directly inside a function as a block-scoped-container. - // Locals that reside in this block should go to the function locals. Othewise 'x' + // Locals that reside in this block should go to the function locals. Otherwise 'x' // would not appear to be a redeclaration of a block scoped local in the following // example: // @@ -775,6 +1193,7 @@ namespace ts { case SyntaxKind.TypeLiteral: case SyntaxKind.ObjectLiteralExpression: case SyntaxKind.InterfaceDeclaration: + case SyntaxKind.JSDocRecordType: // Interface/Object-types always have their children added to the 'members' of // their container. They are only accessible through an instance of their // container, and are never in scope otherwise (even inside the body of the @@ -795,6 +1214,7 @@ namespace ts { case SyntaxKind.FunctionDeclaration: case SyntaxKind.FunctionExpression: case SyntaxKind.ArrowFunction: + case SyntaxKind.JSDocFunctionType: case SyntaxKind.TypeAliasDeclaration: // All the children of these container types are never visible through another // symbol (i.e. through another symbol's 'exports' or 'members'). Instead, @@ -843,8 +1263,16 @@ namespace ts { function bindModuleDeclaration(node: ModuleDeclaration) { setExportContextFlag(node); - if (node.name.kind === SyntaxKind.StringLiteral) { - declareSymbolAndAddToSymbolTable(node, SymbolFlags.ValueModule, SymbolFlags.ValueModuleExcludes); + if (isAmbientModule(node)) { + if (node.flags & NodeFlags.Export) { + errorOnFirstToken(node, Diagnostics.export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always_visible); + } + if (isExternalModuleAugmentation(node)) { + declareSymbolAndAddToSymbolTable(node, SymbolFlags.NamespaceModule, SymbolFlags.NamespaceModuleExcludes); + } + else { + declareSymbolAndAddToSymbolTable(node, SymbolFlags.ValueModule, SymbolFlags.ValueModuleExcludes); + } } else { const state = getModuleInstanceState(node); @@ -873,7 +1301,7 @@ namespace ts { } } - function bindFunctionOrConstructorType(node: SignatureDeclaration) { + function bindFunctionOrConstructorType(node: SignatureDeclaration): void { // For a given function symbol "<...>(...) => T" we want to generate a symbol identical // to the one we would get for: { <...>(...): T } // @@ -904,7 +1332,7 @@ namespace ts { const identifier = prop.name; - // ECMA-262 11.1.5 Object Initialiser + // ECMA-262 11.1.5 Object Initializer // If previous is not undefined then throw a SyntaxError exception if any of the following conditions are true // a.This production is contained in strict code and IsDataDescriptor(previous) is true and // IsDataDescriptor(propId.descriptor) is true. @@ -948,7 +1376,7 @@ namespace ts { declareModuleMember(node, symbolFlags, symbolExcludes); break; } - // fall through. + // fall through. default: if (!blockScopeContainer.locals) { blockScopeContainer.locals = {}; @@ -968,7 +1396,8 @@ namespace ts { if (inStrictMode && node.originalKeywordKind >= SyntaxKind.FirstFutureReservedWord && node.originalKeywordKind <= SyntaxKind.LastFutureReservedWord && - !isIdentifierName(node)) { + !isIdentifierName(node) && + !isInAmbientContext(node)) { // Report error only if there are no parse errors in file if (!file.parseDiagnostics.length) { @@ -1057,8 +1486,37 @@ namespace ts { } } + function getStrictModeBlockScopeFunctionDeclarationMessage(node: Node) { + // Provide specialized messages to help the user understand why we think they're in + // strict mode. + if (getContainingClass(node)) { + return Diagnostics.Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Class_definitions_are_automatically_in_strict_mode; + } + + if (file.externalModuleIndicator) { + return Diagnostics.Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Modules_are_automatically_in_strict_mode; + } + + return Diagnostics.Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5; + } + + function checkStrictModeFunctionDeclaration(node: FunctionDeclaration) { + if (languageVersion < ScriptTarget.ES6) { + // Report error if function is not top level function declaration + if (blockScopeContainer.kind !== SyntaxKind.SourceFile && + blockScopeContainer.kind !== SyntaxKind.ModuleDeclaration && + !isFunctionLike(blockScopeContainer)) { + // We check first if the name is inside class declaration or class expression; if so give explicit message + // otherwise report generic error message. + const errorSpan = getErrorSpanForNode(file, node); + file.bindDiagnostics.push(createFileDiagnostic(file, errorSpan.start, errorSpan.length, + getStrictModeBlockScopeFunctionDeclarationMessage(node))); + } + } + } + function checkStrictModeNumericLiteral(node: LiteralExpression) { - if (inStrictMode && node.flags & NodeFlags.OctalLiteral) { + if (inStrictMode && node.isOctalLiteral) { file.bindDiagnostics.push(createDiagnosticForNode(node, Diagnostics.Octal_literals_are_not_allowed_in_strict_mode)); } } @@ -1169,14 +1627,23 @@ namespace ts { // Note: the node text must be exactly "use strict" or 'use strict'. It is not ok for the // string to contain unicode escapes (as per ES5). - return nodeText === "\"use strict\"" || nodeText === "'use strict'"; + return nodeText === '"use strict"' || nodeText === "'use strict'"; } function bindWorker(node: Node) { switch (node.kind) { /* Strict mode checks */ case SyntaxKind.Identifier: + case SyntaxKind.ThisKeyword: + if (currentFlow && (isExpression(node) || parent.kind === SyntaxKind.ShorthandPropertyAssignment)) { + node.flowNode = currentFlow; + } return checkStrictModeIdentifier(node); + case SyntaxKind.PropertyAccessExpression: + if (currentFlow && isNarrowableReference(node)) { + node.flowNode = currentFlow; + } + break; case SyntaxKind.BinaryExpression: if (isInJavaScriptFile(node)) { const specialKind = getSpecialPropertyAssignmentKind(node); @@ -1227,12 +1694,18 @@ namespace ts { return bindVariableDeclarationOrBindingElement(node); case SyntaxKind.PropertyDeclaration: case SyntaxKind.PropertySignature: + case SyntaxKind.JSDocRecordMember: return bindPropertyOrMethodOrAccessor(node, SymbolFlags.Property | ((node).questionToken ? SymbolFlags.Optional : SymbolFlags.None), SymbolFlags.PropertyExcludes); case SyntaxKind.PropertyAssignment: case SyntaxKind.ShorthandPropertyAssignment: return bindPropertyOrMethodOrAccessor(node, SymbolFlags.Property, SymbolFlags.PropertyExcludes); case SyntaxKind.EnumMember: return bindPropertyOrMethodOrAccessor(node, SymbolFlags.EnumMember, SymbolFlags.EnumMemberExcludes); + + case SyntaxKind.JsxSpreadAttribute: + hasJsxSpreadAttribute = true; + return; + case SyntaxKind.CallSignature: case SyntaxKind.ConstructSignature: case SyntaxKind.IndexSignature: @@ -1246,8 +1719,7 @@ namespace ts { return bindPropertyOrMethodOrAccessor(node, SymbolFlags.Method | ((node).questionToken ? SymbolFlags.Optional : SymbolFlags.None), isObjectLiteralMethod(node) ? SymbolFlags.PropertyExcludes : SymbolFlags.MethodExcludes); case SyntaxKind.FunctionDeclaration: - checkStrictModeFunctionName(node); - return declareSymbolAndAddToSymbolTable(node, SymbolFlags.Function, SymbolFlags.FunctionExcludes); + return bindFunctionDeclaration(node); case SyntaxKind.Constructor: return declareSymbolAndAddToSymbolTable(node, SymbolFlags.Constructor, /*symbolExcludes:*/ SymbolFlags.None); case SyntaxKind.GetAccessor: @@ -1256,16 +1728,16 @@ namespace ts { return bindPropertyOrMethodOrAccessor(node, SymbolFlags.SetAccessor, SymbolFlags.SetAccessorExcludes); case SyntaxKind.FunctionType: case SyntaxKind.ConstructorType: + case SyntaxKind.JSDocFunctionType: return bindFunctionOrConstructorType(node); case SyntaxKind.TypeLiteral: + case SyntaxKind.JSDocRecordType: return bindAnonymousDeclaration(node, SymbolFlags.TypeLiteral, "__type"); case SyntaxKind.ObjectLiteralExpression: return bindObjectLiteralExpression(node); case SyntaxKind.FunctionExpression: case SyntaxKind.ArrowFunction: - checkStrictModeFunctionName(node); - const bindingName = (node).name ? (node).name.text : "__function"; - return bindAnonymousDeclaration(node, SymbolFlags.Function, bindingName); + return bindFunctionExpression(node); case SyntaxKind.CallExpression: if (isInJavaScriptFile(node)) { @@ -1292,6 +1764,8 @@ namespace ts { case SyntaxKind.ImportSpecifier: case SyntaxKind.ExportSpecifier: return declareSymbolAndAddToSymbolTable(node, SymbolFlags.Alias, SymbolFlags.AliasExcludes); + case SyntaxKind.GlobalModuleExportDeclaration: + return bindGlobalModuleExportDeclaration(node); case SyntaxKind.ImportClause: return bindImportClause(node); case SyntaxKind.ExportDeclaration: @@ -1331,7 +1805,7 @@ namespace ts { // Export assignment in some sort of block construct bindAnonymousDeclaration(node, SymbolFlags.Alias, getDeclarationName(node)); } - else if (boundExpression.kind === SyntaxKind.Identifier) { + else if (boundExpression.kind === SyntaxKind.Identifier && node.kind === SyntaxKind.ExportAssignment) { // An export default clause with an identifier exports all meanings of that identifier declareSymbol(container.symbol.exports, container.symbol, node, SymbolFlags.Alias, SymbolFlags.PropertyExcludes | SymbolFlags.AliasExcludes); } @@ -1341,6 +1815,33 @@ namespace ts { } } + function bindGlobalModuleExportDeclaration(node: GlobalModuleExportDeclaration) { + if (node.modifiers && node.modifiers.length) { + file.bindDiagnostics.push(createDiagnosticForNode(node, Diagnostics.Modifiers_cannot_appear_here)); + } + + if (node.parent.kind !== SyntaxKind.SourceFile) { + file.bindDiagnostics.push(createDiagnosticForNode(node, Diagnostics.Global_module_exports_may_only_appear_at_top_level)); + return; + } + else { + const parent = node.parent as SourceFile; + + if (!isExternalModule(parent)) { + file.bindDiagnostics.push(createDiagnosticForNode(node, Diagnostics.Global_module_exports_may_only_appear_in_module_files)); + return; + } + + if (!parent.isDeclarationFile) { + file.bindDiagnostics.push(createDiagnosticForNode(node, Diagnostics.Global_module_exports_may_only_appear_in_declaration_files)); + return; + } + } + + file.symbol.globalExports = file.symbol.globalExports || {}; + declareSymbol(file.symbol.globalExports, file.symbol, node, SymbolFlags.Alias, SymbolFlags.AliasExcludes); + } + function bindExportDeclaration(node: ExportDeclaration) { if (!container.symbol || !container.symbol.exports) { // Export * in some sort of block construct @@ -1375,14 +1876,15 @@ namespace ts { function bindModuleExportsAssignment(node: BinaryExpression) { // 'module.exports = expr' assignment setCommonJsModuleIndicator(node); - bindExportAssignment(node); + declareSymbol(file.symbol.exports, file.symbol, node, SymbolFlags.Property | SymbolFlags.Export | SymbolFlags.ValueModule, SymbolFlags.None); } function bindThisPropertyAssignment(node: BinaryExpression) { // Declare a 'member' in case it turns out the container was an ES5 class if (container.kind === SyntaxKind.FunctionExpression || container.kind === SyntaxKind.FunctionDeclaration) { container.symbol.members = container.symbol.members || {}; - declareSymbol(container.symbol.members, container.symbol, node, SymbolFlags.Property, SymbolFlags.PropertyExcludes); + // It's acceptable for multiple 'this' assignments of the same identifier to occur + declareSymbol(container.symbol.members, container.symbol, node, SymbolFlags.Property, SymbolFlags.PropertyExcludes & ~SymbolFlags.Property); } } @@ -1391,8 +1893,16 @@ namespace ts { // Look up the function in the local scope, since prototype assignments should // follow the function declaration - const classId = ((node.left).expression).expression; - const funcSymbol = container.locals[classId.text]; + const leftSideOfAssignment = node.left as PropertyAccessExpression; + const classPrototype = leftSideOfAssignment.expression as PropertyAccessExpression; + const constructorFunction = classPrototype.expression as Identifier; + + // Fix up parent pointers since we're going to use these nodes before we bind into them + leftSideOfAssignment.parent = node; + constructorFunction.parent = classPrototype; + classPrototype.parent = leftSideOfAssignment; + + const funcSymbol = container.locals[constructorFunction.text]; if (!funcSymbol || !(funcSymbol.flags & SymbolFlags.Function)) { return; } @@ -1403,18 +1913,27 @@ namespace ts { } // Declare the method/property - declareSymbol(funcSymbol.members, funcSymbol, node.left, SymbolFlags.Property, SymbolFlags.PropertyExcludes); + declareSymbol(funcSymbol.members, funcSymbol, leftSideOfAssignment, SymbolFlags.Property, SymbolFlags.PropertyExcludes); } function bindCallExpression(node: CallExpression) { // We're only inspecting call expressions to detect CommonJS modules, so we can skip // this check if we've already seen the module indicator - if (!file.commonJsModuleIndicator && isRequireCall(node)) { + if (!file.commonJsModuleIndicator && isRequireCall(node, /*checkArgumentIsStringLiteral*/false)) { setCommonJsModuleIndicator(node); } } function bindClassLikeDeclaration(node: ClassLikeDeclaration) { + if (!isDeclarationFile(file) && !isInAmbientContext(node)) { + if (getClassExtendsHeritageClauseElement(node) !== undefined) { + hasClassExtends = true; + } + if (nodeIsDecorated(node)) { + hasDecorators = true; + } + } + if (node.kind === SyntaxKind.ClassDeclaration) { bindBlockScopedDeclaration(node, SymbolFlags.Class, SymbolFlags.ClassExcludes); } @@ -1484,6 +2003,13 @@ namespace ts { } function bindParameter(node: ParameterDeclaration) { + if (!isDeclarationFile(file) && + !isInAmbientContext(node) && + nodeIsDecorated(node)) { + hasDecorators = true; + hasParameterDecorators = true; + } + if (inStrictMode) { // It is a SyntaxError if the identifier eval or arguments appears within a FormalParameterList of a // strict mode FunctionLikeDeclaration or FunctionExpression(13.1) @@ -1505,7 +2031,45 @@ namespace ts { } } + function bindFunctionDeclaration(node: FunctionDeclaration) { + if (!isDeclarationFile(file) && !isInAmbientContext(node)) { + if (isAsyncFunctionLike(node)) { + hasAsyncFunctions = true; + } + } + + checkStrictModeFunctionName(node); + if (inStrictMode) { + checkStrictModeFunctionDeclaration(node); + return bindBlockScopedDeclaration(node, SymbolFlags.Function, SymbolFlags.FunctionExcludes); + } + else { + return declareSymbolAndAddToSymbolTable(node, SymbolFlags.Function, SymbolFlags.FunctionExcludes); + } + } + + function bindFunctionExpression(node: FunctionExpression) { + if (!isDeclarationFile(file) && !isInAmbientContext(node)) { + if (isAsyncFunctionLike(node)) { + hasAsyncFunctions = true; + } + } + + checkStrictModeFunctionName(node); + const bindingName = (node).name ? (node).name.text : "__function"; + return bindAnonymousDeclaration(node, SymbolFlags.Function, bindingName); + } + function bindPropertyOrMethodOrAccessor(node: Declaration, symbolFlags: SymbolFlags, symbolExcludes: SymbolFlags) { + if (!isDeclarationFile(file) && !isInAmbientContext(node)) { + if (isAsyncFunctionLike(node)) { + hasAsyncFunctions = true; + } + if (nodeIsDecorated(node)) { + hasDecorators = true; + } + } + return hasDynamicName(node) ? bindAnonymousDeclaration(node, symbolFlags, "__computed") : declareSymbolAndAddToSymbolTable(node, symbolFlags, symbolExcludes); @@ -1513,132 +2077,53 @@ namespace ts { // reachability checks - function pushNamedLabel(name: Identifier): boolean { - initializeReachabilityStateIfNecessary(); - - if (hasProperty(labelIndexMap, name.text)) { - return false; - } - labelIndexMap[name.text] = labelStack.push(Reachability.Unintialized) - 1; - return true; - } - - function pushImplicitLabel(): number { - initializeReachabilityStateIfNecessary(); - - const index = labelStack.push(Reachability.Unintialized) - 1; - implicitLabels.push(index); - return index; - } - - function popNamedLabel(label: Identifier, outerState: Reachability): void { - const index = labelIndexMap[label.text]; - Debug.assert(index !== undefined); - Debug.assert(labelStack.length == index + 1); - - labelIndexMap[label.text] = undefined; - - setCurrentStateAtLabel(labelStack.pop(), outerState, label); - } - - function popImplicitLabel(implicitLabelIndex: number, outerState: Reachability): void { - if (labelStack.length !== implicitLabelIndex + 1) { - Debug.assert(false, `Label stack: ${labelStack.length}, index:${implicitLabelIndex}`); - } - - const i = implicitLabels.pop(); - - if (implicitLabelIndex !== i) { - Debug.assert(false, `i: ${i}, index: ${implicitLabelIndex}`); - } - - setCurrentStateAtLabel(labelStack.pop(), outerState, /*name*/ undefined); - } - - function setCurrentStateAtLabel(innerMergedState: Reachability, outerState: Reachability, label: Identifier): void { - if (innerMergedState === Reachability.Unintialized) { - if (label && !options.allowUnusedLabels) { - file.bindDiagnostics.push(createDiagnosticForNode(label, Diagnostics.Unused_label)); - } - currentReachabilityState = outerState; - } - else { - currentReachabilityState = or(innerMergedState, outerState); - } - } - - function jumpToLabel(label: Identifier, outerState: Reachability): boolean { - initializeReachabilityStateIfNecessary(); - - const index = label ? labelIndexMap[label.text] : lastOrUndefined(implicitLabels); - if (index === undefined) { - // reference to unknown label or - // break/continue used outside of loops - return false; - } - const stateAtLabel = labelStack[index]; - labelStack[index] = stateAtLabel === Reachability.Unintialized ? outerState : or(stateAtLabel, outerState); - return true; + function shouldReportErrorOnModuleDeclaration(node: ModuleDeclaration): boolean { + const instanceState = getModuleInstanceState(node); + return instanceState === ModuleInstanceState.Instantiated || (instanceState === ModuleInstanceState.ConstEnumOnly && options.preserveConstEnums); } function checkUnreachable(node: Node): boolean { - switch (currentReachabilityState) { - case Reachability.Unreachable: - const reportError = - // report error on all statements except empty ones - (isStatement(node) && node.kind !== SyntaxKind.EmptyStatement) || - // report error on class declarations - node.kind === SyntaxKind.ClassDeclaration || - // report error on instantiated modules or const-enums only modules if preserveConstEnums is set - (node.kind === SyntaxKind.ModuleDeclaration && shouldReportErrorOnModuleDeclaration(node)) || - // report error on regular enums and const enums if preserveConstEnums is set - (node.kind === SyntaxKind.EnumDeclaration && (!isConstEnumDeclaration(node) || options.preserveConstEnums)); + if (!(currentFlow.flags & FlowFlags.Unreachable)) { + return false; + } + if (currentFlow === unreachableFlow) { + const reportError = + // report error on all statements except empty ones + (isStatement(node) && node.kind !== SyntaxKind.EmptyStatement) || + // report error on class declarations + node.kind === SyntaxKind.ClassDeclaration || + // report error on instantiated modules or const-enums only modules if preserveConstEnums is set + (node.kind === SyntaxKind.ModuleDeclaration && shouldReportErrorOnModuleDeclaration(node)) || + // report error on regular enums and const enums if preserveConstEnums is set + (node.kind === SyntaxKind.EnumDeclaration && (!isConstEnumDeclaration(node) || options.preserveConstEnums)); - if (reportError) { - currentReachabilityState = Reachability.ReportedUnreachable; + if (reportError) { + currentFlow = reportedUnreachableFlow; - // unreachable code is reported if - // - user has explicitly asked about it AND - // - statement is in not ambient context (statements in ambient context is already an error - // so we should not report extras) AND - // - node is not variable statement OR - // - node is block scoped variable statement OR - // - node is not block scoped variable statement and at least one variable declaration has initializer - // Rationale: we don't want to report errors on non-initialized var's since they are hoisted - // On the other side we do want to report errors on non-initialized 'lets' because of TDZ - const reportUnreachableCode = - !options.allowUnreachableCode && - !isInAmbientContext(node) && - ( - node.kind !== SyntaxKind.VariableStatement || - getCombinedNodeFlags((node).declarationList) & NodeFlags.BlockScoped || - forEach((node).declarationList.declarations, d => d.initializer) - ); + // unreachable code is reported if + // - user has explicitly asked about it AND + // - statement is in not ambient context (statements in ambient context is already an error + // so we should not report extras) AND + // - node is not variable statement OR + // - node is block scoped variable statement OR + // - node is not block scoped variable statement and at least one variable declaration has initializer + // Rationale: we don't want to report errors on non-initialized var's since they are hoisted + // On the other side we do want to report errors on non-initialized 'lets' because of TDZ + const reportUnreachableCode = + !options.allowUnreachableCode && + !isInAmbientContext(node) && + ( + node.kind !== SyntaxKind.VariableStatement || + getCombinedNodeFlags((node).declarationList) & NodeFlags.BlockScoped || + forEach((node).declarationList.declarations, d => d.initializer) + ); - if (reportUnreachableCode) { - errorOnFirstToken(node, Diagnostics.Unreachable_code_detected); - } + if (reportUnreachableCode) { + errorOnFirstToken(node, Diagnostics.Unreachable_code_detected); } - case Reachability.ReportedUnreachable: - return true; - default: - return false; + } } - - function shouldReportErrorOnModuleDeclaration(node: ModuleDeclaration): boolean { - const instanceState = getModuleInstanceState(node); - return instanceState === ModuleInstanceState.Instantiated || (instanceState === ModuleInstanceState.ConstEnumOnly && options.preserveConstEnums); - } - } - - function initializeReachabilityStateIfNecessary(): void { - if (labelIndexMap) { - return; - } - currentReachabilityState = Reachability.Reachable; - labelIndexMap = {}; - labelStack = []; - implicitLabels = []; + return true; } } } diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index eb0338c9f57..422e08eccd5 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -5,6 +5,7 @@ namespace ts { let nextSymbolId = 1; let nextNodeId = 1; let nextMergeId = 1; + let nextFlowId = 1; export function getNodeId(node: Node): number { if (!node.id) { @@ -49,8 +50,9 @@ namespace ts { const compilerOptions = host.getCompilerOptions(); const languageVersion = compilerOptions.target || ScriptTarget.ES3; - const modulekind = compilerOptions.module ? compilerOptions.module : languageVersion === ScriptTarget.ES6 ? ModuleKind.ES6 : ModuleKind.None; + const modulekind = getEmitModuleKind(compilerOptions); const allowSyntheticDefaultImports = typeof compilerOptions.allowSyntheticDefaultImports !== "undefined" ? compilerOptions.allowSyntheticDefaultImports : modulekind === ModuleKind.System; + const strictNullChecks = compilerOptions.strictNullChecks; const emitResolver = createResolver(); @@ -65,12 +67,10 @@ namespace ts { getTypeCount: () => typeCount, isUndefinedSymbol: symbol => symbol === undefinedSymbol, isArgumentsSymbol: symbol => symbol === argumentsSymbol, + isUnknownSymbol: symbol => symbol === unknownSymbol, getDiagnostics, getGlobalDiagnostics, - - // The language service will always care about the narrowed type of a symbol, because that is - // the type the language says the symbol should have. - getTypeOfSymbolAtLocation: getNarrowedTypeOfSymbol, + getTypeOfSymbolAtLocation, getSymbolsOfParameterPropertyDeclaration, getDeclaredTypeOfSymbol, getPropertiesOfType, @@ -79,10 +79,13 @@ namespace ts { getIndexTypeOfType, getBaseTypes, getReturnTypeOfSignature, + getNonNullableType, getSymbolsInScope, getSymbolAtLocation, getShorthandAssignmentValueSymbol, + getExportSpecifierLocalTargetSymbol, getTypeAtLocation: getTypeOfNode, + getPropertySymbolOfDestructuringAssignment, typeToString, getSymbolDisplayBuilder, symbolToString, @@ -107,18 +110,20 @@ namespace ts { const unknownSymbol = createSymbol(SymbolFlags.Property | SymbolFlags.Transient, "unknown"); const resolvingSymbol = createSymbol(SymbolFlags.Transient, "__resolving__"); + const nullableWideningFlags = strictNullChecks ? 0 : TypeFlags.ContainsUndefinedOrNull; const anyType = createIntrinsicType(TypeFlags.Any, "any"); const stringType = createIntrinsicType(TypeFlags.String, "string"); const numberType = createIntrinsicType(TypeFlags.Number, "number"); const booleanType = createIntrinsicType(TypeFlags.Boolean, "boolean"); const esSymbolType = createIntrinsicType(TypeFlags.ESSymbol, "symbol"); const voidType = createIntrinsicType(TypeFlags.Void, "void"); - const undefinedType = createIntrinsicType(TypeFlags.Undefined | TypeFlags.ContainsUndefinedOrNull, "undefined"); - const nullType = createIntrinsicType(TypeFlags.Null | TypeFlags.ContainsUndefinedOrNull, "null"); + const undefinedType = createIntrinsicType(TypeFlags.Undefined | nullableWideningFlags, "undefined"); + const nullType = createIntrinsicType(TypeFlags.Null | nullableWideningFlags, "null"); + const emptyArrayElementType = createIntrinsicType(TypeFlags.Undefined | TypeFlags.ContainsUndefinedOrNull, "undefined"); const unknownType = createIntrinsicType(TypeFlags.Any, "unknown"); + const neverType = createIntrinsicType(TypeFlags.Never, "never"); const emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); - const emptyUnionType = emptyObjectType; const emptyGenericType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); emptyGenericType.instantiations = {}; @@ -129,29 +134,38 @@ namespace ts { const noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); - const anySignature = createSignature(undefined, undefined, emptyArray, anyType, 0, /*hasRestParameter*/ false, /*hasStringLiterals*/ false); - const unknownSignature = createSignature(undefined, undefined, emptyArray, unknownType, 0, /*hasRestParameter*/ false, /*hasStringLiterals*/ false); + const anySignature = createSignature(undefined, undefined, undefined, emptyArray, anyType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasStringLiterals*/ false); + const unknownSignature = createSignature(undefined, undefined, undefined, emptyArray, unknownType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasStringLiterals*/ false); + + const enumNumberIndexInfo = createIndexInfo(stringType, /*isReadonly*/ true); const globals: SymbolTable = {}; - let globalESSymbolConstructorSymbol: Symbol; + let getGlobalESSymbolConstructorSymbol: () => Symbol; let getGlobalPromiseConstructorSymbol: () => Symbol; let globalObjectType: ObjectType; let globalFunctionType: ObjectType; let globalArrayType: GenericType; + let globalReadonlyArrayType: GenericType; let globalStringType: ObjectType; let globalNumberType: ObjectType; let globalBooleanType: ObjectType; let globalRegExpType: ObjectType; - let globalTemplateStringsArrayType: ObjectType; - let globalESSymbolType: ObjectType; - let globalIterableType: GenericType; - let globalIteratorType: GenericType; - let globalIterableIteratorType: GenericType; - let anyArrayType: Type; + let anyReadonlyArrayType: Type; + + // The library files are only loaded when the feature is used. + // This allows users to just specify library files they want to used through --lib + // and they will not get an error from not having unrelated library files + let getGlobalTemplateStringsArrayType: () => ObjectType; + + let getGlobalESSymbolType: () => ObjectType; + let getGlobalIterableType: () => GenericType; + let getGlobalIteratorType: () => GenericType; + let getGlobalIterableIteratorType: () => GenericType; + let getGlobalClassDecoratorType: () => ObjectType; let getGlobalParameterDecoratorType: () => ObjectType; let getGlobalPropertyDecoratorType: () => ObjectType; @@ -168,15 +182,14 @@ namespace ts { let deferredNodes: Node[]; + let flowLoopStart = 0; + let flowLoopCount = 0; + let visitedFlowCount = 0; + const tupleTypes: Map = {}; const unionTypes: Map = {}; const intersectionTypes: Map = {}; const stringLiteralTypes: Map = {}; - let emitExtends = false; - let emitDecorate = false; - let emitParam = false; - let emitAwaiter = false; - const emitGenerator = false; const resolutionTargets: TypeSystemEntity[] = []; const resolutionResults: boolean[] = []; @@ -185,32 +198,87 @@ namespace ts { const mergedSymbols: Symbol[] = []; const symbolLinks: SymbolLinks[] = []; const nodeLinks: NodeLinks[] = []; + const flowLoopCaches: Map[] = []; + const flowLoopNodes: FlowNode[] = []; + const flowLoopKeys: string[] = []; + const flowLoopTypes: Type[][] = []; + const visitedFlowNodes: FlowNode[] = []; + const visitedFlowTypes: Type[] = []; const potentialThisCollisions: Node[] = []; const awaitedTypeStack: number[] = []; const diagnostics = createDiagnosticCollection(); - const primitiveTypeInfo: Map<{ type: Type; flags: TypeFlags }> = { - "string": { - type: stringType, - flags: TypeFlags.StringLike - }, - "number": { - type: numberType, - flags: TypeFlags.NumberLike - }, - "boolean": { - type: booleanType, - flags: TypeFlags.Boolean - }, - "symbol": { - type: esSymbolType, - flags: TypeFlags.ESSymbol - }, - "undefined": { - type: undefinedType, - flags: TypeFlags.ContainsUndefinedOrNull - } + const enum TypeFacts { + None = 0, + TypeofEQString = 1 << 0, // typeof x === "string" + TypeofEQNumber = 1 << 1, // typeof x === "number" + TypeofEQBoolean = 1 << 2, // typeof x === "boolean" + TypeofEQSymbol = 1 << 3, // typeof x === "symbol" + TypeofEQObject = 1 << 4, // typeof x === "object" + TypeofEQFunction = 1 << 5, // typeof x === "function" + TypeofEQHostObject = 1 << 6, // typeof x === "xxx" + TypeofNEString = 1 << 7, // typeof x !== "string" + TypeofNENumber = 1 << 8, // typeof x !== "number" + TypeofNEBoolean = 1 << 9, // typeof x !== "boolean" + TypeofNESymbol = 1 << 10, // typeof x !== "symbol" + TypeofNEObject = 1 << 11, // typeof x !== "object" + TypeofNEFunction = 1 << 12, // typeof x !== "function" + TypeofNEHostObject = 1 << 13, // typeof x !== "xxx" + EQUndefined = 1 << 14, // x === undefined + EQNull = 1 << 15, // x === null + EQUndefinedOrNull = 1 << 16, // x == undefined / x == null + NEUndefined = 1 << 17, // x !== undefined + NENull = 1 << 18, // x !== null + NEUndefinedOrNull = 1 << 19, // x != undefined / x != null + Truthy = 1 << 20, // x + Falsy = 1 << 21, // !x + All = (1 << 22) - 1, + // The following members encode facts about particular kinds of types for use in the getTypeFacts function. + // The presence of a particular fact means that the given test is true for some (and possibly all) values + // of that kind of type. + StringStrictFacts = TypeofEQString | TypeofNENumber | TypeofNEBoolean | TypeofNESymbol | TypeofNEObject | TypeofNEFunction | TypeofNEHostObject | NEUndefined | NENull | NEUndefinedOrNull | Truthy | Falsy, + StringFacts = StringStrictFacts | EQUndefined | EQNull | EQUndefinedOrNull, + NumberStrictFacts = TypeofEQNumber | TypeofNEString | TypeofNEBoolean | TypeofNESymbol | TypeofNEObject | TypeofNEFunction | TypeofNEHostObject | NEUndefined | NENull | NEUndefinedOrNull | Truthy | Falsy, + NumberFacts = NumberStrictFacts | EQUndefined | EQNull | EQUndefinedOrNull, + BooleanStrictFacts = TypeofEQBoolean | TypeofNEString | TypeofNENumber | TypeofNESymbol | TypeofNEObject | TypeofNEFunction | TypeofNEHostObject | NEUndefined | NENull | NEUndefinedOrNull | Truthy | Falsy, + BooleanFacts = BooleanStrictFacts | EQUndefined | EQNull | EQUndefinedOrNull, + SymbolStrictFacts = TypeofEQSymbol | TypeofNEString | TypeofNENumber | TypeofNEBoolean | TypeofNEObject | TypeofNEFunction | TypeofNEHostObject | NEUndefined | NENull | NEUndefinedOrNull | Truthy, + SymbolFacts = SymbolStrictFacts | EQUndefined | EQNull | EQUndefinedOrNull | Falsy, + ObjectStrictFacts = TypeofEQObject | TypeofEQHostObject | TypeofNEString | TypeofNENumber | TypeofNEBoolean | TypeofNESymbol | TypeofNEFunction | NEUndefined | NENull | NEUndefinedOrNull | Truthy, + ObjectFacts = ObjectStrictFacts | EQUndefined | EQNull | EQUndefinedOrNull | Falsy, + FunctionStrictFacts = TypeofEQFunction | TypeofEQHostObject | TypeofNEString | TypeofNENumber | TypeofNEBoolean | TypeofNESymbol | TypeofNEObject | NEUndefined | NENull | NEUndefinedOrNull | Truthy, + FunctionFacts = FunctionStrictFacts | EQUndefined | EQNull | EQUndefinedOrNull | Falsy, + UndefinedFacts = TypeofNEString | TypeofNENumber | TypeofNEBoolean | TypeofNESymbol | TypeofNEObject | TypeofNEFunction | TypeofNEHostObject | EQUndefined | EQUndefinedOrNull | NENull | Falsy, + NullFacts = TypeofEQObject | TypeofNEString | TypeofNENumber | TypeofNEBoolean | TypeofNESymbol | TypeofNEFunction | TypeofNEHostObject | EQNull | EQUndefinedOrNull | NEUndefined | Falsy, + } + + const typeofEQFacts: Map = { + "string": TypeFacts.TypeofEQString, + "number": TypeFacts.TypeofEQNumber, + "boolean": TypeFacts.TypeofEQBoolean, + "symbol": TypeFacts.TypeofEQSymbol, + "undefined": TypeFacts.EQUndefined, + "object": TypeFacts.TypeofEQObject, + "function": TypeFacts.TypeofEQFunction + }; + + const typeofNEFacts: Map = { + "string": TypeFacts.TypeofNEString, + "number": TypeFacts.TypeofNENumber, + "boolean": TypeFacts.TypeofNEBoolean, + "symbol": TypeFacts.TypeofNESymbol, + "undefined": TypeFacts.NEUndefined, + "object": TypeFacts.TypeofNEObject, + "function": TypeFacts.TypeofNEFunction + }; + + const typeofTypesByName: Map = { + "string": stringType, + "number": numberType, + "boolean": booleanType, + "symbol": esSymbolType, + "undefined": undefinedType }; let jsxElementType: ObjectType; @@ -228,6 +296,7 @@ namespace ts { const subtypeRelation: Map = {}; const assignableRelation: Map = {}; + const comparableRelation: Map = {}; const identityRelation: Map = {}; // This is for caching the result of getSymbolDisplayBuilder. Do not access directly. @@ -375,6 +444,43 @@ namespace ts { } } + function mergeModuleAugmentation(moduleName: LiteralExpression): void { + const moduleAugmentation = moduleName.parent; + if (moduleAugmentation.symbol.declarations[0] !== moduleAugmentation) { + // this is a combined symbol for multiple augmentations within the same file. + // its symbol already has accumulated information for all declarations + // so we need to add it just once - do the work only for first declaration + Debug.assert(moduleAugmentation.symbol.declarations.length > 1); + return; + } + + if (isGlobalScopeAugmentation(moduleAugmentation)) { + mergeSymbolTable(globals, moduleAugmentation.symbol.exports); + } + else { + // find a module that about to be augmented + // do not validate names of augmentations that are defined in ambient context + const moduleNotFoundError = !isInAmbientContext(moduleName.parent.parent) + ? Diagnostics.Invalid_module_name_in_augmentation_module_0_cannot_be_found + : undefined; + let mainModule = resolveExternalModuleNameWorker(moduleName, moduleName, moduleNotFoundError); + if (!mainModule) { + return; + } + // obtain item referenced by 'export=' + mainModule = resolveExternalModuleSymbol(mainModule); + if (mainModule.flags & SymbolFlags.Namespace) { + // if module symbol has already been merged - it is safe to use it. + // otherwise clone it + mainModule = mainModule.flags & SymbolFlags.Merged ? mainModule : cloneSymbol(mainModule); + mergeSymbol(mainModule, moduleAugmentation.symbol); + } + else { + error(moduleName, Diagnostics.Cannot_augment_module_0_because_it_resolves_to_a_non_module_entity, moduleName.text); + } + } + } + function addToSymbolTable(target: SymbolTable, source: SymbolTable, message: DiagnosticMessage) { for (const id in source) { if (hasProperty(source, id)) { @@ -404,22 +510,10 @@ namespace ts { return nodeLinks[nodeId] || (nodeLinks[nodeId] = {}); } - function getSourceFile(node: Node): SourceFile { - return getAncestor(node, SyntaxKind.SourceFile); - } - function isGlobalSourceFile(node: Node) { return node.kind === SyntaxKind.SourceFile && !isExternalOrCommonJsModule(node); } - /** Is this type one of the apparent types created from the primitive types. */ - function isPrimitiveApparentType(type: Type): boolean { - return type === globalStringType || - type === globalNumberType || - type === globalBooleanType || - type === globalESSymbolType; - } - function getSymbol(symbols: SymbolTable, name: string, meaning: SymbolFlags): Symbol { if (meaning && hasProperty(symbols, name)) { const symbol = symbols[name]; @@ -442,13 +536,13 @@ namespace ts { * Get symbols that represent parameter-property-declaration as parameter and as property declaration * @param parameter a parameterDeclaration node * @param parameterName a name of the parameter to get the symbols for. - * @return a tuple of two symbols + * @return a tuple of two symbols */ function getSymbolsOfParameterPropertyDeclaration(parameter: ParameterDeclaration, parameterName: string): [Symbol, Symbol] { - const constructoDeclaration = parameter.parent; + const constructorDeclaration = parameter.parent; const classDeclaration = parameter.parent.parent; - const parameterSymbol = getSymbol(constructoDeclaration.locals, parameterName, SymbolFlags.Value); + const parameterSymbol = getSymbol(constructorDeclaration.locals, parameterName, SymbolFlags.Value); const propertySymbol = getSymbol(classDeclaration.symbol.members, parameterName, SymbolFlags.Value); if (parameterSymbol && propertySymbol) { @@ -485,18 +579,28 @@ namespace ts { function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration: VariableDeclaration, usage: Node): boolean { const container = getEnclosingBlockScopeContainer(declaration); - if (declaration.parent.parent.kind === SyntaxKind.VariableStatement || - declaration.parent.parent.kind === SyntaxKind.ForStatement) { - // variable statement/for statement case, - // use site should not be inside variable declaration (initializer of declaration or binding element) - return isSameScopeDescendentOf(usage, declaration, container); + switch (declaration.parent.parent.kind) { + case SyntaxKind.VariableStatement: + case SyntaxKind.ForStatement: + case SyntaxKind.ForOfStatement: + // variable statement/for/for-of statement case, + // use site should not be inside variable declaration (initializer of declaration or binding element) + if (isSameScopeDescendentOf(usage, declaration, container)) { + return true; + } + break; } - else if (declaration.parent.parent.kind === SyntaxKind.ForOfStatement || - declaration.parent.parent.kind === SyntaxKind.ForInStatement) { - // ForIn/ForOf case - use site should not be used in expression part - const expression = (declaration.parent.parent).expression; - return isSameScopeDescendentOf(usage, expression, container); + + switch (declaration.parent.parent.kind) { + case SyntaxKind.ForInStatement: + case SyntaxKind.ForOfStatement: + // ForIn/ForOf case - use site should not be used in expression part + if (isSameScopeDescendentOf(usage, (declaration.parent.parent).expression, container)) { + return true; + } } + + return false; } function isUsedInFunctionOrNonStaticProperty(declaration: Declaration, usage: Node): boolean { @@ -546,7 +650,9 @@ namespace ts { // - Type parameters of a function are in scope in the entire function declaration, including the parameter // list and return type. However, local types are only in scope in the function body. // - parameters are only in the scope of function body - if (meaning & result.flags & SymbolFlags.Type) { + // This restriction does not apply to JSDoc comment types because they are parented + // at a higher level than type parameters would normally be + if (meaning & result.flags & SymbolFlags.Type && lastLocation.kind !== SyntaxKind.JSDocComment) { useResult = result.flags & SymbolFlags.TypeParameter // type parameters are visible in parameter list, return type and type parameter list ? lastLocation === (location).type || @@ -582,8 +688,7 @@ namespace ts { if (!isExternalOrCommonJsModule(location)) break; case SyntaxKind.ModuleDeclaration: const moduleExports = getSymbolOfNode(location).exports; - if (location.kind === SyntaxKind.SourceFile || - (location.kind === SyntaxKind.ModuleDeclaration && (location).name.kind === SyntaxKind.StringLiteral)) { + if (location.kind === SyntaxKind.SourceFile || isAmbientModule(location)) { // It's an external module. First see if the module has an export default and if the local // name of that export default matches. @@ -739,7 +844,9 @@ namespace ts { if (!result) { if (nameNotFoundMessage) { - error(errorLocation, nameNotFoundMessage, typeof nameArg === "string" ? nameArg : declarationNameToString(nameArg)); + if (!checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg)) { + error(errorLocation, nameNotFoundMessage, typeof nameArg === "string" ? nameArg : declarationNameToString(nameArg)); + } } return undefined; } @@ -776,6 +883,43 @@ namespace ts { return result; } + function checkAndReportErrorForMissingPrefix(errorLocation: Node, name: string, nameArg: string | Identifier): boolean { + if (!errorLocation || (errorLocation.kind === SyntaxKind.Identifier && (isTypeReferenceIdentifier(errorLocation)) || isInTypeQuery(errorLocation))) { + return false; + } + + const container = getThisContainer(errorLocation, /* includeArrowFunctions */ true); + let location = container; + while (location) { + if (isClassLike(location.parent)) { + const classSymbol = getSymbolOfNode(location.parent); + if (!classSymbol) { + break; + } + + // Check to see if a static member exists. + const constructorType = getTypeOfSymbol(classSymbol); + if (getPropertyOfType(constructorType, name)) { + error(errorLocation, Diagnostics.Cannot_find_name_0_Did_you_mean_the_static_member_1_0, typeof nameArg === "string" ? nameArg : declarationNameToString(nameArg), symbolToString(classSymbol)); + return true; + } + + // No static member is present. + // Check if we're in an instance method and look for a relevant instance member. + if (location === container && !(location.flags & NodeFlags.Static)) { + const instanceType = (getDeclaredTypeOfSymbol(classSymbol)).thisType; + if (getPropertyOfType(instanceType, name)) { + error(errorLocation, Diagnostics.Cannot_find_name_0_Did_you_mean_the_instance_member_this_0, typeof nameArg === "string" ? nameArg : declarationNameToString(nameArg)); + return true; + } + } + } + + location = location.parent; + } + return false; + } + function checkResolvedBlockScopedVariable(result: Symbol, errorLocation: Node): void { Debug.assert((result.flags & SymbolFlags.BlockScopedVariable) !== 0); // Block-scoped variables cannot be used before their definition @@ -830,13 +974,17 @@ namespace ts { function getTargetOfImportClause(node: ImportClause): Symbol { const moduleSymbol = resolveExternalModuleName(node, (node.parent).moduleSpecifier); + if (moduleSymbol) { - const exportDefaultSymbol = resolveSymbol(moduleSymbol.exports["default"]); + const exportDefaultSymbol = moduleSymbol.exports["export="] ? + getPropertyOfType(getTypeOfSymbol(moduleSymbol.exports["export="]), "default") : + resolveSymbol(moduleSymbol.exports["default"]); + if (!exportDefaultSymbol && !allowSyntheticDefaultImports) { error(node.name, Diagnostics.Module_0_has_no_default_export, symbolToString(moduleSymbol)); } else if (!exportDefaultSymbol && allowSyntheticDefaultImports) { - return resolveSymbol(moduleSymbol.exports["export="]) || resolveSymbol(moduleSymbol); + return resolveExternalModuleSymbol(moduleSymbol) || resolveSymbol(moduleSymbol); } return exportDefaultSymbol; } @@ -902,8 +1050,17 @@ namespace ts { if (targetSymbol) { const name = specifier.propertyName || specifier.name; if (name.text) { + let symbolFromVariable: Symbol; + // First check if module was specified with "export=". If so, get the member from the resolved type + if (moduleSymbol && moduleSymbol.exports && moduleSymbol.exports["export="]) { + symbolFromVariable = getPropertyOfType(getTypeOfSymbol(targetSymbol), name.text); + } + else { + symbolFromVariable = getPropertyOfVariable(targetSymbol, name.text); + } + // if symbolFromVariable is export - get its final target + symbolFromVariable = resolveSymbol(symbolFromVariable); const symbolFromModule = getExportOfModule(targetSymbol, name.text); - const symbolFromVariable = getPropertyOfVariable(targetSymbol, name.text); const symbol = symbolFromModule && symbolFromVariable ? combineValueAndTypeSymbols(symbolFromVariable, symbolFromModule) : symbolFromModule || symbolFromVariable; @@ -919,6 +1076,10 @@ namespace ts { return getExternalModuleMember(node.parent.parent.parent, node); } + function getTargetOfGlobalModuleExportDeclaration(node: GlobalModuleExportDeclaration): Symbol { + return resolveExternalModuleSymbol(node.parent.symbol); + } + function getTargetOfExportSpecifier(node: ExportSpecifier): Symbol { return (node.parent.parent).moduleSpecifier ? getExternalModuleMember(node.parent.parent, node) : @@ -943,6 +1104,8 @@ namespace ts { return getTargetOfExportSpecifier(node); case SyntaxKind.ExportAssignment: return getTargetOfExportAssignment(node); + case SyntaxKind.GlobalModuleExportDeclaration: + return getTargetOfGlobalModuleExportDeclaration(node); } } @@ -974,9 +1137,8 @@ namespace ts { const symbol = getSymbolOfNode(node); const target = resolveAlias(symbol); if (target) { - const markAlias = - (target === unknownSymbol && compilerOptions.isolatedModules) || - (target !== unknownSymbol && (target.flags & SymbolFlags.Value) && !isConstEnumOrConstEnumOnlyModule(target)); + const markAlias = target === unknownSymbol || + ((target.flags & SymbolFlags.Value) && !isConstEnumOrConstEnumOnlyModule(target)); if (markAlias) { markAliasSymbolAsReferenced(symbol); @@ -1077,6 +1239,10 @@ namespace ts { } function resolveExternalModuleName(location: Node, moduleReferenceExpression: Expression): Symbol { + return resolveExternalModuleNameWorker(location, moduleReferenceExpression, Diagnostics.Cannot_find_module_0); + } + + function resolveExternalModuleNameWorker(location: Node, moduleReferenceExpression: Expression, moduleNotFoundError: DiagnosticMessage): Symbol { if (moduleReferenceExpression.kind !== SyntaxKind.StringLiteral) { return; } @@ -1093,28 +1259,37 @@ namespace ts { const isRelative = isExternalModuleNameRelative(moduleName); if (!isRelative) { - const symbol = getSymbol(globals, "\"" + moduleName + "\"", SymbolFlags.ValueModule); + const symbol = getSymbol(globals, '"' + moduleName + '"', SymbolFlags.ValueModule); if (symbol) { - return symbol; + // merged symbol is module declaration symbol combined with all augmentations + return getMergedSymbol(symbol); } } - const resolvedModule = getResolvedModule(getSourceFile(location), moduleReferenceLiteral.text); + const resolvedModule = getResolvedModule(getSourceFileOfNode(location), moduleReferenceLiteral.text); const sourceFile = resolvedModule && host.getSourceFile(resolvedModule.resolvedFileName); if (sourceFile) { if (sourceFile.symbol) { - return sourceFile.symbol; + // merged symbol is module declaration symbol combined with all augmentations + return getMergedSymbol(sourceFile.symbol); } - error(moduleReferenceLiteral, Diagnostics.File_0_is_not_a_module, sourceFile.fileName); - return; + if (moduleNotFoundError) { + // report errors only if it was requested + error(moduleReferenceLiteral, Diagnostics.File_0_is_not_a_module, sourceFile.fileName); + } + return undefined; } - error(moduleReferenceLiteral, Diagnostics.Cannot_find_module_0, moduleName); + if (moduleNotFoundError) { + // report errors only if it was requested + error(moduleReferenceLiteral, moduleNotFoundError, moduleName); + } + return undefined; } // An external module with an 'export =' declaration resolves to the target of the 'export =' declaration, // and an external module with no 'export =' declaration resolves to the module itself. function resolveExternalModuleSymbol(moduleSymbol: Symbol): Symbol { - return moduleSymbol && resolveSymbol(moduleSymbol.exports["export="]) || moduleSymbol; + return moduleSymbol && getMergedSymbol(resolveSymbol(moduleSymbol.exports["export="])) || moduleSymbol; } // An external module with an 'export =' declaration may be referenced as an ES6 module provided the 'export =' @@ -1129,8 +1304,8 @@ namespace ts { return symbol; } - function getExportAssignmentSymbol(moduleSymbol: Symbol): Symbol { - return moduleSymbol.exports["export="]; + function hasExportAssignmentSymbol(moduleSymbol: Symbol): boolean { + return moduleSymbol.exports["export="] !== undefined; } function getExportsOfModuleAsArray(moduleSymbol: Symbol): Symbol[] { @@ -1318,19 +1493,19 @@ namespace ts { return result || emptyArray; } - function setObjectTypeMembers(type: ObjectType, members: SymbolTable, callSignatures: Signature[], constructSignatures: Signature[], stringIndexType: Type, numberIndexType: Type): ResolvedType { + function setObjectTypeMembers(type: ObjectType, members: SymbolTable, callSignatures: Signature[], constructSignatures: Signature[], stringIndexInfo: IndexInfo, numberIndexInfo: IndexInfo): ResolvedType { (type).members = members; (type).properties = getNamedMembers(members); (type).callSignatures = callSignatures; (type).constructSignatures = constructSignatures; - if (stringIndexType) (type).stringIndexType = stringIndexType; - if (numberIndexType) (type).numberIndexType = numberIndexType; + if (stringIndexInfo) (type).stringIndexInfo = stringIndexInfo; + if (numberIndexInfo) (type).numberIndexInfo = numberIndexInfo; return type; } - function createAnonymousType(symbol: Symbol, members: SymbolTable, callSignatures: Signature[], constructSignatures: Signature[], stringIndexType: Type, numberIndexType: Type): ResolvedType { + function createAnonymousType(symbol: Symbol, members: SymbolTable, callSignatures: Signature[], constructSignatures: Signature[], stringIndexInfo: IndexInfo, numberIndexInfo: IndexInfo): ResolvedType { return setObjectTypeMembers(createObjectType(TypeFlags.Anonymous, symbol), - members, callSignatures, constructSignatures, stringIndexType, numberIndexType); + members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo); } function forEachSymbolTableInScope(enclosingDeclaration: Node, callback: (symbolTable: SymbolTable) => T): T { @@ -1352,12 +1527,6 @@ namespace ts { return result; } break; - case SyntaxKind.ClassDeclaration: - case SyntaxKind.InterfaceDeclaration: - if (result = callback(getSymbolOfNode(location).members)) { - return result; - } - break; } } @@ -1385,7 +1554,7 @@ namespace ts { function isAccessible(symbolFromSymbolTable: Symbol, resolvedAliasSymbol?: Symbol) { if (symbol === (resolvedAliasSymbol || symbolFromSymbolTable)) { // if the symbolFromSymbolTable is not external module (it could be if it was determined as ambient external module and would be in globals table) - // and if symbolfrom symbolTable or alias resolution matches the symbol, + // and if symbolFromSymbolTable or alias resolution matches the symbol, // check the symbol can be qualified, it is only then this symbol is accessible return !forEach(symbolFromSymbolTable.declarations, hasExternalModuleSymbol) && canQualifySymbol(symbolFromSymbolTable, meaning); @@ -1423,7 +1592,9 @@ namespace ts { } if (symbol) { - return forEachSymbolTableInScope(enclosingDeclaration, getAccessibleSymbolChainFromSymbolTable); + if (!(isPropertyOrMethodDeclarationSymbol(symbol))) { + return forEachSymbolTableInScope(enclosingDeclaration, getAccessibleSymbolChainFromSymbolTable); + } } } @@ -1456,7 +1627,25 @@ namespace ts { return qualify; } - function isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessiblityResult { + function isPropertyOrMethodDeclarationSymbol(symbol: Symbol) { + if (symbol.declarations && symbol.declarations.length) { + for (const declaration of symbol.declarations) { + switch (declaration.kind) { + case SyntaxKind.PropertyDeclaration: + case SyntaxKind.MethodDeclaration: + case SyntaxKind.GetAccessor: + case SyntaxKind.SetAccessor: + continue; + default: + return false; + } + } + return true; + } + return false; + } + + function isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessibilityResult { if (symbol && enclosingDeclaration && !(symbol.flags & SymbolFlags.TypeParameter)) { const initialSymbol = symbol; let meaningToLook = meaning; @@ -1466,7 +1655,7 @@ namespace ts { if (accessibleSymbolChain) { const hasAccessibleDeclarations = hasVisibleDeclarations(accessibleSymbolChain[0]); if (!hasAccessibleDeclarations) { - return { + return { accessibility: SymbolAccessibility.NotAccessible, errorSymbolName: symbolToString(initialSymbol, enclosingDeclaration, meaning), errorModuleName: symbol !== initialSymbol ? symbolToString(symbol, enclosingDeclaration, SymbolFlags.Namespace) : undefined, @@ -1525,8 +1714,7 @@ namespace ts { } function hasExternalModuleSymbol(declaration: Node) { - return (declaration.kind === SyntaxKind.ModuleDeclaration && (declaration).name.kind === SyntaxKind.StringLiteral) || - (declaration.kind === SyntaxKind.SourceFile && isExternalOrCommonJsModule(declaration)); + return isAmbientModule(declaration) || (declaration.kind === SyntaxKind.SourceFile && isExternalOrCommonJsModule(declaration)); } function hasVisibleDeclarations(symbol: Symbol): SymbolVisibilityResult { @@ -1568,7 +1756,7 @@ namespace ts { function isEntityNameVisible(entityName: EntityName | Expression, enclosingDeclaration: Node): SymbolVisibilityResult { // get symbol of the first identifier of the entityName let meaning: SymbolFlags; - if (entityName.parent.kind === SyntaxKind.TypeQuery) { + if (entityName.parent.kind === SyntaxKind.TypeQuery || isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) { // Typeof value meaning = SymbolFlags.Value | SymbolFlags.ExportValue; } @@ -1637,6 +1825,25 @@ namespace ts { return result; } + function typePredicateToString(typePredicate: TypePredicate, enclosingDeclaration?: Declaration, flags?: TypeFormatFlags): string { + const writer = getSingleLineStringWriter(); + getSymbolDisplayBuilder().buildTypePredicateDisplay(typePredicate, writer, enclosingDeclaration, flags); + const result = writer.string(); + releaseStringWriter(writer); + + return result; + } + + function visibilityToString(flags: NodeFlags) { + if (flags === NodeFlags.Private) { + return "private"; + } + if (flags === NodeFlags.Protected) { + return "protected"; + } + return "public"; + } + function getTypeAliasForTypeLiteral(type: Type): Symbol { if (type.symbol && type.symbol.flags & SymbolFlags.TypeLiteral) { let node = type.symbol.declarations[0].parent; @@ -1650,6 +1857,12 @@ namespace ts { return undefined; } + function isTopLevelInExternalModuleAugmentation(node: Node): boolean { + return node && node.parent && + node.parent.kind === SyntaxKind.ModuleBlock && + isExternalModuleAugmentation(node.parent.parent); + } + function getSymbolDisplayBuilder(): SymbolDisplayBuilder { function getNameOfSymbol(symbol: Symbol): string { @@ -1671,12 +1884,38 @@ namespace ts { /** * Writes only the name of the symbol out to the writer. Uses the original source text - * for the name of the symbol if it is available to match how the user inputted the name. + * for the name of the symbol if it is available to match how the user wrote the name. */ function appendSymbolNameOnly(symbol: Symbol, writer: SymbolWriter): void { writer.writeSymbol(getNameOfSymbol(symbol), symbol); } + /** + * Writes a property access or element access with the name of the symbol out to the writer. + * Uses the original source text for the name of the symbol if it is available to match how the user wrote the name, + * ensuring that any names written with literals use element accesses. + */ + function appendPropertyOrElementAccessForSymbol(symbol: Symbol, writer: SymbolWriter): void { + const symbolName = getNameOfSymbol(symbol); + const firstChar = symbolName.charCodeAt(0); + const needsElementAccess = !isIdentifierStart(firstChar, languageVersion); + + if (needsElementAccess) { + writePunctuation(writer, SyntaxKind.OpenBracketToken); + if (isSingleOrDoubleQuote(firstChar)) { + writer.writeStringLiteral(symbolName); + } + else { + writer.writeSymbol(symbolName, symbol); + } + writePunctuation(writer, SyntaxKind.CloseBracketToken); + } + else { + writePunctuation(writer, SyntaxKind.DotToken); + writer.writeSymbol(symbolName, symbol); + } + } + /** * Enclosing declaration is optional when we don't want to get qualified name in the enclosing declaration scope * Meaning needs to be specified if the enclosing declaration is given @@ -1695,10 +1934,12 @@ namespace ts { buildTypeParameterDisplayFromSymbol(parentSymbol, writer, enclosingDeclaration); } } - writePunctuation(writer, SyntaxKind.DotToken); + appendPropertyOrElementAccessForSymbol(symbol, writer); + } + else { + appendSymbolNameOnly(symbol, writer); } parentSymbol = symbol; - appendSymbolNameOnly(symbol, writer); } // const the writer know we just wrote out a symbol. The declaration emitter writer uses @@ -1764,16 +2005,10 @@ namespace ts { function writeType(type: Type, flags: TypeFormatFlags) { // Write undefined/null type as any if (type.flags & TypeFlags.Intrinsic) { - if (type.flags & TypeFlags.PredicateType) { - buildTypePredicateDisplay(writer, (type as PredicateType).predicate); - buildTypeDisplay((type as PredicateType).predicate.type, writer, enclosingDeclaration, flags, symbolStack); - } - else { - // Special handling for unknown / resolving types, they should show up as any and not unknown or __resolving - writer.writeKeyword(!(globalFlags & TypeFormatFlags.WriteOwnNameForAnyLike) && isTypeAny(type) - ? "any" - : (type).intrinsicName); - } + // Special handling for unknown / resolving types, they should show up as any and not unknown or __resolving + writer.writeKeyword(!(globalFlags & TypeFormatFlags.WriteOwnNameForAnyLike) && isTypeAny(type) + ? "any" + : (type).intrinsicName); } else if (type.flags & TypeFlags.ThisType) { if (inObjectTypeLiteral) { @@ -1831,7 +2066,7 @@ namespace ts { } if (pos < end) { writePunctuation(writer, SyntaxKind.LessThanToken); - writeType(typeArguments[pos], TypeFormatFlags.None); + writeType(typeArguments[pos], TypeFormatFlags.InFirstTypeArgument); pos++; while (pos < end) { writePunctuation(writer, SyntaxKind.CommaToken); @@ -1899,10 +2134,10 @@ namespace ts { if (symbol) { // Always use 'typeof T' for type of class, enum, and module objects if (symbol.flags & (SymbolFlags.Class | SymbolFlags.Enum | SymbolFlags.ValueModule)) { - writeTypeofSymbol(type, flags); + writeTypeOfSymbol(type, flags); } else if (shouldWriteTypeOfFunctionSymbol()) { - writeTypeofSymbol(type, flags); + writeTypeOfSymbol(type, flags); } else if (contains(symbolStack, symbol)) { // If type is an anonymous type literal in a type alias declaration, use type alias name @@ -1947,26 +2182,59 @@ namespace ts { } } - function writeTypeofSymbol(type: ObjectType, typeFormatFlags?: TypeFormatFlags) { + function writeTypeOfSymbol(type: ObjectType, typeFormatFlags?: TypeFormatFlags) { writeKeyword(writer, SyntaxKind.TypeOfKeyword); writeSpace(writer); buildSymbolDisplay(type.symbol, writer, enclosingDeclaration, SymbolFlags.Value, SymbolFormatFlags.None, typeFormatFlags); } - function getIndexerParameterName(type: ObjectType, indexKind: IndexKind, fallbackName: string): string { - const declaration = getIndexDeclarationOfSymbol(type.symbol, indexKind); - if (!declaration) { - // declaration might not be found if indexer was added from the contextual type. - // in this case use fallback name - return fallbackName; + function writeIndexSignature(info: IndexInfo, keyword: SyntaxKind) { + if (info) { + if (info.isReadonly) { + writeKeyword(writer, SyntaxKind.ReadonlyKeyword); + writeSpace(writer); + } + writePunctuation(writer, SyntaxKind.OpenBracketToken); + writer.writeParameter(info.declaration ? declarationNameToString(info.declaration.parameters[0].name) : "x"); + writePunctuation(writer, SyntaxKind.ColonToken); + writeSpace(writer); + writeKeyword(writer, keyword); + writePunctuation(writer, SyntaxKind.CloseBracketToken); + writePunctuation(writer, SyntaxKind.ColonToken); + writeSpace(writer); + writeType(info.type, TypeFormatFlags.None); + writePunctuation(writer, SyntaxKind.SemicolonToken); + writer.writeLine(); } - Debug.assert(declaration.parameters.length !== 0); - return declarationNameToString(declaration.parameters[0].name); + } + + function writePropertyWithModifiers(prop: Symbol) { + if (isReadonlySymbol(prop)) { + writeKeyword(writer, SyntaxKind.ReadonlyKeyword); + writeSpace(writer); + } + buildSymbolDisplay(prop, writer); + if (prop.flags & SymbolFlags.Optional) { + writePunctuation(writer, SyntaxKind.QuestionToken); + } + } + + function shouldAddParenthesisAroundFunctionType(callSignature: Signature, flags: TypeFormatFlags) { + if (flags & TypeFormatFlags.InElementType) { + return true; + } + else if (flags & TypeFormatFlags.InFirstTypeArgument) { + // Add parenthesis around function type for the first type argument to avoid ambiguity + const typeParameters = callSignature.target && (flags & TypeFormatFlags.WriteTypeArgumentsOfSignature) ? + callSignature.target.typeParameters : callSignature.typeParameters; + return typeParameters && typeParameters.length !== 0; + } + return false; } function writeLiteralType(type: ObjectType, flags: TypeFormatFlags) { const resolved = resolveStructuredTypeMembers(type); - if (!resolved.properties.length && !resolved.stringIndexType && !resolved.numberIndexType) { + if (!resolved.properties.length && !resolved.stringIndexInfo && !resolved.numberIndexInfo) { if (!resolved.callSignatures.length && !resolved.constructSignatures.length) { writePunctuation(writer, SyntaxKind.OpenBraceToken); writePunctuation(writer, SyntaxKind.CloseBraceToken); @@ -1974,11 +2242,12 @@ namespace ts { } if (resolved.callSignatures.length === 1 && !resolved.constructSignatures.length) { - if (flags & TypeFormatFlags.InElementType) { + const parenthesizeSignature = shouldAddParenthesisAroundFunctionType(resolved.callSignatures[0], flags); + if (parenthesizeSignature) { writePunctuation(writer, SyntaxKind.OpenParenToken); } buildSignatureDisplay(resolved.callSignatures[0], writer, enclosingDeclaration, globalFlagsToPass | TypeFormatFlags.WriteArrowStyleSignature, /*kind*/ undefined, symbolStack); - if (flags & TypeFormatFlags.InElementType) { + if (parenthesizeSignature) { writePunctuation(writer, SyntaxKind.CloseParenToken); } return; @@ -2012,53 +2281,21 @@ namespace ts { writePunctuation(writer, SyntaxKind.SemicolonToken); writer.writeLine(); } - if (resolved.stringIndexType) { - // [x: string]: - writePunctuation(writer, SyntaxKind.OpenBracketToken); - writer.writeParameter(getIndexerParameterName(resolved, IndexKind.String, /*fallbackName*/"x")); - writePunctuation(writer, SyntaxKind.ColonToken); - writeSpace(writer); - writeKeyword(writer, SyntaxKind.StringKeyword); - writePunctuation(writer, SyntaxKind.CloseBracketToken); - writePunctuation(writer, SyntaxKind.ColonToken); - writeSpace(writer); - writeType(resolved.stringIndexType, TypeFormatFlags.None); - writePunctuation(writer, SyntaxKind.SemicolonToken); - writer.writeLine(); - } - if (resolved.numberIndexType) { - // [x: number]: - writePunctuation(writer, SyntaxKind.OpenBracketToken); - writer.writeParameter(getIndexerParameterName(resolved, IndexKind.Number, /*fallbackName*/"x")); - writePunctuation(writer, SyntaxKind.ColonToken); - writeSpace(writer); - writeKeyword(writer, SyntaxKind.NumberKeyword); - writePunctuation(writer, SyntaxKind.CloseBracketToken); - writePunctuation(writer, SyntaxKind.ColonToken); - writeSpace(writer); - writeType(resolved.numberIndexType, TypeFormatFlags.None); - writePunctuation(writer, SyntaxKind.SemicolonToken); - writer.writeLine(); - } + writeIndexSignature(resolved.stringIndexInfo, SyntaxKind.StringKeyword); + writeIndexSignature(resolved.numberIndexInfo, SyntaxKind.NumberKeyword); for (const p of resolved.properties) { const t = getTypeOfSymbol(p); if (p.flags & (SymbolFlags.Function | SymbolFlags.Method) && !getPropertiesOfObjectType(t).length) { const signatures = getSignaturesOfType(t, SignatureKind.Call); for (const signature of signatures) { - buildSymbolDisplay(p, writer); - if (p.flags & SymbolFlags.Optional) { - writePunctuation(writer, SyntaxKind.QuestionToken); - } + writePropertyWithModifiers(p); buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, /*kind*/ undefined, symbolStack); writePunctuation(writer, SyntaxKind.SemicolonToken); writer.writeLine(); } } else { - buildSymbolDisplay(p, writer); - if (p.flags & SymbolFlags.Optional) { - writePunctuation(writer, SyntaxKind.QuestionToken); - } + writePropertyWithModifiers(p); writePunctuation(writer, SyntaxKind.ColonToken); writeSpace(writer); writeType(t, TypeFormatFlags.None); @@ -2072,10 +2309,10 @@ namespace ts { } } - function buildTypeParameterDisplayFromSymbol(symbol: Symbol, writer: SymbolWriter, enclosingDeclaraiton?: Node, flags?: TypeFormatFlags) { + function buildTypeParameterDisplayFromSymbol(symbol: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags) { const targetSymbol = getTargetSymbol(symbol); if (targetSymbol.flags & SymbolFlags.Class || targetSymbol.flags & SymbolFlags.Interface || targetSymbol.flags & SymbolFlags.TypeAlias) { - buildDisplayForTypeParametersAndDelimiters(getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol), writer, enclosingDeclaraiton, flags); + buildDisplayForTypeParametersAndDelimiters(getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol), writer, enclosingDeclaration, flags); } } @@ -2095,7 +2332,12 @@ namespace ts { if (isRestParameter(parameterNode)) { writePunctuation(writer, SyntaxKind.DotDotDotToken); } - appendSymbolNameOnly(p, writer); + if (isBindingPattern(parameterNode.name)) { + buildBindingPatternDisplay(parameterNode.name, writer, enclosingDeclaration, flags, symbolStack); + } + else { + appendSymbolNameOnly(p, writer); + } if (isOptionalParameter(parameterNode)) { writePunctuation(writer, SyntaxKind.QuestionToken); } @@ -2105,38 +2347,89 @@ namespace ts { buildTypeDisplay(getTypeOfSymbol(p), writer, enclosingDeclaration, flags, symbolStack); } + function buildBindingPatternDisplay(bindingPattern: BindingPattern, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags, symbolStack?: Symbol[]) { + // We have to explicitly emit square bracket and bracket because these tokens are not stored inside the node. + if (bindingPattern.kind === SyntaxKind.ObjectBindingPattern) { + writePunctuation(writer, SyntaxKind.OpenBraceToken); + buildDisplayForCommaSeparatedList(bindingPattern.elements, writer, e => buildBindingElementDisplay(e, writer, enclosingDeclaration, flags, symbolStack)); + writePunctuation(writer, SyntaxKind.CloseBraceToken); + } + else if (bindingPattern.kind === SyntaxKind.ArrayBindingPattern) { + writePunctuation(writer, SyntaxKind.OpenBracketToken); + const elements = bindingPattern.elements; + buildDisplayForCommaSeparatedList(elements, writer, e => buildBindingElementDisplay(e, writer, enclosingDeclaration, flags, symbolStack)); + if (elements && elements.hasTrailingComma) { + writePunctuation(writer, SyntaxKind.CommaToken); + } + writePunctuation(writer, SyntaxKind.CloseBracketToken); + } + } + + function buildBindingElementDisplay(bindingElement: BindingElement, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags, symbolStack?: Symbol[]) { + if (bindingElement.kind === SyntaxKind.OmittedExpression) { + return; + } + Debug.assert(bindingElement.kind === SyntaxKind.BindingElement); + if (bindingElement.propertyName) { + writer.writeSymbol(getTextOfNode(bindingElement.propertyName), bindingElement.symbol); + writePunctuation(writer, SyntaxKind.ColonToken); + writeSpace(writer); + } + if (isBindingPattern(bindingElement.name)) { + buildBindingPatternDisplay(bindingElement.name, writer, enclosingDeclaration, flags, symbolStack); + } + else { + if (bindingElement.dotDotDotToken) { + writePunctuation(writer, SyntaxKind.DotDotDotToken); + } + appendSymbolNameOnly(bindingElement.symbol, writer); + } + } + function buildDisplayForTypeParametersAndDelimiters(typeParameters: TypeParameter[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags, symbolStack?: Symbol[]) { if (typeParameters && typeParameters.length) { writePunctuation(writer, SyntaxKind.LessThanToken); - for (let i = 0; i < typeParameters.length; i++) { - if (i > 0) { - writePunctuation(writer, SyntaxKind.CommaToken); - writeSpace(writer); - } - buildTypeParameterDisplay(typeParameters[i], writer, enclosingDeclaration, flags, symbolStack); - } + buildDisplayForCommaSeparatedList(typeParameters, writer, p => buildTypeParameterDisplay(p, writer, enclosingDeclaration, flags, symbolStack)); writePunctuation(writer, SyntaxKind.GreaterThanToken); } } + function buildDisplayForCommaSeparatedList(list: T[], writer: SymbolWriter, action: (item: T) => void) { + for (let i = 0; i < list.length; i++) { + if (i > 0) { + writePunctuation(writer, SyntaxKind.CommaToken); + writeSpace(writer); + } + action(list[i]); + } + } + function buildDisplayForTypeArgumentsAndDelimiters(typeParameters: TypeParameter[], mapper: TypeMapper, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags, symbolStack?: Symbol[]) { if (typeParameters && typeParameters.length) { writePunctuation(writer, SyntaxKind.LessThanToken); + let flags = TypeFormatFlags.InFirstTypeArgument; for (let i = 0; i < typeParameters.length; i++) { if (i > 0) { writePunctuation(writer, SyntaxKind.CommaToken); writeSpace(writer); + flags = TypeFormatFlags.None; } - buildTypeDisplay(mapper(typeParameters[i]), writer, enclosingDeclaration, TypeFormatFlags.None); + buildTypeDisplay(mapper(typeParameters[i]), writer, enclosingDeclaration, flags); } writePunctuation(writer, SyntaxKind.GreaterThanToken); } } - function buildDisplayForParametersAndDelimiters(parameters: Symbol[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags, symbolStack?: Symbol[]) { + function buildDisplayForParametersAndDelimiters(thisType: Type, parameters: Symbol[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags, symbolStack?: Symbol[]) { writePunctuation(writer, SyntaxKind.OpenParenToken); + if (thisType) { + writeKeyword(writer, SyntaxKind.ThisKeyword); + writePunctuation(writer, SyntaxKind.ColonToken); + writeSpace(writer); + buildTypeDisplay(thisType, writer, enclosingDeclaration, flags, symbolStack); + } for (let i = 0; i < parameters.length; i++) { - if (i > 0) { + if (i > 0 || thisType) { writePunctuation(writer, SyntaxKind.CommaToken); writeSpace(writer); } @@ -2145,7 +2438,7 @@ namespace ts { writePunctuation(writer, SyntaxKind.CloseParenToken); } - function buildTypePredicateDisplay(writer: SymbolWriter, predicate: TypePredicate) { + function buildTypePredicateDisplay(predicate: TypePredicate, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags, symbolStack?: Symbol[]): void { if (isIdentifierTypePredicate(predicate)) { writer.writeParameter(predicate.parameterName); } @@ -2155,6 +2448,7 @@ namespace ts { writeSpace(writer); writeKeyword(writer, SyntaxKind.IsKeyword); writeSpace(writer); + buildTypeDisplay(predicate.type, writer, enclosingDeclaration, flags, symbolStack); } function buildReturnTypeDisplay(signature: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags, symbolStack?: Symbol[]) { @@ -2167,8 +2461,13 @@ namespace ts { } writeSpace(writer); - const returnType = getReturnTypeOfSignature(signature); - buildTypeDisplay(returnType, writer, enclosingDeclaration, flags, symbolStack); + if (signature.typePredicate) { + buildTypePredicateDisplay(signature.typePredicate, writer, enclosingDeclaration, flags, symbolStack); + } + else { + const returnType = getReturnTypeOfSignature(signature); + buildTypeDisplay(returnType, writer, enclosingDeclaration, flags, symbolStack); + } } function buildSignatureDisplay(signature: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags, kind?: SignatureKind, symbolStack?: Symbol[]) { @@ -2186,7 +2485,8 @@ namespace ts { buildDisplayForTypeParametersAndDelimiters(signature.typeParameters, writer, enclosingDeclaration, flags, symbolStack); } - buildDisplayForParametersAndDelimiters(signature.parameters, writer, enclosingDeclaration, flags, symbolStack); + buildDisplayForParametersAndDelimiters(signature.thisType, signature.parameters, writer, enclosingDeclaration, flags, symbolStack); + buildReturnTypeDisplay(signature, writer, enclosingDeclaration, flags, symbolStack); } @@ -2194,6 +2494,7 @@ namespace ts { buildSymbolDisplay, buildTypeDisplay, buildTypeParameterDisplay, + buildTypePredicateDisplay, buildParameterDisplay, buildDisplayForParametersAndDelimiters, buildDisplayForTypeParametersAndDelimiters, @@ -2232,6 +2533,10 @@ namespace ts { case SyntaxKind.FunctionDeclaration: case SyntaxKind.EnumDeclaration: case SyntaxKind.ImportEqualsDeclaration: + // external module augmentation is always visible + if (isExternalModuleAugmentation(node)) { + return true; + } const parent = getDeclarationContainer(node); // If the node is not exported or it is not ambient module element (except import declaration) if (!(getCombinedNodeFlags(node) & NodeFlags.Export) && @@ -2288,7 +2593,7 @@ namespace ts { return false; default: - Debug.fail("isDeclarationVisible unknown: SyntaxKind: " + node.kind); + return false; } } } @@ -2323,8 +2628,10 @@ namespace ts { const internalModuleReference = (declaration).moduleReference; const firstIdentifier = getFirstIdentifier(internalModuleReference); const importSymbol = resolveName(declaration, firstIdentifier.text, SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace, - Diagnostics.Cannot_find_name_0, firstIdentifier); - buildVisibleNodeList(importSymbol.declarations); + undefined, undefined); + if (importSymbol) { + buildVisibleNodeList(importSymbol.declarations); + } } }); } @@ -2398,10 +2705,21 @@ namespace ts { function getDeclarationContainer(node: Node): Node { node = getRootDeclaration(node); + while (node) { + switch (node.kind) { + case SyntaxKind.VariableDeclaration: + case SyntaxKind.VariableDeclarationList: + case SyntaxKind.ImportSpecifier: + case SyntaxKind.NamedImports: + case SyntaxKind.NamespaceImport: + case SyntaxKind.ImportClause: + node = node.parent; + break; - // Parent chain: - // VaribleDeclaration -> VariableDeclarationList -> VariableStatement -> 'Declaration Container' - return node.kind === SyntaxKind.VariableDeclaration ? node.parent.parent.parent : node.parent; + default: + return node.parent; + } + } } function getTypeOfPrototypeProperty(prototype: Symbol): Type { @@ -2409,7 +2727,7 @@ namespace ts { // Every class automatically contains a static property member named 'prototype', // the type of which is an instantiation of the class type with type Any supplied as a type argument for each type parameter. // It is an error to explicitly declare a static property member with the name 'prototype'. - const classType = getDeclaredTypeOfSymbol(prototype.parent); + const classType = getDeclaredTypeOfSymbol(getParentOfSymbol(prototype)); return classType.typeParameters ? createTypeReference(classType, map(classType.typeParameters, _ => anyType)) : classType; } @@ -2450,7 +2768,7 @@ namespace ts { return name.kind === SyntaxKind.ComputedPropertyName && !isStringOrNumericLiteral((name).expression.kind); } - // Return the inferred type for a binding element + /** Return the inferred type for a binding element */ function getTypeForBindingElement(declaration: BindingElement): Type { const pattern = declaration.parent; const parentType = getTypeForBindingElementParent(pattern.parent); @@ -2476,6 +2794,9 @@ namespace ts { // computed properties with non-literal names are treated as 'any' return anyType; } + if (declaration.initializer) { + getContextualType(declaration.initializer); + } // Use type of the specified property, or otherwise, for a numeric name, the type of the numeric index signature, // or otherwise the type of the string index signature. @@ -2515,14 +2836,69 @@ namespace ts { type = createArrayType(elementType); } } + // In strict null checking mode, if a default value of a non-undefined type is specified, remove + // undefined from the final type. + if (strictNullChecks && declaration.initializer && !(getNullableKind(checkExpressionCached(declaration.initializer)) & TypeFlags.Undefined)) { + type = getTypeWithFacts(type, TypeFacts.NEUndefined); + } return type; } + function getTypeForVariableLikeDeclarationFromJSDocComment(declaration: VariableLikeDeclaration) { + const jsDocType = getJSDocTypeForVariableLikeDeclarationFromJSDocComment(declaration); + if (jsDocType) { + return getTypeFromTypeNode(jsDocType); + } + } + + function getJSDocTypeForVariableLikeDeclarationFromJSDocComment(declaration: VariableLikeDeclaration): JSDocType { + // First, see if this node has an @type annotation on it directly. + const typeTag = getJSDocTypeTag(declaration); + if (typeTag && typeTag.typeExpression) { + return typeTag.typeExpression.type; + } + + if (declaration.kind === SyntaxKind.VariableDeclaration && + declaration.parent.kind === SyntaxKind.VariableDeclarationList && + declaration.parent.parent.kind === SyntaxKind.VariableStatement) { + + // @type annotation might have been on the variable statement, try that instead. + const annotation = getJSDocTypeTag(declaration.parent.parent); + if (annotation && annotation.typeExpression) { + return annotation.typeExpression.type; + } + } + else if (declaration.kind === SyntaxKind.Parameter) { + // If it's a parameter, see if the parent has a jsdoc comment with an @param + // annotation. + const paramTag = getCorrespondingJSDocParameterTag(declaration); + if (paramTag && paramTag.typeExpression) { + return paramTag.typeExpression.type; + } + } + + return undefined; + } + + function addOptionality(type: Type, optional: boolean): Type { + return strictNullChecks && optional ? addNullableKind(type, TypeFlags.Undefined) : type; + } + // Return the inferred type for a variable, parameter, or property declaration function getTypeForVariableLikeDeclaration(declaration: VariableLikeDeclaration): Type { - // A variable declared in a for..in statement is always of type any + if (declaration.flags & NodeFlags.JavaScriptFile) { + // If this is a variable in a JavaScript file, then use the JSDoc type (if it has + // one as its type), otherwise fallback to the below standard TS codepaths to + // try to figure it out. + const type = getTypeForVariableLikeDeclarationFromJSDocComment(declaration); + if (type && type !== unknownType) { + return type; + } + } + + // A variable declared in a for..in statement is always of type string if (declaration.parent.parent.kind === SyntaxKind.ForInStatement) { - return anyType; + return stringType; } if (declaration.parent.parent.kind === SyntaxKind.ForOfStatement) { @@ -2539,7 +2915,7 @@ namespace ts { // Use type from type annotation if one is present if (declaration.type) { - return getTypeFromTypeNode(declaration.type); + return addOptionality(getTypeFromTypeNode(declaration.type), /*optional*/ !!declaration.questionToken); } if (declaration.kind === SyntaxKind.Parameter) { @@ -2548,19 +2924,26 @@ namespace ts { if (func.kind === SyntaxKind.SetAccessor && !hasDynamicName(func)) { const getter = getDeclarationOfKind(declaration.parent.symbol, SyntaxKind.GetAccessor); if (getter) { - return getReturnTypeOfSignature(getSignatureFromDeclaration(getter)); + const signature = getSignatureFromDeclaration(getter); + const thisParameter = getAccessorThisParameter(func as AccessorDeclaration); + if (thisParameter && declaration === thisParameter) { + return signature.thisType; + } + return getReturnTypeOfSignature(signature); } } // Use contextual parameter type if one is available - const type = getContextuallyTypedParameterType(declaration); + const type = declaration.symbol.name === "this" + ? getContextuallyTypedThisType(func) + : getContextuallyTypedParameterType(declaration); if (type) { - return type; + return addOptionality(type, /*optional*/ !!declaration.questionToken); } } // Use the type of the initializer expression if one is present if (declaration.initializer) { - return checkExpressionCached(declaration.initializer); + return addOptionality(checkExpressionCached(declaration.initializer), /*optional*/ !!declaration.questionToken); } // If it is a short-hand property assignment, use the type of the identifier @@ -2582,11 +2965,16 @@ namespace ts { // pattern. Otherwise, it is the type any. function getTypeFromBindingElement(element: BindingElement, includePatternInType?: boolean): Type { if (element.initializer) { - return getWidenedType(checkExpressionCached(element.initializer)); + const type = checkExpressionCached(element.initializer); + reportErrorsFromWidening(element, type); + return getWidenedType(type); } if (isBindingPattern(element.name)) { return getTypeFromBindingPattern(element.name, includePatternInType); } + if (compilerOptions.noImplicitAny && !declarationBelongsToPrivateAmbientMember(element)) { + reportImplicitAnyError(element, anyType); + } return anyType; } @@ -2669,9 +3057,6 @@ namespace ts { if (declaration.kind === SyntaxKind.PropertyAssignment) { return type; } - if (type.flags & TypeFlags.PredicateType && (declaration.kind === SyntaxKind.PropertyDeclaration || declaration.kind === SyntaxKind.PropertySignature)) { - return type; - } return getWidenedType(type); } @@ -2680,14 +3065,19 @@ namespace ts { // Report implicit any errors unless this is a private property within an ambient declaration if (reportErrors && compilerOptions.noImplicitAny) { - const root = getRootDeclaration(declaration); - if (!isPrivateWithinAmbient(root) && !(root.kind === SyntaxKind.Parameter && isPrivateWithinAmbient(root.parent))) { + if (!declarationBelongsToPrivateAmbientMember(declaration)) { reportImplicitAnyError(declaration, type); } } return type; } + function declarationBelongsToPrivateAmbientMember(declaration: VariableLikeDeclaration) { + const root = getRootDeclaration(declaration); + const memberDeclaration = root.kind === SyntaxKind.Parameter ? root.parent : root; + return isPrivateWithinAmbient(memberDeclaration); + } + function getTypeOfVariableOrParameterOrProperty(symbol: Symbol): Type { const links = getSymbolLinks(symbol); if (!links.type) { @@ -2706,7 +3096,7 @@ namespace ts { } // Handle module.exports = expr if (declaration.kind === SyntaxKind.BinaryExpression) { - return links.type = checkExpression((declaration).right); + return links.type = getUnionType(map(symbol.declarations, (decl: BinaryExpression) => checkExpressionCached(decl.right))); } if (declaration.kind === SyntaxKind.PropertyAccessExpression) { // Declarations only exist for property access expressions for certain @@ -2755,15 +3145,35 @@ namespace ts { return undefined; } + function getAnnotatedAccessorThisType(accessor: AccessorDeclaration): Type { + if (accessor) { + const parameter = getAccessorThisParameter(accessor); + if (parameter && parameter.type) { + return getTypeFromTypeNode(accessor.parameters[0].type); + } + } + return undefined; + } + function getTypeOfAccessors(symbol: Symbol): Type { const links = getSymbolLinks(symbol); if (!links.type) { + const getter = getDeclarationOfKind(symbol, SyntaxKind.GetAccessor); + const setter = getDeclarationOfKind(symbol, SyntaxKind.SetAccessor); + + if (getter && getter.flags & NodeFlags.JavaScriptFile) { + const jsDocType = getTypeForVariableLikeDeclarationFromJSDocComment(getter); + if (jsDocType) { + return links.type = jsDocType; + } + } + if (!pushTypeResolution(symbol, TypeSystemPropertyName.Type)) { return unknownType; } - const getter = getDeclarationOfKind(symbol, SyntaxKind.GetAccessor); - const setter = getDeclarationOfKind(symbol, SyntaxKind.SetAccessor); + let type: Type; + // First try to see if the user specified a return type on the get-accessor. const getterReturnType = getAnnotatedAccessorType(getter); if (getterReturnType) { @@ -2804,7 +3214,9 @@ namespace ts { function getTypeOfFuncClassEnumModule(symbol: Symbol): Type { const links = getSymbolLinks(symbol); if (!links.type) { - links.type = createObjectType(TypeFlags.Anonymous, symbol); + const type = createObjectType(TypeFlags.Anonymous, symbol); + links.type = strictNullChecks && symbol.flags & SymbolFlags.Optional ? + addNullableKind(type, TypeFlags.Undefined) : type; } return links.type; } @@ -3257,6 +3669,9 @@ namespace ts { case SyntaxKind.BooleanKeyword: case SyntaxKind.SymbolKeyword: case SyntaxKind.VoidKeyword: + case SyntaxKind.UndefinedKeyword: + case SyntaxKind.NullKeyword: + case SyntaxKind.NeverKeyword: case SyntaxKind.StringLiteralType: return true; case SyntaxKind.ArrayType: @@ -3290,7 +3705,7 @@ namespace ts { // Returns true if the class or interface member given by the symbol is free of "this" references. The // function may return false for symbols that are actually free of "this" references because it is not // feasible to perform a complete analysis in all cases. In particular, property members with types - // inferred from their initializers and function members with inferred return types are convervatively + // inferred from their initializers and function members with inferred return types are conservatively // assumed not to be free of "this" references. function isIndependentMember(symbol: Symbol): boolean { if (symbol.declarations && symbol.declarations.length === 1) { @@ -3342,8 +3757,8 @@ namespace ts { (type).declaredProperties = getNamedMembers(symbol.members); (type).declaredCallSignatures = getSignaturesOfSymbol(symbol.members["__call"]); (type).declaredConstructSignatures = getSignaturesOfSymbol(symbol.members["__new"]); - (type).declaredStringIndexType = getIndexTypeOfSymbol(symbol, IndexKind.String); - (type).declaredNumberIndexType = getIndexTypeOfSymbol(symbol, IndexKind.Number); + (type).declaredStringIndexInfo = getIndexInfoOfSymbol(symbol, IndexKind.String); + (type).declaredNumberIndexInfo = getIndexInfoOfSymbol(symbol, IndexKind.Number); } return type; } @@ -3361,15 +3776,15 @@ namespace ts { let members = source.symbol.members; let callSignatures = source.declaredCallSignatures; let constructSignatures = source.declaredConstructSignatures; - let stringIndexType = source.declaredStringIndexType; - let numberIndexType = source.declaredNumberIndexType; + let stringIndexInfo = source.declaredStringIndexInfo; + let numberIndexInfo = source.declaredNumberIndexInfo; if (!rangeEquals(typeParameters, typeArguments, 0, typeParameters.length)) { mapper = createTypeMapper(typeParameters, typeArguments); members = createInstantiatedSymbolTable(source.declaredProperties, mapper, /*mappingThisOnly*/ typeParameters.length === 1); callSignatures = instantiateList(source.declaredCallSignatures, mapper, instantiateSignature); constructSignatures = instantiateList(source.declaredConstructSignatures, mapper, instantiateSignature); - stringIndexType = instantiateType(source.declaredStringIndexType, mapper); - numberIndexType = instantiateType(source.declaredNumberIndexType, mapper); + stringIndexInfo = instantiateIndexInfo(source.declaredStringIndexInfo, mapper); + numberIndexInfo = instantiateIndexInfo(source.declaredNumberIndexInfo, mapper); } const baseTypes = getBaseTypes(source); if (baseTypes.length) { @@ -3382,11 +3797,11 @@ namespace ts { addInheritedMembers(members, getPropertiesOfObjectType(instantiatedBaseType)); callSignatures = concatenate(callSignatures, getSignaturesOfType(instantiatedBaseType, SignatureKind.Call)); constructSignatures = concatenate(constructSignatures, getSignaturesOfType(instantiatedBaseType, SignatureKind.Construct)); - stringIndexType = stringIndexType || getIndexTypeOfType(instantiatedBaseType, IndexKind.String); - numberIndexType = numberIndexType || getIndexTypeOfType(instantiatedBaseType, IndexKind.Number); + stringIndexInfo = stringIndexInfo || getIndexInfoOfType(instantiatedBaseType, IndexKind.String); + numberIndexInfo = numberIndexInfo || getIndexInfoOfType(instantiatedBaseType, IndexKind.Number); } } - setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexType, numberIndexType); + setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo); } function resolveClassOrInterfaceMembers(type: InterfaceType): void { @@ -3401,13 +3816,15 @@ namespace ts { resolveObjectTypeMembers(type, source, typeParameters, typeArguments); } - function createSignature(declaration: SignatureDeclaration, typeParameters: TypeParameter[], parameters: Symbol[], - resolvedReturnType: Type, minArgumentCount: number, hasRestParameter: boolean, hasStringLiterals: boolean): Signature { + function createSignature(declaration: SignatureDeclaration, typeParameters: TypeParameter[], thisType: Type, parameters: Symbol[], + resolvedReturnType: Type, typePredicate: TypePredicate, minArgumentCount: number, hasRestParameter: boolean, hasStringLiterals: boolean): Signature { const sig = new Signature(checker); sig.declaration = declaration; sig.typeParameters = typeParameters; sig.parameters = parameters; + sig.thisType = thisType; sig.resolvedReturnType = resolvedReturnType; + sig.typePredicate = typePredicate; sig.minArgumentCount = minArgumentCount; sig.hasRestParameter = hasRestParameter; sig.hasStringLiterals = hasStringLiterals; @@ -3415,15 +3832,15 @@ namespace ts { } function cloneSignature(sig: Signature): Signature { - return createSignature(sig.declaration, sig.typeParameters, sig.parameters, sig.resolvedReturnType, - sig.minArgumentCount, sig.hasRestParameter, sig.hasStringLiterals); + return createSignature(sig.declaration, sig.typeParameters, sig.thisType, sig.parameters, sig.resolvedReturnType, + sig.typePredicate, sig.minArgumentCount, sig.hasRestParameter, sig.hasStringLiterals); } function getDefaultConstructSignatures(classType: InterfaceType): Signature[] { const baseConstructorType = getBaseConstructorTypeOfClass(classType); const baseSignatures = getSignaturesOfType(baseConstructorType, SignatureKind.Construct); if (baseSignatures.length === 0) { - return [createSignature(undefined, classType.localTypeParameters, emptyArray, classType, 0, /*hasRestParameter*/ false, /*hasStringLiterals*/ false)]; + return [createSignature(undefined, classType.localTypeParameters, undefined, emptyArray, classType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasStringLiterals*/ false)]; } const baseTypeNode = getBaseTypeNodeOfClass(classType); const typeArguments = map(baseTypeNode.typeArguments, getTypeFromTypeNode); @@ -3457,12 +3874,12 @@ namespace ts { const arrayType = resolveStructuredTypeMembers(createTypeFromGenericGlobalType(globalArrayType, [arrayElementType, type])); const members = createTupleTypeMemberSymbols(type.elementTypes); addInheritedMembers(members, arrayType.properties); - setObjectTypeMembers(type, members, arrayType.callSignatures, arrayType.constructSignatures, arrayType.stringIndexType, arrayType.numberIndexType); + setObjectTypeMembers(type, members, arrayType.callSignatures, arrayType.constructSignatures, arrayType.stringIndexInfo, arrayType.numberIndexInfo); } - function findMatchingSignature(signatureList: Signature[], signature: Signature, partialMatch: boolean, ignoreReturnTypes: boolean): Signature { + function findMatchingSignature(signatureList: Signature[], signature: Signature, partialMatch: boolean, ignoreThisTypes: boolean, ignoreReturnTypes: boolean): Signature { for (const s of signatureList) { - if (compareSignaturesIdentical(s, signature, partialMatch, ignoreReturnTypes, compareTypesIdentical)) { + if (compareSignaturesIdentical(s, signature, partialMatch, ignoreThisTypes, ignoreReturnTypes, compareTypesIdentical)) { return s; } } @@ -3476,7 +3893,7 @@ namespace ts { return undefined; } for (let i = 1; i < signatureLists.length; i++) { - if (!findMatchingSignature(signatureLists[i], signature, /*partialMatch*/ false, /*ignoreReturnTypes*/ false)) { + if (!findMatchingSignature(signatureLists[i], signature, /*partialMatch*/ false, /*ignoreThisTypes*/ false, /*ignoreReturnTypes*/ false)) { return undefined; } } @@ -3485,7 +3902,7 @@ namespace ts { let result: Signature[] = undefined; for (let i = 0; i < signatureLists.length; i++) { // Allow matching non-generic signatures to have excess parameters and different return types - const match = i === listIndex ? signature : findMatchingSignature(signatureLists[i], signature, /*partialMatch*/ true, /*ignoreReturnTypes*/ true); + const match = i === listIndex ? signature : findMatchingSignature(signatureLists[i], signature, /*partialMatch*/ true, /*ignoreThisTypes*/ true, /*ignoreReturnTypes*/ true); if (!match) { return undefined; } @@ -3506,13 +3923,16 @@ namespace ts { for (let i = 0; i < signatureLists.length; i++) { for (const signature of signatureLists[i]) { // Only process signatures with parameter lists that aren't already in the result list - if (!result || !findMatchingSignature(result, signature, /*partialMatch*/ false, /*ignoreReturnTypes*/ true)) { + if (!result || !findMatchingSignature(result, signature, /*partialMatch*/ false, /*ignoreThisTypes*/ true, /*ignoreReturnTypes*/ true)) { const unionSignatures = findMatchingSignatures(signatureLists, signature, i); if (unionSignatures) { let s = signature; // Union the result types when more than one signature matches if (unionSignatures.length > 1) { s = cloneSignature(signature); + if (forEach(unionSignatures, sig => sig.thisType)) { + s.thisType = getUnionType(map(unionSignatures, sig => sig.thisType || anyType)); + } // Clear resolved return type we possibly got from cloneSignature s.resolvedReturnType = undefined; s.unionSignatures = unionSignatures; @@ -3525,16 +3945,18 @@ namespace ts { return result || emptyArray; } - function getUnionIndexType(types: Type[], kind: IndexKind): Type { + function getUnionIndexInfo(types: Type[], kind: IndexKind): IndexInfo { const indexTypes: Type[] = []; + let isAnyReadonly = false; for (const type of types) { - const indexType = getIndexTypeOfType(type, kind); - if (!indexType) { + const indexInfo = getIndexInfoOfType(type, kind); + if (!indexInfo) { return undefined; } - indexTypes.push(indexType); + indexTypes.push(indexInfo.type); + isAnyReadonly = isAnyReadonly || indexInfo.isReadonly; } - return getUnionType(indexTypes); + return createIndexInfo(getUnionType(indexTypes), isAnyReadonly); } function resolveUnionTypeMembers(type: UnionType) { @@ -3542,29 +3964,34 @@ namespace ts { // type use getPropertiesOfType (only the language service uses this). const callSignatures = getUnionSignatures(type.types, SignatureKind.Call); const constructSignatures = getUnionSignatures(type.types, SignatureKind.Construct); - const stringIndexType = getUnionIndexType(type.types, IndexKind.String); - const numberIndexType = getUnionIndexType(type.types, IndexKind.Number); - setObjectTypeMembers(type, emptySymbols, callSignatures, constructSignatures, stringIndexType, numberIndexType); + const stringIndexInfo = getUnionIndexInfo(type.types, IndexKind.String); + const numberIndexInfo = getUnionIndexInfo(type.types, IndexKind.Number); + setObjectTypeMembers(type, emptySymbols, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo); } function intersectTypes(type1: Type, type2: Type): Type { return !type1 ? type2 : !type2 ? type1 : getIntersectionType([type1, type2]); } + function intersectIndexInfos(info1: IndexInfo, info2: IndexInfo): IndexInfo { + return !info1 ? info2 : !info2 ? info1 : createIndexInfo( + getIntersectionType([info1.type, info2.type]), info1.isReadonly && info2.isReadonly); + } + function resolveIntersectionTypeMembers(type: IntersectionType) { // The members and properties collections are empty for intersection types. To get all properties of an // intersection type use getPropertiesOfType (only the language service uses this). let callSignatures: Signature[] = emptyArray; let constructSignatures: Signature[] = emptyArray; - let stringIndexType: Type = undefined; - let numberIndexType: Type = undefined; + let stringIndexInfo: IndexInfo = undefined; + let numberIndexInfo: IndexInfo = undefined; for (const t of type.types) { callSignatures = concatenate(callSignatures, getSignaturesOfType(t, SignatureKind.Call)); constructSignatures = concatenate(constructSignatures, getSignaturesOfType(t, SignatureKind.Construct)); - stringIndexType = intersectTypes(stringIndexType, getIndexTypeOfType(t, IndexKind.String)); - numberIndexType = intersectTypes(numberIndexType, getIndexTypeOfType(t, IndexKind.Number)); + stringIndexInfo = intersectIndexInfos(stringIndexInfo, getIndexInfoOfType(t, IndexKind.String)); + numberIndexInfo = intersectIndexInfos(numberIndexInfo, getIndexInfoOfType(t, IndexKind.Number)); } - setObjectTypeMembers(type, emptySymbols, callSignatures, constructSignatures, stringIndexType, numberIndexType); + setObjectTypeMembers(type, emptySymbols, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo); } function resolveAnonymousTypeMembers(type: AnonymousType) { @@ -3573,17 +4000,17 @@ namespace ts { const members = createInstantiatedSymbolTable(getPropertiesOfObjectType(type.target), type.mapper, /*mappingThisOnly*/ false); const callSignatures = instantiateList(getSignaturesOfType(type.target, SignatureKind.Call), type.mapper, instantiateSignature); const constructSignatures = instantiateList(getSignaturesOfType(type.target, SignatureKind.Construct), type.mapper, instantiateSignature); - const stringIndexType = instantiateType(getIndexTypeOfType(type.target, IndexKind.String), type.mapper); - const numberIndexType = instantiateType(getIndexTypeOfType(type.target, IndexKind.Number), type.mapper); - setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexType, numberIndexType); + const stringIndexInfo = instantiateIndexInfo(getIndexInfoOfType(type.target, IndexKind.String), type.mapper); + const numberIndexInfo = instantiateIndexInfo(getIndexInfoOfType(type.target, IndexKind.Number), type.mapper); + setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo); } else if (symbol.flags & SymbolFlags.TypeLiteral) { const members = symbol.members; const callSignatures = getSignaturesOfSymbol(members["__call"]); const constructSignatures = getSignaturesOfSymbol(members["__new"]); - const stringIndexType = getIndexTypeOfSymbol(symbol, IndexKind.String); - const numberIndexType = getIndexTypeOfSymbol(symbol, IndexKind.Number); - setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexType, numberIndexType); + const stringIndexInfo = getIndexInfoOfSymbol(symbol, IndexKind.String); + const numberIndexInfo = getIndexInfoOfSymbol(symbol, IndexKind.Number); + setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo); } else { // Combinations of function, class, enum and module @@ -3604,8 +4031,8 @@ namespace ts { addInheritedMembers(members, getPropertiesOfObjectType(baseConstructorType)); } } - const numberIndexType = (symbol.flags & SymbolFlags.Enum) ? stringType : undefined; - setObjectTypeMembers(type, members, emptyArray, constructSignatures, undefined, numberIndexType); + const numberIndexInfo = symbol.flags & SymbolFlags.Enum ? enumNumberIndexInfo : undefined; + setObjectTypeMembers(type, members, emptyArray, constructSignatures, undefined, numberIndexInfo); // We resolve the members before computing the signatures because a signature may use // typeof with a qualified name expression that circularly references the type we are // in the process of resolving (see issue #6072). The temporarily empty signature list @@ -3715,7 +4142,7 @@ namespace ts { type = globalBooleanType; } else if (type.flags & TypeFlags.ESSymbol) { - type = globalESSymbolType; + type = getGlobalESSymbolType(); } return type; } @@ -3824,19 +4251,57 @@ namespace ts { function getSignaturesOfType(type: Type, kind: SignatureKind): Signature[] { return getSignaturesOfStructuredType(getApparentType(type), kind); } - function getIndexTypeOfStructuredType(type: Type, kind: IndexKind): Type { + + function getIndexInfoOfStructuredType(type: Type, kind: IndexKind): IndexInfo { if (type.flags & TypeFlags.StructuredType) { const resolved = resolveStructuredTypeMembers(type); - return kind === IndexKind.String ? resolved.stringIndexType : resolved.numberIndexType; + return kind === IndexKind.String ? resolved.stringIndexInfo : resolved.numberIndexInfo; } } + function getIndexTypeOfStructuredType(type: Type, kind: IndexKind): Type { + const info = getIndexInfoOfStructuredType(type, kind); + return info && info.type; + } + + // Return the indexing info of the given kind in the given type. Creates synthetic union index types when necessary and + // maps primitive types and type parameters are to their apparent types. + function getIndexInfoOfType(type: Type, kind: IndexKind): IndexInfo { + return getIndexInfoOfStructuredType(getApparentType(type), kind); + } + // Return the index type of the given kind in the given type. Creates synthetic union index types when necessary and // maps primitive types and type parameters are to their apparent types. function getIndexTypeOfType(type: Type, kind: IndexKind): Type { return getIndexTypeOfStructuredType(getApparentType(type), kind); } + function getImplicitIndexTypeOfType(type: Type, kind: IndexKind): Type { + if (isObjectLiteralType(type)) { + const propTypes: Type[] = []; + for (const prop of getPropertiesOfType(type)) { + if (kind === IndexKind.String || isNumericLiteralName(prop.name)) { + propTypes.push(getTypeOfSymbol(prop)); + } + } + if (propTypes.length) { + return getUnionType(propTypes); + } + } + return undefined; + } + + function getTypeParametersFromJSDocTemplate(declaration: SignatureDeclaration): TypeParameter[] { + if (declaration.flags & NodeFlags.JavaScriptFile) { + const templateTag = getJSDocTemplateTag(declaration); + if (templateTag) { + return getTypeParametersFromDeclaration(templateTag.typeParameters); + } + } + + return undefined; + } + // Return list of type parameters with duplicates removed (duplicate identifier errors are generated in the actual // type checking functions). function getTypeParametersFromDeclaration(typeParameterDeclarations: TypeParameterDeclaration[]): TypeParameter[] { @@ -3861,6 +4326,23 @@ namespace ts { } function isOptionalParameter(node: ParameterDeclaration) { + if (node.flags & NodeFlags.JavaScriptFile) { + if (node.type && node.type.kind === SyntaxKind.JSDocOptionalType) { + return true; + } + + const paramTag = getCorrespondingJSDocParameterTag(node); + if (paramTag) { + if (paramTag.isBracketed) { + return true; + } + + if (paramTag.typeExpression) { + return paramTag.typeExpression.type.kind === SyntaxKind.JSDocOptionalType; + } + } + } + if (hasQuestionToken(node)) { return true; } @@ -3897,30 +4379,40 @@ namespace ts { function getSignatureFromDeclaration(declaration: SignatureDeclaration): Signature { const links = getNodeLinks(declaration); if (!links.resolvedSignature) { - const classType = declaration.kind === SyntaxKind.Constructor ? - getDeclaredTypeOfClassOrInterface(getMergedSymbol((declaration.parent).symbol)) - : undefined; - const typeParameters = classType ? classType.localTypeParameters : - declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : undefined; const parameters: Symbol[] = []; let hasStringLiterals = false; let minArgumentCount = -1; - for (let i = 0, n = declaration.parameters.length; i < n; i++) { + let thisType: Type = undefined; + let hasThisParameter: boolean; + const isJSConstructSignature = isJSDocConstructSignature(declaration); + + // If this is a JSDoc construct signature, then skip the first parameter in the + // parameter list. The first parameter represents the return type of the construct + // signature. + for (let i = isJSConstructSignature ? 1 : 0, n = declaration.parameters.length; i < n; i++) { const param = declaration.parameters[i]; + let paramSymbol = param.symbol; // Include parameter symbol instead of property symbol in the signature if (paramSymbol && !!(paramSymbol.flags & SymbolFlags.Property) && !isBindingPattern(param.name)) { const resolvedSymbol = resolveName(param, paramSymbol.name, SymbolFlags.Value, undefined, undefined); paramSymbol = resolvedSymbol; } - parameters.push(paramSymbol); + if (i === 0 && paramSymbol.name === "this") { + hasThisParameter = true; + thisType = param.type ? getTypeFromTypeNode(param.type) : unknownType; + } + else { + parameters.push(paramSymbol); + } + if (param.type && param.type.kind === SyntaxKind.StringLiteralType) { hasStringLiterals = true; } if (param.initializer || param.questionToken || param.dotDotDotToken) { if (minArgumentCount < 0) { - minArgumentCount = i; + minArgumentCount = i - (hasThisParameter ? 1 : 0); } } else { @@ -3929,35 +4421,68 @@ namespace ts { } } + // If only one accessor includes a this-type annotation, the other behaves as if it had the same type annotation + if ((declaration.kind === SyntaxKind.GetAccessor || declaration.kind === SyntaxKind.SetAccessor) && + !hasDynamicName(declaration) && + (!hasThisParameter || thisType === unknownType)) { + const otherKind = declaration.kind === SyntaxKind.GetAccessor ? SyntaxKind.SetAccessor : SyntaxKind.GetAccessor; + const setter = getDeclarationOfKind(declaration.symbol, otherKind); + thisType = getAnnotatedAccessorThisType(setter); + } + if (minArgumentCount < 0) { - minArgumentCount = declaration.parameters.length; + minArgumentCount = declaration.parameters.length - (hasThisParameter ? 1 : 0); + } + if (isJSConstructSignature) { + minArgumentCount--; } - let returnType: Type; - if (classType) { - returnType = classType; - } - else if (declaration.type) { - returnType = getTypeFromTypeNode(declaration.type); - } - else { - // TypeScript 1.0 spec (April 2014): - // If only one accessor includes a type annotation, the other behaves as if it had the same type annotation. - if (declaration.kind === SyntaxKind.GetAccessor && !hasDynamicName(declaration)) { - const setter = getDeclarationOfKind(declaration.symbol, SyntaxKind.SetAccessor); - returnType = getAnnotatedAccessorType(setter); - } + const classType = declaration.kind === SyntaxKind.Constructor ? + getDeclaredTypeOfClassOrInterface(getMergedSymbol((declaration.parent).symbol)) + : undefined; + const typeParameters = classType ? classType.localTypeParameters : + declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : + getTypeParametersFromJSDocTemplate(declaration); + const returnType = getSignatureReturnTypeFromDeclaration(declaration, minArgumentCount, isJSConstructSignature, classType); + const typePredicate = declaration.type && declaration.type.kind === SyntaxKind.TypePredicate ? + createTypePredicateFromTypePredicateNode(declaration.type as TypePredicateNode) : + undefined; - if (!returnType && nodeIsMissing((declaration).body)) { - returnType = anyType; - } - } - - links.resolvedSignature = createSignature(declaration, typeParameters, parameters, returnType, minArgumentCount, hasRestParameter(declaration), hasStringLiterals); + links.resolvedSignature = createSignature(declaration, typeParameters, thisType, parameters, returnType, typePredicate, minArgumentCount, hasRestParameter(declaration), hasStringLiterals); } return links.resolvedSignature; } + function getSignatureReturnTypeFromDeclaration(declaration: SignatureDeclaration, minArgumentCount: number, isJSConstructSignature: boolean, classType: Type) { + if (isJSConstructSignature) { + return getTypeFromTypeNode(declaration.parameters[0].type); + } + else if (classType) { + return classType; + } + else if (declaration.type) { + return getTypeFromTypeNode(declaration.type); + } + + if (declaration.flags & NodeFlags.JavaScriptFile) { + const type = getReturnTypeFromJSDocComment(declaration); + if (type && type !== unknownType) { + return type; + } + } + + // TypeScript 1.0 spec (April 2014): + // If only one accessor includes a type annotation, the other behaves as if it had the same type annotation. + if (declaration.kind === SyntaxKind.GetAccessor && !hasDynamicName(declaration)) { + const setter = getDeclarationOfKind(declaration.symbol, SyntaxKind.SetAccessor); + return getAnnotatedAccessorType(setter); + } + + if (nodeIsMissing((declaration).body)) { + return anyType; + } + } + function getSignaturesOfSymbol(symbol: Symbol): Signature[] { if (!symbol) return emptyArray; const result: Signature[] = []; @@ -3977,6 +4502,7 @@ namespace ts { case SyntaxKind.SetAccessor: case SyntaxKind.FunctionExpression: case SyntaxKind.ArrowFunction: + case SyntaxKind.JSDocFunctionType: // Don't include signature if node is the implementation of an overloaded function. A node is considered // an implementation node if it has a body and the previous node is of the same kind and immediately // precedes the implementation node (i.e. has the same parent and ends where the implementation starts). @@ -4053,12 +4579,7 @@ namespace ts { function getErasedSignature(signature: Signature): Signature { if (!signature.typeParameters) return signature; if (!signature.erasedSignatureCache) { - if (signature.target) { - signature.erasedSignatureCache = instantiateSignature(getErasedSignature(signature.target), signature.mapper); - } - else { - signature.erasedSignatureCache = instantiateSignature(signature, createTypeEraser(signature.typeParameters), /*eraseTypeParameters*/ true); - } + signature.erasedSignatureCache = instantiateSignature(signature, createTypeEraser(signature.typeParameters), /*eraseTypeParameters*/ true); } return signature.erasedSignatureCache; } @@ -4103,11 +4624,17 @@ namespace ts { return undefined; } - function getIndexTypeOfSymbol(symbol: Symbol, kind: IndexKind): Type { + function createIndexInfo(type: Type, isReadonly: boolean, declaration?: SignatureDeclaration): IndexInfo { + return { type, isReadonly, declaration }; + } + + function getIndexInfoOfSymbol(symbol: Symbol, kind: IndexKind): IndexInfo { const declaration = getIndexDeclarationOfSymbol(symbol, kind); - return declaration - ? declaration.type ? getTypeFromTypeNode(declaration.type) : anyType - : undefined; + if (declaration) { + return createIndexInfo(declaration.type ? getTypeFromTypeNode(declaration.type) : anyType, + (declaration.flags & NodeFlags.Readonly) !== 0, declaration); + } + return undefined; } function getConstraintDeclaration(type: TypeParameter) { @@ -4116,7 +4643,7 @@ namespace ts { function hasConstraintReferenceTo(type: Type, target: TypeParameter): boolean { let checked: Type[]; - while (type && type.flags & TypeFlags.TypeParameter && !contains(checked, type)) { + while (type && !(type.flags & TypeFlags.ThisType) && type.flags & TypeFlags.TypeParameter && !contains(checked, type)) { if (type === target) { return true; } @@ -4175,10 +4702,12 @@ namespace ts { // It is only necessary to do so if a constituent type might be the undefined type, the null type, the type // of an object literal or the anyFunctionType. This is because there are operations in the type checker // that care about the presence of such types at arbitrary depth in a containing type. - function getPropagatingFlagsOfTypes(types: Type[]): TypeFlags { + function getPropagatingFlagsOfTypes(types: Type[], excludeKinds: TypeFlags): TypeFlags { let result: TypeFlags = 0; for (const type of types) { - result |= type.flags; + if (!(type.flags & excludeKinds)) { + result |= type.flags; + } } return result & TypeFlags.PropagatingFlags; } @@ -4187,7 +4716,8 @@ namespace ts { const id = getTypeListId(typeArguments); let type = target.instantiations[id]; if (!type) { - const flags = TypeFlags.Reference | (typeArguments ? getPropagatingFlagsOfTypes(typeArguments) : 0); + const propagatedFlags = typeArguments ? getPropagatingFlagsOfTypes(typeArguments, /*excludeKinds*/ 0) : 0; + const flags = TypeFlags.Reference | propagatedFlags; type = target.instantiations[id] = createObjectType(flags, target.symbol); type.target = target; type.typeArguments = typeArguments; @@ -4196,8 +4726,8 @@ namespace ts { } // Get type from reference to class or interface - function getTypeFromClassOrInterfaceReference(node: TypeReferenceNode | ExpressionWithTypeArguments, symbol: Symbol): Type { - const type = getDeclaredTypeOfSymbol(symbol); + function getTypeFromClassOrInterfaceReference(node: TypeReferenceNode | ExpressionWithTypeArguments | JSDocTypeReference, symbol: Symbol): Type { + const type = getDeclaredTypeOfSymbol(getMergedSymbol(symbol)); const typeParameters = type.localTypeParameters; if (typeParameters) { if (!node.typeArguments || node.typeArguments.length !== typeParameters.length) { @@ -4219,7 +4749,7 @@ namespace ts { // Get type from reference to type alias. When a type alias is generic, the declared type of the type alias may include // references to the type parameters of the alias. We replace those with the actual type arguments by instantiating the // declared type. Instantiations are cached using the type identities of the type arguments as the key. - function getTypeFromTypeAliasReference(node: TypeReferenceNode | ExpressionWithTypeArguments, symbol: Symbol): Type { + function getTypeFromTypeAliasReference(node: TypeReferenceNode | ExpressionWithTypeArguments | JSDocTypeReference, symbol: Symbol): Type { const type = getDeclaredTypeOfSymbol(symbol); const links = getSymbolLinks(symbol); const typeParameters = links.typeParameters; @@ -4240,7 +4770,7 @@ namespace ts { } // Get type from reference to named type that cannot be generic (enum or type parameter) - function getTypeFromNonGenericTypeReference(node: TypeReferenceNode | ExpressionWithTypeArguments, symbol: Symbol): Type { + function getTypeFromNonGenericTypeReference(node: TypeReferenceNode | ExpressionWithTypeArguments | JSDocTypeReference, symbol: Symbol): Type { if (node.typeArguments) { error(node, Diagnostics.Type_0_is_not_generic, symbolToString(symbol)); return unknownType; @@ -4248,18 +4778,83 @@ namespace ts { return getDeclaredTypeOfSymbol(symbol); } - function getTypeFromTypeReference(node: TypeReferenceNode | ExpressionWithTypeArguments): Type { + function getTypeReferenceName(node: TypeReferenceNode | ExpressionWithTypeArguments | JSDocTypeReference): LeftHandSideExpression | EntityName { + switch (node.kind) { + case SyntaxKind.TypeReference: + return (node).typeName; + case SyntaxKind.JSDocTypeReference: + return (node).name; + case SyntaxKind.ExpressionWithTypeArguments: + // We only support expressions that are simple qualified names. For other + // expressions this produces undefined. + if (isSupportedExpressionWithTypeArguments(node)) { + return (node).expression; + } + + // fall through; + } + + return undefined; + } + + function resolveTypeReferenceName( + node: TypeReferenceNode | ExpressionWithTypeArguments | JSDocTypeReference, + typeReferenceName: LeftHandSideExpression | EntityName) { + + if (!typeReferenceName) { + return unknownSymbol; + } + + return resolveEntityName(typeReferenceName, SymbolFlags.Type) || unknownSymbol; + } + + function getTypeReferenceType(node: TypeReferenceNode | ExpressionWithTypeArguments | JSDocTypeReference, symbol: Symbol) { + if (symbol === unknownSymbol) { + return unknownType; + } + + if (symbol.flags & (SymbolFlags.Class | SymbolFlags.Interface)) { + return getTypeFromClassOrInterfaceReference(node, symbol); + } + + if (symbol.flags & SymbolFlags.TypeAlias) { + return getTypeFromTypeAliasReference(node, symbol); + } + + if (symbol.flags & SymbolFlags.Value && node.kind === SyntaxKind.JSDocTypeReference) { + // A JSDocTypeReference may have resolved to a value (as opposed to a type). In + // that case, the type of this reference is just the type of the value we resolved + // to. + return getTypeOfSymbol(symbol); + } + + return getTypeFromNonGenericTypeReference(node, symbol); + } + + function getTypeFromTypeReference(node: TypeReferenceNode | ExpressionWithTypeArguments | JSDocTypeReference): Type { const links = getNodeLinks(node); if (!links.resolvedType) { - // We only support expressions that are simple qualified names. For other expressions this produces undefined. - const typeNameOrExpression = node.kind === SyntaxKind.TypeReference ? (node).typeName : - isSupportedExpressionWithTypeArguments(node) ? (node).expression : - undefined; - const symbol = typeNameOrExpression && resolveEntityName(typeNameOrExpression, SymbolFlags.Type) || unknownSymbol; - const type = symbol === unknownSymbol ? unknownType : - symbol.flags & (SymbolFlags.Class | SymbolFlags.Interface) ? getTypeFromClassOrInterfaceReference(node, symbol) : - symbol.flags & SymbolFlags.TypeAlias ? getTypeFromTypeAliasReference(node, symbol) : - getTypeFromNonGenericTypeReference(node, symbol); + let symbol: Symbol; + let type: Type; + if (node.kind === SyntaxKind.JSDocTypeReference) { + const typeReferenceName = getTypeReferenceName(node); + symbol = resolveTypeReferenceName(node, typeReferenceName); + type = getTypeReferenceType(node, symbol); + + links.resolvedSymbol = symbol; + links.resolvedType = type; + } + else { + // We only support expressions that are simple qualified names. For other expressions this produces undefined. + const typeNameOrExpression = node.kind === SyntaxKind.TypeReference ? (node).typeName : + isSupportedExpressionWithTypeArguments(node) ? (node).expression : + undefined; + symbol = typeNameOrExpression && resolveEntityName(typeNameOrExpression, SymbolFlags.Type) || unknownSymbol; + type = symbol === unknownSymbol ? unknownType : + symbol.flags & (SymbolFlags.Class | SymbolFlags.Interface) ? getTypeFromClassOrInterfaceReference(node, symbol) : + symbol.flags & SymbolFlags.TypeAlias ? getTypeFromTypeAliasReference(node, symbol) : + getTypeFromNonGenericTypeReference(node, symbol); + } // Cache both the resolved symbol and the resolved type. The resolved symbol is needed in when we check the // type reference in checkTypeReferenceOrExpressionWithTypeArguments. links.resolvedSymbol = symbol; @@ -4335,10 +4930,6 @@ namespace ts { return typeSymbol && getDeclaredTypeOfSymbol(typeSymbol); } - function getGlobalESSymbolConstructorSymbol() { - return globalESSymbolConstructorSymbol || (globalESSymbolConstructorSymbol = getGlobalValueSymbol("Symbol")); - } - /** * Creates a TypeReference for a generic `TypedPropertyDescriptor`. */ @@ -4357,11 +4948,11 @@ namespace ts { } function createIterableType(elementType: Type): Type { - return createTypeFromGenericGlobalType(globalIterableType, [elementType]); + return createTypeFromGenericGlobalType(getGlobalIterableType(), [elementType]); } function createIterableIteratorType(elementType: Type): Type { - return createTypeFromGenericGlobalType(globalIterableIteratorType, [elementType]); + return createTypeFromGenericGlobalType(getGlobalIterableIteratorType(), [elementType]); } function createArrayType(elementType: Type): Type { @@ -4382,7 +4973,8 @@ namespace ts { } function createNewTupleType(elementTypes: Type[]) { - const type = createObjectType(TypeFlags.Tuple | getPropagatingFlagsOfTypes(elementTypes)); + const propagatedFlags = getPropagatingFlagsOfTypes(elementTypes, /*excludeKinds*/ 0); + const type = createObjectType(TypeFlags.Tuple | propagatedFlags); type.elementTypes = elementTypes; return type; } @@ -4395,18 +4987,29 @@ namespace ts { return links.resolvedType; } - function addTypeToSet(typeSet: Type[], type: Type, typeSetKind: TypeFlags) { + interface TypeSet extends Array { + containsAny?: boolean; + containsUndefined?: boolean; + containsNull?: boolean; + } + + function addTypeToSet(typeSet: TypeSet, type: Type, typeSetKind: TypeFlags) { if (type.flags & typeSetKind) { addTypesToSet(typeSet, (type).types, typeSetKind); } - else if (!contains(typeSet, type)) { + else if (type.flags & (TypeFlags.Any | TypeFlags.Undefined | TypeFlags.Null)) { + if (type.flags & TypeFlags.Any) typeSet.containsAny = true; + if (type.flags & TypeFlags.Undefined) typeSet.containsUndefined = true; + if (type.flags & TypeFlags.Null) typeSet.containsNull = true; + } + else if (type !== neverType && !contains(typeSet, type)) { typeSet.push(type); } } // Add the given types to the given type set. Order is preserved, duplicates are removed, // and nested types of the given kind are flattened into the set. - function addTypesToSet(typeSet: Type[], types: Type[], typeSetKind: TypeFlags) { + function addTypesToSet(typeSet: TypeSet, types: Type[], typeSetKind: TypeFlags) { for (const type of types) { addTypeToSet(typeSet, type, typeSetKind); } @@ -4431,25 +5034,6 @@ namespace ts { } } - function containsTypeAny(types: Type[]): boolean { - for (const type of types) { - if (isTypeAny(type)) { - return true; - } - } - return false; - } - - function removeAllButLast(types: Type[], typeToRemove: Type) { - let i = types.length; - while (i > 0 && types.length > 1) { - i--; - if (types[i] === typeToRemove) { - types.splice(i, 1); - } - } - } - // We reduce the constituent type set to only include types that aren't subtypes of other types, unless // the noSubtypeReduction flag is specified, in which case we perform a simple deduplication based on // object identity. Subtype reduction is possible only when union types are known not to circularly @@ -4459,27 +5043,36 @@ namespace ts { // a named type that circularly references itself. function getUnionType(types: Type[], noSubtypeReduction?: boolean): Type { if (types.length === 0) { - return emptyUnionType; + return neverType; } - const typeSet: Type[] = []; + if (types.length === 1) { + return types[0]; + } + const typeSet = [] as TypeSet; addTypesToSet(typeSet, types, TypeFlags.Union); - if (containsTypeAny(typeSet)) { + if (typeSet.containsAny) { return anyType; } - if (noSubtypeReduction) { - removeAllButLast(typeSet, undefinedType); - removeAllButLast(typeSet, nullType); + if (strictNullChecks) { + if (typeSet.containsNull) typeSet.push(nullType); + if (typeSet.containsUndefined) typeSet.push(undefinedType); } - else { + if (!noSubtypeReduction) { removeSubtypes(typeSet); } - if (typeSet.length === 1) { + if (typeSet.length === 0) { + return typeSet.containsNull ? nullType : + typeSet.containsUndefined ? undefinedType : + neverType; + } + else if (typeSet.length === 1) { return typeSet[0]; } const id = getTypeListId(typeSet); let type = unionTypes[id]; if (!type) { - type = unionTypes[id] = createObjectType(TypeFlags.Union | getPropagatingFlagsOfTypes(typeSet)); + const propagatedFlags = getPropagatingFlagsOfTypes(typeSet, /*excludeKinds*/ TypeFlags.Nullable); + type = unionTypes[id] = createObjectType(TypeFlags.Union | propagatedFlags); type.types = typeSet; } return type; @@ -4502,18 +5095,23 @@ namespace ts { if (types.length === 0) { return emptyObjectType; } - const typeSet: Type[] = []; + const typeSet = [] as TypeSet; addTypesToSet(typeSet, types, TypeFlags.Intersection); - if (containsTypeAny(typeSet)) { + if (typeSet.containsAny) { return anyType; } + if (strictNullChecks) { + if (typeSet.containsNull) typeSet.push(nullType); + if (typeSet.containsUndefined) typeSet.push(undefinedType); + } if (typeSet.length === 1) { return typeSet[0]; } const id = getTypeListId(typeSet); let type = intersectionTypes[id]; if (!type) { - type = intersectionTypes[id] = createObjectType(TypeFlags.Intersection | getPropagatingFlagsOfTypes(typeSet)); + const propagatedFlags = getPropagatingFlagsOfTypes(typeSet, /*excludeKinds*/ TypeFlags.Nullable); + type = intersectionTypes[id] = createObjectType(TypeFlags.Intersection | propagatedFlags); type.types = typeSet; } return type; @@ -4549,12 +5147,30 @@ namespace ts { function getTypeFromStringLiteralTypeNode(node: StringLiteralTypeNode): Type { const links = getNodeLinks(node); if (!links.resolvedType) { - links.resolvedType = getStringLiteralTypeForText(node.text); + links.resolvedType = getStringLiteralTypeForText(unescapeIdentifier(node.text)); } return links.resolvedType; } - function getThisType(node: TypeNode): Type { + function getTypeFromJSDocVariadicType(node: JSDocVariadicType): Type { + const links = getNodeLinks(node); + if (!links.resolvedType) { + const type = getTypeFromTypeNode(node.type); + links.resolvedType = type ? createArrayType(type) : unknownType; + } + return links.resolvedType; + } + + function getTypeFromJSDocTupleType(node: JSDocTupleType): Type { + const links = getNodeLinks(node); + if (!links.resolvedType) { + const types = map(node.types, getTypeFromTypeNode); + links.resolvedType = createTupleType(types); + } + return links.resolvedType; + } + + function getThisType(node: Node): Type { const container = getThisContainer(node, /*includeArrowFunctions*/ false); const parent = container && container.parent; if (parent && (isClassLike(parent) || parent.kind === SyntaxKind.InterfaceDeclaration)) { @@ -4575,28 +5191,11 @@ namespace ts { return links.resolvedType; } - function getPredicateType(node: TypePredicateNode): Type { - return createPredicateType(getSymbolOfNode(node), createTypePredicateFromTypePredicateNode(node)); - } - - function createPredicateType(symbol: Symbol, predicate: ThisTypePredicate | IdentifierTypePredicate) { - const type = createType(TypeFlags.Boolean | TypeFlags.PredicateType) as PredicateType; - type.symbol = symbol; - type.predicate = predicate; - return type; - } - - function getTypeFromPredicateTypeNode(node: TypePredicateNode): Type { - const links = getNodeLinks(node); - if (!links.resolvedType) { - links.resolvedType = getPredicateType(node); - } - return links.resolvedType; - } - function getTypeFromTypeNode(node: TypeNode): Type { switch (node.kind) { case SyntaxKind.AnyKeyword: + case SyntaxKind.JSDocAllType: + case SyntaxKind.JSDocUnknownType: return anyType; case SyntaxKind.StringKeyword: return stringType; @@ -4608,31 +5207,48 @@ namespace ts { return esSymbolType; case SyntaxKind.VoidKeyword: return voidType; + case SyntaxKind.UndefinedKeyword: + return undefinedType; + case SyntaxKind.NullKeyword: + return nullType; + case SyntaxKind.NeverKeyword: + return neverType; case SyntaxKind.ThisType: + case SyntaxKind.ThisKeyword: return getTypeFromThisTypeNode(node); case SyntaxKind.StringLiteralType: return getTypeFromStringLiteralTypeNode(node); case SyntaxKind.TypeReference: + case SyntaxKind.JSDocTypeReference: return getTypeFromTypeReference(node); case SyntaxKind.TypePredicate: - return getTypeFromPredicateTypeNode(node); + return booleanType; case SyntaxKind.ExpressionWithTypeArguments: return getTypeFromTypeReference(node); case SyntaxKind.TypeQuery: return getTypeFromTypeQueryNode(node); case SyntaxKind.ArrayType: + case SyntaxKind.JSDocArrayType: return getTypeFromArrayTypeNode(node); case SyntaxKind.TupleType: return getTypeFromTupleTypeNode(node); case SyntaxKind.UnionType: + case SyntaxKind.JSDocUnionType: return getTypeFromUnionTypeNode(node); case SyntaxKind.IntersectionType: return getTypeFromIntersectionTypeNode(node); case SyntaxKind.ParenthesizedType: - return getTypeFromTypeNode((node).type); + case SyntaxKind.JSDocNullableType: + case SyntaxKind.JSDocNonNullableType: + case SyntaxKind.JSDocConstructorType: + case SyntaxKind.JSDocThisType: + case SyntaxKind.JSDocOptionalType: + return getTypeFromTypeNode((node).type); case SyntaxKind.FunctionType: case SyntaxKind.ConstructorType: case SyntaxKind.TypeLiteral: + case SyntaxKind.JSDocFunctionType: + case SyntaxKind.JSDocRecordType: return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); // This function assumes that an identifier or qualified name is a type expression // Callers should first ensure this by calling isTypeNode @@ -4640,6 +5256,10 @@ namespace ts { case SyntaxKind.QualifiedName: const symbol = getSymbolAtLocation(node); return symbol && getDeclaredTypeOfSymbol(symbol); + case SyntaxKind.JSDocTupleType: + return getTypeFromJSDocTupleType(node); + case SyntaxKind.JSDocVariadicType: + return getTypeFromJSDocVariadicType(node); default: return unknownType; } @@ -4664,42 +5284,29 @@ namespace ts { return t => t === source1 ? target1 : t === source2 ? target2 : t; } - function createTypeMapper(sources: Type[], targets: Type[]): TypeMapper { - switch (sources.length) { - case 1: return createUnaryTypeMapper(sources[0], targets[0]); - case 2: return createBinaryTypeMapper(sources[0], targets[0], sources[1], targets[1]); - } + function createArrayTypeMapper(sources: Type[], targets: Type[]): TypeMapper { return t => { for (let i = 0; i < sources.length; i++) { if (t === sources[i]) { - return targets[i]; + return targets ? targets[i] : anyType; } } return t; }; } - function createUnaryTypeEraser(source: Type): TypeMapper { - return t => t === source ? anyType : t; - } - - function createBinaryTypeEraser(source1: Type, source2: Type): TypeMapper { - return t => t === source1 || t === source2 ? anyType : t; + function createTypeMapper(sources: Type[], targets: Type[]): TypeMapper { + const count = sources.length; + const mapper: TypeMapper = + count == 1 ? createUnaryTypeMapper(sources[0], targets ? targets[0] : anyType) : + count == 2 ? createBinaryTypeMapper(sources[0], targets ? targets[0] : anyType, sources[1], targets ? targets[1] : anyType) : + createArrayTypeMapper(sources, targets); + mapper.mappedTypes = sources; + return mapper; } function createTypeEraser(sources: Type[]): TypeMapper { - switch (sources.length) { - case 1: return createUnaryTypeEraser(sources[0]); - case 2: return createBinaryTypeEraser(sources[0], sources[1]); - } - return t => { - for (const source of sources) { - if (t === source) { - return anyType; - } - } - return t; - }; + return createTypeMapper(sources, undefined); } function getInferenceMapper(context: InferenceContext): TypeMapper { @@ -4714,6 +5321,7 @@ namespace ts { } return t; }; + mapper.mappedTypes = context.typeParameters; mapper.context = context; context.mapper = mapper; } @@ -4725,7 +5333,9 @@ namespace ts { } function combineTypeMappers(mapper1: TypeMapper, mapper2: TypeMapper): TypeMapper { - return t => instantiateType(mapper1(t), mapper2); + const mapper: TypeMapper = t => instantiateType(mapper1(t), mapper2); + mapper.mappedTypes = mapper1.mappedTypes; + return mapper; } function cloneTypeParameter(typeParameter: TypeParameter): TypeParameter { @@ -4754,6 +5364,7 @@ namespace ts { function instantiateSignature(signature: Signature, mapper: TypeMapper, eraseTypeParameters?: boolean): Signature { let freshTypeParameters: TypeParameter[]; + let freshTypePredicate: TypePredicate; if (signature.typeParameters && !eraseTypeParameters) { // First create a fresh set of type parameters, then include a mapping from the old to the // new type parameters in the mapper function. Finally store this mapper in the new type @@ -4764,9 +5375,14 @@ namespace ts { tp.mapper = mapper; } } + if (signature.typePredicate) { + freshTypePredicate = cloneTypePredicate(signature.typePredicate, mapper); + } const result = createSignature(signature.declaration, freshTypeParameters, + signature.thisType && instantiateType(signature.thisType, mapper), instantiateList(signature.parameters, mapper, instantiateSymbol), instantiateType(signature.resolvedReturnType, mapper), + freshTypePredicate, signature.minArgumentCount, signature.hasRestParameter, signature.hasStringLiterals); result.target = signature; result.mapper = mapper; @@ -4815,13 +5431,70 @@ namespace ts { return result; } + function isSymbolInScopeOfMappedTypeParameter(symbol: Symbol, mapper: TypeMapper) { + const mappedTypes = mapper.mappedTypes; + // Starting with the parent of the symbol's declaration, check if the mapper maps any of + // the type parameters introduced by enclosing declarations. We just pick the first + // declaration since multiple declarations will all have the same parent anyway. + let node = symbol.declarations[0].parent; + while (node) { + switch (node.kind) { + case SyntaxKind.FunctionType: + case SyntaxKind.ConstructorType: + case SyntaxKind.FunctionDeclaration: + case SyntaxKind.MethodDeclaration: + case SyntaxKind.MethodSignature: + case SyntaxKind.Constructor: + case SyntaxKind.CallSignature: + case SyntaxKind.ConstructSignature: + case SyntaxKind.IndexSignature: + case SyntaxKind.GetAccessor: + case SyntaxKind.SetAccessor: + case SyntaxKind.FunctionExpression: + case SyntaxKind.ArrowFunction: + case SyntaxKind.ClassDeclaration: + case SyntaxKind.ClassExpression: + case SyntaxKind.InterfaceDeclaration: + case SyntaxKind.TypeAliasDeclaration: + const declaration = node; + if (declaration.typeParameters) { + for (const d of declaration.typeParameters) { + if (contains(mappedTypes, getDeclaredTypeOfTypeParameter(getSymbolOfNode(d)))) { + return true; + } + } + } + if (isClassLike(node) || node.kind === SyntaxKind.InterfaceDeclaration) { + const thisType = getDeclaredTypeOfClassOrInterface(getSymbolOfNode(node)).thisType; + if (thisType && contains(mappedTypes, thisType)) { + return true; + } + } + break; + case SyntaxKind.ModuleDeclaration: + case SyntaxKind.SourceFile: + return false; + } + node = node.parent; + } + return false; + } + function instantiateType(type: Type, mapper: TypeMapper): Type { if (type && mapper !== identityMapper) { if (type.flags & TypeFlags.TypeParameter) { return mapper(type); } if (type.flags & TypeFlags.Anonymous) { - return type.symbol && type.symbol.flags & (SymbolFlags.Function | SymbolFlags.Method | SymbolFlags.Class | SymbolFlags.TypeLiteral | SymbolFlags.ObjectLiteral) ? + // If the anonymous type originates in a declaration of a function, method, class, or + // interface, in an object type literal, or in an object literal expression, we may need + // to instantiate the type because it might reference a type parameter. We skip instantiation + // if none of the type parameters that are in scope in the type's declaration are mapped by + // the given mapper, however we can only do that analysis if the type isn't itself an + // instantiation. + return type.symbol && + type.symbol.flags & (SymbolFlags.Function | SymbolFlags.Method | SymbolFlags.Class | SymbolFlags.TypeLiteral | SymbolFlags.ObjectLiteral) && + (type.flags & TypeFlags.Instantiated || isSymbolInScopeOfMappedTypeParameter(type.symbol, mapper)) ? instantiateAnonymousType(type, mapper) : type; } if (type.flags & TypeFlags.Reference) { @@ -4836,14 +5509,14 @@ namespace ts { if (type.flags & TypeFlags.Intersection) { return getIntersectionType(instantiateList((type).types, mapper, instantiateType)); } - if (type.flags & TypeFlags.PredicateType) { - const predicate = (type as PredicateType).predicate; - return createPredicateType(type.symbol, cloneTypePredicate(predicate, mapper)); - } } return type; } + function instantiateIndexInfo(info: IndexInfo, mapper: TypeMapper): IndexInfo { + return info && createIndexInfo(instantiateType(info.type, mapper), info.isReadonly, info.declaration); + } + // Returns true if the given expression contains (at any level of nesting) a function or arrow expression // that is subject to contextual typing. function isContextSensitive(node: Expression | MethodDeclaration | ObjectLiteralElement): boolean { @@ -4875,7 +5548,13 @@ namespace ts { } function isContextSensitiveFunctionLikeDeclaration(node: FunctionLikeDeclaration) { - return !node.typeParameters && node.parameters.length && !forEach(node.parameters, p => p.type); + const areAllParametersUntyped = !forEach(node.parameters, p => p.type); + const isNullaryArrow = node.kind === SyntaxKind.ArrowFunction && !node.parameters.length; + return !node.typeParameters && areAllParametersUntyped && !isNullaryArrow; + } + + function isContextSensitiveFunctionOrObjectLiteralMethod(func: Node): func is FunctionExpression | MethodDeclaration { + return (isFunctionExpressionOrArrowFunction(func) || isObjectLiteralMethod(func)) && isContextSensitiveFunctionLikeDeclaration(func); } function getTypeWithoutSignatures(type: Type): Type { @@ -4903,6 +5582,10 @@ namespace ts { return checkTypeRelatedTo(source, target, identityRelation, /*errorNode*/ undefined) ? Ternary.True : Ternary.False; } + function compareTypesAssignable(source: Type, target: Type): Ternary { + return checkTypeRelatedTo(source, target, assignableRelation, /*errorNode*/ undefined) ? Ternary.True : Ternary.False; + } + function isTypeSubtypeOf(source: Type, target: Type): boolean { return checkTypeSubtypeOf(source, target, /*errorNode*/ undefined); } @@ -4911,6 +5594,14 @@ namespace ts { return checkTypeAssignableTo(source, target, /*errorNode*/ undefined); } + /** + * This is *not* a bi-directional relationship. + * If one needs to check both directions for comparability, use a second call to this function or 'checkTypeComparableTo'. + */ + function isTypeComparableTo(source: Type, target: Type): boolean { + return checkTypeComparableTo(source, target, /*errorNode*/ undefined); + } + function checkTypeSubtypeOf(source: Type, target: Type, errorNode: Node, headMessage?: DiagnosticMessage, containingMessageChain?: DiagnosticMessageChain): boolean { return checkTypeRelatedTo(source, target, subtypeRelation, errorNode, headMessage, containingMessageChain); } @@ -4919,16 +5610,35 @@ namespace ts { return checkTypeRelatedTo(source, target, assignableRelation, errorNode, headMessage, containingMessageChain); } + /** + * This is *not* a bi-directional relationship. + * If one needs to check both directions for comparability, use a second call to this function or 'isTypeComparableTo'. + */ + function checkTypeComparableTo(source: Type, target: Type, errorNode: Node, headMessage?: DiagnosticMessage, containingMessageChain?: DiagnosticMessageChain): boolean { + return checkTypeRelatedTo(source, target, comparableRelation, errorNode, headMessage, containingMessageChain); + } + + function isSignatureAssignableTo(source: Signature, + target: Signature, + ignoreReturnTypes: boolean): boolean { + return compareSignaturesRelated(source, target, ignoreReturnTypes, /*reportErrors*/ false, /*errorReporter*/ undefined, compareTypesAssignable) !== Ternary.False; + } + /** * See signatureRelatedTo, compareSignaturesIdentical */ - function isSignatureAssignableTo(source: Signature, target: Signature, ignoreReturnTypes: boolean): boolean { + function compareSignaturesRelated(source: Signature, + target: Signature, + ignoreReturnTypes: boolean, + reportErrors: boolean, + errorReporter: (d: DiagnosticMessage, arg0?: string, arg1?: string) => void, + compareTypes: (s: Type, t: Type, reportErrors?: boolean) => Ternary): Ternary { // TODO (drosen): De-duplicate code between related functions. if (source === target) { - return true; + return Ternary.True; } if (!target.hasRestParameter && source.minArgumentCount > target.parameters.length) { - return false; + return Ternary.False; } // Spec 1.0 Section 3.8.3 & 3.8.4: @@ -4936,36 +5646,98 @@ namespace ts { source = getErasedSignature(source); target = getErasedSignature(target); + let result = Ternary.True; + if (source.thisType && target.thisType && source.thisType !== voidType) { + // void sources are assignable to anything. + const related = compareTypes(source.thisType, target.thisType, /*reportErrors*/ false) + || compareTypes(target.thisType, source.thisType, reportErrors); + if (!related) { + if (reportErrors) { + errorReporter(Diagnostics.The_this_types_of_each_signature_are_incompatible); + } + return Ternary.False; + } + result &= related; + } + const sourceMax = getNumNonRestParameters(source); const targetMax = getNumNonRestParameters(target); const checkCount = getNumParametersToCheckForSignatureRelatability(source, sourceMax, target, targetMax); + const sourceParams = source.parameters; + const targetParams = target.parameters; for (let i = 0; i < checkCount; i++) { - const s = i < sourceMax ? getTypeOfSymbol(source.parameters[i]) : getRestTypeOfSignature(source); - const t = i < targetMax ? getTypeOfSymbol(target.parameters[i]) : getRestTypeOfSignature(target); - const related = isTypeAssignableTo(t, s) || isTypeAssignableTo(s, t); + const s = i < sourceMax ? getTypeOfParameter(sourceParams[i]) : getRestTypeOfSignature(source); + const t = i < targetMax ? getTypeOfParameter(targetParams[i]) : getRestTypeOfSignature(target); + const related = compareTypes(s, t, /*reportErrors*/ false) || compareTypes(t, s, reportErrors); if (!related) { - return false; + if (reportErrors) { + errorReporter(Diagnostics.Types_of_parameters_0_and_1_are_incompatible, + sourceParams[i < sourceMax ? i : sourceMax].name, + targetParams[i < targetMax ? i : targetMax].name); + } + return Ternary.False; } + result &= related; } if (!ignoreReturnTypes) { const targetReturnType = getReturnTypeOfSignature(target); if (targetReturnType === voidType) { - return true; + return result; } const sourceReturnType = getReturnTypeOfSignature(source); // The following block preserves behavior forbidding boolean returning functions from being assignable to type guard returning functions - if (targetReturnType.flags & TypeFlags.PredicateType && (targetReturnType as PredicateType).predicate.kind === TypePredicateKind.Identifier) { - if (!(sourceReturnType.flags & TypeFlags.PredicateType)) { - return false; + if (target.typePredicate) { + if (source.typePredicate) { + result &= compareTypePredicateRelatedTo(source.typePredicate, target.typePredicate, reportErrors, errorReporter, compareTypes); + } + else if (isIdentifierTypePredicate(target.typePredicate)) { + if (reportErrors) { + errorReporter(Diagnostics.Signature_0_must_have_a_type_predicate, signatureToString(source)); + } + return Ternary.False; } } + else { + result &= compareTypes(sourceReturnType, targetReturnType, reportErrors); + } - return isTypeAssignableTo(sourceReturnType, targetReturnType); } - return true; + return result; + } + + function compareTypePredicateRelatedTo(source: TypePredicate, + target: TypePredicate, + reportErrors: boolean, + errorReporter: (d: DiagnosticMessage, arg0?: string, arg1?: string) => void, + compareTypes: (s: Type, t: Type, reportErrors?: boolean) => Ternary): Ternary { + if (source.kind !== target.kind) { + if (reportErrors) { + errorReporter(Diagnostics.A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard); + errorReporter(Diagnostics.Type_predicate_0_is_not_assignable_to_1, typePredicateToString(source), typePredicateToString(target)); + } + return Ternary.False; + } + + if (source.kind === TypePredicateKind.Identifier) { + const sourceIdentifierPredicate = source as IdentifierTypePredicate; + const targetIdentifierPredicate = target as IdentifierTypePredicate; + if (sourceIdentifierPredicate.parameterIndex !== targetIdentifierPredicate.parameterIndex) { + if (reportErrors) { + errorReporter(Diagnostics.Parameter_0_is_not_in_the_same_position_as_parameter_1, sourceIdentifierPredicate.parameterName, targetIdentifierPredicate.parameterName); + errorReporter(Diagnostics.Type_predicate_0_is_not_assignable_to_1, typePredicateToString(source), typePredicateToString(target)); + } + return Ternary.False; + } + } + + const related = compareTypes(source.type, target.type, reportErrors); + if (related === Ternary.False && reportErrors) { + errorReporter(Diagnostics.Type_predicate_0_is_not_assignable_to_1, typePredicateToString(source), typePredicateToString(target)); + } + return related; } function isImplementationCompatibleWithOverload(implementation: Signature, overload: Signature): boolean { @@ -5015,7 +5787,7 @@ namespace ts { * Checks if 'source' is related to 'target' (e.g.: is a assignable to). * @param source The left-hand-side of the relation. * @param target The right-hand-side of the relation. - * @param relation The relation considered. One of 'identityRelation', 'assignableRelation', or 'subTypeRelation'. + * @param relation The relation considered. One of 'identityRelation', 'subtypeRelation', 'assignableRelation', or 'comparableRelation'. * Used as both to determine which checks are performed and as a cache of previously computed results. * @param errorNode The suggested node upon which all errors will be reported, if defined. This may or may not be the actual node used. * @param headMessage If the error chain should be prepended by a head message, then headMessage will be used. @@ -5036,24 +5808,14 @@ namespace ts { let expandingFlags: number; let depth = 0; let overflow = false; - let elaborateErrors = false; Debug.assert(relation !== identityRelation || !errorNode, "no error reporting in identity checking"); - const result = isRelatedTo(source, target, errorNode !== undefined, headMessage); + const result = isRelatedTo(source, target, /*reportErrors*/ !!errorNode, headMessage); if (overflow) { error(errorNode, Diagnostics.Excessive_stack_depth_comparing_types_0_and_1, typeToString(source), typeToString(target)); } else if (errorInfo) { - // If we already computed this relation, but in a context where we didn't want to report errors (e.g. overload resolution), - // then we'll only have a top-level error (e.g. 'Class X does not implement interface Y') without any details. If this happened, - // request a recompuation to get a complete error message. This will be skipped if we've already done this computation in a context - // where errors were being reported. - if (errorInfo.next === undefined) { - errorInfo = undefined; - elaborateErrors = true; - isRelatedTo(source, target, errorNode !== undefined, headMessage); - } if (containingMessageChain) { errorInfo = concatenateDiagnosticMessageChains(containingMessageChain, errorInfo); } @@ -5063,6 +5825,7 @@ namespace ts { return result !== Ternary.False; function reportError(message: DiagnosticMessage, arg0?: string, arg1?: string, arg2?: string): void { + Debug.assert(!!errorNode); errorInfo = chainDiagnosticMessages(errorInfo, message, arg0, arg1, arg2); } @@ -5073,7 +5836,14 @@ namespace ts { sourceType = typeToString(source, /*enclosingDeclaration*/ undefined, TypeFormatFlags.UseFullyQualifiedType); targetType = typeToString(target, /*enclosingDeclaration*/ undefined, TypeFormatFlags.UseFullyQualifiedType); } - reportError(message || Diagnostics.Type_0_is_not_assignable_to_type_1, sourceType, targetType); + + if (!message) { + message = relation === comparableRelation ? + Diagnostics.Type_0_is_not_comparable_to_type_1 : + Diagnostics.Type_0_is_not_assignable_to_type_1; + } + + reportError(message, sourceType, targetType); } // Compare two types and return @@ -5088,49 +5858,28 @@ namespace ts { return isIdenticalTo(source, target); } - if (isTypeAny(target)) return Ternary.True; - if (source === undefinedType) return Ternary.True; - if (source === nullType && target !== undefinedType) return Ternary.True; - if (source.flags & TypeFlags.Enum && target === numberType) return Ternary.True; - if (source.flags & TypeFlags.Enum && target.flags & TypeFlags.Enum) { - if (result = enumRelatedTo(source, target)) { - return result; + if (!(target.flags & TypeFlags.Never)) { + if (target.flags & TypeFlags.Any) return Ternary.True; + if (source.flags & TypeFlags.Undefined) { + if (!strictNullChecks || target.flags & (TypeFlags.Undefined | TypeFlags.Void) || source === emptyArrayElementType) return Ternary.True; } - } - if (source.flags & TypeFlags.StringLiteral && target === stringType) return Ternary.True; - if (relation === assignableRelation) { - if (isTypeAny(source)) return Ternary.True; - if (source === numberType && target.flags & TypeFlags.Enum) return Ternary.True; - } - if (source.flags & TypeFlags.Boolean && target.flags & TypeFlags.Boolean) { - if (source.flags & TypeFlags.PredicateType && target.flags & TypeFlags.PredicateType) { - const sourcePredicate = source as PredicateType; - const targetPredicate = target as PredicateType; - if (sourcePredicate.predicate.kind !== targetPredicate.predicate.kind) { - if (reportErrors) { - reportError(Diagnostics.A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard); - reportError(Diagnostics.Type_predicate_0_is_not_assignable_to_1, typeToString(source), typeToString(target)); - } - return Ternary.False; - } - if (sourcePredicate.predicate.kind === TypePredicateKind.Identifier) { - const sourceIdentifierPredicate = sourcePredicate.predicate as IdentifierTypePredicate; - const targetIdentifierPredicate = targetPredicate.predicate as IdentifierTypePredicate; - if (sourceIdentifierPredicate.parameterIndex !== targetIdentifierPredicate.parameterIndex) { - if (reportErrors) { - reportError(Diagnostics.Parameter_0_is_not_in_the_same_position_as_parameter_1, sourceIdentifierPredicate.parameterName, targetIdentifierPredicate.parameterName); - reportError(Diagnostics.Type_predicate_0_is_not_assignable_to_1, typeToString(source), typeToString(target)); - } - return Ternary.False; - } - } - const related = isRelatedTo(sourcePredicate.predicate.type, targetPredicate.predicate.type, reportErrors, headMessage); - if (related === Ternary.False && reportErrors) { - reportError(Diagnostics.Type_predicate_0_is_not_assignable_to_1, typeToString(source), typeToString(target)); - } - return related; + if (source.flags & TypeFlags.Null) { + if (!strictNullChecks || target.flags & TypeFlags.Null) return Ternary.True; + } + if (source.flags & TypeFlags.Enum && target === numberType) return Ternary.True; + if (source.flags & TypeFlags.Enum && target.flags & TypeFlags.Enum) { + if (result = enumRelatedTo(source, target, reportErrors)) { + return result; + } + } + if (source.flags & TypeFlags.StringLiteral && target === stringType) return Ternary.True; + if (relation === assignableRelation || relation === comparableRelation) { + if (source.flags & (TypeFlags.Any | TypeFlags.Never)) return Ternary.True; + if (source === numberType && target.flags & TypeFlags.Enum) return Ternary.True; + } + if (source.flags & TypeFlags.Boolean && target.flags & TypeFlags.Boolean) { + return Ternary.True; } - return Ternary.True; } if (source.flags & TypeFlags.FreshObjectLiteral) { @@ -5151,29 +5900,50 @@ namespace ts { const saveErrorInfo = errorInfo; - // Note that the "each" checks must precede the "some" checks to produce the correct results + // Note that these checks are specifically ordered to produce correct results. if (source.flags & TypeFlags.Union) { - if (result = eachTypeRelatedToType(source, target, reportErrors)) { + if (relation === comparableRelation) { + result = someTypeRelatedToType(source as UnionType, target, reportErrors); + } + else { + result = eachTypeRelatedToType(source as UnionType, target, reportErrors); + } + + if (result) { return result; } } else if (target.flags & TypeFlags.Intersection) { - if (result = typeRelatedToEachType(source, target, reportErrors)) { + result = typeRelatedToEachType(source, target as IntersectionType, reportErrors); + + if (result) { return result; } } else { - // It is necessary to try "some" checks on both sides because there may be nested "each" checks + // It is necessary to try these "some" checks on both sides because there may be nested "each" checks // on either side that need to be prioritized. For example, A | B = (A | B) & (C | D) or // A & B = (A & B) | (C & D). if (source.flags & TypeFlags.Intersection) { - // If target is a union type the following check will report errors so we suppress them here - if (result = someTypeRelatedToType(source, target, reportErrors && !(target.flags & TypeFlags.Union))) { + // Check to see if any constituents of the intersection are immediately related to the target. + // + // Don't report errors though. Checking whether a constituent is related to the source is not actually + // useful and leads to some confusing error messages. Instead it is better to let the below checks + // take care of this, or to not elaborate at all. For instance, + // + // - For an object type (such as 'C = A & B'), users are usually more interested in structural errors. + // + // - For a union type (such as '(A | B) = (C & D)'), it's better to hold onto the whole intersection + // than to report that 'D' is not assignable to 'A' or 'B'. + // + // - For a primitive type or type parameter (such as 'number = A & B') there is no point in + // breaking the intersection apart. + if (result = someTypeRelatedToType(source, target, /*reportErrors*/ false)) { return result; } } if (target.flags & TypeFlags.Union) { - if (result = typeRelatedToSomeType(source, target, reportErrors)) { + if (result = typeRelatedToSomeType(source, target, reportErrors && !(source.flags & TypeFlags.Primitive))) { return result; } } @@ -5181,9 +5951,14 @@ namespace ts { if (source.flags & TypeFlags.TypeParameter) { let constraint = getConstraintOfTypeParameter(source); + if (!constraint || constraint.flags & TypeFlags.Any) { constraint = emptyObjectType; } + + // The constraint may need to be further instantiated with its 'this' type. + constraint = getTypeWithThisArgument(constraint, source); + // Report constraint errors only if the constraint is not the empty object type const reportConstraintErrors = reportErrors && constraint !== emptyObjectType; if (result = isRelatedTo(constraint, target, reportConstraintErrors)) { @@ -5200,14 +5975,14 @@ namespace ts { } // Even if relationship doesn't hold for unions, intersections, or generic type references, // it may hold in a structural comparison. - const apparentType = getApparentType(source); + const apparentSource = getApparentType(source); // In a check of the form X = A & B, we will have previously checked if A relates to X or B relates // to X. Failing both of those we want to check if the aggregation of A and B's members structurally // relates to X. Thus, we include intersection types on the source side here. - if (apparentType.flags & (TypeFlags.ObjectType | TypeFlags.Intersection) && target.flags & TypeFlags.ObjectType) { + if (apparentSource.flags & (TypeFlags.ObjectType | TypeFlags.Intersection) && target.flags & TypeFlags.ObjectType) { // Report structural errors only if we haven't reported any errors yet - const reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo; - if (result = objectTypeRelatedTo(apparentType, source, target, reportStructuralErrors)) { + const reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo && !(source.flags & TypeFlags.Primitive); + if (result = objectTypeRelatedTo(apparentSource, source, target, reportStructuralErrors)) { errorInfo = saveErrorInfo; return result; } @@ -5233,8 +6008,8 @@ namespace ts { } if (source.flags & TypeFlags.Union && target.flags & TypeFlags.Union || source.flags & TypeFlags.Intersection && target.flags & TypeFlags.Intersection) { - if (result = eachTypeRelatedToSomeType(source, target)) { - if (result &= eachTypeRelatedToSomeType(target, source)) { + if (result = eachTypeRelatedToSomeType(source, target, /*reportErrors*/ false)) { + if (result &= eachTypeRelatedToSomeType(target, source, /*reportErrors*/ false)) { return result; } } @@ -5249,8 +6024,9 @@ namespace ts { function isKnownProperty(type: Type, name: string): boolean { if (type.flags & TypeFlags.ObjectType) { const resolved = resolveStructuredTypeMembers(type); - if (relation === assignableRelation && (type === globalObjectType || resolved.properties.length === 0) || - resolved.stringIndexType || resolved.numberIndexType || getPropertyOfType(type, name)) { + if ((relation === assignableRelation || relation === comparableRelation) && + (type === globalObjectType || isEmptyObjectType(resolved)) || + resolved.stringIndexInfo || resolved.numberIndexInfo || getPropertyOfType(type, name)) { return true; } } @@ -5264,14 +6040,23 @@ namespace ts { return false; } + function isEmptyObjectType(t: ResolvedType) { + return t.properties.length === 0 && + t.callSignatures.length === 0 && + t.constructSignatures.length === 0 && + !t.stringIndexInfo && + !t.numberIndexInfo; + } + function hasExcessProperties(source: FreshObjectLiteralType, target: Type, reportErrors: boolean): boolean { - if (!(target.flags & TypeFlags.ObjectLiteralPatternWithComputedProperties) && someConstituentTypeHasKind(target, TypeFlags.ObjectType)) { + if (!(target.flags & TypeFlags.ObjectLiteralPatternWithComputedProperties) && maybeTypeOfKind(target, TypeFlags.ObjectType)) { for (const prop of getPropertiesOfObjectType(source)) { if (!isKnownProperty(target, prop.name)) { if (reportErrors) { // We know *exactly* where things went wrong when comparing the types. // Use this property as the error node as this will be more helpful in // reasoning about what went wrong. + Debug.assert(!!errorNode); errorNode = prop.valueDeclaration; reportError(Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1, symbolToString(prop), typeToString(target)); @@ -5283,7 +6068,7 @@ namespace ts { return false; } - function eachTypeRelatedToSomeType(source: UnionOrIntersectionType, target: UnionOrIntersectionType): Ternary { + function eachTypeRelatedToSomeType(source: UnionOrIntersectionType, target: UnionOrIntersectionType, reportErrors: boolean): Ternary { let result = Ternary.True; const sourceTypes = source.types; for (const sourceType of sourceTypes) { @@ -5298,7 +6083,19 @@ namespace ts { function typeRelatedToSomeType(source: Type, target: UnionOrIntersectionType, reportErrors: boolean): Ternary { const targetTypes = target.types; - for (let i = 0, len = targetTypes.length; i < len; i++) { + let len = targetTypes.length; + // The null and undefined types are guaranteed to be at the end of the constituent type list. In order + // to produce the best possible errors we first check the nullable types, such that the last type we + // check and report errors from is a non-nullable type if one is present. + while (len >= 2 && targetTypes[len - 1].flags & TypeFlags.Nullable) { + const related = isRelatedTo(source, targetTypes[len - 1], /*reportErrors*/ false); + if (related) { + return related; + } + len--; + } + // Now check the non-nullable types and report errors on the last one. + for (let i = 0; i < len; i++) { const related = isRelatedTo(source, targetTypes[i], reportErrors && i === len - 1); if (related) { return related; @@ -5322,7 +6119,19 @@ namespace ts { function someTypeRelatedToType(source: UnionOrIntersectionType, target: Type, reportErrors: boolean): Ternary { const sourceTypes = source.types; - for (let i = 0, len = sourceTypes.length; i < len; i++) { + let len = sourceTypes.length; + // The null and undefined types are guaranteed to be at the end of the constituent type list. In order + // to produce the best possible errors we first check the nullable types, such that the last type we + // check and report errors from is a non-nullable type if one is present. + while (len >= 2 && sourceTypes[len - 1].flags & TypeFlags.Nullable) { + const related = isRelatedTo(sourceTypes[len - 1], target, /*reportErrors*/ false); + if (related) { + return related; + } + len--; + } + // Now check the non-nullable types and report errors on the last one. + for (let i = 0; i < len; i++) { const related = isRelatedTo(sourceTypes[i], target, reportErrors && i === len - 1); if (related) { return related; @@ -5374,7 +6183,7 @@ namespace ts { const id = relation !== identityRelation || source.id < target.id ? source.id + "," + target.id : target.id + "," + source.id; const related = relation[id]; if (related !== undefined) { - if (elaborateErrors && related === RelationComparisonResult.Failed) { + if (reportErrors && related === RelationComparisonResult.Failed) { // We are elaborating errors and the cached result is an unreported failure. Record the result as a reported // failure and continue computing the relation such that errors get reported. relation[id] = RelationComparisonResult.FailedAndReported; @@ -5420,9 +6229,9 @@ namespace ts { if (result) { result &= signaturesRelatedTo(source, target, SignatureKind.Construct, reportErrors); if (result) { - result &= stringIndexTypesRelatedTo(source, originalSource, target, reportErrors); + result &= indexTypesRelatedTo(source, originalSource, target, IndexKind.String, reportErrors); if (result) { - result &= numberIndexTypesRelatedTo(source, originalSource, target, reportErrors); + result &= indexTypesRelatedTo(source, originalSource, target, IndexKind.Number, reportErrors); } } } @@ -5483,8 +6292,8 @@ namespace ts { } else if (targetPropFlags & NodeFlags.Protected) { const sourceDeclaredInClass = sourceProp.parent && sourceProp.parent.flags & SymbolFlags.Class; - const sourceClass = sourceDeclaredInClass ? getDeclaredTypeOfSymbol(sourceProp.parent) : undefined; - const targetClass = getDeclaredTypeOfSymbol(targetProp.parent); + const sourceClass = sourceDeclaredInClass ? getDeclaredTypeOfSymbol(getParentOfSymbol(sourceProp)) : undefined; + const targetClass = getDeclaredTypeOfSymbol(getParentOfSymbol(targetProp)); if (!sourceClass || !hasBaseType(sourceClass, targetClass)) { if (reportErrors) { reportError(Diagnostics.Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2, @@ -5562,121 +6371,53 @@ namespace ts { const sourceSignatures = getSignaturesOfType(source, kind); const targetSignatures = getSignaturesOfType(target, kind); - if (kind === SignatureKind.Construct && sourceSignatures.length && targetSignatures.length && - isAbstractConstructorType(source) && !isAbstractConstructorType(target)) { - // An abstract constructor type is not assignable to a non-abstract constructor type - // as it would otherwise be possible to new an abstract class. Note that the assignablity - // check we perform for an extends clause excludes construct signatures from the target, - // so this check never proceeds. - if (reportErrors) { - reportError(Diagnostics.Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type); + if (kind === SignatureKind.Construct && sourceSignatures.length && targetSignatures.length) { + if (isAbstractConstructorType(source) && !isAbstractConstructorType(target)) { + // An abstract constructor type is not assignable to a non-abstract constructor type + // as it would otherwise be possible to new an abstract class. Note that the assignability + // check we perform for an extends clause excludes construct signatures from the target, + // so this check never proceeds. + if (reportErrors) { + reportError(Diagnostics.Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type); + } + return Ternary.False; + } + if (!constructorVisibilitiesAreCompatible(sourceSignatures[0], targetSignatures[0], reportErrors)) { + return Ternary.False; } - return Ternary.False; } let result = Ternary.True; const saveErrorInfo = errorInfo; outer: for (const t of targetSignatures) { - if (!t.hasStringLiterals || target.flags & TypeFlags.FromSignature) { - // Only elaborate errors from the first failure - let shouldElaborateErrors = reportErrors; - for (const s of sourceSignatures) { - if (!s.hasStringLiterals || source.flags & TypeFlags.FromSignature) { - const related = signatureRelatedTo(s, t, shouldElaborateErrors); - if (related) { - result &= related; - errorInfo = saveErrorInfo; - continue outer; - } - shouldElaborateErrors = false; - } + // Only elaborate errors from the first failure + let shouldElaborateErrors = reportErrors; + for (const s of sourceSignatures) { + const related = signatureRelatedTo(s, t, shouldElaborateErrors); + if (related) { + result &= related; + errorInfo = saveErrorInfo; + continue outer; } - // don't elaborate the primitive apparent types (like Number) - // because the actual primitives will have already been reported. - if (shouldElaborateErrors && !isPrimitiveApparentType(source)) { - reportError(Diagnostics.Type_0_provides_no_match_for_the_signature_1, - typeToString(source), - signatureToString(t, /*enclosingDeclaration*/ undefined, /*flags*/ undefined, kind)); - } - return Ternary.False; + shouldElaborateErrors = false; } + + if (shouldElaborateErrors) { + reportError(Diagnostics.Type_0_provides_no_match_for_the_signature_1, + typeToString(source), + signatureToString(t, /*enclosingDeclaration*/ undefined, /*flags*/ undefined, kind)); + } + return Ternary.False; } return result; } /** - * See signatureAssignableTo, signatureAssignableTo + * See signatureAssignableTo, compareSignaturesIdentical */ function signatureRelatedTo(source: Signature, target: Signature, reportErrors: boolean): Ternary { - // TODO (drosen): De-duplicate code between related functions. - if (source === target) { - return Ternary.True; - } - if (!target.hasRestParameter && source.minArgumentCount > target.parameters.length) { - return Ternary.False; - } - let sourceMax = source.parameters.length; - let targetMax = target.parameters.length; - let checkCount: number; - if (source.hasRestParameter && target.hasRestParameter) { - checkCount = sourceMax > targetMax ? sourceMax : targetMax; - sourceMax--; - targetMax--; - } - else if (source.hasRestParameter) { - sourceMax--; - checkCount = targetMax; - } - else if (target.hasRestParameter) { - targetMax--; - checkCount = sourceMax; - } - else { - checkCount = sourceMax < targetMax ? sourceMax : targetMax; - } - // Spec 1.0 Section 3.8.3 & 3.8.4: - // M and N (the signatures) are instantiated using type Any as the type argument for all type parameters declared by M and N - source = getErasedSignature(source); - target = getErasedSignature(target); - let result = Ternary.True; - for (let i = 0; i < checkCount; i++) { - const s = i < sourceMax ? getTypeOfSymbol(source.parameters[i]) : getRestTypeOfSignature(source); - const t = i < targetMax ? getTypeOfSymbol(target.parameters[i]) : getRestTypeOfSignature(target); - const saveErrorInfo = errorInfo; - let related = isRelatedTo(s, t, reportErrors); - if (!related) { - related = isRelatedTo(t, s, /*reportErrors*/ false); - if (!related) { - if (reportErrors) { - reportError(Diagnostics.Types_of_parameters_0_and_1_are_incompatible, - source.parameters[i < sourceMax ? i : sourceMax].name, - target.parameters[i < targetMax ? i : targetMax].name); - } - return Ternary.False; - } - errorInfo = saveErrorInfo; - } - result &= related; - } - - const targetReturnType = getReturnTypeOfSignature(target); - if (targetReturnType === voidType) { - return result; - } - const sourceReturnType = getReturnTypeOfSignature(source); - - // The following block preserves behavior forbidding boolean returning functions from being assignable to type guard returning functions - if (targetReturnType.flags & TypeFlags.PredicateType && (targetReturnType as PredicateType).predicate.kind === TypePredicateKind.Identifier) { - if (!(sourceReturnType.flags & TypeFlags.PredicateType)) { - if (reportErrors) { - reportError(Diagnostics.Signature_0_must_have_a_type_predicate, signatureToString(source)); - } - return Ternary.False; - } - } - - return result & isRelatedTo(sourceReturnType, targetReturnType, reportErrors); + return compareSignaturesRelated(source, target, /*ignoreReturnTypes*/ false, reportErrors, reportError, isRelatedTo); } function signaturesIdenticalTo(source: Type, target: Type, kind: SignatureKind): Ternary { @@ -5687,7 +6428,7 @@ namespace ts { } let result = Ternary.True; for (let i = 0, len = sourceSignatures.length; i < len; i++) { - const related = compareSignaturesIdentical(sourceSignatures[i], targetSignatures[i], /*partialMatch*/ false, /*ignoreReturnTypes*/ false, isRelatedTo); + const related = compareSignaturesIdentical(sourceSignatures[i], targetSignatures[i], /*partialMatch*/ false, /*ignoreThisTypes*/ false, /*ignoreReturnTypes*/ false, isRelatedTo); if (!related) { return Ternary.False; } @@ -5696,87 +6437,77 @@ namespace ts { return result; } - function stringIndexTypesRelatedTo(source: Type, originalSource: Type, target: Type, reportErrors: boolean): Ternary { - if (relation === identityRelation) { - return indexTypesIdenticalTo(IndexKind.String, source, target); - } - const targetType = getIndexTypeOfType(target, IndexKind.String); - if (targetType) { - if ((targetType.flags & TypeFlags.Any) && !(originalSource.flags & TypeFlags.Primitive)) { - // non-primitive assignment to any is always allowed, eg - // `var x: { [index: string]: any } = { property: 12 };` - return Ternary.True; - } - const sourceType = getIndexTypeOfType(source, IndexKind.String); - if (!sourceType) { - if (reportErrors) { - reportError(Diagnostics.Index_signature_is_missing_in_type_0, typeToString(source)); + function eachPropertyRelatedTo(source: Type, target: Type, kind: IndexKind, reportErrors: boolean): Ternary { + let result = Ternary.True; + for (const prop of getPropertiesOfObjectType(source)) { + if (kind === IndexKind.String || isNumericLiteralName(prop.name)) { + const related = isRelatedTo(getTypeOfSymbol(prop), target, reportErrors); + if (!related) { + if (reportErrors) { + reportError(Diagnostics.Property_0_is_incompatible_with_index_signature, symbolToString(prop)); + } + return Ternary.False; } - return Ternary.False; + result &= related; } - const related = isRelatedTo(sourceType, targetType, reportErrors); - if (!related) { - if (reportErrors) { - reportError(Diagnostics.Index_signatures_are_incompatible); - } - return Ternary.False; - } - return related; } - return Ternary.True; + return result; } - function numberIndexTypesRelatedTo(source: Type, originalSource: Type, target: Type, reportErrors: boolean): Ternary { - if (relation === identityRelation) { - return indexTypesIdenticalTo(IndexKind.Number, source, target); + function indexInfoRelatedTo(sourceInfo: IndexInfo, targetInfo: IndexInfo, reportErrors: boolean) { + const related = isRelatedTo(sourceInfo.type, targetInfo.type, reportErrors); + if (!related && reportErrors) { + reportError(Diagnostics.Index_signatures_are_incompatible); } - const targetType = getIndexTypeOfType(target, IndexKind.Number); - if (targetType) { - if ((targetType.flags & TypeFlags.Any) && !(originalSource.flags & TypeFlags.Primitive)) { - // non-primitive assignment to any is always allowed, eg - // `var x: { [index: number]: any } = { property: 12 };` - return Ternary.True; - } - const sourceStringType = getIndexTypeOfType(source, IndexKind.String); - const sourceNumberType = getIndexTypeOfType(source, IndexKind.Number); - if (!(sourceStringType || sourceNumberType)) { - if (reportErrors) { - reportError(Diagnostics.Index_signature_is_missing_in_type_0, typeToString(source)); - } - return Ternary.False; - } - let related: Ternary; - if (sourceStringType && sourceNumberType) { - // If we know for sure we're testing both string and numeric index types then only report errors from the second one - related = isRelatedTo(sourceStringType, targetType, /*reportErrors*/ false) || isRelatedTo(sourceNumberType, targetType, reportErrors); - } - else { - related = isRelatedTo(sourceStringType || sourceNumberType, targetType, reportErrors); - } - if (!related) { - if (reportErrors) { - reportError(Diagnostics.Index_signatures_are_incompatible); - } - return Ternary.False; - } - return related; - } - return Ternary.True; + return related; } - function indexTypesIdenticalTo(indexKind: IndexKind, source: Type, target: Type): Ternary { - const targetType = getIndexTypeOfType(target, indexKind); - const sourceType = getIndexTypeOfType(source, indexKind); - if (!sourceType && !targetType) { + function indexTypesRelatedTo(source: Type, originalSource: Type, target: Type, kind: IndexKind, reportErrors: boolean) { + if (relation === identityRelation) { + return indexTypesIdenticalTo(source, target, kind); + } + const targetInfo = getIndexInfoOfType(target, kind); + if (!targetInfo || ((targetInfo.type.flags & TypeFlags.Any) && !(originalSource.flags & TypeFlags.Primitive))) { + // Index signature of type any permits assignment from everything but primitives return Ternary.True; } - if (sourceType && targetType) { - return isRelatedTo(sourceType, targetType); + const sourceInfo = getIndexInfoOfType(source, kind) || + kind === IndexKind.Number && getIndexInfoOfType(source, IndexKind.String); + if (sourceInfo) { + return indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors); + } + if (isObjectLiteralType(source)) { + let related = Ternary.True; + if (kind === IndexKind.String) { + const sourceNumberInfo = getIndexInfoOfType(source, IndexKind.Number); + if (sourceNumberInfo) { + related = indexInfoRelatedTo(sourceNumberInfo, targetInfo, reportErrors); + } + } + if (related) { + related &= eachPropertyRelatedTo(source, targetInfo.type, kind, reportErrors); + } + return related; + } + if (reportErrors) { + reportError(Diagnostics.Index_signature_is_missing_in_type_0, typeToString(source)); } return Ternary.False; } - function enumRelatedTo(source: Type, target: Type) { + function indexTypesIdenticalTo(source: Type, target: Type, indexKind: IndexKind): Ternary { + const targetInfo = getIndexInfoOfType(target, indexKind); + const sourceInfo = getIndexInfoOfType(source, indexKind); + if (!sourceInfo && !targetInfo) { + return Ternary.True; + } + if (sourceInfo && targetInfo && sourceInfo.isReadonly === targetInfo.isReadonly) { + return isRelatedTo(sourceInfo.type, targetInfo.type); + } + return Ternary.False; + } + + function enumRelatedTo(source: Type, target: Type, reportErrors?: boolean) { if (source.symbol.name !== target.symbol.name || source.symbol.flags & SymbolFlags.ConstEnum || target.symbol.flags & SymbolFlags.ConstEnum) { @@ -5787,15 +6518,47 @@ namespace ts { if (property.flags & SymbolFlags.EnumMember) { const targetProperty = getPropertyOfType(targetEnumType, property.name); if (!targetProperty || !(targetProperty.flags & SymbolFlags.EnumMember)) { - reportError(Diagnostics.Property_0_is_missing_in_type_1, - property.name, - typeToString(target, /*enclosingDeclaration*/ undefined, TypeFormatFlags.UseFullyQualifiedType)); + if (reportErrors) { + reportError(Diagnostics.Property_0_is_missing_in_type_1, + property.name, + typeToString(target, /*enclosingDeclaration*/ undefined, TypeFormatFlags.UseFullyQualifiedType)); + } return Ternary.False; } } } return Ternary.True; } + + function constructorVisibilitiesAreCompatible(sourceSignature: Signature, targetSignature: Signature, reportErrors: boolean) { + if (!sourceSignature.declaration || !targetSignature.declaration) { + return true; + } + + const sourceAccessibility = sourceSignature.declaration.flags & (NodeFlags.Private | NodeFlags.Protected); + const targetAccessibility = targetSignature.declaration.flags & (NodeFlags.Private | NodeFlags.Protected); + + // A public, protected and private signature is assignable to a private signature. + if (targetAccessibility === NodeFlags.Private) { + return true; + } + + // A public and protected signature is assignable to a protected signature. + if (targetAccessibility === NodeFlags.Protected && sourceAccessibility !== NodeFlags.Private) { + return true; + } + + // Only a public signature is assignable to public signature. + if (targetAccessibility !== NodeFlags.Protected && !sourceAccessibility) { + return true; + } + + if (reportErrors) { + reportError(Diagnostics.Cannot_assign_a_0_constructor_type_to_a_1_constructor_type, visibilityToString(sourceAccessibility), visibilityToString(targetAccessibility)); + } + + return false; + } } // Return true if the given type is the constructor type for an abstract class @@ -5859,6 +6622,9 @@ namespace ts { return Ternary.False; } } + if (isReadonlySymbol(sourceProp) !== isReadonlySymbol(targetProp)) { + return Ternary.False; + } return compareTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp)); } @@ -5884,7 +6650,7 @@ namespace ts { /** * See signatureRelatedTo, compareSignaturesIdentical */ - function compareSignaturesIdentical(source: Signature, target: Signature, partialMatch: boolean, ignoreReturnTypes: boolean, compareTypes: (s: Type, t: Type) => Ternary): Ternary { + function compareSignaturesIdentical(source: Signature, target: Signature, partialMatch: boolean, ignoreThisTypes: boolean, ignoreReturnTypes: boolean, compareTypes: (s: Type, t: Type) => Ternary): Ternary { // TODO (drosen): De-duplicate code between related functions. if (source === target) { return Ternary.True; @@ -5905,10 +6671,17 @@ namespace ts { source = getErasedSignature(source); target = getErasedSignature(target); let result = Ternary.True; + if (!ignoreThisTypes && source.thisType && target.thisType) { + const related = compareTypes(source.thisType, target.thisType); + if (!related) { + return Ternary.False; + } + result &= related; + } const targetLen = target.parameters.length; for (let i = 0; i < targetLen; i++) { - const s = isRestParameterIndex(source, i) ? getRestTypeOfSignature(source) : getTypeOfSymbol(source.parameters[i]); - const t = isRestParameterIndex(target, i) ? getRestTypeOfSignature(target) : getTypeOfSymbol(target.parameters[i]); + const s = isRestParameterIndex(source, i) ? getRestTypeOfSignature(source) : getTypeOfParameter(source.parameters[i]); + const t = isRestParameterIndex(target, i) ? getRestTypeOfSignature(target) : getTypeOfParameter(target.parameters[i]); const related = compareTypes(s, t); if (!related) { return Ternary.False; @@ -5926,14 +6699,30 @@ namespace ts { } function isSupertypeOfEach(candidate: Type, types: Type[]): boolean { - for (const type of types) { - if (candidate !== type && !isTypeSubtypeOf(type, candidate)) return false; + for (const t of types) { + if (candidate !== t && !isTypeSubtypeOf(t, candidate)) return false; } return true; } + function getCombinedFlagsOfTypes(types: Type[]) { + let flags: TypeFlags = 0; + for (const t of types) { + flags |= t.flags; + } + return flags; + } + function getCommonSupertype(types: Type[]): Type { - return forEach(types, t => isSupertypeOfEach(t, types) ? t : undefined); + if (!strictNullChecks) { + return forEach(types, t => isSupertypeOfEach(t, types) ? t : undefined); + } + const primaryTypes = filter(types, t => !(t.flags & TypeFlags.Nullable)); + if (!primaryTypes.length) { + return getUnionType(types); + } + const supertype = forEach(primaryTypes, t => isSupertypeOfEach(t, primaryTypes) ? t : undefined); + return supertype && addNullableKind(supertype, getCombinedFlagsOfTypes(types) & TypeFlags.Nullable); } function reportNoCommonSupertypeError(types: Type[], errorLocation: Node, errorMessageChainHead: DiagnosticMessageChain): void { @@ -5982,8 +6771,10 @@ namespace ts { } function isArrayLikeType(type: Type): boolean { - // A type is array-like if it is not the undefined or null type and if it is assignable to any[] - return !(type.flags & (TypeFlags.Undefined | TypeFlags.Null)) && isTypeAssignableTo(type, anyArrayType); + // A type is array-like if it is a reference to the global Array or global ReadonlyArray type, + // or if it is not the undefined or null type and if it is assignable to ReadonlyArray + return type.flags & TypeFlags.Reference && ((type).target === globalArrayType || (type).target === globalReadonlyArrayType) || + !(type.flags & TypeFlags.Nullable) && isTypeAssignableTo(type, anyReadonlyArrayType); } function isTupleLikeType(type: Type): boolean { @@ -6002,6 +6793,44 @@ namespace ts { return !!(type.flags & TypeFlags.Tuple); } + function getNullableKind(type: Type): TypeFlags { + let flags = type.flags; + if (flags & TypeFlags.Union) { + for (const t of (type as UnionType).types) { + flags |= t.flags; + } + } + return flags & TypeFlags.Nullable; + } + + function addNullableKind(type: Type, kind: TypeFlags): Type { + if ((getNullableKind(type) & kind) !== kind) { + const types = [type]; + if (kind & TypeFlags.Undefined) { + types.push(undefinedType); + } + if (kind & TypeFlags.Null) { + types.push(nullType); + } + type = getUnionType(types); + } + return type; + } + + function getNonNullableType(type: Type): Type { + return strictNullChecks ? getTypeWithFacts(type, TypeFacts.NEUndefinedOrNull) : type; + } + + /** + * Return true if type was inferred from an object literal or written as an object type literal + * with no call or construct signatures. + */ + function isObjectLiteralType(type: Type) { + return type.symbol && (type.symbol.flags & (SymbolFlags.ObjectLiteral | SymbolFlags.TypeLiteral)) !== 0 && + getSignaturesOfType(type, SignatureKind.Call).length === 0 && + getSignaturesOfType(type, SignatureKind.Construct).length === 0; + } + function getRegularTypeOfObjectLiteral(type: Type): Type { if (type.flags & TypeFlags.FreshObjectLiteral) { let regularType = (type).regularType; @@ -6012,8 +6841,8 @@ namespace ts { regularType.properties = (type).properties; regularType.callSignatures = (type).callSignatures; regularType.constructSignatures = (type).constructSignatures; - regularType.stringIndexType = (type).stringIndexType; - regularType.numberIndexType = (type).numberIndexType; + regularType.stringIndexInfo = (type).stringIndexInfo; + regularType.numberIndexInfo = (type).numberIndexInfo; (type).regularType = regularType; } return regularType; @@ -6038,26 +6867,27 @@ namespace ts { } members[p.name] = p; }); - let stringIndexType = getIndexTypeOfType(type, IndexKind.String); - let numberIndexType = getIndexTypeOfType(type, IndexKind.Number); - if (stringIndexType) stringIndexType = getWidenedType(stringIndexType); - if (numberIndexType) numberIndexType = getWidenedType(numberIndexType); - return createAnonymousType(type.symbol, members, emptyArray, emptyArray, stringIndexType, numberIndexType); + const stringIndexInfo = getIndexInfoOfType(type, IndexKind.String); + const numberIndexInfo = getIndexInfoOfType(type, IndexKind.Number); + return createAnonymousType(type.symbol, members, emptyArray, emptyArray, + stringIndexInfo && createIndexInfo(getWidenedType(stringIndexInfo.type), stringIndexInfo.isReadonly), + numberIndexInfo && createIndexInfo(getWidenedType(numberIndexInfo.type), numberIndexInfo.isReadonly)); + } + + function getWidenedConstituentType(type: Type): Type { + return type.flags & TypeFlags.Nullable ? type : getWidenedType(type); } function getWidenedType(type: Type): Type { if (type.flags & TypeFlags.RequiresWidening) { - if (type.flags & (TypeFlags.Undefined | TypeFlags.Null)) { + if (type.flags & TypeFlags.Nullable) { return anyType; } - if (type.flags & TypeFlags.PredicateType) { - return booleanType; - } if (type.flags & TypeFlags.ObjectLiteral) { return getWidenedTypeOfObjectLiteral(type); } if (type.flags & TypeFlags.Union) { - return getUnionType(map((type).types, getWidenedType), /*noSubtypeReduction*/ true); + return getUnionType(map((type).types, getWidenedConstituentType), /*noSubtypeReduction*/ true); } if (isArrayType(type)) { return createArrayType(getWidenedType((type).typeArguments[0])); @@ -6126,6 +6956,9 @@ namespace ts { Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : Diagnostics.Parameter_0_implicitly_has_an_1_type; break; + case SyntaxKind.BindingElement: + diagnostic = Diagnostics.Binding_element_0_implicitly_has_an_1_type; + break; case SyntaxKind.FunctionDeclaration: case SyntaxKind.MethodDeclaration: case SyntaxKind.MethodSignature: @@ -6155,29 +6988,23 @@ namespace ts { } function forEachMatchingParameterType(source: Signature, target: Signature, callback: (s: Type, t: Type) => void) { - let sourceMax = source.parameters.length; - let targetMax = target.parameters.length; + const sourceMax = source.parameters.length; + const targetMax = target.parameters.length; let count: number; if (source.hasRestParameter && target.hasRestParameter) { - count = sourceMax > targetMax ? sourceMax : targetMax; - sourceMax--; - targetMax--; + count = Math.max(sourceMax, targetMax); } else if (source.hasRestParameter) { - sourceMax--; count = targetMax; } else if (target.hasRestParameter) { - targetMax--; count = sourceMax; } else { - count = sourceMax < targetMax ? sourceMax : targetMax; + count = Math.min(sourceMax, targetMax); } for (let i = 0; i < count; i++) { - const s = i < sourceMax ? getTypeOfSymbol(source.parameters[i]) : getRestTypeOfSignature(source); - const t = i < targetMax ? getTypeOfSymbol(target.parameters[i]) : getRestTypeOfSignature(target); - callback(s, t); + callback(getTypeAtPosition(source, i), getTypeAtPosition(target, i)); } } @@ -6205,6 +7032,7 @@ namespace ts { let targetStack: Type[]; let depth = 0; let inferiority = 0; + const visited: Map = {}; inferFromTypes(source, target); function isInProcess(source: Type, target: Type) { @@ -6280,11 +7108,6 @@ namespace ts { inferFromTypes(sourceTypes[i], targetTypes[i]); } } - else if (source.flags & TypeFlags.PredicateType && target.flags & TypeFlags.PredicateType) { - if ((source as PredicateType).predicate.kind === (target as PredicateType).predicate.kind) { - inferFromTypes((source as PredicateType).predicate.type, (target as PredicateType).predicate.type); - } - } else if (source.flags & TypeFlags.Tuple && target.flags & TypeFlags.Tuple && (source).elementTypes.length === (target).elementTypes.length) { // If source and target are tuples of the same size, infer from element types const sourceTypes = (source).elementTypes; @@ -6318,7 +7141,7 @@ namespace ts { } } else if (source.flags & TypeFlags.UnionOrIntersection) { - // Source is a union or intersection type, infer from each consituent type + // Source is a union or intersection type, infer from each constituent type const sourceTypes = (source).types; for (const sourceType of sourceTypes) { inferFromTypes(sourceType, target); @@ -6339,6 +7162,12 @@ namespace ts { return; } + const key = source.id + "," + target.id; + if (hasProperty(visited, key)) { + return; + } + visited[key] = true; + if (depth === 0) { sourceStack = []; targetStack = []; @@ -6349,9 +7178,7 @@ namespace ts { inferFromProperties(source, target); inferFromSignatures(source, target, SignatureKind.Call); inferFromSignatures(source, target, SignatureKind.Construct); - inferFromIndexTypes(source, target, IndexKind.String, IndexKind.String); - inferFromIndexTypes(source, target, IndexKind.Number, IndexKind.Number); - inferFromIndexTypes(source, target, IndexKind.String, IndexKind.Number); + inferFromIndexTypes(source, target); depth--; } } @@ -6380,15 +7207,31 @@ namespace ts { function inferFromSignature(source: Signature, target: Signature) { forEachMatchingParameterType(source, target, inferFromTypes); - inferFromTypes(getReturnTypeOfSignature(source), getReturnTypeOfSignature(target)); + + if (source.typePredicate && target.typePredicate && source.typePredicate.kind === target.typePredicate.kind) { + inferFromTypes(source.typePredicate.type, target.typePredicate.type); + } + else { + inferFromTypes(getReturnTypeOfSignature(source), getReturnTypeOfSignature(target)); + } } - function inferFromIndexTypes(source: Type, target: Type, sourceKind: IndexKind, targetKind: IndexKind) { - const targetIndexType = getIndexTypeOfType(target, targetKind); - if (targetIndexType) { - const sourceIndexType = getIndexTypeOfType(source, sourceKind); + function inferFromIndexTypes(source: Type, target: Type) { + const targetStringIndexType = getIndexTypeOfType(target, IndexKind.String); + if (targetStringIndexType) { + const sourceIndexType = getIndexTypeOfType(source, IndexKind.String) || + getImplicitIndexTypeOfType(source, IndexKind.String); if (sourceIndexType) { - inferFromTypes(sourceIndexType, targetIndexType); + inferFromTypes(sourceIndexType, targetStringIndexType); + } + } + const targetNumberIndexType = getIndexTypeOfType(target, IndexKind.Number); + if (targetNumberIndexType) { + const sourceIndexType = getIndexTypeOfType(source, IndexKind.Number) || + getIndexTypeOfType(source, IndexKind.String) || + getImplicitIndexTypeOfType(source, IndexKind.Number); + if (sourceIndexType) { + inferFromTypes(sourceIndexType, targetNumberIndexType); } } } @@ -6475,7 +7318,7 @@ namespace ts { function getResolvedSymbol(node: Identifier): Symbol { const links = getNodeLinks(node); if (!links.resolvedSymbol) { - links.resolvedSymbol = (!nodeIsMissing(node) && resolveName(node, node.text, SymbolFlags.Value | SymbolFlags.ExportValue, Diagnostics.Cannot_find_name_0, node)) || unknownSymbol; + links.resolvedSymbol = !nodeIsMissing(node) && resolveName(node, node.text, SymbolFlags.Value | SymbolFlags.ExportValue, Diagnostics.Cannot_find_name_0, node) || unknownSymbol; } return links.resolvedSymbol; } @@ -6499,248 +7342,554 @@ namespace ts { Debug.fail("should not get here"); } - function hasInitializer(node: VariableLikeDeclaration): boolean { - return !!(node.initializer || isBindingPattern(node.parent) && hasInitializer(node.parent.parent)); + // Return the flow cache key for a "dotted name" (i.e. a sequence of identifiers + // separated by dots). The key consists of the id of the symbol referenced by the + // leftmost identifier followed by zero or more property names separated by dots. + // The result is undefined if the reference isn't a dotted name. + function getFlowCacheKey(node: Node): string { + if (node.kind === SyntaxKind.Identifier) { + const symbol = getResolvedSymbol(node); + return symbol !== unknownSymbol ? "" + getSymbolId(symbol) : undefined; + } + if (node.kind === SyntaxKind.ThisKeyword) { + return "0"; + } + if (node.kind === SyntaxKind.PropertyAccessExpression) { + const key = getFlowCacheKey((node).expression); + return key && key + "." + (node).name.text; + } + return undefined; } - // Check if a given variable is assigned within a given syntax node - function isVariableAssignedWithin(symbol: Symbol, node: Node): boolean { - const links = getNodeLinks(node); - if (links.assignmentChecks) { - const cachedResult = links.assignmentChecks[symbol.id]; - if (cachedResult !== undefined) { - return cachedResult; + function isNullOrUndefinedLiteral(node: Expression) { + return node.kind === SyntaxKind.NullKeyword || + node.kind === SyntaxKind.Identifier && getResolvedSymbol(node) === undefinedSymbol; + } + + function getLeftmostIdentifierOrThis(node: Node): Node { + switch (node.kind) { + case SyntaxKind.Identifier: + case SyntaxKind.ThisKeyword: + return node; + case SyntaxKind.PropertyAccessExpression: + return getLeftmostIdentifierOrThis((node).expression); + } + return undefined; + } + + function isMatchingReference(source: Node, target: Node): boolean { + if (source.kind === target.kind) { + switch (source.kind) { + case SyntaxKind.Identifier: + return getResolvedSymbol(source) === getResolvedSymbol(target); + case SyntaxKind.ThisKeyword: + return true; + case SyntaxKind.PropertyAccessExpression: + return (source).name.text === (target).name.text && + isMatchingReference((source).expression, (target).expression); } } - else { - links.assignmentChecks = {}; - } - return links.assignmentChecks[symbol.id] = isAssignedIn(node); + return false; + } - function isAssignedInBinaryExpression(node: BinaryExpression) { - if (node.operatorToken.kind >= SyntaxKind.FirstAssignment && node.operatorToken.kind <= SyntaxKind.LastAssignment) { - const n = skipParenthesizedNodes(node.left); - if (n.kind === SyntaxKind.Identifier && getResolvedSymbol(n) === symbol) { + function containsMatchingReference(source: Node, target: Node) { + while (source.kind === SyntaxKind.PropertyAccessExpression) { + source = (source).expression; + if (isMatchingReference(source, target)) { + return true; + } + } + return false; + } + + function isOrContainsMatchingReference(source: Node, target: Node) { + return isMatchingReference(source, target) || containsMatchingReference(source, target); + } + + function hasMatchingArgument(callExpression: CallExpression, reference: Node) { + if (callExpression.arguments) { + for (const argument of callExpression.arguments) { + if (isOrContainsMatchingReference(reference, argument)) { return true; } } - return forEachChild(node, isAssignedIn); } - - function isAssignedInVariableDeclaration(node: VariableLikeDeclaration) { - if (!isBindingPattern(node.name) && getSymbolOfNode(node) === symbol && hasInitializer(node)) { - return true; - } - return forEachChild(node, isAssignedIn); - } - - function isAssignedIn(node: Node): boolean { - switch (node.kind) { - case SyntaxKind.BinaryExpression: - return isAssignedInBinaryExpression(node); - case SyntaxKind.VariableDeclaration: - case SyntaxKind.BindingElement: - return isAssignedInVariableDeclaration(node); - case SyntaxKind.ObjectBindingPattern: - case SyntaxKind.ArrayBindingPattern: - case SyntaxKind.ArrayLiteralExpression: - case SyntaxKind.ObjectLiteralExpression: - case SyntaxKind.PropertyAccessExpression: - case SyntaxKind.ElementAccessExpression: - case SyntaxKind.CallExpression: - case SyntaxKind.NewExpression: - case SyntaxKind.TypeAssertionExpression: - case SyntaxKind.AsExpression: - case SyntaxKind.ParenthesizedExpression: - case SyntaxKind.PrefixUnaryExpression: - case SyntaxKind.DeleteExpression: - case SyntaxKind.AwaitExpression: - case SyntaxKind.TypeOfExpression: - case SyntaxKind.VoidExpression: - case SyntaxKind.PostfixUnaryExpression: - case SyntaxKind.YieldExpression: - case SyntaxKind.ConditionalExpression: - case SyntaxKind.SpreadElementExpression: - case SyntaxKind.Block: - case SyntaxKind.VariableStatement: - case SyntaxKind.ExpressionStatement: - case SyntaxKind.IfStatement: - case SyntaxKind.DoStatement: - case SyntaxKind.WhileStatement: - case SyntaxKind.ForStatement: - case SyntaxKind.ForInStatement: - case SyntaxKind.ForOfStatement: - case SyntaxKind.ReturnStatement: - case SyntaxKind.WithStatement: - case SyntaxKind.SwitchStatement: - case SyntaxKind.CaseClause: - case SyntaxKind.DefaultClause: - case SyntaxKind.LabeledStatement: - case SyntaxKind.ThrowStatement: - case SyntaxKind.TryStatement: - case SyntaxKind.CatchClause: - case SyntaxKind.JsxElement: - case SyntaxKind.JsxSelfClosingElement: - case SyntaxKind.JsxAttribute: - case SyntaxKind.JsxSpreadAttribute: - case SyntaxKind.JsxOpeningElement: - case SyntaxKind.JsxExpression: - return forEachChild(node, isAssignedIn); - } - return false; + if (callExpression.expression.kind === SyntaxKind.PropertyAccessExpression && + isOrContainsMatchingReference(reference, (callExpression.expression).expression)) { + return true; } + return false; } - // Get the narrowed type of a given symbol at a given location - function getNarrowedTypeOfSymbol(symbol: Symbol, node: Node) { - let type = getTypeOfSymbol(symbol); - // Only narrow when symbol is variable of type any or an object, union, or type parameter type - if (node && symbol.flags & SymbolFlags.Variable) { - if (isTypeAny(type) || type.flags & (TypeFlags.ObjectType | TypeFlags.Union | TypeFlags.TypeParameter)) { - const declaration = getDeclarationOfKind(symbol, SyntaxKind.VariableDeclaration); - const top = declaration && getDeclarationContainer(declaration); - const originalType = type; - const nodeStack: {node: Node, child: Node}[] = []; - loop: while (node.parent) { - const child = node; - node = node.parent; - switch (node.kind) { - case SyntaxKind.IfStatement: - case SyntaxKind.ConditionalExpression: - case SyntaxKind.BinaryExpression: - nodeStack.push({node, child}); - break; - case SyntaxKind.SourceFile: - case SyntaxKind.ModuleDeclaration: - // Stop at the first containing file or module declaration - break loop; - } - if (node === top) { - break; - } + function getFlowNodeId(flow: FlowNode): number { + if (!flow.id) { + flow.id = nextFlowId; + nextFlowId++; + } + return flow.id; + } + + function typeMaybeAssignableTo(source: Type, target: Type) { + if (!(source.flags & TypeFlags.Union)) { + return isTypeAssignableTo(source, target); + } + for (const t of (source).types) { + if (isTypeAssignableTo(t, target)) { + return true; + } + } + return false; + } + + // Remove those constituent types of declaredType to which no constituent type of assignedType is assignable. + // For example, when a variable of type number | string | boolean is assigned a value of type number | boolean, + // we remove type string. + function getAssignmentReducedType(declaredType: UnionType, assignedType: Type) { + if (declaredType !== assignedType && declaredType.flags & TypeFlags.Union) { + const reducedTypes = filter(declaredType.types, t => typeMaybeAssignableTo(assignedType, t)); + if (reducedTypes.length) { + return reducedTypes.length === 1 ? reducedTypes[0] : getUnionType(reducedTypes); + } + } + return declaredType; + } + + function getTypeFacts(type: Type): TypeFacts { + const flags = type.flags; + if (flags & TypeFlags.StringLike) { + return strictNullChecks ? TypeFacts.StringStrictFacts : TypeFacts.StringFacts; + } + if (flags & TypeFlags.NumberLike) { + return strictNullChecks ? TypeFacts.NumberStrictFacts : TypeFacts.NumberFacts; + } + if (flags & TypeFlags.Boolean) { + return strictNullChecks ? TypeFacts.BooleanStrictFacts : TypeFacts.BooleanFacts; + } + if (flags & TypeFlags.ObjectType) { + const resolved = resolveStructuredTypeMembers(type); + return resolved.callSignatures.length || resolved.constructSignatures.length || isTypeSubtypeOf(type, globalFunctionType) ? + strictNullChecks ? TypeFacts.FunctionStrictFacts : TypeFacts.FunctionFacts : + strictNullChecks ? TypeFacts.ObjectStrictFacts : TypeFacts.ObjectFacts; + } + if (flags & (TypeFlags.Void | TypeFlags.Undefined)) { + return TypeFacts.UndefinedFacts; + } + if (flags & TypeFlags.Null) { + return TypeFacts.NullFacts; + } + if (flags & TypeFlags.ESSymbol) { + return strictNullChecks ? TypeFacts.SymbolStrictFacts : TypeFacts.SymbolFacts; + } + if (flags & TypeFlags.TypeParameter) { + const constraint = getConstraintOfTypeParameter(type); + return constraint ? getTypeFacts(constraint) : TypeFacts.All; + } + if (flags & TypeFlags.Intersection) { + return reduceLeft((type).types, (flags, type) => flags |= getTypeFacts(type), TypeFacts.None); + } + return TypeFacts.All; + } + + function getTypeWithFacts(type: Type, include: TypeFacts) { + if (!(type.flags & TypeFlags.Union)) { + return getTypeFacts(type) & include ? type : neverType; + } + let firstType: Type; + let types: Type[]; + for (const t of (type as UnionType).types) { + if (getTypeFacts(t) & include) { + if (!firstType) { + firstType = t; } - - let nodes: {node: Node, child: Node}; - while (nodes = nodeStack.pop()) { - const {node, child} = nodes; - switch (node.kind) { - case SyntaxKind.IfStatement: - // In a branch of an if statement, narrow based on controlling expression - if (child !== (node).expression) { - type = narrowType(type, (node).expression, /*assumeTrue*/ child === (node).thenStatement); - } - break; - case SyntaxKind.ConditionalExpression: - // In a branch of a conditional expression, narrow based on controlling condition - if (child !== (node).condition) { - type = narrowType(type, (node).condition, /*assumeTrue*/ child === (node).whenTrue); - } - break; - case SyntaxKind.BinaryExpression: - // In the right operand of an && or ||, narrow based on left operand - if (child === (node).right) { - if ((node).operatorToken.kind === SyntaxKind.AmpersandAmpersandToken) { - type = narrowType(type, (node).left, /*assumeTrue*/ true); - } - else if ((node).operatorToken.kind === SyntaxKind.BarBarToken) { - type = narrowType(type, (node).left, /*assumeTrue*/ false); - } - } - break; - default: - Debug.fail("Unreachable!"); + else { + if (!types) { + types = [firstType]; } - - // Use original type if construct contains assignments to variable - if (type !== originalType && isVariableAssignedWithin(symbol, node)) { - type = originalType; - } - } - - // Preserve old top-level behavior - if the branch is really an empty set, revert to prior type - if (type === emptyUnionType) { - type = originalType; + types.push(t); } } } + return firstType ? types ? getUnionType(types, /*noSubtypeReduction*/ true) : firstType : neverType; + } + function getTypeWithDefault(type: Type, defaultExpression: Expression) { + if (defaultExpression) { + const defaultType = checkExpression(defaultExpression); + return getUnionType([getTypeWithFacts(type, TypeFacts.NEUndefined), defaultType]); + } return type; + } - function narrowTypeByEquality(type: Type, expr: BinaryExpression, assumeTrue: boolean): Type { - // Check that we have 'typeof ' on the left and string literal on the right - if (expr.left.kind !== SyntaxKind.TypeOfExpression || expr.right.kind !== SyntaxKind.StringLiteral) { + function getTypeOfDestructuredProperty(type: Type, name: Identifier | LiteralExpression | ComputedPropertyName) { + const text = getTextOfPropertyName(name); + return getTypeOfPropertyOfType(type, text) || + isNumericLiteralName(text) && getIndexTypeOfType(type, IndexKind.Number) || + getIndexTypeOfType(type, IndexKind.String) || + unknownType; + } + + function getTypeOfDestructuredArrayElement(type: Type, index: number) { + return isTupleLikeType(type) && getTypeOfPropertyOfType(type, "" + index) || + checkIteratedTypeOrElementType(type, /*errorNode*/ undefined, /*allowStringInput*/ false) || + unknownType; + } + + function getTypeOfDestructuredSpreadElement(type: Type) { + return createArrayType(checkIteratedTypeOrElementType(type, /*errorNode*/ undefined, /*allowStringInput*/ false) || unknownType); + } + + function getAssignedTypeOfBinaryExpression(node: BinaryExpression): Type { + return node.parent.kind === SyntaxKind.ArrayLiteralExpression || node.parent.kind === SyntaxKind.PropertyAssignment ? + getTypeWithDefault(getAssignedType(node), node.right) : + checkExpression(node.right); + } + + function getAssignedTypeOfArrayLiteralElement(node: ArrayLiteralExpression, element: Expression): Type { + return getTypeOfDestructuredArrayElement(getAssignedType(node), indexOf(node.elements, element)); + } + + function getAssignedTypeOfSpreadElement(node: SpreadElementExpression): Type { + return getTypeOfDestructuredSpreadElement(getAssignedType(node.parent)); + } + + function getAssignedTypeOfPropertyAssignment(node: PropertyAssignment | ShorthandPropertyAssignment): Type { + return getTypeOfDestructuredProperty(getAssignedType(node.parent), node.name); + } + + function getAssignedTypeOfShorthandPropertyAssignment(node: ShorthandPropertyAssignment): Type { + return getTypeWithDefault(getAssignedTypeOfPropertyAssignment(node), node.objectAssignmentInitializer); + } + + function getAssignedType(node: Expression): Type { + const parent = node.parent; + switch (parent.kind) { + case SyntaxKind.ForInStatement: + return stringType; + case SyntaxKind.ForOfStatement: + return checkRightHandSideOfForOf((parent).expression) || unknownType; + case SyntaxKind.BinaryExpression: + return getAssignedTypeOfBinaryExpression(parent); + case SyntaxKind.DeleteExpression: + return undefinedType; + case SyntaxKind.ArrayLiteralExpression: + return getAssignedTypeOfArrayLiteralElement(parent, node); + case SyntaxKind.SpreadElementExpression: + return getAssignedTypeOfSpreadElement(parent); + case SyntaxKind.PropertyAssignment: + return getAssignedTypeOfPropertyAssignment(parent); + case SyntaxKind.ShorthandPropertyAssignment: + return getAssignedTypeOfShorthandPropertyAssignment(parent); + } + return unknownType; + } + + function getInitialTypeOfBindingElement(node: BindingElement): Type { + const pattern = node.parent; + const parentType = getInitialType(pattern.parent); + const type = pattern.kind === SyntaxKind.ObjectBindingPattern ? + getTypeOfDestructuredProperty(parentType, node.propertyName || node.name) : + !node.dotDotDotToken ? + getTypeOfDestructuredArrayElement(parentType, indexOf(pattern.elements, node)) : + getTypeOfDestructuredSpreadElement(parentType); + return getTypeWithDefault(type, node.initializer); + } + + function getTypeOfInitializer(node: Expression) { + // Return the cached type if one is available. If the type of the variable was inferred + // from its initializer, we'll already have cached the type. Otherwise we compute it now + // without caching such that transient types are reflected. + const links = getNodeLinks(node); + return links.resolvedType || checkExpression(node); + } + + function getInitialTypeOfVariableDeclaration(node: VariableDeclaration) { + if (node.initializer) { + return getTypeOfInitializer(node.initializer); + } + if (node.parent.parent.kind === SyntaxKind.ForInStatement) { + return stringType; + } + if (node.parent.parent.kind === SyntaxKind.ForOfStatement) { + return checkRightHandSideOfForOf((node.parent.parent).expression) || unknownType; + } + return unknownType; + } + + function getInitialType(node: VariableDeclaration | BindingElement) { + return node.kind === SyntaxKind.VariableDeclaration ? + getInitialTypeOfVariableDeclaration(node) : + getInitialTypeOfBindingElement(node); + } + + function getFlowTypeOfReference(reference: Node, declaredType: Type, assumeInitialized: boolean) { + let key: string; + if (!reference.flowNode || assumeInitialized && !(declaredType.flags & TypeFlags.Narrowable)) { + return declaredType; + } + const initialType = assumeInitialized ? declaredType : addNullableKind(declaredType, TypeFlags.Undefined); + const visitedFlowStart = visitedFlowCount; + const result = getTypeAtFlowNode(reference.flowNode); + visitedFlowCount = visitedFlowStart; + if (reference.parent.kind === SyntaxKind.NonNullExpression && getTypeWithFacts(result, TypeFacts.NEUndefinedOrNull) === neverType) { + return declaredType; + } + return result; + + function getTypeAtFlowNode(flow: FlowNode): Type { + while (true) { + if (flow.flags & FlowFlags.Shared) { + // We cache results of flow type resolution for shared nodes that were previously visited in + // the same getFlowTypeOfReference invocation. A node is considered shared when it is the + // antecedent of more than one node. + for (let i = visitedFlowStart; i < visitedFlowCount; i++) { + if (visitedFlowNodes[i] === flow) { + return visitedFlowTypes[i]; + } + } + } + let type: Type; + if (flow.flags & FlowFlags.Assignment) { + type = getTypeAtFlowAssignment(flow); + if (!type) { + flow = (flow).antecedent; + continue; + } + } + else if (flow.flags & FlowFlags.Condition) { + type = getTypeAtFlowCondition(flow); + } + else if (flow.flags & FlowFlags.Label) { + if ((flow).antecedents.length === 1) { + flow = (flow).antecedents[0]; + continue; + } + type = flow.flags & FlowFlags.BranchLabel ? + getTypeAtFlowBranchLabel(flow) : + getTypeAtFlowLoopLabel(flow); + } + else if (flow.flags & FlowFlags.Unreachable) { + // Unreachable code errors are reported in the binding phase. Here we + // simply return the declared type to reduce follow-on errors. + type = declaredType; + } + else { + // At the top of the flow we have the initial type. + type = initialType; + } + if (flow.flags & FlowFlags.Shared) { + // Record visited node and the associated type in the cache. + visitedFlowNodes[visitedFlowCount] = flow; + visitedFlowTypes[visitedFlowCount] = type; + visitedFlowCount++; + } return type; } + } + + function getTypeAtFlowAssignment(flow: FlowAssignment) { + const node = flow.node; + // Assignments only narrow the computed type if the declared type is a union type. Thus, we + // only need to evaluate the assigned type if the declared type is a union type. + if ((node.kind === SyntaxKind.VariableDeclaration || node.kind === SyntaxKind.BindingElement) && + reference.kind === SyntaxKind.Identifier && + getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(reference)) === getSymbolOfNode(node)) { + return declaredType.flags & TypeFlags.Union ? + getAssignmentReducedType(declaredType, getInitialType(node)) : + declaredType; + } + // If the node is not a variable declaration or binding element, it is an identifier + // or a dotted name that is the target of an assignment. If we have a match, reduce + // the declared type by the assigned type. + if (isMatchingReference(reference, node)) { + return declaredType.flags & TypeFlags.Union ? + getAssignmentReducedType(declaredType, getAssignedType(node)) : + declaredType; + } + // We didn't have a direct match. However, if the reference is a dotted name, this + // may be an assignment to a left hand part of the reference. For example, for a + // reference 'x.y.z', we may be at an assignment to 'x.y' or 'x'. In that case, + // return the declared type. + if (containsMatchingReference(reference, node)) { + return declaredType; + } + // Assignment doesn't affect reference + return undefined; + } + + function getTypeAtFlowCondition(flow: FlowCondition) { + let type = getTypeAtFlowNode(flow.antecedent); + if (type !== neverType) { + // If we have an antecedent type (meaning we're reachable in some way), we first + // attempt to narrow the antecedent type. If that produces the nothing type, then + // we take the type guard as an indication that control could reach here in a + // manner not understood by the control flow analyzer (e.g. a function argument + // has an invalid type, or a nested function has possibly made an assignment to a + // captured variable). We proceed by reverting to the declared type and then + // narrow that. + const assumeTrue = (flow.flags & FlowFlags.TrueCondition) !== 0; + type = narrowType(type, flow.expression, assumeTrue); + if (type === neverType) { + type = narrowType(declaredType, flow.expression, assumeTrue); + } + } + return type; + } + + function getTypeAtFlowBranchLabel(flow: FlowLabel) { + const antecedentTypes: Type[] = []; + for (const antecedent of flow.antecedents) { + const type = getTypeAtFlowNode(antecedent); + // If the type at a particular antecedent path is the declared type and the + // reference is known to always be assigned (i.e. when declared and initial types + // are the same), there is no reason to process more antecedents since the only + // possible outcome is subtypes that will be removed in the final union type anyway. + if (type === declaredType && declaredType === initialType) { + return type; + } + if (!contains(antecedentTypes, type)) { + antecedentTypes.push(type); + } + } + return getUnionType(antecedentTypes); + } + + function getTypeAtFlowLoopLabel(flow: FlowLabel) { + // If we have previously computed the control flow type for the reference at + // this flow loop junction, return the cached type. + const id = getFlowNodeId(flow); + const cache = flowLoopCaches[id] || (flowLoopCaches[id] = {}); + if (!key) { + key = getFlowCacheKey(reference); + } + if (cache[key]) { + return cache[key]; + } + // If this flow loop junction and reference are already being processed, return + // the union of the types computed for each branch so far. We should never see + // an empty array here because the first antecedent of a loop junction is always + // the non-looping control flow path that leads to the top. + for (let i = flowLoopStart; i < flowLoopCount; i++) { + if (flowLoopNodes[i] === flow && flowLoopKeys[i] === key) { + return getUnionType(flowLoopTypes[i]); + } + } + // Add the flow loop junction and reference to the in-process stack and analyze + // each antecedent code path. + const antecedentTypes: Type[] = []; + flowLoopNodes[flowLoopCount] = flow; + flowLoopKeys[flowLoopCount] = key; + flowLoopTypes[flowLoopCount] = antecedentTypes; + for (const antecedent of flow.antecedents) { + flowLoopCount++; + const type = getTypeAtFlowNode(antecedent); + flowLoopCount--; + // If we see a value appear in the cache it is a sign that control flow analysis + // was restarted and completed by checkExpressionCached. We can simply pick up + // the resulting type and bail out. + if (cache[key]) { + return cache[key]; + } + if (!contains(antecedentTypes, type)) { + antecedentTypes.push(type); + } + // If the type at a particular antecedent path is the declared type there is no + // reason to process more antecedents since the only possible outcome is subtypes + // that will be removed in the final union type anyway. + if (type === declaredType) { + break; + } + } + return cache[key] = getUnionType(antecedentTypes); + } + + function narrowTypeByTruthiness(type: Type, expr: Expression, assumeTrue: boolean): Type { + return isMatchingReference(reference, expr) ? getTypeWithFacts(type, assumeTrue ? TypeFacts.Truthy : TypeFacts.Falsy) : type; + } + + function narrowTypeByBinaryExpression(type: Type, expr: BinaryExpression, assumeTrue: boolean): Type { + switch (expr.operatorToken.kind) { + case SyntaxKind.EqualsToken: + return narrowTypeByTruthiness(type, expr.left, assumeTrue); + case SyntaxKind.EqualsEqualsToken: + case SyntaxKind.ExclamationEqualsToken: + case SyntaxKind.EqualsEqualsEqualsToken: + case SyntaxKind.ExclamationEqualsEqualsToken: + if (isNullOrUndefinedLiteral(expr.right)) { + return narrowTypeByNullCheck(type, expr, assumeTrue); + } + if (expr.left.kind === SyntaxKind.TypeOfExpression && expr.right.kind === SyntaxKind.StringLiteral) { + return narrowTypeByTypeof(type, expr, assumeTrue); + } + break; + case SyntaxKind.InstanceOfKeyword: + return narrowTypeByInstanceof(type, expr, assumeTrue); + case SyntaxKind.CommaToken: + return narrowType(type, expr.right, assumeTrue); + } + return type; + } + + function narrowTypeByNullCheck(type: Type, expr: BinaryExpression, assumeTrue: boolean): Type { + // We have '==', '!=', '===', or '!==' operator with 'null' or 'undefined' on the right + const operator = expr.operatorToken.kind; + if (operator === SyntaxKind.ExclamationEqualsToken || operator === SyntaxKind.ExclamationEqualsEqualsToken) { + assumeTrue = !assumeTrue; + } + if (!strictNullChecks || !isMatchingReference(reference, expr.left)) { + return type; + } + const doubleEquals = operator === SyntaxKind.EqualsEqualsToken || operator === SyntaxKind.ExclamationEqualsToken; + const facts = doubleEquals ? + assumeTrue ? TypeFacts.EQUndefinedOrNull : TypeFacts.NEUndefinedOrNull : + expr.right.kind === SyntaxKind.NullKeyword ? + assumeTrue ? TypeFacts.EQNull : TypeFacts.NENull : + assumeTrue ? TypeFacts.EQUndefined : TypeFacts.NEUndefined; + return getTypeWithFacts(type, facts); + } + + function narrowTypeByTypeof(type: Type, expr: BinaryExpression, assumeTrue: boolean): Type { + // We have '==', '!=', '====', or !==' operator with 'typeof xxx' on the left + // and string literal on the right const left = expr.left; const right = expr.right; - if (left.expression.kind !== SyntaxKind.Identifier || getResolvedSymbol(left.expression) !== symbol) { + if (!isMatchingReference(reference, left.expression)) { + // For a reference of the form 'x.y', a 'typeof x === ...' type guard resets the + // narrowed type of 'y' to its declared type. + if (containsMatchingReference(reference, left.expression)) { + return declaredType; + } return type; } - if (expr.operatorToken.kind === SyntaxKind.ExclamationEqualsEqualsToken) { + if (expr.operatorToken.kind === SyntaxKind.ExclamationEqualsToken || + expr.operatorToken.kind === SyntaxKind.ExclamationEqualsEqualsToken) { assumeTrue = !assumeTrue; } - const typeInfo = primitiveTypeInfo[right.text]; - // Don't narrow `undefined` - if (typeInfo && typeInfo.type === undefinedType) { - return type; - } - // If the type to be narrowed is any and we're checking a primitive with assumeTrue=true, return the primitive - if (!!(type.flags & TypeFlags.Any) && typeInfo && assumeTrue) { - return typeInfo.type; - } - let flags: TypeFlags; - if (typeInfo) { - flags = typeInfo.flags; - } - else { - assumeTrue = !assumeTrue; - flags = TypeFlags.NumberLike | TypeFlags.StringLike | TypeFlags.ESSymbol | TypeFlags.Boolean; - } - // At this point we can bail if it's not a union - if (!(type.flags & TypeFlags.Union)) { - // If the active non-union type would be removed from a union by this type guard, return an empty union - return filterUnion(type) ? type : emptyUnionType; - } - return getUnionType(filter((type as UnionType).types, filterUnion), /*noSubtypeReduction*/ true); - - function filterUnion(type: Type) { - return assumeTrue === !!(type.flags & flags); - } - } - - function narrowTypeByAnd(type: Type, expr: BinaryExpression, assumeTrue: boolean): Type { - if (assumeTrue) { - // The assumed result is true, therefore we narrow assuming each operand to be true. - return narrowType(narrowType(type, expr.left, /*assumeTrue*/ true), expr.right, /*assumeTrue*/ true); - } - else { - // The assumed result is false. This means either the first operand was false, or the first operand was true - // and the second operand was false. We narrow with those assumptions and union the two resulting types. - return getUnionType([ - narrowType(type, expr.left, /*assumeTrue*/ false), - narrowType(type, expr.right, /*assumeTrue*/ false) - ]); - } - } - - function narrowTypeByOr(type: Type, expr: BinaryExpression, assumeTrue: boolean): Type { - if (assumeTrue) { - // The assumed result is true. This means either the first operand was true, or the first operand was false - // and the second operand was true. We narrow with those assumptions and union the two resulting types. - return getUnionType([ - narrowType(type, expr.left, /*assumeTrue*/ true), - narrowType(type, expr.right, /*assumeTrue*/ true) - ]); - } - else { - // The assumed result is false, therefore we narrow assuming each operand to be false. - return narrowType(narrowType(type, expr.left, /*assumeTrue*/ false), expr.right, /*assumeTrue*/ false); + if (assumeTrue && !(type.flags & TypeFlags.Union)) { + // We narrow a non-union type to an exact primitive type if the non-union type + // is a supertype of that primtive type. For example, type 'any' can be narrowed + // to one of the primitive types. + const targetType = getProperty(typeofTypesByName, right.text); + if (targetType && isTypeSubtypeOf(targetType, type)) { + return targetType; + } } + const facts = assumeTrue ? + getProperty(typeofEQFacts, right.text) || TypeFacts.TypeofEQHostObject : + getProperty(typeofNEFacts, right.text) || TypeFacts.TypeofNEHostObject; + return getTypeWithFacts(type, facts); } function narrowTypeByInstanceof(type: Type, expr: BinaryExpression, assumeTrue: boolean): Type { - // Check that type is not any, assumed result is true, and we have variable symbol on the left - if (isTypeAny(type) || expr.left.kind !== SyntaxKind.Identifier || getResolvedSymbol(expr.left) !== symbol) { + if (!isMatchingReference(reference, expr.left)) { + // For a reference of the form 'x.y', an 'x instanceof T' type guard resets the + // narrowed type of 'y' to its declared type. + if (containsMatchingReference(reference, expr.left)) { + return declaredType; + } + return type; + } + // We never narrow type any in an instanceof guard + if (isTypeAny(type)) { return type; } @@ -6781,125 +7930,113 @@ namespace ts { return type; } - function getNarrowedType(originalType: Type, narrowedTypeCandidate: Type, assumeTrue: boolean) { + function getNarrowedType(type: Type, candidate: Type, assumeTrue: boolean) { if (!assumeTrue) { - if (originalType.flags & TypeFlags.Union) { - return getUnionType(filter((originalType).types, t => !isTypeSubtypeOf(t, narrowedTypeCandidate))); - } - return originalType; + return type.flags & TypeFlags.Union ? + getUnionType(filter((type).types, t => !isTypeSubtypeOf(t, candidate))) : + type; } - - // If the current type is a union type, remove all constituents that aren't assignable to target. If that produces - // 0 candidates, fall back to the assignability check - if (originalType.flags & TypeFlags.Union) { - const assignableConstituents = filter((originalType).types, t => isTypeAssignableTo(t, narrowedTypeCandidate)); + // If the current type is a union type, remove all constituents that aren't assignable to + // the candidate type. If one or more constituents remain, return a union of those. + if (type.flags & TypeFlags.Union) { + const assignableConstituents = filter((type).types, t => isTypeAssignableTo(t, candidate)); if (assignableConstituents.length) { return getUnionType(assignableConstituents); } } - - if (isTypeAssignableTo(narrowedTypeCandidate, originalType)) { - // Narrow to the target type if it's assignable to the current type - return narrowedTypeCandidate; - } - - return originalType; + // If the candidate type is assignable to the target type, narrow to the candidate type. + // Otherwise, if the current type is assignable to the candidate, keep the current type. + // Otherwise, the types are completely unrelated, so narrow to the empty type. + const targetType = type.flags & TypeFlags.TypeParameter ? getApparentType(type) : type; + return isTypeAssignableTo(candidate, targetType) ? candidate : + isTypeAssignableTo(type, candidate) ? type : + neverType; } - function narrowTypeByTypePredicate(type: Type, expr: CallExpression, assumeTrue: boolean): Type { - if (type.flags & TypeFlags.Any) { + function narrowTypeByTypePredicate(type: Type, callExpression: CallExpression, assumeTrue: boolean): Type { + if (type.flags & TypeFlags.Any || !hasMatchingArgument(callExpression, reference)) { return type; } - const signature = getResolvedSignature(expr); - const predicateType = getReturnTypeOfSignature(signature); - - if (!predicateType || !(predicateType.flags & TypeFlags.PredicateType)) { + const signature = getResolvedSignature(callExpression); + const predicate = signature.typePredicate; + if (!predicate) { return type; } - const predicate = (predicateType as PredicateType).predicate; if (isIdentifierTypePredicate(predicate)) { - const callExpression = expr as CallExpression; - if (callExpression.arguments[predicate.parameterIndex] && - getSymbolAtTypePredicatePosition(callExpression.arguments[predicate.parameterIndex]) === symbol) { - return getNarrowedType(type, predicate.type, assumeTrue); + const predicateArgument = callExpression.arguments[predicate.parameterIndex]; + if (predicateArgument) { + if (isMatchingReference(reference, predicateArgument)) { + return getNarrowedType(type, predicate.type, assumeTrue); + } + if (containsMatchingReference(reference, predicateArgument)) { + return declaredType; + } } } else { - const expression = skipParenthesizedNodes(expr.expression); - return narrowTypeByThisTypePredicate(type, predicate, expression, assumeTrue); - } - return type; - } - - function narrowTypeByTypePredicateMember(type: Type, expr: ElementAccessExpression | PropertyAccessExpression, assumeTrue: boolean): Type { - if (type.flags & TypeFlags.Any) { - return type; - } - const memberType = getTypeOfExpression(expr); - if (!(memberType.flags & TypeFlags.PredicateType)) { - return type; - } - - return narrowTypeByThisTypePredicate(type, (memberType as PredicateType).predicate as ThisTypePredicate, expr, assumeTrue); - } - - function narrowTypeByThisTypePredicate(type: Type, predicate: ThisTypePredicate, expression: Expression, assumeTrue: boolean): Type { - if (expression.kind === SyntaxKind.ElementAccessExpression || expression.kind === SyntaxKind.PropertyAccessExpression) { - const accessExpression = expression as ElementAccessExpression | PropertyAccessExpression; - const possibleIdentifier = skipParenthesizedNodes(accessExpression.expression); - if (possibleIdentifier.kind === SyntaxKind.Identifier && getSymbolAtTypePredicatePosition(possibleIdentifier) === symbol) { - return getNarrowedType(type, predicate.type, assumeTrue); + const invokedExpression = skipParenthesizedNodes(callExpression.expression); + if (invokedExpression.kind === SyntaxKind.ElementAccessExpression || invokedExpression.kind === SyntaxKind.PropertyAccessExpression) { + const accessExpression = invokedExpression as ElementAccessExpression | PropertyAccessExpression; + const possibleReference = skipParenthesizedNodes(accessExpression.expression); + if (isMatchingReference(reference, possibleReference)) { + return getNarrowedType(type, predicate.type, assumeTrue); + } + if (containsMatchingReference(reference, possibleReference)) { + return declaredType; + } } } return type; } - function getSymbolAtTypePredicatePosition(expr: Expression): Symbol { - expr = skipParenthesizedNodes(expr); - switch (expr.kind) { - case SyntaxKind.Identifier: - case SyntaxKind.PropertyAccessExpression: - case SyntaxKind.QualifiedName: - return getSymbolOfEntityNameOrPropertyAccessExpression(expr as Node as (EntityName | PropertyAccessExpression)); - } - } - // Narrow the given type based on the given expression having the assumed boolean value. The returned type // will be a subtype or the same type as the argument. function narrowType(type: Type, expr: Expression, assumeTrue: boolean): Type { switch (expr.kind) { + case SyntaxKind.Identifier: + case SyntaxKind.ThisKeyword: + case SyntaxKind.PropertyAccessExpression: + return narrowTypeByTruthiness(type, expr, assumeTrue); case SyntaxKind.CallExpression: return narrowTypeByTypePredicate(type, expr, assumeTrue); case SyntaxKind.ParenthesizedExpression: return narrowType(type, (expr).expression, assumeTrue); case SyntaxKind.BinaryExpression: - const operator = (expr).operatorToken.kind; - if (operator === SyntaxKind.EqualsEqualsEqualsToken || operator === SyntaxKind.ExclamationEqualsEqualsToken) { - return narrowTypeByEquality(type, expr, assumeTrue); - } - else if (operator === SyntaxKind.AmpersandAmpersandToken) { - return narrowTypeByAnd(type, expr, assumeTrue); - } - else if (operator === SyntaxKind.BarBarToken) { - return narrowTypeByOr(type, expr, assumeTrue); - } - else if (operator === SyntaxKind.InstanceOfKeyword) { - return narrowTypeByInstanceof(type, expr, assumeTrue); - } - break; + return narrowTypeByBinaryExpression(type, expr, assumeTrue); case SyntaxKind.PrefixUnaryExpression: if ((expr).operator === SyntaxKind.ExclamationToken) { return narrowType(type, (expr).operand, !assumeTrue); } break; - case SyntaxKind.ElementAccessExpression: - case SyntaxKind.PropertyAccessExpression: - return narrowTypeByTypePredicateMember(type, expr as (ElementAccessExpression | PropertyAccessExpression), assumeTrue); } return type; } } + function getTypeOfSymbolAtLocation(symbol: Symbol, location: Node) { + // If we have an identifier or a property access at the given location, if the location is + // an dotted name expression, and if the location is not an assignment target, obtain the type + // of the expression (which will reflect control flow analysis). If the expression indeed + // resolved to the given symbol, return the narrowed type. + if (location.kind === SyntaxKind.Identifier) { + if (isRightSideOfQualifiedNameOrPropertyAccess(location)) { + location = location.parent; + } + if (isExpression(location) && !isAssignmentTarget(location)) { + const type = checkExpression(location); + if (getExportSymbolOfValueSymbolIfExported(getNodeLinks(location).resolvedSymbol) === symbol) { + return type; + } + } + } + // The location isn't a reference to the given symbol, meaning we're being asked + // a hypothetical question of what type the symbol would have if there was a reference + // to it at the given location. Since we have no control flow information for the + // hypotherical reference (control flow information is created and attached by the + // binder), we simply return the declared type of the symbol. + return getTypeOfSymbol(symbol); + } + function skipParenthesizedNodes(expression: Expression): Expression { while (expression.kind === SyntaxKind.ParenthesizedExpression) { expression = (expression as ParenthesizedExpression).expression; @@ -6924,9 +8061,8 @@ namespace ts { } } - if (node.parserContextFlags & ParserContextFlags.Await) { + if (node.flags & NodeFlags.AwaitContext) { getNodeLinks(container).flags |= NodeCheckFlags.CaptureArguments; - getNodeLinks(node).flags |= NodeCheckFlags.LexicalArguments; } } @@ -6934,11 +8070,46 @@ namespace ts { markAliasSymbolAsReferenced(symbol); } + const localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol); + + // Due to the emit for class decorators, any reference to the class from inside of the class body + // must instead be rewritten to point to a temporary variable to avoid issues with the double-bind + // behavior of class names in ES6. + if (languageVersion === ScriptTarget.ES6 + && localOrExportSymbol.flags & SymbolFlags.Class + && localOrExportSymbol.valueDeclaration.kind === SyntaxKind.ClassDeclaration + && nodeIsDecorated(localOrExportSymbol.valueDeclaration)) { + let container = getContainingClass(node); + while (container !== undefined) { + if (container === localOrExportSymbol.valueDeclaration && container.name !== node) { + getNodeLinks(container).flags |= NodeCheckFlags.ClassWithBodyScopedClassBinding; + getNodeLinks(node).flags |= NodeCheckFlags.BodyScopedClassBinding; + break; + } + + container = getContainingClass(container); + } + } + checkCollisionWithCapturedSuperVariable(node, node); checkCollisionWithCapturedThisVariable(node, node); - checkBlockScopedBindingCapturedInLoop(node, symbol); + checkNestedBlockScopedBinding(node, symbol); - return getNarrowedTypeOfSymbol(getExportSymbolOfValueSymbolIfExported(symbol), node); + const type = getTypeOfSymbol(localOrExportSymbol); + if (!(localOrExportSymbol.flags & SymbolFlags.Variable) || isAssignmentTarget(node)) { + return type; + } + const declaration = localOrExportSymbol.valueDeclaration; + const assumeInitialized = !strictNullChecks || (type.flags & TypeFlags.Any) !== 0 || !declaration || + getRootDeclaration(declaration).kind === SyntaxKind.Parameter || isInAmbientContext(declaration) || + getContainingFunctionOrModule(declaration) !== getContainingFunctionOrModule(node); + const flowType = getFlowTypeOfReference(node, type, assumeInitialized); + if (!assumeInitialized && !(getNullableKind(type) & TypeFlags.Undefined) && getNullableKind(flowType) & TypeFlags.Undefined) { + error(node, Diagnostics.Variable_0_is_used_before_being_assigned, symbolToString(symbol)); + // Return the declared type to reduce follow-on errors + return type; + } + return flowType; } function isInsideFunction(node: Node, threshold: Node): boolean { @@ -6953,7 +8124,7 @@ namespace ts { return false; } - function checkBlockScopedBindingCapturedInLoop(node: Identifier, symbol: Symbol): void { + function checkNestedBlockScopedBinding(node: Identifier, symbol: Symbol): void { if (languageVersion >= ScriptTarget.ES6 || (symbol.flags & (SymbolFlags.BlockScopedVariable | SymbolFlags.Class)) === 0 || symbol.valueDeclaration.parent.kind === SyntaxKind.CatchClause) { @@ -6965,40 +8136,74 @@ namespace ts { // 2. walk from the declaration up to the boundary of lexical environment and check // if there is an iteration statement in between declaration and boundary (is binding/class declared inside iteration statement) - let container: Node; - if (symbol.flags & SymbolFlags.Class) { - // get parent of class declaration - container = getClassLikeDeclarationOfSymbol(symbol).parent; - } - else { - // nesting structure: - // (variable declaration or binding element) -> variable declaration list -> container - container = symbol.valueDeclaration; - while (container.kind !== SyntaxKind.VariableDeclarationList) { - container = container.parent; - } - // get the parent of variable declaration list - container = container.parent; - if (container.kind === SyntaxKind.VariableStatement) { - // if parent is variable statement - get its parent - container = container.parent; - } - } - - const inFunction = isInsideFunction(node.parent, container); - + const container = getEnclosingBlockScopeContainer(symbol.valueDeclaration); + const usedInFunction = isInsideFunction(node.parent, container); let current = container; + + let containedInIterationStatement = false; while (current && !nodeStartsNewLexicalEnvironment(current)) { if (isIterationStatement(current, /*lookInLabeledStatements*/ false)) { - if (inFunction) { - getNodeLinks(current).flags |= NodeCheckFlags.LoopWithBlockScopedBindingCapturedInFunction; - } - // mark value declaration so during emit they can have a special handling - getNodeLinks(symbol.valueDeclaration).flags |= NodeCheckFlags.BlockScopedBindingInLoop; + containedInIterationStatement = true; break; } current = current.parent; } + + if (containedInIterationStatement) { + if (usedInFunction) { + // mark iteration statement as containing block-scoped binding captured in some function + getNodeLinks(current).flags |= NodeCheckFlags.LoopWithCapturedBlockScopedBinding; + } + + // mark variables that are declared in loop initializer and reassigned inside the body of ForStatement. + // if body of ForStatement will be converted to function then we'll need a extra machinery to propagate reassigned values back. + if (container.kind === SyntaxKind.ForStatement && + getAncestor(symbol.valueDeclaration, SyntaxKind.VariableDeclarationList).parent === container && + isAssignedInBodyOfForStatement(node, container)) { + getNodeLinks(symbol.valueDeclaration).flags |= NodeCheckFlags.NeedsLoopOutParameter; + } + + // set 'declared inside loop' bit on the block-scoped binding + getNodeLinks(symbol.valueDeclaration).flags |= NodeCheckFlags.BlockScopedBindingInLoop; + } + + if (usedInFunction) { + getNodeLinks(symbol.valueDeclaration).flags |= NodeCheckFlags.CapturedBlockScopedBinding; + } + } + + function isAssignedInBodyOfForStatement(node: Identifier, container: ForStatement): boolean { + let current: Node = node; + // skip parenthesized nodes + while (current.parent.kind === SyntaxKind.ParenthesizedExpression) { + current = current.parent; + } + + // check if node is used as LHS in some assignment expression + let isAssigned = false; + if (isAssignmentTarget(current)) { + isAssigned = true; + } + else if ((current.parent.kind === SyntaxKind.PrefixUnaryExpression || current.parent.kind === SyntaxKind.PostfixUnaryExpression)) { + const expr = current.parent; + isAssigned = expr.operator === SyntaxKind.PlusPlusToken || expr.operator === SyntaxKind.MinusMinusToken; + } + + if (!isAssigned) { + return false; + } + + // at this point we know that node is the target of assignment + // now check that modification happens inside the statement part of the ForStatement + while (current !== container) { + if (current === container.statement) { + return true; + } + else { + current = current.parent; + } + } + return false; } function captureLexicalThis(node: Node, container: Node): void { @@ -7012,12 +8217,75 @@ namespace ts { } } + function findFirstSuperCall(n: Node): Node { + if (isSuperCallExpression(n)) { + return n; + } + else if (isFunctionLike(n)) { + return undefined; + } + return forEachChild(n, findFirstSuperCall); + } + + /** + * Return a cached result if super-statement is already found. + * Otherwise, find a super statement in a given constructor function and cache the result in the node-links of the constructor + * + * @param constructor constructor-function to look for super statement + */ + function getSuperCallInConstructor(constructor: ConstructorDeclaration): ExpressionStatement { + const links = getNodeLinks(constructor); + + // Only trying to find super-call if we haven't yet tried to find one. Once we try, we will record the result + if (links.hasSuperCall === undefined) { + links.superCall = findFirstSuperCall(constructor.body); + links.hasSuperCall = links.superCall ? true : false; + } + return links.superCall; + } + + /** + * Check if the given class-declaration extends null then return true. + * Otherwise, return false + * @param classDecl a class declaration to check if it extends null + */ + function classDeclarationExtendsNull(classDecl: ClassDeclaration): boolean { + const classSymbol = getSymbolOfNode(classDecl); + const classInstanceType = getDeclaredTypeOfSymbol(classSymbol); + const baseConstructorType = getBaseConstructorTypeOfClass(classInstanceType); + + return baseConstructorType === nullType; + } + function checkThisExpression(node: Node): Type { // Stop at the first arrow function so that we can // tell whether 'this' needs to be captured. let container = getThisContainer(node, /* includeArrowFunctions */ true); let needToCaptureLexicalThis = false; + if (container.kind === SyntaxKind.Constructor) { + const containingClassDecl = container.parent; + const baseTypeNode = getClassExtendsHeritageClauseElement(containingClassDecl); + + // If a containing class does not have extends clause or the class extends null + // skip checking whether super statement is called before "this" accessing. + if (baseTypeNode && !classDeclarationExtendsNull(containingClassDecl)) { + const superCall = getSuperCallInConstructor(container); + + // We should give an error in the following cases: + // - No super-call + // - "this" is accessing before super-call. + // i.e super(this) + // this.x; super(); + // We want to make sure that super-call is done before accessing "this" so that + // "this" is not accessed as a parameter of the super-call. + if (!superCall || superCall.end > node.pos) { + // In ES6, super inside constructor of class-declaration has to precede "this" accessing + error(node, Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class); + } + } + } + // Now skip arrow functions to get the "real" owner of 'this'. if (container.kind === SyntaxKind.ArrowFunction) { container = getThisContainer(container, /* includeArrowFunctions */ false); @@ -7056,18 +8324,14 @@ namespace ts { if (needToCaptureLexicalThis) { captureLexicalThis(node, container); } - - if (isClassLike(container.parent)) { - const symbol = getSymbolOfNode(container.parent); - return container.flags & NodeFlags.Static ? getTypeOfSymbol(symbol) : (getDeclaredTypeOfSymbol(symbol)).thisType; - } - - // If this is a function in a JS file, it might be a class method. Check if it's the RHS - // of a x.prototype.y = function [name]() { .... } - if (isInJavaScriptFile(node) && container.kind === SyntaxKind.FunctionExpression) { - if (getSpecialPropertyAssignmentKind(container.parent) === SpecialPropertyAssignmentKind.PrototypeProperty) { + if (isFunctionLike(container)) { + // If this is a function in a JS file, it might be a class method. Check if it's the RHS + // of a x.prototype.y = function [name]() { .... } + if (container.kind === SyntaxKind.FunctionExpression && + isInJavaScriptFile(container.parent) && + getSpecialPropertyAssignmentKind(container.parent) === SpecialPropertyAssignmentKind.PrototypeProperty) { // Get the 'x' of 'x.prototype.y = f' (here, 'f' is 'container') - const className = (((container.parent as BinaryExpression) // x.protoype.y = f + const className = (((container.parent as BinaryExpression) // x.prototype.y = f .left as PropertyAccessExpression) // x.prototype.y .expression as PropertyAccessExpression) // x.prototype .expression; // x @@ -7076,11 +8340,45 @@ namespace ts { return getInferredClassType(classSymbol); } } + const type = getContextuallyTypedThisType(container); + if (type) { + return type; + } + const signature = getSignatureFromDeclaration(container); + if (signature.thisType) { + return signature.thisType; + } + } + if (isClassLike(container.parent)) { + const symbol = getSymbolOfNode(container.parent); + const type = container.flags & NodeFlags.Static ? getTypeOfSymbol(symbol) : (getDeclaredTypeOfSymbol(symbol)).thisType; + return getFlowTypeOfReference(node, type, /*assumeInitialized*/ true); } + if (isInJavaScriptFile(node)) { + const type = getTypeForThisExpressionFromJSDoc(container); + if (type && type !== unknownType) { + return type; + } + } + + if (compilerOptions.noImplicitThis) { + // With noImplicitThis, functions may not reference 'this' if it has type 'any' + error(node, Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation); + } return anyType; } + function getTypeForThisExpressionFromJSDoc(node: Node) { + const typeTag = getJSDocTypeTag(node); + if (typeTag && typeTag.typeExpression && typeTag.typeExpression.type && typeTag.typeExpression.type.kind === SyntaxKind.JSDocFunctionType) { + const jsDocFunctionType = typeTag.typeExpression.type; + if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].type.kind === SyntaxKind.JSDocThisType) { + return getTypeFromTypeNode(jsDocFunctionType.parameters[0].type); + } + } + } + function isInConstructorArgumentInitializer(node: Node, constructorDecl: Node): boolean { for (let n = node; n && n !== constructorDecl; n = n.parent) { if (n.kind === SyntaxKind.Parameter) { @@ -7141,6 +8439,71 @@ namespace ts { getNodeLinks(node).flags |= nodeCheckFlag; + // Due to how we emit async functions, we need to specialize the emit for an async method that contains a `super` reference. + // This is due to the fact that we emit the body of an async function inside of a generator function. As generator + // functions cannot reference `super`, we emit a helper inside of the method body, but outside of the generator. This helper + // uses an arrow function, which is permitted to reference `super`. + // + // There are two primary ways we can access `super` from within an async method. The first is getting the value of a property + // or indexed access on super, either as part of a right-hand-side expression or call expression. The second is when setting the value + // of a property or indexed access, either as part of an assignment expression or destructuring assignment. + // + // The simplest case is reading a value, in which case we will emit something like the following: + // + // // ts + // ... + // async asyncMethod() { + // let x = await super.asyncMethod(); + // return x; + // } + // ... + // + // // js + // ... + // asyncMethod() { + // const _super = name => super[name]; + // return __awaiter(this, arguments, Promise, function *() { + // let x = yield _super("asyncMethod").call(this); + // return x; + // }); + // } + // ... + // + // The more complex case is when we wish to assign a value, especially as part of a destructuring assignment. As both cases + // are legal in ES6, but also likely less frequent, we emit the same more complex helper for both scenarios: + // + // // ts + // ... + // async asyncMethod(ar: Promise) { + // [super.a, super.b] = await ar; + // } + // ... + // + // // js + // ... + // asyncMethod(ar) { + // const _super = (function (geti, seti) { + // const cache = Object.create(null); + // return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } }); + // })(name => super[name], (name, value) => super[name] = value); + // return __awaiter(this, arguments, Promise, function *() { + // [_super("a").value, _super("b").value] = yield ar; + // }); + // } + // ... + // + // This helper creates an object with a "value" property that wraps the `super` property or indexed access for both get and set. + // This is required for destructuring assignments, as a call expression cannot be used as the target of a destructuring assignment + // while a property access can. + if (container.kind === SyntaxKind.MethodDeclaration && container.flags & NodeFlags.Async) { + if (isSuperPropertyOrElementAccess(node.parent) && isAssignmentTarget(node.parent)) { + getNodeLinks(container).flags |= NodeCheckFlags.AsyncMethodWithSuperBinding; + } + else { + getNodeLinks(container).flags |= NodeCheckFlags.AsyncMethodWithSuper; + } + } + if (needToCaptureLexicalThis) { // call expressions are allowed only in constructors so they should always capture correct 'this' // super property access expressions can also appear in arrow functions - @@ -7220,38 +8583,82 @@ namespace ts { } } + function getContextuallyTypedThisType(func: FunctionLikeDeclaration): Type { + if (isContextSensitiveFunctionOrObjectLiteralMethod(func) && func.kind !== SyntaxKind.ArrowFunction) { + const contextualSignature = getContextualSignature(func); + if (contextualSignature) { + return contextualSignature.thisType; + } + } + + return undefined; + } + // Return contextual type of parameter or undefined if no contextual type is available function getContextuallyTypedParameterType(parameter: ParameterDeclaration): Type { const func = parameter.parent; - if (isFunctionExpressionOrArrowFunction(func) || isObjectLiteralMethod(func)) { - if (isContextSensitive(func)) { - const contextualSignature = getContextualSignature(func); - if (contextualSignature) { - - const funcHasRestParameters = hasRestParameter(func); - const len = func.parameters.length - (funcHasRestParameters ? 1 : 0); - const indexOfParameter = indexOf(func.parameters, parameter); - if (indexOfParameter < len) { - return getTypeAtPosition(contextualSignature, indexOfParameter); + if (isContextSensitiveFunctionOrObjectLiteralMethod(func)) { + const iife = getImmediatelyInvokedFunctionExpression(func); + if (iife) { + const indexOfParameter = indexOf(func.parameters, parameter); + if (iife.arguments && indexOfParameter < iife.arguments.length) { + if (parameter.dotDotDotToken) { + const restTypes: Type[] = []; + for (let i = indexOfParameter; i < iife.arguments.length; i++) { + restTypes.push(getTypeOfExpression(iife.arguments[i])); + } + return createArrayType(getUnionType(restTypes)); } + const links = getNodeLinks(iife); + const cached = links.resolvedSignature; + links.resolvedSignature = anySignature; + const type = checkExpression(iife.arguments[indexOfParameter]); + links.resolvedSignature = cached; + return type; + } + } + const contextualSignature = getContextualSignature(func); + if (contextualSignature) { + const funcHasRestParameters = hasRestParameter(func); + const len = func.parameters.length - (funcHasRestParameters ? 1 : 0); + const indexOfParameter = indexOf(func.parameters, parameter); + if (indexOfParameter < len) { + return getTypeAtPosition(contextualSignature, indexOfParameter); + } - // If last parameter is contextually rest parameter get its type - if (funcHasRestParameters && - indexOfParameter === (func.parameters.length - 1) && - isRestParameterIndex(contextualSignature, func.parameters.length - 1)) { - return getTypeOfSymbol(lastOrUndefined(contextualSignature.parameters)); - } + // If last parameter is contextually rest parameter get its type + if (funcHasRestParameters && + indexOfParameter === (func.parameters.length - 1) && + isRestParameterIndex(contextualSignature, func.parameters.length - 1)) { + return getTypeOfSymbol(lastOrUndefined(contextualSignature.parameters)); } } } return undefined; } - // In a variable, parameter or property declaration with a type annotation, the contextual type of an initializer - // expression is the type of the variable, parameter or property. Otherwise, in a parameter declaration of a - // contextually typed function expression, the contextual type of an initializer expression is the contextual type - // of the parameter. Otherwise, in a variable or parameter declaration with a binding pattern name, the contextual - // type of an initializer expression is the type implied by the binding pattern. + function getImmediatelyInvokedFunctionExpression(func: FunctionExpression | MethodDeclaration) { + if (isFunctionExpressionOrArrowFunction(func)) { + let prev: Node = func; + let parent: Node = func.parent; + while (parent.kind === SyntaxKind.ParenthesizedExpression) { + prev = parent; + parent = parent.parent; + } + if (parent.kind === SyntaxKind.CallExpression && (parent as CallExpression).expression === prev) { + return parent as CallExpression; + } + } + } + + // In a variable, parameter or property declaration with a type annotation, + // the contextual type of an initializer expression is the type of the variable, parameter or property. + // Otherwise, in a parameter declaration of a contextually typed function expression, + // the contextual type of an initializer expression is the contextual type of the parameter. + // Otherwise, in a variable or parameter declaration with a binding pattern name, + // the contextual type of an initializer expression is the type implied by the binding pattern. + // Otherwise, in a binding pattern inside a variable or parameter declaration, + // the contextual type of an initializer expression is the type annotation of the containing declaration, if present. function getContextualTypeForInitializerExpression(node: Expression): Type { const declaration = node.parent; if (node === declaration.initializer) { @@ -7267,6 +8674,18 @@ namespace ts { if (isBindingPattern(declaration.name)) { return getTypeFromBindingPattern(declaration.name, /*includePatternInType*/ true); } + if (isBindingPattern(declaration.parent)) { + const parentDeclaration = declaration.parent.parent; + const name = declaration.propertyName || declaration.name; + if (isVariableLike(parentDeclaration) && + parentDeclaration.type && + !isBindingPattern(name)) { + const text = getTextOfPropertyName(name); + if (text) { + return getTypeOfPropertyOfType(getTypeFromTypeNode(parentDeclaration.type), text); + } + } + } } return undefined; } @@ -7330,7 +8749,7 @@ namespace ts { const args = getEffectiveCallArguments(callTarget); const argIndex = indexOf(args, arg); if (argIndex >= 0) { - const signature = getResolvedSignature(callTarget); + const signature = getResolvedOrAnySignature(callTarget); return getTypeAtPosition(signature, argIndex); } return undefined; @@ -7362,6 +8781,12 @@ namespace ts { } return type; } + else if (operator === SyntaxKind.AmpersandAmpersandToken || operator === SyntaxKind.CommaToken) { + if (node === binaryExpression.right) { + return getContextualType(binaryExpression); + } + } + return undefined; } @@ -7412,11 +8837,6 @@ namespace ts { return !!(type.flags & TypeFlags.Union ? forEach((type).types, isTupleLikeType) : isTupleLikeType(type)); } - // Return true if the given contextual type provides an index signature of the given kind - function contextualTypeHasIndexSignature(type: Type, kind: IndexKind): boolean { - return !!(type.flags & TypeFlags.Union ? forEach((type).types, t => getIndexTypeOfStructuredType(t, kind)) : getIndexTypeOfStructuredType(type, kind)); - } - // In an object literal contextually typed by a type T, the contextual type of a property assignment is the type of // the matching property in T, if one exists. Otherwise, it is the type of the numeric index signature in T, if one // exists. Otherwise, it is the type of the string index signature in T, if one exists. @@ -7474,24 +8894,22 @@ namespace ts { return node === conditional.whenTrue || node === conditional.whenFalse ? getContextualType(conditional) : undefined; } - function getContextualTypeForJsxExpression(expr: JsxExpression | JsxSpreadAttribute): Type { - // Contextual type only applies to JSX expressions that are in attribute assignments (not in 'Children' positions) - if (expr.parent.kind === SyntaxKind.JsxAttribute) { - const attrib = expr.parent; - const attrsType = getJsxElementAttributesType(attrib.parent); + function getContextualTypeForJsxAttribute(attribute: JsxAttribute | JsxSpreadAttribute) { + const kind = attribute.kind; + const jsxElement = attribute.parent as JsxOpeningLikeElement; + const attrsType = getJsxElementAttributesType(jsxElement); + + if (attribute.kind === SyntaxKind.JsxAttribute) { if (!attrsType || isTypeAny(attrsType)) { return undefined; } - else { - return getTypeOfPropertyOfType(attrsType, attrib.name.text); - } + return getTypeOfPropertyOfType(attrsType, (attribute as JsxAttribute).name.text); + } + else if (attribute.kind === SyntaxKind.JsxSpreadAttribute) { + return attrsType; } - if (expr.kind === SyntaxKind.JsxSpreadAttribute) { - return getJsxElementAttributesType(expr.parent); - } - - return undefined; + Debug.fail(`Expected JsxAttribute or JsxSpreadAttribute, got ts.SyntaxKind[${kind}]`); } // Return the contextual type for a given expression node. During overload resolution, a contextual type may temporarily @@ -7510,7 +8928,7 @@ namespace ts { * Otherwise this may not be very useful. * * In cases where you *are* working on this function, you should understand - * when it is appropriate to use 'getContextualType' and 'getApparentTypeOfContetxualType'. + * when it is appropriate to use 'getContextualType' and 'getApparentTypeOfContextualType'. * * - Use 'getContextualType' when you are simply going to propagate the result to the expression. * - Use 'getApparentTypeOfContextualType' when you're going to need the members of the type. @@ -7559,8 +8977,10 @@ namespace ts { case SyntaxKind.ParenthesizedExpression: return getContextualType(parent); case SyntaxKind.JsxExpression: + return getContextualType(parent); + case SyntaxKind.JsxAttribute: case SyntaxKind.JsxSpreadAttribute: - return getContextualTypeForJsxExpression(parent); + return getContextualTypeForJsxAttribute(parent); } return undefined; } @@ -7588,6 +9008,12 @@ namespace ts { : undefined; } + function getContextualTypeForFunctionLikeDeclaration(node: FunctionExpression | MethodDeclaration) { + return isObjectLiteralMethod(node) ? + getContextualTypeForObjectLiteralMethod(node) : + getApparentTypeOfContextualType(node); + } + // Return the contextual signature for a given expression node. A contextual type provides a // contextual signature if it has a single call signature and if that call signature is non-generic. // If the contextual type is a union type, get the signature from each type possible and if they are @@ -7595,9 +9021,7 @@ namespace ts { // union type of return types from these signatures function getContextualSignature(node: FunctionExpression | MethodDeclaration): Signature { Debug.assert(node.kind !== SyntaxKind.MethodDeclaration || isObjectLiteralMethod(node)); - const type = isObjectLiteralMethod(node) - ? getContextualTypeForObjectLiteralMethod(node) - : getApparentTypeOfContextualType(node); + const type = getContextualTypeForFunctionLikeDeclaration(node); if (!type) { return undefined; } @@ -7613,7 +9037,7 @@ namespace ts { // This signature will contribute to contextual union signature signatureList = [signature]; } - else if (!compareSignaturesIdentical(signatureList[0], signature, /*partialMatch*/ false, /*ignoreReturnTypes*/ true, compareTypesIdentical)) { + else if (!compareSignaturesIdentical(signatureList[0], signature, /*partialMatch*/ false, /*ignoreThisTypes*/ true, /*ignoreReturnTypes*/ true, compareTypesIdentical)) { // Signatures aren't identical, do not use return undefined; } @@ -7654,23 +9078,6 @@ namespace ts { return mapper && mapper.context; } - // 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', '[{ p: a}] = xxx'. - function isAssignmentTarget(node: Node): boolean { - const parent = node.parent; - if (parent.kind === SyntaxKind.BinaryExpression && (parent).operatorToken.kind === SyntaxKind.EqualsToken && (parent).left === node) { - return true; - } - if (parent.kind === SyntaxKind.PropertyAssignment) { - return isAssignmentTarget(parent.parent); - } - if (parent.kind === SyntaxKind.ArrayLiteralExpression) { - return isAssignmentTarget(parent); - } - return false; - } - function checkSpreadElementExpression(node: SpreadElementExpression, contextualMapper?: TypeMapper): Type { // It is usually not safe to call checkExpressionCached if we can be contextually typing. // You can tell that we are contextually typing because of the contextualMapper parameter. @@ -7752,7 +9159,7 @@ namespace ts { } } } - return createArrayType(elementTypes.length ? getUnionType(elementTypes) : undefinedType); + return createArrayType(elementTypes.length ? getUnionType(elementTypes) : emptyArrayElementType); } function isNumericName(name: DeclarationName): boolean { @@ -7766,7 +9173,7 @@ namespace ts { } function isTypeAnyOrAllConstituentTypesHaveKind(type: Type, kind: TypeFlags): boolean { - return isTypeAny(type) || allConstituentTypesHaveKind(type, kind); + return isTypeAny(type) || isTypeOfKind(type, kind); } function isNumericLiteralName(name: string) { @@ -7812,6 +9219,17 @@ namespace ts { return links.resolvedType; } + function getObjectLiteralIndexInfo(node: ObjectLiteralExpression, properties: Symbol[], kind: IndexKind): IndexInfo { + const propTypes: Type[] = []; + for (let i = 0; i < properties.length; i++) { + if (kind === IndexKind.String || isNumericName(node.properties[i].name)) { + propTypes.push(getTypeOfSymbol(properties[i])); + } + } + const unionType = propTypes.length ? getUnionType(propTypes) : undefinedType; + return createIndexInfo(unionType, /*isReadonly*/ false); + } + function checkObjectLiteral(node: ObjectLiteralExpression, contextualMapper?: TypeMapper): Type { const inDestructuringPattern = isAssignmentTarget(node); // Grammar checking @@ -7823,8 +9241,10 @@ namespace ts { const contextualTypeHasPattern = contextualType && contextualType.pattern && (contextualType.pattern.kind === SyntaxKind.ObjectBindingPattern || contextualType.pattern.kind === SyntaxKind.ObjectLiteralExpression); let typeFlags: TypeFlags = 0; - let patternWithComputedProperties = false; + let hasComputedStringProperty = false; + let hasComputedNumberProperty = false; + for (const memberDecl of node.properties) { let member = memberDecl.symbol; if (memberDecl.kind === SyntaxKind.PropertyAssignment || @@ -7888,7 +9308,15 @@ namespace ts { checkAccessorDeclaration(memberDecl); } - if (!hasDynamicName(memberDecl)) { + if (hasDynamicName(memberDecl)) { + if (isNumericName(memberDecl.name)) { + hasComputedNumberProperty = true; + } + else { + hasComputedStringProperty = true; + } + } + else { propertiesTable[member.name] = member; } propertiesArray.push(member); @@ -7909,38 +9337,15 @@ namespace ts { } } - const stringIndexType = getIndexType(IndexKind.String); - const numberIndexType = getIndexType(IndexKind.Number); - const result = createAnonymousType(node.symbol, propertiesTable, emptyArray, emptyArray, stringIndexType, numberIndexType); + const stringIndexInfo = hasComputedStringProperty ? getObjectLiteralIndexInfo(node, propertiesArray, IndexKind.String) : undefined; + const numberIndexInfo = hasComputedNumberProperty ? getObjectLiteralIndexInfo(node, propertiesArray, IndexKind.Number) : undefined; + const result = createAnonymousType(node.symbol, propertiesTable, emptyArray, emptyArray, stringIndexInfo, numberIndexInfo); const freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : TypeFlags.FreshObjectLiteral; result.flags |= TypeFlags.ObjectLiteral | TypeFlags.ContainsObjectLiteral | freshObjectLiteralFlag | (typeFlags & TypeFlags.PropagatingFlags) | (patternWithComputedProperties ? TypeFlags.ObjectLiteralPatternWithComputedProperties : 0); if (inDestructuringPattern) { result.pattern = node; } return result; - - function getIndexType(kind: IndexKind) { - if (contextualType && contextualTypeHasIndexSignature(contextualType, kind)) { - const propTypes: Type[] = []; - for (let i = 0; i < propertiesArray.length; i++) { - const propertyDecl = node.properties[i]; - if (kind === IndexKind.String || isNumericName(propertyDecl.name)) { - // Do not call getSymbolOfNode(propertyDecl), as that will get the - // original symbol for the node. We actually want to get the symbol - // created by checkObjectLiteral, since that will be appropriately - // contextually typed and resolved. - const type = getTypeOfSymbol(propertiesArray[i]); - if (!contains(propTypes, type)) { - propTypes.push(type); - } - } - } - const result = propTypes.length ? getUnionType(propTypes) : undefinedType; - typeFlags |= result.flags; - return result; - } - return undefined; - } } function checkJsxSelfClosingElement(node: JsxSelfClosingElement) { @@ -7948,30 +9353,16 @@ namespace ts { return jsxElementType || anyType; } - function tagNamesAreEquivalent(lhs: EntityName, rhs: EntityName): boolean { - if (lhs.kind !== rhs.kind) { - return false; - } - - if (lhs.kind === SyntaxKind.Identifier) { - return (lhs).text === (rhs).text; - } - - return (lhs).right.text === (rhs).right.text && - tagNamesAreEquivalent((lhs).left, (rhs).left); - } - function checkJsxElement(node: JsxElement) { // Check attributes checkJsxOpeningLikeElement(node.openingElement); - // Check that the closing tag matches - if (!tagNamesAreEquivalent(node.openingElement.tagName, node.closingElement.tagName)) { - error(node.closingElement, Diagnostics.Expected_corresponding_JSX_closing_tag_for_0, getTextOfNode(node.openingElement.tagName)); + // Perform resolution on the closing tag so that rename/go to definition/etc work + if (isJsxIntrinsicIdentifier(node.closingElement.tagName)) { + getIntrinsicTagSymbol(node.closingElement); } else { - // Perform resolution on the closing tag so that rename/go to definition/etc work - getJsxElementTagSymbol(node.closingElement); + checkExpression(node.closingElement.tagName); } // Check children @@ -8082,76 +9473,43 @@ namespace ts { return jsxTypes[name]; } - /// Given a JSX opening element or self-closing element, return the symbol of the property that the tag name points to if - /// this is an intrinsic tag. This might be a named - /// property of the IntrinsicElements interface, or its string indexer. - /// If this is a class-based tag (otherwise returns undefined), returns the symbol of the class - /// type or factory function. - /// Otherwise, returns unknownSymbol. - function getJsxElementTagSymbol(node: JsxOpeningLikeElement | JsxClosingElement): Symbol { + /** + * Looks up an intrinsic tag name and returns a symbol that either points to an intrinsic + * property (in which case nodeLinks.jsxFlags will be IntrinsicNamedElement) or an intrinsic + * string index signature (in which case nodeLinks.jsxFlags will be IntrinsicIndexedElement). + * May also return unknownSymbol if both of these lookups fail. + */ + function getIntrinsicTagSymbol(node: JsxOpeningLikeElement | JsxClosingElement): Symbol { const links = getNodeLinks(node); if (!links.resolvedSymbol) { - if (isJsxIntrinsicIdentifier(node.tagName)) { - links.resolvedSymbol = lookupIntrinsicTag(node); - } - else { - links.resolvedSymbol = lookupClassTag(node); - } - } - return links.resolvedSymbol; - - function lookupIntrinsicTag(node: JsxOpeningLikeElement | JsxClosingElement): Symbol { const intrinsicElementsType = getJsxType(JsxNames.IntrinsicElements); if (intrinsicElementsType !== unknownType) { // Property case const intrinsicProp = getPropertyOfType(intrinsicElementsType, (node.tagName).text); if (intrinsicProp) { links.jsxFlags |= JsxFlags.IntrinsicNamedElement; - return intrinsicProp; + return links.resolvedSymbol = intrinsicProp; } // Intrinsic string indexer case const indexSignatureType = getIndexTypeOfType(intrinsicElementsType, IndexKind.String); if (indexSignatureType) { links.jsxFlags |= JsxFlags.IntrinsicIndexedElement; - return intrinsicElementsType.symbol; + return links.resolvedSymbol = intrinsicElementsType.symbol; } // Wasn't found error(node, Diagnostics.Property_0_does_not_exist_on_type_1, (node.tagName).text, "JSX." + JsxNames.IntrinsicElements); - return unknownSymbol; + return links.resolvedSymbol = unknownSymbol; } else { if (compilerOptions.noImplicitAny) { error(node, Diagnostics.JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists, JsxNames.IntrinsicElements); } + return links.resolvedSymbol = unknownSymbol; } } - - function lookupClassTag(node: JsxOpeningLikeElement | JsxClosingElement): Symbol { - const valueSymbol: Symbol = resolveJsxTagName(node); - - // Look up the value in the current scope - if (valueSymbol && valueSymbol !== unknownSymbol) { - links.jsxFlags |= JsxFlags.ValueElement; - if (valueSymbol.flags & SymbolFlags.Alias) { - markAliasSymbolAsReferenced(valueSymbol); - } - } - - return valueSymbol || unknownSymbol; - } - - function resolveJsxTagName(node: JsxOpeningLikeElement | JsxClosingElement): Symbol { - if (node.tagName.kind === SyntaxKind.Identifier) { - const tag = node.tagName; - const sym = getResolvedSymbol(tag); - return sym.exportSymbol || sym; - } - else { - return checkQualifiedName(node.tagName).symbol; - } - } + return links.resolvedSymbol; } /** @@ -8159,29 +9517,18 @@ namespace ts { * element is not a class element, or the class element type cannot be determined, returns 'undefined'. * For example, in the element , the element instance type is `MyClass` (not `typeof MyClass`). */ - function getJsxElementInstanceType(node: JsxOpeningLikeElement) { - // There is no such thing as an instance type for a non-class element. This - // line shouldn't be hit. - Debug.assert(!!(getNodeLinks(node).jsxFlags & JsxFlags.ValueElement), "Should not call getJsxElementInstanceType on non-class Element"); - - const classSymbol = getJsxElementTagSymbol(node); - if (classSymbol === unknownSymbol) { - // Couldn't find the class instance type. Error has already been issued - return anyType; - } - - const valueType = getTypeOfSymbol(classSymbol); + function getJsxElementInstanceType(node: JsxOpeningLikeElement, valueType: Type) { + Debug.assert(!(valueType.flags & TypeFlags.Union)); if (isTypeAny(valueType)) { // Short-circuit if the class tag is using an element type 'any' return anyType; } - // Resolve the signatures, preferring constructors + // Resolve the signatures, preferring constructor let signatures = getSignaturesOfType(valueType, SignatureKind.Construct); if (signatures.length === 0) { // No construct signatures, try call signatures signatures = getSignaturesOfType(valueType, SignatureKind.Call); - if (signatures.length === 0) { // We found no signatures at all, which is an error error(node.tagName, Diagnostics.JSX_element_type_0_does_not_have_any_construct_or_call_signatures, getTextOfNode(node.tagName)); @@ -8193,10 +9540,10 @@ namespace ts { } /// e.g. "props" for React.d.ts, - /// or 'undefined' if ElementAttributesPropery doesn't exist (which means all + /// or 'undefined' if ElementAttributesProperty doesn't exist (which means all /// non-intrinsic elements' attributes type is 'any'), /// or '' if it has 0 properties (which means every - /// non-instrinsic elements' attributes type is the element instance type) + /// non-intrinsic elements' attributes type is the element instance type) function getJsxElementPropertiesName() { // JSX const jsxNamespace = getGlobalSymbol(JsxNames.JSX, SymbolFlags.Namespace, /*diagnosticMessage*/undefined); @@ -8204,7 +9551,7 @@ namespace ts { const attribsPropTypeSym = jsxNamespace && getSymbol(jsxNamespace.exports, JsxNames.ElementAttributesPropertyNameContainer, SymbolFlags.Type); // JSX.ElementAttributesProperty [type] const attribPropType = attribsPropTypeSym && getDeclaredTypeOfSymbol(attribsPropTypeSym); - // The properites of JSX.ElementAttributesProperty + // The properties of JSX.ElementAttributesProperty const attribProperties = attribPropType && getPropertiesOfType(attribPropType); if (attribProperties) { @@ -8230,24 +9577,32 @@ namespace ts { } /** - * Given an opening/self-closing element, get the 'element attributes type', i.e. the type that tells - * us which attributes are valid on a given element. + * Given React element instance type and the class type, resolve the Jsx type + * Pass elemType to handle individual type in the union typed element type. */ - function getJsxElementAttributesType(node: JsxOpeningLikeElement): Type { - const links = getNodeLinks(node); - if (!links.resolvedJsxType) { - const sym = getJsxElementTagSymbol(node); + function getResolvedJsxType(node: JsxOpeningLikeElement, elemType?: Type, elemClassType?: Type): Type { + if (!elemType) { + elemType = checkExpression(node.tagName); + } + if (elemType.flags & TypeFlags.Union) { + const types = ( elemType).types; + return getUnionType(types.map(type => { + return getResolvedJsxType(node, type, elemClassType); + })); + } - if (links.jsxFlags & JsxFlags.ValueElement) { - // Get the element instance type (the result of newing or invoking this tag) - const elemInstanceType = getJsxElementInstanceType(node); + // Get the element instance type (the result of newing or invoking this tag) + const elemInstanceType = getJsxElementInstanceType(node, elemType); - // Is this is a stateless function component? See if its single signature is - // assignable to the JSX Element Type - const callSignature = getSingleCallSignature(getTypeOfSymbol(sym)); + if (!elemClassType || !isTypeAssignableTo(elemInstanceType, elemClassType)) { + // Is this is a stateless function component? See if its single signature's return type is + // assignable to the JSX Element Type + if (jsxElementType) { + const callSignatures = elemType && getSignaturesOfType(elemType, SignatureKind.Call); + const callSignature = callSignatures && callSignatures.length > 0 && callSignatures[0]; const callReturnType = callSignature && getReturnTypeOfSignature(callSignature); let paramType = callReturnType && (callSignature.parameters.length === 0 ? emptyObjectType : getTypeOfSymbol(callSignature.parameters[0])); - if (callReturnType && isTypeAssignableTo(callReturnType, jsxElementType) && (paramType.flags & TypeFlags.ObjectType)) { + if (callReturnType && isTypeAssignableTo(callReturnType, jsxElementType)) { // Intersect in JSX.IntrinsicAttributes if it exists const intrinsicAttributes = getJsxType(JsxNames.IntrinsicAttributes); if (intrinsicAttributes !== unknownType) { @@ -8255,80 +9610,93 @@ namespace ts { } return paramType; } - - // Issue an error if this return type isn't assignable to JSX.ElementClass - const elemClassType = getJsxGlobalElementClassType(); - if (elemClassType) { - checkTypeRelatedTo(elemInstanceType, elemClassType, assignableRelation, node, Diagnostics.JSX_element_type_0_is_not_a_constructor_function_for_JSX_elements); - } - - - if (isTypeAny(elemInstanceType)) { - return links.resolvedJsxType = elemInstanceType; - } - - const propsName = getJsxElementPropertiesName(); - if (propsName === undefined) { - // There is no type ElementAttributesProperty, return 'any' - return links.resolvedJsxType = anyType; - } - else if (propsName === "") { - // If there is no e.g. 'props' member in ElementAttributesProperty, use the element class type instead - return links.resolvedJsxType = elemInstanceType; - } - else { - const attributesType = getTypeOfPropertyOfType(elemInstanceType, propsName); - - if (!attributesType) { - // There is no property named 'props' on this instance type - return links.resolvedJsxType = emptyObjectType; - } - else if (isTypeAny(attributesType) || (attributesType === unknownType)) { - // Props is of type 'any' or unknown - return links.resolvedJsxType = attributesType; - } - else if (attributesType.flags & TypeFlags.Union) { - // Props cannot be a union type - error(node.tagName, Diagnostics.JSX_element_attributes_type_0_may_not_be_a_union_type, typeToString(attributesType)); - return links.resolvedJsxType = anyType; - } - else { - // Normal case -- add in IntrinsicClassElements and IntrinsicElements - let apparentAttributesType = attributesType; - const intrinsicClassAttribs = getJsxType(JsxNames.IntrinsicClassAttributes); - if (intrinsicClassAttribs !== unknownType) { - const typeParams = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(intrinsicClassAttribs.symbol); - if (typeParams) { - if (typeParams.length === 1) { - apparentAttributesType = intersectTypes(createTypeReference(intrinsicClassAttribs, [elemInstanceType]), apparentAttributesType); - } - } - else { - apparentAttributesType = intersectTypes(attributesType, intrinsicClassAttribs); - } - } - - const intrinsicAttribs = getJsxType(JsxNames.IntrinsicAttributes); - if (intrinsicAttribs !== unknownType) { - apparentAttributesType = intersectTypes(intrinsicAttribs, apparentAttributesType); - } - - return links.resolvedJsxType = apparentAttributesType; - } - } - } - else if (links.jsxFlags & JsxFlags.IntrinsicNamedElement) { - return links.resolvedJsxType = getTypeOfSymbol(sym); - } - else if (links.jsxFlags & JsxFlags.IntrinsicIndexedElement) { - return links.resolvedJsxType = getIndexTypeOfSymbol(sym, IndexKind.String); - } - else { - // Resolution failed, so we don't know - return links.resolvedJsxType = anyType; } } + // Issue an error if this return type isn't assignable to JSX.ElementClass + if (elemClassType) { + checkTypeRelatedTo(elemInstanceType, elemClassType, assignableRelation, node, Diagnostics.JSX_element_type_0_is_not_a_constructor_function_for_JSX_elements); + } + + if (isTypeAny(elemInstanceType)) { + return elemInstanceType; + } + + const propsName = getJsxElementPropertiesName(); + if (propsName === undefined) { + // There is no type ElementAttributesProperty, return 'any' + return anyType; + } + else if (propsName === "") { + // If there is no e.g. 'props' member in ElementAttributesProperty, use the element class type instead + return elemInstanceType; + } + else { + const attributesType = getTypeOfPropertyOfType(elemInstanceType, propsName); + + if (!attributesType) { + // There is no property named 'props' on this instance type + return emptyObjectType; + } + else if (isTypeAny(attributesType) || (attributesType === unknownType)) { + // Props is of type 'any' or unknown + return attributesType; + } + else if (attributesType.flags & TypeFlags.Union) { + // Props cannot be a union type + error(node.tagName, Diagnostics.JSX_element_attributes_type_0_may_not_be_a_union_type, typeToString(attributesType)); + return anyType; + } + else { + // Normal case -- add in IntrinsicClassElements and IntrinsicElements + let apparentAttributesType = attributesType; + const intrinsicClassAttribs = getJsxType(JsxNames.IntrinsicClassAttributes); + if (intrinsicClassAttribs !== unknownType) { + const typeParams = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(intrinsicClassAttribs.symbol); + if (typeParams) { + if (typeParams.length === 1) { + apparentAttributesType = intersectTypes(createTypeReference(intrinsicClassAttribs, [elemInstanceType]), apparentAttributesType); + } + } + else { + apparentAttributesType = intersectTypes(attributesType, intrinsicClassAttribs); + } + } + + const intrinsicAttribs = getJsxType(JsxNames.IntrinsicAttributes); + if (intrinsicAttribs !== unknownType) { + apparentAttributesType = intersectTypes(intrinsicAttribs, apparentAttributesType); + } + + return apparentAttributesType; + } + } + } + + /** + * Given an opening/self-closing element, get the 'element attributes type', i.e. the type that tells + * us which attributes are valid on a given element. + */ + function getJsxElementAttributesType(node: JsxOpeningLikeElement): Type { + const links = getNodeLinks(node); + if (!links.resolvedJsxType) { + if (isJsxIntrinsicIdentifier(node.tagName)) { + const symbol = getIntrinsicTagSymbol(node); + if (links.jsxFlags & JsxFlags.IntrinsicNamedElement) { + return links.resolvedJsxType = getTypeOfSymbol(symbol); + } + else if (links.jsxFlags & JsxFlags.IntrinsicIndexedElement) { + return links.resolvedJsxType = getIndexInfoOfSymbol(symbol, IndexKind.String).type; + } + else { + return links.resolvedJsxType = unknownType; + } + } + else { + const elemClassType = getJsxGlobalElementClassType(); + return links.resolvedJsxType = getResolvedJsxType(node, undefined, elemClassType); + } + } return links.resolvedJsxType; } @@ -8373,10 +9741,11 @@ namespace ts { checkGrammarJsxElement(node); checkJsxPreconditions(node); - // The symbol 'React' should be marked as 'used' so we don't incorrectly elide its import. And if there - // is no 'React' symbol in scope when targeting React emit, we should issue an error. + // The reactNamespace symbol should be marked as 'used' so we don't incorrectly elide its import. And if there + // is no reactNamespace symbol in scope when targeting React emit, we should issue an error. const reactRefErr = compilerOptions.jsx === JsxEmit.React ? Diagnostics.Cannot_find_name_0 : undefined; - const reactSym = resolveName(node.tagName, "React", SymbolFlags.Value, reactRefErr, "React"); + const reactNamespace = compilerOptions.reactNamespace ? compilerOptions.reactNamespace : "React"; + const reactSym = resolveName(node.tagName, reactNamespace, SymbolFlags.Value, reactRefErr, reactNamespace); if (reactSym) { getSymbolLinks(reactSym).referenced = true; } @@ -8442,15 +9811,13 @@ namespace ts { * @param type The type of left. * @param prop The symbol for the right hand side of the property access. */ - function checkClassPropertyAccess(node: PropertyAccessExpression | QualifiedName, left: Expression | QualifiedName, type: Type, prop: Symbol): boolean { + function checkClassPropertyAccess(node: PropertyAccessExpression | QualifiedName | VariableLikeDeclaration, left: Expression | QualifiedName, type: Type, prop: Symbol): boolean { const flags = getDeclarationFlagsFromSymbol(prop); - const declaringClass = getDeclaredTypeOfSymbol(prop.parent); - + const declaringClass = getDeclaredTypeOfSymbol(getParentOfSymbol(prop)); + const errorNode = node.kind === SyntaxKind.PropertyAccessExpression || node.kind === SyntaxKind.VariableDeclaration ? + (node).name : + (node).right; if (left.kind === SyntaxKind.SuperKeyword) { - const errorNode = node.kind === SyntaxKind.PropertyAccessExpression ? - (node).name : - (node).right; - // TS 1.0 spec (April 2014): 4.8.2 // - In a constructor, instance member function, instance member accessor, or // instance member variable initializer where this references a derived class instance, @@ -8483,15 +9850,12 @@ namespace ts { } // Property is known to be private or protected at this point - // Get the declaring and enclosing class instance types - const enclosingClassDeclaration = getContainingClass(node); - const enclosingClass = enclosingClassDeclaration ? getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingClassDeclaration)) : undefined; - - // Private property is accessible if declaring and enclosing class are the same + // Private property is accessible if the property is within the declaring class if (flags & NodeFlags.Private) { - if (declaringClass !== enclosingClass) { - error(node, Diagnostics.Property_0_is_private_and_only_accessible_within_class_1, symbolToString(prop), typeToString(declaringClass)); + const declaringClassDeclaration = getClassLikeDeclarationOfSymbol(getParentOfSymbol(prop)); + if (!isNodeWithinClass(node, declaringClassDeclaration)) { + error(errorNode, Diagnostics.Property_0_is_private_and_only_accessible_within_class_1, symbolToString(prop), typeToString(declaringClass)); return false; } return true; @@ -8503,9 +9867,16 @@ namespace ts { if (left.kind === SyntaxKind.SuperKeyword) { return true; } - // A protected property is accessible in the declaring class and classes derived from it - if (!enclosingClass || !hasBaseType(enclosingClass, declaringClass)) { - error(node, Diagnostics.Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses, symbolToString(prop), typeToString(declaringClass)); + + // Get the enclosing class that has the declaring class as its base type + const enclosingClass = forEachEnclosingClass(node, enclosingDeclaration => { + const enclosingClass = getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingDeclaration)); + return hasBaseType(enclosingClass, declaringClass) ? enclosingClass : undefined; + }); + + // A protected property is accessible if the property is within the declaring class or classes derived from it + if (!enclosingClass) { + error(errorNode, Diagnostics.Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses, symbolToString(prop), typeToString(declaringClass)); return false; } // No further restrictions for static properties @@ -8520,12 +9891,27 @@ namespace ts { // TODO: why is the first part of this check here? if (!(getTargetType(type).flags & (TypeFlags.Class | TypeFlags.Interface) && hasBaseType(type, enclosingClass))) { - error(node, Diagnostics.Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1, symbolToString(prop), typeToString(enclosingClass)); + error(errorNode, Diagnostics.Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1, symbolToString(prop), typeToString(enclosingClass)); return false; } return true; } + function checkNonNullExpression(node: Expression | QualifiedName) { + const type = checkExpression(node); + if (strictNullChecks) { + const kind = getNullableKind(type); + if (kind) { + error(node, kind & TypeFlags.Undefined ? kind & TypeFlags.Null ? + Diagnostics.Object_is_possibly_null_or_undefined : + Diagnostics.Object_is_possibly_undefined : + Diagnostics.Object_is_possibly_null); + } + return getNonNullableType(type); + } + return type; + } + function checkPropertyAccessExpression(node: PropertyAccessExpression) { return checkPropertyAccessExpressionOrQualifiedName(node, node.expression, node.name); } @@ -8535,7 +9921,7 @@ namespace ts { } function checkPropertyAccessExpressionOrQualifiedName(node: PropertyAccessExpression | QualifiedName, left: Expression | QualifiedName, right: Identifier) { - const type = checkExpression(left); + const type = checkNonNullExpression(left); if (isTypeAny(type)) { return type; } @@ -8558,7 +9944,27 @@ namespace ts { if (prop.parent && prop.parent.flags & SymbolFlags.Class) { checkClassPropertyAccess(node, left, apparentType, prop); } - return getTypeOfSymbol(prop); + + const propType = getTypeOfSymbol(prop); + if (node.kind !== SyntaxKind.PropertyAccessExpression || isAssignmentTarget(node) || + !(propType.flags & TypeFlags.Union) && !(prop.flags & (SymbolFlags.Variable | SymbolFlags.Property | SymbolFlags.Accessor))) { + return propType; + } + const leftmostNode = getLeftmostIdentifierOrThis(node); + if (!leftmostNode) { + return propType; + } + if (leftmostNode.kind === SyntaxKind.Identifier) { + const leftmostSymbol = getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(leftmostNode)); + if (!leftmostSymbol) { + return propType; + } + const declaration = leftmostSymbol.valueDeclaration; + if (!declaration || declaration.kind !== SyntaxKind.VariableDeclaration && declaration.kind !== SyntaxKind.Parameter && declaration.kind !== SyntaxKind.BindingElement) { + return propType; + } + } + return getFlowTypeOfReference(node, propType, /*assumeInitialized*/ true); } function isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName, propertyName: string): boolean { @@ -8576,10 +9982,60 @@ namespace ts { return true; } + /** + * Return the symbol of the for-in variable declared or referenced by the given for-in statement. + */ + function getForInVariableSymbol(node: ForInStatement): Symbol { + const initializer = node.initializer; + if (initializer.kind === SyntaxKind.VariableDeclarationList) { + const variable = (initializer).declarations[0]; + if (variable && !isBindingPattern(variable.name)) { + return getSymbolOfNode(variable); + } + } + else if (initializer.kind === SyntaxKind.Identifier) { + return getResolvedSymbol(initializer); + } + return undefined; + } + + /** + * Return true if the given type is considered to have numeric property names. + */ + function hasNumericPropertyNames(type: Type) { + return getIndexTypeOfType(type, IndexKind.Number) && !getIndexTypeOfType(type, IndexKind.String); + } + + /** + * Return true if given node is an expression consisting of an identifier (possibly parenthesized) + * that references a for-in variable for an object with numeric property names. + */ + function isForInVariableForNumericPropertyNames(expr: Expression) { + const e = skipParenthesizedNodes(expr); + if (e.kind === SyntaxKind.Identifier) { + const symbol = getResolvedSymbol(e); + if (symbol.flags & SymbolFlags.Variable) { + let child: Node = expr; + let node = expr.parent; + while (node) { + if (node.kind === SyntaxKind.ForInStatement && + child === (node).statement && + getForInVariableSymbol(node) === symbol && + hasNumericPropertyNames(checkExpression((node).expression))) { + return true; + } + child = node; + node = node.parent; + } + } + } + return false; + } + function checkIndexedAccess(node: ElementAccessExpression): Type { // Grammar checking if (!node.argumentExpression) { - const sourceFile = getSourceFile(node); + const sourceFile = getSourceFileOfNode(node); if (node.parent.kind === SyntaxKind.NewExpression && (node.parent).expression === node) { const start = skipTrivia(sourceFile.text, node.expression.end); const end = node.end; @@ -8593,7 +10049,7 @@ namespace ts { } // Obtain base constraint such that we can bail out if the constraint is an unknown type - const objectType = getApparentType(checkExpression(node.expression)); + const objectType = getApparentType(checkNonNullExpression(node.expression)); const indexType = node.argumentExpression ? checkExpression(node.argumentExpression) : unknownType; if (objectType === unknownType) { @@ -8636,22 +10092,26 @@ namespace ts { if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, TypeFlags.StringLike | TypeFlags.NumberLike | TypeFlags.ESSymbol)) { // Try to use a number indexer. - if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, TypeFlags.NumberLike)) { - const numberIndexType = getIndexTypeOfType(objectType, IndexKind.Number); - if (numberIndexType) { - return numberIndexType; + if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, TypeFlags.NumberLike) || isForInVariableForNumericPropertyNames(node.argumentExpression)) { + const numberIndexInfo = getIndexInfoOfType(objectType, IndexKind.Number); + if (numberIndexInfo) { + getNodeLinks(node).resolvedIndexInfo = numberIndexInfo; + return numberIndexInfo.type; } } // Try to use string indexing. - const stringIndexType = getIndexTypeOfType(objectType, IndexKind.String); - if (stringIndexType) { - return stringIndexType; + const stringIndexInfo = getIndexInfoOfType(objectType, IndexKind.String); + if (stringIndexInfo) { + getNodeLinks(node).resolvedIndexInfo = stringIndexInfo; + return stringIndexInfo.type; } // Fall back to any. if (compilerOptions.noImplicitAny && !compilerOptions.suppressImplicitAnyIndexErrors && !isTypeAny(objectType)) { - error(node, Diagnostics.Index_signature_of_object_type_implicitly_has_an_any_type); + error(node, getIndexTypeOfType(objectType, IndexKind.Number) ? + Diagnostics.Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number : + Diagnostics.Index_signature_of_object_type_implicitly_has_an_any_type); } return anyType; @@ -8903,7 +10363,7 @@ namespace ts { if (type.flags & TypeFlags.ObjectType) { const resolved = resolveStructuredTypeMembers(type); if (resolved.callSignatures.length === 1 && resolved.constructSignatures.length === 0 && - resolved.properties.length === 0 && !resolved.stringIndexType && !resolved.numberIndexType) { + resolved.properties.length === 0 && !resolved.stringIndexInfo && !resolved.numberIndexInfo) { return resolved.callSignatures[0]; } } @@ -8946,6 +10406,12 @@ namespace ts { context.failedTypeParameterIndex = undefined; } + if (signature.thisType) { + const thisArgumentNode = getThisArgumentOfCall(node); + const thisArgumentType = thisArgumentNode ? checkExpression(thisArgumentNode) : voidType; + inferTypes(context, thisArgumentType, signature.thisType); + } + // We perform two passes over the arguments. In the first pass we infer from all arguments, but use // wildcards for all context sensitive function expressions. const argCount = getEffectiveArgumentCount(node, args, signature); @@ -8976,7 +10442,7 @@ namespace ts { // Tagged template expressions will always have `undefined` for `excludeArgument[0]`. if (excludeArgument) { for (let i = 0; i < argCount; i++) { - // No need to check for omitted args and template expressions, their exlusion value is always undefined + // No need to check for omitted args and template expressions, their exclusion value is always undefined if (excludeArgument[i] === false) { const arg = args[i]; const paramType = getTypeAtPosition(signature, i); @@ -9019,6 +10485,20 @@ namespace ts { } function checkApplicableSignature(node: CallLikeExpression, args: Expression[], signature: Signature, relation: Map, excludeArgument: boolean[], reportErrors: boolean) { + + if (signature.thisType && signature.thisType !== voidType && node.kind !== SyntaxKind.NewExpression) { + // If the called expression is not of the form `x.f` or `x["f"]`, then sourceType = voidType + // If the signature's 'this' type is voidType, then the check is skipped -- anything is compatible. + // If the expression is a new expression, then the check is skipped. + const thisArgumentNode = getThisArgumentOfCall(node); + const thisArgumentType = thisArgumentNode ? checkExpression(thisArgumentNode) : voidType; + const errorNode = reportErrors ? (thisArgumentNode || node) : undefined; + const headMessage = Diagnostics.The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1; + if (!checkTypeRelatedTo(thisArgumentType, signature.thisType, relation, errorNode, headMessage)) { + return false; + } + } + const headMessage = Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1; const argCount = getEffectiveArgumentCount(node, args, signature); for (let i = 0; i < argCount; i++) { const arg = getEffectiveArgument(node, args, i); @@ -9038,7 +10518,6 @@ namespace ts { // Use argument expression as error location when reporting errors const errorNode = reportErrors ? getEffectiveArgumentErrorNode(node, i, arg) : undefined; - const headMessage = Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1; if (!checkTypeRelatedTo(argType, paramType, relation, errorNode, headMessage)) { return false; } @@ -9048,6 +10527,21 @@ namespace ts { return true; } + /** + * Returns the this argument in calls like x.f(...) and x[f](...). Undefined otherwise. + */ + function getThisArgumentOfCall(node: CallLikeExpression): LeftHandSideExpression { + if (node.kind === SyntaxKind.CallExpression) { + const callee = (node).expression; + if (callee.kind === SyntaxKind.PropertyAccessExpression) { + return (callee as PropertyAccessExpression).expression; + } + else if (callee.kind === SyntaxKind.ElementAccessExpression) { + return (callee as ElementAccessExpression).expression; + } + } + } + /** * Returns the effective arguments for an expression that works like a function invocation. * @@ -9231,7 +10725,7 @@ namespace ts { case SyntaxKind.ComputedPropertyName: const nameType = checkComputedPropertyName(element.name); - if (allConstituentTypesHaveKind(nameType, TypeFlags.ESSymbol)) { + if (isTypeOfKind(nameType, TypeFlags.ESSymbol)) { return nameType; } else { @@ -9257,7 +10751,7 @@ namespace ts { */ function getEffectiveDecoratorThirdArgumentType(node: Node) { // The third argument to a decorator is either its `descriptor` for a method decorator - // or its `parameterIndex` for a paramter decorator + // or its `parameterIndex` for a parameter decorator if (node.kind === SyntaxKind.ClassDeclaration) { Debug.fail("Class decorators should not have a third synthetic argument."); return unknownType; @@ -9315,7 +10809,7 @@ namespace ts { return getEffectiveDecoratorArgumentType(node, argIndex); } else if (argIndex === 0 && node.kind === SyntaxKind.TaggedTemplateExpression) { - return globalTemplateStringsArrayType; + return getGlobalTemplateStringsArrayType(); } // This is not a synthetic argument, so we return 'undefined' @@ -9596,13 +11090,15 @@ namespace ts { // In super call, the candidate signatures are the matching arity signatures of the base constructor function instantiated // with the type arguments specified in the extends clause. const baseTypeNode = getClassExtendsHeritageClauseElement(getContainingClass(node)); - const baseConstructors = getInstantiatedConstructorsForTypeArguments(superType, baseTypeNode.typeArguments); - return resolveCall(node, baseConstructors, candidatesOutArray); + if (baseTypeNode) { + const baseConstructors = getInstantiatedConstructorsForTypeArguments(superType, baseTypeNode.typeArguments); + return resolveCall(node, baseConstructors, candidatesOutArray); + } } return resolveUntypedCall(node); } - const funcType = checkExpression(node.expression); + const funcType = checkNonNullExpression(node.expression); const apparentType = getApparentType(funcType); if (apparentType === unknownType) { @@ -9625,7 +11121,7 @@ namespace ts { // We exclude union types because we may have a union of function types that happen to have // no common signatures. if (isTypeAny(funcType) || (!callSignatures.length && !constructSignatures.length && !(funcType.flags & TypeFlags.Union) && isTypeAssignableTo(funcType, globalFunctionType))) { - // The unknownType indicates that an error already occured (and was reported). No + // The unknownType indicates that an error already occurred (and was reported). No // need to report another error in this case. if (funcType !== unknownType && node.typeArguments) { error(node, Diagnostics.Untyped_function_calls_may_not_accept_type_arguments); @@ -9655,7 +11151,7 @@ namespace ts { } } - let expressionType = checkExpression(node.expression); + let expressionType = checkNonNullExpression(node.expression); // If expressionType's apparent type(section 3.8.1) is an object type with one or // more construct signatures, the expression is processed in the same manner as a @@ -9694,19 +11190,25 @@ namespace ts { // that the user will not add any. const constructSignatures = getSignaturesOfType(expressionType, SignatureKind.Construct); if (constructSignatures.length) { + if (!isConstructorAccessible(node, constructSignatures[0])) { + return resolveErrorCall(node); + } return resolveCall(node, constructSignatures, candidatesOutArray); } // If expressionType's apparent type is an object type with no construct signatures but // one or more call signatures, the expression is processed as a function call. A compile-time // error occurs if the result of the function call is not Void. The type of the result of the - // operation is Any. + // operation is Any. It is an error to have a Void this type. const callSignatures = getSignaturesOfType(expressionType, SignatureKind.Call); if (callSignatures.length) { const signature = resolveCall(node, callSignatures, candidatesOutArray); if (getReturnTypeOfSignature(signature) !== voidType) { error(node, Diagnostics.Only_a_void_function_can_be_called_with_the_new_keyword); } + if (signature.thisType === voidType) { + error(node, Diagnostics.A_function_that_is_called_with_the_new_keyword_cannot_have_a_this_type_that_is_void); + } return signature; } @@ -9714,6 +11216,36 @@ namespace ts { return resolveErrorCall(node); } + function isConstructorAccessible(node: NewExpression, signature: Signature) { + if (!signature || !signature.declaration) { + return true; + } + + const declaration = signature.declaration; + const flags = declaration.flags; + + // Public constructor is accessible. + if (!(flags & (NodeFlags.Private | NodeFlags.Protected))) { + return true; + } + + const declaringClassDeclaration = getClassLikeDeclarationOfSymbol(declaration.parent.symbol); + const declaringClass = getDeclaredTypeOfSymbol(declaration.parent.symbol); + + // A private or protected constructor can only be instantiated within it's own class + if (!isNodeWithinClass(node, declaringClassDeclaration)) { + if (flags & NodeFlags.Private) { + error(node, Diagnostics.Constructor_of_class_0_is_private_and_only_accessible_within_the_class_declaration, typeToString(declaringClass)); + } + if (flags & NodeFlags.Protected) { + error(node, Diagnostics.Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration, typeToString(declaringClass)); + } + return false; + } + + return true; + } + function resolveTaggedTemplateExpression(node: TaggedTemplateExpression, candidatesOutArray: Signature[]): Signature { const tagType = checkExpression(node.tag); const apparentType = getApparentType(tagType); @@ -9786,6 +11318,20 @@ namespace ts { return resolveCall(node, callSignatures, candidatesOutArray, headMessage); } + function resolveSignature(node: CallLikeExpression, candidatesOutArray?: Signature[]): Signature { + switch (node.kind) { + case SyntaxKind.CallExpression: + return resolveCallExpression(node, candidatesOutArray); + case SyntaxKind.NewExpression: + return resolveNewExpression(node, candidatesOutArray); + case SyntaxKind.TaggedTemplateExpression: + return resolveTaggedTemplateExpression(node, candidatesOutArray); + case SyntaxKind.Decorator: + return resolveDecorator(node, candidatesOutArray); + } + Debug.fail("Branch in 'resolveSignature' should be unreachable."); + } + // candidatesOutArray is passed by signature help in the language service, and collectCandidates // must fill it up with the appropriate candidate signatures function getResolvedSignature(node: CallLikeExpression, candidatesOutArray?: Signature[]): Signature { @@ -9794,26 +11340,23 @@ namespace ts { // However, it is possible that either candidatesOutArray was not passed in the first time, // or that a different candidatesOutArray was passed in. Therefore, we need to redo the work // to correctly fill the candidatesOutArray. - if (!links.resolvedSignature || candidatesOutArray) { - links.resolvedSignature = anySignature; - - if (node.kind === SyntaxKind.CallExpression) { - links.resolvedSignature = resolveCallExpression(node, candidatesOutArray); - } - else if (node.kind === SyntaxKind.NewExpression) { - links.resolvedSignature = resolveNewExpression(node, candidatesOutArray); - } - else if (node.kind === SyntaxKind.TaggedTemplateExpression) { - links.resolvedSignature = resolveTaggedTemplateExpression(node, candidatesOutArray); - } - else if (node.kind === SyntaxKind.Decorator) { - links.resolvedSignature = resolveDecorator(node, candidatesOutArray); - } - else { - Debug.fail("Branch in 'getResolvedSignature' should be unreachable."); - } + const cached = links.resolvedSignature; + if (cached && cached !== anySignature && !candidatesOutArray) { + return cached; } - return links.resolvedSignature; + links.resolvedSignature = anySignature; + const result = resolveSignature(node, candidatesOutArray); + // If signature resolution originated in control flow type analysis (for example to compute the + // assigned type in a flow assignment) we don't cache the result as it may be based on temporary + // types from the control flow analysis. + links.resolvedSignature = flowLoopStart === flowLoopCount ? result : cached; + return result; + } + + function getResolvedOrAnySignature(node: CallLikeExpression) { + // If we're already in the process of resolving the given signature, don't resolve again as + // that could cause infinite recursion. Instead, return anySignature. + return getNodeLinks(node).resolvedSignature === anySignature ? anySignature : getResolvedSignature(node); } function getInferredClassType(symbol: Symbol) { @@ -9834,16 +11377,19 @@ namespace ts { checkGrammarTypeArguments(node, node.typeArguments) || checkGrammarArguments(node, node.arguments); const signature = getResolvedSignature(node); + if (node.expression.kind === SyntaxKind.SuperKeyword) { return voidType; } + if (node.kind === SyntaxKind.NewExpression) { const declaration = signature.declaration; if (declaration && declaration.kind !== SyntaxKind.Constructor && declaration.kind !== SyntaxKind.ConstructSignature && - declaration.kind !== SyntaxKind.ConstructorType) { + declaration.kind !== SyntaxKind.ConstructorType && + !isJSDocConstructSignature(declaration)) { // When resolved signature is a call signature (and not a construct signature) the result type is any, unless // the declaring function had members created through 'x.prototype.y = expr' or 'this.y = expr' psuedodeclarations @@ -9860,7 +11406,7 @@ namespace ts { } // In JavaScript files, calls to any identifier 'require' are treated as external module imports - if (isInJavaScriptFile(node) && isRequireCall(node)) { + if (isInJavaScriptFile(node) && isRequireCall(node, /*checkArgumentIsStringLiteral*/true)) { return resolveExternalModuleTypeByLiteral(node.arguments[0]); } @@ -9876,22 +11422,32 @@ namespace ts { const targetType = getTypeFromTypeNode(node.type); if (produceDiagnostics && targetType !== unknownType) { const widenedType = getWidenedType(exprType); - - // Permit 'number[] | "foo"' to be asserted to 'string'. - const bothAreStringLike = - someConstituentTypeHasKind(targetType, TypeFlags.StringLike) && - someConstituentTypeHasKind(widenedType, TypeFlags.StringLike); - if (!bothAreStringLike && !(isTypeAssignableTo(targetType, widenedType))) { - checkTypeAssignableTo(exprType, targetType, node, Diagnostics.Neither_type_0_nor_type_1_is_assignable_to_the_other); + if (!isTypeComparableTo(targetType, widenedType)) { + checkTypeComparableTo(exprType, targetType, node, Diagnostics.Type_0_cannot_be_converted_to_type_1); } } return targetType; } + function checkNonNullAssertion(node: NonNullExpression) { + return getNonNullableType(checkExpression(node.expression)); + } + + function getTypeOfParameter(symbol: Symbol) { + const type = getTypeOfSymbol(symbol); + if (strictNullChecks) { + const declaration = symbol.valueDeclaration; + if (declaration && (declaration).initializer) { + return addNullableKind(type, TypeFlags.Undefined); + } + } + return type; + } + function getTypeAtPosition(signature: Signature, pos: number): Type { return signature.hasRestParameter ? - pos < signature.parameters.length - 1 ? getTypeOfSymbol(signature.parameters[pos]) : getRestTypeOfSignature(signature) : - pos < signature.parameters.length ? getTypeOfSymbol(signature.parameters[pos]) : anyType; + pos < signature.parameters.length - 1 ? getTypeOfParameter(signature.parameters[pos]) : getRestTypeOfSignature(signature) : + pos < signature.parameters.length ? getTypeOfParameter(signature.parameters[pos]) : anyType; } function assignContextualParameterTypes(signature: Signature, context: Signature, mapper: TypeMapper) { @@ -9927,6 +11483,12 @@ namespace ts { const links = getSymbolLinks(parameter); if (!links.type) { links.type = instantiateType(contextualType, mapper); + // if inference didn't come up with anything but {}, fall back to the binding pattern if present. + if (links.type === emptyObjectType && + (parameter.valueDeclaration.name.kind === SyntaxKind.ObjectBindingPattern || + parameter.valueDeclaration.name.kind === SyntaxKind.ArrayBindingPattern)) { + links.type = getTypeFromBindingPattern(parameter.valueDeclaration.name); + } assignBindingElementTypes(parameter.valueDeclaration); } else if (isInferentialContext(mapper)) { @@ -9963,6 +11525,15 @@ namespace ts { } } + function getReturnTypeFromJSDocComment(func: SignatureDeclaration | FunctionDeclaration): Type { + const returnTag = getJSDocReturnTag(func); + if (returnTag && returnTag.typeExpression) { + return getTypeFromTypeNode(returnTag.typeExpression.type); + } + + return undefined; + } + function createPromiseType(promisedType: Type): Type { // creates a `Promise` type where `T` is the promisedType argument const globalPromiseType = getGlobalPromiseType(); @@ -10008,7 +11579,11 @@ namespace ts { } } else { - types = checkAndAggregateReturnExpressionTypes(func.body, contextualMapper, isAsync); + const hasImplicitReturn = !!(func.flags & NodeFlags.HasImplicitReturn); + types = checkAndAggregateReturnExpressionTypes(func.body, contextualMapper, isAsync, hasImplicitReturn); + if (!types) { + return neverType; + } if (types.length === 0) { if (isAsync) { // For an async function, the return type will not be void, but rather a Promise for void. @@ -10017,12 +11592,9 @@ namespace ts { error(func, Diagnostics.An_async_function_or_method_must_have_a_valid_awaitable_return_type); return unknownType; } - return promiseType; } - else { - return voidType; - } + return voidType; } } // When yield/return statements are contextually typed we allow the return type to be a union type. @@ -10035,7 +11607,8 @@ namespace ts { } else { error(func, Diagnostics.No_best_common_type_exists_among_return_expressions); - return unknownType; + // Defer to unioning the return types so we get a) downstream errors earlier and b) better Salsa experience + return getUnionType(types); } } @@ -10087,9 +11660,9 @@ namespace ts { return aggregatedTypes; } - function checkAndAggregateReturnExpressionTypes(body: Block, contextualMapper?: TypeMapper, isAsync?: boolean): Type[] { + function checkAndAggregateReturnExpressionTypes(body: Block, contextualMapper: TypeMapper, isAsync: boolean, hasImplicitReturn: boolean): Type[] { const aggregatedTypes: Type[] = []; - + let hasOmittedExpressions = false; forEachReturnStatement(body, returnStatement => { const expr = returnStatement.expression; if (expr) { @@ -10101,21 +11674,32 @@ namespace ts { // the native Promise type by the caller. type = checkAwaitedType(type, body.parent, Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member); } - - if (!contains(aggregatedTypes, type)) { + if (type !== neverType && !contains(aggregatedTypes, type)) { aggregatedTypes.push(type); } } + else { + hasOmittedExpressions = true; + } }); - + if (aggregatedTypes.length === 0 && !hasOmittedExpressions && !hasImplicitReturn) { + return undefined; + } + if (strictNullChecks && aggregatedTypes.length && (hasOmittedExpressions || hasImplicitReturn)) { + if (!contains(aggregatedTypes, undefinedType)) { + aggregatedTypes.push(undefinedType); + } + } return aggregatedTypes; } - /* - *TypeScript Specification 1.0 (6.3) - July 2014 - * An explicitly typed function whose return type isn't the Void or the Any type - * must have at least one return statement somewhere in its body. - * An exception to this rule is if the function implementation consists of a single 'throw' statement. + /** + * TypeScript Specification 1.0 (6.3) - July 2014 + * An explicitly typed function whose return type isn't the Void type, + * the Any type, or a union type containing the Void or Any type as a constituent + * must have at least one return statement somewhere in its body. + * An exception to this rule is if the function implementation consists of a single 'throw' statement. + * * @param returnType - return type of the function, can be undefined if return type is not explicitly specified */ function checkAllCodePathsInNonVoidFunctionReturnOrThrow(func: FunctionLikeDeclaration, returnType: Type): void { @@ -10124,7 +11708,7 @@ namespace ts { } // Functions with with an explicitly specified 'void' or 'any' return type don't need any return expressions. - if (returnType === voidType || isTypeAny(returnType)) { + if (returnType && maybeTypeOfKind(returnType, TypeFlags.Any | TypeFlags.Void)) { return; } @@ -10136,22 +11720,28 @@ namespace ts { const hasExplicitReturn = func.flags & NodeFlags.HasExplicitReturn; - if (returnType && !hasExplicitReturn) { + if (returnType === neverType) { + error(func.type, Diagnostics.A_function_returning_never_cannot_have_a_reachable_end_point); + } + else if (returnType && !hasExplicitReturn) { // minimal check: function has syntactic return type annotation and no explicit return statements in the body // this function does not conform to the specification. // NOTE: having returnType !== undefined is a precondition for entering this branch so func.type will always be present error(func.type, Diagnostics.A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value); } + else if (returnType && strictNullChecks && !isTypeAssignableTo(undefinedType, returnType)) { + error(func.type, Diagnostics.Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined); + } else if (compilerOptions.noImplicitReturns) { if (!returnType) { // If return type annotation is omitted check if function has any explicit return statements. // If it does not have any - its inferred return type is void - don't do any checks. // Otherwise get inferred return type from function body and report error only if it is not void / anytype - const inferredReturnType = hasExplicitReturn - ? getReturnTypeOfSignature(getSignatureFromDeclaration(func)) - : voidType; - - if (inferredReturnType === voidType || isTypeAny(inferredReturnType)) { + if (!hasExplicitReturn) { + return; + } + const inferredReturnType = getReturnTypeOfSignature(getSignatureFromDeclaration(func)); + if (isUnwrappedReturnTypeVoidOrAny(func, inferredReturnType)) { return; } } @@ -10170,14 +11760,10 @@ namespace ts { // The identityMapper object is used to indicate that function expressions are wildcards if (contextualMapper === identityMapper && isContextSensitive(node)) { + checkNodeDeferred(node); return anyFunctionType; } - const isAsync = isAsyncFunctionLike(node); - if (isAsync) { - emitAwaiter = true; - } - const links = getNodeLinks(node); const type = getTypeOfSymbol(node.symbol); const contextSensitive = isContextSensitive(node); @@ -10226,10 +11812,6 @@ namespace ts { Debug.assert(node.kind !== SyntaxKind.MethodDeclaration || isObjectLiteralMethod(node)); const isAsync = isAsyncFunctionLike(node); - if (isAsync) { - emitAwaiter = true; - } - const returnOrPromisedType = node.type && (isAsync ? checkAsyncFunctionReturnType(node) : getTypeFromTypeNode(node.type)); if (!node.asteriskToken) { // return is not necessary in the body of generators @@ -10277,81 +11859,78 @@ namespace ts { return true; } - function checkReferenceExpression(n: Node, invalidReferenceMessage: DiagnosticMessage, constantVariableMessage: DiagnosticMessage): boolean { - function findSymbol(n: Node): Symbol { - const symbol = getNodeLinks(n).resolvedSymbol; - // Because we got the symbol from the resolvedSymbol property, it might be of kind - // SymbolFlags.ExportValue. In this case it is necessary to get the actual export - // symbol, which will have the correct flags set on it. - return symbol && getExportSymbolOfValueSymbolIfExported(symbol); - } + function isReadonlySymbol(symbol: Symbol): boolean { + // The following symbols are considered read-only: + // Properties with a 'readonly' modifier + // Variables declared with 'const' + // Get accessors without matching set accessors + // Enum members + return symbol.flags & SymbolFlags.Property && (getDeclarationFlagsFromSymbol(symbol) & NodeFlags.Readonly) !== 0 || + symbol.flags & SymbolFlags.Variable && (getDeclarationFlagsFromSymbol(symbol) & NodeFlags.Const) !== 0 || + symbol.flags & SymbolFlags.Accessor && !(symbol.flags & SymbolFlags.SetAccessor) || + (symbol.flags & SymbolFlags.EnumMember) !== 0; + } - function isReferenceOrErrorExpression(n: Node): boolean { - // TypeScript 1.0 spec (April 2014): - // Expressions are classified as values or references. - // References are the subset of expressions that are permitted as the target of an assignment. - // Specifically, references are combinations of identifiers(section 4.3), parentheses(section 4.7), - // and property accesses(section 4.10). - // All other expression constructs described in this chapter are classified as values. - switch (n.kind) { - case SyntaxKind.Identifier: { - const symbol = findSymbol(n); - // TypeScript 1.0 spec (April 2014): 4.3 - // An identifier expression that references a variable or parameter is classified as a reference. - // An identifier expression that references any other kind of entity is classified as a value(and therefore cannot be the target of an assignment). - return !symbol || symbol === unknownSymbol || symbol === argumentsSymbol || (symbol.flags & SymbolFlags.Variable) !== 0; + function isReferenceToReadonlyEntity(expr: Expression, symbol: Symbol): boolean { + if (isReadonlySymbol(symbol)) { + // Allow assignments to readonly properties within constructors of the same class declaration. + if (symbol.flags & SymbolFlags.Property && + (expr.kind === SyntaxKind.PropertyAccessExpression || expr.kind === SyntaxKind.ElementAccessExpression) && + (expr as PropertyAccessExpression | ElementAccessExpression).expression.kind === SyntaxKind.ThisKeyword) { + const func = getContainingFunction(expr); + return !(func && func.kind === SyntaxKind.Constructor && func.parent === symbol.valueDeclaration.parent); + } + return true; + } + return false; + } + + function isReferenceThroughNamespaceImport(expr: Expression): boolean { + if (expr.kind === SyntaxKind.PropertyAccessExpression || expr.kind === SyntaxKind.ElementAccessExpression) { + const node = skipParenthesizedNodes((expr as PropertyAccessExpression | ElementAccessExpression).expression); + if (node.kind === SyntaxKind.Identifier) { + const symbol = getNodeLinks(node).resolvedSymbol; + if (symbol.flags & SymbolFlags.Alias) { + const declaration = getDeclarationOfAliasSymbol(symbol); + return declaration && declaration.kind === SyntaxKind.NamespaceImport; } - case SyntaxKind.PropertyAccessExpression: { - const symbol = findSymbol(n); - // TypeScript 1.0 spec (April 2014): 4.10 - // A property access expression is always classified as a reference. - // NOTE (not in spec): assignment to enum members should not be allowed - return !symbol || symbol === unknownSymbol || (symbol.flags & ~SymbolFlags.EnumMember) !== 0; - } - case SyntaxKind.ElementAccessExpression: - // old compiler doesn't check indexed access - return true; - case SyntaxKind.ParenthesizedExpression: - return isReferenceOrErrorExpression((n).expression); - default: - return false; } } + return false; + } - function isConstVariableReference(n: Node): boolean { - switch (n.kind) { - case SyntaxKind.Identifier: - case SyntaxKind.PropertyAccessExpression: { - const symbol = findSymbol(n); - return symbol && (symbol.flags & SymbolFlags.Variable) !== 0 && (getDeclarationFlagsFromSymbol(symbol) & NodeFlags.Const) !== 0; - } - case SyntaxKind.ElementAccessExpression: { - const index = (n).argumentExpression; - const symbol = findSymbol((n).expression); - if (symbol && index && index.kind === SyntaxKind.StringLiteral) { - const name = (index).text; - const prop = getPropertyOfType(getTypeOfSymbol(symbol), name); - return prop && (prop.flags & SymbolFlags.Variable) !== 0 && (getDeclarationFlagsFromSymbol(prop) & NodeFlags.Const) !== 0; - } + function checkReferenceExpression(expr: Expression, invalidReferenceMessage: DiagnosticMessage, constantVariableMessage: DiagnosticMessage): boolean { + // References are combinations of identifiers, parentheses, and property accesses. + const node = skipParenthesizedNodes(expr); + if (node.kind !== SyntaxKind.Identifier && node.kind !== SyntaxKind.PropertyAccessExpression && node.kind !== SyntaxKind.ElementAccessExpression) { + error(expr, invalidReferenceMessage); + return false; + } + // Because we get the symbol from the resolvedSymbol property, it might be of kind + // SymbolFlags.ExportValue. In this case it is necessary to get the actual export + // symbol, which will have the correct flags set on it. + const links = getNodeLinks(node); + const symbol = getExportSymbolOfValueSymbolIfExported(links.resolvedSymbol); + if (symbol) { + if (symbol !== unknownSymbol && symbol !== argumentsSymbol) { + // Only variables (and not functions, classes, namespaces, enum objects, or enum members) + // are considered references when referenced using a simple identifier. + if (node.kind === SyntaxKind.Identifier && !(symbol.flags & SymbolFlags.Variable)) { + error(expr, invalidReferenceMessage); return false; } - case SyntaxKind.ParenthesizedExpression: - return isConstVariableReference((n).expression); - default: + if (isReferenceToReadonlyEntity(node, symbol) || isReferenceThroughNamespaceImport(node)) { + error(expr, constantVariableMessage); return false; + } } } - - if (!isReferenceOrErrorExpression(n)) { - error(n, invalidReferenceMessage); - return false; + else if (node.kind === SyntaxKind.ElementAccessExpression) { + if (links.resolvedIndexInfo && links.resolvedIndexInfo.isReadonly) { + error(expr, constantVariableMessage); + return false; + } } - - if (isConstVariableReference(n)) { - error(n, constantVariableMessage); - return false; - } - return true; } @@ -10373,7 +11952,7 @@ namespace ts { function checkAwaitExpression(node: AwaitExpression): Type { // Grammar checking if (produceDiagnostics) { - if (!(node.parserContextFlags & ParserContextFlags.Await)) { + if (!(node.flags & NodeFlags.AwaitContext)) { grammarErrorOnFirstToken(node, Diagnostics.await_expression_is_only_allowed_within_an_async_function); } @@ -10392,7 +11971,7 @@ namespace ts { case SyntaxKind.PlusToken: case SyntaxKind.MinusToken: case SyntaxKind.TildeToken: - if (someConstituentTypeHasKind(operandType, TypeFlags.ESSymbol)) { + if (maybeTypeOfKind(operandType, TypeFlags.ESSymbol)) { error(node.operand, Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, tokenToString(node.operator)); } return numberType; @@ -10400,12 +11979,13 @@ namespace ts { return booleanType; case SyntaxKind.PlusPlusToken: case SyntaxKind.MinusMinusToken: - const ok = checkArithmeticOperandType(node.operand, operandType, Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); + const ok = checkArithmeticOperandType(node.operand, getNonNullableType(operandType), + Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); if (ok) { // run check only if former checks succeeded to avoid reporting cascading errors checkReferenceExpression(node.operand, Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer, - Diagnostics.The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant); + Diagnostics.The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant_or_a_read_only_property); } return numberType; } @@ -10414,48 +11994,58 @@ namespace ts { function checkPostfixUnaryExpression(node: PostfixUnaryExpression): Type { const operandType = checkExpression(node.operand); - const ok = checkArithmeticOperandType(node.operand, operandType, Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); + const ok = checkArithmeticOperandType(node.operand, getNonNullableType(operandType), + Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); if (ok) { // run check only if former checks succeeded to avoid reporting cascading errors checkReferenceExpression(node.operand, Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer, - Diagnostics.The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant); + Diagnostics.The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant_or_a_read_only_property); } return numberType; } - // Just like isTypeOfKind below, except that it returns true if *any* constituent - // has this kind. - function someConstituentTypeHasKind(type: Type, kind: TypeFlags): boolean { + // Return true if type might be of the given kind. A union or intersection type might be of a given + // kind if at least one constituent type is of the given kind. + function maybeTypeOfKind(type: Type, kind: TypeFlags): boolean { if (type.flags & kind) { return true; } if (type.flags & TypeFlags.UnionOrIntersection) { const types = (type).types; - for (const current of types) { - if (current.flags & kind) { + for (const t of types) { + if (maybeTypeOfKind(t, kind)) { return true; } } - return false; } return false; } - // Return true if type has the given flags, or is a union or intersection type composed of types that all have those flags. - function allConstituentTypesHaveKind(type: Type, kind: TypeFlags): boolean { + // Return true if type is of the given kind. A union type is of a given kind if all constituent types + // are of the given kind. An intersection type is of a given kind if at least one constituent type is + // of the given kind. + function isTypeOfKind(type: Type, kind: TypeFlags): boolean { if (type.flags & kind) { return true; } - if (type.flags & TypeFlags.UnionOrIntersection) { + if (type.flags & TypeFlags.Union) { const types = (type).types; - for (const current of types) { - if (!(current.flags & kind)) { + for (const t of types) { + if (!isTypeOfKind(t, kind)) { return false; } } return true; } + if (type.flags & TypeFlags.Intersection) { + const types = (type).types; + for (const t of types) { + if (isTypeOfKind(t, kind)) { + return true; + } + } + } return false; } @@ -10473,7 +12063,7 @@ namespace ts { // and the right operand to be of type Any or a subtype of the 'Function' interface type. // The result is always of the Boolean primitive type. // NOTE: do not raise error if leftType is unknown as related error was already reported - if (allConstituentTypesHaveKind(leftType, TypeFlags.Primitive)) { + if (isTypeOfKind(leftType, TypeFlags.Primitive)) { error(left, Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); } // NOTE: do not raise error if right is unknown as related error was already reported @@ -10500,39 +12090,43 @@ namespace ts { function checkObjectLiteralAssignment(node: ObjectLiteralExpression, sourceType: Type, contextualMapper?: TypeMapper): Type { const properties = node.properties; for (const p of properties) { - if (p.kind === SyntaxKind.PropertyAssignment || p.kind === SyntaxKind.ShorthandPropertyAssignment) { - const name = (p).name; - if (name.kind === SyntaxKind.ComputedPropertyName) { - checkComputedPropertyName(name); - } - if (isComputedNonLiteralName(name)) { - continue; - } + checkObjectLiteralDestructuringPropertyAssignment(sourceType, p, contextualMapper); + } + return sourceType; + } - const text = getTextOfPropertyName(name); - const type = isTypeAny(sourceType) - ? sourceType - : getTypeOfPropertyOfType(sourceType, text) || - isNumericLiteralName(text) && getIndexTypeOfType(sourceType, IndexKind.Number) || - getIndexTypeOfType(sourceType, IndexKind.String); - if (type) { - if (p.kind === SyntaxKind.ShorthandPropertyAssignment) { - checkDestructuringAssignment(p, type); - } - else { - // non-shorthand property assignments should always have initializers - checkDestructuringAssignment((p).initializer, type); - } + function checkObjectLiteralDestructuringPropertyAssignment(objectLiteralType: Type, property: ObjectLiteralElement, contextualMapper?: TypeMapper) { + if (property.kind === SyntaxKind.PropertyAssignment || property.kind === SyntaxKind.ShorthandPropertyAssignment) { + const name = (property).name; + if (name.kind === SyntaxKind.ComputedPropertyName) { + checkComputedPropertyName(name); + } + if (isComputedNonLiteralName(name)) { + return undefined; + } + + const text = getTextOfPropertyName(name); + const type = isTypeAny(objectLiteralType) + ? objectLiteralType + : getTypeOfPropertyOfType(objectLiteralType, text) || + isNumericLiteralName(text) && getIndexTypeOfType(objectLiteralType, IndexKind.Number) || + getIndexTypeOfType(objectLiteralType, IndexKind.String); + if (type) { + if (property.kind === SyntaxKind.ShorthandPropertyAssignment) { + return checkDestructuringAssignment(property, type); } else { - error(name, Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(sourceType), declarationNameToString(name)); + // non-shorthand property assignments should always have initializers + return checkDestructuringAssignment((property).initializer, type); } } else { - error(p, Diagnostics.Property_assignment_expected); + error(name, Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(objectLiteralType), declarationNameToString(name)); } } - return sourceType; + else { + error(property, Diagnostics.Property_assignment_expected); + } } function checkArrayLiteralAssignment(node: ArrayLiteralExpression, sourceType: Type, contextualMapper?: TypeMapper): Type { @@ -10542,44 +12136,51 @@ namespace ts { const elementType = checkIteratedTypeOrElementType(sourceType, node, /*allowStringInput*/ false) || unknownType; const elements = node.elements; for (let i = 0; i < elements.length; i++) { - const e = elements[i]; - if (e.kind !== SyntaxKind.OmittedExpression) { - if (e.kind !== SyntaxKind.SpreadElementExpression) { - const propName = "" + i; - const type = isTypeAny(sourceType) - ? sourceType - : isTupleLikeType(sourceType) - ? getTypeOfPropertyOfType(sourceType, propName) - : elementType; - if (type) { - checkDestructuringAssignment(e, type, contextualMapper); - } - else { - if (isTupleType(sourceType)) { - error(e, Diagnostics.Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2, typeToString(sourceType), (sourceType).elementTypes.length, elements.length); - } - else { - error(e, Diagnostics.Type_0_has_no_property_1, typeToString(sourceType), propName); - } - } + checkArrayLiteralDestructuringElementAssignment(node, sourceType, i, elementType, contextualMapper); + } + return sourceType; + } + + function checkArrayLiteralDestructuringElementAssignment(node: ArrayLiteralExpression, sourceType: Type, + elementIndex: number, elementType: Type, contextualMapper?: TypeMapper) { + const elements = node.elements; + const element = elements[elementIndex]; + if (element.kind !== SyntaxKind.OmittedExpression) { + if (element.kind !== SyntaxKind.SpreadElementExpression) { + const propName = "" + elementIndex; + const type = isTypeAny(sourceType) + ? sourceType + : isTupleLikeType(sourceType) + ? getTypeOfPropertyOfType(sourceType, propName) + : elementType; + if (type) { + return checkDestructuringAssignment(element, type, contextualMapper); } else { - if (i < elements.length - 1) { - error(e, Diagnostics.A_rest_element_must_be_last_in_an_array_destructuring_pattern); + if (isTupleType(sourceType)) { + error(element, Diagnostics.Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2, typeToString(sourceType), (sourceType).elementTypes.length, elements.length); } else { - const restExpression = (e).expression; - if (restExpression.kind === SyntaxKind.BinaryExpression && (restExpression).operatorToken.kind === SyntaxKind.EqualsToken) { - error((restExpression).operatorToken, Diagnostics.A_rest_element_cannot_have_an_initializer); - } - else { - checkDestructuringAssignment(restExpression, createArrayType(elementType), contextualMapper); - } + error(element, Diagnostics.Type_0_has_no_property_1, typeToString(sourceType), propName); + } + } + } + else { + if (elementIndex < elements.length - 1) { + error(element, Diagnostics.A_rest_element_must_be_last_in_an_array_destructuring_pattern); + } + else { + const restExpression = (element).expression; + if (restExpression.kind === SyntaxKind.BinaryExpression && (restExpression).operatorToken.kind === SyntaxKind.EqualsToken) { + error((restExpression).operatorToken, Diagnostics.A_rest_element_cannot_have_an_initializer); + } + else { + return checkDestructuringAssignment(restExpression, createArrayType(elementType), contextualMapper); } } } } - return sourceType; + return undefined; } function checkDestructuringAssignment(exprOrAssignment: Expression | ShorthandPropertyAssignment, sourceType: Type, contextualMapper?: TypeMapper): Type { @@ -10610,12 +12211,16 @@ namespace ts { function checkReferenceAssignment(target: Expression, sourceType: Type, contextualMapper?: TypeMapper): Type { const targetType = checkExpression(target, contextualMapper); - if (checkReferenceExpression(target, Diagnostics.Invalid_left_hand_side_of_assignment_expression, Diagnostics.Left_hand_side_of_assignment_expression_cannot_be_a_constant)) { + if (checkReferenceExpression(target, Diagnostics.Invalid_left_hand_side_of_assignment_expression, Diagnostics.Left_hand_side_of_assignment_expression_cannot_be_a_constant_or_a_read_only_property)) { checkTypeAssignableTo(sourceType, targetType, target, /*headMessage*/ undefined); } return sourceType; } + function isTypeEqualityComparableTo(source: Type, target: Type) { + return (target.flags & TypeFlags.Nullable) !== 0 || isTypeComparableTo(source, target); + } + function checkBinaryExpression(node: BinaryExpression, contextualMapper?: TypeMapper) { return checkBinaryLikeExpression(node.left, node.operatorToken, node.right, contextualMapper, node); } @@ -10656,8 +12261,11 @@ namespace ts { // as having the primitive type Number. If one operand is the null or undefined value, // it is treated as having the type of the other operand. // The result is always of the Number primitive type. - if (leftType.flags & (TypeFlags.Undefined | TypeFlags.Null)) leftType = rightType; - if (rightType.flags & (TypeFlags.Undefined | TypeFlags.Null)) rightType = leftType; + if (leftType.flags & TypeFlags.Nullable) leftType = rightType; + if (rightType.flags & TypeFlags.Nullable) rightType = leftType; + + leftType = getNonNullableType(leftType); + rightType = getNonNullableType(rightType); let suggestedOperator: SyntaxKind; // if a user tries to apply a bitwise operator to 2 boolean operands @@ -10684,17 +12292,20 @@ namespace ts { // or at least one of the operands to be of type Any or the String primitive type. // If one operand is the null or undefined value, it is treated as having the type of the other operand. - if (leftType.flags & (TypeFlags.Undefined | TypeFlags.Null)) leftType = rightType; - if (rightType.flags & (TypeFlags.Undefined | TypeFlags.Null)) rightType = leftType; + if (leftType.flags & TypeFlags.Nullable) leftType = rightType; + if (rightType.flags & TypeFlags.Nullable) rightType = leftType; + + leftType = getNonNullableType(leftType); + rightType = getNonNullableType(rightType); let resultType: Type; - if (allConstituentTypesHaveKind(leftType, TypeFlags.NumberLike) && allConstituentTypesHaveKind(rightType, TypeFlags.NumberLike)) { + if (isTypeOfKind(leftType, TypeFlags.NumberLike) && isTypeOfKind(rightType, TypeFlags.NumberLike)) { // Operands of an enum type are treated as having the primitive type Number. // If both operands are of the Number primitive type, the result is of the Number primitive type. resultType = numberType; } else { - if (allConstituentTypesHaveKind(leftType, TypeFlags.StringLike) || allConstituentTypesHaveKind(rightType, TypeFlags.StringLike)) { + if (isTypeOfKind(leftType, TypeFlags.StringLike) || isTypeOfKind(rightType, TypeFlags.StringLike)) { // If one or both operands are of the String primitive type, the result is of the String primitive type. resultType = stringType; } @@ -10723,19 +12334,17 @@ namespace ts { case SyntaxKind.GreaterThanToken: case SyntaxKind.LessThanEqualsToken: case SyntaxKind.GreaterThanEqualsToken: - if (!checkForDisallowedESSymbolOperand(operator)) { - return booleanType; + if (checkForDisallowedESSymbolOperand(operator)) { + if (!isTypeComparableTo(leftType, rightType) && !isTypeComparableTo(rightType, leftType)) { + reportOperatorError(); + } } - // Fall through + return booleanType; case SyntaxKind.EqualsEqualsToken: case SyntaxKind.ExclamationEqualsToken: case SyntaxKind.EqualsEqualsEqualsToken: case SyntaxKind.ExclamationEqualsEqualsToken: - // Permit 'number[] | "foo"' to be asserted to 'string'. - if (someConstituentTypeHasKind(leftType, TypeFlags.StringLike) && someConstituentTypeHasKind(rightType, TypeFlags.StringLike)) { - return booleanType; - } - if (!isTypeAssignableTo(leftType, rightType) && !isTypeAssignableTo(rightType, leftType)) { + if (!isTypeEqualityComparableTo(leftType, rightType) && !isTypeEqualityComparableTo(rightType, leftType)) { reportOperatorError(); } return booleanType; @@ -10744,9 +12353,9 @@ namespace ts { case SyntaxKind.InKeyword: return checkInExpression(left, right, leftType, rightType); case SyntaxKind.AmpersandAmpersandToken: - return rightType; + return addNullableKind(rightType, getNullableKind(leftType)); case SyntaxKind.BarBarToken: - return getUnionType([leftType, rightType]); + return getUnionType([getNonNullableType(leftType), rightType]); case SyntaxKind.EqualsToken: checkAssignmentOperator(rightType); return getRegularTypeOfObjectLiteral(rightType); @@ -10757,8 +12366,8 @@ namespace ts { // Return true if there was no error, false if there was an error. function checkForDisallowedESSymbolOperand(operator: SyntaxKind): boolean { const offendingSymbolOperand = - someConstituentTypeHasKind(leftType, TypeFlags.ESSymbol) ? left : - someConstituentTypeHasKind(rightType, TypeFlags.ESSymbol) ? right : + maybeTypeOfKind(leftType, TypeFlags.ESSymbol) ? left : + maybeTypeOfKind(rightType, TypeFlags.ESSymbol) ? right : undefined; if (offendingSymbolOperand) { error(offendingSymbolOperand, Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, tokenToString(operator)); @@ -10792,7 +12401,9 @@ namespace ts { // requires VarExpr to be classified as a reference // A compound assignment furthermore requires VarExpr to be classified as a reference (section 4.1) // and the type of the non - compound operation to be assignable to the type of VarExpr. - const ok = checkReferenceExpression(left, Diagnostics.Invalid_left_hand_side_of_assignment_expression, Diagnostics.Left_hand_side_of_assignment_expression_cannot_be_a_constant); + const ok = checkReferenceExpression(left, + Diagnostics.Invalid_left_hand_side_of_assignment_expression, + Diagnostics.Left_hand_side_of_assignment_expression_cannot_be_a_constant_or_a_read_only_property); // Use default messages if (ok) { // to avoid cascading errors check assignability only if 'isReference' check succeeded and no errors were reported @@ -10827,7 +12438,7 @@ namespace ts { function checkYieldExpression(node: YieldExpression): Type { // Grammar checking if (produceDiagnostics) { - if (!(node.parserContextFlags & ParserContextFlags.Yield) || isYieldExpressionInClass(node)) { + if (!(node.flags & NodeFlags.YieldContext) || isYieldExpressionInClass(node)) { grammarErrorOnFirstToken(node, Diagnostics.A_yield_expression_is_only_allowed_in_a_generator_body); } @@ -10906,7 +12517,13 @@ namespace ts { function checkExpressionCached(node: Expression, contextualMapper?: TypeMapper): Type { const links = getNodeLinks(node); if (!links.resolvedType) { + // When computing a type that we're going to cache, we need to ignore any ongoing control flow + // analysis because variables may have transient types in indeterminable states. Moving flowLoopStart + // to the top of the stack ensures all transient types are computed from a known point. + const saveFlowLoopStart = flowLoopStart; + flowLoopStart = flowLoopCount; links.resolvedType = checkExpression(node, contextualMapper); + flowLoopStart = saveFlowLoopStart; } return links.resolvedType; } @@ -10956,7 +12573,7 @@ namespace ts { // Checks an expression and returns its type. The contextualMapper parameter serves two purposes: When // contextualMapper is not undefined and not equal to the identityMapper function object it indicates that the - // expression is being inferentially typed (section 4.12.2 in spec) and provides the type mapper to use in + // expression is being inferentially typed (section 4.15.2 in spec) and provides the type mapper to use in // conjunction with the generic contextual type. When contextualMapper is equal to the identityMapper function // object, it serves as an indicator that all contained function and arrow expressions should be considered to // have the wildcard function type; this form of type check is used during overload resolution to exclude @@ -11042,6 +12659,8 @@ namespace ts { case SyntaxKind.TypeAssertionExpression: case SyntaxKind.AsExpression: return checkAssertion(node); + case SyntaxKind.NonNullExpression: + return checkNonNullAssertion(node); case SyntaxKind.DeleteExpression: return checkDeleteExpression(node); case SyntaxKind.VoidExpression: @@ -11100,7 +12719,7 @@ namespace ts { checkVariableLikeDeclaration(node); let func = getContainingFunction(node); - if (node.flags & NodeFlags.AccessibilityModifier) { + if (node.flags & NodeFlags.ParameterPropertyModifier) { func = getContainingFunction(node); if (!(func.kind === SyntaxKind.Constructor && nodeIsPresent(func.body))) { error(node, Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); @@ -11109,6 +12728,14 @@ namespace ts { if (node.questionToken && isBindingPattern(node.name) && func.body) { error(node, Diagnostics.A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature); } + if ((node.name).text === "this") { + if (indexOf(func.parameters, node) !== 0) { + error(node, Diagnostics.A_this_parameter_must_be_the_first_parameter); + } + if (func.kind === SyntaxKind.Constructor || func.kind === SyntaxKind.ConstructSignature || func.kind === SyntaxKind.ConstructorType) { + error(node, Diagnostics.A_constructor_cannot_have_a_this_parameter); + } + } // Only check rest parameter type if it's not a binding pattern. Since binding patterns are // not allowed in a rest parameter, we already have an error from checkGrammarParameterList. @@ -11141,7 +12768,55 @@ namespace ts { return -1; } - function isInLegalParameterTypePredicatePosition(node: Node): boolean { + function checkTypePredicate(node: TypePredicateNode): void { + const parent = getTypePredicateParent(node); + if (!parent) { + // The parent must not be valid. + error(node, Diagnostics.A_type_predicate_is_only_allowed_in_return_type_position_for_functions_and_methods); + return; + } + + const typePredicate = getSignatureFromDeclaration(parent).typePredicate; + if (!typePredicate) { + return; + } + + const { parameterName } = node; + if (isThisTypePredicate(typePredicate)) { + getTypeFromThisTypeNode(parameterName as ThisTypeNode); + } + else { + if (typePredicate.parameterIndex >= 0) { + if (parent.parameters[typePredicate.parameterIndex].dotDotDotToken) { + error(parameterName, + Diagnostics.A_type_predicate_cannot_reference_a_rest_parameter); + } + else { + const leadingError = chainDiagnosticMessages(undefined, Diagnostics.A_type_predicate_s_type_must_be_assignable_to_its_parameter_s_type); + checkTypeAssignableTo(typePredicate.type, + getTypeOfNode(parent.parameters[typePredicate.parameterIndex]), + node.type, + /*headMessage*/ undefined, + leadingError); + } + } + else if (parameterName) { + let hasReportedError = false; + for (const { name } of parent.parameters) { + if (isBindingPattern(name) && + checkIfTypePredicateVariableIsDeclaredInBindingPattern(name, parameterName, typePredicate.parameterName)) { + hasReportedError = true; + break; + } + } + if (!hasReportedError) { + error(node.parameterName, Diagnostics.Cannot_find_parameter_0, typePredicate.parameterName); + } + } + } + } + + function getTypePredicateParent(node: Node): SignatureDeclaration { switch (node.parent.kind) { case SyntaxKind.ArrowFunction: case SyntaxKind.CallSignature: @@ -11150,22 +12825,35 @@ namespace ts { case SyntaxKind.FunctionType: case SyntaxKind.MethodDeclaration: case SyntaxKind.MethodSignature: - return node === (node.parent).type; + const parent = node.parent; + if (node === parent.type) { + return parent; + } } - return false; } - function isInLegalThisTypePredicatePosition(node: Node): boolean { - if (isInLegalParameterTypePredicatePosition(node)) { - return true; + function checkIfTypePredicateVariableIsDeclaredInBindingPattern( + pattern: BindingPattern, + predicateVariableNode: Node, + predicateVariableName: string) { + for (const { name } of pattern.elements) { + if (name.kind === SyntaxKind.Identifier && + (name).text === predicateVariableName) { + error(predicateVariableNode, + Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, + predicateVariableName); + return true; + } + else if (name.kind === SyntaxKind.ArrayBindingPattern || + name.kind === SyntaxKind.ObjectBindingPattern) { + if (checkIfTypePredicateVariableIsDeclaredInBindingPattern( + name, + predicateVariableNode, + predicateVariableName)) { + return true; + } + } } - switch (node.parent.kind) { - case SyntaxKind.PropertyDeclaration: - case SyntaxKind.PropertySignature: - case SyntaxKind.GetAccessor: - return node === (node.parent as (PropertyDeclaration | GetAccessorDeclaration | PropertySignature)).type; - } - return false; } function checkSignatureDeclaration(node: SignatureDeclaration) { @@ -11185,66 +12873,7 @@ namespace ts { forEach(node.parameters, checkParameter); if (node.type) { - if (node.type.kind === SyntaxKind.TypePredicate) { - const returnType = getReturnTypeOfSignature(getSignatureFromDeclaration(node)); - if (!returnType || !(returnType.flags & TypeFlags.PredicateType)) { - return; - } - const typePredicate = (returnType as PredicateType).predicate; - const typePredicateNode = node.type as TypePredicateNode; - checkSourceElement(typePredicateNode); - if (isIdentifierTypePredicate(typePredicate)) { - if (typePredicate.parameterIndex >= 0) { - if (node.parameters[typePredicate.parameterIndex].dotDotDotToken) { - error(typePredicateNode.parameterName, - Diagnostics.A_type_predicate_cannot_reference_a_rest_parameter); - } - else { - checkTypeAssignableTo(typePredicate.type, - getTypeOfNode(node.parameters[typePredicate.parameterIndex]), - typePredicateNode.type); - } - } - else if (typePredicateNode.parameterName) { - let hasReportedError = false; - for (var param of node.parameters) { - if (hasReportedError) { - break; - } - if (param.name.kind === SyntaxKind.ObjectBindingPattern || - param.name.kind === SyntaxKind.ArrayBindingPattern) { - - (function checkBindingPattern(pattern: BindingPattern) { - for (const element of pattern.elements) { - if (element.name.kind === SyntaxKind.Identifier && - (element.name).text === typePredicate.parameterName) { - - error(typePredicateNode.parameterName, - Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, - typePredicate.parameterName); - hasReportedError = true; - break; - } - else if (element.name.kind === SyntaxKind.ArrayBindingPattern || - element.name.kind === SyntaxKind.ObjectBindingPattern) { - - checkBindingPattern(element.name); - } - } - })(param.name); - } - } - if (!hasReportedError) { - error(typePredicateNode.parameterName, - Diagnostics.Cannot_find_parameter_0, - typePredicate.parameterName); - } - } - } - } - else { - checkSourceElement(node.type); - } + checkSourceElement(node.type); } if (produceDiagnostics) { @@ -11279,10 +12908,11 @@ namespace ts { checkTypeAssignableTo(iterableIteratorInstantiation, returnType, node.type); } } + else if (isAsyncFunctionLike(node)) { + checkAsyncFunctionReturnType(node); + } } } - - checkSpecializedSignatureDeclaration(node); } function checkTypeForDuplicateIndexSignatures(node: Node) { @@ -11352,7 +12982,7 @@ namespace ts { function checkConstructorDeclaration(node: ConstructorDeclaration) { // Grammar check on signature of constructor and modifier of the constructor is done in checkSignatureDeclaration function. checkSignatureDeclaration(node); - // Grammar check for checking only related to constructoDeclaration + // Grammar check for checking only related to constructorDeclaration checkGrammarConstructorTypeParameters(node) || checkGrammarConstructorTypeAnnotation(node); checkSourceElement(node.body); @@ -11374,10 +13004,6 @@ namespace ts { return; } - function isSuperCallExpression(n: Node): boolean { - return n.kind === SyntaxKind.CallExpression && (n).expression.kind === SyntaxKind.SuperKeyword; - } - function containsSuperCallAsComputedPropertyName(n: Declaration): boolean { return n.name && containsSuperCall(n.name); } @@ -11415,13 +13041,11 @@ namespace ts { // constructors of derived classes must contain at least one super call somewhere in their function body. const containingClassDecl = node.parent; if (getClassExtendsHeritageClauseElement(containingClassDecl)) { - const containingClassSymbol = getSymbolOfNode(containingClassDecl); - const containingClassInstanceType = getDeclaredTypeOfSymbol(containingClassSymbol); - const baseConstructorType = getBaseConstructorTypeOfClass(containingClassInstanceType); - - if (containsSuperCall(node.body)) { - if (baseConstructorType === nullType) { - error(node, Diagnostics.A_constructor_cannot_contain_a_super_call_when_its_class_extends_null); + const classExtendsNull = classDeclarationExtendsNull(containingClassDecl); + const superCall = getSuperCallInConstructor(node); + if (superCall) { + if (classExtendsNull) { + error(superCall, Diagnostics.A_constructor_cannot_contain_a_super_call_when_its_class_extends_null); } // The first statement in the body of a constructor (excluding prologue directives) must be a super call @@ -11431,13 +13055,14 @@ namespace ts { // or the containing class declares instance member variables with initializers. const superCallShouldBeFirst = forEach((node.parent).members, isInstancePropertyWithInitializer) || - forEach(node.parameters, p => p.flags & (NodeFlags.Public | NodeFlags.Private | NodeFlags.Protected)); + forEach(node.parameters, p => p.flags & NodeFlags.ParameterPropertyModifier); // Skip past any prologue directives to find the first statement // to ensure that it was a super call. if (superCallShouldBeFirst) { const statements = (node.body).statements; let superCallStatement: ExpressionStatement; + for (const statement of statements) { if (statement.kind === SyntaxKind.ExpressionStatement && isSuperCallExpression((statement).expression)) { superCallStatement = statement; @@ -11450,13 +13075,9 @@ namespace ts { if (!superCallStatement) { error(node, Diagnostics.A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties); } - else { - // In such a required super call, it is a compile-time error for argument expressions to reference this. - markThisReferencesAsErrors(superCallStatement.expression); - } } } - else if (baseConstructorType !== nullType) { + else if (!classExtendsNull) { error(node, Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call); } } @@ -11496,16 +13117,14 @@ namespace ts { if (((node.flags & NodeFlags.AccessibilityModifier) !== (otherAccessor.flags & NodeFlags.AccessibilityModifier))) { error(node.name, Diagnostics.Getter_and_setter_accessors_do_not_agree_in_visibility); } + if (((node.flags & NodeFlags.Abstract) !== (otherAccessor.flags & NodeFlags.Abstract))) { + error(node.name, Diagnostics.Accessors_must_both_be_abstract_or_non_abstract); + } - const currentAccessorType = getAnnotatedAccessorType(node); - const otherAccessorType = getAnnotatedAccessorType(otherAccessor); // TypeScript 1.0 spec (April 2014): 4.5 // If both accessors include type annotations, the specified types must be identical. - if (currentAccessorType && otherAccessorType) { - if (!isTypeIdenticalTo(currentAccessorType, otherAccessorType)) { - error(node, Diagnostics.get_and_set_accessor_must_have_the_same_type); - } - } + checkAccessorDeclarationTypesIdentical(node, otherAccessor, getAnnotatedAccessorType, Diagnostics.get_and_set_accessor_must_have_the_same_type); + checkAccessorDeclarationTypesIdentical(node, otherAccessor, getAnnotatedAccessorThisType, Diagnostics.get_and_set_accessor_must_have_the_same_this_type); } } getTypeOfAccessors(getSymbolOfNode(node)); @@ -11518,6 +13137,14 @@ namespace ts { } } + function checkAccessorDeclarationTypesIdentical(first: AccessorDeclaration, second: AccessorDeclaration, getAnnotatedType: (a: AccessorDeclaration) => Type, message: DiagnosticMessage) { + const firstType = getAnnotatedType(first); + const secondType = getAnnotatedType(second); + if (firstType && secondType && !isTypeIdenticalTo(firstType, secondType)) { + error(first, message); + } + } + function checkAccessorDeferred(node: AccessorDeclaration) { checkSourceElement(node.body); } @@ -11597,48 +13224,6 @@ namespace ts { return (node.flags & NodeFlags.Private) && isInAmbientContext(node); } - function checkSpecializedSignatureDeclaration(signatureDeclarationNode: SignatureDeclaration): void { - if (!produceDiagnostics) { - return; - } - const signature = getSignatureFromDeclaration(signatureDeclarationNode); - if (!signature.hasStringLiterals) { - return; - } - - // TypeScript 1.0 spec (April 2014): 3.7.2.2 - // Specialized signatures are not permitted in conjunction with a function body - if (nodeIsPresent((signatureDeclarationNode).body)) { - error(signatureDeclarationNode, Diagnostics.A_signature_with_an_implementation_cannot_use_a_string_literal_type); - return; - } - - // TypeScript 1.0 spec (April 2014): 3.7.2.4 - // Every specialized call or construct signature in an object type must be assignable - // to at least one non-specialized call or construct signature in the same object type - let signaturesToCheck: Signature[]; - // Unnamed (call\construct) signatures in interfaces are inherited and not shadowed so examining just node symbol won't give complete answer. - // Use declaring type to obtain full list of signatures. - if (!signatureDeclarationNode.name && signatureDeclarationNode.parent && signatureDeclarationNode.parent.kind === SyntaxKind.InterfaceDeclaration) { - Debug.assert(signatureDeclarationNode.kind === SyntaxKind.CallSignature || signatureDeclarationNode.kind === SyntaxKind.ConstructSignature); - const signatureKind = signatureDeclarationNode.kind === SyntaxKind.CallSignature ? SignatureKind.Call : SignatureKind.Construct; - const containingSymbol = getSymbolOfNode(signatureDeclarationNode.parent); - const containingType = getDeclaredTypeOfSymbol(containingSymbol); - signaturesToCheck = getSignaturesOfType(containingType, signatureKind); - } - else { - signaturesToCheck = getSignaturesOfSymbol(getSymbolOfNode(signatureDeclarationNode)); - } - - for (const otherSignature of signaturesToCheck) { - if (!otherSignature.hasStringLiterals && isSignatureAssignableTo(signature, otherSignature, /*ignoreReturnTypes*/ false)) { - return; - } - } - - error(signatureDeclarationNode, Diagnostics.Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature); - } - function getEffectiveDeclarationFlags(n: Node, flagsToCheck: NodeFlags): NodeFlags { let flags = getCombinedNodeFlags(n); @@ -11683,16 +13268,16 @@ namespace ts { forEach(overloads, o => { const deviation = getEffectiveDeclarationFlags(o, flagsToCheck) ^ canonicalFlags; if (deviation & NodeFlags.Export) { - error(o.name, Diagnostics.Overload_signatures_must_all_be_exported_or_not_exported); + error(o.name, Diagnostics.Overload_signatures_must_all_be_exported_or_non_exported); } else if (deviation & NodeFlags.Ambient) { error(o.name, Diagnostics.Overload_signatures_must_all_be_ambient_or_non_ambient); } else if (deviation & (NodeFlags.Private | NodeFlags.Protected)) { - error(o.name, Diagnostics.Overload_signatures_must_all_be_public_private_or_protected); + error(o.name || o, Diagnostics.Overload_signatures_must_all_be_public_private_or_protected); } else if (deviation & NodeFlags.Abstract) { - error(o.name, Diagnostics.Overload_signatures_must_all_be_abstract_or_not_abstract); + error(o.name, Diagnostics.Overload_signatures_must_all_be_abstract_or_non_abstract); } }); } @@ -11737,7 +13322,7 @@ namespace ts { seen = c === node; } }); - // We may be here because of some extra junk between overloads that could not be parsed into a valid node. + // We may be here because of some extra nodes between overloads that could not be parsed into a valid node. // In this case the subsequent node is not really consecutive (.pos !== node.end), and we must ignore it here. if (subsequentNode && subsequentNode.pos === node.end) { if (subsequentNode.kind === node.kind) { @@ -11849,7 +13434,7 @@ namespace ts { // Abstract methods can't have an implementation -- in particular, they don't need one. if (!isExportSymbolInsideModule && lastSeenNonAmbientDeclaration && !lastSeenNonAmbientDeclaration.body && - !(lastSeenNonAmbientDeclaration.flags & NodeFlags.Abstract)) { + !(lastSeenNonAmbientDeclaration.flags & NodeFlags.Abstract) && !lastSeenNonAmbientDeclaration.questionToken) { reportImplementationExpectedError(lastSeenNonAmbientDeclaration); } @@ -11860,28 +13445,10 @@ namespace ts { if (bodyDeclaration) { const signatures = getSignaturesOfSymbol(symbol); const bodySignature = getSignatureFromDeclaration(bodyDeclaration); - // If the implementation signature has string literals, we will have reported an error in - // checkSpecializedSignatureDeclaration - if (!bodySignature.hasStringLiterals) { - // TypeScript 1.0 spec (April 2014): 6.1 - // If a function declaration includes overloads, the overloads determine the call - // signatures of the type given to the function object - // and the function implementation signature must be assignable to that type - // - // TypeScript 1.0 spec (April 2014): 3.8.4 - // Note that specialized call and construct signatures (section 3.7.2.4) are not significant when determining assignment compatibility - // Consider checking against specialized signatures too. Not doing so creates a type hole: - // - // function g(x: "hi", y: boolean); - // function g(x: string, y: {}); - // function g(x: string, y: string) { } - // - // The implementation is completely unrelated to the specialized signature, yet we do not check this. - for (const signature of signatures) { - if (!signature.hasStringLiterals && !isImplementationCompatibleWithOverload(bodySignature, signature)) { - error(signature.declaration, Diagnostics.Overload_signature_is_not_compatible_with_function_implementation); - break; - } + for (const signature of signatures) { + if (!isImplementationCompatibleWithOverload(bodySignature, signature)) { + error(signature.declaration, Diagnostics.Overload_signature_is_not_compatible_with_function_implementation); + break; } } } @@ -11932,7 +13499,7 @@ namespace ts { } } - // Spaces for anyting not declared a 'default export'. + // Spaces for anything not declared a 'default export'. const nonDefaultExportedDeclarationSpaces = exportedDeclarationSpaces | nonExportedDeclarationSpaces; const commonDeclarationSpacesForExportsAndLocals = exportedDeclarationSpaces & nonExportedDeclarationSpaces; @@ -11943,7 +13510,7 @@ namespace ts { for (const d of symbol.declarations) { const declarationSpaces = getDeclarationSpaces(d); - // Only error on the declarations that conributed to the intersecting spaces. + // Only error on the declarations that contributed to the intersecting spaces. if (declarationSpaces & commonDeclarationSpacesForDefaultAndNonDefault) { error(d.name, Diagnostics.Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead, declarationNameToString(d.name)); } @@ -11958,7 +13525,7 @@ namespace ts { case SyntaxKind.InterfaceDeclaration: return SymbolFlags.ExportType; case SyntaxKind.ModuleDeclaration: - return (d).name.kind === SyntaxKind.StringLiteral || getModuleInstanceState(d) !== ModuleInstanceState.NonInstantiated + return isAmbientModule(d) || getModuleInstanceState(d) !== ModuleInstanceState.NonInstantiated ? SymbolFlags.ExportNamespace | SymbolFlags.ExportValue : SymbolFlags.ExportNamespace; case SyntaxKind.ClassDeclaration: @@ -12031,7 +13598,7 @@ namespace ts { return undefined; } - const onfulfilledParameterType = getUnionType(map(thenSignatures, getTypeOfFirstParameterOfSignature)); + const onfulfilledParameterType = getTypeWithFacts(getUnionType(map(thenSignatures, getTypeOfFirstParameterOfSignature)), TypeFacts.NEUndefined); if (onfulfilledParameterType.flags & TypeFlags.Any) { return undefined; } @@ -12093,7 +13660,7 @@ namespace ts { return checkNonThenableType(type, location, message); } else { - if (type.id === promisedType.id || awaitedTypeStack.indexOf(promisedType.id) >= 0) { + if (type.id === promisedType.id || indexOf(awaitedTypeStack, promisedType.id) >= 0) { // We have a bad actor in the form of a promise whose promised type is // the same promise type, or a mutually recursive promise. Return the // unknown type as we cannot guess the shape. If this were the actual @@ -12148,6 +13715,36 @@ namespace ts { } } + /** + * Checks that the return type provided is an instantiation of the global Promise type + * and returns the awaited type of the return type. + * + * @param returnType The return type of a FunctionLikeDeclaration + * @param location The node on which to report the error. + */ + function checkCorrectPromiseType(returnType: Type, location: Node) { + if (returnType === unknownType) { + // The return type already had some other error, so we ignore and return + // the unknown type. + return unknownType; + } + + const globalPromiseType = getGlobalPromiseType(); + if (globalPromiseType === emptyGenericType + || globalPromiseType === getTargetType(returnType)) { + // Either we couldn't resolve the global promise type, which would have already + // reported an error, or we could resolve it and the return type is a valid type + // reference to the global type. In either case, we return the awaited type for + // the return type. + return checkAwaitedType(returnType, location, Diagnostics.An_async_function_or_method_must_have_a_valid_awaitable_return_type); + } + + // The promise type was not a valid type reference to the global promise type, so we + // report an error and return the unknown type. + error(location, Diagnostics.The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type); + return unknownType; + } + /** * Checks the return type of an async function to ensure it is a compatible * Promise implementation. @@ -12162,6 +13759,11 @@ namespace ts { * callable `then` signature. */ function checkAsyncFunctionReturnType(node: FunctionLikeDeclaration): Type { + if (languageVersion >= ScriptTarget.ES6) { + const returnType = getTypeFromTypeNode(node.type); + return checkCorrectPromiseType(returnType, node.type); + } + const globalPromiseConstructorLikeType = getGlobalPromiseConstructorLikeType(); if (globalPromiseConstructorLikeType === emptyObjectType) { // If we couldn't resolve the global PromiseConstructorLike type we cannot verify @@ -12340,7 +13942,7 @@ namespace ts { } if (!compilerOptions.experimentalDecorators) { - error(node, Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Specify_experimentalDecorators_to_remove_this_warning); + error(node, Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning); } if (compilerOptions.emitDecoratorMetadata) { @@ -12367,11 +13969,6 @@ namespace ts { } } - emitDecorate = true; - if (node.kind === SyntaxKind.Parameter) { - emitParam = true; - } - forEach(node.decorators, checkDecorator); } @@ -12382,6 +13979,7 @@ namespace ts { checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); + checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); } } @@ -12389,9 +13987,6 @@ namespace ts { checkDecorators(node); checkSignatureDeclaration(node); const isAsync = isAsyncFunctionLike(node); - if (isAsync) { - emitAwaiter = true; - } // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including @@ -12414,7 +14009,7 @@ namespace ts { // checkFunctionOrConstructorSymbol wouldn't be called if we didnt ignore javascript function. const firstDeclaration = forEach(localSymbol.declarations, // Get first non javascript function declaration - declaration => declaration.kind === node.kind && !isSourceFileJavaScript(getSourceFile(declaration)) ? + declaration => declaration.kind === node.kind && !isSourceFileJavaScript(getSourceFileOfNode(declaration)) ? declaration : undefined); // Only type check the symbol once @@ -12463,7 +14058,7 @@ namespace ts { function checkCollisionWithArgumentsInGeneratedCode(node: SignatureDeclaration) { // no rest parameters \ declaration context \ overload - no codegen impact - if (!hasRestParameter(node) || isInAmbientContext(node) || nodeIsMissing((node).body)) { + if (!hasDeclaredRestParameter(node) || isInAmbientContext(node) || nodeIsMissing((node).body)) { return; } @@ -12569,6 +14164,25 @@ namespace ts { } } + function checkCollisionWithGlobalPromiseInGeneratedCode(node: Node, name: Identifier): void { + if (!needCollisionCheckForIdentifier(node, name, "Promise")) { + return; + } + + // Uninstantiated modules shouldnt do this check + if (node.kind === SyntaxKind.ModuleDeclaration && getModuleInstanceState(node) !== ModuleInstanceState.Instantiated) { + return; + } + + // In case of variable declaration, node.parent is variable statement so look at the variable statement's parent + const parent = getDeclarationContainer(node); + if (parent.kind === SyntaxKind.SourceFile && isExternalOrCommonJsModule(parent) && parent.flags & NodeFlags.HasAsyncFunctions) { + // If the declaration happens to be in external module, report error that Promise is a reserved identifier. + error(name, Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions, + declarationNameToString(name), declarationNameToString(name)); + } + } + function checkVarDeclaredNamesNotShadowed(node: VariableDeclaration | BindingElement) { // - ScriptBody : StatementList // It is a Syntax Error if any element of the LexicallyDeclaredNames of StatementList @@ -12651,28 +14265,59 @@ namespace ts { const func = getContainingFunction(node); visit(node.initializer); - function visit(n: Node) { - if (n.kind === SyntaxKind.Identifier) { - const referencedSymbol = getNodeLinks(n).resolvedSymbol; + function visit(n: Node): void { + if (isTypeNode(n) || isDeclarationName(n)) { + // do not dive in types + // skip declaration names (i.e. in object literal expressions) + return; + } + if (n.kind === SyntaxKind.PropertyAccessExpression) { + // skip property names in property access expression + return visit((n).expression); + } + else if (n.kind === SyntaxKind.Identifier) { // check FunctionLikeDeclaration.locals (stores parameters\function local variable) - // if it contains entry with a specified name and if this entry matches the resolved symbol - if (referencedSymbol && referencedSymbol !== unknownSymbol && getSymbol(func.locals, referencedSymbol.name, SymbolFlags.Value) === referencedSymbol) { - if (referencedSymbol.valueDeclaration.kind === SyntaxKind.Parameter) { - if (referencedSymbol.valueDeclaration === node) { - error(n, Diagnostics.Parameter_0_cannot_be_referenced_in_its_initializer, declarationNameToString(node.name)); + // if it contains entry with a specified name + const symbol = resolveName(n, (n).text, SymbolFlags.Value | SymbolFlags.Alias, /*nameNotFoundMessage*/undefined, /*nameArg*/undefined); + if (!symbol || symbol === unknownSymbol || !symbol.valueDeclaration) { + return; + } + if (symbol.valueDeclaration === node) { + error(n, Diagnostics.Parameter_0_cannot_be_referenced_in_its_initializer, declarationNameToString(node.name)); + return; + } + // locals map for function contain both parameters and function locals + // so we need to do a bit of extra work to check if reference is legal + const enclosingContainer = getEnclosingBlockScopeContainer(symbol.valueDeclaration); + if (enclosingContainer === func) { + if (symbol.valueDeclaration.kind === SyntaxKind.Parameter) { + // it is ok to reference parameter in initializer if either + // - parameter is located strictly on the left of current parameter declaration + if (symbol.valueDeclaration.pos < node.pos) { return; } - if (referencedSymbol.valueDeclaration.pos < node.pos) { - // legal case - parameter initializer references some parameter strictly on left of current parameter declaration - return; + // - parameter is wrapped in function-like entity + let current = n; + while (current !== node.initializer) { + if (isFunctionLike(current.parent)) { + return; + } + // computed property names/initializers in instance property declaration of class like entities + // are executed in constructor and thus deferred + if (current.parent.kind === SyntaxKind.PropertyDeclaration && + !(current.parent.flags & NodeFlags.Static) && + isClassLike(current.parent.parent)) { + return; + } + current = current.parent; } - // fall through to error reporting + // fall through to report error } error(n, Diagnostics.Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it, declarationNameToString(node.name), declarationNameToString(n)); } } else { - forEachChild(n, visit); + return forEachChild(n, visit); } } } @@ -12697,6 +14342,15 @@ namespace ts { if (node.propertyName && node.propertyName.kind === SyntaxKind.ComputedPropertyName) { checkComputedPropertyName(node.propertyName); } + + // check private/protected variable access + const parent = (node.parent).parent; + const parentType = getTypeForBindingElementParent(parent); + const name = node.propertyName || node.name; + const property = getPropertyOfType(parentType, getTextOfPropertyName(name)); + if (parent.initializer && property && getParentOfSymbol(property)) { + checkClassPropertyAccess(parent, parent.initializer, parentType, property); + } } // For a binding pattern, check contained binding elements @@ -12710,7 +14364,8 @@ namespace ts { } // For a binding pattern, validate the initializer and exit if (isBindingPattern(node.name)) { - if (node.initializer) { + // Don't validate for-in initializer as it is already an error + if (node.initializer && node.parent.parent.kind !== SyntaxKind.ForInStatement) { checkTypeAssignableTo(checkExpressionCached(node.initializer), getWidenedTypeForVariableLikeDeclaration(node), node, /*headMessage*/ undefined); checkParameterInitializer(node); } @@ -12720,7 +14375,8 @@ namespace ts { const type = getTypeOfVariableOrParameterOrProperty(symbol); if (node === symbol.valueDeclaration) { // Node is the primary declaration of the symbol, just validate the initializer - if (node.initializer) { + // Don't validate for-in initializer as it is already an error + if (node.initializer && node.parent.parent.kind !== SyntaxKind.ForInStatement) { checkTypeAssignableTo(checkExpressionCached(node.initializer), type, node, /*headMessage*/ undefined); checkParameterInitializer(node); } @@ -12745,6 +14401,7 @@ namespace ts { checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); + checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); } } @@ -12863,7 +14520,7 @@ namespace ts { else { const leftType = checkExpression(varExpr); checkReferenceExpression(varExpr, /*invalidReferenceMessage*/ Diagnostics.Invalid_left_hand_side_in_for_of_statement, - /*constantVariableMessage*/ Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_be_a_previously_defined_constant); + /*constantVariableMessage*/ Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_be_a_constant_or_a_read_only_property); // iteratedType will be undefined if the rightType was missing properties/signatures // required to get its iteratedType (like [Symbol.iterator] or next). This may be @@ -12910,11 +14567,12 @@ namespace ts { } else { // run check only former check succeeded to avoid cascading errors - checkReferenceExpression(varExpr, Diagnostics.Invalid_left_hand_side_in_for_in_statement, Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_previously_defined_constant); + checkReferenceExpression(varExpr, Diagnostics.Invalid_left_hand_side_in_for_in_statement, + Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_constant_or_a_read_only_property); } } - const rightType = checkExpression(node.expression); + const rightType = checkNonNullExpression(node.expression); // unknownType is returned i.e. if node.expression is identifier whose name cannot be resolved // in this case error about missing name is already reported - do not report extra one if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, TypeFlags.ObjectType | TypeFlags.TypeParameter)) { @@ -12934,7 +14592,7 @@ namespace ts { } function checkRightHandSideOfForOf(rhsExpression: Expression): Type { - const expressionType = getTypeOfExpression(rhsExpression); + const expressionType = checkNonNullExpression(rhsExpression); return checkIteratedTypeOrElementType(expressionType, rhsExpression, /*allowStringInput*/ true); } @@ -12942,23 +14600,21 @@ namespace ts { if (isTypeAny(inputType)) { return inputType; } - if (languageVersion >= ScriptTarget.ES6) { return checkElementTypeOfIterable(inputType, errorNode); } - if (allowStringInput) { return checkElementTypeOfArrayOrString(inputType, errorNode); } - if (isArrayLikeType(inputType)) { const indexType = getIndexTypeOfType(inputType, IndexKind.Number); if (indexType) { return indexType; } } - - error(errorNode, Diagnostics.Type_0_is_not_an_array_type, typeToString(inputType)); + if (errorNode) { + error(errorNode, Diagnostics.Type_0_is_not_an_array_type, typeToString(inputType)); + } return unknownType; } @@ -13006,7 +14662,7 @@ namespace ts { if (!typeAsIterable.iterableElementType) { // As an optimization, if the type is instantiated directly using the globalIterableType (Iterable), // then just grab its type argument. - if ((type.flags & TypeFlags.Reference) && (type).target === globalIterableType) { + if ((type.flags & TypeFlags.Reference) && (type).target === getGlobalIterableType()) { typeAsIterable.iterableElementType = (type).typeArguments[0]; } else { @@ -13052,7 +14708,7 @@ namespace ts { if (!typeAsIterator.iteratorElementType) { // As an optimization, if the type is instantiated directly using the globalIteratorType (Iterator), // then just grab its type argument. - if ((type.flags & TypeFlags.Reference) && (type).target === globalIteratorType) { + if ((type.flags & TypeFlags.Reference) && (type).target === getGlobalIteratorType()) { typeAsIterator.iteratorElementType = (type).typeArguments[0]; } else { @@ -13096,7 +14752,7 @@ namespace ts { // As an optimization, if the type is instantiated directly using the globalIterableIteratorType (IterableIterator), // then just grab its type argument. - if ((type.flags & TypeFlags.Reference) && (type).target === globalIterableIteratorType) { + if ((type.flags & TypeFlags.Reference) && (type).target === getGlobalIterableIteratorType()) { return (type).typeArguments[0]; } @@ -13108,7 +14764,7 @@ namespace ts { * This function does the following steps: * 1. Break up arrayOrStringType (possibly a union) into its string constituents and array constituents. * 2. Take the element types of the array constituents. - * 3. Return the union of the element types, and string if there was a string constitutent. + * 3. Return the union of the element types, and string if there was a string constituent. * * For example: * string -> string @@ -13131,7 +14787,7 @@ namespace ts { arrayType = getUnionType(filter((arrayOrStringType as UnionType).types, t => !(t.flags & TypeFlags.StringLike))); } else if (arrayOrStringType.flags & TypeFlags.StringLike) { - arrayType = emptyUnionType; + arrayType = neverType; } const hasStringConstituent = arrayOrStringType !== arrayType; let reportedError = false; @@ -13143,7 +14799,7 @@ namespace ts { // Now that we've removed all the StringLike types, if no constituents remain, then the entire // arrayOrStringType was a string. - if (arrayType === emptyObjectType) { + if (arrayType === neverType) { return stringType; } } @@ -13182,10 +14838,15 @@ namespace ts { // TODO: Check that target label is valid } - function isGetAccessorWithAnnotatatedSetAccessor(node: FunctionLikeDeclaration) { + function isGetAccessorWithAnnotatedSetAccessor(node: FunctionLikeDeclaration) { return !!(node.kind === SyntaxKind.GetAccessor && getSetAccessorTypeAnnotationNode(getDeclarationOfKind(node.symbol, SyntaxKind.SetAccessor))); } + function isUnwrappedReturnTypeVoidOrAny(func: FunctionLikeDeclaration, returnType: Type): boolean { + const unwrappedReturnType = isAsyncFunctionLike(func) ? getPromisedType(returnType) : returnType; + return maybeTypeOfKind(unwrappedReturnType, TypeFlags.Void | TypeFlags.Any); + } + function checkReturnStatement(node: ReturnStatement) { // Grammar checking if (!checkGrammarStatementInAmbientContext(node)) { @@ -13195,12 +14856,12 @@ namespace ts { } } - if (node.expression) { - const func = getContainingFunction(node); - if (func) { - const signature = getSignatureFromDeclaration(func); - const returnType = getReturnTypeOfSignature(signature); - const exprType = checkExpressionCached(node.expression); + const func = getContainingFunction(node); + if (func) { + const signature = getSignatureFromDeclaration(func); + const returnType = getReturnTypeOfSignature(signature); + if (strictNullChecks || node.expression || returnType === neverType) { + const exprType = node.expression ? checkExpressionCached(node.expression) : undefinedType; if (func.asteriskToken) { // A generator does not need its return expressions checked against its return type. @@ -13211,36 +14872,42 @@ namespace ts { } if (func.kind === SyntaxKind.SetAccessor) { - error(node.expression, Diagnostics.Setters_cannot_return_a_value); + if (node.expression) { + error(node.expression, Diagnostics.Setters_cannot_return_a_value); + } } else if (func.kind === SyntaxKind.Constructor) { - if (!checkTypeAssignableTo(exprType, returnType, node.expression)) { + if (node.expression && !checkTypeAssignableTo(exprType, returnType, node.expression)) { error(node.expression, Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); } } - else if (func.type || isGetAccessorWithAnnotatatedSetAccessor(func) || returnType.flags & TypeFlags.PredicateType) { + else if (func.type || isGetAccessorWithAnnotatedSetAccessor(func)) { if (isAsyncFunctionLike(func)) { const promisedType = getPromisedType(returnType); - const awaitedType = checkAwaitedType(exprType, node.expression, Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member); + const awaitedType = checkAwaitedType(exprType, node.expression || node, Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member); if (promisedType) { // If the function has a return type, but promisedType is // undefined, an error will be reported in checkAsyncFunctionReturnType // so we don't need to report one here. - checkTypeAssignableTo(awaitedType, promisedType, node.expression); + checkTypeAssignableTo(awaitedType, promisedType, node.expression || node); } } else { - checkTypeAssignableTo(exprType, returnType, node.expression); + checkTypeAssignableTo(exprType, returnType, node.expression || node); } } } + else if (func.kind !== SyntaxKind.Constructor && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(func, returnType)) { + // The function has a return type, but the return statement doesn't have an expression. + error(node, Diagnostics.Not_all_code_paths_return_a_value); + } } } function checkWithStatement(node: WithStatement) { // Grammar checking for withStatement if (!checkGrammarStatementInAmbientContext(node)) { - if (node.parserContextFlags & ParserContextFlags.Await) { + if (node.flags & NodeFlags.AwaitContext) { grammarErrorOnFirstToken(node, Diagnostics.with_statements_are_not_allowed_in_an_async_function_block); } } @@ -13257,7 +14924,6 @@ namespace ts { let hasDuplicateDefaultClause = false; const expressionType = checkExpression(node.expression); - const expressionTypeIsStringLike = someConstituentTypeHasKind(expressionType, TypeFlags.StringLike); forEach(node.caseBlock.clauses, clause => { // Grammar check for duplicate default clauses, skip if we already report duplicate default clause if (clause.kind === SyntaxKind.DefaultClause && !hasDuplicateDefaultClause) { @@ -13275,18 +14941,13 @@ namespace ts { if (produceDiagnostics && clause.kind === SyntaxKind.CaseClause) { const caseClause = clause; - // TypeScript 1.0 spec (April 2014):5.9 - // In a 'switch' statement, each 'case' expression must be of a type that is assignable to or from the type of the 'switch' expression. + // TypeScript 1.0 spec (April 2014): 5.9 + // In a 'switch' statement, each 'case' expression must be of a type that is comparable + // to or from the type of the 'switch' expression. const caseType = checkExpression(caseClause.expression); - - const expressionTypeIsAssignableToCaseType = - // Permit 'number[] | "foo"' to be asserted to 'string'. - (expressionTypeIsStringLike && someConstituentTypeHasKind(caseType, TypeFlags.StringLike)) || - isTypeAssignableTo(expressionType, caseType); - - if (!expressionTypeIsAssignableToCaseType) { - // 'expressionType is not assignable to caseType', try the reversed check and report errors if it fails - checkTypeAssignableTo(caseType, expressionType, caseClause.expression, /*headMessage*/ undefined); + if (!isTypeComparableTo(expressionType, caseType)) { + // expressionType is not comparable to caseType, try the reversed check and report errors if it fails + checkTypeComparableTo(caseType, expressionType, caseClause.expression, /*headMessage*/ undefined); } } forEach(clause.statements, checkSourceElement); @@ -13467,7 +15128,7 @@ namespace ts { } } - // Check each type parameter and check that list has no duplicate type parameter declarations + /** Check each type parameter and check that type parameters have no duplicate type parameter declarations */ function checkTypeParameters(typeParameterDeclarations: TypeParameterDeclaration[]) { if (typeParameterDeclarations) { for (let i = 0, n = typeParameterDeclarations.length; i < n; i++) { @@ -13485,6 +15146,24 @@ namespace ts { } } + /** Check that type parameter lists are identical across multiple declarations */ + function checkTypeParameterListsIdentical(node: ClassLikeDeclaration | InterfaceDeclaration, symbol: Symbol) { + if (symbol.declarations.length === 1) { + return; + } + let firstDecl: ClassLikeDeclaration | InterfaceDeclaration; + for (const declaration of symbol.declarations) { + if (declaration.kind === SyntaxKind.ClassDeclaration || declaration.kind === SyntaxKind.InterfaceDeclaration) { + if (!firstDecl) { + firstDecl = declaration; + } + else if (!areTypeParametersIdentical(firstDecl.typeParameters, node.typeParameters)) { + error(node.name, Diagnostics.All_declarations_of_0_must_have_identical_type_parameters, node.name.text); + } + } + } + } + function checkClassExpression(node: ClassExpression): Type { checkClassLikeDeclaration(node); checkNodeDeferred(node); @@ -13510,6 +15189,7 @@ namespace ts { checkTypeNameIsReserved(node.name, Diagnostics.Class_name_cannot_be_0); checkCollisionWithCapturedThisVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); + checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); } checkTypeParameters(node.typeParameters); checkExportsOnMergedDeclarations(node); @@ -13517,14 +15197,15 @@ namespace ts { const type = getDeclaredTypeOfSymbol(symbol); const typeWithThis = getTypeWithThisArgument(type); const staticType = getTypeOfSymbol(symbol); + checkTypeParameterListsIdentical(node, symbol); const baseTypeNode = getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { - emitExtends = emitExtends || !isInAmbientContext(node); const baseTypes = getBaseTypes(type); if (baseTypes.length && produceDiagnostics) { const baseType = baseTypes[0]; const staticBaseType = getBaseConstructorTypeOfClass(type); + checkBaseTypeAccessibility(staticBaseType, baseTypeNode); checkSourceElement(baseTypeNode.expression); if (baseTypeNode.typeArguments) { forEach(baseTypeNode.typeArguments, checkSourceElement); @@ -13580,6 +15261,19 @@ namespace ts { } } + function checkBaseTypeAccessibility(type: ObjectType, node: ExpressionWithTypeArguments) { + const signatures = getSignaturesOfType(type, SignatureKind.Construct); + if (signatures.length) { + const declaration = signatures[0].declaration; + if (declaration && declaration.flags & NodeFlags.Private) { + const typeClassDeclaration = getClassLikeDeclarationOfSymbol(type.symbol); + if (!isNodeWithinClass(node, typeClassDeclaration)) { + error(node, Diagnostics.Cannot_extend_a_class_0_Class_constructor_is_marked_as_private, (node.expression).text); + } + } + } + } + function getTargetSymbol(s: Symbol) { // if symbol is instantiated its flags are not copied from the 'target' // so we'll need to get back original 'target' symbol to work with correct set of flags @@ -13621,7 +15315,7 @@ namespace ts { Debug.assert(!!derived, "derived should point to something, even if it is the base class' declaration."); if (derived) { - // In order to resolve whether the inherited method was overriden in the base class or not, + // In order to resolve whether the inherited method was overridden in the base class or not, // we compare the Symbols obtained. Since getTargetSymbol returns the symbol on the *uninstantiated* // type declaration, derived and base resolve to the same symbol even in the case of generic classes. if (derived === base) { @@ -13766,14 +15460,10 @@ namespace ts { checkExportsOnMergedDeclarations(node); const symbol = getSymbolOfNode(node); - const firstInterfaceDecl = getDeclarationOfKind(symbol, SyntaxKind.InterfaceDeclaration); - if (symbol.declarations.length > 1) { - if (node !== firstInterfaceDecl && !areTypeParametersIdentical(firstInterfaceDecl.typeParameters, node.typeParameters)) { - error(node.name, Diagnostics.All_declarations_of_an_interface_must_have_identical_type_parameters); - } - } + checkTypeParameterListsIdentical(node, symbol); // Only check this symbol once + const firstInterfaceDecl = getDeclarationOfKind(symbol, SyntaxKind.InterfaceDeclaration); if (node === firstInterfaceDecl) { const type = getDeclaredTypeOfSymbol(symbol); const typeWithThis = getTypeWithThisArgument(type); @@ -14017,6 +15707,7 @@ namespace ts { checkTypeNameIsReserved(node.name, Diagnostics.Enum_name_cannot_be_0); checkCollisionWithCapturedThisVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); + checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); checkExportsOnMergedDeclarations(node); computeEnumMemberValues(node); @@ -14098,7 +15789,13 @@ namespace ts { function checkModuleDeclaration(node: ModuleDeclaration) { if (produceDiagnostics) { // Grammar checking - const isAmbientExternalModule = node.name.kind === SyntaxKind.StringLiteral; + const isGlobalAugmentation = isGlobalScopeAugmentation(node); + const inAmbientContext = isInAmbientContext(node); + if (isGlobalAugmentation && !inAmbientContext) { + error(node.name, Diagnostics.Augmentations_for_the_global_scope_should_have_declare_modifier_unless_they_appear_in_already_ambient_context); + } + + const isAmbientExternalModule = isAmbientModule(node); const contextErrorMessage = isAmbientExternalModule ? Diagnostics.An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file : Diagnostics.A_namespace_declaration_is_only_allowed_in_a_namespace_or_module; @@ -14108,20 +15805,21 @@ namespace ts { } if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node)) { - if (!isInAmbientContext(node) && node.name.kind === SyntaxKind.StringLiteral) { + if (!inAmbientContext && node.name.kind === SyntaxKind.StringLiteral) { grammarErrorOnNode(node.name, Diagnostics.Only_ambient_modules_can_use_quoted_names); } } checkCollisionWithCapturedThisVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); + checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); checkExportsOnMergedDeclarations(node); const symbol = getSymbolOfNode(node); // The following checks only apply on a non-ambient instantiated module declaration. if (symbol.flags & SymbolFlags.ValueModule && symbol.declarations.length > 1 - && !isInAmbientContext(node) + && !inAmbientContext && isInstantiatedModule(node, compilerOptions.preserveConstEnums || compilerOptions.isolatedModules)) { const firstNonAmbientClassOrFunc = getFirstNonAmbientClassOrFunctionDeclaration(symbol); if (firstNonAmbientClassOrFunc) { @@ -14142,19 +15840,96 @@ namespace ts { } } - // Checks for ambient external modules. if (isAmbientExternalModule) { - if (!isGlobalSourceFile(node.parent)) { - error(node.name, Diagnostics.Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces); + if (isExternalModuleAugmentation(node)) { + // body of the augmentation should be checked for consistency only if augmentation was applied to its target (either global scope or module) + // otherwise we'll be swamped in cascading errors. + // We can detect if augmentation was applied using following rules: + // - augmentation for a global scope is always applied + // - augmentation for some external module is applied if symbol for augmentation is merged (it was combined with target module). + const checkBody = isGlobalAugmentation || (getSymbolOfNode(node).flags & SymbolFlags.Merged); + if (checkBody) { + // body of ambient external module is always a module block + for (const statement of (node.body).statements) { + checkModuleAugmentationElement(statement, isGlobalAugmentation); + } + } } - if (isExternalModuleNameRelative(node.name.text)) { - error(node.name, Diagnostics.Ambient_module_declaration_cannot_specify_relative_module_name); + else if (isGlobalSourceFile(node.parent)) { + if (isGlobalAugmentation) { + error(node.name, Diagnostics.Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_declarations); + } + else if (isExternalModuleNameRelative(node.name.text)) { + error(node.name, Diagnostics.Ambient_module_declaration_cannot_specify_relative_module_name); + } + } + else { + if (isGlobalAugmentation) { + error(node.name, Diagnostics.Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_declarations); + } + else { + // Node is not an augmentation and is not located on the script level. + // This means that this is declaration of ambient module that is located in other module or namespace which is prohibited. + error(node.name, Diagnostics.Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces); + } } } } checkSourceElement(node.body); } + function checkModuleAugmentationElement(node: Node, isGlobalAugmentation: boolean): void { + switch (node.kind) { + case SyntaxKind.VariableStatement: + // error each individual name in variable statement instead of marking the entire variable statement + for (const decl of (node).declarationList.declarations) { + checkModuleAugmentationElement(decl, isGlobalAugmentation); + } + break; + case SyntaxKind.ExportAssignment: + case SyntaxKind.ExportDeclaration: + grammarErrorOnFirstToken(node, Diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations); + break; + case SyntaxKind.ImportEqualsDeclaration: + case SyntaxKind.ImportDeclaration: + grammarErrorOnFirstToken(node, Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module); + break; + case SyntaxKind.BindingElement: + case SyntaxKind.VariableDeclaration: + const name = (node).name; + if (isBindingPattern(name)) { + for (const el of name.elements) { + // mark individual names in binding pattern + checkModuleAugmentationElement(el, isGlobalAugmentation); + } + break; + } + // fallthrough + case SyntaxKind.ClassDeclaration: + case SyntaxKind.EnumDeclaration: + case SyntaxKind.FunctionDeclaration: + case SyntaxKind.InterfaceDeclaration: + case SyntaxKind.ModuleDeclaration: + case SyntaxKind.TypeAliasDeclaration: + if (isGlobalAugmentation) { + return; + } + const symbol = getSymbolOfNode(node); + if (symbol) { + // module augmentations cannot introduce new names on the top level scope of the module + // this is done it two steps + // 1. quick check - if symbol for node is not merged - this is local symbol to this augmentation - report error + // 2. main check - report error if value declaration of the parent symbol is module augmentation) + let reportError = !(symbol.flags & SymbolFlags.Merged); + if (!reportError) { + // symbol should not originate in augmentation + reportError = isExternalModuleAugmentation(symbol.parent.declarations[0]); + } + } + break; + } + } + function getFirstIdentifier(node: EntityName | Expression): Identifier { while (true) { if (node.kind === SyntaxKind.QualifiedName) { @@ -14177,7 +15952,7 @@ namespace ts { error(moduleName, Diagnostics.String_literal_expected); return false; } - const inAmbientExternalModule = node.parent.kind === SyntaxKind.ModuleBlock && (node.parent.parent).name.kind === SyntaxKind.StringLiteral; + const inAmbientExternalModule = node.parent.kind === SyntaxKind.ModuleBlock && isAmbientModule(node.parent.parent); if (node.parent.kind !== SyntaxKind.SourceFile && !inAmbientExternalModule) { error(moduleName, node.kind === SyntaxKind.ExportDeclaration ? Diagnostics.Export_declarations_are_not_permitted_in_a_namespace : @@ -14185,12 +15960,16 @@ namespace ts { return false; } if (inAmbientExternalModule && isExternalModuleNameRelative((moduleName).text)) { - // TypeScript 1.0 spec (April 2013): 12.1.6 - // An ExternalImportDeclaration in an AmbientExternalModuleDeclaration may reference - // other external modules only through top - level external module names. - // Relative external module names are not permitted. - error(node, Diagnostics.Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relative_module_name); - return false; + // we have already reported errors on top level imports\exports in external module augmentations in checkModuleDeclaration + // no need to do this again. + if (!isTopLevelInExternalModuleAugmentation(node)) { + // TypeScript 1.0 spec (April 2013): 12.1.6 + // An ExternalImportDeclaration in an AmbientExternalModuleDeclaration may reference + // other external modules only through top - level external module names. + // Relative external module names are not permitted. + error(node, Diagnostics.Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relative_module_name); + return false; + } } return true; } @@ -14199,8 +15978,14 @@ namespace ts { const symbol = getSymbolOfNode(node); const target = resolveAlias(symbol); if (target !== unknownSymbol) { + // For external modules symbol represent local symbol for an alias. + // This local symbol will merge any other local declarations (excluding other aliases) + // and symbol.flags will contains combined representation for all merged declaration. + // Based on symbol.flags we can compute a set of excluded meanings (meaning that resolved alias should not have, + // otherwise it will conflict with some local declaration). Note that in addition to normal flags we include matching SymbolFlags.Export* + // in order to prevent collisions with declarations that were exported from the current module (they still contribute to local names). const excludedMeanings = - (symbol.flags & SymbolFlags.Value ? SymbolFlags.Value : 0) | + (symbol.flags & (SymbolFlags.Value | SymbolFlags.ExportValue) ? SymbolFlags.Value : 0) | (symbol.flags & SymbolFlags.Type ? SymbolFlags.Type : 0) | (symbol.flags & SymbolFlags.Namespace ? SymbolFlags.Namespace : 0); if (target.flags & excludedMeanings) { @@ -14215,6 +16000,7 @@ namespace ts { function checkImportBinding(node: ImportEqualsDeclaration | ImportClause | NamespaceImport | ImportSpecifier) { checkCollisionWithCapturedThisVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); + checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); checkAliasSymbol(node); } @@ -14296,7 +16082,7 @@ namespace ts { // export { x, y } from "foo" forEach(node.exportClause.elements, checkExportSpecifier); - const inAmbientExternalModule = node.parent.kind === SyntaxKind.ModuleBlock && (node.parent.parent).name.kind === SyntaxKind.StringLiteral; + const inAmbientExternalModule = node.parent.kind === SyntaxKind.ModuleBlock && isAmbientModule(node.parent.parent); if (node.parent.kind !== SyntaxKind.SourceFile && !inAmbientExternalModule) { error(node, Diagnostics.Export_declarations_are_not_permitted_in_a_namespace); } @@ -14304,7 +16090,7 @@ namespace ts { else { // export * from "foo" const moduleSymbol = resolveExternalModuleName(node, node.moduleSpecifier); - if (moduleSymbol && moduleSymbol.exports["export="]) { + if (moduleSymbol && hasExportAssignmentSymbol(moduleSymbol)) { error(node.moduleSpecifier, Diagnostics.Module_0_uses_export_and_cannot_be_used_with_export_Asterisk, symbolToString(moduleSymbol)); } } @@ -14320,7 +16106,16 @@ namespace ts { function checkExportSpecifier(node: ExportSpecifier) { checkAliasSymbol(node); if (!(node.parent.parent).moduleSpecifier) { - markExportAsReferenced(node); + const exportedName = node.propertyName || node.name; + // find immediate value referenced by exported name (SymbolFlags.Alias is set so we don't chase down aliases) + const symbol = resolveName(exportedName, exportedName.text, SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace | SymbolFlags.Alias, + /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined); + if (symbol && (symbol === undefinedSymbol || isGlobalSourceFile(getDeclarationContainer(symbol.declarations[0])))) { + error(exportedName, Diagnostics.Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module, exportedName.text); + } + else { + markExportAsReferenced(node); + } } } @@ -14331,7 +16126,7 @@ namespace ts { } const container = node.parent.kind === SyntaxKind.SourceFile ? node.parent : node.parent.parent; - if (container.kind === SyntaxKind.ModuleDeclaration && (container).name.kind === SyntaxKind.Identifier) { + if (container.kind === SyntaxKind.ModuleDeclaration && !isAmbientModule(container)) { error(node, Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); return; } @@ -14361,7 +16156,7 @@ namespace ts { } function hasExportedMembers(moduleSymbol: Symbol) { - for (var id in moduleSymbol.exports) { + for (const id in moduleSymbol.exports) { if (id !== "export=") { return true; } @@ -14376,7 +16171,9 @@ namespace ts { const exportEqualsSymbol = moduleSymbol.exports["export="]; if (exportEqualsSymbol && hasExportedMembers(moduleSymbol)) { const declaration = getDeclarationOfAliasSymbol(exportEqualsSymbol) || exportEqualsSymbol.valueDeclaration; - error(declaration, Diagnostics.An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements); + if (!isTopLevelInExternalModuleAugmentation(declaration)) { + error(declaration, Diagnostics.An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements); + } } // Checks for export * conflicts const exports = getExportsOfModule(moduleSymbol); @@ -14385,11 +16182,20 @@ namespace ts { continue; } const { declarations, flags } = exports[id]; - // ECMA262: 15.2.1.1 It is a Syntax Error if the ExportedNames of ModuleItemList contains any duplicate entries. (TS Exceptions: namespaces, function overloads, enums, and interfaces) - if (!(flags & (SymbolFlags.Namespace | SymbolFlags.Interface | SymbolFlags.Enum)) && (flags & SymbolFlags.TypeAlias ? declarations.length - 1 : declarations.length) > 1) { - const exportedDeclarations: Declaration[] = filter(declarations, isNotOverload); - if (exportedDeclarations.length > 1) { - for (const declaration of exportedDeclarations) { + // ECMA262: 15.2.1.1 It is a Syntax Error if the ExportedNames of ModuleItemList contains any duplicate entries. + // (TS Exceptions: namespaces, function overloads, enums, and interfaces) + if (flags & (SymbolFlags.Namespace | SymbolFlags.Interface | SymbolFlags.Enum)) { + continue; + } + const exportedDeclarationsCount = countWhere(declarations, isNotOverload); + if (flags & SymbolFlags.TypeAlias && exportedDeclarationsCount <= 2) { + // it is legal to merge type alias with other values + // so count should be either 1 (just type alias) or 2 (type alias + merged value) + continue; + } + if (exportedDeclarationsCount > 1) { + for (const declaration of declarations) { + if (isNotOverload(declaration)) { diagnostics.add(createDiagnosticForNode(declaration, Diagnostics.Cannot_redeclare_exported_variable_0, id)); } } @@ -14403,21 +16209,6 @@ namespace ts { } } - function checkTypePredicate(node: TypePredicateNode) { - const { parameterName } = node; - if (parameterName.kind === SyntaxKind.Identifier && !isInLegalParameterTypePredicatePosition(node)) { - error(node, Diagnostics.A_type_predicate_is_only_allowed_in_return_type_position_for_functions_and_methods); - } - else if (parameterName.kind === SyntaxKind.ThisType) { - if (!isInLegalThisTypePredicatePosition(node)) { - error(node, Diagnostics.A_this_based_type_predicate_is_only_allowed_within_a_class_or_interface_s_members_get_accessors_or_return_type_positions_for_functions_and_methods); - } - else { - getTypeFromThisTypeNode(parameterName as ThisTypeNode); - } - } - } - function checkSourceElement(node: Node): void { if (!node) { return; @@ -14425,7 +16216,7 @@ namespace ts { const kind = node.kind; if (cancellationToken) { - // Only bother checking on a few construct kinds. We don't want to be excessivly + // Only bother checking on a few construct kinds. We don't want to be excessively // hitting the cancellation token on every node we check. switch (kind) { case SyntaxKind.ModuleDeclaration: @@ -14605,10 +16396,6 @@ namespace ts { // Grammar checking checkGrammarSourceFile(node); - emitExtends = false; - emitDecorate = false; - emitParam = false; - emitAwaiter = false; potentialThisCollisions.length = 0; deferredNodes = []; @@ -14625,26 +16412,6 @@ namespace ts { potentialThisCollisions.length = 0; } - if (emitExtends) { - links.flags |= NodeCheckFlags.EmitExtends; - } - - if (emitDecorate) { - links.flags |= NodeCheckFlags.EmitDecorate; - } - - if (emitParam) { - links.flags |= NodeCheckFlags.EmitParam; - } - - if (emitAwaiter) { - links.flags |= NodeCheckFlags.EmitAwaiter; - } - - if (emitGenerator || (emitAwaiter && languageVersion < ScriptTarget.ES6)) { - links.flags |= NodeCheckFlags.EmitGenerator; - } - links.flags |= NodeCheckFlags.TypeChecked; } } @@ -14829,6 +16596,22 @@ namespace ts { return node.parent && node.parent.kind === SyntaxKind.ExpressionWithTypeArguments; } + function forEachEnclosingClass(node: Node, callback: (node: Node) => T): T { + let result: T; + + while (true) { + node = getContainingClass(node); + if (!node) break; + if (result = callback(node)) break; + } + + return result; + } + + function isNodeWithinClass(node: Node, classDeclaration: ClassLikeDeclaration) { + return !!forEachEnclosingClass(node, n => n === classDeclaration); + } + function getLeftSideOfImportEqualsOrExportAssignment(nodeOnRightSide: EntityName): ImportEqualsDeclaration | ExportAssignment { while (nodeOnRightSide.parent.kind === SyntaxKind.QualifiedName) { nodeOnRightSide = nodeOnRightSide.parent; @@ -14854,6 +16637,20 @@ namespace ts { return getSymbolOfNode(entityName.parent); } + if (isInJavaScriptFile(entityName) && entityName.parent.kind === SyntaxKind.PropertyAccessExpression) { + const specialPropertyAssignmentKind = getSpecialPropertyAssignmentKind(entityName.parent.parent); + switch (specialPropertyAssignmentKind) { + case SpecialPropertyAssignmentKind.ExportsProperty: + case SpecialPropertyAssignmentKind.PrototypeProperty: + return getSymbolOfNode(entityName.parent); + case SpecialPropertyAssignmentKind.ThisProperty: + case SpecialPropertyAssignmentKind.ModuleExports: + return getSymbolOfNode(entityName.parent.parent); + default: + // Fall through if it is not a special property assignment + } + } + if (entityName.parent.kind === SyntaxKind.ExportAssignment) { return resolveEntityName(entityName, /*all meanings*/ SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace | SymbolFlags.Alias); @@ -14889,11 +16686,6 @@ namespace ts { meaning |= SymbolFlags.Alias; return resolveEntityName(entityName, meaning); } - else if ((entityName.parent.kind === SyntaxKind.JsxOpeningElement) || - (entityName.parent.kind === SyntaxKind.JsxSelfClosingElement) || - (entityName.parent.kind === SyntaxKind.JsxClosingElement)) { - return getJsxElementTagSymbol(entityName.parent); - } else if (isExpression(entityName)) { if (nodeIsMissing(entityName)) { // Missing entity name. @@ -14901,6 +16693,10 @@ namespace ts { } if (entityName.kind === SyntaxKind.Identifier) { + if (isJSXTagName(entityName) && isJsxIntrinsicIdentifier(entityName)) { + return getIntrinsicTagSymbol(entityName.parent); + } + // Include aliases in the meaning, this ensures that we do not follow aliases to where they point and instead // return the alias symbol. const meaning: SymbolFlags = SymbolFlags.Value | SymbolFlags.Alias; @@ -14941,6 +16737,9 @@ namespace ts { } function getSymbolAtLocation(node: Node) { + if (node.kind === SyntaxKind.SourceFile) { + return isExternalModule(node) ? getMergedSymbol(node.symbol) : undefined; + } if (isInsideWithStatementBody(node)) { // We cannot answer semantic questions within a with block, do not proceed any further return undefined; @@ -14950,6 +16749,9 @@ namespace ts { // This is a declaration, call getSymbolOfNode return getSymbolOfNode(node.parent); } + else if (isLiteralComputedPropertyDeclarationName(node)) { + return getSymbolOfNode(node.parent.parent); + } if (node.kind === SyntaxKind.Identifier) { if (isInRightSideOfImportOrExportAssignment(node)) { @@ -15020,11 +16822,18 @@ namespace ts { // This is necessary as an identifier in short-hand property assignment can contains two meaning: // property name and property value. if (location && location.kind === SyntaxKind.ShorthandPropertyAssignment) { - return resolveEntityName((location).name, SymbolFlags.Value); + return resolveEntityName((location).name, SymbolFlags.Value | SymbolFlags.Alias); } return undefined; } + /** Returns the target of an export specifier without following aliases */ + function getExportSpecifierLocalTargetSymbol(node: ExportSpecifier): Symbol { + return (node.parent.parent).moduleSpecifier ? + getExternalModuleMember(node.parent.parent, node) : + resolveEntityName(node.propertyName || node.name, SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace | SymbolFlags.Alias); + } + function getTypeOfNode(node: Node): Type { if (isInsideWithStatementBody(node)) { // We cannot answer semantic questions within a with block, do not proceed any further @@ -15080,6 +16889,53 @@ namespace ts { return unknownType; } + // Gets the type of object literal or array literal of destructuring assignment. + // { a } from + // for ( { a } of elems) { + // } + // [ a ] from + // [a] = [ some array ...] + function getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr: Expression): Type { + Debug.assert(expr.kind === SyntaxKind.ObjectLiteralExpression || expr.kind === SyntaxKind.ArrayLiteralExpression); + // If this is from "for of" + // for ( { a } of elems) { + // } + if (expr.parent.kind === SyntaxKind.ForOfStatement) { + const iteratedType = checkRightHandSideOfForOf((expr.parent).expression); + return checkDestructuringAssignment(expr, iteratedType || unknownType); + } + // If this is from "for" initializer + // for ({a } = elems[0];.....) { } + if (expr.parent.kind === SyntaxKind.BinaryExpression) { + const iteratedType = checkExpression((expr.parent).right); + return checkDestructuringAssignment(expr, iteratedType || unknownType); + } + // If this is from nested object binding pattern + // for ({ skills: { primary, secondary } } = multiRobot, i = 0; i < 1; i++) { + if (expr.parent.kind === SyntaxKind.PropertyAssignment) { + const typeOfParentObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent.parent); + return checkObjectLiteralDestructuringPropertyAssignment(typeOfParentObjectLiteral || unknownType, expr.parent); + } + // Array literal assignment - array destructuring pattern + Debug.assert(expr.parent.kind === SyntaxKind.ArrayLiteralExpression); + // [{ property1: p1, property2 }] = elems; + const typeOfArrayLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent); + const elementType = checkIteratedTypeOrElementType(typeOfArrayLiteral || unknownType, expr.parent, /*allowStringInput*/ false) || unknownType; + return checkArrayLiteralDestructuringElementAssignment(expr.parent, typeOfArrayLiteral, + indexOf((expr.parent).elements, expr), elementType || unknownType); + } + + // Gets the property symbol corresponding to the property in destructuring assignment + // 'property1' from + // for ( { property1: a } of elems) { + // } + // 'property1' at location 'a' from: + // [a] = [ property1, property2 ] + function getPropertySymbolOfDestructuringAssignment(location: Identifier) { + // Get the type of the object or array literal and then look for property of given name in the type + const typeOfObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(location.parent.parent); + return typeOfObjectLiteral && getPropertyOfType(typeOfObjectLiteral, location.text); + } function getTypeOfExpression(expr: Expression): Type { if (isRightSideOfQualifiedNameOrPropertyAccess(expr)) { @@ -15127,7 +16983,11 @@ namespace ts { return symbols; } else if (symbol.flags & SymbolFlags.Transient) { - const target = getSymbolLinks(symbol).target; + let target: Symbol; + let next = symbol; + while (next = getSymbolLinks(next).target) { + target = next; + } if (target) { return [target]; } @@ -15148,7 +17008,7 @@ namespace ts { return true; } - const hasExportAssignment = getExportAssignmentSymbol(moduleSymbol) !== undefined; + const hasExportAssignment = hasExportAssignmentSymbol(moduleSymbol); // if module has export assignment then 'resolveExternalModuleSymbol' will return resolved symbol for export assignment // otherwise it will return moduleSymbol itself moduleSymbol = resolveExternalModuleSymbol(moduleSymbol); @@ -15206,42 +17066,61 @@ namespace ts { return symbol && symbol.flags & SymbolFlags.Alias ? getDeclarationOfAliasSymbol(symbol) : undefined; } - function isStatementWithLocals(node: Node) { - switch (node.kind) { - case SyntaxKind.Block: - case SyntaxKind.CaseBlock: - case SyntaxKind.ForStatement: - case SyntaxKind.ForInStatement: - case SyntaxKind.ForOfStatement: - return true; - } - return false; - } - - function isNestedRedeclarationSymbol(symbol: Symbol): boolean { + function isSymbolOfDeclarationWithCollidingName(symbol: Symbol): boolean { if (symbol.flags & SymbolFlags.BlockScoped) { const links = getSymbolLinks(symbol); - if (links.isNestedRedeclaration === undefined) { + if (links.isDeclarationWithCollidingName === undefined) { const container = getEnclosingBlockScopeContainer(symbol.valueDeclaration); - links.isNestedRedeclaration = isStatementWithLocals(container) && - !!resolveName(container.parent, symbol.name, SymbolFlags.Value, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined); + if (isStatementWithLocals(container)) { + const nodeLinks = getNodeLinks(symbol.valueDeclaration); + if (!!resolveName(container.parent, symbol.name, SymbolFlags.Value, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined)) { + // redeclaration - always should be renamed + links.isDeclarationWithCollidingName = true; + } + else if (nodeLinks.flags & NodeCheckFlags.CapturedBlockScopedBinding) { + // binding is captured in the function + // should be renamed if: + // - binding is not top level - top level bindings never collide with anything + // AND + // - binding is not declared in loop, should be renamed to avoid name reuse across siblings + // let a, b + // { let x = 1; a = () => x; } + // { let x = 100; b = () => x; } + // console.log(a()); // should print '1' + // console.log(b()); // should print '100' + // OR + // - binding is declared inside loop but not in inside initializer of iteration statement or directly inside loop body + // * variables from initializer are passed to rewritten loop body as parameters so they are not captured directly + // * variables that are declared immediately in loop body will become top level variable after loop is rewritten and thus + // they will not collide with anything + const isDeclaredInLoop = nodeLinks.flags & NodeCheckFlags.BlockScopedBindingInLoop; + const inLoopInitializer = isIterationStatement(container, /*lookInLabeledStatements*/ false); + const inLoopBodyBlock = container.kind === SyntaxKind.Block && isIterationStatement(container.parent, /*lookInLabeledStatements*/ false); + + links.isDeclarationWithCollidingName = !isBlockScopedContainerTopLevel(container) && (!isDeclaredInLoop || (!inLoopInitializer && !inLoopBodyBlock)); + } + else { + links.isDeclarationWithCollidingName = false; + } + } } - return links.isNestedRedeclaration; + return links.isDeclarationWithCollidingName; } return false; } // When resolved as an expression identifier, if the given node references a nested block scoped entity with - // a name that hides an existing name, return the declaration of that entity. Otherwise, return undefined. - function getReferencedNestedRedeclaration(node: Identifier): Declaration { + // a name that either hides an existing name or might hide it when compiled downlevel, + // return the declaration of that entity. Otherwise, return undefined. + function getReferencedDeclarationWithCollidingName(node: Identifier): Declaration { const symbol = getReferencedValueSymbol(node); - return symbol && isNestedRedeclarationSymbol(symbol) ? symbol.valueDeclaration : undefined; + return symbol && isSymbolOfDeclarationWithCollidingName(symbol) ? symbol.valueDeclaration : undefined; } - // Return true if the given node is a declaration of a nested block scoped entity with a name that hides an - // existing name. - function isNestedRedeclaration(node: Declaration): boolean { - return isNestedRedeclarationSymbol(getSymbolOfNode(node)); + // Return true if the given node is a declaration of a nested block scoped entity with a name that either hides an + // existing name or might hide a name when compiled downlevel + function isDeclarationWithCollidingName(node: Declaration): boolean { + return isSymbolOfDeclarationWithCollidingName(getSymbolOfNode(node)); } function isValueAliasDeclaration(node: Node): boolean { @@ -15273,14 +17152,12 @@ namespace ts { function isAliasResolvedToValue(symbol: Symbol): boolean { const target = resolveAlias(symbol); - if (target === unknownSymbol && compilerOptions.isolatedModules) { + if (target === unknownSymbol) { return true; } - // const enums and modules that contain only const enums are not considered values from the emit perespective + // const enums and modules that contain only const enums are not considered values from the emit perspective // unless 'preserveConstEnums' option is set to true - return target !== unknownSymbol && - target && - target.flags & SymbolFlags.Value && + return target.flags & SymbolFlags.Value && (compilerOptions.preserveConstEnums || !isConstEnumOrConstEnumOnlyModule(target)); } @@ -15373,22 +17250,22 @@ namespace ts { else if (type.flags & TypeFlags.Any) { return TypeReferenceSerializationKind.ObjectType; } - else if (allConstituentTypesHaveKind(type, TypeFlags.Void)) { + else if (isTypeOfKind(type, TypeFlags.Void)) { return TypeReferenceSerializationKind.VoidType; } - else if (allConstituentTypesHaveKind(type, TypeFlags.Boolean)) { + else if (isTypeOfKind(type, TypeFlags.Boolean)) { return TypeReferenceSerializationKind.BooleanType; } - else if (allConstituentTypesHaveKind(type, TypeFlags.NumberLike)) { + else if (isTypeOfKind(type, TypeFlags.NumberLike)) { return TypeReferenceSerializationKind.NumberLikeType; } - else if (allConstituentTypesHaveKind(type, TypeFlags.StringLike)) { + else if (isTypeOfKind(type, TypeFlags.StringLike)) { return TypeReferenceSerializationKind.StringLikeType; } - else if (allConstituentTypesHaveKind(type, TypeFlags.Tuple)) { + else if (isTypeOfKind(type, TypeFlags.Tuple)) { return TypeReferenceSerializationKind.ArrayLikeType; } - else if (allConstituentTypesHaveKind(type, TypeFlags.ESSymbol)) { + else if (isTypeOfKind(type, TypeFlags.ESSymbol)) { return TypeReferenceSerializationKind.ESSymbolType; } else if (isFunctionType(type)) { @@ -15418,10 +17295,17 @@ namespace ts { } function writeTypeOfExpression(expr: Expression, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter) { - const type = getTypeOfExpression(expr); + const type = getWidenedType(getTypeOfExpression(expr)); getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags); } + function writeBaseConstructorTypeOfClass(node: ClassLikeDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter) { + const classType = getDeclaredTypeOfSymbol(getSymbolOfNode(node)); + resolveBaseTypesOfClass(classType); + const baseType = classType.resolvedBaseTypes.length ? classType.resolvedBaseTypes[0] : unknownType; + getSymbolDisplayBuilder().buildTypeDisplay(baseType, writer, enclosingDeclaration, flags); + } + function hasGlobalName(name: string): boolean { return hasProperty(globals, name); } @@ -15439,11 +17323,30 @@ namespace ts { } function createResolver(): EmitResolver { + // this variable and functions that use it are deliberately moved here from the outer scope + // to avoid scope pollution + const resolvedTypeReferenceDirectives = host.getResolvedTypeReferenceDirectives(); + let fileToDirective: FileMap; + if (resolvedTypeReferenceDirectives) { + // populate reverse mapping: file path -> type reference directive that was resolved to this file + fileToDirective = createFileMap(); + for (const key in resolvedTypeReferenceDirectives) { + if (!hasProperty(resolvedTypeReferenceDirectives, key)) { + continue; + } + const resolvedDirective = resolvedTypeReferenceDirectives[key]; + if (!resolvedDirective) { + continue; + } + const file = host.getSourceFile(resolvedDirective.resolvedFileName); + fileToDirective.set(file.path, key); + } + } return { getReferencedExportContainer, getReferencedImportDeclaration, - getReferencedNestedRedeclaration, - isNestedRedeclaration, + getReferencedDeclarationWithCollidingName, + isDeclarationWithCollidingName, isValueAliasDeclaration, hasGlobalName, isReferencedAliasDeclaration, @@ -15454,6 +17357,7 @@ namespace ts { writeTypeOfDeclaration, writeReturnTypeOfSignatureDeclaration, writeTypeOfExpression, + writeBaseConstructorTypeOfClass, isSymbolAccessible, isEntityNameVisible, getConstantValue, @@ -15463,17 +17367,93 @@ namespace ts { isOptionalParameter, moduleExportsSomeValue, isArgumentsLocalBinding, - getExternalModuleFileFromDeclaration + getExternalModuleFileFromDeclaration, + getTypeReferenceDirectivesForEntityName, + getTypeReferenceDirectivesForSymbol }; - } - function getExternalModuleFileFromDeclaration(declaration: ImportEqualsDeclaration | ImportDeclaration | ExportDeclaration): SourceFile { - const specifier = getExternalModuleName(declaration); - const moduleSymbol = getSymbolAtLocation(specifier); - if (!moduleSymbol) { + // defined here to avoid outer scope pollution + function getTypeReferenceDirectivesForEntityName(node: EntityName | PropertyAccessExpression): string[] { + // program does not have any files with type reference directives - bail out + if (!fileToDirective) { return undefined; } - return getDeclarationOfKind(moduleSymbol, SyntaxKind.SourceFile) as SourceFile; + // property access can only be used as values + // qualified names can only be used as types\namespaces + // identifiers are treated as values only if they appear in type queries + const meaning = (node.kind === SyntaxKind.PropertyAccessExpression) || (node.kind === SyntaxKind.Identifier && isInTypeQuery(node)) + ? SymbolFlags.Value | SymbolFlags.ExportValue + : SymbolFlags.Type | SymbolFlags.Namespace; + + const symbol = resolveEntityName(node, meaning, /*ignoreErrors*/true); + return symbol && symbol !== unknownSymbol ? getTypeReferenceDirectivesForSymbol(symbol, meaning) : undefined; + } + + // defined here to avoid outer scope pollution + function getTypeReferenceDirectivesForSymbol(symbol: Symbol, meaning?: SymbolFlags): string[] { + // program does not have any files with type reference directives - bail out + if (!fileToDirective) { + return undefined; + } + if (!isSymbolFromTypeDeclarationFile(symbol)) { + return undefined; + } + // check what declarations in the symbol can contribute to the target meaning + let typeReferenceDirectives: string[]; + for (const decl of symbol.declarations) { + // check meaning of the local symbol to see if declaration needs to be analyzed further + if (decl.symbol && decl.symbol.flags & meaning) { + const file = getSourceFileOfNode(decl); + const typeReferenceDirective = fileToDirective.get(file.path); + if (typeReferenceDirective) { + (typeReferenceDirectives || (typeReferenceDirectives = [])).push(typeReferenceDirective); + } + } + } + return typeReferenceDirectives; + } + + function isSymbolFromTypeDeclarationFile(symbol: Symbol): boolean { + // bail out if symbol does not have associated declarations (i.e. this is transient symbol created for property in binding pattern) + if (!symbol.declarations) { + return false; + } + + // walk the parent chain for symbols to make sure that top level parent symbol is in the global scope + // external modules cannot define or contribute to type declaration files + let current = symbol; + while (true) { + const parent = getParentOfSymbol(current); + if (parent) { + current = parent; + } + else { + break; + } + } + + if (current.valueDeclaration && current.valueDeclaration.kind === SyntaxKind.SourceFile && current.flags & SymbolFlags.ValueModule) { + return false; + } + + // check that at least one declaration of top level symbol originates from type declaration file + for (const decl of symbol.declarations) { + const file = getSourceFileOfNode(decl); + if (fileToDirective.contains(file.path)) { + return true; + } + } + return false; + } + } + + function getExternalModuleFileFromDeclaration(declaration: ImportEqualsDeclaration | ImportDeclaration | ExportDeclaration | ModuleDeclaration): SourceFile { + const specifier = getExternalModuleName(declaration); + const moduleSymbol = resolveExternalModuleNameWorker(specifier, specifier, /*moduleNotFoundError*/ undefined); + if (!moduleSymbol) { + return undefined; + } + return getDeclarationOfKind(moduleSymbol, SyntaxKind.SourceFile) as SourceFile; } function initializeTypeChecker() { @@ -15482,13 +17462,30 @@ namespace ts { bindSourceFile(file, compilerOptions); }); + let augmentations: LiteralExpression[][]; // Initialize global symbol table forEach(host.getSourceFiles(), file => { if (!isExternalOrCommonJsModule(file)) { mergeSymbolTable(globals, file.locals); } + if (file.moduleAugmentations.length) { + (augmentations || (augmentations = [])).push(file.moduleAugmentations); + } + if (file.wasReferenced && file.symbol && file.symbol.globalExports) { + mergeSymbolTable(globals, file.symbol.globalExports); + } }); + if (augmentations) { + // merge module augmentations. + // this needs to be done after global symbol table is initialized to make sure that all ambient modules are indexed + for (const list of augmentations) { + for (const augmentation of list) { + mergeModuleAugmentation(augmentation); + } + } + } + // Setup global builtins addToSymbolTable(globals, builtinGlobals, Diagnostics.Declaration_name_conflicts_with_built_in_global_identifier_0); @@ -15504,12 +17501,14 @@ namespace ts { globalNumberType = getGlobalType("Number"); globalBooleanType = getGlobalType("Boolean"); globalRegExpType = getGlobalType("RegExp"); + jsxElementType = getExportedTypeFromNamespace("JSX", JsxNames.Element); getGlobalClassDecoratorType = memoize(() => getGlobalType("ClassDecorator")); getGlobalPropertyDecoratorType = memoize(() => getGlobalType("PropertyDecorator")); getGlobalMethodDecoratorType = memoize(() => getGlobalType("MethodDecorator")); getGlobalParameterDecoratorType = memoize(() => getGlobalType("ParameterDecorator")); getGlobalTypedPropertyDescriptorType = memoize(() => getGlobalType("TypedPropertyDescriptor", /*arity*/ 1)); + getGlobalESSymbolConstructorSymbol = memoize(() => getGlobalValueSymbol("Symbol")); getGlobalPromiseType = memoize(() => getGlobalType("Promise", /*arity*/ 1)); tryGetGlobalPromiseType = memoize(() => getGlobalSymbol("Promise", SymbolFlags.Type, /*diagnostic*/ undefined) && getGlobalPromiseType()); getGlobalPromiseLikeType = memoize(() => getGlobalType("PromiseLike", /*arity*/ 1)); @@ -15518,30 +17517,26 @@ namespace ts { getGlobalPromiseConstructorLikeType = memoize(() => getGlobalType("PromiseConstructorLike")); getGlobalThenableType = memoize(createThenableType); - // If we're in ES6 mode, load the TemplateStringsArray. - // Otherwise, default to 'unknown' for the purposes of type checking in LS scenarios. + getGlobalTemplateStringsArrayType = memoize(() => getGlobalType("TemplateStringsArray")); + if (languageVersion >= ScriptTarget.ES6) { - globalTemplateStringsArrayType = getGlobalType("TemplateStringsArray"); - globalESSymbolType = getGlobalType("Symbol"); - globalESSymbolConstructorSymbol = getGlobalValueSymbol("Symbol"); - globalIterableType = getGlobalType("Iterable", /*arity*/ 1); - globalIteratorType = getGlobalType("Iterator", /*arity*/ 1); - globalIterableIteratorType = getGlobalType("IterableIterator", /*arity*/ 1); + getGlobalESSymbolType = memoize(() => getGlobalType("Symbol")); + getGlobalIterableType = memoize(() => getGlobalType("Iterable", /*arity*/ 1)); + getGlobalIteratorType = memoize(() => getGlobalType("Iterator", /*arity*/ 1)); + getGlobalIterableIteratorType = memoize(() => getGlobalType("IterableIterator", /*arity*/ 1)); } else { - globalTemplateStringsArrayType = unknownType; - - // Consider putting Symbol interface in lib.d.ts. On the plus side, putting it in lib.d.ts would make it - // extensible for Polyfilling Symbols. But putting it into lib.d.ts could also break users that have - // a global Symbol already, particularly if it is a class. - globalESSymbolType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); - globalESSymbolConstructorSymbol = undefined; - globalIterableType = emptyGenericType; - globalIteratorType = emptyGenericType; - globalIterableIteratorType = emptyGenericType; + getGlobalESSymbolType = memoize(() => emptyObjectType); + getGlobalIterableType = memoize(() => emptyGenericType); + getGlobalIteratorType = memoize(() => emptyGenericType); + getGlobalIterableIteratorType = memoize(() => emptyGenericType); } anyArrayType = createArrayType(anyType); + + const symbol = getGlobalSymbol("ReadonlyArray", SymbolFlags.Type, /*diagnostic*/ undefined); + globalReadonlyArrayType = symbol && getTypeOfGlobalSymbol(symbol, /*arity*/ 1); + anyReadonlyArrayType = globalReadonlyArrayType ? createTypeFromGenericGlobalType(globalReadonlyArrayType, [anyType]) : anyArrayType; } function createInstantiatedPromiseLikeType(): ObjectType { @@ -15633,9 +17628,17 @@ namespace ts { return; } - let lastStatic: Node, lastPrivate: Node, lastProtected: Node, lastDeclare: Node, lastAsync: Node; + let lastStatic: Node, lastPrivate: Node, lastProtected: Node, lastDeclare: Node, lastAsync: Node, lastReadonly: Node; let flags = 0; for (const modifier of node.modifiers) { + if (modifier.kind !== SyntaxKind.ReadonlyKeyword) { + if (node.kind === SyntaxKind.PropertySignature || node.kind === SyntaxKind.MethodSignature) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_type_member, tokenToString(modifier.kind)); + } + if (node.kind === SyntaxKind.IndexSignature) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_an_index_signature, tokenToString(modifier.kind)); + } + } switch (modifier.kind) { case SyntaxKind.ConstKeyword: if (node.kind !== SyntaxKind.EnumDeclaration && node.parent.kind === SyntaxKind.ClassDeclaration) { @@ -15645,16 +17648,12 @@ namespace ts { case SyntaxKind.PublicKeyword: case SyntaxKind.ProtectedKeyword: case SyntaxKind.PrivateKeyword: - let text: string; - if (modifier.kind === SyntaxKind.PublicKeyword) { - text = "public"; - } - else if (modifier.kind === SyntaxKind.ProtectedKeyword) { - text = "protected"; + let text = visibilityToString(modifierToFlag(modifier.kind)); + + if (modifier.kind === SyntaxKind.ProtectedKeyword) { lastProtected = modifier; } - else { - text = "private"; + else if (modifier.kind === SyntaxKind.PrivateKeyword) { lastPrivate = modifier; } @@ -15664,11 +17663,14 @@ namespace ts { else if (flags & NodeFlags.Static) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, text, "static"); } + else if (flags & NodeFlags.Readonly) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, text, "readonly"); + } else if (flags & NodeFlags.Async) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, text, "async"); } else if (node.parent.kind === SyntaxKind.ModuleBlock || node.parent.kind === SyntaxKind.SourceFile) { - return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_module_element, text); + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, text); } else if (flags & NodeFlags.Abstract) { if (modifier.kind === SyntaxKind.PrivateKeyword) { @@ -15685,11 +17687,14 @@ namespace ts { if (flags & NodeFlags.Static) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, "static"); } + else if (flags & NodeFlags.Readonly) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "static", "readonly"); + } else if (flags & NodeFlags.Async) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "static", "async"); } else if (node.parent.kind === SyntaxKind.ModuleBlock || node.parent.kind === SyntaxKind.SourceFile) { - return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_module_element, "static"); + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, "static"); } else if (node.kind === SyntaxKind.Parameter) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static"); @@ -15701,6 +17706,18 @@ namespace ts { lastStatic = modifier; break; + case SyntaxKind.ReadonlyKeyword: + if (flags & NodeFlags.Readonly) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, "readonly"); + } + else if (node.kind !== SyntaxKind.PropertyDeclaration && node.kind !== SyntaxKind.PropertySignature && node.kind !== SyntaxKind.IndexSignature && node.kind !== SyntaxKind.Parameter) { + // If node.kind === SyntaxKind.Parameter, checkParameter report an error if it's not a parameter property. + return grammarErrorOnNode(modifier, Diagnostics.readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature); + } + flags |= NodeFlags.Readonly; + lastReadonly = modifier; + break; + case SyntaxKind.ExportKeyword: if (flags & NodeFlags.Export) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, "export"); @@ -15748,8 +17765,11 @@ namespace ts { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, "abstract"); } if (node.kind !== SyntaxKind.ClassDeclaration) { - if (node.kind !== SyntaxKind.MethodDeclaration) { - return grammarErrorOnNode(modifier, Diagnostics.abstract_modifier_can_only_appear_on_a_class_or_method_declaration); + if (node.kind !== SyntaxKind.MethodDeclaration && + node.kind !== SyntaxKind.PropertyDeclaration && + node.kind !== SyntaxKind.GetAccessor && + node.kind !== SyntaxKind.SetAccessor) { + return grammarErrorOnNode(modifier, Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration); } if (!(node.parent.kind === SyntaxKind.ClassDeclaration && node.parent.flags & NodeFlags.Abstract)) { return grammarErrorOnNode(modifier, Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class); @@ -15788,21 +17808,18 @@ namespace ts { if (flags & NodeFlags.Abstract) { return grammarErrorOnNode(lastStatic, Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "abstract"); } - else if (flags & NodeFlags.Protected) { - return grammarErrorOnNode(lastProtected, Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "protected"); - } - else if (flags & NodeFlags.Private) { - return grammarErrorOnNode(lastPrivate, Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "private"); - } else if (flags & NodeFlags.Async) { return grammarErrorOnNode(lastAsync, Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "async"); } + else if (flags & NodeFlags.Readonly) { + return grammarErrorOnNode(lastReadonly, Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "readonly"); + } return; } else if ((node.kind === SyntaxKind.ImportDeclaration || node.kind === SyntaxKind.ImportEqualsDeclaration) && flags & NodeFlags.Ambient) { return grammarErrorOnNode(lastDeclare, Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare"); } - else if (node.kind === SyntaxKind.Parameter && (flags & NodeFlags.AccessibilityModifier) && isBindingPattern((node).name)) { + else if (node.kind === SyntaxKind.Parameter && (flags & NodeFlags.ParameterPropertyModifier) && isBindingPattern((node).name)) { return grammarErrorOnNode(node, Diagnostics.A_parameter_property_may_not_be_a_binding_pattern); } if (flags & NodeFlags.Async) { @@ -15942,15 +17959,9 @@ namespace ts { } } - function checkGrammarForIndexSignatureModifier(node: SignatureDeclaration): void { - if (node.flags & NodeFlags.Modifier) { - grammarErrorOnFirstToken(node, Diagnostics.Modifiers_not_permitted_on_index_signature_members); - } - } - function checkGrammarIndexSignature(node: SignatureDeclaration) { // Prevent cascading error by short-circuit - return checkGrammarDecorators(node) || checkGrammarModifiers(node) || checkGrammarIndexSignatureParameters(node) || checkGrammarForIndexSignatureModifier(node); + return checkGrammarDecorators(node) || checkGrammarModifiers(node) || checkGrammarIndexSignatureParameters(node); } function checkGrammarForAtLeastOneTypeArgument(node: Node, typeArguments: NodeArray): boolean { @@ -16096,8 +18107,8 @@ namespace ts { const seen: Map = {}; const Property = 1; const GetAccessor = 2; - const SetAccesor = 4; - const GetOrSetAccessor = GetAccessor | SetAccesor; + const SetAccessor = 4; + const GetOrSetAccessor = GetAccessor | SetAccessor; for (const prop of node.properties) { const name = prop.name; @@ -16121,7 +18132,7 @@ namespace ts { } }); - // ECMA-262 11.1.5 Object Initialiser + // ECMA-262 11.1.5 Object Initializer // If previous is not undefined then throw a SyntaxError exception if any of the following conditions are true // a.This production is contained in strict code and IsDataDescriptor(previous) is true and // IsDataDescriptor(propId.descriptor) is true. @@ -16131,10 +18142,10 @@ namespace ts { // and either both previous and propId.descriptor have[[Get]] fields or both previous and propId.descriptor have[[Set]] fields let currentKind: number; if (prop.kind === SyntaxKind.PropertyAssignment || prop.kind === SyntaxKind.ShorthandPropertyAssignment) { - // Grammar checking for computedPropertName and shorthandPropertyAssignment + // Grammar checking for computedPropertyName and shorthandPropertyAssignment checkGrammarForInvalidQuestionMark(prop, (prop).questionToken, Diagnostics.An_object_member_cannot_be_declared_optional); if (name.kind === SyntaxKind.NumericLiteral) { - checkGrammarNumericLiteral(name); + checkGrammarNumericLiteral(name); } currentKind = Property; } @@ -16145,7 +18156,7 @@ namespace ts { currentKind = GetAccessor; } else if (prop.kind === SyntaxKind.SetAccessor) { - currentKind = SetAccesor; + currentKind = SetAccessor; } else { Debug.fail("Unexpected syntax kind:" + prop.kind); @@ -16244,7 +18255,7 @@ namespace ts { return false; } - function checkGrammarAccessor(accessor: MethodDeclaration): boolean { + function checkGrammarAccessor(accessor: AccessorDeclaration): boolean { const kind = accessor.kind; if (languageVersion < ScriptTarget.ES5) { return grammarErrorOnNode(accessor.name, Diagnostics.Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher); @@ -16252,30 +18263,27 @@ namespace ts { else if (isInAmbientContext(accessor)) { return grammarErrorOnNode(accessor.name, Diagnostics.An_accessor_cannot_be_declared_in_an_ambient_context); } - else if (accessor.body === undefined) { + else if (accessor.body === undefined && !(accessor.flags & NodeFlags.Abstract)) { return grammarErrorAtPos(getSourceFileOfNode(accessor), accessor.end - 1, ";".length, Diagnostics._0_expected, "{"); } else if (accessor.typeParameters) { return grammarErrorOnNode(accessor.name, Diagnostics.An_accessor_cannot_have_type_parameters); } - else if (kind === SyntaxKind.GetAccessor && accessor.parameters.length) { - return grammarErrorOnNode(accessor.name, Diagnostics.A_get_accessor_cannot_have_parameters); + else if (!doesAccessorHaveCorrectParameterCount(accessor)) { + return grammarErrorOnNode(accessor.name, + kind === SyntaxKind.GetAccessor ? + Diagnostics.A_get_accessor_cannot_have_parameters : + Diagnostics.A_set_accessor_must_have_exactly_one_parameter); } else if (kind === SyntaxKind.SetAccessor) { if (accessor.type) { return grammarErrorOnNode(accessor.name, Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation); } - else if (accessor.parameters.length !== 1) { - return grammarErrorOnNode(accessor.name, Diagnostics.A_set_accessor_must_have_exactly_one_parameter); - } else { const parameter = accessor.parameters[0]; if (parameter.dotDotDotToken) { return grammarErrorOnNode(parameter.dotDotDotToken, Diagnostics.A_set_accessor_cannot_have_rest_parameter); } - else if (parameter.flags & NodeFlags.Modifier) { - return grammarErrorOnNode(accessor.name, Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); - } else if (parameter.questionToken) { return grammarErrorOnNode(parameter.questionToken, Diagnostics.A_set_accessor_cannot_have_an_optional_parameter); } @@ -16286,6 +18294,22 @@ namespace ts { } } + /** Does the accessor have the right number of parameters? + + A get accessor has no parameters or a single `this` parameter. + A set accessor has one parameter or a `this` parameter and one more parameter */ + function doesAccessorHaveCorrectParameterCount(accessor: AccessorDeclaration) { + return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === SyntaxKind.GetAccessor ? 0 : 1); + } + + function getAccessorThisParameter(accessor: AccessorDeclaration) { + if (accessor.parameters.length === (accessor.kind === SyntaxKind.GetAccessor ? 1 : 2) && + accessor.parameters[0].name.kind === SyntaxKind.Identifier && + (accessor.parameters[0].name).originalKeywordKind === SyntaxKind.ThisKeyword) { + return accessor.parameters[0]; + } + } + function checkGrammarForNonSymbolComputedProperty(node: DeclarationName, message: DiagnosticMessage) { if (isDynamicName(node)) { return grammarErrorOnNode(node, message); @@ -16300,18 +18324,15 @@ namespace ts { } if (node.parent.kind === SyntaxKind.ObjectLiteralExpression) { - if (checkGrammarForInvalidQuestionMark(node, node.questionToken, Diagnostics.A_class_member_cannot_be_declared_optional)) { + if (checkGrammarForInvalidQuestionMark(node, node.questionToken, Diagnostics.An_object_member_cannot_be_declared_optional)) { return true; } else if (node.body === undefined) { - return grammarErrorAtPos(getSourceFile(node), node.end - 1, ";".length, Diagnostics._0_expected, "{"); + return grammarErrorAtPos(getSourceFileOfNode(node), node.end - 1, ";".length, Diagnostics._0_expected, "{"); } } if (isClassLike(node.parent)) { - if (checkGrammarForInvalidQuestionMark(node, node.questionToken, Diagnostics.A_class_member_cannot_be_declared_optional)) { - return true; - } // Technically, computed properties in ambient contexts is disallowed // for property declarations and accessors too, not just methods. // However, property declarations disallow computed names in general, @@ -16533,8 +18554,7 @@ namespace ts { function checkGrammarProperty(node: PropertyDeclaration) { if (isClassLike(node.parent)) { - if (checkGrammarForInvalidQuestionMark(node, node.questionToken, Diagnostics.A_class_member_cannot_be_declared_optional) || - checkGrammarForNonSymbolComputedProperty(node.name, Diagnostics.A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol)) { + if (checkGrammarForNonSymbolComputedProperty(node.name, Diagnostics.A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol)) { return true; } } @@ -16617,7 +18637,7 @@ namespace ts { // We are either parented by another statement, or some sort of block. // If we're in a block, we only want to really report an error once - // to prevent noisyness. So use a bit on the block to indicate if + // to prevent noisiness. So use a bit on the block to indicate if // this has already been reported, and don't report if it has. // if (node.parent.kind === SyntaxKind.Block || node.parent.kind === SyntaxKind.ModuleBlock || node.parent.kind === SyntaxKind.SourceFile) { @@ -16635,9 +18655,9 @@ namespace ts { } } - function checkGrammarNumericLiteral(node: Identifier): boolean { + function checkGrammarNumericLiteral(node: LiteralExpression): boolean { // Grammar checking - if (node.flags & NodeFlags.OctalLiteral && languageVersion >= ScriptTarget.ES5) { + if (node.isOctalLiteral && languageVersion >= ScriptTarget.ES5) { return grammarErrorOnNode(node, Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher); } } diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 52f9ef05f37..8dcc21b4d1b 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -17,6 +17,12 @@ namespace ts { type: "boolean", description: Diagnostics.Generates_corresponding_d_ts_file, }, + { + name: "declarationDir", + type: "string", + isFilePath: true, + paramType: Diagnostics.DIRECTORY, + }, { name: "diagnostics", type: "boolean", @@ -52,7 +58,11 @@ namespace ts { }, paramType: Diagnostics.KIND, description: Diagnostics.Specify_JSX_code_generation_Colon_preserve_or_react, - error: Diagnostics.Argument_for_jsx_must_be_preserve_or_react + }, + { + name: "reactNamespace", + type: "string", + description: Diagnostics.Specify_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit }, { name: "listFiles", @@ -66,13 +76,14 @@ namespace ts { name: "mapRoot", type: "string", isFilePath: true, - description: Diagnostics.Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations, + description: Diagnostics.Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations, paramType: Diagnostics.LOCATION, }, { name: "module", shortName: "m", type: { + "none": ModuleKind.None, "commonjs": ModuleKind.CommonJS, "amd": ModuleKind.AMD, "system": ModuleKind.System, @@ -82,7 +93,6 @@ namespace ts { }, description: Diagnostics.Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015, paramType: Diagnostics.KIND, - error: Diagnostics.Argument_for_module_option_must_be_commonjs_amd_system_umd_or_es2015 }, { name: "newLine", @@ -90,9 +100,8 @@ namespace ts { "crlf": NewLineKind.CarriageReturnLineFeed, "lf": NewLineKind.LineFeed }, - description: Diagnostics.Specifies_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix, + description: Diagnostics.Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix, paramType: Diagnostics.NEWLINE, - error: Diagnostics.Argument_for_newLine_option_must_be_CRLF_or_LF }, { name: "noEmit", @@ -113,6 +122,11 @@ namespace ts { type: "boolean", description: Diagnostics.Raise_error_on_expressions_and_declarations_with_an_implied_any_type, }, + { + name: "noImplicitThis", + type: "boolean", + description: Diagnostics.Raise_error_on_this_expressions_with_an_implied_any_type, + }, { name: "noLib", type: "boolean", @@ -129,7 +143,7 @@ namespace ts { name: "out", type: "string", isFilePath: false, // This is intentionally broken to support compatability with existing tsconfig files - // for correct behaviour, please use outFile + // for correct behaviour, please use outFile paramType: Diagnostics.FILE, }, { @@ -153,7 +167,6 @@ namespace ts { }, { name: "pretty", - paramType: Diagnostics.KIND, description: Diagnostics.Stylize_errors_and_messages_using_color_and_context_experimental, type: "boolean" }, @@ -174,8 +187,8 @@ namespace ts { name: "rootDir", type: "string", isFilePath: true, - description: Diagnostics.Specifies_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir, paramType: Diagnostics.LOCATION, + description: Diagnostics.Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir, }, { name: "isolatedModules", @@ -190,7 +203,7 @@ namespace ts { name: "sourceRoot", type: "string", isFilePath: true, - description: Diagnostics.Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations, + description: Diagnostics.Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations, paramType: Diagnostics.LOCATION, }, { @@ -219,9 +232,8 @@ namespace ts { "es6": ScriptTarget.ES6, "es2015": ScriptTarget.ES2015, }, - description: Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015_experimental, + description: Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015, paramType: Diagnostics.VERSION, - error: Diagnostics.Argument_for_target_option_must_be_ES3_ES5_or_ES2015 }, { name: "version", @@ -250,10 +262,9 @@ namespace ts { name: "moduleResolution", type: { "node": ModuleResolutionKind.NodeJs, - "classic": ModuleResolutionKind.Classic + "classic": ModuleResolutionKind.Classic, }, - description: Diagnostics.Specifies_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6, - error: Diagnostics.Argument_for_moduleResolution_option_must_be_node_or_classic, + description: Diagnostics.Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6, }, { name: "allowUnusedLabels", @@ -281,14 +292,138 @@ namespace ts { description: Diagnostics.Disallow_inconsistently_cased_references_to_the_same_file }, { - name: "allowSyntheticDefaultImports", + name: "baseUrl", + type: "string", + isFilePath: true, + description: Diagnostics.Base_directory_to_resolve_non_absolute_module_names + }, + { + // this option can only be specified in tsconfig.json + // use type = object to copy the value as-is + name: "paths", + type: "object", + isTSConfigOnly: true + }, + { + // this option can only be specified in tsconfig.json + // use type = object to copy the value as-is + name: "rootDirs", + type: "list", + isTSConfigOnly: true, + element: { + name: "rootDirs", + type: "string", + isFilePath: true + } + }, + { + name: "typesSearchPaths", + type: "list", + isTSConfigOnly: true, + element: { + name: "typesSearchPaths", + type: "string", + isFilePath: true + } + }, + { + name: "typesRoot", + type: "string" + }, + { + name: "types", + type: "list", + element: { + name: "types", + type: "string" + }, + description: Diagnostics.Type_declaration_files_to_be_included_in_compilation + }, + { + name: "traceResolution", type: "boolean", - description: Diagnostics.Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typechecking + description: Diagnostics.Enable_tracing_of_the_name_resolution_process }, { name: "allowJs", type: "boolean", description: Diagnostics.Allow_javascript_files_to_be_compiled + }, + { + name: "allowSyntheticDefaultImports", + type: "boolean", + description: Diagnostics.Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typechecking + }, + { + name: "noImplicitUseStrict", + type: "boolean", + description: Diagnostics.Do_not_emit_use_strict_directives_in_module_output + }, + { + name: "listEmittedFiles", + type: "boolean" + }, + { + name: "lib", + type: "list", + element: { + name: "lib", + type: { + // JavaScript only + "es5": "lib.es5.d.ts", + "es6": "lib.es2015.d.ts", + "es2015": "lib.es2015.d.ts", + "es7": "lib.es2016.d.ts", + "es2016": "lib.es2016.d.ts", + "es2017": "lib.es2017.d.ts", + // Host only + "dom": "lib.dom.d.ts", + "webworker": "lib.webworker.d.ts", + "scripthost": "lib.scripthost.d.ts", + // ES2015 Or ESNext By-feature options + "es2015.core": "lib.es2015.core.d.ts", + "es2015.collection": "lib.es2015.collection.d.ts", + "es2015.generator": "lib.es2015.generator.d.ts", + "es2015.iterable": "lib.es2015.iterable.d.ts", + "es2015.promise": "lib.es2015.promise.d.ts", + "es2015.proxy": "lib.es2015.proxy.d.ts", + "es2015.reflect": "lib.es2015.reflect.d.ts", + "es2015.symbol": "lib.es2015.symbol.d.ts", + "es2015.symbol.wellknown": "lib.es2015.symbol.wellknown.d.ts", + "es2016.array.include": "lib.es2016.array.include.d.ts", + "es2017.object": "lib.es2017.object.d.ts" + }, + }, + description: Diagnostics.Specify_library_files_to_be_included_in_the_compilation_Colon + }, + { + name: "strictNullChecks", + type: "boolean", + description: Diagnostics.Enable_strict_null_checks + } + ]; + + /* @internal */ + export let typingOptionDeclarations: CommandLineOption[] = [ + { + name: "enableAutoDiscovery", + type: "boolean", + }, + { + name: "include", + type: "list", + element: { + name: "include", + type: "string" + } + }, + { + name: "exclude", + type: "list", + element: { + name: "exclude", + type: "string" + } } ]; @@ -299,6 +434,7 @@ namespace ts { } let optionNameMapCache: OptionNameMap; + /* @internal */ export function getOptionNameMap(): OptionNameMap { if (optionNameMapCache) { @@ -318,6 +454,42 @@ namespace ts { return optionNameMapCache; } + /* @internal */ + export function createCompilerDiagnosticForInvalidCustomType(opt: CommandLineOptionOfCustomType): Diagnostic { + const namesOfType: string[] = []; + forEachKey(opt.type, key => { + namesOfType.push(` '${key}'`); + }); + + return createCompilerDiagnostic(Diagnostics.Argument_for_0_option_must_be_Colon_1, `--${opt.name}`, namesOfType); + } + + /* @internal */ + export function parseCustomTypeOption(opt: CommandLineOptionOfCustomType, value: string, errors: Diagnostic[]) { + const key = trimString((value || "")).toLowerCase(); + const map = opt.type; + if (hasProperty(map, key)) { + return map[key]; + } + else { + errors.push(createCompilerDiagnosticForInvalidCustomType(opt)); + } + } + + /* @internal */ + export function parseListTypeOption(opt: CommandLineOptionOfListType, value: string, errors: Diagnostic[]): (string | number)[] { + const values = trimString((value || "")).split(","); + switch (opt.element.type) { + case "number": + return ts.map(values, parseInt); + case "string": + return ts.map(values, v => v || ""); + default: + return filter(map(values, v => parseCustomTypeOption(opt.element, v, errors)), v => !!v); + } + } + + /* @internal */ export function parseCommandLine(commandLine: string[], readFile?: (path: string) => string): ParsedCommandLine { const options: CompilerOptions = {}; const fileNames: string[] = []; @@ -350,34 +522,37 @@ namespace ts { if (hasProperty(optionNameMap, s)) { const opt = optionNameMap[s]; - // Check to see if no argument was provided (e.g. "--locale" is the last command-line argument). - if (!args[i] && opt.type !== "boolean") { - errors.push(createCompilerDiagnostic(Diagnostics.Compiler_option_0_expects_an_argument, opt.name)); + if (opt.isTSConfigOnly) { + errors.push(createCompilerDiagnostic(Diagnostics.Option_0_can_only_be_specified_in_tsconfig_json_file, opt.name)); } + else { + // Check to see if no argument was provided (e.g. "--locale" is the last command-line argument). + if (!args[i] && opt.type !== "boolean") { + errors.push(createCompilerDiagnostic(Diagnostics.Compiler_option_0_expects_an_argument, opt.name)); + } - switch (opt.type) { - case "number": - options[opt.name] = parseInt(args[i]); - i++; - break; - case "boolean": - options[opt.name] = true; - break; - case "string": - options[opt.name] = args[i] || ""; - i++; - break; - // If not a primitive, the possible types are specified in what is effectively a map of options. - default: - let map = >opt.type; - let key = (args[i] || "").toLowerCase(); - i++; - if (hasProperty(map, key)) { - options[opt.name] = map[key]; - } - else { - errors.push(createCompilerDiagnostic((opt).error)); - } + switch (opt.type) { + case "number": + options[opt.name] = parseInt(args[i]); + i++; + break; + case "boolean": + options[opt.name] = true; + break; + case "string": + options[opt.name] = args[i] || ""; + i++; + break; + case "list": + options[opt.name] = parseListTypeOption(opt, args[i], errors); + i++; + break; + // If not a primitive, the possible types are specified in what is effectively a map of options. + default: + options[opt.name] = parseCustomTypeOption(opt, args[i], errors); + i++; + break; + } } } else { @@ -428,7 +603,7 @@ namespace ts { * Read tsconfig.json file * @param fileName The path to the config file */ - export function readConfigFile(fileName: string, readFile: (path: string) => string): { config?: any; error?: Diagnostic } { + export function readConfigFile(fileName: string, readFile: (path: string) => string): { config?: any; error?: Diagnostic } { let text = ""; try { text = readFile(fileName); @@ -454,7 +629,6 @@ namespace ts { } } - /** * Remove the comments from a json like text. * Comments can be single line comments (starting with # or //) or multiline comments using / * * / @@ -480,7 +654,9 @@ namespace ts { return output; } - + // Skip over any minified JavaScript files (ending in ".min.js") + // Skip over dotted files and folders as well + const IgnoreFileNamePattern = /(\.min\.js$)|([\\/]\.[\w.])/; /** * Parse the contents of a config file (tsconfig.json). * @param json The contents of the config file to parse @@ -488,19 +664,26 @@ namespace ts { * @param basePath A root directory to resolve relative path entries in the config * file to. e.g. outDir */ - export function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions: CompilerOptions = {}): ParsedCommandLine { - const { options: optionsFromJsonConfigFile, errors } = convertCompilerOptionsFromJson(json["compilerOptions"], basePath); + export function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions: CompilerOptions = {}, configFileName?: string): ParsedCommandLine { + const errors: Diagnostic[] = []; + const compilerOptions: CompilerOptions = convertCompilerOptionsFromJsonWorker(json["compilerOptions"], basePath, errors, configFileName); + const options = extend(existingOptions, compilerOptions); + const typingOptions: TypingOptions = convertTypingOptionsFromJsonWorker(json["typingOptions"], basePath, errors, configFileName); + + options.configFilePath = configFileName; + + const { fileNames, wildcardDirectories } = getFileNames(errors); - const options = extend(existingOptions, optionsFromJsonConfigFile); - const { fileNames, wildcardDirectories } = getFileNames(); return { options, fileNames, + typingOptions, + raw: json, errors, wildcardDirectories }; - function getFileNames(): ExpandResult { + function getFileNames(errors: Diagnostic[]): ExpandResult { let fileNames: string[]; if (hasProperty(json, "files")) { if (isArray(json["files"])) { @@ -539,12 +722,41 @@ namespace ts { } } - export function convertCompilerOptionsFromJson(jsonOptions: any, basePath: string): { options: CompilerOptions, errors: Diagnostic[] } { - const options: CompilerOptions = {}; + export function convertCompilerOptionsFromJson(jsonOptions: any, basePath: string, configFileName?: string): { options: CompilerOptions, errors: Diagnostic[] } { const errors: Diagnostic[] = []; + const options = convertCompilerOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName); + return { options, errors }; + } + + export function convertTypingOptionsFromJson(jsonOptions: any, basePath: string, configFileName?: string): { options: CompilerOptions, errors: Diagnostic[] } { + const errors: Diagnostic[] = []; + const options = convertTypingOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName); + return { options, errors }; + } + + function convertCompilerOptionsFromJsonWorker(jsonOptions: any, + basePath: string, errors: Diagnostic[], configFileName?: string): CompilerOptions { + + const options: CompilerOptions = getBaseFileName(configFileName) === "jsconfig.json" ? { allowJs: true } : {}; + convertOptionsFromJson(optionDeclarations, jsonOptions, basePath, options, Diagnostics.Unknown_compiler_option_0, errors); + return options; + } + + function convertTypingOptionsFromJsonWorker(jsonOptions: any, + basePath: string, errors: Diagnostic[], configFileName?: string): TypingOptions { + + const options: TypingOptions = getBaseFileName(configFileName) === "jsconfig.json" + ? { enableAutoDiscovery: true, include: [], exclude: [] } + : { enableAutoDiscovery: false, include: [], exclude: [] }; + convertOptionsFromJson(typingOptionDeclarations, jsonOptions, basePath, options, Diagnostics.Unknown_typing_option_0, errors); + return options; + } + + function convertOptionsFromJson(optionDeclarations: CommandLineOption[], jsonOptions: any, basePath: string, + defaultOptions: CompilerOptions | TypingOptions, diagnosticMessage: DiagnosticMessage, errors: Diagnostic[]) { if (!jsonOptions) { - return { options, errors }; + return; } const optionNameMap = arrayToMap(optionDeclarations, opt => opt.name); @@ -552,38 +764,55 @@ namespace ts { for (const id in jsonOptions) { if (hasProperty(optionNameMap, id)) { const opt = optionNameMap[id]; - const optType = opt.type; - let value = jsonOptions[id]; - const expectedType = typeof optType === "string" ? optType : "string"; - if (typeof value === expectedType) { - if (typeof optType !== "string") { - const key = value.toLowerCase(); - if (hasProperty(optType, key)) { - value = optType[key]; - } - else { - errors.push(createCompilerDiagnostic((opt).error)); - value = 0; - } - } - if (opt.isFilePath) { - value = normalizePath(combinePaths(basePath, value)); - if (value === "") { - value = "."; - } - } - options[opt.name] = value; - } - else { - errors.push(createCompilerDiagnostic(Diagnostics.Compiler_option_0_requires_a_value_of_type_1, id, expectedType)); - } + defaultOptions[opt.name] = convertJsonOption(opt, jsonOptions[id], basePath, errors); } else { - errors.push(createCompilerDiagnostic(Diagnostics.Unknown_compiler_option_0, id)); + errors.push(createCompilerDiagnostic(diagnosticMessage, id)); } } + } - return { options, errors }; + function convertJsonOption(opt: CommandLineOption, value: any, basePath: string, errors: Diagnostic[]): CompilerOptionsValue { + const optType = opt.type; + const expectedType = typeof optType === "string" ? optType : "string"; + if (optType === "list" && isArray(value)) { + return convertJsonOptionOfListType(opt, value, basePath, errors); + } + else if (typeof value === expectedType) { + if (typeof optType !== "string") { + return convertJsonOptionOfCustomType(opt, value, errors); + } + else { + if (opt.isFilePath) { + value = normalizePath(combinePaths(basePath, value)); + if (value === "") { + value = "."; + } + } + } + return value; + } + else { + errors.push(createCompilerDiagnostic(Diagnostics.Compiler_option_0_requires_a_value_of_type_1, opt.name, expectedType)); + } + } + + function convertJsonOptionOfCustomType(opt: CommandLineOptionOfCustomType, value: string, errors: Diagnostic[]) { + const key = value.toLowerCase(); + if (hasProperty(opt.type, key)) { + return opt.type[key]; + } + else { + errors.push(createCompilerDiagnosticForInvalidCustomType(opt)); + } + } + + function convertJsonOptionOfListType(option: CommandLineOptionOfListType, values: any[], basePath: string, errors: Diagnostic[]): any[] { + return filter(map(values, v => convertJsonOption(option.element, v, basePath, errors)), v => !!v); + } + + function trimString(s: string) { + return typeof s.trim === "function" ? s.trim() : s.replace(/^[\s]+|[\s]+$/g, ""); } /** diff --git a/src/compiler/core.ts b/src/compiler/core.ts index d0f27a2046f..ae489ad553c 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -74,8 +74,6 @@ namespace ts { GreaterThan = 1 } - export interface StringSet extends Map { } - /** * 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. @@ -93,10 +91,10 @@ namespace ts { return undefined; } - export function contains(array: T[], value: T): boolean { + export function contains(array: T[], value: T, areEqual?: (a: T, b: T) => boolean): boolean { if (array) { for (const v of array) { - if (v === value) { + if (areEqual ? areEqual(v, value) : v === value) { return true; } } @@ -167,12 +165,12 @@ namespace ts { return array1.concat(array2); } - export function deduplicate(array: T[]): T[] { + export function deduplicate(array: T[], areEqual?: (a: T, b: T) => boolean): T[] { let result: T[]; if (array) { result = []; for (const item of array) { - if (!contains(result, item)) { + if (!contains(result, item, areEqual)) { result.push(item); } } @@ -253,8 +251,14 @@ namespace ts { const count = array.length; if (count > 0) { let pos = 0; - let result = arguments.length <= 2 ? array[pos] : initial; - pos++; + let result: T | U; + if (arguments.length <= 2) { + result = array[pos]; + pos++; + } + else { + result = initial; + } while (pos < count) { result = f(result, array[pos]); pos++; @@ -271,8 +275,14 @@ namespace ts { if (array) { let pos = array.length - 1; if (pos >= 0) { - let result = arguments.length <= 2 ? array[pos] : initial; - pos--; + let result: T | U; + if (arguments.length <= 2) { + result = array[pos]; + pos--; + } + else { + result = initial; + } while (pos >= 0) { result = f(result, array[pos]); pos--; @@ -289,6 +299,14 @@ namespace ts { return hasOwnProperty.call(map, key); } + export function getKeys(map: Map): string[] { + const keys: string[] = []; + for (const key in map) { + keys.push(key); + } + return keys; + } + export function getProperty(map: Map, key: string): T { return hasOwnProperty.call(map, key) ? map[key] : undefined; } @@ -450,6 +468,17 @@ namespace ts { }; } + /* internal */ + export function formatMessage(dummy: any, message: DiagnosticMessage): string { + let text = getLocaleSpecificMessage(message); + + if (arguments.length > 2) { + text = formatStringFromArgs(text, arguments, 2); + } + + return text; + } + export function createCompilerDiagnostic(message: DiagnosticMessage, ...args: any[]): Diagnostic; export function createCompilerDiagnostic(message: DiagnosticMessage): Diagnostic { let text = getLocaleSpecificMessage(message); @@ -647,7 +676,9 @@ namespace ts { return path.substr(0, rootLength) + normalized.join(directorySeparator); } - export function getDirectoryPath(path: string) { + export function getDirectoryPath(path: Path): Path; + export function getDirectoryPath(path: string): string; + export function getDirectoryPath(path: string): any { return path.substr(0, Math.max(getRootLength(path), path.lastIndexOf(directorySeparator))); } @@ -687,7 +718,7 @@ namespace ts { } function getNormalizedPathComponentsOfUrl(url: string) { - // Get root length of http://www.website.com/folder1/foler2/ + // Get root length of http://www.website.com/folder1/folder2/ // In this example the root is: http://www.website.com/ // normalized path components should be ["http://www.website.com/", "folder1", "folder2"] @@ -715,7 +746,7 @@ namespace ts { const indexOfNextSlash = url.indexOf(directorySeparator, rootLength); if (indexOfNextSlash !== -1) { // Found the "/" after the website.com so the root is length of http://www.website.com/ - // and get components afetr the root normally like any other folder components + // and get components after the root normally like any other folder components rootLength = indexOfNextSlash + 1; return normalizedPathComponents(url, rootLength); } @@ -747,7 +778,8 @@ namespace ts { } // Find the component that differs - for (var joinStartIndex = 0; joinStartIndex < pathComponents.length && joinStartIndex < directoryComponents.length; joinStartIndex++) { + let joinStartIndex: number; + for (joinStartIndex = 0; joinStartIndex < pathComponents.length && joinStartIndex < directoryComponents.length; joinStartIndex++) { if (getCanonicalFileName(directoryComponents[joinStartIndex]) !== getCanonicalFileName(pathComponents[joinStartIndex])) { break; } @@ -1035,6 +1067,32 @@ namespace ts { return basePaths; } + + export function ensureScriptKind(fileName: string, scriptKind?: ScriptKind): 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)) || ScriptKind.TS; + } + + export function getScriptKindFromFileName(fileName: string): ScriptKind { + const ext = fileName.substr(fileName.lastIndexOf(".")); + switch (ext.toLowerCase()) { + case ".js": + return ScriptKind.JS; + case ".jsx": + return ScriptKind.JSX; + case ".ts": + return ScriptKind.TS; + case ".tsx": + return ScriptKind.TSX; + default: + return ScriptKind.Unknown; + } + } /** * List of supported extensions in order of file resolution precedence. @@ -1201,4 +1259,11 @@ namespace ts { } return copiedList; } + + export function createGetCanonicalFileName(useCaseSensitivefileNames: boolean): (fileName: string) => string { + return useCaseSensitivefileNames + ? ((fileName) => fileName) + : ((fileName) => fileName.toLowerCase()); + } + } diff --git a/src/compiler/declarationEmitter.ts b/src/compiler/declarationEmitter.ts index 75319d0ab51..397b135bf23 100644 --- a/src/compiler/declarationEmitter.ts +++ b/src/compiler/declarationEmitter.ts @@ -15,10 +15,10 @@ namespace ts { reportedDeclarationError: boolean; moduleElementDeclarationEmitInfo: ModuleElementDeclarationEmitInfo[]; synchronousDeclarationOutput: string; - referencePathsOutput: string; + referencesOutput: string; } - type GetSymbolAccessibilityDiagnostic = (symbolAccesibilityResult: SymbolAccessiblityResult) => SymbolAccessibilityDiagnostic; + type GetSymbolAccessibilityDiagnostic = (symbolAccessibilityResult: SymbolAccessibilityResult) => SymbolAccessibilityDiagnostic; interface EmitTextWriterWithSymbolWriter extends EmitTextWriter, SymbolWriter { getSymbolAccessibilityDiagnostic: GetSymbolAccessibilityDiagnostic; @@ -33,9 +33,9 @@ namespace ts { export function getDeclarationDiagnostics(host: EmitHost, resolver: EmitResolver, targetSourceFile: SourceFile): Diagnostic[] { const declarationDiagnostics = createDiagnosticCollection(); forEachExpectedEmitFile(host, getDeclarationDiagnosticsFromFile, targetSourceFile); - return declarationDiagnostics.getDiagnostics(targetSourceFile.fileName); + return declarationDiagnostics.getDiagnostics(targetSourceFile ? targetSourceFile.fileName : undefined); - function getDeclarationDiagnosticsFromFile({ declarationFilePath }, sources: SourceFile[], isBundledEmit: boolean) { + function getDeclarationDiagnosticsFromFile({ declarationFilePath }: EmitFileNames, sources: SourceFile[], isBundledEmit: boolean) { emitDeclarations(host, resolver, declarationDiagnostics, declarationFilePath, sources, isBundledEmit); } } @@ -51,9 +51,12 @@ namespace ts { let decreaseIndent: () => void; let writeTextOfNode: (text: string, node: Node) => void; - let writer = createAndSetNewTextWriterWithSymbolWriter(); + let writer: EmitTextWriterWithSymbolWriter; + + createAndSetNewTextWriterWithSymbolWriter(); let enclosingDeclaration: Node; + let resultHasExternalModuleIndicator: boolean; let currentText: string; let currentLineMap: number[]; let currentIdentifiers: Map; @@ -70,7 +73,9 @@ namespace ts { // Contains the reference paths that needs to go in the declaration file. // Collecting this separately because reference paths need to be first thing in the declaration file // and we could be collecting these paths from multiple files into single one with --out option - let referencePathsOutput = ""; + let referencesOutput = ""; + + let usedTypeDirectiveReferences: Map; // Emit references corresponding to each file const emittedReferencedFiles: SourceFile[] = []; @@ -101,6 +106,7 @@ namespace ts { }); } + resultHasExternalModuleIndicator = false; if (!isBundledEmit || !isExternalModule(sourceFile)) { noDeclare = false; emitSourceFile(sourceFile); @@ -139,13 +145,29 @@ namespace ts { allSourcesModuleElementDeclarationEmitInfo = allSourcesModuleElementDeclarationEmitInfo.concat(moduleElementDeclarationEmitInfo); moduleElementDeclarationEmitInfo = []; } + + if (!isBundledEmit && isExternalModule(sourceFile) && sourceFile.moduleAugmentations.length && !resultHasExternalModuleIndicator) { + // if file was external module with augmentations - this fact should be preserved in .d.ts as well. + // in case if we didn't write any external module specifiers in .d.ts we need to emit something + // that will force compiler to think that this file is an external module - 'export {}' is a reasonable choice here. + write("export {};"); + writeLine(); + } }); + if (usedTypeDirectiveReferences) { + for (const directive in usedTypeDirectiveReferences) { + if (hasProperty(usedTypeDirectiveReferences, directive)) { + referencesOutput += `/// ${newLine}`; + } + } + } + return { reportedDeclarationError, moduleElementDeclarationEmitInfo: allSourcesModuleElementDeclarationEmitInfo, synchronousDeclarationOutput: writer.getText(), - referencePathsOutput, + referencesOutput, }; function hasInternalAnnotation(range: CommentRange) { @@ -164,7 +186,7 @@ namespace ts { } } - function createAndSetNewTextWriterWithSymbolWriter(): EmitTextWriterWithSymbolWriter { + function createAndSetNewTextWriterWithSymbolWriter(): void { const writer = createTextWriter(newLine); writer.trackSymbol = trackSymbol; writer.reportInaccessibleThisError = reportInaccessibleThisError; @@ -176,7 +198,6 @@ namespace ts { writer.writeParameter = writer.write; writer.writeSymbol = writer.write; setWriter(writer); - return writer; } function setWriter(newWriter: EmitTextWriterWithSymbolWriter) { @@ -242,30 +263,45 @@ namespace ts { setWriter(oldWriter); } - function handleSymbolAccessibilityError(symbolAccesibilityResult: SymbolAccessiblityResult) { - if (symbolAccesibilityResult.accessibility === SymbolAccessibility.Accessible) { + function recordTypeReferenceDirectivesIfNecessary(typeReferenceDirectives: string[]): void { + if (!typeReferenceDirectives) { + return; + } + + if (!usedTypeDirectiveReferences) { + usedTypeDirectiveReferences = {}; + } + for (const directive of typeReferenceDirectives) { + if (!hasProperty(usedTypeDirectiveReferences, directive)) { + usedTypeDirectiveReferences[directive] = directive; + } + } + } + + function handleSymbolAccessibilityError(symbolAccessibilityResult: SymbolAccessibilityResult) { + if (symbolAccessibilityResult.accessibility === SymbolAccessibility.Accessible) { // write the aliases - if (symbolAccesibilityResult && symbolAccesibilityResult.aliasesToMakeVisible) { - writeAsynchronousModuleElements(symbolAccesibilityResult.aliasesToMakeVisible); + if (symbolAccessibilityResult && symbolAccessibilityResult.aliasesToMakeVisible) { + writeAsynchronousModuleElements(symbolAccessibilityResult.aliasesToMakeVisible); } } else { // Report error reportedDeclarationError = true; - const errorInfo = writer.getSymbolAccessibilityDiagnostic(symbolAccesibilityResult); + const errorInfo = writer.getSymbolAccessibilityDiagnostic(symbolAccessibilityResult); if (errorInfo) { if (errorInfo.typeName) { - emitterDiagnostics.add(createDiagnosticForNode(symbolAccesibilityResult.errorNode || errorInfo.errorNode, + emitterDiagnostics.add(createDiagnosticForNode(symbolAccessibilityResult.errorNode || errorInfo.errorNode, errorInfo.diagnosticMessage, getTextOfNodeFromSourceText(currentText, errorInfo.typeName), - symbolAccesibilityResult.errorSymbolName, - symbolAccesibilityResult.errorModuleName)); + symbolAccessibilityResult.errorSymbolName, + symbolAccessibilityResult.errorModuleName)); } else { - emitterDiagnostics.add(createDiagnosticForNode(symbolAccesibilityResult.errorNode || errorInfo.errorNode, + emitterDiagnostics.add(createDiagnosticForNode(symbolAccessibilityResult.errorNode || errorInfo.errorNode, errorInfo.diagnosticMessage, - symbolAccesibilityResult.errorSymbolName, - symbolAccesibilityResult.errorModuleName)); + symbolAccessibilityResult.errorSymbolName, + symbolAccessibilityResult.errorModuleName)); } } } @@ -273,6 +309,7 @@ namespace ts { function trackSymbol(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags) { handleSymbolAccessibilityError(resolver.isSymbolAccessible(symbol, enclosingDeclaration, meaning)); + recordTypeReferenceDirectivesIfNecessary(resolver.getTypeReferenceDirectivesForSymbol(symbol, meaning)); } function reportInaccessibleThisError() { @@ -356,6 +393,9 @@ namespace ts { case SyntaxKind.BooleanKeyword: case SyntaxKind.SymbolKeyword: case SyntaxKind.VoidKeyword: + case SyntaxKind.UndefinedKeyword: + case SyntaxKind.NullKeyword: + case SyntaxKind.NeverKeyword: case SyntaxKind.ThisType: case SyntaxKind.StringLiteralType: return writeTextOfNode(currentText, type); @@ -407,6 +447,7 @@ namespace ts { entityName.parent.kind === SyntaxKind.ImportEqualsDeclaration ? entityName.parent : enclosingDeclaration); handleSymbolAccessibilityError(visibilityResult); + recordTypeReferenceDirectivesIfNecessary(resolver.getTypeReferenceDirectivesForEntityName(entityName)); writeEntityName(entityName); } @@ -517,7 +558,10 @@ namespace ts { else { // Expression const tempVarName = getExportDefaultTempVariableName(); - write("declare var "); + if (!noDeclare) { + write("declare "); + } + write("var "); write(tempVarName); write(": "); writer.getSymbolAccessibilityDiagnostic = getDefaultExportAccessibilityDiagnostic; @@ -538,7 +582,7 @@ namespace ts { writeAsynchronousModuleElements(nodes); } - function getDefaultExportAccessibilityDiagnostic(diagnostic: SymbolAccessiblityResult): SymbolAccessibilityDiagnostic { + function getDefaultExportAccessibilityDiagnostic(diagnostic: SymbolAccessibilityResult): SymbolAccessibilityDiagnostic { return { diagnosticMessage: Diagnostics.Default_export_of_the_module_has_or_is_using_private_name_0, errorNode: node @@ -627,18 +671,21 @@ namespace ts { } } - function emitClassMemberDeclarationFlags(node: Declaration) { - if (node.flags & NodeFlags.Private) { + function emitClassMemberDeclarationFlags(flags: NodeFlags) { + if (flags & NodeFlags.Private) { write("private "); } - else if (node.flags & NodeFlags.Protected) { + else if (flags & NodeFlags.Protected) { write("protected "); } - if (node.flags & NodeFlags.Static) { + if (flags & NodeFlags.Static) { write("static "); } - if (node.flags & NodeFlags.Abstract) { + if (flags & NodeFlags.Readonly) { + write("readonly "); + } + if (flags & NodeFlags.Abstract) { write("abstract "); } } @@ -664,7 +711,7 @@ namespace ts { } writer.writeLine(); - function getImportEntityNameVisibilityError(symbolAccesibilityResult: SymbolAccessiblityResult): SymbolAccessibilityDiagnostic { + function getImportEntityNameVisibilityError(symbolAccessibilityResult: SymbolAccessibilityResult): SymbolAccessibilityDiagnostic { return { diagnosticMessage: Diagnostics.Import_declaration_0_is_using_private_name_1, errorNode: node, @@ -685,10 +732,6 @@ namespace ts { } function writeImportDeclaration(node: ImportDeclaration) { - if (!node.importClause && !(node.flags & NodeFlags.Export)) { - // do not write non-exported import declarations that don't have import clauses - return; - } emitJsDocComments(node); if (node.flags & NodeFlags.Export) { write("export "); @@ -721,22 +764,31 @@ namespace ts { writer.writeLine(); } - function emitExternalModuleSpecifier(parent: ImportEqualsDeclaration | ImportDeclaration | ExportDeclaration) { + function emitExternalModuleSpecifier(parent: ImportEqualsDeclaration | ImportDeclaration | ExportDeclaration | ModuleDeclaration) { + // emitExternalModuleSpecifier is usually called when we emit something in the.d.ts file that will make it an external module (i.e. import/export declarations). + // the only case when it is not true is when we call it to emit correct name for module augmentation - d.ts files with just module augmentations are not considered + // external modules since they are indistinguishable from script files with ambient modules. To fix this in such d.ts files we'll emit top level 'export {}' + // so compiler will treat them as external modules. + resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || parent.kind !== SyntaxKind.ModuleDeclaration; let moduleSpecifier: Node; if (parent.kind === SyntaxKind.ImportEqualsDeclaration) { const node = parent as ImportEqualsDeclaration; moduleSpecifier = getExternalModuleImportEqualsDeclarationExpression(node); } + else if (parent.kind === SyntaxKind.ModuleDeclaration) { + moduleSpecifier = (parent).name; + } else { const node = parent as (ImportDeclaration | ExportDeclaration); moduleSpecifier = node.moduleSpecifier; } + if (moduleSpecifier.kind === SyntaxKind.StringLiteral && isBundledEmit && (compilerOptions.out || compilerOptions.outFile)) { const moduleName = getExternalModuleNameFromDeclaration(host, resolver, parent); if (moduleName) { - write("\""); + write('"'); write(moduleName); - write("\""); + write('"'); return; } } @@ -784,13 +836,23 @@ namespace ts { function writeModuleDeclaration(node: ModuleDeclaration) { emitJsDocComments(node); emitModuleElementDeclarationFlags(node); - if (node.flags & NodeFlags.Namespace) { - write("namespace "); + if (isGlobalScopeAugmentation(node)) { + write("global "); } else { - write("module "); + if (node.flags & NodeFlags.Namespace) { + write("namespace "); + } + else { + write("module "); + } + if (isExternalModuleAugmentation(node)) { + emitExternalModuleSpecifier(node); + } + else { + writeTextOfNode(currentText, node.name); + } } - writeTextOfNode(currentText, node.name); while (node.body.kind !== SyntaxKind.ModuleBlock) { node = node.body; write("."); @@ -822,7 +884,7 @@ namespace ts { writeLine(); enclosingDeclaration = prevEnclosingDeclaration; - function getTypeAliasDeclarationVisibilityError(symbolAccesibilityResult: SymbolAccessiblityResult): SymbolAccessibilityDiagnostic { + function getTypeAliasDeclarationVisibilityError(symbolAccessibilityResult: SymbolAccessibilityResult): SymbolAccessibilityDiagnostic { return { diagnosticMessage: Diagnostics.Exported_type_alias_0_has_or_is_using_private_name_1, errorNode: node.type, @@ -889,7 +951,7 @@ namespace ts { } } - function getTypeParameterConstraintVisibilityError(symbolAccesibilityResult: SymbolAccessiblityResult): SymbolAccessibilityDiagnostic { + function getTypeParameterConstraintVisibilityError(symbolAccessibilityResult: SymbolAccessibilityResult): SymbolAccessibilityDiagnostic { // Type parameter constraints are named by user so we should always be able to name it let diagnosticMessage: DiagnosticMessage; switch (node.parent.kind) { @@ -958,8 +1020,12 @@ namespace ts { else if (!isImplementsList && node.expression.kind === SyntaxKind.NullKeyword) { write("null"); } + else { + writer.getSymbolAccessibilityDiagnostic = getHeritageClauseVisibilityError; + resolver.writeBaseConstructorTypeOfClass(enclosingDeclaration, enclosingDeclaration, TypeFormatFlags.UseTypeOfFunction, writer); + } - function getHeritageClauseVisibilityError(symbolAccesibilityResult: SymbolAccessiblityResult): SymbolAccessibilityDiagnostic { + function getHeritageClauseVisibilityError(symbolAccessibilityResult: SymbolAccessibilityResult): SymbolAccessibilityDiagnostic { let diagnosticMessage: DiagnosticMessage; // Heritage clause is written by user so it can always be named if (node.parent.parent.kind === SyntaxKind.ClassDeclaration) { @@ -986,7 +1052,7 @@ namespace ts { function emitParameterProperties(constructorDeclaration: ConstructorDeclaration) { if (constructorDeclaration) { forEach(constructorDeclaration.parameters, param => { - if (param.flags & NodeFlags.AccessibilityModifier) { + if (param.flags & NodeFlags.ParameterPropertyModifier) { emitPropertyDeclaration(param); } }); @@ -1045,7 +1111,7 @@ namespace ts { } emitJsDocComments(node); - emitClassMemberDeclarationFlags(node); + emitClassMemberDeclarationFlags(node.flags); emitVariableDeclaration(node); write(";"); writeLine(); @@ -1064,7 +1130,7 @@ namespace ts { // what we want, namely the name expression enclosed in brackets. writeTextOfNode(currentText, node.name); // If optional property emit ? - if ((node.kind === SyntaxKind.PropertyDeclaration || node.kind === SyntaxKind.PropertySignature) && hasQuestionToken(node)) { + if ((node.kind === SyntaxKind.PropertyDeclaration || node.kind === SyntaxKind.PropertySignature || node.kind === SyntaxKind.Parameter) && hasQuestionToken(node)) { write("?"); } if ((node.kind === SyntaxKind.PropertyDeclaration || node.kind === SyntaxKind.PropertySignature) && node.parent.kind === SyntaxKind.TypeLiteral) { @@ -1076,10 +1142,10 @@ namespace ts { } } - function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult: SymbolAccessiblityResult) { + function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult: SymbolAccessibilityResult) { if (node.kind === SyntaxKind.VariableDeclaration) { - return symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ? + return symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ? Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 : Diagnostics.Exported_variable_0_has_or_is_using_private_name_1; @@ -1088,30 +1154,30 @@ namespace ts { else if (node.kind === SyntaxKind.PropertyDeclaration || node.kind === SyntaxKind.PropertySignature) { // TODO(jfreeman): Deal with computed properties in error reporting. if (node.flags & NodeFlags.Static) { - return symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ? + return symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ? Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; } else if (node.parent.kind === SyntaxKind.ClassDeclaration) { - return symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ? + return symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ? Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : Diagnostics.Public_property_0_of_exported_class_has_or_is_using_private_name_1; } else { // Interfaces cannot have types that cannot be named - return symbolAccesibilityResult.errorModuleName ? + return symbolAccessibilityResult.errorModuleName ? Diagnostics.Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 : Diagnostics.Property_0_of_exported_interface_has_or_is_using_private_name_1; } } } - function getVariableDeclarationTypeVisibilityError(symbolAccesibilityResult: SymbolAccessiblityResult): SymbolAccessibilityDiagnostic { - const diagnosticMessage = getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult); + function getVariableDeclarationTypeVisibilityError(symbolAccessibilityResult: SymbolAccessibilityResult): SymbolAccessibilityDiagnostic { + const diagnosticMessage = getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult); return diagnosticMessage !== undefined ? { diagnosticMessage, errorNode: node, @@ -1135,8 +1201,8 @@ namespace ts { } function emitBindingElement(bindingElement: BindingElement) { - function getBindingElementTypeVisibilityError(symbolAccesibilityResult: SymbolAccessiblityResult): SymbolAccessibilityDiagnostic { - const diagnosticMessage = getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult); + function getBindingElementTypeVisibilityError(symbolAccessibilityResult: SymbolAccessibilityResult): SymbolAccessibilityDiagnostic { + const diagnosticMessage = getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult); return diagnosticMessage !== undefined ? { diagnosticMessage, errorNode: bindingElement, @@ -1198,7 +1264,7 @@ namespace ts { if (node === accessors.firstAccessor) { emitJsDocComments(accessors.getAccessor); emitJsDocComments(accessors.setAccessor); - emitClassMemberDeclarationFlags(node); + emitClassMemberDeclarationFlags(node.flags | (accessors.setAccessor ? 0 : NodeFlags.Readonly)); writeTextOfNode(currentText, node.name); if (!(node.flags & NodeFlags.Private)) { accessorWithTypeAnnotation = node; @@ -1227,17 +1293,17 @@ namespace ts { } } - function getAccessorDeclarationTypeVisibilityError(symbolAccesibilityResult: SymbolAccessiblityResult): SymbolAccessibilityDiagnostic { + function getAccessorDeclarationTypeVisibilityError(symbolAccessibilityResult: SymbolAccessibilityResult): SymbolAccessibilityDiagnostic { let diagnosticMessage: DiagnosticMessage; if (accessorWithTypeAnnotation.kind === SyntaxKind.SetAccessor) { // Setters have to have type named and cannot infer it so, the type should always be named if (accessorWithTypeAnnotation.parent.flags & NodeFlags.Static) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1; } else { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1; } @@ -1250,15 +1316,15 @@ namespace ts { } else { if (accessorWithTypeAnnotation.flags & NodeFlags.Static) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ? + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ? Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 : Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0; } else { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ? + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ? Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 : Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0; @@ -1284,8 +1350,8 @@ namespace ts { if (node.kind === SyntaxKind.FunctionDeclaration) { emitModuleElementDeclarationFlags(node); } - else if (node.kind === SyntaxKind.MethodDeclaration) { - emitClassMemberDeclarationFlags(node); + else if (node.kind === SyntaxKind.MethodDeclaration || node.kind === SyntaxKind.Constructor) { + emitClassMemberDeclarationFlags(node.flags); } if (node.kind === SyntaxKind.FunctionDeclaration) { write("function "); @@ -1312,16 +1378,29 @@ namespace ts { function emitSignatureDeclaration(node: SignatureDeclaration) { const prevEnclosingDeclaration = enclosingDeclaration; enclosingDeclaration = node; + let closeParenthesizedFunctionType = false; - // Construct signature or constructor type write new Signature - if (node.kind === SyntaxKind.ConstructSignature || node.kind === SyntaxKind.ConstructorType) { - write("new "); - } - emitTypeParameters(node.typeParameters); if (node.kind === SyntaxKind.IndexSignature) { + // Index signature can have readonly modifier + emitClassMemberDeclarationFlags(node.flags); write("["); } else { + // Construct signature or constructor type write new Signature + if (node.kind === SyntaxKind.ConstructSignature || node.kind === SyntaxKind.ConstructorType) { + write("new "); + } + else if (node.kind === SyntaxKind.FunctionType) { + const currentOutput = writer.getText(); + // Do not generate incorrect type when function type with type parameters is type argument + // This could happen if user used space between two '<' making it error free + // e.g var x: A< (a: Tany)=>Tany>; + if (node.typeParameters && currentOutput.charAt(currentOutput.length - 1) === "<") { + closeParenthesizedFunctionType = true; + write("("); + } + } + emitTypeParameters(node.typeParameters); write("("); } @@ -1354,27 +1433,30 @@ namespace ts { write(";"); writeLine(); } + else if (closeParenthesizedFunctionType) { + write(")"); + } - function getReturnTypeVisibilityError(symbolAccesibilityResult: SymbolAccessiblityResult): SymbolAccessibilityDiagnostic { + function getReturnTypeVisibilityError(symbolAccessibilityResult: SymbolAccessibilityResult): SymbolAccessibilityDiagnostic { let diagnosticMessage: DiagnosticMessage; switch (node.kind) { case SyntaxKind.ConstructSignature: // Interfaces cannot have return types that cannot be named - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0; break; case SyntaxKind.CallSignature: // Interfaces cannot have return types that cannot be named - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0; break; case SyntaxKind.IndexSignature: // Interfaces cannot have return types that cannot be named - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0; break; @@ -1382,30 +1464,30 @@ namespace ts { case SyntaxKind.MethodDeclaration: case SyntaxKind.MethodSignature: if (node.flags & NodeFlags.Static) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ? + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ? Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0; } else if (node.parent.kind === SyntaxKind.ClassDeclaration) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ? + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ? Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0; } else { // Interfaces cannot have return types that cannot be named - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; case SyntaxKind.FunctionDeclaration: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ? + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ? Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1 : Diagnostics.Return_type_of_exported_function_has_or_is_using_private_name_0; @@ -1451,8 +1533,8 @@ namespace ts { writeTypeOfDeclaration(node, node.type, getParameterDeclarationTypeVisibilityError); } - function getParameterDeclarationTypeVisibilityError(symbolAccesibilityResult: SymbolAccessiblityResult): SymbolAccessibilityDiagnostic { - const diagnosticMessage: DiagnosticMessage = getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult); + function getParameterDeclarationTypeVisibilityError(symbolAccessibilityResult: SymbolAccessibilityResult): SymbolAccessibilityDiagnostic { + const diagnosticMessage: DiagnosticMessage = getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult); return diagnosticMessage !== undefined ? { diagnosticMessage, errorNode: node, @@ -1460,53 +1542,53 @@ namespace ts { } : undefined; } - function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult: SymbolAccessiblityResult): DiagnosticMessage { + function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult: SymbolAccessibilityResult): DiagnosticMessage { switch (node.parent.kind) { case SyntaxKind.Constructor: - return symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ? + return symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ? Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 : Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1; case SyntaxKind.ConstructSignature: // Interfaces cannot have parameter types that cannot be named - return symbolAccesibilityResult.errorModuleName ? + return symbolAccessibilityResult.errorModuleName ? Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; case SyntaxKind.CallSignature: // Interfaces cannot have parameter types that cannot be named - return symbolAccesibilityResult.errorModuleName ? + return symbolAccessibilityResult.errorModuleName ? Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; case SyntaxKind.MethodDeclaration: case SyntaxKind.MethodSignature: if (node.parent.flags & NodeFlags.Static) { - return symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ? + return symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ? Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } else if (node.parent.parent.kind === SyntaxKind.ClassDeclaration) { - return symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ? + return symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ? Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { // Interfaces cannot have parameter types that cannot be named - return symbolAccesibilityResult.errorModuleName ? + return symbolAccessibilityResult.errorModuleName ? Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } case SyntaxKind.FunctionDeclaration: - return symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ? + return symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ? Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 : Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1; @@ -1648,7 +1730,7 @@ namespace ts { host.getCanonicalFileName, /*isAbsolutePathAnUrl*/ false); - referencePathsOutput += "/// " + newLine; + referencesOutput += `/// ${newLine}`; } return addedBundledEmitReference; @@ -1670,9 +1752,9 @@ namespace ts { const emitDeclarationResult = emitDeclarations(host, resolver, emitterDiagnostics, declarationFilePath, sourceFiles, isBundledEmit); const emitSkipped = emitDeclarationResult.reportedDeclarationError || host.isEmitBlocked(declarationFilePath) || host.getCompilerOptions().noEmit; if (!emitSkipped) { - const declarationOutput = emitDeclarationResult.referencePathsOutput + const declarationOutput = emitDeclarationResult.referencesOutput + getDeclarationOutput(emitDeclarationResult.synchronousDeclarationOutput, emitDeclarationResult.moduleElementDeclarationEmitInfo); - writeFile(host, emitterDiagnostics, declarationFilePath, declarationOutput, host.getCompilerOptions().emitBOM); + writeFile(host, emitterDiagnostics, declarationFilePath, declarationOutput, host.getCompilerOptions().emitBOM, sourceFiles); } return emitSkipped; diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 35334ffdf4d..52c7e9e9549 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1,4 +1,4 @@ - { +{ "Unterminated string literal.": { "category": "Error", "code": 1002 @@ -67,6 +67,10 @@ "category": "Error", "code": 1023 }, + "'readonly' modifier can only appear on a property declaration or index signature.": { + "category": "Error", + "code": 1024 + }, "Accessibility modifier already seen.": { "category": "Error", "code": 1028 @@ -119,7 +123,7 @@ "category": "Error", "code": 1043 }, - "'{0}' modifier cannot appear on a module element.": { + "'{0}' modifier cannot appear on a module or namespace element.": { "category": "Error", "code": 1044 }, @@ -195,6 +199,10 @@ "category": "Error", "code": 1063 }, + "The return type of an async function or method must be the global Promise type.": { + "category": "Error", + "code": 1064 + }, "In ambient enum declarations member initializer must be constant expression.": { "category": "Error", "code": 1066 @@ -203,6 +211,14 @@ "category": "Error", "code": 1068 }, + "'{0}' modifier cannot appear on a type member.": { + "category": "Error", + "code": 1070 + }, + "'{0}' modifier cannot appear on an index signature.": { + "category": "Error", + "code": 1071 + }, "A '{0}' modifier cannot be used with an import declaration.": { "category": "Error", "code": 1079 @@ -299,10 +315,6 @@ "category": "Error", "code": 1110 }, - "A class member cannot be declared optional.": { - "category": "Error", - "code": 1112 - }, "A 'default' clause cannot appear more than once in a 'switch' statement.": { "category": "Error", "code": 1113 @@ -423,10 +435,6 @@ "category": "Error", "code": 1144 }, - "Modifiers not permitted on index signature members.": { - "category": "Error", - "code": 1145 - }, "Declaration expected.": { "category": "Error", "code": 1146 @@ -435,7 +443,7 @@ "category": "Error", "code": 1147 }, - "Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file.": { + "Cannot compile modules unless the '--module' flag is provided with a valid module type. Consider setting the 'module' compiler option in a 'tsconfig.json' file.": { "category": "Error", "code": 1148 }, @@ -675,7 +683,7 @@ "category": "Error", "code": 1218 }, - "Experimental support for decorators is a feature that is subject to change in a future release. Specify '--experimentalDecorators' to remove this warning.": { + "Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning.": { "category": "Error", "code": 1219 }, @@ -767,7 +775,7 @@ "category": "Error", "code": 1241 }, - "'abstract' modifier can only appear on a class or method declaration.": { + "'abstract' modifier can only appear on a class, method, or property declaration.": { "category": "Error", "code": 1242 }, @@ -798,7 +806,19 @@ "A decorator can only decorate a method implementation, not an overload.": { "category": "Error", "code": 1249 - }, + }, + "Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'.": { + "category": "Error", + "code": 1250 + }, + "Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. Class definitions are automatically in strict mode.": { + "category": "Error", + "code": 1251 + }, + "Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. Modules are automatically in strict mode.": { + "category": "Error", + "code": 1252 + }, "'with' statements are not allowed in an async function block.": { "category": "Error", "code": 1300 @@ -819,6 +839,18 @@ "category": "Error", "code": 1313 }, + "Global module exports may only appear in module files.": { + "category": "Error", + "code": 1314 + }, + "Global module exports may only appear in declaration files.": { + "category": "Error", + "code": 1315 + }, + "Global module exports may only appear at top level.": { + "category": "Error", + "code": 1316 + }, "Duplicate identifier '{0}'.": { "category": "Error", "code": 2300 @@ -1023,7 +1055,7 @@ "category": "Error", "code": 2351 }, - "Neither type '{0}' nor type '{1}' is assignable to the other.": { + "Type '{0}' cannot be converted to type '{1}'.": { "category": "Error", "code": 2352 }, @@ -1079,6 +1111,10 @@ "category": "Error", "code": 2365 }, + "Function lacks ending return statement and return type does not include 'undefined'.": { + "category": "Error", + "code": 2366 + }, "Type parameter name cannot be '{0}'": { "category": "Error", "code": 2368 @@ -1139,7 +1175,7 @@ "category": "Error", "code": 2382 }, - "Overload signatures must all be exported or not exported.": { + "Overload signatures must all be exported or non-exported.": { "category": "Error", "code": 2383 }, @@ -1271,10 +1307,6 @@ "category": "Error", "code": 2417 }, - "Type name '{0}' in extends clause does not reference constructor function for '{0}'.": { - "category": "Error", - "code": 2419 - }, "Class '{0}' incorrectly implements interface '{1}'.": { "category": "Error", "code": 2420 @@ -1303,7 +1335,7 @@ "category": "Error", "code": 2427 }, - "All declarations of an interface must have identical type parameters.": { + "All declarations of '{0}' must have identical type parameters.": { "category": "Error", "code": 2428 }, @@ -1383,11 +1415,11 @@ "category": "Error", "code": 2448 }, - "The operand of an increment or decrement operator cannot be a constant.": { + "The operand of an increment or decrement operator cannot be a constant or a read-only property.": { "category": "Error", "code": 2449 }, - "Left-hand side of assignment expression cannot be a constant.": { + "Left-hand side of assignment expression cannot be a constant or a read-only property.": { "category": "Error", "code": 2450 }, @@ -1403,6 +1435,10 @@ "category": "Error", "code": 2453 }, + "Variable '{0}' is used before being assigned.": { + "category": "Error", + "code": 2454 + }, "Type argument candidate '{1}' is not a valid type argument because it is not a supertype of candidate '{0}'.": { "category": "Error", "code": 2455 @@ -1519,11 +1555,11 @@ "category": "Error", "code": 2484 }, - "The left-hand side of a 'for...of' statement cannot be a previously defined constant.": { + "The left-hand side of a 'for...of' statement cannot be a constant or a read-only property.": { "category": "Error", "code": 2485 }, - "The left-hand side of a 'for...in' statement cannot be a previously defined constant.": { + "The left-hand side of a 'for...in' statement cannot be a constant or a read-only property.": { "category": "Error", "code": 2486 }, @@ -1627,7 +1663,7 @@ "category": "Error", "code": 2511 }, - "Overload signatures must all be abstract or not abstract.": { + "Overload signatures must all be abstract or non-abstract.": { "category": "Error", "code": 2512 }, @@ -1655,10 +1691,6 @@ "category": "Error", "code": 2518 }, - "A 'this'-based type predicate is only allowed within a class or interface's members, get accessors, or return type positions for functions and methods.": { - "category": "Error", - "code": 2519 - }, "Duplicate identifier '{0}'. Compiler uses declaration '{1}' to support async functions.": { "category": "Error", "code": 2520 @@ -1695,6 +1727,30 @@ "category": "Error", "code": 2528 }, + "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of a module containing async functions.": { + "category": "Error", + "code": 2529 + }, + "Property '{0}' is incompatible with index signature.": { + "category": "Error", + "code": 2530 + }, + "Object is possibly 'null'.": { + "category": "Error", + "code": 2531 + }, + "Object is possibly 'undefined'.": { + "category": "Error", + "code": 2532 + }, + "Object is possibly 'null' or 'undefined'.": { + "category": "Error", + "code": 2533 + }, + "A function returning 'never' cannot have a reachable end point.": { + "category": "Error", + "code": 2534 + }, "JSX element attributes type '{0}' may not be a union type.": { "category": "Error", "code": 2600 @@ -1771,6 +1827,102 @@ "category": "Error", "code": 2660 }, + "Cannot export '{0}'. Only local declarations can be exported from a module.": { + "category": "Error", + "code": 2661 + }, + "Cannot find name '{0}'. Did you mean the static member '{1}.{0}'?": { + "category": "Error", + "code": 2662 + }, + "Cannot find name '{0}'. Did you mean the instance member 'this.{0}'?": { + "category": "Error", + "code": 2663 + }, + "Invalid module name in augmentation, module '{0}' cannot be found.": { + "category": "Error", + "code": 2664 + }, + "Exports and export assignments are not permitted in module augmentations.": { + "category": "Error", + "code": 2666 + }, + "Imports are not permitted in module augmentations. Consider moving them to the enclosing external module.": { + "category": "Error", + "code": 2667 + }, + "'export' modifier cannot be applied to ambient modules and module augmentations since they are always visible.": { + "category": "Error", + "code": 2668 + }, + "Augmentations for the global scope can only be directly nested in external modules or ambient module declarations.": { + "category": "Error", + "code": 2669 + }, + "Augmentations for the global scope should have 'declare' modifier unless they appear in already ambient context.": { + "category": "Error", + "code": 2670 + }, + "Cannot augment module '{0}' because it resolves to a non-module entity.": { + "category": "Error", + "code": 2671 + }, + "Cannot assign a '{0}' constructor type to a '{1}' constructor type.": { + "category": "Error", + "code": 2672 + }, + "Constructor of class '{0}' is private and only accessible within the class declaration.": { + "category": "Error", + "code": 2673 + }, + "Constructor of class '{0}' is protected and only accessible within the class declaration.": { + "category": "Error", + "code": 2674 + }, + "Cannot extend a class '{0}'. Class constructor is marked as private.": { + "category": "Error", + "code": 2675 + }, + "Accessors must both be abstract or non-abstract.": { + "category": "Error", + "code": 2676 + }, + "A type predicate's type must be assignable to its parameter's type.": { + "category": "Error", + "code": 2677 + }, + "Type '{0}' is not comparable to type '{1}'.": { + "category": "Error", + "code": 2678 + }, + "A function that is called with the 'new' keyword cannot have a 'this' type that is 'void'.": { + "category": "Error", + "code": 2679 + }, + "A 'this' parameter must be the first parameter.": { + "category": "Error", + "code": 2680 + }, + "A constructor cannot have a 'this' parameter.": { + "category": "Error", + "code": 2681 + }, + "'get' and 'set' accessor must have the same 'this' type.": { + "category": "Error", + "code": 2682 + }, + "'this' implicitly has type 'any' because it does not have a type annotation.": { + "category": "Error", + "code": 2683 + }, + "The 'this' context of type '{0}' is not assignable to method's 'this' of type '{1}'.": { + "category": "Error", + "code": 2684 + }, + "The 'this' types of each signature are incompatible.": { + "category": "Error", + "code": 2685 + }, "Import declaration '{0}' is using private name '{1}'.": { "category": "Error", "code": 4000 @@ -2051,6 +2203,11 @@ "category": "Error", "code": 4082 }, + "Conflicting library definitions for '{0}' found at '{1}' and '{2}'. Copy the correct file to the 'typings' folder to resolve this conflict.": { + "category": "Message", + "code": 4090 + }, + "The current host does not support the '{0}' option.": { "category": "Error", "code": 5001 @@ -2131,7 +2288,30 @@ "category": "Error", "code": 5058 }, - + "Invalid value for '--reactNamespace'. '{0}' is not a valid identifier.": { + "category": "Error", + "code": 5059 + }, + "Option 'paths' cannot be used without specifying '--baseUrl' option.": { + "category": "Error", + "code": 5060 + }, + "Pattern '{0}' can have at most one '*' character": { + "category": "Error", + "code": 5061 + }, + "Substitution '{0}' in pattern '{1}' in can have at most one '*' character": { + "category": "Error", + "code": 5062 + }, + "Substututions for pattern '{0}' should be an array.": { + "category": "Error", + "code": 5063 + }, + "Substitution '{0}' for pattern '{1}' has incorrect type, expected 'string', got '{2}'.": { + "category": "Error", + "code": 5064 + }, "Concatenate and emit output to single file.": { "category": "Message", "code": 6001 @@ -2140,11 +2320,11 @@ "category": "Message", "code": 6002 }, - "Specifies the location where debugger should locate map files instead of generated locations.": { + "Specify the location where debugger should locate map files instead of generated locations.": { "category": "Message", "code": 6003 }, - "Specifies the location where debugger should locate TypeScript files instead of source locations.": { + "Specify the location where debugger should locate TypeScript files instead of source locations.": { "category": "Message", "code": 6004 }, @@ -2176,10 +2356,10 @@ "category": "Message", "code": 6011 }, - "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES2015' (experimental)": { - "category": "Message", - "code": 6015 - }, + "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES2015'": { + "category": "Message", + "code": 6015 + }, "Specify module code generation: 'commonjs', 'amd', 'system', 'umd' or 'es2015'": { "category": "Message", "code": 6016 @@ -2264,14 +2444,10 @@ "category": "Error", "code": 6045 }, - "Argument for '--module' option must be 'commonjs', 'amd', 'system', 'umd', or 'es2015'.": { + "Argument for '{0}' option must be: {1}": { "category": "Error", "code": 6046 }, - "Argument for '--target' option must be 'ES3', 'ES5', or 'ES2015'.": { - "category": "Error", - "code": 6047 - }, "Locale must be of the form or -. For example '{0}' or '{1}'.": { "category": "Error", "code": 6048 @@ -2308,7 +2484,7 @@ "category": "Message", "code": 6056 }, - "Specifies the root directory of input files. Use to control the output directory structure with --outDir.": { + "Specify the root directory of input files. Use to control the output directory structure with --outDir.": { "category": "Message", "code": 6058 }, @@ -2316,7 +2492,7 @@ "category": "Error", "code": 6059 }, - "Specifies the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix).": { + "Specify the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix).": { "category": "Message", "code": 6060 }, @@ -2324,15 +2500,10 @@ "category": "Message", "code": 6061 }, - "Argument for '--newLine' option must be 'CRLF' or 'LF'.": { + "Option '{0}' can only be specified in 'tsconfig.json' file.": { "category": "Error", - "code": 6062 + "code": 6064 }, - "Argument for '--moduleResolution' option must be 'node' or 'classic'.": { - "category": "Error", - "code": 6063 - }, - "Enables experimental support for ES7 decorators.": { "category": "Message", "code": 6065 @@ -2345,7 +2516,7 @@ "category": "Message", "code": 6068 }, - "Specifies module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6).": { + "Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6).": { "category": "Message", "code": 6069 }, @@ -2385,23 +2556,210 @@ "category": "Message", "code": 6078 }, + "Specify library files to be included in the compilation: ": { + "category": "Message", + "code": 6079 + }, "Specify JSX code generation: 'preserve' or 'react'": { "category": "Message", "code": 6080 }, - "Argument for '--jsx' must be 'preserve' or 'react'.": { - "category": "Message", - "code": 6081 - }, "Only 'amd' and 'system' modules are supported alongside --{0}.": { "category": "Error", "code": 6082 }, - "Allow javascript files to be compiled.": { + "Base directory to resolve non-absolute module names.": { "category": "Message", "code": 6083 }, - + "Specify the object invoked for createElement and __spread when targeting 'react' JSX emit": { + "category": "Message", + "code": 6084 + }, + "Enable tracing of the name resolution process.": { + "category": "Message", + "code": 6085 + }, + "======== Resolving module '{0}' from '{1}'. ========": { + "category": "Message", + "code": 6086 + }, + "Explicitly specified module resolution kind: '{0}'.": { + "category": "Message", + "code": 6087 + }, + "Module resolution kind is not specified, using '{0}'.": { + "category": "Message", + "code": 6088 + }, + "======== Module name '{0}' was successfully resolved to '{1}'. ========": { + "category": "Message", + "code": 6089 + }, + "======== Module name '{0}' was not resolved. ========": { + "category": "Message", + "code": 6090 + }, + "'paths' option is specified, looking for a pattern to match module name '{0}'.": { + "category": "Message", + "code": 6091 + }, + "Module name '{0}', matched pattern '{1}'.": { + "category": "Message", + "code": 6092 + }, + "Trying substitution '{0}', candidate module location: '{1}'.": { + "category": "Message", + "code": 6093 + }, + "Resolving module name '{0}' relative to base url '{1}' - '{2}'.": { + "category": "Message", + "code": 6094 + }, + "Loading module as file / folder, candidate module location '{0}'.": { + "category": "Message", + "code": 6095 + }, + "File '{0}' does not exist.": { + "category": "Message", + "code": 6096 + }, + "File '{0}' exist - use it as a name resolution result.": { + "category": "Message", + "code": 6097 + }, + "Loading module '{0}' from 'node_modules' folder.": { + "category": "Message", + "code": 6098 + }, + "Found 'package.json' at '{0}'.": { + "category": "Message", + "code": 6099 + }, + "'package.json' does not have 'types' field.": { + "category": "Message", + "code": 6100 + }, + "'package.json' has '{0}' field '{1}' that references '{2}'.": { + "category": "Message", + "code": 6101 + }, + "Allow javascript files to be compiled.": { + "category": "Message", + "code": 6102 + }, + "Option '{0}' should have array of strings as a value.": { + "category": "Error", + "code": 6103 + }, + "Checking if '{0}' is the longest matching prefix for '{1}' - '{2}'.": { + "category": "Message", + "code": 6104 + }, + "Expected type of '{0}' field in 'package.json' to be 'string', got '{1}'.": { + "category": "Message", + "code": 6105 + }, + "'baseUrl' option is set to '{0}', using this value to resolve non-relative module name '{1}'": { + "category": "Message", + "code": 6106 + }, + "'rootDirs' option is set, using it to resolve relative module name '{0}'": { + "category": "Message", + "code": 6107 + }, + "Longest matching prefix for '{0}' is '{1}'": { + "category": "Message", + "code": 6108 + }, + "Loading '{0}' from the root dir '{1}', candidate location '{2}'": { + "category": "Message", + "code": 6109 + }, + "Trying other entries in 'rootDirs'": { + "category": "Message", + "code": 6110 + }, + "Module resolution using 'rootDirs' has failed": { + "category": "Message", + "code": 6111 + }, + "Do not emit 'use strict' directives in module output.": { + "category": "Message", + "code": 6112 + }, + "Enable strict null checks.": { + "category": "Message", + "code": 6113 + }, + "Unknown option 'excludes'. Did you mean 'exclude'?": { + "category": "Error", + "code": 6114 + }, + "Raise error on 'this' expressions with an implied 'any' type.": { + "category": "Message", + "code": 6115 + }, + "======== Resolving type reference directive '{0}', containing file '{1}', root directory '{2}'. ========": { + "category": "Message", + "code": 6116 + }, + "Resolving using primary search paths...": { + "category": "Message", + "code": 6117 + }, + "Resolving from node_modules folder...": { + "category": "Message", + "code": 6118 + }, + "======== Type reference directive '{0}' was successfully resolved to '{1}', primary: {2}. ========": { + "category": "Message", + "code": 6119 + }, + "======== Type reference directive '{0}' was not resolved. ========": { + "category": "Message", + "code": 6120 + }, + "Resolving with primary search path '{0}'": { + "category": "Message", + "code": 6121 + }, + "Root directory cannot be determined, skipping primary search paths.": { + "category": "Message", + "code": 6122 + }, + "======== Resolving type reference directive '{0}', containing file '{1}', root directory not set. ========": { + "category": "Message", + "code": 6123 + }, + "Type declaration files to be included in compilation.": { + "category": "Message", + "code": 6124 + }, + "Looking up in 'node_modules' folder, initial location '{0}'": { + "category": "Message", + "code": 6125 + }, + "Containing file is not specified and root directory cannot be determined, skipping lookup in 'node_modules' folder.": { + "category": "Message", + "code": 6126 + }, + "======== Resolving type reference directive '{0}', containing file not set, root directory '{1}'. ========": { + "category": "Message", + "code": 6127 + }, + "======== Resolving type reference directive '{0}', containing file not set, root directory not set. ========": { + "category": "Message", + "code": 6128 + }, + "The config file '{0}' found doesn't contain any source files.": { + "category": "Error", + "code": 6129 + }, + "Resolving real path for '{0}', result '{1}'": { + "category": "Message", + "code": 6130 + }, "Variable '{0}' implicitly has an '{1}' type.": { "category": "Error", "code": 7005 @@ -2430,6 +2788,10 @@ "category": "Error", "code": 7013 }, + "Element implicitly has an 'any' type because index expression is not of type 'number'.": { + "category": "Error", + "code": 7015 + }, "Property '{0}' implicitly has type 'any', because its 'set' accessor lacks a type annotation.": { "category": "Error", "code": 7016 @@ -2486,6 +2848,10 @@ "category": "Error", "code": 7030 }, + "Binding element '{0}' implicitly has an '{1}' type.": { + "category": "Error", + "code": 7031 + }, "You cannot rename this element.": { "category": "Error", "code": 8000 @@ -2550,11 +2916,6 @@ "category": "Error", "code": 8016 }, - "'decorators' can only be used in a .ts file.": { - "category": "Error", - "code": 8017 - }, - "Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses.": { "category": "Error", "code": 9002 @@ -2584,15 +2945,27 @@ "code": 17004 }, "A constructor cannot contain a 'super' call when its class extends 'null'": { - "category": "Error", - "code": 17005 + "category": "Error", + "code": 17005 }, "An unary expression with the '{0}' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses.": { - "category": "Error", - "code": 17006 + "category": "Error", + "code": 17006 }, "A type assertion expression is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses.": { - "category": "Error", - "code": 17007 + "category": "Error", + "code": 17007 + }, + "JSX element '{0}' has no corresponding closing tag.": { + "category": "Error", + "code": 17008 + }, + "'super' must be called before accessing 'this' in the constructor of a derived class.": { + "category": "Error", + "code": 17009 + }, + "Unknown typing option '{0}'.": { + "category": "Error", + "code": 17010 } } diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index d412225cdf0..f27557a9136 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -287,6 +287,54 @@ namespace ts { _i = 0x10000000, // Use/preference flag for '_i' } + const enum CopyDirection { + ToOriginal, + ToOutParameter + } + + /** + * If loop contains block scoped binding captured in some function then loop body is converted to a function. + * Lexical bindings declared in loop initializer will be passed into the loop body function as parameters, + * however if this binding is modified inside the body - this new value should be propagated back to the original binding. + * This is done by declaring new variable (out parameter holder) outside of the loop for every binding that is reassigned inside the body. + * On every iteration this variable is initialized with value of corresponding binding. + * At every point where control flow leaves the loop either explicitly (break/continue) or implicitly (at the end of loop body) + * we copy the value inside the loop to the out parameter holder. + * + * for (let x;;) { + * let a = 1; + * let b = () => a; + * x++ + * if (...) break; + * ... + * } + * + * will be converted to + * + * var out_x; + * var loop = function(x) { + * var a = 1; + * var b = function() { return a; } + * x++; + * if (...) return out_x = x, "break"; + * ... + * out_x = x; + * } + * for (var x;;) { + * out_x = x; + * var state = loop(x); + * x = out_x; + * if (state === "break") break; + * } + * + * NOTE: values to out parameters are not copies if loop is abrupted with 'return' - in this case this will end the entire enclosing function + * so nobody can observe this new value. + */ + interface LoopOutParameter { + originalName: Identifier; + outParamName: string; + } + // targetSourceFile is when users only want one file in entire project to be emitted. This is used in compileOnSave feature export function emitFiles(resolver: EmitResolver, host: EmitHost, targetSourceFile: SourceFile): EmitResult { // emit output for the __extends helper function @@ -297,6 +345,16 @@ var __extends = (this && this.__extends) || function (d, b) { d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); };`; + const assignHelper = ` +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; +};`; + // emit output for the __decorate helper function const decorateHelper = ` var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { @@ -319,17 +377,12 @@ var __param = (this && this.__param) || function (paramIndex, decorator) { };`; const awaiterHelper = ` -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promise, generator) { - return new Promise(function (resolve, reject) { - generator = generator.call(thisArg, _arguments); - function cast(value) { return value instanceof Promise && value.constructor === Promise ? value : new Promise(function (resolve) { resolve(value); }); } - function onfulfill(value) { try { step("next", value); } catch (e) { reject(e); } } - function onreject(value) { try { step("throw", value); } catch (e) { reject(e); } } - function step(verb, value) { - var result = generator[verb](value); - result.done ? resolve(result.value) : cast(result.value).then(onfulfill, onreject); - } - step("next", void 0); +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator.throw(value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments)).next()); }); };`; @@ -337,6 +390,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi const languageVersion = getEmitScriptTarget(compilerOptions); const modulekind = getEmitModuleKind(compilerOptions); const sourceMapDataList: SourceMapData[] = compilerOptions.sourceMap || compilerOptions.inlineSourceMap ? [] : undefined; + const emittedFilesList: string[] = compilerOptions.listEmittedFiles ? [] : undefined; const emitterDiagnostics = createDiagnosticCollection(); let emitSkipped = false; const newLine = host.getNewLine(); @@ -347,6 +401,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi return { emitSkipped, diagnostics: emitterDiagnostics.getDiagnostics(), + emittedFiles: emittedFilesList, sourceMaps: sourceMapDataList }; @@ -364,14 +419,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi interface ConvertedLoopState { /* - * set of labels that occured inside the converted loop + * set of labels that occurred inside the converted loop * used to determine if labeled jump can be emitted as is or it should be dispatched to calling code */ labels?: Map; /* * collection of labeled jumps that transfer control outside the converted loop. * maps store association 'label -> labelMarker' where - * - label - value of label as it apprear in code + * - label - value of label as it appear in code * - label marker - return value that should be interpreted by calling code as 'jump to HTML anchor element and sets the name attribute to the text value + * @param name + */ + anchor(name: string): string; + + /** Returns a HTML element */ + big(): string; + + /** Returns a HTML element */ + blink(): string; + + /** Returns a HTML element */ + bold(): string; + + /** Returns a HTML element */ + fixed(): string + + /** Returns a HTML element and sets the color attribute value */ + fontcolor(color: string): string + + /** Returns a HTML element and sets the size attribute value */ + fontsize(size: number): string; + + /** Returns a HTML element and sets the size attribute value */ + fontsize(size: string): string; + + /** Returns an HTML element */ + italics(): string; + + /** Returns an HTML element and sets the href attribute value */ + link(url: string): string; + + /** Returns a HTML element */ + small(): string; + + /** Returns a HTML element */ + strike(): string; + + /** Returns a HTML element */ + sub(): string; + + /** Returns a HTML element */ + sup(): string; +} + +interface StringConstructor { + /** + * Return the String value whose elements are, in order, the elements in the List elements. + * If length is 0, the empty string is returned. + */ + fromCodePoint(...codePoints: number[]): string; + + /** + * String.raw is intended for use as a tag function of a Tagged Template String. When called + * as such the first argument will be a well formed template call site object and the rest + * parameter will contain the substitution values. + * @param template A well-formed template string call site representation. + * @param substitutions A set of substitution values. + */ + raw(template: TemplateStringsArray, ...substitutions: any[]): string; +} diff --git a/src/lib/es2015.d.ts b/src/lib/es2015.d.ts new file mode 100644 index 00000000000..ba30ea74669 --- /dev/null +++ b/src/lib/es2015.d.ts @@ -0,0 +1,10 @@ +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// \ No newline at end of file diff --git a/src/lib/es2015.generator.d.ts b/src/lib/es2015.generator.d.ts new file mode 100644 index 00000000000..2f522ad8770 --- /dev/null +++ b/src/lib/es2015.generator.d.ts @@ -0,0 +1,12 @@ +interface GeneratorFunction extends Function { } + +interface GeneratorFunctionConstructor { + /** + * Creates a new Generator function. + * @param args A list of arguments the function accepts. + */ + new (...args: string[]): GeneratorFunction; + (...args: string[]): GeneratorFunction; + readonly prototype: GeneratorFunction; +} +declare var GeneratorFunction: GeneratorFunctionConstructor; diff --git a/src/lib/es2015.iterable.d.ts b/src/lib/es2015.iterable.d.ts new file mode 100644 index 00000000000..e1b9d99762b --- /dev/null +++ b/src/lib/es2015.iterable.d.ts @@ -0,0 +1,425 @@ +/// + +interface SymbolConstructor { + /** + * A method that returns the default iterator for an object. Called by the semantics of the + * for-of statement. + */ + readonly iterator: symbol; +} + +interface IteratorResult { + done: boolean; + value: T; +} + +interface Iterator { + next(value?: any): IteratorResult; + return?(value?: any): IteratorResult; + throw?(e?: any): IteratorResult; +} + +interface Iterable { + [Symbol.iterator](): Iterator; +} + +interface IterableIterator extends Iterator { + [Symbol.iterator](): IterableIterator; +} + +interface Array { + /** Iterator */ + [Symbol.iterator](): IterableIterator; + + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, T]>; + + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface ArrayConstructor { + /** + * Creates an array from an iterable object. + * @param iterable An iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(iterable: Iterable, mapfn: (v: T, k: number) => U, thisArg?: any): Array; + + /** + * Creates an array from an iterable object. + * @param iterable An iterable object to convert to an array. + */ + from(iterable: Iterable): Array; +} + +interface IArguments { + /** Iterator */ + [Symbol.iterator](): IterableIterator; +} + +interface Map { + [Symbol.iterator](): IterableIterator<[K,V]>; + entries(): IterableIterator<[K, V]>; + keys(): IterableIterator; + values(): IterableIterator; +} + +interface MapConstructor { + new (iterable: Iterable<[K, V]>): Map; +} + +interface WeakMap { } + +interface WeakMapConstructor { + new (iterable: Iterable<[K, V]>): WeakMap; +} + +interface Set { + [Symbol.iterator](): IterableIterator; + entries(): IterableIterator<[T, T]>; + keys(): IterableIterator; + values(): IterableIterator; +} + +interface SetConstructor { + new (iterable: Iterable): Set; +} + +interface WeakSet { } + +interface WeakSetConstructor { + new (iterable: Iterable): WeakSet; +} + +interface Promise { } + +interface PromiseConstructor { + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any Promise is rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + all(values: Iterable>): Promise; + + /** + * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved + * or rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + race(values: Iterable>): Promise; +} + +declare namespace Reflect { + function enumerate(target: any): IterableIterator; +} + +interface String { + /** Iterator */ + [Symbol.iterator](): IterableIterator; +} + +/** + * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Int8Array { + [Symbol.iterator](): IterableIterator; + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Int8ArrayConstructor { + new (elements: Iterable): Int8Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array; +} + +/** + * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8Array { + [Symbol.iterator](): IterableIterator; + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Uint8ArrayConstructor { + new (elements: Iterable): Uint8Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array; +} + +/** + * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. + * If the requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8ClampedArray { + [Symbol.iterator](): IterableIterator; + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Uint8ClampedArrayConstructor { + new (elements: Iterable): Uint8ClampedArray; + + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray; +} + +/** + * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int16Array { + [Symbol.iterator](): IterableIterator; + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Int16ArrayConstructor { + new (elements: Iterable): Int16Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array; +} + +/** + * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint16Array { + [Symbol.iterator](): IterableIterator; + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Uint16ArrayConstructor { + new (elements: Iterable): Uint16Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array; +} + +/** + * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int32Array { + [Symbol.iterator](): IterableIterator; + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Int32ArrayConstructor { + new (elements: Iterable): Int32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array; +} + +/** + * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint32Array { + [Symbol.iterator](): IterableIterator; + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Uint32ArrayConstructor { + new (elements: Iterable): Uint32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array; +} + +/** + * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number + * of bytes could not be allocated an exception is raised. + */ +interface Float32Array { + [Symbol.iterator](): IterableIterator; + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Float32ArrayConstructor { + new (elements: Iterable): Float32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array; +} + +/** + * A typed array of 64-bit float values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Float64Array { + [Symbol.iterator](): IterableIterator; + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Float64ArrayConstructor { + new (elements: Iterable): Float64Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; +} \ No newline at end of file diff --git a/src/lib/es2015.promise.d.ts b/src/lib/es2015.promise.d.ts new file mode 100644 index 00000000000..6ade205dc42 --- /dev/null +++ b/src/lib/es2015.promise.d.ts @@ -0,0 +1,81 @@ +/** + * Represents the completion of an asynchronous operation + */ +interface Promise { + /** + * Attaches callbacks for the resolution and/or rejection of the Promise. + * @param onfulfilled The callback to execute when the Promise is resolved. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of which ever callback is executed. + */ + then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; + then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): Promise; + + /** + * Attaches a callback for only the rejection of the Promise. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of the callback. + */ + catch(onrejected?: (reason: any) => T | PromiseLike): Promise; + catch(onrejected?: (reason: any) => void): Promise; +} + +interface PromiseConstructor { + /** + * A reference to the prototype. + */ + readonly prototype: Promise; + + /** + * Creates a new Promise. + * @param executor A callback used to initialize the promise. This callback is passed two arguments: + * a resolve callback used resolve the promise with a value or the result of another promise, + * and a reject callback used to reject the promise with a provided reason or error. + */ + new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void): Promise; + + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any Promise is rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike, T10 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>; + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>; + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>; + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7]>; + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6]>; + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike]): Promise<[T1, T2, T3, T4, T5]>; + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike ]): Promise<[T1, T2, T3, T4]>; + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike]): Promise<[T1, T2, T3]>; + all(values: [T1 | PromiseLike, T2 | PromiseLike]): Promise<[T1, T2]>; + + /** + * Creates a new rejected promise for the provided reason. + * @param reason The reason the promise was rejected. + * @returns A new rejected Promise. + */ + reject(reason: any): Promise; + + /** + * Creates a new rejected promise for the provided reason. + * @param reason The reason the promise was rejected. + * @returns A new rejected Promise. + */ + reject(reason: any): Promise; + + /** + * Creates a new resolved promise for the provided value. + * @param value A promise. + * @returns A promise whose internal state matches the provided promise. + */ + resolve(value: T | PromiseLike): Promise; + + /** + * Creates a new resolved promise . + * @returns A resolved promise. + */ + resolve(): Promise; +} + +declare var Promise: PromiseConstructor; \ No newline at end of file diff --git a/src/lib/es2015.proxy.d.ts b/src/lib/es2015.proxy.d.ts new file mode 100644 index 00000000000..c37e8fb0f59 --- /dev/null +++ b/src/lib/es2015.proxy.d.ts @@ -0,0 +1,22 @@ +interface ProxyHandler { + getPrototypeOf? (target: T): any; + setPrototypeOf? (target: T, v: any): boolean; + isExtensible? (target: T): boolean; + preventExtensions? (target: T): boolean; + getOwnPropertyDescriptor? (target: T, p: PropertyKey): PropertyDescriptor; + has? (target: T, p: PropertyKey): boolean; + get? (target: T, p: PropertyKey, receiver: any): any; + set? (target: T, p: PropertyKey, value: any, receiver: any): boolean; + deleteProperty? (target: T, p: PropertyKey): boolean; + defineProperty? (target: T, p: PropertyKey, attributes: PropertyDescriptor): boolean; + enumerate? (target: T): PropertyKey[]; + ownKeys? (target: T): PropertyKey[]; + apply? (target: T, thisArg: any, argArray?: any): any; + construct? (target: T, thisArg: any, argArray?: any): any; +} + +interface ProxyConstructor { + revocable(target: T, handler: ProxyHandler): { proxy: T; revoke: () => void; }; + new (target: T, handler: ProxyHandler): T +} +declare var Proxy: ProxyConstructor; \ No newline at end of file diff --git a/src/lib/es2015.reflect.d.ts b/src/lib/es2015.reflect.d.ts new file mode 100644 index 00000000000..eda8d352263 --- /dev/null +++ b/src/lib/es2015.reflect.d.ts @@ -0,0 +1,16 @@ +declare namespace Reflect { + function apply(target: Function, thisArgument: any, argumentsList: ArrayLike): any; + function construct(target: Function, argumentsList: ArrayLike, newTarget?: any): any; + function defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean; + function deleteProperty(target: any, propertyKey: PropertyKey): boolean; + function get(target: any, propertyKey: PropertyKey, receiver?: any): any; + function getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor; + function getPrototypeOf(target: any): any; + function has(target: any, propertyKey: string): boolean; + function has(target: any, propertyKey: symbol): boolean; + function isExtensible(target: any): boolean; + function ownKeys(target: any): Array; + function preventExtensions(target: any): boolean; + function set(target: any, propertyKey: PropertyKey, value: any, receiver?: any): boolean; + function setPrototypeOf(target: any, proto: any): boolean; +} \ No newline at end of file diff --git a/src/lib/es2015.symbol.d.ts b/src/lib/es2015.symbol.d.ts new file mode 100644 index 00000000000..cd7e45595f0 --- /dev/null +++ b/src/lib/es2015.symbol.d.ts @@ -0,0 +1,36 @@ +interface Symbol { + /** Returns a string representation of an object. */ + toString(): string; + + /** Returns the primitive value of the specified object. */ + valueOf(): Object; +} + +interface SymbolConstructor { + /** + * A reference to the prototype. + */ + readonly prototype: Symbol; + + /** + * Returns a new unique Symbol value. + * @param description Description of the new Symbol object. + */ + (description?: string|number): symbol; + + /** + * Returns a Symbol object from the global symbol registry matching the given key if found. + * Otherwise, returns a new symbol with this key. + * @param key key to search for. + */ + for(key: string): symbol; + + /** + * Returns a key from the global symbol registry matching the given Symbol if found. + * Otherwise, returns a undefined. + * @param sym Symbol to find the key for. + */ + keyFor(sym: symbol): string | undefined; +} + +declare var Symbol: SymbolConstructor; \ No newline at end of file diff --git a/src/lib/es2015.symbol.wellknown.d.ts b/src/lib/es2015.symbol.wellknown.d.ts new file mode 100644 index 00000000000..145d8af6b10 --- /dev/null +++ b/src/lib/es2015.symbol.wellknown.d.ts @@ -0,0 +1,327 @@ +/// + +interface SymbolConstructor { + /** + * A method that determines if a constructor object recognizes an object as one of the + * constructor’s instances. Called by the semantics of the instanceof operator. + */ + readonly hasInstance: symbol; + + /** + * A Boolean value that if true indicates that an object should flatten to its array elements + * by Array.prototype.concat. + */ + readonly isConcatSpreadable: symbol; + + /** + * A regular expression method that matches the regular expression against a string. Called + * by the String.prototype.match method. + */ + readonly match: symbol; + + /** + * A regular expression method that replaces matched substrings of a string. Called by the + * String.prototype.replace method. + */ + readonly replace: symbol; + + /** + * A regular expression method that returns the index within a string that matches the + * regular expression. Called by the String.prototype.search method. + */ + readonly search: symbol; + + /** + * A function valued property that is the constructor function that is used to create + * derived objects. + */ + readonly species: symbol; + + /** + * A regular expression method that splits a string at the indices that match the regular + * expression. Called by the String.prototype.split method. + */ + readonly split: symbol; + + /** + * A method that converts an object to a corresponding primitive value. + * Called by the ToPrimitive abstract operation. + */ + readonly toPrimitive: symbol; + + /** + * A String value that is used in the creation of the default string description of an object. + * Called by the built-in method Object.prototype.toString. + */ + readonly toStringTag: symbol; + + /** + * An Object whose own property names are property names that are excluded from the 'with' + * environment bindings of the associated objects. + */ + readonly unscopables: symbol; +} + +interface Symbol { + readonly [Symbol.toStringTag]: "Symbol"; +} + +interface Array { + /** + * Returns an object whose properties have the value 'true' + * when they will be absent when used in a 'with' statement. + */ + [Symbol.unscopables](): { + copyWithin: boolean; + entries: boolean; + fill: boolean; + find: boolean; + findIndex: boolean; + keys: boolean; + values: boolean; + }; +} + +interface Date { + /** + * Converts a Date object to a string. + */ + [Symbol.toPrimitive](hint: "default"): string; + /** + * Converts a Date object to a string. + */ + [Symbol.toPrimitive](hint: "string"): string; + /** + * Converts a Date object to a number. + */ + [Symbol.toPrimitive](hint: "number"): number; + /** + * Converts a Date object to a string or number. + * + * @param hint The strings "number", "string", or "default" to specify what primitive to return. + * + * @throws {TypeError} If 'hint' was given something other than "number", "string", or "default". + * @returns A number if 'hint' was "number", a string if 'hint' was "string" or "default". + */ + [Symbol.toPrimitive](hint: string): string | number; +} + +interface Map { + readonly [Symbol.toStringTag]: "Map"; +} + +interface WeakMap{ + readonly [Symbol.toStringTag]: "WeakMap"; +} + +interface Set { + readonly [Symbol.toStringTag]: "Set"; +} + +interface WeakSet { + readonly [Symbol.toStringTag]: "WeakSet"; +} + +interface JSON { + readonly [Symbol.toStringTag]: "JSON"; +} + +interface Function { + /** + * Determines whether the given value inherits from this function if this function was used + * as a constructor function. + * + * A constructor function can control which objects are recognized as its instances by + * 'instanceof' by overriding this method. + */ + [Symbol.hasInstance](value: any): boolean; +} + +interface GeneratorFunction extends Function { + readonly [Symbol.toStringTag]: "GeneratorFunction"; +} + +interface Math { + readonly [Symbol.toStringTag]: "Math"; +} + +interface Promise { + readonly [Symbol.toStringTag]: "Promise"; +} + +interface PromiseConstructor { + readonly [Symbol.species]: Function; +} + +interface RegExp { + /** + * Matches a string with this regular expression, and returns an array containing the results of + * that search. + * @param string A string to search within. + */ + [Symbol.match](string: string): RegExpMatchArray | null; + + /** + * Replaces text in a string, using this regular expression. + * @param string A String object or string literal whose contents matching against + * this regular expression will be replaced + * @param replaceValue A String object or string literal containing the text to replace for every + * successful match of this regular expression. + */ + [Symbol.replace](string: string, replaceValue: string): string; + + /** + * Replaces text in a string, using this regular expression. + * @param string A String object or string literal whose contents matching against + * this regular expression will be replaced + * @param replacer A function that returns the replacement text. + */ + [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; + + /** + * Finds the position beginning first substring match in a regular expression search + * using this regular expression. + * + * @param string The string to search within. + */ + [Symbol.search](string: string): number; + + /** + * Returns an array of substrings that were delimited by strings in the original input that + * match against this regular expression. + * + * If the regular expression contains capturing parentheses, then each time this + * regular expression matches, the results (including any undefined results) of the + * capturing parentheses are spliced. + * + * @param string string value to split + * @param limit if not undefined, the output array is truncated so that it contains no more + * than 'limit' elements. + */ + [Symbol.split](string: string, limit?: number): string[]; +} + +interface RegExpConstructor { + [Symbol.species](): RegExpConstructor; +} + +interface String { + /** + * Matches a string an object that supports being matched against, and returns an array containing the results of that search. + * @param matcher An object that supports being matched against. + */ + match(matcher: { [Symbol.match](string: string): RegExpMatchArray | null; }): RegExpMatchArray | null; + + /** + * Replaces text in a string, using an object that supports replacement within a string. + * @param searchValue A object can search for and replace matches within a string. + * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. + */ + replace(searchValue: { [Symbol.replace](string: string, replaceValue: string): string; }, replaceValue: string): string; + + /** + * Replaces text in a string, using an object that supports replacement within a string. + * @param searchValue A object can search for and replace matches within a string. + * @param replacer A function that returns the replacement text. + */ + replace(searchValue: { [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; }, replacer: (substring: string, ...args: any[]) => string): string; + + /** + * Finds the first substring match in a regular expression search. + * @param searcher An object which supports searching within a string. + */ + search(searcher: { [Symbol.search](string: string): number; }): number; + + /** + * Split a string into substrings using the specified separator and return them as an array. + * @param splitter An object that can split a string. + * @param limit A value used to limit the number of elements returned in the array. + */ + split(splitter: { [Symbol.split](string: string, limit?: number): string[]; }, limit?: number): string[]; +} + +/** + * Represents a raw buffer of binary data, which is used to store data for the + * different typed arrays. ArrayBuffers cannot be read from or written to directly, + * but can be passed to a typed array or DataView Object to interpret the raw + * buffer as needed. + */ +interface ArrayBuffer { + readonly [Symbol.toStringTag]: "ArrayBuffer"; +} + +interface DataView { + readonly [Symbol.toStringTag]: "DataView"; +} + +/** + * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Int8Array { + readonly [Symbol.toStringTag]: "Int8Array"; +} + +/** + * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8Array { + readonly [Symbol.toStringTag]: "UInt8Array"; +} + +/** + * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. + * If the requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8ClampedArray { + readonly [Symbol.toStringTag]: "Uint8ClampedArray"; +} + +/** + * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int16Array { + readonly [Symbol.toStringTag]: "Int16Array"; +} + +/** + * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint16Array { + readonly [Symbol.toStringTag]: "Uint16Array"; +} + +/** + * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int32Array { + readonly [Symbol.toStringTag]: "Int32Array"; +} + +/** + * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint32Array { + readonly [Symbol.toStringTag]: "Uint32Array"; +} + +/** + * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number + * of bytes could not be allocated an exception is raised. + */ +interface Float32Array { + readonly [Symbol.toStringTag]: "Float32Array"; +} + +/** + * A typed array of 64-bit float values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Float64Array { + readonly [Symbol.toStringTag]: "Float64Array"; +} \ No newline at end of file diff --git a/src/lib/es2016.array.include.d.ts b/src/lib/es2016.array.include.d.ts new file mode 100644 index 00000000000..17b3eaac1d3 --- /dev/null +++ b/src/lib/es2016.array.include.d.ts @@ -0,0 +1,89 @@ +interface Array { + /** + * Determines whether an array includes a certain element, returning true or false as appropriate. + * @param searchElement The element to search for. + * @param fromIndex The position in this array at which to begin searching for searchElement. + */ + includes(searchElement: T, fromIndex?: number): boolean; +} + +interface Int8Array { + /** + * Determines whether an array includes a certain element, returning true or false as appropriate. + * @param searchElement The element to search for. + * @param fromIndex The position in this array at which to begin searching for searchElement. + */ + includes(searchElement: number, fromIndex?: number): boolean; +} + +interface Uint8Array { + /** + * Determines whether an array includes a certain element, returning true or false as appropriate. + * @param searchElement The element to search for. + * @param fromIndex The position in this array at which to begin searching for searchElement. + */ + includes(searchElement: number, fromIndex?: number): boolean; +} + +interface Uint8ClampedArray { + /** + * Determines whether an array includes a certain element, returning true or false as appropriate. + * @param searchElement The element to search for. + * @param fromIndex The position in this array at which to begin searching for searchElement. + */ + includes(searchElement: number, fromIndex?: number): boolean; +} + +interface Int16Array { + /** + * Determines whether an array includes a certain element, returning true or false as appropriate. + * @param searchElement The element to search for. + * @param fromIndex The position in this array at which to begin searching for searchElement. + */ + includes(searchElement: number, fromIndex?: number): boolean; +} + +interface Uint16Array { + /** + * Determines whether an array includes a certain element, returning true or false as appropriate. + * @param searchElement The element to search for. + * @param fromIndex The position in this array at which to begin searching for searchElement. + */ + includes(searchElement: number, fromIndex?: number): boolean; +} + +interface Int32Array { + /** + * Determines whether an array includes a certain element, returning true or false as appropriate. + * @param searchElement The element to search for. + * @param fromIndex The position in this array at which to begin searching for searchElement. + */ + includes(searchElement: number, fromIndex?: number): boolean; +} + +interface Uint32Array { + /** + * Determines whether an array includes a certain element, returning true or false as appropriate. + * @param searchElement The element to search for. + * @param fromIndex The position in this array at which to begin searching for searchElement. + */ + includes(searchElement: number, fromIndex?: number): boolean; +} + +interface Float32Array { + /** + * Determines whether an array includes a certain element, returning true or false as appropriate. + * @param searchElement The element to search for. + * @param fromIndex The position in this array at which to begin searching for searchElement. + */ + includes(searchElement: number, fromIndex?: number): boolean; +} + +interface Float64Array { + /** + * Determines whether an array includes a certain element, returning true or false as appropriate. + * @param searchElement The element to search for. + * @param fromIndex The position in this array at which to begin searching for searchElement. + */ + includes(searchElement: number, fromIndex?: number): boolean; +} \ No newline at end of file diff --git a/src/lib/es2016.d.ts b/src/lib/es2016.d.ts new file mode 100644 index 00000000000..34f833d621b --- /dev/null +++ b/src/lib/es2016.d.ts @@ -0,0 +1,2 @@ +/// +/// \ No newline at end of file diff --git a/src/lib/es2017.d.ts b/src/lib/es2017.d.ts new file mode 100644 index 00000000000..aad5ff4d2ce --- /dev/null +++ b/src/lib/es2017.d.ts @@ -0,0 +1,2 @@ +/// +/// \ No newline at end of file diff --git a/src/lib/es2017.object.d.ts b/src/lib/es2017.object.d.ts new file mode 100644 index 00000000000..95cc5692a03 --- /dev/null +++ b/src/lib/es2017.object.d.ts @@ -0,0 +1,14 @@ +interface ObjectConstructor { + /** + * Returns an array of values of the enumerable properties of an object + * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. + */ + values(o: { [s: string]: T }): T[]; + values(o: any): any[]; + /** + * Returns an array of key/values of the enumerable properties of an object + * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. + */ + entries(o: { [s: string]: T }): [string, T][]; + entries(o: any): [string, any][]; +} \ No newline at end of file diff --git a/src/lib/core.d.ts b/src/lib/es5.d.ts similarity index 73% rename from src/lib/core.d.ts rename to src/lib/es5.d.ts index 12df449931e..dfd2bd4ff0c 100644 --- a/src/lib/core.d.ts +++ b/src/lib/es5.d.ts @@ -1,14 +1,12 @@ -/// - ///////////////////////////// /// ECMAScript APIs ///////////////////////////// -declare var NaN: number; -declare var Infinity: number; +declare const NaN: number; +declare const Infinity: number; /** - * Evaluates JavaScript code and executes it. + * Evaluates JavaScript code and executes it. * @param x A String value that contains valid JavaScript code. */ declare function eval(x: string): any; @@ -16,25 +14,25 @@ declare function eval(x: string): any; /** * Converts A string to an integer. * @param s A string to convert into a number. - * @param radix A value between 2 and 36 that specifies the base of the number in numString. + * @param radix A value between 2 and 36 that specifies the base of the number in numString. * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. * All other strings are considered decimal. */ declare function parseInt(s: string, radix?: number): number; /** - * Converts a string to a floating-point number. - * @param string A string that contains a floating-point number. + * Converts a string to a floating-point number. + * @param string A string that contains a floating-point number. */ declare function parseFloat(string: string): number; /** - * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a number). + * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a number). * @param number A numeric value. */ declare function isNaN(number: number): boolean; -/** +/** * Determines whether a supplied number is finite. * @param number Any numeric value. */ @@ -52,7 +50,7 @@ declare function decodeURI(encodedURI: string): string; */ declare function decodeURIComponent(encodedURIComponent: string): string; -/** +/** * Encodes a text string as a valid Uniform Resource Identifier (URI) * @param uri A value representing an encoded URI. */ @@ -91,18 +89,18 @@ interface Object { valueOf(): Object; /** - * Determines whether an object has a property with the specified name. + * Determines whether an object has a property with the specified name. * @param v A property name. */ hasOwnProperty(v: string): boolean; /** - * Determines whether an object exists in another object's prototype chain. + * Determines whether an object exists in another object's prototype chain. * @param v Another object whose prototype chain is to be checked. */ isPrototypeOf(v: Object): boolean; - /** + /** * Determines whether a specified property is enumerable. * @param v A property name. */ @@ -115,38 +113,38 @@ interface ObjectConstructor { (value: any): any; /** A reference to the prototype for a class of objects. */ - prototype: Object; + readonly prototype: Object; - /** - * Returns the prototype of an object. + /** + * Returns the prototype of an object. * @param o The object that references the prototype. */ getPrototypeOf(o: any): any; /** - * Gets the own property descriptor of the specified object. - * An own property descriptor is one that is defined directly on the object and is not inherited from the object's prototype. + * Gets the own property descriptor of the specified object. + * An own property descriptor is one that is defined directly on the object and is not inherited from the object's prototype. * @param o Object that contains the property. * @param p Name of the property. */ getOwnPropertyDescriptor(o: any, p: string): PropertyDescriptor; - /** - * Returns the names of the own properties of an object. The own properties of an object are those that are defined directly + /** + * Returns the names of the own properties of an object. The own properties of an object are those that are defined directly * on that object, and are not inherited from the object's prototype. The properties of an object include both fields (objects) and functions. * @param o Object that contains the own properties. */ getOwnPropertyNames(o: any): string[]; - /** + /** * Creates an object that has the specified prototype, and that optionally contains specified properties. * @param o Object to use as a prototype. May be null - * @param properties JavaScript object that contains one or more property descriptors. + * @param properties JavaScript object that contains one or more property descriptors. */ create(o: any, properties?: PropertyDescriptorMap): any; /** - * Adds a property to an object, or modifies attributes of an existing property. + * Adds a property to an object, or modifies attributes of an existing property. * @param o Object on which to add or modify the property. This can be a native JavaScript object (that is, a user-defined object or a built in object) or a DOM object. * @param p The property name. * @param attributes Descriptor for the property. It can be for a data property or an accessor property. @@ -154,7 +152,7 @@ interface ObjectConstructor { defineProperty(o: any, p: string, attributes: PropertyDescriptor): any; /** - * Adds one or more properties to an object, and/or modifies attributes of existing properties. + * Adds one or more properties to an object, and/or modifies attributes of existing properties. * @param o Object on which to add or modify the properties. This can be a native JavaScript object or a DOM object. * @param properties JavaScript object that contains one or more descriptor objects. Each descriptor object describes a data property or an accessor property. */ @@ -162,7 +160,7 @@ interface ObjectConstructor { /** * Prevents the modification of attributes of existing properties, and prevents the addition of new properties. - * @param o Object on which to lock the attributes. + * @param o Object on which to lock the attributes. */ seal(o: T): T; @@ -174,25 +172,25 @@ interface ObjectConstructor { /** * Prevents the addition of new properties to an object. - * @param o Object to make non-extensible. + * @param o Object to make non-extensible. */ preventExtensions(o: T): T; /** * Returns true if existing property attributes cannot be modified in an object and new properties cannot be added to the object. - * @param o Object to test. + * @param o Object to test. */ isSealed(o: any): boolean; /** * Returns true if existing property attributes and values cannot be modified in an object, and new properties cannot be added to the object. - * @param o Object to test. + * @param o Object to test. */ isFrozen(o: any): boolean; /** * Returns a value that indicates whether new properties can be added to an object. - * @param o Object to test. + * @param o Object to test. */ isExtensible(o: any): boolean; @@ -206,7 +204,7 @@ interface ObjectConstructor { /** * Provides functionality common to all JavaScript objects. */ -declare var Object: ObjectConstructor; +declare const Object: ObjectConstructor; /** * Creates a new function. @@ -217,25 +215,25 @@ interface Function { * @param thisArg The object to be used as the this object. * @param argArray A set of arguments to be passed to the function. */ - apply(thisArg: any, argArray?: any): any; + apply(this: Function, thisArg: any, argArray?: any): any; /** * Calls a method of an object, substituting another object for the current object. * @param thisArg The object to be used as the current object. * @param argArray A list of arguments to be passed to the method. */ - call(thisArg: any, ...argArray: any[]): any; + call(this: Function, thisArg: any, ...argArray: any[]): any; /** - * For a given function, creates a bound function that has the same body as the original function. + * For a given function, creates a bound function that has the same body as the original function. * The this object of the bound function is associated with the specified object, and has the specified initial parameters. * @param thisArg An object to which the this keyword can refer inside the new function. * @param argArray A list of arguments to be passed to the new function. */ - bind(thisArg: any, ...argArray: any[]): any; + bind(this: Function, thisArg: any, ...argArray: any[]): any; prototype: any; - length: number; + readonly length: number; // Non-standard extensions arguments: any; @@ -249,10 +247,10 @@ interface FunctionConstructor { */ new (...args: string[]): Function; (...args: string[]): Function; - prototype: Function; + readonly prototype: Function; } -declare var Function: FunctionConstructor; +declare const Function: FunctionConstructor; interface IArguments { [index: number]: any; @@ -270,7 +268,7 @@ interface String { */ charAt(pos: number): string; - /** + /** * Returns the Unicode value of the character at the specified location. * @param index The zero-based index of the desired character. If there is no character at the specified index, NaN is returned. */ @@ -278,12 +276,12 @@ interface String { /** * Returns a string that contains the concatenation of two or more strings. - * @param strings The strings to append to the end of the string. + * @param strings The strings to append to the end of the string. */ concat(...strings: string[]): string; /** - * Returns the position of the first occurrence of a substring. + * Returns the position of the first occurrence of a substring. * @param searchString The substring to search for in the string * @param position The index at which to begin searching the String object. If omitted, search starts at the beginning of the string. */ @@ -302,17 +300,17 @@ interface String { */ localeCompare(that: string): number; - /** + /** * Matches a string with a regular expression, and returns an array containing the results of that search. * @param regexp A variable name or string literal containing the regular expression pattern and flags. */ - match(regexp: string): RegExpMatchArray; + match(regexp: string): RegExpMatchArray | null; - /** + /** * Matches a string with a regular expression, and returns an array containing the results of that search. - * @param regexp A regular expression object that contains the regular expression pattern and applicable flags. + * @param regexp A regular expression object that contains the regular expression pattern and applicable flags. */ - match(regexp: RegExp): RegExpMatchArray; + match(regexp: RegExp): RegExpMatchArray | null; /** * Replaces text in a string, using a regular expression or search string. @@ -344,40 +342,40 @@ interface String { /** * Finds the first substring match in a regular expression search. - * @param regexp The regular expression pattern and applicable flags. + * @param regexp The regular expression pattern and applicable flags. */ search(regexp: string): number; /** * Finds the first substring match in a regular expression search. - * @param regexp The regular expression pattern and applicable flags. + * @param regexp The regular expression pattern and applicable flags. */ search(regexp: RegExp): number; /** * Returns a section of a string. - * @param start The index to the beginning of the specified portion of stringObj. - * @param end The index to the end of the specified portion of stringObj. The substring includes the characters up to, but not including, the character indicated by end. + * @param start The index to the beginning of the specified portion of stringObj. + * @param end The index to the end of the specified portion of stringObj. The substring includes the characters up to, but not including, the character indicated by end. * If this value is not specified, the substring continues to the end of stringObj. */ slice(start?: number, end?: number): string; /** * Split a string into substrings using the specified separator and return them as an array. - * @param separator A string that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. + * @param separator A string that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. * @param limit A value used to limit the number of elements returned in the array. */ split(separator: string, limit?: number): string[]; /** * Split a string into substrings using the specified separator and return them as an array. - * @param separator A Regular Express that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. + * @param separator A Regular Express that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. * @param limit A value used to limit the number of elements returned in the array. */ split(separator: RegExp, limit?: number): string[]; /** - * Returns the substring at the specified location within a String object. + * Returns the substring at the specified location within a String object. * @param start The zero-based index number indicating the beginning of the substring. * @param end Zero-based index number indicating the end of the substring. The substring includes the characters up to, but not including, the character indicated by end. * If end is omitted, the characters from start through the end of the original string are returned. @@ -400,7 +398,7 @@ interface String { trim(): string; /** Returns the length of a String object. */ - length: number; + readonly length: number; // IE extensions /** @@ -413,20 +411,20 @@ interface String { /** Returns the primitive value of the specified object. */ valueOf(): string; - [index: number]: string; + readonly [index: number]: string; } interface StringConstructor { new (value?: any): String; (value?: any): string; - prototype: String; + readonly prototype: String; fromCharCode(...codes: number[]): string; } -/** - * Allows manipulation and formatting of text strings and determination and location of substrings within strings. +/** + * Allows manipulation and formatting of text strings and determination and location of substrings within strings. */ -declare var String: StringConstructor; +declare const String: StringConstructor; interface Boolean { /** Returns the primitive value of the specified object. */ @@ -436,10 +434,10 @@ interface Boolean { interface BooleanConstructor { new (value?: any): Boolean; (value?: any): boolean; - prototype: Boolean; + readonly prototype: Boolean; } -declare var Boolean: BooleanConstructor; +declare const Boolean: BooleanConstructor; interface Number { /** @@ -448,7 +446,7 @@ interface Number { */ toString(radix?: number): string; - /** + /** * Returns a string representing a number in fixed-point notation. * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive. */ @@ -473,75 +471,75 @@ interface Number { interface NumberConstructor { new (value?: any): Number; (value?: any): number; - prototype: Number; + readonly prototype: Number; /** The largest number that can be represented in JavaScript. Equal to approximately 1.79E+308. */ - MAX_VALUE: number; + readonly MAX_VALUE: number; /** The closest number to zero that can be represented in JavaScript. Equal to approximately 5.00E-324. */ - MIN_VALUE: number; + readonly MIN_VALUE: number; - /** + /** * A value that is not a number. * In equality comparisons, NaN does not equal any value, including itself. To test whether a value is equivalent to NaN, use the isNaN function. */ - NaN: number; - - /** - * A value that is less than the largest negative number that can be represented in JavaScript. - * JavaScript displays NEGATIVE_INFINITY values as -infinity. - */ - NEGATIVE_INFINITY: number; + readonly NaN: number; /** - * A value greater than the largest number that can be represented in JavaScript. - * JavaScript displays POSITIVE_INFINITY values as infinity. + * A value that is less than the largest negative number that can be represented in JavaScript. + * JavaScript displays NEGATIVE_INFINITY values as -infinity. */ - POSITIVE_INFINITY: number; + readonly NEGATIVE_INFINITY: number; + + /** + * A value greater than the largest number that can be represented in JavaScript. + * JavaScript displays POSITIVE_INFINITY values as infinity. + */ + readonly POSITIVE_INFINITY: number; } /** An object that represents a number of any kind. All JavaScript numbers are 64-bit floating-point numbers. */ -declare var Number: NumberConstructor; +declare const Number: NumberConstructor; interface TemplateStringsArray extends Array { - raw: string[]; + readonly raw: string[]; } interface Math { /** The mathematical constant e. This is Euler's number, the base of natural logarithms. */ - E: number; + readonly E: number; /** The natural logarithm of 10. */ - LN10: number; + readonly LN10: number; /** The natural logarithm of 2. */ - LN2: number; + readonly LN2: number; /** The base-2 logarithm of e. */ - LOG2E: number; + readonly LOG2E: number; /** The base-10 logarithm of e. */ - LOG10E: number; + readonly LOG10E: number; /** Pi. This is the ratio of the circumference of a circle to its diameter. */ - PI: number; + readonly PI: number; /** The square root of 0.5, or, equivalently, one divided by the square root of 2. */ - SQRT1_2: number; + readonly SQRT1_2: number; /** The square root of 2. */ - SQRT2: number; + readonly SQRT2: number; /** - * Returns the absolute value of a number (the value without regard to whether it is positive or negative). + * Returns the absolute value of a number (the value without regard to whether it is positive or negative). * For example, the absolute value of -5 is the same as the absolute value of 5. * @param x A numeric expression for which the absolute value is needed. */ abs(x: number): number; /** - * Returns the arc cosine (or inverse cosine) of a number. + * Returns the arc cosine (or inverse cosine) of a number. * @param x A numeric expression. */ acos(x: number): number; - /** - * Returns the arcsine of a number. + /** + * Returns the arcsine of a number. * @param x A numeric expression. */ asin(x: number): number; /** - * Returns the arctangent of a number. + * Returns the arctangent of a number. * @param x A numeric expression for which the arctangent is needed. */ atan(x: number): number; @@ -552,49 +550,49 @@ interface Math { */ atan2(y: number, x: number): number; /** - * Returns the smallest number greater than or equal to its numeric argument. + * Returns the smallest number greater than or equal to its numeric argument. * @param x A numeric expression. */ ceil(x: number): number; /** - * Returns the cosine of a number. + * Returns the cosine of a number. * @param x A numeric expression that contains an angle measured in radians. */ cos(x: number): number; /** - * Returns e (the base of natural logarithms) raised to a power. + * Returns e (the base of natural logarithms) raised to a power. * @param x A numeric expression representing the power of e. */ exp(x: number): number; /** - * Returns the greatest number less than or equal to its numeric argument. + * Returns the greatest number less than or equal to its numeric argument. * @param x A numeric expression. */ floor(x: number): number; /** - * Returns the natural logarithm (base e) of a number. + * Returns the natural logarithm (base e) of a number. * @param x A numeric expression. */ log(x: number): number; /** - * Returns the larger of a set of supplied numeric expressions. + * Returns the larger of a set of supplied numeric expressions. * @param values Numeric expressions to be evaluated. */ max(...values: number[]): number; /** - * Returns the smaller of a set of supplied numeric expressions. + * Returns the smaller of a set of supplied numeric expressions. * @param values Numeric expressions to be evaluated. */ min(...values: number[]): number; /** - * Returns the value of a base expression taken to a specified power. + * Returns the value of a base expression taken to a specified power. * @param x The base value of the expression. * @param y The exponent value of the expression. */ pow(x: number, y: number): number; /** Returns a pseudorandom number between 0 and 1. */ random(): number; - /** + /** * Returns a supplied numeric expression rounded to the nearest number. * @param x The value to be rounded to the nearest number. */ @@ -616,7 +614,7 @@ interface Math { tan(x: number): number; } /** An intrinsic object that provides basic mathematics functionality and constants. */ -declare var Math: Math; +declare const Math: Math; /** Enables basic storage and retrieval of dates and times. */ interface Date { @@ -670,24 +668,24 @@ interface Date { getUTCMilliseconds(): number; /** Gets the difference in minutes between the time on the local computer and Universal Coordinated Time (UTC). */ getTimezoneOffset(): number; - /** + /** * Sets the date and time value in the Date object. - * @param time A numeric value representing the number of elapsed milliseconds since midnight, January 1, 1970 GMT. + * @param time A numeric value representing the number of elapsed milliseconds since midnight, January 1, 1970 GMT. */ setTime(time: number): number; /** - * Sets the milliseconds value in the Date object using local time. + * Sets the milliseconds value in the Date object using local time. * @param ms A numeric value equal to the millisecond value. */ setMilliseconds(ms: number): number; - /** + /** * Sets the milliseconds value in the Date object using Universal Coordinated Time (UTC). - * @param ms A numeric value equal to the millisecond value. + * @param ms A numeric value equal to the millisecond value. */ setUTCMilliseconds(ms: number): number; /** - * Sets the seconds value in the Date object using local time. + * Sets the seconds value in the Date object using local time. * @param sec A numeric value equal to the seconds value. * @param ms A numeric value equal to the milliseconds value. */ @@ -699,16 +697,16 @@ interface Date { */ setUTCSeconds(sec: number, ms?: number): number; /** - * Sets the minutes value in the Date object using local time. - * @param min A numeric value equal to the minutes value. - * @param sec A numeric value equal to the seconds value. + * Sets the minutes value in the Date object using local time. + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. * @param ms A numeric value equal to the milliseconds value. */ setMinutes(min: number, sec?: number, ms?: number): number; /** * Sets the minutes value in the Date object using Universal Coordinated Time (UTC). - * @param min A numeric value equal to the minutes value. - * @param sec A numeric value equal to the seconds value. + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. * @param ms A numeric value equal to the milliseconds value. */ setUTCMinutes(min: number, sec?: number, ms?: number): number; @@ -716,7 +714,7 @@ interface Date { * Sets the hour value in the Date object using local time. * @param hours A numeric value equal to the hours value. * @param min A numeric value equal to the minutes value. - * @param sec A numeric value equal to the seconds value. + * @param sec A numeric value equal to the seconds value. * @param ms A numeric value equal to the milliseconds value. */ setHours(hours: number, min?: number, sec?: number, ms?: number): number; @@ -724,23 +722,23 @@ interface Date { * Sets the hours value in the Date object using Universal Coordinated Time (UTC). * @param hours A numeric value equal to the hours value. * @param min A numeric value equal to the minutes value. - * @param sec A numeric value equal to the seconds value. + * @param sec A numeric value equal to the seconds value. * @param ms A numeric value equal to the milliseconds value. */ setUTCHours(hours: number, min?: number, sec?: number, ms?: number): number; /** - * Sets the numeric day-of-the-month value of the Date object using local time. + * Sets the numeric day-of-the-month value of the Date object using local time. * @param date A numeric value equal to the day of the month. */ setDate(date: number): number; - /** + /** * Sets the numeric day of the month in the Date object using Universal Coordinated Time (UTC). - * @param date A numeric value equal to the day of the month. + * @param date A numeric value equal to the day of the month. */ setUTCDate(date: number): number; - /** - * Sets the month value in the Date object using local time. - * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. + /** + * Sets the month value in the Date object using local time. + * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. * @param date A numeric value representing the day of the month. If this value is not supplied, the value from a call to the getDate method is used. */ setMonth(month: number, date?: number): number; @@ -778,14 +776,14 @@ interface DateConstructor { new (value: string): Date; new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; (): string; - prototype: Date; + readonly prototype: Date; /** * Parses a string containing a date, and returns the number of milliseconds between that date and midnight, January 1, 1970. * @param s A date string */ parse(s: string): number; /** - * Returns the number of milliseconds between midnight, January 1, 1970 Universal Coordinated Time (UTC) (or GMT) and the specified date. + * Returns the number of milliseconds between midnight, January 1, 1970 Universal Coordinated Time (UTC) (or GMT) and the specified date. * @param year The full year designation is required for cross-century date accuracy. If year is between 0 and 99 is used, then year is assumed to be 1900 + year. * @param month The month as an number between 0 and 11 (January to December). * @param date The date as an number between 1 and 31. @@ -798,7 +796,7 @@ interface DateConstructor { now(): number; } -declare var Date: DateConstructor; +declare const Date: DateConstructor; interface RegExpMatchArray extends Array { index?: number; @@ -811,40 +809,42 @@ interface RegExpExecArray extends Array { } interface RegExp { - /** + /** * Executes a search on a string using a regular expression pattern, and returns an array containing the results of that search. * @param string The String object or string literal on which to perform the search. */ - exec(string: string): RegExpExecArray; + exec(string: string): RegExpExecArray | null; - /** + /** * Returns a Boolean value that indicates whether or not a pattern exists in a searched string. * @param string String on which to perform the search. */ test(string: string): boolean; /** Returns a copy of the text of the regular expression pattern. Read-only. The regExp argument is a Regular expression object. It can be a variable name or a literal. */ - source: string; + readonly source: string; /** Returns a Boolean value indicating the state of the global flag (g) used with a regular expression. Default is false. Read-only. */ - global: boolean; + readonly global: boolean; /** Returns a Boolean value indicating the state of the ignoreCase flag (i) used with a regular expression. Default is false. Read-only. */ - ignoreCase: boolean; + readonly ignoreCase: boolean; /** Returns a Boolean value indicating the state of the multiline flag (m) used with a regular expression. Default is false. Read-only. */ - multiline: boolean; + readonly multiline: boolean; lastIndex: number; // Non-standard extensions - compile(): RegExp; + compile(): this; } interface RegExpConstructor { + new (pattern: RegExp): RegExp; new (pattern: string, flags?: string): RegExp; + (pattern: RegExp): RegExp; (pattern: string, flags?: string): RegExp; - prototype: RegExp; + readonly prototype: RegExp; // Non-standard extensions $1: string; @@ -859,20 +859,21 @@ interface RegExpConstructor { lastMatch: string; } -declare var RegExp: RegExpConstructor; +declare const RegExp: RegExpConstructor; interface Error { name: string; message: string; + stack?: string; } interface ErrorConstructor { new (message?: string): Error; (message?: string): Error; - prototype: Error; + readonly prototype: Error; } -declare var Error: ErrorConstructor; +declare const Error: ErrorConstructor; interface EvalError extends Error { } @@ -880,10 +881,10 @@ interface EvalError extends Error { interface EvalErrorConstructor { new (message?: string): EvalError; (message?: string): EvalError; - prototype: EvalError; + readonly prototype: EvalError; } -declare var EvalError: EvalErrorConstructor; +declare const EvalError: EvalErrorConstructor; interface RangeError extends Error { } @@ -891,10 +892,10 @@ interface RangeError extends Error { interface RangeErrorConstructor { new (message?: string): RangeError; (message?: string): RangeError; - prototype: RangeError; + readonly prototype: RangeError; } -declare var RangeError: RangeErrorConstructor; +declare const RangeError: RangeErrorConstructor; interface ReferenceError extends Error { } @@ -902,10 +903,10 @@ interface ReferenceError extends Error { interface ReferenceErrorConstructor { new (message?: string): ReferenceError; (message?: string): ReferenceError; - prototype: ReferenceError; + readonly prototype: ReferenceError; } -declare var ReferenceError: ReferenceErrorConstructor; +declare const ReferenceError: ReferenceErrorConstructor; interface SyntaxError extends Error { } @@ -913,10 +914,10 @@ interface SyntaxError extends Error { interface SyntaxErrorConstructor { new (message?: string): SyntaxError; (message?: string): SyntaxError; - prototype: SyntaxError; + readonly prototype: SyntaxError; } -declare var SyntaxError: SyntaxErrorConstructor; +declare const SyntaxError: SyntaxErrorConstructor; interface TypeError extends Error { } @@ -924,10 +925,10 @@ interface TypeError extends Error { interface TypeErrorConstructor { new (message?: string): TypeError; (message?: string): TypeError; - prototype: TypeError; + readonly prototype: TypeError; } -declare var TypeError: TypeErrorConstructor; +declare const TypeError: TypeErrorConstructor; interface URIError extends Error { } @@ -935,61 +936,147 @@ interface URIError extends Error { interface URIErrorConstructor { new (message?: string): URIError; (message?: string): URIError; - prototype: URIError; + readonly prototype: URIError; } -declare var URIError: URIErrorConstructor; +declare const URIError: URIErrorConstructor; interface JSON { /** * Converts a JavaScript Object Notation (JSON) string into an object. * @param text A valid JSON string. - * @param reviver A function that transforms the results. This function is called for each member of the object. - * If a member contains nested objects, the nested objects are transformed before the parent object is. + * @param reviver A function that transforms the results. This function is called for each member of the object. + * If a member contains nested objects, the nested objects are transformed before the parent object is. */ parse(text: string, reviver?: (key: any, value: any) => any): any; - /** - * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. - * @param value A JavaScript value, usually an object or array, to be converted. - */ - stringify(value: any): string; - /** - * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. - * @param value A JavaScript value, usually an object or array, to be converted. - * @param replacer A function that transforms the results. - */ - stringify(value: any, replacer: (key: string, value: any) => any): string; - /** - * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. - * @param value A JavaScript value, usually an object or array, to be converted. - * @param replacer Array that transforms the results. - */ - stringify(value: any, replacer: any[]): string; /** * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. * @param value A JavaScript value, usually an object or array, to be converted. * @param replacer A function that transforms the results. * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. */ - stringify(value: any, replacer: (key: string, value: any) => any, space: string | number): string; + stringify(value: any, replacer?: (key: string, value: any) => any, space?: string | number): string; /** * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. * @param value A JavaScript value, usually an object or array, to be converted. - * @param replacer Array that transforms the results. + * @param replacer An array of strings and numbers that acts as a white list for selecting the object properties that will be stringified. * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. */ - stringify(value: any, replacer: any[], space: string | number): string; + stringify(value: any, replacer?: (number | string)[] | null, space?: string | number): string; } + /** * An intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format. */ -declare var JSON: JSON; +declare const JSON: JSON; ///////////////////////////// /// ECMAScript Array API (specially handled by compiler) ///////////////////////////// +interface ReadonlyArray { + /** + * Gets the length of the array. This is a number one higher than the highest element defined in an array. + */ + readonly length: number; + /** + * Returns a string representation of an array. + */ + toString(): string; + toLocaleString(): string; + /** + * Combines two or more arrays. + * @param items Additional items to add to the end of array1. + */ + concat>(...items: U[]): T[]; + /** + * Combines two or more arrays. + * @param items Additional items to add to the end of array1. + */ + concat(...items: T[]): T[]; + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): T[]; + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. + */ + indexOf(searchElement: T, fromIndex?: number): number; + + /** + * Returns the index of the last occurrence of a specified value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array. + */ + lastIndexOf(searchElement: T, fromIndex?: number): number; + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: T, index: number, array: ReadonlyArray) => boolean, thisArg?: any): boolean; + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: T, index: number, array: ReadonlyArray) => boolean, thisArg?: any): boolean; + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: T, index: number, array: ReadonlyArray) => void, thisArg?: any): void; + /** + * Calls a defined callback function on each element of an array, and returns an array that contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: T, index: number, array: ReadonlyArray) => U, thisArg?: any): U[]; + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (value: T, index: number, array: ReadonlyArray) => any, thisArg?: any): T[]; + /** + * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: ReadonlyArray) => T, initialValue?: T): T; + /** + * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: ReadonlyArray) => U, initialValue: U): U; + /** + * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: ReadonlyArray) => T, initialValue?: T): T; + /** + * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: ReadonlyArray) => U, initialValue: U): U; + + readonly [n: number]: T; +} + interface Array { /** * Gets or sets the length of the array. This is a number one higher than the highest element defined in an array. @@ -1008,49 +1095,41 @@ interface Array { /** * Removes the last element from an array and returns it. */ - pop(): T; + pop(): T | undefined; /** * Combines two or more arrays. * @param items Additional items to add to the end of array1. */ - concat(...items: U[]): T[]; - /** - * Combines two or more arrays. - * @param items Additional items to add to the end of array1. - */ - concat(...items: T[]): T[]; + concat(...items: (T | T[])[]): T[]; /** * Adds all the elements of an array separated by the specified separator string. * @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): T[]; /** * Removes the first element from an array and returns it. */ - shift(): T; - /** + shift(): T | undefined; + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. */ slice(start?: number, end?: number): T[]; - /** * Sorts an array. * @param compareFn The name of the function used to determine the order of the elements. If omitted, the elements are sorted in ascending, ASCII character order. */ - sort(compareFn?: (a: T, b: T) => number): T[]; - + sort(compareFn?: (a: T, b: T) => number): this; /** * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. * @param start The zero-based location in the array from which to start removing elements. */ splice(start: number): T[]; - /** * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. * @param start The zero-based location in the array from which to start removing elements. @@ -1058,62 +1137,53 @@ interface Array { * @param items Elements to insert into the array in place of the deleted elements. */ splice(start: number, deleteCount: number, ...items: T[]): T[]; - /** * Inserts new elements at the start of an array. * @param items Elements to insert at the start of the Array. */ unshift(...items: T[]): number; - /** * Returns the index of the first occurrence of a value in an array. * @param searchElement The value to locate in the array. * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. */ indexOf(searchElement: T, fromIndex?: number): number; - /** * Returns the index of the last occurrence of a specified value in an array. * @param searchElement The value to locate in the array. * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array. */ lastIndexOf(searchElement: T, fromIndex?: number): number; - /** * Determines whether all the members of an array satisfy the specified test. * @param callbackfn A function that accepts up to three arguments. The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. */ every(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; - /** * Determines whether the specified callback function returns true for any element of an array. * @param callbackfn A function that accepts up to three arguments. The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; - /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void; - /** * Calls a defined callback function on each element of an array, and returns an array that contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. + * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[]; - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. */ - filter(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): T[]; - + filter(callbackfn: (value: T, index: number, array: T[]) => any, thisArg?: any): T[]; /** * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. @@ -1126,16 +1196,15 @@ interface Array { * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; - - /** + /** * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. */ reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; - /** + /** * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; @@ -1151,10 +1220,10 @@ interface ArrayConstructor { (arrayLength: number): T[]; (...items: T[]): T[]; isArray(arg: any): arg is Array; - prototype: Array; + readonly prototype: Array; } -declare var Array: ArrayConstructor; +declare const Array: ArrayConstructor; interface TypedPropertyDescriptor { enumerable?: boolean; @@ -1184,22 +1253,21 @@ interface PromiseLike { } interface ArrayLike { - length: number; - [n: number]: T; + readonly length: number; + readonly [n: number]: T; } - /** - * Represents a raw buffer of binary data, which is used to store data for the - * different typed arrays. ArrayBuffers cannot be read from or written to directly, - * but can be passed to a typed array or DataView Object to interpret the raw - * buffer as needed. + * Represents a raw buffer of binary data, which is used to store data for the + * different typed arrays. ArrayBuffers cannot be read from or written to directly, + * but can be passed to a typed array or DataView Object to interpret the raw + * buffer as needed. */ interface ArrayBuffer { /** * Read-only. The length of the ArrayBuffer (in bytes). */ - byteLength: number; + readonly byteLength: number; /** * Returns a section of an ArrayBuffer. @@ -1208,15 +1276,15 @@ interface ArrayBuffer { } interface ArrayBufferConstructor { - prototype: ArrayBuffer; + readonly prototype: ArrayBuffer; new (byteLength: number): ArrayBuffer; isView(arg: any): arg is ArrayBufferView; } -declare var ArrayBuffer: ArrayBufferConstructor; +declare const ArrayBuffer: ArrayBufferConstructor; interface ArrayBufferView { /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ buffer: ArrayBuffer; @@ -1232,128 +1300,128 @@ interface ArrayBufferView { } interface DataView { - buffer: ArrayBuffer; - byteLength: number; - byteOffset: number; + readonly buffer: ArrayBuffer; + readonly byteLength: number; + readonly byteOffset: number; /** - * Gets the Float32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. + * Gets the Float32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. * @param byteOffset The place in the buffer at which the value should be retrieved. */ getFloat32(byteOffset: number, littleEndian?: boolean): number; /** * Gets the Float64 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. + * no alignment constraint; multi-byte values may be fetched from any offset. * @param byteOffset The place in the buffer at which the value should be retrieved. */ getFloat64(byteOffset: number, littleEndian?: boolean): number; /** - * Gets the Int8 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. + * Gets the Int8 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. * @param byteOffset The place in the buffer at which the value should be retrieved. */ getInt8(byteOffset: number): number; /** - * Gets the Int16 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. + * Gets the Int16 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. * @param byteOffset The place in the buffer at which the value should be retrieved. */ getInt16(byteOffset: number, littleEndian?: boolean): number; /** - * Gets the Int32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. + * Gets the Int32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. * @param byteOffset The place in the buffer at which the value should be retrieved. */ getInt32(byteOffset: number, littleEndian?: boolean): number; /** - * Gets the Uint8 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. + * Gets the Uint8 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. * @param byteOffset The place in the buffer at which the value should be retrieved. */ getUint8(byteOffset: number): number; /** - * Gets the Uint16 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. + * Gets the Uint16 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. * @param byteOffset The place in the buffer at which the value should be retrieved. */ getUint16(byteOffset: number, littleEndian?: boolean): number; /** - * Gets the Uint32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. + * Gets the Uint32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. * @param byteOffset The place in the buffer at which the value should be retrieved. */ getUint32(byteOffset: number, littleEndian?: boolean): number; /** - * Stores an Float32 value at the specified byte offset from the start of the view. + * Stores an Float32 value at the specified byte offset from the start of the view. * @param byteOffset The place in the buffer at which the value should be set. * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, + * @param littleEndian If false or undefined, a big-endian value should be written, * otherwise a little-endian value should be written. */ setFloat32(byteOffset: number, value: number, littleEndian?: boolean): void; /** - * Stores an Float64 value at the specified byte offset from the start of the view. + * Stores an Float64 value at the specified byte offset from the start of the view. * @param byteOffset The place in the buffer at which the value should be set. * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, + * @param littleEndian If false or undefined, a big-endian value should be written, * otherwise a little-endian value should be written. */ setFloat64(byteOffset: number, value: number, littleEndian?: boolean): void; /** - * Stores an Int8 value at the specified byte offset from the start of the view. + * Stores an Int8 value at the specified byte offset from the start of the view. * @param byteOffset The place in the buffer at which the value should be set. * @param value The value to set. */ setInt8(byteOffset: number, value: number): void; /** - * Stores an Int16 value at the specified byte offset from the start of the view. + * Stores an Int16 value at the specified byte offset from the start of the view. * @param byteOffset The place in the buffer at which the value should be set. * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, + * @param littleEndian If false or undefined, a big-endian value should be written, * otherwise a little-endian value should be written. */ setInt16(byteOffset: number, value: number, littleEndian?: boolean): void; /** - * Stores an Int32 value at the specified byte offset from the start of the view. + * Stores an Int32 value at the specified byte offset from the start of the view. * @param byteOffset The place in the buffer at which the value should be set. * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, + * @param littleEndian If false or undefined, a big-endian value should be written, * otherwise a little-endian value should be written. */ setInt32(byteOffset: number, value: number, littleEndian?: boolean): void; /** - * Stores an Uint8 value at the specified byte offset from the start of the view. + * Stores an Uint8 value at the specified byte offset from the start of the view. * @param byteOffset The place in the buffer at which the value should be set. * @param value The value to set. */ setUint8(byteOffset: number, value: number): void; /** - * Stores an Uint16 value at the specified byte offset from the start of the view. + * Stores an Uint16 value at the specified byte offset from the start of the view. * @param byteOffset The place in the buffer at which the value should be set. * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, + * @param littleEndian If false or undefined, a big-endian value should be written, * otherwise a little-endian value should be written. */ setUint16(byteOffset: number, value: number, littleEndian?: boolean): void; /** - * Stores an Uint32 value at the specified byte offset from the start of the view. + * Stores an Uint32 value at the specified byte offset from the start of the view. * @param byteOffset The place in the buffer at which the value should be set. * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, + * @param littleEndian If false or undefined, a big-endian value should be written, * otherwise a little-endian value should be written. */ setUint32(byteOffset: number, value: number, littleEndian?: boolean): void; @@ -1362,48 +1430,48 @@ interface DataView { interface DataViewConstructor { new (buffer: ArrayBuffer, byteOffset?: number, byteLength?: number): DataView; } -declare var DataView: DataViewConstructor; +declare const DataView: DataViewConstructor; /** - * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested + * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested * number of bytes could not be allocated an exception is raised. */ interface Int8Array { /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ - BYTES_PER_ELEMENT: number; + readonly BYTES_PER_ELEMENT: number; /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ - buffer: ArrayBuffer; + readonly buffer: ArrayBuffer; /** * The length in bytes of the array. */ - byteLength: number; + readonly byteLength: number; /** * The offset in bytes of the array. */ - byteOffset: number; + readonly byteOffset: number; - /** + /** * Returns the this object after copying a section of the array identified by start and end * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * @param end If not specified, length of the this object is used as its default value. */ - copyWithin(target: number, start: number, end?: number): Int8Array; + copyWithin(target: number, start: number, end?: number): this; /** * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, * or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. @@ -1413,49 +1481,49 @@ interface Int8Array { /** * Returns the this object after filling the section identified by start and end with value * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ - fill(value: number, start?: number, end?: number): Int8Array; + fill(value: number, start?: number, end?: number): this; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - filter(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): Int8Array; + filter(callbackfn: (value: number, index: number, array: Int8Array) => any, thisArg?: any): Int8Array; - /** - * Returns the value of the first element in the array where predicate is true, and undefined + /** + * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; - /** - * Returns the index of the first element in the array where predicate is true, and undefined + /** + * Returns the index of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ findIndex(predicate: (value: number) => boolean, thisArg?: any): number; /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: number, index: number, array: Int8Array) => void, thisArg?: any): void; @@ -1470,7 +1538,7 @@ interface Int8Array { /** * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the + * @param separator A string used to separate one element of an array from the next in the * resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; @@ -1478,7 +1546,7 @@ interface Int8Array { /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the * search starts at index 0. */ lastIndexOf(searchElement: number, fromIndex?: number): number; @@ -1486,68 +1554,68 @@ interface Int8Array { /** * The length of the array. */ - length: number; + readonly length: number; /** - * Calls a defined callback function on each element of an array, and returns an array that + * Calls a defined callback function on each element of an array, and returns an array that * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: number, index: number, array: Int8Array) => number, thisArg?: any): Int8Array; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): Int8Array; @@ -1565,7 +1633,7 @@ interface Int8Array { */ set(array: ArrayLike, offset?: number): void; - /** + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. @@ -1574,31 +1642,31 @@ interface Int8Array { /** * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean; /** * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If + * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ - sort(compareFn?: (a: number, b: number) => number): Int8Array; + sort(compareFn?: (a: number, b: number) => number): this; /** * Gets a new Int8Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. + * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ subarray(begin: number, end?: number): Int8Array; /** - * Converts a number to a string by using the current locale. + * Converts a number to a string by using the current locale. */ toLocaleString(): string; @@ -1610,22 +1678,22 @@ interface Int8Array { [index: number]: number; } interface Int8ArrayConstructor { - prototype: Int8Array; + readonly prototype: Int8Array; new (length: number): Int8Array; new (array: ArrayLike): Int8Array; new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int8Array; /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ - BYTES_PER_ELEMENT: number; + readonly BYTES_PER_ELEMENT: number; /** * Returns a new array from a set of elements. * @param items A set of elements to include in the new array object. */ of(...items: number[]): Int8Array; - + /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. @@ -1635,48 +1703,48 @@ interface Int8ArrayConstructor { from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array; } -declare var Int8Array: Int8ArrayConstructor; +declare const Int8Array: Int8ArrayConstructor; /** - * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the + * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the * requested number of bytes could not be allocated an exception is raised. */ interface Uint8Array { /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ - BYTES_PER_ELEMENT: number; + readonly BYTES_PER_ELEMENT: number; /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ - buffer: ArrayBuffer; + readonly buffer: ArrayBuffer; /** * The length in bytes of the array. */ - byteLength: number; + readonly byteLength: number; /** * The offset in bytes of the array. */ - byteOffset: number; + readonly byteOffset: number; - /** + /** * Returns the this object after copying a section of the array identified by start and end * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * @param end If not specified, length of the this object is used as its default value. */ - copyWithin(target: number, start: number, end?: number): Uint8Array; + copyWithin(target: number, start: number, end?: number): this; /** * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, * or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. @@ -1686,49 +1754,49 @@ interface Uint8Array { /** * Returns the this object after filling the section identified by start and end with value * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ - fill(value: number, start?: number, end?: number): Uint8Array; + fill(value: number, start?: number, end?: number): this; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - filter(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): Uint8Array; + filter(callbackfn: (value: number, index: number, array: Uint8Array) => any, thisArg?: any): Uint8Array; - /** - * Returns the value of the first element in the array where predicate is true, and undefined + /** + * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; - /** - * Returns the index of the first element in the array where predicate is true, and undefined + /** + * Returns the index of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ findIndex(predicate: (value: number) => boolean, thisArg?: any): number; /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: number, index: number, array: Uint8Array) => void, thisArg?: any): void; @@ -1743,7 +1811,7 @@ interface Uint8Array { /** * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the + * @param separator A string used to separate one element of an array from the next in the * resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; @@ -1751,7 +1819,7 @@ interface Uint8Array { /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the * search starts at index 0. */ lastIndexOf(searchElement: number, fromIndex?: number): number; @@ -1759,68 +1827,68 @@ interface Uint8Array { /** * The length of the array. */ - length: number; + readonly length: number; /** - * Calls a defined callback function on each element of an array, and returns an array that + * Calls a defined callback function on each element of an array, and returns an array that * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: number, index: number, array: Uint8Array) => number, thisArg?: any): Uint8Array; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): Uint8Array; @@ -1838,7 +1906,7 @@ interface Uint8Array { */ set(array: ArrayLike, offset?: number): void; - /** + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. @@ -1847,31 +1915,31 @@ interface Uint8Array { /** * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean; /** * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If + * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ - sort(compareFn?: (a: number, b: number) => number): Uint8Array; + sort(compareFn?: (a: number, b: number) => number): this; /** * Gets a new Uint8Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. + * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ subarray(begin: number, end?: number): Uint8Array; /** - * Converts a number to a string by using the current locale. + * Converts a number to a string by using the current locale. */ toLocaleString(): string; @@ -1884,22 +1952,22 @@ interface Uint8Array { } interface Uint8ArrayConstructor { - prototype: Uint8Array; + readonly prototype: Uint8Array; new (length: number): Uint8Array; new (array: ArrayLike): Uint8Array; new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8Array; /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ - BYTES_PER_ELEMENT: number; + readonly BYTES_PER_ELEMENT: number; /** * Returns a new array from a set of elements. * @param items A set of elements to include in the new array object. */ of(...items: number[]): Uint8Array; - + /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. @@ -1909,48 +1977,48 @@ interface Uint8ArrayConstructor { from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array; } -declare var Uint8Array: Uint8ArrayConstructor; +declare const Uint8Array: Uint8ArrayConstructor; /** - * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. + * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. * If the requested number of bytes could not be allocated an exception is raised. */ interface Uint8ClampedArray { /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ - BYTES_PER_ELEMENT: number; + readonly BYTES_PER_ELEMENT: number; /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ - buffer: ArrayBuffer; + readonly buffer: ArrayBuffer; /** * The length in bytes of the array. */ - byteLength: number; + readonly byteLength: number; /** * The offset in bytes of the array. */ - byteOffset: number; + readonly byteOffset: number; - /** + /** * Returns the this object after copying a section of the array identified by start and end * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * @param end If not specified, length of the this object is used as its default value. */ - copyWithin(target: number, start: number, end?: number): Uint8ClampedArray; + copyWithin(target: number, start: number, end?: number): this; /** * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, * or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. @@ -1960,49 +2028,49 @@ interface Uint8ClampedArray { /** * Returns the this object after filling the section identified by start and end with value * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ - fill(value: number, start?: number, end?: number): Uint8ClampedArray; + fill(value: number, start?: number, end?: number): this; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - filter(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): Uint8ClampedArray; + filter(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => any, thisArg?: any): Uint8ClampedArray; - /** - * Returns the value of the first element in the array where predicate is true, and undefined + /** + * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; - /** - * Returns the index of the first element in the array where predicate is true, and undefined + /** + * Returns the index of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ findIndex(predicate: (value: number) => boolean, thisArg?: any): number; /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => void, thisArg?: any): void; @@ -2017,7 +2085,7 @@ interface Uint8ClampedArray { /** * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the + * @param separator A string used to separate one element of an array from the next in the * resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; @@ -2025,7 +2093,7 @@ interface Uint8ClampedArray { /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the * search starts at index 0. */ lastIndexOf(searchElement: number, fromIndex?: number): number; @@ -2033,68 +2101,68 @@ interface Uint8ClampedArray { /** * The length of the array. */ - length: number; + readonly length: number; /** - * Calls a defined callback function on each element of an array, and returns an array that + * Calls a defined callback function on each element of an array, and returns an array that * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => number, thisArg?: any): Uint8ClampedArray; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): Uint8ClampedArray; @@ -2112,7 +2180,7 @@ interface Uint8ClampedArray { */ set(array: Uint8ClampedArray, offset?: number): void; - /** + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. @@ -2121,31 +2189,31 @@ interface Uint8ClampedArray { /** * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): boolean; /** * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If + * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ - sort(compareFn?: (a: number, b: number) => number): Uint8ClampedArray; + sort(compareFn?: (a: number, b: number) => number): this; /** * Gets a new Uint8ClampedArray view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. + * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ subarray(begin: number, end?: number): Uint8ClampedArray; /** - * Converts a number to a string by using the current locale. + * Converts a number to a string by using the current locale. */ toLocaleString(): string; @@ -2158,15 +2226,15 @@ interface Uint8ClampedArray { } interface Uint8ClampedArrayConstructor { - prototype: Uint8ClampedArray; + readonly prototype: Uint8ClampedArray; new (length: number): Uint8ClampedArray; new (array: ArrayLike): Uint8ClampedArray; new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8ClampedArray; /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ - BYTES_PER_ELEMENT: number; + readonly BYTES_PER_ELEMENT: number; /** * Returns a new array from a set of elements. @@ -2182,48 +2250,48 @@ interface Uint8ClampedArrayConstructor { */ from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray; } -declare var Uint8ClampedArray: Uint8ClampedArrayConstructor; +declare const Uint8ClampedArray: Uint8ClampedArrayConstructor; /** - * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the + * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the * requested number of bytes could not be allocated an exception is raised. */ interface Int16Array { /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ - BYTES_PER_ELEMENT: number; + readonly BYTES_PER_ELEMENT: number; /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ - buffer: ArrayBuffer; + readonly buffer: ArrayBuffer; /** * The length in bytes of the array. */ - byteLength: number; + readonly byteLength: number; /** * The offset in bytes of the array. */ - byteOffset: number; + readonly byteOffset: number; - /** + /** * Returns the this object after copying a section of the array identified by start and end * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * @param end If not specified, length of the this object is used as its default value. */ - copyWithin(target: number, start: number, end?: number): Int16Array; + copyWithin(target: number, start: number, end?: number): this; /** * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, * or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. @@ -2233,49 +2301,49 @@ interface Int16Array { /** * Returns the this object after filling the section identified by start and end with value * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ - fill(value: number, start?: number, end?: number): Int16Array; + fill(value: number, start?: number, end?: number): this; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - filter(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): Int16Array; + filter(callbackfn: (value: number, index: number, array: Int16Array) => any, thisArg?: any): Int16Array; - /** - * Returns the value of the first element in the array where predicate is true, and undefined + /** + * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; - /** - * Returns the index of the first element in the array where predicate is true, and undefined + /** + * Returns the index of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ findIndex(predicate: (value: number) => boolean, thisArg?: any): number; /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: number, index: number, array: Int16Array) => void, thisArg?: any): void; @@ -2290,7 +2358,7 @@ interface Int16Array { /** * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the + * @param separator A string used to separate one element of an array from the next in the * resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; @@ -2298,7 +2366,7 @@ interface Int16Array { /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the * search starts at index 0. */ lastIndexOf(searchElement: number, fromIndex?: number): number; @@ -2306,68 +2374,68 @@ interface Int16Array { /** * The length of the array. */ - length: number; + readonly length: number; /** - * Calls a defined callback function on each element of an array, and returns an array that + * Calls a defined callback function on each element of an array, and returns an array that * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: number, index: number, array: Int16Array) => number, thisArg?: any): Int16Array; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): Int16Array; @@ -2385,7 +2453,7 @@ interface Int16Array { */ set(array: ArrayLike, offset?: number): void; - /** + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. @@ -2394,31 +2462,31 @@ interface Int16Array { /** * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean; /** * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If + * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ - sort(compareFn?: (a: number, b: number) => number): Int16Array; + sort(compareFn?: (a: number, b: number) => number): this; /** * Gets a new Int16Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. + * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ subarray(begin: number, end?: number): Int16Array; /** - * Converts a number to a string by using the current locale. + * Converts a number to a string by using the current locale. */ toLocaleString(): string; @@ -2431,22 +2499,22 @@ interface Int16Array { } interface Int16ArrayConstructor { - prototype: Int16Array; + readonly prototype: Int16Array; new (length: number): Int16Array; new (array: ArrayLike): Int16Array; new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int16Array; /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ - BYTES_PER_ELEMENT: number; + readonly BYTES_PER_ELEMENT: number; /** * Returns a new array from a set of elements. * @param items A set of elements to include in the new array object. */ of(...items: number[]): Int16Array; - + /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. @@ -2456,48 +2524,48 @@ interface Int16ArrayConstructor { from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array; } -declare var Int16Array: Int16ArrayConstructor; +declare const Int16Array: Int16ArrayConstructor; /** - * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the + * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the * requested number of bytes could not be allocated an exception is raised. */ interface Uint16Array { /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ - BYTES_PER_ELEMENT: number; + readonly BYTES_PER_ELEMENT: number; /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ - buffer: ArrayBuffer; + readonly buffer: ArrayBuffer; /** * The length in bytes of the array. */ - byteLength: number; + readonly byteLength: number; /** * The offset in bytes of the array. */ - byteOffset: number; + readonly byteOffset: number; - /** + /** * Returns the this object after copying a section of the array identified by start and end * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * @param end If not specified, length of the this object is used as its default value. */ - copyWithin(target: number, start: number, end?: number): Uint16Array; + copyWithin(target: number, start: number, end?: number): this; /** * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, * or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. @@ -2507,49 +2575,49 @@ interface Uint16Array { /** * Returns the this object after filling the section identified by start and end with value * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ - fill(value: number, start?: number, end?: number): Uint16Array; + fill(value: number, start?: number, end?: number): this; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - filter(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): Uint16Array; + filter(callbackfn: (value: number, index: number, array: Uint16Array) => any, thisArg?: any): Uint16Array; - /** - * Returns the value of the first element in the array where predicate is true, and undefined + /** + * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; - /** - * Returns the index of the first element in the array where predicate is true, and undefined + /** + * Returns the index of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ findIndex(predicate: (value: number) => boolean, thisArg?: any): number; /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: number, index: number, array: Uint16Array) => void, thisArg?: any): void; @@ -2564,7 +2632,7 @@ interface Uint16Array { /** * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the + * @param separator A string used to separate one element of an array from the next in the * resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; @@ -2572,7 +2640,7 @@ interface Uint16Array { /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the * search starts at index 0. */ lastIndexOf(searchElement: number, fromIndex?: number): number; @@ -2580,68 +2648,68 @@ interface Uint16Array { /** * The length of the array. */ - length: number; + readonly length: number; /** - * Calls a defined callback function on each element of an array, and returns an array that + * Calls a defined callback function on each element of an array, and returns an array that * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: number, index: number, array: Uint16Array) => number, thisArg?: any): Uint16Array; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): Uint16Array; @@ -2659,7 +2727,7 @@ interface Uint16Array { */ set(array: ArrayLike, offset?: number): void; - /** + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. @@ -2668,31 +2736,31 @@ interface Uint16Array { /** * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean; /** * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If + * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ - sort(compareFn?: (a: number, b: number) => number): Uint16Array; + sort(compareFn?: (a: number, b: number) => number): this; /** * Gets a new Uint16Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. + * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ subarray(begin: number, end?: number): Uint16Array; /** - * Converts a number to a string by using the current locale. + * Converts a number to a string by using the current locale. */ toLocaleString(): string; @@ -2705,22 +2773,22 @@ interface Uint16Array { } interface Uint16ArrayConstructor { - prototype: Uint16Array; + readonly prototype: Uint16Array; new (length: number): Uint16Array; new (array: ArrayLike): Uint16Array; new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint16Array; /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ - BYTES_PER_ELEMENT: number; + readonly BYTES_PER_ELEMENT: number; /** * Returns a new array from a set of elements. * @param items A set of elements to include in the new array object. */ of(...items: number[]): Uint16Array; - + /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. @@ -2730,47 +2798,47 @@ interface Uint16ArrayConstructor { from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array; } -declare var Uint16Array: Uint16ArrayConstructor; +declare const Uint16Array: Uint16ArrayConstructor; /** - * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the + * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the * requested number of bytes could not be allocated an exception is raised. */ interface Int32Array { /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ - BYTES_PER_ELEMENT: number; + readonly BYTES_PER_ELEMENT: number; /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ - buffer: ArrayBuffer; + readonly buffer: ArrayBuffer; /** * The length in bytes of the array. */ - byteLength: number; + readonly byteLength: number; /** * The offset in bytes of the array. */ - byteOffset: number; + readonly byteOffset: number; - /** + /** * Returns the this object after copying a section of the array identified by start and end * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * @param end If not specified, length of the this object is used as its default value. */ - copyWithin(target: number, start: number, end?: number): Int32Array; + copyWithin(target: number, start: number, end?: number): this; /** * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, * or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. @@ -2780,49 +2848,49 @@ interface Int32Array { /** * Returns the this object after filling the section identified by start and end with value * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ - fill(value: number, start?: number, end?: number): Int32Array; + fill(value: number, start?: number, end?: number): this; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - filter(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): Int32Array; + filter(callbackfn: (value: number, index: number, array: Int32Array) => any, thisArg?: any): Int32Array; - /** - * Returns the value of the first element in the array where predicate is true, and undefined + /** + * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; - /** - * Returns the index of the first element in the array where predicate is true, and undefined + /** + * Returns the index of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ findIndex(predicate: (value: number) => boolean, thisArg?: any): number; /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: number, index: number, array: Int32Array) => void, thisArg?: any): void; @@ -2837,7 +2905,7 @@ interface Int32Array { /** * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the + * @param separator A string used to separate one element of an array from the next in the * resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; @@ -2845,7 +2913,7 @@ interface Int32Array { /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the * search starts at index 0. */ lastIndexOf(searchElement: number, fromIndex?: number): number; @@ -2853,68 +2921,68 @@ interface Int32Array { /** * The length of the array. */ - length: number; + readonly length: number; /** - * Calls a defined callback function on each element of an array, and returns an array that + * Calls a defined callback function on each element of an array, and returns an array that * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: number, index: number, array: Int32Array) => number, thisArg?: any): Int32Array; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): Int32Array; @@ -2932,7 +3000,7 @@ interface Int32Array { */ set(array: ArrayLike, offset?: number): void; - /** + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. @@ -2941,31 +3009,31 @@ interface Int32Array { /** * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean; /** * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If + * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ - sort(compareFn?: (a: number, b: number) => number): Int32Array; + sort(compareFn?: (a: number, b: number) => number): this; /** * Gets a new Int32Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. + * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ subarray(begin: number, end?: number): Int32Array; /** - * Converts a number to a string by using the current locale. + * Converts a number to a string by using the current locale. */ toLocaleString(): string; @@ -2978,22 +3046,22 @@ interface Int32Array { } interface Int32ArrayConstructor { - prototype: Int32Array; + readonly prototype: Int32Array; new (length: number): Int32Array; new (array: ArrayLike): Int32Array; new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int32Array; /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ - BYTES_PER_ELEMENT: number; + readonly BYTES_PER_ELEMENT: number; /** * Returns a new array from a set of elements. * @param items A set of elements to include in the new array object. */ of(...items: number[]): Int32Array; - + /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. @@ -3002,48 +3070,48 @@ interface Int32ArrayConstructor { */ from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array; } -declare var Int32Array: Int32ArrayConstructor; +declare const Int32Array: Int32ArrayConstructor; /** - * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the + * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the * requested number of bytes could not be allocated an exception is raised. */ interface Uint32Array { /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ - BYTES_PER_ELEMENT: number; + readonly BYTES_PER_ELEMENT: number; /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ - buffer: ArrayBuffer; + readonly buffer: ArrayBuffer; /** * The length in bytes of the array. */ - byteLength: number; + readonly byteLength: number; /** * The offset in bytes of the array. */ - byteOffset: number; + readonly byteOffset: number; - /** + /** * Returns the this object after copying a section of the array identified by start and end * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * @param end If not specified, length of the this object is used as its default value. */ - copyWithin(target: number, start: number, end?: number): Uint32Array; + copyWithin(target: number, start: number, end?: number): this; /** * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, * or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. @@ -3053,49 +3121,49 @@ interface Uint32Array { /** * Returns the this object after filling the section identified by start and end with value * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ - fill(value: number, start?: number, end?: number): Uint32Array; + fill(value: number, start?: number, end?: number): this; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - filter(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): Uint32Array; + filter(callbackfn: (value: number, index: number, array: Uint32Array) => any, thisArg?: any): Uint32Array; - /** - * Returns the value of the first element in the array where predicate is true, and undefined + /** + * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; - /** - * Returns the index of the first element in the array where predicate is true, and undefined + /** + * Returns the index of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ findIndex(predicate: (value: number) => boolean, thisArg?: any): number; /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: number, index: number, array: Uint32Array) => void, thisArg?: any): void; @@ -3110,7 +3178,7 @@ interface Uint32Array { /** * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the + * @param separator A string used to separate one element of an array from the next in the * resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; @@ -3118,7 +3186,7 @@ interface Uint32Array { /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the * search starts at index 0. */ lastIndexOf(searchElement: number, fromIndex?: number): number; @@ -3126,68 +3194,68 @@ interface Uint32Array { /** * The length of the array. */ - length: number; + readonly length: number; /** - * Calls a defined callback function on each element of an array, and returns an array that + * Calls a defined callback function on each element of an array, and returns an array that * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: number, index: number, array: Uint32Array) => number, thisArg?: any): Uint32Array; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): Uint32Array; @@ -3205,7 +3273,7 @@ interface Uint32Array { */ set(array: ArrayLike, offset?: number): void; - /** + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. @@ -3214,31 +3282,31 @@ interface Uint32Array { /** * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean; /** * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If + * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ - sort(compareFn?: (a: number, b: number) => number): Uint32Array; + sort(compareFn?: (a: number, b: number) => number): this; /** * Gets a new Uint32Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. + * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ subarray(begin: number, end?: number): Uint32Array; /** - * Converts a number to a string by using the current locale. + * Converts a number to a string by using the current locale. */ toLocaleString(): string; @@ -3251,22 +3319,22 @@ interface Uint32Array { } interface Uint32ArrayConstructor { - prototype: Uint32Array; + readonly prototype: Uint32Array; new (length: number): Uint32Array; new (array: ArrayLike): Uint32Array; new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint32Array; /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ - BYTES_PER_ELEMENT: number; + readonly BYTES_PER_ELEMENT: number; /** * Returns a new array from a set of elements. * @param items A set of elements to include in the new array object. */ of(...items: number[]): Uint32Array; - + /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. @@ -3275,7 +3343,7 @@ interface Uint32ArrayConstructor { */ from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array; } -declare var Uint32Array: Uint32ArrayConstructor; +declare const Uint32Array: Uint32ArrayConstructor; /** * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number @@ -3283,40 +3351,40 @@ declare var Uint32Array: Uint32ArrayConstructor; */ interface Float32Array { /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ - BYTES_PER_ELEMENT: number; + readonly BYTES_PER_ELEMENT: number; /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ - buffer: ArrayBuffer; + readonly buffer: ArrayBuffer; /** * The length in bytes of the array. */ - byteLength: number; + readonly byteLength: number; /** * The offset in bytes of the array. */ - byteOffset: number; + readonly byteOffset: number; - /** + /** * Returns the this object after copying a section of the array identified by start and end * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * @param end If not specified, length of the this object is used as its default value. */ - copyWithin(target: number, start: number, end?: number): Float32Array; + copyWithin(target: number, start: number, end?: number): this; /** * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, * or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. @@ -3326,49 +3394,49 @@ interface Float32Array { /** * Returns the this object after filling the section identified by start and end with value * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ - fill(value: number, start?: number, end?: number): Float32Array; + fill(value: number, start?: number, end?: number): this; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - filter(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): Float32Array; + filter(callbackfn: (value: number, index: number, array: Float32Array) => any, thisArg?: any): Float32Array; - /** - * Returns the value of the first element in the array where predicate is true, and undefined + /** + * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; - /** - * Returns the index of the first element in the array where predicate is true, and undefined + /** + * Returns the index of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ findIndex(predicate: (value: number) => boolean, thisArg?: any): number; /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: number, index: number, array: Float32Array) => void, thisArg?: any): void; @@ -3383,7 +3451,7 @@ interface Float32Array { /** * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the + * @param separator A string used to separate one element of an array from the next in the * resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; @@ -3391,7 +3459,7 @@ interface Float32Array { /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the * search starts at index 0. */ lastIndexOf(searchElement: number, fromIndex?: number): number; @@ -3399,68 +3467,68 @@ interface Float32Array { /** * The length of the array. */ - length: number; + readonly length: number; /** - * Calls a defined callback function on each element of an array, and returns an array that + * Calls a defined callback function on each element of an array, and returns an array that * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: number, index: number, array: Float32Array) => number, thisArg?: any): Float32Array; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): Float32Array; @@ -3478,7 +3546,7 @@ interface Float32Array { */ set(array: ArrayLike, offset?: number): void; - /** + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. @@ -3487,31 +3555,31 @@ interface Float32Array { /** * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean; /** * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If + * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ - sort(compareFn?: (a: number, b: number) => number): Float32Array; + sort(compareFn?: (a: number, b: number) => number): this; /** * Gets a new Float32Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. + * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ subarray(begin: number, end?: number): Float32Array; /** - * Converts a number to a string by using the current locale. + * Converts a number to a string by using the current locale. */ toLocaleString(): string; @@ -3524,22 +3592,22 @@ interface Float32Array { } interface Float32ArrayConstructor { - prototype: Float32Array; + readonly prototype: Float32Array; new (length: number): Float32Array; new (array: ArrayLike): Float32Array; new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float32Array; /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ - BYTES_PER_ELEMENT: number; + readonly BYTES_PER_ELEMENT: number; /** * Returns a new array from a set of elements. * @param items A set of elements to include in the new array object. */ of(...items: number[]): Float32Array; - + /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. @@ -3549,48 +3617,48 @@ interface Float32ArrayConstructor { from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array; } -declare var Float32Array: Float32ArrayConstructor; +declare const Float32Array: Float32ArrayConstructor; /** - * A typed array of 64-bit float values. The contents are initialized to 0. If the requested + * A typed array of 64-bit float values. The contents are initialized to 0. If the requested * number of bytes could not be allocated an exception is raised. */ interface Float64Array { /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ - BYTES_PER_ELEMENT: number; + readonly BYTES_PER_ELEMENT: number; /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ - buffer: ArrayBuffer; + readonly buffer: ArrayBuffer; /** * The length in bytes of the array. */ - byteLength: number; + readonly byteLength: number; /** * The offset in bytes of the array. */ - byteOffset: number; + readonly byteOffset: number; - /** + /** * Returns the this object after copying a section of the array identified by start and end * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * @param end If not specified, length of the this object is used as its default value. */ - copyWithin(target: number, start: number, end?: number): Float64Array; + copyWithin(target: number, start: number, end?: number): this; /** * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, * or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. @@ -3600,49 +3668,49 @@ interface Float64Array { /** * Returns the this object after filling the section identified by start and end with value * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ - fill(value: number, start?: number, end?: number): Float64Array; + fill(value: number, start?: number, end?: number): this; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - filter(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): Float64Array; + filter(callbackfn: (value: number, index: number, array: Float64Array) => any, thisArg?: any): Float64Array; - /** - * Returns the value of the first element in the array where predicate is true, and undefined + /** + * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; - /** - * Returns the index of the first element in the array where predicate is true, and undefined + /** + * Returns the index of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ findIndex(predicate: (value: number) => boolean, thisArg?: any): number; /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: number, index: number, array: Float64Array) => void, thisArg?: any): void; @@ -3657,7 +3725,7 @@ interface Float64Array { /** * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the + * @param separator A string used to separate one element of an array from the next in the * resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; @@ -3665,7 +3733,7 @@ interface Float64Array { /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the * search starts at index 0. */ lastIndexOf(searchElement: number, fromIndex?: number): number; @@ -3673,68 +3741,68 @@ interface Float64Array { /** * The length of the array. */ - length: number; + readonly length: number; /** - * Calls a defined callback function on each element of an array, and returns an array that + * Calls a defined callback function on each element of an array, and returns an array that * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: number, index: number, array: Float64Array) => number, thisArg?: any): Float64Array; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): Float64Array; @@ -3752,7 +3820,7 @@ interface Float64Array { */ set(array: ArrayLike, offset?: number): void; - /** + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. @@ -3761,31 +3829,31 @@ interface Float64Array { /** * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean; /** * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If + * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ - sort(compareFn?: (a: number, b: number) => number): Float64Array; + sort(compareFn?: (a: number, b: number) => number): this; /** * Gets a new Float64Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. + * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ subarray(begin: number, end?: number): Float64Array; /** - * Converts a number to a string by using the current locale. + * Converts a number to a string by using the current locale. */ toLocaleString(): string; @@ -3798,22 +3866,22 @@ interface Float64Array { } interface Float64ArrayConstructor { - prototype: Float64Array; + readonly prototype: Float64Array; new (length: number): Float64Array; new (array: ArrayLike): Float64Array; new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float64Array; /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ - BYTES_PER_ELEMENT: number; + readonly BYTES_PER_ELEMENT: number; /** * Returns a new array from a set of elements. * @param items A set of elements to include in the new array object. */ of(...items: number[]): Float64Array; - + /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. @@ -3822,4 +3890,205 @@ interface Float64ArrayConstructor { */ from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; } -declare var Float64Array: Float64ArrayConstructor; +declare const Float64Array: Float64ArrayConstructor; + +///////////////////////////// +/// ECMAScript Internationalization API +///////////////////////////// + +declare module Intl { + interface CollatorOptions { + usage?: string; + localeMatcher?: string; + numeric?: boolean; + caseFirst?: string; + sensitivity?: string; + ignorePunctuation?: boolean; + } + + interface ResolvedCollatorOptions { + locale: string; + usage: string; + sensitivity: string; + ignorePunctuation: boolean; + collation: string; + caseFirst: string; + numeric: boolean; + } + + interface Collator { + compare(x: string, y: string): number; + resolvedOptions(): ResolvedCollatorOptions; + } + var Collator: { + new (locales?: string[], options?: CollatorOptions): Collator; + new (locale?: string, options?: CollatorOptions): Collator; + (locales?: string[], options?: CollatorOptions): Collator; + (locale?: string, options?: CollatorOptions): Collator; + supportedLocalesOf(locales: string[], options?: CollatorOptions): string[]; + supportedLocalesOf(locale: string, options?: CollatorOptions): string[]; + } + + interface NumberFormatOptions { + localeMatcher?: string; + style?: string; + currency?: string; + currencyDisplay?: string; + useGrouping?: boolean; + minimumIntegerDigits?: number; + minimumFractionDigits?: number; + maximumFractionDigits?: number; + minimumSignificantDigits?: number; + maximumSignificantDigits?: number; + } + + interface ResolvedNumberFormatOptions { + locale: string; + numberingSystem: string; + style: string; + currency?: string; + currencyDisplay?: string; + minimumIntegerDigits: number; + minimumFractionDigits: number; + maximumFractionDigits: number; + minimumSignificantDigits?: number; + maximumSignificantDigits?: number; + useGrouping: boolean; + } + + interface NumberFormat { + format(value: number): string; + resolvedOptions(): ResolvedNumberFormatOptions; + } + var NumberFormat: { + new (locales?: string[], options?: NumberFormatOptions): NumberFormat; + new (locale?: string, options?: NumberFormatOptions): NumberFormat; + (locales?: string[], options?: NumberFormatOptions): NumberFormat; + (locale?: string, options?: NumberFormatOptions): NumberFormat; + supportedLocalesOf(locales: string[], options?: NumberFormatOptions): string[]; + supportedLocalesOf(locale: string, options?: NumberFormatOptions): string[]; + } + + interface DateTimeFormatOptions { + localeMatcher?: string; + weekday?: string; + era?: string; + year?: string; + month?: string; + day?: string; + hour?: string; + minute?: string; + second?: string; + timeZoneName?: string; + formatMatcher?: string; + hour12?: boolean; + timeZone?: string; + } + + interface ResolvedDateTimeFormatOptions { + locale: string; + calendar: string; + numberingSystem: string; + timeZone: string; + hour12?: boolean; + weekday?: string; + era?: string; + year?: string; + month?: string; + day?: string; + hour?: string; + minute?: string; + second?: string; + timeZoneName?: string; + } + + interface DateTimeFormat { + format(date?: Date | number): string; + resolvedOptions(): ResolvedDateTimeFormatOptions; + } + var DateTimeFormat: { + new (locales?: string[], options?: DateTimeFormatOptions): DateTimeFormat; + new (locale?: string, options?: DateTimeFormatOptions): DateTimeFormat; + (locales?: string[], options?: DateTimeFormatOptions): DateTimeFormat; + (locale?: string, options?: DateTimeFormatOptions): DateTimeFormat; + supportedLocalesOf(locales: string[], options?: DateTimeFormatOptions): string[]; + supportedLocalesOf(locale: string, options?: DateTimeFormatOptions): string[]; + } +} + +interface String { + /** + * Determines whether two strings are equivalent in the current locale. + * @param that String to compare to target string + * @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. This parameter must conform to BCP 47 standards; see the Intl.Collator object for details. + * @param options An object that contains one or more properties that specify comparison options. see the Intl.Collator object for details. + */ + localeCompare(that: string, locales: string[], options?: Intl.CollatorOptions): number; + + /** + * Determines whether two strings are equivalent in the current locale. + * @param that String to compare to target string + * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. This parameter must conform to BCP 47 standards; see the Intl.Collator object for details. + * @param options An object that contains one or more properties that specify comparison options. see the Intl.Collator object for details. + */ + localeCompare(that: string, locale: string, options?: Intl.CollatorOptions): number; +} + +interface Number { + /** + * Converts a number to a string by using the current or specified locale. + * @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleString(locales?: string[], options?: Intl.NumberFormatOptions): string; + + /** + * Converts a number to a string by using the current or specified locale. + * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleString(locale?: string, options?: Intl.NumberFormatOptions): string; +} + +interface Date { + /** + * Converts a date and time to a string by using the current or specified locale. + * @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleString(locales?: string[], options?: Intl.DateTimeFormatOptions): string; + /** + * Converts a date to a string by using the current or specified locale. + * @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleDateString(locales?: string[], options?: Intl.DateTimeFormatOptions): string; + + /** + * Converts a time to a string by using the current or specified locale. + * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleTimeString(locale?: string[], options?: Intl.DateTimeFormatOptions): string; + + /** + * Converts a date and time to a string by using the current or specified locale. + * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleString(locale?: string, options?: Intl.DateTimeFormatOptions): string; + + /** + * Converts a date to a string by using the current or specified locale. + * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleDateString(locale?: string, options?: Intl.DateTimeFormatOptions): string; + + /** + * Converts a time to a string by using the current or specified locale. + * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleTimeString(locale?: string, options?: Intl.DateTimeFormatOptions): string; +} diff --git a/src/lib/es6.d.ts b/src/lib/es6.d.ts deleted file mode 100644 index 531dbf9e5ea..00000000000 --- a/src/lib/es6.d.ts +++ /dev/null @@ -1,1324 +0,0 @@ -declare type PropertyKey = string | number | symbol; - -interface Symbol { - /** Returns a string representation of an object. */ - toString(): string; - - /** Returns the primitive value of the specified object. */ - valueOf(): Object; - - [Symbol.toStringTag]: string; -} - -interface SymbolConstructor { - /** - * A reference to the prototype. - */ - prototype: Symbol; - - /** - * Returns a new unique Symbol value. - * @param description Description of the new Symbol object. - */ - (description?: string|number): symbol; - - /** - * Returns a Symbol object from the global symbol registry matching the given key if found. - * Otherwise, returns a new symbol with this key. - * @param key key to search for. - */ - for(key: string): symbol; - - /** - * Returns a key from the global symbol registry matching the given Symbol if found. - * Otherwise, returns a undefined. - * @param sym Symbol to find the key for. - */ - keyFor(sym: symbol): string; - - // Well-known Symbols - - /** - * A method that determines if a constructor object recognizes an object as one of the - * constructor’s instances. Called by the semantics of the instanceof operator. - */ - hasInstance: symbol; - - /** - * A Boolean value that if true indicates that an object should flatten to its array elements - * by Array.prototype.concat. - */ - isConcatSpreadable: symbol; - - /** - * A method that returns the default iterator for an object. Called by the semantics of the - * for-of statement. - */ - iterator: symbol; - - /** - * A regular expression method that matches the regular expression against a string. Called - * by the String.prototype.match method. - */ - match: symbol; - - /** - * A regular expression method that replaces matched substrings of a string. Called by the - * String.prototype.replace method. - */ - replace: symbol; - - /** - * A regular expression method that returns the index within a string that matches the - * regular expression. Called by the String.prototype.search method. - */ - search: symbol; - - /** - * A function valued property that is the constructor function that is used to create - * derived objects. - */ - species: symbol; - - /** - * A regular expression method that splits a string at the indices that match the regular - * expression. Called by the String.prototype.split method. - */ - split: symbol; - - /** - * A method that converts an object to a corresponding primitive value. - * Called by the ToPrimitive abstract operation. - */ - toPrimitive: symbol; - - /** - * A String value that is used in the creation of the default string description of an object. - * Called by the built-in method Object.prototype.toString. - */ - toStringTag: symbol; - - /** - * An Object whose own property names are property names that are excluded from the 'with' - * environment bindings of the associated objects. - */ - unscopables: symbol; -} -declare var Symbol: SymbolConstructor; - -interface Object { - /** - * Determines whether an object has a property with the specified name. - * @param v A property name. - */ - hasOwnProperty(v: PropertyKey): boolean; - - /** - * Determines whether a specified property is enumerable. - * @param v A property name. - */ - propertyIsEnumerable(v: PropertyKey): boolean; -} - -interface ObjectConstructor { - /** - * Copy the values of all of the enumerable own properties from one or more source objects to a - * target object. Returns the target object. - * @param target The target object to copy to. - * @param source The source object from which to copy properties. - */ - assign(target: T, source: U): T & U; - - /** - * Copy the values of all of the enumerable own properties from one or more source objects to a - * target object. Returns the target object. - * @param target The target object to copy to. - * @param source1 The first source object from which to copy properties. - * @param source2 The second source object from which to copy properties. - */ - assign(target: T, source1: U, source2: V): T & U & V; - - /** - * Copy the values of all of the enumerable own properties from one or more source objects to a - * target object. Returns the target object. - * @param target The target object to copy to. - * @param source1 The first source object from which to copy properties. - * @param source2 The second source object from which to copy properties. - * @param source3 The third source object from which to copy properties. - */ - assign(target: T, source1: U, source2: V, source3: W): T & U & V & W; - - /** - * Copy the values of all of the enumerable own properties from one or more source objects to a - * target object. Returns the target object. - * @param target The target object to copy to. - * @param sources One or more source objects from which to copy properties - */ - assign(target: any, ...sources: any[]): any; - - /** - * Returns an array of all symbol properties found directly on object o. - * @param o Object to retrieve the symbols from. - */ - getOwnPropertySymbols(o: any): symbol[]; - - /** - * Returns true if the values are the same value, false otherwise. - * @param value1 The first value. - * @param value2 The second value. - */ - is(value1: any, value2: any): boolean; - - /** - * Sets the prototype of a specified object o to object proto or null. Returns the object o. - * @param o The object to change its prototype. - * @param proto The value of the new prototype or null. - */ - setPrototypeOf(o: any, proto: any): any; - - /** - * Gets the own property descriptor of the specified object. - * An own property descriptor is one that is defined directly on the object and is not - * inherited from the object's prototype. - * @param o Object that contains the property. - * @param p Name of the property. - */ - getOwnPropertyDescriptor(o: any, propertyKey: PropertyKey): PropertyDescriptor; - - /** - * Adds a property to an object, or modifies attributes of an existing property. - * @param o Object on which to add or modify the property. This can be a native JavaScript - * object (that is, a user-defined object or a built in object) or a DOM object. - * @param p The property name. - * @param attributes Descriptor for the property. It can be for a data property or an accessor - * property. - */ - defineProperty(o: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): any; -} - -interface Function { - /** - * Returns the name of the function. Function names are read-only and can not be changed. - */ - name: string; - - /** - * Determines whether the given value inherits from this function if this function was used - * as a constructor function. - * - * A constructor function can control which objects are recognized as its instances by - * 'instanceof' by overriding this method. - */ - [Symbol.hasInstance](value: any): boolean; -} - -interface NumberConstructor { - /** - * The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1 - * that is representable as a Number value, which is approximately: - * 2.2204460492503130808472633361816 x 10‍−‍16. - */ - EPSILON: number; - - /** - * Returns true if passed value is finite. - * Unlike the global isFininte, Number.isFinite doesn't forcibly convert the parameter to a - * number. Only finite values of the type number, result in true. - * @param number A numeric value. - */ - isFinite(number: number): boolean; - - /** - * Returns true if the value passed is an integer, false otherwise. - * @param number A numeric value. - */ - isInteger(number: number): boolean; - - /** - * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a - * number). Unlike the global isNaN(), Number.isNaN() doesn't forcefully convert the parameter - * to a number. Only values of the type number, that are also NaN, result in true. - * @param number A numeric value. - */ - isNaN(number: number): boolean; - - /** - * Returns true if the value passed is a safe integer. - * @param number A numeric value. - */ - isSafeInteger(number: number): boolean; - - /** - * The value of the largest integer n such that n and n + 1 are both exactly representable as - * a Number value. - * The value of Number.MIN_SAFE_INTEGER is 9007199254740991 2^53 − 1. - */ - MAX_SAFE_INTEGER: number; - - /** - * The value of the smallest integer n such that n and n − 1 are both exactly representable as - * a Number value. - * The value of Number.MIN_SAFE_INTEGER is −9007199254740991 (−(2^53 − 1)). - */ - MIN_SAFE_INTEGER: number; - - /** - * Converts a string to a floating-point number. - * @param string A string that contains a floating-point number. - */ - parseFloat(string: string): number; - - /** - * Converts A string to an integer. - * @param s A string to convert into a number. - * @param radix A value between 2 and 36 that specifies the base of the number in numString. - * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. - * All other strings are considered decimal. - */ - parseInt(string: string, radix?: number): number; -} - -interface Array { - /** Iterator */ - [Symbol.iterator](): IterableIterator; - - /** - * Returns an object whose properties have the value 'true' - * when they will be absent when used in a 'with' statement. - */ - [Symbol.unscopables](): { - copyWithin: boolean; - entries: boolean; - fill: boolean; - find: boolean; - findIndex: boolean; - keys: boolean; - values: boolean; - }; - - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, T]>; - - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: T, index: number, obj: Array) => boolean, thisArg?: any): T; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: T) => boolean, thisArg?: any): number; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: T, start?: number, end?: number): T[]; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): T[]; -} - -interface IArguments { - /** Iterator */ - [Symbol.iterator](): IterableIterator; -} - -interface ArrayConstructor { - /** - * Creates an array from an array-like object. - * @param arrayLike An array-like object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): Array; - - /** - * Creates an array from an iterable object. - * @param iterable An iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(iterable: Iterable, mapfn: (v: T, k: number) => U, thisArg?: any): Array; - - /** - * Creates an array from an array-like object. - * @param arrayLike An array-like object to convert to an array. - */ - from(arrayLike: ArrayLike): Array; - - /** - * Creates an array from an iterable object. - * @param iterable An iterable object to convert to an array. - */ - from(iterable: Iterable): Array; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: T[]): Array; -} - -interface String { - /** Iterator */ - [Symbol.iterator](): IterableIterator; - - /** - * Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point - * value of the UTF-16 encoded code point starting at the string element at position pos in - * the String resulting from converting this object to a String. - * If there is no element at that position, the result is undefined. - * If a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos. - */ - codePointAt(pos: number): number; - - /** - * Returns true if searchString appears as a substring of the result of converting this - * object to a String, at one or more positions that are - * greater than or equal to position; otherwise, returns false. - * @param searchString search string - * @param position If position is undefined, 0 is assumed, so as to search all of the String. - */ - includes(searchString: string, position?: number): boolean; - - /** - * Returns true if the sequence of elements of searchString converted to a String is the - * same as the corresponding elements of this object (converted to a String) starting at - * endPosition – length(this). Otherwise returns false. - */ - endsWith(searchString: string, endPosition?: number): boolean; - - /** - * Returns the String value result of normalizing the string into the normalization form - * named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms. - * @param form Applicable values: "NFC", "NFD", "NFKC", or "NFKD", If not specified default - * is "NFC" - */ - normalize(form?: string): string; - - /** - * Returns a String value that is made from count copies appended together. If count is 0, - * T is the empty String is returned. - * @param count number of copies to append - */ - repeat(count: number): string; - - /** - * Returns true if the sequence of elements of searchString converted to a String is the - * same as the corresponding elements of this object (converted to a String) starting at - * position. Otherwise returns false. - */ - startsWith(searchString: string, position?: number): boolean; - - // Overloads for objects with methods of well-known symbols. - - /** - * Matches a string an object that supports being matched against, and returns an array containing the results of that search. - * @param matcher An object that supports being matched against. - */ - match(matcher: { [Symbol.match](string: string): RegExpMatchArray; }): RegExpMatchArray; - - /** - * Replaces text in a string, using an object that supports replacement within a string. - * @param searchValue A object can search for and replace matches within a string. - * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. - */ - replace(searchValue: { [Symbol.replace](string: string, replaceValue: string): string; }, replaceValue: string): string; - - /** - * Replaces text in a string, using an object that supports replacement within a string. - * @param searchValue A object can search for and replace matches within a string. - * @param replacer A function that returns the replacement text. - */ - replace(searchValue: { [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; }, replacer: (substring: string, ...args: any[]) => string): string; - - /** - * Finds the first substring match in a regular expression search. - * @param searcher An object which supports searching within a string. - */ - search(searcher: { [Symbol.search](string: string): number; }): number; - - /** - * Split a string into substrings using the specified separator and return them as an array. - * @param splitter An object that can split a string. - * @param limit A value used to limit the number of elements returned in the array. - */ - split(splitter: { [Symbol.split](string: string, limit?: number): string[]; }, limit?: number): string[]; - - /** - * Returns an HTML anchor element and sets the name attribute to the text value - * @param name - */ - anchor(name: string): string; - - /** Returns a HTML element */ - big(): string; - - /** Returns a HTML element */ - blink(): string; - - /** Returns a HTML element */ - bold(): string; - - /** Returns a HTML element */ - fixed(): string - - /** Returns a HTML element and sets the color attribute value */ - fontcolor(color: string): string - - /** Returns a HTML element and sets the size attribute value */ - fontsize(size: number): string; - - /** Returns a HTML element and sets the size attribute value */ - fontsize(size: string): string; - - /** Returns an HTML element */ - italics(): string; - - /** Returns an HTML element and sets the href attribute value */ - link(url: string): string; - - /** Returns a HTML element */ - small(): string; - - /** Returns a HTML element */ - strike(): string; - - /** Returns a HTML element */ - sub(): string; - - /** Returns a HTML element */ - sup(): string; -} - -interface StringConstructor { - /** - * Return the String value whose elements are, in order, the elements in the List elements. - * If length is 0, the empty string is returned. - */ - fromCodePoint(...codePoints: number[]): string; - - /** - * String.raw is intended for use as a tag function of a Tagged Template String. When called - * as such the first argument will be a well formed template call site object and the rest - * parameter will contain the substitution values. - * @param template A well-formed template string call site representation. - * @param substitutions A set of substitution values. - */ - raw(template: TemplateStringsArray, ...substitutions: any[]): string; -} - -interface IteratorResult { - done: boolean; - value?: T; -} - -interface Iterator { - next(value?: any): IteratorResult; - return?(value?: any): IteratorResult; - throw?(e?: any): IteratorResult; -} - -interface Iterable { - [Symbol.iterator](): Iterator; -} - -interface IterableIterator extends Iterator { - [Symbol.iterator](): IterableIterator; -} - -interface GeneratorFunction extends Function { - -} - -interface GeneratorFunctionConstructor { - /** - * Creates a new Generator function. - * @param args A list of arguments the function accepts. - */ - new (...args: string[]): GeneratorFunction; - (...args: string[]): GeneratorFunction; - prototype: GeneratorFunction; -} -declare var GeneratorFunction: GeneratorFunctionConstructor; - -interface Math { - /** - * Returns the number of leading zero bits in the 32-bit binary representation of a number. - * @param x A numeric expression. - */ - clz32(x: number): number; - - /** - * Returns the result of 32-bit multiplication of two numbers. - * @param x First number - * @param y Second number - */ - imul(x: number, y: number): number; - - /** - * Returns the sign of the x, indicating whether x is positive, negative or zero. - * @param x The numeric expression to test - */ - sign(x: number): number; - - /** - * Returns the base 10 logarithm of a number. - * @param x A numeric expression. - */ - log10(x: number): number; - - /** - * Returns the base 2 logarithm of a number. - * @param x A numeric expression. - */ - log2(x: number): number; - - /** - * Returns the natural logarithm of 1 + x. - * @param x A numeric expression. - */ - log1p(x: number): number; - - /** - * Returns the result of (e^x - 1) of x (e raised to the power of x, where e is the base of - * the natural logarithms). - * @param x A numeric expression. - */ - expm1(x: number): number; - - /** - * Returns the hyperbolic cosine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - cosh(x: number): number; - - /** - * Returns the hyperbolic sine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - sinh(x: number): number; - - /** - * Returns the hyperbolic tangent of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - tanh(x: number): number; - - /** - * Returns the inverse hyperbolic cosine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - acosh(x: number): number; - - /** - * Returns the inverse hyperbolic sine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - asinh(x: number): number; - - /** - * Returns the inverse hyperbolic tangent of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - atanh(x: number): number; - - /** - * Returns the square root of the sum of squares of its arguments. - * @param values Values to compute the square root for. - * If no arguments are passed, the result is +0. - * If there is only one argument, the result is the absolute value. - * If any argument is +Infinity or -Infinity, the result is +Infinity. - * If any argument is NaN, the result is NaN. - * If all arguments are either +0 or −0, the result is +0. - */ - hypot(...values: number[] ): number; - - /** - * Returns the integral part of the a numeric expression, x, removing any fractional digits. - * If x is already an integer, the result is x. - * @param x A numeric expression. - */ - trunc(x: number): number; - - /** - * Returns the nearest single precision float representation of a number. - * @param x A numeric expression. - */ - fround(x: number): number; - - /** - * Returns an implementation-dependent approximation to the cube root of number. - * @param x A numeric expression. - */ - cbrt(x: number): number; - - [Symbol.toStringTag]: string; -} - -interface Date { - /** - * Converts a Date object to a string. - */ - [Symbol.toPrimitive](hint: "default"): string; - /** - * Converts a Date object to a string. - */ - [Symbol.toPrimitive](hint: "string"): string; - /** - * Converts a Date object to a number. - */ - [Symbol.toPrimitive](hint: "number"): number; - /** - * Converts a Date object to a string or number. - * - * @param hint The strings "number", "string", or "default" to specify what primitive to return. - * - * @throws {TypeError} If 'hint' was given something other than "number", "string", or "default". - * @returns A number if 'hint' was "number", a string if 'hint' was "string" or "default". - */ - [Symbol.toPrimitive](hint: string): string | number; -} - -interface RegExp { - /** - * Matches a string with this regular expression, and returns an array containing the results of - * that search. - * @param string A string to search within. - */ - [Symbol.match](string: string): RegExpMatchArray; - - /** - * Replaces text in a string, using this regular expression. - * @param string A String object or string literal whose contents matching against - * this regular expression will be replaced - * @param replaceValue A String object or string literal containing the text to replace for every - * successful match of this regular expression. - */ - [Symbol.replace](string: string, replaceValue: string): string; - - /** - * Replaces text in a string, using this regular expression. - * @param string A String object or string literal whose contents matching against - * this regular expression will be replaced - * @param replacer A function that returns the replacement text. - */ - [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; - - /** - * Finds the position beginning first substring match in a regular expression search - * using this regular expression. - * - * @param string The string to search within. - */ - [Symbol.search](string: string): number; - - /** - * Returns an array of substrings that were delimited by strings in the original input that - * match against this regular expression. - * - * If the regular expression contains capturing parentheses, then each time this - * regular expression matches, the results (including any undefined results) of the - * capturing parentheses are spliced. - * - * @param string string value to split - * @param limit if not undefined, the output array is truncated so that it contains no more - * than 'limit' elements. - */ - [Symbol.split](string: string, limit?: number): string[]; - - /** - * Returns a string indicating the flags of the regular expression in question. This field is read-only. - * The characters in this string are sequenced and concatenated in the following order: - * - * - "g" for global - * - "i" for ignoreCase - * - "m" for multiline - * - "u" for unicode - * - "y" for sticky - * - * If no flags are set, the value is the empty string. - */ - flags: string; - - /** - * Returns a Boolean value indicating the state of the sticky flag (y) used with a regular - * expression. Default is false. Read-only. - */ - sticky: boolean; - - /** - * Returns a Boolean value indicating the state of the Unicode flag (u) used with a regular - * expression. Default is false. Read-only. - */ - unicode: boolean; -} - -interface RegExpConstructor { - [Symbol.species](): RegExpConstructor; -} - -interface Map { - clear(): void; - delete(key: K): boolean; - entries(): IterableIterator<[K, V]>; - forEach(callbackfn: (value: V, index: K, map: Map) => void, thisArg?: any): void; - get(key: K): V; - has(key: K): boolean; - keys(): IterableIterator; - set(key: K, value?: V): Map; - size: number; - values(): IterableIterator; - [Symbol.iterator]():IterableIterator<[K,V]>; - [Symbol.toStringTag]: string; -} - -interface MapConstructor { - new (): Map; - new (): Map; - new (iterable: Iterable<[K, V]>): Map; - prototype: Map; -} -declare var Map: MapConstructor; - -interface WeakMap { - clear(): void; - delete(key: K): boolean; - get(key: K): V; - has(key: K): boolean; - set(key: K, value?: V): WeakMap; - [Symbol.toStringTag]: string; -} - -interface WeakMapConstructor { - new (): WeakMap; - new (): WeakMap; - new (iterable: Iterable<[K, V]>): WeakMap; - prototype: WeakMap; -} -declare var WeakMap: WeakMapConstructor; - -interface Set { - add(value: T): Set; - clear(): void; - delete(value: T): boolean; - entries(): IterableIterator<[T, T]>; - forEach(callbackfn: (value: T, index: T, set: Set) => void, thisArg?: any): void; - has(value: T): boolean; - keys(): IterableIterator; - size: number; - values(): IterableIterator; - [Symbol.iterator]():IterableIterator; - [Symbol.toStringTag]: string; -} - -interface SetConstructor { - new (): Set; - new (): Set; - new (iterable: Iterable): Set; - prototype: Set; -} -declare var Set: SetConstructor; - -interface WeakSet { - add(value: T): WeakSet; - clear(): void; - delete(value: T): boolean; - has(value: T): boolean; - [Symbol.toStringTag]: string; -} - -interface WeakSetConstructor { - new (): WeakSet; - new (): WeakSet; - new (iterable: Iterable): WeakSet; - prototype: WeakSet; -} -declare var WeakSet: WeakSetConstructor; - -interface JSON { - [Symbol.toStringTag]: string; -} - -/** - * Represents a raw buffer of binary data, which is used to store data for the - * different typed arrays. ArrayBuffers cannot be read from or written to directly, - * but can be passed to a typed array or DataView Object to interpret the raw - * buffer as needed. - */ -interface ArrayBuffer { - [Symbol.toStringTag]: string; -} - -interface DataView { - [Symbol.toStringTag]: string; -} - -/** - * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested - * number of bytes could not be allocated an exception is raised. - */ -interface Int8Array { - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - [Symbol.iterator](): IterableIterator; -} - -interface Int8ArrayConstructor { - new (elements: Iterable): Int8Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array; -} - -/** - * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint8Array { - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - [Symbol.iterator](): IterableIterator; -} - -interface Uint8ArrayConstructor { - new (elements: Iterable): Uint8Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array; -} - -/** - * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. - * If the requested number of bytes could not be allocated an exception is raised. - */ -interface Uint8ClampedArray { - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - - [Symbol.iterator](): IterableIterator; -} - -interface Uint8ClampedArrayConstructor { - new (elements: Iterable): Uint8ClampedArray; - - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray; -} - -/** - * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Int16Array { - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - - - [Symbol.iterator](): IterableIterator; -} - -interface Int16ArrayConstructor { - new (elements: Iterable): Int16Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array; -} - -/** - * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint16Array { - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - [Symbol.iterator](): IterableIterator; -} - -interface Uint16ArrayConstructor { - new (elements: Iterable): Uint16Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array; -} - -/** - * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Int32Array { - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - [Symbol.iterator](): IterableIterator; -} - -interface Int32ArrayConstructor { - new (elements: Iterable): Int32Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array; -} - -/** - * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint32Array { - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - [Symbol.iterator](): IterableIterator; -} - -interface Uint32ArrayConstructor { - new (elements: Iterable): Uint32Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array; -} - -/** - * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number - * of bytes could not be allocated an exception is raised. - */ -interface Float32Array { - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - [Symbol.iterator](): IterableIterator; -} - -interface Float32ArrayConstructor { - new (elements: Iterable): Float32Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array; -} - -/** - * A typed array of 64-bit float values. The contents are initialized to 0. If the requested - * number of bytes could not be allocated an exception is raised. - */ -interface Float64Array { - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - [Symbol.iterator](): IterableIterator; -} - -interface Float64ArrayConstructor { - new (elements: Iterable): Float64Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; -} - -interface ProxyHandler { - getPrototypeOf? (target: T): any; - setPrototypeOf? (target: T, v: any): boolean; - isExtensible? (target: T): boolean; - preventExtensions? (target: T): boolean; - getOwnPropertyDescriptor? (target: T, p: PropertyKey): PropertyDescriptor; - has? (target: T, p: PropertyKey): boolean; - get? (target: T, p: PropertyKey, receiver: any): any; - set? (target: T, p: PropertyKey, value: any, receiver: any): boolean; - deleteProperty? (target: T, p: PropertyKey): boolean; - defineProperty? (target: T, p: PropertyKey, attributes: PropertyDescriptor): boolean; - enumerate? (target: T): PropertyKey[]; - ownKeys? (target: T): PropertyKey[]; - apply? (target: T, thisArg: any, argArray?: any): any; - construct? (target: T, thisArg: any, argArray?: any): any; -} - -interface ProxyConstructor { - revocable(target: T, handler: ProxyHandler): { proxy: T; revoke: () => void; }; - new (target: T, handler: ProxyHandler): T -} -declare var Proxy: ProxyConstructor; - -declare namespace Reflect { - function apply(target: Function, thisArgument: any, argumentsList: ArrayLike): any; - function construct(target: Function, argumentsList: ArrayLike, newTarget?: any): any; - function defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean; - function deleteProperty(target: any, propertyKey: PropertyKey): boolean; - function enumerate(target: any): IterableIterator; - function get(target: any, propertyKey: PropertyKey, receiver?: any): any; - function getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor; - function getPrototypeOf(target: any): any; - function has(target: any, propertyKey: string): boolean; - function has(target: any, propertyKey: symbol): boolean; - function isExtensible(target: any): boolean; - function ownKeys(target: any): Array; - function preventExtensions(target: any): boolean; - function set(target: any, propertyKey: PropertyKey, value: any, receiver?: any): boolean; - function setPrototypeOf(target: any, proto: any): boolean; -} - -/** - * Represents the completion of an asynchronous operation - */ -interface Promise { - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; - then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): Promise; - - /** - * Attaches a callback for only the rejection of the Promise. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of the callback. - */ - catch(onrejected?: (reason: any) => T | PromiseLike): Promise; - catch(onrejected?: (reason: any) => void): Promise; - - [Symbol.toStringTag]: string; -} - -interface PromiseConstructor { - /** - * A reference to the prototype. - */ - prototype: Promise; - - /** - * Creates a new Promise. - * @param executor A callback used to initialize the promise. This callback is passed two arguments: - * a resolve callback used resolve the promise with a value or the result of another promise, - * and a reject callback used to reject the promise with a provided reason or error. - */ - new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void): Promise; - - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: [T1 | PromiseLike, T2 | PromiseLike]): Promise<[T1, T2]>; - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike]): Promise<[T1, T2, T3]>; - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike ]): Promise<[T1, T2, T3, T4]>; - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike]): Promise<[T1, T2, T3, T4, T5]>; - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6]>; - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7]>; - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>; - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>; - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike, T10 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>; - all(values: Iterable>): Promise; - - /** - * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved - * or rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - race(values: Iterable>): Promise; - - /** - * Creates a new rejected promise for the provided reason. - * @param reason The reason the promise was rejected. - * @returns A new rejected Promise. - */ - reject(reason: any): Promise; - - /** - * Creates a new rejected promise for the provided reason. - * @param reason The reason the promise was rejected. - * @returns A new rejected Promise. - */ - reject(reason: any): Promise; - - /** - * Creates a new resolved promise for the provided value. - * @param value A promise. - * @returns A promise whose internal state matches the provided promise. - */ - resolve(value: T | PromiseLike): Promise; - - /** - * Creates a new resolved promise . - * @returns A resolved promise. - */ - resolve(): Promise; - - [Symbol.species]: Function; -} - -declare var Promise: PromiseConstructor; diff --git a/src/lib/header.d.ts b/src/lib/header.d.ts new file mode 100644 index 00000000000..129e4739a83 --- /dev/null +++ b/src/lib/header.d.ts @@ -0,0 +1 @@ +/// diff --git a/src/lib/importcore.d.ts b/src/lib/importcore.d.ts deleted file mode 100644 index 94e599fb842..00000000000 --- a/src/lib/importcore.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/src/lib/importes5.d.ts b/src/lib/importes5.d.ts new file mode 100644 index 00000000000..872bf0a1bed --- /dev/null +++ b/src/lib/importes5.d.ts @@ -0,0 +1 @@ +/// diff --git a/src/lib/intl.d.ts b/src/lib/intl.d.ts deleted file mode 100644 index 53894587259..00000000000 --- a/src/lib/intl.d.ts +++ /dev/null @@ -1,201 +0,0 @@ -///////////////////////////// -/// ECMAScript Internationalization API -///////////////////////////// - -declare module Intl { - interface CollatorOptions { - usage?: string; - localeMatcher?: string; - numeric?: boolean; - caseFirst?: string; - sensitivity?: string; - ignorePunctuation?: boolean; - } - - interface ResolvedCollatorOptions { - locale: string; - usage: string; - sensitivity: string; - ignorePunctuation: boolean; - collation: string; - caseFirst: string; - numeric: boolean; - } - - interface Collator { - compare(x: string, y: string): number; - resolvedOptions(): ResolvedCollatorOptions; - } - var Collator: { - new (locales?: string[], options?: CollatorOptions): Collator; - new (locale?: string, options?: CollatorOptions): Collator; - (locales?: string[], options?: CollatorOptions): Collator; - (locale?: string, options?: CollatorOptions): Collator; - supportedLocalesOf(locales: string[], options?: CollatorOptions): string[]; - supportedLocalesOf(locale: string, options?: CollatorOptions): string[]; - } - - interface NumberFormatOptions { - localeMatcher?: string; - style?: string; - currency?: string; - currencyDisplay?: string; - useGrouping?: boolean; - minimumIntegerDigits?: number; - minimumFractionDigits?: number; - maximumFractionDigits?: number; - minimumSignificantDigits?: number; - maximumSignificantDigits?: number; - } - - interface ResolvedNumberFormatOptions { - locale: string; - numberingSystem: string; - style: string; - currency?: string; - currencyDisplay?: string; - minimumIntegerDigits: number; - minimumFractionDigits: number; - maximumFractionDigits: number; - minimumSignificantDigits?: number; - maximumSignificantDigits?: number; - useGrouping: boolean; - } - - interface NumberFormat { - format(value: number): string; - resolvedOptions(): ResolvedNumberFormatOptions; - } - var NumberFormat: { - new (locales?: string[], options?: NumberFormatOptions): NumberFormat; - new (locale?: string, options?: NumberFormatOptions): NumberFormat; - (locales?: string[], options?: NumberFormatOptions): NumberFormat; - (locale?: string, options?: NumberFormatOptions): NumberFormat; - supportedLocalesOf(locales: string[], options?: NumberFormatOptions): string[]; - supportedLocalesOf(locale: string, options?: NumberFormatOptions): string[]; - } - - interface DateTimeFormatOptions { - localeMatcher?: string; - weekday?: string; - era?: string; - year?: string; - month?: string; - day?: string; - hour?: string; - minute?: string; - second?: string; - timeZoneName?: string; - formatMatcher?: string; - hour12?: boolean; - timeZone?: string; - } - - interface ResolvedDateTimeFormatOptions { - locale: string; - calendar: string; - numberingSystem: string; - timeZone: string; - hour12?: boolean; - weekday?: string; - era?: string; - year?: string; - month?: string; - day?: string; - hour?: string; - minute?: string; - second?: string; - timeZoneName?: string; - } - - interface DateTimeFormat { - format(date?: Date | number): string; - resolvedOptions(): ResolvedDateTimeFormatOptions; - } - var DateTimeFormat: { - new (locales?: string[], options?: DateTimeFormatOptions): DateTimeFormat; - new (locale?: string, options?: DateTimeFormatOptions): DateTimeFormat; - (locales?: string[], options?: DateTimeFormatOptions): DateTimeFormat; - (locale?: string, options?: DateTimeFormatOptions): DateTimeFormat; - supportedLocalesOf(locales: string[], options?: DateTimeFormatOptions): string[]; - supportedLocalesOf(locale: string, options?: DateTimeFormatOptions): string[]; - } -} - -interface String { - /** - * Determines whether two strings are equivalent in the current locale. - * @param that String to compare to target string - * @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. This parameter must conform to BCP 47 standards; see the Intl.Collator object for details. - * @param options An object that contains one or more properties that specify comparison options. see the Intl.Collator object for details. - */ - localeCompare(that: string, locales: string[], options?: Intl.CollatorOptions): number; - - /** - * Determines whether two strings are equivalent in the current locale. - * @param that String to compare to target string - * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. This parameter must conform to BCP 47 standards; see the Intl.Collator object for details. - * @param options An object that contains one or more properties that specify comparison options. see the Intl.Collator object for details. - */ - localeCompare(that: string, locale: string, options?: Intl.CollatorOptions): number; -} - -interface Number { - /** - * Converts a number to a string by using the current or specified locale. - * @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleString(locales?: string[], options?: Intl.NumberFormatOptions): string; - - /** - * Converts a number to a string by using the current or specified locale. - * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleString(locale?: string, options?: Intl.NumberFormatOptions): string; -} - -interface Date { - /** - * Converts a date and time to a string by using the current or specified locale. - * @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleString(locales?: string[], options?: Intl.DateTimeFormatOptions): string; - /** - * Converts a date to a string by using the current or specified locale. - * @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleDateString(locales?: string[], options?: Intl.DateTimeFormatOptions): string; - - /** - * Converts a time to a string by using the current or specified locale. - * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleTimeString(locale?: string[], options?: Intl.DateTimeFormatOptions): string; - - /** - * Converts a date and time to a string by using the current or specified locale. - * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleString(locale?: string, options?: Intl.DateTimeFormatOptions): string; - - /** - * Converts a date to a string by using the current or specified locale. - * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleDateString(locale?: string, options?: Intl.DateTimeFormatOptions): string; - - /** - * Converts a time to a string by using the current or specified locale. - * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleTimeString(locale?: string, options?: Intl.DateTimeFormatOptions): string; -} - diff --git a/src/lib/scriptHost.d.ts b/src/lib/scripthost.d.ts similarity index 100% rename from src/lib/scriptHost.d.ts rename to src/lib/scripthost.d.ts diff --git a/src/lib/webworker.generated.d.ts b/src/lib/webworker.generated.d.ts index a1d87f79787..f5c77b8594d 100644 --- a/src/lib/webworker.generated.d.ts +++ b/src/lib/webworker.generated.d.ts @@ -8,15 +8,27 @@ interface EventInit { cancelable?: boolean; } +interface IDBIndexParameters { + multiEntry?: boolean; + unique?: boolean; +} + +interface IDBObjectStoreParameters { + autoIncrement?: boolean; + keyPath?: IDBKeyPath; +} + interface EventListener { (evt: Event): void; } interface AudioBuffer { - duration: number; - length: number; - numberOfChannels: number; - sampleRate: number; + readonly duration: number; + readonly length: number; + readonly numberOfChannels: number; + readonly sampleRate: number; + copyFromChannel(destination: Float32Array, channelNumber: number, startInChannel?: number): void; + copyToChannel(source: Float32Array, channelNumber: number, startInChannel?: number): void; getChannelData(channel: number): Float32Array; } @@ -26,8 +38,8 @@ declare var AudioBuffer: { } interface Blob { - size: number; - type: string; + readonly size: number; + readonly type: string; msClose(): void; msDetachStream(): any; slice(start?: number, end?: number, contentType?: string): Blob; @@ -39,9 +51,9 @@ declare var Blob: { } interface CloseEvent extends Event { - code: number; - reason: string; - wasClean: boolean; + readonly code: number; + readonly reason: string; + readonly wasClean: boolean; initCloseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, wasCleanArg: boolean, codeArg: number, reasonArg: string): void; } @@ -58,6 +70,7 @@ interface Console { dir(value?: any, ...optionalParams: any[]): void; dirxml(value: any): void; error(message?: any, ...optionalParams: any[]): void; + exception(message?: string, ...optionalParams: any[]): void; group(groupTitle?: string): void; groupCollapsed(groupTitle?: string): void; groupEnd(): void; @@ -67,9 +80,10 @@ interface Console { profile(reportName?: string): void; profileEnd(): void; select(element: any): void; + table(...data: any[]): void; time(timerName?: string): void; timeEnd(timerName?: string): void; - trace(): void; + trace(message?: any, ...optionalParams: any[]): void; warn(message?: any, ...optionalParams: any[]): void; } @@ -79,13 +93,13 @@ declare var Console: { } interface Coordinates { - accuracy: number; - altitude: number; - altitudeAccuracy: number; - heading: number; - latitude: number; - longitude: number; - speed: number; + readonly accuracy: number; + readonly altitude: number | null; + readonly altitudeAccuracy: number | null; + readonly heading: number | null; + readonly latitude: number; + readonly longitude: number; + readonly speed: number | null; } declare var Coordinates: { @@ -94,7 +108,7 @@ declare var Coordinates: { } interface DOMError { - name: string; + readonly name: string; toString(): string; } @@ -104,75 +118,75 @@ declare var DOMError: { } interface DOMException { - code: number; - message: string; - name: string; + readonly code: number; + readonly message: string; + readonly name: string; toString(): string; - ABORT_ERR: number; - DATA_CLONE_ERR: number; - DOMSTRING_SIZE_ERR: number; - HIERARCHY_REQUEST_ERR: number; - INDEX_SIZE_ERR: number; - INUSE_ATTRIBUTE_ERR: number; - INVALID_ACCESS_ERR: number; - INVALID_CHARACTER_ERR: number; - INVALID_MODIFICATION_ERR: number; - INVALID_NODE_TYPE_ERR: number; - INVALID_STATE_ERR: number; - NAMESPACE_ERR: number; - NETWORK_ERR: number; - NOT_FOUND_ERR: number; - NOT_SUPPORTED_ERR: number; - NO_DATA_ALLOWED_ERR: number; - NO_MODIFICATION_ALLOWED_ERR: number; - PARSE_ERR: number; - QUOTA_EXCEEDED_ERR: number; - SECURITY_ERR: number; - SERIALIZE_ERR: number; - SYNTAX_ERR: number; - TIMEOUT_ERR: number; - TYPE_MISMATCH_ERR: number; - URL_MISMATCH_ERR: number; - VALIDATION_ERR: number; - WRONG_DOCUMENT_ERR: number; + readonly ABORT_ERR: number; + readonly DATA_CLONE_ERR: number; + readonly DOMSTRING_SIZE_ERR: number; + readonly HIERARCHY_REQUEST_ERR: number; + readonly INDEX_SIZE_ERR: number; + readonly INUSE_ATTRIBUTE_ERR: number; + readonly INVALID_ACCESS_ERR: number; + readonly INVALID_CHARACTER_ERR: number; + readonly INVALID_MODIFICATION_ERR: number; + readonly INVALID_NODE_TYPE_ERR: number; + readonly INVALID_STATE_ERR: number; + readonly NAMESPACE_ERR: number; + readonly NETWORK_ERR: number; + readonly NOT_FOUND_ERR: number; + readonly NOT_SUPPORTED_ERR: number; + readonly NO_DATA_ALLOWED_ERR: number; + readonly NO_MODIFICATION_ALLOWED_ERR: number; + readonly PARSE_ERR: number; + readonly QUOTA_EXCEEDED_ERR: number; + readonly SECURITY_ERR: number; + readonly SERIALIZE_ERR: number; + readonly SYNTAX_ERR: number; + readonly TIMEOUT_ERR: number; + readonly TYPE_MISMATCH_ERR: number; + readonly URL_MISMATCH_ERR: number; + readonly VALIDATION_ERR: number; + readonly WRONG_DOCUMENT_ERR: number; } declare var DOMException: { prototype: DOMException; new(): DOMException; - ABORT_ERR: number; - DATA_CLONE_ERR: number; - DOMSTRING_SIZE_ERR: number; - HIERARCHY_REQUEST_ERR: number; - INDEX_SIZE_ERR: number; - INUSE_ATTRIBUTE_ERR: number; - INVALID_ACCESS_ERR: number; - INVALID_CHARACTER_ERR: number; - INVALID_MODIFICATION_ERR: number; - INVALID_NODE_TYPE_ERR: number; - INVALID_STATE_ERR: number; - NAMESPACE_ERR: number; - NETWORK_ERR: number; - NOT_FOUND_ERR: number; - NOT_SUPPORTED_ERR: number; - NO_DATA_ALLOWED_ERR: number; - NO_MODIFICATION_ALLOWED_ERR: number; - PARSE_ERR: number; - QUOTA_EXCEEDED_ERR: number; - SECURITY_ERR: number; - SERIALIZE_ERR: number; - SYNTAX_ERR: number; - TIMEOUT_ERR: number; - TYPE_MISMATCH_ERR: number; - URL_MISMATCH_ERR: number; - VALIDATION_ERR: number; - WRONG_DOCUMENT_ERR: number; + readonly ABORT_ERR: number; + readonly DATA_CLONE_ERR: number; + readonly DOMSTRING_SIZE_ERR: number; + readonly HIERARCHY_REQUEST_ERR: number; + readonly INDEX_SIZE_ERR: number; + readonly INUSE_ATTRIBUTE_ERR: number; + readonly INVALID_ACCESS_ERR: number; + readonly INVALID_CHARACTER_ERR: number; + readonly INVALID_MODIFICATION_ERR: number; + readonly INVALID_NODE_TYPE_ERR: number; + readonly INVALID_STATE_ERR: number; + readonly NAMESPACE_ERR: number; + readonly NETWORK_ERR: number; + readonly NOT_FOUND_ERR: number; + readonly NOT_SUPPORTED_ERR: number; + readonly NO_DATA_ALLOWED_ERR: number; + readonly NO_MODIFICATION_ALLOWED_ERR: number; + readonly PARSE_ERR: number; + readonly QUOTA_EXCEEDED_ERR: number; + readonly SECURITY_ERR: number; + readonly SERIALIZE_ERR: number; + readonly SYNTAX_ERR: number; + readonly TIMEOUT_ERR: number; + readonly TYPE_MISMATCH_ERR: number; + readonly URL_MISMATCH_ERR: number; + readonly VALIDATION_ERR: number; + readonly WRONG_DOCUMENT_ERR: number; } interface DOMStringList { - length: number; + readonly length: number; contains(str: string): boolean; - item(index: number): string; + item(index: number): string | null; [index: number]: string; } @@ -182,11 +196,11 @@ declare var DOMStringList: { } interface ErrorEvent extends Event { - colno: number; - error: any; - filename: string; - lineno: number; - message: string; + readonly colno: number; + readonly error: any; + readonly filename: string; + readonly lineno: number; + readonly message: string; initErrorEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, messageArg: string, filenameArg: string, linenoArg: number): void; } @@ -196,39 +210,39 @@ declare var ErrorEvent: { } interface Event { - bubbles: boolean; + readonly bubbles: boolean; cancelBubble: boolean; - cancelable: boolean; - currentTarget: EventTarget; - defaultPrevented: boolean; - eventPhase: number; - isTrusted: boolean; + readonly cancelable: boolean; + readonly currentTarget: EventTarget; + readonly defaultPrevented: boolean; + readonly eventPhase: number; + readonly isTrusted: boolean; returnValue: boolean; - srcElement: any; - target: EventTarget; - timeStamp: number; - type: string; + readonly srcElement: any; + readonly target: EventTarget; + readonly timeStamp: number; + readonly type: string; initEvent(eventTypeArg: string, canBubbleArg: boolean, cancelableArg: boolean): void; preventDefault(): void; stopImmediatePropagation(): void; stopPropagation(): void; - AT_TARGET: number; - BUBBLING_PHASE: number; - CAPTURING_PHASE: number; + readonly AT_TARGET: number; + readonly BUBBLING_PHASE: number; + readonly CAPTURING_PHASE: number; } declare var Event: { prototype: Event; new(type: string, eventInitDict?: EventInit): Event; - AT_TARGET: number; - BUBBLING_PHASE: number; - CAPTURING_PHASE: number; + readonly AT_TARGET: number; + readonly BUBBLING_PHASE: number; + readonly CAPTURING_PHASE: number; } interface EventTarget { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + addEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; dispatchEvent(evt: Event): boolean; - removeEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var EventTarget: { @@ -237,8 +251,9 @@ declare var EventTarget: { } interface File extends Blob { - lastModifiedDate: any; - name: string; + readonly lastModifiedDate: any; + readonly name: string; + readonly webkitRelativePath: string; } declare var File: { @@ -247,7 +262,7 @@ declare var File: { } interface FileList { - length: number; + readonly length: number; item(index: number): File; [index: number]: File; } @@ -258,7 +273,7 @@ declare var FileList: { } interface FileReader extends EventTarget, MSBaseReader { - error: DOMError; + readonly error: DOMError; readAsArrayBuffer(blob: Blob): void; readAsBinaryString(blob: Blob): void; readAsDataURL(blob: Blob): void; @@ -272,31 +287,31 @@ declare var FileReader: { } interface IDBCursor { - direction: string; - key: any; - primaryKey: any; - source: any; + readonly direction: string; + key: IDBKeyRange | IDBValidKey; + readonly primaryKey: any; + source: IDBObjectStore | IDBIndex; advance(count: number): void; - continue(key?: any): void; + continue(key?: IDBKeyRange | IDBValidKey): void; delete(): IDBRequest; update(value: any): IDBRequest; - NEXT: string; - NEXT_NO_DUPLICATE: string; - PREV: string; - PREV_NO_DUPLICATE: string; + readonly NEXT: string; + readonly NEXT_NO_DUPLICATE: string; + readonly PREV: string; + readonly PREV_NO_DUPLICATE: string; } declare var IDBCursor: { prototype: IDBCursor; new(): IDBCursor; - NEXT: string; - NEXT_NO_DUPLICATE: string; - PREV: string; - PREV_NO_DUPLICATE: string; + readonly NEXT: string; + readonly NEXT_NO_DUPLICATE: string; + readonly PREV: string; + readonly PREV_NO_DUPLICATE: string; } interface IDBCursorWithValue extends IDBCursor { - value: any; + readonly value: any; } declare var IDBCursorWithValue: { @@ -305,15 +320,17 @@ declare var IDBCursorWithValue: { } interface IDBDatabase extends EventTarget { - name: string; - objectStoreNames: DOMStringList; + readonly name: string; + readonly objectStoreNames: DOMStringList; onabort: (ev: Event) => any; onerror: (ev: Event) => any; - version: string; + version: number; + onversionchange: (ev: IDBVersionChangeEvent) => any; close(): void; createObjectStore(name: string, optionalParameters?: IDBObjectStoreParameters): IDBObjectStore; deleteObjectStore(name: string): void; - transaction(storeNames: any, mode?: string): IDBTransaction; + transaction(storeNames: string | string[], mode?: string): IDBTransaction; + addEventListener(type: "versionchange", listener: (ev: IDBVersionChangeEvent) => any, useCapture?: boolean): void; addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; @@ -337,15 +354,15 @@ declare var IDBFactory: { interface IDBIndex { keyPath: string | string[]; - name: string; - objectStore: IDBObjectStore; - unique: boolean; + readonly name: string; + readonly objectStore: IDBObjectStore; + readonly unique: boolean; multiEntry: boolean; - count(key?: any): IDBRequest; - get(key: any): IDBRequest; - getKey(key: any): IDBRequest; - openCursor(range?: IDBKeyRange, direction?: string): IDBRequest; - openKeyCursor(range?: IDBKeyRange, direction?: string): IDBRequest; + count(key?: IDBKeyRange | IDBValidKey): IDBRequest; + get(key: IDBKeyRange | IDBValidKey): IDBRequest; + getKey(key: IDBKeyRange | IDBValidKey): IDBRequest; + openCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; + openKeyCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; } declare var IDBIndex: { @@ -354,36 +371,37 @@ declare var IDBIndex: { } interface IDBKeyRange { - lower: any; - lowerOpen: boolean; - upper: any; - upperOpen: boolean; + readonly lower: any; + readonly lowerOpen: boolean; + readonly upper: any; + readonly upperOpen: boolean; } declare var IDBKeyRange: { prototype: IDBKeyRange; new(): IDBKeyRange; bound(lower: any, upper: any, lowerOpen?: boolean, upperOpen?: boolean): IDBKeyRange; - lowerBound(bound: any, open?: boolean): IDBKeyRange; + lowerBound(lower: any, open?: boolean): IDBKeyRange; only(value: any): IDBKeyRange; - upperBound(bound: any, open?: boolean): IDBKeyRange; + upperBound(upper: any, open?: boolean): IDBKeyRange; } interface IDBObjectStore { - indexNames: DOMStringList; - keyPath: string; - name: string; - transaction: IDBTransaction; - add(value: any, key?: any): IDBRequest; + readonly indexNames: DOMStringList; + keyPath: string | string[]; + readonly name: string; + readonly transaction: IDBTransaction; + autoIncrement: boolean; + add(value: any, key?: IDBKeyRange | IDBValidKey): IDBRequest; clear(): IDBRequest; - count(key?: any): IDBRequest; + count(key?: IDBKeyRange | IDBValidKey): IDBRequest; createIndex(name: string, keyPath: string | string[], optionalParameters?: IDBIndexParameters): IDBIndex; - delete(key: any): IDBRequest; + delete(key: IDBKeyRange | IDBValidKey): IDBRequest; deleteIndex(indexName: string): void; get(key: any): IDBRequest; index(name: string): IDBIndex; - openCursor(range?: any, direction?: string): IDBRequest; - put(value: any, key?: any): IDBRequest; + openCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; + put(value: any, key?: IDBKeyRange | IDBValidKey): IDBRequest; } declare var IDBObjectStore: { @@ -407,13 +425,13 @@ declare var IDBOpenDBRequest: { } interface IDBRequest extends EventTarget { - error: DOMError; + readonly error: DOMError; onerror: (ev: Event) => any; onsuccess: (ev: Event) => any; - readyState: string; - result: any; - source: any; - transaction: IDBTransaction; + readonly readyState: string; + readonly result: any; + source: IDBObjectStore | IDBIndex | IDBCursor; + readonly transaction: IDBTransaction; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "success", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; @@ -425,17 +443,17 @@ declare var IDBRequest: { } interface IDBTransaction extends EventTarget { - db: IDBDatabase; - error: DOMError; - mode: string; + readonly db: IDBDatabase; + readonly error: DOMError; + readonly mode: string; onabort: (ev: Event) => any; oncomplete: (ev: Event) => any; onerror: (ev: Event) => any; abort(): void; objectStore(name: string): IDBObjectStore; - READ_ONLY: string; - READ_WRITE: string; - VERSION_CHANGE: string; + readonly READ_ONLY: string; + readonly READ_WRITE: string; + readonly VERSION_CHANGE: string; addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "complete", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; @@ -445,14 +463,14 @@ interface IDBTransaction extends EventTarget { declare var IDBTransaction: { prototype: IDBTransaction; new(): IDBTransaction; - READ_ONLY: string; - READ_WRITE: string; - VERSION_CHANGE: string; + readonly READ_ONLY: string; + readonly READ_WRITE: string; + readonly VERSION_CHANGE: string; } interface IDBVersionChangeEvent extends Event { - newVersion: number; - oldVersion: number; + readonly newVersion: number | null; + readonly oldVersion: number; } declare var IDBVersionChangeEvent: { @@ -462,8 +480,8 @@ declare var IDBVersionChangeEvent: { interface ImageData { data: Uint8ClampedArray; - height: number; - width: number; + readonly height: number; + readonly width: number; } declare var ImageData: { @@ -482,29 +500,29 @@ interface MSApp { execAsyncAtPriority(asynchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): void; execAtPriority(synchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): any; getCurrentPriority(): string; - getHtmlPrintDocumentSourceAsync(htmlDoc: any): any; + getHtmlPrintDocumentSourceAsync(htmlDoc: any): PromiseLike; getViewId(view: any): any; isTaskScheduledAtPriorityOrHigher(priority: string): boolean; pageHandlesAllApplicationActivations(enabled: boolean): void; suppressSubdownloadCredentialPrompts(suppress: boolean): void; terminateApp(exceptionObject: any): void; - CURRENT: string; - HIGH: string; - IDLE: string; - NORMAL: string; + readonly CURRENT: string; + readonly HIGH: string; + readonly IDLE: string; + readonly NORMAL: string; } declare var MSApp: MSApp; interface MSAppAsyncOperation extends EventTarget { - error: DOMError; + readonly error: DOMError; oncomplete: (ev: Event) => any; onerror: (ev: Event) => any; - readyState: number; - result: any; + readonly readyState: number; + readonly result: any; start(): void; - COMPLETED: number; - ERROR: number; - STARTED: number; + readonly COMPLETED: number; + readonly ERROR: number; + readonly STARTED: number; addEventListener(type: "complete", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; @@ -513,9 +531,9 @@ interface MSAppAsyncOperation extends EventTarget { declare var MSAppAsyncOperation: { prototype: MSAppAsyncOperation; new(): MSAppAsyncOperation; - COMPLETED: number; - ERROR: number; - STARTED: number; + readonly COMPLETED: number; + readonly ERROR: number; + readonly STARTED: number; } interface MSBlobBuilder { @@ -529,7 +547,7 @@ declare var MSBlobBuilder: { } interface MSStream { - type: string; + readonly type: string; msClose(): void; msDetachStream(): any; } @@ -540,7 +558,7 @@ declare var MSStream: { } interface MSStreamReader extends EventTarget, MSBaseReader { - error: DOMError; + readonly error: DOMError; readAsArrayBuffer(stream: MSStream, size?: number): void; readAsBinaryString(stream: MSStream, size?: number): void; readAsBlob(stream: MSStream, size?: number): void; @@ -555,8 +573,8 @@ declare var MSStreamReader: { } interface MediaQueryList { - matches: boolean; - media: string; + readonly matches: boolean; + readonly media: string; addListener(listener: MediaQueryListListener): void; removeListener(listener: MediaQueryListListener): void; } @@ -567,8 +585,8 @@ declare var MediaQueryList: { } interface MessageChannel { - port1: MessagePort; - port2: MessagePort; + readonly port1: MessagePort; + readonly port2: MessagePort; } declare var MessageChannel: { @@ -577,10 +595,10 @@ declare var MessageChannel: { } interface MessageEvent extends Event { - data: any; - origin: string; - ports: any; - source: any; + readonly data: any; + readonly origin: string; + readonly ports: any; + readonly source: any; initMessageEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, dataArg: any, originArg: string, lastEventIdArg: string, sourceArg: any): void; } @@ -604,8 +622,8 @@ declare var MessagePort: { } interface Position { - coords: Coordinates; - timestamp: number; + readonly coords: Coordinates; + readonly timestamp: number; } declare var Position: { @@ -614,26 +632,26 @@ declare var Position: { } interface PositionError { - code: number; - message: string; + readonly code: number; + readonly message: string; toString(): string; - PERMISSION_DENIED: number; - POSITION_UNAVAILABLE: number; - TIMEOUT: number; + readonly PERMISSION_DENIED: number; + readonly POSITION_UNAVAILABLE: number; + readonly TIMEOUT: number; } declare var PositionError: { prototype: PositionError; new(): PositionError; - PERMISSION_DENIED: number; - POSITION_UNAVAILABLE: number; - TIMEOUT: number; + readonly PERMISSION_DENIED: number; + readonly POSITION_UNAVAILABLE: number; + readonly TIMEOUT: number; } interface ProgressEvent extends Event { - lengthComputable: boolean; - loaded: number; - total: number; + readonly lengthComputable: boolean; + readonly loaded: number; + readonly total: number; initProgressEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, lengthComputableArg: boolean, loadedArg: number, totalArg: number): void; } @@ -644,21 +662,21 @@ declare var ProgressEvent: { interface WebSocket extends EventTarget { binaryType: string; - bufferedAmount: number; - extensions: string; + readonly bufferedAmount: number; + readonly extensions: string; onclose: (ev: CloseEvent) => any; onerror: (ev: Event) => any; onmessage: (ev: MessageEvent) => any; onopen: (ev: Event) => any; - protocol: string; - readyState: number; - url: string; + readonly protocol: string; + readonly readyState: number; + readonly url: string; close(code?: number, reason?: string): void; send(data: any): void; - CLOSED: number; - CLOSING: number; - CONNECTING: number; - OPEN: number; + readonly CLOSED: number; + readonly CLOSING: number; + readonly CONNECTING: number; + readonly OPEN: number; addEventListener(type: "close", listener: (ev: CloseEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "message", listener: (ev: MessageEvent) => any, useCapture?: boolean): void; @@ -669,10 +687,10 @@ interface WebSocket extends EventTarget { declare var WebSocket: { prototype: WebSocket; new(url: string, protocols?: string | string[]): WebSocket; - CLOSED: number; - CLOSING: number; - CONNECTING: number; - OPEN: number; + readonly CLOSED: number; + readonly CLOSING: number; + readonly CONNECTING: number; + readonly OPEN: number; } interface Worker extends EventTarget, AbstractWorker { @@ -692,31 +710,30 @@ declare var Worker: { interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget { msCaching: string; onreadystatechange: (ev: ProgressEvent) => any; - readyState: number; - response: any; - responseBody: any; - responseText: string; + readonly readyState: number; + readonly response: any; + readonly responseText: string; responseType: string; - responseXML: any; - status: number; - statusText: string; + readonly responseXML: any; + readonly status: number; + readonly statusText: string; timeout: number; - upload: XMLHttpRequestUpload; + readonly upload: XMLHttpRequestUpload; withCredentials: boolean; abort(): void; getAllResponseHeaders(): string; - getResponseHeader(header: string): string; + getResponseHeader(header: string): string | null; msCachingEnabled(): boolean; open(method: string, url: string, async?: boolean, user?: string, password?: string): void; overrideMimeType(mime: string): void; send(data?: string): void; send(data?: any): void; setRequestHeader(header: string, value: string): void; - DONE: number; - HEADERS_RECEIVED: number; - LOADING: number; - OPENED: number; - UNSENT: number; + readonly DONE: number; + readonly HEADERS_RECEIVED: number; + readonly LOADING: number; + readonly OPENED: number; + readonly UNSENT: number; addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -731,11 +748,11 @@ interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget { declare var XMLHttpRequest: { prototype: XMLHttpRequest; new(): XMLHttpRequest; - DONE: number; - HEADERS_RECEIVED: number; - LOADING: number; - OPENED: number; - UNSENT: number; + readonly DONE: number; + readonly HEADERS_RECEIVED: number; + readonly LOADING: number; + readonly OPENED: number; + readonly UNSENT: number; create(): XMLHttpRequest; } @@ -761,12 +778,12 @@ interface MSBaseReader { onloadend: (ev: ProgressEvent) => any; onloadstart: (ev: Event) => any; onprogress: (ev: ProgressEvent) => any; - readyState: number; - result: any; + readonly readyState: number; + readonly result: any; abort(): void; - DONE: number; - EMPTY: number; - LOADING: number; + readonly DONE: number; + readonly EMPTY: number; + readonly LOADING: number; addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -777,18 +794,18 @@ interface MSBaseReader { } interface NavigatorID { - appName: string; - appVersion: string; - platform: string; - product: string; - productSub: string; - userAgent: string; - vendor: string; - vendorSub: string; + readonly appName: string; + readonly appVersion: string; + readonly platform: string; + readonly product: string; + readonly productSub: string; + readonly userAgent: string; + readonly vendor: string; + readonly vendorSub: string; } interface NavigatorOnLine { - onLine: boolean; + readonly onLine: boolean; } interface WindowBase64 { @@ -797,7 +814,7 @@ interface WindowBase64 { } interface WindowConsole { - console: Console; + readonly console: Console; } interface XMLHttpRequestEventTarget { @@ -831,9 +848,9 @@ declare var FileReaderSync: { } interface WorkerGlobalScope extends EventTarget, WorkerUtils, DedicatedWorkerGlobalScope, WindowConsole { - location: WorkerLocation; + readonly location: WorkerLocation; onerror: (ev: Event) => any; - self: WorkerGlobalScope; + readonly self: WorkerGlobalScope; close(): void; msWriteProfilerMark(profilerMarkName: string): void; toString(): string; @@ -848,14 +865,14 @@ declare var WorkerGlobalScope: { } interface WorkerLocation { - hash: string; - host: string; - hostname: string; - href: string; - pathname: string; - port: string; - protocol: string; - search: string; + readonly hash: string; + readonly host: string; + readonly hostname: string; + readonly href: string; + readonly pathname: string; + readonly port: string; + readonly protocol: string; + readonly search: string; toString(): string; } @@ -881,9 +898,9 @@ interface DedicatedWorkerGlobalScope { } interface WorkerUtils extends Object, WindowBase64 { - indexedDB: IDBFactory; - msIndexedDB: IDBFactory; - navigator: WorkerNavigator; + readonly indexedDB: IDBFactory; + readonly msIndexedDB: IDBFactory; + readonly navigator: WorkerNavigator; clearImmediate(handle: number): void; clearInterval(handle: number): void; clearTimeout(handle: number): void; @@ -893,16 +910,6 @@ interface WorkerUtils extends Object, WindowBase64 { setTimeout(handler: any, timeout?: any, ...args: any[]): number; } -interface IDBObjectStoreParameters { - keyPath?: string | string[]; - autoIncrement?: boolean; -} - -interface IDBIndexParameters { - unique?: boolean; - multiEntry?: boolean; -} - interface BlobPropertyBag { type?: string; endings?: string; @@ -932,6 +939,9 @@ interface ProgressEventInit extends EventInit { total?: number; } +interface IDBArrayKey extends Array { +} + declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject; interface ErrorEventHandler { @@ -959,7 +969,7 @@ interface DecodeSuccessCallback { (decodedData: AudioBuffer): void; } interface DecodeErrorCallback { - (): void; + (error: DOMException): void; } interface FunctionStringCallback { (data: string): void; @@ -970,9 +980,9 @@ declare var self: WorkerGlobalScope; declare function close(): void; declare function msWriteProfilerMark(profilerMarkName: string): void; declare function toString(): string; -declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +declare function addEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; declare function dispatchEvent(evt: Event): boolean; -declare function removeEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +declare function removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; declare var indexedDB: IDBFactory; declare var msIndexedDB: IDBFactory; declare var navigator: WorkerNavigator; @@ -990,4 +1000,6 @@ declare function postMessage(data: any): void; declare var console: Console; declare function addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "message", listener: (ev: MessageEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; \ No newline at end of file +declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +type IDBKeyPath = string; +type IDBValidKey = number | string | Date | IDBArrayKey; \ No newline at end of file diff --git a/src/server/client.ts b/src/server/client.ts index 08939b2b44a..251b626eed5 100644 --- a/src/server/client.ts +++ b/src/server/client.ts @@ -1,5 +1,5 @@ /// - + namespace ts.server { export interface SessionClientHost extends LanguageServiceHost { @@ -25,23 +25,23 @@ namespace ts.server { private lineMaps: ts.Map = {}; private messages: string[] = []; private lastRenameEntry: RenameEntry; - + constructor(private host: SessionClientHost) { } - public onMessage(message: string): void { + public onMessage(message: string): void { this.messages.push(message); } - private writeMessage(message: string): void { + private writeMessage(message: string): void { this.host.writeMessage(message); } - private getLineMap(fileName: string): number[] { + private getLineMap(fileName: string): number[] { var lineMap = ts.lookUp(this.lineMaps, fileName); if (!lineMap) { var scriptSnapshot = this.host.getScriptSnapshot(fileName); - lineMap = this.lineMaps[fileName] = ts.computeLineStarts(scriptSnapshot.getText(0, scriptSnapshot.getLength())); + lineMap = this.lineMaps[fileName] = ts.computeLineStarts(scriptSnapshot.getText(0, scriptSnapshot.getLength())); } return lineMap; } @@ -82,34 +82,29 @@ namespace ts.server { } private processResponse(request: protocol.Request): T { - var lastMessage = this.messages.shift(); - Debug.assert(!!lastMessage, "Did not recieve any responses."); - - // Read the content length - var contentLengthPrefix = "Content-Length: "; - var lines = lastMessage.split("\r\n"); - Debug.assert(lines.length >= 2, "Malformed response: Expected 3 lines in the response."); - - var contentLengthText = lines[0]; - Debug.assert(contentLengthText.indexOf(contentLengthPrefix) === 0, "Malformed response: Response text did not contain content-length header."); - var contentLength = parseInt(contentLengthText.substring(contentLengthPrefix.length)); - - // Read the body - var responseBody = lines[2]; - - // Verify content length - Debug.assert(responseBody.length + 1 === contentLength, "Malformed response: Content length did not match the response's body length."); - - try { - var response: T = JSON.parse(responseBody); - } - catch (e) { - throw new Error("Malformed response: Failed to parse server response: " + lastMessage + ". \r\n Error details: " + e.message); + let foundResponseMessage = false; + let lastMessage: string; + let response: T; + while (!foundResponseMessage) { + lastMessage = this.messages.shift(); + Debug.assert(!!lastMessage, "Did not receive any responses."); + const responseBody = processMessage(lastMessage); + try { + response = JSON.parse(responseBody); + // the server may emit events before emitting the response. We + // want to ignore these events for testing purpose. + if (response.type === "response") { + foundResponseMessage = true; + } + } + catch (e) { + throw new Error("Malformed response: Failed to parse server response: " + lastMessage + ". \r\n Error details: " + e.message); + } } // verify the sequence numbers - Debug.assert(response.request_seq === request.seq, "Malformed response: response sequance number did not match request sequence number."); - + Debug.assert(response.request_seq === request.seq, "Malformed response: response sequence number did not match request sequence number."); + // unmarshal errors if (!response.success) { throw new Error("Error " + response.message); @@ -118,10 +113,28 @@ namespace ts.server { Debug.assert(!!response.body, "Malformed response: Unexpected empty response body."); return response; + + function processMessage(message: string) { + // Read the content length + const contentLengthPrefix = "Content-Length: "; + const lines = message.split("\r\n"); + Debug.assert(lines.length >= 2, "Malformed response: Expected 3 lines in the response."); + + const contentLengthText = lines[0]; + Debug.assert(contentLengthText.indexOf(contentLengthPrefix) === 0, "Malformed response: Response text did not contain content-length header."); + const contentLength = parseInt(contentLengthText.substring(contentLengthPrefix.length)); + + // Read the body + const responseBody = lines[2]; + + // Verify content length + Debug.assert(responseBody.length + 1 === contentLength, "Malformed response: Content length did not match the response's body length."); + return responseBody; + } } - openFile(fileName: string, content?: string): void { - var args: protocol.OpenRequestArgs = { file: fileName, fileContent: content }; + openFile(fileName: string, content?: string, scriptKindName?: "TS" | "JS" | "TSX" | "JSX"): void { + var args: protocol.OpenRequestArgs = { file: fileName, fileContent: content, scriptKindName }; this.processRequest(CommandNames.Open, args); } @@ -186,7 +199,7 @@ namespace ts.server { fileNames: response.body.fileNames }; } - + getCompletionsAtPosition(fileName: string, position: number): CompletionInfo { var lineOffset = this.positionToOneBasedLineOffset(fileName, position); var args: protocol.CompletionsRequestArgs = { @@ -199,13 +212,13 @@ namespace ts.server { var request = this.processRequest(CommandNames.Completions, args); var response = this.processResponse(request); - return { + return { isMemberCompletion: false, isNewIdentifierLocation: false, entries: response.body }; } - + getCompletionEntryDetails(fileName: string, position: number, entryName: string): CompletionEntryDetails { var lineOffset = this.positionToOneBasedLineOffset(fileName, position); var args: protocol.CompletionDetailsRequestArgs = { @@ -234,7 +247,7 @@ namespace ts.server { var fileName = entry.file; var start = this.lineOffsetToPosition(fileName, entry.start); var end = this.lineOffsetToPosition(fileName, entry.end); - + return { name: entry.name, containerName: entry.containerName || "", @@ -264,7 +277,7 @@ namespace ts.server { var request = this.processRequest(CommandNames.Format, args); var response = this.processResponse(request); - return response.body.map(entry=> this.convertCodeEditsToTextChange(fileName, entry)); + return response.body.map(entry => this.convertCodeEditsToTextChange(fileName, entry)); } getFormattingEditsForDocument(fileName: string, options: ts.FormatCodeOptions): ts.TextChange[] { @@ -284,7 +297,7 @@ namespace ts.server { var request = this.processRequest(CommandNames.Formatonkey, args); var response = this.processResponse(request); - return response.body.map(entry=> this.convertCodeEditsToTextChange(fileName, entry)); + return response.body.map(entry => this.convertCodeEditsToTextChange(fileName, entry)); } getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[] { @@ -339,7 +352,7 @@ namespace ts.server { }); } - findReferences(fileName: string, position: number): ReferencedSymbol[]{ + findReferences(fileName: string, position: number): ReferencedSymbol[] { // Not yet implemented. return []; } @@ -444,7 +457,7 @@ namespace ts.server { text: item.text, kind: item.kind, kindModifiers: item.kindModifiers || "", - spans: item.spans.map(span=> createTextSpanFromBounds(this.lineOffsetToPosition(fileName, span.start), this.lineOffsetToPosition(fileName, span.end))), + spans: item.spans.map(span => createTextSpanFromBounds(this.lineOffsetToPosition(fileName, span.start), this.lineOffsetToPosition(fileName, span.end))), childItems: this.decodeNavigationBarItems(item.childItems, fileName), indent: 0, bolded: false, @@ -478,10 +491,10 @@ namespace ts.server { line: lineOffset.line, offset: lineOffset.offset }; - + var request = this.processRequest(CommandNames.SignatureHelp, args); var response = this.processResponse(request); - + if (!response.body) { return undefined; } @@ -490,7 +503,7 @@ namespace ts.server { var span = helpItems.applicableSpan; var start = this.lineOffsetToPosition(fileName, span.start); var end = this.lineOffsetToPosition(fileName, span.end); - + var result: SignatureHelpItems = { items: helpItems.items, applicableSpan: { @@ -499,7 +512,7 @@ namespace ts.server { }, selectedItemIndex: helpItems.selectedItemIndex, argumentIndex: helpItems.argumentIndex, - argumentCount: helpItems.argumentCount, + argumentCount: helpItems.argumentCount, } return result; } @@ -561,11 +574,15 @@ namespace ts.server { } getTodoComments(fileName: string, descriptors: TodoCommentDescriptor[]): TodoComment[] { - throw new Error("Not Implemented Yet."); + throw new Error("Not Implemented Yet."); } - + getDocCommentTemplateAtPosition(fileName: string, position: number): TextInsertion { - throw new Error("Not Implemented Yet."); + throw new Error("Not Implemented Yet."); + } + + isValidBraceCompletionAtPostion(fileName: string, position: number, openingBrace: number): boolean { + throw new Error("Not Implemented Yet."); } getBraceMatchingAtPosition(fileName: string, position: number): TextSpan[] { @@ -613,7 +630,7 @@ namespace ts.server { throw new Error("SourceFile objects are not serializable through the server protocol."); } - getSourceFile(fileName: string): SourceFile { + getNonBoundSourceFile(fileName: string): SourceFile { throw new Error("SourceFile objects are not serializable through the server protocol."); } diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index 9305031089c..93f10956c6a 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -32,8 +32,9 @@ namespace ts.server { children: ScriptInfo[] = []; // files referenced by this file defaultProject: Project; // project to use by default for file fileWatcher: FileWatcher; - formatCodeOptions = ts.clone(CompilerService.defaultFormatCodeOptions); + formatCodeOptions = ts.clone(CompilerService.getDefaultFormatCodeOptions(this.host)); path: Path; + scriptKind: ScriptKind; constructor(private host: ServerHost, public fileName: string, public content: string, public isOpen = false) { this.path = toPath(fileName, host.getCurrentDirectory(), createGetCanonicalFileName(host.useCaseSensitiveFileNames)); @@ -81,8 +82,14 @@ namespace ts.server { } } - interface TimestampedResolvedModule extends ResolvedModuleWithFailedLookupLocations { - lastCheckTime: number; + interface Timestamped { + lastCheckTime?: number; + } + + interface TimestampedResolvedModule extends ResolvedModuleWithFailedLookupLocations, Timestamped { + } + + interface TimestampedResolvedTypeReferenceDirective extends ResolvedTypeReferenceDirectiveWithFailedLookupLocations, Timestamped { } export class LSHost implements ts.LanguageServiceHost { @@ -90,60 +97,69 @@ namespace ts.server { compilationSettings: ts.CompilerOptions; filenameToScript: ts.FileMap; roots: ScriptInfo[] = []; + private resolvedModuleNames: ts.FileMap>; + private resolvedTypeReferenceDirectives: ts.FileMap>; private moduleResolutionHost: ts.ModuleResolutionHost; private getCanonicalFileName: (fileName: string) => string; constructor(public host: ServerHost, public project: Project) { this.getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames); this.resolvedModuleNames = createFileMap>(); + this.resolvedTypeReferenceDirectives = createFileMap>(); this.filenameToScript = createFileMap(); this.moduleResolutionHost = { fileExists: fileName => this.fileExists(fileName), - readFile: fileName => this.host.readFile(fileName) + readFile: fileName => this.host.readFile(fileName), + directoryExists: directoryName => this.host.directoryExists(directoryName) }; } - resolveModuleNames(moduleNames: string[], containingFile: string): ResolvedModule[] { + private resolveNamesWithLocalCache( + names: string[], + containingFile: string, + cache: ts.FileMap>, + loader: (name: string, containingFile: string, options: CompilerOptions, host: ModuleResolutionHost) => T, + getResult: (s: T) => R): R[] { + const path = toPath(containingFile, this.host.getCurrentDirectory(), this.getCanonicalFileName); - const currentResolutionsInFile = this.resolvedModuleNames.get(path); - - const newResolutions: Map = {}; - const resolvedModules: ResolvedModule[] = []; + const currentResolutionsInFile = cache.get(path); + const newResolutions: Map = {}; + const resolvedModules: R[] = []; const compilerOptions = this.getCompilationSettings(); - for (const moduleName of moduleNames) { + for (const name of names) { // check if this is a duplicate entry in the list - let resolution = lookUp(newResolutions, moduleName); + let resolution = lookUp(newResolutions, name); if (!resolution) { - const existingResolution = currentResolutionsInFile && ts.lookUp(currentResolutionsInFile, moduleName); + const existingResolution = currentResolutionsInFile && ts.lookUp(currentResolutionsInFile, name); if (moduleResolutionIsValid(existingResolution)) { - // ok, it is safe to use existing module resolution results + // ok, it is safe to use existing name resolution results resolution = existingResolution; } else { - resolution = resolveModuleName(moduleName, containingFile, compilerOptions, this.moduleResolutionHost); + resolution = loader(name, containingFile, compilerOptions, this.moduleResolutionHost); resolution.lastCheckTime = Date.now(); - newResolutions[moduleName] = resolution; + newResolutions[name] = resolution; } } ts.Debug.assert(resolution !== undefined); - resolvedModules.push(resolution.resolvedModule); + resolvedModules.push(getResult(resolution)); } // replace old results with a new one - this.resolvedModuleNames.set(path, newResolutions); + cache.set(path, newResolutions); return resolvedModules; - function moduleResolutionIsValid(resolution: TimestampedResolvedModule): boolean { + function moduleResolutionIsValid(resolution: T): boolean { if (!resolution) { return false; } - if (resolution.resolvedModule) { + if (getResult(resolution)) { // TODO: consider checking failedLookupLocations // TODO: use lastCheckTime to track expiration for module name resolution return true; @@ -155,6 +171,14 @@ namespace ts.server { } } + resolveTypeReferenceDirectives(typeDirectiveNames: string[], containingFile: string): ResolvedTypeReferenceDirective[] { + return this.resolveNamesWithLocalCache(typeDirectiveNames, containingFile, this.resolvedTypeReferenceDirectives, resolveTypeReferenceDirective, m => m.resolvedTypeReferenceDirective); + } + + resolveModuleNames(moduleNames: string[], containingFile: string): ResolvedModule[] { + return this.resolveNamesWithLocalCache(moduleNames, containingFile, this.resolvedModuleNames, resolveModuleName, m => m.resolvedModule); + } + getDefaultLibFileName() { const nodeModuleBinDir = ts.getDirectoryPath(ts.normalizePath(this.host.getExecutingFilePath())); return ts.combinePaths(nodeModuleBinDir, ts.getDefaultLibFileName(this.compilationSettings)); @@ -171,6 +195,7 @@ namespace ts.server { this.compilationSettings = opt; // conservatively assume that changing compiler options might affect module resolution strategy this.resolvedModuleNames.clear(); + this.resolvedTypeReferenceDirectives.clear(); } lineAffectsRefs(filename: string, line: number) { @@ -191,6 +216,18 @@ namespace ts.server { return this.roots.map(root => root.fileName); } + getScriptKind(fileName: string) { + const info = this.getScriptInfo(fileName); + if (!info) { + return undefined; + } + + if (!info.scriptKind) { + info.scriptKind = getScriptKindFromFileName(fileName); + } + return info.scriptKind; + } + getScriptVersion(filename: string) { return this.getScriptInfo(filename).svc.latestVersion().toString(); } @@ -207,6 +244,7 @@ namespace ts.server { if (!info.isOpen) { this.filenameToScript.remove(info.path); this.resolvedModuleNames.remove(info.path); + this.resolvedTypeReferenceDirectives.remove(info.path); } } @@ -234,6 +272,7 @@ namespace ts.server { this.filenameToScript.remove(info.path); this.roots = copyListRemovingItem(info, this.roots); this.resolvedModuleNames.remove(info.path); + this.resolvedTypeReferenceDirectives.remove(info.path); } } @@ -461,6 +500,14 @@ namespace ts.server { return copiedList; } + /** + * This helper funciton processes a list of projects and return the concatenated, sortd and deduplicated output of processing each project. + */ + export function combineProjectOutput(projects: Project[], action: (project: Project) => T[], comparer?: (a: T, b: T) => number, areEqual?: (a: T, b: T) => boolean) { + const result = projects.reduce((previous, current) => concatenate(previous, action(current)), []).sort(comparer); + return projects.length > 1 ? deduplicate(result, areEqual) : result; + } + export interface ProjectServiceEventHandler { (eventName: string, project: Project, fileName: string): void; } @@ -488,7 +535,7 @@ namespace ts.server { // number becomes 0 for a watcher, then we should close it. directoryWatchersRefCount: ts.Map = {}; hostConfiguration: HostConfiguration; - timerForDetectingProjectFileListChanges: Map = {}; + timerForDetectingProjectFileListChanges: Map = {}; constructor(public host: ServerHost, public psLogger: Logger, public eventHandler?: ProjectServiceEventHandler) { // ts.disableIncrementalParsing = true; @@ -497,7 +544,7 @@ namespace ts.server { addDefaultHostConfiguration() { this.hostConfiguration = { - formatCodeOptions: ts.clone(CompilerService.defaultFormatCodeOptions), + formatCodeOptions: ts.clone(CompilerService.getDefaultFormatCodeOptions(this.host)), hostInfo: "Unknown host" }; } @@ -548,9 +595,9 @@ namespace ts.server { startTimerForDetectingProjectFileListChanges(project: Project) { if (this.timerForDetectingProjectFileListChanges[project.projectFilename]) { - clearTimeout(this.timerForDetectingProjectFileListChanges[project.projectFilename]); + this.host.clearTimeout(this.timerForDetectingProjectFileListChanges[project.projectFilename]); } - this.timerForDetectingProjectFileListChanges[project.projectFilename] = setTimeout( + this.timerForDetectingProjectFileListChanges[project.projectFilename] = this.host.setTimeout( () => this.handleProjectFileListChanges(project), 250 ); @@ -876,6 +923,7 @@ namespace ts.server { configuredProject.updateGraph(); if (configuredProject.getSourceFile(info)) { info.defaultProject = configuredProject; + referencingProjects.push(configuredProject); } } return referencingProjects; @@ -987,7 +1035,7 @@ namespace ts.server { * @param filename is absolute pathname * @param fileContent is a known version of the file content that is more up to date than the one on disk */ - openFile(fileName: string, openedByClient: boolean, fileContent?: string) { + openFile(fileName: string, openedByClient: boolean, fileContent?: string, scriptKind?: ScriptKind) { fileName = ts.normalizePath(fileName); let info = ts.lookUp(this.filenameToScriptInfo, fileName); if (!info) { @@ -1002,6 +1050,7 @@ namespace ts.server { } if (content !== undefined) { info = new ScriptInfo(this.host, fileName, content, openedByClient); + info.scriptKind = scriptKind; info.setFormatOptions(this.getFormatCodeOptions()); this.filenameToScriptInfo[fileName] = info; if (!info.isOpen) { @@ -1027,10 +1076,16 @@ namespace ts.server { // the newly opened file. findConfigFile(searchPath: string): string { while (true) { - const fileName = ts.combinePaths(searchPath, "tsconfig.json"); - if (this.host.fileExists(fileName)) { - return fileName; + const tsconfigFileName = ts.combinePaths(searchPath, "tsconfig.json"); + if (this.host.fileExists(tsconfigFileName)) { + return tsconfigFileName; } + + const jsconfigFileName = ts.combinePaths(searchPath, "jsconfig.json"); + if (this.host.fileExists(jsconfigFileName)) { + return jsconfigFileName; + } + const parentPath = ts.getDirectoryPath(searchPath); if (parentPath === searchPath) { break; @@ -1045,12 +1100,12 @@ namespace ts.server { * @param filename is absolute pathname * @param fileContent is a known version of the file content that is more up to date than the one on disk */ - openClientFile(fileName: string, fileContent?: string) { - this.openOrUpdateConfiguredProjectForFile(fileName); - const info = this.openFile(fileName, /*openedByClient*/ true, fileContent); + openClientFile(fileName: string, fileContent?: string, scriptKind?: ScriptKind): { configFileName?: string, configFileErrors?: Diagnostic[] } { + const { configFileName, configFileErrors } = this.openOrUpdateConfiguredProjectForFile(fileName); + const info = this.openFile(fileName, /*openedByClient*/ true, fileContent, scriptKind); this.addOpenFile(info); this.printProjects(); - return info; + return { configFileName, configFileErrors }; } /** @@ -1058,7 +1113,7 @@ namespace ts.server { * we first detect if there is already a configured project created for it: if so, we re-read * the tsconfig file content and update the project; otherwise we create a new one. */ - openOrUpdateConfiguredProjectForFile(fileName: string) { + openOrUpdateConfiguredProjectForFile(fileName: string): { configFileName?: string, configFileErrors?: Diagnostic[] } { const searchPath = ts.normalizePath(getDirectoryPath(fileName)); this.log("Search path: " + searchPath, "Info"); const configFileName = this.findConfigFile(searchPath); @@ -1068,11 +1123,16 @@ namespace ts.server { if (!project) { const configResult = this.openConfigFile(configFileName, fileName); if (!configResult.success) { - this.log("Error opening config file " + configFileName + " " + configResult.errorMsg); + return { configFileName, configFileErrors: configResult.errors }; } else { + // even if opening config file was successful, it could still + // contain errors that were tolerated. this.log("Opened configuration file " + configFileName, "Info"); this.configuredProjects.push(configResult.project); + if (configResult.errors && configResult.errors.length > 0) { + return { configFileName, configFileErrors: configResult.errors }; + } } } else { @@ -1082,6 +1142,7 @@ namespace ts.server { else { this.log("No config files found."); } + return {}; } /** @@ -1171,24 +1232,25 @@ namespace ts.server { return undefined; } - configFileToProjectOptions(configFilename: string): { succeeded: boolean, projectOptions?: ProjectOptions, error?: ProjectOpenResult } { + configFileToProjectOptions(configFilename: string): { succeeded: boolean, projectOptions?: ProjectOptions, errors?: Diagnostic[] } { configFilename = ts.normalizePath(configFilename); // file references will be relative to dirPath (or absolute) const dirPath = ts.getDirectoryPath(configFilename); const contents = this.host.readFile(configFilename); const rawConfig: { config?: ProjectOptions; error?: Diagnostic; } = ts.parseConfigFileTextToJson(configFilename, contents); if (rawConfig.error) { - return { succeeded: false, error: rawConfig.error }; + return { succeeded: false, errors: [rawConfig.error] }; } else { - const parsedCommandLine = ts.parseJsonConfigFileContent(rawConfig.config, this.host, dirPath); + const parsedCommandLine = ts.parseJsonConfigFileContent(rawConfig.config, this.host, dirPath, /*existingOptions*/ {}, configFilename); Debug.assert(!!parsedCommandLine.fileNames); if (parsedCommandLine.errors && (parsedCommandLine.errors.length > 0)) { - return { succeeded: false, error: { errorMsg: "tsconfig option errors" } }; + return { succeeded: false, errors: parsedCommandLine.errors }; } else if (parsedCommandLine.fileNames.length === 0) { - return { succeeded: false, error: { errorMsg: "no files found" } }; + const error = createCompilerDiagnostic(Diagnostics.The_config_file_0_found_doesn_t_contain_any_source_files, configFilename); + return { succeeded: false, errors: [error] }; } else { const projectOptions: ProjectOptions = { @@ -1202,20 +1264,21 @@ namespace ts.server { } - openConfigFile(configFilename: string, clientFileName?: string): ProjectOpenResult { - const { succeeded, projectOptions, error } = this.configFileToProjectOptions(configFilename); + openConfigFile(configFilename: string, clientFileName?: string): { success: boolean, project?: Project, errors?: Diagnostic[] } { + const { succeeded, projectOptions, errors } = this.configFileToProjectOptions(configFilename); if (!succeeded) { - return error; + return { success: false, errors }; } else { const project = this.createProject(configFilename, projectOptions); + let errors: Diagnostic[]; for (const rootFilename of projectOptions.files) { if (this.host.fileExists(rootFilename)) { const info = this.openFile(rootFilename, /*openedByClient*/ clientFileName == rootFilename); project.addRoot(info); } else { - return { errorMsg: "specified file " + rootFilename + " not found" }; + (errors || (errors = [])).push(createCompilerDiagnostic(Diagnostics.File_0_not_found, rootFilename)); } } project.finishGraph(); @@ -1244,7 +1307,7 @@ namespace ts.server { return watchers; }, >{}); - return { success: true, project: project }; + return { success: true, project: project, errors }; } } @@ -1254,13 +1317,13 @@ namespace ts.server { this.removeProject(project); } else { - const { succeeded, projectOptions, error } = this.configFileToProjectOptions(project.projectFilename); + const { succeeded, projectOptions, errors } = this.configFileToProjectOptions(project.projectFilename); if (!succeeded) { - return error; + return errors; } else { const oldFileNames = project.compilerService.host.roots.map(info => info.fileName); - const newFileNames = projectOptions.files; + const newFileNames = ts.filter(projectOptions.files, f => this.host.fileExists(f)); const fileNamesToRemove = oldFileNames.filter(f => newFileNames.indexOf(f) < 0); const fileNamesToAdd = newFileNames.filter(f => oldFileNames.indexOf(f) < 0); @@ -1325,6 +1388,7 @@ namespace ts.server { else { const defaultOpts = ts.getDefaultCompilerOptions(); defaultOpts.allowNonTsExtensions = true; + defaultOpts.allowJs = true; this.setCompilerOptions(defaultOpts); } this.languageService = ts.createLanguageService(this.host, this.documentRegistry); @@ -1337,26 +1401,29 @@ namespace ts.server { } isExternalModule(filename: string): boolean { - const sourceFile = this.languageService.getSourceFile(filename); + const sourceFile = this.languageService.getNonBoundSourceFile(filename); return ts.isExternalModule(sourceFile); } - static defaultFormatCodeOptions: ts.FormatCodeOptions = { - IndentSize: 4, - TabSize: 4, - NewLineCharacter: ts.sys ? ts.sys.newLine : "\n", - ConvertTabsToSpaces: true, - IndentStyle: ts.IndentStyle.Smart, - InsertSpaceAfterCommaDelimiter: true, - InsertSpaceAfterSemicolonInForStatements: true, - InsertSpaceBeforeAndAfterBinaryOperators: true, - InsertSpaceAfterKeywordsInControlFlowStatements: true, - InsertSpaceAfterFunctionKeywordForAnonymousFunctions: false, - InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: false, - InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: false, - PlaceOpenBraceOnNewLineForFunctions: false, - PlaceOpenBraceOnNewLineForControlBlocks: false, - }; + static getDefaultFormatCodeOptions(host: ServerHost): ts.FormatCodeOptions { + return ts.clone({ + IndentSize: 4, + TabSize: 4, + NewLineCharacter: host.newLine || "\n", + ConvertTabsToSpaces: true, + IndentStyle: ts.IndentStyle.Smart, + InsertSpaceAfterCommaDelimiter: true, + InsertSpaceAfterSemicolonInForStatements: true, + InsertSpaceBeforeAndAfterBinaryOperators: true, + InsertSpaceAfterKeywordsInControlFlowStatements: true, + InsertSpaceAfterFunctionKeywordForAnonymousFunctions: false, + InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: false, + InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: false, + InsertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: false, + PlaceOpenBraceOnNewLineForFunctions: false, + PlaceOpenBraceOnNewLineForControlBlocks: false, + }); + } } export interface LineCollection { @@ -1651,7 +1718,12 @@ namespace ts.server { } reloadFromFile(filename: string, cb?: () => any) { - const content = this.host.readFile(filename); + let content = this.host.readFile(filename); + // If the file doesn't exist or cannot be read, we should + // wipe out its cached content on the server to avoid side effects. + if (!content) { + content = ""; + } this.reload(content); if (cb) cb(); diff --git a/src/server/protocol.d.ts b/src/server/protocol.d.ts index 3a669753323..f6a418fb578 100644 --- a/src/server/protocol.d.ts +++ b/src/server/protocol.d.ts @@ -1,54 +1,54 @@ -/** - * Declaration module describing the TypeScript Server protocol +/** + * Declaration module describing the TypeScript Server protocol */ declare namespace ts.server.protocol { - /** - * A TypeScript Server message + /** + * A TypeScript Server message */ export interface Message { - /** - * Sequence number of the message + /** + * Sequence number of the message */ seq: number; /** - * One of "request", "response", or "event" + * One of "request", "response", or "event" */ type: string; } - /** - * Client-initiated request message + /** + * Client-initiated request message */ export interface Request extends Message { /** - * The command to execute + * The command to execute */ command: string; - /** - * Object containing arguments for the command + /** + * Object containing arguments for the command */ arguments?: any; } /** - * Request to reload the project structure for all the opened files + * Request to reload the project structure for all the opened files */ export interface ReloadProjectsRequest extends Message { } - /** - * Server-initiated event message + /** + * Server-initiated event message */ export interface Event extends Message { - /** - * Name of event + /** + * Name of event */ event: string; - /** - * Event-specific information + /** + * Event-specific information */ body?: any; } @@ -62,18 +62,18 @@ declare namespace ts.server.protocol { */ request_seq: number; - /** - * Outcome of the request. + /** + * Outcome of the request. */ success: boolean; - /** + /** * The command requested. */ command: string; - /** - * Contains error message if success === false. + /** + * Contains error message if success === false. */ message?: string; @@ -83,7 +83,7 @@ declare namespace ts.server.protocol { body?: any; } - /** + /** * Arguments for FileRequest messages. */ export interface FileRequestArgs { @@ -93,7 +93,7 @@ declare namespace ts.server.protocol { file: string; } - /** + /** * Arguments for ProjectInfoRequest request. */ export interface ProjectInfoRequestArgs extends FileRequestArgs { @@ -110,7 +110,7 @@ declare namespace ts.server.protocol { arguments: ProjectInfoRequestArgs; } - /** + /** * Response message body for "projectInfo" request */ export interface ProjectInfo { @@ -125,7 +125,7 @@ declare namespace ts.server.protocol { fileNames?: string[]; } - /** + /** * Response message for "projectInfo" request */ export interface ProjectInfoResponse extends Response { @@ -144,12 +144,12 @@ declare namespace ts.server.protocol { * (file, line, character offset), where line and character offset are 1-based. */ export interface FileLocationRequestArgs extends FileRequestArgs { - /** + /** * The line number for the request (1-based). */ line: number; - /** + /** * The character offset (on the line) for the request (1-based). */ offset: number; @@ -216,7 +216,7 @@ declare namespace ts.server.protocol { * Object found in response messages defining a span of text in a specific source file. */ export interface FileSpan extends TextSpan { - /** + /** * File containing text span. */ file: string; @@ -300,14 +300,14 @@ declare namespace ts.server.protocol { */ lineText: string; - /** + /** * True if reference is a write location, false otherwise. */ isWriteAccess: boolean; } /** - * The body of a "references" response message. + * The body of a "references" response message. */ export interface ReferencesResponseBody { /** @@ -325,7 +325,7 @@ declare namespace ts.server.protocol { */ symbolStartOffset: number; - /** + /** * The full display name of the symbol. */ symbolDisplayString: string; @@ -355,7 +355,7 @@ declare namespace ts.server.protocol { } /** - * Information about the item to be renamed. + * Information about the item to be renamed. */ export interface RenameInfo { /** @@ -373,7 +373,7 @@ declare namespace ts.server.protocol { */ displayName: string; - /** + /** * Full display name of item to be renamed. */ fullDisplayName: string; @@ -383,7 +383,7 @@ declare namespace ts.server.protocol { */ kind: string; - /** + /** * Optional modifiers for the kind (such as 'public'). */ kindModifiers: string; @@ -444,7 +444,7 @@ declare namespace ts.server.protocol { /** Defines space handling after a comma delimiter. Default value is true. */ insertSpaceAfterCommaDelimiter?: boolean; - /** Defines space handling after a semicolon in a for statemen. Default value is true */ + /** Defines space handling after a semicolon in a for statement. Default value is true */ insertSpaceAfterSemicolonInForStatements?: boolean; /** Defines space handling after a binary operator. Default value is true. */ @@ -469,7 +469,7 @@ declare namespace ts.server.protocol { placeOpenBraceOnNewLineForControlBlocks?: boolean; /** Index operator */ - [key: string] : string | number | boolean; + [key: string]: string | number | boolean; } /** @@ -477,7 +477,7 @@ declare namespace ts.server.protocol { */ export interface ConfigureRequestArguments { - /** + /** * Information about the host, for example 'Emacs 24.4' or * 'Sublime Text version 3075' */ @@ -495,7 +495,7 @@ declare namespace ts.server.protocol { } /** - * Configure request; value of command field is "configure". Specifies + * Configure request; value of command field is "configure". Specifies * host information, such as host type, tab size, and indent size. */ export interface ConfigureRequest extends Request { @@ -514,10 +514,15 @@ declare namespace ts.server.protocol { */ export interface OpenRequestArgs extends FileRequestArgs { /** - * Used when a version of the file content is known to be more up to date than the one on disk. - * Then the known content will be used upon opening instead of the disk copy + * Used when a version of the file content is known to be more up to date than the one on disk. + * Then the known content will be used upon opening instead of the disk copy */ fileContent?: string; + /** + * Used to specify the script kind of the file explicitly. It could be one of the following: + * "TS", "JS", "TSX", "JSX" + */ + scriptKindName?: "TS" | "JS" | "TSX" | "JSX"; } /** @@ -751,7 +756,7 @@ declare namespace ts.server.protocol { * Optional modifiers for the kind (such as 'public'). */ kindModifiers: string; - /** + /** * A string that is used for comparing completion items so that they can be ordered. This * is often the same as the name but may be different in certain circumstances. */ @@ -794,7 +799,7 @@ declare namespace ts.server.protocol { } /** - * Signature help information for a single parameter + * Signature help information for a single parameter */ export interface SignatureHelpParameter { @@ -814,18 +819,18 @@ declare namespace ts.server.protocol { displayParts: SymbolDisplayPart[]; /** - * Whether the parameter is optional or not. + * Whether the parameter is optional or not. */ isOptional: boolean; } /** - * Represents a single signature to show in signature help. + * Represents a single signature to show in signature help. */ export interface SignatureHelpItem { /** - * Whether the signature accepts a variable number of arguments. + * Whether the signature accepts a variable number of arguments. */ isVariadic: boolean; @@ -835,7 +840,7 @@ declare namespace ts.server.protocol { prefixDisplayParts: SymbolDisplayPart[]; /** - * The suffix disaply parts. + * The suffix display parts. */ suffixDisplayParts: SymbolDisplayPart[]; @@ -845,7 +850,7 @@ declare namespace ts.server.protocol { separatorDisplayParts: SymbolDisplayPart[]; /** - * The signature helps items for the parameters. + * The signature helps items for the parameters. */ parameters: SignatureHelpParameter[]; @@ -861,17 +866,17 @@ declare namespace ts.server.protocol { export interface SignatureHelpItems { /** - * The signature help items. + * The signature help items. */ items: SignatureHelpItem[]; /** - * The span for which signature help should appear on a signature + * The span for which signature help should appear on a signature */ applicableSpan: TextSpan; /** - * The item selected in the set of available help items. + * The item selected in the set of available help items. */ selectedItemIndex: number; @@ -895,7 +900,7 @@ declare namespace ts.server.protocol { /** * Signature help request; value of command field is "signatureHelp". - * Given a file location (file, line, col), return the signature + * Given a file location (file, line, col), return the signature * help. */ export interface SignatureHelpRequest extends FileLocationRequest { @@ -903,7 +908,7 @@ declare namespace ts.server.protocol { } /** - * Repsonse object for a SignatureHelpRequest. + * Response object for a SignatureHelpRequest. */ export interface SignatureHelpResponse extends Response { body?: SignatureHelpItems; @@ -926,8 +931,8 @@ declare namespace ts.server.protocol { } /** - * GeterrForProjectRequest request; value of command field is - * "geterrForProject". It works similarly with 'Geterr', only + * GeterrForProjectRequest request; value of command field is + * "geterrForProject". It works similarly with 'Geterr', only * it request for every file in this project. */ export interface GeterrForProjectRequest extends Request { @@ -970,7 +975,7 @@ declare namespace ts.server.protocol { */ export interface Diagnostic { /** - * Starting file location at which text appies. + * Starting file location at which text applies. */ start: Location; @@ -997,7 +1002,7 @@ declare namespace ts.server.protocol { diagnostics: Diagnostic[]; } - /** + /** * Event message for "syntaxDiag" and "semanticDiag" event types. * These events provide syntactic and semantic errors for a file. */ @@ -1005,6 +1010,32 @@ declare namespace ts.server.protocol { body?: DiagnosticEventBody; } + export interface ConfigFileDiagnosticEventBody { + /** + * The file which trigged the searching and error-checking of the config file + */ + triggerFile: string; + + /** + * The name of the found config file. + */ + configFile: string; + + /** + * An arry of diagnostic information items for the found config file. + */ + diagnostics: Diagnostic[]; + } + + /** + * Event message for "configFileDiag" event type. + * This event provides errors for a found config file. + */ + export interface ConfigFileDiagnosticEvent extends Event { + body?: ConfigFileDiagnosticEventBody; + event: "configFileDiag"; + } + /** * Arguments for reload request. */ @@ -1033,7 +1064,7 @@ declare namespace ts.server.protocol { export interface ReloadResponse extends Response { } - /** + /** * Arguments for saveto request. */ export interface SavetoRequestArgs extends FileRequestArgs { @@ -1109,7 +1140,7 @@ declare namespace ts.server.protocol { */ kindModifiers?: string; - /** + /** * The file in which the symbol is found. */ file: string; @@ -1156,7 +1187,7 @@ declare namespace ts.server.protocol { /** * Change request message; value of command field is "change". - * Update the server's view of the file named by argument 'file'. + * Update the server's view of the file named by argument 'file'. * Server does not currently send a response to a change request. */ export interface ChangeRequest extends FileLocationRequest { @@ -1179,7 +1210,7 @@ declare namespace ts.server.protocol { } /** - * NavBar itesm request; value of command field is "navbar". + * NavBar items request; value of command field is "navbar". * Return response giving the list of navigation bar entries * extracted from the requested file. */ diff --git a/src/server/server.ts b/src/server/server.ts index d9f078ac0eb..767793024c2 100644 --- a/src/server/server.ts +++ b/src/server/server.ts @@ -1,7 +1,7 @@ /// /// // used in fs.writeSync -/* tslint:disable:no-null */ +/* tslint:disable:no-null-keyword */ namespace ts.server { const readline: NodeJS.ReadLine = require("readline"); @@ -153,6 +153,98 @@ namespace ts.server { // 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 = 2500, chunkSize = 30) { + let watchedFiles: WatchedFile[] = []; + let nextFileToCheck = 0; + let watchTimer: any; + + function getModifiedTime(fileName: string): Date { + return fs.statSync(fileName).mtime; + } + + function poll(checkedIndex: number) { + const watchedFile = watchedFiles[checkedIndex]; + if (!watchedFile) { + return; + } + + fs.stat(watchedFile.fileName, (err: any, stats: any) => { + if (err) { + watchedFile.callback(watchedFile.fileName); + } + else if (watchedFile.mtime.getTime() !== stats.mtime.getTime()) { + watchedFile.mtime = getModifiedTime(watchedFile.fileName); + watchedFile.callback(watchedFile.fileName, watchedFile.mtime.getTime() === 0); + } + }); + } + + // this implementation uses polling and + // stat due to inconsistencies of fs.watch + // and efficiency of stat on modern filesystems + function startWatchTimer() { + watchTimer = setInterval(() => { + let count = 0; + let nextToCheck = nextFileToCheck; + let firstCheck = -1; + while ((count < chunkSize) && (nextToCheck !== firstCheck)) { + poll(nextToCheck); + if (firstCheck < 0) { + firstCheck = nextToCheck; + } + nextToCheck++; + if (nextToCheck === watchedFiles.length) { + nextToCheck = 0; + } + count++; + } + nextFileToCheck = nextToCheck; + }, interval); + } + + function addFile(fileName: string, callback: FileWatcherCallback): WatchedFile { + const file: WatchedFile = { + fileName, + callback, + mtime: getModifiedTime(fileName) + }; + + watchedFiles.push(file); + if (watchedFiles.length === 1) { + startWatchTimer(); + } + return file; + } + + function removeFile(file: WatchedFile) { + watchedFiles = copyListRemovingItem(file, watchedFiles); + } + + return { + getModifiedTime: getModifiedTime, + poll: poll, + startWatchTimer: startWatchTimer, + addFile: addFile, + removeFile: removeFile + }; + } + + // 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? + const pollingWatchedFileSet = createPollingWatchedFileSet(); const logger = createLoggerFromEnv(); const pending: string[] = []; @@ -174,10 +266,21 @@ namespace ts.server { } } - // Override sys.write because fs.writeSync is not reliable on Node 4 - ts.sys.write = (s: string) => writeMessage(s); + const sys = ts.sys; - const ioSession = new IOSession(ts.sys, logger); + // Override sys.write because fs.writeSync is not reliable on Node 4 + sys.write = (s: string) => writeMessage(s); + sys.watchFile = (fileName, callback) => { + const watchedFile = pollingWatchedFileSet.addFile(fileName, callback); + return { + close: () => pollingWatchedFileSet.removeFile(watchedFile) + }; + }; + + sys.setTimeout = setTimeout; + sys.clearTimeout = clearTimeout; + + const ioSession = new IOSession(sys, logger); process.on("uncaughtException", function(err: Error) { ioSession.logError(err, "unknown"); }); diff --git a/src/server/session.ts b/src/server/session.ts index 9b9bf35a4a5..09b86da48cc 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -68,7 +68,7 @@ namespace ts.server { } } - function formatDiag(fileName: string, project: Project, diag: ts.Diagnostic) { + function formatDiag(fileName: string, project: Project, diag: ts.Diagnostic): protocol.Diagnostic { return { start: project.compilerService.host.positionToLineOffset(fileName, diag.start), end: project.compilerService.host.positionToLineOffset(fileName, diag.start + diag.length), @@ -76,6 +76,14 @@ namespace ts.server { }; } + function formatConfigFileDiag(diag: ts.Diagnostic): protocol.Diagnostic { + return { + start: undefined, + end: undefined, + text: ts.flattenDiagnosticMessageText(diag.messageText, "\n") + }; + } + export interface PendingErrorCheck { fileName: string; project: Project; @@ -125,6 +133,8 @@ namespace ts.server { } export interface ServerHost extends ts.System { + setTimeout(callback: (...args: any[]) => void, ms: number, ...args: any[]): any; + clearTimeout(timeoutId: any): void; } export class Session { @@ -141,8 +151,8 @@ namespace ts.server { ) { this.projectService = new ProjectService(host, logger, (eventName, project, fileName) => { - this.handleEvent(eventName, project, fileName); - }); + this.handleEvent(eventName, project, fileName); + }); } private handleEvent(eventName: string, project: Project, fileName: string) { @@ -178,6 +188,21 @@ namespace ts.server { "\r\n\r\n" + json); } + public configFileDiagnosticEvent(triggerFile: string, configFile: string, diagnostics: ts.Diagnostic[]) { + const bakedDiags = ts.map(diagnostics, formatConfigFileDiag); + const ev: protocol.ConfigFileDiagnosticEvent = { + seq: 0, + type: "event", + event: "configFileDiag", + body: { + triggerFile, + configFile, + diagnostics: bakedDiags + } + }; + this.send(ev); + } + public event(info: any, eventName: string) { const ev: protocol.Event = { seq: 0, @@ -412,14 +437,17 @@ namespace ts.server { private getRenameLocations(line: number, offset: number, fileName: string, findInComments: boolean, findInStrings: boolean): protocol.RenameResponseBody { const file = ts.normalizePath(fileName); - const project = this.projectService.getProjectForFile(file); - if (!project) { + const info = this.projectService.getScriptInfo(file); + const projects = this.projectService.findReferencingProjects(info); + if (!projects.length) { throw Errors.NoProject; } - const compilerService = project.compilerService; - const position = compilerService.host.lineOffsetToPosition(file, line, offset); - const renameInfo = compilerService.languageService.getRenameInfo(file, position); + const defaultProject = projects[0]; + // The rename info should be the same for every project + const defaultProjectCompilerService = defaultProject.compilerService; + const position = defaultProjectCompilerService.host.lineOffsetToPosition(file, line, offset); + const renameInfo = defaultProjectCompilerService.languageService.getRenameInfo(file, position); if (!renameInfo) { return undefined; } @@ -431,16 +459,43 @@ namespace ts.server { }; } - const renameLocations = compilerService.languageService.findRenameLocations(file, position, findInStrings, findInComments); - if (!renameLocations) { - return undefined; - } + const fileSpans = combineProjectOutput( + projects, + (project: Project) => { + const compilerService = project.compilerService; + const renameLocations = compilerService.languageService.findRenameLocations(file, position, findInStrings, findInComments); + if (!renameLocations) { + return []; + } - const bakedRenameLocs = renameLocations.map(location => ({ - file: location.fileName, - start: compilerService.host.positionToLineOffset(location.fileName, location.textSpan.start), - end: compilerService.host.positionToLineOffset(location.fileName, ts.textSpanEnd(location.textSpan)), - })).sort((a, b) => { + return renameLocations.map(location => ({ + file: location.fileName, + start: compilerService.host.positionToLineOffset(location.fileName, location.textSpan.start), + end: compilerService.host.positionToLineOffset(location.fileName, ts.textSpanEnd(location.textSpan)), + })); + }, + compareRenameLocation, + (a, b) => a.file === b.file && a.start.line === b.start.line && a.start.offset === b.start.offset + ); + const locs = fileSpans.reduce((accum, cur) => { + let curFileAccum: protocol.SpanGroup; + if (accum.length > 0) { + curFileAccum = accum[accum.length - 1]; + if (curFileAccum.file !== cur.file) { + curFileAccum = undefined; + } + } + if (!curFileAccum) { + curFileAccum = { file: cur.file, locs: [] }; + accum.push(curFileAccum); + } + curFileAccum.locs.push({ start: cur.start, end: cur.end }); + return accum; + }, []); + + return { info: renameInfo, locs }; + + function compareRenameLocation(a: protocol.FileSpan, b: protocol.FileSpan) { if (a.file < b.file) { return -1; } @@ -459,79 +514,82 @@ namespace ts.server { return b.start.offset - a.start.offset; } } - }).reduce((accum: protocol.SpanGroup[], cur: protocol.FileSpan) => { - let curFileAccum: protocol.SpanGroup; - if (accum.length > 0) { - curFileAccum = accum[accum.length - 1]; - if (curFileAccum.file != cur.file) { - curFileAccum = undefined; - } - } - if (!curFileAccum) { - curFileAccum = { file: cur.file, locs: [] }; - accum.push(curFileAccum); - } - curFileAccum.locs.push({ start: cur.start, end: cur.end }); - return accum; - }, []); - - return { info: renameInfo, locs: bakedRenameLocs }; + } } private getReferences(line: number, offset: number, fileName: string): protocol.ReferencesResponseBody { - // TODO: get all projects for this file; report refs for all projects deleting duplicates - // can avoid duplicates by eliminating same ref file from subsequent projects const file = ts.normalizePath(fileName); - const project = this.projectService.getProjectForFile(file); - if (!project) { + const info = this.projectService.getScriptInfo(file); + const projects = this.projectService.findReferencingProjects(info); + if (!projects.length) { throw Errors.NoProject; } - const compilerService = project.compilerService; - const position = compilerService.host.lineOffsetToPosition(file, line, offset); - - const references = compilerService.languageService.getReferencesAtPosition(file, position); - if (!references) { - return undefined; - } - - const nameInfo = compilerService.languageService.getQuickInfoAtPosition(file, position); + const defaultProject = projects[0]; + const position = defaultProject.compilerService.host.lineOffsetToPosition(file, line, offset); + const nameInfo = defaultProject.compilerService.languageService.getQuickInfoAtPosition(file, position); if (!nameInfo) { return undefined; } const displayString = ts.displayPartsToString(nameInfo.displayParts); const nameSpan = nameInfo.textSpan; - const nameColStart = compilerService.host.positionToLineOffset(file, nameSpan.start).offset; - const nameText = compilerService.host.getScriptSnapshot(file).getText(nameSpan.start, ts.textSpanEnd(nameSpan)); - const bakedRefs: protocol.ReferencesResponseItem[] = references.map(ref => { - const start = compilerService.host.positionToLineOffset(ref.fileName, ref.textSpan.start); - const refLineSpan = compilerService.host.lineToTextSpan(ref.fileName, start.line - 1); - const snap = compilerService.host.getScriptSnapshot(ref.fileName); - const lineText = snap.getText(refLineSpan.start, ts.textSpanEnd(refLineSpan)).replace(/\r|\n/g, ""); - return { - file: ref.fileName, - start: start, - lineText: lineText, - end: compilerService.host.positionToLineOffset(ref.fileName, ts.textSpanEnd(ref.textSpan)), - isWriteAccess: ref.isWriteAccess - }; - }).sort(compareFileStart); + const nameColStart = defaultProject.compilerService.host.positionToLineOffset(file, nameSpan.start).offset; + const nameText = defaultProject.compilerService.host.getScriptSnapshot(file).getText(nameSpan.start, ts.textSpanEnd(nameSpan)); + const refs = combineProjectOutput( + projects, + (project: Project) => { + const compilerService = project.compilerService; + const references = compilerService.languageService.getReferencesAtPosition(file, position); + if (!references) { + return []; + } + + return references.map(ref => { + const start = compilerService.host.positionToLineOffset(ref.fileName, ref.textSpan.start); + const refLineSpan = compilerService.host.lineToTextSpan(ref.fileName, start.line - 1); + const snap = compilerService.host.getScriptSnapshot(ref.fileName); + const lineText = snap.getText(refLineSpan.start, ts.textSpanEnd(refLineSpan)).replace(/\r|\n/g, ""); + return { + file: ref.fileName, + start: start, + lineText: lineText, + end: compilerService.host.positionToLineOffset(ref.fileName, ts.textSpanEnd(ref.textSpan)), + isWriteAccess: ref.isWriteAccess + }; + }); + }, + compareFileStart, + areReferencesResponseItemsForTheSameLocation + ); + return { - refs: bakedRefs, + refs, symbolName: nameText, symbolStartOffset: nameColStart, symbolDisplayString: displayString }; + + function areReferencesResponseItemsForTheSameLocation(a: protocol.ReferencesResponseItem, b: protocol.ReferencesResponseItem) { + if (a && b) { + return a.file === b.file && + a.start === b.start && + a.end === b.end; + } + return false; + } } /** * @param fileName is the name of the file to be opened * @param fileContent is a version of the file content that is known to be more up to date than the one on disk */ - private openClientFile(fileName: string, fileContent?: string) { + private openClientFile(fileName: string, fileContent?: string, scriptKind?: ScriptKind) { const file = ts.normalizePath(fileName); - this.projectService.openClientFile(file, fileContent); + const { configFileName, configFileErrors } = this.projectService.openClientFile(file, fileContent, scriptKind); + if (configFileErrors) { + this.configFileDiagnosticEvent(fileName, configFileName, configFileErrors); + } } private getQuickInfo(line: number, offset: number, fileName: string): protocol.QuickInfoResponseBody { @@ -603,7 +661,7 @@ namespace ts.server { // Check whether we should auto-indent. This will be when // the position is on a line containing only whitespace. // This should leave the edits returned from - // getFormattingEditsAfterKeytroke either empty or pertaining + // getFormattingEditsAfterKeystroke either empty or pertaining // only to the previous line. If all this is true, then // add edits necessary to properly indent the current line. if ((key == "\n") && ((!edits) || (edits.length === 0) || allEditsBeforePos(edits, position))) { @@ -617,7 +675,7 @@ namespace ts.server { const editorOptions: ts.EditorOptions = { IndentSize: formatOptions.IndentSize, TabSize: formatOptions.TabSize, - NewLineCharacter: "\n", + NewLineCharacter: formatOptions.NewLineCharacter, ConvertTabsToSpaces: formatOptions.ConvertTabsToSpaces, IndentStyle: ts.IndentStyle.Smart, }; @@ -792,7 +850,9 @@ namespace ts.server { } private closeClientFile(fileName: string) { - if (!fileName) { return; } + if (!fileName) { + return; + } const file = ts.normalizePath(fileName); this.projectService.closeClientFile(file); } @@ -834,41 +894,60 @@ namespace ts.server { private getNavigateToItems(searchValue: string, fileName: string, maxResultCount?: number): protocol.NavtoItem[] { const file = ts.normalizePath(fileName); - const project = this.projectService.getProjectForFile(file); - if (!project) { + const info = this.projectService.getScriptInfo(file); + const projects = this.projectService.findReferencingProjects(info); + const defaultProject = projects[0]; + if (!defaultProject) { throw Errors.NoProject; } - const compilerService = project.compilerService; - const navItems = compilerService.languageService.getNavigateToItems(searchValue, maxResultCount); - if (!navItems) { - return undefined; - } + const allNavToItems = combineProjectOutput( + projects, + (project: Project) => { + const compilerService = project.compilerService; + const navItems = compilerService.languageService.getNavigateToItems(searchValue, maxResultCount); + if (!navItems) { + return []; + } - return navItems.map((navItem) => { - const start = compilerService.host.positionToLineOffset(navItem.fileName, navItem.textSpan.start); - const end = compilerService.host.positionToLineOffset(navItem.fileName, ts.textSpanEnd(navItem.textSpan)); - const bakedItem: protocol.NavtoItem = { - name: navItem.name, - kind: navItem.kind, - file: navItem.fileName, - start: start, - end: end, - }; - if (navItem.kindModifiers && (navItem.kindModifiers != "")) { - bakedItem.kindModifiers = navItem.kindModifiers; + return navItems.map((navItem) => { + const start = compilerService.host.positionToLineOffset(navItem.fileName, navItem.textSpan.start); + const end = compilerService.host.positionToLineOffset(navItem.fileName, ts.textSpanEnd(navItem.textSpan)); + const bakedItem: protocol.NavtoItem = { + name: navItem.name, + kind: navItem.kind, + file: navItem.fileName, + start: start, + end: end, + }; + if (navItem.kindModifiers && (navItem.kindModifiers !== "")) { + bakedItem.kindModifiers = navItem.kindModifiers; + } + if (navItem.matchKind !== "none") { + bakedItem.matchKind = navItem.matchKind; + } + if (navItem.containerName && (navItem.containerName.length > 0)) { + bakedItem.containerName = navItem.containerName; + } + if (navItem.containerKind && (navItem.containerKind.length > 0)) { + bakedItem.containerKind = navItem.containerKind; + } + return bakedItem; + }); + }, + /*comparer*/ undefined, + areNavToItemsForTheSameLocation + ); + return allNavToItems; + + function areNavToItemsForTheSameLocation(a: protocol.NavtoItem, b: protocol.NavtoItem) { + if (a && b) { + return a.file === b.file && + a.start === b.start && + a.end === b.end; } - if (navItem.matchKind !== "none") { - bakedItem.matchKind = navItem.matchKind; - } - if (navItem.containerName && (navItem.containerName.length > 0)) { - bakedItem.containerName = navItem.containerName; - } - if (navItem.containerKind && (navItem.containerKind.length > 0)) { - bakedItem.containerKind = navItem.containerKind; - } - return bakedItem; - }); + return false; + } } private getBraceMatching(line: number, offset: number, fileName: string): protocol.TextSpan[] { @@ -942,129 +1021,146 @@ namespace ts.server { exit() { } - private handlers: Map<(request: protocol.Request) => {response?: any, responseRequired?: boolean}> = { + private handlers: Map<(request: protocol.Request) => { response?: any, responseRequired?: boolean }> = { [CommandNames.Exit]: () => { this.exit(); - return { responseRequired: false}; + return { responseRequired: false }; }, [CommandNames.Definition]: (request: protocol.Request) => { const defArgs = request.arguments; - return {response: this.getDefinition(defArgs.line, defArgs.offset, defArgs.file), responseRequired: true}; + return { response: this.getDefinition(defArgs.line, defArgs.offset, defArgs.file), responseRequired: true }; }, [CommandNames.TypeDefinition]: (request: protocol.Request) => { const defArgs = request.arguments; - return {response: this.getTypeDefinition(defArgs.line, defArgs.offset, defArgs.file), responseRequired: true}; + return { response: this.getTypeDefinition(defArgs.line, defArgs.offset, defArgs.file), responseRequired: true }; }, [CommandNames.References]: (request: protocol.Request) => { const defArgs = request.arguments; - return {response: this.getReferences(defArgs.line, defArgs.offset, defArgs.file), responseRequired: true}; + return { response: this.getReferences(defArgs.line, defArgs.offset, defArgs.file), responseRequired: true }; }, [CommandNames.Rename]: (request: protocol.Request) => { const renameArgs = request.arguments; - return {response: this.getRenameLocations(renameArgs.line, renameArgs.offset, renameArgs.file, renameArgs.findInComments, renameArgs.findInStrings), responseRequired: true}; + return { response: this.getRenameLocations(renameArgs.line, renameArgs.offset, renameArgs.file, renameArgs.findInComments, renameArgs.findInStrings), responseRequired: true }; }, [CommandNames.Open]: (request: protocol.Request) => { const openArgs = request.arguments; - this.openClientFile(openArgs.file, openArgs.fileContent); - return {responseRequired: false}; + let scriptKind: ScriptKind; + switch (openArgs.scriptKindName) { + case "TS": + scriptKind = ScriptKind.TS; + break; + case "JS": + scriptKind = ScriptKind.JS; + break; + case "TSX": + scriptKind = ScriptKind.TSX; + break; + case "JSX": + scriptKind = ScriptKind.JSX; + break; + } + this.openClientFile(openArgs.file, openArgs.fileContent, scriptKind); + return { responseRequired: false }; }, [CommandNames.Quickinfo]: (request: protocol.Request) => { const quickinfoArgs = request.arguments; - return {response: this.getQuickInfo(quickinfoArgs.line, quickinfoArgs.offset, quickinfoArgs.file), responseRequired: true}; + return { response: this.getQuickInfo(quickinfoArgs.line, quickinfoArgs.offset, quickinfoArgs.file), responseRequired: true }; }, [CommandNames.Format]: (request: protocol.Request) => { const formatArgs = request.arguments; - return {response: this.getFormattingEditsForRange(formatArgs.line, formatArgs.offset, formatArgs.endLine, formatArgs.endOffset, formatArgs.file), responseRequired: true}; + return { response: this.getFormattingEditsForRange(formatArgs.line, formatArgs.offset, formatArgs.endLine, formatArgs.endOffset, formatArgs.file), responseRequired: true }; }, [CommandNames.Formatonkey]: (request: protocol.Request) => { const formatOnKeyArgs = request.arguments; - return {response: this.getFormattingEditsAfterKeystroke(formatOnKeyArgs.line, formatOnKeyArgs.offset, formatOnKeyArgs.key, formatOnKeyArgs.file), responseRequired: true}; + return { response: this.getFormattingEditsAfterKeystroke(formatOnKeyArgs.line, formatOnKeyArgs.offset, formatOnKeyArgs.key, formatOnKeyArgs.file), responseRequired: true }; }, [CommandNames.Completions]: (request: protocol.Request) => { const completionsArgs = request.arguments; - return {response: this.getCompletions(completionsArgs.line, completionsArgs.offset, completionsArgs.prefix, completionsArgs.file), responseRequired: true}; + return { response: this.getCompletions(completionsArgs.line, completionsArgs.offset, completionsArgs.prefix, completionsArgs.file), responseRequired: true }; }, [CommandNames.CompletionDetails]: (request: protocol.Request) => { const completionDetailsArgs = request.arguments; - return {response: this.getCompletionEntryDetails(completionDetailsArgs.line, completionDetailsArgs.offset, - completionDetailsArgs.entryNames, completionDetailsArgs.file), responseRequired: true}; + return { + response: this.getCompletionEntryDetails(completionDetailsArgs.line, completionDetailsArgs.offset, + completionDetailsArgs.entryNames, completionDetailsArgs.file), responseRequired: true + }; }, [CommandNames.SignatureHelp]: (request: protocol.Request) => { const signatureHelpArgs = request.arguments; - return {response: this.getSignatureHelpItems(signatureHelpArgs.line, signatureHelpArgs.offset, signatureHelpArgs.file), responseRequired: true}; + return { response: this.getSignatureHelpItems(signatureHelpArgs.line, signatureHelpArgs.offset, signatureHelpArgs.file), responseRequired: true }; }, [CommandNames.Geterr]: (request: protocol.Request) => { const geterrArgs = request.arguments; - return {response: this.getDiagnostics(geterrArgs.delay, geterrArgs.files), responseRequired: false}; + return { response: this.getDiagnostics(geterrArgs.delay, geterrArgs.files), responseRequired: false }; }, [CommandNames.GeterrForProject]: (request: protocol.Request) => { const { file, delay } = request.arguments; - return {response: this.getDiagnosticsForProject(delay, file), responseRequired: false}; + return { response: this.getDiagnosticsForProject(delay, file), responseRequired: false }; }, [CommandNames.Change]: (request: protocol.Request) => { const changeArgs = request.arguments; this.change(changeArgs.line, changeArgs.offset, changeArgs.endLine, changeArgs.endOffset, - changeArgs.insertString, changeArgs.file); - return {responseRequired: false}; + changeArgs.insertString, changeArgs.file); + return { responseRequired: false }; }, [CommandNames.Configure]: (request: protocol.Request) => { const configureArgs = request.arguments; this.projectService.setHostConfiguration(configureArgs); this.output(undefined, CommandNames.Configure, request.seq); - return {responseRequired: false}; + return { responseRequired: false }; }, [CommandNames.Reload]: (request: protocol.Request) => { const reloadArgs = request.arguments; this.reload(reloadArgs.file, reloadArgs.tmpfile, request.seq); - return {responseRequired: false}; + return {response: { reloadFinished: true }, responseRequired: true}; }, [CommandNames.Saveto]: (request: protocol.Request) => { const savetoArgs = request.arguments; this.saveToTmp(savetoArgs.file, savetoArgs.tmpfile); - return {responseRequired: false}; + return { responseRequired: false }; }, [CommandNames.Close]: (request: protocol.Request) => { const closeArgs = request.arguments; this.closeClientFile(closeArgs.file); - return {responseRequired: false}; + return { responseRequired: false }; }, [CommandNames.Navto]: (request: protocol.Request) => { const navtoArgs = request.arguments; - return {response: this.getNavigateToItems(navtoArgs.searchValue, navtoArgs.file, navtoArgs.maxResultCount), responseRequired: true}; + return { response: this.getNavigateToItems(navtoArgs.searchValue, navtoArgs.file, navtoArgs.maxResultCount), responseRequired: true }; }, [CommandNames.Brace]: (request: protocol.Request) => { const braceArguments = request.arguments; - return {response: this.getBraceMatching(braceArguments.line, braceArguments.offset, braceArguments.file), responseRequired: true}; + return { response: this.getBraceMatching(braceArguments.line, braceArguments.offset, braceArguments.file), responseRequired: true }; }, [CommandNames.NavBar]: (request: protocol.Request) => { const navBarArgs = request.arguments; - return {response: this.getNavigationBarItems(navBarArgs.file), responseRequired: true}; + return { response: this.getNavigationBarItems(navBarArgs.file), responseRequired: true }; }, [CommandNames.Occurrences]: (request: protocol.Request) => { const { line, offset, file: fileName } = request.arguments; - return {response: this.getOccurrences(line, offset, fileName), responseRequired: true}; + return { response: this.getOccurrences(line, offset, fileName), responseRequired: true }; }, [CommandNames.DocumentHighlights]: (request: protocol.Request) => { const { line, offset, file: fileName, filesToSearch } = request.arguments; - return {response: this.getDocumentHighlights(line, offset, fileName, filesToSearch), responseRequired: true}; + return { response: this.getDocumentHighlights(line, offset, fileName, filesToSearch), responseRequired: true }; }, [CommandNames.ProjectInfo]: (request: protocol.Request) => { const { file, needFileNameList } = request.arguments; - return {response: this.getProjectInfo(file, needFileNameList), responseRequired: true}; + return { response: this.getProjectInfo(file, needFileNameList), responseRequired: true }; }, [CommandNames.ReloadProjects]: (request: protocol.ReloadProjectsRequest) => { this.reloadProjects(); - return {responseRequired: false}; + return { responseRequired: false }; } }; - public addProtocolHandler(command: string, handler: (request: protocol.Request) => {response?: any, responseRequired: boolean}) { + public addProtocolHandler(command: string, handler: (request: protocol.Request) => { response?: any, responseRequired: boolean }) { if (this.handlers[command]) { throw new Error(`Protocol handler already exists for command "${command}"`); } this.handlers[command] = handler; } - public executeCommand(request: protocol.Request): {response?: any, responseRequired?: boolean} { + public executeCommand(request: protocol.Request): { response?: any, responseRequired?: boolean } { const handler = this.handlers[request.command]; if (handler) { return handler(request); @@ -1072,7 +1168,7 @@ namespace ts.server { else { this.projectService.log("Unrecognized JSON command: " + JSON.stringify(request)); this.output(undefined, CommandNames.Unknown, request.seq, "Unrecognized JSON command: " + request.command); - return {responseRequired: false}; + return { responseRequired: false }; } } diff --git a/src/server/tsconfig.json b/src/server/tsconfig.json index 2c8538c61e3..0772210cb15 100644 --- a/src/server/tsconfig.json +++ b/src/server/tsconfig.json @@ -1,6 +1,5 @@ { "compilerOptions": { - "module": "commonjs", "noImplicitAny": true, "removeComments": true, "preserveConstEnums": true, diff --git a/src/services/breakpoints.ts b/src/services/breakpoints.ts index 31ab5d2adec..02456f5add1 100644 --- a/src/services/breakpoints.ts +++ b/src/services/breakpoints.ts @@ -10,7 +10,7 @@ namespace ts.BreakpointResolver { */ export function spanInSourceFileAtLocation(sourceFile: SourceFile, position: number) { // Cannot set breakpoint in dts file - if (sourceFile.flags & NodeFlags.DeclarationFile) { + if (sourceFile.isDeclarationFile) { return undefined; } @@ -24,7 +24,7 @@ namespace ts.BreakpointResolver { // token on same line if trailing trivia (comments or white spaces on same line) part of the last token on that line tokenAtLocation = findPrecedingToken(tokenAtLocation.pos, sourceFile); - // Its a blank line + // It's a blank line if (!tokenAtLocation || sourceFile.getLineAndCharacterOfPosition(tokenAtLocation.getEnd()).line !== lineOfPosition) { return undefined; } @@ -45,6 +45,10 @@ namespace ts.BreakpointResolver { return createTextSpanFromBounds(start, (endNode || startNode).getEnd()); } + function textSpanEndingAtNextToken(startNode: Node, previousTokenToFindNextEndToken: Node): TextSpan { + return textSpan(startNode, findNextToken(previousTokenToFindNextEndToken, previousTokenToFindNextEndToken.parent)); + } + function spanInNodeIfStartsOnSameLine(node: Node, otherwiseOnNode?: Node): TextSpan { if (node && lineOfPosition === sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile)).line) { return spanInNode(node); @@ -66,33 +70,6 @@ namespace ts.BreakpointResolver { function spanInNode(node: Node): TextSpan { if (node) { - if (isExpression(node)) { - if (node.parent.kind === SyntaxKind.DoStatement) { - // Set span as if on while keyword - return spanInPreviousNode(node); - } - - if (node.parent.kind === SyntaxKind.Decorator) { - // Set breakpoint on the decorator emit - return spanInNode(node.parent); - } - - if (node.parent.kind === SyntaxKind.ForStatement) { - // For now lets set the span on this expression, fix it later - return textSpan(node); - } - - if (node.parent.kind === SyntaxKind.BinaryExpression && (node.parent).operatorToken.kind === SyntaxKind.CommaToken) { - // if this is comma expression, the breakpoint is possible in this expression - return textSpan(node); - } - - if (node.parent.kind === SyntaxKind.ArrowFunction && (node.parent).body === node) { - // If this is body of arrow function, it is allowed to have the breakpoint - return textSpan(node); - } - } - switch (node.kind) { case SyntaxKind.VariableStatement: // Span on first variable declaration @@ -120,7 +97,7 @@ namespace ts.BreakpointResolver { if (isFunctionBlock(node)) { return spanInFunctionBlock(node); } - // Fall through + // Fall through case SyntaxKind.ModuleBlock: return spanInBlock(node); @@ -137,7 +114,7 @@ namespace ts.BreakpointResolver { case SyntaxKind.WhileStatement: // Span on while(...) - return textSpan(node, findNextToken((node).expression, node)); + return textSpanEndingAtNextToken(node, (node).expression); case SyntaxKind.DoStatement: // span in statement of the do statement @@ -149,7 +126,7 @@ namespace ts.BreakpointResolver { case SyntaxKind.IfStatement: // set on if(..) span - return textSpan(node, findNextToken((node).expression, node)); + return textSpanEndingAtNextToken(node, (node).expression); case SyntaxKind.LabeledStatement: // span in statement @@ -164,13 +141,16 @@ namespace ts.BreakpointResolver { return spanInForStatement(node); case SyntaxKind.ForInStatement: + // span of for (a in ...) + return textSpanEndingAtNextToken(node, (node).expression); + case SyntaxKind.ForOfStatement: - // span on for (a in ...) - return textSpan(node, findNextToken((node).expression, node)); + // span in initializer + return spanInInitializerOfForLike(node); case SyntaxKind.SwitchStatement: // span on switch(...) - return textSpan(node, findNextToken((node).expression, node)); + return textSpanEndingAtNextToken(node, (node).expression); case SyntaxKind.CaseClause: case SyntaxKind.DefaultClause: @@ -210,8 +190,7 @@ namespace ts.BreakpointResolver { case SyntaxKind.ClassDeclaration: case SyntaxKind.EnumDeclaration: case SyntaxKind.EnumMember: - case SyntaxKind.CallExpression: - case SyntaxKind.NewExpression: + case SyntaxKind.BindingElement: // span on complete node return textSpan(node); @@ -222,6 +201,10 @@ namespace ts.BreakpointResolver { case SyntaxKind.Decorator: return spanInNodeArray(node.parent.decorators); + case SyntaxKind.ObjectBindingPattern: + case SyntaxKind.ArrayBindingPattern: + return spanInBindingPattern(node); + // No breakpoint in interface, type alias case SyntaxKind.InterfaceDeclaration: case SyntaxKind.TypeAliasDeclaration: @@ -234,14 +217,17 @@ namespace ts.BreakpointResolver { case SyntaxKind.CommaToken: return spanInPreviousNode(node) - + case SyntaxKind.OpenBraceToken: return spanInOpenBraceToken(node); case SyntaxKind.CloseBraceToken: return spanInCloseBraceToken(node); - case SyntaxKind.OpenParenToken: + case SyntaxKind.CloseBracketToken: + return spanInCloseBracketToken(node); + + case SyntaxKind.OpenParenToken: return spanInOpenParenToken(node); case SyntaxKind.CloseParenToken: @@ -263,15 +249,93 @@ namespace ts.BreakpointResolver { case SyntaxKind.FinallyKeyword: return spanInNextNode(node); + case SyntaxKind.OfKeyword: + return spanInOfKeyword(node); + default: - // If this is name of property assignment, set breakpoint in the initializer - if (node.parent.kind === SyntaxKind.PropertyAssignment && (node.parent).name === node) { - return spanInNode((node.parent).initializer); + // Destructuring pattern in destructuring assignment + // [a, b, c] of + // [a, b, c] = expression + if (isArrayLiteralOrObjectLiteralDestructuringPattern(node)) { + return spanInArrayLiteralOrObjectLiteralDestructuringPattern(node); + } + + // Set breakpoint on identifier element of destructuring pattern + // a or ...c or d: x from + // [a, b, ...c] or { a, b } or { d: x } from destructuring pattern + if ((node.kind === SyntaxKind.Identifier || + node.kind == SyntaxKind.SpreadElementExpression || + node.kind === SyntaxKind.PropertyAssignment || + node.kind === SyntaxKind.ShorthandPropertyAssignment) && + isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent)) { + return textSpan(node); } + if (node.kind === SyntaxKind.BinaryExpression) { + const binaryExpression = node; + // Set breakpoint in destructuring pattern if its destructuring assignment + // [a, b, c] or {a, b, c} of + // [a, b, c] = expression or + // {a, b, c} = expression + if (isArrayLiteralOrObjectLiteralDestructuringPattern(binaryExpression.left)) { + return spanInArrayLiteralOrObjectLiteralDestructuringPattern( + binaryExpression.left); + } + + if (binaryExpression.operatorToken.kind === SyntaxKind.EqualsToken && + isArrayLiteralOrObjectLiteralDestructuringPattern(binaryExpression.parent)) { + // Set breakpoint on assignment expression element of destructuring pattern + // a = expression of + // [a = expression, b, c] = someExpression or + // { a = expression, b, c } = someExpression + return textSpan(node); + } + + if (binaryExpression.operatorToken.kind === SyntaxKind.CommaToken) { + return spanInNode(binaryExpression.left); + } + } + + if (isExpression(node)) { + switch (node.parent.kind) { + case SyntaxKind.DoStatement: + // Set span as if on while keyword + return spanInPreviousNode(node); + + case SyntaxKind.Decorator: + // Set breakpoint on the decorator emit + return spanInNode(node.parent); + + case SyntaxKind.ForStatement: + case SyntaxKind.ForOfStatement: + return textSpan(node); + + case SyntaxKind.BinaryExpression: + if ((node.parent).operatorToken.kind === SyntaxKind.CommaToken) { + // If this is a comma expression, the breakpoint is possible in this expression + return textSpan(node); + } + break; + + case SyntaxKind.ArrowFunction: + if ((node.parent).body === node) { + // If this is body of arrow function, it is allowed to have the breakpoint + return textSpan(node); + } + break; + } + } + + // If this is name of property assignment, set breakpoint in the initializer + if (node.parent.kind === SyntaxKind.PropertyAssignment && + (node.parent).name === node && + !isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.parent)) { + return spanInNode((node.parent).initializer); + } + // Breakpoint in type assertion goes to its operand if (node.parent.kind === SyntaxKind.TypeAssertionExpression && (node.parent).type === node) { - return spanInNode((node.parent).expression); + return spanInNextNode((node.parent).type); } // return type of function go to previous token @@ -279,48 +343,70 @@ namespace ts.BreakpointResolver { return spanInPreviousNode(node); } + // initializer of variable/parameter declaration go to previous node + if ((node.parent.kind === SyntaxKind.VariableDeclaration || + node.parent.kind === SyntaxKind.Parameter)) { + const paramOrVarDecl = node.parent; + if (paramOrVarDecl.initializer === node || + paramOrVarDecl.type === node || + isAssignmentOperator(node.kind)) { + return spanInPreviousNode(node); + } + } + + if (node.parent.kind === SyntaxKind.BinaryExpression) { + const binaryExpression = node.parent; + if (isArrayLiteralOrObjectLiteralDestructuringPattern(binaryExpression.left) && + (binaryExpression.right === node || + binaryExpression.operatorToken === node)) { + // If initializer of destructuring assignment move to previous token + return spanInPreviousNode(node); + } + } + // Default go to parent to set the breakpoint return spanInNode(node.parent); } } + function textSpanFromVariableDeclaration(variableDeclaration: VariableDeclaration): TextSpan { + let declarations = variableDeclaration.parent.declarations; + if (declarations && declarations[0] === variableDeclaration) { + // First declaration - include let keyword + return textSpan(findPrecedingToken(variableDeclaration.pos, sourceFile, variableDeclaration.parent), variableDeclaration); + } + else { + // Span only on this declaration + return textSpan(variableDeclaration); + } + } + function spanInVariableDeclaration(variableDeclaration: VariableDeclaration): TextSpan { // If declaration of for in statement, just set the span in parent - if (variableDeclaration.parent.parent.kind === SyntaxKind.ForInStatement || - variableDeclaration.parent.parent.kind === SyntaxKind.ForOfStatement) { + if (variableDeclaration.parent.parent.kind === SyntaxKind.ForInStatement) { return spanInNode(variableDeclaration.parent.parent); } - - let isParentVariableStatement = variableDeclaration.parent.parent.kind === SyntaxKind.VariableStatement; - let isDeclarationOfForStatement = variableDeclaration.parent.parent.kind === SyntaxKind.ForStatement && contains(((variableDeclaration.parent.parent).initializer).declarations, variableDeclaration); - let declarations = isParentVariableStatement - ? (variableDeclaration.parent.parent).declarationList.declarations - : isDeclarationOfForStatement - ? ((variableDeclaration.parent.parent).initializer).declarations - : undefined; + + // If this is a destructuring pattern, set breakpoint in binding pattern + if (isBindingPattern(variableDeclaration.name)) { + return spanInBindingPattern(variableDeclaration.name); + } // Breakpoint is possible in variableDeclaration only if there is initialization - if (variableDeclaration.initializer || (variableDeclaration.flags & NodeFlags.Export)) { - if (declarations && declarations[0] === variableDeclaration) { - if (isParentVariableStatement) { - // First declaration - include let keyword - return textSpan(variableDeclaration.parent, variableDeclaration); - } - else { - Debug.assert(isDeclarationOfForStatement); - // Include let keyword from for statement declarations in the span - return textSpan(findPrecedingToken(variableDeclaration.pos, sourceFile, variableDeclaration.parent), variableDeclaration); - } - } - else { - // Span only on this declaration - return textSpan(variableDeclaration); - } + // or its declaration from 'for of' + if (variableDeclaration.initializer || + (variableDeclaration.flags & NodeFlags.Export) || + variableDeclaration.parent.parent.kind === SyntaxKind.ForOfStatement) { + return textSpanFromVariableDeclaration(variableDeclaration); } - else if (declarations && declarations[0] !== variableDeclaration) { - // If we cant set breakpoint on this declaration, set it on previous one - let indexOfCurrentDeclaration = indexOf(declarations, variableDeclaration); - return spanInVariableDeclaration(declarations[indexOfCurrentDeclaration - 1]); + + let declarations = variableDeclaration.parent.declarations; + if (declarations && declarations[0] !== variableDeclaration) { + // If we cannot set breakpoint on this declaration, set it on previous one + // Because the variable declaration may be binding pattern and + // we would like to set breakpoint in last binding element if that's the case, + // use preceding token instead + return spanInNode(findPrecedingToken(variableDeclaration.pos, sourceFile, variableDeclaration.parent)); } } @@ -331,7 +417,11 @@ namespace ts.BreakpointResolver { } function spanInParameterDeclaration(parameter: ParameterDeclaration): TextSpan { - if (canHaveSpanInParameterDeclaration(parameter)) { + if (isBindingPattern(parameter.name)) { + // Set breakpoint in binding pattern + return spanInBindingPattern(parameter.name); + } + else if (canHaveSpanInParameterDeclaration(parameter)) { return textSpan(parameter); } else { @@ -388,11 +478,11 @@ namespace ts.BreakpointResolver { case SyntaxKind.WhileStatement: case SyntaxKind.IfStatement: case SyntaxKind.ForInStatement: - case SyntaxKind.ForOfStatement: return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]); // Set span on previous token if it starts on same line otherwise on the first statement of the block case SyntaxKind.ForStatement: + case SyntaxKind.ForOfStatement: return spanInNodeIfStartsOnSameLine(findPrecedingToken(block.pos, sourceFile, block.parent), block.statements[0]); } @@ -400,17 +490,23 @@ namespace ts.BreakpointResolver { return spanInNode(block.statements[0]); } + function spanInInitializerOfForLike(forLikeStatement: ForStatement | ForOfStatement | ForInStatement): TextSpan { + if (forLikeStatement.initializer.kind === SyntaxKind.VariableDeclarationList) { + // Declaration list - set breakpoint in first declaration + let variableDeclarationList = forLikeStatement.initializer; + if (variableDeclarationList.declarations.length > 0) { + return spanInNode(variableDeclarationList.declarations[0]); + } + } + else { + // Expression - set breakpoint in it + return spanInNode(forLikeStatement.initializer); + } + } + function spanInForStatement(forStatement: ForStatement): TextSpan { if (forStatement.initializer) { - if (forStatement.initializer.kind === SyntaxKind.VariableDeclarationList) { - let variableDeclarationList = forStatement.initializer; - if (variableDeclarationList.declarations.length > 0) { - return spanInNode(variableDeclarationList.declarations[0]); - } - } - else { - return spanInNode(forStatement.initializer); - } + return spanInInitializerOfForLike(forStatement); } if (forStatement.condition) { @@ -421,6 +517,45 @@ namespace ts.BreakpointResolver { } } + function spanInBindingPattern(bindingPattern: BindingPattern): TextSpan { + // Set breakpoint in first binding element + let firstBindingElement = forEach(bindingPattern.elements, + element => element.kind !== SyntaxKind.OmittedExpression ? element : undefined); + + if (firstBindingElement) { + return spanInNode(firstBindingElement); + } + + // Empty binding pattern of binding element, set breakpoint on binding element + if (bindingPattern.parent.kind === SyntaxKind.BindingElement) { + return textSpan(bindingPattern.parent); + } + + // Variable declaration is used as the span + return textSpanFromVariableDeclaration(bindingPattern.parent); + } + + function spanInArrayLiteralOrObjectLiteralDestructuringPattern(node: DestructuringPattern): TextSpan { + Debug.assert(node.kind !== SyntaxKind.ArrayBindingPattern && node.kind !== SyntaxKind.ObjectBindingPattern); + const elements: NodeArray = + node.kind === SyntaxKind.ArrayLiteralExpression ? + (node).elements : + (node).properties; + + const firstBindingElement = forEach(elements, + element => element.kind !== SyntaxKind.OmittedExpression ? element : undefined); + + if (firstBindingElement) { + return spanInNode(firstBindingElement); + } + + // Could be ArrayLiteral from destructuring assignment or + // just nested element in another destructuring assignment + // set breakpoint on assignment when parent is destructuring assignment + // Otherwise set breakpoint for this element + return textSpan(node.parent.kind === SyntaxKind.BinaryExpression ? node.parent : node); + } + // Tokens: function spanInOpenBraceToken(node: Node): TextSpan { switch (node.parent.kind) { @@ -443,7 +578,7 @@ namespace ts.BreakpointResolver { function spanInCloseBraceToken(node: Node): TextSpan { switch (node.parent.kind) { case SyntaxKind.ModuleBlock: - // If this is not instantiated module block no bp span + // If this is not an instantiated module block, no bp span if (getModuleInstanceState(node.parent.parent) !== ModuleInstanceState.Instantiated) { return undefined; } @@ -458,7 +593,7 @@ namespace ts.BreakpointResolver { // Span on close brace token return textSpan(node); } - // fall through. + // fall through case SyntaxKind.CatchClause: return spanInNode(lastOrUndefined((node.parent).statements)); @@ -472,18 +607,52 @@ namespace ts.BreakpointResolver { } return undefined; + case SyntaxKind.ObjectBindingPattern: + // Breakpoint in last binding element or binding pattern if it contains no elements + let bindingPattern = node.parent; + return spanInNode(lastOrUndefined(bindingPattern.elements) || bindingPattern); + // Default to parent node default: + if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent)) { + // Breakpoint in last binding element or binding pattern if it contains no elements + let objectLiteral = node.parent; + return textSpan(lastOrUndefined(objectLiteral.properties) || objectLiteral); + } + return spanInNode(node.parent); + } + } + + function spanInCloseBracketToken(node: Node): TextSpan { + switch (node.parent.kind) { + case SyntaxKind.ArrayBindingPattern: + // Breakpoint in last binding element or binding pattern if it contains no elements + let bindingPattern = node.parent; + return textSpan(lastOrUndefined(bindingPattern.elements) || bindingPattern); + + default: + if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent)) { + // Breakpoint in last binding element or binding pattern if it contains no elements + let arrayLiteral = node.parent; + return textSpan(lastOrUndefined(arrayLiteral.elements) || arrayLiteral); + } + + // Default to parent node return spanInNode(node.parent); } } function spanInOpenParenToken(node: Node): TextSpan { - if (node.parent.kind === SyntaxKind.DoStatement) { - // Go to while keyword and do action instead + if (node.parent.kind === SyntaxKind.DoStatement || // Go to while keyword and do action instead + node.parent.kind === SyntaxKind.CallExpression || + node.parent.kind === SyntaxKind.NewExpression) { return spanInPreviousNode(node); } + if (node.parent.kind === SyntaxKind.ParenthesizedExpression) { + return spanInNextNode(node); + } + // Default to parent node return spanInNode(node.parent); } @@ -502,6 +671,10 @@ namespace ts.BreakpointResolver { case SyntaxKind.WhileStatement: case SyntaxKind.DoStatement: case SyntaxKind.ForStatement: + case SyntaxKind.ForOfStatement: + case SyntaxKind.CallExpression: + case SyntaxKind.NewExpression: + case SyntaxKind.ParenthesizedExpression: return spanInPreviousNode(node); // Default to parent node @@ -512,7 +685,9 @@ namespace ts.BreakpointResolver { function spanInColonToken(node: Node): TextSpan { // Is this : specifying return annotation of the function declaration - if (isFunctionLike(node.parent) || node.parent.kind === SyntaxKind.PropertyAssignment) { + if (isFunctionLike(node.parent) || + node.parent.kind === SyntaxKind.PropertyAssignment || + node.parent.kind === SyntaxKind.Parameter) { return spanInPreviousNode(node); } @@ -521,7 +696,7 @@ namespace ts.BreakpointResolver { function spanInGreaterThanOrLessThanToken(node: Node): TextSpan { if (node.parent.kind === SyntaxKind.TypeAssertionExpression) { - return spanInNode((node.parent).expression); + return spanInNextNode(node); } return spanInNode(node.parent); @@ -530,7 +705,17 @@ namespace ts.BreakpointResolver { function spanInWhileKeyword(node: Node): TextSpan { if (node.parent.kind === SyntaxKind.DoStatement) { // Set span on while expression - return textSpan(node, findNextToken((node.parent).expression, node.parent)); + return textSpanEndingAtNextToken(node, (node.parent).expression); + } + + // Default to parent node + return spanInNode(node.parent); + } + + function spanInOfKeyword(node: Node): TextSpan { + if (node.parent.kind === SyntaxKind.ForOfStatement) { + // Set using next token + return spanInNextNode(node); } // Default to parent node @@ -538,4 +723,4 @@ namespace ts.BreakpointResolver { } } } -} \ No newline at end of file +} diff --git a/src/services/formatting/formatting.ts b/src/services/formatting/formatting.ts index 4e48a4bf4f2..20b20356907 100644 --- a/src/services/formatting/formatting.ts +++ b/src/services/formatting/formatting.ts @@ -20,13 +20,13 @@ namespace ts.formatting { Unknown = -1 } - /* + /* * Indentation for the scope that can be dynamically recomputed. - * i.e + * i.e * while(true) * { let x; * } - * Normally indentation is applied only to the first token in line so at glance 'var' should not be touched. + * Normally indentation is applied only to the first token in line so at glance 'var' should not be touched. * However if some format rule adds new line between '}' and 'var' 'var' will become * the first token in line so it should be indented */ @@ -48,15 +48,15 @@ namespace ts.formatting { * foo(bar({ * $ * })) - * Both 'foo', 'bar' introduce new indentation with delta = 4, but total indentation in $ is not 8. + * Both 'foo', 'bar' introduce new indentation with delta = 4, but total indentation in $ is not 8. * foo: { indentation: 0, delta: 4 } * bar: { indentation: foo.indentation + foo.delta = 4, delta: 4} however 'foo' and 'bar' are on the same line * so bar inherits indentation from foo and bar.delta will be 4 - * + * */ getDelta(child: TextRangeWithKind): number; /** - * Formatter calls this function when rule adds or deletes new lines from the text + * Formatter calls this function when rule adds or deletes new lines from the text * so indentation scope can adjust values of indentation and delta. */ recomputeIndentation(lineAddedByFormatting: boolean): void; @@ -72,12 +72,20 @@ namespace ts.formatting { if (line === 0) { return []; } - // get the span for the previous\current line + // After the enter key, the cursor is now at a new line. The new line may or may not contain non-whitespace characters. + // If the new line has only whitespaces, we won't want to format this line, because that would remove the indentation as + // trailing whitespaces. So the end of the formatting span should be the later one between: + // 1. the end of the previous line + // 2. the last non-whitespace character in the current line + let endOfFormatSpan = getEndLinePosition(line, sourceFile); + while (isWhiteSpace(sourceFile.text.charCodeAt(endOfFormatSpan)) && !isLineBreak(sourceFile.text.charCodeAt(endOfFormatSpan))) { + endOfFormatSpan--; + } let span = { // get start position for the previous line pos: getStartPositionOfLine(line - 1, sourceFile), - // get end position for the current line (end value is exclusive so add 1 to the result) - end: getEndLinePosition(line, sourceFile) + 1 + // end value is exclusive so add 1 to the result + end: endOfFormatSpan + 1 } return formatSpan(span, sourceFile, options, rulesProvider, FormattingRequestKind.FormatOnEnter); } @@ -121,10 +129,10 @@ namespace ts.formatting { function findOutermostParent(position: number, expectedTokenKind: SyntaxKind, sourceFile: SourceFile): Node { let precedingToken = findPrecedingToken(position, sourceFile); - - // when it is claimed that trigger character was typed at given position + + // when it is claimed that trigger character was typed at given position // we verify that there is a token with a matching kind whose end is equal to position (because the character was just typed). - // If this condition is not hold - then trigger character was typed in some other context, + // If this condition is not hold - then trigger character was typed in some other context, // i.e.in comment and thus should not trigger autoformatting if (!precedingToken || precedingToken.kind !== expectedTokenKind || @@ -134,12 +142,12 @@ namespace ts.formatting { // walk up and search for the parent node that ends at the same position with precedingToken. // for cases like this - // + // // let x = 1; // while (true) { - // } + // } // after typing close curly in while statement we want to reformat just the while statement. - // However if we just walk upwards searching for the parent that has the same end value - + // However if we just walk upwards searching for the parent that has the same end value - // we'll end up with the whole source file. isListElement allows to stop on the list element level let current = precedingToken; while (current && @@ -151,7 +159,7 @@ namespace ts.formatting { return current; } - + // Returns true if node is a element in some list in parent // i.e. parent is class declaration with the list of members and node is one of members. function isListElement(parent: Node, node: Node): boolean { @@ -198,7 +206,7 @@ namespace ts.formatting { if (!errors.length) { return rangeHasNoErrors; } - + // pick only errors that fall in range let sorted = errors .filter(d => rangeOverlapsWithStartEnd(originalRange, d.start, d.start + d.length)) @@ -215,7 +223,7 @@ namespace ts.formatting { // 'index' tracks the index of the most recent error that was checked. while (true) { if (index >= sorted.length) { - // all errors in the range were already checked -> no error in specified range + // all errors in the range were already checked -> no error in specified range return false; } @@ -241,7 +249,7 @@ namespace ts.formatting { /** * Start of the original range might fall inside the comment - scanner will not yield appropriate results - * This function will look for token that is located before the start of target range + * This function will look for token that is located before the start of target range * and return its end as start position for the scanner. */ function getScanStartPosition(enclosingNode: Node, originalRange: TextRange, sourceFile: SourceFile): number { @@ -256,7 +264,7 @@ namespace ts.formatting { return enclosingNode.pos; } - // preceding token ends after the start of original range (i.e when originaRange.pos falls in the middle of literal) + // preceding token ends after the start of original range (i.e when originalRange.pos falls in the middle of literal) // start from the beginning of enclosingNode to handle the entire 'originalRange' if (precedingToken.end >= originalRange.pos) { return enclosingNode.pos; @@ -266,7 +274,7 @@ namespace ts.formatting { } /* - * For cases like + * For cases like * if (a || * b ||$ * c) {...} @@ -276,8 +284,8 @@ namespace ts.formatting { * Initial indentation for this node will be 0. * Binary expressions don't introduce new indentation scopes, however it is possible * that some parent node on the same line does - like if statement in this case. - * Note that we are considering parents only from the same line with initial node - - * if parent is on the different line - its delta was already contributed + * Note that we are considering parents only from the same line with initial node - + * if parent is on the different line - its delta was already contributed * to the initial indentation. */ function getOwnOrInheritedDelta(n: Node, options: FormatCodeOptions, sourceFile: SourceFile): number { @@ -341,6 +349,14 @@ namespace ts.formatting { processNode(enclosingNode, enclosingNode, startLine, undecoratedStartLine, initialIndentation, delta); } + if (!formattingScanner.isOnToken()) { + let leadingTrivia = formattingScanner.getCurrentLeadingTrivia(); + if (leadingTrivia) { + processTrivia(leadingTrivia, enclosingNode, enclosingNode, undefined); + trimTrailingWhitespacesForRemainingRange(); + } + } + formattingScanner.close(); return edits; @@ -348,10 +364,10 @@ namespace ts.formatting { // local functions /** Tries to compute the indentation for a list element. - * If list element is not in range then - * function will pick its actual indentation + * If list element is not in range then + * function will pick its actual indentation * so it can be pushed downstream as inherited indentation. - * If list element is in the range - its indentation will be equal + * If list element is in the range - its indentation will be equal * to inherited indentation from its predecessors. */ function tryComputeIndentationForListItem(startPos: number, @@ -362,7 +378,7 @@ namespace ts.formatting { if (rangeOverlapsWithStartEnd(range, startPos, endPos) || rangeContainsStartEnd(range, startPos, endPos) /* Not to miss zero-range nodes e.g. JsxText */) { - + if (inheritedIndentation !== Constants.Unknown) { return inheritedIndentation; } @@ -513,12 +529,12 @@ namespace ts.formatting { // a useful observations when tracking context node // / // [a] - // / | \ + // / | \ // [b] [c] [d] - // node 'a' is a context node for nodes 'b', 'c', 'd' + // node 'a' is a context node for nodes 'b', 'c', 'd' // except for the leftmost leaf token in [b] - in this case context node ('e') is located somewhere above 'a' // this rule can be applied recursively to child nodes of 'a'. - // + // // context node is set to parent node value after processing every child node // context node is set to parent of the token after processing every token @@ -551,7 +567,8 @@ namespace ts.formatting { parentDynamicIndentation: DynamicIndentation, parentStartLine: number, undecoratedParentStartLine: number, - isListItem: boolean): number { + isListItem: boolean, + isFirstListItem?: boolean): number { let childStartPos = child.getStart(sourceFile); @@ -610,6 +627,10 @@ namespace ts.formatting { childContextNode = node; + if (isFirstListItem && parent.kind === SyntaxKind.ArrayLiteralExpression && inheritedIndentation === Constants.Unknown) { + inheritedIndentation = childIndentation.indentation; + } + return inheritedIndentation; } @@ -649,8 +670,9 @@ namespace ts.formatting { } let inheritedIndentation = Constants.Unknown; - for (let child of nodes) { - inheritedIndentation = processChildNode(child, inheritedIndentation, node, listDynamicIndentation, startLine, startLine, /*isListElement*/ true) + for (let i = 0; i < nodes.length; i++) { + const child = nodes[i]; + inheritedIndentation = processChildNode(child, inheritedIndentation, node, listDynamicIndentation, startLine, startLine, /*isListElement*/ true, /*isFirstListItem*/ i === 0); } if (listEndToken !== SyntaxKind.Unknown) { @@ -658,7 +680,7 @@ namespace ts.formatting { let tokenInfo = formattingScanner.readTokenInfo(parent); // consume the list end token only if it is still belong to the parent // there might be the case when current token matches end token but does not considered as one - // function (x: function) <-- + // function (x: function) <-- // without this check close paren will be interpreted as list end token for function expression which is wrong if (tokenInfo.token.kind === listEndToken && rangeContainsRange(parent, tokenInfo.token)) { // consume list end token @@ -712,25 +734,24 @@ namespace ts.formatting { dynamicIndentation.getIndentationForToken(tokenStart.line, currentTokenInfo.token.kind, container) : Constants.Unknown; + let indentNextTokenOrTrivia = true; if (currentTokenInfo.leadingTrivia) { let commentIndentation = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind, tokenIndentation, container); - let indentNextTokenOrTrivia = true; for (let triviaItem of currentTokenInfo.leadingTrivia) { - if (!rangeContainsRange(originalRange, triviaItem)) { - continue; - } - + const triviaInRange = rangeContainsRange(originalRange, triviaItem); switch (triviaItem.kind) { case SyntaxKind.MultiLineCommentTrivia: - indentMultilineComment(triviaItem, commentIndentation, /*firstLineIsIndented*/ !indentNextTokenOrTrivia); + if (triviaInRange) { + indentMultilineComment(triviaItem, commentIndentation, /*firstLineIsIndented*/ !indentNextTokenOrTrivia); + } indentNextTokenOrTrivia = false; break; case SyntaxKind.SingleLineCommentTrivia: - if (indentNextTokenOrTrivia) { + if (indentNextTokenOrTrivia && triviaInRange) { insertIndentation(triviaItem.pos, commentIndentation, /*lineAdded*/ false); - indentNextTokenOrTrivia = false; } + indentNextTokenOrTrivia = false; break; case SyntaxKind.NewLineTrivia: indentNextTokenOrTrivia = true; @@ -740,7 +761,7 @@ namespace ts.formatting { } // indent token only if is it is in target range and does not overlap with any error ranges - if (tokenIndentation !== Constants.Unknown) { + if (tokenIndentation !== Constants.Unknown && indentNextTokenOrTrivia) { insertIndentation(currentTokenInfo.token.pos, tokenIndentation, lineAdded); lastIndentedLine = tokenStart.line; @@ -811,7 +832,7 @@ namespace ts.formatting { if (rule.Operation.Action & (RuleAction.Space | RuleAction.Delete) && currentStartLine !== previousStartLine) { lineAdded = false; - // Handle the case where the next line is moved to be the end of this line. + // Handle the case where the next line is moved to be the end of this line. // In this case we don't indent the next line in the next pass. if (currentParent.getStart(sourceFile) === currentItem.pos) { dynamicIndentation.recomputeIndentation(/*lineAdded*/ false); @@ -819,7 +840,7 @@ namespace ts.formatting { } else if (rule.Operation.Action & RuleAction.NewLine && currentStartLine === previousStartLine) { lineAdded = true; - // Handle the case where token2 is moved to the new line. + // Handle the case where token2 is moved to the new line. // In this case we indent token2 in the next pass but we set // sameLineIndent flag to notify the indenter that the indentation is within the line. if (currentParent.getStart(sourceFile) === currentItem.pos) { @@ -828,9 +849,7 @@ namespace ts.formatting { } // We need to trim trailing whitespace between the tokens if they were on different lines, and no rule was applied to put them on the same line - trimTrailingWhitespaces = - (rule.Operation.Action & (RuleAction.NewLine | RuleAction.Space)) && - rule.Flag !== RuleFlags.CanDeleteNewLines; + trimTrailingWhitespaces = !(rule.Operation.Action & RuleAction.Delete) && rule.Flag !== RuleFlags.CanDeleteNewLines; } else { trimTrailingWhitespaces = true; @@ -853,13 +872,17 @@ namespace ts.formatting { } else { let tokenStart = sourceFile.getLineAndCharacterOfPosition(pos); - if (indentation !== tokenStart.character) { - let startLinePosition = getStartPositionOfLine(tokenStart.line, sourceFile); + let startLinePosition = getStartPositionOfLine(tokenStart.line, sourceFile); + if (indentation !== tokenStart.character || indentationIsDifferent(indentationString, startLinePosition)) { recordReplace(startLinePosition, tokenStart.character, indentationString); } } } + function indentationIsDifferent(indentationString: string, startLinePosition: number): boolean { + return indentationString !== sourceFile.text.substr(startLinePosition , indentationString.length); + } + function indentMultilineComment(commentRange: TextRange, indentation: number, firstLineIsIndented: boolean) { // split comment in lines let startLine = sourceFile.getLineAndCharacterOfPosition(commentRange.pos).line; @@ -929,17 +952,41 @@ namespace ts.formatting { continue; } - let pos = lineEndPosition; - while (pos >= lineStartPosition && isWhiteSpace(sourceFile.text.charCodeAt(pos))) { - pos--; - } - if (pos !== lineEndPosition) { - Debug.assert(pos === lineStartPosition || !isWhiteSpace(sourceFile.text.charCodeAt(pos))); - recordDelete(pos + 1, lineEndPosition - pos); + let whitespaceStart = getTrailingWhitespaceStartPosition(lineStartPosition, lineEndPosition); + if (whitespaceStart !== -1) { + Debug.assert(whitespaceStart === lineStartPosition || !isWhiteSpace(sourceFile.text.charCodeAt(whitespaceStart - 1))); + recordDelete(whitespaceStart, lineEndPosition + 1 - whitespaceStart); } } } + /** + * @param start The position of the first character in range + * @param end The position of the last character in range + */ + function getTrailingWhitespaceStartPosition(start: number, end: number) { + let pos = end; + while (pos >= start && isWhiteSpace(sourceFile.text.charCodeAt(pos))) { + pos--; + } + if (pos !== end) { + return pos + 1; + } + return -1; + } + + /** + * Trimming will be done for lines after the previous range + */ + function trimTrailingWhitespacesForRemainingRange() { + let startPosition = previousRange ? previousRange.end : originalRange.pos; + + let startLine = sourceFile.getLineAndCharacterOfPosition(startPosition).line; + let endLine = sourceFile.getLineAndCharacterOfPosition(originalRange.end).line; + + trimTrailingWhitespacesForLines(startLine, endLine + 1, previousRange); + } + function newTextChange(start: number, len: number, newText: string): TextChange { return { span: createTextSpan(start, len), newText } } @@ -1115,4 +1162,4 @@ namespace ts.formatting { return s; } } -} \ No newline at end of file +} diff --git a/src/services/formatting/formattingScanner.ts b/src/services/formatting/formattingScanner.ts index 58e2f304482..5b869f12096 100644 --- a/src/services/formatting/formattingScanner.ts +++ b/src/services/formatting/formattingScanner.ts @@ -5,21 +5,22 @@ namespace ts.formatting { const standardScanner = createScanner(ScriptTarget.Latest, /*skipTrivia*/ false, LanguageVariant.Standard); const jsxScanner = createScanner(ScriptTarget.Latest, /*skipTrivia*/ false, LanguageVariant.JSX); - + /** * Scanner that is currently used for formatting */ let scanner: Scanner; - + export interface FormattingScanner { advance(): void; isOnToken(): boolean; readTokenInfo(n: Node): TokenInfo; + getCurrentLeadingTrivia(): TextRangeWithKind[]; lastTrailingTriviaWasNewLine(): boolean; close(): void; } - const enum ScanAction{ + const enum ScanAction { Scan, RescanGreaterThanToken, RescanSlashToken, @@ -37,19 +38,20 @@ namespace ts.formatting { let wasNewLine: boolean = true; let leadingTrivia: TextRangeWithKind[]; let trailingTrivia: TextRangeWithKind[]; - + let savedPos: number; let lastScanAction: ScanAction; let lastTokenInfo: TokenInfo; return { - advance: advance, - readTokenInfo: readTokenInfo, - isOnToken: isOnToken, + advance, + readTokenInfo, + isOnToken, + getCurrentLeadingTrivia: () => leadingTrivia, lastTrailingTriviaWasNewLine: () => wasNewLine, close: () => { Debug.assert(scanner !== undefined); - + lastTokenInfo = undefined; scanner.setText(undefined); scanner = undefined; @@ -58,7 +60,7 @@ namespace ts.formatting { function advance(): void { Debug.assert(scanner !== undefined); - + lastTokenInfo = undefined; let isStarted = scanner.getStartPos() !== startPos; @@ -81,7 +83,7 @@ namespace ts.formatting { let t: SyntaxKind; let pos = scanner.getStartPos(); - + // Read leading trivia and token while (pos < endPos) { let t = scanner.getToken(); @@ -122,10 +124,10 @@ namespace ts.formatting { return false; } - + function shouldRescanJsxIdentifier(node: Node): boolean { if (node.parent) { - switch(node.parent.kind) { + switch (node.parent.kind) { case SyntaxKind.JsxAttribute: case SyntaxKind.JsxOpeningElement: case SyntaxKind.JsxClosingElement: @@ -133,7 +135,7 @@ namespace ts.formatting { return node.kind === SyntaxKind.Identifier; } } - + return false; } @@ -142,7 +144,7 @@ namespace ts.formatting { } function shouldRescanTemplateToken(container: Node): boolean { - return container.kind === SyntaxKind.TemplateMiddle || + return container.kind === SyntaxKind.TemplateMiddle || container.kind === SyntaxKind.TemplateTail; } @@ -152,11 +154,11 @@ namespace ts.formatting { function readTokenInfo(n: Node): TokenInfo { Debug.assert(scanner !== undefined); - + if (!isOnToken()) { // scanner is not on the token (either advance was not called yet or scanner is already past the end position) return { - leadingTrivia: leadingTrivia, + leadingTrivia, trailingTrivia: undefined, token: undefined }; @@ -164,7 +166,7 @@ namespace ts.formatting { // normally scanner returns the smallest available token // check the kind of context node to determine if scanner should have more greedy behavior and consume more text. - let expectedScanAction = + let expectedScanAction = shouldRescanGreaterThanToken(n) ? ScanAction.RescanGreaterThanToken : shouldRescanSlashToken(n) @@ -179,7 +181,7 @@ namespace ts.formatting { // readTokenInfo was called before with the same expected scan action. // No need to re-scan text, return existing 'lastTokenInfo' // it is ok to call fixTokenKind here since it does not affect - // what portion of text is consumed. In opposize rescanning can change it, + // what portion of text is consumed. In contrast rescanning can change it, // i.e. for '>=' when originally scanner eats just one character // and rescanning forces it to consume more. return fixTokenKind(lastTokenInfo, n); @@ -226,7 +228,7 @@ namespace ts.formatting { if (trailingTrivia) { trailingTrivia = undefined; } - while(scanner.getStartPos() < endPos) { + while (scanner.getStartPos() < endPos) { currentToken = scanner.scan(); if (!isTrivia(currentToken)) { break; @@ -261,7 +263,7 @@ namespace ts.formatting { function isOnToken(): boolean { Debug.assert(scanner !== undefined); - + let current = (lastTokenInfo && lastTokenInfo.token.kind) || scanner.getToken(); let startPos = (lastTokenInfo && lastTokenInfo.token.pos) || scanner.getStartPos(); return startPos < endPos && current !== SyntaxKind.EndOfFileToken && !isTrivia(current); diff --git a/src/services/formatting/rules.ts b/src/services/formatting/rules.ts index de4761f57d2..afcaad28560 100644 --- a/src/services/formatting/rules.ts +++ b/src/services/formatting/rules.ts @@ -219,9 +219,11 @@ namespace ts.formatting { public SpaceBetweenAsyncAndFunctionKeyword: Rule; // Template strings - public SpaceBetweenTagAndTemplateString: Rule; + public NoSpaceBetweenTagAndTemplateString: Rule; public NoSpaceAfterTemplateHeadAndMiddle: Rule; + public SpaceAfterTemplateHeadAndMiddle: Rule; public NoSpaceBeforeTemplateMiddleAndTail: Rule; + public SpaceBeforeTemplateMiddleAndTail: Rule; constructor() { /// @@ -233,29 +235,29 @@ namespace ts.formatting { this.IgnoreAfterLineComment = new Rule(RuleDescriptor.create3(SyntaxKind.SingleLineCommentTrivia, Shared.TokenRange.Any), RuleOperation.create1(RuleAction.Ignore)); // Space after keyword but not before ; or : or ? - this.NoSpaceBeforeSemicolon = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.SemicolonToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete)); - this.NoSpaceBeforeColon = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.ColonToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), RuleAction.Delete)); - this.NoSpaceBeforeQuestionMark = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.QuestionToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), RuleAction.Delete)); - this.SpaceAfterColon = new Rule(RuleDescriptor.create3(SyntaxKind.ColonToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), RuleAction.Space)); - this.SpaceAfterQuestionMarkInConditionalOperator = new Rule(RuleDescriptor.create3(SyntaxKind.QuestionToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsConditionalOperatorContext), RuleAction.Space)); - this.NoSpaceAfterQuestionMark = new Rule(RuleDescriptor.create3(SyntaxKind.QuestionToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete)); - this.SpaceAfterSemicolon = new Rule(RuleDescriptor.create3(SyntaxKind.SemicolonToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space)); + this.NoSpaceBeforeSemicolon = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.SemicolonToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete)); + this.NoSpaceBeforeColon = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.ColonToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotBinaryOpContext), RuleAction.Delete)); + this.NoSpaceBeforeQuestionMark = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.QuestionToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotBinaryOpContext), RuleAction.Delete)); + this.SpaceAfterColon = new Rule(RuleDescriptor.create3(SyntaxKind.ColonToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotBinaryOpContext), RuleAction.Space)); + this.SpaceAfterQuestionMarkInConditionalOperator = new Rule(RuleDescriptor.create3(SyntaxKind.QuestionToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsConditionalOperatorContext), RuleAction.Space)); + this.NoSpaceAfterQuestionMark = new Rule(RuleDescriptor.create3(SyntaxKind.QuestionToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete)); + this.SpaceAfterSemicolon = new Rule(RuleDescriptor.create3(SyntaxKind.SemicolonToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Space)); // Space after }. - this.SpaceAfterCloseBrace = new Rule(RuleDescriptor.create3(SyntaxKind.CloseBraceToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsAfterCodeBlockContext), RuleAction.Space)); + this.SpaceAfterCloseBrace = new Rule(RuleDescriptor.create3(SyntaxKind.CloseBraceToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsAfterCodeBlockContext), RuleAction.Space)); // Special case for (}, else) and (}, while) since else & while tokens are not part of the tree which makes SpaceAfterCloseBrace rule not applied - this.SpaceBetweenCloseBraceAndElse = new Rule(RuleDescriptor.create1(SyntaxKind.CloseBraceToken, SyntaxKind.ElseKeyword), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space)); - this.SpaceBetweenCloseBraceAndWhile = new Rule(RuleDescriptor.create1(SyntaxKind.CloseBraceToken, SyntaxKind.WhileKeyword), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space)); - this.NoSpaceAfterCloseBrace = new Rule(RuleDescriptor.create3(SyntaxKind.CloseBraceToken, Shared.TokenRange.FromTokens([SyntaxKind.CloseParenToken, SyntaxKind.CloseBracketToken, SyntaxKind.CommaToken, SyntaxKind.SemicolonToken])), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete)); + this.SpaceBetweenCloseBraceAndElse = new Rule(RuleDescriptor.create1(SyntaxKind.CloseBraceToken, SyntaxKind.ElseKeyword), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Space)); + this.SpaceBetweenCloseBraceAndWhile = new Rule(RuleDescriptor.create1(SyntaxKind.CloseBraceToken, SyntaxKind.WhileKeyword), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Space)); + this.NoSpaceAfterCloseBrace = new Rule(RuleDescriptor.create3(SyntaxKind.CloseBraceToken, Shared.TokenRange.FromTokens([SyntaxKind.CloseParenToken, SyntaxKind.CloseBracketToken, SyntaxKind.CommaToken, SyntaxKind.SemicolonToken])), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete)); // No space for dot - this.NoSpaceBeforeDot = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.DotToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete)); - this.NoSpaceAfterDot = new Rule(RuleDescriptor.create3(SyntaxKind.DotToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete)); + this.NoSpaceBeforeDot = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.DotToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete)); + this.NoSpaceAfterDot = new Rule(RuleDescriptor.create3(SyntaxKind.DotToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete)); // No space before and after indexer - this.NoSpaceBeforeOpenBracket = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.OpenBracketToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete)); - this.NoSpaceAfterCloseBracket = new Rule(RuleDescriptor.create3(SyntaxKind.CloseBracketToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBeforeBlockInFunctionDeclarationContext), RuleAction.Delete)); + this.NoSpaceBeforeOpenBracket = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.OpenBracketToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete)); + this.NoSpaceAfterCloseBracket = new Rule(RuleDescriptor.create3(SyntaxKind.CloseBracketToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotBeforeBlockInFunctionDeclarationContext), RuleAction.Delete)); // Place a space before open brace in a function declaration this.FunctionOpenBraceLeftTokenRange = Shared.TokenRange.AnyIncludingMultilineComments; @@ -272,7 +274,7 @@ namespace ts.formatting { // Insert a space after { and before } in single-line contexts, but remove space from empty object literals {}. this.SpaceAfterOpenBrace = new Rule(RuleDescriptor.create3(SyntaxKind.OpenBraceToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSingleLineBlockContext), RuleAction.Space)); this.SpaceBeforeCloseBrace = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.CloseBraceToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSingleLineBlockContext), RuleAction.Space)); - this.NoSpaceBetweenEmptyBraceBrackets = new Rule(RuleDescriptor.create1(SyntaxKind.OpenBraceToken, SyntaxKind.CloseBraceToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsObjectContext), RuleAction.Delete)); + this.NoSpaceBetweenEmptyBraceBrackets = new Rule(RuleDescriptor.create1(SyntaxKind.OpenBraceToken, SyntaxKind.CloseBraceToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsObjectContext), RuleAction.Delete)); // Insert new line after { and before } in multi-line contexts. this.NewLineAfterOpenBraceInBlockContext = new Rule(RuleDescriptor.create3(SyntaxKind.OpenBraceToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsMultilineBlockContext), RuleAction.NewLine)); @@ -283,102 +285,100 @@ namespace ts.formatting { // Special handling of unary operators. // Prefix operators generally shouldn't have a space between // them and their target unary expression. - this.NoSpaceAfterUnaryPrefixOperator = new Rule(RuleDescriptor.create4(Shared.TokenRange.UnaryPrefixOperators, Shared.TokenRange.UnaryPrefixExpressions), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), RuleAction.Delete)); - this.NoSpaceAfterUnaryPreincrementOperator = new Rule(RuleDescriptor.create3(SyntaxKind.PlusPlusToken, Shared.TokenRange.UnaryPreincrementExpressions), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete)); - this.NoSpaceAfterUnaryPredecrementOperator = new Rule(RuleDescriptor.create3(SyntaxKind.MinusMinusToken, Shared.TokenRange.UnaryPredecrementExpressions), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete)); - this.NoSpaceBeforeUnaryPostincrementOperator = new Rule(RuleDescriptor.create2(Shared.TokenRange.UnaryPostincrementExpressions, SyntaxKind.PlusPlusToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete)); - this.NoSpaceBeforeUnaryPostdecrementOperator = new Rule(RuleDescriptor.create2(Shared.TokenRange.UnaryPostdecrementExpressions, SyntaxKind.MinusMinusToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete)); + this.NoSpaceAfterUnaryPrefixOperator = new Rule(RuleDescriptor.create4(Shared.TokenRange.UnaryPrefixOperators, Shared.TokenRange.UnaryPrefixExpressions), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotBinaryOpContext), RuleAction.Delete)); + this.NoSpaceAfterUnaryPreincrementOperator = new Rule(RuleDescriptor.create3(SyntaxKind.PlusPlusToken, Shared.TokenRange.UnaryPreincrementExpressions), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete)); + this.NoSpaceAfterUnaryPredecrementOperator = new Rule(RuleDescriptor.create3(SyntaxKind.MinusMinusToken, Shared.TokenRange.UnaryPredecrementExpressions), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete)); + this.NoSpaceBeforeUnaryPostincrementOperator = new Rule(RuleDescriptor.create2(Shared.TokenRange.UnaryPostincrementExpressions, SyntaxKind.PlusPlusToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete)); + this.NoSpaceBeforeUnaryPostdecrementOperator = new Rule(RuleDescriptor.create2(Shared.TokenRange.UnaryPostdecrementExpressions, SyntaxKind.MinusMinusToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete)); // More unary operator special-casing. // DevDiv 181814: Be careful when removing leading whitespace // around unary operators. Examples: // 1 - -2 --X--> 1--2 // a + ++b --X--> a+++b - this.SpaceAfterPostincrementWhenFollowedByAdd = new Rule(RuleDescriptor.create1(SyntaxKind.PlusPlusToken, SyntaxKind.PlusToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), RuleAction.Space)); - this.SpaceAfterAddWhenFollowedByUnaryPlus = new Rule(RuleDescriptor.create1(SyntaxKind.PlusToken, SyntaxKind.PlusToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), RuleAction.Space)); - this.SpaceAfterAddWhenFollowedByPreincrement = new Rule(RuleDescriptor.create1(SyntaxKind.PlusToken, SyntaxKind.PlusPlusToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), RuleAction.Space)); - this.SpaceAfterPostdecrementWhenFollowedBySubtract = new Rule(RuleDescriptor.create1(SyntaxKind.MinusMinusToken, SyntaxKind.MinusToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), RuleAction.Space)); - this.SpaceAfterSubtractWhenFollowedByUnaryMinus = new Rule(RuleDescriptor.create1(SyntaxKind.MinusToken, SyntaxKind.MinusToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), RuleAction.Space)); - this.SpaceAfterSubtractWhenFollowedByPredecrement = new Rule(RuleDescriptor.create1(SyntaxKind.MinusToken, SyntaxKind.MinusMinusToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), RuleAction.Space)); + this.SpaceAfterPostincrementWhenFollowedByAdd = new Rule(RuleDescriptor.create1(SyntaxKind.PlusPlusToken, SyntaxKind.PlusToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), RuleAction.Space)); + this.SpaceAfterAddWhenFollowedByUnaryPlus = new Rule(RuleDescriptor.create1(SyntaxKind.PlusToken, SyntaxKind.PlusToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), RuleAction.Space)); + this.SpaceAfterAddWhenFollowedByPreincrement = new Rule(RuleDescriptor.create1(SyntaxKind.PlusToken, SyntaxKind.PlusPlusToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), RuleAction.Space)); + this.SpaceAfterPostdecrementWhenFollowedBySubtract = new Rule(RuleDescriptor.create1(SyntaxKind.MinusMinusToken, SyntaxKind.MinusToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), RuleAction.Space)); + this.SpaceAfterSubtractWhenFollowedByUnaryMinus = new Rule(RuleDescriptor.create1(SyntaxKind.MinusToken, SyntaxKind.MinusToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), RuleAction.Space)); + this.SpaceAfterSubtractWhenFollowedByPredecrement = new Rule(RuleDescriptor.create1(SyntaxKind.MinusToken, SyntaxKind.MinusMinusToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), RuleAction.Space)); - this.NoSpaceBeforeComma = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.CommaToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete)); + this.NoSpaceBeforeComma = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.CommaToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete)); - this.SpaceAfterCertainKeywords = new Rule(RuleDescriptor.create4(Shared.TokenRange.FromTokens([SyntaxKind.VarKeyword, SyntaxKind.ThrowKeyword, SyntaxKind.NewKeyword, SyntaxKind.DeleteKeyword, SyntaxKind.ReturnKeyword, SyntaxKind.TypeOfKeyword, SyntaxKind.AwaitKeyword]), Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space)); - this.SpaceAfterLetConstInVariableDeclaration = new Rule(RuleDescriptor.create4(Shared.TokenRange.FromTokens([SyntaxKind.LetKeyword, SyntaxKind.ConstKeyword]), Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsStartOfVariableDeclarationList), RuleAction.Space)); - this.NoSpaceBeforeOpenParenInFuncCall = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsFunctionCallOrNewContext, Rules.IsPreviousTokenNotComma), RuleAction.Delete)); + this.SpaceAfterCertainKeywords = new Rule(RuleDescriptor.create4(Shared.TokenRange.FromTokens([SyntaxKind.VarKeyword, SyntaxKind.ThrowKeyword, SyntaxKind.NewKeyword, SyntaxKind.DeleteKeyword, SyntaxKind.ReturnKeyword, SyntaxKind.TypeOfKeyword, SyntaxKind.AwaitKeyword]), Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Space)); + this.SpaceAfterLetConstInVariableDeclaration = new Rule(RuleDescriptor.create4(Shared.TokenRange.FromTokens([SyntaxKind.LetKeyword, SyntaxKind.ConstKeyword]), Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsStartOfVariableDeclarationList), RuleAction.Space)); + this.NoSpaceBeforeOpenParenInFuncCall = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsFunctionCallOrNewContext, Rules.IsPreviousTokenNotComma), RuleAction.Delete)); this.SpaceAfterFunctionInFuncDecl = new Rule(RuleDescriptor.create3(SyntaxKind.FunctionKeyword, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsFunctionDeclContext), RuleAction.Space)); - this.NoSpaceBeforeOpenParenInFuncDecl = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsFunctionDeclContext), RuleAction.Delete)); - this.SpaceAfterVoidOperator = new Rule(RuleDescriptor.create3(SyntaxKind.VoidKeyword, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsVoidOpContext), RuleAction.Space)); + this.NoSpaceBeforeOpenParenInFuncDecl = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsFunctionDeclContext), RuleAction.Delete)); + this.SpaceAfterVoidOperator = new Rule(RuleDescriptor.create3(SyntaxKind.VoidKeyword, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsVoidOpContext), RuleAction.Space)); - this.NoSpaceBetweenReturnAndSemicolon = new Rule(RuleDescriptor.create1(SyntaxKind.ReturnKeyword, SyntaxKind.SemicolonToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete)); + this.NoSpaceBetweenReturnAndSemicolon = new Rule(RuleDescriptor.create1(SyntaxKind.ReturnKeyword, SyntaxKind.SemicolonToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete)); // Add a space between statements. All keywords except (do,else,case) has open/close parens after them. // So, we have a rule to add a space for [),Any], [do,Any], [else,Any], and [case,Any] - this.SpaceBetweenStatements = new Rule(RuleDescriptor.create4(Shared.TokenRange.FromTokens([SyntaxKind.CloseParenToken, SyntaxKind.DoKeyword, SyntaxKind.ElseKeyword, SyntaxKind.CaseKeyword]), Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotForContext), RuleAction.Space)); + this.SpaceBetweenStatements = new Rule(RuleDescriptor.create4(Shared.TokenRange.FromTokens([SyntaxKind.CloseParenToken, SyntaxKind.DoKeyword, SyntaxKind.ElseKeyword, SyntaxKind.CaseKeyword]), Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotForContext), RuleAction.Space)); // This low-pri rule takes care of "try {" and "finally {" in case the rule SpaceBeforeOpenBraceInControl didn't execute on FormatOnEnter. - this.SpaceAfterTryFinally = new Rule(RuleDescriptor.create2(Shared.TokenRange.FromTokens([SyntaxKind.TryKeyword, SyntaxKind.FinallyKeyword]), SyntaxKind.OpenBraceToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space)); + this.SpaceAfterTryFinally = new Rule(RuleDescriptor.create2(Shared.TokenRange.FromTokens([SyntaxKind.TryKeyword, SyntaxKind.FinallyKeyword]), SyntaxKind.OpenBraceToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Space)); // get x() {} // set x(val) {} this.SpaceAfterGetSetInMember = new Rule(RuleDescriptor.create2(Shared.TokenRange.FromTokens([SyntaxKind.GetKeyword, SyntaxKind.SetKeyword]), SyntaxKind.Identifier), RuleOperation.create2(new RuleOperationContext(Rules.IsFunctionDeclContext), RuleAction.Space)); // Special case for binary operators (that are keywords). For these we have to add a space and shouldn't follow any user options. - this.SpaceBeforeBinaryKeywordOperator = new Rule(RuleDescriptor.create4(Shared.TokenRange.Any, Shared.TokenRange.BinaryKeywordOperators), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), RuleAction.Space)); - this.SpaceAfterBinaryKeywordOperator = new Rule(RuleDescriptor.create4(Shared.TokenRange.BinaryKeywordOperators, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), RuleAction.Space)); + this.SpaceBeforeBinaryKeywordOperator = new Rule(RuleDescriptor.create4(Shared.TokenRange.Any, Shared.TokenRange.BinaryKeywordOperators), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), RuleAction.Space)); + this.SpaceAfterBinaryKeywordOperator = new Rule(RuleDescriptor.create4(Shared.TokenRange.BinaryKeywordOperators, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), RuleAction.Space)); // TypeScript-specific higher priority rules // Treat constructor as an identifier in a function declaration, and remove spaces between constructor and following left parentheses - this.NoSpaceAfterConstructor = new Rule(RuleDescriptor.create1(SyntaxKind.ConstructorKeyword, SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete)); + this.NoSpaceAfterConstructor = new Rule(RuleDescriptor.create1(SyntaxKind.ConstructorKeyword, SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete)); // Use of module as a function call. e.g.: import m2 = module("m2"); - this.NoSpaceAfterModuleImport = new Rule(RuleDescriptor.create2(Shared.TokenRange.FromTokens([SyntaxKind.ModuleKeyword, SyntaxKind.RequireKeyword]), SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete)); + this.NoSpaceAfterModuleImport = new Rule(RuleDescriptor.create2(Shared.TokenRange.FromTokens([SyntaxKind.ModuleKeyword, SyntaxKind.RequireKeyword]), SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete)); // Add a space around certain TypeScript keywords - this.SpaceAfterCertainTypeScriptKeywords = new Rule(RuleDescriptor.create4(Shared.TokenRange.FromTokens([SyntaxKind.AbstractKeyword, SyntaxKind.ClassKeyword, SyntaxKind.DeclareKeyword, SyntaxKind.DefaultKeyword, SyntaxKind.EnumKeyword, SyntaxKind.ExportKeyword, SyntaxKind.ExtendsKeyword, SyntaxKind.GetKeyword, SyntaxKind.ImplementsKeyword, SyntaxKind.ImportKeyword, SyntaxKind.InterfaceKeyword, SyntaxKind.ModuleKeyword, SyntaxKind.NamespaceKeyword, SyntaxKind.PrivateKeyword, SyntaxKind.PublicKeyword, SyntaxKind.ProtectedKeyword, SyntaxKind.SetKeyword, SyntaxKind.StaticKeyword, SyntaxKind.TypeKeyword]), Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space)); - this.SpaceBeforeCertainTypeScriptKeywords = new Rule(RuleDescriptor.create4(Shared.TokenRange.Any, Shared.TokenRange.FromTokens([SyntaxKind.ExtendsKeyword, SyntaxKind.ImplementsKeyword])), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space)); + this.SpaceAfterCertainTypeScriptKeywords = new Rule(RuleDescriptor.create4(Shared.TokenRange.FromTokens([SyntaxKind.AbstractKeyword, SyntaxKind.ClassKeyword, SyntaxKind.DeclareKeyword, SyntaxKind.DefaultKeyword, SyntaxKind.EnumKeyword, SyntaxKind.ExportKeyword, SyntaxKind.ExtendsKeyword, SyntaxKind.GetKeyword, SyntaxKind.ImplementsKeyword, SyntaxKind.ImportKeyword, SyntaxKind.InterfaceKeyword, SyntaxKind.ModuleKeyword, SyntaxKind.NamespaceKeyword, SyntaxKind.PrivateKeyword, SyntaxKind.PublicKeyword, SyntaxKind.ProtectedKeyword, SyntaxKind.SetKeyword, SyntaxKind.StaticKeyword, SyntaxKind.TypeKeyword]), Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Space)); + this.SpaceBeforeCertainTypeScriptKeywords = new Rule(RuleDescriptor.create4(Shared.TokenRange.Any, Shared.TokenRange.FromTokens([SyntaxKind.ExtendsKeyword, SyntaxKind.ImplementsKeyword])), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Space)); // Treat string literals in module names as identifiers, and add a space between the literal and the opening Brace braces, e.g.: module "m2" { this.SpaceAfterModuleName = new Rule(RuleDescriptor.create1(SyntaxKind.StringLiteral, SyntaxKind.OpenBraceToken), RuleOperation.create2(new RuleOperationContext(Rules.IsModuleDeclContext), RuleAction.Space)); // Lambda expressions - this.SpaceBeforeArrow = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.EqualsGreaterThanToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space)); - this.SpaceAfterArrow = new Rule(RuleDescriptor.create3(SyntaxKind.EqualsGreaterThanToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space)); + this.SpaceBeforeArrow = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.EqualsGreaterThanToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Space)); + this.SpaceAfterArrow = new Rule(RuleDescriptor.create3(SyntaxKind.EqualsGreaterThanToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Space)); // Optional parameters and let args - this.NoSpaceAfterEllipsis = new Rule(RuleDescriptor.create1(SyntaxKind.DotDotDotToken, SyntaxKind.Identifier), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete)); - this.NoSpaceAfterOptionalParameters = new Rule(RuleDescriptor.create3(SyntaxKind.QuestionToken, Shared.TokenRange.FromTokens([SyntaxKind.CloseParenToken, SyntaxKind.CommaToken])), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), RuleAction.Delete)); + this.NoSpaceAfterEllipsis = new Rule(RuleDescriptor.create1(SyntaxKind.DotDotDotToken, SyntaxKind.Identifier), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete)); + this.NoSpaceAfterOptionalParameters = new Rule(RuleDescriptor.create3(SyntaxKind.QuestionToken, Shared.TokenRange.FromTokens([SyntaxKind.CloseParenToken, SyntaxKind.CommaToken])), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotBinaryOpContext), RuleAction.Delete)); // generics and type assertions - this.NoSpaceBeforeOpenAngularBracket = new Rule(RuleDescriptor.create2(Shared.TokenRange.TypeNames, SyntaxKind.LessThanToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), RuleAction.Delete)); - this.NoSpaceBetweenCloseParenAndAngularBracket = new Rule(RuleDescriptor.create1(SyntaxKind.CloseParenToken, SyntaxKind.LessThanToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), RuleAction.Delete)); - this.NoSpaceAfterOpenAngularBracket = new Rule(RuleDescriptor.create3(SyntaxKind.LessThanToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), RuleAction.Delete)); - this.NoSpaceBeforeCloseAngularBracket = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.GreaterThanToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), RuleAction.Delete)); - this.NoSpaceAfterCloseAngularBracket = new Rule(RuleDescriptor.create3(SyntaxKind.GreaterThanToken, Shared.TokenRange.FromTokens([SyntaxKind.OpenParenToken, SyntaxKind.OpenBracketToken, SyntaxKind.GreaterThanToken, SyntaxKind.CommaToken])), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), RuleAction.Delete)); - this.NoSpaceAfterTypeAssertion = new Rule(RuleDescriptor.create3(SyntaxKind.GreaterThanToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeAssertionContext), RuleAction.Delete)); + this.NoSpaceBeforeOpenAngularBracket = new Rule(RuleDescriptor.create2(Shared.TokenRange.TypeNames, SyntaxKind.LessThanToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), RuleAction.Delete)); + this.NoSpaceBetweenCloseParenAndAngularBracket = new Rule(RuleDescriptor.create1(SyntaxKind.CloseParenToken, SyntaxKind.LessThanToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), RuleAction.Delete)); + this.NoSpaceAfterOpenAngularBracket = new Rule(RuleDescriptor.create3(SyntaxKind.LessThanToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), RuleAction.Delete)); + this.NoSpaceBeforeCloseAngularBracket = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.GreaterThanToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), RuleAction.Delete)); + this.NoSpaceAfterCloseAngularBracket = new Rule(RuleDescriptor.create3(SyntaxKind.GreaterThanToken, Shared.TokenRange.FromTokens([SyntaxKind.OpenParenToken, SyntaxKind.OpenBracketToken, SyntaxKind.GreaterThanToken, SyntaxKind.CommaToken])), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), RuleAction.Delete)); + this.NoSpaceAfterTypeAssertion = new Rule(RuleDescriptor.create3(SyntaxKind.GreaterThanToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeAssertionContext), RuleAction.Delete)); // Remove spaces in empty interface literals. e.g.: x: {} - this.NoSpaceBetweenEmptyInterfaceBraceBrackets = new Rule(RuleDescriptor.create1(SyntaxKind.OpenBraceToken, SyntaxKind.CloseBraceToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsObjectTypeContext), RuleAction.Delete)); + this.NoSpaceBetweenEmptyInterfaceBraceBrackets = new Rule(RuleDescriptor.create1(SyntaxKind.OpenBraceToken, SyntaxKind.CloseBraceToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsObjectTypeContext), RuleAction.Delete)); // decorators - this.SpaceBeforeAt = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.AtToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space)); - this.NoSpaceAfterAt = new Rule(RuleDescriptor.create3(SyntaxKind.AtToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete)); + this.SpaceBeforeAt = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.AtToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Space)); + this.NoSpaceAfterAt = new Rule(RuleDescriptor.create3(SyntaxKind.AtToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete)); this.SpaceAfterDecorator = new Rule(RuleDescriptor.create4(Shared.TokenRange.Any, Shared.TokenRange.FromTokens([SyntaxKind.AbstractKeyword, SyntaxKind.Identifier, SyntaxKind.ExportKeyword, SyntaxKind.DefaultKeyword, SyntaxKind.ClassKeyword, SyntaxKind.StaticKeyword, SyntaxKind.PublicKeyword, SyntaxKind.PrivateKeyword, SyntaxKind.ProtectedKeyword, SyntaxKind.GetKeyword, SyntaxKind.SetKeyword, SyntaxKind.OpenBracketToken, SyntaxKind.AsteriskToken])), RuleOperation.create2(new RuleOperationContext(Rules.IsEndOfDecoratorContextOnSameLine), RuleAction.Space)); this.NoSpaceBetweenFunctionKeywordAndStar = new Rule(RuleDescriptor.create1(SyntaxKind.FunctionKeyword, SyntaxKind.AsteriskToken), RuleOperation.create2(new RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), RuleAction.Delete)); this.SpaceAfterStarInGeneratorDeclaration = new Rule(RuleDescriptor.create3(SyntaxKind.AsteriskToken, Shared.TokenRange.FromTokens([SyntaxKind.Identifier, SyntaxKind.OpenParenToken])), RuleOperation.create2(new RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), RuleAction.Space)); - this.NoSpaceBetweenYieldKeywordAndStar = new Rule(RuleDescriptor.create1(SyntaxKind.YieldKeyword, SyntaxKind.AsteriskToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), RuleAction.Delete)); - this.SpaceBetweenYieldOrYieldStarAndOperand = new Rule(RuleDescriptor.create4(Shared.TokenRange.FromTokens([SyntaxKind.YieldKeyword, SyntaxKind.AsteriskToken]), Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), RuleAction.Space)); + this.NoSpaceBetweenYieldKeywordAndStar = new Rule(RuleDescriptor.create1(SyntaxKind.YieldKeyword, SyntaxKind.AsteriskToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), RuleAction.Delete)); + this.SpaceBetweenYieldOrYieldStarAndOperand = new Rule(RuleDescriptor.create4(Shared.TokenRange.FromTokens([SyntaxKind.YieldKeyword, SyntaxKind.AsteriskToken]), Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), RuleAction.Space)); // Async-await - this.SpaceBetweenAsyncAndOpenParen = new Rule(RuleDescriptor.create1(SyntaxKind.AsyncKeyword, SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsArrowFunctionContext, Rules.IsSameLineTokenContext), RuleAction.Space)); - this.SpaceBetweenAsyncAndFunctionKeyword = new Rule(RuleDescriptor.create1(SyntaxKind.AsyncKeyword, SyntaxKind.FunctionKeyword), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space)); + this.SpaceBetweenAsyncAndOpenParen = new Rule(RuleDescriptor.create1(SyntaxKind.AsyncKeyword, SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsArrowFunctionContext, Rules.IsNonJsxSameLineTokenContext), RuleAction.Space)); + this.SpaceBetweenAsyncAndFunctionKeyword = new Rule(RuleDescriptor.create1(SyntaxKind.AsyncKeyword, SyntaxKind.FunctionKeyword), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Space)); // template string - this.SpaceBetweenTagAndTemplateString = new Rule(RuleDescriptor.create3(SyntaxKind.Identifier, Shared.TokenRange.FromTokens([SyntaxKind.NoSubstitutionTemplateLiteral, SyntaxKind.TemplateHead])), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space)); - this.NoSpaceAfterTemplateHeadAndMiddle = new Rule(RuleDescriptor.create4(Shared.TokenRange.FromTokens([SyntaxKind.TemplateHead, SyntaxKind.TemplateMiddle]), Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete)); - this.NoSpaceBeforeTemplateMiddleAndTail = new Rule(RuleDescriptor.create4(Shared.TokenRange.Any, Shared.TokenRange.FromTokens([SyntaxKind.TemplateMiddle, SyntaxKind.TemplateTail])), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete)); + this.NoSpaceBetweenTagAndTemplateString = new Rule(RuleDescriptor.create3(SyntaxKind.Identifier, Shared.TokenRange.FromTokens([SyntaxKind.NoSubstitutionTemplateLiteral, SyntaxKind.TemplateHead])), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete)); // These rules are higher in priority than user-configurable rules. this.HighPriorityCommonRules = [ @@ -406,7 +406,7 @@ namespace ts.formatting { this.SpaceBeforeBinaryKeywordOperator, this.SpaceAfterBinaryKeywordOperator, this.SpaceAfterVoidOperator, this.SpaceBetweenAsyncAndOpenParen, this.SpaceBetweenAsyncAndFunctionKeyword, - this.SpaceBetweenTagAndTemplateString, this.NoSpaceAfterTemplateHeadAndMiddle, this.NoSpaceBeforeTemplateMiddleAndTail, + this.NoSpaceBetweenTagAndTemplateString, // TypeScript-specific rules this.NoSpaceAfterConstructor, this.NoSpaceAfterModuleImport, @@ -444,14 +444,14 @@ namespace ts.formatting { /// // Insert space after comma delimiter - this.SpaceAfterComma = new Rule(RuleDescriptor.create3(SyntaxKind.CommaToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space)); - this.NoSpaceAfterComma = new Rule(RuleDescriptor.create3(SyntaxKind.CommaToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete)); + this.SpaceAfterComma = new Rule(RuleDescriptor.create3(SyntaxKind.CommaToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNextTokenNotCloseBracket), RuleAction.Space)); + this.NoSpaceAfterComma = new Rule(RuleDescriptor.create3(SyntaxKind.CommaToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete)); // Insert space before and after binary operators - this.SpaceBeforeBinaryOperator = new Rule(RuleDescriptor.create4(Shared.TokenRange.Any, Shared.TokenRange.BinaryOperators), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), RuleAction.Space)); - this.SpaceAfterBinaryOperator = new Rule(RuleDescriptor.create4(Shared.TokenRange.BinaryOperators, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), RuleAction.Space)); - this.NoSpaceBeforeBinaryOperator = new Rule(RuleDescriptor.create4(Shared.TokenRange.Any, Shared.TokenRange.BinaryOperators), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), RuleAction.Delete)); - this.NoSpaceAfterBinaryOperator = new Rule(RuleDescriptor.create4(Shared.TokenRange.BinaryOperators, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), RuleAction.Delete)); + this.SpaceBeforeBinaryOperator = new Rule(RuleDescriptor.create4(Shared.TokenRange.Any, Shared.TokenRange.BinaryOperators), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), RuleAction.Space)); + this.SpaceAfterBinaryOperator = new Rule(RuleDescriptor.create4(Shared.TokenRange.BinaryOperators, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), RuleAction.Space)); + this.NoSpaceBeforeBinaryOperator = new Rule(RuleDescriptor.create4(Shared.TokenRange.Any, Shared.TokenRange.BinaryOperators), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), RuleAction.Delete)); + this.NoSpaceAfterBinaryOperator = new Rule(RuleDescriptor.create4(Shared.TokenRange.BinaryOperators, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), RuleAction.Delete)); // Insert space after keywords in control flow statements this.SpaceAfterKeywordInControl = new Rule(RuleDescriptor.create2(Shared.TokenRange.Keywords, SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsControlDeclContext), RuleAction.Space)); @@ -468,22 +468,28 @@ namespace ts.formatting { this.NewLineBeforeOpenBraceInControl = new Rule(RuleDescriptor.create2(this.ControlOpenBraceLeftTokenRange, SyntaxKind.OpenBraceToken), RuleOperation.create2(new RuleOperationContext(Rules.IsControlDeclContext, Rules.IsBeforeMultilineBlockContext), RuleAction.NewLine), RuleFlags.CanDeleteNewLines); // Insert space after semicolon in for statement - this.SpaceAfterSemicolonInFor = new Rule(RuleDescriptor.create3(SyntaxKind.SemicolonToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsForContext), RuleAction.Space)); - this.NoSpaceAfterSemicolonInFor = new Rule(RuleDescriptor.create3(SyntaxKind.SemicolonToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsForContext), RuleAction.Delete)); + this.SpaceAfterSemicolonInFor = new Rule(RuleDescriptor.create3(SyntaxKind.SemicolonToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsForContext), RuleAction.Space)); + this.NoSpaceAfterSemicolonInFor = new Rule(RuleDescriptor.create3(SyntaxKind.SemicolonToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsForContext), RuleAction.Delete)); // Insert space after opening and before closing nonempty parenthesis - this.SpaceAfterOpenParen = new Rule(RuleDescriptor.create3(SyntaxKind.OpenParenToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space)); - this.SpaceBeforeCloseParen = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.CloseParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space)); - this.NoSpaceBetweenParens = new Rule(RuleDescriptor.create1(SyntaxKind.OpenParenToken, SyntaxKind.CloseParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete)); - this.NoSpaceAfterOpenParen = new Rule(RuleDescriptor.create3(SyntaxKind.OpenParenToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete)); - this.NoSpaceBeforeCloseParen = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.CloseParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete)); + this.SpaceAfterOpenParen = new Rule(RuleDescriptor.create3(SyntaxKind.OpenParenToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Space)); + this.SpaceBeforeCloseParen = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.CloseParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Space)); + this.NoSpaceBetweenParens = new Rule(RuleDescriptor.create1(SyntaxKind.OpenParenToken, SyntaxKind.CloseParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete)); + this.NoSpaceAfterOpenParen = new Rule(RuleDescriptor.create3(SyntaxKind.OpenParenToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete)); + this.NoSpaceBeforeCloseParen = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.CloseParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete)); // Insert space after opening and before closing nonempty brackets - this.SpaceAfterOpenBracket = new Rule(RuleDescriptor.create3(SyntaxKind.OpenBracketToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space)); - this.SpaceBeforeCloseBracket = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.CloseBracketToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space)); - this.NoSpaceBetweenBrackets = new Rule(RuleDescriptor.create1(SyntaxKind.OpenBracketToken, SyntaxKind.CloseBracketToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete)); - this.NoSpaceAfterOpenBracket = new Rule(RuleDescriptor.create3(SyntaxKind.OpenBracketToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete)); - this.NoSpaceBeforeCloseBracket = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.CloseBracketToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete)); + this.SpaceAfterOpenBracket = new Rule(RuleDescriptor.create3(SyntaxKind.OpenBracketToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Space)); + this.SpaceBeforeCloseBracket = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.CloseBracketToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Space)); + this.NoSpaceBetweenBrackets = new Rule(RuleDescriptor.create1(SyntaxKind.OpenBracketToken, SyntaxKind.CloseBracketToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete)); + this.NoSpaceAfterOpenBracket = new Rule(RuleDescriptor.create3(SyntaxKind.OpenBracketToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete)); + this.NoSpaceBeforeCloseBracket = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.CloseBracketToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete)); + + // Insert space after opening and before closing template string braces + this.NoSpaceAfterTemplateHeadAndMiddle = new Rule(RuleDescriptor.create4(Shared.TokenRange.FromTokens([SyntaxKind.TemplateHead, SyntaxKind.TemplateMiddle]), Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete)); + this.SpaceAfterTemplateHeadAndMiddle = new Rule(RuleDescriptor.create4(Shared.TokenRange.FromTokens([SyntaxKind.TemplateHead, SyntaxKind.TemplateMiddle]), Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Space)); + this.NoSpaceBeforeTemplateMiddleAndTail = new Rule(RuleDescriptor.create4(Shared.TokenRange.Any, Shared.TokenRange.FromTokens([SyntaxKind.TemplateMiddle, SyntaxKind.TemplateTail])), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete)); + this.SpaceBeforeTemplateMiddleAndTail = new Rule(RuleDescriptor.create4(Shared.TokenRange.Any, Shared.TokenRange.FromTokens([SyntaxKind.TemplateMiddle, SyntaxKind.TemplateTail])), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Space)); // Insert space after function keyword for anonymous functions this.SpaceAfterAnonymousFunctionKeyword = new Rule(RuleDescriptor.create1(SyntaxKind.FunctionKeyword, SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsFunctionDeclContext), RuleAction.Space)); @@ -555,13 +561,13 @@ namespace ts.formatting { //// Ex: //// if (1) //// { ... } - //// * ) and { are on differnet lines. We only need to format if the block is multiline context. So in this case we don't format. + //// * ) and { are on different lines. We only need to format if the block is multiline context. So in this case we don't format. //// //// Ex: //// if (1) //// { ... //// } - //// * ) and { are on differnet lines. We only need to format if the block is multiline context. So in this case we format. + //// * ) and { are on different lines. We only need to format if the block is multiline context. So in this case we format. return context.TokensAreOnSameLine() || Rules.IsBeforeMultilineBlockContext(context); } @@ -705,12 +711,16 @@ namespace ts.formatting { return context.currentTokenSpan.kind !== SyntaxKind.CommaToken; } + static IsNextTokenNotCloseBracket(context: FormattingContext): boolean { + return context.nextTokenSpan.kind !== SyntaxKind.CloseBracketToken; + } + static IsArrowFunctionContext(context: FormattingContext): boolean { return context.contextNode.kind === SyntaxKind.ArrowFunction; } - static IsSameLineTokenContext(context: FormattingContext): boolean { - return context.TokensAreOnSameLine(); + static IsNonJsxSameLineTokenContext(context: FormattingContext): boolean { + return context.TokensAreOnSameLine() && context.contextNode.kind !== SyntaxKind.JsxText; } static IsNotBeforeBlockInFunctionDeclarationContext(context: FormattingContext): boolean { diff --git a/src/services/formatting/rulesProvider.ts b/src/services/formatting/rulesProvider.ts index f6cf1de474b..48a783dd0c6 100644 --- a/src/services/formatting/rulesProvider.ts +++ b/src/services/formatting/rulesProvider.ts @@ -71,15 +71,24 @@ namespace ts.formatting { rules.push(this.globalRules.NoSpaceBetweenParens); } - if ( options.InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets ) { - rules.push( this.globalRules.SpaceAfterOpenBracket ); - rules.push( this.globalRules.SpaceBeforeCloseBracket ); - rules.push( this.globalRules.NoSpaceBetweenBrackets ); + if (options.InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets) { + rules.push(this.globalRules.SpaceAfterOpenBracket); + rules.push(this.globalRules.SpaceBeforeCloseBracket); + rules.push(this.globalRules.NoSpaceBetweenBrackets); } else { - rules.push( this.globalRules.NoSpaceAfterOpenBracket ); - rules.push( this.globalRules.NoSpaceBeforeCloseBracket ); - rules.push( this.globalRules.NoSpaceBetweenBrackets ); + rules.push(this.globalRules.NoSpaceAfterOpenBracket); + rules.push(this.globalRules.NoSpaceBeforeCloseBracket); + rules.push(this.globalRules.NoSpaceBetweenBrackets); + } + + if (options.InsertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces) { + rules.push(this.globalRules.SpaceAfterTemplateHeadAndMiddle); + rules.push(this.globalRules.SpaceBeforeTemplateMiddleAndTail); + } + else { + rules.push(this.globalRules.NoSpaceAfterTemplateHeadAndMiddle); + rules.push(this.globalRules.NoSpaceBeforeTemplateMiddleAndTail); } if (options.InsertSpaceAfterSemicolonInForStatements) { diff --git a/src/services/jsTyping.ts b/src/services/jsTyping.ts new file mode 100644 index 00000000000..3b013a4a924 --- /dev/null +++ b/src/services/jsTyping.ts @@ -0,0 +1,227 @@ +// Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. +// See LICENSE.txt in the project root for complete license information. + +/// + +/* @internal */ +namespace ts.JsTyping { + + export interface TypingResolutionHost { + directoryExists: (path: string) => boolean; + fileExists: (fileName: string) => boolean; + readFile: (path: string, encoding?: string) => string; + readDirectory: (rootDir: string, extensions: string[], excludes: string[], includes: string[], depth?: number) => string[]; + }; + + interface PackageJson { + _requiredBy?: string[]; + dependencies?: Map; + devDependencies?: Map; + name?: string; + optionalDependencies?: Map; + peerDependencies?: Map; + typings?: string; + }; + + // A map of loose file names to library names + // that we are confident require typings + let safeList: Map; + + /** + * @param host is the object providing I/O related operations. + * @param fileNames are the file names that belong to the same project + * @param projectRootPath is the path to the project root directory + * @param safeListPath is the path used to retrieve the safe list + * @param packageNameToTypingLocation is the map of package names to their cached typing locations + * @param typingOptions are used to customize the typing inference process + * @param compilerOptions are used as a source for typing inference + */ + export function discoverTypings( + host: TypingResolutionHost, + fileNames: string[], + projectRootPath: Path, + safeListPath: Path, + packageNameToTypingLocation: Map, + typingOptions: TypingOptions, + compilerOptions: CompilerOptions): + { cachedTypingPaths: string[], newTypingNames: string[], filesToWatch: string[] } { + + // A typing name to typing file path mapping + const inferredTypings: Map = {}; + + if (!typingOptions || !typingOptions.enableAutoDiscovery) { + return { cachedTypingPaths: [], newTypingNames: [], filesToWatch: [] }; + } + + // Only infer typings for .js and .jsx files + fileNames = filter(map(fileNames, normalizePath), f => scriptKindIs(f, /*LanguageServiceHost*/ undefined, ScriptKind.JS, ScriptKind.JSX)); + + if (!safeList) { + const result = readConfigFile(safeListPath, (path: string) => host.readFile(path)); + if (result.config) { + safeList = result.config; + } + else { + safeList = {}; + }; + } + + const filesToWatch: string[] = []; + // Directories to search for package.json, bower.json and other typing information + let searchDirs: string[] = []; + let exclude: string[] = []; + + mergeTypings(typingOptions.include); + exclude = typingOptions.exclude || []; + + const possibleSearchDirs = map(fileNames, getDirectoryPath); + if (projectRootPath !== undefined) { + possibleSearchDirs.push(projectRootPath); + } + searchDirs = deduplicate(possibleSearchDirs); + for (const searchDir of searchDirs) { + const packageJsonPath = combinePaths(searchDir, "package.json"); + getTypingNamesFromJson(packageJsonPath, filesToWatch); + + const bowerJsonPath = combinePaths(searchDir, "bower.json"); + getTypingNamesFromJson(bowerJsonPath, filesToWatch); + + const nodeModulesPath = combinePaths(searchDir, "node_modules"); + getTypingNamesFromNodeModuleFolder(nodeModulesPath); + } + getTypingNamesFromSourceFileNames(fileNames); + + // Add the cached typing locations for inferred typings that are already installed + for (const name in packageNameToTypingLocation) { + if (hasProperty(inferredTypings, name) && !inferredTypings[name]) { + inferredTypings[name] = packageNameToTypingLocation[name]; + } + } + + // Remove typings that the user has added to the exclude list + for (const excludeTypingName of exclude) { + delete inferredTypings[excludeTypingName]; + } + + const newTypingNames: string[] = []; + const cachedTypingPaths: string[] = []; + for (const typing in inferredTypings) { + if (inferredTypings[typing] !== undefined) { + cachedTypingPaths.push(inferredTypings[typing]); + } + else { + newTypingNames.push(typing); + } + } + return { cachedTypingPaths, newTypingNames, filesToWatch }; + + /** + * Merge a given list of typingNames to the inferredTypings map + */ + function mergeTypings(typingNames: string[]) { + if (!typingNames) { + return; + } + + for (const typing of typingNames) { + if (!hasProperty(inferredTypings, typing)) { + inferredTypings[typing] = undefined; + } + } + } + + /** + * Get the typing info from common package manager json files like package.json or bower.json + */ + function getTypingNamesFromJson(jsonPath: string, filesToWatch: string[]) { + const result = readConfigFile(jsonPath, (path: string) => host.readFile(path)); + if (result.config) { + const jsonConfig: PackageJson = result.config; + filesToWatch.push(jsonPath); + if (jsonConfig.dependencies) { + mergeTypings(getKeys(jsonConfig.dependencies)); + } + if (jsonConfig.devDependencies) { + mergeTypings(getKeys(jsonConfig.devDependencies)); + } + if (jsonConfig.optionalDependencies) { + mergeTypings(getKeys(jsonConfig.optionalDependencies)); + } + if (jsonConfig.peerDependencies) { + mergeTypings(getKeys(jsonConfig.peerDependencies)); + } + } + } + + /** + * Infer typing names from given file names. For example, the file name "jquery-min.2.3.4.js" + * should be inferred to the 'jquery' typing name; and "angular-route.1.2.3.js" should be inferred + * to the 'angular-route' typing name. + * @param fileNames are the names for source files in the project + */ + function getTypingNamesFromSourceFileNames(fileNames: string[]) { + const jsFileNames = filter(fileNames, hasJavaScriptFileExtension); + const inferredTypingNames = map(jsFileNames, f => removeFileExtension(getBaseFileName(f.toLowerCase()))); + const cleanedTypingNames = map(inferredTypingNames, f => f.replace(/((?:\.|-)min(?=\.|$))|((?:-|\.)\d+)/g, "")); + if (safeList === undefined) { + mergeTypings(cleanedTypingNames); + } + else { + mergeTypings(filter(cleanedTypingNames, f => hasProperty(safeList, f))); + } + + const hasJsxFile = forEach(fileNames, f => scriptKindIs(f, /*LanguageServiceHost*/ undefined, ScriptKind.JSX)); + if (hasJsxFile) { + mergeTypings(["react"]); + } + } + + /** + * Infer typing names from node_module folder + * @param nodeModulesPath is the path to the "node_modules" folder + */ + function getTypingNamesFromNodeModuleFolder(nodeModulesPath: string) { + // Todo: add support for ModuleResolutionHost too + if (!host.directoryExists(nodeModulesPath)) { + return; + } + + const typingNames: string[] = []; + const fileNames = host.readDirectory(nodeModulesPath, ["*.json"], /*excludes*/ undefined, /*includes*/ undefined, /*depth*/ 2); + for (const fileName of fileNames) { + const normalizedFileName = normalizePath(fileName); + if (getBaseFileName(normalizedFileName) !== "package.json") { + continue; + } + const result = readConfigFile(normalizedFileName, (path: string) => host.readFile(path)); + if (!result.config) { + continue; + } + const packageJson: PackageJson = result.config; + + // npm 3's package.json contains a "_requiredBy" field + // we should include all the top level module names for npm 2, and only module names whose + // "_requiredBy" field starts with "#" or equals "/" for npm 3. + if (packageJson._requiredBy && + filter(packageJson._requiredBy, (r: string) => r[0] === "#" || r === "/").length === 0) { + continue; + } + + // If the package has its own d.ts typings, those will take precedence. Otherwise the package name will be used + // to download d.ts files from DefinitelyTyped + if (!packageJson.name) { + continue; + } + if (packageJson.typings) { + const absolutePath = getNormalizedAbsolutePath(packageJson.typings, getDirectoryPath(normalizedFileName)); + inferredTypings[packageJson.name] = absolutePath; + } + else { + typingNames.push(packageJson.name); + } + } + mergeTypings(typingNames); + } + + } +} diff --git a/src/services/navigationBar.ts b/src/services/navigationBar.ts index 46ec807a881..2cd93d3856c 100644 --- a/src/services/navigationBar.ts +++ b/src/services/navigationBar.ts @@ -3,6 +3,12 @@ /* @internal */ namespace ts.NavigationBar { export function getNavigationBarItems(sourceFile: SourceFile, compilerOptions: CompilerOptions): ts.NavigationBarItem[] { + // TODO: Handle JS files differently in 'navbar' calls for now, but ideally we should unify + // the 'navbar' and 'navto' logic for TypeScript and JavaScript. + if (isSourceFileJavaScript(sourceFile)) { + return getJsNavigationBarItems(sourceFile, compilerOptions); + } + // If the source file has any child items, then it included in the tree // and takes lexical ownership of all other top-level items. let hasGlobalNode = false; @@ -40,7 +46,7 @@ namespace ts.NavigationBar { } function getChildNodes(nodes: Node[]): Node[] { - let childNodes: Node[] = []; + const childNodes: Node[] = []; function visit(node: Node) { switch (node.kind) { @@ -103,7 +109,7 @@ namespace ts.NavigationBar { } } - //for (let i = 0, n = nodes.length; i < n; i++) { + // for (let i = 0, n = nodes.length; i < n; i++) { // let node = nodes[i]; // if (node.kind === SyntaxKind.ClassDeclaration || @@ -117,20 +123,20 @@ namespace ts.NavigationBar { // else if (node.kind === SyntaxKind.VariableStatement) { // childNodes.push.apply(childNodes, (node).declarations); // } - //} + // } forEach(nodes, visit); return sortNodes(childNodes); } function getTopLevelNodes(node: SourceFile): Node[] { - let topLevelNodes: Node[] = []; + const topLevelNodes: Node[] = []; topLevelNodes.push(node); addTopLevelNodes(node.statements, topLevelNodes); return topLevelNodes; } - + function sortNodes(nodes: Node[]): Node[] { return nodes.slice(0).sort((n1: Declaration, n2: Declaration) => { if (n1.name && n2.name) { @@ -147,15 +153,30 @@ namespace ts.NavigationBar { } }); } - + function addTopLevelNodes(nodes: Node[], topLevelNodes: Node[]): void { nodes = sortNodes(nodes); - for (let node of nodes) { + for (const node of nodes) { switch (node.kind) { case SyntaxKind.ClassDeclaration: + topLevelNodes.push(node); + for (const member of (node).members) { + if (member.kind === SyntaxKind.MethodDeclaration || member.kind === SyntaxKind.Constructor) { + type FunctionLikeMember = MethodDeclaration | ConstructorDeclaration; + if ((member).body) { + // We do not include methods that does not have child functions in it, because of duplications. + if (hasNamedFunctionDeclarations(((member).body).statements)) { + topLevelNodes.push(member); + } + addTopLevelNodes(((member).body).statements, topLevelNodes); + } + } + } + break; case SyntaxKind.EnumDeclaration: case SyntaxKind.InterfaceDeclaration: + case SyntaxKind.TypeAliasDeclaration: topLevelNodes.push(node); break; @@ -176,41 +197,58 @@ namespace ts.NavigationBar { } } - function isTopLevelFunctionDeclaration(functionDeclaration: FunctionLikeDeclaration) { + function hasNamedFunctionDeclarations(nodes: NodeArray): boolean { + for (const s of nodes) { + if (s.kind === SyntaxKind.FunctionDeclaration && !isEmpty((s).name.text)) { + return true; + } + } + return false; + } + + function isTopLevelFunctionDeclaration(functionDeclaration: FunctionLikeDeclaration): boolean { if (functionDeclaration.kind === SyntaxKind.FunctionDeclaration) { - // A function declaration is 'top level' if it contains any function declarations - // within it. + // A function declaration is 'top level' if it contains any function declarations + // within it. if (functionDeclaration.body && functionDeclaration.body.kind === SyntaxKind.Block) { // Proper function declarations can only have identifier names - if (forEach((functionDeclaration.body).statements, - s => s.kind === SyntaxKind.FunctionDeclaration && !isEmpty((s).name.text))) { - + if (hasNamedFunctionDeclarations((functionDeclaration.body).statements)) { return true; } - // Or if it is not parented by another function. i.e all functions - // at module scope are 'top level'. + // Or if it is not parented by another function. I.e all functions at module scope are 'top level'. if (!isFunctionBlock(functionDeclaration.parent)) { return true; } + + // Or if it is nested inside class methods and constructors. + else { + // We have made sure that a grand parent node exists with 'isFunctionBlock()' above. + const grandParentKind = functionDeclaration.parent.parent.kind; + if (grandParentKind === SyntaxKind.MethodDeclaration || + grandParentKind === SyntaxKind.Constructor) { + + return true; + } + } } } return false; } - + function getItemsWorker(nodes: Node[], createItem: (n: Node) => ts.NavigationBarItem): ts.NavigationBarItem[] { - let items: ts.NavigationBarItem[] = []; + const items: ts.NavigationBarItem[] = []; - let keyToItem: Map = {}; + const keyToItem: Map = {}; - for (let child of nodes) { - let item = createItem(child); + for (const child of nodes) { + const item = createItem(child); if (item !== undefined) { if (item.text.length > 0) { - let key = item.text + "-" + item.kind + "-" + item.indent; + const key = item.text + "-" + item.kind + "-" + item.indent; - let itemWithSameName = keyToItem[key]; + const itemWithSameName = keyToItem[key]; if (itemWithSameName) { // We had an item with the same name. Merge these items together. merge(itemWithSameName, item); @@ -237,8 +275,8 @@ namespace ts.NavigationBar { // Next, recursively merge or add any children in the source as appropriate. outer: - for (let sourceChild of source.childItems) { - for (let targetChild of target.childItems) { + for (const sourceChild of source.childItems) { + for (const targetChild of target.childItems) { if (targetChild.text === sourceChild.text && targetChild.kind === sourceChild.kind) { // Found a match. merge them. merge(targetChild, sourceChild); @@ -345,7 +383,7 @@ namespace ts.NavigationBar { return !text || text.trim() === ""; } - function getNavigationBarItem(text: string, kind: string, kindModifiers: string, spans: TextSpan[], childItems: NavigationBarItem[] = [], indent: number = 0): NavigationBarItem { + function getNavigationBarItem(text: string, kind: string, kindModifiers: string, spans: TextSpan[], childItems: NavigationBarItem[] = [], indent = 0): NavigationBarItem { if (isEmpty(text)) { return undefined; } @@ -370,45 +408,52 @@ namespace ts.NavigationBar { case SyntaxKind.ClassDeclaration: return createClassItem(node); + case SyntaxKind.MethodDeclaration: + case SyntaxKind.Constructor: + return createMemberFunctionLikeItem(node); + case SyntaxKind.EnumDeclaration: return createEnumItem(node); case SyntaxKind.InterfaceDeclaration: - return createIterfaceItem(node); + return createInterfaceItem(node); case SyntaxKind.ModuleDeclaration: return createModuleItem(node); case SyntaxKind.FunctionDeclaration: return createFunctionItem(node); + + case SyntaxKind.TypeAliasDeclaration: + return createTypeAliasItem(node); } return undefined; function getModuleName(moduleDeclaration: ModuleDeclaration): string { // We want to maintain quotation marks. - if (moduleDeclaration.name.kind === SyntaxKind.StringLiteral) { + if (isAmbientModule(moduleDeclaration)) { return getTextOfNode(moduleDeclaration.name); } // Otherwise, we need to aggregate each identifier to build up the qualified name. - let result: string[] = []; + const result: string[] = []; result.push(moduleDeclaration.name.text); - + while (moduleDeclaration.body && moduleDeclaration.body.kind === SyntaxKind.ModuleDeclaration) { moduleDeclaration = moduleDeclaration.body; result.push(moduleDeclaration.name.text); - } + } return result.join("."); } function createModuleItem(node: ModuleDeclaration): NavigationBarItem { - let moduleName = getModuleName(node); - - let childItems = getItemsWorker(getChildNodes((getInnermostModule(node).body).statements), createChildItem); + const moduleName = getModuleName(node); + + const childItems = getItemsWorker(getChildNodes((getInnermostModule(node).body).statements), createChildItem); return getNavigationBarItem(moduleName, ts.ScriptElementKind.moduleElement, @@ -418,11 +463,11 @@ namespace ts.NavigationBar { getIndent(node)); } - function createFunctionItem(node: FunctionDeclaration) { + function createFunctionItem(node: FunctionDeclaration): ts.NavigationBarItem { if (node.body && node.body.kind === SyntaxKind.Block) { - let childItems = getItemsWorker(sortNodes((node.body).statements), createChildItem); + const childItems = getItemsWorker(sortNodes((node.body).statements), createChildItem); - return getNavigationBarItem(!node.name ? "default": node.name.text , + return getNavigationBarItem(!node.name ? "default" : node.name.text, ts.ScriptElementKind.functionElement, getNodeModifiers(node), [getNodeSpan(node)], @@ -433,17 +478,51 @@ namespace ts.NavigationBar { return undefined; } + function createTypeAliasItem(node: TypeAliasDeclaration): ts.NavigationBarItem { + return getNavigationBarItem(node.name.text, + ts.ScriptElementKind.typeElement, + getNodeModifiers(node), + [getNodeSpan(node)], + [], + getIndent(node)); + } + + function createMemberFunctionLikeItem(node: MethodDeclaration | ConstructorDeclaration): ts.NavigationBarItem { + if (node.body && node.body.kind === SyntaxKind.Block) { + const childItems = getItemsWorker(sortNodes((node.body).statements), createChildItem); + let scriptElementKind: string; + let memberFunctionName: string; + if (node.kind === SyntaxKind.MethodDeclaration) { + memberFunctionName = getPropertyNameForPropertyNameNode(node.name); + scriptElementKind = ts.ScriptElementKind.memberFunctionElement; + } + else { + memberFunctionName = "constructor"; + scriptElementKind = ts.ScriptElementKind.constructorImplementationElement; + } + + return getNavigationBarItem(memberFunctionName, + scriptElementKind, + getNodeModifiers(node), + [getNodeSpan(node)], + childItems, + getIndent(node)); + } + + return undefined; + } + function createSourceFileItem(node: SourceFile): ts.NavigationBarItem { - let childItems = getItemsWorker(getChildNodes(node.statements), createChildItem); + const childItems = getItemsWorker(getChildNodes(node.statements), createChildItem); if (childItems === undefined || childItems.length === 0) { return undefined; } hasGlobalNode = true; - let rootName = isExternalModule(node) + const rootName = isExternalModule(node) ? "\"" + escapeString(getBaseFileName(removeFileExtension(normalizePath(node.fileName)))) + "\"" - : "" + : ""; return getNavigationBarItem(rootName, ts.ScriptElementKind.moduleElement, @@ -456,14 +535,14 @@ namespace ts.NavigationBar { let childItems: NavigationBarItem[]; if (node.members) { - let constructor = forEach(node.members, member => { + const constructor = forEach(node.members, member => { return member.kind === SyntaxKind.Constructor && member; }); // Add the constructor parameters in as children of the class (for property parameters). // Note that *all non-binding pattern named* parameters will be added to the nodes array, but parameters that // are not properties will be filtered out later by createChildItem. - let nodes: Node[] = removeDynamicallyNamedProperties(node); + const nodes: Node[] = removeDynamicallyNamedProperties(node); if (constructor) { addRange(nodes, filter(constructor.parameters, p => !isBindingPattern(p.name))); } @@ -471,7 +550,7 @@ namespace ts.NavigationBar { childItems = getItemsWorker(sortNodes(nodes), createChildItem); } - var nodeName = !node.name ? "default" : node.name.text; + const nodeName = !node.name ? "default" : node.name.text; return getNavigationBarItem( nodeName, @@ -483,7 +562,7 @@ namespace ts.NavigationBar { } function createEnumItem(node: EnumDeclaration): ts.NavigationBarItem { - let childItems = getItemsWorker(sortNodes(removeComputedProperties(node)), createChildItem); + const childItems = getItemsWorker(sortNodes(removeComputedProperties(node)), createChildItem); return getNavigationBarItem( node.name.text, ts.ScriptElementKind.enumElement, @@ -493,8 +572,8 @@ namespace ts.NavigationBar { getIndent(node)); } - function createIterfaceItem(node: InterfaceDeclaration): ts.NavigationBarItem { - let childItems = getItemsWorker(sortNodes(removeDynamicallyNamedProperties(node)), createChildItem); + function createInterfaceItem(node: InterfaceDeclaration): ts.NavigationBarItem { + const childItems = getItemsWorker(sortNodes(removeDynamicallyNamedProperties(node)), createChildItem); return getNavigationBarItem( node.name.text, ts.ScriptElementKind.interfaceElement, @@ -512,7 +591,7 @@ namespace ts.NavigationBar { /** * Like removeComputedProperties, but retains the properties with well known symbol names */ - function removeDynamicallyNamedProperties(node: ClassDeclaration | InterfaceDeclaration): Declaration[]{ + function removeDynamicallyNamedProperties(node: ClassDeclaration | InterfaceDeclaration): Declaration[] { return filter(node.members, member => !hasDynamicName(member)); } @@ -534,4 +613,203 @@ namespace ts.NavigationBar { return getTextOfNodeFromSourceText(sourceFile.text, node); } } -} \ No newline at end of file + + export function getJsNavigationBarItems(sourceFile: SourceFile, compilerOptions: CompilerOptions): NavigationBarItem[] { + const anonFnText = ""; + const anonClassText = ""; + let indent = 0; + + const rootName = isExternalModule(sourceFile) ? + "\"" + escapeString(getBaseFileName(removeFileExtension(normalizePath(sourceFile.fileName)))) + "\"" + : ""; + + const sourceFileItem = getNavBarItem(rootName, ScriptElementKind.moduleElement, [getNodeSpan(sourceFile)]); + let topItem = sourceFileItem; + + // Walk the whole file, because we want to also find function expressions - which may be in variable initializer, + // call arguments, expressions, etc... + forEachChild(sourceFile, visitNode); + + function visitNode(node: Node) { + const newItem = createNavBarItem(node); + + if (newItem) { + topItem.childItems.push(newItem); + } + + // Add a level if traversing into a container + if (newItem && (isFunctionLike(node) || isClassLike(node))) { + const lastTop = topItem; + indent++; + topItem = newItem; + forEachChild(node, visitNode); + topItem = lastTop; + indent--; + + // If the last item added was an anonymous function expression, and it had no children, discard it. + if (newItem && newItem.text === anonFnText && newItem.childItems.length === 0) { + topItem.childItems.pop(); + } + } + else { + forEachChild(node, visitNode); + } + } + + function createNavBarItem(node: Node): NavigationBarItem { + switch (node.kind) { + case SyntaxKind.VariableDeclaration: + // Only add to the navbar if at the top-level of the file + // Note: "const" and "let" are also SyntaxKind.VariableDeclarations + if (node.parent/*VariableDeclarationList*/.parent/*VariableStatement*/ + .parent/*SourceFile*/.kind !== SyntaxKind.SourceFile) { + return undefined; + } + // If it is initialized with a function expression, handle it when we reach the function expression node + const varDecl = node as VariableDeclaration; + if (varDecl.initializer && (varDecl.initializer.kind === SyntaxKind.FunctionExpression || + varDecl.initializer.kind === SyntaxKind.ArrowFunction || + varDecl.initializer.kind === SyntaxKind.ClassExpression)) { + return undefined; + } + // Fall through + case SyntaxKind.FunctionDeclaration: + case SyntaxKind.ClassDeclaration: + case SyntaxKind.Constructor: + case SyntaxKind.GetAccessor: + case SyntaxKind.SetAccessor: + // "export default function().." looks just like a regular function/class declaration, except with the 'default' flag + const name = node.flags && (node.flags & NodeFlags.Default) && !(node as (Declaration)).name ? "default" : + node.kind === SyntaxKind.Constructor ? "constructor" : + declarationNameToString((node as (Declaration)).name); + return getNavBarItem(name, getScriptKindForElementKind(node.kind), [getNodeSpan(node)]); + case SyntaxKind.FunctionExpression: + case SyntaxKind.ArrowFunction: + case SyntaxKind.ClassExpression: + return getDefineModuleItem(node) || getFunctionOrClassExpressionItem(node); + case SyntaxKind.MethodDeclaration: + const methodDecl = node as MethodDeclaration; + return getNavBarItem(declarationNameToString(methodDecl.name), + ScriptElementKind.memberFunctionElement, + [getNodeSpan(node)]); + case SyntaxKind.ExportAssignment: + // e.g. "export default " + return getNavBarItem("default", ScriptElementKind.variableElement, [getNodeSpan(node)]); + case SyntaxKind.ImportClause: // e.g. 'def' in: import def from 'mod' (in ImportDeclaration) + if (!(node as ImportClause).name) { + // No default import (this node is still a parent of named & namespace imports, which are handled below) + return undefined; + } + // fall through + case SyntaxKind.ImportSpecifier: // e.g. 'id' in: import {id} from 'mod' (in NamedImports, in ImportClause) + case SyntaxKind.NamespaceImport: // e.g. '* as ns' in: import * as ns from 'mod' (in ImportClause) + case SyntaxKind.ExportSpecifier: // e.g. 'a' or 'b' in: export {a, foo as b} from 'mod' + // Export specifiers are only interesting if they are reexports from another module, or renamed, else they are already globals + if (node.kind === SyntaxKind.ExportSpecifier) { + if (!(node.parent.parent as ExportDeclaration).moduleSpecifier && !(node as ExportSpecifier).propertyName) { + return undefined; + } + } + const decl = node as (ImportSpecifier | ImportClause | NamespaceImport | ExportSpecifier); + if (!decl.name) { + return undefined; + } + const declName = declarationNameToString(decl.name); + return getNavBarItem(declName, ScriptElementKind.constElement, [getNodeSpan(node)]); + default: + return undefined; + } + } + + function getNavBarItem(text: string, kind: string, spans: TextSpan[], kindModifiers = ScriptElementKindModifier.none): NavigationBarItem { + return { + text, kind, kindModifiers, spans, childItems: [], indent, bolded: false, grayed: false + }; + } + + function getDefineModuleItem(node: Node): NavigationBarItem { + if (node.kind !== SyntaxKind.FunctionExpression && node.kind !== SyntaxKind.ArrowFunction) { + return undefined; + } + + // No match if this is not a call expression to an identifier named 'define' + if (node.parent.kind !== SyntaxKind.CallExpression) { + return undefined; + } + const callExpr = node.parent as CallExpression; + if (callExpr.expression.kind !== SyntaxKind.Identifier || callExpr.expression.getText() !== "define") { + return undefined; + } + + // Return a module of either the given text in the first argument, or of the source file path + let defaultName = node.getSourceFile().fileName; + if (callExpr.arguments[0].kind === SyntaxKind.StringLiteral) { + defaultName = ((callExpr.arguments[0]) as StringLiteral).text; + } + return getNavBarItem(defaultName, ScriptElementKind.moduleElement, [getNodeSpan(node.parent)]); + } + + function getFunctionOrClassExpressionItem(node: Node): NavigationBarItem { + if (node.kind !== SyntaxKind.FunctionExpression && + node.kind !== SyntaxKind.ArrowFunction && + node.kind !== SyntaxKind.ClassExpression) { + return undefined; + } + + const fnExpr = node as FunctionExpression | ArrowFunction | ClassExpression; + let fnName: string; + if (fnExpr.name && getFullWidth(fnExpr.name) > 0) { + // The expression has an identifier, so use that as the name + fnName = declarationNameToString(fnExpr.name); + } + else { + // See if it is a var initializer. If so, use the var name. + if (fnExpr.parent.kind === SyntaxKind.VariableDeclaration) { + fnName = declarationNameToString((fnExpr.parent as VariableDeclaration).name); + } + // See if it is of the form " = function(){...}". If so, use the text from the left-hand side. + else if (fnExpr.parent.kind === SyntaxKind.BinaryExpression && + (fnExpr.parent as BinaryExpression).operatorToken.kind === SyntaxKind.EqualsToken) { + fnName = (fnExpr.parent as BinaryExpression).left.getText(); + } + // See if it is a property assignment, and if so use the property name + else if (fnExpr.parent.kind === SyntaxKind.PropertyAssignment && + (fnExpr.parent as PropertyAssignment).name) { + fnName = (fnExpr.parent as PropertyAssignment).name.getText(); + } + else { + fnName = node.kind === SyntaxKind.ClassExpression ? anonClassText : anonFnText; + } + } + const scriptKind = node.kind === SyntaxKind.ClassExpression ? ScriptElementKind.classElement : ScriptElementKind.functionElement; + return getNavBarItem(fnName, scriptKind, [getNodeSpan(node)]); + } + + function getNodeSpan(node: Node) { + return node.kind === SyntaxKind.SourceFile + ? createTextSpanFromBounds(node.getFullStart(), node.getEnd()) + : createTextSpanFromBounds(node.getStart(), node.getEnd()); + } + + function getScriptKindForElementKind(kind: SyntaxKind) { + switch (kind) { + case SyntaxKind.VariableDeclaration: + return ScriptElementKind.variableElement; + case SyntaxKind.FunctionDeclaration: + return ScriptElementKind.functionElement; + case SyntaxKind.ClassDeclaration: + return ScriptElementKind.classElement; + case SyntaxKind.Constructor: + return ScriptElementKind.constructorImplementationElement; + case SyntaxKind.GetAccessor: + return ScriptElementKind.memberGetAccessorElement; + case SyntaxKind.SetAccessor: + return ScriptElementKind.memberSetAccessorElement; + default: + return "unknown"; + } + } + + return sourceFileItem.childItems; + } +} diff --git a/src/services/outliningElementsCollector.ts b/src/services/outliningElementsCollector.ts index fa4f46b5010..dc2e4a59773 100644 --- a/src/services/outliningElementsCollector.ts +++ b/src/services/outliningElementsCollector.ts @@ -100,7 +100,7 @@ namespace ts.OutliningElementsCollector { const closeBrace = findChildOfKind(n, SyntaxKind.CloseBraceToken, sourceFile); // Check if the block is standalone, or 'attached' to some parent statement. - // If the latter, we want to collaps the block, but consider its hint span + // If the latter, we want to collapse the block, but consider its hint span // to be the entire span of the parent. if (parent.kind === SyntaxKind.DoStatement || parent.kind === SyntaxKind.ForInStatement || diff --git a/src/services/services.ts b/src/services/services.ts index 0fd4df19907..995e27c02ca 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -7,12 +7,13 @@ /// /// /// +/// /// /// namespace ts { /** The version of the language service API */ - export const servicesVersion = "0.4"; + export const servicesVersion = "0.5"; export interface Node { getSourceFile(): SourceFile; @@ -49,6 +50,7 @@ namespace ts { getStringIndexType(): Type; getNumberIndexType(): Type; getBaseTypes(): ObjectType[]; + getNonNullableType(): Type; } export interface Signature { @@ -62,7 +64,7 @@ namespace ts { export interface SourceFile { /* @internal */ version: string; /* @internal */ scriptSnapshot: IScriptSnapshot; - /* @internal */ nameTable: Map; + /* @internal */ nameTable: Map; /* @internal */ getNamedDeclarations(): Map; @@ -124,6 +126,7 @@ namespace ts { } export interface PreProcessedFileInfo { referencedFiles: FileReference[]; + typeReferenceDirectives: FileReference[]; importedFiles: FileReference[]; ambientExternalModules: string[]; isLibFile: boolean; @@ -237,14 +240,14 @@ namespace ts { while (pos < end) { const token = scanner.scan(); const textPos = scanner.getTextPos(); - nodes.push(createNode(token, pos, textPos, NodeFlags.Synthetic, this)); + nodes.push(createNode(token, pos, textPos, 0, this)); pos = textPos; } return pos; } private createSyntaxList(nodes: NodeArray): Node { - const list = createNode(SyntaxKind.SyntaxList, nodes.pos, nodes.end, NodeFlags.Synthetic, this); + const list = createNode(SyntaxKind.SyntaxList, nodes.pos, nodes.end, 0, this); list._children = []; let pos = nodes.pos; @@ -502,7 +505,7 @@ namespace ts { spacesToRemoveAfterAsterisk = 0; } - // Analyse text on this line + // Analyze text on this line while (pos < end && !isLineBreak(sourceFile.text.charCodeAt(pos))) { const ch = sourceFile.text.charAt(pos); if (ch === "@") { @@ -641,7 +644,7 @@ namespace ts { paramHelpStringMargin = undefined; } - // If this is the start of another tag, continue with the loop in seach of param tag with symbol name + // If this is the start of another tag, continue with the loop in search of param tag with symbol name if (sourceFile.text.charCodeAt(pos) === CharacterCodes.at) { continue; } @@ -733,6 +736,9 @@ namespace ts { ? this.checker.getBaseTypes(this) : undefined; } + getNonNullableType(): Type { + return this.checker.getNonNullableType(this); + } } class SignatureObject implements Signature { @@ -740,6 +746,7 @@ namespace ts { declaration: SignatureDeclaration; typeParameters: TypeParameter[]; parameters: Symbol[]; + thisType: Type; resolvedReturnType: Type; minArgumentCount: number; hasRestParameter: boolean; @@ -791,12 +798,14 @@ namespace ts { public amdDependencies: { name: string; path: string }[]; public moduleName: string; public referencedFiles: FileReference[]; + public typeReferenceDirectives: FileReference[]; public syntacticDiagnostics: Diagnostic[]; public referenceDiagnostics: Diagnostic[]; public parseDiagnostics: Diagnostic[]; public bindDiagnostics: Diagnostic[]; + public isDeclarationFile: boolean; public isDefaultLib: boolean; public hasNoDefaultLib: boolean; public externalModuleIndicator: Node; // The first node that causes this file to be an external module @@ -805,12 +814,15 @@ namespace ts { public identifierCount: number; public symbolCount: number; public version: string; + public scriptKind: ScriptKind; public languageVersion: ScriptTarget; public languageVariant: LanguageVariant; public identifiers: Map; - public nameTable: Map; + public nameTable: Map; public resolvedModules: Map; + public resolvedTypeReferenceDirectiveNames: Map; public imports: LiteralExpression[]; + public moduleAugmentations: LiteralExpression[]; private namedDeclarations: Map; constructor(kind: SyntaxKind, pos: number, end: number) { @@ -896,6 +908,7 @@ namespace ts { function visit(node: Node): void { switch (node.kind) { case SyntaxKind.FunctionDeclaration: + case SyntaxKind.FunctionExpression: case SyntaxKind.MethodDeclaration: case SyntaxKind.MethodSignature: const functionDeclaration = node; @@ -922,6 +935,7 @@ namespace ts { break; case SyntaxKind.ClassDeclaration: + case SyntaxKind.ClassExpression: case SyntaxKind.InterfaceDeclaration: case SyntaxKind.TypeAliasDeclaration: case SyntaxKind.EnumDeclaration: @@ -936,34 +950,25 @@ namespace ts { case SyntaxKind.SetAccessor: case SyntaxKind.TypeLiteral: addDeclaration(node); - // fall through - case SyntaxKind.Constructor: - case SyntaxKind.VariableStatement: - case SyntaxKind.VariableDeclarationList: - case SyntaxKind.ObjectBindingPattern: - case SyntaxKind.ArrayBindingPattern: - case SyntaxKind.ModuleBlock: forEachChild(node, visit); break; - case SyntaxKind.Block: - if (isFunctionBlock(node)) { - forEachChild(node, visit); - } - break; - case SyntaxKind.Parameter: - // Only consider properties defined as constructor parameters - if (!(node.flags & NodeFlags.AccessibilityModifier)) { + // Only consider parameter properties + if (!(node.flags & NodeFlags.ParameterPropertyModifier)) { break; } // fall through case SyntaxKind.VariableDeclaration: - case SyntaxKind.BindingElement: - if (isBindingPattern((node).name)) { - forEachChild((node).name, visit); + case SyntaxKind.BindingElement: { + const decl = node; + if (isBindingPattern(decl.name)) { + forEachChild(decl.name, visit); break; } + if (decl.initializer) + visit(decl.initializer); + } case SyntaxKind.EnumMember: case SyntaxKind.PropertyDeclaration: case SyntaxKind.PropertySignature: @@ -1000,6 +1005,9 @@ namespace ts { } } break; + + default: + forEachChild(node, visit); } } } @@ -1017,8 +1025,9 @@ namespace ts { getNewLine?(): string; getProjectVersion?(): string; getScriptFileNames(): string[]; + getScriptKind?(fileName: string): ScriptKind; getScriptVersion(fileName: string): string; - getScriptSnapshot(fileName: string): IScriptSnapshot; + getScriptSnapshot(fileName: string): IScriptSnapshot | undefined; getLocalizedDiagnosticMessages?(): any; getCancellationToken?(): HostCancellationToken; getCurrentDirectory(): string; @@ -1034,6 +1043,8 @@ namespace ts { * host specific questions using 'getScriptSnapshot'. */ resolveModuleNames?(moduleNames: string[], containingFile: string): ResolvedModule[]; + resolveTypeReferenceDirectives?(typeDirectiveNames: string[], containingFile: string): ResolvedTypeReferenceDirective[]; + directoryExists?(directoryName: string): boolean; } // @@ -1102,11 +1113,13 @@ namespace ts { getDocCommentTemplateAtPosition(fileName: string, position: number): TextInsertion; + isValidBraceCompletionAtPostion(fileName: string, position: number, openingBrace: number): boolean; + getEmitOutput(fileName: string): EmitOutput; getProgram(): Program; - getSourceFile(fileName: string): SourceFile; + /* @internal */ getNonBoundSourceFile(fileName: string): SourceFile; dispose(): void; } @@ -1217,6 +1230,7 @@ namespace ts { InsertSpaceAfterFunctionKeywordForAnonymousFunctions: boolean; InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean; InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: boolean; + InsertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: boolean; PlaceOpenBraceOnNewLineForFunctions: boolean; PlaceOpenBraceOnNewLineForControlBlocks: boolean; [s: string]: boolean | number | string; @@ -1464,7 +1478,17 @@ namespace ts { fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, - version: string): SourceFile; + 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 @@ -1482,8 +1506,19 @@ namespace ts { fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, - version: string): SourceFile; + 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. * @@ -1495,76 +1530,86 @@ namespace ts { */ releaseDocument(fileName: string, compilationSettings: CompilerOptions): void; + releaseDocumentWithKey(path: Path, key: DocumentRegistryBucketKey): void; + reportStats(): string; } + export type DocumentRegistryBucketKey = string & { __bucketKey: any }; + // TODO: move these to enums export namespace ScriptElementKind { export const unknown = ""; export const warning = "warning"; - // predefined type (void) or keyword (class) + /** predefined type (void) or keyword (class) */ export const keyword = "keyword"; - // top level script node + /** top level script node */ export const scriptElement = "script"; - // module foo {} + /** module foo {} */ export const moduleElement = "module"; - // class X {} + /** class X {} */ export const classElement = "class"; - // var x = class X {} + /** var x = class X {} */ export const localClassElement = "local class"; - // interface Y {} + /** interface Y {} */ export const interfaceElement = "interface"; - // type T = ... + /** type T = ... */ export const typeElement = "type"; - // enum E + /** enum E */ export const enumElement = "enum"; - // Inside module and script only - // const v = .. + /** + * Inside module and script only + * const v = .. + */ export const variableElement = "var"; - // Inside function + /** Inside function */ export const localVariableElement = "local var"; - // Inside module and script only - // function f() { } + /** + * Inside module and script only + * function f() { } + */ export const functionElement = "function"; - // Inside function + /** Inside function */ export const localFunctionElement = "local function"; - // class X { [public|private]* foo() {} } + /** class X { [public|private]* foo() {} } */ export const memberFunctionElement = "method"; - // class X { [public|private]* [get|set] foo:number; } + /** class X { [public|private]* [get|set] foo:number; } */ export const memberGetAccessorElement = "getter"; export const memberSetAccessorElement = "setter"; - // class X { [public|private]* foo:number; } - // interface Y { foo:number; } + /** + * class X { [public|private]* foo:number; } + * interface Y { foo:number; } + */ export const memberVariableElement = "property"; - // class X { constructor() { } } + /** class X { constructor() { } } */ export const constructorImplementationElement = "constructor"; - // interface Y { ():number; } + /** interface Y { ():number; } */ export const callSignatureElement = "call"; - // interface Y { []:number; } + /** interface Y { []:number; } */ export const indexSignatureElement = "index"; - // interface Y { new():Y; } + /** interface Y { new():Y; } */ export const constructSignatureElement = "construct"; - // function foo(*Y*: string) + /** function foo(*Y*: string) */ export const parameterElement = "parameter"; export const typeParameterElement = "type parameter"; @@ -1614,6 +1659,9 @@ namespace ts { public static jsxOpenTagName = "jsx open tag name"; public static jsxCloseTagName = "jsx close tag name"; public static jsxSelfClosingTagName = "jsx self closing tag name"; + public static jsxAttribute = "jsx attribute"; + public static jsxText = "jsx text"; + public static jsxAttributeStringLiteralValue = "jsx attribute string literal value"; } export const enum ClassificationType { @@ -1638,6 +1686,9 @@ namespace ts { jsxOpenTagName = 19, jsxCloseTagName = 20, jsxSelfClosingTagName = 21, + jsxAttribute = 22, + jsxText = 23, + jsxAttributeStringLiteralValue = 24, } /// Language Service @@ -1647,6 +1698,7 @@ namespace ts { hostFileName: string; version: string; scriptSnapshot: IScriptSnapshot; + scriptKind: ScriptKind; } interface DocumentRegistryEntry { @@ -1703,7 +1755,6 @@ namespace ts { // Always default to "ScriptTarget.ES5" for the language service return { target: ScriptTarget.ES5, - module: ModuleKind.None, jsx: JsxEmit.Preserve }; } @@ -1742,7 +1793,8 @@ namespace ts { entry = { hostFileName: fileName, version: this.host.getScriptVersion(fileName), - scriptSnapshot: scriptSnapshot + scriptSnapshot: scriptSnapshot, + scriptKind: getScriptKind(fileName, this.host) }; } @@ -1760,11 +1812,13 @@ namespace ts { public getOrCreateEntry(fileName: string): HostFileInformation { const path = toPath(fileName, this.currentDirectory, this.getCanonicalFileName); - if (this.contains(path)) { - return this.getEntry(path); - } + return this.getOrCreateEntryByPath(fileName, path); + } - return this.createEntry(fileName, path); + public getOrCreateEntryByPath(fileName: string, path: Path): HostFileInformation { + return this.contains(path) + ? this.getEntry(path) + : this.createEntry(fileName, path); } public getRootFileNames(): string[] { @@ -1808,12 +1862,13 @@ namespace ts { throw new Error("Could not find file: '" + fileName + "'."); } + const scriptKind = getScriptKind(fileName, this.host); const version = this.host.getScriptVersion(fileName); let sourceFile: SourceFile; if (this.currentFileName !== fileName) { // This is a new file, just parse it - sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, ScriptTarget.Latest, version, /*setNodeParents*/ true); + sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, ScriptTarget.Latest, version, /*setNodeParents*/ true, scriptKind); } else if (this.currentFileVersion !== version) { // This is the same file, just a newer version. Incrementally parse the file. @@ -1866,6 +1921,9 @@ namespace ts { options.isolatedModules = true; + // transpileModule does not write anything to disk so there is no need to verify that there are no conflicts between input and output paths. + options.suppressOutputPathCheck = true; + // Filename can be non-ts file. options.allowNonTsExtensions = true; @@ -1894,7 +1952,7 @@ namespace ts { // Create a compilerHost object to allow the compiler to read and write files const compilerHost: CompilerHost = { - getSourceFile: (fileName, target) => fileName === normalizeSlashes(inputFileName) ? sourceFile : undefined, + getSourceFile: (fileName, target) => fileName === normalizePath(inputFileName) ? sourceFile : undefined, writeFile: (name, text, writeByteOrderMark) => { if (fileExtensionIs(name, ".map")) { Debug.assert(sourceMapText === undefined, `Unexpected multiple source map outputs for the file '${name}'`); @@ -1911,7 +1969,8 @@ namespace ts { getCurrentDirectory: () => "", getNewLine: () => newLine, fileExists: (fileName): boolean => fileName === inputFileName, - readFile: (fileName): string => "" + readFile: (fileName): string => "", + directoryExists: directoryExists => true }; const program = createProgram([inputFileName], options, compilerHost); @@ -1940,12 +1999,10 @@ namespace ts { return output.outputText; } - export function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile { + export function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean, scriptKind?: ScriptKind): SourceFile { const text = scriptSnapshot.getText(0, scriptSnapshot.getLength()); - const sourceFile = createSourceFile(fileName, text, scriptTarget, setNodeParents); + const sourceFile = createSourceFile(fileName, text, scriptTarget, setNodeParents, scriptKind); setSourceFileFields(sourceFile, scriptSnapshot, version); - // after full parsing we can use table with interned strings as name table - sourceFile.nameTable = sourceFile.identifiers; return sourceFile; } @@ -2006,28 +2063,20 @@ namespace ts { } // Otherwise, just create a new source file. - return createLanguageServiceSourceFile(sourceFile.fileName, scriptSnapshot, sourceFile.languageVersion, version, /*setNodeParents*/ true); + return createLanguageServiceSourceFile(sourceFile.fileName, scriptSnapshot, sourceFile.languageVersion, version, /*setNodeParents*/ true, sourceFile.scriptKind); } - export function createGetCanonicalFileName(useCaseSensitivefileNames: boolean): (fileName: string) => string { - return useCaseSensitivefileNames - ? ((fileName) => fileName) - : ((fileName) => fileName.toLowerCase()); - } - - export function createDocumentRegistry(useCaseSensitiveFileNames?: boolean, currentDirectory = ""): DocumentRegistry { // Maps from compiler setting target (ES3, ES5, etc.) to all the cached documents we have // for those settings. const buckets: Map> = {}; const getCanonicalFileName = createGetCanonicalFileName(!!useCaseSensitiveFileNames); - function getKeyFromCompilationSettings(settings: CompilerOptions): string { - return "_" + settings.target + "|" + settings.module + "|" + settings.noResolve + "|" + settings.jsx + +"|" + settings.allowJs; + function getKeyForCompilationSettings(settings: CompilerOptions): DocumentRegistryBucketKey { + return `_${settings.target}|${settings.module}|${settings.noResolve}|${settings.jsx}|${settings.allowJs}|${settings.baseUrl}|${settings.typesRoot}|${settings.typesSearchPaths}|${JSON.stringify(settings.rootDirs)}|${JSON.stringify(settings.paths)}`; } - function getBucketForCompilationSettings(settings: CompilerOptions, createIfMissing: boolean): FileMap { - const key = getKeyFromCompilationSettings(settings); + function getBucketForCompilationSettings(key: DocumentRegistryBucketKey, createIfMissing: boolean): FileMap { let bucket = lookUp(buckets, key); if (!bucket && createIfMissing) { buckets[key] = bucket = createFileMap(); @@ -2055,29 +2104,43 @@ namespace ts { return JSON.stringify(bucketInfoArray, undefined, 2); } - function acquireDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string): SourceFile { - return acquireOrUpdateDocument(fileName, compilationSettings, scriptSnapshot, version, /*acquiring*/ true); + function acquireDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, scriptKind?: ScriptKind): SourceFile { + const path = toPath(fileName, currentDirectory, getCanonicalFileName); + const key = getKeyForCompilationSettings(compilationSettings); + return acquireDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind); } - function updateDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string): SourceFile { - return acquireOrUpdateDocument(fileName, compilationSettings, scriptSnapshot, version, /*acquiring*/ false); + function acquireDocumentWithKey(fileName: string, path: Path, compilationSettings: CompilerOptions, key: DocumentRegistryBucketKey, scriptSnapshot: IScriptSnapshot, version: string, scriptKind?: ScriptKind): SourceFile { + return acquireOrUpdateDocument(fileName, path, compilationSettings, key, scriptSnapshot, version, /*acquiring*/ true, scriptKind); + } + + function updateDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, scriptKind?: ScriptKind): SourceFile { + const path = toPath(fileName, currentDirectory, getCanonicalFileName); + const key = getKeyForCompilationSettings(compilationSettings); + return updateDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind); + } + + function updateDocumentWithKey(fileName: string, path: Path, compilationSettings: CompilerOptions, key: DocumentRegistryBucketKey, scriptSnapshot: IScriptSnapshot, version: string, scriptKind?: ScriptKind): SourceFile { + return acquireOrUpdateDocument(fileName, path, compilationSettings, key, scriptSnapshot, version, /*acquiring*/ false, scriptKind); } function acquireOrUpdateDocument( fileName: string, + path: Path, compilationSettings: CompilerOptions, + key: DocumentRegistryBucketKey, scriptSnapshot: IScriptSnapshot, version: string, - acquiring: boolean): SourceFile { + acquiring: boolean, + scriptKind?: ScriptKind): SourceFile { - const bucket = getBucketForCompilationSettings(compilationSettings, /*createIfMissing*/ true); - const path = toPath(fileName, currentDirectory, getCanonicalFileName); + const bucket = getBucketForCompilationSettings(key, /*createIfMissing*/ true); let entry = bucket.get(path); if (!entry) { Debug.assert(acquiring, "How could we be trying to update a document that the registry doesn't have?"); // Have never seen this file with these settings. Create a new source file for it. - const sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, compilationSettings.target, version, /*setNodeParents*/ false); + const sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, compilationSettings.target, version, /*setNodeParents*/ false, scriptKind); entry = { sourceFile: sourceFile, @@ -2109,10 +2172,14 @@ namespace ts { } function releaseDocument(fileName: string, compilationSettings: CompilerOptions): void { - const bucket = getBucketForCompilationSettings(compilationSettings, /*createIfMissing*/false); - Debug.assert(bucket !== undefined); - const path = toPath(fileName, currentDirectory, getCanonicalFileName); + const key = getKeyForCompilationSettings(compilationSettings); + return releaseDocumentWithKey(path, key); + } + + function releaseDocumentWithKey(path: Path, key: DocumentRegistryBucketKey): void { + const bucket = getBucketForCompilationSettings(key, /*createIfMissing*/false); + Debug.assert(bucket !== undefined); const entry = bucket.get(path); entry.languageServiceRefCount--; @@ -2125,17 +2192,37 @@ namespace ts { return { acquireDocument, + acquireDocumentWithKey, updateDocument, + updateDocumentWithKey, releaseDocument, - reportStats + releaseDocumentWithKey, + reportStats, + getKeyForCompilationSettings }; } export function preProcessFile(sourceText: string, readImportFiles = true, detectJavaScriptImports = false): PreProcessedFileInfo { const referencedFiles: FileReference[] = []; + const typeReferenceDirectives: FileReference[] = []; const importedFiles: FileReference[] = []; - let ambientExternalModules: string[]; + let ambientExternalModules: { ref: FileReference, depth: number }[]; let isNoDefaultLib = false; + let braceNesting = 0; + // assume that text represent an external module if it contains at least one top level import/export + // ambient modules that are found inside external modules are interpreted as module augmentations + let externalModule = false; + + function nextToken() { + const token = scanner.scan(); + if (token === SyntaxKind.OpenBraceToken) { + braceNesting++; + } + else if (token === SyntaxKind.CloseBraceToken) { + braceNesting--; + } + return token; + } function processTripleSlashDirectives(): void { const commentRanges = getLeadingCommentRanges(sourceText, 0); @@ -2146,27 +2233,43 @@ namespace ts { isNoDefaultLib = referencePathMatchResult.isNoDefaultLib; const fileReference = referencePathMatchResult.fileReference; if (fileReference) { - referencedFiles.push(fileReference); + const collection = referencePathMatchResult.isTypeReferenceDirective + ? typeReferenceDirectives + : referencedFiles; + + collection.push(fileReference); } } }); } + function getFileReference() { + const file = scanner.getTokenValue(); + const pos = scanner.getTokenPos(); + return { + fileName: file, + pos: pos, + end: pos + file.length + }; + } + function recordAmbientExternalModule(): void { if (!ambientExternalModules) { ambientExternalModules = []; } - ambientExternalModules.push(scanner.getTokenValue()); + ambientExternalModules.push({ ref: getFileReference(), depth: braceNesting }); } function recordModuleName() { - const importPath = scanner.getTokenValue(); - const pos = scanner.getTokenPos(); - importedFiles.push({ - fileName: importPath, - pos: pos, - end: pos + importPath.length - }); + importedFiles.push(getFileReference()); + + markAsExternalModuleIfTopLevel(); + } + + function markAsExternalModuleIfTopLevel() { + if (braceNesting === 0) { + externalModule = true; + } } /** @@ -2176,9 +2279,9 @@ namespace ts { let token = scanner.getToken(); if (token === SyntaxKind.DeclareKeyword) { // declare module "mod" - token = scanner.scan(); + token = nextToken(); if (token === SyntaxKind.ModuleKeyword) { - token = scanner.scan(); + token = nextToken(); if (token === SyntaxKind.StringLiteral) { recordAmbientExternalModule(); } @@ -2195,7 +2298,8 @@ namespace ts { function tryConsumeImport(): boolean { let token = scanner.getToken(); if (token === SyntaxKind.ImportKeyword) { - token = scanner.scan(); + + token = nextToken(); if (token === SyntaxKind.StringLiteral) { // import "mod"; recordModuleName(); @@ -2203,9 +2307,9 @@ namespace ts { } else { if (token === SyntaxKind.Identifier || isKeyword(token)) { - token = scanner.scan(); + token = nextToken(); if (token === SyntaxKind.FromKeyword) { - token = scanner.scan(); + token = nextToken(); if (token === SyntaxKind.StringLiteral) { // import d from "mod"; recordModuleName(); @@ -2219,7 +2323,7 @@ namespace ts { } else if (token === SyntaxKind.CommaToken) { // consume comma and keep going - token = scanner.scan(); + token = nextToken(); } else { // unknown syntax @@ -2228,17 +2332,17 @@ namespace ts { } if (token === SyntaxKind.OpenBraceToken) { - token = scanner.scan(); + token = nextToken(); // consume "{ a as B, c, d as D}" clauses // make sure that it stops on EOF while (token !== SyntaxKind.CloseBraceToken && token !== SyntaxKind.EndOfFileToken) { - token = scanner.scan(); + token = nextToken(); } if (token === SyntaxKind.CloseBraceToken) { - token = scanner.scan(); + token = nextToken(); if (token === SyntaxKind.FromKeyword) { - token = scanner.scan(); + token = nextToken(); if (token === SyntaxKind.StringLiteral) { // import {a as A} from "mod"; // import d, {a, b as B} from "mod" @@ -2248,13 +2352,13 @@ namespace ts { } } else if (token === SyntaxKind.AsteriskToken) { - token = scanner.scan(); + token = nextToken(); if (token === SyntaxKind.AsKeyword) { - token = scanner.scan(); + token = nextToken(); if (token === SyntaxKind.Identifier || isKeyword(token)) { - token = scanner.scan(); + token = nextToken(); if (token === SyntaxKind.FromKeyword) { - token = scanner.scan(); + token = nextToken(); if (token === SyntaxKind.StringLiteral) { // import * as NS from "mod" // import d, * as NS from "mod" @@ -2275,19 +2379,20 @@ namespace ts { function tryConsumeExport(): boolean { let token = scanner.getToken(); if (token === SyntaxKind.ExportKeyword) { - token = scanner.scan(); + markAsExternalModuleIfTopLevel(); + token = nextToken(); if (token === SyntaxKind.OpenBraceToken) { - token = scanner.scan(); + token = nextToken(); // consume "{ a as B, c, d as D}" clauses // make sure it stops on EOF while (token !== SyntaxKind.CloseBraceToken && token !== SyntaxKind.EndOfFileToken) { - token = scanner.scan(); + token = nextToken(); } if (token === SyntaxKind.CloseBraceToken) { - token = scanner.scan(); + token = nextToken(); if (token === SyntaxKind.FromKeyword) { - token = scanner.scan(); + token = nextToken(); if (token === SyntaxKind.StringLiteral) { // export {a as A} from "mod"; // export {a, b as B} from "mod" @@ -2297,9 +2402,9 @@ namespace ts { } } else if (token === SyntaxKind.AsteriskToken) { - token = scanner.scan(); + token = nextToken(); if (token === SyntaxKind.FromKeyword) { - token = scanner.scan(); + token = nextToken(); if (token === SyntaxKind.StringLiteral) { // export * from "mod" recordModuleName(); @@ -2307,9 +2412,9 @@ namespace ts { } } else if (token === SyntaxKind.ImportKeyword) { - token = scanner.scan(); + token = nextToken(); if (token === SyntaxKind.Identifier || isKeyword(token)) { - token = scanner.scan(); + token = nextToken(); if (token === SyntaxKind.EqualsToken) { if (tryConsumeRequireCall(/*skipCurrentToken*/ true)) { return true; @@ -2325,11 +2430,11 @@ namespace ts { } function tryConsumeRequireCall(skipCurrentToken: boolean): boolean { - let token = skipCurrentToken ? scanner.scan() : scanner.getToken(); + let token = skipCurrentToken ? nextToken() : scanner.getToken(); if (token === SyntaxKind.RequireKeyword) { - token = scanner.scan(); + token = nextToken(); if (token === SyntaxKind.OpenParenToken) { - token = scanner.scan(); + token = nextToken(); if (token === SyntaxKind.StringLiteral) { // require("mod"); recordModuleName(); @@ -2343,17 +2448,17 @@ namespace ts { function tryConsumeDefine(): boolean { let token = scanner.getToken(); if (token === SyntaxKind.Identifier && scanner.getTokenValue() === "define") { - token = scanner.scan(); + token = nextToken(); if (token !== SyntaxKind.OpenParenToken) { return true; } - token = scanner.scan(); + token = nextToken(); if (token === SyntaxKind.StringLiteral) { // looks like define ("modname", ... - skip string literal and comma - token = scanner.scan(); + token = nextToken(); if (token === SyntaxKind.CommaToken) { - token = scanner.scan(); + token = nextToken(); } else { // unexpected token @@ -2367,7 +2472,7 @@ namespace ts { } // skip open bracket - token = scanner.scan(); + token = nextToken(); let i = 0; // scan until ']' or EOF while (token !== SyntaxKind.CloseBracketToken && token !== SyntaxKind.EndOfFileToken) { @@ -2377,7 +2482,7 @@ namespace ts { i++; } - token = scanner.scan(); + token = nextToken(); } return true; @@ -2387,7 +2492,7 @@ namespace ts { function processImports(): void { scanner.setText(sourceText); - scanner.scan(); + nextToken(); // Look for: // import "mod"; // import d from "mod" @@ -2414,7 +2519,7 @@ namespace ts { continue; } else { - scanner.scan(); + nextToken(); } } @@ -2425,7 +2530,34 @@ namespace ts { processImports(); } processTripleSlashDirectives(); - return { referencedFiles, importedFiles, isLibFile: isNoDefaultLib, ambientExternalModules }; + if (externalModule) { + // for external modules module all nested ambient modules are augmentations + if (ambientExternalModules) { + // move all detected ambient modules to imported files since they need to be resolved + for (const decl of ambientExternalModules) { + importedFiles.push(decl.ref); + } + } + return { referencedFiles, typeReferenceDirectives, importedFiles, isLibFile: isNoDefaultLib, ambientExternalModules: undefined }; + } + else { + // for global scripts ambient modules still can have augmentations - look for ambient modules with depth > 0 + let ambientModuleNames: string[]; + if (ambientExternalModules) { + for (const decl of ambientExternalModules) { + if (decl.depth === 0) { + if (!ambientModuleNames) { + ambientModuleNames = []; + } + ambientModuleNames.push(decl.ref.fileName); + } + else { + importedFiles.push(decl.ref); + } + } + } + return { referencedFiles, typeReferenceDirectives, importedFiles, isLibFile: isNoDefaultLib, ambientExternalModules: ambientModuleNames }; + } } /// Helpers @@ -2500,10 +2632,33 @@ namespace ts { isFunctionLike(node.parent) && (node.parent).name === node; } - /** Returns true if node is a name of an object literal property, e.g. "a" in x = { "a": 1 } */ - function isNameOfPropertyAssignment(node: Node): boolean { - return (node.kind === SyntaxKind.Identifier || node.kind === SyntaxKind.StringLiteral || node.kind === SyntaxKind.NumericLiteral) && - (node.parent.kind === SyntaxKind.PropertyAssignment || node.parent.kind === SyntaxKind.ShorthandPropertyAssignment) && (node.parent).name === node; + function isObjectLiteralPropertyDeclaration(node: Node): node is ObjectLiteralElement { + switch (node.kind) { + case SyntaxKind.PropertyAssignment: + case SyntaxKind.ShorthandPropertyAssignment: + case SyntaxKind.MethodDeclaration: + case SyntaxKind.GetAccessor: + case SyntaxKind.SetAccessor: + return true; + } + return false; + } + + /** + * Returns the containing object literal property declaration given a possible name node, e.g. "a" in x = { "a": 1 } + */ + function getContainingObjectLiteralElement(node: Node): ObjectLiteralElement { + switch (node.kind) { + case SyntaxKind.StringLiteral: + case SyntaxKind.NumericLiteral: + if (node.parent.kind === SyntaxKind.ComputedPropertyName) { + return isObjectLiteralPropertyDeclaration(node.parent.parent) ? node.parent.parent : undefined; + } + // intential fall through + case SyntaxKind.Identifier: + return isObjectLiteralPropertyDeclaration(node.parent) && node.parent.name === node ? node.parent : undefined; + } + return undefined; } function isLiteralNameOfPropertyDeclarationOrIndexAccess(node: Node): boolean { @@ -2521,6 +2676,8 @@ namespace ts { return (node.parent).name === node; case SyntaxKind.ElementAccessExpression: return (node.parent).argumentExpression === node; + case SyntaxKind.ComputedPropertyName: + return true; } } @@ -2619,7 +2776,9 @@ namespace ts { /* @internal */ export function getNodeKind(node: Node): string { switch (node.kind) { case SyntaxKind.ModuleDeclaration: return ScriptElementKind.moduleElement; - case SyntaxKind.ClassDeclaration: return ScriptElementKind.classElement; + case SyntaxKind.ClassDeclaration: + case SyntaxKind.ClassExpression: + return ScriptElementKind.classElement; case SyntaxKind.InterfaceDeclaration: return ScriptElementKind.interfaceElement; case SyntaxKind.TypeAliasDeclaration: return ScriptElementKind.typeElement; case SyntaxKind.EnumDeclaration: return ScriptElementKind.enumElement; @@ -2629,7 +2788,9 @@ namespace ts { : isLet(node) ? ScriptElementKind.letElement : ScriptElementKind.variableElement; - case SyntaxKind.FunctionDeclaration: return ScriptElementKind.functionElement; + case SyntaxKind.FunctionDeclaration: + case SyntaxKind.FunctionExpression: + return ScriptElementKind.functionElement; case SyntaxKind.GetAccessor: return ScriptElementKind.memberGetAccessorElement; case SyntaxKind.SetAccessor: return ScriptElementKind.memberSetAccessorElement; case SyntaxKind.MethodDeclaration: @@ -2644,7 +2805,7 @@ namespace ts { case SyntaxKind.Constructor: return ScriptElementKind.constructorImplementationElement; case SyntaxKind.TypeParameter: return ScriptElementKind.typeParameterElement; case SyntaxKind.EnumMember: return ScriptElementKind.variableElement; - case SyntaxKind.Parameter: return (node.flags & NodeFlags.AccessibilityModifier) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; + case SyntaxKind.Parameter: return (node.flags & NodeFlags.ParameterPropertyModifier) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; case SyntaxKind.ImportEqualsDeclaration: case SyntaxKind.ImportSpecifier: case SyntaxKind.ImportClause: @@ -2752,6 +2913,7 @@ namespace ts { // Now create a new compiler const compilerHost: CompilerHost = { getSourceFile: getOrCreateSourceFile, + getSourceFileByPath: getOrCreateSourceFileByPath, getCancellationToken: () => cancellationToken, getCanonicalFileName, useCaseSensitiveFileNames: () => useCaseSensitivefileNames, @@ -2761,29 +2923,43 @@ namespace ts { getCurrentDirectory: () => currentDirectory, fileExists: (fileName): boolean => { // stub missing host functionality - Debug.assert(!host.resolveModuleNames); + Debug.assert(!host.resolveModuleNames || !host.resolveTypeReferenceDirectives); return hostCache.getOrCreateEntry(fileName) !== undefined; }, readFile: (fileName): string => { // stub missing host functionality const entry = hostCache.getOrCreateEntry(fileName); return entry && entry.scriptSnapshot.getText(0, entry.scriptSnapshot.getLength()); + }, + directoryExists: directoryName => { + Debug.assert(!host.resolveModuleNames || !host.resolveTypeReferenceDirectives); + return directoryProbablyExists(directoryName, host); } }; + if (host.trace) { + compilerHost.trace = message => host.trace(message); + } if (host.resolveModuleNames) { compilerHost.resolveModuleNames = (moduleNames, containingFile) => host.resolveModuleNames(moduleNames, containingFile); } + if (host.resolveTypeReferenceDirectives) { + compilerHost.resolveTypeReferenceDirectives = (typeReferenceDirectiveNames, containingFile) => { + return host.resolveTypeReferenceDirectives(typeReferenceDirectiveNames, containingFile); + }; + } + const documentRegistryBucketKey = documentRegistry.getKeyForCompilationSettings(newSettings); const newProgram = createProgram(hostCache.getRootFileNames(), newSettings, compilerHost, program); // Release any files we have acquired in the old program but are // not part of the new program. if (program) { const oldSourceFiles = program.getSourceFiles(); + const oldSettingsKey = documentRegistry.getKeyForCompilationSettings(oldSettings); for (const oldSourceFile of oldSourceFiles) { if (!newProgram.getSourceFile(oldSourceFile.fileName) || changesInCompilationSettingsAffectSyntax) { - documentRegistry.releaseDocument(oldSourceFile.fileName, oldSettings); + documentRegistry.releaseDocumentWithKey(oldSourceFile.path, oldSettingsKey); } } } @@ -2800,25 +2976,29 @@ namespace ts { return; function getOrCreateSourceFile(fileName: string): SourceFile { + return getOrCreateSourceFileByPath(fileName, toPath(fileName, currentDirectory, getCanonicalFileName)); + } + + function getOrCreateSourceFileByPath(fileName: string, path: Path): SourceFile { Debug.assert(hostCache !== undefined); // The program is asking for this file, check first if the host can locate it. // If the host can not locate the file, then it does not exist. return undefined // to the program to allow reporting of errors for missing files. - const hostFileInformation = hostCache.getOrCreateEntry(fileName); + const hostFileInformation = hostCache.getOrCreateEntryByPath(fileName, path); if (!hostFileInformation) { return undefined; } // Check if the language version has changed since we last created a program; if they are the same, - // it is safe to reuse the souceFiles; if not, then the shape of the AST can change, and the oldSourceFile + // it is safe to reuse the sourceFiles; if not, then the shape of the AST can change, and the oldSourceFile // can not be reused. we have to dump all syntax trees and create new ones. if (!changesInCompilationSettingsAffectSyntax) { // Check if the old program had this file already - const oldSourceFile = program && program.getSourceFile(fileName); + const oldSourceFile = program && program.getSourceFileByPath(path); if (oldSourceFile) { // We already had a source file for this file name. Go to the registry to // ensure that we get the right up to date version of it. We need this to - // address the following 'race'. Specifically, say we have the following: + // address the following race-condition. Specifically, say we have the following: // // LS1 // \ @@ -2837,14 +3017,20 @@ namespace ts { // it's source file any more, and instead defers to DocumentRegistry to get // either version 1, version 2 (or some other version) depending on what the // host says should be used. - return documentRegistry.updateDocument(fileName, newSettings, hostFileInformation.scriptSnapshot, hostFileInformation.version); + + // We do not support the scenario where a host can modify a registered + // file's script kind, i.e. in one project some file is treated as ".ts" + // and in another as ".js" + Debug.assert(hostFileInformation.scriptKind === oldSourceFile.scriptKind, "Registered script kind (" + oldSourceFile.scriptKind + ") should match new script kind (" + hostFileInformation.scriptKind + ") for file: " + path); + + return documentRegistry.updateDocumentWithKey(fileName, path, newSettings, documentRegistryBucketKey, hostFileInformation.scriptSnapshot, hostFileInformation.version, hostFileInformation.scriptKind); } // We didn't already have the file. Fall through and acquire it from the registry. } // Could not find this file in the old program, create a new SourceFile for it. - return documentRegistry.acquireDocument(fileName, newSettings, hostFileInformation.scriptSnapshot, hostFileInformation.version); + return documentRegistry.acquireDocumentWithKey(fileName, path, newSettings, documentRegistryBucketKey, hostFileInformation.scriptSnapshot, hostFileInformation.version, hostFileInformation.scriptKind); } function sourceFileUpToDate(sourceFile: SourceFile): boolean { @@ -2904,7 +3090,7 @@ namespace ts { } /** - * getSemanticDiagnostiscs return array of Diagnostics. If '-d' is not enabled, only report semantic errors + * getSemanticDiagnostics return array of Diagnostics. If '-d' is not enabled, only report semantic errors * If '-d' enabled, report both semantic and emitter errors */ function getSemanticDiagnostics(fileName: string): Diagnostic[] { @@ -2972,15 +3158,9 @@ namespace ts { // e.g "b a" is valid quoted name but when we strip off the quotes, it is invalid. // We, thus, need to check if whatever was inside the quotes is actually a valid identifier name. if (performCharacterChecks) { - if (!isIdentifierStart(name.charCodeAt(0), target)) { + if (!isIdentifier(name, target)) { return undefined; } - - for (let i = 1, n = name.length; i < n; i++) { - if (!isIdentifierPart(name.charCodeAt(i), target)) { - return undefined; - } - } } return name; @@ -3098,6 +3278,7 @@ namespace ts { } else if (kind === SyntaxKind.SlashToken && contextToken.parent.kind === SyntaxKind.JsxClosingElement) { isStartingCloseTag = true; + location = contextToken; } } } @@ -3113,7 +3294,7 @@ namespace ts { else if (isRightOfOpenTag) { const tagSymbols = typeChecker.getJsxIntrinsicTagNames(); if (tryGetGlobalSymbols()) { - symbols = tagSymbols.concat(symbols.filter(s => !!(s.flags & SymbolFlags.Value))); + symbols = tagSymbols.concat(symbols.filter(s => !!(s.flags & (SymbolFlags.Value | SymbolFlags.Alias)))); } else { symbols = tagSymbols; @@ -3123,8 +3304,11 @@ namespace ts { } else if (isStartingCloseTag) { const tagName = (contextToken.parent.parent).openingElement.tagName; - symbols = [typeChecker.getSymbolAtLocation(tagName)]; + const tagSymbol = typeChecker.getSymbolAtLocation(tagName); + if (!typeChecker.isUnknownSymbol(tagSymbol)) { + symbols = [tagSymbol]; + } isMemberCompletion = true; isNewIdentifierLocation = false; } @@ -3424,7 +3608,18 @@ namespace ts { // We don't want to complete using the type acquired by the shape // of the binding pattern; we are only interested in types acquired // through type declaration or inference. - if (rootDeclaration.initializer || rootDeclaration.type) { + // Also proceed if rootDeclaration is parameter and if its containing function expression\arrow function is contextually typed - + // type of parameter will flow in from the contextual type of the function + let canGetType = !!(rootDeclaration.initializer || rootDeclaration.type); + if (!canGetType && rootDeclaration.kind === SyntaxKind.Parameter) { + if (isExpression(rootDeclaration.parent)) { + canGetType = !!typeChecker.getContextualType(rootDeclaration.parent); + } + else if (rootDeclaration.parent.kind === SyntaxKind.MethodDeclaration || rootDeclaration.parent.kind === SyntaxKind.SetAccessor) { + canGetType = isExpression(rootDeclaration.parent.parent) && !!typeChecker.getContextualType(rootDeclaration.parent.parent); + } + } + if (canGetType) { typeForObject = typeChecker.getTypeAtLocation(objectLikeContainer); existingMembers = (objectLikeContainer).elements; } @@ -3715,7 +3910,7 @@ namespace ts { * do not occur at the current position and have not otherwise been typed. */ function filterNamedImportOrExportCompletionItems(exportsOfModule: Symbol[], namedImportsOrExports: ImportOrExportSpecifier[]): Symbol[] { - const exisingImportsOrExports: Map = {}; + const existingImportsOrExports: Map = {}; for (const element of namedImportsOrExports) { // If this is the current item we are editing right now, do not filter it out @@ -3724,14 +3919,14 @@ namespace ts { } const name = element.propertyName || element.name; - exisingImportsOrExports[name.text] = true; + existingImportsOrExports[name.text] = true; } - if (isEmpty(exisingImportsOrExports)) { - return exportsOfModule; + if (isEmpty(existingImportsOrExports)) { + return filter(exportsOfModule, e => e.name !== "default"); } - return filter(exportsOfModule, e => !lookUp(exisingImportsOrExports, e.name)); + return filter(exportsOfModule, e => e.name !== "default" && !lookUp(existingImportsOrExports, e.name)); } /** @@ -3813,7 +4008,7 @@ namespace ts { return undefined; } - const { symbols, isMemberCompletion, isNewIdentifierLocation, location, isRightOfDot, isJsDocTagName } = completionData; + const { symbols, isMemberCompletion, isNewIdentifierLocation, location, isJsDocTagName } = completionData; if (isJsDocTagName) { // If the current position is a jsDoc tag name, only tag names should be provided for completion @@ -3824,13 +4019,29 @@ namespace ts { const entries: CompletionEntry[] = []; - if (isRightOfDot && isSourceFileJavaScript(sourceFile)) { + if (isSourceFileJavaScript(sourceFile)) { const uniqueNames = getCompletionEntriesFromSymbols(symbols, entries); - addRange(entries, getJavaScriptCompletionEntries(sourceFile, uniqueNames)); + addRange(entries, getJavaScriptCompletionEntries(sourceFile, location.pos, uniqueNames)); } else { if (!symbols || symbols.length === 0) { - return undefined; + if (sourceFile.languageVariant === LanguageVariant.JSX && + location.parent && location.parent.kind === SyntaxKind.JsxClosingElement) { + // In the TypeScript JSX element, if such element is not defined. When users query for completion at closing tag, + // instead of simply giving unknown value, the completion will return the tag-name of an associated opening-element. + // For example: + // var x =
completion list at "1" will contain "div" with type any + const tagName = (location.parent.parent).openingElement.tagName; + entries.push({ + name: (tagName).text, + kind: undefined, + kindModifiers: undefined, + sortText: "0", + }); + } + else { + return undefined; + } } getCompletionEntriesFromSymbols(symbols, entries); @@ -3843,12 +4054,17 @@ namespace ts { return { isMemberCompletion, isNewIdentifierLocation, entries }; - function getJavaScriptCompletionEntries(sourceFile: SourceFile, uniqueNames: Map): CompletionEntry[] { + function getJavaScriptCompletionEntries(sourceFile: SourceFile, position: number, uniqueNames: Map): CompletionEntry[] { const entries: CompletionEntry[] = []; const target = program.getCompilerOptions().target; const nameTable = getNameTable(sourceFile); for (const name in nameTable) { + // Skip identifiers produced only from the current location + if (nameTable[name] === position) { + continue; + } + if (!uniqueNames[name]) { uniqueNames[name] = name; const displayName = getCompletionEntryDisplayName(name, target, /*performCharacterChecks*/ true); @@ -3997,6 +4213,9 @@ namespace ts { if (typeChecker.isArgumentsSymbol(symbol)) { return ScriptElementKind.localVariableElement; } + if (location.kind === SyntaxKind.ThisKeyword && isExpression(location)) { + return ScriptElementKind.parameterElement; + } if (flags & SymbolFlags.Variable) { if (isFirstDeclarationOfSymbolParameter(symbol)) { return ScriptElementKind.parameterElement; @@ -4059,6 +4278,7 @@ namespace ts { const symbolFlags = symbol.flags; let symbolKind = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(symbol, symbolFlags, location); let hasAddedSymbolInfo: boolean; + const isThisExpression: boolean = location.kind === SyntaxKind.ThisKeyword && isExpression(location); let type: Type; // Class at constructor site need to be shown as constructor apart from property,method, vars @@ -4069,7 +4289,7 @@ namespace ts { } let signature: Signature; - type = typeChecker.getTypeOfSymbolAtLocation(symbol, location); + type = isThisExpression ? typeChecker.getTypeAtLocation(location) : typeChecker.getTypeOfSymbolAtLocation(symbol, location); if (type) { if (location.parent && location.parent.kind === SyntaxKind.PropertyAccessExpression) { const right = (location.parent).name; @@ -4139,7 +4359,7 @@ namespace ts { displayParts.push(keywordPart(SyntaxKind.NewKeyword)); displayParts.push(spacePart()); } - if (!(type.flags & TypeFlags.Anonymous)) { + if (!(type.flags & TypeFlags.Anonymous) && type.symbol) { addRange(displayParts, symbolToDisplayParts(typeChecker, type.symbol, enclosingDeclaration, /*meaning*/ undefined, SymbolFormatFlags.WriteTypeParametersOrArguments)); } addSignatureDisplayParts(signature, allSignatures, TypeFormatFlags.WriteArrowStyleSignature); @@ -4156,7 +4376,7 @@ namespace ts { (location.kind === SyntaxKind.ConstructorKeyword && location.parent.kind === SyntaxKind.Constructor)) { // At constructor keyword of constructor declaration // get the signature from the declaration and write it const functionDeclaration = location.parent; - const allSignatures = functionDeclaration.kind === SyntaxKind.Constructor ? type.getConstructSignatures() : type.getCallSignatures(); + const allSignatures = functionDeclaration.kind === SyntaxKind.Constructor ? type.getNonNullableType().getConstructSignatures() : type.getNonNullableType().getCallSignatures(); if (!typeChecker.isImplementationOfOverload(functionDeclaration)) { signature = typeChecker.getSignatureFromDeclaration(functionDeclaration); } @@ -4180,7 +4400,7 @@ namespace ts { } } } - if (symbolFlags & SymbolFlags.Class && !hasAddedSymbolInfo) { + if (symbolFlags & SymbolFlags.Class && !hasAddedSymbolInfo && !isThisExpression) { if (getDeclarationOfKind(symbol, SyntaxKind.ClassExpression)) { // Special case for class expressions because we would like to indicate that // the class name is local to the class body (similar to function expression) @@ -4322,11 +4542,19 @@ namespace ts { if (!hasAddedSymbolInfo) { if (symbolKind !== ScriptElementKind.unknown) { if (type) { - addPrefixForAnyFunctionOrVar(symbol, symbolKind); + if (isThisExpression) { + addNewLineIfDisplayPartsExist(); + displayParts.push(keywordPart(SyntaxKind.ThisKeyword)); + } + else { + addPrefixForAnyFunctionOrVar(symbol, symbolKind); + } + // For properties, variables and local vars: show the type if (symbolKind === ScriptElementKind.memberVariableElement || symbolFlags & SymbolFlags.Variable || - symbolKind === ScriptElementKind.localVariableElement) { + symbolKind === ScriptElementKind.localVariableElement || + isThisExpression) { displayParts.push(punctuationPart(SyntaxKind.ColonToken)); displayParts.push(spacePart()); // If the type is type parameter, format it specially @@ -4346,7 +4574,7 @@ namespace ts { symbolFlags & SymbolFlags.Signature || symbolFlags & SymbolFlags.Accessor || symbolKind === ScriptElementKind.memberFunctionElement) { - const allSignatures = type.getCallSignatures(); + const allSignatures = type.getNonNullableType().getCallSignatures(); addSignatureDisplayParts(allSignatures[0], allSignatures); } } @@ -4427,7 +4655,7 @@ namespace ts { const sourceFile = getValidSourceFile(fileName); const node = getTouchingPropertyName(sourceFile, position); - if (!node) { + if (node === sourceFile) { return undefined; } @@ -4438,7 +4666,7 @@ namespace ts { const typeChecker = program.getTypeChecker(); const symbol = typeChecker.getSymbolAtLocation(node); - if (!symbol) { + if (!symbol || typeChecker.isUnknownSymbol(symbol)) { // Try getting just type at this position and show switch (node.kind) { case SyntaxKind.Identifier: @@ -4558,14 +4786,54 @@ namespace ts { } } + function findReferenceInPosition(refs: FileReference[], pos: number): FileReference { + for (const ref of refs) { + if (ref.pos <= pos && pos < ref.end) { + return ref; + } + } + return undefined; + } + + function getDefinitionInfoForFileReference(name: string, targetFileName: string): DefinitionInfo { + return { + fileName: targetFileName, + textSpan: createTextSpanFromBounds(0, 0), + kind: ScriptElementKind.scriptElement, + name: name, + containerName: undefined, + containerKind: undefined + }; + } + /// Goto definition function getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[] { synchronizeHostData(); const sourceFile = getValidSourceFile(fileName); + /// Triple slash reference comments + const comment = findReferenceInPosition(sourceFile.referencedFiles, position); + if (comment) { + const referenceFile = tryResolveScriptReference(program, sourceFile, comment); + if (referenceFile) { + return [getDefinitionInfoForFileReference(comment.fileName, referenceFile.fileName)]; + } + return undefined; + } + + // Type reference directives + const typeReferenceDirective = findReferenceInPosition(sourceFile.typeReferenceDirectives, position); + if (typeReferenceDirective) { + const referenceFile = lookUp(program.getResolvedTypeReferenceDirectives(), typeReferenceDirective.fileName); + if (referenceFile && referenceFile.resolvedFileName) { + return [getDefinitionInfoForFileReference(typeReferenceDirective.fileName, referenceFile.resolvedFileName)]; + } + return undefined; + } + const node = getTouchingPropertyName(sourceFile, position); - if (!node) { + if (node === sourceFile) { return undefined; } @@ -4576,23 +4844,6 @@ namespace ts { return label ? [createDefinitionInfo(label, ScriptElementKind.label, labelName, /*containerName*/ undefined)] : undefined; } - /// Triple slash reference comments - const comment = forEach(sourceFile.referencedFiles, r => (r.pos <= position && position < r.end) ? r : undefined); - if (comment) { - const referenceFile = tryResolveScriptReference(program, sourceFile, comment); - if (referenceFile) { - return [{ - fileName: referenceFile.fileName, - textSpan: createTextSpanFromBounds(0, 0), - kind: ScriptElementKind.scriptElement, - name: comment.fileName, - containerName: undefined, - containerKind: undefined - }]; - } - return undefined; - } - const typeChecker = program.getTypeChecker(); let symbol = typeChecker.getSymbolAtLocation(node); @@ -4608,7 +4859,16 @@ namespace ts { // to jump to the implementation directly. if (symbol.flags & SymbolFlags.Alias) { const declaration = symbol.declarations[0]; - if (node.kind === SyntaxKind.Identifier && node.parent === declaration) { + + // Go to the original declaration for cases: + // + // (1) when the aliased symbol was declared in the location(parent). + // (2) when the aliased symbol is originating from a named import. + // + if (node.kind === SyntaxKind.Identifier && + (node.parent === declaration || + (declaration.kind === SyntaxKind.ImportSpecifier && declaration.parent && declaration.parent.kind === SyntaxKind.NamedImports))) { + symbol = typeChecker.getAliasedSymbol(symbol); } } @@ -4642,7 +4902,7 @@ namespace ts { const sourceFile = getValidSourceFile(fileName); const node = getTouchingPropertyName(sourceFile, position); - if (!node) { + if (node === sourceFile) { return undefined; } @@ -4719,8 +4979,8 @@ namespace ts { node.kind === SyntaxKind.ThisKeyword || node.kind === SyntaxKind.ThisType || node.kind === SyntaxKind.SuperKeyword || - isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || - isNameOfExternalModuleImportOrDeclaration(node)) { + node.kind === SyntaxKind.StringLiteral || + isLiteralNameOfPropertyDeclarationOrIndexAccess(node)) { const referencedSymbols = getReferencedSymbolsForNode(node, sourceFilesToSearch, /*findInStrings*/ false, /*findInComments*/ false); return convertReferencedSymbols(referencedSymbols); @@ -5379,7 +5639,7 @@ namespace ts { const sourceFile = getValidSourceFile(fileName); const node = getTouchingPropertyName(sourceFile, position); - if (!node) { + if (node === sourceFile) { return undefined; } @@ -5387,8 +5647,8 @@ namespace ts { // TODO (drosen): This should be enabled in a later release - currently breaks rename. // node.kind !== SyntaxKind.ThisKeyword && // node.kind !== SyntaxKind.SuperKeyword && - !isLiteralNameOfPropertyDeclarationOrIndexAccess(node) && - !isNameOfExternalModuleImportOrDeclaration(node)) { + node.kind !== SyntaxKind.StringLiteral && + !isLiteralNameOfPropertyDeclarationOrIndexAccess(node)) { return undefined; } @@ -5423,6 +5683,10 @@ namespace ts { const symbol = typeChecker.getSymbolAtLocation(node); + if (!symbol && node.kind === SyntaxKind.StringLiteral) { + return getReferencesForStringLiteral(node, sourceFiles); + } + // Could not find a symbol e.g. unknown identifier if (!symbol) { // Can't have references to something that we have no symbol for. @@ -5463,7 +5727,7 @@ namespace ts { const nameTable = getNameTable(sourceFile); - if (lookUp(nameTable, internedName)) { + if (lookUp(nameTable, internedName) !== undefined) { result = result || []; getReferencesInNode(sourceFile, symbol, declaredName, node, searchMeaning, findInStrings, findInComments, result, symbolToIndex); } @@ -5490,10 +5754,51 @@ namespace ts { }; } - function isImportOrExportSpecifierImportSymbol(symbol: Symbol) { - return (symbol.flags & SymbolFlags.Alias) && forEach(symbol.declarations, declaration => { - return declaration.kind === SyntaxKind.ImportSpecifier || declaration.kind === SyntaxKind.ExportSpecifier; - }); + function getAliasSymbolForPropertyNameSymbol(symbol: Symbol, location: Node): Symbol { + if (symbol.flags & SymbolFlags.Alias) { + // Default import get alias + const defaultImport = getDeclarationOfKind(symbol, SyntaxKind.ImportClause); + if (defaultImport) { + return typeChecker.getAliasedSymbol(symbol); + } + + const importOrExportSpecifier = forEach(symbol.declarations, + declaration => (declaration.kind === SyntaxKind.ImportSpecifier || + declaration.kind === SyntaxKind.ExportSpecifier) ? declaration : undefined); + if (importOrExportSpecifier && + // export { a } + (!importOrExportSpecifier.propertyName || + // export {a as class } where a is location + importOrExportSpecifier.propertyName === location)) { + // If Import specifier -> get alias + // else Export specifier -> get local target + return importOrExportSpecifier.kind === SyntaxKind.ImportSpecifier ? + typeChecker.getAliasedSymbol(symbol) : + typeChecker.getExportSpecifierLocalTargetSymbol(importOrExportSpecifier); + } + } + return undefined; + } + + function getPropertySymbolOfDestructuringAssignment(location: Node) { + return isArrayLiteralOrObjectLiteralDestructuringPattern(location.parent.parent) && + typeChecker.getPropertySymbolOfDestructuringAssignment(location); + } + + function isObjectBindingPatternElementWithoutPropertyName(symbol: Symbol) { + const bindingElement = getDeclarationOfKind(symbol, SyntaxKind.BindingElement); + return bindingElement && + bindingElement.parent.kind === SyntaxKind.ObjectBindingPattern && + !bindingElement.propertyName; + } + + function getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol: Symbol) { + if (isObjectBindingPatternElementWithoutPropertyName(symbol)) { + const bindingElement = getDeclarationOfKind(symbol, SyntaxKind.BindingElement); + const typeOfPattern = typeChecker.getTypeAtLocation(bindingElement.parent); + return typeOfPattern && typeChecker.getPropertyOfType(typeOfPattern, (bindingElement.name).text); + } + return undefined; } function getInternedName(symbol: Symbol, location: Node, declarations: Declaration[]): string { @@ -5536,11 +5841,17 @@ namespace ts { } // If the symbol is an import we would like to find it if we are looking for what it imports. - // So consider it visibile outside its declaration scope. + // So consider it visible outside its declaration scope. if (symbol.flags & SymbolFlags.Alias) { return undefined; } + // If symbol is of object binding pattern element without property name we would want to + // look for property too and that could be anywhere + if (isObjectBindingPatternElementWithoutPropertyName(symbol)) { + return undefined; + } + // if this symbol is visible from its parent container, e.g. exported, then bail out // if symbol correspond to the union property - bail out if (symbol.parent || (symbol.flags & SymbolFlags.SyntheticProperty)) { @@ -5932,20 +6243,88 @@ namespace ts { } } + + function getReferencesForStringLiteral(node: StringLiteral, sourceFiles: SourceFile[]): ReferencedSymbol[] { + const typeChecker = program.getTypeChecker(); + const type = getStringLiteralTypeForNode(node, typeChecker); + + if (!type) { + // nothing to do here. moving on + return undefined; + } + + const references: ReferenceEntry[] = []; + + for (const sourceFile of sourceFiles) { + const possiblePositions = getPossibleSymbolReferencePositions(sourceFile, type.text, sourceFile.getStart(), sourceFile.getEnd()); + getReferencesForStringLiteralInFile(sourceFile, type, possiblePositions, references); + } + + return [{ + definition: { + containerKind: "", + containerName: "", + fileName: node.getSourceFile().fileName, + kind: ScriptElementKind.variableElement, + name: type.text, + textSpan: createTextSpanFromBounds(node.getStart(), node.getEnd()) + }, + references: references + }]; + + function getReferencesForStringLiteralInFile(sourceFile: SourceFile, searchType: Type, possiblePositions: number[], references: ReferenceEntry[]): void { + for (const position of possiblePositions) { + cancellationToken.throwIfCancellationRequested(); + + const node = getTouchingWord(sourceFile, position); + if (!node || node.kind !== SyntaxKind.StringLiteral) { + return; + } + + const type = getStringLiteralTypeForNode(node, typeChecker); + if (type === searchType) { + references.push(getReferenceEntryFromNode(node)); + } + } + } + } + function populateSearchSymbolSet(symbol: Symbol, location: Node): Symbol[] { // The search set contains at least the current symbol let result = [symbol]; - // If the symbol is an alias, add what it alaises to the list - if (isImportOrExportSpecifierImportSymbol(symbol)) { - result.push(typeChecker.getAliasedSymbol(symbol)); + // If the location is name of property symbol from object literal destructuring pattern + // Search the property symbol + // for ( { property: p2 } of elems) { } + const containingObjectLiteralElement = getContainingObjectLiteralElement(location); + if (containingObjectLiteralElement && containingObjectLiteralElement.kind !== SyntaxKind.ShorthandPropertyAssignment) { + const propertySymbol = getPropertySymbolOfDestructuringAssignment(location); + if (propertySymbol) { + result.push(propertySymbol); + } + } + + // If the symbol is an alias, add what it aliases to the list + // import {a} from "mod"; + // export {a} + // If the symbol is an alias to default declaration, add what it aliases to the list + // declare "mod" { export default class B { } } + // import B from "mod"; + //// For export specifiers, the exported name can be referring to a local symbol, e.g.: + //// import {a} from "mod"; + //// export {a as somethingElse} + //// We want the *local* declaration of 'a' as declared in the import, + //// *not* as declared within "mod" (or farther) + const aliasSymbol = getAliasSymbolForPropertyNameSymbol(symbol, location); + if (aliasSymbol) { + result = result.concat(populateSearchSymbolSet(aliasSymbol, location)); } // If the location is in a context sensitive location (i.e. in an object literal) try // to get a contextual type for it, and add the property symbol from the contextual // type to the search set - if (isNameOfPropertyAssignment(location)) { - forEach(getPropertySymbolsFromContextualType(location), contextualSymbol => { + if (containingObjectLiteralElement) { + forEach(getPropertySymbolsFromContextualType(containingObjectLiteralElement), contextualSymbol => { addRange(result, typeChecker.getRootSymbols(contextualSymbol)); }); @@ -5968,13 +6347,20 @@ namespace ts { // If the symbol.valueDeclaration is a property parameter declaration, // we should include both parameter declaration symbol and property declaration symbol - // Parameter Declaration symbol is only visible within function scope, so the symbol is stored in contructor.locals. + // Parameter Declaration symbol is only visible within function scope, so the symbol is stored in constructor.locals. // Property Declaration symbol is a member of the class, so the symbol is stored in its class Declaration.symbol.members if (symbol.valueDeclaration && symbol.valueDeclaration.kind === SyntaxKind.Parameter && isParameterPropertyDeclaration(symbol.valueDeclaration)) { result = result.concat(typeChecker.getSymbolsOfParameterPropertyDeclaration(symbol.valueDeclaration, symbol.name)); } + // If this is symbol of binding element without propertyName declaration in Object binding pattern + // Include the property in the search + const bindingElementPropertySymbol = getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol); + if (bindingElementPropertySymbol) { + result.push(bindingElementPropertySymbol); + } + // If this is a union property, add all the symbols from all its source symbols in all unioned types. // If the symbol is an instantiation from a another symbol (e.g. widened symbol) , add the root the list forEach(typeChecker.getRootSymbols(symbol), rootSymbol => { @@ -5984,17 +6370,45 @@ namespace ts { // Add symbol of properties/methods of the same name in base classes and implemented interfaces definitions if (rootSymbol.parent && rootSymbol.parent.flags & (SymbolFlags.Class | SymbolFlags.Interface)) { - getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result); + getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result, /*previousIterationSymbolsCache*/ {}); } }); return result; } - function getPropertySymbolsFromBaseTypes(symbol: Symbol, propertyName: string, result: Symbol[]): void { - if (symbol && symbol.flags & (SymbolFlags.Class | SymbolFlags.Interface)) { + /** + * Find symbol of the given property-name and add the symbol to the given result array + * @param symbol a symbol to start searching for the given propertyName + * @param propertyName a name of property to search for + * @param result an array of symbol of found property symbols + * @param previousIterationSymbolsCache a cache of symbol from previous iterations of calling this function to prevent infinite revisiting of the same symbol. + * The value of previousIterationSymbol is undefined when the function is first called. + */ + function getPropertySymbolsFromBaseTypes(symbol: Symbol, propertyName: string, result: Symbol[], + previousIterationSymbolsCache: SymbolTable): void { + if (!symbol) { + return; + } + + // If the current symbol is the same as the previous-iteration symbol, we can just return the symbol that has already been visited + // This is particularly important for the following cases, so that we do not infinitely visit the same symbol. + // For example: + // interface C extends C { + // /*findRef*/propName: string; + // } + // The first time getPropertySymbolsFromBaseTypes is called when finding-all-references at propName, + // the symbol argument will be the symbol of an interface "C" and previousIterationSymbol is undefined, + // the function will add any found symbol of the property-name, then its sub-routine will call + // getPropertySymbolsFromBaseTypes again to walk up any base types to prevent revisiting already + // visited symbol, interface "C", the sub-routine will pass the current symbol as previousIterationSymbol. + if (hasProperty(previousIterationSymbolsCache, symbol.name)) { + return; + } + + if (symbol.flags & (SymbolFlags.Class | SymbolFlags.Interface)) { forEach(symbol.getDeclarations(), declaration => { - if (declaration.kind === SyntaxKind.ClassDeclaration) { + if (isClassLike(declaration)) { getPropertySymbolFromTypeReference(getClassExtendsHeritageClauseElement(declaration)); forEach(getClassImplementsHeritageClauseElements(declaration), getPropertySymbolFromTypeReference); } @@ -6011,11 +6425,12 @@ namespace ts { if (type) { const propertySymbol = typeChecker.getPropertyOfType(type, propertyName); if (propertySymbol) { - result.push(propertySymbol); + result.push(...typeChecker.getRootSymbols(propertySymbol)); } // Visit the typeReference as well to see if it directly or indirectly use that property - getPropertySymbolsFromBaseTypes(type.symbol, propertyName, result); + previousIterationSymbolsCache[symbol.name] = symbol; + getPropertySymbolsFromBaseTypes(type.symbol, propertyName, result, previousIterationSymbolsCache); } } } @@ -6027,21 +6442,41 @@ namespace ts { } // If the reference symbol is an alias, check if what it is aliasing is one of the search - // symbols. - if (isImportOrExportSpecifierImportSymbol(referenceSymbol)) { - const aliasedSymbol = typeChecker.getAliasedSymbol(referenceSymbol); - if (searchSymbols.indexOf(aliasedSymbol) >= 0) { - return aliasedSymbol; - } + // symbols but by looking up for related symbol of this alias so it can handle multiple level of indirectness. + const aliasSymbol = getAliasSymbolForPropertyNameSymbol(referenceSymbol, referenceLocation); + if (aliasSymbol) { + return getRelatedSymbol(searchSymbols, aliasSymbol, referenceLocation); } // If the reference location is in an object literal, try to get the contextual type for the // object literal, lookup the property symbol in the contextual type, and use this symbol to // compare to our searchSymbol - if (isNameOfPropertyAssignment(referenceLocation)) { - return forEach(getPropertySymbolsFromContextualType(referenceLocation), contextualSymbol => { + const containingObjectLiteralElement = getContainingObjectLiteralElement(referenceLocation); + if (containingObjectLiteralElement) { + const contextualSymbol = forEach(getPropertySymbolsFromContextualType(containingObjectLiteralElement), contextualSymbol => { return forEach(typeChecker.getRootSymbols(contextualSymbol), s => searchSymbols.indexOf(s) >= 0 ? s : undefined); }); + + if (contextualSymbol) { + return contextualSymbol; + } + + // If the reference location is the name of property from object literal destructuring pattern + // Get the property symbol from the object literal's type and look if thats the search symbol + // In below eg. get 'property' from type of elems iterating type + // for ( { property: p2 } of elems) { } + const propertySymbol = getPropertySymbolOfDestructuringAssignment(referenceLocation); + if (propertySymbol && searchSymbols.indexOf(propertySymbol) >= 0) { + return propertySymbol; + } + } + + // If the reference location is the binding element and doesn't have property name + // then include the binding element in the related symbols + // let { a } : { a }; + const bindingElementPropertySymbol = getPropertySymbolOfObjectBindingPatternWithoutPropertyName(referenceSymbol); + if (bindingElementPropertySymbol && searchSymbols.indexOf(bindingElementPropertySymbol) >= 0) { + return bindingElementPropertySymbol; } // Unwrap symbols to get to the root (e.g. transient symbols as a result of widening) @@ -6056,7 +6491,7 @@ namespace ts { // see if any is in the list if (rootSymbol.parent && rootSymbol.parent.flags & (SymbolFlags.Class | SymbolFlags.Interface)) { const result: Symbol[] = []; - getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result); + getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result, /*previousIterationSymbolsCache*/ {}); return forEach(result, s => searchSymbols.indexOf(s) >= 0 ? s : undefined); } @@ -6064,37 +6499,38 @@ namespace ts { }); } - function getPropertySymbolsFromContextualType(node: Node): Symbol[] { - if (isNameOfPropertyAssignment(node)) { - const objectLiteral = node.parent.parent; - const contextualType = typeChecker.getContextualType(objectLiteral); - const name = (node).text; - if (contextualType) { - if (contextualType.flags & TypeFlags.Union) { - // This is a union type, first see if the property we are looking for is a union property (i.e. exists in all types) - // if not, search the constituent types for the property - const unionProperty = contextualType.getProperty(name); - if (unionProperty) { - return [unionProperty]; - } - else { - const result: Symbol[] = []; - forEach((contextualType).types, t => { - const symbol = t.getProperty(name); - if (symbol) { - result.push(symbol); - } - }); - return result; - } - } - else { - const symbol = contextualType.getProperty(name); - if (symbol) { - return [symbol]; - } - } + function getNameFromObjectLiteralElement(node: ObjectLiteralElement) { + if (node.name.kind === SyntaxKind.ComputedPropertyName) { + const nameExpression = (node.name).expression; + // treat computed property names where expression is string/numeric literal as just string/numeric literal + if (isStringOrNumericLiteral(nameExpression.kind)) { + return (nameExpression).text; } + return undefined; + } + return (node.name).text; + } + + function getPropertySymbolsFromContextualType(node: ObjectLiteralElement): Symbol[] { + const objectLiteral = node.parent; + const contextualType = typeChecker.getContextualType(objectLiteral); + const name = getNameFromObjectLiteralElement(node); + if (name && contextualType) { + const result: Symbol[] = []; + const symbol = contextualType.getProperty(name); + if (symbol) { + result.push(symbol); + } + + if (contextualType.flags & TypeFlags.Union) { + forEach((contextualType).types, t => { + const symbol = t.getProperty(name); + if (symbol) { + result.push(symbol); + } + }); + } + return result; } return undefined; } @@ -6229,7 +6665,7 @@ namespace ts { return SemanticMeaning.Value | SemanticMeaning.Type; case SyntaxKind.ModuleDeclaration: - if ((node).name.kind === SyntaxKind.StringLiteral) { + if (isAmbientModule(node)) { return SemanticMeaning.Namespace | SemanticMeaning.Value; } else if (getModuleInstanceState(node) === ModuleInstanceState.Instantiated) { @@ -6360,7 +6796,7 @@ namespace ts { } /// Syntactic features - function getSourceFile(fileName: string): SourceFile { + function getNonBoundSourceFile(fileName: string): SourceFile { return syntaxTreeCache.getCurrentSourceFile(fileName); } @@ -6370,7 +6806,7 @@ namespace ts { // Get node at the location const node = getTouchingPropertyName(sourceFile, startPos); - if (!node) { + if (node === sourceFile) { return; } @@ -6573,6 +7009,9 @@ namespace ts { case ClassificationType.jsxOpenTagName: return ClassificationTypeNames.jsxOpenTagName; case ClassificationType.jsxCloseTagName: return ClassificationTypeNames.jsxCloseTagName; case ClassificationType.jsxSelfClosingTagName: return ClassificationTypeNames.jsxSelfClosingTagName; + case ClassificationType.jsxAttribute: return ClassificationTypeNames.jsxAttribute; + case ClassificationType.jsxText: return ClassificationTypeNames.jsxText; + case ClassificationType.jsxAttributeStringLiteralValue: return ClassificationTypeNames.jsxAttributeStringLiteralValue; } } @@ -6757,7 +7196,8 @@ namespace ts { function classifyDisabledMergeCode(text: string, start: number, end: number) { // Classify the line that the ======= marker is on as a comment. Then just lex // all further tokens and add them to the result. - for (var i = start; i < end; i++) { + let i: number; + for (i = start; i < end; i++) { if (isLineBreak(text.charCodeAt(i))) { break; } @@ -6781,21 +7221,58 @@ namespace ts { } } - function classifyToken(token: Node): void { - if (nodeIsMissing(token)) { - return; + /** + * Returns true if node should be treated as classified and no further processing is required. + * False will mean that node is not classified and traverse routine should recurse into node contents. + */ + function tryClassifyNode(node: Node): boolean { + if (nodeIsMissing(node)) { + return true; } - const tokenStart = classifyLeadingTriviaAndGetTokenStart(token); + const classifiedElementName = tryClassifyJsxElementName(node); + if (!isToken(node) && node.kind !== SyntaxKind.JsxText && classifiedElementName === undefined) { + return false; + } - const tokenWidth = token.end - tokenStart; + const tokenStart = node.kind === SyntaxKind.JsxText ? node.pos : classifyLeadingTriviaAndGetTokenStart(node); + + const tokenWidth = node.end - tokenStart; Debug.assert(tokenWidth >= 0); if (tokenWidth > 0) { - const type = classifyTokenType(token.kind, token); + const type = classifiedElementName || classifyTokenType(node.kind, node); if (type) { pushClassification(tokenStart, tokenWidth, type); } } + + return true; + } + + function tryClassifyJsxElementName(token: Node): ClassificationType { + switch (token.parent && token.parent.kind) { + case SyntaxKind.JsxOpeningElement: + if ((token.parent).tagName === token) { + return ClassificationType.jsxOpenTagName; + } + break; + case SyntaxKind.JsxClosingElement: + if ((token.parent).tagName === token) { + return ClassificationType.jsxCloseTagName; + } + break; + case SyntaxKind.JsxSelfClosingElement: + if ((token.parent).tagName === token) { + return ClassificationType.jsxSelfClosingTagName; + } + break; + case SyntaxKind.JsxAttribute: + if ((token.parent).name === token) { + return ClassificationType.jsxAttribute; + } + break; + } + return undefined; } // for accurate classification, the actual token should be passed in. however, for @@ -6822,7 +7299,8 @@ namespace ts { // the '=' in a variable declaration is special cased here. if (token.parent.kind === SyntaxKind.VariableDeclaration || token.parent.kind === SyntaxKind.PropertyDeclaration || - token.parent.kind === SyntaxKind.Parameter) { + token.parent.kind === SyntaxKind.Parameter || + token.parent.kind === SyntaxKind.JsxAttribute) { return ClassificationType.operator; } } @@ -6841,7 +7319,7 @@ namespace ts { return ClassificationType.numericLiteral; } else if (tokenKind === SyntaxKind.StringLiteral || tokenKind === SyntaxKind.StringLiteralType) { - return ClassificationType.stringLiteral; + return token.parent.kind === SyntaxKind.JsxAttribute ? ClassificationType.jsxAttributeStringLiteralValue : ClassificationType.stringLiteral; } else if (tokenKind === SyntaxKind.RegularExpressionLiteral) { // TODO: we should get another classification type for these literals. @@ -6851,6 +7329,9 @@ namespace ts { // TODO (drosen): we should *also* get another classification type for these literals. return ClassificationType.stringLiteral; } + else if (tokenKind === SyntaxKind.JsxText) { + return ClassificationType.jsxText; + } else if (tokenKind === SyntaxKind.Identifier) { if (token) { switch (token.parent.kind) { @@ -6884,27 +7365,8 @@ namespace ts { return ClassificationType.parameterName; } return; - - case SyntaxKind.JsxOpeningElement: - if ((token.parent).tagName === token) { - return ClassificationType.jsxOpenTagName; - } - return; - - case SyntaxKind.JsxClosingElement: - if ((token.parent).tagName === token) { - return ClassificationType.jsxCloseTagName; - } - return; - - case SyntaxKind.JsxSelfClosingElement: - if ((token.parent).tagName === token) { - return ClassificationType.jsxSelfClosingTagName; - } - return; } } - return ClassificationType.identifier; } } @@ -6921,10 +7383,7 @@ namespace ts { const children = element.getChildren(sourceFile); for (let i = 0, n = children.length; i < n; i++) { const child = children[i]; - if (isToken(child)) { - classifyToken(child); - } - else { + if (!tryClassifyNode(child)) { // Recurse into our child nodes. processElement(child); } @@ -7100,8 +7559,7 @@ namespace ts { const indentationStr = sourceFile.text.substr(lineStart, posLineAndChar.character); - // TODO: call a helper method instead once PR #4133 gets merged in. - const newLine = host.getNewLine ? host.getNewLine() : "\r\n"; + const newLine = getNewLineOrDefaultFromHost(host); let docParams = ""; for (let i = 0, numParams = parameters.length; i < numParams; i++) { @@ -7131,6 +7589,36 @@ namespace ts { return { newText: result, caretOffset: preamble.length }; } + function isValidBraceCompletionAtPostion(fileName: string, position: number, openingBrace: number): boolean { + + // '<' is currently not supported, figuring out if we're in a Generic Type vs. a comparison is too + // expensive to do during typing scenarios + // i.e. whether we're dealing with: + // var x = new foo<| ( with class foo{} ) + // or + // var y = 3 <| + if (openingBrace === CharacterCodes.lessThan) { + return false; + } + + const sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); + + // Check if in a context where we don't want to perform any insertion + if (isInString(sourceFile, position) || isInComment(sourceFile, position)) { + return false; + } + + if (isInsideJsxElementOrAttribute(sourceFile, position)) { + return openingBrace === CharacterCodes.openBrace; + } + + if (isInTemplateString(sourceFile, position)) { + return false; + } + + return true; + } + function getParametersForJsDocOwningNode(commentOwner: Node): ParameterDeclaration[] { if (isFunctionLike(commentOwner)) { return commentOwner.parameters; @@ -7277,12 +7765,12 @@ namespace ts { // comment portion. const singleLineCommentStart = /(?:\/\/+\s*)/.source; const multiLineCommentStart = /(?:\/\*+\s*)/.source; - const anyNumberOfSpacesAndAsterixesAtStartOfLine = /(?:^(?:\s|\*)*)/.source; + const anyNumberOfSpacesAndAsterisksAtStartOfLine = /(?:^(?:\s|\*)*)/.source; // Match any of the above three TODO comment start regexps. // Note that the outermost group *is* a capture group. We want to capture the preamble // so that we can determine the starting position of the TODO comment match. - const preamble = "(" + anyNumberOfSpacesAndAsterixesAtStartOfLine + "|" + singleLineCommentStart + "|" + multiLineCommentStart + ")"; + const preamble = "(" + anyNumberOfSpacesAndAsterisksAtStartOfLine + "|" + singleLineCommentStart + "|" + multiLineCommentStart + ")"; // Takes the descriptors and forms a regexp that matches them as if they were literals. // For example, if the descriptors are "TODO(jason)" and "HACK", then this will be: @@ -7324,6 +7812,14 @@ namespace ts { } } + function getStringLiteralTypeForNode(node: StringLiteral | StringLiteralTypeNode, typeChecker: TypeChecker): StringLiteralType { + const searchNode = node.parent.kind === SyntaxKind.StringLiteralType ? node.parent : node; + const type = typeChecker.getTypeAtLocation(searchNode); + if (type && type.flags & TypeFlags.StringLiteral) { + return type; + } + return undefined; + } function getRenameInfo(fileName: string, position: number): RenameInfo { synchronizeHostData(); @@ -7331,46 +7827,60 @@ namespace ts { const sourceFile = getValidSourceFile(fileName); const typeChecker = program.getTypeChecker(); + const defaultLibFileName = host.getDefaultLibFileName(host.getCompilationSettings()); + const canonicalDefaultLibName = getCanonicalFileName(ts.normalizePath(defaultLibFileName)); + const node = getTouchingWord(sourceFile, position); // Can only rename an identifier. - if (node && node.kind === SyntaxKind.Identifier) { - const symbol = typeChecker.getSymbolAtLocation(node); + if (node) { + if (node.kind === SyntaxKind.Identifier || + node.kind === SyntaxKind.StringLiteral || + isLiteralNameOfPropertyDeclarationOrIndexAccess(node)) { + const symbol = typeChecker.getSymbolAtLocation(node); - // Only allow a symbol to be renamed if it actually has at least one declaration. - if (symbol) { - const declarations = symbol.getDeclarations(); - if (declarations && declarations.length > 0) { - // Disallow rename for elements that are defined in the standard TypeScript library. - const defaultLibFileName = host.getDefaultLibFileName(host.getCompilationSettings()); - const canonicalDefaultLibName = getCanonicalFileName(ts.normalizePath(defaultLibFileName)); - if (defaultLibFileName) { - for (const current of declarations) { - const sourceFile = current.getSourceFile(); - // TODO (drosen): When is there no source file? - if (!sourceFile) { - continue; - } + // Only allow a symbol to be renamed if it actually has at least one declaration. + if (symbol) { + const declarations = symbol.getDeclarations(); + if (declarations && declarations.length > 0) { + // Disallow rename for elements that are defined in the standard TypeScript library. + if (forEach(declarations, isDefinedInLibraryFile)) { + return getRenameInfoError(getLocaleSpecificMessage(Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library)); + } - const canonicalName = getCanonicalFileName(ts.normalizePath(sourceFile.fileName)); - if (canonicalName === canonicalDefaultLibName) { - return getRenameInfoError(getLocaleSpecificMessage(Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library)); - } + const displayName = stripQuotes(getDeclaredName(typeChecker, symbol, node)); + const kind = getSymbolKind(symbol, node); + if (kind) { + return { + canRename: true, + kind, + displayName, + localizedErrorMessage: undefined, + fullDisplayName: typeChecker.getFullyQualifiedName(symbol), + kindModifiers: getSymbolModifiers(symbol), + triggerSpan: createTriggerSpanForNode(node, sourceFile) + }; } } - - const displayName = stripQuotes(getDeclaredName(typeChecker, symbol, node)); - const kind = getSymbolKind(symbol, node); - if (kind) { - return { - canRename: true, - kind, - displayName, - localizedErrorMessage: undefined, - fullDisplayName: typeChecker.getFullyQualifiedName(symbol), - kindModifiers: getSymbolModifiers(symbol), - triggerSpan: createTextSpan(node.getStart(), node.getWidth()) - }; + } + else if (node.kind === SyntaxKind.StringLiteral) { + const type = getStringLiteralTypeForNode(node, typeChecker); + if (type) { + if (isDefinedInLibraryFile(node)) { + return getRenameInfoError(getLocaleSpecificMessage(Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library)); + } + else { + const displayName = stripQuotes(type.text); + return { + canRename: true, + kind: ScriptElementKind.variableElement, + displayName, + localizedErrorMessage: undefined, + fullDisplayName: displayName, + kindModifiers: ScriptElementKindModifier.none, + triggerSpan: createTriggerSpanForNode(node, sourceFile) + }; + } } } } @@ -7389,6 +7899,28 @@ namespace ts { triggerSpan: undefined }; } + + function isDefinedInLibraryFile(declaration: Node) { + if (defaultLibFileName) { + const sourceFile = declaration.getSourceFile(); + const canonicalName = getCanonicalFileName(ts.normalizePath(sourceFile.fileName)); + if (canonicalName === canonicalDefaultLibName) { + return true; + } + } + return false; + } + + function createTriggerSpanForNode(node: Node, sourceFile: SourceFile) { + let start = node.getStart(sourceFile); + let width = node.getWidth(sourceFile); + if (node.kind === SyntaxKind.StringLiteral) { + // Exclude the quotes + start += 1; + width -= 2; + } + return createTextSpan(start, width); + } } return { @@ -7425,14 +7957,15 @@ namespace ts { getFormattingEditsForDocument, getFormattingEditsAfterKeystroke, getDocCommentTemplateAtPosition, + isValidBraceCompletionAtPostion, getEmitOutput, - getSourceFile, + getNonBoundSourceFile, getProgram }; } /* @internal */ - export function getNameTable(sourceFile: SourceFile): Map { + export function getNameTable(sourceFile: SourceFile): Map { if (!sourceFile.nameTable) { initializeNameTable(sourceFile); } @@ -7441,7 +7974,7 @@ namespace ts { } function initializeNameTable(sourceFile: SourceFile): void { - const nameTable: Map = {}; + const nameTable: Map = {}; walk(sourceFile); sourceFile.nameTable = nameTable; @@ -7449,7 +7982,7 @@ namespace ts { function walk(node: Node) { switch (node.kind) { case SyntaxKind.Identifier: - nameTable[(node).text] = (node).text; + nameTable[(node).text] = nameTable[(node).text] === undefined ? node.pos : -1; break; case SyntaxKind.StringLiteral: case SyntaxKind.NumericLiteral: @@ -7459,9 +7992,10 @@ namespace ts { // "a['propname']" then we want to store "propname" in the name table. if (isDeclarationName(node) || node.parent.kind === SyntaxKind.ExternalModuleReference || - isArgumentOfElementAccessExpression(node)) { + isArgumentOfElementAccessExpression(node) || + isLiteralComputedPropertyDeclarationName(node)) { - nameTable[(node).text] = (node).text; + nameTable[(node).text] = nameTable[(node).text] === undefined ? node.pos : -1; } break; default: diff --git a/src/services/shims.ts b/src/services/shims.ts index 46056eb110f..0610c0e0b57 100644 --- a/src/services/shims.ts +++ b/src/services/shims.ts @@ -16,7 +16,11 @@ /// /* @internal */ -var debugObjectHost = (this); +let debugObjectHost = (this); + +// We need to use 'null' to interface with the managed side. +/* tslint:disable:no-null-keyword */ +/* tslint:disable:no-in-operator */ /* @internal */ namespace ts { @@ -51,6 +55,7 @@ namespace ts { /** Returns a JSON-encoded value of the type: string[] */ getScriptFileNames(): string; + getScriptKind?(fileName: string): ScriptKind; getScriptVersion(fileName: string): string; getScriptSnapshot(fileName: string): ScriptSnapshotShim; getLocalizedDiagnosticMessages(): string; @@ -62,6 +67,8 @@ namespace ts { useCaseSensitiveFileNames?(): boolean; getModuleResolutionsForFile?(fileName: string): string; + getTypeReferenceDirectiveResolutionsForFile?(fileName: string): string; + directoryExists(directoryName: string): boolean; } /** Public interface of the the of a config service shim instance.*/ @@ -72,8 +79,9 @@ namespace ts { * @param exclude A JSON encoded string[] containing the paths to exclude * when enumerating the directory. */ - readDirectory(rootDir: string, extension: string, exclude?: string, include?: string): string; + readDirectory(rootDir: string, extension: string, exclude?: string, include?: string, depth?: number): string; useCaseSensitiveFileNames?(): boolean; + trace(s: string): void; } /// @@ -213,6 +221,13 @@ namespace ts { */ getDocCommentTemplateAtPosition(fileName: string, position: number): string; + /** + * Returns JSON-encoded boolean to indicate whether we should support brace location + * at the current position. + * E.g. we don't want brace completion inside string-literals, comments, etc. + */ + isValidBraceCompletionAtPostion(fileName: string, position: number, openingBrace: number): string; + getEmitOutput(fileName: string): string; } @@ -225,6 +240,7 @@ namespace ts { getPreProcessedFileInfo(fileName: string, sourceText: IScriptSnapshot): string; getTSConfigFileInfo(fileName: string, sourceText: IScriptSnapshot): string; getDefaultCompilationSettings(): string; + discoverTypings(discoverTypingsJson: string): string; } function logInternalError(logger: Logger, err: Error) { @@ -234,8 +250,6 @@ namespace ts { } class ScriptSnapshotShimAdapter implements IScriptSnapshot { - private lineStartPositions: number[] = null; - constructor(private scriptSnapshotShim: ScriptSnapshotShim) { } @@ -248,14 +262,14 @@ namespace ts { } public getChangeRange(oldSnapshot: IScriptSnapshot): TextChangeRange { - var oldSnapshotShim = oldSnapshot; - var encoded = this.scriptSnapshotShim.getChangeRange(oldSnapshotShim.scriptSnapshotShim); + const oldSnapshotShim = oldSnapshot; + const encoded = this.scriptSnapshotShim.getChangeRange(oldSnapshotShim.scriptSnapshotShim); // TODO: should this be '==='? if (encoded == null) { return null; } - var decoded: { span: { start: number; length: number; }; newLength: number; } = JSON.parse(encoded); + const decoded: { span: { start: number; length: number; }; newLength: number; } = JSON.parse(encoded); return createTextChangeRange( createTextSpan(decoded.span.start, decoded.span.length), decoded.newLength); } @@ -275,19 +289,30 @@ namespace ts { private tracingEnabled = false; public resolveModuleNames: (moduleName: string[], containingFile: string) => ResolvedModule[]; + public resolveTypeReferenceDirectives: (typeDirectiveNames: string[], containingFile: string) => ResolvedTypeReferenceDirective[]; + public directoryExists: (directoryName: string) => boolean; constructor(private shimHost: LanguageServiceShimHost) { // if shimHost is a COM object then property check will become method call with no arguments. // 'in' does not have this effect. if ("getModuleResolutionsForFile" in this.shimHost) { this.resolveModuleNames = (moduleNames: string[], containingFile: string) => { - let resolutionsInFile = >JSON.parse(this.shimHost.getModuleResolutionsForFile(containingFile)); + const resolutionsInFile = >JSON.parse(this.shimHost.getModuleResolutionsForFile(containingFile)); return map(moduleNames, name => { const result = lookUp(resolutionsInFile, name); return result ? { resolvedFileName: result } : undefined; }); }; } + if ("directoryExists" in this.shimHost) { + this.directoryExists = directoryName => this.shimHost.directoryExists(directoryName); + } + if ("getTypeReferenceDirectiveResolutionsForFile" in this.shimHost) { + this.resolveTypeReferenceDirectives = (typeDirectiveNames: string[], containingFile: string) => { + const typeDirectivesForFile = >JSON.parse(this.shimHost.getTypeReferenceDirectiveResolutionsForFile(containingFile)); + return map(typeDirectiveNames, name => lookUp(typeDirectivesForFile, name)); + }; + } } public log(s: string): void { @@ -320,7 +345,7 @@ namespace ts { } public getCompilationSettings(): CompilerOptions { - var settingsJson = this.shimHost.getCompilationSettings(); + const settingsJson = this.shimHost.getCompilationSettings(); // TODO: should this be '==='? if (settingsJson == null || settingsJson == "") { throw Error("LanguageServiceShimHostAdapter.getCompilationSettings: empty compilationSettings"); @@ -329,26 +354,30 @@ namespace ts { } public getScriptFileNames(): string[] { - var encoded = this.shimHost.getScriptFileNames(); + const encoded = this.shimHost.getScriptFileNames(); return this.files = JSON.parse(encoded); } public getScriptSnapshot(fileName: string): IScriptSnapshot { - // Shim the API changes for 1.5 release. This should be removed once - // TypeScript 1.5 has shipped. - if (this.files && this.files.indexOf(fileName) < 0) { - return undefined; - } - var scriptSnapshot = this.shimHost.getScriptSnapshot(fileName); + const scriptSnapshot = this.shimHost.getScriptSnapshot(fileName); return scriptSnapshot && new ScriptSnapshotShimAdapter(scriptSnapshot); } + public getScriptKind(fileName: string): ScriptKind { + if ("getScriptKind" in this.shimHost) { + return this.shimHost.getScriptKind(fileName); + } + else { + return ScriptKind.Unknown; + } + } + public getScriptVersion(fileName: string): string { return this.shimHost.getScriptVersion(fileName); } public getLocalizedDiagnosticMessages(): any { - var diagnosticMessagesJson = this.shimHost.getLocalizedDiagnosticMessages(); + const diagnosticMessagesJson = this.shimHost.getLocalizedDiagnosticMessages(); if (diagnosticMessagesJson == null || diagnosticMessagesJson == "") { return null; } @@ -363,7 +392,7 @@ namespace ts { } public getCancellationToken(): HostCancellationToken { - var hostCancellationToken = this.shimHost.getCancellationToken(); + const hostCancellationToken = this.shimHost.getCancellationToken(); return new ThrottledCancellationToken(hostCancellationToken); } @@ -372,14 +401,7 @@ namespace ts { } public getDefaultLibFileName(options: CompilerOptions): string { - // Wrap the API changes for 1.5 release. This try/catch - // should be removed once TypeScript 1.5 has shipped. - try { - return this.shimHost.getDefaultLibFileName(JSON.stringify(options)); - } - catch (e) { - return ""; - } + return this.shimHost.getDefaultLibFileName(JSON.stringify(options)); } } @@ -394,8 +416,8 @@ namespace ts { } public isCancellationRequested(): boolean { - var time = Date.now(); - var duration = Math.abs(time - this.lastCancellationCheckTime); + const time = Date.now(); + const duration = Math.abs(time - this.lastCancellationCheckTime); if (duration > 10) { // Check no more than once every 10 ms. this.lastCancellationCheckTime = time; @@ -406,25 +428,33 @@ namespace ts { } } - export class CoreServicesShimHostAdapter implements ParseConfigHost { + export class CoreServicesShimHostAdapter implements ParseConfigHost, ModuleResolutionHost { - public useCaseSensitiveFileNames: boolean; + public directoryExists: (directoryName: string) => boolean; + public realpath: (path: string) => string; + public useCaseSensitiveFileNames: boolean; constructor(private shimHost: CoreServicesShimHost) { - this.useCaseSensitiveFileNames = this.shimHost.useCaseSensitiveFileNames ? this.shimHost.useCaseSensitiveFileNames() : false; + this.useCaseSensitiveFileNames = this.shimHost.useCaseSensitiveFileNames ? this.shimHost.useCaseSensitiveFileNames() : false; + if ("directoryExists" in this.shimHost) { + this.directoryExists = directoryName => this.shimHost.directoryExists(directoryName); + } + if ("realpath" in this.shimHost) { + this.realpath = path => this.shimHost.realpath(path); + } } - public readDirectory(rootDir: string, extensions: string[], exclude: string[], include: string[]): string[] { - // Wrap the API changes for 1.8 release. This try/catch - // should be removed once TypeScript 1.8 has shipped. - // Also consider removing the optional designation for - // the exclude param at this time. + public readDirectory(rootDir: string, extensions: string[], exclude: string[], include: string[], depth?: number): string[] { + // Wrap the API changes for 2.0 release. This try/catch + // should be removed once TypeScript 2.0 has shipped. try { return JSON.parse(this.shimHost.readDirectory( rootDir, JSON.stringify(extensions), JSON.stringify(exclude), - JSON.stringify(include))); + JSON.stringify(include), + depth + )); } catch (e) { const results: string[] = []; @@ -454,22 +484,23 @@ namespace ts { } function simpleForwardCall(logger: Logger, actionDescription: string, action: () => any, logPerformance: boolean): any { + let start: number; if (logPerformance) { logger.log(actionDescription); - var start = Date.now(); + start = Date.now(); } - var result = action(); + const result = action(); if (logPerformance) { - var end = Date.now(); - logger.log(actionDescription + " completed in " + (end - start) + " msec"); - if (typeof (result) === "string") { - var str = result; + const end = Date.now(); + logger.log(`${actionDescription} completed in ${end - start} msec`); + if (typeof result === "string") { + let str = result; if (str.length > 128) { str = str.substring(0, 128) + "..."; } - logger.log(" result.length=" + str.length + ", result='" + JSON.stringify(str) + "'"); + logger.log(` result.length=${str.length}, result='${JSON.stringify(str)}'`); } } @@ -478,8 +509,8 @@ namespace ts { function forwardJSONCall(logger: Logger, actionDescription: string, action: () => any, logPerformance: boolean): string { try { - var result = simpleForwardCall(logger, actionDescription, action, logPerformance); - return JSON.stringify({ result: result }); + const result = simpleForwardCall(logger, actionDescription, action, logPerformance); + return JSON.stringify({ result }); } catch (err) { if (err instanceof OperationCanceledException) { @@ -500,7 +531,7 @@ namespace ts { } } - export function realizeDiagnostics(diagnostics: Diagnostic[], newLine: string): { message: string; start: number; length: number; category: string; code: number; } []{ + export function realizeDiagnostics(diagnostics: Diagnostic[], newLine: string): { message: string; start: number; length: number; category: string; code: number; }[] { return diagnostics.map(d => realizeDiagnostic(d, newLine)); } @@ -559,10 +590,9 @@ namespace ts { */ public refresh(throwOnError: boolean): void { this.forwardJSONCall( - "refresh(" + throwOnError + ")", - () => { - return null; - }); + `refresh(${throwOnError})`, + () => null + ); } public cleanupSemanticCache(): void { @@ -574,63 +604,57 @@ namespace ts { }); } - private realizeDiagnostics(diagnostics: Diagnostic[]): { message: string; start: number; length: number; category: string; }[]{ - var newLine = getNewLineOrDefaultFromHost(this.host); + private realizeDiagnostics(diagnostics: Diagnostic[]): { message: string; start: number; length: number; category: string; }[] { + const newLine = getNewLineOrDefaultFromHost(this.host); return ts.realizeDiagnostics(diagnostics, newLine); } public getSyntacticClassifications(fileName: string, start: number, length: number): string { return this.forwardJSONCall( - "getSyntacticClassifications('" + fileName + "', " + start + ", " + length + ")", - () => { - var classifications = this.languageService.getSyntacticClassifications(fileName, createTextSpan(start, length)); - return classifications; - }); + `getSyntacticClassifications('${fileName}', ${start}, ${length})`, + () => this.languageService.getSyntacticClassifications(fileName, createTextSpan(start, length)) + ); } public getSemanticClassifications(fileName: string, start: number, length: number): string { return this.forwardJSONCall( - "getSemanticClassifications('" + fileName + "', " + start + ", " + length + ")", - () => { - var classifications = this.languageService.getSemanticClassifications(fileName, createTextSpan(start, length)); - return classifications; - }); + `getSemanticClassifications('${fileName}', ${start}, ${length})`, + () => this.languageService.getSemanticClassifications(fileName, createTextSpan(start, length)) + ); } public getEncodedSyntacticClassifications(fileName: string, start: number, length: number): string { return this.forwardJSONCall( - "getEncodedSyntacticClassifications('" + fileName + "', " + start + ", " + length + ")", - () => { - // directly serialize the spans out to a string. This is much faster to decode - // on the managed side versus a full JSON array. - return convertClassifications(this.languageService.getEncodedSyntacticClassifications(fileName, createTextSpan(start, length))); - }); + `getEncodedSyntacticClassifications('${fileName}', ${start}, ${length})`, + // directly serialize the spans out to a string. This is much faster to decode + // on the managed side versus a full JSON array. + () => convertClassifications(this.languageService.getEncodedSyntacticClassifications(fileName, createTextSpan(start, length))) + ); } public getEncodedSemanticClassifications(fileName: string, start: number, length: number): string { return this.forwardJSONCall( - "getEncodedSemanticClassifications('" + fileName + "', " + start + ", " + length + ")", - () => { - // directly serialize the spans out to a string. This is much faster to decode - // on the managed side versus a full JSON array. - return convertClassifications(this.languageService.getEncodedSemanticClassifications(fileName, createTextSpan(start, length))); - }); + `getEncodedSemanticClassifications('${fileName}', ${start}, ${length})`, + // directly serialize the spans out to a string. This is much faster to decode + // on the managed side versus a full JSON array. + () => convertClassifications(this.languageService.getEncodedSemanticClassifications(fileName, createTextSpan(start, length))) + ); } public getSyntacticDiagnostics(fileName: string): string { return this.forwardJSONCall( - "getSyntacticDiagnostics('" + fileName + "')", + `getSyntacticDiagnostics('${fileName}')`, () => { - var diagnostics = this.languageService.getSyntacticDiagnostics(fileName); + const diagnostics = this.languageService.getSyntacticDiagnostics(fileName); return this.realizeDiagnostics(diagnostics); }); } public getSemanticDiagnostics(fileName: string): string { return this.forwardJSONCall( - "getSemanticDiagnostics('" + fileName + "')", + `getSemanticDiagnostics('${fileName}')`, () => { - var diagnostics = this.languageService.getSemanticDiagnostics(fileName); + const diagnostics = this.languageService.getSemanticDiagnostics(fileName); return this.realizeDiagnostics(diagnostics); }); } @@ -639,7 +663,7 @@ namespace ts { return this.forwardJSONCall( "getCompilerOptionsDiagnostics()", () => { - var diagnostics = this.languageService.getCompilerOptionsDiagnostics(); + const diagnostics = this.languageService.getCompilerOptionsDiagnostics(); return this.realizeDiagnostics(diagnostics); }); } @@ -652,11 +676,9 @@ namespace ts { */ public getQuickInfoAtPosition(fileName: string, position: number): string { return this.forwardJSONCall( - "getQuickInfoAtPosition('" + fileName + "', " + position + ")", - () => { - var quickInfo = this.languageService.getQuickInfoAtPosition(fileName, position); - return quickInfo; - }); + `getQuickInfoAtPosition('${fileName}', ${position})`, + () => this.languageService.getQuickInfoAtPosition(fileName, position) + ); } @@ -668,11 +690,9 @@ namespace ts { */ public getNameOrDottedNameSpan(fileName: string, startPos: number, endPos: number): string { return this.forwardJSONCall( - "getNameOrDottedNameSpan('" + fileName + "', " + startPos + ", " + endPos + ")", - () => { - var spanInfo = this.languageService.getNameOrDottedNameSpan(fileName, startPos, endPos); - return spanInfo; - }); + `getNameOrDottedNameSpan('${fileName}', ${startPos}, ${endPos})`, + () => this.languageService.getNameOrDottedNameSpan(fileName, startPos, endPos) + ); } /** @@ -681,22 +701,18 @@ namespace ts { */ public getBreakpointStatementAtPosition(fileName: string, position: number): string { return this.forwardJSONCall( - "getBreakpointStatementAtPosition('" + fileName + "', " + position + ")", - () => { - var spanInfo = this.languageService.getBreakpointStatementAtPosition(fileName, position); - return spanInfo; - }); + `getBreakpointStatementAtPosition('${fileName}', ${position})`, + () => this.languageService.getBreakpointStatementAtPosition(fileName, position) + ); } /// SIGNATUREHELP public getSignatureHelpItems(fileName: string, position: number): string { return this.forwardJSONCall( - "getSignatureHelpItems('" + fileName + "', " + position + ")", - () => { - var signatureInfo = this.languageService.getSignatureHelpItems(fileName, position); - return signatureInfo; - }); + `getSignatureHelpItems('${fileName}', ${position})`, + () => this.languageService.getSignatureHelpItems(fileName, position) + ); } /// GOTO DEFINITION @@ -707,10 +723,9 @@ namespace ts { */ public getDefinitionAtPosition(fileName: string, position: number): string { return this.forwardJSONCall( - "getDefinitionAtPosition('" + fileName + "', " + position + ")", - () => { - return this.languageService.getDefinitionAtPosition(fileName, position); - }); + `getDefinitionAtPosition('${fileName}', ${position})`, + () => this.languageService.getDefinitionAtPosition(fileName, position) + ); } /// GOTO Type @@ -721,44 +736,46 @@ namespace ts { */ public getTypeDefinitionAtPosition(fileName: string, position: number): string { return this.forwardJSONCall( - "getTypeDefinitionAtPosition('" + fileName + "', " + position + ")", - () => { - return this.languageService.getTypeDefinitionAtPosition(fileName, position); - }); + `getTypeDefinitionAtPosition('${fileName}', ${position})`, + () => this.languageService.getTypeDefinitionAtPosition(fileName, position) + ); } public getRenameInfo(fileName: string, position: number): string { return this.forwardJSONCall( - "getRenameInfo('" + fileName + "', " + position + ")", - () => { - return this.languageService.getRenameInfo(fileName, position); - }); + `getRenameInfo('${fileName}', ${position})`, + () => this.languageService.getRenameInfo(fileName, position) + ); } public findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean): string { return this.forwardJSONCall( - "findRenameLocations('" + fileName + "', " + position + ", " + findInStrings + ", " + findInComments + ")", - () => { - return this.languageService.findRenameLocations(fileName, position, findInStrings, findInComments); - }); + `findRenameLocations('${fileName}', ${position}, ${findInStrings}, ${findInComments})`, + () => this.languageService.findRenameLocations(fileName, position, findInStrings, findInComments) + ); } /// GET BRACE MATCHING public getBraceMatchingAtPosition(fileName: string, position: number): string { return this.forwardJSONCall( - "getBraceMatchingAtPosition('" + fileName + "', " + position + ")", - () => { - var textRanges = this.languageService.getBraceMatchingAtPosition(fileName, position); - return textRanges; - }); + `getBraceMatchingAtPosition('${fileName}', ${position})`, + () => this.languageService.getBraceMatchingAtPosition(fileName, position) + ); + } + + public isValidBraceCompletionAtPostion(fileName: string, position: number, openingBrace: number): string { + return this.forwardJSONCall( + `isValidBraceCompletionAtPostion('${fileName}', ${position}, ${openingBrace})`, + () => this.languageService.isValidBraceCompletionAtPostion(fileName, position, openingBrace) + ); } /// GET SMART INDENT public getIndentationAtPosition(fileName: string, position: number, options: string /*Services.EditorOptions*/): string { return this.forwardJSONCall( - "getIndentationAtPosition('" + fileName + "', " + position + ")", + `getIndentationAtPosition('${fileName}', ${position})`, () => { - var localOptions: EditorOptions = JSON.parse(options); + const localOptions: EditorOptions = JSON.parse(options); return this.languageService.getIndentationAtPosition(fileName, position, localOptions); }); } @@ -767,35 +784,32 @@ namespace ts { public getReferencesAtPosition(fileName: string, position: number): string { return this.forwardJSONCall( - "getReferencesAtPosition('" + fileName + "', " + position + ")", - () => { - return this.languageService.getReferencesAtPosition(fileName, position); - }); + `getReferencesAtPosition('${fileName}', ${position})`, + () => this.languageService.getReferencesAtPosition(fileName, position) + ); } public findReferences(fileName: string, position: number): string { return this.forwardJSONCall( - "findReferences('" + fileName + "', " + position + ")", - () => { - return this.languageService.findReferences(fileName, position); - }); + `findReferences('${fileName}', ${position})`, + () => this.languageService.findReferences(fileName, position) + ); } public getOccurrencesAtPosition(fileName: string, position: number): string { return this.forwardJSONCall( - "getOccurrencesAtPosition('" + fileName + "', " + position + ")", - () => { - return this.languageService.getOccurrencesAtPosition(fileName, position); - }); + `getOccurrencesAtPosition('${fileName}', ${position})`, + () => this.languageService.getOccurrencesAtPosition(fileName, position) + ); } public getDocumentHighlights(fileName: string, position: number, filesToSearch: string): string { return this.forwardJSONCall( - "getDocumentHighlights('" + fileName + "', " + position + ")", + `getDocumentHighlights('${fileName}', ${position})`, () => { - var results = this.languageService.getDocumentHighlights(fileName, position, JSON.parse(filesToSearch)); - // workaround for VS document higlighting issue - keep only items from the initial file - let normalizedName = normalizeSlashes(fileName).toLowerCase(); + const results = this.languageService.getDocumentHighlights(fileName, position, JSON.parse(filesToSearch)); + // workaround for VS document highlighting issue - keep only items from the initial file + const normalizedName = normalizeSlashes(fileName).toLowerCase(); return filter(results, r => normalizeSlashes(r.fileName).toLowerCase() === normalizedName); }); } @@ -809,56 +823,49 @@ namespace ts { */ public getCompletionsAtPosition(fileName: string, position: number) { return this.forwardJSONCall( - "getCompletionsAtPosition('" + fileName + "', " + position + ")", - () => { - var completion = this.languageService.getCompletionsAtPosition(fileName, position); - return completion; - }); + `getCompletionsAtPosition('${fileName}', ${position})`, + () => this.languageService.getCompletionsAtPosition(fileName, position) + ); } /** Get a string based representation of a completion list entry details */ public getCompletionEntryDetails(fileName: string, position: number, entryName: string) { return this.forwardJSONCall( - "getCompletionEntryDetails('" + fileName + "', " + position + ", " + entryName + ")", - () => { - var details = this.languageService.getCompletionEntryDetails(fileName, position, entryName); - return details; - }); + `getCompletionEntryDetails('${fileName}', ${position}, '${entryName}')`, + () => this.languageService.getCompletionEntryDetails(fileName, position, entryName) + ); } public getFormattingEditsForRange(fileName: string, start: number, end: number, options: string/*Services.FormatCodeOptions*/): string { return this.forwardJSONCall( - "getFormattingEditsForRange('" + fileName + "', " + start + ", " + end + ")", + `getFormattingEditsForRange('${fileName}', ${start}, ${end})`, () => { - var localOptions: ts.FormatCodeOptions = JSON.parse(options); - var edits = this.languageService.getFormattingEditsForRange(fileName, start, end, localOptions); - return edits; + const localOptions: ts.FormatCodeOptions = JSON.parse(options); + return this.languageService.getFormattingEditsForRange(fileName, start, end, localOptions); }); } public getFormattingEditsForDocument(fileName: string, options: string/*Services.FormatCodeOptions*/): string { return this.forwardJSONCall( - "getFormattingEditsForDocument('" + fileName + "')", + `getFormattingEditsForDocument('${fileName}')`, () => { - var localOptions: ts.FormatCodeOptions = JSON.parse(options); - var edits = this.languageService.getFormattingEditsForDocument(fileName, localOptions); - return edits; + const localOptions: ts.FormatCodeOptions = JSON.parse(options); + return this.languageService.getFormattingEditsForDocument(fileName, localOptions); }); } public getFormattingEditsAfterKeystroke(fileName: string, position: number, key: string, options: string/*Services.FormatCodeOptions*/): string { return this.forwardJSONCall( - "getFormattingEditsAfterKeystroke('" + fileName + "', " + position + ", '" + key + "')", + `getFormattingEditsAfterKeystroke('${fileName}', ${position}, '${key}')`, () => { - var localOptions: ts.FormatCodeOptions = JSON.parse(options); - var edits = this.languageService.getFormattingEditsAfterKeystroke(fileName, position, key, localOptions); - return edits; + const localOptions: ts.FormatCodeOptions = JSON.parse(options); + return this.languageService.getFormattingEditsAfterKeystroke(fileName, position, key, localOptions); }); } public getDocCommentTemplateAtPosition(fileName: string, position: number): string { return this.forwardJSONCall( - "getDocCommentTemplateAtPosition('" + fileName + "', " + position + ")", + `getDocCommentTemplateAtPosition('${fileName}', ${position})`, () => this.languageService.getDocCommentTemplateAtPosition(fileName, position) ); } @@ -868,51 +875,38 @@ namespace ts { /** Return a list of symbols that are interesting to navigate to */ public getNavigateToItems(searchValue: string, maxResultCount?: number): string { return this.forwardJSONCall( - "getNavigateToItems('" + searchValue + "', " + maxResultCount+ ")", - () => { - var items = this.languageService.getNavigateToItems(searchValue, maxResultCount); - return items; - }); + `getNavigateToItems('${searchValue}', ${maxResultCount})`, + () => this.languageService.getNavigateToItems(searchValue, maxResultCount) + ); } public getNavigationBarItems(fileName: string): string { return this.forwardJSONCall( - "getNavigationBarItems('" + fileName + "')", - () => { - var items = this.languageService.getNavigationBarItems(fileName); - return items; - }); + `getNavigationBarItems('${fileName}')`, + () => this.languageService.getNavigationBarItems(fileName) + ); } public getOutliningSpans(fileName: string): string { return this.forwardJSONCall( - "getOutliningSpans('" + fileName + "')", - () => { - var items = this.languageService.getOutliningSpans(fileName); - return items; - }); + `getOutliningSpans('${fileName}')`, + () => this.languageService.getOutliningSpans(fileName) + ); } public getTodoComments(fileName: string, descriptors: string): string { return this.forwardJSONCall( - "getTodoComments('" + fileName + "')", - () => { - var items = this.languageService.getTodoComments(fileName, JSON.parse(descriptors)); - return items; - }); + `getTodoComments('${fileName}')`, + () => this.languageService.getTodoComments(fileName, JSON.parse(descriptors)) + ); } /// Emit public getEmitOutput(fileName: string): string { return this.forwardJSONCall( - "getEmitOutput('" + fileName + "')", - () => { - var output = this.languageService.getEmitOutput(fileName); - // Shim the API changes for 1.5 release. This should be removed once - // TypeScript 1.5 has shipped. - (output).emitOutputStatus = output.emitSkipped ? 1 : 0; - return output; - }); + `getEmitOutput('${fileName}')`, + () => this.languageService.getEmitOutput(fileName) + ); } } @@ -937,12 +931,11 @@ namespace ts { /// COLORIZATION public getClassificationsForLine(text: string, lexState: EndOfLineState, classifyKeywordsInGenerics?: boolean): string { - var classification = this.classifier.getClassificationsForLine(text, lexState, classifyKeywordsInGenerics); - var items = classification.entries; - var result = ""; - for (var i = 0; i < items.length; i++) { - result += items[i].length + "\n"; - result += items[i].classification + "\n"; + const classification = this.classifier.getClassificationsForLine(text, lexState, classifyKeywordsInGenerics); + let result = ""; + for (const item of classification.entries) { + result += item.length + "\n"; + result += item.classification + "\n"; } result += classification.finalLexState; return result; @@ -962,10 +955,22 @@ namespace ts { public resolveModuleName(fileName: string, moduleName: string, compilerOptionsJson: string): string { return this.forwardJSONCall(`resolveModuleName('${fileName}')`, () => { - let compilerOptions = JSON.parse(compilerOptionsJson); + const compilerOptions = JSON.parse(compilerOptionsJson); const result = resolveModuleName(moduleName, normalizeSlashes(fileName), compilerOptions, this.host); return { - resolvedFileName: result.resolvedModule ? result.resolvedModule.resolvedFileName: undefined, + resolvedFileName: result.resolvedModule ? result.resolvedModule.resolvedFileName : undefined, + failedLookupLocations: result.failedLookupLocations + }; + }); + } + + public resolveTypeReferenceDirective(fileName: string, typeReferenceDirective: string, compilerOptionsJson: string): string { + return this.forwardJSONCall(`resolveTypeReferenceDirective(${fileName})`, () => { + const compilerOptions = JSON.parse(compilerOptionsJson); + const result = resolveTypeReferenceDirective(typeReferenceDirective, normalizeSlashes(fileName), compilerOptions, this.host); + return { + resolvedFileName: result.resolvedTypeReferenceDirective ? result.resolvedTypeReferenceDirective.resolvedFileName : undefined, + primary: result.resolvedTypeReferenceDirective ? result.resolvedTypeReferenceDirective.primary : true, failedLookupLocations: result.failedLookupLocations }; }); @@ -976,55 +981,59 @@ namespace ts { "getPreProcessedFileInfo('" + fileName + "')", () => { // for now treat files as JavaScript - var result = preProcessFile(sourceTextSnapshot.getText(0, sourceTextSnapshot.getLength()), /* readImportFiles */ true, /* detectJavaScriptImports */ true); - var convertResult = { - referencedFiles: [], - importedFiles: [], + const result = preProcessFile(sourceTextSnapshot.getText(0, sourceTextSnapshot.getLength()), /* readImportFiles */ true, /* detectJavaScriptImports */ true); + return { + referencedFiles: this.convertFileReferences(result.referencedFiles), + importedFiles: this.convertFileReferences(result.importedFiles), ambientExternalModules: result.ambientExternalModules, - isLibFile: result.isLibFile + isLibFile: result.isLibFile, + typeReferenceDirectives: this.convertFileReferences(result.typeReferenceDirectives) }; - - forEach(result.referencedFiles, refFile => { - convertResult.referencedFiles.push({ - path: normalizePath(refFile.fileName), - position: refFile.pos, - length: refFile.end - refFile.pos - }); - }); - - forEach(result.importedFiles, importedFile => { - convertResult.importedFiles.push({ - path: normalizeSlashes(importedFile.fileName), - position: importedFile.pos, - length: importedFile.end - importedFile.pos - }); - }); - return convertResult; }); } + private convertFileReferences(refs: FileReference[]): IFileReference[] { + if (!refs) { + return undefined; + } + const result: IFileReference[] = []; + for (const ref of refs) { + result.push({ + path: normalizeSlashes(ref.fileName), + position: ref.pos, + length: ref.end - ref.pos + }); + } + return result; + } + public getTSConfigFileInfo(fileName: string, sourceTextSnapshot: IScriptSnapshot): string { return this.forwardJSONCall( - "getTSConfigFileInfo('" + fileName + "')", + `getTSConfigFileInfo('${fileName}')`, () => { - let text = sourceTextSnapshot.getText(0, sourceTextSnapshot.getLength()); + const text = sourceTextSnapshot.getText(0, sourceTextSnapshot.getLength()); - let result = parseConfigFileTextToJson(fileName, text); + const result = parseConfigFileTextToJson(fileName, text); if (result.error) { return { options: {}, + typingOptions: {}, files: [], - errors: [realizeDiagnostic(result.error, '\r\n')] + raw: {}, + errors: [realizeDiagnostic(result.error, "\r\n")] }; } - var configFile = parseJsonConfigFileContent(result.config, this.host, getDirectoryPath(normalizeSlashes(fileName))); + const normalizedFileName = normalizeSlashes(fileName); + const configFile = parseJsonConfigFileContent(result.config, this.host, getDirectoryPath(normalizedFileName), /*existingOptions*/ {}, normalizedFileName); return { options: configFile.options, + typingOptions: configFile.typingOptions, files: configFile.fileNames, - errors: realizeDiagnostics(configFile.errors, '\r\n') + raw: configFile.raw, + errors: realizeDiagnostics(configFile.errors, "\r\n") }; }); } @@ -1032,9 +1041,23 @@ namespace ts { public getDefaultCompilationSettings(): string { return this.forwardJSONCall( "getDefaultCompilationSettings()", - () => { - return getDefaultCompilerOptions(); - }); + () => getDefaultCompilerOptions() + ); + } + + public discoverTypings(discoverTypingsJson: string): string { + const getCanonicalFileName = createGetCanonicalFileName(/*useCaseSensitivefileNames:*/ false); + return this.forwardJSONCall("discoverTypings()", () => { + const info = JSON.parse(discoverTypingsJson); + return ts.JsTyping.discoverTypings( + this.host, + info.fileNames, + toPath(info.projectRootPath, info.projectRootPath, getCanonicalFileName), + toPath(info.safeListPath, info.safeListPath, getCanonicalFileName), + info.packageNameToTypingLocation, + info.typingOptions, + info.compilerOptions); + }); } } @@ -1054,8 +1077,8 @@ namespace ts { if (this.documentRegistry === undefined) { this.documentRegistry = createDocumentRegistry(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames(), host.getCurrentDirectory()); } - var hostAdapter = new LanguageServiceShimHostAdapter(host); - var languageService = createLanguageService(hostAdapter, this.documentRegistry); + const hostAdapter = new LanguageServiceShimHostAdapter(host); + const languageService = createLanguageService(hostAdapter, this.documentRegistry); return new LanguageServiceShimObject(this, host, languageService); } catch (err) { @@ -1076,7 +1099,7 @@ namespace ts { public createCoreServicesShim(host: CoreServicesShimHost): CoreServicesShim { try { - var adapter = new CoreServicesShimHostAdapter(host); + const adapter = new CoreServicesShimHostAdapter(host); return new CoreServicesShimObject(this, host, adapter); } catch (err) { @@ -1096,7 +1119,7 @@ namespace ts { } public unregisterShim(shim: Shim): void { - for (var i = 0, n = this._shims.length; i < n; i++) { + for (let i = 0, n = this._shims.length; i < n; i++) { if (this._shims[i] === shim) { delete this._shims[i]; return; @@ -1115,12 +1138,21 @@ namespace ts { } } +/* tslint:enable:no-in-operator */ +/* tslint:enable:no-null */ + /// TODO: this is used by VS, clean this up on both sides of the interface /* @internal */ -module TypeScript.Services { - export var TypeScriptServicesFactory = ts.TypeScriptServicesFactory; +namespace TypeScript.Services { + export const TypeScriptServicesFactory = ts.TypeScriptServicesFactory; } +/* tslint:disable:no-unused-variable */ +// 'toolsVersion' gets consumed by the managed side, so it's not unused. +// TODO: it should be moved into a namespace though. + /* @internal */ -const toolsVersion = "1.6"; +const toolsVersion = "1.9"; + +/* tslint:enable:no-unused-variable */ \ No newline at end of file diff --git a/src/services/signatureHelp.ts b/src/services/signatureHelp.ts index 02e36e185a5..9e8a2f14ed8 100644 --- a/src/services/signatureHelp.ts +++ b/src/services/signatureHelp.ts @@ -50,7 +50,7 @@ namespace ts.SignatureHelp { // case TypeScript.SyntaxKind.GreaterThanGreaterThanGreaterThanToken: // stack++; - // // Intentaion fall through + // // Intentional fall through // case TypeScript.SyntaxKind.GreaterThanToken: // stack++; // break; @@ -76,7 +76,7 @@ namespace ts.SignatureHelp { // break; // case TypeScript.SyntaxKind.EqualsGreaterThanToken: - // // This can be a function type or a constructor type. In either case, we want to skip the function defintion + // // This can be a function type or a constructor type. In either case, we want to skip the function definition // token = previousToken(token, /*includeSkippedTokens*/ true); // if (token && token.kind() === TypeScript.SyntaxKind.CloseParenToken) { @@ -99,7 +99,7 @@ namespace ts.SignatureHelp { // } // } // else { - // // This is not a funtion type. exit the main loop + // // This is not a function type. exit the main loop // break whileLoop; // } @@ -559,7 +559,7 @@ namespace ts.SignatureHelp { signatureHelpParameters = typeParameters && typeParameters.length > 0 ? map(typeParameters, createSignatureHelpParameterForTypeParameter) : emptyArray; suffixDisplayParts.push(punctuationPart(SyntaxKind.GreaterThanToken)); let parameterParts = mapToDisplayParts(writer => - typeChecker.getSymbolDisplayBuilder().buildDisplayForParametersAndDelimiters(candidateSignature.parameters, writer, invocation)); + typeChecker.getSymbolDisplayBuilder().buildDisplayForParametersAndDelimiters(candidateSignature.thisType, candidateSignature.parameters, writer, invocation)); addRange(suffixDisplayParts, parameterParts); } else { diff --git a/src/services/tsconfig.json b/src/services/tsconfig.json index 5dcee789243..6aa7e61391b 100644 --- a/src/services/tsconfig.json +++ b/src/services/tsconfig.json @@ -1,6 +1,5 @@ { "compilerOptions": { - "module": "commonjs", "noImplicitAny": true, "removeComments": true, "preserveConstEnums": true, @@ -30,6 +29,7 @@ "shims.ts", "signatureHelp.ts", "utilities.ts", + "jsTyping.ts", "formatting/formatting.ts", "formatting/formattingContext.ts", "formatting/formattingRequestKind.ts", diff --git a/src/services/utilities.ts b/src/services/utilities.ts index b3b4ec31a02..404fdf92d4d 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -6,32 +6,6 @@ namespace ts { list: Node; } - export function getEndLinePosition(line: number, sourceFile: SourceFile): number { - Debug.assert(line >= 0); - let lineStarts = sourceFile.getLineStarts(); - - let lineIndex = line; - if (lineIndex + 1 === lineStarts.length) { - // last line - return EOF - return sourceFile.text.length - 1; - } - else { - // current line start - let start = lineStarts[lineIndex]; - // take the start position of the next line -1 = it should be some line break - let pos = lineStarts[lineIndex + 1] - 1; - Debug.assert(isLineBreak(sourceFile.text.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 && isLineBreak(sourceFile.text.charCodeAt(pos))) { - pos--; - } - return pos; - } - } - export function getLineStartPositionForPosition(position: number, sourceFile: SourceFile): number { let lineStarts = sourceFile.getLineStarts(); let line = sourceFile.getLineAndCharacterOfPosition(position).line; @@ -147,7 +121,7 @@ namespace ts { case SyntaxKind.CaseClause: case SyntaxKind.DefaultClause: - // there is no such thing as terminator token for CaseClause/DefaultClause so for simplicitly always consider them non-completed + // there is no such thing as terminator token for CaseClause/DefaultClause so for simplicity always consider them non-completed return false; case SyntaxKind.ForStatement: @@ -265,7 +239,7 @@ namespace ts { } /* Gets the token whose text has range [start, end) and position >= start - * and (position < end or (position === end && token is keyword or identifier or numeric\string litera)) + * and (position < end or (position === end && token is keyword or identifier or numeric/string literal)) */ export function getTouchingPropertyName(sourceFile: SourceFile, position: number): Node { return getTouchingToken(sourceFile, position, n => isPropertyName(n.kind)); @@ -396,7 +370,7 @@ namespace ts { if (lookInPreviousChild) { // actual start of the node is past the position - previous token should be at the end of previous child let candidate = findRightmostChildNodeWithTokens(children, /*exclusiveStartPosition*/ i); - return candidate && findRightmostToken(candidate) + return candidate && findRightmostToken(candidate); } else { // candidate should be in this node @@ -429,13 +403,53 @@ namespace ts { export function isInString(sourceFile: SourceFile, position: number) { let token = getTokenAtPosition(sourceFile, position); - return token && (token.kind === SyntaxKind.StringLiteral || token.kind === SyntaxKind.StringLiteralType) && position > token.getStart(); + return token && (token.kind === SyntaxKind.StringLiteral || token.kind === SyntaxKind.StringLiteralType) && position > token.getStart(sourceFile); } export function isInComment(sourceFile: SourceFile, position: number) { return isInCommentHelper(sourceFile, position, /*predicate*/ undefined); } + /** + * returns true if the position is in between the open and close elements of an JSX expression. + */ + export function isInsideJsxElementOrAttribute(sourceFile: SourceFile, position: number) { + let token = getTokenAtPosition(sourceFile, position); + + if (!token) { + return false; + } + + //
Hello |
+ if (token.kind === SyntaxKind.LessThanToken && token.parent.kind === SyntaxKind.JsxText) { + return true; + } + + //
{ |
or
+ if (token.kind === SyntaxKind.LessThanToken && token.parent.kind === SyntaxKind.JsxExpression) { + return true; + } + + //
{ + // | + // } < /div> + if (token && token.kind === SyntaxKind.CloseBraceToken && token.parent.kind === SyntaxKind.JsxExpression) { + return true; + } + + //
|
+ if (token.kind === SyntaxKind.LessThanToken && token.parent.kind === SyntaxKind.JsxClosingElement) { + return true; + } + + return false; + } + + export function isInTemplateString(sourceFile: SourceFile, position: number) { + let token = getTokenAtPosition(sourceFile, position); + return isTemplateLiteralKind(token.kind) && position > token.getStart(sourceFile); + } + /** * Returns true if the cursor at position in sourceFile is within a comment that additionally * satisfies predicate, and false otherwise. @@ -443,7 +457,7 @@ namespace ts { export function isInCommentHelper(sourceFile: SourceFile, position: number, predicate?: (c: CommentRange) => boolean): boolean { let token = getTokenAtPosition(sourceFile, position); - if (token && position <= token.getStart()) { + if (token && position <= token.getStart(sourceFile)) { let commentRanges = getLeadingCommentRanges(sourceFile.text, token.pos); // The end marker of a single-line comment does not include the newline character. @@ -476,8 +490,8 @@ namespace ts { return forEach(commentRanges, jsDocPrefix); function jsDocPrefix(c: CommentRange): boolean { - var text = sourceFile.text; - return text.length >= c.pos + 3 && text[c.pos] === '/' && text[c.pos + 1] === '*' && text[c.pos + 2] === '*'; + const text = sourceFile.text; + return text.length >= c.pos + 3 && text[c.pos] === "/" && text[c.pos + 1] === "*" && text[c.pos + 2] === "*"; } } @@ -532,7 +546,7 @@ namespace ts { if (flags & NodeFlags.Export) result.push(ScriptElementKindModifier.exportedModifier); if (isInAmbientContext(node)) result.push(ScriptElementKindModifier.ambientModifier); - return result.length > 0 ? result.join(',') : ScriptElementKindModifier.none; + return result.length > 0 ? result.join(",") : ScriptElementKindModifier.none; } export function getTypeArgumentOrTypeParameterList(node: Node): NodeArray { @@ -608,6 +622,36 @@ namespace ts { } return true; } + + export function isArrayLiteralOrObjectLiteralDestructuringPattern(node: Node) { + if (node.kind === SyntaxKind.ArrayLiteralExpression || + node.kind === SyntaxKind.ObjectLiteralExpression) { + // [a,b,c] from: + // [a, b, c] = someExpression; + if (node.parent.kind === SyntaxKind.BinaryExpression && + (node.parent).left === node && + (node.parent).operatorToken.kind === SyntaxKind.EqualsToken) { + return true; + } + + // [a, b, c] from: + // for([a, b, c] of expression) + if (node.parent.kind === SyntaxKind.ForOfStatement && + (node.parent).initializer === node) { + return true; + } + + // [a, b, c] of + // [x, [a, b, c] ] = someExpression + // or + // {x, a: {a, b, c} } = someExpression + if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === SyntaxKind.PropertyAssignment ? node.parent.parent : node.parent)) { + return true; + } + } + + return false; + } } // Display-part writer helpers @@ -667,7 +711,7 @@ namespace ts { } function resetWriter() { - displayParts = [] + displayParts = []; lineStart = true; indent = 0; } @@ -724,7 +768,7 @@ namespace ts { } export function textOrKeywordPart(text: string) { - var kind = stringToToken(text); + const kind = stringToToken(text); return kind === undefined ? textPart(text) : keywordPart(kind); @@ -777,6 +821,10 @@ namespace ts { if (isImportOrExportSpecifierName(location)) { return location.getText(); } + else if (isStringOrNumericLiteral(location.kind) && + location.parent.kind === SyntaxKind.ComputedPropertyName) { + return (location).text; + } // Try to get the local symbol if we're dealing with an 'export default' // since that symbol has the "true" name. @@ -807,4 +855,22 @@ namespace ts { }; return name; } + + export function scriptKindIs(fileName: string, host: LanguageServiceHost, ...scriptKinds: ScriptKind[]): boolean { + const scriptKind = getScriptKind(fileName, host); + return forEach(scriptKinds, k => k === scriptKind); + } + + export function getScriptKind(fileName: string, host?: LanguageServiceHost): ScriptKind { + // First check to see if the script kind was specified by the host. Chances are the host + // may override the default script kind for the file extension. + let scriptKind: ScriptKind; + if (host && host.getScriptKind) { + scriptKind = host.getScriptKind(fileName); + } + if (!scriptKind || scriptKind === ScriptKind.Unknown) { + scriptKind = getScriptKindFromFileName(fileName); + } + return ensureScriptKind(fileName, scriptKind); + } } \ No newline at end of file diff --git a/tests/baselines/reference/1.0lib-noErrors.symbols b/tests/baselines/reference/1.0lib-noErrors.symbols index 789018598d1..adedbdb9aa2 100644 --- a/tests/baselines/reference/1.0lib-noErrors.symbols +++ b/tests/baselines/reference/1.0lib-noErrors.symbols @@ -106,22 +106,22 @@ interface PropertyDescriptor { >PropertyDescriptor : Symbol(PropertyDescriptor, Decl(1.0lib-noErrors.ts, 79, 66)) configurable?: boolean; ->configurable : Symbol(configurable, Decl(1.0lib-noErrors.ts, 81, 30)) +>configurable : Symbol(PropertyDescriptor.configurable, Decl(1.0lib-noErrors.ts, 81, 30)) enumerable?: boolean; ->enumerable : Symbol(enumerable, Decl(1.0lib-noErrors.ts, 82, 27)) +>enumerable : Symbol(PropertyDescriptor.enumerable, Decl(1.0lib-noErrors.ts, 82, 27)) value?: any; ->value : Symbol(value, Decl(1.0lib-noErrors.ts, 83, 25)) +>value : Symbol(PropertyDescriptor.value, Decl(1.0lib-noErrors.ts, 83, 25)) writable?: boolean; ->writable : Symbol(writable, Decl(1.0lib-noErrors.ts, 84, 16)) +>writable : Symbol(PropertyDescriptor.writable, Decl(1.0lib-noErrors.ts, 84, 16)) get?(): any; ->get : Symbol(get, Decl(1.0lib-noErrors.ts, 85, 23)) +>get : Symbol(PropertyDescriptor.get, Decl(1.0lib-noErrors.ts, 85, 23)) set?(v: any): void; ->set : Symbol(set, Decl(1.0lib-noErrors.ts, 86, 16)) +>set : Symbol(PropertyDescriptor.set, Decl(1.0lib-noErrors.ts, 86, 16)) >v : Symbol(v, Decl(1.0lib-noErrors.ts, 87, 9)) } @@ -138,20 +138,20 @@ interface Object { /** The initial value of Object.prototype.constructor is the standard built-in Object constructor. */ constructor: Function; ->constructor : Symbol(constructor, Decl(1.0lib-noErrors.ts, 94, 18)) +>constructor : Symbol(Object.constructor, Decl(1.0lib-noErrors.ts, 94, 18)) >Function : Symbol(Function, Decl(1.0lib-noErrors.ts, 221, 1), Decl(1.0lib-noErrors.ts, 257, 11)) /** Returns a string representation of an object. */ toString(): string; ->toString : Symbol(toString, Decl(1.0lib-noErrors.ts, 96, 26)) +>toString : Symbol(Object.toString, Decl(1.0lib-noErrors.ts, 96, 26)) /** Returns a date converted to a string using the current locale. */ toLocaleString(): string; ->toLocaleString : Symbol(toLocaleString, Decl(1.0lib-noErrors.ts, 99, 23)) +>toLocaleString : Symbol(Object.toLocaleString, Decl(1.0lib-noErrors.ts, 99, 23)) /** Returns the primitive value of the specified object. */ valueOf(): Object; ->valueOf : Symbol(valueOf, Decl(1.0lib-noErrors.ts, 102, 29)) +>valueOf : Symbol(Object.valueOf, Decl(1.0lib-noErrors.ts, 102, 29)) >Object : Symbol(Object, Decl(1.0lib-noErrors.ts, 92, 1), Decl(1.0lib-noErrors.ts, 129, 11)) /** @@ -159,7 +159,7 @@ interface Object { * @param v A property name. */ hasOwnProperty(v: string): boolean; ->hasOwnProperty : Symbol(hasOwnProperty, Decl(1.0lib-noErrors.ts, 105, 22)) +>hasOwnProperty : Symbol(Object.hasOwnProperty, Decl(1.0lib-noErrors.ts, 105, 22)) >v : Symbol(v, Decl(1.0lib-noErrors.ts, 111, 19)) /** @@ -167,7 +167,7 @@ interface Object { * @param v Another object whose prototype chain is to be checked. */ isPrototypeOf(v: Object): boolean; ->isPrototypeOf : Symbol(isPrototypeOf, Decl(1.0lib-noErrors.ts, 111, 39)) +>isPrototypeOf : Symbol(Object.isPrototypeOf, Decl(1.0lib-noErrors.ts, 111, 39)) >v : Symbol(v, Decl(1.0lib-noErrors.ts, 117, 18)) >Object : Symbol(Object, Decl(1.0lib-noErrors.ts, 92, 1), Decl(1.0lib-noErrors.ts, 129, 11)) @@ -176,7 +176,7 @@ interface Object { * @param v A property name. */ propertyIsEnumerable(v: string): boolean; ->propertyIsEnumerable : Symbol(propertyIsEnumerable, Decl(1.0lib-noErrors.ts, 117, 38)) +>propertyIsEnumerable : Symbol(Object.propertyIsEnumerable, Decl(1.0lib-noErrors.ts, 117, 38)) >v : Symbol(v, Decl(1.0lib-noErrors.ts, 123, 25)) } @@ -332,7 +332,7 @@ interface Function { * @param argArray A set of arguments to be passed to the function. */ apply(thisArg: any, argArray?: any): any; ->apply : Symbol(apply, Decl(1.0lib-noErrors.ts, 226, 20)) +>apply : Symbol(Function.apply, Decl(1.0lib-noErrors.ts, 226, 20)) >thisArg : Symbol(thisArg, Decl(1.0lib-noErrors.ts, 232, 10)) >argArray : Symbol(argArray, Decl(1.0lib-noErrors.ts, 232, 23)) @@ -342,7 +342,7 @@ interface Function { * @param argArray A list of arguments to be passed to the method. */ call(thisArg: any, ...argArray: any[]): any; ->call : Symbol(call, Decl(1.0lib-noErrors.ts, 232, 45)) +>call : Symbol(Function.call, Decl(1.0lib-noErrors.ts, 232, 45)) >thisArg : Symbol(thisArg, Decl(1.0lib-noErrors.ts, 239, 9)) >argArray : Symbol(argArray, Decl(1.0lib-noErrors.ts, 239, 22)) @@ -353,22 +353,22 @@ interface Function { * @param argArray A list of arguments to be passed to the new function. */ bind(thisArg: any, ...argArray: any[]): any; ->bind : Symbol(bind, Decl(1.0lib-noErrors.ts, 239, 48)) +>bind : Symbol(Function.bind, Decl(1.0lib-noErrors.ts, 239, 48)) >thisArg : Symbol(thisArg, Decl(1.0lib-noErrors.ts, 247, 9)) >argArray : Symbol(argArray, Decl(1.0lib-noErrors.ts, 247, 22)) prototype: any; ->prototype : Symbol(prototype, Decl(1.0lib-noErrors.ts, 247, 48)) +>prototype : Symbol(Function.prototype, Decl(1.0lib-noErrors.ts, 247, 48)) length: number; ->length : Symbol(length, Decl(1.0lib-noErrors.ts, 249, 19)) +>length : Symbol(Function.length, Decl(1.0lib-noErrors.ts, 249, 19)) // Non-standard extensions arguments: any; ->arguments : Symbol(arguments, Decl(1.0lib-noErrors.ts, 250, 19)) +>arguments : Symbol(Function.arguments, Decl(1.0lib-noErrors.ts, 250, 19)) caller: Function; ->caller : Symbol(caller, Decl(1.0lib-noErrors.ts, 253, 19)) +>caller : Symbol(Function.caller, Decl(1.0lib-noErrors.ts, 253, 19)) >Function : Symbol(Function, Decl(1.0lib-noErrors.ts, 221, 1), Decl(1.0lib-noErrors.ts, 257, 11)) } @@ -399,10 +399,10 @@ interface IArguments { >index : Symbol(index, Decl(1.0lib-noErrors.ts, 268, 5)) length: number; ->length : Symbol(length, Decl(1.0lib-noErrors.ts, 268, 25)) +>length : Symbol(IArguments.length, Decl(1.0lib-noErrors.ts, 268, 25)) callee: Function; ->callee : Symbol(callee, Decl(1.0lib-noErrors.ts, 269, 19)) +>callee : Symbol(IArguments.callee, Decl(1.0lib-noErrors.ts, 269, 19)) >Function : Symbol(Function, Decl(1.0lib-noErrors.ts, 221, 1), Decl(1.0lib-noErrors.ts, 257, 11)) } @@ -411,14 +411,14 @@ interface String { /** Returns a string representation of a string. */ toString(): string; ->toString : Symbol(toString, Decl(1.0lib-noErrors.ts, 273, 18)) +>toString : Symbol(String.toString, Decl(1.0lib-noErrors.ts, 273, 18)) /** * Returns the character at the specified index. * @param pos The zero-based index of the desired character. */ charAt(pos: number): string; ->charAt : Symbol(charAt, Decl(1.0lib-noErrors.ts, 275, 23)) +>charAt : Symbol(String.charAt, Decl(1.0lib-noErrors.ts, 275, 23)) >pos : Symbol(pos, Decl(1.0lib-noErrors.ts, 281, 11)) /** @@ -426,7 +426,7 @@ interface String { * @param index The zero-based index of the desired character. If there is no character at the specified index, NaN is returned. */ charCodeAt(index: number): number; ->charCodeAt : Symbol(charCodeAt, Decl(1.0lib-noErrors.ts, 281, 32)) +>charCodeAt : Symbol(String.charCodeAt, Decl(1.0lib-noErrors.ts, 281, 32)) >index : Symbol(index, Decl(1.0lib-noErrors.ts, 287, 15)) /** @@ -434,7 +434,7 @@ interface String { * @param strings The strings to append to the end of the string. */ concat(...strings: string[]): string; ->concat : Symbol(concat, Decl(1.0lib-noErrors.ts, 287, 38)) +>concat : Symbol(String.concat, Decl(1.0lib-noErrors.ts, 287, 38)) >strings : Symbol(strings, Decl(1.0lib-noErrors.ts, 293, 11)) /** @@ -443,7 +443,7 @@ interface String { * @param position The index at which to begin searching the String object. If omitted, search starts at the beginning of the string. */ indexOf(searchString: string, position?: number): number; ->indexOf : Symbol(indexOf, Decl(1.0lib-noErrors.ts, 293, 41)) +>indexOf : Symbol(String.indexOf, Decl(1.0lib-noErrors.ts, 293, 41)) >searchString : Symbol(searchString, Decl(1.0lib-noErrors.ts, 300, 12)) >position : Symbol(position, Decl(1.0lib-noErrors.ts, 300, 33)) @@ -453,7 +453,7 @@ interface String { * @param position The index at which to begin searching. If omitted, the search begins at the end of the string. */ lastIndexOf(searchString: string, position?: number): number; ->lastIndexOf : Symbol(lastIndexOf, Decl(1.0lib-noErrors.ts, 300, 61)) +>lastIndexOf : Symbol(String.lastIndexOf, Decl(1.0lib-noErrors.ts, 300, 61)) >searchString : Symbol(searchString, Decl(1.0lib-noErrors.ts, 307, 16)) >position : Symbol(position, Decl(1.0lib-noErrors.ts, 307, 37)) @@ -462,7 +462,7 @@ interface String { * @param that String to compare to target string */ localeCompare(that: string): number; ->localeCompare : Symbol(localeCompare, Decl(1.0lib-noErrors.ts, 307, 65)) +>localeCompare : Symbol(String.localeCompare, Decl(1.0lib-noErrors.ts, 307, 65)) >that : Symbol(that, Decl(1.0lib-noErrors.ts, 313, 18)) /** @@ -470,7 +470,7 @@ interface String { * @param regexp A variable name or string literal containing the regular expression pattern and flags. */ match(regexp: string): string[]; ->match : Symbol(match, Decl(1.0lib-noErrors.ts, 313, 40), Decl(1.0lib-noErrors.ts, 319, 36)) +>match : Symbol(String.match, Decl(1.0lib-noErrors.ts, 313, 40), Decl(1.0lib-noErrors.ts, 319, 36)) >regexp : Symbol(regexp, Decl(1.0lib-noErrors.ts, 319, 10)) /** @@ -478,7 +478,7 @@ interface String { * @param regexp A regular expression object that contains the regular expression pattern and applicable flags. */ match(regexp: RegExp): string[]; ->match : Symbol(match, Decl(1.0lib-noErrors.ts, 313, 40), Decl(1.0lib-noErrors.ts, 319, 36)) +>match : Symbol(String.match, Decl(1.0lib-noErrors.ts, 313, 40), Decl(1.0lib-noErrors.ts, 319, 36)) >regexp : Symbol(regexp, Decl(1.0lib-noErrors.ts, 325, 10)) >RegExp : Symbol(RegExp, Decl(1.0lib-noErrors.ts, 822, 1), Decl(1.0lib-noErrors.ts, 855, 11)) @@ -488,7 +488,7 @@ interface String { * @param replaceValue A String object or string literal containing the text to replace for every successful match of rgExp in stringObj. */ replace(searchValue: string, replaceValue: string): string; ->replace : Symbol(replace, Decl(1.0lib-noErrors.ts, 325, 36), Decl(1.0lib-noErrors.ts, 332, 63), Decl(1.0lib-noErrors.ts, 339, 102), Decl(1.0lib-noErrors.ts, 346, 63)) +>replace : Symbol(String.replace, Decl(1.0lib-noErrors.ts, 325, 36), Decl(1.0lib-noErrors.ts, 332, 63), Decl(1.0lib-noErrors.ts, 339, 102), Decl(1.0lib-noErrors.ts, 346, 63)) >searchValue : Symbol(searchValue, Decl(1.0lib-noErrors.ts, 332, 12)) >replaceValue : Symbol(replaceValue, Decl(1.0lib-noErrors.ts, 332, 32)) @@ -498,7 +498,7 @@ interface String { * @param replaceValue A function that returns the replacement text. */ replace(searchValue: string, replaceValue: (substring: string, ...args: any[]) => string): string; ->replace : Symbol(replace, Decl(1.0lib-noErrors.ts, 325, 36), Decl(1.0lib-noErrors.ts, 332, 63), Decl(1.0lib-noErrors.ts, 339, 102), Decl(1.0lib-noErrors.ts, 346, 63)) +>replace : Symbol(String.replace, Decl(1.0lib-noErrors.ts, 325, 36), Decl(1.0lib-noErrors.ts, 332, 63), Decl(1.0lib-noErrors.ts, 339, 102), Decl(1.0lib-noErrors.ts, 346, 63)) >searchValue : Symbol(searchValue, Decl(1.0lib-noErrors.ts, 339, 12)) >replaceValue : Symbol(replaceValue, Decl(1.0lib-noErrors.ts, 339, 32)) >substring : Symbol(substring, Decl(1.0lib-noErrors.ts, 339, 48)) @@ -510,7 +510,7 @@ interface String { * @param replaceValue A String object or string literal containing the text to replace for every successful match of rgExp in stringObj. */ replace(searchValue: RegExp, replaceValue: string): string; ->replace : Symbol(replace, Decl(1.0lib-noErrors.ts, 325, 36), Decl(1.0lib-noErrors.ts, 332, 63), Decl(1.0lib-noErrors.ts, 339, 102), Decl(1.0lib-noErrors.ts, 346, 63)) +>replace : Symbol(String.replace, Decl(1.0lib-noErrors.ts, 325, 36), Decl(1.0lib-noErrors.ts, 332, 63), Decl(1.0lib-noErrors.ts, 339, 102), Decl(1.0lib-noErrors.ts, 346, 63)) >searchValue : Symbol(searchValue, Decl(1.0lib-noErrors.ts, 346, 12)) >RegExp : Symbol(RegExp, Decl(1.0lib-noErrors.ts, 822, 1), Decl(1.0lib-noErrors.ts, 855, 11)) >replaceValue : Symbol(replaceValue, Decl(1.0lib-noErrors.ts, 346, 32)) @@ -521,7 +521,7 @@ interface String { * @param replaceValue A function that returns the replacement text. */ replace(searchValue: RegExp, replaceValue: (substring: string, ...args: any[]) => string): string; ->replace : Symbol(replace, Decl(1.0lib-noErrors.ts, 325, 36), Decl(1.0lib-noErrors.ts, 332, 63), Decl(1.0lib-noErrors.ts, 339, 102), Decl(1.0lib-noErrors.ts, 346, 63)) +>replace : Symbol(String.replace, Decl(1.0lib-noErrors.ts, 325, 36), Decl(1.0lib-noErrors.ts, 332, 63), Decl(1.0lib-noErrors.ts, 339, 102), Decl(1.0lib-noErrors.ts, 346, 63)) >searchValue : Symbol(searchValue, Decl(1.0lib-noErrors.ts, 353, 12)) >RegExp : Symbol(RegExp, Decl(1.0lib-noErrors.ts, 822, 1), Decl(1.0lib-noErrors.ts, 855, 11)) >replaceValue : Symbol(replaceValue, Decl(1.0lib-noErrors.ts, 353, 32)) @@ -533,7 +533,7 @@ interface String { * @param regexp The regular expression pattern and applicable flags. */ search(regexp: string): number; ->search : Symbol(search, Decl(1.0lib-noErrors.ts, 353, 102), Decl(1.0lib-noErrors.ts, 359, 35)) +>search : Symbol(String.search, Decl(1.0lib-noErrors.ts, 353, 102), Decl(1.0lib-noErrors.ts, 359, 35)) >regexp : Symbol(regexp, Decl(1.0lib-noErrors.ts, 359, 11)) /** @@ -541,7 +541,7 @@ interface String { * @param regexp The regular expression pattern and applicable flags. */ search(regexp: RegExp): number; ->search : Symbol(search, Decl(1.0lib-noErrors.ts, 353, 102), Decl(1.0lib-noErrors.ts, 359, 35)) +>search : Symbol(String.search, Decl(1.0lib-noErrors.ts, 353, 102), Decl(1.0lib-noErrors.ts, 359, 35)) >regexp : Symbol(regexp, Decl(1.0lib-noErrors.ts, 365, 11)) >RegExp : Symbol(RegExp, Decl(1.0lib-noErrors.ts, 822, 1), Decl(1.0lib-noErrors.ts, 855, 11)) @@ -552,7 +552,7 @@ interface String { * If this value is not specified, the substring continues to the end of stringObj. */ slice(start?: number, end?: number): string; ->slice : Symbol(slice, Decl(1.0lib-noErrors.ts, 365, 35)) +>slice : Symbol(String.slice, Decl(1.0lib-noErrors.ts, 365, 35)) >start : Symbol(start, Decl(1.0lib-noErrors.ts, 373, 10)) >end : Symbol(end, Decl(1.0lib-noErrors.ts, 373, 25)) @@ -562,7 +562,7 @@ interface String { * @param limit A value used to limit the number of elements returned in the array. */ split(separator: string, limit?: number): string[]; ->split : Symbol(split, Decl(1.0lib-noErrors.ts, 373, 48), Decl(1.0lib-noErrors.ts, 380, 55)) +>split : Symbol(String.split, Decl(1.0lib-noErrors.ts, 373, 48), Decl(1.0lib-noErrors.ts, 380, 55)) >separator : Symbol(separator, Decl(1.0lib-noErrors.ts, 380, 10)) >limit : Symbol(limit, Decl(1.0lib-noErrors.ts, 380, 28)) @@ -572,7 +572,7 @@ interface String { * @param limit A value used to limit the number of elements returned in the array. */ split(separator: RegExp, limit?: number): string[]; ->split : Symbol(split, Decl(1.0lib-noErrors.ts, 373, 48), Decl(1.0lib-noErrors.ts, 380, 55)) +>split : Symbol(String.split, Decl(1.0lib-noErrors.ts, 373, 48), Decl(1.0lib-noErrors.ts, 380, 55)) >separator : Symbol(separator, Decl(1.0lib-noErrors.ts, 387, 10)) >RegExp : Symbol(RegExp, Decl(1.0lib-noErrors.ts, 822, 1), Decl(1.0lib-noErrors.ts, 855, 11)) >limit : Symbol(limit, Decl(1.0lib-noErrors.ts, 387, 28)) @@ -584,33 +584,33 @@ interface String { * If end is omitted, the characters from start through the end of the original string are returned. */ substring(start: number, end?: number): string; ->substring : Symbol(substring, Decl(1.0lib-noErrors.ts, 387, 55)) +>substring : Symbol(String.substring, Decl(1.0lib-noErrors.ts, 387, 55)) >start : Symbol(start, Decl(1.0lib-noErrors.ts, 395, 14)) >end : Symbol(end, Decl(1.0lib-noErrors.ts, 395, 28)) /** Converts all the alphabetic characters in a string to lowercase. */ toLowerCase(): string; ->toLowerCase : Symbol(toLowerCase, Decl(1.0lib-noErrors.ts, 395, 51)) +>toLowerCase : Symbol(String.toLowerCase, Decl(1.0lib-noErrors.ts, 395, 51)) /** Converts all alphabetic characters to lowercase, taking into account the host environment's current locale. */ toLocaleLowerCase(): string; ->toLocaleLowerCase : Symbol(toLocaleLowerCase, Decl(1.0lib-noErrors.ts, 398, 26)) +>toLocaleLowerCase : Symbol(String.toLocaleLowerCase, Decl(1.0lib-noErrors.ts, 398, 26)) /** Converts all the alphabetic characters in a string to uppercase. */ toUpperCase(): string; ->toUpperCase : Symbol(toUpperCase, Decl(1.0lib-noErrors.ts, 401, 32)) +>toUpperCase : Symbol(String.toUpperCase, Decl(1.0lib-noErrors.ts, 401, 32)) /** Returns a string where all alphabetic characters have been converted to uppercase, taking into account the host environment's current locale. */ toLocaleUpperCase(): string; ->toLocaleUpperCase : Symbol(toLocaleUpperCase, Decl(1.0lib-noErrors.ts, 404, 26)) +>toLocaleUpperCase : Symbol(String.toLocaleUpperCase, Decl(1.0lib-noErrors.ts, 404, 26)) /** Removes the leading and trailing white space and line terminator characters from a string. */ trim(): string; ->trim : Symbol(trim, Decl(1.0lib-noErrors.ts, 407, 32)) +>trim : Symbol(String.trim, Decl(1.0lib-noErrors.ts, 407, 32)) /** Returns the length of a String object. */ length: number; ->length : Symbol(length, Decl(1.0lib-noErrors.ts, 410, 19)) +>length : Symbol(String.length, Decl(1.0lib-noErrors.ts, 410, 19)) // IE extensions /** @@ -619,7 +619,7 @@ interface String { * @param length The number of characters to include in the returned substring. */ substr(from: number, length?: number): string; ->substr : Symbol(substr, Decl(1.0lib-noErrors.ts, 413, 19)) +>substr : Symbol(String.substr, Decl(1.0lib-noErrors.ts, 413, 19)) >from : Symbol(from, Decl(1.0lib-noErrors.ts, 421, 11)) >length : Symbol(length, Decl(1.0lib-noErrors.ts, 421, 24)) @@ -675,7 +675,7 @@ interface Number { * @param radix Specifies a radix for converting numeric values to strings. This value is only used for numbers. */ toString(radix?: number): string; ->toString : Symbol(toString, Decl(1.0lib-noErrors.ts, 444, 18)) +>toString : Symbol(Number.toString, Decl(1.0lib-noErrors.ts, 444, 18)) >radix : Symbol(radix, Decl(1.0lib-noErrors.ts, 449, 13)) /** @@ -683,7 +683,7 @@ interface Number { * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive. */ toFixed(fractionDigits?: number): string; ->toFixed : Symbol(toFixed, Decl(1.0lib-noErrors.ts, 449, 37)) +>toFixed : Symbol(Number.toFixed, Decl(1.0lib-noErrors.ts, 449, 37)) >fractionDigits : Symbol(fractionDigits, Decl(1.0lib-noErrors.ts, 455, 12)) /** @@ -691,7 +691,7 @@ interface Number { * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive. */ toExponential(fractionDigits?: number): string; ->toExponential : Symbol(toExponential, Decl(1.0lib-noErrors.ts, 455, 45)) +>toExponential : Symbol(Number.toExponential, Decl(1.0lib-noErrors.ts, 455, 45)) >fractionDigits : Symbol(fractionDigits, Decl(1.0lib-noErrors.ts, 461, 18)) /** @@ -699,7 +699,7 @@ interface Number { * @param precision Number of significant digits. Must be in the range 1 - 21, inclusive. */ toPrecision(precision?: number): string; ->toPrecision : Symbol(toPrecision, Decl(1.0lib-noErrors.ts, 461, 51)) +>toPrecision : Symbol(Number.toPrecision, Decl(1.0lib-noErrors.ts, 461, 51)) >precision : Symbol(precision, Decl(1.0lib-noErrors.ts, 467, 16)) } @@ -753,35 +753,35 @@ interface Math { /** The mathematical constant e. This is Euler's number, the base of natural logarithms. */ E: number; ->E : Symbol(E, Decl(1.0lib-noErrors.ts, 501, 16)) +>E : Symbol(Math.E, Decl(1.0lib-noErrors.ts, 501, 16)) /** The natural logarithm of 10. */ LN10: number; ->LN10 : Symbol(LN10, Decl(1.0lib-noErrors.ts, 503, 14)) +>LN10 : Symbol(Math.LN10, Decl(1.0lib-noErrors.ts, 503, 14)) /** The natural logarithm of 2. */ LN2: number; ->LN2 : Symbol(LN2, Decl(1.0lib-noErrors.ts, 505, 17)) +>LN2 : Symbol(Math.LN2, Decl(1.0lib-noErrors.ts, 505, 17)) /** The base-2 logarithm of e. */ LOG2E: number; ->LOG2E : Symbol(LOG2E, Decl(1.0lib-noErrors.ts, 507, 16)) +>LOG2E : Symbol(Math.LOG2E, Decl(1.0lib-noErrors.ts, 507, 16)) /** The base-10 logarithm of e. */ LOG10E: number; ->LOG10E : Symbol(LOG10E, Decl(1.0lib-noErrors.ts, 509, 18)) +>LOG10E : Symbol(Math.LOG10E, Decl(1.0lib-noErrors.ts, 509, 18)) /** Pi. This is the ratio of the circumference of a circle to its diameter. */ PI: number; ->PI : Symbol(PI, Decl(1.0lib-noErrors.ts, 511, 19)) +>PI : Symbol(Math.PI, Decl(1.0lib-noErrors.ts, 511, 19)) /** The square root of 0.5, or, equivalently, one divided by the square root of 2. */ SQRT1_2: number; ->SQRT1_2 : Symbol(SQRT1_2, Decl(1.0lib-noErrors.ts, 513, 15)) +>SQRT1_2 : Symbol(Math.SQRT1_2, Decl(1.0lib-noErrors.ts, 513, 15)) /** The square root of 2. */ SQRT2: number; ->SQRT2 : Symbol(SQRT2, Decl(1.0lib-noErrors.ts, 515, 20)) +>SQRT2 : Symbol(Math.SQRT2, Decl(1.0lib-noErrors.ts, 515, 20)) /** * Returns the absolute value of a number (the value without regard to whether it is positive or negative). @@ -789,7 +789,7 @@ interface Math { * @param x A numeric expression for which the absolute value is needed. */ abs(x: number): number; ->abs : Symbol(abs, Decl(1.0lib-noErrors.ts, 517, 18)) +>abs : Symbol(Math.abs, Decl(1.0lib-noErrors.ts, 517, 18)) >x : Symbol(x, Decl(1.0lib-noErrors.ts, 523, 8)) /** @@ -797,7 +797,7 @@ interface Math { * @param x A numeric expression. */ acos(x: number): number; ->acos : Symbol(acos, Decl(1.0lib-noErrors.ts, 523, 27)) +>acos : Symbol(Math.acos, Decl(1.0lib-noErrors.ts, 523, 27)) >x : Symbol(x, Decl(1.0lib-noErrors.ts, 528, 9)) /** @@ -805,7 +805,7 @@ interface Math { * @param x A numeric expression. */ asin(x: number): number; ->asin : Symbol(asin, Decl(1.0lib-noErrors.ts, 528, 28)) +>asin : Symbol(Math.asin, Decl(1.0lib-noErrors.ts, 528, 28)) >x : Symbol(x, Decl(1.0lib-noErrors.ts, 533, 9)) /** @@ -813,7 +813,7 @@ interface Math { * @param x A numeric expression for which the arctangent is needed. */ atan(x: number): number; ->atan : Symbol(atan, Decl(1.0lib-noErrors.ts, 533, 28)) +>atan : Symbol(Math.atan, Decl(1.0lib-noErrors.ts, 533, 28)) >x : Symbol(x, Decl(1.0lib-noErrors.ts, 538, 9)) /** @@ -822,7 +822,7 @@ interface Math { * @param x A numeric expression representing the cartesian x-coordinate. */ atan2(y: number, x: number): number; ->atan2 : Symbol(atan2, Decl(1.0lib-noErrors.ts, 538, 28)) +>atan2 : Symbol(Math.atan2, Decl(1.0lib-noErrors.ts, 538, 28)) >y : Symbol(y, Decl(1.0lib-noErrors.ts, 544, 10)) >x : Symbol(x, Decl(1.0lib-noErrors.ts, 544, 20)) @@ -831,7 +831,7 @@ interface Math { * @param x A numeric expression. */ ceil(x: number): number; ->ceil : Symbol(ceil, Decl(1.0lib-noErrors.ts, 544, 40)) +>ceil : Symbol(Math.ceil, Decl(1.0lib-noErrors.ts, 544, 40)) >x : Symbol(x, Decl(1.0lib-noErrors.ts, 549, 9)) /** @@ -839,7 +839,7 @@ interface Math { * @param x A numeric expression that contains an angle measured in radians. */ cos(x: number): number; ->cos : Symbol(cos, Decl(1.0lib-noErrors.ts, 549, 28)) +>cos : Symbol(Math.cos, Decl(1.0lib-noErrors.ts, 549, 28)) >x : Symbol(x, Decl(1.0lib-noErrors.ts, 554, 8)) /** @@ -847,7 +847,7 @@ interface Math { * @param x A numeric expression representing the power of e. */ exp(x: number): number; ->exp : Symbol(exp, Decl(1.0lib-noErrors.ts, 554, 27)) +>exp : Symbol(Math.exp, Decl(1.0lib-noErrors.ts, 554, 27)) >x : Symbol(x, Decl(1.0lib-noErrors.ts, 559, 8)) /** @@ -855,7 +855,7 @@ interface Math { * @param x A numeric expression. */ floor(x: number): number; ->floor : Symbol(floor, Decl(1.0lib-noErrors.ts, 559, 27)) +>floor : Symbol(Math.floor, Decl(1.0lib-noErrors.ts, 559, 27)) >x : Symbol(x, Decl(1.0lib-noErrors.ts, 564, 10)) /** @@ -863,7 +863,7 @@ interface Math { * @param x A numeric expression. */ log(x: number): number; ->log : Symbol(log, Decl(1.0lib-noErrors.ts, 564, 29)) +>log : Symbol(Math.log, Decl(1.0lib-noErrors.ts, 564, 29)) >x : Symbol(x, Decl(1.0lib-noErrors.ts, 569, 8)) /** @@ -871,7 +871,7 @@ interface Math { * @param values Numeric expressions to be evaluated. */ max(...values: number[]): number; ->max : Symbol(max, Decl(1.0lib-noErrors.ts, 569, 27)) +>max : Symbol(Math.max, Decl(1.0lib-noErrors.ts, 569, 27)) >values : Symbol(values, Decl(1.0lib-noErrors.ts, 574, 8)) /** @@ -879,7 +879,7 @@ interface Math { * @param values Numeric expressions to be evaluated. */ min(...values: number[]): number; ->min : Symbol(min, Decl(1.0lib-noErrors.ts, 574, 37)) +>min : Symbol(Math.min, Decl(1.0lib-noErrors.ts, 574, 37)) >values : Symbol(values, Decl(1.0lib-noErrors.ts, 579, 8)) /** @@ -888,20 +888,20 @@ interface Math { * @param y The exponent value of the expression. */ pow(x: number, y: number): number; ->pow : Symbol(pow, Decl(1.0lib-noErrors.ts, 579, 37)) +>pow : Symbol(Math.pow, Decl(1.0lib-noErrors.ts, 579, 37)) >x : Symbol(x, Decl(1.0lib-noErrors.ts, 585, 8)) >y : Symbol(y, Decl(1.0lib-noErrors.ts, 585, 18)) /** Returns a pseudorandom number between 0 and 1. */ random(): number; ->random : Symbol(random, Decl(1.0lib-noErrors.ts, 585, 38)) +>random : Symbol(Math.random, Decl(1.0lib-noErrors.ts, 585, 38)) /** * Returns a supplied numeric expression rounded to the nearest number. * @param x The value to be rounded to the nearest number. */ round(x: number): number; ->round : Symbol(round, Decl(1.0lib-noErrors.ts, 587, 21)) +>round : Symbol(Math.round, Decl(1.0lib-noErrors.ts, 587, 21)) >x : Symbol(x, Decl(1.0lib-noErrors.ts, 592, 10)) /** @@ -909,7 +909,7 @@ interface Math { * @param x A numeric expression that contains an angle measured in radians. */ sin(x: number): number; ->sin : Symbol(sin, Decl(1.0lib-noErrors.ts, 592, 29)) +>sin : Symbol(Math.sin, Decl(1.0lib-noErrors.ts, 592, 29)) >x : Symbol(x, Decl(1.0lib-noErrors.ts, 597, 8)) /** @@ -917,7 +917,7 @@ interface Math { * @param x A numeric expression. */ sqrt(x: number): number; ->sqrt : Symbol(sqrt, Decl(1.0lib-noErrors.ts, 597, 27)) +>sqrt : Symbol(Math.sqrt, Decl(1.0lib-noErrors.ts, 597, 27)) >x : Symbol(x, Decl(1.0lib-noErrors.ts, 602, 9)) /** @@ -925,7 +925,7 @@ interface Math { * @param x A numeric expression that contains an angle measured in radians. */ tan(x: number): number; ->tan : Symbol(tan, Decl(1.0lib-noErrors.ts, 602, 28)) +>tan : Symbol(Math.tan, Decl(1.0lib-noErrors.ts, 602, 28)) >x : Symbol(x, Decl(1.0lib-noErrors.ts, 607, 8)) } /** An intrinsic object that provides basic mathematics functionality and constants. */ @@ -939,110 +939,110 @@ interface Date { /** Returns a string representation of a date. The format of the string depends on the locale. */ toString(): string; ->toString : Symbol(toString, Decl(1.0lib-noErrors.ts, 613, 16)) +>toString : Symbol(Date.toString, Decl(1.0lib-noErrors.ts, 613, 16)) /** Returns a date as a string value. */ toDateString(): string; ->toDateString : Symbol(toDateString, Decl(1.0lib-noErrors.ts, 615, 23)) +>toDateString : Symbol(Date.toDateString, Decl(1.0lib-noErrors.ts, 615, 23)) /** Returns a time as a string value. */ toTimeString(): string; ->toTimeString : Symbol(toTimeString, Decl(1.0lib-noErrors.ts, 617, 27)) +>toTimeString : Symbol(Date.toTimeString, Decl(1.0lib-noErrors.ts, 617, 27)) /** Returns a value as a string value appropriate to the host environment's current locale. */ toLocaleString(): string; ->toLocaleString : Symbol(toLocaleString, Decl(1.0lib-noErrors.ts, 619, 27)) +>toLocaleString : Symbol(Date.toLocaleString, Decl(1.0lib-noErrors.ts, 619, 27)) /** Returns a date as a string value appropriate to the host environment's current locale. */ toLocaleDateString(): string; ->toLocaleDateString : Symbol(toLocaleDateString, Decl(1.0lib-noErrors.ts, 621, 29)) +>toLocaleDateString : Symbol(Date.toLocaleDateString, Decl(1.0lib-noErrors.ts, 621, 29)) /** Returns a time as a string value appropriate to the host environment's current locale. */ toLocaleTimeString(): string; ->toLocaleTimeString : Symbol(toLocaleTimeString, Decl(1.0lib-noErrors.ts, 623, 33)) +>toLocaleTimeString : Symbol(Date.toLocaleTimeString, Decl(1.0lib-noErrors.ts, 623, 33)) /** Returns the stored time value in milliseconds since midnight, January 1, 1970 UTC. */ valueOf(): number; ->valueOf : Symbol(valueOf, Decl(1.0lib-noErrors.ts, 625, 33)) +>valueOf : Symbol(Date.valueOf, Decl(1.0lib-noErrors.ts, 625, 33)) /** Gets the time value in milliseconds. */ getTime(): number; ->getTime : Symbol(getTime, Decl(1.0lib-noErrors.ts, 627, 22)) +>getTime : Symbol(Date.getTime, Decl(1.0lib-noErrors.ts, 627, 22)) /** Gets the year, using local time. */ getFullYear(): number; ->getFullYear : Symbol(getFullYear, Decl(1.0lib-noErrors.ts, 629, 22)) +>getFullYear : Symbol(Date.getFullYear, Decl(1.0lib-noErrors.ts, 629, 22)) /** Gets the year using Universal Coordinated Time (UTC). */ getUTCFullYear(): number; ->getUTCFullYear : Symbol(getUTCFullYear, Decl(1.0lib-noErrors.ts, 631, 26)) +>getUTCFullYear : Symbol(Date.getUTCFullYear, Decl(1.0lib-noErrors.ts, 631, 26)) /** Gets the month, using local time. */ getMonth(): number; ->getMonth : Symbol(getMonth, Decl(1.0lib-noErrors.ts, 633, 29)) +>getMonth : Symbol(Date.getMonth, Decl(1.0lib-noErrors.ts, 633, 29)) /** Gets the month of a Date object using Universal Coordinated Time (UTC). */ getUTCMonth(): number; ->getUTCMonth : Symbol(getUTCMonth, Decl(1.0lib-noErrors.ts, 635, 23)) +>getUTCMonth : Symbol(Date.getUTCMonth, Decl(1.0lib-noErrors.ts, 635, 23)) /** Gets the day-of-the-month, using local time. */ getDate(): number; ->getDate : Symbol(getDate, Decl(1.0lib-noErrors.ts, 637, 26)) +>getDate : Symbol(Date.getDate, Decl(1.0lib-noErrors.ts, 637, 26)) /** Gets the day-of-the-month, using Universal Coordinated Time (UTC). */ getUTCDate(): number; ->getUTCDate : Symbol(getUTCDate, Decl(1.0lib-noErrors.ts, 639, 22)) +>getUTCDate : Symbol(Date.getUTCDate, Decl(1.0lib-noErrors.ts, 639, 22)) /** Gets the day of the week, using local time. */ getDay(): number; ->getDay : Symbol(getDay, Decl(1.0lib-noErrors.ts, 641, 25)) +>getDay : Symbol(Date.getDay, Decl(1.0lib-noErrors.ts, 641, 25)) /** Gets the day of the week using Universal Coordinated Time (UTC). */ getUTCDay(): number; ->getUTCDay : Symbol(getUTCDay, Decl(1.0lib-noErrors.ts, 643, 21)) +>getUTCDay : Symbol(Date.getUTCDay, Decl(1.0lib-noErrors.ts, 643, 21)) /** Gets the hours in a date, using local time. */ getHours(): number; ->getHours : Symbol(getHours, Decl(1.0lib-noErrors.ts, 645, 24)) +>getHours : Symbol(Date.getHours, Decl(1.0lib-noErrors.ts, 645, 24)) /** Gets the hours value in a Date object using Universal Coordinated Time (UTC). */ getUTCHours(): number; ->getUTCHours : Symbol(getUTCHours, Decl(1.0lib-noErrors.ts, 647, 23)) +>getUTCHours : Symbol(Date.getUTCHours, Decl(1.0lib-noErrors.ts, 647, 23)) /** Gets the minutes of a Date object, using local time. */ getMinutes(): number; ->getMinutes : Symbol(getMinutes, Decl(1.0lib-noErrors.ts, 649, 26)) +>getMinutes : Symbol(Date.getMinutes, Decl(1.0lib-noErrors.ts, 649, 26)) /** Gets the minutes of a Date object using Universal Coordinated Time (UTC). */ getUTCMinutes(): number; ->getUTCMinutes : Symbol(getUTCMinutes, Decl(1.0lib-noErrors.ts, 651, 25)) +>getUTCMinutes : Symbol(Date.getUTCMinutes, Decl(1.0lib-noErrors.ts, 651, 25)) /** Gets the seconds of a Date object, using local time. */ getSeconds(): number; ->getSeconds : Symbol(getSeconds, Decl(1.0lib-noErrors.ts, 653, 28)) +>getSeconds : Symbol(Date.getSeconds, Decl(1.0lib-noErrors.ts, 653, 28)) /** Gets the seconds of a Date object using Universal Coordinated Time (UTC). */ getUTCSeconds(): number; ->getUTCSeconds : Symbol(getUTCSeconds, Decl(1.0lib-noErrors.ts, 655, 25)) +>getUTCSeconds : Symbol(Date.getUTCSeconds, Decl(1.0lib-noErrors.ts, 655, 25)) /** Gets the milliseconds of a Date, using local time. */ getMilliseconds(): number; ->getMilliseconds : Symbol(getMilliseconds, Decl(1.0lib-noErrors.ts, 657, 28)) +>getMilliseconds : Symbol(Date.getMilliseconds, Decl(1.0lib-noErrors.ts, 657, 28)) /** Gets the milliseconds of a Date object using Universal Coordinated Time (UTC). */ getUTCMilliseconds(): number; ->getUTCMilliseconds : Symbol(getUTCMilliseconds, Decl(1.0lib-noErrors.ts, 659, 30)) +>getUTCMilliseconds : Symbol(Date.getUTCMilliseconds, Decl(1.0lib-noErrors.ts, 659, 30)) /** Gets the difference in minutes between the time on the local computer and Universal Coordinated Time (UTC). */ getTimezoneOffset(): number; ->getTimezoneOffset : Symbol(getTimezoneOffset, Decl(1.0lib-noErrors.ts, 661, 33)) +>getTimezoneOffset : Symbol(Date.getTimezoneOffset, Decl(1.0lib-noErrors.ts, 661, 33)) /** * Sets the date and time value in the Date object. * @param time A numeric value representing the number of elapsed milliseconds since midnight, January 1, 1970 GMT. */ setTime(time: number): number; ->setTime : Symbol(setTime, Decl(1.0lib-noErrors.ts, 663, 32)) +>setTime : Symbol(Date.setTime, Decl(1.0lib-noErrors.ts, 663, 32)) >time : Symbol(time, Decl(1.0lib-noErrors.ts, 668, 12)) /** @@ -1050,7 +1050,7 @@ interface Date { * @param ms A numeric value equal to the millisecond value. */ setMilliseconds(ms: number): number; ->setMilliseconds : Symbol(setMilliseconds, Decl(1.0lib-noErrors.ts, 668, 34)) +>setMilliseconds : Symbol(Date.setMilliseconds, Decl(1.0lib-noErrors.ts, 668, 34)) >ms : Symbol(ms, Decl(1.0lib-noErrors.ts, 673, 20)) /** @@ -1058,7 +1058,7 @@ interface Date { * @param ms A numeric value equal to the millisecond value. */ setUTCMilliseconds(ms: number): number; ->setUTCMilliseconds : Symbol(setUTCMilliseconds, Decl(1.0lib-noErrors.ts, 673, 40)) +>setUTCMilliseconds : Symbol(Date.setUTCMilliseconds, Decl(1.0lib-noErrors.ts, 673, 40)) >ms : Symbol(ms, Decl(1.0lib-noErrors.ts, 678, 23)) /** @@ -1067,7 +1067,7 @@ interface Date { * @param ms A numeric value equal to the milliseconds value. */ setSeconds(sec: number, ms?: number): number; ->setSeconds : Symbol(setSeconds, Decl(1.0lib-noErrors.ts, 678, 43)) +>setSeconds : Symbol(Date.setSeconds, Decl(1.0lib-noErrors.ts, 678, 43)) >sec : Symbol(sec, Decl(1.0lib-noErrors.ts, 685, 15)) >ms : Symbol(ms, Decl(1.0lib-noErrors.ts, 685, 27)) @@ -1077,7 +1077,7 @@ interface Date { * @param ms A numeric value equal to the milliseconds value. */ setUTCSeconds(sec: number, ms?: number): number; ->setUTCSeconds : Symbol(setUTCSeconds, Decl(1.0lib-noErrors.ts, 685, 49)) +>setUTCSeconds : Symbol(Date.setUTCSeconds, Decl(1.0lib-noErrors.ts, 685, 49)) >sec : Symbol(sec, Decl(1.0lib-noErrors.ts, 691, 18)) >ms : Symbol(ms, Decl(1.0lib-noErrors.ts, 691, 30)) @@ -1088,7 +1088,7 @@ interface Date { * @param ms A numeric value equal to the milliseconds value. */ setMinutes(min: number, sec?: number, ms?: number): number; ->setMinutes : Symbol(setMinutes, Decl(1.0lib-noErrors.ts, 691, 52)) +>setMinutes : Symbol(Date.setMinutes, Decl(1.0lib-noErrors.ts, 691, 52)) >min : Symbol(min, Decl(1.0lib-noErrors.ts, 698, 15)) >sec : Symbol(sec, Decl(1.0lib-noErrors.ts, 698, 27)) >ms : Symbol(ms, Decl(1.0lib-noErrors.ts, 698, 41)) @@ -1100,7 +1100,7 @@ interface Date { * @param ms A numeric value equal to the milliseconds value. */ setUTCMinutes(min: number, sec?: number, ms?: number): number; ->setUTCMinutes : Symbol(setUTCMinutes, Decl(1.0lib-noErrors.ts, 698, 63)) +>setUTCMinutes : Symbol(Date.setUTCMinutes, Decl(1.0lib-noErrors.ts, 698, 63)) >min : Symbol(min, Decl(1.0lib-noErrors.ts, 705, 18)) >sec : Symbol(sec, Decl(1.0lib-noErrors.ts, 705, 30)) >ms : Symbol(ms, Decl(1.0lib-noErrors.ts, 705, 44)) @@ -1113,7 +1113,7 @@ interface Date { * @param ms A numeric value equal to the milliseconds value. */ setHours(hours: number, min?: number, sec?: number, ms?: number): number; ->setHours : Symbol(setHours, Decl(1.0lib-noErrors.ts, 705, 66)) +>setHours : Symbol(Date.setHours, Decl(1.0lib-noErrors.ts, 705, 66)) >hours : Symbol(hours, Decl(1.0lib-noErrors.ts, 713, 13)) >min : Symbol(min, Decl(1.0lib-noErrors.ts, 713, 27)) >sec : Symbol(sec, Decl(1.0lib-noErrors.ts, 713, 41)) @@ -1127,7 +1127,7 @@ interface Date { * @param ms A numeric value equal to the milliseconds value. */ setUTCHours(hours: number, min?: number, sec?: number, ms?: number): number; ->setUTCHours : Symbol(setUTCHours, Decl(1.0lib-noErrors.ts, 713, 77)) +>setUTCHours : Symbol(Date.setUTCHours, Decl(1.0lib-noErrors.ts, 713, 77)) >hours : Symbol(hours, Decl(1.0lib-noErrors.ts, 721, 16)) >min : Symbol(min, Decl(1.0lib-noErrors.ts, 721, 30)) >sec : Symbol(sec, Decl(1.0lib-noErrors.ts, 721, 44)) @@ -1138,7 +1138,7 @@ interface Date { * @param date A numeric value equal to the day of the month. */ setDate(date: number): number; ->setDate : Symbol(setDate, Decl(1.0lib-noErrors.ts, 721, 80)) +>setDate : Symbol(Date.setDate, Decl(1.0lib-noErrors.ts, 721, 80)) >date : Symbol(date, Decl(1.0lib-noErrors.ts, 726, 12)) /** @@ -1146,7 +1146,7 @@ interface Date { * @param date A numeric value equal to the day of the month. */ setUTCDate(date: number): number; ->setUTCDate : Symbol(setUTCDate, Decl(1.0lib-noErrors.ts, 726, 34)) +>setUTCDate : Symbol(Date.setUTCDate, Decl(1.0lib-noErrors.ts, 726, 34)) >date : Symbol(date, Decl(1.0lib-noErrors.ts, 731, 15)) /** @@ -1155,7 +1155,7 @@ interface Date { * @param date A numeric value representing the day of the month. If this value is not supplied, the value from a call to the getDate method is used. */ setMonth(month: number, date?: number): number; ->setMonth : Symbol(setMonth, Decl(1.0lib-noErrors.ts, 731, 37)) +>setMonth : Symbol(Date.setMonth, Decl(1.0lib-noErrors.ts, 731, 37)) >month : Symbol(month, Decl(1.0lib-noErrors.ts, 737, 13)) >date : Symbol(date, Decl(1.0lib-noErrors.ts, 737, 27)) @@ -1165,7 +1165,7 @@ interface Date { * @param date A numeric value representing the day of the month. If it is not supplied, the value from a call to the getUTCDate method is used. */ setUTCMonth(month: number, date?: number): number; ->setUTCMonth : Symbol(setUTCMonth, Decl(1.0lib-noErrors.ts, 737, 51)) +>setUTCMonth : Symbol(Date.setUTCMonth, Decl(1.0lib-noErrors.ts, 737, 51)) >month : Symbol(month, Decl(1.0lib-noErrors.ts, 743, 16)) >date : Symbol(date, Decl(1.0lib-noErrors.ts, 743, 30)) @@ -1176,7 +1176,7 @@ interface Date { * @param date A numeric value equal for the day of the month. */ setFullYear(year: number, month?: number, date?: number): number; ->setFullYear : Symbol(setFullYear, Decl(1.0lib-noErrors.ts, 743, 54)) +>setFullYear : Symbol(Date.setFullYear, Decl(1.0lib-noErrors.ts, 743, 54)) >year : Symbol(year, Decl(1.0lib-noErrors.ts, 750, 16)) >month : Symbol(month, Decl(1.0lib-noErrors.ts, 750, 29)) >date : Symbol(date, Decl(1.0lib-noErrors.ts, 750, 45)) @@ -1188,22 +1188,22 @@ interface Date { * @param date A numeric value equal to the day of the month. */ setUTCFullYear(year: number, month?: number, date?: number): number; ->setUTCFullYear : Symbol(setUTCFullYear, Decl(1.0lib-noErrors.ts, 750, 69)) +>setUTCFullYear : Symbol(Date.setUTCFullYear, Decl(1.0lib-noErrors.ts, 750, 69)) >year : Symbol(year, Decl(1.0lib-noErrors.ts, 757, 19)) >month : Symbol(month, Decl(1.0lib-noErrors.ts, 757, 32)) >date : Symbol(date, Decl(1.0lib-noErrors.ts, 757, 48)) /** Returns a date converted to a string using Universal Coordinated Time (UTC). */ toUTCString(): string; ->toUTCString : Symbol(toUTCString, Decl(1.0lib-noErrors.ts, 757, 72)) +>toUTCString : Symbol(Date.toUTCString, Decl(1.0lib-noErrors.ts, 757, 72)) /** Returns a date as a string value in ISO format. */ toISOString(): string; ->toISOString : Symbol(toISOString, Decl(1.0lib-noErrors.ts, 759, 26)) +>toISOString : Symbol(Date.toISOString, Decl(1.0lib-noErrors.ts, 759, 26)) /** Used by the JSON.stringify method to enable the transformation of an object's data for JavaScript Object Notation (JSON) serialization. */ toJSON(key?: any): string; ->toJSON : Symbol(toJSON, Decl(1.0lib-noErrors.ts, 761, 26)) +>toJSON : Symbol(Date.toJSON, Decl(1.0lib-noErrors.ts, 761, 26)) >key : Symbol(key, Decl(1.0lib-noErrors.ts, 763, 11)) } @@ -1275,78 +1275,78 @@ interface RegExpExecArray { >index : Symbol(index, Decl(1.0lib-noErrors.ts, 793, 5)) length: number; ->length : Symbol(length, Decl(1.0lib-noErrors.ts, 793, 28)) +>length : Symbol(RegExpExecArray.length, Decl(1.0lib-noErrors.ts, 793, 28)) index: number; ->index : Symbol(index, Decl(1.0lib-noErrors.ts, 794, 19)) +>index : Symbol(RegExpExecArray.index, Decl(1.0lib-noErrors.ts, 794, 19)) input: string; ->input : Symbol(input, Decl(1.0lib-noErrors.ts, 796, 18)) +>input : Symbol(RegExpExecArray.input, Decl(1.0lib-noErrors.ts, 796, 18)) toString(): string; ->toString : Symbol(toString, Decl(1.0lib-noErrors.ts, 797, 18)) +>toString : Symbol(RegExpExecArray.toString, Decl(1.0lib-noErrors.ts, 797, 18)) toLocaleString(): string; ->toLocaleString : Symbol(toLocaleString, Decl(1.0lib-noErrors.ts, 799, 23)) +>toLocaleString : Symbol(RegExpExecArray.toLocaleString, Decl(1.0lib-noErrors.ts, 799, 23)) concat(...items: string[][]): string[]; ->concat : Symbol(concat, Decl(1.0lib-noErrors.ts, 800, 29)) +>concat : Symbol(RegExpExecArray.concat, Decl(1.0lib-noErrors.ts, 800, 29)) >items : Symbol(items, Decl(1.0lib-noErrors.ts, 801, 11)) join(separator?: string): string; ->join : Symbol(join, Decl(1.0lib-noErrors.ts, 801, 43)) +>join : Symbol(RegExpExecArray.join, Decl(1.0lib-noErrors.ts, 801, 43)) >separator : Symbol(separator, Decl(1.0lib-noErrors.ts, 802, 9)) pop(): string; ->pop : Symbol(pop, Decl(1.0lib-noErrors.ts, 802, 37)) +>pop : Symbol(RegExpExecArray.pop, Decl(1.0lib-noErrors.ts, 802, 37)) push(...items: string[]): number; ->push : Symbol(push, Decl(1.0lib-noErrors.ts, 803, 18)) +>push : Symbol(RegExpExecArray.push, Decl(1.0lib-noErrors.ts, 803, 18)) >items : Symbol(items, Decl(1.0lib-noErrors.ts, 804, 9)) reverse(): string[]; ->reverse : Symbol(reverse, Decl(1.0lib-noErrors.ts, 804, 37)) +>reverse : Symbol(RegExpExecArray.reverse, Decl(1.0lib-noErrors.ts, 804, 37)) shift(): string; ->shift : Symbol(shift, Decl(1.0lib-noErrors.ts, 805, 24)) +>shift : Symbol(RegExpExecArray.shift, Decl(1.0lib-noErrors.ts, 805, 24)) slice(start?: number, end?: number): string[]; ->slice : Symbol(slice, Decl(1.0lib-noErrors.ts, 806, 20)) +>slice : Symbol(RegExpExecArray.slice, Decl(1.0lib-noErrors.ts, 806, 20)) >start : Symbol(start, Decl(1.0lib-noErrors.ts, 807, 10)) >end : Symbol(end, Decl(1.0lib-noErrors.ts, 807, 25)) sort(compareFn?: (a: string, b: string) => number): string[]; ->sort : Symbol(sort, Decl(1.0lib-noErrors.ts, 807, 50)) +>sort : Symbol(RegExpExecArray.sort, Decl(1.0lib-noErrors.ts, 807, 50)) >compareFn : Symbol(compareFn, Decl(1.0lib-noErrors.ts, 808, 9)) >a : Symbol(a, Decl(1.0lib-noErrors.ts, 808, 22)) >b : Symbol(b, Decl(1.0lib-noErrors.ts, 808, 32)) splice(start: number): string[]; ->splice : Symbol(splice, Decl(1.0lib-noErrors.ts, 808, 65), Decl(1.0lib-noErrors.ts, 809, 36)) +>splice : Symbol(RegExpExecArray.splice, Decl(1.0lib-noErrors.ts, 808, 65), Decl(1.0lib-noErrors.ts, 809, 36)) >start : Symbol(start, Decl(1.0lib-noErrors.ts, 809, 11)) splice(start: number, deleteCount: number, ...items: string[]): string[]; ->splice : Symbol(splice, Decl(1.0lib-noErrors.ts, 808, 65), Decl(1.0lib-noErrors.ts, 809, 36)) +>splice : Symbol(RegExpExecArray.splice, Decl(1.0lib-noErrors.ts, 808, 65), Decl(1.0lib-noErrors.ts, 809, 36)) >start : Symbol(start, Decl(1.0lib-noErrors.ts, 810, 11)) >deleteCount : Symbol(deleteCount, Decl(1.0lib-noErrors.ts, 810, 25)) >items : Symbol(items, Decl(1.0lib-noErrors.ts, 810, 46)) unshift(...items: string[]): number; ->unshift : Symbol(unshift, Decl(1.0lib-noErrors.ts, 810, 77)) +>unshift : Symbol(RegExpExecArray.unshift, Decl(1.0lib-noErrors.ts, 810, 77)) >items : Symbol(items, Decl(1.0lib-noErrors.ts, 811, 12)) indexOf(searchElement: string, fromIndex?: number): number; ->indexOf : Symbol(indexOf, Decl(1.0lib-noErrors.ts, 811, 40)) +>indexOf : Symbol(RegExpExecArray.indexOf, Decl(1.0lib-noErrors.ts, 811, 40)) >searchElement : Symbol(searchElement, Decl(1.0lib-noErrors.ts, 813, 12)) >fromIndex : Symbol(fromIndex, Decl(1.0lib-noErrors.ts, 813, 34)) lastIndexOf(searchElement: string, fromIndex?: number): number; ->lastIndexOf : Symbol(lastIndexOf, Decl(1.0lib-noErrors.ts, 813, 63)) +>lastIndexOf : Symbol(RegExpExecArray.lastIndexOf, Decl(1.0lib-noErrors.ts, 813, 63)) >searchElement : Symbol(searchElement, Decl(1.0lib-noErrors.ts, 814, 16)) >fromIndex : Symbol(fromIndex, Decl(1.0lib-noErrors.ts, 814, 38)) every(callbackfn: (value: string, index: number, array: string[]) => boolean, thisArg?: any): boolean; ->every : Symbol(every, Decl(1.0lib-noErrors.ts, 814, 67)) +>every : Symbol(RegExpExecArray.every, Decl(1.0lib-noErrors.ts, 814, 67)) >callbackfn : Symbol(callbackfn, Decl(1.0lib-noErrors.ts, 815, 10)) >value : Symbol(value, Decl(1.0lib-noErrors.ts, 815, 23)) >index : Symbol(index, Decl(1.0lib-noErrors.ts, 815, 37)) @@ -1354,7 +1354,7 @@ interface RegExpExecArray { >thisArg : Symbol(thisArg, Decl(1.0lib-noErrors.ts, 815, 81)) some(callbackfn: (value: string, index: number, array: string[]) => boolean, thisArg?: any): boolean; ->some : Symbol(some, Decl(1.0lib-noErrors.ts, 815, 106)) +>some : Symbol(RegExpExecArray.some, Decl(1.0lib-noErrors.ts, 815, 106)) >callbackfn : Symbol(callbackfn, Decl(1.0lib-noErrors.ts, 816, 9)) >value : Symbol(value, Decl(1.0lib-noErrors.ts, 816, 22)) >index : Symbol(index, Decl(1.0lib-noErrors.ts, 816, 36)) @@ -1362,7 +1362,7 @@ interface RegExpExecArray { >thisArg : Symbol(thisArg, Decl(1.0lib-noErrors.ts, 816, 80)) forEach(callbackfn: (value: string, index: number, array: string[]) => void, thisArg?: any): void; ->forEach : Symbol(forEach, Decl(1.0lib-noErrors.ts, 816, 105)) +>forEach : Symbol(RegExpExecArray.forEach, Decl(1.0lib-noErrors.ts, 816, 105)) >callbackfn : Symbol(callbackfn, Decl(1.0lib-noErrors.ts, 817, 12)) >value : Symbol(value, Decl(1.0lib-noErrors.ts, 817, 25)) >index : Symbol(index, Decl(1.0lib-noErrors.ts, 817, 39)) @@ -1370,7 +1370,7 @@ interface RegExpExecArray { >thisArg : Symbol(thisArg, Decl(1.0lib-noErrors.ts, 817, 80)) map(callbackfn: (value: string, index: number, array: string[]) => any, thisArg?: any): any[]; ->map : Symbol(map, Decl(1.0lib-noErrors.ts, 817, 102)) +>map : Symbol(RegExpExecArray.map, Decl(1.0lib-noErrors.ts, 817, 102)) >callbackfn : Symbol(callbackfn, Decl(1.0lib-noErrors.ts, 818, 8)) >value : Symbol(value, Decl(1.0lib-noErrors.ts, 818, 21)) >index : Symbol(index, Decl(1.0lib-noErrors.ts, 818, 35)) @@ -1378,7 +1378,7 @@ interface RegExpExecArray { >thisArg : Symbol(thisArg, Decl(1.0lib-noErrors.ts, 818, 75)) filter(callbackfn: (value: string, index: number, array: string[]) => boolean, thisArg?: any): string[]; ->filter : Symbol(filter, Decl(1.0lib-noErrors.ts, 818, 98)) +>filter : Symbol(RegExpExecArray.filter, Decl(1.0lib-noErrors.ts, 818, 98)) >callbackfn : Symbol(callbackfn, Decl(1.0lib-noErrors.ts, 819, 11)) >value : Symbol(value, Decl(1.0lib-noErrors.ts, 819, 24)) >index : Symbol(index, Decl(1.0lib-noErrors.ts, 819, 38)) @@ -1386,7 +1386,7 @@ interface RegExpExecArray { >thisArg : Symbol(thisArg, Decl(1.0lib-noErrors.ts, 819, 82)) reduce(callbackfn: (previousValue: any, currentValue: any, currentIndex: number, array: string[]) => any, initialValue?: any): any; ->reduce : Symbol(reduce, Decl(1.0lib-noErrors.ts, 819, 108)) +>reduce : Symbol(RegExpExecArray.reduce, Decl(1.0lib-noErrors.ts, 819, 108)) >callbackfn : Symbol(callbackfn, Decl(1.0lib-noErrors.ts, 820, 11)) >previousValue : Symbol(previousValue, Decl(1.0lib-noErrors.ts, 820, 24)) >currentValue : Symbol(currentValue, Decl(1.0lib-noErrors.ts, 820, 43)) @@ -1395,7 +1395,7 @@ interface RegExpExecArray { >initialValue : Symbol(initialValue, Decl(1.0lib-noErrors.ts, 820, 109)) reduceRight(callbackfn: (previousValue: any, currentValue: any, currentIndex: number, array: string[]) => any, initialValue?: any): any; ->reduceRight : Symbol(reduceRight, Decl(1.0lib-noErrors.ts, 820, 135)) +>reduceRight : Symbol(RegExpExecArray.reduceRight, Decl(1.0lib-noErrors.ts, 820, 135)) >callbackfn : Symbol(callbackfn, Decl(1.0lib-noErrors.ts, 821, 16)) >previousValue : Symbol(previousValue, Decl(1.0lib-noErrors.ts, 821, 29)) >currentValue : Symbol(currentValue, Decl(1.0lib-noErrors.ts, 821, 48)) @@ -1413,7 +1413,7 @@ interface RegExp { * @param string The String object or string literal on which to perform the search. */ exec(string: string): RegExpExecArray; ->exec : Symbol(exec, Decl(1.0lib-noErrors.ts, 825, 18)) +>exec : Symbol(RegExp.exec, Decl(1.0lib-noErrors.ts, 825, 18)) >string : Symbol(string, Decl(1.0lib-noErrors.ts, 830, 9)) >RegExpExecArray : Symbol(RegExpExecArray, Decl(1.0lib-noErrors.ts, 790, 1)) @@ -1422,31 +1422,31 @@ interface RegExp { * @param string String on which to perform the search. */ test(string: string): boolean; ->test : Symbol(test, Decl(1.0lib-noErrors.ts, 830, 42)) +>test : Symbol(RegExp.test, Decl(1.0lib-noErrors.ts, 830, 42)) >string : Symbol(string, Decl(1.0lib-noErrors.ts, 836, 9)) /** Returns a copy of the text of the regular expression pattern. Read-only. The rgExp argument is a Regular expression object. It can be a variable name or a literal. */ source: string; ->source : Symbol(source, Decl(1.0lib-noErrors.ts, 836, 34)) +>source : Symbol(RegExp.source, Decl(1.0lib-noErrors.ts, 836, 34)) /** Returns a Boolean value indicating the state of the global flag (g) used with a regular expression. Default is false. Read-only. */ global: boolean; ->global : Symbol(global, Decl(1.0lib-noErrors.ts, 839, 19)) +>global : Symbol(RegExp.global, Decl(1.0lib-noErrors.ts, 839, 19)) /** Returns a Boolean value indicating the state of the ignoreCase flag (i) used with a regular expression. Default is false. Read-only. */ ignoreCase: boolean; ->ignoreCase : Symbol(ignoreCase, Decl(1.0lib-noErrors.ts, 842, 20)) +>ignoreCase : Symbol(RegExp.ignoreCase, Decl(1.0lib-noErrors.ts, 842, 20)) /** Returns a Boolean value indicating the state of the multiline flag (m) used with a regular expression. Default is false. Read-only. */ multiline: boolean; ->multiline : Symbol(multiline, Decl(1.0lib-noErrors.ts, 845, 24)) +>multiline : Symbol(RegExp.multiline, Decl(1.0lib-noErrors.ts, 845, 24)) lastIndex: number; ->lastIndex : Symbol(lastIndex, Decl(1.0lib-noErrors.ts, 848, 23)) +>lastIndex : Symbol(RegExp.lastIndex, Decl(1.0lib-noErrors.ts, 848, 23)) // Non-standard extensions compile(): RegExp; ->compile : Symbol(compile, Decl(1.0lib-noErrors.ts, 850, 22)) +>compile : Symbol(RegExp.compile, Decl(1.0lib-noErrors.ts, 850, 22)) >RegExp : Symbol(RegExp, Decl(1.0lib-noErrors.ts, 822, 1), Decl(1.0lib-noErrors.ts, 855, 11)) } declare var RegExp: { @@ -1498,10 +1498,10 @@ interface Error { >Error : Symbol(Error, Decl(1.0lib-noErrors.ts, 870, 1), Decl(1.0lib-noErrors.ts, 876, 11)) name: string; ->name : Symbol(name, Decl(1.0lib-noErrors.ts, 872, 17)) +>name : Symbol(Error.name, Decl(1.0lib-noErrors.ts, 872, 17)) message: string; ->message : Symbol(message, Decl(1.0lib-noErrors.ts, 873, 17)) +>message : Symbol(Error.message, Decl(1.0lib-noErrors.ts, 873, 17)) } declare var Error: { >Error : Symbol(Error, Decl(1.0lib-noErrors.ts, 870, 1), Decl(1.0lib-noErrors.ts, 876, 11)) @@ -1649,7 +1649,7 @@ interface JSON { * If a member contains nested objects, the nested objects are transformed before the parent object is. */ parse(text: string, reviver?: (key: any, value: any) => any): any; ->parse : Symbol(parse, Decl(1.0lib-noErrors.ts, 930, 16)) +>parse : Symbol(JSON.parse, Decl(1.0lib-noErrors.ts, 930, 16)) >text : Symbol(text, Decl(1.0lib-noErrors.ts, 937, 10)) >reviver : Symbol(reviver, Decl(1.0lib-noErrors.ts, 937, 23)) >key : Symbol(key, Decl(1.0lib-noErrors.ts, 937, 35)) @@ -1660,7 +1660,7 @@ interface JSON { * @param value A JavaScript value, usually an object or array, to be converted. */ stringify(value: any): string; ->stringify : Symbol(stringify, Decl(1.0lib-noErrors.ts, 937, 70), Decl(1.0lib-noErrors.ts, 942, 34), Decl(1.0lib-noErrors.ts, 948, 78), Decl(1.0lib-noErrors.ts, 954, 51), Decl(1.0lib-noErrors.ts, 961, 90)) +>stringify : Symbol(JSON.stringify, Decl(1.0lib-noErrors.ts, 937, 70), Decl(1.0lib-noErrors.ts, 942, 34), Decl(1.0lib-noErrors.ts, 948, 78), Decl(1.0lib-noErrors.ts, 954, 51), Decl(1.0lib-noErrors.ts, 961, 90)) >value : Symbol(value, Decl(1.0lib-noErrors.ts, 942, 14)) /** @@ -1669,7 +1669,7 @@ interface JSON { * @param replacer A function that transforms the results. */ stringify(value: any, replacer: (key: string, value: any) => any): string; ->stringify : Symbol(stringify, Decl(1.0lib-noErrors.ts, 937, 70), Decl(1.0lib-noErrors.ts, 942, 34), Decl(1.0lib-noErrors.ts, 948, 78), Decl(1.0lib-noErrors.ts, 954, 51), Decl(1.0lib-noErrors.ts, 961, 90)) +>stringify : Symbol(JSON.stringify, Decl(1.0lib-noErrors.ts, 937, 70), Decl(1.0lib-noErrors.ts, 942, 34), Decl(1.0lib-noErrors.ts, 948, 78), Decl(1.0lib-noErrors.ts, 954, 51), Decl(1.0lib-noErrors.ts, 961, 90)) >value : Symbol(value, Decl(1.0lib-noErrors.ts, 948, 14)) >replacer : Symbol(replacer, Decl(1.0lib-noErrors.ts, 948, 25)) >key : Symbol(key, Decl(1.0lib-noErrors.ts, 948, 37)) @@ -1681,7 +1681,7 @@ interface JSON { * @param replacer Array that transforms the results. */ stringify(value: any, replacer: any[]): string; ->stringify : Symbol(stringify, Decl(1.0lib-noErrors.ts, 937, 70), Decl(1.0lib-noErrors.ts, 942, 34), Decl(1.0lib-noErrors.ts, 948, 78), Decl(1.0lib-noErrors.ts, 954, 51), Decl(1.0lib-noErrors.ts, 961, 90)) +>stringify : Symbol(JSON.stringify, Decl(1.0lib-noErrors.ts, 937, 70), Decl(1.0lib-noErrors.ts, 942, 34), Decl(1.0lib-noErrors.ts, 948, 78), Decl(1.0lib-noErrors.ts, 954, 51), Decl(1.0lib-noErrors.ts, 961, 90)) >value : Symbol(value, Decl(1.0lib-noErrors.ts, 954, 14)) >replacer : Symbol(replacer, Decl(1.0lib-noErrors.ts, 954, 25)) @@ -1692,7 +1692,7 @@ interface JSON { * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. */ stringify(value: any, replacer: (key: string, value: any) => any, space: any): string; ->stringify : Symbol(stringify, Decl(1.0lib-noErrors.ts, 937, 70), Decl(1.0lib-noErrors.ts, 942, 34), Decl(1.0lib-noErrors.ts, 948, 78), Decl(1.0lib-noErrors.ts, 954, 51), Decl(1.0lib-noErrors.ts, 961, 90)) +>stringify : Symbol(JSON.stringify, Decl(1.0lib-noErrors.ts, 937, 70), Decl(1.0lib-noErrors.ts, 942, 34), Decl(1.0lib-noErrors.ts, 948, 78), Decl(1.0lib-noErrors.ts, 954, 51), Decl(1.0lib-noErrors.ts, 961, 90)) >value : Symbol(value, Decl(1.0lib-noErrors.ts, 961, 14)) >replacer : Symbol(replacer, Decl(1.0lib-noErrors.ts, 961, 25)) >key : Symbol(key, Decl(1.0lib-noErrors.ts, 961, 37)) @@ -1706,7 +1706,7 @@ interface JSON { * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. */ stringify(value: any, replacer: any[], space: any): string; ->stringify : Symbol(stringify, Decl(1.0lib-noErrors.ts, 937, 70), Decl(1.0lib-noErrors.ts, 942, 34), Decl(1.0lib-noErrors.ts, 948, 78), Decl(1.0lib-noErrors.ts, 954, 51), Decl(1.0lib-noErrors.ts, 961, 90)) +>stringify : Symbol(JSON.stringify, Decl(1.0lib-noErrors.ts, 937, 70), Decl(1.0lib-noErrors.ts, 942, 34), Decl(1.0lib-noErrors.ts, 948, 78), Decl(1.0lib-noErrors.ts, 954, 51), Decl(1.0lib-noErrors.ts, 961, 90)) >value : Symbol(value, Decl(1.0lib-noErrors.ts, 968, 14)) >replacer : Symbol(replacer, Decl(1.0lib-noErrors.ts, 968, 25)) >space : Symbol(space, Decl(1.0lib-noErrors.ts, 968, 42)) @@ -1731,17 +1731,17 @@ interface Array { * Returns a string representation of an array. */ toString(): string; ->toString : Symbol(toString, Decl(1.0lib-noErrors.ts, 980, 20)) +>toString : Symbol(Array.toString, Decl(1.0lib-noErrors.ts, 980, 20)) toLocaleString(): string; ->toLocaleString : Symbol(toLocaleString, Decl(1.0lib-noErrors.ts, 984, 23)) +>toLocaleString : Symbol(Array.toLocaleString, Decl(1.0lib-noErrors.ts, 984, 23)) /** * Combines two or more arrays. * @param items Additional items to add to the end of array1. */ concat(...items: U[]): T[]; ->concat : Symbol(concat, Decl(1.0lib-noErrors.ts, 985, 29), Decl(1.0lib-noErrors.ts, 990, 46)) +>concat : Symbol(Array.concat, Decl(1.0lib-noErrors.ts, 985, 29), Decl(1.0lib-noErrors.ts, 990, 46)) >U : Symbol(U, Decl(1.0lib-noErrors.ts, 990, 11)) >T : Symbol(T, Decl(1.0lib-noErrors.ts, 980, 16)) >items : Symbol(items, Decl(1.0lib-noErrors.ts, 990, 26)) @@ -1753,7 +1753,7 @@ interface Array { * @param items Additional items to add to the end of array1. */ concat(...items: T[]): T[]; ->concat : Symbol(concat, Decl(1.0lib-noErrors.ts, 985, 29), Decl(1.0lib-noErrors.ts, 990, 46)) +>concat : Symbol(Array.concat, Decl(1.0lib-noErrors.ts, 985, 29), Decl(1.0lib-noErrors.ts, 990, 46)) >items : Symbol(items, Decl(1.0lib-noErrors.ts, 995, 11)) >T : Symbol(T, Decl(1.0lib-noErrors.ts, 980, 16)) >T : Symbol(T, Decl(1.0lib-noErrors.ts, 980, 16)) @@ -1763,14 +1763,14 @@ interface Array { * @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; ->join : Symbol(join, Decl(1.0lib-noErrors.ts, 995, 31)) +>join : Symbol(Array.join, Decl(1.0lib-noErrors.ts, 995, 31)) >separator : Symbol(separator, Decl(1.0lib-noErrors.ts, 1000, 9)) /** * Removes the last element from an array and returns it. */ pop(): T; ->pop : Symbol(pop, Decl(1.0lib-noErrors.ts, 1000, 37)) +>pop : Symbol(Array.pop, Decl(1.0lib-noErrors.ts, 1000, 37)) >T : Symbol(T, Decl(1.0lib-noErrors.ts, 980, 16)) /** @@ -1778,7 +1778,7 @@ interface Array { * @param items New elements of the Array. */ push(...items: T[]): number; ->push : Symbol(push, Decl(1.0lib-noErrors.ts, 1004, 13)) +>push : Symbol(Array.push, Decl(1.0lib-noErrors.ts, 1004, 13)) >items : Symbol(items, Decl(1.0lib-noErrors.ts, 1009, 9)) >T : Symbol(T, Decl(1.0lib-noErrors.ts, 980, 16)) @@ -1786,14 +1786,14 @@ interface Array { * Reverses the elements in an Array. */ reverse(): T[]; ->reverse : Symbol(reverse, Decl(1.0lib-noErrors.ts, 1009, 32)) +>reverse : Symbol(Array.reverse, Decl(1.0lib-noErrors.ts, 1009, 32)) >T : Symbol(T, Decl(1.0lib-noErrors.ts, 980, 16)) /** * Removes the first element from an array and returns it. */ shift(): T; ->shift : Symbol(shift, Decl(1.0lib-noErrors.ts, 1013, 19)) +>shift : Symbol(Array.shift, Decl(1.0lib-noErrors.ts, 1013, 19)) >T : Symbol(T, Decl(1.0lib-noErrors.ts, 980, 16)) /** @@ -1802,7 +1802,7 @@ interface Array { * @param end The end of the specified portion of the array. */ slice(start?: number, end?: number): T[]; ->slice : Symbol(slice, Decl(1.0lib-noErrors.ts, 1017, 15)) +>slice : Symbol(Array.slice, Decl(1.0lib-noErrors.ts, 1017, 15)) >start : Symbol(start, Decl(1.0lib-noErrors.ts, 1023, 10)) >end : Symbol(end, Decl(1.0lib-noErrors.ts, 1023, 25)) >T : Symbol(T, Decl(1.0lib-noErrors.ts, 980, 16)) @@ -1812,7 +1812,7 @@ interface Array { * @param compareFn The name of the function used to determine the order of the elements. If omitted, the elements are sorted in ascending, ASCII character order. */ sort(compareFn?: (a: T, b: T) => number): T[]; ->sort : Symbol(sort, Decl(1.0lib-noErrors.ts, 1023, 45)) +>sort : Symbol(Array.sort, Decl(1.0lib-noErrors.ts, 1023, 45)) >compareFn : Symbol(compareFn, Decl(1.0lib-noErrors.ts, 1029, 9)) >a : Symbol(a, Decl(1.0lib-noErrors.ts, 1029, 22)) >T : Symbol(T, Decl(1.0lib-noErrors.ts, 980, 16)) @@ -1825,7 +1825,7 @@ interface Array { * @param start The zero-based location in the array from which to start removing elements. */ splice(start: number): T[]; ->splice : Symbol(splice, Decl(1.0lib-noErrors.ts, 1029, 50), Decl(1.0lib-noErrors.ts, 1035, 31)) +>splice : Symbol(Array.splice, Decl(1.0lib-noErrors.ts, 1029, 50), Decl(1.0lib-noErrors.ts, 1035, 31)) >start : Symbol(start, Decl(1.0lib-noErrors.ts, 1035, 11)) >T : Symbol(T, Decl(1.0lib-noErrors.ts, 980, 16)) @@ -1836,7 +1836,7 @@ interface Array { * @param items Elements to insert into the array in place of the deleted elements. */ splice(start: number, deleteCount: number, ...items: T[]): T[]; ->splice : Symbol(splice, Decl(1.0lib-noErrors.ts, 1029, 50), Decl(1.0lib-noErrors.ts, 1035, 31)) +>splice : Symbol(Array.splice, Decl(1.0lib-noErrors.ts, 1029, 50), Decl(1.0lib-noErrors.ts, 1035, 31)) >start : Symbol(start, Decl(1.0lib-noErrors.ts, 1043, 11)) >deleteCount : Symbol(deleteCount, Decl(1.0lib-noErrors.ts, 1043, 25)) >items : Symbol(items, Decl(1.0lib-noErrors.ts, 1043, 46)) @@ -1848,7 +1848,7 @@ interface Array { * @param items Elements to insert at the start of the Array. */ unshift(...items: T[]): number; ->unshift : Symbol(unshift, Decl(1.0lib-noErrors.ts, 1043, 67)) +>unshift : Symbol(Array.unshift, Decl(1.0lib-noErrors.ts, 1043, 67)) >items : Symbol(items, Decl(1.0lib-noErrors.ts, 1049, 12)) >T : Symbol(T, Decl(1.0lib-noErrors.ts, 980, 16)) @@ -1858,7 +1858,7 @@ interface Array { * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. */ indexOf(searchElement: T, fromIndex?: number): number; ->indexOf : Symbol(indexOf, Decl(1.0lib-noErrors.ts, 1049, 35)) +>indexOf : Symbol(Array.indexOf, Decl(1.0lib-noErrors.ts, 1049, 35)) >searchElement : Symbol(searchElement, Decl(1.0lib-noErrors.ts, 1056, 12)) >T : Symbol(T, Decl(1.0lib-noErrors.ts, 980, 16)) >fromIndex : Symbol(fromIndex, Decl(1.0lib-noErrors.ts, 1056, 29)) @@ -1869,7 +1869,7 @@ interface Array { * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array. */ lastIndexOf(searchElement: T, fromIndex?: number): number; ->lastIndexOf : Symbol(lastIndexOf, Decl(1.0lib-noErrors.ts, 1056, 58)) +>lastIndexOf : Symbol(Array.lastIndexOf, Decl(1.0lib-noErrors.ts, 1056, 58)) >searchElement : Symbol(searchElement, Decl(1.0lib-noErrors.ts, 1063, 16)) >T : Symbol(T, Decl(1.0lib-noErrors.ts, 980, 16)) >fromIndex : Symbol(fromIndex, Decl(1.0lib-noErrors.ts, 1063, 33)) @@ -1880,7 +1880,7 @@ interface Array { * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. */ every(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; ->every : Symbol(every, Decl(1.0lib-noErrors.ts, 1063, 62)) +>every : Symbol(Array.every, Decl(1.0lib-noErrors.ts, 1063, 62)) >callbackfn : Symbol(callbackfn, Decl(1.0lib-noErrors.ts, 1070, 10)) >value : Symbol(value, Decl(1.0lib-noErrors.ts, 1070, 23)) >T : Symbol(T, Decl(1.0lib-noErrors.ts, 980, 16)) @@ -1895,7 +1895,7 @@ interface Array { * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; ->some : Symbol(some, Decl(1.0lib-noErrors.ts, 1070, 96)) +>some : Symbol(Array.some, Decl(1.0lib-noErrors.ts, 1070, 96)) >callbackfn : Symbol(callbackfn, Decl(1.0lib-noErrors.ts, 1077, 9)) >value : Symbol(value, Decl(1.0lib-noErrors.ts, 1077, 22)) >T : Symbol(T, Decl(1.0lib-noErrors.ts, 980, 16)) @@ -1910,7 +1910,7 @@ interface Array { * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void; ->forEach : Symbol(forEach, Decl(1.0lib-noErrors.ts, 1077, 95)) +>forEach : Symbol(Array.forEach, Decl(1.0lib-noErrors.ts, 1077, 95)) >callbackfn : Symbol(callbackfn, Decl(1.0lib-noErrors.ts, 1084, 12)) >value : Symbol(value, Decl(1.0lib-noErrors.ts, 1084, 25)) >T : Symbol(T, Decl(1.0lib-noErrors.ts, 980, 16)) @@ -1925,7 +1925,7 @@ interface Array { * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[]; ->map : Symbol(map, Decl(1.0lib-noErrors.ts, 1084, 92)) +>map : Symbol(Array.map, Decl(1.0lib-noErrors.ts, 1084, 92)) >U : Symbol(U, Decl(1.0lib-noErrors.ts, 1091, 8)) >callbackfn : Symbol(callbackfn, Decl(1.0lib-noErrors.ts, 1091, 11)) >value : Symbol(value, Decl(1.0lib-noErrors.ts, 1091, 24)) @@ -1943,7 +1943,7 @@ interface Array { * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. */ filter(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): T[]; ->filter : Symbol(filter, Decl(1.0lib-noErrors.ts, 1091, 87)) +>filter : Symbol(Array.filter, Decl(1.0lib-noErrors.ts, 1091, 87)) >callbackfn : Symbol(callbackfn, Decl(1.0lib-noErrors.ts, 1098, 11)) >value : Symbol(value, Decl(1.0lib-noErrors.ts, 1098, 24)) >T : Symbol(T, Decl(1.0lib-noErrors.ts, 980, 16)) @@ -1959,7 +1959,7 @@ interface Array { * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. */ reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; ->reduce : Symbol(reduce, Decl(1.0lib-noErrors.ts, 1098, 93), Decl(1.0lib-noErrors.ts, 1105, 120)) +>reduce : Symbol(Array.reduce, Decl(1.0lib-noErrors.ts, 1098, 93), Decl(1.0lib-noErrors.ts, 1105, 120)) >callbackfn : Symbol(callbackfn, Decl(1.0lib-noErrors.ts, 1105, 11)) >previousValue : Symbol(previousValue, Decl(1.0lib-noErrors.ts, 1105, 24)) >T : Symbol(T, Decl(1.0lib-noErrors.ts, 980, 16)) @@ -1979,7 +1979,7 @@ interface Array { * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; ->reduce : Symbol(reduce, Decl(1.0lib-noErrors.ts, 1098, 93), Decl(1.0lib-noErrors.ts, 1105, 120)) +>reduce : Symbol(Array.reduce, Decl(1.0lib-noErrors.ts, 1098, 93), Decl(1.0lib-noErrors.ts, 1105, 120)) >U : Symbol(U, Decl(1.0lib-noErrors.ts, 1111, 11)) >callbackfn : Symbol(callbackfn, Decl(1.0lib-noErrors.ts, 1111, 14)) >previousValue : Symbol(previousValue, Decl(1.0lib-noErrors.ts, 1111, 27)) @@ -2000,7 +2000,7 @@ interface Array { * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. */ reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; ->reduceRight : Symbol(reduceRight, Decl(1.0lib-noErrors.ts, 1111, 122), Decl(1.0lib-noErrors.ts, 1118, 125)) +>reduceRight : Symbol(Array.reduceRight, Decl(1.0lib-noErrors.ts, 1111, 122), Decl(1.0lib-noErrors.ts, 1118, 125)) >callbackfn : Symbol(callbackfn, Decl(1.0lib-noErrors.ts, 1118, 16)) >previousValue : Symbol(previousValue, Decl(1.0lib-noErrors.ts, 1118, 29)) >T : Symbol(T, Decl(1.0lib-noErrors.ts, 980, 16)) @@ -2020,7 +2020,7 @@ interface Array { * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; ->reduceRight : Symbol(reduceRight, Decl(1.0lib-noErrors.ts, 1111, 122), Decl(1.0lib-noErrors.ts, 1118, 125)) +>reduceRight : Symbol(Array.reduceRight, Decl(1.0lib-noErrors.ts, 1111, 122), Decl(1.0lib-noErrors.ts, 1118, 125)) >U : Symbol(U, Decl(1.0lib-noErrors.ts, 1124, 16)) >callbackfn : Symbol(callbackfn, Decl(1.0lib-noErrors.ts, 1124, 19)) >previousValue : Symbol(previousValue, Decl(1.0lib-noErrors.ts, 1124, 32)) @@ -2039,7 +2039,7 @@ interface Array { * Gets or sets the length of the array. This is a number one higher than the highest element defined in an array. */ length: number; ->length : Symbol(length, Decl(1.0lib-noErrors.ts, 1124, 127)) +>length : Symbol(Array.length, Decl(1.0lib-noErrors.ts, 1124, 127)) [n: number]: T; >n : Symbol(n, Decl(1.0lib-noErrors.ts, 1131, 5)) diff --git a/tests/baselines/reference/2dArrays.symbols b/tests/baselines/reference/2dArrays.symbols index a42a40e2b6b..8d6b6b167e6 100644 --- a/tests/baselines/reference/2dArrays.symbols +++ b/tests/baselines/reference/2dArrays.symbols @@ -7,28 +7,28 @@ class Ship { >Ship : Symbol(Ship, Decl(2dArrays.ts, 1, 1)) isSunk: boolean; ->isSunk : Symbol(isSunk, Decl(2dArrays.ts, 3, 12)) +>isSunk : Symbol(Ship.isSunk, Decl(2dArrays.ts, 3, 12)) } class Board { >Board : Symbol(Board, Decl(2dArrays.ts, 5, 1)) ships: Ship[]; ->ships : Symbol(ships, Decl(2dArrays.ts, 7, 13)) +>ships : Symbol(Board.ships, Decl(2dArrays.ts, 7, 13)) >Ship : Symbol(Ship, Decl(2dArrays.ts, 1, 1)) cells: Cell[]; ->cells : Symbol(cells, Decl(2dArrays.ts, 8, 18)) +>cells : Symbol(Board.cells, Decl(2dArrays.ts, 8, 18)) >Cell : Symbol(Cell, Decl(2dArrays.ts, 0, 0)) private allShipsSunk() { ->allShipsSunk : Symbol(allShipsSunk, Decl(2dArrays.ts, 9, 18)) +>allShipsSunk : Symbol(Board.allShipsSunk, Decl(2dArrays.ts, 9, 18)) return this.ships.every(function (val) { return val.isSunk; }); >this.ships.every : Symbol(Array.every, Decl(lib.d.ts, --, --)) ->this.ships : Symbol(ships, Decl(2dArrays.ts, 7, 13)) +>this.ships : Symbol(Board.ships, Decl(2dArrays.ts, 7, 13)) >this : Symbol(Board, Decl(2dArrays.ts, 5, 1)) ->ships : Symbol(ships, Decl(2dArrays.ts, 7, 13)) +>ships : Symbol(Board.ships, Decl(2dArrays.ts, 7, 13)) >every : Symbol(Array.every, Decl(lib.d.ts, --, --)) >val : Symbol(val, Decl(2dArrays.ts, 12, 42)) >val.isSunk : Symbol(Ship.isSunk, Decl(2dArrays.ts, 3, 12)) diff --git a/tests/baselines/reference/APISample_compile.js b/tests/baselines/reference/APISample_compile.js index 3830e53697c..5f55c04c9f9 100644 --- a/tests/baselines/reference/APISample_compile.js +++ b/tests/baselines/reference/APISample_compile.js @@ -16,7 +16,7 @@ export function compile(fileNames: string[], options: ts.CompilerOptions): void var program = ts.createProgram(fileNames, options); var emitResult = program.emit(); - var allDiagnostics = ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics); + var allDiagnostics = ts.getPreEmitDiagnostics(program); allDiagnostics.forEach(diagnostic => { var { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start); @@ -45,7 +45,7 @@ var ts = require("typescript"); function compile(fileNames, options) { var program = ts.createProgram(fileNames, options); var emitResult = program.emit(); - var allDiagnostics = ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics); + var allDiagnostics = ts.getPreEmitDiagnostics(program); allDiagnostics.forEach(function (diagnostic) { var _a = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start), line = _a.line, character = _a.character; var message = ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n'); diff --git a/tests/baselines/reference/APISample_linter.js b/tests/baselines/reference/APISample_linter.js index 62b201976cd..4e563c7cac3 100644 --- a/tests/baselines/reference/APISample_linter.js +++ b/tests/baselines/reference/APISample_linter.js @@ -55,7 +55,7 @@ export function delint(sourceFile: ts.SourceFile) { } } -const fileNames = process.argv.slice(2); +const fileNames: string[] = process.argv.slice(2); fileNames.forEach(fileName => { // Parse a file let sourceFile = ts.createSourceFile(fileName, readFileSync(fileName).toString(), ts.ScriptTarget.ES6, /*setParentNodes */ true); diff --git a/tests/baselines/reference/APISample_parseConfig.js b/tests/baselines/reference/APISample_parseConfig.js new file mode 100644 index 00000000000..75ab80d3f23 --- /dev/null +++ b/tests/baselines/reference/APISample_parseConfig.js @@ -0,0 +1,70 @@ +//// [APISample_parseConfig.ts] + +/* + * Note: This test is a public API sample. The sample sources can be found + at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#a-minimal-compiler + * Please log a "breaking change" issue for any API breaking change affecting this issue + */ + +declare var process: any; +declare var console: any; +declare var os: any; + +import ts = require("typescript"); + +function printError(error: ts.Diagnostic): void { + if (!error) { + return; + } + console.log(`${error.file && error.file.fileName}: ${error.messageText}`); +} + +export function createProgram(rootFiles: string[], compilerOptionsJson: string): ts.Program | undefined { + const { config, error } = ts.parseConfigFileTextToJson("tsconfig.json", compilerOptionsJson) + if (error) { + printError(error); + return undefined; + } + const basePath: string = process.cwd(); + const settings = ts.convertCompilerOptionsFromJson(config.config["compilerOptions"], basePath); + if (!settings.options) { + for (const err of settings.errors) { + printError(err); + } + return undefined; + } + return ts.createProgram(rootFiles, settings.options); +} + +//// [APISample_parseConfig.js] +/* + * Note: This test is a public API sample. The sample sources can be found + at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#a-minimal-compiler + * Please log a "breaking change" issue for any API breaking change affecting this issue + */ +"use strict"; +var ts = require("typescript"); +function printError(error) { + if (!error) { + return; + } + console.log((error.file && error.file.fileName) + ": " + error.messageText); +} +function createProgram(rootFiles, compilerOptionsJson) { + var _a = ts.parseConfigFileTextToJson("tsconfig.json", compilerOptionsJson), config = _a.config, error = _a.error; + if (error) { + printError(error); + return undefined; + } + var basePath = process.cwd(); + var settings = ts.convertCompilerOptionsFromJson(config.config["compilerOptions"], basePath); + if (!settings.options) { + for (var _i = 0, _b = settings.errors; _i < _b.length; _i++) { + var err = _b[_i]; + printError(err); + } + return undefined; + } + return ts.createProgram(rootFiles, settings.options); +} +exports.createProgram = createProgram; diff --git a/tests/baselines/reference/APISample_watcher.js b/tests/baselines/reference/APISample_watcher.js index 1b6d52255fb..7573f2ba99e 100644 --- a/tests/baselines/reference/APISample_watcher.js +++ b/tests/baselines/reference/APISample_watcher.js @@ -8,7 +8,13 @@ declare var process: any; declare var console: any; -declare var fs: any; +declare var fs: { + existsSync(path: string): boolean; + readdirSync(path: string): string[]; + readFileSync(filename: string, encoding?: string): string; + writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void; + watchFile(filename: string, options: { persistent?: boolean; interval?: number; }, listener: (curr: { mtime: Date }, prev: { mtime: Date }) => void): void; +}; declare var path: any; import * as ts from "typescript"; diff --git a/tests/baselines/reference/AmbientModuleAndAmbientWithSameNameAndCommonRoot.symbols b/tests/baselines/reference/AmbientModuleAndAmbientWithSameNameAndCommonRoot.symbols index 2a24e5df919..3db6d644d98 100644 --- a/tests/baselines/reference/AmbientModuleAndAmbientWithSameNameAndCommonRoot.symbols +++ b/tests/baselines/reference/AmbientModuleAndAmbientWithSameNameAndCommonRoot.symbols @@ -29,10 +29,10 @@ declare module A { >y : Symbol(y, Decl(class.d.ts, 2, 30)) x: number; ->x : Symbol(x, Decl(class.d.ts, 2, 42)) +>x : Symbol(Point.x, Decl(class.d.ts, 2, 42)) y: number; ->y : Symbol(y, Decl(class.d.ts, 3, 18)) +>y : Symbol(Point.y, Decl(class.d.ts, 3, 18)) } } diff --git a/tests/baselines/reference/AmbientModuleAndNonAmbientClassWithSameNameAndCommonRoot.symbols b/tests/baselines/reference/AmbientModuleAndNonAmbientClassWithSameNameAndCommonRoot.symbols index 09762fd1406..8a776358b4c 100644 --- a/tests/baselines/reference/AmbientModuleAndNonAmbientClassWithSameNameAndCommonRoot.symbols +++ b/tests/baselines/reference/AmbientModuleAndNonAmbientClassWithSameNameAndCommonRoot.symbols @@ -25,8 +25,8 @@ module A { >Point : Symbol(Point, Decl(module.d.ts, 0, 18), Decl(classPoint.ts, 0, 10)) constructor(public x: number, public y: number) { } ->x : Symbol(x, Decl(classPoint.ts, 2, 20)) ->y : Symbol(y, Decl(classPoint.ts, 2, 37)) +>x : Symbol(Point.x, Decl(classPoint.ts, 2, 20)) +>y : Symbol(Point.y, Decl(classPoint.ts, 2, 37)) } } diff --git a/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.errors.txt b/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.errors.txt index 3feee7069d0..d2847665c7c 100644 --- a/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.errors.txt +++ b/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.ts(11,16): error TS2341: Property 'sfn' is private and only accessible within class 'clodule'. +tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.ts(11,24): error TS2341: Property 'sfn' is private and only accessible within class 'clodule'. ==== tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.ts (1 errors) ==== @@ -13,7 +13,7 @@ tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMer // error: duplicate identifier expected export function fn(x: T, y: T): number { return clodule.sfn('a'); - ~~~~~~~~~~~ + ~~~ !!! error TS2341: Property 'sfn' is private and only accessible within class 'clodule'. } } diff --git a/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.symbols b/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.symbols index 1c75c33a278..14e9ebf6124 100644 --- a/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.symbols +++ b/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.symbols @@ -3,8 +3,8 @@ class Point { >Point : Symbol(Point, Decl(ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.ts, 0, 0), Decl(ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.ts, 4, 1)) constructor(public x: number, public y: number) { } ->x : Symbol(x, Decl(ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.ts, 1, 16)) ->y : Symbol(y, Decl(ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.ts, 1, 33)) +>x : Symbol(Point.x, Decl(ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.ts, 1, 16)) +>y : Symbol(Point.y, Decl(ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.ts, 1, 33)) static Origin(): Point { return { x: 0, y: 0 }; } >Origin : Symbol(Point.Origin, Decl(ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.ts, 1, 55)) @@ -28,8 +28,8 @@ module A { >Point : Symbol(Point, Decl(ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.ts, 11, 10), Decl(ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.ts, 16, 5)) constructor(public x: number, public y: number) { } ->x : Symbol(x, Decl(ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.ts, 13, 20)) ->y : Symbol(y, Decl(ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.ts, 13, 37)) +>x : Symbol(Point.x, Decl(ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.ts, 13, 20)) +>y : Symbol(Point.y, Decl(ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.ts, 13, 37)) static Origin(): Point { return { x: 0, y: 0 }; } >Origin : Symbol(Point.Origin, Decl(ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.ts, 13, 59)) diff --git a/tests/baselines/reference/ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.symbols b/tests/baselines/reference/ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.symbols index 046b92fd6ee..b995c02929f 100644 --- a/tests/baselines/reference/ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.symbols +++ b/tests/baselines/reference/ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.symbols @@ -3,8 +3,8 @@ class Point { >Point : Symbol(Point, Decl(ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.ts, 0, 0), Decl(ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.ts, 4, 1)) constructor(public x: number, public y: number) { } ->x : Symbol(x, Decl(ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.ts, 1, 16)) ->y : Symbol(y, Decl(ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.ts, 1, 33)) +>x : Symbol(Point.x, Decl(ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.ts, 1, 16)) +>y : Symbol(Point.y, Decl(ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.ts, 1, 33)) static Origin: Point = { x: 0, y: 0 }; >Origin : Symbol(Point.Origin, Decl(ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.ts, 1, 55)) @@ -28,8 +28,8 @@ module A { >Point : Symbol(Point, Decl(ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.ts, 11, 10), Decl(ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.ts, 16, 5)) constructor(public x: number, public y: number) { } ->x : Symbol(x, Decl(ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.ts, 13, 20)) ->y : Symbol(y, Decl(ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.ts, 13, 37)) +>x : Symbol(Point.x, Decl(ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.ts, 13, 20)) +>y : Symbol(Point.y, Decl(ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.ts, 13, 37)) static Origin: Point = { x: 0, y: 0 }; >Origin : Symbol(Point.Origin, Decl(ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.ts, 13, 59)) diff --git a/tests/baselines/reference/ClassDeclarationWithInvalidConstOnPropertyDeclaration2.symbols b/tests/baselines/reference/ClassDeclarationWithInvalidConstOnPropertyDeclaration2.symbols index ce0ab000017..69f0d0520e6 100644 --- a/tests/baselines/reference/ClassDeclarationWithInvalidConstOnPropertyDeclaration2.symbols +++ b/tests/baselines/reference/ClassDeclarationWithInvalidConstOnPropertyDeclaration2.symbols @@ -3,8 +3,8 @@ class C { >C : Symbol(C, Decl(ClassDeclarationWithInvalidConstOnPropertyDeclaration2.ts, 0, 0)) const ->const : Symbol(const, Decl(ClassDeclarationWithInvalidConstOnPropertyDeclaration2.ts, 0, 9)) +>const : Symbol(C.const, Decl(ClassDeclarationWithInvalidConstOnPropertyDeclaration2.ts, 0, 9)) x = 10; ->x : Symbol(x, Decl(ClassDeclarationWithInvalidConstOnPropertyDeclaration2.ts, 1, 9)) +>x : Symbol(C.x, Decl(ClassDeclarationWithInvalidConstOnPropertyDeclaration2.ts, 1, 9)) } diff --git a/tests/baselines/reference/ES5For-of1.js.map b/tests/baselines/reference/ES5For-of1.js.map index 568ac1987e7..bd729517462 100644 --- a/tests/baselines/reference/ES5For-of1.js.map +++ b/tests/baselines/reference/ES5For-of1.js.map @@ -1,2 +1,2 @@ //// [ES5For-of1.js.map] -{"version":3,"file":"ES5For-of1.js","sourceRoot":"","sources":["ES5For-of1.ts"],"names":[],"mappings":"AAAA,GAAG,CAAC,CAAU,UAAe,EAAf,MAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAxB,cAAK,EAAL,IAAwB,CAAC;IAAzB,IAAI,CAAC,SAAA;IACN,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAClB"} \ No newline at end of file +{"version":3,"file":"ES5For-of1.js","sourceRoot":"","sources":["ES5For-of1.ts"],"names":[],"mappings":"AAAA,GAAG,CAAC,CAAU,UAAe,EAAf,MAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAf,cAAe,EAAf,IAAe,CAAC;IAAzB,IAAI,CAAC,SAAA;IACN,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAClB"} \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of1.sourcemap.txt b/tests/baselines/reference/ES5For-of1.sourcemap.txt index 7bdd7edfa13..5ae1084df25 100644 --- a/tests/baselines/reference/ES5For-of1.sourcemap.txt +++ b/tests/baselines/reference/ES5For-of1.sourcemap.txt @@ -41,9 +41,9 @@ sourceFile:ES5For-of1.ts 12> 'c' 13> ] 14> -15> var v +15> ['a', 'b', 'c'] 16> -17> var v of ['a', 'b', 'c'] +17> ['a', 'b', 'c'] 18> ) 1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) 2 >Emitted(1, 4) Source(1, 4) + SourceIndex(0) @@ -58,9 +58,9 @@ sourceFile:ES5For-of1.ts 11>Emitted(1, 34) Source(1, 26) + SourceIndex(0) 12>Emitted(1, 37) Source(1, 29) + SourceIndex(0) 13>Emitted(1, 38) Source(1, 30) + SourceIndex(0) -14>Emitted(1, 40) Source(1, 6) + SourceIndex(0) -15>Emitted(1, 54) Source(1, 11) + SourceIndex(0) -16>Emitted(1, 56) Source(1, 6) + SourceIndex(0) +14>Emitted(1, 40) Source(1, 15) + SourceIndex(0) +15>Emitted(1, 54) Source(1, 30) + SourceIndex(0) +16>Emitted(1, 56) Source(1, 15) + SourceIndex(0) 17>Emitted(1, 60) Source(1, 30) + SourceIndex(0) 18>Emitted(1, 61) Source(1, 31) + SourceIndex(0) --- diff --git a/tests/baselines/reference/ES5For-of13.js.map b/tests/baselines/reference/ES5For-of13.js.map index 5ff54bb8816..3fa2bd27348 100644 --- a/tests/baselines/reference/ES5For-of13.js.map +++ b/tests/baselines/reference/ES5For-of13.js.map @@ -1,2 +1,2 @@ //// [ES5For-of13.js.map] -{"version":3,"file":"ES5For-of13.js","sourceRoot":"","sources":["ES5For-of13.ts"],"names":[],"mappings":"AAAA,GAAG,CAAC,CAAU,UAAe,EAAf,MAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAxB,cAAK,EAAL,IAAwB,CAAC;IAAzB,IAAI,CAAC,SAAA;IACN,IAAI,CAAC,GAAG,CAAC,CAAC;CACb"} \ No newline at end of file +{"version":3,"file":"ES5For-of13.js","sourceRoot":"","sources":["ES5For-of13.ts"],"names":[],"mappings":"AAAA,GAAG,CAAC,CAAU,UAAe,EAAf,MAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAf,cAAe,EAAf,IAAe,CAAC;IAAzB,IAAI,CAAC,SAAA;IACN,IAAI,CAAC,GAAG,CAAC,CAAC;CACb"} \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of13.sourcemap.txt b/tests/baselines/reference/ES5For-of13.sourcemap.txt index c3a188e7221..410560ac78e 100644 --- a/tests/baselines/reference/ES5For-of13.sourcemap.txt +++ b/tests/baselines/reference/ES5For-of13.sourcemap.txt @@ -41,9 +41,9 @@ sourceFile:ES5For-of13.ts 12> 'c' 13> ] 14> -15> let v +15> ['a', 'b', 'c'] 16> -17> let v of ['a', 'b', 'c'] +17> ['a', 'b', 'c'] 18> ) 1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) 2 >Emitted(1, 4) Source(1, 4) + SourceIndex(0) @@ -58,9 +58,9 @@ sourceFile:ES5For-of13.ts 11>Emitted(1, 34) Source(1, 26) + SourceIndex(0) 12>Emitted(1, 37) Source(1, 29) + SourceIndex(0) 13>Emitted(1, 38) Source(1, 30) + SourceIndex(0) -14>Emitted(1, 40) Source(1, 6) + SourceIndex(0) -15>Emitted(1, 54) Source(1, 11) + SourceIndex(0) -16>Emitted(1, 56) Source(1, 6) + SourceIndex(0) +14>Emitted(1, 40) Source(1, 15) + SourceIndex(0) +15>Emitted(1, 54) Source(1, 30) + SourceIndex(0) +16>Emitted(1, 56) Source(1, 15) + SourceIndex(0) 17>Emitted(1, 60) Source(1, 30) + SourceIndex(0) 18>Emitted(1, 61) Source(1, 31) + SourceIndex(0) --- diff --git a/tests/baselines/reference/ES5For-of25.js.map b/tests/baselines/reference/ES5For-of25.js.map index 1c4d8c2101f..5ccc838a488 100644 --- a/tests/baselines/reference/ES5For-of25.js.map +++ b/tests/baselines/reference/ES5For-of25.js.map @@ -1,2 +1,2 @@ //// [ES5For-of25.js.map] -{"version":3,"file":"ES5For-of25.js","sourceRoot":"","sources":["ES5For-of25.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AAClB,GAAG,CAAC,CAAU,UAAC,EAAD,OAAC,EAAV,eAAK,EAAL,IAAU,CAAC;IAAX,IAAI,CAAC,UAAA;IACN,CAAC,CAAC;IACF,CAAC,CAAC;CACL"} \ No newline at end of file +{"version":3,"file":"ES5For-of25.js","sourceRoot":"","sources":["ES5For-of25.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AAClB,GAAG,CAAC,CAAU,UAAC,EAAD,OAAC,EAAD,eAAC,EAAD,IAAC,CAAC;IAAX,IAAI,CAAC,UAAA;IACN,CAAC,CAAC;IACF,CAAC,CAAC;CACL"} \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of25.sourcemap.txt b/tests/baselines/reference/ES5For-of25.sourcemap.txt index 453eef4ee46..765aa707701 100644 --- a/tests/baselines/reference/ES5For-of25.sourcemap.txt +++ b/tests/baselines/reference/ES5For-of25.sourcemap.txt @@ -69,9 +69,9 @@ sourceFile:ES5For-of25.ts 6 > 7 > a 8 > -9 > var v +9 > a 10> -11> var v of a +11> a 12> ) 1->Emitted(2, 1) Source(2, 1) + SourceIndex(0) 2 >Emitted(2, 4) Source(2, 4) + SourceIndex(0) @@ -80,9 +80,9 @@ sourceFile:ES5For-of25.ts 5 >Emitted(2, 16) Source(2, 16) + SourceIndex(0) 6 >Emitted(2, 18) Source(2, 15) + SourceIndex(0) 7 >Emitted(2, 25) Source(2, 16) + SourceIndex(0) -8 >Emitted(2, 27) Source(2, 6) + SourceIndex(0) -9 >Emitted(2, 42) Source(2, 11) + SourceIndex(0) -10>Emitted(2, 44) Source(2, 6) + SourceIndex(0) +8 >Emitted(2, 27) Source(2, 15) + SourceIndex(0) +9 >Emitted(2, 42) Source(2, 16) + SourceIndex(0) +10>Emitted(2, 44) Source(2, 15) + SourceIndex(0) 11>Emitted(2, 48) Source(2, 16) + SourceIndex(0) 12>Emitted(2, 49) Source(2, 17) + SourceIndex(0) --- diff --git a/tests/baselines/reference/ES5For-of26.js.map b/tests/baselines/reference/ES5For-of26.js.map index 704a3a24f2a..9dcebf97134 100644 --- a/tests/baselines/reference/ES5For-of26.js.map +++ b/tests/baselines/reference/ES5For-of26.js.map @@ -1,2 +1,2 @@ //// [ES5For-of26.js.map] -{"version":3,"file":"ES5For-of26.js","sourceRoot":"","sources":["ES5For-of26.ts"],"names":[],"mappings":"AAAA,GAAG,CAAC,CAAuB,UAAM,EAAN,MAAC,CAAC,EAAE,CAAC,CAAC,EAA5B,cAAkB,EAAlB,IAA4B,CAAC;IAA7B,6BAAK,CAAC,mBAAG,CAAC,mBAAE,CAAC,mBAAG,CAAC,KAAC;IACnB,CAAC,CAAC;IACF,CAAC,CAAC;CACL"} \ No newline at end of file +{"version":3,"file":"ES5For-of26.js","sourceRoot":"","sources":["ES5For-of26.ts"],"names":[],"mappings":"AAAA,GAAG,CAAC,CAAuB,UAAM,EAAN,MAAC,CAAC,EAAE,CAAC,CAAC,EAAN,cAAM,EAAN,IAAM,CAAC;IAA7B,eAAkB,EAAb,UAAK,EAAL,0BAAK,EAAE,UAAK,EAAL,0BAAK;IAClB,CAAC,CAAC;IACF,CAAC,CAAC;CACL"} \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of26.sourcemap.txt b/tests/baselines/reference/ES5For-of26.sourcemap.txt index c9942b1e861..00a1cc55f37 100644 --- a/tests/baselines/reference/ES5For-of26.sourcemap.txt +++ b/tests/baselines/reference/ES5For-of26.sourcemap.txt @@ -38,9 +38,9 @@ sourceFile:ES5For-of26.ts 10> 3 11> ] 12> -13> var [a = 0, b = 1] +13> [2, 3] 14> -15> var [a = 0, b = 1] of [2, 3] +15> [2, 3] 16> ) 1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) 2 >Emitted(1, 4) Source(1, 4) + SourceIndex(0) @@ -53,50 +53,50 @@ sourceFile:ES5For-of26.ts 9 >Emitted(1, 27) Source(1, 32) + SourceIndex(0) 10>Emitted(1, 28) Source(1, 33) + SourceIndex(0) 11>Emitted(1, 29) Source(1, 34) + SourceIndex(0) -12>Emitted(1, 31) Source(1, 6) + SourceIndex(0) -13>Emitted(1, 45) Source(1, 24) + SourceIndex(0) -14>Emitted(1, 47) Source(1, 6) + SourceIndex(0) +12>Emitted(1, 31) Source(1, 28) + SourceIndex(0) +13>Emitted(1, 45) Source(1, 34) + SourceIndex(0) +14>Emitted(1, 47) Source(1, 28) + SourceIndex(0) 15>Emitted(1, 51) Source(1, 34) + SourceIndex(0) 16>Emitted(1, 52) Source(1, 35) + SourceIndex(0) --- >>> var _b = _a[_i], _c = _b[0], a = _c === void 0 ? 0 : _c, _d = _b[1], b = _d === void 0 ? 1 : _d; 1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^ -5 > ^ -6 > ^^^^^^^^^^^^^^^^^^^ -7 > ^ -8 > ^^^^^^^^^^^^^^^^^^^ -9 > ^ -10> ^^^^^ +2 > ^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^ 1-> -2 > var [ -3 > a -4 > = -5 > 0 -6 > , -7 > b -8 > = -9 > 1 -10> ] +2 > var [a = 0, b = 1] +3 > +4 > a = 0 +5 > +6 > a = 0 +7 > , +8 > b = 1 +9 > +10> b = 1 1->Emitted(2, 5) Source(1, 6) + SourceIndex(0) -2 >Emitted(2, 34) Source(1, 11) + SourceIndex(0) -3 >Emitted(2, 35) Source(1, 12) + SourceIndex(0) -4 >Emitted(2, 54) Source(1, 15) + SourceIndex(0) -5 >Emitted(2, 55) Source(1, 16) + SourceIndex(0) -6 >Emitted(2, 74) Source(1, 18) + SourceIndex(0) -7 >Emitted(2, 75) Source(1, 19) + SourceIndex(0) -8 >Emitted(2, 94) Source(1, 22) + SourceIndex(0) -9 >Emitted(2, 95) Source(1, 23) + SourceIndex(0) -10>Emitted(2, 100) Source(1, 24) + SourceIndex(0) +2 >Emitted(2, 20) Source(1, 24) + SourceIndex(0) +3 >Emitted(2, 22) Source(1, 11) + SourceIndex(0) +4 >Emitted(2, 32) Source(1, 16) + SourceIndex(0) +5 >Emitted(2, 34) Source(1, 11) + SourceIndex(0) +6 >Emitted(2, 60) Source(1, 16) + SourceIndex(0) +7 >Emitted(2, 62) Source(1, 18) + SourceIndex(0) +8 >Emitted(2, 72) Source(1, 23) + SourceIndex(0) +9 >Emitted(2, 74) Source(1, 18) + SourceIndex(0) +10>Emitted(2, 100) Source(1, 23) + SourceIndex(0) --- >>> a; 1 >^^^^ 2 > ^ 3 > ^ 4 > ^-> -1 > of [2, 3]) { +1 >] of [2, 3]) { > 2 > a 3 > ; diff --git a/tests/baselines/reference/ES5For-of3.js.map b/tests/baselines/reference/ES5For-of3.js.map index 7454e1ca85d..5a91ff28e9c 100644 --- a/tests/baselines/reference/ES5For-of3.js.map +++ b/tests/baselines/reference/ES5For-of3.js.map @@ -1,2 +1,2 @@ //// [ES5For-of3.js.map] -{"version":3,"file":"ES5For-of3.js","sourceRoot":"","sources":["ES5For-of3.ts"],"names":[],"mappings":"AAAA,GAAG,CAAC,CAAU,UAAe,EAAf,MAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAxB,cAAK,EAAL,IAAwB,CAAC;IAAzB,IAAI,CAAC,SAAA;IACN,IAAI,CAAC,GAAG,CAAC,CAAC;CAAA"} \ No newline at end of file +{"version":3,"file":"ES5For-of3.js","sourceRoot":"","sources":["ES5For-of3.ts"],"names":[],"mappings":"AAAA,GAAG,CAAC,CAAU,UAAe,EAAf,MAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAf,cAAe,EAAf,IAAe,CAAC;IAAzB,IAAI,CAAC,SAAA;IACN,IAAI,CAAC,GAAG,CAAC,CAAC;CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of3.sourcemap.txt b/tests/baselines/reference/ES5For-of3.sourcemap.txt index dd0bca37b68..1c728f5df67 100644 --- a/tests/baselines/reference/ES5For-of3.sourcemap.txt +++ b/tests/baselines/reference/ES5For-of3.sourcemap.txt @@ -41,9 +41,9 @@ sourceFile:ES5For-of3.ts 12> 'c' 13> ] 14> -15> var v +15> ['a', 'b', 'c'] 16> -17> var v of ['a', 'b', 'c'] +17> ['a', 'b', 'c'] 18> ) 1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) 2 >Emitted(1, 4) Source(1, 4) + SourceIndex(0) @@ -58,9 +58,9 @@ sourceFile:ES5For-of3.ts 11>Emitted(1, 34) Source(1, 26) + SourceIndex(0) 12>Emitted(1, 37) Source(1, 29) + SourceIndex(0) 13>Emitted(1, 38) Source(1, 30) + SourceIndex(0) -14>Emitted(1, 40) Source(1, 6) + SourceIndex(0) -15>Emitted(1, 54) Source(1, 11) + SourceIndex(0) -16>Emitted(1, 56) Source(1, 6) + SourceIndex(0) +14>Emitted(1, 40) Source(1, 15) + SourceIndex(0) +15>Emitted(1, 54) Source(1, 30) + SourceIndex(0) +16>Emitted(1, 56) Source(1, 15) + SourceIndex(0) 17>Emitted(1, 60) Source(1, 30) + SourceIndex(0) 18>Emitted(1, 61) Source(1, 31) + SourceIndex(0) --- diff --git a/tests/baselines/reference/ES5For-of8.js.map b/tests/baselines/reference/ES5For-of8.js.map index f4e62e46e18..3a1497eadcd 100644 --- a/tests/baselines/reference/ES5For-of8.js.map +++ b/tests/baselines/reference/ES5For-of8.js.map @@ -1,2 +1,2 @@ //// [ES5For-of8.js.map] -{"version":3,"file":"ES5For-of8.js","sourceRoot":"","sources":["ES5For-of8.ts"],"names":[],"mappings":"AAAA;IACI,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;AACpB,CAAC;AACD,GAAG,CAAC,CAAY,UAAe,EAAf,MAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAA1B,cAAO,EAAP,IAA0B,CAAC;IAA3B,GAAG,EAAE,CAAC,CAAC,SAAA;IACR,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC,CAAC,CAAC;CACnB"} \ No newline at end of file +{"version":3,"file":"ES5For-of8.js","sourceRoot":"","sources":["ES5For-of8.ts"],"names":[],"mappings":"AAAA;IACI,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;AACpB,CAAC;AACD,GAAG,CAAC,CAAY,UAAe,EAAf,MAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAf,cAAe,EAAf,IAAe,CAAC;IAA3B,GAAG,EAAE,CAAC,CAAC,SAAA;IACR,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC,CAAC,CAAC;CACnB"} \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of8.sourcemap.txt b/tests/baselines/reference/ES5For-of8.sourcemap.txt index 7a87dbf3998..dbfce707ca6 100644 --- a/tests/baselines/reference/ES5For-of8.sourcemap.txt +++ b/tests/baselines/reference/ES5For-of8.sourcemap.txt @@ -88,9 +88,9 @@ sourceFile:ES5For-of8.ts 12> 'c' 13> ] 14> -15> foo().x +15> ['a', 'b', 'c'] 16> -17> foo().x of ['a', 'b', 'c'] +17> ['a', 'b', 'c'] 18> ) 1->Emitted(4, 1) Source(4, 1) + SourceIndex(0) 2 >Emitted(4, 4) Source(4, 4) + SourceIndex(0) @@ -105,9 +105,9 @@ sourceFile:ES5For-of8.ts 11>Emitted(4, 34) Source(4, 28) + SourceIndex(0) 12>Emitted(4, 37) Source(4, 31) + SourceIndex(0) 13>Emitted(4, 38) Source(4, 32) + SourceIndex(0) -14>Emitted(4, 40) Source(4, 6) + SourceIndex(0) -15>Emitted(4, 54) Source(4, 13) + SourceIndex(0) -16>Emitted(4, 56) Source(4, 6) + SourceIndex(0) +14>Emitted(4, 40) Source(4, 17) + SourceIndex(0) +15>Emitted(4, 54) Source(4, 32) + SourceIndex(0) +16>Emitted(4, 56) Source(4, 17) + SourceIndex(0) 17>Emitted(4, 60) Source(4, 32) + SourceIndex(0) 18>Emitted(4, 61) Source(4, 33) + SourceIndex(0) --- diff --git a/tests/baselines/reference/EnumAndModuleWithSameNameAndCommonRoot.symbols b/tests/baselines/reference/EnumAndModuleWithSameNameAndCommonRoot.symbols index dc97960f71e..30eca163cda 100644 --- a/tests/baselines/reference/EnumAndModuleWithSameNameAndCommonRoot.symbols +++ b/tests/baselines/reference/EnumAndModuleWithSameNameAndCommonRoot.symbols @@ -14,8 +14,8 @@ module enumdule { >Point : Symbol(Point, Decl(EnumAndModuleWithSameNameAndCommonRoot.ts, 4, 17)) constructor(public x: number, public y: number) { } ->x : Symbol(x, Decl(EnumAndModuleWithSameNameAndCommonRoot.ts, 7, 20)) ->y : Symbol(y, Decl(EnumAndModuleWithSameNameAndCommonRoot.ts, 7, 37)) +>x : Symbol(Point.x, Decl(EnumAndModuleWithSameNameAndCommonRoot.ts, 7, 20)) +>y : Symbol(Point.y, Decl(EnumAndModuleWithSameNameAndCommonRoot.ts, 7, 37)) } } diff --git a/tests/baselines/reference/ExportAssignment7.errors.txt b/tests/baselines/reference/ExportAssignment7.errors.txt index fe461785c63..6535428e2e4 100644 --- a/tests/baselines/reference/ExportAssignment7.errors.txt +++ b/tests/baselines/reference/ExportAssignment7.errors.txt @@ -1,12 +1,9 @@ -tests/cases/compiler/ExportAssignment7.ts(1,14): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/compiler/ExportAssignment7.ts(4,1): error TS2309: An export assignment cannot be used in a module with other exported elements. tests/cases/compiler/ExportAssignment7.ts(4,10): error TS2304: Cannot find name 'B'. -==== tests/cases/compiler/ExportAssignment7.ts (3 errors) ==== +==== tests/cases/compiler/ExportAssignment7.ts (2 errors) ==== export class C { - ~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. } export = B; diff --git a/tests/baselines/reference/ExportAssignment7.js b/tests/baselines/reference/ExportAssignment7.js index d6b37101619..bc7cee12b1d 100644 --- a/tests/baselines/reference/ExportAssignment7.js +++ b/tests/baselines/reference/ExportAssignment7.js @@ -12,3 +12,4 @@ var C = (function () { return C; }()); exports.C = C; +module.exports = B; diff --git a/tests/baselines/reference/ExportAssignment8.errors.txt b/tests/baselines/reference/ExportAssignment8.errors.txt index 22e32c9c7d0..e346dcbab11 100644 --- a/tests/baselines/reference/ExportAssignment8.errors.txt +++ b/tests/baselines/reference/ExportAssignment8.errors.txt @@ -1,13 +1,10 @@ -tests/cases/compiler/ExportAssignment8.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/compiler/ExportAssignment8.ts(1,1): error TS2309: An export assignment cannot be used in a module with other exported elements. tests/cases/compiler/ExportAssignment8.ts(1,10): error TS2304: Cannot find name 'B'. -==== tests/cases/compiler/ExportAssignment8.ts (3 errors) ==== +==== tests/cases/compiler/ExportAssignment8.ts (2 errors) ==== export = B; ~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. - ~~~~~~~~~~~ !!! error TS2309: An export assignment cannot be used in a module with other exported elements. ~ !!! error TS2304: Cannot find name 'B'. diff --git a/tests/baselines/reference/ExportAssignment8.js b/tests/baselines/reference/ExportAssignment8.js index 8cdff41505e..e31a38c651c 100644 --- a/tests/baselines/reference/ExportAssignment8.js +++ b/tests/baselines/reference/ExportAssignment8.js @@ -12,3 +12,4 @@ var C = (function () { return C; }()); exports.C = C; +module.exports = B; diff --git a/tests/baselines/reference/ExportClassWhichExtendsInterfaceWithInaccessibleType.symbols b/tests/baselines/reference/ExportClassWhichExtendsInterfaceWithInaccessibleType.symbols index 8346888d81f..0ff8e694fd5 100644 --- a/tests/baselines/reference/ExportClassWhichExtendsInterfaceWithInaccessibleType.symbols +++ b/tests/baselines/reference/ExportClassWhichExtendsInterfaceWithInaccessibleType.symbols @@ -6,13 +6,13 @@ module A { >Point : Symbol(Point, Decl(ExportClassWhichExtendsInterfaceWithInaccessibleType.ts, 0, 10)) x: number; ->x : Symbol(x, Decl(ExportClassWhichExtendsInterfaceWithInaccessibleType.ts, 2, 21)) +>x : Symbol(Point.x, Decl(ExportClassWhichExtendsInterfaceWithInaccessibleType.ts, 2, 21)) y: number; ->y : Symbol(y, Decl(ExportClassWhichExtendsInterfaceWithInaccessibleType.ts, 3, 18)) +>y : Symbol(Point.y, Decl(ExportClassWhichExtendsInterfaceWithInaccessibleType.ts, 3, 18)) fromOrigin(p: Point): number; ->fromOrigin : Symbol(fromOrigin, Decl(ExportClassWhichExtendsInterfaceWithInaccessibleType.ts, 4, 18)) +>fromOrigin : Symbol(Point.fromOrigin, Decl(ExportClassWhichExtendsInterfaceWithInaccessibleType.ts, 4, 18)) >p : Symbol(p, Decl(ExportClassWhichExtendsInterfaceWithInaccessibleType.ts, 6, 19)) >Point : Symbol(Point, Decl(ExportClassWhichExtendsInterfaceWithInaccessibleType.ts, 0, 10)) } @@ -22,11 +22,11 @@ module A { >Point : Symbol(Point, Decl(ExportClassWhichExtendsInterfaceWithInaccessibleType.ts, 0, 10)) constructor(public x: number, public y: number) { } ->x : Symbol(x, Decl(ExportClassWhichExtendsInterfaceWithInaccessibleType.ts, 10, 20)) ->y : Symbol(y, Decl(ExportClassWhichExtendsInterfaceWithInaccessibleType.ts, 10, 37)) +>x : Symbol(Point2d.x, Decl(ExportClassWhichExtendsInterfaceWithInaccessibleType.ts, 10, 20)) +>y : Symbol(Point2d.y, Decl(ExportClassWhichExtendsInterfaceWithInaccessibleType.ts, 10, 37)) fromOrigin(p: Point) { ->fromOrigin : Symbol(fromOrigin, Decl(ExportClassWhichExtendsInterfaceWithInaccessibleType.ts, 10, 59)) +>fromOrigin : Symbol(Point2d.fromOrigin, Decl(ExportClassWhichExtendsInterfaceWithInaccessibleType.ts, 10, 59)) >p : Symbol(p, Decl(ExportClassWhichExtendsInterfaceWithInaccessibleType.ts, 12, 19)) >Point : Symbol(Point, Decl(ExportClassWhichExtendsInterfaceWithInaccessibleType.ts, 0, 10)) diff --git a/tests/baselines/reference/ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.symbols b/tests/baselines/reference/ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.symbols index 2802e6aa392..371c740d967 100644 --- a/tests/baselines/reference/ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.symbols +++ b/tests/baselines/reference/ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.symbols @@ -6,10 +6,10 @@ module A { >Point : Symbol(Point, Decl(ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.ts, 0, 10)) x: number; ->x : Symbol(x, Decl(ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.ts, 2, 24)) +>x : Symbol(Point.x, Decl(ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.ts, 2, 24)) y: number; ->y : Symbol(y, Decl(ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.ts, 3, 18)) +>y : Symbol(Point.y, Decl(ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.ts, 3, 18)) } export var Origin: Point = { x: 0, y: 0 }; @@ -23,7 +23,7 @@ module A { >Point : Symbol(Point, Decl(ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.ts, 0, 10)) z: number; ->z : Symbol(z, Decl(ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.ts, 9, 40)) +>z : Symbol(Point3d.z, Decl(ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.ts, 9, 40)) } export var Origin3d: Point3d = { x: 0, y: 0, z: 0 }; @@ -39,9 +39,9 @@ module A { >Point : Symbol(Point, Decl(ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.ts, 0, 10)) constructor(public start: TPoint, public end: TPoint) { } ->start : Symbol(start, Decl(ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.ts, 16, 20)) +>start : Symbol(Line.start, Decl(ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.ts, 16, 20)) >TPoint : Symbol(TPoint, Decl(ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.ts, 15, 22)) ->end : Symbol(end, Decl(ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.ts, 16, 41)) +>end : Symbol(Line.end, Decl(ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.ts, 16, 41)) >TPoint : Symbol(TPoint, Decl(ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.ts, 15, 22)) } } diff --git a/tests/baselines/reference/ExportClassWithInaccessibleTypeInIndexerTypeAnnotations.symbols b/tests/baselines/reference/ExportClassWithInaccessibleTypeInIndexerTypeAnnotations.symbols index e1e433a8921..b42f561ccf3 100644 --- a/tests/baselines/reference/ExportClassWithInaccessibleTypeInIndexerTypeAnnotations.symbols +++ b/tests/baselines/reference/ExportClassWithInaccessibleTypeInIndexerTypeAnnotations.symbols @@ -6,10 +6,10 @@ module A { >Point : Symbol(Point, Decl(ExportClassWithInaccessibleTypeInIndexerTypeAnnotations.ts, 0, 10)) x: number; ->x : Symbol(x, Decl(ExportClassWithInaccessibleTypeInIndexerTypeAnnotations.ts, 2, 17)) +>x : Symbol(Point.x, Decl(ExportClassWithInaccessibleTypeInIndexerTypeAnnotations.ts, 2, 17)) y: number; ->y : Symbol(y, Decl(ExportClassWithInaccessibleTypeInIndexerTypeAnnotations.ts, 3, 18)) +>y : Symbol(Point.y, Decl(ExportClassWithInaccessibleTypeInIndexerTypeAnnotations.ts, 3, 18)) } export class points { diff --git a/tests/baselines/reference/ExportClassWithInaccessibleTypeInTypeParameterConstraint.symbols b/tests/baselines/reference/ExportClassWithInaccessibleTypeInTypeParameterConstraint.symbols index e1044bd2442..38c97a7e54a 100644 --- a/tests/baselines/reference/ExportClassWithInaccessibleTypeInTypeParameterConstraint.symbols +++ b/tests/baselines/reference/ExportClassWithInaccessibleTypeInTypeParameterConstraint.symbols @@ -6,10 +6,10 @@ module A { >Point : Symbol(Point, Decl(ExportClassWithInaccessibleTypeInTypeParameterConstraint.ts, 0, 10)) x: number; ->x : Symbol(x, Decl(ExportClassWithInaccessibleTypeInTypeParameterConstraint.ts, 2, 17)) +>x : Symbol(Point.x, Decl(ExportClassWithInaccessibleTypeInTypeParameterConstraint.ts, 2, 17)) y: number; ->y : Symbol(y, Decl(ExportClassWithInaccessibleTypeInTypeParameterConstraint.ts, 3, 18)) +>y : Symbol(Point.y, Decl(ExportClassWithInaccessibleTypeInTypeParameterConstraint.ts, 3, 18)) } export var Origin: Point = { x: 0, y: 0 }; @@ -23,7 +23,7 @@ module A { >Point : Symbol(Point, Decl(ExportClassWithInaccessibleTypeInTypeParameterConstraint.ts, 0, 10)) z: number; ->z : Symbol(z, Decl(ExportClassWithInaccessibleTypeInTypeParameterConstraint.ts, 9, 40)) +>z : Symbol(Point3d.z, Decl(ExportClassWithInaccessibleTypeInTypeParameterConstraint.ts, 9, 40)) } export var Origin3d: Point3d = { x: 0, y: 0, z: 0 }; @@ -39,9 +39,9 @@ module A { >Point : Symbol(Point, Decl(ExportClassWithInaccessibleTypeInTypeParameterConstraint.ts, 0, 10)) constructor(public start: TPoint, public end: TPoint) { } ->start : Symbol(start, Decl(ExportClassWithInaccessibleTypeInTypeParameterConstraint.ts, 16, 20)) +>start : Symbol(Line.start, Decl(ExportClassWithInaccessibleTypeInTypeParameterConstraint.ts, 16, 20)) >TPoint : Symbol(TPoint, Decl(ExportClassWithInaccessibleTypeInTypeParameterConstraint.ts, 15, 22)) ->end : Symbol(end, Decl(ExportClassWithInaccessibleTypeInTypeParameterConstraint.ts, 16, 41)) +>end : Symbol(Line.end, Decl(ExportClassWithInaccessibleTypeInTypeParameterConstraint.ts, 16, 41)) >TPoint : Symbol(TPoint, Decl(ExportClassWithInaccessibleTypeInTypeParameterConstraint.ts, 15, 22)) static fromorigin2d(p: Point): Line{ diff --git a/tests/baselines/reference/ExportFunctionWithAccessibleTypesInParameterAndReturnTypeAnnotation.symbols b/tests/baselines/reference/ExportFunctionWithAccessibleTypesInParameterAndReturnTypeAnnotation.symbols index 37b6da18c37..4903398db6a 100644 --- a/tests/baselines/reference/ExportFunctionWithAccessibleTypesInParameterAndReturnTypeAnnotation.symbols +++ b/tests/baselines/reference/ExportFunctionWithAccessibleTypesInParameterAndReturnTypeAnnotation.symbols @@ -6,19 +6,19 @@ module A { >Point : Symbol(Point, Decl(ExportFunctionWithAccessibleTypesInParameterAndReturnTypeAnnotation.ts, 0, 10)) x: number; ->x : Symbol(x, Decl(ExportFunctionWithAccessibleTypesInParameterAndReturnTypeAnnotation.ts, 2, 24)) +>x : Symbol(Point.x, Decl(ExportFunctionWithAccessibleTypesInParameterAndReturnTypeAnnotation.ts, 2, 24)) y: number; ->y : Symbol(y, Decl(ExportFunctionWithAccessibleTypesInParameterAndReturnTypeAnnotation.ts, 3, 18)) +>y : Symbol(Point.y, Decl(ExportFunctionWithAccessibleTypesInParameterAndReturnTypeAnnotation.ts, 3, 18)) } export class Line { >Line : Symbol(Line, Decl(ExportFunctionWithAccessibleTypesInParameterAndReturnTypeAnnotation.ts, 5, 5)) constructor(public start: Point, public end: Point) { } ->start : Symbol(start, Decl(ExportFunctionWithAccessibleTypesInParameterAndReturnTypeAnnotation.ts, 8, 20)) +>start : Symbol(Line.start, Decl(ExportFunctionWithAccessibleTypesInParameterAndReturnTypeAnnotation.ts, 8, 20)) >Point : Symbol(Point, Decl(ExportFunctionWithAccessibleTypesInParameterAndReturnTypeAnnotation.ts, 0, 10)) ->end : Symbol(end, Decl(ExportFunctionWithAccessibleTypesInParameterAndReturnTypeAnnotation.ts, 8, 40)) +>end : Symbol(Line.end, Decl(ExportFunctionWithAccessibleTypesInParameterAndReturnTypeAnnotation.ts, 8, 40)) >Point : Symbol(Point, Decl(ExportFunctionWithAccessibleTypesInParameterAndReturnTypeAnnotation.ts, 0, 10)) } diff --git a/tests/baselines/reference/ExportFunctionWithInaccessibleTypesInParameterTypeAnnotation.symbols b/tests/baselines/reference/ExportFunctionWithInaccessibleTypesInParameterTypeAnnotation.symbols index 41993ebf48f..2583ddc1163 100644 --- a/tests/baselines/reference/ExportFunctionWithInaccessibleTypesInParameterTypeAnnotation.symbols +++ b/tests/baselines/reference/ExportFunctionWithInaccessibleTypesInParameterTypeAnnotation.symbols @@ -6,19 +6,19 @@ module A { >Point : Symbol(Point, Decl(ExportFunctionWithInaccessibleTypesInParameterTypeAnnotation.ts, 0, 10)) x: number; ->x : Symbol(x, Decl(ExportFunctionWithInaccessibleTypesInParameterTypeAnnotation.ts, 2, 17)) +>x : Symbol(Point.x, Decl(ExportFunctionWithInaccessibleTypesInParameterTypeAnnotation.ts, 2, 17)) y: number; ->y : Symbol(y, Decl(ExportFunctionWithInaccessibleTypesInParameterTypeAnnotation.ts, 3, 18)) +>y : Symbol(Point.y, Decl(ExportFunctionWithInaccessibleTypesInParameterTypeAnnotation.ts, 3, 18)) } export class Line { >Line : Symbol(Line, Decl(ExportFunctionWithInaccessibleTypesInParameterTypeAnnotation.ts, 5, 5)) constructor(public start: Point, public end: Point) { } ->start : Symbol(start, Decl(ExportFunctionWithInaccessibleTypesInParameterTypeAnnotation.ts, 8, 20)) +>start : Symbol(Line.start, Decl(ExportFunctionWithInaccessibleTypesInParameterTypeAnnotation.ts, 8, 20)) >Point : Symbol(Point, Decl(ExportFunctionWithInaccessibleTypesInParameterTypeAnnotation.ts, 0, 10)) ->end : Symbol(end, Decl(ExportFunctionWithInaccessibleTypesInParameterTypeAnnotation.ts, 8, 40)) +>end : Symbol(Line.end, Decl(ExportFunctionWithInaccessibleTypesInParameterTypeAnnotation.ts, 8, 40)) >Point : Symbol(Point, Decl(ExportFunctionWithInaccessibleTypesInParameterTypeAnnotation.ts, 0, 10)) } diff --git a/tests/baselines/reference/ExportFunctionWithInaccessibleTypesInReturnTypeAnnotation.symbols b/tests/baselines/reference/ExportFunctionWithInaccessibleTypesInReturnTypeAnnotation.symbols index 77d57215795..b39abaf7305 100644 --- a/tests/baselines/reference/ExportFunctionWithInaccessibleTypesInReturnTypeAnnotation.symbols +++ b/tests/baselines/reference/ExportFunctionWithInaccessibleTypesInReturnTypeAnnotation.symbols @@ -6,19 +6,19 @@ module A { >Point : Symbol(Point, Decl(ExportFunctionWithInaccessibleTypesInReturnTypeAnnotation.ts, 0, 10)) x: number; ->x : Symbol(x, Decl(ExportFunctionWithInaccessibleTypesInReturnTypeAnnotation.ts, 2, 24)) +>x : Symbol(Point.x, Decl(ExportFunctionWithInaccessibleTypesInReturnTypeAnnotation.ts, 2, 24)) y: number; ->y : Symbol(y, Decl(ExportFunctionWithInaccessibleTypesInReturnTypeAnnotation.ts, 3, 18)) +>y : Symbol(Point.y, Decl(ExportFunctionWithInaccessibleTypesInReturnTypeAnnotation.ts, 3, 18)) } class Line { >Line : Symbol(Line, Decl(ExportFunctionWithInaccessibleTypesInReturnTypeAnnotation.ts, 5, 5)) constructor(public start: Point, public end: Point) { } ->start : Symbol(start, Decl(ExportFunctionWithInaccessibleTypesInReturnTypeAnnotation.ts, 8, 20)) +>start : Symbol(Line.start, Decl(ExportFunctionWithInaccessibleTypesInReturnTypeAnnotation.ts, 8, 20)) >Point : Symbol(Point, Decl(ExportFunctionWithInaccessibleTypesInReturnTypeAnnotation.ts, 0, 10)) ->end : Symbol(end, Decl(ExportFunctionWithInaccessibleTypesInReturnTypeAnnotation.ts, 8, 40)) +>end : Symbol(Line.end, Decl(ExportFunctionWithInaccessibleTypesInReturnTypeAnnotation.ts, 8, 40)) >Point : Symbol(Point, Decl(ExportFunctionWithInaccessibleTypesInReturnTypeAnnotation.ts, 0, 10)) } diff --git a/tests/baselines/reference/ExportInterfaceWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.symbols b/tests/baselines/reference/ExportInterfaceWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.symbols index 31b978c85f9..d03c7a4f58f 100644 --- a/tests/baselines/reference/ExportInterfaceWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.symbols +++ b/tests/baselines/reference/ExportInterfaceWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.symbols @@ -6,10 +6,10 @@ module A { >Point : Symbol(Point, Decl(ExportInterfaceWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.ts, 0, 10)) x: number; ->x : Symbol(x, Decl(ExportInterfaceWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.ts, 2, 28)) +>x : Symbol(Point.x, Decl(ExportInterfaceWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.ts, 2, 28)) y: number; ->y : Symbol(y, Decl(ExportInterfaceWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.ts, 3, 18)) +>y : Symbol(Point.y, Decl(ExportInterfaceWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.ts, 3, 18)) } export var Origin: Point = { x: 0, y: 0 }; @@ -23,7 +23,7 @@ module A { >Point : Symbol(Point, Decl(ExportInterfaceWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.ts, 0, 10)) z: number; ->z : Symbol(z, Decl(ExportInterfaceWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.ts, 9, 44)) +>z : Symbol(Point3d.z, Decl(ExportInterfaceWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.ts, 9, 44)) } export var Origin3d: Point3d = { x: 0, y: 0, z: 0 }; @@ -45,11 +45,11 @@ module A { >TPoint : Symbol(TPoint, Decl(ExportInterfaceWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.ts, 15, 26)) start: TPoint; ->start : Symbol(start, Decl(ExportInterfaceWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.ts, 16, 41)) +>start : Symbol(Line.start, Decl(ExportInterfaceWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.ts, 16, 41)) >TPoint : Symbol(TPoint, Decl(ExportInterfaceWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.ts, 15, 26)) end: TPoint; ->end : Symbol(end, Decl(ExportInterfaceWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.ts, 17, 22)) +>end : Symbol(Line.end, Decl(ExportInterfaceWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.ts, 17, 22)) >TPoint : Symbol(TPoint, Decl(ExportInterfaceWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.ts, 15, 26)) } } diff --git a/tests/baselines/reference/ExportInterfaceWithInaccessibleTypeInIndexerTypeAnnotations.symbols b/tests/baselines/reference/ExportInterfaceWithInaccessibleTypeInIndexerTypeAnnotations.symbols index 00f9025aa8c..d92f5ea5366 100644 --- a/tests/baselines/reference/ExportInterfaceWithInaccessibleTypeInIndexerTypeAnnotations.symbols +++ b/tests/baselines/reference/ExportInterfaceWithInaccessibleTypeInIndexerTypeAnnotations.symbols @@ -6,10 +6,10 @@ module A { >Point : Symbol(Point, Decl(ExportInterfaceWithInaccessibleTypeInIndexerTypeAnnotations.ts, 0, 10)) x: number; ->x : Symbol(x, Decl(ExportInterfaceWithInaccessibleTypeInIndexerTypeAnnotations.ts, 2, 21)) +>x : Symbol(Point.x, Decl(ExportInterfaceWithInaccessibleTypeInIndexerTypeAnnotations.ts, 2, 21)) y: number; ->y : Symbol(y, Decl(ExportInterfaceWithInaccessibleTypeInIndexerTypeAnnotations.ts, 3, 18)) +>y : Symbol(Point.y, Decl(ExportInterfaceWithInaccessibleTypeInIndexerTypeAnnotations.ts, 3, 18)) } export interface points { diff --git a/tests/baselines/reference/ExportInterfaceWithInaccessibleTypeInTypeParameterConstraint.symbols b/tests/baselines/reference/ExportInterfaceWithInaccessibleTypeInTypeParameterConstraint.symbols index 7ee70a0c77b..1d452b2b496 100644 --- a/tests/baselines/reference/ExportInterfaceWithInaccessibleTypeInTypeParameterConstraint.symbols +++ b/tests/baselines/reference/ExportInterfaceWithInaccessibleTypeInTypeParameterConstraint.symbols @@ -6,10 +6,10 @@ module A { >Point : Symbol(Point, Decl(ExportInterfaceWithInaccessibleTypeInTypeParameterConstraint.ts, 0, 10)) x: number; ->x : Symbol(x, Decl(ExportInterfaceWithInaccessibleTypeInTypeParameterConstraint.ts, 2, 21)) +>x : Symbol(Point.x, Decl(ExportInterfaceWithInaccessibleTypeInTypeParameterConstraint.ts, 2, 21)) y: number; ->y : Symbol(y, Decl(ExportInterfaceWithInaccessibleTypeInTypeParameterConstraint.ts, 3, 18)) +>y : Symbol(Point.y, Decl(ExportInterfaceWithInaccessibleTypeInTypeParameterConstraint.ts, 3, 18)) } export var Origin: Point = { x: 0, y: 0 }; @@ -23,7 +23,7 @@ module A { >Point : Symbol(Point, Decl(ExportInterfaceWithInaccessibleTypeInTypeParameterConstraint.ts, 0, 10)) z: number; ->z : Symbol(z, Decl(ExportInterfaceWithInaccessibleTypeInTypeParameterConstraint.ts, 9, 44)) +>z : Symbol(Point3d.z, Decl(ExportInterfaceWithInaccessibleTypeInTypeParameterConstraint.ts, 9, 44)) } export var Origin3d: Point3d = { x: 0, y: 0, z: 0 }; @@ -45,11 +45,11 @@ module A { >TPoint : Symbol(TPoint, Decl(ExportInterfaceWithInaccessibleTypeInTypeParameterConstraint.ts, 15, 26)) start: TPoint; ->start : Symbol(start, Decl(ExportInterfaceWithInaccessibleTypeInTypeParameterConstraint.ts, 16, 41)) +>start : Symbol(Line.start, Decl(ExportInterfaceWithInaccessibleTypeInTypeParameterConstraint.ts, 16, 41)) >TPoint : Symbol(TPoint, Decl(ExportInterfaceWithInaccessibleTypeInTypeParameterConstraint.ts, 15, 26)) end: TPoint; ->end : Symbol(end, Decl(ExportInterfaceWithInaccessibleTypeInTypeParameterConstraint.ts, 18, 22)) +>end : Symbol(Line.end, Decl(ExportInterfaceWithInaccessibleTypeInTypeParameterConstraint.ts, 18, 22)) >TPoint : Symbol(TPoint, Decl(ExportInterfaceWithInaccessibleTypeInTypeParameterConstraint.ts, 15, 26)) } } diff --git a/tests/baselines/reference/ExportModuleWithAccessibleTypesOnItsExportedMembers.symbols b/tests/baselines/reference/ExportModuleWithAccessibleTypesOnItsExportedMembers.symbols index acf6a1caef4..76df3ffd35a 100644 --- a/tests/baselines/reference/ExportModuleWithAccessibleTypesOnItsExportedMembers.symbols +++ b/tests/baselines/reference/ExportModuleWithAccessibleTypesOnItsExportedMembers.symbols @@ -6,8 +6,8 @@ module A { >Point : Symbol(Point, Decl(ExportModuleWithAccessibleTypesOnItsExportedMembers.ts, 0, 10)) constructor(public x: number, public y: number) { } ->x : Symbol(x, Decl(ExportModuleWithAccessibleTypesOnItsExportedMembers.ts, 3, 20)) ->y : Symbol(y, Decl(ExportModuleWithAccessibleTypesOnItsExportedMembers.ts, 3, 37)) +>x : Symbol(Point.x, Decl(ExportModuleWithAccessibleTypesOnItsExportedMembers.ts, 3, 20)) +>y : Symbol(Point.y, Decl(ExportModuleWithAccessibleTypesOnItsExportedMembers.ts, 3, 37)) } export module B { diff --git a/tests/baselines/reference/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInMemberTypeAnnotations.symbols b/tests/baselines/reference/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInMemberTypeAnnotations.symbols index dccc613aca9..2bbedd3ea09 100644 --- a/tests/baselines/reference/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInMemberTypeAnnotations.symbols +++ b/tests/baselines/reference/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInMemberTypeAnnotations.symbols @@ -6,8 +6,8 @@ module A { >Point : Symbol(Point, Decl(ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInMemberTypeAnnotations.ts, 0, 10)) constructor(public x: number, public y: number) { } ->x : Symbol(x, Decl(ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInMemberTypeAnnotations.ts, 3, 20)) ->y : Symbol(y, Decl(ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInMemberTypeAnnotations.ts, 3, 37)) +>x : Symbol(Point.x, Decl(ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInMemberTypeAnnotations.ts, 3, 20)) +>y : Symbol(Point.y, Decl(ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInMemberTypeAnnotations.ts, 3, 37)) } export var Origin: Point = { x: 0, y: 0 }; diff --git a/tests/baselines/reference/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInNestedMemberTypeAnnotations.symbols b/tests/baselines/reference/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInNestedMemberTypeAnnotations.symbols index 3c1ca13b616..97ac79dc44d 100644 --- a/tests/baselines/reference/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInNestedMemberTypeAnnotations.symbols +++ b/tests/baselines/reference/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInNestedMemberTypeAnnotations.symbols @@ -6,8 +6,8 @@ module A { >Point : Symbol(Point, Decl(ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInNestedMemberTypeAnnotations.ts, 0, 10)) constructor(public x: number, public y: number) { } ->x : Symbol(x, Decl(ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInNestedMemberTypeAnnotations.ts, 3, 20)) ->y : Symbol(y, Decl(ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInNestedMemberTypeAnnotations.ts, 3, 37)) +>x : Symbol(Point.x, Decl(ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInNestedMemberTypeAnnotations.ts, 3, 20)) +>y : Symbol(Point.y, Decl(ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInNestedMemberTypeAnnotations.ts, 3, 37)) } export var UnitSquare : { diff --git a/tests/baselines/reference/ExportVariableOfGenericTypeWithInaccessibleTypeAsTypeArgument.symbols b/tests/baselines/reference/ExportVariableOfGenericTypeWithInaccessibleTypeAsTypeArgument.symbols index 90f2701b534..e837af939b9 100644 --- a/tests/baselines/reference/ExportVariableOfGenericTypeWithInaccessibleTypeAsTypeArgument.symbols +++ b/tests/baselines/reference/ExportVariableOfGenericTypeWithInaccessibleTypeAsTypeArgument.symbols @@ -6,7 +6,7 @@ module A { >B : Symbol(B, Decl(ExportVariableOfGenericTypeWithInaccessibleTypeAsTypeArgument.ts, 0, 10)) id: number; ->id : Symbol(id, Decl(ExportVariableOfGenericTypeWithInaccessibleTypeAsTypeArgument.ts, 1, 13)) +>id : Symbol(B.id, Decl(ExportVariableOfGenericTypeWithInaccessibleTypeAsTypeArgument.ts, 1, 13)) } export var beez: Array; diff --git a/tests/baselines/reference/ExportVariableWithAccessibleTypeInTypeAnnotation.symbols b/tests/baselines/reference/ExportVariableWithAccessibleTypeInTypeAnnotation.symbols index 55ba5fd0cf3..c32bed24d98 100644 --- a/tests/baselines/reference/ExportVariableWithAccessibleTypeInTypeAnnotation.symbols +++ b/tests/baselines/reference/ExportVariableWithAccessibleTypeInTypeAnnotation.symbols @@ -6,10 +6,10 @@ module A { >Point : Symbol(Point, Decl(ExportVariableWithAccessibleTypeInTypeAnnotation.ts, 0, 10)) x: number; ->x : Symbol(x, Decl(ExportVariableWithAccessibleTypeInTypeAnnotation.ts, 2, 28)) +>x : Symbol(Point.x, Decl(ExportVariableWithAccessibleTypeInTypeAnnotation.ts, 2, 28)) y: number; ->y : Symbol(y, Decl(ExportVariableWithAccessibleTypeInTypeAnnotation.ts, 3, 18)) +>y : Symbol(Point.y, Decl(ExportVariableWithAccessibleTypeInTypeAnnotation.ts, 3, 18)) } // valid since Point is exported diff --git a/tests/baselines/reference/ExportVariableWithInaccessibleTypeInTypeAnnotation.symbols b/tests/baselines/reference/ExportVariableWithInaccessibleTypeInTypeAnnotation.symbols index ac43ccea789..ea7806eb0f6 100644 --- a/tests/baselines/reference/ExportVariableWithInaccessibleTypeInTypeAnnotation.symbols +++ b/tests/baselines/reference/ExportVariableWithInaccessibleTypeInTypeAnnotation.symbols @@ -6,10 +6,10 @@ module A { >Point : Symbol(Point, Decl(ExportVariableWithInaccessibleTypeInTypeAnnotation.ts, 0, 10)) x: number; ->x : Symbol(x, Decl(ExportVariableWithInaccessibleTypeInTypeAnnotation.ts, 2, 28)) +>x : Symbol(Point.x, Decl(ExportVariableWithInaccessibleTypeInTypeAnnotation.ts, 2, 28)) y: number; ->y : Symbol(y, Decl(ExportVariableWithInaccessibleTypeInTypeAnnotation.ts, 3, 18)) +>y : Symbol(Point.y, Decl(ExportVariableWithInaccessibleTypeInTypeAnnotation.ts, 3, 18)) } // valid since Point is exported @@ -24,7 +24,7 @@ module A { >Point : Symbol(Point, Decl(ExportVariableWithInaccessibleTypeInTypeAnnotation.ts, 0, 10)) z: number; ->z : Symbol(z, Decl(ExportVariableWithInaccessibleTypeInTypeAnnotation.ts, 10, 37)) +>z : Symbol(Point3d.z, Decl(ExportVariableWithInaccessibleTypeInTypeAnnotation.ts, 10, 37)) } // invalid Point3d is not exported diff --git a/tests/baselines/reference/ModuleAndEnumWithSameNameAndCommonRoot.symbols b/tests/baselines/reference/ModuleAndEnumWithSameNameAndCommonRoot.symbols index 72eb0340eb2..7d1358ca927 100644 --- a/tests/baselines/reference/ModuleAndEnumWithSameNameAndCommonRoot.symbols +++ b/tests/baselines/reference/ModuleAndEnumWithSameNameAndCommonRoot.symbols @@ -6,8 +6,8 @@ module enumdule { >Point : Symbol(Point, Decl(ModuleAndEnumWithSameNameAndCommonRoot.ts, 0, 17)) constructor(public x: number, public y: number) { } ->x : Symbol(x, Decl(ModuleAndEnumWithSameNameAndCommonRoot.ts, 3, 20)) ->y : Symbol(y, Decl(ModuleAndEnumWithSameNameAndCommonRoot.ts, 3, 37)) +>x : Symbol(Point.x, Decl(ModuleAndEnumWithSameNameAndCommonRoot.ts, 3, 20)) +>y : Symbol(Point.y, Decl(ModuleAndEnumWithSameNameAndCommonRoot.ts, 3, 37)) } } diff --git a/tests/baselines/reference/Protected1.errors.txt b/tests/baselines/reference/Protected1.errors.txt index 561e4cfd001..157c9b3263e 100644 --- a/tests/baselines/reference/Protected1.errors.txt +++ b/tests/baselines/reference/Protected1.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/Protected/Protected1.ts(1,1): error TS1044: 'protected' modifier cannot appear on a module element. +tests/cases/conformance/parser/ecmascript5/Protected/Protected1.ts(1,1): error TS1044: 'protected' modifier cannot appear on a module or namespace element. ==== tests/cases/conformance/parser/ecmascript5/Protected/Protected1.ts (1 errors) ==== protected class C { ~~~~~~~~~ -!!! error TS1044: 'protected' modifier cannot appear on a module element. +!!! error TS1044: 'protected' modifier cannot appear on a module or namespace element. } \ No newline at end of file diff --git a/tests/baselines/reference/Protected2.errors.txt b/tests/baselines/reference/Protected2.errors.txt index 0f6de4d49ed..7779cb55348 100644 --- a/tests/baselines/reference/Protected2.errors.txt +++ b/tests/baselines/reference/Protected2.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/Protected/Protected2.ts(1,1): error TS1044: 'protected' modifier cannot appear on a module element. +tests/cases/conformance/parser/ecmascript5/Protected/Protected2.ts(1,1): error TS1044: 'protected' modifier cannot appear on a module or namespace element. ==== tests/cases/conformance/parser/ecmascript5/Protected/Protected2.ts (1 errors) ==== protected module M { ~~~~~~~~~ -!!! error TS1044: 'protected' modifier cannot appear on a module element. +!!! error TS1044: 'protected' modifier cannot appear on a module or namespace element. } \ No newline at end of file diff --git a/tests/baselines/reference/Protected3.errors.txt b/tests/baselines/reference/Protected3.errors.txt deleted file mode 100644 index 688422a1e0f..00000000000 --- a/tests/baselines/reference/Protected3.errors.txt +++ /dev/null @@ -1,9 +0,0 @@ -tests/cases/conformance/parser/ecmascript5/Protected/Protected3.ts(2,3): error TS1089: 'protected' modifier cannot appear on a constructor declaration. - - -==== tests/cases/conformance/parser/ecmascript5/Protected/Protected3.ts (1 errors) ==== - class C { - protected constructor() { } - ~~~~~~~~~ -!!! error TS1089: 'protected' modifier cannot appear on a constructor declaration. - } \ No newline at end of file diff --git a/tests/baselines/reference/Protected3.symbols b/tests/baselines/reference/Protected3.symbols new file mode 100644 index 00000000000..a9882189902 --- /dev/null +++ b/tests/baselines/reference/Protected3.symbols @@ -0,0 +1,6 @@ +=== tests/cases/conformance/parser/ecmascript5/Protected/Protected3.ts === +class C { +>C : Symbol(C, Decl(Protected3.ts, 0, 0)) + + protected constructor() { } +} diff --git a/tests/baselines/reference/Protected3.types b/tests/baselines/reference/Protected3.types new file mode 100644 index 00000000000..d3f938a4431 --- /dev/null +++ b/tests/baselines/reference/Protected3.types @@ -0,0 +1,6 @@ +=== tests/cases/conformance/parser/ecmascript5/Protected/Protected3.ts === +class C { +>C : C + + protected constructor() { } +} diff --git a/tests/baselines/reference/Protected8.symbols b/tests/baselines/reference/Protected8.symbols index 502e68bb9c2..eccd4b50f3c 100644 --- a/tests/baselines/reference/Protected8.symbols +++ b/tests/baselines/reference/Protected8.symbols @@ -3,8 +3,8 @@ interface I { >I : Symbol(I, Decl(Protected8.ts, 0, 0)) protected ->protected : Symbol(protected, Decl(Protected8.ts, 0, 13)) +>protected : Symbol(I.protected, Decl(Protected8.ts, 0, 13)) p ->p : Symbol(p, Decl(Protected8.ts, 1, 12)) +>p : Symbol(I.p, Decl(Protected8.ts, 1, 12)) } diff --git a/tests/baselines/reference/Protected9.symbols b/tests/baselines/reference/Protected9.symbols index 27ce91344e4..9ca97c78f9a 100644 --- a/tests/baselines/reference/Protected9.symbols +++ b/tests/baselines/reference/Protected9.symbols @@ -3,5 +3,5 @@ class C { >C : Symbol(C, Decl(Protected9.ts, 0, 0)) constructor(protected p) { } ->p : Symbol(p, Decl(Protected9.ts, 1, 15)) +>p : Symbol(C.p, Decl(Protected9.ts, 1, 15)) } diff --git a/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedAndNonExportedClassesOfTheSameName.symbols b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedAndNonExportedClassesOfTheSameName.symbols index c9e2c124e9d..f5830071897 100644 --- a/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedAndNonExportedClassesOfTheSameName.symbols +++ b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedAndNonExportedClassesOfTheSameName.symbols @@ -6,10 +6,10 @@ module A { >Point : Symbol(Point, Decl(TwoInternalModulesThatMergeEachWithExportedAndNonExportedClassesOfTheSameName.ts, 0, 10)) x: number; ->x : Symbol(x, Decl(TwoInternalModulesThatMergeEachWithExportedAndNonExportedClassesOfTheSameName.ts, 1, 24)) +>x : Symbol(Point.x, Decl(TwoInternalModulesThatMergeEachWithExportedAndNonExportedClassesOfTheSameName.ts, 1, 24)) y: number; ->y : Symbol(y, Decl(TwoInternalModulesThatMergeEachWithExportedAndNonExportedClassesOfTheSameName.ts, 2, 18)) +>y : Symbol(Point.y, Decl(TwoInternalModulesThatMergeEachWithExportedAndNonExportedClassesOfTheSameName.ts, 2, 18)) } } @@ -20,7 +20,7 @@ module A { >Point : Symbol(Point, Decl(TwoInternalModulesThatMergeEachWithExportedAndNonExportedClassesOfTheSameName.ts, 7, 10)) fromCarthesian(p: A.Point) { ->fromCarthesian : Symbol(fromCarthesian, Decl(TwoInternalModulesThatMergeEachWithExportedAndNonExportedClassesOfTheSameName.ts, 8, 17)) +>fromCarthesian : Symbol(Point.fromCarthesian, Decl(TwoInternalModulesThatMergeEachWithExportedAndNonExportedClassesOfTheSameName.ts, 8, 17)) >p : Symbol(p, Decl(TwoInternalModulesThatMergeEachWithExportedAndNonExportedClassesOfTheSameName.ts, 9, 23)) >A : Symbol(A, Decl(TwoInternalModulesThatMergeEachWithExportedAndNonExportedClassesOfTheSameName.ts, 0, 0), Decl(TwoInternalModulesThatMergeEachWithExportedAndNonExportedClassesOfTheSameName.ts, 5, 1)) >Point : Symbol(Point, Decl(TwoInternalModulesThatMergeEachWithExportedAndNonExportedClassesOfTheSameName.ts, 0, 10)) @@ -58,7 +58,7 @@ module X.Y.Z { >Line : Symbol(Line, Decl(TwoInternalModulesThatMergeEachWithExportedAndNonExportedClassesOfTheSameName.ts, 19, 14)) length: number; ->length : Symbol(length, Decl(TwoInternalModulesThatMergeEachWithExportedAndNonExportedClassesOfTheSameName.ts, 20, 23)) +>length : Symbol(Line.length, Decl(TwoInternalModulesThatMergeEachWithExportedAndNonExportedClassesOfTheSameName.ts, 20, 23)) } } @@ -75,7 +75,7 @@ module X { >Line : Symbol(Line, Decl(TwoInternalModulesThatMergeEachWithExportedAndNonExportedClassesOfTheSameName.ts, 27, 25)) name: string; ->name : Symbol(name, Decl(TwoInternalModulesThatMergeEachWithExportedAndNonExportedClassesOfTheSameName.ts, 28, 24)) +>name : Symbol(Line.name, Decl(TwoInternalModulesThatMergeEachWithExportedAndNonExportedClassesOfTheSameName.ts, 28, 24)) } } } diff --git a/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedAndNonExportedInterfacesOfTheSameName.symbols b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedAndNonExportedInterfacesOfTheSameName.symbols index 2fcf3c4b09e..f9237087508 100644 --- a/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedAndNonExportedInterfacesOfTheSameName.symbols +++ b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedAndNonExportedInterfacesOfTheSameName.symbols @@ -6,13 +6,13 @@ module A { >Point : Symbol(Point, Decl(TwoInternalModulesThatMergeEachWithExportedAndNonExportedInterfacesOfTheSameName.ts, 0, 10)) x: number; ->x : Symbol(x, Decl(TwoInternalModulesThatMergeEachWithExportedAndNonExportedInterfacesOfTheSameName.ts, 1, 28)) +>x : Symbol(Point.x, Decl(TwoInternalModulesThatMergeEachWithExportedAndNonExportedInterfacesOfTheSameName.ts, 1, 28)) y: number; ->y : Symbol(y, Decl(TwoInternalModulesThatMergeEachWithExportedAndNonExportedInterfacesOfTheSameName.ts, 2, 18)) +>y : Symbol(Point.y, Decl(TwoInternalModulesThatMergeEachWithExportedAndNonExportedInterfacesOfTheSameName.ts, 2, 18)) toCarth(): Point; ->toCarth : Symbol(toCarth, Decl(TwoInternalModulesThatMergeEachWithExportedAndNonExportedInterfacesOfTheSameName.ts, 3, 18)) +>toCarth : Symbol(Point.toCarth, Decl(TwoInternalModulesThatMergeEachWithExportedAndNonExportedInterfacesOfTheSameName.ts, 3, 18)) >Point : Symbol(Point, Decl(TwoInternalModulesThatMergeEachWithExportedAndNonExportedInterfacesOfTheSameName.ts, 0, 10)) } } @@ -24,7 +24,7 @@ module A { >Point : Symbol(Point, Decl(TwoInternalModulesThatMergeEachWithExportedAndNonExportedInterfacesOfTheSameName.ts, 8, 10)) fromCarth(): Point; ->fromCarth : Symbol(fromCarth, Decl(TwoInternalModulesThatMergeEachWithExportedAndNonExportedInterfacesOfTheSameName.ts, 9, 21)) +>fromCarth : Symbol(Point.fromCarth, Decl(TwoInternalModulesThatMergeEachWithExportedAndNonExportedInterfacesOfTheSameName.ts, 9, 21)) >Point : Symbol(Point, Decl(TwoInternalModulesThatMergeEachWithExportedAndNonExportedInterfacesOfTheSameName.ts, 8, 10)) } } @@ -72,12 +72,12 @@ module X { >Line : Symbol(Line, Decl(TwoInternalModulesThatMergeEachWithExportedAndNonExportedInterfacesOfTheSameName.ts, 25, 23)) start: A.Point; ->start : Symbol(start, Decl(TwoInternalModulesThatMergeEachWithExportedAndNonExportedInterfacesOfTheSameName.ts, 26, 24)) +>start : Symbol(Line.start, Decl(TwoInternalModulesThatMergeEachWithExportedAndNonExportedInterfacesOfTheSameName.ts, 26, 24)) >A : Symbol(A, Decl(TwoInternalModulesThatMergeEachWithExportedAndNonExportedInterfacesOfTheSameName.ts, 0, 0), Decl(TwoInternalModulesThatMergeEachWithExportedAndNonExportedInterfacesOfTheSameName.ts, 6, 1)) >Point : Symbol(A.Point, Decl(TwoInternalModulesThatMergeEachWithExportedAndNonExportedInterfacesOfTheSameName.ts, 0, 10)) end: A.Point; ->end : Symbol(end, Decl(TwoInternalModulesThatMergeEachWithExportedAndNonExportedInterfacesOfTheSameName.ts, 27, 27)) +>end : Symbol(Line.end, Decl(TwoInternalModulesThatMergeEachWithExportedAndNonExportedInterfacesOfTheSameName.ts, 27, 27)) >A : Symbol(A, Decl(TwoInternalModulesThatMergeEachWithExportedAndNonExportedInterfacesOfTheSameName.ts, 0, 0), Decl(TwoInternalModulesThatMergeEachWithExportedAndNonExportedInterfacesOfTheSameName.ts, 6, 1)) >Point : Symbol(A.Point, Decl(TwoInternalModulesThatMergeEachWithExportedAndNonExportedInterfacesOfTheSameName.ts, 0, 10)) } diff --git a/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedAndNonExportedLocalVarsOfTheSameName.symbols b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedAndNonExportedLocalVarsOfTheSameName.symbols index b7402952dff..a9de1388dcd 100644 --- a/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedAndNonExportedLocalVarsOfTheSameName.symbols +++ b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedAndNonExportedLocalVarsOfTheSameName.symbols @@ -6,10 +6,10 @@ module A { >Point : Symbol(Point, Decl(part1.ts, 0, 10)) x: number; ->x : Symbol(x, Decl(part1.ts, 1, 28)) +>x : Symbol(Point.x, Decl(part1.ts, 1, 28)) y: number; ->y : Symbol(y, Decl(part1.ts, 2, 18)) +>y : Symbol(Point.y, Decl(part1.ts, 2, 18)) } export module Utils { @@ -55,9 +55,9 @@ module A { >Plane : Symbol(Plane, Decl(part2.ts, 4, 25)) constructor(public tl: Point, public br: Point) { } ->tl : Symbol(tl, Decl(part2.ts, 6, 24)) +>tl : Symbol(Plane.tl, Decl(part2.ts, 6, 24)) >Point : Symbol(Point, Decl(part1.ts, 0, 10)) ->br : Symbol(br, Decl(part2.ts, 6, 41)) +>br : Symbol(Plane.br, Decl(part2.ts, 6, 41)) >Point : Symbol(Point, Decl(part1.ts, 0, 10)) } } diff --git a/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedInterfacesOfTheSameName.symbols b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedInterfacesOfTheSameName.symbols index 3e8fa64501f..ba0d0a1888d 100644 --- a/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedInterfacesOfTheSameName.symbols +++ b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedInterfacesOfTheSameName.symbols @@ -6,13 +6,13 @@ module A { >Point : Symbol(Point, Decl(TwoInternalModulesThatMergeEachWithExportedInterfacesOfTheSameName.ts, 0, 10), Decl(TwoInternalModulesThatMergeEachWithExportedInterfacesOfTheSameName.ts, 8, 10)) x: number; ->x : Symbol(x, Decl(TwoInternalModulesThatMergeEachWithExportedInterfacesOfTheSameName.ts, 1, 28)) +>x : Symbol(Point.x, Decl(TwoInternalModulesThatMergeEachWithExportedInterfacesOfTheSameName.ts, 1, 28)) y: number; ->y : Symbol(y, Decl(TwoInternalModulesThatMergeEachWithExportedInterfacesOfTheSameName.ts, 2, 18)) +>y : Symbol(Point.y, Decl(TwoInternalModulesThatMergeEachWithExportedInterfacesOfTheSameName.ts, 2, 18)) toCarth(): Point; ->toCarth : Symbol(toCarth, Decl(TwoInternalModulesThatMergeEachWithExportedInterfacesOfTheSameName.ts, 3, 18)) +>toCarth : Symbol(Point.toCarth, Decl(TwoInternalModulesThatMergeEachWithExportedInterfacesOfTheSameName.ts, 3, 18)) >Point : Symbol(Point, Decl(TwoInternalModulesThatMergeEachWithExportedInterfacesOfTheSameName.ts, 0, 10), Decl(TwoInternalModulesThatMergeEachWithExportedInterfacesOfTheSameName.ts, 8, 10)) } } @@ -24,7 +24,7 @@ module A { >Point : Symbol(Point, Decl(TwoInternalModulesThatMergeEachWithExportedInterfacesOfTheSameName.ts, 0, 10), Decl(TwoInternalModulesThatMergeEachWithExportedInterfacesOfTheSameName.ts, 8, 10)) fromCarth(): Point; ->fromCarth : Symbol(fromCarth, Decl(TwoInternalModulesThatMergeEachWithExportedInterfacesOfTheSameName.ts, 9, 28)) +>fromCarth : Symbol(Point.fromCarth, Decl(TwoInternalModulesThatMergeEachWithExportedInterfacesOfTheSameName.ts, 9, 28)) >Point : Symbol(Point, Decl(TwoInternalModulesThatMergeEachWithExportedInterfacesOfTheSameName.ts, 0, 10), Decl(TwoInternalModulesThatMergeEachWithExportedInterfacesOfTheSameName.ts, 8, 10)) } } @@ -75,12 +75,12 @@ module X { >Line : Symbol(Line, Decl(TwoInternalModulesThatMergeEachWithExportedInterfacesOfTheSameName.ts, 18, 14), Decl(TwoInternalModulesThatMergeEachWithExportedInterfacesOfTheSameName.ts, 25, 23)) start: A.Point; ->start : Symbol(start, Decl(TwoInternalModulesThatMergeEachWithExportedInterfacesOfTheSameName.ts, 26, 31)) +>start : Symbol(Line.start, Decl(TwoInternalModulesThatMergeEachWithExportedInterfacesOfTheSameName.ts, 26, 31)) >A : Symbol(A, Decl(TwoInternalModulesThatMergeEachWithExportedInterfacesOfTheSameName.ts, 0, 0), Decl(TwoInternalModulesThatMergeEachWithExportedInterfacesOfTheSameName.ts, 6, 1)) >Point : Symbol(A.Point, Decl(TwoInternalModulesThatMergeEachWithExportedInterfacesOfTheSameName.ts, 0, 10), Decl(TwoInternalModulesThatMergeEachWithExportedInterfacesOfTheSameName.ts, 8, 10)) end: A.Point; ->end : Symbol(end, Decl(TwoInternalModulesThatMergeEachWithExportedInterfacesOfTheSameName.ts, 27, 27)) +>end : Symbol(Line.end, Decl(TwoInternalModulesThatMergeEachWithExportedInterfacesOfTheSameName.ts, 27, 27)) >A : Symbol(A, Decl(TwoInternalModulesThatMergeEachWithExportedInterfacesOfTheSameName.ts, 0, 0), Decl(TwoInternalModulesThatMergeEachWithExportedInterfacesOfTheSameName.ts, 6, 1)) >Point : Symbol(A.Point, Decl(TwoInternalModulesThatMergeEachWithExportedInterfacesOfTheSameName.ts, 0, 10), Decl(TwoInternalModulesThatMergeEachWithExportedInterfacesOfTheSameName.ts, 8, 10)) } diff --git a/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedLocalVarsOfTheSameName.errors.txt b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedLocalVarsOfTheSameName.errors.txt index e46805a6a2f..fd048a987a4 100644 --- a/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedLocalVarsOfTheSameName.errors.txt +++ b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedLocalVarsOfTheSameName.errors.txt @@ -1,13 +1,10 @@ -tests/cases/conformance/internalModules/DeclarationMerging/part1.ts(1,15): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/conformance/internalModules/DeclarationMerging/part2.ts(3,24): error TS2304: Cannot find name 'Point'. tests/cases/conformance/internalModules/DeclarationMerging/part2.ts(7,36): error TS2304: Cannot find name 'Point'. tests/cases/conformance/internalModules/DeclarationMerging/part2.ts(7,54): error TS2304: Cannot find name 'Point'. -==== tests/cases/conformance/internalModules/DeclarationMerging/part1.ts (1 errors) ==== +==== tests/cases/conformance/internalModules/DeclarationMerging/part1.ts (0 errors) ==== export module A { - ~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. export interface Point { x: number; y: number; diff --git a/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedModulesOfTheSameName.symbols b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedModulesOfTheSameName.symbols index e8187771695..bf8fd1dc48d 100644 --- a/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedModulesOfTheSameName.symbols +++ b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedModulesOfTheSameName.symbols @@ -39,7 +39,7 @@ module X.Y.Z { >Line : Symbol(Line, Decl(TwoInternalModulesThatMergeEachWithExportedModulesOfTheSameName.ts, 14, 14)) length: number; ->length : Symbol(length, Decl(TwoInternalModulesThatMergeEachWithExportedModulesOfTheSameName.ts, 15, 23)) +>length : Symbol(Line.length, Decl(TwoInternalModulesThatMergeEachWithExportedModulesOfTheSameName.ts, 15, 23)) } } @@ -56,7 +56,7 @@ module X { >Line : Symbol(Line, Decl(TwoInternalModulesThatMergeEachWithExportedModulesOfTheSameName.ts, 22, 18)) name: string; ->name : Symbol(name, Decl(TwoInternalModulesThatMergeEachWithExportedModulesOfTheSameName.ts, 23, 31)) +>name : Symbol(Line.name, Decl(TwoInternalModulesThatMergeEachWithExportedModulesOfTheSameName.ts, 23, 31)) } } } diff --git a/tests/baselines/reference/TwoInternalModulesWithTheSameNameAndDifferentCommonRoot.symbols b/tests/baselines/reference/TwoInternalModulesWithTheSameNameAndDifferentCommonRoot.symbols index 5c533273fa6..c76da99ac42 100644 --- a/tests/baselines/reference/TwoInternalModulesWithTheSameNameAndDifferentCommonRoot.symbols +++ b/tests/baselines/reference/TwoInternalModulesWithTheSameNameAndDifferentCommonRoot.symbols @@ -9,10 +9,10 @@ module Root { >Point : Symbol(Point, Decl(part1.ts, 1, 21)) x: number; ->x : Symbol(x, Decl(part1.ts, 2, 32)) +>x : Symbol(Point.x, Decl(part1.ts, 2, 32)) y: number; ->y : Symbol(y, Decl(part1.ts, 3, 22)) +>y : Symbol(Point.y, Decl(part1.ts, 3, 22)) } export module Utils { @@ -62,11 +62,11 @@ module otherRoot { >Plane : Symbol(Plane, Decl(part2.ts, 5, 29)) constructor(public tl: Root.A.Point, public br: Root.A.Point) { } ->tl : Symbol(tl, Decl(part2.ts, 7, 28)) +>tl : Symbol(Plane.tl, Decl(part2.ts, 7, 28)) >Root : Symbol(Root, Decl(part1.ts, 0, 0)) >A : Symbol(Root.A, Decl(part1.ts, 0, 13)) >Point : Symbol(Root.A.Point, Decl(part1.ts, 1, 21)) ->br : Symbol(br, Decl(part2.ts, 7, 52)) +>br : Symbol(Plane.br, Decl(part2.ts, 7, 52)) >Root : Symbol(Root, Decl(part1.ts, 0, 0)) >A : Symbol(Root.A, Decl(part1.ts, 0, 13)) >Point : Symbol(Root.A.Point, Decl(part1.ts, 1, 21)) diff --git a/tests/baselines/reference/TwoInternalModulesWithTheSameNameAndSameCommonRoot.symbols b/tests/baselines/reference/TwoInternalModulesWithTheSameNameAndSameCommonRoot.symbols index 34abd4ecd65..ada4d20c0be 100644 --- a/tests/baselines/reference/TwoInternalModulesWithTheSameNameAndSameCommonRoot.symbols +++ b/tests/baselines/reference/TwoInternalModulesWithTheSameNameAndSameCommonRoot.symbols @@ -6,10 +6,10 @@ module A { >Point : Symbol(Point, Decl(part1.ts, 0, 10)) x: number; ->x : Symbol(x, Decl(part1.ts, 1, 28)) +>x : Symbol(Point.x, Decl(part1.ts, 1, 28)) y: number; ->y : Symbol(y, Decl(part1.ts, 2, 18)) +>y : Symbol(Point.y, Decl(part1.ts, 2, 18)) } export module Utils { @@ -52,9 +52,9 @@ module A { >Plane : Symbol(Plane, Decl(part2.ts, 3, 25)) constructor(public tl: Point, public br: Point) { } ->tl : Symbol(tl, Decl(part2.ts, 5, 24)) +>tl : Symbol(Plane.tl, Decl(part2.ts, 5, 24)) >Point : Symbol(Point, Decl(part1.ts, 0, 10)) ->br : Symbol(br, Decl(part2.ts, 5, 41)) +>br : Symbol(Plane.br, Decl(part2.ts, 5, 41)) >Point : Symbol(Point, Decl(part1.ts, 0, 10)) } } diff --git a/tests/baselines/reference/TypeGuardWithArrayUnion.symbols b/tests/baselines/reference/TypeGuardWithArrayUnion.symbols index 2ff91774b83..38d1dcf3e0a 100644 --- a/tests/baselines/reference/TypeGuardWithArrayUnion.symbols +++ b/tests/baselines/reference/TypeGuardWithArrayUnion.symbols @@ -3,7 +3,7 @@ class Message { >Message : Symbol(Message, Decl(TypeGuardWithArrayUnion.ts, 0, 0)) value: string; ->value : Symbol(value, Decl(TypeGuardWithArrayUnion.ts, 0, 15)) +>value : Symbol(Message.value, Decl(TypeGuardWithArrayUnion.ts, 0, 15)) } function saySize(message: Message | Message[]) { diff --git a/tests/baselines/reference/TypeGuardWithEnumUnion.types b/tests/baselines/reference/TypeGuardWithEnumUnion.types index 453ec220f02..05d55cb0dbb 100644 --- a/tests/baselines/reference/TypeGuardWithEnumUnion.types +++ b/tests/baselines/reference/TypeGuardWithEnumUnion.types @@ -55,7 +55,7 @@ function f2(x: Color | string | string[]) { if (typeof x === "number") { >typeof x === "number" : boolean >typeof x : string ->x : Color | string | string[] +>x : string[] | Color | string >"number" : string var z = x; @@ -68,16 +68,16 @@ function f2(x: Color | string | string[]) { } else { var w = x; ->w : string | string[] ->x : string | string[] +>w : string[] | string +>x : string[] | string var w: string | string[]; ->w : string | string[] +>w : string[] | string } if (typeof x === "string") { >typeof x === "string" : boolean >typeof x : string ->x : Color | string | string[] +>x : Color | string[] | string >"string" : string var a = x; diff --git a/tests/baselines/reference/VariableDeclaration12_es6.js b/tests/baselines/reference/VariableDeclaration12_es6.js new file mode 100644 index 00000000000..1e7d6d4b363 --- /dev/null +++ b/tests/baselines/reference/VariableDeclaration12_es6.js @@ -0,0 +1,7 @@ +//// [VariableDeclaration12_es6.ts] + +let +x + +//// [VariableDeclaration12_es6.js] +let x; diff --git a/tests/baselines/reference/VariableDeclaration12_es6.symbols b/tests/baselines/reference/VariableDeclaration12_es6.symbols new file mode 100644 index 00000000000..a2f324502dd --- /dev/null +++ b/tests/baselines/reference/VariableDeclaration12_es6.symbols @@ -0,0 +1,6 @@ +=== tests/cases/conformance/es6/variableDeclarations/VariableDeclaration12_es6.ts === + +let +x +>x : Symbol(x, Decl(VariableDeclaration12_es6.ts, 1, 3)) + diff --git a/tests/baselines/reference/VariableDeclaration12_es6.types b/tests/baselines/reference/VariableDeclaration12_es6.types new file mode 100644 index 00000000000..14f23f88a7a --- /dev/null +++ b/tests/baselines/reference/VariableDeclaration12_es6.types @@ -0,0 +1,6 @@ +=== tests/cases/conformance/es6/variableDeclarations/VariableDeclaration12_es6.ts === + +let +x +>x : any + diff --git a/tests/baselines/reference/VariableDeclaration13_es6.errors.txt b/tests/baselines/reference/VariableDeclaration13_es6.errors.txt new file mode 100644 index 00000000000..a022a4ad52b --- /dev/null +++ b/tests/baselines/reference/VariableDeclaration13_es6.errors.txt @@ -0,0 +1,20 @@ +tests/cases/conformance/es6/variableDeclarations/VariableDeclaration13_es6.ts(5,5): error TS1181: Array element destructuring pattern expected. +tests/cases/conformance/es6/variableDeclarations/VariableDeclaration13_es6.ts(5,6): error TS1005: ',' expected. +tests/cases/conformance/es6/variableDeclarations/VariableDeclaration13_es6.ts(5,8): error TS1134: Variable declaration expected. +tests/cases/conformance/es6/variableDeclarations/VariableDeclaration13_es6.ts(5,10): error TS1134: Variable declaration expected. + + +==== tests/cases/conformance/es6/variableDeclarations/VariableDeclaration13_es6.ts (4 errors) ==== + + // An ExpressionStatement cannot start with the two token sequence `let [` because + // that would make it ambiguous with a `let` LexicalDeclaration whose first LexicalBinding was an ArrayBindingPattern. + var let: any; + let[0] = 100; + ~ +!!! error TS1181: Array element destructuring pattern expected. + ~ +!!! error TS1005: ',' expected. + ~ +!!! error TS1134: Variable declaration expected. + ~~~ +!!! error TS1134: Variable declaration expected. \ No newline at end of file diff --git a/tests/baselines/reference/VariableDeclaration13_es6.js b/tests/baselines/reference/VariableDeclaration13_es6.js new file mode 100644 index 00000000000..4ec04b18c3a --- /dev/null +++ b/tests/baselines/reference/VariableDeclaration13_es6.js @@ -0,0 +1,13 @@ +//// [VariableDeclaration13_es6.ts] + +// An ExpressionStatement cannot start with the two token sequence `let [` because +// that would make it ambiguous with a `let` LexicalDeclaration whose first LexicalBinding was an ArrayBindingPattern. +var let: any; +let[0] = 100; + +//// [VariableDeclaration13_es6.js] +// An ExpressionStatement cannot start with the two token sequence `let [` because +// that would make it ambiguous with a `let` LexicalDeclaration whose first LexicalBinding was an ArrayBindingPattern. +var let; +let [] = 0; +100; diff --git a/tests/baselines/reference/YieldExpression11_es6.errors.txt b/tests/baselines/reference/YieldExpression11_es6.errors.txt index c19e8b6cfa5..1b0c08bd79a 100644 --- a/tests/baselines/reference/YieldExpression11_es6.errors.txt +++ b/tests/baselines/reference/YieldExpression11_es6.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/es6/yieldExpressions/YieldExpression11_es6.ts(2,3): error TS1220: Generators are only available when targeting ECMAScript 6 or higher. -tests/cases/conformance/es6/yieldExpressions/YieldExpression11_es6.ts(3,11): error TS2304: Cannot find name 'foo'. +tests/cases/conformance/es6/yieldExpressions/YieldExpression11_es6.ts(3,11): error TS2663: Cannot find name 'foo'. Did you mean the instance member 'this.foo'? ==== tests/cases/conformance/es6/yieldExpressions/YieldExpression11_es6.ts (2 errors) ==== @@ -9,6 +9,6 @@ tests/cases/conformance/es6/yieldExpressions/YieldExpression11_es6.ts(3,11): err !!! error TS1220: Generators are only available when targeting ECMAScript 6 or higher. yield(foo); ~~~ -!!! error TS2304: Cannot find name 'foo'. +!!! error TS2663: Cannot find name 'foo'. Did you mean the instance member 'this.foo'? } } \ No newline at end of file diff --git a/tests/baselines/reference/abstractInterfaceIdentifierName.symbols b/tests/baselines/reference/abstractInterfaceIdentifierName.symbols index c70cdec8ac9..29a1a361894 100644 --- a/tests/baselines/reference/abstractInterfaceIdentifierName.symbols +++ b/tests/baselines/reference/abstractInterfaceIdentifierName.symbols @@ -4,6 +4,6 @@ interface abstract { >abstract : Symbol(abstract, Decl(abstractInterfaceIdentifierName.ts, 0, 0)) abstract(): void; ->abstract : Symbol(abstract, Decl(abstractInterfaceIdentifierName.ts, 1, 20)) +>abstract : Symbol(abstract.abstract, Decl(abstractInterfaceIdentifierName.ts, 1, 20)) } diff --git a/tests/baselines/reference/abstractProperty.js b/tests/baselines/reference/abstractProperty.js new file mode 100644 index 00000000000..9564be862dc --- /dev/null +++ b/tests/baselines/reference/abstractProperty.js @@ -0,0 +1,56 @@ +//// [abstractProperty.ts] +interface A { + prop: string; + raw: string; + m(): void; +} +abstract class B implements A { + abstract prop: string; + abstract raw: string; + abstract readonly ro: string; + abstract get readonlyProp(): string; + abstract set readonlyProp(val: string); + abstract m(): void; +} +class C extends B { + get prop() { return "foo"; } + set prop(v) { } + raw = "edge"; + readonly ro = "readonly please"; + readonlyProp: string; // don't have to give a value, in fact + m() { } +} + +//// [abstractProperty.js] +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var B = (function () { + function B() { + } + Object.defineProperty(B.prototype, "readonlyProp", { + get: function () { }, + set: function (val) { }, + enumerable: true, + configurable: true + }); + return B; +}()); +var C = (function (_super) { + __extends(C, _super); + function C() { + _super.apply(this, arguments); + this.raw = "edge"; + this.ro = "readonly please"; + } + Object.defineProperty(C.prototype, "prop", { + get: function () { return "foo"; }, + set: function (v) { }, + enumerable: true, + configurable: true + }); + C.prototype.m = function () { }; + return C; +}(B)); diff --git a/tests/baselines/reference/abstractProperty.symbols b/tests/baselines/reference/abstractProperty.symbols new file mode 100644 index 00000000000..3c69af4ffe9 --- /dev/null +++ b/tests/baselines/reference/abstractProperty.symbols @@ -0,0 +1,59 @@ +=== tests/cases/compiler/abstractProperty.ts === +interface A { +>A : Symbol(A, Decl(abstractProperty.ts, 0, 0)) + + prop: string; +>prop : Symbol(A.prop, Decl(abstractProperty.ts, 0, 13)) + + raw: string; +>raw : Symbol(A.raw, Decl(abstractProperty.ts, 1, 17)) + + m(): void; +>m : Symbol(A.m, Decl(abstractProperty.ts, 2, 16)) +} +abstract class B implements A { +>B : Symbol(B, Decl(abstractProperty.ts, 4, 1)) +>A : Symbol(A, Decl(abstractProperty.ts, 0, 0)) + + abstract prop: string; +>prop : Symbol(B.prop, Decl(abstractProperty.ts, 5, 31)) + + abstract raw: string; +>raw : Symbol(B.raw, Decl(abstractProperty.ts, 6, 26)) + + abstract readonly ro: string; +>ro : Symbol(B.ro, Decl(abstractProperty.ts, 7, 25)) + + abstract get readonlyProp(): string; +>readonlyProp : Symbol(B.readonlyProp, Decl(abstractProperty.ts, 8, 33), Decl(abstractProperty.ts, 9, 40)) + + abstract set readonlyProp(val: string); +>readonlyProp : Symbol(B.readonlyProp, Decl(abstractProperty.ts, 8, 33), Decl(abstractProperty.ts, 9, 40)) +>val : Symbol(val, Decl(abstractProperty.ts, 10, 30)) + + abstract m(): void; +>m : Symbol(B.m, Decl(abstractProperty.ts, 10, 43)) +} +class C extends B { +>C : Symbol(C, Decl(abstractProperty.ts, 12, 1)) +>B : Symbol(B, Decl(abstractProperty.ts, 4, 1)) + + get prop() { return "foo"; } +>prop : Symbol(C.prop, Decl(abstractProperty.ts, 13, 19), Decl(abstractProperty.ts, 14, 32)) + + set prop(v) { } +>prop : Symbol(C.prop, Decl(abstractProperty.ts, 13, 19), Decl(abstractProperty.ts, 14, 32)) +>v : Symbol(v, Decl(abstractProperty.ts, 15, 13)) + + raw = "edge"; +>raw : Symbol(C.raw, Decl(abstractProperty.ts, 15, 19)) + + readonly ro = "readonly please"; +>ro : Symbol(C.ro, Decl(abstractProperty.ts, 16, 17)) + + readonlyProp: string; // don't have to give a value, in fact +>readonlyProp : Symbol(C.readonlyProp, Decl(abstractProperty.ts, 17, 36)) + + m() { } +>m : Symbol(C.m, Decl(abstractProperty.ts, 18, 25)) +} diff --git a/tests/baselines/reference/abstractProperty.types b/tests/baselines/reference/abstractProperty.types new file mode 100644 index 00000000000..b6aff9356cd --- /dev/null +++ b/tests/baselines/reference/abstractProperty.types @@ -0,0 +1,62 @@ +=== tests/cases/compiler/abstractProperty.ts === +interface A { +>A : A + + prop: string; +>prop : string + + raw: string; +>raw : string + + m(): void; +>m : () => void +} +abstract class B implements A { +>B : B +>A : A + + abstract prop: string; +>prop : string + + abstract raw: string; +>raw : string + + abstract readonly ro: string; +>ro : string + + abstract get readonlyProp(): string; +>readonlyProp : string + + abstract set readonlyProp(val: string); +>readonlyProp : string +>val : string + + abstract m(): void; +>m : () => void +} +class C extends B { +>C : C +>B : B + + get prop() { return "foo"; } +>prop : string +>"foo" : string + + set prop(v) { } +>prop : string +>v : string + + raw = "edge"; +>raw : string +>"edge" : string + + readonly ro = "readonly please"; +>ro : string +>"readonly please" : string + + readonlyProp: string; // don't have to give a value, in fact +>readonlyProp : string + + m() { } +>m : () => void +} diff --git a/tests/baselines/reference/abstractPropertyNegative.errors.txt b/tests/baselines/reference/abstractPropertyNegative.errors.txt new file mode 100644 index 00000000000..448fb2255e0 --- /dev/null +++ b/tests/baselines/reference/abstractPropertyNegative.errors.txt @@ -0,0 +1,106 @@ +tests/cases/compiler/abstractPropertyNegative.ts(10,18): error TS2380: 'get' and 'set' accessor must have the same type. +tests/cases/compiler/abstractPropertyNegative.ts(11,18): error TS2380: 'get' and 'set' accessor must have the same type. +tests/cases/compiler/abstractPropertyNegative.ts(13,7): error TS2515: Non-abstract class 'C' does not implement inherited abstract member 'm' from class 'B'. +tests/cases/compiler/abstractPropertyNegative.ts(13,7): error TS2515: Non-abstract class 'C' does not implement inherited abstract member 'mismatch' from class 'B'. +tests/cases/compiler/abstractPropertyNegative.ts(13,7): error TS2515: Non-abstract class 'C' does not implement inherited abstract member 'prop' from class 'B'. +tests/cases/compiler/abstractPropertyNegative.ts(13,7): error TS2515: Non-abstract class 'C' does not implement inherited abstract member 'readonlyProp' from class 'B'. +tests/cases/compiler/abstractPropertyNegative.ts(15,5): error TS1244: Abstract methods can only appear within an abstract class. +tests/cases/compiler/abstractPropertyNegative.ts(16,37): error TS1005: '{' expected. +tests/cases/compiler/abstractPropertyNegative.ts(19,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. +tests/cases/compiler/abstractPropertyNegative.ts(24,7): error TS2415: Class 'WrongTypePropertyImpl' incorrectly extends base class 'WrongTypeProperty'. + Types of property 'num' are incompatible. + Type 'string' is not assignable to type 'number'. +tests/cases/compiler/abstractPropertyNegative.ts(30,7): error TS2415: Class 'WrongTypeAccessorImpl' incorrectly extends base class 'WrongTypeAccessor'. + Types of property 'num' are incompatible. + Type 'string' is not assignable to type 'number'. +tests/cases/compiler/abstractPropertyNegative.ts(33,7): error TS2415: Class 'WrongTypeAccessorImpl2' incorrectly extends base class 'WrongTypeAccessor'. + Types of property 'num' are incompatible. + Type 'string' is not assignable to type 'number'. +tests/cases/compiler/abstractPropertyNegative.ts(38,18): error TS2676: Accessors must both be abstract or non-abstract. +tests/cases/compiler/abstractPropertyNegative.ts(39,9): error TS2676: Accessors must both be abstract or non-abstract. +tests/cases/compiler/abstractPropertyNegative.ts(40,9): error TS2676: Accessors must both be abstract or non-abstract. +tests/cases/compiler/abstractPropertyNegative.ts(41,18): error TS2676: Accessors must both be abstract or non-abstract. + + +==== tests/cases/compiler/abstractPropertyNegative.ts (16 errors) ==== + interface A { + prop: string; + m(): string; + } + abstract class B implements A { + abstract prop: string; + public abstract readonly ro: string; + abstract get readonlyProp(): string; + abstract m(): string; + abstract get mismatch(): string; + ~~~~~~~~ +!!! error TS2380: 'get' and 'set' accessor must have the same type. + abstract set mismatch(val: number); // error, not same type + ~~~~~~~~ +!!! error TS2380: 'get' and 'set' accessor must have the same type. + } + class C extends B { + ~ +!!! error TS2515: Non-abstract class 'C' does not implement inherited abstract member 'm' from class 'B'. + ~ +!!! error TS2515: Non-abstract class 'C' does not implement inherited abstract member 'mismatch' from class 'B'. + ~ +!!! error TS2515: Non-abstract class 'C' does not implement inherited abstract member 'prop' from class 'B'. + ~ +!!! error TS2515: Non-abstract class 'C' does not implement inherited abstract member 'readonlyProp' from class 'B'. + readonly ro = "readonly please"; + abstract notAllowed: string; + ~~~~~~~~ +!!! error TS1244: Abstract methods can only appear within an abstract class. + get concreteWithNoBody(): string; + ~ +!!! error TS1005: '{' expected. + } + let c = new C(); + c.ro = "error: lhs of assignment can't be readonly"; + ~~~~ +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. + + abstract class WrongTypeProperty { + abstract num: number; + } + class WrongTypePropertyImpl extends WrongTypeProperty { + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2415: Class 'WrongTypePropertyImpl' incorrectly extends base class 'WrongTypeProperty'. +!!! error TS2415: Types of property 'num' are incompatible. +!!! error TS2415: Type 'string' is not assignable to type 'number'. + num = "nope, wrong"; + } + abstract class WrongTypeAccessor { + abstract get num(): number; + } + class WrongTypeAccessorImpl extends WrongTypeAccessor { + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2415: Class 'WrongTypeAccessorImpl' incorrectly extends base class 'WrongTypeAccessor'. +!!! error TS2415: Types of property 'num' are incompatible. +!!! error TS2415: Type 'string' is not assignable to type 'number'. + get num() { return "nope, wrong"; } + } + class WrongTypeAccessorImpl2 extends WrongTypeAccessor { + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2415: Class 'WrongTypeAccessorImpl2' incorrectly extends base class 'WrongTypeAccessor'. +!!! error TS2415: Types of property 'num' are incompatible. +!!! error TS2415: Type 'string' is not assignable to type 'number'. + num = "nope, wrong"; + } + + abstract class AbstractAccessorMismatch { + abstract get p1(): string; + ~~ +!!! error TS2676: Accessors must both be abstract or non-abstract. + set p1(val: string) { }; + ~~ +!!! error TS2676: Accessors must both be abstract or non-abstract. + get p2(): string { return "should work"; } + ~~ +!!! error TS2676: Accessors must both be abstract or non-abstract. + abstract set p2(val: string); + ~~ +!!! error TS2676: Accessors must both be abstract or non-abstract. + } + \ No newline at end of file diff --git a/tests/baselines/reference/abstractPropertyNegative.js b/tests/baselines/reference/abstractPropertyNegative.js new file mode 100644 index 00000000000..55c9aea9411 --- /dev/null +++ b/tests/baselines/reference/abstractPropertyNegative.js @@ -0,0 +1,144 @@ +//// [abstractPropertyNegative.ts] +interface A { + prop: string; + m(): string; +} +abstract class B implements A { + abstract prop: string; + public abstract readonly ro: string; + abstract get readonlyProp(): string; + abstract m(): string; + abstract get mismatch(): string; + abstract set mismatch(val: number); // error, not same type +} +class C extends B { + readonly ro = "readonly please"; + abstract notAllowed: string; + get concreteWithNoBody(): string; +} +let c = new C(); +c.ro = "error: lhs of assignment can't be readonly"; + +abstract class WrongTypeProperty { + abstract num: number; +} +class WrongTypePropertyImpl extends WrongTypeProperty { + num = "nope, wrong"; +} +abstract class WrongTypeAccessor { + abstract get num(): number; +} +class WrongTypeAccessorImpl extends WrongTypeAccessor { + get num() { return "nope, wrong"; } +} +class WrongTypeAccessorImpl2 extends WrongTypeAccessor { + num = "nope, wrong"; +} + +abstract class AbstractAccessorMismatch { + abstract get p1(): string; + set p1(val: string) { }; + get p2(): string { return "should work"; } + abstract set p2(val: string); +} + + +//// [abstractPropertyNegative.js] +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var B = (function () { + function B() { + } + Object.defineProperty(B.prototype, "readonlyProp", { + get: function () { }, + enumerable: true, + configurable: true + }); + Object.defineProperty(B.prototype, "mismatch", { + get: function () { }, + set: function (val) { } // error, not same type + , + enumerable: true, + configurable: true + }); + return B; +}()); +var C = (function (_super) { + __extends(C, _super); + function C() { + _super.apply(this, arguments); + this.ro = "readonly please"; + } + Object.defineProperty(C.prototype, "concreteWithNoBody", { + get: function () { }, + enumerable: true, + configurable: true + }); + return C; +}(B)); +var c = new C(); +c.ro = "error: lhs of assignment can't be readonly"; +var WrongTypeProperty = (function () { + function WrongTypeProperty() { + } + return WrongTypeProperty; +}()); +var WrongTypePropertyImpl = (function (_super) { + __extends(WrongTypePropertyImpl, _super); + function WrongTypePropertyImpl() { + _super.apply(this, arguments); + this.num = "nope, wrong"; + } + return WrongTypePropertyImpl; +}(WrongTypeProperty)); +var WrongTypeAccessor = (function () { + function WrongTypeAccessor() { + } + Object.defineProperty(WrongTypeAccessor.prototype, "num", { + get: function () { }, + enumerable: true, + configurable: true + }); + return WrongTypeAccessor; +}()); +var WrongTypeAccessorImpl = (function (_super) { + __extends(WrongTypeAccessorImpl, _super); + function WrongTypeAccessorImpl() { + _super.apply(this, arguments); + } + Object.defineProperty(WrongTypeAccessorImpl.prototype, "num", { + get: function () { return "nope, wrong"; }, + enumerable: true, + configurable: true + }); + return WrongTypeAccessorImpl; +}(WrongTypeAccessor)); +var WrongTypeAccessorImpl2 = (function (_super) { + __extends(WrongTypeAccessorImpl2, _super); + function WrongTypeAccessorImpl2() { + _super.apply(this, arguments); + this.num = "nope, wrong"; + } + return WrongTypeAccessorImpl2; +}(WrongTypeAccessor)); +var AbstractAccessorMismatch = (function () { + function AbstractAccessorMismatch() { + } + Object.defineProperty(AbstractAccessorMismatch.prototype, "p1", { + get: function () { }, + set: function (val) { }, + enumerable: true, + configurable: true + }); + ; + Object.defineProperty(AbstractAccessorMismatch.prototype, "p2", { + get: function () { return "should work"; }, + set: function (val) { }, + enumerable: true, + configurable: true + }); + return AbstractAccessorMismatch; +}()); diff --git a/tests/baselines/reference/accessInstanceMemberFromStaticMethod01.errors.txt b/tests/baselines/reference/accessInstanceMemberFromStaticMethod01.errors.txt new file mode 100644 index 00000000000..0ce9c614618 --- /dev/null +++ b/tests/baselines/reference/accessInstanceMemberFromStaticMethod01.errors.txt @@ -0,0 +1,13 @@ +tests/cases/compiler/accessInstanceMemberFromStaticMethod01.ts(5,17): error TS2662: Cannot find name 'foo'. Did you mean the static member 'C.foo'? + + +==== tests/cases/compiler/accessInstanceMemberFromStaticMethod01.ts (1 errors) ==== + class C { + static foo: string; + + bar() { + let k = foo; + ~~~ +!!! error TS2662: Cannot find name 'foo'. Did you mean the static member 'C.foo'? + } + } \ No newline at end of file diff --git a/tests/baselines/reference/accessInstanceMemberFromStaticMethod01.js b/tests/baselines/reference/accessInstanceMemberFromStaticMethod01.js new file mode 100644 index 00000000000..763be0568dc --- /dev/null +++ b/tests/baselines/reference/accessInstanceMemberFromStaticMethod01.js @@ -0,0 +1,18 @@ +//// [accessInstanceMemberFromStaticMethod01.ts] +class C { + static foo: string; + + bar() { + let k = foo; + } +} + +//// [accessInstanceMemberFromStaticMethod01.js] +var C = (function () { + function C() { + } + C.prototype.bar = function () { + var k = foo; + }; + return C; +}()); diff --git a/tests/baselines/reference/accessOverriddenBaseClassMember1.symbols b/tests/baselines/reference/accessOverriddenBaseClassMember1.symbols index e5e19030afa..edcea5686e7 100644 --- a/tests/baselines/reference/accessOverriddenBaseClassMember1.symbols +++ b/tests/baselines/reference/accessOverriddenBaseClassMember1.symbols @@ -3,19 +3,19 @@ class Point { >Point : Symbol(Point, Decl(accessOverriddenBaseClassMember1.ts, 0, 0)) constructor(public x: number, public y: number) { } ->x : Symbol(x, Decl(accessOverriddenBaseClassMember1.ts, 1, 16)) ->y : Symbol(y, Decl(accessOverriddenBaseClassMember1.ts, 1, 33)) +>x : Symbol(Point.x, Decl(accessOverriddenBaseClassMember1.ts, 1, 16)) +>y : Symbol(Point.y, Decl(accessOverriddenBaseClassMember1.ts, 1, 33)) public toString() { ->toString : Symbol(toString, Decl(accessOverriddenBaseClassMember1.ts, 1, 55)) +>toString : Symbol(Point.toString, Decl(accessOverriddenBaseClassMember1.ts, 1, 55)) return "x=" + this.x + " y=" + this.y; ->this.x : Symbol(x, Decl(accessOverriddenBaseClassMember1.ts, 1, 16)) +>this.x : Symbol(Point.x, Decl(accessOverriddenBaseClassMember1.ts, 1, 16)) >this : Symbol(Point, Decl(accessOverriddenBaseClassMember1.ts, 0, 0)) ->x : Symbol(x, Decl(accessOverriddenBaseClassMember1.ts, 1, 16)) ->this.y : Symbol(y, Decl(accessOverriddenBaseClassMember1.ts, 1, 33)) +>x : Symbol(Point.x, Decl(accessOverriddenBaseClassMember1.ts, 1, 16)) +>this.y : Symbol(Point.y, Decl(accessOverriddenBaseClassMember1.ts, 1, 33)) >this : Symbol(Point, Decl(accessOverriddenBaseClassMember1.ts, 0, 0)) ->y : Symbol(y, Decl(accessOverriddenBaseClassMember1.ts, 1, 33)) +>y : Symbol(Point.y, Decl(accessOverriddenBaseClassMember1.ts, 1, 33)) } } class ColoredPoint extends Point { @@ -25,7 +25,7 @@ class ColoredPoint extends Point { constructor(x: number, y: number, public color: string) { >x : Symbol(x, Decl(accessOverriddenBaseClassMember1.ts, 7, 16)) >y : Symbol(y, Decl(accessOverriddenBaseClassMember1.ts, 7, 26)) ->color : Symbol(color, Decl(accessOverriddenBaseClassMember1.ts, 7, 37)) +>color : Symbol(ColoredPoint.color, Decl(accessOverriddenBaseClassMember1.ts, 7, 37)) super(x, y); >super : Symbol(Point, Decl(accessOverriddenBaseClassMember1.ts, 0, 0)) @@ -33,15 +33,15 @@ class ColoredPoint extends Point { >y : Symbol(y, Decl(accessOverriddenBaseClassMember1.ts, 7, 26)) } public toString() { ->toString : Symbol(toString, Decl(accessOverriddenBaseClassMember1.ts, 9, 5)) +>toString : Symbol(ColoredPoint.toString, Decl(accessOverriddenBaseClassMember1.ts, 9, 5)) return super.toString() + " color=" + this.color; >super.toString : Symbol(Point.toString, Decl(accessOverriddenBaseClassMember1.ts, 1, 55)) >super : Symbol(Point, Decl(accessOverriddenBaseClassMember1.ts, 0, 0)) >toString : Symbol(Point.toString, Decl(accessOverriddenBaseClassMember1.ts, 1, 55)) ->this.color : Symbol(color, Decl(accessOverriddenBaseClassMember1.ts, 7, 37)) +>this.color : Symbol(ColoredPoint.color, Decl(accessOverriddenBaseClassMember1.ts, 7, 37)) >this : Symbol(ColoredPoint, Decl(accessOverriddenBaseClassMember1.ts, 5, 1)) ->color : Symbol(color, Decl(accessOverriddenBaseClassMember1.ts, 7, 37)) +>color : Symbol(ColoredPoint.color, Decl(accessOverriddenBaseClassMember1.ts, 7, 37)) } } diff --git a/tests/baselines/reference/accessStaticMemberFromInstanceMethod01.errors.txt b/tests/baselines/reference/accessStaticMemberFromInstanceMethod01.errors.txt new file mode 100644 index 00000000000..612a89a1043 --- /dev/null +++ b/tests/baselines/reference/accessStaticMemberFromInstanceMethod01.errors.txt @@ -0,0 +1,13 @@ +tests/cases/compiler/accessStaticMemberFromInstanceMethod01.ts(5,17): error TS2304: Cannot find name 'foo'. + + +==== tests/cases/compiler/accessStaticMemberFromInstanceMethod01.ts (1 errors) ==== + class C { + foo: string; + + static bar() { + let k = foo; + ~~~ +!!! error TS2304: Cannot find name 'foo'. + } + } \ No newline at end of file diff --git a/tests/baselines/reference/accessStaticMemberFromInstanceMethod01.js b/tests/baselines/reference/accessStaticMemberFromInstanceMethod01.js new file mode 100644 index 00000000000..fd8ee14b2e1 --- /dev/null +++ b/tests/baselines/reference/accessStaticMemberFromInstanceMethod01.js @@ -0,0 +1,18 @@ +//// [accessStaticMemberFromInstanceMethod01.ts] +class C { + foo: string; + + static bar() { + let k = foo; + } +} + +//// [accessStaticMemberFromInstanceMethod01.js] +var C = (function () { + function C() { + } + C.bar = function () { + var k = foo; + }; + return C; +}()); diff --git a/tests/baselines/reference/accessorParameterAccessibilityModifier.errors.txt b/tests/baselines/reference/accessorParameterAccessibilityModifier.errors.txt index fad1d8ff10a..3036e734105 100644 --- a/tests/baselines/reference/accessorParameterAccessibilityModifier.errors.txt +++ b/tests/baselines/reference/accessorParameterAccessibilityModifier.errors.txt @@ -1,20 +1,14 @@ -tests/cases/compiler/accessorParameterAccessibilityModifier.ts(3,9): error TS2369: A parameter property is only allowed in a constructor implementation. tests/cases/compiler/accessorParameterAccessibilityModifier.ts(3,11): error TS2369: A parameter property is only allowed in a constructor implementation. -tests/cases/compiler/accessorParameterAccessibilityModifier.ts(4,16): error TS2369: A parameter property is only allowed in a constructor implementation. tests/cases/compiler/accessorParameterAccessibilityModifier.ts(4,18): error TS2369: A parameter property is only allowed in a constructor implementation. -==== tests/cases/compiler/accessorParameterAccessibilityModifier.ts (4 errors) ==== +==== tests/cases/compiler/accessorParameterAccessibilityModifier.ts (2 errors) ==== class C { set X(public v) { } - ~ -!!! error TS2369: A parameter property is only allowed in a constructor implementation. ~~~~~~~~ !!! error TS2369: A parameter property is only allowed in a constructor implementation. static set X(public v2) { } - ~ -!!! error TS2369: A parameter property is only allowed in a constructor implementation. ~~~~~~~~~ !!! error TS2369: A parameter property is only allowed in a constructor implementation. } \ No newline at end of file diff --git a/tests/baselines/reference/accessorWithES5.symbols b/tests/baselines/reference/accessorWithES5.symbols index dccbd8180bb..46e8d6f91da 100644 --- a/tests/baselines/reference/accessorWithES5.symbols +++ b/tests/baselines/reference/accessorWithES5.symbols @@ -4,7 +4,7 @@ class C { >C : Symbol(C, Decl(accessorWithES5.ts, 0, 0)) get x() { ->x : Symbol(x, Decl(accessorWithES5.ts, 1, 9)) +>x : Symbol(C.x, Decl(accessorWithES5.ts, 1, 9)) return 1; } @@ -14,7 +14,7 @@ class D { >D : Symbol(D, Decl(accessorWithES5.ts, 5, 1)) set x(v) { ->x : Symbol(x, Decl(accessorWithES5.ts, 7, 9)) +>x : Symbol(D.x, Decl(accessorWithES5.ts, 7, 9)) >v : Symbol(v, Decl(accessorWithES5.ts, 8, 10)) } } diff --git a/tests/baselines/reference/accessorWithES5.types b/tests/baselines/reference/accessorWithES5.types index cb54e92b184..29471548918 100644 --- a/tests/baselines/reference/accessorWithES5.types +++ b/tests/baselines/reference/accessorWithES5.types @@ -21,8 +21,8 @@ class D { } var x = { ->x : { a: number; } ->{ get a() { return 1 }} : { a: number; } +>x : { readonly a: number; } +>{ get a() { return 1 }} : { readonly a: number; } get a() { return 1 } >a : number diff --git a/tests/baselines/reference/additionOperatorWithAnyAndEveryType.symbols b/tests/baselines/reference/additionOperatorWithAnyAndEveryType.symbols index bada6c561f1..f95a388c189 100644 --- a/tests/baselines/reference/additionOperatorWithAnyAndEveryType.symbols +++ b/tests/baselines/reference/additionOperatorWithAnyAndEveryType.symbols @@ -6,7 +6,7 @@ class C { >C : Symbol(C, Decl(additionOperatorWithAnyAndEveryType.ts, 0, 18)) public a: string; ->a : Symbol(a, Decl(additionOperatorWithAnyAndEveryType.ts, 1, 9)) +>a : Symbol(C.a, Decl(additionOperatorWithAnyAndEveryType.ts, 1, 9)) static foo() { } >foo : Symbol(C.foo, Decl(additionOperatorWithAnyAndEveryType.ts, 2, 21)) diff --git a/tests/baselines/reference/aliasAssignments.errors.txt b/tests/baselines/reference/aliasAssignments.errors.txt index fe13faba581..18ea36c5d00 100644 --- a/tests/baselines/reference/aliasAssignments.errors.txt +++ b/tests/baselines/reference/aliasAssignments.errors.txt @@ -1,5 +1,4 @@ tests/cases/compiler/aliasAssignments_1.ts(3,1): error TS2322: Type 'number' is not assignable to type 'typeof "tests/cases/compiler/aliasAssignments_moduleA"'. - Property 'someClass' is missing in type 'Number'. tests/cases/compiler/aliasAssignments_1.ts(5,1): error TS2322: Type 'typeof "tests/cases/compiler/aliasAssignments_moduleA"' is not assignable to type 'number'. @@ -9,7 +8,6 @@ tests/cases/compiler/aliasAssignments_1.ts(5,1): error TS2322: Type 'typeof "tes x = 1; // Should be error ~ !!! error TS2322: Type 'number' is not assignable to type 'typeof "tests/cases/compiler/aliasAssignments_moduleA"'. -!!! error TS2322: Property 'someClass' is missing in type 'Number'. var y = 1; y = moduleA; // should be error ~ diff --git a/tests/baselines/reference/aliasErrors.js b/tests/baselines/reference/aliasErrors.js index 1e93d22c3fb..970ea3c54a3 100644 --- a/tests/baselines/reference/aliasErrors.js +++ b/tests/baselines/reference/aliasErrors.js @@ -55,9 +55,12 @@ var foo; var provide = foo; var booz = foo.bar.baz; var beez = foo.bar; +var m = no; +var m2 = no.mod; 5; "s"; null; +var r = undefined; var p = new provide.Provide(); function use() { beez.baz.boo; diff --git a/tests/baselines/reference/aliasUsageInAccessorsOfClass.symbols b/tests/baselines/reference/aliasUsageInAccessorsOfClass.symbols index 62a2396e2b2..45132ea2aa9 100644 --- a/tests/baselines/reference/aliasUsageInAccessorsOfClass.symbols +++ b/tests/baselines/reference/aliasUsageInAccessorsOfClass.symbols @@ -9,7 +9,7 @@ interface IHasVisualizationModel { >IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsage1_main.ts, 1, 50)) VisualizationModel: typeof Backbone.Model; ->VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsage1_main.ts, 2, 34)) +>VisualizationModel : Symbol(IHasVisualizationModel.VisualizationModel, Decl(aliasUsage1_main.ts, 2, 34)) >Backbone.Model : Symbol(Backbone.Model, Decl(aliasUsage1_backbone.ts, 0, 0)) >Backbone : Symbol(Backbone, Decl(aliasUsage1_main.ts, 0, 0)) >Model : Symbol(Backbone.Model, Decl(aliasUsage1_backbone.ts, 0, 0)) @@ -18,19 +18,19 @@ class C2 { >C2 : Symbol(C2, Decl(aliasUsage1_main.ts, 4, 1)) x: IHasVisualizationModel; ->x : Symbol(x, Decl(aliasUsage1_main.ts, 5, 10)) +>x : Symbol(C2.x, Decl(aliasUsage1_main.ts, 5, 10)) >IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsage1_main.ts, 1, 50)) get A() { ->A : Symbol(A, Decl(aliasUsage1_main.ts, 6, 30), Decl(aliasUsage1_main.ts, 9, 5)) +>A : Symbol(C2.A, Decl(aliasUsage1_main.ts, 6, 30), Decl(aliasUsage1_main.ts, 9, 5)) return this.x; ->this.x : Symbol(x, Decl(aliasUsage1_main.ts, 5, 10)) +>this.x : Symbol(C2.x, Decl(aliasUsage1_main.ts, 5, 10)) >this : Symbol(C2, Decl(aliasUsage1_main.ts, 4, 1)) ->x : Symbol(x, Decl(aliasUsage1_main.ts, 5, 10)) +>x : Symbol(C2.x, Decl(aliasUsage1_main.ts, 5, 10)) } set A(x) { ->A : Symbol(A, Decl(aliasUsage1_main.ts, 6, 30), Decl(aliasUsage1_main.ts, 9, 5)) +>A : Symbol(C2.A, Decl(aliasUsage1_main.ts, 6, 30), Decl(aliasUsage1_main.ts, 9, 5)) >x : Symbol(x, Decl(aliasUsage1_main.ts, 10, 10)) x = moduleA; @@ -43,7 +43,7 @@ export class Model { >Model : Symbol(Model, Decl(aliasUsage1_backbone.ts, 0, 0)) public someData: string; ->someData : Symbol(someData, Decl(aliasUsage1_backbone.ts, 0, 20)) +>someData : Symbol(Model.someData, Decl(aliasUsage1_backbone.ts, 0, 20)) } === tests/cases/compiler/aliasUsage1_moduleA.ts === diff --git a/tests/baselines/reference/aliasUsageInArray.symbols b/tests/baselines/reference/aliasUsageInArray.symbols index 9bca1bc8864..367cd05545a 100644 --- a/tests/baselines/reference/aliasUsageInArray.symbols +++ b/tests/baselines/reference/aliasUsageInArray.symbols @@ -9,7 +9,7 @@ interface IHasVisualizationModel { >IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInArray_main.ts, 1, 56)) VisualizationModel: typeof Backbone.Model; ->VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInArray_main.ts, 2, 34)) +>VisualizationModel : Symbol(IHasVisualizationModel.VisualizationModel, Decl(aliasUsageInArray_main.ts, 2, 34)) >Backbone.Model : Symbol(Backbone.Model, Decl(aliasUsageInArray_backbone.ts, 0, 0)) >Backbone : Symbol(Backbone, Decl(aliasUsageInArray_main.ts, 0, 0)) >Model : Symbol(Backbone.Model, Decl(aliasUsageInArray_backbone.ts, 0, 0)) @@ -30,7 +30,7 @@ export class Model { >Model : Symbol(Model, Decl(aliasUsageInArray_backbone.ts, 0, 0)) public someData: string; ->someData : Symbol(someData, Decl(aliasUsageInArray_backbone.ts, 0, 20)) +>someData : Symbol(Model.someData, Decl(aliasUsageInArray_backbone.ts, 0, 20)) } === tests/cases/compiler/aliasUsageInArray_moduleA.ts === diff --git a/tests/baselines/reference/aliasUsageInFunctionExpression.symbols b/tests/baselines/reference/aliasUsageInFunctionExpression.symbols index bd791d4d38f..a7a1f5d4593 100644 --- a/tests/baselines/reference/aliasUsageInFunctionExpression.symbols +++ b/tests/baselines/reference/aliasUsageInFunctionExpression.symbols @@ -9,7 +9,7 @@ interface IHasVisualizationModel { >IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInFunctionExpression_main.ts, 1, 69)) VisualizationModel: typeof Backbone.Model; ->VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInFunctionExpression_main.ts, 2, 34)) +>VisualizationModel : Symbol(IHasVisualizationModel.VisualizationModel, Decl(aliasUsageInFunctionExpression_main.ts, 2, 34)) >Backbone.Model : Symbol(Backbone.Model, Decl(aliasUsageInFunctionExpression_backbone.ts, 0, 0)) >Backbone : Symbol(Backbone, Decl(aliasUsageInFunctionExpression_main.ts, 0, 0)) >Model : Symbol(Backbone.Model, Decl(aliasUsageInFunctionExpression_backbone.ts, 0, 0)) @@ -30,7 +30,7 @@ export class Model { >Model : Symbol(Model, Decl(aliasUsageInFunctionExpression_backbone.ts, 0, 0)) public someData: string; ->someData : Symbol(someData, Decl(aliasUsageInFunctionExpression_backbone.ts, 0, 20)) +>someData : Symbol(Model.someData, Decl(aliasUsageInFunctionExpression_backbone.ts, 0, 20)) } === tests/cases/compiler/aliasUsageInFunctionExpression_moduleA.ts === diff --git a/tests/baselines/reference/aliasUsageInGenericFunction.symbols b/tests/baselines/reference/aliasUsageInGenericFunction.symbols index fccf60c3514..e44059e6907 100644 --- a/tests/baselines/reference/aliasUsageInGenericFunction.symbols +++ b/tests/baselines/reference/aliasUsageInGenericFunction.symbols @@ -9,7 +9,7 @@ interface IHasVisualizationModel { >IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInGenericFunction_main.ts, 1, 66)) VisualizationModel: typeof Backbone.Model; ->VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInGenericFunction_main.ts, 2, 34)) +>VisualizationModel : Symbol(IHasVisualizationModel.VisualizationModel, Decl(aliasUsageInGenericFunction_main.ts, 2, 34)) >Backbone.Model : Symbol(Backbone.Model, Decl(aliasUsageInGenericFunction_backbone.ts, 0, 0)) >Backbone : Symbol(Backbone, Decl(aliasUsageInGenericFunction_main.ts, 0, 0)) >Model : Symbol(Backbone.Model, Decl(aliasUsageInGenericFunction_backbone.ts, 0, 0)) @@ -42,7 +42,7 @@ export class Model { >Model : Symbol(Model, Decl(aliasUsageInGenericFunction_backbone.ts, 0, 0)) public someData: string; ->someData : Symbol(someData, Decl(aliasUsageInGenericFunction_backbone.ts, 0, 20)) +>someData : Symbol(Model.someData, Decl(aliasUsageInGenericFunction_backbone.ts, 0, 20)) } === tests/cases/compiler/aliasUsageInGenericFunction_moduleA.ts === diff --git a/tests/baselines/reference/aliasUsageInIndexerOfClass.symbols b/tests/baselines/reference/aliasUsageInIndexerOfClass.symbols index 37529d2ead2..3e13b71ea4f 100644 --- a/tests/baselines/reference/aliasUsageInIndexerOfClass.symbols +++ b/tests/baselines/reference/aliasUsageInIndexerOfClass.symbols @@ -9,7 +9,7 @@ interface IHasVisualizationModel { >IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInIndexerOfClass_main.ts, 1, 65)) VisualizationModel: typeof Backbone.Model; ->VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInIndexerOfClass_main.ts, 2, 34)) +>VisualizationModel : Symbol(IHasVisualizationModel.VisualizationModel, Decl(aliasUsageInIndexerOfClass_main.ts, 2, 34)) >Backbone.Model : Symbol(Backbone.Model, Decl(aliasUsageInIndexerOfClass_backbone.ts, 0, 0)) >Backbone : Symbol(Backbone, Decl(aliasUsageInIndexerOfClass_main.ts, 0, 0)) >Model : Symbol(Backbone.Model, Decl(aliasUsageInIndexerOfClass_backbone.ts, 0, 0)) @@ -22,7 +22,7 @@ class N { >IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInIndexerOfClass_main.ts, 1, 65)) x = moduleA; ->x : Symbol(x, Decl(aliasUsageInIndexerOfClass_main.ts, 6, 41)) +>x : Symbol(N.x, Decl(aliasUsageInIndexerOfClass_main.ts, 6, 41)) >moduleA : Symbol(moduleA, Decl(aliasUsageInIndexerOfClass_main.ts, 0, 67)) } class N2 { @@ -33,7 +33,7 @@ class N2 { >moduleA : Symbol(moduleA, Decl(aliasUsageInIndexerOfClass_main.ts, 0, 67)) x: IHasVisualizationModel; ->x : Symbol(x, Decl(aliasUsageInIndexerOfClass_main.ts, 10, 33)) +>x : Symbol(N2.x, Decl(aliasUsageInIndexerOfClass_main.ts, 10, 33)) >IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInIndexerOfClass_main.ts, 1, 65)) } === tests/cases/compiler/aliasUsageInIndexerOfClass_backbone.ts === @@ -41,7 +41,7 @@ export class Model { >Model : Symbol(Model, Decl(aliasUsageInIndexerOfClass_backbone.ts, 0, 0)) public someData: string; ->someData : Symbol(someData, Decl(aliasUsageInIndexerOfClass_backbone.ts, 0, 20)) +>someData : Symbol(Model.someData, Decl(aliasUsageInIndexerOfClass_backbone.ts, 0, 20)) } === tests/cases/compiler/aliasUsageInIndexerOfClass_moduleA.ts === diff --git a/tests/baselines/reference/aliasUsageInObjectLiteral.symbols b/tests/baselines/reference/aliasUsageInObjectLiteral.symbols index ef94a9037ad..161617e0003 100644 --- a/tests/baselines/reference/aliasUsageInObjectLiteral.symbols +++ b/tests/baselines/reference/aliasUsageInObjectLiteral.symbols @@ -9,7 +9,7 @@ interface IHasVisualizationModel { >IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInObjectLiteral_main.ts, 1, 64)) VisualizationModel: typeof Backbone.Model; ->VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInObjectLiteral_main.ts, 2, 34)) +>VisualizationModel : Symbol(IHasVisualizationModel.VisualizationModel, Decl(aliasUsageInObjectLiteral_main.ts, 2, 34)) >Backbone.Model : Symbol(Backbone.Model, Decl(aliasUsageInObjectLiteral_backbone.ts, 0, 0)) >Backbone : Symbol(Backbone, Decl(aliasUsageInObjectLiteral_main.ts, 0, 0)) >Model : Symbol(Backbone.Model, Decl(aliasUsageInObjectLiteral_backbone.ts, 0, 0)) @@ -42,7 +42,7 @@ export class Model { >Model : Symbol(Model, Decl(aliasUsageInObjectLiteral_backbone.ts, 0, 0)) public someData: string; ->someData : Symbol(someData, Decl(aliasUsageInObjectLiteral_backbone.ts, 0, 20)) +>someData : Symbol(Model.someData, Decl(aliasUsageInObjectLiteral_backbone.ts, 0, 20)) } === tests/cases/compiler/aliasUsageInObjectLiteral_moduleA.ts === diff --git a/tests/baselines/reference/aliasUsageInOrExpression.symbols b/tests/baselines/reference/aliasUsageInOrExpression.symbols index 3d9331b1fa9..2d9f55ec274 100644 --- a/tests/baselines/reference/aliasUsageInOrExpression.symbols +++ b/tests/baselines/reference/aliasUsageInOrExpression.symbols @@ -9,7 +9,7 @@ interface IHasVisualizationModel { >IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInOrExpression_main.ts, 1, 63)) VisualizationModel: typeof Backbone.Model; ->VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInOrExpression_main.ts, 2, 34)) +>VisualizationModel : Symbol(IHasVisualizationModel.VisualizationModel, Decl(aliasUsageInOrExpression_main.ts, 2, 34)) >Backbone.Model : Symbol(Backbone.Model, Decl(aliasUsageInOrExpression_backbone.ts, 0, 0)) >Backbone : Symbol(Backbone, Decl(aliasUsageInOrExpression_main.ts, 0, 0)) >Model : Symbol(Backbone.Model, Decl(aliasUsageInOrExpression_backbone.ts, 0, 0)) @@ -58,7 +58,7 @@ export class Model { >Model : Symbol(Model, Decl(aliasUsageInOrExpression_backbone.ts, 0, 0)) public someData: string; ->someData : Symbol(someData, Decl(aliasUsageInOrExpression_backbone.ts, 0, 20)) +>someData : Symbol(Model.someData, Decl(aliasUsageInOrExpression_backbone.ts, 0, 20)) } === tests/cases/compiler/aliasUsageInOrExpression_moduleA.ts === diff --git a/tests/baselines/reference/aliasUsageInTypeArgumentOfExtendsClause.symbols b/tests/baselines/reference/aliasUsageInTypeArgumentOfExtendsClause.symbols index 6fc639da2c1..77dbb058371 100644 --- a/tests/baselines/reference/aliasUsageInTypeArgumentOfExtendsClause.symbols +++ b/tests/baselines/reference/aliasUsageInTypeArgumentOfExtendsClause.symbols @@ -9,7 +9,7 @@ interface IHasVisualizationModel { >IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInTypeArgumentOfExtendsClause_main.ts, 1, 78)) VisualizationModel: typeof Backbone.Model; ->VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInTypeArgumentOfExtendsClause_main.ts, 2, 34)) +>VisualizationModel : Symbol(IHasVisualizationModel.VisualizationModel, Decl(aliasUsageInTypeArgumentOfExtendsClause_main.ts, 2, 34)) >Backbone.Model : Symbol(Backbone.Model, Decl(aliasUsageInTypeArgumentOfExtendsClause_backbone.ts, 0, 0)) >Backbone : Symbol(Backbone, Decl(aliasUsageInTypeArgumentOfExtendsClause_main.ts, 0, 0)) >Model : Symbol(Backbone.Model, Decl(aliasUsageInTypeArgumentOfExtendsClause_backbone.ts, 0, 0)) @@ -20,7 +20,7 @@ class C { >IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInTypeArgumentOfExtendsClause_main.ts, 1, 78)) x: T; ->x : Symbol(x, Decl(aliasUsageInTypeArgumentOfExtendsClause_main.ts, 5, 43)) +>x : Symbol(C.x, Decl(aliasUsageInTypeArgumentOfExtendsClause_main.ts, 5, 43)) >T : Symbol(T, Decl(aliasUsageInTypeArgumentOfExtendsClause_main.ts, 5, 8)) } class D extends C { @@ -29,7 +29,7 @@ class D extends C { >IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInTypeArgumentOfExtendsClause_main.ts, 1, 78)) x = moduleA; ->x : Symbol(x, Decl(aliasUsageInTypeArgumentOfExtendsClause_main.ts, 8, 43)) +>x : Symbol(D.x, Decl(aliasUsageInTypeArgumentOfExtendsClause_main.ts, 8, 43)) >moduleA : Symbol(moduleA, Decl(aliasUsageInTypeArgumentOfExtendsClause_main.ts, 0, 80)) } === tests/cases/compiler/aliasUsageInTypeArgumentOfExtendsClause_backbone.ts === @@ -37,7 +37,7 @@ export class Model { >Model : Symbol(Model, Decl(aliasUsageInTypeArgumentOfExtendsClause_backbone.ts, 0, 0)) public someData: string; ->someData : Symbol(someData, Decl(aliasUsageInTypeArgumentOfExtendsClause_backbone.ts, 0, 20)) +>someData : Symbol(Model.someData, Decl(aliasUsageInTypeArgumentOfExtendsClause_backbone.ts, 0, 20)) } === tests/cases/compiler/aliasUsageInTypeArgumentOfExtendsClause_moduleA.ts === diff --git a/tests/baselines/reference/aliasUsageInVarAssignment.symbols b/tests/baselines/reference/aliasUsageInVarAssignment.symbols index d0e7f6b7d05..671cbfc3082 100644 --- a/tests/baselines/reference/aliasUsageInVarAssignment.symbols +++ b/tests/baselines/reference/aliasUsageInVarAssignment.symbols @@ -9,7 +9,7 @@ interface IHasVisualizationModel { >IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInVarAssignment_main.ts, 1, 64)) VisualizationModel: typeof Backbone.Model; ->VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInVarAssignment_main.ts, 2, 34)) +>VisualizationModel : Symbol(IHasVisualizationModel.VisualizationModel, Decl(aliasUsageInVarAssignment_main.ts, 2, 34)) >Backbone.Model : Symbol(Backbone.Model, Decl(aliasUsageInVarAssignment_backbone.ts, 0, 0)) >Backbone : Symbol(Backbone, Decl(aliasUsageInVarAssignment_main.ts, 0, 0)) >Model : Symbol(Backbone.Model, Decl(aliasUsageInVarAssignment_backbone.ts, 0, 0)) @@ -28,7 +28,7 @@ export class Model { >Model : Symbol(Model, Decl(aliasUsageInVarAssignment_backbone.ts, 0, 0)) public someData: string; ->someData : Symbol(someData, Decl(aliasUsageInVarAssignment_backbone.ts, 0, 20)) +>someData : Symbol(Model.someData, Decl(aliasUsageInVarAssignment_backbone.ts, 0, 20)) } === tests/cases/compiler/aliasUsageInVarAssignment_moduleA.ts === diff --git a/tests/baselines/reference/aliasesInSystemModule1.js b/tests/baselines/reference/aliasesInSystemModule1.js index 11f02c18ea4..46d2b061dd3 100644 --- a/tests/baselines/reference/aliasesInSystemModule1.js +++ b/tests/baselines/reference/aliasesInSystemModule1.js @@ -17,8 +17,9 @@ module M { //// [aliasesInSystemModule1.js] -System.register(['foo'], function(exports_1, __moduleName) { +System.register(['foo'], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; var alias; var cls, cls2, x, y, z, M; return { diff --git a/tests/baselines/reference/aliasesInSystemModule2.js b/tests/baselines/reference/aliasesInSystemModule2.js index 7378536e2fd..e30ba4fea56 100644 --- a/tests/baselines/reference/aliasesInSystemModule2.js +++ b/tests/baselines/reference/aliasesInSystemModule2.js @@ -16,8 +16,9 @@ module M { } //// [aliasesInSystemModule2.js] -System.register(["foo"], function(exports_1, __moduleName) { +System.register(["foo"], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; var foo_1; var cls, cls2, x, y, z, M; return { diff --git a/tests/baselines/reference/allowSyntheticDefaultImports1.symbols b/tests/baselines/reference/allowSyntheticDefaultImports1.symbols index d88a79e1bf2..ecbe9e4c205 100644 --- a/tests/baselines/reference/allowSyntheticDefaultImports1.symbols +++ b/tests/baselines/reference/allowSyntheticDefaultImports1.symbols @@ -13,6 +13,6 @@ export class Foo { >Foo : Symbol(Foo, Decl(b.ts, 0, 0)) member: string; ->member : Symbol(member, Decl(b.ts, 0, 18)) +>member : Symbol(Foo.member, Decl(b.ts, 0, 18)) } diff --git a/tests/baselines/reference/allowSyntheticDefaultImports2.js b/tests/baselines/reference/allowSyntheticDefaultImports2.js index 0480250d71a..87e47f9c9a1 100644 --- a/tests/baselines/reference/allowSyntheticDefaultImports2.js +++ b/tests/baselines/reference/allowSyntheticDefaultImports2.js @@ -10,8 +10,9 @@ export class Foo { } //// [b.js] -System.register([], function(exports_1, __moduleName) { +System.register([], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; var Foo; return { setters:[], @@ -26,8 +27,9 @@ System.register([], function(exports_1, __moduleName) { } }); //// [a.js] -System.register(["./b"], function(exports_1, __moduleName) { +System.register(["./b"], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; var b_1; var x; return { diff --git a/tests/baselines/reference/allowSyntheticDefaultImports2.symbols b/tests/baselines/reference/allowSyntheticDefaultImports2.symbols index cea6145fbd6..615b1095c66 100644 --- a/tests/baselines/reference/allowSyntheticDefaultImports2.symbols +++ b/tests/baselines/reference/allowSyntheticDefaultImports2.symbols @@ -13,5 +13,5 @@ export class Foo { >Foo : Symbol(Foo, Decl(b.ts, 0, 0)) member: string; ->member : Symbol(member, Decl(b.ts, 0, 18)) +>member : Symbol(Foo.member, Decl(b.ts, 0, 18)) } diff --git a/tests/baselines/reference/allowSyntheticDefaultImports3.js b/tests/baselines/reference/allowSyntheticDefaultImports3.js index adf85792fd9..348ce42a60a 100644 --- a/tests/baselines/reference/allowSyntheticDefaultImports3.js +++ b/tests/baselines/reference/allowSyntheticDefaultImports3.js @@ -11,8 +11,9 @@ export class Foo { //// [b.js] -System.register([], function(exports_1, __moduleName) { +System.register([], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; var Foo; return { setters:[], @@ -27,8 +28,9 @@ System.register([], function(exports_1, __moduleName) { } }); //// [a.js] -System.register(["./b"], function(exports_1, __moduleName) { +System.register(["./b"], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; var b_1; var x; return { diff --git a/tests/baselines/reference/allowSyntheticDefaultImports4.symbols b/tests/baselines/reference/allowSyntheticDefaultImports4.symbols index 8edad006c2d..22887d48bd9 100644 --- a/tests/baselines/reference/allowSyntheticDefaultImports4.symbols +++ b/tests/baselines/reference/allowSyntheticDefaultImports4.symbols @@ -3,7 +3,7 @@ declare class Foo { >Foo : Symbol(Foo, Decl(b.d.ts, 0, 0)) member: string; ->member : Symbol(member, Decl(b.d.ts, 0, 19)) +>member : Symbol(Foo.member, Decl(b.d.ts, 0, 19)) } export = Foo; >Foo : Symbol(Foo, Decl(b.d.ts, 0, 0)) diff --git a/tests/baselines/reference/allowSyntheticDefaultImports5.js b/tests/baselines/reference/allowSyntheticDefaultImports5.js index d0dfdcb76d1..f59226e152d 100644 --- a/tests/baselines/reference/allowSyntheticDefaultImports5.js +++ b/tests/baselines/reference/allowSyntheticDefaultImports5.js @@ -12,8 +12,9 @@ export var x = new Foo(); //// [a.js] -System.register(["./b"], function(exports_1, __moduleName) { +System.register(["./b"], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; var b_1; var x; return { diff --git a/tests/baselines/reference/allowSyntheticDefaultImports5.symbols b/tests/baselines/reference/allowSyntheticDefaultImports5.symbols index 8edad006c2d..22887d48bd9 100644 --- a/tests/baselines/reference/allowSyntheticDefaultImports5.symbols +++ b/tests/baselines/reference/allowSyntheticDefaultImports5.symbols @@ -3,7 +3,7 @@ declare class Foo { >Foo : Symbol(Foo, Decl(b.d.ts, 0, 0)) member: string; ->member : Symbol(member, Decl(b.d.ts, 0, 19)) +>member : Symbol(Foo.member, Decl(b.d.ts, 0, 19)) } export = Foo; >Foo : Symbol(Foo, Decl(b.d.ts, 0, 0)) diff --git a/tests/baselines/reference/allowSyntheticDefaultImports6.js b/tests/baselines/reference/allowSyntheticDefaultImports6.js index eaafb5ee276..d2f25e538c5 100644 --- a/tests/baselines/reference/allowSyntheticDefaultImports6.js +++ b/tests/baselines/reference/allowSyntheticDefaultImports6.js @@ -12,8 +12,9 @@ export var x = new Foo(); //// [a.js] -System.register(["./b"], function(exports_1, __moduleName) { +System.register(["./b"], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; var b_1; var x; return { diff --git a/tests/baselines/reference/ambientClassDeclarationWithExtends.symbols b/tests/baselines/reference/ambientClassDeclarationWithExtends.symbols index 023ae6bf582..125bd0d0e5f 100644 --- a/tests/baselines/reference/ambientClassDeclarationWithExtends.symbols +++ b/tests/baselines/reference/ambientClassDeclarationWithExtends.symbols @@ -10,7 +10,7 @@ declare class C { >C : Symbol(C, Decl(ambientClassDeclarationExtends_singleFile.ts, 1, 29)) public foo; ->foo : Symbol(foo, Decl(ambientClassDeclarationExtends_singleFile.ts, 3, 17)) +>foo : Symbol(C.foo, Decl(ambientClassDeclarationExtends_singleFile.ts, 3, 17)) } namespace D { var x; } >D : Symbol(D, Decl(ambientClassDeclarationExtends_singleFile.ts, 5, 1), Decl(ambientClassDeclarationExtends_singleFile.ts, 6, 22)) @@ -31,7 +31,7 @@ declare class E { >E : Symbol(E, Decl(ambientClassDeclarationExtends_file1.ts, 0, 0)) public bar; ->bar : Symbol(bar, Decl(ambientClassDeclarationExtends_file1.ts, 1, 17)) +>bar : Symbol(E.bar, Decl(ambientClassDeclarationExtends_file1.ts, 1, 17)) } namespace F { var y; } >F : Symbol(F, Decl(ambientClassDeclarationExtends_file1.ts, 3, 1), Decl(ambientClassDeclarationExtends_file2.ts, 0, 0)) diff --git a/tests/baselines/reference/ambientClassMergesOverloadsWithInterface.symbols b/tests/baselines/reference/ambientClassMergesOverloadsWithInterface.symbols index 9a5eb13d21d..224edf38cee 100644 --- a/tests/baselines/reference/ambientClassMergesOverloadsWithInterface.symbols +++ b/tests/baselines/reference/ambientClassMergesOverloadsWithInterface.symbols @@ -3,20 +3,20 @@ declare class C { >C : Symbol(C, Decl(ambientClassMergesOverloadsWithInterface.ts, 0, 0), Decl(ambientClassMergesOverloadsWithInterface.ts, 3, 1)) baz(): any; ->baz : Symbol(baz, Decl(ambientClassMergesOverloadsWithInterface.ts, 0, 17)) +>baz : Symbol(C.baz, Decl(ambientClassMergesOverloadsWithInterface.ts, 0, 17)) foo(n: number): any; ->foo : Symbol(foo, Decl(ambientClassMergesOverloadsWithInterface.ts, 1, 15), Decl(ambientClassMergesOverloadsWithInterface.ts, 4, 13)) +>foo : Symbol(C.foo, Decl(ambientClassMergesOverloadsWithInterface.ts, 1, 15), Decl(ambientClassMergesOverloadsWithInterface.ts, 4, 13)) >n : Symbol(n, Decl(ambientClassMergesOverloadsWithInterface.ts, 2, 8)) } interface C { >C : Symbol(C, Decl(ambientClassMergesOverloadsWithInterface.ts, 0, 0), Decl(ambientClassMergesOverloadsWithInterface.ts, 3, 1)) foo(n: number): any; ->foo : Symbol(foo, Decl(ambientClassMergesOverloadsWithInterface.ts, 1, 15), Decl(ambientClassMergesOverloadsWithInterface.ts, 4, 13)) +>foo : Symbol(C.foo, Decl(ambientClassMergesOverloadsWithInterface.ts, 1, 15), Decl(ambientClassMergesOverloadsWithInterface.ts, 4, 13)) >n : Symbol(n, Decl(ambientClassMergesOverloadsWithInterface.ts, 5, 8)) bar(): any; ->bar : Symbol(bar, Decl(ambientClassMergesOverloadsWithInterface.ts, 5, 24)) +>bar : Symbol(C.bar, Decl(ambientClassMergesOverloadsWithInterface.ts, 5, 24)) } diff --git a/tests/baselines/reference/ambientDeclarations.symbols b/tests/baselines/reference/ambientDeclarations.symbols index e5b85ae7c2c..ef5c5403ccf 100644 --- a/tests/baselines/reference/ambientDeclarations.symbols +++ b/tests/baselines/reference/ambientDeclarations.symbols @@ -63,7 +63,7 @@ declare class cls { constructor(); method(): cls; ->method : Symbol(method, Decl(ambientDeclarations.ts, 26, 18)) +>method : Symbol(cls.method, Decl(ambientDeclarations.ts, 26, 18)) >cls : Symbol(cls, Decl(ambientDeclarations.ts, 22, 36)) static static(p): number; @@ -74,7 +74,7 @@ declare class cls { >q : Symbol(cls.q, Decl(ambientDeclarations.ts, 28, 29)) private fn(); ->fn : Symbol(fn, Decl(ambientDeclarations.ts, 29, 13)) +>fn : Symbol(cls.fn, Decl(ambientDeclarations.ts, 29, 13)) private static fns(); >fns : Symbol(cls.fns, Decl(ambientDeclarations.ts, 30, 17)) diff --git a/tests/baselines/reference/ambientDeclarationsExternal.errors.txt b/tests/baselines/reference/ambientDeclarationsExternal.errors.txt deleted file mode 100644 index 2a9b1fe4879..00000000000 --- a/tests/baselines/reference/ambientDeclarationsExternal.errors.txt +++ /dev/null @@ -1,28 +0,0 @@ -tests/cases/conformance/ambient/consumer.ts(2,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. - - -==== tests/cases/conformance/ambient/consumer.ts (1 errors) ==== - /// - import imp1 = require('equ'); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. - - - // Ambient external module members are always exported with or without export keyword when module lacks export assignment - import imp3 = require('equ2'); - var n = imp3.x; - var n: number; - -==== tests/cases/conformance/ambient/decls.ts (0 errors) ==== - - // Ambient external module with export assignment - declare module 'equ' { - var x; - export = x; - } - - declare module 'equ2' { - var x: number; - } - - // Ambient external import declaration referencing ambient external module using top level module name \ No newline at end of file diff --git a/tests/baselines/reference/ambientDeclarationsExternal.symbols b/tests/baselines/reference/ambientDeclarationsExternal.symbols new file mode 100644 index 00000000000..f160751a19b --- /dev/null +++ b/tests/baselines/reference/ambientDeclarationsExternal.symbols @@ -0,0 +1,36 @@ +=== tests/cases/conformance/ambient/consumer.ts === +/// +import imp1 = require('equ'); +>imp1 : Symbol(imp1, Decl(consumer.ts, 0, 0)) + + +// Ambient external module members are always exported with or without export keyword when module lacks export assignment +import imp3 = require('equ2'); +>imp3 : Symbol(imp3, Decl(consumer.ts, 1, 29)) + +var n = imp3.x; +>n : Symbol(n, Decl(consumer.ts, 6, 3), Decl(consumer.ts, 7, 3)) +>imp3.x : Symbol(imp3.x, Decl(decls.ts, 8, 7)) +>imp3 : Symbol(imp3, Decl(consumer.ts, 1, 29)) +>x : Symbol(imp3.x, Decl(decls.ts, 8, 7)) + +var n: number; +>n : Symbol(n, Decl(consumer.ts, 6, 3), Decl(consumer.ts, 7, 3)) + +=== tests/cases/conformance/ambient/decls.ts === + +// Ambient external module with export assignment +declare module 'equ' { + var x; +>x : Symbol(x, Decl(decls.ts, 3, 7)) + + export = x; +>x : Symbol(x, Decl(decls.ts, 3, 7)) +} + +declare module 'equ2' { + var x: number; +>x : Symbol(x, Decl(decls.ts, 8, 7)) +} + +// Ambient external import declaration referencing ambient external module using top level module name diff --git a/tests/baselines/reference/ambientDeclarationsExternal.types b/tests/baselines/reference/ambientDeclarationsExternal.types new file mode 100644 index 00000000000..062e006cf0a --- /dev/null +++ b/tests/baselines/reference/ambientDeclarationsExternal.types @@ -0,0 +1,36 @@ +=== tests/cases/conformance/ambient/consumer.ts === +/// +import imp1 = require('equ'); +>imp1 : any + + +// Ambient external module members are always exported with or without export keyword when module lacks export assignment +import imp3 = require('equ2'); +>imp3 : typeof imp3 + +var n = imp3.x; +>n : number +>imp3.x : number +>imp3 : typeof imp3 +>x : number + +var n: number; +>n : number + +=== tests/cases/conformance/ambient/decls.ts === + +// Ambient external module with export assignment +declare module 'equ' { + var x; +>x : any + + export = x; +>x : any +} + +declare module 'equ2' { + var x: number; +>x : number +} + +// Ambient external import declaration referencing ambient external module using top level module name diff --git a/tests/baselines/reference/ambientErrors.errors.txt b/tests/baselines/reference/ambientErrors.errors.txt index 5e257c2de3f..7b42085e0c2 100644 --- a/tests/baselines/reference/ambientErrors.errors.txt +++ b/tests/baselines/reference/ambientErrors.errors.txt @@ -1,5 +1,4 @@ tests/cases/conformance/ambient/ambientErrors.ts(2,15): error TS1039: Initializers are not allowed in ambient contexts. -tests/cases/conformance/ambient/ambientErrors.ts(6,18): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. tests/cases/conformance/ambient/ambientErrors.ts(17,22): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. tests/cases/conformance/ambient/ambientErrors.ts(20,24): error TS1183: An implementation cannot be declared in ambient contexts. tests/cases/conformance/ambient/ambientErrors.ts(29,9): error TS1066: In ambient enum declarations member initializer must be constant expression. @@ -15,7 +14,7 @@ tests/cases/conformance/ambient/ambientErrors.ts(51,16): error TS2436: Ambient m tests/cases/conformance/ambient/ambientErrors.ts(57,5): error TS2309: An export assignment cannot be used in a module with other exported elements. -==== tests/cases/conformance/ambient/ambientErrors.ts (15 errors) ==== +==== tests/cases/conformance/ambient/ambientErrors.ts (14 errors) ==== // Ambient variable with an initializer declare var x = 4; ~ @@ -24,8 +23,6 @@ tests/cases/conformance/ambient/ambientErrors.ts(57,5): error TS2309: An export // Ambient functions with invalid overloads declare function fn(x: number): string; declare function fn(x: 'foo'): number; - ~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. // Ambient functions with duplicate signatures declare function fn1(x: number): string; diff --git a/tests/baselines/reference/ambientExternalModuleInAnotherExternalModule.errors.txt b/tests/baselines/reference/ambientExternalModuleInAnotherExternalModule.errors.txt index 0e508470b13..4edf3bf7966 100644 --- a/tests/baselines/reference/ambientExternalModuleInAnotherExternalModule.errors.txt +++ b/tests/baselines/reference/ambientExternalModuleInAnotherExternalModule.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/ambientExternalModuleInAnotherExternalModule.ts(5,16): error TS2435: Ambient modules cannot be nested in other modules or namespaces. +tests/cases/compiler/ambientExternalModuleInAnotherExternalModule.ts(5,16): error TS2664: Invalid module name in augmentation, module 'ext' cannot be found. tests/cases/compiler/ambientExternalModuleInAnotherExternalModule.ts(10,22): error TS2307: Cannot find module 'ext'. @@ -9,7 +9,7 @@ tests/cases/compiler/ambientExternalModuleInAnotherExternalModule.ts(10,22): err declare module "ext" { ~~~~~ -!!! error TS2435: Ambient modules cannot be nested in other modules or namespaces. +!!! error TS2664: Invalid module name in augmentation, module 'ext' cannot be found. export class C { } } diff --git a/tests/baselines/reference/ambientExternalModuleInsideNonAmbient.errors.txt b/tests/baselines/reference/ambientExternalModuleInsideNonAmbient.errors.txt index 7e4ac795d0d..c892c91bfd7 100644 --- a/tests/baselines/reference/ambientExternalModuleInsideNonAmbient.errors.txt +++ b/tests/baselines/reference/ambientExternalModuleInsideNonAmbient.errors.txt @@ -1,9 +1,12 @@ +tests/cases/conformance/ambient/ambientExternalModuleInsideNonAmbient.ts(2,5): error TS2668: 'export' modifier cannot be applied to ambient modules and module augmentations since they are always visible. tests/cases/conformance/ambient/ambientExternalModuleInsideNonAmbient.ts(2,27): error TS2435: Ambient modules cannot be nested in other modules or namespaces. -==== tests/cases/conformance/ambient/ambientExternalModuleInsideNonAmbient.ts (1 errors) ==== +==== tests/cases/conformance/ambient/ambientExternalModuleInsideNonAmbient.ts (2 errors) ==== module M { export declare module "M" { } + ~~~~~~ +!!! error TS2668: 'export' modifier cannot be applied to ambient modules and module augmentations since they are always visible. ~~~ !!! error TS2435: Ambient modules cannot be nested in other modules or namespaces. } \ No newline at end of file diff --git a/tests/baselines/reference/ambientExternalModuleInsideNonAmbientExternalModule.errors.txt b/tests/baselines/reference/ambientExternalModuleInsideNonAmbientExternalModule.errors.txt index e5905aaaf8f..1599069e67d 100644 --- a/tests/baselines/reference/ambientExternalModuleInsideNonAmbientExternalModule.errors.txt +++ b/tests/baselines/reference/ambientExternalModuleInsideNonAmbientExternalModule.errors.txt @@ -1,7 +1,10 @@ -tests/cases/conformance/ambient/ambientExternalModuleInsideNonAmbientExternalModule.ts(1,23): error TS2435: Ambient modules cannot be nested in other modules or namespaces. +tests/cases/conformance/ambient/ambientExternalModuleInsideNonAmbientExternalModule.ts(1,1): error TS2668: 'export' modifier cannot be applied to ambient modules and module augmentations since they are always visible. +tests/cases/conformance/ambient/ambientExternalModuleInsideNonAmbientExternalModule.ts(1,23): error TS2664: Invalid module name in augmentation, module 'M' cannot be found. -==== tests/cases/conformance/ambient/ambientExternalModuleInsideNonAmbientExternalModule.ts (1 errors) ==== +==== tests/cases/conformance/ambient/ambientExternalModuleInsideNonAmbientExternalModule.ts (2 errors) ==== export declare module "M" { } + ~~~~~~ +!!! error TS2668: 'export' modifier cannot be applied to ambient modules and module augmentations since they are always visible. ~~~ -!!! error TS2435: Ambient modules cannot be nested in other modules or namespaces. \ No newline at end of file +!!! error TS2664: Invalid module name in augmentation, module 'M' cannot be found. \ No newline at end of file diff --git a/tests/baselines/reference/ambientExternalModuleWithInternalImportDeclaration.symbols b/tests/baselines/reference/ambientExternalModuleWithInternalImportDeclaration.symbols index 3af41f90957..d7e3b5925b1 100644 --- a/tests/baselines/reference/ambientExternalModuleWithInternalImportDeclaration.symbols +++ b/tests/baselines/reference/ambientExternalModuleWithInternalImportDeclaration.symbols @@ -19,7 +19,7 @@ declare module 'M' { >C : Symbol(C, Decl(ambientExternalModuleWithInternalImportDeclaration_0.ts, 0, 20), Decl(ambientExternalModuleWithInternalImportDeclaration_0.ts, 3, 5)) foo(): void; ->foo : Symbol(foo, Decl(ambientExternalModuleWithInternalImportDeclaration_0.ts, 4, 13)) +>foo : Symbol(C.foo, Decl(ambientExternalModuleWithInternalImportDeclaration_0.ts, 4, 13)) } import X = C; >X : Symbol(X, Decl(ambientExternalModuleWithInternalImportDeclaration_0.ts, 6, 5)) diff --git a/tests/baselines/reference/ambientExternalModuleWithoutInternalImportDeclaration.symbols b/tests/baselines/reference/ambientExternalModuleWithoutInternalImportDeclaration.symbols index baf15f22a4a..15ddf4ac488 100644 --- a/tests/baselines/reference/ambientExternalModuleWithoutInternalImportDeclaration.symbols +++ b/tests/baselines/reference/ambientExternalModuleWithoutInternalImportDeclaration.symbols @@ -19,7 +19,7 @@ declare module 'M' { >C : Symbol(C, Decl(ambientExternalModuleWithoutInternalImportDeclaration_0.ts, 0, 20), Decl(ambientExternalModuleWithoutInternalImportDeclaration_0.ts, 3, 5)) foo(): void; ->foo : Symbol(foo, Decl(ambientExternalModuleWithoutInternalImportDeclaration_0.ts, 4, 13)) +>foo : Symbol(C.foo, Decl(ambientExternalModuleWithoutInternalImportDeclaration_0.ts, 4, 13)) } export = C; >C : Symbol(C, Decl(ambientExternalModuleWithoutInternalImportDeclaration_0.ts, 0, 20), Decl(ambientExternalModuleWithoutInternalImportDeclaration_0.ts, 3, 5)) diff --git a/tests/baselines/reference/ambientNameRestrictions.js b/tests/baselines/reference/ambientNameRestrictions.js new file mode 100644 index 00000000000..cd4fbf29371 --- /dev/null +++ b/tests/baselines/reference/ambientNameRestrictions.js @@ -0,0 +1,8 @@ +//// [ambientNameRestrictions.ts] +export declare namespace Foo { + export var static: any; +} + + +//// [ambientNameRestrictions.js] +"use strict"; diff --git a/tests/baselines/reference/ambientNameRestrictions.symbols b/tests/baselines/reference/ambientNameRestrictions.symbols new file mode 100644 index 00000000000..d5b3fafaa57 --- /dev/null +++ b/tests/baselines/reference/ambientNameRestrictions.symbols @@ -0,0 +1,8 @@ +=== tests/cases/compiler/ambientNameRestrictions.ts === +export declare namespace Foo { +>Foo : Symbol(Foo, Decl(ambientNameRestrictions.ts, 0, 0)) + + export var static: any; +>static : Symbol(static, Decl(ambientNameRestrictions.ts, 1, 12)) +} + diff --git a/tests/baselines/reference/ambientNameRestrictions.types b/tests/baselines/reference/ambientNameRestrictions.types new file mode 100644 index 00000000000..705319392d8 --- /dev/null +++ b/tests/baselines/reference/ambientNameRestrictions.types @@ -0,0 +1,8 @@ +=== tests/cases/compiler/ambientNameRestrictions.ts === +export declare namespace Foo { +>Foo : typeof Foo + + export var static: any; +>static : any +} + diff --git a/tests/baselines/reference/ambiguousCallsWhereReturnTypesAgree.symbols b/tests/baselines/reference/ambiguousCallsWhereReturnTypesAgree.symbols index 5d6c34f4d68..9dcf5c515e2 100644 --- a/tests/baselines/reference/ambiguousCallsWhereReturnTypesAgree.symbols +++ b/tests/baselines/reference/ambiguousCallsWhereReturnTypesAgree.symbols @@ -3,35 +3,35 @@ class TestClass { >TestClass : Symbol(TestClass, Decl(ambiguousCallsWhereReturnTypesAgree.ts, 0, 0)) public bar(x: string): void; ->bar : Symbol(bar, Decl(ambiguousCallsWhereReturnTypesAgree.ts, 0, 17), Decl(ambiguousCallsWhereReturnTypesAgree.ts, 1, 32), Decl(ambiguousCallsWhereReturnTypesAgree.ts, 2, 34)) +>bar : Symbol(TestClass.bar, Decl(ambiguousCallsWhereReturnTypesAgree.ts, 0, 17), Decl(ambiguousCallsWhereReturnTypesAgree.ts, 1, 32), Decl(ambiguousCallsWhereReturnTypesAgree.ts, 2, 34)) >x : Symbol(x, Decl(ambiguousCallsWhereReturnTypesAgree.ts, 1, 15)) public bar(x: string[]): void; ->bar : Symbol(bar, Decl(ambiguousCallsWhereReturnTypesAgree.ts, 0, 17), Decl(ambiguousCallsWhereReturnTypesAgree.ts, 1, 32), Decl(ambiguousCallsWhereReturnTypesAgree.ts, 2, 34)) +>bar : Symbol(TestClass.bar, Decl(ambiguousCallsWhereReturnTypesAgree.ts, 0, 17), Decl(ambiguousCallsWhereReturnTypesAgree.ts, 1, 32), Decl(ambiguousCallsWhereReturnTypesAgree.ts, 2, 34)) >x : Symbol(x, Decl(ambiguousCallsWhereReturnTypesAgree.ts, 2, 15)) public bar(x: any): void { ->bar : Symbol(bar, Decl(ambiguousCallsWhereReturnTypesAgree.ts, 0, 17), Decl(ambiguousCallsWhereReturnTypesAgree.ts, 1, 32), Decl(ambiguousCallsWhereReturnTypesAgree.ts, 2, 34)) +>bar : Symbol(TestClass.bar, Decl(ambiguousCallsWhereReturnTypesAgree.ts, 0, 17), Decl(ambiguousCallsWhereReturnTypesAgree.ts, 1, 32), Decl(ambiguousCallsWhereReturnTypesAgree.ts, 2, 34)) >x : Symbol(x, Decl(ambiguousCallsWhereReturnTypesAgree.ts, 3, 15)) } public foo(x: string): void; ->foo : Symbol(foo, Decl(ambiguousCallsWhereReturnTypesAgree.ts, 5, 5), Decl(ambiguousCallsWhereReturnTypesAgree.ts, 7, 32), Decl(ambiguousCallsWhereReturnTypesAgree.ts, 8, 34)) +>foo : Symbol(TestClass.foo, Decl(ambiguousCallsWhereReturnTypesAgree.ts, 5, 5), Decl(ambiguousCallsWhereReturnTypesAgree.ts, 7, 32), Decl(ambiguousCallsWhereReturnTypesAgree.ts, 8, 34)) >x : Symbol(x, Decl(ambiguousCallsWhereReturnTypesAgree.ts, 7, 15)) public foo(x: string[]): void; ->foo : Symbol(foo, Decl(ambiguousCallsWhereReturnTypesAgree.ts, 5, 5), Decl(ambiguousCallsWhereReturnTypesAgree.ts, 7, 32), Decl(ambiguousCallsWhereReturnTypesAgree.ts, 8, 34)) +>foo : Symbol(TestClass.foo, Decl(ambiguousCallsWhereReturnTypesAgree.ts, 5, 5), Decl(ambiguousCallsWhereReturnTypesAgree.ts, 7, 32), Decl(ambiguousCallsWhereReturnTypesAgree.ts, 8, 34)) >x : Symbol(x, Decl(ambiguousCallsWhereReturnTypesAgree.ts, 8, 15)) public foo(x: any): void { ->foo : Symbol(foo, Decl(ambiguousCallsWhereReturnTypesAgree.ts, 5, 5), Decl(ambiguousCallsWhereReturnTypesAgree.ts, 7, 32), Decl(ambiguousCallsWhereReturnTypesAgree.ts, 8, 34)) +>foo : Symbol(TestClass.foo, Decl(ambiguousCallsWhereReturnTypesAgree.ts, 5, 5), Decl(ambiguousCallsWhereReturnTypesAgree.ts, 7, 32), Decl(ambiguousCallsWhereReturnTypesAgree.ts, 8, 34)) >x : Symbol(x, Decl(ambiguousCallsWhereReturnTypesAgree.ts, 9, 15)) this.bar(x); // should not error ->this.bar : Symbol(bar, Decl(ambiguousCallsWhereReturnTypesAgree.ts, 0, 17), Decl(ambiguousCallsWhereReturnTypesAgree.ts, 1, 32), Decl(ambiguousCallsWhereReturnTypesAgree.ts, 2, 34)) +>this.bar : Symbol(TestClass.bar, Decl(ambiguousCallsWhereReturnTypesAgree.ts, 0, 17), Decl(ambiguousCallsWhereReturnTypesAgree.ts, 1, 32), Decl(ambiguousCallsWhereReturnTypesAgree.ts, 2, 34)) >this : Symbol(TestClass, Decl(ambiguousCallsWhereReturnTypesAgree.ts, 0, 0)) ->bar : Symbol(bar, Decl(ambiguousCallsWhereReturnTypesAgree.ts, 0, 17), Decl(ambiguousCallsWhereReturnTypesAgree.ts, 1, 32), Decl(ambiguousCallsWhereReturnTypesAgree.ts, 2, 34)) +>bar : Symbol(TestClass.bar, Decl(ambiguousCallsWhereReturnTypesAgree.ts, 0, 17), Decl(ambiguousCallsWhereReturnTypesAgree.ts, 1, 32), Decl(ambiguousCallsWhereReturnTypesAgree.ts, 2, 34)) >x : Symbol(x, Decl(ambiguousCallsWhereReturnTypesAgree.ts, 9, 15)) } } @@ -40,36 +40,36 @@ class TestClass2 { >TestClass2 : Symbol(TestClass2, Decl(ambiguousCallsWhereReturnTypesAgree.ts, 12, 1)) public bar(x: string): number; ->bar : Symbol(bar, Decl(ambiguousCallsWhereReturnTypesAgree.ts, 14, 18), Decl(ambiguousCallsWhereReturnTypesAgree.ts, 15, 34), Decl(ambiguousCallsWhereReturnTypesAgree.ts, 16, 36)) +>bar : Symbol(TestClass2.bar, Decl(ambiguousCallsWhereReturnTypesAgree.ts, 14, 18), Decl(ambiguousCallsWhereReturnTypesAgree.ts, 15, 34), Decl(ambiguousCallsWhereReturnTypesAgree.ts, 16, 36)) >x : Symbol(x, Decl(ambiguousCallsWhereReturnTypesAgree.ts, 15, 15)) public bar(x: string[]): number; ->bar : Symbol(bar, Decl(ambiguousCallsWhereReturnTypesAgree.ts, 14, 18), Decl(ambiguousCallsWhereReturnTypesAgree.ts, 15, 34), Decl(ambiguousCallsWhereReturnTypesAgree.ts, 16, 36)) +>bar : Symbol(TestClass2.bar, Decl(ambiguousCallsWhereReturnTypesAgree.ts, 14, 18), Decl(ambiguousCallsWhereReturnTypesAgree.ts, 15, 34), Decl(ambiguousCallsWhereReturnTypesAgree.ts, 16, 36)) >x : Symbol(x, Decl(ambiguousCallsWhereReturnTypesAgree.ts, 16, 15)) public bar(x: any): number { ->bar : Symbol(bar, Decl(ambiguousCallsWhereReturnTypesAgree.ts, 14, 18), Decl(ambiguousCallsWhereReturnTypesAgree.ts, 15, 34), Decl(ambiguousCallsWhereReturnTypesAgree.ts, 16, 36)) +>bar : Symbol(TestClass2.bar, Decl(ambiguousCallsWhereReturnTypesAgree.ts, 14, 18), Decl(ambiguousCallsWhereReturnTypesAgree.ts, 15, 34), Decl(ambiguousCallsWhereReturnTypesAgree.ts, 16, 36)) >x : Symbol(x, Decl(ambiguousCallsWhereReturnTypesAgree.ts, 17, 15)) return 0; } public foo(x: string): number; ->foo : Symbol(foo, Decl(ambiguousCallsWhereReturnTypesAgree.ts, 19, 5), Decl(ambiguousCallsWhereReturnTypesAgree.ts, 21, 34), Decl(ambiguousCallsWhereReturnTypesAgree.ts, 22, 36)) +>foo : Symbol(TestClass2.foo, Decl(ambiguousCallsWhereReturnTypesAgree.ts, 19, 5), Decl(ambiguousCallsWhereReturnTypesAgree.ts, 21, 34), Decl(ambiguousCallsWhereReturnTypesAgree.ts, 22, 36)) >x : Symbol(x, Decl(ambiguousCallsWhereReturnTypesAgree.ts, 21, 15)) public foo(x: string[]): number; ->foo : Symbol(foo, Decl(ambiguousCallsWhereReturnTypesAgree.ts, 19, 5), Decl(ambiguousCallsWhereReturnTypesAgree.ts, 21, 34), Decl(ambiguousCallsWhereReturnTypesAgree.ts, 22, 36)) +>foo : Symbol(TestClass2.foo, Decl(ambiguousCallsWhereReturnTypesAgree.ts, 19, 5), Decl(ambiguousCallsWhereReturnTypesAgree.ts, 21, 34), Decl(ambiguousCallsWhereReturnTypesAgree.ts, 22, 36)) >x : Symbol(x, Decl(ambiguousCallsWhereReturnTypesAgree.ts, 22, 15)) public foo(x: any): number { ->foo : Symbol(foo, Decl(ambiguousCallsWhereReturnTypesAgree.ts, 19, 5), Decl(ambiguousCallsWhereReturnTypesAgree.ts, 21, 34), Decl(ambiguousCallsWhereReturnTypesAgree.ts, 22, 36)) +>foo : Symbol(TestClass2.foo, Decl(ambiguousCallsWhereReturnTypesAgree.ts, 19, 5), Decl(ambiguousCallsWhereReturnTypesAgree.ts, 21, 34), Decl(ambiguousCallsWhereReturnTypesAgree.ts, 22, 36)) >x : Symbol(x, Decl(ambiguousCallsWhereReturnTypesAgree.ts, 23, 15)) return this.bar(x); // should not error ->this.bar : Symbol(bar, Decl(ambiguousCallsWhereReturnTypesAgree.ts, 14, 18), Decl(ambiguousCallsWhereReturnTypesAgree.ts, 15, 34), Decl(ambiguousCallsWhereReturnTypesAgree.ts, 16, 36)) +>this.bar : Symbol(TestClass2.bar, Decl(ambiguousCallsWhereReturnTypesAgree.ts, 14, 18), Decl(ambiguousCallsWhereReturnTypesAgree.ts, 15, 34), Decl(ambiguousCallsWhereReturnTypesAgree.ts, 16, 36)) >this : Symbol(TestClass2, Decl(ambiguousCallsWhereReturnTypesAgree.ts, 12, 1)) ->bar : Symbol(bar, Decl(ambiguousCallsWhereReturnTypesAgree.ts, 14, 18), Decl(ambiguousCallsWhereReturnTypesAgree.ts, 15, 34), Decl(ambiguousCallsWhereReturnTypesAgree.ts, 16, 36)) +>bar : Symbol(TestClass2.bar, Decl(ambiguousCallsWhereReturnTypesAgree.ts, 14, 18), Decl(ambiguousCallsWhereReturnTypesAgree.ts, 15, 34), Decl(ambiguousCallsWhereReturnTypesAgree.ts, 16, 36)) >x : Symbol(x, Decl(ambiguousCallsWhereReturnTypesAgree.ts, 23, 15)) } } diff --git a/tests/baselines/reference/ambiguousOverloadResolution.symbols b/tests/baselines/reference/ambiguousOverloadResolution.symbols index 1d848d707de..46711a1d142 100644 --- a/tests/baselines/reference/ambiguousOverloadResolution.symbols +++ b/tests/baselines/reference/ambiguousOverloadResolution.symbols @@ -5,7 +5,7 @@ class A { } class B extends A { x: number; } >B : Symbol(B, Decl(ambiguousOverloadResolution.ts, 0, 11)) >A : Symbol(A, Decl(ambiguousOverloadResolution.ts, 0, 0)) ->x : Symbol(x, Decl(ambiguousOverloadResolution.ts, 1, 19)) +>x : Symbol(B.x, Decl(ambiguousOverloadResolution.ts, 1, 19)) declare function f(p: A, q: B): number; >f : Symbol(f, Decl(ambiguousOverloadResolution.ts, 1, 32), Decl(ambiguousOverloadResolution.ts, 3, 39)) diff --git a/tests/baselines/reference/amdImportNotAsPrimaryExpression.symbols b/tests/baselines/reference/amdImportNotAsPrimaryExpression.symbols index 68a852c6165..ae67c0a3175 100644 --- a/tests/baselines/reference/amdImportNotAsPrimaryExpression.symbols +++ b/tests/baselines/reference/amdImportNotAsPrimaryExpression.symbols @@ -43,7 +43,7 @@ export class C1 { >C1 : Symbol(C1, Decl(foo_0.ts, 0, 0)) m1 = 42; ->m1 : Symbol(m1, Decl(foo_0.ts, 0, 17)) +>m1 : Symbol(C1.m1, Decl(foo_0.ts, 0, 17)) static s1 = true; >s1 : Symbol(C1.s1, Decl(foo_0.ts, 1, 9)) @@ -53,10 +53,10 @@ export interface I1 { >I1 : Symbol(I1, Decl(foo_0.ts, 3, 1)) name: string; ->name : Symbol(name, Decl(foo_0.ts, 5, 21)) +>name : Symbol(I1.name, Decl(foo_0.ts, 5, 21)) age: number; ->age : Symbol(age, Decl(foo_0.ts, 6, 14)) +>age : Symbol(I1.age, Decl(foo_0.ts, 6, 14)) } export module M1 { @@ -66,7 +66,7 @@ export module M1 { >I2 : Symbol(I2, Decl(foo_0.ts, 10, 18)) foo: string; ->foo : Symbol(foo, Decl(foo_0.ts, 11, 22)) +>foo : Symbol(I2.foo, Decl(foo_0.ts, 11, 22)) } } diff --git a/tests/baselines/reference/amdModuleName1.symbols b/tests/baselines/reference/amdModuleName1.symbols index 04f471dc2ad..d6e44acf93a 100644 --- a/tests/baselines/reference/amdModuleName1.symbols +++ b/tests/baselines/reference/amdModuleName1.symbols @@ -4,13 +4,13 @@ class Foo { >Foo : Symbol(Foo, Decl(amdModuleName1.ts, 0, 0)) x: number; ->x : Symbol(x, Decl(amdModuleName1.ts, 1, 11)) +>x : Symbol(Foo.x, Decl(amdModuleName1.ts, 1, 11)) constructor() { this.x = 5; ->this.x : Symbol(x, Decl(amdModuleName1.ts, 1, 11)) +>this.x : Symbol(Foo.x, Decl(amdModuleName1.ts, 1, 11)) >this : Symbol(Foo, Decl(amdModuleName1.ts, 0, 0)) ->x : Symbol(x, Decl(amdModuleName1.ts, 1, 11)) +>x : Symbol(Foo.x, Decl(amdModuleName1.ts, 1, 11)) } } export = Foo; diff --git a/tests/baselines/reference/anonterface.symbols b/tests/baselines/reference/anonterface.symbols index fccd48043cf..56d6b6a09b8 100644 --- a/tests/baselines/reference/anonterface.symbols +++ b/tests/baselines/reference/anonterface.symbols @@ -6,7 +6,7 @@ module M { >C : Symbol(C, Decl(anonterface.ts, 0, 10)) m(fn:{ (n:number):string; },n2:number):string { ->m : Symbol(m, Decl(anonterface.ts, 1, 20)) +>m : Symbol(C.m, Decl(anonterface.ts, 1, 20)) >fn : Symbol(fn, Decl(anonterface.ts, 2, 10)) >n : Symbol(n, Decl(anonterface.ts, 2, 16)) >n2 : Symbol(n2, Decl(anonterface.ts, 2, 36)) diff --git a/tests/baselines/reference/anonymousDefaultExportsSystem.js b/tests/baselines/reference/anonymousDefaultExportsSystem.js index 4ee7e2a11bc..f68806eb1af 100644 --- a/tests/baselines/reference/anonymousDefaultExportsSystem.js +++ b/tests/baselines/reference/anonymousDefaultExportsSystem.js @@ -7,21 +7,23 @@ export default class {} export default function() {} //// [a.js] -System.register([], function(exports_1, __moduleName) { +System.register([], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; var default_1; return { setters:[], execute: function() { - class default_1 { - } + default_1 = class { + }; exports_1("default", default_1); } } }); //// [b.js] -System.register([], function(exports_1, __moduleName) { +System.register([], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; function default_1() { } exports_1("default", default_1); return { diff --git a/tests/baselines/reference/anyAssignabilityInInheritance.symbols b/tests/baselines/reference/anyAssignabilityInInheritance.symbols index 50148d7df99..d1043256962 100644 --- a/tests/baselines/reference/anyAssignabilityInInheritance.symbols +++ b/tests/baselines/reference/anyAssignabilityInInheritance.symbols @@ -8,7 +8,7 @@ interface I { >x : Symbol(x, Decl(anyAssignabilityInInheritance.ts, 3, 5)) foo: any; // ok, any identical to itself ->foo : Symbol(foo, Decl(anyAssignabilityInInheritance.ts, 3, 21)) +>foo : Symbol(I.foo, Decl(anyAssignabilityInInheritance.ts, 3, 21)) } var a: any; @@ -56,8 +56,8 @@ var r3 = foo3(a); // any declare function foo5(x: Date): Date; >foo5 : Symbol(foo5, Decl(anyAssignabilityInInheritance.ts, 19, 17), Decl(anyAssignabilityInInheritance.ts, 21, 37)) >x : Symbol(x, Decl(anyAssignabilityInInheritance.ts, 21, 22)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) declare function foo5(x: any): any; >foo5 : Symbol(foo5, Decl(anyAssignabilityInInheritance.ts, 19, 17), Decl(anyAssignabilityInInheritance.ts, 21, 37)) @@ -113,7 +113,7 @@ var r3 = foo3(a); // any interface I8 { foo: string } >I8 : Symbol(I8, Decl(anyAssignabilityInInheritance.ts, 35, 17)) ->foo : Symbol(foo, Decl(anyAssignabilityInInheritance.ts, 37, 14)) +>foo : Symbol(I8.foo, Decl(anyAssignabilityInInheritance.ts, 37, 14)) declare function foo9(x: I8): I8; >foo9 : Symbol(foo9, Decl(anyAssignabilityInInheritance.ts, 37, 28), Decl(anyAssignabilityInInheritance.ts, 38, 33)) @@ -132,7 +132,7 @@ var r3 = foo3(a); // any class A { foo: number; } >A : Symbol(A, Decl(anyAssignabilityInInheritance.ts, 40, 17)) ->foo : Symbol(foo, Decl(anyAssignabilityInInheritance.ts, 42, 9)) +>foo : Symbol(A.foo, Decl(anyAssignabilityInInheritance.ts, 42, 9)) declare function foo10(x: A): A; >foo10 : Symbol(foo10, Decl(anyAssignabilityInInheritance.ts, 42, 24), Decl(anyAssignabilityInInheritance.ts, 43, 32)) @@ -152,7 +152,7 @@ var r3 = foo3(a); // any class A2 { foo: T; } >A2 : Symbol(A2, Decl(anyAssignabilityInInheritance.ts, 45, 17)) >T : Symbol(T, Decl(anyAssignabilityInInheritance.ts, 47, 9)) ->foo : Symbol(foo, Decl(anyAssignabilityInInheritance.ts, 47, 13)) +>foo : Symbol(A2.foo, Decl(anyAssignabilityInInheritance.ts, 47, 13)) >T : Symbol(T, Decl(anyAssignabilityInInheritance.ts, 47, 9)) declare function foo11(x: A2): A2; @@ -251,7 +251,7 @@ var r3 = foo3(a); // any class CC { baz: string } >CC : Symbol(CC, Decl(anyAssignabilityInInheritance.ts, 71, 17), Decl(anyAssignabilityInInheritance.ts, 73, 24)) ->baz : Symbol(baz, Decl(anyAssignabilityInInheritance.ts, 73, 10)) +>baz : Symbol(CC.baz, Decl(anyAssignabilityInInheritance.ts, 73, 10)) module CC { >CC : Symbol(CC, Decl(anyAssignabilityInInheritance.ts, 71, 17), Decl(anyAssignabilityInInheritance.ts, 73, 24)) diff --git a/tests/baselines/reference/anyAssignableToEveryType.symbols b/tests/baselines/reference/anyAssignableToEveryType.symbols index b1b2f87c050..4995a24a5c2 100644 --- a/tests/baselines/reference/anyAssignableToEveryType.symbols +++ b/tests/baselines/reference/anyAssignableToEveryType.symbols @@ -6,7 +6,7 @@ class C { >C : Symbol(C, Decl(anyAssignableToEveryType.ts, 0, 11)) foo: string; ->foo : Symbol(foo, Decl(anyAssignableToEveryType.ts, 2, 9)) +>foo : Symbol(C.foo, Decl(anyAssignableToEveryType.ts, 2, 9)) } var ac: C; >ac : Symbol(ac, Decl(anyAssignableToEveryType.ts, 5, 3)) @@ -16,7 +16,7 @@ interface I { >I : Symbol(I, Decl(anyAssignableToEveryType.ts, 5, 10)) foo: string; ->foo : Symbol(foo, Decl(anyAssignableToEveryType.ts, 6, 13)) +>foo : Symbol(I.foo, Decl(anyAssignableToEveryType.ts, 6, 13)) } var ai: I; >ai : Symbol(ai, Decl(anyAssignableToEveryType.ts, 9, 3)) @@ -44,7 +44,7 @@ var d: boolean = a; var e: Date = a; >e : Symbol(e, Decl(anyAssignableToEveryType.ts, 17, 3)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >a : Symbol(a, Decl(anyAssignableToEveryType.ts, 0, 3)) var f: any = a; @@ -109,12 +109,12 @@ var o: (x: T) => T = a; var p: Number = a; >p : Symbol(p, Decl(anyAssignableToEveryType.ts, 31, 3)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >a : Symbol(a, Decl(anyAssignableToEveryType.ts, 0, 3)) var q: String = a; >q : Symbol(q, Decl(anyAssignableToEveryType.ts, 32, 3)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >a : Symbol(a, Decl(anyAssignableToEveryType.ts, 0, 3)) function foo(x: T, y: U, z: V) { @@ -122,7 +122,7 @@ function foo(x: T, y: U, z: V) { >T : Symbol(T, Decl(anyAssignableToEveryType.ts, 34, 13)) >U : Symbol(U, Decl(anyAssignableToEveryType.ts, 34, 15)) >V : Symbol(V, Decl(anyAssignableToEveryType.ts, 34, 32)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(anyAssignableToEveryType.ts, 34, 49)) >T : Symbol(T, Decl(anyAssignableToEveryType.ts, 34, 13)) >y : Symbol(y, Decl(anyAssignableToEveryType.ts, 34, 54)) diff --git a/tests/baselines/reference/anyAssignableToEveryType2.symbols b/tests/baselines/reference/anyAssignableToEveryType2.symbols index 9984a3f2fb8..12d380aa368 100644 --- a/tests/baselines/reference/anyAssignableToEveryType2.symbols +++ b/tests/baselines/reference/anyAssignableToEveryType2.symbols @@ -8,7 +8,7 @@ interface I { >x : Symbol(x, Decl(anyAssignableToEveryType2.ts, 3, 5)) foo: any; // ok, any identical to itself ->foo : Symbol(foo, Decl(anyAssignableToEveryType2.ts, 3, 21)) +>foo : Symbol(I.foo, Decl(anyAssignableToEveryType2.ts, 3, 21)) } @@ -19,7 +19,7 @@ interface I2 { >x : Symbol(x, Decl(anyAssignableToEveryType2.ts, 9, 5)) foo: any; ->foo : Symbol(foo, Decl(anyAssignableToEveryType2.ts, 9, 24)) +>foo : Symbol(I2.foo, Decl(anyAssignableToEveryType2.ts, 9, 24)) } @@ -30,7 +30,7 @@ interface I3 { >x : Symbol(x, Decl(anyAssignableToEveryType2.ts, 15, 5)) foo: any; ->foo : Symbol(foo, Decl(anyAssignableToEveryType2.ts, 15, 24)) +>foo : Symbol(I3.foo, Decl(anyAssignableToEveryType2.ts, 15, 24)) } @@ -41,7 +41,7 @@ interface I4 { >x : Symbol(x, Decl(anyAssignableToEveryType2.ts, 21, 5)) foo: any; ->foo : Symbol(foo, Decl(anyAssignableToEveryType2.ts, 21, 25)) +>foo : Symbol(I4.foo, Decl(anyAssignableToEveryType2.ts, 21, 25)) } @@ -50,10 +50,10 @@ interface I5 { [x: string]: Date; >x : Symbol(x, Decl(anyAssignableToEveryType2.ts, 27, 5)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) foo: any; ->foo : Symbol(foo, Decl(anyAssignableToEveryType2.ts, 27, 22)) +>foo : Symbol(I5.foo, Decl(anyAssignableToEveryType2.ts, 27, 22)) } @@ -65,7 +65,7 @@ interface I6 { >RegExp : Symbol(RegExp, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) foo: any; ->foo : Symbol(foo, Decl(anyAssignableToEveryType2.ts, 33, 24)) +>foo : Symbol(I6.foo, Decl(anyAssignableToEveryType2.ts, 33, 24)) } @@ -77,7 +77,7 @@ interface I7 { >bar : Symbol(bar, Decl(anyAssignableToEveryType2.ts, 39, 18)) foo: any; ->foo : Symbol(foo, Decl(anyAssignableToEveryType2.ts, 39, 33)) +>foo : Symbol(I7.foo, Decl(anyAssignableToEveryType2.ts, 39, 33)) } @@ -88,7 +88,7 @@ interface I8 { >x : Symbol(x, Decl(anyAssignableToEveryType2.ts, 45, 5)) foo: any; ->foo : Symbol(foo, Decl(anyAssignableToEveryType2.ts, 45, 26)) +>foo : Symbol(I8.foo, Decl(anyAssignableToEveryType2.ts, 45, 26)) } @@ -100,12 +100,12 @@ interface I9 { >I8 : Symbol(I8, Decl(anyAssignableToEveryType2.ts, 41, 1)) foo: any; ->foo : Symbol(foo, Decl(anyAssignableToEveryType2.ts, 51, 20)) +>foo : Symbol(I9.foo, Decl(anyAssignableToEveryType2.ts, 51, 20)) } class A { foo: number; } >A : Symbol(A, Decl(anyAssignableToEveryType2.ts, 53, 1)) ->foo : Symbol(foo, Decl(anyAssignableToEveryType2.ts, 55, 9)) +>foo : Symbol(A.foo, Decl(anyAssignableToEveryType2.ts, 55, 9)) interface I10 { >I10 : Symbol(I10, Decl(anyAssignableToEveryType2.ts, 55, 24)) @@ -115,13 +115,13 @@ interface I10 { >A : Symbol(A, Decl(anyAssignableToEveryType2.ts, 53, 1)) foo: any; ->foo : Symbol(foo, Decl(anyAssignableToEveryType2.ts, 57, 19)) +>foo : Symbol(I10.foo, Decl(anyAssignableToEveryType2.ts, 57, 19)) } class A2 { foo: T; } >A2 : Symbol(A2, Decl(anyAssignableToEveryType2.ts, 59, 1)) >T : Symbol(T, Decl(anyAssignableToEveryType2.ts, 61, 9)) ->foo : Symbol(foo, Decl(anyAssignableToEveryType2.ts, 61, 13)) +>foo : Symbol(A2.foo, Decl(anyAssignableToEveryType2.ts, 61, 13)) >T : Symbol(T, Decl(anyAssignableToEveryType2.ts, 61, 9)) interface I11 { @@ -132,7 +132,7 @@ interface I11 { >A2 : Symbol(A2, Decl(anyAssignableToEveryType2.ts, 59, 1)) foo: any; ->foo : Symbol(foo, Decl(anyAssignableToEveryType2.ts, 63, 28)) +>foo : Symbol(I11.foo, Decl(anyAssignableToEveryType2.ts, 63, 28)) } @@ -144,7 +144,7 @@ interface I12 { >x : Symbol(x, Decl(anyAssignableToEveryType2.ts, 69, 18)) foo: any; ->foo : Symbol(foo, Decl(anyAssignableToEveryType2.ts, 69, 31)) +>foo : Symbol(I12.foo, Decl(anyAssignableToEveryType2.ts, 69, 31)) } @@ -159,7 +159,7 @@ interface I13 { >T : Symbol(T, Decl(anyAssignableToEveryType2.ts, 75, 18)) foo: any; ->foo : Symbol(foo, Decl(anyAssignableToEveryType2.ts, 75, 32)) +>foo : Symbol(I13.foo, Decl(anyAssignableToEveryType2.ts, 75, 32)) } @@ -175,7 +175,7 @@ interface I14 { >E : Symbol(E, Decl(anyAssignableToEveryType2.ts, 77, 1)) foo: any; ->foo : Symbol(foo, Decl(anyAssignableToEveryType2.ts, 82, 19)) +>foo : Symbol(I14.foo, Decl(anyAssignableToEveryType2.ts, 82, 19)) } @@ -196,13 +196,13 @@ interface I15 { >f : Symbol(f, Decl(anyAssignableToEveryType2.ts, 84, 1), Decl(anyAssignableToEveryType2.ts, 87, 16)) foo: any; ->foo : Symbol(foo, Decl(anyAssignableToEveryType2.ts, 92, 26)) +>foo : Symbol(I15.foo, Decl(anyAssignableToEveryType2.ts, 92, 26)) } class c { baz: string } >c : Symbol(c, Decl(anyAssignableToEveryType2.ts, 94, 1), Decl(anyAssignableToEveryType2.ts, 97, 23)) ->baz : Symbol(baz, Decl(anyAssignableToEveryType2.ts, 97, 9)) +>baz : Symbol(c.baz, Decl(anyAssignableToEveryType2.ts, 97, 9)) module c { >c : Symbol(c, Decl(anyAssignableToEveryType2.ts, 94, 1), Decl(anyAssignableToEveryType2.ts, 97, 23)) @@ -218,7 +218,7 @@ interface I16 { >c : Symbol(c, Decl(anyAssignableToEveryType2.ts, 94, 1), Decl(anyAssignableToEveryType2.ts, 97, 23)) foo: any; ->foo : Symbol(foo, Decl(anyAssignableToEveryType2.ts, 102, 26)) +>foo : Symbol(I16.foo, Decl(anyAssignableToEveryType2.ts, 102, 26)) } @@ -231,7 +231,7 @@ interface I17 { >T : Symbol(T, Decl(anyAssignableToEveryType2.ts, 107, 14)) foo: any; ->foo : Symbol(foo, Decl(anyAssignableToEveryType2.ts, 108, 19)) +>foo : Symbol(I17.foo, Decl(anyAssignableToEveryType2.ts, 108, 19)) } @@ -246,7 +246,7 @@ interface I18 { >U : Symbol(U, Decl(anyAssignableToEveryType2.ts, 113, 16)) foo: any; ->foo : Symbol(foo, Decl(anyAssignableToEveryType2.ts, 114, 19)) +>foo : Symbol(I18.foo, Decl(anyAssignableToEveryType2.ts, 114, 19)) } @@ -258,7 +258,7 @@ interface I19 { >Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) foo: any; ->foo : Symbol(foo, Decl(anyAssignableToEveryType2.ts, 120, 24)) +>foo : Symbol(I19.foo, Decl(anyAssignableToEveryType2.ts, 120, 24)) } @@ -269,6 +269,6 @@ interface I20 { >x : Symbol(x, Decl(anyAssignableToEveryType2.ts, 126, 5)) foo: any; ->foo : Symbol(foo, Decl(anyAssignableToEveryType2.ts, 126, 20)) +>foo : Symbol(I20.foo, Decl(anyAssignableToEveryType2.ts, 126, 20)) } diff --git a/tests/baselines/reference/anyIsAssignableToObject.symbols b/tests/baselines/reference/anyIsAssignableToObject.symbols index a9650fa58b8..15478466d5b 100644 --- a/tests/baselines/reference/anyIsAssignableToObject.symbols +++ b/tests/baselines/reference/anyIsAssignableToObject.symbols @@ -3,7 +3,7 @@ interface P { >P : Symbol(P, Decl(anyIsAssignableToObject.ts, 0, 0)) p: {}; ->p : Symbol(p, Decl(anyIsAssignableToObject.ts, 0, 13)) +>p : Symbol(P.p, Decl(anyIsAssignableToObject.ts, 0, 13)) } interface Q extends P { // Check assignability here. Any is assignable to {} @@ -11,5 +11,5 @@ interface Q extends P { // Check assignability here. Any is assignable to {} >P : Symbol(P, Decl(anyIsAssignableToObject.ts, 0, 0)) p: any; ->p : Symbol(p, Decl(anyIsAssignableToObject.ts, 4, 23)) +>p : Symbol(Q.p, Decl(anyIsAssignableToObject.ts, 4, 23)) } diff --git a/tests/baselines/reference/anyIsAssignableToVoid.symbols b/tests/baselines/reference/anyIsAssignableToVoid.symbols index f5ee5ce7b23..50545c05d56 100644 --- a/tests/baselines/reference/anyIsAssignableToVoid.symbols +++ b/tests/baselines/reference/anyIsAssignableToVoid.symbols @@ -3,7 +3,7 @@ interface P { >P : Symbol(P, Decl(anyIsAssignableToVoid.ts, 0, 0)) p: void; ->p : Symbol(p, Decl(anyIsAssignableToVoid.ts, 0, 13)) +>p : Symbol(P.p, Decl(anyIsAssignableToVoid.ts, 0, 13)) } interface Q extends P { // check assignability here. any is assignable to void. @@ -11,5 +11,5 @@ interface Q extends P { // check assignability here. any is assignable to void. >P : Symbol(P, Decl(anyIsAssignableToVoid.ts, 0, 0)) p: any; ->p : Symbol(p, Decl(anyIsAssignableToVoid.ts, 4, 23)) +>p : Symbol(Q.p, Decl(anyIsAssignableToVoid.ts, 4, 23)) } diff --git a/tests/baselines/reference/argsInScope.symbols b/tests/baselines/reference/argsInScope.symbols index 6faf88facd9..1c91e2bdd73 100644 --- a/tests/baselines/reference/argsInScope.symbols +++ b/tests/baselines/reference/argsInScope.symbols @@ -3,7 +3,7 @@ class C { >C : Symbol(C, Decl(argsInScope.ts, 0, 0)) P(ii:number, j:number, k:number) { ->P : Symbol(P, Decl(argsInScope.ts, 0, 9)) +>P : Symbol(C.P, Decl(argsInScope.ts, 0, 9)) >ii : Symbol(ii, Decl(argsInScope.ts, 1, 6)) >j : Symbol(j, Decl(argsInScope.ts, 1, 16)) >k : Symbol(k, Decl(argsInScope.ts, 1, 26)) diff --git a/tests/baselines/reference/argumentsBindsToFunctionScopeArgumentList.errors.txt b/tests/baselines/reference/argumentsBindsToFunctionScopeArgumentList.errors.txt index 812bbe15da4..89ef8ded91c 100644 --- a/tests/baselines/reference/argumentsBindsToFunctionScopeArgumentList.errors.txt +++ b/tests/baselines/reference/argumentsBindsToFunctionScopeArgumentList.errors.txt @@ -1,5 +1,4 @@ tests/cases/compiler/argumentsBindsToFunctionScopeArgumentList.ts(3,5): error TS2322: Type 'number' is not assignable to type 'IArguments'. - Property 'length' is missing in type 'Number'. ==== tests/cases/compiler/argumentsBindsToFunctionScopeArgumentList.ts (1 errors) ==== @@ -8,5 +7,4 @@ tests/cases/compiler/argumentsBindsToFunctionScopeArgumentList.ts(3,5): error TS arguments = 10; /// This shouldnt be of type number and result in error. ~~~~~~~~~ !!! error TS2322: Type 'number' is not assignable to type 'IArguments'. -!!! error TS2322: Property 'length' is missing in type 'Number'. } \ No newline at end of file diff --git a/tests/baselines/reference/argumentsObjectIterator01_ES6.symbols b/tests/baselines/reference/argumentsObjectIterator01_ES6.symbols index d2d05cf3132..384b4458b2f 100644 --- a/tests/baselines/reference/argumentsObjectIterator01_ES6.symbols +++ b/tests/baselines/reference/argumentsObjectIterator01_ES6.symbols @@ -14,9 +14,9 @@ function doubleAndReturnAsArray(x: number, y: number, z: number): [number, numbe >arguments : Symbol(arguments) result.push(arg + arg); ->result.push : Symbol(Array.push, Decl(lib.d.ts, --, --)) +>result.push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --)) >result : Symbol(result, Decl(argumentsObjectIterator01_ES6.ts, 2, 7)) ->push : Symbol(Array.push, Decl(lib.d.ts, --, --)) +>push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --)) >arg : Symbol(arg, Decl(argumentsObjectIterator01_ES6.ts, 3, 12)) >arg : Symbol(arg, Decl(argumentsObjectIterator01_ES6.ts, 3, 12)) } diff --git a/tests/baselines/reference/argumentsObjectIterator02_ES6.symbols b/tests/baselines/reference/argumentsObjectIterator02_ES6.symbols index 7a4e75de66b..974d668bc1f 100644 --- a/tests/baselines/reference/argumentsObjectIterator02_ES6.symbols +++ b/tests/baselines/reference/argumentsObjectIterator02_ES6.symbols @@ -9,9 +9,9 @@ function doubleAndReturnAsArray(x: number, y: number, z: number): [number, numbe let blah = arguments[Symbol.iterator]; >blah : Symbol(blah, Decl(argumentsObjectIterator02_ES6.ts, 2, 7)) >arguments : Symbol(arguments) ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) let result = []; >result : Symbol(result, Decl(argumentsObjectIterator02_ES6.ts, 4, 7)) @@ -21,9 +21,9 @@ function doubleAndReturnAsArray(x: number, y: number, z: number): [number, numbe >blah : Symbol(blah, Decl(argumentsObjectIterator02_ES6.ts, 2, 7)) result.push(arg + arg); ->result.push : Symbol(Array.push, Decl(lib.d.ts, --, --)) +>result.push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --)) >result : Symbol(result, Decl(argumentsObjectIterator02_ES6.ts, 4, 7)) ->push : Symbol(Array.push, Decl(lib.d.ts, --, --)) +>push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --)) >arg : Symbol(arg, Decl(argumentsObjectIterator02_ES6.ts, 5, 12)) >arg : Symbol(arg, Decl(argumentsObjectIterator02_ES6.ts, 5, 12)) } diff --git a/tests/baselines/reference/arrayAssignmentTest1.errors.txt b/tests/baselines/reference/arrayAssignmentTest1.errors.txt index d3a7fafed05..3cce5658c13 100644 --- a/tests/baselines/reference/arrayAssignmentTest1.errors.txt +++ b/tests/baselines/reference/arrayAssignmentTest1.errors.txt @@ -26,10 +26,13 @@ tests/cases/compiler/arrayAssignmentTest1.ts(70,1): error TS2322: Type 'C3[]' is Property 'C2M1' is missing in type 'C3'. tests/cases/compiler/arrayAssignmentTest1.ts(75,1): error TS2322: Type 'C2[]' is not assignable to type 'C3[]'. Type 'C2' is not assignable to type 'C3'. + Property 'CM3M1' is missing in type 'C2'. tests/cases/compiler/arrayAssignmentTest1.ts(76,1): error TS2322: Type 'C1[]' is not assignable to type 'C3[]'. Type 'C1' is not assignable to type 'C3'. + Property 'CM3M1' is missing in type 'C1'. tests/cases/compiler/arrayAssignmentTest1.ts(77,1): error TS2322: Type 'I1[]' is not assignable to type 'C3[]'. Type 'I1' is not assignable to type 'C3'. + Property 'CM3M1' is missing in type 'I1'. tests/cases/compiler/arrayAssignmentTest1.ts(79,1): error TS2322: Type '() => C1' is not assignable to type 'any[]'. Property 'push' is missing in type '() => C1'. tests/cases/compiler/arrayAssignmentTest1.ts(80,1): error TS2322: Type '{ one: number; }' is not assignable to type 'any[]'. @@ -159,14 +162,17 @@ tests/cases/compiler/arrayAssignmentTest1.ts(85,1): error TS2322: Type 'I1' is n ~~~~~~ !!! error TS2322: Type 'C2[]' is not assignable to type 'C3[]'. !!! error TS2322: Type 'C2' is not assignable to type 'C3'. +!!! error TS2322: Property 'CM3M1' is missing in type 'C2'. arr_c3 = arr_c1_2; // should be an error - is ~~~~~~ !!! error TS2322: Type 'C1[]' is not assignable to type 'C3[]'. !!! error TS2322: Type 'C1' is not assignable to type 'C3'. +!!! error TS2322: Property 'CM3M1' is missing in type 'C1'. arr_c3 = arr_i1_2; // should be an error - is ~~~~~~ !!! error TS2322: Type 'I1[]' is not assignable to type 'C3[]'. !!! error TS2322: Type 'I1' is not assignable to type 'C3'. +!!! error TS2322: Property 'CM3M1' is missing in type 'I1'. arr_any = f1; // should be an error - is ~~~~~~~ diff --git a/tests/baselines/reference/arrayAssignmentTest6.symbols b/tests/baselines/reference/arrayAssignmentTest6.symbols index c4d4ba76a5f..a224f260625 100644 --- a/tests/baselines/reference/arrayAssignmentTest6.symbols +++ b/tests/baselines/reference/arrayAssignmentTest6.symbols @@ -9,24 +9,24 @@ module Test { >IToken : Symbol(IToken, Decl(arrayAssignmentTest6.ts, 2, 5)) startIndex: number; ->startIndex : Symbol(startIndex, Decl(arrayAssignmentTest6.ts, 3, 22)) +>startIndex : Symbol(IToken.startIndex, Decl(arrayAssignmentTest6.ts, 3, 22)) } interface ILineTokens { >ILineTokens : Symbol(ILineTokens, Decl(arrayAssignmentTest6.ts, 5, 5)) tokens: IToken[]; ->tokens : Symbol(tokens, Decl(arrayAssignmentTest6.ts, 6, 27)) +>tokens : Symbol(ILineTokens.tokens, Decl(arrayAssignmentTest6.ts, 6, 27)) >IToken : Symbol(IToken, Decl(arrayAssignmentTest6.ts, 2, 5)) endState: IState; ->endState : Symbol(endState, Decl(arrayAssignmentTest6.ts, 7, 25)) +>endState : Symbol(ILineTokens.endState, Decl(arrayAssignmentTest6.ts, 7, 25)) >IState : Symbol(IState, Decl(arrayAssignmentTest6.ts, 0, 13)) } interface IMode { >IMode : Symbol(IMode, Decl(arrayAssignmentTest6.ts, 9, 5)) tokenize(line:string, state:IState, includeStates:boolean):ILineTokens; ->tokenize : Symbol(tokenize, Decl(arrayAssignmentTest6.ts, 10, 21)) +>tokenize : Symbol(IMode.tokenize, Decl(arrayAssignmentTest6.ts, 10, 21)) >line : Symbol(line, Decl(arrayAssignmentTest6.ts, 11, 17)) >state : Symbol(state, Decl(arrayAssignmentTest6.ts, 11, 29)) >IState : Symbol(IState, Decl(arrayAssignmentTest6.ts, 0, 13)) @@ -38,7 +38,7 @@ module Test { >IMode : Symbol(IMode, Decl(arrayAssignmentTest6.ts, 9, 5)) public tokenize(line:string, tokens:IToken[], includeStates:boolean):ILineTokens { ->tokenize : Symbol(tokenize, Decl(arrayAssignmentTest6.ts, 13, 39)) +>tokenize : Symbol(Bug.tokenize, Decl(arrayAssignmentTest6.ts, 13, 39)) >line : Symbol(line, Decl(arrayAssignmentTest6.ts, 14, 24)) >tokens : Symbol(tokens, Decl(arrayAssignmentTest6.ts, 14, 36)) >IToken : Symbol(IToken, Decl(arrayAssignmentTest6.ts, 2, 5)) diff --git a/tests/baselines/reference/arrayAugment.symbols b/tests/baselines/reference/arrayAugment.symbols index 90a506077ad..5ba92ca07e1 100644 --- a/tests/baselines/reference/arrayAugment.symbols +++ b/tests/baselines/reference/arrayAugment.symbols @@ -4,7 +4,7 @@ interface Array { >T : Symbol(T, Decl(lib.d.ts, --, --), Decl(arrayAugment.ts, 0, 16)) split: (parts: number) => T[][]; ->split : Symbol(split, Decl(arrayAugment.ts, 0, 20)) +>split : Symbol(Array.split, Decl(arrayAugment.ts, 0, 20)) >parts : Symbol(parts, Decl(arrayAugment.ts, 1, 12)) >T : Symbol(T, Decl(lib.d.ts, --, --), Decl(arrayAugment.ts, 0, 16)) } diff --git a/tests/baselines/reference/arrayBestCommonTypes.symbols b/tests/baselines/reference/arrayBestCommonTypes.symbols index c4b42f66991..fc7d10261e8 100644 --- a/tests/baselines/reference/arrayBestCommonTypes.symbols +++ b/tests/baselines/reference/arrayBestCommonTypes.symbols @@ -22,98 +22,98 @@ module EmptyTypes { >f : Symbol(f, Decl(arrayBestCommonTypes.ts, 4, 34)) public voidIfAny(x: boolean, y?: boolean): number; ->voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57)) +>voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57)) >x : Symbol(x, Decl(arrayBestCommonTypes.ts, 8, 25)) >y : Symbol(y, Decl(arrayBestCommonTypes.ts, 8, 36)) public voidIfAny(x: string, y?: boolean): number; ->voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57)) +>voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57)) >x : Symbol(x, Decl(arrayBestCommonTypes.ts, 9, 25)) >y : Symbol(y, Decl(arrayBestCommonTypes.ts, 9, 35)) public voidIfAny(x: number, y?: boolean): number; ->voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57)) +>voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57)) >x : Symbol(x, Decl(arrayBestCommonTypes.ts, 10, 25)) >y : Symbol(y, Decl(arrayBestCommonTypes.ts, 10, 35)) public voidIfAny(x: any, y = false): any { return null; } ->voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57)) +>voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57)) >x : Symbol(x, Decl(arrayBestCommonTypes.ts, 11, 25)) >y : Symbol(y, Decl(arrayBestCommonTypes.ts, 11, 32)) public x() { ->x : Symbol(x, Decl(arrayBestCommonTypes.ts, 11, 65)) +>x : Symbol(f.x, Decl(arrayBestCommonTypes.ts, 11, 65)) (this.voidIfAny([4, 2][0])); ->this.voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57)) +>this.voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57)) >this : Symbol(f, Decl(arrayBestCommonTypes.ts, 4, 34)) ->voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57)) +>voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57)) (this.voidIfAny([4, 2, undefined][0])); ->this.voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57)) +>this.voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57)) >this : Symbol(f, Decl(arrayBestCommonTypes.ts, 4, 34)) ->voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57)) +>voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57)) >undefined : Symbol(undefined) (this.voidIfAny([undefined, 2, 4][0])); ->this.voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57)) +>this.voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57)) >this : Symbol(f, Decl(arrayBestCommonTypes.ts, 4, 34)) ->voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57)) +>voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57)) >undefined : Symbol(undefined) (this.voidIfAny([null, 2, 4][0])); ->this.voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57)) +>this.voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57)) >this : Symbol(f, Decl(arrayBestCommonTypes.ts, 4, 34)) ->voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57)) +>voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57)) (this.voidIfAny([2, 4, null][0])); ->this.voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57)) +>this.voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57)) >this : Symbol(f, Decl(arrayBestCommonTypes.ts, 4, 34)) ->voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57)) +>voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57)) (this.voidIfAny([undefined, 4, null][0])); ->this.voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57)) +>this.voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57)) >this : Symbol(f, Decl(arrayBestCommonTypes.ts, 4, 34)) ->voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57)) +>voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57)) >undefined : Symbol(undefined) (this.voidIfAny(['', "q"][0])); ->this.voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57)) +>this.voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57)) >this : Symbol(f, Decl(arrayBestCommonTypes.ts, 4, 34)) ->voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57)) +>voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57)) (this.voidIfAny(['', "q", undefined][0])); ->this.voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57)) +>this.voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57)) >this : Symbol(f, Decl(arrayBestCommonTypes.ts, 4, 34)) ->voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57)) +>voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57)) >undefined : Symbol(undefined) (this.voidIfAny([undefined, "q", ''][0])); ->this.voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57)) +>this.voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57)) >this : Symbol(f, Decl(arrayBestCommonTypes.ts, 4, 34)) ->voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57)) +>voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57)) >undefined : Symbol(undefined) (this.voidIfAny([null, "q", ''][0])); ->this.voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57)) +>this.voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57)) >this : Symbol(f, Decl(arrayBestCommonTypes.ts, 4, 34)) ->voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57)) +>voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57)) (this.voidIfAny(["q", '', null][0])); ->this.voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57)) +>this.voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57)) >this : Symbol(f, Decl(arrayBestCommonTypes.ts, 4, 34)) ->voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57)) +>voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57)) (this.voidIfAny([undefined, '', null][0])); ->this.voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57)) +>this.voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57)) >this : Symbol(f, Decl(arrayBestCommonTypes.ts, 4, 34)) ->voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57)) +>voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57)) >undefined : Symbol(undefined) (this.voidIfAny([[3, 4], [null]][0][0])); ->this.voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57)) +>this.voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57)) >this : Symbol(f, Decl(arrayBestCommonTypes.ts, 4, 34)) ->voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57)) +>voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57)) var t1: { x: number; y: base; }[] = [{ x: 7, y: new derived() }, { x: 5, y: new base() }]; @@ -231,122 +231,122 @@ module NonEmptyTypes { interface iface { x: string; } >iface : Symbol(iface, Decl(arrayBestCommonTypes.ts, 53, 22)) ->x : Symbol(x, Decl(arrayBestCommonTypes.ts, 54, 21)) +>x : Symbol(iface.x, Decl(arrayBestCommonTypes.ts, 54, 21)) class base implements iface { x: string; y: string; } >base : Symbol(base, Decl(arrayBestCommonTypes.ts, 54, 34)) >iface : Symbol(iface, Decl(arrayBestCommonTypes.ts, 53, 22)) ->x : Symbol(x, Decl(arrayBestCommonTypes.ts, 55, 33)) ->y : Symbol(y, Decl(arrayBestCommonTypes.ts, 55, 44)) +>x : Symbol(base.x, Decl(arrayBestCommonTypes.ts, 55, 33)) +>y : Symbol(base.y, Decl(arrayBestCommonTypes.ts, 55, 44)) class base2 implements iface { x: string; z: string; } >base2 : Symbol(base2, Decl(arrayBestCommonTypes.ts, 55, 57)) >iface : Symbol(iface, Decl(arrayBestCommonTypes.ts, 53, 22)) ->x : Symbol(x, Decl(arrayBestCommonTypes.ts, 56, 34)) ->z : Symbol(z, Decl(arrayBestCommonTypes.ts, 56, 45)) +>x : Symbol(base2.x, Decl(arrayBestCommonTypes.ts, 56, 34)) +>z : Symbol(base2.z, Decl(arrayBestCommonTypes.ts, 56, 45)) class derived extends base { a: string; } >derived : Symbol(derived, Decl(arrayBestCommonTypes.ts, 56, 58)) >base : Symbol(base, Decl(arrayBestCommonTypes.ts, 54, 34)) ->a : Symbol(a, Decl(arrayBestCommonTypes.ts, 57, 32)) +>a : Symbol(derived.a, Decl(arrayBestCommonTypes.ts, 57, 32)) class f { >f : Symbol(f, Decl(arrayBestCommonTypes.ts, 57, 45)) public voidIfAny(x: boolean, y?: boolean): number; ->voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57)) +>voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57)) >x : Symbol(x, Decl(arrayBestCommonTypes.ts, 61, 25)) >y : Symbol(y, Decl(arrayBestCommonTypes.ts, 61, 36)) public voidIfAny(x: string, y?: boolean): number; ->voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57)) +>voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57)) >x : Symbol(x, Decl(arrayBestCommonTypes.ts, 62, 25)) >y : Symbol(y, Decl(arrayBestCommonTypes.ts, 62, 35)) public voidIfAny(x: number, y?: boolean): number; ->voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57)) +>voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57)) >x : Symbol(x, Decl(arrayBestCommonTypes.ts, 63, 25)) >y : Symbol(y, Decl(arrayBestCommonTypes.ts, 63, 35)) public voidIfAny(x: any, y = false): any { return null; } ->voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57)) +>voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57)) >x : Symbol(x, Decl(arrayBestCommonTypes.ts, 64, 25)) >y : Symbol(y, Decl(arrayBestCommonTypes.ts, 64, 32)) public x() { ->x : Symbol(x, Decl(arrayBestCommonTypes.ts, 64, 65)) +>x : Symbol(f.x, Decl(arrayBestCommonTypes.ts, 64, 65)) (this.voidIfAny([4, 2][0])); ->this.voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57)) +>this.voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57)) >this : Symbol(f, Decl(arrayBestCommonTypes.ts, 57, 45)) ->voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57)) +>voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57)) (this.voidIfAny([4, 2, undefined][0])); ->this.voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57)) +>this.voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57)) >this : Symbol(f, Decl(arrayBestCommonTypes.ts, 57, 45)) ->voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57)) +>voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57)) >undefined : Symbol(undefined) (this.voidIfAny([undefined, 2, 4][0])); ->this.voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57)) +>this.voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57)) >this : Symbol(f, Decl(arrayBestCommonTypes.ts, 57, 45)) ->voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57)) +>voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57)) >undefined : Symbol(undefined) (this.voidIfAny([null, 2, 4][0])); ->this.voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57)) +>this.voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57)) >this : Symbol(f, Decl(arrayBestCommonTypes.ts, 57, 45)) ->voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57)) +>voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57)) (this.voidIfAny([2, 4, null][0])); ->this.voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57)) +>this.voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57)) >this : Symbol(f, Decl(arrayBestCommonTypes.ts, 57, 45)) ->voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57)) +>voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57)) (this.voidIfAny([undefined, 4, null][0])); ->this.voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57)) +>this.voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57)) >this : Symbol(f, Decl(arrayBestCommonTypes.ts, 57, 45)) ->voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57)) +>voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57)) >undefined : Symbol(undefined) (this.voidIfAny(['', "q"][0])); ->this.voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57)) +>this.voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57)) >this : Symbol(f, Decl(arrayBestCommonTypes.ts, 57, 45)) ->voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57)) +>voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57)) (this.voidIfAny(['', "q", undefined][0])); ->this.voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57)) +>this.voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57)) >this : Symbol(f, Decl(arrayBestCommonTypes.ts, 57, 45)) ->voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57)) +>voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57)) >undefined : Symbol(undefined) (this.voidIfAny([undefined, "q", ''][0])); ->this.voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57)) +>this.voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57)) >this : Symbol(f, Decl(arrayBestCommonTypes.ts, 57, 45)) ->voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57)) +>voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57)) >undefined : Symbol(undefined) (this.voidIfAny([null, "q", ''][0])); ->this.voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57)) +>this.voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57)) >this : Symbol(f, Decl(arrayBestCommonTypes.ts, 57, 45)) ->voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57)) +>voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57)) (this.voidIfAny(["q", '', null][0])); ->this.voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57)) +>this.voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57)) >this : Symbol(f, Decl(arrayBestCommonTypes.ts, 57, 45)) ->voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57)) +>voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57)) (this.voidIfAny([undefined, '', null][0])); ->this.voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57)) +>this.voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57)) >this : Symbol(f, Decl(arrayBestCommonTypes.ts, 57, 45)) ->voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57)) +>voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57)) >undefined : Symbol(undefined) (this.voidIfAny([[3, 4], [null]][0][0])); ->this.voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57)) +>this.voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57)) >this : Symbol(f, Decl(arrayBestCommonTypes.ts, 57, 45)) ->voidIfAny : Symbol(voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57)) +>voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57)) var t1: { x: number; y: base; }[] = [{ x: 7, y: new derived() }, { x: 5, y: new base() }]; diff --git a/tests/baselines/reference/arrayBindingPatternOmittedExpressions.types b/tests/baselines/reference/arrayBindingPatternOmittedExpressions.types index e83aa6a17de..77db8cc250d 100644 --- a/tests/baselines/reference/arrayBindingPatternOmittedExpressions.types +++ b/tests/baselines/reference/arrayBindingPatternOmittedExpressions.types @@ -25,7 +25,7 @@ var results: string[]; function f([, a, , b, , , , s, , , ] = results) { ->f : ([, a, , b, , , , s, , , ]?: string[]) => void +>f : ([, a, , b, , , , s, , ,]?: string[]) => void > : undefined >a : string > : undefined diff --git a/tests/baselines/reference/arrayBufferIsViewNarrowsType.types b/tests/baselines/reference/arrayBufferIsViewNarrowsType.types index b9d4f3db81b..129b7d601d8 100644 --- a/tests/baselines/reference/arrayBufferIsViewNarrowsType.types +++ b/tests/baselines/reference/arrayBufferIsViewNarrowsType.types @@ -4,7 +4,7 @@ var obj: Object; >Object : Object if (ArrayBuffer.isView(obj)) { ->ArrayBuffer.isView(obj) : arg is ArrayBufferView +>ArrayBuffer.isView(obj) : boolean >ArrayBuffer.isView : (arg: any) => arg is ArrayBufferView >ArrayBuffer : ArrayBufferConstructor >isView : (arg: any) => arg is ArrayBufferView diff --git a/tests/baselines/reference/arrayCast.errors.txt b/tests/baselines/reference/arrayCast.errors.txt index 815813ea727..61463e5557b 100644 --- a/tests/baselines/reference/arrayCast.errors.txt +++ b/tests/baselines/reference/arrayCast.errors.txt @@ -1,5 +1,5 @@ -tests/cases/compiler/arrayCast.ts(3,23): error TS2352: Neither type '{ foo: string; }[]' nor type '{ id: number; }[]' is assignable to the other. - Type '{ foo: string; }' is not assignable to type '{ id: number; }'. +tests/cases/compiler/arrayCast.ts(3,23): error TS2352: Type '{ foo: string; }[]' cannot be converted to type '{ id: number; }[]'. + Type '{ foo: string; }' is not comparable to type '{ id: number; }'. Object literal may only specify known properties, and 'foo' does not exist in type '{ id: number; }'. @@ -8,8 +8,8 @@ tests/cases/compiler/arrayCast.ts(3,23): error TS2352: Neither type '{ foo: stri // has type { foo: string }[], which is not assignable to { id: number }[]. <{ id: number; }[]>[{ foo: "s" }]; ~~~~~~~~ -!!! error TS2352: Neither type '{ foo: string; }[]' nor type '{ id: number; }[]' is assignable to the other. -!!! error TS2352: Type '{ foo: string; }' is not assignable to type '{ id: number; }'. +!!! error TS2352: Type '{ foo: string; }[]' cannot be converted to type '{ id: number; }[]'. +!!! error TS2352: Type '{ foo: string; }' is not comparable to type '{ id: number; }'. !!! error TS2352: Object literal may only specify known properties, and 'foo' does not exist in type '{ id: number; }'. // Should succeed, as the {} element causes the type of the array to be {}[] diff --git a/tests/baselines/reference/arrayConcat2.symbols b/tests/baselines/reference/arrayConcat2.symbols index daedee6e9c8..fb84193c113 100644 --- a/tests/baselines/reference/arrayConcat2.symbols +++ b/tests/baselines/reference/arrayConcat2.symbols @@ -3,21 +3,21 @@ var a: string[] = []; >a : Symbol(a, Decl(arrayConcat2.ts, 0, 3)) a.concat("hello", 'world'); ->a.concat : Symbol(Array.concat, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>a.concat : Symbol(Array.concat, Decl(lib.d.ts, --, --)) >a : Symbol(a, Decl(arrayConcat2.ts, 0, 3)) ->concat : Symbol(Array.concat, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>concat : Symbol(Array.concat, Decl(lib.d.ts, --, --)) a.concat('Hello'); ->a.concat : Symbol(Array.concat, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>a.concat : Symbol(Array.concat, Decl(lib.d.ts, --, --)) >a : Symbol(a, Decl(arrayConcat2.ts, 0, 3)) ->concat : Symbol(Array.concat, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>concat : Symbol(Array.concat, Decl(lib.d.ts, --, --)) var b = new Array(); >b : Symbol(b, Decl(arrayConcat2.ts, 5, 3)) >Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) b.concat('hello'); ->b.concat : Symbol(Array.concat, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>b.concat : Symbol(Array.concat, Decl(lib.d.ts, --, --)) >b : Symbol(b, Decl(arrayConcat2.ts, 5, 3)) ->concat : Symbol(Array.concat, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>concat : Symbol(Array.concat, Decl(lib.d.ts, --, --)) diff --git a/tests/baselines/reference/arrayConcat2.types b/tests/baselines/reference/arrayConcat2.types index a49046c871f..b7df3749116 100644 --- a/tests/baselines/reference/arrayConcat2.types +++ b/tests/baselines/reference/arrayConcat2.types @@ -5,17 +5,17 @@ var a: string[] = []; a.concat("hello", 'world'); >a.concat("hello", 'world') : string[] ->a.concat : { (...items: U[]): string[]; (...items: string[]): string[]; } +>a.concat : (...items: (string | string[])[]) => string[] >a : string[] ->concat : { (...items: U[]): string[]; (...items: string[]): string[]; } +>concat : (...items: (string | string[])[]) => string[] >"hello" : string >'world' : string a.concat('Hello'); >a.concat('Hello') : string[] ->a.concat : { (...items: U[]): string[]; (...items: string[]): string[]; } +>a.concat : (...items: (string | string[])[]) => string[] >a : string[] ->concat : { (...items: U[]): string[]; (...items: string[]): string[]; } +>concat : (...items: (string | string[])[]) => string[] >'Hello' : string var b = new Array(); @@ -25,8 +25,8 @@ var b = new Array(); b.concat('hello'); >b.concat('hello') : string[] ->b.concat : { (...items: U[]): string[]; (...items: string[]): string[]; } +>b.concat : (...items: (string | string[])[]) => string[] >b : string[] ->concat : { (...items: U[]): string[]; (...items: string[]): string[]; } +>concat : (...items: (string | string[])[]) => string[] >'hello' : string diff --git a/tests/baselines/reference/arrayConcatMap.symbols b/tests/baselines/reference/arrayConcatMap.symbols index 5ef9d811723..bde2686e259 100644 --- a/tests/baselines/reference/arrayConcatMap.symbols +++ b/tests/baselines/reference/arrayConcatMap.symbols @@ -2,8 +2,8 @@ var x = [].concat([{ a: 1 }], [{ a: 2 }]) >x : Symbol(x, Decl(arrayConcatMap.ts, 0, 3)) >[].concat([{ a: 1 }], [{ a: 2 }]) .map : Symbol(Array.map, Decl(lib.d.ts, --, --)) ->[].concat : Symbol(Array.concat, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->concat : Symbol(Array.concat, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>[].concat : Symbol(Array.concat, Decl(lib.d.ts, --, --)) +>concat : Symbol(Array.concat, Decl(lib.d.ts, --, --)) >a : Symbol(a, Decl(arrayConcatMap.ts, 0, 20)) >a : Symbol(a, Decl(arrayConcatMap.ts, 0, 32)) diff --git a/tests/baselines/reference/arrayConcatMap.types b/tests/baselines/reference/arrayConcatMap.types index 11342ee848a..38e1a1c49c9 100644 --- a/tests/baselines/reference/arrayConcatMap.types +++ b/tests/baselines/reference/arrayConcatMap.types @@ -4,9 +4,9 @@ var x = [].concat([{ a: 1 }], [{ a: 2 }]) >[].concat([{ a: 1 }], [{ a: 2 }]) .map(b => b.a) : any[] >[].concat([{ a: 1 }], [{ a: 2 }]) .map : (callbackfn: (value: any, index: number, array: any[]) => U, thisArg?: any) => U[] >[].concat([{ a: 1 }], [{ a: 2 }]) : any[] ->[].concat : { (...items: U[]): any[]; (...items: any[]): any[]; } +>[].concat : (...items: any[]) => any[] >[] : undefined[] ->concat : { (...items: U[]): any[]; (...items: any[]): any[]; } +>concat : (...items: any[]) => any[] >[{ a: 1 }] : { a: number; }[] >{ a: 1 } : { a: number; } >a : number diff --git a/tests/baselines/reference/arrayFilter.js b/tests/baselines/reference/arrayFilter.js new file mode 100644 index 00000000000..dd3b321b19c --- /dev/null +++ b/tests/baselines/reference/arrayFilter.js @@ -0,0 +1,16 @@ +//// [arrayFilter.ts] +var foo = [ + { name: 'bar' }, + { name: null }, + { name: 'baz' } +] + +foo.filter(x => x.name); //should accepted all possible types not only boolean! + +//// [arrayFilter.js] +var foo = [ + { name: 'bar' }, + { name: null }, + { name: 'baz' } +]; +foo.filter(function (x) { return x.name; }); //should accepted all possible types not only boolean! diff --git a/tests/baselines/reference/arrayFilter.symbols b/tests/baselines/reference/arrayFilter.symbols new file mode 100644 index 00000000000..fcdd39117a7 --- /dev/null +++ b/tests/baselines/reference/arrayFilter.symbols @@ -0,0 +1,24 @@ +=== tests/cases/compiler/arrayFilter.ts === +var foo = [ +>foo : Symbol(foo, Decl(arrayFilter.ts, 0, 3)) + + { name: 'bar' }, +>name : Symbol(name, Decl(arrayFilter.ts, 1, 5)) + + { name: null }, +>name : Symbol(name, Decl(arrayFilter.ts, 2, 5)) + + { name: 'baz' } +>name : Symbol(name, Decl(arrayFilter.ts, 3, 5)) + +] + +foo.filter(x => x.name); //should accepted all possible types not only boolean! +>foo.filter : Symbol(Array.filter, Decl(lib.d.ts, --, --)) +>foo : Symbol(foo, Decl(arrayFilter.ts, 0, 3)) +>filter : Symbol(Array.filter, Decl(lib.d.ts, --, --)) +>x : Symbol(x, Decl(arrayFilter.ts, 6, 11)) +>x.name : Symbol(name, Decl(arrayFilter.ts, 1, 5)) +>x : Symbol(x, Decl(arrayFilter.ts, 6, 11)) +>name : Symbol(name, Decl(arrayFilter.ts, 1, 5)) + diff --git a/tests/baselines/reference/arrayFilter.types b/tests/baselines/reference/arrayFilter.types new file mode 100644 index 00000000000..f3d6d421744 --- /dev/null +++ b/tests/baselines/reference/arrayFilter.types @@ -0,0 +1,33 @@ +=== tests/cases/compiler/arrayFilter.ts === +var foo = [ +>foo : { name: string; }[] +>[ { name: 'bar' }, { name: null }, { name: 'baz' }] : { name: string; }[] + + { name: 'bar' }, +>{ name: 'bar' } : { name: string; } +>name : string +>'bar' : string + + { name: null }, +>{ name: null } : { name: null; } +>name : null +>null : null + + { name: 'baz' } +>{ name: 'baz' } : { name: string; } +>name : string +>'baz' : string + +] + +foo.filter(x => x.name); //should accepted all possible types not only boolean! +>foo.filter(x => x.name) : { name: string; }[] +>foo.filter : (callbackfn: (value: { name: string; }, index: number, array: { name: string; }[]) => any, thisArg?: any) => { name: string; }[] +>foo : { name: string; }[] +>filter : (callbackfn: (value: { name: string; }, index: number, array: { name: string; }[]) => any, thisArg?: any) => { name: string; }[] +>x => x.name : (x: { name: string; }) => string +>x : { name: string; } +>x.name : string +>x : { name: string; } +>name : string + diff --git a/tests/baselines/reference/arrayLiteralContextualType.symbols b/tests/baselines/reference/arrayLiteralContextualType.symbols index 500c1d522f6..2049ec342ec 100644 --- a/tests/baselines/reference/arrayLiteralContextualType.symbols +++ b/tests/baselines/reference/arrayLiteralContextualType.symbols @@ -3,27 +3,27 @@ interface IAnimal { >IAnimal : Symbol(IAnimal, Decl(arrayLiteralContextualType.ts, 0, 0)) name: string; ->name : Symbol(name, Decl(arrayLiteralContextualType.ts, 0, 19)) +>name : Symbol(IAnimal.name, Decl(arrayLiteralContextualType.ts, 0, 19)) } class Giraffe { >Giraffe : Symbol(Giraffe, Decl(arrayLiteralContextualType.ts, 2, 1)) name = "Giraffe"; ->name : Symbol(name, Decl(arrayLiteralContextualType.ts, 4, 15)) +>name : Symbol(Giraffe.name, Decl(arrayLiteralContextualType.ts, 4, 15)) neckLength = "3m"; ->neckLength : Symbol(neckLength, Decl(arrayLiteralContextualType.ts, 5, 21)) +>neckLength : Symbol(Giraffe.neckLength, Decl(arrayLiteralContextualType.ts, 5, 21)) } class Elephant { >Elephant : Symbol(Elephant, Decl(arrayLiteralContextualType.ts, 7, 1)) name = "Elephant"; ->name : Symbol(name, Decl(arrayLiteralContextualType.ts, 9, 16)) +>name : Symbol(Elephant.name, Decl(arrayLiteralContextualType.ts, 9, 16)) trunkDiameter = "20cm"; ->trunkDiameter : Symbol(trunkDiameter, Decl(arrayLiteralContextualType.ts, 10, 22)) +>trunkDiameter : Symbol(Elephant.trunkDiameter, Decl(arrayLiteralContextualType.ts, 10, 22)) } function foo(animals: IAnimal[]) { } diff --git a/tests/baselines/reference/arrayLiteralWidened.types b/tests/baselines/reference/arrayLiteralWidened.types index 9599db2dff5..83db7046eed 100644 --- a/tests/baselines/reference/arrayLiteralWidened.types +++ b/tests/baselines/reference/arrayLiteralWidened.types @@ -19,7 +19,7 @@ var a = [undefined, undefined]; var b = [[], [null, null]]; // any[][] >b : any[][] ->[[], [null, null]] : null[][] +>[[], [null, null]] : undefined[][] >[] : undefined[] >[null, null] : null[] >null : null diff --git a/tests/baselines/reference/arrayLiterals2ES5.symbols b/tests/baselines/reference/arrayLiterals2ES5.symbols index 4db8372a601..eea3c78bfc0 100644 --- a/tests/baselines/reference/arrayLiterals2ES5.symbols +++ b/tests/baselines/reference/arrayLiterals2ES5.symbols @@ -81,13 +81,13 @@ var temp4 = []; interface myArray extends Array { } >myArray : Symbol(myArray, Decl(arrayLiterals2ES5.ts, 42, 15)) >Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) interface myArray2 extends Array { } >myArray2 : Symbol(myArray2, Decl(arrayLiterals2ES5.ts, 44, 43)) >Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) var d0 = [1, true, ...temp,]; // has type (string|number|boolean)[] >d0 : Symbol(d0, Decl(arrayLiterals2ES5.ts, 46, 3)) diff --git a/tests/baselines/reference/arrayLiterals2ES6.symbols b/tests/baselines/reference/arrayLiterals2ES6.symbols index 0c7dc1495df..8202cb16df9 100644 --- a/tests/baselines/reference/arrayLiterals2ES6.symbols +++ b/tests/baselines/reference/arrayLiterals2ES6.symbols @@ -72,14 +72,14 @@ var temp2: [number[], string[]] = [[1, 2, 3], ["hello", "string"]]; interface myArray extends Array { } >myArray : Symbol(myArray, Decl(arrayLiterals2ES6.ts, 40, 67)) ->Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) interface myArray2 extends Array { } >myArray2 : Symbol(myArray2, Decl(arrayLiterals2ES6.ts, 42, 43)) ->Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>String : Symbol(String, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) var d0 = [1, true, ...temp, ]; // has type (string|number|boolean)[] >d0 : Symbol(d0, Decl(arrayLiterals2ES6.ts, 44, 3)) diff --git a/tests/baselines/reference/arrayLiterals3.errors.txt b/tests/baselines/reference/arrayLiterals3.errors.txt index 637fb3e3bc4..f205e90eced 100644 --- a/tests/baselines/reference/arrayLiterals3.errors.txt +++ b/tests/baselines/reference/arrayLiterals3.errors.txt @@ -16,9 +16,8 @@ tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(34,5): error Types of property 'push' are incompatible. Type '(...items: (number | string)[]) => number' is not assignable to type '(...items: Number[]) => number'. Types of parameters 'items' and 'items' are incompatible. - Type 'number | string' is not assignable to type 'Number'. - Type 'string' is not assignable to type 'Number'. - Property 'toFixed' is missing in type 'String'. + Type 'Number' is not assignable to type 'number | string'. + Type 'Number' is not assignable to type 'string'. ==== tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts (6 errors) ==== @@ -80,7 +79,6 @@ tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(34,5): error !!! error TS2322: Types of property 'push' are incompatible. !!! error TS2322: Type '(...items: (number | string)[]) => number' is not assignable to type '(...items: Number[]) => number'. !!! error TS2322: Types of parameters 'items' and 'items' are incompatible. -!!! error TS2322: Type 'number | string' is not assignable to type 'Number'. -!!! error TS2322: Type 'string' is not assignable to type 'Number'. -!!! error TS2322: Property 'toFixed' is missing in type 'String'. +!!! error TS2322: Type 'Number' is not assignable to type 'number | string'. +!!! error TS2322: Type 'Number' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/arrayLiteralsWithRecursiveGenerics.symbols b/tests/baselines/reference/arrayLiteralsWithRecursiveGenerics.symbols index cd597dc2b4e..0b3630cac28 100644 --- a/tests/baselines/reference/arrayLiteralsWithRecursiveGenerics.symbols +++ b/tests/baselines/reference/arrayLiteralsWithRecursiveGenerics.symbols @@ -4,11 +4,11 @@ class List { >T : Symbol(T, Decl(arrayLiteralsWithRecursiveGenerics.ts, 0, 11)) data: T; ->data : Symbol(data, Decl(arrayLiteralsWithRecursiveGenerics.ts, 0, 15)) +>data : Symbol(List.data, Decl(arrayLiteralsWithRecursiveGenerics.ts, 0, 15)) >T : Symbol(T, Decl(arrayLiteralsWithRecursiveGenerics.ts, 0, 11)) next: List>; ->next : Symbol(next, Decl(arrayLiteralsWithRecursiveGenerics.ts, 1, 12)) +>next : Symbol(List.next, Decl(arrayLiteralsWithRecursiveGenerics.ts, 1, 12)) >List : Symbol(List, Decl(arrayLiteralsWithRecursiveGenerics.ts, 0, 0)) >List : Symbol(List, Decl(arrayLiteralsWithRecursiveGenerics.ts, 0, 0)) >T : Symbol(T, Decl(arrayLiteralsWithRecursiveGenerics.ts, 0, 11)) @@ -21,7 +21,7 @@ class DerivedList extends List { >U : Symbol(U, Decl(arrayLiteralsWithRecursiveGenerics.ts, 5, 18)) foo: U; ->foo : Symbol(foo, Decl(arrayLiteralsWithRecursiveGenerics.ts, 5, 38)) +>foo : Symbol(DerivedList.foo, Decl(arrayLiteralsWithRecursiveGenerics.ts, 5, 38)) >U : Symbol(U, Decl(arrayLiteralsWithRecursiveGenerics.ts, 5, 18)) // next: List> @@ -32,11 +32,11 @@ class MyList { >T : Symbol(T, Decl(arrayLiteralsWithRecursiveGenerics.ts, 10, 13)) data: T; ->data : Symbol(data, Decl(arrayLiteralsWithRecursiveGenerics.ts, 10, 17)) +>data : Symbol(MyList.data, Decl(arrayLiteralsWithRecursiveGenerics.ts, 10, 17)) >T : Symbol(T, Decl(arrayLiteralsWithRecursiveGenerics.ts, 10, 13)) next: MyList>; ->next : Symbol(next, Decl(arrayLiteralsWithRecursiveGenerics.ts, 11, 12)) +>next : Symbol(MyList.next, Decl(arrayLiteralsWithRecursiveGenerics.ts, 11, 12)) >MyList : Symbol(MyList, Decl(arrayLiteralsWithRecursiveGenerics.ts, 8, 1)) >MyList : Symbol(MyList, Decl(arrayLiteralsWithRecursiveGenerics.ts, 8, 1)) >T : Symbol(T, Decl(arrayLiteralsWithRecursiveGenerics.ts, 10, 13)) diff --git a/tests/baselines/reference/arrayOfExportedClass.symbols b/tests/baselines/reference/arrayOfExportedClass.symbols index bdcaf98eb0d..acdcbfa398b 100644 --- a/tests/baselines/reference/arrayOfExportedClass.symbols +++ b/tests/baselines/reference/arrayOfExportedClass.symbols @@ -7,18 +7,18 @@ class Road { >Road : Symbol(Road, Decl(arrayOfExportedClass_1.ts, 1, 49)) public cars: Car[]; ->cars : Symbol(cars, Decl(arrayOfExportedClass_1.ts, 3, 12)) +>cars : Symbol(Road.cars, Decl(arrayOfExportedClass_1.ts, 3, 12)) >Car : Symbol(Car, Decl(arrayOfExportedClass_1.ts, 0, 0)) public AddCars(cars: Car[]) { ->AddCars : Symbol(AddCars, Decl(arrayOfExportedClass_1.ts, 5, 23)) +>AddCars : Symbol(Road.AddCars, Decl(arrayOfExportedClass_1.ts, 5, 23)) >cars : Symbol(cars, Decl(arrayOfExportedClass_1.ts, 7, 19)) >Car : Symbol(Car, Decl(arrayOfExportedClass_1.ts, 0, 0)) this.cars = cars; ->this.cars : Symbol(cars, Decl(arrayOfExportedClass_1.ts, 3, 12)) +>this.cars : Symbol(Road.cars, Decl(arrayOfExportedClass_1.ts, 3, 12)) >this : Symbol(Road, Decl(arrayOfExportedClass_1.ts, 1, 49)) ->cars : Symbol(cars, Decl(arrayOfExportedClass_1.ts, 3, 12)) +>cars : Symbol(Road.cars, Decl(arrayOfExportedClass_1.ts, 3, 12)) >cars : Symbol(cars, Decl(arrayOfExportedClass_1.ts, 7, 19)) } } @@ -31,7 +31,7 @@ class Car { >Car : Symbol(Car, Decl(arrayOfExportedClass_0.ts, 0, 0)) foo: string; ->foo : Symbol(foo, Decl(arrayOfExportedClass_0.ts, 0, 11)) +>foo : Symbol(Car.foo, Decl(arrayOfExportedClass_0.ts, 0, 11)) } export = Car; diff --git a/tests/baselines/reference/arrayOfFunctionTypes3.symbols b/tests/baselines/reference/arrayOfFunctionTypes3.symbols index d26effeb5b7..9ff5a252d34 100644 --- a/tests/baselines/reference/arrayOfFunctionTypes3.symbols +++ b/tests/baselines/reference/arrayOfFunctionTypes3.symbols @@ -12,7 +12,7 @@ class C { >C : Symbol(C, Decl(arrayOfFunctionTypes3.ts, 3, 16)) foo: string; ->foo : Symbol(foo, Decl(arrayOfFunctionTypes3.ts, 5, 9)) +>foo : Symbol(C.foo, Decl(arrayOfFunctionTypes3.ts, 5, 9)) } var y = [C, C]; >y : Symbol(y, Decl(arrayOfFunctionTypes3.ts, 8, 3)) diff --git a/tests/baselines/reference/arraySigChecking.errors.txt b/tests/baselines/reference/arraySigChecking.errors.txt index b70b659773c..1968957363c 100644 --- a/tests/baselines/reference/arraySigChecking.errors.txt +++ b/tests/baselines/reference/arraySigChecking.errors.txt @@ -4,7 +4,6 @@ tests/cases/compiler/arraySigChecking.ts(18,5): error TS2322: Type 'void[]' is n tests/cases/compiler/arraySigChecking.ts(22,1): error TS2322: Type 'number[][]' is not assignable to type 'number[][][]'. Type 'number[]' is not assignable to type 'number[][]'. Type 'number' is not assignable to type 'number[]'. - Property 'length' is missing in type 'Number'. ==== tests/cases/compiler/arraySigChecking.ts (3 errors) ==== @@ -39,7 +38,6 @@ tests/cases/compiler/arraySigChecking.ts(22,1): error TS2322: Type 'number[][]' !!! error TS2322: Type 'number[][]' is not assignable to type 'number[][][]'. !!! error TS2322: Type 'number[]' is not assignable to type 'number[][]'. !!! error TS2322: Type 'number' is not assignable to type 'number[]'. -!!! error TS2322: Property 'length' is missing in type 'Number'. function isEmpty(l: { length: number }) { return l.length === 0; diff --git a/tests/baselines/reference/arrayTypeInSignatureOfInterfaceAndClass.symbols b/tests/baselines/reference/arrayTypeInSignatureOfInterfaceAndClass.symbols index d9665e98eb5..018f9ce35c9 100644 --- a/tests/baselines/reference/arrayTypeInSignatureOfInterfaceAndClass.symbols +++ b/tests/baselines/reference/arrayTypeInSignatureOfInterfaceAndClass.symbols @@ -7,7 +7,7 @@ declare module WinJS { >T : Symbol(T, Decl(arrayTypeInSignatureOfInterfaceAndClass.ts, 1, 18)) then(success?: (value: T) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; ->then : Symbol(then, Decl(arrayTypeInSignatureOfInterfaceAndClass.ts, 1, 22)) +>then : Symbol(Promise.then, Decl(arrayTypeInSignatureOfInterfaceAndClass.ts, 1, 22)) >U : Symbol(U, Decl(arrayTypeInSignatureOfInterfaceAndClass.ts, 2, 13)) >success : Symbol(success, Decl(arrayTypeInSignatureOfInterfaceAndClass.ts, 2, 16)) >value : Symbol(value, Decl(arrayTypeInSignatureOfInterfaceAndClass.ts, 2, 27)) @@ -32,29 +32,29 @@ declare module Data { >T : Symbol(T, Decl(arrayTypeInSignatureOfInterfaceAndClass.ts, 6, 31)) itemIndex: number; ->itemIndex : Symbol(itemIndex, Decl(arrayTypeInSignatureOfInterfaceAndClass.ts, 6, 35)) +>itemIndex : Symbol(IListItem.itemIndex, Decl(arrayTypeInSignatureOfInterfaceAndClass.ts, 6, 35)) key: any; ->key : Symbol(key, Decl(arrayTypeInSignatureOfInterfaceAndClass.ts, 7, 26)) +>key : Symbol(IListItem.key, Decl(arrayTypeInSignatureOfInterfaceAndClass.ts, 7, 26)) data: T; ->data : Symbol(data, Decl(arrayTypeInSignatureOfInterfaceAndClass.ts, 8, 17)) +>data : Symbol(IListItem.data, Decl(arrayTypeInSignatureOfInterfaceAndClass.ts, 8, 17)) >T : Symbol(T, Decl(arrayTypeInSignatureOfInterfaceAndClass.ts, 6, 31)) group: any; ->group : Symbol(group, Decl(arrayTypeInSignatureOfInterfaceAndClass.ts, 9, 16)) +>group : Symbol(IListItem.group, Decl(arrayTypeInSignatureOfInterfaceAndClass.ts, 9, 16)) isHeader: boolean; ->isHeader : Symbol(isHeader, Decl(arrayTypeInSignatureOfInterfaceAndClass.ts, 10, 19)) +>isHeader : Symbol(IListItem.isHeader, Decl(arrayTypeInSignatureOfInterfaceAndClass.ts, 10, 19)) cached: boolean; ->cached : Symbol(cached, Decl(arrayTypeInSignatureOfInterfaceAndClass.ts, 11, 26)) +>cached : Symbol(IListItem.cached, Decl(arrayTypeInSignatureOfInterfaceAndClass.ts, 11, 26)) isNonSourceData: boolean; ->isNonSourceData : Symbol(isNonSourceData, Decl(arrayTypeInSignatureOfInterfaceAndClass.ts, 12, 24)) +>isNonSourceData : Symbol(IListItem.isNonSourceData, Decl(arrayTypeInSignatureOfInterfaceAndClass.ts, 12, 24)) preventAugmentation: boolean; ->preventAugmentation : Symbol(preventAugmentation, Decl(arrayTypeInSignatureOfInterfaceAndClass.ts, 13, 33)) +>preventAugmentation : Symbol(IListItem.preventAugmentation, Decl(arrayTypeInSignatureOfInterfaceAndClass.ts, 13, 33)) } export interface IVirtualList { >IVirtualList : Symbol(IVirtualList, Decl(arrayTypeInSignatureOfInterfaceAndClass.ts, 15, 5)) @@ -62,7 +62,7 @@ declare module Data { //removeIndices: WinJS.Promise[]>; removeIndices(indices: number[], options?: any): WinJS.Promise[]>; ->removeIndices : Symbol(removeIndices, Decl(arrayTypeInSignatureOfInterfaceAndClass.ts, 16, 38)) +>removeIndices : Symbol(IVirtualList.removeIndices, Decl(arrayTypeInSignatureOfInterfaceAndClass.ts, 16, 38)) >indices : Symbol(indices, Decl(arrayTypeInSignatureOfInterfaceAndClass.ts, 18, 22)) >options : Symbol(options, Decl(arrayTypeInSignatureOfInterfaceAndClass.ts, 18, 40)) >WinJS : Symbol(WinJS, Decl(arrayTypeInSignatureOfInterfaceAndClass.ts, 0, 0)) @@ -78,7 +78,7 @@ declare module Data { //removeIndices: WinJS.Promise[]>; public removeIndices(indices: number[], options?: any): WinJS.Promise[]>; ->removeIndices : Symbol(removeIndices, Decl(arrayTypeInSignatureOfInterfaceAndClass.ts, 20, 60)) +>removeIndices : Symbol(VirtualList.removeIndices, Decl(arrayTypeInSignatureOfInterfaceAndClass.ts, 20, 60)) >indices : Symbol(indices, Decl(arrayTypeInSignatureOfInterfaceAndClass.ts, 22, 29)) >options : Symbol(options, Decl(arrayTypeInSignatureOfInterfaceAndClass.ts, 22, 47)) >WinJS : Symbol(WinJS, Decl(arrayTypeInSignatureOfInterfaceAndClass.ts, 0, 0)) diff --git a/tests/baselines/reference/arrayTypeOfTypeOf.errors.txt b/tests/baselines/reference/arrayTypeOfTypeOf.errors.txt index 41446dfceab..1c37f04be72 100644 --- a/tests/baselines/reference/arrayTypeOfTypeOf.errors.txt +++ b/tests/baselines/reference/arrayTypeOfTypeOf.errors.txt @@ -1,5 +1,4 @@ tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayTypeOfTypeOf.ts(6,5): error TS2322: Type 'number' is not assignable to type 'ArrayConstructor'. - Property 'isArray' is missing in type 'Number'. tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayTypeOfTypeOf.ts(6,22): error TS1005: '=' expected. tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayTypeOfTypeOf.ts(6,30): error TS1109: Expression expected. tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayTypeOfTypeOf.ts(7,5): error TS2322: Type 'number' is not assignable to type 'ArrayConstructor'. @@ -16,7 +15,6 @@ tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayTypeOfTypeOf.ts( var xs3: typeof Array; ~~~ !!! error TS2322: Type 'number' is not assignable to type 'ArrayConstructor'. -!!! error TS2322: Property 'isArray' is missing in type 'Number'. ~ !!! error TS1005: '=' expected. ~ diff --git a/tests/baselines/reference/arrayconcat.symbols b/tests/baselines/reference/arrayconcat.symbols index 4fee1860be6..74cc7ef06c1 100644 --- a/tests/baselines/reference/arrayconcat.symbols +++ b/tests/baselines/reference/arrayconcat.symbols @@ -3,46 +3,46 @@ interface IOptions { >IOptions : Symbol(IOptions, Decl(arrayconcat.ts, 0, 0)) name?: string; ->name : Symbol(name, Decl(arrayconcat.ts, 0, 20)) +>name : Symbol(IOptions.name, Decl(arrayconcat.ts, 0, 20)) flag?: boolean; ->flag : Symbol(flag, Decl(arrayconcat.ts, 1, 18)) +>flag : Symbol(IOptions.flag, Decl(arrayconcat.ts, 1, 18)) short?: string; ->short : Symbol(short, Decl(arrayconcat.ts, 2, 19)) +>short : Symbol(IOptions.short, Decl(arrayconcat.ts, 2, 19)) usage?: string; ->usage : Symbol(usage, Decl(arrayconcat.ts, 3, 19)) +>usage : Symbol(IOptions.usage, Decl(arrayconcat.ts, 3, 19)) set?: (s: string) => void; ->set : Symbol(set, Decl(arrayconcat.ts, 4, 19)) +>set : Symbol(IOptions.set, Decl(arrayconcat.ts, 4, 19)) >s : Symbol(s, Decl(arrayconcat.ts, 5, 11)) type?: string; ->type : Symbol(type, Decl(arrayconcat.ts, 5, 30)) +>type : Symbol(IOptions.type, Decl(arrayconcat.ts, 5, 30)) experimental?: boolean; ->experimental : Symbol(experimental, Decl(arrayconcat.ts, 6, 18)) +>experimental : Symbol(IOptions.experimental, Decl(arrayconcat.ts, 6, 18)) } class parser { >parser : Symbol(parser, Decl(arrayconcat.ts, 8, 1)) public options: IOptions[]; ->options : Symbol(options, Decl(arrayconcat.ts, 10, 14)) +>options : Symbol(parser.options, Decl(arrayconcat.ts, 10, 14)) >IOptions : Symbol(IOptions, Decl(arrayconcat.ts, 0, 0)) public m() { ->m : Symbol(m, Decl(arrayconcat.ts, 11, 28)) +>m : Symbol(parser.m, Decl(arrayconcat.ts, 11, 28)) this.options = this.options.sort(function(a, b) { ->this.options : Symbol(options, Decl(arrayconcat.ts, 10, 14)) +>this.options : Symbol(parser.options, Decl(arrayconcat.ts, 10, 14)) >this : Symbol(parser, Decl(arrayconcat.ts, 8, 1)) ->options : Symbol(options, Decl(arrayconcat.ts, 10, 14)) +>options : Symbol(parser.options, Decl(arrayconcat.ts, 10, 14)) >this.options.sort : Symbol(Array.sort, Decl(lib.d.ts, --, --)) ->this.options : Symbol(options, Decl(arrayconcat.ts, 10, 14)) +>this.options : Symbol(parser.options, Decl(arrayconcat.ts, 10, 14)) >this : Symbol(parser, Decl(arrayconcat.ts, 8, 1)) ->options : Symbol(options, Decl(arrayconcat.ts, 10, 14)) +>options : Symbol(parser.options, Decl(arrayconcat.ts, 10, 14)) >sort : Symbol(Array.sort, Decl(lib.d.ts, --, --)) >a : Symbol(a, Decl(arrayconcat.ts, 14, 44)) >b : Symbol(b, Decl(arrayconcat.ts, 14, 46)) diff --git a/tests/baselines/reference/arrowFunctionErrorSpan.errors.txt b/tests/baselines/reference/arrowFunctionErrorSpan.errors.txt new file mode 100644 index 00000000000..e258f56d5ed --- /dev/null +++ b/tests/baselines/reference/arrowFunctionErrorSpan.errors.txt @@ -0,0 +1,111 @@ +tests/cases/compiler/arrowFunctionErrorSpan.ts(4,3): error TS2345: Argument of type '() => void' is not assignable to parameter of type '() => number'. + Type 'void' is not assignable to type 'number'. +tests/cases/compiler/arrowFunctionErrorSpan.ts(7,3): error TS2345: Argument of type '() => void' is not assignable to parameter of type '() => number'. + Type 'void' is not assignable to type 'number'. +tests/cases/compiler/arrowFunctionErrorSpan.ts(12,3): error TS2345: Argument of type '() => void' is not assignable to parameter of type '() => number'. + Type 'void' is not assignable to type 'number'. +tests/cases/compiler/arrowFunctionErrorSpan.ts(17,3): error TS2345: Argument of type '() => void' is not assignable to parameter of type '() => number'. + Type 'void' is not assignable to type 'number'. +tests/cases/compiler/arrowFunctionErrorSpan.ts(18,5): error TS1200: Line terminator not permitted before arrow. +tests/cases/compiler/arrowFunctionErrorSpan.ts(21,3): error TS2345: Argument of type '(a: any, b: any, c: any, d: any) => void' is not assignable to parameter of type '() => number'. +tests/cases/compiler/arrowFunctionErrorSpan.ts(28,7): error TS2345: Argument of type '() => void' is not assignable to parameter of type '() => number'. + Type 'void' is not assignable to type 'number'. +tests/cases/compiler/arrowFunctionErrorSpan.ts(32,7): error TS2345: Argument of type '() => void' is not assignable to parameter of type '() => number'. + Type 'void' is not assignable to type 'number'. +tests/cases/compiler/arrowFunctionErrorSpan.ts(36,7): error TS2345: Argument of type '() => void' is not assignable to parameter of type '() => number'. + Type 'void' is not assignable to type 'number'. +tests/cases/compiler/arrowFunctionErrorSpan.ts(43,5): error TS2345: Argument of type '() => void' is not assignable to parameter of type '() => number'. + Type 'void' is not assignable to type 'number'. +tests/cases/compiler/arrowFunctionErrorSpan.ts(52,3): error TS2345: Argument of type '(_: any) => number' is not assignable to parameter of type '() => number'. + + +==== tests/cases/compiler/arrowFunctionErrorSpan.ts (11 errors) ==== + function f(a: () => number) { } + + // oneliner + f(() => { }); + ~~~~~~~~~ +!!! error TS2345: Argument of type '() => void' is not assignable to parameter of type '() => number'. +!!! error TS2345: Type 'void' is not assignable to type 'number'. + + // multiline, body + f(() => { + ~~~~~~~ +!!! error TS2345: Argument of type '() => void' is not assignable to parameter of type '() => number'. +!!! error TS2345: Type 'void' is not assignable to type 'number'. + + }); + + // multiline 2, body + f(() => { + ~~~~~~~ +!!! error TS2345: Argument of type '() => void' is not assignable to parameter of type '() => number'. +!!! error TS2345: Type 'void' is not assignable to type 'number'. + + }); + + // multiline 3, arrow on a new line + f(() + ~~ + => { }); + ~~~~~~~~~~ +!!! error TS2345: Argument of type '() => void' is not assignable to parameter of type '() => number'. +!!! error TS2345: Type 'void' is not assignable to type 'number'. + ~~ +!!! error TS1200: Line terminator not permitted before arrow. + + // multiline 4, arguments + f((a, + ~~~ + b, + ~~~~~~ + c, + ~~~~~~ + d) => { }); + ~~~~~~~~~~~~~ +!!! error TS2345: Argument of type '(a: any, b: any, c: any, d: any) => void' is not assignable to parameter of type '() => number'. + + // single line with a comment + f(/* + */() => { }); + ~~~~~~~~~ +!!! error TS2345: Argument of type '() => void' is not assignable to parameter of type '() => number'. +!!! error TS2345: Type 'void' is not assignable to type 'number'. + + // multi line with a comment + f(/* + */() => { }); + ~~~~~~~~~ +!!! error TS2345: Argument of type '() => void' is not assignable to parameter of type '() => number'. +!!! error TS2345: Type 'void' is not assignable to type 'number'. + + // multi line with a comment 2 + f(/* + */() => { + ~~~~~~~~ +!!! error TS2345: Argument of type '() => void' is not assignable to parameter of type '() => number'. +!!! error TS2345: Type 'void' is not assignable to type 'number'. + + }); + + // multi line with a comment 3 + f( // comment 1 + // comment 2 + () => + ~~~~~ +!!! error TS2345: Argument of type '() => void' is not assignable to parameter of type '() => number'. +!!! error TS2345: Type 'void' is not assignable to type 'number'. + // comment 3 + { + // comment 4 + } + // comment 5 + ); + + // body is not a block + f(_ => 1 + + ~~~~~~~~ + 2); + ~~~~~ +!!! error TS2345: Argument of type '(_: any) => number' is not assignable to parameter of type '() => number'. + \ No newline at end of file diff --git a/tests/baselines/reference/arrowFunctionErrorSpan.js b/tests/baselines/reference/arrowFunctionErrorSpan.js new file mode 100644 index 00000000000..2557113e89b --- /dev/null +++ b/tests/baselines/reference/arrowFunctionErrorSpan.js @@ -0,0 +1,89 @@ +//// [arrowFunctionErrorSpan.ts] +function f(a: () => number) { } + +// oneliner +f(() => { }); + +// multiline, body +f(() => { + +}); + +// multiline 2, body +f(() => { + +}); + +// multiline 3, arrow on a new line +f(() + => { }); + +// multiline 4, arguments +f((a, + b, + c, + d) => { }); + +// single line with a comment +f(/* + */() => { }); + +// multi line with a comment +f(/* + */() => { }); + +// multi line with a comment 2 +f(/* + */() => { + + }); + +// multi line with a comment 3 +f( // comment 1 + // comment 2 + () => + // comment 3 + { + // comment 4 + } + // comment 5 +); + +// body is not a block +f(_ => 1 + + 2); + + +//// [arrowFunctionErrorSpan.js] +function f(a) { } +// oneliner +f(function () { }); +// multiline, body +f(function () { +}); +// multiline 2, body +f(function () { +}); +// multiline 3, arrow on a new line +f(function () { }); +// multiline 4, arguments +f(function (a, b, c, d) { }); +// single line with a comment +f(/* + */ function () { }); +// multi line with a comment +f(/* + */ function () { }); +// multi line with a comment 2 +f(/* + */ function () { +}); +// multi line with a comment 3 +f(// comment 1 +// comment 2 +function () { + // comment 4 +}); +// body is not a block +f(function (_) { return 1 + + 2; }); diff --git a/tests/baselines/reference/arrowFunctionExpressions.symbols b/tests/baselines/reference/arrowFunctionExpressions.symbols index 853c5074580..028d57084a2 100644 --- a/tests/baselines/reference/arrowFunctionExpressions.symbols +++ b/tests/baselines/reference/arrowFunctionExpressions.symbols @@ -94,18 +94,18 @@ class MyClass { >MyClass : Symbol(MyClass, Decl(arrowFunctionExpressions.ts, 24, 37)) m = (n) => n + 1; ->m : Symbol(m, Decl(arrowFunctionExpressions.ts, 28, 15)) +>m : Symbol(MyClass.m, Decl(arrowFunctionExpressions.ts, 28, 15)) >n : Symbol(n, Decl(arrowFunctionExpressions.ts, 29, 9)) >n : Symbol(n, Decl(arrowFunctionExpressions.ts, 29, 9)) p = (n) => n && this; ->p : Symbol(p, Decl(arrowFunctionExpressions.ts, 29, 21)) +>p : Symbol(MyClass.p, Decl(arrowFunctionExpressions.ts, 29, 21)) >n : Symbol(n, Decl(arrowFunctionExpressions.ts, 30, 9)) >n : Symbol(n, Decl(arrowFunctionExpressions.ts, 30, 9)) >this : Symbol(MyClass, Decl(arrowFunctionExpressions.ts, 24, 37)) fn() { ->fn : Symbol(fn, Decl(arrowFunctionExpressions.ts, 30, 25)) +>fn : Symbol(MyClass.fn, Decl(arrowFunctionExpressions.ts, 30, 25)) var m = (n) => n + 1; >m : Symbol(m, Decl(arrowFunctionExpressions.ts, 33, 11)) diff --git a/tests/baselines/reference/arrowFunctionExpressions.types b/tests/baselines/reference/arrowFunctionExpressions.types index eedd20944fe..41344c61cc4 100644 --- a/tests/baselines/reference/arrowFunctionExpressions.types +++ b/tests/baselines/reference/arrowFunctionExpressions.types @@ -77,31 +77,31 @@ var p4 = ([, ...a]) => { }; >a : any[] var p5 = ([a = 1]) => { }; ->p5 : ([a = 1]: [number]) => void ->([a = 1]) => { } : ([a = 1]: [number]) => void +>p5 : ([a]: [number]) => void +>([a = 1]) => { } : ([a]: [number]) => void >a : number >1 : number var p6 = ({ a }) => { }; ->p6 : ({ a }: { a: any; }) => void ->({ a }) => { } : ({ a }: { a: any; }) => void +>p6 : ({a}: { a: any; }) => void +>({ a }) => { } : ({a}: { a: any; }) => void >a : any var p7 = ({ a: { b } }) => { }; ->p7 : ({ a: { b } }: { a: { b: any; }; }) => void ->({ a: { b } }) => { } : ({ a: { b } }: { a: { b: any; }; }) => void +>p7 : ({a: {b}}: { a: { b: any; }; }) => void +>({ a: { b } }) => { } : ({a: {b}}: { a: { b: any; }; }) => void >a : any >b : any var p8 = ({ a = 1 }) => { }; ->p8 : ({ a = 1 }: { a?: number; }) => void ->({ a = 1 }) => { } : ({ a = 1 }: { a?: number; }) => void +>p8 : ({a}: { a?: number; }) => void +>({ a = 1 }) => { } : ({a}: { a?: number; }) => void >a : number >1 : number var p9 = ({ a: { b = 1 } = { b: 1 } }) => { }; ->p9 : ({ a: { b = 1 } = { b: 1 } }: { a?: { b?: number; }; }) => void ->({ a: { b = 1 } = { b: 1 } }) => { } : ({ a: { b = 1 } = { b: 1 } }: { a?: { b?: number; }; }) => void +>p9 : ({a: {b}}: { a?: { b?: number; }; }) => void +>({ a: { b = 1 } = { b: 1 } }) => { } : ({a: {b}}: { a?: { b?: number; }; }) => void >a : any >b : number >1 : number @@ -110,8 +110,8 @@ var p9 = ({ a: { b = 1 } = { b: 1 } }) => { }; >1 : number var p10 = ([{ value, done }]) => { }; ->p10 : ([{ value, done }]: [{ value: any; done: any; }]) => void ->([{ value, done }]) => { } : ([{ value, done }]: [{ value: any; done: any; }]) => void +>p10 : ([{value, done}]: [{ value: any; done: any; }]) => void +>([{ value, done }]) => { } : ([{value, done}]: [{ value: any; done: any; }]) => void >value : any >done : any diff --git a/tests/baselines/reference/arrowFunctionWithObjectLiteralBody6.symbols b/tests/baselines/reference/arrowFunctionWithObjectLiteralBody6.symbols index 141b0d49880..534f9cc1ea0 100644 --- a/tests/baselines/reference/arrowFunctionWithObjectLiteralBody6.symbols +++ b/tests/baselines/reference/arrowFunctionWithObjectLiteralBody6.symbols @@ -1,13 +1,13 @@ === tests/cases/compiler/arrowFunctionWithObjectLiteralBody6.ts === var a = () => { name: "foo", message: "bar" }; >a : Symbol(a, Decl(arrowFunctionWithObjectLiteralBody6.ts, 0, 3)) ->Error : Symbol(Error, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >name : Symbol(name, Decl(arrowFunctionWithObjectLiteralBody6.ts, 0, 22)) >message : Symbol(message, Decl(arrowFunctionWithObjectLiteralBody6.ts, 0, 35)) var b = () => ({ name: "foo", message: "bar" }); >b : Symbol(b, Decl(arrowFunctionWithObjectLiteralBody6.ts, 2, 3)) ->Error : Symbol(Error, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >name : Symbol(name, Decl(arrowFunctionWithObjectLiteralBody6.ts, 2, 23)) >message : Symbol(message, Decl(arrowFunctionWithObjectLiteralBody6.ts, 2, 36)) @@ -18,7 +18,7 @@ var c = () => ({ name: "foo", message: "bar" }); var d = () => ((({ name: "foo", message: "bar" }))); >d : Symbol(d, Decl(arrowFunctionWithObjectLiteralBody6.ts, 6, 3)) ->Error : Symbol(Error, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >name : Symbol(name, Decl(arrowFunctionWithObjectLiteralBody6.ts, 6, 25)) >message : Symbol(message, Decl(arrowFunctionWithObjectLiteralBody6.ts, 6, 38)) diff --git a/tests/baselines/reference/arrowFunctionWithParameterNameAsync.js b/tests/baselines/reference/arrowFunctionWithParameterNameAsync.js new file mode 100644 index 00000000000..0baea798c03 --- /dev/null +++ b/tests/baselines/reference/arrowFunctionWithParameterNameAsync.js @@ -0,0 +1,6 @@ +//// [arrowFunctionWithParameterNameAsync.ts] + +const x = async => async; + +//// [arrowFunctionWithParameterNameAsync.js] +var x = function (async) { return async; }; diff --git a/tests/baselines/reference/arrowFunctionWithParameterNameAsync.symbols b/tests/baselines/reference/arrowFunctionWithParameterNameAsync.symbols new file mode 100644 index 00000000000..26f36f48df7 --- /dev/null +++ b/tests/baselines/reference/arrowFunctionWithParameterNameAsync.symbols @@ -0,0 +1,7 @@ +=== tests/cases/conformance/async/es6/asyncArrowFunction/arrowFunctionWithParameterNameAsync.ts === + +const x = async => async; +>x : Symbol(x, Decl(arrowFunctionWithParameterNameAsync.ts, 1, 5)) +>async : Symbol(async, Decl(arrowFunctionWithParameterNameAsync.ts, 1, 9)) +>async : Symbol(async, Decl(arrowFunctionWithParameterNameAsync.ts, 1, 9)) + diff --git a/tests/baselines/reference/arrowFunctionWithParameterNameAsync.types b/tests/baselines/reference/arrowFunctionWithParameterNameAsync.types new file mode 100644 index 00000000000..4bdc60935ea --- /dev/null +++ b/tests/baselines/reference/arrowFunctionWithParameterNameAsync.types @@ -0,0 +1,8 @@ +=== tests/cases/conformance/async/es6/asyncArrowFunction/arrowFunctionWithParameterNameAsync.ts === + +const x = async => async; +>x : (async: any) => any +>async => async : (async: any) => any +>async : any +>async : any + diff --git a/tests/baselines/reference/asOperator1.symbols b/tests/baselines/reference/asOperator1.symbols index 343d3422b5c..83813d26981 100644 --- a/tests/baselines/reference/asOperator1.symbols +++ b/tests/baselines/reference/asOperator1.symbols @@ -13,7 +13,7 @@ var y = (null as string).length; var z = Date as any as string; >z : Symbol(z, Decl(asOperator1.ts, 3, 3)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) // Should parse as a union type, not a bitwise 'or' of (32 as number) and 'string' var j = 32 as number|string; diff --git a/tests/baselines/reference/asOperator2.errors.txt b/tests/baselines/reference/asOperator2.errors.txt index 3b074038c26..92603c25cb0 100644 --- a/tests/baselines/reference/asOperator2.errors.txt +++ b/tests/baselines/reference/asOperator2.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/expressions/asOperator/asOperator2.ts(1,9): error TS2352: Neither type 'number' nor type 'string' is assignable to the other. +tests/cases/conformance/expressions/asOperator/asOperator2.ts(1,9): error TS2352: Type 'number' cannot be converted to type 'string'. ==== tests/cases/conformance/expressions/asOperator/asOperator2.ts (1 errors) ==== var x = 23 as string; ~~~~~~~~~~~~ -!!! error TS2352: Neither type 'number' nor type 'string' is assignable to the other. +!!! error TS2352: Type 'number' cannot be converted to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/asOperatorContextualType.errors.txt b/tests/baselines/reference/asOperatorContextualType.errors.txt index c53b407b5cf..9431d6123e2 100644 --- a/tests/baselines/reference/asOperatorContextualType.errors.txt +++ b/tests/baselines/reference/asOperatorContextualType.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/expressions/asOperator/asOperatorContextualType.ts(2,9): error TS2352: Neither type '(v: number) => number' nor type '(x: number) => string' is assignable to the other. - Type 'number' is not assignable to type 'string'. +tests/cases/conformance/expressions/asOperator/asOperatorContextualType.ts(2,9): error TS2352: Type '(v: number) => number' cannot be converted to type '(x: number) => string'. + Type 'number' is not comparable to type 'string'. ==== tests/cases/conformance/expressions/asOperator/asOperatorContextualType.ts (1 errors) ==== // should error var x = (v => v) as (x: number) => string; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2352: Neither type '(v: number) => number' nor type '(x: number) => string' is assignable to the other. -!!! error TS2352: Type 'number' is not assignable to type 'string'. \ No newline at end of file +!!! error TS2352: Type '(v: number) => number' cannot be converted to type '(x: number) => string'. +!!! error TS2352: Type 'number' is not comparable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/asOperatorNames.errors.txt b/tests/baselines/reference/asOperatorNames.errors.txt index e3dfaab9884..4f957791a24 100644 --- a/tests/baselines/reference/asOperatorNames.errors.txt +++ b/tests/baselines/reference/asOperatorNames.errors.txt @@ -1,11 +1,11 @@ -tests/cases/conformance/expressions/asOperator/asOperatorNames.ts(2,9): error TS2352: Neither type 'number' nor type 'string' is assignable to the other. +tests/cases/conformance/expressions/asOperator/asOperatorNames.ts(2,9): error TS2352: Type 'number' cannot be converted to type 'string'. ==== tests/cases/conformance/expressions/asOperator/asOperatorNames.ts (1 errors) ==== var a = 20; var b = a as string; ~~~~~~~~~~~ -!!! error TS2352: Neither type 'number' nor type 'string' is assignable to the other. +!!! error TS2352: Type 'number' cannot be converted to type 'string'. var as = "hello"; var as1 = as as string; \ No newline at end of file diff --git a/tests/baselines/reference/asiInES6Classes.symbols b/tests/baselines/reference/asiInES6Classes.symbols index e6af356008d..e4b89c19bf0 100644 --- a/tests/baselines/reference/asiInES6Classes.symbols +++ b/tests/baselines/reference/asiInES6Classes.symbols @@ -5,7 +5,7 @@ class Foo { defaults = { ->defaults : Symbol(defaults, Decl(asiInES6Classes.ts, 0, 11)) +>defaults : Symbol(Foo.defaults, Decl(asiInES6Classes.ts, 0, 11)) done: false >done : Symbol(done, Decl(asiInES6Classes.ts, 4, 16)) @@ -15,7 +15,7 @@ class Foo { bar() { ->bar : Symbol(bar, Decl(asiInES6Classes.ts, 8, 5)) +>bar : Symbol(Foo.bar, Decl(asiInES6Classes.ts, 8, 5)) return 3; diff --git a/tests/baselines/reference/assign1.symbols b/tests/baselines/reference/assign1.symbols index f434da72670..a8ab57146af 100644 --- a/tests/baselines/reference/assign1.symbols +++ b/tests/baselines/reference/assign1.symbols @@ -6,10 +6,10 @@ module M { >I : Symbol(I, Decl(assign1.ts, 0, 10)) salt:number; ->salt : Symbol(salt, Decl(assign1.ts, 1, 17)) +>salt : Symbol(I.salt, Decl(assign1.ts, 1, 17)) pepper:number; ->pepper : Symbol(pepper, Decl(assign1.ts, 2, 20)) +>pepper : Symbol(I.pepper, Decl(assign1.ts, 2, 20)) } var x:I={salt:2,pepper:0}; diff --git a/tests/baselines/reference/assignEveryTypeToAny.symbols b/tests/baselines/reference/assignEveryTypeToAny.symbols index 145e19664fd..e94413d4a3b 100644 --- a/tests/baselines/reference/assignEveryTypeToAny.symbols +++ b/tests/baselines/reference/assignEveryTypeToAny.symbols @@ -84,7 +84,7 @@ interface I { >I : Symbol(I, Decl(assignEveryTypeToAny.ts, 31, 6)) foo: string; ->foo : Symbol(foo, Decl(assignEveryTypeToAny.ts, 33, 13)) +>foo : Symbol(I.foo, Decl(assignEveryTypeToAny.ts, 33, 13)) } var g: I; @@ -99,7 +99,7 @@ class C { >C : Symbol(C, Decl(assignEveryTypeToAny.ts, 38, 6)) bar: string; ->bar : Symbol(bar, Decl(assignEveryTypeToAny.ts, 40, 9)) +>bar : Symbol(C.bar, Decl(assignEveryTypeToAny.ts, 40, 9)) } var h: C; diff --git a/tests/baselines/reference/assignToEnum.errors.txt b/tests/baselines/reference/assignToEnum.errors.txt index 4846a96dbb7..d50daa3099f 100644 --- a/tests/baselines/reference/assignToEnum.errors.txt +++ b/tests/baselines/reference/assignToEnum.errors.txt @@ -1,7 +1,7 @@ tests/cases/compiler/assignToEnum.ts(2,1): error TS2364: Invalid left-hand side of assignment expression. tests/cases/compiler/assignToEnum.ts(3,1): error TS2364: Invalid left-hand side of assignment expression. -tests/cases/compiler/assignToEnum.ts(4,1): error TS2364: Invalid left-hand side of assignment expression. -tests/cases/compiler/assignToEnum.ts(5,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/compiler/assignToEnum.ts(4,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. +tests/cases/compiler/assignToEnum.ts(5,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. ==== tests/cases/compiler/assignToEnum.ts (4 errors) ==== @@ -14,9 +14,9 @@ tests/cases/compiler/assignToEnum.ts(5,1): error TS2364: Invalid left-hand side !!! error TS2364: Invalid left-hand side of assignment expression. A.foo = 1; // invalid LHS ~~~~~ -!!! error TS2364: Invalid left-hand side of assignment expression. +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. A.foo = A.bar; // invalid LHS ~~~~~ -!!! error TS2364: Invalid left-hand side of assignment expression. +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. \ No newline at end of file diff --git a/tests/baselines/reference/assignToPrototype1.symbols b/tests/baselines/reference/assignToPrototype1.symbols index ddb8e915043..7e58c92fdcb 100644 --- a/tests/baselines/reference/assignToPrototype1.symbols +++ b/tests/baselines/reference/assignToPrototype1.symbols @@ -3,7 +3,7 @@ declare class Point { >Point : Symbol(Point, Decl(assignToPrototype1.ts, 0, 0)) add(dx: number, dy: number): void; ->add : Symbol(add, Decl(assignToPrototype1.ts, 0, 21)) +>add : Symbol(Point.add, Decl(assignToPrototype1.ts, 0, 21)) >dx : Symbol(dx, Decl(assignToPrototype1.ts, 1, 6)) >dy : Symbol(dy, Decl(assignToPrototype1.ts, 1, 17)) } diff --git a/tests/baselines/reference/assignmentCompat1.errors.txt b/tests/baselines/reference/assignmentCompat1.errors.txt index 7539af92887..0936c532ab3 100644 --- a/tests/baselines/reference/assignmentCompat1.errors.txt +++ b/tests/baselines/reference/assignmentCompat1.errors.txt @@ -3,9 +3,7 @@ tests/cases/compiler/assignmentCompat1.ts(4,1): error TS2322: Type '{ [index: st tests/cases/compiler/assignmentCompat1.ts(6,1): error TS2322: Type '{ [index: number]: any; }' is not assignable to type '{ one: number; }'. Property 'one' is missing in type '{ [index: number]: any; }'. tests/cases/compiler/assignmentCompat1.ts(8,1): error TS2322: Type 'string' is not assignable to type '{ [index: string]: any; }'. - Index signature is missing in type 'String'. tests/cases/compiler/assignmentCompat1.ts(10,1): error TS2322: Type 'boolean' is not assignable to type '{ [index: number]: any; }'. - Index signature is missing in type 'Boolean'. ==== tests/cases/compiler/assignmentCompat1.ts (4 errors) ==== @@ -25,11 +23,9 @@ tests/cases/compiler/assignmentCompat1.ts(10,1): error TS2322: Type 'boolean' is y = "foo"; // Error ~ !!! error TS2322: Type 'string' is not assignable to type '{ [index: string]: any; }'. -!!! error TS2322: Index signature is missing in type 'String'. z = "foo"; // OK, string has numeric indexer z = false; // Error ~ !!! error TS2322: Type 'boolean' is not assignable to type '{ [index: number]: any; }'. -!!! error TS2322: Index signature is missing in type 'Boolean'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatBug5.errors.txt b/tests/baselines/reference/assignmentCompatBug5.errors.txt index 1b5e3d80259..44e28f15d8c 100644 --- a/tests/baselines/reference/assignmentCompatBug5.errors.txt +++ b/tests/baselines/reference/assignmentCompatBug5.errors.txt @@ -4,7 +4,7 @@ tests/cases/compiler/assignmentCompatBug5.ts(5,6): error TS2345: Argument of typ Type 'string' is not assignable to type 'number'. tests/cases/compiler/assignmentCompatBug5.ts(8,6): error TS2345: Argument of type '(s: string) => void' is not assignable to parameter of type '(n: number) => number'. Types of parameters 's' and 'n' are incompatible. - Type 'string' is not assignable to type 'number'. + Type 'number' is not assignable to type 'string'. tests/cases/compiler/assignmentCompatBug5.ts(9,6): error TS2345: Argument of type '(n: number) => void' is not assignable to parameter of type '(n: number) => number'. Type 'void' is not assignable to type 'number'. @@ -27,7 +27,7 @@ tests/cases/compiler/assignmentCompatBug5.ts(9,6): error TS2345: Argument of typ ~~~~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(s: string) => void' is not assignable to parameter of type '(n: number) => number'. !!! error TS2345: Types of parameters 's' and 'n' are incompatible. -!!! error TS2345: Type 'string' is not assignable to type 'number'. +!!! error TS2345: Type 'number' is not assignable to type 'string'. foo3((n) => { return; }); ~~~~~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(n: number) => void' is not assignable to parameter of type '(n: number) => number'. diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures.errors.txt b/tests/baselines/reference/assignmentCompatWithCallSignatures.errors.txt index 6a221ef144e..c5914e59386 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures.errors.txt @@ -1,27 +1,27 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures.ts(35,1): error TS2322: Type 'S2' is not assignable to type 'T'. Types of parameters 'x' and 'x' are incompatible. - Type 'string' is not assignable to type 'number'. + Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures.ts(36,1): error TS2322: Type '(x: string) => void' is not assignable to type 'T'. Types of parameters 'x' and 'x' are incompatible. - Type 'string' is not assignable to type 'number'. + Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures.ts(37,1): error TS2322: Type '(x: string) => number' is not assignable to type 'T'. Types of parameters 'x' and 'x' are incompatible. - Type 'string' is not assignable to type 'number'. + Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures.ts(38,1): error TS2322: Type '(x: string) => string' is not assignable to type 'T'. Types of parameters 'x' and 'x' are incompatible. - Type 'string' is not assignable to type 'number'. + Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures.ts(39,1): error TS2322: Type 'S2' is not assignable to type '(x: number) => void'. Types of parameters 'x' and 'x' are incompatible. - Type 'string' is not assignable to type 'number'. + Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures.ts(40,1): error TS2322: Type '(x: string) => void' is not assignable to type '(x: number) => void'. Types of parameters 'x' and 'x' are incompatible. - Type 'string' is not assignable to type 'number'. + Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures.ts(41,1): error TS2322: Type '(x: string) => number' is not assignable to type '(x: number) => void'. Types of parameters 'x' and 'x' are incompatible. - Type 'string' is not assignable to type 'number'. + Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures.ts(42,1): error TS2322: Type '(x: string) => string' is not assignable to type '(x: number) => void'. Types of parameters 'x' and 'x' are incompatible. - Type 'string' is not assignable to type 'number'. + Type 'number' is not assignable to type 'string'. ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures.ts (8 errors) ==== @@ -63,40 +63,40 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme ~ !!! error TS2322: Type 'S2' is not assignable to type 'T'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. t = a3; ~ !!! error TS2322: Type '(x: string) => void' is not assignable to type 'T'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. t = (x: string) => 1; ~ !!! error TS2322: Type '(x: string) => number' is not assignable to type 'T'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. t = function (x: string) { return ''; } ~ !!! error TS2322: Type '(x: string) => string' is not assignable to type 'T'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. a = s2; ~ !!! error TS2322: Type 'S2' is not assignable to type '(x: number) => void'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. a = a3; ~ !!! error TS2322: Type '(x: string) => void' is not assignable to type '(x: number) => void'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. a = (x: string) => 1; ~ !!! error TS2322: Type '(x: string) => number' is not assignable to type '(x: number) => void'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. a = function (x: string) { return ''; } ~ !!! error TS2322: Type '(x: string) => string' is not assignable to type '(x: number) => void'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures2.errors.txt b/tests/baselines/reference/assignmentCompatWithCallSignatures2.errors.txt index e67f0a930c2..ffc0fdcd772 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures2.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures2.errors.txt @@ -10,12 +10,12 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme Types of property 'f' are incompatible. Type '(x: string) => void' is not assignable to type '(x: number) => void'. Types of parameters 'x' and 'x' are incompatible. - Type 'string' is not assignable to type 'number'. + Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures2.ts(43,1): error TS2322: Type '{ f(x: string): void; }' is not assignable to type 'T'. Types of property 'f' are incompatible. Type '(x: string) => void' is not assignable to type '(x: number) => void'. Types of parameters 'x' and 'x' are incompatible. - Type 'string' is not assignable to type 'number'. + Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures2.ts(44,1): error TS2322: Type '(x: string) => number' is not assignable to type 'T'. Property 'f' is missing in type '(x: string) => number'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures2.ts(45,1): error TS2322: Type '(x: string) => string' is not assignable to type 'T'. @@ -24,12 +24,12 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme Types of property 'f' are incompatible. Type '(x: string) => void' is not assignable to type '(x: number) => void'. Types of parameters 'x' and 'x' are incompatible. - Type 'string' is not assignable to type 'number'. + Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures2.ts(47,1): error TS2322: Type '{ f(x: string): void; }' is not assignable to type '{ f(x: number): void; }'. Types of property 'f' are incompatible. Type '(x: string) => void' is not assignable to type '(x: number) => void'. Types of parameters 'x' and 'x' are incompatible. - Type 'string' is not assignable to type 'number'. + Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures2.ts(48,1): error TS2322: Type '(x: string) => number' is not assignable to type '{ f(x: number): void; }'. Property 'f' is missing in type '(x: string) => number'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures2.ts(49,1): error TS2322: Type '(x: string) => string' is not assignable to type '{ f(x: number): void; }'. @@ -96,14 +96,14 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Types of property 'f' are incompatible. !!! error TS2322: Type '(x: string) => void' is not assignable to type '(x: number) => void'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. t = a3; ~ !!! error TS2322: Type '{ f(x: string): void; }' is not assignable to type 'T'. !!! error TS2322: Types of property 'f' are incompatible. !!! error TS2322: Type '(x: string) => void' is not assignable to type '(x: number) => void'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. t = (x: string) => 1; ~ !!! error TS2322: Type '(x: string) => number' is not assignable to type 'T'. @@ -118,14 +118,14 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Types of property 'f' are incompatible. !!! error TS2322: Type '(x: string) => void' is not assignable to type '(x: number) => void'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. a = a3; ~ !!! error TS2322: Type '{ f(x: string): void; }' is not assignable to type '{ f(x: number): void; }'. !!! error TS2322: Types of property 'f' are incompatible. !!! error TS2322: Type '(x: string) => void' is not assignable to type '(x: number) => void'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. a = (x: string) => 1; ~ !!! error TS2322: Type '(x: string) => number' is not assignable to type '{ f(x: number): void; }'. diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures3.symbols b/tests/baselines/reference/assignmentCompatWithCallSignatures3.symbols index ea9440cf1a9..de0a5dc7b28 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures3.symbols +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures3.symbols @@ -3,22 +3,22 @@ class Base { foo: string; } >Base : Symbol(Base, Decl(assignmentCompatWithCallSignatures3.ts, 0, 0)) ->foo : Symbol(foo, Decl(assignmentCompatWithCallSignatures3.ts, 2, 12)) +>foo : Symbol(Base.foo, Decl(assignmentCompatWithCallSignatures3.ts, 2, 12)) class Derived extends Base { bar: string; } >Derived : Symbol(Derived, Decl(assignmentCompatWithCallSignatures3.ts, 2, 27)) >Base : Symbol(Base, Decl(assignmentCompatWithCallSignatures3.ts, 0, 0)) ->bar : Symbol(bar, Decl(assignmentCompatWithCallSignatures3.ts, 3, 28)) +>bar : Symbol(Derived.bar, Decl(assignmentCompatWithCallSignatures3.ts, 3, 28)) class Derived2 extends Derived { baz: string; } >Derived2 : Symbol(Derived2, Decl(assignmentCompatWithCallSignatures3.ts, 3, 43)) >Derived : Symbol(Derived, Decl(assignmentCompatWithCallSignatures3.ts, 2, 27)) ->baz : Symbol(baz, Decl(assignmentCompatWithCallSignatures3.ts, 4, 32)) +>baz : Symbol(Derived2.baz, Decl(assignmentCompatWithCallSignatures3.ts, 4, 32)) class OtherDerived extends Base { bing: string; } >OtherDerived : Symbol(OtherDerived, Decl(assignmentCompatWithCallSignatures3.ts, 4, 47)) >Base : Symbol(Base, Decl(assignmentCompatWithCallSignatures3.ts, 0, 0)) ->bing : Symbol(bing, Decl(assignmentCompatWithCallSignatures3.ts, 5, 33)) +>bing : Symbol(OtherDerived.bing, Decl(assignmentCompatWithCallSignatures3.ts, 5, 33)) var a: (x: number) => number[]; >a : Symbol(a, Decl(assignmentCompatWithCallSignatures3.ts, 7, 3)) @@ -189,8 +189,8 @@ var a18: { (a: Date): Date; >a : Symbol(a, Decl(assignmentCompatWithCallSignatures3.ts, 40, 9)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) }): any[]; } diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures4.errors.txt b/tests/baselines/reference/assignmentCompatWithCallSignatures4.errors.txt index e00d1eea042..8d184edc085 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures4.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures4.errors.txt @@ -1,13 +1,17 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures4.ts(52,9): error TS2322: Type '(x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U' is not assignable to type '(x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived'. Types of parameters 'y' and 'y' are incompatible. - Type '(arg2: { foo: number; }) => any' is not assignable to type '(arg2: Base) => Derived'. + Type '(arg2: Base) => Derived' is not assignable to type '(arg2: { foo: number; }) => any'. Types of parameters 'arg2' and 'arg2' are incompatible. Type '{ foo: number; }' is not assignable to type 'Base'. Types of property 'foo' are incompatible. Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures4.ts(53,9): error TS2322: Type '(x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived' is not assignable to type '(x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U'. Types of parameters 'y' and 'y' are incompatible. - Type '(arg2: Base) => Derived' is not assignable to type '(arg2: { foo: number; }) => any'. + Type '(arg2: { foo: number; }) => any' is not assignable to type '(arg2: Base) => Derived'. + Types of parameters 'arg2' and 'arg2' are incompatible. + Type 'Base' is not assignable to type '{ foo: number; }'. + Types of property 'foo' are incompatible. + Type 'string' is not assignable to type 'number'. ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures4.ts (2 errors) ==== @@ -66,7 +70,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme ~~ !!! error TS2322: Type '(x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U' is not assignable to type '(x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived'. !!! error TS2322: Types of parameters 'y' and 'y' are incompatible. -!!! error TS2322: Type '(arg2: { foo: number; }) => any' is not assignable to type '(arg2: Base) => Derived'. +!!! error TS2322: Type '(arg2: Base) => Derived' is not assignable to type '(arg2: { foo: number; }) => any'. !!! error TS2322: Types of parameters 'arg2' and 'arg2' are incompatible. !!! error TS2322: Type '{ foo: number; }' is not assignable to type 'Base'. !!! error TS2322: Types of property 'foo' are incompatible. @@ -75,7 +79,11 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme ~~ !!! error TS2322: Type '(x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived' is not assignable to type '(x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U'. !!! error TS2322: Types of parameters 'y' and 'y' are incompatible. -!!! error TS2322: Type '(arg2: Base) => Derived' is not assignable to type '(arg2: { foo: number; }) => any'. +!!! error TS2322: Type '(arg2: { foo: number; }) => any' is not assignable to type '(arg2: Base) => Derived'. +!!! error TS2322: Types of parameters 'arg2' and 'arg2' are incompatible. +!!! error TS2322: Type 'Base' is not assignable to type '{ foo: number; }'. +!!! error TS2322: Types of property 'foo' are incompatible. +!!! error TS2322: Type 'string' is not assignable to type 'number'. var b10: (...x: T[]) => T; diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures5.symbols b/tests/baselines/reference/assignmentCompatWithCallSignatures5.symbols index e26e95b0c0c..e958922c1de 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures5.symbols +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures5.symbols @@ -3,22 +3,22 @@ class Base { foo: string; } >Base : Symbol(Base, Decl(assignmentCompatWithCallSignatures5.ts, 0, 0)) ->foo : Symbol(foo, Decl(assignmentCompatWithCallSignatures5.ts, 2, 12)) +>foo : Symbol(Base.foo, Decl(assignmentCompatWithCallSignatures5.ts, 2, 12)) class Derived extends Base { bar: string; } >Derived : Symbol(Derived, Decl(assignmentCompatWithCallSignatures5.ts, 2, 27)) >Base : Symbol(Base, Decl(assignmentCompatWithCallSignatures5.ts, 0, 0)) ->bar : Symbol(bar, Decl(assignmentCompatWithCallSignatures5.ts, 3, 28)) +>bar : Symbol(Derived.bar, Decl(assignmentCompatWithCallSignatures5.ts, 3, 28)) class Derived2 extends Derived { baz: string; } >Derived2 : Symbol(Derived2, Decl(assignmentCompatWithCallSignatures5.ts, 3, 43)) >Derived : Symbol(Derived, Decl(assignmentCompatWithCallSignatures5.ts, 2, 27)) ->baz : Symbol(baz, Decl(assignmentCompatWithCallSignatures5.ts, 4, 32)) +>baz : Symbol(Derived2.baz, Decl(assignmentCompatWithCallSignatures5.ts, 4, 32)) class OtherDerived extends Base { bing: string; } >OtherDerived : Symbol(OtherDerived, Decl(assignmentCompatWithCallSignatures5.ts, 4, 47)) >Base : Symbol(Base, Decl(assignmentCompatWithCallSignatures5.ts, 0, 0)) ->bing : Symbol(bing, Decl(assignmentCompatWithCallSignatures5.ts, 5, 33)) +>bing : Symbol(OtherDerived.bing, Decl(assignmentCompatWithCallSignatures5.ts, 5, 33)) var a: (x: T) => T[]; >a : Symbol(a, Decl(assignmentCompatWithCallSignatures5.ts, 7, 3)) diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures6.symbols b/tests/baselines/reference/assignmentCompatWithCallSignatures6.symbols index b7e6956ef65..008ea5481a9 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures6.symbols +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures6.symbols @@ -3,47 +3,47 @@ class Base { foo: string; } >Base : Symbol(Base, Decl(assignmentCompatWithCallSignatures6.ts, 0, 0)) ->foo : Symbol(foo, Decl(assignmentCompatWithCallSignatures6.ts, 2, 12)) +>foo : Symbol(Base.foo, Decl(assignmentCompatWithCallSignatures6.ts, 2, 12)) class Derived extends Base { bar: string; } >Derived : Symbol(Derived, Decl(assignmentCompatWithCallSignatures6.ts, 2, 27)) >Base : Symbol(Base, Decl(assignmentCompatWithCallSignatures6.ts, 0, 0)) ->bar : Symbol(bar, Decl(assignmentCompatWithCallSignatures6.ts, 3, 28)) +>bar : Symbol(Derived.bar, Decl(assignmentCompatWithCallSignatures6.ts, 3, 28)) class Derived2 extends Derived { baz: string; } >Derived2 : Symbol(Derived2, Decl(assignmentCompatWithCallSignatures6.ts, 3, 43)) >Derived : Symbol(Derived, Decl(assignmentCompatWithCallSignatures6.ts, 2, 27)) ->baz : Symbol(baz, Decl(assignmentCompatWithCallSignatures6.ts, 4, 32)) +>baz : Symbol(Derived2.baz, Decl(assignmentCompatWithCallSignatures6.ts, 4, 32)) class OtherDerived extends Base { bing: string; } >OtherDerived : Symbol(OtherDerived, Decl(assignmentCompatWithCallSignatures6.ts, 4, 47)) >Base : Symbol(Base, Decl(assignmentCompatWithCallSignatures6.ts, 0, 0)) ->bing : Symbol(bing, Decl(assignmentCompatWithCallSignatures6.ts, 5, 33)) +>bing : Symbol(OtherDerived.bing, Decl(assignmentCompatWithCallSignatures6.ts, 5, 33)) interface A { >A : Symbol(A, Decl(assignmentCompatWithCallSignatures6.ts, 5, 49)) a: (x: T) => T[]; ->a : Symbol(a, Decl(assignmentCompatWithCallSignatures6.ts, 7, 13)) +>a : Symbol(A.a, Decl(assignmentCompatWithCallSignatures6.ts, 7, 13)) >T : Symbol(T, Decl(assignmentCompatWithCallSignatures6.ts, 8, 8)) >x : Symbol(x, Decl(assignmentCompatWithCallSignatures6.ts, 8, 11)) >T : Symbol(T, Decl(assignmentCompatWithCallSignatures6.ts, 8, 8)) >T : Symbol(T, Decl(assignmentCompatWithCallSignatures6.ts, 8, 8)) a2: (x: T) => string[]; ->a2 : Symbol(a2, Decl(assignmentCompatWithCallSignatures6.ts, 8, 24)) +>a2 : Symbol(A.a2, Decl(assignmentCompatWithCallSignatures6.ts, 8, 24)) >T : Symbol(T, Decl(assignmentCompatWithCallSignatures6.ts, 9, 9)) >x : Symbol(x, Decl(assignmentCompatWithCallSignatures6.ts, 9, 12)) >T : Symbol(T, Decl(assignmentCompatWithCallSignatures6.ts, 9, 9)) a3: (x: T) => void; ->a3 : Symbol(a3, Decl(assignmentCompatWithCallSignatures6.ts, 9, 30)) +>a3 : Symbol(A.a3, Decl(assignmentCompatWithCallSignatures6.ts, 9, 30)) >T : Symbol(T, Decl(assignmentCompatWithCallSignatures6.ts, 10, 9)) >x : Symbol(x, Decl(assignmentCompatWithCallSignatures6.ts, 10, 12)) >T : Symbol(T, Decl(assignmentCompatWithCallSignatures6.ts, 10, 9)) a4: (x: T, y: U) => string; ->a4 : Symbol(a4, Decl(assignmentCompatWithCallSignatures6.ts, 10, 26)) +>a4 : Symbol(A.a4, Decl(assignmentCompatWithCallSignatures6.ts, 10, 26)) >T : Symbol(T, Decl(assignmentCompatWithCallSignatures6.ts, 11, 9)) >U : Symbol(U, Decl(assignmentCompatWithCallSignatures6.ts, 11, 11)) >x : Symbol(x, Decl(assignmentCompatWithCallSignatures6.ts, 11, 14)) @@ -52,7 +52,7 @@ interface A { >U : Symbol(U, Decl(assignmentCompatWithCallSignatures6.ts, 11, 11)) a5: (x: (arg: T) => U) => T; ->a5 : Symbol(a5, Decl(assignmentCompatWithCallSignatures6.ts, 11, 36)) +>a5 : Symbol(A.a5, Decl(assignmentCompatWithCallSignatures6.ts, 11, 36)) >T : Symbol(T, Decl(assignmentCompatWithCallSignatures6.ts, 12, 9)) >U : Symbol(U, Decl(assignmentCompatWithCallSignatures6.ts, 12, 11)) >x : Symbol(x, Decl(assignmentCompatWithCallSignatures6.ts, 12, 14)) @@ -62,7 +62,7 @@ interface A { >T : Symbol(T, Decl(assignmentCompatWithCallSignatures6.ts, 12, 9)) a6: (x: (arg: T) => Derived) => T; ->a6 : Symbol(a6, Decl(assignmentCompatWithCallSignatures6.ts, 12, 37)) +>a6 : Symbol(A.a6, Decl(assignmentCompatWithCallSignatures6.ts, 12, 37)) >T : Symbol(T, Decl(assignmentCompatWithCallSignatures6.ts, 13, 9)) >Base : Symbol(Base, Decl(assignmentCompatWithCallSignatures6.ts, 0, 0)) >x : Symbol(x, Decl(assignmentCompatWithCallSignatures6.ts, 13, 25)) @@ -72,7 +72,7 @@ interface A { >T : Symbol(T, Decl(assignmentCompatWithCallSignatures6.ts, 13, 9)) a11: (x: { foo: T }, y: { foo: T; bar: T }) => Base; ->a11 : Symbol(a11, Decl(assignmentCompatWithCallSignatures6.ts, 13, 54)) +>a11 : Symbol(A.a11, Decl(assignmentCompatWithCallSignatures6.ts, 13, 54)) >T : Symbol(T, Decl(assignmentCompatWithCallSignatures6.ts, 14, 10)) >x : Symbol(x, Decl(assignmentCompatWithCallSignatures6.ts, 14, 13)) >foo : Symbol(foo, Decl(assignmentCompatWithCallSignatures6.ts, 14, 17)) @@ -85,7 +85,7 @@ interface A { >Base : Symbol(Base, Decl(assignmentCompatWithCallSignatures6.ts, 0, 0)) a15: (x: { a: T; b: T }) => T[]; ->a15 : Symbol(a15, Decl(assignmentCompatWithCallSignatures6.ts, 14, 59)) +>a15 : Symbol(A.a15, Decl(assignmentCompatWithCallSignatures6.ts, 14, 59)) >T : Symbol(T, Decl(assignmentCompatWithCallSignatures6.ts, 15, 10)) >x : Symbol(x, Decl(assignmentCompatWithCallSignatures6.ts, 15, 13)) >a : Symbol(a, Decl(assignmentCompatWithCallSignatures6.ts, 15, 17)) @@ -95,7 +95,7 @@ interface A { >T : Symbol(T, Decl(assignmentCompatWithCallSignatures6.ts, 15, 10)) a16: (x: { a: T; b: T }) => T[]; ->a16 : Symbol(a16, Decl(assignmentCompatWithCallSignatures6.ts, 15, 39)) +>a16 : Symbol(A.a16, Decl(assignmentCompatWithCallSignatures6.ts, 15, 39)) >T : Symbol(T, Decl(assignmentCompatWithCallSignatures6.ts, 16, 10)) >Base : Symbol(Base, Decl(assignmentCompatWithCallSignatures6.ts, 0, 0)) >x : Symbol(x, Decl(assignmentCompatWithCallSignatures6.ts, 16, 26)) diff --git a/tests/baselines/reference/assignmentCompatWithCallSignaturesWithRestParameters.errors.txt b/tests/baselines/reference/assignmentCompatWithCallSignaturesWithRestParameters.errors.txt index 8eec8503e70..6b563ef2631 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignaturesWithRestParameters.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithCallSignaturesWithRestParameters.errors.txt @@ -1,30 +1,30 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignaturesWithRestParameters.ts(13,5): error TS2322: Type '(...args: string[]) => number' is not assignable to type '(...args: number[]) => number'. Types of parameters 'args' and 'args' are incompatible. - Type 'string' is not assignable to type 'number'. + Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignaturesWithRestParameters.ts(17,5): error TS2322: Type '(x?: string) => number' is not assignable to type '(...args: number[]) => number'. Types of parameters 'x' and 'args' are incompatible. - Type 'string' is not assignable to type 'number'. + Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignaturesWithRestParameters.ts(26,5): error TS2322: Type '(x: number, ...args: string[]) => number' is not assignable to type '(x: number, ...z: number[]) => number'. Types of parameters 'args' and 'z' are incompatible. - Type 'string' is not assignable to type 'number'. + Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignaturesWithRestParameters.ts(35,5): error TS2322: Type '(x: number, y?: number, z?: number) => number' is not assignable to type '(x: number, y?: string, ...z: number[]) => number'. Types of parameters 'y' and 'y' are incompatible. - Type 'number' is not assignable to type 'string'. + Type 'string' is not assignable to type 'number'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignaturesWithRestParameters.ts(36,5): error TS2322: Type '(x: number, ...z: number[]) => number' is not assignable to type '(x: number, y?: string, ...z: number[]) => number'. Types of parameters 'z' and 'y' are incompatible. - Type 'number' is not assignable to type 'string'. + Type 'string' is not assignable to type 'number'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignaturesWithRestParameters.ts(37,5): error TS2322: Type '(x: string, y?: string, z?: string) => number' is not assignable to type '(x: number, y?: string, ...z: number[]) => number'. Types of parameters 'x' and 'x' are incompatible. - Type 'string' is not assignable to type 'number'. + Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignaturesWithRestParameters.ts(41,5): error TS2322: Type '(x?: number, y?: number) => number' is not assignable to type '(x?: number, y?: string, ...z: number[]) => number'. Types of parameters 'y' and 'y' are incompatible. - Type 'number' is not assignable to type 'string'. + Type 'string' is not assignable to type 'number'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignaturesWithRestParameters.ts(43,5): error TS2322: Type '(x: number, y?: number) => number' is not assignable to type '(x?: number, y?: string, ...z: number[]) => number'. Types of parameters 'y' and 'y' are incompatible. - Type 'number' is not assignable to type 'string'. + Type 'string' is not assignable to type 'number'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignaturesWithRestParameters.ts(45,5): error TS2322: Type '(x: number, ...args: string[]) => number' is not assignable to type '(x?: number, y?: string, ...z: number[]) => number'. Types of parameters 'args' and 'z' are incompatible. - Type 'string' is not assignable to type 'number'. + Type 'number' is not assignable to type 'string'. ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignaturesWithRestParameters.ts (9 errors) ==== @@ -44,7 +44,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme ~ !!! error TS2322: Type '(...args: string[]) => number' is not assignable to type '(...args: number[]) => number'. !!! error TS2322: Types of parameters 'args' and 'args' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. a = (x?: number) => 1; // ok, same number of required params a = (x?: number, y?: number, z?: number) => 1; // ok, same number of required params a = (x: number) => 1; // ok, rest param corresponds to infinite number of params @@ -52,7 +52,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme ~ !!! error TS2322: Type '(x?: string) => number' is not assignable to type '(...args: number[]) => number'. !!! error TS2322: Types of parameters 'x' and 'args' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. var a2: (x: number, ...z: number[]) => number; @@ -65,7 +65,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme ~~ !!! error TS2322: Type '(x: number, ...args: string[]) => number' is not assignable to type '(x: number, ...z: number[]) => number'. !!! error TS2322: Types of parameters 'args' and 'z' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. a2 = (x: number, y: number) => 1; // ok, rest param corresponds to infinite number of params a2 = (x: number, y?: number) => 1; // ok, same number of required params @@ -78,17 +78,17 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme ~~ !!! error TS2322: Type '(x: number, y?: number, z?: number) => number' is not assignable to type '(x: number, y?: string, ...z: number[]) => number'. !!! error TS2322: Types of parameters 'y' and 'y' are incompatible. -!!! error TS2322: Type 'number' is not assignable to type 'string'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. a3 = (x: number, ...z: number[]) => 1; // error ~~ !!! error TS2322: Type '(x: number, ...z: number[]) => number' is not assignable to type '(x: number, y?: string, ...z: number[]) => number'. !!! error TS2322: Types of parameters 'z' and 'y' are incompatible. -!!! error TS2322: Type 'number' is not assignable to type 'string'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. a3 = (x: string, y?: string, z?: string) => 1; // error ~~ !!! error TS2322: Type '(x: string, y?: string, z?: string) => number' is not assignable to type '(x: number, y?: string, ...z: number[]) => number'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. var a4: (x?: number, y?: string, ...z: number[]) => number; a4 = () => 1; // ok, fewer required params @@ -96,16 +96,16 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme ~~ !!! error TS2322: Type '(x?: number, y?: number) => number' is not assignable to type '(x?: number, y?: string, ...z: number[]) => number'. !!! error TS2322: Types of parameters 'y' and 'y' are incompatible. -!!! error TS2322: Type 'number' is not assignable to type 'string'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. a4 = (x: number) => 1; // ok, all present params match a4 = (x: number, y?: number) => 1; // error, second param has type mismatch ~~ !!! error TS2322: Type '(x: number, y?: number) => number' is not assignable to type '(x?: number, y?: string, ...z: number[]) => number'. !!! error TS2322: Types of parameters 'y' and 'y' are incompatible. -!!! error TS2322: Type 'number' is not assignable to type 'string'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. a4 = (x?: number, y?: string) => 1; // ok, same number of required params with matching types a4 = (x: number, ...args: string[]) => 1; // error, rest params have type mismatch ~~ !!! error TS2322: Type '(x: number, ...args: string[]) => number' is not assignable to type '(x?: number, y?: string, ...z: number[]) => number'. !!! error TS2322: Types of parameters 'args' and 'z' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'number'. \ No newline at end of file +!!! error TS2322: Type 'number' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures3.symbols b/tests/baselines/reference/assignmentCompatWithConstructSignatures3.symbols index 4ef01deaea8..0e3b0b38332 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures3.symbols +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures3.symbols @@ -3,22 +3,22 @@ class Base { foo: string; } >Base : Symbol(Base, Decl(assignmentCompatWithConstructSignatures3.ts, 0, 0)) ->foo : Symbol(foo, Decl(assignmentCompatWithConstructSignatures3.ts, 2, 12)) +>foo : Symbol(Base.foo, Decl(assignmentCompatWithConstructSignatures3.ts, 2, 12)) class Derived extends Base { bar: string; } >Derived : Symbol(Derived, Decl(assignmentCompatWithConstructSignatures3.ts, 2, 27)) >Base : Symbol(Base, Decl(assignmentCompatWithConstructSignatures3.ts, 0, 0)) ->bar : Symbol(bar, Decl(assignmentCompatWithConstructSignatures3.ts, 3, 28)) +>bar : Symbol(Derived.bar, Decl(assignmentCompatWithConstructSignatures3.ts, 3, 28)) class Derived2 extends Derived { baz: string; } >Derived2 : Symbol(Derived2, Decl(assignmentCompatWithConstructSignatures3.ts, 3, 43)) >Derived : Symbol(Derived, Decl(assignmentCompatWithConstructSignatures3.ts, 2, 27)) ->baz : Symbol(baz, Decl(assignmentCompatWithConstructSignatures3.ts, 4, 32)) +>baz : Symbol(Derived2.baz, Decl(assignmentCompatWithConstructSignatures3.ts, 4, 32)) class OtherDerived extends Base { bing: string; } >OtherDerived : Symbol(OtherDerived, Decl(assignmentCompatWithConstructSignatures3.ts, 4, 47)) >Base : Symbol(Base, Decl(assignmentCompatWithConstructSignatures3.ts, 0, 0)) ->bing : Symbol(bing, Decl(assignmentCompatWithConstructSignatures3.ts, 5, 33)) +>bing : Symbol(OtherDerived.bing, Decl(assignmentCompatWithConstructSignatures3.ts, 5, 33)) var a: new (x: number) => number[]; >a : Symbol(a, Decl(assignmentCompatWithConstructSignatures3.ts, 7, 3)) @@ -189,8 +189,8 @@ var a18: { new (a: Date): Date; >a : Symbol(a, Decl(assignmentCompatWithConstructSignatures3.ts, 40, 13)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) }): any[]; } diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures4.errors.txt b/tests/baselines/reference/assignmentCompatWithConstructSignatures4.errors.txt index 6cd40f6c8c1..3f8111a3244 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures4.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures4.errors.txt @@ -1,27 +1,33 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4.ts(52,9): error TS2322: Type 'new (x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U' is not assignable to type 'new (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived'. Types of parameters 'y' and 'y' are incompatible. - Type '(arg2: { foo: number; }) => any' is not assignable to type '(arg2: Base) => Derived'. + Type '(arg2: Base) => Derived' is not assignable to type '(arg2: { foo: number; }) => any'. Types of parameters 'arg2' and 'arg2' are incompatible. Type '{ foo: number; }' is not assignable to type 'Base'. Types of property 'foo' are incompatible. Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4.ts(53,9): error TS2322: Type 'new (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived' is not assignable to type 'new (x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U'. Types of parameters 'y' and 'y' are incompatible. - Type '(arg2: Base) => Derived' is not assignable to type '(arg2: { foo: number; }) => any'. + Type '(arg2: { foo: number; }) => any' is not assignable to type '(arg2: Base) => Derived'. + Types of parameters 'arg2' and 'arg2' are incompatible. + Type 'Base' is not assignable to type '{ foo: number; }'. + Types of property 'foo' are incompatible. + Type 'string' is not assignable to type 'number'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4.ts(77,9): error TS2322: Type 'new (x: (a: T) => T) => T[]' is not assignable to type '{ new (x: { new (a: number): number; new (a?: number): number; }): number[]; new (x: { new (a: boolean): boolean; new (a?: boolean): boolean; }): boolean[]; }'. + Types of parameters 'x' and 'x' are incompatible. + Type '{ new (a: number): number; new (a?: number): number; }' is not assignable to type '(a: any) => any'. + Type '{ new (a: number): number; new (a?: number): number; }' provides no match for the signature '(a: any): any' +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4.ts(78,9): error TS2322: Type '{ new (x: { new (a: number): number; new (a?: number): number; }): number[]; new (x: { new (a: boolean): boolean; new (a?: boolean): boolean; }): boolean[]; }' is not assignable to type 'new (x: (a: T) => T) => T[]'. Types of parameters 'x' and 'x' are incompatible. Type '(a: any) => any' is not assignable to type '{ new (a: number): number; new (a?: number): number; }'. Type '(a: any) => any' provides no match for the signature 'new (a: number): number' -tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4.ts(78,9): error TS2322: Type '{ new (x: { new (a: number): number; new (a?: number): number; }): number[]; new (x: { new (a: boolean): boolean; new (a?: boolean): boolean; }): boolean[]; }' is not assignable to type 'new (x: (a: T) => T) => T[]'. - Types of parameters 'x' and 'x' are incompatible. - Type '{ new (a: number): number; new (a?: number): number; }' is not assignable to type '(a: any) => any'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4.ts(81,9): error TS2322: Type 'new (x: (a: T) => T) => any[]' is not assignable to type '{ new (x: { new (a: T): T; new (a: T): T; }): any[]; new (x: { new (a: T): T; new (a: T): T; }): any[]; }'. + Types of parameters 'x' and 'x' are incompatible. + Type '{ new (a: T): T; new (a: T): T; }' is not assignable to type '(a: any) => any'. + Type '{ new (a: T): T; new (a: T): T; }' provides no match for the signature '(a: any): any' +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4.ts(82,9): error TS2322: Type '{ new (x: { new (a: T): T; new (a: T): T; }): any[]; new (x: { new (a: T): T; new (a: T): T; }): any[]; }' is not assignable to type 'new (x: (a: T) => T) => any[]'. Types of parameters 'x' and 'x' are incompatible. Type '(a: any) => any' is not assignable to type '{ new (a: T): T; new (a: T): T; }'. Type '(a: any) => any' provides no match for the signature 'new (a: T): T' -tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4.ts(82,9): error TS2322: Type '{ new (x: { new (a: T): T; new (a: T): T; }): any[]; new (x: { new (a: T): T; new (a: T): T; }): any[]; }' is not assignable to type 'new (x: (a: T) => T) => any[]'. - Types of parameters 'x' and 'x' are incompatible. - Type '{ new (a: T): T; new (a: T): T; }' is not assignable to type '(a: any) => any'. ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4.ts (6 errors) ==== @@ -80,7 +86,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme ~~ !!! error TS2322: Type 'new (x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U' is not assignable to type 'new (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived'. !!! error TS2322: Types of parameters 'y' and 'y' are incompatible. -!!! error TS2322: Type '(arg2: { foo: number; }) => any' is not assignable to type '(arg2: Base) => Derived'. +!!! error TS2322: Type '(arg2: Base) => Derived' is not assignable to type '(arg2: { foo: number; }) => any'. !!! error TS2322: Types of parameters 'arg2' and 'arg2' are incompatible. !!! error TS2322: Type '{ foo: number; }' is not assignable to type 'Base'. !!! error TS2322: Types of property 'foo' are incompatible. @@ -89,7 +95,11 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme ~~ !!! error TS2322: Type 'new (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived' is not assignable to type 'new (x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U'. !!! error TS2322: Types of parameters 'y' and 'y' are incompatible. -!!! error TS2322: Type '(arg2: Base) => Derived' is not assignable to type '(arg2: { foo: number; }) => any'. +!!! error TS2322: Type '(arg2: { foo: number; }) => any' is not assignable to type '(arg2: Base) => Derived'. +!!! error TS2322: Types of parameters 'arg2' and 'arg2' are incompatible. +!!! error TS2322: Type 'Base' is not assignable to type '{ foo: number; }'. +!!! error TS2322: Types of property 'foo' are incompatible. +!!! error TS2322: Type 'string' is not assignable to type 'number'. var b10: new (...x: T[]) => T; @@ -117,26 +127,28 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme ~~~ !!! error TS2322: Type 'new (x: (a: T) => T) => T[]' is not assignable to type '{ new (x: { new (a: number): number; new (a?: number): number; }): number[]; new (x: { new (a: boolean): boolean; new (a?: boolean): boolean; }): boolean[]; }'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2322: Type '(a: any) => any' is not assignable to type '{ new (a: number): number; new (a?: number): number; }'. -!!! error TS2322: Type '(a: any) => any' provides no match for the signature 'new (a: number): number' +!!! error TS2322: Type '{ new (a: number): number; new (a?: number): number; }' is not assignable to type '(a: any) => any'. +!!! error TS2322: Type '{ new (a: number): number; new (a?: number): number; }' provides no match for the signature '(a: any): any' b16 = a16; // error ~~~ !!! error TS2322: Type '{ new (x: { new (a: number): number; new (a?: number): number; }): number[]; new (x: { new (a: boolean): boolean; new (a?: boolean): boolean; }): boolean[]; }' is not assignable to type 'new (x: (a: T) => T) => T[]'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2322: Type '{ new (a: number): number; new (a?: number): number; }' is not assignable to type '(a: any) => any'. +!!! error TS2322: Type '(a: any) => any' is not assignable to type '{ new (a: number): number; new (a?: number): number; }'. +!!! error TS2322: Type '(a: any) => any' provides no match for the signature 'new (a: number): number' var b17: new (x: (a: T) => T) => any[]; a17 = b17; // error ~~~ !!! error TS2322: Type 'new (x: (a: T) => T) => any[]' is not assignable to type '{ new (x: { new (a: T): T; new (a: T): T; }): any[]; new (x: { new (a: T): T; new (a: T): T; }): any[]; }'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2322: Type '(a: any) => any' is not assignable to type '{ new (a: T): T; new (a: T): T; }'. -!!! error TS2322: Type '(a: any) => any' provides no match for the signature 'new (a: T): T' +!!! error TS2322: Type '{ new (a: T): T; new (a: T): T; }' is not assignable to type '(a: any) => any'. +!!! error TS2322: Type '{ new (a: T): T; new (a: T): T; }' provides no match for the signature '(a: any): any' b17 = a17; // error ~~~ !!! error TS2322: Type '{ new (x: { new (a: T): T; new (a: T): T; }): any[]; new (x: { new (a: T): T; new (a: T): T; }): any[]; }' is not assignable to type 'new (x: (a: T) => T) => any[]'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2322: Type '{ new (a: T): T; new (a: T): T; }' is not assignable to type '(a: any) => any'. +!!! error TS2322: Type '(a: any) => any' is not assignable to type '{ new (a: T): T; new (a: T): T; }'. +!!! error TS2322: Type '(a: any) => any' provides no match for the signature 'new (a: T): T' } module WithGenericSignaturesInBaseType { diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures5.symbols b/tests/baselines/reference/assignmentCompatWithConstructSignatures5.symbols index d2016b247b8..6fa6cc53bcd 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures5.symbols +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures5.symbols @@ -3,22 +3,22 @@ class Base { foo: string; } >Base : Symbol(Base, Decl(assignmentCompatWithConstructSignatures5.ts, 0, 0)) ->foo : Symbol(foo, Decl(assignmentCompatWithConstructSignatures5.ts, 2, 12)) +>foo : Symbol(Base.foo, Decl(assignmentCompatWithConstructSignatures5.ts, 2, 12)) class Derived extends Base { bar: string; } >Derived : Symbol(Derived, Decl(assignmentCompatWithConstructSignatures5.ts, 2, 27)) >Base : Symbol(Base, Decl(assignmentCompatWithConstructSignatures5.ts, 0, 0)) ->bar : Symbol(bar, Decl(assignmentCompatWithConstructSignatures5.ts, 3, 28)) +>bar : Symbol(Derived.bar, Decl(assignmentCompatWithConstructSignatures5.ts, 3, 28)) class Derived2 extends Derived { baz: string; } >Derived2 : Symbol(Derived2, Decl(assignmentCompatWithConstructSignatures5.ts, 3, 43)) >Derived : Symbol(Derived, Decl(assignmentCompatWithConstructSignatures5.ts, 2, 27)) ->baz : Symbol(baz, Decl(assignmentCompatWithConstructSignatures5.ts, 4, 32)) +>baz : Symbol(Derived2.baz, Decl(assignmentCompatWithConstructSignatures5.ts, 4, 32)) class OtherDerived extends Base { bing: string; } >OtherDerived : Symbol(OtherDerived, Decl(assignmentCompatWithConstructSignatures5.ts, 4, 47)) >Base : Symbol(Base, Decl(assignmentCompatWithConstructSignatures5.ts, 0, 0)) ->bing : Symbol(bing, Decl(assignmentCompatWithConstructSignatures5.ts, 5, 33)) +>bing : Symbol(OtherDerived.bing, Decl(assignmentCompatWithConstructSignatures5.ts, 5, 33)) var a: new (x: T) => T[]; >a : Symbol(a, Decl(assignmentCompatWithConstructSignatures5.ts, 7, 3)) diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures6.symbols b/tests/baselines/reference/assignmentCompatWithConstructSignatures6.symbols index 1850406bfa8..8db5ad09d1d 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures6.symbols +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures6.symbols @@ -3,47 +3,47 @@ class Base { foo: string; } >Base : Symbol(Base, Decl(assignmentCompatWithConstructSignatures6.ts, 0, 0)) ->foo : Symbol(foo, Decl(assignmentCompatWithConstructSignatures6.ts, 2, 12)) +>foo : Symbol(Base.foo, Decl(assignmentCompatWithConstructSignatures6.ts, 2, 12)) class Derived extends Base { bar: string; } >Derived : Symbol(Derived, Decl(assignmentCompatWithConstructSignatures6.ts, 2, 27)) >Base : Symbol(Base, Decl(assignmentCompatWithConstructSignatures6.ts, 0, 0)) ->bar : Symbol(bar, Decl(assignmentCompatWithConstructSignatures6.ts, 3, 28)) +>bar : Symbol(Derived.bar, Decl(assignmentCompatWithConstructSignatures6.ts, 3, 28)) class Derived2 extends Derived { baz: string; } >Derived2 : Symbol(Derived2, Decl(assignmentCompatWithConstructSignatures6.ts, 3, 43)) >Derived : Symbol(Derived, Decl(assignmentCompatWithConstructSignatures6.ts, 2, 27)) ->baz : Symbol(baz, Decl(assignmentCompatWithConstructSignatures6.ts, 4, 32)) +>baz : Symbol(Derived2.baz, Decl(assignmentCompatWithConstructSignatures6.ts, 4, 32)) class OtherDerived extends Base { bing: string; } >OtherDerived : Symbol(OtherDerived, Decl(assignmentCompatWithConstructSignatures6.ts, 4, 47)) >Base : Symbol(Base, Decl(assignmentCompatWithConstructSignatures6.ts, 0, 0)) ->bing : Symbol(bing, Decl(assignmentCompatWithConstructSignatures6.ts, 5, 33)) +>bing : Symbol(OtherDerived.bing, Decl(assignmentCompatWithConstructSignatures6.ts, 5, 33)) interface A { >A : Symbol(A, Decl(assignmentCompatWithConstructSignatures6.ts, 5, 49)) a: new (x: T) => T[]; ->a : Symbol(a, Decl(assignmentCompatWithConstructSignatures6.ts, 7, 13)) +>a : Symbol(A.a, Decl(assignmentCompatWithConstructSignatures6.ts, 7, 13)) >T : Symbol(T, Decl(assignmentCompatWithConstructSignatures6.ts, 8, 12)) >x : Symbol(x, Decl(assignmentCompatWithConstructSignatures6.ts, 8, 15)) >T : Symbol(T, Decl(assignmentCompatWithConstructSignatures6.ts, 8, 12)) >T : Symbol(T, Decl(assignmentCompatWithConstructSignatures6.ts, 8, 12)) a2: new (x: T) => string[]; ->a2 : Symbol(a2, Decl(assignmentCompatWithConstructSignatures6.ts, 8, 28)) +>a2 : Symbol(A.a2, Decl(assignmentCompatWithConstructSignatures6.ts, 8, 28)) >T : Symbol(T, Decl(assignmentCompatWithConstructSignatures6.ts, 9, 13)) >x : Symbol(x, Decl(assignmentCompatWithConstructSignatures6.ts, 9, 16)) >T : Symbol(T, Decl(assignmentCompatWithConstructSignatures6.ts, 9, 13)) a3: new (x: T) => void; ->a3 : Symbol(a3, Decl(assignmentCompatWithConstructSignatures6.ts, 9, 34)) +>a3 : Symbol(A.a3, Decl(assignmentCompatWithConstructSignatures6.ts, 9, 34)) >T : Symbol(T, Decl(assignmentCompatWithConstructSignatures6.ts, 10, 13)) >x : Symbol(x, Decl(assignmentCompatWithConstructSignatures6.ts, 10, 16)) >T : Symbol(T, Decl(assignmentCompatWithConstructSignatures6.ts, 10, 13)) a4: new (x: T, y: U) => string; ->a4 : Symbol(a4, Decl(assignmentCompatWithConstructSignatures6.ts, 10, 30)) +>a4 : Symbol(A.a4, Decl(assignmentCompatWithConstructSignatures6.ts, 10, 30)) >T : Symbol(T, Decl(assignmentCompatWithConstructSignatures6.ts, 11, 13)) >U : Symbol(U, Decl(assignmentCompatWithConstructSignatures6.ts, 11, 15)) >x : Symbol(x, Decl(assignmentCompatWithConstructSignatures6.ts, 11, 19)) @@ -52,7 +52,7 @@ interface A { >U : Symbol(U, Decl(assignmentCompatWithConstructSignatures6.ts, 11, 15)) a5: new (x: (arg: T) => U) => T; ->a5 : Symbol(a5, Decl(assignmentCompatWithConstructSignatures6.ts, 11, 41)) +>a5 : Symbol(A.a5, Decl(assignmentCompatWithConstructSignatures6.ts, 11, 41)) >T : Symbol(T, Decl(assignmentCompatWithConstructSignatures6.ts, 12, 13)) >U : Symbol(U, Decl(assignmentCompatWithConstructSignatures6.ts, 12, 15)) >x : Symbol(x, Decl(assignmentCompatWithConstructSignatures6.ts, 12, 19)) @@ -62,7 +62,7 @@ interface A { >T : Symbol(T, Decl(assignmentCompatWithConstructSignatures6.ts, 12, 13)) a6: new (x: (arg: T) => Derived) => T; ->a6 : Symbol(a6, Decl(assignmentCompatWithConstructSignatures6.ts, 12, 42)) +>a6 : Symbol(A.a6, Decl(assignmentCompatWithConstructSignatures6.ts, 12, 42)) >T : Symbol(T, Decl(assignmentCompatWithConstructSignatures6.ts, 13, 13)) >Base : Symbol(Base, Decl(assignmentCompatWithConstructSignatures6.ts, 0, 0)) >x : Symbol(x, Decl(assignmentCompatWithConstructSignatures6.ts, 13, 29)) @@ -72,7 +72,7 @@ interface A { >T : Symbol(T, Decl(assignmentCompatWithConstructSignatures6.ts, 13, 13)) a11: new (x: { foo: T }, y: { foo: T; bar: T }) => Base; ->a11 : Symbol(a11, Decl(assignmentCompatWithConstructSignatures6.ts, 13, 58)) +>a11 : Symbol(A.a11, Decl(assignmentCompatWithConstructSignatures6.ts, 13, 58)) >T : Symbol(T, Decl(assignmentCompatWithConstructSignatures6.ts, 14, 14)) >x : Symbol(x, Decl(assignmentCompatWithConstructSignatures6.ts, 14, 17)) >foo : Symbol(foo, Decl(assignmentCompatWithConstructSignatures6.ts, 14, 21)) @@ -85,7 +85,7 @@ interface A { >Base : Symbol(Base, Decl(assignmentCompatWithConstructSignatures6.ts, 0, 0)) a15: new (x: { a: T; b: T }) => T[]; ->a15 : Symbol(a15, Decl(assignmentCompatWithConstructSignatures6.ts, 14, 63)) +>a15 : Symbol(A.a15, Decl(assignmentCompatWithConstructSignatures6.ts, 14, 63)) >T : Symbol(T, Decl(assignmentCompatWithConstructSignatures6.ts, 15, 14)) >x : Symbol(x, Decl(assignmentCompatWithConstructSignatures6.ts, 15, 17)) >a : Symbol(a, Decl(assignmentCompatWithConstructSignatures6.ts, 15, 21)) @@ -95,7 +95,7 @@ interface A { >T : Symbol(T, Decl(assignmentCompatWithConstructSignatures6.ts, 15, 14)) a16: new (x: { a: T; b: T }) => T[]; ->a16 : Symbol(a16, Decl(assignmentCompatWithConstructSignatures6.ts, 15, 43)) +>a16 : Symbol(A.a16, Decl(assignmentCompatWithConstructSignatures6.ts, 15, 43)) >T : Symbol(T, Decl(assignmentCompatWithConstructSignatures6.ts, 16, 14)) >Base : Symbol(Base, Decl(assignmentCompatWithConstructSignatures6.ts, 0, 0)) >x : Symbol(x, Decl(assignmentCompatWithConstructSignatures6.ts, 16, 30)) diff --git a/tests/baselines/reference/assignmentCompatWithGenericCallSignatures4.symbols b/tests/baselines/reference/assignmentCompatWithGenericCallSignatures4.symbols index bcea8fbbb27..86531a95506 100644 --- a/tests/baselines/reference/assignmentCompatWithGenericCallSignatures4.symbols +++ b/tests/baselines/reference/assignmentCompatWithGenericCallSignatures4.symbols @@ -6,7 +6,7 @@ interface I2 { >T : Symbol(T, Decl(assignmentCompatWithGenericCallSignatures4.ts, 2, 13)) p: T ->p : Symbol(p, Decl(assignmentCompatWithGenericCallSignatures4.ts, 2, 17)) +>p : Symbol(I2.p, Decl(assignmentCompatWithGenericCallSignatures4.ts, 2, 17)) >T : Symbol(T, Decl(assignmentCompatWithGenericCallSignatures4.ts, 2, 13)) } diff --git a/tests/baselines/reference/assignmentCompatWithObjectMembers.symbols b/tests/baselines/reference/assignmentCompatWithObjectMembers.symbols index 181c4db641a..9b84883324d 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembers.symbols +++ b/tests/baselines/reference/assignmentCompatWithObjectMembers.symbols @@ -7,11 +7,11 @@ module SimpleTypes { class S { foo: string; } >S : Symbol(S, Decl(assignmentCompatWithObjectMembers.ts, 3, 20)) ->foo : Symbol(foo, Decl(assignmentCompatWithObjectMembers.ts, 4, 13)) +>foo : Symbol(S.foo, Decl(assignmentCompatWithObjectMembers.ts, 4, 13)) class T { foo: string; } >T : Symbol(T, Decl(assignmentCompatWithObjectMembers.ts, 4, 28)) ->foo : Symbol(foo, Decl(assignmentCompatWithObjectMembers.ts, 5, 13)) +>foo : Symbol(T.foo, Decl(assignmentCompatWithObjectMembers.ts, 5, 13)) var s: S; >s : Symbol(s, Decl(assignmentCompatWithObjectMembers.ts, 6, 7)) @@ -23,11 +23,11 @@ module SimpleTypes { interface S2 { foo: string; } >S2 : Symbol(S2, Decl(assignmentCompatWithObjectMembers.ts, 7, 13)) ->foo : Symbol(foo, Decl(assignmentCompatWithObjectMembers.ts, 9, 18)) +>foo : Symbol(S2.foo, Decl(assignmentCompatWithObjectMembers.ts, 9, 18)) interface T2 { foo: string; } >T2 : Symbol(T2, Decl(assignmentCompatWithObjectMembers.ts, 9, 33)) ->foo : Symbol(foo, Decl(assignmentCompatWithObjectMembers.ts, 10, 18)) +>foo : Symbol(T2.foo, Decl(assignmentCompatWithObjectMembers.ts, 10, 18)) var s2: S2; >s2 : Symbol(s2, Decl(assignmentCompatWithObjectMembers.ts, 11, 7)) @@ -135,12 +135,12 @@ module ObjectTypes { class S { foo: S; } >S : Symbol(S, Decl(assignmentCompatWithObjectMembers.ts, 44, 20)) ->foo : Symbol(foo, Decl(assignmentCompatWithObjectMembers.ts, 45, 13)) +>foo : Symbol(S.foo, Decl(assignmentCompatWithObjectMembers.ts, 45, 13)) >S : Symbol(S, Decl(assignmentCompatWithObjectMembers.ts, 44, 20)) class T { foo: T; } >T : Symbol(T, Decl(assignmentCompatWithObjectMembers.ts, 45, 23)) ->foo : Symbol(foo, Decl(assignmentCompatWithObjectMembers.ts, 46, 13)) +>foo : Symbol(T.foo, Decl(assignmentCompatWithObjectMembers.ts, 46, 13)) >T : Symbol(T, Decl(assignmentCompatWithObjectMembers.ts, 45, 23)) var s: S; @@ -153,12 +153,12 @@ module ObjectTypes { interface S2 { foo: S2; } >S2 : Symbol(S2, Decl(assignmentCompatWithObjectMembers.ts, 48, 13)) ->foo : Symbol(foo, Decl(assignmentCompatWithObjectMembers.ts, 50, 18)) +>foo : Symbol(S2.foo, Decl(assignmentCompatWithObjectMembers.ts, 50, 18)) >S2 : Symbol(S2, Decl(assignmentCompatWithObjectMembers.ts, 48, 13)) interface T2 { foo: T2; } >T2 : Symbol(T2, Decl(assignmentCompatWithObjectMembers.ts, 50, 29)) ->foo : Symbol(foo, Decl(assignmentCompatWithObjectMembers.ts, 51, 18)) +>foo : Symbol(T2.foo, Decl(assignmentCompatWithObjectMembers.ts, 51, 18)) >T2 : Symbol(T2, Decl(assignmentCompatWithObjectMembers.ts, 50, 29)) var s2: S2; diff --git a/tests/baselines/reference/assignmentCompatWithObjectMembers2.symbols b/tests/baselines/reference/assignmentCompatWithObjectMembers2.symbols index ab3301c5e93..e0ac6899eaf 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembers2.symbols +++ b/tests/baselines/reference/assignmentCompatWithObjectMembers2.symbols @@ -4,11 +4,11 @@ class S { foo: string; } >S : Symbol(S, Decl(assignmentCompatWithObjectMembers2.ts, 0, 0)) ->foo : Symbol(foo, Decl(assignmentCompatWithObjectMembers2.ts, 3, 9)) +>foo : Symbol(S.foo, Decl(assignmentCompatWithObjectMembers2.ts, 3, 9)) class T { foo: string; } >T : Symbol(T, Decl(assignmentCompatWithObjectMembers2.ts, 3, 24)) ->foo : Symbol(foo, Decl(assignmentCompatWithObjectMembers2.ts, 4, 9)) +>foo : Symbol(T.foo, Decl(assignmentCompatWithObjectMembers2.ts, 4, 9)) var s: S; >s : Symbol(s, Decl(assignmentCompatWithObjectMembers2.ts, 5, 3)) @@ -20,13 +20,13 @@ var t: T; interface S2 { foo: string; bar?: string } >S2 : Symbol(S2, Decl(assignmentCompatWithObjectMembers2.ts, 6, 9)) ->foo : Symbol(foo, Decl(assignmentCompatWithObjectMembers2.ts, 8, 14)) ->bar : Symbol(bar, Decl(assignmentCompatWithObjectMembers2.ts, 8, 27)) +>foo : Symbol(S2.foo, Decl(assignmentCompatWithObjectMembers2.ts, 8, 14)) +>bar : Symbol(S2.bar, Decl(assignmentCompatWithObjectMembers2.ts, 8, 27)) interface T2 { foo: string; baz?: string } >T2 : Symbol(T2, Decl(assignmentCompatWithObjectMembers2.ts, 8, 42)) ->foo : Symbol(foo, Decl(assignmentCompatWithObjectMembers2.ts, 9, 14)) ->baz : Symbol(baz, Decl(assignmentCompatWithObjectMembers2.ts, 9, 27)) +>foo : Symbol(T2.foo, Decl(assignmentCompatWithObjectMembers2.ts, 9, 14)) +>baz : Symbol(T2.baz, Decl(assignmentCompatWithObjectMembers2.ts, 9, 27)) var s2: S2; >s2 : Symbol(s2, Decl(assignmentCompatWithObjectMembers2.ts, 10, 3)) diff --git a/tests/baselines/reference/assignmentCompatWithObjectMembers3.symbols b/tests/baselines/reference/assignmentCompatWithObjectMembers3.symbols index 861d38530bb..72151ce6048 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembers3.symbols +++ b/tests/baselines/reference/assignmentCompatWithObjectMembers3.symbols @@ -5,12 +5,12 @@ class S implements S2 { foo: string; } >S : Symbol(S, Decl(assignmentCompatWithObjectMembers3.ts, 0, 0)) >S2 : Symbol(S2, Decl(assignmentCompatWithObjectMembers3.ts, 6, 9)) ->foo : Symbol(foo, Decl(assignmentCompatWithObjectMembers3.ts, 3, 23)) +>foo : Symbol(S.foo, Decl(assignmentCompatWithObjectMembers3.ts, 3, 23)) class T implements T2 { foo: string; } >T : Symbol(T, Decl(assignmentCompatWithObjectMembers3.ts, 3, 38)) >T2 : Symbol(T2, Decl(assignmentCompatWithObjectMembers3.ts, 8, 42)) ->foo : Symbol(foo, Decl(assignmentCompatWithObjectMembers3.ts, 4, 23)) +>foo : Symbol(T.foo, Decl(assignmentCompatWithObjectMembers3.ts, 4, 23)) var s: S; >s : Symbol(s, Decl(assignmentCompatWithObjectMembers3.ts, 5, 3)) @@ -22,13 +22,13 @@ var t: T; interface S2 { foo: string; bar?: string } >S2 : Symbol(S2, Decl(assignmentCompatWithObjectMembers3.ts, 6, 9)) ->foo : Symbol(foo, Decl(assignmentCompatWithObjectMembers3.ts, 8, 14)) ->bar : Symbol(bar, Decl(assignmentCompatWithObjectMembers3.ts, 8, 27)) +>foo : Symbol(S2.foo, Decl(assignmentCompatWithObjectMembers3.ts, 8, 14)) +>bar : Symbol(S2.bar, Decl(assignmentCompatWithObjectMembers3.ts, 8, 27)) interface T2 { foo: string; baz?: string } >T2 : Symbol(T2, Decl(assignmentCompatWithObjectMembers3.ts, 8, 42)) ->foo : Symbol(foo, Decl(assignmentCompatWithObjectMembers3.ts, 9, 14)) ->baz : Symbol(baz, Decl(assignmentCompatWithObjectMembers3.ts, 9, 27)) +>foo : Symbol(T2.foo, Decl(assignmentCompatWithObjectMembers3.ts, 9, 14)) +>baz : Symbol(T2.baz, Decl(assignmentCompatWithObjectMembers3.ts, 9, 27)) var s2: S2; >s2 : Symbol(s2, Decl(assignmentCompatWithObjectMembers3.ts, 10, 3)) diff --git a/tests/baselines/reference/assignmentCompatWithObjectMembersNumericNames.symbols b/tests/baselines/reference/assignmentCompatWithObjectMembersNumericNames.symbols index e01bcee21c0..ce633683339 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembersNumericNames.symbols +++ b/tests/baselines/reference/assignmentCompatWithObjectMembersNumericNames.symbols @@ -18,11 +18,11 @@ var t: T; interface S2 { 1: string; bar?: string } >S2 : Symbol(S2, Decl(assignmentCompatWithObjectMembersNumericNames.ts, 6, 9)) ->bar : Symbol(bar, Decl(assignmentCompatWithObjectMembersNumericNames.ts, 8, 25)) +>bar : Symbol(S2.bar, Decl(assignmentCompatWithObjectMembersNumericNames.ts, 8, 25)) interface T2 { 1.0: string; baz?: string } >T2 : Symbol(T2, Decl(assignmentCompatWithObjectMembersNumericNames.ts, 8, 40)) ->baz : Symbol(baz, Decl(assignmentCompatWithObjectMembersNumericNames.ts, 9, 27)) +>baz : Symbol(T2.baz, Decl(assignmentCompatWithObjectMembersNumericNames.ts, 9, 27)) var s2: S2; >s2 : Symbol(s2, Decl(assignmentCompatWithObjectMembersNumericNames.ts, 10, 3)) diff --git a/tests/baselines/reference/assignmentCompatWithOverloads.errors.txt b/tests/baselines/reference/assignmentCompatWithOverloads.errors.txt index 3bea0c46716..3773229f516 100644 --- a/tests/baselines/reference/assignmentCompatWithOverloads.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithOverloads.errors.txt @@ -2,12 +2,12 @@ tests/cases/compiler/assignmentCompatWithOverloads.ts(17,1): error TS2322: Type Type 'string' is not assignable to type 'number'. tests/cases/compiler/assignmentCompatWithOverloads.ts(19,1): error TS2322: Type '(x: number) => number' is not assignable to type '(s1: string) => number'. Types of parameters 'x' and 's1' are incompatible. - Type 'number' is not assignable to type 'string'. + Type 'string' is not assignable to type 'number'. tests/cases/compiler/assignmentCompatWithOverloads.ts(21,1): error TS2322: Type '{ (x: string): string; (x: number): number; }' is not assignable to type '(s1: string) => number'. Type 'string' is not assignable to type 'number'. tests/cases/compiler/assignmentCompatWithOverloads.ts(30,1): error TS2322: Type 'typeof C' is not assignable to type 'new (x: number) => void'. Types of parameters 'x' and 'x' are incompatible. - Type 'string' is not assignable to type 'number'. + Type 'number' is not assignable to type 'string'. ==== tests/cases/compiler/assignmentCompatWithOverloads.ts (4 errors) ==== @@ -36,7 +36,7 @@ tests/cases/compiler/assignmentCompatWithOverloads.ts(30,1): error TS2322: Type ~ !!! error TS2322: Type '(x: number) => number' is not assignable to type '(s1: string) => number'. !!! error TS2322: Types of parameters 'x' and 's1' are incompatible. -!!! error TS2322: Type 'number' is not assignable to type 'string'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. g = f4; // Error ~ @@ -54,4 +54,4 @@ tests/cases/compiler/assignmentCompatWithOverloads.ts(30,1): error TS2322: Type ~ !!! error TS2322: Type 'typeof C' is not assignable to type 'new (x: number) => void'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'number'. \ No newline at end of file +!!! error TS2322: Type 'number' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatability1.symbols b/tests/baselines/reference/assignmentCompatability1.symbols index 07d3cf4c029..15da482c203 100644 --- a/tests/baselines/reference/assignmentCompatability1.symbols +++ b/tests/baselines/reference/assignmentCompatability1.symbols @@ -6,9 +6,9 @@ module __test1__ { >interfaceWithPublicAndOptional : Symbol(interfaceWithPublicAndOptional, Decl(assignmentCompatability1.ts, 0, 18)) >T : Symbol(T, Decl(assignmentCompatability1.ts, 1, 52)) >U : Symbol(U, Decl(assignmentCompatability1.ts, 1, 54)) ->one : Symbol(one, Decl(assignmentCompatability1.ts, 1, 58)) +>one : Symbol(interfaceWithPublicAndOptional.one, Decl(assignmentCompatability1.ts, 1, 58)) >T : Symbol(T, Decl(assignmentCompatability1.ts, 1, 52)) ->two : Symbol(two, Decl(assignmentCompatability1.ts, 1, 66)) +>two : Symbol(interfaceWithPublicAndOptional.two, Decl(assignmentCompatability1.ts, 1, 66)) >U : Symbol(U, Decl(assignmentCompatability1.ts, 1, 54)) >obj4 : Symbol(obj4, Decl(assignmentCompatability1.ts, 1, 83)) >interfaceWithPublicAndOptional : Symbol(interfaceWithPublicAndOptional, Decl(assignmentCompatability1.ts, 0, 18)) diff --git a/tests/baselines/reference/assignmentCompatability16.errors.txt b/tests/baselines/reference/assignmentCompatability16.errors.txt index 266d72b3232..71a93f11b35 100644 --- a/tests/baselines/reference/assignmentCompatability16.errors.txt +++ b/tests/baselines/reference/assignmentCompatability16.errors.txt @@ -1,7 +1,6 @@ tests/cases/compiler/assignmentCompatability16.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ one: any[]; }'. Types of property 'one' are incompatible. Type 'number' is not assignable to type 'any[]'. - Property 'length' is missing in type 'Number'. ==== tests/cases/compiler/assignmentCompatability16.ts (1 errors) ==== @@ -17,5 +16,4 @@ tests/cases/compiler/assignmentCompatability16.ts(9,1): error TS2322: Type 'inte ~~~~~~~~~~~~~~~~~~~~ !!! error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ one: any[]; }'. !!! error TS2322: Types of property 'one' are incompatible. -!!! error TS2322: Type 'number' is not assignable to type 'any[]'. -!!! error TS2322: Property 'length' is missing in type 'Number'. \ No newline at end of file +!!! error TS2322: Type 'number' is not assignable to type 'any[]'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatability17.errors.txt b/tests/baselines/reference/assignmentCompatability17.errors.txt index b37f39d082f..a87bcff2e92 100644 --- a/tests/baselines/reference/assignmentCompatability17.errors.txt +++ b/tests/baselines/reference/assignmentCompatability17.errors.txt @@ -1,7 +1,6 @@ tests/cases/compiler/assignmentCompatability17.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ two: any[]; }'. Types of property 'two' are incompatible. Type 'string' is not assignable to type 'any[]'. - Property 'push' is missing in type 'String'. ==== tests/cases/compiler/assignmentCompatability17.ts (1 errors) ==== @@ -17,5 +16,4 @@ tests/cases/compiler/assignmentCompatability17.ts(9,1): error TS2322: Type 'inte ~~~~~~~~~~~~~~~~~~~~ !!! error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ two: any[]; }'. !!! error TS2322: Types of property 'two' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'any[]'. -!!! error TS2322: Property 'push' is missing in type 'String'. \ No newline at end of file +!!! error TS2322: Type 'string' is not assignable to type 'any[]'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatability18.errors.txt b/tests/baselines/reference/assignmentCompatability18.errors.txt index 2be4a037575..8ab5e5dcd07 100644 --- a/tests/baselines/reference/assignmentCompatability18.errors.txt +++ b/tests/baselines/reference/assignmentCompatability18.errors.txt @@ -1,7 +1,6 @@ tests/cases/compiler/assignmentCompatability18.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ one: number[]; }'. Types of property 'one' are incompatible. Type 'number' is not assignable to type 'number[]'. - Property 'length' is missing in type 'Number'. ==== tests/cases/compiler/assignmentCompatability18.ts (1 errors) ==== @@ -17,5 +16,4 @@ tests/cases/compiler/assignmentCompatability18.ts(9,1): error TS2322: Type 'inte ~~~~~~~~~~~~~~~~~~~~ !!! error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ one: number[]; }'. !!! error TS2322: Types of property 'one' are incompatible. -!!! error TS2322: Type 'number' is not assignable to type 'number[]'. -!!! error TS2322: Property 'length' is missing in type 'Number'. \ No newline at end of file +!!! error TS2322: Type 'number' is not assignable to type 'number[]'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatability19.errors.txt b/tests/baselines/reference/assignmentCompatability19.errors.txt index ae97af6aa7e..e84e665cefa 100644 --- a/tests/baselines/reference/assignmentCompatability19.errors.txt +++ b/tests/baselines/reference/assignmentCompatability19.errors.txt @@ -1,7 +1,6 @@ tests/cases/compiler/assignmentCompatability19.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ two: number[]; }'. Types of property 'two' are incompatible. Type 'string' is not assignable to type 'number[]'. - Property 'push' is missing in type 'String'. ==== tests/cases/compiler/assignmentCompatability19.ts (1 errors) ==== @@ -17,5 +16,4 @@ tests/cases/compiler/assignmentCompatability19.ts(9,1): error TS2322: Type 'inte ~~~~~~~~~~~~~~~~~~~~ !!! error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ two: number[]; }'. !!! error TS2322: Types of property 'two' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'number[]'. -!!! error TS2322: Property 'push' is missing in type 'String'. \ No newline at end of file +!!! error TS2322: Type 'string' is not assignable to type 'number[]'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatability2.symbols b/tests/baselines/reference/assignmentCompatability2.symbols index 1ed6dd3c639..55ed25fb4ad 100644 --- a/tests/baselines/reference/assignmentCompatability2.symbols +++ b/tests/baselines/reference/assignmentCompatability2.symbols @@ -6,9 +6,9 @@ module __test1__ { >interfaceWithPublicAndOptional : Symbol(interfaceWithPublicAndOptional, Decl(assignmentCompatability2.ts, 0, 18)) >T : Symbol(T, Decl(assignmentCompatability2.ts, 1, 52)) >U : Symbol(U, Decl(assignmentCompatability2.ts, 1, 54)) ->one : Symbol(one, Decl(assignmentCompatability2.ts, 1, 58)) +>one : Symbol(interfaceWithPublicAndOptional.one, Decl(assignmentCompatability2.ts, 1, 58)) >T : Symbol(T, Decl(assignmentCompatability2.ts, 1, 52)) ->two : Symbol(two, Decl(assignmentCompatability2.ts, 1, 66)) +>two : Symbol(interfaceWithPublicAndOptional.two, Decl(assignmentCompatability2.ts, 1, 66)) >U : Symbol(U, Decl(assignmentCompatability2.ts, 1, 54)) >obj4 : Symbol(obj4, Decl(assignmentCompatability2.ts, 1, 83)) >interfaceWithPublicAndOptional : Symbol(interfaceWithPublicAndOptional, Decl(assignmentCompatability2.ts, 0, 18)) diff --git a/tests/baselines/reference/assignmentCompatability20.errors.txt b/tests/baselines/reference/assignmentCompatability20.errors.txt index 750310ac5cc..2e67a2a2033 100644 --- a/tests/baselines/reference/assignmentCompatability20.errors.txt +++ b/tests/baselines/reference/assignmentCompatability20.errors.txt @@ -1,7 +1,6 @@ tests/cases/compiler/assignmentCompatability20.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ one: string[]; }'. Types of property 'one' are incompatible. Type 'number' is not assignable to type 'string[]'. - Property 'length' is missing in type 'Number'. ==== tests/cases/compiler/assignmentCompatability20.ts (1 errors) ==== @@ -17,5 +16,4 @@ tests/cases/compiler/assignmentCompatability20.ts(9,1): error TS2322: Type 'inte ~~~~~~~~~~~~~~~~~~~~ !!! error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ one: string[]; }'. !!! error TS2322: Types of property 'one' are incompatible. -!!! error TS2322: Type 'number' is not assignable to type 'string[]'. -!!! error TS2322: Property 'length' is missing in type 'Number'. \ No newline at end of file +!!! error TS2322: Type 'number' is not assignable to type 'string[]'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatability21.errors.txt b/tests/baselines/reference/assignmentCompatability21.errors.txt index 8da52fe42c6..44e24e7d0b5 100644 --- a/tests/baselines/reference/assignmentCompatability21.errors.txt +++ b/tests/baselines/reference/assignmentCompatability21.errors.txt @@ -1,7 +1,6 @@ tests/cases/compiler/assignmentCompatability21.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ two: string[]; }'. Types of property 'two' are incompatible. Type 'string' is not assignable to type 'string[]'. - Property 'push' is missing in type 'String'. ==== tests/cases/compiler/assignmentCompatability21.ts (1 errors) ==== @@ -17,5 +16,4 @@ tests/cases/compiler/assignmentCompatability21.ts(9,1): error TS2322: Type 'inte ~~~~~~~~~~~~~~~~~~~~ !!! error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ two: string[]; }'. !!! error TS2322: Types of property 'two' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'string[]'. -!!! error TS2322: Property 'push' is missing in type 'String'. \ No newline at end of file +!!! error TS2322: Type 'string' is not assignable to type 'string[]'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatability22.errors.txt b/tests/baselines/reference/assignmentCompatability22.errors.txt index f0799a92f5c..cb42a7abaef 100644 --- a/tests/baselines/reference/assignmentCompatability22.errors.txt +++ b/tests/baselines/reference/assignmentCompatability22.errors.txt @@ -1,7 +1,6 @@ tests/cases/compiler/assignmentCompatability22.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ one: boolean[]; }'. Types of property 'one' are incompatible. Type 'number' is not assignable to type 'boolean[]'. - Property 'length' is missing in type 'Number'. ==== tests/cases/compiler/assignmentCompatability22.ts (1 errors) ==== @@ -17,5 +16,4 @@ tests/cases/compiler/assignmentCompatability22.ts(9,1): error TS2322: Type 'inte ~~~~~~~~~~~~~~~~~~~~ !!! error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ one: boolean[]; }'. !!! error TS2322: Types of property 'one' are incompatible. -!!! error TS2322: Type 'number' is not assignable to type 'boolean[]'. -!!! error TS2322: Property 'length' is missing in type 'Number'. \ No newline at end of file +!!! error TS2322: Type 'number' is not assignable to type 'boolean[]'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatability23.errors.txt b/tests/baselines/reference/assignmentCompatability23.errors.txt index a005eaa02d1..7b54e8559eb 100644 --- a/tests/baselines/reference/assignmentCompatability23.errors.txt +++ b/tests/baselines/reference/assignmentCompatability23.errors.txt @@ -1,7 +1,6 @@ tests/cases/compiler/assignmentCompatability23.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ two: boolean[]; }'. Types of property 'two' are incompatible. Type 'string' is not assignable to type 'boolean[]'. - Property 'push' is missing in type 'String'. ==== tests/cases/compiler/assignmentCompatability23.ts (1 errors) ==== @@ -17,5 +16,4 @@ tests/cases/compiler/assignmentCompatability23.ts(9,1): error TS2322: Type 'inte ~~~~~~~~~~~~~~~~~~~~ !!! error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ two: boolean[]; }'. !!! error TS2322: Types of property 'two' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'boolean[]'. -!!! error TS2322: Property 'push' is missing in type 'String'. \ No newline at end of file +!!! error TS2322: Type 'string' is not assignable to type 'boolean[]'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatability29.errors.txt b/tests/baselines/reference/assignmentCompatability29.errors.txt index 194ae4ab675..9ba5c35d528 100644 --- a/tests/baselines/reference/assignmentCompatability29.errors.txt +++ b/tests/baselines/reference/assignmentCompatability29.errors.txt @@ -1,7 +1,6 @@ tests/cases/compiler/assignmentCompatability29.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ one: any[]; }'. Types of property 'one' are incompatible. Type 'number' is not assignable to type 'any[]'. - Property 'length' is missing in type 'Number'. ==== tests/cases/compiler/assignmentCompatability29.ts (1 errors) ==== @@ -17,5 +16,4 @@ tests/cases/compiler/assignmentCompatability29.ts(9,1): error TS2322: Type 'inte ~~~~~~~~~~~~~~~~~~~ !!! error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ one: any[]; }'. !!! error TS2322: Types of property 'one' are incompatible. -!!! error TS2322: Type 'number' is not assignable to type 'any[]'. -!!! error TS2322: Property 'length' is missing in type 'Number'. \ No newline at end of file +!!! error TS2322: Type 'number' is not assignable to type 'any[]'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatability3.symbols b/tests/baselines/reference/assignmentCompatability3.symbols index c31d69e2f12..49fccff55f0 100644 --- a/tests/baselines/reference/assignmentCompatability3.symbols +++ b/tests/baselines/reference/assignmentCompatability3.symbols @@ -6,9 +6,9 @@ module __test1__ { >interfaceWithPublicAndOptional : Symbol(interfaceWithPublicAndOptional, Decl(assignmentCompatability3.ts, 0, 18)) >T : Symbol(T, Decl(assignmentCompatability3.ts, 1, 52)) >U : Symbol(U, Decl(assignmentCompatability3.ts, 1, 54)) ->one : Symbol(one, Decl(assignmentCompatability3.ts, 1, 58)) +>one : Symbol(interfaceWithPublicAndOptional.one, Decl(assignmentCompatability3.ts, 1, 58)) >T : Symbol(T, Decl(assignmentCompatability3.ts, 1, 52)) ->two : Symbol(two, Decl(assignmentCompatability3.ts, 1, 66)) +>two : Symbol(interfaceWithPublicAndOptional.two, Decl(assignmentCompatability3.ts, 1, 66)) >U : Symbol(U, Decl(assignmentCompatability3.ts, 1, 54)) >obj4 : Symbol(obj4, Decl(assignmentCompatability3.ts, 1, 83)) >interfaceWithPublicAndOptional : Symbol(interfaceWithPublicAndOptional, Decl(assignmentCompatability3.ts, 0, 18)) diff --git a/tests/baselines/reference/assignmentCompatability30.errors.txt b/tests/baselines/reference/assignmentCompatability30.errors.txt index b025705517c..43f7f3f9c0a 100644 --- a/tests/baselines/reference/assignmentCompatability30.errors.txt +++ b/tests/baselines/reference/assignmentCompatability30.errors.txt @@ -1,7 +1,6 @@ tests/cases/compiler/assignmentCompatability30.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ one: number[]; }'. Types of property 'one' are incompatible. Type 'number' is not assignable to type 'number[]'. - Property 'length' is missing in type 'Number'. ==== tests/cases/compiler/assignmentCompatability30.ts (1 errors) ==== @@ -17,5 +16,4 @@ tests/cases/compiler/assignmentCompatability30.ts(9,1): error TS2322: Type 'inte ~~~~~~~~~~~~~~~~~~~ !!! error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ one: number[]; }'. !!! error TS2322: Types of property 'one' are incompatible. -!!! error TS2322: Type 'number' is not assignable to type 'number[]'. -!!! error TS2322: Property 'length' is missing in type 'Number'. \ No newline at end of file +!!! error TS2322: Type 'number' is not assignable to type 'number[]'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatability31.errors.txt b/tests/baselines/reference/assignmentCompatability31.errors.txt index 8e19905eba7..8874ebf06a6 100644 --- a/tests/baselines/reference/assignmentCompatability31.errors.txt +++ b/tests/baselines/reference/assignmentCompatability31.errors.txt @@ -1,7 +1,6 @@ tests/cases/compiler/assignmentCompatability31.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ one: string[]; }'. Types of property 'one' are incompatible. Type 'number' is not assignable to type 'string[]'. - Property 'length' is missing in type 'Number'. ==== tests/cases/compiler/assignmentCompatability31.ts (1 errors) ==== @@ -17,5 +16,4 @@ tests/cases/compiler/assignmentCompatability31.ts(9,1): error TS2322: Type 'inte ~~~~~~~~~~~~~~~~~~~ !!! error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ one: string[]; }'. !!! error TS2322: Types of property 'one' are incompatible. -!!! error TS2322: Type 'number' is not assignable to type 'string[]'. -!!! error TS2322: Property 'length' is missing in type 'Number'. \ No newline at end of file +!!! error TS2322: Type 'number' is not assignable to type 'string[]'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatability32.errors.txt b/tests/baselines/reference/assignmentCompatability32.errors.txt index 6d6321f5e50..00164a48fd6 100644 --- a/tests/baselines/reference/assignmentCompatability32.errors.txt +++ b/tests/baselines/reference/assignmentCompatability32.errors.txt @@ -1,7 +1,6 @@ tests/cases/compiler/assignmentCompatability32.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ one: boolean[]; }'. Types of property 'one' are incompatible. Type 'number' is not assignable to type 'boolean[]'. - Property 'length' is missing in type 'Number'. ==== tests/cases/compiler/assignmentCompatability32.ts (1 errors) ==== @@ -17,5 +16,4 @@ tests/cases/compiler/assignmentCompatability32.ts(9,1): error TS2322: Type 'inte ~~~~~~~~~~~~~~~~~~~ !!! error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ one: boolean[]; }'. !!! error TS2322: Types of property 'one' are incompatible. -!!! error TS2322: Type 'number' is not assignable to type 'boolean[]'. -!!! error TS2322: Property 'length' is missing in type 'Number'. \ No newline at end of file +!!! error TS2322: Type 'number' is not assignable to type 'boolean[]'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatability36.symbols b/tests/baselines/reference/assignmentCompatability36.symbols index 4b4b7d75a51..09ebfb67ed8 100644 --- a/tests/baselines/reference/assignmentCompatability36.symbols +++ b/tests/baselines/reference/assignmentCompatability36.symbols @@ -6,9 +6,9 @@ module __test1__ { >interfaceWithPublicAndOptional : Symbol(interfaceWithPublicAndOptional, Decl(assignmentCompatability36.ts, 0, 18)) >T : Symbol(T, Decl(assignmentCompatability36.ts, 1, 52)) >U : Symbol(U, Decl(assignmentCompatability36.ts, 1, 54)) ->one : Symbol(one, Decl(assignmentCompatability36.ts, 1, 58)) +>one : Symbol(interfaceWithPublicAndOptional.one, Decl(assignmentCompatability36.ts, 1, 58)) >T : Symbol(T, Decl(assignmentCompatability36.ts, 1, 52)) ->two : Symbol(two, Decl(assignmentCompatability36.ts, 1, 66)) +>two : Symbol(interfaceWithPublicAndOptional.two, Decl(assignmentCompatability36.ts, 1, 66)) >U : Symbol(U, Decl(assignmentCompatability36.ts, 1, 54)) >obj4 : Symbol(obj4, Decl(assignmentCompatability36.ts, 1, 83)) >interfaceWithPublicAndOptional : Symbol(interfaceWithPublicAndOptional, Decl(assignmentCompatability36.ts, 0, 18)) diff --git a/tests/baselines/reference/assignmentCompatability4.symbols b/tests/baselines/reference/assignmentCompatability4.symbols index fe5e4a32dee..cac51957fc8 100644 --- a/tests/baselines/reference/assignmentCompatability4.symbols +++ b/tests/baselines/reference/assignmentCompatability4.symbols @@ -6,9 +6,9 @@ module __test1__ { >interfaceWithPublicAndOptional : Symbol(interfaceWithPublicAndOptional, Decl(assignmentCompatability4.ts, 0, 18)) >T : Symbol(T, Decl(assignmentCompatability4.ts, 1, 52)) >U : Symbol(U, Decl(assignmentCompatability4.ts, 1, 54)) ->one : Symbol(one, Decl(assignmentCompatability4.ts, 1, 58)) +>one : Symbol(interfaceWithPublicAndOptional.one, Decl(assignmentCompatability4.ts, 1, 58)) >T : Symbol(T, Decl(assignmentCompatability4.ts, 1, 52)) ->two : Symbol(two, Decl(assignmentCompatability4.ts, 1, 66)) +>two : Symbol(interfaceWithPublicAndOptional.two, Decl(assignmentCompatability4.ts, 1, 66)) >U : Symbol(U, Decl(assignmentCompatability4.ts, 1, 54)) >obj4 : Symbol(obj4, Decl(assignmentCompatability4.ts, 1, 83)) >interfaceWithPublicAndOptional : Symbol(interfaceWithPublicAndOptional, Decl(assignmentCompatability4.ts, 0, 18)) diff --git a/tests/baselines/reference/assignmentCompatability5.symbols b/tests/baselines/reference/assignmentCompatability5.symbols index 15885d07892..9cbfd0dbd8b 100644 --- a/tests/baselines/reference/assignmentCompatability5.symbols +++ b/tests/baselines/reference/assignmentCompatability5.symbols @@ -6,9 +6,9 @@ module __test1__ { >interfaceWithPublicAndOptional : Symbol(interfaceWithPublicAndOptional, Decl(assignmentCompatability5.ts, 0, 18)) >T : Symbol(T, Decl(assignmentCompatability5.ts, 1, 52)) >U : Symbol(U, Decl(assignmentCompatability5.ts, 1, 54)) ->one : Symbol(one, Decl(assignmentCompatability5.ts, 1, 58)) +>one : Symbol(interfaceWithPublicAndOptional.one, Decl(assignmentCompatability5.ts, 1, 58)) >T : Symbol(T, Decl(assignmentCompatability5.ts, 1, 52)) ->two : Symbol(two, Decl(assignmentCompatability5.ts, 1, 66)) +>two : Symbol(interfaceWithPublicAndOptional.two, Decl(assignmentCompatability5.ts, 1, 66)) >U : Symbol(U, Decl(assignmentCompatability5.ts, 1, 54)) >obj4 : Symbol(obj4, Decl(assignmentCompatability5.ts, 1, 83)) >interfaceWithPublicAndOptional : Symbol(interfaceWithPublicAndOptional, Decl(assignmentCompatability5.ts, 0, 18)) @@ -24,7 +24,7 @@ module __test2__ { export interface interfaceOne { one: T; }; var obj1: interfaceOne = { one: 1 };; >interfaceOne : Symbol(interfaceOne, Decl(assignmentCompatability5.ts, 4, 18)) >T : Symbol(T, Decl(assignmentCompatability5.ts, 5, 52)) ->one : Symbol(one, Decl(assignmentCompatability5.ts, 5, 56)) +>one : Symbol(interfaceOne.one, Decl(assignmentCompatability5.ts, 5, 56)) >T : Symbol(T, Decl(assignmentCompatability5.ts, 5, 52)) >obj1 : Symbol(obj1, Decl(assignmentCompatability5.ts, 5, 86)) >interfaceOne : Symbol(interfaceOne, Decl(assignmentCompatability5.ts, 4, 18)) diff --git a/tests/baselines/reference/assignmentCompatability6.symbols b/tests/baselines/reference/assignmentCompatability6.symbols index 4ddacd5cd8c..713ca092653 100644 --- a/tests/baselines/reference/assignmentCompatability6.symbols +++ b/tests/baselines/reference/assignmentCompatability6.symbols @@ -6,9 +6,9 @@ module __test1__ { >interfaceWithPublicAndOptional : Symbol(interfaceWithPublicAndOptional, Decl(assignmentCompatability6.ts, 0, 18)) >T : Symbol(T, Decl(assignmentCompatability6.ts, 1, 52)) >U : Symbol(U, Decl(assignmentCompatability6.ts, 1, 54)) ->one : Symbol(one, Decl(assignmentCompatability6.ts, 1, 58)) +>one : Symbol(interfaceWithPublicAndOptional.one, Decl(assignmentCompatability6.ts, 1, 58)) >T : Symbol(T, Decl(assignmentCompatability6.ts, 1, 52)) ->two : Symbol(two, Decl(assignmentCompatability6.ts, 1, 66)) +>two : Symbol(interfaceWithPublicAndOptional.two, Decl(assignmentCompatability6.ts, 1, 66)) >U : Symbol(U, Decl(assignmentCompatability6.ts, 1, 54)) >obj4 : Symbol(obj4, Decl(assignmentCompatability6.ts, 1, 83)) >interfaceWithPublicAndOptional : Symbol(interfaceWithPublicAndOptional, Decl(assignmentCompatability6.ts, 0, 18)) @@ -24,7 +24,7 @@ module __test2__ { export interface interfaceWithOptional { one?: T; }; var obj3: interfaceWithOptional = { };; >interfaceWithOptional : Symbol(interfaceWithOptional, Decl(assignmentCompatability6.ts, 4, 18)) >T : Symbol(T, Decl(assignmentCompatability6.ts, 5, 52)) ->one : Symbol(one, Decl(assignmentCompatability6.ts, 5, 56)) +>one : Symbol(interfaceWithOptional.one, Decl(assignmentCompatability6.ts, 5, 56)) >T : Symbol(T, Decl(assignmentCompatability6.ts, 5, 52)) >obj3 : Symbol(obj3, Decl(assignmentCompatability6.ts, 5, 86)) >interfaceWithOptional : Symbol(interfaceWithOptional, Decl(assignmentCompatability6.ts, 4, 18)) diff --git a/tests/baselines/reference/assignmentCompatability7.symbols b/tests/baselines/reference/assignmentCompatability7.symbols index 32a5be9f87f..ae66ee04584 100644 --- a/tests/baselines/reference/assignmentCompatability7.symbols +++ b/tests/baselines/reference/assignmentCompatability7.symbols @@ -6,9 +6,9 @@ module __test1__ { >interfaceWithPublicAndOptional : Symbol(interfaceWithPublicAndOptional, Decl(assignmentCompatability7.ts, 0, 18)) >T : Symbol(T, Decl(assignmentCompatability7.ts, 1, 52)) >U : Symbol(U, Decl(assignmentCompatability7.ts, 1, 54)) ->one : Symbol(one, Decl(assignmentCompatability7.ts, 1, 58)) +>one : Symbol(interfaceWithPublicAndOptional.one, Decl(assignmentCompatability7.ts, 1, 58)) >T : Symbol(T, Decl(assignmentCompatability7.ts, 1, 52)) ->two : Symbol(two, Decl(assignmentCompatability7.ts, 1, 66)) +>two : Symbol(interfaceWithPublicAndOptional.two, Decl(assignmentCompatability7.ts, 1, 66)) >U : Symbol(U, Decl(assignmentCompatability7.ts, 1, 54)) >obj4 : Symbol(obj4, Decl(assignmentCompatability7.ts, 1, 83)) >interfaceWithPublicAndOptional : Symbol(interfaceWithPublicAndOptional, Decl(assignmentCompatability7.ts, 0, 18)) @@ -25,9 +25,9 @@ module __test2__ { >interfaceWithPublicAndOptional : Symbol(interfaceWithPublicAndOptional, Decl(assignmentCompatability7.ts, 4, 18)) >T : Symbol(T, Decl(assignmentCompatability7.ts, 5, 52)) >U : Symbol(U, Decl(assignmentCompatability7.ts, 5, 54)) ->one : Symbol(one, Decl(assignmentCompatability7.ts, 5, 58)) +>one : Symbol(interfaceWithPublicAndOptional.one, Decl(assignmentCompatability7.ts, 5, 58)) >T : Symbol(T, Decl(assignmentCompatability7.ts, 5, 52)) ->two : Symbol(two, Decl(assignmentCompatability7.ts, 5, 66)) +>two : Symbol(interfaceWithPublicAndOptional.two, Decl(assignmentCompatability7.ts, 5, 66)) >U : Symbol(U, Decl(assignmentCompatability7.ts, 5, 54)) >obj4 : Symbol(obj4, Decl(assignmentCompatability7.ts, 5, 83)) >interfaceWithPublicAndOptional : Symbol(interfaceWithPublicAndOptional, Decl(assignmentCompatability7.ts, 4, 18)) diff --git a/tests/baselines/reference/assignmentCompatability8.symbols b/tests/baselines/reference/assignmentCompatability8.symbols index ba30e4fee94..78b74f4ba62 100644 --- a/tests/baselines/reference/assignmentCompatability8.symbols +++ b/tests/baselines/reference/assignmentCompatability8.symbols @@ -6,9 +6,9 @@ module __test1__ { >interfaceWithPublicAndOptional : Symbol(interfaceWithPublicAndOptional, Decl(assignmentCompatability8.ts, 0, 18)) >T : Symbol(T, Decl(assignmentCompatability8.ts, 1, 52)) >U : Symbol(U, Decl(assignmentCompatability8.ts, 1, 54)) ->one : Symbol(one, Decl(assignmentCompatability8.ts, 1, 58)) +>one : Symbol(interfaceWithPublicAndOptional.one, Decl(assignmentCompatability8.ts, 1, 58)) >T : Symbol(T, Decl(assignmentCompatability8.ts, 1, 52)) ->two : Symbol(two, Decl(assignmentCompatability8.ts, 1, 66)) +>two : Symbol(interfaceWithPublicAndOptional.two, Decl(assignmentCompatability8.ts, 1, 66)) >U : Symbol(U, Decl(assignmentCompatability8.ts, 1, 54)) >obj4 : Symbol(obj4, Decl(assignmentCompatability8.ts, 1, 83)) >interfaceWithPublicAndOptional : Symbol(interfaceWithPublicAndOptional, Decl(assignmentCompatability8.ts, 0, 18)) @@ -24,7 +24,7 @@ module __test2__ { export class classWithPublic { constructor(public one: T) {} } var x1 = new classWithPublic(1);; >classWithPublic : Symbol(classWithPublic, Decl(assignmentCompatability8.ts, 4, 18)) >T : Symbol(T, Decl(assignmentCompatability8.ts, 5, 44)) ->one : Symbol(one, Decl(assignmentCompatability8.ts, 5, 61)) +>one : Symbol(classWithPublic.one, Decl(assignmentCompatability8.ts, 5, 61)) >T : Symbol(T, Decl(assignmentCompatability8.ts, 5, 44)) >x1 : Symbol(x1, Decl(assignmentCompatability8.ts, 5, 107)) >classWithPublic : Symbol(classWithPublic, Decl(assignmentCompatability8.ts, 4, 18)) diff --git a/tests/baselines/reference/assignmentCompatability9.symbols b/tests/baselines/reference/assignmentCompatability9.symbols index 7c49da7fea2..3799e8beed0 100644 --- a/tests/baselines/reference/assignmentCompatability9.symbols +++ b/tests/baselines/reference/assignmentCompatability9.symbols @@ -6,9 +6,9 @@ module __test1__ { >interfaceWithPublicAndOptional : Symbol(interfaceWithPublicAndOptional, Decl(assignmentCompatability9.ts, 0, 18)) >T : Symbol(T, Decl(assignmentCompatability9.ts, 1, 52)) >U : Symbol(U, Decl(assignmentCompatability9.ts, 1, 54)) ->one : Symbol(one, Decl(assignmentCompatability9.ts, 1, 58)) +>one : Symbol(interfaceWithPublicAndOptional.one, Decl(assignmentCompatability9.ts, 1, 58)) >T : Symbol(T, Decl(assignmentCompatability9.ts, 1, 52)) ->two : Symbol(two, Decl(assignmentCompatability9.ts, 1, 66)) +>two : Symbol(interfaceWithPublicAndOptional.two, Decl(assignmentCompatability9.ts, 1, 66)) >U : Symbol(U, Decl(assignmentCompatability9.ts, 1, 54)) >obj4 : Symbol(obj4, Decl(assignmentCompatability9.ts, 1, 83)) >interfaceWithPublicAndOptional : Symbol(interfaceWithPublicAndOptional, Decl(assignmentCompatability9.ts, 0, 18)) @@ -24,7 +24,7 @@ module __test2__ { export class classWithOptional { constructor(public one?: T) {} } var x3 = new classWithOptional();; >classWithOptional : Symbol(classWithOptional, Decl(assignmentCompatability9.ts, 4, 18)) >T : Symbol(T, Decl(assignmentCompatability9.ts, 5, 44)) ->one : Symbol(one, Decl(assignmentCompatability9.ts, 5, 61)) +>one : Symbol(classWithOptional.one, Decl(assignmentCompatability9.ts, 5, 61)) >T : Symbol(T, Decl(assignmentCompatability9.ts, 5, 44)) >x3 : Symbol(x3, Decl(assignmentCompatability9.ts, 5, 107)) >classWithOptional : Symbol(classWithOptional, Decl(assignmentCompatability9.ts, 4, 18)) diff --git a/tests/baselines/reference/assignmentCompatability_checking-apply-member-off-of-function-interface.errors.txt b/tests/baselines/reference/assignmentCompatability_checking-apply-member-off-of-function-interface.errors.txt index e5db4f9ab96..33a2269f747 100644 --- a/tests/baselines/reference/assignmentCompatability_checking-apply-member-off-of-function-interface.errors.txt +++ b/tests/baselines/reference/assignmentCompatability_checking-apply-member-off-of-function-interface.errors.txt @@ -1,9 +1,7 @@ tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-function-interface.ts(10,1): error TS2322: Type 'string' is not assignable to type 'Applicable'. - Property 'apply' is missing in type 'String'. tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-function-interface.ts(11,1): error TS2322: Type 'string[]' is not assignable to type 'Applicable'. Property 'apply' is missing in type 'string[]'. tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-function-interface.ts(12,1): error TS2322: Type 'number' is not assignable to type 'Applicable'. - Property 'apply' is missing in type 'Number'. tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-function-interface.ts(13,1): error TS2322: Type '{}' is not assignable to type 'Applicable'. Property 'apply' is missing in type '{}'. tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-function-interface.ts(22,4): error TS2345: Argument of type 'string' is not assignable to parameter of type 'Applicable'. @@ -26,7 +24,6 @@ tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-functi x = ''; ~ !!! error TS2322: Type 'string' is not assignable to type 'Applicable'. -!!! error TS2322: Property 'apply' is missing in type 'String'. x = ['']; ~ !!! error TS2322: Type 'string[]' is not assignable to type 'Applicable'. @@ -34,7 +31,6 @@ tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-functi x = 4; ~ !!! error TS2322: Type 'number' is not assignable to type 'Applicable'. -!!! error TS2322: Property 'apply' is missing in type 'Number'. x = {}; ~ !!! error TS2322: Type '{}' is not assignable to type 'Applicable'. diff --git a/tests/baselines/reference/assignmentCompatability_checking-call-member-off-of-function-interface.errors.txt b/tests/baselines/reference/assignmentCompatability_checking-call-member-off-of-function-interface.errors.txt index f3ff6f1b792..1651e5082ee 100644 --- a/tests/baselines/reference/assignmentCompatability_checking-call-member-off-of-function-interface.errors.txt +++ b/tests/baselines/reference/assignmentCompatability_checking-call-member-off-of-function-interface.errors.txt @@ -1,9 +1,7 @@ tests/cases/compiler/assignmentCompatability_checking-call-member-off-of-function-interface.ts(10,1): error TS2322: Type 'string' is not assignable to type 'Callable'. - Property 'call' is missing in type 'String'. tests/cases/compiler/assignmentCompatability_checking-call-member-off-of-function-interface.ts(11,1): error TS2322: Type 'string[]' is not assignable to type 'Callable'. Property 'call' is missing in type 'string[]'. tests/cases/compiler/assignmentCompatability_checking-call-member-off-of-function-interface.ts(12,1): error TS2322: Type 'number' is not assignable to type 'Callable'. - Property 'call' is missing in type 'Number'. tests/cases/compiler/assignmentCompatability_checking-call-member-off-of-function-interface.ts(13,1): error TS2322: Type '{}' is not assignable to type 'Callable'. Property 'call' is missing in type '{}'. tests/cases/compiler/assignmentCompatability_checking-call-member-off-of-function-interface.ts(22,4): error TS2345: Argument of type 'string' is not assignable to parameter of type 'Callable'. @@ -26,7 +24,6 @@ tests/cases/compiler/assignmentCompatability_checking-call-member-off-of-functio x = ''; ~ !!! error TS2322: Type 'string' is not assignable to type 'Callable'. -!!! error TS2322: Property 'call' is missing in type 'String'. x = ['']; ~ !!! error TS2322: Type 'string[]' is not assignable to type 'Callable'. @@ -34,7 +31,6 @@ tests/cases/compiler/assignmentCompatability_checking-call-member-off-of-functio x = 4; ~ !!! error TS2322: Type 'number' is not assignable to type 'Callable'. -!!! error TS2322: Property 'call' is missing in type 'Number'. x = {}; ~ !!! error TS2322: Type '{}' is not assignable to type 'Callable'. diff --git a/tests/baselines/reference/assignmentNonObjectTypeConstraints.symbols b/tests/baselines/reference/assignmentNonObjectTypeConstraints.symbols index d8bff5df5f2..52596124e42 100644 --- a/tests/baselines/reference/assignmentNonObjectTypeConstraints.symbols +++ b/tests/baselines/reference/assignmentNonObjectTypeConstraints.symbols @@ -27,11 +27,11 @@ foo(E.A); class A { a } >A : Symbol(A, Decl(assignmentNonObjectTypeConstraints.ts, 7, 9)) ->a : Symbol(a, Decl(assignmentNonObjectTypeConstraints.ts, 9, 9)) +>a : Symbol(A.a, Decl(assignmentNonObjectTypeConstraints.ts, 9, 9)) class B { b } >B : Symbol(B, Decl(assignmentNonObjectTypeConstraints.ts, 9, 13)) ->b : Symbol(b, Decl(assignmentNonObjectTypeConstraints.ts, 10, 9)) +>b : Symbol(B.b, Decl(assignmentNonObjectTypeConstraints.ts, 10, 9)) function bar(x: T) { >bar : Symbol(bar, Decl(assignmentNonObjectTypeConstraints.ts, 10, 13)) diff --git a/tests/baselines/reference/assignmentToObjectAndFunction.errors.txt b/tests/baselines/reference/assignmentToObjectAndFunction.errors.txt index 2e85ee101f5..204135cd004 100644 --- a/tests/baselines/reference/assignmentToObjectAndFunction.errors.txt +++ b/tests/baselines/reference/assignmentToObjectAndFunction.errors.txt @@ -5,7 +5,7 @@ tests/cases/compiler/assignmentToObjectAndFunction.ts(8,5): error TS2322: Type ' Property 'apply' is missing in type '{}'. tests/cases/compiler/assignmentToObjectAndFunction.ts(29,5): error TS2322: Type 'typeof bad' is not assignable to type 'Function'. Types of property 'apply' are incompatible. - Type 'number' is not assignable to type '(thisArg: any, argArray?: any) => any'. + Type 'number' is not assignable to type '(this: Function, thisArg: any, argArray?: any) => any'. ==== tests/cases/compiler/assignmentToObjectAndFunction.ts (3 errors) ==== @@ -48,4 +48,4 @@ tests/cases/compiler/assignmentToObjectAndFunction.ts(29,5): error TS2322: Type ~~~~~~~~~~ !!! error TS2322: Type 'typeof bad' is not assignable to type 'Function'. !!! error TS2322: Types of property 'apply' are incompatible. -!!! error TS2322: Type 'number' is not assignable to type '(thisArg: any, argArray?: any) => any'. \ No newline at end of file +!!! error TS2322: Type 'number' is not assignable to type '(this: Function, thisArg: any, argArray?: any) => any'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentTypeNarrowing.js b/tests/baselines/reference/assignmentTypeNarrowing.js new file mode 100644 index 00000000000..7c10dde65cc --- /dev/null +++ b/tests/baselines/reference/assignmentTypeNarrowing.js @@ -0,0 +1,53 @@ +//// [assignmentTypeNarrowing.ts] +let x: string | number | boolean | RegExp; + +x = ""; +x; // string + +[x] = [true]; +x; // boolean + +[x = ""] = [1]; +x; // string | number + +({x} = {x: true}); +x; // boolean + +({y: x} = {y: 1}); +x; // number + +({x = ""} = {x: true}); +x; // string | boolean + +({y: x = /a/} = {y: 1}); +x; // number | RegExp + +let a: string[]; + +for (x of a) { + x; // string +} + + +//// [assignmentTypeNarrowing.js] +var x; +x = ""; +x; // string +x = [true][0]; +x; // boolean +_a = [1][0], x = _a === void 0 ? "" : _a; +x; // string | number +(_b = { x: true }, x = _b.x, _b); +x; // boolean +(_c = { y: 1 }, x = _c.y, _c); +x; // number +(_d = { x: true }, _e = _d.x, x = _e === void 0 ? "" : _e, _d); +x; // string | boolean +(_f = { y: 1 }, _g = _f.y, x = _g === void 0 ? /a/ : _g, _f); +x; // number | RegExp +var a; +for (var _i = 0, a_1 = a; _i < a_1.length; _i++) { + x = a_1[_i]; + x; // string +} +var _a, _b, _c, _d, _e, _f, _g; diff --git a/tests/baselines/reference/assignmentTypeNarrowing.symbols b/tests/baselines/reference/assignmentTypeNarrowing.symbols new file mode 100644 index 00000000000..7d638d6a76b --- /dev/null +++ b/tests/baselines/reference/assignmentTypeNarrowing.symbols @@ -0,0 +1,64 @@ +=== tests/cases/conformance/expressions/assignmentOperator/assignmentTypeNarrowing.ts === +let x: string | number | boolean | RegExp; +>x : Symbol(x, Decl(assignmentTypeNarrowing.ts, 0, 3)) +>RegExp : Symbol(RegExp, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) + +x = ""; +>x : Symbol(x, Decl(assignmentTypeNarrowing.ts, 0, 3)) + +x; // string +>x : Symbol(x, Decl(assignmentTypeNarrowing.ts, 0, 3)) + +[x] = [true]; +>x : Symbol(x, Decl(assignmentTypeNarrowing.ts, 0, 3)) + +x; // boolean +>x : Symbol(x, Decl(assignmentTypeNarrowing.ts, 0, 3)) + +[x = ""] = [1]; +>x : Symbol(x, Decl(assignmentTypeNarrowing.ts, 0, 3)) + +x; // string | number +>x : Symbol(x, Decl(assignmentTypeNarrowing.ts, 0, 3)) + +({x} = {x: true}); +>x : Symbol(x, Decl(assignmentTypeNarrowing.ts, 11, 2)) +>x : Symbol(x, Decl(assignmentTypeNarrowing.ts, 11, 8)) + +x; // boolean +>x : Symbol(x, Decl(assignmentTypeNarrowing.ts, 0, 3)) + +({y: x} = {y: 1}); +>y : Symbol(y, Decl(assignmentTypeNarrowing.ts, 14, 2)) +>x : Symbol(x, Decl(assignmentTypeNarrowing.ts, 0, 3)) +>y : Symbol(y, Decl(assignmentTypeNarrowing.ts, 14, 11)) + +x; // number +>x : Symbol(x, Decl(assignmentTypeNarrowing.ts, 0, 3)) + +({x = ""} = {x: true}); +>x : Symbol(x, Decl(assignmentTypeNarrowing.ts, 17, 2)) +>x : Symbol(x, Decl(assignmentTypeNarrowing.ts, 17, 13)) + +x; // string | boolean +>x : Symbol(x, Decl(assignmentTypeNarrowing.ts, 0, 3)) + +({y: x = /a/} = {y: 1}); +>y : Symbol(y, Decl(assignmentTypeNarrowing.ts, 20, 2)) +>x : Symbol(x, Decl(assignmentTypeNarrowing.ts, 0, 3)) +>y : Symbol(y, Decl(assignmentTypeNarrowing.ts, 20, 17)) + +x; // number | RegExp +>x : Symbol(x, Decl(assignmentTypeNarrowing.ts, 0, 3)) + +let a: string[]; +>a : Symbol(a, Decl(assignmentTypeNarrowing.ts, 23, 3)) + +for (x of a) { +>x : Symbol(x, Decl(assignmentTypeNarrowing.ts, 0, 3)) +>a : Symbol(a, Decl(assignmentTypeNarrowing.ts, 23, 3)) + + x; // string +>x : Symbol(x, Decl(assignmentTypeNarrowing.ts, 0, 3)) +} + diff --git a/tests/baselines/reference/assignmentTypeNarrowing.types b/tests/baselines/reference/assignmentTypeNarrowing.types new file mode 100644 index 00000000000..be99a31501d --- /dev/null +++ b/tests/baselines/reference/assignmentTypeNarrowing.types @@ -0,0 +1,98 @@ +=== tests/cases/conformance/expressions/assignmentOperator/assignmentTypeNarrowing.ts === +let x: string | number | boolean | RegExp; +>x : string | number | boolean | RegExp +>RegExp : RegExp + +x = ""; +>x = "" : string +>x : string | number | boolean | RegExp +>"" : string + +x; // string +>x : string + +[x] = [true]; +>[x] = [true] : [boolean] +>[x] : [string | number | boolean | RegExp] +>x : string | number | boolean | RegExp +>[true] : [boolean] +>true : boolean + +x; // boolean +>x : boolean + +[x = ""] = [1]; +>[x = ""] = [1] : [number] +>[x = ""] : [string] +>x = "" : string +>x : string | number | boolean | RegExp +>"" : string +>[1] : [number] +>1 : number + +x; // string | number +>x : string | number + +({x} = {x: true}); +>({x} = {x: true}) : { x: boolean; } +>{x} = {x: true} : { x: boolean; } +>{x} : { x: string | number | boolean | RegExp; } +>x : string | number | boolean | RegExp +>{x: true} : { x: boolean; } +>x : boolean +>true : boolean + +x; // boolean +>x : boolean + +({y: x} = {y: 1}); +>({y: x} = {y: 1}) : { y: number; } +>{y: x} = {y: 1} : { y: number; } +>{y: x} : { y: string | number | boolean | RegExp; } +>y : string | number | boolean | RegExp +>x : string | number | boolean | RegExp +>{y: 1} : { y: number; } +>y : number +>1 : number + +x; // number +>x : number + +({x = ""} = {x: true}); +>({x = ""} = {x: true}) : { x?: boolean; } +>{x = ""} = {x: true} : { x?: boolean; } +>{x = ""} : { x?: string | number | boolean | RegExp; } +>x : string | number | boolean | RegExp +>{x: true} : { x?: boolean; } +>x : boolean +>true : boolean + +x; // string | boolean +>x : string | boolean + +({y: x = /a/} = {y: 1}); +>({y: x = /a/} = {y: 1}) : { y?: number; } +>{y: x = /a/} = {y: 1} : { y?: number; } +>{y: x = /a/} : { y?: RegExp; } +>y : RegExp +>x = /a/ : RegExp +>x : string | number | boolean | RegExp +>/a/ : RegExp +>{y: 1} : { y?: number; } +>y : number +>1 : number + +x; // number | RegExp +>x : number | RegExp + +let a: string[]; +>a : string[] + +for (x of a) { +>x : string | number | boolean | RegExp +>a : string[] + + x; // string +>x : string +} + diff --git a/tests/baselines/reference/assignments.errors.txt b/tests/baselines/reference/assignments.errors.txt index 9f89863f31f..05bc4ce1794 100644 --- a/tests/baselines/reference/assignments.errors.txt +++ b/tests/baselines/reference/assignments.errors.txt @@ -1,7 +1,7 @@ tests/cases/conformance/expressions/valuesAndReferences/assignments.ts(11,1): error TS2304: Cannot find name 'M'. tests/cases/conformance/expressions/valuesAndReferences/assignments.ts(14,1): error TS2364: Invalid left-hand side of assignment expression. tests/cases/conformance/expressions/valuesAndReferences/assignments.ts(17,1): error TS2364: Invalid left-hand side of assignment expression. -tests/cases/conformance/expressions/valuesAndReferences/assignments.ts(18,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/valuesAndReferences/assignments.ts(18,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. tests/cases/conformance/expressions/valuesAndReferences/assignments.ts(21,1): error TS2364: Invalid left-hand side of assignment expression. tests/cases/conformance/expressions/valuesAndReferences/assignments.ts(31,1): error TS2304: Cannot find name 'I'. @@ -32,7 +32,7 @@ tests/cases/conformance/expressions/valuesAndReferences/assignments.ts(31,1): er !!! error TS2364: Invalid left-hand side of assignment expression. E.A = null; // OK per spec, Error per implementation (509581) ~~~ -!!! error TS2364: Invalid left-hand side of assignment expression. +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. function fn() { } fn = null; // Should be error diff --git a/tests/baselines/reference/asyncAliasReturnType_es6.errors.txt b/tests/baselines/reference/asyncAliasReturnType_es6.errors.txt deleted file mode 100644 index ec532d1380d..00000000000 --- a/tests/baselines/reference/asyncAliasReturnType_es6.errors.txt +++ /dev/null @@ -1,10 +0,0 @@ -tests/cases/conformance/async/es6/asyncAliasReturnType_es6.ts(3,16): error TS1055: Type 'PromiseAlias' is not a valid async function return type. - - -==== tests/cases/conformance/async/es6/asyncAliasReturnType_es6.ts (1 errors) ==== - type PromiseAlias = Promise; - - async function f(): PromiseAlias { - ~ -!!! error TS1055: Type 'PromiseAlias' is not a valid async function return type. - } \ No newline at end of file diff --git a/tests/baselines/reference/asyncAliasReturnType_es6.js b/tests/baselines/reference/asyncAliasReturnType_es6.js index 0af63b0bfa6..45fe3228f6e 100644 --- a/tests/baselines/reference/asyncAliasReturnType_es6.js +++ b/tests/baselines/reference/asyncAliasReturnType_es6.js @@ -6,6 +6,6 @@ async function f(): PromiseAlias { //// [asyncAliasReturnType_es6.js] function f() { - return __awaiter(this, void 0, PromiseAlias, function* () { + return __awaiter(this, void 0, void 0, function* () { }); } diff --git a/tests/baselines/reference/asyncAliasReturnType_es6.symbols b/tests/baselines/reference/asyncAliasReturnType_es6.symbols new file mode 100644 index 00000000000..61de47e4092 --- /dev/null +++ b/tests/baselines/reference/asyncAliasReturnType_es6.symbols @@ -0,0 +1,11 @@ +=== tests/cases/conformance/async/es6/asyncAliasReturnType_es6.ts === +type PromiseAlias = Promise; +>PromiseAlias : Symbol(PromiseAlias, Decl(asyncAliasReturnType_es6.ts, 0, 0)) +>T : Symbol(T, Decl(asyncAliasReturnType_es6.ts, 0, 18)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>T : Symbol(T, Decl(asyncAliasReturnType_es6.ts, 0, 18)) + +async function f(): PromiseAlias { +>f : Symbol(f, Decl(asyncAliasReturnType_es6.ts, 0, 34)) +>PromiseAlias : Symbol(PromiseAlias, Decl(asyncAliasReturnType_es6.ts, 0, 0)) +} diff --git a/tests/baselines/reference/asyncAliasReturnType_es6.types b/tests/baselines/reference/asyncAliasReturnType_es6.types new file mode 100644 index 00000000000..8426d2a3542 --- /dev/null +++ b/tests/baselines/reference/asyncAliasReturnType_es6.types @@ -0,0 +1,11 @@ +=== tests/cases/conformance/async/es6/asyncAliasReturnType_es6.ts === +type PromiseAlias = Promise; +>PromiseAlias : Promise +>T : T +>Promise : Promise +>T : T + +async function f(): PromiseAlias { +>f : () => Promise +>PromiseAlias : Promise +} diff --git a/tests/baselines/reference/asyncArrowFunction1_es6.js b/tests/baselines/reference/asyncArrowFunction1_es6.js index 4f03acc5ced..0026cd91a7e 100644 --- a/tests/baselines/reference/asyncArrowFunction1_es6.js +++ b/tests/baselines/reference/asyncArrowFunction1_es6.js @@ -4,5 +4,5 @@ var foo = async (): Promise => { }; //// [asyncArrowFunction1_es6.js] -var foo = () => __awaiter(this, void 0, Promise, function* () { +var foo = () => __awaiter(this, void 0, void 0, function* () { }); diff --git a/tests/baselines/reference/asyncArrowFunction1_es6.symbols b/tests/baselines/reference/asyncArrowFunction1_es6.symbols index a8a5aef325a..a2f62f82990 100644 --- a/tests/baselines/reference/asyncArrowFunction1_es6.symbols +++ b/tests/baselines/reference/asyncArrowFunction1_es6.symbols @@ -2,6 +2,6 @@ var foo = async (): Promise => { >foo : Symbol(foo, Decl(asyncArrowFunction1_es6.ts, 1, 3)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) }; diff --git a/tests/baselines/reference/asyncArrowFunction6_es6.js b/tests/baselines/reference/asyncArrowFunction6_es6.js index 54b8aa1f6b1..a01e53f5b11 100644 --- a/tests/baselines/reference/asyncArrowFunction6_es6.js +++ b/tests/baselines/reference/asyncArrowFunction6_es6.js @@ -4,5 +4,5 @@ var foo = async (a = await): Promise => { } //// [asyncArrowFunction6_es6.js] -var foo = (a = yield ) => __awaiter(this, void 0, Promise, function* () { +var foo = (a = yield ) => __awaiter(this, void 0, void 0, function* () { }); diff --git a/tests/baselines/reference/asyncArrowFunction7_es6.js b/tests/baselines/reference/asyncArrowFunction7_es6.js index ac68a8fd2f8..fab705c0b76 100644 --- a/tests/baselines/reference/asyncArrowFunction7_es6.js +++ b/tests/baselines/reference/asyncArrowFunction7_es6.js @@ -7,8 +7,8 @@ var bar = async (): Promise => { } //// [asyncArrowFunction7_es6.js] -var bar = () => __awaiter(this, void 0, Promise, function* () { +var bar = () => __awaiter(this, void 0, void 0, function* () { // 'await' here is an identifier, and not an await expression. - var foo = (a = yield ) => __awaiter(this, void 0, Promise, function* () { + var foo = (a = yield ) => __awaiter(this, void 0, void 0, function* () { }); }); diff --git a/tests/baselines/reference/asyncArrowFunction8_es6.js b/tests/baselines/reference/asyncArrowFunction8_es6.js index 9cee5ee1525..0c33cfcfa2d 100644 --- a/tests/baselines/reference/asyncArrowFunction8_es6.js +++ b/tests/baselines/reference/asyncArrowFunction8_es6.js @@ -5,6 +5,6 @@ var foo = async (): Promise => { } //// [asyncArrowFunction8_es6.js] -var foo = () => __awaiter(this, void 0, Promise, function* () { +var foo = () => __awaiter(this, void 0, void 0, function* () { var v = { [yield ]: foo }; }); diff --git a/tests/baselines/reference/asyncArrowFunctionCapturesArguments_es6.js b/tests/baselines/reference/asyncArrowFunctionCapturesArguments_es6.js index c24259cf0b5..ca79eed6c8e 100644 --- a/tests/baselines/reference/asyncArrowFunctionCapturesArguments_es6.js +++ b/tests/baselines/reference/asyncArrowFunctionCapturesArguments_es6.js @@ -11,6 +11,6 @@ class C { class C { method() { function other() { } - var fn = () => __awaiter(this, arguments, Promise, function* (_arguments) { return yield other.apply(this, _arguments); }); + var fn = () => __awaiter(this, arguments, void 0, function* () { return yield other.apply(this, arguments); }); } } diff --git a/tests/baselines/reference/asyncArrowFunctionCapturesArguments_es6.symbols b/tests/baselines/reference/asyncArrowFunctionCapturesArguments_es6.symbols index 2f516d7d758..4b312fd4646 100644 --- a/tests/baselines/reference/asyncArrowFunctionCapturesArguments_es6.symbols +++ b/tests/baselines/reference/asyncArrowFunctionCapturesArguments_es6.symbols @@ -3,16 +3,16 @@ class C { >C : Symbol(C, Decl(asyncArrowFunctionCapturesArguments_es6.ts, 0, 0)) method() { ->method : Symbol(method, Decl(asyncArrowFunctionCapturesArguments_es6.ts, 0, 9)) +>method : Symbol(C.method, Decl(asyncArrowFunctionCapturesArguments_es6.ts, 0, 9)) function other() {} >other : Symbol(other, Decl(asyncArrowFunctionCapturesArguments_es6.ts, 1, 13)) var fn = async () => await other.apply(this, arguments); >fn : Symbol(fn, Decl(asyncArrowFunctionCapturesArguments_es6.ts, 3, 9)) ->other.apply : Symbol(Function.apply, Decl(lib.d.ts, --, --)) +>other.apply : Symbol(Function.apply, Decl(lib.es5.d.ts, --, --)) >other : Symbol(other, Decl(asyncArrowFunctionCapturesArguments_es6.ts, 1, 13)) ->apply : Symbol(Function.apply, Decl(lib.d.ts, --, --)) +>apply : Symbol(Function.apply, Decl(lib.es5.d.ts, --, --)) >this : Symbol(C, Decl(asyncArrowFunctionCapturesArguments_es6.ts, 0, 0)) >arguments : Symbol(arguments) } diff --git a/tests/baselines/reference/asyncArrowFunctionCapturesArguments_es6.types b/tests/baselines/reference/asyncArrowFunctionCapturesArguments_es6.types index 76853858c5c..bb9df9af139 100644 --- a/tests/baselines/reference/asyncArrowFunctionCapturesArguments_es6.types +++ b/tests/baselines/reference/asyncArrowFunctionCapturesArguments_es6.types @@ -13,9 +13,9 @@ class C { >async () => await other.apply(this, arguments) : () => Promise >await other.apply(this, arguments) : any >other.apply(this, arguments) : any ->other.apply : (thisArg: any, argArray?: any) => any +>other.apply : (this: Function, thisArg: any, argArray?: any) => any >other : () => void ->apply : (thisArg: any, argArray?: any) => any +>apply : (this: Function, thisArg: any, argArray?: any) => any >this : this >arguments : IArguments } diff --git a/tests/baselines/reference/asyncArrowFunctionCapturesThis_es6.js b/tests/baselines/reference/asyncArrowFunctionCapturesThis_es6.js index 0f09e366ef3..de7eb23ed78 100644 --- a/tests/baselines/reference/asyncArrowFunctionCapturesThis_es6.js +++ b/tests/baselines/reference/asyncArrowFunctionCapturesThis_es6.js @@ -9,6 +9,6 @@ class C { //// [asyncArrowFunctionCapturesThis_es6.js] class C { method() { - var fn = () => __awaiter(this, void 0, Promise, function* () { return yield this; }); + var fn = () => __awaiter(this, void 0, void 0, function* () { return yield this; }); } } diff --git a/tests/baselines/reference/asyncArrowFunctionCapturesThis_es6.symbols b/tests/baselines/reference/asyncArrowFunctionCapturesThis_es6.symbols index ae516bb7fe3..17293752672 100644 --- a/tests/baselines/reference/asyncArrowFunctionCapturesThis_es6.symbols +++ b/tests/baselines/reference/asyncArrowFunctionCapturesThis_es6.symbols @@ -3,7 +3,7 @@ class C { >C : Symbol(C, Decl(asyncArrowFunctionCapturesThis_es6.ts, 0, 0)) method() { ->method : Symbol(method, Decl(asyncArrowFunctionCapturesThis_es6.ts, 0, 9)) +>method : Symbol(C.method, Decl(asyncArrowFunctionCapturesThis_es6.ts, 0, 9)) var fn = async () => await this; >fn : Symbol(fn, Decl(asyncArrowFunctionCapturesThis_es6.ts, 2, 9)) diff --git a/tests/baselines/reference/asyncAwaitIsolatedModules_es6.js b/tests/baselines/reference/asyncAwaitIsolatedModules_es6.js index 7007c66ae28..4022fde7f54 100644 --- a/tests/baselines/reference/asyncAwaitIsolatedModules_es6.js +++ b/tests/baselines/reference/asyncAwaitIsolatedModules_es6.js @@ -40,79 +40,74 @@ module M { } //// [asyncAwaitIsolatedModules_es6.js] -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promise, generator) { - return new Promise(function (resolve, reject) { - generator = generator.call(thisArg, _arguments); - function cast(value) { return value instanceof Promise && value.constructor === Promise ? value : new Promise(function (resolve) { resolve(value); }); } - function onfulfill(value) { try { step("next", value); } catch (e) { reject(e); } } - function onreject(value) { try { step("throw", value); } catch (e) { reject(e); } } - function step(verb, value) { - var result = generator[verb](value); - result.done ? resolve(result.value) : cast(result.value).then(onfulfill, onreject); - } - step("next", void 0); +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator.throw(value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments)).next()); }); }; function f0() { - return __awaiter(this, void 0, Promise, function* () { }); + return __awaiter(this, void 0, void 0, function* () { }); } function f1() { - return __awaiter(this, void 0, Promise, function* () { }); + return __awaiter(this, void 0, void 0, function* () { }); } function f3() { - return __awaiter(this, void 0, MyPromise, function* () { }); + return __awaiter(this, void 0, void 0, function* () { }); } let f4 = function () { - return __awaiter(this, void 0, Promise, function* () { }); + return __awaiter(this, void 0, void 0, function* () { }); }; let f5 = function () { - return __awaiter(this, void 0, Promise, function* () { }); + return __awaiter(this, void 0, void 0, function* () { }); }; let f6 = function () { - return __awaiter(this, void 0, MyPromise, function* () { }); + return __awaiter(this, void 0, void 0, function* () { }); }; -let f7 = () => __awaiter(this, void 0, Promise, function* () { }); -let f8 = () => __awaiter(this, void 0, Promise, function* () { }); -let f9 = () => __awaiter(this, void 0, MyPromise, function* () { }); -let f10 = () => __awaiter(this, void 0, Promise, function* () { return p; }); -let f11 = () => __awaiter(this, void 0, Promise, function* () { return mp; }); -let f12 = () => __awaiter(this, void 0, Promise, function* () { return mp; }); -let f13 = () => __awaiter(this, void 0, MyPromise, function* () { return p; }); +let f7 = () => __awaiter(this, void 0, void 0, function* () { }); +let f8 = () => __awaiter(this, void 0, void 0, function* () { }); +let f9 = () => __awaiter(this, void 0, void 0, function* () { }); +let f10 = () => __awaiter(this, void 0, void 0, function* () { return p; }); +let f11 = () => __awaiter(this, void 0, void 0, function* () { return mp; }); +let f12 = () => __awaiter(this, void 0, void 0, function* () { return mp; }); +let f13 = () => __awaiter(this, void 0, void 0, function* () { return p; }); let o = { m1() { - return __awaiter(this, void 0, Promise, function* () { }); + return __awaiter(this, void 0, void 0, function* () { }); }, m2() { - return __awaiter(this, void 0, Promise, function* () { }); + return __awaiter(this, void 0, void 0, function* () { }); }, m3() { - return __awaiter(this, void 0, MyPromise, function* () { }); + return __awaiter(this, void 0, void 0, function* () { }); } }; class C { m1() { - return __awaiter(this, void 0, Promise, function* () { }); + return __awaiter(this, void 0, void 0, function* () { }); } m2() { - return __awaiter(this, void 0, Promise, function* () { }); + return __awaiter(this, void 0, void 0, function* () { }); } m3() { - return __awaiter(this, void 0, MyPromise, function* () { }); + return __awaiter(this, void 0, void 0, function* () { }); } static m4() { - return __awaiter(this, void 0, Promise, function* () { }); + return __awaiter(this, void 0, void 0, function* () { }); } static m5() { - return __awaiter(this, void 0, Promise, function* () { }); + return __awaiter(this, void 0, void 0, function* () { }); } static m6() { - return __awaiter(this, void 0, MyPromise, function* () { }); + return __awaiter(this, void 0, void 0, function* () { }); } } var M; (function (M) { function f1() { - return __awaiter(this, void 0, Promise, function* () { }); + return __awaiter(this, void 0, void 0, function* () { }); } M.f1 = f1; })(M || (M = {})); diff --git a/tests/baselines/reference/asyncAwait_es6.js b/tests/baselines/reference/asyncAwait_es6.js index 155a44d339d..be2eb90e3e4 100644 --- a/tests/baselines/reference/asyncAwait_es6.js +++ b/tests/baselines/reference/asyncAwait_es6.js @@ -40,79 +40,74 @@ module M { } //// [asyncAwait_es6.js] -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promise, generator) { - return new Promise(function (resolve, reject) { - generator = generator.call(thisArg, _arguments); - function cast(value) { return value instanceof Promise && value.constructor === Promise ? value : new Promise(function (resolve) { resolve(value); }); } - function onfulfill(value) { try { step("next", value); } catch (e) { reject(e); } } - function onreject(value) { try { step("throw", value); } catch (e) { reject(e); } } - function step(verb, value) { - var result = generator[verb](value); - result.done ? resolve(result.value) : cast(result.value).then(onfulfill, onreject); - } - step("next", void 0); +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator.throw(value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments)).next()); }); }; function f0() { - return __awaiter(this, void 0, Promise, function* () { }); + return __awaiter(this, void 0, void 0, function* () { }); } function f1() { - return __awaiter(this, void 0, Promise, function* () { }); + return __awaiter(this, void 0, void 0, function* () { }); } function f3() { - return __awaiter(this, void 0, MyPromise, function* () { }); + return __awaiter(this, void 0, void 0, function* () { }); } let f4 = function () { - return __awaiter(this, void 0, Promise, function* () { }); + return __awaiter(this, void 0, void 0, function* () { }); }; let f5 = function () { - return __awaiter(this, void 0, Promise, function* () { }); + return __awaiter(this, void 0, void 0, function* () { }); }; let f6 = function () { - return __awaiter(this, void 0, MyPromise, function* () { }); + return __awaiter(this, void 0, void 0, function* () { }); }; -let f7 = () => __awaiter(this, void 0, Promise, function* () { }); -let f8 = () => __awaiter(this, void 0, Promise, function* () { }); -let f9 = () => __awaiter(this, void 0, MyPromise, function* () { }); -let f10 = () => __awaiter(this, void 0, Promise, function* () { return p; }); -let f11 = () => __awaiter(this, void 0, Promise, function* () { return mp; }); -let f12 = () => __awaiter(this, void 0, Promise, function* () { return mp; }); -let f13 = () => __awaiter(this, void 0, MyPromise, function* () { return p; }); +let f7 = () => __awaiter(this, void 0, void 0, function* () { }); +let f8 = () => __awaiter(this, void 0, void 0, function* () { }); +let f9 = () => __awaiter(this, void 0, void 0, function* () { }); +let f10 = () => __awaiter(this, void 0, void 0, function* () { return p; }); +let f11 = () => __awaiter(this, void 0, void 0, function* () { return mp; }); +let f12 = () => __awaiter(this, void 0, void 0, function* () { return mp; }); +let f13 = () => __awaiter(this, void 0, void 0, function* () { return p; }); let o = { m1() { - return __awaiter(this, void 0, Promise, function* () { }); + return __awaiter(this, void 0, void 0, function* () { }); }, m2() { - return __awaiter(this, void 0, Promise, function* () { }); + return __awaiter(this, void 0, void 0, function* () { }); }, m3() { - return __awaiter(this, void 0, MyPromise, function* () { }); + return __awaiter(this, void 0, void 0, function* () { }); } }; class C { m1() { - return __awaiter(this, void 0, Promise, function* () { }); + return __awaiter(this, void 0, void 0, function* () { }); } m2() { - return __awaiter(this, void 0, Promise, function* () { }); + return __awaiter(this, void 0, void 0, function* () { }); } m3() { - return __awaiter(this, void 0, MyPromise, function* () { }); + return __awaiter(this, void 0, void 0, function* () { }); } static m4() { - return __awaiter(this, void 0, Promise, function* () { }); + return __awaiter(this, void 0, void 0, function* () { }); } static m5() { - return __awaiter(this, void 0, Promise, function* () { }); + return __awaiter(this, void 0, void 0, function* () { }); } static m6() { - return __awaiter(this, void 0, MyPromise, function* () { }); + return __awaiter(this, void 0, void 0, function* () { }); } } var M; (function (M) { function f1() { - return __awaiter(this, void 0, Promise, function* () { }); + return __awaiter(this, void 0, void 0, function* () { }); } M.f1 = f1; })(M || (M = {})); diff --git a/tests/baselines/reference/asyncAwait_es6.symbols b/tests/baselines/reference/asyncAwait_es6.symbols index 3c668b15b36..26295e72f78 100644 --- a/tests/baselines/reference/asyncAwait_es6.symbols +++ b/tests/baselines/reference/asyncAwait_es6.symbols @@ -2,16 +2,16 @@ type MyPromise = Promise; >MyPromise : Symbol(MyPromise, Decl(asyncAwait_es6.ts, 0, 0), Decl(asyncAwait_es6.ts, 1, 11)) >T : Symbol(T, Decl(asyncAwait_es6.ts, 0, 15)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >T : Symbol(T, Decl(asyncAwait_es6.ts, 0, 15)) declare var MyPromise: typeof Promise; >MyPromise : Symbol(MyPromise, Decl(asyncAwait_es6.ts, 0, 0), Decl(asyncAwait_es6.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) declare var p: Promise; >p : Symbol(p, Decl(asyncAwait_es6.ts, 2, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) declare var mp: MyPromise; >mp : Symbol(mp, Decl(asyncAwait_es6.ts, 3, 11)) @@ -22,7 +22,7 @@ async function f0() { } async function f1(): Promise { } >f1 : Symbol(f1, Decl(asyncAwait_es6.ts, 5, 23)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) async function f3(): MyPromise { } >f3 : Symbol(f3, Decl(asyncAwait_es6.ts, 6, 38)) @@ -33,7 +33,7 @@ let f4 = async function() { } let f5 = async function(): Promise { } >f5 : Symbol(f5, Decl(asyncAwait_es6.ts, 10, 3)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) let f6 = async function(): MyPromise { } >f6 : Symbol(f6, Decl(asyncAwait_es6.ts, 11, 3)) @@ -44,7 +44,7 @@ let f7 = async () => { }; let f8 = async (): Promise => { }; >f8 : Symbol(f8, Decl(asyncAwait_es6.ts, 14, 3)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) let f9 = async (): MyPromise => { }; >f9 : Symbol(f9, Decl(asyncAwait_es6.ts, 15, 3)) @@ -60,7 +60,7 @@ let f11 = async () => mp; let f12 = async (): Promise => mp; >f12 : Symbol(f12, Decl(asyncAwait_es6.ts, 18, 3)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >mp : Symbol(mp, Decl(asyncAwait_es6.ts, 3, 11)) let f13 = async (): MyPromise => p; @@ -76,7 +76,7 @@ let o = { async m2(): Promise { }, >m2 : Symbol(m2, Decl(asyncAwait_es6.ts, 22, 16)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) async m3(): MyPromise { } >m3 : Symbol(m3, Decl(asyncAwait_es6.ts, 23, 31)) @@ -88,14 +88,14 @@ class C { >C : Symbol(C, Decl(asyncAwait_es6.ts, 25, 2)) async m1() { } ->m1 : Symbol(m1, Decl(asyncAwait_es6.ts, 27, 9)) +>m1 : Symbol(C.m1, Decl(asyncAwait_es6.ts, 27, 9)) async m2(): Promise { } ->m2 : Symbol(m2, Decl(asyncAwait_es6.ts, 28, 15)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>m2 : Symbol(C.m2, Decl(asyncAwait_es6.ts, 28, 15)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) async m3(): MyPromise { } ->m3 : Symbol(m3, Decl(asyncAwait_es6.ts, 29, 30)) +>m3 : Symbol(C.m3, Decl(asyncAwait_es6.ts, 29, 30)) >MyPromise : Symbol(MyPromise, Decl(asyncAwait_es6.ts, 0, 0), Decl(asyncAwait_es6.ts, 1, 11)) static async m4() { } @@ -103,7 +103,7 @@ class C { static async m5(): Promise { } >m5 : Symbol(C.m5, Decl(asyncAwait_es6.ts, 31, 22)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) static async m6(): MyPromise { } >m6 : Symbol(C.m6, Decl(asyncAwait_es6.ts, 32, 37)) diff --git a/tests/baselines/reference/asyncFunctionDeclaration11_es6.js b/tests/baselines/reference/asyncFunctionDeclaration11_es6.js index a44343cef78..6fe8921434c 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration11_es6.js +++ b/tests/baselines/reference/asyncFunctionDeclaration11_es6.js @@ -4,6 +4,6 @@ async function await(): Promise { //// [asyncFunctionDeclaration11_es6.js] function await() { - return __awaiter(this, void 0, Promise, function* () { + return __awaiter(this, void 0, void 0, function* () { }); } diff --git a/tests/baselines/reference/asyncFunctionDeclaration11_es6.symbols b/tests/baselines/reference/asyncFunctionDeclaration11_es6.symbols index f1946aa712f..c9288f42763 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration11_es6.symbols +++ b/tests/baselines/reference/asyncFunctionDeclaration11_es6.symbols @@ -1,5 +1,5 @@ === tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration11_es6.ts === async function await(): Promise { >await : Symbol(await, Decl(asyncFunctionDeclaration11_es6.ts, 0, 0)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) } diff --git a/tests/baselines/reference/asyncFunctionDeclaration13_es6.js b/tests/baselines/reference/asyncFunctionDeclaration13_es6.js index 4257c8691c2..6fab6c39947 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration13_es6.js +++ b/tests/baselines/reference/asyncFunctionDeclaration13_es6.js @@ -7,7 +7,7 @@ async function foo(): Promise { //// [asyncFunctionDeclaration13_es6.js] function foo() { - return __awaiter(this, void 0, Promise, function* () { + return __awaiter(this, void 0, void 0, function* () { // Legal to use 'await' in a type context. var v; }); diff --git a/tests/baselines/reference/asyncFunctionDeclaration14_es6.js b/tests/baselines/reference/asyncFunctionDeclaration14_es6.js index f32d106f92e..f584f917842 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration14_es6.js +++ b/tests/baselines/reference/asyncFunctionDeclaration14_es6.js @@ -5,7 +5,7 @@ async function foo(): Promise { //// [asyncFunctionDeclaration14_es6.js] function foo() { - return __awaiter(this, void 0, Promise, function* () { + return __awaiter(this, void 0, void 0, function* () { return; }); } diff --git a/tests/baselines/reference/asyncFunctionDeclaration14_es6.symbols b/tests/baselines/reference/asyncFunctionDeclaration14_es6.symbols index 34623ded262..d036632ff86 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration14_es6.symbols +++ b/tests/baselines/reference/asyncFunctionDeclaration14_es6.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration14_es6.ts === async function foo(): Promise { >foo : Symbol(foo, Decl(asyncFunctionDeclaration14_es6.ts, 0, 0)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) return; } diff --git a/tests/baselines/reference/asyncFunctionDeclaration15_es6.errors.txt b/tests/baselines/reference/asyncFunctionDeclaration15_es6.errors.txt index bc1ef24127a..e8d3e7d79b1 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration15_es6.errors.txt +++ b/tests/baselines/reference/asyncFunctionDeclaration15_es6.errors.txt @@ -1,12 +1,8 @@ -tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration15_es6.ts(6,16): error TS1055: Type '{}' is not a valid async function return type. -tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration15_es6.ts(7,16): error TS1055: Type 'any' is not a valid async function return type. -tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration15_es6.ts(8,16): error TS1055: Type 'number' is not a valid async function return type. -tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration15_es6.ts(9,16): error TS1055: Type 'PromiseLike' is not a valid async function return type. -tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration15_es6.ts(10,16): error TS1055: Type 'typeof Thenable' is not a valid async function return type. - Type 'Thenable' is not assignable to type 'PromiseLike'. - Types of property 'then' are incompatible. - Type '() => void' is not assignable to type '{ (onfulfilled?: (value: any) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): PromiseLike; (onfulfilled?: (value: any) => TResult | PromiseLike, onrejected?: (reason: any) => void): PromiseLike; }'. - Type 'void' is not assignable to type 'PromiseLike'. +tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration15_es6.ts(6,23): error TS1064: The return type of an async function or method must be the global Promise type. +tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration15_es6.ts(7,23): error TS1064: The return type of an async function or method must be the global Promise type. +tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration15_es6.ts(8,23): error TS1064: The return type of an async function or method must be the global Promise type. +tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration15_es6.ts(9,23): error TS1064: The return type of an async function or method must be the global Promise type. +tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration15_es6.ts(10,23): error TS1064: The return type of an async function or method must be the global Promise type. tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration15_es6.ts(17,16): error TS1059: Return expression in async function does not have a valid callable 'then' member. tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration15_es6.ts(23,25): error TS1058: Operand for 'await' does not have a valid callable 'then' member. @@ -18,24 +14,20 @@ tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration1 declare let thenable: Thenable; async function fn1() { } // valid: Promise async function fn2(): { } { } // error - ~~~ -!!! error TS1055: Type '{}' is not a valid async function return type. + ~~~ +!!! error TS1064: The return type of an async function or method must be the global Promise type. async function fn3(): any { } // error - ~~~ -!!! error TS1055: Type 'any' is not a valid async function return type. + ~~~ +!!! error TS1064: The return type of an async function or method must be the global Promise type. async function fn4(): number { } // error - ~~~ -!!! error TS1055: Type 'number' is not a valid async function return type. + ~~~~~~ +!!! error TS1064: The return type of an async function or method must be the global Promise type. async function fn5(): PromiseLike { } // error - ~~~ -!!! error TS1055: Type 'PromiseLike' is not a valid async function return type. + ~~~~~~~~~~~~~~~~~ +!!! error TS1064: The return type of an async function or method must be the global Promise type. async function fn6(): Thenable { } // error - ~~~ -!!! error TS1055: Type 'typeof Thenable' is not a valid async function return type. -!!! error TS1055: Type 'Thenable' is not assignable to type 'PromiseLike'. -!!! error TS1055: Types of property 'then' are incompatible. -!!! error TS1055: Type '() => void' is not assignable to type '{ (onfulfilled?: (value: any) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): PromiseLike; (onfulfilled?: (value: any) => TResult | PromiseLike, onrejected?: (reason: any) => void): PromiseLike; }'. -!!! error TS1055: Type 'void' is not assignable to type 'PromiseLike'. + ~~~~~~~~ +!!! error TS1064: The return type of an async function or method must be the global Promise type. async function fn7() { return; } // valid: Promise async function fn8() { return 1; } // valid: Promise async function fn9() { return null; } // valid: Promise diff --git a/tests/baselines/reference/asyncFunctionDeclaration15_es6.js b/tests/baselines/reference/asyncFunctionDeclaration15_es6.js index c72062e24b2..174a95d6f66 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration15_es6.js +++ b/tests/baselines/reference/asyncFunctionDeclaration15_es6.js @@ -26,59 +26,59 @@ async function fn19() { await thenable; } // error //// [asyncFunctionDeclaration15_es6.js] function fn1() { - return __awaiter(this, void 0, Promise, function* () { }); + return __awaiter(this, void 0, void 0, function* () { }); } // valid: Promise function fn2() { - return __awaiter(this, void 0, Promise, function* () { }); + return __awaiter(this, void 0, void 0, function* () { }); } // error function fn3() { - return __awaiter(this, void 0, Promise, function* () { }); + return __awaiter(this, void 0, void 0, function* () { }); } // error function fn4() { - return __awaiter(this, void 0, Promise, function* () { }); + return __awaiter(this, void 0, void 0, function* () { }); } // error function fn5() { - return __awaiter(this, void 0, PromiseLike, function* () { }); + return __awaiter(this, void 0, void 0, function* () { }); } // error function fn6() { - return __awaiter(this, void 0, Thenable, function* () { }); + return __awaiter(this, void 0, void 0, function* () { }); } // error function fn7() { - return __awaiter(this, void 0, Promise, function* () { return; }); + return __awaiter(this, void 0, void 0, function* () { return; }); } // valid: Promise function fn8() { - return __awaiter(this, void 0, Promise, function* () { return 1; }); + return __awaiter(this, void 0, void 0, function* () { return 1; }); } // valid: Promise function fn9() { - return __awaiter(this, void 0, Promise, function* () { return null; }); + return __awaiter(this, void 0, void 0, function* () { return null; }); } // valid: Promise function fn10() { - return __awaiter(this, void 0, Promise, function* () { return undefined; }); + return __awaiter(this, void 0, void 0, function* () { return undefined; }); } // valid: Promise function fn11() { - return __awaiter(this, void 0, Promise, function* () { return a; }); + return __awaiter(this, void 0, void 0, function* () { return a; }); } // valid: Promise function fn12() { - return __awaiter(this, void 0, Promise, function* () { return obj; }); + return __awaiter(this, void 0, void 0, function* () { return obj; }); } // valid: Promise<{ then: string; }> function fn13() { - return __awaiter(this, void 0, Promise, function* () { return thenable; }); + return __awaiter(this, void 0, void 0, function* () { return thenable; }); } // error function fn14() { - return __awaiter(this, void 0, Promise, function* () { yield 1; }); + return __awaiter(this, void 0, void 0, function* () { yield 1; }); } // valid: Promise function fn15() { - return __awaiter(this, void 0, Promise, function* () { yield null; }); + return __awaiter(this, void 0, void 0, function* () { yield null; }); } // valid: Promise function fn16() { - return __awaiter(this, void 0, Promise, function* () { yield undefined; }); + return __awaiter(this, void 0, void 0, function* () { yield undefined; }); } // valid: Promise function fn17() { - return __awaiter(this, void 0, Promise, function* () { yield a; }); + return __awaiter(this, void 0, void 0, function* () { yield a; }); } // valid: Promise function fn18() { - return __awaiter(this, void 0, Promise, function* () { yield obj; }); + return __awaiter(this, void 0, void 0, function* () { yield obj; }); } // valid: Promise function fn19() { - return __awaiter(this, void 0, Promise, function* () { yield thenable; }); + return __awaiter(this, void 0, void 0, function* () { yield thenable; }); } // error diff --git a/tests/baselines/reference/asyncFunctionDeclaration1_es6.js b/tests/baselines/reference/asyncFunctionDeclaration1_es6.js index 263e27fa35e..e92d55dc0e2 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration1_es6.js +++ b/tests/baselines/reference/asyncFunctionDeclaration1_es6.js @@ -4,6 +4,6 @@ async function foo(): Promise { //// [asyncFunctionDeclaration1_es6.js] function foo() { - return __awaiter(this, void 0, Promise, function* () { + return __awaiter(this, void 0, void 0, function* () { }); } diff --git a/tests/baselines/reference/asyncFunctionDeclaration1_es6.symbols b/tests/baselines/reference/asyncFunctionDeclaration1_es6.symbols index b1721789f5c..019d2db4f07 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration1_es6.symbols +++ b/tests/baselines/reference/asyncFunctionDeclaration1_es6.symbols @@ -1,5 +1,5 @@ === tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration1_es6.ts === async function foo(): Promise { >foo : Symbol(foo, Decl(asyncFunctionDeclaration1_es6.ts, 0, 0)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) } diff --git a/tests/baselines/reference/asyncFunctionDeclaration6_es6.js b/tests/baselines/reference/asyncFunctionDeclaration6_es6.js index 8c37968ab4c..a70316989b3 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration6_es6.js +++ b/tests/baselines/reference/asyncFunctionDeclaration6_es6.js @@ -4,6 +4,6 @@ async function foo(a = await): Promise { //// [asyncFunctionDeclaration6_es6.js] function foo(a = yield ) { - return __awaiter(this, void 0, Promise, function* () { + return __awaiter(this, void 0, void 0, function* () { }); } diff --git a/tests/baselines/reference/asyncFunctionDeclaration7_es6.js b/tests/baselines/reference/asyncFunctionDeclaration7_es6.js index ef66df4e413..0d360fa866c 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration7_es6.js +++ b/tests/baselines/reference/asyncFunctionDeclaration7_es6.js @@ -7,10 +7,10 @@ async function bar(): Promise { //// [asyncFunctionDeclaration7_es6.js] function bar() { - return __awaiter(this, void 0, Promise, function* () { + return __awaiter(this, void 0, void 0, function* () { // 'await' here is an identifier, and not a yield expression. function foo(a = yield ) { - return __awaiter(this, void 0, Promise, function* () { + return __awaiter(this, void 0, void 0, function* () { }); } }); diff --git a/tests/baselines/reference/asyncFunctionDeclaration9_es6.js b/tests/baselines/reference/asyncFunctionDeclaration9_es6.js index 9723a69f2a2..c57c0eb395a 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration9_es6.js +++ b/tests/baselines/reference/asyncFunctionDeclaration9_es6.js @@ -5,7 +5,7 @@ async function foo(): Promise { //// [asyncFunctionDeclaration9_es6.js] function foo() { - return __awaiter(this, void 0, Promise, function* () { + return __awaiter(this, void 0, void 0, function* () { var v = { [yield ]: foo }; }); } diff --git a/tests/baselines/reference/asyncFunctionsAcrossFiles.js b/tests/baselines/reference/asyncFunctionsAcrossFiles.js new file mode 100644 index 00000000000..94ccff2358c --- /dev/null +++ b/tests/baselines/reference/asyncFunctionsAcrossFiles.js @@ -0,0 +1,47 @@ +//// [tests/cases/compiler/asyncFunctionsAcrossFiles.ts] //// + +//// [a.ts] +import { b } from './b'; +export const a = { + f: async () => { + await b.f(); + } +}; +//// [b.ts] +import { a } from './a'; +export const b = { + f: async () => { + await a.f(); + } +}; + +//// [b.js] +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator.throw(value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments)).next()); + }); +}; +import { a } from './a'; +export const b = { + f: () => __awaiter(this, void 0, void 0, function* () { + yield a.f(); + }) +}; +//// [a.js] +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator.throw(value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments)).next()); + }); +}; +import { b } from './b'; +export const a = { + f: () => __awaiter(this, void 0, void 0, function* () { + yield b.f(); + }) +}; diff --git a/tests/baselines/reference/asyncFunctionsAcrossFiles.symbols b/tests/baselines/reference/asyncFunctionsAcrossFiles.symbols new file mode 100644 index 00000000000..2e9c52d5d91 --- /dev/null +++ b/tests/baselines/reference/asyncFunctionsAcrossFiles.symbols @@ -0,0 +1,32 @@ +=== tests/cases/compiler/a.ts === +import { b } from './b'; +>b : Symbol(b, Decl(a.ts, 0, 8)) + +export const a = { +>a : Symbol(a, Decl(a.ts, 1, 12)) + + f: async () => { +>f : Symbol(f, Decl(a.ts, 1, 18)) + + await b.f(); +>b.f : Symbol(f, Decl(b.ts, 1, 18)) +>b : Symbol(b, Decl(a.ts, 0, 8)) +>f : Symbol(f, Decl(b.ts, 1, 18)) + } +}; +=== tests/cases/compiler/b.ts === +import { a } from './a'; +>a : Symbol(a, Decl(b.ts, 0, 8)) + +export const b = { +>b : Symbol(b, Decl(b.ts, 1, 12)) + + f: async () => { +>f : Symbol(f, Decl(b.ts, 1, 18)) + + await a.f(); +>a.f : Symbol(f, Decl(a.ts, 1, 18)) +>a : Symbol(a, Decl(b.ts, 0, 8)) +>f : Symbol(f, Decl(a.ts, 1, 18)) + } +}; diff --git a/tests/baselines/reference/asyncFunctionsAcrossFiles.types b/tests/baselines/reference/asyncFunctionsAcrossFiles.types new file mode 100644 index 00000000000..0b946141541 --- /dev/null +++ b/tests/baselines/reference/asyncFunctionsAcrossFiles.types @@ -0,0 +1,40 @@ +=== tests/cases/compiler/a.ts === +import { b } from './b'; +>b : { f: () => Promise; } + +export const a = { +>a : { f: () => Promise; } +>{ f: async () => { await b.f(); }} : { f: () => Promise; } + + f: async () => { +>f : () => Promise +>async () => { await b.f(); } : () => Promise + + await b.f(); +>await b.f() : void +>b.f() : Promise +>b.f : () => Promise +>b : { f: () => Promise; } +>f : () => Promise + } +}; +=== tests/cases/compiler/b.ts === +import { a } from './a'; +>a : { f: () => Promise; } + +export const b = { +>b : { f: () => Promise; } +>{ f: async () => { await a.f(); }} : { f: () => Promise; } + + f: async () => { +>f : () => Promise +>async () => { await a.f(); } : () => Promise + + await a.f(); +>await a.f() : void +>a.f() : Promise +>a.f : () => Promise +>a : { f: () => Promise; } +>f : () => Promise + } +}; diff --git a/tests/baselines/reference/asyncFunctionsAndStrictNullChecks.js b/tests/baselines/reference/asyncFunctionsAndStrictNullChecks.js new file mode 100644 index 00000000000..3e351c37046 --- /dev/null +++ b/tests/baselines/reference/asyncFunctionsAndStrictNullChecks.js @@ -0,0 +1,48 @@ +//// [asyncFunctionsAndStrictNullChecks.ts] + +declare namespace Windows.Foundation { + interface IPromise { + then(success?: (value: TResult) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; + then(success?: (value: TResult) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; + then(success?: (value: TResult) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; + then(success?: (value: TResult) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; + done(success?: (value: TResult) => any, error?: (error: any) => any, progress?: (progress: any) => void): void; + + cancel(): void; + } +} + +async function sample(promise: Windows.Foundation.IPromise) { + var number = await promise; +} + + +declare function resolve1(value: T): Promise; +declare function resolve2(value: T): Windows.Foundation.IPromise; + +async function sample2(x?: number) { + let x1 = await resolve1(x); + let x2 = await resolve2(x); +} + + +//// [asyncFunctionsAndStrictNullChecks.js] +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator.throw(value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments)).next()); + }); +}; +function sample(promise) { + return __awaiter(this, void 0, void 0, function* () { + var number = yield promise; + }); +} +function sample2(x) { + return __awaiter(this, void 0, void 0, function* () { + let x1 = yield resolve1(x); + let x2 = yield resolve2(x); + }); +} diff --git a/tests/baselines/reference/asyncFunctionsAndStrictNullChecks.symbols b/tests/baselines/reference/asyncFunctionsAndStrictNullChecks.symbols new file mode 100644 index 00000000000..2d10183133d --- /dev/null +++ b/tests/baselines/reference/asyncFunctionsAndStrictNullChecks.symbols @@ -0,0 +1,136 @@ +=== tests/cases/compiler/asyncFunctionsAndStrictNullChecks.ts === + +declare namespace Windows.Foundation { +>Windows : Symbol(Windows, Decl(asyncFunctionsAndStrictNullChecks.ts, 0, 0)) +>Foundation : Symbol(Foundation, Decl(asyncFunctionsAndStrictNullChecks.ts, 1, 26)) + + interface IPromise { +>IPromise : Symbol(IPromise, Decl(asyncFunctionsAndStrictNullChecks.ts, 1, 38)) +>TResult : Symbol(TResult, Decl(asyncFunctionsAndStrictNullChecks.ts, 2, 23)) + + then(success?: (value: TResult) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; +>then : Symbol(IPromise.then, Decl(asyncFunctionsAndStrictNullChecks.ts, 2, 33), Decl(asyncFunctionsAndStrictNullChecks.ts, 3, 145), Decl(asyncFunctionsAndStrictNullChecks.ts, 4, 135), Decl(asyncFunctionsAndStrictNullChecks.ts, 5, 135)) +>U : Symbol(U, Decl(asyncFunctionsAndStrictNullChecks.ts, 3, 13)) +>success : Symbol(success, Decl(asyncFunctionsAndStrictNullChecks.ts, 3, 16)) +>value : Symbol(value, Decl(asyncFunctionsAndStrictNullChecks.ts, 3, 27)) +>TResult : Symbol(TResult, Decl(asyncFunctionsAndStrictNullChecks.ts, 2, 23)) +>IPromise : Symbol(IPromise, Decl(asyncFunctionsAndStrictNullChecks.ts, 1, 38)) +>U : Symbol(U, Decl(asyncFunctionsAndStrictNullChecks.ts, 3, 13)) +>error : Symbol(error, Decl(asyncFunctionsAndStrictNullChecks.ts, 3, 58)) +>error : Symbol(error, Decl(asyncFunctionsAndStrictNullChecks.ts, 3, 68)) +>IPromise : Symbol(IPromise, Decl(asyncFunctionsAndStrictNullChecks.ts, 1, 38)) +>U : Symbol(U, Decl(asyncFunctionsAndStrictNullChecks.ts, 3, 13)) +>progress : Symbol(progress, Decl(asyncFunctionsAndStrictNullChecks.ts, 3, 95)) +>progress : Symbol(progress, Decl(asyncFunctionsAndStrictNullChecks.ts, 3, 108)) +>IPromise : Symbol(IPromise, Decl(asyncFunctionsAndStrictNullChecks.ts, 1, 38)) +>U : Symbol(U, Decl(asyncFunctionsAndStrictNullChecks.ts, 3, 13)) + + then(success?: (value: TResult) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; +>then : Symbol(IPromise.then, Decl(asyncFunctionsAndStrictNullChecks.ts, 2, 33), Decl(asyncFunctionsAndStrictNullChecks.ts, 3, 145), Decl(asyncFunctionsAndStrictNullChecks.ts, 4, 135), Decl(asyncFunctionsAndStrictNullChecks.ts, 5, 135)) +>U : Symbol(U, Decl(asyncFunctionsAndStrictNullChecks.ts, 4, 13)) +>success : Symbol(success, Decl(asyncFunctionsAndStrictNullChecks.ts, 4, 16)) +>value : Symbol(value, Decl(asyncFunctionsAndStrictNullChecks.ts, 4, 27)) +>TResult : Symbol(TResult, Decl(asyncFunctionsAndStrictNullChecks.ts, 2, 23)) +>IPromise : Symbol(IPromise, Decl(asyncFunctionsAndStrictNullChecks.ts, 1, 38)) +>U : Symbol(U, Decl(asyncFunctionsAndStrictNullChecks.ts, 4, 13)) +>error : Symbol(error, Decl(asyncFunctionsAndStrictNullChecks.ts, 4, 58)) +>error : Symbol(error, Decl(asyncFunctionsAndStrictNullChecks.ts, 4, 68)) +>U : Symbol(U, Decl(asyncFunctionsAndStrictNullChecks.ts, 4, 13)) +>progress : Symbol(progress, Decl(asyncFunctionsAndStrictNullChecks.ts, 4, 85)) +>progress : Symbol(progress, Decl(asyncFunctionsAndStrictNullChecks.ts, 4, 98)) +>IPromise : Symbol(IPromise, Decl(asyncFunctionsAndStrictNullChecks.ts, 1, 38)) +>U : Symbol(U, Decl(asyncFunctionsAndStrictNullChecks.ts, 4, 13)) + + then(success?: (value: TResult) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; +>then : Symbol(IPromise.then, Decl(asyncFunctionsAndStrictNullChecks.ts, 2, 33), Decl(asyncFunctionsAndStrictNullChecks.ts, 3, 145), Decl(asyncFunctionsAndStrictNullChecks.ts, 4, 135), Decl(asyncFunctionsAndStrictNullChecks.ts, 5, 135)) +>U : Symbol(U, Decl(asyncFunctionsAndStrictNullChecks.ts, 5, 13)) +>success : Symbol(success, Decl(asyncFunctionsAndStrictNullChecks.ts, 5, 16)) +>value : Symbol(value, Decl(asyncFunctionsAndStrictNullChecks.ts, 5, 27)) +>TResult : Symbol(TResult, Decl(asyncFunctionsAndStrictNullChecks.ts, 2, 23)) +>U : Symbol(U, Decl(asyncFunctionsAndStrictNullChecks.ts, 5, 13)) +>error : Symbol(error, Decl(asyncFunctionsAndStrictNullChecks.ts, 5, 48)) +>error : Symbol(error, Decl(asyncFunctionsAndStrictNullChecks.ts, 5, 58)) +>IPromise : Symbol(IPromise, Decl(asyncFunctionsAndStrictNullChecks.ts, 1, 38)) +>U : Symbol(U, Decl(asyncFunctionsAndStrictNullChecks.ts, 5, 13)) +>progress : Symbol(progress, Decl(asyncFunctionsAndStrictNullChecks.ts, 5, 85)) +>progress : Symbol(progress, Decl(asyncFunctionsAndStrictNullChecks.ts, 5, 98)) +>IPromise : Symbol(IPromise, Decl(asyncFunctionsAndStrictNullChecks.ts, 1, 38)) +>U : Symbol(U, Decl(asyncFunctionsAndStrictNullChecks.ts, 5, 13)) + + then(success?: (value: TResult) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; +>then : Symbol(IPromise.then, Decl(asyncFunctionsAndStrictNullChecks.ts, 2, 33), Decl(asyncFunctionsAndStrictNullChecks.ts, 3, 145), Decl(asyncFunctionsAndStrictNullChecks.ts, 4, 135), Decl(asyncFunctionsAndStrictNullChecks.ts, 5, 135)) +>U : Symbol(U, Decl(asyncFunctionsAndStrictNullChecks.ts, 6, 13)) +>success : Symbol(success, Decl(asyncFunctionsAndStrictNullChecks.ts, 6, 16)) +>value : Symbol(value, Decl(asyncFunctionsAndStrictNullChecks.ts, 6, 27)) +>TResult : Symbol(TResult, Decl(asyncFunctionsAndStrictNullChecks.ts, 2, 23)) +>U : Symbol(U, Decl(asyncFunctionsAndStrictNullChecks.ts, 6, 13)) +>error : Symbol(error, Decl(asyncFunctionsAndStrictNullChecks.ts, 6, 48)) +>error : Symbol(error, Decl(asyncFunctionsAndStrictNullChecks.ts, 6, 58)) +>U : Symbol(U, Decl(asyncFunctionsAndStrictNullChecks.ts, 6, 13)) +>progress : Symbol(progress, Decl(asyncFunctionsAndStrictNullChecks.ts, 6, 75)) +>progress : Symbol(progress, Decl(asyncFunctionsAndStrictNullChecks.ts, 6, 88)) +>IPromise : Symbol(IPromise, Decl(asyncFunctionsAndStrictNullChecks.ts, 1, 38)) +>U : Symbol(U, Decl(asyncFunctionsAndStrictNullChecks.ts, 6, 13)) + + done(success?: (value: TResult) => any, error?: (error: any) => any, progress?: (progress: any) => void): void; +>done : Symbol(IPromise.done, Decl(asyncFunctionsAndStrictNullChecks.ts, 6, 125)) +>U : Symbol(U, Decl(asyncFunctionsAndStrictNullChecks.ts, 7, 13)) +>success : Symbol(success, Decl(asyncFunctionsAndStrictNullChecks.ts, 7, 16)) +>value : Symbol(value, Decl(asyncFunctionsAndStrictNullChecks.ts, 7, 27)) +>TResult : Symbol(TResult, Decl(asyncFunctionsAndStrictNullChecks.ts, 2, 23)) +>error : Symbol(error, Decl(asyncFunctionsAndStrictNullChecks.ts, 7, 50)) +>error : Symbol(error, Decl(asyncFunctionsAndStrictNullChecks.ts, 7, 60)) +>progress : Symbol(progress, Decl(asyncFunctionsAndStrictNullChecks.ts, 7, 79)) +>progress : Symbol(progress, Decl(asyncFunctionsAndStrictNullChecks.ts, 7, 92)) + + cancel(): void; +>cancel : Symbol(IPromise.cancel, Decl(asyncFunctionsAndStrictNullChecks.ts, 7, 122)) + } +} + +async function sample(promise: Windows.Foundation.IPromise) { +>sample : Symbol(sample, Decl(asyncFunctionsAndStrictNullChecks.ts, 11, 1)) +>promise : Symbol(promise, Decl(asyncFunctionsAndStrictNullChecks.ts, 13, 22)) +>Windows : Symbol(Windows, Decl(asyncFunctionsAndStrictNullChecks.ts, 0, 0)) +>Foundation : Symbol(Windows.Foundation, Decl(asyncFunctionsAndStrictNullChecks.ts, 1, 26)) +>IPromise : Symbol(Windows.Foundation.IPromise, Decl(asyncFunctionsAndStrictNullChecks.ts, 1, 38)) + + var number = await promise; +>number : Symbol(number, Decl(asyncFunctionsAndStrictNullChecks.ts, 14, 7)) +>promise : Symbol(promise, Decl(asyncFunctionsAndStrictNullChecks.ts, 13, 22)) +} + + +declare function resolve1(value: T): Promise; +>resolve1 : Symbol(resolve1, Decl(asyncFunctionsAndStrictNullChecks.ts, 15, 1)) +>T : Symbol(T, Decl(asyncFunctionsAndStrictNullChecks.ts, 18, 26)) +>value : Symbol(value, Decl(asyncFunctionsAndStrictNullChecks.ts, 18, 29)) +>T : Symbol(T, Decl(asyncFunctionsAndStrictNullChecks.ts, 18, 26)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>T : Symbol(T, Decl(asyncFunctionsAndStrictNullChecks.ts, 18, 26)) + +declare function resolve2(value: T): Windows.Foundation.IPromise; +>resolve2 : Symbol(resolve2, Decl(asyncFunctionsAndStrictNullChecks.ts, 18, 51)) +>T : Symbol(T, Decl(asyncFunctionsAndStrictNullChecks.ts, 19, 26)) +>value : Symbol(value, Decl(asyncFunctionsAndStrictNullChecks.ts, 19, 29)) +>T : Symbol(T, Decl(asyncFunctionsAndStrictNullChecks.ts, 19, 26)) +>Windows : Symbol(Windows, Decl(asyncFunctionsAndStrictNullChecks.ts, 0, 0)) +>Foundation : Symbol(Windows.Foundation, Decl(asyncFunctionsAndStrictNullChecks.ts, 1, 26)) +>IPromise : Symbol(Windows.Foundation.IPromise, Decl(asyncFunctionsAndStrictNullChecks.ts, 1, 38)) +>T : Symbol(T, Decl(asyncFunctionsAndStrictNullChecks.ts, 19, 26)) + +async function sample2(x?: number) { +>sample2 : Symbol(sample2, Decl(asyncFunctionsAndStrictNullChecks.ts, 19, 71)) +>x : Symbol(x, Decl(asyncFunctionsAndStrictNullChecks.ts, 21, 23)) + + let x1 = await resolve1(x); +>x1 : Symbol(x1, Decl(asyncFunctionsAndStrictNullChecks.ts, 22, 7)) +>resolve1 : Symbol(resolve1, Decl(asyncFunctionsAndStrictNullChecks.ts, 15, 1)) +>x : Symbol(x, Decl(asyncFunctionsAndStrictNullChecks.ts, 21, 23)) + + let x2 = await resolve2(x); +>x2 : Symbol(x2, Decl(asyncFunctionsAndStrictNullChecks.ts, 23, 7)) +>resolve2 : Symbol(resolve2, Decl(asyncFunctionsAndStrictNullChecks.ts, 18, 51)) +>x : Symbol(x, Decl(asyncFunctionsAndStrictNullChecks.ts, 21, 23)) +} + diff --git a/tests/baselines/reference/asyncFunctionsAndStrictNullChecks.types b/tests/baselines/reference/asyncFunctionsAndStrictNullChecks.types new file mode 100644 index 00000000000..f4eb4f7fa05 --- /dev/null +++ b/tests/baselines/reference/asyncFunctionsAndStrictNullChecks.types @@ -0,0 +1,141 @@ +=== tests/cases/compiler/asyncFunctionsAndStrictNullChecks.ts === + +declare namespace Windows.Foundation { +>Windows : any +>Foundation : any + + interface IPromise { +>IPromise : IPromise +>TResult : TResult + + then(success?: (value: TResult) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; +>then : { (success?: ((value: TResult) => IPromise) | undefined, error?: ((error: any) => IPromise) | undefined, progress?: ((progress: any) => void) | undefined): IPromise; (success?: ((value: TResult) => IPromise) | undefined, error?: ((error: any) => U) | undefined, progress?: ((progress: any) => void) | undefined): IPromise; (success?: ((value: TResult) => U) | undefined, error?: ((error: any) => IPromise) | undefined, progress?: ((progress: any) => void) | undefined): IPromise; (success?: ((value: TResult) => U) | undefined, error?: ((error: any) => U) | undefined, progress?: ((progress: any) => void) | undefined): IPromise; } +>U : U +>success : ((value: TResult) => IPromise) | undefined +>value : TResult +>TResult : TResult +>IPromise : IPromise +>U : U +>error : ((error: any) => IPromise) | undefined +>error : any +>IPromise : IPromise +>U : U +>progress : ((progress: any) => void) | undefined +>progress : any +>IPromise : IPromise +>U : U + + then(success?: (value: TResult) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; +>then : { (success?: ((value: TResult) => IPromise) | undefined, error?: ((error: any) => IPromise) | undefined, progress?: ((progress: any) => void) | undefined): IPromise; (success?: ((value: TResult) => IPromise) | undefined, error?: ((error: any) => U) | undefined, progress?: ((progress: any) => void) | undefined): IPromise; (success?: ((value: TResult) => U) | undefined, error?: ((error: any) => IPromise) | undefined, progress?: ((progress: any) => void) | undefined): IPromise; (success?: ((value: TResult) => U) | undefined, error?: ((error: any) => U) | undefined, progress?: ((progress: any) => void) | undefined): IPromise; } +>U : U +>success : ((value: TResult) => IPromise) | undefined +>value : TResult +>TResult : TResult +>IPromise : IPromise +>U : U +>error : ((error: any) => U) | undefined +>error : any +>U : U +>progress : ((progress: any) => void) | undefined +>progress : any +>IPromise : IPromise +>U : U + + then(success?: (value: TResult) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; +>then : { (success?: ((value: TResult) => IPromise) | undefined, error?: ((error: any) => IPromise) | undefined, progress?: ((progress: any) => void) | undefined): IPromise; (success?: ((value: TResult) => IPromise) | undefined, error?: ((error: any) => U) | undefined, progress?: ((progress: any) => void) | undefined): IPromise; (success?: ((value: TResult) => U) | undefined, error?: ((error: any) => IPromise) | undefined, progress?: ((progress: any) => void) | undefined): IPromise; (success?: ((value: TResult) => U) | undefined, error?: ((error: any) => U) | undefined, progress?: ((progress: any) => void) | undefined): IPromise; } +>U : U +>success : ((value: TResult) => U) | undefined +>value : TResult +>TResult : TResult +>U : U +>error : ((error: any) => IPromise) | undefined +>error : any +>IPromise : IPromise +>U : U +>progress : ((progress: any) => void) | undefined +>progress : any +>IPromise : IPromise +>U : U + + then(success?: (value: TResult) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; +>then : { (success?: ((value: TResult) => IPromise) | undefined, error?: ((error: any) => IPromise) | undefined, progress?: ((progress: any) => void) | undefined): IPromise; (success?: ((value: TResult) => IPromise) | undefined, error?: ((error: any) => U) | undefined, progress?: ((progress: any) => void) | undefined): IPromise; (success?: ((value: TResult) => U) | undefined, error?: ((error: any) => IPromise) | undefined, progress?: ((progress: any) => void) | undefined): IPromise; (success?: ((value: TResult) => U) | undefined, error?: ((error: any) => U) | undefined, progress?: ((progress: any) => void) | undefined): IPromise; } +>U : U +>success : ((value: TResult) => U) | undefined +>value : TResult +>TResult : TResult +>U : U +>error : ((error: any) => U) | undefined +>error : any +>U : U +>progress : ((progress: any) => void) | undefined +>progress : any +>IPromise : IPromise +>U : U + + done(success?: (value: TResult) => any, error?: (error: any) => any, progress?: (progress: any) => void): void; +>done : (success?: ((value: TResult) => any) | undefined, error?: ((error: any) => any) | undefined, progress?: ((progress: any) => void) | undefined) => void +>U : U +>success : ((value: TResult) => any) | undefined +>value : TResult +>TResult : TResult +>error : ((error: any) => any) | undefined +>error : any +>progress : ((progress: any) => void) | undefined +>progress : any + + cancel(): void; +>cancel : () => void + } +} + +async function sample(promise: Windows.Foundation.IPromise) { +>sample : (promise: Windows.Foundation.IPromise) => Promise +>promise : Windows.Foundation.IPromise +>Windows : any +>Foundation : any +>IPromise : Windows.Foundation.IPromise + + var number = await promise; +>number : number +>await promise : number +>promise : Windows.Foundation.IPromise +} + + +declare function resolve1(value: T): Promise; +>resolve1 : (value: T) => Promise +>T : T +>value : T +>T : T +>Promise : Promise +>T : T + +declare function resolve2(value: T): Windows.Foundation.IPromise; +>resolve2 : (value: T) => Windows.Foundation.IPromise +>T : T +>value : T +>T : T +>Windows : any +>Foundation : any +>IPromise : Windows.Foundation.IPromise +>T : T + +async function sample2(x?: number) { +>sample2 : (x?: number | undefined) => Promise +>x : number | undefined + + let x1 = await resolve1(x); +>x1 : number | undefined +>await resolve1(x) : number | undefined +>resolve1(x) : Promise +>resolve1 : (value: T) => Promise +>x : number | undefined + + let x2 = await resolve2(x); +>x2 : number | undefined +>await resolve2(x) : number | undefined +>resolve2(x) : Windows.Foundation.IPromise +>resolve2 : (value: T) => Windows.Foundation.IPromise +>x : number | undefined +} + diff --git a/tests/baselines/reference/asyncImportedPromise_es6.errors.txt b/tests/baselines/reference/asyncImportedPromise_es6.errors.txt new file mode 100644 index 00000000000..43b45482644 --- /dev/null +++ b/tests/baselines/reference/asyncImportedPromise_es6.errors.txt @@ -0,0 +1,13 @@ +tests/cases/conformance/async/es6/test.ts(3,25): error TS1064: The return type of an async function or method must be the global Promise type. + + +==== tests/cases/conformance/async/es6/task.ts (0 errors) ==== + export class Task extends Promise { } + +==== tests/cases/conformance/async/es6/test.ts (1 errors) ==== + import { Task } from "./task"; + class Test { + async example(): Task { return; } + ~~~~~~~ +!!! error TS1064: The return type of an async function or method must be the global Promise type. + } \ No newline at end of file diff --git a/tests/baselines/reference/asyncImportedPromise_es6.js b/tests/baselines/reference/asyncImportedPromise_es6.js index a9c7540d88f..56a41b0283f 100644 --- a/tests/baselines/reference/asyncImportedPromise_es6.js +++ b/tests/baselines/reference/asyncImportedPromise_es6.js @@ -16,22 +16,16 @@ class Task extends Promise { exports.Task = Task; //// [test.js] "use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promise, generator) { - return new Promise(function (resolve, reject) { - generator = generator.call(thisArg, _arguments); - function cast(value) { return value instanceof Promise && value.constructor === Promise ? value : new Promise(function (resolve) { resolve(value); }); } - function onfulfill(value) { try { step("next", value); } catch (e) { reject(e); } } - function onreject(value) { try { step("throw", value); } catch (e) { reject(e); } } - function step(verb, value) { - var result = generator[verb](value); - result.done ? resolve(result.value) : cast(result.value).then(onfulfill, onreject); - } - step("next", void 0); +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator.throw(value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments)).next()); }); }; -var task_1 = require("./task"); class Test { example() { - return __awaiter(this, void 0, task_1.Task, function* () { return; }); + return __awaiter(this, void 0, void 0, function* () { return; }); } } diff --git a/tests/baselines/reference/asyncImportedPromise_es6.symbols b/tests/baselines/reference/asyncImportedPromise_es6.symbols deleted file mode 100644 index 45cf47d2b45..00000000000 --- a/tests/baselines/reference/asyncImportedPromise_es6.symbols +++ /dev/null @@ -1,20 +0,0 @@ -=== tests/cases/conformance/async/es6/task.ts === -export class Task extends Promise { } ->Task : Symbol(Task, Decl(task.ts, 0, 0)) ->T : Symbol(T, Decl(task.ts, 0, 18)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->T : Symbol(T, Decl(task.ts, 0, 18)) - -=== tests/cases/conformance/async/es6/test.ts === -import { Task } from "./task"; ->Task : Symbol(Task, Decl(test.ts, 0, 8)) - -class Test { ->Test : Symbol(Test, Decl(test.ts, 0, 30)) - - async example(): Task { return; } ->example : Symbol(example, Decl(test.ts, 1, 12)) ->T : Symbol(T, Decl(test.ts, 2, 18)) ->Task : Symbol(Task, Decl(test.ts, 0, 8)) ->T : Symbol(T, Decl(test.ts, 2, 18)) -} diff --git a/tests/baselines/reference/asyncImportedPromise_es6.types b/tests/baselines/reference/asyncImportedPromise_es6.types deleted file mode 100644 index 424f14b34d3..00000000000 --- a/tests/baselines/reference/asyncImportedPromise_es6.types +++ /dev/null @@ -1,20 +0,0 @@ -=== tests/cases/conformance/async/es6/task.ts === -export class Task extends Promise { } ->Task : Task ->T : T ->Promise : Promise ->T : T - -=== tests/cases/conformance/async/es6/test.ts === -import { Task } from "./task"; ->Task : typeof Task - -class Test { ->Test : Test - - async example(): Task { return; } ->example : () => Task ->T : T ->Task : Task ->T : T -} diff --git a/tests/baselines/reference/asyncMethodWithSuper_es6.js b/tests/baselines/reference/asyncMethodWithSuper_es6.js new file mode 100644 index 00000000000..eacb0a882b2 --- /dev/null +++ b/tests/baselines/reference/asyncMethodWithSuper_es6.js @@ -0,0 +1,99 @@ +//// [asyncMethodWithSuper_es6.ts] +class A { + x() { + } +} + +class B extends A { + // async method with only call/get on 'super' does not require a binding + async simple() { + // call with property access + super.x(); + + // call with element access + super["x"](); + + // property access (read) + const a = super.x; + + // element access (read) + const b = super["x"]; + } + + // async method with assignment/destructuring on 'super' requires a binding + async advanced() { + const f = () => {}; + + // call with property access + super.x(); + + // call with element access + super["x"](); + + // property access (read) + const a = super.x; + + // element access (read) + const b = super["x"]; + + // property access (assign) + super.x = f; + + // element access (assign) + super["x"] = f; + + // destructuring assign with property access + ({ f: super.x } = { f }); + + // destructuring assign with element access + ({ f: super["x"] } = { f }); + } +} + +//// [asyncMethodWithSuper_es6.js] +class A { + x() { + } +} +class B extends A { + // async method with only call/get on 'super' does not require a binding + simple() { + const _super = name => super[name]; + return __awaiter(this, void 0, void 0, function* () { + // call with property access + _super("x").call(this); + // call with element access + _super("x").call(this); + // property access (read) + const a = _super("x"); + // element access (read) + const b = _super("x"); + }); + } + // async method with assignment/destructuring on 'super' requires a binding + advanced() { + const _super = (function (geti, seti) { + const cache = Object.create(null); + return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } }); + })(name => super[name], (name, value) => super[name] = value); + return __awaiter(this, void 0, void 0, function* () { + const f = () => { }; + // call with property access + _super("x").value.call(this); + // call with element access + _super("x").value.call(this); + // property access (read) + const a = _super("x").value; + // element access (read) + const b = _super("x").value; + // property access (assign) + _super("x").value = f; + // element access (assign) + _super("x").value = f; + // destructuring assign with property access + ({ f: _super("x").value } = { f }); + // destructuring assign with element access + ({ f: _super("x").value } = { f }); + }); + } +} diff --git a/tests/baselines/reference/asyncMethodWithSuper_es6.symbols b/tests/baselines/reference/asyncMethodWithSuper_es6.symbols new file mode 100644 index 00000000000..268ad90f203 --- /dev/null +++ b/tests/baselines/reference/asyncMethodWithSuper_es6.symbols @@ -0,0 +1,102 @@ +=== tests/cases/conformance/async/es6/asyncMethodWithSuper_es6.ts === +class A { +>A : Symbol(A, Decl(asyncMethodWithSuper_es6.ts, 0, 0)) + + x() { +>x : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9)) + } +} + +class B extends A { +>B : Symbol(B, Decl(asyncMethodWithSuper_es6.ts, 3, 1)) +>A : Symbol(A, Decl(asyncMethodWithSuper_es6.ts, 0, 0)) + + // async method with only call/get on 'super' does not require a binding + async simple() { +>simple : Symbol(B.simple, Decl(asyncMethodWithSuper_es6.ts, 5, 19)) + + // call with property access + super.x(); +>super.x : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9)) +>super : Symbol(A, Decl(asyncMethodWithSuper_es6.ts, 0, 0)) +>x : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9)) + + // call with element access + super["x"](); +>super : Symbol(A, Decl(asyncMethodWithSuper_es6.ts, 0, 0)) +>"x" : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9)) + + // property access (read) + const a = super.x; +>a : Symbol(a, Decl(asyncMethodWithSuper_es6.ts, 15, 13)) +>super.x : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9)) +>super : Symbol(A, Decl(asyncMethodWithSuper_es6.ts, 0, 0)) +>x : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9)) + + // element access (read) + const b = super["x"]; +>b : Symbol(b, Decl(asyncMethodWithSuper_es6.ts, 18, 13)) +>super : Symbol(A, Decl(asyncMethodWithSuper_es6.ts, 0, 0)) +>"x" : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9)) + } + + // async method with assignment/destructuring on 'super' requires a binding + async advanced() { +>advanced : Symbol(B.advanced, Decl(asyncMethodWithSuper_es6.ts, 19, 5)) + + const f = () => {}; +>f : Symbol(f, Decl(asyncMethodWithSuper_es6.ts, 23, 13)) + + // call with property access + super.x(); +>super.x : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9)) +>super : Symbol(A, Decl(asyncMethodWithSuper_es6.ts, 0, 0)) +>x : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9)) + + // call with element access + super["x"](); +>super : Symbol(A, Decl(asyncMethodWithSuper_es6.ts, 0, 0)) +>"x" : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9)) + + // property access (read) + const a = super.x; +>a : Symbol(a, Decl(asyncMethodWithSuper_es6.ts, 32, 13)) +>super.x : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9)) +>super : Symbol(A, Decl(asyncMethodWithSuper_es6.ts, 0, 0)) +>x : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9)) + + // element access (read) + const b = super["x"]; +>b : Symbol(b, Decl(asyncMethodWithSuper_es6.ts, 35, 13)) +>super : Symbol(A, Decl(asyncMethodWithSuper_es6.ts, 0, 0)) +>"x" : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9)) + + // property access (assign) + super.x = f; +>super.x : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9)) +>super : Symbol(A, Decl(asyncMethodWithSuper_es6.ts, 0, 0)) +>x : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9)) +>f : Symbol(f, Decl(asyncMethodWithSuper_es6.ts, 23, 13)) + + // element access (assign) + super["x"] = f; +>super : Symbol(A, Decl(asyncMethodWithSuper_es6.ts, 0, 0)) +>"x" : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9)) +>f : Symbol(f, Decl(asyncMethodWithSuper_es6.ts, 23, 13)) + + // destructuring assign with property access + ({ f: super.x } = { f }); +>f : Symbol(f, Decl(asyncMethodWithSuper_es6.ts, 44, 10)) +>super.x : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9)) +>super : Symbol(A, Decl(asyncMethodWithSuper_es6.ts, 0, 0)) +>x : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9)) +>f : Symbol(f, Decl(asyncMethodWithSuper_es6.ts, 44, 27)) + + // destructuring assign with element access + ({ f: super["x"] } = { f }); +>f : Symbol(f, Decl(asyncMethodWithSuper_es6.ts, 47, 10)) +>super : Symbol(A, Decl(asyncMethodWithSuper_es6.ts, 0, 0)) +>"x" : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9)) +>f : Symbol(f, Decl(asyncMethodWithSuper_es6.ts, 47, 30)) + } +} diff --git a/tests/baselines/reference/asyncMethodWithSuper_es6.types b/tests/baselines/reference/asyncMethodWithSuper_es6.types new file mode 100644 index 00000000000..04c5b5a9baf --- /dev/null +++ b/tests/baselines/reference/asyncMethodWithSuper_es6.types @@ -0,0 +1,123 @@ +=== tests/cases/conformance/async/es6/asyncMethodWithSuper_es6.ts === +class A { +>A : A + + x() { +>x : () => void + } +} + +class B extends A { +>B : B +>A : A + + // async method with only call/get on 'super' does not require a binding + async simple() { +>simple : () => Promise + + // call with property access + super.x(); +>super.x() : void +>super.x : () => void +>super : A +>x : () => void + + // call with element access + super["x"](); +>super["x"]() : void +>super["x"] : () => void +>super : A +>"x" : string + + // property access (read) + const a = super.x; +>a : () => void +>super.x : () => void +>super : A +>x : () => void + + // element access (read) + const b = super["x"]; +>b : () => void +>super["x"] : () => void +>super : A +>"x" : string + } + + // async method with assignment/destructuring on 'super' requires a binding + async advanced() { +>advanced : () => Promise + + const f = () => {}; +>f : () => void +>() => {} : () => void + + // call with property access + super.x(); +>super.x() : void +>super.x : () => void +>super : A +>x : () => void + + // call with element access + super["x"](); +>super["x"]() : void +>super["x"] : () => void +>super : A +>"x" : string + + // property access (read) + const a = super.x; +>a : () => void +>super.x : () => void +>super : A +>x : () => void + + // element access (read) + const b = super["x"]; +>b : () => void +>super["x"] : () => void +>super : A +>"x" : string + + // property access (assign) + super.x = f; +>super.x = f : () => void +>super.x : () => void +>super : A +>x : () => void +>f : () => void + + // element access (assign) + super["x"] = f; +>super["x"] = f : () => void +>super["x"] : () => void +>super : A +>"x" : string +>f : () => void + + // destructuring assign with property access + ({ f: super.x } = { f }); +>({ f: super.x } = { f }) : { f: () => void; } +>{ f: super.x } = { f } : { f: () => void; } +>{ f: super.x } : { f: () => void; } +>f : () => void +>super.x : () => void +>super : A +>x : () => void +>{ f } : { f: () => void; } +>f : () => void + + // destructuring assign with element access + ({ f: super["x"] } = { f }); +>({ f: super["x"] } = { f }) : { f: () => void; } +>{ f: super["x"] } = { f } : { f: () => void; } +>{ f: super["x"] } : { f: () => void; } +>f : () => void +>super["x"] : () => void +>super : A +>"x" : string +>{ f } : { f: () => void; } +>f : () => void + } +} diff --git a/tests/baselines/reference/asyncMultiFile.js b/tests/baselines/reference/asyncMultiFile.js index e93dc586255..cbf3445ecc9 100644 --- a/tests/baselines/reference/asyncMultiFile.js +++ b/tests/baselines/reference/asyncMultiFile.js @@ -6,21 +6,16 @@ async function f() {} function g() { } //// [a.js] -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promise, generator) { - return new Promise(function (resolve, reject) { - generator = generator.call(thisArg, _arguments); - function cast(value) { return value instanceof Promise && value.constructor === Promise ? value : new Promise(function (resolve) { resolve(value); }); } - function onfulfill(value) { try { step("next", value); } catch (e) { reject(e); } } - function onreject(value) { try { step("throw", value); } catch (e) { reject(e); } } - function step(verb, value) { - var result = generator[verb](value); - result.done ? resolve(result.value) : cast(result.value).then(onfulfill, onreject); - } - step("next", void 0); +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator.throw(value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments)).next()); }); }; function f() { - return __awaiter(this, void 0, Promise, function* () { }); + return __awaiter(this, void 0, void 0, function* () { }); } //// [b.js] function g() { } diff --git a/tests/baselines/reference/asyncQualifiedReturnType_es6.errors.txt b/tests/baselines/reference/asyncQualifiedReturnType_es6.errors.txt new file mode 100644 index 00000000000..205ea016736 --- /dev/null +++ b/tests/baselines/reference/asyncQualifiedReturnType_es6.errors.txt @@ -0,0 +1,13 @@ +tests/cases/conformance/async/es6/asyncQualifiedReturnType_es6.ts(6,21): error TS1064: The return type of an async function or method must be the global Promise type. + + +==== tests/cases/conformance/async/es6/asyncQualifiedReturnType_es6.ts (1 errors) ==== + namespace X { + export class MyPromise extends Promise { + } + } + + async function f(): X.MyPromise { + ~~~~~~~~~~~~~~~~~ +!!! error TS1064: The return type of an async function or method must be the global Promise type. + } \ No newline at end of file diff --git a/tests/baselines/reference/asyncQualifiedReturnType_es6.js b/tests/baselines/reference/asyncQualifiedReturnType_es6.js index 1da37946254..4d5aa87bbff 100644 --- a/tests/baselines/reference/asyncQualifiedReturnType_es6.js +++ b/tests/baselines/reference/asyncQualifiedReturnType_es6.js @@ -15,6 +15,6 @@ var X; X.MyPromise = MyPromise; })(X || (X = {})); function f() { - return __awaiter(this, void 0, X.MyPromise, function* () { + return __awaiter(this, void 0, void 0, function* () { }); } diff --git a/tests/baselines/reference/asyncQualifiedReturnType_es6.symbols b/tests/baselines/reference/asyncQualifiedReturnType_es6.symbols deleted file mode 100644 index 5d27d04ea3b..00000000000 --- a/tests/baselines/reference/asyncQualifiedReturnType_es6.symbols +++ /dev/null @@ -1,17 +0,0 @@ -=== tests/cases/conformance/async/es6/asyncQualifiedReturnType_es6.ts === -namespace X { ->X : Symbol(X, Decl(asyncQualifiedReturnType_es6.ts, 0, 0)) - - export class MyPromise extends Promise { ->MyPromise : Symbol(MyPromise, Decl(asyncQualifiedReturnType_es6.ts, 0, 13)) ->T : Symbol(T, Decl(asyncQualifiedReturnType_es6.ts, 1, 27)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->T : Symbol(T, Decl(asyncQualifiedReturnType_es6.ts, 1, 27)) - } -} - -async function f(): X.MyPromise { ->f : Symbol(f, Decl(asyncQualifiedReturnType_es6.ts, 3, 1)) ->X : Symbol(X, Decl(asyncQualifiedReturnType_es6.ts, 0, 0)) ->MyPromise : Symbol(X.MyPromise, Decl(asyncQualifiedReturnType_es6.ts, 0, 13)) -} diff --git a/tests/baselines/reference/asyncQualifiedReturnType_es6.types b/tests/baselines/reference/asyncQualifiedReturnType_es6.types deleted file mode 100644 index 3b438eb93b6..00000000000 --- a/tests/baselines/reference/asyncQualifiedReturnType_es6.types +++ /dev/null @@ -1,17 +0,0 @@ -=== tests/cases/conformance/async/es6/asyncQualifiedReturnType_es6.ts === -namespace X { ->X : typeof X - - export class MyPromise extends Promise { ->MyPromise : MyPromise ->T : T ->Promise : Promise ->T : T - } -} - -async function f(): X.MyPromise { ->f : () => X.MyPromise ->X : any ->MyPromise : X.MyPromise -} diff --git a/tests/baselines/reference/asyncUnParenthesizedArrowFunction_es6.js b/tests/baselines/reference/asyncUnParenthesizedArrowFunction_es6.js new file mode 100644 index 00000000000..a4b097a8715 --- /dev/null +++ b/tests/baselines/reference/asyncUnParenthesizedArrowFunction_es6.js @@ -0,0 +1,9 @@ +//// [asyncUnParenthesizedArrowFunction_es6.ts] + +declare function someOtherFunction(i: any): Promise; +const x = async i => await someOtherFunction(i) +const x1 = async (i) => await someOtherFunction(i); + +//// [asyncUnParenthesizedArrowFunction_es6.js] +const x = (i) => __awaiter(this, void 0, void 0, function* () { return yield someOtherFunction(i); }); +const x1 = (i) => __awaiter(this, void 0, void 0, function* () { return yield someOtherFunction(i); }); diff --git a/tests/baselines/reference/asyncUnParenthesizedArrowFunction_es6.symbols b/tests/baselines/reference/asyncUnParenthesizedArrowFunction_es6.symbols new file mode 100644 index 00000000000..018c2399258 --- /dev/null +++ b/tests/baselines/reference/asyncUnParenthesizedArrowFunction_es6.symbols @@ -0,0 +1,19 @@ +=== tests/cases/conformance/async/es6/asyncArrowFunction/asyncUnParenthesizedArrowFunction_es6.ts === + +declare function someOtherFunction(i: any): Promise; +>someOtherFunction : Symbol(someOtherFunction, Decl(asyncUnParenthesizedArrowFunction_es6.ts, 0, 0)) +>i : Symbol(i, Decl(asyncUnParenthesizedArrowFunction_es6.ts, 1, 35)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) + +const x = async i => await someOtherFunction(i) +>x : Symbol(x, Decl(asyncUnParenthesizedArrowFunction_es6.ts, 2, 5)) +>i : Symbol(i, Decl(asyncUnParenthesizedArrowFunction_es6.ts, 2, 15)) +>someOtherFunction : Symbol(someOtherFunction, Decl(asyncUnParenthesizedArrowFunction_es6.ts, 0, 0)) +>i : Symbol(i, Decl(asyncUnParenthesizedArrowFunction_es6.ts, 2, 15)) + +const x1 = async (i) => await someOtherFunction(i); +>x1 : Symbol(x1, Decl(asyncUnParenthesizedArrowFunction_es6.ts, 3, 5)) +>i : Symbol(i, Decl(asyncUnParenthesizedArrowFunction_es6.ts, 3, 18)) +>someOtherFunction : Symbol(someOtherFunction, Decl(asyncUnParenthesizedArrowFunction_es6.ts, 0, 0)) +>i : Symbol(i, Decl(asyncUnParenthesizedArrowFunction_es6.ts, 3, 18)) + diff --git a/tests/baselines/reference/asyncUnParenthesizedArrowFunction_es6.types b/tests/baselines/reference/asyncUnParenthesizedArrowFunction_es6.types new file mode 100644 index 00000000000..d2cc97ce6c0 --- /dev/null +++ b/tests/baselines/reference/asyncUnParenthesizedArrowFunction_es6.types @@ -0,0 +1,25 @@ +=== tests/cases/conformance/async/es6/asyncArrowFunction/asyncUnParenthesizedArrowFunction_es6.ts === + +declare function someOtherFunction(i: any): Promise; +>someOtherFunction : (i: any) => Promise +>i : any +>Promise : Promise + +const x = async i => await someOtherFunction(i) +>x : (i: any) => Promise +>async i => await someOtherFunction(i) : (i: any) => Promise +>i : any +>await someOtherFunction(i) : void +>someOtherFunction(i) : Promise +>someOtherFunction : (i: any) => Promise +>i : any + +const x1 = async (i) => await someOtherFunction(i); +>x1 : (i: any) => Promise +>async (i) => await someOtherFunction(i) : (i: any) => Promise +>i : any +>await someOtherFunction(i) : void +>someOtherFunction(i) : Promise +>someOtherFunction : (i: any) => Promise +>i : any + diff --git a/tests/baselines/reference/augmentExportEquals1.errors.txt b/tests/baselines/reference/augmentExportEquals1.errors.txt new file mode 100644 index 00000000000..2d15e6d622a --- /dev/null +++ b/tests/baselines/reference/augmentExportEquals1.errors.txt @@ -0,0 +1,26 @@ +tests/cases/compiler/file2.ts(6,16): error TS2671: Cannot augment module './file1' because it resolves to a non-module entity. +tests/cases/compiler/file3.ts(3,8): error TS2503: Cannot find namespace 'x'. + + +==== tests/cases/compiler/file3.ts (1 errors) ==== + import x = require("./file1"); + import "./file2"; + let a: x.A; // should not work + ~ +!!! error TS2503: Cannot find namespace 'x'. +==== tests/cases/compiler/file1.ts (0 errors) ==== + var x = 1; + export = x; + +==== tests/cases/compiler/file2.ts (1 errors) ==== + + import x = require("./file1"); + + // augmentation for './file1' + // should error since './file1' does not have namespace meaning + declare module "./file1" { + ~~~~~~~~~ +!!! error TS2671: Cannot augment module './file1' because it resolves to a non-module entity. + interface A { a } + } + \ No newline at end of file diff --git a/tests/baselines/reference/augmentExportEquals1.js b/tests/baselines/reference/augmentExportEquals1.js new file mode 100644 index 00000000000..98322c01a34 --- /dev/null +++ b/tests/baselines/reference/augmentExportEquals1.js @@ -0,0 +1,36 @@ +//// [tests/cases/compiler/augmentExportEquals1.ts] //// + +//// [file1.ts] +var x = 1; +export = x; + +//// [file2.ts] + +import x = require("./file1"); + +// augmentation for './file1' +// should error since './file1' does not have namespace meaning +declare module "./file1" { + interface A { a } +} + +//// [file3.ts] +import x = require("./file1"); +import "./file2"; +let a: x.A; // should not work + +//// [file1.js] +define(["require", "exports"], function (require, exports) { + "use strict"; + var x = 1; + return x; +}); +//// [file2.js] +define(["require", "exports"], function (require, exports) { + "use strict"; +}); +//// [file3.js] +define(["require", "exports", "./file2"], function (require, exports) { + "use strict"; + var a; // should not work +}); diff --git a/tests/baselines/reference/augmentExportEquals1_1.errors.txt b/tests/baselines/reference/augmentExportEquals1_1.errors.txt new file mode 100644 index 00000000000..aa89aa0c1d3 --- /dev/null +++ b/tests/baselines/reference/augmentExportEquals1_1.errors.txt @@ -0,0 +1,29 @@ +tests/cases/compiler/file2.ts(6,16): error TS2671: Cannot augment module 'file1' because it resolves to a non-module entity. +tests/cases/compiler/file3.ts(3,8): error TS2503: Cannot find namespace 'x'. + + +==== tests/cases/compiler/file3.ts (1 errors) ==== + import x = require("file1"); + import "file2"; + let a: x.A; // should not work + ~ +!!! error TS2503: Cannot find namespace 'x'. +==== tests/cases/compiler/file1.d.ts (0 errors) ==== + + declare module "file1" { + var x: number; + export = x; + } + +==== tests/cases/compiler/file2.ts (1 errors) ==== + /// + import x = require("file1"); + + // augmentation for 'file1' + // should error since 'file1' does not have namespace meaning + declare module "file1" { + ~~~~~~~ +!!! error TS2671: Cannot augment module 'file1' because it resolves to a non-module entity. + interface A { a } + } + \ No newline at end of file diff --git a/tests/baselines/reference/augmentExportEquals1_1.js b/tests/baselines/reference/augmentExportEquals1_1.js new file mode 100644 index 00000000000..08f032ff33f --- /dev/null +++ b/tests/baselines/reference/augmentExportEquals1_1.js @@ -0,0 +1,33 @@ +//// [tests/cases/compiler/augmentExportEquals1_1.ts] //// + +//// [file1.d.ts] + +declare module "file1" { + var x: number; + export = x; +} + +//// [file2.ts] +/// +import x = require("file1"); + +// augmentation for 'file1' +// should error since 'file1' does not have namespace meaning +declare module "file1" { + interface A { a } +} + +//// [file3.ts] +import x = require("file1"); +import "file2"; +let a: x.A; // should not work + +//// [file2.js] +define(["require", "exports"], function (require, exports) { + "use strict"; +}); +//// [file3.js] +define(["require", "exports", "file2"], function (require, exports) { + "use strict"; + var a; // should not work +}); diff --git a/tests/baselines/reference/augmentExportEquals2.errors.txt b/tests/baselines/reference/augmentExportEquals2.errors.txt new file mode 100644 index 00000000000..b078a6623d7 --- /dev/null +++ b/tests/baselines/reference/augmentExportEquals2.errors.txt @@ -0,0 +1,25 @@ +tests/cases/compiler/file2.ts(4,16): error TS2671: Cannot augment module './file1' because it resolves to a non-module entity. +tests/cases/compiler/file3.ts(3,8): error TS2503: Cannot find namespace 'x'. + + +==== tests/cases/compiler/file3.ts (1 errors) ==== + import x = require("./file1"); + import "./file2"; + let a: x.A; // should not work + ~ +!!! error TS2503: Cannot find namespace 'x'. +==== tests/cases/compiler/file1.ts (0 errors) ==== + + function foo() {} + export = foo; + +==== tests/cases/compiler/file2.ts (1 errors) ==== + import x = require("./file1"); + + // should error since './file1' does not have namespace meaning + declare module "./file1" { + ~~~~~~~~~ +!!! error TS2671: Cannot augment module './file1' because it resolves to a non-module entity. + interface A { a } + } + \ No newline at end of file diff --git a/tests/baselines/reference/augmentExportEquals2.js b/tests/baselines/reference/augmentExportEquals2.js new file mode 100644 index 00000000000..fc373173e3c --- /dev/null +++ b/tests/baselines/reference/augmentExportEquals2.js @@ -0,0 +1,35 @@ +//// [tests/cases/compiler/augmentExportEquals2.ts] //// + +//// [file1.ts] + +function foo() {} +export = foo; + +//// [file2.ts] +import x = require("./file1"); + +// should error since './file1' does not have namespace meaning +declare module "./file1" { + interface A { a } +} + +//// [file3.ts] +import x = require("./file1"); +import "./file2"; +let a: x.A; // should not work + +//// [file1.js] +define(["require", "exports"], function (require, exports) { + "use strict"; + function foo() { } + return foo; +}); +//// [file2.js] +define(["require", "exports"], function (require, exports) { + "use strict"; +}); +//// [file3.js] +define(["require", "exports", "./file2"], function (require, exports) { + "use strict"; + var a; // should not work +}); diff --git a/tests/baselines/reference/augmentExportEquals2_1.errors.txt b/tests/baselines/reference/augmentExportEquals2_1.errors.txt new file mode 100644 index 00000000000..8e02f21176a --- /dev/null +++ b/tests/baselines/reference/augmentExportEquals2_1.errors.txt @@ -0,0 +1,29 @@ +tests/cases/compiler/file2.ts(6,16): error TS2671: Cannot augment module 'file1' because it resolves to a non-module entity. +tests/cases/compiler/file3.ts(3,8): error TS2503: Cannot find namespace 'x'. + + +==== tests/cases/compiler/file3.ts (1 errors) ==== + import x = require("file1"); + import "file2"; + let a: x.A; // should not work + ~ +!!! error TS2503: Cannot find namespace 'x'. +==== tests/cases/compiler/file1.d.ts (0 errors) ==== + + declare module "file1" { + function foo(): void; + export = foo; + } + +==== tests/cases/compiler/file2.ts (1 errors) ==== + + /// + import x = require("file1"); + + // should error since './file1' does not have namespace meaning + declare module "file1" { + ~~~~~~~ +!!! error TS2671: Cannot augment module 'file1' because it resolves to a non-module entity. + interface A { a } + } + \ No newline at end of file diff --git a/tests/baselines/reference/augmentExportEquals2_1.js b/tests/baselines/reference/augmentExportEquals2_1.js new file mode 100644 index 00000000000..9046157bb26 --- /dev/null +++ b/tests/baselines/reference/augmentExportEquals2_1.js @@ -0,0 +1,33 @@ +//// [tests/cases/compiler/augmentExportEquals2_1.ts] //// + +//// [file1.d.ts] + +declare module "file1" { + function foo(): void; + export = foo; +} + +//// [file2.ts] + +/// +import x = require("file1"); + +// should error since './file1' does not have namespace meaning +declare module "file1" { + interface A { a } +} + +//// [file3.ts] +import x = require("file1"); +import "file2"; +let a: x.A; // should not work + +//// [file2.js] +define(["require", "exports"], function (require, exports) { + "use strict"; +}); +//// [file3.js] +define(["require", "exports", "file2"], function (require, exports) { + "use strict"; + var a; // should not work +}); diff --git a/tests/baselines/reference/augmentExportEquals3.js b/tests/baselines/reference/augmentExportEquals3.js new file mode 100644 index 00000000000..82cfa5f2166 --- /dev/null +++ b/tests/baselines/reference/augmentExportEquals3.js @@ -0,0 +1,47 @@ +//// [tests/cases/compiler/augmentExportEquals3.ts] //// + +//// [file1.ts] + +function foo() {} +namespace foo { + export var v = 1; +} +export = foo; + +//// [file2.ts] +import x = require("./file1"); +x.b = 1; + +// OK - './file1' is a namespace +declare module "./file1" { + interface A { a } + let b: number; +} + +//// [file3.ts] +import * as x from "./file1"; +import "./file2"; +let a: x.A; +let b = x.b; + +//// [file1.js] +define(["require", "exports"], function (require, exports) { + "use strict"; + function foo() { } + var foo; + (function (foo) { + foo.v = 1; + })(foo || (foo = {})); + return foo; +}); +//// [file2.js] +define(["require", "exports", "./file1"], function (require, exports, x) { + "use strict"; + x.b = 1; +}); +//// [file3.js] +define(["require", "exports", "./file1", "./file2"], function (require, exports, x) { + "use strict"; + var a; + var b = x.b; +}); diff --git a/tests/baselines/reference/augmentExportEquals3.symbols b/tests/baselines/reference/augmentExportEquals3.symbols new file mode 100644 index 00000000000..c7338867021 --- /dev/null +++ b/tests/baselines/reference/augmentExportEquals3.symbols @@ -0,0 +1,49 @@ +=== tests/cases/compiler/file1.ts === + +function foo() {} +>foo : Symbol(, Decl(file1.ts, 0, 0), Decl(file1.ts, 1, 17), Decl(file2.ts, 1, 8)) + +namespace foo { +>foo : Symbol(, Decl(file1.ts, 0, 0), Decl(file1.ts, 1, 17), Decl(file2.ts, 1, 8)) + + export var v = 1; +>v : Symbol(v, Decl(file1.ts, 3, 14)) +} +export = foo; +>foo : Symbol(foo, Decl(file1.ts, 0, 0), Decl(file1.ts, 1, 17)) + +=== tests/cases/compiler/file2.ts === +import x = require("./file1"); +>x : Symbol(x, Decl(file2.ts, 0, 0)) + +x.b = 1; +>x.b : Symbol(x.b, Decl(file2.ts, 6, 7)) +>x : Symbol(x, Decl(file2.ts, 0, 0)) +>b : Symbol(x.b, Decl(file2.ts, 6, 7)) + +// OK - './file1' is a namespace +declare module "./file1" { + interface A { a } +>A : Symbol(A, Decl(file2.ts, 4, 26)) +>a : Symbol(A.a, Decl(file2.ts, 5, 17)) + + let b: number; +>b : Symbol(b, Decl(file2.ts, 6, 7)) +} + +=== tests/cases/compiler/file3.ts === +import * as x from "./file1"; +>x : Symbol(x, Decl(file3.ts, 0, 6)) + +import "./file2"; +let a: x.A; +>a : Symbol(a, Decl(file3.ts, 2, 3)) +>x : Symbol(x, Decl(file3.ts, 0, 6)) +>A : Symbol(x.A, Decl(file2.ts, 4, 26)) + +let b = x.b; +>b : Symbol(b, Decl(file3.ts, 3, 3)) +>x.b : Symbol(x.b, Decl(file2.ts, 6, 7)) +>x : Symbol(x, Decl(file3.ts, 0, 6)) +>b : Symbol(x.b, Decl(file2.ts, 6, 7)) + diff --git a/tests/baselines/reference/augmentExportEquals3.types b/tests/baselines/reference/augmentExportEquals3.types new file mode 100644 index 00000000000..4df7bbc60fa --- /dev/null +++ b/tests/baselines/reference/augmentExportEquals3.types @@ -0,0 +1,52 @@ +=== tests/cases/compiler/file1.ts === + +function foo() {} +>foo : typeof + +namespace foo { +>foo : typeof + + export var v = 1; +>v : number +>1 : number +} +export = foo; +>foo : typeof foo + +=== tests/cases/compiler/file2.ts === +import x = require("./file1"); +>x : typeof x + +x.b = 1; +>x.b = 1 : number +>x.b : number +>x : typeof x +>b : number +>1 : number + +// OK - './file1' is a namespace +declare module "./file1" { + interface A { a } +>A : A +>a : any + + let b: number; +>b : number +} + +=== tests/cases/compiler/file3.ts === +import * as x from "./file1"; +>x : typeof x + +import "./file2"; +let a: x.A; +>a : x.A +>x : any +>A : x.A + +let b = x.b; +>b : number +>x.b : number +>x : typeof x +>b : number + diff --git a/tests/baselines/reference/augmentExportEquals3_1.js b/tests/baselines/reference/augmentExportEquals3_1.js new file mode 100644 index 00000000000..fc6b7b1cec3 --- /dev/null +++ b/tests/baselines/reference/augmentExportEquals3_1.js @@ -0,0 +1,40 @@ +//// [tests/cases/compiler/augmentExportEquals3_1.ts] //// + +//// [file1.d.ts] +declare module "file1" { + function foo(): void; + namespace foo { + export var v: number; + } + export = foo; +} + + +//// [file2.ts] +/// +import x = require("file1"); +x.b = 1; + +// OK - './file1' is a namespace +declare module "file1" { + interface A { a } + let b: number; +} + +//// [file3.ts] +import * as x from "file1"; +import "file2"; +let a: x.A; +let b = x.b; + +//// [file2.js] +define(["require", "exports", "file1"], function (require, exports, x) { + "use strict"; + x.b = 1; +}); +//// [file3.js] +define(["require", "exports", "file1", "file2"], function (require, exports, x) { + "use strict"; + var a; + var b = x.b; +}); diff --git a/tests/baselines/reference/augmentExportEquals3_1.symbols b/tests/baselines/reference/augmentExportEquals3_1.symbols new file mode 100644 index 00000000000..09827aaa094 --- /dev/null +++ b/tests/baselines/reference/augmentExportEquals3_1.symbols @@ -0,0 +1,52 @@ +=== tests/cases/compiler/file1.d.ts === +declare module "file1" { + function foo(): void; +>foo : Symbol(, Decl(file1.d.ts, 0, 24), Decl(file1.d.ts, 1, 25), Decl(file2.ts, 2, 8)) + + namespace foo { +>foo : Symbol(, Decl(file1.d.ts, 0, 24), Decl(file1.d.ts, 1, 25), Decl(file2.ts, 2, 8)) + + export var v: number; +>v : Symbol(v, Decl(file1.d.ts, 3, 18)) + } + export = foo; +>foo : Symbol(foo, Decl(file1.d.ts, 0, 24), Decl(file1.d.ts, 1, 25)) +} + + +=== tests/cases/compiler/file2.ts === +/// +import x = require("file1"); +>x : Symbol(x, Decl(file2.ts, 0, 0)) + +x.b = 1; +>x.b : Symbol(x.b, Decl(file2.ts, 7, 7)) +>x : Symbol(x, Decl(file2.ts, 0, 0)) +>b : Symbol(x.b, Decl(file2.ts, 7, 7)) + +// OK - './file1' is a namespace +declare module "file1" { + interface A { a } +>A : Symbol(A, Decl(file2.ts, 5, 24)) +>a : Symbol(A.a, Decl(file2.ts, 6, 17)) + + let b: number; +>b : Symbol(b, Decl(file2.ts, 7, 7)) +} + +=== tests/cases/compiler/file3.ts === +import * as x from "file1"; +>x : Symbol(x, Decl(file3.ts, 0, 6)) + +import "file2"; +let a: x.A; +>a : Symbol(a, Decl(file3.ts, 2, 3)) +>x : Symbol(x, Decl(file3.ts, 0, 6)) +>A : Symbol(x.A, Decl(file2.ts, 5, 24)) + +let b = x.b; +>b : Symbol(b, Decl(file3.ts, 3, 3)) +>x.b : Symbol(x.b, Decl(file2.ts, 7, 7)) +>x : Symbol(x, Decl(file3.ts, 0, 6)) +>b : Symbol(x.b, Decl(file2.ts, 7, 7)) + diff --git a/tests/baselines/reference/augmentExportEquals3_1.types b/tests/baselines/reference/augmentExportEquals3_1.types new file mode 100644 index 00000000000..8a70a6ec0a6 --- /dev/null +++ b/tests/baselines/reference/augmentExportEquals3_1.types @@ -0,0 +1,54 @@ +=== tests/cases/compiler/file1.d.ts === +declare module "file1" { + function foo(): void; +>foo : typeof + + namespace foo { +>foo : typeof + + export var v: number; +>v : number + } + export = foo; +>foo : typeof foo +} + + +=== tests/cases/compiler/file2.ts === +/// +import x = require("file1"); +>x : typeof x + +x.b = 1; +>x.b = 1 : number +>x.b : number +>x : typeof x +>b : number +>1 : number + +// OK - './file1' is a namespace +declare module "file1" { + interface A { a } +>A : A +>a : any + + let b: number; +>b : number +} + +=== tests/cases/compiler/file3.ts === +import * as x from "file1"; +>x : typeof x + +import "file2"; +let a: x.A; +>a : x.A +>x : any +>A : x.A + +let b = x.b; +>b : number +>x.b : number +>x : typeof x +>b : number + diff --git a/tests/baselines/reference/augmentExportEquals4.js b/tests/baselines/reference/augmentExportEquals4.js new file mode 100644 index 00000000000..ee0fc1892c2 --- /dev/null +++ b/tests/baselines/reference/augmentExportEquals4.js @@ -0,0 +1,51 @@ +//// [tests/cases/compiler/augmentExportEquals4.ts] //// + +//// [file1.ts] + +class foo {} +namespace foo { + export var v = 1; +} +export = foo; + +//// [file2.ts] +import x = require("./file1"); +x.b = 1; + +// OK - './file1' is a namespace +declare module "./file1" { + interface A { a } + let b: number; +} + +//// [file3.ts] +import * as x from "./file1"; +import "./file2"; +let a: x.A; +let b = x.b; + +//// [file1.js] +define(["require", "exports"], function (require, exports) { + "use strict"; + var foo = (function () { + function foo() { + } + return foo; + }()); + var foo; + (function (foo) { + foo.v = 1; + })(foo || (foo = {})); + return foo; +}); +//// [file2.js] +define(["require", "exports", "./file1"], function (require, exports, x) { + "use strict"; + x.b = 1; +}); +//// [file3.js] +define(["require", "exports", "./file1", "./file2"], function (require, exports, x) { + "use strict"; + var a; + var b = x.b; +}); diff --git a/tests/baselines/reference/augmentExportEquals4.symbols b/tests/baselines/reference/augmentExportEquals4.symbols new file mode 100644 index 00000000000..94941693bae --- /dev/null +++ b/tests/baselines/reference/augmentExportEquals4.symbols @@ -0,0 +1,49 @@ +=== tests/cases/compiler/file1.ts === + +class foo {} +>foo : Symbol(, Decl(file1.ts, 0, 0), Decl(file1.ts, 1, 12), Decl(file2.ts, 1, 8)) + +namespace foo { +>foo : Symbol(, Decl(file1.ts, 0, 0), Decl(file1.ts, 1, 12), Decl(file2.ts, 1, 8)) + + export var v = 1; +>v : Symbol(v, Decl(file1.ts, 3, 14)) +} +export = foo; +>foo : Symbol(foo, Decl(file1.ts, 0, 0), Decl(file1.ts, 1, 12)) + +=== tests/cases/compiler/file2.ts === +import x = require("./file1"); +>x : Symbol(x, Decl(file2.ts, 0, 0)) + +x.b = 1; +>x.b : Symbol(x.b, Decl(file2.ts, 6, 7)) +>x : Symbol(x, Decl(file2.ts, 0, 0)) +>b : Symbol(x.b, Decl(file2.ts, 6, 7)) + +// OK - './file1' is a namespace +declare module "./file1" { + interface A { a } +>A : Symbol(A, Decl(file2.ts, 4, 26)) +>a : Symbol(A.a, Decl(file2.ts, 5, 17)) + + let b: number; +>b : Symbol(b, Decl(file2.ts, 6, 7)) +} + +=== tests/cases/compiler/file3.ts === +import * as x from "./file1"; +>x : Symbol(x, Decl(file3.ts, 0, 6)) + +import "./file2"; +let a: x.A; +>a : Symbol(a, Decl(file3.ts, 2, 3)) +>x : Symbol(x, Decl(file3.ts, 0, 6)) +>A : Symbol(x.A, Decl(file2.ts, 4, 26)) + +let b = x.b; +>b : Symbol(b, Decl(file3.ts, 3, 3)) +>x.b : Symbol(x.b, Decl(file2.ts, 6, 7)) +>x : Symbol(x, Decl(file3.ts, 0, 6)) +>b : Symbol(x.b, Decl(file2.ts, 6, 7)) + diff --git a/tests/baselines/reference/augmentExportEquals4.types b/tests/baselines/reference/augmentExportEquals4.types new file mode 100644 index 00000000000..3d25ae2decb --- /dev/null +++ b/tests/baselines/reference/augmentExportEquals4.types @@ -0,0 +1,52 @@ +=== tests/cases/compiler/file1.ts === + +class foo {} +>foo : + +namespace foo { +>foo : typeof + + export var v = 1; +>v : number +>1 : number +} +export = foo; +>foo : foo + +=== tests/cases/compiler/file2.ts === +import x = require("./file1"); +>x : typeof x + +x.b = 1; +>x.b = 1 : number +>x.b : number +>x : typeof x +>b : number +>1 : number + +// OK - './file1' is a namespace +declare module "./file1" { + interface A { a } +>A : A +>a : any + + let b: number; +>b : number +} + +=== tests/cases/compiler/file3.ts === +import * as x from "./file1"; +>x : typeof x + +import "./file2"; +let a: x.A; +>a : x.A +>x : any +>A : x.A + +let b = x.b; +>b : number +>x.b : number +>x : typeof x +>b : number + diff --git a/tests/baselines/reference/augmentExportEquals4_1.js b/tests/baselines/reference/augmentExportEquals4_1.js new file mode 100644 index 00000000000..b4ba932d44b --- /dev/null +++ b/tests/baselines/reference/augmentExportEquals4_1.js @@ -0,0 +1,41 @@ +//// [tests/cases/compiler/augmentExportEquals4_1.ts] //// + +//// [file1.d.ts] + +declare module "file1" { + class foo {} + namespace foo { + export var v: number; + } + export = foo; +} + + +//// [file2.ts] +/// +import x = require("file1"); +x.b = 1; + +// OK - './file1' is a namespace +declare module "file1" { + interface A { a } + let b: number; +} + +//// [file3.ts] +import * as x from "file1"; +import "file2"; +let a: x.A; +let b = x.b; + +//// [file2.js] +define(["require", "exports", "file1"], function (require, exports, x) { + "use strict"; + x.b = 1; +}); +//// [file3.js] +define(["require", "exports", "file1", "file2"], function (require, exports, x) { + "use strict"; + var a; + var b = x.b; +}); diff --git a/tests/baselines/reference/augmentExportEquals4_1.symbols b/tests/baselines/reference/augmentExportEquals4_1.symbols new file mode 100644 index 00000000000..5c4aadbdf83 --- /dev/null +++ b/tests/baselines/reference/augmentExportEquals4_1.symbols @@ -0,0 +1,53 @@ +=== tests/cases/compiler/file1.d.ts === + +declare module "file1" { + class foo {} +>foo : Symbol(, Decl(file1.d.ts, 1, 24), Decl(file1.d.ts, 2, 16), Decl(file2.ts, 2, 8)) + + namespace foo { +>foo : Symbol(, Decl(file1.d.ts, 1, 24), Decl(file1.d.ts, 2, 16), Decl(file2.ts, 2, 8)) + + export var v: number; +>v : Symbol(v, Decl(file1.d.ts, 4, 18)) + } + export = foo; +>foo : Symbol(foo, Decl(file1.d.ts, 1, 24), Decl(file1.d.ts, 2, 16)) +} + + +=== tests/cases/compiler/file2.ts === +/// +import x = require("file1"); +>x : Symbol(x, Decl(file2.ts, 0, 0)) + +x.b = 1; +>x.b : Symbol(x.b, Decl(file2.ts, 7, 7)) +>x : Symbol(x, Decl(file2.ts, 0, 0)) +>b : Symbol(x.b, Decl(file2.ts, 7, 7)) + +// OK - './file1' is a namespace +declare module "file1" { + interface A { a } +>A : Symbol(A, Decl(file2.ts, 5, 24)) +>a : Symbol(A.a, Decl(file2.ts, 6, 17)) + + let b: number; +>b : Symbol(b, Decl(file2.ts, 7, 7)) +} + +=== tests/cases/compiler/file3.ts === +import * as x from "file1"; +>x : Symbol(x, Decl(file3.ts, 0, 6)) + +import "file2"; +let a: x.A; +>a : Symbol(a, Decl(file3.ts, 2, 3)) +>x : Symbol(x, Decl(file3.ts, 0, 6)) +>A : Symbol(x.A, Decl(file2.ts, 5, 24)) + +let b = x.b; +>b : Symbol(b, Decl(file3.ts, 3, 3)) +>x.b : Symbol(x.b, Decl(file2.ts, 7, 7)) +>x : Symbol(x, Decl(file3.ts, 0, 6)) +>b : Symbol(x.b, Decl(file2.ts, 7, 7)) + diff --git a/tests/baselines/reference/augmentExportEquals4_1.types b/tests/baselines/reference/augmentExportEquals4_1.types new file mode 100644 index 00000000000..9f219286000 --- /dev/null +++ b/tests/baselines/reference/augmentExportEquals4_1.types @@ -0,0 +1,55 @@ +=== tests/cases/compiler/file1.d.ts === + +declare module "file1" { + class foo {} +>foo : + + namespace foo { +>foo : typeof + + export var v: number; +>v : number + } + export = foo; +>foo : foo +} + + +=== tests/cases/compiler/file2.ts === +/// +import x = require("file1"); +>x : typeof x + +x.b = 1; +>x.b = 1 : number +>x.b : number +>x : typeof x +>b : number +>1 : number + +// OK - './file1' is a namespace +declare module "file1" { + interface A { a } +>A : A +>a : any + + let b: number; +>b : number +} + +=== tests/cases/compiler/file3.ts === +import * as x from "file1"; +>x : typeof x + +import "file2"; +let a: x.A; +>a : x.A +>x : any +>A : x.A + +let b = x.b; +>b : number +>x.b : number +>x : typeof x +>b : number + diff --git a/tests/baselines/reference/augmentExportEquals5.js b/tests/baselines/reference/augmentExportEquals5.js new file mode 100644 index 00000000000..49b6c3fed56 --- /dev/null +++ b/tests/baselines/reference/augmentExportEquals5.js @@ -0,0 +1,94 @@ +//// [tests/cases/compiler/augmentExportEquals5.ts] //// + +//// [express.d.ts] + + +declare module Express { + export interface Request { } + export interface Response { } + export interface Application { } +} + +declare module "express" { + function e(): e.Express; + namespace e { + interface IRoute { + all(...handler: RequestHandler[]): IRoute; + } + + interface IRouterMatcher { + (name: string|RegExp, ...handlers: RequestHandler[]): T; + } + + interface IRouter extends RequestHandler { + route(path: string): IRoute; + } + + export function Router(options?: any): Router; + + export interface Router extends IRouter {} + + interface Errback { (err: Error): void; } + + interface Request extends Express.Request { + + get (name: string): string; + } + + interface Response extends Express.Response { + charset: string; + } + + interface ErrorRequestHandler { + (err: any, req: Request, res: Response, next: Function): any; + } + + interface RequestHandler { + (req: Request, res: Response, next: Function): any; + } + + interface Handler extends RequestHandler {} + + interface RequestParamHandler { + (req: Request, res: Response, next: Function, param: any): any; + } + + interface Application extends IRouter, Express.Application { + routes: any; + } + + interface Express extends Application { + createApplication(): Application; + } + + var static: any; + } + + export = e; +} + +//// [augmentation.ts] +/// +import * as e from "express"; +declare module "express" { + interface Request { + id: number; + } +} + +//// [consumer.ts] +import { Request } from "express"; +import "./augmentation"; +let x: Request; +const y = x.id; + +//// [augmentation.js] +define(["require", "exports"], function (require, exports) { + "use strict"; +}); +//// [consumer.js] +define(["require", "exports", "./augmentation"], function (require, exports) { + "use strict"; + var x; + var y = x.id; +}); diff --git a/tests/baselines/reference/augmentExportEquals5.symbols b/tests/baselines/reference/augmentExportEquals5.symbols new file mode 100644 index 00000000000..37fa00bd8cc --- /dev/null +++ b/tests/baselines/reference/augmentExportEquals5.symbols @@ -0,0 +1,194 @@ +=== tests/cases/compiler/express.d.ts === + + +declare module Express { +>Express : Symbol(Express, Decl(express.d.ts, 0, 0)) + + export interface Request { } +>Request : Symbol(Request, Decl(express.d.ts, 2, 24)) + + export interface Response { } +>Response : Symbol(Response, Decl(express.d.ts, 3, 32)) + + export interface Application { } +>Application : Symbol(Application, Decl(express.d.ts, 4, 33)) +} + +declare module "express" { + function e(): e.Express; +>e : Symbol(, Decl(express.d.ts, 8, 26), Decl(express.d.ts, 9, 28), Decl(augmentation.ts, 1, 29)) +>e : Symbol(e, Decl(express.d.ts, 8, 26), Decl(express.d.ts, 9, 28)) +>Express : Symbol(Express, Decl(express.d.ts, 54, 9)) + + namespace e { +>e : Symbol(, Decl(express.d.ts, 8, 26), Decl(express.d.ts, 9, 28), Decl(augmentation.ts, 1, 29)) + + interface IRoute { +>IRoute : Symbol(IRoute, Decl(express.d.ts, 10, 17)) + + all(...handler: RequestHandler[]): IRoute; +>all : Symbol(IRoute.all, Decl(express.d.ts, 11, 26)) +>handler : Symbol(handler, Decl(express.d.ts, 12, 16)) +>RequestHandler : Symbol(RequestHandler, Decl(express.d.ts, 40, 9)) +>IRoute : Symbol(IRoute, Decl(express.d.ts, 10, 17)) + } + + interface IRouterMatcher { +>IRouterMatcher : Symbol(IRouterMatcher, Decl(express.d.ts, 13, 9)) +>T : Symbol(T, Decl(express.d.ts, 15, 33)) + + (name: string|RegExp, ...handlers: RequestHandler[]): T; +>name : Symbol(name, Decl(express.d.ts, 16, 13)) +>RegExp : Symbol(RegExp, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>handlers : Symbol(handlers, Decl(express.d.ts, 16, 33)) +>RequestHandler : Symbol(RequestHandler, Decl(express.d.ts, 40, 9)) +>T : Symbol(T, Decl(express.d.ts, 15, 33)) + } + + interface IRouter extends RequestHandler { +>IRouter : Symbol(IRouter, Decl(express.d.ts, 17, 9)) +>T : Symbol(T, Decl(express.d.ts, 19, 26)) +>RequestHandler : Symbol(RequestHandler, Decl(express.d.ts, 40, 9)) + + route(path: string): IRoute; +>route : Symbol(IRouter.route, Decl(express.d.ts, 19, 53)) +>path : Symbol(path, Decl(express.d.ts, 20, 18)) +>IRoute : Symbol(IRoute, Decl(express.d.ts, 10, 17)) + } + + export function Router(options?: any): Router; +>Router : Symbol(Router, Decl(express.d.ts, 21, 9), Decl(express.d.ts, 23, 54)) +>options : Symbol(options, Decl(express.d.ts, 23, 31)) +>Router : Symbol(Router, Decl(express.d.ts, 21, 9), Decl(express.d.ts, 23, 54)) + + export interface Router extends IRouter {} +>Router : Symbol(Router, Decl(express.d.ts, 21, 9), Decl(express.d.ts, 23, 54)) +>IRouter : Symbol(IRouter, Decl(express.d.ts, 17, 9)) +>Router : Symbol(Router, Decl(express.d.ts, 21, 9), Decl(express.d.ts, 23, 54)) + + interface Errback { (err: Error): void; } +>Errback : Symbol(Errback, Decl(express.d.ts, 25, 58)) +>err : Symbol(err, Decl(express.d.ts, 27, 29)) +>Error : Symbol(Error, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) + + interface Request extends Express.Request { +>Request : Symbol(Request, Decl(express.d.ts, 27, 49), Decl(augmentation.ts, 2, 26)) +>Express.Request : Symbol(Express.Request, Decl(express.d.ts, 2, 24)) +>Express : Symbol(Express, Decl(express.d.ts, 0, 0)) +>Request : Symbol(Express.Request, Decl(express.d.ts, 2, 24)) + + get (name: string): string; +>get : Symbol(Request.get, Decl(express.d.ts, 29, 51)) +>name : Symbol(name, Decl(express.d.ts, 31, 17)) + } + + interface Response extends Express.Response { +>Response : Symbol(Response, Decl(express.d.ts, 32, 9)) +>Express.Response : Symbol(Express.Response, Decl(express.d.ts, 3, 32)) +>Express : Symbol(Express, Decl(express.d.ts, 0, 0)) +>Response : Symbol(Express.Response, Decl(express.d.ts, 3, 32)) + + charset: string; +>charset : Symbol(Response.charset, Decl(express.d.ts, 34, 53)) + } + + interface ErrorRequestHandler { +>ErrorRequestHandler : Symbol(ErrorRequestHandler, Decl(express.d.ts, 36, 9)) + + (err: any, req: Request, res: Response, next: Function): any; +>err : Symbol(err, Decl(express.d.ts, 39, 13)) +>req : Symbol(req, Decl(express.d.ts, 39, 22)) +>Request : Symbol(Request, Decl(express.d.ts, 27, 49), Decl(augmentation.ts, 2, 26)) +>res : Symbol(res, Decl(express.d.ts, 39, 36)) +>Response : Symbol(Response, Decl(express.d.ts, 32, 9)) +>next : Symbol(next, Decl(express.d.ts, 39, 51)) +>Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) + } + + interface RequestHandler { +>RequestHandler : Symbol(RequestHandler, Decl(express.d.ts, 40, 9)) + + (req: Request, res: Response, next: Function): any; +>req : Symbol(req, Decl(express.d.ts, 43, 13)) +>Request : Symbol(Request, Decl(express.d.ts, 27, 49), Decl(augmentation.ts, 2, 26)) +>res : Symbol(res, Decl(express.d.ts, 43, 26)) +>Response : Symbol(Response, Decl(express.d.ts, 32, 9)) +>next : Symbol(next, Decl(express.d.ts, 43, 41)) +>Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) + } + + interface Handler extends RequestHandler {} +>Handler : Symbol(Handler, Decl(express.d.ts, 44, 9)) +>RequestHandler : Symbol(RequestHandler, Decl(express.d.ts, 40, 9)) + + interface RequestParamHandler { +>RequestParamHandler : Symbol(RequestParamHandler, Decl(express.d.ts, 46, 51)) + + (req: Request, res: Response, next: Function, param: any): any; +>req : Symbol(req, Decl(express.d.ts, 49, 13)) +>Request : Symbol(Request, Decl(express.d.ts, 27, 49), Decl(augmentation.ts, 2, 26)) +>res : Symbol(res, Decl(express.d.ts, 49, 26)) +>Response : Symbol(Response, Decl(express.d.ts, 32, 9)) +>next : Symbol(next, Decl(express.d.ts, 49, 41)) +>Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>param : Symbol(param, Decl(express.d.ts, 49, 57)) + } + + interface Application extends IRouter, Express.Application { +>Application : Symbol(Application, Decl(express.d.ts, 50, 9)) +>IRouter : Symbol(IRouter, Decl(express.d.ts, 17, 9)) +>Application : Symbol(Application, Decl(express.d.ts, 50, 9)) +>Express.Application : Symbol(Express.Application, Decl(express.d.ts, 4, 33)) +>Express : Symbol(Express, Decl(express.d.ts, 0, 0)) +>Application : Symbol(Express.Application, Decl(express.d.ts, 4, 33)) + + routes: any; +>routes : Symbol(Application.routes, Decl(express.d.ts, 52, 81)) + } + + interface Express extends Application { +>Express : Symbol(Express, Decl(express.d.ts, 54, 9)) +>Application : Symbol(Application, Decl(express.d.ts, 50, 9)) + + createApplication(): Application; +>createApplication : Symbol(Express.createApplication, Decl(express.d.ts, 56, 47)) +>Application : Symbol(Application, Decl(express.d.ts, 50, 9)) + } + + var static: any; +>static : Symbol(static, Decl(express.d.ts, 60, 11)) + } + + export = e; +>e : Symbol(e, Decl(express.d.ts, 8, 26), Decl(express.d.ts, 9, 28)) +} + +=== tests/cases/compiler/augmentation.ts === +/// +import * as e from "express"; +>e : Symbol(e, Decl(augmentation.ts, 1, 6)) + +declare module "express" { + interface Request { +>Request : Symbol(Request, Decl(express.d.ts, 27, 49), Decl(augmentation.ts, 2, 26)) + + id: number; +>id : Symbol(Request.id, Decl(augmentation.ts, 3, 23)) + } +} + +=== tests/cases/compiler/consumer.ts === +import { Request } from "express"; +>Request : Symbol(Request, Decl(consumer.ts, 0, 8)) + +import "./augmentation"; +let x: Request; +>x : Symbol(x, Decl(consumer.ts, 2, 3)) +>Request : Symbol(Request, Decl(consumer.ts, 0, 8)) + +const y = x.id; +>y : Symbol(y, Decl(consumer.ts, 3, 5)) +>x.id : Symbol(Request.id, Decl(augmentation.ts, 3, 23)) +>x : Symbol(x, Decl(consumer.ts, 2, 3)) +>id : Symbol(Request.id, Decl(augmentation.ts, 3, 23)) + diff --git a/tests/baselines/reference/augmentExportEquals5.types b/tests/baselines/reference/augmentExportEquals5.types new file mode 100644 index 00000000000..42b79674dfd --- /dev/null +++ b/tests/baselines/reference/augmentExportEquals5.types @@ -0,0 +1,194 @@ +=== tests/cases/compiler/express.d.ts === + + +declare module Express { +>Express : any + + export interface Request { } +>Request : Request + + export interface Response { } +>Response : Response + + export interface Application { } +>Application : Application +} + +declare module "express" { + function e(): e.Express; +>e : typeof +>e : any +>Express : Express + + namespace e { +>e : typeof + + interface IRoute { +>IRoute : IRoute + + all(...handler: RequestHandler[]): IRoute; +>all : (...handler: RequestHandler[]) => IRoute +>handler : RequestHandler[] +>RequestHandler : RequestHandler +>IRoute : IRoute + } + + interface IRouterMatcher { +>IRouterMatcher : IRouterMatcher +>T : T + + (name: string|RegExp, ...handlers: RequestHandler[]): T; +>name : string | RegExp +>RegExp : RegExp +>handlers : RequestHandler[] +>RequestHandler : RequestHandler +>T : T + } + + interface IRouter extends RequestHandler { +>IRouter : IRouter +>T : T +>RequestHandler : RequestHandler + + route(path: string): IRoute; +>route : (path: string) => IRoute +>path : string +>IRoute : IRoute + } + + export function Router(options?: any): Router; +>Router : (options?: any) => Router +>options : any +>Router : Router + + export interface Router extends IRouter {} +>Router : Router +>IRouter : IRouter +>Router : Router + + interface Errback { (err: Error): void; } +>Errback : Errback +>err : Error +>Error : Error + + interface Request extends Express.Request { +>Request : Request +>Express.Request : any +>Express : any +>Request : Express.Request + + get (name: string): string; +>get : (name: string) => string +>name : string + } + + interface Response extends Express.Response { +>Response : Response +>Express.Response : any +>Express : any +>Response : Express.Response + + charset: string; +>charset : string + } + + interface ErrorRequestHandler { +>ErrorRequestHandler : ErrorRequestHandler + + (err: any, req: Request, res: Response, next: Function): any; +>err : any +>req : Request +>Request : Request +>res : Response +>Response : Response +>next : Function +>Function : Function + } + + interface RequestHandler { +>RequestHandler : RequestHandler + + (req: Request, res: Response, next: Function): any; +>req : Request +>Request : Request +>res : Response +>Response : Response +>next : Function +>Function : Function + } + + interface Handler extends RequestHandler {} +>Handler : Handler +>RequestHandler : RequestHandler + + interface RequestParamHandler { +>RequestParamHandler : RequestParamHandler + + (req: Request, res: Response, next: Function, param: any): any; +>req : Request +>Request : Request +>res : Response +>Response : Response +>next : Function +>Function : Function +>param : any + } + + interface Application extends IRouter, Express.Application { +>Application : Application +>IRouter : IRouter +>Application : Application +>Express.Application : any +>Express : any +>Application : Express.Application + + routes: any; +>routes : any + } + + interface Express extends Application { +>Express : Express +>Application : Application + + createApplication(): Application; +>createApplication : () => Application +>Application : Application + } + + var static: any; +>static : any + } + + export = e; +>e : typeof e +} + +=== tests/cases/compiler/augmentation.ts === +/// +import * as e from "express"; +>e : typeof e + +declare module "express" { + interface Request { +>Request : Request + + id: number; +>id : number + } +} + +=== tests/cases/compiler/consumer.ts === +import { Request } from "express"; +>Request : any + +import "./augmentation"; +let x: Request; +>x : Request +>Request : Request + +const y = x.id; +>y : number +>x.id : number +>x : Request +>id : number + diff --git a/tests/baselines/reference/augmentExportEquals6.js b/tests/baselines/reference/augmentExportEquals6.js new file mode 100644 index 00000000000..94dfa389c6d --- /dev/null +++ b/tests/baselines/reference/augmentExportEquals6.js @@ -0,0 +1,64 @@ +//// [tests/cases/compiler/augmentExportEquals6.ts] //// + +//// [file1.ts] + +class foo {} +namespace foo { + export class A {} + export namespace B { export let a; } +} +export = foo; + +//// [file2.ts] +import x = require("./file1"); +x.B.b = 1; + +// OK - './file1' is a namespace +declare module "./file1" { + interface A { a: number } + namespace B { + export let b: number; + } +} + +//// [file3.ts] +import * as x from "./file1"; +import "./file2"; +let a: x.A; +let b = a.a; +let c = x.B.b; + +//// [file1.js] +define(["require", "exports"], function (require, exports) { + "use strict"; + var foo = (function () { + function foo() { + } + return foo; + }()); + var foo; + (function (foo) { + var A = (function () { + function A() { + } + return A; + }()); + foo.A = A; + var B; + (function (B) { + })(B = foo.B || (foo.B = {})); + })(foo || (foo = {})); + return foo; +}); +//// [file2.js] +define(["require", "exports", "./file1"], function (require, exports, x) { + "use strict"; + x.B.b = 1; +}); +//// [file3.js] +define(["require", "exports", "./file1", "./file2"], function (require, exports, x) { + "use strict"; + var a; + var b = a.a; + var c = x.B.b; +}); diff --git a/tests/baselines/reference/augmentExportEquals6.symbols b/tests/baselines/reference/augmentExportEquals6.symbols new file mode 100644 index 00000000000..4af820f24d7 --- /dev/null +++ b/tests/baselines/reference/augmentExportEquals6.symbols @@ -0,0 +1,67 @@ +=== tests/cases/compiler/file1.ts === + +class foo {} +>foo : Symbol(, Decl(file1.ts, 0, 0), Decl(file1.ts, 1, 12), Decl(file2.ts, 1, 10)) + +namespace foo { +>foo : Symbol(, Decl(file1.ts, 0, 0), Decl(file1.ts, 1, 12), Decl(file2.ts, 1, 10)) + + export class A {} +>A : Symbol(A, Decl(file1.ts, 2, 15), Decl(file2.ts, 4, 26)) + + export namespace B { export let a; } +>B : Symbol(B, Decl(file1.ts, 3, 21), Decl(file2.ts, 5, 29)) +>a : Symbol(a, Decl(file1.ts, 4, 35)) +} +export = foo; +>foo : Symbol(foo, Decl(file1.ts, 0, 0), Decl(file1.ts, 1, 12)) + +=== tests/cases/compiler/file2.ts === +import x = require("./file1"); +>x : Symbol(x, Decl(file2.ts, 0, 0)) + +x.B.b = 1; +>x.B.b : Symbol(x.B.b, Decl(file2.ts, 7, 18)) +>x.B : Symbol(x.B, Decl(file1.ts, 3, 21), Decl(file2.ts, 5, 29)) +>x : Symbol(x, Decl(file2.ts, 0, 0)) +>B : Symbol(x.B, Decl(file1.ts, 3, 21), Decl(file2.ts, 5, 29)) +>b : Symbol(x.B.b, Decl(file2.ts, 7, 18)) + +// OK - './file1' is a namespace +declare module "./file1" { + interface A { a: number } +>A : Symbol(A, Decl(file1.ts, 2, 15), Decl(file2.ts, 4, 26)) +>a : Symbol(A.a, Decl(file2.ts, 5, 17)) + + namespace B { +>B : Symbol(B, Decl(file1.ts, 3, 21), Decl(file2.ts, 5, 29)) + + export let b: number; +>b : Symbol(b, Decl(file2.ts, 7, 18)) + } +} + +=== tests/cases/compiler/file3.ts === +import * as x from "./file1"; +>x : Symbol(x, Decl(file3.ts, 0, 6)) + +import "./file2"; +let a: x.A; +>a : Symbol(a, Decl(file3.ts, 2, 3)) +>x : Symbol(x, Decl(file3.ts, 0, 6)) +>A : Symbol(x.A, Decl(file1.ts, 2, 15), Decl(file2.ts, 4, 26)) + +let b = a.a; +>b : Symbol(b, Decl(file3.ts, 3, 3)) +>a.a : Symbol(x.A.a, Decl(file2.ts, 5, 17)) +>a : Symbol(a, Decl(file3.ts, 2, 3)) +>a : Symbol(x.A.a, Decl(file2.ts, 5, 17)) + +let c = x.B.b; +>c : Symbol(c, Decl(file3.ts, 4, 3)) +>x.B.b : Symbol(x.B.b, Decl(file2.ts, 7, 18)) +>x.B : Symbol(x.B, Decl(file1.ts, 3, 21), Decl(file2.ts, 5, 29)) +>x : Symbol(x, Decl(file3.ts, 0, 6)) +>B : Symbol(x.B, Decl(file1.ts, 3, 21), Decl(file2.ts, 5, 29)) +>b : Symbol(x.B.b, Decl(file2.ts, 7, 18)) + diff --git a/tests/baselines/reference/augmentExportEquals6.types b/tests/baselines/reference/augmentExportEquals6.types new file mode 100644 index 00000000000..1a2b2b22ccb --- /dev/null +++ b/tests/baselines/reference/augmentExportEquals6.types @@ -0,0 +1,69 @@ +=== tests/cases/compiler/file1.ts === + +class foo {} +>foo : + +namespace foo { +>foo : typeof + + export class A {} +>A : A + + export namespace B { export let a; } +>B : typeof B +>a : any +} +export = foo; +>foo : foo + +=== tests/cases/compiler/file2.ts === +import x = require("./file1"); +>x : typeof x + +x.B.b = 1; +>x.B.b = 1 : number +>x.B.b : number +>x.B : typeof x.B +>x : typeof x +>B : typeof x.B +>b : number +>1 : number + +// OK - './file1' is a namespace +declare module "./file1" { + interface A { a: number } +>A : A +>a : number + + namespace B { +>B : typeof B + + export let b: number; +>b : number + } +} + +=== tests/cases/compiler/file3.ts === +import * as x from "./file1"; +>x : typeof x + +import "./file2"; +let a: x.A; +>a : x.A +>x : any +>A : x.A + +let b = a.a; +>b : number +>a.a : number +>a : x.A +>a : number + +let c = x.B.b; +>c : number +>x.B.b : number +>x.B : typeof x.B +>x : typeof x +>B : typeof x.B +>b : number + diff --git a/tests/baselines/reference/augmentExportEquals6_1.js b/tests/baselines/reference/augmentExportEquals6_1.js new file mode 100644 index 00000000000..c7c560183cc --- /dev/null +++ b/tests/baselines/reference/augmentExportEquals6_1.js @@ -0,0 +1,38 @@ +//// [tests/cases/compiler/augmentExportEquals6_1.ts] //// + +//// [file1.d.ts] + +declare module "file1" { + class foo {} + namespace foo { + class A {} + } + export = foo; +} + + +//// [file2.ts] +/// +import x = require("file1"); + +// OK - './file1' is a namespace +declare module "file1" { + interface A { a: number } +} + +//// [file3.ts] +import * as x from "file1"; +import "file2"; +let a: x.A; +let b = a.a; + +//// [file2.js] +define(["require", "exports"], function (require, exports) { + "use strict"; +}); +//// [file3.js] +define(["require", "exports", "file2"], function (require, exports) { + "use strict"; + var a; + var b = a.a; +}); diff --git a/tests/baselines/reference/augmentExportEquals6_1.symbols b/tests/baselines/reference/augmentExportEquals6_1.symbols new file mode 100644 index 00000000000..3db6702448e --- /dev/null +++ b/tests/baselines/reference/augmentExportEquals6_1.symbols @@ -0,0 +1,45 @@ +=== tests/cases/compiler/file1.d.ts === + +declare module "file1" { + class foo {} +>foo : Symbol(, Decl(file1.d.ts, 1, 24), Decl(file1.d.ts, 2, 16), Decl(file2.ts, 1, 28)) + + namespace foo { +>foo : Symbol(, Decl(file1.d.ts, 1, 24), Decl(file1.d.ts, 2, 16), Decl(file2.ts, 1, 28)) + + class A {} +>A : Symbol(A, Decl(file1.d.ts, 3, 19), Decl(file2.ts, 4, 24)) + } + export = foo; +>foo : Symbol(foo, Decl(file1.d.ts, 1, 24), Decl(file1.d.ts, 2, 16)) +} + + +=== tests/cases/compiler/file2.ts === +/// +import x = require("file1"); +>x : Symbol(x, Decl(file2.ts, 0, 0)) + +// OK - './file1' is a namespace +declare module "file1" { + interface A { a: number } +>A : Symbol(A, Decl(file1.d.ts, 3, 19), Decl(file2.ts, 4, 24)) +>a : Symbol(A.a, Decl(file2.ts, 5, 17)) +} + +=== tests/cases/compiler/file3.ts === +import * as x from "file1"; +>x : Symbol(x, Decl(file3.ts, 0, 6)) + +import "file2"; +let a: x.A; +>a : Symbol(a, Decl(file3.ts, 2, 3)) +>x : Symbol(x, Decl(file3.ts, 0, 6)) +>A : Symbol(x.A, Decl(file1.d.ts, 3, 19), Decl(file2.ts, 4, 24)) + +let b = a.a; +>b : Symbol(b, Decl(file3.ts, 3, 3)) +>a.a : Symbol(x.A.a, Decl(file2.ts, 5, 17)) +>a : Symbol(a, Decl(file3.ts, 2, 3)) +>a : Symbol(x.A.a, Decl(file2.ts, 5, 17)) + diff --git a/tests/baselines/reference/augmentExportEquals6_1.types b/tests/baselines/reference/augmentExportEquals6_1.types new file mode 100644 index 00000000000..a9cc78056c8 --- /dev/null +++ b/tests/baselines/reference/augmentExportEquals6_1.types @@ -0,0 +1,45 @@ +=== tests/cases/compiler/file1.d.ts === + +declare module "file1" { + class foo {} +>foo : + + namespace foo { +>foo : typeof + + class A {} +>A : A + } + export = foo; +>foo : foo +} + + +=== tests/cases/compiler/file2.ts === +/// +import x = require("file1"); +>x : typeof x + +// OK - './file1' is a namespace +declare module "file1" { + interface A { a: number } +>A : A +>a : number +} + +=== tests/cases/compiler/file3.ts === +import * as x from "file1"; +>x : typeof x + +import "file2"; +let a: x.A; +>a : x.A +>x : any +>A : x.A + +let b = a.a; +>b : number +>a.a : number +>a : x.A +>a : number + diff --git a/tests/baselines/reference/augmentedTypeAssignmentCompatIndexSignature.errors.txt b/tests/baselines/reference/augmentedTypeAssignmentCompatIndexSignature.errors.txt index eb5020e97f9..e99cac7968c 100644 --- a/tests/baselines/reference/augmentedTypeAssignmentCompatIndexSignature.errors.txt +++ b/tests/baselines/reference/augmentedTypeAssignmentCompatIndexSignature.errors.txt @@ -1,10 +1,8 @@ -tests/cases/conformance/types/members/augmentedTypeAssignmentCompatIndexSignature.ts(15,5): error TS2322: Type '{}' is not assignable to type '{ [n: number]: Foo; }'. - Index signature is missing in type '{}'. tests/cases/conformance/types/members/augmentedTypeAssignmentCompatIndexSignature.ts(19,5): error TS2322: Type '() => void' is not assignable to type '{ [n: number]: Bar; }'. Index signature is missing in type '() => void'. -==== tests/cases/conformance/types/members/augmentedTypeAssignmentCompatIndexSignature.ts (2 errors) ==== +==== tests/cases/conformance/types/members/augmentedTypeAssignmentCompatIndexSignature.ts (1 errors) ==== interface Foo { a } interface Bar { b } @@ -20,9 +18,6 @@ tests/cases/conformance/types/members/augmentedTypeAssignmentCompatIndexSignatur var f = () => { }; var v1: { - ~~ -!!! error TS2322: Type '{}' is not assignable to type '{ [n: number]: Foo; }'. -!!! error TS2322: Index signature is missing in type '{}'. [n: number]: Foo } = o; // Should be allowed diff --git a/tests/baselines/reference/augmentedTypeBracketAccessIndexSignature.symbols b/tests/baselines/reference/augmentedTypeBracketAccessIndexSignature.symbols index c3dfe5996b9..9ab4ceb9068 100644 --- a/tests/baselines/reference/augmentedTypeBracketAccessIndexSignature.symbols +++ b/tests/baselines/reference/augmentedTypeBracketAccessIndexSignature.symbols @@ -1,11 +1,11 @@ === tests/cases/conformance/types/members/augmentedTypeBracketAccessIndexSignature.ts === interface Foo { a } >Foo : Symbol(Foo, Decl(augmentedTypeBracketAccessIndexSignature.ts, 0, 0)) ->a : Symbol(a, Decl(augmentedTypeBracketAccessIndexSignature.ts, 0, 15)) +>a : Symbol(Foo.a, Decl(augmentedTypeBracketAccessIndexSignature.ts, 0, 15)) interface Bar { b } >Bar : Symbol(Bar, Decl(augmentedTypeBracketAccessIndexSignature.ts, 0, 19)) ->b : Symbol(b, Decl(augmentedTypeBracketAccessIndexSignature.ts, 1, 15)) +>b : Symbol(Bar.b, Decl(augmentedTypeBracketAccessIndexSignature.ts, 1, 15)) interface Object { >Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(augmentedTypeBracketAccessIndexSignature.ts, 1, 19)) diff --git a/tests/baselines/reference/augmentedTypeBracketNamedPropertyAccess.symbols b/tests/baselines/reference/augmentedTypeBracketNamedPropertyAccess.symbols index d12e8e13793..c51c0497ec8 100644 --- a/tests/baselines/reference/augmentedTypeBracketNamedPropertyAccess.symbols +++ b/tests/baselines/reference/augmentedTypeBracketNamedPropertyAccess.symbols @@ -3,13 +3,13 @@ interface Object { >Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(augmentedTypeBracketNamedPropertyAccess.ts, 0, 0)) data: number; ->data : Symbol(data, Decl(augmentedTypeBracketNamedPropertyAccess.ts, 0, 18)) +>data : Symbol(Object.data, Decl(augmentedTypeBracketNamedPropertyAccess.ts, 0, 18)) } interface Function { >Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(augmentedTypeBracketNamedPropertyAccess.ts, 2, 1)) functionData: string; ->functionData : Symbol(functionData, Decl(augmentedTypeBracketNamedPropertyAccess.ts, 3, 20)) +>functionData : Symbol(Function.functionData, Decl(augmentedTypeBracketNamedPropertyAccess.ts, 3, 20)) } var o = {}; >o : Symbol(o, Decl(augmentedTypeBracketNamedPropertyAccess.ts, 6, 3)) diff --git a/tests/baselines/reference/augmentedTypesClass3.symbols b/tests/baselines/reference/augmentedTypesClass3.symbols index 62504a56f25..e968ecd61ed 100644 --- a/tests/baselines/reference/augmentedTypesClass3.symbols +++ b/tests/baselines/reference/augmentedTypesClass3.symbols @@ -2,14 +2,14 @@ // class then module class c5 { public foo() { } } >c5 : Symbol(c5, Decl(augmentedTypesClass3.ts, 0, 0), Decl(augmentedTypesClass3.ts, 1, 29)) ->foo : Symbol(foo, Decl(augmentedTypesClass3.ts, 1, 10)) +>foo : Symbol(c5.foo, Decl(augmentedTypesClass3.ts, 1, 10)) module c5 { } // should be ok >c5 : Symbol(c5, Decl(augmentedTypesClass3.ts, 0, 0), Decl(augmentedTypesClass3.ts, 1, 29)) class c5a { public foo() { } } >c5a : Symbol(c5a, Decl(augmentedTypesClass3.ts, 2, 13), Decl(augmentedTypesClass3.ts, 4, 30)) ->foo : Symbol(foo, Decl(augmentedTypesClass3.ts, 4, 11)) +>foo : Symbol(c5a.foo, Decl(augmentedTypesClass3.ts, 4, 11)) module c5a { var y = 2; } // should be ok >c5a : Symbol(c5a, Decl(augmentedTypesClass3.ts, 2, 13), Decl(augmentedTypesClass3.ts, 4, 30)) @@ -17,7 +17,7 @@ module c5a { var y = 2; } // should be ok class c5b { public foo() { } } >c5b : Symbol(c5b, Decl(augmentedTypesClass3.ts, 5, 25), Decl(augmentedTypesClass3.ts, 7, 30)) ->foo : Symbol(foo, Decl(augmentedTypesClass3.ts, 7, 11)) +>foo : Symbol(c5b.foo, Decl(augmentedTypesClass3.ts, 7, 11)) module c5b { export var y = 2; } // should be ok >c5b : Symbol(c5b, Decl(augmentedTypesClass3.ts, 5, 25), Decl(augmentedTypesClass3.ts, 7, 30)) @@ -26,6 +26,6 @@ module c5b { export var y = 2; } // should be ok //// class then import class c5c { public foo() { } } >c5c : Symbol(c5c, Decl(augmentedTypesClass3.ts, 8, 32)) ->foo : Symbol(foo, Decl(augmentedTypesClass3.ts, 11, 11)) +>foo : Symbol(c5c.foo, Decl(augmentedTypesClass3.ts, 11, 11)) //import c5c = require(''); diff --git a/tests/baselines/reference/augmentedTypesExternalModule1.symbols b/tests/baselines/reference/augmentedTypesExternalModule1.symbols index 3a909b91df5..d44d1f213a0 100644 --- a/tests/baselines/reference/augmentedTypesExternalModule1.symbols +++ b/tests/baselines/reference/augmentedTypesExternalModule1.symbols @@ -4,7 +4,7 @@ export var a = 1; class c5 { public foo() { } } >c5 : Symbol(c5, Decl(augmentedTypesExternalModule1.ts, 0, 17), Decl(augmentedTypesExternalModule1.ts, 1, 29)) ->foo : Symbol(foo, Decl(augmentedTypesExternalModule1.ts, 1, 10)) +>foo : Symbol(c5.foo, Decl(augmentedTypesExternalModule1.ts, 1, 10)) module c5 { } // should be ok everywhere >c5 : Symbol(c5, Decl(augmentedTypesExternalModule1.ts, 0, 17), Decl(augmentedTypesExternalModule1.ts, 1, 29)) diff --git a/tests/baselines/reference/augmentedTypesModules3b.symbols b/tests/baselines/reference/augmentedTypesModules3b.symbols index dd5456e4cf2..abafc4855ca 100644 --- a/tests/baselines/reference/augmentedTypesModules3b.symbols +++ b/tests/baselines/reference/augmentedTypesModules3b.symbols @@ -1,7 +1,7 @@ === tests/cases/compiler/augmentedTypesModules3b.ts === class m3b { foo() { } } >m3b : Symbol(m3b, Decl(augmentedTypesModules3b.ts, 0, 0), Decl(augmentedTypesModules3b.ts, 0, 23)) ->foo : Symbol(foo, Decl(augmentedTypesModules3b.ts, 0, 11)) +>foo : Symbol(m3b.foo, Decl(augmentedTypesModules3b.ts, 0, 11)) module m3b { var y = 2; } >m3b : Symbol(m3b, Decl(augmentedTypesModules3b.ts, 0, 0), Decl(augmentedTypesModules3b.ts, 0, 23)) @@ -9,7 +9,7 @@ module m3b { var y = 2; } class m3c { foo() { } } >m3c : Symbol(m3c, Decl(augmentedTypesModules3b.ts, 1, 25), Decl(augmentedTypesModules3b.ts, 3, 23)) ->foo : Symbol(foo, Decl(augmentedTypesModules3b.ts, 3, 11)) +>foo : Symbol(m3c.foo, Decl(augmentedTypesModules3b.ts, 3, 11)) module m3c { export var y = 2; } >m3c : Symbol(m3c, Decl(augmentedTypesModules3b.ts, 1, 25), Decl(augmentedTypesModules3b.ts, 3, 23)) @@ -17,7 +17,7 @@ module m3c { export var y = 2; } declare class m3d { foo(): void } >m3d : Symbol(m3d, Decl(augmentedTypesModules3b.ts, 4, 32), Decl(augmentedTypesModules3b.ts, 6, 33)) ->foo : Symbol(foo, Decl(augmentedTypesModules3b.ts, 6, 19)) +>foo : Symbol(m3d.foo, Decl(augmentedTypesModules3b.ts, 6, 19)) module m3d { export var y = 2; } >m3d : Symbol(m3d, Decl(augmentedTypesModules3b.ts, 4, 32), Decl(augmentedTypesModules3b.ts, 6, 33)) @@ -29,23 +29,23 @@ module m3e { export var y = 2; } declare class m3e { foo(): void } >m3e : Symbol(m3e, Decl(augmentedTypesModules3b.ts, 7, 32), Decl(augmentedTypesModules3b.ts, 9, 32)) ->foo : Symbol(foo, Decl(augmentedTypesModules3b.ts, 10, 19)) +>foo : Symbol(m3e.foo, Decl(augmentedTypesModules3b.ts, 10, 19)) declare class m3f { foo(): void } >m3f : Symbol(m3f, Decl(augmentedTypesModules3b.ts, 10, 33), Decl(augmentedTypesModules3b.ts, 12, 33)) ->foo : Symbol(foo, Decl(augmentedTypesModules3b.ts, 12, 19)) +>foo : Symbol(m3f.foo, Decl(augmentedTypesModules3b.ts, 12, 19)) module m3f { export interface I { foo(): void } } >m3f : Symbol(m3f, Decl(augmentedTypesModules3b.ts, 10, 33), Decl(augmentedTypesModules3b.ts, 12, 33)) >I : Symbol(I, Decl(augmentedTypesModules3b.ts, 13, 12)) ->foo : Symbol(foo, Decl(augmentedTypesModules3b.ts, 13, 33)) +>foo : Symbol(I.foo, Decl(augmentedTypesModules3b.ts, 13, 33)) declare class m3g { foo(): void } >m3g : Symbol(m3g, Decl(augmentedTypesModules3b.ts, 13, 49), Decl(augmentedTypesModules3b.ts, 15, 33)) ->foo : Symbol(foo, Decl(augmentedTypesModules3b.ts, 15, 19)) +>foo : Symbol(m3g.foo, Decl(augmentedTypesModules3b.ts, 15, 19)) module m3g { export class C { foo() { } } } >m3g : Symbol(m3g, Decl(augmentedTypesModules3b.ts, 13, 49), Decl(augmentedTypesModules3b.ts, 15, 33)) >C : Symbol(C, Decl(augmentedTypesModules3b.ts, 16, 12)) ->foo : Symbol(foo, Decl(augmentedTypesModules3b.ts, 16, 29)) +>foo : Symbol(C.foo, Decl(augmentedTypesModules3b.ts, 16, 29)) diff --git a/tests/baselines/reference/augmentedTypesModules4.symbols b/tests/baselines/reference/augmentedTypesModules4.symbols index e0cee3e7c3a..8df383141ec 100644 --- a/tests/baselines/reference/augmentedTypesModules4.symbols +++ b/tests/baselines/reference/augmentedTypesModules4.symbols @@ -26,7 +26,7 @@ enum m4b { One } module m4c { interface I { foo(): void } } >m4c : Symbol(m4c, Decl(augmentedTypesModules4.ts, 9, 16), Decl(augmentedTypesModules4.ts, 11, 42)) >I : Symbol(I, Decl(augmentedTypesModules4.ts, 11, 12)) ->foo : Symbol(foo, Decl(augmentedTypesModules4.ts, 11, 26)) +>foo : Symbol(I.foo, Decl(augmentedTypesModules4.ts, 11, 26)) enum m4c { One } >m4c : Symbol(m4c, Decl(augmentedTypesModules4.ts, 9, 16), Decl(augmentedTypesModules4.ts, 11, 42)) @@ -35,7 +35,7 @@ enum m4c { One } module m4d { class C { foo() { } } } >m4d : Symbol(m4d, Decl(augmentedTypesModules4.ts, 12, 16), Decl(augmentedTypesModules4.ts, 14, 36)) >C : Symbol(C, Decl(augmentedTypesModules4.ts, 14, 12)) ->foo : Symbol(foo, Decl(augmentedTypesModules4.ts, 14, 22)) +>foo : Symbol(C.foo, Decl(augmentedTypesModules4.ts, 14, 22)) enum m4d { One } >m4d : Symbol(m4d, Decl(augmentedTypesModules4.ts, 12, 16), Decl(augmentedTypesModules4.ts, 14, 36)) @@ -50,5 +50,5 @@ module m5 { export var y = 2; } module m5 { export interface I { foo(): void } } // should already be reasonably well covered >m5 : Symbol(m5, Decl(augmentedTypesModules4.ts, 15, 16), Decl(augmentedTypesModules4.ts, 19, 31)) >I : Symbol(I, Decl(augmentedTypesModules4.ts, 20, 11)) ->foo : Symbol(foo, Decl(augmentedTypesModules4.ts, 20, 32)) +>foo : Symbol(I.foo, Decl(augmentedTypesModules4.ts, 20, 32)) diff --git a/tests/baselines/reference/avoid.symbols b/tests/baselines/reference/avoid.symbols index 9b9440eea65..e2f9e1c4507 100644 --- a/tests/baselines/reference/avoid.symbols +++ b/tests/baselines/reference/avoid.symbols @@ -25,7 +25,7 @@ class C { >C : Symbol(C, Decl(avoid.ts, 7, 6)) g() { ->g : Symbol(g, Decl(avoid.ts, 9, 9)) +>g : Symbol(C.g, Decl(avoid.ts, 9, 9)) } } diff --git a/tests/baselines/reference/awaitBinaryExpression1_es6.js b/tests/baselines/reference/awaitBinaryExpression1_es6.js index 8deb771f5ab..a19e94353d5 100644 --- a/tests/baselines/reference/awaitBinaryExpression1_es6.js +++ b/tests/baselines/reference/awaitBinaryExpression1_es6.js @@ -9,7 +9,7 @@ async function func(): Promise { //// [awaitBinaryExpression1_es6.js] function func() { - return __awaiter(this, void 0, Promise, function* () { + return __awaiter(this, void 0, void 0, function* () { "before"; var b = (yield p) || a; "after"; diff --git a/tests/baselines/reference/awaitBinaryExpression1_es6.symbols b/tests/baselines/reference/awaitBinaryExpression1_es6.symbols index fd532aeca74..aee3dbefe96 100644 --- a/tests/baselines/reference/awaitBinaryExpression1_es6.symbols +++ b/tests/baselines/reference/awaitBinaryExpression1_es6.symbols @@ -4,11 +4,11 @@ declare var a: boolean; declare var p: Promise; >p : Symbol(p, Decl(awaitBinaryExpression1_es6.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) async function func(): Promise { >func : Symbol(func, Decl(awaitBinaryExpression1_es6.ts, 1, 32)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) "before"; var b = await p || a; diff --git a/tests/baselines/reference/awaitBinaryExpression2_es6.js b/tests/baselines/reference/awaitBinaryExpression2_es6.js index 506af50a0ef..7fb1a70446b 100644 --- a/tests/baselines/reference/awaitBinaryExpression2_es6.js +++ b/tests/baselines/reference/awaitBinaryExpression2_es6.js @@ -9,7 +9,7 @@ async function func(): Promise { //// [awaitBinaryExpression2_es6.js] function func() { - return __awaiter(this, void 0, Promise, function* () { + return __awaiter(this, void 0, void 0, function* () { "before"; var b = (yield p) && a; "after"; diff --git a/tests/baselines/reference/awaitBinaryExpression2_es6.symbols b/tests/baselines/reference/awaitBinaryExpression2_es6.symbols index 3117f62da17..a4ed0ec14bd 100644 --- a/tests/baselines/reference/awaitBinaryExpression2_es6.symbols +++ b/tests/baselines/reference/awaitBinaryExpression2_es6.symbols @@ -4,11 +4,11 @@ declare var a: boolean; declare var p: Promise; >p : Symbol(p, Decl(awaitBinaryExpression2_es6.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) async function func(): Promise { >func : Symbol(func, Decl(awaitBinaryExpression2_es6.ts, 1, 32)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) "before"; var b = await p && a; diff --git a/tests/baselines/reference/awaitBinaryExpression3_es6.js b/tests/baselines/reference/awaitBinaryExpression3_es6.js index 4b298d7b947..f845ce12421 100644 --- a/tests/baselines/reference/awaitBinaryExpression3_es6.js +++ b/tests/baselines/reference/awaitBinaryExpression3_es6.js @@ -9,7 +9,7 @@ async function func(): Promise { //// [awaitBinaryExpression3_es6.js] function func() { - return __awaiter(this, void 0, Promise, function* () { + return __awaiter(this, void 0, void 0, function* () { "before"; var b = (yield p) + a; "after"; diff --git a/tests/baselines/reference/awaitBinaryExpression3_es6.symbols b/tests/baselines/reference/awaitBinaryExpression3_es6.symbols index e50f194bbee..4b3beb9d9a5 100644 --- a/tests/baselines/reference/awaitBinaryExpression3_es6.symbols +++ b/tests/baselines/reference/awaitBinaryExpression3_es6.symbols @@ -4,11 +4,11 @@ declare var a: number; declare var p: Promise; >p : Symbol(p, Decl(awaitBinaryExpression3_es6.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) async function func(): Promise { >func : Symbol(func, Decl(awaitBinaryExpression3_es6.ts, 1, 31)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) "before"; var b = await p + a; diff --git a/tests/baselines/reference/awaitBinaryExpression4_es6.js b/tests/baselines/reference/awaitBinaryExpression4_es6.js index 4d313588984..b6e14c82487 100644 --- a/tests/baselines/reference/awaitBinaryExpression4_es6.js +++ b/tests/baselines/reference/awaitBinaryExpression4_es6.js @@ -9,7 +9,7 @@ async function func(): Promise { //// [awaitBinaryExpression4_es6.js] function func() { - return __awaiter(this, void 0, Promise, function* () { + return __awaiter(this, void 0, void 0, function* () { "before"; var b = yield p, a; "after"; diff --git a/tests/baselines/reference/awaitBinaryExpression4_es6.symbols b/tests/baselines/reference/awaitBinaryExpression4_es6.symbols index 02e05faeab0..1c52cbb48ef 100644 --- a/tests/baselines/reference/awaitBinaryExpression4_es6.symbols +++ b/tests/baselines/reference/awaitBinaryExpression4_es6.symbols @@ -4,11 +4,11 @@ declare var a: boolean; declare var p: Promise; >p : Symbol(p, Decl(awaitBinaryExpression4_es6.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) async function func(): Promise { >func : Symbol(func, Decl(awaitBinaryExpression4_es6.ts, 1, 32)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) "before"; var b = await p, a; diff --git a/tests/baselines/reference/awaitBinaryExpression5_es6.js b/tests/baselines/reference/awaitBinaryExpression5_es6.js index 01d6c50f6f0..65a5bbfee77 100644 --- a/tests/baselines/reference/awaitBinaryExpression5_es6.js +++ b/tests/baselines/reference/awaitBinaryExpression5_es6.js @@ -10,7 +10,7 @@ async function func(): Promise { //// [awaitBinaryExpression5_es6.js] function func() { - return __awaiter(this, void 0, Promise, function* () { + return __awaiter(this, void 0, void 0, function* () { "before"; var o; o.a = yield p; diff --git a/tests/baselines/reference/awaitBinaryExpression5_es6.symbols b/tests/baselines/reference/awaitBinaryExpression5_es6.symbols index 061364240f8..28f96aa55f5 100644 --- a/tests/baselines/reference/awaitBinaryExpression5_es6.symbols +++ b/tests/baselines/reference/awaitBinaryExpression5_es6.symbols @@ -4,11 +4,11 @@ declare var a: boolean; declare var p: Promise; >p : Symbol(p, Decl(awaitBinaryExpression5_es6.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) async function func(): Promise { >func : Symbol(func, Decl(awaitBinaryExpression5_es6.ts, 1, 32)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) "before"; var o: { a: boolean; }; diff --git a/tests/baselines/reference/awaitCallExpression1_es6.js b/tests/baselines/reference/awaitCallExpression1_es6.js index f9dad87a8b6..aeeb598e3bf 100644 --- a/tests/baselines/reference/awaitCallExpression1_es6.js +++ b/tests/baselines/reference/awaitCallExpression1_es6.js @@ -13,7 +13,7 @@ async function func(): Promise { //// [awaitCallExpression1_es6.js] function func() { - return __awaiter(this, void 0, Promise, function* () { + return __awaiter(this, void 0, void 0, function* () { "before"; var b = fn(a, a, a); "after"; diff --git a/tests/baselines/reference/awaitCallExpression1_es6.symbols b/tests/baselines/reference/awaitCallExpression1_es6.symbols index debe9180bcc..c4a91817a46 100644 --- a/tests/baselines/reference/awaitCallExpression1_es6.symbols +++ b/tests/baselines/reference/awaitCallExpression1_es6.symbols @@ -4,7 +4,7 @@ declare var a: boolean; declare var p: Promise; >p : Symbol(p, Decl(awaitCallExpression1_es6.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void; >fn : Symbol(fn, Decl(awaitCallExpression1_es6.ts, 1, 32)) @@ -21,14 +21,14 @@ declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }; declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >pfn : Symbol(pfn, Decl(awaitCallExpression1_es6.ts, 4, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >arg0 : Symbol(arg0, Decl(awaitCallExpression1_es6.ts, 4, 28)) >arg1 : Symbol(arg1, Decl(awaitCallExpression1_es6.ts, 4, 42)) >arg2 : Symbol(arg2, Decl(awaitCallExpression1_es6.ts, 4, 57)) declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >po : Symbol(po, Decl(awaitCallExpression1_es6.ts, 5, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >fn : Symbol(fn, Decl(awaitCallExpression1_es6.ts, 5, 25)) >arg0 : Symbol(arg0, Decl(awaitCallExpression1_es6.ts, 5, 29)) >arg1 : Symbol(arg1, Decl(awaitCallExpression1_es6.ts, 5, 43)) @@ -36,7 +36,7 @@ declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; async function func(): Promise { >func : Symbol(func, Decl(awaitCallExpression1_es6.ts, 5, 84)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) "before"; var b = fn(a, a, a); diff --git a/tests/baselines/reference/awaitCallExpression2_es6.js b/tests/baselines/reference/awaitCallExpression2_es6.js index 87d99cd0793..b41735275a8 100644 --- a/tests/baselines/reference/awaitCallExpression2_es6.js +++ b/tests/baselines/reference/awaitCallExpression2_es6.js @@ -13,7 +13,7 @@ async function func(): Promise { //// [awaitCallExpression2_es6.js] function func() { - return __awaiter(this, void 0, Promise, function* () { + return __awaiter(this, void 0, void 0, function* () { "before"; var b = fn(yield p, a, a); "after"; diff --git a/tests/baselines/reference/awaitCallExpression2_es6.symbols b/tests/baselines/reference/awaitCallExpression2_es6.symbols index be9a11410c2..3931e28045d 100644 --- a/tests/baselines/reference/awaitCallExpression2_es6.symbols +++ b/tests/baselines/reference/awaitCallExpression2_es6.symbols @@ -4,7 +4,7 @@ declare var a: boolean; declare var p: Promise; >p : Symbol(p, Decl(awaitCallExpression2_es6.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void; >fn : Symbol(fn, Decl(awaitCallExpression2_es6.ts, 1, 32)) @@ -21,14 +21,14 @@ declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }; declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >pfn : Symbol(pfn, Decl(awaitCallExpression2_es6.ts, 4, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >arg0 : Symbol(arg0, Decl(awaitCallExpression2_es6.ts, 4, 28)) >arg1 : Symbol(arg1, Decl(awaitCallExpression2_es6.ts, 4, 42)) >arg2 : Symbol(arg2, Decl(awaitCallExpression2_es6.ts, 4, 57)) declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >po : Symbol(po, Decl(awaitCallExpression2_es6.ts, 5, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >fn : Symbol(fn, Decl(awaitCallExpression2_es6.ts, 5, 25)) >arg0 : Symbol(arg0, Decl(awaitCallExpression2_es6.ts, 5, 29)) >arg1 : Symbol(arg1, Decl(awaitCallExpression2_es6.ts, 5, 43)) @@ -36,7 +36,7 @@ declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; async function func(): Promise { >func : Symbol(func, Decl(awaitCallExpression2_es6.ts, 5, 84)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) "before"; var b = fn(await p, a, a); diff --git a/tests/baselines/reference/awaitCallExpression3_es6.js b/tests/baselines/reference/awaitCallExpression3_es6.js index f397d83c3a1..74dee3e7e42 100644 --- a/tests/baselines/reference/awaitCallExpression3_es6.js +++ b/tests/baselines/reference/awaitCallExpression3_es6.js @@ -13,7 +13,7 @@ async function func(): Promise { //// [awaitCallExpression3_es6.js] function func() { - return __awaiter(this, void 0, Promise, function* () { + return __awaiter(this, void 0, void 0, function* () { "before"; var b = fn(a, yield p, a); "after"; diff --git a/tests/baselines/reference/awaitCallExpression3_es6.symbols b/tests/baselines/reference/awaitCallExpression3_es6.symbols index 612e33c456c..2002748c9ba 100644 --- a/tests/baselines/reference/awaitCallExpression3_es6.symbols +++ b/tests/baselines/reference/awaitCallExpression3_es6.symbols @@ -4,7 +4,7 @@ declare var a: boolean; declare var p: Promise; >p : Symbol(p, Decl(awaitCallExpression3_es6.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void; >fn : Symbol(fn, Decl(awaitCallExpression3_es6.ts, 1, 32)) @@ -21,14 +21,14 @@ declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }; declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >pfn : Symbol(pfn, Decl(awaitCallExpression3_es6.ts, 4, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >arg0 : Symbol(arg0, Decl(awaitCallExpression3_es6.ts, 4, 28)) >arg1 : Symbol(arg1, Decl(awaitCallExpression3_es6.ts, 4, 42)) >arg2 : Symbol(arg2, Decl(awaitCallExpression3_es6.ts, 4, 57)) declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >po : Symbol(po, Decl(awaitCallExpression3_es6.ts, 5, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >fn : Symbol(fn, Decl(awaitCallExpression3_es6.ts, 5, 25)) >arg0 : Symbol(arg0, Decl(awaitCallExpression3_es6.ts, 5, 29)) >arg1 : Symbol(arg1, Decl(awaitCallExpression3_es6.ts, 5, 43)) @@ -36,7 +36,7 @@ declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; async function func(): Promise { >func : Symbol(func, Decl(awaitCallExpression3_es6.ts, 5, 84)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) "before"; var b = fn(a, await p, a); diff --git a/tests/baselines/reference/awaitCallExpression4_es6.js b/tests/baselines/reference/awaitCallExpression4_es6.js index d8824d7e7a0..682a1776ac5 100644 --- a/tests/baselines/reference/awaitCallExpression4_es6.js +++ b/tests/baselines/reference/awaitCallExpression4_es6.js @@ -13,7 +13,7 @@ async function func(): Promise { //// [awaitCallExpression4_es6.js] function func() { - return __awaiter(this, void 0, Promise, function* () { + return __awaiter(this, void 0, void 0, function* () { "before"; var b = (yield pfn)(a, a, a); "after"; diff --git a/tests/baselines/reference/awaitCallExpression4_es6.symbols b/tests/baselines/reference/awaitCallExpression4_es6.symbols index 6925e5a44ea..d31cf100ad4 100644 --- a/tests/baselines/reference/awaitCallExpression4_es6.symbols +++ b/tests/baselines/reference/awaitCallExpression4_es6.symbols @@ -4,7 +4,7 @@ declare var a: boolean; declare var p: Promise; >p : Symbol(p, Decl(awaitCallExpression4_es6.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void; >fn : Symbol(fn, Decl(awaitCallExpression4_es6.ts, 1, 32)) @@ -21,14 +21,14 @@ declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }; declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >pfn : Symbol(pfn, Decl(awaitCallExpression4_es6.ts, 4, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >arg0 : Symbol(arg0, Decl(awaitCallExpression4_es6.ts, 4, 28)) >arg1 : Symbol(arg1, Decl(awaitCallExpression4_es6.ts, 4, 42)) >arg2 : Symbol(arg2, Decl(awaitCallExpression4_es6.ts, 4, 57)) declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >po : Symbol(po, Decl(awaitCallExpression4_es6.ts, 5, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >fn : Symbol(fn, Decl(awaitCallExpression4_es6.ts, 5, 25)) >arg0 : Symbol(arg0, Decl(awaitCallExpression4_es6.ts, 5, 29)) >arg1 : Symbol(arg1, Decl(awaitCallExpression4_es6.ts, 5, 43)) @@ -36,7 +36,7 @@ declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; async function func(): Promise { >func : Symbol(func, Decl(awaitCallExpression4_es6.ts, 5, 84)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) "before"; var b = (await pfn)(a, a, a); diff --git a/tests/baselines/reference/awaitCallExpression5_es6.js b/tests/baselines/reference/awaitCallExpression5_es6.js index f39a633765d..30889b35011 100644 --- a/tests/baselines/reference/awaitCallExpression5_es6.js +++ b/tests/baselines/reference/awaitCallExpression5_es6.js @@ -13,7 +13,7 @@ async function func(): Promise { //// [awaitCallExpression5_es6.js] function func() { - return __awaiter(this, void 0, Promise, function* () { + return __awaiter(this, void 0, void 0, function* () { "before"; var b = o.fn(a, a, a); "after"; diff --git a/tests/baselines/reference/awaitCallExpression5_es6.symbols b/tests/baselines/reference/awaitCallExpression5_es6.symbols index 8bdce5cd12c..d14a966b0b1 100644 --- a/tests/baselines/reference/awaitCallExpression5_es6.symbols +++ b/tests/baselines/reference/awaitCallExpression5_es6.symbols @@ -4,7 +4,7 @@ declare var a: boolean; declare var p: Promise; >p : Symbol(p, Decl(awaitCallExpression5_es6.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void; >fn : Symbol(fn, Decl(awaitCallExpression5_es6.ts, 1, 32)) @@ -21,14 +21,14 @@ declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }; declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >pfn : Symbol(pfn, Decl(awaitCallExpression5_es6.ts, 4, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >arg0 : Symbol(arg0, Decl(awaitCallExpression5_es6.ts, 4, 28)) >arg1 : Symbol(arg1, Decl(awaitCallExpression5_es6.ts, 4, 42)) >arg2 : Symbol(arg2, Decl(awaitCallExpression5_es6.ts, 4, 57)) declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >po : Symbol(po, Decl(awaitCallExpression5_es6.ts, 5, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >fn : Symbol(fn, Decl(awaitCallExpression5_es6.ts, 5, 25)) >arg0 : Symbol(arg0, Decl(awaitCallExpression5_es6.ts, 5, 29)) >arg1 : Symbol(arg1, Decl(awaitCallExpression5_es6.ts, 5, 43)) @@ -36,7 +36,7 @@ declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; async function func(): Promise { >func : Symbol(func, Decl(awaitCallExpression5_es6.ts, 5, 84)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) "before"; var b = o.fn(a, a, a); diff --git a/tests/baselines/reference/awaitCallExpression6_es6.js b/tests/baselines/reference/awaitCallExpression6_es6.js index de8477fa938..55d86119d64 100644 --- a/tests/baselines/reference/awaitCallExpression6_es6.js +++ b/tests/baselines/reference/awaitCallExpression6_es6.js @@ -13,7 +13,7 @@ async function func(): Promise { //// [awaitCallExpression6_es6.js] function func() { - return __awaiter(this, void 0, Promise, function* () { + return __awaiter(this, void 0, void 0, function* () { "before"; var b = o.fn(yield p, a, a); "after"; diff --git a/tests/baselines/reference/awaitCallExpression6_es6.symbols b/tests/baselines/reference/awaitCallExpression6_es6.symbols index ad79f75ab49..afd07fd0185 100644 --- a/tests/baselines/reference/awaitCallExpression6_es6.symbols +++ b/tests/baselines/reference/awaitCallExpression6_es6.symbols @@ -4,7 +4,7 @@ declare var a: boolean; declare var p: Promise; >p : Symbol(p, Decl(awaitCallExpression6_es6.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void; >fn : Symbol(fn, Decl(awaitCallExpression6_es6.ts, 1, 32)) @@ -21,14 +21,14 @@ declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }; declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >pfn : Symbol(pfn, Decl(awaitCallExpression6_es6.ts, 4, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >arg0 : Symbol(arg0, Decl(awaitCallExpression6_es6.ts, 4, 28)) >arg1 : Symbol(arg1, Decl(awaitCallExpression6_es6.ts, 4, 42)) >arg2 : Symbol(arg2, Decl(awaitCallExpression6_es6.ts, 4, 57)) declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >po : Symbol(po, Decl(awaitCallExpression6_es6.ts, 5, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >fn : Symbol(fn, Decl(awaitCallExpression6_es6.ts, 5, 25)) >arg0 : Symbol(arg0, Decl(awaitCallExpression6_es6.ts, 5, 29)) >arg1 : Symbol(arg1, Decl(awaitCallExpression6_es6.ts, 5, 43)) @@ -36,7 +36,7 @@ declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; async function func(): Promise { >func : Symbol(func, Decl(awaitCallExpression6_es6.ts, 5, 84)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) "before"; var b = o.fn(await p, a, a); diff --git a/tests/baselines/reference/awaitCallExpression7_es6.js b/tests/baselines/reference/awaitCallExpression7_es6.js index 24edc3b9393..df805266ff3 100644 --- a/tests/baselines/reference/awaitCallExpression7_es6.js +++ b/tests/baselines/reference/awaitCallExpression7_es6.js @@ -13,7 +13,7 @@ async function func(): Promise { //// [awaitCallExpression7_es6.js] function func() { - return __awaiter(this, void 0, Promise, function* () { + return __awaiter(this, void 0, void 0, function* () { "before"; var b = o.fn(a, yield p, a); "after"; diff --git a/tests/baselines/reference/awaitCallExpression7_es6.symbols b/tests/baselines/reference/awaitCallExpression7_es6.symbols index 0da1dd16016..bb503d4b3a1 100644 --- a/tests/baselines/reference/awaitCallExpression7_es6.symbols +++ b/tests/baselines/reference/awaitCallExpression7_es6.symbols @@ -4,7 +4,7 @@ declare var a: boolean; declare var p: Promise; >p : Symbol(p, Decl(awaitCallExpression7_es6.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void; >fn : Symbol(fn, Decl(awaitCallExpression7_es6.ts, 1, 32)) @@ -21,14 +21,14 @@ declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }; declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >pfn : Symbol(pfn, Decl(awaitCallExpression7_es6.ts, 4, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >arg0 : Symbol(arg0, Decl(awaitCallExpression7_es6.ts, 4, 28)) >arg1 : Symbol(arg1, Decl(awaitCallExpression7_es6.ts, 4, 42)) >arg2 : Symbol(arg2, Decl(awaitCallExpression7_es6.ts, 4, 57)) declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >po : Symbol(po, Decl(awaitCallExpression7_es6.ts, 5, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >fn : Symbol(fn, Decl(awaitCallExpression7_es6.ts, 5, 25)) >arg0 : Symbol(arg0, Decl(awaitCallExpression7_es6.ts, 5, 29)) >arg1 : Symbol(arg1, Decl(awaitCallExpression7_es6.ts, 5, 43)) @@ -36,7 +36,7 @@ declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; async function func(): Promise { >func : Symbol(func, Decl(awaitCallExpression7_es6.ts, 5, 84)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) "before"; var b = o.fn(a, await p, a); diff --git a/tests/baselines/reference/awaitCallExpression8_es6.js b/tests/baselines/reference/awaitCallExpression8_es6.js index 8bee6112a7a..8d7bb4b83ce 100644 --- a/tests/baselines/reference/awaitCallExpression8_es6.js +++ b/tests/baselines/reference/awaitCallExpression8_es6.js @@ -13,7 +13,7 @@ async function func(): Promise { //// [awaitCallExpression8_es6.js] function func() { - return __awaiter(this, void 0, Promise, function* () { + return __awaiter(this, void 0, void 0, function* () { "before"; var b = (yield po).fn(a, a, a); "after"; diff --git a/tests/baselines/reference/awaitCallExpression8_es6.symbols b/tests/baselines/reference/awaitCallExpression8_es6.symbols index d2d4fa2264d..9f4df1046f4 100644 --- a/tests/baselines/reference/awaitCallExpression8_es6.symbols +++ b/tests/baselines/reference/awaitCallExpression8_es6.symbols @@ -4,7 +4,7 @@ declare var a: boolean; declare var p: Promise; >p : Symbol(p, Decl(awaitCallExpression8_es6.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void; >fn : Symbol(fn, Decl(awaitCallExpression8_es6.ts, 1, 32)) @@ -21,14 +21,14 @@ declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }; declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >pfn : Symbol(pfn, Decl(awaitCallExpression8_es6.ts, 4, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >arg0 : Symbol(arg0, Decl(awaitCallExpression8_es6.ts, 4, 28)) >arg1 : Symbol(arg1, Decl(awaitCallExpression8_es6.ts, 4, 42)) >arg2 : Symbol(arg2, Decl(awaitCallExpression8_es6.ts, 4, 57)) declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >po : Symbol(po, Decl(awaitCallExpression8_es6.ts, 5, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >fn : Symbol(fn, Decl(awaitCallExpression8_es6.ts, 5, 25)) >arg0 : Symbol(arg0, Decl(awaitCallExpression8_es6.ts, 5, 29)) >arg1 : Symbol(arg1, Decl(awaitCallExpression8_es6.ts, 5, 43)) @@ -36,7 +36,7 @@ declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; async function func(): Promise { >func : Symbol(func, Decl(awaitCallExpression8_es6.ts, 5, 84)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) "before"; var b = (await po).fn(a, a, a); diff --git a/tests/baselines/reference/awaitUnion_es6.js b/tests/baselines/reference/awaitUnion_es6.js index 80c68f811ef..9603454b969 100644 --- a/tests/baselines/reference/awaitUnion_es6.js +++ b/tests/baselines/reference/awaitUnion_es6.js @@ -14,7 +14,7 @@ async function f() { //// [awaitUnion_es6.js] function f() { - return __awaiter(this, void 0, Promise, function* () { + return __awaiter(this, void 0, void 0, function* () { let await_a = yield a; let await_b = yield b; let await_c = yield c; diff --git a/tests/baselines/reference/awaitUnion_es6.symbols b/tests/baselines/reference/awaitUnion_es6.symbols index 48524c4526d..98a229c4148 100644 --- a/tests/baselines/reference/awaitUnion_es6.symbols +++ b/tests/baselines/reference/awaitUnion_es6.symbols @@ -4,20 +4,20 @@ declare let a: number | string; declare let b: PromiseLike | PromiseLike; >b : Symbol(b, Decl(awaitUnion_es6.ts, 1, 11)) ->PromiseLike : Symbol(PromiseLike, Decl(lib.d.ts, --, --)) ->PromiseLike : Symbol(PromiseLike, Decl(lib.d.ts, --, --)) +>PromiseLike : Symbol(PromiseLike, Decl(lib.es5.d.ts, --, --)) +>PromiseLike : Symbol(PromiseLike, Decl(lib.es5.d.ts, --, --)) declare let c: PromiseLike; >c : Symbol(c, Decl(awaitUnion_es6.ts, 2, 11)) ->PromiseLike : Symbol(PromiseLike, Decl(lib.d.ts, --, --)) +>PromiseLike : Symbol(PromiseLike, Decl(lib.es5.d.ts, --, --)) declare let d: number | PromiseLike; >d : Symbol(d, Decl(awaitUnion_es6.ts, 3, 11)) ->PromiseLike : Symbol(PromiseLike, Decl(lib.d.ts, --, --)) +>PromiseLike : Symbol(PromiseLike, Decl(lib.es5.d.ts, --, --)) declare let e: number | PromiseLike; >e : Symbol(e, Decl(awaitUnion_es6.ts, 4, 11)) ->PromiseLike : Symbol(PromiseLike, Decl(lib.d.ts, --, --)) +>PromiseLike : Symbol(PromiseLike, Decl(lib.es5.d.ts, --, --)) async function f() { >f : Symbol(f, Decl(awaitUnion_es6.ts, 4, 53)) diff --git a/tests/baselines/reference/badOverloadError.types b/tests/baselines/reference/badOverloadError.types index b8ae583a73c..198582af2db 100644 --- a/tests/baselines/reference/badOverloadError.types +++ b/tests/baselines/reference/badOverloadError.types @@ -6,6 +6,6 @@ function method() { >dictionary : { [index: string]: string; } ><{ [index: string]: string; }>{} : { [index: string]: string; } >index : string ->{} : { [x: string]: undefined; } +>{} : {} } diff --git a/tests/baselines/reference/baseCheck.errors.txt b/tests/baselines/reference/baseCheck.errors.txt index f52ba4b3dbd..c31ba95476a 100644 --- a/tests/baselines/reference/baseCheck.errors.txt +++ b/tests/baselines/reference/baseCheck.errors.txt @@ -1,9 +1,9 @@ tests/cases/compiler/baseCheck.ts(9,18): error TS2304: Cannot find name 'loc'. tests/cases/compiler/baseCheck.ts(17,53): error TS2346: Supplied parameters do not match any signature of call target. -tests/cases/compiler/baseCheck.ts(17,59): error TS2332: 'this' cannot be referenced in current location. -tests/cases/compiler/baseCheck.ts(18,62): error TS2332: 'this' cannot be referenced in current location. +tests/cases/compiler/baseCheck.ts(17,59): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. +tests/cases/compiler/baseCheck.ts(18,62): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. tests/cases/compiler/baseCheck.ts(19,59): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. -tests/cases/compiler/baseCheck.ts(19,68): error TS2332: 'this' cannot be referenced in current location. +tests/cases/compiler/baseCheck.ts(19,68): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. tests/cases/compiler/baseCheck.ts(22,9): error TS2304: Cannot find name 'x'. tests/cases/compiler/baseCheck.ts(23,7): error TS2304: Cannot find name 'x'. tests/cases/compiler/baseCheck.ts(26,9): error TS2304: Cannot find name 'x'. @@ -32,15 +32,15 @@ tests/cases/compiler/baseCheck.ts(26,9): error TS2304: Cannot find name 'x'. ~~~~~~~~~~~~~ !!! error TS2346: Supplied parameters do not match any signature of call target. ~~~~ -!!! error TS2332: 'this' cannot be referenced in current location. +!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. class E extends C { constructor(public z: number) { super(0, this.z) } } ~~~~ -!!! error TS2332: 'this' cannot be referenced in current location. +!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. class F extends C { constructor(public z: number) { super("hello", this.z) } } // first param type ~~~~~~~ !!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. ~~~~ -!!! error TS2332: 'this' cannot be referenced in current location. +!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. function f() { if (x<10) { diff --git a/tests/baselines/reference/baseIndexSignatureResolution.symbols b/tests/baselines/reference/baseIndexSignatureResolution.symbols index 297f6b092f3..a70ad99fc7b 100644 --- a/tests/baselines/reference/baseIndexSignatureResolution.symbols +++ b/tests/baselines/reference/baseIndexSignatureResolution.symbols @@ -1,12 +1,12 @@ === tests/cases/compiler/baseIndexSignatureResolution.ts === class Base { private a: string; } >Base : Symbol(Base, Decl(baseIndexSignatureResolution.ts, 0, 0)) ->a : Symbol(a, Decl(baseIndexSignatureResolution.ts, 0, 12)) +>a : Symbol(Base.a, Decl(baseIndexSignatureResolution.ts, 0, 12)) class Derived extends Base { private b: string; } >Derived : Symbol(Derived, Decl(baseIndexSignatureResolution.ts, 0, 33)) >Base : Symbol(Base, Decl(baseIndexSignatureResolution.ts, 0, 0)) ->b : Symbol(b, Decl(baseIndexSignatureResolution.ts, 1, 28)) +>b : Symbol(Derived.b, Decl(baseIndexSignatureResolution.ts, 1, 28)) // Note - commmenting "extends Foo" prevents the error interface Foo { diff --git a/tests/baselines/reference/baseTypeAfterDerivedType.symbols b/tests/baselines/reference/baseTypeAfterDerivedType.symbols index b085e0a4152..89d35e21635 100644 --- a/tests/baselines/reference/baseTypeAfterDerivedType.symbols +++ b/tests/baselines/reference/baseTypeAfterDerivedType.symbols @@ -4,7 +4,7 @@ interface Derived extends Base { >Base : Symbol(Base, Decl(baseTypeAfterDerivedType.ts, 2, 1)) method(...args: any[]): void; ->method : Symbol(method, Decl(baseTypeAfterDerivedType.ts, 0, 32)) +>method : Symbol(Derived.method, Decl(baseTypeAfterDerivedType.ts, 0, 32)) >args : Symbol(args, Decl(baseTypeAfterDerivedType.ts, 1, 11)) } @@ -12,7 +12,7 @@ interface Base { >Base : Symbol(Base, Decl(baseTypeAfterDerivedType.ts, 2, 1)) method(...args: any[]): void; ->method : Symbol(method, Decl(baseTypeAfterDerivedType.ts, 4, 16)) +>method : Symbol(Base.method, Decl(baseTypeAfterDerivedType.ts, 4, 16)) >args : Symbol(args, Decl(baseTypeAfterDerivedType.ts, 5, 11)) } @@ -21,7 +21,7 @@ class Derived2 implements Base2 { >Base2 : Symbol(Base2, Decl(baseTypeAfterDerivedType.ts, 10, 1)) method(...args: any[]): void { } ->method : Symbol(method, Decl(baseTypeAfterDerivedType.ts, 8, 33)) +>method : Symbol(Derived2.method, Decl(baseTypeAfterDerivedType.ts, 8, 33)) >args : Symbol(args, Decl(baseTypeAfterDerivedType.ts, 9, 11)) } @@ -29,7 +29,7 @@ interface Base2 { >Base2 : Symbol(Base2, Decl(baseTypeAfterDerivedType.ts, 10, 1)) method(...args: any[]): void; ->method : Symbol(method, Decl(baseTypeAfterDerivedType.ts, 12, 17)) +>method : Symbol(Base2.method, Decl(baseTypeAfterDerivedType.ts, 12, 17)) >args : Symbol(args, Decl(baseTypeAfterDerivedType.ts, 13, 11)) } diff --git a/tests/baselines/reference/baseTypeOrderChecking.symbols b/tests/baselines/reference/baseTypeOrderChecking.symbols index 05d913f481e..13a926fe278 100644 --- a/tests/baselines/reference/baseTypeOrderChecking.symbols +++ b/tests/baselines/reference/baseTypeOrderChecking.symbols @@ -32,7 +32,7 @@ class Class3 { public memberVariable: Class2; ->memberVariable : Symbol(memberVariable, Decl(baseTypeOrderChecking.ts, 22, 1)) +>memberVariable : Symbol(Class3.memberVariable, Decl(baseTypeOrderChecking.ts, 22, 1)) >Class2 : Symbol(Class2, Decl(baseTypeOrderChecking.ts, 8, 1)) } diff --git a/tests/baselines/reference/baseTypeWrappingInstantiationChain.symbols b/tests/baselines/reference/baseTypeWrappingInstantiationChain.symbols index 1e8ab089b90..936110ea43a 100644 --- a/tests/baselines/reference/baseTypeWrappingInstantiationChain.symbols +++ b/tests/baselines/reference/baseTypeWrappingInstantiationChain.symbols @@ -6,7 +6,7 @@ class C extends CBase { >T1 : Symbol(T1, Decl(baseTypeWrappingInstantiationChain.ts, 0, 8)) public works() { ->works : Symbol(works, Decl(baseTypeWrappingInstantiationChain.ts, 0, 31)) +>works : Symbol(C.works, Decl(baseTypeWrappingInstantiationChain.ts, 0, 31)) new CBaseBase>(this); >CBaseBase : Symbol(CBaseBase, Decl(baseTypeWrappingInstantiationChain.ts, 13, 1)) @@ -15,7 +15,7 @@ class C extends CBase { >this : Symbol(C, Decl(baseTypeWrappingInstantiationChain.ts, 0, 0)) } public alsoWorks() { ->alsoWorks : Symbol(alsoWorks, Decl(baseTypeWrappingInstantiationChain.ts, 3, 5)) +>alsoWorks : Symbol(C.alsoWorks, Decl(baseTypeWrappingInstantiationChain.ts, 3, 5)) new CBase(this); // Should not error, parameter is of type Parameter> >CBase : Symbol(CBase, Decl(baseTypeWrappingInstantiationChain.ts, 9, 1)) @@ -24,7 +24,7 @@ class C extends CBase { } public method(t: Wrapper) { } ->method : Symbol(method, Decl(baseTypeWrappingInstantiationChain.ts, 6, 5)) +>method : Symbol(C.method, Decl(baseTypeWrappingInstantiationChain.ts, 6, 5)) >t : Symbol(t, Decl(baseTypeWrappingInstantiationChain.ts, 8, 18)) >Wrapper : Symbol(Wrapper, Decl(baseTypeWrappingInstantiationChain.ts, 21, 1)) >T1 : Symbol(T1, Decl(baseTypeWrappingInstantiationChain.ts, 0, 8)) @@ -54,7 +54,7 @@ class Parameter { >T4 : Symbol(T4, Decl(baseTypeWrappingInstantiationChain.ts, 19, 16)) method(t: T4) { } ->method : Symbol(method, Decl(baseTypeWrappingInstantiationChain.ts, 19, 21)) +>method : Symbol(Parameter.method, Decl(baseTypeWrappingInstantiationChain.ts, 19, 21)) >t : Symbol(t, Decl(baseTypeWrappingInstantiationChain.ts, 20, 11)) >T4 : Symbol(T4, Decl(baseTypeWrappingInstantiationChain.ts, 19, 16)) } @@ -64,6 +64,6 @@ class Wrapper { >T5 : Symbol(T5, Decl(baseTypeWrappingInstantiationChain.ts, 23, 14)) property: T5; ->property : Symbol(property, Decl(baseTypeWrappingInstantiationChain.ts, 23, 19)) +>property : Symbol(Wrapper.property, Decl(baseTypeWrappingInstantiationChain.ts, 23, 19)) >T5 : Symbol(T5, Decl(baseTypeWrappingInstantiationChain.ts, 23, 14)) } diff --git a/tests/baselines/reference/bases.errors.txt b/tests/baselines/reference/bases.errors.txt index c03a47d7532..a61d35f664e 100644 --- a/tests/baselines/reference/bases.errors.txt +++ b/tests/baselines/reference/bases.errors.txt @@ -4,6 +4,7 @@ tests/cases/compiler/bases.ts(7,17): error TS2304: Cannot find name 'any'. tests/cases/compiler/bases.ts(11,7): error TS2420: Class 'C' incorrectly implements interface 'I'. Property 'x' is missing in type 'C'. tests/cases/compiler/bases.ts(12,5): error TS2377: Constructors for derived classes must contain a 'super' call. +tests/cases/compiler/bases.ts(13,9): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. tests/cases/compiler/bases.ts(13,14): error TS2339: Property 'x' does not exist on type 'C'. tests/cases/compiler/bases.ts(13,15): error TS1005: ';' expected. tests/cases/compiler/bases.ts(13,17): error TS2304: Cannot find name 'any'. @@ -11,7 +12,7 @@ tests/cases/compiler/bases.ts(17,9): error TS2339: Property 'x' does not exist o tests/cases/compiler/bases.ts(18,9): error TS2339: Property 'y' does not exist on type 'C'. -==== tests/cases/compiler/bases.ts (10 errors) ==== +==== tests/cases/compiler/bases.ts (11 errors) ==== interface I { x; } @@ -36,6 +37,8 @@ tests/cases/compiler/bases.ts(18,9): error TS2339: Property 'y' does not exist o ~~~~~~~~~~~~~~~ this.x: any; ~~~~~~~~~~~~~~~~~~~~ + ~~~~ +!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. ~ !!! error TS2339: Property 'x' does not exist on type 'C'. ~ diff --git a/tests/baselines/reference/bestCommonTypeOfConditionalExpressions.symbols b/tests/baselines/reference/bestCommonTypeOfConditionalExpressions.symbols index 626777523ab..1cdb83ea837 100644 --- a/tests/baselines/reference/bestCommonTypeOfConditionalExpressions.symbols +++ b/tests/baselines/reference/bestCommonTypeOfConditionalExpressions.symbols @@ -14,17 +14,17 @@ var b: { x: number; z?: number }; class Base { foo: string; } >Base : Symbol(Base, Decl(bestCommonTypeOfConditionalExpressions.ts, 4, 33)) ->foo : Symbol(foo, Decl(bestCommonTypeOfConditionalExpressions.ts, 6, 12)) +>foo : Symbol(Base.foo, Decl(bestCommonTypeOfConditionalExpressions.ts, 6, 12)) class Derived extends Base { bar: string; } >Derived : Symbol(Derived, Decl(bestCommonTypeOfConditionalExpressions.ts, 6, 27)) >Base : Symbol(Base, Decl(bestCommonTypeOfConditionalExpressions.ts, 4, 33)) ->bar : Symbol(bar, Decl(bestCommonTypeOfConditionalExpressions.ts, 7, 28)) +>bar : Symbol(Derived.bar, Decl(bestCommonTypeOfConditionalExpressions.ts, 7, 28)) class Derived2 extends Base { baz: string; } >Derived2 : Symbol(Derived2, Decl(bestCommonTypeOfConditionalExpressions.ts, 7, 43)) >Base : Symbol(Base, Decl(bestCommonTypeOfConditionalExpressions.ts, 4, 33)) ->baz : Symbol(baz, Decl(bestCommonTypeOfConditionalExpressions.ts, 8, 29)) +>baz : Symbol(Derived2.baz, Decl(bestCommonTypeOfConditionalExpressions.ts, 8, 29)) var base: Base; >base : Symbol(base, Decl(bestCommonTypeOfConditionalExpressions.ts, 9, 3)) diff --git a/tests/baselines/reference/bestCommonTypeOfConditionalExpressions2.symbols b/tests/baselines/reference/bestCommonTypeOfConditionalExpressions2.symbols index 68103761051..11a3430a668 100644 --- a/tests/baselines/reference/bestCommonTypeOfConditionalExpressions2.symbols +++ b/tests/baselines/reference/bestCommonTypeOfConditionalExpressions2.symbols @@ -4,17 +4,17 @@ class Base { foo: string; } >Base : Symbol(Base, Decl(bestCommonTypeOfConditionalExpressions2.ts, 0, 0)) ->foo : Symbol(foo, Decl(bestCommonTypeOfConditionalExpressions2.ts, 3, 12)) +>foo : Symbol(Base.foo, Decl(bestCommonTypeOfConditionalExpressions2.ts, 3, 12)) class Derived extends Base { bar: string; } >Derived : Symbol(Derived, Decl(bestCommonTypeOfConditionalExpressions2.ts, 3, 27)) >Base : Symbol(Base, Decl(bestCommonTypeOfConditionalExpressions2.ts, 0, 0)) ->bar : Symbol(bar, Decl(bestCommonTypeOfConditionalExpressions2.ts, 4, 28)) +>bar : Symbol(Derived.bar, Decl(bestCommonTypeOfConditionalExpressions2.ts, 4, 28)) class Derived2 extends Base { baz: string; } >Derived2 : Symbol(Derived2, Decl(bestCommonTypeOfConditionalExpressions2.ts, 4, 43)) >Base : Symbol(Base, Decl(bestCommonTypeOfConditionalExpressions2.ts, 0, 0)) ->baz : Symbol(baz, Decl(bestCommonTypeOfConditionalExpressions2.ts, 5, 29)) +>baz : Symbol(Derived2.baz, Decl(bestCommonTypeOfConditionalExpressions2.ts, 5, 29)) var base: Base; >base : Symbol(base, Decl(bestCommonTypeOfConditionalExpressions2.ts, 6, 3)) diff --git a/tests/baselines/reference/bestCommonTypeOfTuple2.symbols b/tests/baselines/reference/bestCommonTypeOfTuple2.symbols index 842d07c417c..1e17f253f8a 100644 --- a/tests/baselines/reference/bestCommonTypeOfTuple2.symbols +++ b/tests/baselines/reference/bestCommonTypeOfTuple2.symbols @@ -4,39 +4,39 @@ interface base { } interface base1 { i } >base1 : Symbol(base1, Decl(bestCommonTypeOfTuple2.ts, 0, 18)) ->i : Symbol(i, Decl(bestCommonTypeOfTuple2.ts, 1, 17)) +>i : Symbol(base1.i, Decl(bestCommonTypeOfTuple2.ts, 1, 17)) class C implements base { c } >C : Symbol(C, Decl(bestCommonTypeOfTuple2.ts, 1, 21)) >base : Symbol(base, Decl(bestCommonTypeOfTuple2.ts, 0, 0)) ->c : Symbol(c, Decl(bestCommonTypeOfTuple2.ts, 2, 25)) +>c : Symbol(C.c, Decl(bestCommonTypeOfTuple2.ts, 2, 25)) class D implements base { d } >D : Symbol(D, Decl(bestCommonTypeOfTuple2.ts, 2, 29)) >base : Symbol(base, Decl(bestCommonTypeOfTuple2.ts, 0, 0)) ->d : Symbol(d, Decl(bestCommonTypeOfTuple2.ts, 3, 25)) +>d : Symbol(D.d, Decl(bestCommonTypeOfTuple2.ts, 3, 25)) class E implements base { e } >E : Symbol(E, Decl(bestCommonTypeOfTuple2.ts, 3, 29)) >base : Symbol(base, Decl(bestCommonTypeOfTuple2.ts, 0, 0)) ->e : Symbol(e, Decl(bestCommonTypeOfTuple2.ts, 4, 25)) +>e : Symbol(E.e, Decl(bestCommonTypeOfTuple2.ts, 4, 25)) class F extends C { f } >F : Symbol(F, Decl(bestCommonTypeOfTuple2.ts, 4, 29)) >C : Symbol(C, Decl(bestCommonTypeOfTuple2.ts, 1, 21)) ->f : Symbol(f, Decl(bestCommonTypeOfTuple2.ts, 5, 19)) +>f : Symbol(F.f, Decl(bestCommonTypeOfTuple2.ts, 5, 19)) class C1 implements base1 { i = "foo"; c } >C1 : Symbol(C1, Decl(bestCommonTypeOfTuple2.ts, 5, 23)) >base1 : Symbol(base1, Decl(bestCommonTypeOfTuple2.ts, 0, 18)) ->i : Symbol(i, Decl(bestCommonTypeOfTuple2.ts, 7, 27)) ->c : Symbol(c, Decl(bestCommonTypeOfTuple2.ts, 7, 38)) +>i : Symbol(C1.i, Decl(bestCommonTypeOfTuple2.ts, 7, 27)) +>c : Symbol(C1.c, Decl(bestCommonTypeOfTuple2.ts, 7, 38)) class D1 extends C1 { i = "bar"; d } >D1 : Symbol(D1, Decl(bestCommonTypeOfTuple2.ts, 7, 42)) >C1 : Symbol(C1, Decl(bestCommonTypeOfTuple2.ts, 5, 23)) ->i : Symbol(i, Decl(bestCommonTypeOfTuple2.ts, 8, 21)) ->d : Symbol(d, Decl(bestCommonTypeOfTuple2.ts, 8, 32)) +>i : Symbol(D1.i, Decl(bestCommonTypeOfTuple2.ts, 8, 21)) +>d : Symbol(D1.d, Decl(bestCommonTypeOfTuple2.ts, 8, 32)) var t1: [C, base]; >t1 : Symbol(t1, Decl(bestCommonTypeOfTuple2.ts, 10, 3)) diff --git a/tests/baselines/reference/bestCommonTypeReturnStatement.symbols b/tests/baselines/reference/bestCommonTypeReturnStatement.symbols index 14e770ae255..db5fb4cfbcd 100644 --- a/tests/baselines/reference/bestCommonTypeReturnStatement.symbols +++ b/tests/baselines/reference/bestCommonTypeReturnStatement.symbols @@ -5,7 +5,7 @@ interface IPromise { >T : Symbol(T, Decl(bestCommonTypeReturnStatement.ts, 1, 19)) then(successCallback: (promiseValue: T) => any, errorCallback?: (reason: any) => any): IPromise; ->then : Symbol(then, Decl(bestCommonTypeReturnStatement.ts, 1, 23)) +>then : Symbol(IPromise.then, Decl(bestCommonTypeReturnStatement.ts, 1, 23)) >successCallback : Symbol(successCallback, Decl(bestCommonTypeReturnStatement.ts, 2, 9)) >promiseValue : Symbol(promiseValue, Decl(bestCommonTypeReturnStatement.ts, 2, 27)) >T : Symbol(T, Decl(bestCommonTypeReturnStatement.ts, 1, 19)) diff --git a/tests/baselines/reference/bestCommonTypeWithContextualTyping.symbols b/tests/baselines/reference/bestCommonTypeWithContextualTyping.symbols index cfa5310bd3c..acaab09cb0e 100644 --- a/tests/baselines/reference/bestCommonTypeWithContextualTyping.symbols +++ b/tests/baselines/reference/bestCommonTypeWithContextualTyping.symbols @@ -3,20 +3,20 @@ interface Contextual { >Contextual : Symbol(Contextual, Decl(bestCommonTypeWithContextualTyping.ts, 0, 0)) dummy; ->dummy : Symbol(dummy, Decl(bestCommonTypeWithContextualTyping.ts, 0, 22)) +>dummy : Symbol(Contextual.dummy, Decl(bestCommonTypeWithContextualTyping.ts, 0, 22)) p?: number; ->p : Symbol(p, Decl(bestCommonTypeWithContextualTyping.ts, 1, 10)) +>p : Symbol(Contextual.p, Decl(bestCommonTypeWithContextualTyping.ts, 1, 10)) } interface Ellement { >Ellement : Symbol(Ellement, Decl(bestCommonTypeWithContextualTyping.ts, 3, 1)) dummy; ->dummy : Symbol(dummy, Decl(bestCommonTypeWithContextualTyping.ts, 5, 20)) +>dummy : Symbol(Ellement.dummy, Decl(bestCommonTypeWithContextualTyping.ts, 5, 20)) p: any; ->p : Symbol(p, Decl(bestCommonTypeWithContextualTyping.ts, 6, 10)) +>p : Symbol(Ellement.p, Decl(bestCommonTypeWithContextualTyping.ts, 6, 10)) } var e: Ellement; diff --git a/tests/baselines/reference/bestCommonTypeWithContextualTyping.types b/tests/baselines/reference/bestCommonTypeWithContextualTyping.types index 628fe82012a..5baca43b752 100644 --- a/tests/baselines/reference/bestCommonTypeWithContextualTyping.types +++ b/tests/baselines/reference/bestCommonTypeWithContextualTyping.types @@ -36,7 +36,7 @@ var obj: { [s: string]: Contextual } = { s: e }; // { s: Ellement; [s: string]: >obj : { [s: string]: Contextual; } >s : string >Contextual : Contextual ->{ s: e } : { [x: string]: Ellement; s: Ellement; } +>{ s: e } : { s: Ellement; } >s : Ellement >e : Ellement diff --git a/tests/baselines/reference/bestCommonTypeWithOptionalProperties.symbols b/tests/baselines/reference/bestCommonTypeWithOptionalProperties.symbols index 35e9534ddb5..5bb2dc8ecf9 100644 --- a/tests/baselines/reference/bestCommonTypeWithOptionalProperties.symbols +++ b/tests/baselines/reference/bestCommonTypeWithOptionalProperties.symbols @@ -1,17 +1,17 @@ === tests/cases/compiler/bestCommonTypeWithOptionalProperties.ts === interface X { foo: string } >X : Symbol(X, Decl(bestCommonTypeWithOptionalProperties.ts, 0, 0)) ->foo : Symbol(foo, Decl(bestCommonTypeWithOptionalProperties.ts, 0, 13)) +>foo : Symbol(X.foo, Decl(bestCommonTypeWithOptionalProperties.ts, 0, 13)) interface Y extends X { bar?: number } >Y : Symbol(Y, Decl(bestCommonTypeWithOptionalProperties.ts, 0, 27)) >X : Symbol(X, Decl(bestCommonTypeWithOptionalProperties.ts, 0, 0)) ->bar : Symbol(bar, Decl(bestCommonTypeWithOptionalProperties.ts, 1, 23)) +>bar : Symbol(Y.bar, Decl(bestCommonTypeWithOptionalProperties.ts, 1, 23)) interface Z extends X { bar: string } >Z : Symbol(Z, Decl(bestCommonTypeWithOptionalProperties.ts, 1, 38)) >X : Symbol(X, Decl(bestCommonTypeWithOptionalProperties.ts, 0, 0)) ->bar : Symbol(bar, Decl(bestCommonTypeWithOptionalProperties.ts, 2, 23)) +>bar : Symbol(Z.bar, Decl(bestCommonTypeWithOptionalProperties.ts, 2, 23)) var x: X; >x : Symbol(x, Decl(bestCommonTypeWithOptionalProperties.ts, 4, 3)) diff --git a/tests/baselines/reference/binopAssignmentShouldHaveType.symbols b/tests/baselines/reference/binopAssignmentShouldHaveType.symbols index 98f4ffee743..ae7a3c521af 100644 --- a/tests/baselines/reference/binopAssignmentShouldHaveType.symbols +++ b/tests/baselines/reference/binopAssignmentShouldHaveType.symbols @@ -10,12 +10,12 @@ module Test { >Bug : Symbol(Bug, Decl(binopAssignmentShouldHaveType.ts, 2, 13)) getName():string { ->getName : Symbol(getName, Decl(binopAssignmentShouldHaveType.ts, 3, 19)) +>getName : Symbol(Bug.getName, Decl(binopAssignmentShouldHaveType.ts, 3, 19)) return "name"; } bug() { ->bug : Symbol(bug, Decl(binopAssignmentShouldHaveType.ts, 6, 3)) +>bug : Symbol(Bug.bug, Decl(binopAssignmentShouldHaveType.ts, 6, 3)) var name:string= null; >name : Symbol(name, Decl(binopAssignmentShouldHaveType.ts, 8, 6)) @@ -23,9 +23,9 @@ module Test { if ((name= this.getName()).length > 0) { >(name= this.getName()).length : Symbol(String.length, Decl(lib.d.ts, --, --)) >name : Symbol(name, Decl(binopAssignmentShouldHaveType.ts, 8, 6)) ->this.getName : Symbol(getName, Decl(binopAssignmentShouldHaveType.ts, 3, 19)) +>this.getName : Symbol(Bug.getName, Decl(binopAssignmentShouldHaveType.ts, 3, 19)) >this : Symbol(Bug, Decl(binopAssignmentShouldHaveType.ts, 2, 13)) ->getName : Symbol(getName, Decl(binopAssignmentShouldHaveType.ts, 3, 19)) +>getName : Symbol(Bug.getName, Decl(binopAssignmentShouldHaveType.ts, 3, 19)) >length : Symbol(String.length, Decl(lib.d.ts, --, --)) console.log(name); diff --git a/tests/baselines/reference/bitwiseNotOperatorWithBooleanType.symbols b/tests/baselines/reference/bitwiseNotOperatorWithBooleanType.symbols index d6a29a11980..d52e73ba600 100644 --- a/tests/baselines/reference/bitwiseNotOperatorWithBooleanType.symbols +++ b/tests/baselines/reference/bitwiseNotOperatorWithBooleanType.symbols @@ -10,7 +10,7 @@ class A { >A : Symbol(A, Decl(bitwiseNotOperatorWithBooleanType.ts, 3, 40)) public a: boolean; ->a : Symbol(a, Decl(bitwiseNotOperatorWithBooleanType.ts, 5, 9)) +>a : Symbol(A.a, Decl(bitwiseNotOperatorWithBooleanType.ts, 5, 9)) static foo() { return false; } >foo : Symbol(A.foo, Decl(bitwiseNotOperatorWithBooleanType.ts, 6, 22)) diff --git a/tests/baselines/reference/bitwiseNotOperatorWithNumberType.symbols b/tests/baselines/reference/bitwiseNotOperatorWithNumberType.symbols index 2cb37660135..f7dd03d78c3 100644 --- a/tests/baselines/reference/bitwiseNotOperatorWithNumberType.symbols +++ b/tests/baselines/reference/bitwiseNotOperatorWithNumberType.symbols @@ -13,7 +13,7 @@ class A { >A : Symbol(A, Decl(bitwiseNotOperatorWithNumberType.ts, 4, 36)) public a: number; ->a : Symbol(a, Decl(bitwiseNotOperatorWithNumberType.ts, 6, 9)) +>a : Symbol(A.a, Decl(bitwiseNotOperatorWithNumberType.ts, 6, 9)) static foo() { return 1; } >foo : Symbol(A.foo, Decl(bitwiseNotOperatorWithNumberType.ts, 7, 21)) diff --git a/tests/baselines/reference/bitwiseNotOperatorWithStringType.symbols b/tests/baselines/reference/bitwiseNotOperatorWithStringType.symbols index 39c16a701b6..f535acc199b 100644 --- a/tests/baselines/reference/bitwiseNotOperatorWithStringType.symbols +++ b/tests/baselines/reference/bitwiseNotOperatorWithStringType.symbols @@ -13,7 +13,7 @@ class A { >A : Symbol(A, Decl(bitwiseNotOperatorWithStringType.ts, 4, 40)) public a: string; ->a : Symbol(a, Decl(bitwiseNotOperatorWithStringType.ts, 6, 9)) +>a : Symbol(A.a, Decl(bitwiseNotOperatorWithStringType.ts, 6, 9)) static foo() { return ""; } >foo : Symbol(A.foo, Decl(bitwiseNotOperatorWithStringType.ts, 7, 21)) diff --git a/tests/baselines/reference/blockScopedBindingUsedBeforeDef.errors.txt b/tests/baselines/reference/blockScopedBindingUsedBeforeDef.errors.txt new file mode 100644 index 00000000000..55b5c9dab2d --- /dev/null +++ b/tests/baselines/reference/blockScopedBindingUsedBeforeDef.errors.txt @@ -0,0 +1,23 @@ +tests/cases/compiler/blockScopedBindingUsedBeforeDef.ts(2,12): error TS2448: Block-scoped variable 'a' used before its declaration. +tests/cases/compiler/blockScopedBindingUsedBeforeDef.ts(5,12): error TS2448: Block-scoped variable 'a' used before its declaration. +tests/cases/compiler/blockScopedBindingUsedBeforeDef.ts(5,35): error TS7027: Unreachable code detected. +tests/cases/compiler/blockScopedBindingUsedBeforeDef.ts(8,7): error TS2448: Block-scoped variable 'b' used before its declaration. + + +==== tests/cases/compiler/blockScopedBindingUsedBeforeDef.ts (4 errors) ==== + // 1: + for (let {[a]: a} of [{ }]) continue; + ~ +!!! error TS2448: Block-scoped variable 'a' used before its declaration. + + // 2: + for (let {[a]: a} = { }; false; ) continue; + ~ +!!! error TS2448: Block-scoped variable 'a' used before its declaration. + ~~~~~~~~ +!!! error TS7027: Unreachable code detected. + + // 3: + let {[b]: b} = { }; + ~ +!!! error TS2448: Block-scoped variable 'b' used before its declaration. \ No newline at end of file diff --git a/tests/baselines/reference/blockScopedBindingUsedBeforeDef.js b/tests/baselines/reference/blockScopedBindingUsedBeforeDef.js new file mode 100644 index 00000000000..cc9ad56be88 --- /dev/null +++ b/tests/baselines/reference/blockScopedBindingUsedBeforeDef.js @@ -0,0 +1,21 @@ +//// [blockScopedBindingUsedBeforeDef.ts] +// 1: +for (let {[a]: a} of [{ }]) continue; + +// 2: +for (let {[a]: a} = { }; false; ) continue; + +// 3: +let {[b]: b} = { }; + +//// [blockScopedBindingUsedBeforeDef.js] +// 1: +for (var _i = 0, _a = [{}]; _i < _a.length; _i++) { + var _b = a, a = _a[_i][_b]; + continue; +} +// 2: +for (var _c = a, a = {}[_c]; false;) + continue; +// 3: +var _d = b, b = {}[_d]; diff --git a/tests/baselines/reference/blockScopedBindingsReassignedInLoop1.js b/tests/baselines/reference/blockScopedBindingsReassignedInLoop1.js new file mode 100644 index 00000000000..609d353fbc7 --- /dev/null +++ b/tests/baselines/reference/blockScopedBindingsReassignedInLoop1.js @@ -0,0 +1,22 @@ +//// [blockScopedBindingsReassignedInLoop1.ts] +declare function use(n: number): void; +(function () { + 'use strict' + for (let i = 0; i < 9; ++i) { + (() => use(++i))(); + } +})(); + +//// [blockScopedBindingsReassignedInLoop1.js] +(function () { + 'use strict'; + var _loop_1 = function(i) { + (function () { return use(++i); })(); + out_i_1 = i; + }; + var out_i_1; + for (var i = 0; i < 9; ++i) { + _loop_1(i); + i = out_i_1; + } +})(); diff --git a/tests/baselines/reference/blockScopedBindingsReassignedInLoop1.symbols b/tests/baselines/reference/blockScopedBindingsReassignedInLoop1.symbols new file mode 100644 index 00000000000..8024124b04e --- /dev/null +++ b/tests/baselines/reference/blockScopedBindingsReassignedInLoop1.symbols @@ -0,0 +1,17 @@ +=== tests/cases/compiler/blockScopedBindingsReassignedInLoop1.ts === +declare function use(n: number): void; +>use : Symbol(use, Decl(blockScopedBindingsReassignedInLoop1.ts, 0, 0)) +>n : Symbol(n, Decl(blockScopedBindingsReassignedInLoop1.ts, 0, 21)) + +(function () { + 'use strict' + for (let i = 0; i < 9; ++i) { +>i : Symbol(i, Decl(blockScopedBindingsReassignedInLoop1.ts, 3, 10)) +>i : Symbol(i, Decl(blockScopedBindingsReassignedInLoop1.ts, 3, 10)) +>i : Symbol(i, Decl(blockScopedBindingsReassignedInLoop1.ts, 3, 10)) + + (() => use(++i))(); +>use : Symbol(use, Decl(blockScopedBindingsReassignedInLoop1.ts, 0, 0)) +>i : Symbol(i, Decl(blockScopedBindingsReassignedInLoop1.ts, 3, 10)) + } +})(); diff --git a/tests/baselines/reference/blockScopedBindingsReassignedInLoop1.types b/tests/baselines/reference/blockScopedBindingsReassignedInLoop1.types new file mode 100644 index 00000000000..7ced53508e6 --- /dev/null +++ b/tests/baselines/reference/blockScopedBindingsReassignedInLoop1.types @@ -0,0 +1,32 @@ +=== tests/cases/compiler/blockScopedBindingsReassignedInLoop1.ts === +declare function use(n: number): void; +>use : (n: number) => void +>n : number + +(function () { +>(function () { 'use strict' for (let i = 0; i < 9; ++i) { (() => use(++i))(); }})() : void +>(function () { 'use strict' for (let i = 0; i < 9; ++i) { (() => use(++i))(); }}) : () => void +>function () { 'use strict' for (let i = 0; i < 9; ++i) { (() => use(++i))(); }} : () => void + + 'use strict' +>'use strict' : string + + for (let i = 0; i < 9; ++i) { +>i : number +>0 : number +>i < 9 : boolean +>i : number +>9 : number +>++i : number +>i : number + + (() => use(++i))(); +>(() => use(++i))() : void +>(() => use(++i)) : () => void +>() => use(++i) : () => void +>use(++i) : void +>use : (n: number) => void +>++i : number +>i : number + } +})(); diff --git a/tests/baselines/reference/blockScopedBindingsReassignedInLoop2.js b/tests/baselines/reference/blockScopedBindingsReassignedInLoop2.js new file mode 100644 index 00000000000..68bfd3cb676 --- /dev/null +++ b/tests/baselines/reference/blockScopedBindingsReassignedInLoop2.js @@ -0,0 +1,119 @@ +//// [blockScopedBindingsReassignedInLoop2.ts] +for (let x = 1, y = 2; x < y; ++x, --y) { + let a = () => x++ + y++; + if (x == 1) { + break; + } + else { + y = 5; + } +} + +for (let x = 1, y = 2; x < y; ++x, --y) { + let a = () => x++ + y++; + if (x == 1) { + continue; + } + else { + y = 5; + } +} + +loop: +for (let x = 1, y = 2; x < y; ++x, --y) { + let a = () => x++ + y++; + if (x == 1) { + break loop; + } + else { + y = 5; + } +} + +loop: +for (let x = 1, y = 2; x < y; ++x, --y) { + let a = () => x++ + y++; + if (x == 1) { + continue loop; + } + else { + y = 5; + } +} + +//// [blockScopedBindingsReassignedInLoop2.js] +var _loop_1 = function(x, y) { + var a = function () { return x++ + y++; }; + if (x == 1) { + return out_x_1 = x, out_y_1 = y, "break"; + } + else { + y = 5; + } + out_x_1 = x; + out_y_1 = y; +}; +var out_x_1, out_y_1; +for (var x = 1, y = 2; x < y; ++x, --y) { + var state_1 = _loop_1(x, y); + x = out_x_1; + y = out_y_1; + if (state_1 === "break") break; +} +var _loop_2 = function(x, y) { + var a = function () { return x++ + y++; }; + if (x == 1) { + return out_x_2 = x, out_y_2 = y, "continue"; + } + else { + y = 5; + } + out_x_2 = x; + out_y_2 = y; +}; +var out_x_2, out_y_2; +for (var x = 1, y = 2; x < y; ++x, --y) { + _loop_2(x, y); + x = out_x_2; + y = out_y_2; +} +var _loop_3 = function(x, y) { + var a = function () { return x++ + y++; }; + if (x == 1) { + return out_x_3 = x, out_y_3 = y, "break-loop"; + } + else { + y = 5; + } + out_x_3 = x; + out_y_3 = y; +}; +var out_x_3, out_y_3; +loop: for (var x = 1, y = 2; x < y; ++x, --y) { + var state_3 = _loop_3(x, y); + x = out_x_3; + y = out_y_3; + switch(state_3) { + case "break-loop": break loop; + } +} +var _loop_4 = function(x, y) { + var a = function () { return x++ + y++; }; + if (x == 1) { + return out_x_4 = x, out_y_4 = y, "continue-loop"; + } + else { + y = 5; + } + out_x_4 = x; + out_y_4 = y; +}; +var out_x_4, out_y_4; +loop: for (var x = 1, y = 2; x < y; ++x, --y) { + var state_4 = _loop_4(x, y); + x = out_x_4; + y = out_y_4; + switch(state_4) { + case "continue-loop": continue loop; + } +} diff --git a/tests/baselines/reference/blockScopedBindingsReassignedInLoop2.symbols b/tests/baselines/reference/blockScopedBindingsReassignedInLoop2.symbols new file mode 100644 index 00000000000..fcaea39564f --- /dev/null +++ b/tests/baselines/reference/blockScopedBindingsReassignedInLoop2.symbols @@ -0,0 +1,98 @@ +=== tests/cases/compiler/blockScopedBindingsReassignedInLoop2.ts === +for (let x = 1, y = 2; x < y; ++x, --y) { +>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop2.ts, 0, 8)) +>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop2.ts, 0, 15)) +>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop2.ts, 0, 8)) +>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop2.ts, 0, 15)) +>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop2.ts, 0, 8)) +>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop2.ts, 0, 15)) + + let a = () => x++ + y++; +>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop2.ts, 1, 7)) +>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop2.ts, 0, 8)) +>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop2.ts, 0, 15)) + + if (x == 1) { +>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop2.ts, 0, 8)) + + break; + } + else { + y = 5; +>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop2.ts, 0, 15)) + } +} + +for (let x = 1, y = 2; x < y; ++x, --y) { +>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop2.ts, 10, 8)) +>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop2.ts, 10, 15)) +>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop2.ts, 10, 8)) +>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop2.ts, 10, 15)) +>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop2.ts, 10, 8)) +>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop2.ts, 10, 15)) + + let a = () => x++ + y++; +>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop2.ts, 11, 7)) +>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop2.ts, 10, 8)) +>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop2.ts, 10, 15)) + + if (x == 1) { +>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop2.ts, 10, 8)) + + continue; + } + else { + y = 5; +>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop2.ts, 10, 15)) + } +} + +loop: +for (let x = 1, y = 2; x < y; ++x, --y) { +>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop2.ts, 21, 8)) +>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop2.ts, 21, 15)) +>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop2.ts, 21, 8)) +>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop2.ts, 21, 15)) +>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop2.ts, 21, 8)) +>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop2.ts, 21, 15)) + + let a = () => x++ + y++; +>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop2.ts, 22, 7)) +>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop2.ts, 21, 8)) +>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop2.ts, 21, 15)) + + if (x == 1) { +>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop2.ts, 21, 8)) + + break loop; + } + else { + y = 5; +>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop2.ts, 21, 15)) + } +} + +loop: +for (let x = 1, y = 2; x < y; ++x, --y) { +>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop2.ts, 32, 8)) +>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop2.ts, 32, 15)) +>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop2.ts, 32, 8)) +>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop2.ts, 32, 15)) +>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop2.ts, 32, 8)) +>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop2.ts, 32, 15)) + + let a = () => x++ + y++; +>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop2.ts, 33, 7)) +>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop2.ts, 32, 8)) +>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop2.ts, 32, 15)) + + if (x == 1) { +>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop2.ts, 32, 8)) + + continue loop; + } + else { + y = 5; +>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop2.ts, 32, 15)) + } +} diff --git a/tests/baselines/reference/blockScopedBindingsReassignedInLoop2.types b/tests/baselines/reference/blockScopedBindingsReassignedInLoop2.types new file mode 100644 index 00000000000..244160dcc6b --- /dev/null +++ b/tests/baselines/reference/blockScopedBindingsReassignedInLoop2.types @@ -0,0 +1,160 @@ +=== tests/cases/compiler/blockScopedBindingsReassignedInLoop2.ts === +for (let x = 1, y = 2; x < y; ++x, --y) { +>x : number +>1 : number +>y : number +>2 : number +>x < y : boolean +>x : number +>y : number +>++x, --y : number +>++x : number +>x : number +>--y : number +>y : number + + let a = () => x++ + y++; +>a : () => number +>() => x++ + y++ : () => number +>x++ + y++ : number +>x++ : number +>x : number +>y++ : number +>y : number + + if (x == 1) { +>x == 1 : boolean +>x : number +>1 : number + + break; + } + else { + y = 5; +>y = 5 : number +>y : number +>5 : number + } +} + +for (let x = 1, y = 2; x < y; ++x, --y) { +>x : number +>1 : number +>y : number +>2 : number +>x < y : boolean +>x : number +>y : number +>++x, --y : number +>++x : number +>x : number +>--y : number +>y : number + + let a = () => x++ + y++; +>a : () => number +>() => x++ + y++ : () => number +>x++ + y++ : number +>x++ : number +>x : number +>y++ : number +>y : number + + if (x == 1) { +>x == 1 : boolean +>x : number +>1 : number + + continue; + } + else { + y = 5; +>y = 5 : number +>y : number +>5 : number + } +} + +loop: +>loop : any + +for (let x = 1, y = 2; x < y; ++x, --y) { +>x : number +>1 : number +>y : number +>2 : number +>x < y : boolean +>x : number +>y : number +>++x, --y : number +>++x : number +>x : number +>--y : number +>y : number + + let a = () => x++ + y++; +>a : () => number +>() => x++ + y++ : () => number +>x++ + y++ : number +>x++ : number +>x : number +>y++ : number +>y : number + + if (x == 1) { +>x == 1 : boolean +>x : number +>1 : number + + break loop; +>loop : any + } + else { + y = 5; +>y = 5 : number +>y : number +>5 : number + } +} + +loop: +>loop : any + +for (let x = 1, y = 2; x < y; ++x, --y) { +>x : number +>1 : number +>y : number +>2 : number +>x < y : boolean +>x : number +>y : number +>++x, --y : number +>++x : number +>x : number +>--y : number +>y : number + + let a = () => x++ + y++; +>a : () => number +>() => x++ + y++ : () => number +>x++ + y++ : number +>x++ : number +>x : number +>y++ : number +>y : number + + if (x == 1) { +>x == 1 : boolean +>x : number +>1 : number + + continue loop; +>loop : any + } + else { + y = 5; +>y = 5 : number +>y : number +>5 : number + } +} diff --git a/tests/baselines/reference/blockScopedBindingsReassignedInLoop3.js b/tests/baselines/reference/blockScopedBindingsReassignedInLoop3.js new file mode 100644 index 00000000000..7e3bac4ff52 --- /dev/null +++ b/tests/baselines/reference/blockScopedBindingsReassignedInLoop3.js @@ -0,0 +1,245 @@ +//// [blockScopedBindingsReassignedInLoop3.ts] + +for (let x = 1, y = 2; x < y; ++x, --y) { + let a = () => x++ + y++; + if (x == 1) { + break; + } + else { + for (let a = 1; a < 5; --a) { + let f = () => a; + if (a) { + a = x; + break; + } + else { + y++; + } + } + + y = 5; + } +} + + +for (let x = 1, y = 2; x < y; ++x, --y) { + let a = () => x++ + y++; + if (x == 1) { + continue; + } + else { + for (let a = 1; a < 5; --a) { + let f = () => a; + if (a) { + a = x; + continue; + } + else { + y++; + } + } + + y = 5; + } +} + +loop2: +for (let x = 1, y = 2; x < y; ++x, --y) { + let a = () => x++ + y++; + if (x == 1) { + break loop2; + } + else { + loop1: + for (let a = 1; a < 5; --a) { + let f = () => a; + if (a) { + a = x; + break loop1; + } + else { + y++; + break loop2 + } + } + + y = 5; + } +} + +loop2: +for (let x = 1, y = 2; x < y; ++x, --y) { + let a = () => x++ + y++; + if (x == 1) { + continue loop2; + } + else { + loop1: + for (let a = 1; a < 5; --a) { + let f = () => a; + if (a) { + a = x; + continue loop1; + } + else { + y++; + continue loop2 + } + } + + y = 5; + } +} + + +//// [blockScopedBindingsReassignedInLoop3.js] +var _loop_1 = function(x, y) { + var a = function () { return x++ + y++; }; + if (x == 1) { + return out_x_1 = x, out_y_1 = y, "break"; + } + else { + var _loop_2 = function(a_1) { + var f = function () { return a_1; }; + if (a_1) { + a_1 = x; + return out_a_1_1 = a_1, "break"; + } + else { + y++; + } + out_a_1_1 = a_1; + }; + var out_a_1_1; + for (var a_1 = 1; a_1 < 5; --a_1) { + var state_1 = _loop_2(a_1); + a_1 = out_a_1_1; + if (state_1 === "break") break; + } + y = 5; + } + out_x_1 = x; + out_y_1 = y; +}; +var out_x_1, out_y_1; +for (var x = 1, y = 2; x < y; ++x, --y) { + var state_2 = _loop_1(x, y); + x = out_x_1; + y = out_y_1; + if (state_2 === "break") break; +} +var _loop_3 = function(x, y) { + var a = function () { return x++ + y++; }; + if (x == 1) { + return out_x_2 = x, out_y_2 = y, "continue"; + } + else { + var _loop_4 = function(a_2) { + var f = function () { return a_2; }; + if (a_2) { + a_2 = x; + return out_a_2_1 = a_2, "continue"; + } + else { + y++; + } + out_a_2_1 = a_2; + }; + var out_a_2_1; + for (var a_2 = 1; a_2 < 5; --a_2) { + _loop_4(a_2); + a_2 = out_a_2_1; + } + y = 5; + } + out_x_2 = x; + out_y_2 = y; +}; +var out_x_2, out_y_2; +for (var x = 1, y = 2; x < y; ++x, --y) { + _loop_3(x, y); + x = out_x_2; + y = out_y_2; +} +var _loop_5 = function(x, y) { + var a = function () { return x++ + y++; }; + if (x == 1) { + return out_x_3 = x, out_y_3 = y, "break-loop2"; + } + else { + var _loop_6 = function(a_3) { + var f = function () { return a_3; }; + if (a_3) { + a_3 = x; + return out_a_3_1 = a_3, "break-loop1"; + } + else { + y++; + return out_a_3_1 = a_3, "break-loop2"; + } + out_a_3_1 = a_3; + }; + var out_a_3_1; + loop1: for (var a_3 = 1; a_3 < 5; --a_3) { + var state_5 = _loop_6(a_3); + a_3 = out_a_3_1; + switch(state_5) { + case "break-loop1": break loop1; + case "break-loop2": return state_5; + } + } + y = 5; + } + out_x_3 = x; + out_y_3 = y; +}; +var out_x_3, out_y_3; +loop2: for (var x = 1, y = 2; x < y; ++x, --y) { + var state_6 = _loop_5(x, y); + x = out_x_3; + y = out_y_3; + switch(state_6) { + case "break-loop2": break loop2; + } +} +var _loop_7 = function(x, y) { + var a = function () { return x++ + y++; }; + if (x == 1) { + return out_x_4 = x, out_y_4 = y, "continue-loop2"; + } + else { + var _loop_8 = function(a_4) { + var f = function () { return a_4; }; + if (a_4) { + a_4 = x; + return out_a_4_1 = a_4, "continue-loop1"; + } + else { + y++; + return out_a_4_1 = a_4, "continue-loop2"; + } + out_a_4_1 = a_4; + }; + var out_a_4_1; + loop1: for (var a_4 = 1; a_4 < 5; --a_4) { + var state_7 = _loop_8(a_4); + a_4 = out_a_4_1; + switch(state_7) { + case "continue-loop1": continue loop1; + case "continue-loop2": return state_7; + } + } + y = 5; + } + out_x_4 = x; + out_y_4 = y; +}; +var out_x_4, out_y_4; +loop2: for (var x = 1, y = 2; x < y; ++x, --y) { + var state_8 = _loop_7(x, y); + x = out_x_4; + y = out_y_4; + switch(state_8) { + case "continue-loop2": continue loop2; + } +} diff --git a/tests/baselines/reference/blockScopedBindingsReassignedInLoop3.symbols b/tests/baselines/reference/blockScopedBindingsReassignedInLoop3.symbols new file mode 100644 index 00000000000..f78cd684c3a --- /dev/null +++ b/tests/baselines/reference/blockScopedBindingsReassignedInLoop3.symbols @@ -0,0 +1,203 @@ +=== tests/cases/compiler/blockScopedBindingsReassignedInLoop3.ts === + +for (let x = 1, y = 2; x < y; ++x, --y) { +>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop3.ts, 1, 8)) +>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop3.ts, 1, 15)) +>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop3.ts, 1, 8)) +>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop3.ts, 1, 15)) +>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop3.ts, 1, 8)) +>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop3.ts, 1, 15)) + + let a = () => x++ + y++; +>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 2, 7)) +>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop3.ts, 1, 8)) +>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop3.ts, 1, 15)) + + if (x == 1) { +>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop3.ts, 1, 8)) + + break; + } + else { + for (let a = 1; a < 5; --a) { +>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 7, 16)) +>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 7, 16)) +>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 7, 16)) + + let f = () => a; +>f : Symbol(f, Decl(blockScopedBindingsReassignedInLoop3.ts, 8, 15)) +>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 7, 16)) + + if (a) { +>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 7, 16)) + + a = x; +>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 7, 16)) +>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop3.ts, 1, 8)) + + break; + } + else { + y++; +>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop3.ts, 1, 15)) + } + } + + y = 5; +>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop3.ts, 1, 15)) + } +} + + +for (let x = 1, y = 2; x < y; ++x, --y) { +>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop3.ts, 23, 8)) +>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop3.ts, 23, 15)) +>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop3.ts, 23, 8)) +>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop3.ts, 23, 15)) +>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop3.ts, 23, 8)) +>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop3.ts, 23, 15)) + + let a = () => x++ + y++; +>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 24, 7)) +>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop3.ts, 23, 8)) +>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop3.ts, 23, 15)) + + if (x == 1) { +>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop3.ts, 23, 8)) + + continue; + } + else { + for (let a = 1; a < 5; --a) { +>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 29, 16)) +>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 29, 16)) +>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 29, 16)) + + let f = () => a; +>f : Symbol(f, Decl(blockScopedBindingsReassignedInLoop3.ts, 30, 15)) +>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 29, 16)) + + if (a) { +>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 29, 16)) + + a = x; +>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 29, 16)) +>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop3.ts, 23, 8)) + + continue; + } + else { + y++; +>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop3.ts, 23, 15)) + } + } + + y = 5; +>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop3.ts, 23, 15)) + } +} + +loop2: +for (let x = 1, y = 2; x < y; ++x, --y) { +>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop3.ts, 45, 8)) +>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop3.ts, 45, 15)) +>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop3.ts, 45, 8)) +>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop3.ts, 45, 15)) +>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop3.ts, 45, 8)) +>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop3.ts, 45, 15)) + + let a = () => x++ + y++; +>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 46, 7)) +>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop3.ts, 45, 8)) +>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop3.ts, 45, 15)) + + if (x == 1) { +>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop3.ts, 45, 8)) + + break loop2; + } + else { + loop1: + for (let a = 1; a < 5; --a) { +>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 52, 16)) +>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 52, 16)) +>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 52, 16)) + + let f = () => a; +>f : Symbol(f, Decl(blockScopedBindingsReassignedInLoop3.ts, 53, 15)) +>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 52, 16)) + + if (a) { +>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 52, 16)) + + a = x; +>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 52, 16)) +>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop3.ts, 45, 8)) + + break loop1; + } + else { + y++; +>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop3.ts, 45, 15)) + + break loop2 + } + } + + y = 5; +>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop3.ts, 45, 15)) + } +} + +loop2: +for (let x = 1, y = 2; x < y; ++x, --y) { +>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop3.ts, 69, 8)) +>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop3.ts, 69, 15)) +>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop3.ts, 69, 8)) +>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop3.ts, 69, 15)) +>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop3.ts, 69, 8)) +>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop3.ts, 69, 15)) + + let a = () => x++ + y++; +>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 70, 7)) +>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop3.ts, 69, 8)) +>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop3.ts, 69, 15)) + + if (x == 1) { +>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop3.ts, 69, 8)) + + continue loop2; + } + else { + loop1: + for (let a = 1; a < 5; --a) { +>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 76, 16)) +>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 76, 16)) +>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 76, 16)) + + let f = () => a; +>f : Symbol(f, Decl(blockScopedBindingsReassignedInLoop3.ts, 77, 15)) +>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 76, 16)) + + if (a) { +>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 76, 16)) + + a = x; +>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop3.ts, 76, 16)) +>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop3.ts, 69, 8)) + + continue loop1; + } + else { + y++; +>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop3.ts, 69, 15)) + + continue loop2 + } + } + + y = 5; +>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop3.ts, 69, 15)) + } +} + diff --git a/tests/baselines/reference/blockScopedBindingsReassignedInLoop3.types b/tests/baselines/reference/blockScopedBindingsReassignedInLoop3.types new file mode 100644 index 00000000000..0753391d5c2 --- /dev/null +++ b/tests/baselines/reference/blockScopedBindingsReassignedInLoop3.types @@ -0,0 +1,301 @@ +=== tests/cases/compiler/blockScopedBindingsReassignedInLoop3.ts === + +for (let x = 1, y = 2; x < y; ++x, --y) { +>x : number +>1 : number +>y : number +>2 : number +>x < y : boolean +>x : number +>y : number +>++x, --y : number +>++x : number +>x : number +>--y : number +>y : number + + let a = () => x++ + y++; +>a : () => number +>() => x++ + y++ : () => number +>x++ + y++ : number +>x++ : number +>x : number +>y++ : number +>y : number + + if (x == 1) { +>x == 1 : boolean +>x : number +>1 : number + + break; + } + else { + for (let a = 1; a < 5; --a) { +>a : number +>1 : number +>a < 5 : boolean +>a : number +>5 : number +>--a : number +>a : number + + let f = () => a; +>f : () => number +>() => a : () => number +>a : number + + if (a) { +>a : number + + a = x; +>a = x : number +>a : number +>x : number + + break; + } + else { + y++; +>y++ : number +>y : number + } + } + + y = 5; +>y = 5 : number +>y : number +>5 : number + } +} + + +for (let x = 1, y = 2; x < y; ++x, --y) { +>x : number +>1 : number +>y : number +>2 : number +>x < y : boolean +>x : number +>y : number +>++x, --y : number +>++x : number +>x : number +>--y : number +>y : number + + let a = () => x++ + y++; +>a : () => number +>() => x++ + y++ : () => number +>x++ + y++ : number +>x++ : number +>x : number +>y++ : number +>y : number + + if (x == 1) { +>x == 1 : boolean +>x : number +>1 : number + + continue; + } + else { + for (let a = 1; a < 5; --a) { +>a : number +>1 : number +>a < 5 : boolean +>a : number +>5 : number +>--a : number +>a : number + + let f = () => a; +>f : () => number +>() => a : () => number +>a : number + + if (a) { +>a : number + + a = x; +>a = x : number +>a : number +>x : number + + continue; + } + else { + y++; +>y++ : number +>y : number + } + } + + y = 5; +>y = 5 : number +>y : number +>5 : number + } +} + +loop2: +>loop2 : any + +for (let x = 1, y = 2; x < y; ++x, --y) { +>x : number +>1 : number +>y : number +>2 : number +>x < y : boolean +>x : number +>y : number +>++x, --y : number +>++x : number +>x : number +>--y : number +>y : number + + let a = () => x++ + y++; +>a : () => number +>() => x++ + y++ : () => number +>x++ + y++ : number +>x++ : number +>x : number +>y++ : number +>y : number + + if (x == 1) { +>x == 1 : boolean +>x : number +>1 : number + + break loop2; +>loop2 : any + } + else { + loop1: +>loop1 : any + + for (let a = 1; a < 5; --a) { +>a : number +>1 : number +>a < 5 : boolean +>a : number +>5 : number +>--a : number +>a : number + + let f = () => a; +>f : () => number +>() => a : () => number +>a : number + + if (a) { +>a : number + + a = x; +>a = x : number +>a : number +>x : number + + break loop1; +>loop1 : any + } + else { + y++; +>y++ : number +>y : number + + break loop2 +>loop2 : any + } + } + + y = 5; +>y = 5 : number +>y : number +>5 : number + } +} + +loop2: +>loop2 : any + +for (let x = 1, y = 2; x < y; ++x, --y) { +>x : number +>1 : number +>y : number +>2 : number +>x < y : boolean +>x : number +>y : number +>++x, --y : number +>++x : number +>x : number +>--y : number +>y : number + + let a = () => x++ + y++; +>a : () => number +>() => x++ + y++ : () => number +>x++ + y++ : number +>x++ : number +>x : number +>y++ : number +>y : number + + if (x == 1) { +>x == 1 : boolean +>x : number +>1 : number + + continue loop2; +>loop2 : any + } + else { + loop1: +>loop1 : any + + for (let a = 1; a < 5; --a) { +>a : number +>1 : number +>a < 5 : boolean +>a : number +>5 : number +>--a : number +>a : number + + let f = () => a; +>f : () => number +>() => a : () => number +>a : number + + if (a) { +>a : number + + a = x; +>a = x : number +>a : number +>x : number + + continue loop1; +>loop1 : any + } + else { + y++; +>y++ : number +>y : number + + continue loop2 +>loop2 : any + } + } + + y = 5; +>y = 5 : number +>y : number +>5 : number + } +} + diff --git a/tests/baselines/reference/blockScopedBindingsReassignedInLoop4.js b/tests/baselines/reference/blockScopedBindingsReassignedInLoop4.js new file mode 100644 index 00000000000..8bff867dc95 --- /dev/null +++ b/tests/baselines/reference/blockScopedBindingsReassignedInLoop4.js @@ -0,0 +1,34 @@ +//// [blockScopedBindingsReassignedInLoop4.ts] +function f1() { + for (let x = 1, y = 2; x < y; ++x, --y) { + let a = () => x++ + y++; + if (x == 1) { + return 1; + } + else { + y = 5; + } + } +} + +//// [blockScopedBindingsReassignedInLoop4.js] +function f1() { + var _loop_1 = function(x, y) { + var a = function () { return x++ + y++; }; + if (x == 1) { + return { value: 1 }; + } + else { + y = 5; + } + out_x_1 = x; + out_y_1 = y; + }; + var out_x_1, out_y_1; + for (var x = 1, y = 2; x < y; ++x, --y) { + var state_1 = _loop_1(x, y); + x = out_x_1; + y = out_y_1; + if (typeof state_1 === "object") return state_1.value; + } +} diff --git a/tests/baselines/reference/blockScopedBindingsReassignedInLoop4.symbols b/tests/baselines/reference/blockScopedBindingsReassignedInLoop4.symbols new file mode 100644 index 00000000000..90c63914b9f --- /dev/null +++ b/tests/baselines/reference/blockScopedBindingsReassignedInLoop4.symbols @@ -0,0 +1,28 @@ +=== tests/cases/compiler/blockScopedBindingsReassignedInLoop4.ts === +function f1() { +>f1 : Symbol(f1, Decl(blockScopedBindingsReassignedInLoop4.ts, 0, 0)) + + for (let x = 1, y = 2; x < y; ++x, --y) { +>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop4.ts, 1, 12)) +>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop4.ts, 1, 19)) +>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop4.ts, 1, 12)) +>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop4.ts, 1, 19)) +>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop4.ts, 1, 12)) +>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop4.ts, 1, 19)) + + let a = () => x++ + y++; +>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop4.ts, 2, 11)) +>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop4.ts, 1, 12)) +>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop4.ts, 1, 19)) + + if (x == 1) { +>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop4.ts, 1, 12)) + + return 1; + } + else { + y = 5; +>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop4.ts, 1, 19)) + } + } +} diff --git a/tests/baselines/reference/blockScopedBindingsReassignedInLoop4.types b/tests/baselines/reference/blockScopedBindingsReassignedInLoop4.types new file mode 100644 index 00000000000..006f536ccca --- /dev/null +++ b/tests/baselines/reference/blockScopedBindingsReassignedInLoop4.types @@ -0,0 +1,43 @@ +=== tests/cases/compiler/blockScopedBindingsReassignedInLoop4.ts === +function f1() { +>f1 : () => number + + for (let x = 1, y = 2; x < y; ++x, --y) { +>x : number +>1 : number +>y : number +>2 : number +>x < y : boolean +>x : number +>y : number +>++x, --y : number +>++x : number +>x : number +>--y : number +>y : number + + let a = () => x++ + y++; +>a : () => number +>() => x++ + y++ : () => number +>x++ + y++ : number +>x++ : number +>x : number +>y++ : number +>y : number + + if (x == 1) { +>x == 1 : boolean +>x : number +>1 : number + + return 1; +>1 : number + } + else { + y = 5; +>y = 5 : number +>y : number +>5 : number + } + } +} diff --git a/tests/baselines/reference/blockScopedBindingsReassignedInLoop5.js b/tests/baselines/reference/blockScopedBindingsReassignedInLoop5.js new file mode 100644 index 00000000000..a891147317d --- /dev/null +++ b/tests/baselines/reference/blockScopedBindingsReassignedInLoop5.js @@ -0,0 +1,27 @@ +//// [blockScopedBindingsReassignedInLoop5.ts] +for (let x = 1, y = 2; x < y; ++x, --y) { + let a = () => x++ + y++; + if (x == 1) + break; + else + y = 5; +} + + +//// [blockScopedBindingsReassignedInLoop5.js] +var _loop_1 = function(x, y) { + var a = function () { return x++ + y++; }; + if (x == 1) + return out_x_1 = x, out_y_1 = y, "break"; + else + y = 5; + out_x_1 = x; + out_y_1 = y; +}; +var out_x_1, out_y_1; +for (var x = 1, y = 2; x < y; ++x, --y) { + var state_1 = _loop_1(x, y); + x = out_x_1; + y = out_y_1; + if (state_1 === "break") break; +} diff --git a/tests/baselines/reference/blockScopedBindingsReassignedInLoop5.symbols b/tests/baselines/reference/blockScopedBindingsReassignedInLoop5.symbols new file mode 100644 index 00000000000..0edc6abe34d --- /dev/null +++ b/tests/baselines/reference/blockScopedBindingsReassignedInLoop5.symbols @@ -0,0 +1,23 @@ +=== tests/cases/compiler/blockScopedBindingsReassignedInLoop5.ts === +for (let x = 1, y = 2; x < y; ++x, --y) { +>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop5.ts, 0, 8)) +>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop5.ts, 0, 15)) +>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop5.ts, 0, 8)) +>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop5.ts, 0, 15)) +>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop5.ts, 0, 8)) +>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop5.ts, 0, 15)) + + let a = () => x++ + y++; +>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop5.ts, 1, 7)) +>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop5.ts, 0, 8)) +>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop5.ts, 0, 15)) + + if (x == 1) +>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop5.ts, 0, 8)) + + break; + else + y = 5; +>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop5.ts, 0, 15)) +} + diff --git a/tests/baselines/reference/blockScopedBindingsReassignedInLoop5.types b/tests/baselines/reference/blockScopedBindingsReassignedInLoop5.types new file mode 100644 index 00000000000..530978dc722 --- /dev/null +++ b/tests/baselines/reference/blockScopedBindingsReassignedInLoop5.types @@ -0,0 +1,37 @@ +=== tests/cases/compiler/blockScopedBindingsReassignedInLoop5.ts === +for (let x = 1, y = 2; x < y; ++x, --y) { +>x : number +>1 : number +>y : number +>2 : number +>x < y : boolean +>x : number +>y : number +>++x, --y : number +>++x : number +>x : number +>--y : number +>y : number + + let a = () => x++ + y++; +>a : () => number +>() => x++ + y++ : () => number +>x++ + y++ : number +>x++ : number +>x : number +>y++ : number +>y : number + + if (x == 1) +>x == 1 : boolean +>x : number +>1 : number + + break; + else + y = 5; +>y = 5 : number +>y : number +>5 : number +} + diff --git a/tests/baselines/reference/blockScopedBindingsReassignedInLoop6.js b/tests/baselines/reference/blockScopedBindingsReassignedInLoop6.js new file mode 100644 index 00000000000..a2a074ed4df --- /dev/null +++ b/tests/baselines/reference/blockScopedBindingsReassignedInLoop6.js @@ -0,0 +1,74 @@ +//// [blockScopedBindingsReassignedInLoop6.ts] +function f1() { + for (let [x, y] = [1, 2]; x < y; ++x, --y) { + let a = () => x++ + y++; + if (x == 1) + break; + else if (y == 2) + y = 5; + else + return; + } +} + +function f2() { + for (let [{a: x, b: {c: y}}] = [{a: 1, b: {c: 2}}]; x < y; ++x, --y) { + let a = () => x++ + y++; + if (x == 1) + break; + else if (y == 2) + y = 5; + else + return; + } +} + + + + + + + +//// [blockScopedBindingsReassignedInLoop6.js] +function f1() { + var _loop_1 = function(x, y) { + var a = function () { return x++ + y++; }; + if (x == 1) + return out_x_1 = x, out_y_1 = y, "break"; + else if (y == 2) + y = 5; + else + return { value: void 0 }; + out_x_1 = x; + out_y_1 = y; + }; + var out_x_1, out_y_1; + for (var _a = [1, 2], x = _a[0], y = _a[1]; x < y; ++x, --y) { + var state_1 = _loop_1(x, y); + x = out_x_1; + y = out_y_1; + if (typeof state_1 === "object") return state_1.value; + if (state_1 === "break") break; + } +} +function f2() { + var _loop_2 = function(x, y) { + var a = function () { return x++ + y++; }; + if (x == 1) + return out_x_2 = x, out_y_2 = y, "break"; + else if (y == 2) + y = 5; + else + return { value: void 0 }; + out_x_2 = x; + out_y_2 = y; + }; + var out_x_2, out_y_2; + for (var _a = [{ a: 1, b: { c: 2 } }][0], x = _a.a, y = _a.b.c; x < y; ++x, --y) { + var state_2 = _loop_2(x, y); + x = out_x_2; + y = out_y_2; + if (typeof state_2 === "object") return state_2.value; + if (state_2 === "break") break; + } +} diff --git a/tests/baselines/reference/blockScopedBindingsReassignedInLoop6.symbols b/tests/baselines/reference/blockScopedBindingsReassignedInLoop6.symbols new file mode 100644 index 00000000000..8dda6eedd47 --- /dev/null +++ b/tests/baselines/reference/blockScopedBindingsReassignedInLoop6.symbols @@ -0,0 +1,74 @@ +=== tests/cases/compiler/blockScopedBindingsReassignedInLoop6.ts === +function f1() { +>f1 : Symbol(f1, Decl(blockScopedBindingsReassignedInLoop6.ts, 0, 0)) + + for (let [x, y] = [1, 2]; x < y; ++x, --y) { +>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop6.ts, 1, 14)) +>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop6.ts, 1, 16)) +>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop6.ts, 1, 14)) +>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop6.ts, 1, 16)) +>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop6.ts, 1, 14)) +>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop6.ts, 1, 16)) + + let a = () => x++ + y++; +>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop6.ts, 2, 11)) +>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop6.ts, 1, 14)) +>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop6.ts, 1, 16)) + + if (x == 1) +>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop6.ts, 1, 14)) + + break; + else if (y == 2) +>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop6.ts, 1, 16)) + + y = 5; +>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop6.ts, 1, 16)) + + else + return; + } +} + +function f2() { +>f2 : Symbol(f2, Decl(blockScopedBindingsReassignedInLoop6.ts, 10, 1)) + + for (let [{a: x, b: {c: y}}] = [{a: 1, b: {c: 2}}]; x < y; ++x, --y) { +>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop6.ts, 13, 37)) +>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop6.ts, 13, 15)) +>b : Symbol(b, Decl(blockScopedBindingsReassignedInLoop6.ts, 13, 42)) +>c : Symbol(c, Decl(blockScopedBindingsReassignedInLoop6.ts, 13, 47)) +>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop6.ts, 13, 25)) +>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop6.ts, 13, 37)) +>b : Symbol(b, Decl(blockScopedBindingsReassignedInLoop6.ts, 13, 42)) +>c : Symbol(c, Decl(blockScopedBindingsReassignedInLoop6.ts, 13, 47)) +>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop6.ts, 13, 15)) +>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop6.ts, 13, 25)) +>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop6.ts, 13, 15)) +>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop6.ts, 13, 25)) + + let a = () => x++ + y++; +>a : Symbol(a, Decl(blockScopedBindingsReassignedInLoop6.ts, 14, 11)) +>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop6.ts, 13, 15)) +>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop6.ts, 13, 25)) + + if (x == 1) +>x : Symbol(x, Decl(blockScopedBindingsReassignedInLoop6.ts, 13, 15)) + + break; + else if (y == 2) +>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop6.ts, 13, 25)) + + y = 5; +>y : Symbol(y, Decl(blockScopedBindingsReassignedInLoop6.ts, 13, 25)) + + else + return; + } +} + + + + + + diff --git a/tests/baselines/reference/blockScopedBindingsReassignedInLoop6.types b/tests/baselines/reference/blockScopedBindingsReassignedInLoop6.types new file mode 100644 index 00000000000..673c0788a03 --- /dev/null +++ b/tests/baselines/reference/blockScopedBindingsReassignedInLoop6.types @@ -0,0 +1,110 @@ +=== tests/cases/compiler/blockScopedBindingsReassignedInLoop6.ts === +function f1() { +>f1 : () => void + + for (let [x, y] = [1, 2]; x < y; ++x, --y) { +>x : number +>y : number +>[1, 2] : [number, number] +>1 : number +>2 : number +>x < y : boolean +>x : number +>y : number +>++x, --y : number +>++x : number +>x : number +>--y : number +>y : number + + let a = () => x++ + y++; +>a : () => number +>() => x++ + y++ : () => number +>x++ + y++ : number +>x++ : number +>x : number +>y++ : number +>y : number + + if (x == 1) +>x == 1 : boolean +>x : number +>1 : number + + break; + else if (y == 2) +>y == 2 : boolean +>y : number +>2 : number + + y = 5; +>y = 5 : number +>y : number +>5 : number + + else + return; + } +} + +function f2() { +>f2 : () => void + + for (let [{a: x, b: {c: y}}] = [{a: 1, b: {c: 2}}]; x < y; ++x, --y) { +>a : any +>x : number +>b : any +>c : any +>y : number +>[{a: 1, b: {c: 2}}] : [{ a: number; b: { c: number; }; }] +>{a: 1, b: {c: 2}} : { a: number; b: { c: number; }; } +>a : number +>1 : number +>b : { c: number; } +>{c: 2} : { c: number; } +>c : number +>2 : number +>x < y : boolean +>x : number +>y : number +>++x, --y : number +>++x : number +>x : number +>--y : number +>y : number + + let a = () => x++ + y++; +>a : () => number +>() => x++ + y++ : () => number +>x++ + y++ : number +>x++ : number +>x : number +>y++ : number +>y : number + + if (x == 1) +>x == 1 : boolean +>x : number +>1 : number + + break; + else if (y == 2) +>y == 2 : boolean +>y : number +>2 : number + + y = 5; +>y = 5 : number +>y : number +>5 : number + + else + return; + } +} + + + + + + diff --git a/tests/baselines/reference/blockScopedFunctionDeclarationES5.js b/tests/baselines/reference/blockScopedFunctionDeclarationES5.js new file mode 100644 index 00000000000..066dd07351c --- /dev/null +++ b/tests/baselines/reference/blockScopedFunctionDeclarationES5.js @@ -0,0 +1,13 @@ +//// [blockScopedFunctionDeclarationES5.ts] +if (true) { + function foo() { } + foo(); +} +foo(); + +//// [blockScopedFunctionDeclarationES5.js] +if (true) { + function foo() { } + foo(); +} +foo(); diff --git a/tests/baselines/reference/blockScopedFunctionDeclarationES5.symbols b/tests/baselines/reference/blockScopedFunctionDeclarationES5.symbols new file mode 100644 index 00000000000..5c8f82cf0ff --- /dev/null +++ b/tests/baselines/reference/blockScopedFunctionDeclarationES5.symbols @@ -0,0 +1,11 @@ +=== tests/cases/compiler/blockScopedFunctionDeclarationES5.ts === +if (true) { + function foo() { } +>foo : Symbol(foo, Decl(blockScopedFunctionDeclarationES5.ts, 0, 11)) + + foo(); +>foo : Symbol(foo, Decl(blockScopedFunctionDeclarationES5.ts, 0, 11)) +} +foo(); +>foo : Symbol(foo, Decl(blockScopedFunctionDeclarationES5.ts, 0, 11)) + diff --git a/tests/baselines/reference/blockScopedFunctionDeclarationES5.types b/tests/baselines/reference/blockScopedFunctionDeclarationES5.types new file mode 100644 index 00000000000..b3c4d9b7d73 --- /dev/null +++ b/tests/baselines/reference/blockScopedFunctionDeclarationES5.types @@ -0,0 +1,15 @@ +=== tests/cases/compiler/blockScopedFunctionDeclarationES5.ts === +if (true) { +>true : boolean + + function foo() { } +>foo : () => void + + foo(); +>foo() : void +>foo : () => void +} +foo(); +>foo() : void +>foo : () => void + diff --git a/tests/baselines/reference/blockScopedFunctionDeclarationES6.js b/tests/baselines/reference/blockScopedFunctionDeclarationES6.js new file mode 100644 index 00000000000..32450cd66f1 --- /dev/null +++ b/tests/baselines/reference/blockScopedFunctionDeclarationES6.js @@ -0,0 +1,13 @@ +//// [blockScopedFunctionDeclarationES6.ts] +if (true) { + function foo() { } + foo(); +} +foo(); + +//// [blockScopedFunctionDeclarationES6.js] +if (true) { + function foo() { } + foo(); +} +foo(); diff --git a/tests/baselines/reference/blockScopedFunctionDeclarationES6.symbols b/tests/baselines/reference/blockScopedFunctionDeclarationES6.symbols new file mode 100644 index 00000000000..65fb133b446 --- /dev/null +++ b/tests/baselines/reference/blockScopedFunctionDeclarationES6.symbols @@ -0,0 +1,11 @@ +=== tests/cases/compiler/blockScopedFunctionDeclarationES6.ts === +if (true) { + function foo() { } +>foo : Symbol(foo, Decl(blockScopedFunctionDeclarationES6.ts, 0, 11)) + + foo(); +>foo : Symbol(foo, Decl(blockScopedFunctionDeclarationES6.ts, 0, 11)) +} +foo(); +>foo : Symbol(foo, Decl(blockScopedFunctionDeclarationES6.ts, 0, 11)) + diff --git a/tests/baselines/reference/blockScopedFunctionDeclarationES6.types b/tests/baselines/reference/blockScopedFunctionDeclarationES6.types new file mode 100644 index 00000000000..7ab74feb0ed --- /dev/null +++ b/tests/baselines/reference/blockScopedFunctionDeclarationES6.types @@ -0,0 +1,15 @@ +=== tests/cases/compiler/blockScopedFunctionDeclarationES6.ts === +if (true) { +>true : boolean + + function foo() { } +>foo : () => void + + foo(); +>foo() : void +>foo : () => void +} +foo(); +>foo() : void +>foo : () => void + diff --git a/tests/baselines/reference/blockScopedFunctionDeclarationInStrictClass.errors.txt b/tests/baselines/reference/blockScopedFunctionDeclarationInStrictClass.errors.txt new file mode 100644 index 00000000000..efedfd097a6 --- /dev/null +++ b/tests/baselines/reference/blockScopedFunctionDeclarationInStrictClass.errors.txt @@ -0,0 +1,18 @@ +tests/cases/compiler/blockScopedFunctionDeclarationInStrictClass.ts(4,22): error TS1251: Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. Class definitions are automatically in strict mode. +tests/cases/compiler/blockScopedFunctionDeclarationInStrictClass.ts(7,9): error TS2304: Cannot find name 'foo'. + + +==== tests/cases/compiler/blockScopedFunctionDeclarationInStrictClass.ts (2 errors) ==== + class c { + method() { + if (true) { + function foo() { } + ~~~ +!!! error TS1251: Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. Class definitions are automatically in strict mode. + foo(); // ok + } + foo(); // not ok + ~~~ +!!! error TS2304: Cannot find name 'foo'. + } + } \ No newline at end of file diff --git a/tests/baselines/reference/blockScopedFunctionDeclarationInStrictClass.js b/tests/baselines/reference/blockScopedFunctionDeclarationInStrictClass.js new file mode 100644 index 00000000000..70a00a95a41 --- /dev/null +++ b/tests/baselines/reference/blockScopedFunctionDeclarationInStrictClass.js @@ -0,0 +1,24 @@ +//// [blockScopedFunctionDeclarationInStrictClass.ts] +class c { + method() { + if (true) { + function foo() { } + foo(); // ok + } + foo(); // not ok + } +} + +//// [blockScopedFunctionDeclarationInStrictClass.js] +var c = (function () { + function c() { + } + c.prototype.method = function () { + if (true) { + function foo() { } + foo(); // ok + } + foo(); // not ok + }; + return c; +}()); diff --git a/tests/baselines/reference/blockScopedFunctionDeclarationInStrictModule.errors.txt b/tests/baselines/reference/blockScopedFunctionDeclarationInStrictModule.errors.txt new file mode 100644 index 00000000000..3f53ef24b58 --- /dev/null +++ b/tests/baselines/reference/blockScopedFunctionDeclarationInStrictModule.errors.txt @@ -0,0 +1,15 @@ +tests/cases/compiler/blockScopedFunctionDeclarationInStrictModule.ts(2,14): error TS1252: Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. Modules are automatically in strict mode. +tests/cases/compiler/blockScopedFunctionDeclarationInStrictModule.ts(6,10): error TS2304: Cannot find name 'foo'. + + +==== tests/cases/compiler/blockScopedFunctionDeclarationInStrictModule.ts (2 errors) ==== + if (true) { + function foo() { } + ~~~ +!!! error TS1252: Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. Modules are automatically in strict mode. + foo(); // ok + } + + export = foo; // not ok + ~~~ +!!! error TS2304: Cannot find name 'foo'. \ No newline at end of file diff --git a/tests/baselines/reference/blockScopedFunctionDeclarationInStrictModule.js b/tests/baselines/reference/blockScopedFunctionDeclarationInStrictModule.js new file mode 100644 index 00000000000..d1a8091871c --- /dev/null +++ b/tests/baselines/reference/blockScopedFunctionDeclarationInStrictModule.js @@ -0,0 +1,17 @@ +//// [blockScopedFunctionDeclarationInStrictModule.ts] +if (true) { + function foo() { } + foo(); // ok +} + +export = foo; // not ok + +//// [blockScopedFunctionDeclarationInStrictModule.js] +define(["require", "exports"], function (require, exports) { + "use strict"; + if (true) { + function foo() { } + foo(); // ok + } + return foo; +}); diff --git a/tests/baselines/reference/blockScopedFunctionDeclarationStrictES5.errors.txt b/tests/baselines/reference/blockScopedFunctionDeclarationStrictES5.errors.txt new file mode 100644 index 00000000000..f945d0eacbf --- /dev/null +++ b/tests/baselines/reference/blockScopedFunctionDeclarationStrictES5.errors.txt @@ -0,0 +1,15 @@ +tests/cases/compiler/blockScopedFunctionDeclarationStrictES5.ts(3,14): error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. +tests/cases/compiler/blockScopedFunctionDeclarationStrictES5.ts(6,1): error TS2304: Cannot find name 'foo'. + + +==== tests/cases/compiler/blockScopedFunctionDeclarationStrictES5.ts (2 errors) ==== + "use strict"; + if (true) { + function foo() { } // Error to declare function in block scope + ~~~ +!!! error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. + foo(); // This call should be ok + } + foo(); // Error to find name foo + ~~~ +!!! error TS2304: Cannot find name 'foo'. \ No newline at end of file diff --git a/tests/baselines/reference/blockScopedFunctionDeclarationStrictES5.js b/tests/baselines/reference/blockScopedFunctionDeclarationStrictES5.js new file mode 100644 index 00000000000..f0926cadf39 --- /dev/null +++ b/tests/baselines/reference/blockScopedFunctionDeclarationStrictES5.js @@ -0,0 +1,15 @@ +//// [blockScopedFunctionDeclarationStrictES5.ts] +"use strict"; +if (true) { + function foo() { } // Error to declare function in block scope + foo(); // This call should be ok +} +foo(); // Error to find name foo + +//// [blockScopedFunctionDeclarationStrictES5.js] +"use strict"; +if (true) { + function foo() { } // Error to declare function in block scope + foo(); // This call should be ok +} +foo(); // Error to find name foo diff --git a/tests/baselines/reference/blockScopedFunctionDeclarationStrictES6.errors.txt b/tests/baselines/reference/blockScopedFunctionDeclarationStrictES6.errors.txt new file mode 100644 index 00000000000..6772a29926b --- /dev/null +++ b/tests/baselines/reference/blockScopedFunctionDeclarationStrictES6.errors.txt @@ -0,0 +1,12 @@ +tests/cases/compiler/blockScopedFunctionDeclarationStrictES6.ts(6,1): error TS2304: Cannot find name 'foo'. + + +==== tests/cases/compiler/blockScopedFunctionDeclarationStrictES6.ts (1 errors) ==== + "use strict"; + if (true) { + function foo() { } // Allowed to declare block scope function + foo(); // This call should be ok + } + foo(); // Cannot find name since foo is block scoped + ~~~ +!!! error TS2304: Cannot find name 'foo'. \ No newline at end of file diff --git a/tests/baselines/reference/blockScopedFunctionDeclarationStrictES6.js b/tests/baselines/reference/blockScopedFunctionDeclarationStrictES6.js new file mode 100644 index 00000000000..0a1b263875b --- /dev/null +++ b/tests/baselines/reference/blockScopedFunctionDeclarationStrictES6.js @@ -0,0 +1,15 @@ +//// [blockScopedFunctionDeclarationStrictES6.ts] +"use strict"; +if (true) { + function foo() { } // Allowed to declare block scope function + foo(); // This call should be ok +} +foo(); // Cannot find name since foo is block scoped + +//// [blockScopedFunctionDeclarationStrictES6.js] +"use strict"; +if (true) { + function foo() { } // Allowed to declare block scope function + foo(); // This call should be ok +} +foo(); // Cannot find name since foo is block scoped diff --git a/tests/baselines/reference/blockScopedSameNameFunctionDeclarationES5.errors.txt b/tests/baselines/reference/blockScopedSameNameFunctionDeclarationES5.errors.txt new file mode 100644 index 00000000000..3efa85d1cc7 --- /dev/null +++ b/tests/baselines/reference/blockScopedSameNameFunctionDeclarationES5.errors.txt @@ -0,0 +1,37 @@ +tests/cases/compiler/blockScopedSameNameFunctionDeclarationES5.ts(3,18): error TS2393: Duplicate function implementation. +tests/cases/compiler/blockScopedSameNameFunctionDeclarationES5.ts(5,9): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/blockScopedSameNameFunctionDeclarationES5.ts(8,18): error TS2393: Duplicate function implementation. +tests/cases/compiler/blockScopedSameNameFunctionDeclarationES5.ts(10,9): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/blockScopedSameNameFunctionDeclarationES5.ts(12,5): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/blockScopedSameNameFunctionDeclarationES5.ts(16,1): error TS2346: Supplied parameters do not match any signature of call target. + + +==== tests/cases/compiler/blockScopedSameNameFunctionDeclarationES5.ts (6 errors) ==== + function foo(a: number) { + if (a === 1) { + function foo() { } // duplicate function + ~~~ +!!! error TS2393: Duplicate function implementation. + foo(); + foo(10); // not ok + ~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. + } + else { + function foo() { } // duplicate function + ~~~ +!!! error TS2393: Duplicate function implementation. + foo(); + foo(10); // not ok + ~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. + } + foo(10); // not ok + ~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. + foo(); + } + foo(10); + foo(); // not ok - needs number + ~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. \ No newline at end of file diff --git a/tests/baselines/reference/blockScopedSameNameFunctionDeclarationES5.js b/tests/baselines/reference/blockScopedSameNameFunctionDeclarationES5.js new file mode 100644 index 00000000000..4c7721f9b43 --- /dev/null +++ b/tests/baselines/reference/blockScopedSameNameFunctionDeclarationES5.js @@ -0,0 +1,35 @@ +//// [blockScopedSameNameFunctionDeclarationES5.ts] +function foo(a: number) { + if (a === 1) { + function foo() { } // duplicate function + foo(); + foo(10); // not ok + } + else { + function foo() { } // duplicate function + foo(); + foo(10); // not ok + } + foo(10); // not ok + foo(); +} +foo(10); +foo(); // not ok - needs number + +//// [blockScopedSameNameFunctionDeclarationES5.js] +function foo(a) { + if (a === 1) { + function foo() { } // duplicate function + foo(); + foo(10); // not ok + } + else { + function foo() { } // duplicate function + foo(); + foo(10); // not ok + } + foo(10); // not ok + foo(); +} +foo(10); +foo(); // not ok - needs number diff --git a/tests/baselines/reference/blockScopedSameNameFunctionDeclarationES6.errors.txt b/tests/baselines/reference/blockScopedSameNameFunctionDeclarationES6.errors.txt new file mode 100644 index 00000000000..5d15278f098 --- /dev/null +++ b/tests/baselines/reference/blockScopedSameNameFunctionDeclarationES6.errors.txt @@ -0,0 +1,37 @@ +tests/cases/compiler/blockScopedSameNameFunctionDeclarationES6.ts(3,18): error TS2393: Duplicate function implementation. +tests/cases/compiler/blockScopedSameNameFunctionDeclarationES6.ts(5,9): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/blockScopedSameNameFunctionDeclarationES6.ts(8,18): error TS2393: Duplicate function implementation. +tests/cases/compiler/blockScopedSameNameFunctionDeclarationES6.ts(10,9): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/blockScopedSameNameFunctionDeclarationES6.ts(12,5): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/blockScopedSameNameFunctionDeclarationES6.ts(16,1): error TS2346: Supplied parameters do not match any signature of call target. + + +==== tests/cases/compiler/blockScopedSameNameFunctionDeclarationES6.ts (6 errors) ==== + function foo(a: number) { + if (a === 10) { + function foo() { } // duplicate + ~~~ +!!! error TS2393: Duplicate function implementation. + foo(); + foo(10); // not ok + ~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. + } + else { + function foo() { } // duplicate + ~~~ +!!! error TS2393: Duplicate function implementation. + foo(); + foo(10);// not ok + ~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. + } + foo(10); // not ok + ~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. + foo(); + } + foo(10); + foo(); // not ok - needs number + ~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. \ No newline at end of file diff --git a/tests/baselines/reference/blockScopedSameNameFunctionDeclarationES6.js b/tests/baselines/reference/blockScopedSameNameFunctionDeclarationES6.js new file mode 100644 index 00000000000..c793b74c60a --- /dev/null +++ b/tests/baselines/reference/blockScopedSameNameFunctionDeclarationES6.js @@ -0,0 +1,35 @@ +//// [blockScopedSameNameFunctionDeclarationES6.ts] +function foo(a: number) { + if (a === 10) { + function foo() { } // duplicate + foo(); + foo(10); // not ok + } + else { + function foo() { } // duplicate + foo(); + foo(10);// not ok + } + foo(10); // not ok + foo(); +} +foo(10); +foo(); // not ok - needs number + +//// [blockScopedSameNameFunctionDeclarationES6.js] +function foo(a) { + if (a === 10) { + function foo() { } // duplicate + foo(); + foo(10); // not ok + } + else { + function foo() { } // duplicate + foo(); + foo(10); // not ok + } + foo(10); // not ok + foo(); +} +foo(10); +foo(); // not ok - needs number diff --git a/tests/baselines/reference/blockScopedSameNameFunctionDeclarationStrictES5.errors.txt b/tests/baselines/reference/blockScopedSameNameFunctionDeclarationStrictES5.errors.txt new file mode 100644 index 00000000000..36ce2d8c488 --- /dev/null +++ b/tests/baselines/reference/blockScopedSameNameFunctionDeclarationStrictES5.errors.txt @@ -0,0 +1,38 @@ +tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES5.ts(4,18): error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. +tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES5.ts(6,9): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES5.ts(9,18): error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. +tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES5.ts(11,9): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES5.ts(14,5): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES5.ts(17,1): error TS2346: Supplied parameters do not match any signature of call target. + + +==== tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES5.ts (6 errors) ==== + "use strict"; + function foo(a: number) { + if (a === 1) { + function foo() { } // Error to declare function in block scope + ~~~ +!!! error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. + foo(); + foo(10); // not ok + ~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. + } + else { + function foo() { } // Error to declare function in block scope + ~~~ +!!! error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. + foo(); + foo(10); // not ok + ~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. + } + foo(10); + foo(); // not ok - needs number + ~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. + } + foo(10); + foo(); // not ok - needs number + ~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. \ No newline at end of file diff --git a/tests/baselines/reference/blockScopedSameNameFunctionDeclarationStrictES5.js b/tests/baselines/reference/blockScopedSameNameFunctionDeclarationStrictES5.js new file mode 100644 index 00000000000..b51be0493cd --- /dev/null +++ b/tests/baselines/reference/blockScopedSameNameFunctionDeclarationStrictES5.js @@ -0,0 +1,37 @@ +//// [blockScopedSameNameFunctionDeclarationStrictES5.ts] +"use strict"; +function foo(a: number) { + if (a === 1) { + function foo() { } // Error to declare function in block scope + foo(); + foo(10); // not ok + } + else { + function foo() { } // Error to declare function in block scope + foo(); + foo(10); // not ok + } + foo(10); + foo(); // not ok - needs number +} +foo(10); +foo(); // not ok - needs number + +//// [blockScopedSameNameFunctionDeclarationStrictES5.js] +"use strict"; +function foo(a) { + if (a === 1) { + function foo() { } // Error to declare function in block scope + foo(); + foo(10); // not ok + } + else { + function foo() { } // Error to declare function in block scope + foo(); + foo(10); // not ok + } + foo(10); + foo(); // not ok - needs number +} +foo(10); +foo(); // not ok - needs number diff --git a/tests/baselines/reference/blockScopedSameNameFunctionDeclarationStrictES6.errors.txt b/tests/baselines/reference/blockScopedSameNameFunctionDeclarationStrictES6.errors.txt new file mode 100644 index 00000000000..7b8834c5594 --- /dev/null +++ b/tests/baselines/reference/blockScopedSameNameFunctionDeclarationStrictES6.errors.txt @@ -0,0 +1,32 @@ +tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES6.ts(6,9): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES6.ts(11,9): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES6.ts(14,5): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES6.ts(17,1): error TS2346: Supplied parameters do not match any signature of call target. + + +==== tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES6.ts (4 errors) ==== + "use strict"; + function foo(a: number) { + if (a === 10) { + function foo() { } + foo(); + foo(10); // not ok + ~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. + } + else { + function foo() { } + foo(); + foo(10); // not ok + ~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. + } + foo(10); + foo(); // not ok + ~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. + } + foo(10); + foo(); // not ok - needs number + ~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. \ No newline at end of file diff --git a/tests/baselines/reference/blockScopedSameNameFunctionDeclarationStrictES6.js b/tests/baselines/reference/blockScopedSameNameFunctionDeclarationStrictES6.js new file mode 100644 index 00000000000..863df86c031 --- /dev/null +++ b/tests/baselines/reference/blockScopedSameNameFunctionDeclarationStrictES6.js @@ -0,0 +1,37 @@ +//// [blockScopedSameNameFunctionDeclarationStrictES6.ts] +"use strict"; +function foo(a: number) { + if (a === 10) { + function foo() { } + foo(); + foo(10); // not ok + } + else { + function foo() { } + foo(); + foo(10); // not ok + } + foo(10); + foo(); // not ok +} +foo(10); +foo(); // not ok - needs number + +//// [blockScopedSameNameFunctionDeclarationStrictES6.js] +"use strict"; +function foo(a) { + if (a === 10) { + function foo() { } + foo(); + foo(10); // not ok + } + else { + function foo() { } + foo(); + foo(10); // not ok + } + foo(10); + foo(); // not ok +} +foo(10); +foo(); // not ok - needs number diff --git a/tests/baselines/reference/bluebirdStaticThis.errors.txt b/tests/baselines/reference/bluebirdStaticThis.errors.txt new file mode 100644 index 00000000000..6e78a90db4b --- /dev/null +++ b/tests/baselines/reference/bluebirdStaticThis.errors.txt @@ -0,0 +1,164 @@ +tests/cases/compiler/bluebirdStaticThis.ts(5,15): error TS2420: Class 'Promise' incorrectly implements interface 'Thenable'. + Property 'then' is missing in type 'Promise'. +tests/cases/compiler/bluebirdStaticThis.ts(22,51): error TS2305: Module 'Promise' has no exported member 'Resolver'. +tests/cases/compiler/bluebirdStaticThis.ts(57,109): error TS2305: Module 'Promise' has no exported member 'Inspection'. +tests/cases/compiler/bluebirdStaticThis.ts(58,91): error TS2305: Module 'Promise' has no exported member 'Inspection'. +tests/cases/compiler/bluebirdStaticThis.ts(59,91): error TS2305: Module 'Promise' has no exported member 'Inspection'. +tests/cases/compiler/bluebirdStaticThis.ts(60,73): error TS2305: Module 'Promise' has no exported member 'Inspection'. + + +==== tests/cases/compiler/bluebirdStaticThis.ts (6 errors) ==== + // This version is reduced from the full d.ts by removing almost all the tests + // and all the comments. + // Then it adds explicit `this` arguments to the static members. + // Tests by: Bart van der Schoor + declare class Promise implements Promise.Thenable { + ~~~~~~~ +!!! error TS2420: Class 'Promise' incorrectly implements interface 'Thenable'. +!!! error TS2420: Property 'then' is missing in type 'Promise'. + constructor(callback: (resolve: (thenableOrResult: R | Promise.Thenable) => void, reject: (error: any) => void) => void); + static try(dit: typeof Promise, fn: () => Promise.Thenable, args?: any[], ctx?: any): Promise; + static try(dit: typeof Promise, fn: () => R, args?: any[], ctx?: any): Promise; + + static attempt(dit: typeof Promise, fn: () => Promise.Thenable, args?: any[], ctx?: any): Promise; + static attempt(dit: typeof Promise, fn: () => R, args?: any[], ctx?: any): Promise; + + static method(dit: typeof Promise, fn: Function): Function; + + static resolve(dit: typeof Promise): Promise; + static resolve(dit: typeof Promise, value: Promise.Thenable): Promise; + static resolve(dit: typeof Promise, value: R): Promise; + + static reject(dit: typeof Promise, reason: any): Promise; + static reject(dit: typeof Promise, reason: any): Promise; + + static defer(dit: typeof Promise): Promise.Resolver; + ~~~~~~~~ +!!! error TS2305: Module 'Promise' has no exported member 'Resolver'. + + static cast(dit: typeof Promise, value: Promise.Thenable): Promise; + static cast(dit: typeof Promise, value: R): Promise; + + static bind(dit: typeof Promise, thisArg: any): Promise; + + static is(dit: typeof Promise, value: any): boolean; + + static longStackTraces(dit: typeof Promise): void; + + static delay(dit: typeof Promise, value: Promise.Thenable, ms: number): Promise; + static delay(dit: typeof Promise, value: R, ms: number): Promise; + static delay(dit: typeof Promise, ms: number): Promise; + + static promisify(dit: typeof Promise, nodeFunction: Function, receiver?: any): Function; + + static promisifyAll(dit: typeof Promise, target: Object): Object; + + static coroutine(dit: typeof Promise, generatorFunction: Function): Function; + + static spawn(dit: typeof Promise, generatorFunction: Function): Promise; + + static noConflict(dit: typeof Promise): typeof Promise; + + static onPossiblyUnhandledRejection(dit: typeof Promise, handler: (reason: any) => any): void; + + static all(dit: typeof Promise, values: Promise.Thenable[]>): Promise; + static all(dit: typeof Promise, values: Promise.Thenable): Promise; + static all(dit: typeof Promise, values: Promise.Thenable[]): Promise; + static all(dit: typeof Promise, values: R[]): Promise; + + static props(dit: typeof Promise, object: Promise): Promise; + static props(dit: typeof Promise, object: Object): Promise; + + static settle(dit: typeof Promise, values: Promise.Thenable[]>): Promise[]>; + ~~~~~~~~~~ +!!! error TS2305: Module 'Promise' has no exported member 'Inspection'. + static settle(dit: typeof Promise, values: Promise.Thenable): Promise[]>; + ~~~~~~~~~~ +!!! error TS2305: Module 'Promise' has no exported member 'Inspection'. + static settle(dit: typeof Promise, values: Promise.Thenable[]): Promise[]>; + ~~~~~~~~~~ +!!! error TS2305: Module 'Promise' has no exported member 'Inspection'. + static settle(dit: typeof Promise, values: R[]): Promise[]>; + ~~~~~~~~~~ +!!! error TS2305: Module 'Promise' has no exported member 'Inspection'. + + static any(dit: typeof Promise, values: Promise.Thenable[]>): Promise; + static any(dit: typeof Promise, values: Promise.Thenable): Promise; + static any(dit: typeof Promise, values: Promise.Thenable[]): Promise; + static any(dit: typeof Promise, values: R[]): Promise; + + static race(dit: typeof Promise, values: Promise.Thenable[]>): Promise; + static race(dit: typeof Promise, values: Promise.Thenable): Promise; + static race(dit: typeof Promise, values: Promise.Thenable[]): Promise; + static race(dit: typeof Promise, values: R[]): Promise; + + static some(dit: typeof Promise, values: Promise.Thenable[]>, count: number): Promise; + static some(dit: typeof Promise, values: Promise.Thenable, count: number): Promise; + static some(dit: typeof Promise, values: Promise.Thenable[], count: number): Promise; + static some(dit: typeof Promise, values: R[], count: number): Promise; + + static join(dit: typeof Promise, ...values: Promise.Thenable[]): Promise; + static join(dit: typeof Promise, ...values: R[]): Promise; + + static map(dit: typeof Promise, values: Promise.Thenable[]>, mapper: (item: R, index: number, arrayLength: number) => Promise.Thenable): Promise; + static map(dit: typeof Promise, values: Promise.Thenable[]>, mapper: (item: R, index: number, arrayLength: number) => U): Promise; + static map(dit: typeof Promise, values: Promise.Thenable, mapper: (item: R, index: number, arrayLength: number) => Promise.Thenable): Promise; + static map(dit: typeof Promise, values: Promise.Thenable, mapper: (item: R, index: number, arrayLength: number) => U): Promise; + static map(dit: typeof Promise, values: Promise.Thenable[], mapper: (item: R, index: number, arrayLength: number) => Promise.Thenable): Promise; + static map(dit: typeof Promise, values: Promise.Thenable[], mapper: (item: R, index: number, arrayLength: number) => U): Promise; + static map(dit: typeof Promise, values: R[], mapper: (item: R, index: number, arrayLength: number) => Promise.Thenable): Promise; + static map(dit: typeof Promise, values: R[], mapper: (item: R, index: number, arrayLength: number) => U): Promise; + + static reduce(dit: typeof Promise, values: Promise.Thenable[]>, reducer: (total: U, current: R, index: number, arrayLength: number) => Promise.Thenable, initialValue?: U): Promise; + static reduce(dit: typeof Promise, values: Promise.Thenable[]>, reducer: (total: U, current: R, index: number, arrayLength: number) => U, initialValue?: U): Promise; + + static reduce(dit: typeof Promise, values: Promise.Thenable, reducer: (total: U, current: R, index: number, arrayLength: number) => Promise.Thenable, initialValue?: U): Promise; + static reduce(dit: typeof Promise, values: Promise.Thenable, reducer: (total: U, current: R, index: number, arrayLength: number) => U, initialValue?: U): Promise; + + static reduce(dit: typeof Promise, values: Promise.Thenable[], reducer: (total: U, current: R, index: number, arrayLength: number) => Promise.Thenable, initialValue?: U): Promise; + static reduce(dit: typeof Promise, values: Promise.Thenable[], reducer: (total: U, current: R, index: number, arrayLength: number) => U, initialValue?: U): Promise; + + static reduce(dit: typeof Promise, values: R[], reducer: (total: U, current: R, index: number, arrayLength: number) => Promise.Thenable, initialValue?: U): Promise; + static reduce(dit: typeof Promise, values: R[], reducer: (total: U, current: R, index: number, arrayLength: number) => U, initialValue?: U): Promise; + + static filter(dit: typeof Promise, values: Promise.Thenable[]>, filterer: (item: R, index: number, arrayLength: number) => Promise.Thenable): Promise; + static filter(dit: typeof Promise, values: Promise.Thenable[]>, filterer: (item: R, index: number, arrayLength: number) => boolean): Promise; + static filter(dit: typeof Promise, values: Promise.Thenable, filterer: (item: R, index: number, arrayLength: number) => Promise.Thenable): Promise; + static filter(dit: typeof Promise, values: Promise.Thenable, filterer: (item: R, index: number, arrayLength: number) => boolean): Promise; + static filter(dit: typeof Promise, values: Promise.Thenable[], filterer: (item: R, index: number, arrayLength: number) => Promise.Thenable): Promise; + static filter(dit: typeof Promise, values: Promise.Thenable[], filterer: (item: R, index: number, arrayLength: number) => boolean): Promise; + static filter(dit: typeof Promise, values: R[], filterer: (item: R, index: number, arrayLength: number) => Promise.Thenable): Promise; + static filter(dit: typeof Promise, values: R[], filterer: (item: R, index: number, arrayLength: number) => boolean): Promise; + } + + declare module Promise { + export interface Thenable { + then(onFulfilled: (value: R) => Thenable, onRejected: (error: any) => Thenable): Thenable; + then(onFulfilled: (value: R) => Thenable, onRejected?: (error: any) => U): Thenable; + then(onFulfilled: (value: R) => U, onRejected: (error: any) => Thenable): Thenable; + then(onFulfilled?: (value: R) => U, onRejected?: (error: any) => U): Thenable; + } + + } + + declare module 'bluebird' { + export = Promise; + } + interface Foo { + a: number; + b: string; + } + var x: any; + var arr: any[]; + var foo: Foo; + var fooProm: Promise; + + fooProm = Promise.try(Promise, () => { + return foo; + }); + fooProm = Promise.try(Promise, () => { + return foo; + }, arr); + fooProm = Promise.try(Promise, () => { + return foo; + }, arr, x); \ No newline at end of file diff --git a/tests/baselines/reference/bluebirdStaticThis.js b/tests/baselines/reference/bluebirdStaticThis.js new file mode 100644 index 00000000000..301f32319a7 --- /dev/null +++ b/tests/baselines/reference/bluebirdStaticThis.js @@ -0,0 +1,157 @@ +//// [bluebirdStaticThis.ts] +// This version is reduced from the full d.ts by removing almost all the tests +// and all the comments. +// Then it adds explicit `this` arguments to the static members. +// Tests by: Bart van der Schoor +declare class Promise implements Promise.Thenable { + constructor(callback: (resolve: (thenableOrResult: R | Promise.Thenable) => void, reject: (error: any) => void) => void); + static try(dit: typeof Promise, fn: () => Promise.Thenable, args?: any[], ctx?: any): Promise; + static try(dit: typeof Promise, fn: () => R, args?: any[], ctx?: any): Promise; + + static attempt(dit: typeof Promise, fn: () => Promise.Thenable, args?: any[], ctx?: any): Promise; + static attempt(dit: typeof Promise, fn: () => R, args?: any[], ctx?: any): Promise; + + static method(dit: typeof Promise, fn: Function): Function; + + static resolve(dit: typeof Promise): Promise; + static resolve(dit: typeof Promise, value: Promise.Thenable): Promise; + static resolve(dit: typeof Promise, value: R): Promise; + + static reject(dit: typeof Promise, reason: any): Promise; + static reject(dit: typeof Promise, reason: any): Promise; + + static defer(dit: typeof Promise): Promise.Resolver; + + static cast(dit: typeof Promise, value: Promise.Thenable): Promise; + static cast(dit: typeof Promise, value: R): Promise; + + static bind(dit: typeof Promise, thisArg: any): Promise; + + static is(dit: typeof Promise, value: any): boolean; + + static longStackTraces(dit: typeof Promise): void; + + static delay(dit: typeof Promise, value: Promise.Thenable, ms: number): Promise; + static delay(dit: typeof Promise, value: R, ms: number): Promise; + static delay(dit: typeof Promise, ms: number): Promise; + + static promisify(dit: typeof Promise, nodeFunction: Function, receiver?: any): Function; + + static promisifyAll(dit: typeof Promise, target: Object): Object; + + static coroutine(dit: typeof Promise, generatorFunction: Function): Function; + + static spawn(dit: typeof Promise, generatorFunction: Function): Promise; + + static noConflict(dit: typeof Promise): typeof Promise; + + static onPossiblyUnhandledRejection(dit: typeof Promise, handler: (reason: any) => any): void; + + static all(dit: typeof Promise, values: Promise.Thenable[]>): Promise; + static all(dit: typeof Promise, values: Promise.Thenable): Promise; + static all(dit: typeof Promise, values: Promise.Thenable[]): Promise; + static all(dit: typeof Promise, values: R[]): Promise; + + static props(dit: typeof Promise, object: Promise): Promise; + static props(dit: typeof Promise, object: Object): Promise; + + static settle(dit: typeof Promise, values: Promise.Thenable[]>): Promise[]>; + static settle(dit: typeof Promise, values: Promise.Thenable): Promise[]>; + static settle(dit: typeof Promise, values: Promise.Thenable[]): Promise[]>; + static settle(dit: typeof Promise, values: R[]): Promise[]>; + + static any(dit: typeof Promise, values: Promise.Thenable[]>): Promise; + static any(dit: typeof Promise, values: Promise.Thenable): Promise; + static any(dit: typeof Promise, values: Promise.Thenable[]): Promise; + static any(dit: typeof Promise, values: R[]): Promise; + + static race(dit: typeof Promise, values: Promise.Thenable[]>): Promise; + static race(dit: typeof Promise, values: Promise.Thenable): Promise; + static race(dit: typeof Promise, values: Promise.Thenable[]): Promise; + static race(dit: typeof Promise, values: R[]): Promise; + + static some(dit: typeof Promise, values: Promise.Thenable[]>, count: number): Promise; + static some(dit: typeof Promise, values: Promise.Thenable, count: number): Promise; + static some(dit: typeof Promise, values: Promise.Thenable[], count: number): Promise; + static some(dit: typeof Promise, values: R[], count: number): Promise; + + static join(dit: typeof Promise, ...values: Promise.Thenable[]): Promise; + static join(dit: typeof Promise, ...values: R[]): Promise; + + static map(dit: typeof Promise, values: Promise.Thenable[]>, mapper: (item: R, index: number, arrayLength: number) => Promise.Thenable): Promise; + static map(dit: typeof Promise, values: Promise.Thenable[]>, mapper: (item: R, index: number, arrayLength: number) => U): Promise; + static map(dit: typeof Promise, values: Promise.Thenable, mapper: (item: R, index: number, arrayLength: number) => Promise.Thenable): Promise; + static map(dit: typeof Promise, values: Promise.Thenable, mapper: (item: R, index: number, arrayLength: number) => U): Promise; + static map(dit: typeof Promise, values: Promise.Thenable[], mapper: (item: R, index: number, arrayLength: number) => Promise.Thenable): Promise; + static map(dit: typeof Promise, values: Promise.Thenable[], mapper: (item: R, index: number, arrayLength: number) => U): Promise; + static map(dit: typeof Promise, values: R[], mapper: (item: R, index: number, arrayLength: number) => Promise.Thenable): Promise; + static map(dit: typeof Promise, values: R[], mapper: (item: R, index: number, arrayLength: number) => U): Promise; + + static reduce(dit: typeof Promise, values: Promise.Thenable[]>, reducer: (total: U, current: R, index: number, arrayLength: number) => Promise.Thenable, initialValue?: U): Promise; + static reduce(dit: typeof Promise, values: Promise.Thenable[]>, reducer: (total: U, current: R, index: number, arrayLength: number) => U, initialValue?: U): Promise; + + static reduce(dit: typeof Promise, values: Promise.Thenable, reducer: (total: U, current: R, index: number, arrayLength: number) => Promise.Thenable, initialValue?: U): Promise; + static reduce(dit: typeof Promise, values: Promise.Thenable, reducer: (total: U, current: R, index: number, arrayLength: number) => U, initialValue?: U): Promise; + + static reduce(dit: typeof Promise, values: Promise.Thenable[], reducer: (total: U, current: R, index: number, arrayLength: number) => Promise.Thenable, initialValue?: U): Promise; + static reduce(dit: typeof Promise, values: Promise.Thenable[], reducer: (total: U, current: R, index: number, arrayLength: number) => U, initialValue?: U): Promise; + + static reduce(dit: typeof Promise, values: R[], reducer: (total: U, current: R, index: number, arrayLength: number) => Promise.Thenable, initialValue?: U): Promise; + static reduce(dit: typeof Promise, values: R[], reducer: (total: U, current: R, index: number, arrayLength: number) => U, initialValue?: U): Promise; + + static filter(dit: typeof Promise, values: Promise.Thenable[]>, filterer: (item: R, index: number, arrayLength: number) => Promise.Thenable): Promise; + static filter(dit: typeof Promise, values: Promise.Thenable[]>, filterer: (item: R, index: number, arrayLength: number) => boolean): Promise; + static filter(dit: typeof Promise, values: Promise.Thenable, filterer: (item: R, index: number, arrayLength: number) => Promise.Thenable): Promise; + static filter(dit: typeof Promise, values: Promise.Thenable, filterer: (item: R, index: number, arrayLength: number) => boolean): Promise; + static filter(dit: typeof Promise, values: Promise.Thenable[], filterer: (item: R, index: number, arrayLength: number) => Promise.Thenable): Promise; + static filter(dit: typeof Promise, values: Promise.Thenable[], filterer: (item: R, index: number, arrayLength: number) => boolean): Promise; + static filter(dit: typeof Promise, values: R[], filterer: (item: R, index: number, arrayLength: number) => Promise.Thenable): Promise; + static filter(dit: typeof Promise, values: R[], filterer: (item: R, index: number, arrayLength: number) => boolean): Promise; +} + +declare module Promise { + export interface Thenable { + then(onFulfilled: (value: R) => Thenable, onRejected: (error: any) => Thenable): Thenable; + then(onFulfilled: (value: R) => Thenable, onRejected?: (error: any) => U): Thenable; + then(onFulfilled: (value: R) => U, onRejected: (error: any) => Thenable): Thenable; + then(onFulfilled?: (value: R) => U, onRejected?: (error: any) => U): Thenable; + } + +} + +declare module 'bluebird' { + export = Promise; +} +interface Foo { + a: number; + b: string; +} +var x: any; +var arr: any[]; +var foo: Foo; +var fooProm: Promise; + +fooProm = Promise.try(Promise, () => { + return foo; +}); +fooProm = Promise.try(Promise, () => { + return foo; +}, arr); +fooProm = Promise.try(Promise, () => { + return foo; +}, arr, x); + +//// [bluebirdStaticThis.js] +var x; +var arr; +var foo; +var fooProm; +fooProm = Promise.try(Promise, function () { + return foo; +}); +fooProm = Promise.try(Promise, function () { + return foo; +}, arr); +fooProm = Promise.try(Promise, function () { + return foo; +}, arr, x); diff --git a/tests/baselines/reference/booleanAssignment.errors.txt b/tests/baselines/reference/booleanAssignment.errors.txt index 454bd7ef707..15b506d3df4 100644 --- a/tests/baselines/reference/booleanAssignment.errors.txt +++ b/tests/baselines/reference/booleanAssignment.errors.txt @@ -1,11 +1,5 @@ tests/cases/compiler/booleanAssignment.ts(2,1): error TS2322: Type 'number' is not assignable to type 'Boolean'. - Types of property 'valueOf' are incompatible. - Type '() => number' is not assignable to type '() => boolean'. - Type 'number' is not assignable to type 'boolean'. tests/cases/compiler/booleanAssignment.ts(3,1): error TS2322: Type 'string' is not assignable to type 'Boolean'. - Types of property 'valueOf' are incompatible. - Type '() => string' is not assignable to type '() => boolean'. - Type 'string' is not assignable to type 'boolean'. tests/cases/compiler/booleanAssignment.ts(4,1): error TS2322: Type '{}' is not assignable to type 'Boolean'. Types of property 'valueOf' are incompatible. Type '() => Object' is not assignable to type '() => boolean'. @@ -17,15 +11,9 @@ tests/cases/compiler/booleanAssignment.ts(4,1): error TS2322: Type '{}' is not a b = 1; // Error ~ !!! error TS2322: Type 'number' is not assignable to type 'Boolean'. -!!! error TS2322: Types of property 'valueOf' are incompatible. -!!! error TS2322: Type '() => number' is not assignable to type '() => boolean'. -!!! error TS2322: Type 'number' is not assignable to type 'boolean'. b = "a"; // Error ~ !!! error TS2322: Type 'string' is not assignable to type 'Boolean'. -!!! error TS2322: Types of property 'valueOf' are incompatible. -!!! error TS2322: Type '() => string' is not assignable to type '() => boolean'. -!!! error TS2322: Type 'string' is not assignable to type 'boolean'. b = {}; // Error ~ !!! error TS2322: Type '{}' is not assignable to type 'Boolean'. diff --git a/tests/baselines/reference/bpSpanDestructuringAssignmentForArrayBindingPattern.baseline b/tests/baselines/reference/bpSpanDestructuringAssignmentForArrayBindingPattern.baseline new file mode 100644 index 00000000000..923e0cced09 --- /dev/null +++ b/tests/baselines/reference/bpSpanDestructuringAssignmentForArrayBindingPattern.baseline @@ -0,0 +1,1005 @@ + +1 >declare var console: { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (0 to 22) SpanInfo: undefined +-------------------------------- +2 > log(msg: any): void; + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (23 to 47) SpanInfo: undefined +-------------------------------- +3 >} + + ~~ => Pos: (48 to 49) SpanInfo: undefined +-------------------------------- +4 >type Robot = [number, string, string]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (50 to 88) SpanInfo: undefined +-------------------------------- +5 >type MultiSkilledRobot = [string, [string, string]]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (89 to 141) SpanInfo: undefined +-------------------------------- +6 >let robotA: Robot = [1, "mower", "mowing"]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (142 to 185) SpanInfo: {"start":142,"length":42} + >let robotA: Robot = [1, "mower", "mowing"] + >:=> (line 6, col 0) to (line 6, col 42) +-------------------------------- +7 >function getRobot() { + + ~~~~~~~~~~~~~~~~~~~~~~ => Pos: (186 to 207) SpanInfo: {"start":212,"length":13} + >return robotA + >:=> (line 8, col 4) to (line 8, col 17) +-------------------------------- +8 > return robotA; + + ~~~~~~~~~~~~~~~~~~~ => Pos: (208 to 226) SpanInfo: {"start":212,"length":13} + >return robotA + >:=> (line 8, col 4) to (line 8, col 17) +-------------------------------- +9 >} + + ~~ => Pos: (227 to 228) SpanInfo: {"start":227,"length":1} + >} + >:=> (line 9, col 0) to (line 9, col 1) +-------------------------------- +10 >let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (229 to 292) SpanInfo: {"start":229,"length":62} + >let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]] + >:=> (line 10, col 0) to (line 10, col 62) +-------------------------------- +11 >let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (293 to 366) SpanInfo: {"start":293,"length":72} + >let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]] + >:=> (line 11, col 0) to (line 11, col 72) +-------------------------------- +12 >function getMultiRobot() { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (367 to 393) SpanInfo: {"start":398,"length":18} + >return multiRobotA + >:=> (line 13, col 4) to (line 13, col 22) +-------------------------------- +13 > return multiRobotA; + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (394 to 417) SpanInfo: {"start":398,"length":18} + >return multiRobotA + >:=> (line 13, col 4) to (line 13, col 22) +-------------------------------- +14 >} + + ~~ => Pos: (418 to 419) SpanInfo: {"start":418,"length":1} + >} + >:=> (line 14, col 0) to (line 14, col 1) +-------------------------------- +15 >let nameA: string, primarySkillA: string, secondarySkillA: string; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (420 to 486) SpanInfo: undefined +-------------------------------- +16 >let numberB: number, nameB: string; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (487 to 522) SpanInfo: undefined +-------------------------------- +17 >let numberA2: number, nameA2: string, skillA2: string, nameMA: string; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (523 to 593) SpanInfo: undefined +-------------------------------- +18 >let numberA3: number, robotAInfo: (number | string)[], multiRobotAInfo: (string | [string, string])[]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (594 to 696) SpanInfo: undefined +-------------------------------- +19 >let i: number; + + ~~~~~~~~~~~~~~~ => Pos: (697 to 711) SpanInfo: undefined +-------------------------------- +20 >for ([, nameA] = robotA, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (712 to 735) SpanInfo: {"start":720,"length":5} + >nameA + >:=> (line 20, col 8) to (line 20, col 13) +20 >for ([, nameA] = robotA, i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (736 to 742) SpanInfo: {"start":737,"length":5} + >i = 0 + >:=> (line 20, col 25) to (line 20, col 30) +20 >for ([, nameA] = robotA, i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (743 to 749) SpanInfo: {"start":744,"length":5} + >i < 1 + >:=> (line 20, col 32) to (line 20, col 37) +20 >for ([, nameA] = robotA, i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (750 to 757) SpanInfo: {"start":751,"length":3} + >i++ + >:=> (line 20, col 39) to (line 20, col 42) +-------------------------------- +21 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (758 to 781) SpanInfo: {"start":762,"length":18} + >console.log(nameA) + >:=> (line 21, col 4) to (line 21, col 22) +-------------------------------- +22 >} + + ~~ => Pos: (782 to 783) SpanInfo: {"start":762,"length":18} + >console.log(nameA) + >:=> (line 21, col 4) to (line 21, col 22) +-------------------------------- +23 >for ([, nameA] = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (784 to 811) SpanInfo: {"start":792,"length":5} + >nameA + >:=> (line 23, col 8) to (line 23, col 13) +23 >for ([, nameA] = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (812 to 818) SpanInfo: {"start":813,"length":5} + >i = 0 + >:=> (line 23, col 29) to (line 23, col 34) +23 >for ([, nameA] = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (819 to 825) SpanInfo: {"start":820,"length":5} + >i < 1 + >:=> (line 23, col 36) to (line 23, col 41) +23 >for ([, nameA] = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (826 to 833) SpanInfo: {"start":827,"length":3} + >i++ + >:=> (line 23, col 43) to (line 23, col 46) +-------------------------------- +24 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (834 to 857) SpanInfo: {"start":838,"length":18} + >console.log(nameA) + >:=> (line 24, col 4) to (line 24, col 22) +-------------------------------- +25 >} + + ~~ => Pos: (858 to 859) SpanInfo: {"start":838,"length":18} + >console.log(nameA) + >:=> (line 24, col 4) to (line 24, col 22) +-------------------------------- +26 >for ([, nameA] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (860 to 903) SpanInfo: {"start":868,"length":5} + >nameA + >:=> (line 26, col 8) to (line 26, col 13) +26 >for ([, nameA] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (904 to 910) SpanInfo: {"start":905,"length":5} + >i = 0 + >:=> (line 26, col 45) to (line 26, col 50) +26 >for ([, nameA] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (911 to 917) SpanInfo: {"start":912,"length":5} + >i < 1 + >:=> (line 26, col 52) to (line 26, col 57) +26 >for ([, nameA] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (918 to 925) SpanInfo: {"start":919,"length":3} + >i++ + >:=> (line 26, col 59) to (line 26, col 62) +-------------------------------- +27 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (926 to 949) SpanInfo: {"start":930,"length":18} + >console.log(nameA) + >:=> (line 27, col 4) to (line 27, col 22) +-------------------------------- +28 >} + + ~~ => Pos: (950 to 951) SpanInfo: {"start":930,"length":18} + >console.log(nameA) + >:=> (line 27, col 4) to (line 27, col 22) +-------------------------------- +29 >for ([, [primarySkillA, secondarySkillA]] = multiRobotA, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (952 to 974) SpanInfo: {"start":961,"length":13} + >primarySkillA + >:=> (line 29, col 9) to (line 29, col 22) +29 >for ([, [primarySkillA, secondarySkillA]] = multiRobotA, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~ => Pos: (975 to 991) SpanInfo: {"start":976,"length":15} + >secondarySkillA + >:=> (line 29, col 24) to (line 29, col 39) +29 >for ([, [primarySkillA, secondarySkillA]] = multiRobotA, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~=> Pos: (992 to 1007) SpanInfo: {"start":960,"length":32} + >[primarySkillA, secondarySkillA] + >:=> (line 29, col 8) to (line 29, col 40) +29 >for ([, [primarySkillA, secondarySkillA]] = multiRobotA, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1008 to 1014) SpanInfo: {"start":1009,"length":5} + >i = 0 + >:=> (line 29, col 57) to (line 29, col 62) +29 >for ([, [primarySkillA, secondarySkillA]] = multiRobotA, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1015 to 1021) SpanInfo: {"start":1016,"length":5} + >i < 1 + >:=> (line 29, col 64) to (line 29, col 69) +29 >for ([, [primarySkillA, secondarySkillA]] = multiRobotA, i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (1022 to 1029) SpanInfo: {"start":1023,"length":3} + >i++ + >:=> (line 29, col 71) to (line 29, col 74) +-------------------------------- +30 > console.log(primarySkillA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1030 to 1061) SpanInfo: {"start":1034,"length":26} + >console.log(primarySkillA) + >:=> (line 30, col 4) to (line 30, col 30) +-------------------------------- +31 >} + + ~~ => Pos: (1062 to 1063) SpanInfo: {"start":1034,"length":26} + >console.log(primarySkillA) + >:=> (line 30, col 4) to (line 30, col 30) +-------------------------------- +32 >for ([, [primarySkillA, secondarySkillA]] = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1064 to 1086) SpanInfo: {"start":1073,"length":13} + >primarySkillA + >:=> (line 32, col 9) to (line 32, col 22) +32 >for ([, [primarySkillA, secondarySkillA]] = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~ => Pos: (1087 to 1103) SpanInfo: {"start":1088,"length":15} + >secondarySkillA + >:=> (line 32, col 24) to (line 32, col 39) +32 >for ([, [primarySkillA, secondarySkillA]] = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~=> Pos: (1104 to 1123) SpanInfo: {"start":1072,"length":32} + >[primarySkillA, secondarySkillA] + >:=> (line 32, col 8) to (line 32, col 40) +32 >for ([, [primarySkillA, secondarySkillA]] = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1124 to 1130) SpanInfo: {"start":1125,"length":5} + >i = 0 + >:=> (line 32, col 61) to (line 32, col 66) +32 >for ([, [primarySkillA, secondarySkillA]] = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1131 to 1137) SpanInfo: {"start":1132,"length":5} + >i < 1 + >:=> (line 32, col 68) to (line 32, col 73) +32 >for ([, [primarySkillA, secondarySkillA]] = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (1138 to 1145) SpanInfo: {"start":1139,"length":3} + >i++ + >:=> (line 32, col 75) to (line 32, col 78) +-------------------------------- +33 > console.log(primarySkillA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1146 to 1177) SpanInfo: {"start":1150,"length":26} + >console.log(primarySkillA) + >:=> (line 33, col 4) to (line 33, col 30) +-------------------------------- +34 >} + + ~~ => Pos: (1178 to 1179) SpanInfo: {"start":1150,"length":26} + >console.log(primarySkillA) + >:=> (line 33, col 4) to (line 33, col 30) +-------------------------------- +35 >for ([, [primarySkillA, secondarySkillA]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1180 to 1202) SpanInfo: {"start":1189,"length":13} + >primarySkillA + >:=> (line 35, col 9) to (line 35, col 22) +35 >for ([, [primarySkillA, secondarySkillA]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~ => Pos: (1203 to 1219) SpanInfo: {"start":1204,"length":15} + >secondarySkillA + >:=> (line 35, col 24) to (line 35, col 39) +35 >for ([, [primarySkillA, secondarySkillA]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1220 to 1259) SpanInfo: {"start":1188,"length":32} + >[primarySkillA, secondarySkillA] + >:=> (line 35, col 8) to (line 35, col 40) +35 >for ([, [primarySkillA, secondarySkillA]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1260 to 1266) SpanInfo: {"start":1261,"length":5} + >i = 0 + >:=> (line 35, col 81) to (line 35, col 86) +35 >for ([, [primarySkillA, secondarySkillA]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1267 to 1273) SpanInfo: {"start":1268,"length":5} + >i < 1 + >:=> (line 35, col 88) to (line 35, col 93) +35 >for ([, [primarySkillA, secondarySkillA]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (1274 to 1281) SpanInfo: {"start":1275,"length":3} + >i++ + >:=> (line 35, col 95) to (line 35, col 98) +-------------------------------- +36 > console.log(primarySkillA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1282 to 1313) SpanInfo: {"start":1286,"length":26} + >console.log(primarySkillA) + >:=> (line 36, col 4) to (line 36, col 30) +-------------------------------- +37 >} + + ~~ => Pos: (1314 to 1315) SpanInfo: {"start":1286,"length":26} + >console.log(primarySkillA) + >:=> (line 36, col 4) to (line 36, col 30) +-------------------------------- +38 >for ([numberB] = robotA, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1316 to 1339) SpanInfo: {"start":1322,"length":7} + >numberB + >:=> (line 38, col 6) to (line 38, col 13) +38 >for ([numberB] = robotA, i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (1340 to 1346) SpanInfo: {"start":1341,"length":5} + >i = 0 + >:=> (line 38, col 25) to (line 38, col 30) +38 >for ([numberB] = robotA, i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (1347 to 1353) SpanInfo: {"start":1348,"length":5} + >i < 1 + >:=> (line 38, col 32) to (line 38, col 37) +38 >for ([numberB] = robotA, i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (1354 to 1361) SpanInfo: {"start":1355,"length":3} + >i++ + >:=> (line 38, col 39) to (line 38, col 42) +-------------------------------- +39 > console.log(numberB); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1362 to 1387) SpanInfo: {"start":1366,"length":20} + >console.log(numberB) + >:=> (line 39, col 4) to (line 39, col 24) +-------------------------------- +40 >} + + ~~ => Pos: (1388 to 1389) SpanInfo: {"start":1366,"length":20} + >console.log(numberB) + >:=> (line 39, col 4) to (line 39, col 24) +-------------------------------- +41 >for ([numberB] = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1390 to 1417) SpanInfo: {"start":1396,"length":7} + >numberB + >:=> (line 41, col 6) to (line 41, col 13) +41 >for ([numberB] = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (1418 to 1424) SpanInfo: {"start":1419,"length":5} + >i = 0 + >:=> (line 41, col 29) to (line 41, col 34) +41 >for ([numberB] = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (1425 to 1431) SpanInfo: {"start":1426,"length":5} + >i < 1 + >:=> (line 41, col 36) to (line 41, col 41) +41 >for ([numberB] = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (1432 to 1439) SpanInfo: {"start":1433,"length":3} + >i++ + >:=> (line 41, col 43) to (line 41, col 46) +-------------------------------- +42 > console.log(numberB); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1440 to 1465) SpanInfo: {"start":1444,"length":20} + >console.log(numberB) + >:=> (line 42, col 4) to (line 42, col 24) +-------------------------------- +43 >} + + ~~ => Pos: (1466 to 1467) SpanInfo: {"start":1444,"length":20} + >console.log(numberB) + >:=> (line 42, col 4) to (line 42, col 24) +-------------------------------- +44 >for ([numberB] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1468 to 1511) SpanInfo: {"start":1474,"length":7} + >numberB + >:=> (line 44, col 6) to (line 44, col 13) +44 >for ([numberB] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1512 to 1518) SpanInfo: {"start":1513,"length":5} + >i = 0 + >:=> (line 44, col 45) to (line 44, col 50) +44 >for ([numberB] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1519 to 1525) SpanInfo: {"start":1520,"length":5} + >i < 1 + >:=> (line 44, col 52) to (line 44, col 57) +44 >for ([numberB] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (1526 to 1533) SpanInfo: {"start":1527,"length":3} + >i++ + >:=> (line 44, col 59) to (line 44, col 62) +-------------------------------- +45 > console.log(numberB); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1534 to 1559) SpanInfo: {"start":1538,"length":20} + >console.log(numberB) + >:=> (line 45, col 4) to (line 45, col 24) +-------------------------------- +46 >} + + ~~ => Pos: (1560 to 1561) SpanInfo: {"start":1538,"length":20} + >console.log(numberB) + >:=> (line 45, col 4) to (line 45, col 24) +-------------------------------- +47 >for ([nameB] = multiRobotA, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1562 to 1588) SpanInfo: {"start":1568,"length":5} + >nameB + >:=> (line 47, col 6) to (line 47, col 11) +47 >for ([nameB] = multiRobotA, i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (1589 to 1595) SpanInfo: {"start":1590,"length":5} + >i = 0 + >:=> (line 47, col 28) to (line 47, col 33) +47 >for ([nameB] = multiRobotA, i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (1596 to 1602) SpanInfo: {"start":1597,"length":5} + >i < 1 + >:=> (line 47, col 35) to (line 47, col 40) +47 >for ([nameB] = multiRobotA, i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (1603 to 1610) SpanInfo: {"start":1604,"length":3} + >i++ + >:=> (line 47, col 42) to (line 47, col 45) +-------------------------------- +48 > console.log(nameB); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1611 to 1634) SpanInfo: {"start":1615,"length":18} + >console.log(nameB) + >:=> (line 48, col 4) to (line 48, col 22) +-------------------------------- +49 >} + + ~~ => Pos: (1635 to 1636) SpanInfo: {"start":1615,"length":18} + >console.log(nameB) + >:=> (line 48, col 4) to (line 48, col 22) +-------------------------------- +50 >for ([nameB] = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1637 to 1667) SpanInfo: {"start":1643,"length":5} + >nameB + >:=> (line 50, col 6) to (line 50, col 11) +50 >for ([nameB] = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (1668 to 1674) SpanInfo: {"start":1669,"length":5} + >i = 0 + >:=> (line 50, col 32) to (line 50, col 37) +50 >for ([nameB] = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (1675 to 1681) SpanInfo: {"start":1676,"length":5} + >i < 1 + >:=> (line 50, col 39) to (line 50, col 44) +50 >for ([nameB] = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (1682 to 1689) SpanInfo: {"start":1683,"length":3} + >i++ + >:=> (line 50, col 46) to (line 50, col 49) +-------------------------------- +51 > console.log(nameB); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1690 to 1713) SpanInfo: {"start":1694,"length":18} + >console.log(nameB) + >:=> (line 51, col 4) to (line 51, col 22) +-------------------------------- +52 >} + + ~~ => Pos: (1714 to 1715) SpanInfo: {"start":1694,"length":18} + >console.log(nameB) + >:=> (line 51, col 4) to (line 51, col 22) +-------------------------------- +53 >for ([nameB] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1716 to 1766) SpanInfo: {"start":1722,"length":5} + >nameB + >:=> (line 53, col 6) to (line 53, col 11) +53 >for ([nameB] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1767 to 1773) SpanInfo: {"start":1768,"length":5} + >i = 0 + >:=> (line 53, col 52) to (line 53, col 57) +53 >for ([nameB] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1774 to 1780) SpanInfo: {"start":1775,"length":5} + >i < 1 + >:=> (line 53, col 59) to (line 53, col 64) +53 >for ([nameB] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (1781 to 1788) SpanInfo: {"start":1782,"length":3} + >i++ + >:=> (line 53, col 66) to (line 53, col 69) +-------------------------------- +54 > console.log(nameB); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1789 to 1812) SpanInfo: {"start":1793,"length":18} + >console.log(nameB) + >:=> (line 54, col 4) to (line 54, col 22) +-------------------------------- +55 >} + + ~~ => Pos: (1813 to 1814) SpanInfo: {"start":1793,"length":18} + >console.log(nameB) + >:=> (line 54, col 4) to (line 54, col 22) +-------------------------------- +56 >for ([numberA2, nameA2, skillA2] = robotA, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~ => Pos: (1815 to 1829) SpanInfo: {"start":1821,"length":8} + >numberA2 + >:=> (line 56, col 6) to (line 56, col 14) +56 >for ([numberA2, nameA2, skillA2] = robotA, i = 0; i < 1; i++) { + + ~~~~~~~~ => Pos: (1830 to 1837) SpanInfo: {"start":1831,"length":6} + >nameA2 + >:=> (line 56, col 16) to (line 56, col 22) +56 >for ([numberA2, nameA2, skillA2] = robotA, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~ => Pos: (1838 to 1856) SpanInfo: {"start":1839,"length":7} + >skillA2 + >:=> (line 56, col 24) to (line 56, col 31) +56 >for ([numberA2, nameA2, skillA2] = robotA, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1857 to 1863) SpanInfo: {"start":1858,"length":5} + >i = 0 + >:=> (line 56, col 43) to (line 56, col 48) +56 >for ([numberA2, nameA2, skillA2] = robotA, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1864 to 1870) SpanInfo: {"start":1865,"length":5} + >i < 1 + >:=> (line 56, col 50) to (line 56, col 55) +56 >for ([numberA2, nameA2, skillA2] = robotA, i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (1871 to 1878) SpanInfo: {"start":1872,"length":3} + >i++ + >:=> (line 56, col 57) to (line 56, col 60) +-------------------------------- +57 > console.log(nameA2); + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1879 to 1903) SpanInfo: {"start":1883,"length":19} + >console.log(nameA2) + >:=> (line 57, col 4) to (line 57, col 23) +-------------------------------- +58 >} + + ~~ => Pos: (1904 to 1905) SpanInfo: {"start":1883,"length":19} + >console.log(nameA2) + >:=> (line 57, col 4) to (line 57, col 23) +-------------------------------- +59 >for ([numberA2, nameA2, skillA2] = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~ => Pos: (1906 to 1920) SpanInfo: {"start":1912,"length":8} + >numberA2 + >:=> (line 59, col 6) to (line 59, col 14) +59 >for ([numberA2, nameA2, skillA2] = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~ => Pos: (1921 to 1928) SpanInfo: {"start":1922,"length":6} + >nameA2 + >:=> (line 59, col 16) to (line 59, col 22) +59 >for ([numberA2, nameA2, skillA2] = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1929 to 1951) SpanInfo: {"start":1930,"length":7} + >skillA2 + >:=> (line 59, col 24) to (line 59, col 31) +59 >for ([numberA2, nameA2, skillA2] = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1952 to 1958) SpanInfo: {"start":1953,"length":5} + >i = 0 + >:=> (line 59, col 47) to (line 59, col 52) +59 >for ([numberA2, nameA2, skillA2] = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1959 to 1965) SpanInfo: {"start":1960,"length":5} + >i < 1 + >:=> (line 59, col 54) to (line 59, col 59) +59 >for ([numberA2, nameA2, skillA2] = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (1966 to 1973) SpanInfo: {"start":1967,"length":3} + >i++ + >:=> (line 59, col 61) to (line 59, col 64) +-------------------------------- +60 > console.log(nameA2); + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1974 to 1998) SpanInfo: {"start":1978,"length":19} + >console.log(nameA2) + >:=> (line 60, col 4) to (line 60, col 23) +-------------------------------- +61 >} + + ~~ => Pos: (1999 to 2000) SpanInfo: {"start":1978,"length":19} + >console.log(nameA2) + >:=> (line 60, col 4) to (line 60, col 23) +-------------------------------- +62 >for ([numberA2, nameA2, skillA2] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~ => Pos: (2001 to 2015) SpanInfo: {"start":2007,"length":8} + >numberA2 + >:=> (line 62, col 6) to (line 62, col 14) +62 >for ([numberA2, nameA2, skillA2] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + + ~~~~~~~~ => Pos: (2016 to 2023) SpanInfo: {"start":2017,"length":6} + >nameA2 + >:=> (line 62, col 16) to (line 62, col 22) +62 >for ([numberA2, nameA2, skillA2] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (2024 to 2062) SpanInfo: {"start":2025,"length":7} + >skillA2 + >:=> (line 62, col 24) to (line 62, col 31) +62 >for ([numberA2, nameA2, skillA2] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (2063 to 2069) SpanInfo: {"start":2064,"length":5} + >i = 0 + >:=> (line 62, col 63) to (line 62, col 68) +62 >for ([numberA2, nameA2, skillA2] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (2070 to 2076) SpanInfo: {"start":2071,"length":5} + >i < 1 + >:=> (line 62, col 70) to (line 62, col 75) +62 >for ([numberA2, nameA2, skillA2] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (2077 to 2084) SpanInfo: {"start":2078,"length":3} + >i++ + >:=> (line 62, col 77) to (line 62, col 80) +-------------------------------- +63 > console.log(nameA2); + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2085 to 2109) SpanInfo: {"start":2089,"length":19} + >console.log(nameA2) + >:=> (line 63, col 4) to (line 63, col 23) +-------------------------------- +64 >} + + ~~ => Pos: (2110 to 2111) SpanInfo: {"start":2089,"length":19} + >console.log(nameA2) + >:=> (line 63, col 4) to (line 63, col 23) +-------------------------------- +65 >for ([nameMA, [primarySkillA, secondarySkillA]] = multiRobotA, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~ => Pos: (2112 to 2124) SpanInfo: {"start":2118,"length":6} + >nameMA + >:=> (line 65, col 6) to (line 65, col 12) +65 >for ([nameMA, [primarySkillA, secondarySkillA]] = multiRobotA, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~ => Pos: (2125 to 2140) SpanInfo: {"start":2127,"length":13} + >primarySkillA + >:=> (line 65, col 15) to (line 65, col 28) +65 >for ([nameMA, [primarySkillA, secondarySkillA]] = multiRobotA, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~=> Pos: (2141 to 2157) SpanInfo: {"start":2142,"length":15} + >secondarySkillA + >:=> (line 65, col 30) to (line 65, col 45) +65 >for ([nameMA, [primarySkillA, secondarySkillA]] = multiRobotA, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~=> Pos: (2158 to 2173) SpanInfo: {"start":2126,"length":32} + >[primarySkillA, secondarySkillA] + >:=> (line 65, col 14) to (line 65, col 46) +65 >for ([nameMA, [primarySkillA, secondarySkillA]] = multiRobotA, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (2174 to 2180) SpanInfo: {"start":2175,"length":5} + >i = 0 + >:=> (line 65, col 63) to (line 65, col 68) +65 >for ([nameMA, [primarySkillA, secondarySkillA]] = multiRobotA, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (2181 to 2187) SpanInfo: {"start":2182,"length":5} + >i < 1 + >:=> (line 65, col 70) to (line 65, col 75) +65 >for ([nameMA, [primarySkillA, secondarySkillA]] = multiRobotA, i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (2188 to 2195) SpanInfo: {"start":2189,"length":3} + >i++ + >:=> (line 65, col 77) to (line 65, col 80) +-------------------------------- +66 > console.log(nameMA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2196 to 2220) SpanInfo: {"start":2200,"length":19} + >console.log(nameMA) + >:=> (line 66, col 4) to (line 66, col 23) +-------------------------------- +67 >} + + ~~ => Pos: (2221 to 2222) SpanInfo: {"start":2200,"length":19} + >console.log(nameMA) + >:=> (line 66, col 4) to (line 66, col 23) +-------------------------------- +68 >for ([nameMA, [primarySkillA, secondarySkillA]] = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~ => Pos: (2223 to 2235) SpanInfo: {"start":2229,"length":6} + >nameMA + >:=> (line 68, col 6) to (line 68, col 12) +68 >for ([nameMA, [primarySkillA, secondarySkillA]] = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~ => Pos: (2236 to 2251) SpanInfo: {"start":2238,"length":13} + >primarySkillA + >:=> (line 68, col 15) to (line 68, col 28) +68 >for ([nameMA, [primarySkillA, secondarySkillA]] = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~=> Pos: (2252 to 2268) SpanInfo: {"start":2253,"length":15} + >secondarySkillA + >:=> (line 68, col 30) to (line 68, col 45) +68 >for ([nameMA, [primarySkillA, secondarySkillA]] = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~=> Pos: (2269 to 2288) SpanInfo: {"start":2237,"length":32} + >[primarySkillA, secondarySkillA] + >:=> (line 68, col 14) to (line 68, col 46) +68 >for ([nameMA, [primarySkillA, secondarySkillA]] = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (2289 to 2295) SpanInfo: {"start":2290,"length":5} + >i = 0 + >:=> (line 68, col 67) to (line 68, col 72) +68 >for ([nameMA, [primarySkillA, secondarySkillA]] = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (2296 to 2302) SpanInfo: {"start":2297,"length":5} + >i < 1 + >:=> (line 68, col 74) to (line 68, col 79) +68 >for ([nameMA, [primarySkillA, secondarySkillA]] = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (2303 to 2310) SpanInfo: {"start":2304,"length":3} + >i++ + >:=> (line 68, col 81) to (line 68, col 84) +-------------------------------- +69 > console.log(nameMA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2311 to 2335) SpanInfo: {"start":2315,"length":19} + >console.log(nameMA) + >:=> (line 69, col 4) to (line 69, col 23) +-------------------------------- +70 >} + + ~~ => Pos: (2336 to 2337) SpanInfo: {"start":2315,"length":19} + >console.log(nameMA) + >:=> (line 69, col 4) to (line 69, col 23) +-------------------------------- +71 >for ([nameMA, [primarySkillA, secondarySkillA]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~ => Pos: (2338 to 2350) SpanInfo: {"start":2344,"length":6} + >nameMA + >:=> (line 71, col 6) to (line 71, col 12) +71 >for ([nameMA, [primarySkillA, secondarySkillA]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~ => Pos: (2351 to 2366) SpanInfo: {"start":2353,"length":13} + >primarySkillA + >:=> (line 71, col 15) to (line 71, col 28) +71 >for ([nameMA, [primarySkillA, secondarySkillA]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~=> Pos: (2367 to 2383) SpanInfo: {"start":2368,"length":15} + >secondarySkillA + >:=> (line 71, col 30) to (line 71, col 45) +71 >for ([nameMA, [primarySkillA, secondarySkillA]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (2384 to 2423) SpanInfo: {"start":2352,"length":32} + >[primarySkillA, secondarySkillA] + >:=> (line 71, col 14) to (line 71, col 46) +71 >for ([nameMA, [primarySkillA, secondarySkillA]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (2424 to 2430) SpanInfo: {"start":2425,"length":5} + >i = 0 + >:=> (line 71, col 87) to (line 71, col 92) +71 >for ([nameMA, [primarySkillA, secondarySkillA]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (2431 to 2437) SpanInfo: {"start":2432,"length":5} + >i < 1 + >:=> (line 71, col 94) to (line 71, col 99) +71 >for ([nameMA, [primarySkillA, secondarySkillA]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (2438 to 2445) SpanInfo: {"start":2439,"length":3} + >i++ + >:=> (line 71, col 101) to (line 71, col 104) +-------------------------------- +72 > console.log(nameMA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2446 to 2470) SpanInfo: {"start":2450,"length":19} + >console.log(nameMA) + >:=> (line 72, col 4) to (line 72, col 23) +-------------------------------- +73 >} + + ~~ => Pos: (2471 to 2472) SpanInfo: {"start":2450,"length":19} + >console.log(nameMA) + >:=> (line 72, col 4) to (line 72, col 23) +-------------------------------- +74 >for ([numberA3, ...robotAInfo] = robotA, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~ => Pos: (2473 to 2487) SpanInfo: {"start":2479,"length":8} + >numberA3 + >:=> (line 74, col 6) to (line 74, col 14) +74 >for ([numberA3, ...robotAInfo] = robotA, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2488 to 2512) SpanInfo: {"start":2489,"length":13} + >...robotAInfo + >:=> (line 74, col 16) to (line 74, col 29) +74 >for ([numberA3, ...robotAInfo] = robotA, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (2513 to 2519) SpanInfo: {"start":2514,"length":5} + >i = 0 + >:=> (line 74, col 41) to (line 74, col 46) +74 >for ([numberA3, ...robotAInfo] = robotA, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (2520 to 2526) SpanInfo: {"start":2521,"length":5} + >i < 1 + >:=> (line 74, col 48) to (line 74, col 53) +74 >for ([numberA3, ...robotAInfo] = robotA, i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (2527 to 2534) SpanInfo: {"start":2528,"length":3} + >i++ + >:=> (line 74, col 55) to (line 74, col 58) +-------------------------------- +75 > console.log(numberA3); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2535 to 2561) SpanInfo: {"start":2539,"length":21} + >console.log(numberA3) + >:=> (line 75, col 4) to (line 75, col 25) +-------------------------------- +76 >} + + ~~ => Pos: (2562 to 2563) SpanInfo: {"start":2539,"length":21} + >console.log(numberA3) + >:=> (line 75, col 4) to (line 75, col 25) +-------------------------------- +77 >for ([numberA3, ...robotAInfo] = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~ => Pos: (2564 to 2578) SpanInfo: {"start":2570,"length":8} + >numberA3 + >:=> (line 77, col 6) to (line 77, col 14) +77 >for ([numberA3, ...robotAInfo] = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2579 to 2607) SpanInfo: {"start":2580,"length":13} + >...robotAInfo + >:=> (line 77, col 16) to (line 77, col 29) +77 >for ([numberA3, ...robotAInfo] = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (2608 to 2614) SpanInfo: {"start":2609,"length":5} + >i = 0 + >:=> (line 77, col 45) to (line 77, col 50) +77 >for ([numberA3, ...robotAInfo] = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (2615 to 2621) SpanInfo: {"start":2616,"length":5} + >i < 1 + >:=> (line 77, col 52) to (line 77, col 57) +77 >for ([numberA3, ...robotAInfo] = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (2622 to 2629) SpanInfo: {"start":2623,"length":3} + >i++ + >:=> (line 77, col 59) to (line 77, col 62) +-------------------------------- +78 > console.log(numberA3); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2630 to 2656) SpanInfo: {"start":2634,"length":21} + >console.log(numberA3) + >:=> (line 78, col 4) to (line 78, col 25) +-------------------------------- +79 >} + + ~~ => Pos: (2657 to 2658) SpanInfo: {"start":2634,"length":21} + >console.log(numberA3) + >:=> (line 78, col 4) to (line 78, col 25) +-------------------------------- +80 >for ([numberA3, ...robotAInfo] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~ => Pos: (2659 to 2673) SpanInfo: {"start":2665,"length":8} + >numberA3 + >:=> (line 80, col 6) to (line 80, col 14) +80 >for ([numberA3, ...robotAInfo] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (2674 to 2725) SpanInfo: {"start":2675,"length":13} + >...robotAInfo + >:=> (line 80, col 16) to (line 80, col 29) +80 >for ([numberA3, ...robotAInfo] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (2726 to 2732) SpanInfo: {"start":2727,"length":5} + >i = 0 + >:=> (line 80, col 68) to (line 80, col 73) +80 >for ([numberA3, ...robotAInfo] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (2733 to 2739) SpanInfo: {"start":2734,"length":5} + >i < 1 + >:=> (line 80, col 75) to (line 80, col 80) +80 >for ([numberA3, ...robotAInfo] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (2740 to 2747) SpanInfo: {"start":2741,"length":3} + >i++ + >:=> (line 80, col 82) to (line 80, col 85) +-------------------------------- +81 > console.log(numberA3); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2748 to 2774) SpanInfo: {"start":2752,"length":21} + >console.log(numberA3) + >:=> (line 81, col 4) to (line 81, col 25) +-------------------------------- +82 >} + + ~~ => Pos: (2775 to 2776) SpanInfo: {"start":2752,"length":21} + >console.log(numberA3) + >:=> (line 81, col 4) to (line 81, col 25) +-------------------------------- +83 >for ([...multiRobotAInfo] = multiRobotA, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2777 to 2816) SpanInfo: {"start":2783,"length":18} + >...multiRobotAInfo + >:=> (line 83, col 6) to (line 83, col 24) +83 >for ([...multiRobotAInfo] = multiRobotA, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (2817 to 2823) SpanInfo: {"start":2818,"length":5} + >i = 0 + >:=> (line 83, col 41) to (line 83, col 46) +83 >for ([...multiRobotAInfo] = multiRobotA, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (2824 to 2830) SpanInfo: {"start":2825,"length":5} + >i < 1 + >:=> (line 83, col 48) to (line 83, col 53) +83 >for ([...multiRobotAInfo] = multiRobotA, i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (2831 to 2838) SpanInfo: {"start":2832,"length":3} + >i++ + >:=> (line 83, col 55) to (line 83, col 58) +-------------------------------- +84 > console.log(multiRobotAInfo); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2839 to 2872) SpanInfo: {"start":2843,"length":28} + >console.log(multiRobotAInfo) + >:=> (line 84, col 4) to (line 84, col 32) +-------------------------------- +85 >} + + ~~ => Pos: (2873 to 2874) SpanInfo: {"start":2843,"length":28} + >console.log(multiRobotAInfo) + >:=> (line 84, col 4) to (line 84, col 32) +-------------------------------- +86 >for ([...multiRobotAInfo] = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2875 to 2918) SpanInfo: {"start":2881,"length":18} + >...multiRobotAInfo + >:=> (line 86, col 6) to (line 86, col 24) +86 >for ([...multiRobotAInfo] = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (2919 to 2925) SpanInfo: {"start":2920,"length":5} + >i = 0 + >:=> (line 86, col 45) to (line 86, col 50) +86 >for ([...multiRobotAInfo] = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (2926 to 2932) SpanInfo: {"start":2927,"length":5} + >i < 1 + >:=> (line 86, col 52) to (line 86, col 57) +86 >for ([...multiRobotAInfo] = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (2933 to 2940) SpanInfo: {"start":2934,"length":3} + >i++ + >:=> (line 86, col 59) to (line 86, col 62) +-------------------------------- +87 > console.log(multiRobotAInfo); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2941 to 2974) SpanInfo: {"start":2945,"length":28} + >console.log(multiRobotAInfo) + >:=> (line 87, col 4) to (line 87, col 32) +-------------------------------- +88 >} + + ~~ => Pos: (2975 to 2976) SpanInfo: {"start":2945,"length":28} + >console.log(multiRobotAInfo) + >:=> (line 87, col 4) to (line 87, col 32) +-------------------------------- +89 >for ([...multiRobotAInfo] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (2977 to 3059) SpanInfo: {"start":2983,"length":18} + >...multiRobotAInfo + >:=> (line 89, col 6) to (line 89, col 24) +89 >for ([...multiRobotAInfo] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (3060 to 3066) SpanInfo: {"start":3061,"length":5} + >i = 0 + >:=> (line 89, col 84) to (line 89, col 89) +89 >for ([...multiRobotAInfo] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (3067 to 3073) SpanInfo: {"start":3068,"length":5} + >i < 1 + >:=> (line 89, col 91) to (line 89, col 96) +89 >for ([...multiRobotAInfo] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (3074 to 3081) SpanInfo: {"start":3075,"length":3} + >i++ + >:=> (line 89, col 98) to (line 89, col 101) +-------------------------------- +90 > console.log(multiRobotAInfo); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (3082 to 3115) SpanInfo: {"start":3086,"length":28} + >console.log(multiRobotAInfo) + >:=> (line 90, col 4) to (line 90, col 32) +-------------------------------- +91 >} + ~ => Pos: (3116 to 3116) SpanInfo: {"start":3086,"length":28} + >console.log(multiRobotAInfo) + >:=> (line 90, col 4) to (line 90, col 32) \ No newline at end of file diff --git a/tests/baselines/reference/bpSpanDestructuringAssignmentForArrayBindingPatternDefaultValues.baseline b/tests/baselines/reference/bpSpanDestructuringAssignmentForArrayBindingPatternDefaultValues.baseline new file mode 100644 index 00000000000..56894ce9a9a --- /dev/null +++ b/tests/baselines/reference/bpSpanDestructuringAssignmentForArrayBindingPatternDefaultValues.baseline @@ -0,0 +1,1008 @@ + +1 >declare var console: { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (0 to 22) SpanInfo: undefined +-------------------------------- +2 > log(msg: any): void; + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (23 to 47) SpanInfo: undefined +-------------------------------- +3 >} + + ~~ => Pos: (48 to 49) SpanInfo: undefined +-------------------------------- +4 >type Robot = [number, string, string]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (50 to 88) SpanInfo: undefined +-------------------------------- +5 >type MultiSkilledRobot = [string, [string, string]]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (89 to 141) SpanInfo: undefined +-------------------------------- +6 >let robotA: Robot = [1, "mower", "mowing"]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (142 to 185) SpanInfo: {"start":142,"length":42} + >let robotA: Robot = [1, "mower", "mowing"] + >:=> (line 6, col 0) to (line 6, col 42) +-------------------------------- +7 >function getRobot() { + + ~~~~~~~~~~~~~~~~~~~~~~ => Pos: (186 to 207) SpanInfo: {"start":212,"length":13} + >return robotA + >:=> (line 8, col 4) to (line 8, col 17) +-------------------------------- +8 > return robotA; + + ~~~~~~~~~~~~~~~~~~~ => Pos: (208 to 226) SpanInfo: {"start":212,"length":13} + >return robotA + >:=> (line 8, col 4) to (line 8, col 17) +-------------------------------- +9 >} + + ~~ => Pos: (227 to 228) SpanInfo: {"start":227,"length":1} + >} + >:=> (line 9, col 0) to (line 9, col 1) +-------------------------------- +10 >let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (229 to 292) SpanInfo: {"start":229,"length":62} + >let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]] + >:=> (line 10, col 0) to (line 10, col 62) +-------------------------------- +11 >let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (293 to 366) SpanInfo: {"start":293,"length":72} + >let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]] + >:=> (line 11, col 0) to (line 11, col 72) +-------------------------------- +12 >function getMultiRobot() { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (367 to 393) SpanInfo: {"start":398,"length":18} + >return multiRobotA + >:=> (line 13, col 4) to (line 13, col 22) +-------------------------------- +13 > return multiRobotA; + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (394 to 417) SpanInfo: {"start":398,"length":18} + >return multiRobotA + >:=> (line 13, col 4) to (line 13, col 22) +-------------------------------- +14 >} + + ~~ => Pos: (418 to 419) SpanInfo: {"start":418,"length":1} + >} + >:=> (line 14, col 0) to (line 14, col 1) +-------------------------------- +15 >let nameA: string, primarySkillA: string, secondarySkillA: string; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (420 to 486) SpanInfo: undefined +-------------------------------- +16 >let numberB: number, nameB: string; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (487 to 522) SpanInfo: undefined +-------------------------------- +17 >let numberA2: number, nameA2: string, skillA2: string, nameMA: string; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (523 to 593) SpanInfo: undefined +-------------------------------- +18 >let numberA3: number, robotAInfo: (number | string)[], multiRobotAInfo: (string | [string, string])[]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (594 to 696) SpanInfo: undefined +-------------------------------- +19 >let i: number; + + ~~~~~~~~~~~~~~~ => Pos: (697 to 711) SpanInfo: undefined +-------------------------------- +20 >for ([, nameA = "name"] = robotA, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (712 to 744) SpanInfo: {"start":720,"length":14} + >nameA = "name" + >:=> (line 20, col 8) to (line 20, col 22) +20 >for ([, nameA = "name"] = robotA, i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (745 to 751) SpanInfo: {"start":746,"length":5} + >i = 0 + >:=> (line 20, col 34) to (line 20, col 39) +20 >for ([, nameA = "name"] = robotA, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (752 to 758) SpanInfo: {"start":753,"length":5} + >i < 1 + >:=> (line 20, col 41) to (line 20, col 46) +20 >for ([, nameA = "name"] = robotA, i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (759 to 766) SpanInfo: {"start":760,"length":3} + >i++ + >:=> (line 20, col 48) to (line 20, col 51) +-------------------------------- +21 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (767 to 790) SpanInfo: {"start":771,"length":18} + >console.log(nameA) + >:=> (line 21, col 4) to (line 21, col 22) +-------------------------------- +22 >} + + ~~ => Pos: (791 to 792) SpanInfo: {"start":771,"length":18} + >console.log(nameA) + >:=> (line 21, col 4) to (line 21, col 22) +-------------------------------- +23 >for ([, nameA = "name"] = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (793 to 829) SpanInfo: {"start":801,"length":14} + >nameA = "name" + >:=> (line 23, col 8) to (line 23, col 22) +23 >for ([, nameA = "name"] = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (830 to 836) SpanInfo: {"start":831,"length":5} + >i = 0 + >:=> (line 23, col 38) to (line 23, col 43) +23 >for ([, nameA = "name"] = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (837 to 843) SpanInfo: {"start":838,"length":5} + >i < 1 + >:=> (line 23, col 45) to (line 23, col 50) +23 >for ([, nameA = "name"] = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (844 to 851) SpanInfo: {"start":845,"length":3} + >i++ + >:=> (line 23, col 52) to (line 23, col 55) +-------------------------------- +24 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (852 to 875) SpanInfo: {"start":856,"length":18} + >console.log(nameA) + >:=> (line 24, col 4) to (line 24, col 22) +-------------------------------- +25 >} + + ~~ => Pos: (876 to 877) SpanInfo: {"start":856,"length":18} + >console.log(nameA) + >:=> (line 24, col 4) to (line 24, col 22) +-------------------------------- +26 >for ([, nameA = "name"] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (878 to 930) SpanInfo: {"start":886,"length":14} + >nameA = "name" + >:=> (line 26, col 8) to (line 26, col 22) +26 >for ([, nameA = "name"] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (931 to 937) SpanInfo: {"start":932,"length":5} + >i = 0 + >:=> (line 26, col 54) to (line 26, col 59) +26 >for ([, nameA = "name"] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (938 to 944) SpanInfo: {"start":939,"length":5} + >i < 1 + >:=> (line 26, col 61) to (line 26, col 66) +26 >for ([, nameA = "name"] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (945 to 952) SpanInfo: {"start":946,"length":3} + >i++ + >:=> (line 26, col 68) to (line 26, col 71) +-------------------------------- +27 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (953 to 976) SpanInfo: {"start":957,"length":18} + >console.log(nameA) + >:=> (line 27, col 4) to (line 27, col 22) +-------------------------------- +28 >} + + ~~ => Pos: (977 to 978) SpanInfo: {"start":957,"length":18} + >console.log(nameA) + >:=> (line 27, col 4) to (line 27, col 22) +-------------------------------- +29 >for ([, [ + + ~~~~~~~~~~ => Pos: (979 to 988) SpanInfo: {"start":993,"length":25} + >primarySkillA = "primary" + >:=> (line 30, col 4) to (line 30, col 29) +-------------------------------- +30 > primarySkillA = "primary", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (989 to 1019) SpanInfo: {"start":993,"length":25} + >primarySkillA = "primary" + >:=> (line 30, col 4) to (line 30, col 29) +-------------------------------- +31 > secondarySkillA = "secondary" + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1020 to 1053) SpanInfo: {"start":1024,"length":29} + >secondarySkillA = "secondary" + >:=> (line 31, col 4) to (line 31, col 33) +-------------------------------- +32 >] = ["none", "none"]] = multiRobotA, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~ => Pos: (1054 to 1073) SpanInfo: {"start":1024,"length":29} + >secondarySkillA = "secondary" + >:=> (line 31, col 4) to (line 31, col 33) +32 >] = ["none", "none"]] = multiRobotA, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~ => Pos: (1074 to 1089) SpanInfo: {"start":987,"length":87} + >[ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + >] = ["none", "none"] + >:=> (line 29, col 8) to (line 32, col 20) +32 >] = ["none", "none"]] = multiRobotA, i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (1090 to 1096) SpanInfo: {"start":1091,"length":5} + >i = 0 + >:=> (line 32, col 37) to (line 32, col 42) +32 >] = ["none", "none"]] = multiRobotA, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1097 to 1103) SpanInfo: {"start":1098,"length":5} + >i < 1 + >:=> (line 32, col 44) to (line 32, col 49) +32 >] = ["none", "none"]] = multiRobotA, i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (1104 to 1111) SpanInfo: {"start":1105,"length":3} + >i++ + >:=> (line 32, col 51) to (line 32, col 54) +-------------------------------- +33 > console.log(primarySkillA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1112 to 1143) SpanInfo: {"start":1116,"length":26} + >console.log(primarySkillA) + >:=> (line 33, col 4) to (line 33, col 30) +-------------------------------- +34 >} + + ~~ => Pos: (1144 to 1145) SpanInfo: {"start":1116,"length":26} + >console.log(primarySkillA) + >:=> (line 33, col 4) to (line 33, col 30) +-------------------------------- +35 >for ([, [ + + ~~~~~~~~~~ => Pos: (1146 to 1155) SpanInfo: {"start":1160,"length":25} + >primarySkillA = "primary" + >:=> (line 36, col 4) to (line 36, col 29) +-------------------------------- +36 > primarySkillA = "primary", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1156 to 1186) SpanInfo: {"start":1160,"length":25} + >primarySkillA = "primary" + >:=> (line 36, col 4) to (line 36, col 29) +-------------------------------- +37 > secondarySkillA = "secondary" + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1187 to 1220) SpanInfo: {"start":1191,"length":29} + >secondarySkillA = "secondary" + >:=> (line 37, col 4) to (line 37, col 33) +-------------------------------- +38 >] = ["none", "none"]] = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~ => Pos: (1221 to 1240) SpanInfo: {"start":1191,"length":29} + >secondarySkillA = "secondary" + >:=> (line 37, col 4) to (line 37, col 33) +38 >] = ["none", "none"]] = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~ => Pos: (1241 to 1260) SpanInfo: {"start":1154,"length":87} + >[ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + >] = ["none", "none"] + >:=> (line 35, col 8) to (line 38, col 20) +38 >] = ["none", "none"]] = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1261 to 1267) SpanInfo: {"start":1262,"length":5} + >i = 0 + >:=> (line 38, col 41) to (line 38, col 46) +38 >] = ["none", "none"]] = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1268 to 1274) SpanInfo: {"start":1269,"length":5} + >i < 1 + >:=> (line 38, col 48) to (line 38, col 53) +38 >] = ["none", "none"]] = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (1275 to 1282) SpanInfo: {"start":1276,"length":3} + >i++ + >:=> (line 38, col 55) to (line 38, col 58) +-------------------------------- +39 > console.log(primarySkillA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1283 to 1314) SpanInfo: {"start":1287,"length":26} + >console.log(primarySkillA) + >:=> (line 39, col 4) to (line 39, col 30) +-------------------------------- +40 >} + + ~~ => Pos: (1315 to 1316) SpanInfo: {"start":1287,"length":26} + >console.log(primarySkillA) + >:=> (line 39, col 4) to (line 39, col 30) +-------------------------------- +41 >for ([, [ + + ~~~~~~~~~~ => Pos: (1317 to 1326) SpanInfo: {"start":1331,"length":25} + >primarySkillA = "primary" + >:=> (line 42, col 4) to (line 42, col 29) +-------------------------------- +42 > primarySkillA = "primary", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1327 to 1357) SpanInfo: {"start":1331,"length":25} + >primarySkillA = "primary" + >:=> (line 42, col 4) to (line 42, col 29) +-------------------------------- +43 > secondarySkillA = "secondary" + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1358 to 1391) SpanInfo: {"start":1362,"length":29} + >secondarySkillA = "secondary" + >:=> (line 43, col 4) to (line 43, col 33) +-------------------------------- +44 >] = ["none", "none"]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~ => Pos: (1392 to 1411) SpanInfo: {"start":1362,"length":29} + >secondarySkillA = "secondary" + >:=> (line 43, col 4) to (line 43, col 33) +44 >] = ["none", "none"]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1412 to 1451) SpanInfo: {"start":1325,"length":87} + >[ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + >] = ["none", "none"] + >:=> (line 41, col 8) to (line 44, col 20) +44 >] = ["none", "none"]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1452 to 1458) SpanInfo: {"start":1453,"length":5} + >i = 0 + >:=> (line 44, col 61) to (line 44, col 66) +44 >] = ["none", "none"]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1459 to 1465) SpanInfo: {"start":1460,"length":5} + >i < 1 + >:=> (line 44, col 68) to (line 44, col 73) +44 >] = ["none", "none"]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (1466 to 1473) SpanInfo: {"start":1467,"length":3} + >i++ + >:=> (line 44, col 75) to (line 44, col 78) +-------------------------------- +45 > console.log(primarySkillA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1474 to 1505) SpanInfo: {"start":1478,"length":26} + >console.log(primarySkillA) + >:=> (line 45, col 4) to (line 45, col 30) +-------------------------------- +46 >} + + ~~ => Pos: (1506 to 1507) SpanInfo: {"start":1478,"length":26} + >console.log(primarySkillA) + >:=> (line 45, col 4) to (line 45, col 30) +-------------------------------- +47 >for ([numberB = -1] = robotA, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1508 to 1536) SpanInfo: {"start":1514,"length":12} + >numberB = -1 + >:=> (line 47, col 6) to (line 47, col 18) +47 >for ([numberB = -1] = robotA, i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (1537 to 1543) SpanInfo: {"start":1538,"length":5} + >i = 0 + >:=> (line 47, col 30) to (line 47, col 35) +47 >for ([numberB = -1] = robotA, i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (1544 to 1550) SpanInfo: {"start":1545,"length":5} + >i < 1 + >:=> (line 47, col 37) to (line 47, col 42) +47 >for ([numberB = -1] = robotA, i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (1551 to 1558) SpanInfo: {"start":1552,"length":3} + >i++ + >:=> (line 47, col 44) to (line 47, col 47) +-------------------------------- +48 > console.log(numberB); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1559 to 1584) SpanInfo: {"start":1563,"length":20} + >console.log(numberB) + >:=> (line 48, col 4) to (line 48, col 24) +-------------------------------- +49 >} + + ~~ => Pos: (1585 to 1586) SpanInfo: {"start":1563,"length":20} + >console.log(numberB) + >:=> (line 48, col 4) to (line 48, col 24) +-------------------------------- +50 >for ([numberB = -1] = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1587 to 1619) SpanInfo: {"start":1593,"length":12} + >numberB = -1 + >:=> (line 50, col 6) to (line 50, col 18) +50 >for ([numberB = -1] = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (1620 to 1626) SpanInfo: {"start":1621,"length":5} + >i = 0 + >:=> (line 50, col 34) to (line 50, col 39) +50 >for ([numberB = -1] = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1627 to 1633) SpanInfo: {"start":1628,"length":5} + >i < 1 + >:=> (line 50, col 41) to (line 50, col 46) +50 >for ([numberB = -1] = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (1634 to 1641) SpanInfo: {"start":1635,"length":3} + >i++ + >:=> (line 50, col 48) to (line 50, col 51) +-------------------------------- +51 > console.log(numberB); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1642 to 1667) SpanInfo: {"start":1646,"length":20} + >console.log(numberB) + >:=> (line 51, col 4) to (line 51, col 24) +-------------------------------- +52 >} + + ~~ => Pos: (1668 to 1669) SpanInfo: {"start":1646,"length":20} + >console.log(numberB) + >:=> (line 51, col 4) to (line 51, col 24) +-------------------------------- +53 >for ([numberB = -1] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1670 to 1718) SpanInfo: {"start":1676,"length":12} + >numberB = -1 + >:=> (line 53, col 6) to (line 53, col 18) +53 >for ([numberB = -1] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1719 to 1725) SpanInfo: {"start":1720,"length":5} + >i = 0 + >:=> (line 53, col 50) to (line 53, col 55) +53 >for ([numberB = -1] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1726 to 1732) SpanInfo: {"start":1727,"length":5} + >i < 1 + >:=> (line 53, col 57) to (line 53, col 62) +53 >for ([numberB = -1] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (1733 to 1740) SpanInfo: {"start":1734,"length":3} + >i++ + >:=> (line 53, col 64) to (line 53, col 67) +-------------------------------- +54 > console.log(numberB); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1741 to 1766) SpanInfo: {"start":1745,"length":20} + >console.log(numberB) + >:=> (line 54, col 4) to (line 54, col 24) +-------------------------------- +55 >} + + ~~ => Pos: (1767 to 1768) SpanInfo: {"start":1745,"length":20} + >console.log(numberB) + >:=> (line 54, col 4) to (line 54, col 24) +-------------------------------- +56 >for ([nameB = "name"] = multiRobotA, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1769 to 1804) SpanInfo: {"start":1775,"length":14} + >nameB = "name" + >:=> (line 56, col 6) to (line 56, col 20) +56 >for ([nameB = "name"] = multiRobotA, i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (1805 to 1811) SpanInfo: {"start":1806,"length":5} + >i = 0 + >:=> (line 56, col 37) to (line 56, col 42) +56 >for ([nameB = "name"] = multiRobotA, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1812 to 1818) SpanInfo: {"start":1813,"length":5} + >i < 1 + >:=> (line 56, col 44) to (line 56, col 49) +56 >for ([nameB = "name"] = multiRobotA, i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (1819 to 1826) SpanInfo: {"start":1820,"length":3} + >i++ + >:=> (line 56, col 51) to (line 56, col 54) +-------------------------------- +57 > console.log(nameB); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1827 to 1850) SpanInfo: {"start":1831,"length":18} + >console.log(nameB) + >:=> (line 57, col 4) to (line 57, col 22) +-------------------------------- +58 >} + + ~~ => Pos: (1851 to 1852) SpanInfo: {"start":1831,"length":18} + >console.log(nameB) + >:=> (line 57, col 4) to (line 57, col 22) +-------------------------------- +59 >for ([nameB = "name"] = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1853 to 1892) SpanInfo: {"start":1859,"length":14} + >nameB = "name" + >:=> (line 59, col 6) to (line 59, col 20) +59 >for ([nameB = "name"] = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1893 to 1899) SpanInfo: {"start":1894,"length":5} + >i = 0 + >:=> (line 59, col 41) to (line 59, col 46) +59 >for ([nameB = "name"] = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1900 to 1906) SpanInfo: {"start":1901,"length":5} + >i < 1 + >:=> (line 59, col 48) to (line 59, col 53) +59 >for ([nameB = "name"] = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (1907 to 1914) SpanInfo: {"start":1908,"length":3} + >i++ + >:=> (line 59, col 55) to (line 59, col 58) +-------------------------------- +60 > console.log(nameB); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1915 to 1938) SpanInfo: {"start":1919,"length":18} + >console.log(nameB) + >:=> (line 60, col 4) to (line 60, col 22) +-------------------------------- +61 >} + + ~~ => Pos: (1939 to 1940) SpanInfo: {"start":1919,"length":18} + >console.log(nameB) + >:=> (line 60, col 4) to (line 60, col 22) +-------------------------------- +62 >for ([nameB = "name"] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1941 to 2000) SpanInfo: {"start":1947,"length":14} + >nameB = "name" + >:=> (line 62, col 6) to (line 62, col 20) +62 >for ([nameB = "name"] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (2001 to 2007) SpanInfo: {"start":2002,"length":5} + >i = 0 + >:=> (line 62, col 61) to (line 62, col 66) +62 >for ([nameB = "name"] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (2008 to 2014) SpanInfo: {"start":2009,"length":5} + >i < 1 + >:=> (line 62, col 68) to (line 62, col 73) +62 >for ([nameB = "name"] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (2015 to 2022) SpanInfo: {"start":2016,"length":3} + >i++ + >:=> (line 62, col 75) to (line 62, col 78) +-------------------------------- +63 > console.log(nameB); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2023 to 2046) SpanInfo: {"start":2027,"length":18} + >console.log(nameB) + >:=> (line 63, col 4) to (line 63, col 22) +-------------------------------- +64 >} + + ~~ => Pos: (2047 to 2048) SpanInfo: {"start":2027,"length":18} + >console.log(nameB) + >:=> (line 63, col 4) to (line 63, col 22) +-------------------------------- +65 >for ([numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = robotA, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~ => Pos: (2049 to 2068) SpanInfo: {"start":2055,"length":13} + >numberA2 = -1 + >:=> (line 65, col 6) to (line 65, col 19) +65 >for ([numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = robotA, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~ => Pos: (2069 to 2085) SpanInfo: {"start":2070,"length":15} + >nameA2 = "name" + >:=> (line 65, col 21) to (line 65, col 36) +65 >for ([numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = robotA, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (2086 to 2114) SpanInfo: {"start":2087,"length":17} + >skillA2 = "skill" + >:=> (line 65, col 38) to (line 65, col 55) +65 >for ([numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = robotA, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (2115 to 2121) SpanInfo: {"start":2116,"length":5} + >i = 0 + >:=> (line 65, col 67) to (line 65, col 72) +65 >for ([numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = robotA, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (2122 to 2128) SpanInfo: {"start":2123,"length":5} + >i < 1 + >:=> (line 65, col 74) to (line 65, col 79) +65 >for ([numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = robotA, i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (2129 to 2136) SpanInfo: {"start":2130,"length":3} + >i++ + >:=> (line 65, col 81) to (line 65, col 84) +-------------------------------- +66 > console.log(nameA2); + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2137 to 2161) SpanInfo: {"start":2141,"length":19} + >console.log(nameA2) + >:=> (line 66, col 4) to (line 66, col 23) +-------------------------------- +67 >} + + ~~ => Pos: (2162 to 2163) SpanInfo: {"start":2141,"length":19} + >console.log(nameA2) + >:=> (line 66, col 4) to (line 66, col 23) +-------------------------------- +68 >for ([numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~ => Pos: (2164 to 2183) SpanInfo: {"start":2170,"length":13} + >numberA2 = -1 + >:=> (line 68, col 6) to (line 68, col 19) +68 >for ([numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~ => Pos: (2184 to 2200) SpanInfo: {"start":2185,"length":15} + >nameA2 = "name" + >:=> (line 68, col 21) to (line 68, col 36) +68 >for ([numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (2201 to 2233) SpanInfo: {"start":2202,"length":17} + >skillA2 = "skill" + >:=> (line 68, col 38) to (line 68, col 55) +68 >for ([numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (2234 to 2240) SpanInfo: {"start":2235,"length":5} + >i = 0 + >:=> (line 68, col 71) to (line 68, col 76) +68 >for ([numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (2241 to 2247) SpanInfo: {"start":2242,"length":5} + >i < 1 + >:=> (line 68, col 78) to (line 68, col 83) +68 >for ([numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (2248 to 2255) SpanInfo: {"start":2249,"length":3} + >i++ + >:=> (line 68, col 85) to (line 68, col 88) +-------------------------------- +69 > console.log(nameA2); + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2256 to 2280) SpanInfo: {"start":2260,"length":19} + >console.log(nameA2) + >:=> (line 69, col 4) to (line 69, col 23) +-------------------------------- +70 >} + + ~~ => Pos: (2281 to 2282) SpanInfo: {"start":2260,"length":19} + >console.log(nameA2) + >:=> (line 69, col 4) to (line 69, col 23) +-------------------------------- +71 >for ([numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~ => Pos: (2283 to 2302) SpanInfo: {"start":2289,"length":13} + >numberA2 = -1 + >:=> (line 71, col 6) to (line 71, col 19) +71 >for ([numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~ => Pos: (2303 to 2319) SpanInfo: {"start":2304,"length":15} + >nameA2 = "name" + >:=> (line 71, col 21) to (line 71, col 36) +71 >for ([numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (2320 to 2368) SpanInfo: {"start":2321,"length":17} + >skillA2 = "skill" + >:=> (line 71, col 38) to (line 71, col 55) +71 >for ([numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (2369 to 2375) SpanInfo: {"start":2370,"length":5} + >i = 0 + >:=> (line 71, col 87) to (line 71, col 92) +71 >for ([numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (2376 to 2382) SpanInfo: {"start":2377,"length":5} + >i < 1 + >:=> (line 71, col 94) to (line 71, col 99) +71 >for ([numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (2383 to 2390) SpanInfo: {"start":2384,"length":3} + >i++ + >:=> (line 71, col 101) to (line 71, col 104) +-------------------------------- +72 > console.log(nameA2); + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2391 to 2415) SpanInfo: {"start":2395,"length":19} + >console.log(nameA2) + >:=> (line 72, col 4) to (line 72, col 23) +-------------------------------- +73 >} + + ~~ => Pos: (2416 to 2417) SpanInfo: {"start":2395,"length":19} + >console.log(nameA2) + >:=> (line 72, col 4) to (line 72, col 23) +-------------------------------- +74 >for ([nameMA = "noName", + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2418 to 2442) SpanInfo: {"start":2424,"length":17} + >nameMA = "noName" + >:=> (line 74, col 6) to (line 74, col 23) +-------------------------------- +75 > [ + + ~~~~~~~~~~ => Pos: (2443 to 2452) SpanInfo: {"start":2465,"length":25} + >primarySkillA = "primary" + >:=> (line 76, col 12) to (line 76, col 37) +-------------------------------- +76 > primarySkillA = "primary", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2453 to 2491) SpanInfo: {"start":2465,"length":25} + >primarySkillA = "primary" + >:=> (line 76, col 12) to (line 76, col 37) +-------------------------------- +77 > secondarySkillA = "secondary" + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2492 to 2533) SpanInfo: {"start":2504,"length":29} + >secondarySkillA = "secondary" + >:=> (line 77, col 12) to (line 77, col 41) +-------------------------------- +78 > ] = ["none", "none"] + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2534 to 2562) SpanInfo: {"start":2504,"length":29} + >secondarySkillA = "secondary" + >:=> (line 77, col 12) to (line 77, col 41) +-------------------------------- +79 > ] = multiRobotA, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~ => Pos: (2563 to 2582) SpanInfo: {"start":2451,"length":111} + >[ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["none", "none"] + >:=> (line 75, col 8) to (line 78, col 28) +79 > ] = multiRobotA, i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (2583 to 2589) SpanInfo: {"start":2584,"length":5} + >i = 0 + >:=> (line 79, col 21) to (line 79, col 26) +79 > ] = multiRobotA, i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (2590 to 2596) SpanInfo: {"start":2591,"length":5} + >i < 1 + >:=> (line 79, col 28) to (line 79, col 33) +79 > ] = multiRobotA, i = 0; i < 1; i++) { + + ~~~~~~~~ => Pos: (2597 to 2604) SpanInfo: {"start":2598,"length":3} + >i++ + >:=> (line 79, col 35) to (line 79, col 38) +-------------------------------- +80 > console.log(nameMA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2605 to 2629) SpanInfo: {"start":2609,"length":19} + >console.log(nameMA) + >:=> (line 80, col 4) to (line 80, col 23) +-------------------------------- +81 >} + + ~~ => Pos: (2630 to 2631) SpanInfo: {"start":2609,"length":19} + >console.log(nameMA) + >:=> (line 80, col 4) to (line 80, col 23) +-------------------------------- +82 >for ([nameMA = "noName", + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2632 to 2656) SpanInfo: {"start":2638,"length":17} + >nameMA = "noName" + >:=> (line 82, col 6) to (line 82, col 23) +-------------------------------- +83 > [ + + ~~~~~~ => Pos: (2657 to 2662) SpanInfo: {"start":2671,"length":25} + >primarySkillA = "primary" + >:=> (line 84, col 8) to (line 84, col 33) +-------------------------------- +84 > primarySkillA = "primary", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2663 to 2697) SpanInfo: {"start":2671,"length":25} + >primarySkillA = "primary" + >:=> (line 84, col 8) to (line 84, col 33) +-------------------------------- +85 > secondarySkillA = "secondary" + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2698 to 2735) SpanInfo: {"start":2706,"length":29} + >secondarySkillA = "secondary" + >:=> (line 85, col 8) to (line 85, col 37) +-------------------------------- +86 > ] = ["none", "none"] + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2736 to 2760) SpanInfo: {"start":2706,"length":29} + >secondarySkillA = "secondary" + >:=> (line 85, col 8) to (line 85, col 37) +-------------------------------- +87 >] = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~ => Pos: (2761 to 2780) SpanInfo: {"start":2661,"length":99} + >[ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["none", "none"] + >:=> (line 83, col 4) to (line 86, col 24) +87 >] = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (2781 to 2787) SpanInfo: {"start":2782,"length":5} + >i = 0 + >:=> (line 87, col 21) to (line 87, col 26) +87 >] = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (2788 to 2794) SpanInfo: {"start":2789,"length":5} + >i < 1 + >:=> (line 87, col 28) to (line 87, col 33) +87 >] = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~ => Pos: (2795 to 2802) SpanInfo: {"start":2796,"length":3} + >i++ + >:=> (line 87, col 35) to (line 87, col 38) +-------------------------------- +88 > console.log(nameMA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2803 to 2827) SpanInfo: {"start":2807,"length":19} + >console.log(nameMA) + >:=> (line 88, col 4) to (line 88, col 23) +-------------------------------- +89 >} + + ~~ => Pos: (2828 to 2829) SpanInfo: {"start":2807,"length":19} + >console.log(nameMA) + >:=> (line 88, col 4) to (line 88, col 23) +-------------------------------- +90 >for ([nameMA = "noName", + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2830 to 2854) SpanInfo: {"start":2836,"length":17} + >nameMA = "noName" + >:=> (line 90, col 6) to (line 90, col 23) +-------------------------------- +91 > [ + + ~~~~~~ => Pos: (2855 to 2860) SpanInfo: {"start":2869,"length":25} + >primarySkillA = "primary" + >:=> (line 92, col 8) to (line 92, col 33) +-------------------------------- +92 > primarySkillA = "primary", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2861 to 2895) SpanInfo: {"start":2869,"length":25} + >primarySkillA = "primary" + >:=> (line 92, col 8) to (line 92, col 33) +-------------------------------- +93 > secondarySkillA = "secondary" + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2896 to 2933) SpanInfo: {"start":2904,"length":29} + >secondarySkillA = "secondary" + >:=> (line 93, col 8) to (line 93, col 37) +-------------------------------- +94 > ] = ["none", "none"] + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2934 to 2958) SpanInfo: {"start":2904,"length":29} + >secondarySkillA = "secondary" + >:=> (line 93, col 8) to (line 93, col 37) +-------------------------------- +95 >] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2959 to 2998) SpanInfo: {"start":2859,"length":99} + >[ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["none", "none"] + >:=> (line 91, col 4) to (line 94, col 24) +95 >] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (2999 to 3005) SpanInfo: {"start":3000,"length":5} + >i = 0 + >:=> (line 95, col 41) to (line 95, col 46) +95 >] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (3006 to 3012) SpanInfo: {"start":3007,"length":5} + >i < 1 + >:=> (line 95, col 48) to (line 95, col 53) +95 >] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (3013 to 3020) SpanInfo: {"start":3014,"length":3} + >i++ + >:=> (line 95, col 55) to (line 95, col 58) +-------------------------------- +96 > console.log(nameMA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (3021 to 3045) SpanInfo: {"start":3025,"length":19} + >console.log(nameMA) + >:=> (line 96, col 4) to (line 96, col 23) +-------------------------------- +97 >} + + ~~ => Pos: (3046 to 3047) SpanInfo: {"start":3025,"length":19} + >console.log(nameMA) + >:=> (line 96, col 4) to (line 96, col 23) +-------------------------------- +98 >for ([numberA3 = -1, ...robotAInfo] = robotA, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~ => Pos: (3048 to 3067) SpanInfo: {"start":3054,"length":13} + >numberA3 = -1 + >:=> (line 98, col 6) to (line 98, col 19) +98 >for ([numberA3 = -1, ...robotAInfo] = robotA, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (3068 to 3092) SpanInfo: {"start":3069,"length":13} + >...robotAInfo + >:=> (line 98, col 21) to (line 98, col 34) +98 >for ([numberA3 = -1, ...robotAInfo] = robotA, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (3093 to 3099) SpanInfo: {"start":3094,"length":5} + >i = 0 + >:=> (line 98, col 46) to (line 98, col 51) +98 >for ([numberA3 = -1, ...robotAInfo] = robotA, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (3100 to 3106) SpanInfo: {"start":3101,"length":5} + >i < 1 + >:=> (line 98, col 53) to (line 98, col 58) +98 >for ([numberA3 = -1, ...robotAInfo] = robotA, i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (3107 to 3114) SpanInfo: {"start":3108,"length":3} + >i++ + >:=> (line 98, col 60) to (line 98, col 63) +-------------------------------- +99 > console.log(numberA3); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (3115 to 3141) SpanInfo: {"start":3119,"length":21} + >console.log(numberA3) + >:=> (line 99, col 4) to (line 99, col 25) +-------------------------------- +100>} + + ~~ => Pos: (3142 to 3143) SpanInfo: {"start":3119,"length":21} + >console.log(numberA3) + >:=> (line 99, col 4) to (line 99, col 25) +-------------------------------- +101>for ([numberA3 = -1, ...robotAInfo] = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~ => Pos: (3144 to 3163) SpanInfo: {"start":3150,"length":13} + >numberA3 = -1 + >:=> (line 101, col 6) to (line 101, col 19) +101>for ([numberA3 = -1, ...robotAInfo] = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (3164 to 3192) SpanInfo: {"start":3165,"length":13} + >...robotAInfo + >:=> (line 101, col 21) to (line 101, col 34) +101>for ([numberA3 = -1, ...robotAInfo] = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (3193 to 3199) SpanInfo: {"start":3194,"length":5} + >i = 0 + >:=> (line 101, col 50) to (line 101, col 55) +101>for ([numberA3 = -1, ...robotAInfo] = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (3200 to 3206) SpanInfo: {"start":3201,"length":5} + >i < 1 + >:=> (line 101, col 57) to (line 101, col 62) +101>for ([numberA3 = -1, ...robotAInfo] = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (3207 to 3214) SpanInfo: {"start":3208,"length":3} + >i++ + >:=> (line 101, col 64) to (line 101, col 67) +-------------------------------- +102> console.log(numberA3); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (3215 to 3241) SpanInfo: {"start":3219,"length":21} + >console.log(numberA3) + >:=> (line 102, col 4) to (line 102, col 25) +-------------------------------- +103>} + + ~~ => Pos: (3242 to 3243) SpanInfo: {"start":3219,"length":21} + >console.log(numberA3) + >:=> (line 102, col 4) to (line 102, col 25) +-------------------------------- +104>for ([numberA3 = -1, ...robotAInfo] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~ => Pos: (3244 to 3263) SpanInfo: {"start":3250,"length":13} + >numberA3 = -1 + >:=> (line 104, col 6) to (line 104, col 19) +104>for ([numberA3 = -1, ...robotAInfo] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (3264 to 3315) SpanInfo: {"start":3265,"length":13} + >...robotAInfo + >:=> (line 104, col 21) to (line 104, col 34) +104>for ([numberA3 = -1, ...robotAInfo] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (3316 to 3322) SpanInfo: {"start":3317,"length":5} + >i = 0 + >:=> (line 104, col 73) to (line 104, col 78) +104>for ([numberA3 = -1, ...robotAInfo] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (3323 to 3329) SpanInfo: {"start":3324,"length":5} + >i < 1 + >:=> (line 104, col 80) to (line 104, col 85) +104>for ([numberA3 = -1, ...robotAInfo] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (3330 to 3337) SpanInfo: {"start":3331,"length":3} + >i++ + >:=> (line 104, col 87) to (line 104, col 90) +-------------------------------- +105> console.log(numberA3); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (3338 to 3364) SpanInfo: {"start":3342,"length":21} + >console.log(numberA3) + >:=> (line 105, col 4) to (line 105, col 25) +-------------------------------- +106>} + ~ => Pos: (3365 to 3365) SpanInfo: {"start":3342,"length":21} + >console.log(numberA3) + >:=> (line 105, col 4) to (line 105, col 25) \ No newline at end of file diff --git a/tests/baselines/reference/bpSpanDestructuringAssignmentForObjectBindingPattern.baseline b/tests/baselines/reference/bpSpanDestructuringAssignmentForObjectBindingPattern.baseline new file mode 100644 index 00000000000..c318d875ddf --- /dev/null +++ b/tests/baselines/reference/bpSpanDestructuringAssignmentForObjectBindingPattern.baseline @@ -0,0 +1,1171 @@ + +1 >declare var console: { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (0 to 22) SpanInfo: undefined +-------------------------------- +2 > log(msg: any): void; + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (23 to 47) SpanInfo: undefined +-------------------------------- +3 >} + + ~~ => Pos: (48 to 49) SpanInfo: undefined +-------------------------------- +4 >interface Robot { + + ~~~~~~~~~~~~~~~~~~ => Pos: (50 to 67) SpanInfo: undefined +-------------------------------- +5 > name: string; + + ~~~~~~~~~~~~~~~~~~ => Pos: (68 to 85) SpanInfo: undefined +-------------------------------- +6 > skill: string; + + ~~~~~~~~~~~~~~~~~~~ => Pos: (86 to 104) SpanInfo: undefined +-------------------------------- +7 >} + + ~~ => Pos: (105 to 106) SpanInfo: undefined +-------------------------------- +8 >interface MultiRobot { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (107 to 129) SpanInfo: undefined +-------------------------------- +9 > name: string; + + ~~~~~~~~~~~~~~~~~~ => Pos: (130 to 147) SpanInfo: undefined +-------------------------------- +10 > skills: { + + ~~~~~~~~~~~~~~ => Pos: (148 to 161) SpanInfo: undefined +-------------------------------- +11 > primary: string; + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (162 to 186) SpanInfo: undefined +-------------------------------- +12 > secondary: string; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (187 to 213) SpanInfo: undefined +-------------------------------- +13 > }; + + ~~~~~~~ => Pos: (214 to 220) SpanInfo: undefined +-------------------------------- +14 >} + + ~~ => Pos: (221 to 222) SpanInfo: undefined +-------------------------------- +15 >let robot: Robot = { name: "mower", skill: "mowing" }; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (223 to 277) SpanInfo: {"start":223,"length":53} + >let robot: Robot = { name: "mower", skill: "mowing" } + >:=> (line 15, col 0) to (line 15, col 53) +-------------------------------- +16 >let multiRobot: MultiRobot = { name: "mower", skills: { primary: "mowing", secondary: "none" } }; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (278 to 375) SpanInfo: {"start":278,"length":96} + >let multiRobot: MultiRobot = { name: "mower", skills: { primary: "mowing", secondary: "none" } } + >:=> (line 16, col 0) to (line 16, col 96) +-------------------------------- +17 >function getRobot() { + + ~~~~~~~~~~~~~~~~~~~~~~ => Pos: (376 to 397) SpanInfo: {"start":402,"length":12} + >return robot + >:=> (line 18, col 4) to (line 18, col 16) +-------------------------------- +18 > return robot; + + ~~~~~~~~~~~~~~~~~~ => Pos: (398 to 415) SpanInfo: {"start":402,"length":12} + >return robot + >:=> (line 18, col 4) to (line 18, col 16) +-------------------------------- +19 >} + + ~~ => Pos: (416 to 417) SpanInfo: {"start":416,"length":1} + >} + >:=> (line 19, col 0) to (line 19, col 1) +-------------------------------- +20 >function getMultiRobot() { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (418 to 444) SpanInfo: {"start":449,"length":17} + >return multiRobot + >:=> (line 21, col 4) to (line 21, col 21) +-------------------------------- +21 > return multiRobot; + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (445 to 467) SpanInfo: {"start":449,"length":17} + >return multiRobot + >:=> (line 21, col 4) to (line 21, col 21) +-------------------------------- +22 >} + + ~~ => Pos: (468 to 469) SpanInfo: {"start":468,"length":1} + >} + >:=> (line 22, col 0) to (line 22, col 1) +-------------------------------- +23 >let nameA: string, primaryA: string, secondaryA: string, i: number, skillA: string; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (470 to 553) SpanInfo: undefined +-------------------------------- +24 >let name: string, primary: string, secondary: string, skill: string; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (554 to 622) SpanInfo: undefined +-------------------------------- +25 >for ({ name: nameA } = robot, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (623 to 651) SpanInfo: {"start":630,"length":11} + >name: nameA + >:=> (line 25, col 7) to (line 25, col 18) +25 >for ({ name: nameA } = robot, i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (652 to 658) SpanInfo: {"start":653,"length":5} + >i = 0 + >:=> (line 25, col 30) to (line 25, col 35) +25 >for ({ name: nameA } = robot, i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (659 to 665) SpanInfo: {"start":660,"length":5} + >i < 1 + >:=> (line 25, col 37) to (line 25, col 42) +25 >for ({ name: nameA } = robot, i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (666 to 673) SpanInfo: {"start":667,"length":3} + >i++ + >:=> (line 25, col 44) to (line 25, col 47) +-------------------------------- +26 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (674 to 697) SpanInfo: {"start":678,"length":18} + >console.log(nameA) + >:=> (line 26, col 4) to (line 26, col 22) +-------------------------------- +27 >} + + ~~ => Pos: (698 to 699) SpanInfo: {"start":678,"length":18} + >console.log(nameA) + >:=> (line 26, col 4) to (line 26, col 22) +-------------------------------- +28 >for ({ name: nameA } = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (700 to 733) SpanInfo: {"start":707,"length":11} + >name: nameA + >:=> (line 28, col 7) to (line 28, col 18) +28 >for ({ name: nameA } = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (734 to 740) SpanInfo: {"start":735,"length":5} + >i = 0 + >:=> (line 28, col 35) to (line 28, col 40) +28 >for ({ name: nameA } = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (741 to 747) SpanInfo: {"start":742,"length":5} + >i < 1 + >:=> (line 28, col 42) to (line 28, col 47) +28 >for ({ name: nameA } = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (748 to 755) SpanInfo: {"start":749,"length":3} + >i++ + >:=> (line 28, col 49) to (line 28, col 52) +-------------------------------- +29 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (756 to 779) SpanInfo: {"start":760,"length":18} + >console.log(nameA) + >:=> (line 29, col 4) to (line 29, col 22) +-------------------------------- +30 >} + + ~~ => Pos: (780 to 781) SpanInfo: {"start":760,"length":18} + >console.log(nameA) + >:=> (line 29, col 4) to (line 29, col 22) +-------------------------------- +31 >for ({ name: nameA } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (782 to 850) SpanInfo: {"start":789,"length":11} + >name: nameA + >:=> (line 31, col 7) to (line 31, col 18) +31 >for ({ name: nameA } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (851 to 857) SpanInfo: {"start":852,"length":5} + >i = 0 + >:=> (line 31, col 70) to (line 31, col 75) +31 >for ({ name: nameA } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (858 to 864) SpanInfo: {"start":859,"length":5} + >i < 1 + >:=> (line 31, col 77) to (line 31, col 82) +31 >for ({ name: nameA } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (865 to 872) SpanInfo: {"start":866,"length":3} + >i++ + >:=> (line 31, col 84) to (line 31, col 87) +-------------------------------- +32 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (873 to 896) SpanInfo: {"start":877,"length":18} + >console.log(nameA) + >:=> (line 32, col 4) to (line 32, col 22) +-------------------------------- +33 >} + + ~~ => Pos: (897 to 898) SpanInfo: {"start":877,"length":18} + >console.log(nameA) + >:=> (line 32, col 4) to (line 32, col 22) +-------------------------------- +34 >for ({ skills: { primary: primaryA, secondary: secondaryA } } = multiRobot, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~ => Pos: (899 to 912) SpanInfo: {"start":906,"length":52} + >skills: { primary: primaryA, secondary: secondaryA } + >:=> (line 34, col 7) to (line 34, col 59) +34 >for ({ skills: { primary: primaryA, secondary: secondaryA } } = multiRobot, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~ => Pos: (913 to 933) SpanInfo: {"start":916,"length":17} + >primary: primaryA + >:=> (line 34, col 17) to (line 34, col 34) +34 >for ({ skills: { primary: primaryA, secondary: secondaryA } } = multiRobot, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (934 to 957) SpanInfo: {"start":935,"length":21} + >secondary: secondaryA + >:=> (line 34, col 36) to (line 34, col 57) +34 >for ({ skills: { primary: primaryA, secondary: secondaryA } } = multiRobot, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~=> Pos: (958 to 973) SpanInfo: {"start":906,"length":52} + >skills: { primary: primaryA, secondary: secondaryA } + >:=> (line 34, col 7) to (line 34, col 59) +34 >for ({ skills: { primary: primaryA, secondary: secondaryA } } = multiRobot, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (974 to 980) SpanInfo: {"start":975,"length":5} + >i = 0 + >:=> (line 34, col 76) to (line 34, col 81) +34 >for ({ skills: { primary: primaryA, secondary: secondaryA } } = multiRobot, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (981 to 987) SpanInfo: {"start":982,"length":5} + >i < 1 + >:=> (line 34, col 83) to (line 34, col 88) +34 >for ({ skills: { primary: primaryA, secondary: secondaryA } } = multiRobot, i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (988 to 995) SpanInfo: {"start":989,"length":3} + >i++ + >:=> (line 34, col 90) to (line 34, col 93) +-------------------------------- +35 > console.log(primaryA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (996 to 1022) SpanInfo: {"start":1000,"length":21} + >console.log(primaryA) + >:=> (line 35, col 4) to (line 35, col 25) +-------------------------------- +36 >} + + ~~ => Pos: (1023 to 1024) SpanInfo: {"start":1000,"length":21} + >console.log(primaryA) + >:=> (line 35, col 4) to (line 35, col 25) +-------------------------------- +37 >for ({ skills: { primary: primaryA, secondary: secondaryA } } = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~ => Pos: (1025 to 1038) SpanInfo: {"start":1032,"length":52} + >skills: { primary: primaryA, secondary: secondaryA } + >:=> (line 37, col 7) to (line 37, col 59) +37 >for ({ skills: { primary: primaryA, secondary: secondaryA } } = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~ => Pos: (1039 to 1059) SpanInfo: {"start":1042,"length":17} + >primary: primaryA + >:=> (line 37, col 17) to (line 37, col 34) +37 >for ({ skills: { primary: primaryA, secondary: secondaryA } } = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1060 to 1083) SpanInfo: {"start":1061,"length":21} + >secondary: secondaryA + >:=> (line 37, col 36) to (line 37, col 57) +37 >for ({ skills: { primary: primaryA, secondary: secondaryA } } = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~=> Pos: (1084 to 1104) SpanInfo: {"start":1032,"length":52} + >skills: { primary: primaryA, secondary: secondaryA } + >:=> (line 37, col 7) to (line 37, col 59) +37 >for ({ skills: { primary: primaryA, secondary: secondaryA } } = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1105 to 1111) SpanInfo: {"start":1106,"length":5} + >i = 0 + >:=> (line 37, col 81) to (line 37, col 86) +37 >for ({ skills: { primary: primaryA, secondary: secondaryA } } = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1112 to 1118) SpanInfo: {"start":1113,"length":5} + >i < 1 + >:=> (line 37, col 88) to (line 37, col 93) +37 >for ({ skills: { primary: primaryA, secondary: secondaryA } } = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (1119 to 1126) SpanInfo: {"start":1120,"length":3} + >i++ + >:=> (line 37, col 95) to (line 37, col 98) +-------------------------------- +38 > console.log(primaryA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1127 to 1153) SpanInfo: {"start":1131,"length":21} + >console.log(primaryA) + >:=> (line 38, col 4) to (line 38, col 25) +-------------------------------- +39 >} + + ~~ => Pos: (1154 to 1155) SpanInfo: {"start":1131,"length":21} + >console.log(primaryA) + >:=> (line 38, col 4) to (line 38, col 25) +-------------------------------- +40 >for ({ skills: { primary: primaryA, secondary: secondaryA } } = + + ~~~~~~~~~~~~~~ => Pos: (1156 to 1169) SpanInfo: {"start":1163,"length":52} + >skills: { primary: primaryA, secondary: secondaryA } + >:=> (line 40, col 7) to (line 40, col 59) +40 >for ({ skills: { primary: primaryA, secondary: secondaryA } } = + + ~~~~~~~~~~~~~~~~~~~~~ => Pos: (1170 to 1190) SpanInfo: {"start":1173,"length":17} + >primary: primaryA + >:=> (line 40, col 17) to (line 40, col 34) +40 >for ({ skills: { primary: primaryA, secondary: secondaryA } } = + + ~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1191 to 1214) SpanInfo: {"start":1192,"length":21} + >secondary: secondaryA + >:=> (line 40, col 36) to (line 40, col 57) +40 >for ({ skills: { primary: primaryA, secondary: secondaryA } } = + + ~~~~~=> Pos: (1215 to 1219) SpanInfo: {"start":1163,"length":52} + >skills: { primary: primaryA, secondary: secondaryA } + >:=> (line 40, col 7) to (line 40, col 59) +-------------------------------- +41 > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1220 to 1310) SpanInfo: {"start":1163,"length":52} + >skills: { primary: primaryA, secondary: secondaryA } + >:=> (line 40, col 7) to (line 40, col 59) +-------------------------------- +42 > i = 0; i < 1; i++) { + + ~~~~~~~~~~ => Pos: (1311 to 1320) SpanInfo: {"start":1315,"length":5} + >i = 0 + >:=> (line 42, col 4) to (line 42, col 9) +42 > i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (1321 to 1327) SpanInfo: {"start":1322,"length":5} + >i < 1 + >:=> (line 42, col 11) to (line 42, col 16) +42 > i = 0; i < 1; i++) { + + ~~~~~~~~ => Pos: (1328 to 1335) SpanInfo: {"start":1329,"length":3} + >i++ + >:=> (line 42, col 18) to (line 42, col 21) +-------------------------------- +43 > console.log(primaryA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1336 to 1362) SpanInfo: {"start":1340,"length":21} + >console.log(primaryA) + >:=> (line 43, col 4) to (line 43, col 25) +-------------------------------- +44 >} + + ~~ => Pos: (1363 to 1364) SpanInfo: {"start":1340,"length":21} + >console.log(primaryA) + >:=> (line 43, col 4) to (line 43, col 25) +-------------------------------- +45 >for ({ name } = robot, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1365 to 1386) SpanInfo: {"start":1372,"length":4} + >name + >:=> (line 45, col 7) to (line 45, col 11) +45 >for ({ name } = robot, i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (1387 to 1393) SpanInfo: {"start":1388,"length":5} + >i = 0 + >:=> (line 45, col 23) to (line 45, col 28) +45 >for ({ name } = robot, i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (1394 to 1400) SpanInfo: {"start":1395,"length":5} + >i < 1 + >:=> (line 45, col 30) to (line 45, col 35) +45 >for ({ name } = robot, i = 0; i < 1; i++) { + + ~~~~~~~~ => Pos: (1401 to 1408) SpanInfo: {"start":1402,"length":3} + >i++ + >:=> (line 45, col 37) to (line 45, col 40) +-------------------------------- +46 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1409 to 1432) SpanInfo: {"start":1413,"length":18} + >console.log(nameA) + >:=> (line 46, col 4) to (line 46, col 22) +-------------------------------- +47 >} + + ~~ => Pos: (1433 to 1434) SpanInfo: {"start":1413,"length":18} + >console.log(nameA) + >:=> (line 46, col 4) to (line 46, col 22) +-------------------------------- +48 >for ({ name } = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1435 to 1461) SpanInfo: {"start":1442,"length":4} + >name + >:=> (line 48, col 7) to (line 48, col 11) +48 >for ({ name } = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (1462 to 1468) SpanInfo: {"start":1463,"length":5} + >i = 0 + >:=> (line 48, col 28) to (line 48, col 33) +48 >for ({ name } = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (1469 to 1475) SpanInfo: {"start":1470,"length":5} + >i < 1 + >:=> (line 48, col 35) to (line 48, col 40) +48 >for ({ name } = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (1476 to 1483) SpanInfo: {"start":1477,"length":3} + >i++ + >:=> (line 48, col 42) to (line 48, col 45) +-------------------------------- +49 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1484 to 1507) SpanInfo: {"start":1488,"length":18} + >console.log(nameA) + >:=> (line 49, col 4) to (line 49, col 22) +-------------------------------- +50 >} + + ~~ => Pos: (1508 to 1509) SpanInfo: {"start":1488,"length":18} + >console.log(nameA) + >:=> (line 49, col 4) to (line 49, col 22) +-------------------------------- +51 >for ({ name } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1510 to 1571) SpanInfo: {"start":1517,"length":4} + >name + >:=> (line 51, col 7) to (line 51, col 11) +51 >for ({ name } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1572 to 1578) SpanInfo: {"start":1573,"length":5} + >i = 0 + >:=> (line 51, col 63) to (line 51, col 68) +51 >for ({ name } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1579 to 1585) SpanInfo: {"start":1580,"length":5} + >i < 1 + >:=> (line 51, col 70) to (line 51, col 75) +51 >for ({ name } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (1586 to 1593) SpanInfo: {"start":1587,"length":3} + >i++ + >:=> (line 51, col 77) to (line 51, col 80) +-------------------------------- +52 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1594 to 1617) SpanInfo: {"start":1598,"length":18} + >console.log(nameA) + >:=> (line 52, col 4) to (line 52, col 22) +-------------------------------- +53 >} + + ~~ => Pos: (1618 to 1619) SpanInfo: {"start":1598,"length":18} + >console.log(nameA) + >:=> (line 52, col 4) to (line 52, col 22) +-------------------------------- +54 >for ({ skills: { primary, secondary } } = multiRobot, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~ => Pos: (1620 to 1633) SpanInfo: {"start":1627,"length":30} + >skills: { primary, secondary } + >:=> (line 54, col 7) to (line 54, col 37) +54 >for ({ skills: { primary, secondary } } = multiRobot, i = 0; i < 1; i++) { + + ~~~~~~~~~~~ => Pos: (1634 to 1644) SpanInfo: {"start":1637,"length":7} + >primary + >:=> (line 54, col 17) to (line 54, col 24) +54 >for ({ skills: { primary, secondary } } = multiRobot, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~ => Pos: (1645 to 1656) SpanInfo: {"start":1646,"length":9} + >secondary + >:=> (line 54, col 26) to (line 54, col 35) +54 >for ({ skills: { primary, secondary } } = multiRobot, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~=> Pos: (1657 to 1672) SpanInfo: {"start":1627,"length":30} + >skills: { primary, secondary } + >:=> (line 54, col 7) to (line 54, col 37) +54 >for ({ skills: { primary, secondary } } = multiRobot, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1673 to 1679) SpanInfo: {"start":1674,"length":5} + >i = 0 + >:=> (line 54, col 54) to (line 54, col 59) +54 >for ({ skills: { primary, secondary } } = multiRobot, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1680 to 1686) SpanInfo: {"start":1681,"length":5} + >i < 1 + >:=> (line 54, col 61) to (line 54, col 66) +54 >for ({ skills: { primary, secondary } } = multiRobot, i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (1687 to 1694) SpanInfo: {"start":1688,"length":3} + >i++ + >:=> (line 54, col 68) to (line 54, col 71) +-------------------------------- +55 > console.log(primaryA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1695 to 1721) SpanInfo: {"start":1699,"length":21} + >console.log(primaryA) + >:=> (line 55, col 4) to (line 55, col 25) +-------------------------------- +56 >} + + ~~ => Pos: (1722 to 1723) SpanInfo: {"start":1699,"length":21} + >console.log(primaryA) + >:=> (line 55, col 4) to (line 55, col 25) +-------------------------------- +57 >for ({ skills: { primary, secondary } } = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~ => Pos: (1724 to 1737) SpanInfo: {"start":1731,"length":30} + >skills: { primary, secondary } + >:=> (line 57, col 7) to (line 57, col 37) +57 >for ({ skills: { primary, secondary } } = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~ => Pos: (1738 to 1748) SpanInfo: {"start":1741,"length":7} + >primary + >:=> (line 57, col 17) to (line 57, col 24) +57 >for ({ skills: { primary, secondary } } = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~ => Pos: (1749 to 1760) SpanInfo: {"start":1750,"length":9} + >secondary + >:=> (line 57, col 26) to (line 57, col 35) +57 >for ({ skills: { primary, secondary } } = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~=> Pos: (1761 to 1781) SpanInfo: {"start":1731,"length":30} + >skills: { primary, secondary } + >:=> (line 57, col 7) to (line 57, col 37) +57 >for ({ skills: { primary, secondary } } = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1782 to 1788) SpanInfo: {"start":1783,"length":5} + >i = 0 + >:=> (line 57, col 59) to (line 57, col 64) +57 >for ({ skills: { primary, secondary } } = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1789 to 1795) SpanInfo: {"start":1790,"length":5} + >i < 1 + >:=> (line 57, col 66) to (line 57, col 71) +57 >for ({ skills: { primary, secondary } } = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (1796 to 1803) SpanInfo: {"start":1797,"length":3} + >i++ + >:=> (line 57, col 73) to (line 57, col 76) +-------------------------------- +58 > console.log(primaryA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1804 to 1830) SpanInfo: {"start":1808,"length":21} + >console.log(primaryA) + >:=> (line 58, col 4) to (line 58, col 25) +-------------------------------- +59 >} + + ~~ => Pos: (1831 to 1832) SpanInfo: {"start":1808,"length":21} + >console.log(primaryA) + >:=> (line 58, col 4) to (line 58, col 25) +-------------------------------- +60 >for ({ skills: { primary, secondary } } = + + ~~~~~~~~~~~~~~ => Pos: (1833 to 1846) SpanInfo: {"start":1840,"length":30} + >skills: { primary, secondary } + >:=> (line 60, col 7) to (line 60, col 37) +60 >for ({ skills: { primary, secondary } } = + + ~~~~~~~~~~~ => Pos: (1847 to 1857) SpanInfo: {"start":1850,"length":7} + >primary + >:=> (line 60, col 17) to (line 60, col 24) +60 >for ({ skills: { primary, secondary } } = + + ~~~~~~~~~~~~ => Pos: (1858 to 1869) SpanInfo: {"start":1859,"length":9} + >secondary + >:=> (line 60, col 26) to (line 60, col 35) +60 >for ({ skills: { primary, secondary } } = + + ~~~~~ => Pos: (1870 to 1874) SpanInfo: {"start":1840,"length":30} + >skills: { primary, secondary } + >:=> (line 60, col 7) to (line 60, col 37) +-------------------------------- +61 > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1875 to 1965) SpanInfo: {"start":1840,"length":30} + >skills: { primary, secondary } + >:=> (line 60, col 7) to (line 60, col 37) +-------------------------------- +62 > i = 0; i < 1; i++) { + + ~~~~~~~~~~ => Pos: (1966 to 1975) SpanInfo: {"start":1970,"length":5} + >i = 0 + >:=> (line 62, col 4) to (line 62, col 9) +62 > i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (1976 to 1982) SpanInfo: {"start":1977,"length":5} + >i < 1 + >:=> (line 62, col 11) to (line 62, col 16) +62 > i = 0; i < 1; i++) { + + ~~~~~~~~ => Pos: (1983 to 1990) SpanInfo: {"start":1984,"length":3} + >i++ + >:=> (line 62, col 18) to (line 62, col 21) +-------------------------------- +63 > console.log(primaryA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1991 to 2017) SpanInfo: {"start":1995,"length":21} + >console.log(primaryA) + >:=> (line 63, col 4) to (line 63, col 25) +-------------------------------- +64 >} + + ~~ => Pos: (2018 to 2019) SpanInfo: {"start":1995,"length":21} + >console.log(primaryA) + >:=> (line 63, col 4) to (line 63, col 25) +-------------------------------- +65 >for ({ name: nameA, skill: skillA } = robot, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~ => Pos: (2020 to 2038) SpanInfo: {"start":2027,"length":11} + >name: nameA + >:=> (line 65, col 7) to (line 65, col 18) +65 >for ({ name: nameA, skill: skillA } = robot, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2039 to 2063) SpanInfo: {"start":2040,"length":13} + >skill: skillA + >:=> (line 65, col 20) to (line 65, col 33) +65 >for ({ name: nameA, skill: skillA } = robot, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (2064 to 2070) SpanInfo: {"start":2065,"length":5} + >i = 0 + >:=> (line 65, col 45) to (line 65, col 50) +65 >for ({ name: nameA, skill: skillA } = robot, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (2071 to 2077) SpanInfo: {"start":2072,"length":5} + >i < 1 + >:=> (line 65, col 52) to (line 65, col 57) +65 >for ({ name: nameA, skill: skillA } = robot, i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (2078 to 2085) SpanInfo: {"start":2079,"length":3} + >i++ + >:=> (line 65, col 59) to (line 65, col 62) +-------------------------------- +66 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2086 to 2109) SpanInfo: {"start":2090,"length":18} + >console.log(nameA) + >:=> (line 66, col 4) to (line 66, col 22) +-------------------------------- +67 >} + + ~~ => Pos: (2110 to 2111) SpanInfo: {"start":2090,"length":18} + >console.log(nameA) + >:=> (line 66, col 4) to (line 66, col 22) +-------------------------------- +68 >for ({ name: nameA, skill: skillA } = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~ => Pos: (2112 to 2130) SpanInfo: {"start":2119,"length":11} + >name: nameA + >:=> (line 68, col 7) to (line 68, col 18) +68 >for ({ name: nameA, skill: skillA } = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (2131 to 2160) SpanInfo: {"start":2132,"length":13} + >skill: skillA + >:=> (line 68, col 20) to (line 68, col 33) +68 >for ({ name: nameA, skill: skillA } = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (2161 to 2167) SpanInfo: {"start":2162,"length":5} + >i = 0 + >:=> (line 68, col 50) to (line 68, col 55) +68 >for ({ name: nameA, skill: skillA } = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (2168 to 2174) SpanInfo: {"start":2169,"length":5} + >i < 1 + >:=> (line 68, col 57) to (line 68, col 62) +68 >for ({ name: nameA, skill: skillA } = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (2175 to 2182) SpanInfo: {"start":2176,"length":3} + >i++ + >:=> (line 68, col 64) to (line 68, col 67) +-------------------------------- +69 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2183 to 2206) SpanInfo: {"start":2187,"length":18} + >console.log(nameA) + >:=> (line 69, col 4) to (line 69, col 22) +-------------------------------- +70 >} + + ~~ => Pos: (2207 to 2208) SpanInfo: {"start":2187,"length":18} + >console.log(nameA) + >:=> (line 69, col 4) to (line 69, col 22) +-------------------------------- +71 >for ({ name: nameA, skill: skillA } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~ => Pos: (2209 to 2227) SpanInfo: {"start":2216,"length":11} + >name: nameA + >:=> (line 71, col 7) to (line 71, col 18) +71 >for ({ name: nameA, skill: skillA } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (2228 to 2292) SpanInfo: {"start":2229,"length":13} + >skill: skillA + >:=> (line 71, col 20) to (line 71, col 33) +71 >for ({ name: nameA, skill: skillA } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (2293 to 2299) SpanInfo: {"start":2294,"length":5} + >i = 0 + >:=> (line 71, col 85) to (line 71, col 90) +71 >for ({ name: nameA, skill: skillA } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (2300 to 2306) SpanInfo: {"start":2301,"length":5} + >i < 1 + >:=> (line 71, col 92) to (line 71, col 97) +71 >for ({ name: nameA, skill: skillA } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (2307 to 2314) SpanInfo: {"start":2308,"length":3} + >i++ + >:=> (line 71, col 99) to (line 71, col 102) +-------------------------------- +72 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2315 to 2338) SpanInfo: {"start":2319,"length":18} + >console.log(nameA) + >:=> (line 72, col 4) to (line 72, col 22) +-------------------------------- +73 >} + + ~~ => Pos: (2339 to 2340) SpanInfo: {"start":2319,"length":18} + >console.log(nameA) + >:=> (line 72, col 4) to (line 72, col 22) +-------------------------------- +74 >for ({ name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = multiRobot, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~ => Pos: (2341 to 2359) SpanInfo: {"start":2348,"length":11} + >name: nameA + >:=> (line 74, col 7) to (line 74, col 18) +74 >for ({ name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = multiRobot, i = 0; i < 1; i++) { + + ~~~~~~~~ => Pos: (2360 to 2367) SpanInfo: {"start":2361,"length":52} + >skills: { primary: primaryA, secondary: secondaryA } + >:=> (line 74, col 20) to (line 74, col 72) +74 >for ({ name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = multiRobot, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~=> Pos: (2368 to 2388) SpanInfo: {"start":2371,"length":17} + >primary: primaryA + >:=> (line 74, col 30) to (line 74, col 47) +74 >for ({ name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = multiRobot, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (2389 to 2412) SpanInfo: {"start":2390,"length":21} + >secondary: secondaryA + >:=> (line 74, col 49) to (line 74, col 70) +74 >for ({ name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = multiRobot, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~=> Pos: (2413 to 2428) SpanInfo: {"start":2361,"length":52} + >skills: { primary: primaryA, secondary: secondaryA } + >:=> (line 74, col 20) to (line 74, col 72) +74 >for ({ name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = multiRobot, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (2429 to 2435) SpanInfo: {"start":2430,"length":5} + >i = 0 + >:=> (line 74, col 89) to (line 74, col 94) +74 >for ({ name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = multiRobot, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (2436 to 2442) SpanInfo: {"start":2437,"length":5} + >i < 1 + >:=> (line 74, col 96) to (line 74, col 101) +74 >for ({ name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = multiRobot, i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (2443 to 2450) SpanInfo: {"start":2444,"length":3} + >i++ + >:=> (line 74, col 103) to (line 74, col 106) +-------------------------------- +75 > console.log(primaryA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2451 to 2477) SpanInfo: {"start":2455,"length":21} + >console.log(primaryA) + >:=> (line 75, col 4) to (line 75, col 25) +-------------------------------- +76 >} + + ~~ => Pos: (2478 to 2479) SpanInfo: {"start":2455,"length":21} + >console.log(primaryA) + >:=> (line 75, col 4) to (line 75, col 25) +-------------------------------- +77 >for ({ name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~ => Pos: (2480 to 2498) SpanInfo: {"start":2487,"length":11} + >name: nameA + >:=> (line 77, col 7) to (line 77, col 18) +77 >for ({ name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~ => Pos: (2499 to 2506) SpanInfo: {"start":2500,"length":52} + >skills: { primary: primaryA, secondary: secondaryA } + >:=> (line 77, col 20) to (line 77, col 72) +77 >for ({ name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~=> Pos: (2507 to 2527) SpanInfo: {"start":2510,"length":17} + >primary: primaryA + >:=> (line 77, col 30) to (line 77, col 47) +77 >for ({ name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (2528 to 2551) SpanInfo: {"start":2529,"length":21} + >secondary: secondaryA + >:=> (line 77, col 49) to (line 77, col 70) +77 >for ({ name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~=> Pos: (2552 to 2572) SpanInfo: {"start":2500,"length":52} + >skills: { primary: primaryA, secondary: secondaryA } + >:=> (line 77, col 20) to (line 77, col 72) +77 >for ({ name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (2573 to 2579) SpanInfo: {"start":2574,"length":5} + >i = 0 + >:=> (line 77, col 94) to (line 77, col 99) +77 >for ({ name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (2580 to 2586) SpanInfo: {"start":2581,"length":5} + >i < 1 + >:=> (line 77, col 101) to (line 77, col 106) +77 >for ({ name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (2587 to 2594) SpanInfo: {"start":2588,"length":3} + >i++ + >:=> (line 77, col 108) to (line 77, col 111) +-------------------------------- +78 > console.log(primaryA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2595 to 2621) SpanInfo: {"start":2599,"length":21} + >console.log(primaryA) + >:=> (line 78, col 4) to (line 78, col 25) +-------------------------------- +79 >} + + ~~ => Pos: (2622 to 2623) SpanInfo: {"start":2599,"length":21} + >console.log(primaryA) + >:=> (line 78, col 4) to (line 78, col 25) +-------------------------------- +80 >for ({ name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = + + ~~~~~~~~~~~~~~~~~~~ => Pos: (2624 to 2642) SpanInfo: {"start":2631,"length":11} + >name: nameA + >:=> (line 80, col 7) to (line 80, col 18) +80 >for ({ name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = + + ~~~~~~~~ => Pos: (2643 to 2650) SpanInfo: {"start":2644,"length":52} + >skills: { primary: primaryA, secondary: secondaryA } + >:=> (line 80, col 20) to (line 80, col 72) +80 >for ({ name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = + + ~~~~~~~~~~~~~~~~~~~~~=> Pos: (2651 to 2671) SpanInfo: {"start":2654,"length":17} + >primary: primaryA + >:=> (line 80, col 30) to (line 80, col 47) +80 >for ({ name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = + + ~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (2672 to 2695) SpanInfo: {"start":2673,"length":21} + >secondary: secondaryA + >:=> (line 80, col 49) to (line 80, col 70) +80 >for ({ name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = + + ~~~~~=> Pos: (2696 to 2700) SpanInfo: {"start":2644,"length":52} + >skills: { primary: primaryA, secondary: secondaryA } + >:=> (line 80, col 20) to (line 80, col 72) +-------------------------------- +81 > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (2701 to 2791) SpanInfo: {"start":2644,"length":52} + >skills: { primary: primaryA, secondary: secondaryA } + >:=> (line 80, col 20) to (line 80, col 72) +-------------------------------- +82 > i = 0; i < 1; i++) { + + ~~~~~~~~~~ => Pos: (2792 to 2801) SpanInfo: {"start":2796,"length":5} + >i = 0 + >:=> (line 82, col 4) to (line 82, col 9) +82 > i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (2802 to 2808) SpanInfo: {"start":2803,"length":5} + >i < 1 + >:=> (line 82, col 11) to (line 82, col 16) +82 > i = 0; i < 1; i++) { + + ~~~~~~~~ => Pos: (2809 to 2816) SpanInfo: {"start":2810,"length":3} + >i++ + >:=> (line 82, col 18) to (line 82, col 21) +-------------------------------- +83 > console.log(primaryA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2817 to 2843) SpanInfo: {"start":2821,"length":21} + >console.log(primaryA) + >:=> (line 83, col 4) to (line 83, col 25) +-------------------------------- +84 >} + + ~~ => Pos: (2844 to 2845) SpanInfo: {"start":2821,"length":21} + >console.log(primaryA) + >:=> (line 83, col 4) to (line 83, col 25) +-------------------------------- +85 >for ({ name, skill } = robot, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~ => Pos: (2846 to 2857) SpanInfo: {"start":2853,"length":4} + >name + >:=> (line 85, col 7) to (line 85, col 11) +85 >for ({ name, skill } = robot, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~ => Pos: (2858 to 2874) SpanInfo: {"start":2859,"length":5} + >skill + >:=> (line 85, col 13) to (line 85, col 18) +85 >for ({ name, skill } = robot, i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (2875 to 2881) SpanInfo: {"start":2876,"length":5} + >i = 0 + >:=> (line 85, col 30) to (line 85, col 35) +85 >for ({ name, skill } = robot, i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (2882 to 2888) SpanInfo: {"start":2883,"length":5} + >i < 1 + >:=> (line 85, col 37) to (line 85, col 42) +85 >for ({ name, skill } = robot, i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (2889 to 2896) SpanInfo: {"start":2890,"length":3} + >i++ + >:=> (line 85, col 44) to (line 85, col 47) +-------------------------------- +86 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2897 to 2920) SpanInfo: {"start":2901,"length":18} + >console.log(nameA) + >:=> (line 86, col 4) to (line 86, col 22) +-------------------------------- +87 >} + + ~~ => Pos: (2921 to 2922) SpanInfo: {"start":2901,"length":18} + >console.log(nameA) + >:=> (line 86, col 4) to (line 86, col 22) +-------------------------------- +88 >for ({ name, skill } = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~ => Pos: (2923 to 2934) SpanInfo: {"start":2930,"length":4} + >name + >:=> (line 88, col 7) to (line 88, col 11) +88 >for ({ name, skill } = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2935 to 2956) SpanInfo: {"start":2936,"length":5} + >skill + >:=> (line 88, col 13) to (line 88, col 18) +88 >for ({ name, skill } = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (2957 to 2963) SpanInfo: {"start":2958,"length":5} + >i = 0 + >:=> (line 88, col 35) to (line 88, col 40) +88 >for ({ name, skill } = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (2964 to 2970) SpanInfo: {"start":2965,"length":5} + >i < 1 + >:=> (line 88, col 42) to (line 88, col 47) +88 >for ({ name, skill } = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (2971 to 2978) SpanInfo: {"start":2972,"length":3} + >i++ + >:=> (line 88, col 49) to (line 88, col 52) +-------------------------------- +89 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2979 to 3002) SpanInfo: {"start":2983,"length":18} + >console.log(nameA) + >:=> (line 89, col 4) to (line 89, col 22) +-------------------------------- +90 >} + + ~~ => Pos: (3003 to 3004) SpanInfo: {"start":2983,"length":18} + >console.log(nameA) + >:=> (line 89, col 4) to (line 89, col 22) +-------------------------------- +91 >for ({ name, skill } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~ => Pos: (3005 to 3016) SpanInfo: {"start":3012,"length":4} + >name + >:=> (line 91, col 7) to (line 91, col 11) +91 >for ({ name, skill } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (3017 to 3073) SpanInfo: {"start":3018,"length":5} + >skill + >:=> (line 91, col 13) to (line 91, col 18) +91 >for ({ name, skill } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (3074 to 3080) SpanInfo: {"start":3075,"length":5} + >i = 0 + >:=> (line 91, col 70) to (line 91, col 75) +91 >for ({ name, skill } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (3081 to 3087) SpanInfo: {"start":3082,"length":5} + >i < 1 + >:=> (line 91, col 77) to (line 91, col 82) +91 >for ({ name, skill } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (3088 to 3095) SpanInfo: {"start":3089,"length":3} + >i++ + >:=> (line 91, col 84) to (line 91, col 87) +-------------------------------- +92 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (3096 to 3119) SpanInfo: {"start":3100,"length":18} + >console.log(nameA) + >:=> (line 92, col 4) to (line 92, col 22) +-------------------------------- +93 >} + + ~~ => Pos: (3120 to 3121) SpanInfo: {"start":3100,"length":18} + >console.log(nameA) + >:=> (line 92, col 4) to (line 92, col 22) +-------------------------------- +94 >for ({ name, skills: { primary, secondary } } = multiRobot, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~ => Pos: (3122 to 3133) SpanInfo: {"start":3129,"length":4} + >name + >:=> (line 94, col 7) to (line 94, col 11) +94 >for ({ name, skills: { primary, secondary } } = multiRobot, i = 0; i < 1; i++) { + + ~~~~~~~~ => Pos: (3134 to 3141) SpanInfo: {"start":3135,"length":30} + >skills: { primary, secondary } + >:=> (line 94, col 13) to (line 94, col 43) +94 >for ({ name, skills: { primary, secondary } } = multiRobot, i = 0; i < 1; i++) { + + ~~~~~~~~~~~ => Pos: (3142 to 3152) SpanInfo: {"start":3145,"length":7} + >primary + >:=> (line 94, col 23) to (line 94, col 30) +94 >for ({ name, skills: { primary, secondary } } = multiRobot, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~ => Pos: (3153 to 3164) SpanInfo: {"start":3154,"length":9} + >secondary + >:=> (line 94, col 32) to (line 94, col 41) +94 >for ({ name, skills: { primary, secondary } } = multiRobot, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~=> Pos: (3165 to 3180) SpanInfo: {"start":3135,"length":30} + >skills: { primary, secondary } + >:=> (line 94, col 13) to (line 94, col 43) +94 >for ({ name, skills: { primary, secondary } } = multiRobot, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (3181 to 3187) SpanInfo: {"start":3182,"length":5} + >i = 0 + >:=> (line 94, col 60) to (line 94, col 65) +94 >for ({ name, skills: { primary, secondary } } = multiRobot, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (3188 to 3194) SpanInfo: {"start":3189,"length":5} + >i < 1 + >:=> (line 94, col 67) to (line 94, col 72) +94 >for ({ name, skills: { primary, secondary } } = multiRobot, i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (3195 to 3202) SpanInfo: {"start":3196,"length":3} + >i++ + >:=> (line 94, col 74) to (line 94, col 77) +-------------------------------- +95 > console.log(primaryA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (3203 to 3229) SpanInfo: {"start":3207,"length":21} + >console.log(primaryA) + >:=> (line 95, col 4) to (line 95, col 25) +-------------------------------- +96 >} + + ~~ => Pos: (3230 to 3231) SpanInfo: {"start":3207,"length":21} + >console.log(primaryA) + >:=> (line 95, col 4) to (line 95, col 25) +-------------------------------- +97 >for ({ name, skills: { primary, secondary } } = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~ => Pos: (3232 to 3243) SpanInfo: {"start":3239,"length":4} + >name + >:=> (line 97, col 7) to (line 97, col 11) +97 >for ({ name, skills: { primary, secondary } } = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~ => Pos: (3244 to 3251) SpanInfo: {"start":3245,"length":30} + >skills: { primary, secondary } + >:=> (line 97, col 13) to (line 97, col 43) +97 >for ({ name, skills: { primary, secondary } } = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~ => Pos: (3252 to 3262) SpanInfo: {"start":3255,"length":7} + >primary + >:=> (line 97, col 23) to (line 97, col 30) +97 >for ({ name, skills: { primary, secondary } } = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~ => Pos: (3263 to 3274) SpanInfo: {"start":3264,"length":9} + >secondary + >:=> (line 97, col 32) to (line 97, col 41) +97 >for ({ name, skills: { primary, secondary } } = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~=> Pos: (3275 to 3295) SpanInfo: {"start":3245,"length":30} + >skills: { primary, secondary } + >:=> (line 97, col 13) to (line 97, col 43) +97 >for ({ name, skills: { primary, secondary } } = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (3296 to 3302) SpanInfo: {"start":3297,"length":5} + >i = 0 + >:=> (line 97, col 65) to (line 97, col 70) +97 >for ({ name, skills: { primary, secondary } } = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (3303 to 3309) SpanInfo: {"start":3304,"length":5} + >i < 1 + >:=> (line 97, col 72) to (line 97, col 77) +97 >for ({ name, skills: { primary, secondary } } = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (3310 to 3317) SpanInfo: {"start":3311,"length":3} + >i++ + >:=> (line 97, col 79) to (line 97, col 82) +-------------------------------- +98 > console.log(primaryA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (3318 to 3344) SpanInfo: {"start":3322,"length":21} + >console.log(primaryA) + >:=> (line 98, col 4) to (line 98, col 25) +-------------------------------- +99 >} + + ~~ => Pos: (3345 to 3346) SpanInfo: {"start":3322,"length":21} + >console.log(primaryA) + >:=> (line 98, col 4) to (line 98, col 25) +-------------------------------- +100>for ({ name, skills: { primary, secondary } } = + + ~~~~~~~~~~~~ => Pos: (3347 to 3358) SpanInfo: {"start":3354,"length":4} + >name + >:=> (line 100, col 7) to (line 100, col 11) +100>for ({ name, skills: { primary, secondary } } = + + ~~~~~~~~ => Pos: (3359 to 3366) SpanInfo: {"start":3360,"length":30} + >skills: { primary, secondary } + >:=> (line 100, col 13) to (line 100, col 43) +100>for ({ name, skills: { primary, secondary } } = + + ~~~~~~~~~~~ => Pos: (3367 to 3377) SpanInfo: {"start":3370,"length":7} + >primary + >:=> (line 100, col 23) to (line 100, col 30) +100>for ({ name, skills: { primary, secondary } } = + + ~~~~~~~~~~~~ => Pos: (3378 to 3389) SpanInfo: {"start":3379,"length":9} + >secondary + >:=> (line 100, col 32) to (line 100, col 41) +100>for ({ name, skills: { primary, secondary } } = + + ~~~~~=> Pos: (3390 to 3394) SpanInfo: {"start":3360,"length":30} + >skills: { primary, secondary } + >:=> (line 100, col 13) to (line 100, col 43) +-------------------------------- +101> { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (3395 to 3485) SpanInfo: {"start":3360,"length":30} + >skills: { primary, secondary } + >:=> (line 100, col 13) to (line 100, col 43) +-------------------------------- +102> i = 0; i < 1; i++) { + + ~~~~~~~~~~ => Pos: (3486 to 3495) SpanInfo: {"start":3490,"length":5} + >i = 0 + >:=> (line 102, col 4) to (line 102, col 9) +102> i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (3496 to 3502) SpanInfo: {"start":3497,"length":5} + >i < 1 + >:=> (line 102, col 11) to (line 102, col 16) +102> i = 0; i < 1; i++) { + + ~~~~~~~~ => Pos: (3503 to 3510) SpanInfo: {"start":3504,"length":3} + >i++ + >:=> (line 102, col 18) to (line 102, col 21) +-------------------------------- +103> console.log(primaryA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (3511 to 3537) SpanInfo: {"start":3515,"length":21} + >console.log(primaryA) + >:=> (line 103, col 4) to (line 103, col 25) +-------------------------------- +104>} + ~ => Pos: (3538 to 3538) SpanInfo: {"start":3515,"length":21} + >console.log(primaryA) + >:=> (line 103, col 4) to (line 103, col 25) \ No newline at end of file diff --git a/tests/baselines/reference/bpSpanDestructuringAssignmentForObjectBindingPatternDefaultValues.baseline b/tests/baselines/reference/bpSpanDestructuringAssignmentForObjectBindingPatternDefaultValues.baseline new file mode 100644 index 00000000000..daf4f8a0d84 --- /dev/null +++ b/tests/baselines/reference/bpSpanDestructuringAssignmentForObjectBindingPatternDefaultValues.baseline @@ -0,0 +1,1483 @@ + +1 >declare var console: { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (0 to 22) SpanInfo: undefined +-------------------------------- +2 > log(msg: any): void; + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (23 to 47) SpanInfo: undefined +-------------------------------- +3 >} + + ~~ => Pos: (48 to 49) SpanInfo: undefined +-------------------------------- +4 >interface Robot { + + ~~~~~~~~~~~~~~~~~~ => Pos: (50 to 67) SpanInfo: undefined +-------------------------------- +5 > name: string; + + ~~~~~~~~~~~~~~~~~~ => Pos: (68 to 85) SpanInfo: undefined +-------------------------------- +6 > skill: string; + + ~~~~~~~~~~~~~~~~~~~ => Pos: (86 to 104) SpanInfo: undefined +-------------------------------- +7 >} + + ~~ => Pos: (105 to 106) SpanInfo: undefined +-------------------------------- +8 >interface MultiRobot { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (107 to 129) SpanInfo: undefined +-------------------------------- +9 > name: string; + + ~~~~~~~~~~~~~~~~~~ => Pos: (130 to 147) SpanInfo: undefined +-------------------------------- +10 > skills: { + + ~~~~~~~~~~~~~~ => Pos: (148 to 161) SpanInfo: undefined +-------------------------------- +11 > primary?: string; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (162 to 187) SpanInfo: undefined +-------------------------------- +12 > secondary?: string; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (188 to 215) SpanInfo: undefined +-------------------------------- +13 > }; + + ~~~~~~~ => Pos: (216 to 222) SpanInfo: undefined +-------------------------------- +14 >} + + ~~ => Pos: (223 to 224) SpanInfo: undefined +-------------------------------- +15 >let robot: Robot = { name: "mower", skill: "mowing" }; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (225 to 279) SpanInfo: {"start":225,"length":53} + >let robot: Robot = { name: "mower", skill: "mowing" } + >:=> (line 15, col 0) to (line 15, col 53) +-------------------------------- +16 >let multiRobot: MultiRobot = { name: "mower", skills: { primary: "mowing", secondary: "none" } }; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (280 to 377) SpanInfo: {"start":280,"length":96} + >let multiRobot: MultiRobot = { name: "mower", skills: { primary: "mowing", secondary: "none" } } + >:=> (line 16, col 0) to (line 16, col 96) +-------------------------------- +17 >function getRobot() { + + ~~~~~~~~~~~~~~~~~~~~~~ => Pos: (378 to 399) SpanInfo: {"start":404,"length":12} + >return robot + >:=> (line 18, col 4) to (line 18, col 16) +-------------------------------- +18 > return robot; + + ~~~~~~~~~~~~~~~~~~ => Pos: (400 to 417) SpanInfo: {"start":404,"length":12} + >return robot + >:=> (line 18, col 4) to (line 18, col 16) +-------------------------------- +19 >} + + ~~ => Pos: (418 to 419) SpanInfo: {"start":418,"length":1} + >} + >:=> (line 19, col 0) to (line 19, col 1) +-------------------------------- +20 >function getMultiRobot() { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (420 to 446) SpanInfo: {"start":451,"length":17} + >return multiRobot + >:=> (line 21, col 4) to (line 21, col 21) +-------------------------------- +21 > return multiRobot; + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (447 to 469) SpanInfo: {"start":451,"length":17} + >return multiRobot + >:=> (line 21, col 4) to (line 21, col 21) +-------------------------------- +22 >} + + ~~ => Pos: (470 to 471) SpanInfo: {"start":470,"length":1} + >} + >:=> (line 22, col 0) to (line 22, col 1) +-------------------------------- +23 >let nameA: string, primaryA: string, secondaryA: string, i: number, skillA: string; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (472 to 555) SpanInfo: undefined +-------------------------------- +24 >let name: string, primary: string, secondary: string, skill: string; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (556 to 624) SpanInfo: undefined +-------------------------------- +25 >for ({name: nameA = "noName" } = robot, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (625 to 663) SpanInfo: {"start":631,"length":22} + >name: nameA = "noName" + >:=> (line 25, col 6) to (line 25, col 28) +25 >for ({name: nameA = "noName" } = robot, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (664 to 670) SpanInfo: {"start":665,"length":5} + >i = 0 + >:=> (line 25, col 40) to (line 25, col 45) +25 >for ({name: nameA = "noName" } = robot, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (671 to 677) SpanInfo: {"start":672,"length":5} + >i < 1 + >:=> (line 25, col 47) to (line 25, col 52) +25 >for ({name: nameA = "noName" } = robot, i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (678 to 685) SpanInfo: {"start":679,"length":3} + >i++ + >:=> (line 25, col 54) to (line 25, col 57) +-------------------------------- +26 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (686 to 709) SpanInfo: {"start":690,"length":18} + >console.log(nameA) + >:=> (line 26, col 4) to (line 26, col 22) +-------------------------------- +27 >} + + ~~ => Pos: (710 to 711) SpanInfo: {"start":690,"length":18} + >console.log(nameA) + >:=> (line 26, col 4) to (line 26, col 22) +-------------------------------- +28 >for ({name: nameA = "noName" } = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (712 to 755) SpanInfo: {"start":718,"length":22} + >name: nameA = "noName" + >:=> (line 28, col 6) to (line 28, col 28) +28 >for ({name: nameA = "noName" } = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (756 to 762) SpanInfo: {"start":757,"length":5} + >i = 0 + >:=> (line 28, col 45) to (line 28, col 50) +28 >for ({name: nameA = "noName" } = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (763 to 769) SpanInfo: {"start":764,"length":5} + >i < 1 + >:=> (line 28, col 52) to (line 28, col 57) +28 >for ({name: nameA = "noName" } = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (770 to 777) SpanInfo: {"start":771,"length":3} + >i++ + >:=> (line 28, col 59) to (line 28, col 62) +-------------------------------- +29 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (778 to 801) SpanInfo: {"start":782,"length":18} + >console.log(nameA) + >:=> (line 29, col 4) to (line 29, col 22) +-------------------------------- +30 >} + + ~~ => Pos: (802 to 803) SpanInfo: {"start":782,"length":18} + >console.log(nameA) + >:=> (line 29, col 4) to (line 29, col 22) +-------------------------------- +31 >for ({name: nameA = "noName" } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (804 to 882) SpanInfo: {"start":810,"length":22} + >name: nameA = "noName" + >:=> (line 31, col 6) to (line 31, col 28) +31 >for ({name: nameA = "noName" } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (883 to 889) SpanInfo: {"start":884,"length":5} + >i = 0 + >:=> (line 31, col 80) to (line 31, col 85) +31 >for ({name: nameA = "noName" } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (890 to 896) SpanInfo: {"start":891,"length":5} + >i < 1 + >:=> (line 31, col 87) to (line 31, col 92) +31 >for ({name: nameA = "noName" } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (897 to 904) SpanInfo: {"start":898,"length":3} + >i++ + >:=> (line 31, col 94) to (line 31, col 97) +-------------------------------- +32 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (905 to 928) SpanInfo: {"start":909,"length":18} + >console.log(nameA) + >:=> (line 32, col 4) to (line 32, col 22) +-------------------------------- +33 >} + + ~~ => Pos: (929 to 930) SpanInfo: {"start":909,"length":18} + >console.log(nameA) + >:=> (line 32, col 4) to (line 32, col 22) +-------------------------------- +34 >for ({ + + ~~~~~~~ => Pos: (931 to 937) SpanInfo: {"start":942,"length":139} + >skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "none", secondary: "none" } + >:=> (line 35, col 4) to (line 38, col 46) +-------------------------------- +35 > skills: { + + ~~~~~~~~~~~ => Pos: (938 to 948) SpanInfo: {"start":942,"length":139} + >skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "none", secondary: "none" } + >:=> (line 35, col 4) to (line 38, col 46) +35 > skills: { + + ~~~ => Pos: (949 to 951) SpanInfo: {"start":960,"length":29} + >primary: primaryA = "primary" + >:=> (line 36, col 8) to (line 36, col 37) +-------------------------------- +36 > primary: primaryA = "primary", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (952 to 990) SpanInfo: {"start":960,"length":29} + >primary: primaryA = "primary" + >:=> (line 36, col 8) to (line 36, col 37) +-------------------------------- +37 > secondary: secondaryA = "secondary" + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (991 to 1034) SpanInfo: {"start":999,"length":35} + >secondary: secondaryA = "secondary" + >:=> (line 37, col 8) to (line 37, col 43) +-------------------------------- +38 > } = { primary: "none", secondary: "none" } + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1035 to 1081) SpanInfo: {"start":999,"length":35} + >secondary: secondaryA = "secondary" + >:=> (line 37, col 8) to (line 37, col 43) +-------------------------------- +39 >} = multiRobot, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~ => Pos: (1082 to 1096) SpanInfo: {"start":942,"length":139} + >skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "none", secondary: "none" } + >:=> (line 35, col 4) to (line 38, col 46) +39 >} = multiRobot, i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (1097 to 1103) SpanInfo: {"start":1098,"length":5} + >i = 0 + >:=> (line 39, col 16) to (line 39, col 21) +39 >} = multiRobot, i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (1104 to 1110) SpanInfo: {"start":1105,"length":5} + >i < 1 + >:=> (line 39, col 23) to (line 39, col 28) +39 >} = multiRobot, i = 0; i < 1; i++) { + + ~~~~~~~~ => Pos: (1111 to 1118) SpanInfo: {"start":1112,"length":3} + >i++ + >:=> (line 39, col 30) to (line 39, col 33) +-------------------------------- +40 > console.log(primaryA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1119 to 1145) SpanInfo: {"start":1123,"length":21} + >console.log(primaryA) + >:=> (line 40, col 4) to (line 40, col 25) +-------------------------------- +41 >} + + ~~ => Pos: (1146 to 1147) SpanInfo: {"start":1123,"length":21} + >console.log(primaryA) + >:=> (line 40, col 4) to (line 40, col 25) +-------------------------------- +42 >for ({ + + ~~~~~~~ => Pos: (1148 to 1154) SpanInfo: {"start":1159,"length":139} + >skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "none", secondary: "none" } + >:=> (line 43, col 4) to (line 46, col 46) +-------------------------------- +43 > skills: { + + ~~~~~~~~~~~ => Pos: (1155 to 1165) SpanInfo: {"start":1159,"length":139} + >skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "none", secondary: "none" } + >:=> (line 43, col 4) to (line 46, col 46) +43 > skills: { + + ~~~ => Pos: (1166 to 1168) SpanInfo: {"start":1177,"length":29} + >primary: primaryA = "primary" + >:=> (line 44, col 8) to (line 44, col 37) +-------------------------------- +44 > primary: primaryA = "primary", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1169 to 1207) SpanInfo: {"start":1177,"length":29} + >primary: primaryA = "primary" + >:=> (line 44, col 8) to (line 44, col 37) +-------------------------------- +45 > secondary: secondaryA = "secondary" + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1208 to 1251) SpanInfo: {"start":1216,"length":35} + >secondary: secondaryA = "secondary" + >:=> (line 45, col 8) to (line 45, col 43) +-------------------------------- +46 > } = { primary: "none", secondary: "none" } + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1252 to 1298) SpanInfo: {"start":1216,"length":35} + >secondary: secondaryA = "secondary" + >:=> (line 45, col 8) to (line 45, col 43) +-------------------------------- +47 >} = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~ => Pos: (1299 to 1318) SpanInfo: {"start":1159,"length":139} + >skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "none", secondary: "none" } + >:=> (line 43, col 4) to (line 46, col 46) +47 >} = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (1319 to 1325) SpanInfo: {"start":1320,"length":5} + >i = 0 + >:=> (line 47, col 21) to (line 47, col 26) +47 >} = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (1326 to 1332) SpanInfo: {"start":1327,"length":5} + >i < 1 + >:=> (line 47, col 28) to (line 47, col 33) +47 >} = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~ => Pos: (1333 to 1340) SpanInfo: {"start":1334,"length":3} + >i++ + >:=> (line 47, col 35) to (line 47, col 38) +-------------------------------- +48 > console.log(primaryA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1341 to 1367) SpanInfo: {"start":1345,"length":21} + >console.log(primaryA) + >:=> (line 48, col 4) to (line 48, col 25) +-------------------------------- +49 >} + + ~~ => Pos: (1368 to 1369) SpanInfo: {"start":1345,"length":21} + >console.log(primaryA) + >:=> (line 48, col 4) to (line 48, col 25) +-------------------------------- +50 >for ({ + + ~~~~~~~ => Pos: (1370 to 1376) SpanInfo: {"start":1381,"length":139} + >skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "none", secondary: "none" } + >:=> (line 51, col 4) to (line 54, col 46) +-------------------------------- +51 > skills: { + + ~~~~~~~~~~~ => Pos: (1377 to 1387) SpanInfo: {"start":1381,"length":139} + >skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "none", secondary: "none" } + >:=> (line 51, col 4) to (line 54, col 46) +51 > skills: { + + ~~~ => Pos: (1388 to 1390) SpanInfo: {"start":1399,"length":29} + >primary: primaryA = "primary" + >:=> (line 52, col 8) to (line 52, col 37) +-------------------------------- +52 > primary: primaryA = "primary", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1391 to 1429) SpanInfo: {"start":1399,"length":29} + >primary: primaryA = "primary" + >:=> (line 52, col 8) to (line 52, col 37) +-------------------------------- +53 > secondary: secondaryA = "secondary" + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1430 to 1473) SpanInfo: {"start":1438,"length":35} + >secondary: secondaryA = "secondary" + >:=> (line 53, col 8) to (line 53, col 43) +-------------------------------- +54 > } = { primary: "none", secondary: "none" } + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1474 to 1520) SpanInfo: {"start":1438,"length":35} + >secondary: secondaryA = "secondary" + >:=> (line 53, col 8) to (line 53, col 43) +-------------------------------- +55 >} = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1521 to 1611) SpanInfo: {"start":1381,"length":139} + >skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "none", secondary: "none" } + >:=> (line 51, col 4) to (line 54, col 46) +-------------------------------- +56 > i = 0; i < 1; i++) { + + ~~~~~~~~~~ => Pos: (1612 to 1621) SpanInfo: {"start":1616,"length":5} + >i = 0 + >:=> (line 56, col 4) to (line 56, col 9) +56 > i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (1622 to 1628) SpanInfo: {"start":1623,"length":5} + >i < 1 + >:=> (line 56, col 11) to (line 56, col 16) +56 > i = 0; i < 1; i++) { + + ~~~~~~~~ => Pos: (1629 to 1636) SpanInfo: {"start":1630,"length":3} + >i++ + >:=> (line 56, col 18) to (line 56, col 21) +-------------------------------- +57 > console.log(primaryA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1637 to 1663) SpanInfo: {"start":1641,"length":21} + >console.log(primaryA) + >:=> (line 57, col 4) to (line 57, col 25) +-------------------------------- +58 >} + + ~~ => Pos: (1664 to 1665) SpanInfo: {"start":1641,"length":21} + >console.log(primaryA) + >:=> (line 57, col 4) to (line 57, col 25) +-------------------------------- +59 >for ({ name = "noName" } = robot, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1666 to 1698) SpanInfo: {"start":1673,"length":15} + >name = "noName" + >:=> (line 59, col 7) to (line 59, col 22) +59 >for ({ name = "noName" } = robot, i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (1699 to 1705) SpanInfo: {"start":1700,"length":5} + >i = 0 + >:=> (line 59, col 34) to (line 59, col 39) +59 >for ({ name = "noName" } = robot, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1706 to 1712) SpanInfo: {"start":1707,"length":5} + >i < 1 + >:=> (line 59, col 41) to (line 59, col 46) +59 >for ({ name = "noName" } = robot, i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (1713 to 1720) SpanInfo: {"start":1714,"length":3} + >i++ + >:=> (line 59, col 48) to (line 59, col 51) +-------------------------------- +60 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1721 to 1744) SpanInfo: {"start":1725,"length":18} + >console.log(nameA) + >:=> (line 60, col 4) to (line 60, col 22) +-------------------------------- +61 >} + + ~~ => Pos: (1745 to 1746) SpanInfo: {"start":1725,"length":18} + >console.log(nameA) + >:=> (line 60, col 4) to (line 60, col 22) +-------------------------------- +62 >for ({ name = "noName" } = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1747 to 1784) SpanInfo: {"start":1754,"length":15} + >name = "noName" + >:=> (line 62, col 7) to (line 62, col 22) +62 >for ({ name = "noName" } = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (1785 to 1791) SpanInfo: {"start":1786,"length":5} + >i = 0 + >:=> (line 62, col 39) to (line 62, col 44) +62 >for ({ name = "noName" } = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1792 to 1798) SpanInfo: {"start":1793,"length":5} + >i < 1 + >:=> (line 62, col 46) to (line 62, col 51) +62 >for ({ name = "noName" } = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (1799 to 1806) SpanInfo: {"start":1800,"length":3} + >i++ + >:=> (line 62, col 53) to (line 62, col 56) +-------------------------------- +63 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1807 to 1830) SpanInfo: {"start":1811,"length":18} + >console.log(nameA) + >:=> (line 63, col 4) to (line 63, col 22) +-------------------------------- +64 >} + + ~~ => Pos: (1831 to 1832) SpanInfo: {"start":1811,"length":18} + >console.log(nameA) + >:=> (line 63, col 4) to (line 63, col 22) +-------------------------------- +65 >for ({ name = "noName" } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1833 to 1905) SpanInfo: {"start":1840,"length":15} + >name = "noName" + >:=> (line 65, col 7) to (line 65, col 22) +65 >for ({ name = "noName" } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1906 to 1912) SpanInfo: {"start":1907,"length":5} + >i = 0 + >:=> (line 65, col 74) to (line 65, col 79) +65 >for ({ name = "noName" } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1913 to 1919) SpanInfo: {"start":1914,"length":5} + >i < 1 + >:=> (line 65, col 81) to (line 65, col 86) +65 >for ({ name = "noName" } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (1920 to 1927) SpanInfo: {"start":1921,"length":3} + >i++ + >:=> (line 65, col 88) to (line 65, col 91) +-------------------------------- +66 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1928 to 1951) SpanInfo: {"start":1932,"length":18} + >console.log(nameA) + >:=> (line 66, col 4) to (line 66, col 22) +-------------------------------- +67 >} + + ~~ => Pos: (1952 to 1953) SpanInfo: {"start":1932,"length":18} + >console.log(nameA) + >:=> (line 66, col 4) to (line 66, col 22) +-------------------------------- +68 >for ({ + + ~~~~~~~ => Pos: (1954 to 1960) SpanInfo: {"start":1965,"length":117} + >skills: { + > primary = "primary", + > secondary = "secondary" + > } = { primary: "none", secondary: "none" } + >:=> (line 69, col 4) to (line 72, col 46) +-------------------------------- +69 > skills: { + + ~~~~~~~~~~~ => Pos: (1961 to 1971) SpanInfo: {"start":1965,"length":117} + >skills: { + > primary = "primary", + > secondary = "secondary" + > } = { primary: "none", secondary: "none" } + >:=> (line 69, col 4) to (line 72, col 46) +69 > skills: { + + ~~~ => Pos: (1972 to 1974) SpanInfo: {"start":1983,"length":19} + >primary = "primary" + >:=> (line 70, col 8) to (line 70, col 27) +-------------------------------- +70 > primary = "primary", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1975 to 2003) SpanInfo: {"start":1983,"length":19} + >primary = "primary" + >:=> (line 70, col 8) to (line 70, col 27) +-------------------------------- +71 > secondary = "secondary" + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2004 to 2035) SpanInfo: {"start":2012,"length":23} + >secondary = "secondary" + >:=> (line 71, col 8) to (line 71, col 31) +-------------------------------- +72 > } = { primary: "none", secondary: "none" } + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (2036 to 2082) SpanInfo: {"start":2012,"length":23} + >secondary = "secondary" + >:=> (line 71, col 8) to (line 71, col 31) +-------------------------------- +73 >} = multiRobot, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~ => Pos: (2083 to 2097) SpanInfo: {"start":1965,"length":117} + >skills: { + > primary = "primary", + > secondary = "secondary" + > } = { primary: "none", secondary: "none" } + >:=> (line 69, col 4) to (line 72, col 46) +73 >} = multiRobot, i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (2098 to 2104) SpanInfo: {"start":2099,"length":5} + >i = 0 + >:=> (line 73, col 16) to (line 73, col 21) +73 >} = multiRobot, i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (2105 to 2111) SpanInfo: {"start":2106,"length":5} + >i < 1 + >:=> (line 73, col 23) to (line 73, col 28) +73 >} = multiRobot, i = 0; i < 1; i++) { + + ~~~~~~~~ => Pos: (2112 to 2119) SpanInfo: {"start":2113,"length":3} + >i++ + >:=> (line 73, col 30) to (line 73, col 33) +-------------------------------- +74 > console.log(primaryA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2120 to 2146) SpanInfo: {"start":2124,"length":21} + >console.log(primaryA) + >:=> (line 74, col 4) to (line 74, col 25) +-------------------------------- +75 >} + + ~~ => Pos: (2147 to 2148) SpanInfo: {"start":2124,"length":21} + >console.log(primaryA) + >:=> (line 74, col 4) to (line 74, col 25) +-------------------------------- +76 >for ({ + + ~~~~~~~ => Pos: (2149 to 2155) SpanInfo: {"start":2160,"length":117} + >skills: { + > primary = "primary", + > secondary = "secondary" + > } = { primary: "none", secondary: "none" } + >:=> (line 77, col 4) to (line 80, col 46) +-------------------------------- +77 > skills: { + + ~~~~~~~~~~~ => Pos: (2156 to 2166) SpanInfo: {"start":2160,"length":117} + >skills: { + > primary = "primary", + > secondary = "secondary" + > } = { primary: "none", secondary: "none" } + >:=> (line 77, col 4) to (line 80, col 46) +77 > skills: { + + ~~~ => Pos: (2167 to 2169) SpanInfo: {"start":2178,"length":19} + >primary = "primary" + >:=> (line 78, col 8) to (line 78, col 27) +-------------------------------- +78 > primary = "primary", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2170 to 2198) SpanInfo: {"start":2178,"length":19} + >primary = "primary" + >:=> (line 78, col 8) to (line 78, col 27) +-------------------------------- +79 > secondary = "secondary" + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2199 to 2230) SpanInfo: {"start":2207,"length":23} + >secondary = "secondary" + >:=> (line 79, col 8) to (line 79, col 31) +-------------------------------- +80 > } = { primary: "none", secondary: "none" } + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (2231 to 2277) SpanInfo: {"start":2207,"length":23} + >secondary = "secondary" + >:=> (line 79, col 8) to (line 79, col 31) +-------------------------------- +81 >} = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~ => Pos: (2278 to 2297) SpanInfo: {"start":2160,"length":117} + >skills: { + > primary = "primary", + > secondary = "secondary" + > } = { primary: "none", secondary: "none" } + >:=> (line 77, col 4) to (line 80, col 46) +81 >} = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (2298 to 2304) SpanInfo: {"start":2299,"length":5} + >i = 0 + >:=> (line 81, col 21) to (line 81, col 26) +81 >} = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (2305 to 2311) SpanInfo: {"start":2306,"length":5} + >i < 1 + >:=> (line 81, col 28) to (line 81, col 33) +81 >} = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~ => Pos: (2312 to 2319) SpanInfo: {"start":2313,"length":3} + >i++ + >:=> (line 81, col 35) to (line 81, col 38) +-------------------------------- +82 > console.log(primaryA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2320 to 2346) SpanInfo: {"start":2324,"length":21} + >console.log(primaryA) + >:=> (line 82, col 4) to (line 82, col 25) +-------------------------------- +83 >} + + ~~ => Pos: (2347 to 2348) SpanInfo: {"start":2324,"length":21} + >console.log(primaryA) + >:=> (line 82, col 4) to (line 82, col 25) +-------------------------------- +84 >for ({ + + ~~~~~~~ => Pos: (2349 to 2355) SpanInfo: {"start":2360,"length":117} + >skills: { + > primary = "primary", + > secondary = "secondary" + > } = { primary: "none", secondary: "none" } + >:=> (line 85, col 4) to (line 88, col 46) +-------------------------------- +85 > skills: { + + ~~~~~~~~~~~ => Pos: (2356 to 2366) SpanInfo: {"start":2360,"length":117} + >skills: { + > primary = "primary", + > secondary = "secondary" + > } = { primary: "none", secondary: "none" } + >:=> (line 85, col 4) to (line 88, col 46) +85 > skills: { + + ~~~ => Pos: (2367 to 2369) SpanInfo: {"start":2378,"length":19} + >primary = "primary" + >:=> (line 86, col 8) to (line 86, col 27) +-------------------------------- +86 > primary = "primary", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2370 to 2398) SpanInfo: {"start":2378,"length":19} + >primary = "primary" + >:=> (line 86, col 8) to (line 86, col 27) +-------------------------------- +87 > secondary = "secondary" + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2399 to 2430) SpanInfo: {"start":2407,"length":23} + >secondary = "secondary" + >:=> (line 87, col 8) to (line 87, col 31) +-------------------------------- +88 > } = { primary: "none", secondary: "none" } + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (2431 to 2477) SpanInfo: {"start":2407,"length":23} + >secondary = "secondary" + >:=> (line 87, col 8) to (line 87, col 31) +-------------------------------- +89 >} = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (2478 to 2568) SpanInfo: {"start":2360,"length":117} + >skills: { + > primary = "primary", + > secondary = "secondary" + > } = { primary: "none", secondary: "none" } + >:=> (line 85, col 4) to (line 88, col 46) +-------------------------------- +90 > i = 0; i < 1; i++) { + + ~~~~~~~~~~ => Pos: (2569 to 2578) SpanInfo: {"start":2573,"length":5} + >i = 0 + >:=> (line 90, col 4) to (line 90, col 9) +90 > i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (2579 to 2585) SpanInfo: {"start":2580,"length":5} + >i < 1 + >:=> (line 90, col 11) to (line 90, col 16) +90 > i = 0; i < 1; i++) { + + ~~~~~~~~ => Pos: (2586 to 2593) SpanInfo: {"start":2587,"length":3} + >i++ + >:=> (line 90, col 18) to (line 90, col 21) +-------------------------------- +91 > console.log(primaryA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2594 to 2620) SpanInfo: {"start":2598,"length":21} + >console.log(primaryA) + >:=> (line 91, col 4) to (line 91, col 25) +-------------------------------- +92 >} + + ~~ => Pos: (2621 to 2622) SpanInfo: {"start":2598,"length":21} + >console.log(primaryA) + >:=> (line 91, col 4) to (line 91, col 25) +-------------------------------- +93 >for ({name: nameA = "noName", skill: skillA = "skill" } = robot, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2623 to 2651) SpanInfo: {"start":2629,"length":22} + >name: nameA = "noName" + >:=> (line 93, col 6) to (line 93, col 28) +93 >for ({name: nameA = "noName", skill: skillA = "skill" } = robot, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (2652 to 2686) SpanInfo: {"start":2653,"length":23} + >skill: skillA = "skill" + >:=> (line 93, col 30) to (line 93, col 53) +93 >for ({name: nameA = "noName", skill: skillA = "skill" } = robot, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (2687 to 2693) SpanInfo: {"start":2688,"length":5} + >i = 0 + >:=> (line 93, col 65) to (line 93, col 70) +93 >for ({name: nameA = "noName", skill: skillA = "skill" } = robot, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (2694 to 2700) SpanInfo: {"start":2695,"length":5} + >i < 1 + >:=> (line 93, col 72) to (line 93, col 77) +93 >for ({name: nameA = "noName", skill: skillA = "skill" } = robot, i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (2701 to 2708) SpanInfo: {"start":2702,"length":3} + >i++ + >:=> (line 93, col 79) to (line 93, col 82) +-------------------------------- +94 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2709 to 2732) SpanInfo: {"start":2713,"length":18} + >console.log(nameA) + >:=> (line 94, col 4) to (line 94, col 22) +-------------------------------- +95 >} + + ~~ => Pos: (2733 to 2734) SpanInfo: {"start":2713,"length":18} + >console.log(nameA) + >:=> (line 94, col 4) to (line 94, col 22) +-------------------------------- +96 >for ({name: nameA = "noName", skill: skillA = "skill" } = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2735 to 2763) SpanInfo: {"start":2741,"length":22} + >name: nameA = "noName" + >:=> (line 96, col 6) to (line 96, col 28) +96 >for ({name: nameA = "noName", skill: skillA = "skill" } = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (2764 to 2803) SpanInfo: {"start":2765,"length":23} + >skill: skillA = "skill" + >:=> (line 96, col 30) to (line 96, col 53) +96 >for ({name: nameA = "noName", skill: skillA = "skill" } = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (2804 to 2810) SpanInfo: {"start":2805,"length":5} + >i = 0 + >:=> (line 96, col 70) to (line 96, col 75) +96 >for ({name: nameA = "noName", skill: skillA = "skill" } = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (2811 to 2817) SpanInfo: {"start":2812,"length":5} + >i < 1 + >:=> (line 96, col 77) to (line 96, col 82) +96 >for ({name: nameA = "noName", skill: skillA = "skill" } = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (2818 to 2825) SpanInfo: {"start":2819,"length":3} + >i++ + >:=> (line 96, col 84) to (line 96, col 87) +-------------------------------- +97 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2826 to 2849) SpanInfo: {"start":2830,"length":18} + >console.log(nameA) + >:=> (line 97, col 4) to (line 97, col 22) +-------------------------------- +98 >} + + ~~ => Pos: (2850 to 2851) SpanInfo: {"start":2830,"length":18} + >console.log(nameA) + >:=> (line 97, col 4) to (line 97, col 22) +-------------------------------- +99 >for ({name: nameA = "noName", skill: skillA = "skill" } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2852 to 2880) SpanInfo: {"start":2858,"length":22} + >name: nameA = "noName" + >:=> (line 99, col 6) to (line 99, col 28) +99 >for ({name: nameA = "noName", skill: skillA = "skill" } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (2881 to 2955) SpanInfo: {"start":2882,"length":23} + >skill: skillA = "skill" + >:=> (line 99, col 30) to (line 99, col 53) +99 >for ({name: nameA = "noName", skill: skillA = "skill" } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (2956 to 2962) SpanInfo: {"start":2957,"length":5} + >i = 0 + >:=> (line 99, col 105) to (line 99, col 110) +99 >for ({name: nameA = "noName", skill: skillA = "skill" } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (2963 to 2969) SpanInfo: {"start":2964,"length":5} + >i < 1 + >:=> (line 99, col 112) to (line 99, col 117) +99 >for ({name: nameA = "noName", skill: skillA = "skill" } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (2970 to 2977) SpanInfo: {"start":2971,"length":3} + >i++ + >:=> (line 99, col 119) to (line 99, col 122) +-------------------------------- +100> console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2978 to 3001) SpanInfo: {"start":2982,"length":18} + >console.log(nameA) + >:=> (line 100, col 4) to (line 100, col 22) +-------------------------------- +101>} + + ~~ => Pos: (3002 to 3003) SpanInfo: {"start":2982,"length":18} + >console.log(nameA) + >:=> (line 100, col 4) to (line 100, col 22) +-------------------------------- +102>for ({ + + ~~~~~~~ => Pos: (3004 to 3010) SpanInfo: {"start":3015,"length":22} + >name: nameA = "noName" + >:=> (line 103, col 4) to (line 103, col 26) +-------------------------------- +103> name: nameA = "noName", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (3011 to 3038) SpanInfo: {"start":3015,"length":22} + >name: nameA = "noName" + >:=> (line 103, col 4) to (line 103, col 26) +-------------------------------- +104> skills: { + + ~~~~~~~~~~~ => Pos: (3039 to 3049) SpanInfo: {"start":3043,"length":139} + >skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "none", secondary: "none" } + >:=> (line 104, col 4) to (line 107, col 46) +104> skills: { + + ~~~ => Pos: (3050 to 3052) SpanInfo: {"start":3061,"length":29} + >primary: primaryA = "primary" + >:=> (line 105, col 8) to (line 105, col 37) +-------------------------------- +105> primary: primaryA = "primary", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (3053 to 3091) SpanInfo: {"start":3061,"length":29} + >primary: primaryA = "primary" + >:=> (line 105, col 8) to (line 105, col 37) +-------------------------------- +106> secondary: secondaryA = "secondary" + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (3092 to 3135) SpanInfo: {"start":3100,"length":35} + >secondary: secondaryA = "secondary" + >:=> (line 106, col 8) to (line 106, col 43) +-------------------------------- +107> } = { primary: "none", secondary: "none" } + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (3136 to 3182) SpanInfo: {"start":3100,"length":35} + >secondary: secondaryA = "secondary" + >:=> (line 106, col 8) to (line 106, col 43) +-------------------------------- +108>} = multiRobot, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~ => Pos: (3183 to 3197) SpanInfo: {"start":3043,"length":139} + >skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "none", secondary: "none" } + >:=> (line 104, col 4) to (line 107, col 46) +108>} = multiRobot, i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (3198 to 3204) SpanInfo: {"start":3199,"length":5} + >i = 0 + >:=> (line 108, col 16) to (line 108, col 21) +108>} = multiRobot, i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (3205 to 3211) SpanInfo: {"start":3206,"length":5} + >i < 1 + >:=> (line 108, col 23) to (line 108, col 28) +108>} = multiRobot, i = 0; i < 1; i++) { + + ~~~~~~~~ => Pos: (3212 to 3219) SpanInfo: {"start":3213,"length":3} + >i++ + >:=> (line 108, col 30) to (line 108, col 33) +-------------------------------- +109> console.log(primaryA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (3220 to 3246) SpanInfo: {"start":3224,"length":21} + >console.log(primaryA) + >:=> (line 109, col 4) to (line 109, col 25) +-------------------------------- +110>} + + ~~ => Pos: (3247 to 3248) SpanInfo: {"start":3224,"length":21} + >console.log(primaryA) + >:=> (line 109, col 4) to (line 109, col 25) +-------------------------------- +111>for ({ + + ~~~~~~~ => Pos: (3249 to 3255) SpanInfo: {"start":3260,"length":22} + >name: nameA = "noName" + >:=> (line 112, col 4) to (line 112, col 26) +-------------------------------- +112> name: nameA = "noName", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (3256 to 3283) SpanInfo: {"start":3260,"length":22} + >name: nameA = "noName" + >:=> (line 112, col 4) to (line 112, col 26) +-------------------------------- +113> skills: { + + ~~~~~~~~~~~ => Pos: (3284 to 3294) SpanInfo: {"start":3288,"length":139} + >skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "none", secondary: "none" } + >:=> (line 113, col 4) to (line 116, col 46) +113> skills: { + + ~~~ => Pos: (3295 to 3297) SpanInfo: {"start":3306,"length":29} + >primary: primaryA = "primary" + >:=> (line 114, col 8) to (line 114, col 37) +-------------------------------- +114> primary: primaryA = "primary", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (3298 to 3336) SpanInfo: {"start":3306,"length":29} + >primary: primaryA = "primary" + >:=> (line 114, col 8) to (line 114, col 37) +-------------------------------- +115> secondary: secondaryA = "secondary" + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (3337 to 3380) SpanInfo: {"start":3345,"length":35} + >secondary: secondaryA = "secondary" + >:=> (line 115, col 8) to (line 115, col 43) +-------------------------------- +116> } = { primary: "none", secondary: "none" } + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (3381 to 3427) SpanInfo: {"start":3345,"length":35} + >secondary: secondaryA = "secondary" + >:=> (line 115, col 8) to (line 115, col 43) +-------------------------------- +117>} = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~ => Pos: (3428 to 3447) SpanInfo: {"start":3288,"length":139} + >skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "none", secondary: "none" } + >:=> (line 113, col 4) to (line 116, col 46) +117>} = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (3448 to 3454) SpanInfo: {"start":3449,"length":5} + >i = 0 + >:=> (line 117, col 21) to (line 117, col 26) +117>} = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (3455 to 3461) SpanInfo: {"start":3456,"length":5} + >i < 1 + >:=> (line 117, col 28) to (line 117, col 33) +117>} = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~ => Pos: (3462 to 3469) SpanInfo: {"start":3463,"length":3} + >i++ + >:=> (line 117, col 35) to (line 117, col 38) +-------------------------------- +118> console.log(primaryA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (3470 to 3496) SpanInfo: {"start":3474,"length":21} + >console.log(primaryA) + >:=> (line 118, col 4) to (line 118, col 25) +-------------------------------- +119>} + + ~~ => Pos: (3497 to 3498) SpanInfo: {"start":3474,"length":21} + >console.log(primaryA) + >:=> (line 118, col 4) to (line 118, col 25) +-------------------------------- +120>for ({ + + ~~~~~~~ => Pos: (3499 to 3505) SpanInfo: {"start":3510,"length":22} + >name: nameA = "noName" + >:=> (line 121, col 4) to (line 121, col 26) +-------------------------------- +121> name: nameA = "noName", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (3506 to 3533) SpanInfo: {"start":3510,"length":22} + >name: nameA = "noName" + >:=> (line 121, col 4) to (line 121, col 26) +-------------------------------- +122> skills: { + + ~~~~~~~~~~~ => Pos: (3534 to 3544) SpanInfo: {"start":3538,"length":139} + >skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "none", secondary: "none" } + >:=> (line 122, col 4) to (line 125, col 46) +122> skills: { + + ~~~ => Pos: (3545 to 3547) SpanInfo: {"start":3556,"length":29} + >primary: primaryA = "primary" + >:=> (line 123, col 8) to (line 123, col 37) +-------------------------------- +123> primary: primaryA = "primary", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (3548 to 3586) SpanInfo: {"start":3556,"length":29} + >primary: primaryA = "primary" + >:=> (line 123, col 8) to (line 123, col 37) +-------------------------------- +124> secondary: secondaryA = "secondary" + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (3587 to 3630) SpanInfo: {"start":3595,"length":35} + >secondary: secondaryA = "secondary" + >:=> (line 124, col 8) to (line 124, col 43) +-------------------------------- +125> } = { primary: "none", secondary: "none" } + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (3631 to 3677) SpanInfo: {"start":3595,"length":35} + >secondary: secondaryA = "secondary" + >:=> (line 124, col 8) to (line 124, col 43) +-------------------------------- +126>} = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (3678 to 3768) SpanInfo: {"start":3538,"length":139} + >skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "none", secondary: "none" } + >:=> (line 122, col 4) to (line 125, col 46) +-------------------------------- +127> i = 0; i < 1; i++) { + + ~~~~~~~~~~ => Pos: (3769 to 3778) SpanInfo: {"start":3773,"length":5} + >i = 0 + >:=> (line 127, col 4) to (line 127, col 9) +127> i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (3779 to 3785) SpanInfo: {"start":3780,"length":5} + >i < 1 + >:=> (line 127, col 11) to (line 127, col 16) +127> i = 0; i < 1; i++) { + + ~~~~~~~~ => Pos: (3786 to 3793) SpanInfo: {"start":3787,"length":3} + >i++ + >:=> (line 127, col 18) to (line 127, col 21) +-------------------------------- +128> console.log(primaryA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (3794 to 3820) SpanInfo: {"start":3798,"length":21} + >console.log(primaryA) + >:=> (line 128, col 4) to (line 128, col 25) +-------------------------------- +129>} + + ~~ => Pos: (3821 to 3822) SpanInfo: {"start":3798,"length":21} + >console.log(primaryA) + >:=> (line 128, col 4) to (line 128, col 25) +-------------------------------- +130>for ({ name = "noName", skill = "skill" } = robot, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (3823 to 3845) SpanInfo: {"start":3830,"length":15} + >name = "noName" + >:=> (line 130, col 7) to (line 130, col 22) +130>for ({ name = "noName", skill = "skill" } = robot, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (3846 to 3872) SpanInfo: {"start":3847,"length":15} + >skill = "skill" + >:=> (line 130, col 24) to (line 130, col 39) +130>for ({ name = "noName", skill = "skill" } = robot, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (3873 to 3879) SpanInfo: {"start":3874,"length":5} + >i = 0 + >:=> (line 130, col 51) to (line 130, col 56) +130>for ({ name = "noName", skill = "skill" } = robot, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (3880 to 3886) SpanInfo: {"start":3881,"length":5} + >i < 1 + >:=> (line 130, col 58) to (line 130, col 63) +130>for ({ name = "noName", skill = "skill" } = robot, i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (3887 to 3894) SpanInfo: {"start":3888,"length":3} + >i++ + >:=> (line 130, col 65) to (line 130, col 68) +-------------------------------- +131> console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (3895 to 3918) SpanInfo: {"start":3899,"length":18} + >console.log(nameA) + >:=> (line 131, col 4) to (line 131, col 22) +-------------------------------- +132>} + + ~~ => Pos: (3919 to 3920) SpanInfo: {"start":3899,"length":18} + >console.log(nameA) + >:=> (line 131, col 4) to (line 131, col 22) +-------------------------------- +133>for ({ name = "noName", skill = "skill" } = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (3921 to 3943) SpanInfo: {"start":3928,"length":15} + >name = "noName" + >:=> (line 133, col 7) to (line 133, col 22) +133>for ({ name = "noName", skill = "skill" } = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (3944 to 3975) SpanInfo: {"start":3945,"length":15} + >skill = "skill" + >:=> (line 133, col 24) to (line 133, col 39) +133>for ({ name = "noName", skill = "skill" } = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (3976 to 3982) SpanInfo: {"start":3977,"length":5} + >i = 0 + >:=> (line 133, col 56) to (line 133, col 61) +133>for ({ name = "noName", skill = "skill" } = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (3983 to 3989) SpanInfo: {"start":3984,"length":5} + >i < 1 + >:=> (line 133, col 63) to (line 133, col 68) +133>for ({ name = "noName", skill = "skill" } = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (3990 to 3997) SpanInfo: {"start":3991,"length":3} + >i++ + >:=> (line 133, col 70) to (line 133, col 73) +-------------------------------- +134> console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (3998 to 4021) SpanInfo: {"start":4002,"length":18} + >console.log(nameA) + >:=> (line 134, col 4) to (line 134, col 22) +-------------------------------- +135>} + + ~~ => Pos: (4022 to 4023) SpanInfo: {"start":4002,"length":18} + >console.log(nameA) + >:=> (line 134, col 4) to (line 134, col 22) +-------------------------------- +136>for ({ name = "noName", skill = "skill" } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (4024 to 4046) SpanInfo: {"start":4031,"length":15} + >name = "noName" + >:=> (line 136, col 7) to (line 136, col 22) +136>for ({ name = "noName", skill = "skill" } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (4047 to 4113) SpanInfo: {"start":4048,"length":15} + >skill = "skill" + >:=> (line 136, col 24) to (line 136, col 39) +136>for ({ name = "noName", skill = "skill" } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (4114 to 4120) SpanInfo: {"start":4115,"length":5} + >i = 0 + >:=> (line 136, col 91) to (line 136, col 96) +136>for ({ name = "noName", skill = "skill" } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (4121 to 4127) SpanInfo: {"start":4122,"length":5} + >i < 1 + >:=> (line 136, col 98) to (line 136, col 103) +136>for ({ name = "noName", skill = "skill" } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (4128 to 4135) SpanInfo: {"start":4129,"length":3} + >i++ + >:=> (line 136, col 105) to (line 136, col 108) +-------------------------------- +137> console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (4136 to 4159) SpanInfo: {"start":4140,"length":18} + >console.log(nameA) + >:=> (line 137, col 4) to (line 137, col 22) +-------------------------------- +138>} + + ~~ => Pos: (4160 to 4161) SpanInfo: {"start":4140,"length":18} + >console.log(nameA) + >:=> (line 137, col 4) to (line 137, col 22) +-------------------------------- +139>for ({ + + ~~~~~~~ => Pos: (4162 to 4168) SpanInfo: {"start":4173,"length":15} + >name = "noName" + >:=> (line 140, col 4) to (line 140, col 19) +-------------------------------- +140> name = "noName", + + ~~~~~~~~~~~~~~~~~~~~~ => Pos: (4169 to 4189) SpanInfo: {"start":4173,"length":15} + >name = "noName" + >:=> (line 140, col 4) to (line 140, col 19) +-------------------------------- +141> skills: { + + ~~~~~~~~~~~ => Pos: (4190 to 4200) SpanInfo: {"start":4194,"length":117} + >skills: { + > primary = "primary", + > secondary = "secondary" + > } = { primary: "none", secondary: "none" } + >:=> (line 141, col 4) to (line 144, col 46) +141> skills: { + + ~~~ => Pos: (4201 to 4203) SpanInfo: {"start":4212,"length":19} + >primary = "primary" + >:=> (line 142, col 8) to (line 142, col 27) +-------------------------------- +142> primary = "primary", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (4204 to 4232) SpanInfo: {"start":4212,"length":19} + >primary = "primary" + >:=> (line 142, col 8) to (line 142, col 27) +-------------------------------- +143> secondary = "secondary" + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (4233 to 4264) SpanInfo: {"start":4241,"length":23} + >secondary = "secondary" + >:=> (line 143, col 8) to (line 143, col 31) +-------------------------------- +144> } = { primary: "none", secondary: "none" } + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (4265 to 4311) SpanInfo: {"start":4241,"length":23} + >secondary = "secondary" + >:=> (line 143, col 8) to (line 143, col 31) +-------------------------------- +145>} = multiRobot, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~ => Pos: (4312 to 4326) SpanInfo: {"start":4194,"length":117} + >skills: { + > primary = "primary", + > secondary = "secondary" + > } = { primary: "none", secondary: "none" } + >:=> (line 141, col 4) to (line 144, col 46) +145>} = multiRobot, i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (4327 to 4333) SpanInfo: {"start":4328,"length":5} + >i = 0 + >:=> (line 145, col 16) to (line 145, col 21) +145>} = multiRobot, i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (4334 to 4340) SpanInfo: {"start":4335,"length":5} + >i < 1 + >:=> (line 145, col 23) to (line 145, col 28) +145>} = multiRobot, i = 0; i < 1; i++) { + + ~~~~~~~~ => Pos: (4341 to 4348) SpanInfo: {"start":4342,"length":3} + >i++ + >:=> (line 145, col 30) to (line 145, col 33) +-------------------------------- +146> console.log(primaryA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (4349 to 4375) SpanInfo: {"start":4353,"length":21} + >console.log(primaryA) + >:=> (line 146, col 4) to (line 146, col 25) +-------------------------------- +147>} + + ~~ => Pos: (4376 to 4377) SpanInfo: {"start":4353,"length":21} + >console.log(primaryA) + >:=> (line 146, col 4) to (line 146, col 25) +-------------------------------- +148>for ({ + + ~~~~~~~ => Pos: (4378 to 4384) SpanInfo: {"start":4389,"length":15} + >name = "noName" + >:=> (line 149, col 4) to (line 149, col 19) +-------------------------------- +149> name = "noName", + + ~~~~~~~~~~~~~~~~~~~~~ => Pos: (4385 to 4405) SpanInfo: {"start":4389,"length":15} + >name = "noName" + >:=> (line 149, col 4) to (line 149, col 19) +-------------------------------- +150> skills: { + + ~~~~~~~~~~~ => Pos: (4406 to 4416) SpanInfo: {"start":4410,"length":117} + >skills: { + > primary = "primary", + > secondary = "secondary" + > } = { primary: "none", secondary: "none" } + >:=> (line 150, col 4) to (line 153, col 46) +150> skills: { + + ~~~ => Pos: (4417 to 4419) SpanInfo: {"start":4428,"length":19} + >primary = "primary" + >:=> (line 151, col 8) to (line 151, col 27) +-------------------------------- +151> primary = "primary", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (4420 to 4448) SpanInfo: {"start":4428,"length":19} + >primary = "primary" + >:=> (line 151, col 8) to (line 151, col 27) +-------------------------------- +152> secondary = "secondary" + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (4449 to 4480) SpanInfo: {"start":4457,"length":23} + >secondary = "secondary" + >:=> (line 152, col 8) to (line 152, col 31) +-------------------------------- +153> } = { primary: "none", secondary: "none" } + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (4481 to 4527) SpanInfo: {"start":4457,"length":23} + >secondary = "secondary" + >:=> (line 152, col 8) to (line 152, col 31) +-------------------------------- +154>} = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~ => Pos: (4528 to 4547) SpanInfo: {"start":4410,"length":117} + >skills: { + > primary = "primary", + > secondary = "secondary" + > } = { primary: "none", secondary: "none" } + >:=> (line 150, col 4) to (line 153, col 46) +154>} = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (4548 to 4554) SpanInfo: {"start":4549,"length":5} + >i = 0 + >:=> (line 154, col 21) to (line 154, col 26) +154>} = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (4555 to 4561) SpanInfo: {"start":4556,"length":5} + >i < 1 + >:=> (line 154, col 28) to (line 154, col 33) +154>} = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~ => Pos: (4562 to 4569) SpanInfo: {"start":4563,"length":3} + >i++ + >:=> (line 154, col 35) to (line 154, col 38) +-------------------------------- +155> console.log(primaryA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (4570 to 4596) SpanInfo: {"start":4574,"length":21} + >console.log(primaryA) + >:=> (line 155, col 4) to (line 155, col 25) +-------------------------------- +156>} + + ~~ => Pos: (4597 to 4598) SpanInfo: {"start":4574,"length":21} + >console.log(primaryA) + >:=> (line 155, col 4) to (line 155, col 25) +-------------------------------- +157>for ({ + + ~~~~~~~ => Pos: (4599 to 4605) SpanInfo: {"start":4610,"length":15} + >name = "noName" + >:=> (line 158, col 4) to (line 158, col 19) +-------------------------------- +158> name = "noName", + + ~~~~~~~~~~~~~~~~~~~~~ => Pos: (4606 to 4626) SpanInfo: {"start":4610,"length":15} + >name = "noName" + >:=> (line 158, col 4) to (line 158, col 19) +-------------------------------- +159> skills: { + + ~~~~~~~~~~~ => Pos: (4627 to 4637) SpanInfo: {"start":4631,"length":117} + >skills: { + > primary = "primary", + > secondary = "secondary" + > } = { primary: "none", secondary: "none" } + >:=> (line 159, col 4) to (line 162, col 46) +159> skills: { + + ~~~ => Pos: (4638 to 4640) SpanInfo: {"start":4649,"length":19} + >primary = "primary" + >:=> (line 160, col 8) to (line 160, col 27) +-------------------------------- +160> primary = "primary", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (4641 to 4669) SpanInfo: {"start":4649,"length":19} + >primary = "primary" + >:=> (line 160, col 8) to (line 160, col 27) +-------------------------------- +161> secondary = "secondary" + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (4670 to 4701) SpanInfo: {"start":4678,"length":23} + >secondary = "secondary" + >:=> (line 161, col 8) to (line 161, col 31) +-------------------------------- +162> } = { primary: "none", secondary: "none" } + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (4702 to 4748) SpanInfo: {"start":4678,"length":23} + >secondary = "secondary" + >:=> (line 161, col 8) to (line 161, col 31) +-------------------------------- +163>} = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (4749 to 4839) SpanInfo: {"start":4631,"length":117} + >skills: { + > primary = "primary", + > secondary = "secondary" + > } = { primary: "none", secondary: "none" } + >:=> (line 159, col 4) to (line 162, col 46) +-------------------------------- +164> i = 0; i < 1; i++) { + + ~~~~~~~~~~ => Pos: (4840 to 4849) SpanInfo: {"start":4844,"length":5} + >i = 0 + >:=> (line 164, col 4) to (line 164, col 9) +164> i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (4850 to 4856) SpanInfo: {"start":4851,"length":5} + >i < 1 + >:=> (line 164, col 11) to (line 164, col 16) +164> i = 0; i < 1; i++) { + + ~~~~~~~~ => Pos: (4857 to 4864) SpanInfo: {"start":4858,"length":3} + >i++ + >:=> (line 164, col 18) to (line 164, col 21) +-------------------------------- +165> console.log(primaryA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (4865 to 4891) SpanInfo: {"start":4869,"length":21} + >console.log(primaryA) + >:=> (line 165, col 4) to (line 165, col 25) +-------------------------------- +166>} + ~ => Pos: (4892 to 4892) SpanInfo: {"start":4869,"length":21} + >console.log(primaryA) + >:=> (line 165, col 4) to (line 165, col 25) \ No newline at end of file diff --git a/tests/baselines/reference/bpSpanDestructuringAssignmentForOfArrayBindingPattern.baseline b/tests/baselines/reference/bpSpanDestructuringAssignmentForOfArrayBindingPattern.baseline new file mode 100644 index 00000000000..16f6039031e --- /dev/null +++ b/tests/baselines/reference/bpSpanDestructuringAssignmentForOfArrayBindingPattern.baseline @@ -0,0 +1,779 @@ + +1 >declare var console: { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (0 to 22) SpanInfo: undefined +-------------------------------- +2 > log(msg: any): void; + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (23 to 47) SpanInfo: undefined +-------------------------------- +3 >} + + ~~ => Pos: (48 to 49) SpanInfo: undefined +-------------------------------- +4 >type Robot = [number, string, string]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (50 to 88) SpanInfo: undefined +-------------------------------- +5 >type MultiSkilledRobot = [string, [string, string]]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (89 to 141) SpanInfo: undefined +-------------------------------- +6 >let robotA: Robot = [1, "mower", "mowing"]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (142 to 185) SpanInfo: {"start":142,"length":42} + >let robotA: Robot = [1, "mower", "mowing"] + >:=> (line 6, col 0) to (line 6, col 42) +-------------------------------- +7 >let robotB: Robot = [2, "trimmer", "trimming"]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (186 to 233) SpanInfo: {"start":186,"length":46} + >let robotB: Robot = [2, "trimmer", "trimming"] + >:=> (line 7, col 0) to (line 7, col 46) +-------------------------------- +8 >let robots = [robotA, robotB]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (234 to 264) SpanInfo: {"start":234,"length":29} + >let robots = [robotA, robotB] + >:=> (line 8, col 0) to (line 8, col 29) +-------------------------------- +9 >function getRobots() { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (265 to 287) SpanInfo: {"start":292,"length":13} + >return robots + >:=> (line 10, col 4) to (line 10, col 17) +-------------------------------- +10 > return robots; + + ~~~~~~~~~~~~~~~~~~~ => Pos: (288 to 306) SpanInfo: {"start":292,"length":13} + >return robots + >:=> (line 10, col 4) to (line 10, col 17) +-------------------------------- +11 >} + + ~~ => Pos: (307 to 308) SpanInfo: {"start":307,"length":1} + >} + >:=> (line 11, col 0) to (line 11, col 1) +-------------------------------- +12 >let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (309 to 372) SpanInfo: {"start":309,"length":62} + >let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]] + >:=> (line 12, col 0) to (line 12, col 62) +-------------------------------- +13 >let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (373 to 446) SpanInfo: {"start":373,"length":72} + >let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]] + >:=> (line 13, col 0) to (line 13, col 72) +-------------------------------- +14 >let multiRobots = [multiRobotA, multiRobotB]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (447 to 492) SpanInfo: {"start":447,"length":44} + >let multiRobots = [multiRobotA, multiRobotB] + >:=> (line 14, col 0) to (line 14, col 44) +-------------------------------- +15 >function getMultiRobots() { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (493 to 520) SpanInfo: {"start":525,"length":18} + >return multiRobots + >:=> (line 16, col 4) to (line 16, col 22) +-------------------------------- +16 > return multiRobots; + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (521 to 544) SpanInfo: {"start":525,"length":18} + >return multiRobots + >:=> (line 16, col 4) to (line 16, col 22) +-------------------------------- +17 >} + + ~~ => Pos: (545 to 546) SpanInfo: {"start":545,"length":1} + >} + >:=> (line 17, col 0) to (line 17, col 1) +-------------------------------- +18 >let nameA: string, primarySkillA: string, secondarySkillA: string; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (547 to 613) SpanInfo: undefined +-------------------------------- +19 >let numberB: number, nameB: string; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (614 to 649) SpanInfo: undefined +-------------------------------- +20 >let numberA2: number, nameA2: string, skillA2: string, nameMA: string; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (650 to 720) SpanInfo: undefined +-------------------------------- +21 >let numberA3: number, robotAInfo: (number | string)[], multiRobotAInfo: (string | [string, string])[]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (721 to 823) SpanInfo: undefined +-------------------------------- +22 >for ([, nameA] of robots) { + + ~~~~~~~~~~~~~~ => Pos: (824 to 837) SpanInfo: {"start":832,"length":5} + >nameA + >:=> (line 22, col 8) to (line 22, col 13) +22 >for ([, nameA] of robots) { + + ~~~~~~~~~~~~~~ => Pos: (838 to 851) SpanInfo: {"start":842,"length":6} + >robots + >:=> (line 22, col 18) to (line 22, col 24) +-------------------------------- +23 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (852 to 875) SpanInfo: {"start":856,"length":18} + >console.log(nameA) + >:=> (line 23, col 4) to (line 23, col 22) +-------------------------------- +24 >} + + ~~ => Pos: (876 to 877) SpanInfo: {"start":856,"length":18} + >console.log(nameA) + >:=> (line 23, col 4) to (line 23, col 22) +-------------------------------- +25 >for ([, nameA] of getRobots()) { + + ~~~~~~~~~~~~~~ => Pos: (878 to 891) SpanInfo: {"start":886,"length":5} + >nameA + >:=> (line 25, col 8) to (line 25, col 13) +25 >for ([, nameA] of getRobots()) { + + ~~~~~~~~~~~~~~~~~~~ => Pos: (892 to 910) SpanInfo: {"start":896,"length":11} + >getRobots() + >:=> (line 25, col 18) to (line 25, col 29) +-------------------------------- +26 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (911 to 934) SpanInfo: {"start":915,"length":18} + >console.log(nameA) + >:=> (line 26, col 4) to (line 26, col 22) +-------------------------------- +27 >} + + ~~ => Pos: (935 to 936) SpanInfo: {"start":915,"length":18} + >console.log(nameA) + >:=> (line 26, col 4) to (line 26, col 22) +-------------------------------- +28 >for ([, nameA] of [robotA, robotB]) { + + ~~~~~~~~~~~~~~ => Pos: (937 to 950) SpanInfo: {"start":945,"length":5} + >nameA + >:=> (line 28, col 8) to (line 28, col 13) +28 >for ([, nameA] of [robotA, robotB]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (951 to 974) SpanInfo: {"start":955,"length":16} + >[robotA, robotB] + >:=> (line 28, col 18) to (line 28, col 34) +-------------------------------- +29 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (975 to 998) SpanInfo: {"start":979,"length":18} + >console.log(nameA) + >:=> (line 29, col 4) to (line 29, col 22) +-------------------------------- +30 >} + + ~~ => Pos: (999 to 1000) SpanInfo: {"start":979,"length":18} + >console.log(nameA) + >:=> (line 29, col 4) to (line 29, col 22) +-------------------------------- +31 >for ([, [primarySkillA, secondarySkillA]] of multiRobots) { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1001 to 1023) SpanInfo: {"start":1010,"length":13} + >primarySkillA + >:=> (line 31, col 9) to (line 31, col 22) +31 >for ([, [primarySkillA, secondarySkillA]] of multiRobots) { + + ~~~~~~~~~~~~~~~~~ => Pos: (1024 to 1040) SpanInfo: {"start":1025,"length":15} + >secondarySkillA + >:=> (line 31, col 24) to (line 31, col 39) +31 >for ([, [primarySkillA, secondarySkillA]] of multiRobots) { + + ~ => Pos: (1041 to 1041) SpanInfo: {"start":1009,"length":32} + >[primarySkillA, secondarySkillA] + >:=> (line 31, col 8) to (line 31, col 40) +31 >for ([, [primarySkillA, secondarySkillA]] of multiRobots) { + + ~~~~~~~~~~~~~~~~~~~=> Pos: (1042 to 1060) SpanInfo: {"start":1046,"length":11} + >multiRobots + >:=> (line 31, col 45) to (line 31, col 56) +-------------------------------- +32 > console.log(primarySkillA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1061 to 1092) SpanInfo: {"start":1065,"length":26} + >console.log(primarySkillA) + >:=> (line 32, col 4) to (line 32, col 30) +-------------------------------- +33 >} + + ~~ => Pos: (1093 to 1094) SpanInfo: {"start":1065,"length":26} + >console.log(primarySkillA) + >:=> (line 32, col 4) to (line 32, col 30) +-------------------------------- +34 >for ([, [primarySkillA, secondarySkillA]] of getMultiRobots()) { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1095 to 1117) SpanInfo: {"start":1104,"length":13} + >primarySkillA + >:=> (line 34, col 9) to (line 34, col 22) +34 >for ([, [primarySkillA, secondarySkillA]] of getMultiRobots()) { + + ~~~~~~~~~~~~~~~~~ => Pos: (1118 to 1134) SpanInfo: {"start":1119,"length":15} + >secondarySkillA + >:=> (line 34, col 24) to (line 34, col 39) +34 >for ([, [primarySkillA, secondarySkillA]] of getMultiRobots()) { + + ~ => Pos: (1135 to 1135) SpanInfo: {"start":1103,"length":32} + >[primarySkillA, secondarySkillA] + >:=> (line 34, col 8) to (line 34, col 40) +34 >for ([, [primarySkillA, secondarySkillA]] of getMultiRobots()) { + + ~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1136 to 1159) SpanInfo: {"start":1140,"length":16} + >getMultiRobots() + >:=> (line 34, col 45) to (line 34, col 61) +-------------------------------- +35 > console.log(primarySkillA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1160 to 1191) SpanInfo: {"start":1164,"length":26} + >console.log(primarySkillA) + >:=> (line 35, col 4) to (line 35, col 30) +-------------------------------- +36 >} + + ~~ => Pos: (1192 to 1193) SpanInfo: {"start":1164,"length":26} + >console.log(primarySkillA) + >:=> (line 35, col 4) to (line 35, col 30) +-------------------------------- +37 >for ([, [primarySkillA, secondarySkillA]] of [multiRobotA, multiRobotB]) { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1194 to 1216) SpanInfo: {"start":1203,"length":13} + >primarySkillA + >:=> (line 37, col 9) to (line 37, col 22) +37 >for ([, [primarySkillA, secondarySkillA]] of [multiRobotA, multiRobotB]) { + + ~~~~~~~~~~~~~~~~~ => Pos: (1217 to 1233) SpanInfo: {"start":1218,"length":15} + >secondarySkillA + >:=> (line 37, col 24) to (line 37, col 39) +37 >for ([, [primarySkillA, secondarySkillA]] of [multiRobotA, multiRobotB]) { + + ~ => Pos: (1234 to 1234) SpanInfo: {"start":1202,"length":32} + >[primarySkillA, secondarySkillA] + >:=> (line 37, col 8) to (line 37, col 40) +37 >for ([, [primarySkillA, secondarySkillA]] of [multiRobotA, multiRobotB]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1235 to 1268) SpanInfo: {"start":1239,"length":26} + >[multiRobotA, multiRobotB] + >:=> (line 37, col 45) to (line 37, col 71) +-------------------------------- +38 > console.log(primarySkillA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1269 to 1300) SpanInfo: {"start":1273,"length":26} + >console.log(primarySkillA) + >:=> (line 38, col 4) to (line 38, col 30) +-------------------------------- +39 >} + + ~~ => Pos: (1301 to 1302) SpanInfo: {"start":1273,"length":26} + >console.log(primarySkillA) + >:=> (line 38, col 4) to (line 38, col 30) +-------------------------------- +40 >for ([numberB] of robots) { + + ~~~~~~~~~~~~~~ => Pos: (1303 to 1316) SpanInfo: {"start":1309,"length":7} + >numberB + >:=> (line 40, col 6) to (line 40, col 13) +40 >for ([numberB] of robots) { + + ~~~~~~~~~~~~~~ => Pos: (1317 to 1330) SpanInfo: {"start":1321,"length":6} + >robots + >:=> (line 40, col 18) to (line 40, col 24) +-------------------------------- +41 > console.log(numberB); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1331 to 1356) SpanInfo: {"start":1335,"length":20} + >console.log(numberB) + >:=> (line 41, col 4) to (line 41, col 24) +-------------------------------- +42 >} + + ~~ => Pos: (1357 to 1358) SpanInfo: {"start":1335,"length":20} + >console.log(numberB) + >:=> (line 41, col 4) to (line 41, col 24) +-------------------------------- +43 >for ([numberB] of getRobots()) { + + ~~~~~~~~~~~~~~ => Pos: (1359 to 1372) SpanInfo: {"start":1365,"length":7} + >numberB + >:=> (line 43, col 6) to (line 43, col 13) +43 >for ([numberB] of getRobots()) { + + ~~~~~~~~~~~~~~~~~~~ => Pos: (1373 to 1391) SpanInfo: {"start":1377,"length":11} + >getRobots() + >:=> (line 43, col 18) to (line 43, col 29) +-------------------------------- +44 > console.log(numberB); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1392 to 1417) SpanInfo: {"start":1396,"length":20} + >console.log(numberB) + >:=> (line 44, col 4) to (line 44, col 24) +-------------------------------- +45 >} + + ~~ => Pos: (1418 to 1419) SpanInfo: {"start":1396,"length":20} + >console.log(numberB) + >:=> (line 44, col 4) to (line 44, col 24) +-------------------------------- +46 >for ([numberB] of [robotA, robotB]) { + + ~~~~~~~~~~~~~~ => Pos: (1420 to 1433) SpanInfo: {"start":1426,"length":7} + >numberB + >:=> (line 46, col 6) to (line 46, col 13) +46 >for ([numberB] of [robotA, robotB]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1434 to 1457) SpanInfo: {"start":1438,"length":16} + >[robotA, robotB] + >:=> (line 46, col 18) to (line 46, col 34) +-------------------------------- +47 > console.log(numberB); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1458 to 1483) SpanInfo: {"start":1462,"length":20} + >console.log(numberB) + >:=> (line 47, col 4) to (line 47, col 24) +-------------------------------- +48 >} + + ~~ => Pos: (1484 to 1485) SpanInfo: {"start":1462,"length":20} + >console.log(numberB) + >:=> (line 47, col 4) to (line 47, col 24) +-------------------------------- +49 >for ([nameB] of multiRobots) { + + ~~~~~~~~~~~~ => Pos: (1486 to 1497) SpanInfo: {"start":1492,"length":5} + >nameB + >:=> (line 49, col 6) to (line 49, col 11) +49 >for ([nameB] of multiRobots) { + + ~~~~~~~~~~~~~~~~~~~ => Pos: (1498 to 1516) SpanInfo: {"start":1502,"length":11} + >multiRobots + >:=> (line 49, col 16) to (line 49, col 27) +-------------------------------- +50 > console.log(nameB); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1517 to 1540) SpanInfo: {"start":1521,"length":18} + >console.log(nameB) + >:=> (line 50, col 4) to (line 50, col 22) +-------------------------------- +51 >} + + ~~ => Pos: (1541 to 1542) SpanInfo: {"start":1521,"length":18} + >console.log(nameB) + >:=> (line 50, col 4) to (line 50, col 22) +-------------------------------- +52 >for ([nameB] of getMultiRobots()) { + + ~~~~~~~~~~~~ => Pos: (1543 to 1554) SpanInfo: {"start":1549,"length":5} + >nameB + >:=> (line 52, col 6) to (line 52, col 11) +52 >for ([nameB] of getMultiRobots()) { + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1555 to 1578) SpanInfo: {"start":1559,"length":16} + >getMultiRobots() + >:=> (line 52, col 16) to (line 52, col 32) +-------------------------------- +53 > console.log(nameB); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1579 to 1602) SpanInfo: {"start":1583,"length":18} + >console.log(nameB) + >:=> (line 53, col 4) to (line 53, col 22) +-------------------------------- +54 >} + + ~~ => Pos: (1603 to 1604) SpanInfo: {"start":1583,"length":18} + >console.log(nameB) + >:=> (line 53, col 4) to (line 53, col 22) +-------------------------------- +55 >for ([nameB] of [multiRobotA, multiRobotB]) { + + ~~~~~~~~~~~~ => Pos: (1605 to 1616) SpanInfo: {"start":1611,"length":5} + >nameB + >:=> (line 55, col 6) to (line 55, col 11) +55 >for ([nameB] of [multiRobotA, multiRobotB]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1617 to 1650) SpanInfo: {"start":1621,"length":26} + >[multiRobotA, multiRobotB] + >:=> (line 55, col 16) to (line 55, col 42) +-------------------------------- +56 > console.log(nameB); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1651 to 1674) SpanInfo: {"start":1655,"length":18} + >console.log(nameB) + >:=> (line 56, col 4) to (line 56, col 22) +-------------------------------- +57 >} + + ~~ => Pos: (1675 to 1676) SpanInfo: {"start":1655,"length":18} + >console.log(nameB) + >:=> (line 56, col 4) to (line 56, col 22) +-------------------------------- +58 >for ([numberA2, nameA2, skillA2] of robots) { + + ~~~~~~~~~~~~~~~ => Pos: (1677 to 1691) SpanInfo: {"start":1683,"length":8} + >numberA2 + >:=> (line 58, col 6) to (line 58, col 14) +58 >for ([numberA2, nameA2, skillA2] of robots) { + + ~~~~~~~~ => Pos: (1692 to 1699) SpanInfo: {"start":1693,"length":6} + >nameA2 + >:=> (line 58, col 16) to (line 58, col 22) +58 >for ([numberA2, nameA2, skillA2] of robots) { + + ~~~~~~~~~ => Pos: (1700 to 1708) SpanInfo: {"start":1701,"length":7} + >skillA2 + >:=> (line 58, col 24) to (line 58, col 31) +58 >for ([numberA2, nameA2, skillA2] of robots) { + + ~~~~~~~~~~~~~~=> Pos: (1709 to 1722) SpanInfo: {"start":1713,"length":6} + >robots + >:=> (line 58, col 36) to (line 58, col 42) +-------------------------------- +59 > console.log(nameA2); + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1723 to 1747) SpanInfo: {"start":1727,"length":19} + >console.log(nameA2) + >:=> (line 59, col 4) to (line 59, col 23) +-------------------------------- +60 >} + + ~~ => Pos: (1748 to 1749) SpanInfo: {"start":1727,"length":19} + >console.log(nameA2) + >:=> (line 59, col 4) to (line 59, col 23) +-------------------------------- +61 >for ([numberA2, nameA2, skillA2] of getRobots()) { + + ~~~~~~~~~~~~~~~ => Pos: (1750 to 1764) SpanInfo: {"start":1756,"length":8} + >numberA2 + >:=> (line 61, col 6) to (line 61, col 14) +61 >for ([numberA2, nameA2, skillA2] of getRobots()) { + + ~~~~~~~~ => Pos: (1765 to 1772) SpanInfo: {"start":1766,"length":6} + >nameA2 + >:=> (line 61, col 16) to (line 61, col 22) +61 >for ([numberA2, nameA2, skillA2] of getRobots()) { + + ~~~~~~~~~ => Pos: (1773 to 1781) SpanInfo: {"start":1774,"length":7} + >skillA2 + >:=> (line 61, col 24) to (line 61, col 31) +61 >for ([numberA2, nameA2, skillA2] of getRobots()) { + + ~~~~~~~~~~~~~~~~~~~=> Pos: (1782 to 1800) SpanInfo: {"start":1786,"length":11} + >getRobots() + >:=> (line 61, col 36) to (line 61, col 47) +-------------------------------- +62 > console.log(nameA2); + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1801 to 1825) SpanInfo: {"start":1805,"length":19} + >console.log(nameA2) + >:=> (line 62, col 4) to (line 62, col 23) +-------------------------------- +63 >} + + ~~ => Pos: (1826 to 1827) SpanInfo: {"start":1805,"length":19} + >console.log(nameA2) + >:=> (line 62, col 4) to (line 62, col 23) +-------------------------------- +64 >for ([numberA2, nameA2, skillA2] of [robotA, robotB]) { + + ~~~~~~~~~~~~~~~ => Pos: (1828 to 1842) SpanInfo: {"start":1834,"length":8} + >numberA2 + >:=> (line 64, col 6) to (line 64, col 14) +64 >for ([numberA2, nameA2, skillA2] of [robotA, robotB]) { + + ~~~~~~~~ => Pos: (1843 to 1850) SpanInfo: {"start":1844,"length":6} + >nameA2 + >:=> (line 64, col 16) to (line 64, col 22) +64 >for ([numberA2, nameA2, skillA2] of [robotA, robotB]) { + + ~~~~~~~~~ => Pos: (1851 to 1859) SpanInfo: {"start":1852,"length":7} + >skillA2 + >:=> (line 64, col 24) to (line 64, col 31) +64 >for ([numberA2, nameA2, skillA2] of [robotA, robotB]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1860 to 1883) SpanInfo: {"start":1864,"length":16} + >[robotA, robotB] + >:=> (line 64, col 36) to (line 64, col 52) +-------------------------------- +65 > console.log(nameA2); + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1884 to 1908) SpanInfo: {"start":1888,"length":19} + >console.log(nameA2) + >:=> (line 65, col 4) to (line 65, col 23) +-------------------------------- +66 >} + + ~~ => Pos: (1909 to 1910) SpanInfo: {"start":1888,"length":19} + >console.log(nameA2) + >:=> (line 65, col 4) to (line 65, col 23) +-------------------------------- +67 >for ([nameMA, [primarySkillA, secondarySkillA]] of multiRobots) { + + ~~~~~~~~~~~~~ => Pos: (1911 to 1923) SpanInfo: {"start":1917,"length":6} + >nameMA + >:=> (line 67, col 6) to (line 67, col 12) +67 >for ([nameMA, [primarySkillA, secondarySkillA]] of multiRobots) { + + ~~~~~~~~~~~~~~~~ => Pos: (1924 to 1939) SpanInfo: {"start":1926,"length":13} + >primarySkillA + >:=> (line 67, col 15) to (line 67, col 28) +67 >for ([nameMA, [primarySkillA, secondarySkillA]] of multiRobots) { + + ~~~~~~~~~~~~~~~~~=> Pos: (1940 to 1956) SpanInfo: {"start":1941,"length":15} + >secondarySkillA + >:=> (line 67, col 30) to (line 67, col 45) +67 >for ([nameMA, [primarySkillA, secondarySkillA]] of multiRobots) { + + ~=> Pos: (1957 to 1957) SpanInfo: {"start":1925,"length":32} + >[primarySkillA, secondarySkillA] + >:=> (line 67, col 14) to (line 67, col 46) +67 >for ([nameMA, [primarySkillA, secondarySkillA]] of multiRobots) { + + ~~~~~~~~~~~~~~~~~~~=> Pos: (1958 to 1976) SpanInfo: {"start":1962,"length":11} + >multiRobots + >:=> (line 67, col 51) to (line 67, col 62) +-------------------------------- +68 > console.log(nameMA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1977 to 2001) SpanInfo: {"start":1981,"length":19} + >console.log(nameMA) + >:=> (line 68, col 4) to (line 68, col 23) +-------------------------------- +69 >} + + ~~ => Pos: (2002 to 2003) SpanInfo: {"start":1981,"length":19} + >console.log(nameMA) + >:=> (line 68, col 4) to (line 68, col 23) +-------------------------------- +70 >for ([nameMA, [primarySkillA, secondarySkillA]] of getMultiRobots()) { + + ~~~~~~~~~~~~~ => Pos: (2004 to 2016) SpanInfo: {"start":2010,"length":6} + >nameMA + >:=> (line 70, col 6) to (line 70, col 12) +70 >for ([nameMA, [primarySkillA, secondarySkillA]] of getMultiRobots()) { + + ~~~~~~~~~~~~~~~~ => Pos: (2017 to 2032) SpanInfo: {"start":2019,"length":13} + >primarySkillA + >:=> (line 70, col 15) to (line 70, col 28) +70 >for ([nameMA, [primarySkillA, secondarySkillA]] of getMultiRobots()) { + + ~~~~~~~~~~~~~~~~~=> Pos: (2033 to 2049) SpanInfo: {"start":2034,"length":15} + >secondarySkillA + >:=> (line 70, col 30) to (line 70, col 45) +70 >for ([nameMA, [primarySkillA, secondarySkillA]] of getMultiRobots()) { + + ~=> Pos: (2050 to 2050) SpanInfo: {"start":2018,"length":32} + >[primarySkillA, secondarySkillA] + >:=> (line 70, col 14) to (line 70, col 46) +70 >for ([nameMA, [primarySkillA, secondarySkillA]] of getMultiRobots()) { + + ~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (2051 to 2074) SpanInfo: {"start":2055,"length":16} + >getMultiRobots() + >:=> (line 70, col 51) to (line 70, col 67) +-------------------------------- +71 > console.log(nameMA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2075 to 2099) SpanInfo: {"start":2079,"length":19} + >console.log(nameMA) + >:=> (line 71, col 4) to (line 71, col 23) +-------------------------------- +72 >} + + ~~ => Pos: (2100 to 2101) SpanInfo: {"start":2079,"length":19} + >console.log(nameMA) + >:=> (line 71, col 4) to (line 71, col 23) +-------------------------------- +73 >for ([nameMA, [primarySkillA, secondarySkillA]] of [multiRobotA, multiRobotB]) { + + ~~~~~~~~~~~~~ => Pos: (2102 to 2114) SpanInfo: {"start":2108,"length":6} + >nameMA + >:=> (line 73, col 6) to (line 73, col 12) +73 >for ([nameMA, [primarySkillA, secondarySkillA]] of [multiRobotA, multiRobotB]) { + + ~~~~~~~~~~~~~~~~ => Pos: (2115 to 2130) SpanInfo: {"start":2117,"length":13} + >primarySkillA + >:=> (line 73, col 15) to (line 73, col 28) +73 >for ([nameMA, [primarySkillA, secondarySkillA]] of [multiRobotA, multiRobotB]) { + + ~~~~~~~~~~~~~~~~~=> Pos: (2131 to 2147) SpanInfo: {"start":2132,"length":15} + >secondarySkillA + >:=> (line 73, col 30) to (line 73, col 45) +73 >for ([nameMA, [primarySkillA, secondarySkillA]] of [multiRobotA, multiRobotB]) { + + ~=> Pos: (2148 to 2148) SpanInfo: {"start":2116,"length":32} + >[primarySkillA, secondarySkillA] + >:=> (line 73, col 14) to (line 73, col 46) +73 >for ([nameMA, [primarySkillA, secondarySkillA]] of [multiRobotA, multiRobotB]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (2149 to 2182) SpanInfo: {"start":2153,"length":26} + >[multiRobotA, multiRobotB] + >:=> (line 73, col 51) to (line 73, col 77) +-------------------------------- +74 > console.log(nameMA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2183 to 2207) SpanInfo: {"start":2187,"length":19} + >console.log(nameMA) + >:=> (line 74, col 4) to (line 74, col 23) +-------------------------------- +75 >} + + ~~ => Pos: (2208 to 2209) SpanInfo: {"start":2187,"length":19} + >console.log(nameMA) + >:=> (line 74, col 4) to (line 74, col 23) +-------------------------------- +76 >for ([numberA3, ...robotAInfo] of robots) { + + ~~~~~~~~~~~~~~~ => Pos: (2210 to 2224) SpanInfo: {"start":2216,"length":8} + >numberA3 + >:=> (line 76, col 6) to (line 76, col 14) +76 >for ([numberA3, ...robotAInfo] of robots) { + + ~~~~~~~~~~~~~~~ => Pos: (2225 to 2239) SpanInfo: {"start":2226,"length":13} + >...robotAInfo + >:=> (line 76, col 16) to (line 76, col 29) +76 >for ([numberA3, ...robotAInfo] of robots) { + + ~~~~~~~~~~~~~~ => Pos: (2240 to 2253) SpanInfo: {"start":2244,"length":6} + >robots + >:=> (line 76, col 34) to (line 76, col 40) +-------------------------------- +77 > console.log(numberA3); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2254 to 2280) SpanInfo: {"start":2258,"length":21} + >console.log(numberA3) + >:=> (line 77, col 4) to (line 77, col 25) +-------------------------------- +78 >} + + ~~ => Pos: (2281 to 2282) SpanInfo: {"start":2258,"length":21} + >console.log(numberA3) + >:=> (line 77, col 4) to (line 77, col 25) +-------------------------------- +79 >for ([numberA3, ...robotAInfo] of getRobots()) { + + ~~~~~~~~~~~~~~~ => Pos: (2283 to 2297) SpanInfo: {"start":2289,"length":8} + >numberA3 + >:=> (line 79, col 6) to (line 79, col 14) +79 >for ([numberA3, ...robotAInfo] of getRobots()) { + + ~~~~~~~~~~~~~~~ => Pos: (2298 to 2312) SpanInfo: {"start":2299,"length":13} + >...robotAInfo + >:=> (line 79, col 16) to (line 79, col 29) +79 >for ([numberA3, ...robotAInfo] of getRobots()) { + + ~~~~~~~~~~~~~~~~~~~=> Pos: (2313 to 2331) SpanInfo: {"start":2317,"length":11} + >getRobots() + >:=> (line 79, col 34) to (line 79, col 45) +-------------------------------- +80 > console.log(numberA3); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2332 to 2358) SpanInfo: {"start":2336,"length":21} + >console.log(numberA3) + >:=> (line 80, col 4) to (line 80, col 25) +-------------------------------- +81 >} + + ~~ => Pos: (2359 to 2360) SpanInfo: {"start":2336,"length":21} + >console.log(numberA3) + >:=> (line 80, col 4) to (line 80, col 25) +-------------------------------- +82 >for ([numberA3, ...robotAInfo] of [robotA, robotB]) { + + ~~~~~~~~~~~~~~~ => Pos: (2361 to 2375) SpanInfo: {"start":2367,"length":8} + >numberA3 + >:=> (line 82, col 6) to (line 82, col 14) +82 >for ([numberA3, ...robotAInfo] of [robotA, robotB]) { + + ~~~~~~~~~~~~~~~ => Pos: (2376 to 2390) SpanInfo: {"start":2377,"length":13} + >...robotAInfo + >:=> (line 82, col 16) to (line 82, col 29) +82 >for ([numberA3, ...robotAInfo] of [robotA, robotB]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (2391 to 2414) SpanInfo: {"start":2395,"length":16} + >[robotA, robotB] + >:=> (line 82, col 34) to (line 82, col 50) +-------------------------------- +83 > console.log(numberA3); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2415 to 2441) SpanInfo: {"start":2419,"length":21} + >console.log(numberA3) + >:=> (line 83, col 4) to (line 83, col 25) +-------------------------------- +84 >} + + ~~ => Pos: (2442 to 2443) SpanInfo: {"start":2419,"length":21} + >console.log(numberA3) + >:=> (line 83, col 4) to (line 83, col 25) +-------------------------------- +85 >for ([...multiRobotAInfo] of multiRobots) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2444 to 2468) SpanInfo: {"start":2450,"length":18} + >...multiRobotAInfo + >:=> (line 85, col 6) to (line 85, col 24) +85 >for ([...multiRobotAInfo] of multiRobots) { + + ~~~~~~~~~~~~~~~~~~~ => Pos: (2469 to 2487) SpanInfo: {"start":2473,"length":11} + >multiRobots + >:=> (line 85, col 29) to (line 85, col 40) +-------------------------------- +86 > console.log(multiRobotAInfo); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2488 to 2521) SpanInfo: {"start":2492,"length":28} + >console.log(multiRobotAInfo) + >:=> (line 86, col 4) to (line 86, col 32) +-------------------------------- +87 >} + + ~~ => Pos: (2522 to 2523) SpanInfo: {"start":2492,"length":28} + >console.log(multiRobotAInfo) + >:=> (line 86, col 4) to (line 86, col 32) +-------------------------------- +88 >for ([...multiRobotAInfo] of getMultiRobots()) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2524 to 2548) SpanInfo: {"start":2530,"length":18} + >...multiRobotAInfo + >:=> (line 88, col 6) to (line 88, col 24) +88 >for ([...multiRobotAInfo] of getMultiRobots()) { + + ~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (2549 to 2572) SpanInfo: {"start":2553,"length":16} + >getMultiRobots() + >:=> (line 88, col 29) to (line 88, col 45) +-------------------------------- +89 > console.log(multiRobotAInfo); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2573 to 2606) SpanInfo: {"start":2577,"length":28} + >console.log(multiRobotAInfo) + >:=> (line 89, col 4) to (line 89, col 32) +-------------------------------- +90 >} + + ~~ => Pos: (2607 to 2608) SpanInfo: {"start":2577,"length":28} + >console.log(multiRobotAInfo) + >:=> (line 89, col 4) to (line 89, col 32) +-------------------------------- +91 >for ([...multiRobotAInfo] of [multiRobotA, multiRobotB]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2609 to 2633) SpanInfo: {"start":2615,"length":18} + >...multiRobotAInfo + >:=> (line 91, col 6) to (line 91, col 24) +91 >for ([...multiRobotAInfo] of [multiRobotA, multiRobotB]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (2634 to 2667) SpanInfo: {"start":2638,"length":26} + >[multiRobotA, multiRobotB] + >:=> (line 91, col 29) to (line 91, col 55) +-------------------------------- +92 > console.log(multiRobotAInfo); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2668 to 2701) SpanInfo: {"start":2672,"length":28} + >console.log(multiRobotAInfo) + >:=> (line 92, col 4) to (line 92, col 32) +-------------------------------- +93 >} + ~ => Pos: (2702 to 2702) SpanInfo: {"start":2672,"length":28} + >console.log(multiRobotAInfo) + >:=> (line 92, col 4) to (line 92, col 32) \ No newline at end of file diff --git a/tests/baselines/reference/bpSpanDestructuringAssignmentForOfArrayBindingPatternDefaultValues.baseline b/tests/baselines/reference/bpSpanDestructuringAssignmentForOfArrayBindingPatternDefaultValues.baseline new file mode 100644 index 00000000000..c7e2f005833 --- /dev/null +++ b/tests/baselines/reference/bpSpanDestructuringAssignmentForOfArrayBindingPatternDefaultValues.baseline @@ -0,0 +1,806 @@ + +1 >declare var console: { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (0 to 22) SpanInfo: undefined +-------------------------------- +2 > log(msg: any): void; + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (23 to 47) SpanInfo: undefined +-------------------------------- +3 >} + + ~~ => Pos: (48 to 49) SpanInfo: undefined +-------------------------------- +4 >type Robot = [number, string, string]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (50 to 88) SpanInfo: undefined +-------------------------------- +5 >type MultiSkilledRobot = [string, [string, string]]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (89 to 141) SpanInfo: undefined +-------------------------------- +6 >let robotA: Robot = [1, "mower", "mowing"]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (142 to 185) SpanInfo: {"start":142,"length":42} + >let robotA: Robot = [1, "mower", "mowing"] + >:=> (line 6, col 0) to (line 6, col 42) +-------------------------------- +7 >let robotB: Robot = [2, "trimmer", "trimming"]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (186 to 233) SpanInfo: {"start":186,"length":46} + >let robotB: Robot = [2, "trimmer", "trimming"] + >:=> (line 7, col 0) to (line 7, col 46) +-------------------------------- +8 >let robots = [robotA, robotB]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (234 to 264) SpanInfo: {"start":234,"length":29} + >let robots = [robotA, robotB] + >:=> (line 8, col 0) to (line 8, col 29) +-------------------------------- +9 >function getRobots() { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (265 to 287) SpanInfo: {"start":292,"length":13} + >return robots + >:=> (line 10, col 4) to (line 10, col 17) +-------------------------------- +10 > return robots; + + ~~~~~~~~~~~~~~~~~~~ => Pos: (288 to 306) SpanInfo: {"start":292,"length":13} + >return robots + >:=> (line 10, col 4) to (line 10, col 17) +-------------------------------- +11 >} + + ~~ => Pos: (307 to 308) SpanInfo: {"start":307,"length":1} + >} + >:=> (line 11, col 0) to (line 11, col 1) +-------------------------------- +12 >let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (309 to 372) SpanInfo: {"start":309,"length":62} + >let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]] + >:=> (line 12, col 0) to (line 12, col 62) +-------------------------------- +13 >let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (373 to 446) SpanInfo: {"start":373,"length":72} + >let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]] + >:=> (line 13, col 0) to (line 13, col 72) +-------------------------------- +14 >let multiRobots = [multiRobotA, multiRobotB]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (447 to 492) SpanInfo: {"start":447,"length":44} + >let multiRobots = [multiRobotA, multiRobotB] + >:=> (line 14, col 0) to (line 14, col 44) +-------------------------------- +15 >function getMultiRobots() { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (493 to 520) SpanInfo: {"start":525,"length":18} + >return multiRobots + >:=> (line 16, col 4) to (line 16, col 22) +-------------------------------- +16 > return multiRobots; + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (521 to 544) SpanInfo: {"start":525,"length":18} + >return multiRobots + >:=> (line 16, col 4) to (line 16, col 22) +-------------------------------- +17 >} + + ~~ => Pos: (545 to 546) SpanInfo: {"start":545,"length":1} + >} + >:=> (line 17, col 0) to (line 17, col 1) +-------------------------------- +18 >let nameA: string, primarySkillA: string, secondarySkillA: string; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (547 to 613) SpanInfo: undefined +-------------------------------- +19 >let numberB: number, nameB: string; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (614 to 649) SpanInfo: undefined +-------------------------------- +20 >let numberA2: number, nameA2: string, skillA2: string, nameMA: string; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (650 to 720) SpanInfo: undefined +-------------------------------- +21 >let numberA3: number, robotAInfo: (number | string)[], multiRobotAInfo: (string | [string, string])[]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (721 to 823) SpanInfo: undefined +-------------------------------- +22 >for ([, nameA = "noName"] of robots) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (824 to 848) SpanInfo: {"start":832,"length":16} + >nameA = "noName" + >:=> (line 22, col 8) to (line 22, col 24) +22 >for ([, nameA = "noName"] of robots) { + + ~~~~~~~~~~~~~~ => Pos: (849 to 862) SpanInfo: {"start":853,"length":6} + >robots + >:=> (line 22, col 29) to (line 22, col 35) +-------------------------------- +23 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (863 to 886) SpanInfo: {"start":867,"length":18} + >console.log(nameA) + >:=> (line 23, col 4) to (line 23, col 22) +-------------------------------- +24 >} + + ~~ => Pos: (887 to 888) SpanInfo: {"start":867,"length":18} + >console.log(nameA) + >:=> (line 23, col 4) to (line 23, col 22) +-------------------------------- +25 >for ([, nameA = "noName"] of getRobots()) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (889 to 913) SpanInfo: {"start":897,"length":16} + >nameA = "noName" + >:=> (line 25, col 8) to (line 25, col 24) +25 >for ([, nameA = "noName"] of getRobots()) { + + ~~~~~~~~~~~~~~~~~~~ => Pos: (914 to 932) SpanInfo: {"start":918,"length":11} + >getRobots() + >:=> (line 25, col 29) to (line 25, col 40) +-------------------------------- +26 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (933 to 956) SpanInfo: {"start":937,"length":18} + >console.log(nameA) + >:=> (line 26, col 4) to (line 26, col 22) +-------------------------------- +27 >} + + ~~ => Pos: (957 to 958) SpanInfo: {"start":937,"length":18} + >console.log(nameA) + >:=> (line 26, col 4) to (line 26, col 22) +-------------------------------- +28 >for ([, nameA = "noName"] of [robotA, robotB]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (959 to 983) SpanInfo: {"start":967,"length":16} + >nameA = "noName" + >:=> (line 28, col 8) to (line 28, col 24) +28 >for ([, nameA = "noName"] of [robotA, robotB]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (984 to 1007) SpanInfo: {"start":988,"length":16} + >[robotA, robotB] + >:=> (line 28, col 29) to (line 28, col 45) +-------------------------------- +29 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1008 to 1031) SpanInfo: {"start":1012,"length":18} + >console.log(nameA) + >:=> (line 29, col 4) to (line 29, col 22) +-------------------------------- +30 >} + + ~~ => Pos: (1032 to 1033) SpanInfo: {"start":1012,"length":18} + >console.log(nameA) + >:=> (line 29, col 4) to (line 29, col 22) +-------------------------------- +31 >for ([, [ + + ~~~~~~~~~~ => Pos: (1034 to 1043) SpanInfo: {"start":1048,"length":25} + >primarySkillA = "primary" + >:=> (line 32, col 4) to (line 32, col 29) +-------------------------------- +32 > primarySkillA = "primary", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1044 to 1074) SpanInfo: {"start":1048,"length":25} + >primarySkillA = "primary" + >:=> (line 32, col 4) to (line 32, col 29) +-------------------------------- +33 > secondarySkillA = "secondary" + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1075 to 1108) SpanInfo: {"start":1079,"length":29} + >secondarySkillA = "secondary" + >:=> (line 33, col 4) to (line 33, col 33) +-------------------------------- +34 >] = ["skill1", "skill2"]] of multiRobots) { + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1109 to 1132) SpanInfo: {"start":1079,"length":29} + >secondarySkillA = "secondary" + >:=> (line 33, col 4) to (line 33, col 33) +34 >] = ["skill1", "skill2"]] of multiRobots) { + + ~ => Pos: (1133 to 1133) SpanInfo: {"start":1042,"length":91} + >[ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + >] = ["skill1", "skill2"] + >:=> (line 31, col 8) to (line 34, col 24) +34 >] = ["skill1", "skill2"]] of multiRobots) { + + ~~~~~~~~~~~~~~~~~~~ => Pos: (1134 to 1152) SpanInfo: {"start":1138,"length":11} + >multiRobots + >:=> (line 34, col 29) to (line 34, col 40) +-------------------------------- +35 > console.log(primarySkillA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1153 to 1184) SpanInfo: {"start":1157,"length":26} + >console.log(primarySkillA) + >:=> (line 35, col 4) to (line 35, col 30) +-------------------------------- +36 >} + + ~~ => Pos: (1185 to 1186) SpanInfo: {"start":1157,"length":26} + >console.log(primarySkillA) + >:=> (line 35, col 4) to (line 35, col 30) +-------------------------------- +37 >for ([, [ + + ~~~~~~~~~~ => Pos: (1187 to 1196) SpanInfo: {"start":1201,"length":25} + >primarySkillA = "primary" + >:=> (line 38, col 4) to (line 38, col 29) +-------------------------------- +38 > primarySkillA = "primary", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1197 to 1227) SpanInfo: {"start":1201,"length":25} + >primarySkillA = "primary" + >:=> (line 38, col 4) to (line 38, col 29) +-------------------------------- +39 > secondarySkillA = "secondary" + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1228 to 1261) SpanInfo: {"start":1232,"length":29} + >secondarySkillA = "secondary" + >:=> (line 39, col 4) to (line 39, col 33) +-------------------------------- +40 >] = ["skill1", "skill2"]] of getMultiRobots()) { + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1262 to 1285) SpanInfo: {"start":1232,"length":29} + >secondarySkillA = "secondary" + >:=> (line 39, col 4) to (line 39, col 33) +40 >] = ["skill1", "skill2"]] of getMultiRobots()) { + + ~ => Pos: (1286 to 1286) SpanInfo: {"start":1195,"length":91} + >[ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + >] = ["skill1", "skill2"] + >:=> (line 37, col 8) to (line 40, col 24) +40 >] = ["skill1", "skill2"]] of getMultiRobots()) { + + ~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1287 to 1310) SpanInfo: {"start":1291,"length":16} + >getMultiRobots() + >:=> (line 40, col 29) to (line 40, col 45) +-------------------------------- +41 > console.log(primarySkillA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1311 to 1342) SpanInfo: {"start":1315,"length":26} + >console.log(primarySkillA) + >:=> (line 41, col 4) to (line 41, col 30) +-------------------------------- +42 >} + + ~~ => Pos: (1343 to 1344) SpanInfo: {"start":1315,"length":26} + >console.log(primarySkillA) + >:=> (line 41, col 4) to (line 41, col 30) +-------------------------------- +43 >for ([, [ + + ~~~~~~~~~~ => Pos: (1345 to 1354) SpanInfo: {"start":1359,"length":25} + >primarySkillA = "primary" + >:=> (line 44, col 4) to (line 44, col 29) +-------------------------------- +44 > primarySkillA = "primary", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1355 to 1385) SpanInfo: {"start":1359,"length":25} + >primarySkillA = "primary" + >:=> (line 44, col 4) to (line 44, col 29) +-------------------------------- +45 > secondarySkillA = "secondary" + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1386 to 1419) SpanInfo: {"start":1390,"length":29} + >secondarySkillA = "secondary" + >:=> (line 45, col 4) to (line 45, col 33) +-------------------------------- +46 >] = ["skill1", "skill2"]] of [multiRobotA, multiRobotB]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1420 to 1443) SpanInfo: {"start":1390,"length":29} + >secondarySkillA = "secondary" + >:=> (line 45, col 4) to (line 45, col 33) +46 >] = ["skill1", "skill2"]] of [multiRobotA, multiRobotB]) { + + ~ => Pos: (1444 to 1444) SpanInfo: {"start":1353,"length":91} + >[ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + >] = ["skill1", "skill2"] + >:=> (line 43, col 8) to (line 46, col 24) +46 >] = ["skill1", "skill2"]] of [multiRobotA, multiRobotB]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1445 to 1478) SpanInfo: {"start":1449,"length":26} + >[multiRobotA, multiRobotB] + >:=> (line 46, col 29) to (line 46, col 55) +-------------------------------- +47 > console.log(primarySkillA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1479 to 1510) SpanInfo: {"start":1483,"length":26} + >console.log(primarySkillA) + >:=> (line 47, col 4) to (line 47, col 30) +-------------------------------- +48 >} + + ~~ => Pos: (1511 to 1512) SpanInfo: {"start":1483,"length":26} + >console.log(primarySkillA) + >:=> (line 47, col 4) to (line 47, col 30) +-------------------------------- +49 >for ([numberB = -1] of robots) { + + ~~~~~~~~~~~~~~~~~~~ => Pos: (1513 to 1531) SpanInfo: {"start":1519,"length":12} + >numberB = -1 + >:=> (line 49, col 6) to (line 49, col 18) +49 >for ([numberB = -1] of robots) { + + ~~~~~~~~~~~~~~ => Pos: (1532 to 1545) SpanInfo: {"start":1536,"length":6} + >robots + >:=> (line 49, col 23) to (line 49, col 29) +-------------------------------- +50 > console.log(numberB); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1546 to 1571) SpanInfo: {"start":1550,"length":20} + >console.log(numberB) + >:=> (line 50, col 4) to (line 50, col 24) +-------------------------------- +51 >} + + ~~ => Pos: (1572 to 1573) SpanInfo: {"start":1550,"length":20} + >console.log(numberB) + >:=> (line 50, col 4) to (line 50, col 24) +-------------------------------- +52 >for ([numberB = -1] of getRobots()) { + + ~~~~~~~~~~~~~~~~~~~ => Pos: (1574 to 1592) SpanInfo: {"start":1580,"length":12} + >numberB = -1 + >:=> (line 52, col 6) to (line 52, col 18) +52 >for ([numberB = -1] of getRobots()) { + + ~~~~~~~~~~~~~~~~~~~ => Pos: (1593 to 1611) SpanInfo: {"start":1597,"length":11} + >getRobots() + >:=> (line 52, col 23) to (line 52, col 34) +-------------------------------- +53 > console.log(numberB); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1612 to 1637) SpanInfo: {"start":1616,"length":20} + >console.log(numberB) + >:=> (line 53, col 4) to (line 53, col 24) +-------------------------------- +54 >} + + ~~ => Pos: (1638 to 1639) SpanInfo: {"start":1616,"length":20} + >console.log(numberB) + >:=> (line 53, col 4) to (line 53, col 24) +-------------------------------- +55 >for ([numberB = -1] of [robotA, robotB]) { + + ~~~~~~~~~~~~~~~~~~~ => Pos: (1640 to 1658) SpanInfo: {"start":1646,"length":12} + >numberB = -1 + >:=> (line 55, col 6) to (line 55, col 18) +55 >for ([numberB = -1] of [robotA, robotB]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1659 to 1682) SpanInfo: {"start":1663,"length":16} + >[robotA, robotB] + >:=> (line 55, col 23) to (line 55, col 39) +-------------------------------- +56 > console.log(numberB); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1683 to 1708) SpanInfo: {"start":1687,"length":20} + >console.log(numberB) + >:=> (line 56, col 4) to (line 56, col 24) +-------------------------------- +57 >} + + ~~ => Pos: (1709 to 1710) SpanInfo: {"start":1687,"length":20} + >console.log(numberB) + >:=> (line 56, col 4) to (line 56, col 24) +-------------------------------- +58 >for ([nameB = "noName"] of multiRobots) { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1711 to 1733) SpanInfo: {"start":1717,"length":16} + >nameB = "noName" + >:=> (line 58, col 6) to (line 58, col 22) +58 >for ([nameB = "noName"] of multiRobots) { + + ~~~~~~~~~~~~~~~~~~~ => Pos: (1734 to 1752) SpanInfo: {"start":1738,"length":11} + >multiRobots + >:=> (line 58, col 27) to (line 58, col 38) +-------------------------------- +59 > console.log(nameB); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1753 to 1776) SpanInfo: {"start":1757,"length":18} + >console.log(nameB) + >:=> (line 59, col 4) to (line 59, col 22) +-------------------------------- +60 >} + + ~~ => Pos: (1777 to 1778) SpanInfo: {"start":1757,"length":18} + >console.log(nameB) + >:=> (line 59, col 4) to (line 59, col 22) +-------------------------------- +61 >for ([nameB = "noName"] of getMultiRobots()) { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1779 to 1801) SpanInfo: {"start":1785,"length":16} + >nameB = "noName" + >:=> (line 61, col 6) to (line 61, col 22) +61 >for ([nameB = "noName"] of getMultiRobots()) { + + ~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1802 to 1825) SpanInfo: {"start":1806,"length":16} + >getMultiRobots() + >:=> (line 61, col 27) to (line 61, col 43) +-------------------------------- +62 > console.log(nameB); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1826 to 1849) SpanInfo: {"start":1830,"length":18} + >console.log(nameB) + >:=> (line 62, col 4) to (line 62, col 22) +-------------------------------- +63 >} + + ~~ => Pos: (1850 to 1851) SpanInfo: {"start":1830,"length":18} + >console.log(nameB) + >:=> (line 62, col 4) to (line 62, col 22) +-------------------------------- +64 >for ([nameB = "noName"] of [multiRobotA, multiRobotB]) { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1852 to 1874) SpanInfo: {"start":1858,"length":16} + >nameB = "noName" + >:=> (line 64, col 6) to (line 64, col 22) +64 >for ([nameB = "noName"] of [multiRobotA, multiRobotB]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1875 to 1908) SpanInfo: {"start":1879,"length":26} + >[multiRobotA, multiRobotB] + >:=> (line 64, col 27) to (line 64, col 53) +-------------------------------- +65 > console.log(nameB); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1909 to 1932) SpanInfo: {"start":1913,"length":18} + >console.log(nameB) + >:=> (line 65, col 4) to (line 65, col 22) +-------------------------------- +66 >} + + ~~ => Pos: (1933 to 1934) SpanInfo: {"start":1913,"length":18} + >console.log(nameB) + >:=> (line 65, col 4) to (line 65, col 22) +-------------------------------- +67 >for ([numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of robots) { + + ~~~~~~~~~~~~~~~~~~~~ => Pos: (1935 to 1954) SpanInfo: {"start":1941,"length":13} + >numberA2 = -1 + >:=> (line 67, col 6) to (line 67, col 19) +67 >for ([numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of robots) { + + ~~~~~~~~~~~~~~~~~~~ => Pos: (1955 to 1973) SpanInfo: {"start":1956,"length":17} + >nameA2 = "noName" + >:=> (line 67, col 21) to (line 67, col 38) +67 >for ([numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of robots) { + + ~~~~~~~~~~~~~~~~~~~=> Pos: (1974 to 1992) SpanInfo: {"start":1975,"length":17} + >skillA2 = "skill" + >:=> (line 67, col 40) to (line 67, col 57) +67 >for ([numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of robots) { + + ~~~~~~~~~~~~~~=> Pos: (1993 to 2006) SpanInfo: {"start":1997,"length":6} + >robots + >:=> (line 67, col 62) to (line 67, col 68) +-------------------------------- +68 > console.log(nameA2); + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2007 to 2031) SpanInfo: {"start":2011,"length":19} + >console.log(nameA2) + >:=> (line 68, col 4) to (line 68, col 23) +-------------------------------- +69 >} + + ~~ => Pos: (2032 to 2033) SpanInfo: {"start":2011,"length":19} + >console.log(nameA2) + >:=> (line 68, col 4) to (line 68, col 23) +-------------------------------- +70 >for ([numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of getRobots()) { + + ~~~~~~~~~~~~~~~~~~~~ => Pos: (2034 to 2053) SpanInfo: {"start":2040,"length":13} + >numberA2 = -1 + >:=> (line 70, col 6) to (line 70, col 19) +70 >for ([numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of getRobots()) { + + ~~~~~~~~~~~~~~~~~~~ => Pos: (2054 to 2072) SpanInfo: {"start":2055,"length":17} + >nameA2 = "noName" + >:=> (line 70, col 21) to (line 70, col 38) +70 >for ([numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of getRobots()) { + + ~~~~~~~~~~~~~~~~~~~=> Pos: (2073 to 2091) SpanInfo: {"start":2074,"length":17} + >skillA2 = "skill" + >:=> (line 70, col 40) to (line 70, col 57) +70 >for ([numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of getRobots()) { + + ~~~~~~~~~~~~~~~~~~~=> Pos: (2092 to 2110) SpanInfo: {"start":2096,"length":11} + >getRobots() + >:=> (line 70, col 62) to (line 70, col 73) +-------------------------------- +71 > console.log(nameA2); + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2111 to 2135) SpanInfo: {"start":2115,"length":19} + >console.log(nameA2) + >:=> (line 71, col 4) to (line 71, col 23) +-------------------------------- +72 >} + + ~~ => Pos: (2136 to 2137) SpanInfo: {"start":2115,"length":19} + >console.log(nameA2) + >:=> (line 71, col 4) to (line 71, col 23) +-------------------------------- +73 >for ([numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of [robotA, robotB]) { + + ~~~~~~~~~~~~~~~~~~~~ => Pos: (2138 to 2157) SpanInfo: {"start":2144,"length":13} + >numberA2 = -1 + >:=> (line 73, col 6) to (line 73, col 19) +73 >for ([numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of [robotA, robotB]) { + + ~~~~~~~~~~~~~~~~~~~ => Pos: (2158 to 2176) SpanInfo: {"start":2159,"length":17} + >nameA2 = "noName" + >:=> (line 73, col 21) to (line 73, col 38) +73 >for ([numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of [robotA, robotB]) { + + ~~~~~~~~~~~~~~~~~~~=> Pos: (2177 to 2195) SpanInfo: {"start":2178,"length":17} + >skillA2 = "skill" + >:=> (line 73, col 40) to (line 73, col 57) +73 >for ([numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of [robotA, robotB]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (2196 to 2219) SpanInfo: {"start":2200,"length":16} + >[robotA, robotB] + >:=> (line 73, col 62) to (line 73, col 78) +-------------------------------- +74 > console.log(nameA2); + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2220 to 2244) SpanInfo: {"start":2224,"length":19} + >console.log(nameA2) + >:=> (line 74, col 4) to (line 74, col 23) +-------------------------------- +75 >} + + ~~ => Pos: (2245 to 2246) SpanInfo: {"start":2224,"length":19} + >console.log(nameA2) + >:=> (line 74, col 4) to (line 74, col 23) +-------------------------------- +76 >for ([nameMA = "noName", [ + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2247 to 2270) SpanInfo: {"start":2253,"length":17} + >nameMA = "noName" + >:=> (line 76, col 6) to (line 76, col 23) +76 >for ([nameMA = "noName", [ + + ~~~ => Pos: (2271 to 2273) SpanInfo: {"start":2278,"length":25} + >primarySkillA = "primary" + >:=> (line 77, col 4) to (line 77, col 29) +-------------------------------- +77 > primarySkillA = "primary", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2274 to 2304) SpanInfo: {"start":2278,"length":25} + >primarySkillA = "primary" + >:=> (line 77, col 4) to (line 77, col 29) +-------------------------------- +78 > secondarySkillA = "secondary" + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2305 to 2338) SpanInfo: {"start":2309,"length":29} + >secondarySkillA = "secondary" + >:=> (line 78, col 4) to (line 78, col 33) +-------------------------------- +79 >] = ["skill1", "skill2"]] of multiRobots) { + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2339 to 2362) SpanInfo: {"start":2309,"length":29} + >secondarySkillA = "secondary" + >:=> (line 78, col 4) to (line 78, col 33) +79 >] = ["skill1", "skill2"]] of multiRobots) { + + ~ => Pos: (2363 to 2363) SpanInfo: {"start":2272,"length":91} + >[ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + >] = ["skill1", "skill2"] + >:=> (line 76, col 25) to (line 79, col 24) +79 >] = ["skill1", "skill2"]] of multiRobots) { + + ~~~~~~~~~~~~~~~~~~~ => Pos: (2364 to 2382) SpanInfo: {"start":2368,"length":11} + >multiRobots + >:=> (line 79, col 29) to (line 79, col 40) +-------------------------------- +80 > console.log(nameMA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2383 to 2407) SpanInfo: {"start":2387,"length":19} + >console.log(nameMA) + >:=> (line 80, col 4) to (line 80, col 23) +-------------------------------- +81 >} + + ~~ => Pos: (2408 to 2409) SpanInfo: {"start":2387,"length":19} + >console.log(nameMA) + >:=> (line 80, col 4) to (line 80, col 23) +-------------------------------- +82 >for ([nameMA = "noName", [ + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2410 to 2433) SpanInfo: {"start":2416,"length":17} + >nameMA = "noName" + >:=> (line 82, col 6) to (line 82, col 23) +82 >for ([nameMA = "noName", [ + + ~~~ => Pos: (2434 to 2436) SpanInfo: {"start":2441,"length":25} + >primarySkillA = "primary" + >:=> (line 83, col 4) to (line 83, col 29) +-------------------------------- +83 > primarySkillA = "primary", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2437 to 2467) SpanInfo: {"start":2441,"length":25} + >primarySkillA = "primary" + >:=> (line 83, col 4) to (line 83, col 29) +-------------------------------- +84 > secondarySkillA = "secondary" + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2468 to 2501) SpanInfo: {"start":2472,"length":29} + >secondarySkillA = "secondary" + >:=> (line 84, col 4) to (line 84, col 33) +-------------------------------- +85 >] = ["skill1", "skill2"]] of getMultiRobots()) { + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2502 to 2525) SpanInfo: {"start":2472,"length":29} + >secondarySkillA = "secondary" + >:=> (line 84, col 4) to (line 84, col 33) +85 >] = ["skill1", "skill2"]] of getMultiRobots()) { + + ~ => Pos: (2526 to 2526) SpanInfo: {"start":2435,"length":91} + >[ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + >] = ["skill1", "skill2"] + >:=> (line 82, col 25) to (line 85, col 24) +85 >] = ["skill1", "skill2"]] of getMultiRobots()) { + + ~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (2527 to 2550) SpanInfo: {"start":2531,"length":16} + >getMultiRobots() + >:=> (line 85, col 29) to (line 85, col 45) +-------------------------------- +86 > console.log(nameMA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2551 to 2575) SpanInfo: {"start":2555,"length":19} + >console.log(nameMA) + >:=> (line 86, col 4) to (line 86, col 23) +-------------------------------- +87 >} + + ~~ => Pos: (2576 to 2577) SpanInfo: {"start":2555,"length":19} + >console.log(nameMA) + >:=> (line 86, col 4) to (line 86, col 23) +-------------------------------- +88 >for ([nameMA = "noName", [ + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2578 to 2601) SpanInfo: {"start":2584,"length":17} + >nameMA = "noName" + >:=> (line 88, col 6) to (line 88, col 23) +88 >for ([nameMA = "noName", [ + + ~~~ => Pos: (2602 to 2604) SpanInfo: {"start":2609,"length":25} + >primarySkillA = "primary" + >:=> (line 89, col 4) to (line 89, col 29) +-------------------------------- +89 > primarySkillA = "primary", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2605 to 2635) SpanInfo: {"start":2609,"length":25} + >primarySkillA = "primary" + >:=> (line 89, col 4) to (line 89, col 29) +-------------------------------- +90 > secondarySkillA = "secondary" + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2636 to 2669) SpanInfo: {"start":2640,"length":29} + >secondarySkillA = "secondary" + >:=> (line 90, col 4) to (line 90, col 33) +-------------------------------- +91 >] = ["skill1", "skill2"]] of [multiRobotA, multiRobotB]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2670 to 2693) SpanInfo: {"start":2640,"length":29} + >secondarySkillA = "secondary" + >:=> (line 90, col 4) to (line 90, col 33) +91 >] = ["skill1", "skill2"]] of [multiRobotA, multiRobotB]) { + + ~ => Pos: (2694 to 2694) SpanInfo: {"start":2603,"length":91} + >[ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + >] = ["skill1", "skill2"] + >:=> (line 88, col 25) to (line 91, col 24) +91 >] = ["skill1", "skill2"]] of [multiRobotA, multiRobotB]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (2695 to 2728) SpanInfo: {"start":2699,"length":26} + >[multiRobotA, multiRobotB] + >:=> (line 91, col 29) to (line 91, col 55) +-------------------------------- +92 > console.log(nameMA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2729 to 2753) SpanInfo: {"start":2733,"length":19} + >console.log(nameMA) + >:=> (line 92, col 4) to (line 92, col 23) +-------------------------------- +93 >} + + ~~ => Pos: (2754 to 2755) SpanInfo: {"start":2733,"length":19} + >console.log(nameMA) + >:=> (line 92, col 4) to (line 92, col 23) +-------------------------------- +94 >for ([numberA3 = -1, ...robotAInfo] of robots) { + + ~~~~~~~~~~~~~~~~~~~~ => Pos: (2756 to 2775) SpanInfo: {"start":2762,"length":13} + >numberA3 = -1 + >:=> (line 94, col 6) to (line 94, col 19) +94 >for ([numberA3 = -1, ...robotAInfo] of robots) { + + ~~~~~~~~~~~~~~~ => Pos: (2776 to 2790) SpanInfo: {"start":2777,"length":13} + >...robotAInfo + >:=> (line 94, col 21) to (line 94, col 34) +94 >for ([numberA3 = -1, ...robotAInfo] of robots) { + + ~~~~~~~~~~~~~~=> Pos: (2791 to 2804) SpanInfo: {"start":2795,"length":6} + >robots + >:=> (line 94, col 39) to (line 94, col 45) +-------------------------------- +95 > console.log(numberA3); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2805 to 2831) SpanInfo: {"start":2809,"length":21} + >console.log(numberA3) + >:=> (line 95, col 4) to (line 95, col 25) +-------------------------------- +96 >} + + ~~ => Pos: (2832 to 2833) SpanInfo: {"start":2809,"length":21} + >console.log(numberA3) + >:=> (line 95, col 4) to (line 95, col 25) +-------------------------------- +97 >for ([numberA3 = -1, ...robotAInfo] of getRobots()) { + + ~~~~~~~~~~~~~~~~~~~~ => Pos: (2834 to 2853) SpanInfo: {"start":2840,"length":13} + >numberA3 = -1 + >:=> (line 97, col 6) to (line 97, col 19) +97 >for ([numberA3 = -1, ...robotAInfo] of getRobots()) { + + ~~~~~~~~~~~~~~~ => Pos: (2854 to 2868) SpanInfo: {"start":2855,"length":13} + >...robotAInfo + >:=> (line 97, col 21) to (line 97, col 34) +97 >for ([numberA3 = -1, ...robotAInfo] of getRobots()) { + + ~~~~~~~~~~~~~~~~~~~=> Pos: (2869 to 2887) SpanInfo: {"start":2873,"length":11} + >getRobots() + >:=> (line 97, col 39) to (line 97, col 50) +-------------------------------- +98 > console.log(numberA3); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2888 to 2914) SpanInfo: {"start":2892,"length":21} + >console.log(numberA3) + >:=> (line 98, col 4) to (line 98, col 25) +-------------------------------- +99 >} + + ~~ => Pos: (2915 to 2916) SpanInfo: {"start":2892,"length":21} + >console.log(numberA3) + >:=> (line 98, col 4) to (line 98, col 25) +-------------------------------- +100>for ([numberA3 = -1, ...robotAInfo] of [robotA, robotB]) { + + ~~~~~~~~~~~~~~~~~~~~ => Pos: (2917 to 2936) SpanInfo: {"start":2923,"length":13} + >numberA3 = -1 + >:=> (line 100, col 6) to (line 100, col 19) +100>for ([numberA3 = -1, ...robotAInfo] of [robotA, robotB]) { + + ~~~~~~~~~~~~~~~ => Pos: (2937 to 2951) SpanInfo: {"start":2938,"length":13} + >...robotAInfo + >:=> (line 100, col 21) to (line 100, col 34) +100>for ([numberA3 = -1, ...robotAInfo] of [robotA, robotB]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (2952 to 2975) SpanInfo: {"start":2956,"length":16} + >[robotA, robotB] + >:=> (line 100, col 39) to (line 100, col 55) +-------------------------------- +101> console.log(numberA3); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2976 to 3002) SpanInfo: {"start":2980,"length":21} + >console.log(numberA3) + >:=> (line 101, col 4) to (line 101, col 25) +-------------------------------- +102>} + ~ => Pos: (3003 to 3003) SpanInfo: {"start":2980,"length":21} + >console.log(numberA3) + >:=> (line 101, col 4) to (line 101, col 25) \ No newline at end of file diff --git a/tests/baselines/reference/bpSpanDestructuringAssignmentForOfObjectBindingPattern.baseline b/tests/baselines/reference/bpSpanDestructuringAssignmentForOfObjectBindingPattern.baseline new file mode 100644 index 00000000000..b303f33026a --- /dev/null +++ b/tests/baselines/reference/bpSpanDestructuringAssignmentForOfObjectBindingPattern.baseline @@ -0,0 +1,943 @@ + +1 >declare var console: { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (0 to 22) SpanInfo: undefined +-------------------------------- +2 > log(msg: any): void; + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (23 to 47) SpanInfo: undefined +-------------------------------- +3 >} + + ~~ => Pos: (48 to 49) SpanInfo: undefined +-------------------------------- +4 >interface Robot { + + ~~~~~~~~~~~~~~~~~~ => Pos: (50 to 67) SpanInfo: undefined +-------------------------------- +5 > name: string; + + ~~~~~~~~~~~~~~~~~~ => Pos: (68 to 85) SpanInfo: undefined +-------------------------------- +6 > skill: string; + + ~~~~~~~~~~~~~~~~~~~ => Pos: (86 to 104) SpanInfo: undefined +-------------------------------- +7 >} + + ~~ => Pos: (105 to 106) SpanInfo: undefined +-------------------------------- +8 >interface MultiRobot { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (107 to 129) SpanInfo: undefined +-------------------------------- +9 > name: string; + + ~~~~~~~~~~~~~~~~~~ => Pos: (130 to 147) SpanInfo: undefined +-------------------------------- +10 > skills: { + + ~~~~~~~~~~~~~~ => Pos: (148 to 161) SpanInfo: undefined +-------------------------------- +11 > primary: string; + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (162 to 186) SpanInfo: undefined +-------------------------------- +12 > secondary: string; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (187 to 213) SpanInfo: undefined +-------------------------------- +13 > }; + + ~~~~~~~ => Pos: (214 to 220) SpanInfo: undefined +-------------------------------- +14 >} + + ~~ => Pos: (221 to 222) SpanInfo: undefined +-------------------------------- +15 >let robots: Robot[] = [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (223 to 322) SpanInfo: {"start":223,"length":98} + >let robots: Robot[] = [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }] + >:=> (line 15, col 0) to (line 15, col 98) +-------------------------------- +16 >let multiRobots: MultiRobot[] = [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (323 to 424) SpanInfo: {"start":323,"length":180} + >let multiRobots: MultiRobot[] = [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] + >:=> (line 16, col 0) to (line 17, col 78) +-------------------------------- +17 > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (425 to 504) SpanInfo: {"start":323,"length":180} + >let multiRobots: MultiRobot[] = [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] + >:=> (line 16, col 0) to (line 17, col 78) +-------------------------------- +18 >function getRobots() { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (505 to 527) SpanInfo: {"start":532,"length":13} + >return robots + >:=> (line 19, col 4) to (line 19, col 17) +-------------------------------- +19 > return robots; + + ~~~~~~~~~~~~~~~~~~~ => Pos: (528 to 546) SpanInfo: {"start":532,"length":13} + >return robots + >:=> (line 19, col 4) to (line 19, col 17) +-------------------------------- +20 >} + + ~~ => Pos: (547 to 548) SpanInfo: {"start":547,"length":1} + >} + >:=> (line 20, col 0) to (line 20, col 1) +-------------------------------- +21 >function getMultiRobots() { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (549 to 576) SpanInfo: {"start":581,"length":18} + >return multiRobots + >:=> (line 22, col 4) to (line 22, col 22) +-------------------------------- +22 > return multiRobots; + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (577 to 600) SpanInfo: {"start":581,"length":18} + >return multiRobots + >:=> (line 22, col 4) to (line 22, col 22) +-------------------------------- +23 >} + + ~~ => Pos: (601 to 602) SpanInfo: {"start":601,"length":1} + >} + >:=> (line 23, col 0) to (line 23, col 1) +-------------------------------- +24 >let nameA: string, primaryA: string, secondaryA: string, i: number, skillA: string; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (603 to 686) SpanInfo: undefined +-------------------------------- +25 >let name: string, primary: string, secondary: string, skill: string; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (687 to 755) SpanInfo: undefined +-------------------------------- +26 >for ({name: nameA } of robots) { + + ~~~~~~~~~~~~~~~~~~~ => Pos: (756 to 774) SpanInfo: {"start":762,"length":11} + >name: nameA + >:=> (line 26, col 6) to (line 26, col 17) +26 >for ({name: nameA } of robots) { + + ~~~~~~~~~~~~~~ => Pos: (775 to 788) SpanInfo: {"start":779,"length":6} + >robots + >:=> (line 26, col 23) to (line 26, col 29) +-------------------------------- +27 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (789 to 812) SpanInfo: {"start":793,"length":18} + >console.log(nameA) + >:=> (line 27, col 4) to (line 27, col 22) +-------------------------------- +28 >} + + ~~ => Pos: (813 to 814) SpanInfo: {"start":793,"length":18} + >console.log(nameA) + >:=> (line 27, col 4) to (line 27, col 22) +-------------------------------- +29 >for ({name: nameA } of getRobots()) { + + ~~~~~~~~~~~~~~~~~~~ => Pos: (815 to 833) SpanInfo: {"start":821,"length":11} + >name: nameA + >:=> (line 29, col 6) to (line 29, col 17) +29 >for ({name: nameA } of getRobots()) { + + ~~~~~~~~~~~~~~~~~~~ => Pos: (834 to 852) SpanInfo: {"start":838,"length":11} + >getRobots() + >:=> (line 29, col 23) to (line 29, col 34) +-------------------------------- +30 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (853 to 876) SpanInfo: {"start":857,"length":18} + >console.log(nameA) + >:=> (line 30, col 4) to (line 30, col 22) +-------------------------------- +31 >} + + ~~ => Pos: (877 to 878) SpanInfo: {"start":857,"length":18} + >console.log(nameA) + >:=> (line 30, col 4) to (line 30, col 22) +-------------------------------- +32 >for ({name: nameA } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { + + ~~~~~~~~~~~~~~~~~~~ => Pos: (879 to 897) SpanInfo: {"start":885,"length":11} + >name: nameA + >:=> (line 32, col 6) to (line 32, col 17) +32 >for ({name: nameA } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (898 to 981) SpanInfo: {"start":902,"length":76} + >[{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }] + >:=> (line 32, col 23) to (line 32, col 99) +-------------------------------- +33 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (982 to 1005) SpanInfo: {"start":986,"length":18} + >console.log(nameA) + >:=> (line 33, col 4) to (line 33, col 22) +-------------------------------- +34 >} + + ~~ => Pos: (1006 to 1007) SpanInfo: {"start":986,"length":18} + >console.log(nameA) + >:=> (line 33, col 4) to (line 33, col 22) +-------------------------------- +35 >for ({ skills: { primary: primaryA, secondary: secondaryA } } of multiRobots) { + + ~~~~~~~~~~~~~~ => Pos: (1008 to 1021) SpanInfo: {"start":1015,"length":52} + >skills: { primary: primaryA, secondary: secondaryA } + >:=> (line 35, col 7) to (line 35, col 59) +35 >for ({ skills: { primary: primaryA, secondary: secondaryA } } of multiRobots) { + + ~~~~~~~~~~~~~~~~~~~~~ => Pos: (1022 to 1042) SpanInfo: {"start":1025,"length":17} + >primary: primaryA + >:=> (line 35, col 17) to (line 35, col 34) +35 >for ({ skills: { primary: primaryA, secondary: secondaryA } } of multiRobots) { + + ~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1043 to 1066) SpanInfo: {"start":1044,"length":21} + >secondary: secondaryA + >:=> (line 35, col 36) to (line 35, col 57) +35 >for ({ skills: { primary: primaryA, secondary: secondaryA } } of multiRobots) { + + ~~=> Pos: (1067 to 1068) SpanInfo: {"start":1015,"length":52} + >skills: { primary: primaryA, secondary: secondaryA } + >:=> (line 35, col 7) to (line 35, col 59) +35 >for ({ skills: { primary: primaryA, secondary: secondaryA } } of multiRobots) { + + ~~~~~~~~~~~~~~~~~~~=> Pos: (1069 to 1087) SpanInfo: {"start":1073,"length":11} + >multiRobots + >:=> (line 35, col 65) to (line 35, col 76) +-------------------------------- +36 > console.log(primaryA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1088 to 1114) SpanInfo: {"start":1092,"length":21} + >console.log(primaryA) + >:=> (line 36, col 4) to (line 36, col 25) +-------------------------------- +37 >} + + ~~ => Pos: (1115 to 1116) SpanInfo: {"start":1092,"length":21} + >console.log(primaryA) + >:=> (line 36, col 4) to (line 36, col 25) +-------------------------------- +38 >for ({ skills: { primary: primaryA, secondary: secondaryA } } of getMultiRobots()) { + + ~~~~~~~~~~~~~~ => Pos: (1117 to 1130) SpanInfo: {"start":1124,"length":52} + >skills: { primary: primaryA, secondary: secondaryA } + >:=> (line 38, col 7) to (line 38, col 59) +38 >for ({ skills: { primary: primaryA, secondary: secondaryA } } of getMultiRobots()) { + + ~~~~~~~~~~~~~~~~~~~~~ => Pos: (1131 to 1151) SpanInfo: {"start":1134,"length":17} + >primary: primaryA + >:=> (line 38, col 17) to (line 38, col 34) +38 >for ({ skills: { primary: primaryA, secondary: secondaryA } } of getMultiRobots()) { + + ~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1152 to 1175) SpanInfo: {"start":1153,"length":21} + >secondary: secondaryA + >:=> (line 38, col 36) to (line 38, col 57) +38 >for ({ skills: { primary: primaryA, secondary: secondaryA } } of getMultiRobots()) { + + ~~=> Pos: (1176 to 1177) SpanInfo: {"start":1124,"length":52} + >skills: { primary: primaryA, secondary: secondaryA } + >:=> (line 38, col 7) to (line 38, col 59) +38 >for ({ skills: { primary: primaryA, secondary: secondaryA } } of getMultiRobots()) { + + ~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1178 to 1201) SpanInfo: {"start":1182,"length":16} + >getMultiRobots() + >:=> (line 38, col 65) to (line 38, col 81) +-------------------------------- +39 > console.log(primaryA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1202 to 1228) SpanInfo: {"start":1206,"length":21} + >console.log(primaryA) + >:=> (line 39, col 4) to (line 39, col 25) +-------------------------------- +40 >} + + ~~ => Pos: (1229 to 1230) SpanInfo: {"start":1206,"length":21} + >console.log(primaryA) + >:=> (line 39, col 4) to (line 39, col 25) +-------------------------------- +41 >for ({ skills: { primary: primaryA, secondary: secondaryA } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + + ~~~~~~~~~~~~~~ => Pos: (1231 to 1244) SpanInfo: {"start":1238,"length":52} + >skills: { primary: primaryA, secondary: secondaryA } + >:=> (line 41, col 7) to (line 41, col 59) +41 >for ({ skills: { primary: primaryA, secondary: secondaryA } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + + ~~~~~~~~~~~~~~~~~~~~~ => Pos: (1245 to 1265) SpanInfo: {"start":1248,"length":17} + >primary: primaryA + >:=> (line 41, col 17) to (line 41, col 34) +41 >for ({ skills: { primary: primaryA, secondary: secondaryA } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + + ~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1266 to 1289) SpanInfo: {"start":1267,"length":21} + >secondary: secondaryA + >:=> (line 41, col 36) to (line 41, col 57) +41 >for ({ skills: { primary: primaryA, secondary: secondaryA } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + + ~~=> Pos: (1290 to 1291) SpanInfo: {"start":1238,"length":52} + >skills: { primary: primaryA, secondary: secondaryA } + >:=> (line 41, col 7) to (line 41, col 59) +41 >for ({ skills: { primary: primaryA, secondary: secondaryA } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1292 to 1365) SpanInfo: {"start":1296,"length":148} + >[{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] + >:=> (line 41, col 65) to (line 42, col 78) +-------------------------------- +42 > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1366 to 1447) SpanInfo: {"start":1296,"length":148} + >[{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] + >:=> (line 41, col 65) to (line 42, col 78) +-------------------------------- +43 > console.log(primaryA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1448 to 1474) SpanInfo: {"start":1452,"length":21} + >console.log(primaryA) + >:=> (line 43, col 4) to (line 43, col 25) +-------------------------------- +44 >} + + ~~ => Pos: (1475 to 1476) SpanInfo: {"start":1452,"length":21} + >console.log(primaryA) + >:=> (line 43, col 4) to (line 43, col 25) +-------------------------------- +45 >for ({name } of robots) { + + ~~~~~~~~~~~~ => Pos: (1477 to 1488) SpanInfo: {"start":1483,"length":4} + >name + >:=> (line 45, col 6) to (line 45, col 10) +45 >for ({name } of robots) { + + ~~~~~~~~~~~~~~ => Pos: (1489 to 1502) SpanInfo: {"start":1493,"length":6} + >robots + >:=> (line 45, col 16) to (line 45, col 22) +-------------------------------- +46 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1503 to 1526) SpanInfo: {"start":1507,"length":18} + >console.log(nameA) + >:=> (line 46, col 4) to (line 46, col 22) +-------------------------------- +47 >} + + ~~ => Pos: (1527 to 1528) SpanInfo: {"start":1507,"length":18} + >console.log(nameA) + >:=> (line 46, col 4) to (line 46, col 22) +-------------------------------- +48 >for ({name } of getRobots()) { + + ~~~~~~~~~~~~ => Pos: (1529 to 1540) SpanInfo: {"start":1535,"length":4} + >name + >:=> (line 48, col 6) to (line 48, col 10) +48 >for ({name } of getRobots()) { + + ~~~~~~~~~~~~~~~~~~~ => Pos: (1541 to 1559) SpanInfo: {"start":1545,"length":11} + >getRobots() + >:=> (line 48, col 16) to (line 48, col 27) +-------------------------------- +49 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1560 to 1583) SpanInfo: {"start":1564,"length":18} + >console.log(nameA) + >:=> (line 49, col 4) to (line 49, col 22) +-------------------------------- +50 >} + + ~~ => Pos: (1584 to 1585) SpanInfo: {"start":1564,"length":18} + >console.log(nameA) + >:=> (line 49, col 4) to (line 49, col 22) +-------------------------------- +51 >for ({name } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { + + ~~~~~~~~~~~~ => Pos: (1586 to 1597) SpanInfo: {"start":1592,"length":4} + >name + >:=> (line 51, col 6) to (line 51, col 10) +51 >for ({name } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1598 to 1681) SpanInfo: {"start":1602,"length":76} + >[{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }] + >:=> (line 51, col 16) to (line 51, col 92) +-------------------------------- +52 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1682 to 1705) SpanInfo: {"start":1686,"length":18} + >console.log(nameA) + >:=> (line 52, col 4) to (line 52, col 22) +-------------------------------- +53 >} + + ~~ => Pos: (1706 to 1707) SpanInfo: {"start":1686,"length":18} + >console.log(nameA) + >:=> (line 52, col 4) to (line 52, col 22) +-------------------------------- +54 >for ({ skills: { primary, secondary } } of multiRobots) { + + ~~~~~~~~~~~~~~ => Pos: (1708 to 1721) SpanInfo: {"start":1715,"length":30} + >skills: { primary, secondary } + >:=> (line 54, col 7) to (line 54, col 37) +54 >for ({ skills: { primary, secondary } } of multiRobots) { + + ~~~~~~~~~~~ => Pos: (1722 to 1732) SpanInfo: {"start":1725,"length":7} + >primary + >:=> (line 54, col 17) to (line 54, col 24) +54 >for ({ skills: { primary, secondary } } of multiRobots) { + + ~~~~~~~~~~~~ => Pos: (1733 to 1744) SpanInfo: {"start":1734,"length":9} + >secondary + >:=> (line 54, col 26) to (line 54, col 35) +54 >for ({ skills: { primary, secondary } } of multiRobots) { + + ~~ => Pos: (1745 to 1746) SpanInfo: {"start":1715,"length":30} + >skills: { primary, secondary } + >:=> (line 54, col 7) to (line 54, col 37) +54 >for ({ skills: { primary, secondary } } of multiRobots) { + + ~~~~~~~~~~~~~~~~~~~=> Pos: (1747 to 1765) SpanInfo: {"start":1751,"length":11} + >multiRobots + >:=> (line 54, col 43) to (line 54, col 54) +-------------------------------- +55 > console.log(primaryA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1766 to 1792) SpanInfo: {"start":1770,"length":21} + >console.log(primaryA) + >:=> (line 55, col 4) to (line 55, col 25) +-------------------------------- +56 >} + + ~~ => Pos: (1793 to 1794) SpanInfo: {"start":1770,"length":21} + >console.log(primaryA) + >:=> (line 55, col 4) to (line 55, col 25) +-------------------------------- +57 >for ({ skills: { primary, secondary } } of getMultiRobots()) { + + ~~~~~~~~~~~~~~ => Pos: (1795 to 1808) SpanInfo: {"start":1802,"length":30} + >skills: { primary, secondary } + >:=> (line 57, col 7) to (line 57, col 37) +57 >for ({ skills: { primary, secondary } } of getMultiRobots()) { + + ~~~~~~~~~~~ => Pos: (1809 to 1819) SpanInfo: {"start":1812,"length":7} + >primary + >:=> (line 57, col 17) to (line 57, col 24) +57 >for ({ skills: { primary, secondary } } of getMultiRobots()) { + + ~~~~~~~~~~~~ => Pos: (1820 to 1831) SpanInfo: {"start":1821,"length":9} + >secondary + >:=> (line 57, col 26) to (line 57, col 35) +57 >for ({ skills: { primary, secondary } } of getMultiRobots()) { + + ~~ => Pos: (1832 to 1833) SpanInfo: {"start":1802,"length":30} + >skills: { primary, secondary } + >:=> (line 57, col 7) to (line 57, col 37) +57 >for ({ skills: { primary, secondary } } of getMultiRobots()) { + + ~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1834 to 1857) SpanInfo: {"start":1838,"length":16} + >getMultiRobots() + >:=> (line 57, col 43) to (line 57, col 59) +-------------------------------- +58 > console.log(primaryA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1858 to 1884) SpanInfo: {"start":1862,"length":21} + >console.log(primaryA) + >:=> (line 58, col 4) to (line 58, col 25) +-------------------------------- +59 >} + + ~~ => Pos: (1885 to 1886) SpanInfo: {"start":1862,"length":21} + >console.log(primaryA) + >:=> (line 58, col 4) to (line 58, col 25) +-------------------------------- +60 >for ({ skills: { primary, secondary } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + + ~~~~~~~~~~~~~~ => Pos: (1887 to 1900) SpanInfo: {"start":1894,"length":30} + >skills: { primary, secondary } + >:=> (line 60, col 7) to (line 60, col 37) +60 >for ({ skills: { primary, secondary } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + + ~~~~~~~~~~~ => Pos: (1901 to 1911) SpanInfo: {"start":1904,"length":7} + >primary + >:=> (line 60, col 17) to (line 60, col 24) +60 >for ({ skills: { primary, secondary } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + + ~~~~~~~~~~~~ => Pos: (1912 to 1923) SpanInfo: {"start":1913,"length":9} + >secondary + >:=> (line 60, col 26) to (line 60, col 35) +60 >for ({ skills: { primary, secondary } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + + ~~ => Pos: (1924 to 1925) SpanInfo: {"start":1894,"length":30} + >skills: { primary, secondary } + >:=> (line 60, col 7) to (line 60, col 37) +60 >for ({ skills: { primary, secondary } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1926 to 1999) SpanInfo: {"start":1930,"length":148} + >[{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] + >:=> (line 60, col 43) to (line 61, col 78) +-------------------------------- +61 > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (2000 to 2081) SpanInfo: {"start":1930,"length":148} + >[{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] + >:=> (line 60, col 43) to (line 61, col 78) +-------------------------------- +62 > console.log(primaryA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2082 to 2108) SpanInfo: {"start":2086,"length":21} + >console.log(primaryA) + >:=> (line 62, col 4) to (line 62, col 25) +-------------------------------- +63 >} + + ~~ => Pos: (2109 to 2110) SpanInfo: {"start":2086,"length":21} + >console.log(primaryA) + >:=> (line 62, col 4) to (line 62, col 25) +-------------------------------- +64 >for ({name: nameA, skill: skillA } of robots) { + + ~~~~~~~~~~~~~~~~~~ => Pos: (2111 to 2128) SpanInfo: {"start":2117,"length":11} + >name: nameA + >:=> (line 64, col 6) to (line 64, col 17) +64 >for ({name: nameA, skill: skillA } of robots) { + + ~~~~~~~~~~~~~~~~ => Pos: (2129 to 2144) SpanInfo: {"start":2130,"length":13} + >skill: skillA + >:=> (line 64, col 19) to (line 64, col 32) +64 >for ({name: nameA, skill: skillA } of robots) { + + ~~~~~~~~~~~~~~=> Pos: (2145 to 2158) SpanInfo: {"start":2149,"length":6} + >robots + >:=> (line 64, col 38) to (line 64, col 44) +-------------------------------- +65 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2159 to 2182) SpanInfo: {"start":2163,"length":18} + >console.log(nameA) + >:=> (line 65, col 4) to (line 65, col 22) +-------------------------------- +66 >} + + ~~ => Pos: (2183 to 2184) SpanInfo: {"start":2163,"length":18} + >console.log(nameA) + >:=> (line 65, col 4) to (line 65, col 22) +-------------------------------- +67 >for ({name: nameA, skill: skillA } of getRobots()) { + + ~~~~~~~~~~~~~~~~~~ => Pos: (2185 to 2202) SpanInfo: {"start":2191,"length":11} + >name: nameA + >:=> (line 67, col 6) to (line 67, col 17) +67 >for ({name: nameA, skill: skillA } of getRobots()) { + + ~~~~~~~~~~~~~~~~ => Pos: (2203 to 2218) SpanInfo: {"start":2204,"length":13} + >skill: skillA + >:=> (line 67, col 19) to (line 67, col 32) +67 >for ({name: nameA, skill: skillA } of getRobots()) { + + ~~~~~~~~~~~~~~~~~~~=> Pos: (2219 to 2237) SpanInfo: {"start":2223,"length":11} + >getRobots() + >:=> (line 67, col 38) to (line 67, col 49) +-------------------------------- +68 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2238 to 2261) SpanInfo: {"start":2242,"length":18} + >console.log(nameA) + >:=> (line 68, col 4) to (line 68, col 22) +-------------------------------- +69 >} + + ~~ => Pos: (2262 to 2263) SpanInfo: {"start":2242,"length":18} + >console.log(nameA) + >:=> (line 68, col 4) to (line 68, col 22) +-------------------------------- +70 >for ({name: nameA, skill: skillA } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { + + ~~~~~~~~~~~~~~~~~~ => Pos: (2264 to 2281) SpanInfo: {"start":2270,"length":11} + >name: nameA + >:=> (line 70, col 6) to (line 70, col 17) +70 >for ({name: nameA, skill: skillA } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { + + ~~~~~~~~~~~~~~~~ => Pos: (2282 to 2297) SpanInfo: {"start":2283,"length":13} + >skill: skillA + >:=> (line 70, col 19) to (line 70, col 32) +70 >for ({name: nameA, skill: skillA } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (2298 to 2381) SpanInfo: {"start":2302,"length":76} + >[{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }] + >:=> (line 70, col 38) to (line 70, col 114) +-------------------------------- +71 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2382 to 2405) SpanInfo: {"start":2386,"length":18} + >console.log(nameA) + >:=> (line 71, col 4) to (line 71, col 22) +-------------------------------- +72 >} + + ~~ => Pos: (2406 to 2407) SpanInfo: {"start":2386,"length":18} + >console.log(nameA) + >:=> (line 71, col 4) to (line 71, col 22) +-------------------------------- +73 >for ({name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of multiRobots) { + + ~~~~~~~~~~~~~~~~~~ => Pos: (2408 to 2425) SpanInfo: {"start":2414,"length":11} + >name: nameA + >:=> (line 73, col 6) to (line 73, col 17) +73 >for ({name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of multiRobots) { + + ~~~~~~~~ => Pos: (2426 to 2433) SpanInfo: {"start":2427,"length":52} + >skills: { primary: primaryA, secondary: secondaryA } + >:=> (line 73, col 19) to (line 73, col 71) +73 >for ({name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of multiRobots) { + + ~~~~~~~~~~~~~~~~~~~~~=> Pos: (2434 to 2454) SpanInfo: {"start":2437,"length":17} + >primary: primaryA + >:=> (line 73, col 29) to (line 73, col 46) +73 >for ({name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of multiRobots) { + + ~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (2455 to 2478) SpanInfo: {"start":2456,"length":21} + >secondary: secondaryA + >:=> (line 73, col 48) to (line 73, col 69) +73 >for ({name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of multiRobots) { + + ~~=> Pos: (2479 to 2480) SpanInfo: {"start":2427,"length":52} + >skills: { primary: primaryA, secondary: secondaryA } + >:=> (line 73, col 19) to (line 73, col 71) +73 >for ({name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of multiRobots) { + + ~~~~~~~~~~~~~~~~~~~=> Pos: (2481 to 2499) SpanInfo: {"start":2485,"length":11} + >multiRobots + >:=> (line 73, col 77) to (line 73, col 88) +-------------------------------- +74 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2500 to 2523) SpanInfo: {"start":2504,"length":18} + >console.log(nameA) + >:=> (line 74, col 4) to (line 74, col 22) +-------------------------------- +75 >} + + ~~ => Pos: (2524 to 2525) SpanInfo: {"start":2504,"length":18} + >console.log(nameA) + >:=> (line 74, col 4) to (line 74, col 22) +-------------------------------- +76 >for ({name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of getMultiRobots()) { + + ~~~~~~~~~~~~~~~~~~ => Pos: (2526 to 2543) SpanInfo: {"start":2532,"length":11} + >name: nameA + >:=> (line 76, col 6) to (line 76, col 17) +76 >for ({name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of getMultiRobots()) { + + ~~~~~~~~ => Pos: (2544 to 2551) SpanInfo: {"start":2545,"length":52} + >skills: { primary: primaryA, secondary: secondaryA } + >:=> (line 76, col 19) to (line 76, col 71) +76 >for ({name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of getMultiRobots()) { + + ~~~~~~~~~~~~~~~~~~~~~=> Pos: (2552 to 2572) SpanInfo: {"start":2555,"length":17} + >primary: primaryA + >:=> (line 76, col 29) to (line 76, col 46) +76 >for ({name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of getMultiRobots()) { + + ~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (2573 to 2596) SpanInfo: {"start":2574,"length":21} + >secondary: secondaryA + >:=> (line 76, col 48) to (line 76, col 69) +76 >for ({name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of getMultiRobots()) { + + ~~=> Pos: (2597 to 2598) SpanInfo: {"start":2545,"length":52} + >skills: { primary: primaryA, secondary: secondaryA } + >:=> (line 76, col 19) to (line 76, col 71) +76 >for ({name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of getMultiRobots()) { + + ~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (2599 to 2622) SpanInfo: {"start":2603,"length":16} + >getMultiRobots() + >:=> (line 76, col 77) to (line 76, col 93) +-------------------------------- +77 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2623 to 2646) SpanInfo: {"start":2627,"length":18} + >console.log(nameA) + >:=> (line 77, col 4) to (line 77, col 22) +-------------------------------- +78 >} + + ~~ => Pos: (2647 to 2648) SpanInfo: {"start":2627,"length":18} + >console.log(nameA) + >:=> (line 77, col 4) to (line 77, col 22) +-------------------------------- +79 >for ({name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + + ~~~~~~~~~~~~~~~~~~ => Pos: (2649 to 2666) SpanInfo: {"start":2655,"length":11} + >name: nameA + >:=> (line 79, col 6) to (line 79, col 17) +79 >for ({name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + + ~~~~~~~~ => Pos: (2667 to 2674) SpanInfo: {"start":2668,"length":52} + >skills: { primary: primaryA, secondary: secondaryA } + >:=> (line 79, col 19) to (line 79, col 71) +79 >for ({name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + + ~~~~~~~~~~~~~~~~~~~~~=> Pos: (2675 to 2695) SpanInfo: {"start":2678,"length":17} + >primary: primaryA + >:=> (line 79, col 29) to (line 79, col 46) +79 >for ({name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + + ~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (2696 to 2719) SpanInfo: {"start":2697,"length":21} + >secondary: secondaryA + >:=> (line 79, col 48) to (line 79, col 69) +79 >for ({name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + + ~~=> Pos: (2720 to 2721) SpanInfo: {"start":2668,"length":52} + >skills: { primary: primaryA, secondary: secondaryA } + >:=> (line 79, col 19) to (line 79, col 71) +79 >for ({name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (2722 to 2795) SpanInfo: {"start":2726,"length":148} + >[{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] + >:=> (line 79, col 77) to (line 80, col 78) +-------------------------------- +80 > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (2796 to 2877) SpanInfo: {"start":2726,"length":148} + >[{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] + >:=> (line 79, col 77) to (line 80, col 78) +-------------------------------- +81 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2878 to 2901) SpanInfo: {"start":2882,"length":18} + >console.log(nameA) + >:=> (line 81, col 4) to (line 81, col 22) +-------------------------------- +82 >} + + ~~ => Pos: (2902 to 2903) SpanInfo: {"start":2882,"length":18} + >console.log(nameA) + >:=> (line 81, col 4) to (line 81, col 22) +-------------------------------- +83 >for ({name, skill } of robots) { + + ~~~~~~~~~~~ => Pos: (2904 to 2914) SpanInfo: {"start":2910,"length":4} + >name + >:=> (line 83, col 6) to (line 83, col 10) +83 >for ({name, skill } of robots) { + + ~~~~~~~~ => Pos: (2915 to 2922) SpanInfo: {"start":2916,"length":5} + >skill + >:=> (line 83, col 12) to (line 83, col 17) +83 >for ({name, skill } of robots) { + + ~~~~~~~~~~~~~~ => Pos: (2923 to 2936) SpanInfo: {"start":2927,"length":6} + >robots + >:=> (line 83, col 23) to (line 83, col 29) +-------------------------------- +84 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2937 to 2960) SpanInfo: {"start":2941,"length":18} + >console.log(nameA) + >:=> (line 84, col 4) to (line 84, col 22) +-------------------------------- +85 >} + + ~~ => Pos: (2961 to 2962) SpanInfo: {"start":2941,"length":18} + >console.log(nameA) + >:=> (line 84, col 4) to (line 84, col 22) +-------------------------------- +86 >for ({name, skill } of getRobots()) { + + ~~~~~~~~~~~ => Pos: (2963 to 2973) SpanInfo: {"start":2969,"length":4} + >name + >:=> (line 86, col 6) to (line 86, col 10) +86 >for ({name, skill } of getRobots()) { + + ~~~~~~~~ => Pos: (2974 to 2981) SpanInfo: {"start":2975,"length":5} + >skill + >:=> (line 86, col 12) to (line 86, col 17) +86 >for ({name, skill } of getRobots()) { + + ~~~~~~~~~~~~~~~~~~~ => Pos: (2982 to 3000) SpanInfo: {"start":2986,"length":11} + >getRobots() + >:=> (line 86, col 23) to (line 86, col 34) +-------------------------------- +87 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (3001 to 3024) SpanInfo: {"start":3005,"length":18} + >console.log(nameA) + >:=> (line 87, col 4) to (line 87, col 22) +-------------------------------- +88 >} + + ~~ => Pos: (3025 to 3026) SpanInfo: {"start":3005,"length":18} + >console.log(nameA) + >:=> (line 87, col 4) to (line 87, col 22) +-------------------------------- +89 >for ({name, skill } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { + + ~~~~~~~~~~~ => Pos: (3027 to 3037) SpanInfo: {"start":3033,"length":4} + >name + >:=> (line 89, col 6) to (line 89, col 10) +89 >for ({name, skill } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { + + ~~~~~~~~ => Pos: (3038 to 3045) SpanInfo: {"start":3039,"length":5} + >skill + >:=> (line 89, col 12) to (line 89, col 17) +89 >for ({name, skill } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (3046 to 3129) SpanInfo: {"start":3050,"length":76} + >[{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }] + >:=> (line 89, col 23) to (line 89, col 99) +-------------------------------- +90 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (3130 to 3153) SpanInfo: {"start":3134,"length":18} + >console.log(nameA) + >:=> (line 90, col 4) to (line 90, col 22) +-------------------------------- +91 >} + + ~~ => Pos: (3154 to 3155) SpanInfo: {"start":3134,"length":18} + >console.log(nameA) + >:=> (line 90, col 4) to (line 90, col 22) +-------------------------------- +92 >for ({name, skills: { primary, secondary } } of multiRobots) { + + ~~~~~~~~~~~ => Pos: (3156 to 3166) SpanInfo: {"start":3162,"length":4} + >name + >:=> (line 92, col 6) to (line 92, col 10) +92 >for ({name, skills: { primary, secondary } } of multiRobots) { + + ~~~~~~~~ => Pos: (3167 to 3174) SpanInfo: {"start":3168,"length":30} + >skills: { primary, secondary } + >:=> (line 92, col 12) to (line 92, col 42) +92 >for ({name, skills: { primary, secondary } } of multiRobots) { + + ~~~~~~~~~~~ => Pos: (3175 to 3185) SpanInfo: {"start":3178,"length":7} + >primary + >:=> (line 92, col 22) to (line 92, col 29) +92 >for ({name, skills: { primary, secondary } } of multiRobots) { + + ~~~~~~~~~~~~ => Pos: (3186 to 3197) SpanInfo: {"start":3187,"length":9} + >secondary + >:=> (line 92, col 31) to (line 92, col 40) +92 >for ({name, skills: { primary, secondary } } of multiRobots) { + + ~~ => Pos: (3198 to 3199) SpanInfo: {"start":3168,"length":30} + >skills: { primary, secondary } + >:=> (line 92, col 12) to (line 92, col 42) +92 >for ({name, skills: { primary, secondary } } of multiRobots) { + + ~~~~~~~~~~~~~~~~~~~=> Pos: (3200 to 3218) SpanInfo: {"start":3204,"length":11} + >multiRobots + >:=> (line 92, col 48) to (line 92, col 59) +-------------------------------- +93 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (3219 to 3242) SpanInfo: {"start":3223,"length":18} + >console.log(nameA) + >:=> (line 93, col 4) to (line 93, col 22) +-------------------------------- +94 >} + + ~~ => Pos: (3243 to 3244) SpanInfo: {"start":3223,"length":18} + >console.log(nameA) + >:=> (line 93, col 4) to (line 93, col 22) +-------------------------------- +95 >for ({name, skills: { primary, secondary } } of getMultiRobots()) { + + ~~~~~~~~~~~ => Pos: (3245 to 3255) SpanInfo: {"start":3251,"length":4} + >name + >:=> (line 95, col 6) to (line 95, col 10) +95 >for ({name, skills: { primary, secondary } } of getMultiRobots()) { + + ~~~~~~~~ => Pos: (3256 to 3263) SpanInfo: {"start":3257,"length":30} + >skills: { primary, secondary } + >:=> (line 95, col 12) to (line 95, col 42) +95 >for ({name, skills: { primary, secondary } } of getMultiRobots()) { + + ~~~~~~~~~~~ => Pos: (3264 to 3274) SpanInfo: {"start":3267,"length":7} + >primary + >:=> (line 95, col 22) to (line 95, col 29) +95 >for ({name, skills: { primary, secondary } } of getMultiRobots()) { + + ~~~~~~~~~~~~ => Pos: (3275 to 3286) SpanInfo: {"start":3276,"length":9} + >secondary + >:=> (line 95, col 31) to (line 95, col 40) +95 >for ({name, skills: { primary, secondary } } of getMultiRobots()) { + + ~~ => Pos: (3287 to 3288) SpanInfo: {"start":3257,"length":30} + >skills: { primary, secondary } + >:=> (line 95, col 12) to (line 95, col 42) +95 >for ({name, skills: { primary, secondary } } of getMultiRobots()) { + + ~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (3289 to 3312) SpanInfo: {"start":3293,"length":16} + >getMultiRobots() + >:=> (line 95, col 48) to (line 95, col 64) +-------------------------------- +96 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (3313 to 3336) SpanInfo: {"start":3317,"length":18} + >console.log(nameA) + >:=> (line 96, col 4) to (line 96, col 22) +-------------------------------- +97 >} + + ~~ => Pos: (3337 to 3338) SpanInfo: {"start":3317,"length":18} + >console.log(nameA) + >:=> (line 96, col 4) to (line 96, col 22) +-------------------------------- +98 >for ({name, skills: { primary, secondary } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + + ~~~~~~~~~~~ => Pos: (3339 to 3349) SpanInfo: {"start":3345,"length":4} + >name + >:=> (line 98, col 6) to (line 98, col 10) +98 >for ({name, skills: { primary, secondary } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + + ~~~~~~~~ => Pos: (3350 to 3357) SpanInfo: {"start":3351,"length":30} + >skills: { primary, secondary } + >:=> (line 98, col 12) to (line 98, col 42) +98 >for ({name, skills: { primary, secondary } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + + ~~~~~~~~~~~ => Pos: (3358 to 3368) SpanInfo: {"start":3361,"length":7} + >primary + >:=> (line 98, col 22) to (line 98, col 29) +98 >for ({name, skills: { primary, secondary } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + + ~~~~~~~~~~~~ => Pos: (3369 to 3380) SpanInfo: {"start":3370,"length":9} + >secondary + >:=> (line 98, col 31) to (line 98, col 40) +98 >for ({name, skills: { primary, secondary } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + + ~~ => Pos: (3381 to 3382) SpanInfo: {"start":3351,"length":30} + >skills: { primary, secondary } + >:=> (line 98, col 12) to (line 98, col 42) +98 >for ({name, skills: { primary, secondary } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (3383 to 3456) SpanInfo: {"start":3387,"length":148} + >[{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] + >:=> (line 98, col 48) to (line 99, col 78) +-------------------------------- +99 > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (3457 to 3538) SpanInfo: {"start":3387,"length":148} + >[{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] + >:=> (line 98, col 48) to (line 99, col 78) +-------------------------------- +100> console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (3539 to 3562) SpanInfo: {"start":3543,"length":18} + >console.log(nameA) + >:=> (line 100, col 4) to (line 100, col 22) +-------------------------------- +101>} + ~ => Pos: (3563 to 3563) SpanInfo: {"start":3543,"length":18} + >console.log(nameA) + >:=> (line 100, col 4) to (line 100, col 22) \ No newline at end of file diff --git a/tests/baselines/reference/bpSpanDestructuringAssignmentForOfObjectBindingPatternDefaultValues.baseline b/tests/baselines/reference/bpSpanDestructuringAssignmentForOfObjectBindingPatternDefaultValues.baseline new file mode 100644 index 00000000000..18a0ebdca34 --- /dev/null +++ b/tests/baselines/reference/bpSpanDestructuringAssignmentForOfObjectBindingPatternDefaultValues.baseline @@ -0,0 +1,1223 @@ + +1 >declare var console: { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (0 to 22) SpanInfo: undefined +-------------------------------- +2 > log(msg: any): void; + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (23 to 47) SpanInfo: undefined +-------------------------------- +3 >} + + ~~ => Pos: (48 to 49) SpanInfo: undefined +-------------------------------- +4 >interface Robot { + + ~~~~~~~~~~~~~~~~~~ => Pos: (50 to 67) SpanInfo: undefined +-------------------------------- +5 > name: string; + + ~~~~~~~~~~~~~~~~~~ => Pos: (68 to 85) SpanInfo: undefined +-------------------------------- +6 > skill: string; + + ~~~~~~~~~~~~~~~~~~~ => Pos: (86 to 104) SpanInfo: undefined +-------------------------------- +7 >} + + ~~ => Pos: (105 to 106) SpanInfo: undefined +-------------------------------- +8 >interface MultiRobot { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (107 to 129) SpanInfo: undefined +-------------------------------- +9 > name: string; + + ~~~~~~~~~~~~~~~~~~ => Pos: (130 to 147) SpanInfo: undefined +-------------------------------- +10 > skills: { + + ~~~~~~~~~~~~~~ => Pos: (148 to 161) SpanInfo: undefined +-------------------------------- +11 > primary: string; + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (162 to 186) SpanInfo: undefined +-------------------------------- +12 > secondary: string; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (187 to 213) SpanInfo: undefined +-------------------------------- +13 > }; + + ~~~~~~~ => Pos: (214 to 220) SpanInfo: undefined +-------------------------------- +14 >} + + ~~ => Pos: (221 to 222) SpanInfo: undefined +-------------------------------- +15 >let robots: Robot[] = [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (223 to 322) SpanInfo: {"start":223,"length":98} + >let robots: Robot[] = [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }] + >:=> (line 15, col 0) to (line 15, col 98) +-------------------------------- +16 >let multiRobots: MultiRobot[] = [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (323 to 424) SpanInfo: {"start":323,"length":180} + >let multiRobots: MultiRobot[] = [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] + >:=> (line 16, col 0) to (line 17, col 78) +-------------------------------- +17 > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (425 to 504) SpanInfo: {"start":323,"length":180} + >let multiRobots: MultiRobot[] = [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] + >:=> (line 16, col 0) to (line 17, col 78) +-------------------------------- +18 >function getRobots() { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (505 to 527) SpanInfo: {"start":532,"length":13} + >return robots + >:=> (line 19, col 4) to (line 19, col 17) +-------------------------------- +19 > return robots; + + ~~~~~~~~~~~~~~~~~~~ => Pos: (528 to 546) SpanInfo: {"start":532,"length":13} + >return robots + >:=> (line 19, col 4) to (line 19, col 17) +-------------------------------- +20 >} + + ~~ => Pos: (547 to 548) SpanInfo: {"start":547,"length":1} + >} + >:=> (line 20, col 0) to (line 20, col 1) +-------------------------------- +21 >function getMultiRobots() { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (549 to 576) SpanInfo: {"start":581,"length":18} + >return multiRobots + >:=> (line 22, col 4) to (line 22, col 22) +-------------------------------- +22 > return multiRobots; + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (577 to 600) SpanInfo: {"start":581,"length":18} + >return multiRobots + >:=> (line 22, col 4) to (line 22, col 22) +-------------------------------- +23 >} + + ~~ => Pos: (601 to 602) SpanInfo: {"start":601,"length":1} + >} + >:=> (line 23, col 0) to (line 23, col 1) +-------------------------------- +24 >let nameA: string, primaryA: string, secondaryA: string, i: number, skillA: string; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (603 to 686) SpanInfo: undefined +-------------------------------- +25 >let name: string, primary: string, secondary: string, skill: string; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (687 to 755) SpanInfo: undefined +-------------------------------- +26 >for ({name: nameA = "noName" } of robots) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (756 to 785) SpanInfo: {"start":762,"length":22} + >name: nameA = "noName" + >:=> (line 26, col 6) to (line 26, col 28) +26 >for ({name: nameA = "noName" } of robots) { + + ~~~~~~~~~~~~~~ => Pos: (786 to 799) SpanInfo: {"start":790,"length":6} + >robots + >:=> (line 26, col 34) to (line 26, col 40) +-------------------------------- +27 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (800 to 823) SpanInfo: {"start":804,"length":18} + >console.log(nameA) + >:=> (line 27, col 4) to (line 27, col 22) +-------------------------------- +28 >} + + ~~ => Pos: (824 to 825) SpanInfo: {"start":804,"length":18} + >console.log(nameA) + >:=> (line 27, col 4) to (line 27, col 22) +-------------------------------- +29 >for ({name: nameA = "noName" } of getRobots()) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (826 to 855) SpanInfo: {"start":832,"length":22} + >name: nameA = "noName" + >:=> (line 29, col 6) to (line 29, col 28) +29 >for ({name: nameA = "noName" } of getRobots()) { + + ~~~~~~~~~~~~~~~~~~~=> Pos: (856 to 874) SpanInfo: {"start":860,"length":11} + >getRobots() + >:=> (line 29, col 34) to (line 29, col 45) +-------------------------------- +30 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (875 to 898) SpanInfo: {"start":879,"length":18} + >console.log(nameA) + >:=> (line 30, col 4) to (line 30, col 22) +-------------------------------- +31 >} + + ~~ => Pos: (899 to 900) SpanInfo: {"start":879,"length":18} + >console.log(nameA) + >:=> (line 30, col 4) to (line 30, col 22) +-------------------------------- +32 >for ({name: nameA = "noName" } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (901 to 930) SpanInfo: {"start":907,"length":22} + >name: nameA = "noName" + >:=> (line 32, col 6) to (line 32, col 28) +32 >for ({name: nameA = "noName" } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (931 to 1014) SpanInfo: {"start":935,"length":76} + >[{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }] + >:=> (line 32, col 34) to (line 32, col 110) +-------------------------------- +33 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1015 to 1038) SpanInfo: {"start":1019,"length":18} + >console.log(nameA) + >:=> (line 33, col 4) to (line 33, col 22) +-------------------------------- +34 >} + + ~~ => Pos: (1039 to 1040) SpanInfo: {"start":1019,"length":18} + >console.log(nameA) + >:=> (line 33, col 4) to (line 33, col 22) +-------------------------------- +35 >for ({ skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = + + ~~~~~~~~~~~~~~ => Pos: (1041 to 1054) SpanInfo: {"start":1048,"length":129} + >skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = + > { primary: "nosKill", secondary: "noSkill" } + >:=> (line 35, col 7) to (line 36, col 48) +35 >for ({ skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1055 to 1087) SpanInfo: {"start":1058,"length":29} + >primary: primaryA = "primary" + >:=> (line 35, col 17) to (line 35, col 46) +35 >for ({ skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1088 to 1128) SpanInfo: {"start":1089,"length":35} + >secondary: secondaryA = "secondary" + >:=> (line 35, col 48) to (line 35, col 83) +-------------------------------- +36 > { primary: "nosKill", secondary: "noSkill" } } of multiRobots) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1129 to 1176) SpanInfo: {"start":1089,"length":35} + >secondary: secondaryA = "secondary" + >:=> (line 35, col 48) to (line 35, col 83) +36 > { primary: "nosKill", secondary: "noSkill" } } of multiRobots) { + + ~~=> Pos: (1177 to 1178) SpanInfo: {"start":1048,"length":129} + >skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = + > { primary: "nosKill", secondary: "noSkill" } + >:=> (line 35, col 7) to (line 36, col 48) +36 > { primary: "nosKill", secondary: "noSkill" } } of multiRobots) { + + ~~~~~~~~~~~~~~~~~~~=> Pos: (1179 to 1197) SpanInfo: {"start":1183,"length":11} + >multiRobots + >:=> (line 36, col 54) to (line 36, col 65) +-------------------------------- +37 > console.log(primaryA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1198 to 1224) SpanInfo: {"start":1202,"length":21} + >console.log(primaryA) + >:=> (line 37, col 4) to (line 37, col 25) +-------------------------------- +38 >} + + ~~ => Pos: (1225 to 1226) SpanInfo: {"start":1202,"length":21} + >console.log(primaryA) + >:=> (line 37, col 4) to (line 37, col 25) +-------------------------------- +39 >for ({ skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = + + ~~~~~~~~~~~~~~ => Pos: (1227 to 1240) SpanInfo: {"start":1234,"length":129} + >skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = + > { primary: "nosKill", secondary: "noSkill" } + >:=> (line 39, col 7) to (line 40, col 48) +39 >for ({ skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1241 to 1273) SpanInfo: {"start":1244,"length":29} + >primary: primaryA = "primary" + >:=> (line 39, col 17) to (line 39, col 46) +39 >for ({ skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1274 to 1314) SpanInfo: {"start":1275,"length":35} + >secondary: secondaryA = "secondary" + >:=> (line 39, col 48) to (line 39, col 83) +-------------------------------- +40 > { primary: "nosKill", secondary: "noSkill" } } of getMultiRobots()) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1315 to 1362) SpanInfo: {"start":1275,"length":35} + >secondary: secondaryA = "secondary" + >:=> (line 39, col 48) to (line 39, col 83) +40 > { primary: "nosKill", secondary: "noSkill" } } of getMultiRobots()) { + + ~~=> Pos: (1363 to 1364) SpanInfo: {"start":1234,"length":129} + >skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = + > { primary: "nosKill", secondary: "noSkill" } + >:=> (line 39, col 7) to (line 40, col 48) +40 > { primary: "nosKill", secondary: "noSkill" } } of getMultiRobots()) { + + ~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1365 to 1388) SpanInfo: {"start":1369,"length":16} + >getMultiRobots() + >:=> (line 40, col 54) to (line 40, col 70) +-------------------------------- +41 > console.log(primaryA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1389 to 1415) SpanInfo: {"start":1393,"length":21} + >console.log(primaryA) + >:=> (line 41, col 4) to (line 41, col 25) +-------------------------------- +42 >} + + ~~ => Pos: (1416 to 1417) SpanInfo: {"start":1393,"length":21} + >console.log(primaryA) + >:=> (line 41, col 4) to (line 41, col 25) +-------------------------------- +43 >for ({ skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = + + ~~~~~~~~~~~~~~ => Pos: (1418 to 1431) SpanInfo: {"start":1425,"length":129} + >skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = + > { primary: "nosKill", secondary: "noSkill" } + >:=> (line 43, col 7) to (line 44, col 48) +43 >for ({ skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1432 to 1464) SpanInfo: {"start":1435,"length":29} + >primary: primaryA = "primary" + >:=> (line 43, col 17) to (line 43, col 46) +43 >for ({ skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1465 to 1505) SpanInfo: {"start":1466,"length":35} + >secondary: secondaryA = "secondary" + >:=> (line 43, col 48) to (line 43, col 83) +-------------------------------- +44 > { primary: "nosKill", secondary: "noSkill" } } of + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1506 to 1553) SpanInfo: {"start":1466,"length":35} + >secondary: secondaryA = "secondary" + >:=> (line 43, col 48) to (line 43, col 83) +44 > { primary: "nosKill", secondary: "noSkill" } } of + + ~~=> Pos: (1554 to 1555) SpanInfo: {"start":1425,"length":129} + >skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = + > { primary: "nosKill", secondary: "noSkill" } + >:=> (line 43, col 7) to (line 44, col 48) +44 > { primary: "nosKill", secondary: "noSkill" } } of + + ~~~~=> Pos: (1556 to 1559) SpanInfo: {"start":1564,"length":166} + >[{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] + >:=> (line 45, col 4) to (line 46, col 82) +-------------------------------- +45 > [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1560 to 1647) SpanInfo: {"start":1564,"length":166} + >[{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] + >:=> (line 45, col 4) to (line 46, col 82) +-------------------------------- +46 > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1648 to 1733) SpanInfo: {"start":1564,"length":166} + >[{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] + >:=> (line 45, col 4) to (line 46, col 82) +-------------------------------- +47 > console.log(primaryA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1734 to 1760) SpanInfo: {"start":1738,"length":21} + >console.log(primaryA) + >:=> (line 47, col 4) to (line 47, col 25) +-------------------------------- +48 >} + + ~~ => Pos: (1761 to 1762) SpanInfo: {"start":1738,"length":21} + >console.log(primaryA) + >:=> (line 47, col 4) to (line 47, col 25) +-------------------------------- +49 >for ({ name = "noName" } of robots) { + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1763 to 1786) SpanInfo: {"start":1770,"length":15} + >name = "noName" + >:=> (line 49, col 7) to (line 49, col 22) +49 >for ({ name = "noName" } of robots) { + + ~~~~~~~~~~~~~~ => Pos: (1787 to 1800) SpanInfo: {"start":1791,"length":6} + >robots + >:=> (line 49, col 28) to (line 49, col 34) +-------------------------------- +50 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1801 to 1824) SpanInfo: {"start":1805,"length":18} + >console.log(nameA) + >:=> (line 50, col 4) to (line 50, col 22) +-------------------------------- +51 >} + + ~~ => Pos: (1825 to 1826) SpanInfo: {"start":1805,"length":18} + >console.log(nameA) + >:=> (line 50, col 4) to (line 50, col 22) +-------------------------------- +52 >for ({ name = "noName" } of getRobots()) { + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1827 to 1850) SpanInfo: {"start":1834,"length":15} + >name = "noName" + >:=> (line 52, col 7) to (line 52, col 22) +52 >for ({ name = "noName" } of getRobots()) { + + ~~~~~~~~~~~~~~~~~~~ => Pos: (1851 to 1869) SpanInfo: {"start":1855,"length":11} + >getRobots() + >:=> (line 52, col 28) to (line 52, col 39) +-------------------------------- +53 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1870 to 1893) SpanInfo: {"start":1874,"length":18} + >console.log(nameA) + >:=> (line 53, col 4) to (line 53, col 22) +-------------------------------- +54 >} + + ~~ => Pos: (1894 to 1895) SpanInfo: {"start":1874,"length":18} + >console.log(nameA) + >:=> (line 53, col 4) to (line 53, col 22) +-------------------------------- +55 >for ({ name = "noName" } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1896 to 1919) SpanInfo: {"start":1903,"length":15} + >name = "noName" + >:=> (line 55, col 7) to (line 55, col 22) +55 >for ({ name = "noName" } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1920 to 2003) SpanInfo: {"start":1924,"length":76} + >[{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }] + >:=> (line 55, col 28) to (line 55, col 104) +-------------------------------- +56 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2004 to 2027) SpanInfo: {"start":2008,"length":18} + >console.log(nameA) + >:=> (line 56, col 4) to (line 56, col 22) +-------------------------------- +57 >} + + ~~ => Pos: (2028 to 2029) SpanInfo: {"start":2008,"length":18} + >console.log(nameA) + >:=> (line 56, col 4) to (line 56, col 22) +-------------------------------- +58 >for ({ + + ~~~~~~~ => Pos: (2030 to 2036) SpanInfo: {"start":2041,"length":123} + >skills: { + > primary = "primary", + > secondary = "secondary" + > } = { primary: "noSkill", secondary: "noSkill" } + >:=> (line 59, col 4) to (line 62, col 52) +-------------------------------- +59 > skills: { + + ~~~~~~~~~~~ => Pos: (2037 to 2047) SpanInfo: {"start":2041,"length":123} + >skills: { + > primary = "primary", + > secondary = "secondary" + > } = { primary: "noSkill", secondary: "noSkill" } + >:=> (line 59, col 4) to (line 62, col 52) +59 > skills: { + + ~~~ => Pos: (2048 to 2050) SpanInfo: {"start":2059,"length":19} + >primary = "primary" + >:=> (line 60, col 8) to (line 60, col 27) +-------------------------------- +60 > primary = "primary", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2051 to 2079) SpanInfo: {"start":2059,"length":19} + >primary = "primary" + >:=> (line 60, col 8) to (line 60, col 27) +-------------------------------- +61 > secondary = "secondary" + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2080 to 2111) SpanInfo: {"start":2088,"length":23} + >secondary = "secondary" + >:=> (line 61, col 8) to (line 61, col 31) +-------------------------------- +62 > } = { primary: "noSkill", secondary: "noSkill" } + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (2112 to 2164) SpanInfo: {"start":2088,"length":23} + >secondary = "secondary" + >:=> (line 61, col 8) to (line 61, col 31) +-------------------------------- +63 >} of multiRobots) { + + ~ => Pos: (2165 to 2165) SpanInfo: {"start":2041,"length":123} + >skills: { + > primary = "primary", + > secondary = "secondary" + > } = { primary: "noSkill", secondary: "noSkill" } + >:=> (line 59, col 4) to (line 62, col 52) +63 >} of multiRobots) { + + ~~~~~~~~~~~~~~~~~~~ => Pos: (2166 to 2184) SpanInfo: {"start":2170,"length":11} + >multiRobots + >:=> (line 63, col 5) to (line 63, col 16) +-------------------------------- +64 > console.log(primaryA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2185 to 2211) SpanInfo: {"start":2189,"length":21} + >console.log(primaryA) + >:=> (line 64, col 4) to (line 64, col 25) +-------------------------------- +65 >} + + ~~ => Pos: (2212 to 2213) SpanInfo: {"start":2189,"length":21} + >console.log(primaryA) + >:=> (line 64, col 4) to (line 64, col 25) +-------------------------------- +66 >for ({ + + ~~~~~~~ => Pos: (2214 to 2220) SpanInfo: {"start":2225,"length":123} + >skills: { + > primary = "primary", + > secondary = "secondary" + > } = { primary: "noSkill", secondary: "noSkill" } + >:=> (line 67, col 4) to (line 70, col 52) +-------------------------------- +67 > skills: { + + ~~~~~~~~~~~ => Pos: (2221 to 2231) SpanInfo: {"start":2225,"length":123} + >skills: { + > primary = "primary", + > secondary = "secondary" + > } = { primary: "noSkill", secondary: "noSkill" } + >:=> (line 67, col 4) to (line 70, col 52) +67 > skills: { + + ~~~ => Pos: (2232 to 2234) SpanInfo: {"start":2243,"length":19} + >primary = "primary" + >:=> (line 68, col 8) to (line 68, col 27) +-------------------------------- +68 > primary = "primary", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2235 to 2263) SpanInfo: {"start":2243,"length":19} + >primary = "primary" + >:=> (line 68, col 8) to (line 68, col 27) +-------------------------------- +69 > secondary = "secondary" + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2264 to 2295) SpanInfo: {"start":2272,"length":23} + >secondary = "secondary" + >:=> (line 69, col 8) to (line 69, col 31) +-------------------------------- +70 > } = { primary: "noSkill", secondary: "noSkill" } + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (2296 to 2348) SpanInfo: {"start":2272,"length":23} + >secondary = "secondary" + >:=> (line 69, col 8) to (line 69, col 31) +-------------------------------- +71 >} of getMultiRobots()) { + + ~ => Pos: (2349 to 2349) SpanInfo: {"start":2225,"length":123} + >skills: { + > primary = "primary", + > secondary = "secondary" + > } = { primary: "noSkill", secondary: "noSkill" } + >:=> (line 67, col 4) to (line 70, col 52) +71 >} of getMultiRobots()) { + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2350 to 2373) SpanInfo: {"start":2354,"length":16} + >getMultiRobots() + >:=> (line 71, col 5) to (line 71, col 21) +-------------------------------- +72 > console.log(primaryA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2374 to 2400) SpanInfo: {"start":2378,"length":21} + >console.log(primaryA) + >:=> (line 72, col 4) to (line 72, col 25) +-------------------------------- +73 >} + + ~~ => Pos: (2401 to 2402) SpanInfo: {"start":2378,"length":21} + >console.log(primaryA) + >:=> (line 72, col 4) to (line 72, col 25) +-------------------------------- +74 >for ({ + + ~~~~~~~ => Pos: (2403 to 2409) SpanInfo: {"start":2414,"length":123} + >skills: { + > primary = "primary", + > secondary = "secondary" + > } = { primary: "noSkill", secondary: "noSkill" } + >:=> (line 75, col 4) to (line 78, col 52) +-------------------------------- +75 > skills: { + + ~~~~~~~~~~~ => Pos: (2410 to 2420) SpanInfo: {"start":2414,"length":123} + >skills: { + > primary = "primary", + > secondary = "secondary" + > } = { primary: "noSkill", secondary: "noSkill" } + >:=> (line 75, col 4) to (line 78, col 52) +75 > skills: { + + ~~~ => Pos: (2421 to 2423) SpanInfo: {"start":2432,"length":19} + >primary = "primary" + >:=> (line 76, col 8) to (line 76, col 27) +-------------------------------- +76 > primary = "primary", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2424 to 2452) SpanInfo: {"start":2432,"length":19} + >primary = "primary" + >:=> (line 76, col 8) to (line 76, col 27) +-------------------------------- +77 > secondary = "secondary" + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2453 to 2484) SpanInfo: {"start":2461,"length":23} + >secondary = "secondary" + >:=> (line 77, col 8) to (line 77, col 31) +-------------------------------- +78 > } = { primary: "noSkill", secondary: "noSkill" } + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (2485 to 2537) SpanInfo: {"start":2461,"length":23} + >secondary = "secondary" + >:=> (line 77, col 8) to (line 77, col 31) +-------------------------------- +79 >} of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + + ~ => Pos: (2538 to 2538) SpanInfo: {"start":2414,"length":123} + >skills: { + > primary = "primary", + > secondary = "secondary" + > } = { primary: "noSkill", secondary: "noSkill" } + >:=> (line 75, col 4) to (line 78, col 52) +79 >} of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (2539 to 2612) SpanInfo: {"start":2543,"length":148} + >[{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] + >:=> (line 79, col 5) to (line 80, col 78) +-------------------------------- +80 > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (2613 to 2694) SpanInfo: {"start":2543,"length":148} + >[{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] + >:=> (line 79, col 5) to (line 80, col 78) +-------------------------------- +81 > console.log(primaryA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2695 to 2721) SpanInfo: {"start":2699,"length":21} + >console.log(primaryA) + >:=> (line 81, col 4) to (line 81, col 25) +-------------------------------- +82 >} + + ~~ => Pos: (2722 to 2723) SpanInfo: {"start":2699,"length":21} + >console.log(primaryA) + >:=> (line 81, col 4) to (line 81, col 25) +-------------------------------- +83 >for ({name: nameA = "noName", skill: skillA = "noSkill" } of robots) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2724 to 2752) SpanInfo: {"start":2730,"length":22} + >name: nameA = "noName" + >:=> (line 83, col 6) to (line 83, col 28) +83 >for ({name: nameA = "noName", skill: skillA = "noSkill" } of robots) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (2753 to 2780) SpanInfo: {"start":2754,"length":25} + >skill: skillA = "noSkill" + >:=> (line 83, col 30) to (line 83, col 55) +83 >for ({name: nameA = "noName", skill: skillA = "noSkill" } of robots) { + + ~~~~~~~~~~~~~~=> Pos: (2781 to 2794) SpanInfo: {"start":2785,"length":6} + >robots + >:=> (line 83, col 61) to (line 83, col 67) +-------------------------------- +84 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2795 to 2818) SpanInfo: {"start":2799,"length":18} + >console.log(nameA) + >:=> (line 84, col 4) to (line 84, col 22) +-------------------------------- +85 >} + + ~~ => Pos: (2819 to 2820) SpanInfo: {"start":2799,"length":18} + >console.log(nameA) + >:=> (line 84, col 4) to (line 84, col 22) +-------------------------------- +86 >for ({name: nameA = "noName", skill: skillA = "noSkill" } of getRobots()) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2821 to 2849) SpanInfo: {"start":2827,"length":22} + >name: nameA = "noName" + >:=> (line 86, col 6) to (line 86, col 28) +86 >for ({name: nameA = "noName", skill: skillA = "noSkill" } of getRobots()) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (2850 to 2878) SpanInfo: {"start":2851,"length":25} + >skill: skillA = "noSkill" + >:=> (line 86, col 30) to (line 86, col 55) +86 >for ({name: nameA = "noName", skill: skillA = "noSkill" } of getRobots()) { + + ~~~~~~~~~~~~~~~~~~~=> Pos: (2879 to 2897) SpanInfo: {"start":2883,"length":11} + >getRobots() + >:=> (line 86, col 62) to (line 86, col 73) +-------------------------------- +87 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2898 to 2921) SpanInfo: {"start":2902,"length":18} + >console.log(nameA) + >:=> (line 87, col 4) to (line 87, col 22) +-------------------------------- +88 >} + + ~~ => Pos: (2922 to 2923) SpanInfo: {"start":2902,"length":18} + >console.log(nameA) + >:=> (line 87, col 4) to (line 87, col 22) +-------------------------------- +89 >for ({name: nameA = "noName", skill: skillA = "noSkill" } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2924 to 2952) SpanInfo: {"start":2930,"length":22} + >name: nameA = "noName" + >:=> (line 89, col 6) to (line 89, col 28) +89 >for ({name: nameA = "noName", skill: skillA = "noSkill" } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (2953 to 2981) SpanInfo: {"start":2954,"length":25} + >skill: skillA = "noSkill" + >:=> (line 89, col 30) to (line 89, col 55) +89 >for ({name: nameA = "noName", skill: skillA = "noSkill" } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (2982 to 3065) SpanInfo: {"start":2986,"length":76} + >[{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }] + >:=> (line 89, col 62) to (line 89, col 138) +-------------------------------- +90 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (3066 to 3089) SpanInfo: {"start":3070,"length":18} + >console.log(nameA) + >:=> (line 90, col 4) to (line 90, col 22) +-------------------------------- +91 >} + + ~~ => Pos: (3090 to 3091) SpanInfo: {"start":3070,"length":18} + >console.log(nameA) + >:=> (line 90, col 4) to (line 90, col 22) +-------------------------------- +92 >for ({ + + ~~~~~~~ => Pos: (3092 to 3098) SpanInfo: {"start":3103,"length":22} + >name: nameA = "noName" + >:=> (line 93, col 4) to (line 93, col 26) +-------------------------------- +93 > name: nameA = "noName", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (3099 to 3126) SpanInfo: {"start":3103,"length":22} + >name: nameA = "noName" + >:=> (line 93, col 4) to (line 93, col 26) +-------------------------------- +94 > skills: { + + ~~~~~~~~~~~ => Pos: (3127 to 3137) SpanInfo: {"start":3131,"length":145} + >skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "noSkill", secondary: "noSkill" } + >:=> (line 94, col 4) to (line 97, col 52) +94 > skills: { + + ~~~ => Pos: (3138 to 3140) SpanInfo: {"start":3149,"length":29} + >primary: primaryA = "primary" + >:=> (line 95, col 8) to (line 95, col 37) +-------------------------------- +95 > primary: primaryA = "primary", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (3141 to 3179) SpanInfo: {"start":3149,"length":29} + >primary: primaryA = "primary" + >:=> (line 95, col 8) to (line 95, col 37) +-------------------------------- +96 > secondary: secondaryA = "secondary" + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (3180 to 3223) SpanInfo: {"start":3188,"length":35} + >secondary: secondaryA = "secondary" + >:=> (line 96, col 8) to (line 96, col 43) +-------------------------------- +97 > } = { primary: "noSkill", secondary: "noSkill" } + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (3224 to 3276) SpanInfo: {"start":3188,"length":35} + >secondary: secondaryA = "secondary" + >:=> (line 96, col 8) to (line 96, col 43) +-------------------------------- +98 >} of multiRobots) { + + ~ => Pos: (3277 to 3277) SpanInfo: {"start":3131,"length":145} + >skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "noSkill", secondary: "noSkill" } + >:=> (line 94, col 4) to (line 97, col 52) +98 >} of multiRobots) { + + ~~~~~~~~~~~~~~~~~~~ => Pos: (3278 to 3296) SpanInfo: {"start":3282,"length":11} + >multiRobots + >:=> (line 98, col 5) to (line 98, col 16) +-------------------------------- +99 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (3297 to 3320) SpanInfo: {"start":3301,"length":18} + >console.log(nameA) + >:=> (line 99, col 4) to (line 99, col 22) +-------------------------------- +100>} + + ~~ => Pos: (3321 to 3322) SpanInfo: {"start":3301,"length":18} + >console.log(nameA) + >:=> (line 99, col 4) to (line 99, col 22) +-------------------------------- +101>for ({ + + ~~~~~~~ => Pos: (3323 to 3329) SpanInfo: {"start":3334,"length":22} + >name: nameA = "noName" + >:=> (line 102, col 4) to (line 102, col 26) +-------------------------------- +102> name: nameA = "noName", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (3330 to 3357) SpanInfo: {"start":3334,"length":22} + >name: nameA = "noName" + >:=> (line 102, col 4) to (line 102, col 26) +-------------------------------- +103> skills: { + + ~~~~~~~~~~~ => Pos: (3358 to 3368) SpanInfo: {"start":3362,"length":145} + >skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "noSkill", secondary: "noSkill" } + >:=> (line 103, col 4) to (line 106, col 52) +103> skills: { + + ~~~ => Pos: (3369 to 3371) SpanInfo: {"start":3380,"length":29} + >primary: primaryA = "primary" + >:=> (line 104, col 8) to (line 104, col 37) +-------------------------------- +104> primary: primaryA = "primary", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (3372 to 3410) SpanInfo: {"start":3380,"length":29} + >primary: primaryA = "primary" + >:=> (line 104, col 8) to (line 104, col 37) +-------------------------------- +105> secondary: secondaryA = "secondary" + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (3411 to 3454) SpanInfo: {"start":3419,"length":35} + >secondary: secondaryA = "secondary" + >:=> (line 105, col 8) to (line 105, col 43) +-------------------------------- +106> } = { primary: "noSkill", secondary: "noSkill" } + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (3455 to 3507) SpanInfo: {"start":3419,"length":35} + >secondary: secondaryA = "secondary" + >:=> (line 105, col 8) to (line 105, col 43) +-------------------------------- +107>} of getMultiRobots()) { + + ~ => Pos: (3508 to 3508) SpanInfo: {"start":3362,"length":145} + >skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "noSkill", secondary: "noSkill" } + >:=> (line 103, col 4) to (line 106, col 52) +107>} of getMultiRobots()) { + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (3509 to 3532) SpanInfo: {"start":3513,"length":16} + >getMultiRobots() + >:=> (line 107, col 5) to (line 107, col 21) +-------------------------------- +108> console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (3533 to 3556) SpanInfo: {"start":3537,"length":18} + >console.log(nameA) + >:=> (line 108, col 4) to (line 108, col 22) +-------------------------------- +109>} + + ~~ => Pos: (3557 to 3558) SpanInfo: {"start":3537,"length":18} + >console.log(nameA) + >:=> (line 108, col 4) to (line 108, col 22) +-------------------------------- +110>for ({ + + ~~~~~~~ => Pos: (3559 to 3565) SpanInfo: {"start":3570,"length":22} + >name: nameA = "noName" + >:=> (line 111, col 4) to (line 111, col 26) +-------------------------------- +111> name: nameA = "noName", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (3566 to 3593) SpanInfo: {"start":3570,"length":22} + >name: nameA = "noName" + >:=> (line 111, col 4) to (line 111, col 26) +-------------------------------- +112> skills: { + + ~~~~~~~~~~~ => Pos: (3594 to 3604) SpanInfo: {"start":3598,"length":145} + >skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "noSkill", secondary: "noSkill" } + >:=> (line 112, col 4) to (line 115, col 52) +112> skills: { + + ~~~ => Pos: (3605 to 3607) SpanInfo: {"start":3616,"length":29} + >primary: primaryA = "primary" + >:=> (line 113, col 8) to (line 113, col 37) +-------------------------------- +113> primary: primaryA = "primary", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (3608 to 3646) SpanInfo: {"start":3616,"length":29} + >primary: primaryA = "primary" + >:=> (line 113, col 8) to (line 113, col 37) +-------------------------------- +114> secondary: secondaryA = "secondary" + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (3647 to 3690) SpanInfo: {"start":3655,"length":35} + >secondary: secondaryA = "secondary" + >:=> (line 114, col 8) to (line 114, col 43) +-------------------------------- +115> } = { primary: "noSkill", secondary: "noSkill" } + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (3691 to 3743) SpanInfo: {"start":3655,"length":35} + >secondary: secondaryA = "secondary" + >:=> (line 114, col 8) to (line 114, col 43) +-------------------------------- +116>} of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + + ~ => Pos: (3744 to 3744) SpanInfo: {"start":3598,"length":145} + >skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "noSkill", secondary: "noSkill" } + >:=> (line 112, col 4) to (line 115, col 52) +116>} of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (3745 to 3832) SpanInfo: {"start":3749,"length":162} + >[{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] + >:=> (line 116, col 5) to (line 117, col 78) +-------------------------------- +117> { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (3833 to 3914) SpanInfo: {"start":3749,"length":162} + >[{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] + >:=> (line 116, col 5) to (line 117, col 78) +-------------------------------- +118> console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (3915 to 3938) SpanInfo: {"start":3919,"length":18} + >console.log(nameA) + >:=> (line 118, col 4) to (line 118, col 22) +-------------------------------- +119>} + + ~~ => Pos: (3939 to 3940) SpanInfo: {"start":3919,"length":18} + >console.log(nameA) + >:=> (line 118, col 4) to (line 118, col 22) +-------------------------------- +120>for ({ name = "noName", skill = "noSkill" } of robots) { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (3941 to 3963) SpanInfo: {"start":3948,"length":15} + >name = "noName" + >:=> (line 120, col 7) to (line 120, col 22) +120>for ({ name = "noName", skill = "noSkill" } of robots) { + + ~~~~~~~~~~~~~~~~~~~~~ => Pos: (3964 to 3984) SpanInfo: {"start":3965,"length":18} + >skill = "noSkill" + >:=> (line 120, col 24) to (line 120, col 42) +120>for ({ name = "noName", skill = "noSkill" } of robots) { + + ~~~~~~~~~~~~~~=> Pos: (3985 to 3998) SpanInfo: {"start":3989,"length":6} + >robots + >:=> (line 120, col 48) to (line 120, col 54) +-------------------------------- +121> console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (3999 to 4022) SpanInfo: {"start":4003,"length":18} + >console.log(nameA) + >:=> (line 121, col 4) to (line 121, col 22) +-------------------------------- +122>} + + ~~ => Pos: (4023 to 4024) SpanInfo: {"start":4003,"length":18} + >console.log(nameA) + >:=> (line 121, col 4) to (line 121, col 22) +-------------------------------- +123>for ({ name = "noName", skill = "noSkill" } of getRobots()) { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (4025 to 4047) SpanInfo: {"start":4032,"length":15} + >name = "noName" + >:=> (line 123, col 7) to (line 123, col 22) +123>for ({ name = "noName", skill = "noSkill" } of getRobots()) { + + ~~~~~~~~~~~~~~~~~~~~~ => Pos: (4048 to 4068) SpanInfo: {"start":4049,"length":17} + >skill = "noSkill" + >:=> (line 123, col 24) to (line 123, col 41) +123>for ({ name = "noName", skill = "noSkill" } of getRobots()) { + + ~~~~~~~~~~~~~~~~~~~=> Pos: (4069 to 4087) SpanInfo: {"start":4073,"length":11} + >getRobots() + >:=> (line 123, col 48) to (line 123, col 59) +-------------------------------- +124> console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (4088 to 4111) SpanInfo: {"start":4092,"length":18} + >console.log(nameA) + >:=> (line 124, col 4) to (line 124, col 22) +-------------------------------- +125>} + + ~~ => Pos: (4112 to 4113) SpanInfo: {"start":4092,"length":18} + >console.log(nameA) + >:=> (line 124, col 4) to (line 124, col 22) +-------------------------------- +126>for ({ name = "noName", skill = "noSkill" } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (4114 to 4136) SpanInfo: {"start":4121,"length":15} + >name = "noName" + >:=> (line 126, col 7) to (line 126, col 22) +126>for ({ name = "noName", skill = "noSkill" } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { + + ~~~~~~~~~~~~~~~~~~~~~ => Pos: (4137 to 4157) SpanInfo: {"start":4138,"length":18} + >skill = "noSkill" + >:=> (line 126, col 24) to (line 126, col 42) +126>for ({ name = "noName", skill = "noSkill" } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (4158 to 4241) SpanInfo: {"start":4162,"length":76} + >[{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }] + >:=> (line 126, col 48) to (line 126, col 124) +-------------------------------- +127> console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (4242 to 4265) SpanInfo: {"start":4246,"length":18} + >console.log(nameA) + >:=> (line 127, col 4) to (line 127, col 22) +-------------------------------- +128>} + + ~~ => Pos: (4266 to 4267) SpanInfo: {"start":4246,"length":18} + >console.log(nameA) + >:=> (line 127, col 4) to (line 127, col 22) +-------------------------------- +129>for ({ + + ~~~~~~~ => Pos: (4268 to 4274) SpanInfo: {"start":4279,"length":15} + >name = "noName" + >:=> (line 130, col 4) to (line 130, col 19) +-------------------------------- +130> name = "noName", + + ~~~~~~~~~~~~~~~~~~~~~ => Pos: (4275 to 4295) SpanInfo: {"start":4279,"length":15} + >name = "noName" + >:=> (line 130, col 4) to (line 130, col 19) +-------------------------------- +131> skills: { + + ~~~~~~~~~~~ => Pos: (4296 to 4306) SpanInfo: {"start":4300,"length":123} + >skills: { + > primary = "primary", + > secondary = "secondary" + > } = { primary: "noSkill", secondary: "noSkill" } + >:=> (line 131, col 4) to (line 134, col 52) +131> skills: { + + ~~~ => Pos: (4307 to 4309) SpanInfo: {"start":4318,"length":19} + >primary = "primary" + >:=> (line 132, col 8) to (line 132, col 27) +-------------------------------- +132> primary = "primary", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (4310 to 4338) SpanInfo: {"start":4318,"length":19} + >primary = "primary" + >:=> (line 132, col 8) to (line 132, col 27) +-------------------------------- +133> secondary = "secondary" + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (4339 to 4370) SpanInfo: {"start":4347,"length":23} + >secondary = "secondary" + >:=> (line 133, col 8) to (line 133, col 31) +-------------------------------- +134> } = { primary: "noSkill", secondary: "noSkill" } + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (4371 to 4423) SpanInfo: {"start":4347,"length":23} + >secondary = "secondary" + >:=> (line 133, col 8) to (line 133, col 31) +-------------------------------- +135>} of multiRobots) { + + ~ => Pos: (4424 to 4424) SpanInfo: {"start":4300,"length":123} + >skills: { + > primary = "primary", + > secondary = "secondary" + > } = { primary: "noSkill", secondary: "noSkill" } + >:=> (line 131, col 4) to (line 134, col 52) +135>} of multiRobots) { + + ~~~~~~~~~~~~~~~~~~~ => Pos: (4425 to 4443) SpanInfo: {"start":4429,"length":11} + >multiRobots + >:=> (line 135, col 5) to (line 135, col 16) +-------------------------------- +136> console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (4444 to 4467) SpanInfo: {"start":4448,"length":18} + >console.log(nameA) + >:=> (line 136, col 4) to (line 136, col 22) +-------------------------------- +137>} + + ~~ => Pos: (4468 to 4469) SpanInfo: {"start":4448,"length":18} + >console.log(nameA) + >:=> (line 136, col 4) to (line 136, col 22) +-------------------------------- +138>for ({ + + ~~~~~~~ => Pos: (4470 to 4476) SpanInfo: {"start":4481,"length":15} + >name = "noName" + >:=> (line 139, col 4) to (line 139, col 19) +-------------------------------- +139> name = "noName", + + ~~~~~~~~~~~~~~~~~~~~~ => Pos: (4477 to 4497) SpanInfo: {"start":4481,"length":15} + >name = "noName" + >:=> (line 139, col 4) to (line 139, col 19) +-------------------------------- +140> skills: { + + ~~~~~~~~~~~ => Pos: (4498 to 4508) SpanInfo: {"start":4502,"length":123} + >skills: { + > primary = "primary", + > secondary = "secondary" + > } = { primary: "noSkill", secondary: "noSkill" } + >:=> (line 140, col 4) to (line 143, col 52) +140> skills: { + + ~~~ => Pos: (4509 to 4511) SpanInfo: {"start":4520,"length":19} + >primary = "primary" + >:=> (line 141, col 8) to (line 141, col 27) +-------------------------------- +141> primary = "primary", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (4512 to 4540) SpanInfo: {"start":4520,"length":19} + >primary = "primary" + >:=> (line 141, col 8) to (line 141, col 27) +-------------------------------- +142> secondary = "secondary" + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (4541 to 4572) SpanInfo: {"start":4549,"length":23} + >secondary = "secondary" + >:=> (line 142, col 8) to (line 142, col 31) +-------------------------------- +143> } = { primary: "noSkill", secondary: "noSkill" } + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (4573 to 4625) SpanInfo: {"start":4549,"length":23} + >secondary = "secondary" + >:=> (line 142, col 8) to (line 142, col 31) +-------------------------------- +144>} of getMultiRobots()) { + + ~ => Pos: (4626 to 4626) SpanInfo: {"start":4502,"length":123} + >skills: { + > primary = "primary", + > secondary = "secondary" + > } = { primary: "noSkill", secondary: "noSkill" } + >:=> (line 140, col 4) to (line 143, col 52) +144>} of getMultiRobots()) { + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (4627 to 4650) SpanInfo: {"start":4631,"length":16} + >getMultiRobots() + >:=> (line 144, col 5) to (line 144, col 21) +-------------------------------- +145> console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (4651 to 4674) SpanInfo: {"start":4655,"length":18} + >console.log(nameA) + >:=> (line 145, col 4) to (line 145, col 22) +-------------------------------- +146>} + + ~~ => Pos: (4675 to 4676) SpanInfo: {"start":4655,"length":18} + >console.log(nameA) + >:=> (line 145, col 4) to (line 145, col 22) +-------------------------------- +147>for ({ + + ~~~~~~~ => Pos: (4677 to 4683) SpanInfo: {"start":4688,"length":15} + >name = "noName" + >:=> (line 148, col 4) to (line 148, col 19) +-------------------------------- +148> name = "noName", + + ~~~~~~~~~~~~~~~~~~~~~ => Pos: (4684 to 4704) SpanInfo: {"start":4688,"length":15} + >name = "noName" + >:=> (line 148, col 4) to (line 148, col 19) +-------------------------------- +149> skills: { + + ~~~~~~~~~~~ => Pos: (4705 to 4715) SpanInfo: {"start":4709,"length":123} + >skills: { + > primary = "primary", + > secondary = "secondary" + > } = { primary: "noSkill", secondary: "noSkill" } + >:=> (line 149, col 4) to (line 152, col 52) +149> skills: { + + ~~~ => Pos: (4716 to 4718) SpanInfo: {"start":4727,"length":19} + >primary = "primary" + >:=> (line 150, col 8) to (line 150, col 27) +-------------------------------- +150> primary = "primary", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (4719 to 4747) SpanInfo: {"start":4727,"length":19} + >primary = "primary" + >:=> (line 150, col 8) to (line 150, col 27) +-------------------------------- +151> secondary = "secondary" + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (4748 to 4779) SpanInfo: {"start":4756,"length":23} + >secondary = "secondary" + >:=> (line 151, col 8) to (line 151, col 31) +-------------------------------- +152> } = { primary: "noSkill", secondary: "noSkill" } + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (4780 to 4832) SpanInfo: {"start":4756,"length":23} + >secondary = "secondary" + >:=> (line 151, col 8) to (line 151, col 31) +-------------------------------- +153>} of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + + ~ => Pos: (4833 to 4833) SpanInfo: {"start":4709,"length":123} + >skills: { + > primary = "primary", + > secondary = "secondary" + > } = { primary: "noSkill", secondary: "noSkill" } + >:=> (line 149, col 4) to (line 152, col 52) +153>} of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (4834 to 4907) SpanInfo: {"start":4838,"length":148} + >[{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] + >:=> (line 153, col 5) to (line 154, col 78) +-------------------------------- +154> { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (4908 to 4989) SpanInfo: {"start":4838,"length":148} + >[{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] + >:=> (line 153, col 5) to (line 154, col 78) +-------------------------------- +155> console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (4990 to 5013) SpanInfo: {"start":4994,"length":18} + >console.log(nameA) + >:=> (line 155, col 4) to (line 155, col 22) +-------------------------------- +156>} + ~ => Pos: (5014 to 5014) SpanInfo: {"start":4994,"length":18} + >console.log(nameA) + >:=> (line 155, col 4) to (line 155, col 22) \ No newline at end of file diff --git a/tests/baselines/reference/bpSpanDestructuringAssignmentStatementArrayBindingPattern.baseline b/tests/baselines/reference/bpSpanDestructuringAssignmentStatementArrayBindingPattern.baseline new file mode 100644 index 00000000000..87bf1b5a179 --- /dev/null +++ b/tests/baselines/reference/bpSpanDestructuringAssignmentStatementArrayBindingPattern.baseline @@ -0,0 +1,365 @@ + +1 >declare var console: { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (0 to 22) SpanInfo: undefined +-------------------------------- +2 > log(msg: any): void; + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (23 to 47) SpanInfo: undefined +-------------------------------- +3 >} + + ~~ => Pos: (48 to 49) SpanInfo: undefined +-------------------------------- +4 >type Robot = [number, string, string]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (50 to 88) SpanInfo: undefined +-------------------------------- +5 >type MultiSkilledRobot = [string, [string, string]]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (89 to 141) SpanInfo: undefined +-------------------------------- +6 > + + ~ => Pos: (142 to 142) SpanInfo: undefined +-------------------------------- +7 >var robotA: Robot = [1, "mower", "mowing"]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (143 to 186) SpanInfo: {"start":143,"length":42} + >var robotA: Robot = [1, "mower", "mowing"] + >:=> (line 7, col 0) to (line 7, col 42) +-------------------------------- +8 >var robotB: Robot = [2, "trimmer", "trimming"]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (187 to 234) SpanInfo: {"start":187,"length":46} + >var robotB: Robot = [2, "trimmer", "trimming"] + >:=> (line 8, col 0) to (line 8, col 46) +-------------------------------- +9 >var multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (235 to 298) SpanInfo: {"start":235,"length":62} + >var multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]] + >:=> (line 9, col 0) to (line 9, col 62) +-------------------------------- +10 >var multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (299 to 372) SpanInfo: {"start":299,"length":72} + >var multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]] + >:=> (line 10, col 0) to (line 10, col 72) +-------------------------------- +11 > + + ~ => Pos: (373 to 373) SpanInfo: undefined +-------------------------------- +12 >let nameA: string, numberB: number, nameB: string, skillB: string; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (374 to 440) SpanInfo: undefined +-------------------------------- +13 >let robotAInfo: (number | string)[]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (441 to 477) SpanInfo: undefined +-------------------------------- +14 > + + ~ => Pos: (478 to 478) SpanInfo: undefined +-------------------------------- +15 >let multiSkillB: [string, string], nameMB: string, primarySkillB: string, secondarySkillB: string; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (479 to 577) SpanInfo: undefined +-------------------------------- +16 >let multiRobotAInfo: (string | [string, string])[]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (578 to 629) SpanInfo: undefined +-------------------------------- +17 > + + ~ => Pos: (630 to 630) SpanInfo: undefined +-------------------------------- +18 >[, nameA] = robotA; + + ~~~~~~~~~~~~~~~~~~~~ => Pos: (631 to 650) SpanInfo: {"start":634,"length":5} + >nameA + >:=> (line 18, col 3) to (line 18, col 8) +-------------------------------- +19 >[, nameB] = getRobotB(); + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (651 to 675) SpanInfo: {"start":654,"length":5} + >nameB + >:=> (line 19, col 3) to (line 19, col 8) +-------------------------------- +20 >[, nameB] = [2, "trimmer", "trimming"]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (676 to 715) SpanInfo: {"start":679,"length":5} + >nameB + >:=> (line 20, col 3) to (line 20, col 8) +-------------------------------- +21 >[, multiSkillB] = multiRobotB; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (716 to 746) SpanInfo: {"start":719,"length":11} + >multiSkillB + >:=> (line 21, col 3) to (line 21, col 14) +-------------------------------- +22 >[, multiSkillB] = getMultiRobotB(); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (747 to 782) SpanInfo: {"start":750,"length":11} + >multiSkillB + >:=> (line 22, col 3) to (line 22, col 14) +-------------------------------- +23 >[, multiSkillB] = ["roomba", ["vaccum", "mopping"]]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (783 to 835) SpanInfo: {"start":786,"length":11} + >multiSkillB + >:=> (line 23, col 3) to (line 23, col 14) +-------------------------------- +24 > + + ~ => Pos: (836 to 836) SpanInfo: undefined +-------------------------------- +25 >[numberB] = robotB; + + ~~~~~~~~~~~~~~~~~~~~ => Pos: (837 to 856) SpanInfo: {"start":838,"length":7} + >numberB + >:=> (line 25, col 1) to (line 25, col 8) +-------------------------------- +26 >[numberB] = getRobotB(); + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (857 to 881) SpanInfo: {"start":858,"length":7} + >numberB + >:=> (line 26, col 1) to (line 26, col 8) +-------------------------------- +27 >[numberB] = [2, "trimmer", "trimming"]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (882 to 921) SpanInfo: {"start":883,"length":7} + >numberB + >:=> (line 27, col 1) to (line 27, col 8) +-------------------------------- +28 >[nameMB] = multiRobotB; + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (922 to 945) SpanInfo: {"start":923,"length":6} + >nameMB + >:=> (line 28, col 1) to (line 28, col 7) +-------------------------------- +29 >[nameMB] = getMultiRobotB(); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (946 to 974) SpanInfo: {"start":947,"length":6} + >nameMB + >:=> (line 29, col 1) to (line 29, col 7) +-------------------------------- +30 >[nameMB] = ["trimmer", ["trimming", "edging"]]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (975 to 1022) SpanInfo: {"start":976,"length":6} + >nameMB + >:=> (line 30, col 1) to (line 30, col 7) +-------------------------------- +31 > + + ~ => Pos: (1023 to 1023) SpanInfo: undefined +-------------------------------- +32 >[numberB, nameB, skillB] = robotB; + + ~~~~~~~~~ => Pos: (1024 to 1032) SpanInfo: {"start":1025,"length":7} + >numberB + >:=> (line 32, col 1) to (line 32, col 8) +32 >[numberB, nameB, skillB] = robotB; + + ~~~~~~~ => Pos: (1033 to 1039) SpanInfo: {"start":1034,"length":5} + >nameB + >:=> (line 32, col 10) to (line 32, col 15) +32 >[numberB, nameB, skillB] = robotB; + + ~~~~~~~~~~~~~~~~~~~ => Pos: (1040 to 1058) SpanInfo: {"start":1041,"length":6} + >skillB + >:=> (line 32, col 17) to (line 32, col 23) +-------------------------------- +33 >[numberB, nameB, skillB] = getRobotB(); + + ~~~~~~~~~ => Pos: (1059 to 1067) SpanInfo: {"start":1060,"length":7} + >numberB + >:=> (line 33, col 1) to (line 33, col 8) +33 >[numberB, nameB, skillB] = getRobotB(); + + ~~~~~~~ => Pos: (1068 to 1074) SpanInfo: {"start":1069,"length":5} + >nameB + >:=> (line 33, col 10) to (line 33, col 15) +33 >[numberB, nameB, skillB] = getRobotB(); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1075 to 1098) SpanInfo: {"start":1076,"length":6} + >skillB + >:=> (line 33, col 17) to (line 33, col 23) +-------------------------------- +34 >[numberB, nameB, skillB] = [2, "trimmer", "trimming"]; + + ~~~~~~~~~ => Pos: (1099 to 1107) SpanInfo: {"start":1100,"length":7} + >numberB + >:=> (line 34, col 1) to (line 34, col 8) +34 >[numberB, nameB, skillB] = [2, "trimmer", "trimming"]; + + ~~~~~~~ => Pos: (1108 to 1114) SpanInfo: {"start":1109,"length":5} + >nameB + >:=> (line 34, col 10) to (line 34, col 15) +34 >[numberB, nameB, skillB] = [2, "trimmer", "trimming"]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1115 to 1153) SpanInfo: {"start":1116,"length":6} + >skillB + >:=> (line 34, col 17) to (line 34, col 23) +-------------------------------- +35 >[nameMB, [primarySkillB, secondarySkillB]] = multiRobotB; + + ~~~~~~~~ => Pos: (1154 to 1161) SpanInfo: {"start":1155,"length":6} + >nameMB + >:=> (line 35, col 1) to (line 35, col 7) +35 >[nameMB, [primarySkillB, secondarySkillB]] = multiRobotB; + + ~~~~~~~~~~~~~~~~ => Pos: (1162 to 1177) SpanInfo: {"start":1164,"length":13} + >primarySkillB + >:=> (line 35, col 10) to (line 35, col 23) +35 >[nameMB, [primarySkillB, secondarySkillB]] = multiRobotB; + + ~~~~~~~~~~~~~~~~~ => Pos: (1178 to 1194) SpanInfo: {"start":1179,"length":15} + >secondarySkillB + >:=> (line 35, col 25) to (line 35, col 40) +35 >[nameMB, [primarySkillB, secondarySkillB]] = multiRobotB; + + ~~~~~~~~~~~~~~~~~=> Pos: (1195 to 1211) SpanInfo: {"start":1163,"length":32} + >[primarySkillB, secondarySkillB] + >:=> (line 35, col 9) to (line 35, col 41) +-------------------------------- +36 >[nameMB, [primarySkillB, secondarySkillB]] = getMultiRobotB(); + + ~~~~~~~~ => Pos: (1212 to 1219) SpanInfo: {"start":1213,"length":6} + >nameMB + >:=> (line 36, col 1) to (line 36, col 7) +36 >[nameMB, [primarySkillB, secondarySkillB]] = getMultiRobotB(); + + ~~~~~~~~~~~~~~~~ => Pos: (1220 to 1235) SpanInfo: {"start":1222,"length":13} + >primarySkillB + >:=> (line 36, col 10) to (line 36, col 23) +36 >[nameMB, [primarySkillB, secondarySkillB]] = getMultiRobotB(); + + ~~~~~~~~~~~~~~~~~ => Pos: (1236 to 1252) SpanInfo: {"start":1237,"length":15} + >secondarySkillB + >:=> (line 36, col 25) to (line 36, col 40) +36 >[nameMB, [primarySkillB, secondarySkillB]] = getMultiRobotB(); + + ~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1253 to 1274) SpanInfo: {"start":1221,"length":32} + >[primarySkillB, secondarySkillB] + >:=> (line 36, col 9) to (line 36, col 41) +-------------------------------- +37 >[nameMB, [primarySkillB, secondarySkillB]] = ["trimmer", ["trimming", "edging"]]; + + ~~~~~~~~ => Pos: (1275 to 1282) SpanInfo: {"start":1276,"length":6} + >nameMB + >:=> (line 37, col 1) to (line 37, col 7) +37 >[nameMB, [primarySkillB, secondarySkillB]] = ["trimmer", ["trimming", "edging"]]; + + ~~~~~~~~~~~~~~~~ => Pos: (1283 to 1298) SpanInfo: {"start":1285,"length":13} + >primarySkillB + >:=> (line 37, col 10) to (line 37, col 23) +37 >[nameMB, [primarySkillB, secondarySkillB]] = ["trimmer", ["trimming", "edging"]]; + + ~~~~~~~~~~~~~~~~~ => Pos: (1299 to 1315) SpanInfo: {"start":1300,"length":15} + >secondarySkillB + >:=> (line 37, col 25) to (line 37, col 40) +37 >[nameMB, [primarySkillB, secondarySkillB]] = ["trimmer", ["trimming", "edging"]]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1316 to 1356) SpanInfo: {"start":1284,"length":32} + >[primarySkillB, secondarySkillB] + >:=> (line 37, col 9) to (line 37, col 41) +-------------------------------- +38 > + + ~ => Pos: (1357 to 1357) SpanInfo: undefined +-------------------------------- +39 >[numberB, ...robotAInfo] = robotB; + + ~~~~~~~~~ => Pos: (1358 to 1366) SpanInfo: {"start":1359,"length":7} + >numberB + >:=> (line 39, col 1) to (line 39, col 8) +39 >[numberB, ...robotAInfo] = robotB; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1367 to 1392) SpanInfo: {"start":1368,"length":13} + >...robotAInfo + >:=> (line 39, col 10) to (line 39, col 23) +-------------------------------- +40 >[numberB, ...robotAInfo] = getRobotB(); + + ~~~~~~~~~ => Pos: (1393 to 1401) SpanInfo: {"start":1394,"length":7} + >numberB + >:=> (line 40, col 1) to (line 40, col 8) +40 >[numberB, ...robotAInfo] = getRobotB(); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1402 to 1432) SpanInfo: {"start":1403,"length":13} + >...robotAInfo + >:=> (line 40, col 10) to (line 40, col 23) +-------------------------------- +41 >[numberB, ...robotAInfo] = [2, "trimmer", "trimming"]; + + ~~~~~~~~~ => Pos: (1433 to 1441) SpanInfo: {"start":1434,"length":7} + >numberB + >:=> (line 41, col 1) to (line 41, col 8) +41 >[numberB, ...robotAInfo] = [2, "trimmer", "trimming"]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1442 to 1494) SpanInfo: {"start":1443,"length":13} + >...robotAInfo + >:=> (line 41, col 10) to (line 41, col 23) +-------------------------------- +42 >[...multiRobotAInfo] = multiRobotA; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1495 to 1530) SpanInfo: {"start":1496,"length":18} + >...multiRobotAInfo + >:=> (line 42, col 1) to (line 42, col 19) +-------------------------------- +43 >[...multiRobotAInfo] = getMultiRobotB(); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1531 to 1571) SpanInfo: {"start":1532,"length":18} + >...multiRobotAInfo + >:=> (line 43, col 1) to (line 43, col 19) +-------------------------------- +44 >[...multiRobotAInfo] = ["trimmer", ["trimming", "edging"]]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1572 to 1631) SpanInfo: {"start":1573,"length":18} + >...multiRobotAInfo + >:=> (line 44, col 1) to (line 44, col 19) +-------------------------------- +45 > + + ~ => Pos: (1632 to 1632) SpanInfo: undefined +-------------------------------- +46 >function getRobotB() { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1633 to 1655) SpanInfo: {"start":1660,"length":13} + >return robotB + >:=> (line 47, col 4) to (line 47, col 17) +-------------------------------- +47 > return robotB; + + ~~~~~~~~~~~~~~~~~~~ => Pos: (1656 to 1674) SpanInfo: {"start":1660,"length":13} + >return robotB + >:=> (line 47, col 4) to (line 47, col 17) +-------------------------------- +48 >} + + ~~ => Pos: (1675 to 1676) SpanInfo: {"start":1675,"length":1} + >} + >:=> (line 48, col 0) to (line 48, col 1) +-------------------------------- +49 > + + ~ => Pos: (1677 to 1677) SpanInfo: undefined +-------------------------------- +50 >function getMultiRobotB() { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1678 to 1705) SpanInfo: {"start":1710,"length":18} + >return multiRobotB + >:=> (line 51, col 4) to (line 51, col 22) +-------------------------------- +51 > return multiRobotB; + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1706 to 1729) SpanInfo: {"start":1710,"length":18} + >return multiRobotB + >:=> (line 51, col 4) to (line 51, col 22) +-------------------------------- +52 >} + ~ => Pos: (1730 to 1730) SpanInfo: {"start":1730,"length":1} + >} + >:=> (line 52, col 0) to (line 52, col 1) \ No newline at end of file diff --git a/tests/baselines/reference/bpSpanDestructuringAssignmentStatementArrayBindingPatternDefaultValues.baseline b/tests/baselines/reference/bpSpanDestructuringAssignmentStatementArrayBindingPatternDefaultValues.baseline new file mode 100644 index 00000000000..7169d67bfef --- /dev/null +++ b/tests/baselines/reference/bpSpanDestructuringAssignmentStatementArrayBindingPatternDefaultValues.baseline @@ -0,0 +1,353 @@ + +1 >declare var console: { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (0 to 22) SpanInfo: undefined +-------------------------------- +2 > log(msg: any): void; + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (23 to 47) SpanInfo: undefined +-------------------------------- +3 >} + + ~~ => Pos: (48 to 49) SpanInfo: undefined +-------------------------------- +4 >type Robot = [number, string, string]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (50 to 88) SpanInfo: undefined +-------------------------------- +5 >type MultiSkilledRobot = [string, string[]]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (89 to 133) SpanInfo: undefined +-------------------------------- +6 > + + ~ => Pos: (134 to 134) SpanInfo: undefined +-------------------------------- +7 >var robotA: Robot = [1, "mower", "mowing"]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (135 to 178) SpanInfo: {"start":135,"length":42} + >var robotA: Robot = [1, "mower", "mowing"] + >:=> (line 7, col 0) to (line 7, col 42) +-------------------------------- +8 >var robotB: Robot = [2, "trimmer", "trimming"]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (179 to 226) SpanInfo: {"start":179,"length":46} + >var robotB: Robot = [2, "trimmer", "trimming"] + >:=> (line 8, col 0) to (line 8, col 46) +-------------------------------- +9 >var multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (227 to 290) SpanInfo: {"start":227,"length":62} + >var multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]] + >:=> (line 9, col 0) to (line 9, col 62) +-------------------------------- +10 >var multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (291 to 364) SpanInfo: {"start":291,"length":72} + >var multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]] + >:=> (line 10, col 0) to (line 10, col 72) +-------------------------------- +11 > + + ~ => Pos: (365 to 365) SpanInfo: undefined +-------------------------------- +12 >let nameA: string, numberB: number, nameB: string, skillB: string; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (366 to 432) SpanInfo: undefined +-------------------------------- +13 >let robotAInfo: (number | string)[]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (433 to 469) SpanInfo: undefined +-------------------------------- +14 > + + ~ => Pos: (470 to 470) SpanInfo: undefined +-------------------------------- +15 >let multiSkillB: string[], nameMB: string, primarySkillB: string, secondarySkillB: string; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (471 to 561) SpanInfo: undefined +-------------------------------- +16 >let multiRobotAInfo: (string | string[])[]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (562 to 605) SpanInfo: undefined +-------------------------------- +17 > + + ~ => Pos: (606 to 606) SpanInfo: undefined +-------------------------------- +18 >[, nameA = "helloNoName"] = robotA; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (607 to 642) SpanInfo: {"start":610,"length":21} + >nameA = "helloNoName" + >:=> (line 18, col 3) to (line 18, col 24) +-------------------------------- +19 >[, nameB = "helloNoName"] = getRobotB(); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (643 to 683) SpanInfo: {"start":646,"length":21} + >nameB = "helloNoName" + >:=> (line 19, col 3) to (line 19, col 24) +-------------------------------- +20 >[, nameB = "helloNoName"] = [2, "trimmer", "trimming"]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (684 to 739) SpanInfo: {"start":687,"length":21} + >nameB = "helloNoName" + >:=> (line 20, col 3) to (line 20, col 24) +-------------------------------- +21 >[, multiSkillB = []] = multiRobotB; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (740 to 775) SpanInfo: {"start":743,"length":16} + >multiSkillB = [] + >:=> (line 21, col 3) to (line 21, col 19) +-------------------------------- +22 >[, multiSkillB = []] = getMultiRobotB(); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (776 to 816) SpanInfo: {"start":779,"length":16} + >multiSkillB = [] + >:=> (line 22, col 3) to (line 22, col 19) +-------------------------------- +23 >[, multiSkillB = []] = ["roomba", ["vaccum", "mopping"]]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (817 to 874) SpanInfo: {"start":820,"length":16} + >multiSkillB = [] + >:=> (line 23, col 3) to (line 23, col 19) +-------------------------------- +24 > + + ~ => Pos: (875 to 875) SpanInfo: undefined +-------------------------------- +25 >[numberB = -1] = robotB; + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (876 to 900) SpanInfo: {"start":877,"length":12} + >numberB = -1 + >:=> (line 25, col 1) to (line 25, col 13) +-------------------------------- +26 >[numberB = -1] = getRobotB(); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (901 to 930) SpanInfo: {"start":902,"length":12} + >numberB = -1 + >:=> (line 26, col 1) to (line 26, col 13) +-------------------------------- +27 >[numberB = -1] = [2, "trimmer", "trimming"]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (931 to 975) SpanInfo: {"start":932,"length":12} + >numberB = -1 + >:=> (line 27, col 1) to (line 27, col 13) +-------------------------------- +28 >[nameMB = "helloNoName"] = multiRobotB; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (976 to 1015) SpanInfo: {"start":977,"length":22} + >nameMB = "helloNoName" + >:=> (line 28, col 1) to (line 28, col 23) +-------------------------------- +29 >[nameMB = "helloNoName"] = getMultiRobotB(); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1016 to 1060) SpanInfo: {"start":1017,"length":22} + >nameMB = "helloNoName" + >:=> (line 29, col 1) to (line 29, col 23) +-------------------------------- +30 >[nameMB = "helloNoName"] = ["trimmer", ["trimming", "edging"]]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1061 to 1124) SpanInfo: {"start":1062,"length":22} + >nameMB = "helloNoName" + >:=> (line 30, col 1) to (line 30, col 23) +-------------------------------- +31 > + + ~ => Pos: (1125 to 1125) SpanInfo: undefined +-------------------------------- +32 >[numberB = -1, nameB = "helloNoName", skillB = "noSkill"] = robotB; + + ~~~~~~~~~~~~~~ => Pos: (1126 to 1139) SpanInfo: {"start":1127,"length":12} + >numberB = -1 + >:=> (line 32, col 1) to (line 32, col 13) +32 >[numberB = -1, nameB = "helloNoName", skillB = "noSkill"] = robotB; + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1140 to 1162) SpanInfo: {"start":1141,"length":21} + >nameB = "helloNoName" + >:=> (line 32, col 15) to (line 32, col 36) +32 >[numberB = -1, nameB = "helloNoName", skillB = "noSkill"] = robotB; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1163 to 1193) SpanInfo: {"start":1164,"length":18} + >skillB = "noSkill" + >:=> (line 32, col 38) to (line 32, col 56) +-------------------------------- +33 >[numberB = -1, nameB = "helloNoName", skillB = "noSkill"] = getRobotB(); + + ~~~~~~~~~~~~~~ => Pos: (1194 to 1207) SpanInfo: {"start":1195,"length":12} + >numberB = -1 + >:=> (line 33, col 1) to (line 33, col 13) +33 >[numberB = -1, nameB = "helloNoName", skillB = "noSkill"] = getRobotB(); + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1208 to 1230) SpanInfo: {"start":1209,"length":21} + >nameB = "helloNoName" + >:=> (line 33, col 15) to (line 33, col 36) +33 >[numberB = -1, nameB = "helloNoName", skillB = "noSkill"] = getRobotB(); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1231 to 1266) SpanInfo: {"start":1232,"length":18} + >skillB = "noSkill" + >:=> (line 33, col 38) to (line 33, col 56) +-------------------------------- +34 >[numberB = -1, nameB = "helloNoName", skillB = "noSkill"] = [2, "trimmer", "trimming"]; + + ~~~~~~~~~~~~~~ => Pos: (1267 to 1280) SpanInfo: {"start":1268,"length":12} + >numberB = -1 + >:=> (line 34, col 1) to (line 34, col 13) +34 >[numberB = -1, nameB = "helloNoName", skillB = "noSkill"] = [2, "trimmer", "trimming"]; + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1281 to 1303) SpanInfo: {"start":1282,"length":21} + >nameB = "helloNoName" + >:=> (line 34, col 15) to (line 34, col 36) +34 >[numberB = -1, nameB = "helloNoName", skillB = "noSkill"] = [2, "trimmer", "trimming"]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1304 to 1354) SpanInfo: {"start":1305,"length":18} + >skillB = "noSkill" + >:=> (line 34, col 38) to (line 34, col 56) +-------------------------------- +35 >[nameMB = "helloNoName", [primarySkillB = "noSkill", secondarySkillB = "noSkill"] = []] = multiRobotB; + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1355 to 1378) SpanInfo: {"start":1356,"length":22} + >nameMB = "helloNoName" + >:=> (line 35, col 1) to (line 35, col 23) +35 >[nameMB = "helloNoName", [primarySkillB = "noSkill", secondarySkillB = "noSkill"] = []] = multiRobotB; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1379 to 1406) SpanInfo: {"start":1381,"length":25} + >primarySkillB = "noSkill" + >:=> (line 35, col 26) to (line 35, col 51) +35 >[nameMB = "helloNoName", [primarySkillB = "noSkill", secondarySkillB = "noSkill"] = []] = multiRobotB; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1407 to 1440) SpanInfo: {"start":1408,"length":27} + >secondarySkillB = "noSkill" + >:=> (line 35, col 53) to (line 35, col 80) +35 >[nameMB = "helloNoName", [primarySkillB = "noSkill", secondarySkillB = "noSkill"] = []] = multiRobotB; + + ~~~~~~~~~~~~~~~~~=> Pos: (1441 to 1457) SpanInfo: {"start":1380,"length":61} + >[primarySkillB = "noSkill", secondarySkillB = "noSkill"] = [] + >:=> (line 35, col 25) to (line 35, col 86) +-------------------------------- +36 >[nameMB = "helloNoName", [primarySkillB = "noSkill", secondarySkillB = "noSkill"] = []] = getMultiRobotB(); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1458 to 1481) SpanInfo: {"start":1459,"length":22} + >nameMB = "helloNoName" + >:=> (line 36, col 1) to (line 36, col 23) +36 >[nameMB = "helloNoName", [primarySkillB = "noSkill", secondarySkillB = "noSkill"] = []] = getMultiRobotB(); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1482 to 1509) SpanInfo: {"start":1484,"length":25} + >primarySkillB = "noSkill" + >:=> (line 36, col 26) to (line 36, col 51) +36 >[nameMB = "helloNoName", [primarySkillB = "noSkill", secondarySkillB = "noSkill"] = []] = getMultiRobotB(); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1510 to 1543) SpanInfo: {"start":1511,"length":27} + >secondarySkillB = "noSkill" + >:=> (line 36, col 53) to (line 36, col 80) +36 >[nameMB = "helloNoName", [primarySkillB = "noSkill", secondarySkillB = "noSkill"] = []] = getMultiRobotB(); + + ~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1544 to 1565) SpanInfo: {"start":1483,"length":61} + >[primarySkillB = "noSkill", secondarySkillB = "noSkill"] = [] + >:=> (line 36, col 25) to (line 36, col 86) +-------------------------------- +37 >[nameMB = "helloNoName", [primarySkillB = "noSkill", secondarySkillB = "noSkill"] = []] = + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1566 to 1589) SpanInfo: {"start":1567,"length":22} + >nameMB = "helloNoName" + >:=> (line 37, col 1) to (line 37, col 23) +37 >[nameMB = "helloNoName", [primarySkillB = "noSkill", secondarySkillB = "noSkill"] = []] = + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1590 to 1617) SpanInfo: {"start":1592,"length":25} + >primarySkillB = "noSkill" + >:=> (line 37, col 26) to (line 37, col 51) +37 >[nameMB = "helloNoName", [primarySkillB = "noSkill", secondarySkillB = "noSkill"] = []] = + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1618 to 1651) SpanInfo: {"start":1619,"length":27} + >secondarySkillB = "noSkill" + >:=> (line 37, col 53) to (line 37, col 80) +37 >[nameMB = "helloNoName", [primarySkillB = "noSkill", secondarySkillB = "noSkill"] = []] = + + ~~~~=> Pos: (1652 to 1655) SpanInfo: {"start":1591,"length":61} + >[primarySkillB = "noSkill", secondarySkillB = "noSkill"] = [] + >:=> (line 37, col 25) to (line 37, col 86) +-------------------------------- +38 > ["trimmer", ["trimming", "edging"]]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1656 to 1696) SpanInfo: {"start":1591,"length":61} + >[primarySkillB = "noSkill", secondarySkillB = "noSkill"] = [] + >:=> (line 37, col 25) to (line 37, col 86) +-------------------------------- +39 > + + ~ => Pos: (1697 to 1697) SpanInfo: undefined +-------------------------------- +40 >[numberB = -1, ...robotAInfo] = robotB; + + ~~~~~~~~~~~~~~ => Pos: (1698 to 1711) SpanInfo: {"start":1699,"length":12} + >numberB = -1 + >:=> (line 40, col 1) to (line 40, col 13) +40 >[numberB = -1, ...robotAInfo] = robotB; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1712 to 1737) SpanInfo: {"start":1713,"length":13} + >...robotAInfo + >:=> (line 40, col 15) to (line 40, col 28) +-------------------------------- +41 >[numberB = -1, ...robotAInfo] = getRobotB(); + + ~~~~~~~~~~~~~~ => Pos: (1738 to 1751) SpanInfo: {"start":1739,"length":12} + >numberB = -1 + >:=> (line 41, col 1) to (line 41, col 13) +41 >[numberB = -1, ...robotAInfo] = getRobotB(); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1752 to 1782) SpanInfo: {"start":1753,"length":13} + >...robotAInfo + >:=> (line 41, col 15) to (line 41, col 28) +-------------------------------- +42 >[numberB = -1, ...robotAInfo] = [2, "trimmer", "trimming"]; + + ~~~~~~~~~~~~~~ => Pos: (1783 to 1796) SpanInfo: {"start":1784,"length":12} + >numberB = -1 + >:=> (line 42, col 1) to (line 42, col 13) +42 >[numberB = -1, ...robotAInfo] = [2, "trimmer", "trimming"]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1797 to 1849) SpanInfo: {"start":1798,"length":13} + >...robotAInfo + >:=> (line 42, col 15) to (line 42, col 28) +-------------------------------- +43 > + + ~ => Pos: (1850 to 1850) SpanInfo: undefined +-------------------------------- +44 >function getRobotB() { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1851 to 1873) SpanInfo: {"start":1878,"length":13} + >return robotB + >:=> (line 45, col 4) to (line 45, col 17) +-------------------------------- +45 > return robotB; + + ~~~~~~~~~~~~~~~~~~~ => Pos: (1874 to 1892) SpanInfo: {"start":1878,"length":13} + >return robotB + >:=> (line 45, col 4) to (line 45, col 17) +-------------------------------- +46 >} + + ~~ => Pos: (1893 to 1894) SpanInfo: {"start":1893,"length":1} + >} + >:=> (line 46, col 0) to (line 46, col 1) +-------------------------------- +47 > + + ~ => Pos: (1895 to 1895) SpanInfo: undefined +-------------------------------- +48 >function getMultiRobotB() { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1896 to 1923) SpanInfo: {"start":1928,"length":18} + >return multiRobotB + >:=> (line 49, col 4) to (line 49, col 22) +-------------------------------- +49 > return multiRobotB; + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1924 to 1947) SpanInfo: {"start":1928,"length":18} + >return multiRobotB + >:=> (line 49, col 4) to (line 49, col 22) +-------------------------------- +50 >} + ~ => Pos: (1948 to 1948) SpanInfo: {"start":1948,"length":1} + >} + >:=> (line 50, col 0) to (line 50, col 1) \ No newline at end of file diff --git a/tests/baselines/reference/bpSpanDestructuringForArrayBindingPattern.baseline b/tests/baselines/reference/bpSpanDestructuringForArrayBindingPattern.baseline new file mode 100644 index 00000000000..9a65a6f2e95 --- /dev/null +++ b/tests/baselines/reference/bpSpanDestructuringForArrayBindingPattern.baseline @@ -0,0 +1,1024 @@ + +1 >declare var console: { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (0 to 22) SpanInfo: undefined +-------------------------------- +2 > log(msg: any): void; + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (23 to 47) SpanInfo: undefined +-------------------------------- +3 >} + + ~~ => Pos: (48 to 49) SpanInfo: undefined +-------------------------------- +4 >type Robot = [number, string, string]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (50 to 88) SpanInfo: undefined +-------------------------------- +5 >type MultiSkilledRobot = [string, [string, string]]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (89 to 141) SpanInfo: undefined +-------------------------------- +6 > + + ~ => Pos: (142 to 142) SpanInfo: undefined +-------------------------------- +7 >let robotA: Robot = [1, "mower", "mowing"]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (143 to 186) SpanInfo: {"start":143,"length":42} + >let robotA: Robot = [1, "mower", "mowing"] + >:=> (line 7, col 0) to (line 7, col 42) +-------------------------------- +8 >function getRobot() { + + ~~~~~~~~~~~~~~~~~~~~~~ => Pos: (187 to 208) SpanInfo: {"start":213,"length":13} + >return robotA + >:=> (line 9, col 4) to (line 9, col 17) +-------------------------------- +9 > return robotA; + + ~~~~~~~~~~~~~~~~~~~ => Pos: (209 to 227) SpanInfo: {"start":213,"length":13} + >return robotA + >:=> (line 9, col 4) to (line 9, col 17) +-------------------------------- +10 >} + + ~~ => Pos: (228 to 229) SpanInfo: {"start":228,"length":1} + >} + >:=> (line 10, col 0) to (line 10, col 1) +-------------------------------- +11 > + + ~ => Pos: (230 to 230) SpanInfo: undefined +-------------------------------- +12 >let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (231 to 294) SpanInfo: {"start":231,"length":62} + >let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]] + >:=> (line 12, col 0) to (line 12, col 62) +-------------------------------- +13 >let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (295 to 368) SpanInfo: {"start":295,"length":72} + >let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]] + >:=> (line 13, col 0) to (line 13, col 72) +-------------------------------- +14 >function getMultiRobot() { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (369 to 395) SpanInfo: {"start":400,"length":18} + >return multiRobotA + >:=> (line 15, col 4) to (line 15, col 22) +-------------------------------- +15 > return multiRobotA; + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (396 to 419) SpanInfo: {"start":400,"length":18} + >return multiRobotA + >:=> (line 15, col 4) to (line 15, col 22) +-------------------------------- +16 >} + + ~~ => Pos: (420 to 421) SpanInfo: {"start":420,"length":1} + >} + >:=> (line 16, col 0) to (line 16, col 1) +-------------------------------- +17 > + + ~ => Pos: (422 to 422) SpanInfo: undefined +-------------------------------- +18 >for (let [, nameA] = robotA, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (423 to 450) SpanInfo: {"start":435,"length":5} + >nameA + >:=> (line 18, col 12) to (line 18, col 17) +18 >for (let [, nameA] = robotA, i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (451 to 457) SpanInfo: {"start":452,"length":5} + >i = 0 + >:=> (line 18, col 29) to (line 18, col 34) +18 >for (let [, nameA] = robotA, i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (458 to 464) SpanInfo: {"start":459,"length":5} + >i < 1 + >:=> (line 18, col 36) to (line 18, col 41) +18 >for (let [, nameA] = robotA, i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (465 to 472) SpanInfo: {"start":466,"length":3} + >i++ + >:=> (line 18, col 43) to (line 18, col 46) +-------------------------------- +19 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (473 to 496) SpanInfo: {"start":477,"length":18} + >console.log(nameA) + >:=> (line 19, col 4) to (line 19, col 22) +-------------------------------- +20 >} + + ~~ => Pos: (497 to 498) SpanInfo: {"start":477,"length":18} + >console.log(nameA) + >:=> (line 19, col 4) to (line 19, col 22) +-------------------------------- +21 >for (let [, nameA] = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (499 to 530) SpanInfo: {"start":511,"length":5} + >nameA + >:=> (line 21, col 12) to (line 21, col 17) +21 >for (let [, nameA] = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (531 to 537) SpanInfo: {"start":532,"length":5} + >i = 0 + >:=> (line 21, col 33) to (line 21, col 38) +21 >for (let [, nameA] = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (538 to 544) SpanInfo: {"start":539,"length":5} + >i < 1 + >:=> (line 21, col 40) to (line 21, col 45) +21 >for (let [, nameA] = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (545 to 552) SpanInfo: {"start":546,"length":3} + >i++ + >:=> (line 21, col 47) to (line 21, col 50) +-------------------------------- +22 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (553 to 576) SpanInfo: {"start":557,"length":18} + >console.log(nameA) + >:=> (line 22, col 4) to (line 22, col 22) +-------------------------------- +23 >} + + ~~ => Pos: (577 to 578) SpanInfo: {"start":557,"length":18} + >console.log(nameA) + >:=> (line 22, col 4) to (line 22, col 22) +-------------------------------- +24 >for (let [, nameA] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (579 to 626) SpanInfo: {"start":591,"length":5} + >nameA + >:=> (line 24, col 12) to (line 24, col 17) +24 >for (let [, nameA] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (627 to 633) SpanInfo: {"start":628,"length":5} + >i = 0 + >:=> (line 24, col 49) to (line 24, col 54) +24 >for (let [, nameA] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (634 to 640) SpanInfo: {"start":635,"length":5} + >i < 1 + >:=> (line 24, col 56) to (line 24, col 61) +24 >for (let [, nameA] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (641 to 648) SpanInfo: {"start":642,"length":3} + >i++ + >:=> (line 24, col 63) to (line 24, col 66) +-------------------------------- +25 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (649 to 672) SpanInfo: {"start":653,"length":18} + >console.log(nameA) + >:=> (line 25, col 4) to (line 25, col 22) +-------------------------------- +26 >} + + ~~ => Pos: (673 to 674) SpanInfo: {"start":653,"length":18} + >console.log(nameA) + >:=> (line 25, col 4) to (line 25, col 22) +-------------------------------- +27 >for (let [, [primarySkillA, secondarySkillA]] = multiRobotA, i = 0; i < 1; i++) { + + ~~~~~~~~~~~ => Pos: (675 to 685) SpanInfo: {"start":687,"length":32} + >[primarySkillA, secondarySkillA] + >:=> (line 27, col 12) to (line 27, col 44) +27 >for (let [, [primarySkillA, secondarySkillA]] = multiRobotA, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~ => Pos: (686 to 701) SpanInfo: {"start":688,"length":13} + >primarySkillA + >:=> (line 27, col 13) to (line 27, col 26) +27 >for (let [, [primarySkillA, secondarySkillA]] = multiRobotA, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~ => Pos: (702 to 718) SpanInfo: {"start":703,"length":15} + >secondarySkillA + >:=> (line 27, col 28) to (line 27, col 43) +27 >for (let [, [primarySkillA, secondarySkillA]] = multiRobotA, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~=> Pos: (719 to 734) SpanInfo: {"start":687,"length":32} + >[primarySkillA, secondarySkillA] + >:=> (line 27, col 12) to (line 27, col 44) +27 >for (let [, [primarySkillA, secondarySkillA]] = multiRobotA, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (735 to 741) SpanInfo: {"start":736,"length":5} + >i = 0 + >:=> (line 27, col 61) to (line 27, col 66) +27 >for (let [, [primarySkillA, secondarySkillA]] = multiRobotA, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (742 to 748) SpanInfo: {"start":743,"length":5} + >i < 1 + >:=> (line 27, col 68) to (line 27, col 73) +27 >for (let [, [primarySkillA, secondarySkillA]] = multiRobotA, i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (749 to 756) SpanInfo: {"start":750,"length":3} + >i++ + >:=> (line 27, col 75) to (line 27, col 78) +-------------------------------- +28 > console.log(primarySkillA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (757 to 788) SpanInfo: {"start":761,"length":26} + >console.log(primarySkillA) + >:=> (line 28, col 4) to (line 28, col 30) +-------------------------------- +29 >} + + ~~ => Pos: (789 to 790) SpanInfo: {"start":761,"length":26} + >console.log(primarySkillA) + >:=> (line 28, col 4) to (line 28, col 30) +-------------------------------- +30 >for (let [, [primarySkillA, secondarySkillA]] = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~ => Pos: (791 to 801) SpanInfo: {"start":803,"length":32} + >[primarySkillA, secondarySkillA] + >:=> (line 30, col 12) to (line 30, col 44) +30 >for (let [, [primarySkillA, secondarySkillA]] = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~ => Pos: (802 to 817) SpanInfo: {"start":804,"length":13} + >primarySkillA + >:=> (line 30, col 13) to (line 30, col 26) +30 >for (let [, [primarySkillA, secondarySkillA]] = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~ => Pos: (818 to 834) SpanInfo: {"start":819,"length":15} + >secondarySkillA + >:=> (line 30, col 28) to (line 30, col 43) +30 >for (let [, [primarySkillA, secondarySkillA]] = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~=> Pos: (835 to 854) SpanInfo: {"start":803,"length":32} + >[primarySkillA, secondarySkillA] + >:=> (line 30, col 12) to (line 30, col 44) +30 >for (let [, [primarySkillA, secondarySkillA]] = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (855 to 861) SpanInfo: {"start":856,"length":5} + >i = 0 + >:=> (line 30, col 65) to (line 30, col 70) +30 >for (let [, [primarySkillA, secondarySkillA]] = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (862 to 868) SpanInfo: {"start":863,"length":5} + >i < 1 + >:=> (line 30, col 72) to (line 30, col 77) +30 >for (let [, [primarySkillA, secondarySkillA]] = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (869 to 876) SpanInfo: {"start":870,"length":3} + >i++ + >:=> (line 30, col 79) to (line 30, col 82) +-------------------------------- +31 > console.log(primarySkillA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (877 to 908) SpanInfo: {"start":881,"length":26} + >console.log(primarySkillA) + >:=> (line 31, col 4) to (line 31, col 30) +-------------------------------- +32 >} + + ~~ => Pos: (909 to 910) SpanInfo: {"start":881,"length":26} + >console.log(primarySkillA) + >:=> (line 31, col 4) to (line 31, col 30) +-------------------------------- +33 >for (let [, [primarySkillA, secondarySkillA]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + + ~~~~~~~~~~~ => Pos: (911 to 921) SpanInfo: {"start":923,"length":32} + >[primarySkillA, secondarySkillA] + >:=> (line 33, col 12) to (line 33, col 44) +33 >for (let [, [primarySkillA, secondarySkillA]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~ => Pos: (922 to 937) SpanInfo: {"start":924,"length":13} + >primarySkillA + >:=> (line 33, col 13) to (line 33, col 26) +33 >for (let [, [primarySkillA, secondarySkillA]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~ => Pos: (938 to 954) SpanInfo: {"start":939,"length":15} + >secondarySkillA + >:=> (line 33, col 28) to (line 33, col 43) +33 >for (let [, [primarySkillA, secondarySkillA]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (955 to 994) SpanInfo: {"start":923,"length":32} + >[primarySkillA, secondarySkillA] + >:=> (line 33, col 12) to (line 33, col 44) +33 >for (let [, [primarySkillA, secondarySkillA]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (995 to 1001) SpanInfo: {"start":996,"length":5} + >i = 0 + >:=> (line 33, col 85) to (line 33, col 90) +33 >for (let [, [primarySkillA, secondarySkillA]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1002 to 1008) SpanInfo: {"start":1003,"length":5} + >i < 1 + >:=> (line 33, col 92) to (line 33, col 97) +33 >for (let [, [primarySkillA, secondarySkillA]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (1009 to 1016) SpanInfo: {"start":1010,"length":3} + >i++ + >:=> (line 33, col 99) to (line 33, col 102) +-------------------------------- +34 > console.log(primarySkillA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1017 to 1048) SpanInfo: {"start":1021,"length":26} + >console.log(primarySkillA) + >:=> (line 34, col 4) to (line 34, col 30) +-------------------------------- +35 >} + + ~~ => Pos: (1049 to 1050) SpanInfo: {"start":1021,"length":26} + >console.log(primarySkillA) + >:=> (line 34, col 4) to (line 34, col 30) +-------------------------------- +36 > + + ~ => Pos: (1051 to 1051) SpanInfo: undefined +-------------------------------- +37 >for (let [numberB] = robotA, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1052 to 1079) SpanInfo: {"start":1062,"length":7} + >numberB + >:=> (line 37, col 10) to (line 37, col 17) +37 >for (let [numberB] = robotA, i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (1080 to 1086) SpanInfo: {"start":1081,"length":5} + >i = 0 + >:=> (line 37, col 29) to (line 37, col 34) +37 >for (let [numberB] = robotA, i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (1087 to 1093) SpanInfo: {"start":1088,"length":5} + >i < 1 + >:=> (line 37, col 36) to (line 37, col 41) +37 >for (let [numberB] = robotA, i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (1094 to 1101) SpanInfo: {"start":1095,"length":3} + >i++ + >:=> (line 37, col 43) to (line 37, col 46) +-------------------------------- +38 > console.log(numberB); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1102 to 1127) SpanInfo: {"start":1106,"length":20} + >console.log(numberB) + >:=> (line 38, col 4) to (line 38, col 24) +-------------------------------- +39 >} + + ~~ => Pos: (1128 to 1129) SpanInfo: {"start":1106,"length":20} + >console.log(numberB) + >:=> (line 38, col 4) to (line 38, col 24) +-------------------------------- +40 >for (let [numberB] = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1130 to 1161) SpanInfo: {"start":1140,"length":7} + >numberB + >:=> (line 40, col 10) to (line 40, col 17) +40 >for (let [numberB] = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (1162 to 1168) SpanInfo: {"start":1163,"length":5} + >i = 0 + >:=> (line 40, col 33) to (line 40, col 38) +40 >for (let [numberB] = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1169 to 1175) SpanInfo: {"start":1170,"length":5} + >i < 1 + >:=> (line 40, col 40) to (line 40, col 45) +40 >for (let [numberB] = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (1176 to 1183) SpanInfo: {"start":1177,"length":3} + >i++ + >:=> (line 40, col 47) to (line 40, col 50) +-------------------------------- +41 > console.log(numberB); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1184 to 1209) SpanInfo: {"start":1188,"length":20} + >console.log(numberB) + >:=> (line 41, col 4) to (line 41, col 24) +-------------------------------- +42 >} + + ~~ => Pos: (1210 to 1211) SpanInfo: {"start":1188,"length":20} + >console.log(numberB) + >:=> (line 41, col 4) to (line 41, col 24) +-------------------------------- +43 >for (let [numberB] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1212 to 1259) SpanInfo: {"start":1222,"length":7} + >numberB + >:=> (line 43, col 10) to (line 43, col 17) +43 >for (let [numberB] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1260 to 1266) SpanInfo: {"start":1261,"length":5} + >i = 0 + >:=> (line 43, col 49) to (line 43, col 54) +43 >for (let [numberB] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1267 to 1273) SpanInfo: {"start":1268,"length":5} + >i < 1 + >:=> (line 43, col 56) to (line 43, col 61) +43 >for (let [numberB] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (1274 to 1281) SpanInfo: {"start":1275,"length":3} + >i++ + >:=> (line 43, col 63) to (line 43, col 66) +-------------------------------- +44 > console.log(numberB); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1282 to 1307) SpanInfo: {"start":1286,"length":20} + >console.log(numberB) + >:=> (line 44, col 4) to (line 44, col 24) +-------------------------------- +45 >} + + ~~ => Pos: (1308 to 1309) SpanInfo: {"start":1286,"length":20} + >console.log(numberB) + >:=> (line 44, col 4) to (line 44, col 24) +-------------------------------- +46 >for (let [nameB] = multiRobotA, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1310 to 1340) SpanInfo: {"start":1320,"length":5} + >nameB + >:=> (line 46, col 10) to (line 46, col 15) +46 >for (let [nameB] = multiRobotA, i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (1341 to 1347) SpanInfo: {"start":1342,"length":5} + >i = 0 + >:=> (line 46, col 32) to (line 46, col 37) +46 >for (let [nameB] = multiRobotA, i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (1348 to 1354) SpanInfo: {"start":1349,"length":5} + >i < 1 + >:=> (line 46, col 39) to (line 46, col 44) +46 >for (let [nameB] = multiRobotA, i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (1355 to 1362) SpanInfo: {"start":1356,"length":3} + >i++ + >:=> (line 46, col 46) to (line 46, col 49) +-------------------------------- +47 > console.log(nameB); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1363 to 1386) SpanInfo: {"start":1367,"length":18} + >console.log(nameB) + >:=> (line 47, col 4) to (line 47, col 22) +-------------------------------- +48 >} + + ~~ => Pos: (1387 to 1388) SpanInfo: {"start":1367,"length":18} + >console.log(nameB) + >:=> (line 47, col 4) to (line 47, col 22) +-------------------------------- +49 >for (let [nameB] = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1389 to 1423) SpanInfo: {"start":1399,"length":5} + >nameB + >:=> (line 49, col 10) to (line 49, col 15) +49 >for (let [nameB] = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (1424 to 1430) SpanInfo: {"start":1425,"length":5} + >i = 0 + >:=> (line 49, col 36) to (line 49, col 41) +49 >for (let [nameB] = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1431 to 1437) SpanInfo: {"start":1432,"length":5} + >i < 1 + >:=> (line 49, col 43) to (line 49, col 48) +49 >for (let [nameB] = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (1438 to 1445) SpanInfo: {"start":1439,"length":3} + >i++ + >:=> (line 49, col 50) to (line 49, col 53) +-------------------------------- +50 > console.log(nameB); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1446 to 1469) SpanInfo: {"start":1450,"length":18} + >console.log(nameB) + >:=> (line 50, col 4) to (line 50, col 22) +-------------------------------- +51 >} + + ~~ => Pos: (1470 to 1471) SpanInfo: {"start":1450,"length":18} + >console.log(nameB) + >:=> (line 50, col 4) to (line 50, col 22) +-------------------------------- +52 >for (let [nameB] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1472 to 1526) SpanInfo: {"start":1482,"length":5} + >nameB + >:=> (line 52, col 10) to (line 52, col 15) +52 >for (let [nameB] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1527 to 1533) SpanInfo: {"start":1528,"length":5} + >i = 0 + >:=> (line 52, col 56) to (line 52, col 61) +52 >for (let [nameB] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1534 to 1540) SpanInfo: {"start":1535,"length":5} + >i < 1 + >:=> (line 52, col 63) to (line 52, col 68) +52 >for (let [nameB] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (1541 to 1548) SpanInfo: {"start":1542,"length":3} + >i++ + >:=> (line 52, col 70) to (line 52, col 73) +-------------------------------- +53 > console.log(nameB); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1549 to 1572) SpanInfo: {"start":1553,"length":18} + >console.log(nameB) + >:=> (line 53, col 4) to (line 53, col 22) +-------------------------------- +54 >} + + ~~ => Pos: (1573 to 1574) SpanInfo: {"start":1553,"length":18} + >console.log(nameB) + >:=> (line 53, col 4) to (line 53, col 22) +-------------------------------- +55 > + + ~ => Pos: (1575 to 1575) SpanInfo: undefined +-------------------------------- +56 >for (let [numberA2, nameA2, skillA2] = robotA, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~ => Pos: (1576 to 1594) SpanInfo: {"start":1586,"length":8} + >numberA2 + >:=> (line 56, col 10) to (line 56, col 18) +56 >for (let [numberA2, nameA2, skillA2] = robotA, i = 0; i < 1; i++) { + + ~~~~~~~~ => Pos: (1595 to 1602) SpanInfo: {"start":1596,"length":6} + >nameA2 + >:=> (line 56, col 20) to (line 56, col 26) +56 >for (let [numberA2, nameA2, skillA2] = robotA, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~=> Pos: (1603 to 1621) SpanInfo: {"start":1604,"length":7} + >skillA2 + >:=> (line 56, col 28) to (line 56, col 35) +56 >for (let [numberA2, nameA2, skillA2] = robotA, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1622 to 1628) SpanInfo: {"start":1623,"length":5} + >i = 0 + >:=> (line 56, col 47) to (line 56, col 52) +56 >for (let [numberA2, nameA2, skillA2] = robotA, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1629 to 1635) SpanInfo: {"start":1630,"length":5} + >i < 1 + >:=> (line 56, col 54) to (line 56, col 59) +56 >for (let [numberA2, nameA2, skillA2] = robotA, i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (1636 to 1643) SpanInfo: {"start":1637,"length":3} + >i++ + >:=> (line 56, col 61) to (line 56, col 64) +-------------------------------- +57 > console.log(nameA2); + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1644 to 1668) SpanInfo: {"start":1648,"length":19} + >console.log(nameA2) + >:=> (line 57, col 4) to (line 57, col 23) +-------------------------------- +58 >} + + ~~ => Pos: (1669 to 1670) SpanInfo: {"start":1648,"length":19} + >console.log(nameA2) + >:=> (line 57, col 4) to (line 57, col 23) +-------------------------------- +59 >for (let [numberA2, nameA2, skillA2] = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~ => Pos: (1671 to 1689) SpanInfo: {"start":1681,"length":8} + >numberA2 + >:=> (line 59, col 10) to (line 59, col 18) +59 >for (let [numberA2, nameA2, skillA2] = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~ => Pos: (1690 to 1697) SpanInfo: {"start":1691,"length":6} + >nameA2 + >:=> (line 59, col 20) to (line 59, col 26) +59 >for (let [numberA2, nameA2, skillA2] = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1698 to 1720) SpanInfo: {"start":1699,"length":7} + >skillA2 + >:=> (line 59, col 28) to (line 59, col 35) +59 >for (let [numberA2, nameA2, skillA2] = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1721 to 1727) SpanInfo: {"start":1722,"length":5} + >i = 0 + >:=> (line 59, col 51) to (line 59, col 56) +59 >for (let [numberA2, nameA2, skillA2] = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1728 to 1734) SpanInfo: {"start":1729,"length":5} + >i < 1 + >:=> (line 59, col 58) to (line 59, col 63) +59 >for (let [numberA2, nameA2, skillA2] = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (1735 to 1742) SpanInfo: {"start":1736,"length":3} + >i++ + >:=> (line 59, col 65) to (line 59, col 68) +-------------------------------- +60 > console.log(nameA2); + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1743 to 1767) SpanInfo: {"start":1747,"length":19} + >console.log(nameA2) + >:=> (line 60, col 4) to (line 60, col 23) +-------------------------------- +61 >} + + ~~ => Pos: (1768 to 1769) SpanInfo: {"start":1747,"length":19} + >console.log(nameA2) + >:=> (line 60, col 4) to (line 60, col 23) +-------------------------------- +62 >for (let [numberA2, nameA2, skillA2] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~ => Pos: (1770 to 1788) SpanInfo: {"start":1780,"length":8} + >numberA2 + >:=> (line 62, col 10) to (line 62, col 18) +62 >for (let [numberA2, nameA2, skillA2] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + + ~~~~~~~~ => Pos: (1789 to 1796) SpanInfo: {"start":1790,"length":6} + >nameA2 + >:=> (line 62, col 20) to (line 62, col 26) +62 >for (let [numberA2, nameA2, skillA2] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1797 to 1835) SpanInfo: {"start":1798,"length":7} + >skillA2 + >:=> (line 62, col 28) to (line 62, col 35) +62 >for (let [numberA2, nameA2, skillA2] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1836 to 1842) SpanInfo: {"start":1837,"length":5} + >i = 0 + >:=> (line 62, col 67) to (line 62, col 72) +62 >for (let [numberA2, nameA2, skillA2] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1843 to 1849) SpanInfo: {"start":1844,"length":5} + >i < 1 + >:=> (line 62, col 74) to (line 62, col 79) +62 >for (let [numberA2, nameA2, skillA2] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (1850 to 1857) SpanInfo: {"start":1851,"length":3} + >i++ + >:=> (line 62, col 81) to (line 62, col 84) +-------------------------------- +63 > console.log(nameA2); + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1858 to 1882) SpanInfo: {"start":1862,"length":19} + >console.log(nameA2) + >:=> (line 63, col 4) to (line 63, col 23) +-------------------------------- +64 >} + + ~~ => Pos: (1883 to 1884) SpanInfo: {"start":1862,"length":19} + >console.log(nameA2) + >:=> (line 63, col 4) to (line 63, col 23) +-------------------------------- +65 >for (let [nameMA, [primarySkillA, secondarySkillA]] = multiRobotA, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~ => Pos: (1885 to 1901) SpanInfo: {"start":1895,"length":6} + >nameMA + >:=> (line 65, col 10) to (line 65, col 16) +65 >for (let [nameMA, [primarySkillA, secondarySkillA]] = multiRobotA, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~ => Pos: (1902 to 1917) SpanInfo: {"start":1904,"length":13} + >primarySkillA + >:=> (line 65, col 19) to (line 65, col 32) +65 >for (let [nameMA, [primarySkillA, secondarySkillA]] = multiRobotA, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~=> Pos: (1918 to 1934) SpanInfo: {"start":1919,"length":15} + >secondarySkillA + >:=> (line 65, col 34) to (line 65, col 49) +65 >for (let [nameMA, [primarySkillA, secondarySkillA]] = multiRobotA, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~=> Pos: (1935 to 1950) SpanInfo: {"start":1903,"length":32} + >[primarySkillA, secondarySkillA] + >:=> (line 65, col 18) to (line 65, col 50) +65 >for (let [nameMA, [primarySkillA, secondarySkillA]] = multiRobotA, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1951 to 1957) SpanInfo: {"start":1952,"length":5} + >i = 0 + >:=> (line 65, col 67) to (line 65, col 72) +65 >for (let [nameMA, [primarySkillA, secondarySkillA]] = multiRobotA, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1958 to 1964) SpanInfo: {"start":1959,"length":5} + >i < 1 + >:=> (line 65, col 74) to (line 65, col 79) +65 >for (let [nameMA, [primarySkillA, secondarySkillA]] = multiRobotA, i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (1965 to 1972) SpanInfo: {"start":1966,"length":3} + >i++ + >:=> (line 65, col 81) to (line 65, col 84) +-------------------------------- +66 > console.log(nameMA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1973 to 1997) SpanInfo: {"start":1977,"length":19} + >console.log(nameMA) + >:=> (line 66, col 4) to (line 66, col 23) +-------------------------------- +67 >} + + ~~ => Pos: (1998 to 1999) SpanInfo: {"start":1977,"length":19} + >console.log(nameMA) + >:=> (line 66, col 4) to (line 66, col 23) +-------------------------------- +68 >for (let [nameMA, [primarySkillA, secondarySkillA]] = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~ => Pos: (2000 to 2016) SpanInfo: {"start":2010,"length":6} + >nameMA + >:=> (line 68, col 10) to (line 68, col 16) +68 >for (let [nameMA, [primarySkillA, secondarySkillA]] = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~ => Pos: (2017 to 2032) SpanInfo: {"start":2019,"length":13} + >primarySkillA + >:=> (line 68, col 19) to (line 68, col 32) +68 >for (let [nameMA, [primarySkillA, secondarySkillA]] = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~=> Pos: (2033 to 2049) SpanInfo: {"start":2034,"length":15} + >secondarySkillA + >:=> (line 68, col 34) to (line 68, col 49) +68 >for (let [nameMA, [primarySkillA, secondarySkillA]] = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~=> Pos: (2050 to 2069) SpanInfo: {"start":2018,"length":32} + >[primarySkillA, secondarySkillA] + >:=> (line 68, col 18) to (line 68, col 50) +68 >for (let [nameMA, [primarySkillA, secondarySkillA]] = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (2070 to 2076) SpanInfo: {"start":2071,"length":5} + >i = 0 + >:=> (line 68, col 71) to (line 68, col 76) +68 >for (let [nameMA, [primarySkillA, secondarySkillA]] = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (2077 to 2083) SpanInfo: {"start":2078,"length":5} + >i < 1 + >:=> (line 68, col 78) to (line 68, col 83) +68 >for (let [nameMA, [primarySkillA, secondarySkillA]] = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (2084 to 2091) SpanInfo: {"start":2085,"length":3} + >i++ + >:=> (line 68, col 85) to (line 68, col 88) +-------------------------------- +69 > console.log(nameMA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2092 to 2116) SpanInfo: {"start":2096,"length":19} + >console.log(nameMA) + >:=> (line 69, col 4) to (line 69, col 23) +-------------------------------- +70 >} + + ~~ => Pos: (2117 to 2118) SpanInfo: {"start":2096,"length":19} + >console.log(nameMA) + >:=> (line 69, col 4) to (line 69, col 23) +-------------------------------- +71 >for (let [nameMA, [primarySkillA, secondarySkillA]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~ => Pos: (2119 to 2135) SpanInfo: {"start":2129,"length":6} + >nameMA + >:=> (line 71, col 10) to (line 71, col 16) +71 >for (let [nameMA, [primarySkillA, secondarySkillA]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~ => Pos: (2136 to 2151) SpanInfo: {"start":2138,"length":13} + >primarySkillA + >:=> (line 71, col 19) to (line 71, col 32) +71 >for (let [nameMA, [primarySkillA, secondarySkillA]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~=> Pos: (2152 to 2168) SpanInfo: {"start":2153,"length":15} + >secondarySkillA + >:=> (line 71, col 34) to (line 71, col 49) +71 >for (let [nameMA, [primarySkillA, secondarySkillA]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (2169 to 2208) SpanInfo: {"start":2137,"length":32} + >[primarySkillA, secondarySkillA] + >:=> (line 71, col 18) to (line 71, col 50) +71 >for (let [nameMA, [primarySkillA, secondarySkillA]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (2209 to 2215) SpanInfo: {"start":2210,"length":5} + >i = 0 + >:=> (line 71, col 91) to (line 71, col 96) +71 >for (let [nameMA, [primarySkillA, secondarySkillA]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (2216 to 2222) SpanInfo: {"start":2217,"length":5} + >i < 1 + >:=> (line 71, col 98) to (line 71, col 103) +71 >for (let [nameMA, [primarySkillA, secondarySkillA]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (2223 to 2230) SpanInfo: {"start":2224,"length":3} + >i++ + >:=> (line 71, col 105) to (line 71, col 108) +-------------------------------- +72 > console.log(nameMA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2231 to 2255) SpanInfo: {"start":2235,"length":19} + >console.log(nameMA) + >:=> (line 72, col 4) to (line 72, col 23) +-------------------------------- +73 >} + + ~~ => Pos: (2256 to 2257) SpanInfo: {"start":2235,"length":19} + >console.log(nameMA) + >:=> (line 72, col 4) to (line 72, col 23) +-------------------------------- +74 > + + ~ => Pos: (2258 to 2258) SpanInfo: undefined +-------------------------------- +75 >for (let [numberA3, ...robotAInfo] = robotA, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~ => Pos: (2259 to 2277) SpanInfo: {"start":2269,"length":8} + >numberA3 + >:=> (line 75, col 10) to (line 75, col 18) +75 >for (let [numberA3, ...robotAInfo] = robotA, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2278 to 2302) SpanInfo: {"start":2279,"length":13} + >...robotAInfo + >:=> (line 75, col 20) to (line 75, col 33) +75 >for (let [numberA3, ...robotAInfo] = robotA, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (2303 to 2309) SpanInfo: {"start":2304,"length":5} + >i = 0 + >:=> (line 75, col 45) to (line 75, col 50) +75 >for (let [numberA3, ...robotAInfo] = robotA, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (2310 to 2316) SpanInfo: {"start":2311,"length":5} + >i < 1 + >:=> (line 75, col 52) to (line 75, col 57) +75 >for (let [numberA3, ...robotAInfo] = robotA, i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (2317 to 2324) SpanInfo: {"start":2318,"length":3} + >i++ + >:=> (line 75, col 59) to (line 75, col 62) +-------------------------------- +76 > console.log(numberA3); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2325 to 2351) SpanInfo: {"start":2329,"length":21} + >console.log(numberA3) + >:=> (line 76, col 4) to (line 76, col 25) +-------------------------------- +77 >} + + ~~ => Pos: (2352 to 2353) SpanInfo: {"start":2329,"length":21} + >console.log(numberA3) + >:=> (line 76, col 4) to (line 76, col 25) +-------------------------------- +78 >for (let [numberA3, ...robotAInfo] = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~ => Pos: (2354 to 2372) SpanInfo: {"start":2364,"length":8} + >numberA3 + >:=> (line 78, col 10) to (line 78, col 18) +78 >for (let [numberA3, ...robotAInfo] = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (2373 to 2401) SpanInfo: {"start":2374,"length":13} + >...robotAInfo + >:=> (line 78, col 20) to (line 78, col 33) +78 >for (let [numberA3, ...robotAInfo] = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (2402 to 2408) SpanInfo: {"start":2403,"length":5} + >i = 0 + >:=> (line 78, col 49) to (line 78, col 54) +78 >for (let [numberA3, ...robotAInfo] = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (2409 to 2415) SpanInfo: {"start":2410,"length":5} + >i < 1 + >:=> (line 78, col 56) to (line 78, col 61) +78 >for (let [numberA3, ...robotAInfo] = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (2416 to 2423) SpanInfo: {"start":2417,"length":3} + >i++ + >:=> (line 78, col 63) to (line 78, col 66) +-------------------------------- +79 > console.log(numberA3); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2424 to 2450) SpanInfo: {"start":2428,"length":21} + >console.log(numberA3) + >:=> (line 79, col 4) to (line 79, col 25) +-------------------------------- +80 >} + + ~~ => Pos: (2451 to 2452) SpanInfo: {"start":2428,"length":21} + >console.log(numberA3) + >:=> (line 79, col 4) to (line 79, col 25) +-------------------------------- +81 >for (let [numberA3, ...robotAInfo] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~ => Pos: (2453 to 2471) SpanInfo: {"start":2463,"length":8} + >numberA3 + >:=> (line 81, col 10) to (line 81, col 18) +81 >for (let [numberA3, ...robotAInfo] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (2472 to 2516) SpanInfo: {"start":2473,"length":13} + >...robotAInfo + >:=> (line 81, col 20) to (line 81, col 33) +81 >for (let [numberA3, ...robotAInfo] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (2517 to 2523) SpanInfo: {"start":2518,"length":5} + >i = 0 + >:=> (line 81, col 65) to (line 81, col 70) +81 >for (let [numberA3, ...robotAInfo] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (2524 to 2530) SpanInfo: {"start":2525,"length":5} + >i < 1 + >:=> (line 81, col 72) to (line 81, col 77) +81 >for (let [numberA3, ...robotAInfo] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (2531 to 2538) SpanInfo: {"start":2532,"length":3} + >i++ + >:=> (line 81, col 79) to (line 81, col 82) +-------------------------------- +82 > console.log(numberA3); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2539 to 2565) SpanInfo: {"start":2543,"length":21} + >console.log(numberA3) + >:=> (line 82, col 4) to (line 82, col 25) +-------------------------------- +83 >} + + ~~ => Pos: (2566 to 2567) SpanInfo: {"start":2543,"length":21} + >console.log(numberA3) + >:=> (line 82, col 4) to (line 82, col 25) +-------------------------------- +84 >for (let [...multiRobotAInfo] = multiRobotA, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2568 to 2611) SpanInfo: {"start":2578,"length":18} + >...multiRobotAInfo + >:=> (line 84, col 10) to (line 84, col 28) +84 >for (let [...multiRobotAInfo] = multiRobotA, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (2612 to 2618) SpanInfo: {"start":2613,"length":5} + >i = 0 + >:=> (line 84, col 45) to (line 84, col 50) +84 >for (let [...multiRobotAInfo] = multiRobotA, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (2619 to 2625) SpanInfo: {"start":2620,"length":5} + >i < 1 + >:=> (line 84, col 52) to (line 84, col 57) +84 >for (let [...multiRobotAInfo] = multiRobotA, i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (2626 to 2633) SpanInfo: {"start":2627,"length":3} + >i++ + >:=> (line 84, col 59) to (line 84, col 62) +-------------------------------- +85 > console.log(multiRobotAInfo); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2634 to 2667) SpanInfo: {"start":2638,"length":28} + >console.log(multiRobotAInfo) + >:=> (line 85, col 4) to (line 85, col 32) +-------------------------------- +86 >} + + ~~ => Pos: (2668 to 2669) SpanInfo: {"start":2638,"length":28} + >console.log(multiRobotAInfo) + >:=> (line 85, col 4) to (line 85, col 32) +-------------------------------- +87 >for (let [...multiRobotAInfo] = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (2670 to 2717) SpanInfo: {"start":2680,"length":18} + >...multiRobotAInfo + >:=> (line 87, col 10) to (line 87, col 28) +87 >for (let [...multiRobotAInfo] = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (2718 to 2724) SpanInfo: {"start":2719,"length":5} + >i = 0 + >:=> (line 87, col 49) to (line 87, col 54) +87 >for (let [...multiRobotAInfo] = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (2725 to 2731) SpanInfo: {"start":2726,"length":5} + >i < 1 + >:=> (line 87, col 56) to (line 87, col 61) +87 >for (let [...multiRobotAInfo] = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (2732 to 2739) SpanInfo: {"start":2733,"length":3} + >i++ + >:=> (line 87, col 63) to (line 87, col 66) +-------------------------------- +88 > console.log(multiRobotAInfo); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2740 to 2773) SpanInfo: {"start":2744,"length":28} + >console.log(multiRobotAInfo) + >:=> (line 88, col 4) to (line 88, col 32) +-------------------------------- +89 >} + + ~~ => Pos: (2774 to 2775) SpanInfo: {"start":2744,"length":28} + >console.log(multiRobotAInfo) + >:=> (line 88, col 4) to (line 88, col 32) +-------------------------------- +90 >for (let [...multiRobotAInfo] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (2776 to 2843) SpanInfo: {"start":2786,"length":18} + >...multiRobotAInfo + >:=> (line 90, col 10) to (line 90, col 28) +90 >for (let [...multiRobotAInfo] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (2844 to 2850) SpanInfo: {"start":2845,"length":5} + >i = 0 + >:=> (line 90, col 69) to (line 90, col 74) +90 >for (let [...multiRobotAInfo] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (2851 to 2857) SpanInfo: {"start":2852,"length":5} + >i < 1 + >:=> (line 90, col 76) to (line 90, col 81) +90 >for (let [...multiRobotAInfo] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (2858 to 2865) SpanInfo: {"start":2859,"length":3} + >i++ + >:=> (line 90, col 83) to (line 90, col 86) +-------------------------------- +91 > console.log(multiRobotAInfo); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2866 to 2899) SpanInfo: {"start":2870,"length":28} + >console.log(multiRobotAInfo) + >:=> (line 91, col 4) to (line 91, col 32) +-------------------------------- +92 >} + ~ => Pos: (2900 to 2900) SpanInfo: {"start":2870,"length":28} + >console.log(multiRobotAInfo) + >:=> (line 91, col 4) to (line 91, col 32) \ No newline at end of file diff --git a/tests/baselines/reference/bpSpanDestructuringForArrayBindingPatternDefaultValues.baseline b/tests/baselines/reference/bpSpanDestructuringForArrayBindingPatternDefaultValues.baseline new file mode 100644 index 00000000000..78fc1b42b2f --- /dev/null +++ b/tests/baselines/reference/bpSpanDestructuringForArrayBindingPatternDefaultValues.baseline @@ -0,0 +1,1042 @@ + +1 >declare var console: { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (0 to 22) SpanInfo: undefined +-------------------------------- +2 > log(msg: any): void; + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (23 to 47) SpanInfo: undefined +-------------------------------- +3 >} + + ~~ => Pos: (48 to 49) SpanInfo: undefined +-------------------------------- +4 >type Robot = [number, string, string]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (50 to 88) SpanInfo: undefined +-------------------------------- +5 >type MultiSkilledRobot = [string, string[]]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (89 to 133) SpanInfo: undefined +-------------------------------- +6 >let robotA: Robot = [1, "mower", "mowing"]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (134 to 177) SpanInfo: {"start":134,"length":42} + >let robotA: Robot = [1, "mower", "mowing"] + >:=> (line 6, col 0) to (line 6, col 42) +-------------------------------- +7 >function getRobot() { + + ~~~~~~~~~~~~~~~~~~~~~~ => Pos: (178 to 199) SpanInfo: {"start":204,"length":13} + >return robotA + >:=> (line 8, col 4) to (line 8, col 17) +-------------------------------- +8 > return robotA; + + ~~~~~~~~~~~~~~~~~~~ => Pos: (200 to 218) SpanInfo: {"start":204,"length":13} + >return robotA + >:=> (line 8, col 4) to (line 8, col 17) +-------------------------------- +9 >} + + ~~ => Pos: (219 to 220) SpanInfo: {"start":219,"length":1} + >} + >:=> (line 9, col 0) to (line 9, col 1) +-------------------------------- +10 >let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (221 to 284) SpanInfo: {"start":221,"length":62} + >let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]] + >:=> (line 10, col 0) to (line 10, col 62) +-------------------------------- +11 >let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (285 to 358) SpanInfo: {"start":285,"length":72} + >let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]] + >:=> (line 11, col 0) to (line 11, col 72) +-------------------------------- +12 >function getMultiRobot() { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (359 to 385) SpanInfo: {"start":390,"length":18} + >return multiRobotA + >:=> (line 13, col 4) to (line 13, col 22) +-------------------------------- +13 > return multiRobotA; + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (386 to 409) SpanInfo: {"start":390,"length":18} + >return multiRobotA + >:=> (line 13, col 4) to (line 13, col 22) +-------------------------------- +14 >} + + ~~ => Pos: (410 to 411) SpanInfo: {"start":410,"length":1} + >} + >:=> (line 14, col 0) to (line 14, col 1) +-------------------------------- +15 >for (let [, nameA ="name"] = robotA, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (412 to 447) SpanInfo: {"start":424,"length":13} + >nameA ="name" + >:=> (line 15, col 12) to (line 15, col 25) +15 >for (let [, nameA ="name"] = robotA, i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (448 to 454) SpanInfo: {"start":449,"length":5} + >i = 0 + >:=> (line 15, col 37) to (line 15, col 42) +15 >for (let [, nameA ="name"] = robotA, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (455 to 461) SpanInfo: {"start":456,"length":5} + >i < 1 + >:=> (line 15, col 44) to (line 15, col 49) +15 >for (let [, nameA ="name"] = robotA, i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (462 to 469) SpanInfo: {"start":463,"length":3} + >i++ + >:=> (line 15, col 51) to (line 15, col 54) +-------------------------------- +16 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (470 to 493) SpanInfo: {"start":474,"length":18} + >console.log(nameA) + >:=> (line 16, col 4) to (line 16, col 22) +-------------------------------- +17 >} + + ~~ => Pos: (494 to 495) SpanInfo: {"start":474,"length":18} + >console.log(nameA) + >:=> (line 16, col 4) to (line 16, col 22) +-------------------------------- +18 >for (let [, nameA = "name"] = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (496 to 536) SpanInfo: {"start":508,"length":14} + >nameA = "name" + >:=> (line 18, col 12) to (line 18, col 26) +18 >for (let [, nameA = "name"] = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (537 to 543) SpanInfo: {"start":538,"length":5} + >i = 0 + >:=> (line 18, col 42) to (line 18, col 47) +18 >for (let [, nameA = "name"] = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (544 to 550) SpanInfo: {"start":545,"length":5} + >i < 1 + >:=> (line 18, col 49) to (line 18, col 54) +18 >for (let [, nameA = "name"] = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (551 to 558) SpanInfo: {"start":552,"length":3} + >i++ + >:=> (line 18, col 56) to (line 18, col 59) +-------------------------------- +19 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (559 to 582) SpanInfo: {"start":563,"length":18} + >console.log(nameA) + >:=> (line 19, col 4) to (line 19, col 22) +-------------------------------- +20 >} + + ~~ => Pos: (583 to 584) SpanInfo: {"start":563,"length":18} + >console.log(nameA) + >:=> (line 19, col 4) to (line 19, col 22) +-------------------------------- +21 >for (let [, nameA = "name"] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (585 to 641) SpanInfo: {"start":597,"length":14} + >nameA = "name" + >:=> (line 21, col 12) to (line 21, col 26) +21 >for (let [, nameA = "name"] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (642 to 648) SpanInfo: {"start":643,"length":5} + >i = 0 + >:=> (line 21, col 58) to (line 21, col 63) +21 >for (let [, nameA = "name"] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (649 to 655) SpanInfo: {"start":650,"length":5} + >i < 1 + >:=> (line 21, col 65) to (line 21, col 70) +21 >for (let [, nameA = "name"] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (656 to 663) SpanInfo: {"start":657,"length":3} + >i++ + >:=> (line 21, col 72) to (line 21, col 75) +-------------------------------- +22 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (664 to 687) SpanInfo: {"start":668,"length":18} + >console.log(nameA) + >:=> (line 22, col 4) to (line 22, col 22) +-------------------------------- +23 >} + + ~~ => Pos: (688 to 689) SpanInfo: {"start":668,"length":18} + >console.log(nameA) + >:=> (line 22, col 4) to (line 22, col 22) +-------------------------------- +24 >for (let [, [ + + ~~~~~~~~~~~ => Pos: (690 to 700) SpanInfo: {"start":702,"length":87} + >[ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + >] = ["none", "none"] + >:=> (line 24, col 12) to (line 27, col 20) +24 >for (let [, [ + + ~~~ => Pos: (701 to 703) SpanInfo: {"start":708,"length":25} + >primarySkillA = "primary" + >:=> (line 25, col 4) to (line 25, col 29) +-------------------------------- +25 > primarySkillA = "primary", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (704 to 734) SpanInfo: {"start":708,"length":25} + >primarySkillA = "primary" + >:=> (line 25, col 4) to (line 25, col 29) +-------------------------------- +26 > secondarySkillA = "secondary" + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (735 to 768) SpanInfo: {"start":739,"length":29} + >secondarySkillA = "secondary" + >:=> (line 26, col 4) to (line 26, col 33) +-------------------------------- +27 >] = ["none", "none"]] = multiRobotA, i = 0; i < 1; i++) { + + ~ => Pos: (769 to 769) SpanInfo: {"start":739,"length":29} + >secondarySkillA = "secondary" + >:=> (line 26, col 4) to (line 26, col 33) +27 >] = ["none", "none"]] = multiRobotA, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (770 to 804) SpanInfo: {"start":702,"length":87} + >[ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + >] = ["none", "none"] + >:=> (line 24, col 12) to (line 27, col 20) +27 >] = ["none", "none"]] = multiRobotA, i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (805 to 811) SpanInfo: {"start":806,"length":5} + >i = 0 + >:=> (line 27, col 37) to (line 27, col 42) +27 >] = ["none", "none"]] = multiRobotA, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (812 to 818) SpanInfo: {"start":813,"length":5} + >i < 1 + >:=> (line 27, col 44) to (line 27, col 49) +27 >] = ["none", "none"]] = multiRobotA, i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (819 to 826) SpanInfo: {"start":820,"length":3} + >i++ + >:=> (line 27, col 51) to (line 27, col 54) +-------------------------------- +28 > console.log(primarySkillA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (827 to 858) SpanInfo: {"start":831,"length":26} + >console.log(primarySkillA) + >:=> (line 28, col 4) to (line 28, col 30) +-------------------------------- +29 >} + + ~~ => Pos: (859 to 860) SpanInfo: {"start":831,"length":26} + >console.log(primarySkillA) + >:=> (line 28, col 4) to (line 28, col 30) +-------------------------------- +30 >for (let [, [ + + ~~~~~~~~~~~ => Pos: (861 to 871) SpanInfo: {"start":873,"length":87} + >[ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + >] = ["none", "none"] + >:=> (line 30, col 12) to (line 33, col 20) +30 >for (let [, [ + + ~~~ => Pos: (872 to 874) SpanInfo: {"start":879,"length":25} + >primarySkillA = "primary" + >:=> (line 31, col 4) to (line 31, col 29) +-------------------------------- +31 > primarySkillA = "primary", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (875 to 905) SpanInfo: {"start":879,"length":25} + >primarySkillA = "primary" + >:=> (line 31, col 4) to (line 31, col 29) +-------------------------------- +32 > secondarySkillA = "secondary" + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (906 to 939) SpanInfo: {"start":910,"length":29} + >secondarySkillA = "secondary" + >:=> (line 32, col 4) to (line 32, col 33) +-------------------------------- +33 >] = ["none", "none"]] = getMultiRobot(), i = 0; i < 1; i++) { + + ~ => Pos: (940 to 940) SpanInfo: {"start":910,"length":29} + >secondarySkillA = "secondary" + >:=> (line 32, col 4) to (line 32, col 33) +33 >] = ["none", "none"]] = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (941 to 979) SpanInfo: {"start":873,"length":87} + >[ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + >] = ["none", "none"] + >:=> (line 30, col 12) to (line 33, col 20) +33 >] = ["none", "none"]] = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (980 to 986) SpanInfo: {"start":981,"length":5} + >i = 0 + >:=> (line 33, col 41) to (line 33, col 46) +33 >] = ["none", "none"]] = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (987 to 993) SpanInfo: {"start":988,"length":5} + >i < 1 + >:=> (line 33, col 48) to (line 33, col 53) +33 >] = ["none", "none"]] = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (994 to 1001) SpanInfo: {"start":995,"length":3} + >i++ + >:=> (line 33, col 55) to (line 33, col 58) +-------------------------------- +34 > console.log(primarySkillA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1002 to 1033) SpanInfo: {"start":1006,"length":26} + >console.log(primarySkillA) + >:=> (line 34, col 4) to (line 34, col 30) +-------------------------------- +35 >} + + ~~ => Pos: (1034 to 1035) SpanInfo: {"start":1006,"length":26} + >console.log(primarySkillA) + >:=> (line 34, col 4) to (line 34, col 30) +-------------------------------- +36 >for (let [, [ + + ~~~~~~~~~~~ => Pos: (1036 to 1046) SpanInfo: {"start":1048,"length":87} + >[ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + >] = ["none", "none"] + >:=> (line 36, col 12) to (line 39, col 20) +36 >for (let [, [ + + ~~~ => Pos: (1047 to 1049) SpanInfo: {"start":1054,"length":25} + >primarySkillA = "primary" + >:=> (line 37, col 4) to (line 37, col 29) +-------------------------------- +37 > primarySkillA = "primary", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1050 to 1080) SpanInfo: {"start":1054,"length":25} + >primarySkillA = "primary" + >:=> (line 37, col 4) to (line 37, col 29) +-------------------------------- +38 > secondarySkillA = "secondary" + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1081 to 1114) SpanInfo: {"start":1085,"length":29} + >secondarySkillA = "secondary" + >:=> (line 38, col 4) to (line 38, col 33) +-------------------------------- +39 >] = ["none", "none"]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + + ~ => Pos: (1115 to 1115) SpanInfo: {"start":1085,"length":29} + >secondarySkillA = "secondary" + >:=> (line 38, col 4) to (line 38, col 33) +39 >] = ["none", "none"]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1116 to 1174) SpanInfo: {"start":1048,"length":87} + >[ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + >] = ["none", "none"] + >:=> (line 36, col 12) to (line 39, col 20) +39 >] = ["none", "none"]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1175 to 1181) SpanInfo: {"start":1176,"length":5} + >i = 0 + >:=> (line 39, col 61) to (line 39, col 66) +39 >] = ["none", "none"]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1182 to 1188) SpanInfo: {"start":1183,"length":5} + >i < 1 + >:=> (line 39, col 68) to (line 39, col 73) +39 >] = ["none", "none"]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (1189 to 1196) SpanInfo: {"start":1190,"length":3} + >i++ + >:=> (line 39, col 75) to (line 39, col 78) +-------------------------------- +40 > console.log(primarySkillA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1197 to 1228) SpanInfo: {"start":1201,"length":26} + >console.log(primarySkillA) + >:=> (line 40, col 4) to (line 40, col 30) +-------------------------------- +41 >} + + ~~ => Pos: (1229 to 1230) SpanInfo: {"start":1201,"length":26} + >console.log(primarySkillA) + >:=> (line 40, col 4) to (line 40, col 30) +-------------------------------- +42 >for (let [numberB = -1] = robotA, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1231 to 1263) SpanInfo: {"start":1241,"length":12} + >numberB = -1 + >:=> (line 42, col 10) to (line 42, col 22) +42 >for (let [numberB = -1] = robotA, i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (1264 to 1270) SpanInfo: {"start":1265,"length":5} + >i = 0 + >:=> (line 42, col 34) to (line 42, col 39) +42 >for (let [numberB = -1] = robotA, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1271 to 1277) SpanInfo: {"start":1272,"length":5} + >i < 1 + >:=> (line 42, col 41) to (line 42, col 46) +42 >for (let [numberB = -1] = robotA, i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (1278 to 1285) SpanInfo: {"start":1279,"length":3} + >i++ + >:=> (line 42, col 48) to (line 42, col 51) +-------------------------------- +43 > console.log(numberB); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1286 to 1311) SpanInfo: {"start":1290,"length":20} + >console.log(numberB) + >:=> (line 43, col 4) to (line 43, col 24) +-------------------------------- +44 >} + + ~~ => Pos: (1312 to 1313) SpanInfo: {"start":1290,"length":20} + >console.log(numberB) + >:=> (line 43, col 4) to (line 43, col 24) +-------------------------------- +45 >for (let [numberB = -1] = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1314 to 1350) SpanInfo: {"start":1324,"length":12} + >numberB = -1 + >:=> (line 45, col 10) to (line 45, col 22) +45 >for (let [numberB = -1] = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (1351 to 1357) SpanInfo: {"start":1352,"length":5} + >i = 0 + >:=> (line 45, col 38) to (line 45, col 43) +45 >for (let [numberB = -1] = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1358 to 1364) SpanInfo: {"start":1359,"length":5} + >i < 1 + >:=> (line 45, col 45) to (line 45, col 50) +45 >for (let [numberB = -1] = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (1365 to 1372) SpanInfo: {"start":1366,"length":3} + >i++ + >:=> (line 45, col 52) to (line 45, col 55) +-------------------------------- +46 > console.log(numberB); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1373 to 1398) SpanInfo: {"start":1377,"length":20} + >console.log(numberB) + >:=> (line 46, col 4) to (line 46, col 24) +-------------------------------- +47 >} + + ~~ => Pos: (1399 to 1400) SpanInfo: {"start":1377,"length":20} + >console.log(numberB) + >:=> (line 46, col 4) to (line 46, col 24) +-------------------------------- +48 >for (let [numberB = -1] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1401 to 1453) SpanInfo: {"start":1411,"length":12} + >numberB = -1 + >:=> (line 48, col 10) to (line 48, col 22) +48 >for (let [numberB = -1] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1454 to 1460) SpanInfo: {"start":1455,"length":5} + >i = 0 + >:=> (line 48, col 54) to (line 48, col 59) +48 >for (let [numberB = -1] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1461 to 1467) SpanInfo: {"start":1462,"length":5} + >i < 1 + >:=> (line 48, col 61) to (line 48, col 66) +48 >for (let [numberB = -1] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (1468 to 1475) SpanInfo: {"start":1469,"length":3} + >i++ + >:=> (line 48, col 68) to (line 48, col 71) +-------------------------------- +49 > console.log(numberB); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1476 to 1501) SpanInfo: {"start":1480,"length":20} + >console.log(numberB) + >:=> (line 49, col 4) to (line 49, col 24) +-------------------------------- +50 >} + + ~~ => Pos: (1502 to 1503) SpanInfo: {"start":1480,"length":20} + >console.log(numberB) + >:=> (line 49, col 4) to (line 49, col 24) +-------------------------------- +51 >for (let [nameB = "name"] = multiRobotA, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1504 to 1543) SpanInfo: {"start":1514,"length":14} + >nameB = "name" + >:=> (line 51, col 10) to (line 51, col 24) +51 >for (let [nameB = "name"] = multiRobotA, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1544 to 1550) SpanInfo: {"start":1545,"length":5} + >i = 0 + >:=> (line 51, col 41) to (line 51, col 46) +51 >for (let [nameB = "name"] = multiRobotA, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1551 to 1557) SpanInfo: {"start":1552,"length":5} + >i < 1 + >:=> (line 51, col 48) to (line 51, col 53) +51 >for (let [nameB = "name"] = multiRobotA, i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (1558 to 1565) SpanInfo: {"start":1559,"length":3} + >i++ + >:=> (line 51, col 55) to (line 51, col 58) +-------------------------------- +52 > console.log(nameB); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1566 to 1589) SpanInfo: {"start":1570,"length":18} + >console.log(nameB) + >:=> (line 52, col 4) to (line 52, col 22) +-------------------------------- +53 >} + + ~~ => Pos: (1590 to 1591) SpanInfo: {"start":1570,"length":18} + >console.log(nameB) + >:=> (line 52, col 4) to (line 52, col 22) +-------------------------------- +54 >for (let [nameB = "name"] = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1592 to 1635) SpanInfo: {"start":1602,"length":14} + >nameB = "name" + >:=> (line 54, col 10) to (line 54, col 24) +54 >for (let [nameB = "name"] = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1636 to 1642) SpanInfo: {"start":1637,"length":5} + >i = 0 + >:=> (line 54, col 45) to (line 54, col 50) +54 >for (let [nameB = "name"] = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1643 to 1649) SpanInfo: {"start":1644,"length":5} + >i < 1 + >:=> (line 54, col 52) to (line 54, col 57) +54 >for (let [nameB = "name"] = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (1650 to 1657) SpanInfo: {"start":1651,"length":3} + >i++ + >:=> (line 54, col 59) to (line 54, col 62) +-------------------------------- +55 > console.log(nameB); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1658 to 1681) SpanInfo: {"start":1662,"length":18} + >console.log(nameB) + >:=> (line 55, col 4) to (line 55, col 22) +-------------------------------- +56 >} + + ~~ => Pos: (1682 to 1683) SpanInfo: {"start":1662,"length":18} + >console.log(nameB) + >:=> (line 55, col 4) to (line 55, col 22) +-------------------------------- +57 >for (let [nameB = "name"] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1684 to 1747) SpanInfo: {"start":1694,"length":14} + >nameB = "name" + >:=> (line 57, col 10) to (line 57, col 24) +57 >for (let [nameB = "name"] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1748 to 1754) SpanInfo: {"start":1749,"length":5} + >i = 0 + >:=> (line 57, col 65) to (line 57, col 70) +57 >for (let [nameB = "name"] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1755 to 1761) SpanInfo: {"start":1756,"length":5} + >i < 1 + >:=> (line 57, col 72) to (line 57, col 77) +57 >for (let [nameB = "name"] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (1762 to 1769) SpanInfo: {"start":1763,"length":3} + >i++ + >:=> (line 57, col 79) to (line 57, col 82) +-------------------------------- +58 > console.log(nameB); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1770 to 1793) SpanInfo: {"start":1774,"length":18} + >console.log(nameB) + >:=> (line 58, col 4) to (line 58, col 22) +-------------------------------- +59 >} + + ~~ => Pos: (1794 to 1795) SpanInfo: {"start":1774,"length":18} + >console.log(nameB) + >:=> (line 58, col 4) to (line 58, col 22) +-------------------------------- +60 >for (let [numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = robotA, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1796 to 1819) SpanInfo: {"start":1806,"length":13} + >numberA2 = -1 + >:=> (line 60, col 10) to (line 60, col 23) +60 >for (let [numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = robotA, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~ => Pos: (1820 to 1836) SpanInfo: {"start":1821,"length":15} + >nameA2 = "name" + >:=> (line 60, col 25) to (line 60, col 40) +60 >for (let [numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = robotA, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1837 to 1865) SpanInfo: {"start":1838,"length":17} + >skillA2 = "skill" + >:=> (line 60, col 42) to (line 60, col 59) +60 >for (let [numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = robotA, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1866 to 1872) SpanInfo: {"start":1867,"length":5} + >i = 0 + >:=> (line 60, col 71) to (line 60, col 76) +60 >for (let [numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = robotA, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1873 to 1879) SpanInfo: {"start":1874,"length":5} + >i < 1 + >:=> (line 60, col 78) to (line 60, col 83) +60 >for (let [numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = robotA, i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (1880 to 1887) SpanInfo: {"start":1881,"length":3} + >i++ + >:=> (line 60, col 85) to (line 60, col 88) +-------------------------------- +61 > console.log(nameA2); + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1888 to 1912) SpanInfo: {"start":1892,"length":19} + >console.log(nameA2) + >:=> (line 61, col 4) to (line 61, col 23) +-------------------------------- +62 >} + + ~~ => Pos: (1913 to 1914) SpanInfo: {"start":1892,"length":19} + >console.log(nameA2) + >:=> (line 61, col 4) to (line 61, col 23) +-------------------------------- +63 >for (let [numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1915 to 1938) SpanInfo: {"start":1925,"length":13} + >numberA2 = -1 + >:=> (line 63, col 10) to (line 63, col 23) +63 >for (let [numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~ => Pos: (1939 to 1955) SpanInfo: {"start":1940,"length":15} + >nameA2 = "name" + >:=> (line 63, col 25) to (line 63, col 40) +63 >for (let [numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1956 to 1988) SpanInfo: {"start":1957,"length":17} + >skillA2 = "skill" + >:=> (line 63, col 42) to (line 63, col 59) +63 >for (let [numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1989 to 1995) SpanInfo: {"start":1990,"length":5} + >i = 0 + >:=> (line 63, col 75) to (line 63, col 80) +63 >for (let [numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1996 to 2002) SpanInfo: {"start":1997,"length":5} + >i < 1 + >:=> (line 63, col 82) to (line 63, col 87) +63 >for (let [numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (2003 to 2010) SpanInfo: {"start":2004,"length":3} + >i++ + >:=> (line 63, col 89) to (line 63, col 92) +-------------------------------- +64 > console.log(nameA2); + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2011 to 2035) SpanInfo: {"start":2015,"length":19} + >console.log(nameA2) + >:=> (line 64, col 4) to (line 64, col 23) +-------------------------------- +65 >} + + ~~ => Pos: (2036 to 2037) SpanInfo: {"start":2015,"length":19} + >console.log(nameA2) + >:=> (line 64, col 4) to (line 64, col 23) +-------------------------------- +66 >for (let [numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2038 to 2061) SpanInfo: {"start":2048,"length":13} + >numberA2 = -1 + >:=> (line 66, col 10) to (line 66, col 23) +66 >for (let [numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~ => Pos: (2062 to 2078) SpanInfo: {"start":2063,"length":15} + >nameA2 = "name" + >:=> (line 66, col 25) to (line 66, col 40) +66 >for (let [numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (2079 to 2127) SpanInfo: {"start":2080,"length":17} + >skillA2 = "skill" + >:=> (line 66, col 42) to (line 66, col 59) +66 >for (let [numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (2128 to 2134) SpanInfo: {"start":2129,"length":5} + >i = 0 + >:=> (line 66, col 91) to (line 66, col 96) +66 >for (let [numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (2135 to 2141) SpanInfo: {"start":2136,"length":5} + >i < 1 + >:=> (line 66, col 98) to (line 66, col 103) +66 >for (let [numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (2142 to 2149) SpanInfo: {"start":2143,"length":3} + >i++ + >:=> (line 66, col 105) to (line 66, col 108) +-------------------------------- +67 > console.log(nameA2); + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2150 to 2174) SpanInfo: {"start":2154,"length":19} + >console.log(nameA2) + >:=> (line 67, col 4) to (line 67, col 23) +-------------------------------- +68 >} + + ~~ => Pos: (2175 to 2176) SpanInfo: {"start":2154,"length":19} + >console.log(nameA2) + >:=> (line 67, col 4) to (line 67, col 23) +-------------------------------- +69 >for (let + + ~~~~~~~~~ => Pos: (2177 to 2185) SpanInfo: {"start":2191,"length":17} + >nameMA = "noName" + >:=> (line 70, col 5) to (line 70, col 22) +-------------------------------- +70 > [nameMA = "noName", + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2186 to 2209) SpanInfo: {"start":2191,"length":17} + >nameMA = "noName" + >:=> (line 70, col 5) to (line 70, col 22) +-------------------------------- +71 > [ + + ~~~~~~~~~~ => Pos: (2210 to 2219) SpanInfo: {"start":2232,"length":25} + >primarySkillA = "primary" + >:=> (line 72, col 12) to (line 72, col 37) +-------------------------------- +72 > primarySkillA = "primary", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2220 to 2258) SpanInfo: {"start":2232,"length":25} + >primarySkillA = "primary" + >:=> (line 72, col 12) to (line 72, col 37) +-------------------------------- +73 > secondarySkillA = "secondary" + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2259 to 2300) SpanInfo: {"start":2271,"length":29} + >secondarySkillA = "secondary" + >:=> (line 73, col 12) to (line 73, col 41) +-------------------------------- +74 > ] = ["none", "none"] + + ~~~~~~~~~ => Pos: (2301 to 2309) SpanInfo: {"start":2271,"length":29} + >secondarySkillA = "secondary" + >:=> (line 73, col 12) to (line 73, col 41) +74 > ] = ["none", "none"] + + ~~~~~~~~~~~~~~~~~~~~ => Pos: (2310 to 2329) SpanInfo: {"start":2218,"length":111} + >[ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["none", "none"] + >:=> (line 71, col 8) to (line 74, col 28) +-------------------------------- +75 > ] = multiRobotA, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~ => Pos: (2330 to 2349) SpanInfo: {"start":2218,"length":111} + >[ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["none", "none"] + >:=> (line 71, col 8) to (line 74, col 28) +75 > ] = multiRobotA, i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (2350 to 2356) SpanInfo: {"start":2351,"length":5} + >i = 0 + >:=> (line 75, col 21) to (line 75, col 26) +75 > ] = multiRobotA, i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (2357 to 2363) SpanInfo: {"start":2358,"length":5} + >i < 1 + >:=> (line 75, col 28) to (line 75, col 33) +75 > ] = multiRobotA, i = 0; i < 1; i++) { + + ~~~~~~~~ => Pos: (2364 to 2371) SpanInfo: {"start":2365,"length":3} + >i++ + >:=> (line 75, col 35) to (line 75, col 38) +-------------------------------- +76 > console.log(nameMA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2372 to 2396) SpanInfo: {"start":2376,"length":19} + >console.log(nameMA) + >:=> (line 76, col 4) to (line 76, col 23) +-------------------------------- +77 >} + + ~~ => Pos: (2397 to 2398) SpanInfo: {"start":2376,"length":19} + >console.log(nameMA) + >:=> (line 76, col 4) to (line 76, col 23) +-------------------------------- +78 >for (let [nameMA = "noName", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2399 to 2427) SpanInfo: {"start":2409,"length":17} + >nameMA = "noName" + >:=> (line 78, col 10) to (line 78, col 27) +-------------------------------- +79 > [ + + ~~~~~~ => Pos: (2428 to 2433) SpanInfo: {"start":2442,"length":25} + >primarySkillA = "primary" + >:=> (line 80, col 8) to (line 80, col 33) +-------------------------------- +80 > primarySkillA = "primary", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2434 to 2468) SpanInfo: {"start":2442,"length":25} + >primarySkillA = "primary" + >:=> (line 80, col 8) to (line 80, col 33) +-------------------------------- +81 > secondarySkillA = "secondary" + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2469 to 2506) SpanInfo: {"start":2477,"length":29} + >secondarySkillA = "secondary" + >:=> (line 81, col 8) to (line 81, col 37) +-------------------------------- +82 > ] = ["none", "none"] + + ~~~~~ => Pos: (2507 to 2511) SpanInfo: {"start":2477,"length":29} + >secondarySkillA = "secondary" + >:=> (line 81, col 8) to (line 81, col 37) +82 > ] = ["none", "none"] + + ~~~~~~~~~~~~~~~~~~~~ => Pos: (2512 to 2531) SpanInfo: {"start":2432,"length":99} + >[ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["none", "none"] + >:=> (line 79, col 4) to (line 82, col 24) +-------------------------------- +83 >] = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~ => Pos: (2532 to 2552) SpanInfo: {"start":2432,"length":99} + >[ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["none", "none"] + >:=> (line 79, col 4) to (line 82, col 24) +83 >] = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (2553 to 2559) SpanInfo: {"start":2554,"length":5} + >i = 0 + >:=> (line 83, col 22) to (line 83, col 27) +83 >] = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (2560 to 2566) SpanInfo: {"start":2561,"length":5} + >i < 1 + >:=> (line 83, col 29) to (line 83, col 34) +83 >] = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~ => Pos: (2567 to 2574) SpanInfo: {"start":2568,"length":3} + >i++ + >:=> (line 83, col 36) to (line 83, col 39) +-------------------------------- +84 > console.log(nameMA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2575 to 2599) SpanInfo: {"start":2579,"length":19} + >console.log(nameMA) + >:=> (line 84, col 4) to (line 84, col 23) +-------------------------------- +85 >} + + ~~ => Pos: (2600 to 2601) SpanInfo: {"start":2579,"length":19} + >console.log(nameMA) + >:=> (line 84, col 4) to (line 84, col 23) +-------------------------------- +86 >for (let [nameMA = "noName", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2602 to 2630) SpanInfo: {"start":2612,"length":17} + >nameMA = "noName" + >:=> (line 86, col 10) to (line 86, col 27) +-------------------------------- +87 > [ + + ~~~~~~ => Pos: (2631 to 2636) SpanInfo: {"start":2645,"length":25} + >primarySkillA = "primary" + >:=> (line 88, col 8) to (line 88, col 33) +-------------------------------- +88 > primarySkillA = "primary", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2637 to 2671) SpanInfo: {"start":2645,"length":25} + >primarySkillA = "primary" + >:=> (line 88, col 8) to (line 88, col 33) +-------------------------------- +89 > secondarySkillA = "secondary" + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2672 to 2709) SpanInfo: {"start":2680,"length":29} + >secondarySkillA = "secondary" + >:=> (line 89, col 8) to (line 89, col 37) +-------------------------------- +90 > ] = ["none", "none"] + + ~~~~~ => Pos: (2710 to 2714) SpanInfo: {"start":2680,"length":29} + >secondarySkillA = "secondary" + >:=> (line 89, col 8) to (line 89, col 37) +90 > ] = ["none", "none"] + + ~~~~~~~~~~~~~~~~~~~~ => Pos: (2715 to 2734) SpanInfo: {"start":2635,"length":99} + >[ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["none", "none"] + >:=> (line 87, col 4) to (line 90, col 24) +-------------------------------- +91 >] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2735 to 2775) SpanInfo: {"start":2635,"length":99} + >[ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["none", "none"] + >:=> (line 87, col 4) to (line 90, col 24) +91 >] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (2776 to 2782) SpanInfo: {"start":2777,"length":5} + >i = 0 + >:=> (line 91, col 42) to (line 91, col 47) +91 >] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (2783 to 2789) SpanInfo: {"start":2784,"length":5} + >i < 1 + >:=> (line 91, col 49) to (line 91, col 54) +91 >] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (2790 to 2797) SpanInfo: {"start":2791,"length":3} + >i++ + >:=> (line 91, col 56) to (line 91, col 59) +-------------------------------- +92 > console.log(nameMA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2798 to 2822) SpanInfo: {"start":2802,"length":19} + >console.log(nameMA) + >:=> (line 92, col 4) to (line 92, col 23) +-------------------------------- +93 >} + + ~~ => Pos: (2823 to 2824) SpanInfo: {"start":2802,"length":19} + >console.log(nameMA) + >:=> (line 92, col 4) to (line 92, col 23) +-------------------------------- +94 >for (let [numberA3 = -1, ...robotAInfo] = robotA, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2825 to 2848) SpanInfo: {"start":2835,"length":13} + >numberA3 = -1 + >:=> (line 94, col 10) to (line 94, col 23) +94 >for (let [numberA3 = -1, ...robotAInfo] = robotA, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (2849 to 2873) SpanInfo: {"start":2850,"length":13} + >...robotAInfo + >:=> (line 94, col 25) to (line 94, col 38) +94 >for (let [numberA3 = -1, ...robotAInfo] = robotA, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (2874 to 2880) SpanInfo: {"start":2875,"length":5} + >i = 0 + >:=> (line 94, col 50) to (line 94, col 55) +94 >for (let [numberA3 = -1, ...robotAInfo] = robotA, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (2881 to 2887) SpanInfo: {"start":2882,"length":5} + >i < 1 + >:=> (line 94, col 57) to (line 94, col 62) +94 >for (let [numberA3 = -1, ...robotAInfo] = robotA, i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (2888 to 2895) SpanInfo: {"start":2889,"length":3} + >i++ + >:=> (line 94, col 64) to (line 94, col 67) +-------------------------------- +95 > console.log(numberA3); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2896 to 2922) SpanInfo: {"start":2900,"length":21} + >console.log(numberA3) + >:=> (line 95, col 4) to (line 95, col 25) +-------------------------------- +96 >} + + ~~ => Pos: (2923 to 2924) SpanInfo: {"start":2900,"length":21} + >console.log(numberA3) + >:=> (line 95, col 4) to (line 95, col 25) +-------------------------------- +97 >for (let [numberA3 = -1, ...robotAInfo] = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2925 to 2948) SpanInfo: {"start":2935,"length":13} + >numberA3 = -1 + >:=> (line 97, col 10) to (line 97, col 23) +97 >for (let [numberA3 = -1, ...robotAInfo] = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (2949 to 2977) SpanInfo: {"start":2950,"length":13} + >...robotAInfo + >:=> (line 97, col 25) to (line 97, col 38) +97 >for (let [numberA3 = -1, ...robotAInfo] = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (2978 to 2984) SpanInfo: {"start":2979,"length":5} + >i = 0 + >:=> (line 97, col 54) to (line 97, col 59) +97 >for (let [numberA3 = -1, ...robotAInfo] = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (2985 to 2991) SpanInfo: {"start":2986,"length":5} + >i < 1 + >:=> (line 97, col 61) to (line 97, col 66) +97 >for (let [numberA3 = -1, ...robotAInfo] = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (2992 to 2999) SpanInfo: {"start":2993,"length":3} + >i++ + >:=> (line 97, col 68) to (line 97, col 71) +-------------------------------- +98 > console.log(numberA3); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (3000 to 3026) SpanInfo: {"start":3004,"length":21} + >console.log(numberA3) + >:=> (line 98, col 4) to (line 98, col 25) +-------------------------------- +99 >} + + ~~ => Pos: (3027 to 3028) SpanInfo: {"start":3004,"length":21} + >console.log(numberA3) + >:=> (line 98, col 4) to (line 98, col 25) +-------------------------------- +100>for (let [numberA3 = -1, ...robotAInfo] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (3029 to 3052) SpanInfo: {"start":3039,"length":13} + >numberA3 = -1 + >:=> (line 100, col 10) to (line 100, col 23) +100>for (let [numberA3 = -1, ...robotAInfo] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (3053 to 3097) SpanInfo: {"start":3054,"length":13} + >...robotAInfo + >:=> (line 100, col 25) to (line 100, col 38) +100>for (let [numberA3 = -1, ...robotAInfo] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (3098 to 3104) SpanInfo: {"start":3099,"length":5} + >i = 0 + >:=> (line 100, col 70) to (line 100, col 75) +100>for (let [numberA3 = -1, ...robotAInfo] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (3105 to 3111) SpanInfo: {"start":3106,"length":5} + >i < 1 + >:=> (line 100, col 77) to (line 100, col 82) +100>for (let [numberA3 = -1, ...robotAInfo] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (3112 to 3119) SpanInfo: {"start":3113,"length":3} + >i++ + >:=> (line 100, col 84) to (line 100, col 87) +-------------------------------- +101> console.log(numberA3); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (3120 to 3146) SpanInfo: {"start":3124,"length":21} + >console.log(numberA3) + >:=> (line 101, col 4) to (line 101, col 25) +-------------------------------- +102>} + ~ => Pos: (3147 to 3147) SpanInfo: {"start":3124,"length":21} + >console.log(numberA3) + >:=> (line 101, col 4) to (line 101, col 25) \ No newline at end of file diff --git a/tests/baselines/reference/bpSpanDestructuringForObjectBindingPattern.baseline b/tests/baselines/reference/bpSpanDestructuringForObjectBindingPattern.baseline new file mode 100644 index 00000000000..718799a8334 --- /dev/null +++ b/tests/baselines/reference/bpSpanDestructuringForObjectBindingPattern.baseline @@ -0,0 +1,633 @@ + +1 >declare var console: { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (0 to 22) SpanInfo: undefined +-------------------------------- +2 > log(msg: any): void; + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (23 to 47) SpanInfo: undefined +-------------------------------- +3 >} + + ~~ => Pos: (48 to 49) SpanInfo: undefined +-------------------------------- +4 >interface Robot { + + ~~~~~~~~~~~~~~~~~~ => Pos: (50 to 67) SpanInfo: undefined +-------------------------------- +5 > name: string; + + ~~~~~~~~~~~~~~~~~~ => Pos: (68 to 85) SpanInfo: undefined +-------------------------------- +6 > skill: string; + + ~~~~~~~~~~~~~~~~~~~ => Pos: (86 to 104) SpanInfo: undefined +-------------------------------- +7 >} + + ~~ => Pos: (105 to 106) SpanInfo: undefined +-------------------------------- +8 >interface MultiRobot { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (107 to 129) SpanInfo: undefined +-------------------------------- +9 > name: string; + + ~~~~~~~~~~~~~~~~~~ => Pos: (130 to 147) SpanInfo: undefined +-------------------------------- +10 > skills: { + + ~~~~~~~~~~~~~~ => Pos: (148 to 161) SpanInfo: undefined +-------------------------------- +11 > primary: string; + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (162 to 186) SpanInfo: undefined +-------------------------------- +12 > secondary: string; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (187 to 213) SpanInfo: undefined +-------------------------------- +13 > }; + + ~~~~~~~ => Pos: (214 to 220) SpanInfo: undefined +-------------------------------- +14 >} + + ~~ => Pos: (221 to 222) SpanInfo: undefined +-------------------------------- +15 >let robot: Robot = { name: "mower", skill: "mowing" }; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (223 to 277) SpanInfo: {"start":223,"length":53} + >let robot: Robot = { name: "mower", skill: "mowing" } + >:=> (line 15, col 0) to (line 15, col 53) +-------------------------------- +16 >let multiRobot: MultiRobot = { name: "mower", skills: { primary: "mowing", secondary: "none" } }; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (278 to 375) SpanInfo: {"start":278,"length":96} + >let multiRobot: MultiRobot = { name: "mower", skills: { primary: "mowing", secondary: "none" } } + >:=> (line 16, col 0) to (line 16, col 96) +-------------------------------- +17 >function getRobot() { + + ~~~~~~~~~~~~~~~~~~~~~~ => Pos: (376 to 397) SpanInfo: {"start":402,"length":12} + >return robot + >:=> (line 18, col 4) to (line 18, col 16) +-------------------------------- +18 > return robot; + + ~~~~~~~~~~~~~~~~~~ => Pos: (398 to 415) SpanInfo: {"start":402,"length":12} + >return robot + >:=> (line 18, col 4) to (line 18, col 16) +-------------------------------- +19 >} + + ~~ => Pos: (416 to 417) SpanInfo: {"start":416,"length":1} + >} + >:=> (line 19, col 0) to (line 19, col 1) +-------------------------------- +20 >function getMultiRobot() { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (418 to 444) SpanInfo: {"start":449,"length":17} + >return multiRobot + >:=> (line 21, col 4) to (line 21, col 21) +-------------------------------- +21 > return multiRobot; + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (445 to 467) SpanInfo: {"start":449,"length":17} + >return multiRobot + >:=> (line 21, col 4) to (line 21, col 21) +-------------------------------- +22 >} + + ~~ => Pos: (468 to 469) SpanInfo: {"start":468,"length":1} + >} + >:=> (line 22, col 0) to (line 22, col 1) +-------------------------------- +23 >for (let {name: nameA } = robot, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (470 to 501) SpanInfo: {"start":480,"length":11} + >name: nameA + >:=> (line 23, col 10) to (line 23, col 21) +23 >for (let {name: nameA } = robot, i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (502 to 508) SpanInfo: {"start":503,"length":5} + >i = 0 + >:=> (line 23, col 33) to (line 23, col 38) +23 >for (let {name: nameA } = robot, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (509 to 515) SpanInfo: {"start":510,"length":5} + >i < 1 + >:=> (line 23, col 40) to (line 23, col 45) +23 >for (let {name: nameA } = robot, i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (516 to 523) SpanInfo: {"start":517,"length":3} + >i++ + >:=> (line 23, col 47) to (line 23, col 50) +-------------------------------- +24 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (524 to 547) SpanInfo: {"start":528,"length":18} + >console.log(nameA) + >:=> (line 24, col 4) to (line 24, col 22) +-------------------------------- +25 >} + + ~~ => Pos: (548 to 549) SpanInfo: {"start":528,"length":18} + >console.log(nameA) + >:=> (line 24, col 4) to (line 24, col 22) +-------------------------------- +26 >for (let {name: nameA } = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (550 to 586) SpanInfo: {"start":560,"length":11} + >name: nameA + >:=> (line 26, col 10) to (line 26, col 21) +26 >for (let {name: nameA } = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (587 to 593) SpanInfo: {"start":588,"length":5} + >i = 0 + >:=> (line 26, col 38) to (line 26, col 43) +26 >for (let {name: nameA } = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (594 to 600) SpanInfo: {"start":595,"length":5} + >i < 1 + >:=> (line 26, col 45) to (line 26, col 50) +26 >for (let {name: nameA } = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (601 to 608) SpanInfo: {"start":602,"length":3} + >i++ + >:=> (line 26, col 52) to (line 26, col 55) +-------------------------------- +27 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (609 to 632) SpanInfo: {"start":613,"length":18} + >console.log(nameA) + >:=> (line 27, col 4) to (line 27, col 22) +-------------------------------- +28 >} + + ~~ => Pos: (633 to 634) SpanInfo: {"start":613,"length":18} + >console.log(nameA) + >:=> (line 27, col 4) to (line 27, col 22) +-------------------------------- +29 >for (let {name: nameA } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (635 to 706) SpanInfo: {"start":645,"length":11} + >name: nameA + >:=> (line 29, col 10) to (line 29, col 21) +29 >for (let {name: nameA } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (707 to 713) SpanInfo: {"start":708,"length":5} + >i = 0 + >:=> (line 29, col 73) to (line 29, col 78) +29 >for (let {name: nameA } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (714 to 720) SpanInfo: {"start":715,"length":5} + >i < 1 + >:=> (line 29, col 80) to (line 29, col 85) +29 >for (let {name: nameA } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (721 to 728) SpanInfo: {"start":722,"length":3} + >i++ + >:=> (line 29, col 87) to (line 29, col 90) +-------------------------------- +30 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (729 to 752) SpanInfo: {"start":733,"length":18} + >console.log(nameA) + >:=> (line 30, col 4) to (line 30, col 22) +-------------------------------- +31 >} + + ~~ => Pos: (753 to 754) SpanInfo: {"start":733,"length":18} + >console.log(nameA) + >:=> (line 30, col 4) to (line 30, col 22) +-------------------------------- +32 >for (let { skills: { primary: primaryA, secondary: secondaryA } } = multiRobot, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~ => Pos: (755 to 772) SpanInfo: {"start":766,"length":52} + >skills: { primary: primaryA, secondary: secondaryA } + >:=> (line 32, col 11) to (line 32, col 63) +32 >for (let { skills: { primary: primaryA, secondary: secondaryA } } = multiRobot, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~ => Pos: (773 to 793) SpanInfo: {"start":776,"length":17} + >primary: primaryA + >:=> (line 32, col 21) to (line 32, col 38) +32 >for (let { skills: { primary: primaryA, secondary: secondaryA } } = multiRobot, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (794 to 817) SpanInfo: {"start":795,"length":21} + >secondary: secondaryA + >:=> (line 32, col 40) to (line 32, col 61) +32 >for (let { skills: { primary: primaryA, secondary: secondaryA } } = multiRobot, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~=> Pos: (818 to 833) SpanInfo: {"start":766,"length":52} + >skills: { primary: primaryA, secondary: secondaryA } + >:=> (line 32, col 11) to (line 32, col 63) +32 >for (let { skills: { primary: primaryA, secondary: secondaryA } } = multiRobot, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (834 to 840) SpanInfo: {"start":835,"length":5} + >i = 0 + >:=> (line 32, col 80) to (line 32, col 85) +32 >for (let { skills: { primary: primaryA, secondary: secondaryA } } = multiRobot, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (841 to 847) SpanInfo: {"start":842,"length":5} + >i < 1 + >:=> (line 32, col 87) to (line 32, col 92) +32 >for (let { skills: { primary: primaryA, secondary: secondaryA } } = multiRobot, i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (848 to 855) SpanInfo: {"start":849,"length":3} + >i++ + >:=> (line 32, col 94) to (line 32, col 97) +-------------------------------- +33 > console.log(primaryA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (856 to 882) SpanInfo: {"start":860,"length":21} + >console.log(primaryA) + >:=> (line 33, col 4) to (line 33, col 25) +-------------------------------- +34 >} + + ~~ => Pos: (883 to 884) SpanInfo: {"start":860,"length":21} + >console.log(primaryA) + >:=> (line 33, col 4) to (line 33, col 25) +-------------------------------- +35 >for (let { skills: { primary: primaryA, secondary: secondaryA } } = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~ => Pos: (885 to 902) SpanInfo: {"start":896,"length":52} + >skills: { primary: primaryA, secondary: secondaryA } + >:=> (line 35, col 11) to (line 35, col 63) +35 >for (let { skills: { primary: primaryA, secondary: secondaryA } } = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~ => Pos: (903 to 923) SpanInfo: {"start":906,"length":17} + >primary: primaryA + >:=> (line 35, col 21) to (line 35, col 38) +35 >for (let { skills: { primary: primaryA, secondary: secondaryA } } = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (924 to 947) SpanInfo: {"start":925,"length":21} + >secondary: secondaryA + >:=> (line 35, col 40) to (line 35, col 61) +35 >for (let { skills: { primary: primaryA, secondary: secondaryA } } = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~=> Pos: (948 to 968) SpanInfo: {"start":896,"length":52} + >skills: { primary: primaryA, secondary: secondaryA } + >:=> (line 35, col 11) to (line 35, col 63) +35 >for (let { skills: { primary: primaryA, secondary: secondaryA } } = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (969 to 975) SpanInfo: {"start":970,"length":5} + >i = 0 + >:=> (line 35, col 85) to (line 35, col 90) +35 >for (let { skills: { primary: primaryA, secondary: secondaryA } } = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (976 to 982) SpanInfo: {"start":977,"length":5} + >i < 1 + >:=> (line 35, col 92) to (line 35, col 97) +35 >for (let { skills: { primary: primaryA, secondary: secondaryA } } = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (983 to 990) SpanInfo: {"start":984,"length":3} + >i++ + >:=> (line 35, col 99) to (line 35, col 102) +-------------------------------- +36 > console.log(primaryA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (991 to 1017) SpanInfo: {"start":995,"length":21} + >console.log(primaryA) + >:=> (line 36, col 4) to (line 36, col 25) +-------------------------------- +37 >} + + ~~ => Pos: (1018 to 1019) SpanInfo: {"start":995,"length":21} + >console.log(primaryA) + >:=> (line 36, col 4) to (line 36, col 25) +-------------------------------- +38 >for (let { skills: { primary: primaryA, secondary: secondaryA } } = + + ~~~~~~~~~~~~~~~~~~ => Pos: (1020 to 1037) SpanInfo: {"start":1031,"length":52} + >skills: { primary: primaryA, secondary: secondaryA } + >:=> (line 38, col 11) to (line 38, col 63) +38 >for (let { skills: { primary: primaryA, secondary: secondaryA } } = + + ~~~~~~~~~~~~~~~~~~~~~ => Pos: (1038 to 1058) SpanInfo: {"start":1041,"length":17} + >primary: primaryA + >:=> (line 38, col 21) to (line 38, col 38) +38 >for (let { skills: { primary: primaryA, secondary: secondaryA } } = + + ~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1059 to 1082) SpanInfo: {"start":1060,"length":21} + >secondary: secondaryA + >:=> (line 38, col 40) to (line 38, col 61) +38 >for (let { skills: { primary: primaryA, secondary: secondaryA } } = + + ~~~~~=> Pos: (1083 to 1087) SpanInfo: {"start":1031,"length":52} + >skills: { primary: primaryA, secondary: secondaryA } + >:=> (line 38, col 11) to (line 38, col 63) +-------------------------------- +39 > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1088 to 1178) SpanInfo: {"start":1031,"length":52} + >skills: { primary: primaryA, secondary: secondaryA } + >:=> (line 38, col 11) to (line 38, col 63) +-------------------------------- +40 > i = 0; i < 1; i++) { + + ~~~~~~~~~~ => Pos: (1179 to 1188) SpanInfo: {"start":1183,"length":5} + >i = 0 + >:=> (line 40, col 4) to (line 40, col 9) +40 > i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (1189 to 1195) SpanInfo: {"start":1190,"length":5} + >i < 1 + >:=> (line 40, col 11) to (line 40, col 16) +40 > i = 0; i < 1; i++) { + + ~~~~~~~~ => Pos: (1196 to 1203) SpanInfo: {"start":1197,"length":3} + >i++ + >:=> (line 40, col 18) to (line 40, col 21) +-------------------------------- +41 > console.log(primaryA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1204 to 1230) SpanInfo: {"start":1208,"length":21} + >console.log(primaryA) + >:=> (line 41, col 4) to (line 41, col 25) +-------------------------------- +42 >} + + ~~ => Pos: (1231 to 1232) SpanInfo: {"start":1208,"length":21} + >console.log(primaryA) + >:=> (line 41, col 4) to (line 41, col 25) +-------------------------------- +43 >for (let {name: nameA, skill: skillA } = robot, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1233 to 1254) SpanInfo: {"start":1243,"length":11} + >name: nameA + >:=> (line 43, col 10) to (line 43, col 21) +43 >for (let {name: nameA, skill: skillA } = robot, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1255 to 1279) SpanInfo: {"start":1256,"length":13} + >skill: skillA + >:=> (line 43, col 23) to (line 43, col 36) +43 >for (let {name: nameA, skill: skillA } = robot, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1280 to 1286) SpanInfo: {"start":1281,"length":5} + >i = 0 + >:=> (line 43, col 48) to (line 43, col 53) +43 >for (let {name: nameA, skill: skillA } = robot, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1287 to 1293) SpanInfo: {"start":1288,"length":5} + >i < 1 + >:=> (line 43, col 55) to (line 43, col 60) +43 >for (let {name: nameA, skill: skillA } = robot, i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (1294 to 1301) SpanInfo: {"start":1295,"length":3} + >i++ + >:=> (line 43, col 62) to (line 43, col 65) +-------------------------------- +44 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1302 to 1325) SpanInfo: {"start":1306,"length":18} + >console.log(nameA) + >:=> (line 44, col 4) to (line 44, col 22) +-------------------------------- +45 >} + + ~~ => Pos: (1326 to 1327) SpanInfo: {"start":1306,"length":18} + >console.log(nameA) + >:=> (line 44, col 4) to (line 44, col 22) +-------------------------------- +46 >for (let {name: nameA, skill: skillA } = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1328 to 1349) SpanInfo: {"start":1338,"length":11} + >name: nameA + >:=> (line 46, col 10) to (line 46, col 21) +46 >for (let {name: nameA, skill: skillA } = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1350 to 1379) SpanInfo: {"start":1351,"length":13} + >skill: skillA + >:=> (line 46, col 23) to (line 46, col 36) +46 >for (let {name: nameA, skill: skillA } = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1380 to 1386) SpanInfo: {"start":1381,"length":5} + >i = 0 + >:=> (line 46, col 53) to (line 46, col 58) +46 >for (let {name: nameA, skill: skillA } = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1387 to 1393) SpanInfo: {"start":1388,"length":5} + >i < 1 + >:=> (line 46, col 60) to (line 46, col 65) +46 >for (let {name: nameA, skill: skillA } = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (1394 to 1401) SpanInfo: {"start":1395,"length":3} + >i++ + >:=> (line 46, col 67) to (line 46, col 70) +-------------------------------- +47 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1402 to 1425) SpanInfo: {"start":1406,"length":18} + >console.log(nameA) + >:=> (line 47, col 4) to (line 47, col 22) +-------------------------------- +48 >} + + ~~ => Pos: (1426 to 1427) SpanInfo: {"start":1406,"length":18} + >console.log(nameA) + >:=> (line 47, col 4) to (line 47, col 22) +-------------------------------- +49 >for (let {name: nameA, skill: skillA } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1428 to 1449) SpanInfo: {"start":1438,"length":11} + >name: nameA + >:=> (line 49, col 10) to (line 49, col 21) +49 >for (let {name: nameA, skill: skillA } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1450 to 1514) SpanInfo: {"start":1451,"length":13} + >skill: skillA + >:=> (line 49, col 23) to (line 49, col 36) +49 >for (let {name: nameA, skill: skillA } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1515 to 1521) SpanInfo: {"start":1516,"length":5} + >i = 0 + >:=> (line 49, col 88) to (line 49, col 93) +49 >for (let {name: nameA, skill: skillA } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1522 to 1528) SpanInfo: {"start":1523,"length":5} + >i < 1 + >:=> (line 49, col 95) to (line 49, col 100) +49 >for (let {name: nameA, skill: skillA } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (1529 to 1536) SpanInfo: {"start":1530,"length":3} + >i++ + >:=> (line 49, col 102) to (line 49, col 105) +-------------------------------- +50 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1537 to 1560) SpanInfo: {"start":1541,"length":18} + >console.log(nameA) + >:=> (line 50, col 4) to (line 50, col 22) +-------------------------------- +51 >} + + ~~ => Pos: (1561 to 1562) SpanInfo: {"start":1541,"length":18} + >console.log(nameA) + >:=> (line 50, col 4) to (line 50, col 22) +-------------------------------- +52 >for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = multiRobot, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1563 to 1584) SpanInfo: {"start":1573,"length":11} + >name: nameA + >:=> (line 52, col 10) to (line 52, col 21) +52 >for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = multiRobot, i = 0; i < 1; i++) { + + ~~~~~~~~ => Pos: (1585 to 1592) SpanInfo: {"start":1586,"length":52} + >skills: { primary: primaryA, secondary: secondaryA } + >:=> (line 52, col 23) to (line 52, col 75) +52 >for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = multiRobot, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~=> Pos: (1593 to 1613) SpanInfo: {"start":1596,"length":17} + >primary: primaryA + >:=> (line 52, col 33) to (line 52, col 50) +52 >for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = multiRobot, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1614 to 1637) SpanInfo: {"start":1615,"length":21} + >secondary: secondaryA + >:=> (line 52, col 52) to (line 52, col 73) +52 >for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = multiRobot, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~=> Pos: (1638 to 1653) SpanInfo: {"start":1586,"length":52} + >skills: { primary: primaryA, secondary: secondaryA } + >:=> (line 52, col 23) to (line 52, col 75) +52 >for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = multiRobot, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1654 to 1660) SpanInfo: {"start":1655,"length":5} + >i = 0 + >:=> (line 52, col 92) to (line 52, col 97) +52 >for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = multiRobot, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1661 to 1667) SpanInfo: {"start":1662,"length":5} + >i < 1 + >:=> (line 52, col 99) to (line 52, col 104) +52 >for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = multiRobot, i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (1668 to 1675) SpanInfo: {"start":1669,"length":3} + >i++ + >:=> (line 52, col 106) to (line 52, col 109) +-------------------------------- +53 > console.log(primaryA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1676 to 1702) SpanInfo: {"start":1680,"length":21} + >console.log(primaryA) + >:=> (line 53, col 4) to (line 53, col 25) +-------------------------------- +54 >} + + ~~ => Pos: (1703 to 1704) SpanInfo: {"start":1680,"length":21} + >console.log(primaryA) + >:=> (line 53, col 4) to (line 53, col 25) +-------------------------------- +55 >for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1705 to 1726) SpanInfo: {"start":1715,"length":11} + >name: nameA + >:=> (line 55, col 10) to (line 55, col 21) +55 >for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~ => Pos: (1727 to 1734) SpanInfo: {"start":1728,"length":52} + >skills: { primary: primaryA, secondary: secondaryA } + >:=> (line 55, col 23) to (line 55, col 75) +55 >for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~=> Pos: (1735 to 1755) SpanInfo: {"start":1738,"length":17} + >primary: primaryA + >:=> (line 55, col 33) to (line 55, col 50) +55 >for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1756 to 1779) SpanInfo: {"start":1757,"length":21} + >secondary: secondaryA + >:=> (line 55, col 52) to (line 55, col 73) +55 >for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~=> Pos: (1780 to 1800) SpanInfo: {"start":1728,"length":52} + >skills: { primary: primaryA, secondary: secondaryA } + >:=> (line 55, col 23) to (line 55, col 75) +55 >for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1801 to 1807) SpanInfo: {"start":1802,"length":5} + >i = 0 + >:=> (line 55, col 97) to (line 55, col 102) +55 >for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1808 to 1814) SpanInfo: {"start":1809,"length":5} + >i < 1 + >:=> (line 55, col 104) to (line 55, col 109) +55 >for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (1815 to 1822) SpanInfo: {"start":1816,"length":3} + >i++ + >:=> (line 55, col 111) to (line 55, col 114) +-------------------------------- +56 > console.log(primaryA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1823 to 1849) SpanInfo: {"start":1827,"length":21} + >console.log(primaryA) + >:=> (line 56, col 4) to (line 56, col 25) +-------------------------------- +57 >} + + ~~ => Pos: (1850 to 1851) SpanInfo: {"start":1827,"length":21} + >console.log(primaryA) + >:=> (line 56, col 4) to (line 56, col 25) +-------------------------------- +58 >for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = + + ~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1852 to 1873) SpanInfo: {"start":1862,"length":11} + >name: nameA + >:=> (line 58, col 10) to (line 58, col 21) +58 >for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = + + ~~~~~~~~ => Pos: (1874 to 1881) SpanInfo: {"start":1875,"length":52} + >skills: { primary: primaryA, secondary: secondaryA } + >:=> (line 58, col 23) to (line 58, col 75) +58 >for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = + + ~~~~~~~~~~~~~~~~~~~~~=> Pos: (1882 to 1902) SpanInfo: {"start":1885,"length":17} + >primary: primaryA + >:=> (line 58, col 33) to (line 58, col 50) +58 >for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = + + ~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1903 to 1926) SpanInfo: {"start":1904,"length":21} + >secondary: secondaryA + >:=> (line 58, col 52) to (line 58, col 73) +58 >for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = + + ~~~~~=> Pos: (1927 to 1931) SpanInfo: {"start":1875,"length":52} + >skills: { primary: primaryA, secondary: secondaryA } + >:=> (line 58, col 23) to (line 58, col 75) +-------------------------------- +59 > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1932 to 2022) SpanInfo: {"start":1875,"length":52} + >skills: { primary: primaryA, secondary: secondaryA } + >:=> (line 58, col 23) to (line 58, col 75) +-------------------------------- +60 > i = 0; i < 1; i++) { + + ~~~~~~~~~~ => Pos: (2023 to 2032) SpanInfo: {"start":2027,"length":5} + >i = 0 + >:=> (line 60, col 4) to (line 60, col 9) +60 > i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (2033 to 2039) SpanInfo: {"start":2034,"length":5} + >i < 1 + >:=> (line 60, col 11) to (line 60, col 16) +60 > i = 0; i < 1; i++) { + + ~~~~~~~~ => Pos: (2040 to 2047) SpanInfo: {"start":2041,"length":3} + >i++ + >:=> (line 60, col 18) to (line 60, col 21) +-------------------------------- +61 > console.log(primaryA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2048 to 2074) SpanInfo: {"start":2052,"length":21} + >console.log(primaryA) + >:=> (line 61, col 4) to (line 61, col 25) +-------------------------------- +62 >} + ~ => Pos: (2075 to 2075) SpanInfo: {"start":2052,"length":21} + >console.log(primaryA) + >:=> (line 61, col 4) to (line 61, col 25) \ No newline at end of file diff --git a/tests/baselines/reference/bpSpanDestructuringForObjectBindingPatternDefaultValues.baseline b/tests/baselines/reference/bpSpanDestructuringForObjectBindingPatternDefaultValues.baseline new file mode 100644 index 00000000000..54d9cbc0471 --- /dev/null +++ b/tests/baselines/reference/bpSpanDestructuringForObjectBindingPatternDefaultValues.baseline @@ -0,0 +1,837 @@ + +1 >declare var console: { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (0 to 22) SpanInfo: undefined +-------------------------------- +2 > log(msg: any): void; + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (23 to 47) SpanInfo: undefined +-------------------------------- +3 >} + + ~~ => Pos: (48 to 49) SpanInfo: undefined +-------------------------------- +4 >interface Robot { + + ~~~~~~~~~~~~~~~~~~ => Pos: (50 to 67) SpanInfo: undefined +-------------------------------- +5 > name: string; + + ~~~~~~~~~~~~~~~~~~ => Pos: (68 to 85) SpanInfo: undefined +-------------------------------- +6 > skill: string; + + ~~~~~~~~~~~~~~~~~~~ => Pos: (86 to 104) SpanInfo: undefined +-------------------------------- +7 >} + + ~~ => Pos: (105 to 106) SpanInfo: undefined +-------------------------------- +8 >interface MultiRobot { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (107 to 129) SpanInfo: undefined +-------------------------------- +9 > name: string; + + ~~~~~~~~~~~~~~~~~~ => Pos: (130 to 147) SpanInfo: undefined +-------------------------------- +10 > skills: { + + ~~~~~~~~~~~~~~ => Pos: (148 to 161) SpanInfo: undefined +-------------------------------- +11 > primary?: string; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (162 to 187) SpanInfo: undefined +-------------------------------- +12 > secondary?: string; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (188 to 215) SpanInfo: undefined +-------------------------------- +13 > }; + + ~~~~~~~ => Pos: (216 to 222) SpanInfo: undefined +-------------------------------- +14 >} + + ~~ => Pos: (223 to 224) SpanInfo: undefined +-------------------------------- +15 >let robot: Robot = { name: "mower", skill: "mowing" }; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (225 to 279) SpanInfo: {"start":225,"length":53} + >let robot: Robot = { name: "mower", skill: "mowing" } + >:=> (line 15, col 0) to (line 15, col 53) +-------------------------------- +16 >let multiRobot: MultiRobot = { name: "mower", skills: { primary: "mowing", secondary: "none" } }; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (280 to 377) SpanInfo: {"start":280,"length":96} + >let multiRobot: MultiRobot = { name: "mower", skills: { primary: "mowing", secondary: "none" } } + >:=> (line 16, col 0) to (line 16, col 96) +-------------------------------- +17 >function getRobot() { + + ~~~~~~~~~~~~~~~~~~~~~~ => Pos: (378 to 399) SpanInfo: {"start":404,"length":12} + >return robot + >:=> (line 18, col 4) to (line 18, col 16) +-------------------------------- +18 > return robot; + + ~~~~~~~~~~~~~~~~~~ => Pos: (400 to 417) SpanInfo: {"start":404,"length":12} + >return robot + >:=> (line 18, col 4) to (line 18, col 16) +-------------------------------- +19 >} + + ~~ => Pos: (418 to 419) SpanInfo: {"start":418,"length":1} + >} + >:=> (line 19, col 0) to (line 19, col 1) +-------------------------------- +20 >function getMultiRobot() { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (420 to 446) SpanInfo: {"start":451,"length":17} + >return multiRobot + >:=> (line 21, col 4) to (line 21, col 21) +-------------------------------- +21 > return multiRobot; + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (447 to 469) SpanInfo: {"start":451,"length":17} + >return multiRobot + >:=> (line 21, col 4) to (line 21, col 21) +-------------------------------- +22 >} + + ~~ => Pos: (470 to 471) SpanInfo: {"start":470,"length":1} + >} + >:=> (line 22, col 0) to (line 22, col 1) +-------------------------------- +23 >for (let {name: nameA= "noName" } = robot, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (472 to 513) SpanInfo: {"start":482,"length":21} + >name: nameA= "noName" + >:=> (line 23, col 10) to (line 23, col 31) +23 >for (let {name: nameA= "noName" } = robot, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (514 to 520) SpanInfo: {"start":515,"length":5} + >i = 0 + >:=> (line 23, col 43) to (line 23, col 48) +23 >for (let {name: nameA= "noName" } = robot, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (521 to 527) SpanInfo: {"start":522,"length":5} + >i < 1 + >:=> (line 23, col 50) to (line 23, col 55) +23 >for (let {name: nameA= "noName" } = robot, i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (528 to 535) SpanInfo: {"start":529,"length":3} + >i++ + >:=> (line 23, col 57) to (line 23, col 60) +-------------------------------- +24 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (536 to 559) SpanInfo: {"start":540,"length":18} + >console.log(nameA) + >:=> (line 24, col 4) to (line 24, col 22) +-------------------------------- +25 >} + + ~~ => Pos: (560 to 561) SpanInfo: {"start":540,"length":18} + >console.log(nameA) + >:=> (line 24, col 4) to (line 24, col 22) +-------------------------------- +26 >for (let {name: nameA = "noName" } = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (562 to 609) SpanInfo: {"start":572,"length":22} + >name: nameA = "noName" + >:=> (line 26, col 10) to (line 26, col 32) +26 >for (let {name: nameA = "noName" } = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (610 to 616) SpanInfo: {"start":611,"length":5} + >i = 0 + >:=> (line 26, col 49) to (line 26, col 54) +26 >for (let {name: nameA = "noName" } = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (617 to 623) SpanInfo: {"start":618,"length":5} + >i < 1 + >:=> (line 26, col 56) to (line 26, col 61) +26 >for (let {name: nameA = "noName" } = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (624 to 631) SpanInfo: {"start":625,"length":3} + >i++ + >:=> (line 26, col 63) to (line 26, col 66) +-------------------------------- +27 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (632 to 655) SpanInfo: {"start":636,"length":18} + >console.log(nameA) + >:=> (line 27, col 4) to (line 27, col 22) +-------------------------------- +28 >} + + ~~ => Pos: (656 to 657) SpanInfo: {"start":636,"length":18} + >console.log(nameA) + >:=> (line 27, col 4) to (line 27, col 22) +-------------------------------- +29 >for (let {name: nameA = "noName" } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (658 to 740) SpanInfo: {"start":668,"length":22} + >name: nameA = "noName" + >:=> (line 29, col 10) to (line 29, col 32) +29 >for (let {name: nameA = "noName" } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (741 to 747) SpanInfo: {"start":742,"length":5} + >i = 0 + >:=> (line 29, col 84) to (line 29, col 89) +29 >for (let {name: nameA = "noName" } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (748 to 754) SpanInfo: {"start":749,"length":5} + >i < 1 + >:=> (line 29, col 91) to (line 29, col 96) +29 >for (let {name: nameA = "noName" } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (755 to 762) SpanInfo: {"start":756,"length":3} + >i++ + >:=> (line 29, col 98) to (line 29, col 101) +-------------------------------- +30 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (763 to 786) SpanInfo: {"start":767,"length":18} + >console.log(nameA) + >:=> (line 30, col 4) to (line 30, col 22) +-------------------------------- +31 >} + + ~~ => Pos: (787 to 788) SpanInfo: {"start":767,"length":18} + >console.log(nameA) + >:=> (line 30, col 4) to (line 30, col 22) +-------------------------------- +32 >for (let { + + ~~~~~~~~~~~ => Pos: (789 to 799) SpanInfo: {"start":804,"length":139} + >skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "none", secondary: "none" } + >:=> (line 33, col 4) to (line 36, col 46) +-------------------------------- +33 > skills: { + + ~~~~~~~~~~~ => Pos: (800 to 810) SpanInfo: {"start":804,"length":139} + >skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "none", secondary: "none" } + >:=> (line 33, col 4) to (line 36, col 46) +33 > skills: { + + ~~~ => Pos: (811 to 813) SpanInfo: {"start":822,"length":29} + >primary: primaryA = "primary" + >:=> (line 34, col 8) to (line 34, col 37) +-------------------------------- +34 > primary: primaryA = "primary", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (814 to 852) SpanInfo: {"start":822,"length":29} + >primary: primaryA = "primary" + >:=> (line 34, col 8) to (line 34, col 37) +-------------------------------- +35 > secondary: secondaryA = "secondary" + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (853 to 896) SpanInfo: {"start":861,"length":35} + >secondary: secondaryA = "secondary" + >:=> (line 35, col 8) to (line 35, col 43) +-------------------------------- +36 > } = { primary: "none", secondary: "none" } + + ~~~~~ => Pos: (897 to 901) SpanInfo: {"start":861,"length":35} + >secondary: secondaryA = "secondary" + >:=> (line 35, col 8) to (line 35, col 43) +36 > } = { primary: "none", secondary: "none" } + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (902 to 943) SpanInfo: {"start":804,"length":139} + >skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "none", secondary: "none" } + >:=> (line 33, col 4) to (line 36, col 46) +-------------------------------- +37 >} = multiRobot, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~ => Pos: (944 to 958) SpanInfo: {"start":804,"length":139} + >skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "none", secondary: "none" } + >:=> (line 33, col 4) to (line 36, col 46) +37 >} = multiRobot, i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (959 to 965) SpanInfo: {"start":960,"length":5} + >i = 0 + >:=> (line 37, col 16) to (line 37, col 21) +37 >} = multiRobot, i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (966 to 972) SpanInfo: {"start":967,"length":5} + >i < 1 + >:=> (line 37, col 23) to (line 37, col 28) +37 >} = multiRobot, i = 0; i < 1; i++) { + + ~~~~~~~~ => Pos: (973 to 980) SpanInfo: {"start":974,"length":3} + >i++ + >:=> (line 37, col 30) to (line 37, col 33) +-------------------------------- +38 > console.log(primaryA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (981 to 1007) SpanInfo: {"start":985,"length":21} + >console.log(primaryA) + >:=> (line 38, col 4) to (line 38, col 25) +-------------------------------- +39 >} + + ~~ => Pos: (1008 to 1009) SpanInfo: {"start":985,"length":21} + >console.log(primaryA) + >:=> (line 38, col 4) to (line 38, col 25) +-------------------------------- +40 >for (let { + + ~~~~~~~~~~~ => Pos: (1010 to 1020) SpanInfo: {"start":1025,"length":139} + >skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "none", secondary: "none" } + >:=> (line 41, col 4) to (line 44, col 46) +-------------------------------- +41 > skills: { + + ~~~~~~~~~~~ => Pos: (1021 to 1031) SpanInfo: {"start":1025,"length":139} + >skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "none", secondary: "none" } + >:=> (line 41, col 4) to (line 44, col 46) +41 > skills: { + + ~~~ => Pos: (1032 to 1034) SpanInfo: {"start":1043,"length":29} + >primary: primaryA = "primary" + >:=> (line 42, col 8) to (line 42, col 37) +-------------------------------- +42 > primary: primaryA = "primary", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1035 to 1073) SpanInfo: {"start":1043,"length":29} + >primary: primaryA = "primary" + >:=> (line 42, col 8) to (line 42, col 37) +-------------------------------- +43 > secondary: secondaryA = "secondary" + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1074 to 1117) SpanInfo: {"start":1082,"length":35} + >secondary: secondaryA = "secondary" + >:=> (line 43, col 8) to (line 43, col 43) +-------------------------------- +44 > } = { primary: "none", secondary: "none" } + + ~~~~~ => Pos: (1118 to 1122) SpanInfo: {"start":1082,"length":35} + >secondary: secondaryA = "secondary" + >:=> (line 43, col 8) to (line 43, col 43) +44 > } = { primary: "none", secondary: "none" } + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1123 to 1164) SpanInfo: {"start":1025,"length":139} + >skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "none", secondary: "none" } + >:=> (line 41, col 4) to (line 44, col 46) +-------------------------------- +45 >} = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~ => Pos: (1165 to 1184) SpanInfo: {"start":1025,"length":139} + >skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "none", secondary: "none" } + >:=> (line 41, col 4) to (line 44, col 46) +45 >} = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (1185 to 1191) SpanInfo: {"start":1186,"length":5} + >i = 0 + >:=> (line 45, col 21) to (line 45, col 26) +45 >} = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (1192 to 1198) SpanInfo: {"start":1193,"length":5} + >i < 1 + >:=> (line 45, col 28) to (line 45, col 33) +45 >} = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~ => Pos: (1199 to 1206) SpanInfo: {"start":1200,"length":3} + >i++ + >:=> (line 45, col 35) to (line 45, col 38) +-------------------------------- +46 > console.log(primaryA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1207 to 1233) SpanInfo: {"start":1211,"length":21} + >console.log(primaryA) + >:=> (line 46, col 4) to (line 46, col 25) +-------------------------------- +47 >} + + ~~ => Pos: (1234 to 1235) SpanInfo: {"start":1211,"length":21} + >console.log(primaryA) + >:=> (line 46, col 4) to (line 46, col 25) +-------------------------------- +48 >for (let { + + ~~~~~~~~~~~ => Pos: (1236 to 1246) SpanInfo: {"start":1251,"length":139} + >skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "none", secondary: "none" } + >:=> (line 49, col 4) to (line 52, col 46) +-------------------------------- +49 > skills: { + + ~~~~~~~~~~~ => Pos: (1247 to 1257) SpanInfo: {"start":1251,"length":139} + >skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "none", secondary: "none" } + >:=> (line 49, col 4) to (line 52, col 46) +49 > skills: { + + ~~~ => Pos: (1258 to 1260) SpanInfo: {"start":1269,"length":29} + >primary: primaryA = "primary" + >:=> (line 50, col 8) to (line 50, col 37) +-------------------------------- +50 > primary: primaryA = "primary", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1261 to 1299) SpanInfo: {"start":1269,"length":29} + >primary: primaryA = "primary" + >:=> (line 50, col 8) to (line 50, col 37) +-------------------------------- +51 > secondary: secondaryA = "secondary" + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1300 to 1343) SpanInfo: {"start":1308,"length":35} + >secondary: secondaryA = "secondary" + >:=> (line 51, col 8) to (line 51, col 43) +-------------------------------- +52 > } = { primary: "none", secondary: "none" } + + ~~~~~ => Pos: (1344 to 1348) SpanInfo: {"start":1308,"length":35} + >secondary: secondaryA = "secondary" + >:=> (line 51, col 8) to (line 51, col 43) +52 > } = { primary: "none", secondary: "none" } + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1349 to 1390) SpanInfo: {"start":1251,"length":139} + >skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "none", secondary: "none" } + >:=> (line 49, col 4) to (line 52, col 46) +-------------------------------- +53 >} = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1391 to 1481) SpanInfo: {"start":1251,"length":139} + >skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "none", secondary: "none" } + >:=> (line 49, col 4) to (line 52, col 46) +-------------------------------- +54 > i = 0; i < 1; i++) { + + ~~~~~~~~~~ => Pos: (1482 to 1491) SpanInfo: {"start":1486,"length":5} + >i = 0 + >:=> (line 54, col 4) to (line 54, col 9) +54 > i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (1492 to 1498) SpanInfo: {"start":1493,"length":5} + >i < 1 + >:=> (line 54, col 11) to (line 54, col 16) +54 > i = 0; i < 1; i++) { + + ~~~~~~~~ => Pos: (1499 to 1506) SpanInfo: {"start":1500,"length":3} + >i++ + >:=> (line 54, col 18) to (line 54, col 21) +-------------------------------- +55 > console.log(primaryA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1507 to 1533) SpanInfo: {"start":1511,"length":21} + >console.log(primaryA) + >:=> (line 55, col 4) to (line 55, col 25) +-------------------------------- +56 >} + + ~~ => Pos: (1534 to 1535) SpanInfo: {"start":1511,"length":21} + >console.log(primaryA) + >:=> (line 55, col 4) to (line 55, col 25) +-------------------------------- +57 >for (let {name: nameA = "noName", skill: skillA = "skill" } = robot, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1536 to 1568) SpanInfo: {"start":1546,"length":22} + >name: nameA = "noName" + >:=> (line 57, col 10) to (line 57, col 32) +57 >for (let {name: nameA = "noName", skill: skillA = "skill" } = robot, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1569 to 1603) SpanInfo: {"start":1570,"length":23} + >skill: skillA = "skill" + >:=> (line 57, col 34) to (line 57, col 57) +57 >for (let {name: nameA = "noName", skill: skillA = "skill" } = robot, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1604 to 1610) SpanInfo: {"start":1605,"length":5} + >i = 0 + >:=> (line 57, col 69) to (line 57, col 74) +57 >for (let {name: nameA = "noName", skill: skillA = "skill" } = robot, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1611 to 1617) SpanInfo: {"start":1612,"length":5} + >i < 1 + >:=> (line 57, col 76) to (line 57, col 81) +57 >for (let {name: nameA = "noName", skill: skillA = "skill" } = robot, i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (1618 to 1625) SpanInfo: {"start":1619,"length":3} + >i++ + >:=> (line 57, col 83) to (line 57, col 86) +-------------------------------- +58 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1626 to 1649) SpanInfo: {"start":1630,"length":18} + >console.log(nameA) + >:=> (line 58, col 4) to (line 58, col 22) +-------------------------------- +59 >} + + ~~ => Pos: (1650 to 1651) SpanInfo: {"start":1630,"length":18} + >console.log(nameA) + >:=> (line 58, col 4) to (line 58, col 22) +-------------------------------- +60 >for (let {name: nameA = "noName", skill: skillA = "skill" } = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1652 to 1684) SpanInfo: {"start":1662,"length":22} + >name: nameA = "noName" + >:=> (line 60, col 10) to (line 60, col 32) +60 >for (let {name: nameA = "noName", skill: skillA = "skill" } = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1685 to 1724) SpanInfo: {"start":1686,"length":23} + >skill: skillA = "skill" + >:=> (line 60, col 34) to (line 60, col 57) +60 >for (let {name: nameA = "noName", skill: skillA = "skill" } = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1725 to 1731) SpanInfo: {"start":1726,"length":5} + >i = 0 + >:=> (line 60, col 74) to (line 60, col 79) +60 >for (let {name: nameA = "noName", skill: skillA = "skill" } = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1732 to 1738) SpanInfo: {"start":1733,"length":5} + >i < 1 + >:=> (line 60, col 81) to (line 60, col 86) +60 >for (let {name: nameA = "noName", skill: skillA = "skill" } = getRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (1739 to 1746) SpanInfo: {"start":1740,"length":3} + >i++ + >:=> (line 60, col 88) to (line 60, col 91) +-------------------------------- +61 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1747 to 1770) SpanInfo: {"start":1751,"length":18} + >console.log(nameA) + >:=> (line 61, col 4) to (line 61, col 22) +-------------------------------- +62 >} + + ~~ => Pos: (1771 to 1772) SpanInfo: {"start":1751,"length":18} + >console.log(nameA) + >:=> (line 61, col 4) to (line 61, col 22) +-------------------------------- +63 >for (let {name: nameA = "noName", skill: skillA = "skill" } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1773 to 1805) SpanInfo: {"start":1783,"length":22} + >name: nameA = "noName" + >:=> (line 63, col 10) to (line 63, col 32) +63 >for (let {name: nameA = "noName", skill: skillA = "skill" } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1806 to 1880) SpanInfo: {"start":1807,"length":23} + >skill: skillA = "skill" + >:=> (line 63, col 34) to (line 63, col 57) +63 >for (let {name: nameA = "noName", skill: skillA = "skill" } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1881 to 1887) SpanInfo: {"start":1882,"length":5} + >i = 0 + >:=> (line 63, col 109) to (line 63, col 114) +63 >for (let {name: nameA = "noName", skill: skillA = "skill" } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + + ~~~~~~~=> Pos: (1888 to 1894) SpanInfo: {"start":1889,"length":5} + >i < 1 + >:=> (line 63, col 116) to (line 63, col 121) +63 >for (let {name: nameA = "noName", skill: skillA = "skill" } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + + ~~~~~~~~=> Pos: (1895 to 1902) SpanInfo: {"start":1896,"length":3} + >i++ + >:=> (line 63, col 123) to (line 63, col 126) +-------------------------------- +64 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1903 to 1926) SpanInfo: {"start":1907,"length":18} + >console.log(nameA) + >:=> (line 64, col 4) to (line 64, col 22) +-------------------------------- +65 >} + + ~~ => Pos: (1927 to 1928) SpanInfo: {"start":1907,"length":18} + >console.log(nameA) + >:=> (line 64, col 4) to (line 64, col 22) +-------------------------------- +66 >for (let { + + ~~~~~~~~~~~ => Pos: (1929 to 1939) SpanInfo: {"start":1944,"length":22} + >name: nameA = "noName" + >:=> (line 67, col 4) to (line 67, col 26) +-------------------------------- +67 > name: nameA = "noName", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1940 to 1967) SpanInfo: {"start":1944,"length":22} + >name: nameA = "noName" + >:=> (line 67, col 4) to (line 67, col 26) +-------------------------------- +68 > skills: { + + ~~~~~~~~~~~ => Pos: (1968 to 1978) SpanInfo: {"start":1972,"length":139} + >skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "none", secondary: "none" } + >:=> (line 68, col 4) to (line 71, col 46) +68 > skills: { + + ~~~ => Pos: (1979 to 1981) SpanInfo: {"start":1990,"length":29} + >primary: primaryA = "primary" + >:=> (line 69, col 8) to (line 69, col 37) +-------------------------------- +69 > primary: primaryA = "primary", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1982 to 2020) SpanInfo: {"start":1990,"length":29} + >primary: primaryA = "primary" + >:=> (line 69, col 8) to (line 69, col 37) +-------------------------------- +70 > secondary: secondaryA = "secondary" + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2021 to 2064) SpanInfo: {"start":2029,"length":35} + >secondary: secondaryA = "secondary" + >:=> (line 70, col 8) to (line 70, col 43) +-------------------------------- +71 > } = { primary: "none", secondary: "none" } + + ~~~~~ => Pos: (2065 to 2069) SpanInfo: {"start":2029,"length":35} + >secondary: secondaryA = "secondary" + >:=> (line 70, col 8) to (line 70, col 43) +71 > } = { primary: "none", secondary: "none" } + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (2070 to 2111) SpanInfo: {"start":1972,"length":139} + >skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "none", secondary: "none" } + >:=> (line 68, col 4) to (line 71, col 46) +-------------------------------- +72 >} = multiRobot, i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~ => Pos: (2112 to 2126) SpanInfo: {"start":1972,"length":139} + >skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "none", secondary: "none" } + >:=> (line 68, col 4) to (line 71, col 46) +72 >} = multiRobot, i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (2127 to 2133) SpanInfo: {"start":2128,"length":5} + >i = 0 + >:=> (line 72, col 16) to (line 72, col 21) +72 >} = multiRobot, i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (2134 to 2140) SpanInfo: {"start":2135,"length":5} + >i < 1 + >:=> (line 72, col 23) to (line 72, col 28) +72 >} = multiRobot, i = 0; i < 1; i++) { + + ~~~~~~~~ => Pos: (2141 to 2148) SpanInfo: {"start":2142,"length":3} + >i++ + >:=> (line 72, col 30) to (line 72, col 33) +-------------------------------- +73 > console.log(primaryA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2149 to 2175) SpanInfo: {"start":2153,"length":21} + >console.log(primaryA) + >:=> (line 73, col 4) to (line 73, col 25) +-------------------------------- +74 >} + + ~~ => Pos: (2176 to 2177) SpanInfo: {"start":2153,"length":21} + >console.log(primaryA) + >:=> (line 73, col 4) to (line 73, col 25) +-------------------------------- +75 >for (let { + + ~~~~~~~~~~~ => Pos: (2178 to 2188) SpanInfo: {"start":2193,"length":22} + >name: nameA = "noName" + >:=> (line 76, col 4) to (line 76, col 26) +-------------------------------- +76 > name: nameA = "noName", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2189 to 2216) SpanInfo: {"start":2193,"length":22} + >name: nameA = "noName" + >:=> (line 76, col 4) to (line 76, col 26) +-------------------------------- +77 > skills: { + + ~~~~~~~~~~~ => Pos: (2217 to 2227) SpanInfo: {"start":2221,"length":139} + >skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "none", secondary: "none" } + >:=> (line 77, col 4) to (line 80, col 46) +77 > skills: { + + ~~~ => Pos: (2228 to 2230) SpanInfo: {"start":2239,"length":29} + >primary: primaryA = "primary" + >:=> (line 78, col 8) to (line 78, col 37) +-------------------------------- +78 > primary: primaryA = "primary", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2231 to 2269) SpanInfo: {"start":2239,"length":29} + >primary: primaryA = "primary" + >:=> (line 78, col 8) to (line 78, col 37) +-------------------------------- +79 > secondary: secondaryA = "secondary" + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2270 to 2313) SpanInfo: {"start":2278,"length":35} + >secondary: secondaryA = "secondary" + >:=> (line 79, col 8) to (line 79, col 43) +-------------------------------- +80 > } = { primary: "none", secondary: "none" } + + ~~~~~ => Pos: (2314 to 2318) SpanInfo: {"start":2278,"length":35} + >secondary: secondaryA = "secondary" + >:=> (line 79, col 8) to (line 79, col 43) +80 > } = { primary: "none", secondary: "none" } + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (2319 to 2360) SpanInfo: {"start":2221,"length":139} + >skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "none", secondary: "none" } + >:=> (line 77, col 4) to (line 80, col 46) +-------------------------------- +81 >} = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~~~~~~~~~~~~~ => Pos: (2361 to 2380) SpanInfo: {"start":2221,"length":139} + >skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "none", secondary: "none" } + >:=> (line 77, col 4) to (line 80, col 46) +81 >} = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (2381 to 2387) SpanInfo: {"start":2382,"length":5} + >i = 0 + >:=> (line 81, col 21) to (line 81, col 26) +81 >} = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (2388 to 2394) SpanInfo: {"start":2389,"length":5} + >i < 1 + >:=> (line 81, col 28) to (line 81, col 33) +81 >} = getMultiRobot(), i = 0; i < 1; i++) { + + ~~~~~~~~ => Pos: (2395 to 2402) SpanInfo: {"start":2396,"length":3} + >i++ + >:=> (line 81, col 35) to (line 81, col 38) +-------------------------------- +82 > console.log(primaryA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2403 to 2429) SpanInfo: {"start":2407,"length":21} + >console.log(primaryA) + >:=> (line 82, col 4) to (line 82, col 25) +-------------------------------- +83 >} + + ~~ => Pos: (2430 to 2431) SpanInfo: {"start":2407,"length":21} + >console.log(primaryA) + >:=> (line 82, col 4) to (line 82, col 25) +-------------------------------- +84 >for (let { + + ~~~~~~~~~~~ => Pos: (2432 to 2442) SpanInfo: {"start":2447,"length":22} + >name: nameA = "noName" + >:=> (line 85, col 4) to (line 85, col 26) +-------------------------------- +85 > name: nameA = "noName", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2443 to 2470) SpanInfo: {"start":2447,"length":22} + >name: nameA = "noName" + >:=> (line 85, col 4) to (line 85, col 26) +-------------------------------- +86 > skills: { + + ~~~~~~~~~~~ => Pos: (2471 to 2481) SpanInfo: {"start":2475,"length":139} + >skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "none", secondary: "none" } + >:=> (line 86, col 4) to (line 89, col 46) +86 > skills: { + + ~~~ => Pos: (2482 to 2484) SpanInfo: {"start":2493,"length":29} + >primary: primaryA = "primary" + >:=> (line 87, col 8) to (line 87, col 37) +-------------------------------- +87 > primary: primaryA = "primary", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2485 to 2523) SpanInfo: {"start":2493,"length":29} + >primary: primaryA = "primary" + >:=> (line 87, col 8) to (line 87, col 37) +-------------------------------- +88 > secondary: secondaryA = "secondary" + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2524 to 2567) SpanInfo: {"start":2532,"length":35} + >secondary: secondaryA = "secondary" + >:=> (line 88, col 8) to (line 88, col 43) +-------------------------------- +89 > } = { primary: "none", secondary: "none" } + + ~~~~~ => Pos: (2568 to 2572) SpanInfo: {"start":2532,"length":35} + >secondary: secondaryA = "secondary" + >:=> (line 88, col 8) to (line 88, col 43) +89 > } = { primary: "none", secondary: "none" } + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (2573 to 2614) SpanInfo: {"start":2475,"length":139} + >skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "none", secondary: "none" } + >:=> (line 86, col 4) to (line 89, col 46) +-------------------------------- +90 >} = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (2615 to 2705) SpanInfo: {"start":2475,"length":139} + >skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "none", secondary: "none" } + >:=> (line 86, col 4) to (line 89, col 46) +-------------------------------- +91 > i = 0; i < 1; i++) { + + ~~~~~~~~~~ => Pos: (2706 to 2715) SpanInfo: {"start":2710,"length":5} + >i = 0 + >:=> (line 91, col 4) to (line 91, col 9) +91 > i = 0; i < 1; i++) { + + ~~~~~~~ => Pos: (2716 to 2722) SpanInfo: {"start":2717,"length":5} + >i < 1 + >:=> (line 91, col 11) to (line 91, col 16) +91 > i = 0; i < 1; i++) { + + ~~~~~~~~ => Pos: (2723 to 2730) SpanInfo: {"start":2724,"length":3} + >i++ + >:=> (line 91, col 18) to (line 91, col 21) +-------------------------------- +92 > console.log(primaryA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2731 to 2757) SpanInfo: {"start":2735,"length":21} + >console.log(primaryA) + >:=> (line 92, col 4) to (line 92, col 25) +-------------------------------- +93 >} + ~ => Pos: (2758 to 2758) SpanInfo: {"start":2735,"length":21} + >console.log(primaryA) + >:=> (line 92, col 4) to (line 92, col 25) \ No newline at end of file diff --git a/tests/baselines/reference/bpSpanDestructuringForOfArrayBindingPattern.baseline b/tests/baselines/reference/bpSpanDestructuringForOfArrayBindingPattern.baseline new file mode 100644 index 00000000000..2d0cbda5d8d --- /dev/null +++ b/tests/baselines/reference/bpSpanDestructuringForOfArrayBindingPattern.baseline @@ -0,0 +1,778 @@ + +1 >declare var console: { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (0 to 22) SpanInfo: undefined +-------------------------------- +2 > log(msg: any): void; + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (23 to 47) SpanInfo: undefined +-------------------------------- +3 >} + + ~~ => Pos: (48 to 49) SpanInfo: undefined +-------------------------------- +4 >type Robot = [number, string, string]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (50 to 88) SpanInfo: undefined +-------------------------------- +5 >type MultiSkilledRobot = [string, [string, string]]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (89 to 141) SpanInfo: undefined +-------------------------------- +6 >let robotA: Robot = [1, "mower", "mowing"]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (142 to 185) SpanInfo: {"start":142,"length":42} + >let robotA: Robot = [1, "mower", "mowing"] + >:=> (line 6, col 0) to (line 6, col 42) +-------------------------------- +7 >let robotB: Robot = [2, "trimmer", "trimming"]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (186 to 233) SpanInfo: {"start":186,"length":46} + >let robotB: Robot = [2, "trimmer", "trimming"] + >:=> (line 7, col 0) to (line 7, col 46) +-------------------------------- +8 >let robots = [robotA, robotB]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (234 to 264) SpanInfo: {"start":234,"length":29} + >let robots = [robotA, robotB] + >:=> (line 8, col 0) to (line 8, col 29) +-------------------------------- +9 >function getRobots() { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (265 to 287) SpanInfo: {"start":292,"length":13} + >return robots + >:=> (line 10, col 4) to (line 10, col 17) +-------------------------------- +10 > return robots; + + ~~~~~~~~~~~~~~~~~~~ => Pos: (288 to 306) SpanInfo: {"start":292,"length":13} + >return robots + >:=> (line 10, col 4) to (line 10, col 17) +-------------------------------- +11 >} + + ~~ => Pos: (307 to 308) SpanInfo: {"start":307,"length":1} + >} + >:=> (line 11, col 0) to (line 11, col 1) +-------------------------------- +12 >let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (309 to 372) SpanInfo: {"start":309,"length":62} + >let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]] + >:=> (line 12, col 0) to (line 12, col 62) +-------------------------------- +13 >let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (373 to 446) SpanInfo: {"start":373,"length":72} + >let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]] + >:=> (line 13, col 0) to (line 13, col 72) +-------------------------------- +14 >let multiRobots = [multiRobotA, multiRobotB]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (447 to 492) SpanInfo: {"start":447,"length":44} + >let multiRobots = [multiRobotA, multiRobotB] + >:=> (line 14, col 0) to (line 14, col 44) +-------------------------------- +15 >function getMultiRobots() { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (493 to 520) SpanInfo: {"start":525,"length":18} + >return multiRobots + >:=> (line 16, col 4) to (line 16, col 22) +-------------------------------- +16 > return multiRobots; + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (521 to 544) SpanInfo: {"start":525,"length":18} + >return multiRobots + >:=> (line 16, col 4) to (line 16, col 22) +-------------------------------- +17 >} + + ~~ => Pos: (545 to 546) SpanInfo: {"start":545,"length":1} + >} + >:=> (line 17, col 0) to (line 17, col 1) +-------------------------------- +18 >for (let [, nameA] of robots) { + + ~~~~~~~~~~~~~~~~~~ => Pos: (547 to 564) SpanInfo: {"start":559,"length":5} + >nameA + >:=> (line 18, col 12) to (line 18, col 17) +18 >for (let [, nameA] of robots) { + + ~~~~~~~~~~~~~~ => Pos: (565 to 578) SpanInfo: {"start":569,"length":6} + >robots + >:=> (line 18, col 22) to (line 18, col 28) +-------------------------------- +19 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (579 to 602) SpanInfo: {"start":583,"length":18} + >console.log(nameA) + >:=> (line 19, col 4) to (line 19, col 22) +-------------------------------- +20 >} + + ~~ => Pos: (603 to 604) SpanInfo: {"start":583,"length":18} + >console.log(nameA) + >:=> (line 19, col 4) to (line 19, col 22) +-------------------------------- +21 >for (let [, nameA] of getRobots()) { + + ~~~~~~~~~~~~~~~~~~ => Pos: (605 to 622) SpanInfo: {"start":617,"length":5} + >nameA + >:=> (line 21, col 12) to (line 21, col 17) +21 >for (let [, nameA] of getRobots()) { + + ~~~~~~~~~~~~~~~~~~~ => Pos: (623 to 641) SpanInfo: {"start":627,"length":11} + >getRobots() + >:=> (line 21, col 22) to (line 21, col 33) +-------------------------------- +22 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (642 to 665) SpanInfo: {"start":646,"length":18} + >console.log(nameA) + >:=> (line 22, col 4) to (line 22, col 22) +-------------------------------- +23 >} + + ~~ => Pos: (666 to 667) SpanInfo: {"start":646,"length":18} + >console.log(nameA) + >:=> (line 22, col 4) to (line 22, col 22) +-------------------------------- +24 >for (let [, nameA] of [robotA, robotB]) { + + ~~~~~~~~~~~~~~~~~~ => Pos: (668 to 685) SpanInfo: {"start":680,"length":5} + >nameA + >:=> (line 24, col 12) to (line 24, col 17) +24 >for (let [, nameA] of [robotA, robotB]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (686 to 709) SpanInfo: {"start":690,"length":16} + >[robotA, robotB] + >:=> (line 24, col 22) to (line 24, col 38) +-------------------------------- +25 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (710 to 733) SpanInfo: {"start":714,"length":18} + >console.log(nameA) + >:=> (line 25, col 4) to (line 25, col 22) +-------------------------------- +26 >} + + ~~ => Pos: (734 to 735) SpanInfo: {"start":714,"length":18} + >console.log(nameA) + >:=> (line 25, col 4) to (line 25, col 22) +-------------------------------- +27 >for (let [, [primarySkillA, secondarySkillA]] of multiRobots) { + + ~~~~~~~~~~~ => Pos: (736 to 746) SpanInfo: {"start":748,"length":32} + >[primarySkillA, secondarySkillA] + >:=> (line 27, col 12) to (line 27, col 44) +27 >for (let [, [primarySkillA, secondarySkillA]] of multiRobots) { + + ~~~~~~~~~~~~~~~~ => Pos: (747 to 762) SpanInfo: {"start":749,"length":13} + >primarySkillA + >:=> (line 27, col 13) to (line 27, col 26) +27 >for (let [, [primarySkillA, secondarySkillA]] of multiRobots) { + + ~~~~~~~~~~~~~~~~~ => Pos: (763 to 779) SpanInfo: {"start":764,"length":15} + >secondarySkillA + >:=> (line 27, col 28) to (line 27, col 43) +27 >for (let [, [primarySkillA, secondarySkillA]] of multiRobots) { + + ~ => Pos: (780 to 780) SpanInfo: {"start":748,"length":32} + >[primarySkillA, secondarySkillA] + >:=> (line 27, col 12) to (line 27, col 44) +27 >for (let [, [primarySkillA, secondarySkillA]] of multiRobots) { + + ~~~~~~~~~~~~~~~~~~~=> Pos: (781 to 799) SpanInfo: {"start":785,"length":11} + >multiRobots + >:=> (line 27, col 49) to (line 27, col 60) +-------------------------------- +28 > console.log(primarySkillA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (800 to 831) SpanInfo: {"start":804,"length":26} + >console.log(primarySkillA) + >:=> (line 28, col 4) to (line 28, col 30) +-------------------------------- +29 >} + + ~~ => Pos: (832 to 833) SpanInfo: {"start":804,"length":26} + >console.log(primarySkillA) + >:=> (line 28, col 4) to (line 28, col 30) +-------------------------------- +30 >for (let [, [primarySkillA, secondarySkillA]] of getMultiRobots()) { + + ~~~~~~~~~~~ => Pos: (834 to 844) SpanInfo: {"start":846,"length":32} + >[primarySkillA, secondarySkillA] + >:=> (line 30, col 12) to (line 30, col 44) +30 >for (let [, [primarySkillA, secondarySkillA]] of getMultiRobots()) { + + ~~~~~~~~~~~~~~~~ => Pos: (845 to 860) SpanInfo: {"start":847,"length":13} + >primarySkillA + >:=> (line 30, col 13) to (line 30, col 26) +30 >for (let [, [primarySkillA, secondarySkillA]] of getMultiRobots()) { + + ~~~~~~~~~~~~~~~~~ => Pos: (861 to 877) SpanInfo: {"start":862,"length":15} + >secondarySkillA + >:=> (line 30, col 28) to (line 30, col 43) +30 >for (let [, [primarySkillA, secondarySkillA]] of getMultiRobots()) { + + ~ => Pos: (878 to 878) SpanInfo: {"start":846,"length":32} + >[primarySkillA, secondarySkillA] + >:=> (line 30, col 12) to (line 30, col 44) +30 >for (let [, [primarySkillA, secondarySkillA]] of getMultiRobots()) { + + ~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (879 to 902) SpanInfo: {"start":883,"length":16} + >getMultiRobots() + >:=> (line 30, col 49) to (line 30, col 65) +-------------------------------- +31 > console.log(primarySkillA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (903 to 934) SpanInfo: {"start":907,"length":26} + >console.log(primarySkillA) + >:=> (line 31, col 4) to (line 31, col 30) +-------------------------------- +32 >} + + ~~ => Pos: (935 to 936) SpanInfo: {"start":907,"length":26} + >console.log(primarySkillA) + >:=> (line 31, col 4) to (line 31, col 30) +-------------------------------- +33 >for (let [, [primarySkillA, secondarySkillA]] of [multiRobotA, multiRobotB]) { + + ~~~~~~~~~~~ => Pos: (937 to 947) SpanInfo: {"start":949,"length":32} + >[primarySkillA, secondarySkillA] + >:=> (line 33, col 12) to (line 33, col 44) +33 >for (let [, [primarySkillA, secondarySkillA]] of [multiRobotA, multiRobotB]) { + + ~~~~~~~~~~~~~~~~ => Pos: (948 to 963) SpanInfo: {"start":950,"length":13} + >primarySkillA + >:=> (line 33, col 13) to (line 33, col 26) +33 >for (let [, [primarySkillA, secondarySkillA]] of [multiRobotA, multiRobotB]) { + + ~~~~~~~~~~~~~~~~~ => Pos: (964 to 980) SpanInfo: {"start":965,"length":15} + >secondarySkillA + >:=> (line 33, col 28) to (line 33, col 43) +33 >for (let [, [primarySkillA, secondarySkillA]] of [multiRobotA, multiRobotB]) { + + ~ => Pos: (981 to 981) SpanInfo: {"start":949,"length":32} + >[primarySkillA, secondarySkillA] + >:=> (line 33, col 12) to (line 33, col 44) +33 >for (let [, [primarySkillA, secondarySkillA]] of [multiRobotA, multiRobotB]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (982 to 1015) SpanInfo: {"start":986,"length":26} + >[multiRobotA, multiRobotB] + >:=> (line 33, col 49) to (line 33, col 75) +-------------------------------- +34 > console.log(primarySkillA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1016 to 1047) SpanInfo: {"start":1020,"length":26} + >console.log(primarySkillA) + >:=> (line 34, col 4) to (line 34, col 30) +-------------------------------- +35 >} + + ~~ => Pos: (1048 to 1049) SpanInfo: {"start":1020,"length":26} + >console.log(primarySkillA) + >:=> (line 34, col 4) to (line 34, col 30) +-------------------------------- +36 >for (let [numberB] of robots) { + + ~~~~~~~~~~~~~~~~~~ => Pos: (1050 to 1067) SpanInfo: {"start":1060,"length":7} + >numberB + >:=> (line 36, col 10) to (line 36, col 17) +36 >for (let [numberB] of robots) { + + ~~~~~~~~~~~~~~ => Pos: (1068 to 1081) SpanInfo: {"start":1072,"length":6} + >robots + >:=> (line 36, col 22) to (line 36, col 28) +-------------------------------- +37 > console.log(numberB); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1082 to 1107) SpanInfo: {"start":1086,"length":20} + >console.log(numberB) + >:=> (line 37, col 4) to (line 37, col 24) +-------------------------------- +38 >} + + ~~ => Pos: (1108 to 1109) SpanInfo: {"start":1086,"length":20} + >console.log(numberB) + >:=> (line 37, col 4) to (line 37, col 24) +-------------------------------- +39 >for (let [numberB] of getRobots()) { + + ~~~~~~~~~~~~~~~~~~ => Pos: (1110 to 1127) SpanInfo: {"start":1120,"length":7} + >numberB + >:=> (line 39, col 10) to (line 39, col 17) +39 >for (let [numberB] of getRobots()) { + + ~~~~~~~~~~~~~~~~~~~ => Pos: (1128 to 1146) SpanInfo: {"start":1132,"length":11} + >getRobots() + >:=> (line 39, col 22) to (line 39, col 33) +-------------------------------- +40 > console.log(numberB); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1147 to 1172) SpanInfo: {"start":1151,"length":20} + >console.log(numberB) + >:=> (line 40, col 4) to (line 40, col 24) +-------------------------------- +41 >} + + ~~ => Pos: (1173 to 1174) SpanInfo: {"start":1151,"length":20} + >console.log(numberB) + >:=> (line 40, col 4) to (line 40, col 24) +-------------------------------- +42 >for (let [numberB] of [robotA, robotB]) { + + ~~~~~~~~~~~~~~~~~~ => Pos: (1175 to 1192) SpanInfo: {"start":1185,"length":7} + >numberB + >:=> (line 42, col 10) to (line 42, col 17) +42 >for (let [numberB] of [robotA, robotB]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1193 to 1216) SpanInfo: {"start":1197,"length":16} + >[robotA, robotB] + >:=> (line 42, col 22) to (line 42, col 38) +-------------------------------- +43 > console.log(numberB); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1217 to 1242) SpanInfo: {"start":1221,"length":20} + >console.log(numberB) + >:=> (line 43, col 4) to (line 43, col 24) +-------------------------------- +44 >} + + ~~ => Pos: (1243 to 1244) SpanInfo: {"start":1221,"length":20} + >console.log(numberB) + >:=> (line 43, col 4) to (line 43, col 24) +-------------------------------- +45 >for (let [nameB] of multiRobots) { + + ~~~~~~~~~~~~~~~~ => Pos: (1245 to 1260) SpanInfo: {"start":1255,"length":5} + >nameB + >:=> (line 45, col 10) to (line 45, col 15) +45 >for (let [nameB] of multiRobots) { + + ~~~~~~~~~~~~~~~~~~~ => Pos: (1261 to 1279) SpanInfo: {"start":1265,"length":11} + >multiRobots + >:=> (line 45, col 20) to (line 45, col 31) +-------------------------------- +46 > console.log(nameB); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1280 to 1303) SpanInfo: {"start":1284,"length":18} + >console.log(nameB) + >:=> (line 46, col 4) to (line 46, col 22) +-------------------------------- +47 >} + + ~~ => Pos: (1304 to 1305) SpanInfo: {"start":1284,"length":18} + >console.log(nameB) + >:=> (line 46, col 4) to (line 46, col 22) +-------------------------------- +48 >for (let [nameB] of getMultiRobots()) { + + ~~~~~~~~~~~~~~~~ => Pos: (1306 to 1321) SpanInfo: {"start":1316,"length":5} + >nameB + >:=> (line 48, col 10) to (line 48, col 15) +48 >for (let [nameB] of getMultiRobots()) { + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1322 to 1345) SpanInfo: {"start":1326,"length":16} + >getMultiRobots() + >:=> (line 48, col 20) to (line 48, col 36) +-------------------------------- +49 > console.log(nameB); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1346 to 1369) SpanInfo: {"start":1350,"length":18} + >console.log(nameB) + >:=> (line 49, col 4) to (line 49, col 22) +-------------------------------- +50 >} + + ~~ => Pos: (1370 to 1371) SpanInfo: {"start":1350,"length":18} + >console.log(nameB) + >:=> (line 49, col 4) to (line 49, col 22) +-------------------------------- +51 >for (let [nameB] of [multiRobotA, multiRobotB]) { + + ~~~~~~~~~~~~~~~~ => Pos: (1372 to 1387) SpanInfo: {"start":1382,"length":5} + >nameB + >:=> (line 51, col 10) to (line 51, col 15) +51 >for (let [nameB] of [multiRobotA, multiRobotB]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1388 to 1421) SpanInfo: {"start":1392,"length":26} + >[multiRobotA, multiRobotB] + >:=> (line 51, col 20) to (line 51, col 46) +-------------------------------- +52 > console.log(nameB); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1422 to 1445) SpanInfo: {"start":1426,"length":18} + >console.log(nameB) + >:=> (line 52, col 4) to (line 52, col 22) +-------------------------------- +53 >} + + ~~ => Pos: (1446 to 1447) SpanInfo: {"start":1426,"length":18} + >console.log(nameB) + >:=> (line 52, col 4) to (line 52, col 22) +-------------------------------- +54 >for (let [numberA2, nameA2, skillA2] of robots) { + + ~~~~~~~~~~~~~~~~~~~ => Pos: (1448 to 1466) SpanInfo: {"start":1458,"length":8} + >numberA2 + >:=> (line 54, col 10) to (line 54, col 18) +54 >for (let [numberA2, nameA2, skillA2] of robots) { + + ~~~~~~~~ => Pos: (1467 to 1474) SpanInfo: {"start":1468,"length":6} + >nameA2 + >:=> (line 54, col 20) to (line 54, col 26) +54 >for (let [numberA2, nameA2, skillA2] of robots) { + + ~~~~~~~~~ => Pos: (1475 to 1483) SpanInfo: {"start":1476,"length":7} + >skillA2 + >:=> (line 54, col 28) to (line 54, col 35) +54 >for (let [numberA2, nameA2, skillA2] of robots) { + + ~~~~~~~~~~~~~~=> Pos: (1484 to 1497) SpanInfo: {"start":1488,"length":6} + >robots + >:=> (line 54, col 40) to (line 54, col 46) +-------------------------------- +55 > console.log(nameA2); + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1498 to 1522) SpanInfo: {"start":1502,"length":19} + >console.log(nameA2) + >:=> (line 55, col 4) to (line 55, col 23) +-------------------------------- +56 >} + + ~~ => Pos: (1523 to 1524) SpanInfo: {"start":1502,"length":19} + >console.log(nameA2) + >:=> (line 55, col 4) to (line 55, col 23) +-------------------------------- +57 >for (let [numberA2, nameA2, skillA2] of getRobots()) { + + ~~~~~~~~~~~~~~~~~~~ => Pos: (1525 to 1543) SpanInfo: {"start":1535,"length":8} + >numberA2 + >:=> (line 57, col 10) to (line 57, col 18) +57 >for (let [numberA2, nameA2, skillA2] of getRobots()) { + + ~~~~~~~~ => Pos: (1544 to 1551) SpanInfo: {"start":1545,"length":6} + >nameA2 + >:=> (line 57, col 20) to (line 57, col 26) +57 >for (let [numberA2, nameA2, skillA2] of getRobots()) { + + ~~~~~~~~~ => Pos: (1552 to 1560) SpanInfo: {"start":1553,"length":7} + >skillA2 + >:=> (line 57, col 28) to (line 57, col 35) +57 >for (let [numberA2, nameA2, skillA2] of getRobots()) { + + ~~~~~~~~~~~~~~~~~~~=> Pos: (1561 to 1579) SpanInfo: {"start":1565,"length":11} + >getRobots() + >:=> (line 57, col 40) to (line 57, col 51) +-------------------------------- +58 > console.log(nameA2); + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1580 to 1604) SpanInfo: {"start":1584,"length":19} + >console.log(nameA2) + >:=> (line 58, col 4) to (line 58, col 23) +-------------------------------- +59 >} + + ~~ => Pos: (1605 to 1606) SpanInfo: {"start":1584,"length":19} + >console.log(nameA2) + >:=> (line 58, col 4) to (line 58, col 23) +-------------------------------- +60 >for (let [numberA2, nameA2, skillA2] of [robotA, robotB]) { + + ~~~~~~~~~~~~~~~~~~~ => Pos: (1607 to 1625) SpanInfo: {"start":1617,"length":8} + >numberA2 + >:=> (line 60, col 10) to (line 60, col 18) +60 >for (let [numberA2, nameA2, skillA2] of [robotA, robotB]) { + + ~~~~~~~~ => Pos: (1626 to 1633) SpanInfo: {"start":1627,"length":6} + >nameA2 + >:=> (line 60, col 20) to (line 60, col 26) +60 >for (let [numberA2, nameA2, skillA2] of [robotA, robotB]) { + + ~~~~~~~~~ => Pos: (1634 to 1642) SpanInfo: {"start":1635,"length":7} + >skillA2 + >:=> (line 60, col 28) to (line 60, col 35) +60 >for (let [numberA2, nameA2, skillA2] of [robotA, robotB]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1643 to 1666) SpanInfo: {"start":1647,"length":16} + >[robotA, robotB] + >:=> (line 60, col 40) to (line 60, col 56) +-------------------------------- +61 > console.log(nameA2); + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1667 to 1691) SpanInfo: {"start":1671,"length":19} + >console.log(nameA2) + >:=> (line 61, col 4) to (line 61, col 23) +-------------------------------- +62 >} + + ~~ => Pos: (1692 to 1693) SpanInfo: {"start":1671,"length":19} + >console.log(nameA2) + >:=> (line 61, col 4) to (line 61, col 23) +-------------------------------- +63 >for (let [nameMA, [primarySkillA, secondarySkillA]] of multiRobots) { + + ~~~~~~~~~~~~~~~~~ => Pos: (1694 to 1710) SpanInfo: {"start":1704,"length":6} + >nameMA + >:=> (line 63, col 10) to (line 63, col 16) +63 >for (let [nameMA, [primarySkillA, secondarySkillA]] of multiRobots) { + + ~~~~~~~~~~~~~~~~ => Pos: (1711 to 1726) SpanInfo: {"start":1713,"length":13} + >primarySkillA + >:=> (line 63, col 19) to (line 63, col 32) +63 >for (let [nameMA, [primarySkillA, secondarySkillA]] of multiRobots) { + + ~~~~~~~~~~~~~~~~~=> Pos: (1727 to 1743) SpanInfo: {"start":1728,"length":15} + >secondarySkillA + >:=> (line 63, col 34) to (line 63, col 49) +63 >for (let [nameMA, [primarySkillA, secondarySkillA]] of multiRobots) { + + ~=> Pos: (1744 to 1744) SpanInfo: {"start":1712,"length":32} + >[primarySkillA, secondarySkillA] + >:=> (line 63, col 18) to (line 63, col 50) +63 >for (let [nameMA, [primarySkillA, secondarySkillA]] of multiRobots) { + + ~~~~~~~~~~~~~~~~~~~=> Pos: (1745 to 1763) SpanInfo: {"start":1749,"length":11} + >multiRobots + >:=> (line 63, col 55) to (line 63, col 66) +-------------------------------- +64 > console.log(nameMA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1764 to 1788) SpanInfo: {"start":1768,"length":19} + >console.log(nameMA) + >:=> (line 64, col 4) to (line 64, col 23) +-------------------------------- +65 >} + + ~~ => Pos: (1789 to 1790) SpanInfo: {"start":1768,"length":19} + >console.log(nameMA) + >:=> (line 64, col 4) to (line 64, col 23) +-------------------------------- +66 >for (let [nameMA, [primarySkillA, secondarySkillA]] of getMultiRobots()) { + + ~~~~~~~~~~~~~~~~~ => Pos: (1791 to 1807) SpanInfo: {"start":1801,"length":6} + >nameMA + >:=> (line 66, col 10) to (line 66, col 16) +66 >for (let [nameMA, [primarySkillA, secondarySkillA]] of getMultiRobots()) { + + ~~~~~~~~~~~~~~~~ => Pos: (1808 to 1823) SpanInfo: {"start":1810,"length":13} + >primarySkillA + >:=> (line 66, col 19) to (line 66, col 32) +66 >for (let [nameMA, [primarySkillA, secondarySkillA]] of getMultiRobots()) { + + ~~~~~~~~~~~~~~~~~=> Pos: (1824 to 1840) SpanInfo: {"start":1825,"length":15} + >secondarySkillA + >:=> (line 66, col 34) to (line 66, col 49) +66 >for (let [nameMA, [primarySkillA, secondarySkillA]] of getMultiRobots()) { + + ~=> Pos: (1841 to 1841) SpanInfo: {"start":1809,"length":32} + >[primarySkillA, secondarySkillA] + >:=> (line 66, col 18) to (line 66, col 50) +66 >for (let [nameMA, [primarySkillA, secondarySkillA]] of getMultiRobots()) { + + ~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1842 to 1865) SpanInfo: {"start":1846,"length":16} + >getMultiRobots() + >:=> (line 66, col 55) to (line 66, col 71) +-------------------------------- +67 > console.log(nameMA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1866 to 1890) SpanInfo: {"start":1870,"length":19} + >console.log(nameMA) + >:=> (line 67, col 4) to (line 67, col 23) +-------------------------------- +68 >} + + ~~ => Pos: (1891 to 1892) SpanInfo: {"start":1870,"length":19} + >console.log(nameMA) + >:=> (line 67, col 4) to (line 67, col 23) +-------------------------------- +69 >for (let [nameMA, [primarySkillA, secondarySkillA]] of [multiRobotA, multiRobotB]) { + + ~~~~~~~~~~~~~~~~~ => Pos: (1893 to 1909) SpanInfo: {"start":1903,"length":6} + >nameMA + >:=> (line 69, col 10) to (line 69, col 16) +69 >for (let [nameMA, [primarySkillA, secondarySkillA]] of [multiRobotA, multiRobotB]) { + + ~~~~~~~~~~~~~~~~ => Pos: (1910 to 1925) SpanInfo: {"start":1912,"length":13} + >primarySkillA + >:=> (line 69, col 19) to (line 69, col 32) +69 >for (let [nameMA, [primarySkillA, secondarySkillA]] of [multiRobotA, multiRobotB]) { + + ~~~~~~~~~~~~~~~~~=> Pos: (1926 to 1942) SpanInfo: {"start":1927,"length":15} + >secondarySkillA + >:=> (line 69, col 34) to (line 69, col 49) +69 >for (let [nameMA, [primarySkillA, secondarySkillA]] of [multiRobotA, multiRobotB]) { + + ~=> Pos: (1943 to 1943) SpanInfo: {"start":1911,"length":32} + >[primarySkillA, secondarySkillA] + >:=> (line 69, col 18) to (line 69, col 50) +69 >for (let [nameMA, [primarySkillA, secondarySkillA]] of [multiRobotA, multiRobotB]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1944 to 1977) SpanInfo: {"start":1948,"length":26} + >[multiRobotA, multiRobotB] + >:=> (line 69, col 55) to (line 69, col 81) +-------------------------------- +70 > console.log(nameMA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1978 to 2002) SpanInfo: {"start":1982,"length":19} + >console.log(nameMA) + >:=> (line 70, col 4) to (line 70, col 23) +-------------------------------- +71 >} + + ~~ => Pos: (2003 to 2004) SpanInfo: {"start":1982,"length":19} + >console.log(nameMA) + >:=> (line 70, col 4) to (line 70, col 23) +-------------------------------- +72 >for (let [numberA3, ...robotAInfo] of robots) { + + ~~~~~~~~~~~~~~~~~~~ => Pos: (2005 to 2023) SpanInfo: {"start":2015,"length":8} + >numberA3 + >:=> (line 72, col 10) to (line 72, col 18) +72 >for (let [numberA3, ...robotAInfo] of robots) { + + ~~~~~~~~~~~~~~~ => Pos: (2024 to 2038) SpanInfo: {"start":2025,"length":13} + >...robotAInfo + >:=> (line 72, col 20) to (line 72, col 33) +72 >for (let [numberA3, ...robotAInfo] of robots) { + + ~~~~~~~~~~~~~~=> Pos: (2039 to 2052) SpanInfo: {"start":2043,"length":6} + >robots + >:=> (line 72, col 38) to (line 72, col 44) +-------------------------------- +73 > console.log(numberA3); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2053 to 2079) SpanInfo: {"start":2057,"length":21} + >console.log(numberA3) + >:=> (line 73, col 4) to (line 73, col 25) +-------------------------------- +74 >} + + ~~ => Pos: (2080 to 2081) SpanInfo: {"start":2057,"length":21} + >console.log(numberA3) + >:=> (line 73, col 4) to (line 73, col 25) +-------------------------------- +75 >for (let [numberA3, ...robotAInfo] of getRobots()) { + + ~~~~~~~~~~~~~~~~~~~ => Pos: (2082 to 2100) SpanInfo: {"start":2092,"length":8} + >numberA3 + >:=> (line 75, col 10) to (line 75, col 18) +75 >for (let [numberA3, ...robotAInfo] of getRobots()) { + + ~~~~~~~~~~~~~~~ => Pos: (2101 to 2115) SpanInfo: {"start":2102,"length":13} + >...robotAInfo + >:=> (line 75, col 20) to (line 75, col 33) +75 >for (let [numberA3, ...robotAInfo] of getRobots()) { + + ~~~~~~~~~~~~~~~~~~~=> Pos: (2116 to 2134) SpanInfo: {"start":2120,"length":11} + >getRobots() + >:=> (line 75, col 38) to (line 75, col 49) +-------------------------------- +76 > console.log(numberA3); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2135 to 2161) SpanInfo: {"start":2139,"length":21} + >console.log(numberA3) + >:=> (line 76, col 4) to (line 76, col 25) +-------------------------------- +77 >} + + ~~ => Pos: (2162 to 2163) SpanInfo: {"start":2139,"length":21} + >console.log(numberA3) + >:=> (line 76, col 4) to (line 76, col 25) +-------------------------------- +78 >for (let [numberA3, ...robotAInfo] of [robotA, robotB]) { + + ~~~~~~~~~~~~~~~~~~~ => Pos: (2164 to 2182) SpanInfo: {"start":2174,"length":8} + >numberA3 + >:=> (line 78, col 10) to (line 78, col 18) +78 >for (let [numberA3, ...robotAInfo] of [robotA, robotB]) { + + ~~~~~~~~~~~~~~~ => Pos: (2183 to 2197) SpanInfo: {"start":2184,"length":13} + >...robotAInfo + >:=> (line 78, col 20) to (line 78, col 33) +78 >for (let [numberA3, ...robotAInfo] of [robotA, robotB]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (2198 to 2221) SpanInfo: {"start":2202,"length":16} + >[robotA, robotB] + >:=> (line 78, col 38) to (line 78, col 54) +-------------------------------- +79 > console.log(numberA3); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2222 to 2248) SpanInfo: {"start":2226,"length":21} + >console.log(numberA3) + >:=> (line 79, col 4) to (line 79, col 25) +-------------------------------- +80 >} + + ~~ => Pos: (2249 to 2250) SpanInfo: {"start":2226,"length":21} + >console.log(numberA3) + >:=> (line 79, col 4) to (line 79, col 25) +-------------------------------- +81 >for (let [...multiRobotAInfo] of multiRobots) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2251 to 2279) SpanInfo: {"start":2261,"length":18} + >...multiRobotAInfo + >:=> (line 81, col 10) to (line 81, col 28) +81 >for (let [...multiRobotAInfo] of multiRobots) { + + ~~~~~~~~~~~~~~~~~~~=> Pos: (2280 to 2298) SpanInfo: {"start":2284,"length":11} + >multiRobots + >:=> (line 81, col 33) to (line 81, col 44) +-------------------------------- +82 > console.log(multiRobotAInfo); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2299 to 2332) SpanInfo: {"start":2303,"length":28} + >console.log(multiRobotAInfo) + >:=> (line 82, col 4) to (line 82, col 32) +-------------------------------- +83 >} + + ~~ => Pos: (2333 to 2334) SpanInfo: {"start":2303,"length":28} + >console.log(multiRobotAInfo) + >:=> (line 82, col 4) to (line 82, col 32) +-------------------------------- +84 >for (let [...multiRobotAInfo] of getMultiRobots()) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2335 to 2363) SpanInfo: {"start":2345,"length":18} + >...multiRobotAInfo + >:=> (line 84, col 10) to (line 84, col 28) +84 >for (let [...multiRobotAInfo] of getMultiRobots()) { + + ~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (2364 to 2387) SpanInfo: {"start":2368,"length":16} + >getMultiRobots() + >:=> (line 84, col 33) to (line 84, col 49) +-------------------------------- +85 > console.log(multiRobotAInfo); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2388 to 2421) SpanInfo: {"start":2392,"length":28} + >console.log(multiRobotAInfo) + >:=> (line 85, col 4) to (line 85, col 32) +-------------------------------- +86 >} + + ~~ => Pos: (2422 to 2423) SpanInfo: {"start":2392,"length":28} + >console.log(multiRobotAInfo) + >:=> (line 85, col 4) to (line 85, col 32) +-------------------------------- +87 >for (let [...multiRobotAInfo] of [multiRobotA, multiRobotB]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2424 to 2452) SpanInfo: {"start":2434,"length":18} + >...multiRobotAInfo + >:=> (line 87, col 10) to (line 87, col 28) +87 >for (let [...multiRobotAInfo] of [multiRobotA, multiRobotB]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (2453 to 2486) SpanInfo: {"start":2457,"length":26} + >[multiRobotA, multiRobotB] + >:=> (line 87, col 33) to (line 87, col 59) +-------------------------------- +88 > console.log(multiRobotAInfo); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2487 to 2520) SpanInfo: {"start":2491,"length":28} + >console.log(multiRobotAInfo) + >:=> (line 88, col 4) to (line 88, col 32) +-------------------------------- +89 >} + ~ => Pos: (2521 to 2521) SpanInfo: {"start":2491,"length":28} + >console.log(multiRobotAInfo) + >:=> (line 88, col 4) to (line 88, col 32) \ No newline at end of file diff --git a/tests/baselines/reference/bpSpanDestructuringForOfArrayBindingPatternDefaultValues.baseline b/tests/baselines/reference/bpSpanDestructuringForOfArrayBindingPatternDefaultValues.baseline new file mode 100644 index 00000000000..5dfc730003f --- /dev/null +++ b/tests/baselines/reference/bpSpanDestructuringForOfArrayBindingPatternDefaultValues.baseline @@ -0,0 +1,814 @@ + +1 >declare var console: { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (0 to 22) SpanInfo: undefined +-------------------------------- +2 > log(msg: any): void; + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (23 to 47) SpanInfo: undefined +-------------------------------- +3 >} + + ~~ => Pos: (48 to 49) SpanInfo: undefined +-------------------------------- +4 >type Robot = [number, string, string]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (50 to 88) SpanInfo: undefined +-------------------------------- +5 >type MultiSkilledRobot = [string, [string, string]]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (89 to 141) SpanInfo: undefined +-------------------------------- +6 >let robotA: Robot = [1, "mower", "mowing"]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (142 to 185) SpanInfo: {"start":142,"length":42} + >let robotA: Robot = [1, "mower", "mowing"] + >:=> (line 6, col 0) to (line 6, col 42) +-------------------------------- +7 >let robotB: Robot = [2, "trimmer", "trimming"]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (186 to 233) SpanInfo: {"start":186,"length":46} + >let robotB: Robot = [2, "trimmer", "trimming"] + >:=> (line 7, col 0) to (line 7, col 46) +-------------------------------- +8 >let robots = [robotA, robotB]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (234 to 264) SpanInfo: {"start":234,"length":29} + >let robots = [robotA, robotB] + >:=> (line 8, col 0) to (line 8, col 29) +-------------------------------- +9 >function getRobots() { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (265 to 287) SpanInfo: {"start":292,"length":13} + >return robots + >:=> (line 10, col 4) to (line 10, col 17) +-------------------------------- +10 > return robots; + + ~~~~~~~~~~~~~~~~~~~ => Pos: (288 to 306) SpanInfo: {"start":292,"length":13} + >return robots + >:=> (line 10, col 4) to (line 10, col 17) +-------------------------------- +11 >} + + ~~ => Pos: (307 to 308) SpanInfo: {"start":307,"length":1} + >} + >:=> (line 11, col 0) to (line 11, col 1) +-------------------------------- +12 >let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (309 to 372) SpanInfo: {"start":309,"length":62} + >let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]] + >:=> (line 12, col 0) to (line 12, col 62) +-------------------------------- +13 >let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (373 to 446) SpanInfo: {"start":373,"length":72} + >let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]] + >:=> (line 13, col 0) to (line 13, col 72) +-------------------------------- +14 >let multiRobots = [multiRobotA, multiRobotB]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (447 to 492) SpanInfo: {"start":447,"length":44} + >let multiRobots = [multiRobotA, multiRobotB] + >:=> (line 14, col 0) to (line 14, col 44) +-------------------------------- +15 >function getMultiRobots() { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (493 to 520) SpanInfo: {"start":525,"length":18} + >return multiRobots + >:=> (line 16, col 4) to (line 16, col 22) +-------------------------------- +16 > return multiRobots; + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (521 to 544) SpanInfo: {"start":525,"length":18} + >return multiRobots + >:=> (line 16, col 4) to (line 16, col 22) +-------------------------------- +17 >} + + ~~ => Pos: (545 to 546) SpanInfo: {"start":545,"length":1} + >} + >:=> (line 17, col 0) to (line 17, col 1) +-------------------------------- +18 >for (let [, nameA = "noName"] of robots) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (547 to 575) SpanInfo: {"start":559,"length":16} + >nameA = "noName" + >:=> (line 18, col 12) to (line 18, col 28) +18 >for (let [, nameA = "noName"] of robots) { + + ~~~~~~~~~~~~~~ => Pos: (576 to 589) SpanInfo: {"start":580,"length":6} + >robots + >:=> (line 18, col 33) to (line 18, col 39) +-------------------------------- +19 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (590 to 613) SpanInfo: {"start":594,"length":18} + >console.log(nameA) + >:=> (line 19, col 4) to (line 19, col 22) +-------------------------------- +20 >} + + ~~ => Pos: (614 to 615) SpanInfo: {"start":594,"length":18} + >console.log(nameA) + >:=> (line 19, col 4) to (line 19, col 22) +-------------------------------- +21 >for (let [, nameA = "noName"] of getRobots()) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (616 to 644) SpanInfo: {"start":628,"length":16} + >nameA = "noName" + >:=> (line 21, col 12) to (line 21, col 28) +21 >for (let [, nameA = "noName"] of getRobots()) { + + ~~~~~~~~~~~~~~~~~~~=> Pos: (645 to 663) SpanInfo: {"start":649,"length":11} + >getRobots() + >:=> (line 21, col 33) to (line 21, col 44) +-------------------------------- +22 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (664 to 687) SpanInfo: {"start":668,"length":18} + >console.log(nameA) + >:=> (line 22, col 4) to (line 22, col 22) +-------------------------------- +23 >} + + ~~ => Pos: (688 to 689) SpanInfo: {"start":668,"length":18} + >console.log(nameA) + >:=> (line 22, col 4) to (line 22, col 22) +-------------------------------- +24 >for (let [, nameA = "noName"] of [robotA, robotB]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (690 to 718) SpanInfo: {"start":702,"length":16} + >nameA = "noName" + >:=> (line 24, col 12) to (line 24, col 28) +24 >for (let [, nameA = "noName"] of [robotA, robotB]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (719 to 742) SpanInfo: {"start":723,"length":16} + >[robotA, robotB] + >:=> (line 24, col 33) to (line 24, col 49) +-------------------------------- +25 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (743 to 766) SpanInfo: {"start":747,"length":18} + >console.log(nameA) + >:=> (line 25, col 4) to (line 25, col 22) +-------------------------------- +26 >} + + ~~ => Pos: (767 to 768) SpanInfo: {"start":747,"length":18} + >console.log(nameA) + >:=> (line 25, col 4) to (line 25, col 22) +-------------------------------- +27 >for (let [, [ + + ~~~~~~~~~~~ => Pos: (769 to 779) SpanInfo: {"start":781,"length":91} + >[ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + >] = ["skill1", "skill2"] + >:=> (line 27, col 12) to (line 30, col 24) +27 >for (let [, [ + + ~~~ => Pos: (780 to 782) SpanInfo: {"start":787,"length":25} + >primarySkillA = "primary" + >:=> (line 28, col 4) to (line 28, col 29) +-------------------------------- +28 > primarySkillA = "primary", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (783 to 813) SpanInfo: {"start":787,"length":25} + >primarySkillA = "primary" + >:=> (line 28, col 4) to (line 28, col 29) +-------------------------------- +29 > secondarySkillA = "secondary" + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (814 to 847) SpanInfo: {"start":818,"length":29} + >secondarySkillA = "secondary" + >:=> (line 29, col 4) to (line 29, col 33) +-------------------------------- +30 >] = ["skill1", "skill2"]] of multiRobots) { + + ~ => Pos: (848 to 848) SpanInfo: {"start":818,"length":29} + >secondarySkillA = "secondary" + >:=> (line 29, col 4) to (line 29, col 33) +30 >] = ["skill1", "skill2"]] of multiRobots) { + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (849 to 872) SpanInfo: {"start":781,"length":91} + >[ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + >] = ["skill1", "skill2"] + >:=> (line 27, col 12) to (line 30, col 24) +30 >] = ["skill1", "skill2"]] of multiRobots) { + + ~~~~~~~~~~~~~~~~~~~ => Pos: (873 to 891) SpanInfo: {"start":877,"length":11} + >multiRobots + >:=> (line 30, col 29) to (line 30, col 40) +-------------------------------- +31 > console.log(primarySkillA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (892 to 923) SpanInfo: {"start":896,"length":26} + >console.log(primarySkillA) + >:=> (line 31, col 4) to (line 31, col 30) +-------------------------------- +32 >} + + ~~ => Pos: (924 to 925) SpanInfo: {"start":896,"length":26} + >console.log(primarySkillA) + >:=> (line 31, col 4) to (line 31, col 30) +-------------------------------- +33 >for (let [, [ + + ~~~~~~~~~~~ => Pos: (926 to 936) SpanInfo: {"start":938,"length":91} + >[ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + >] = ["skill1", "skill2"] + >:=> (line 33, col 12) to (line 36, col 24) +33 >for (let [, [ + + ~~~ => Pos: (937 to 939) SpanInfo: {"start":944,"length":25} + >primarySkillA = "primary" + >:=> (line 34, col 4) to (line 34, col 29) +-------------------------------- +34 > primarySkillA = "primary", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (940 to 970) SpanInfo: {"start":944,"length":25} + >primarySkillA = "primary" + >:=> (line 34, col 4) to (line 34, col 29) +-------------------------------- +35 > secondarySkillA = "secondary" + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (971 to 1004) SpanInfo: {"start":975,"length":29} + >secondarySkillA = "secondary" + >:=> (line 35, col 4) to (line 35, col 33) +-------------------------------- +36 >] = ["skill1", "skill2"]] of getMultiRobots()) { + + ~ => Pos: (1005 to 1005) SpanInfo: {"start":975,"length":29} + >secondarySkillA = "secondary" + >:=> (line 35, col 4) to (line 35, col 33) +36 >] = ["skill1", "skill2"]] of getMultiRobots()) { + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1006 to 1029) SpanInfo: {"start":938,"length":91} + >[ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + >] = ["skill1", "skill2"] + >:=> (line 33, col 12) to (line 36, col 24) +36 >] = ["skill1", "skill2"]] of getMultiRobots()) { + + ~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1030 to 1053) SpanInfo: {"start":1034,"length":16} + >getMultiRobots() + >:=> (line 36, col 29) to (line 36, col 45) +-------------------------------- +37 > console.log(primarySkillA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1054 to 1085) SpanInfo: {"start":1058,"length":26} + >console.log(primarySkillA) + >:=> (line 37, col 4) to (line 37, col 30) +-------------------------------- +38 >} + + ~~ => Pos: (1086 to 1087) SpanInfo: {"start":1058,"length":26} + >console.log(primarySkillA) + >:=> (line 37, col 4) to (line 37, col 30) +-------------------------------- +39 >for (let [, [ + + ~~~~~~~~~~~ => Pos: (1088 to 1098) SpanInfo: {"start":1100,"length":91} + >[ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + >] = ["skill1", "skill2"] + >:=> (line 39, col 12) to (line 42, col 24) +39 >for (let [, [ + + ~~~ => Pos: (1099 to 1101) SpanInfo: {"start":1106,"length":25} + >primarySkillA = "primary" + >:=> (line 40, col 4) to (line 40, col 29) +-------------------------------- +40 > primarySkillA = "primary", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1102 to 1132) SpanInfo: {"start":1106,"length":25} + >primarySkillA = "primary" + >:=> (line 40, col 4) to (line 40, col 29) +-------------------------------- +41 > secondarySkillA = "secondary" + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1133 to 1166) SpanInfo: {"start":1137,"length":29} + >secondarySkillA = "secondary" + >:=> (line 41, col 4) to (line 41, col 33) +-------------------------------- +42 >] = ["skill1", "skill2"]] of [multiRobotA, multiRobotB]) { + + ~ => Pos: (1167 to 1167) SpanInfo: {"start":1137,"length":29} + >secondarySkillA = "secondary" + >:=> (line 41, col 4) to (line 41, col 33) +42 >] = ["skill1", "skill2"]] of [multiRobotA, multiRobotB]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1168 to 1191) SpanInfo: {"start":1100,"length":91} + >[ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + >] = ["skill1", "skill2"] + >:=> (line 39, col 12) to (line 42, col 24) +42 >] = ["skill1", "skill2"]] of [multiRobotA, multiRobotB]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1192 to 1225) SpanInfo: {"start":1196,"length":26} + >[multiRobotA, multiRobotB] + >:=> (line 42, col 29) to (line 42, col 55) +-------------------------------- +43 > console.log(primarySkillA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1226 to 1257) SpanInfo: {"start":1230,"length":26} + >console.log(primarySkillA) + >:=> (line 43, col 4) to (line 43, col 30) +-------------------------------- +44 >} + + ~~ => Pos: (1258 to 1259) SpanInfo: {"start":1230,"length":26} + >console.log(primarySkillA) + >:=> (line 43, col 4) to (line 43, col 30) +-------------------------------- +45 >for (let [numberB = -1] of robots) { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1260 to 1282) SpanInfo: {"start":1270,"length":12} + >numberB = -1 + >:=> (line 45, col 10) to (line 45, col 22) +45 >for (let [numberB = -1] of robots) { + + ~~~~~~~~~~~~~~ => Pos: (1283 to 1296) SpanInfo: {"start":1287,"length":6} + >robots + >:=> (line 45, col 27) to (line 45, col 33) +-------------------------------- +46 > console.log(numberB); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1297 to 1322) SpanInfo: {"start":1301,"length":20} + >console.log(numberB) + >:=> (line 46, col 4) to (line 46, col 24) +-------------------------------- +47 >} + + ~~ => Pos: (1323 to 1324) SpanInfo: {"start":1301,"length":20} + >console.log(numberB) + >:=> (line 46, col 4) to (line 46, col 24) +-------------------------------- +48 >for (let [numberB = -1] of getRobots()) { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1325 to 1347) SpanInfo: {"start":1335,"length":12} + >numberB = -1 + >:=> (line 48, col 10) to (line 48, col 22) +48 >for (let [numberB = -1] of getRobots()) { + + ~~~~~~~~~~~~~~~~~~~ => Pos: (1348 to 1366) SpanInfo: {"start":1352,"length":11} + >getRobots() + >:=> (line 48, col 27) to (line 48, col 38) +-------------------------------- +49 > console.log(numberB); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1367 to 1392) SpanInfo: {"start":1371,"length":20} + >console.log(numberB) + >:=> (line 49, col 4) to (line 49, col 24) +-------------------------------- +50 >} + + ~~ => Pos: (1393 to 1394) SpanInfo: {"start":1371,"length":20} + >console.log(numberB) + >:=> (line 49, col 4) to (line 49, col 24) +-------------------------------- +51 >for (let [numberB = -1] of [robotA, robotB]) { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1395 to 1417) SpanInfo: {"start":1405,"length":12} + >numberB = -1 + >:=> (line 51, col 10) to (line 51, col 22) +51 >for (let [numberB = -1] of [robotA, robotB]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1418 to 1441) SpanInfo: {"start":1422,"length":16} + >[robotA, robotB] + >:=> (line 51, col 27) to (line 51, col 43) +-------------------------------- +52 > console.log(numberB); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1442 to 1467) SpanInfo: {"start":1446,"length":20} + >console.log(numberB) + >:=> (line 52, col 4) to (line 52, col 24) +-------------------------------- +53 >} + + ~~ => Pos: (1468 to 1469) SpanInfo: {"start":1446,"length":20} + >console.log(numberB) + >:=> (line 52, col 4) to (line 52, col 24) +-------------------------------- +54 >for (let [nameB = "noName"] of multiRobots) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1470 to 1496) SpanInfo: {"start":1480,"length":16} + >nameB = "noName" + >:=> (line 54, col 10) to (line 54, col 26) +54 >for (let [nameB = "noName"] of multiRobots) { + + ~~~~~~~~~~~~~~~~~~~=> Pos: (1497 to 1515) SpanInfo: {"start":1501,"length":11} + >multiRobots + >:=> (line 54, col 31) to (line 54, col 42) +-------------------------------- +55 > console.log(nameB); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1516 to 1539) SpanInfo: {"start":1520,"length":18} + >console.log(nameB) + >:=> (line 55, col 4) to (line 55, col 22) +-------------------------------- +56 >} + + ~~ => Pos: (1540 to 1541) SpanInfo: {"start":1520,"length":18} + >console.log(nameB) + >:=> (line 55, col 4) to (line 55, col 22) +-------------------------------- +57 >for (let [nameB = "noName"] of getMultiRobots()) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1542 to 1568) SpanInfo: {"start":1552,"length":16} + >nameB = "noName" + >:=> (line 57, col 10) to (line 57, col 26) +57 >for (let [nameB = "noName"] of getMultiRobots()) { + + ~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1569 to 1592) SpanInfo: {"start":1573,"length":16} + >getMultiRobots() + >:=> (line 57, col 31) to (line 57, col 47) +-------------------------------- +58 > console.log(nameB); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1593 to 1616) SpanInfo: {"start":1597,"length":18} + >console.log(nameB) + >:=> (line 58, col 4) to (line 58, col 22) +-------------------------------- +59 >} + + ~~ => Pos: (1617 to 1618) SpanInfo: {"start":1597,"length":18} + >console.log(nameB) + >:=> (line 58, col 4) to (line 58, col 22) +-------------------------------- +60 >for (let [nameB = "noName"] of [multiRobotA, multiRobotB]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1619 to 1645) SpanInfo: {"start":1629,"length":16} + >nameB = "noName" + >:=> (line 60, col 10) to (line 60, col 26) +60 >for (let [nameB = "noName"] of [multiRobotA, multiRobotB]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1646 to 1679) SpanInfo: {"start":1650,"length":26} + >[multiRobotA, multiRobotB] + >:=> (line 60, col 31) to (line 60, col 57) +-------------------------------- +61 > console.log(nameB); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1680 to 1703) SpanInfo: {"start":1684,"length":18} + >console.log(nameB) + >:=> (line 61, col 4) to (line 61, col 22) +-------------------------------- +62 >} + + ~~ => Pos: (1704 to 1705) SpanInfo: {"start":1684,"length":18} + >console.log(nameB) + >:=> (line 61, col 4) to (line 61, col 22) +-------------------------------- +63 >for (let [numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of robots) { + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1706 to 1729) SpanInfo: {"start":1716,"length":13} + >numberA2 = -1 + >:=> (line 63, col 10) to (line 63, col 23) +63 >for (let [numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of robots) { + + ~~~~~~~~~~~~~~~~~~~ => Pos: (1730 to 1748) SpanInfo: {"start":1731,"length":17} + >nameA2 = "noName" + >:=> (line 63, col 25) to (line 63, col 42) +63 >for (let [numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of robots) { + + ~~~~~~~~~~~~~~~~~~~=> Pos: (1749 to 1767) SpanInfo: {"start":1750,"length":17} + >skillA2 = "skill" + >:=> (line 63, col 44) to (line 63, col 61) +63 >for (let [numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of robots) { + + ~~~~~~~~~~~~~~=> Pos: (1768 to 1781) SpanInfo: {"start":1772,"length":6} + >robots + >:=> (line 63, col 66) to (line 63, col 72) +-------------------------------- +64 > console.log(nameA2); + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1782 to 1806) SpanInfo: {"start":1786,"length":19} + >console.log(nameA2) + >:=> (line 64, col 4) to (line 64, col 23) +-------------------------------- +65 >} + + ~~ => Pos: (1807 to 1808) SpanInfo: {"start":1786,"length":19} + >console.log(nameA2) + >:=> (line 64, col 4) to (line 64, col 23) +-------------------------------- +66 >for (let [numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of getRobots()) { + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1809 to 1832) SpanInfo: {"start":1819,"length":13} + >numberA2 = -1 + >:=> (line 66, col 10) to (line 66, col 23) +66 >for (let [numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of getRobots()) { + + ~~~~~~~~~~~~~~~~~~~ => Pos: (1833 to 1851) SpanInfo: {"start":1834,"length":17} + >nameA2 = "noName" + >:=> (line 66, col 25) to (line 66, col 42) +66 >for (let [numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of getRobots()) { + + ~~~~~~~~~~~~~~~~~~~=> Pos: (1852 to 1870) SpanInfo: {"start":1853,"length":17} + >skillA2 = "skill" + >:=> (line 66, col 44) to (line 66, col 61) +66 >for (let [numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of getRobots()) { + + ~~~~~~~~~~~~~~~~~~~=> Pos: (1871 to 1889) SpanInfo: {"start":1875,"length":11} + >getRobots() + >:=> (line 66, col 66) to (line 66, col 77) +-------------------------------- +67 > console.log(nameA2); + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1890 to 1914) SpanInfo: {"start":1894,"length":19} + >console.log(nameA2) + >:=> (line 67, col 4) to (line 67, col 23) +-------------------------------- +68 >} + + ~~ => Pos: (1915 to 1916) SpanInfo: {"start":1894,"length":19} + >console.log(nameA2) + >:=> (line 67, col 4) to (line 67, col 23) +-------------------------------- +69 >for (let [numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of [robotA, robotB]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1917 to 1940) SpanInfo: {"start":1927,"length":13} + >numberA2 = -1 + >:=> (line 69, col 10) to (line 69, col 23) +69 >for (let [numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of [robotA, robotB]) { + + ~~~~~~~~~~~~~~~~~~~ => Pos: (1941 to 1959) SpanInfo: {"start":1942,"length":17} + >nameA2 = "noName" + >:=> (line 69, col 25) to (line 69, col 42) +69 >for (let [numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of [robotA, robotB]) { + + ~~~~~~~~~~~~~~~~~~~=> Pos: (1960 to 1978) SpanInfo: {"start":1961,"length":17} + >skillA2 = "skill" + >:=> (line 69, col 44) to (line 69, col 61) +69 >for (let [numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of [robotA, robotB]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1979 to 2002) SpanInfo: {"start":1983,"length":16} + >[robotA, robotB] + >:=> (line 69, col 66) to (line 69, col 82) +-------------------------------- +70 > console.log(nameA2); + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2003 to 2027) SpanInfo: {"start":2007,"length":19} + >console.log(nameA2) + >:=> (line 70, col 4) to (line 70, col 23) +-------------------------------- +71 >} + + ~~ => Pos: (2028 to 2029) SpanInfo: {"start":2007,"length":19} + >console.log(nameA2) + >:=> (line 70, col 4) to (line 70, col 23) +-------------------------------- +72 >for (let [nameMA = "noName", [ + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2030 to 2057) SpanInfo: {"start":2040,"length":17} + >nameMA = "noName" + >:=> (line 72, col 10) to (line 72, col 27) +72 >for (let [nameMA = "noName", [ + + ~~~ => Pos: (2058 to 2060) SpanInfo: {"start":2065,"length":25} + >primarySkillA = "primary" + >:=> (line 73, col 4) to (line 73, col 29) +-------------------------------- +73 > primarySkillA = "primary", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2061 to 2091) SpanInfo: {"start":2065,"length":25} + >primarySkillA = "primary" + >:=> (line 73, col 4) to (line 73, col 29) +-------------------------------- +74 > secondarySkillA = "secondary" + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2092 to 2125) SpanInfo: {"start":2096,"length":29} + >secondarySkillA = "secondary" + >:=> (line 74, col 4) to (line 74, col 33) +-------------------------------- +75 >] = ["skill1", "skill2"]] of multiRobots) { + + ~ => Pos: (2126 to 2126) SpanInfo: {"start":2096,"length":29} + >secondarySkillA = "secondary" + >:=> (line 74, col 4) to (line 74, col 33) +75 >] = ["skill1", "skill2"]] of multiRobots) { + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2127 to 2150) SpanInfo: {"start":2059,"length":91} + >[ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + >] = ["skill1", "skill2"] + >:=> (line 72, col 29) to (line 75, col 24) +75 >] = ["skill1", "skill2"]] of multiRobots) { + + ~~~~~~~~~~~~~~~~~~~ => Pos: (2151 to 2169) SpanInfo: {"start":2155,"length":11} + >multiRobots + >:=> (line 75, col 29) to (line 75, col 40) +-------------------------------- +76 > console.log(nameMA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2170 to 2194) SpanInfo: {"start":2174,"length":19} + >console.log(nameMA) + >:=> (line 76, col 4) to (line 76, col 23) +-------------------------------- +77 >} + + ~~ => Pos: (2195 to 2196) SpanInfo: {"start":2174,"length":19} + >console.log(nameMA) + >:=> (line 76, col 4) to (line 76, col 23) +-------------------------------- +78 >for (let [nameMA = "noName", [ + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2197 to 2224) SpanInfo: {"start":2207,"length":17} + >nameMA = "noName" + >:=> (line 78, col 10) to (line 78, col 27) +78 >for (let [nameMA = "noName", [ + + ~~~ => Pos: (2225 to 2227) SpanInfo: {"start":2232,"length":25} + >primarySkillA = "primary" + >:=> (line 79, col 4) to (line 79, col 29) +-------------------------------- +79 > primarySkillA = "primary", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2228 to 2258) SpanInfo: {"start":2232,"length":25} + >primarySkillA = "primary" + >:=> (line 79, col 4) to (line 79, col 29) +-------------------------------- +80 > secondarySkillA = "secondary" + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2259 to 2292) SpanInfo: {"start":2263,"length":29} + >secondarySkillA = "secondary" + >:=> (line 80, col 4) to (line 80, col 33) +-------------------------------- +81 >] = ["skill1", "skill2"]] of getMultiRobots()) { + + ~ => Pos: (2293 to 2293) SpanInfo: {"start":2263,"length":29} + >secondarySkillA = "secondary" + >:=> (line 80, col 4) to (line 80, col 33) +81 >] = ["skill1", "skill2"]] of getMultiRobots()) { + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2294 to 2317) SpanInfo: {"start":2226,"length":91} + >[ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + >] = ["skill1", "skill2"] + >:=> (line 78, col 29) to (line 81, col 24) +81 >] = ["skill1", "skill2"]] of getMultiRobots()) { + + ~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (2318 to 2341) SpanInfo: {"start":2322,"length":16} + >getMultiRobots() + >:=> (line 81, col 29) to (line 81, col 45) +-------------------------------- +82 > console.log(nameMA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2342 to 2366) SpanInfo: {"start":2346,"length":19} + >console.log(nameMA) + >:=> (line 82, col 4) to (line 82, col 23) +-------------------------------- +83 >} + + ~~ => Pos: (2367 to 2368) SpanInfo: {"start":2346,"length":19} + >console.log(nameMA) + >:=> (line 82, col 4) to (line 82, col 23) +-------------------------------- +84 >for (let [nameMA = "noName", [ + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2369 to 2396) SpanInfo: {"start":2379,"length":17} + >nameMA = "noName" + >:=> (line 84, col 10) to (line 84, col 27) +84 >for (let [nameMA = "noName", [ + + ~~~ => Pos: (2397 to 2399) SpanInfo: {"start":2404,"length":25} + >primarySkillA = "primary" + >:=> (line 85, col 4) to (line 85, col 29) +-------------------------------- +85 > primarySkillA = "primary", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2400 to 2430) SpanInfo: {"start":2404,"length":25} + >primarySkillA = "primary" + >:=> (line 85, col 4) to (line 85, col 29) +-------------------------------- +86 > secondarySkillA = "secondary" + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2431 to 2464) SpanInfo: {"start":2435,"length":29} + >secondarySkillA = "secondary" + >:=> (line 86, col 4) to (line 86, col 33) +-------------------------------- +87 >] = ["skill1", "skill2"]] of [multiRobotA, multiRobotB]) { + + ~ => Pos: (2465 to 2465) SpanInfo: {"start":2435,"length":29} + >secondarySkillA = "secondary" + >:=> (line 86, col 4) to (line 86, col 33) +87 >] = ["skill1", "skill2"]] of [multiRobotA, multiRobotB]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2466 to 2489) SpanInfo: {"start":2398,"length":91} + >[ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + >] = ["skill1", "skill2"] + >:=> (line 84, col 29) to (line 87, col 24) +87 >] = ["skill1", "skill2"]] of [multiRobotA, multiRobotB]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (2490 to 2523) SpanInfo: {"start":2494,"length":26} + >[multiRobotA, multiRobotB] + >:=> (line 87, col 29) to (line 87, col 55) +-------------------------------- +88 > console.log(nameMA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2524 to 2548) SpanInfo: {"start":2528,"length":19} + >console.log(nameMA) + >:=> (line 88, col 4) to (line 88, col 23) +-------------------------------- +89 >} + + ~~ => Pos: (2549 to 2550) SpanInfo: {"start":2528,"length":19} + >console.log(nameMA) + >:=> (line 88, col 4) to (line 88, col 23) +-------------------------------- +90 >for (let [numberA3 = -1, ...robotAInfo] of robots) { + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2551 to 2574) SpanInfo: {"start":2561,"length":13} + >numberA3 = -1 + >:=> (line 90, col 10) to (line 90, col 23) +90 >for (let [numberA3 = -1, ...robotAInfo] of robots) { + + ~~~~~~~~~~~~~~~ => Pos: (2575 to 2589) SpanInfo: {"start":2576,"length":13} + >...robotAInfo + >:=> (line 90, col 25) to (line 90, col 38) +90 >for (let [numberA3 = -1, ...robotAInfo] of robots) { + + ~~~~~~~~~~~~~~=> Pos: (2590 to 2603) SpanInfo: {"start":2594,"length":6} + >robots + >:=> (line 90, col 43) to (line 90, col 49) +-------------------------------- +91 > console.log(numberA3); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2604 to 2630) SpanInfo: {"start":2608,"length":21} + >console.log(numberA3) + >:=> (line 91, col 4) to (line 91, col 25) +-------------------------------- +92 >} + + ~~ => Pos: (2631 to 2632) SpanInfo: {"start":2608,"length":21} + >console.log(numberA3) + >:=> (line 91, col 4) to (line 91, col 25) +-------------------------------- +93 >for (let [numberA3 = -1, ...robotAInfo] of getRobots()) { + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2633 to 2656) SpanInfo: {"start":2643,"length":13} + >numberA3 = -1 + >:=> (line 93, col 10) to (line 93, col 23) +93 >for (let [numberA3 = -1, ...robotAInfo] of getRobots()) { + + ~~~~~~~~~~~~~~~ => Pos: (2657 to 2671) SpanInfo: {"start":2658,"length":13} + >...robotAInfo + >:=> (line 93, col 25) to (line 93, col 38) +93 >for (let [numberA3 = -1, ...robotAInfo] of getRobots()) { + + ~~~~~~~~~~~~~~~~~~~=> Pos: (2672 to 2690) SpanInfo: {"start":2676,"length":11} + >getRobots() + >:=> (line 93, col 43) to (line 93, col 54) +-------------------------------- +94 > console.log(numberA3); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2691 to 2717) SpanInfo: {"start":2695,"length":21} + >console.log(numberA3) + >:=> (line 94, col 4) to (line 94, col 25) +-------------------------------- +95 >} + + ~~ => Pos: (2718 to 2719) SpanInfo: {"start":2695,"length":21} + >console.log(numberA3) + >:=> (line 94, col 4) to (line 94, col 25) +-------------------------------- +96 >for (let [numberA3 = -1, ...robotAInfo] of [robotA, robotB]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2720 to 2743) SpanInfo: {"start":2730,"length":13} + >numberA3 = -1 + >:=> (line 96, col 10) to (line 96, col 23) +96 >for (let [numberA3 = -1, ...robotAInfo] of [robotA, robotB]) { + + ~~~~~~~~~~~~~~~ => Pos: (2744 to 2758) SpanInfo: {"start":2745,"length":13} + >...robotAInfo + >:=> (line 96, col 25) to (line 96, col 38) +96 >for (let [numberA3 = -1, ...robotAInfo] of [robotA, robotB]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (2759 to 2782) SpanInfo: {"start":2763,"length":16} + >[robotA, robotB] + >:=> (line 96, col 43) to (line 96, col 59) +-------------------------------- +97 > console.log(numberA3); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2783 to 2809) SpanInfo: {"start":2787,"length":21} + >console.log(numberA3) + >:=> (line 97, col 4) to (line 97, col 25) +-------------------------------- +98 >} + ~ => Pos: (2810 to 2810) SpanInfo: {"start":2787,"length":21} + >console.log(numberA3) + >:=> (line 97, col 4) to (line 97, col 25) \ No newline at end of file diff --git a/tests/baselines/reference/bpSpanDestructuringForOfObjectBindingPattern.baseline b/tests/baselines/reference/bpSpanDestructuringForOfObjectBindingPattern.baseline new file mode 100644 index 00000000000..14e0d2a2d27 --- /dev/null +++ b/tests/baselines/reference/bpSpanDestructuringForOfObjectBindingPattern.baseline @@ -0,0 +1,523 @@ + +1 >declare var console: { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (0 to 22) SpanInfo: undefined +-------------------------------- +2 > log(msg: any): void; + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (23 to 47) SpanInfo: undefined +-------------------------------- +3 >} + + ~~ => Pos: (48 to 49) SpanInfo: undefined +-------------------------------- +4 >interface Robot { + + ~~~~~~~~~~~~~~~~~~ => Pos: (50 to 67) SpanInfo: undefined +-------------------------------- +5 > name: string; + + ~~~~~~~~~~~~~~~~~~ => Pos: (68 to 85) SpanInfo: undefined +-------------------------------- +6 > skill: string; + + ~~~~~~~~~~~~~~~~~~~ => Pos: (86 to 104) SpanInfo: undefined +-------------------------------- +7 >} + + ~~ => Pos: (105 to 106) SpanInfo: undefined +-------------------------------- +8 >interface MultiRobot { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (107 to 129) SpanInfo: undefined +-------------------------------- +9 > name: string; + + ~~~~~~~~~~~~~~~~~~ => Pos: (130 to 147) SpanInfo: undefined +-------------------------------- +10 > skills: { + + ~~~~~~~~~~~~~~ => Pos: (148 to 161) SpanInfo: undefined +-------------------------------- +11 > primary: string; + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (162 to 186) SpanInfo: undefined +-------------------------------- +12 > secondary: string; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (187 to 213) SpanInfo: undefined +-------------------------------- +13 > }; + + ~~~~~~~ => Pos: (214 to 220) SpanInfo: undefined +-------------------------------- +14 >} + + ~~ => Pos: (221 to 222) SpanInfo: undefined +-------------------------------- +15 >let robots: Robot[] = [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (223 to 322) SpanInfo: {"start":223,"length":98} + >let robots: Robot[] = [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }] + >:=> (line 15, col 0) to (line 15, col 98) +-------------------------------- +16 >let multiRobots: MultiRobot[] = [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (323 to 424) SpanInfo: {"start":323,"length":180} + >let multiRobots: MultiRobot[] = [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] + >:=> (line 16, col 0) to (line 17, col 78) +-------------------------------- +17 > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (425 to 504) SpanInfo: {"start":323,"length":180} + >let multiRobots: MultiRobot[] = [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] + >:=> (line 16, col 0) to (line 17, col 78) +-------------------------------- +18 >function getRobots() { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (505 to 527) SpanInfo: {"start":532,"length":13} + >return robots + >:=> (line 19, col 4) to (line 19, col 17) +-------------------------------- +19 > return robots; + + ~~~~~~~~~~~~~~~~~~~ => Pos: (528 to 546) SpanInfo: {"start":532,"length":13} + >return robots + >:=> (line 19, col 4) to (line 19, col 17) +-------------------------------- +20 >} + + ~~ => Pos: (547 to 548) SpanInfo: {"start":547,"length":1} + >} + >:=> (line 20, col 0) to (line 20, col 1) +-------------------------------- +21 >function getMultiRobots() { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (549 to 576) SpanInfo: {"start":581,"length":18} + >return multiRobots + >:=> (line 22, col 4) to (line 22, col 22) +-------------------------------- +22 > return multiRobots; + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (577 to 600) SpanInfo: {"start":581,"length":18} + >return multiRobots + >:=> (line 22, col 4) to (line 22, col 22) +-------------------------------- +23 >} + + ~~ => Pos: (601 to 602) SpanInfo: {"start":601,"length":1} + >} + >:=> (line 23, col 0) to (line 23, col 1) +-------------------------------- +24 >for (let {name: nameA } of robots) { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (603 to 625) SpanInfo: {"start":613,"length":11} + >name: nameA + >:=> (line 24, col 10) to (line 24, col 21) +24 >for (let {name: nameA } of robots) { + + ~~~~~~~~~~~~~~ => Pos: (626 to 639) SpanInfo: {"start":630,"length":6} + >robots + >:=> (line 24, col 27) to (line 24, col 33) +-------------------------------- +25 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (640 to 663) SpanInfo: {"start":644,"length":18} + >console.log(nameA) + >:=> (line 25, col 4) to (line 25, col 22) +-------------------------------- +26 >} + + ~~ => Pos: (664 to 665) SpanInfo: {"start":644,"length":18} + >console.log(nameA) + >:=> (line 25, col 4) to (line 25, col 22) +-------------------------------- +27 >for (let {name: nameA } of getRobots()) { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (666 to 688) SpanInfo: {"start":676,"length":11} + >name: nameA + >:=> (line 27, col 10) to (line 27, col 21) +27 >for (let {name: nameA } of getRobots()) { + + ~~~~~~~~~~~~~~~~~~~ => Pos: (689 to 707) SpanInfo: {"start":693,"length":11} + >getRobots() + >:=> (line 27, col 27) to (line 27, col 38) +-------------------------------- +28 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (708 to 731) SpanInfo: {"start":712,"length":18} + >console.log(nameA) + >:=> (line 28, col 4) to (line 28, col 22) +-------------------------------- +29 >} + + ~~ => Pos: (732 to 733) SpanInfo: {"start":712,"length":18} + >console.log(nameA) + >:=> (line 28, col 4) to (line 28, col 22) +-------------------------------- +30 >for (let {name: nameA } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (734 to 756) SpanInfo: {"start":744,"length":11} + >name: nameA + >:=> (line 30, col 10) to (line 30, col 21) +30 >for (let {name: nameA } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (757 to 840) SpanInfo: {"start":761,"length":76} + >[{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }] + >:=> (line 30, col 27) to (line 30, col 103) +-------------------------------- +31 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (841 to 864) SpanInfo: {"start":845,"length":18} + >console.log(nameA) + >:=> (line 31, col 4) to (line 31, col 22) +-------------------------------- +32 >} + + ~~ => Pos: (865 to 866) SpanInfo: {"start":845,"length":18} + >console.log(nameA) + >:=> (line 31, col 4) to (line 31, col 22) +-------------------------------- +33 >for (let { skills: { primary: primaryA, secondary: secondaryA } } of multiRobots) { + + ~~~~~~~~~~~~~~~~~~ => Pos: (867 to 884) SpanInfo: {"start":878,"length":52} + >skills: { primary: primaryA, secondary: secondaryA } + >:=> (line 33, col 11) to (line 33, col 63) +33 >for (let { skills: { primary: primaryA, secondary: secondaryA } } of multiRobots) { + + ~~~~~~~~~~~~~~~~~~~~~ => Pos: (885 to 905) SpanInfo: {"start":888,"length":17} + >primary: primaryA + >:=> (line 33, col 21) to (line 33, col 38) +33 >for (let { skills: { primary: primaryA, secondary: secondaryA } } of multiRobots) { + + ~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (906 to 929) SpanInfo: {"start":907,"length":21} + >secondary: secondaryA + >:=> (line 33, col 40) to (line 33, col 61) +33 >for (let { skills: { primary: primaryA, secondary: secondaryA } } of multiRobots) { + + ~~=> Pos: (930 to 931) SpanInfo: {"start":878,"length":52} + >skills: { primary: primaryA, secondary: secondaryA } + >:=> (line 33, col 11) to (line 33, col 63) +33 >for (let { skills: { primary: primaryA, secondary: secondaryA } } of multiRobots) { + + ~~~~~~~~~~~~~~~~~~~=> Pos: (932 to 950) SpanInfo: {"start":936,"length":11} + >multiRobots + >:=> (line 33, col 69) to (line 33, col 80) +-------------------------------- +34 > console.log(primaryA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (951 to 977) SpanInfo: {"start":955,"length":21} + >console.log(primaryA) + >:=> (line 34, col 4) to (line 34, col 25) +-------------------------------- +35 >} + + ~~ => Pos: (978 to 979) SpanInfo: {"start":955,"length":21} + >console.log(primaryA) + >:=> (line 34, col 4) to (line 34, col 25) +-------------------------------- +36 >for (let { skills: { primary: primaryA, secondary: secondaryA } } of getMultiRobots()) { + + ~~~~~~~~~~~~~~~~~~ => Pos: (980 to 997) SpanInfo: {"start":991,"length":52} + >skills: { primary: primaryA, secondary: secondaryA } + >:=> (line 36, col 11) to (line 36, col 63) +36 >for (let { skills: { primary: primaryA, secondary: secondaryA } } of getMultiRobots()) { + + ~~~~~~~~~~~~~~~~~~~~~ => Pos: (998 to 1018) SpanInfo: {"start":1001,"length":17} + >primary: primaryA + >:=> (line 36, col 21) to (line 36, col 38) +36 >for (let { skills: { primary: primaryA, secondary: secondaryA } } of getMultiRobots()) { + + ~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1019 to 1042) SpanInfo: {"start":1020,"length":21} + >secondary: secondaryA + >:=> (line 36, col 40) to (line 36, col 61) +36 >for (let { skills: { primary: primaryA, secondary: secondaryA } } of getMultiRobots()) { + + ~~=> Pos: (1043 to 1044) SpanInfo: {"start":991,"length":52} + >skills: { primary: primaryA, secondary: secondaryA } + >:=> (line 36, col 11) to (line 36, col 63) +36 >for (let { skills: { primary: primaryA, secondary: secondaryA } } of getMultiRobots()) { + + ~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1045 to 1068) SpanInfo: {"start":1049,"length":16} + >getMultiRobots() + >:=> (line 36, col 69) to (line 36, col 85) +-------------------------------- +37 > console.log(primaryA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1069 to 1095) SpanInfo: {"start":1073,"length":21} + >console.log(primaryA) + >:=> (line 37, col 4) to (line 37, col 25) +-------------------------------- +38 >} + + ~~ => Pos: (1096 to 1097) SpanInfo: {"start":1073,"length":21} + >console.log(primaryA) + >:=> (line 37, col 4) to (line 37, col 25) +-------------------------------- +39 >for (let { skills: { primary: primaryA, secondary: secondaryA } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + + ~~~~~~~~~~~~~~~~~~ => Pos: (1098 to 1115) SpanInfo: {"start":1109,"length":52} + >skills: { primary: primaryA, secondary: secondaryA } + >:=> (line 39, col 11) to (line 39, col 63) +39 >for (let { skills: { primary: primaryA, secondary: secondaryA } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + + ~~~~~~~~~~~~~~~~~~~~~ => Pos: (1116 to 1136) SpanInfo: {"start":1119,"length":17} + >primary: primaryA + >:=> (line 39, col 21) to (line 39, col 38) +39 >for (let { skills: { primary: primaryA, secondary: secondaryA } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + + ~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1137 to 1160) SpanInfo: {"start":1138,"length":21} + >secondary: secondaryA + >:=> (line 39, col 40) to (line 39, col 61) +39 >for (let { skills: { primary: primaryA, secondary: secondaryA } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + + ~~=> Pos: (1161 to 1162) SpanInfo: {"start":1109,"length":52} + >skills: { primary: primaryA, secondary: secondaryA } + >:=> (line 39, col 11) to (line 39, col 63) +39 >for (let { skills: { primary: primaryA, secondary: secondaryA } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1163 to 1236) SpanInfo: {"start":1167,"length":148} + >[{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] + >:=> (line 39, col 69) to (line 40, col 78) +-------------------------------- +40 > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1237 to 1318) SpanInfo: {"start":1167,"length":148} + >[{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] + >:=> (line 39, col 69) to (line 40, col 78) +-------------------------------- +41 > console.log(primaryA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1319 to 1345) SpanInfo: {"start":1323,"length":21} + >console.log(primaryA) + >:=> (line 41, col 4) to (line 41, col 25) +-------------------------------- +42 >} + + ~~ => Pos: (1346 to 1347) SpanInfo: {"start":1323,"length":21} + >console.log(primaryA) + >:=> (line 41, col 4) to (line 41, col 25) +-------------------------------- +43 >for (let {name: nameA, skill: skillA } of robots) { + + ~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1348 to 1369) SpanInfo: {"start":1358,"length":11} + >name: nameA + >:=> (line 43, col 10) to (line 43, col 21) +43 >for (let {name: nameA, skill: skillA } of robots) { + + ~~~~~~~~~~~~~~~~ => Pos: (1370 to 1385) SpanInfo: {"start":1371,"length":13} + >skill: skillA + >:=> (line 43, col 23) to (line 43, col 36) +43 >for (let {name: nameA, skill: skillA } of robots) { + + ~~~~~~~~~~~~~~=> Pos: (1386 to 1399) SpanInfo: {"start":1390,"length":6} + >robots + >:=> (line 43, col 42) to (line 43, col 48) +-------------------------------- +44 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1400 to 1423) SpanInfo: {"start":1404,"length":18} + >console.log(nameA) + >:=> (line 44, col 4) to (line 44, col 22) +-------------------------------- +45 >} + + ~~ => Pos: (1424 to 1425) SpanInfo: {"start":1404,"length":18} + >console.log(nameA) + >:=> (line 44, col 4) to (line 44, col 22) +-------------------------------- +46 >for (let {name: nameA, skill: skillA } of getRobots()) { + + ~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1426 to 1447) SpanInfo: {"start":1436,"length":11} + >name: nameA + >:=> (line 46, col 10) to (line 46, col 21) +46 >for (let {name: nameA, skill: skillA } of getRobots()) { + + ~~~~~~~~~~~~~~~~ => Pos: (1448 to 1463) SpanInfo: {"start":1449,"length":13} + >skill: skillA + >:=> (line 46, col 23) to (line 46, col 36) +46 >for (let {name: nameA, skill: skillA } of getRobots()) { + + ~~~~~~~~~~~~~~~~~~~=> Pos: (1464 to 1482) SpanInfo: {"start":1468,"length":11} + >getRobots() + >:=> (line 46, col 42) to (line 46, col 53) +-------------------------------- +47 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1483 to 1506) SpanInfo: {"start":1487,"length":18} + >console.log(nameA) + >:=> (line 47, col 4) to (line 47, col 22) +-------------------------------- +48 >} + + ~~ => Pos: (1507 to 1508) SpanInfo: {"start":1487,"length":18} + >console.log(nameA) + >:=> (line 47, col 4) to (line 47, col 22) +-------------------------------- +49 >for (let {name: nameA, skill: skillA } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { + + ~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1509 to 1530) SpanInfo: {"start":1519,"length":11} + >name: nameA + >:=> (line 49, col 10) to (line 49, col 21) +49 >for (let {name: nameA, skill: skillA } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { + + ~~~~~~~~~~~~~~~~ => Pos: (1531 to 1546) SpanInfo: {"start":1532,"length":13} + >skill: skillA + >:=> (line 49, col 23) to (line 49, col 36) +49 >for (let {name: nameA, skill: skillA } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1547 to 1630) SpanInfo: {"start":1551,"length":76} + >[{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }] + >:=> (line 49, col 42) to (line 49, col 118) +-------------------------------- +50 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1631 to 1654) SpanInfo: {"start":1635,"length":18} + >console.log(nameA) + >:=> (line 50, col 4) to (line 50, col 22) +-------------------------------- +51 >} + + ~~ => Pos: (1655 to 1656) SpanInfo: {"start":1635,"length":18} + >console.log(nameA) + >:=> (line 50, col 4) to (line 50, col 22) +-------------------------------- +52 >for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of multiRobots) { + + ~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1657 to 1678) SpanInfo: {"start":1667,"length":11} + >name: nameA + >:=> (line 52, col 10) to (line 52, col 21) +52 >for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of multiRobots) { + + ~~~~~~~~ => Pos: (1679 to 1686) SpanInfo: {"start":1680,"length":52} + >skills: { primary: primaryA, secondary: secondaryA } + >:=> (line 52, col 23) to (line 52, col 75) +52 >for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of multiRobots) { + + ~~~~~~~~~~~~~~~~~~~~~=> Pos: (1687 to 1707) SpanInfo: {"start":1690,"length":17} + >primary: primaryA + >:=> (line 52, col 33) to (line 52, col 50) +52 >for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of multiRobots) { + + ~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1708 to 1731) SpanInfo: {"start":1709,"length":21} + >secondary: secondaryA + >:=> (line 52, col 52) to (line 52, col 73) +52 >for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of multiRobots) { + + ~~=> Pos: (1732 to 1733) SpanInfo: {"start":1680,"length":52} + >skills: { primary: primaryA, secondary: secondaryA } + >:=> (line 52, col 23) to (line 52, col 75) +52 >for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of multiRobots) { + + ~~~~~~~~~~~~~~~~~~~=> Pos: (1734 to 1752) SpanInfo: {"start":1738,"length":11} + >multiRobots + >:=> (line 52, col 81) to (line 52, col 92) +-------------------------------- +53 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1753 to 1776) SpanInfo: {"start":1757,"length":18} + >console.log(nameA) + >:=> (line 53, col 4) to (line 53, col 22) +-------------------------------- +54 >} + + ~~ => Pos: (1777 to 1778) SpanInfo: {"start":1757,"length":18} + >console.log(nameA) + >:=> (line 53, col 4) to (line 53, col 22) +-------------------------------- +55 >for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of getMultiRobots()) { + + ~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1779 to 1800) SpanInfo: {"start":1789,"length":11} + >name: nameA + >:=> (line 55, col 10) to (line 55, col 21) +55 >for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of getMultiRobots()) { + + ~~~~~~~~ => Pos: (1801 to 1808) SpanInfo: {"start":1802,"length":52} + >skills: { primary: primaryA, secondary: secondaryA } + >:=> (line 55, col 23) to (line 55, col 75) +55 >for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of getMultiRobots()) { + + ~~~~~~~~~~~~~~~~~~~~~=> Pos: (1809 to 1829) SpanInfo: {"start":1812,"length":17} + >primary: primaryA + >:=> (line 55, col 33) to (line 55, col 50) +55 >for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of getMultiRobots()) { + + ~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1830 to 1853) SpanInfo: {"start":1831,"length":21} + >secondary: secondaryA + >:=> (line 55, col 52) to (line 55, col 73) +55 >for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of getMultiRobots()) { + + ~~=> Pos: (1854 to 1855) SpanInfo: {"start":1802,"length":52} + >skills: { primary: primaryA, secondary: secondaryA } + >:=> (line 55, col 23) to (line 55, col 75) +55 >for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of getMultiRobots()) { + + ~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1856 to 1879) SpanInfo: {"start":1860,"length":16} + >getMultiRobots() + >:=> (line 55, col 81) to (line 55, col 97) +-------------------------------- +56 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1880 to 1903) SpanInfo: {"start":1884,"length":18} + >console.log(nameA) + >:=> (line 56, col 4) to (line 56, col 22) +-------------------------------- +57 >} + + ~~ => Pos: (1904 to 1905) SpanInfo: {"start":1884,"length":18} + >console.log(nameA) + >:=> (line 56, col 4) to (line 56, col 22) +-------------------------------- +58 >for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + + ~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1906 to 1927) SpanInfo: {"start":1916,"length":11} + >name: nameA + >:=> (line 58, col 10) to (line 58, col 21) +58 >for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + + ~~~~~~~~ => Pos: (1928 to 1935) SpanInfo: {"start":1929,"length":52} + >skills: { primary: primaryA, secondary: secondaryA } + >:=> (line 58, col 23) to (line 58, col 75) +58 >for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + + ~~~~~~~~~~~~~~~~~~~~~=> Pos: (1936 to 1956) SpanInfo: {"start":1939,"length":17} + >primary: primaryA + >:=> (line 58, col 33) to (line 58, col 50) +58 >for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + + ~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1957 to 1980) SpanInfo: {"start":1958,"length":21} + >secondary: secondaryA + >:=> (line 58, col 52) to (line 58, col 73) +58 >for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + + ~~=> Pos: (1981 to 1982) SpanInfo: {"start":1929,"length":52} + >skills: { primary: primaryA, secondary: secondaryA } + >:=> (line 58, col 23) to (line 58, col 75) +58 >for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1983 to 2056) SpanInfo: {"start":1987,"length":148} + >[{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] + >:=> (line 58, col 81) to (line 59, col 78) +-------------------------------- +59 > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (2057 to 2138) SpanInfo: {"start":1987,"length":148} + >[{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] + >:=> (line 58, col 81) to (line 59, col 78) +-------------------------------- +60 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2139 to 2162) SpanInfo: {"start":2143,"length":18} + >console.log(nameA) + >:=> (line 60, col 4) to (line 60, col 22) +-------------------------------- +61 >} + ~ => Pos: (2163 to 2163) SpanInfo: {"start":2143,"length":18} + >console.log(nameA) + >:=> (line 60, col 4) to (line 60, col 22) \ No newline at end of file diff --git a/tests/baselines/reference/bpSpanDestructuringForOfObjectBindingPatternDefaultValues.baseline b/tests/baselines/reference/bpSpanDestructuringForOfObjectBindingPatternDefaultValues.baseline new file mode 100644 index 00000000000..d2169558daf --- /dev/null +++ b/tests/baselines/reference/bpSpanDestructuringForOfObjectBindingPatternDefaultValues.baseline @@ -0,0 +1,662 @@ + +1 >declare var console: { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (0 to 22) SpanInfo: undefined +-------------------------------- +2 > log(msg: any): void; + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (23 to 47) SpanInfo: undefined +-------------------------------- +3 >} + + ~~ => Pos: (48 to 49) SpanInfo: undefined +-------------------------------- +4 >interface Robot { + + ~~~~~~~~~~~~~~~~~~ => Pos: (50 to 67) SpanInfo: undefined +-------------------------------- +5 > name: string; + + ~~~~~~~~~~~~~~~~~~ => Pos: (68 to 85) SpanInfo: undefined +-------------------------------- +6 > skill: string; + + ~~~~~~~~~~~~~~~~~~~ => Pos: (86 to 104) SpanInfo: undefined +-------------------------------- +7 >} + + ~~ => Pos: (105 to 106) SpanInfo: undefined +-------------------------------- +8 >interface MultiRobot { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (107 to 129) SpanInfo: undefined +-------------------------------- +9 > name: string; + + ~~~~~~~~~~~~~~~~~~ => Pos: (130 to 147) SpanInfo: undefined +-------------------------------- +10 > skills: { + + ~~~~~~~~~~~~~~ => Pos: (148 to 161) SpanInfo: undefined +-------------------------------- +11 > primary?: string; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (162 to 187) SpanInfo: undefined +-------------------------------- +12 > secondary?: string; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (188 to 215) SpanInfo: undefined +-------------------------------- +13 > }; + + ~~~~~~~ => Pos: (216 to 222) SpanInfo: undefined +-------------------------------- +14 >} + + ~~ => Pos: (223 to 224) SpanInfo: undefined +-------------------------------- +15 >let robots: Robot[] = [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (225 to 324) SpanInfo: {"start":225,"length":98} + >let robots: Robot[] = [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }] + >:=> (line 15, col 0) to (line 15, col 98) +-------------------------------- +16 >let multiRobots: MultiRobot[] = [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (325 to 426) SpanInfo: {"start":325,"length":180} + >let multiRobots: MultiRobot[] = [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] + >:=> (line 16, col 0) to (line 17, col 78) +-------------------------------- +17 > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (427 to 506) SpanInfo: {"start":325,"length":180} + >let multiRobots: MultiRobot[] = [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] + >:=> (line 16, col 0) to (line 17, col 78) +-------------------------------- +18 >function getRobots() { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (507 to 529) SpanInfo: {"start":534,"length":13} + >return robots + >:=> (line 19, col 4) to (line 19, col 17) +-------------------------------- +19 > return robots; + + ~~~~~~~~~~~~~~~~~~~ => Pos: (530 to 548) SpanInfo: {"start":534,"length":13} + >return robots + >:=> (line 19, col 4) to (line 19, col 17) +-------------------------------- +20 >} + + ~~ => Pos: (549 to 550) SpanInfo: {"start":549,"length":1} + >} + >:=> (line 20, col 0) to (line 20, col 1) +-------------------------------- +21 >function getMultiRobots() { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (551 to 578) SpanInfo: {"start":583,"length":18} + >return multiRobots + >:=> (line 22, col 4) to (line 22, col 22) +-------------------------------- +22 > return multiRobots; + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (579 to 602) SpanInfo: {"start":583,"length":18} + >return multiRobots + >:=> (line 22, col 4) to (line 22, col 22) +-------------------------------- +23 >} + + ~~ => Pos: (603 to 604) SpanInfo: {"start":603,"length":1} + >} + >:=> (line 23, col 0) to (line 23, col 1) +-------------------------------- +24 >for (let {name: nameA = "noName" } of robots) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (605 to 638) SpanInfo: {"start":615,"length":22} + >name: nameA = "noName" + >:=> (line 24, col 10) to (line 24, col 32) +24 >for (let {name: nameA = "noName" } of robots) { + + ~~~~~~~~~~~~~~=> Pos: (639 to 652) SpanInfo: {"start":643,"length":6} + >robots + >:=> (line 24, col 38) to (line 24, col 44) +-------------------------------- +25 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (653 to 676) SpanInfo: {"start":657,"length":18} + >console.log(nameA) + >:=> (line 25, col 4) to (line 25, col 22) +-------------------------------- +26 >} + + ~~ => Pos: (677 to 678) SpanInfo: {"start":657,"length":18} + >console.log(nameA) + >:=> (line 25, col 4) to (line 25, col 22) +-------------------------------- +27 >for (let {name: nameA = "noName" } of getRobots()) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (679 to 712) SpanInfo: {"start":689,"length":22} + >name: nameA = "noName" + >:=> (line 27, col 10) to (line 27, col 32) +27 >for (let {name: nameA = "noName" } of getRobots()) { + + ~~~~~~~~~~~~~~~~~~~=> Pos: (713 to 731) SpanInfo: {"start":717,"length":11} + >getRobots() + >:=> (line 27, col 38) to (line 27, col 49) +-------------------------------- +28 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (732 to 755) SpanInfo: {"start":736,"length":18} + >console.log(nameA) + >:=> (line 28, col 4) to (line 28, col 22) +-------------------------------- +29 >} + + ~~ => Pos: (756 to 757) SpanInfo: {"start":736,"length":18} + >console.log(nameA) + >:=> (line 28, col 4) to (line 28, col 22) +-------------------------------- +30 >for (let {name: nameA = "noName" } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (758 to 791) SpanInfo: {"start":768,"length":22} + >name: nameA = "noName" + >:=> (line 30, col 10) to (line 30, col 32) +30 >for (let {name: nameA = "noName" } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (792 to 875) SpanInfo: {"start":796,"length":76} + >[{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }] + >:=> (line 30, col 38) to (line 30, col 114) +-------------------------------- +31 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (876 to 899) SpanInfo: {"start":880,"length":18} + >console.log(nameA) + >:=> (line 31, col 4) to (line 31, col 22) +-------------------------------- +32 >} + + ~~ => Pos: (900 to 901) SpanInfo: {"start":880,"length":18} + >console.log(nameA) + >:=> (line 31, col 4) to (line 31, col 22) +-------------------------------- +33 >for (let { skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = + + ~~~~~~~~~~~~~~~~~~ => Pos: (902 to 919) SpanInfo: {"start":913,"length":129} + >skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = + > { primary: "nosKill", secondary: "noSkill" } + >:=> (line 33, col 11) to (line 34, col 48) +33 >for (let { skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (920 to 952) SpanInfo: {"start":923,"length":29} + >primary: primaryA = "primary" + >:=> (line 33, col 21) to (line 33, col 50) +33 >for (let { skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (953 to 990) SpanInfo: {"start":954,"length":35} + >secondary: secondaryA = "secondary" + >:=> (line 33, col 52) to (line 33, col 87) +33 >for (let { skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = + + ~~~=> Pos: (991 to 993) SpanInfo: {"start":913,"length":129} + >skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = + > { primary: "nosKill", secondary: "noSkill" } + >:=> (line 33, col 11) to (line 34, col 48) +-------------------------------- +34 > { primary: "nosKill", secondary: "noSkill" } } of multiRobots) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (994 to 1043) SpanInfo: {"start":913,"length":129} + >skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = + > { primary: "nosKill", secondary: "noSkill" } + >:=> (line 33, col 11) to (line 34, col 48) +34 > { primary: "nosKill", secondary: "noSkill" } } of multiRobots) { + + ~~~~~~~~~~~~~~~~~~~=> Pos: (1044 to 1062) SpanInfo: {"start":1048,"length":11} + >multiRobots + >:=> (line 34, col 54) to (line 34, col 65) +-------------------------------- +35 > console.log(primaryA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1063 to 1089) SpanInfo: {"start":1067,"length":21} + >console.log(primaryA) + >:=> (line 35, col 4) to (line 35, col 25) +-------------------------------- +36 >} + + ~~ => Pos: (1090 to 1091) SpanInfo: {"start":1067,"length":21} + >console.log(primaryA) + >:=> (line 35, col 4) to (line 35, col 25) +-------------------------------- +37 >for (let { skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = + + ~~~~~~~~~~~~~~~~~~ => Pos: (1092 to 1109) SpanInfo: {"start":1103,"length":129} + >skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = + > { primary: "nosKill", secondary: "noSkill" } + >:=> (line 37, col 11) to (line 38, col 48) +37 >for (let { skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1110 to 1142) SpanInfo: {"start":1113,"length":29} + >primary: primaryA = "primary" + >:=> (line 37, col 21) to (line 37, col 50) +37 >for (let { skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1143 to 1180) SpanInfo: {"start":1144,"length":35} + >secondary: secondaryA = "secondary" + >:=> (line 37, col 52) to (line 37, col 87) +37 >for (let { skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = + + ~~~=> Pos: (1181 to 1183) SpanInfo: {"start":1103,"length":129} + >skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = + > { primary: "nosKill", secondary: "noSkill" } + >:=> (line 37, col 11) to (line 38, col 48) +-------------------------------- +38 > { primary: "nosKill", secondary: "noSkill" } } of getMultiRobots()) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1184 to 1233) SpanInfo: {"start":1103,"length":129} + >skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = + > { primary: "nosKill", secondary: "noSkill" } + >:=> (line 37, col 11) to (line 38, col 48) +38 > { primary: "nosKill", secondary: "noSkill" } } of getMultiRobots()) { + + ~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1234 to 1257) SpanInfo: {"start":1238,"length":16} + >getMultiRobots() + >:=> (line 38, col 54) to (line 38, col 70) +-------------------------------- +39 > console.log(primaryA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1258 to 1284) SpanInfo: {"start":1262,"length":21} + >console.log(primaryA) + >:=> (line 39, col 4) to (line 39, col 25) +-------------------------------- +40 >} + + ~~ => Pos: (1285 to 1286) SpanInfo: {"start":1262,"length":21} + >console.log(primaryA) + >:=> (line 39, col 4) to (line 39, col 25) +-------------------------------- +41 >for (let { skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = + + ~~~~~~~~~~~~~~~~~~ => Pos: (1287 to 1304) SpanInfo: {"start":1298,"length":129} + >skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = + > { primary: "nosKill", secondary: "noSkill" } + >:=> (line 41, col 11) to (line 42, col 48) +41 >for (let { skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1305 to 1337) SpanInfo: {"start":1308,"length":29} + >primary: primaryA = "primary" + >:=> (line 41, col 21) to (line 41, col 50) +41 >for (let { skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1338 to 1375) SpanInfo: {"start":1339,"length":35} + >secondary: secondaryA = "secondary" + >:=> (line 41, col 52) to (line 41, col 87) +41 >for (let { skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = + + ~~~=> Pos: (1376 to 1378) SpanInfo: {"start":1298,"length":129} + >skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = + > { primary: "nosKill", secondary: "noSkill" } + >:=> (line 41, col 11) to (line 42, col 48) +-------------------------------- +42 > { primary: "nosKill", secondary: "noSkill" } } of + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1379 to 1428) SpanInfo: {"start":1298,"length":129} + >skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = + > { primary: "nosKill", secondary: "noSkill" } + >:=> (line 41, col 11) to (line 42, col 48) +42 > { primary: "nosKill", secondary: "noSkill" } } of + + ~~~~=> Pos: (1429 to 1432) SpanInfo: {"start":1437,"length":162} + >[{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] + >:=> (line 43, col 4) to (line 44, col 78) +-------------------------------- +43 > [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1433 to 1520) SpanInfo: {"start":1437,"length":162} + >[{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] + >:=> (line 43, col 4) to (line 44, col 78) +-------------------------------- +44 > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1521 to 1602) SpanInfo: {"start":1437,"length":162} + >[{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] + >:=> (line 43, col 4) to (line 44, col 78) +-------------------------------- +45 > console.log(primaryA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1603 to 1629) SpanInfo: {"start":1607,"length":21} + >console.log(primaryA) + >:=> (line 45, col 4) to (line 45, col 25) +-------------------------------- +46 >} + + ~~ => Pos: (1630 to 1631) SpanInfo: {"start":1607,"length":21} + >console.log(primaryA) + >:=> (line 45, col 4) to (line 45, col 25) +-------------------------------- +47 >for (let {name: nameA = "noName", skill: skillA = "noSkill" } of robots) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1632 to 1664) SpanInfo: {"start":1642,"length":22} + >name: nameA = "noName" + >:=> (line 47, col 10) to (line 47, col 32) +47 >for (let {name: nameA = "noName", skill: skillA = "noSkill" } of robots) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1665 to 1692) SpanInfo: {"start":1666,"length":25} + >skill: skillA = "noSkill" + >:=> (line 47, col 34) to (line 47, col 59) +47 >for (let {name: nameA = "noName", skill: skillA = "noSkill" } of robots) { + + ~~~~~~~~~~~~~~=> Pos: (1693 to 1706) SpanInfo: {"start":1697,"length":6} + >robots + >:=> (line 47, col 65) to (line 47, col 71) +-------------------------------- +48 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1707 to 1730) SpanInfo: {"start":1711,"length":18} + >console.log(nameA) + >:=> (line 48, col 4) to (line 48, col 22) +-------------------------------- +49 >} + + ~~ => Pos: (1731 to 1732) SpanInfo: {"start":1711,"length":18} + >console.log(nameA) + >:=> (line 48, col 4) to (line 48, col 22) +-------------------------------- +50 >for (let {name: nameA = "noName", skill: skillA = "noSkill" } of getRobots()) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1733 to 1765) SpanInfo: {"start":1743,"length":22} + >name: nameA = "noName" + >:=> (line 50, col 10) to (line 50, col 32) +50 >for (let {name: nameA = "noName", skill: skillA = "noSkill" } of getRobots()) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1766 to 1794) SpanInfo: {"start":1767,"length":25} + >skill: skillA = "noSkill" + >:=> (line 50, col 34) to (line 50, col 59) +50 >for (let {name: nameA = "noName", skill: skillA = "noSkill" } of getRobots()) { + + ~~~~~~~~~~~~~~~~~~~=> Pos: (1795 to 1813) SpanInfo: {"start":1799,"length":11} + >getRobots() + >:=> (line 50, col 66) to (line 50, col 77) +-------------------------------- +51 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1814 to 1837) SpanInfo: {"start":1818,"length":18} + >console.log(nameA) + >:=> (line 51, col 4) to (line 51, col 22) +-------------------------------- +52 >} + + ~~ => Pos: (1838 to 1839) SpanInfo: {"start":1818,"length":18} + >console.log(nameA) + >:=> (line 51, col 4) to (line 51, col 22) +-------------------------------- +53 >for (let {name: nameA = "noName", skill: skillA = "noSkill" } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1840 to 1872) SpanInfo: {"start":1850,"length":22} + >name: nameA = "noName" + >:=> (line 53, col 10) to (line 53, col 32) +53 >for (let {name: nameA = "noName", skill: skillA = "noSkill" } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1873 to 1901) SpanInfo: {"start":1874,"length":25} + >skill: skillA = "noSkill" + >:=> (line 53, col 34) to (line 53, col 59) +53 >for (let {name: nameA = "noName", skill: skillA = "noSkill" } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1902 to 1985) SpanInfo: {"start":1906,"length":76} + >[{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }] + >:=> (line 53, col 66) to (line 53, col 142) +-------------------------------- +54 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1986 to 2009) SpanInfo: {"start":1990,"length":18} + >console.log(nameA) + >:=> (line 54, col 4) to (line 54, col 22) +-------------------------------- +55 >} + + ~~ => Pos: (2010 to 2011) SpanInfo: {"start":1990,"length":18} + >console.log(nameA) + >:=> (line 54, col 4) to (line 54, col 22) +-------------------------------- +56 >for (let { + + ~~~~~~~~~~~ => Pos: (2012 to 2022) SpanInfo: {"start":2027,"length":22} + >name: nameA = "noName" + >:=> (line 57, col 4) to (line 57, col 26) +-------------------------------- +57 > name: nameA = "noName", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2023 to 2050) SpanInfo: {"start":2027,"length":22} + >name: nameA = "noName" + >:=> (line 57, col 4) to (line 57, col 26) +-------------------------------- +58 > skills: { + + ~~~~~~~~~~~ => Pos: (2051 to 2061) SpanInfo: {"start":2055,"length":145} + >skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "noSkill", secondary: "noSkill" } + >:=> (line 58, col 4) to (line 61, col 52) +58 > skills: { + + ~~~ => Pos: (2062 to 2064) SpanInfo: {"start":2073,"length":29} + >primary: primaryA = "primary" + >:=> (line 59, col 8) to (line 59, col 37) +-------------------------------- +59 > primary: primaryA = "primary", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2065 to 2103) SpanInfo: {"start":2073,"length":29} + >primary: primaryA = "primary" + >:=> (line 59, col 8) to (line 59, col 37) +-------------------------------- +60 > secondary: secondaryA = "secondary" + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2104 to 2147) SpanInfo: {"start":2112,"length":35} + >secondary: secondaryA = "secondary" + >:=> (line 60, col 8) to (line 60, col 43) +-------------------------------- +61 > } = { primary: "noSkill", secondary: "noSkill" } + + ~~~~~ => Pos: (2148 to 2152) SpanInfo: {"start":2112,"length":35} + >secondary: secondaryA = "secondary" + >:=> (line 60, col 8) to (line 60, col 43) +61 > } = { primary: "noSkill", secondary: "noSkill" } + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (2153 to 2200) SpanInfo: {"start":2055,"length":145} + >skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "noSkill", secondary: "noSkill" } + >:=> (line 58, col 4) to (line 61, col 52) +-------------------------------- +62 >} of multiRobots) { + + ~ => Pos: (2201 to 2201) SpanInfo: {"start":2055,"length":145} + >skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "noSkill", secondary: "noSkill" } + >:=> (line 58, col 4) to (line 61, col 52) +62 >} of multiRobots) { + + ~~~~~~~~~~~~~~~~~~~ => Pos: (2202 to 2220) SpanInfo: {"start":2206,"length":11} + >multiRobots + >:=> (line 62, col 5) to (line 62, col 16) +-------------------------------- +63 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2221 to 2244) SpanInfo: {"start":2225,"length":18} + >console.log(nameA) + >:=> (line 63, col 4) to (line 63, col 22) +-------------------------------- +64 >} + + ~~ => Pos: (2245 to 2246) SpanInfo: {"start":2225,"length":18} + >console.log(nameA) + >:=> (line 63, col 4) to (line 63, col 22) +-------------------------------- +65 >for (let { + + ~~~~~~~~~~~ => Pos: (2247 to 2257) SpanInfo: {"start":2262,"length":22} + >name: nameA = "noName" + >:=> (line 66, col 4) to (line 66, col 26) +-------------------------------- +66 > name: nameA = "noName", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2258 to 2285) SpanInfo: {"start":2262,"length":22} + >name: nameA = "noName" + >:=> (line 66, col 4) to (line 66, col 26) +-------------------------------- +67 > skills: { + + ~~~~~~~~~~~ => Pos: (2286 to 2296) SpanInfo: {"start":2290,"length":145} + >skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "noSkill", secondary: "noSkill" } + >:=> (line 67, col 4) to (line 70, col 52) +67 > skills: { + + ~~~ => Pos: (2297 to 2299) SpanInfo: {"start":2308,"length":29} + >primary: primaryA = "primary" + >:=> (line 68, col 8) to (line 68, col 37) +-------------------------------- +68 > primary: primaryA = "primary", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2300 to 2338) SpanInfo: {"start":2308,"length":29} + >primary: primaryA = "primary" + >:=> (line 68, col 8) to (line 68, col 37) +-------------------------------- +69 > secondary: secondaryA = "secondary" + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2339 to 2382) SpanInfo: {"start":2347,"length":35} + >secondary: secondaryA = "secondary" + >:=> (line 69, col 8) to (line 69, col 43) +-------------------------------- +70 > } = { primary: "noSkill", secondary: "noSkill" } + + ~~~~~ => Pos: (2383 to 2387) SpanInfo: {"start":2347,"length":35} + >secondary: secondaryA = "secondary" + >:=> (line 69, col 8) to (line 69, col 43) +70 > } = { primary: "noSkill", secondary: "noSkill" } + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (2388 to 2435) SpanInfo: {"start":2290,"length":145} + >skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "noSkill", secondary: "noSkill" } + >:=> (line 67, col 4) to (line 70, col 52) +-------------------------------- +71 >} of getMultiRobots()) { + + ~ => Pos: (2436 to 2436) SpanInfo: {"start":2290,"length":145} + >skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "noSkill", secondary: "noSkill" } + >:=> (line 67, col 4) to (line 70, col 52) +71 >} of getMultiRobots()) { + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2437 to 2460) SpanInfo: {"start":2441,"length":16} + >getMultiRobots() + >:=> (line 71, col 5) to (line 71, col 21) +-------------------------------- +72 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2461 to 2484) SpanInfo: {"start":2465,"length":18} + >console.log(nameA) + >:=> (line 72, col 4) to (line 72, col 22) +-------------------------------- +73 >} + + ~~ => Pos: (2485 to 2486) SpanInfo: {"start":2465,"length":18} + >console.log(nameA) + >:=> (line 72, col 4) to (line 72, col 22) +-------------------------------- +74 >for (let { + + ~~~~~~~~~~~ => Pos: (2487 to 2497) SpanInfo: {"start":2502,"length":22} + >name: nameA = "noName" + >:=> (line 75, col 4) to (line 75, col 26) +-------------------------------- +75 > name: nameA = "noName", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2498 to 2525) SpanInfo: {"start":2502,"length":22} + >name: nameA = "noName" + >:=> (line 75, col 4) to (line 75, col 26) +-------------------------------- +76 > skills: { + + ~~~~~~~~~~~ => Pos: (2526 to 2536) SpanInfo: {"start":2530,"length":145} + >skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "noSkill", secondary: "noSkill" } + >:=> (line 76, col 4) to (line 79, col 52) +76 > skills: { + + ~~~ => Pos: (2537 to 2539) SpanInfo: {"start":2548,"length":29} + >primary: primaryA = "primary" + >:=> (line 77, col 8) to (line 77, col 37) +-------------------------------- +77 > primary: primaryA = "primary", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2540 to 2578) SpanInfo: {"start":2548,"length":29} + >primary: primaryA = "primary" + >:=> (line 77, col 8) to (line 77, col 37) +-------------------------------- +78 > secondary: secondaryA = "secondary" + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2579 to 2622) SpanInfo: {"start":2587,"length":35} + >secondary: secondaryA = "secondary" + >:=> (line 78, col 8) to (line 78, col 43) +-------------------------------- +79 > } = { primary: "noSkill", secondary: "noSkill" } + + ~~~~~ => Pos: (2623 to 2627) SpanInfo: {"start":2587,"length":35} + >secondary: secondaryA = "secondary" + >:=> (line 78, col 8) to (line 78, col 43) +79 > } = { primary: "noSkill", secondary: "noSkill" } + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (2628 to 2675) SpanInfo: {"start":2530,"length":145} + >skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "noSkill", secondary: "noSkill" } + >:=> (line 76, col 4) to (line 79, col 52) +-------------------------------- +80 >} of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + + ~ => Pos: (2676 to 2676) SpanInfo: {"start":2530,"length":145} + >skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "noSkill", secondary: "noSkill" } + >:=> (line 76, col 4) to (line 79, col 52) +80 >} of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (2677 to 2764) SpanInfo: {"start":2681,"length":162} + >[{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] + >:=> (line 80, col 5) to (line 81, col 78) +-------------------------------- +81 > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (2765 to 2846) SpanInfo: {"start":2681,"length":162} + >[{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] + >:=> (line 80, col 5) to (line 81, col 78) +-------------------------------- +82 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (2847 to 2870) SpanInfo: {"start":2851,"length":18} + >console.log(nameA) + >:=> (line 82, col 4) to (line 82, col 22) +-------------------------------- +83 >} + ~ => Pos: (2871 to 2871) SpanInfo: {"start":2851,"length":18} + >console.log(nameA) + >:=> (line 82, col 4) to (line 82, col 22) \ No newline at end of file diff --git a/tests/baselines/reference/bpSpanDestructuringParameterArrayBindingPattern.baseline b/tests/baselines/reference/bpSpanDestructuringParameterArrayBindingPattern.baseline new file mode 100644 index 00000000000..03f0ee87356 --- /dev/null +++ b/tests/baselines/reference/bpSpanDestructuringParameterArrayBindingPattern.baseline @@ -0,0 +1,196 @@ + +1 >declare var console: { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (0 to 22) SpanInfo: undefined +-------------------------------- +2 > log(msg: any): void; + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (23 to 47) SpanInfo: undefined +-------------------------------- +3 >} + + ~~ => Pos: (48 to 49) SpanInfo: undefined +-------------------------------- +4 >type Robot = [number, string, string]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (50 to 88) SpanInfo: undefined +-------------------------------- +5 >var robotA: Robot = [1, "mower", "mowing"]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (89 to 132) SpanInfo: {"start":89,"length":42} + >var robotA: Robot = [1, "mower", "mowing"] + >:=> (line 5, col 0) to (line 5, col 42) +-------------------------------- +6 >function foo1([, nameA]: Robot) { + + ~~~~~~~~~~~~~~ => Pos: (133 to 146) SpanInfo: {"start":171,"length":18} + >console.log(nameA) + >:=> (line 7, col 4) to (line 7, col 22) +6 >function foo1([, nameA]: Robot) { + + ~~~~~~~~~~~~~~~~~ => Pos: (147 to 163) SpanInfo: {"start":150,"length":5} + >nameA + >:=> (line 6, col 17) to (line 6, col 22) +6 >function foo1([, nameA]: Robot) { + + ~~~ => Pos: (164 to 166) SpanInfo: {"start":171,"length":18} + >console.log(nameA) + >:=> (line 7, col 4) to (line 7, col 22) +-------------------------------- +7 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (167 to 190) SpanInfo: {"start":171,"length":18} + >console.log(nameA) + >:=> (line 7, col 4) to (line 7, col 22) +-------------------------------- +8 >} + + ~~ => Pos: (191 to 192) SpanInfo: {"start":191,"length":1} + >} + >:=> (line 8, col 0) to (line 8, col 1) +-------------------------------- +9 >function foo2([numberB]: Robot) { + + ~~~~~~~~~~~~~~ => Pos: (193 to 206) SpanInfo: {"start":231,"length":20} + >console.log(numberB) + >:=> (line 10, col 4) to (line 10, col 24) +9 >function foo2([numberB]: Robot) { + + ~~~~~~~~~~~~~~~~~ => Pos: (207 to 223) SpanInfo: {"start":208,"length":7} + >numberB + >:=> (line 9, col 15) to (line 9, col 22) +9 >function foo2([numberB]: Robot) { + + ~~~ => Pos: (224 to 226) SpanInfo: {"start":231,"length":20} + >console.log(numberB) + >:=> (line 10, col 4) to (line 10, col 24) +-------------------------------- +10 > console.log(numberB); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (227 to 252) SpanInfo: {"start":231,"length":20} + >console.log(numberB) + >:=> (line 10, col 4) to (line 10, col 24) +-------------------------------- +11 >} + + ~~ => Pos: (253 to 254) SpanInfo: {"start":253,"length":1} + >} + >:=> (line 11, col 0) to (line 11, col 1) +-------------------------------- +12 >function foo3([numberA2, nameA2, skillA2]: Robot) { + + ~~~~~~~~~~~~~~ => Pos: (255 to 268) SpanInfo: {"start":311,"length":19} + >console.log(nameA2) + >:=> (line 13, col 4) to (line 13, col 23) +12 >function foo3([numberA2, nameA2, skillA2]: Robot) { + + ~~~~~~~~~~ => Pos: (269 to 278) SpanInfo: {"start":270,"length":8} + >numberA2 + >:=> (line 12, col 15) to (line 12, col 23) +12 >function foo3([numberA2, nameA2, skillA2]: Robot) { + + ~~~~~~~~ => Pos: (279 to 286) SpanInfo: {"start":280,"length":6} + >nameA2 + >:=> (line 12, col 25) to (line 12, col 31) +12 >function foo3([numberA2, nameA2, skillA2]: Robot) { + + ~~~~~~~~~~~~~~~~~=> Pos: (287 to 303) SpanInfo: {"start":288,"length":7} + >skillA2 + >:=> (line 12, col 33) to (line 12, col 40) +12 >function foo3([numberA2, nameA2, skillA2]: Robot) { + + ~~~=> Pos: (304 to 306) SpanInfo: {"start":311,"length":19} + >console.log(nameA2) + >:=> (line 13, col 4) to (line 13, col 23) +-------------------------------- +13 > console.log(nameA2); + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (307 to 331) SpanInfo: {"start":311,"length":19} + >console.log(nameA2) + >:=> (line 13, col 4) to (line 13, col 23) +-------------------------------- +14 >} + + ~~ => Pos: (332 to 333) SpanInfo: {"start":332,"length":1} + >} + >:=> (line 14, col 0) to (line 14, col 1) +-------------------------------- +15 >function foo4([numberA3, ...robotAInfo]: Robot) { + + ~~~~~~~~~~~~~~ => Pos: (334 to 347) SpanInfo: {"start":388,"length":23} + >console.log(robotAInfo) + >:=> (line 16, col 4) to (line 16, col 27) +15 >function foo4([numberA3, ...robotAInfo]: Robot) { + + ~~~~~~~~~~ => Pos: (348 to 357) SpanInfo: {"start":349,"length":8} + >numberA3 + >:=> (line 15, col 15) to (line 15, col 23) +15 >function foo4([numberA3, ...robotAInfo]: Robot) { + + ~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (358 to 380) SpanInfo: {"start":359,"length":13} + >...robotAInfo + >:=> (line 15, col 25) to (line 15, col 38) +15 >function foo4([numberA3, ...robotAInfo]: Robot) { + + ~~~=> Pos: (381 to 383) SpanInfo: {"start":388,"length":23} + >console.log(robotAInfo) + >:=> (line 16, col 4) to (line 16, col 27) +-------------------------------- +16 > console.log(robotAInfo); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (384 to 412) SpanInfo: {"start":388,"length":23} + >console.log(robotAInfo) + >:=> (line 16, col 4) to (line 16, col 27) +-------------------------------- +17 >} + + ~~ => Pos: (413 to 414) SpanInfo: {"start":413,"length":1} + >} + >:=> (line 17, col 0) to (line 17, col 1) +-------------------------------- +18 >foo1(robotA); + + ~~~~~~~~~~~~~~ => Pos: (415 to 428) SpanInfo: {"start":415,"length":12} + >foo1(robotA) + >:=> (line 18, col 0) to (line 18, col 12) +-------------------------------- +19 >foo1([2, "trimmer", "trimming"]); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (429 to 462) SpanInfo: {"start":429,"length":32} + >foo1([2, "trimmer", "trimming"]) + >:=> (line 19, col 0) to (line 19, col 32) +-------------------------------- +20 >foo2(robotA); + + ~~~~~~~~~~~~~~ => Pos: (463 to 476) SpanInfo: {"start":463,"length":12} + >foo2(robotA) + >:=> (line 20, col 0) to (line 20, col 12) +-------------------------------- +21 >foo2([2, "trimmer", "trimming"]); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (477 to 510) SpanInfo: {"start":477,"length":32} + >foo2([2, "trimmer", "trimming"]) + >:=> (line 21, col 0) to (line 21, col 32) +-------------------------------- +22 >foo3(robotA); + + ~~~~~~~~~~~~~~ => Pos: (511 to 524) SpanInfo: {"start":511,"length":12} + >foo3(robotA) + >:=> (line 22, col 0) to (line 22, col 12) +-------------------------------- +23 >foo3([2, "trimmer", "trimming"]); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (525 to 558) SpanInfo: {"start":525,"length":32} + >foo3([2, "trimmer", "trimming"]) + >:=> (line 23, col 0) to (line 23, col 32) +-------------------------------- +24 >foo4(robotA); + + ~~~~~~~~~~~~~~ => Pos: (559 to 572) SpanInfo: {"start":559,"length":12} + >foo4(robotA) + >:=> (line 24, col 0) to (line 24, col 12) +-------------------------------- +25 >foo4([2, "trimmer", "trimming"]); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (573 to 605) SpanInfo: {"start":573,"length":32} + >foo4([2, "trimmer", "trimming"]) + >:=> (line 25, col 0) to (line 25, col 32) \ No newline at end of file diff --git a/tests/baselines/reference/bpSpanDestructuringParameterArrayBindingPattern2.baseline b/tests/baselines/reference/bpSpanDestructuringParameterArrayBindingPattern2.baseline new file mode 100644 index 00000000000..cb9088c99ef --- /dev/null +++ b/tests/baselines/reference/bpSpanDestructuringParameterArrayBindingPattern2.baseline @@ -0,0 +1,196 @@ + +1 >declare var console: { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (0 to 22) SpanInfo: undefined +-------------------------------- +2 > log(msg: any): void; + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (23 to 47) SpanInfo: undefined +-------------------------------- +3 >} + + ~~ => Pos: (48 to 49) SpanInfo: undefined +-------------------------------- +4 >type Robot = [string, [string, string]]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (50 to 90) SpanInfo: undefined +-------------------------------- +5 >var robotA: Robot = ["trimmer", ["trimming", "edging"]]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (91 to 147) SpanInfo: {"start":91,"length":55} + >var robotA: Robot = ["trimmer", ["trimming", "edging"]] + >:=> (line 5, col 0) to (line 5, col 55) +-------------------------------- +6 >function foo1([, skillA]: Robot) { + + ~~~~~~~~~~~~~~ => Pos: (148 to 161) SpanInfo: {"start":187,"length":19} + >console.log(skillA) + >:=> (line 7, col 4) to (line 7, col 23) +6 >function foo1([, skillA]: Robot) { + + ~~~~~~~~~~~~~~~~~~ => Pos: (162 to 179) SpanInfo: {"start":165,"length":6} + >skillA + >:=> (line 6, col 17) to (line 6, col 23) +6 >function foo1([, skillA]: Robot) { + + ~~~ => Pos: (180 to 182) SpanInfo: {"start":187,"length":19} + >console.log(skillA) + >:=> (line 7, col 4) to (line 7, col 23) +-------------------------------- +7 > console.log(skillA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (183 to 207) SpanInfo: {"start":187,"length":19} + >console.log(skillA) + >:=> (line 7, col 4) to (line 7, col 23) +-------------------------------- +8 >} + + ~~ => Pos: (208 to 209) SpanInfo: {"start":208,"length":1} + >} + >:=> (line 8, col 0) to (line 8, col 1) +-------------------------------- +9 >function foo2([nameMB]: Robot) { + + ~~~~~~~~~~~~~~ => Pos: (210 to 223) SpanInfo: {"start":247,"length":19} + >console.log(nameMB) + >:=> (line 10, col 4) to (line 10, col 23) +9 >function foo2([nameMB]: Robot) { + + ~~~~~~~~~~~~~~~~ => Pos: (224 to 239) SpanInfo: {"start":225,"length":6} + >nameMB + >:=> (line 9, col 15) to (line 9, col 21) +9 >function foo2([nameMB]: Robot) { + + ~~~ => Pos: (240 to 242) SpanInfo: {"start":247,"length":19} + >console.log(nameMB) + >:=> (line 10, col 4) to (line 10, col 23) +-------------------------------- +10 > console.log(nameMB); + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (243 to 267) SpanInfo: {"start":247,"length":19} + >console.log(nameMB) + >:=> (line 10, col 4) to (line 10, col 23) +-------------------------------- +11 >} + + ~~ => Pos: (268 to 269) SpanInfo: {"start":268,"length":1} + >} + >:=> (line 11, col 0) to (line 11, col 1) +-------------------------------- +12 >function foo3([nameMA, [primarySkillA, secondarySkillA]]: Robot) { + + ~~~~~~~~~~~~~~ => Pos: (270 to 283) SpanInfo: {"start":341,"length":19} + >console.log(nameMA) + >:=> (line 13, col 4) to (line 13, col 23) +12 >function foo3([nameMA, [primarySkillA, secondarySkillA]]: Robot) { + + ~~~~~~~~ => Pos: (284 to 291) SpanInfo: {"start":285,"length":6} + >nameMA + >:=> (line 12, col 15) to (line 12, col 21) +12 >function foo3([nameMA, [primarySkillA, secondarySkillA]]: Robot) { + + ~~~~~~~~~~~~~~~~ => Pos: (292 to 307) SpanInfo: {"start":294,"length":13} + >primarySkillA + >:=> (line 12, col 24) to (line 12, col 37) +12 >function foo3([nameMA, [primarySkillA, secondarySkillA]]: Robot) { + + ~~~~~~~~~~~~~~~~~=> Pos: (308 to 324) SpanInfo: {"start":309,"length":15} + >secondarySkillA + >:=> (line 12, col 39) to (line 12, col 54) +12 >function foo3([nameMA, [primarySkillA, secondarySkillA]]: Robot) { + + ~~~~~~~~~=> Pos: (325 to 333) SpanInfo: {"start":293,"length":32} + >[primarySkillA, secondarySkillA] + >:=> (line 12, col 23) to (line 12, col 55) +12 >function foo3([nameMA, [primarySkillA, secondarySkillA]]: Robot) { + + ~~~=> Pos: (334 to 336) SpanInfo: {"start":341,"length":19} + >console.log(nameMA) + >:=> (line 13, col 4) to (line 13, col 23) +-------------------------------- +13 > console.log(nameMA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (337 to 361) SpanInfo: {"start":341,"length":19} + >console.log(nameMA) + >:=> (line 13, col 4) to (line 13, col 23) +-------------------------------- +14 >} + + ~~ => Pos: (362 to 363) SpanInfo: {"start":362,"length":1} + >} + >:=> (line 14, col 0) to (line 14, col 1) +-------------------------------- +15 >function foo4([...multiRobotAInfo]: Robot) { + + ~~~~~~~~~~~~~~ => Pos: (364 to 377) SpanInfo: {"start":413,"length":28} + >console.log(multiRobotAInfo) + >:=> (line 16, col 4) to (line 16, col 32) +15 >function foo4([...multiRobotAInfo]: Robot) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (378 to 405) SpanInfo: {"start":379,"length":18} + >...multiRobotAInfo + >:=> (line 15, col 15) to (line 15, col 33) +15 >function foo4([...multiRobotAInfo]: Robot) { + + ~~~ => Pos: (406 to 408) SpanInfo: {"start":413,"length":28} + >console.log(multiRobotAInfo) + >:=> (line 16, col 4) to (line 16, col 32) +-------------------------------- +16 > console.log(multiRobotAInfo); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (409 to 442) SpanInfo: {"start":413,"length":28} + >console.log(multiRobotAInfo) + >:=> (line 16, col 4) to (line 16, col 32) +-------------------------------- +17 >} + + ~~ => Pos: (443 to 444) SpanInfo: {"start":443,"length":1} + >} + >:=> (line 17, col 0) to (line 17, col 1) +-------------------------------- +18 >foo1(robotA); + + ~~~~~~~~~~~~~~ => Pos: (445 to 458) SpanInfo: {"start":445,"length":12} + >foo1(robotA) + >:=> (line 18, col 0) to (line 18, col 12) +-------------------------------- +19 >foo1(["roomba", ["vaccum", "mopping"]]); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (459 to 499) SpanInfo: {"start":459,"length":39} + >foo1(["roomba", ["vaccum", "mopping"]]) + >:=> (line 19, col 0) to (line 19, col 39) +-------------------------------- +20 >foo2(robotA); + + ~~~~~~~~~~~~~~ => Pos: (500 to 513) SpanInfo: {"start":500,"length":12} + >foo2(robotA) + >:=> (line 20, col 0) to (line 20, col 12) +-------------------------------- +21 >foo2(["roomba", ["vaccum", "mopping"]]); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (514 to 554) SpanInfo: {"start":514,"length":39} + >foo2(["roomba", ["vaccum", "mopping"]]) + >:=> (line 21, col 0) to (line 21, col 39) +-------------------------------- +22 >foo3(robotA); + + ~~~~~~~~~~~~~~ => Pos: (555 to 568) SpanInfo: {"start":555,"length":12} + >foo3(robotA) + >:=> (line 22, col 0) to (line 22, col 12) +-------------------------------- +23 >foo3(["roomba", ["vaccum", "mopping"]]); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (569 to 609) SpanInfo: {"start":569,"length":39} + >foo3(["roomba", ["vaccum", "mopping"]]) + >:=> (line 23, col 0) to (line 23, col 39) +-------------------------------- +24 >foo4(robotA); + + ~~~~~~~~~~~~~~ => Pos: (610 to 623) SpanInfo: {"start":610,"length":12} + >foo4(robotA) + >:=> (line 24, col 0) to (line 24, col 12) +-------------------------------- +25 >foo4(["roomba", ["vaccum", "mopping"]]); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (624 to 663) SpanInfo: {"start":624,"length":39} + >foo4(["roomba", ["vaccum", "mopping"]]) + >:=> (line 25, col 0) to (line 25, col 39) \ No newline at end of file diff --git a/tests/baselines/reference/bpSpanDestructuringParameterArrayBindingPatternDefaultValues.baseline b/tests/baselines/reference/bpSpanDestructuringParameterArrayBindingPatternDefaultValues.baseline new file mode 100644 index 00000000000..d071692b0f2 --- /dev/null +++ b/tests/baselines/reference/bpSpanDestructuringParameterArrayBindingPatternDefaultValues.baseline @@ -0,0 +1,196 @@ + +1 >declare var console: { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (0 to 22) SpanInfo: undefined +-------------------------------- +2 > log(msg: any): void; + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (23 to 47) SpanInfo: undefined +-------------------------------- +3 >} + + ~~ => Pos: (48 to 49) SpanInfo: undefined +-------------------------------- +4 >type Robot = [number, string, string]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (50 to 88) SpanInfo: undefined +-------------------------------- +5 >var robotA: Robot = [1, "mower", "mowing"]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (89 to 132) SpanInfo: {"start":89,"length":42} + >var robotA: Robot = [1, "mower", "mowing"] + >:=> (line 5, col 0) to (line 5, col 42) +-------------------------------- +6 >function foo1([, nameA = "noName"]: Robot = [-1, "name", "skill"]) { + + ~~~~~~~~~~~~~~ => Pos: (133 to 146) SpanInfo: {"start":206,"length":18} + >console.log(nameA) + >:=> (line 7, col 4) to (line 7, col 22) +6 >function foo1([, nameA = "noName"]: Robot = [-1, "name", "skill"]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (147 to 198) SpanInfo: {"start":150,"length":16} + >nameA = "noName" + >:=> (line 6, col 17) to (line 6, col 33) +6 >function foo1([, nameA = "noName"]: Robot = [-1, "name", "skill"]) { + + ~~~=> Pos: (199 to 201) SpanInfo: {"start":206,"length":18} + >console.log(nameA) + >:=> (line 7, col 4) to (line 7, col 22) +-------------------------------- +7 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (202 to 225) SpanInfo: {"start":206,"length":18} + >console.log(nameA) + >:=> (line 7, col 4) to (line 7, col 22) +-------------------------------- +8 >} + + ~~ => Pos: (226 to 227) SpanInfo: {"start":226,"length":1} + >} + >:=> (line 8, col 0) to (line 8, col 1) +-------------------------------- +9 >function foo2([numberB = -1]: Robot = [-1, "name", "skill"]) { + + ~~~~~~~~~~~~~~ => Pos: (228 to 241) SpanInfo: {"start":295,"length":20} + >console.log(numberB) + >:=> (line 10, col 4) to (line 10, col 24) +9 >function foo2([numberB = -1]: Robot = [-1, "name", "skill"]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (242 to 287) SpanInfo: {"start":243,"length":12} + >numberB = -1 + >:=> (line 9, col 15) to (line 9, col 27) +9 >function foo2([numberB = -1]: Robot = [-1, "name", "skill"]) { + + ~~~=> Pos: (288 to 290) SpanInfo: {"start":295,"length":20} + >console.log(numberB) + >:=> (line 10, col 4) to (line 10, col 24) +-------------------------------- +10 > console.log(numberB); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (291 to 316) SpanInfo: {"start":295,"length":20} + >console.log(numberB) + >:=> (line 10, col 4) to (line 10, col 24) +-------------------------------- +11 >} + + ~~ => Pos: (317 to 318) SpanInfo: {"start":317,"length":1} + >} + >:=> (line 11, col 0) to (line 11, col 1) +-------------------------------- +12 >function foo3([numberA2 = -1, nameA2 = "name", skillA2 = "skill"]: Robot = [-1, "name", "skill"]) { + + ~~~~~~~~~~~~~~ => Pos: (319 to 332) SpanInfo: {"start":423,"length":19} + >console.log(nameA2) + >:=> (line 13, col 4) to (line 13, col 23) +12 >function foo3([numberA2 = -1, nameA2 = "name", skillA2 = "skill"]: Robot = [-1, "name", "skill"]) { + + ~~~~~~~~~~~~~~~ => Pos: (333 to 347) SpanInfo: {"start":334,"length":13} + >numberA2 = -1 + >:=> (line 12, col 15) to (line 12, col 28) +12 >function foo3([numberA2 = -1, nameA2 = "name", skillA2 = "skill"]: Robot = [-1, "name", "skill"]) { + + ~~~~~~~~~~~~~~~~~=> Pos: (348 to 364) SpanInfo: {"start":349,"length":15} + >nameA2 = "name" + >:=> (line 12, col 30) to (line 12, col 45) +12 >function foo3([numberA2 = -1, nameA2 = "name", skillA2 = "skill"]: Robot = [-1, "name", "skill"]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (365 to 415) SpanInfo: {"start":366,"length":17} + >skillA2 = "skill" + >:=> (line 12, col 47) to (line 12, col 64) +12 >function foo3([numberA2 = -1, nameA2 = "name", skillA2 = "skill"]: Robot = [-1, "name", "skill"]) { + + ~~~=> Pos: (416 to 418) SpanInfo: {"start":423,"length":19} + >console.log(nameA2) + >:=> (line 13, col 4) to (line 13, col 23) +-------------------------------- +13 > console.log(nameA2); + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (419 to 443) SpanInfo: {"start":423,"length":19} + >console.log(nameA2) + >:=> (line 13, col 4) to (line 13, col 23) +-------------------------------- +14 >} + + ~~ => Pos: (444 to 445) SpanInfo: {"start":444,"length":1} + >} + >:=> (line 14, col 0) to (line 14, col 1) +-------------------------------- +15 >function foo4([numberA3 = -1, ...robotAInfo]: Robot = [-1, "name", "skill"]) { + + ~~~~~~~~~~~~~~ => Pos: (446 to 459) SpanInfo: {"start":529,"length":23} + >console.log(robotAInfo) + >:=> (line 16, col 4) to (line 16, col 27) +15 >function foo4([numberA3 = -1, ...robotAInfo]: Robot = [-1, "name", "skill"]) { + + ~~~~~~~~~~~~~~~ => Pos: (460 to 474) SpanInfo: {"start":461,"length":13} + >numberA3 = -1 + >:=> (line 15, col 15) to (line 15, col 28) +15 >function foo4([numberA3 = -1, ...robotAInfo]: Robot = [-1, "name", "skill"]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (475 to 521) SpanInfo: {"start":476,"length":13} + >...robotAInfo + >:=> (line 15, col 30) to (line 15, col 43) +15 >function foo4([numberA3 = -1, ...robotAInfo]: Robot = [-1, "name", "skill"]) { + + ~~~=> Pos: (522 to 524) SpanInfo: {"start":529,"length":23} + >console.log(robotAInfo) + >:=> (line 16, col 4) to (line 16, col 27) +-------------------------------- +16 > console.log(robotAInfo); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (525 to 553) SpanInfo: {"start":529,"length":23} + >console.log(robotAInfo) + >:=> (line 16, col 4) to (line 16, col 27) +-------------------------------- +17 >} + + ~~ => Pos: (554 to 555) SpanInfo: {"start":554,"length":1} + >} + >:=> (line 17, col 0) to (line 17, col 1) +-------------------------------- +18 >foo1(robotA); + + ~~~~~~~~~~~~~~ => Pos: (556 to 569) SpanInfo: {"start":556,"length":12} + >foo1(robotA) + >:=> (line 18, col 0) to (line 18, col 12) +-------------------------------- +19 >foo1([2, "trimmer", "trimming"]); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (570 to 603) SpanInfo: {"start":570,"length":32} + >foo1([2, "trimmer", "trimming"]) + >:=> (line 19, col 0) to (line 19, col 32) +-------------------------------- +20 >foo2(robotA); + + ~~~~~~~~~~~~~~ => Pos: (604 to 617) SpanInfo: {"start":604,"length":12} + >foo2(robotA) + >:=> (line 20, col 0) to (line 20, col 12) +-------------------------------- +21 >foo2([2, "trimmer", "trimming"]); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (618 to 651) SpanInfo: {"start":618,"length":32} + >foo2([2, "trimmer", "trimming"]) + >:=> (line 21, col 0) to (line 21, col 32) +-------------------------------- +22 >foo3(robotA); + + ~~~~~~~~~~~~~~ => Pos: (652 to 665) SpanInfo: {"start":652,"length":12} + >foo3(robotA) + >:=> (line 22, col 0) to (line 22, col 12) +-------------------------------- +23 >foo3([2, "trimmer", "trimming"]); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (666 to 699) SpanInfo: {"start":666,"length":32} + >foo3([2, "trimmer", "trimming"]) + >:=> (line 23, col 0) to (line 23, col 32) +-------------------------------- +24 >foo4(robotA); + + ~~~~~~~~~~~~~~ => Pos: (700 to 713) SpanInfo: {"start":700,"length":12} + >foo4(robotA) + >:=> (line 24, col 0) to (line 24, col 12) +-------------------------------- +25 >foo4([2, "trimmer", "trimming"]); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (714 to 746) SpanInfo: {"start":714,"length":32} + >foo4([2, "trimmer", "trimming"]) + >:=> (line 25, col 0) to (line 25, col 32) \ No newline at end of file diff --git a/tests/baselines/reference/bpSpanDestructuringParameterArrayBindingPatternDefaultValues2.baseline b/tests/baselines/reference/bpSpanDestructuringParameterArrayBindingPatternDefaultValues2.baseline new file mode 100644 index 00000000000..34b41cc1218 --- /dev/null +++ b/tests/baselines/reference/bpSpanDestructuringParameterArrayBindingPatternDefaultValues2.baseline @@ -0,0 +1,172 @@ + +1 >declare var console: { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (0 to 22) SpanInfo: undefined +-------------------------------- +2 > log(msg: any): void; + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (23 to 47) SpanInfo: undefined +-------------------------------- +3 >} + + ~~ => Pos: (48 to 49) SpanInfo: undefined +-------------------------------- +4 >type Robot = [string, string[]]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (50 to 82) SpanInfo: undefined +-------------------------------- +5 >var robotA: Robot = ["trimmer", ["trimming", "edging"]]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (83 to 139) SpanInfo: {"start":83,"length":55} + >var robotA: Robot = ["trimmer", ["trimming", "edging"]] + >:=> (line 5, col 0) to (line 5, col 55) +-------------------------------- +6 >function foo1([, skillA = ["noSkill", "noSkill"]]: Robot= ["name", ["skill1", "skill2"]]) { + + ~~~~~~~~~~~~~~ => Pos: (140 to 153) SpanInfo: {"start":236,"length":19} + >console.log(skillA) + >:=> (line 7, col 4) to (line 7, col 23) +6 >function foo1([, skillA = ["noSkill", "noSkill"]]: Robot= ["name", ["skill1", "skill2"]]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (154 to 228) SpanInfo: {"start":157,"length":31} + >skillA = ["noSkill", "noSkill"] + >:=> (line 6, col 17) to (line 6, col 48) +6 >function foo1([, skillA = ["noSkill", "noSkill"]]: Robot= ["name", ["skill1", "skill2"]]) { + + ~~~=> Pos: (229 to 231) SpanInfo: {"start":236,"length":19} + >console.log(skillA) + >:=> (line 7, col 4) to (line 7, col 23) +-------------------------------- +7 > console.log(skillA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (232 to 256) SpanInfo: {"start":236,"length":19} + >console.log(skillA) + >:=> (line 7, col 4) to (line 7, col 23) +-------------------------------- +8 >} + + ~~ => Pos: (257 to 258) SpanInfo: {"start":257,"length":1} + >} + >:=> (line 8, col 0) to (line 8, col 1) +-------------------------------- +9 >function foo2([nameMB = "noName"]: Robot = ["name", ["skill1", "skill2"]]) { + + ~~~~~~~~~~~~~~ => Pos: (259 to 272) SpanInfo: {"start":340,"length":19} + >console.log(nameMB) + >:=> (line 10, col 4) to (line 10, col 23) +9 >function foo2([nameMB = "noName"]: Robot = ["name", ["skill1", "skill2"]]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (273 to 332) SpanInfo: {"start":274,"length":17} + >nameMB = "noName" + >:=> (line 9, col 15) to (line 9, col 32) +9 >function foo2([nameMB = "noName"]: Robot = ["name", ["skill1", "skill2"]]) { + + ~~~=> Pos: (333 to 335) SpanInfo: {"start":340,"length":19} + >console.log(nameMB) + >:=> (line 10, col 4) to (line 10, col 23) +-------------------------------- +10 > console.log(nameMB); + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (336 to 360) SpanInfo: {"start":340,"length":19} + >console.log(nameMB) + >:=> (line 10, col 4) to (line 10, col 23) +-------------------------------- +11 >} + + ~~ => Pos: (361 to 362) SpanInfo: {"start":361,"length":1} + >} + >:=> (line 11, col 0) to (line 11, col 1) +-------------------------------- +12 >function foo3([nameMA = "noName", [ + + ~~~~~~~~~~~~~~ => Pos: (363 to 376) SpanInfo: {"start":506,"length":19} + >console.log(nameMA) + >:=> (line 16, col 4) to (line 16, col 23) +12 >function foo3([nameMA = "noName", [ + + ~~~~~~~~~~~~~~~~~~~ => Pos: (377 to 395) SpanInfo: {"start":378,"length":17} + >nameMA = "noName" + >:=> (line 12, col 15) to (line 12, col 32) +12 >function foo3([nameMA = "noName", [ + + ~~~ => Pos: (396 to 398) SpanInfo: {"start":403,"length":25} + >primarySkillA = "primary" + >:=> (line 13, col 4) to (line 13, col 29) +-------------------------------- +13 > primarySkillA = "primary", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (399 to 429) SpanInfo: {"start":403,"length":25} + >primarySkillA = "primary" + >:=> (line 13, col 4) to (line 13, col 29) +-------------------------------- +14 > secondarySkillA = "secondary" + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (430 to 463) SpanInfo: {"start":434,"length":29} + >secondarySkillA = "secondary" + >:=> (line 14, col 4) to (line 14, col 33) +-------------------------------- +15 >] = ["noSkill", "noSkill"]]: Robot) { + + ~ => Pos: (464 to 464) SpanInfo: {"start":434,"length":29} + >secondarySkillA = "secondary" + >:=> (line 14, col 4) to (line 14, col 33) +15 >] = ["noSkill", "noSkill"]]: Robot) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (465 to 498) SpanInfo: {"start":397,"length":93} + >[ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + >] = ["noSkill", "noSkill"] + >:=> (line 12, col 34) to (line 15, col 26) +15 >] = ["noSkill", "noSkill"]]: Robot) { + + ~~~ => Pos: (499 to 501) SpanInfo: {"start":506,"length":19} + >console.log(nameMA) + >:=> (line 16, col 4) to (line 16, col 23) +-------------------------------- +16 > console.log(nameMA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (502 to 526) SpanInfo: {"start":506,"length":19} + >console.log(nameMA) + >:=> (line 16, col 4) to (line 16, col 23) +-------------------------------- +17 >} + + ~~ => Pos: (527 to 528) SpanInfo: {"start":527,"length":1} + >} + >:=> (line 17, col 0) to (line 17, col 1) +-------------------------------- +18 >foo1(robotA); + + ~~~~~~~~~~~~~~ => Pos: (529 to 542) SpanInfo: {"start":529,"length":12} + >foo1(robotA) + >:=> (line 18, col 0) to (line 18, col 12) +-------------------------------- +19 >foo1(["roomba", ["vaccum", "mopping"]]); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (543 to 583) SpanInfo: {"start":543,"length":39} + >foo1(["roomba", ["vaccum", "mopping"]]) + >:=> (line 19, col 0) to (line 19, col 39) +-------------------------------- +20 >foo2(robotA); + + ~~~~~~~~~~~~~~ => Pos: (584 to 597) SpanInfo: {"start":584,"length":12} + >foo2(robotA) + >:=> (line 20, col 0) to (line 20, col 12) +-------------------------------- +21 >foo2(["roomba", ["vaccum", "mopping"]]); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (598 to 638) SpanInfo: {"start":598,"length":39} + >foo2(["roomba", ["vaccum", "mopping"]]) + >:=> (line 21, col 0) to (line 21, col 39) +-------------------------------- +22 >foo3(robotA); + + ~~~~~~~~~~~~~~ => Pos: (639 to 652) SpanInfo: {"start":639,"length":12} + >foo3(robotA) + >:=> (line 22, col 0) to (line 22, col 12) +-------------------------------- +23 >foo3(["roomba", ["vaccum", "mopping"]]); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (653 to 692) SpanInfo: {"start":653,"length":39} + >foo3(["roomba", ["vaccum", "mopping"]]) + >:=> (line 23, col 0) to (line 23, col 39) \ No newline at end of file diff --git a/tests/baselines/reference/bpSpanDestructuringParameterNestedObjectBindingPattern.baseline b/tests/baselines/reference/bpSpanDestructuringParameterNestedObjectBindingPattern.baseline new file mode 100644 index 00000000000..be773df4530 --- /dev/null +++ b/tests/baselines/reference/bpSpanDestructuringParameterNestedObjectBindingPattern.baseline @@ -0,0 +1,200 @@ + +1 >declare var console: { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (0 to 22) SpanInfo: undefined +-------------------------------- +2 > log(msg: string): void; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (23 to 50) SpanInfo: undefined +-------------------------------- +3 >} + + ~~ => Pos: (51 to 52) SpanInfo: undefined +-------------------------------- +4 >interface Robot { + + ~~~~~~~~~~~~~~~~~~ => Pos: (53 to 70) SpanInfo: undefined +-------------------------------- +5 > name: string; + + ~~~~~~~~~~~~~~~~~~ => Pos: (71 to 88) SpanInfo: undefined +-------------------------------- +6 > skills: { + + ~~~~~~~~~~~~~~ => Pos: (89 to 102) SpanInfo: undefined +-------------------------------- +7 > primary: string; + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (103 to 127) SpanInfo: undefined +-------------------------------- +8 > secondary: string; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (128 to 154) SpanInfo: undefined +-------------------------------- +9 > }; + + ~~~~~~~ => Pos: (155 to 161) SpanInfo: undefined +-------------------------------- +10 >} + + ~~ => Pos: (162 to 163) SpanInfo: undefined +-------------------------------- +11 >var robotA: Robot = { name: "mower", skills: { primary: "mowing", secondary: "none" } }; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (164 to 252) SpanInfo: {"start":164,"length":87} + >var robotA: Robot = { name: "mower", skills: { primary: "mowing", secondary: "none" } } + >:=> (line 11, col 0) to (line 11, col 87) +-------------------------------- +12 >function foo1({ skills: { primary: primaryA, secondary: secondaryA } }: Robot) { + + ~~~~~~~~~~~~~~ => Pos: (253 to 266) SpanInfo: {"start":338,"length":21} + >console.log(primaryA) + >:=> (line 13, col 4) to (line 13, col 25) +12 >function foo1({ skills: { primary: primaryA, secondary: secondaryA } }: Robot) { + + ~~~~~~~~~ => Pos: (267 to 275) SpanInfo: {"start":269,"length":52} + >skills: { primary: primaryA, secondary: secondaryA } + >:=> (line 12, col 16) to (line 12, col 68) +12 >function foo1({ skills: { primary: primaryA, secondary: secondaryA } }: Robot) { + + ~~~~~~~~~~~~~~~~~~~~~ => Pos: (276 to 296) SpanInfo: {"start":279,"length":17} + >primary: primaryA + >:=> (line 12, col 26) to (line 12, col 43) +12 >function foo1({ skills: { primary: primaryA, secondary: secondaryA } }: Robot) { + + ~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (297 to 320) SpanInfo: {"start":298,"length":21} + >secondary: secondaryA + >:=> (line 12, col 45) to (line 12, col 66) +12 >function foo1({ skills: { primary: primaryA, secondary: secondaryA } }: Robot) { + + ~~~~~~~~~~=> Pos: (321 to 330) SpanInfo: {"start":269,"length":52} + >skills: { primary: primaryA, secondary: secondaryA } + >:=> (line 12, col 16) to (line 12, col 68) +12 >function foo1({ skills: { primary: primaryA, secondary: secondaryA } }: Robot) { + + ~~~=> Pos: (331 to 333) SpanInfo: {"start":338,"length":21} + >console.log(primaryA) + >:=> (line 13, col 4) to (line 13, col 25) +-------------------------------- +13 > console.log(primaryA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (334 to 360) SpanInfo: {"start":338,"length":21} + >console.log(primaryA) + >:=> (line 13, col 4) to (line 13, col 25) +-------------------------------- +14 >} + + ~~ => Pos: (361 to 362) SpanInfo: {"start":361,"length":1} + >} + >:=> (line 14, col 0) to (line 14, col 1) +-------------------------------- +15 >function foo2({ name: nameC, skills: { primary: primaryB, secondary: secondaryB } }: Robot) { + + ~~~~~~~~~~~~~~ => Pos: (363 to 376) SpanInfo: {"start":461,"length":23} + >console.log(secondaryB) + >:=> (line 16, col 4) to (line 16, col 27) +15 >function foo2({ name: nameC, skills: { primary: primaryB, secondary: secondaryB } }: Robot) { + + ~~~~~~~~~~~~~~ => Pos: (377 to 390) SpanInfo: {"start":379,"length":11} + >name: nameC + >:=> (line 15, col 16) to (line 15, col 27) +15 >function foo2({ name: nameC, skills: { primary: primaryB, secondary: secondaryB } }: Robot) { + + ~~~~~~~~ => Pos: (391 to 398) SpanInfo: {"start":392,"length":52} + >skills: { primary: primaryB, secondary: secondaryB } + >:=> (line 15, col 29) to (line 15, col 81) +15 >function foo2({ name: nameC, skills: { primary: primaryB, secondary: secondaryB } }: Robot) { + + ~~~~~~~~~~~~~~~~~~~~~=> Pos: (399 to 419) SpanInfo: {"start":402,"length":17} + >primary: primaryB + >:=> (line 15, col 39) to (line 15, col 56) +15 >function foo2({ name: nameC, skills: { primary: primaryB, secondary: secondaryB } }: Robot) { + + ~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (420 to 443) SpanInfo: {"start":421,"length":21} + >secondary: secondaryB + >:=> (line 15, col 58) to (line 15, col 79) +15 >function foo2({ name: nameC, skills: { primary: primaryB, secondary: secondaryB } }: Robot) { + + ~~~~~~~~~~=> Pos: (444 to 453) SpanInfo: {"start":392,"length":52} + >skills: { primary: primaryB, secondary: secondaryB } + >:=> (line 15, col 29) to (line 15, col 81) +15 >function foo2({ name: nameC, skills: { primary: primaryB, secondary: secondaryB } }: Robot) { + + ~~~=> Pos: (454 to 456) SpanInfo: {"start":461,"length":23} + >console.log(secondaryB) + >:=> (line 16, col 4) to (line 16, col 27) +-------------------------------- +16 > console.log(secondaryB); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (457 to 485) SpanInfo: {"start":461,"length":23} + >console.log(secondaryB) + >:=> (line 16, col 4) to (line 16, col 27) +-------------------------------- +17 >} + + ~~ => Pos: (486 to 487) SpanInfo: {"start":486,"length":1} + >} + >:=> (line 17, col 0) to (line 17, col 1) +-------------------------------- +18 >function foo3({ skills }: Robot) { + + ~~~~~~~~~~~~~~ => Pos: (488 to 501) SpanInfo: {"start":527,"length":27} + >console.log(skills.primary) + >:=> (line 19, col 4) to (line 19, col 31) +18 >function foo3({ skills }: Robot) { + + ~~~~~~~~~~~~~~~~~~ => Pos: (502 to 519) SpanInfo: {"start":504,"length":6} + >skills + >:=> (line 18, col 16) to (line 18, col 22) +18 >function foo3({ skills }: Robot) { + + ~~~ => Pos: (520 to 522) SpanInfo: {"start":527,"length":27} + >console.log(skills.primary) + >:=> (line 19, col 4) to (line 19, col 31) +-------------------------------- +19 > console.log(skills.primary); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (523 to 555) SpanInfo: {"start":527,"length":27} + >console.log(skills.primary) + >:=> (line 19, col 4) to (line 19, col 31) +-------------------------------- +20 >} + + ~~ => Pos: (556 to 557) SpanInfo: {"start":556,"length":1} + >} + >:=> (line 20, col 0) to (line 20, col 1) +-------------------------------- +21 >foo1(robotA); + + ~~~~~~~~~~~~~~ => Pos: (558 to 571) SpanInfo: {"start":558,"length":12} + >foo1(robotA) + >:=> (line 21, col 0) to (line 21, col 12) +-------------------------------- +22 >foo1({ name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (572 to 657) SpanInfo: {"start":572,"length":84} + >foo1({ name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }) + >:=> (line 22, col 0) to (line 22, col 84) +-------------------------------- +23 >foo2(robotA); + + ~~~~~~~~~~~~~~ => Pos: (658 to 671) SpanInfo: {"start":658,"length":12} + >foo2(robotA) + >:=> (line 23, col 0) to (line 23, col 12) +-------------------------------- +24 >foo2({ name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (672 to 757) SpanInfo: {"start":672,"length":84} + >foo2({ name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }) + >:=> (line 24, col 0) to (line 24, col 84) +-------------------------------- +25 >foo3(robotA); + + ~~~~~~~~~~~~~~ => Pos: (758 to 771) SpanInfo: {"start":758,"length":12} + >foo3(robotA) + >:=> (line 25, col 0) to (line 25, col 12) +-------------------------------- +26 >foo3({ name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (772 to 856) SpanInfo: {"start":772,"length":84} + >foo3({ name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }) + >:=> (line 26, col 0) to (line 26, col 84) \ No newline at end of file diff --git a/tests/baselines/reference/bpSpanDestructuringParameterNestedObjectBindingPatternDefaultValues.baseline b/tests/baselines/reference/bpSpanDestructuringParameterNestedObjectBindingPatternDefaultValues.baseline new file mode 100644 index 00000000000..c06c9b56fe5 --- /dev/null +++ b/tests/baselines/reference/bpSpanDestructuringParameterNestedObjectBindingPatternDefaultValues.baseline @@ -0,0 +1,274 @@ + +1 >declare var console: { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (0 to 22) SpanInfo: undefined +-------------------------------- +2 > log(msg: string): void; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (23 to 50) SpanInfo: undefined +-------------------------------- +3 >} + + ~~ => Pos: (51 to 52) SpanInfo: undefined +-------------------------------- +4 >interface Robot { + + ~~~~~~~~~~~~~~~~~~ => Pos: (53 to 70) SpanInfo: undefined +-------------------------------- +5 > name: string; + + ~~~~~~~~~~~~~~~~~~ => Pos: (71 to 88) SpanInfo: undefined +-------------------------------- +6 > skills: { + + ~~~~~~~~~~~~~~ => Pos: (89 to 102) SpanInfo: undefined +-------------------------------- +7 > primary?: string; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (103 to 128) SpanInfo: undefined +-------------------------------- +8 > secondary?: string; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (129 to 156) SpanInfo: undefined +-------------------------------- +9 > }; + + ~~~~~~~ => Pos: (157 to 163) SpanInfo: undefined +-------------------------------- +10 >} + + ~~ => Pos: (164 to 165) SpanInfo: undefined +-------------------------------- +11 >var robotA: Robot = { name: "mower", skills: { primary: "mowing", secondary: "none" } }; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (166 to 254) SpanInfo: {"start":166,"length":87} + >var robotA: Robot = { name: "mower", skills: { primary: "mowing", secondary: "none" } } + >:=> (line 11, col 0) to (line 11, col 87) +-------------------------------- +12 >function foo1( + + ~~~~~~~~~~~~~~~ => Pos: (255 to 269) SpanInfo: {"start":475,"length":21} + >console.log(primaryA) + >:=> (line 19, col 4) to (line 19, col 25) +-------------------------------- +13 > { + + ~~~~~~ => Pos: (270 to 275) SpanInfo: {"start":284,"length":161} + >skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "SomeSkill", secondary: "someSkill" } + >:=> (line 14, col 8) to (line 17, col 60) +-------------------------------- +14 > skills: { + + ~~~~~~~~~~~~~~~ => Pos: (276 to 290) SpanInfo: {"start":284,"length":161} + >skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "SomeSkill", secondary: "someSkill" } + >:=> (line 14, col 8) to (line 17, col 60) +14 > skills: { + + ~~~ => Pos: (291 to 293) SpanInfo: {"start":306,"length":29} + >primary: primaryA = "primary" + >:=> (line 15, col 12) to (line 15, col 41) +-------------------------------- +15 > primary: primaryA = "primary", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (294 to 336) SpanInfo: {"start":306,"length":29} + >primary: primaryA = "primary" + >:=> (line 15, col 12) to (line 15, col 41) +-------------------------------- +16 > secondary: secondaryA = "secondary" + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (337 to 384) SpanInfo: {"start":349,"length":35} + >secondary: secondaryA = "secondary" + >:=> (line 16, col 12) to (line 16, col 47) +-------------------------------- +17 > } = { primary: "SomeSkill", secondary: "someSkill" } + + ~~~~~~~~~ => Pos: (385 to 393) SpanInfo: {"start":349,"length":35} + >secondary: secondaryA = "secondary" + >:=> (line 16, col 12) to (line 16, col 47) +17 > } = { primary: "SomeSkill", secondary: "someSkill" } + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (394 to 445) SpanInfo: {"start":284,"length":161} + >skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "SomeSkill", secondary: "someSkill" } + >:=> (line 14, col 8) to (line 17, col 60) +-------------------------------- +18 > }: Robot = robotA) { + + ~~~~~~~~~~~~~~~~~~~~~~ => Pos: (446 to 467) SpanInfo: {"start":284,"length":161} + >skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "SomeSkill", secondary: "someSkill" } + >:=> (line 14, col 8) to (line 17, col 60) +18 > }: Robot = robotA) { + + ~~~ => Pos: (468 to 470) SpanInfo: {"start":475,"length":21} + >console.log(primaryA) + >:=> (line 19, col 4) to (line 19, col 25) +-------------------------------- +19 > console.log(primaryA); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (471 to 497) SpanInfo: {"start":475,"length":21} + >console.log(primaryA) + >:=> (line 19, col 4) to (line 19, col 25) +-------------------------------- +20 >} + + ~~ => Pos: (498 to 499) SpanInfo: {"start":498,"length":1} + >} + >:=> (line 20, col 0) to (line 20, col 1) +-------------------------------- +21 >function foo2( + + ~~~~~~~~~~~~~~~ => Pos: (500 to 514) SpanInfo: {"start":750,"length":23} + >console.log(secondaryB) + >:=> (line 29, col 4) to (line 29, col 27) +-------------------------------- +22 > { + + ~~~~~~ => Pos: (515 to 520) SpanInfo: {"start":529,"length":20} + >name: nameC = "name" + >:=> (line 23, col 8) to (line 23, col 28) +-------------------------------- +23 > name: nameC = "name", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (521 to 550) SpanInfo: {"start":529,"length":20} + >name: nameC = "name" + >:=> (line 23, col 8) to (line 23, col 28) +-------------------------------- +24 > skills: { + + ~~~~~~~~~~~~~~~ => Pos: (551 to 565) SpanInfo: {"start":559,"length":161} + >skills: { + > primary: primaryB = "primary", + > secondary: secondaryB = "secondary" + > } = { primary: "SomeSkill", secondary: "someSkill" } + >:=> (line 24, col 8) to (line 27, col 60) +24 > skills: { + + ~~~ => Pos: (566 to 568) SpanInfo: {"start":581,"length":29} + >primary: primaryB = "primary" + >:=> (line 25, col 12) to (line 25, col 41) +-------------------------------- +25 > primary: primaryB = "primary", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (569 to 611) SpanInfo: {"start":581,"length":29} + >primary: primaryB = "primary" + >:=> (line 25, col 12) to (line 25, col 41) +-------------------------------- +26 > secondary: secondaryB = "secondary" + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (612 to 659) SpanInfo: {"start":624,"length":35} + >secondary: secondaryB = "secondary" + >:=> (line 26, col 12) to (line 26, col 47) +-------------------------------- +27 > } = { primary: "SomeSkill", secondary: "someSkill" } + + ~~~~~~~~~ => Pos: (660 to 668) SpanInfo: {"start":624,"length":35} + >secondary: secondaryB = "secondary" + >:=> (line 26, col 12) to (line 26, col 47) +27 > } = { primary: "SomeSkill", secondary: "someSkill" } + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (669 to 720) SpanInfo: {"start":559,"length":161} + >skills: { + > primary: primaryB = "primary", + > secondary: secondaryB = "secondary" + > } = { primary: "SomeSkill", secondary: "someSkill" } + >:=> (line 24, col 8) to (line 27, col 60) +-------------------------------- +28 > }: Robot = robotA) { + + ~~~~~~~~~~~~~~~~~~~~~~ => Pos: (721 to 742) SpanInfo: {"start":559,"length":161} + >skills: { + > primary: primaryB = "primary", + > secondary: secondaryB = "secondary" + > } = { primary: "SomeSkill", secondary: "someSkill" } + >:=> (line 24, col 8) to (line 27, col 60) +28 > }: Robot = robotA) { + + ~~~ => Pos: (743 to 745) SpanInfo: {"start":750,"length":23} + >console.log(secondaryB) + >:=> (line 29, col 4) to (line 29, col 27) +-------------------------------- +29 > console.log(secondaryB); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (746 to 774) SpanInfo: {"start":750,"length":23} + >console.log(secondaryB) + >:=> (line 29, col 4) to (line 29, col 27) +-------------------------------- +30 >} + + ~~ => Pos: (775 to 776) SpanInfo: {"start":775,"length":1} + >} + >:=> (line 30, col 0) to (line 30, col 1) +-------------------------------- +31 >function foo3({ skills = { primary: "SomeSkill", secondary: "someSkill" } }: Robot = robotA) { + + ~~~~~~~~~~~~~~ => Pos: (777 to 790) SpanInfo: {"start":877,"length":27} + >console.log(skills.primary) + >:=> (line 32, col 4) to (line 32, col 31) +31 >function foo3({ skills = { primary: "SomeSkill", secondary: "someSkill" } }: Robot = robotA) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (791 to 869) SpanInfo: {"start":793,"length":57} + >skills = { primary: "SomeSkill", secondary: "someSkill" } + >:=> (line 31, col 16) to (line 31, col 73) +31 >function foo3({ skills = { primary: "SomeSkill", secondary: "someSkill" } }: Robot = robotA) { + + ~~~=> Pos: (870 to 872) SpanInfo: {"start":877,"length":27} + >console.log(skills.primary) + >:=> (line 32, col 4) to (line 32, col 31) +-------------------------------- +32 > console.log(skills.primary); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (873 to 905) SpanInfo: {"start":877,"length":27} + >console.log(skills.primary) + >:=> (line 32, col 4) to (line 32, col 31) +-------------------------------- +33 >} + + ~~ => Pos: (906 to 907) SpanInfo: {"start":906,"length":1} + >} + >:=> (line 33, col 0) to (line 33, col 1) +-------------------------------- +34 >foo1(robotA); + + ~~~~~~~~~~~~~~ => Pos: (908 to 921) SpanInfo: {"start":908,"length":12} + >foo1(robotA) + >:=> (line 34, col 0) to (line 34, col 12) +-------------------------------- +35 >foo1({ name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (922 to 1007) SpanInfo: {"start":922,"length":84} + >foo1({ name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }) + >:=> (line 35, col 0) to (line 35, col 84) +-------------------------------- +36 >foo2(robotA); + + ~~~~~~~~~~~~~~ => Pos: (1008 to 1021) SpanInfo: {"start":1008,"length":12} + >foo2(robotA) + >:=> (line 36, col 0) to (line 36, col 12) +-------------------------------- +37 >foo2({ name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1022 to 1107) SpanInfo: {"start":1022,"length":84} + >foo2({ name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }) + >:=> (line 37, col 0) to (line 37, col 84) +-------------------------------- +38 >foo3(robotA); + + ~~~~~~~~~~~~~~ => Pos: (1108 to 1121) SpanInfo: {"start":1108,"length":12} + >foo3(robotA) + >:=> (line 38, col 0) to (line 38, col 12) +-------------------------------- +39 >foo3({ name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1122 to 1206) SpanInfo: {"start":1122,"length":84} + >foo3({ name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }) + >:=> (line 39, col 0) to (line 39, col 84) \ No newline at end of file diff --git a/tests/baselines/reference/bpSpanDestructuringParameterObjectBindingPattern.baseline b/tests/baselines/reference/bpSpanDestructuringParameterObjectBindingPattern.baseline new file mode 100644 index 00000000000..21f11f320ab --- /dev/null +++ b/tests/baselines/reference/bpSpanDestructuringParameterObjectBindingPattern.baseline @@ -0,0 +1,164 @@ + +1 >interface Robot { + + ~~~~~~~~~~~~~~~~~~ => Pos: (0 to 17) SpanInfo: undefined +-------------------------------- +2 > name: string; + + ~~~~~~~~~~~~~~~~~~ => Pos: (18 to 35) SpanInfo: undefined +-------------------------------- +3 > skill: string; + + ~~~~~~~~~~~~~~~~~~~ => Pos: (36 to 54) SpanInfo: undefined +-------------------------------- +4 >} + + ~~ => Pos: (55 to 56) SpanInfo: undefined +-------------------------------- +5 >declare var console: { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (57 to 79) SpanInfo: undefined +-------------------------------- +6 > log(msg: string): void; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (80 to 107) SpanInfo: undefined +-------------------------------- +7 >} + + ~~ => Pos: (108 to 109) SpanInfo: undefined +-------------------------------- +8 >var hello = "hello"; + + ~~~~~~~~~~~~~~~~~~~~~ => Pos: (110 to 130) SpanInfo: {"start":110,"length":19} + >var hello = "hello" + >:=> (line 8, col 0) to (line 8, col 19) +-------------------------------- +9 >var robotA: Robot = { name: "mower", skill: "mowing" }; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (131 to 186) SpanInfo: {"start":131,"length":54} + >var robotA: Robot = { name: "mower", skill: "mowing" } + >:=> (line 9, col 0) to (line 9, col 54) +-------------------------------- +10 >function foo1({ name: nameA }: Robot) { + + ~~~~~~~~~~~~~~ => Pos: (187 to 200) SpanInfo: {"start":231,"length":18} + >console.log(nameA) + >:=> (line 11, col 4) to (line 11, col 22) +10 >function foo1({ name: nameA }: Robot) { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (201 to 223) SpanInfo: {"start":203,"length":11} + >name: nameA + >:=> (line 10, col 16) to (line 10, col 27) +10 >function foo1({ name: nameA }: Robot) { + + ~~~ => Pos: (224 to 226) SpanInfo: {"start":231,"length":18} + >console.log(nameA) + >:=> (line 11, col 4) to (line 11, col 22) +-------------------------------- +11 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (227 to 250) SpanInfo: {"start":231,"length":18} + >console.log(nameA) + >:=> (line 11, col 4) to (line 11, col 22) +-------------------------------- +12 >} + + ~~ => Pos: (251 to 252) SpanInfo: {"start":251,"length":1} + >} + >:=> (line 12, col 0) to (line 12, col 1) +-------------------------------- +13 >function foo2({ name: nameB, skill: skillB }: Robot) { + + ~~~~~~~~~~~~~~ => Pos: (253 to 266) SpanInfo: {"start":312,"length":18} + >console.log(nameB) + >:=> (line 14, col 4) to (line 14, col 22) +13 >function foo2({ name: nameB, skill: skillB }: Robot) { + + ~~~~~~~~~~~~~~ => Pos: (267 to 280) SpanInfo: {"start":269,"length":11} + >name: nameB + >:=> (line 13, col 16) to (line 13, col 27) +13 >function foo2({ name: nameB, skill: skillB }: Robot) { + + ~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (281 to 304) SpanInfo: {"start":282,"length":13} + >skill: skillB + >:=> (line 13, col 29) to (line 13, col 42) +13 >function foo2({ name: nameB, skill: skillB }: Robot) { + + ~~~=> Pos: (305 to 307) SpanInfo: {"start":312,"length":18} + >console.log(nameB) + >:=> (line 14, col 4) to (line 14, col 22) +-------------------------------- +14 > console.log(nameB); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (308 to 331) SpanInfo: {"start":312,"length":18} + >console.log(nameB) + >:=> (line 14, col 4) to (line 14, col 22) +-------------------------------- +15 >} + + ~~ => Pos: (332 to 333) SpanInfo: {"start":332,"length":1} + >} + >:=> (line 15, col 0) to (line 15, col 1) +-------------------------------- +16 >function foo3({ name }: Robot) { + + ~~~~~~~~~~~~~~ => Pos: (334 to 347) SpanInfo: {"start":371,"length":17} + >console.log(name) + >:=> (line 17, col 4) to (line 17, col 21) +16 >function foo3({ name }: Robot) { + + ~~~~~~~~~~~~~~~~ => Pos: (348 to 363) SpanInfo: {"start":350,"length":4} + >name + >:=> (line 16, col 16) to (line 16, col 20) +16 >function foo3({ name }: Robot) { + + ~~~ => Pos: (364 to 366) SpanInfo: {"start":371,"length":17} + >console.log(name) + >:=> (line 17, col 4) to (line 17, col 21) +-------------------------------- +17 > console.log(name); + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (367 to 389) SpanInfo: {"start":371,"length":17} + >console.log(name) + >:=> (line 17, col 4) to (line 17, col 21) +-------------------------------- +18 >} + + ~~ => Pos: (390 to 391) SpanInfo: {"start":390,"length":1} + >} + >:=> (line 18, col 0) to (line 18, col 1) +-------------------------------- +19 >foo1(robotA); + + ~~~~~~~~~~~~~~ => Pos: (392 to 405) SpanInfo: {"start":392,"length":12} + >foo1(robotA) + >:=> (line 19, col 0) to (line 19, col 12) +-------------------------------- +20 >foo1({ name: "Edger", skill: "cutting edges" }); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (406 to 454) SpanInfo: {"start":406,"length":47} + >foo1({ name: "Edger", skill: "cutting edges" }) + >:=> (line 20, col 0) to (line 20, col 47) +-------------------------------- +21 >foo2(robotA); + + ~~~~~~~~~~~~~~ => Pos: (455 to 468) SpanInfo: {"start":455,"length":12} + >foo2(robotA) + >:=> (line 21, col 0) to (line 21, col 12) +-------------------------------- +22 >foo2({ name: "Edger", skill: "cutting edges" }); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (469 to 517) SpanInfo: {"start":469,"length":47} + >foo2({ name: "Edger", skill: "cutting edges" }) + >:=> (line 22, col 0) to (line 22, col 47) +-------------------------------- +23 >foo3(robotA); + + ~~~~~~~~~~~~~~ => Pos: (518 to 531) SpanInfo: {"start":518,"length":12} + >foo3(robotA) + >:=> (line 23, col 0) to (line 23, col 12) +-------------------------------- +24 >foo3({ name: "Edger", skill: "cutting edges" }); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (532 to 579) SpanInfo: {"start":532,"length":47} + >foo3({ name: "Edger", skill: "cutting edges" }) + >:=> (line 24, col 0) to (line 24, col 47) \ No newline at end of file diff --git a/tests/baselines/reference/bpSpanDestructuringParameterObjectBindingPatternDefaultValues.baseline b/tests/baselines/reference/bpSpanDestructuringParameterObjectBindingPatternDefaultValues.baseline new file mode 100644 index 00000000000..6cb9b39c0d3 --- /dev/null +++ b/tests/baselines/reference/bpSpanDestructuringParameterObjectBindingPatternDefaultValues.baseline @@ -0,0 +1,164 @@ + +1 >interface Robot { + + ~~~~~~~~~~~~~~~~~~ => Pos: (0 to 17) SpanInfo: undefined +-------------------------------- +2 > name?: string; + + ~~~~~~~~~~~~~~~~~~~ => Pos: (18 to 36) SpanInfo: undefined +-------------------------------- +3 > skill?: string; + + ~~~~~~~~~~~~~~~~~~~~ => Pos: (37 to 56) SpanInfo: undefined +-------------------------------- +4 >} + + ~~ => Pos: (57 to 58) SpanInfo: undefined +-------------------------------- +5 >declare var console: { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (59 to 81) SpanInfo: undefined +-------------------------------- +6 > log(msg: string): void; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (82 to 109) SpanInfo: undefined +-------------------------------- +7 >} + + ~~ => Pos: (110 to 111) SpanInfo: undefined +-------------------------------- +8 >var hello = "hello"; + + ~~~~~~~~~~~~~~~~~~~~~ => Pos: (112 to 132) SpanInfo: {"start":112,"length":19} + >var hello = "hello" + >:=> (line 8, col 0) to (line 8, col 19) +-------------------------------- +9 >var robotA: Robot = { name: "mower", skill: "mowing" }; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (133 to 188) SpanInfo: {"start":133,"length":54} + >var robotA: Robot = { name: "mower", skill: "mowing" } + >:=> (line 9, col 0) to (line 9, col 54) +-------------------------------- +10 >function foo1({ name: nameA = "" }: Robot = { }) { + + ~~~~~~~~~~~~~~ => Pos: (189 to 202) SpanInfo: {"start":252,"length":18} + >console.log(nameA) + >:=> (line 11, col 4) to (line 11, col 22) +10 >function foo1({ name: nameA = "" }: Robot = { }) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (203 to 244) SpanInfo: {"start":205,"length":24} + >name: nameA = "" + >:=> (line 10, col 16) to (line 10, col 40) +10 >function foo1({ name: nameA = "" }: Robot = { }) { + + ~~~=> Pos: (245 to 247) SpanInfo: {"start":252,"length":18} + >console.log(nameA) + >:=> (line 11, col 4) to (line 11, col 22) +-------------------------------- +11 > console.log(nameA); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (248 to 271) SpanInfo: {"start":252,"length":18} + >console.log(nameA) + >:=> (line 11, col 4) to (line 11, col 22) +-------------------------------- +12 >} + + ~~ => Pos: (272 to 273) SpanInfo: {"start":272,"length":1} + >} + >:=> (line 12, col 0) to (line 12, col 1) +-------------------------------- +13 >function foo2({ name: nameB = "", skill: skillB = "noSkill" }: Robot = {}) { + + ~~~~~~~~~~~~~~ => Pos: (274 to 287) SpanInfo: {"start":363,"length":18} + >console.log(nameB) + >:=> (line 14, col 4) to (line 14, col 22) +13 >function foo2({ name: nameB = "", skill: skillB = "noSkill" }: Robot = {}) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (288 to 314) SpanInfo: {"start":290,"length":24} + >name: nameB = "" + >:=> (line 13, col 16) to (line 13, col 40) +13 >function foo2({ name: nameB = "", skill: skillB = "noSkill" }: Robot = {}) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (315 to 355) SpanInfo: {"start":316,"length":25} + >skill: skillB = "noSkill" + >:=> (line 13, col 42) to (line 13, col 67) +13 >function foo2({ name: nameB = "", skill: skillB = "noSkill" }: Robot = {}) { + + ~~~=> Pos: (356 to 358) SpanInfo: {"start":363,"length":18} + >console.log(nameB) + >:=> (line 14, col 4) to (line 14, col 22) +-------------------------------- +14 > console.log(nameB); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (359 to 382) SpanInfo: {"start":363,"length":18} + >console.log(nameB) + >:=> (line 14, col 4) to (line 14, col 22) +-------------------------------- +15 >} + + ~~ => Pos: (383 to 384) SpanInfo: {"start":383,"length":1} + >} + >:=> (line 15, col 0) to (line 15, col 1) +-------------------------------- +16 >function foo3({ name = "" }: Robot = {}) { + + ~~~~~~~~~~~~~~ => Pos: (385 to 398) SpanInfo: {"start":440,"length":17} + >console.log(name) + >:=> (line 17, col 4) to (line 17, col 21) +16 >function foo3({ name = "" }: Robot = {}) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (399 to 432) SpanInfo: {"start":401,"length":17} + >name = "" + >:=> (line 16, col 16) to (line 16, col 33) +16 >function foo3({ name = "" }: Robot = {}) { + + ~~~=> Pos: (433 to 435) SpanInfo: {"start":440,"length":17} + >console.log(name) + >:=> (line 17, col 4) to (line 17, col 21) +-------------------------------- +17 > console.log(name); + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (436 to 458) SpanInfo: {"start":440,"length":17} + >console.log(name) + >:=> (line 17, col 4) to (line 17, col 21) +-------------------------------- +18 >} + + ~~ => Pos: (459 to 460) SpanInfo: {"start":459,"length":1} + >} + >:=> (line 18, col 0) to (line 18, col 1) +-------------------------------- +19 >foo1(robotA); + + ~~~~~~~~~~~~~~ => Pos: (461 to 474) SpanInfo: {"start":461,"length":12} + >foo1(robotA) + >:=> (line 19, col 0) to (line 19, col 12) +-------------------------------- +20 >foo1({ name: "Edger", skill: "cutting edges" }); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (475 to 523) SpanInfo: {"start":475,"length":47} + >foo1({ name: "Edger", skill: "cutting edges" }) + >:=> (line 20, col 0) to (line 20, col 47) +-------------------------------- +21 >foo2(robotA); + + ~~~~~~~~~~~~~~ => Pos: (524 to 537) SpanInfo: {"start":524,"length":12} + >foo2(robotA) + >:=> (line 21, col 0) to (line 21, col 12) +-------------------------------- +22 >foo2({ name: "Edger", skill: "cutting edges" }); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (538 to 586) SpanInfo: {"start":538,"length":47} + >foo2({ name: "Edger", skill: "cutting edges" }) + >:=> (line 22, col 0) to (line 22, col 47) +-------------------------------- +23 >foo3(robotA); + + ~~~~~~~~~~~~~~ => Pos: (587 to 600) SpanInfo: {"start":587,"length":12} + >foo3(robotA) + >:=> (line 23, col 0) to (line 23, col 12) +-------------------------------- +24 >foo3({ name: "Edger", skill: "cutting edges" }); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (601 to 648) SpanInfo: {"start":601,"length":47} + >foo3({ name: "Edger", skill: "cutting edges" }) + >:=> (line 24, col 0) to (line 24, col 47) \ No newline at end of file diff --git a/tests/baselines/reference/bpSpanDestructuringVariableStatement.baseline b/tests/baselines/reference/bpSpanDestructuringVariableStatement.baseline new file mode 100644 index 00000000000..3939c66c56e --- /dev/null +++ b/tests/baselines/reference/bpSpanDestructuringVariableStatement.baseline @@ -0,0 +1,109 @@ + +1 >interface Robot { + + ~~~~~~~~~~~~~~~~~~ => Pos: (0 to 17) SpanInfo: undefined +-------------------------------- +2 > name: string; + + ~~~~~~~~~~~~~~~~~~ => Pos: (18 to 35) SpanInfo: undefined +-------------------------------- +3 > skill: string; + + ~~~~~~~~~~~~~~~~~~~ => Pos: (36 to 54) SpanInfo: undefined +-------------------------------- +4 >} + + ~~ => Pos: (55 to 56) SpanInfo: undefined +-------------------------------- +5 >declare var console: { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (57 to 79) SpanInfo: undefined +-------------------------------- +6 > log(msg: string): void; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (80 to 107) SpanInfo: undefined +-------------------------------- +7 >} + + ~~ => Pos: (108 to 109) SpanInfo: undefined +-------------------------------- +8 >var hello = "hello"; + + ~~~~~~~~~~~~~~~~~~~~~ => Pos: (110 to 130) SpanInfo: {"start":110,"length":19} + >var hello = "hello" + >:=> (line 8, col 0) to (line 8, col 19) +-------------------------------- +9 >var robotA: Robot = { name: "mower", skill: "mowing" }; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (131 to 186) SpanInfo: {"start":131,"length":54} + >var robotA: Robot = { name: "mower", skill: "mowing" } + >:=> (line 9, col 0) to (line 9, col 54) +-------------------------------- +10 >var robotB: Robot = { name: "trimmer", skill: "trimming" }; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (187 to 246) SpanInfo: {"start":187,"length":58} + >var robotB: Robot = { name: "trimmer", skill: "trimming" } + >:=> (line 10, col 0) to (line 10, col 58) +-------------------------------- +11 >var { name: nameA } = robotA; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (247 to 276) SpanInfo: {"start":253,"length":11} + >name: nameA + >:=> (line 11, col 6) to (line 11, col 17) +-------------------------------- +12 >var { name: nameB, skill: skillB } = robotB; + + ~~~~~~~~~~~~~~~~~~ => Pos: (277 to 294) SpanInfo: {"start":283,"length":11} + >name: nameB + >:=> (line 12, col 6) to (line 12, col 17) +12 >var { name: nameB, skill: skillB } = robotB; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (295 to 321) SpanInfo: {"start":296,"length":13} + >skill: skillB + >:=> (line 12, col 19) to (line 12, col 32) +-------------------------------- +13 >var { name: nameC, skill: skillC } = { name: "Edger", skill: "cutting edges" }; + + ~~~~~~~~~~~~~~~~~~ => Pos: (322 to 339) SpanInfo: {"start":328,"length":11} + >name: nameC + >:=> (line 13, col 6) to (line 13, col 17) +13 >var { name: nameC, skill: skillC } = { name: "Edger", skill: "cutting edges" }; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (340 to 401) SpanInfo: {"start":341,"length":13} + >skill: skillC + >:=> (line 13, col 19) to (line 13, col 32) +-------------------------------- +14 >if (nameA == nameB) { + + ~~~~~~~~~~~~~~~~~~~~~~ => Pos: (402 to 423) SpanInfo: {"start":402,"length":19} + >if (nameA == nameB) + >:=> (line 14, col 0) to (line 14, col 19) +-------------------------------- +15 > console.log(skillB); + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (424 to 448) SpanInfo: {"start":428,"length":19} + >console.log(skillB) + >:=> (line 15, col 4) to (line 15, col 23) +-------------------------------- +16 >} + + ~~ => Pos: (449 to 450) SpanInfo: {"start":428,"length":19} + >console.log(skillB) + >:=> (line 15, col 4) to (line 15, col 23) +-------------------------------- +17 >else { + + ~~~~~~~ => Pos: (451 to 457) SpanInfo: {"start":462,"length":18} + >console.log(nameC) + >:=> (line 18, col 4) to (line 18, col 22) +-------------------------------- +18 > console.log(nameC); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (458 to 481) SpanInfo: {"start":462,"length":18} + >console.log(nameC) + >:=> (line 18, col 4) to (line 18, col 22) +-------------------------------- +19 >} + ~ => Pos: (482 to 482) SpanInfo: {"start":462,"length":18} + >console.log(nameC) + >:=> (line 18, col 4) to (line 18, col 22) \ No newline at end of file diff --git a/tests/baselines/reference/bpSpanDestructuringVariableStatement1.baseline b/tests/baselines/reference/bpSpanDestructuringVariableStatement1.baseline new file mode 100644 index 00000000000..ce1edbb0ee9 --- /dev/null +++ b/tests/baselines/reference/bpSpanDestructuringVariableStatement1.baseline @@ -0,0 +1,227 @@ + +1 >interface Robot { + + ~~~~~~~~~~~~~~~~~~ => Pos: (0 to 17) SpanInfo: undefined +-------------------------------- +2 > name: string; + + ~~~~~~~~~~~~~~~~~~ => Pos: (18 to 35) SpanInfo: undefined +-------------------------------- +3 > skill: string; + + ~~~~~~~~~~~~~~~~~~~ => Pos: (36 to 54) SpanInfo: undefined +-------------------------------- +4 >} + + ~~ => Pos: (55 to 56) SpanInfo: undefined +-------------------------------- +5 >declare var console: { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (57 to 79) SpanInfo: undefined +-------------------------------- +6 > log(msg: string): void; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (80 to 107) SpanInfo: undefined +-------------------------------- +7 >} + + ~~ => Pos: (108 to 109) SpanInfo: undefined +-------------------------------- +8 >var hello = "hello"; + + ~~~~~~~~~~~~~~~~~~~~~ => Pos: (110 to 130) SpanInfo: {"start":110,"length":19} + >var hello = "hello" + >:=> (line 8, col 0) to (line 8, col 19) +-------------------------------- +9 >var robotA: Robot = { name: "mower", skill: "mowing" }; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (131 to 186) SpanInfo: {"start":131,"length":54} + >var robotA: Robot = { name: "mower", skill: "mowing" } + >:=> (line 9, col 0) to (line 9, col 54) +-------------------------------- +10 >var robotB: Robot = { name: "trimmer", skill: "trimming" }; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (187 to 246) SpanInfo: {"start":187,"length":58} + >var robotB: Robot = { name: "trimmer", skill: "trimming" } + >:=> (line 10, col 0) to (line 10, col 58) +-------------------------------- +11 >var a: string, { name: nameA } = robotA; + + ~~~~~~~~~~~~~~ => Pos: (247 to 260) SpanInfo: undefined +11 >var a: string, { name: nameA } = robotA; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (261 to 287) SpanInfo: {"start":264,"length":11} + >name: nameA + >:=> (line 11, col 17) to (line 11, col 28) +-------------------------------- +12 >var b: string, { name: nameB, skill: skillB } = robotB; + + ~~~~~~~~~~~~~~ => Pos: (288 to 301) SpanInfo: undefined +12 >var b: string, { name: nameB, skill: skillB } = robotB; + + ~~~~~~~~~~~~~~~ => Pos: (302 to 316) SpanInfo: {"start":305,"length":11} + >name: nameB + >:=> (line 12, col 17) to (line 12, col 28) +12 >var b: string, { name: nameB, skill: skillB } = robotB; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (317 to 343) SpanInfo: {"start":318,"length":13} + >skill: skillB + >:=> (line 12, col 30) to (line 12, col 43) +-------------------------------- +13 >var c: string, { name: nameC, skill: skillC } = { name: "Edger", skill: "cutting edges" }; + + ~~~~~~~~~~~~~~ => Pos: (344 to 357) SpanInfo: undefined +13 >var c: string, { name: nameC, skill: skillC } = { name: "Edger", skill: "cutting edges" }; + + ~~~~~~~~~~~~~~~ => Pos: (358 to 372) SpanInfo: {"start":361,"length":11} + >name: nameC + >:=> (line 13, col 17) to (line 13, col 28) +13 >var c: string, { name: nameC, skill: skillC } = { name: "Edger", skill: "cutting edges" }; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (373 to 434) SpanInfo: {"start":374,"length":13} + >skill: skillC + >:=> (line 13, col 30) to (line 13, col 43) +-------------------------------- +14 > + + ~ => Pos: (435 to 435) SpanInfo: undefined +-------------------------------- +15 >var { name: nameA } = robotA, a = hello; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (436 to 464) SpanInfo: {"start":442,"length":11} + >name: nameA + >:=> (line 15, col 6) to (line 15, col 17) +15 >var { name: nameA } = robotA, a = hello; + + ~~~~~~~~~~~~ => Pos: (465 to 476) SpanInfo: {"start":466,"length":9} + >a = hello + >:=> (line 15, col 30) to (line 15, col 39) +-------------------------------- +16 >var { name: nameB, skill: skillB } = robotB, b = " hello"; + + ~~~~~~~~~~~~~~~~~~ => Pos: (477 to 494) SpanInfo: {"start":483,"length":11} + >name: nameB + >:=> (line 16, col 6) to (line 16, col 17) +16 >var { name: nameB, skill: skillB } = robotB, b = " hello"; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (495 to 520) SpanInfo: {"start":496,"length":13} + >skill: skillB + >:=> (line 16, col 19) to (line 16, col 32) +16 >var { name: nameB, skill: skillB } = robotB, b = " hello"; + + ~~~~~~~~~~~~~~~=> Pos: (521 to 535) SpanInfo: {"start":522,"length":12} + >b = " hello" + >:=> (line 16, col 45) to (line 16, col 57) +-------------------------------- +17 >var { name: nameC, skill: skillC } = { name: "Edger", skill: "cutting edges" }, c = hello; + + ~~~~~~~~~~~~~~~~~~ => Pos: (536 to 553) SpanInfo: {"start":542,"length":11} + >name: nameC + >:=> (line 17, col 6) to (line 17, col 17) +17 >var { name: nameC, skill: skillC } = { name: "Edger", skill: "cutting edges" }, c = hello; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (554 to 614) SpanInfo: {"start":555,"length":13} + >skill: skillC + >:=> (line 17, col 19) to (line 17, col 32) +17 >var { name: nameC, skill: skillC } = { name: "Edger", skill: "cutting edges" }, c = hello; + + ~~~~~~~~~~~~=> Pos: (615 to 626) SpanInfo: {"start":616,"length":9} + >c = hello + >:=> (line 17, col 80) to (line 17, col 89) +-------------------------------- +18 > + + ~ => Pos: (627 to 627) SpanInfo: undefined +-------------------------------- +19 >var a = hello, { name: nameA } = robotA, a1= "hello"; + + ~~~~~~~~~~~~~~ => Pos: (628 to 641) SpanInfo: {"start":628,"length":13} + >var a = hello + >:=> (line 19, col 0) to (line 19, col 13) +19 >var a = hello, { name: nameA } = robotA, a1= "hello"; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (642 to 667) SpanInfo: {"start":645,"length":11} + >name: nameA + >:=> (line 19, col 17) to (line 19, col 28) +19 >var a = hello, { name: nameA } = robotA, a1= "hello"; + + ~~~~~~~~~~~~~~=> Pos: (668 to 681) SpanInfo: {"start":669,"length":11} + >a1= "hello" + >:=> (line 19, col 41) to (line 19, col 52) +-------------------------------- +20 >var b = hello, { name: nameB, skill: skillB } = robotB, b1 = "hello"; + + ~~~~~~~~~~~~~~ => Pos: (682 to 695) SpanInfo: {"start":682,"length":13} + >var b = hello + >:=> (line 20, col 0) to (line 20, col 13) +20 >var b = hello, { name: nameB, skill: skillB } = robotB, b1 = "hello"; + + ~~~~~~~~~~~~~~~ => Pos: (696 to 710) SpanInfo: {"start":699,"length":11} + >name: nameB + >:=> (line 20, col 17) to (line 20, col 28) +20 >var b = hello, { name: nameB, skill: skillB } = robotB, b1 = "hello"; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (711 to 736) SpanInfo: {"start":712,"length":13} + >skill: skillB + >:=> (line 20, col 30) to (line 20, col 43) +20 >var b = hello, { name: nameB, skill: skillB } = robotB, b1 = "hello"; + + ~~~~~~~~~~~~~~~=> Pos: (737 to 751) SpanInfo: {"start":738,"length":12} + >b1 = "hello" + >:=> (line 20, col 56) to (line 20, col 68) +-------------------------------- +21 >var c = hello, { name: nameC, skill: skillC } = { name: "Edger", skill: "cutting edges" }, c1 = hello; + + ~~~~~~~~~~~~~~ => Pos: (752 to 765) SpanInfo: {"start":752,"length":13} + >var c = hello + >:=> (line 21, col 0) to (line 21, col 13) +21 >var c = hello, { name: nameC, skill: skillC } = { name: "Edger", skill: "cutting edges" }, c1 = hello; + + ~~~~~~~~~~~~~~~ => Pos: (766 to 780) SpanInfo: {"start":769,"length":11} + >name: nameC + >:=> (line 21, col 17) to (line 21, col 28) +21 >var c = hello, { name: nameC, skill: skillC } = { name: "Edger", skill: "cutting edges" }, c1 = hello; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (781 to 841) SpanInfo: {"start":782,"length":13} + >skill: skillC + >:=> (line 21, col 30) to (line 21, col 43) +21 >var c = hello, { name: nameC, skill: skillC } = { name: "Edger", skill: "cutting edges" }, c1 = hello; + + ~~~~~~~~~~~~~=> Pos: (842 to 854) SpanInfo: {"start":843,"length":10} + >c1 = hello + >:=> (line 21, col 91) to (line 21, col 101) +-------------------------------- +22 >if (nameA == nameB) { + + ~~~~~~~~~~~~~~~~~~~~~~ => Pos: (855 to 876) SpanInfo: {"start":855,"length":19} + >if (nameA == nameB) + >:=> (line 22, col 0) to (line 22, col 19) +-------------------------------- +23 > console.log(skillB); + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (877 to 901) SpanInfo: {"start":881,"length":19} + >console.log(skillB) + >:=> (line 23, col 4) to (line 23, col 23) +-------------------------------- +24 >} + + ~~ => Pos: (902 to 903) SpanInfo: {"start":881,"length":19} + >console.log(skillB) + >:=> (line 23, col 4) to (line 23, col 23) +-------------------------------- +25 >else { + + ~~~~~~~ => Pos: (904 to 910) SpanInfo: {"start":915,"length":18} + >console.log(nameC) + >:=> (line 26, col 4) to (line 26, col 22) +-------------------------------- +26 > console.log(nameC); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (911 to 934) SpanInfo: {"start":915,"length":18} + >console.log(nameC) + >:=> (line 26, col 4) to (line 26, col 22) +-------------------------------- +27 >} + ~ => Pos: (935 to 935) SpanInfo: {"start":915,"length":18} + >console.log(nameC) + >:=> (line 26, col 4) to (line 26, col 22) \ No newline at end of file diff --git a/tests/baselines/reference/bpSpanDestructuringVariableStatementArrayBindingPattern.baseline b/tests/baselines/reference/bpSpanDestructuringVariableStatementArrayBindingPattern.baseline new file mode 100644 index 00000000000..0639ca49c9d --- /dev/null +++ b/tests/baselines/reference/bpSpanDestructuringVariableStatementArrayBindingPattern.baseline @@ -0,0 +1,87 @@ + +1 >declare var console: { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (0 to 22) SpanInfo: undefined +-------------------------------- +2 > log(msg: string): void; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (23 to 50) SpanInfo: undefined +-------------------------------- +3 >} + + ~~ => Pos: (51 to 52) SpanInfo: undefined +-------------------------------- +4 >type Robot = [number, string, string]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (53 to 91) SpanInfo: undefined +-------------------------------- +5 >var robotA: Robot = [1, "mower", "mowing"]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (92 to 135) SpanInfo: {"start":92,"length":42} + >var robotA: Robot = [1, "mower", "mowing"] + >:=> (line 5, col 0) to (line 5, col 42) +-------------------------------- +6 >var robotB: Robot = [2, "trimmer", "trimming"]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (136 to 183) SpanInfo: {"start":136,"length":46} + >var robotB: Robot = [2, "trimmer", "trimming"] + >:=> (line 6, col 0) to (line 6, col 46) +-------------------------------- +7 >let [, nameA] = robotA; + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (184 to 207) SpanInfo: {"start":191,"length":5} + >nameA + >:=> (line 7, col 7) to (line 7, col 12) +-------------------------------- +8 >let [numberB] = robotB; + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (208 to 231) SpanInfo: {"start":213,"length":7} + >numberB + >:=> (line 8, col 5) to (line 8, col 12) +-------------------------------- +9 >let [numberA2, nameA2, skillA2] = robotA; + + ~~~~~~~~~~~~~~ => Pos: (232 to 245) SpanInfo: {"start":237,"length":8} + >numberA2 + >:=> (line 9, col 5) to (line 9, col 13) +9 >let [numberA2, nameA2, skillA2] = robotA; + + ~~~~~~~~ => Pos: (246 to 253) SpanInfo: {"start":247,"length":6} + >nameA2 + >:=> (line 9, col 15) to (line 9, col 21) +9 >let [numberA2, nameA2, skillA2] = robotA; + + ~~~~~~~~~~~~~~~~~~~~ => Pos: (254 to 273) SpanInfo: {"start":255,"length":7} + >skillA2 + >:=> (line 9, col 23) to (line 9, col 30) +-------------------------------- +10 >let [numberC2] = [3, "edging", "Trimming edges"]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (274 to 323) SpanInfo: {"start":279,"length":8} + >numberC2 + >:=> (line 10, col 5) to (line 10, col 13) +-------------------------------- +11 >let [numberC, nameC, skillC] = [3, "edging", "Trimming edges"]; + + ~~~~~~~~~~~~~ => Pos: (324 to 336) SpanInfo: {"start":329,"length":7} + >numberC + >:=> (line 11, col 5) to (line 11, col 12) +11 >let [numberC, nameC, skillC] = [3, "edging", "Trimming edges"]; + + ~~~~~~~ => Pos: (337 to 343) SpanInfo: {"start":338,"length":5} + >nameC + >:=> (line 11, col 14) to (line 11, col 19) +11 >let [numberC, nameC, skillC] = [3, "edging", "Trimming edges"]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (344 to 387) SpanInfo: {"start":345,"length":6} + >skillC + >:=> (line 11, col 21) to (line 11, col 27) +-------------------------------- +12 >let [numberA3, ...robotAInfo] = robotA; + ~~~~~~~~~~~~~~ => Pos: (388 to 401) SpanInfo: {"start":393,"length":8} + >numberA3 + >:=> (line 12, col 5) to (line 12, col 13) +12 >let [numberA3, ...robotAInfo] = robotA; + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (402 to 426) SpanInfo: {"start":403,"length":13} + >...robotAInfo + >:=> (line 12, col 15) to (line 12, col 28) \ No newline at end of file diff --git a/tests/baselines/reference/bpSpanDestructuringVariableStatementArrayBindingPattern2.baseline b/tests/baselines/reference/bpSpanDestructuringVariableStatementArrayBindingPattern2.baseline new file mode 100644 index 00000000000..cb980a37c74 --- /dev/null +++ b/tests/baselines/reference/bpSpanDestructuringVariableStatementArrayBindingPattern2.baseline @@ -0,0 +1,105 @@ + +1 >declare var console: { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (0 to 22) SpanInfo: undefined +-------------------------------- +2 > log(msg: string): void; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (23 to 50) SpanInfo: undefined +-------------------------------- +3 >} + + ~~ => Pos: (51 to 52) SpanInfo: undefined +-------------------------------- +4 >type MultiSkilledRobot = [string, [string, string]]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (53 to 105) SpanInfo: undefined +-------------------------------- +5 >var multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (106 to 169) SpanInfo: {"start":106,"length":62} + >var multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]] + >:=> (line 5, col 0) to (line 5, col 62) +-------------------------------- +6 >var multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (170 to 243) SpanInfo: {"start":170,"length":72} + >var multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]] + >:=> (line 6, col 0) to (line 6, col 72) +-------------------------------- +7 > + + ~ => Pos: (244 to 244) SpanInfo: undefined +-------------------------------- +8 >let [, skillA] = multiRobotA; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (245 to 274) SpanInfo: {"start":252,"length":6} + >skillA + >:=> (line 8, col 7) to (line 8, col 13) +-------------------------------- +9 >let [nameMB] = multiRobotB; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (275 to 302) SpanInfo: {"start":280,"length":6} + >nameMB + >:=> (line 9, col 5) to (line 9, col 11) +-------------------------------- +10 >let [nameMA, [primarySkillA, secondarySkillA]] = multiRobotA; + + ~~~~~~~~~~~~ => Pos: (303 to 314) SpanInfo: {"start":308,"length":6} + >nameMA + >:=> (line 10, col 5) to (line 10, col 11) +10 >let [nameMA, [primarySkillA, secondarySkillA]] = multiRobotA; + + ~~~~~~~~~~~~~~~~ => Pos: (315 to 330) SpanInfo: {"start":317,"length":13} + >primarySkillA + >:=> (line 10, col 14) to (line 10, col 27) +10 >let [nameMA, [primarySkillA, secondarySkillA]] = multiRobotA; + + ~~~~~~~~~~~~~~~~~ => Pos: (331 to 347) SpanInfo: {"start":332,"length":15} + >secondarySkillA + >:=> (line 10, col 29) to (line 10, col 44) +10 >let [nameMA, [primarySkillA, secondarySkillA]] = multiRobotA; + + ~~~~~~~~~~~~~~~~~=> Pos: (348 to 364) SpanInfo: {"start":316,"length":32} + >[primarySkillA, secondarySkillA] + >:=> (line 10, col 13) to (line 10, col 45) +-------------------------------- +11 > + + ~ => Pos: (365 to 365) SpanInfo: undefined +-------------------------------- +12 >let [nameMC] = ["roomba", ["vaccum", "mopping"]]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (366 to 415) SpanInfo: {"start":371,"length":6} + >nameMC + >:=> (line 12, col 5) to (line 12, col 11) +-------------------------------- +13 >let [nameMC2, [primarySkillC, secondarySkillC]] = ["roomba", ["vaccum", "mopping"]]; + + ~~~~~~~~~~~~~ => Pos: (416 to 428) SpanInfo: {"start":421,"length":7} + >nameMC2 + >:=> (line 13, col 5) to (line 13, col 12) +13 >let [nameMC2, [primarySkillC, secondarySkillC]] = ["roomba", ["vaccum", "mopping"]]; + + ~~~~~~~~~~~~~~~~ => Pos: (429 to 444) SpanInfo: {"start":431,"length":13} + >primarySkillC + >:=> (line 13, col 15) to (line 13, col 28) +13 >let [nameMC2, [primarySkillC, secondarySkillC]] = ["roomba", ["vaccum", "mopping"]]; + + ~~~~~~~~~~~~~~~~~=> Pos: (445 to 461) SpanInfo: {"start":446,"length":15} + >secondarySkillC + >:=> (line 13, col 30) to (line 13, col 45) +13 >let [nameMC2, [primarySkillC, secondarySkillC]] = ["roomba", ["vaccum", "mopping"]]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (462 to 500) SpanInfo: {"start":430,"length":32} + >[primarySkillC, secondarySkillC] + >:=> (line 13, col 14) to (line 13, col 46) +-------------------------------- +14 > + + ~ => Pos: (501 to 501) SpanInfo: undefined +-------------------------------- +15 >let [...multiRobotAInfo] = multiRobotA; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (502 to 540) SpanInfo: {"start":507,"length":18} + >...multiRobotAInfo + >:=> (line 15, col 5) to (line 15, col 23) \ No newline at end of file diff --git a/tests/baselines/reference/bpSpanDestructuringVariableStatementArrayBindingPatternDefaultValues.baseline b/tests/baselines/reference/bpSpanDestructuringVariableStatementArrayBindingPatternDefaultValues.baseline new file mode 100644 index 00000000000..e3b43164563 --- /dev/null +++ b/tests/baselines/reference/bpSpanDestructuringVariableStatementArrayBindingPatternDefaultValues.baseline @@ -0,0 +1,87 @@ + +1 >declare var console: { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (0 to 22) SpanInfo: undefined +-------------------------------- +2 > log(msg: string): void; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (23 to 50) SpanInfo: undefined +-------------------------------- +3 >} + + ~~ => Pos: (51 to 52) SpanInfo: undefined +-------------------------------- +4 >type Robot = [number, string, string]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (53 to 91) SpanInfo: undefined +-------------------------------- +5 >var robotA: Robot = [1, "mower", "mowing"]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (92 to 135) SpanInfo: {"start":92,"length":42} + >var robotA: Robot = [1, "mower", "mowing"] + >:=> (line 5, col 0) to (line 5, col 42) +-------------------------------- +6 >var robotB: Robot = [2, "trimmer", "trimming"]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (136 to 183) SpanInfo: {"start":136,"length":46} + >var robotB: Robot = [2, "trimmer", "trimming"] + >:=> (line 6, col 0) to (line 6, col 46) +-------------------------------- +7 >let [, nameA = "noName"] = robotA; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (184 to 218) SpanInfo: {"start":191,"length":16} + >nameA = "noName" + >:=> (line 7, col 7) to (line 7, col 23) +-------------------------------- +8 >let [numberB = -1] = robotB; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (219 to 247) SpanInfo: {"start":224,"length":12} + >numberB = -1 + >:=> (line 8, col 5) to (line 8, col 17) +-------------------------------- +9 >let [numberA2 = -1, nameA2 = "noName", skillA2 = "noSkill"] = robotA; + + ~~~~~~~~~~~~~~~~~~~ => Pos: (248 to 266) SpanInfo: {"start":253,"length":13} + >numberA2 = -1 + >:=> (line 9, col 5) to (line 9, col 18) +9 >let [numberA2 = -1, nameA2 = "noName", skillA2 = "noSkill"] = robotA; + + ~~~~~~~~~~~~~~~~~~~ => Pos: (267 to 285) SpanInfo: {"start":268,"length":17} + >nameA2 = "noName" + >:=> (line 9, col 20) to (line 9, col 37) +9 >let [numberA2 = -1, nameA2 = "noName", skillA2 = "noSkill"] = robotA; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (286 to 317) SpanInfo: {"start":287,"length":19} + >skillA2 = "noSkill" + >:=> (line 9, col 39) to (line 9, col 58) +-------------------------------- +10 >let [numberC2 = -1] = [3, "edging", "Trimming edges"]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (318 to 372) SpanInfo: {"start":323,"length":13} + >numberC2 = -1 + >:=> (line 10, col 5) to (line 10, col 18) +-------------------------------- +11 >let [numberC = -1, nameC = "noName", skillC = "noSkill"] = [3, "edging", "Trimming edges"]; + + ~~~~~~~~~~~~~~~~~~ => Pos: (373 to 390) SpanInfo: {"start":378,"length":12} + >numberC = -1 + >:=> (line 11, col 5) to (line 11, col 17) +11 >let [numberC = -1, nameC = "noName", skillC = "noSkill"] = [3, "edging", "Trimming edges"]; + + ~~~~~~~~~~~~~~~~~~ => Pos: (391 to 408) SpanInfo: {"start":392,"length":16} + >nameC = "noName" + >:=> (line 11, col 19) to (line 11, col 35) +11 >let [numberC = -1, nameC = "noName", skillC = "noSkill"] = [3, "edging", "Trimming edges"]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (409 to 464) SpanInfo: {"start":410,"length":18} + >skillC = "noSkill" + >:=> (line 11, col 37) to (line 11, col 55) +-------------------------------- +12 >let [numberA3 = -1, ...robotAInfo] = robotA; + ~~~~~~~~~~~~~~~~~~~ => Pos: (465 to 483) SpanInfo: {"start":470,"length":13} + >numberA3 = -1 + >:=> (line 12, col 5) to (line 12, col 18) +12 >let [numberA3 = -1, ...robotAInfo] = robotA; + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (484 to 508) SpanInfo: {"start":485,"length":13} + >...robotAInfo + >:=> (line 12, col 20) to (line 12, col 33) \ No newline at end of file diff --git a/tests/baselines/reference/bpSpanDestructuringVariableStatementArrayBindingPatternDefaultValues2.baseline b/tests/baselines/reference/bpSpanDestructuringVariableStatementArrayBindingPatternDefaultValues2.baseline new file mode 100644 index 00000000000..ddbfdd29268 --- /dev/null +++ b/tests/baselines/reference/bpSpanDestructuringVariableStatementArrayBindingPatternDefaultValues2.baseline @@ -0,0 +1,84 @@ + +1 >declare var console: { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (0 to 22) SpanInfo: undefined +-------------------------------- +2 > log(msg: string): void; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (23 to 50) SpanInfo: undefined +-------------------------------- +3 >} + + ~~ => Pos: (51 to 52) SpanInfo: undefined +-------------------------------- +4 >type MultiSkilledRobot = [string, string[]]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (53 to 97) SpanInfo: undefined +-------------------------------- +5 >var multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (98 to 161) SpanInfo: {"start":98,"length":62} + >var multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]] + >:=> (line 5, col 0) to (line 5, col 62) +-------------------------------- +6 >var multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (162 to 235) SpanInfo: {"start":162,"length":72} + >var multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]] + >:=> (line 6, col 0) to (line 6, col 72) +-------------------------------- +7 >let [, skillA = ["noSkill", "noSkill"]] = multiRobotA; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (236 to 290) SpanInfo: {"start":243,"length":31} + >skillA = ["noSkill", "noSkill"] + >:=> (line 7, col 7) to (line 7, col 38) +-------------------------------- +8 >let [nameMB = "noName" ] = multiRobotB; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (291 to 330) SpanInfo: {"start":296,"length":17} + >nameMB = "noName" + >:=> (line 8, col 5) to (line 8, col 22) +-------------------------------- +9 >let [nameMA = "noName", [primarySkillA = "noSkill", secondarySkillA = "noSkill"] = ["noSkill", "noSkill"]] = multiRobotA; + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (331 to 353) SpanInfo: {"start":336,"length":17} + >nameMA = "noName" + >:=> (line 9, col 5) to (line 9, col 22) +9 >let [nameMA = "noName", [primarySkillA = "noSkill", secondarySkillA = "noSkill"] = ["noSkill", "noSkill"]] = multiRobotA; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (354 to 381) SpanInfo: {"start":356,"length":25} + >primarySkillA = "noSkill" + >:=> (line 9, col 25) to (line 9, col 50) +9 >let [nameMA = "noName", [primarySkillA = "noSkill", secondarySkillA = "noSkill"] = ["noSkill", "noSkill"]] = multiRobotA; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (382 to 410) SpanInfo: {"start":383,"length":27} + >secondarySkillA = "noSkill" + >:=> (line 9, col 52) to (line 9, col 79) +9 >let [nameMA = "noName", [primarySkillA = "noSkill", secondarySkillA = "noSkill"] = ["noSkill", "noSkill"]] = multiRobotA; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (411 to 452) SpanInfo: {"start":355,"length":81} + >[primarySkillA = "noSkill", secondarySkillA = "noSkill"] = ["noSkill", "noSkill"] + >:=> (line 9, col 24) to (line 9, col 105) +-------------------------------- +10 >let [nameMC = "noName" ] = ["roomba", ["vaccum", "mopping"]]; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (453 to 514) SpanInfo: {"start":458,"length":17} + >nameMC = "noName" + >:=> (line 10, col 5) to (line 10, col 22) +-------------------------------- +11 >let [nameMC2 = "noName", [primarySkillC = "noSkill", secondarySkillC = "noSkill"] = ["noSkill", "noSkill"]] = ["roomba", ["vaccum", "mopping"]]; + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (515 to 538) SpanInfo: {"start":520,"length":18} + >nameMC2 = "noName" + >:=> (line 11, col 5) to (line 11, col 23) +11 >let [nameMC2 = "noName", [primarySkillC = "noSkill", secondarySkillC = "noSkill"] = ["noSkill", "noSkill"]] = ["roomba", ["vaccum", "mopping"]]; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (539 to 566) SpanInfo: {"start":541,"length":25} + >primarySkillC = "noSkill" + >:=> (line 11, col 26) to (line 11, col 51) +11 >let [nameMC2 = "noName", [primarySkillC = "noSkill", secondarySkillC = "noSkill"] = ["noSkill", "noSkill"]] = ["roomba", ["vaccum", "mopping"]]; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (567 to 595) SpanInfo: {"start":568,"length":27} + >secondarySkillC = "noSkill" + >:=> (line 11, col 53) to (line 11, col 80) +11 >let [nameMC2 = "noName", [primarySkillC = "noSkill", secondarySkillC = "noSkill"] = ["noSkill", "noSkill"]] = ["roomba", ["vaccum", "mopping"]]; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (596 to 658) SpanInfo: {"start":540,"length":81} + >[primarySkillC = "noSkill", secondarySkillC = "noSkill"] = ["noSkill", "noSkill"] + >:=> (line 11, col 25) to (line 11, col 106) \ No newline at end of file diff --git a/tests/baselines/reference/bpSpanDestructuringVariableStatementDefaultValues.baseline b/tests/baselines/reference/bpSpanDestructuringVariableStatementDefaultValues.baseline new file mode 100644 index 00000000000..60ee5897d48 --- /dev/null +++ b/tests/baselines/reference/bpSpanDestructuringVariableStatementDefaultValues.baseline @@ -0,0 +1,109 @@ + +1 >interface Robot { + + ~~~~~~~~~~~~~~~~~~ => Pos: (0 to 17) SpanInfo: undefined +-------------------------------- +2 > name: string; + + ~~~~~~~~~~~~~~~~~~ => Pos: (18 to 35) SpanInfo: undefined +-------------------------------- +3 > skill: string; + + ~~~~~~~~~~~~~~~~~~~ => Pos: (36 to 54) SpanInfo: undefined +-------------------------------- +4 >} + + ~~ => Pos: (55 to 56) SpanInfo: undefined +-------------------------------- +5 >declare var console: { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (57 to 79) SpanInfo: undefined +-------------------------------- +6 > log(msg: string): void; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (80 to 107) SpanInfo: undefined +-------------------------------- +7 >} + + ~~ => Pos: (108 to 109) SpanInfo: undefined +-------------------------------- +8 >var hello = "hello"; + + ~~~~~~~~~~~~~~~~~~~~~ => Pos: (110 to 130) SpanInfo: {"start":110,"length":19} + >var hello = "hello" + >:=> (line 8, col 0) to (line 8, col 19) +-------------------------------- +9 >var robotA: Robot = { name: "mower", skill: "mowing" }; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (131 to 186) SpanInfo: {"start":131,"length":54} + >var robotA: Robot = { name: "mower", skill: "mowing" } + >:=> (line 9, col 0) to (line 9, col 54) +-------------------------------- +10 >var robotB: Robot = { name: "trimmer", skill: "trimming" }; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (187 to 246) SpanInfo: {"start":187,"length":58} + >var robotB: Robot = { name: "trimmer", skill: "trimming" } + >:=> (line 10, col 0) to (line 10, col 58) +-------------------------------- +11 >var { name: nameA = "" } = robotA; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (247 to 289) SpanInfo: {"start":253,"length":24} + >name: nameA = "" + >:=> (line 11, col 6) to (line 11, col 30) +-------------------------------- +12 >var { name: nameB = "", skill: skillB = "" } = robotB; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (290 to 320) SpanInfo: {"start":296,"length":24} + >name: nameB = "" + >:=> (line 12, col 6) to (line 12, col 30) +12 >var { name: nameB = "", skill: skillB = "" } = robotB; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (321 to 370) SpanInfo: {"start":322,"length":36} + >skill: skillB = "" + >:=> (line 12, col 32) to (line 12, col 68) +-------------------------------- +13 >var { name: nameC = "", skill: skillC = "" } = { name: "Edger", skill: "cutting edges" }; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (371 to 401) SpanInfo: {"start":377,"length":24} + >name: nameC = "" + >:=> (line 13, col 6) to (line 13, col 30) +13 >var { name: nameC = "", skill: skillC = "" } = { name: "Edger", skill: "cutting edges" }; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (402 to 486) SpanInfo: {"start":403,"length":36} + >skill: skillC = "" + >:=> (line 13, col 32) to (line 13, col 68) +-------------------------------- +14 >if (nameA == nameB) { + + ~~~~~~~~~~~~~~~~~~~~~~ => Pos: (487 to 508) SpanInfo: {"start":487,"length":19} + >if (nameA == nameB) + >:=> (line 14, col 0) to (line 14, col 19) +-------------------------------- +15 > console.log(skillB); + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (509 to 533) SpanInfo: {"start":513,"length":19} + >console.log(skillB) + >:=> (line 15, col 4) to (line 15, col 23) +-------------------------------- +16 >} + + ~~ => Pos: (534 to 535) SpanInfo: {"start":513,"length":19} + >console.log(skillB) + >:=> (line 15, col 4) to (line 15, col 23) +-------------------------------- +17 >else { + + ~~~~~~~ => Pos: (536 to 542) SpanInfo: {"start":547,"length":18} + >console.log(nameC) + >:=> (line 18, col 4) to (line 18, col 22) +-------------------------------- +18 > console.log(nameC); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (543 to 566) SpanInfo: {"start":547,"length":18} + >console.log(nameC) + >:=> (line 18, col 4) to (line 18, col 22) +-------------------------------- +19 >} + ~ => Pos: (567 to 567) SpanInfo: {"start":547,"length":18} + >console.log(nameC) + >:=> (line 18, col 4) to (line 18, col 22) \ No newline at end of file diff --git a/tests/baselines/reference/bpSpanDestructuringVariableStatementNestedObjectBindingPattern.baseline b/tests/baselines/reference/bpSpanDestructuringVariableStatementNestedObjectBindingPattern.baseline new file mode 100644 index 00000000000..66f814ada9c --- /dev/null +++ b/tests/baselines/reference/bpSpanDestructuringVariableStatementNestedObjectBindingPattern.baseline @@ -0,0 +1,168 @@ + +1 >declare var console: { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (0 to 22) SpanInfo: undefined +-------------------------------- +2 > log(msg: string): void; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (23 to 50) SpanInfo: undefined +-------------------------------- +3 >} + + ~~ => Pos: (51 to 52) SpanInfo: undefined +-------------------------------- +4 >interface Robot { + + ~~~~~~~~~~~~~~~~~~ => Pos: (53 to 70) SpanInfo: undefined +-------------------------------- +5 > name: string; + + ~~~~~~~~~~~~~~~~~~ => Pos: (71 to 88) SpanInfo: undefined +-------------------------------- +6 > skills: { + + ~~~~~~~~~~~~~~ => Pos: (89 to 102) SpanInfo: undefined +-------------------------------- +7 > primary: string; + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (103 to 127) SpanInfo: undefined +-------------------------------- +8 > secondary: string; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (128 to 154) SpanInfo: undefined +-------------------------------- +9 > }; + + ~~~~~~~ => Pos: (155 to 161) SpanInfo: undefined +-------------------------------- +10 >} + + ~~ => Pos: (162 to 163) SpanInfo: undefined +-------------------------------- +11 >var robotA: Robot = { name: "mower", skills: { primary: "mowing", secondary: "none" } }; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (164 to 252) SpanInfo: {"start":164,"length":87} + >var robotA: Robot = { name: "mower", skills: { primary: "mowing", secondary: "none" } } + >:=> (line 11, col 0) to (line 11, col 87) +-------------------------------- +12 >var robotB: Robot = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (253 to 347) SpanInfo: {"start":253,"length":93} + >var robotB: Robot = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } } + >:=> (line 12, col 0) to (line 12, col 93) +-------------------------------- +13 > + + ~ => Pos: (348 to 348) SpanInfo: undefined +-------------------------------- +14 >var { skills: { primary: primaryA, secondary: secondaryA } } = robotA; + + ~~~~~~~~~~~~~ => Pos: (349 to 361) SpanInfo: {"start":355,"length":52} + >skills: { primary: primaryA, secondary: secondaryA } + >:=> (line 14, col 6) to (line 14, col 58) +14 >var { skills: { primary: primaryA, secondary: secondaryA } } = robotA; + + ~~~~~~~~~~~~~~~~~~~~~ => Pos: (362 to 382) SpanInfo: {"start":365,"length":17} + >primary: primaryA + >:=> (line 14, col 16) to (line 14, col 33) +14 >var { skills: { primary: primaryA, secondary: secondaryA } } = robotA; + + ~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (383 to 406) SpanInfo: {"start":384,"length":21} + >secondary: secondaryA + >:=> (line 14, col 35) to (line 14, col 56) +14 >var { skills: { primary: primaryA, secondary: secondaryA } } = robotA; + + ~~~~~~~~~~~~~=> Pos: (407 to 419) SpanInfo: {"start":355,"length":52} + >skills: { primary: primaryA, secondary: secondaryA } + >:=> (line 14, col 6) to (line 14, col 58) +-------------------------------- +15 >var { name: nameB, skills: { primary: primaryB, secondary: secondaryB } } = robotB; + + ~~~~~~~~~~~~~~~~~~ => Pos: (420 to 437) SpanInfo: {"start":426,"length":11} + >name: nameB + >:=> (line 15, col 6) to (line 15, col 17) +15 >var { name: nameB, skills: { primary: primaryB, secondary: secondaryB } } = robotB; + + ~~~~~~~~ => Pos: (438 to 445) SpanInfo: {"start":439,"length":52} + >skills: { primary: primaryB, secondary: secondaryB } + >:=> (line 15, col 19) to (line 15, col 71) +15 >var { name: nameB, skills: { primary: primaryB, secondary: secondaryB } } = robotB; + + ~~~~~~~~~~~~~~~~~~~~~=> Pos: (446 to 466) SpanInfo: {"start":449,"length":17} + >primary: primaryB + >:=> (line 15, col 29) to (line 15, col 46) +15 >var { name: nameB, skills: { primary: primaryB, secondary: secondaryB } } = robotB; + + ~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (467 to 490) SpanInfo: {"start":468,"length":21} + >secondary: secondaryB + >:=> (line 15, col 48) to (line 15, col 69) +15 >var { name: nameB, skills: { primary: primaryB, secondary: secondaryB } } = robotB; + + ~~~~~~~~~~~~~=> Pos: (491 to 503) SpanInfo: {"start":439,"length":52} + >skills: { primary: primaryB, secondary: secondaryB } + >:=> (line 15, col 19) to (line 15, col 71) +-------------------------------- +16 >var { name: nameC, skills: { primary: primaryB, secondary: secondaryB } } = { name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }; + + ~~~~~~~~~~~~~~~~~~ => Pos: (504 to 521) SpanInfo: {"start":510,"length":11} + >name: nameC + >:=> (line 16, col 6) to (line 16, col 17) +16 >var { name: nameC, skills: { primary: primaryB, secondary: secondaryB } } = { name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }; + + ~~~~~~~~ => Pos: (522 to 529) SpanInfo: {"start":523,"length":52} + >skills: { primary: primaryB, secondary: secondaryB } + >:=> (line 16, col 19) to (line 16, col 71) +16 >var { name: nameC, skills: { primary: primaryB, secondary: secondaryB } } = { name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }; + + ~~~~~~~~~~~~~~~~~~~~~=> Pos: (530 to 550) SpanInfo: {"start":533,"length":17} + >primary: primaryB + >:=> (line 16, col 29) to (line 16, col 46) +16 >var { name: nameC, skills: { primary: primaryB, secondary: secondaryB } } = { name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }; + + ~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (551 to 574) SpanInfo: {"start":552,"length":21} + >secondary: secondaryB + >:=> (line 16, col 48) to (line 16, col 69) +16 >var { name: nameC, skills: { primary: primaryB, secondary: secondaryB } } = { name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (575 to 659) SpanInfo: {"start":523,"length":52} + >skills: { primary: primaryB, secondary: secondaryB } + >:=> (line 16, col 19) to (line 16, col 71) +-------------------------------- +17 > + + ~ => Pos: (660 to 660) SpanInfo: undefined +-------------------------------- +18 >if (nameB == nameB) { + + ~~~~~~~~~~~~~~~~~~~~~~ => Pos: (661 to 682) SpanInfo: {"start":661,"length":19} + >if (nameB == nameB) + >:=> (line 18, col 0) to (line 18, col 19) +-------------------------------- +19 > console.log(nameC); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (683 to 706) SpanInfo: {"start":687,"length":18} + >console.log(nameC) + >:=> (line 19, col 4) to (line 19, col 22) +-------------------------------- +20 >} + + ~~ => Pos: (707 to 708) SpanInfo: {"start":687,"length":18} + >console.log(nameC) + >:=> (line 19, col 4) to (line 19, col 22) +-------------------------------- +21 >else { + + ~~~~~~~ => Pos: (709 to 715) SpanInfo: {"start":720,"length":18} + >console.log(nameC) + >:=> (line 22, col 4) to (line 22, col 22) +-------------------------------- +22 > console.log(nameC); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (716 to 739) SpanInfo: {"start":720,"length":18} + >console.log(nameC) + >:=> (line 22, col 4) to (line 22, col 22) +-------------------------------- +23 >} + ~ => Pos: (740 to 740) SpanInfo: {"start":720,"length":18} + >console.log(nameC) + >:=> (line 22, col 4) to (line 22, col 22) \ No newline at end of file diff --git a/tests/baselines/reference/bpSpanDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.baseline b/tests/baselines/reference/bpSpanDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.baseline new file mode 100644 index 00000000000..75b37a0231e --- /dev/null +++ b/tests/baselines/reference/bpSpanDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.baseline @@ -0,0 +1,275 @@ + +1 >declare var console: { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (0 to 22) SpanInfo: undefined +-------------------------------- +2 > log(msg: string): void; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (23 to 50) SpanInfo: undefined +-------------------------------- +3 >} + + ~~ => Pos: (51 to 52) SpanInfo: undefined +-------------------------------- +4 >interface Robot { + + ~~~~~~~~~~~~~~~~~~ => Pos: (53 to 70) SpanInfo: undefined +-------------------------------- +5 > name: string; + + ~~~~~~~~~~~~~~~~~~ => Pos: (71 to 88) SpanInfo: undefined +-------------------------------- +6 > skills: { + + ~~~~~~~~~~~~~~ => Pos: (89 to 102) SpanInfo: undefined +-------------------------------- +7 > primary?: string; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (103 to 128) SpanInfo: undefined +-------------------------------- +8 > secondary?: string; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (129 to 156) SpanInfo: undefined +-------------------------------- +9 > }; + + ~~~~~~~ => Pos: (157 to 163) SpanInfo: undefined +-------------------------------- +10 >} + + ~~ => Pos: (164 to 165) SpanInfo: undefined +-------------------------------- +11 >var robotA: Robot = { name: "mower", skills: { primary: "mowing", secondary: "none" } }; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (166 to 254) SpanInfo: {"start":166,"length":87} + >var robotA: Robot = { name: "mower", skills: { primary: "mowing", secondary: "none" } } + >:=> (line 11, col 0) to (line 11, col 87) +-------------------------------- +12 >var robotB: Robot = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (255 to 349) SpanInfo: {"start":255,"length":93} + >var robotB: Robot = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } } + >:=> (line 12, col 0) to (line 12, col 93) +-------------------------------- +13 > + + ~ => Pos: (350 to 350) SpanInfo: undefined +-------------------------------- +14 >var { + + ~~~~~~ => Pos: (351 to 356) SpanInfo: {"start":361,"length":143} + >skills: { + > primary: primaryA = "noSkill", + > secondary: secondaryA = "noSkill" + > } = { primary: "noSkill", secondary: "noSkill" } + >:=> (line 15, col 4) to (line 18, col 52) +-------------------------------- +15 > skills: { + + ~~~~~~~~~~~ => Pos: (357 to 367) SpanInfo: {"start":361,"length":143} + >skills: { + > primary: primaryA = "noSkill", + > secondary: secondaryA = "noSkill" + > } = { primary: "noSkill", secondary: "noSkill" } + >:=> (line 15, col 4) to (line 18, col 52) +15 > skills: { + + ~~~ => Pos: (368 to 370) SpanInfo: {"start":379,"length":29} + >primary: primaryA = "noSkill" + >:=> (line 16, col 8) to (line 16, col 37) +-------------------------------- +16 > primary: primaryA = "noSkill", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (371 to 409) SpanInfo: {"start":379,"length":29} + >primary: primaryA = "noSkill" + >:=> (line 16, col 8) to (line 16, col 37) +-------------------------------- +17 > secondary: secondaryA = "noSkill" + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (410 to 451) SpanInfo: {"start":418,"length":33} + >secondary: secondaryA = "noSkill" + >:=> (line 17, col 8) to (line 17, col 41) +-------------------------------- +18 > } = { primary: "noSkill", secondary: "noSkill" } + + ~~~~~ => Pos: (452 to 456) SpanInfo: {"start":418,"length":33} + >secondary: secondaryA = "noSkill" + >:=> (line 17, col 8) to (line 17, col 41) +18 > } = { primary: "noSkill", secondary: "noSkill" } + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (457 to 504) SpanInfo: {"start":361,"length":143} + >skills: { + > primary: primaryA = "noSkill", + > secondary: secondaryA = "noSkill" + > } = { primary: "noSkill", secondary: "noSkill" } + >:=> (line 15, col 4) to (line 18, col 52) +-------------------------------- +19 >} = robotA; + + ~~~~~~~~~~~~ => Pos: (505 to 516) SpanInfo: {"start":361,"length":143} + >skills: { + > primary: primaryA = "noSkill", + > secondary: secondaryA = "noSkill" + > } = { primary: "noSkill", secondary: "noSkill" } + >:=> (line 15, col 4) to (line 18, col 52) +-------------------------------- +20 >var { + + ~~~~~~ => Pos: (517 to 522) SpanInfo: {"start":527,"length":31} + >name: nameB = "noNameSpecified" + >:=> (line 21, col 4) to (line 21, col 35) +-------------------------------- +21 > name: nameB = "noNameSpecified", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (523 to 559) SpanInfo: {"start":527,"length":31} + >name: nameB = "noNameSpecified" + >:=> (line 21, col 4) to (line 21, col 35) +-------------------------------- +22 > skills: { + + ~~~~~~~~~~~ => Pos: (560 to 570) SpanInfo: {"start":564,"length":143} + >skills: { + > primary: primaryB = "noSkill", + > secondary: secondaryB = "noSkill" + > } = { primary: "noSkill", secondary: "noSkill" } + >:=> (line 22, col 4) to (line 25, col 52) +22 > skills: { + + ~~~ => Pos: (571 to 573) SpanInfo: {"start":582,"length":29} + >primary: primaryB = "noSkill" + >:=> (line 23, col 8) to (line 23, col 37) +-------------------------------- +23 > primary: primaryB = "noSkill", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (574 to 612) SpanInfo: {"start":582,"length":29} + >primary: primaryB = "noSkill" + >:=> (line 23, col 8) to (line 23, col 37) +-------------------------------- +24 > secondary: secondaryB = "noSkill" + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (613 to 654) SpanInfo: {"start":621,"length":33} + >secondary: secondaryB = "noSkill" + >:=> (line 24, col 8) to (line 24, col 41) +-------------------------------- +25 > } = { primary: "noSkill", secondary: "noSkill" } + + ~~~~~ => Pos: (655 to 659) SpanInfo: {"start":621,"length":33} + >secondary: secondaryB = "noSkill" + >:=> (line 24, col 8) to (line 24, col 41) +25 > } = { primary: "noSkill", secondary: "noSkill" } + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (660 to 707) SpanInfo: {"start":564,"length":143} + >skills: { + > primary: primaryB = "noSkill", + > secondary: secondaryB = "noSkill" + > } = { primary: "noSkill", secondary: "noSkill" } + >:=> (line 22, col 4) to (line 25, col 52) +-------------------------------- +26 >} = robotB; + + ~~~~~~~~~~~~ => Pos: (708 to 719) SpanInfo: {"start":564,"length":143} + >skills: { + > primary: primaryB = "noSkill", + > secondary: secondaryB = "noSkill" + > } = { primary: "noSkill", secondary: "noSkill" } + >:=> (line 22, col 4) to (line 25, col 52) +-------------------------------- +27 >var { + + ~~~~~~ => Pos: (720 to 725) SpanInfo: {"start":730,"length":31} + >name: nameC = "noNameSpecified" + >:=> (line 28, col 4) to (line 28, col 35) +-------------------------------- +28 > name: nameC = "noNameSpecified", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (726 to 762) SpanInfo: {"start":730,"length":31} + >name: nameC = "noNameSpecified" + >:=> (line 28, col 4) to (line 28, col 35) +-------------------------------- +29 > skills: { + + ~~~~~~~~~~~ => Pos: (763 to 773) SpanInfo: {"start":767,"length":143} + >skills: { + > primary: primaryB = "noSkill", + > secondary: secondaryB = "noSkill" + > } = { primary: "noSkill", secondary: "noSkill" } + >:=> (line 29, col 4) to (line 32, col 52) +29 > skills: { + + ~~~ => Pos: (774 to 776) SpanInfo: {"start":785,"length":29} + >primary: primaryB = "noSkill" + >:=> (line 30, col 8) to (line 30, col 37) +-------------------------------- +30 > primary: primaryB = "noSkill", + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (777 to 815) SpanInfo: {"start":785,"length":29} + >primary: primaryB = "noSkill" + >:=> (line 30, col 8) to (line 30, col 37) +-------------------------------- +31 > secondary: secondaryB = "noSkill" + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (816 to 857) SpanInfo: {"start":824,"length":33} + >secondary: secondaryB = "noSkill" + >:=> (line 31, col 8) to (line 31, col 41) +-------------------------------- +32 > } = { primary: "noSkill", secondary: "noSkill" } + + ~~~~~ => Pos: (858 to 862) SpanInfo: {"start":824,"length":33} + >secondary: secondaryB = "noSkill" + >:=> (line 31, col 8) to (line 31, col 41) +32 > } = { primary: "noSkill", secondary: "noSkill" } + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (863 to 910) SpanInfo: {"start":767,"length":143} + >skills: { + > primary: primaryB = "noSkill", + > secondary: secondaryB = "noSkill" + > } = { primary: "noSkill", secondary: "noSkill" } + >:=> (line 29, col 4) to (line 32, col 52) +-------------------------------- +33 >} = { name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (911 to 1001) SpanInfo: {"start":767,"length":143} + >skills: { + > primary: primaryB = "noSkill", + > secondary: secondaryB = "noSkill" + > } = { primary: "noSkill", secondary: "noSkill" } + >:=> (line 29, col 4) to (line 32, col 52) +-------------------------------- +34 > + + ~ => Pos: (1002 to 1002) SpanInfo: undefined +-------------------------------- +35 >if (nameB == nameB) { + + ~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1003 to 1024) SpanInfo: {"start":1003,"length":19} + >if (nameB == nameB) + >:=> (line 35, col 0) to (line 35, col 19) +-------------------------------- +36 > console.log(nameC); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1025 to 1048) SpanInfo: {"start":1029,"length":18} + >console.log(nameC) + >:=> (line 36, col 4) to (line 36, col 22) +-------------------------------- +37 >} + + ~~ => Pos: (1049 to 1050) SpanInfo: {"start":1029,"length":18} + >console.log(nameC) + >:=> (line 36, col 4) to (line 36, col 22) +-------------------------------- +38 >else { + + ~~~~~~~ => Pos: (1051 to 1057) SpanInfo: {"start":1062,"length":18} + >console.log(nameC) + >:=> (line 39, col 4) to (line 39, col 22) +-------------------------------- +39 > console.log(nameC); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1058 to 1081) SpanInfo: {"start":1062,"length":18} + >console.log(nameC) + >:=> (line 39, col 4) to (line 39, col 22) +-------------------------------- +40 >} + ~ => Pos: (1082 to 1082) SpanInfo: {"start":1062,"length":18} + >console.log(nameC) + >:=> (line 39, col 4) to (line 39, col 22) \ No newline at end of file diff --git a/tests/baselines/reference/bpSpan_arrayLiteralExpressions.baseline b/tests/baselines/reference/bpSpan_arrayLiteralExpressions.baseline index d8bfbc84aa0..aa39897be0f 100644 --- a/tests/baselines/reference/bpSpan_arrayLiteralExpressions.baseline +++ b/tests/baselines/reference/bpSpan_arrayLiteralExpressions.baseline @@ -25,26 +25,14 @@ -------------------------------- 5 >a = [foo(30), (function () { - ~~~~~ => Pos: (64 to 68) SpanInfo: {"start":64,"length":49} + ~~~~~~~~~~~~~ => Pos: (64 to 76) SpanInfo: {"start":64,"length":49} >a = [foo(30), (function () { > return 30; >})()] >:=> (line 5, col 0) to (line 7, col 5) 5 >a = [foo(30), (function () { - ~~~~~~~~ => Pos: (69 to 76) SpanInfo: {"start":69,"length":7} - >foo(30) - >:=> (line 5, col 5) to (line 5, col 12) -5 >a = [foo(30), (function () { - - ~~ => Pos: (77 to 78) SpanInfo: {"start":78,"length":34} - >(function () { - > return 30; - >})() - >:=> (line 5, col 14) to (line 7, col 4) -5 >a = [foo(30), (function () { - - ~~~~~~~~~~~~~~ => Pos: (79 to 92) SpanInfo: {"start":97,"length":9} + ~~~~~~~~~~~~~~~~ => Pos: (77 to 92) SpanInfo: {"start":97,"length":9} >return 30 >:=> (line 6, col 4) to (line 6, col 13) -------------------------------- @@ -56,18 +44,11 @@ -------------------------------- 7 >})()]; - ~ => Pos: (108 to 108) SpanInfo: {"start":108,"length":1} + ~~~~ => Pos: (108 to 111) SpanInfo: {"start":108,"length":1} >} >:=> (line 7, col 0) to (line 7, col 1) 7 >})()]; - ~~~ => Pos: (109 to 111) SpanInfo: {"start":78,"length":34} - >(function () { - > return 30; - >})() - >:=> (line 5, col 14) to (line 7, col 4) -7 >})()]; - ~~~ => Pos: (112 to 114) SpanInfo: {"start":64,"length":49} >a = [foo(30), (function () { > return 30; @@ -94,17 +75,7 @@ -------------------------------- 11 >var x = bar()[0]; - ~~~~~~~ => Pos: (148 to 154) SpanInfo: {"start":148,"length":16} - >var x = bar()[0] - >:=> (line 11, col 0) to (line 11, col 16) -11 >var x = bar()[0]; - - ~~~~~~ => Pos: (155 to 160) SpanInfo: {"start":156,"length":5} - >bar() - >:=> (line 11, col 8) to (line 11, col 13) -11 >var x = bar()[0]; - - ~~~~~ => Pos: (161 to 165) SpanInfo: {"start":148,"length":16} + ~~~~~~~~~~~~~~~~~~ => Pos: (148 to 165) SpanInfo: {"start":148,"length":16} >var x = bar()[0] >:=> (line 11, col 0) to (line 11, col 16) -------------------------------- @@ -117,14 +88,7 @@ >:=> (line 12, col 0) to (line 14, col 7) 12 >x = (function () { - ~~ => Pos: (169 to 170) SpanInfo: {"start":170,"length":33} - >(function () { - > return a; - >})() - >:=> (line 12, col 4) to (line 14, col 4) -12 >x = (function () { - - ~~~~~~~~~~~~~~ => Pos: (171 to 184) SpanInfo: {"start":189,"length":8} + ~~~~~~~~~~~~~~~~ => Pos: (169 to 184) SpanInfo: {"start":189,"length":8} >return a >:=> (line 13, col 4) to (line 13, col 12) -------------------------------- @@ -136,18 +100,11 @@ -------------------------------- 14 >})()[x]; - ~ => Pos: (199 to 199) SpanInfo: {"start":199,"length":1} + ~~~~ => Pos: (199 to 202) SpanInfo: {"start":199,"length":1} >} >:=> (line 14, col 0) to (line 14, col 1) 14 >})()[x]; - ~~~ => Pos: (200 to 202) SpanInfo: {"start":170,"length":33} - >(function () { - > return a; - >})() - >:=> (line 12, col 4) to (line 14, col 4) -14 >})()[x]; - ~~~~~ => Pos: (203 to 207) SpanInfo: {"start":166,"length":40} >x = (function () { > return a; @@ -163,14 +120,7 @@ >:=> (line 15, col 0) to (line 17, col 5) 15 >a[(function () { - ~ => Pos: (210 to 210) SpanInfo: {"start":210,"length":33} - >(function () { - > return x; - >})() - >:=> (line 15, col 2) to (line 17, col 4) -15 >a[(function () { - - ~~~~~~~~~~~~~~ => Pos: (211 to 224) SpanInfo: {"start":229,"length":8} + ~~~~~~~~~~~~~~~ => Pos: (210 to 224) SpanInfo: {"start":229,"length":8} >return x >:=> (line 16, col 4) to (line 16, col 12) -------------------------------- @@ -181,15 +131,9 @@ >:=> (line 16, col 4) to (line 16, col 12) -------------------------------- 17 >})()]; - ~ => Pos: (239 to 239) SpanInfo: {"start":239,"length":1} + ~~~~ => Pos: (239 to 242) SpanInfo: {"start":239,"length":1} >} >:=> (line 17, col 0) to (line 17, col 1) -17 >})()]; - ~~~ => Pos: (240 to 242) SpanInfo: {"start":210,"length":33} - >(function () { - > return x; - >})() - >:=> (line 15, col 2) to (line 17, col 4) 17 >})()]; ~~ => Pos: (243 to 244) SpanInfo: {"start":208,"length":36} >a[(function () { diff --git a/tests/baselines/reference/bpSpan_binaryExpressions.baseline b/tests/baselines/reference/bpSpan_binaryExpressions.baseline index 370fec39a25..93f6b97005b 100644 --- a/tests/baselines/reference/bpSpan_binaryExpressions.baseline +++ b/tests/baselines/reference/bpSpan_binaryExpressions.baseline @@ -38,14 +38,7 @@ >:=> (line 6, col 0) to (line 8, col 8) 6 >x = (function foo() { - ~~ => Pos: (55 to 56) SpanInfo: {"start":56,"length":36} - >(function foo() { - > return y; - >})() - >:=> (line 6, col 4) to (line 8, col 4) -6 >x = (function foo() { - - ~~~~~~~~~~~~~~~~~ => Pos: (57 to 73) SpanInfo: {"start":78,"length":8} + ~~~~~~~~~~~~~~~~~~~ => Pos: (55 to 73) SpanInfo: {"start":78,"length":8} >return y >:=> (line 7, col 4) to (line 7, col 12) -------------------------------- @@ -57,18 +50,11 @@ -------------------------------- 8 >})() + y; - ~ => Pos: (88 to 88) SpanInfo: {"start":88,"length":1} + ~~~~ => Pos: (88 to 91) SpanInfo: {"start":88,"length":1} >} >:=> (line 8, col 0) to (line 8, col 1) 8 >})() + y; - ~~~ => Pos: (89 to 91) SpanInfo: {"start":56,"length":36} - >(function foo() { - > return y; - >})() - >:=> (line 6, col 4) to (line 8, col 4) -8 >})() + y; - ~~~~~~ => Pos: (92 to 97) SpanInfo: {"start":52,"length":44} >x = (function foo() { > return y; @@ -84,14 +70,7 @@ >:=> (line 9, col 0) to (line 11, col 9) 9 >x = y + 30 + (function foo() { - ~~ => Pos: (110 to 111) SpanInfo: {"start":111,"length":36} - >(function foo() { - > return y; - >})() - >:=> (line 9, col 13) to (line 11, col 4) -9 >x = y + 30 + (function foo() { - - ~~~~~~~~~~~~~~~~~ => Pos: (112 to 128) SpanInfo: {"start":133,"length":8} + ~~~~~~~~~~~~~~~~~~~ => Pos: (110 to 128) SpanInfo: {"start":133,"length":8} >return y >:=> (line 10, col 4) to (line 10, col 12) -------------------------------- @@ -102,15 +81,9 @@ >:=> (line 10, col 4) to (line 10, col 12) -------------------------------- 11 >})() * 40; - ~ => Pos: (143 to 143) SpanInfo: {"start":143,"length":1} + ~~~~ => Pos: (143 to 146) SpanInfo: {"start":143,"length":1} >} >:=> (line 11, col 0) to (line 11, col 1) -11 >})() * 40; - ~~~ => Pos: (144 to 146) SpanInfo: {"start":111,"length":36} - >(function foo() { - > return y; - >})() - >:=> (line 9, col 13) to (line 11, col 4) 11 >})() * 40; ~~~~~~ => Pos: (147 to 152) SpanInfo: {"start":98,"length":54} >x = y + 30 + (function foo() { diff --git a/tests/baselines/reference/bpSpan_classes.baseline b/tests/baselines/reference/bpSpan_classes.baseline index 811109af835..ecba5c8706a 100644 --- a/tests/baselines/reference/bpSpan_classes.baseline +++ b/tests/baselines/reference/bpSpan_classes.baseline @@ -171,14 +171,9 @@ -------------------------------- 15 > return new Greeter(greeting); - ~~~~~~~~~~~~~~ => Pos: (249 to 262) SpanInfo: {"start":257,"length":28} + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (249 to 286) SpanInfo: {"start":257,"length":28} >return new Greeter(greeting) >:=> (line 15, col 8) to (line 15, col 36) -15 > return new Greeter(greeting); - - ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (263 to 286) SpanInfo: {"start":264,"length":21} - >new Greeter(greeting) - >:=> (line 15, col 15) to (line 15, col 36) -------------------------------- 16 > } @@ -192,25 +187,15 @@ -------------------------------- 18 > var greeter = new Greeter("Hello, world!"); - ~~~~~~~~~~~~~~~~~ => Pos: (294 to 310) SpanInfo: {"start":298,"length":42} + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (294 to 341) SpanInfo: {"start":298,"length":42} >var greeter = new Greeter("Hello, world!") >:=> (line 18, col 4) to (line 18, col 46) -18 > var greeter = new Greeter("Hello, world!"); - - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (311 to 341) SpanInfo: {"start":312,"length":28} - >new Greeter("Hello, world!") - >:=> (line 18, col 18) to (line 18, col 46) -------------------------------- 19 > var str = greeter.greet(); - ~~~~~~~~~~~~~ => Pos: (342 to 354) SpanInfo: {"start":346,"length":25} + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (342 to 372) SpanInfo: {"start":346,"length":25} >var str = greeter.greet() >:=> (line 19, col 4) to (line 19, col 29) -19 > var str = greeter.greet(); - - ~~~~~~~~~~~~~~~~~~ => Pos: (355 to 372) SpanInfo: {"start":356,"length":15} - >greeter.greet() - >:=> (line 19, col 14) to (line 19, col 29) -------------------------------- 20 > @@ -240,14 +225,9 @@ -------------------------------- 23 > greeters[0] = new Greeter(greeting); - ~~~~~~~~~~~~~~~~~~~~~ => Pos: (525 to 545) SpanInfo: {"start":533,"length":35} + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (525 to 569) SpanInfo: {"start":533,"length":35} >greeters[0] = new Greeter(greeting) >:=> (line 23, col 8) to (line 23, col 43) -23 > greeters[0] = new Greeter(greeting); - - ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (546 to 569) SpanInfo: {"start":547,"length":21} - >new Greeter(greeting) - >:=> (line 23, col 22) to (line 23, col 43) -------------------------------- 24 > for (var i = 0; i < restGreetings.length; i++) { @@ -267,17 +247,7 @@ -------------------------------- 25 > greeters.push(new Greeter(restGreetings[i])); - ~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (627 to 652) SpanInfo: {"start":639,"length":44} - >greeters.push(new Greeter(restGreetings[i])) - >:=> (line 25, col 12) to (line 25, col 56) -25 > greeters.push(new Greeter(restGreetings[i])); - - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (653 to 681) SpanInfo: {"start":653,"length":29} - >new Greeter(restGreetings[i]) - >:=> (line 25, col 26) to (line 25, col 55) -25 > greeters.push(new Greeter(restGreetings[i])); - - ~~~=> Pos: (682 to 684) SpanInfo: {"start":639,"length":44} + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (627 to 684) SpanInfo: {"start":639,"length":44} >greeters.push(new Greeter(restGreetings[i])) >:=> (line 25, col 12) to (line 25, col 56) -------------------------------- @@ -309,14 +279,9 @@ -------------------------------- 31 > var b = foo2("Hello", "World", "!"); - ~~~~~~~~~~~ => Pos: (728 to 738) SpanInfo: {"start":732,"length":35} + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (728 to 768) SpanInfo: {"start":732,"length":35} >var b = foo2("Hello", "World", "!") >:=> (line 31, col 4) to (line 31, col 39) -31 > var b = foo2("Hello", "World", "!"); - - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (739 to 768) SpanInfo: {"start":740,"length":27} - >foo2("Hello", "World", "!") - >:=> (line 31, col 12) to (line 31, col 39) -------------------------------- 32 > // This is simple signle line comment diff --git a/tests/baselines/reference/bpSpan_conditionalExpressions.baseline b/tests/baselines/reference/bpSpan_conditionalExpressions.baseline index 5abd49d50cf..17432ee5439 100644 --- a/tests/baselines/reference/bpSpan_conditionalExpressions.baseline +++ b/tests/baselines/reference/bpSpan_conditionalExpressions.baseline @@ -22,14 +22,7 @@ >:=> (line 3, col 0) to (line 7, col 4) 3 >var z = (function foo() { - ~~ => Pos: (44 to 45) SpanInfo: {"start":45,"length":36} - >(function foo() { - > return x; - >})() - >:=> (line 3, col 8) to (line 5, col 4) -3 >var z = (function foo() { - - ~~~~~~~~~~~~~~~~~ => Pos: (46 to 62) SpanInfo: {"start":67,"length":8} + ~~~~~~~~~~~~~~~~~~~ => Pos: (44 to 62) SpanInfo: {"start":67,"length":8} >return x >:=> (line 4, col 4) to (line 4, col 12) -------------------------------- @@ -41,18 +34,11 @@ -------------------------------- 5 >})() ? y : function bar() { - ~ => Pos: (77 to 77) SpanInfo: {"start":77,"length":1} + ~~~~ => Pos: (77 to 80) SpanInfo: {"start":77,"length":1} >} >:=> (line 5, col 0) to (line 5, col 1) 5 >})() ? y : function bar() { - ~~~ => Pos: (78 to 80) SpanInfo: {"start":45,"length":36} - >(function foo() { - > return x; - >})() - >:=> (line 3, col 8) to (line 5, col 4) -5 >})() ? y : function bar() { - ~~~~~~ => Pos: (81 to 86) SpanInfo: {"start":37,"length":90} >var z = (function foo() { > return x; @@ -74,16 +60,9 @@ -------------------------------- 7 >} (); - ~ => Pos: (123 to 123) SpanInfo: {"start":123,"length":1} + ~~~~~~ => Pos: (123 to 128) SpanInfo: {"start":123,"length":1} >} >:=> (line 7, col 0) to (line 7, col 1) -7 >} (); - - ~~~~~ => Pos: (124 to 128) SpanInfo: {"start":88,"length":39} - >function bar() { - > return x; - >} () - >:=> (line 5, col 11) to (line 7, col 4) -------------------------------- 8 >x = y ? (function () { @@ -94,14 +73,7 @@ >:=> (line 8, col 0) to (line 10, col 10) 8 >x = y ? (function () { - ~~ => Pos: (136 to 137) SpanInfo: {"start":137,"length":33} - >(function () { - > return z; - >})() - >:=> (line 8, col 8) to (line 10, col 4) -8 >x = y ? (function () { - - ~~~~~~~~~~~~~~ => Pos: (138 to 151) SpanInfo: {"start":156,"length":8} + ~~~~~~~~~~~~~~~~ => Pos: (136 to 151) SpanInfo: {"start":156,"length":8} >return z >:=> (line 9, col 4) to (line 9, col 12) -------------------------------- @@ -112,15 +84,9 @@ >:=> (line 9, col 4) to (line 9, col 12) -------------------------------- 10 >})() : 10; - ~ => Pos: (166 to 166) SpanInfo: {"start":166,"length":1} + ~~~~ => Pos: (166 to 169) SpanInfo: {"start":166,"length":1} >} >:=> (line 10, col 0) to (line 10, col 1) -10 >})() : 10; - ~~~ => Pos: (167 to 169) SpanInfo: {"start":137,"length":33} - >(function () { - > return z; - >})() - >:=> (line 8, col 8) to (line 10, col 4) 10 >})() : 10; ~~~~~~~ => Pos: (170 to 176) SpanInfo: {"start":129,"length":47} >x = y ? (function () { diff --git a/tests/baselines/reference/bpSpan_do.baseline b/tests/baselines/reference/bpSpan_do.baseline index 3ff287c2046..602ec5b16c7 100644 --- a/tests/baselines/reference/bpSpan_do.baseline +++ b/tests/baselines/reference/bpSpan_do.baseline @@ -107,14 +107,7 @@ >:=> (line 15, col 2) to (line 17, col 15) 15 >} while ((function () { - ~ => Pos: (131 to 131) SpanInfo: {"start":131,"length":46} - >(function () { - > return 30 * i; - > })() - >:=> (line 15, col 9) to (line 17, col 8) -15 >} while ((function () { - - ~~~~~~~~~~~~~~ => Pos: (132 to 145) SpanInfo: {"start":154,"length":13} + ~~~~~~~~~~~~~~~ => Pos: (131 to 145) SpanInfo: {"start":154,"length":13} >return 30 * i >:=> (line 16, col 8) to (line 16, col 21) -------------------------------- @@ -125,15 +118,9 @@ >:=> (line 16, col 8) to (line 16, col 21) -------------------------------- 17 > })() !== i); - ~~~~~ => Pos: (169 to 173) SpanInfo: {"start":173,"length":1} + ~~~~~~~~ => Pos: (169 to 176) SpanInfo: {"start":173,"length":1} >} >:=> (line 17, col 4) to (line 17, col 5) -17 > })() !== i); - ~~~ => Pos: (174 to 176) SpanInfo: {"start":131,"length":46} - >(function () { - > return 30 * i; - > })() - >:=> (line 15, col 9) to (line 17, col 8) 17 > })() !== i); ~~~~~~~~~ => Pos: (177 to 185) SpanInfo: {"start":124,"length":60} >while ((function () { diff --git a/tests/baselines/reference/bpSpan_for.baseline b/tests/baselines/reference/bpSpan_for.baseline index 7fd6ba4c858..46214f6e3b1 100644 --- a/tests/baselines/reference/bpSpan_for.baseline +++ b/tests/baselines/reference/bpSpan_for.baseline @@ -220,12 +220,7 @@ -------------------------------- 32 >for (i = 0, j = 20; j < 20, i < 20; j++) { - ~~~~~ => Pos: (351 to 355) SpanInfo: {"start":356,"length":13} - >i = 0, j = 20 - >:=> (line 32, col 5) to (line 32, col 18) -32 >for (i = 0, j = 20; j < 20, i < 20; j++) { - - ~~~~~~ => Pos: (356 to 361) SpanInfo: {"start":356,"length":5} + ~~~~~~~~~~~ => Pos: (351 to 361) SpanInfo: {"start":356,"length":5} >i = 0 >:=> (line 32, col 5) to (line 32, col 10) 32 >for (i = 0, j = 20; j < 20, i < 20; j++) { diff --git a/tests/baselines/reference/bpSpan_forIn.baseline b/tests/baselines/reference/bpSpan_forIn.baseline index c2b72df5b12..1c46a83e3b4 100644 --- a/tests/baselines/reference/bpSpan_forIn.baseline +++ b/tests/baselines/reference/bpSpan_forIn.baseline @@ -104,14 +104,9 @@ -------------------------------- 17 > return new String(); - ~~~~~~~~~~ => Pos: (221 to 230) SpanInfo: {"start":225,"length":19} + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (221 to 245) SpanInfo: {"start":225,"length":19} >return new String() >:=> (line 17, col 4) to (line 17, col 23) -17 > return new String(); - - ~~~~~~~~~~~~~~~ => Pos: (231 to 245) SpanInfo: {"start":232,"length":12} - >new String() - >:=> (line 17, col 11) to (line 17, col 23) -------------------------------- 18 >}) { diff --git a/tests/baselines/reference/bpSpan_functionExpressions.baseline b/tests/baselines/reference/bpSpan_functionExpressions.baseline index 135edff9418..f75bde15f07 100644 --- a/tests/baselines/reference/bpSpan_functionExpressions.baseline +++ b/tests/baselines/reference/bpSpan_functionExpressions.baseline @@ -80,14 +80,9 @@ -------------------------------- 10 > return greet(msg); - ~~~~~~~~~~ => Pos: (235 to 244) SpanInfo: {"start":239,"length":17} + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (235 to 257) SpanInfo: {"start":239,"length":17} >return greet(msg) >:=> (line 10, col 4) to (line 10, col 21) -10 > return greet(msg); - - ~~~~~~~~~~~~~ => Pos: (245 to 257) SpanInfo: {"start":246,"length":10} - >greet(msg) - >:=> (line 10, col 11) to (line 10, col 21) -------------------------------- 11 >}; @@ -132,17 +127,7 @@ -------------------------------- 15 > if (!a()) { - ~~~~~~~~~ => Pos: (322 to 330) SpanInfo: {"start":326,"length":9} - >if (!a()) - >:=> (line 15, col 4) to (line 15, col 13) -15 > if (!a()) { - - ~~~ => Pos: (331 to 333) SpanInfo: {"start":331,"length":3} - >a() - >:=> (line 15, col 9) to (line 15, col 12) -15 > if (!a()) { - - ~~~~ => Pos: (334 to 337) SpanInfo: {"start":326,"length":9} + ~~~~~~~~~~~~~~~~ => Pos: (322 to 337) SpanInfo: {"start":326,"length":9} >if (!a()) >:=> (line 15, col 4) to (line 15, col 13) -------------------------------- diff --git a/tests/baselines/reference/bpSpan_ifElse.baseline b/tests/baselines/reference/bpSpan_ifElse.baseline index b66316d3392..fc9e5f6758a 100644 --- a/tests/baselines/reference/bpSpan_ifElse.baseline +++ b/tests/baselines/reference/bpSpan_ifElse.baseline @@ -131,18 +131,11 @@ -------------------------------- 20 >} ()) { - ~ => Pos: (193 to 193) SpanInfo: {"start":193,"length":1} + ~~~~ => Pos: (193 to 196) SpanInfo: {"start":193,"length":1} >} >:=> (line 20, col 0) to (line 20, col 1) 20 >} ()) { - ~~~ => Pos: (194 to 196) SpanInfo: {"start":161,"length":36} - >function foo() { - > return 30; - >} () - >:=> (line 18, col 4) to (line 20, col 4) -20 >} ()) { - ~ => Pos: (197 to 197) SpanInfo: {"start":157,"length":41} >if (function foo() { > return 30; diff --git a/tests/baselines/reference/bpSpan_import.baseline b/tests/baselines/reference/bpSpan_import.baseline index 26279b48f26..af0f959c57c 100644 --- a/tests/baselines/reference/bpSpan_import.baseline +++ b/tests/baselines/reference/bpSpan_import.baseline @@ -41,20 +41,11 @@ -------------------------------- 7 >var x = new a(); - ~~~~~~~ => Pos: (72 to 78) SpanInfo: {"start":72,"length":15} + ~~~~~~~~~~~~~~~~~ => Pos: (72 to 88) SpanInfo: {"start":72,"length":15} >var x = new a() >:=> (line 7, col 0) to (line 7, col 15) -7 >var x = new a(); - - ~~~~~~~~~~ => Pos: (79 to 88) SpanInfo: {"start":80,"length":7} - >new a() - >:=> (line 7, col 8) to (line 7, col 15) -------------------------------- 8 >var y = new b(); - ~~~~~~~ => Pos: (89 to 95) SpanInfo: {"start":89,"length":15} + ~~~~~~~~~~~~~~~~ => Pos: (89 to 104) SpanInfo: {"start":89,"length":15} >var y = new b() - >:=> (line 8, col 0) to (line 8, col 15) -8 >var y = new b(); - ~~~~~~~~~ => Pos: (96 to 104) SpanInfo: {"start":97,"length":7} - >new b() - >:=> (line 8, col 8) to (line 8, col 15) \ No newline at end of file + >:=> (line 8, col 0) to (line 8, col 15) \ No newline at end of file diff --git a/tests/baselines/reference/bpSpan_parenCallOrNewExpressions.baseline b/tests/baselines/reference/bpSpan_parenCallOrNewExpressions.baseline index 47c932640f9..bcc2326c1f3 100644 --- a/tests/baselines/reference/bpSpan_parenCallOrNewExpressions.baseline +++ b/tests/baselines/reference/bpSpan_parenCallOrNewExpressions.baseline @@ -26,105 +26,46 @@ >:=> (line 4, col 0) to (line 6, col 5) 4 >foo((function bar() { - ~ => Pos: (46 to 46) SpanInfo: {"start":46,"length":42} - >(function bar() { - > return foo(40); - >})() - >:=> (line 4, col 4) to (line 6, col 4) -4 >foo((function bar() { - - ~~~~~~~~~~~~~~~~~ => Pos: (47 to 63) SpanInfo: {"start":68,"length":14} + ~~~~~~~~~~~~~~~~~~ => Pos: (46 to 63) SpanInfo: {"start":68,"length":14} >return foo(40) >:=> (line 5, col 4) to (line 5, col 18) -------------------------------- 5 > return foo(40); - ~~~~~~~~~~ => Pos: (64 to 73) SpanInfo: {"start":68,"length":14} + ~~~~~~~~~~~~~~~~~~~~ => Pos: (64 to 83) SpanInfo: {"start":68,"length":14} >return foo(40) >:=> (line 5, col 4) to (line 5, col 18) -5 > return foo(40); - - ~~~~~~~~~~ => Pos: (74 to 83) SpanInfo: {"start":75,"length":7} - >foo(40) - >:=> (line 5, col 11) to (line 5, col 18) -------------------------------- 6 >})()); - ~ => Pos: (84 to 84) SpanInfo: {"start":84,"length":1} + ~~~~~~~ => Pos: (84 to 90) SpanInfo: {"start":84,"length":1} >} >:=> (line 6, col 0) to (line 6, col 1) -6 >})()); - - ~~~ => Pos: (85 to 87) SpanInfo: {"start":46,"length":42} - >(function bar() { - > return foo(40); - >})() - >:=> (line 4, col 4) to (line 6, col 4) -6 >})()); - - ~~~ => Pos: (88 to 90) SpanInfo: {"start":42,"length":47} - >foo((function bar() { - > return foo(40); - >})()) - >:=> (line 4, col 0) to (line 6, col 5) -------------------------------- 7 >var y = foo((function () { - ~~~~~~~ => Pos: (91 to 97) SpanInfo: {"start":91,"length":52} + ~~~~~~~~~~~~ => Pos: (91 to 102) SpanInfo: {"start":91,"length":52} >var y = foo((function () { > return foo(40); >})()) >:=> (line 7, col 0) to (line 9, col 5) 7 >var y = foo((function () { - ~~~~~ => Pos: (98 to 102) SpanInfo: {"start":99,"length":44} - >foo((function () { - > return foo(40); - >})()) - >:=> (line 7, col 8) to (line 9, col 5) -7 >var y = foo((function () { - - ~ => Pos: (103 to 103) SpanInfo: {"start":103,"length":39} - >(function () { - > return foo(40); - >})() - >:=> (line 7, col 12) to (line 9, col 4) -7 >var y = foo((function () { - - ~~~~~~~~~~~~~~ => Pos: (104 to 117) SpanInfo: {"start":122,"length":14} + ~~~~~~~~~~~~~~~ => Pos: (103 to 117) SpanInfo: {"start":122,"length":14} >return foo(40) >:=> (line 8, col 4) to (line 8, col 18) -------------------------------- 8 > return foo(40); - ~~~~~~~~~~ => Pos: (118 to 127) SpanInfo: {"start":122,"length":14} + ~~~~~~~~~~~~~~~~~~~~ => Pos: (118 to 137) SpanInfo: {"start":122,"length":14} >return foo(40) >:=> (line 8, col 4) to (line 8, col 18) -8 > return foo(40); - - ~~~~~~~~~~ => Pos: (128 to 137) SpanInfo: {"start":129,"length":7} - >foo(40) - >:=> (line 8, col 11) to (line 8, col 18) -------------------------------- 9 >})());; - ~ => Pos: (138 to 138) SpanInfo: {"start":138,"length":1} + ~~~~~~~~ => Pos: (138 to 145) SpanInfo: {"start":138,"length":1} >} >:=> (line 9, col 0) to (line 9, col 1) -9 >})());; - - ~~~ => Pos: (139 to 141) SpanInfo: {"start":103,"length":39} - >(function () { - > return foo(40); - >})() - >:=> (line 7, col 12) to (line 9, col 4) -9 >})());; - - ~~~~ => Pos: (142 to 145) SpanInfo: {"start":99,"length":44} - >foo((function () { - > return foo(40); - >})()) - >:=> (line 7, col 8) to (line 9, col 5) -------------------------------- 10 >class greeter { @@ -167,25 +108,15 @@ -------------------------------- 16 >y = foo(30); - ~~~ => Pos: (221 to 223) SpanInfo: {"start":221,"length":11} + ~~~~~~~~~~~~~ => Pos: (221 to 233) SpanInfo: {"start":221,"length":11} >y = foo(30) >:=> (line 16, col 0) to (line 16, col 11) -16 >y = foo(30); - - ~~~~~~~~~~ => Pos: (224 to 233) SpanInfo: {"start":225,"length":7} - >foo(30) - >:=> (line 16, col 4) to (line 16, col 11) -------------------------------- 17 >y = foo(500 + y); - ~~~ => Pos: (234 to 236) SpanInfo: {"start":234,"length":16} + ~~~~~~~~~~~~~~~~~~ => Pos: (234 to 251) SpanInfo: {"start":234,"length":16} >y = foo(500 + y) >:=> (line 17, col 0) to (line 17, col 16) -17 >y = foo(500 + y); - - ~~~~~~~~~~~~~~~ => Pos: (237 to 251) SpanInfo: {"start":238,"length":12} - >foo(500 + y) - >:=> (line 17, col 4) to (line 17, col 16) -------------------------------- 18 >new greeter((function bar() { @@ -196,127 +127,58 @@ >:=> (line 18, col 0) to (line 20, col 5) 18 >new greeter((function bar() { - ~ => Pos: (264 to 264) SpanInfo: {"start":264,"length":42} - >(function bar() { - > return foo(40); - >})() - >:=> (line 18, col 12) to (line 20, col 4) -18 >new greeter((function bar() { - - ~~~~~~~~~~~~~~~~~ => Pos: (265 to 281) SpanInfo: {"start":286,"length":14} + ~~~~~~~~~~~~~~~~~~ => Pos: (264 to 281) SpanInfo: {"start":286,"length":14} >return foo(40) >:=> (line 19, col 4) to (line 19, col 18) -------------------------------- 19 > return foo(40); - ~~~~~~~~~~ => Pos: (282 to 291) SpanInfo: {"start":286,"length":14} + ~~~~~~~~~~~~~~~~~~~~ => Pos: (282 to 301) SpanInfo: {"start":286,"length":14} >return foo(40) >:=> (line 19, col 4) to (line 19, col 18) -19 > return foo(40); - - ~~~~~~~~~~ => Pos: (292 to 301) SpanInfo: {"start":293,"length":7} - >foo(40) - >:=> (line 19, col 11) to (line 19, col 18) -------------------------------- 20 >})()); - ~ => Pos: (302 to 302) SpanInfo: {"start":302,"length":1} + ~~~~~~~ => Pos: (302 to 308) SpanInfo: {"start":302,"length":1} >} >:=> (line 20, col 0) to (line 20, col 1) -20 >})()); - - ~~~ => Pos: (303 to 305) SpanInfo: {"start":264,"length":42} - >(function bar() { - > return foo(40); - >})() - >:=> (line 18, col 12) to (line 20, col 4) -20 >})()); - - ~~~ => Pos: (306 to 308) SpanInfo: {"start":252,"length":55} - >new greeter((function bar() { - > return foo(40); - >})()) - >:=> (line 18, col 0) to (line 20, col 5) -------------------------------- 21 >var anotherGreeter = new greeter((function bar() { - ~~~~~~~~~~~~~~~~~~~~ => Pos: (309 to 328) SpanInfo: {"start":309,"length":76} + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (309 to 341) SpanInfo: {"start":309,"length":76} >var anotherGreeter = new greeter((function bar() { > return foo(40); >})()) >:=> (line 21, col 0) to (line 23, col 5) 21 >var anotherGreeter = new greeter((function bar() { - ~~~~~~~~~~~~~ => Pos: (329 to 341) SpanInfo: {"start":330,"length":55} - >new greeter((function bar() { - > return foo(40); - >})()) - >:=> (line 21, col 21) to (line 23, col 5) -21 >var anotherGreeter = new greeter((function bar() { - - ~ => Pos: (342 to 342) SpanInfo: {"start":342,"length":42} - >(function bar() { - > return foo(40); - >})() - >:=> (line 21, col 33) to (line 23, col 4) -21 >var anotherGreeter = new greeter((function bar() { - - ~~~~~~~~~~~~~~~~~=> Pos: (343 to 359) SpanInfo: {"start":364,"length":14} + ~~~~~~~~~~~~~~~~~~=> Pos: (342 to 359) SpanInfo: {"start":364,"length":14} >return foo(40) >:=> (line 22, col 4) to (line 22, col 18) -------------------------------- 22 > return foo(40); - ~~~~~~~~~~ => Pos: (360 to 369) SpanInfo: {"start":364,"length":14} + ~~~~~~~~~~~~~~~~~~~~ => Pos: (360 to 379) SpanInfo: {"start":364,"length":14} >return foo(40) >:=> (line 22, col 4) to (line 22, col 18) -22 > return foo(40); - - ~~~~~~~~~~ => Pos: (370 to 379) SpanInfo: {"start":371,"length":7} - >foo(40) - >:=> (line 22, col 11) to (line 22, col 18) -------------------------------- 23 >})()); - ~ => Pos: (380 to 380) SpanInfo: {"start":380,"length":1} + ~~~~~~~ => Pos: (380 to 386) SpanInfo: {"start":380,"length":1} >} >:=> (line 23, col 0) to (line 23, col 1) -23 >})()); - - ~~~ => Pos: (381 to 383) SpanInfo: {"start":342,"length":42} - >(function bar() { - > return foo(40); - >})() - >:=> (line 21, col 33) to (line 23, col 4) -23 >})()); - - ~~~ => Pos: (384 to 386) SpanInfo: {"start":330,"length":55} - >new greeter((function bar() { - > return foo(40); - >})()) - >:=> (line 21, col 21) to (line 23, col 5) -------------------------------- 24 >anotherGreeter = new greeter(30); - ~~~~~~~~~~~~~~~~ => Pos: (387 to 402) SpanInfo: {"start":387,"length":32} + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (387 to 420) SpanInfo: {"start":387,"length":32} >anotherGreeter = new greeter(30) >:=> (line 24, col 0) to (line 24, col 32) -24 >anotherGreeter = new greeter(30); - - ~~~~~~~~~~~~~~~~~~ => Pos: (403 to 420) SpanInfo: {"start":404,"length":15} - >new greeter(30) - >:=> (line 24, col 17) to (line 24, col 32) -------------------------------- 25 >anotherGreeter = new greeter(40 + y); - ~~~~~~~~~~~~~~~~ => Pos: (421 to 436) SpanInfo: {"start":421,"length":36} + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (421 to 458) SpanInfo: {"start":421,"length":36} >anotherGreeter = new greeter(40 + y) >:=> (line 25, col 0) to (line 25, col 36) -25 >anotherGreeter = new greeter(40 + y); - - ~~~~~~~~~~~~~~~~~~~~~~ => Pos: (437 to 458) SpanInfo: {"start":438,"length":19} - >new greeter(40 + y) - >:=> (line 25, col 17) to (line 25, col 36) -------------------------------- 26 >new greeter(30); @@ -343,22 +205,6 @@ >:=> (line 29, col 0) to (line 29, col 1) -------------------------------- 30 >foo2(foo(30), foo(40).toString()); - ~~~~~ => Pos: (537 to 541) SpanInfo: {"start":537,"length":33} - >foo2(foo(30), foo(40).toString()) - >:=> (line 30, col 0) to (line 30, col 33) -30 >foo2(foo(30), foo(40).toString()); - ~~~~~~~~ => Pos: (542 to 549) SpanInfo: {"start":542,"length":7} - >foo(30) - >:=> (line 30, col 5) to (line 30, col 12) -30 >foo2(foo(30), foo(40).toString()); - ~~~~~~~~ => Pos: (550 to 557) SpanInfo: {"start":551,"length":7} - >foo(40) - >:=> (line 30, col 14) to (line 30, col 21) -30 >foo2(foo(30), foo(40).toString()); - ~~~~~~~~~~~ => Pos: (558 to 568) SpanInfo: {"start":551,"length":18} - >foo(40).toString() - >:=> (line 30, col 14) to (line 30, col 32) -30 >foo2(foo(30), foo(40).toString()); - ~~ => Pos: (569 to 570) SpanInfo: {"start":537,"length":33} + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (537 to 570) SpanInfo: {"start":537,"length":33} >foo2(foo(30), foo(40).toString()) >:=> (line 30, col 0) to (line 30, col 33) \ No newline at end of file diff --git a/tests/baselines/reference/bpSpan_stmts.baseline b/tests/baselines/reference/bpSpan_stmts.baseline index 7f6bf21b40b..b818c9c9e30 100644 --- a/tests/baselines/reference/bpSpan_stmts.baseline +++ b/tests/baselines/reference/bpSpan_stmts.baseline @@ -278,14 +278,9 @@ -------------------------------- 37 > throw new Error(); - ~~~~~~~~~~~~~ => Pos: (549 to 561) SpanInfo: {"start":557,"length":17} + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (549 to 575) SpanInfo: {"start":557,"length":17} >throw new Error() >:=> (line 37, col 8) to (line 37, col 25) -37 > throw new Error(); - - ~~~~~~~~~~~~~~ => Pos: (562 to 575) SpanInfo: {"start":563,"length":11} - >new Error() - >:=> (line 37, col 14) to (line 37, col 25) -------------------------------- 38 > } catch (e1) { diff --git a/tests/baselines/reference/bpSpan_switch.baseline b/tests/baselines/reference/bpSpan_switch.baseline index c0e2259784d..7fde6067ed0 100644 --- a/tests/baselines/reference/bpSpan_switch.baseline +++ b/tests/baselines/reference/bpSpan_switch.baseline @@ -176,14 +176,7 @@ >:=> (line 29, col 0) to (line 31, col 5) 29 >switch ((function foo() { - ~ => Pos: (357 to 357) SpanInfo: {"start":357,"length":41} - >(function foo() { - > return x * 30; - >})() - >:=> (line 29, col 8) to (line 31, col 4) -29 >switch ((function foo() { - - ~~~~~~~~~~~~~~~~~ => Pos: (358 to 374) SpanInfo: {"start":379,"length":13} + ~~~~~~~~~~~~~~~~~~ => Pos: (357 to 374) SpanInfo: {"start":379,"length":13} >return x * 30 >:=> (line 30, col 4) to (line 30, col 17) -------------------------------- @@ -195,18 +188,11 @@ -------------------------------- 31 >})()) { - ~ => Pos: (394 to 394) SpanInfo: {"start":394,"length":1} + ~~~~ => Pos: (394 to 397) SpanInfo: {"start":394,"length":1} >} >:=> (line 31, col 0) to (line 31, col 1) 31 >})()) { - ~~~ => Pos: (395 to 397) SpanInfo: {"start":357,"length":41} - >(function foo() { - > return x * 30; - >})() - >:=> (line 29, col 8) to (line 31, col 4) -31 >})()) { - ~ => Pos: (398 to 398) SpanInfo: {"start":349,"length":50} >switch ((function foo() { > return x * 30; @@ -225,14 +211,7 @@ >:=> (line 35, col 8) to (line 35, col 11) 32 > case (function bar() { - ~~ => Pos: (410 to 411) SpanInfo: {"start":411,"length":45} - >(function bar() { - > return 30; - > })() - >:=> (line 32, col 9) to (line 34, col 8) -32 > case (function bar() { - - ~~~~~~~~~~~~~~~~~ => Pos: (412 to 428) SpanInfo: {"start":437,"length":9} + ~~~~~~~~~~~~~~~~~~~ => Pos: (410 to 428) SpanInfo: {"start":437,"length":9} >return 30 >:=> (line 33, col 8) to (line 33, col 17) -------------------------------- @@ -244,18 +223,11 @@ -------------------------------- 34 > })(): - ~~~~~ => Pos: (448 to 452) SpanInfo: {"start":452,"length":1} + ~~~~~~~~ => Pos: (448 to 455) SpanInfo: {"start":452,"length":1} >} >:=> (line 34, col 4) to (line 34, col 5) 34 > })(): - ~~~ => Pos: (453 to 455) SpanInfo: {"start":411,"length":45} - >(function bar() { - > return 30; - > })() - >:=> (line 32, col 9) to (line 34, col 8) -34 > })(): - ~~ => Pos: (456 to 457) SpanInfo: {"start":466,"length":3} >x++ >:=> (line 35, col 8) to (line 35, col 11) diff --git a/tests/baselines/reference/bpSpan_tryCatchFinally.baseline b/tests/baselines/reference/bpSpan_tryCatchFinally.baseline index e5465b8812c..c35683b6e53 100644 --- a/tests/baselines/reference/bpSpan_tryCatchFinally.baseline +++ b/tests/baselines/reference/bpSpan_tryCatchFinally.baseline @@ -85,14 +85,9 @@ -------------------------------- 12 > throw new Error(); - ~~~~~~~~~ => Pos: (113 to 121) SpanInfo: {"start":117,"length":17} + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (113 to 135) SpanInfo: {"start":117,"length":17} >throw new Error() >:=> (line 12, col 4) to (line 12, col 21) -12 > throw new Error(); - - ~~~~~~~~~~~~~~ => Pos: (122 to 135) SpanInfo: {"start":123,"length":11} - >new Error() - >:=> (line 12, col 10) to (line 12, col 21) -------------------------------- 13 >} @@ -173,45 +168,21 @@ >:=> (line 23, col 4) to (line 25, col 8) 23 > throw (function foo() { - ~~ => Pos: (210 to 211) SpanInfo: {"start":211,"length":59} - >(function foo() { - > new Error(x.toString()); - > })() - >:=> (line 23, col 10) to (line 25, col 8) -23 > throw (function foo() { - - ~~~~~~~~~~~~~~~~~ => Pos: (212 to 228) SpanInfo: {"start":237,"length":23} + ~~~~~~~~~~~~~~~~~~~ => Pos: (210 to 228) SpanInfo: {"start":237,"length":23} >new Error(x.toString()) >:=> (line 24, col 8) to (line 24, col 31) -------------------------------- 24 > new Error(x.toString()); - ~~~~~~~~~~~~~~~~~~ => Pos: (229 to 246) SpanInfo: {"start":237,"length":23} - >new Error(x.toString()) - >:=> (line 24, col 8) to (line 24, col 31) -24 > new Error(x.toString()); - - ~~~~~~~~~~~~ => Pos: (247 to 258) SpanInfo: {"start":247,"length":12} - >x.toString() - >:=> (line 24, col 18) to (line 24, col 30) -24 > new Error(x.toString()); - - ~~~ => Pos: (259 to 261) SpanInfo: {"start":237,"length":23} + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (229 to 261) SpanInfo: {"start":237,"length":23} >new Error(x.toString()) >:=> (line 24, col 8) to (line 24, col 31) -------------------------------- 25 > })(); - ~~~~~ => Pos: (262 to 266) SpanInfo: {"start":266,"length":1} + ~~~~~~~~~~ => Pos: (262 to 271) SpanInfo: {"start":266,"length":1} >} >:=> (line 25, col 4) to (line 25, col 5) -25 > })(); - - ~~~~~ => Pos: (267 to 271) SpanInfo: {"start":211,"length":59} - >(function foo() { - > new Error(x.toString()); - > })() - >:=> (line 23, col 10) to (line 25, col 8) -------------------------------- 26 >} diff --git a/tests/baselines/reference/bpSpan_typeAssertionExpressions.baseline b/tests/baselines/reference/bpSpan_typeAssertionExpressions.baseline index c04ddb8503b..9a15f782081 100644 --- a/tests/baselines/reference/bpSpan_typeAssertionExpressions.baseline +++ b/tests/baselines/reference/bpSpan_typeAssertionExpressions.baseline @@ -14,28 +14,13 @@ -------------------------------- 3 >var a = new Greeter(); - ~~~~~~~ => Pos: (18 to 24) SpanInfo: {"start":18,"length":30} + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (18 to 49) SpanInfo: {"start":18,"length":30} >var a = new Greeter() >:=> (line 3, col 0) to (line 3, col 30) -3 >var a = new Greeter(); - - ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (25 to 49) SpanInfo: {"start":35,"length":13} - >new Greeter() - >:=> (line 3, col 17) to (line 3, col 30) -------------------------------- 4 >a = ( new Greeter()); - ~~~~~ => Pos: (50 to 54) SpanInfo: {"start":50,"length":29} - >a = ( new Greeter()) - >:=> (line 4, col 0) to (line 4, col 29) -4 >a = ( new Greeter()); - - ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (55 to 77) SpanInfo: {"start":65,"length":13} - >new Greeter() - >:=> (line 4, col 15) to (line 4, col 28) -4 >a = ( new Greeter()); - - ~~~ => Pos: (78 to 80) SpanInfo: {"start":50,"length":29} + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (50 to 80) SpanInfo: {"start":50,"length":29} >a = ( new Greeter()) >:=> (line 4, col 0) to (line 4, col 29) -------------------------------- @@ -48,35 +33,17 @@ >:=> (line 5, col 0) to (line 7, col 4) 5 >a = (function foo() { - ~~~~~~~~~~~ => Pos: (84 to 94) SpanInfo: {"start":94,"length":48} - >(function foo() { - > return new Greeter(); - >})() - >:=> (line 5, col 13) to (line 7, col 4) -5 >a = (function foo() { - - ~~~~~~~~~~~~~~~~~ => Pos: (95 to 111) SpanInfo: {"start":116,"length":20} + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (84 to 111) SpanInfo: {"start":116,"length":20} >return new Greeter() >:=> (line 6, col 4) to (line 6, col 24) -------------------------------- 6 > return new Greeter(); - ~~~~~~~~~~ => Pos: (112 to 121) SpanInfo: {"start":116,"length":20} + ~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (112 to 137) SpanInfo: {"start":116,"length":20} >return new Greeter() >:=> (line 6, col 4) to (line 6, col 24) -6 > return new Greeter(); - - ~~~~~~~~~~~~~~~~ => Pos: (122 to 137) SpanInfo: {"start":123,"length":13} - >new Greeter() - >:=> (line 6, col 11) to (line 6, col 24) -------------------------------- 7 >})(); - ~ => Pos: (138 to 138) SpanInfo: {"start":138,"length":1} + ~~~~~ => Pos: (138 to 142) SpanInfo: {"start":138,"length":1} >} - >:=> (line 7, col 0) to (line 7, col 1) -7 >})(); - ~~~~ => Pos: (139 to 142) SpanInfo: {"start":94,"length":48} - >(function foo() { - > return new Greeter(); - >})() - >:=> (line 5, col 13) to (line 7, col 4) \ No newline at end of file + >:=> (line 7, col 0) to (line 7, col 1) \ No newline at end of file diff --git a/tests/baselines/reference/bpSpan_typealias.baseline b/tests/baselines/reference/bpSpan_typealias.baseline index 88e60b55e47..80e654ad2f3 100644 --- a/tests/baselines/reference/bpSpan_typealias.baseline +++ b/tests/baselines/reference/bpSpan_typealias.baseline @@ -52,25 +52,15 @@ -------------------------------- 8 > var x: a = new m.c(); - ~~~~~~~~~~~~~~ => Pos: (111 to 124) SpanInfo: {"start":115,"length":20} + ~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (111 to 136) SpanInfo: {"start":115,"length":20} >var x: a = new m.c() >:=> (line 8, col 4) to (line 8, col 24) -8 > var x: a = new m.c(); - - ~~~~~~~~~~~~ => Pos: (125 to 136) SpanInfo: {"start":126,"length":9} - >new m.c() - >:=> (line 8, col 15) to (line 8, col 24) -------------------------------- 9 > var y: b = new m.c(); - ~~~~~~~~~~~~~~ => Pos: (137 to 150) SpanInfo: {"start":141,"length":20} + ~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (137 to 162) SpanInfo: {"start":141,"length":20} >var y: b = new m.c() >:=> (line 9, col 4) to (line 9, col 24) -9 > var y: b = new m.c(); - - ~~~~~~~~~~~~ => Pos: (151 to 162) SpanInfo: {"start":152,"length":9} - >new m.c() - >:=> (line 9, col 15) to (line 9, col 24) -------------------------------- 10 >} ~ => Pos: (163 to 163) SpanInfo: {"start":163,"length":1} diff --git a/tests/baselines/reference/bpSpan_unaryExpressions.baseline b/tests/baselines/reference/bpSpan_unaryExpressions.baseline index 2ad1191cf95..e0433bf5fad 100644 --- a/tests/baselines/reference/bpSpan_unaryExpressions.baseline +++ b/tests/baselines/reference/bpSpan_unaryExpressions.baseline @@ -32,14 +32,7 @@ >:=> (line 5, col 0) to (line 7, col 4) 5 >typeof (function foo() { - ~~ => Pos: (40 to 41) SpanInfo: {"start":41,"length":36} - >(function foo() { - > return y; - >})() - >:=> (line 5, col 7) to (line 7, col 4) -5 >typeof (function foo() { - - ~~~~~~~~~~~~~~~~~ => Pos: (42 to 58) SpanInfo: {"start":63,"length":8} + ~~~~~~~~~~~~~~~~~~~ => Pos: (40 to 58) SpanInfo: {"start":63,"length":8} >return y >:=> (line 6, col 4) to (line 6, col 12) -------------------------------- @@ -51,16 +44,9 @@ -------------------------------- 7 >})(); - ~ => Pos: (73 to 73) SpanInfo: {"start":73,"length":1} + ~~~~~~ => Pos: (73 to 78) SpanInfo: {"start":73,"length":1} >} >:=> (line 7, col 0) to (line 7, col 1) -7 >})(); - - ~~~~~ => Pos: (74 to 78) SpanInfo: {"start":41,"length":36} - >(function foo() { - > return y; - >})() - >:=> (line 5, col 7) to (line 7, col 4) -------------------------------- 8 >++x; diff --git a/tests/baselines/reference/bpSpan_while.baseline b/tests/baselines/reference/bpSpan_while.baseline index 91632b78009..464a736447a 100644 --- a/tests/baselines/reference/bpSpan_while.baseline +++ b/tests/baselines/reference/bpSpan_while.baseline @@ -79,14 +79,7 @@ >:=> (line 12, col 0) to (line 14, col 11) 12 >while ((function () { - ~ => Pos: (126 to 126) SpanInfo: {"start":126,"length":38} - >(function () { - > return 30 * a; - >})() - >:=> (line 12, col 7) to (line 14, col 4) -12 >while ((function () { - - ~~~~~~~~~~~~~~ => Pos: (127 to 140) SpanInfo: {"start":145,"length":13} + ~~~~~~~~~~~~~~~ => Pos: (126 to 140) SpanInfo: {"start":145,"length":13} >return 30 * a >:=> (line 13, col 4) to (line 13, col 17) -------------------------------- @@ -98,18 +91,11 @@ -------------------------------- 14 >})() !== a) { - ~ => Pos: (160 to 160) SpanInfo: {"start":160,"length":1} + ~~~~ => Pos: (160 to 163) SpanInfo: {"start":160,"length":1} >} >:=> (line 14, col 0) to (line 14, col 1) 14 >})() !== a) { - ~~~ => Pos: (161 to 163) SpanInfo: {"start":126,"length":38} - >(function () { - > return 30 * a; - >})() - >:=> (line 12, col 7) to (line 14, col 4) -14 >})() !== a) { - ~~~~~~~ => Pos: (164 to 170) SpanInfo: {"start":119,"length":52} >while ((function () { > return 30 * a; diff --git a/tests/baselines/reference/callGenericFunctionWithZeroTypeArguments.symbols b/tests/baselines/reference/callGenericFunctionWithZeroTypeArguments.symbols index 107650c530e..83f18f2d41d 100644 --- a/tests/baselines/reference/callGenericFunctionWithZeroTypeArguments.symbols +++ b/tests/baselines/reference/callGenericFunctionWithZeroTypeArguments.symbols @@ -38,7 +38,7 @@ class C { >C : Symbol(C, Decl(callGenericFunctionWithZeroTypeArguments.ts, 9, 15)) f(x: T): T { ->f : Symbol(f, Decl(callGenericFunctionWithZeroTypeArguments.ts, 11, 9)) +>f : Symbol(C.f, Decl(callGenericFunctionWithZeroTypeArguments.ts, 11, 9)) >T : Symbol(T, Decl(callGenericFunctionWithZeroTypeArguments.ts, 12, 6)) >x : Symbol(x, Decl(callGenericFunctionWithZeroTypeArguments.ts, 12, 9)) >T : Symbol(T, Decl(callGenericFunctionWithZeroTypeArguments.ts, 12, 6)) @@ -57,7 +57,7 @@ interface I { >I : Symbol(I, Decl(callGenericFunctionWithZeroTypeArguments.ts, 16, 24)) f(x: T): T; ->f : Symbol(f, Decl(callGenericFunctionWithZeroTypeArguments.ts, 18, 13)) +>f : Symbol(I.f, Decl(callGenericFunctionWithZeroTypeArguments.ts, 18, 13)) >T : Symbol(T, Decl(callGenericFunctionWithZeroTypeArguments.ts, 19, 6)) >x : Symbol(x, Decl(callGenericFunctionWithZeroTypeArguments.ts, 19, 9)) >T : Symbol(T, Decl(callGenericFunctionWithZeroTypeArguments.ts, 19, 6)) @@ -78,7 +78,7 @@ class C2 { >T : Symbol(T, Decl(callGenericFunctionWithZeroTypeArguments.ts, 24, 9)) f(x: T): T { ->f : Symbol(f, Decl(callGenericFunctionWithZeroTypeArguments.ts, 24, 13)) +>f : Symbol(C2.f, Decl(callGenericFunctionWithZeroTypeArguments.ts, 24, 13)) >x : Symbol(x, Decl(callGenericFunctionWithZeroTypeArguments.ts, 25, 6)) >T : Symbol(T, Decl(callGenericFunctionWithZeroTypeArguments.ts, 24, 9)) >T : Symbol(T, Decl(callGenericFunctionWithZeroTypeArguments.ts, 24, 9)) @@ -97,7 +97,7 @@ interface I2 { >T : Symbol(T, Decl(callGenericFunctionWithZeroTypeArguments.ts, 31, 13)) f(x: T): T; ->f : Symbol(f, Decl(callGenericFunctionWithZeroTypeArguments.ts, 31, 17)) +>f : Symbol(I2.f, Decl(callGenericFunctionWithZeroTypeArguments.ts, 31, 17)) >x : Symbol(x, Decl(callGenericFunctionWithZeroTypeArguments.ts, 32, 6)) >T : Symbol(T, Decl(callGenericFunctionWithZeroTypeArguments.ts, 31, 13)) >T : Symbol(T, Decl(callGenericFunctionWithZeroTypeArguments.ts, 31, 13)) diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance2.symbols b/tests/baselines/reference/callSignatureAssignabilityInInheritance2.symbols index 12bc165575b..f1fa53d7b6c 100644 --- a/tests/baselines/reference/callSignatureAssignabilityInInheritance2.symbols +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance2.symbols @@ -3,51 +3,51 @@ class Base { foo: string; } >Base : Symbol(Base, Decl(callSignatureAssignabilityInInheritance2.ts, 0, 0)) ->foo : Symbol(foo, Decl(callSignatureAssignabilityInInheritance2.ts, 2, 12)) +>foo : Symbol(Base.foo, Decl(callSignatureAssignabilityInInheritance2.ts, 2, 12)) class Derived extends Base { bar: string; } >Derived : Symbol(Derived, Decl(callSignatureAssignabilityInInheritance2.ts, 2, 27)) >Base : Symbol(Base, Decl(callSignatureAssignabilityInInheritance2.ts, 0, 0)) ->bar : Symbol(bar, Decl(callSignatureAssignabilityInInheritance2.ts, 3, 28)) +>bar : Symbol(Derived.bar, Decl(callSignatureAssignabilityInInheritance2.ts, 3, 28)) class Derived2 extends Derived { baz: string; } >Derived2 : Symbol(Derived2, Decl(callSignatureAssignabilityInInheritance2.ts, 3, 43)) >Derived : Symbol(Derived, Decl(callSignatureAssignabilityInInheritance2.ts, 2, 27)) ->baz : Symbol(baz, Decl(callSignatureAssignabilityInInheritance2.ts, 4, 32)) +>baz : Symbol(Derived2.baz, Decl(callSignatureAssignabilityInInheritance2.ts, 4, 32)) class OtherDerived extends Base { bing: string; } >OtherDerived : Symbol(OtherDerived, Decl(callSignatureAssignabilityInInheritance2.ts, 4, 47)) >Base : Symbol(Base, Decl(callSignatureAssignabilityInInheritance2.ts, 0, 0)) ->bing : Symbol(bing, Decl(callSignatureAssignabilityInInheritance2.ts, 5, 33)) +>bing : Symbol(OtherDerived.bing, Decl(callSignatureAssignabilityInInheritance2.ts, 5, 33)) interface A { // T >A : Symbol(A, Decl(callSignatureAssignabilityInInheritance2.ts, 5, 49)) // M's a: (x: number) => number[]; ->a : Symbol(a, Decl(callSignatureAssignabilityInInheritance2.ts, 7, 13)) +>a : Symbol(A.a, Decl(callSignatureAssignabilityInInheritance2.ts, 7, 13)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance2.ts, 9, 8)) a2: (x: number) => string[]; ->a2 : Symbol(a2, Decl(callSignatureAssignabilityInInheritance2.ts, 9, 31)) +>a2 : Symbol(A.a2, Decl(callSignatureAssignabilityInInheritance2.ts, 9, 31)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance2.ts, 10, 9)) a3: (x: number) => void; ->a3 : Symbol(a3, Decl(callSignatureAssignabilityInInheritance2.ts, 10, 32)) +>a3 : Symbol(A.a3, Decl(callSignatureAssignabilityInInheritance2.ts, 10, 32)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance2.ts, 11, 9)) a4: (x: string, y: number) => string; ->a4 : Symbol(a4, Decl(callSignatureAssignabilityInInheritance2.ts, 11, 28)) +>a4 : Symbol(A.a4, Decl(callSignatureAssignabilityInInheritance2.ts, 11, 28)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance2.ts, 12, 9)) >y : Symbol(y, Decl(callSignatureAssignabilityInInheritance2.ts, 12, 19)) a5: (x: (arg: string) => number) => string; ->a5 : Symbol(a5, Decl(callSignatureAssignabilityInInheritance2.ts, 12, 41)) +>a5 : Symbol(A.a5, Decl(callSignatureAssignabilityInInheritance2.ts, 12, 41)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance2.ts, 13, 9)) >arg : Symbol(arg, Decl(callSignatureAssignabilityInInheritance2.ts, 13, 13)) a6: (x: (arg: Base) => Derived) => Base; ->a6 : Symbol(a6, Decl(callSignatureAssignabilityInInheritance2.ts, 13, 47)) +>a6 : Symbol(A.a6, Decl(callSignatureAssignabilityInInheritance2.ts, 13, 47)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance2.ts, 14, 9)) >arg : Symbol(arg, Decl(callSignatureAssignabilityInInheritance2.ts, 14, 13)) >Base : Symbol(Base, Decl(callSignatureAssignabilityInInheritance2.ts, 0, 0)) @@ -55,7 +55,7 @@ interface A { // T >Base : Symbol(Base, Decl(callSignatureAssignabilityInInheritance2.ts, 0, 0)) a7: (x: (arg: Base) => Derived) => (r: Base) => Derived; ->a7 : Symbol(a7, Decl(callSignatureAssignabilityInInheritance2.ts, 14, 44)) +>a7 : Symbol(A.a7, Decl(callSignatureAssignabilityInInheritance2.ts, 14, 44)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance2.ts, 15, 9)) >arg : Symbol(arg, Decl(callSignatureAssignabilityInInheritance2.ts, 15, 13)) >Base : Symbol(Base, Decl(callSignatureAssignabilityInInheritance2.ts, 0, 0)) @@ -65,7 +65,7 @@ interface A { // T >Derived : Symbol(Derived, Decl(callSignatureAssignabilityInInheritance2.ts, 2, 27)) a8: (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived; ->a8 : Symbol(a8, Decl(callSignatureAssignabilityInInheritance2.ts, 15, 60)) +>a8 : Symbol(A.a8, Decl(callSignatureAssignabilityInInheritance2.ts, 15, 60)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance2.ts, 16, 9)) >arg : Symbol(arg, Decl(callSignatureAssignabilityInInheritance2.ts, 16, 13)) >Base : Symbol(Base, Decl(callSignatureAssignabilityInInheritance2.ts, 0, 0)) @@ -79,7 +79,7 @@ interface A { // T >Derived : Symbol(Derived, Decl(callSignatureAssignabilityInInheritance2.ts, 2, 27)) a9: (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived; ->a9 : Symbol(a9, Decl(callSignatureAssignabilityInInheritance2.ts, 16, 88)) +>a9 : Symbol(A.a9, Decl(callSignatureAssignabilityInInheritance2.ts, 16, 88)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance2.ts, 17, 9)) >arg : Symbol(arg, Decl(callSignatureAssignabilityInInheritance2.ts, 17, 13)) >Base : Symbol(Base, Decl(callSignatureAssignabilityInInheritance2.ts, 0, 0)) @@ -93,13 +93,13 @@ interface A { // T >Derived : Symbol(Derived, Decl(callSignatureAssignabilityInInheritance2.ts, 2, 27)) a10: (...x: Derived[]) => Derived; ->a10 : Symbol(a10, Decl(callSignatureAssignabilityInInheritance2.ts, 17, 88)) +>a10 : Symbol(A.a10, Decl(callSignatureAssignabilityInInheritance2.ts, 17, 88)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance2.ts, 18, 10)) >Derived : Symbol(Derived, Decl(callSignatureAssignabilityInInheritance2.ts, 2, 27)) >Derived : Symbol(Derived, Decl(callSignatureAssignabilityInInheritance2.ts, 2, 27)) a11: (x: { foo: string }, y: { foo: string; bar: string }) => Base; ->a11 : Symbol(a11, Decl(callSignatureAssignabilityInInheritance2.ts, 18, 38)) +>a11 : Symbol(A.a11, Decl(callSignatureAssignabilityInInheritance2.ts, 18, 38)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance2.ts, 19, 10)) >foo : Symbol(foo, Decl(callSignatureAssignabilityInInheritance2.ts, 19, 14)) >y : Symbol(y, Decl(callSignatureAssignabilityInInheritance2.ts, 19, 29)) @@ -108,7 +108,7 @@ interface A { // T >Base : Symbol(Base, Decl(callSignatureAssignabilityInInheritance2.ts, 0, 0)) a12: (x: Array, y: Array) => Array; ->a12 : Symbol(a12, Decl(callSignatureAssignabilityInInheritance2.ts, 19, 71)) +>a12 : Symbol(A.a12, Decl(callSignatureAssignabilityInInheritance2.ts, 19, 71)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance2.ts, 20, 10)) >Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >Base : Symbol(Base, Decl(callSignatureAssignabilityInInheritance2.ts, 0, 0)) @@ -119,7 +119,7 @@ interface A { // T >Derived : Symbol(Derived, Decl(callSignatureAssignabilityInInheritance2.ts, 2, 27)) a13: (x: Array, y: Array) => Array; ->a13 : Symbol(a13, Decl(callSignatureAssignabilityInInheritance2.ts, 20, 64)) +>a13 : Symbol(A.a13, Decl(callSignatureAssignabilityInInheritance2.ts, 20, 64)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance2.ts, 21, 10)) >Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >Base : Symbol(Base, Decl(callSignatureAssignabilityInInheritance2.ts, 0, 0)) @@ -130,14 +130,14 @@ interface A { // T >Derived : Symbol(Derived, Decl(callSignatureAssignabilityInInheritance2.ts, 2, 27)) a14: (x: { a: string; b: number }) => Object; ->a14 : Symbol(a14, Decl(callSignatureAssignabilityInInheritance2.ts, 21, 63)) +>a14 : Symbol(A.a14, Decl(callSignatureAssignabilityInInheritance2.ts, 21, 63)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance2.ts, 22, 10)) >a : Symbol(a, Decl(callSignatureAssignabilityInInheritance2.ts, 22, 14)) >b : Symbol(b, Decl(callSignatureAssignabilityInInheritance2.ts, 22, 25)) >Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) a15: { ->a15 : Symbol(a15, Decl(callSignatureAssignabilityInInheritance2.ts, 22, 49)) +>a15 : Symbol(A.a15, Decl(callSignatureAssignabilityInInheritance2.ts, 22, 49)) (x: number): number[]; >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance2.ts, 24, 9)) @@ -147,7 +147,7 @@ interface A { // T }; a16: { ->a16 : Symbol(a16, Decl(callSignatureAssignabilityInInheritance2.ts, 26, 6)) +>a16 : Symbol(A.a16, Decl(callSignatureAssignabilityInInheritance2.ts, 26, 6)) (x: T): number[]; >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance2.ts, 28, 9)) @@ -163,7 +163,7 @@ interface A { // T }; a17: { ->a17 : Symbol(a17, Decl(callSignatureAssignabilityInInheritance2.ts, 30, 6)) +>a17 : Symbol(A.a17, Decl(callSignatureAssignabilityInInheritance2.ts, 30, 6)) (x: (a: number) => number): number[]; >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance2.ts, 32, 9)) @@ -175,7 +175,7 @@ interface A { // T }; a18: { ->a18 : Symbol(a18, Decl(callSignatureAssignabilityInInheritance2.ts, 34, 6)) +>a18 : Symbol(A.a18, Decl(callSignatureAssignabilityInInheritance2.ts, 34, 6)) (x: { >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance2.ts, 36, 9)) @@ -195,8 +195,8 @@ interface A { // T (a: Date): Date; >a : Symbol(a, Decl(callSignatureAssignabilityInInheritance2.ts, 42, 13)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) }): any[]; }; @@ -209,27 +209,27 @@ interface I extends A { // N's a: (x: T) => T[]; // ok, instantiation of N is a subtype of M, T is number ->a : Symbol(a, Decl(callSignatureAssignabilityInInheritance2.ts, 48, 23)) +>a : Symbol(I.a, Decl(callSignatureAssignabilityInInheritance2.ts, 48, 23)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance2.ts, 50, 8)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance2.ts, 50, 11)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance2.ts, 50, 8)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance2.ts, 50, 8)) a2: (x: T) => string[]; // ok ->a2 : Symbol(a2, Decl(callSignatureAssignabilityInInheritance2.ts, 50, 24)) +>a2 : Symbol(I.a2, Decl(callSignatureAssignabilityInInheritance2.ts, 50, 24)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance2.ts, 51, 9)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance2.ts, 51, 12)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance2.ts, 51, 9)) a3: (x: T) => T; // ok since Base returns void ->a3 : Symbol(a3, Decl(callSignatureAssignabilityInInheritance2.ts, 51, 30)) +>a3 : Symbol(I.a3, Decl(callSignatureAssignabilityInInheritance2.ts, 51, 30)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance2.ts, 52, 9)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance2.ts, 52, 12)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance2.ts, 52, 9)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance2.ts, 52, 9)) a4: (x: T, y: U) => T; // ok, instantiation of N is a subtype of M, T is string, U is number ->a4 : Symbol(a4, Decl(callSignatureAssignabilityInInheritance2.ts, 52, 23)) +>a4 : Symbol(I.a4, Decl(callSignatureAssignabilityInInheritance2.ts, 52, 23)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance2.ts, 53, 9)) >U : Symbol(U, Decl(callSignatureAssignabilityInInheritance2.ts, 53, 11)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance2.ts, 53, 15)) @@ -239,7 +239,7 @@ interface I extends A { >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance2.ts, 53, 9)) a5: (x: (arg: T) => U) => T; // ok, U is in a parameter position so inferences can be made ->a5 : Symbol(a5, Decl(callSignatureAssignabilityInInheritance2.ts, 53, 32)) +>a5 : Symbol(I.a5, Decl(callSignatureAssignabilityInInheritance2.ts, 53, 32)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance2.ts, 54, 9)) >U : Symbol(U, Decl(callSignatureAssignabilityInInheritance2.ts, 54, 11)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance2.ts, 54, 15)) @@ -249,7 +249,7 @@ interface I extends A { >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance2.ts, 54, 9)) a6: (x: (arg: T) => U) => T; // ok, same as a5 but with object type hierarchy ->a6 : Symbol(a6, Decl(callSignatureAssignabilityInInheritance2.ts, 54, 38)) +>a6 : Symbol(I.a6, Decl(callSignatureAssignabilityInInheritance2.ts, 54, 38)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance2.ts, 55, 9)) >Base : Symbol(Base, Decl(callSignatureAssignabilityInInheritance2.ts, 0, 0)) >U : Symbol(U, Decl(callSignatureAssignabilityInInheritance2.ts, 55, 24)) @@ -261,7 +261,7 @@ interface I extends A { >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance2.ts, 55, 9)) a7: (x: (arg: T) => U) => (r: T) => U; // ok ->a7 : Symbol(a7, Decl(callSignatureAssignabilityInInheritance2.ts, 55, 67)) +>a7 : Symbol(I.a7, Decl(callSignatureAssignabilityInInheritance2.ts, 55, 67)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance2.ts, 56, 9)) >Base : Symbol(Base, Decl(callSignatureAssignabilityInInheritance2.ts, 0, 0)) >U : Symbol(U, Decl(callSignatureAssignabilityInInheritance2.ts, 56, 24)) @@ -275,7 +275,7 @@ interface I extends A { >U : Symbol(U, Decl(callSignatureAssignabilityInInheritance2.ts, 56, 24)) a8: (x: (arg: T) => U, y: (arg2: T) => U) => (r: T) => U; // ok ->a8 : Symbol(a8, Decl(callSignatureAssignabilityInInheritance2.ts, 56, 77)) +>a8 : Symbol(I.a8, Decl(callSignatureAssignabilityInInheritance2.ts, 56, 77)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance2.ts, 57, 9)) >Base : Symbol(Base, Decl(callSignatureAssignabilityInInheritance2.ts, 0, 0)) >U : Symbol(U, Decl(callSignatureAssignabilityInInheritance2.ts, 57, 24)) @@ -293,7 +293,7 @@ interface I extends A { >U : Symbol(U, Decl(callSignatureAssignabilityInInheritance2.ts, 57, 24)) a9: (x: (arg: T) => U, y: (arg2: { foo: string; bing: number }) => U) => (r: T) => U; // ok, same as a8 with compatible object literal ->a9 : Symbol(a9, Decl(callSignatureAssignabilityInInheritance2.ts, 57, 96)) +>a9 : Symbol(I.a9, Decl(callSignatureAssignabilityInInheritance2.ts, 57, 96)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance2.ts, 58, 9)) >Base : Symbol(Base, Decl(callSignatureAssignabilityInInheritance2.ts, 0, 0)) >U : Symbol(U, Decl(callSignatureAssignabilityInInheritance2.ts, 58, 24)) @@ -312,7 +312,7 @@ interface I extends A { >U : Symbol(U, Decl(callSignatureAssignabilityInInheritance2.ts, 58, 24)) a10: (...x: T[]) => T; // ok ->a10 : Symbol(a10, Decl(callSignatureAssignabilityInInheritance2.ts, 58, 124)) +>a10 : Symbol(I.a10, Decl(callSignatureAssignabilityInInheritance2.ts, 58, 124)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance2.ts, 59, 10)) >Derived : Symbol(Derived, Decl(callSignatureAssignabilityInInheritance2.ts, 2, 27)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance2.ts, 59, 29)) @@ -320,7 +320,7 @@ interface I extends A { >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance2.ts, 59, 10)) a11: (x: T, y: T) => T; // ok ->a11 : Symbol(a11, Decl(callSignatureAssignabilityInInheritance2.ts, 59, 45)) +>a11 : Symbol(I.a11, Decl(callSignatureAssignabilityInInheritance2.ts, 59, 45)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance2.ts, 60, 10)) >Base : Symbol(Base, Decl(callSignatureAssignabilityInInheritance2.ts, 0, 0)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance2.ts, 60, 26)) @@ -330,7 +330,7 @@ interface I extends A { >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance2.ts, 60, 10)) a12: >(x: Array, y: T) => Array; // ok, less specific parameter type ->a12 : Symbol(a12, Decl(callSignatureAssignabilityInInheritance2.ts, 60, 43)) +>a12 : Symbol(I.a12, Decl(callSignatureAssignabilityInInheritance2.ts, 60, 43)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance2.ts, 61, 10)) >Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >Base : Symbol(Base, Decl(callSignatureAssignabilityInInheritance2.ts, 0, 0)) @@ -343,7 +343,7 @@ interface I extends A { >Derived : Symbol(Derived, Decl(callSignatureAssignabilityInInheritance2.ts, 2, 27)) a13: >(x: Array, y: T) => T; // ok, T = Array, satisfies constraint, contextual signature instantiation succeeds ->a13 : Symbol(a13, Decl(callSignatureAssignabilityInInheritance2.ts, 61, 73)) +>a13 : Symbol(I.a13, Decl(callSignatureAssignabilityInInheritance2.ts, 61, 73)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance2.ts, 62, 10)) >Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >Derived : Symbol(Derived, Decl(callSignatureAssignabilityInInheritance2.ts, 2, 27)) @@ -355,7 +355,7 @@ interface I extends A { >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance2.ts, 62, 10)) a14: (x: { a: T; b: T }) => T; // ok, best common type yields T = {} but that's satisfactory for this signature ->a14 : Symbol(a14, Decl(callSignatureAssignabilityInInheritance2.ts, 62, 63)) +>a14 : Symbol(I.a14, Decl(callSignatureAssignabilityInInheritance2.ts, 62, 63)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance2.ts, 63, 10)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance2.ts, 63, 13)) >a : Symbol(a, Decl(callSignatureAssignabilityInInheritance2.ts, 63, 17)) @@ -365,21 +365,21 @@ interface I extends A { >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance2.ts, 63, 10)) a15: (x: T) => T[]; // ok ->a15 : Symbol(a15, Decl(callSignatureAssignabilityInInheritance2.ts, 63, 37)) +>a15 : Symbol(I.a15, Decl(callSignatureAssignabilityInInheritance2.ts, 63, 37)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance2.ts, 64, 10)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance2.ts, 64, 13)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance2.ts, 64, 10)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance2.ts, 64, 10)) a16: (x: T) => number[]; // ok ->a16 : Symbol(a16, Decl(callSignatureAssignabilityInInheritance2.ts, 64, 26)) +>a16 : Symbol(I.a16, Decl(callSignatureAssignabilityInInheritance2.ts, 64, 26)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance2.ts, 65, 10)) >Base : Symbol(Base, Decl(callSignatureAssignabilityInInheritance2.ts, 0, 0)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance2.ts, 65, 26)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance2.ts, 65, 10)) a17: (x: (a: T) => T) => T[]; // ok ->a17 : Symbol(a17, Decl(callSignatureAssignabilityInInheritance2.ts, 65, 44)) +>a17 : Symbol(I.a17, Decl(callSignatureAssignabilityInInheritance2.ts, 65, 44)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance2.ts, 66, 10)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance2.ts, 66, 13)) >a : Symbol(a, Decl(callSignatureAssignabilityInInheritance2.ts, 66, 17)) @@ -388,7 +388,7 @@ interface I extends A { >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance2.ts, 66, 10)) a18: (x: (a: T) => T) => T[]; // ok, no inferences for T but assignable to any ->a18 : Symbol(a18, Decl(callSignatureAssignabilityInInheritance2.ts, 66, 36)) +>a18 : Symbol(I.a18, Decl(callSignatureAssignabilityInInheritance2.ts, 66, 36)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance2.ts, 67, 10)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance2.ts, 67, 13)) >a : Symbol(a, Decl(callSignatureAssignabilityInInheritance2.ts, 67, 17)) diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance3.errors.txt b/tests/baselines/reference/callSignatureAssignabilityInInheritance3.errors.txt index 7e9d75b1b41..2d7e795d26a 100644 --- a/tests/baselines/reference/callSignatureAssignabilityInInheritance3.errors.txt +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance3.errors.txt @@ -2,12 +2,12 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSign Types of property 'a2' are incompatible. Type '(x: T) => U[]' is not assignable to type '(x: number) => string[]'. Types of parameters 'x' and 'x' are incompatible. - Type 'T' is not assignable to type 'number'. + Type 'number' is not assignable to type 'T'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSignatureAssignabilityInInheritance3.ts(60,19): error TS2430: Interface 'I4' incorrectly extends interface 'A'. Types of property 'a8' are incompatible. Type '(x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U' is not assignable to type '(x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived'. Types of parameters 'y' and 'y' are incompatible. - Type '(arg2: { foo: number; }) => any' is not assignable to type '(arg2: Base) => Derived'. + Type '(arg2: Base) => Derived' is not assignable to type '(arg2: { foo: number; }) => any'. Types of parameters 'arg2' and 'arg2' are incompatible. Type '{ foo: number; }' is not assignable to type 'Base'. Types of property 'foo' are incompatible. @@ -71,7 +71,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSign !!! error TS2430: Types of property 'a2' are incompatible. !!! error TS2430: Type '(x: T) => U[]' is not assignable to type '(x: number) => string[]'. !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2430: Type 'T' is not assignable to type 'number'. +!!! error TS2430: Type 'number' is not assignable to type 'T'. a2: (x: T) => U[]; // error, no contextual signature instantiation since I2.a2 is not generic } @@ -86,7 +86,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSign !!! error TS2430: Types of property 'a8' are incompatible. !!! error TS2430: Type '(x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U' is not assignable to type '(x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived'. !!! error TS2430: Types of parameters 'y' and 'y' are incompatible. -!!! error TS2430: Type '(arg2: { foo: number; }) => any' is not assignable to type '(arg2: Base) => Derived'. +!!! error TS2430: Type '(arg2: Base) => Derived' is not assignable to type '(arg2: { foo: number; }) => any'. !!! error TS2430: Types of parameters 'arg2' and 'arg2' are incompatible. !!! error TS2430: Type '{ foo: number; }' is not assignable to type 'Base'. !!! error TS2430: Types of property 'foo' are incompatible. diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance4.symbols b/tests/baselines/reference/callSignatureAssignabilityInInheritance4.symbols index f45d7f318d2..4261483f451 100644 --- a/tests/baselines/reference/callSignatureAssignabilityInInheritance4.symbols +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance4.symbols @@ -3,48 +3,48 @@ class Base { foo: string; } >Base : Symbol(Base, Decl(callSignatureAssignabilityInInheritance4.ts, 0, 0)) ->foo : Symbol(foo, Decl(callSignatureAssignabilityInInheritance4.ts, 2, 12)) +>foo : Symbol(Base.foo, Decl(callSignatureAssignabilityInInheritance4.ts, 2, 12)) class Derived extends Base { bar: string; } >Derived : Symbol(Derived, Decl(callSignatureAssignabilityInInheritance4.ts, 2, 27)) >Base : Symbol(Base, Decl(callSignatureAssignabilityInInheritance4.ts, 0, 0)) ->bar : Symbol(bar, Decl(callSignatureAssignabilityInInheritance4.ts, 3, 28)) +>bar : Symbol(Derived.bar, Decl(callSignatureAssignabilityInInheritance4.ts, 3, 28)) class Derived2 extends Derived { baz: string; } >Derived2 : Symbol(Derived2, Decl(callSignatureAssignabilityInInheritance4.ts, 3, 43)) >Derived : Symbol(Derived, Decl(callSignatureAssignabilityInInheritance4.ts, 2, 27)) ->baz : Symbol(baz, Decl(callSignatureAssignabilityInInheritance4.ts, 4, 32)) +>baz : Symbol(Derived2.baz, Decl(callSignatureAssignabilityInInheritance4.ts, 4, 32)) class OtherDerived extends Base { bing: string; } >OtherDerived : Symbol(OtherDerived, Decl(callSignatureAssignabilityInInheritance4.ts, 4, 47)) >Base : Symbol(Base, Decl(callSignatureAssignabilityInInheritance4.ts, 0, 0)) ->bing : Symbol(bing, Decl(callSignatureAssignabilityInInheritance4.ts, 5, 33)) +>bing : Symbol(OtherDerived.bing, Decl(callSignatureAssignabilityInInheritance4.ts, 5, 33)) interface A { // T >A : Symbol(A, Decl(callSignatureAssignabilityInInheritance4.ts, 5, 49)) // M's a: (x: T) => T[]; ->a : Symbol(a, Decl(callSignatureAssignabilityInInheritance4.ts, 7, 13)) +>a : Symbol(A.a, Decl(callSignatureAssignabilityInInheritance4.ts, 7, 13)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance4.ts, 9, 8)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance4.ts, 9, 11)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance4.ts, 9, 8)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance4.ts, 9, 8)) a2: (x: T) => string[]; ->a2 : Symbol(a2, Decl(callSignatureAssignabilityInInheritance4.ts, 9, 24)) +>a2 : Symbol(A.a2, Decl(callSignatureAssignabilityInInheritance4.ts, 9, 24)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance4.ts, 10, 9)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance4.ts, 10, 12)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance4.ts, 10, 9)) a3: (x: T) => void; ->a3 : Symbol(a3, Decl(callSignatureAssignabilityInInheritance4.ts, 10, 30)) +>a3 : Symbol(A.a3, Decl(callSignatureAssignabilityInInheritance4.ts, 10, 30)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance4.ts, 11, 9)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance4.ts, 11, 12)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance4.ts, 11, 9)) a4: (x: T, y: U) => string; ->a4 : Symbol(a4, Decl(callSignatureAssignabilityInInheritance4.ts, 11, 26)) +>a4 : Symbol(A.a4, Decl(callSignatureAssignabilityInInheritance4.ts, 11, 26)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance4.ts, 12, 9)) >U : Symbol(U, Decl(callSignatureAssignabilityInInheritance4.ts, 12, 11)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance4.ts, 12, 14)) @@ -53,7 +53,7 @@ interface A { // T >U : Symbol(U, Decl(callSignatureAssignabilityInInheritance4.ts, 12, 11)) a5: (x: (arg: T) => U) => T; ->a5 : Symbol(a5, Decl(callSignatureAssignabilityInInheritance4.ts, 12, 36)) +>a5 : Symbol(A.a5, Decl(callSignatureAssignabilityInInheritance4.ts, 12, 36)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance4.ts, 13, 9)) >U : Symbol(U, Decl(callSignatureAssignabilityInInheritance4.ts, 13, 11)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance4.ts, 13, 14)) @@ -63,7 +63,7 @@ interface A { // T >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance4.ts, 13, 9)) a6: (x: (arg: T) => Derived) => T; ->a6 : Symbol(a6, Decl(callSignatureAssignabilityInInheritance4.ts, 13, 37)) +>a6 : Symbol(A.a6, Decl(callSignatureAssignabilityInInheritance4.ts, 13, 37)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance4.ts, 14, 9)) >Base : Symbol(Base, Decl(callSignatureAssignabilityInInheritance4.ts, 0, 0)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance4.ts, 14, 25)) @@ -73,7 +73,7 @@ interface A { // T >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance4.ts, 14, 9)) a11: (x: { foo: T }, y: { foo: T; bar: T }) => Base; ->a11 : Symbol(a11, Decl(callSignatureAssignabilityInInheritance4.ts, 14, 54)) +>a11 : Symbol(A.a11, Decl(callSignatureAssignabilityInInheritance4.ts, 14, 54)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance4.ts, 15, 10)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance4.ts, 15, 13)) >foo : Symbol(foo, Decl(callSignatureAssignabilityInInheritance4.ts, 15, 17)) @@ -86,7 +86,7 @@ interface A { // T >Base : Symbol(Base, Decl(callSignatureAssignabilityInInheritance4.ts, 0, 0)) a15: (x: { a: T; b: T }) => T[]; ->a15 : Symbol(a15, Decl(callSignatureAssignabilityInInheritance4.ts, 15, 59)) +>a15 : Symbol(A.a15, Decl(callSignatureAssignabilityInInheritance4.ts, 15, 59)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance4.ts, 16, 10)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance4.ts, 16, 13)) >a : Symbol(a, Decl(callSignatureAssignabilityInInheritance4.ts, 16, 17)) @@ -96,7 +96,7 @@ interface A { // T >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance4.ts, 16, 10)) a16: (x: { a: T; b: T }) => T[]; ->a16 : Symbol(a16, Decl(callSignatureAssignabilityInInheritance4.ts, 16, 39)) +>a16 : Symbol(A.a16, Decl(callSignatureAssignabilityInInheritance4.ts, 16, 39)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance4.ts, 17, 10)) >Base : Symbol(Base, Decl(callSignatureAssignabilityInInheritance4.ts, 0, 0)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance4.ts, 17, 26)) @@ -107,7 +107,7 @@ interface A { // T >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance4.ts, 17, 10)) a17: { ->a17 : Symbol(a17, Decl(callSignatureAssignabilityInInheritance4.ts, 17, 52)) +>a17 : Symbol(A.a17, Decl(callSignatureAssignabilityInInheritance4.ts, 17, 52)) (x: (a: T) => T): T[]; >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance4.ts, 19, 9)) @@ -129,7 +129,7 @@ interface A { // T }; a18: { ->a18 : Symbol(a18, Decl(callSignatureAssignabilityInInheritance4.ts, 21, 6)) +>a18 : Symbol(A.a18, Decl(callSignatureAssignabilityInInheritance4.ts, 21, 6)) (x: { >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance4.ts, 23, 9)) @@ -177,27 +177,27 @@ interface I extends A { // N's a: (x: T) => T[]; // ok, instantiation of N is a subtype of M, T is number ->a : Symbol(a, Decl(callSignatureAssignabilityInInheritance4.ts, 35, 23)) +>a : Symbol(I.a, Decl(callSignatureAssignabilityInInheritance4.ts, 35, 23)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance4.ts, 37, 8)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance4.ts, 37, 11)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance4.ts, 37, 8)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance4.ts, 37, 8)) a2: (x: T) => string[]; // ok ->a2 : Symbol(a2, Decl(callSignatureAssignabilityInInheritance4.ts, 37, 24)) +>a2 : Symbol(I.a2, Decl(callSignatureAssignabilityInInheritance4.ts, 37, 24)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance4.ts, 38, 9)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance4.ts, 38, 12)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance4.ts, 38, 9)) a3: (x: T) => T; // ok since Base returns void ->a3 : Symbol(a3, Decl(callSignatureAssignabilityInInheritance4.ts, 38, 30)) +>a3 : Symbol(I.a3, Decl(callSignatureAssignabilityInInheritance4.ts, 38, 30)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance4.ts, 39, 9)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance4.ts, 39, 12)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance4.ts, 39, 9)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance4.ts, 39, 9)) a4: (x: T, y: U) => string; // ok, instantiation of N is a subtype of M, T is string, U is number ->a4 : Symbol(a4, Decl(callSignatureAssignabilityInInheritance4.ts, 39, 23)) +>a4 : Symbol(I.a4, Decl(callSignatureAssignabilityInInheritance4.ts, 39, 23)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance4.ts, 40, 9)) >U : Symbol(U, Decl(callSignatureAssignabilityInInheritance4.ts, 40, 11)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance4.ts, 40, 15)) @@ -206,7 +206,7 @@ interface I extends A { >U : Symbol(U, Decl(callSignatureAssignabilityInInheritance4.ts, 40, 11)) a5: (x: (arg: T) => U) => T; // ok, U is in a parameter position so inferences can be made ->a5 : Symbol(a5, Decl(callSignatureAssignabilityInInheritance4.ts, 40, 37)) +>a5 : Symbol(I.a5, Decl(callSignatureAssignabilityInInheritance4.ts, 40, 37)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance4.ts, 41, 9)) >U : Symbol(U, Decl(callSignatureAssignabilityInInheritance4.ts, 41, 11)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance4.ts, 41, 15)) @@ -216,7 +216,7 @@ interface I extends A { >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance4.ts, 41, 9)) a6: (x: (arg: T) => U) => T; // ok, same as a5 but with object type hierarchy ->a6 : Symbol(a6, Decl(callSignatureAssignabilityInInheritance4.ts, 41, 38)) +>a6 : Symbol(I.a6, Decl(callSignatureAssignabilityInInheritance4.ts, 41, 38)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance4.ts, 42, 9)) >Base : Symbol(Base, Decl(callSignatureAssignabilityInInheritance4.ts, 0, 0)) >U : Symbol(U, Decl(callSignatureAssignabilityInInheritance4.ts, 42, 24)) @@ -228,7 +228,7 @@ interface I extends A { >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance4.ts, 42, 9)) a11: (x: { foo: T }, y: { foo: U; bar: U }) => Base; // ok ->a11 : Symbol(a11, Decl(callSignatureAssignabilityInInheritance4.ts, 42, 67)) +>a11 : Symbol(I.a11, Decl(callSignatureAssignabilityInInheritance4.ts, 42, 67)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance4.ts, 43, 10)) >U : Symbol(U, Decl(callSignatureAssignabilityInInheritance4.ts, 43, 12)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance4.ts, 43, 16)) @@ -242,7 +242,7 @@ interface I extends A { >Base : Symbol(Base, Decl(callSignatureAssignabilityInInheritance4.ts, 0, 0)) a15: (x: { a: U; b: V; }) => U[]; // ok, T = U, T = V ->a15 : Symbol(a15, Decl(callSignatureAssignabilityInInheritance4.ts, 43, 62)) +>a15 : Symbol(I.a15, Decl(callSignatureAssignabilityInInheritance4.ts, 43, 62)) >U : Symbol(U, Decl(callSignatureAssignabilityInInheritance4.ts, 44, 10)) >V : Symbol(V, Decl(callSignatureAssignabilityInInheritance4.ts, 44, 12)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance4.ts, 44, 16)) @@ -253,7 +253,7 @@ interface I extends A { >U : Symbol(U, Decl(callSignatureAssignabilityInInheritance4.ts, 44, 10)) a16: (x: { a: T; b: T }) => T[]; // ok, more general parameter type ->a16 : Symbol(a16, Decl(callSignatureAssignabilityInInheritance4.ts, 44, 43)) +>a16 : Symbol(I.a16, Decl(callSignatureAssignabilityInInheritance4.ts, 44, 43)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance4.ts, 45, 10)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance4.ts, 45, 13)) >a : Symbol(a, Decl(callSignatureAssignabilityInInheritance4.ts, 45, 17)) @@ -263,7 +263,7 @@ interface I extends A { >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance4.ts, 45, 10)) a17: (x: (a: T) => T) => T[]; // ok ->a17 : Symbol(a17, Decl(callSignatureAssignabilityInInheritance4.ts, 45, 39)) +>a17 : Symbol(I.a17, Decl(callSignatureAssignabilityInInheritance4.ts, 45, 39)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance4.ts, 46, 10)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance4.ts, 46, 13)) >a : Symbol(a, Decl(callSignatureAssignabilityInInheritance4.ts, 46, 17)) @@ -272,7 +272,7 @@ interface I extends A { >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance4.ts, 46, 10)) a18: (x: (a: T) => T) => any[]; // ok ->a18 : Symbol(a18, Decl(callSignatureAssignabilityInInheritance4.ts, 46, 36)) +>a18 : Symbol(I.a18, Decl(callSignatureAssignabilityInInheritance4.ts, 46, 36)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance4.ts, 47, 10)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance4.ts, 47, 14)) >a : Symbol(a, Decl(callSignatureAssignabilityInInheritance4.ts, 47, 17)) diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance5.symbols b/tests/baselines/reference/callSignatureAssignabilityInInheritance5.symbols index 89797dceb70..6f92fa5d5c7 100644 --- a/tests/baselines/reference/callSignatureAssignabilityInInheritance5.symbols +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance5.symbols @@ -4,51 +4,51 @@ class Base { foo: string; } >Base : Symbol(Base, Decl(callSignatureAssignabilityInInheritance5.ts, 0, 0)) ->foo : Symbol(foo, Decl(callSignatureAssignabilityInInheritance5.ts, 3, 12)) +>foo : Symbol(Base.foo, Decl(callSignatureAssignabilityInInheritance5.ts, 3, 12)) class Derived extends Base { bar: string; } >Derived : Symbol(Derived, Decl(callSignatureAssignabilityInInheritance5.ts, 3, 27)) >Base : Symbol(Base, Decl(callSignatureAssignabilityInInheritance5.ts, 0, 0)) ->bar : Symbol(bar, Decl(callSignatureAssignabilityInInheritance5.ts, 4, 28)) +>bar : Symbol(Derived.bar, Decl(callSignatureAssignabilityInInheritance5.ts, 4, 28)) class Derived2 extends Derived { baz: string; } >Derived2 : Symbol(Derived2, Decl(callSignatureAssignabilityInInheritance5.ts, 4, 43)) >Derived : Symbol(Derived, Decl(callSignatureAssignabilityInInheritance5.ts, 3, 27)) ->baz : Symbol(baz, Decl(callSignatureAssignabilityInInheritance5.ts, 5, 32)) +>baz : Symbol(Derived2.baz, Decl(callSignatureAssignabilityInInheritance5.ts, 5, 32)) class OtherDerived extends Base { bing: string; } >OtherDerived : Symbol(OtherDerived, Decl(callSignatureAssignabilityInInheritance5.ts, 5, 47)) >Base : Symbol(Base, Decl(callSignatureAssignabilityInInheritance5.ts, 0, 0)) ->bing : Symbol(bing, Decl(callSignatureAssignabilityInInheritance5.ts, 6, 33)) +>bing : Symbol(OtherDerived.bing, Decl(callSignatureAssignabilityInInheritance5.ts, 6, 33)) interface A { // T >A : Symbol(A, Decl(callSignatureAssignabilityInInheritance5.ts, 6, 49)) // M's a: (x: number) => number[]; ->a : Symbol(a, Decl(callSignatureAssignabilityInInheritance5.ts, 8, 13)) +>a : Symbol(A.a, Decl(callSignatureAssignabilityInInheritance5.ts, 8, 13)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance5.ts, 10, 8)) a2: (x: number) => string[]; ->a2 : Symbol(a2, Decl(callSignatureAssignabilityInInheritance5.ts, 10, 31)) +>a2 : Symbol(A.a2, Decl(callSignatureAssignabilityInInheritance5.ts, 10, 31)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance5.ts, 11, 9)) a3: (x: number) => void; ->a3 : Symbol(a3, Decl(callSignatureAssignabilityInInheritance5.ts, 11, 32)) +>a3 : Symbol(A.a3, Decl(callSignatureAssignabilityInInheritance5.ts, 11, 32)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance5.ts, 12, 9)) a4: (x: string, y: number) => string; ->a4 : Symbol(a4, Decl(callSignatureAssignabilityInInheritance5.ts, 12, 28)) +>a4 : Symbol(A.a4, Decl(callSignatureAssignabilityInInheritance5.ts, 12, 28)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance5.ts, 13, 9)) >y : Symbol(y, Decl(callSignatureAssignabilityInInheritance5.ts, 13, 19)) a5: (x: (arg: string) => number) => string; ->a5 : Symbol(a5, Decl(callSignatureAssignabilityInInheritance5.ts, 13, 41)) +>a5 : Symbol(A.a5, Decl(callSignatureAssignabilityInInheritance5.ts, 13, 41)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance5.ts, 14, 9)) >arg : Symbol(arg, Decl(callSignatureAssignabilityInInheritance5.ts, 14, 13)) a6: (x: (arg: Base) => Derived) => Base; ->a6 : Symbol(a6, Decl(callSignatureAssignabilityInInheritance5.ts, 14, 47)) +>a6 : Symbol(A.a6, Decl(callSignatureAssignabilityInInheritance5.ts, 14, 47)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance5.ts, 15, 9)) >arg : Symbol(arg, Decl(callSignatureAssignabilityInInheritance5.ts, 15, 13)) >Base : Symbol(Base, Decl(callSignatureAssignabilityInInheritance5.ts, 0, 0)) @@ -56,7 +56,7 @@ interface A { // T >Base : Symbol(Base, Decl(callSignatureAssignabilityInInheritance5.ts, 0, 0)) a7: (x: (arg: Base) => Derived) => (r: Base) => Derived; ->a7 : Symbol(a7, Decl(callSignatureAssignabilityInInheritance5.ts, 15, 44)) +>a7 : Symbol(A.a7, Decl(callSignatureAssignabilityInInheritance5.ts, 15, 44)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance5.ts, 16, 9)) >arg : Symbol(arg, Decl(callSignatureAssignabilityInInheritance5.ts, 16, 13)) >Base : Symbol(Base, Decl(callSignatureAssignabilityInInheritance5.ts, 0, 0)) @@ -66,7 +66,7 @@ interface A { // T >Derived : Symbol(Derived, Decl(callSignatureAssignabilityInInheritance5.ts, 3, 27)) a8: (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived; ->a8 : Symbol(a8, Decl(callSignatureAssignabilityInInheritance5.ts, 16, 60)) +>a8 : Symbol(A.a8, Decl(callSignatureAssignabilityInInheritance5.ts, 16, 60)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance5.ts, 17, 9)) >arg : Symbol(arg, Decl(callSignatureAssignabilityInInheritance5.ts, 17, 13)) >Base : Symbol(Base, Decl(callSignatureAssignabilityInInheritance5.ts, 0, 0)) @@ -80,7 +80,7 @@ interface A { // T >Derived : Symbol(Derived, Decl(callSignatureAssignabilityInInheritance5.ts, 3, 27)) a9: (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived; ->a9 : Symbol(a9, Decl(callSignatureAssignabilityInInheritance5.ts, 17, 88)) +>a9 : Symbol(A.a9, Decl(callSignatureAssignabilityInInheritance5.ts, 17, 88)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance5.ts, 18, 9)) >arg : Symbol(arg, Decl(callSignatureAssignabilityInInheritance5.ts, 18, 13)) >Base : Symbol(Base, Decl(callSignatureAssignabilityInInheritance5.ts, 0, 0)) @@ -94,13 +94,13 @@ interface A { // T >Derived : Symbol(Derived, Decl(callSignatureAssignabilityInInheritance5.ts, 3, 27)) a10: (...x: Derived[]) => Derived; ->a10 : Symbol(a10, Decl(callSignatureAssignabilityInInheritance5.ts, 18, 88)) +>a10 : Symbol(A.a10, Decl(callSignatureAssignabilityInInheritance5.ts, 18, 88)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance5.ts, 19, 10)) >Derived : Symbol(Derived, Decl(callSignatureAssignabilityInInheritance5.ts, 3, 27)) >Derived : Symbol(Derived, Decl(callSignatureAssignabilityInInheritance5.ts, 3, 27)) a11: (x: { foo: string }, y: { foo: string; bar: string }) => Base; ->a11 : Symbol(a11, Decl(callSignatureAssignabilityInInheritance5.ts, 19, 38)) +>a11 : Symbol(A.a11, Decl(callSignatureAssignabilityInInheritance5.ts, 19, 38)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance5.ts, 20, 10)) >foo : Symbol(foo, Decl(callSignatureAssignabilityInInheritance5.ts, 20, 14)) >y : Symbol(y, Decl(callSignatureAssignabilityInInheritance5.ts, 20, 29)) @@ -109,7 +109,7 @@ interface A { // T >Base : Symbol(Base, Decl(callSignatureAssignabilityInInheritance5.ts, 0, 0)) a12: (x: Array, y: Array) => Array; ->a12 : Symbol(a12, Decl(callSignatureAssignabilityInInheritance5.ts, 20, 71)) +>a12 : Symbol(A.a12, Decl(callSignatureAssignabilityInInheritance5.ts, 20, 71)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance5.ts, 21, 10)) >Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >Base : Symbol(Base, Decl(callSignatureAssignabilityInInheritance5.ts, 0, 0)) @@ -120,7 +120,7 @@ interface A { // T >Derived : Symbol(Derived, Decl(callSignatureAssignabilityInInheritance5.ts, 3, 27)) a13: (x: Array, y: Array) => Array; ->a13 : Symbol(a13, Decl(callSignatureAssignabilityInInheritance5.ts, 21, 64)) +>a13 : Symbol(A.a13, Decl(callSignatureAssignabilityInInheritance5.ts, 21, 64)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance5.ts, 22, 10)) >Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >Base : Symbol(Base, Decl(callSignatureAssignabilityInInheritance5.ts, 0, 0)) @@ -131,7 +131,7 @@ interface A { // T >Derived : Symbol(Derived, Decl(callSignatureAssignabilityInInheritance5.ts, 3, 27)) a14: (x: { a: string; b: number }) => Object; ->a14 : Symbol(a14, Decl(callSignatureAssignabilityInInheritance5.ts, 22, 63)) +>a14 : Symbol(A.a14, Decl(callSignatureAssignabilityInInheritance5.ts, 22, 63)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance5.ts, 23, 10)) >a : Symbol(a, Decl(callSignatureAssignabilityInInheritance5.ts, 23, 14)) >b : Symbol(b, Decl(callSignatureAssignabilityInInheritance5.ts, 23, 25)) @@ -143,7 +143,7 @@ interface B extends A { >A : Symbol(A, Decl(callSignatureAssignabilityInInheritance5.ts, 6, 49)) a: (x: T) => T[]; ->a : Symbol(a, Decl(callSignatureAssignabilityInInheritance5.ts, 26, 23)) +>a : Symbol(B.a, Decl(callSignatureAssignabilityInInheritance5.ts, 26, 23)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance5.ts, 27, 8)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance5.ts, 27, 11)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance5.ts, 27, 8)) @@ -157,27 +157,27 @@ interface I extends B { // N's a: (x: T) => T[]; // ok, instantiation of N is a subtype of M, T is number ->a : Symbol(a, Decl(callSignatureAssignabilityInInheritance5.ts, 31, 23)) +>a : Symbol(I.a, Decl(callSignatureAssignabilityInInheritance5.ts, 31, 23)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance5.ts, 33, 8)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance5.ts, 33, 11)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance5.ts, 33, 8)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance5.ts, 33, 8)) a2: (x: T) => string[]; // ok ->a2 : Symbol(a2, Decl(callSignatureAssignabilityInInheritance5.ts, 33, 24)) +>a2 : Symbol(I.a2, Decl(callSignatureAssignabilityInInheritance5.ts, 33, 24)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance5.ts, 34, 9)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance5.ts, 34, 12)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance5.ts, 34, 9)) a3: (x: T) => T; // ok since Base returns void ->a3 : Symbol(a3, Decl(callSignatureAssignabilityInInheritance5.ts, 34, 30)) +>a3 : Symbol(I.a3, Decl(callSignatureAssignabilityInInheritance5.ts, 34, 30)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance5.ts, 35, 9)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance5.ts, 35, 12)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance5.ts, 35, 9)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance5.ts, 35, 9)) a4: (x: T, y: U) => T; // ok, instantiation of N is a subtype of M, T is string, U is number ->a4 : Symbol(a4, Decl(callSignatureAssignabilityInInheritance5.ts, 35, 23)) +>a4 : Symbol(I.a4, Decl(callSignatureAssignabilityInInheritance5.ts, 35, 23)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance5.ts, 36, 9)) >U : Symbol(U, Decl(callSignatureAssignabilityInInheritance5.ts, 36, 11)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance5.ts, 36, 15)) @@ -187,7 +187,7 @@ interface I extends B { >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance5.ts, 36, 9)) a5: (x: (arg: T) => U) => T; // ok, U is in a parameter position so inferences can be made ->a5 : Symbol(a5, Decl(callSignatureAssignabilityInInheritance5.ts, 36, 32)) +>a5 : Symbol(I.a5, Decl(callSignatureAssignabilityInInheritance5.ts, 36, 32)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance5.ts, 37, 9)) >U : Symbol(U, Decl(callSignatureAssignabilityInInheritance5.ts, 37, 11)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance5.ts, 37, 15)) @@ -197,7 +197,7 @@ interface I extends B { >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance5.ts, 37, 9)) a6: (x: (arg: T) => U) => T; // ok, same as a5 but with object type hierarchy ->a6 : Symbol(a6, Decl(callSignatureAssignabilityInInheritance5.ts, 37, 38)) +>a6 : Symbol(I.a6, Decl(callSignatureAssignabilityInInheritance5.ts, 37, 38)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance5.ts, 38, 9)) >Base : Symbol(Base, Decl(callSignatureAssignabilityInInheritance5.ts, 0, 0)) >U : Symbol(U, Decl(callSignatureAssignabilityInInheritance5.ts, 38, 24)) @@ -209,7 +209,7 @@ interface I extends B { >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance5.ts, 38, 9)) a7: (x: (arg: T) => U) => (r: T) => U; // ok ->a7 : Symbol(a7, Decl(callSignatureAssignabilityInInheritance5.ts, 38, 67)) +>a7 : Symbol(I.a7, Decl(callSignatureAssignabilityInInheritance5.ts, 38, 67)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance5.ts, 39, 9)) >Base : Symbol(Base, Decl(callSignatureAssignabilityInInheritance5.ts, 0, 0)) >U : Symbol(U, Decl(callSignatureAssignabilityInInheritance5.ts, 39, 24)) @@ -223,7 +223,7 @@ interface I extends B { >U : Symbol(U, Decl(callSignatureAssignabilityInInheritance5.ts, 39, 24)) a8: (x: (arg: T) => U, y: (arg2: T) => U) => (r: T) => U; // ok ->a8 : Symbol(a8, Decl(callSignatureAssignabilityInInheritance5.ts, 39, 77)) +>a8 : Symbol(I.a8, Decl(callSignatureAssignabilityInInheritance5.ts, 39, 77)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance5.ts, 40, 9)) >Base : Symbol(Base, Decl(callSignatureAssignabilityInInheritance5.ts, 0, 0)) >U : Symbol(U, Decl(callSignatureAssignabilityInInheritance5.ts, 40, 24)) @@ -241,7 +241,7 @@ interface I extends B { >U : Symbol(U, Decl(callSignatureAssignabilityInInheritance5.ts, 40, 24)) a9: (x: (arg: T) => U, y: (arg2: { foo: string; bing: number }) => U) => (r: T) => U; // ok, same as a8 with compatible object literal ->a9 : Symbol(a9, Decl(callSignatureAssignabilityInInheritance5.ts, 40, 96)) +>a9 : Symbol(I.a9, Decl(callSignatureAssignabilityInInheritance5.ts, 40, 96)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance5.ts, 41, 9)) >Base : Symbol(Base, Decl(callSignatureAssignabilityInInheritance5.ts, 0, 0)) >U : Symbol(U, Decl(callSignatureAssignabilityInInheritance5.ts, 41, 24)) @@ -260,7 +260,7 @@ interface I extends B { >U : Symbol(U, Decl(callSignatureAssignabilityInInheritance5.ts, 41, 24)) a10: (...x: T[]) => T; // ok ->a10 : Symbol(a10, Decl(callSignatureAssignabilityInInheritance5.ts, 41, 124)) +>a10 : Symbol(I.a10, Decl(callSignatureAssignabilityInInheritance5.ts, 41, 124)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance5.ts, 42, 10)) >Derived : Symbol(Derived, Decl(callSignatureAssignabilityInInheritance5.ts, 3, 27)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance5.ts, 42, 29)) @@ -268,7 +268,7 @@ interface I extends B { >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance5.ts, 42, 10)) a11: (x: T, y: T) => T; // ok ->a11 : Symbol(a11, Decl(callSignatureAssignabilityInInheritance5.ts, 42, 45)) +>a11 : Symbol(I.a11, Decl(callSignatureAssignabilityInInheritance5.ts, 42, 45)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance5.ts, 43, 10)) >Base : Symbol(Base, Decl(callSignatureAssignabilityInInheritance5.ts, 0, 0)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance5.ts, 43, 26)) @@ -278,7 +278,7 @@ interface I extends B { >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance5.ts, 43, 10)) a12: >(x: Array, y: T) => Array; // ok, less specific parameter type ->a12 : Symbol(a12, Decl(callSignatureAssignabilityInInheritance5.ts, 43, 43)) +>a12 : Symbol(I.a12, Decl(callSignatureAssignabilityInInheritance5.ts, 43, 43)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance5.ts, 44, 10)) >Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >Base : Symbol(Base, Decl(callSignatureAssignabilityInInheritance5.ts, 0, 0)) @@ -291,7 +291,7 @@ interface I extends B { >Derived : Symbol(Derived, Decl(callSignatureAssignabilityInInheritance5.ts, 3, 27)) a13: >(x: Array, y: T) => T; // ok, T = Array, satisfies constraint, contextual signature instantiation succeeds ->a13 : Symbol(a13, Decl(callSignatureAssignabilityInInheritance5.ts, 44, 73)) +>a13 : Symbol(I.a13, Decl(callSignatureAssignabilityInInheritance5.ts, 44, 73)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance5.ts, 45, 10)) >Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >Derived : Symbol(Derived, Decl(callSignatureAssignabilityInInheritance5.ts, 3, 27)) @@ -303,7 +303,7 @@ interface I extends B { >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance5.ts, 45, 10)) a14: (x: { a: T; b: T }) => T; // ok, best common type yields T = {} but that's satisfactory for this signature ->a14 : Symbol(a14, Decl(callSignatureAssignabilityInInheritance5.ts, 45, 63)) +>a14 : Symbol(I.a14, Decl(callSignatureAssignabilityInInheritance5.ts, 45, 63)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance5.ts, 46, 10)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance5.ts, 46, 13)) >a : Symbol(a, Decl(callSignatureAssignabilityInInheritance5.ts, 46, 17)) diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance6.symbols b/tests/baselines/reference/callSignatureAssignabilityInInheritance6.symbols index 1d4c99d89db..56c7098d408 100644 --- a/tests/baselines/reference/callSignatureAssignabilityInInheritance6.symbols +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance6.symbols @@ -5,48 +5,48 @@ class Base { foo: string; } >Base : Symbol(Base, Decl(callSignatureAssignabilityInInheritance6.ts, 0, 0)) ->foo : Symbol(foo, Decl(callSignatureAssignabilityInInheritance6.ts, 4, 12)) +>foo : Symbol(Base.foo, Decl(callSignatureAssignabilityInInheritance6.ts, 4, 12)) class Derived extends Base { bar: string; } >Derived : Symbol(Derived, Decl(callSignatureAssignabilityInInheritance6.ts, 4, 27)) >Base : Symbol(Base, Decl(callSignatureAssignabilityInInheritance6.ts, 0, 0)) ->bar : Symbol(bar, Decl(callSignatureAssignabilityInInheritance6.ts, 5, 28)) +>bar : Symbol(Derived.bar, Decl(callSignatureAssignabilityInInheritance6.ts, 5, 28)) class Derived2 extends Derived { baz: string; } >Derived2 : Symbol(Derived2, Decl(callSignatureAssignabilityInInheritance6.ts, 5, 43)) >Derived : Symbol(Derived, Decl(callSignatureAssignabilityInInheritance6.ts, 4, 27)) ->baz : Symbol(baz, Decl(callSignatureAssignabilityInInheritance6.ts, 6, 32)) +>baz : Symbol(Derived2.baz, Decl(callSignatureAssignabilityInInheritance6.ts, 6, 32)) class OtherDerived extends Base { bing: string; } >OtherDerived : Symbol(OtherDerived, Decl(callSignatureAssignabilityInInheritance6.ts, 6, 47)) >Base : Symbol(Base, Decl(callSignatureAssignabilityInInheritance6.ts, 0, 0)) ->bing : Symbol(bing, Decl(callSignatureAssignabilityInInheritance6.ts, 7, 33)) +>bing : Symbol(OtherDerived.bing, Decl(callSignatureAssignabilityInInheritance6.ts, 7, 33)) interface A { // T >A : Symbol(A, Decl(callSignatureAssignabilityInInheritance6.ts, 7, 49)) // M's a: (x: T) => T[]; ->a : Symbol(a, Decl(callSignatureAssignabilityInInheritance6.ts, 9, 13)) +>a : Symbol(A.a, Decl(callSignatureAssignabilityInInheritance6.ts, 9, 13)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance6.ts, 11, 8)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance6.ts, 11, 11)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance6.ts, 11, 8)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance6.ts, 11, 8)) a2: (x: T) => string[]; ->a2 : Symbol(a2, Decl(callSignatureAssignabilityInInheritance6.ts, 11, 24)) +>a2 : Symbol(A.a2, Decl(callSignatureAssignabilityInInheritance6.ts, 11, 24)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance6.ts, 12, 9)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance6.ts, 12, 12)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance6.ts, 12, 9)) a3: (x: T) => void; ->a3 : Symbol(a3, Decl(callSignatureAssignabilityInInheritance6.ts, 12, 30)) +>a3 : Symbol(A.a3, Decl(callSignatureAssignabilityInInheritance6.ts, 12, 30)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance6.ts, 13, 9)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance6.ts, 13, 12)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance6.ts, 13, 9)) a4: (x: T, y: U) => string; ->a4 : Symbol(a4, Decl(callSignatureAssignabilityInInheritance6.ts, 13, 26)) +>a4 : Symbol(A.a4, Decl(callSignatureAssignabilityInInheritance6.ts, 13, 26)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance6.ts, 14, 9)) >U : Symbol(U, Decl(callSignatureAssignabilityInInheritance6.ts, 14, 11)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance6.ts, 14, 14)) @@ -55,7 +55,7 @@ interface A { // T >U : Symbol(U, Decl(callSignatureAssignabilityInInheritance6.ts, 14, 11)) a5: (x: (arg: T) => U) => T; ->a5 : Symbol(a5, Decl(callSignatureAssignabilityInInheritance6.ts, 14, 36)) +>a5 : Symbol(A.a5, Decl(callSignatureAssignabilityInInheritance6.ts, 14, 36)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance6.ts, 15, 9)) >U : Symbol(U, Decl(callSignatureAssignabilityInInheritance6.ts, 15, 11)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance6.ts, 15, 14)) @@ -65,7 +65,7 @@ interface A { // T >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance6.ts, 15, 9)) a6: (x: (arg: T) => Derived) => T; ->a6 : Symbol(a6, Decl(callSignatureAssignabilityInInheritance6.ts, 15, 37)) +>a6 : Symbol(A.a6, Decl(callSignatureAssignabilityInInheritance6.ts, 15, 37)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance6.ts, 16, 9)) >Base : Symbol(Base, Decl(callSignatureAssignabilityInInheritance6.ts, 0, 0)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance6.ts, 16, 25)) @@ -75,7 +75,7 @@ interface A { // T >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance6.ts, 16, 9)) a11: (x: { foo: T }, y: { foo: T; bar: T }) => Base; ->a11 : Symbol(a11, Decl(callSignatureAssignabilityInInheritance6.ts, 16, 54)) +>a11 : Symbol(A.a11, Decl(callSignatureAssignabilityInInheritance6.ts, 16, 54)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance6.ts, 17, 10)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance6.ts, 17, 13)) >foo : Symbol(foo, Decl(callSignatureAssignabilityInInheritance6.ts, 17, 17)) @@ -88,7 +88,7 @@ interface A { // T >Base : Symbol(Base, Decl(callSignatureAssignabilityInInheritance6.ts, 0, 0)) a15: (x: { a: T; b: T }) => T[]; ->a15 : Symbol(a15, Decl(callSignatureAssignabilityInInheritance6.ts, 17, 59)) +>a15 : Symbol(A.a15, Decl(callSignatureAssignabilityInInheritance6.ts, 17, 59)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance6.ts, 18, 10)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance6.ts, 18, 13)) >a : Symbol(a, Decl(callSignatureAssignabilityInInheritance6.ts, 18, 17)) @@ -98,7 +98,7 @@ interface A { // T >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance6.ts, 18, 10)) a16: (x: { a: T; b: T }) => T[]; ->a16 : Symbol(a16, Decl(callSignatureAssignabilityInInheritance6.ts, 18, 39)) +>a16 : Symbol(A.a16, Decl(callSignatureAssignabilityInInheritance6.ts, 18, 39)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance6.ts, 19, 10)) >Base : Symbol(Base, Decl(callSignatureAssignabilityInInheritance6.ts, 0, 0)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance6.ts, 19, 26)) @@ -116,7 +116,7 @@ interface I extends A { >A : Symbol(A, Decl(callSignatureAssignabilityInInheritance6.ts, 7, 49)) a: (x: T) => T[]; ->a : Symbol(a, Decl(callSignatureAssignabilityInInheritance6.ts, 23, 26)) +>a : Symbol(I.a, Decl(callSignatureAssignabilityInInheritance6.ts, 23, 26)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance6.ts, 24, 8)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance6.ts, 23, 12)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance6.ts, 23, 12)) @@ -128,7 +128,7 @@ interface I2 extends A { >A : Symbol(A, Decl(callSignatureAssignabilityInInheritance6.ts, 7, 49)) a2: (x: T) => string[]; ->a2 : Symbol(a2, Decl(callSignatureAssignabilityInInheritance6.ts, 27, 27)) +>a2 : Symbol(I2.a2, Decl(callSignatureAssignabilityInInheritance6.ts, 27, 27)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance6.ts, 28, 9)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance6.ts, 27, 13)) } @@ -139,7 +139,7 @@ interface I3 extends A { >A : Symbol(A, Decl(callSignatureAssignabilityInInheritance6.ts, 7, 49)) a3: (x: T) => T; ->a3 : Symbol(a3, Decl(callSignatureAssignabilityInInheritance6.ts, 31, 27)) +>a3 : Symbol(I3.a3, Decl(callSignatureAssignabilityInInheritance6.ts, 31, 27)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance6.ts, 32, 9)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance6.ts, 31, 13)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance6.ts, 31, 13)) @@ -151,7 +151,7 @@ interface I4 extends A { >A : Symbol(A, Decl(callSignatureAssignabilityInInheritance6.ts, 7, 49)) a4: (x: T, y: U) => string; ->a4 : Symbol(a4, Decl(callSignatureAssignabilityInInheritance6.ts, 35, 27)) +>a4 : Symbol(I4.a4, Decl(callSignatureAssignabilityInInheritance6.ts, 35, 27)) >U : Symbol(U, Decl(callSignatureAssignabilityInInheritance6.ts, 36, 9)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance6.ts, 36, 12)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance6.ts, 35, 13)) @@ -165,7 +165,7 @@ interface I5 extends A { >A : Symbol(A, Decl(callSignatureAssignabilityInInheritance6.ts, 7, 49)) a5: (x: (arg: T) => U) => T; ->a5 : Symbol(a5, Decl(callSignatureAssignabilityInInheritance6.ts, 39, 27)) +>a5 : Symbol(I5.a5, Decl(callSignatureAssignabilityInInheritance6.ts, 39, 27)) >U : Symbol(U, Decl(callSignatureAssignabilityInInheritance6.ts, 40, 9)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance6.ts, 40, 12)) >arg : Symbol(arg, Decl(callSignatureAssignabilityInInheritance6.ts, 40, 16)) @@ -180,7 +180,7 @@ interface I7 extends A { >A : Symbol(A, Decl(callSignatureAssignabilityInInheritance6.ts, 7, 49)) a11: (x: { foo: T }, y: { foo: U; bar: U }) => Base; ->a11 : Symbol(a11, Decl(callSignatureAssignabilityInInheritance6.ts, 43, 27)) +>a11 : Symbol(I7.a11, Decl(callSignatureAssignabilityInInheritance6.ts, 43, 27)) >U : Symbol(U, Decl(callSignatureAssignabilityInInheritance6.ts, 44, 10)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance6.ts, 44, 13)) >foo : Symbol(foo, Decl(callSignatureAssignabilityInInheritance6.ts, 44, 17)) @@ -199,7 +199,7 @@ interface I9 extends A { >A : Symbol(A, Decl(callSignatureAssignabilityInInheritance6.ts, 7, 49)) a16: (x: { a: T; b: T }) => T[]; ->a16 : Symbol(a16, Decl(callSignatureAssignabilityInInheritance6.ts, 47, 27)) +>a16 : Symbol(I9.a16, Decl(callSignatureAssignabilityInInheritance6.ts, 47, 27)) >x : Symbol(x, Decl(callSignatureAssignabilityInInheritance6.ts, 48, 10)) >a : Symbol(a, Decl(callSignatureAssignabilityInInheritance6.ts, 48, 14)) >T : Symbol(T, Decl(callSignatureAssignabilityInInheritance6.ts, 47, 13)) diff --git a/tests/baselines/reference/callSignatureWithoutAnnotationsOrBody.symbols b/tests/baselines/reference/callSignatureWithoutAnnotationsOrBody.symbols index 4b499ec2667..d8a43948fac 100644 --- a/tests/baselines/reference/callSignatureWithoutAnnotationsOrBody.symbols +++ b/tests/baselines/reference/callSignatureWithoutAnnotationsOrBody.symbols @@ -14,7 +14,7 @@ interface I { (); f(); ->f : Symbol(f, Decl(callSignatureWithoutAnnotationsOrBody.ts, 6, 7)) +>f : Symbol(I.f, Decl(callSignatureWithoutAnnotationsOrBody.ts, 6, 7)) } var i: I; >i : Symbol(i, Decl(callSignatureWithoutAnnotationsOrBody.ts, 9, 3)) diff --git a/tests/baselines/reference/callSignatureWithoutReturnTypeAnnotationInference.symbols b/tests/baselines/reference/callSignatureWithoutReturnTypeAnnotationInference.symbols index faba4e427ec..dd302da3671 100644 --- a/tests/baselines/reference/callSignatureWithoutReturnTypeAnnotationInference.symbols +++ b/tests/baselines/reference/callSignatureWithoutReturnTypeAnnotationInference.symbols @@ -109,7 +109,7 @@ interface I { >I : Symbol(I, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 54, 17)) foo: string; ->foo : Symbol(foo, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 56, 13)) +>foo : Symbol(I.foo, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 56, 13)) } function foo9(x: number) { >foo9 : Symbol(foo9, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 58, 1)) @@ -130,7 +130,7 @@ class C { >C : Symbol(C, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 63, 17)) foo: string; ->foo : Symbol(foo, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 65, 9)) +>foo : Symbol(C.foo, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 65, 9)) } function foo10(x: number) { >foo10 : Symbol(foo10, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 67, 1)) @@ -155,7 +155,7 @@ module M { export class C { foo: string } >C : Symbol(C, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 75, 21)) ->foo : Symbol(foo, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 76, 20)) +>foo : Symbol(C.foo, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 76, 20)) } function foo11() { >foo11 : Symbol(foo11, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 77, 1)) @@ -172,13 +172,13 @@ interface I2 { >I2 : Symbol(I2, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 81, 18), Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 86, 1)) x: number; ->x : Symbol(x, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 84, 14)) +>x : Symbol(I2.x, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 84, 14)) } interface I2 { >I2 : Symbol(I2, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 81, 18), Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 86, 1)) y: number; ->y : Symbol(y, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 87, 14)) +>y : Symbol(I2.y, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 87, 14)) } function foo12() { >foo12 : Symbol(foo12, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 89, 1)) @@ -215,7 +215,7 @@ class c1 { >c1 : Symbol(c1, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 101, 18), Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 106, 1)) foo: string; ->foo : Symbol(foo, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 103, 10)) +>foo : Symbol(c1.foo, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 103, 10)) constructor(x) { } >x : Symbol(x, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 105, 16)) diff --git a/tests/baselines/reference/callSignaturesWithOptionalParameters.symbols b/tests/baselines/reference/callSignaturesWithOptionalParameters.symbols index 542bd425fb1..c86adcff927 100644 --- a/tests/baselines/reference/callSignaturesWithOptionalParameters.symbols +++ b/tests/baselines/reference/callSignaturesWithOptionalParameters.symbols @@ -37,7 +37,7 @@ class C { >C : Symbol(C, Decl(callSignaturesWithOptionalParameters.ts, 11, 9)) foo(x?: number) { } ->foo : Symbol(foo, Decl(callSignaturesWithOptionalParameters.ts, 13, 9)) +>foo : Symbol(C.foo, Decl(callSignaturesWithOptionalParameters.ts, 13, 9)) >x : Symbol(x, Decl(callSignaturesWithOptionalParameters.ts, 14, 8)) } @@ -62,7 +62,7 @@ interface I { >x : Symbol(x, Decl(callSignaturesWithOptionalParameters.ts, 22, 5)) foo(x: number, y?: number); ->foo : Symbol(foo, Decl(callSignaturesWithOptionalParameters.ts, 22, 17)) +>foo : Symbol(I.foo, Decl(callSignaturesWithOptionalParameters.ts, 22, 17)) >x : Symbol(x, Decl(callSignaturesWithOptionalParameters.ts, 23, 8)) >y : Symbol(y, Decl(callSignaturesWithOptionalParameters.ts, 23, 18)) } diff --git a/tests/baselines/reference/callSignaturesWithOptionalParameters2.symbols b/tests/baselines/reference/callSignaturesWithOptionalParameters2.symbols index e8609d66236..7900b86bcb2 100644 --- a/tests/baselines/reference/callSignaturesWithOptionalParameters2.symbols +++ b/tests/baselines/reference/callSignaturesWithOptionalParameters2.symbols @@ -39,24 +39,24 @@ class C { >C : Symbol(C, Decl(callSignaturesWithOptionalParameters2.ts, 13, 11)) foo(x?: number); ->foo : Symbol(foo, Decl(callSignaturesWithOptionalParameters2.ts, 15, 9), Decl(callSignaturesWithOptionalParameters2.ts, 16, 20)) +>foo : Symbol(C.foo, Decl(callSignaturesWithOptionalParameters2.ts, 15, 9), Decl(callSignaturesWithOptionalParameters2.ts, 16, 20)) >x : Symbol(x, Decl(callSignaturesWithOptionalParameters2.ts, 16, 8)) foo(x?: number) { } ->foo : Symbol(foo, Decl(callSignaturesWithOptionalParameters2.ts, 15, 9), Decl(callSignaturesWithOptionalParameters2.ts, 16, 20)) +>foo : Symbol(C.foo, Decl(callSignaturesWithOptionalParameters2.ts, 15, 9), Decl(callSignaturesWithOptionalParameters2.ts, 16, 20)) >x : Symbol(x, Decl(callSignaturesWithOptionalParameters2.ts, 17, 8)) foo2(x: number); ->foo2 : Symbol(foo2, Decl(callSignaturesWithOptionalParameters2.ts, 17, 23), Decl(callSignaturesWithOptionalParameters2.ts, 19, 20), Decl(callSignaturesWithOptionalParameters2.ts, 20, 32)) +>foo2 : Symbol(C.foo2, Decl(callSignaturesWithOptionalParameters2.ts, 17, 23), Decl(callSignaturesWithOptionalParameters2.ts, 19, 20), Decl(callSignaturesWithOptionalParameters2.ts, 20, 32)) >x : Symbol(x, Decl(callSignaturesWithOptionalParameters2.ts, 19, 9)) foo2(x: number, y?: number); ->foo2 : Symbol(foo2, Decl(callSignaturesWithOptionalParameters2.ts, 17, 23), Decl(callSignaturesWithOptionalParameters2.ts, 19, 20), Decl(callSignaturesWithOptionalParameters2.ts, 20, 32)) +>foo2 : Symbol(C.foo2, Decl(callSignaturesWithOptionalParameters2.ts, 17, 23), Decl(callSignaturesWithOptionalParameters2.ts, 19, 20), Decl(callSignaturesWithOptionalParameters2.ts, 20, 32)) >x : Symbol(x, Decl(callSignaturesWithOptionalParameters2.ts, 20, 9)) >y : Symbol(y, Decl(callSignaturesWithOptionalParameters2.ts, 20, 19)) foo2(x: number, y?: number) { } ->foo2 : Symbol(foo2, Decl(callSignaturesWithOptionalParameters2.ts, 17, 23), Decl(callSignaturesWithOptionalParameters2.ts, 19, 20), Decl(callSignaturesWithOptionalParameters2.ts, 20, 32)) +>foo2 : Symbol(C.foo2, Decl(callSignaturesWithOptionalParameters2.ts, 17, 23), Decl(callSignaturesWithOptionalParameters2.ts, 19, 20), Decl(callSignaturesWithOptionalParameters2.ts, 20, 32)) >x : Symbol(x, Decl(callSignaturesWithOptionalParameters2.ts, 21, 9)) >y : Symbol(y, Decl(callSignaturesWithOptionalParameters2.ts, 21, 19)) } @@ -96,12 +96,12 @@ interface I { >y : Symbol(y, Decl(callSignaturesWithOptionalParameters2.ts, 33, 16)) foo(x: number, y?: number); ->foo : Symbol(foo, Decl(callSignaturesWithOptionalParameters2.ts, 33, 29), Decl(callSignaturesWithOptionalParameters2.ts, 34, 31)) +>foo : Symbol(I.foo, Decl(callSignaturesWithOptionalParameters2.ts, 33, 29), Decl(callSignaturesWithOptionalParameters2.ts, 34, 31)) >x : Symbol(x, Decl(callSignaturesWithOptionalParameters2.ts, 34, 8)) >y : Symbol(y, Decl(callSignaturesWithOptionalParameters2.ts, 34, 18)) foo(x: number, y?: number, z?: number); ->foo : Symbol(foo, Decl(callSignaturesWithOptionalParameters2.ts, 33, 29), Decl(callSignaturesWithOptionalParameters2.ts, 34, 31)) +>foo : Symbol(I.foo, Decl(callSignaturesWithOptionalParameters2.ts, 33, 29), Decl(callSignaturesWithOptionalParameters2.ts, 34, 31)) >x : Symbol(x, Decl(callSignaturesWithOptionalParameters2.ts, 35, 8)) >y : Symbol(y, Decl(callSignaturesWithOptionalParameters2.ts, 35, 18)) >z : Symbol(z, Decl(callSignaturesWithOptionalParameters2.ts, 35, 30)) diff --git a/tests/baselines/reference/callWithSpread.symbols b/tests/baselines/reference/callWithSpread.symbols index bc1dd7468c9..bc2d9bfebd9 100644 --- a/tests/baselines/reference/callWithSpread.symbols +++ b/tests/baselines/reference/callWithSpread.symbols @@ -3,7 +3,7 @@ interface X { >X : Symbol(X, Decl(callWithSpread.ts, 0, 0)) foo(x: number, y: number, ...z: string[]); ->foo : Symbol(foo, Decl(callWithSpread.ts, 0, 13)) +>foo : Symbol(X.foo, Decl(callWithSpread.ts, 0, 13)) >x : Symbol(x, Decl(callWithSpread.ts, 1, 8)) >y : Symbol(y, Decl(callWithSpread.ts, 1, 18)) >z : Symbol(z, Decl(callWithSpread.ts, 1, 29)) @@ -107,22 +107,22 @@ class C { >z : Symbol(z, Decl(callWithSpread.ts, 31, 37)) this.foo(x, y); ->this.foo : Symbol(foo, Decl(callWithSpread.ts, 34, 5)) +>this.foo : Symbol(C.foo, Decl(callWithSpread.ts, 34, 5)) >this : Symbol(C, Decl(callWithSpread.ts, 28, 40)) ->foo : Symbol(foo, Decl(callWithSpread.ts, 34, 5)) +>foo : Symbol(C.foo, Decl(callWithSpread.ts, 34, 5)) >x : Symbol(x, Decl(callWithSpread.ts, 31, 16)) >y : Symbol(y, Decl(callWithSpread.ts, 31, 26)) this.foo(x, y, ...z); ->this.foo : Symbol(foo, Decl(callWithSpread.ts, 34, 5)) +>this.foo : Symbol(C.foo, Decl(callWithSpread.ts, 34, 5)) >this : Symbol(C, Decl(callWithSpread.ts, 28, 40)) ->foo : Symbol(foo, Decl(callWithSpread.ts, 34, 5)) +>foo : Symbol(C.foo, Decl(callWithSpread.ts, 34, 5)) >x : Symbol(x, Decl(callWithSpread.ts, 31, 16)) >y : Symbol(y, Decl(callWithSpread.ts, 31, 26)) >z : Symbol(z, Decl(callWithSpread.ts, 31, 37)) } foo(x: number, y: number, ...z: string[]) { ->foo : Symbol(foo, Decl(callWithSpread.ts, 34, 5)) +>foo : Symbol(C.foo, Decl(callWithSpread.ts, 34, 5)) >x : Symbol(x, Decl(callWithSpread.ts, 35, 8)) >y : Symbol(y, Decl(callWithSpread.ts, 35, 18)) >z : Symbol(z, Decl(callWithSpread.ts, 35, 29)) @@ -142,7 +142,7 @@ class D extends C { >a : Symbol(a, Decl(callWithSpread.ts, 7, 3)) } foo() { ->foo : Symbol(foo, Decl(callWithSpread.ts, 43, 5)) +>foo : Symbol(D.foo, Decl(callWithSpread.ts, 43, 5)) super.foo(1, 2); >super.foo : Symbol(C.foo, Decl(callWithSpread.ts, 34, 5)) diff --git a/tests/baselines/reference/callWithSpreadES6.symbols b/tests/baselines/reference/callWithSpreadES6.symbols index 26dd9b548d5..518b04162b2 100644 --- a/tests/baselines/reference/callWithSpreadES6.symbols +++ b/tests/baselines/reference/callWithSpreadES6.symbols @@ -4,7 +4,7 @@ interface X { >X : Symbol(X, Decl(callWithSpreadES6.ts, 0, 0)) foo(x: number, y: number, ...z: string[]); ->foo : Symbol(foo, Decl(callWithSpreadES6.ts, 1, 13)) +>foo : Symbol(X.foo, Decl(callWithSpreadES6.ts, 1, 13)) >x : Symbol(x, Decl(callWithSpreadES6.ts, 2, 8)) >y : Symbol(y, Decl(callWithSpreadES6.ts, 2, 18)) >z : Symbol(z, Decl(callWithSpreadES6.ts, 2, 29)) @@ -94,7 +94,7 @@ xa[1].foo(1, 2, ...a, "abc"); >a : Symbol(a, Decl(callWithSpreadES6.ts, 8, 3)) (xa[1].foo)(...[1, 2, "abc"]); ->Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Function : Symbol(Function, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) >xa[1].foo : Symbol(X.foo, Decl(callWithSpreadES6.ts, 1, 13)) >xa : Symbol(xa, Decl(callWithSpreadES6.ts, 11, 3)) >foo : Symbol(X.foo, Decl(callWithSpreadES6.ts, 1, 13)) @@ -108,22 +108,22 @@ class C { >z : Symbol(z, Decl(callWithSpreadES6.ts, 32, 37)) this.foo(x, y); ->this.foo : Symbol(foo, Decl(callWithSpreadES6.ts, 35, 5)) +>this.foo : Symbol(C.foo, Decl(callWithSpreadES6.ts, 35, 5)) >this : Symbol(C, Decl(callWithSpreadES6.ts, 29, 40)) ->foo : Symbol(foo, Decl(callWithSpreadES6.ts, 35, 5)) +>foo : Symbol(C.foo, Decl(callWithSpreadES6.ts, 35, 5)) >x : Symbol(x, Decl(callWithSpreadES6.ts, 32, 16)) >y : Symbol(y, Decl(callWithSpreadES6.ts, 32, 26)) this.foo(x, y, ...z); ->this.foo : Symbol(foo, Decl(callWithSpreadES6.ts, 35, 5)) +>this.foo : Symbol(C.foo, Decl(callWithSpreadES6.ts, 35, 5)) >this : Symbol(C, Decl(callWithSpreadES6.ts, 29, 40)) ->foo : Symbol(foo, Decl(callWithSpreadES6.ts, 35, 5)) +>foo : Symbol(C.foo, Decl(callWithSpreadES6.ts, 35, 5)) >x : Symbol(x, Decl(callWithSpreadES6.ts, 32, 16)) >y : Symbol(y, Decl(callWithSpreadES6.ts, 32, 26)) >z : Symbol(z, Decl(callWithSpreadES6.ts, 32, 37)) } foo(x: number, y: number, ...z: string[]) { ->foo : Symbol(foo, Decl(callWithSpreadES6.ts, 35, 5)) +>foo : Symbol(C.foo, Decl(callWithSpreadES6.ts, 35, 5)) >x : Symbol(x, Decl(callWithSpreadES6.ts, 36, 8)) >y : Symbol(y, Decl(callWithSpreadES6.ts, 36, 18)) >z : Symbol(z, Decl(callWithSpreadES6.ts, 36, 29)) @@ -143,7 +143,7 @@ class D extends C { >a : Symbol(a, Decl(callWithSpreadES6.ts, 8, 3)) } foo() { ->foo : Symbol(foo, Decl(callWithSpreadES6.ts, 44, 5)) +>foo : Symbol(D.foo, Decl(callWithSpreadES6.ts, 44, 5)) super.foo(1, 2); >super.foo : Symbol(C.foo, Decl(callWithSpreadES6.ts, 35, 5)) diff --git a/tests/baselines/reference/callbackArgsDifferByOptionality.errors.txt b/tests/baselines/reference/callbackArgsDifferByOptionality.errors.txt index 2df02c30185..5ec083a685a 100644 --- a/tests/baselines/reference/callbackArgsDifferByOptionality.errors.txt +++ b/tests/baselines/reference/callbackArgsDifferByOptionality.errors.txt @@ -1,11 +1,8 @@ -tests/cases/compiler/callbackArgsDifferByOptionality.ts(1,23): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. tests/cases/compiler/callbackArgsDifferByOptionality.ts(4,5): error TS2304: Cannot find name 'cb'. -==== tests/cases/compiler/callbackArgsDifferByOptionality.ts (2 errors) ==== +==== tests/cases/compiler/callbackArgsDifferByOptionality.ts (1 errors) ==== function x3(callback: (x?: 'hi') => number); - ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. function x3(callback: (x: string) => number); function x3(callback: (x: any) => number) { cb(); diff --git a/tests/baselines/reference/callbacksDontShareTypes.symbols b/tests/baselines/reference/callbacksDontShareTypes.symbols index 1d7583cec2d..2eded6b880f 100644 --- a/tests/baselines/reference/callbacksDontShareTypes.symbols +++ b/tests/baselines/reference/callbacksDontShareTypes.symbols @@ -4,15 +4,15 @@ interface Collection { >T : Symbol(T, Decl(callbacksDontShareTypes.ts, 0, 21)) length: number; ->length : Symbol(length, Decl(callbacksDontShareTypes.ts, 0, 25)) +>length : Symbol(Collection.length, Decl(callbacksDontShareTypes.ts, 0, 25)) add(x: T): void; ->add : Symbol(add, Decl(callbacksDontShareTypes.ts, 1, 19)) +>add : Symbol(Collection.add, Decl(callbacksDontShareTypes.ts, 1, 19)) >x : Symbol(x, Decl(callbacksDontShareTypes.ts, 2, 8)) >T : Symbol(T, Decl(callbacksDontShareTypes.ts, 0, 21)) remove(x: T): boolean; ->remove : Symbol(remove, Decl(callbacksDontShareTypes.ts, 2, 20)) +>remove : Symbol(Collection.remove, Decl(callbacksDontShareTypes.ts, 2, 20)) >x : Symbol(x, Decl(callbacksDontShareTypes.ts, 3, 11)) >T : Symbol(T, Decl(callbacksDontShareTypes.ts, 0, 21)) } @@ -20,7 +20,7 @@ interface Combinators { >Combinators : Symbol(Combinators, Decl(callbacksDontShareTypes.ts, 4, 1)) map(c: Collection, f: (x: T) => U): Collection; ->map : Symbol(map, Decl(callbacksDontShareTypes.ts, 5, 23), Decl(callbacksDontShareTypes.ts, 6, 63)) +>map : Symbol(Combinators.map, Decl(callbacksDontShareTypes.ts, 5, 23), Decl(callbacksDontShareTypes.ts, 6, 63)) >T : Symbol(T, Decl(callbacksDontShareTypes.ts, 6, 8)) >U : Symbol(U, Decl(callbacksDontShareTypes.ts, 6, 10)) >c : Symbol(c, Decl(callbacksDontShareTypes.ts, 6, 14)) @@ -34,7 +34,7 @@ interface Combinators { >U : Symbol(U, Decl(callbacksDontShareTypes.ts, 6, 10)) map(c: Collection, f: (x: T) => any): Collection; ->map : Symbol(map, Decl(callbacksDontShareTypes.ts, 5, 23), Decl(callbacksDontShareTypes.ts, 6, 63)) +>map : Symbol(Combinators.map, Decl(callbacksDontShareTypes.ts, 5, 23), Decl(callbacksDontShareTypes.ts, 6, 63)) >T : Symbol(T, Decl(callbacksDontShareTypes.ts, 7, 8)) >c : Symbol(c, Decl(callbacksDontShareTypes.ts, 7, 11)) >Collection : Symbol(Collection, Decl(callbacksDontShareTypes.ts, 0, 0)) diff --git a/tests/baselines/reference/captureThisInSuperCall.symbols b/tests/baselines/reference/captureThisInSuperCall.symbols index bf1fd151b3c..84d92c292a9 100644 --- a/tests/baselines/reference/captureThisInSuperCall.symbols +++ b/tests/baselines/reference/captureThisInSuperCall.symbols @@ -13,10 +13,10 @@ class B extends A { constructor() { super({ test: () => this.someMethod()}); } >super : Symbol(A, Decl(captureThisInSuperCall.ts, 0, 0)) >test : Symbol(test, Decl(captureThisInSuperCall.ts, 5, 27)) ->this.someMethod : Symbol(someMethod, Decl(captureThisInSuperCall.ts, 5, 62)) +>this.someMethod : Symbol(B.someMethod, Decl(captureThisInSuperCall.ts, 5, 62)) >this : Symbol(B, Decl(captureThisInSuperCall.ts, 2, 1)) ->someMethod : Symbol(someMethod, Decl(captureThisInSuperCall.ts, 5, 62)) +>someMethod : Symbol(B.someMethod, Decl(captureThisInSuperCall.ts, 5, 62)) someMethod() {} ->someMethod : Symbol(someMethod, Decl(captureThisInSuperCall.ts, 5, 62)) +>someMethod : Symbol(B.someMethod, Decl(captureThisInSuperCall.ts, 5, 62)) } diff --git a/tests/baselines/reference/capturedLetConstInLoop1.js b/tests/baselines/reference/capturedLetConstInLoop1.js index 633b78af510..fe76bdd5c91 100644 --- a/tests/baselines/reference/capturedLetConstInLoop1.js +++ b/tests/baselines/reference/capturedLetConstInLoop1.js @@ -138,7 +138,7 @@ for (var x = 0; x < 1; ++x) { _loop_3(x); } var _loop_4 = function() { - var x = void 0; + var x; (function () { return x; }); (function () { return x; }); }; @@ -146,7 +146,7 @@ while (1 === 1) { _loop_4(); } var _loop_5 = function() { - var x = void 0; + var x; (function () { return x; }); (function () { return x; }); }; @@ -169,7 +169,7 @@ for (var x = 0, y = 1; x < 1; ++x) { _loop_7(x, y); } var _loop_8 = function() { - var x = void 0, y = void 0; + var x, y; (function () { return x + y; }); (function () { return x + y; }); }; @@ -177,7 +177,7 @@ while (1 === 1) { _loop_8(); } var _loop_9 = function() { - var x = void 0, y = void 0; + var x, y; (function () { return x + y; }); (function () { return x + y; }); }; diff --git a/tests/baselines/reference/capturedLetConstInLoop1.types b/tests/baselines/reference/capturedLetConstInLoop1.types index c68f2422f43..bed3db55d7c 100644 --- a/tests/baselines/reference/capturedLetConstInLoop1.types +++ b/tests/baselines/reference/capturedLetConstInLoop1.types @@ -1,18 +1,18 @@ === tests/cases/compiler/capturedLetConstInLoop1.ts === //==== let for (let x in {}) { ->x : any +>x : string >{} : {} (function() { return x}); ->(function() { return x}) : () => any ->function() { return x} : () => any ->x : any +>(function() { return x}) : () => string +>function() { return x} : () => string +>x : string (() => x); ->(() => x) : () => any ->() => x : () => any ->x : any +>(() => x) : () => string +>() => x : () => string +>x : string } for (let x of []) { @@ -216,18 +216,18 @@ for (let y = 0; y < 1; ++y) { //=========const for (const x in {}) { ->x : any +>x : string >{} : {} (function() { return x}); ->(function() { return x}) : () => any ->function() { return x} : () => any ->x : any +>(function() { return x}) : () => string +>function() { return x} : () => string +>x : string (() => x); ->(() => x) : () => any ->() => x : () => any ->x : any +>(() => x) : () => string +>() => x : () => string +>x : string } for (const x of []) { diff --git a/tests/baselines/reference/capturedLetConstInLoop10.symbols b/tests/baselines/reference/capturedLetConstInLoop10.symbols index 124874088a8..3ad860b92ae 100644 --- a/tests/baselines/reference/capturedLetConstInLoop10.symbols +++ b/tests/baselines/reference/capturedLetConstInLoop10.symbols @@ -3,7 +3,7 @@ class A { >A : Symbol(A, Decl(capturedLetConstInLoop10.ts, 0, 0)) foo() { ->foo : Symbol(foo, Decl(capturedLetConstInLoop10.ts, 0, 9)) +>foo : Symbol(A.foo, Decl(capturedLetConstInLoop10.ts, 0, 9)) for (let x of [0]) { >x : Symbol(x, Decl(capturedLetConstInLoop10.ts, 2, 16)) @@ -13,19 +13,19 @@ class A { >x : Symbol(x, Decl(capturedLetConstInLoop10.ts, 2, 16)) this.bar(f()); ->this.bar : Symbol(bar, Decl(capturedLetConstInLoop10.ts, 6, 5)) +>this.bar : Symbol(A.bar, Decl(capturedLetConstInLoop10.ts, 6, 5)) >this : Symbol(A, Decl(capturedLetConstInLoop10.ts, 0, 0)) ->bar : Symbol(bar, Decl(capturedLetConstInLoop10.ts, 6, 5)) +>bar : Symbol(A.bar, Decl(capturedLetConstInLoop10.ts, 6, 5)) >f : Symbol(f, Decl(capturedLetConstInLoop10.ts, 3, 15)) } } bar(a: number) { ->bar : Symbol(bar, Decl(capturedLetConstInLoop10.ts, 6, 5)) +>bar : Symbol(A.bar, Decl(capturedLetConstInLoop10.ts, 6, 5)) >a : Symbol(a, Decl(capturedLetConstInLoop10.ts, 7, 8)) } baz() { ->baz : Symbol(baz, Decl(capturedLetConstInLoop10.ts, 8, 5)) +>baz : Symbol(A.baz, Decl(capturedLetConstInLoop10.ts, 8, 5)) for (let x of [1]) { >x : Symbol(x, Decl(capturedLetConstInLoop10.ts, 11, 16)) @@ -42,20 +42,20 @@ class A { >y : Symbol(y, Decl(capturedLetConstInLoop10.ts, 13, 20)) this.bar(b()); ->this.bar : Symbol(bar, Decl(capturedLetConstInLoop10.ts, 6, 5)) +>this.bar : Symbol(A.bar, Decl(capturedLetConstInLoop10.ts, 6, 5)) >this : Symbol(A, Decl(capturedLetConstInLoop10.ts, 0, 0)) ->bar : Symbol(bar, Decl(capturedLetConstInLoop10.ts, 6, 5)) +>bar : Symbol(A.bar, Decl(capturedLetConstInLoop10.ts, 6, 5)) >b : Symbol(b, Decl(capturedLetConstInLoop10.ts, 14, 19)) } this.bar(a()); ->this.bar : Symbol(bar, Decl(capturedLetConstInLoop10.ts, 6, 5)) +>this.bar : Symbol(A.bar, Decl(capturedLetConstInLoop10.ts, 6, 5)) >this : Symbol(A, Decl(capturedLetConstInLoop10.ts, 0, 0)) ->bar : Symbol(bar, Decl(capturedLetConstInLoop10.ts, 6, 5)) +>bar : Symbol(A.bar, Decl(capturedLetConstInLoop10.ts, 6, 5)) >a : Symbol(a, Decl(capturedLetConstInLoop10.ts, 12, 15)) } } baz2() { ->baz2 : Symbol(baz2, Decl(capturedLetConstInLoop10.ts, 19, 5)) +>baz2 : Symbol(A.baz2, Decl(capturedLetConstInLoop10.ts, 19, 5)) for (let x of [1]) { >x : Symbol(x, Decl(capturedLetConstInLoop10.ts, 21, 16)) @@ -65,9 +65,9 @@ class A { >x : Symbol(x, Decl(capturedLetConstInLoop10.ts, 21, 16)) this.bar(a()); ->this.bar : Symbol(bar, Decl(capturedLetConstInLoop10.ts, 6, 5)) +>this.bar : Symbol(A.bar, Decl(capturedLetConstInLoop10.ts, 6, 5)) >this : Symbol(A, Decl(capturedLetConstInLoop10.ts, 0, 0)) ->bar : Symbol(bar, Decl(capturedLetConstInLoop10.ts, 6, 5)) +>bar : Symbol(A.bar, Decl(capturedLetConstInLoop10.ts, 6, 5)) >a : Symbol(a, Decl(capturedLetConstInLoop10.ts, 22, 15)) for (let y of [1]) { @@ -78,9 +78,9 @@ class A { >y : Symbol(y, Decl(capturedLetConstInLoop10.ts, 24, 20)) this.bar(b()); ->this.bar : Symbol(bar, Decl(capturedLetConstInLoop10.ts, 6, 5)) +>this.bar : Symbol(A.bar, Decl(capturedLetConstInLoop10.ts, 6, 5)) >this : Symbol(A, Decl(capturedLetConstInLoop10.ts, 0, 0)) ->bar : Symbol(bar, Decl(capturedLetConstInLoop10.ts, 6, 5)) +>bar : Symbol(A.bar, Decl(capturedLetConstInLoop10.ts, 6, 5)) >b : Symbol(b, Decl(capturedLetConstInLoop10.ts, 25, 19)) } } @@ -91,7 +91,7 @@ class B { >B : Symbol(B, Decl(capturedLetConstInLoop10.ts, 30, 1)) foo() { ->foo : Symbol(foo, Decl(capturedLetConstInLoop10.ts, 32, 9)) +>foo : Symbol(B.foo, Decl(capturedLetConstInLoop10.ts, 32, 9)) let a = >a : Symbol(a, Decl(capturedLetConstInLoop10.ts, 34, 11)) @@ -105,15 +105,15 @@ class B { >x : Symbol(x, Decl(capturedLetConstInLoop10.ts, 36, 24)) this.bar(f()); ->this.bar : Symbol(bar, Decl(capturedLetConstInLoop10.ts, 41, 5)) +>this.bar : Symbol(B.bar, Decl(capturedLetConstInLoop10.ts, 41, 5)) >this : Symbol(B, Decl(capturedLetConstInLoop10.ts, 30, 1)) ->bar : Symbol(bar, Decl(capturedLetConstInLoop10.ts, 41, 5)) +>bar : Symbol(B.bar, Decl(capturedLetConstInLoop10.ts, 41, 5)) >f : Symbol(f, Decl(capturedLetConstInLoop10.ts, 37, 23)) } } } bar(a: number) { ->bar : Symbol(bar, Decl(capturedLetConstInLoop10.ts, 41, 5)) +>bar : Symbol(B.bar, Decl(capturedLetConstInLoop10.ts, 41, 5)) >a : Symbol(a, Decl(capturedLetConstInLoop10.ts, 42, 8)) } } diff --git a/tests/baselines/reference/capturedLetConstInLoop10_ES6.symbols b/tests/baselines/reference/capturedLetConstInLoop10_ES6.symbols index f0cf92ff96b..8ca14c806a3 100644 --- a/tests/baselines/reference/capturedLetConstInLoop10_ES6.symbols +++ b/tests/baselines/reference/capturedLetConstInLoop10_ES6.symbols @@ -3,7 +3,7 @@ class A { >A : Symbol(A, Decl(capturedLetConstInLoop10_ES6.ts, 0, 0)) foo() { ->foo : Symbol(foo, Decl(capturedLetConstInLoop10_ES6.ts, 0, 9)) +>foo : Symbol(A.foo, Decl(capturedLetConstInLoop10_ES6.ts, 0, 9)) for (let x of [0]) { >x : Symbol(x, Decl(capturedLetConstInLoop10_ES6.ts, 2, 16)) @@ -13,19 +13,19 @@ class A { >x : Symbol(x, Decl(capturedLetConstInLoop10_ES6.ts, 2, 16)) this.bar(f()); ->this.bar : Symbol(bar, Decl(capturedLetConstInLoop10_ES6.ts, 6, 5)) +>this.bar : Symbol(A.bar, Decl(capturedLetConstInLoop10_ES6.ts, 6, 5)) >this : Symbol(A, Decl(capturedLetConstInLoop10_ES6.ts, 0, 0)) ->bar : Symbol(bar, Decl(capturedLetConstInLoop10_ES6.ts, 6, 5)) +>bar : Symbol(A.bar, Decl(capturedLetConstInLoop10_ES6.ts, 6, 5)) >f : Symbol(f, Decl(capturedLetConstInLoop10_ES6.ts, 3, 15)) } } bar(a: number) { ->bar : Symbol(bar, Decl(capturedLetConstInLoop10_ES6.ts, 6, 5)) +>bar : Symbol(A.bar, Decl(capturedLetConstInLoop10_ES6.ts, 6, 5)) >a : Symbol(a, Decl(capturedLetConstInLoop10_ES6.ts, 7, 8)) } baz() { ->baz : Symbol(baz, Decl(capturedLetConstInLoop10_ES6.ts, 8, 5)) +>baz : Symbol(A.baz, Decl(capturedLetConstInLoop10_ES6.ts, 8, 5)) for (let x of [1]) { >x : Symbol(x, Decl(capturedLetConstInLoop10_ES6.ts, 11, 16)) @@ -42,20 +42,20 @@ class A { >y : Symbol(y, Decl(capturedLetConstInLoop10_ES6.ts, 13, 20)) this.bar(b()); ->this.bar : Symbol(bar, Decl(capturedLetConstInLoop10_ES6.ts, 6, 5)) +>this.bar : Symbol(A.bar, Decl(capturedLetConstInLoop10_ES6.ts, 6, 5)) >this : Symbol(A, Decl(capturedLetConstInLoop10_ES6.ts, 0, 0)) ->bar : Symbol(bar, Decl(capturedLetConstInLoop10_ES6.ts, 6, 5)) +>bar : Symbol(A.bar, Decl(capturedLetConstInLoop10_ES6.ts, 6, 5)) >b : Symbol(b, Decl(capturedLetConstInLoop10_ES6.ts, 14, 19)) } this.bar(a()); ->this.bar : Symbol(bar, Decl(capturedLetConstInLoop10_ES6.ts, 6, 5)) +>this.bar : Symbol(A.bar, Decl(capturedLetConstInLoop10_ES6.ts, 6, 5)) >this : Symbol(A, Decl(capturedLetConstInLoop10_ES6.ts, 0, 0)) ->bar : Symbol(bar, Decl(capturedLetConstInLoop10_ES6.ts, 6, 5)) +>bar : Symbol(A.bar, Decl(capturedLetConstInLoop10_ES6.ts, 6, 5)) >a : Symbol(a, Decl(capturedLetConstInLoop10_ES6.ts, 12, 15)) } } baz2() { ->baz2 : Symbol(baz2, Decl(capturedLetConstInLoop10_ES6.ts, 19, 5)) +>baz2 : Symbol(A.baz2, Decl(capturedLetConstInLoop10_ES6.ts, 19, 5)) for (let x of [1]) { >x : Symbol(x, Decl(capturedLetConstInLoop10_ES6.ts, 21, 16)) @@ -65,9 +65,9 @@ class A { >x : Symbol(x, Decl(capturedLetConstInLoop10_ES6.ts, 21, 16)) this.bar(a()); ->this.bar : Symbol(bar, Decl(capturedLetConstInLoop10_ES6.ts, 6, 5)) +>this.bar : Symbol(A.bar, Decl(capturedLetConstInLoop10_ES6.ts, 6, 5)) >this : Symbol(A, Decl(capturedLetConstInLoop10_ES6.ts, 0, 0)) ->bar : Symbol(bar, Decl(capturedLetConstInLoop10_ES6.ts, 6, 5)) +>bar : Symbol(A.bar, Decl(capturedLetConstInLoop10_ES6.ts, 6, 5)) >a : Symbol(a, Decl(capturedLetConstInLoop10_ES6.ts, 22, 15)) for (let y of [1]) { @@ -78,9 +78,9 @@ class A { >y : Symbol(y, Decl(capturedLetConstInLoop10_ES6.ts, 24, 20)) this.bar(b()); ->this.bar : Symbol(bar, Decl(capturedLetConstInLoop10_ES6.ts, 6, 5)) +>this.bar : Symbol(A.bar, Decl(capturedLetConstInLoop10_ES6.ts, 6, 5)) >this : Symbol(A, Decl(capturedLetConstInLoop10_ES6.ts, 0, 0)) ->bar : Symbol(bar, Decl(capturedLetConstInLoop10_ES6.ts, 6, 5)) +>bar : Symbol(A.bar, Decl(capturedLetConstInLoop10_ES6.ts, 6, 5)) >b : Symbol(b, Decl(capturedLetConstInLoop10_ES6.ts, 25, 19)) } } @@ -91,7 +91,7 @@ class B { >B : Symbol(B, Decl(capturedLetConstInLoop10_ES6.ts, 30, 1)) foo() { ->foo : Symbol(foo, Decl(capturedLetConstInLoop10_ES6.ts, 32, 9)) +>foo : Symbol(B.foo, Decl(capturedLetConstInLoop10_ES6.ts, 32, 9)) let a = >a : Symbol(a, Decl(capturedLetConstInLoop10_ES6.ts, 34, 11)) @@ -105,15 +105,15 @@ class B { >x : Symbol(x, Decl(capturedLetConstInLoop10_ES6.ts, 36, 24)) this.bar(f()); ->this.bar : Symbol(bar, Decl(capturedLetConstInLoop10_ES6.ts, 41, 5)) +>this.bar : Symbol(B.bar, Decl(capturedLetConstInLoop10_ES6.ts, 41, 5)) >this : Symbol(B, Decl(capturedLetConstInLoop10_ES6.ts, 30, 1)) ->bar : Symbol(bar, Decl(capturedLetConstInLoop10_ES6.ts, 41, 5)) +>bar : Symbol(B.bar, Decl(capturedLetConstInLoop10_ES6.ts, 41, 5)) >f : Symbol(f, Decl(capturedLetConstInLoop10_ES6.ts, 37, 23)) } } } bar(a: number) { ->bar : Symbol(bar, Decl(capturedLetConstInLoop10_ES6.ts, 41, 5)) +>bar : Symbol(B.bar, Decl(capturedLetConstInLoop10_ES6.ts, 41, 5)) >a : Symbol(a, Decl(capturedLetConstInLoop10_ES6.ts, 42, 8)) } } diff --git a/tests/baselines/reference/capturedLetConstInLoop11.js b/tests/baselines/reference/capturedLetConstInLoop11.js new file mode 100644 index 00000000000..9190dd3ec02 --- /dev/null +++ b/tests/baselines/reference/capturedLetConstInLoop11.js @@ -0,0 +1,35 @@ +//// [capturedLetConstInLoop11.ts] +for (;;) { + let x = 1; + () => x; +} + +function foo() { + for (;;) { + const a = 0; + switch(a) { + case 0: return () => a; + } + } +} + +//// [capturedLetConstInLoop11.js] +var _loop_1 = function() { + var x = 1; + (function () { return x; }); +}; +for (;;) { + _loop_1(); +} +function foo() { + var _loop_2 = function() { + var a = 0; + switch (a) { + case 0: return { value: function () { return a; } }; + } + }; + for (;;) { + var state_2 = _loop_2(); + if (typeof state_2 === "object") return state_2.value; + } +} diff --git a/tests/baselines/reference/capturedLetConstInLoop11.symbols b/tests/baselines/reference/capturedLetConstInLoop11.symbols new file mode 100644 index 00000000000..2e242906b73 --- /dev/null +++ b/tests/baselines/reference/capturedLetConstInLoop11.symbols @@ -0,0 +1,24 @@ +=== tests/cases/compiler/capturedLetConstInLoop11.ts === +for (;;) { + let x = 1; +>x : Symbol(x, Decl(capturedLetConstInLoop11.ts, 1, 7)) + + () => x; +>x : Symbol(x, Decl(capturedLetConstInLoop11.ts, 1, 7)) +} + +function foo() { +>foo : Symbol(foo, Decl(capturedLetConstInLoop11.ts, 3, 1)) + + for (;;) { + const a = 0; +>a : Symbol(a, Decl(capturedLetConstInLoop11.ts, 7, 13)) + + switch(a) { +>a : Symbol(a, Decl(capturedLetConstInLoop11.ts, 7, 13)) + + case 0: return () => a; +>a : Symbol(a, Decl(capturedLetConstInLoop11.ts, 7, 13)) + } + } +} diff --git a/tests/baselines/reference/capturedLetConstInLoop11.types b/tests/baselines/reference/capturedLetConstInLoop11.types new file mode 100644 index 00000000000..93e18f2cb27 --- /dev/null +++ b/tests/baselines/reference/capturedLetConstInLoop11.types @@ -0,0 +1,29 @@ +=== tests/cases/compiler/capturedLetConstInLoop11.ts === +for (;;) { + let x = 1; +>x : number +>1 : number + + () => x; +>() => x : () => number +>x : number +} + +function foo() { +>foo : () => () => number + + for (;;) { + const a = 0; +>a : number +>0 : number + + switch(a) { +>a : number + + case 0: return () => a; +>0 : number +>() => a : () => number +>a : number + } + } +} diff --git a/tests/baselines/reference/capturedLetConstInLoop11_ES6.js b/tests/baselines/reference/capturedLetConstInLoop11_ES6.js new file mode 100644 index 00000000000..49f6e9f5214 --- /dev/null +++ b/tests/baselines/reference/capturedLetConstInLoop11_ES6.js @@ -0,0 +1,28 @@ +//// [capturedLetConstInLoop11_ES6.ts] +for (;;) { + let x = 1; + () => x; +} + +function foo() { + for (;;) { + const a = 0; + switch(a) { + case 0: return () => a; + } + } +} + +//// [capturedLetConstInLoop11_ES6.js] +for (;;) { + let x = 1; + (() => x); +} +function foo() { + for (;;) { + const a = 0; + switch (a) { + case 0: return () => a; + } + } +} diff --git a/tests/baselines/reference/capturedLetConstInLoop11_ES6.symbols b/tests/baselines/reference/capturedLetConstInLoop11_ES6.symbols new file mode 100644 index 00000000000..6079bf490a3 --- /dev/null +++ b/tests/baselines/reference/capturedLetConstInLoop11_ES6.symbols @@ -0,0 +1,24 @@ +=== tests/cases/compiler/capturedLetConstInLoop11_ES6.ts === +for (;;) { + let x = 1; +>x : Symbol(x, Decl(capturedLetConstInLoop11_ES6.ts, 1, 7)) + + () => x; +>x : Symbol(x, Decl(capturedLetConstInLoop11_ES6.ts, 1, 7)) +} + +function foo() { +>foo : Symbol(foo, Decl(capturedLetConstInLoop11_ES6.ts, 3, 1)) + + for (;;) { + const a = 0; +>a : Symbol(a, Decl(capturedLetConstInLoop11_ES6.ts, 7, 13)) + + switch(a) { +>a : Symbol(a, Decl(capturedLetConstInLoop11_ES6.ts, 7, 13)) + + case 0: return () => a; +>a : Symbol(a, Decl(capturedLetConstInLoop11_ES6.ts, 7, 13)) + } + } +} diff --git a/tests/baselines/reference/capturedLetConstInLoop11_ES6.types b/tests/baselines/reference/capturedLetConstInLoop11_ES6.types new file mode 100644 index 00000000000..de75d5d1511 --- /dev/null +++ b/tests/baselines/reference/capturedLetConstInLoop11_ES6.types @@ -0,0 +1,29 @@ +=== tests/cases/compiler/capturedLetConstInLoop11_ES6.ts === +for (;;) { + let x = 1; +>x : number +>1 : number + + () => x; +>() => x : () => number +>x : number +} + +function foo() { +>foo : () => () => number + + for (;;) { + const a = 0; +>a : number +>0 : number + + switch(a) { +>a : number + + case 0: return () => a; +>0 : number +>() => a : () => number +>a : number + } + } +} diff --git a/tests/baselines/reference/capturedLetConstInLoop12.js b/tests/baselines/reference/capturedLetConstInLoop12.js new file mode 100644 index 00000000000..7235c959a59 --- /dev/null +++ b/tests/baselines/reference/capturedLetConstInLoop12.js @@ -0,0 +1,42 @@ +//// [capturedLetConstInLoop12.ts] +(function() { + "use strict"; + + for (let i = 0; i < 4; i++) { + (() => [i] = [i + 1])(); + } +})(); + +(function() { + "use strict"; + + for (let i = 0; i < 4; i++) { + (() => ({a:i} = {a:i + 1}))(); + } +})(); + +//// [capturedLetConstInLoop12.js] +(function () { + "use strict"; + var _loop_1 = function(i) { + (function () { return (_a = [i + 1], i = _a[0], _a); var _a; })(); + out_i_1 = i; + }; + var out_i_1; + for (var i = 0; i < 4; i++) { + _loop_1(i); + i = out_i_1; + } +})(); +(function () { + "use strict"; + var _loop_2 = function(i) { + (function () { return (_a = { a: i + 1 }, i = _a.a, _a); var _a; })(); + out_i_2 = i; + }; + var out_i_2; + for (var i = 0; i < 4; i++) { + _loop_2(i); + i = out_i_2; + } +})(); diff --git a/tests/baselines/reference/capturedLetConstInLoop12.symbols b/tests/baselines/reference/capturedLetConstInLoop12.symbols new file mode 100644 index 00000000000..8c0338ea84e --- /dev/null +++ b/tests/baselines/reference/capturedLetConstInLoop12.symbols @@ -0,0 +1,30 @@ +=== tests/cases/compiler/capturedLetConstInLoop12.ts === +(function() { + "use strict"; + + for (let i = 0; i < 4; i++) { +>i : Symbol(i, Decl(capturedLetConstInLoop12.ts, 3, 12)) +>i : Symbol(i, Decl(capturedLetConstInLoop12.ts, 3, 12)) +>i : Symbol(i, Decl(capturedLetConstInLoop12.ts, 3, 12)) + + (() => [i] = [i + 1])(); +>i : Symbol(i, Decl(capturedLetConstInLoop12.ts, 3, 12)) +>i : Symbol(i, Decl(capturedLetConstInLoop12.ts, 3, 12)) + } +})(); + +(function() { + "use strict"; + + for (let i = 0; i < 4; i++) { +>i : Symbol(i, Decl(capturedLetConstInLoop12.ts, 11, 12)) +>i : Symbol(i, Decl(capturedLetConstInLoop12.ts, 11, 12)) +>i : Symbol(i, Decl(capturedLetConstInLoop12.ts, 11, 12)) + + (() => ({a:i} = {a:i + 1}))(); +>a : Symbol(a, Decl(capturedLetConstInLoop12.ts, 12, 17)) +>i : Symbol(i, Decl(capturedLetConstInLoop12.ts, 11, 12)) +>a : Symbol(a, Decl(capturedLetConstInLoop12.ts, 12, 25)) +>i : Symbol(i, Decl(capturedLetConstInLoop12.ts, 11, 12)) + } +})(); diff --git a/tests/baselines/reference/capturedLetConstInLoop12.types b/tests/baselines/reference/capturedLetConstInLoop12.types new file mode 100644 index 00000000000..aee671b4d36 --- /dev/null +++ b/tests/baselines/reference/capturedLetConstInLoop12.types @@ -0,0 +1,65 @@ +=== tests/cases/compiler/capturedLetConstInLoop12.ts === +(function() { +>(function() { "use strict"; for (let i = 0; i < 4; i++) { (() => [i] = [i + 1])(); }})() : void +>(function() { "use strict"; for (let i = 0; i < 4; i++) { (() => [i] = [i + 1])(); }}) : () => void +>function() { "use strict"; for (let i = 0; i < 4; i++) { (() => [i] = [i + 1])(); }} : () => void + + "use strict"; +>"use strict" : string + + for (let i = 0; i < 4; i++) { +>i : number +>0 : number +>i < 4 : boolean +>i : number +>4 : number +>i++ : number +>i : number + + (() => [i] = [i + 1])(); +>(() => [i] = [i + 1])() : [number] +>(() => [i] = [i + 1]) : () => [number] +>() => [i] = [i + 1] : () => [number] +>[i] = [i + 1] : [number] +>[i] : [number] +>i : number +>[i + 1] : [number] +>i + 1 : number +>i : number +>1 : number + } +})(); + +(function() { +>(function() { "use strict"; for (let i = 0; i < 4; i++) { (() => ({a:i} = {a:i + 1}))(); }})() : void +>(function() { "use strict"; for (let i = 0; i < 4; i++) { (() => ({a:i} = {a:i + 1}))(); }}) : () => void +>function() { "use strict"; for (let i = 0; i < 4; i++) { (() => ({a:i} = {a:i + 1}))(); }} : () => void + + "use strict"; +>"use strict" : string + + for (let i = 0; i < 4; i++) { +>i : number +>0 : number +>i < 4 : boolean +>i : number +>4 : number +>i++ : number +>i : number + + (() => ({a:i} = {a:i + 1}))(); +>(() => ({a:i} = {a:i + 1}))() : { a: number; } +>(() => ({a:i} = {a:i + 1})) : () => { a: number; } +>() => ({a:i} = {a:i + 1}) : () => { a: number; } +>({a:i} = {a:i + 1}) : { a: number; } +>{a:i} = {a:i + 1} : { a: number; } +>{a:i} : { a: number; } +>a : number +>i : number +>{a:i + 1} : { a: number; } +>a : number +>i + 1 : number +>i : number +>1 : number + } +})(); diff --git a/tests/baselines/reference/capturedLetConstInLoop1_ES6.types b/tests/baselines/reference/capturedLetConstInLoop1_ES6.types index 5e25e1f930d..47b12586684 100644 --- a/tests/baselines/reference/capturedLetConstInLoop1_ES6.types +++ b/tests/baselines/reference/capturedLetConstInLoop1_ES6.types @@ -1,18 +1,18 @@ === tests/cases/compiler/capturedLetConstInLoop1_ES6.ts === //==== let for (let x in {}) { ->x : any +>x : string >{} : {} (function() { return x}); ->(function() { return x}) : () => any ->function() { return x} : () => any ->x : any +>(function() { return x}) : () => string +>function() { return x} : () => string +>x : string (() => x); ->(() => x) : () => any ->() => x : () => any ->x : any +>(() => x) : () => string +>() => x : () => string +>x : string } for (let x of []) { @@ -216,18 +216,18 @@ for (let y = 0; y < 1; ++y) { //=========const for (const x in {}) { ->x : any +>x : string >{} : {} (function() { return x}); ->(function() { return x}) : () => any ->function() { return x} : () => any ->x : any +>(function() { return x}) : () => string +>function() { return x} : () => string +>x : string (() => x); ->(() => x) : () => any ->() => x : () => any ->x : any +>(() => x) : () => string +>() => x : () => string +>x : string } for (const x of []) { diff --git a/tests/baselines/reference/capturedLetConstInLoop2.js b/tests/baselines/reference/capturedLetConstInLoop2.js index b9fbcf46f57..b41dd380a24 100644 --- a/tests/baselines/reference/capturedLetConstInLoop2.js +++ b/tests/baselines/reference/capturedLetConstInLoop2.js @@ -225,7 +225,7 @@ function foo2(x) { } function foo3(x) { var _loop_5 = function() { - var x_4 = void 0; + var x_4; var a = arguments_5.length; (function () { return x_4 + a; }); (function () { return x_4 + a; }); @@ -260,7 +260,7 @@ function foo5(x) { } function foo6(x) { var _loop_8 = function() { - var x_7 = void 0, y = void 0; + var x_7, y; var a = arguments_8.length; (function () { return x_7 + y + a; }); (function () { return x_7 + y + a; }); @@ -272,7 +272,7 @@ function foo6(x) { } function foo7(x) { var _loop_9 = function() { - var x_8 = void 0, y = void 0; + var x_8, y; var a = arguments_9.length; (function () { return x_8 + y + a; }); (function () { return x_8 + y + a; }); diff --git a/tests/baselines/reference/capturedLetConstInLoop2.types b/tests/baselines/reference/capturedLetConstInLoop2.types index 5108fc399ee..2872eb4c763 100644 --- a/tests/baselines/reference/capturedLetConstInLoop2.types +++ b/tests/baselines/reference/capturedLetConstInLoop2.types @@ -37,7 +37,7 @@ function foo0_1(x) { >x : any for (let x in []) { ->x : any +>x : string >[] : undefined[] let a = arguments.length; @@ -47,17 +47,17 @@ function foo0_1(x) { >length : number (function() { return x + a }); ->(function() { return x + a }) : () => any ->function() { return x + a } : () => any ->x + a : any ->x : any +>(function() { return x + a }) : () => string +>function() { return x + a } : () => string +>x + a : string +>x : string >a : number (() => x + a); ->(() => x + a) : () => any ->() => x + a : () => any ->x + a : any ->x : any +>(() => x + a) : () => string +>() => x + a : () => string +>x + a : string +>x : string >a : number } } @@ -400,7 +400,7 @@ function foo0_1_c(x) { >x : any for (const x in []) { ->x : any +>x : string >[] : undefined[] const a = arguments.length; @@ -410,17 +410,17 @@ function foo0_1_c(x) { >length : number (function() { return x + a }); ->(function() { return x + a }) : () => any ->function() { return x + a } : () => any ->x + a : any ->x : any +>(function() { return x + a }) : () => string +>function() { return x + a } : () => string +>x + a : string +>x : string >a : number (() => x + a); ->(() => x + a) : () => any ->() => x + a : () => any ->x + a : any ->x : any +>(() => x + a) : () => string +>() => x + a : () => string +>x + a : string +>x : string >a : number } } diff --git a/tests/baselines/reference/capturedLetConstInLoop2_ES6.symbols b/tests/baselines/reference/capturedLetConstInLoop2_ES6.symbols index 32812c89370..0dd74bc4b25 100644 --- a/tests/baselines/reference/capturedLetConstInLoop2_ES6.symbols +++ b/tests/baselines/reference/capturedLetConstInLoop2_ES6.symbols @@ -10,9 +10,9 @@ function foo0(x) { let a = arguments.length; >a : Symbol(a, Decl(capturedLetConstInLoop2_ES6.ts, 4, 11)) ->arguments.length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>arguments.length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) >arguments : Symbol(arguments) ->length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) (function() { return x + a }); >x : Symbol(x, Decl(capturedLetConstInLoop2_ES6.ts, 3, 12)) @@ -33,9 +33,9 @@ function foo0_1(x) { let a = arguments.length; >a : Symbol(a, Decl(capturedLetConstInLoop2_ES6.ts, 12, 11)) ->arguments.length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>arguments.length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) >arguments : Symbol(arguments) ->length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) (function() { return x + a }); >x : Symbol(x, Decl(capturedLetConstInLoop2_ES6.ts, 11, 12)) @@ -58,9 +58,9 @@ function foo1(x) { let a = arguments.length; >a : Symbol(a, Decl(capturedLetConstInLoop2_ES6.ts, 20, 11)) ->arguments.length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>arguments.length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) >arguments : Symbol(arguments) ->length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) (function() { return x + a }); >x : Symbol(x, Decl(capturedLetConstInLoop2_ES6.ts, 19, 12)) @@ -79,9 +79,9 @@ function foo2(x) { while (1 === 1) { let a = arguments.length; >a : Symbol(a, Decl(capturedLetConstInLoop2_ES6.ts, 28, 11)) ->arguments.length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>arguments.length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) >arguments : Symbol(arguments) ->length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) (function() { return x + a }); >x : Symbol(x, Decl(capturedLetConstInLoop2_ES6.ts, 26, 14)) @@ -103,9 +103,9 @@ function foo3(x) { let a = arguments.length; >a : Symbol(a, Decl(capturedLetConstInLoop2_ES6.ts, 37, 11)) ->arguments.length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>arguments.length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) >arguments : Symbol(arguments) ->length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) (function() { return x + a }); >x : Symbol(x, Decl(capturedLetConstInLoop2_ES6.ts, 36, 11)) @@ -129,9 +129,9 @@ function foo4(x) { let a = arguments.length; >a : Symbol(a, Decl(capturedLetConstInLoop2_ES6.ts, 45, 11)) ->arguments.length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>arguments.length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) >arguments : Symbol(arguments) ->length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) let x = 1; >x : Symbol(x, Decl(capturedLetConstInLoop2_ES6.ts, 46, 11)) @@ -158,9 +158,9 @@ function foo5(x) { let a = arguments.length; >a : Symbol(a, Decl(capturedLetConstInLoop2_ES6.ts, 54, 11)) ->arguments.length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>arguments.length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) >arguments : Symbol(arguments) ->length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) (function() { return x + y + a }); >x : Symbol(x, Decl(capturedLetConstInLoop2_ES6.ts, 53, 12)) @@ -186,9 +186,9 @@ function foo6(x) { let a = arguments.length; >a : Symbol(a, Decl(capturedLetConstInLoop2_ES6.ts, 64, 11)) ->arguments.length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>arguments.length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) >arguments : Symbol(arguments) ->length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) (function() { return x + y + a }); >x : Symbol(x, Decl(capturedLetConstInLoop2_ES6.ts, 63, 11)) @@ -213,9 +213,9 @@ function foo7(x) { let a = arguments.length; >a : Symbol(a, Decl(capturedLetConstInLoop2_ES6.ts, 73, 11)) ->arguments.length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>arguments.length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) >arguments : Symbol(arguments) ->length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) (function() { return x + y + a }); >x : Symbol(x, Decl(capturedLetConstInLoop2_ES6.ts, 72, 11)) @@ -245,9 +245,9 @@ function foo8(x) { let a = arguments.length; >a : Symbol(a, Decl(capturedLetConstInLoop2_ES6.ts, 83, 11)) ->arguments.length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>arguments.length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) >arguments : Symbol(arguments) ->length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) (function() { return x + y + a }); >x : Symbol(x, Decl(capturedLetConstInLoop2_ES6.ts, 82, 11)) @@ -270,9 +270,9 @@ function foo0_c(x) { const a = arguments.length; >a : Symbol(a, Decl(capturedLetConstInLoop2_ES6.ts, 91, 13)) ->arguments.length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>arguments.length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) >arguments : Symbol(arguments) ->length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) (function() { return x + a }); >x : Symbol(x, Decl(capturedLetConstInLoop2_ES6.ts, 90, 14)) @@ -293,9 +293,9 @@ function foo0_1_c(x) { const a = arguments.length; >a : Symbol(a, Decl(capturedLetConstInLoop2_ES6.ts, 99, 13)) ->arguments.length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>arguments.length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) >arguments : Symbol(arguments) ->length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) (function() { return x + a }); >x : Symbol(x, Decl(capturedLetConstInLoop2_ES6.ts, 98, 14)) @@ -317,9 +317,9 @@ function foo1_c(x) { const a = arguments.length; >a : Symbol(a, Decl(capturedLetConstInLoop2_ES6.ts, 107, 13)) ->arguments.length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>arguments.length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) >arguments : Symbol(arguments) ->length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) (function() { return x + a }); >x : Symbol(x, Decl(capturedLetConstInLoop2_ES6.ts, 106, 14)) @@ -338,9 +338,9 @@ function foo2_c(x) { while (1 === 1) { const a = arguments.length; >a : Symbol(a, Decl(capturedLetConstInLoop2_ES6.ts, 115, 13)) ->arguments.length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>arguments.length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) >arguments : Symbol(arguments) ->length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) (function() { return x + a }); >x : Symbol(x, Decl(capturedLetConstInLoop2_ES6.ts, 113, 16)) @@ -362,9 +362,9 @@ function foo3_c(x) { const a = arguments.length; >a : Symbol(a, Decl(capturedLetConstInLoop2_ES6.ts, 124, 13)) ->arguments.length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>arguments.length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) >arguments : Symbol(arguments) ->length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) (function() { return x + a }); >x : Symbol(x, Decl(capturedLetConstInLoop2_ES6.ts, 123, 13)) @@ -387,9 +387,9 @@ function foo4_c(x) { const a = arguments.length; >a : Symbol(a, Decl(capturedLetConstInLoop2_ES6.ts, 132, 13)) ->arguments.length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>arguments.length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) >arguments : Symbol(arguments) ->length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) const x = 1; >x : Symbol(x, Decl(capturedLetConstInLoop2_ES6.ts, 133, 13)) @@ -415,9 +415,9 @@ function foo5_c(x) { const a = arguments.length; >a : Symbol(a, Decl(capturedLetConstInLoop2_ES6.ts, 141, 13)) ->arguments.length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>arguments.length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) >arguments : Symbol(arguments) ->length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) (function() { return x + y + a }); >x : Symbol(x, Decl(capturedLetConstInLoop2_ES6.ts, 140, 14)) @@ -443,9 +443,9 @@ function foo6_c(x) { const a = arguments.length; >a : Symbol(a, Decl(capturedLetConstInLoop2_ES6.ts, 151, 13)) ->arguments.length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>arguments.length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) >arguments : Symbol(arguments) ->length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) (function() { return x + y + a }); >x : Symbol(x, Decl(capturedLetConstInLoop2_ES6.ts, 150, 13)) @@ -470,9 +470,9 @@ function foo7_c(x) { const a = arguments.length; >a : Symbol(a, Decl(capturedLetConstInLoop2_ES6.ts, 160, 13)) ->arguments.length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>arguments.length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) >arguments : Symbol(arguments) ->length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) (function() { return x + y + a }); >x : Symbol(x, Decl(capturedLetConstInLoop2_ES6.ts, 159, 13)) @@ -501,9 +501,9 @@ function foo8_c(x) { const a = arguments.length; >a : Symbol(a, Decl(capturedLetConstInLoop2_ES6.ts, 170, 13)) ->arguments.length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>arguments.length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) >arguments : Symbol(arguments) ->length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) (function() { return x + y + a }); >x : Symbol(x, Decl(capturedLetConstInLoop2_ES6.ts, 169, 13)) diff --git a/tests/baselines/reference/capturedLetConstInLoop2_ES6.types b/tests/baselines/reference/capturedLetConstInLoop2_ES6.types index 9fea265da44..8a4d9c82628 100644 --- a/tests/baselines/reference/capturedLetConstInLoop2_ES6.types +++ b/tests/baselines/reference/capturedLetConstInLoop2_ES6.types @@ -36,7 +36,7 @@ function foo0_1(x) { >x : any for (let x in []) { ->x : any +>x : string >[] : undefined[] let a = arguments.length; @@ -46,17 +46,17 @@ function foo0_1(x) { >length : number (function() { return x + a }); ->(function() { return x + a }) : () => any ->function() { return x + a } : () => any ->x + a : any ->x : any +>(function() { return x + a }) : () => string +>function() { return x + a } : () => string +>x + a : string +>x : string >a : number (() => x + a); ->(() => x + a) : () => any ->() => x + a : () => any ->x + a : any ->x : any +>(() => x + a) : () => string +>() => x + a : () => string +>x + a : string +>x : string >a : number } } @@ -399,7 +399,7 @@ function foo0_1_c(x) { >x : any for (const x in []) { ->x : any +>x : string >[] : undefined[] const a = arguments.length; @@ -409,17 +409,17 @@ function foo0_1_c(x) { >length : number (function() { return x + a }); ->(function() { return x + a }) : () => any ->function() { return x + a } : () => any ->x + a : any ->x : any +>(function() { return x + a }) : () => string +>function() { return x + a } : () => string +>x + a : string +>x : string >a : number (() => x + a); ->(() => x + a) : () => any ->() => x + a : () => any ->x + a : any ->x : any +>(() => x + a) : () => string +>() => x + a : () => string +>x + a : string +>x : string >a : number } } diff --git a/tests/baselines/reference/capturedLetConstInLoop3.js b/tests/baselines/reference/capturedLetConstInLoop3.js index b38c12967dd..233dfe9206c 100644 --- a/tests/baselines/reference/capturedLetConstInLoop3.js +++ b/tests/baselines/reference/capturedLetConstInLoop3.js @@ -270,7 +270,7 @@ function foo2(x) { } function foo3(x) { var _loop_5 = function() { - var x_5 = void 0; + var x_5; (function () { return x_5 + v; }); (function () { return x_5 + v; }); }; @@ -307,7 +307,7 @@ function foo5(x) { } function foo6(x) { var _loop_8 = function() { - var x_8 = void 0, y = void 0; + var x_8, y; v = x_8; (function () { return x_8 + y + v; }); (function () { return x_8 + y + v; }); @@ -320,7 +320,7 @@ function foo6(x) { } function foo7(x) { var _loop_9 = function() { - var x_9 = void 0, y = void 0; + var x_9, y; v = x_9; (function () { return x_9 + y + v; }); (function () { return x_9 + y + v; }); diff --git a/tests/baselines/reference/capturedLetConstInLoop3.types b/tests/baselines/reference/capturedLetConstInLoop3.types index 51646f5a98b..9c0c188b727 100644 --- a/tests/baselines/reference/capturedLetConstInLoop3.types +++ b/tests/baselines/reference/capturedLetConstInLoop3.types @@ -42,32 +42,32 @@ function foo0_1(x) { >x : any for (let x in []) { ->x : any +>x : string >[] : undefined[] var v = x; ->v : any ->x : any +>v : string +>x : string (function() { return x + v }); ->(function() { return x + v }) : () => any ->function() { return x + v } : () => any ->x + v : any ->x : any ->v : any +>(function() { return x + v }) : () => string +>function() { return x + v } : () => string +>x + v : string +>x : string +>v : string (() => x + v); ->(() => x + v) : () => any ->() => x + v : () => any ->x + v : any ->x : any ->v : any +>(() => x + v) : () => string +>() => x + v : () => string +>x + v : string +>x : string +>v : string } use(v); >use(v) : any >use : (a: any) => any ->v : any +>v : string } function foo1(x) { @@ -438,32 +438,32 @@ function foo0_1_c(x) { >x : any for (const x in []) { ->x : any +>x : string >[] : undefined[] var v = x; ->v : any ->x : any +>v : string +>x : string (function() { return x + v }); ->(function() { return x + v }) : () => any ->function() { return x + v } : () => any ->x + v : any ->x : any ->v : any +>(function() { return x + v }) : () => string +>function() { return x + v } : () => string +>x + v : string +>x : string +>v : string (() => x + v); ->(() => x + v) : () => any ->() => x + v : () => any ->x + v : any ->x : any ->v : any +>(() => x + v) : () => string +>() => x + v : () => string +>x + v : string +>x : string +>v : string } use(v); >use(v) : any >use : (a: any) => any ->v : any +>v : string } function foo1_c(x) { diff --git a/tests/baselines/reference/capturedLetConstInLoop3_ES6.types b/tests/baselines/reference/capturedLetConstInLoop3_ES6.types index cc4b57ff9ea..03377d913c9 100644 --- a/tests/baselines/reference/capturedLetConstInLoop3_ES6.types +++ b/tests/baselines/reference/capturedLetConstInLoop3_ES6.types @@ -43,32 +43,32 @@ function foo0_1(x) { >x : any for (let x in []) { ->x : any +>x : string >[] : undefined[] var v = x; ->v : any ->x : any +>v : string +>x : string (function() { return x + v }); ->(function() { return x + v }) : () => any ->function() { return x + v } : () => any ->x + v : any ->x : any ->v : any +>(function() { return x + v }) : () => string +>function() { return x + v } : () => string +>x + v : string +>x : string +>v : string (() => x + v); ->(() => x + v) : () => any ->() => x + v : () => any ->x + v : any ->x : any ->v : any +>(() => x + v) : () => string +>() => x + v : () => string +>x + v : string +>x : string +>v : string } use(v); >use(v) : any >use : (a: any) => any ->v : any +>v : string } function foo1(x) { @@ -439,32 +439,32 @@ function foo0_1_c(x) { >x : any for (const x in []) { ->x : any +>x : string >[] : undefined[] var v = x; ->v : any ->x : any +>v : string +>x : string (function() { return x + v }); ->(function() { return x + v }) : () => any ->function() { return x + v } : () => any ->x + v : any ->x : any ->v : any +>(function() { return x + v }) : () => string +>function() { return x + v } : () => string +>x + v : string +>x : string +>v : string (() => x + v); ->(() => x + v) : () => any ->() => x + v : () => any ->x + v : any ->x : any ->v : any +>(() => x + v) : () => string +>() => x + v : () => string +>x + v : string +>x : string +>v : string } use(v); >use(v) : any >use : (a: any) => any ->v : any +>v : string } function foo1_c(x) { diff --git a/tests/baselines/reference/capturedLetConstInLoop4.js b/tests/baselines/reference/capturedLetConstInLoop4.js index c2d2c998616..04f514b01e8 100644 --- a/tests/baselines/reference/capturedLetConstInLoop4.js +++ b/tests/baselines/reference/capturedLetConstInLoop4.js @@ -144,8 +144,9 @@ for (const y = 0; y < 1;) { //// [capturedLetConstInLoop4.js] -System.register([], function(exports_1, __moduleName) { +System.register([], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; var v0, v00, v1, v2, v3, v4, v5, v6, v7, v8, v0_c, v00_c, v1_c, v2_c, v3_c, v4_c, v5_c, v6_c, v7_c, v8_c; //======let function exportedFoo() { @@ -186,7 +187,7 @@ System.register([], function(exports_1, __moduleName) { _loop_3(x); } var _loop_4 = function() { - var x = void 0; + var x; v2 = x; (function () { return x + v2; }); (function () { return x; }); @@ -195,7 +196,7 @@ System.register([], function(exports_1, __moduleName) { _loop_4(); } var _loop_5 = function() { - var x = void 0; + var x; v3 = x; (function () { return x + v3; }); (function () { return x; }); @@ -221,7 +222,7 @@ System.register([], function(exports_1, __moduleName) { _loop_7(x, y); } var _loop_8 = function() { - var x = void 0, y = void 0; + var x, y; v6 = x; (function () { return x + y + v6; }); (function () { return x + y; }); @@ -230,7 +231,7 @@ System.register([], function(exports_1, __moduleName) { _loop_8(); } var _loop_9 = function() { - var x = void 0, y = void 0; + var x, y; v7 = x; (function () { return x + y + v7; }); (function () { return x + y; }); diff --git a/tests/baselines/reference/capturedLetConstInLoop4.types b/tests/baselines/reference/capturedLetConstInLoop4.types index f19e5d109b8..1bc928cefe4 100644 --- a/tests/baselines/reference/capturedLetConstInLoop4.types +++ b/tests/baselines/reference/capturedLetConstInLoop4.types @@ -2,20 +2,20 @@ //======let export function exportedFoo() { ->exportedFoo : () => any +>exportedFoo : () => string return v0 + v00 + v1 + v2 + v3 + v4 + v5 + v6 + v7 + v8; ->v0 + v00 + v1 + v2 + v3 + v4 + v5 + v6 + v7 + v8 : any ->v0 + v00 + v1 + v2 + v3 + v4 + v5 + v6 + v7 : any ->v0 + v00 + v1 + v2 + v3 + v4 + v5 + v6 : any ->v0 + v00 + v1 + v2 + v3 + v4 + v5 : any ->v0 + v00 + v1 + v2 + v3 + v4 : any ->v0 + v00 + v1 + v2 + v3 : any ->v0 + v00 + v1 + v2 : any ->v0 + v00 + v1 : any ->v0 + v00 : any +>v0 + v00 + v1 + v2 + v3 + v4 + v5 + v6 + v7 + v8 : string +>v0 + v00 + v1 + v2 + v3 + v4 + v5 + v6 + v7 : string +>v0 + v00 + v1 + v2 + v3 + v4 + v5 + v6 : string +>v0 + v00 + v1 + v2 + v3 + v4 + v5 : string +>v0 + v00 + v1 + v2 + v3 + v4 : string +>v0 + v00 + v1 + v2 + v3 : string +>v0 + v00 + v1 + v2 : string +>v0 + v00 + v1 : string +>v0 + v00 : string >v0 : any ->v00 : any +>v00 : string >v1 : number >v2 : any >v3 : any @@ -48,24 +48,24 @@ for (let x of []) { } for (let x in []) { ->x : any +>x : string >[] : undefined[] var v00 = x; ->v00 : any ->x : any +>v00 : string +>x : string (function() { return x + v00}); ->(function() { return x + v00}) : () => any ->function() { return x + v00} : () => any ->x + v00 : any ->x : any ->v00 : any +>(function() { return x + v00}) : () => string +>function() { return x + v00} : () => string +>x + v00 : string +>x : string +>v00 : string (() => x); ->(() => x) : () => any ->() => x : () => any ->x : any +>(() => x) : () => string +>() => x : () => string +>x : string } for (let x = 0; x < 1; ++x) { @@ -302,20 +302,20 @@ for (let y = 0; y < 1; ++y) { //======const export function exportedFoo2() { ->exportedFoo2 : () => any +>exportedFoo2 : () => string return v0_c + v00_c + v1_c + v2_c + v3_c + v4_c + v5_c + v6_c + v7_c + v8_c; ->v0_c + v00_c + v1_c + v2_c + v3_c + v4_c + v5_c + v6_c + v7_c + v8_c : any ->v0_c + v00_c + v1_c + v2_c + v3_c + v4_c + v5_c + v6_c + v7_c : any ->v0_c + v00_c + v1_c + v2_c + v3_c + v4_c + v5_c + v6_c : any ->v0_c + v00_c + v1_c + v2_c + v3_c + v4_c + v5_c : any ->v0_c + v00_c + v1_c + v2_c + v3_c + v4_c : any ->v0_c + v00_c + v1_c + v2_c + v3_c : any ->v0_c + v00_c + v1_c + v2_c : any ->v0_c + v00_c + v1_c : any ->v0_c + v00_c : any +>v0_c + v00_c + v1_c + v2_c + v3_c + v4_c + v5_c + v6_c + v7_c + v8_c : string +>v0_c + v00_c + v1_c + v2_c + v3_c + v4_c + v5_c + v6_c + v7_c : string +>v0_c + v00_c + v1_c + v2_c + v3_c + v4_c + v5_c + v6_c : string +>v0_c + v00_c + v1_c + v2_c + v3_c + v4_c + v5_c : string +>v0_c + v00_c + v1_c + v2_c + v3_c + v4_c : string +>v0_c + v00_c + v1_c + v2_c + v3_c : string +>v0_c + v00_c + v1_c + v2_c : string +>v0_c + v00_c + v1_c : string +>v0_c + v00_c : string >v0_c : any ->v00_c : any +>v00_c : string >v1_c : number >v2_c : number >v3_c : number @@ -348,24 +348,24 @@ for (const x of []) { } for (const x in []) { ->x : any +>x : string >[] : undefined[] var v00_c = x; ->v00_c : any ->x : any +>v00_c : string +>x : string (function() { return x + v00}); ->(function() { return x + v00}) : () => any ->function() { return x + v00} : () => any ->x + v00 : any ->x : any ->v00 : any +>(function() { return x + v00}) : () => string +>function() { return x + v00} : () => string +>x + v00 : string +>x : string +>v00 : string (() => x); ->(() => x) : () => any ->() => x : () => any ->x : any +>(() => x) : () => string +>() => x : () => string +>x : string } for (const x = 0; x < 1;) { diff --git a/tests/baselines/reference/capturedLetConstInLoop4_ES6.types b/tests/baselines/reference/capturedLetConstInLoop4_ES6.types index fd5f6dadf62..cf44c7b6981 100644 --- a/tests/baselines/reference/capturedLetConstInLoop4_ES6.types +++ b/tests/baselines/reference/capturedLetConstInLoop4_ES6.types @@ -2,20 +2,20 @@ //======let export function exportedFoo() { ->exportedFoo : () => any +>exportedFoo : () => string return v0 + v00 + v1 + v2 + v3 + v4 + v5 + v6 + v7 + v8; ->v0 + v00 + v1 + v2 + v3 + v4 + v5 + v6 + v7 + v8 : any ->v0 + v00 + v1 + v2 + v3 + v4 + v5 + v6 + v7 : any ->v0 + v00 + v1 + v2 + v3 + v4 + v5 + v6 : any ->v0 + v00 + v1 + v2 + v3 + v4 + v5 : any ->v0 + v00 + v1 + v2 + v3 + v4 : any ->v0 + v00 + v1 + v2 + v3 : any ->v0 + v00 + v1 + v2 : any ->v0 + v00 + v1 : any ->v0 + v00 : any +>v0 + v00 + v1 + v2 + v3 + v4 + v5 + v6 + v7 + v8 : string +>v0 + v00 + v1 + v2 + v3 + v4 + v5 + v6 + v7 : string +>v0 + v00 + v1 + v2 + v3 + v4 + v5 + v6 : string +>v0 + v00 + v1 + v2 + v3 + v4 + v5 : string +>v0 + v00 + v1 + v2 + v3 + v4 : string +>v0 + v00 + v1 + v2 + v3 : string +>v0 + v00 + v1 + v2 : string +>v0 + v00 + v1 : string +>v0 + v00 : string >v0 : any ->v00 : any +>v00 : string >v1 : number >v2 : any >v3 : any @@ -48,24 +48,24 @@ for (let x of []) { } for (let x in []) { ->x : any +>x : string >[] : undefined[] var v00 = x; ->v00 : any ->x : any +>v00 : string +>x : string (function() { return x + v00}); ->(function() { return x + v00}) : () => any ->function() { return x + v00} : () => any ->x + v00 : any ->x : any ->v00 : any +>(function() { return x + v00}) : () => string +>function() { return x + v00} : () => string +>x + v00 : string +>x : string +>v00 : string (() => x); ->(() => x) : () => any ->() => x : () => any ->x : any +>(() => x) : () => string +>() => x : () => string +>x : string } for (let x = 0; x < 1; ++x) { @@ -302,20 +302,20 @@ for (let y = 0; y < 1; ++y) { //======const export function exportedFoo2() { ->exportedFoo2 : () => any +>exportedFoo2 : () => string return v0_c + v00_c + v1_c + v2_c + v3_c + v4_c + v5_c + v6_c + v7_c + v8_c; ->v0_c + v00_c + v1_c + v2_c + v3_c + v4_c + v5_c + v6_c + v7_c + v8_c : any ->v0_c + v00_c + v1_c + v2_c + v3_c + v4_c + v5_c + v6_c + v7_c : any ->v0_c + v00_c + v1_c + v2_c + v3_c + v4_c + v5_c + v6_c : any ->v0_c + v00_c + v1_c + v2_c + v3_c + v4_c + v5_c : any ->v0_c + v00_c + v1_c + v2_c + v3_c + v4_c : any ->v0_c + v00_c + v1_c + v2_c + v3_c : any ->v0_c + v00_c + v1_c + v2_c : any ->v0_c + v00_c + v1_c : any ->v0_c + v00_c : any +>v0_c + v00_c + v1_c + v2_c + v3_c + v4_c + v5_c + v6_c + v7_c + v8_c : string +>v0_c + v00_c + v1_c + v2_c + v3_c + v4_c + v5_c + v6_c + v7_c : string +>v0_c + v00_c + v1_c + v2_c + v3_c + v4_c + v5_c + v6_c : string +>v0_c + v00_c + v1_c + v2_c + v3_c + v4_c + v5_c : string +>v0_c + v00_c + v1_c + v2_c + v3_c + v4_c : string +>v0_c + v00_c + v1_c + v2_c + v3_c : string +>v0_c + v00_c + v1_c + v2_c : string +>v0_c + v00_c + v1_c : string +>v0_c + v00_c : string >v0_c : any ->v00_c : any +>v00_c : string >v1_c : number >v2_c : number >v3_c : number @@ -348,24 +348,24 @@ for (const x of []) { } for (const x in []) { ->x : any +>x : string >[] : undefined[] var v00_c = x; ->v00_c : any ->x : any +>v00_c : string +>x : string (function() { return x + v00}); ->(function() { return x + v00}) : () => any ->function() { return x + v00} : () => any ->x + v00 : any ->x : any ->v00 : any +>(function() { return x + v00}) : () => string +>function() { return x + v00} : () => string +>x + v00 : string +>x : string +>v00 : string (() => x); ->(() => x) : () => any ->() => x : () => any ->x : any +>(() => x) : () => string +>() => x : () => string +>x : string } for (const x = 0; x < 1;) { diff --git a/tests/baselines/reference/capturedLetConstInLoop5.js b/tests/baselines/reference/capturedLetConstInLoop5.js index d7d177a19b9..a1a4d4b0a8f 100644 --- a/tests/baselines/reference/capturedLetConstInLoop5.js +++ b/tests/baselines/reference/capturedLetConstInLoop5.js @@ -20,7 +20,7 @@ function foo00(x) { var v = x; (function() { return x + v }); (() => x + v); - if (x == 1) { + if (x == "1") { return; } } @@ -159,7 +159,7 @@ function foo00_c(x) { var v = x; (function() { return x + v }); (() => x + v); - if (x == 1) { + if (x == "1") { return; } } @@ -294,7 +294,7 @@ function foo0(x) { for (var _i = 0, _a = []; _i < _a.length; _i++) { var x_1 = _a[_i]; var state_1 = _loop_1(x_1); - if (typeof state_1 === "object") return state_1.value + if (typeof state_1 === "object") return state_1.value; } use(v); } @@ -303,14 +303,14 @@ function foo00(x) { v = x_2; (function () { return x_2 + v; }); (function () { return x_2 + v; }); - if (x_2 == 1) { + if (x_2 == "1") { return { value: void 0 }; } }; var v; for (var x_2 in []) { var state_2 = _loop_2(x_2); - if (typeof state_2 === "object") return state_2.value + if (typeof state_2 === "object") return state_2.value; } use(v); } @@ -326,7 +326,7 @@ function foo1(x) { var v; for (var x_3 = 0; x_3 < 1; ++x_3) { var state_3 = _loop_3(x_3); - if (typeof state_3 === "object") return state_3.value + if (typeof state_3 === "object") return state_3.value; } use(v); } @@ -343,13 +343,13 @@ function foo2(x) { var v; while (1 === 1) { var state_4 = _loop_4(); - if (typeof state_4 === "object") return state_4.value + if (typeof state_4 === "object") return state_4.value; } use(v); } function foo3(x) { var _loop_5 = function() { - var x_5 = void 0; + var x_5; (function () { return x_5 + v; }); (function () { return x_5 + v; }); if (x_5 == 1) { @@ -359,7 +359,7 @@ function foo3(x) { var v; do { var state_5 = _loop_5(); - if (typeof state_5 === "object") return state_5.value + if (typeof state_5 === "object") return state_5.value; } while (1 === 1); use(v); } @@ -376,7 +376,7 @@ function foo4(x) { var v; for (var y = 0; y < 1; ++y) { var state_6 = _loop_6(y); - if (typeof state_6 === "object") return state_6.value + if (typeof state_6 === "object") return state_6.value; } use(v); } @@ -392,13 +392,13 @@ function foo5(x) { var v; for (var x_7 = 0, y = 1; x_7 < 1; ++x_7) { var state_7 = _loop_7(x_7, y); - if (typeof state_7 === "object") return state_7.value + if (typeof state_7 === "object") return state_7.value; } use(v); } function foo6(x) { var _loop_8 = function() { - var x_8 = void 0, y = void 0; + var x_8, y; v = x_8; (function () { return x_8 + y + v; }); (function () { return x_8 + y + v; }); @@ -409,14 +409,14 @@ function foo6(x) { var v; while (1 === 1) { var state_8 = _loop_8(); - if (typeof state_8 === "object") return state_8.value + if (typeof state_8 === "object") return state_8.value; } ; use(v); } function foo7(x) { var _loop_9 = function() { - var x_9 = void 0, y = void 0; + var x_9, y; v = x_9; (function () { return x_9 + y + v; }); (function () { return x_9 + y + v; }); @@ -427,7 +427,7 @@ function foo7(x) { var v; do { var state_9 = _loop_9(); - if (typeof state_9 === "object") return state_9.value + if (typeof state_9 === "object") return state_9.value; } while (1 === 1); use(v); } @@ -444,7 +444,7 @@ function foo8(x) { var v; for (var y = 0; y < 1; ++y) { var state_10 = _loop_10(y); - if (typeof state_10 === "object") return state_10.value + if (typeof state_10 === "object") return state_10.value; } use(v); } @@ -462,7 +462,7 @@ function foo0_c(x) { for (var _i = 0, _a = []; _i < _a.length; _i++) { var x_11 = _a[_i]; var state_11 = _loop_11(x_11); - if (typeof state_11 === "object") return state_11.value + if (typeof state_11 === "object") return state_11.value; } use(v); } @@ -471,14 +471,14 @@ function foo00_c(x) { v = x_12; (function () { return x_12 + v; }); (function () { return x_12 + v; }); - if (x_12 == 1) { + if (x_12 == "1") { return { value: void 0 }; } }; var v; for (var x_12 in []) { var state_12 = _loop_12(x_12); - if (typeof state_12 === "object") return state_12.value + if (typeof state_12 === "object") return state_12.value; } use(v); } @@ -494,7 +494,7 @@ function foo1_c(x) { var v; for (var x_13 = 0; x_13 < 1;) { var state_13 = _loop_13(x_13); - if (typeof state_13 === "object") return state_13.value + if (typeof state_13 === "object") return state_13.value; } use(v); } @@ -511,7 +511,7 @@ function foo2_c(x) { var v; while (1 === 1) { var state_14 = _loop_14(); - if (typeof state_14 === "object") return state_14.value + if (typeof state_14 === "object") return state_14.value; } use(v); } @@ -527,7 +527,7 @@ function foo3_c(x) { var v; do { var state_15 = _loop_15(); - if (typeof state_15 === "object") return state_15.value + if (typeof state_15 === "object") return state_15.value; } while (1 === 1); use(v); } @@ -544,7 +544,7 @@ function foo4_c(x) { var v; for (var y = 0; y < 1;) { var state_16 = _loop_16(y); - if (typeof state_16 === "object") return state_16.value + if (typeof state_16 === "object") return state_16.value; } use(v); } @@ -560,7 +560,7 @@ function foo5_c(x) { var v; for (var x_17 = 0, y = 1; x_17 < 1;) { var state_17 = _loop_17(x_17, y); - if (typeof state_17 === "object") return state_17.value + if (typeof state_17 === "object") return state_17.value; } use(v); } @@ -577,7 +577,7 @@ function foo6_c(x) { var v; while (1 === 1) { var state_18 = _loop_18(); - if (typeof state_18 === "object") return state_18.value + if (typeof state_18 === "object") return state_18.value; } use(v); } @@ -594,7 +594,7 @@ function foo7_c(x) { var v; do { var state_19 = _loop_19(); - if (typeof state_19 === "object") return state_19.value + if (typeof state_19 === "object") return state_19.value; } while (1 === 1); use(v); } @@ -611,7 +611,7 @@ function foo8_c(x) { var v; for (var y = 0; y < 1;) { var state_20 = _loop_20(y); - if (typeof state_20 === "object") return state_20.value + if (typeof state_20 === "object") return state_20.value; } use(v); } diff --git a/tests/baselines/reference/capturedLetConstInLoop5.symbols b/tests/baselines/reference/capturedLetConstInLoop5.symbols index 2d514e8c88c..965379d3a11 100644 --- a/tests/baselines/reference/capturedLetConstInLoop5.symbols +++ b/tests/baselines/reference/capturedLetConstInLoop5.symbols @@ -54,7 +54,7 @@ function foo00(x) { >x : Symbol(x, Decl(capturedLetConstInLoop5.ts, 17, 12)) >v : Symbol(v, Decl(capturedLetConstInLoop5.ts, 18, 11)) - if (x == 1) { + if (x == "1") { >x : Symbol(x, Decl(capturedLetConstInLoop5.ts, 17, 12)) return; @@ -395,7 +395,7 @@ function foo00_c(x) { >x : Symbol(x, Decl(capturedLetConstInLoop5.ts, 156, 14)) >v : Symbol(v, Decl(capturedLetConstInLoop5.ts, 157, 11)) - if (x == 1) { + if (x == "1") { >x : Symbol(x, Decl(capturedLetConstInLoop5.ts, 156, 14)) return; diff --git a/tests/baselines/reference/capturedLetConstInLoop5.types b/tests/baselines/reference/capturedLetConstInLoop5.types index 3654ffe5820..b7b4b880dc4 100644 --- a/tests/baselines/reference/capturedLetConstInLoop5.types +++ b/tests/baselines/reference/capturedLetConstInLoop5.types @@ -50,31 +50,31 @@ function foo00(x) { >x : any for (let x in []) { ->x : any +>x : string >[] : undefined[] var v = x; ->v : any ->x : any +>v : string +>x : string (function() { return x + v }); ->(function() { return x + v }) : () => any ->function() { return x + v } : () => any ->x + v : any ->x : any ->v : any +>(function() { return x + v }) : () => string +>function() { return x + v } : () => string +>x + v : string +>x : string +>v : string (() => x + v); ->(() => x + v) : () => any ->() => x + v : () => any ->x + v : any ->x : any ->v : any +>(() => x + v) : () => string +>() => x + v : () => string +>x + v : string +>x : string +>v : string - if (x == 1) { ->x == 1 : boolean ->x : any ->1 : number + if (x == "1") { +>x == "1" : boolean +>x : string +>"1" : string return; } @@ -83,7 +83,7 @@ function foo00(x) { use(v); >use(v) : any >use : (a: any) => any ->v : any +>v : string } function foo1(x) { @@ -525,31 +525,31 @@ function foo00_c(x) { >x : any for (const x in []) { ->x : any +>x : string >[] : undefined[] var v = x; ->v : any ->x : any +>v : string +>x : string (function() { return x + v }); ->(function() { return x + v }) : () => any ->function() { return x + v } : () => any ->x + v : any ->x : any ->v : any +>(function() { return x + v }) : () => string +>function() { return x + v } : () => string +>x + v : string +>x : string +>v : string (() => x + v); ->(() => x + v) : () => any ->() => x + v : () => any ->x + v : any ->x : any ->v : any +>(() => x + v) : () => string +>() => x + v : () => string +>x + v : string +>x : string +>v : string - if (x == 1) { ->x == 1 : boolean ->x : any ->1 : number + if (x == "1") { +>x == "1" : boolean +>x : string +>"1" : string return; } @@ -558,7 +558,7 @@ function foo00_c(x) { use(v); >use(v) : any >use : (a: any) => any ->v : any +>v : string } function foo1_c(x) { diff --git a/tests/baselines/reference/capturedLetConstInLoop5_ES6.js b/tests/baselines/reference/capturedLetConstInLoop5_ES6.js index e5996bb3053..0f0624b8a8b 100644 --- a/tests/baselines/reference/capturedLetConstInLoop5_ES6.js +++ b/tests/baselines/reference/capturedLetConstInLoop5_ES6.js @@ -21,7 +21,7 @@ function foo00(x) { var v = x; (function() { return x + v }); (() => x + v); - if (x == 1) { + if (x == "1") { return; } } @@ -160,7 +160,7 @@ function foo00_c(x) { var v = x; (function() { return x + v }); (() => x + v); - if (x == 1) { + if (x == "1") { return; } } @@ -298,7 +298,7 @@ function foo00(x) { var v = x; (function () { return x + v; }); (() => x + v); - if (x == 1) { + if (x == "1") { return; } } @@ -416,7 +416,7 @@ function foo00_c(x) { var v = x; (function () { return x + v; }); (() => x + v); - if (x == 1) { + if (x == "1") { return; } } diff --git a/tests/baselines/reference/capturedLetConstInLoop5_ES6.symbols b/tests/baselines/reference/capturedLetConstInLoop5_ES6.symbols index b3d338ad60e..5b40cb44599 100644 --- a/tests/baselines/reference/capturedLetConstInLoop5_ES6.symbols +++ b/tests/baselines/reference/capturedLetConstInLoop5_ES6.symbols @@ -55,7 +55,7 @@ function foo00(x) { >x : Symbol(x, Decl(capturedLetConstInLoop5_ES6.ts, 18, 12)) >v : Symbol(v, Decl(capturedLetConstInLoop5_ES6.ts, 19, 11)) - if (x == 1) { + if (x == "1") { >x : Symbol(x, Decl(capturedLetConstInLoop5_ES6.ts, 18, 12)) return; @@ -396,7 +396,7 @@ function foo00_c(x) { >x : Symbol(x, Decl(capturedLetConstInLoop5_ES6.ts, 157, 14)) >v : Symbol(v, Decl(capturedLetConstInLoop5_ES6.ts, 158, 11)) - if (x == 1) { + if (x == "1") { >x : Symbol(x, Decl(capturedLetConstInLoop5_ES6.ts, 157, 14)) return; diff --git a/tests/baselines/reference/capturedLetConstInLoop5_ES6.types b/tests/baselines/reference/capturedLetConstInLoop5_ES6.types index 8db8ae25e9b..855bbfc6308 100644 --- a/tests/baselines/reference/capturedLetConstInLoop5_ES6.types +++ b/tests/baselines/reference/capturedLetConstInLoop5_ES6.types @@ -51,31 +51,31 @@ function foo00(x) { >x : any for (let x in []) { ->x : any +>x : string >[] : undefined[] var v = x; ->v : any ->x : any +>v : string +>x : string (function() { return x + v }); ->(function() { return x + v }) : () => any ->function() { return x + v } : () => any ->x + v : any ->x : any ->v : any +>(function() { return x + v }) : () => string +>function() { return x + v } : () => string +>x + v : string +>x : string +>v : string (() => x + v); ->(() => x + v) : () => any ->() => x + v : () => any ->x + v : any ->x : any ->v : any +>(() => x + v) : () => string +>() => x + v : () => string +>x + v : string +>x : string +>v : string - if (x == 1) { ->x == 1 : boolean ->x : any ->1 : number + if (x == "1") { +>x == "1" : boolean +>x : string +>"1" : string return; } @@ -84,7 +84,7 @@ function foo00(x) { use(v); >use(v) : any >use : (a: any) => any ->v : any +>v : string } function foo1(x) { @@ -526,31 +526,31 @@ function foo00_c(x) { >x : any for (const x in []) { ->x : any +>x : string >[] : undefined[] var v = x; ->v : any ->x : any +>v : string +>x : string (function() { return x + v }); ->(function() { return x + v }) : () => any ->function() { return x + v } : () => any ->x + v : any ->x : any ->v : any +>(function() { return x + v }) : () => string +>function() { return x + v } : () => string +>x + v : string +>x : string +>v : string (() => x + v); ->(() => x + v) : () => any ->() => x + v : () => any ->x + v : any ->x : any ->v : any +>(() => x + v) : () => string +>() => x + v : () => string +>x + v : string +>x : string +>v : string - if (x == 1) { ->x == 1 : boolean ->x : any ->1 : number + if (x == "1") { +>x == "1" : boolean +>x : string +>"1" : string return; } @@ -559,7 +559,7 @@ function foo00_c(x) { use(v); >use(v) : any >use : (a: any) => any ->v : any +>v : string } function foo1_c(x) { diff --git a/tests/baselines/reference/capturedLetConstInLoop6.js b/tests/baselines/reference/capturedLetConstInLoop6.js index 187d9f10ad3..6a2b4c9a335 100644 --- a/tests/baselines/reference/capturedLetConstInLoop6.js +++ b/tests/baselines/reference/capturedLetConstInLoop6.js @@ -14,10 +14,10 @@ for (let x of []) { for (let x in []) { (function() { return x}); (() => x); - if (x == 1) { + if (x == "1") { break; } - if (x == 2) { + if (x == "2") { continue; } } @@ -133,10 +133,10 @@ for (const x of []) { for (const x in []) { (function() { return x}); (() => x); - if (x == 1) { + if (x == "1") { break; } - if (x == 2) { + if (x == "2") { continue; } } @@ -254,22 +254,20 @@ for (var _i = 0, _a = []; _i < _a.length; _i++) { var x = _a[_i]; var state_1 = _loop_1(x); if (state_1 === "break") break; - if (state_1 === "continue") continue; } var _loop_2 = function(x) { (function () { return x; }); (function () { return x; }); - if (x == 1) { + if (x == "1") { return "break"; } - if (x == 2) { + if (x == "2") { return "continue"; } }; for (var x in []) { var state_2 = _loop_2(x); if (state_2 === "break") break; - if (state_2 === "continue") continue; } var _loop_3 = function(x) { (function () { return x; }); @@ -284,10 +282,9 @@ var _loop_3 = function(x) { for (var x = 0; x < 1; ++x) { var state_3 = _loop_3(x); if (state_3 === "break") break; - if (state_3 === "continue") continue; } var _loop_4 = function() { - var x = void 0; + var x; (function () { return x; }); (function () { return x; }); if (x == 1) { @@ -300,10 +297,9 @@ var _loop_4 = function() { while (1 === 1) { var state_4 = _loop_4(); if (state_4 === "break") break; - if (state_4 === "continue") continue; } var _loop_5 = function() { - var x = void 0; + var x; (function () { return x; }); (function () { return x; }); if (x == 1) { @@ -316,7 +312,6 @@ var _loop_5 = function() { do { var state_5 = _loop_5(); if (state_5 === "break") break; - if (state_5 === "continue") continue; } while (1 === 1); var _loop_6 = function(y) { var x = 1; @@ -332,7 +327,6 @@ var _loop_6 = function(y) { for (var y = 0; y < 1; ++y) { var state_6 = _loop_6(y); if (state_6 === "break") break; - if (state_6 === "continue") continue; } var _loop_7 = function(x, y) { (function () { return x + y; }); @@ -347,10 +341,9 @@ var _loop_7 = function(x, y) { for (var x = 0, y = 1; x < 1; ++x) { var state_7 = _loop_7(x, y); if (state_7 === "break") break; - if (state_7 === "continue") continue; } var _loop_8 = function() { - var x = void 0, y = void 0; + var x, y; (function () { return x + y; }); (function () { return x + y; }); if (x == 1) { @@ -363,10 +356,9 @@ var _loop_8 = function() { while (1 === 1) { var state_8 = _loop_8(); if (state_8 === "break") break; - if (state_8 === "continue") continue; } var _loop_9 = function() { - var x = void 0, y = void 0; + var x, y; (function () { return x + y; }); (function () { return x + y; }); if (x == 1) { @@ -379,7 +371,6 @@ var _loop_9 = function() { do { var state_9 = _loop_9(); if (state_9 === "break") break; - if (state_9 === "continue") continue; } while (1 === 1); var _loop_10 = function(y) { var x = 1; @@ -395,7 +386,6 @@ var _loop_10 = function(y) { for (var y = 0; y < 1; ++y) { var state_10 = _loop_10(y); if (state_10 === "break") break; - if (state_10 === "continue") continue; } // ====const var _loop_11 = function(x) { @@ -412,22 +402,20 @@ for (var _b = 0, _c = []; _b < _c.length; _b++) { var x = _c[_b]; var state_11 = _loop_11(x); if (state_11 === "break") break; - if (state_11 === "continue") continue; } var _loop_12 = function(x) { (function () { return x; }); (function () { return x; }); - if (x == 1) { + if (x == "1") { return "break"; } - if (x == 2) { + if (x == "2") { return "continue"; } }; for (var x in []) { var state_12 = _loop_12(x); if (state_12 === "break") break; - if (state_12 === "continue") continue; } var _loop_13 = function(x) { (function () { return x; }); @@ -442,7 +430,6 @@ var _loop_13 = function(x) { for (var x = 0; x < 1;) { var state_13 = _loop_13(x); if (state_13 === "break") break; - if (state_13 === "continue") continue; } var _loop_14 = function() { var x = 1; @@ -458,7 +445,6 @@ var _loop_14 = function() { while (1 === 1) { var state_14 = _loop_14(); if (state_14 === "break") break; - if (state_14 === "continue") continue; } var _loop_15 = function() { var x = 1; @@ -474,7 +460,6 @@ var _loop_15 = function() { do { var state_15 = _loop_15(); if (state_15 === "break") break; - if (state_15 === "continue") continue; } while (1 === 1); var _loop_16 = function(y) { var x = 1; @@ -490,7 +475,6 @@ var _loop_16 = function(y) { for (var y = 0; y < 1;) { var state_16 = _loop_16(y); if (state_16 === "break") break; - if (state_16 === "continue") continue; } var _loop_17 = function(x, y) { (function () { return x + y; }); @@ -505,7 +489,6 @@ var _loop_17 = function(x, y) { for (var x = 0, y = 1; x < 1;) { var state_17 = _loop_17(x, y); if (state_17 === "break") break; - if (state_17 === "continue") continue; } var _loop_18 = function() { var x = 1, y = 1; @@ -521,7 +504,6 @@ var _loop_18 = function() { while (1 === 1) { var state_18 = _loop_18(); if (state_18 === "break") break; - if (state_18 === "continue") continue; } var _loop_19 = function() { var x = 1, y = 1; @@ -537,7 +519,6 @@ var _loop_19 = function() { do { var state_19 = _loop_19(); if (state_19 === "break") break; - if (state_19 === "continue") continue; } while (1 === 1); var _loop_20 = function(y) { var x = 1; @@ -553,5 +534,4 @@ var _loop_20 = function(y) { for (var y = 0; y < 1;) { var state_20 = _loop_20(y); if (state_20 === "break") break; - if (state_20 === "continue") continue; } diff --git a/tests/baselines/reference/capturedLetConstInLoop6.symbols b/tests/baselines/reference/capturedLetConstInLoop6.symbols index 8d8e6d6ce59..872bc3a4727 100644 --- a/tests/baselines/reference/capturedLetConstInLoop6.symbols +++ b/tests/baselines/reference/capturedLetConstInLoop6.symbols @@ -30,12 +30,12 @@ for (let x in []) { (() => x); >x : Symbol(x, Decl(capturedLetConstInLoop6.ts, 12, 8)) - if (x == 1) { + if (x == "1") { >x : Symbol(x, Decl(capturedLetConstInLoop6.ts, 12, 8)) break; } - if (x == 2) { + if (x == "2") { >x : Symbol(x, Decl(capturedLetConstInLoop6.ts, 12, 8)) continue; @@ -272,12 +272,12 @@ for (const x in []) { (() => x); >x : Symbol(x, Decl(capturedLetConstInLoop6.ts, 131, 10)) - if (x == 1) { + if (x == "1") { >x : Symbol(x, Decl(capturedLetConstInLoop6.ts, 131, 10)) break; } - if (x == 2) { + if (x == "2") { >x : Symbol(x, Decl(capturedLetConstInLoop6.ts, 131, 10)) continue; diff --git a/tests/baselines/reference/capturedLetConstInLoop6.types b/tests/baselines/reference/capturedLetConstInLoop6.types index 6c31bdef31b..f2b1103305f 100644 --- a/tests/baselines/reference/capturedLetConstInLoop6.types +++ b/tests/baselines/reference/capturedLetConstInLoop6.types @@ -31,30 +31,30 @@ for (let x of []) { } for (let x in []) { ->x : any +>x : string >[] : undefined[] (function() { return x}); ->(function() { return x}) : () => any ->function() { return x} : () => any ->x : any +>(function() { return x}) : () => string +>function() { return x} : () => string +>x : string (() => x); ->(() => x) : () => any ->() => x : () => any ->x : any +>(() => x) : () => string +>() => x : () => string +>x : string - if (x == 1) { ->x == 1 : boolean ->x : any ->1 : number + if (x == "1") { +>x == "1" : boolean +>x : string +>"1" : string break; } - if (x == 2) { ->x == 2 : boolean ->x : any ->2 : number + if (x == "2") { +>x == "2" : boolean +>x : string +>"2" : string continue; } @@ -396,30 +396,30 @@ for (const x of []) { } for (const x in []) { ->x : any +>x : string >[] : undefined[] (function() { return x}); ->(function() { return x}) : () => any ->function() { return x} : () => any ->x : any +>(function() { return x}) : () => string +>function() { return x} : () => string +>x : string (() => x); ->(() => x) : () => any ->() => x : () => any ->x : any +>(() => x) : () => string +>() => x : () => string +>x : string - if (x == 1) { ->x == 1 : boolean ->x : any ->1 : number + if (x == "1") { +>x == "1" : boolean +>x : string +>"1" : string break; } - if (x == 2) { ->x == 2 : boolean ->x : any ->2 : number + if (x == "2") { +>x == "2" : boolean +>x : string +>"2" : string continue; } diff --git a/tests/baselines/reference/capturedLetConstInLoop6_ES6.js b/tests/baselines/reference/capturedLetConstInLoop6_ES6.js index 924f55b6915..33d64e88927 100644 --- a/tests/baselines/reference/capturedLetConstInLoop6_ES6.js +++ b/tests/baselines/reference/capturedLetConstInLoop6_ES6.js @@ -14,10 +14,10 @@ for (let x of []) { for (let x in []) { (function() { return x}); (() => x); - if (x == 1) { + if (x == "1") { break; } - if (x == 2) { + if (x == "2") { continue; } } @@ -133,10 +133,10 @@ for (const x of []) { for (const x in []) { (function() { return x}); (() => x); - if (x == 1) { + if (x == "1") { break; } - if (x == 2) { + if (x == "2") { continue; } } @@ -253,10 +253,10 @@ for (let x of []) { for (let x in []) { (function () { return x; }); (() => x); - if (x == 1) { + if (x == "1") { break; } - if (x == 2) { + if (x == "2") { continue; } } @@ -360,10 +360,10 @@ for (const x of []) { for (const x in []) { (function () { return x; }); (() => x); - if (x == 1) { + if (x == "1") { break; } - if (x == 2) { + if (x == "2") { continue; } } diff --git a/tests/baselines/reference/capturedLetConstInLoop6_ES6.symbols b/tests/baselines/reference/capturedLetConstInLoop6_ES6.symbols index acd557e4714..63cb26c4300 100644 --- a/tests/baselines/reference/capturedLetConstInLoop6_ES6.symbols +++ b/tests/baselines/reference/capturedLetConstInLoop6_ES6.symbols @@ -30,12 +30,12 @@ for (let x in []) { (() => x); >x : Symbol(x, Decl(capturedLetConstInLoop6_ES6.ts, 12, 8)) - if (x == 1) { + if (x == "1") { >x : Symbol(x, Decl(capturedLetConstInLoop6_ES6.ts, 12, 8)) break; } - if (x == 2) { + if (x == "2") { >x : Symbol(x, Decl(capturedLetConstInLoop6_ES6.ts, 12, 8)) continue; @@ -272,12 +272,12 @@ for (const x in []) { (() => x); >x : Symbol(x, Decl(capturedLetConstInLoop6_ES6.ts, 131, 10)) - if (x == 1) { + if (x == "1") { >x : Symbol(x, Decl(capturedLetConstInLoop6_ES6.ts, 131, 10)) break; } - if (x == 2) { + if (x == "2") { >x : Symbol(x, Decl(capturedLetConstInLoop6_ES6.ts, 131, 10)) continue; diff --git a/tests/baselines/reference/capturedLetConstInLoop6_ES6.types b/tests/baselines/reference/capturedLetConstInLoop6_ES6.types index 87f21709120..cfd55a63aaa 100644 --- a/tests/baselines/reference/capturedLetConstInLoop6_ES6.types +++ b/tests/baselines/reference/capturedLetConstInLoop6_ES6.types @@ -31,30 +31,30 @@ for (let x of []) { } for (let x in []) { ->x : any +>x : string >[] : undefined[] (function() { return x}); ->(function() { return x}) : () => any ->function() { return x} : () => any ->x : any +>(function() { return x}) : () => string +>function() { return x} : () => string +>x : string (() => x); ->(() => x) : () => any ->() => x : () => any ->x : any +>(() => x) : () => string +>() => x : () => string +>x : string - if (x == 1) { ->x == 1 : boolean ->x : any ->1 : number + if (x == "1") { +>x == "1" : boolean +>x : string +>"1" : string break; } - if (x == 2) { ->x == 2 : boolean ->x : any ->2 : number + if (x == "2") { +>x == "2" : boolean +>x : string +>"2" : string continue; } @@ -396,30 +396,30 @@ for (const x of []) { } for (const x in []) { ->x : any +>x : string >[] : undefined[] (function() { return x}); ->(function() { return x}) : () => any ->function() { return x} : () => any ->x : any +>(function() { return x}) : () => string +>function() { return x} : () => string +>x : string (() => x); ->(() => x) : () => any ->() => x : () => any ->x : any +>(() => x) : () => string +>() => x : () => string +>x : string - if (x == 1) { ->x == 1 : boolean ->x : any ->1 : number + if (x == "1") { +>x == "1" : boolean +>x : string +>"1" : string break; } - if (x == 2) { ->x == 2 : boolean ->x : any ->2 : number + if (x == "2") { +>x == "2" : boolean +>x : string +>"2" : string continue; } diff --git a/tests/baselines/reference/capturedLetConstInLoop7.js b/tests/baselines/reference/capturedLetConstInLoop7.js index ce6769d2b1a..56b84e7802d 100644 --- a/tests/baselines/reference/capturedLetConstInLoop7.js +++ b/tests/baselines/reference/capturedLetConstInLoop7.js @@ -22,16 +22,16 @@ l00: for (let x in []) { (function() { return x}); (() => x); - if (x == 1) { + if (x == "1") { break; } - if (x == 1) { + if (x == "1") { break l00; } - if (x == 2) { + if (x == "2") { continue; } - if (x == 2) { + if (x == "2") { continue l00; } } @@ -210,16 +210,16 @@ l00_c: for (const x in []) { (function() { return x}); (() => x); - if (x == 1) { + if (x == "1") { break; } - if (x == 1) { + if (x == "1") { break l00_c; } - if (x == 2) { + if (x == "2") { continue; } - if (x == 2) { + if (x == "2") { continue l00_c; } } @@ -397,7 +397,6 @@ l0: for (var _i = 0, _a = []; _i < _a.length; _i++) { var x = _a[_i]; var state_1 = _loop_1(x); if (state_1 === "break") break; - if (state_1 === "continue") continue; switch(state_1) { case "break-l0": break l0; case "continue-l0": continue l0; @@ -406,23 +405,22 @@ l0: for (var _i = 0, _a = []; _i < _a.length; _i++) { var _loop_2 = function(x) { (function () { return x; }); (function () { return x; }); - if (x == 1) { + if (x == "1") { return "break"; } - if (x == 1) { + if (x == "1") { return "break-l00"; } - if (x == 2) { + if (x == "2") { return "continue"; } - if (x == 2) { + if (x == "2") { return "continue-l00"; } }; l00: for (var x in []) { var state_2 = _loop_2(x); if (state_2 === "break") break; - if (state_2 === "continue") continue; switch(state_2) { case "break-l00": break l00; case "continue-l00": continue l00; @@ -447,14 +445,13 @@ var _loop_3 = function(x) { l1: for (var x = 0; x < 1; ++x) { var state_3 = _loop_3(x); if (state_3 === "break") break; - if (state_3 === "continue") continue; switch(state_3) { case "break-l1": break l1; case "continue-l1": continue l1; } } var _loop_4 = function() { - var x = void 0; + var x; (function () { return x; }); (function () { return x; }); if (x == 1) { @@ -473,14 +470,13 @@ var _loop_4 = function() { l2: while (1 === 1) { var state_4 = _loop_4(); if (state_4 === "break") break; - if (state_4 === "continue") continue; switch(state_4) { case "break-l2": break l2; case "continue-l2": continue l2; } } var _loop_5 = function() { - var x = void 0; + var x; (function () { return x; }); (function () { return x; }); if (x == 1) { @@ -499,7 +495,6 @@ var _loop_5 = function() { l3: do { var state_5 = _loop_5(); if (state_5 === "break") break; - if (state_5 === "continue") continue; switch(state_5) { case "break-l3": break l3; case "continue-l3": continue l3; @@ -525,7 +520,6 @@ var _loop_6 = function(y) { l4: for (var y = 0; y < 1; ++y) { var state_6 = _loop_6(y); if (state_6 === "break") break; - if (state_6 === "continue") continue; switch(state_6) { case "break-l4": break l4; case "continue-l4": continue l4; @@ -550,14 +544,13 @@ var _loop_7 = function(x, y) { l5: for (var x = 0, y = 1; x < 1; ++x) { var state_7 = _loop_7(x, y); if (state_7 === "break") break; - if (state_7 === "continue") continue; switch(state_7) { case "break-l5": break l5; case "continue-l5": continue l5; } } var _loop_8 = function() { - var x = void 0, y = void 0; + var x, y; (function () { return x + y; }); (function () { return x + y; }); if (x == 1) { @@ -576,14 +569,13 @@ var _loop_8 = function() { l6: while (1 === 1) { var state_8 = _loop_8(); if (state_8 === "break") break; - if (state_8 === "continue") continue; switch(state_8) { case "break-l6": break l6; case "continue-l6": continue l6; } } var _loop_9 = function() { - var x = void 0, y = void 0; + var x, y; (function () { return x + y; }); (function () { return x + y; }); if (x == 1) { @@ -602,7 +594,6 @@ var _loop_9 = function() { l7: do { var state_9 = _loop_9(); if (state_9 === "break") break; - if (state_9 === "continue") continue; switch(state_9) { case "break-l7": break l7; case "continue-l7": continue l7; @@ -628,7 +619,6 @@ var _loop_10 = function(y) { l8: for (var y = 0; y < 1; ++y) { var state_10 = _loop_10(y); if (state_10 === "break") break; - if (state_10 === "continue") continue; switch(state_10) { case "break-l8": break l8; case "continue-l8": continue l8; @@ -655,7 +645,6 @@ l0_c: for (var _b = 0, _c = []; _b < _c.length; _b++) { var x = _c[_b]; var state_11 = _loop_11(x); if (state_11 === "break") break; - if (state_11 === "continue") continue; switch(state_11) { case "break-l0_c": break l0_c; case "continue-l0_c": continue l0_c; @@ -664,23 +653,22 @@ l0_c: for (var _b = 0, _c = []; _b < _c.length; _b++) { var _loop_12 = function(x) { (function () { return x; }); (function () { return x; }); - if (x == 1) { + if (x == "1") { return "break"; } - if (x == 1) { + if (x == "1") { return "break-l00_c"; } - if (x == 2) { + if (x == "2") { return "continue"; } - if (x == 2) { + if (x == "2") { return "continue-l00_c"; } }; l00_c: for (var x in []) { var state_12 = _loop_12(x); if (state_12 === "break") break; - if (state_12 === "continue") continue; switch(state_12) { case "break-l00_c": break l00_c; case "continue-l00_c": continue l00_c; @@ -705,7 +693,6 @@ var _loop_13 = function(x) { l1_c: for (var x = 0; x < 1;) { var state_13 = _loop_13(x); if (state_13 === "break") break; - if (state_13 === "continue") continue; switch(state_13) { case "break-l1_c": break l1_c; case "continue-l1_c": continue l1_c; @@ -731,7 +718,6 @@ var _loop_14 = function() { l2_c: while (1 === 1) { var state_14 = _loop_14(); if (state_14 === "break") break; - if (state_14 === "continue") continue; switch(state_14) { case "break-l2_c": break l2_c; case "continue-l2_c": continue l2_c; @@ -757,7 +743,6 @@ var _loop_15 = function() { l3_c: do { var state_15 = _loop_15(); if (state_15 === "break") break; - if (state_15 === "continue") continue; switch(state_15) { case "break-l3_c": break l3_c; case "continue-l3_c": continue l3_c; @@ -783,7 +768,6 @@ var _loop_16 = function(y) { l4_c: for (var y = 0; y < 1;) { var state_16 = _loop_16(y); if (state_16 === "break") break; - if (state_16 === "continue") continue; switch(state_16) { case "break-l4_c": break l4_c; case "continue-l4_c": continue l4_c; @@ -808,7 +792,6 @@ var _loop_17 = function(x, y) { l5_c: for (var x = 0, y = 1; x < 1;) { var state_17 = _loop_17(x, y); if (state_17 === "break") break; - if (state_17 === "continue") continue; switch(state_17) { case "break-l5_c": break l5_c; case "continue-l5_c": continue l5_c; @@ -834,7 +817,6 @@ var _loop_18 = function() { l6_c: while (1 === 1) { var state_18 = _loop_18(); if (state_18 === "break") break; - if (state_18 === "continue") continue; switch(state_18) { case "break-l6_c": break l6_c; case "continue-l6_c": continue l6_c; @@ -860,7 +842,6 @@ var _loop_19 = function() { l7_c: do { var state_19 = _loop_19(); if (state_19 === "break") break; - if (state_19 === "continue") continue; switch(state_19) { case "break-l7_c": break l7_c; case "continue-l7_c": continue l7_c; @@ -886,7 +867,6 @@ var _loop_20 = function(y) { l8_c: for (var y = 0; y < 1;) { var state_20 = _loop_20(y); if (state_20 === "break") break; - if (state_20 === "continue") continue; switch(state_20) { case "break-l8_c": break l8_c; case "continue-l8_c": continue l8_c; diff --git a/tests/baselines/reference/capturedLetConstInLoop7.symbols b/tests/baselines/reference/capturedLetConstInLoop7.symbols index 2aa5ec2cd38..0f4395a6d68 100644 --- a/tests/baselines/reference/capturedLetConstInLoop7.symbols +++ b/tests/baselines/reference/capturedLetConstInLoop7.symbols @@ -42,22 +42,22 @@ for (let x in []) { (() => x); >x : Symbol(x, Decl(capturedLetConstInLoop7.ts, 20, 8)) - if (x == 1) { + if (x == "1") { >x : Symbol(x, Decl(capturedLetConstInLoop7.ts, 20, 8)) break; } - if (x == 1) { + if (x == "1") { >x : Symbol(x, Decl(capturedLetConstInLoop7.ts, 20, 8)) break l00; } - if (x == 2) { + if (x == "2") { >x : Symbol(x, Decl(capturedLetConstInLoop7.ts, 20, 8)) continue; } - if (x == 2) { + if (x == "2") { >x : Symbol(x, Decl(capturedLetConstInLoop7.ts, 20, 8)) continue l00; @@ -393,22 +393,22 @@ for (const x in []) { (() => x); >x : Symbol(x, Decl(capturedLetConstInLoop7.ts, 208, 10)) - if (x == 1) { + if (x == "1") { >x : Symbol(x, Decl(capturedLetConstInLoop7.ts, 208, 10)) break; } - if (x == 1) { + if (x == "1") { >x : Symbol(x, Decl(capturedLetConstInLoop7.ts, 208, 10)) break l00_c; } - if (x == 2) { + if (x == "2") { >x : Symbol(x, Decl(capturedLetConstInLoop7.ts, 208, 10)) continue; } - if (x == 2) { + if (x == "2") { >x : Symbol(x, Decl(capturedLetConstInLoop7.ts, 208, 10)) continue l00_c; diff --git a/tests/baselines/reference/capturedLetConstInLoop7.types b/tests/baselines/reference/capturedLetConstInLoop7.types index 280985eae0f..29ea34e39a1 100644 --- a/tests/baselines/reference/capturedLetConstInLoop7.types +++ b/tests/baselines/reference/capturedLetConstInLoop7.types @@ -53,45 +53,45 @@ l00: >l00 : any for (let x in []) { ->x : any +>x : string >[] : undefined[] (function() { return x}); ->(function() { return x}) : () => any ->function() { return x} : () => any ->x : any +>(function() { return x}) : () => string +>function() { return x} : () => string +>x : string (() => x); ->(() => x) : () => any ->() => x : () => any ->x : any +>(() => x) : () => string +>() => x : () => string +>x : string - if (x == 1) { ->x == 1 : boolean ->x : any ->1 : number + if (x == "1") { +>x == "1" : boolean +>x : string +>"1" : string break; } - if (x == 1) { ->x == 1 : boolean ->x : any ->1 : number + if (x == "1") { +>x == "1" : boolean +>x : string +>"1" : string break l00; >l00 : any } - if (x == 2) { ->x == 2 : boolean ->x : any ->2 : number + if (x == "2") { +>x == "2" : boolean +>x : string +>"2" : string continue; } - if (x == 2) { ->x == 2 : boolean ->x : any ->2 : number + if (x == "2") { +>x == "2" : boolean +>x : string +>"2" : string continue l00; >l00 : any @@ -607,45 +607,45 @@ l00_c: >l00_c : any for (const x in []) { ->x : any +>x : string >[] : undefined[] (function() { return x}); ->(function() { return x}) : () => any ->function() { return x} : () => any ->x : any +>(function() { return x}) : () => string +>function() { return x} : () => string +>x : string (() => x); ->(() => x) : () => any ->() => x : () => any ->x : any +>(() => x) : () => string +>() => x : () => string +>x : string - if (x == 1) { ->x == 1 : boolean ->x : any ->1 : number + if (x == "1") { +>x == "1" : boolean +>x : string +>"1" : string break; } - if (x == 1) { ->x == 1 : boolean ->x : any ->1 : number + if (x == "1") { +>x == "1" : boolean +>x : string +>"1" : string break l00_c; >l00_c : any } - if (x == 2) { ->x == 2 : boolean ->x : any ->2 : number + if (x == "2") { +>x == "2" : boolean +>x : string +>"2" : string continue; } - if (x == 2) { ->x == 2 : boolean ->x : any ->2 : number + if (x == "2") { +>x == "2" : boolean +>x : string +>"2" : string continue l00_c; >l00_c : any diff --git a/tests/baselines/reference/capturedLetConstInLoop7_ES6.js b/tests/baselines/reference/capturedLetConstInLoop7_ES6.js index 4a2db640081..13c69a88392 100644 --- a/tests/baselines/reference/capturedLetConstInLoop7_ES6.js +++ b/tests/baselines/reference/capturedLetConstInLoop7_ES6.js @@ -22,16 +22,16 @@ l00: for (let x in []) { (function() { return x}); (() => x); - if (x == 1) { + if (x == "1") { break; } - if (x == 1) { + if (x == "1") { break l00; } - if (x == 2) { + if (x == "2") { continue; } - if (x == 2) { + if (x == "2") { continue l00; } } @@ -210,16 +210,16 @@ l00_c: for (const x in []) { (function() { return x}); (() => x); - if (x == 1) { + if (x == "1") { break; } - if (x == 1) { + if (x == "1") { break l00_c; } - if (x == 2) { + if (x == "2") { continue; } - if (x == 2) { + if (x == "2") { continue l00_c; } } @@ -396,16 +396,16 @@ l0: for (let x of []) { l00: for (let x in []) { (function () { return x; }); (() => x); - if (x == 1) { + if (x == "1") { break; } - if (x == 1) { + if (x == "1") { break l00; } - if (x == 2) { + if (x == "2") { continue; } - if (x == 2) { + if (x == "2") { continue l00; } } @@ -563,16 +563,16 @@ l0_c: for (const x of []) { l00_c: for (const x in []) { (function () { return x; }); (() => x); - if (x == 1) { + if (x == "1") { break; } - if (x == 1) { + if (x == "1") { break l00_c; } - if (x == 2) { + if (x == "2") { continue; } - if (x == 2) { + if (x == "2") { continue l00_c; } } diff --git a/tests/baselines/reference/capturedLetConstInLoop7_ES6.symbols b/tests/baselines/reference/capturedLetConstInLoop7_ES6.symbols index 51131f421ba..a817377834b 100644 --- a/tests/baselines/reference/capturedLetConstInLoop7_ES6.symbols +++ b/tests/baselines/reference/capturedLetConstInLoop7_ES6.symbols @@ -42,22 +42,22 @@ for (let x in []) { (() => x); >x : Symbol(x, Decl(capturedLetConstInLoop7_ES6.ts, 20, 8)) - if (x == 1) { + if (x == "1") { >x : Symbol(x, Decl(capturedLetConstInLoop7_ES6.ts, 20, 8)) break; } - if (x == 1) { + if (x == "1") { >x : Symbol(x, Decl(capturedLetConstInLoop7_ES6.ts, 20, 8)) break l00; } - if (x == 2) { + if (x == "2") { >x : Symbol(x, Decl(capturedLetConstInLoop7_ES6.ts, 20, 8)) continue; } - if (x == 2) { + if (x == "2") { >x : Symbol(x, Decl(capturedLetConstInLoop7_ES6.ts, 20, 8)) continue l00; @@ -393,22 +393,22 @@ for (const x in []) { (() => x); >x : Symbol(x, Decl(capturedLetConstInLoop7_ES6.ts, 208, 10)) - if (x == 1) { + if (x == "1") { >x : Symbol(x, Decl(capturedLetConstInLoop7_ES6.ts, 208, 10)) break; } - if (x == 1) { + if (x == "1") { >x : Symbol(x, Decl(capturedLetConstInLoop7_ES6.ts, 208, 10)) break l00_c; } - if (x == 2) { + if (x == "2") { >x : Symbol(x, Decl(capturedLetConstInLoop7_ES6.ts, 208, 10)) continue; } - if (x == 2) { + if (x == "2") { >x : Symbol(x, Decl(capturedLetConstInLoop7_ES6.ts, 208, 10)) continue l00_c; diff --git a/tests/baselines/reference/capturedLetConstInLoop7_ES6.types b/tests/baselines/reference/capturedLetConstInLoop7_ES6.types index 56573fb4927..c72afb41942 100644 --- a/tests/baselines/reference/capturedLetConstInLoop7_ES6.types +++ b/tests/baselines/reference/capturedLetConstInLoop7_ES6.types @@ -53,45 +53,45 @@ l00: >l00 : any for (let x in []) { ->x : any +>x : string >[] : undefined[] (function() { return x}); ->(function() { return x}) : () => any ->function() { return x} : () => any ->x : any +>(function() { return x}) : () => string +>function() { return x} : () => string +>x : string (() => x); ->(() => x) : () => any ->() => x : () => any ->x : any +>(() => x) : () => string +>() => x : () => string +>x : string - if (x == 1) { ->x == 1 : boolean ->x : any ->1 : number + if (x == "1") { +>x == "1" : boolean +>x : string +>"1" : string break; } - if (x == 1) { ->x == 1 : boolean ->x : any ->1 : number + if (x == "1") { +>x == "1" : boolean +>x : string +>"1" : string break l00; >l00 : any } - if (x == 2) { ->x == 2 : boolean ->x : any ->2 : number + if (x == "2") { +>x == "2" : boolean +>x : string +>"2" : string continue; } - if (x == 2) { ->x == 2 : boolean ->x : any ->2 : number + if (x == "2") { +>x == "2" : boolean +>x : string +>"2" : string continue l00; >l00 : any @@ -607,45 +607,45 @@ l00_c: >l00_c : any for (const x in []) { ->x : any +>x : string >[] : undefined[] (function() { return x}); ->(function() { return x}) : () => any ->function() { return x} : () => any ->x : any +>(function() { return x}) : () => string +>function() { return x} : () => string +>x : string (() => x); ->(() => x) : () => any ->() => x : () => any ->x : any +>(() => x) : () => string +>() => x : () => string +>x : string - if (x == 1) { ->x == 1 : boolean ->x : any ->1 : number + if (x == "1") { +>x == "1" : boolean +>x : string +>"1" : string break; } - if (x == 1) { ->x == 1 : boolean ->x : any ->1 : number + if (x == "1") { +>x == "1" : boolean +>x : string +>"1" : string break l00_c; >l00_c : any } - if (x == 2) { ->x == 2 : boolean ->x : any ->2 : number + if (x == "2") { +>x == "2" : boolean +>x : string +>"2" : string continue; } - if (x == 2) { ->x == 2 : boolean ->x : any ->2 : number + if (x == "2") { +>x == "2" : boolean +>x : string +>"2" : string continue l00_c; >l00_c : any diff --git a/tests/baselines/reference/capturedLetConstInLoop8.js b/tests/baselines/reference/capturedLetConstInLoop8.js index b10beb7b44e..122bdb96e36 100644 --- a/tests/baselines/reference/capturedLetConstInLoop8.js +++ b/tests/baselines/reference/capturedLetConstInLoop8.js @@ -165,7 +165,6 @@ function foo() { var state_1 = _loop_2(y); if (typeof state_1 === "object") return state_1; if (state_1 === "break") break; - if (state_1 === "continue") continue; switch(state_1) { case "break-l1": return state_1; case "break-ll1": break ll1; @@ -198,9 +197,8 @@ function foo() { }; l1: for (var x = 0; x < 1; ++x) { var state_2 = _loop_1(x); - if (typeof state_2 === "object") return state_2.value + if (typeof state_2 === "object") return state_2.value; if (state_2 === "break") break; - if (state_2 === "continue") continue; switch(state_2) { case "break-l1": break l1; case "continue-l0": continue l0; @@ -247,7 +245,6 @@ function foo_c() { var state_3 = _loop_4(y); if (typeof state_3 === "object") return state_3; if (state_3 === "break") break; - if (state_3 === "continue") continue; switch(state_3) { case "break-l1": return state_3; case "break-ll1": break ll1; @@ -280,9 +277,8 @@ function foo_c() { }; l1: for (var x = 0; x < 1;) { var state_4 = _loop_3(x); - if (typeof state_4 === "object") return state_4.value + if (typeof state_4 === "object") return state_4.value; if (state_4 === "break") break; - if (state_4 === "continue") continue; switch(state_4) { case "break-l1": break l1; case "continue-l0": continue l0; diff --git a/tests/baselines/reference/capturedLetConstInLoop9.js b/tests/baselines/reference/capturedLetConstInLoop9.js index 9b31218a1e3..1f79b1694cb 100644 --- a/tests/baselines/reference/capturedLetConstInLoop9.js +++ b/tests/baselines/reference/capturedLetConstInLoop9.js @@ -140,25 +140,25 @@ function foo3 () { //// [capturedLetConstInLoop9.js] var _loop_1 = function(x) { - var x_1 = void 0; + var x_1; (function () { return x_1; }); { - var x_2 = void 0; + var x_2; (function () { return x_2; }); } try { } catch (e) { - var x_3 = void 0; + var x_3; (function () { return x_3; }); } switch (x_1) { case 1: - var x_4 = void 0; + var x_4; (function () { return x_4; }); break; } var _loop_2 = function() { - var x_5 = void 0; + var x_5; (function () { return x_5; }); }; while (1 == 1) { @@ -225,7 +225,7 @@ function foo() { l0: for (var _f = 0, _g = []; _f < _g.length; _f++) { var a = _g[_f]; var state_4 = _loop_3(a); - if (typeof state_4 === "object") return state_4.value + if (typeof state_4 === "object") return state_4.value; if (state_4 === "break") break; switch(state_4) { case "break-l0": break l0; diff --git a/tests/baselines/reference/capturedLetConstInLoop9.symbols b/tests/baselines/reference/capturedLetConstInLoop9.symbols index 37d1764b41b..2cc1645863e 100644 --- a/tests/baselines/reference/capturedLetConstInLoop9.symbols +++ b/tests/baselines/reference/capturedLetConstInLoop9.symbols @@ -53,7 +53,7 @@ for (let x = 0; x < 1; ++x) { >A : Symbol(A, Decl(capturedLetConstInLoop9.ts, 24, 5)) m() { ->m : Symbol(m, Decl(capturedLetConstInLoop9.ts, 26, 13)) +>m : Symbol(A.m, Decl(capturedLetConstInLoop9.ts, 26, 13)) return x + 1; >x : Symbol(x, Decl(capturedLetConstInLoop9.ts, 1, 7)) @@ -222,10 +222,10 @@ class C { >C : Symbol(C, Decl(capturedLetConstInLoop9.ts, 120, 1)) constructor(private N: number) { } ->N : Symbol(N, Decl(capturedLetConstInLoop9.ts, 123, 16)) +>N : Symbol(C.N, Decl(capturedLetConstInLoop9.ts, 123, 16)) foo() { ->foo : Symbol(foo, Decl(capturedLetConstInLoop9.ts, 123, 38)) +>foo : Symbol(C.foo, Decl(capturedLetConstInLoop9.ts, 123, 38)) for (let i = 0; i < 100; i++) { >i : Symbol(i, Decl(capturedLetConstInLoop9.ts, 125, 16)) @@ -234,9 +234,9 @@ class C { let f = () => this.N * i; >f : Symbol(f, Decl(capturedLetConstInLoop9.ts, 126, 15)) ->this.N : Symbol(N, Decl(capturedLetConstInLoop9.ts, 123, 16)) +>this.N : Symbol(C.N, Decl(capturedLetConstInLoop9.ts, 123, 16)) >this : Symbol(C, Decl(capturedLetConstInLoop9.ts, 120, 1)) ->N : Symbol(N, Decl(capturedLetConstInLoop9.ts, 123, 16)) +>N : Symbol(C.N, Decl(capturedLetConstInLoop9.ts, 123, 16)) >i : Symbol(i, Decl(capturedLetConstInLoop9.ts, 125, 16)) } } diff --git a/tests/baselines/reference/capturedLetConstInLoop9_ES6.symbols b/tests/baselines/reference/capturedLetConstInLoop9_ES6.symbols index d71a20afe47..c9b8fdb392c 100644 --- a/tests/baselines/reference/capturedLetConstInLoop9_ES6.symbols +++ b/tests/baselines/reference/capturedLetConstInLoop9_ES6.symbols @@ -54,7 +54,7 @@ for (let x = 0; x < 1; ++x) { >A : Symbol(A, Decl(capturedLetConstInLoop9_ES6.ts, 25, 5)) m() { ->m : Symbol(m, Decl(capturedLetConstInLoop9_ES6.ts, 27, 13)) +>m : Symbol(A.m, Decl(capturedLetConstInLoop9_ES6.ts, 27, 13)) return x + 1; >x : Symbol(x, Decl(capturedLetConstInLoop9_ES6.ts, 2, 7)) @@ -127,9 +127,9 @@ function foo() { >z1 : Symbol(z1, Decl(capturedLetConstInLoop9_ES6.ts, 68, 21)) >x1 : Symbol(x1, Decl(capturedLetConstInLoop9_ES6.ts, 68, 33)) >y : Symbol(y, Decl(capturedLetConstInLoop9_ES6.ts, 68, 38)) ->arguments.length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>arguments.length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) >arguments : Symbol(arguments) ->length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) if (b === 1) { >b : Symbol(b, Decl(capturedLetConstInLoop9_ES6.ts, 67, 16)) @@ -222,10 +222,10 @@ class C { >C : Symbol(C, Decl(capturedLetConstInLoop9_ES6.ts, 120, 1)) constructor(private N: number) { } ->N : Symbol(N, Decl(capturedLetConstInLoop9_ES6.ts, 123, 16)) +>N : Symbol(C.N, Decl(capturedLetConstInLoop9_ES6.ts, 123, 16)) foo() { ->foo : Symbol(foo, Decl(capturedLetConstInLoop9_ES6.ts, 123, 38)) +>foo : Symbol(C.foo, Decl(capturedLetConstInLoop9_ES6.ts, 123, 38)) for (let i = 0; i < 100; i++) { >i : Symbol(i, Decl(capturedLetConstInLoop9_ES6.ts, 125, 16)) @@ -234,9 +234,9 @@ class C { let f = () => this.N * i; >f : Symbol(f, Decl(capturedLetConstInLoop9_ES6.ts, 126, 15)) ->this.N : Symbol(N, Decl(capturedLetConstInLoop9_ES6.ts, 123, 16)) +>this.N : Symbol(C.N, Decl(capturedLetConstInLoop9_ES6.ts, 123, 16)) >this : Symbol(C, Decl(capturedLetConstInLoop9_ES6.ts, 120, 1)) ->N : Symbol(N, Decl(capturedLetConstInLoop9_ES6.ts, 123, 16)) +>N : Symbol(C.N, Decl(capturedLetConstInLoop9_ES6.ts, 123, 16)) >i : Symbol(i, Decl(capturedLetConstInLoop9_ES6.ts, 125, 16)) } } @@ -247,24 +247,24 @@ function foo3 () { let x = arguments.length; >x : Symbol(x, Decl(capturedLetConstInLoop9_ES6.ts, 132, 7)) ->arguments.length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>arguments.length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) >arguments : Symbol(arguments) ->length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) for (let y of []) { >y : Symbol(y, Decl(capturedLetConstInLoop9_ES6.ts, 133, 12)) let z = arguments.length; >z : Symbol(z, Decl(capturedLetConstInLoop9_ES6.ts, 134, 11)) ->arguments.length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>arguments.length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) >arguments : Symbol(arguments) ->length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) (function() { return y + z + arguments.length; }); >y : Symbol(y, Decl(capturedLetConstInLoop9_ES6.ts, 133, 12)) >z : Symbol(z, Decl(capturedLetConstInLoop9_ES6.ts, 134, 11)) ->arguments.length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>arguments.length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) >arguments : Symbol(arguments) ->length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) } } diff --git a/tests/baselines/reference/capturedParametersInInitializers1.js b/tests/baselines/reference/capturedParametersInInitializers1.js new file mode 100644 index 00000000000..bc46acecad3 --- /dev/null +++ b/tests/baselines/reference/capturedParametersInInitializers1.js @@ -0,0 +1,40 @@ +//// [capturedParametersInInitializers1.ts] +// ok - usage is deferred +function foo1(y = class {c = x}, x = 1) { + new y().c; +} + +// ok - used in file +function foo2(y = function(x: typeof z) {}, z = 1) { + +} + +// ok -used in type +let a; +function foo3(y = { x: a }, z = 1) { + +} + +//// [capturedParametersInInitializers1.js] +// ok - usage is deferred +function foo1(y, x) { + if (y === void 0) { y = (function () { + function class_1() { + this.c = x; + } + return class_1; + }()); } + if (x === void 0) { x = 1; } + new y().c; +} +// ok - used in file +function foo2(y, z) { + if (y === void 0) { y = function (x) { }; } + if (z === void 0) { z = 1; } +} +// ok -used in type +var a; +function foo3(y, z) { + if (y === void 0) { y = { x: a }; } + if (z === void 0) { z = 1; } +} diff --git a/tests/baselines/reference/capturedParametersInInitializers1.symbols b/tests/baselines/reference/capturedParametersInInitializers1.symbols new file mode 100644 index 00000000000..b72a2c75ef1 --- /dev/null +++ b/tests/baselines/reference/capturedParametersInInitializers1.symbols @@ -0,0 +1,38 @@ +=== tests/cases/compiler/capturedParametersInInitializers1.ts === +// ok - usage is deferred +function foo1(y = class {c = x}, x = 1) { +>foo1 : Symbol(foo1, Decl(capturedParametersInInitializers1.ts, 0, 0)) +>y : Symbol(y, Decl(capturedParametersInInitializers1.ts, 1, 14)) +>c : Symbol((Anonymous class).c, Decl(capturedParametersInInitializers1.ts, 1, 25)) +>x : Symbol(x, Decl(capturedParametersInInitializers1.ts, 1, 32)) +>x : Symbol(x, Decl(capturedParametersInInitializers1.ts, 1, 32)) + + new y().c; +>new y().c : Symbol((Anonymous class).c, Decl(capturedParametersInInitializers1.ts, 1, 25)) +>y : Symbol(y, Decl(capturedParametersInInitializers1.ts, 1, 14)) +>c : Symbol((Anonymous class).c, Decl(capturedParametersInInitializers1.ts, 1, 25)) +} + +// ok - used in file +function foo2(y = function(x: typeof z) {}, z = 1) { +>foo2 : Symbol(foo2, Decl(capturedParametersInInitializers1.ts, 3, 1)) +>y : Symbol(y, Decl(capturedParametersInInitializers1.ts, 6, 14)) +>x : Symbol(x, Decl(capturedParametersInInitializers1.ts, 6, 27)) +>z : Symbol(z, Decl(capturedParametersInInitializers1.ts, 6, 43)) +>z : Symbol(z, Decl(capturedParametersInInitializers1.ts, 6, 43)) + +} + +// ok -used in type +let a; +>a : Symbol(a, Decl(capturedParametersInInitializers1.ts, 11, 3)) + +function foo3(y = { x: a }, z = 1) { +>foo3 : Symbol(foo3, Decl(capturedParametersInInitializers1.ts, 11, 6)) +>y : Symbol(y, Decl(capturedParametersInInitializers1.ts, 12, 14)) +>x : Symbol(x, Decl(capturedParametersInInitializers1.ts, 12, 19)) +>z : Symbol(z, Decl(capturedParametersInInitializers1.ts, 12, 37)) +>a : Symbol(a, Decl(capturedParametersInInitializers1.ts, 11, 3)) +>z : Symbol(z, Decl(capturedParametersInInitializers1.ts, 12, 37)) + +} diff --git a/tests/baselines/reference/capturedParametersInInitializers1.types b/tests/baselines/reference/capturedParametersInInitializers1.types new file mode 100644 index 00000000000..493c608c145 --- /dev/null +++ b/tests/baselines/reference/capturedParametersInInitializers1.types @@ -0,0 +1,46 @@ +=== tests/cases/compiler/capturedParametersInInitializers1.ts === +// ok - usage is deferred +function foo1(y = class {c = x}, x = 1) { +>foo1 : (y?: typeof (Anonymous class), x?: number) => void +>y : typeof (Anonymous class) +>class {c = x} : typeof (Anonymous class) +>c : number +>x : number +>x : number +>1 : number + + new y().c; +>new y().c : number +>new y() : (Anonymous class) +>y : typeof (Anonymous class) +>c : number +} + +// ok - used in file +function foo2(y = function(x: typeof z) {}, z = 1) { +>foo2 : (y?: (x: number) => void, z?: number) => void +>y : (x: number) => void +>function(x: typeof z) {} : (x: number) => void +>x : number +>z : number +>z : number +>1 : number + +} + +// ok -used in type +let a; +>a : any + +function foo3(y = { x: a }, z = 1) { +>foo3 : (y?: { x: number; }, z?: number) => void +>y : { x: number; } +>{ x: a } : { x: number; } +>x : number +>a : number +>z : number +>a : any +>z : number +>1 : number + +} diff --git a/tests/baselines/reference/capturedParametersInInitializers2.errors.txt b/tests/baselines/reference/capturedParametersInInitializers2.errors.txt new file mode 100644 index 00000000000..9e9f48e5390 --- /dev/null +++ b/tests/baselines/reference/capturedParametersInInitializers2.errors.txt @@ -0,0 +1,14 @@ +tests/cases/compiler/capturedParametersInInitializers2.ts(1,36): error TS2373: Initializer of parameter 'y' cannot reference identifier 'x' declared after it. +tests/cases/compiler/capturedParametersInInitializers2.ts(4,26): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. + + +==== tests/cases/compiler/capturedParametersInInitializers2.ts (2 errors) ==== + function foo(y = class {static c = x}, x = 1) { + ~ +!!! error TS2373: Initializer of parameter 'y' cannot reference identifier 'x' declared after it. + y.c + } + function foo2(y = class {[x] = x}, x = 1) { + ~~~ +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. + } \ No newline at end of file diff --git a/tests/baselines/reference/capturedParametersInInitializers2.js b/tests/baselines/reference/capturedParametersInInitializers2.js new file mode 100644 index 00000000000..8d2cd4d58cd --- /dev/null +++ b/tests/baselines/reference/capturedParametersInInitializers2.js @@ -0,0 +1,27 @@ +//// [capturedParametersInInitializers2.ts] +function foo(y = class {static c = x}, x = 1) { + y.c +} +function foo2(y = class {[x] = x}, x = 1) { +} + +//// [capturedParametersInInitializers2.js] +function foo(y, x) { + if (y === void 0) { y = (function () { + function class_1() { + } + class_1.c = x; + return class_1; + }()); } + if (x === void 0) { x = 1; } + y.c; +} +function foo2(y, x) { + if (y === void 0) { y = (function () { + function class_2() { + this[x] = x; + } + return class_2; + }()); } + if (x === void 0) { x = 1; } +} diff --git a/tests/baselines/reference/castTest.symbols b/tests/baselines/reference/castTest.symbols index e0bf154820e..944cc8238e6 100644 --- a/tests/baselines/reference/castTest.symbols +++ b/tests/baselines/reference/castTest.symbols @@ -32,19 +32,19 @@ declare class Point >Point : Symbol(Point, Decl(castTest.ts, 11, 37)) { x: number; ->x : Symbol(x, Decl(castTest.ts, 14, 1)) +>x : Symbol(Point.x, Decl(castTest.ts, 14, 1)) y: number; ->y : Symbol(y, Decl(castTest.ts, 15, 14)) +>y : Symbol(Point.y, Decl(castTest.ts, 15, 14)) add(dx: number, dy: number): Point; ->add : Symbol(add, Decl(castTest.ts, 16, 14)) +>add : Symbol(Point.add, Decl(castTest.ts, 16, 14)) >dx : Symbol(dx, Decl(castTest.ts, 17, 8)) >dy : Symbol(dy, Decl(castTest.ts, 17, 19)) >Point : Symbol(Point, Decl(castTest.ts, 11, 37)) mult(p: Point): Point; ->mult : Symbol(mult, Decl(castTest.ts, 17, 39)) +>mult : Symbol(Point.mult, Decl(castTest.ts, 17, 39)) >p : Symbol(p, Decl(castTest.ts, 18, 9)) >Point : Symbol(Point, Decl(castTest.ts, 11, 37)) >Point : Symbol(Point, Decl(castTest.ts, 11, 37)) diff --git a/tests/baselines/reference/castingTuple.errors.txt b/tests/baselines/reference/castingTuple.errors.txt index 62a36c9c156..6d5549c6bf2 100644 --- a/tests/baselines/reference/castingTuple.errors.txt +++ b/tests/baselines/reference/castingTuple.errors.txt @@ -1,24 +1,15 @@ -tests/cases/conformance/types/tuple/castingTuple.ts(13,23): error TS2352: Neither type '[number, string]' nor type '[number, string, boolean]' is assignable to the other. - Property '2' is missing in type '[number, string]'. -tests/cases/conformance/types/tuple/castingTuple.ts(16,21): error TS2352: Neither type '[C, D]' nor type '[C, D, A]' is assignable to the other. - Property '2' is missing in type '[C, D]'. -tests/cases/conformance/types/tuple/castingTuple.ts(28,10): error TS2352: Neither type '[number, string]' nor type '[number, number]' is assignable to the other. +tests/cases/conformance/types/tuple/castingTuple.ts(28,10): error TS2352: Type '[number, string]' cannot be converted to type '[number, number]'. Types of property '1' are incompatible. - Type 'string' is not assignable to type 'number'. -tests/cases/conformance/types/tuple/castingTuple.ts(29,10): error TS2352: Neither type '[C, D]' nor type '[A, I]' is assignable to the other. + Type 'string' is not comparable to type 'number'. +tests/cases/conformance/types/tuple/castingTuple.ts(29,10): error TS2352: Type '[C, D]' cannot be converted to type '[A, I]'. Types of property '0' are incompatible. - Type 'C' is not assignable to type 'A'. + Type 'C' is not comparable to type 'A'. Property 'a' is missing in type 'C'. tests/cases/conformance/types/tuple/castingTuple.ts(30,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'array1' must be of type '{}[]', but here has type 'number[]'. -tests/cases/conformance/types/tuple/castingTuple.ts(30,14): error TS2352: Neither type '[number, string]' nor type 'number[]' is assignable to the other. - Types of property 'pop' are incompatible. - Type '() => number | string' is not assignable to type '() => number'. - Type 'number | string' is not assignable to type 'number'. - Type 'string' is not assignable to type 'number'. tests/cases/conformance/types/tuple/castingTuple.ts(31,1): error TS2304: Cannot find name 't4'. -==== tests/cases/conformance/types/tuple/castingTuple.ts (7 errors) ==== +==== tests/cases/conformance/types/tuple/castingTuple.ts (4 errors) ==== interface I { } class A { a = 10; } class C implements I { c }; @@ -32,15 +23,9 @@ tests/cases/conformance/types/tuple/castingTuple.ts(31,1): error TS2304: Cannot var numStrTuple: [number, string] = [5, "foo"]; var emptyObjTuple = <[{}, {}]>numStrTuple; var numStrBoolTuple = <[number, string, boolean]>numStrTuple; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2352: Neither type '[number, string]' nor type '[number, string, boolean]' is assignable to the other. -!!! error TS2352: Property '2' is missing in type '[number, string]'. var classCDTuple: [C, D] = [new C(), new D()]; var interfaceIITuple = <[I, I]>classCDTuple; var classCDATuple = <[C, D, A]>classCDTuple; - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2352: Neither type '[C, D]' nor type '[C, D, A]' is assignable to the other. -!!! error TS2352: Property '2' is missing in type '[C, D]'. var eleFromCDA1 = classCDATuple[2]; // A var eleFromCDA2 = classCDATuple[5]; // C | D | A var t10: [E1, E2] = [E1.one, E2.one]; @@ -54,24 +39,18 @@ tests/cases/conformance/types/tuple/castingTuple.ts(31,1): error TS2304: Cannot // error var t3 = <[number, number]>numStrTuple; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2352: Neither type '[number, string]' nor type '[number, number]' is assignable to the other. +!!! error TS2352: Type '[number, string]' cannot be converted to type '[number, number]'. !!! error TS2352: Types of property '1' are incompatible. -!!! error TS2352: Type 'string' is not assignable to type 'number'. +!!! error TS2352: Type 'string' is not comparable to type 'number'. var t9 = <[A, I]>classCDTuple; ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2352: Neither type '[C, D]' nor type '[A, I]' is assignable to the other. +!!! error TS2352: Type '[C, D]' cannot be converted to type '[A, I]'. !!! error TS2352: Types of property '0' are incompatible. -!!! error TS2352: Type 'C' is not assignable to type 'A'. +!!! error TS2352: Type 'C' is not comparable to type 'A'. !!! error TS2352: Property 'a' is missing in type 'C'. var array1 = numStrTuple; ~~~~~~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'array1' must be of type '{}[]', but here has type 'number[]'. - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2352: Neither type '[number, string]' nor type 'number[]' is assignable to the other. -!!! error TS2352: Types of property 'pop' are incompatible. -!!! error TS2352: Type '() => number | string' is not assignable to type '() => number'. -!!! error TS2352: Type 'number | string' is not assignable to type 'number'. -!!! error TS2352: Type 'string' is not assignable to type 'number'. t4[2] = 10; ~~ !!! error TS2304: Cannot find name 't4'. diff --git a/tests/baselines/reference/chainedAssignment2.symbols b/tests/baselines/reference/chainedAssignment2.symbols index 3335c3cbb43..0f37d41c3be 100644 --- a/tests/baselines/reference/chainedAssignment2.symbols +++ b/tests/baselines/reference/chainedAssignment2.symbols @@ -10,7 +10,7 @@ var c: boolean; var d: Date; >d : Symbol(d, Decl(chainedAssignment2.ts, 3, 3)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) var e: RegExp; >e : Symbol(e, Decl(chainedAssignment2.ts, 4, 3)) diff --git a/tests/baselines/reference/chainedSpecializationToObjectTypeLiteral.symbols b/tests/baselines/reference/chainedSpecializationToObjectTypeLiteral.symbols index 8232c44a620..f8fbae6b8b3 100644 --- a/tests/baselines/reference/chainedSpecializationToObjectTypeLiteral.symbols +++ b/tests/baselines/reference/chainedSpecializationToObjectTypeLiteral.symbols @@ -4,13 +4,13 @@ interface Sequence { >T : Symbol(T, Decl(chainedSpecializationToObjectTypeLiteral.ts, 0, 19)) each(iterator: (value: T) => void): void; ->each : Symbol(each, Decl(chainedSpecializationToObjectTypeLiteral.ts, 0, 23)) +>each : Symbol(Sequence.each, Decl(chainedSpecializationToObjectTypeLiteral.ts, 0, 23)) >iterator : Symbol(iterator, Decl(chainedSpecializationToObjectTypeLiteral.ts, 1, 9)) >value : Symbol(value, Decl(chainedSpecializationToObjectTypeLiteral.ts, 1, 20)) >T : Symbol(T, Decl(chainedSpecializationToObjectTypeLiteral.ts, 0, 19)) map(iterator: (value: T) => U): Sequence; ->map : Symbol(map, Decl(chainedSpecializationToObjectTypeLiteral.ts, 1, 45)) +>map : Symbol(Sequence.map, Decl(chainedSpecializationToObjectTypeLiteral.ts, 1, 45)) >U : Symbol(U, Decl(chainedSpecializationToObjectTypeLiteral.ts, 2, 8)) >iterator : Symbol(iterator, Decl(chainedSpecializationToObjectTypeLiteral.ts, 2, 11)) >value : Symbol(value, Decl(chainedSpecializationToObjectTypeLiteral.ts, 2, 22)) @@ -20,7 +20,7 @@ interface Sequence { >U : Symbol(U, Decl(chainedSpecializationToObjectTypeLiteral.ts, 2, 8)) filter(iterator: (value: T) => boolean): Sequence; ->filter : Symbol(filter, Decl(chainedSpecializationToObjectTypeLiteral.ts, 2, 51)) +>filter : Symbol(Sequence.filter, Decl(chainedSpecializationToObjectTypeLiteral.ts, 2, 51)) >iterator : Symbol(iterator, Decl(chainedSpecializationToObjectTypeLiteral.ts, 3, 11)) >value : Symbol(value, Decl(chainedSpecializationToObjectTypeLiteral.ts, 3, 22)) >T : Symbol(T, Decl(chainedSpecializationToObjectTypeLiteral.ts, 0, 19)) @@ -28,7 +28,7 @@ interface Sequence { >T : Symbol(T, Decl(chainedSpecializationToObjectTypeLiteral.ts, 0, 19)) groupBy(keySelector: (value: T) => K): Sequence<{ key: K; items: T[]; }>; ->groupBy : Symbol(groupBy, Decl(chainedSpecializationToObjectTypeLiteral.ts, 3, 57)) +>groupBy : Symbol(Sequence.groupBy, Decl(chainedSpecializationToObjectTypeLiteral.ts, 3, 57)) >K : Symbol(K, Decl(chainedSpecializationToObjectTypeLiteral.ts, 4, 12)) >keySelector : Symbol(keySelector, Decl(chainedSpecializationToObjectTypeLiteral.ts, 4, 15)) >value : Symbol(value, Decl(chainedSpecializationToObjectTypeLiteral.ts, 4, 29)) diff --git a/tests/baselines/reference/checkInfiniteExpansionTermination.symbols b/tests/baselines/reference/checkInfiniteExpansionTermination.symbols index 52ba8ad698e..e6d75d40cee 100644 --- a/tests/baselines/reference/checkInfiniteExpansionTermination.symbols +++ b/tests/baselines/reference/checkInfiniteExpansionTermination.symbols @@ -7,7 +7,7 @@ interface IObservable { >T : Symbol(T, Decl(checkInfiniteExpansionTermination.ts, 3, 22)) n: IObservable; // Needed, must be T[] ->n : Symbol(n, Decl(checkInfiniteExpansionTermination.ts, 3, 26)) +>n : Symbol(IObservable.n, Decl(checkInfiniteExpansionTermination.ts, 3, 26)) >IObservable : Symbol(IObservable, Decl(checkInfiniteExpansionTermination.ts, 0, 0)) >T : Symbol(T, Decl(checkInfiniteExpansionTermination.ts, 3, 22)) } @@ -21,11 +21,11 @@ interface ISubject extends IObservable { } interface Foo { x } >Foo : Symbol(Foo, Decl(checkInfiniteExpansionTermination.ts, 8, 48)) ->x : Symbol(x, Decl(checkInfiniteExpansionTermination.ts, 10, 15)) +>x : Symbol(Foo.x, Decl(checkInfiniteExpansionTermination.ts, 10, 15)) interface Bar { y } >Bar : Symbol(Bar, Decl(checkInfiniteExpansionTermination.ts, 10, 19)) ->y : Symbol(y, Decl(checkInfiniteExpansionTermination.ts, 11, 15)) +>y : Symbol(Bar.y, Decl(checkInfiniteExpansionTermination.ts, 11, 15)) var values: IObservable; >values : Symbol(values, Decl(checkInfiniteExpansionTermination.ts, 13, 3)) diff --git a/tests/baselines/reference/checkInfiniteExpansionTermination2.symbols b/tests/baselines/reference/checkInfiniteExpansionTermination2.symbols index c4fe17a09a6..b7be2445e0d 100644 --- a/tests/baselines/reference/checkInfiniteExpansionTermination2.symbols +++ b/tests/baselines/reference/checkInfiniteExpansionTermination2.symbols @@ -7,7 +7,7 @@ interface IObservable { >T : Symbol(T, Decl(checkInfiniteExpansionTermination2.ts, 3, 22)) n: IObservable; ->n : Symbol(n, Decl(checkInfiniteExpansionTermination2.ts, 3, 26)) +>n : Symbol(IObservable.n, Decl(checkInfiniteExpansionTermination2.ts, 3, 26)) >IObservable : Symbol(IObservable, Decl(checkInfiniteExpansionTermination2.ts, 0, 0)) >T : Symbol(T, Decl(checkInfiniteExpansionTermination2.ts, 3, 22)) } diff --git a/tests/baselines/reference/checkInterfaceBases.symbols b/tests/baselines/reference/checkInterfaceBases.symbols index 6b5f987b0bc..57a820dcfaf 100644 --- a/tests/baselines/reference/checkInterfaceBases.symbols +++ b/tests/baselines/reference/checkInterfaceBases.symbols @@ -4,7 +4,7 @@ interface SecondEvent { >SecondEvent : Symbol(SecondEvent, Decl(app.ts, 0, 0)) data: any; ->data : Symbol(data, Decl(app.ts, 1, 23)) +>data : Symbol(SecondEvent.data, Decl(app.ts, 1, 23)) } interface Third extends JQueryEventObjectTest, SecondEvent {} >Third : Symbol(Third, Decl(app.ts, 3, 1)) @@ -16,12 +16,12 @@ interface JQueryEventObjectTest { >JQueryEventObjectTest : Symbol(JQueryEventObjectTest, Decl(jquery.d.ts, 0, 0)) data: any; ->data : Symbol(data, Decl(jquery.d.ts, 0, 33)) +>data : Symbol(JQueryEventObjectTest.data, Decl(jquery.d.ts, 0, 33)) which: number; ->which : Symbol(which, Decl(jquery.d.ts, 1, 14)) +>which : Symbol(JQueryEventObjectTest.which, Decl(jquery.d.ts, 1, 14)) metaKey: any; ->metaKey : Symbol(metaKey, Decl(jquery.d.ts, 2, 18)) +>metaKey : Symbol(JQueryEventObjectTest.metaKey, Decl(jquery.d.ts, 2, 18)) } diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing1.js b/tests/baselines/reference/checkSuperCallBeforeThisAccessing1.js new file mode 100644 index 00000000000..cfb5726dac1 --- /dev/null +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing1.js @@ -0,0 +1,33 @@ +//// [checkSuperCallBeforeThisAccessing1.ts] +class Based { } +class Derived extends Based { + public x: number; + constructor() { + super(); + this; + this.x = 10; + var that = this; + } +} + +//// [checkSuperCallBeforeThisAccessing1.js] +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var Based = (function () { + function Based() { + } + return Based; +}()); +var Derived = (function (_super) { + __extends(Derived, _super); + function Derived() { + _super.call(this); + this; + this.x = 10; + var that = this; + } + return Derived; +}(Based)); diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing1.symbols b/tests/baselines/reference/checkSuperCallBeforeThisAccessing1.symbols new file mode 100644 index 00000000000..8ac242b0e48 --- /dev/null +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing1.symbols @@ -0,0 +1,28 @@ +=== tests/cases/compiler/checkSuperCallBeforeThisAccessing1.ts === +class Based { } +>Based : Symbol(Based, Decl(checkSuperCallBeforeThisAccessing1.ts, 0, 0)) + +class Derived extends Based { +>Derived : Symbol(Derived, Decl(checkSuperCallBeforeThisAccessing1.ts, 0, 15)) +>Based : Symbol(Based, Decl(checkSuperCallBeforeThisAccessing1.ts, 0, 0)) + + public x: number; +>x : Symbol(Derived.x, Decl(checkSuperCallBeforeThisAccessing1.ts, 1, 29)) + + constructor() { + super(); +>super : Symbol(Based, Decl(checkSuperCallBeforeThisAccessing1.ts, 0, 0)) + + this; +>this : Symbol(Derived, Decl(checkSuperCallBeforeThisAccessing1.ts, 0, 15)) + + this.x = 10; +>this.x : Symbol(Derived.x, Decl(checkSuperCallBeforeThisAccessing1.ts, 1, 29)) +>this : Symbol(Derived, Decl(checkSuperCallBeforeThisAccessing1.ts, 0, 15)) +>x : Symbol(Derived.x, Decl(checkSuperCallBeforeThisAccessing1.ts, 1, 29)) + + var that = this; +>that : Symbol(that, Decl(checkSuperCallBeforeThisAccessing1.ts, 7, 11)) +>this : Symbol(Derived, Decl(checkSuperCallBeforeThisAccessing1.ts, 0, 15)) + } +} diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing1.types b/tests/baselines/reference/checkSuperCallBeforeThisAccessing1.types new file mode 100644 index 00000000000..d734b0c6ad0 --- /dev/null +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing1.types @@ -0,0 +1,31 @@ +=== tests/cases/compiler/checkSuperCallBeforeThisAccessing1.ts === +class Based { } +>Based : Based + +class Derived extends Based { +>Derived : Derived +>Based : Based + + public x: number; +>x : number + + constructor() { + super(); +>super() : void +>super : typeof Based + + this; +>this : this + + this.x = 10; +>this.x = 10 : number +>this.x : number +>this : this +>x : number +>10 : number + + var that = this; +>that : this +>this : this + } +} diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing2.errors.txt b/tests/baselines/reference/checkSuperCallBeforeThisAccessing2.errors.txt new file mode 100644 index 00000000000..4e947e8630f --- /dev/null +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing2.errors.txt @@ -0,0 +1,16 @@ +tests/cases/compiler/checkSuperCallBeforeThisAccessing2.ts(5,9): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. + + +==== tests/cases/compiler/checkSuperCallBeforeThisAccessing2.ts (1 errors) ==== + class Based { } + class Derived extends Based { + public x: number; + constructor() { + this.x = 100; + ~~~~ +!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. + super(); + this.x = 10; + var that = this; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing2.js b/tests/baselines/reference/checkSuperCallBeforeThisAccessing2.js new file mode 100644 index 00000000000..afbc15cf912 --- /dev/null +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing2.js @@ -0,0 +1,33 @@ +//// [checkSuperCallBeforeThisAccessing2.ts] +class Based { } +class Derived extends Based { + public x: number; + constructor() { + this.x = 100; + super(); + this.x = 10; + var that = this; + } +} + +//// [checkSuperCallBeforeThisAccessing2.js] +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var Based = (function () { + function Based() { + } + return Based; +}()); +var Derived = (function (_super) { + __extends(Derived, _super); + function Derived() { + this.x = 100; + _super.call(this); + this.x = 10; + var that = this; + } + return Derived; +}(Based)); diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing3.js b/tests/baselines/reference/checkSuperCallBeforeThisAccessing3.js new file mode 100644 index 00000000000..7e9c23c1f83 --- /dev/null +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing3.js @@ -0,0 +1,43 @@ +//// [checkSuperCallBeforeThisAccessing3.ts] +class Based { } +class Derived extends Based { + public x: number; + constructor() { + class innver { + public y: boolean; + constructor() { + this.y = true; + } + } + super(); + this.x = 10; + var that = this; + } +} + +//// [checkSuperCallBeforeThisAccessing3.js] +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var Based = (function () { + function Based() { + } + return Based; +}()); +var Derived = (function (_super) { + __extends(Derived, _super); + function Derived() { + var innver = (function () { + function innver() { + this.y = true; + } + return innver; + }()); + _super.call(this); + this.x = 10; + var that = this; + } + return Derived; +}(Based)); diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing3.symbols b/tests/baselines/reference/checkSuperCallBeforeThisAccessing3.symbols new file mode 100644 index 00000000000..44bbd5949bb --- /dev/null +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing3.symbols @@ -0,0 +1,38 @@ +=== tests/cases/compiler/checkSuperCallBeforeThisAccessing3.ts === +class Based { } +>Based : Symbol(Based, Decl(checkSuperCallBeforeThisAccessing3.ts, 0, 0)) + +class Derived extends Based { +>Derived : Symbol(Derived, Decl(checkSuperCallBeforeThisAccessing3.ts, 0, 15)) +>Based : Symbol(Based, Decl(checkSuperCallBeforeThisAccessing3.ts, 0, 0)) + + public x: number; +>x : Symbol(Derived.x, Decl(checkSuperCallBeforeThisAccessing3.ts, 1, 29)) + + constructor() { + class innver { +>innver : Symbol(innver, Decl(checkSuperCallBeforeThisAccessing3.ts, 3, 19)) + + public y: boolean; +>y : Symbol(innver.y, Decl(checkSuperCallBeforeThisAccessing3.ts, 4, 22)) + + constructor() { + this.y = true; +>this.y : Symbol(innver.y, Decl(checkSuperCallBeforeThisAccessing3.ts, 4, 22)) +>this : Symbol(innver, Decl(checkSuperCallBeforeThisAccessing3.ts, 3, 19)) +>y : Symbol(innver.y, Decl(checkSuperCallBeforeThisAccessing3.ts, 4, 22)) + } + } + super(); +>super : Symbol(Based, Decl(checkSuperCallBeforeThisAccessing3.ts, 0, 0)) + + this.x = 10; +>this.x : Symbol(Derived.x, Decl(checkSuperCallBeforeThisAccessing3.ts, 1, 29)) +>this : Symbol(Derived, Decl(checkSuperCallBeforeThisAccessing3.ts, 0, 15)) +>x : Symbol(Derived.x, Decl(checkSuperCallBeforeThisAccessing3.ts, 1, 29)) + + var that = this; +>that : Symbol(that, Decl(checkSuperCallBeforeThisAccessing3.ts, 12, 11)) +>this : Symbol(Derived, Decl(checkSuperCallBeforeThisAccessing3.ts, 0, 15)) + } +} diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing3.types b/tests/baselines/reference/checkSuperCallBeforeThisAccessing3.types new file mode 100644 index 00000000000..c4e9e15ed8e --- /dev/null +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing3.types @@ -0,0 +1,43 @@ +=== tests/cases/compiler/checkSuperCallBeforeThisAccessing3.ts === +class Based { } +>Based : Based + +class Derived extends Based { +>Derived : Derived +>Based : Based + + public x: number; +>x : number + + constructor() { + class innver { +>innver : innver + + public y: boolean; +>y : boolean + + constructor() { + this.y = true; +>this.y = true : boolean +>this.y : boolean +>this : this +>y : boolean +>true : boolean + } + } + super(); +>super() : void +>super : typeof Based + + this.x = 10; +>this.x = 10 : number +>this.x : number +>this : this +>x : number +>10 : number + + var that = this; +>that : this +>this : this + } +} diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing4.js b/tests/baselines/reference/checkSuperCallBeforeThisAccessing4.js new file mode 100644 index 00000000000..1257b446ccb --- /dev/null +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing4.js @@ -0,0 +1,52 @@ +//// [checkSuperCallBeforeThisAccessing4.ts] +class Based { } +class Derived extends Based { + public x: number; + constructor() { + (() => { + this; // No error + }); + () => { + this; // No error + }; + (() => { + this; // No error + })(); + super(); + super(); + this.x = 10; + var that = this; + } +} + +//// [checkSuperCallBeforeThisAccessing4.js] +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var Based = (function () { + function Based() { + } + return Based; +}()); +var Derived = (function (_super) { + __extends(Derived, _super); + function Derived() { + var _this = this; + (function () { + _this; // No error + }); + (function () { + _this; // No error + }); + (function () { + _this; // No error + })(); + _super.call(this); + _super.call(this); + this.x = 10; + var that = this; + } + return Derived; +}(Based)); diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing4.symbols b/tests/baselines/reference/checkSuperCallBeforeThisAccessing4.symbols new file mode 100644 index 00000000000..4ea467558df --- /dev/null +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing4.symbols @@ -0,0 +1,43 @@ +=== tests/cases/compiler/checkSuperCallBeforeThisAccessing4.ts === +class Based { } +>Based : Symbol(Based, Decl(checkSuperCallBeforeThisAccessing4.ts, 0, 0)) + +class Derived extends Based { +>Derived : Symbol(Derived, Decl(checkSuperCallBeforeThisAccessing4.ts, 0, 15)) +>Based : Symbol(Based, Decl(checkSuperCallBeforeThisAccessing4.ts, 0, 0)) + + public x: number; +>x : Symbol(Derived.x, Decl(checkSuperCallBeforeThisAccessing4.ts, 1, 29)) + + constructor() { + (() => { + this; // No error +>this : Symbol(Derived, Decl(checkSuperCallBeforeThisAccessing4.ts, 0, 15)) + + }); + () => { + this; // No error +>this : Symbol(Derived, Decl(checkSuperCallBeforeThisAccessing4.ts, 0, 15)) + + }; + (() => { + this; // No error +>this : Symbol(Derived, Decl(checkSuperCallBeforeThisAccessing4.ts, 0, 15)) + + })(); + super(); +>super : Symbol(Based, Decl(checkSuperCallBeforeThisAccessing4.ts, 0, 0)) + + super(); +>super : Symbol(Based, Decl(checkSuperCallBeforeThisAccessing4.ts, 0, 0)) + + this.x = 10; +>this.x : Symbol(Derived.x, Decl(checkSuperCallBeforeThisAccessing4.ts, 1, 29)) +>this : Symbol(Derived, Decl(checkSuperCallBeforeThisAccessing4.ts, 0, 15)) +>x : Symbol(Derived.x, Decl(checkSuperCallBeforeThisAccessing4.ts, 1, 29)) + + var that = this; +>that : Symbol(that, Decl(checkSuperCallBeforeThisAccessing4.ts, 16, 11)) +>this : Symbol(Derived, Decl(checkSuperCallBeforeThisAccessing4.ts, 0, 15)) + } +} diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing4.types b/tests/baselines/reference/checkSuperCallBeforeThisAccessing4.types new file mode 100644 index 00000000000..f42a0ac8563 --- /dev/null +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing4.types @@ -0,0 +1,56 @@ +=== tests/cases/compiler/checkSuperCallBeforeThisAccessing4.ts === +class Based { } +>Based : Based + +class Derived extends Based { +>Derived : Derived +>Based : Based + + public x: number; +>x : number + + constructor() { + (() => { +>(() => { this; // No error }) : () => void +>() => { this; // No error } : () => void + + this; // No error +>this : this + + }); + () => { +>() => { this; // No error } : () => void + + this; // No error +>this : this + + }; + (() => { +>(() => { this; // No error })() : void +>(() => { this; // No error }) : () => void +>() => { this; // No error } : () => void + + this; // No error +>this : this + + })(); + super(); +>super() : void +>super : typeof Based + + super(); +>super() : void +>super : typeof Based + + this.x = 10; +>this.x = 10 : number +>this.x : number +>this : this +>x : number +>10 : number + + var that = this; +>that : this +>this : this + } +} diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing5.errors.txt b/tests/baselines/reference/checkSuperCallBeforeThisAccessing5.errors.txt new file mode 100644 index 00000000000..a0b86e28cf0 --- /dev/null +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing5.errors.txt @@ -0,0 +1,13 @@ +tests/cases/compiler/checkSuperCallBeforeThisAccessing5.ts(5,15): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. + + +==== tests/cases/compiler/checkSuperCallBeforeThisAccessing5.ts (1 errors) ==== + class Based { constructor(...arg) { } } + class Derived extends Based { + public x: number; + constructor() { + super(this.x); + ~~~~ +!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. + } + } \ No newline at end of file diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing5.js b/tests/baselines/reference/checkSuperCallBeforeThisAccessing5.js new file mode 100644 index 00000000000..1889ee998ca --- /dev/null +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing5.js @@ -0,0 +1,31 @@ +//// [checkSuperCallBeforeThisAccessing5.ts] +class Based { constructor(...arg) { } } +class Derived extends Based { + public x: number; + constructor() { + super(this.x); + } +} + +//// [checkSuperCallBeforeThisAccessing5.js] +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var Based = (function () { + function Based() { + var arg = []; + for (var _i = 0; _i < arguments.length; _i++) { + arg[_i - 0] = arguments[_i]; + } + } + return Based; +}()); +var Derived = (function (_super) { + __extends(Derived, _super); + function Derived() { + _super.call(this, this.x); + } + return Derived; +}(Based)); diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing6.js b/tests/baselines/reference/checkSuperCallBeforeThisAccessing6.js new file mode 100644 index 00000000000..39db4dec174 --- /dev/null +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing6.js @@ -0,0 +1,36 @@ +//// [checkSuperCallBeforeThisAccessing6.ts] +class Base { + constructor(...arg) { + } +} +class Super extends Base { + constructor() { + (() => this); // No Error + super(); + } +} + +//// [checkSuperCallBeforeThisAccessing6.js] +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var Base = (function () { + function Base() { + var arg = []; + for (var _i = 0; _i < arguments.length; _i++) { + arg[_i - 0] = arguments[_i]; + } + } + return Base; +}()); +var Super = (function (_super) { + __extends(Super, _super); + function Super() { + var _this = this; + (function () { return _this; }); // No Error + _super.call(this); + } + return Super; +}(Base)); diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing6.symbols b/tests/baselines/reference/checkSuperCallBeforeThisAccessing6.symbols new file mode 100644 index 00000000000..84bac5775ec --- /dev/null +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing6.symbols @@ -0,0 +1,20 @@ +=== tests/cases/compiler/checkSuperCallBeforeThisAccessing6.ts === +class Base { +>Base : Symbol(Base, Decl(checkSuperCallBeforeThisAccessing6.ts, 0, 0)) + + constructor(...arg) { +>arg : Symbol(arg, Decl(checkSuperCallBeforeThisAccessing6.ts, 1, 16)) + } +} +class Super extends Base { +>Super : Symbol(Super, Decl(checkSuperCallBeforeThisAccessing6.ts, 3, 1)) +>Base : Symbol(Base, Decl(checkSuperCallBeforeThisAccessing6.ts, 0, 0)) + + constructor() { + (() => this); // No Error +>this : Symbol(Super, Decl(checkSuperCallBeforeThisAccessing6.ts, 3, 1)) + + super(); +>super : Symbol(Base, Decl(checkSuperCallBeforeThisAccessing6.ts, 0, 0)) + } +} diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing6.types b/tests/baselines/reference/checkSuperCallBeforeThisAccessing6.types new file mode 100644 index 00000000000..826dab0c400 --- /dev/null +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing6.types @@ -0,0 +1,23 @@ +=== tests/cases/compiler/checkSuperCallBeforeThisAccessing6.ts === +class Base { +>Base : Base + + constructor(...arg) { +>arg : any[] + } +} +class Super extends Base { +>Super : Super +>Base : Base + + constructor() { + (() => this); // No Error +>(() => this) : () => this +>() => this : () => this +>this : this + + super(); +>super() : void +>super : typeof Base + } +} diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing7.js b/tests/baselines/reference/checkSuperCallBeforeThisAccessing7.js new file mode 100644 index 00000000000..d071c05db5d --- /dev/null +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing7.js @@ -0,0 +1,30 @@ +//// [checkSuperCallBeforeThisAccessing7.ts] +class Base { + constructor(func: ()=>Base) { + } +} +class Super extends Base { + constructor() { + super((() => this)); // No error + } +} + +//// [checkSuperCallBeforeThisAccessing7.js] +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var Base = (function () { + function Base(func) { + } + return Base; +}()); +var Super = (function (_super) { + __extends(Super, _super); + function Super() { + var _this = this; + _super.call(this, (function () { return _this; })); // No error + } + return Super; +}(Base)); diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing7.symbols b/tests/baselines/reference/checkSuperCallBeforeThisAccessing7.symbols new file mode 100644 index 00000000000..3611429d2b2 --- /dev/null +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing7.symbols @@ -0,0 +1,19 @@ +=== tests/cases/compiler/checkSuperCallBeforeThisAccessing7.ts === +class Base { +>Base : Symbol(Base, Decl(checkSuperCallBeforeThisAccessing7.ts, 0, 0)) + + constructor(func: ()=>Base) { +>func : Symbol(func, Decl(checkSuperCallBeforeThisAccessing7.ts, 1, 16)) +>Base : Symbol(Base, Decl(checkSuperCallBeforeThisAccessing7.ts, 0, 0)) + } +} +class Super extends Base { +>Super : Symbol(Super, Decl(checkSuperCallBeforeThisAccessing7.ts, 3, 1)) +>Base : Symbol(Base, Decl(checkSuperCallBeforeThisAccessing7.ts, 0, 0)) + + constructor() { + super((() => this)); // No error +>super : Symbol(Base, Decl(checkSuperCallBeforeThisAccessing7.ts, 0, 0)) +>this : Symbol(Super, Decl(checkSuperCallBeforeThisAccessing7.ts, 3, 1)) + } +} diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing7.types b/tests/baselines/reference/checkSuperCallBeforeThisAccessing7.types new file mode 100644 index 00000000000..11d2ab26d20 --- /dev/null +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing7.types @@ -0,0 +1,22 @@ +=== tests/cases/compiler/checkSuperCallBeforeThisAccessing7.ts === +class Base { +>Base : Base + + constructor(func: ()=>Base) { +>func : () => Base +>Base : Base + } +} +class Super extends Base { +>Super : Super +>Base : Base + + constructor() { + super((() => this)); // No error +>super((() => this)) : void +>super : typeof Base +>(() => this) : () => this +>() => this : () => this +>this : this + } +} diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing8.errors.txt b/tests/baselines/reference/checkSuperCallBeforeThisAccessing8.errors.txt new file mode 100644 index 00000000000..2c8c8d9fb06 --- /dev/null +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing8.errors.txt @@ -0,0 +1,16 @@ +tests/cases/compiler/checkSuperCallBeforeThisAccessing8.ts(7,20): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. + + +==== tests/cases/compiler/checkSuperCallBeforeThisAccessing8.ts (1 errors) ==== + class Base { + constructor(...arg) { + } + } + class Super extends Base { + constructor() { + var that = this; + ~~~~ +!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. + super(); + } + } \ No newline at end of file diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing8.js b/tests/baselines/reference/checkSuperCallBeforeThisAccessing8.js new file mode 100644 index 00000000000..f334cc7f42b --- /dev/null +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing8.js @@ -0,0 +1,35 @@ +//// [checkSuperCallBeforeThisAccessing8.ts] +class Base { + constructor(...arg) { + } +} +class Super extends Base { + constructor() { + var that = this; + super(); + } +} + +//// [checkSuperCallBeforeThisAccessing8.js] +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var Base = (function () { + function Base() { + var arg = []; + for (var _i = 0; _i < arguments.length; _i++) { + arg[_i - 0] = arguments[_i]; + } + } + return Base; +}()); +var Super = (function (_super) { + __extends(Super, _super); + function Super() { + var that = this; + _super.call(this); + } + return Super; +}(Base)); diff --git a/tests/baselines/reference/checkSwitchStatementIfCaseTypeIsString.symbols b/tests/baselines/reference/checkSwitchStatementIfCaseTypeIsString.symbols index 6bc994f2a44..2a6ba238b4b 100644 --- a/tests/baselines/reference/checkSwitchStatementIfCaseTypeIsString.symbols +++ b/tests/baselines/reference/checkSwitchStatementIfCaseTypeIsString.symbols @@ -7,7 +7,7 @@ class A { >A : Symbol(A, Decl(checkSwitchStatementIfCaseTypeIsString.ts, 0, 35)) doIt(x: Array): void { ->doIt : Symbol(doIt, Decl(checkSwitchStatementIfCaseTypeIsString.ts, 2, 9)) +>doIt : Symbol(A.doIt, Decl(checkSwitchStatementIfCaseTypeIsString.ts, 2, 9)) >x : Symbol(x, Decl(checkSwitchStatementIfCaseTypeIsString.ts, 3, 9)) >Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) diff --git a/tests/baselines/reference/circularImportAlias.symbols b/tests/baselines/reference/circularImportAlias.symbols index 6eaa4a7467e..518766ceb5d 100644 --- a/tests/baselines/reference/circularImportAlias.symbols +++ b/tests/baselines/reference/circularImportAlias.symbols @@ -15,7 +15,7 @@ module B { >C : Symbol(a.C, Decl(circularImportAlias.ts, 9, 10)) id: number; ->id : Symbol(id, Decl(circularImportAlias.ts, 4, 32)) +>id : Symbol(D.id, Decl(circularImportAlias.ts, 4, 32)) } } @@ -24,7 +24,7 @@ module A { export class C { name: string } >C : Symbol(C, Decl(circularImportAlias.ts, 9, 10)) ->name : Symbol(name, Decl(circularImportAlias.ts, 10, 20)) +>name : Symbol(C.name, Decl(circularImportAlias.ts, 10, 20)) export import b = B; >b : Symbol(b, Decl(circularImportAlias.ts, 10, 35)) diff --git a/tests/baselines/reference/circularReference.errors.txt b/tests/baselines/reference/circularReference.errors.txt index 9954944ff1f..8f99c93be1e 100644 --- a/tests/baselines/reference/circularReference.errors.txt +++ b/tests/baselines/reference/circularReference.errors.txt @@ -1,4 +1,3 @@ -tests/cases/conformance/externalModules/foo1.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/conformance/externalModules/foo1.ts(9,12): error TS2339: Property 'x' does not exist on type 'C1'. tests/cases/conformance/externalModules/foo2.ts(8,12): error TS2339: Property 'y' does not exist on type 'C1'. tests/cases/conformance/externalModules/foo2.ts(13,8): error TS2339: Property 'x' does not exist on type 'C1'. @@ -26,10 +25,8 @@ tests/cases/conformance/externalModules/foo2.ts(13,8): error TS2339: Property 'x } } -==== tests/cases/conformance/externalModules/foo1.ts (2 errors) ==== +==== tests/cases/conformance/externalModules/foo1.ts (1 errors) ==== import foo2 = require('./foo2'); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. export module M1 { export class C1 { m1: foo2.M1.C1; diff --git a/tests/baselines/reference/circularTypeAliasForUnionWithClass.symbols b/tests/baselines/reference/circularTypeAliasForUnionWithClass.symbols index ecfba63332d..d18711d03da 100644 --- a/tests/baselines/reference/circularTypeAliasForUnionWithClass.symbols +++ b/tests/baselines/reference/circularTypeAliasForUnionWithClass.symbols @@ -11,7 +11,7 @@ class I0 { >I0 : Symbol(I0, Decl(circularTypeAliasForUnionWithClass.ts, 1, 22)) x: T0; ->x : Symbol(x, Decl(circularTypeAliasForUnionWithClass.ts, 2, 10)) +>x : Symbol(I0.x, Decl(circularTypeAliasForUnionWithClass.ts, 2, 10)) >T0 : Symbol(T0, Decl(circularTypeAliasForUnionWithClass.ts, 0, 11)) } diff --git a/tests/baselines/reference/circularTypeAliasForUnionWithInterface.symbols b/tests/baselines/reference/circularTypeAliasForUnionWithInterface.symbols index 29bc3098d91..ad33c036bf8 100644 --- a/tests/baselines/reference/circularTypeAliasForUnionWithInterface.symbols +++ b/tests/baselines/reference/circularTypeAliasForUnionWithInterface.symbols @@ -11,7 +11,7 @@ interface I0 { >I0 : Symbol(I0, Decl(circularTypeAliasForUnionWithInterface.ts, 1, 22)) x: T0; ->x : Symbol(x, Decl(circularTypeAliasForUnionWithInterface.ts, 2, 14)) +>x : Symbol(I0.x, Decl(circularTypeAliasForUnionWithInterface.ts, 2, 14)) >T0 : Symbol(T0, Decl(circularTypeAliasForUnionWithInterface.ts, 0, 11)) } diff --git a/tests/baselines/reference/classAbstractAsIdentifier.symbols b/tests/baselines/reference/classAbstractAsIdentifier.symbols index f2ce2ebcab5..5b96a74bb12 100644 --- a/tests/baselines/reference/classAbstractAsIdentifier.symbols +++ b/tests/baselines/reference/classAbstractAsIdentifier.symbols @@ -3,7 +3,7 @@ class abstract { >abstract : Symbol(abstract, Decl(classAbstractAsIdentifier.ts, 0, 0)) foo() { return 1; } ->foo : Symbol(foo, Decl(classAbstractAsIdentifier.ts, 0, 16)) +>foo : Symbol(abstract.foo, Decl(classAbstractAsIdentifier.ts, 0, 16)) } new abstract; diff --git a/tests/baselines/reference/classAbstractConstructor.errors.txt b/tests/baselines/reference/classAbstractConstructor.errors.txt index fee9f4cefee..c57d52a018f 100644 --- a/tests/baselines/reference/classAbstractConstructor.errors.txt +++ b/tests/baselines/reference/classAbstractConstructor.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractConstructor.ts(2,5): error TS1242: 'abstract' modifier can only appear on a class or method declaration. +tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractConstructor.ts(2,5): error TS1242: 'abstract' modifier can only appear on a class, method, or property declaration. ==== tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractConstructor.ts (1 errors) ==== abstract class A { abstract constructor() {} ~~~~~~~~ -!!! error TS1242: 'abstract' modifier can only appear on a class or method declaration. +!!! error TS1242: 'abstract' modifier can only appear on a class, method, or property declaration. } \ No newline at end of file diff --git a/tests/baselines/reference/classAbstractDeclarations.d.errors.txt b/tests/baselines/reference/classAbstractDeclarations.d.errors.txt index a1c0e55152c..d71f53118af 100644 --- a/tests/baselines/reference/classAbstractDeclarations.d.errors.txt +++ b/tests/baselines/reference/classAbstractDeclarations.d.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractDeclarations.d.ts(2,5): error TS1242: 'abstract' modifier can only appear on a class or method declaration. +tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractDeclarations.d.ts(2,5): error TS1242: 'abstract' modifier can only appear on a class, method, or property declaration. tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractDeclarations.d.ts(2,28): error TS1183: An implementation cannot be declared in ambient contexts. tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractDeclarations.d.ts(11,15): error TS2515: Non-abstract class 'CC' does not implement inherited abstract member 'foo' from class 'AA'. tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractDeclarations.d.ts(13,15): error TS2515: Non-abstract class 'DD' does not implement inherited abstract member 'foo' from class 'BB'. @@ -9,7 +9,7 @@ tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbst declare abstract class A { abstract constructor() {} ~~~~~~~~ -!!! error TS1242: 'abstract' modifier can only appear on a class or method declaration. +!!! error TS1242: 'abstract' modifier can only appear on a class, method, or property declaration. ~ !!! error TS1183: An implementation cannot be declared in ambient contexts. } diff --git a/tests/baselines/reference/classAbstractInstantiations2.errors.txt b/tests/baselines/reference/classAbstractInstantiations2.errors.txt index 077f87c5050..bf4cd851fb3 100644 --- a/tests/baselines/reference/classAbstractInstantiations2.errors.txt +++ b/tests/baselines/reference/classAbstractInstantiations2.errors.txt @@ -5,7 +5,7 @@ tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbst tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts(21,1): error TS2511: Cannot create an instance of the abstract class 'B'. tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts(26,7): error TS2515: Non-abstract class 'C' does not implement inherited abstract member 'bar' from class 'B'. tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts(46,5): error TS2391: Function implementation is missing or not immediately following the declaration. -tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts(46,5): error TS2512: Overload signatures must all be abstract or not abstract. +tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts(46,5): error TS2512: Overload signatures must all be abstract or non-abstract. tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts(50,5): error TS1244: Abstract methods can only appear within an abstract class. @@ -70,7 +70,7 @@ tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbst ~~~ !!! error TS2391: Function implementation is missing or not immediately following the declaration. ~~~ -!!! error TS2512: Overload signatures must all be abstract or not abstract. +!!! error TS2512: Overload signatures must all be abstract or non-abstract. } class H { // error -- not declared abstract diff --git a/tests/baselines/reference/classAbstractManyKeywords.errors.txt b/tests/baselines/reference/classAbstractManyKeywords.errors.txt index eec5ac4bc0d..8f9e3fed18e 100644 --- a/tests/baselines/reference/classAbstractManyKeywords.errors.txt +++ b/tests/baselines/reference/classAbstractManyKeywords.errors.txt @@ -1,13 +1,10 @@ -tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractManyKeywords.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractManyKeywords.ts(1,25): error TS1005: ';' expected. tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractManyKeywords.ts(3,1): error TS1128: Declaration or statement expected. tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractManyKeywords.ts(4,17): error TS1005: '=' expected. -==== tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractManyKeywords.ts (4 errors) ==== +==== tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractManyKeywords.ts (3 errors) ==== export default abstract class A {} - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ~~~~~ !!! error TS1005: ';' expected. export abstract class B {} diff --git a/tests/baselines/reference/classAbstractManyKeywords.js b/tests/baselines/reference/classAbstractManyKeywords.js index 2708806a0d1..8ba50dcee1c 100644 --- a/tests/baselines/reference/classAbstractManyKeywords.js +++ b/tests/baselines/reference/classAbstractManyKeywords.js @@ -6,6 +6,8 @@ import abstract class D {} //// [classAbstractManyKeywords.js] "use strict"; +exports.__esModule = true; +exports["default"] = abstract; var A = (function () { function A() { } @@ -22,6 +24,7 @@ var C = (function () { } return C; }()); +var abstract = ; var D = (function () { function D() { } diff --git a/tests/baselines/reference/classAbstractOverloads.errors.txt b/tests/baselines/reference/classAbstractOverloads.errors.txt index 0a1c96bd30a..155a8451a5d 100644 --- a/tests/baselines/reference/classAbstractOverloads.errors.txt +++ b/tests/baselines/reference/classAbstractOverloads.errors.txt @@ -1,6 +1,6 @@ -tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractOverloads.ts(7,5): error TS2512: Overload signatures must all be abstract or not abstract. -tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractOverloads.ts(10,14): error TS2512: Overload signatures must all be abstract or not abstract. -tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractOverloads.ts(12,14): error TS2512: Overload signatures must all be abstract or not abstract. +tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractOverloads.ts(7,5): error TS2512: Overload signatures must all be abstract or non-abstract. +tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractOverloads.ts(10,14): error TS2512: Overload signatures must all be abstract or non-abstract. +tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractOverloads.ts(12,14): error TS2512: Overload signatures must all be abstract or non-abstract. tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractOverloads.ts(15,5): error TS2391: Function implementation is missing or not immediately following the declaration. tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractOverloads.ts(20,14): error TS2516: All declarations of an abstract method must be consecutive. @@ -14,16 +14,16 @@ tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbst abstract bar(); bar(); ~~~ -!!! error TS2512: Overload signatures must all be abstract or not abstract. +!!! error TS2512: Overload signatures must all be abstract or non-abstract. abstract bar(); abstract baz(); ~~~ -!!! error TS2512: Overload signatures must all be abstract or not abstract. +!!! error TS2512: Overload signatures must all be abstract or non-abstract. baz(); abstract baz(); ~~~ -!!! error TS2512: Overload signatures must all be abstract or not abstract. +!!! error TS2512: Overload signatures must all be abstract or non-abstract. baz() {} qux(); diff --git a/tests/baselines/reference/classAbstractProperties.errors.txt b/tests/baselines/reference/classAbstractProperties.errors.txt index 223a3049825..88c0b587484 100644 --- a/tests/baselines/reference/classAbstractProperties.errors.txt +++ b/tests/baselines/reference/classAbstractProperties.errors.txt @@ -1,29 +1,17 @@ -tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractProperties.ts(2,5): error TS1242: 'abstract' modifier can only appear on a class or method declaration. -tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractProperties.ts(3,12): error TS1242: 'abstract' modifier can only appear on a class or method declaration. -tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractProperties.ts(4,15): error TS1242: 'abstract' modifier can only appear on a class or method declaration. -tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractProperties.ts(5,13): error TS1242: 'abstract' modifier can only appear on a class or method declaration. -tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractProperties.ts(7,5): error TS1242: 'abstract' modifier can only appear on a class or method declaration. +tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractProperties.ts(5,13): error TS1243: 'private' modifier cannot be used with 'abstract' modifier. tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractProperties.ts(12,13): error TS1243: 'private' modifier cannot be used with 'abstract' modifier. -==== tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractProperties.ts (6 errors) ==== +==== tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractProperties.ts (2 errors) ==== abstract class A { abstract x : number; - ~~~~~~~~ -!!! error TS1242: 'abstract' modifier can only appear on a class or method declaration. public abstract y : number; - ~~~~~~~~ -!!! error TS1242: 'abstract' modifier can only appear on a class or method declaration. protected abstract z : number; - ~~~~~~~~ -!!! error TS1242: 'abstract' modifier can only appear on a class or method declaration. private abstract w : number; ~~~~~~~~ -!!! error TS1242: 'abstract' modifier can only appear on a class or method declaration. +!!! error TS1243: 'private' modifier cannot be used with 'abstract' modifier. abstract m: () => void; - ~~~~~~~~ -!!! error TS1242: 'abstract' modifier can only appear on a class or method declaration. abstract foo_x() : number; public abstract foo_y() : number; diff --git a/tests/baselines/reference/classAbstractWithInterface.errors.txt b/tests/baselines/reference/classAbstractWithInterface.errors.txt index fa0a3d08957..0fe3b3ba342 100644 --- a/tests/baselines/reference/classAbstractWithInterface.errors.txt +++ b/tests/baselines/reference/classAbstractWithInterface.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractWithInterface.ts(1,1): error TS1242: 'abstract' modifier can only appear on a class or method declaration. +tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractWithInterface.ts(1,1): error TS1242: 'abstract' modifier can only appear on a class, method, or property declaration. ==== tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractWithInterface.ts (1 errors) ==== abstract interface I {} ~~~~~~~~ -!!! error TS1242: 'abstract' modifier can only appear on a class or method declaration. \ No newline at end of file +!!! error TS1242: 'abstract' modifier can only appear on a class, method, or property declaration. \ No newline at end of file diff --git a/tests/baselines/reference/classAppearsToHaveMembersOfObject.symbols b/tests/baselines/reference/classAppearsToHaveMembersOfObject.symbols index 28c31e639a7..6041f2ddf04 100644 --- a/tests/baselines/reference/classAppearsToHaveMembersOfObject.symbols +++ b/tests/baselines/reference/classAppearsToHaveMembersOfObject.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classAppearsToHaveMembersOfObject.ts === class C { foo: string; } >C : Symbol(C, Decl(classAppearsToHaveMembersOfObject.ts, 0, 0)) ->foo : Symbol(foo, Decl(classAppearsToHaveMembersOfObject.ts, 0, 9)) +>foo : Symbol(C.foo, Decl(classAppearsToHaveMembersOfObject.ts, 0, 9)) var c: C; >c : Symbol(c, Decl(classAppearsToHaveMembersOfObject.ts, 2, 3)) diff --git a/tests/baselines/reference/classConstructorAccessibility.errors.txt b/tests/baselines/reference/classConstructorAccessibility.errors.txt index c22f3593bc5..c79633ba33d 100644 --- a/tests/baselines/reference/classConstructorAccessibility.errors.txt +++ b/tests/baselines/reference/classConstructorAccessibility.errors.txt @@ -1,29 +1,30 @@ -tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility.ts(6,5): error TS1089: 'private' modifier cannot appear on a constructor declaration. -tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility.ts(10,5): error TS1089: 'protected' modifier cannot appear on a constructor declaration. -tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility.ts(23,9): error TS1089: 'private' modifier cannot appear on a constructor declaration. -tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility.ts(27,9): error TS1089: 'protected' modifier cannot appear on a constructor declaration. +tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility.ts(15,9): error TS2673: Constructor of class 'D' is private and only accessible within the class declaration. +tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility.ts(16,9): error TS2674: Constructor of class 'E' is protected and only accessible within the class declaration. +tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility.ts(32,13): error TS2673: Constructor of class 'D' is private and only accessible within the class declaration. +tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility.ts(33,13): error TS2674: Constructor of class 'E' is protected and only accessible within the class declaration. ==== tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility.ts (4 errors) ==== + class C { public constructor(public x: number) { } } class D { - private constructor(public x: number) { } // error - ~~~~~~~ -!!! error TS1089: 'private' modifier cannot appear on a constructor declaration. + private constructor(public x: number) { } } class E { - protected constructor(public x: number) { } // error - ~~~~~~~~~ -!!! error TS1089: 'protected' modifier cannot appear on a constructor declaration. + protected constructor(public x: number) { } } var c = new C(1); - var d = new D(1); - var e = new E(1); + var d = new D(1); // error + ~~~~~~~~ +!!! error TS2673: Constructor of class 'D' is private and only accessible within the class declaration. + var e = new E(1); // error + ~~~~~~~~ +!!! error TS2674: Constructor of class 'E' is protected and only accessible within the class declaration. module Generic { class C { @@ -31,19 +32,19 @@ tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessib } class D { - private constructor(public x: T) { } // error - ~~~~~~~ -!!! error TS1089: 'private' modifier cannot appear on a constructor declaration. + private constructor(public x: T) { } } class E { - protected constructor(public x: T) { } // error - ~~~~~~~~~ -!!! error TS1089: 'protected' modifier cannot appear on a constructor declaration. + protected constructor(public x: T) { } } var c = new C(1); - var d = new D(1); - var e = new E(1); + var d = new D(1); // error + ~~~~~~~~ +!!! error TS2673: Constructor of class 'D' is private and only accessible within the class declaration. + var e = new E(1); // error + ~~~~~~~~ +!!! error TS2674: Constructor of class 'E' is protected and only accessible within the class declaration. } \ No newline at end of file diff --git a/tests/baselines/reference/classConstructorAccessibility.js b/tests/baselines/reference/classConstructorAccessibility.js index fed96385845..efc3f3c273c 100644 --- a/tests/baselines/reference/classConstructorAccessibility.js +++ b/tests/baselines/reference/classConstructorAccessibility.js @@ -1,19 +1,20 @@ //// [classConstructorAccessibility.ts] + class C { public constructor(public x: number) { } } class D { - private constructor(public x: number) { } // error + private constructor(public x: number) { } } class E { - protected constructor(public x: number) { } // error + protected constructor(public x: number) { } } var c = new C(1); -var d = new D(1); -var e = new E(1); +var d = new D(1); // error +var e = new E(1); // error module Generic { class C { @@ -21,16 +22,16 @@ module Generic { } class D { - private constructor(public x: T) { } // error + private constructor(public x: T) { } } class E { - protected constructor(public x: T) { } // error + protected constructor(public x: T) { } } var c = new C(1); - var d = new D(1); - var e = new E(1); + var d = new D(1); // error + var e = new E(1); // error } @@ -44,18 +45,18 @@ var C = (function () { var D = (function () { function D(x) { this.x = x; - } // error + } return D; }()); var E = (function () { function E(x) { this.x = x; - } // error + } return E; }()); var c = new C(1); -var d = new D(1); -var e = new E(1); +var d = new D(1); // error +var e = new E(1); // error var Generic; (function (Generic) { var C = (function () { @@ -67,16 +68,36 @@ var Generic; var D = (function () { function D(x) { this.x = x; - } // error + } return D; }()); var E = (function () { function E(x) { this.x = x; - } // error + } return E; }()); var c = new C(1); - var d = new D(1); - var e = new E(1); + var d = new D(1); // error + var e = new E(1); // error })(Generic || (Generic = {})); + + +//// [classConstructorAccessibility.d.ts] +declare class C { + x: number; + constructor(x: number); +} +declare class D { + x: number; + private constructor(x); +} +declare class E { + x: number; + protected constructor(x: number); +} +declare var c: C; +declare var d: any; +declare var e: any; +declare module Generic { +} diff --git a/tests/baselines/reference/classConstructorAccessibility2.errors.txt b/tests/baselines/reference/classConstructorAccessibility2.errors.txt new file mode 100644 index 00000000000..7bd784ac268 --- /dev/null +++ b/tests/baselines/reference/classConstructorAccessibility2.errors.txt @@ -0,0 +1,59 @@ +tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility2.ts(26,28): error TS2674: Constructor of class 'BaseB' is protected and only accessible within the class declaration. +tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility2.ts(29,24): error TS2675: Cannot extend a class 'BaseC'. Class constructor is marked as private. +tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility2.ts(32,28): error TS2673: Constructor of class 'BaseC' is private and only accessible within the class declaration. +tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility2.ts(36,10): error TS2674: Constructor of class 'BaseB' is protected and only accessible within the class declaration. +tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility2.ts(37,10): error TS2673: Constructor of class 'BaseC' is private and only accessible within the class declaration. + + +==== tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility2.ts (5 errors) ==== + + class BaseA { + public constructor(public x: number) { } + createInstance() { new BaseA(1); } + } + + class BaseB { + protected constructor(public x: number) { } + createInstance() { new BaseB(1); } + } + + class BaseC { + private constructor(public x: number) { } + createInstance() { new BaseC(1); } + } + + class DerivedA extends BaseA { + constructor(public x: number) { super(x); } + createInstance() { new DerivedA(1); } + createBaseInstance() { new BaseA(1); } + } + + class DerivedB extends BaseB { + constructor(public x: number) { super(x); } + createInstance() { new DerivedB(1); } + createBaseInstance() { new BaseB(1); } // error + ~~~~~~~~~~~~ +!!! error TS2674: Constructor of class 'BaseB' is protected and only accessible within the class declaration. + } + + class DerivedC extends BaseC { // error + ~~~~~ +!!! error TS2675: Cannot extend a class 'BaseC'. Class constructor is marked as private. + constructor(public x: number) { super(x); } + createInstance() { new DerivedC(1); } + createBaseInstance() { new BaseC(1); } // error + ~~~~~~~~~~~~ +!!! error TS2673: Constructor of class 'BaseC' is private and only accessible within the class declaration. + } + + var ba = new BaseA(1); + var bb = new BaseB(1); // error + ~~~~~~~~~~~~ +!!! error TS2674: Constructor of class 'BaseB' is protected and only accessible within the class declaration. + var bc = new BaseC(1); // error + ~~~~~~~~~~~~ +!!! error TS2673: Constructor of class 'BaseC' is private and only accessible within the class declaration. + + var da = new DerivedA(1); + var db = new DerivedB(1); + var dc = new DerivedC(1); \ No newline at end of file diff --git a/tests/baselines/reference/classConstructorAccessibility2.js b/tests/baselines/reference/classConstructorAccessibility2.js new file mode 100644 index 00000000000..e19589ece45 --- /dev/null +++ b/tests/baselines/reference/classConstructorAccessibility2.js @@ -0,0 +1,148 @@ +//// [classConstructorAccessibility2.ts] + +class BaseA { + public constructor(public x: number) { } + createInstance() { new BaseA(1); } +} + +class BaseB { + protected constructor(public x: number) { } + createInstance() { new BaseB(1); } +} + +class BaseC { + private constructor(public x: number) { } + createInstance() { new BaseC(1); } +} + +class DerivedA extends BaseA { + constructor(public x: number) { super(x); } + createInstance() { new DerivedA(1); } + createBaseInstance() { new BaseA(1); } +} + +class DerivedB extends BaseB { + constructor(public x: number) { super(x); } + createInstance() { new DerivedB(1); } + createBaseInstance() { new BaseB(1); } // error +} + +class DerivedC extends BaseC { // error + constructor(public x: number) { super(x); } + createInstance() { new DerivedC(1); } + createBaseInstance() { new BaseC(1); } // error +} + +var ba = new BaseA(1); +var bb = new BaseB(1); // error +var bc = new BaseC(1); // error + +var da = new DerivedA(1); +var db = new DerivedB(1); +var dc = new DerivedC(1); + +//// [classConstructorAccessibility2.js] +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var BaseA = (function () { + function BaseA(x) { + this.x = x; + } + BaseA.prototype.createInstance = function () { new BaseA(1); }; + return BaseA; +}()); +var BaseB = (function () { + function BaseB(x) { + this.x = x; + } + BaseB.prototype.createInstance = function () { new BaseB(1); }; + return BaseB; +}()); +var BaseC = (function () { + function BaseC(x) { + this.x = x; + } + BaseC.prototype.createInstance = function () { new BaseC(1); }; + return BaseC; +}()); +var DerivedA = (function (_super) { + __extends(DerivedA, _super); + function DerivedA(x) { + _super.call(this, x); + this.x = x; + } + DerivedA.prototype.createInstance = function () { new DerivedA(1); }; + DerivedA.prototype.createBaseInstance = function () { new BaseA(1); }; + return DerivedA; +}(BaseA)); +var DerivedB = (function (_super) { + __extends(DerivedB, _super); + function DerivedB(x) { + _super.call(this, x); + this.x = x; + } + DerivedB.prototype.createInstance = function () { new DerivedB(1); }; + DerivedB.prototype.createBaseInstance = function () { new BaseB(1); }; // error + return DerivedB; +}(BaseB)); +var DerivedC = (function (_super) { + __extends(DerivedC, _super); + function DerivedC(x) { + _super.call(this, x); + this.x = x; + } + DerivedC.prototype.createInstance = function () { new DerivedC(1); }; + DerivedC.prototype.createBaseInstance = function () { new BaseC(1); }; // error + return DerivedC; +}(BaseC)); +var ba = new BaseA(1); +var bb = new BaseB(1); // error +var bc = new BaseC(1); // error +var da = new DerivedA(1); +var db = new DerivedB(1); +var dc = new DerivedC(1); + + +//// [classConstructorAccessibility2.d.ts] +declare class BaseA { + x: number; + constructor(x: number); + createInstance(): void; +} +declare class BaseB { + x: number; + protected constructor(x: number); + createInstance(): void; +} +declare class BaseC { + x: number; + private constructor(x); + createInstance(): void; +} +declare class DerivedA extends BaseA { + x: number; + constructor(x: number); + createInstance(): void; + createBaseInstance(): void; +} +declare class DerivedB extends BaseB { + x: number; + constructor(x: number); + createInstance(): void; + createBaseInstance(): void; +} +declare class DerivedC extends BaseC { + x: number; + constructor(x: number); + createInstance(): void; + createBaseInstance(): void; +} +declare var ba: BaseA; +declare var bb: any; +declare var bc: any; +declare var da: DerivedA; +declare var db: DerivedB; +declare var dc: DerivedC; diff --git a/tests/baselines/reference/classConstructorAccessibility3.errors.txt b/tests/baselines/reference/classConstructorAccessibility3.errors.txt new file mode 100644 index 00000000000..1b96db289dc --- /dev/null +++ b/tests/baselines/reference/classConstructorAccessibility3.errors.txt @@ -0,0 +1,52 @@ +tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility3.ts(21,1): error TS2322: Type 'typeof Baz' is not assignable to type 'typeof Foo'. + Cannot assign a 'protected' constructor type to a 'public' constructor type. +tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility3.ts(22,1): error TS2322: Type 'typeof Qux' is not assignable to type 'typeof Foo'. + Cannot assign a 'private' constructor type to a 'public' constructor type. +tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility3.ts(28,1): error TS2322: Type 'typeof Qux' is not assignable to type 'typeof Baz'. + Cannot assign a 'private' constructor type to a 'protected' constructor type. + + +==== tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility3.ts (3 errors) ==== + + class Foo { + constructor(public x: number) { } + } + + class Bar { + public constructor(public x: number) { } + } + + class Baz { + protected constructor(public x: number) { } + } + + class Qux { + private constructor(public x: number) { } + } + + // b is public + let a = Foo; + a = Bar; + a = Baz; // error Baz is protected + ~ +!!! error TS2322: Type 'typeof Baz' is not assignable to type 'typeof Foo'. +!!! error TS2322: Cannot assign a 'protected' constructor type to a 'public' constructor type. + a = Qux; // error Qux is private + ~ +!!! error TS2322: Type 'typeof Qux' is not assignable to type 'typeof Foo'. +!!! error TS2322: Cannot assign a 'private' constructor type to a 'public' constructor type. + + // b is protected + let b = Baz; + b = Foo; + b = Bar; + b = Qux; // error Qux is private + ~ +!!! error TS2322: Type 'typeof Qux' is not assignable to type 'typeof Baz'. +!!! error TS2322: Cannot assign a 'private' constructor type to a 'protected' constructor type. + + // c is private + let c = Qux; + c = Foo; + c = Bar; + c = Baz; \ No newline at end of file diff --git a/tests/baselines/reference/classConstructorAccessibility3.js b/tests/baselines/reference/classConstructorAccessibility3.js new file mode 100644 index 00000000000..acc7d38aa55 --- /dev/null +++ b/tests/baselines/reference/classConstructorAccessibility3.js @@ -0,0 +1,98 @@ +//// [classConstructorAccessibility3.ts] + +class Foo { + constructor(public x: number) { } +} + +class Bar { + public constructor(public x: number) { } +} + +class Baz { + protected constructor(public x: number) { } +} + +class Qux { + private constructor(public x: number) { } +} + +// b is public +let a = Foo; +a = Bar; +a = Baz; // error Baz is protected +a = Qux; // error Qux is private + +// b is protected +let b = Baz; +b = Foo; +b = Bar; +b = Qux; // error Qux is private + +// c is private +let c = Qux; +c = Foo; +c = Bar; +c = Baz; + +//// [classConstructorAccessibility3.js] +var Foo = (function () { + function Foo(x) { + this.x = x; + } + return Foo; +}()); +var Bar = (function () { + function Bar(x) { + this.x = x; + } + return Bar; +}()); +var Baz = (function () { + function Baz(x) { + this.x = x; + } + return Baz; +}()); +var Qux = (function () { + function Qux(x) { + this.x = x; + } + return Qux; +}()); +// b is public +var a = Foo; +a = Bar; +a = Baz; // error Baz is protected +a = Qux; // error Qux is private +// b is protected +var b = Baz; +b = Foo; +b = Bar; +b = Qux; // error Qux is private +// c is private +var c = Qux; +c = Foo; +c = Bar; +c = Baz; + + +//// [classConstructorAccessibility3.d.ts] +declare class Foo { + x: number; + constructor(x: number); +} +declare class Bar { + x: number; + constructor(x: number); +} +declare class Baz { + x: number; + protected constructor(x: number); +} +declare class Qux { + x: number; + private constructor(x); +} +declare let a: typeof Foo; +declare let b: typeof Baz; +declare let c: typeof Qux; diff --git a/tests/baselines/reference/classConstructorAccessibility4.js b/tests/baselines/reference/classConstructorAccessibility4.js new file mode 100644 index 00000000000..6342facae21 --- /dev/null +++ b/tests/baselines/reference/classConstructorAccessibility4.js @@ -0,0 +1,93 @@ +//// [classConstructorAccessibility4.ts] + +class A { + private constructor() { } + + method() { + class B { + method() { + new A(); // OK + } + } + + class C extends A { // OK + } + } +} + +class D { + protected constructor() { } + + method() { + class E { + method() { + new D(); // OK + } + } + + class F extends D { // OK + } + } +} + +//// [classConstructorAccessibility4.js] +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var A = (function () { + function A() { + } + A.prototype.method = function () { + var B = (function () { + function B() { + } + B.prototype.method = function () { + new A(); // OK + }; + return B; + }()); + var C = (function (_super) { + __extends(C, _super); + function C() { + _super.apply(this, arguments); + } + return C; + }(A)); + }; + return A; +}()); +var D = (function () { + function D() { + } + D.prototype.method = function () { + var E = (function () { + function E() { + } + E.prototype.method = function () { + new D(); // OK + }; + return E; + }()); + var F = (function (_super) { + __extends(F, _super); + function F() { + _super.apply(this, arguments); + } + return F; + }(D)); + }; + return D; +}()); + + +//// [classConstructorAccessibility4.d.ts] +declare class A { + private constructor(); + method(): void; +} +declare class D { + protected constructor(); + method(): void; +} diff --git a/tests/baselines/reference/classConstructorAccessibility4.symbols b/tests/baselines/reference/classConstructorAccessibility4.symbols new file mode 100644 index 00000000000..66a9bbfabfd --- /dev/null +++ b/tests/baselines/reference/classConstructorAccessibility4.symbols @@ -0,0 +1,53 @@ +=== tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility4.ts === + +class A { +>A : Symbol(A, Decl(classConstructorAccessibility4.ts, 0, 0)) + + private constructor() { } + + method() { +>method : Symbol(A.method, Decl(classConstructorAccessibility4.ts, 2, 29)) + + class B { +>B : Symbol(B, Decl(classConstructorAccessibility4.ts, 4, 14)) + + method() { +>method : Symbol(B.method, Decl(classConstructorAccessibility4.ts, 5, 17)) + + new A(); // OK +>A : Symbol(A, Decl(classConstructorAccessibility4.ts, 0, 0)) + } + } + + class C extends A { // OK +>C : Symbol(C, Decl(classConstructorAccessibility4.ts, 9, 9)) +>A : Symbol(A, Decl(classConstructorAccessibility4.ts, 0, 0)) + } + } +} + +class D { +>D : Symbol(D, Decl(classConstructorAccessibility4.ts, 14, 1)) + + protected constructor() { } + + method() { +>method : Symbol(D.method, Decl(classConstructorAccessibility4.ts, 17, 31)) + + class E { +>E : Symbol(E, Decl(classConstructorAccessibility4.ts, 19, 14)) + + method() { +>method : Symbol(E.method, Decl(classConstructorAccessibility4.ts, 20, 17)) + + new D(); // OK +>D : Symbol(D, Decl(classConstructorAccessibility4.ts, 14, 1)) + } + } + + class F extends D { // OK +>F : Symbol(F, Decl(classConstructorAccessibility4.ts, 24, 9)) +>D : Symbol(D, Decl(classConstructorAccessibility4.ts, 14, 1)) + } + } +} diff --git a/tests/baselines/reference/classConstructorAccessibility4.types b/tests/baselines/reference/classConstructorAccessibility4.types new file mode 100644 index 00000000000..1eb5a25e220 --- /dev/null +++ b/tests/baselines/reference/classConstructorAccessibility4.types @@ -0,0 +1,55 @@ +=== tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility4.ts === + +class A { +>A : A + + private constructor() { } + + method() { +>method : () => void + + class B { +>B : B + + method() { +>method : () => void + + new A(); // OK +>new A() : A +>A : typeof A + } + } + + class C extends A { // OK +>C : C +>A : A + } + } +} + +class D { +>D : D + + protected constructor() { } + + method() { +>method : () => void + + class E { +>E : E + + method() { +>method : () => void + + new D(); // OK +>new D() : D +>D : typeof D + } + } + + class F extends D { // OK +>F : F +>D : D + } + } +} diff --git a/tests/baselines/reference/classConstructorOverloadsAccessibility.errors.txt b/tests/baselines/reference/classConstructorOverloadsAccessibility.errors.txt new file mode 100644 index 00000000000..8882b9f0180 --- /dev/null +++ b/tests/baselines/reference/classConstructorOverloadsAccessibility.errors.txt @@ -0,0 +1,45 @@ +tests/cases/conformance/classes/constructorDeclarations/classConstructorOverloadsAccessibility.ts(3,2): error TS2385: Overload signatures must all be public, private or protected. +tests/cases/conformance/classes/constructorDeclarations/classConstructorOverloadsAccessibility.ts(4,2): error TS2385: Overload signatures must all be public, private or protected. +tests/cases/conformance/classes/constructorDeclarations/classConstructorOverloadsAccessibility.ts(12,2): error TS2385: Overload signatures must all be public, private or protected. + + +==== tests/cases/conformance/classes/constructorDeclarations/classConstructorOverloadsAccessibility.ts (3 errors) ==== + + class A { + public constructor(a: boolean) // error + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2385: Overload signatures must all be public, private or protected. + protected constructor(a: number) // error + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2385: Overload signatures must all be public, private or protected. + private constructor(a: string) + private constructor() { + + } + } + + class B { + protected constructor(a: number) // error + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2385: Overload signatures must all be public, private or protected. + constructor(a: string) + constructor() { + + } + } + + class C { + protected constructor(a: number) + protected constructor(a: string) + protected constructor() { + + } + } + + class D { + constructor(a: number) + constructor(a: string) + public constructor() { + + } + } \ No newline at end of file diff --git a/tests/baselines/reference/classConstructorOverloadsAccessibility.js b/tests/baselines/reference/classConstructorOverloadsAccessibility.js new file mode 100644 index 00000000000..3914c29b785 --- /dev/null +++ b/tests/baselines/reference/classConstructorOverloadsAccessibility.js @@ -0,0 +1,76 @@ +//// [classConstructorOverloadsAccessibility.ts] + +class A { + public constructor(a: boolean) // error + protected constructor(a: number) // error + private constructor(a: string) + private constructor() { + + } +} + +class B { + protected constructor(a: number) // error + constructor(a: string) + constructor() { + + } +} + +class C { + protected constructor(a: number) + protected constructor(a: string) + protected constructor() { + + } +} + +class D { + constructor(a: number) + constructor(a: string) + public constructor() { + + } +} + +//// [classConstructorOverloadsAccessibility.js] +var A = (function () { + function A() { + } + return A; +}()); +var B = (function () { + function B() { + } + return B; +}()); +var C = (function () { + function C() { + } + return C; +}()); +var D = (function () { + function D() { + } + return D; +}()); + + +//// [classConstructorOverloadsAccessibility.d.ts] +declare class A { + constructor(a: boolean); + protected constructor(a: number); + private constructor(a); +} +declare class B { + protected constructor(a: number); + constructor(a: string); +} +declare class C { + protected constructor(a: number); + protected constructor(a: string); +} +declare class D { + constructor(a: number); + constructor(a: string); +} diff --git a/tests/baselines/reference/classConstructorParametersAccessibility.errors.txt b/tests/baselines/reference/classConstructorParametersAccessibility.errors.txt index 029c3fae018..97b8655ab87 100644 --- a/tests/baselines/reference/classConstructorParametersAccessibility.errors.txt +++ b/tests/baselines/reference/classConstructorParametersAccessibility.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/classes/constructorDeclarations/classConstructorParametersAccessibility.ts(12,1): error TS2341: Property 'p' is private and only accessible within class 'C2'. -tests/cases/conformance/classes/constructorDeclarations/classConstructorParametersAccessibility.ts(19,1): error TS2445: Property 'p' is protected and only accessible within class 'C3' and its subclasses. +tests/cases/conformance/classes/constructorDeclarations/classConstructorParametersAccessibility.ts(12,4): error TS2341: Property 'p' is private and only accessible within class 'C2'. +tests/cases/conformance/classes/constructorDeclarations/classConstructorParametersAccessibility.ts(19,4): error TS2445: Property 'p' is protected and only accessible within class 'C3' and its subclasses. ==== tests/cases/conformance/classes/constructorDeclarations/classConstructorParametersAccessibility.ts (2 errors) ==== @@ -15,7 +15,7 @@ tests/cases/conformance/classes/constructorDeclarations/classConstructorParamete } var c2: C2; c2.p // private, error - ~~~~ + ~ !!! error TS2341: Property 'p' is private and only accessible within class 'C2'. @@ -24,7 +24,7 @@ tests/cases/conformance/classes/constructorDeclarations/classConstructorParamete } var c3: C3; c3.p // protected, error - ~~~~ + ~ !!! error TS2445: Property 'p' is protected and only accessible within class 'C3' and its subclasses. class Derived extends C3 { constructor(p: number) { diff --git a/tests/baselines/reference/classConstructorParametersAccessibility2.errors.txt b/tests/baselines/reference/classConstructorParametersAccessibility2.errors.txt index 7c95a35e1da..2a27d24b280 100644 --- a/tests/baselines/reference/classConstructorParametersAccessibility2.errors.txt +++ b/tests/baselines/reference/classConstructorParametersAccessibility2.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/classes/constructorDeclarations/classConstructorParametersAccessibility2.ts(12,1): error TS2341: Property 'p' is private and only accessible within class 'C2'. -tests/cases/conformance/classes/constructorDeclarations/classConstructorParametersAccessibility2.ts(19,1): error TS2445: Property 'p' is protected and only accessible within class 'C3' and its subclasses. +tests/cases/conformance/classes/constructorDeclarations/classConstructorParametersAccessibility2.ts(12,4): error TS2341: Property 'p' is private and only accessible within class 'C2'. +tests/cases/conformance/classes/constructorDeclarations/classConstructorParametersAccessibility2.ts(19,4): error TS2445: Property 'p' is protected and only accessible within class 'C3' and its subclasses. ==== tests/cases/conformance/classes/constructorDeclarations/classConstructorParametersAccessibility2.ts (2 errors) ==== @@ -15,7 +15,7 @@ tests/cases/conformance/classes/constructorDeclarations/classConstructorParamete } var c2: C2; c2.p // private, error - ~~~~ + ~ !!! error TS2341: Property 'p' is private and only accessible within class 'C2'. @@ -24,7 +24,7 @@ tests/cases/conformance/classes/constructorDeclarations/classConstructorParamete } var c3: C3; c3.p // protected, error - ~~~~ + ~ !!! error TS2445: Property 'p' is protected and only accessible within class 'C3' and its subclasses. class Derived extends C3 { constructor(p: number) { diff --git a/tests/baselines/reference/classConstructorParametersAccessibility3.symbols b/tests/baselines/reference/classConstructorParametersAccessibility3.symbols index b2888528e7e..1e61cffd88b 100644 --- a/tests/baselines/reference/classConstructorParametersAccessibility3.symbols +++ b/tests/baselines/reference/classConstructorParametersAccessibility3.symbols @@ -3,7 +3,7 @@ class Base { >Base : Symbol(Base, Decl(classConstructorParametersAccessibility3.ts, 0, 0)) constructor(protected p: number) { } ->p : Symbol(p, Decl(classConstructorParametersAccessibility3.ts, 1, 16)) +>p : Symbol(Base.p, Decl(classConstructorParametersAccessibility3.ts, 1, 16)) } class Derived extends Base { @@ -11,16 +11,16 @@ class Derived extends Base { >Base : Symbol(Base, Decl(classConstructorParametersAccessibility3.ts, 0, 0)) constructor(public p: number) { ->p : Symbol(p, Decl(classConstructorParametersAccessibility3.ts, 5, 16)) +>p : Symbol(Derived.p, Decl(classConstructorParametersAccessibility3.ts, 5, 16)) super(p); >super : Symbol(Base, Decl(classConstructorParametersAccessibility3.ts, 0, 0)) >p : Symbol(p, Decl(classConstructorParametersAccessibility3.ts, 5, 16)) this.p; // OK ->this.p : Symbol(p, Decl(classConstructorParametersAccessibility3.ts, 5, 16)) +>this.p : Symbol(Derived.p, Decl(classConstructorParametersAccessibility3.ts, 5, 16)) >this : Symbol(Derived, Decl(classConstructorParametersAccessibility3.ts, 2, 1)) ->p : Symbol(p, Decl(classConstructorParametersAccessibility3.ts, 5, 16)) +>p : Symbol(Derived.p, Decl(classConstructorParametersAccessibility3.ts, 5, 16)) } } diff --git a/tests/baselines/reference/classDoesNotDependOnPrivateMember.symbols b/tests/baselines/reference/classDoesNotDependOnPrivateMember.symbols index ca042499c05..5f5a23156ef 100644 --- a/tests/baselines/reference/classDoesNotDependOnPrivateMember.symbols +++ b/tests/baselines/reference/classDoesNotDependOnPrivateMember.symbols @@ -9,7 +9,7 @@ module M { >C : Symbol(C, Decl(classDoesNotDependOnPrivateMember.ts, 1, 19)) private x: I; ->x : Symbol(x, Decl(classDoesNotDependOnPrivateMember.ts, 2, 20)) +>x : Symbol(C.x, Decl(classDoesNotDependOnPrivateMember.ts, 2, 20)) >I : Symbol(I, Decl(classDoesNotDependOnPrivateMember.ts, 0, 10)) } } diff --git a/tests/baselines/reference/classExpressionTest1.symbols b/tests/baselines/reference/classExpressionTest1.symbols index 684ee302895..398a74d7f5f 100644 --- a/tests/baselines/reference/classExpressionTest1.symbols +++ b/tests/baselines/reference/classExpressionTest1.symbols @@ -7,7 +7,7 @@ function M() { >X : Symbol(X, Decl(classExpressionTest1.ts, 1, 12)) f() { ->f : Symbol(f, Decl(classExpressionTest1.ts, 1, 16)) +>f : Symbol(C.f, Decl(classExpressionTest1.ts, 1, 16)) >T : Symbol(T, Decl(classExpressionTest1.ts, 2, 10)) var t: T; diff --git a/tests/baselines/reference/classExtendingBuiltinType.symbols b/tests/baselines/reference/classExtendingBuiltinType.symbols index 78f2195c8db..fb0814cc0f2 100644 --- a/tests/baselines/reference/classExtendingBuiltinType.symbols +++ b/tests/baselines/reference/classExtendingBuiltinType.symbols @@ -9,7 +9,7 @@ class C2 extends Function { } class C3 extends String { } >C3 : Symbol(C3, Decl(classExtendingBuiltinType.ts, 1, 29)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) class C4 extends Boolean { } >C4 : Symbol(C4, Decl(classExtendingBuiltinType.ts, 2, 27)) @@ -17,11 +17,11 @@ class C4 extends Boolean { } class C5 extends Number { } >C5 : Symbol(C5, Decl(classExtendingBuiltinType.ts, 3, 28)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) class C6 extends Date { } >C6 : Symbol(C6, Decl(classExtendingBuiltinType.ts, 4, 27)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) class C7 extends RegExp { } >C7 : Symbol(C7, Decl(classExtendingBuiltinType.ts, 5, 25)) diff --git a/tests/baselines/reference/classExtendingClass.symbols b/tests/baselines/reference/classExtendingClass.symbols index 3c79887d163..638d595f812 100644 --- a/tests/baselines/reference/classExtendingClass.symbols +++ b/tests/baselines/reference/classExtendingClass.symbols @@ -3,10 +3,10 @@ class C { >C : Symbol(C, Decl(classExtendingClass.ts, 0, 0)) foo: string; ->foo : Symbol(foo, Decl(classExtendingClass.ts, 0, 9)) +>foo : Symbol(C.foo, Decl(classExtendingClass.ts, 0, 9)) thing() { } ->thing : Symbol(thing, Decl(classExtendingClass.ts, 1, 16)) +>thing : Symbol(C.thing, Decl(classExtendingClass.ts, 1, 16)) static other() { } >other : Symbol(C.other, Decl(classExtendingClass.ts, 2, 15)) @@ -17,7 +17,7 @@ class D extends C { >C : Symbol(C, Decl(classExtendingClass.ts, 0, 0)) bar: string; ->bar : Symbol(bar, Decl(classExtendingClass.ts, 6, 19)) +>bar : Symbol(D.bar, Decl(classExtendingClass.ts, 6, 19)) } var d: D; @@ -53,11 +53,11 @@ class C2 { >T : Symbol(T, Decl(classExtendingClass.ts, 16, 9)) foo: T; ->foo : Symbol(foo, Decl(classExtendingClass.ts, 16, 13)) +>foo : Symbol(C2.foo, Decl(classExtendingClass.ts, 16, 13)) >T : Symbol(T, Decl(classExtendingClass.ts, 16, 9)) thing(x: T) { } ->thing : Symbol(thing, Decl(classExtendingClass.ts, 17, 11)) +>thing : Symbol(C2.thing, Decl(classExtendingClass.ts, 17, 11)) >x : Symbol(x, Decl(classExtendingClass.ts, 18, 10)) >T : Symbol(T, Decl(classExtendingClass.ts, 16, 9)) @@ -75,7 +75,7 @@ class D2 extends C2 { >T : Symbol(T, Decl(classExtendingClass.ts, 22, 9)) bar: string; ->bar : Symbol(bar, Decl(classExtendingClass.ts, 22, 27)) +>bar : Symbol(D2.bar, Decl(classExtendingClass.ts, 22, 27)) } var d2: D2; diff --git a/tests/baselines/reference/classExtendsAcrossFiles.js b/tests/baselines/reference/classExtendsAcrossFiles.js new file mode 100644 index 00000000000..b533b880036 --- /dev/null +++ b/tests/baselines/reference/classExtendsAcrossFiles.js @@ -0,0 +1,71 @@ +//// [tests/cases/compiler/classExtendsAcrossFiles.ts] //// + +//// [a.ts] +import { b } from './b'; +export const a = { + f: () => { + class A { } + class B extends A { } + b.f(); + } +}; +//// [b.ts] +import { a } from './a'; +export const b = { + f: () => { + class A { } + class B extends A { } + a.f(); + } +}; + +//// [b.js] +"use strict"; +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var a_1 = require('./a'); +exports.b = { + f: function () { + var A = (function () { + function A() { + } + return A; + }()); + var B = (function (_super) { + __extends(B, _super); + function B() { + _super.apply(this, arguments); + } + return B; + }(A)); + a_1.a.f(); + } +}; +//// [a.js] +"use strict"; +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var b_1 = require('./b'); +exports.a = { + f: function () { + var A = (function () { + function A() { + } + return A; + }()); + var B = (function (_super) { + __extends(B, _super); + function B() { + _super.apply(this, arguments); + } + return B; + }(A)); + b_1.b.f(); + } +}; diff --git a/tests/baselines/reference/classExtendsAcrossFiles.symbols b/tests/baselines/reference/classExtendsAcrossFiles.symbols new file mode 100644 index 00000000000..cf81c923912 --- /dev/null +++ b/tests/baselines/reference/classExtendsAcrossFiles.symbols @@ -0,0 +1,46 @@ +=== tests/cases/compiler/a.ts === +import { b } from './b'; +>b : Symbol(b, Decl(a.ts, 0, 8)) + +export const a = { +>a : Symbol(a, Decl(a.ts, 1, 12)) + + f: () => { +>f : Symbol(f, Decl(a.ts, 1, 18)) + + class A { } +>A : Symbol(A, Decl(a.ts, 2, 14)) + + class B extends A { } +>B : Symbol(B, Decl(a.ts, 3, 19)) +>A : Symbol(A, Decl(a.ts, 2, 14)) + + b.f(); +>b.f : Symbol(f, Decl(b.ts, 1, 18)) +>b : Symbol(b, Decl(a.ts, 0, 8)) +>f : Symbol(f, Decl(b.ts, 1, 18)) + } +}; +=== tests/cases/compiler/b.ts === +import { a } from './a'; +>a : Symbol(a, Decl(b.ts, 0, 8)) + +export const b = { +>b : Symbol(b, Decl(b.ts, 1, 12)) + + f: () => { +>f : Symbol(f, Decl(b.ts, 1, 18)) + + class A { } +>A : Symbol(A, Decl(b.ts, 2, 14)) + + class B extends A { } +>B : Symbol(B, Decl(b.ts, 3, 19)) +>A : Symbol(A, Decl(b.ts, 2, 14)) + + a.f(); +>a.f : Symbol(f, Decl(a.ts, 1, 18)) +>a : Symbol(a, Decl(b.ts, 0, 8)) +>f : Symbol(f, Decl(a.ts, 1, 18)) + } +}; diff --git a/tests/baselines/reference/classExtendsAcrossFiles.types b/tests/baselines/reference/classExtendsAcrossFiles.types new file mode 100644 index 00000000000..fe3427ba043 --- /dev/null +++ b/tests/baselines/reference/classExtendsAcrossFiles.types @@ -0,0 +1,52 @@ +=== tests/cases/compiler/a.ts === +import { b } from './b'; +>b : { f: () => void; } + +export const a = { +>a : { f: () => void; } +>{ f: () => { class A { } class B extends A { } b.f(); }} : { f: () => void; } + + f: () => { +>f : () => void +>() => { class A { } class B extends A { } b.f(); } : () => void + + class A { } +>A : A + + class B extends A { } +>B : B +>A : A + + b.f(); +>b.f() : void +>b.f : () => void +>b : { f: () => void; } +>f : () => void + } +}; +=== tests/cases/compiler/b.ts === +import { a } from './a'; +>a : { f: () => void; } + +export const b = { +>b : { f: () => void; } +>{ f: () => { class A { } class B extends A { } a.f(); }} : { f: () => void; } + + f: () => { +>f : () => void +>() => { class A { } class B extends A { } a.f(); } : () => void + + class A { } +>A : A + + class B extends A { } +>B : B +>A : A + + a.f(); +>a.f() : void +>a.f : () => void +>a : { f: () => void; } +>f : () => void + } +}; diff --git a/tests/baselines/reference/classExtendsNull.errors.txt b/tests/baselines/reference/classExtendsNull.errors.txt index 7bb44774826..905c90c42fd 100644 --- a/tests/baselines/reference/classExtendsNull.errors.txt +++ b/tests/baselines/reference/classExtendsNull.errors.txt @@ -1,17 +1,14 @@ -tests/cases/compiler/classExtendsNull.ts(2,5): error TS17005: A constructor cannot contain a 'super' call when its class extends 'null' +tests/cases/compiler/classExtendsNull.ts(3,9): error TS17005: A constructor cannot contain a 'super' call when its class extends 'null' ==== tests/cases/compiler/classExtendsNull.ts (1 errors) ==== class C extends null { constructor() { - ~~~~~~~~~~~~~~~ super(); - ~~~~~~~~~~~~~~~~ - return Object.create(null); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - } - ~~~~~ + ~~~~~~~ !!! error TS17005: A constructor cannot contain a 'super' call when its class extends 'null' + return Object.create(null); + } } class D extends null { diff --git a/tests/baselines/reference/classImplementsClass3.symbols b/tests/baselines/reference/classImplementsClass3.symbols index a1c565c8d53..66fdd66786c 100644 --- a/tests/baselines/reference/classImplementsClass3.symbols +++ b/tests/baselines/reference/classImplementsClass3.symbols @@ -1,14 +1,14 @@ === tests/cases/compiler/classImplementsClass3.ts === class A { foo(): number { return 1; } } >A : Symbol(A, Decl(classImplementsClass3.ts, 0, 0)) ->foo : Symbol(foo, Decl(classImplementsClass3.ts, 0, 9)) +>foo : Symbol(A.foo, Decl(classImplementsClass3.ts, 0, 9)) class C implements A { >C : Symbol(C, Decl(classImplementsClass3.ts, 0, 39)) >A : Symbol(A, Decl(classImplementsClass3.ts, 0, 0)) foo() { ->foo : Symbol(foo, Decl(classImplementsClass3.ts, 1, 22)) +>foo : Symbol(C.foo, Decl(classImplementsClass3.ts, 1, 22)) return 1; } diff --git a/tests/baselines/reference/classImplementsImportedInterface.symbols b/tests/baselines/reference/classImplementsImportedInterface.symbols index a629d3c005d..be06fa6f991 100644 --- a/tests/baselines/reference/classImplementsImportedInterface.symbols +++ b/tests/baselines/reference/classImplementsImportedInterface.symbols @@ -6,7 +6,7 @@ module M1 { >I : Symbol(I, Decl(classImplementsImportedInterface.ts, 0, 11)) foo(); ->foo : Symbol(foo, Decl(classImplementsImportedInterface.ts, 1, 24)) +>foo : Symbol(I.foo, Decl(classImplementsImportedInterface.ts, 1, 24)) } } @@ -23,6 +23,6 @@ module M2 { >T : Symbol(T, Decl(classImplementsImportedInterface.ts, 6, 11)) foo() {} ->foo : Symbol(foo, Decl(classImplementsImportedInterface.ts, 8, 26)) +>foo : Symbol(C.foo, Decl(classImplementsImportedInterface.ts, 8, 26)) } } diff --git a/tests/baselines/reference/classMemberInitializerWithLamdaScoping3.errors.txt b/tests/baselines/reference/classMemberInitializerWithLamdaScoping3.errors.txt index b016952a3aa..6af97590fa8 100644 --- a/tests/baselines/reference/classMemberInitializerWithLamdaScoping3.errors.txt +++ b/tests/baselines/reference/classMemberInitializerWithLamdaScoping3.errors.txt @@ -1,17 +1,14 @@ -tests/cases/compiler/classMemberInitializerWithLamdaScoping3_1.ts(4,14): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/compiler/classMemberInitializerWithLamdaScoping3_1.ts(8,21): error TS2301: Initializer of instance member variable 'messageHandler' cannot reference identifier 'field1' declared in the constructor. ==== tests/cases/compiler/classMemberInitializerWithLamdaScoping3_0.ts (0 errors) ==== var field1: string; -==== tests/cases/compiler/classMemberInitializerWithLamdaScoping3_1.ts (2 errors) ==== +==== tests/cases/compiler/classMemberInitializerWithLamdaScoping3_1.ts (1 errors) ==== declare var console: { log(msg?: any): void; }; export class Test1 { - ~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. constructor(private field1: string) { } messageHandler = () => { diff --git a/tests/baselines/reference/classMemberInitializerWithLamdaScoping4.errors.txt b/tests/baselines/reference/classMemberInitializerWithLamdaScoping4.errors.txt index 73fa862e82b..58a660c1ee8 100644 --- a/tests/baselines/reference/classMemberInitializerWithLamdaScoping4.errors.txt +++ b/tests/baselines/reference/classMemberInitializerWithLamdaScoping4.errors.txt @@ -1,11 +1,8 @@ -tests/cases/compiler/classMemberInitializerWithLamdaScoping3_0.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/compiler/classMemberInitializerWithLamdaScoping3_1.ts(8,21): error TS2304: Cannot find name 'field1'. -==== tests/cases/compiler/classMemberInitializerWithLamdaScoping3_0.ts (1 errors) ==== +==== tests/cases/compiler/classMemberInitializerWithLamdaScoping3_0.ts (0 errors) ==== export var field1: string; - ~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ==== tests/cases/compiler/classMemberInitializerWithLamdaScoping3_1.ts (1 errors) ==== declare var console: { diff --git a/tests/baselines/reference/classMemberInitializerWithLamdaScoping5.symbols b/tests/baselines/reference/classMemberInitializerWithLamdaScoping5.symbols index 585bae5b3c3..230f5bcec90 100644 --- a/tests/baselines/reference/classMemberInitializerWithLamdaScoping5.symbols +++ b/tests/baselines/reference/classMemberInitializerWithLamdaScoping5.symbols @@ -16,7 +16,7 @@ class Greeter { } messageHandler = (message: string) => { ->messageHandler : Symbol(messageHandler, Decl(classMemberInitializerWithLamdaScoping5.ts, 5, 5)) +>messageHandler : Symbol(Greeter.messageHandler, Decl(classMemberInitializerWithLamdaScoping5.ts, 5, 5)) >message : Symbol(message, Decl(classMemberInitializerWithLamdaScoping5.ts, 7, 22)) console.log(message); // This shouldnt be error diff --git a/tests/baselines/reference/classOrder1.symbols b/tests/baselines/reference/classOrder1.symbols index 4f1541ba9cd..02d6fc8ea34 100644 --- a/tests/baselines/reference/classOrder1.symbols +++ b/tests/baselines/reference/classOrder1.symbols @@ -3,7 +3,7 @@ class A { >A : Symbol(A, Decl(classOrder1.ts, 0, 0)) public foo() { ->foo : Symbol(foo, Decl(classOrder1.ts, 0, 9)) +>foo : Symbol(A.foo, Decl(classOrder1.ts, 0, 9)) /*WScript.Echo("Here!");*/ } diff --git a/tests/baselines/reference/classOrder2.symbols b/tests/baselines/reference/classOrder2.symbols index 4ee49d269a9..8ca6e89e1db 100644 --- a/tests/baselines/reference/classOrder2.symbols +++ b/tests/baselines/reference/classOrder2.symbols @@ -5,7 +5,7 @@ class A extends B { >B : Symbol(B, Decl(classOrder2.ts, 5, 1)) foo() { this.bar(); } ->foo : Symbol(foo, Decl(classOrder2.ts, 1, 19)) +>foo : Symbol(A.foo, Decl(classOrder2.ts, 1, 19)) >this.bar : Symbol(B.bar, Decl(classOrder2.ts, 7, 9)) >this : Symbol(A, Decl(classOrder2.ts, 0, 0)) >bar : Symbol(B.bar, Decl(classOrder2.ts, 7, 9)) @@ -16,7 +16,7 @@ class B { >B : Symbol(B, Decl(classOrder2.ts, 5, 1)) bar() { } ->bar : Symbol(bar, Decl(classOrder2.ts, 7, 9)) +>bar : Symbol(B.bar, Decl(classOrder2.ts, 7, 9)) } diff --git a/tests/baselines/reference/classOrderBug.symbols b/tests/baselines/reference/classOrderBug.symbols index 9065909180b..bbc78371231 100644 --- a/tests/baselines/reference/classOrderBug.symbols +++ b/tests/baselines/reference/classOrderBug.symbols @@ -3,15 +3,15 @@ class bar { >bar : Symbol(bar, Decl(classOrderBug.ts, 0, 0)) public baz: foo; ->baz : Symbol(baz, Decl(classOrderBug.ts, 0, 11)) +>baz : Symbol(bar.baz, Decl(classOrderBug.ts, 0, 11)) >foo : Symbol(foo, Decl(classOrderBug.ts, 10, 12)) constructor() { this.baz = new foo(); ->this.baz : Symbol(baz, Decl(classOrderBug.ts, 0, 11)) +>this.baz : Symbol(bar.baz, Decl(classOrderBug.ts, 0, 11)) >this : Symbol(bar, Decl(classOrderBug.ts, 0, 0)) ->baz : Symbol(baz, Decl(classOrderBug.ts, 0, 11)) +>baz : Symbol(bar.baz, Decl(classOrderBug.ts, 0, 11)) >foo : Symbol(foo, Decl(classOrderBug.ts, 10, 12)) } diff --git a/tests/baselines/reference/classPropertyAsPrivate.errors.txt b/tests/baselines/reference/classPropertyAsPrivate.errors.txt index a5fdffe091a..4cc38cb049f 100644 --- a/tests/baselines/reference/classPropertyAsPrivate.errors.txt +++ b/tests/baselines/reference/classPropertyAsPrivate.errors.txt @@ -2,14 +2,14 @@ tests/cases/conformance/classes/members/accessibility/classPropertyAsPrivate.ts( tests/cases/conformance/classes/members/accessibility/classPropertyAsPrivate.ts(4,17): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/classes/members/accessibility/classPropertyAsPrivate.ts(8,24): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/classes/members/accessibility/classPropertyAsPrivate.ts(9,24): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/classes/members/accessibility/classPropertyAsPrivate.ts(15,1): error TS2341: Property 'x' is private and only accessible within class 'C'. -tests/cases/conformance/classes/members/accessibility/classPropertyAsPrivate.ts(16,1): error TS2341: Property 'y' is private and only accessible within class 'C'. -tests/cases/conformance/classes/members/accessibility/classPropertyAsPrivate.ts(17,1): error TS2341: Property 'y' is private and only accessible within class 'C'. -tests/cases/conformance/classes/members/accessibility/classPropertyAsPrivate.ts(18,1): error TS2341: Property 'foo' is private and only accessible within class 'C'. -tests/cases/conformance/classes/members/accessibility/classPropertyAsPrivate.ts(20,1): error TS2341: Property 'a' is private and only accessible within class 'C'. -tests/cases/conformance/classes/members/accessibility/classPropertyAsPrivate.ts(21,1): error TS2341: Property 'b' is private and only accessible within class 'C'. -tests/cases/conformance/classes/members/accessibility/classPropertyAsPrivate.ts(22,1): error TS2341: Property 'b' is private and only accessible within class 'C'. -tests/cases/conformance/classes/members/accessibility/classPropertyAsPrivate.ts(23,1): error TS2341: Property 'foo' is private and only accessible within class 'C'. +tests/cases/conformance/classes/members/accessibility/classPropertyAsPrivate.ts(15,3): error TS2341: Property 'x' is private and only accessible within class 'C'. +tests/cases/conformance/classes/members/accessibility/classPropertyAsPrivate.ts(16,3): error TS2341: Property 'y' is private and only accessible within class 'C'. +tests/cases/conformance/classes/members/accessibility/classPropertyAsPrivate.ts(17,3): error TS2341: Property 'y' is private and only accessible within class 'C'. +tests/cases/conformance/classes/members/accessibility/classPropertyAsPrivate.ts(18,3): error TS2341: Property 'foo' is private and only accessible within class 'C'. +tests/cases/conformance/classes/members/accessibility/classPropertyAsPrivate.ts(20,3): error TS2341: Property 'a' is private and only accessible within class 'C'. +tests/cases/conformance/classes/members/accessibility/classPropertyAsPrivate.ts(21,3): error TS2341: Property 'b' is private and only accessible within class 'C'. +tests/cases/conformance/classes/members/accessibility/classPropertyAsPrivate.ts(22,3): error TS2341: Property 'b' is private and only accessible within class 'C'. +tests/cases/conformance/classes/members/accessibility/classPropertyAsPrivate.ts(23,3): error TS2341: Property 'foo' is private and only accessible within class 'C'. ==== tests/cases/conformance/classes/members/accessibility/classPropertyAsPrivate.ts (12 errors) ==== @@ -36,27 +36,27 @@ tests/cases/conformance/classes/members/accessibility/classPropertyAsPrivate.ts( var c: C; // all errors c.x; - ~~~ + ~ !!! error TS2341: Property 'x' is private and only accessible within class 'C'. c.y; - ~~~ + ~ !!! error TS2341: Property 'y' is private and only accessible within class 'C'. c.y = 1; - ~~~ + ~ !!! error TS2341: Property 'y' is private and only accessible within class 'C'. c.foo(); - ~~~~~ + ~~~ !!! error TS2341: Property 'foo' is private and only accessible within class 'C'. C.a; - ~~~ + ~ !!! error TS2341: Property 'a' is private and only accessible within class 'C'. C.b(); - ~~~ + ~ !!! error TS2341: Property 'b' is private and only accessible within class 'C'. C.b = 1; - ~~~ + ~ !!! error TS2341: Property 'b' is private and only accessible within class 'C'. C.foo(); - ~~~~~ + ~~~ !!! error TS2341: Property 'foo' is private and only accessible within class 'C'. \ No newline at end of file diff --git a/tests/baselines/reference/classPropertyAsProtected.errors.txt b/tests/baselines/reference/classPropertyAsProtected.errors.txt index 570ebc718ac..acfba42f9e3 100644 --- a/tests/baselines/reference/classPropertyAsProtected.errors.txt +++ b/tests/baselines/reference/classPropertyAsProtected.errors.txt @@ -2,14 +2,14 @@ tests/cases/conformance/classes/members/accessibility/classPropertyAsProtected.t tests/cases/conformance/classes/members/accessibility/classPropertyAsProtected.ts(4,19): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/classes/members/accessibility/classPropertyAsProtected.ts(8,26): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/classes/members/accessibility/classPropertyAsProtected.ts(9,26): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/classes/members/accessibility/classPropertyAsProtected.ts(15,1): error TS2445: Property 'x' is protected and only accessible within class 'C' and its subclasses. -tests/cases/conformance/classes/members/accessibility/classPropertyAsProtected.ts(16,1): error TS2445: Property 'y' is protected and only accessible within class 'C' and its subclasses. -tests/cases/conformance/classes/members/accessibility/classPropertyAsProtected.ts(17,1): error TS2445: Property 'y' is protected and only accessible within class 'C' and its subclasses. -tests/cases/conformance/classes/members/accessibility/classPropertyAsProtected.ts(18,1): error TS2445: Property 'foo' is protected and only accessible within class 'C' and its subclasses. -tests/cases/conformance/classes/members/accessibility/classPropertyAsProtected.ts(20,1): error TS2445: Property 'a' is protected and only accessible within class 'C' and its subclasses. -tests/cases/conformance/classes/members/accessibility/classPropertyAsProtected.ts(21,1): error TS2445: Property 'b' is protected and only accessible within class 'C' and its subclasses. -tests/cases/conformance/classes/members/accessibility/classPropertyAsProtected.ts(22,1): error TS2445: Property 'b' is protected and only accessible within class 'C' and its subclasses. -tests/cases/conformance/classes/members/accessibility/classPropertyAsProtected.ts(23,1): error TS2445: Property 'foo' is protected and only accessible within class 'C' and its subclasses. +tests/cases/conformance/classes/members/accessibility/classPropertyAsProtected.ts(15,3): error TS2445: Property 'x' is protected and only accessible within class 'C' and its subclasses. +tests/cases/conformance/classes/members/accessibility/classPropertyAsProtected.ts(16,3): error TS2445: Property 'y' is protected and only accessible within class 'C' and its subclasses. +tests/cases/conformance/classes/members/accessibility/classPropertyAsProtected.ts(17,3): error TS2445: Property 'y' is protected and only accessible within class 'C' and its subclasses. +tests/cases/conformance/classes/members/accessibility/classPropertyAsProtected.ts(18,3): error TS2445: Property 'foo' is protected and only accessible within class 'C' and its subclasses. +tests/cases/conformance/classes/members/accessibility/classPropertyAsProtected.ts(20,3): error TS2445: Property 'a' is protected and only accessible within class 'C' and its subclasses. +tests/cases/conformance/classes/members/accessibility/classPropertyAsProtected.ts(21,3): error TS2445: Property 'b' is protected and only accessible within class 'C' and its subclasses. +tests/cases/conformance/classes/members/accessibility/classPropertyAsProtected.ts(22,3): error TS2445: Property 'b' is protected and only accessible within class 'C' and its subclasses. +tests/cases/conformance/classes/members/accessibility/classPropertyAsProtected.ts(23,3): error TS2445: Property 'foo' is protected and only accessible within class 'C' and its subclasses. ==== tests/cases/conformance/classes/members/accessibility/classPropertyAsProtected.ts (12 errors) ==== @@ -36,27 +36,27 @@ tests/cases/conformance/classes/members/accessibility/classPropertyAsProtected.t var c: C; // all errors c.x; - ~~~ + ~ !!! error TS2445: Property 'x' is protected and only accessible within class 'C' and its subclasses. c.y; - ~~~ + ~ !!! error TS2445: Property 'y' is protected and only accessible within class 'C' and its subclasses. c.y = 1; - ~~~ + ~ !!! error TS2445: Property 'y' is protected and only accessible within class 'C' and its subclasses. c.foo(); - ~~~~~ + ~~~ !!! error TS2445: Property 'foo' is protected and only accessible within class 'C' and its subclasses. C.a; - ~~~ + ~ !!! error TS2445: Property 'a' is protected and only accessible within class 'C' and its subclasses. C.b(); - ~~~ + ~ !!! error TS2445: Property 'b' is protected and only accessible within class 'C' and its subclasses. C.b = 1; - ~~~ + ~ !!! error TS2445: Property 'b' is protected and only accessible within class 'C' and its subclasses. C.foo(); - ~~~~~ + ~~~ !!! error TS2445: Property 'foo' is protected and only accessible within class 'C' and its subclasses. \ No newline at end of file diff --git a/tests/baselines/reference/classSideInheritance2.symbols b/tests/baselines/reference/classSideInheritance2.symbols index 697aba99832..b90ae38a4a9 100644 --- a/tests/baselines/reference/classSideInheritance2.symbols +++ b/tests/baselines/reference/classSideInheritance2.symbols @@ -3,7 +3,7 @@ interface IText { >IText : Symbol(IText, Decl(classSideInheritance2.ts, 0, 0)) foo: number; ->foo : Symbol(foo, Decl(classSideInheritance2.ts, 0, 17)) +>foo : Symbol(IText.foo, Decl(classSideInheritance2.ts, 0, 17)) } interface TextSpan {} @@ -29,10 +29,10 @@ class TextBase implements IText { >IText : Symbol(IText, Decl(classSideInheritance2.ts, 0, 0)) public foo: number; ->foo : Symbol(foo, Decl(classSideInheritance2.ts, 13, 33)) +>foo : Symbol(TextBase.foo, Decl(classSideInheritance2.ts, 13, 33)) public subText(span: TextSpan): IText { ->subText : Symbol(subText, Decl(classSideInheritance2.ts, 14, 27)) +>subText : Symbol(TextBase.subText, Decl(classSideInheritance2.ts, 14, 27)) >span : Symbol(span, Decl(classSideInheritance2.ts, 15, 23)) >TextSpan : Symbol(TextSpan, Decl(classSideInheritance2.ts, 2, 1)) >IText : Symbol(IText, Decl(classSideInheritance2.ts, 0, 0)) diff --git a/tests/baselines/reference/classWithNoConstructorOrBaseClass.symbols b/tests/baselines/reference/classWithNoConstructorOrBaseClass.symbols index 0d26f892dec..efbd022a920 100644 --- a/tests/baselines/reference/classWithNoConstructorOrBaseClass.symbols +++ b/tests/baselines/reference/classWithNoConstructorOrBaseClass.symbols @@ -3,7 +3,7 @@ class C { >C : Symbol(C, Decl(classWithNoConstructorOrBaseClass.ts, 0, 0)) x: string; ->x : Symbol(x, Decl(classWithNoConstructorOrBaseClass.ts, 0, 9)) +>x : Symbol(C.x, Decl(classWithNoConstructorOrBaseClass.ts, 0, 9)) } var c = new C(); @@ -20,11 +20,11 @@ class D { >U : Symbol(U, Decl(classWithNoConstructorOrBaseClass.ts, 7, 10)) x: T; ->x : Symbol(x, Decl(classWithNoConstructorOrBaseClass.ts, 7, 14)) +>x : Symbol(D.x, Decl(classWithNoConstructorOrBaseClass.ts, 7, 14)) >T : Symbol(T, Decl(classWithNoConstructorOrBaseClass.ts, 7, 8)) y: U; ->y : Symbol(y, Decl(classWithNoConstructorOrBaseClass.ts, 8, 9)) +>y : Symbol(D.y, Decl(classWithNoConstructorOrBaseClass.ts, 8, 9)) >U : Symbol(U, Decl(classWithNoConstructorOrBaseClass.ts, 7, 10)) } diff --git a/tests/baselines/reference/classWithOnlyPublicMembersEquivalentToInterface.symbols b/tests/baselines/reference/classWithOnlyPublicMembersEquivalentToInterface.symbols index e30810f5cf9..b09c819cf65 100644 --- a/tests/baselines/reference/classWithOnlyPublicMembersEquivalentToInterface.symbols +++ b/tests/baselines/reference/classWithOnlyPublicMembersEquivalentToInterface.symbols @@ -5,17 +5,17 @@ class C { >C : Symbol(C, Decl(classWithOnlyPublicMembersEquivalentToInterface.ts, 0, 0)) public x: string; ->x : Symbol(x, Decl(classWithOnlyPublicMembersEquivalentToInterface.ts, 2, 9)) +>x : Symbol(C.x, Decl(classWithOnlyPublicMembersEquivalentToInterface.ts, 2, 9)) public y(a: number): number { return null; } ->y : Symbol(y, Decl(classWithOnlyPublicMembersEquivalentToInterface.ts, 3, 21)) +>y : Symbol(C.y, Decl(classWithOnlyPublicMembersEquivalentToInterface.ts, 3, 21)) >a : Symbol(a, Decl(classWithOnlyPublicMembersEquivalentToInterface.ts, 4, 13)) public get z() { return 1; } ->z : Symbol(z, Decl(classWithOnlyPublicMembersEquivalentToInterface.ts, 4, 48), Decl(classWithOnlyPublicMembersEquivalentToInterface.ts, 5, 32)) +>z : Symbol(C.z, Decl(classWithOnlyPublicMembersEquivalentToInterface.ts, 4, 48), Decl(classWithOnlyPublicMembersEquivalentToInterface.ts, 5, 32)) public set z(v) { } ->z : Symbol(z, Decl(classWithOnlyPublicMembersEquivalentToInterface.ts, 4, 48), Decl(classWithOnlyPublicMembersEquivalentToInterface.ts, 5, 32)) +>z : Symbol(C.z, Decl(classWithOnlyPublicMembersEquivalentToInterface.ts, 4, 48), Decl(classWithOnlyPublicMembersEquivalentToInterface.ts, 5, 32)) >v : Symbol(v, Decl(classWithOnlyPublicMembersEquivalentToInterface.ts, 6, 17)) [x: string]: Object; @@ -33,14 +33,14 @@ interface I { >I : Symbol(I, Decl(classWithOnlyPublicMembersEquivalentToInterface.ts, 10, 1)) x: string; ->x : Symbol(x, Decl(classWithOnlyPublicMembersEquivalentToInterface.ts, 12, 13)) +>x : Symbol(I.x, Decl(classWithOnlyPublicMembersEquivalentToInterface.ts, 12, 13)) y(b: number): number; ->y : Symbol(y, Decl(classWithOnlyPublicMembersEquivalentToInterface.ts, 13, 14)) +>y : Symbol(I.y, Decl(classWithOnlyPublicMembersEquivalentToInterface.ts, 13, 14)) >b : Symbol(b, Decl(classWithOnlyPublicMembersEquivalentToInterface.ts, 14, 6)) z: number; ->z : Symbol(z, Decl(classWithOnlyPublicMembersEquivalentToInterface.ts, 14, 25)) +>z : Symbol(I.z, Decl(classWithOnlyPublicMembersEquivalentToInterface.ts, 14, 25)) [x: string]: Object; >x : Symbol(x, Decl(classWithOnlyPublicMembersEquivalentToInterface.ts, 16, 5)) diff --git a/tests/baselines/reference/classWithOnlyPublicMembersEquivalentToInterface2.symbols b/tests/baselines/reference/classWithOnlyPublicMembersEquivalentToInterface2.symbols index 13a716f9e8c..80658b0531c 100644 --- a/tests/baselines/reference/classWithOnlyPublicMembersEquivalentToInterface2.symbols +++ b/tests/baselines/reference/classWithOnlyPublicMembersEquivalentToInterface2.symbols @@ -5,17 +5,17 @@ class C { >C : Symbol(C, Decl(classWithOnlyPublicMembersEquivalentToInterface2.ts, 0, 0)) public x: string; ->x : Symbol(x, Decl(classWithOnlyPublicMembersEquivalentToInterface2.ts, 2, 9)) +>x : Symbol(C.x, Decl(classWithOnlyPublicMembersEquivalentToInterface2.ts, 2, 9)) public y(a: number): number { return null; } ->y : Symbol(y, Decl(classWithOnlyPublicMembersEquivalentToInterface2.ts, 3, 21)) +>y : Symbol(C.y, Decl(classWithOnlyPublicMembersEquivalentToInterface2.ts, 3, 21)) >a : Symbol(a, Decl(classWithOnlyPublicMembersEquivalentToInterface2.ts, 4, 13)) public get z() { return 1; } ->z : Symbol(z, Decl(classWithOnlyPublicMembersEquivalentToInterface2.ts, 4, 48), Decl(classWithOnlyPublicMembersEquivalentToInterface2.ts, 5, 32)) +>z : Symbol(C.z, Decl(classWithOnlyPublicMembersEquivalentToInterface2.ts, 4, 48), Decl(classWithOnlyPublicMembersEquivalentToInterface2.ts, 5, 32)) public set z(v) { } ->z : Symbol(z, Decl(classWithOnlyPublicMembersEquivalentToInterface2.ts, 4, 48), Decl(classWithOnlyPublicMembersEquivalentToInterface2.ts, 5, 32)) +>z : Symbol(C.z, Decl(classWithOnlyPublicMembersEquivalentToInterface2.ts, 4, 48), Decl(classWithOnlyPublicMembersEquivalentToInterface2.ts, 5, 32)) >v : Symbol(v, Decl(classWithOnlyPublicMembersEquivalentToInterface2.ts, 6, 17)) [x: string]: Object; @@ -36,14 +36,14 @@ interface I { >I : Symbol(I, Decl(classWithOnlyPublicMembersEquivalentToInterface2.ts, 12, 1)) x: string; ->x : Symbol(x, Decl(classWithOnlyPublicMembersEquivalentToInterface2.ts, 14, 13)) +>x : Symbol(I.x, Decl(classWithOnlyPublicMembersEquivalentToInterface2.ts, 14, 13)) y(b: number): number; ->y : Symbol(y, Decl(classWithOnlyPublicMembersEquivalentToInterface2.ts, 15, 14)) +>y : Symbol(I.y, Decl(classWithOnlyPublicMembersEquivalentToInterface2.ts, 15, 14)) >b : Symbol(b, Decl(classWithOnlyPublicMembersEquivalentToInterface2.ts, 16, 6)) z: number; ->z : Symbol(z, Decl(classWithOnlyPublicMembersEquivalentToInterface2.ts, 16, 25)) +>z : Symbol(I.z, Decl(classWithOnlyPublicMembersEquivalentToInterface2.ts, 16, 25)) [x: string]: Object; >x : Symbol(x, Decl(classWithOnlyPublicMembersEquivalentToInterface2.ts, 18, 5)) diff --git a/tests/baselines/reference/classWithOptionalParameter.errors.txt b/tests/baselines/reference/classWithOptionalParameter.errors.txt deleted file mode 100644 index 6e512c2a02e..00000000000 --- a/tests/baselines/reference/classWithOptionalParameter.errors.txt +++ /dev/null @@ -1,26 +0,0 @@ -tests/cases/conformance/types/namedTypes/classWithOptionalParameter.ts(4,6): error TS1112: A class member cannot be declared optional. -tests/cases/conformance/types/namedTypes/classWithOptionalParameter.ts(5,6): error TS1112: A class member cannot be declared optional. -tests/cases/conformance/types/namedTypes/classWithOptionalParameter.ts(9,6): error TS1112: A class member cannot be declared optional. -tests/cases/conformance/types/namedTypes/classWithOptionalParameter.ts(10,6): error TS1112: A class member cannot be declared optional. - - -==== tests/cases/conformance/types/namedTypes/classWithOptionalParameter.ts (4 errors) ==== - // classes do not permit optional parameters, these are errors - - class C { - x?: string; - ~ -!!! error TS1112: A class member cannot be declared optional. - f?() {} - ~ -!!! error TS1112: A class member cannot be declared optional. - } - - class C2 { - x?: T; - ~ -!!! error TS1112: A class member cannot be declared optional. - f?(x: T) {} - ~ -!!! error TS1112: A class member cannot be declared optional. - } \ No newline at end of file diff --git a/tests/baselines/reference/classWithOptionalParameter.symbols b/tests/baselines/reference/classWithOptionalParameter.symbols new file mode 100644 index 00000000000..b85cd5d7a07 --- /dev/null +++ b/tests/baselines/reference/classWithOptionalParameter.symbols @@ -0,0 +1,26 @@ +=== tests/cases/conformance/types/namedTypes/classWithOptionalParameter.ts === +// classes do not permit optional parameters, these are errors + +class C { +>C : Symbol(C, Decl(classWithOptionalParameter.ts, 0, 0)) + + x?: string; +>x : Symbol(C.x, Decl(classWithOptionalParameter.ts, 2, 9)) + + f?() {} +>f : Symbol(C.f, Decl(classWithOptionalParameter.ts, 3, 15)) +} + +class C2 { +>C2 : Symbol(C2, Decl(classWithOptionalParameter.ts, 5, 1)) +>T : Symbol(T, Decl(classWithOptionalParameter.ts, 7, 9)) + + x?: T; +>x : Symbol(C2.x, Decl(classWithOptionalParameter.ts, 7, 13)) +>T : Symbol(T, Decl(classWithOptionalParameter.ts, 7, 9)) + + f?(x: T) {} +>f : Symbol(C2.f, Decl(classWithOptionalParameter.ts, 8, 10)) +>x : Symbol(x, Decl(classWithOptionalParameter.ts, 9, 7)) +>T : Symbol(T, Decl(classWithOptionalParameter.ts, 7, 9)) +} diff --git a/tests/baselines/reference/classWithOptionalParameter.types b/tests/baselines/reference/classWithOptionalParameter.types new file mode 100644 index 00000000000..2c62aee6fab --- /dev/null +++ b/tests/baselines/reference/classWithOptionalParameter.types @@ -0,0 +1,26 @@ +=== tests/cases/conformance/types/namedTypes/classWithOptionalParameter.ts === +// classes do not permit optional parameters, these are errors + +class C { +>C : C + + x?: string; +>x : string + + f?() {} +>f : () => void +} + +class C2 { +>C2 : C2 +>T : T + + x?: T; +>x : T +>T : T + + f?(x: T) {} +>f : (x: T) => void +>x : T +>T : T +} diff --git a/tests/baselines/reference/classWithPrivateProperty.errors.txt b/tests/baselines/reference/classWithPrivateProperty.errors.txt index 93a94e21075..359e5972250 100644 --- a/tests/baselines/reference/classWithPrivateProperty.errors.txt +++ b/tests/baselines/reference/classWithPrivateProperty.errors.txt @@ -1,11 +1,11 @@ -tests/cases/conformance/types/members/classWithPrivateProperty.ts(15,18): error TS2341: Property 'x' is private and only accessible within class 'C'. -tests/cases/conformance/types/members/classWithPrivateProperty.ts(16,18): error TS2341: Property 'a' is private and only accessible within class 'C'. -tests/cases/conformance/types/members/classWithPrivateProperty.ts(17,18): error TS2341: Property 'b' is private and only accessible within class 'C'. -tests/cases/conformance/types/members/classWithPrivateProperty.ts(18,18): error TS2341: Property 'c' is private and only accessible within class 'C'. -tests/cases/conformance/types/members/classWithPrivateProperty.ts(19,18): error TS2341: Property 'd' is private and only accessible within class 'C'. -tests/cases/conformance/types/members/classWithPrivateProperty.ts(20,18): error TS2341: Property 'e' is private and only accessible within class 'C'. -tests/cases/conformance/types/members/classWithPrivateProperty.ts(21,18): error TS2341: Property 'f' is private and only accessible within class 'C'. -tests/cases/conformance/types/members/classWithPrivateProperty.ts(22,18): error TS2341: Property 'g' is private and only accessible within class 'C'. +tests/cases/conformance/types/members/classWithPrivateProperty.ts(15,20): error TS2341: Property 'x' is private and only accessible within class 'C'. +tests/cases/conformance/types/members/classWithPrivateProperty.ts(16,20): error TS2341: Property 'a' is private and only accessible within class 'C'. +tests/cases/conformance/types/members/classWithPrivateProperty.ts(17,20): error TS2341: Property 'b' is private and only accessible within class 'C'. +tests/cases/conformance/types/members/classWithPrivateProperty.ts(18,20): error TS2341: Property 'c' is private and only accessible within class 'C'. +tests/cases/conformance/types/members/classWithPrivateProperty.ts(19,20): error TS2341: Property 'd' is private and only accessible within class 'C'. +tests/cases/conformance/types/members/classWithPrivateProperty.ts(20,20): error TS2341: Property 'e' is private and only accessible within class 'C'. +tests/cases/conformance/types/members/classWithPrivateProperty.ts(21,20): error TS2341: Property 'f' is private and only accessible within class 'C'. +tests/cases/conformance/types/members/classWithPrivateProperty.ts(22,20): error TS2341: Property 'g' is private and only accessible within class 'C'. ==== tests/cases/conformance/types/members/classWithPrivateProperty.ts (8 errors) ==== @@ -24,26 +24,26 @@ tests/cases/conformance/types/members/classWithPrivateProperty.ts(22,18): error var c = new C(); var r1: string = c.x; - ~~~ + ~ !!! error TS2341: Property 'x' is private and only accessible within class 'C'. var r2: string = c.a; - ~~~ + ~ !!! error TS2341: Property 'a' is private and only accessible within class 'C'. var r3: string = c.b; - ~~~ + ~ !!! error TS2341: Property 'b' is private and only accessible within class 'C'. var r4: string = c.c(); - ~~~ + ~ !!! error TS2341: Property 'c' is private and only accessible within class 'C'. var r5: string = c.d(); - ~~~ + ~ !!! error TS2341: Property 'd' is private and only accessible within class 'C'. var r6: string = C.e; - ~~~ + ~ !!! error TS2341: Property 'e' is private and only accessible within class 'C'. var r7: string = C.f(); - ~~~ + ~ !!! error TS2341: Property 'f' is private and only accessible within class 'C'. var r8: string = C.g(); - ~~~ + ~ !!! error TS2341: Property 'g' is private and only accessible within class 'C'. \ No newline at end of file diff --git a/tests/baselines/reference/classWithProtectedProperty.symbols b/tests/baselines/reference/classWithProtectedProperty.symbols index 017233081b2..c51b52b4df9 100644 --- a/tests/baselines/reference/classWithProtectedProperty.symbols +++ b/tests/baselines/reference/classWithProtectedProperty.symbols @@ -5,19 +5,19 @@ class C { >C : Symbol(C, Decl(classWithProtectedProperty.ts, 0, 0)) protected x; ->x : Symbol(x, Decl(classWithProtectedProperty.ts, 2, 9)) +>x : Symbol(C.x, Decl(classWithProtectedProperty.ts, 2, 9)) protected a = ''; ->a : Symbol(a, Decl(classWithProtectedProperty.ts, 3, 16)) +>a : Symbol(C.a, Decl(classWithProtectedProperty.ts, 3, 16)) protected b: string = ''; ->b : Symbol(b, Decl(classWithProtectedProperty.ts, 4, 21)) +>b : Symbol(C.b, Decl(classWithProtectedProperty.ts, 4, 21)) protected c() { return '' } ->c : Symbol(c, Decl(classWithProtectedProperty.ts, 5, 29)) +>c : Symbol(C.c, Decl(classWithProtectedProperty.ts, 5, 29)) protected d = () => ''; ->d : Symbol(d, Decl(classWithProtectedProperty.ts, 6, 31)) +>d : Symbol(C.d, Decl(classWithProtectedProperty.ts, 6, 31)) protected static e; >e : Symbol(C.e, Decl(classWithProtectedProperty.ts, 7, 27)) @@ -34,7 +34,7 @@ class D extends C { >C : Symbol(C, Decl(classWithProtectedProperty.ts, 0, 0)) method() { ->method : Symbol(method, Decl(classWithProtectedProperty.ts, 13, 19)) +>method : Symbol(D.method, Decl(classWithProtectedProperty.ts, 13, 19)) // No errors var d = new D(); diff --git a/tests/baselines/reference/classWithPublicProperty.symbols b/tests/baselines/reference/classWithPublicProperty.symbols index 0e3aa272e5d..612d50c4694 100644 --- a/tests/baselines/reference/classWithPublicProperty.symbols +++ b/tests/baselines/reference/classWithPublicProperty.symbols @@ -3,19 +3,19 @@ class C { >C : Symbol(C, Decl(classWithPublicProperty.ts, 0, 0)) public x; ->x : Symbol(x, Decl(classWithPublicProperty.ts, 0, 9)) +>x : Symbol(C.x, Decl(classWithPublicProperty.ts, 0, 9)) public a = ''; ->a : Symbol(a, Decl(classWithPublicProperty.ts, 1, 13)) +>a : Symbol(C.a, Decl(classWithPublicProperty.ts, 1, 13)) public b: string = ''; ->b : Symbol(b, Decl(classWithPublicProperty.ts, 2, 18)) +>b : Symbol(C.b, Decl(classWithPublicProperty.ts, 2, 18)) public c() { return '' } ->c : Symbol(c, Decl(classWithPublicProperty.ts, 3, 26)) +>c : Symbol(C.c, Decl(classWithPublicProperty.ts, 3, 26)) public d = () => ''; ->d : Symbol(d, Decl(classWithPublicProperty.ts, 4, 28)) +>d : Symbol(C.d, Decl(classWithPublicProperty.ts, 4, 28)) public static e; >e : Symbol(C.e, Decl(classWithPublicProperty.ts, 5, 24)) diff --git a/tests/baselines/reference/classdecl.js b/tests/baselines/reference/classdecl.js index 710c5166d30..a8a440fa17d 100644 --- a/tests/baselines/reference/classdecl.js +++ b/tests/baselines/reference/classdecl.js @@ -211,12 +211,12 @@ declare class a { pgF(): void; pv: any; d: number; - static p2: { + static readonly p2: { x: number; y: number; }; private static d2(); - private static p3; + private static readonly p3; private pv3; private foo(n); private foo(s); diff --git a/tests/baselines/reference/classdecl.symbols b/tests/baselines/reference/classdecl.symbols index ad355e23517..68c7a632c10 100644 --- a/tests/baselines/reference/classdecl.symbols +++ b/tests/baselines/reference/classdecl.symbols @@ -15,18 +15,18 @@ class a { } public pgF() { } ->pgF : Symbol(pgF, Decl(classdecl.ts, 6, 5)) +>pgF : Symbol(a.pgF, Decl(classdecl.ts, 6, 5)) public pv; ->pv : Symbol(pv, Decl(classdecl.ts, 8, 20)) +>pv : Symbol(a.pv, Decl(classdecl.ts, 8, 20)) public get d() { ->d : Symbol(d, Decl(classdecl.ts, 10, 14), Decl(classdecl.ts, 13, 5)) +>d : Symbol(a.d, Decl(classdecl.ts, 10, 14), Decl(classdecl.ts, 13, 5)) return 30; } public set d(a: number) { ->d : Symbol(d, Decl(classdecl.ts, 10, 14), Decl(classdecl.ts, 13, 5)) +>d : Symbol(a.d, Decl(classdecl.ts, 10, 14), Decl(classdecl.ts, 13, 5)) >a : Symbol(a, Decl(classdecl.ts, 14, 17)) } @@ -47,18 +47,18 @@ class a { return "string"; } private pv3; ->pv3 : Symbol(pv3, Decl(classdecl.ts, 25, 5)) +>pv3 : Symbol(a.pv3, Decl(classdecl.ts, 25, 5)) private foo(n: number): string; ->foo : Symbol(foo, Decl(classdecl.ts, 26, 16), Decl(classdecl.ts, 28, 35), Decl(classdecl.ts, 29, 35)) +>foo : Symbol(a.foo, Decl(classdecl.ts, 26, 16), Decl(classdecl.ts, 28, 35), Decl(classdecl.ts, 29, 35)) >n : Symbol(n, Decl(classdecl.ts, 28, 16)) private foo(s: string): string; ->foo : Symbol(foo, Decl(classdecl.ts, 26, 16), Decl(classdecl.ts, 28, 35), Decl(classdecl.ts, 29, 35)) +>foo : Symbol(a.foo, Decl(classdecl.ts, 26, 16), Decl(classdecl.ts, 28, 35), Decl(classdecl.ts, 29, 35)) >s : Symbol(s, Decl(classdecl.ts, 29, 16)) private foo(ns: any) { ->foo : Symbol(foo, Decl(classdecl.ts, 26, 16), Decl(classdecl.ts, 28, 35), Decl(classdecl.ts, 29, 35)) +>foo : Symbol(a.foo, Decl(classdecl.ts, 26, 16), Decl(classdecl.ts, 28, 35), Decl(classdecl.ts, 29, 35)) >ns : Symbol(ns, Decl(classdecl.ts, 30, 16)) return ns.toString(); @@ -130,13 +130,13 @@ declare class aAmbient { >s : Symbol(s, Decl(classdecl.ts, 67, 17)) public pgF(): void; ->pgF : Symbol(pgF, Decl(classdecl.ts, 67, 28)) +>pgF : Symbol(aAmbient.pgF, Decl(classdecl.ts, 67, 28)) public pv; ->pv : Symbol(pv, Decl(classdecl.ts, 68, 23)) +>pv : Symbol(aAmbient.pv, Decl(classdecl.ts, 68, 23)) public d : number; ->d : Symbol(d, Decl(classdecl.ts, 69, 14)) +>d : Symbol(aAmbient.d, Decl(classdecl.ts, 69, 14)) static p2 : { x: number; y: number; }; >p2 : Symbol(aAmbient.p2, Decl(classdecl.ts, 70, 22)) @@ -150,10 +150,10 @@ declare class aAmbient { >p3 : Symbol(aAmbient.p3, Decl(classdecl.ts, 72, 16)) private pv3; ->pv3 : Symbol(pv3, Decl(classdecl.ts, 73, 14)) +>pv3 : Symbol(aAmbient.pv3, Decl(classdecl.ts, 73, 14)) private foo(s); ->foo : Symbol(foo, Decl(classdecl.ts, 74, 16)) +>foo : Symbol(aAmbient.foo, Decl(classdecl.ts, 74, 16)) >s : Symbol(s, Decl(classdecl.ts, 75, 16)) } @@ -161,15 +161,15 @@ class d { >d : Symbol(d, Decl(classdecl.ts, 76, 1)) private foo(n: number): string; ->foo : Symbol(foo, Decl(classdecl.ts, 78, 9), Decl(classdecl.ts, 79, 35), Decl(classdecl.ts, 80, 35)) +>foo : Symbol(d.foo, Decl(classdecl.ts, 78, 9), Decl(classdecl.ts, 79, 35), Decl(classdecl.ts, 80, 35)) >n : Symbol(n, Decl(classdecl.ts, 79, 16)) private foo(s: string): string; ->foo : Symbol(foo, Decl(classdecl.ts, 78, 9), Decl(classdecl.ts, 79, 35), Decl(classdecl.ts, 80, 35)) +>foo : Symbol(d.foo, Decl(classdecl.ts, 78, 9), Decl(classdecl.ts, 79, 35), Decl(classdecl.ts, 80, 35)) >s : Symbol(s, Decl(classdecl.ts, 80, 16)) private foo(ns: any) { ->foo : Symbol(foo, Decl(classdecl.ts, 78, 9), Decl(classdecl.ts, 79, 35), Decl(classdecl.ts, 80, 35)) +>foo : Symbol(d.foo, Decl(classdecl.ts, 78, 9), Decl(classdecl.ts, 79, 35), Decl(classdecl.ts, 80, 35)) >ns : Symbol(ns, Decl(classdecl.ts, 81, 16)) return ns.toString(); @@ -181,15 +181,15 @@ class e { >e : Symbol(e, Decl(classdecl.ts, 84, 1)) private foo(s: string): string; ->foo : Symbol(foo, Decl(classdecl.ts, 86, 9), Decl(classdecl.ts, 87, 35), Decl(classdecl.ts, 88, 35)) +>foo : Symbol(e.foo, Decl(classdecl.ts, 86, 9), Decl(classdecl.ts, 87, 35), Decl(classdecl.ts, 88, 35)) >s : Symbol(s, Decl(classdecl.ts, 87, 16)) private foo(n: number): string; ->foo : Symbol(foo, Decl(classdecl.ts, 86, 9), Decl(classdecl.ts, 87, 35), Decl(classdecl.ts, 88, 35)) +>foo : Symbol(e.foo, Decl(classdecl.ts, 86, 9), Decl(classdecl.ts, 87, 35), Decl(classdecl.ts, 88, 35)) >n : Symbol(n, Decl(classdecl.ts, 88, 16)) private foo(ns: any) { ->foo : Symbol(foo, Decl(classdecl.ts, 86, 9), Decl(classdecl.ts, 87, 35), Decl(classdecl.ts, 88, 35)) +>foo : Symbol(e.foo, Decl(classdecl.ts, 86, 9), Decl(classdecl.ts, 87, 35), Decl(classdecl.ts, 88, 35)) >ns : Symbol(ns, Decl(classdecl.ts, 89, 16)) return ns.toString(); diff --git a/tests/baselines/reference/clinterfaces.symbols b/tests/baselines/reference/clinterfaces.symbols index 76c7d74b521..0c0bf5ba3a3 100644 --- a/tests/baselines/reference/clinterfaces.symbols +++ b/tests/baselines/reference/clinterfaces.symbols @@ -20,7 +20,7 @@ interface Foo { >T : Symbol(T, Decl(clinterfaces.ts, 7, 14), Decl(clinterfaces.ts, 11, 10)) a: string; ->a : Symbol(a, Decl(clinterfaces.ts, 7, 18)) +>a : Symbol(Foo.a, Decl(clinterfaces.ts, 7, 18)) } class Foo{ @@ -28,7 +28,7 @@ class Foo{ >T : Symbol(T, Decl(clinterfaces.ts, 7, 14), Decl(clinterfaces.ts, 11, 10)) b: number; ->b : Symbol(b, Decl(clinterfaces.ts, 11, 13)) +>b : Symbol(Foo.b, Decl(clinterfaces.ts, 11, 13)) } class Bar{ @@ -36,7 +36,7 @@ class Bar{ >T : Symbol(T, Decl(clinterfaces.ts, 15, 10), Decl(clinterfaces.ts, 19, 14)) b: number; ->b : Symbol(b, Decl(clinterfaces.ts, 15, 13)) +>b : Symbol(Bar.b, Decl(clinterfaces.ts, 15, 13)) } interface Bar { @@ -44,7 +44,7 @@ interface Bar { >T : Symbol(T, Decl(clinterfaces.ts, 15, 10), Decl(clinterfaces.ts, 19, 14)) a: string; ->a : Symbol(a, Decl(clinterfaces.ts, 19, 18)) +>a : Symbol(Bar.a, Decl(clinterfaces.ts, 19, 18)) } export = Foo; diff --git a/tests/baselines/reference/cloduleAcrossModuleDefinitions.symbols b/tests/baselines/reference/cloduleAcrossModuleDefinitions.symbols index 7be8383355c..c0821b54c69 100644 --- a/tests/baselines/reference/cloduleAcrossModuleDefinitions.symbols +++ b/tests/baselines/reference/cloduleAcrossModuleDefinitions.symbols @@ -6,7 +6,7 @@ module A { >B : Symbol(B, Decl(cloduleAcrossModuleDefinitions.ts, 0, 10), Decl(cloduleAcrossModuleDefinitions.ts, 7, 10)) foo() { } ->foo : Symbol(foo, Decl(cloduleAcrossModuleDefinitions.ts, 1, 20)) +>foo : Symbol(B.foo, Decl(cloduleAcrossModuleDefinitions.ts, 1, 20)) static bar() { } >bar : Symbol(B.bar, Decl(cloduleAcrossModuleDefinitions.ts, 2, 17)) diff --git a/tests/baselines/reference/cloduleAndTypeParameters.symbols b/tests/baselines/reference/cloduleAndTypeParameters.symbols index f2d96346495..5a1b5cf18dc 100644 --- a/tests/baselines/reference/cloduleAndTypeParameters.symbols +++ b/tests/baselines/reference/cloduleAndTypeParameters.symbols @@ -16,7 +16,7 @@ module Foo { >Bar : Symbol(Bar, Decl(cloduleAndTypeParameters.ts, 5, 12)) bar(): void; ->bar : Symbol(bar, Decl(cloduleAndTypeParameters.ts, 6, 24)) +>bar : Symbol(Bar.bar, Decl(cloduleAndTypeParameters.ts, 6, 24)) } export class Baz { diff --git a/tests/baselines/reference/cloduleStaticMembers.errors.txt b/tests/baselines/reference/cloduleStaticMembers.errors.txt index 914fea72424..a8fe560bac7 100644 --- a/tests/baselines/reference/cloduleStaticMembers.errors.txt +++ b/tests/baselines/reference/cloduleStaticMembers.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/cloduleStaticMembers.ts(6,13): error TS2341: Property 'x' is private and only accessible within class 'Clod'. +tests/cases/compiler/cloduleStaticMembers.ts(6,18): error TS2341: Property 'x' is private and only accessible within class 'Clod'. tests/cases/compiler/cloduleStaticMembers.ts(7,13): error TS2304: Cannot find name 'x'. tests/cases/compiler/cloduleStaticMembers.ts(10,13): error TS2304: Cannot find name 'y'. @@ -10,7 +10,7 @@ tests/cases/compiler/cloduleStaticMembers.ts(10,13): error TS2304: Cannot find n } module Clod { var p = Clod.x; - ~~~~~~ + ~ !!! error TS2341: Property 'x' is private and only accessible within class 'Clod'. var q = x; ~ diff --git a/tests/baselines/reference/cloduleTest1.symbols b/tests/baselines/reference/cloduleTest1.symbols index 01759cfa136..11e1967d16f 100644 --- a/tests/baselines/reference/cloduleTest1.symbols +++ b/tests/baselines/reference/cloduleTest1.symbols @@ -8,7 +8,7 @@ >$ : Symbol($, Decl(cloduleTest1.ts, 0, 0), Decl(cloduleTest1.ts, 0, 42), Decl(cloduleTest1.ts, 3, 3)) addClass(className: string): $; ->addClass : Symbol(addClass, Decl(cloduleTest1.ts, 1, 15)) +>addClass : Symbol($.addClass, Decl(cloduleTest1.ts, 1, 15)) >className : Symbol(className, Decl(cloduleTest1.ts, 2, 15)) >$ : Symbol($, Decl(cloduleTest1.ts, 0, 0), Decl(cloduleTest1.ts, 0, 42), Decl(cloduleTest1.ts, 3, 3)) } diff --git a/tests/baselines/reference/cloduleWithPriorUninstantiatedModule.symbols b/tests/baselines/reference/cloduleWithPriorUninstantiatedModule.symbols index 7f93d361dd9..be76ccfbfad 100644 --- a/tests/baselines/reference/cloduleWithPriorUninstantiatedModule.symbols +++ b/tests/baselines/reference/cloduleWithPriorUninstantiatedModule.symbols @@ -7,7 +7,7 @@ module Moclodule { >Someinterface : Symbol(Someinterface, Decl(cloduleWithPriorUninstantiatedModule.ts, 1, 18)) foo(): void; ->foo : Symbol(foo, Decl(cloduleWithPriorUninstantiatedModule.ts, 2, 36)) +>foo : Symbol(Someinterface.foo, Decl(cloduleWithPriorUninstantiatedModule.ts, 2, 36)) } } diff --git a/tests/baselines/reference/collisionArgumentsInterfaceMembers.symbols b/tests/baselines/reference/collisionArgumentsInterfaceMembers.symbols index a8856c37a4c..f0a82bec521 100644 --- a/tests/baselines/reference/collisionArgumentsInterfaceMembers.symbols +++ b/tests/baselines/reference/collisionArgumentsInterfaceMembers.symbols @@ -48,16 +48,16 @@ interface i3 { >i3 : Symbol(i3, Decl(collisionArgumentsInterfaceMembers.ts, 20, 1)) foo(i: number, ...arguments); // no error - no code gen ->foo : Symbol(foo, Decl(collisionArgumentsInterfaceMembers.ts, 23, 14)) +>foo : Symbol(i3.foo, Decl(collisionArgumentsInterfaceMembers.ts, 23, 14)) >i : Symbol(i, Decl(collisionArgumentsInterfaceMembers.ts, 24, 8)) >arguments : Symbol(arguments, Decl(collisionArgumentsInterfaceMembers.ts, 24, 18)) foo1(arguments: number, ...rest); // no error - no code gen ->foo1 : Symbol(foo1, Decl(collisionArgumentsInterfaceMembers.ts, 24, 33)) +>foo1 : Symbol(i3.foo1, Decl(collisionArgumentsInterfaceMembers.ts, 24, 33)) >arguments : Symbol(arguments, Decl(collisionArgumentsInterfaceMembers.ts, 25, 9)) >rest : Symbol(rest, Decl(collisionArgumentsInterfaceMembers.ts, 25, 27)) fooNoError(arguments: number); // no error ->fooNoError : Symbol(fooNoError, Decl(collisionArgumentsInterfaceMembers.ts, 25, 37)) +>fooNoError : Symbol(i3.fooNoError, Decl(collisionArgumentsInterfaceMembers.ts, 25, 37)) >arguments : Symbol(arguments, Decl(collisionArgumentsInterfaceMembers.ts, 26, 15)) } diff --git a/tests/baselines/reference/collisionCodeGenModuleWithConstructorChildren.symbols b/tests/baselines/reference/collisionCodeGenModuleWithConstructorChildren.symbols index 28665abd098..ce003b9c878 100644 --- a/tests/baselines/reference/collisionCodeGenModuleWithConstructorChildren.symbols +++ b/tests/baselines/reference/collisionCodeGenModuleWithConstructorChildren.symbols @@ -23,7 +23,7 @@ module M { >d : Symbol(d, Decl(collisionCodeGenModuleWithConstructorChildren.ts, 8, 10)) constructor(private M, p = x) { ->M : Symbol(M, Decl(collisionCodeGenModuleWithConstructorChildren.ts, 10, 20)) +>M : Symbol(d.M, Decl(collisionCodeGenModuleWithConstructorChildren.ts, 10, 20)) >p : Symbol(p, Decl(collisionCodeGenModuleWithConstructorChildren.ts, 10, 30)) >x : Symbol(x, Decl(collisionCodeGenModuleWithConstructorChildren.ts, 1, 14)) } diff --git a/tests/baselines/reference/collisionCodeGenModuleWithMethodChildren.symbols b/tests/baselines/reference/collisionCodeGenModuleWithMethodChildren.symbols index 02105ce42e6..87c90bfb480 100644 --- a/tests/baselines/reference/collisionCodeGenModuleWithMethodChildren.symbols +++ b/tests/baselines/reference/collisionCodeGenModuleWithMethodChildren.symbols @@ -9,7 +9,7 @@ module M { >c : Symbol(c, Decl(collisionCodeGenModuleWithMethodChildren.ts, 1, 21)) fn(M, p = x) { } ->fn : Symbol(fn, Decl(collisionCodeGenModuleWithMethodChildren.ts, 2, 13)) +>fn : Symbol(c.fn, Decl(collisionCodeGenModuleWithMethodChildren.ts, 2, 13)) >M : Symbol(M, Decl(collisionCodeGenModuleWithMethodChildren.ts, 3, 11)) >p : Symbol(p, Decl(collisionCodeGenModuleWithMethodChildren.ts, 3, 13)) >x : Symbol(x, Decl(collisionCodeGenModuleWithMethodChildren.ts, 1, 14)) @@ -23,7 +23,7 @@ module M { >d : Symbol(d, Decl(collisionCodeGenModuleWithMethodChildren.ts, 7, 10)) fn2() { ->fn2 : Symbol(fn2, Decl(collisionCodeGenModuleWithMethodChildren.ts, 8, 13)) +>fn2 : Symbol(d.fn2, Decl(collisionCodeGenModuleWithMethodChildren.ts, 8, 13)) var M; >M : Symbol(M, Decl(collisionCodeGenModuleWithMethodChildren.ts, 10, 15)) @@ -42,7 +42,7 @@ module M { >e : Symbol(e, Decl(collisionCodeGenModuleWithMethodChildren.ts, 16, 10)) fn3() { ->fn3 : Symbol(fn3, Decl(collisionCodeGenModuleWithMethodChildren.ts, 17, 13)) +>fn3 : Symbol(e.fn3, Decl(collisionCodeGenModuleWithMethodChildren.ts, 17, 13)) function M() { >M : Symbol(M, Decl(collisionCodeGenModuleWithMethodChildren.ts, 18, 15)) @@ -62,7 +62,7 @@ module M { // Shouldnt bn _M >f : Symbol(f, Decl(collisionCodeGenModuleWithMethodChildren.ts, 26, 10)) M() { ->M : Symbol(M, Decl(collisionCodeGenModuleWithMethodChildren.ts, 27, 13)) +>M : Symbol(f.M, Decl(collisionCodeGenModuleWithMethodChildren.ts, 27, 13)) } } } diff --git a/tests/baselines/reference/collisionRestParameterClassConstructor.symbols b/tests/baselines/reference/collisionRestParameterClassConstructor.symbols index 895cb0f8df4..4b1f20cc26e 100644 --- a/tests/baselines/reference/collisionRestParameterClassConstructor.symbols +++ b/tests/baselines/reference/collisionRestParameterClassConstructor.symbols @@ -45,7 +45,7 @@ class c3 { >c3 : Symbol(c3, Decl(collisionRestParameterClassConstructor.ts, 21, 1)) constructor(public _i: number, ...restParameters) { //_i is error ->_i : Symbol(_i, Decl(collisionRestParameterClassConstructor.ts, 24, 16)) +>_i : Symbol(c3._i, Decl(collisionRestParameterClassConstructor.ts, 24, 16)) >restParameters : Symbol(restParameters, Decl(collisionRestParameterClassConstructor.ts, 24, 34)) var _i = 10; // no error @@ -56,7 +56,7 @@ class c3NoError { >c3NoError : Symbol(c3NoError, Decl(collisionRestParameterClassConstructor.ts, 27, 1)) constructor(public _i: number) { // no error ->_i : Symbol(_i, Decl(collisionRestParameterClassConstructor.ts, 29, 16)) +>_i : Symbol(c3NoError._i, Decl(collisionRestParameterClassConstructor.ts, 29, 16)) var _i = 10; // no error >_i : Symbol(_i, Decl(collisionRestParameterClassConstructor.ts, 29, 16), Decl(collisionRestParameterClassConstructor.ts, 30, 11)) diff --git a/tests/baselines/reference/collisionRestParameterClassMethod.symbols b/tests/baselines/reference/collisionRestParameterClassMethod.symbols index 838736e33ce..e7f975b26b3 100644 --- a/tests/baselines/reference/collisionRestParameterClassMethod.symbols +++ b/tests/baselines/reference/collisionRestParameterClassMethod.symbols @@ -3,7 +3,7 @@ class c1 { >c1 : Symbol(c1, Decl(collisionRestParameterClassMethod.ts, 0, 0)) public foo(_i: number, ...restParameters) { //_i is error ->foo : Symbol(foo, Decl(collisionRestParameterClassMethod.ts, 0, 10)) +>foo : Symbol(c1.foo, Decl(collisionRestParameterClassMethod.ts, 0, 10)) >_i : Symbol(_i, Decl(collisionRestParameterClassMethod.ts, 1, 15), Decl(collisionRestParameterClassMethod.ts, 2, 11)) >restParameters : Symbol(restParameters, Decl(collisionRestParameterClassMethod.ts, 1, 26)) @@ -11,24 +11,24 @@ class c1 { >_i : Symbol(_i, Decl(collisionRestParameterClassMethod.ts, 1, 15), Decl(collisionRestParameterClassMethod.ts, 2, 11)) } public fooNoError(_i: number) { // no error ->fooNoError : Symbol(fooNoError, Decl(collisionRestParameterClassMethod.ts, 3, 5)) +>fooNoError : Symbol(c1.fooNoError, Decl(collisionRestParameterClassMethod.ts, 3, 5)) >_i : Symbol(_i, Decl(collisionRestParameterClassMethod.ts, 4, 22), Decl(collisionRestParameterClassMethod.ts, 5, 11)) var _i = 10; // no error >_i : Symbol(_i, Decl(collisionRestParameterClassMethod.ts, 4, 22), Decl(collisionRestParameterClassMethod.ts, 5, 11)) } public f4(_i: number, ...rest); // no codegen no error ->f4 : Symbol(f4, Decl(collisionRestParameterClassMethod.ts, 6, 5), Decl(collisionRestParameterClassMethod.ts, 7, 35), Decl(collisionRestParameterClassMethod.ts, 8, 35)) +>f4 : Symbol(c1.f4, Decl(collisionRestParameterClassMethod.ts, 6, 5), Decl(collisionRestParameterClassMethod.ts, 7, 35), Decl(collisionRestParameterClassMethod.ts, 8, 35)) >_i : Symbol(_i, Decl(collisionRestParameterClassMethod.ts, 7, 14)) >rest : Symbol(rest, Decl(collisionRestParameterClassMethod.ts, 7, 25)) public f4(_i: string, ...rest); // no codegen no error ->f4 : Symbol(f4, Decl(collisionRestParameterClassMethod.ts, 6, 5), Decl(collisionRestParameterClassMethod.ts, 7, 35), Decl(collisionRestParameterClassMethod.ts, 8, 35)) +>f4 : Symbol(c1.f4, Decl(collisionRestParameterClassMethod.ts, 6, 5), Decl(collisionRestParameterClassMethod.ts, 7, 35), Decl(collisionRestParameterClassMethod.ts, 8, 35)) >_i : Symbol(_i, Decl(collisionRestParameterClassMethod.ts, 8, 14)) >rest : Symbol(rest, Decl(collisionRestParameterClassMethod.ts, 8, 25)) public f4(_i: any, ...rest) { // error ->f4 : Symbol(f4, Decl(collisionRestParameterClassMethod.ts, 6, 5), Decl(collisionRestParameterClassMethod.ts, 7, 35), Decl(collisionRestParameterClassMethod.ts, 8, 35)) +>f4 : Symbol(c1.f4, Decl(collisionRestParameterClassMethod.ts, 6, 5), Decl(collisionRestParameterClassMethod.ts, 7, 35), Decl(collisionRestParameterClassMethod.ts, 8, 35)) >_i : Symbol(_i, Decl(collisionRestParameterClassMethod.ts, 9, 14), Decl(collisionRestParameterClassMethod.ts, 10, 11)) >rest : Symbol(rest, Decl(collisionRestParameterClassMethod.ts, 9, 22)) @@ -37,15 +37,15 @@ class c1 { } public f4NoError(_i: number); // no error ->f4NoError : Symbol(f4NoError, Decl(collisionRestParameterClassMethod.ts, 11, 5), Decl(collisionRestParameterClassMethod.ts, 13, 33), Decl(collisionRestParameterClassMethod.ts, 14, 33)) +>f4NoError : Symbol(c1.f4NoError, Decl(collisionRestParameterClassMethod.ts, 11, 5), Decl(collisionRestParameterClassMethod.ts, 13, 33), Decl(collisionRestParameterClassMethod.ts, 14, 33)) >_i : Symbol(_i, Decl(collisionRestParameterClassMethod.ts, 13, 21)) public f4NoError(_i: string); // no error ->f4NoError : Symbol(f4NoError, Decl(collisionRestParameterClassMethod.ts, 11, 5), Decl(collisionRestParameterClassMethod.ts, 13, 33), Decl(collisionRestParameterClassMethod.ts, 14, 33)) +>f4NoError : Symbol(c1.f4NoError, Decl(collisionRestParameterClassMethod.ts, 11, 5), Decl(collisionRestParameterClassMethod.ts, 13, 33), Decl(collisionRestParameterClassMethod.ts, 14, 33)) >_i : Symbol(_i, Decl(collisionRestParameterClassMethod.ts, 14, 21)) public f4NoError(_i: any) { // no error ->f4NoError : Symbol(f4NoError, Decl(collisionRestParameterClassMethod.ts, 11, 5), Decl(collisionRestParameterClassMethod.ts, 13, 33), Decl(collisionRestParameterClassMethod.ts, 14, 33)) +>f4NoError : Symbol(c1.f4NoError, Decl(collisionRestParameterClassMethod.ts, 11, 5), Decl(collisionRestParameterClassMethod.ts, 13, 33), Decl(collisionRestParameterClassMethod.ts, 14, 33)) >_i : Symbol(_i, Decl(collisionRestParameterClassMethod.ts, 15, 21), Decl(collisionRestParameterClassMethod.ts, 16, 11)) var _i: any; // no error @@ -57,30 +57,30 @@ declare class c2 { >c2 : Symbol(c2, Decl(collisionRestParameterClassMethod.ts, 18, 1)) public foo(_i: number, ...restParameters); // No error - no code gen ->foo : Symbol(foo, Decl(collisionRestParameterClassMethod.ts, 20, 18)) +>foo : Symbol(c2.foo, Decl(collisionRestParameterClassMethod.ts, 20, 18)) >_i : Symbol(_i, Decl(collisionRestParameterClassMethod.ts, 21, 15)) >restParameters : Symbol(restParameters, Decl(collisionRestParameterClassMethod.ts, 21, 26)) public fooNoError(_i: number); // no error ->fooNoError : Symbol(fooNoError, Decl(collisionRestParameterClassMethod.ts, 21, 46)) +>fooNoError : Symbol(c2.fooNoError, Decl(collisionRestParameterClassMethod.ts, 21, 46)) >_i : Symbol(_i, Decl(collisionRestParameterClassMethod.ts, 22, 22)) public f4(_i: number, ...rest); // no codegen no error ->f4 : Symbol(f4, Decl(collisionRestParameterClassMethod.ts, 22, 34), Decl(collisionRestParameterClassMethod.ts, 24, 35)) +>f4 : Symbol(c2.f4, Decl(collisionRestParameterClassMethod.ts, 22, 34), Decl(collisionRestParameterClassMethod.ts, 24, 35)) >_i : Symbol(_i, Decl(collisionRestParameterClassMethod.ts, 24, 14)) >rest : Symbol(rest, Decl(collisionRestParameterClassMethod.ts, 24, 25)) public f4(_i: string, ...rest); // no codegen no error ->f4 : Symbol(f4, Decl(collisionRestParameterClassMethod.ts, 22, 34), Decl(collisionRestParameterClassMethod.ts, 24, 35)) +>f4 : Symbol(c2.f4, Decl(collisionRestParameterClassMethod.ts, 22, 34), Decl(collisionRestParameterClassMethod.ts, 24, 35)) >_i : Symbol(_i, Decl(collisionRestParameterClassMethod.ts, 25, 14)) >rest : Symbol(rest, Decl(collisionRestParameterClassMethod.ts, 25, 25)) public f4NoError(_i: number); // no error ->f4NoError : Symbol(f4NoError, Decl(collisionRestParameterClassMethod.ts, 25, 35), Decl(collisionRestParameterClassMethod.ts, 26, 33)) +>f4NoError : Symbol(c2.f4NoError, Decl(collisionRestParameterClassMethod.ts, 25, 35), Decl(collisionRestParameterClassMethod.ts, 26, 33)) >_i : Symbol(_i, Decl(collisionRestParameterClassMethod.ts, 26, 21)) public f4NoError(_i: string); // no error ->f4NoError : Symbol(f4NoError, Decl(collisionRestParameterClassMethod.ts, 25, 35), Decl(collisionRestParameterClassMethod.ts, 26, 33)) +>f4NoError : Symbol(c2.f4NoError, Decl(collisionRestParameterClassMethod.ts, 25, 35), Decl(collisionRestParameterClassMethod.ts, 26, 33)) >_i : Symbol(_i, Decl(collisionRestParameterClassMethod.ts, 27, 21)) } @@ -88,14 +88,14 @@ class c3 { >c3 : Symbol(c3, Decl(collisionRestParameterClassMethod.ts, 28, 1)) public foo(...restParameters) { ->foo : Symbol(foo, Decl(collisionRestParameterClassMethod.ts, 30, 10)) +>foo : Symbol(c3.foo, Decl(collisionRestParameterClassMethod.ts, 30, 10)) >restParameters : Symbol(restParameters, Decl(collisionRestParameterClassMethod.ts, 31, 15)) var _i = 10; // no error >_i : Symbol(_i, Decl(collisionRestParameterClassMethod.ts, 32, 11)) } public fooNoError() { ->fooNoError : Symbol(fooNoError, Decl(collisionRestParameterClassMethod.ts, 33, 5)) +>fooNoError : Symbol(c3.fooNoError, Decl(collisionRestParameterClassMethod.ts, 33, 5)) var _i = 10; // no error >_i : Symbol(_i, Decl(collisionRestParameterClassMethod.ts, 35, 11)) diff --git a/tests/baselines/reference/collisionRestParameterInterfaceMembers.symbols b/tests/baselines/reference/collisionRestParameterInterfaceMembers.symbols index 448346c0838..4c99c7eec06 100644 --- a/tests/baselines/reference/collisionRestParameterInterfaceMembers.symbols +++ b/tests/baselines/reference/collisionRestParameterInterfaceMembers.symbols @@ -34,11 +34,11 @@ interface i3 { >i3 : Symbol(i3, Decl(collisionRestParameterInterfaceMembers.ts, 14, 1)) foo (_i: number, ...restParameters); // no error - no code gen ->foo : Symbol(foo, Decl(collisionRestParameterInterfaceMembers.ts, 17, 14)) +>foo : Symbol(i3.foo, Decl(collisionRestParameterInterfaceMembers.ts, 17, 14)) >_i : Symbol(_i, Decl(collisionRestParameterInterfaceMembers.ts, 18, 9)) >restParameters : Symbol(restParameters, Decl(collisionRestParameterInterfaceMembers.ts, 18, 20)) fooNoError (_i: number); // no error ->fooNoError : Symbol(fooNoError, Decl(collisionRestParameterInterfaceMembers.ts, 18, 40)) +>fooNoError : Symbol(i3.fooNoError, Decl(collisionRestParameterInterfaceMembers.ts, 18, 40)) >_i : Symbol(_i, Decl(collisionRestParameterInterfaceMembers.ts, 19, 16)) } diff --git a/tests/baselines/reference/commaOperatorWithSecondOperandObjectType.symbols b/tests/baselines/reference/commaOperatorWithSecondOperandObjectType.symbols index 3b8473318c0..6df26708078 100644 --- a/tests/baselines/reference/commaOperatorWithSecondOperandObjectType.symbols +++ b/tests/baselines/reference/commaOperatorWithSecondOperandObjectType.symbols @@ -19,7 +19,7 @@ class CLASS { >CLASS : Symbol(CLASS, Decl(commaOperatorWithSecondOperandObjectType.ts, 4, 19)) num: number; ->num : Symbol(num, Decl(commaOperatorWithSecondOperandObjectType.ts, 6, 13)) +>num : Symbol(CLASS.num, Decl(commaOperatorWithSecondOperandObjectType.ts, 6, 13)) } //The second operand type is Object @@ -82,7 +82,7 @@ true, {} >BOOLEAN : Symbol(BOOLEAN, Decl(commaOperatorWithSecondOperandObjectType.ts, 1, 3)) "string", new Date() ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) STRING.toLowerCase(), new CLASS() >STRING.toLowerCase : Symbol(String.toLowerCase, Decl(lib.d.ts, --, --)) @@ -110,7 +110,7 @@ var resultIsObject9 = (!BOOLEAN, { a: 1, b: "s" }); var resultIsObject10 = ("string", new Date()); >resultIsObject10 : Symbol(resultIsObject10, Decl(commaOperatorWithSecondOperandObjectType.ts, 36, 3)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) var resultIsObject11 = (STRING.toLowerCase(), new CLASS()); >resultIsObject11 : Symbol(resultIsObject11, Decl(commaOperatorWithSecondOperandObjectType.ts, 37, 3)) diff --git a/tests/baselines/reference/commaOperatorWithSecondOperandStringType.symbols b/tests/baselines/reference/commaOperatorWithSecondOperandStringType.symbols index 3c674237a21..2d9fc665a81 100644 --- a/tests/baselines/reference/commaOperatorWithSecondOperandStringType.symbols +++ b/tests/baselines/reference/commaOperatorWithSecondOperandStringType.symbols @@ -71,7 +71,7 @@ null, STRING; ANY = new Date(), STRING; >ANY : Symbol(ANY, Decl(commaOperatorWithSecondOperandStringType.ts, 0, 3)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >STRING : Symbol(STRING, Decl(commaOperatorWithSecondOperandStringType.ts, 3, 3)) true, ""; @@ -96,7 +96,7 @@ var resultIsString6 = (null, STRING); var resultIsString7 = (ANY = new Date(), STRING); >resultIsString7 : Symbol(resultIsString7, Decl(commaOperatorWithSecondOperandStringType.ts, 31, 3)) >ANY : Symbol(ANY, Decl(commaOperatorWithSecondOperandStringType.ts, 0, 3)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >STRING : Symbol(STRING, Decl(commaOperatorWithSecondOperandStringType.ts, 3, 3)) var resultIsString8 = (true, ""); diff --git a/tests/baselines/reference/commentOnAmbientModule.symbols b/tests/baselines/reference/commentOnAmbientModule.symbols index e7525e6306f..60d5dfe66fa 100644 --- a/tests/baselines/reference/commentOnAmbientModule.symbols +++ b/tests/baselines/reference/commentOnAmbientModule.symbols @@ -10,7 +10,7 @@ declare module E { >bar : Symbol(D.bar, Decl(a.ts, 11, 18)) foo(); ->foo : Symbol(foo, Decl(b.ts, 2, 32)) +>foo : Symbol(foobar.foo, Decl(b.ts, 2, 32)) } } === tests/cases/compiler/a.ts === diff --git a/tests/baselines/reference/commentOnClassMethod1.symbols b/tests/baselines/reference/commentOnClassMethod1.symbols index 18caefb744b..8fdb04c0e10 100644 --- a/tests/baselines/reference/commentOnClassMethod1.symbols +++ b/tests/baselines/reference/commentOnClassMethod1.symbols @@ -6,6 +6,6 @@ class WebControls { * Render a control */ createControl(): any { ->createControl : Symbol(createControl, Decl(commentOnClassMethod1.ts, 0, 19)) +>createControl : Symbol(WebControls.createControl, Decl(commentOnClassMethod1.ts, 0, 19)) } } diff --git a/tests/baselines/reference/commentOnSignature1.symbols b/tests/baselines/reference/commentOnSignature1.symbols index 7f0d48401cd..719544e21e6 100644 --- a/tests/baselines/reference/commentOnSignature1.symbols +++ b/tests/baselines/reference/commentOnSignature1.symbols @@ -51,16 +51,16 @@ class c { // dont keep this comment foo(a: string); ->foo : Symbol(foo, Decl(a.ts, 18, 5), Decl(a.ts, 21, 19), Decl(a.ts, 23, 19)) +>foo : Symbol(c.foo, Decl(a.ts, 18, 5), Decl(a.ts, 21, 19), Decl(a.ts, 23, 19)) >a : Symbol(a, Decl(a.ts, 21, 8)) /*! keep this pinned comment */ foo(a: number); ->foo : Symbol(foo, Decl(a.ts, 18, 5), Decl(a.ts, 21, 19), Decl(a.ts, 23, 19)) +>foo : Symbol(c.foo, Decl(a.ts, 18, 5), Decl(a.ts, 21, 19), Decl(a.ts, 23, 19)) >a : Symbol(a, Decl(a.ts, 23, 8)) foo(a: any) { ->foo : Symbol(foo, Decl(a.ts, 18, 5), Decl(a.ts, 21, 19), Decl(a.ts, 23, 19)) +>foo : Symbol(c.foo, Decl(a.ts, 18, 5), Decl(a.ts, 21, 19), Decl(a.ts, 23, 19)) >a : Symbol(a, Decl(a.ts, 24, 8)) } } diff --git a/tests/baselines/reference/commentsAfterFunctionExpression1.js b/tests/baselines/reference/commentsAfterFunctionExpression1.js new file mode 100644 index 00000000000..7a591391052 --- /dev/null +++ b/tests/baselines/reference/commentsAfterFunctionExpression1.js @@ -0,0 +1,14 @@ +//// [commentsAfterFunctionExpression1.ts] +var v = { + f: a => 0 /*t1*/, + g: (a => 0) /*t2*/, + h: (a => 0 /*t3*/) +} + + +//// [commentsAfterFunctionExpression1.js] +var v = { + f: function (a) { return 0; } /*t1*/, + g: (function (a) { return 0; }) /*t2*/, + h: (function (a) { return 0; } /*t3*/) +}; diff --git a/tests/baselines/reference/commentsAfterFunctionExpression1.symbols b/tests/baselines/reference/commentsAfterFunctionExpression1.symbols new file mode 100644 index 00000000000..450bb990c89 --- /dev/null +++ b/tests/baselines/reference/commentsAfterFunctionExpression1.symbols @@ -0,0 +1,17 @@ +=== tests/cases/compiler/commentsAfterFunctionExpression1.ts === +var v = { +>v : Symbol(v, Decl(commentsAfterFunctionExpression1.ts, 0, 3)) + + f: a => 0 /*t1*/, +>f : Symbol(f, Decl(commentsAfterFunctionExpression1.ts, 0, 9)) +>a : Symbol(a, Decl(commentsAfterFunctionExpression1.ts, 1, 6)) + + g: (a => 0) /*t2*/, +>g : Symbol(g, Decl(commentsAfterFunctionExpression1.ts, 1, 21)) +>a : Symbol(a, Decl(commentsAfterFunctionExpression1.ts, 2, 8)) + + h: (a => 0 /*t3*/) +>h : Symbol(h, Decl(commentsAfterFunctionExpression1.ts, 2, 23)) +>a : Symbol(a, Decl(commentsAfterFunctionExpression1.ts, 3, 8)) +} + diff --git a/tests/baselines/reference/commentsAfterFunctionExpression1.types b/tests/baselines/reference/commentsAfterFunctionExpression1.types new file mode 100644 index 00000000000..4a6b12bc210 --- /dev/null +++ b/tests/baselines/reference/commentsAfterFunctionExpression1.types @@ -0,0 +1,26 @@ +=== tests/cases/compiler/commentsAfterFunctionExpression1.ts === +var v = { +>v : { f: (a: any) => number; g: (a: any) => number; h: (a: any) => number; } +>{ f: a => 0 /*t1*/, g: (a => 0) /*t2*/, h: (a => 0 /*t3*/)} : { f: (a: any) => number; g: (a: any) => number; h: (a: any) => number; } + + f: a => 0 /*t1*/, +>f : (a: any) => number +>a => 0 : (a: any) => number +>a : any +>0 : number + + g: (a => 0) /*t2*/, +>g : (a: any) => number +>(a => 0) : (a: any) => number +>a => 0 : (a: any) => number +>a : any +>0 : number + + h: (a => 0 /*t3*/) +>h : (a: any) => number +>(a => 0 /*t3*/) : (a: any) => number +>a => 0 : (a: any) => number +>a : any +>0 : number +} + diff --git a/tests/baselines/reference/commentsClassMembers.js b/tests/baselines/reference/commentsClassMembers.js index fe2dc0a63d0..dacbde7a276 100644 --- a/tests/baselines/reference/commentsClassMembers.js +++ b/tests/baselines/reference/commentsClassMembers.js @@ -568,8 +568,8 @@ declare var i1_c: typeof c1; declare class cProperties { private val; /** getter only property*/ - p1: number; - nc_p1: number; + readonly p1: number; + readonly nc_p1: number; /**setter only property*/ p2: number; nc_p2: number; diff --git a/tests/baselines/reference/commentsClassMembers.symbols b/tests/baselines/reference/commentsClassMembers.symbols index dd014611df7..4cbf1292c10 100644 --- a/tests/baselines/reference/commentsClassMembers.symbols +++ b/tests/baselines/reference/commentsClassMembers.symbols @@ -6,88 +6,88 @@ class c1 { /** p1 is property of c1*/ public p1: number; ->p1 : Symbol(p1, Decl(commentsClassMembers.ts, 2, 10)) +>p1 : Symbol(c1.p1, Decl(commentsClassMembers.ts, 2, 10)) /** sum with property*/ public p2(/** number to add*/b: number) { ->p2 : Symbol(p2, Decl(commentsClassMembers.ts, 4, 22)) +>p2 : Symbol(c1.p2, Decl(commentsClassMembers.ts, 4, 22)) >b : Symbol(b, Decl(commentsClassMembers.ts, 6, 14)) return this.p1 + b; ->this.p1 : Symbol(p1, Decl(commentsClassMembers.ts, 2, 10)) +>this.p1 : Symbol(c1.p1, Decl(commentsClassMembers.ts, 2, 10)) >this : Symbol(c1, Decl(commentsClassMembers.ts, 0, 0)) ->p1 : Symbol(p1, Decl(commentsClassMembers.ts, 2, 10)) +>p1 : Symbol(c1.p1, Decl(commentsClassMembers.ts, 2, 10)) >b : Symbol(b, Decl(commentsClassMembers.ts, 6, 14)) } /* trailing comment of method*/ /** getter property*/ public get p3() { ->p3 : Symbol(p3, Decl(commentsClassMembers.ts, 8, 5), Decl(commentsClassMembers.ts, 12, 5)) +>p3 : Symbol(c1.p3, Decl(commentsClassMembers.ts, 8, 5), Decl(commentsClassMembers.ts, 12, 5)) return this.p2(this.p1); ->this.p2 : Symbol(p2, Decl(commentsClassMembers.ts, 4, 22)) +>this.p2 : Symbol(c1.p2, Decl(commentsClassMembers.ts, 4, 22)) >this : Symbol(c1, Decl(commentsClassMembers.ts, 0, 0)) ->p2 : Symbol(p2, Decl(commentsClassMembers.ts, 4, 22)) ->this.p1 : Symbol(p1, Decl(commentsClassMembers.ts, 2, 10)) +>p2 : Symbol(c1.p2, Decl(commentsClassMembers.ts, 4, 22)) +>this.p1 : Symbol(c1.p1, Decl(commentsClassMembers.ts, 2, 10)) >this : Symbol(c1, Decl(commentsClassMembers.ts, 0, 0)) ->p1 : Symbol(p1, Decl(commentsClassMembers.ts, 2, 10)) +>p1 : Symbol(c1.p1, Decl(commentsClassMembers.ts, 2, 10)) }// trailing comment Getter /** setter property*/ public set p3(/** this is value*/value: number) { ->p3 : Symbol(p3, Decl(commentsClassMembers.ts, 8, 5), Decl(commentsClassMembers.ts, 12, 5)) +>p3 : Symbol(c1.p3, Decl(commentsClassMembers.ts, 8, 5), Decl(commentsClassMembers.ts, 12, 5)) >value : Symbol(value, Decl(commentsClassMembers.ts, 14, 18)) this.p1 = this.p2(value); ->this.p1 : Symbol(p1, Decl(commentsClassMembers.ts, 2, 10)) +>this.p1 : Symbol(c1.p1, Decl(commentsClassMembers.ts, 2, 10)) >this : Symbol(c1, Decl(commentsClassMembers.ts, 0, 0)) ->p1 : Symbol(p1, Decl(commentsClassMembers.ts, 2, 10)) ->this.p2 : Symbol(p2, Decl(commentsClassMembers.ts, 4, 22)) +>p1 : Symbol(c1.p1, Decl(commentsClassMembers.ts, 2, 10)) +>this.p2 : Symbol(c1.p2, Decl(commentsClassMembers.ts, 4, 22)) >this : Symbol(c1, Decl(commentsClassMembers.ts, 0, 0)) ->p2 : Symbol(p2, Decl(commentsClassMembers.ts, 4, 22)) +>p2 : Symbol(c1.p2, Decl(commentsClassMembers.ts, 4, 22)) >value : Symbol(value, Decl(commentsClassMembers.ts, 14, 18)) }// trailing comment Setter /** pp1 is property of c1*/ private pp1: number; ->pp1 : Symbol(pp1, Decl(commentsClassMembers.ts, 16, 5)) +>pp1 : Symbol(c1.pp1, Decl(commentsClassMembers.ts, 16, 5)) /** sum with property*/ private pp2(/** number to add*/b: number) { ->pp2 : Symbol(pp2, Decl(commentsClassMembers.ts, 18, 24)) +>pp2 : Symbol(c1.pp2, Decl(commentsClassMembers.ts, 18, 24)) >b : Symbol(b, Decl(commentsClassMembers.ts, 20, 16)) return this.p1 + b; ->this.p1 : Symbol(p1, Decl(commentsClassMembers.ts, 2, 10)) +>this.p1 : Symbol(c1.p1, Decl(commentsClassMembers.ts, 2, 10)) >this : Symbol(c1, Decl(commentsClassMembers.ts, 0, 0)) ->p1 : Symbol(p1, Decl(commentsClassMembers.ts, 2, 10)) +>p1 : Symbol(c1.p1, Decl(commentsClassMembers.ts, 2, 10)) >b : Symbol(b, Decl(commentsClassMembers.ts, 20, 16)) } // trailing comment of method /** getter property*/ private get pp3() { ->pp3 : Symbol(pp3, Decl(commentsClassMembers.ts, 22, 5), Decl(commentsClassMembers.ts, 26, 5)) +>pp3 : Symbol(c1.pp3, Decl(commentsClassMembers.ts, 22, 5), Decl(commentsClassMembers.ts, 26, 5)) return this.pp2(this.pp1); ->this.pp2 : Symbol(pp2, Decl(commentsClassMembers.ts, 18, 24)) +>this.pp2 : Symbol(c1.pp2, Decl(commentsClassMembers.ts, 18, 24)) >this : Symbol(c1, Decl(commentsClassMembers.ts, 0, 0)) ->pp2 : Symbol(pp2, Decl(commentsClassMembers.ts, 18, 24)) ->this.pp1 : Symbol(pp1, Decl(commentsClassMembers.ts, 16, 5)) +>pp2 : Symbol(c1.pp2, Decl(commentsClassMembers.ts, 18, 24)) +>this.pp1 : Symbol(c1.pp1, Decl(commentsClassMembers.ts, 16, 5)) >this : Symbol(c1, Decl(commentsClassMembers.ts, 0, 0)) ->pp1 : Symbol(pp1, Decl(commentsClassMembers.ts, 16, 5)) +>pp1 : Symbol(c1.pp1, Decl(commentsClassMembers.ts, 16, 5)) } /** setter property*/ private set pp3( /** this is value*/value: number) { ->pp3 : Symbol(pp3, Decl(commentsClassMembers.ts, 22, 5), Decl(commentsClassMembers.ts, 26, 5)) +>pp3 : Symbol(c1.pp3, Decl(commentsClassMembers.ts, 22, 5), Decl(commentsClassMembers.ts, 26, 5)) >value : Symbol(value, Decl(commentsClassMembers.ts, 28, 20)) this.pp1 = this.pp2(value); ->this.pp1 : Symbol(pp1, Decl(commentsClassMembers.ts, 16, 5)) +>this.pp1 : Symbol(c1.pp1, Decl(commentsClassMembers.ts, 16, 5)) >this : Symbol(c1, Decl(commentsClassMembers.ts, 0, 0)) ->pp1 : Symbol(pp1, Decl(commentsClassMembers.ts, 16, 5)) ->this.pp2 : Symbol(pp2, Decl(commentsClassMembers.ts, 18, 24)) +>pp1 : Symbol(c1.pp1, Decl(commentsClassMembers.ts, 16, 5)) +>this.pp2 : Symbol(c1.pp2, Decl(commentsClassMembers.ts, 18, 24)) >this : Symbol(c1, Decl(commentsClassMembers.ts, 0, 0)) ->pp2 : Symbol(pp2, Decl(commentsClassMembers.ts, 18, 24)) +>pp2 : Symbol(c1.pp2, Decl(commentsClassMembers.ts, 18, 24)) >value : Symbol(value, Decl(commentsClassMembers.ts, 28, 20)) } /** Constructor method*/ @@ -137,77 +137,77 @@ class c1 { }/*trailing comment 2 */ /*setter*/ public nc_p1: number; ->nc_p1 : Symbol(nc_p1, Decl(commentsClassMembers.ts, 47, 5)) +>nc_p1 : Symbol(c1.nc_p1, Decl(commentsClassMembers.ts, 47, 5)) public nc_p2(b: number) { ->nc_p2 : Symbol(nc_p2, Decl(commentsClassMembers.ts, 48, 25)) +>nc_p2 : Symbol(c1.nc_p2, Decl(commentsClassMembers.ts, 48, 25)) >b : Symbol(b, Decl(commentsClassMembers.ts, 49, 17)) return this.nc_p1 + b; ->this.nc_p1 : Symbol(nc_p1, Decl(commentsClassMembers.ts, 47, 5)) +>this.nc_p1 : Symbol(c1.nc_p1, Decl(commentsClassMembers.ts, 47, 5)) >this : Symbol(c1, Decl(commentsClassMembers.ts, 0, 0)) ->nc_p1 : Symbol(nc_p1, Decl(commentsClassMembers.ts, 47, 5)) +>nc_p1 : Symbol(c1.nc_p1, Decl(commentsClassMembers.ts, 47, 5)) >b : Symbol(b, Decl(commentsClassMembers.ts, 49, 17)) } public get nc_p3() { ->nc_p3 : Symbol(nc_p3, Decl(commentsClassMembers.ts, 51, 5), Decl(commentsClassMembers.ts, 54, 5)) +>nc_p3 : Symbol(c1.nc_p3, Decl(commentsClassMembers.ts, 51, 5), Decl(commentsClassMembers.ts, 54, 5)) return this.nc_p2(this.nc_p1); ->this.nc_p2 : Symbol(nc_p2, Decl(commentsClassMembers.ts, 48, 25)) +>this.nc_p2 : Symbol(c1.nc_p2, Decl(commentsClassMembers.ts, 48, 25)) >this : Symbol(c1, Decl(commentsClassMembers.ts, 0, 0)) ->nc_p2 : Symbol(nc_p2, Decl(commentsClassMembers.ts, 48, 25)) ->this.nc_p1 : Symbol(nc_p1, Decl(commentsClassMembers.ts, 47, 5)) +>nc_p2 : Symbol(c1.nc_p2, Decl(commentsClassMembers.ts, 48, 25)) +>this.nc_p1 : Symbol(c1.nc_p1, Decl(commentsClassMembers.ts, 47, 5)) >this : Symbol(c1, Decl(commentsClassMembers.ts, 0, 0)) ->nc_p1 : Symbol(nc_p1, Decl(commentsClassMembers.ts, 47, 5)) +>nc_p1 : Symbol(c1.nc_p1, Decl(commentsClassMembers.ts, 47, 5)) } public set nc_p3(value: number) { ->nc_p3 : Symbol(nc_p3, Decl(commentsClassMembers.ts, 51, 5), Decl(commentsClassMembers.ts, 54, 5)) +>nc_p3 : Symbol(c1.nc_p3, Decl(commentsClassMembers.ts, 51, 5), Decl(commentsClassMembers.ts, 54, 5)) >value : Symbol(value, Decl(commentsClassMembers.ts, 55, 21)) this.nc_p1 = this.nc_p2(value); ->this.nc_p1 : Symbol(nc_p1, Decl(commentsClassMembers.ts, 47, 5)) +>this.nc_p1 : Symbol(c1.nc_p1, Decl(commentsClassMembers.ts, 47, 5)) >this : Symbol(c1, Decl(commentsClassMembers.ts, 0, 0)) ->nc_p1 : Symbol(nc_p1, Decl(commentsClassMembers.ts, 47, 5)) ->this.nc_p2 : Symbol(nc_p2, Decl(commentsClassMembers.ts, 48, 25)) +>nc_p1 : Symbol(c1.nc_p1, Decl(commentsClassMembers.ts, 47, 5)) +>this.nc_p2 : Symbol(c1.nc_p2, Decl(commentsClassMembers.ts, 48, 25)) >this : Symbol(c1, Decl(commentsClassMembers.ts, 0, 0)) ->nc_p2 : Symbol(nc_p2, Decl(commentsClassMembers.ts, 48, 25)) +>nc_p2 : Symbol(c1.nc_p2, Decl(commentsClassMembers.ts, 48, 25)) >value : Symbol(value, Decl(commentsClassMembers.ts, 55, 21)) } private nc_pp1: number; ->nc_pp1 : Symbol(nc_pp1, Decl(commentsClassMembers.ts, 57, 5)) +>nc_pp1 : Symbol(c1.nc_pp1, Decl(commentsClassMembers.ts, 57, 5)) private nc_pp2(b: number) { ->nc_pp2 : Symbol(nc_pp2, Decl(commentsClassMembers.ts, 58, 27)) +>nc_pp2 : Symbol(c1.nc_pp2, Decl(commentsClassMembers.ts, 58, 27)) >b : Symbol(b, Decl(commentsClassMembers.ts, 59, 19)) return this.nc_pp1 + b; ->this.nc_pp1 : Symbol(nc_pp1, Decl(commentsClassMembers.ts, 57, 5)) +>this.nc_pp1 : Symbol(c1.nc_pp1, Decl(commentsClassMembers.ts, 57, 5)) >this : Symbol(c1, Decl(commentsClassMembers.ts, 0, 0)) ->nc_pp1 : Symbol(nc_pp1, Decl(commentsClassMembers.ts, 57, 5)) +>nc_pp1 : Symbol(c1.nc_pp1, Decl(commentsClassMembers.ts, 57, 5)) >b : Symbol(b, Decl(commentsClassMembers.ts, 59, 19)) } private get nc_pp3() { ->nc_pp3 : Symbol(nc_pp3, Decl(commentsClassMembers.ts, 61, 5), Decl(commentsClassMembers.ts, 64, 5)) +>nc_pp3 : Symbol(c1.nc_pp3, Decl(commentsClassMembers.ts, 61, 5), Decl(commentsClassMembers.ts, 64, 5)) return this.nc_pp2(this.nc_pp1); ->this.nc_pp2 : Symbol(nc_pp2, Decl(commentsClassMembers.ts, 58, 27)) +>this.nc_pp2 : Symbol(c1.nc_pp2, Decl(commentsClassMembers.ts, 58, 27)) >this : Symbol(c1, Decl(commentsClassMembers.ts, 0, 0)) ->nc_pp2 : Symbol(nc_pp2, Decl(commentsClassMembers.ts, 58, 27)) ->this.nc_pp1 : Symbol(nc_pp1, Decl(commentsClassMembers.ts, 57, 5)) +>nc_pp2 : Symbol(c1.nc_pp2, Decl(commentsClassMembers.ts, 58, 27)) +>this.nc_pp1 : Symbol(c1.nc_pp1, Decl(commentsClassMembers.ts, 57, 5)) >this : Symbol(c1, Decl(commentsClassMembers.ts, 0, 0)) ->nc_pp1 : Symbol(nc_pp1, Decl(commentsClassMembers.ts, 57, 5)) +>nc_pp1 : Symbol(c1.nc_pp1, Decl(commentsClassMembers.ts, 57, 5)) } private set nc_pp3(value: number) { ->nc_pp3 : Symbol(nc_pp3, Decl(commentsClassMembers.ts, 61, 5), Decl(commentsClassMembers.ts, 64, 5)) +>nc_pp3 : Symbol(c1.nc_pp3, Decl(commentsClassMembers.ts, 61, 5), Decl(commentsClassMembers.ts, 64, 5)) >value : Symbol(value, Decl(commentsClassMembers.ts, 65, 23)) this.nc_pp1 = this.nc_pp2(value); ->this.nc_pp1 : Symbol(nc_pp1, Decl(commentsClassMembers.ts, 57, 5)) +>this.nc_pp1 : Symbol(c1.nc_pp1, Decl(commentsClassMembers.ts, 57, 5)) >this : Symbol(c1, Decl(commentsClassMembers.ts, 0, 0)) ->nc_pp1 : Symbol(nc_pp1, Decl(commentsClassMembers.ts, 57, 5)) ->this.nc_pp2 : Symbol(nc_pp2, Decl(commentsClassMembers.ts, 58, 27)) +>nc_pp1 : Symbol(c1.nc_pp1, Decl(commentsClassMembers.ts, 57, 5)) +>this.nc_pp2 : Symbol(c1.nc_pp2, Decl(commentsClassMembers.ts, 58, 27)) >this : Symbol(c1, Decl(commentsClassMembers.ts, 0, 0)) ->nc_pp2 : Symbol(nc_pp2, Decl(commentsClassMembers.ts, 58, 27)) +>nc_pp2 : Symbol(c1.nc_pp2, Decl(commentsClassMembers.ts, 58, 27)) >value : Symbol(value, Decl(commentsClassMembers.ts, 65, 23)) } static nc_s1: number; @@ -250,84 +250,84 @@ class c1 { // p1 is property of c1 public a_p1: number; ->a_p1 : Symbol(a_p1, Decl(commentsClassMembers.ts, 77, 5)) +>a_p1 : Symbol(c1.a_p1, Decl(commentsClassMembers.ts, 77, 5)) // sum with property public a_p2(b: number) { ->a_p2 : Symbol(a_p2, Decl(commentsClassMembers.ts, 80, 24)) +>a_p2 : Symbol(c1.a_p2, Decl(commentsClassMembers.ts, 80, 24)) >b : Symbol(b, Decl(commentsClassMembers.ts, 82, 16)) return this.a_p1 + b; ->this.a_p1 : Symbol(a_p1, Decl(commentsClassMembers.ts, 77, 5)) +>this.a_p1 : Symbol(c1.a_p1, Decl(commentsClassMembers.ts, 77, 5)) >this : Symbol(c1, Decl(commentsClassMembers.ts, 0, 0)) ->a_p1 : Symbol(a_p1, Decl(commentsClassMembers.ts, 77, 5)) +>a_p1 : Symbol(c1.a_p1, Decl(commentsClassMembers.ts, 77, 5)) >b : Symbol(b, Decl(commentsClassMembers.ts, 82, 16)) } // getter property public get a_p3() { ->a_p3 : Symbol(a_p3, Decl(commentsClassMembers.ts, 84, 5), Decl(commentsClassMembers.ts, 88, 5)) +>a_p3 : Symbol(c1.a_p3, Decl(commentsClassMembers.ts, 84, 5), Decl(commentsClassMembers.ts, 88, 5)) return this.a_p2(this.a_p1); ->this.a_p2 : Symbol(a_p2, Decl(commentsClassMembers.ts, 80, 24)) +>this.a_p2 : Symbol(c1.a_p2, Decl(commentsClassMembers.ts, 80, 24)) >this : Symbol(c1, Decl(commentsClassMembers.ts, 0, 0)) ->a_p2 : Symbol(a_p2, Decl(commentsClassMembers.ts, 80, 24)) ->this.a_p1 : Symbol(a_p1, Decl(commentsClassMembers.ts, 77, 5)) +>a_p2 : Symbol(c1.a_p2, Decl(commentsClassMembers.ts, 80, 24)) +>this.a_p1 : Symbol(c1.a_p1, Decl(commentsClassMembers.ts, 77, 5)) >this : Symbol(c1, Decl(commentsClassMembers.ts, 0, 0)) ->a_p1 : Symbol(a_p1, Decl(commentsClassMembers.ts, 77, 5)) +>a_p1 : Symbol(c1.a_p1, Decl(commentsClassMembers.ts, 77, 5)) } // setter property public set a_p3(value: number) { ->a_p3 : Symbol(a_p3, Decl(commentsClassMembers.ts, 84, 5), Decl(commentsClassMembers.ts, 88, 5)) +>a_p3 : Symbol(c1.a_p3, Decl(commentsClassMembers.ts, 84, 5), Decl(commentsClassMembers.ts, 88, 5)) >value : Symbol(value, Decl(commentsClassMembers.ts, 90, 20)) this.a_p1 = this.a_p2(value); ->this.a_p1 : Symbol(a_p1, Decl(commentsClassMembers.ts, 77, 5)) +>this.a_p1 : Symbol(c1.a_p1, Decl(commentsClassMembers.ts, 77, 5)) >this : Symbol(c1, Decl(commentsClassMembers.ts, 0, 0)) ->a_p1 : Symbol(a_p1, Decl(commentsClassMembers.ts, 77, 5)) ->this.a_p2 : Symbol(a_p2, Decl(commentsClassMembers.ts, 80, 24)) +>a_p1 : Symbol(c1.a_p1, Decl(commentsClassMembers.ts, 77, 5)) +>this.a_p2 : Symbol(c1.a_p2, Decl(commentsClassMembers.ts, 80, 24)) >this : Symbol(c1, Decl(commentsClassMembers.ts, 0, 0)) ->a_p2 : Symbol(a_p2, Decl(commentsClassMembers.ts, 80, 24)) +>a_p2 : Symbol(c1.a_p2, Decl(commentsClassMembers.ts, 80, 24)) >value : Symbol(value, Decl(commentsClassMembers.ts, 90, 20)) } // pp1 is property of c1 private a_pp1: number; ->a_pp1 : Symbol(a_pp1, Decl(commentsClassMembers.ts, 92, 5)) +>a_pp1 : Symbol(c1.a_pp1, Decl(commentsClassMembers.ts, 92, 5)) // sum with property private a_pp2(b: number) { ->a_pp2 : Symbol(a_pp2, Decl(commentsClassMembers.ts, 94, 26)) +>a_pp2 : Symbol(c1.a_pp2, Decl(commentsClassMembers.ts, 94, 26)) >b : Symbol(b, Decl(commentsClassMembers.ts, 96, 18)) return this.a_p1 + b; ->this.a_p1 : Symbol(a_p1, Decl(commentsClassMembers.ts, 77, 5)) +>this.a_p1 : Symbol(c1.a_p1, Decl(commentsClassMembers.ts, 77, 5)) >this : Symbol(c1, Decl(commentsClassMembers.ts, 0, 0)) ->a_p1 : Symbol(a_p1, Decl(commentsClassMembers.ts, 77, 5)) +>a_p1 : Symbol(c1.a_p1, Decl(commentsClassMembers.ts, 77, 5)) >b : Symbol(b, Decl(commentsClassMembers.ts, 96, 18)) } // getter property private get a_pp3() { ->a_pp3 : Symbol(a_pp3, Decl(commentsClassMembers.ts, 98, 5), Decl(commentsClassMembers.ts, 102, 5)) +>a_pp3 : Symbol(c1.a_pp3, Decl(commentsClassMembers.ts, 98, 5), Decl(commentsClassMembers.ts, 102, 5)) return this.a_pp2(this.a_pp1); ->this.a_pp2 : Symbol(a_pp2, Decl(commentsClassMembers.ts, 94, 26)) +>this.a_pp2 : Symbol(c1.a_pp2, Decl(commentsClassMembers.ts, 94, 26)) >this : Symbol(c1, Decl(commentsClassMembers.ts, 0, 0)) ->a_pp2 : Symbol(a_pp2, Decl(commentsClassMembers.ts, 94, 26)) ->this.a_pp1 : Symbol(a_pp1, Decl(commentsClassMembers.ts, 92, 5)) +>a_pp2 : Symbol(c1.a_pp2, Decl(commentsClassMembers.ts, 94, 26)) +>this.a_pp1 : Symbol(c1.a_pp1, Decl(commentsClassMembers.ts, 92, 5)) >this : Symbol(c1, Decl(commentsClassMembers.ts, 0, 0)) ->a_pp1 : Symbol(a_pp1, Decl(commentsClassMembers.ts, 92, 5)) +>a_pp1 : Symbol(c1.a_pp1, Decl(commentsClassMembers.ts, 92, 5)) } // setter property private set a_pp3(value: number) { ->a_pp3 : Symbol(a_pp3, Decl(commentsClassMembers.ts, 98, 5), Decl(commentsClassMembers.ts, 102, 5)) +>a_pp3 : Symbol(c1.a_pp3, Decl(commentsClassMembers.ts, 98, 5), Decl(commentsClassMembers.ts, 102, 5)) >value : Symbol(value, Decl(commentsClassMembers.ts, 104, 22)) this.a_pp1 = this.a_pp2(value); ->this.a_pp1 : Symbol(a_pp1, Decl(commentsClassMembers.ts, 92, 5)) +>this.a_pp1 : Symbol(c1.a_pp1, Decl(commentsClassMembers.ts, 92, 5)) >this : Symbol(c1, Decl(commentsClassMembers.ts, 0, 0)) ->a_pp1 : Symbol(a_pp1, Decl(commentsClassMembers.ts, 92, 5)) ->this.a_pp2 : Symbol(a_pp2, Decl(commentsClassMembers.ts, 94, 26)) +>a_pp1 : Symbol(c1.a_pp1, Decl(commentsClassMembers.ts, 92, 5)) +>this.a_pp2 : Symbol(c1.a_pp2, Decl(commentsClassMembers.ts, 94, 26)) >this : Symbol(c1, Decl(commentsClassMembers.ts, 0, 0)) ->a_pp2 : Symbol(a_pp2, Decl(commentsClassMembers.ts, 94, 26)) +>a_pp2 : Symbol(c1.a_pp2, Decl(commentsClassMembers.ts, 94, 26)) >value : Symbol(value, Decl(commentsClassMembers.ts, 104, 22)) } @@ -376,84 +376,84 @@ class c1 { /** p1 is property of c1 */ public b_p1: number; ->b_p1 : Symbol(b_p1, Decl(commentsClassMembers.ts, 122, 5)) +>b_p1 : Symbol(c1.b_p1, Decl(commentsClassMembers.ts, 122, 5)) /** sum with property */ public b_p2(b: number) { ->b_p2 : Symbol(b_p2, Decl(commentsClassMembers.ts, 125, 24)) +>b_p2 : Symbol(c1.b_p2, Decl(commentsClassMembers.ts, 125, 24)) >b : Symbol(b, Decl(commentsClassMembers.ts, 127, 16)) return this.b_p1 + b; ->this.b_p1 : Symbol(b_p1, Decl(commentsClassMembers.ts, 122, 5)) +>this.b_p1 : Symbol(c1.b_p1, Decl(commentsClassMembers.ts, 122, 5)) >this : Symbol(c1, Decl(commentsClassMembers.ts, 0, 0)) ->b_p1 : Symbol(b_p1, Decl(commentsClassMembers.ts, 122, 5)) +>b_p1 : Symbol(c1.b_p1, Decl(commentsClassMembers.ts, 122, 5)) >b : Symbol(b, Decl(commentsClassMembers.ts, 127, 16)) } /** getter property */ public get b_p3() { ->b_p3 : Symbol(b_p3, Decl(commentsClassMembers.ts, 129, 5), Decl(commentsClassMembers.ts, 133, 5)) +>b_p3 : Symbol(c1.b_p3, Decl(commentsClassMembers.ts, 129, 5), Decl(commentsClassMembers.ts, 133, 5)) return this.b_p2(this.b_p1); ->this.b_p2 : Symbol(b_p2, Decl(commentsClassMembers.ts, 125, 24)) +>this.b_p2 : Symbol(c1.b_p2, Decl(commentsClassMembers.ts, 125, 24)) >this : Symbol(c1, Decl(commentsClassMembers.ts, 0, 0)) ->b_p2 : Symbol(b_p2, Decl(commentsClassMembers.ts, 125, 24)) ->this.b_p1 : Symbol(b_p1, Decl(commentsClassMembers.ts, 122, 5)) +>b_p2 : Symbol(c1.b_p2, Decl(commentsClassMembers.ts, 125, 24)) +>this.b_p1 : Symbol(c1.b_p1, Decl(commentsClassMembers.ts, 122, 5)) >this : Symbol(c1, Decl(commentsClassMembers.ts, 0, 0)) ->b_p1 : Symbol(b_p1, Decl(commentsClassMembers.ts, 122, 5)) +>b_p1 : Symbol(c1.b_p1, Decl(commentsClassMembers.ts, 122, 5)) } /** setter property */ public set b_p3(value: number) { ->b_p3 : Symbol(b_p3, Decl(commentsClassMembers.ts, 129, 5), Decl(commentsClassMembers.ts, 133, 5)) +>b_p3 : Symbol(c1.b_p3, Decl(commentsClassMembers.ts, 129, 5), Decl(commentsClassMembers.ts, 133, 5)) >value : Symbol(value, Decl(commentsClassMembers.ts, 135, 20)) this.b_p1 = this.b_p2(value); ->this.b_p1 : Symbol(b_p1, Decl(commentsClassMembers.ts, 122, 5)) +>this.b_p1 : Symbol(c1.b_p1, Decl(commentsClassMembers.ts, 122, 5)) >this : Symbol(c1, Decl(commentsClassMembers.ts, 0, 0)) ->b_p1 : Symbol(b_p1, Decl(commentsClassMembers.ts, 122, 5)) ->this.b_p2 : Symbol(b_p2, Decl(commentsClassMembers.ts, 125, 24)) +>b_p1 : Symbol(c1.b_p1, Decl(commentsClassMembers.ts, 122, 5)) +>this.b_p2 : Symbol(c1.b_p2, Decl(commentsClassMembers.ts, 125, 24)) >this : Symbol(c1, Decl(commentsClassMembers.ts, 0, 0)) ->b_p2 : Symbol(b_p2, Decl(commentsClassMembers.ts, 125, 24)) +>b_p2 : Symbol(c1.b_p2, Decl(commentsClassMembers.ts, 125, 24)) >value : Symbol(value, Decl(commentsClassMembers.ts, 135, 20)) } /** pp1 is property of c1 */ private b_pp1: number; ->b_pp1 : Symbol(b_pp1, Decl(commentsClassMembers.ts, 137, 5)) +>b_pp1 : Symbol(c1.b_pp1, Decl(commentsClassMembers.ts, 137, 5)) /** sum with property */ private b_pp2(b: number) { ->b_pp2 : Symbol(b_pp2, Decl(commentsClassMembers.ts, 139, 26)) +>b_pp2 : Symbol(c1.b_pp2, Decl(commentsClassMembers.ts, 139, 26)) >b : Symbol(b, Decl(commentsClassMembers.ts, 141, 18)) return this.b_p1 + b; ->this.b_p1 : Symbol(b_p1, Decl(commentsClassMembers.ts, 122, 5)) +>this.b_p1 : Symbol(c1.b_p1, Decl(commentsClassMembers.ts, 122, 5)) >this : Symbol(c1, Decl(commentsClassMembers.ts, 0, 0)) ->b_p1 : Symbol(b_p1, Decl(commentsClassMembers.ts, 122, 5)) +>b_p1 : Symbol(c1.b_p1, Decl(commentsClassMembers.ts, 122, 5)) >b : Symbol(b, Decl(commentsClassMembers.ts, 141, 18)) } /** getter property */ private get b_pp3() { ->b_pp3 : Symbol(b_pp3, Decl(commentsClassMembers.ts, 143, 5), Decl(commentsClassMembers.ts, 147, 5)) +>b_pp3 : Symbol(c1.b_pp3, Decl(commentsClassMembers.ts, 143, 5), Decl(commentsClassMembers.ts, 147, 5)) return this.b_pp2(this.b_pp1); ->this.b_pp2 : Symbol(b_pp2, Decl(commentsClassMembers.ts, 139, 26)) +>this.b_pp2 : Symbol(c1.b_pp2, Decl(commentsClassMembers.ts, 139, 26)) >this : Symbol(c1, Decl(commentsClassMembers.ts, 0, 0)) ->b_pp2 : Symbol(b_pp2, Decl(commentsClassMembers.ts, 139, 26)) ->this.b_pp1 : Symbol(b_pp1, Decl(commentsClassMembers.ts, 137, 5)) +>b_pp2 : Symbol(c1.b_pp2, Decl(commentsClassMembers.ts, 139, 26)) +>this.b_pp1 : Symbol(c1.b_pp1, Decl(commentsClassMembers.ts, 137, 5)) >this : Symbol(c1, Decl(commentsClassMembers.ts, 0, 0)) ->b_pp1 : Symbol(b_pp1, Decl(commentsClassMembers.ts, 137, 5)) +>b_pp1 : Symbol(c1.b_pp1, Decl(commentsClassMembers.ts, 137, 5)) } /** setter property */ private set b_pp3(value: number) { ->b_pp3 : Symbol(b_pp3, Decl(commentsClassMembers.ts, 143, 5), Decl(commentsClassMembers.ts, 147, 5)) +>b_pp3 : Symbol(c1.b_pp3, Decl(commentsClassMembers.ts, 143, 5), Decl(commentsClassMembers.ts, 147, 5)) >value : Symbol(value, Decl(commentsClassMembers.ts, 149, 22)) this.b_pp1 = this.b_pp2(value); ->this.b_pp1 : Symbol(b_pp1, Decl(commentsClassMembers.ts, 137, 5)) +>this.b_pp1 : Symbol(c1.b_pp1, Decl(commentsClassMembers.ts, 137, 5)) >this : Symbol(c1, Decl(commentsClassMembers.ts, 0, 0)) ->b_pp1 : Symbol(b_pp1, Decl(commentsClassMembers.ts, 137, 5)) ->this.b_pp2 : Symbol(b_pp2, Decl(commentsClassMembers.ts, 139, 26)) +>b_pp1 : Symbol(c1.b_pp1, Decl(commentsClassMembers.ts, 137, 5)) +>this.b_pp2 : Symbol(c1.b_pp2, Decl(commentsClassMembers.ts, 139, 26)) >this : Symbol(c1, Decl(commentsClassMembers.ts, 0, 0)) ->b_pp2 : Symbol(b_pp2, Decl(commentsClassMembers.ts, 139, 26)) +>b_pp2 : Symbol(c1.b_pp2, Decl(commentsClassMembers.ts, 139, 26)) >value : Symbol(value, Decl(commentsClassMembers.ts, 149, 22)) } @@ -635,54 +635,54 @@ class cProperties { >cProperties : Symbol(cProperties, Decl(commentsClassMembers.ts, 193, 14)) private val: number; ->val : Symbol(val, Decl(commentsClassMembers.ts, 194, 19)) +>val : Symbol(cProperties.val, Decl(commentsClassMembers.ts, 194, 19)) /** getter only property*/ public get p1() { ->p1 : Symbol(p1, Decl(commentsClassMembers.ts, 195, 24)) +>p1 : Symbol(cProperties.p1, Decl(commentsClassMembers.ts, 195, 24)) return this.val; ->this.val : Symbol(val, Decl(commentsClassMembers.ts, 194, 19)) +>this.val : Symbol(cProperties.val, Decl(commentsClassMembers.ts, 194, 19)) >this : Symbol(cProperties, Decl(commentsClassMembers.ts, 193, 14)) ->val : Symbol(val, Decl(commentsClassMembers.ts, 194, 19)) +>val : Symbol(cProperties.val, Decl(commentsClassMembers.ts, 194, 19)) } // trailing comment of only getter public get nc_p1() { ->nc_p1 : Symbol(nc_p1, Decl(commentsClassMembers.ts, 199, 5)) +>nc_p1 : Symbol(cProperties.nc_p1, Decl(commentsClassMembers.ts, 199, 5)) return this.val; ->this.val : Symbol(val, Decl(commentsClassMembers.ts, 194, 19)) +>this.val : Symbol(cProperties.val, Decl(commentsClassMembers.ts, 194, 19)) >this : Symbol(cProperties, Decl(commentsClassMembers.ts, 193, 14)) ->val : Symbol(val, Decl(commentsClassMembers.ts, 194, 19)) +>val : Symbol(cProperties.val, Decl(commentsClassMembers.ts, 194, 19)) } /**setter only property*/ public set p2(value: number) { ->p2 : Symbol(p2, Decl(commentsClassMembers.ts, 202, 5)) +>p2 : Symbol(cProperties.p2, Decl(commentsClassMembers.ts, 202, 5)) >value : Symbol(value, Decl(commentsClassMembers.ts, 204, 18)) this.val = value; ->this.val : Symbol(val, Decl(commentsClassMembers.ts, 194, 19)) +>this.val : Symbol(cProperties.val, Decl(commentsClassMembers.ts, 194, 19)) >this : Symbol(cProperties, Decl(commentsClassMembers.ts, 193, 14)) ->val : Symbol(val, Decl(commentsClassMembers.ts, 194, 19)) +>val : Symbol(cProperties.val, Decl(commentsClassMembers.ts, 194, 19)) >value : Symbol(value, Decl(commentsClassMembers.ts, 204, 18)) } public set nc_p2(value: number) { ->nc_p2 : Symbol(nc_p2, Decl(commentsClassMembers.ts, 206, 5)) +>nc_p2 : Symbol(cProperties.nc_p2, Decl(commentsClassMembers.ts, 206, 5)) >value : Symbol(value, Decl(commentsClassMembers.ts, 207, 21)) this.val = value; ->this.val : Symbol(val, Decl(commentsClassMembers.ts, 194, 19)) +>this.val : Symbol(cProperties.val, Decl(commentsClassMembers.ts, 194, 19)) >this : Symbol(cProperties, Decl(commentsClassMembers.ts, 193, 14)) ->val : Symbol(val, Decl(commentsClassMembers.ts, 194, 19)) +>val : Symbol(cProperties.val, Decl(commentsClassMembers.ts, 194, 19)) >value : Symbol(value, Decl(commentsClassMembers.ts, 207, 21)) } /* trailing comment of setter only*/ public x = 10; /*trailing comment for property*/ ->x : Symbol(x, Decl(commentsClassMembers.ts, 209, 5)) +>x : Symbol(cProperties.x, Decl(commentsClassMembers.ts, 209, 5)) private y = 10; // trailing comment of // style ->y : Symbol(y, Decl(commentsClassMembers.ts, 211, 18)) +>y : Symbol(cProperties.y, Decl(commentsClassMembers.ts, 211, 18)) } var cProperties_i = new cProperties(); >cProperties_i : Symbol(cProperties_i, Decl(commentsClassMembers.ts, 214, 3)) diff --git a/tests/baselines/reference/commentsInheritance.js b/tests/baselines/reference/commentsInheritance.js index b9d84b2475a..42df3cca389 100644 --- a/tests/baselines/reference/commentsInheritance.js +++ b/tests/baselines/reference/commentsInheritance.js @@ -316,19 +316,19 @@ declare class c2 { /** c2 c2_f1*/ c2_f1(): void; /** c2 c2_prop*/ - c2_prop: number; + readonly c2_prop: number; c2_nc_p1: number; c2_nc_f1(): void; - c2_nc_prop: number; + readonly c2_nc_prop: number; /** c2 p1*/ p1: number; /** c2 f1*/ f1(): void; /** c2 prop*/ - prop: number; + readonly prop: number; nc_p1: number; nc_f1(): void; - nc_prop: number; + readonly nc_prop: number; /** c2 constructor*/ constructor(a: number); } @@ -339,10 +339,10 @@ declare class c3 extends c2 { /** c3 f1*/ f1(): void; /** c3 prop*/ - prop: number; + readonly prop: number; nc_p1: number; nc_f1(): void; - nc_prop: number; + readonly nc_prop: number; } declare var c2_i: c2; declare var c3_i: c3; diff --git a/tests/baselines/reference/commentsInheritance.symbols b/tests/baselines/reference/commentsInheritance.symbols index f702f40a0d4..288bfdb4280 100644 --- a/tests/baselines/reference/commentsInheritance.symbols +++ b/tests/baselines/reference/commentsInheritance.symbols @@ -6,90 +6,90 @@ interface i1 { /** i1_p1*/ i1_p1: number; ->i1_p1 : Symbol(i1_p1, Decl(commentsInheritance.ts, 2, 14)) +>i1_p1 : Symbol(i1.i1_p1, Decl(commentsInheritance.ts, 2, 14)) /** i1_f1*/ i1_f1(): void; ->i1_f1 : Symbol(i1_f1, Decl(commentsInheritance.ts, 4, 18)) +>i1_f1 : Symbol(i1.i1_f1, Decl(commentsInheritance.ts, 4, 18)) /** i1_l1*/ i1_l1: () => void; ->i1_l1 : Symbol(i1_l1, Decl(commentsInheritance.ts, 6, 18)) +>i1_l1 : Symbol(i1.i1_l1, Decl(commentsInheritance.ts, 6, 18)) // il_nc_p1 i1_nc_p1: number; ->i1_nc_p1 : Symbol(i1_nc_p1, Decl(commentsInheritance.ts, 8, 22)) +>i1_nc_p1 : Symbol(i1.i1_nc_p1, Decl(commentsInheritance.ts, 8, 22)) i1_nc_f1(): void; ->i1_nc_f1 : Symbol(i1_nc_f1, Decl(commentsInheritance.ts, 10, 21)) +>i1_nc_f1 : Symbol(i1.i1_nc_f1, Decl(commentsInheritance.ts, 10, 21)) i1_nc_l1: () => void; ->i1_nc_l1 : Symbol(i1_nc_l1, Decl(commentsInheritance.ts, 11, 21)) +>i1_nc_l1 : Symbol(i1.i1_nc_l1, Decl(commentsInheritance.ts, 11, 21)) p1: number; ->p1 : Symbol(p1, Decl(commentsInheritance.ts, 12, 25)) +>p1 : Symbol(i1.p1, Decl(commentsInheritance.ts, 12, 25)) f1(): void; ->f1 : Symbol(f1, Decl(commentsInheritance.ts, 13, 15)) +>f1 : Symbol(i1.f1, Decl(commentsInheritance.ts, 13, 15)) l1: () => void; ->l1 : Symbol(l1, Decl(commentsInheritance.ts, 14, 15)) +>l1 : Symbol(i1.l1, Decl(commentsInheritance.ts, 14, 15)) nc_p1: number; ->nc_p1 : Symbol(nc_p1, Decl(commentsInheritance.ts, 15, 19)) +>nc_p1 : Symbol(i1.nc_p1, Decl(commentsInheritance.ts, 15, 19)) nc_f1(): void; ->nc_f1 : Symbol(nc_f1, Decl(commentsInheritance.ts, 16, 18)) +>nc_f1 : Symbol(i1.nc_f1, Decl(commentsInheritance.ts, 16, 18)) nc_l1: () => void; ->nc_l1 : Symbol(nc_l1, Decl(commentsInheritance.ts, 17, 18)) +>nc_l1 : Symbol(i1.nc_l1, Decl(commentsInheritance.ts, 17, 18)) } class c1 implements i1 { >c1 : Symbol(c1, Decl(commentsInheritance.ts, 19, 1)) >i1 : Symbol(i1, Decl(commentsInheritance.ts, 0, 0)) public i1_p1: number; ->i1_p1 : Symbol(i1_p1, Decl(commentsInheritance.ts, 20, 24)) +>i1_p1 : Symbol(c1.i1_p1, Decl(commentsInheritance.ts, 20, 24)) // i1_f1 public i1_f1() { ->i1_f1 : Symbol(i1_f1, Decl(commentsInheritance.ts, 21, 25)) +>i1_f1 : Symbol(c1.i1_f1, Decl(commentsInheritance.ts, 21, 25)) } public i1_l1: () => void; ->i1_l1 : Symbol(i1_l1, Decl(commentsInheritance.ts, 24, 5)) +>i1_l1 : Symbol(c1.i1_l1, Decl(commentsInheritance.ts, 24, 5)) public i1_nc_p1: number; ->i1_nc_p1 : Symbol(i1_nc_p1, Decl(commentsInheritance.ts, 25, 29)) +>i1_nc_p1 : Symbol(c1.i1_nc_p1, Decl(commentsInheritance.ts, 25, 29)) public i1_nc_f1() { ->i1_nc_f1 : Symbol(i1_nc_f1, Decl(commentsInheritance.ts, 26, 28)) +>i1_nc_f1 : Symbol(c1.i1_nc_f1, Decl(commentsInheritance.ts, 26, 28)) } public i1_nc_l1: () => void; ->i1_nc_l1 : Symbol(i1_nc_l1, Decl(commentsInheritance.ts, 28, 5)) +>i1_nc_l1 : Symbol(c1.i1_nc_l1, Decl(commentsInheritance.ts, 28, 5)) /** c1_p1*/ public p1: number; ->p1 : Symbol(p1, Decl(commentsInheritance.ts, 29, 32)) +>p1 : Symbol(c1.p1, Decl(commentsInheritance.ts, 29, 32)) /** c1_f1*/ public f1() { ->f1 : Symbol(f1, Decl(commentsInheritance.ts, 31, 22)) +>f1 : Symbol(c1.f1, Decl(commentsInheritance.ts, 31, 22)) } /** c1_l1*/ public l1: () => void; ->l1 : Symbol(l1, Decl(commentsInheritance.ts, 34, 5)) +>l1 : Symbol(c1.l1, Decl(commentsInheritance.ts, 34, 5)) /** c1_nc_p1*/ public nc_p1: number; ->nc_p1 : Symbol(nc_p1, Decl(commentsInheritance.ts, 36, 26)) +>nc_p1 : Symbol(c1.nc_p1, Decl(commentsInheritance.ts, 36, 26)) /** c1_nc_f1*/ public nc_f1() { ->nc_f1 : Symbol(nc_f1, Decl(commentsInheritance.ts, 38, 25)) +>nc_f1 : Symbol(c1.nc_f1, Decl(commentsInheritance.ts, 38, 25)) } /** c1_nc_l1*/ public nc_l1: () => void; ->nc_l1 : Symbol(nc_l1, Decl(commentsInheritance.ts, 41, 5)) +>nc_l1 : Symbol(c1.nc_l1, Decl(commentsInheritance.ts, 41, 5)) } var i1_i: i1; >i1_i : Symbol(i1_i, Decl(commentsInheritance.ts, 45, 3)) @@ -109,51 +109,51 @@ class c2 { /** c2 c2_p1*/ public c2_p1: number; ->c2_p1 : Symbol(c2_p1, Decl(commentsInheritance.ts, 49, 10)) +>c2_p1 : Symbol(c2.c2_p1, Decl(commentsInheritance.ts, 49, 10)) /** c2 c2_f1*/ public c2_f1() { ->c2_f1 : Symbol(c2_f1, Decl(commentsInheritance.ts, 51, 25)) +>c2_f1 : Symbol(c2.c2_f1, Decl(commentsInheritance.ts, 51, 25)) } /** c2 c2_prop*/ public get c2_prop() { ->c2_prop : Symbol(c2_prop, Decl(commentsInheritance.ts, 54, 5)) +>c2_prop : Symbol(c2.c2_prop, Decl(commentsInheritance.ts, 54, 5)) return 10; } public c2_nc_p1: number; ->c2_nc_p1 : Symbol(c2_nc_p1, Decl(commentsInheritance.ts, 58, 5)) +>c2_nc_p1 : Symbol(c2.c2_nc_p1, Decl(commentsInheritance.ts, 58, 5)) public c2_nc_f1() { ->c2_nc_f1 : Symbol(c2_nc_f1, Decl(commentsInheritance.ts, 59, 28)) +>c2_nc_f1 : Symbol(c2.c2_nc_f1, Decl(commentsInheritance.ts, 59, 28)) } public get c2_nc_prop() { ->c2_nc_prop : Symbol(c2_nc_prop, Decl(commentsInheritance.ts, 61, 5)) +>c2_nc_prop : Symbol(c2.c2_nc_prop, Decl(commentsInheritance.ts, 61, 5)) return 10; } /** c2 p1*/ public p1: number; ->p1 : Symbol(p1, Decl(commentsInheritance.ts, 64, 5)) +>p1 : Symbol(c2.p1, Decl(commentsInheritance.ts, 64, 5)) /** c2 f1*/ public f1() { ->f1 : Symbol(f1, Decl(commentsInheritance.ts, 66, 22)) +>f1 : Symbol(c2.f1, Decl(commentsInheritance.ts, 66, 22)) } /** c2 prop*/ public get prop() { ->prop : Symbol(prop, Decl(commentsInheritance.ts, 69, 5)) +>prop : Symbol(c2.prop, Decl(commentsInheritance.ts, 69, 5)) return 10; } public nc_p1: number; ->nc_p1 : Symbol(nc_p1, Decl(commentsInheritance.ts, 73, 5)) +>nc_p1 : Symbol(c2.nc_p1, Decl(commentsInheritance.ts, 73, 5)) public nc_f1() { ->nc_f1 : Symbol(nc_f1, Decl(commentsInheritance.ts, 74, 25)) +>nc_f1 : Symbol(c2.nc_f1, Decl(commentsInheritance.ts, 74, 25)) } public get nc_prop() { ->nc_prop : Symbol(nc_prop, Decl(commentsInheritance.ts, 76, 5)) +>nc_prop : Symbol(c2.nc_prop, Decl(commentsInheritance.ts, 76, 5)) return 10; } @@ -162,9 +162,9 @@ class c2 { >a : Symbol(a, Decl(commentsInheritance.ts, 81, 16)) this.c2_p1 = a; ->this.c2_p1 : Symbol(c2_p1, Decl(commentsInheritance.ts, 49, 10)) +>this.c2_p1 : Symbol(c2.c2_p1, Decl(commentsInheritance.ts, 49, 10)) >this : Symbol(c2, Decl(commentsInheritance.ts, 48, 12)) ->c2_p1 : Symbol(c2_p1, Decl(commentsInheritance.ts, 49, 10)) +>c2_p1 : Symbol(c2.c2_p1, Decl(commentsInheritance.ts, 49, 10)) >a : Symbol(a, Decl(commentsInheritance.ts, 81, 16)) } } @@ -178,26 +178,26 @@ class c3 extends c2 { } /** c3 p1*/ public p1: number; ->p1 : Symbol(p1, Decl(commentsInheritance.ts, 88, 5)) +>p1 : Symbol(c3.p1, Decl(commentsInheritance.ts, 88, 5)) /** c3 f1*/ public f1() { ->f1 : Symbol(f1, Decl(commentsInheritance.ts, 90, 22)) +>f1 : Symbol(c3.f1, Decl(commentsInheritance.ts, 90, 22)) } /** c3 prop*/ public get prop() { ->prop : Symbol(prop, Decl(commentsInheritance.ts, 93, 5)) +>prop : Symbol(c3.prop, Decl(commentsInheritance.ts, 93, 5)) return 10; } public nc_p1: number; ->nc_p1 : Symbol(nc_p1, Decl(commentsInheritance.ts, 97, 5)) +>nc_p1 : Symbol(c3.nc_p1, Decl(commentsInheritance.ts, 97, 5)) public nc_f1() { ->nc_f1 : Symbol(nc_f1, Decl(commentsInheritance.ts, 98, 25)) +>nc_f1 : Symbol(c3.nc_f1, Decl(commentsInheritance.ts, 98, 25)) } public get nc_prop() { ->nc_prop : Symbol(nc_prop, Decl(commentsInheritance.ts, 100, 5)) +>nc_prop : Symbol(c3.nc_prop, Decl(commentsInheritance.ts, 100, 5)) return 10; } @@ -228,46 +228,46 @@ interface i2 { /** i2_p1*/ i2_p1: number; ->i2_p1 : Symbol(i2_p1, Decl(commentsInheritance.ts, 112, 14)) +>i2_p1 : Symbol(i2.i2_p1, Decl(commentsInheritance.ts, 112, 14)) /** i2_f1*/ i2_f1(): void; ->i2_f1 : Symbol(i2_f1, Decl(commentsInheritance.ts, 114, 18)) +>i2_f1 : Symbol(i2.i2_f1, Decl(commentsInheritance.ts, 114, 18)) /** i2_l1*/ i2_l1: () => void; ->i2_l1 : Symbol(i2_l1, Decl(commentsInheritance.ts, 116, 18)) +>i2_l1 : Symbol(i2.i2_l1, Decl(commentsInheritance.ts, 116, 18)) // i2_nc_p1 i2_nc_p1: number; ->i2_nc_p1 : Symbol(i2_nc_p1, Decl(commentsInheritance.ts, 118, 22)) +>i2_nc_p1 : Symbol(i2.i2_nc_p1, Decl(commentsInheritance.ts, 118, 22)) i2_nc_f1(): void; ->i2_nc_f1 : Symbol(i2_nc_f1, Decl(commentsInheritance.ts, 120, 21)) +>i2_nc_f1 : Symbol(i2.i2_nc_f1, Decl(commentsInheritance.ts, 120, 21)) i2_nc_l1: () => void; ->i2_nc_l1 : Symbol(i2_nc_l1, Decl(commentsInheritance.ts, 121, 21)) +>i2_nc_l1 : Symbol(i2.i2_nc_l1, Decl(commentsInheritance.ts, 121, 21)) /** i2 p1*/ p1: number; ->p1 : Symbol(p1, Decl(commentsInheritance.ts, 122, 25)) +>p1 : Symbol(i2.p1, Decl(commentsInheritance.ts, 122, 25)) /** i2 f1*/ f1(): void; ->f1 : Symbol(f1, Decl(commentsInheritance.ts, 124, 15)) +>f1 : Symbol(i2.f1, Decl(commentsInheritance.ts, 124, 15)) /** i2 l1*/ l1: () => void; ->l1 : Symbol(l1, Decl(commentsInheritance.ts, 126, 15)) +>l1 : Symbol(i2.l1, Decl(commentsInheritance.ts, 126, 15)) nc_p1: number; ->nc_p1 : Symbol(nc_p1, Decl(commentsInheritance.ts, 128, 19)) +>nc_p1 : Symbol(i2.nc_p1, Decl(commentsInheritance.ts, 128, 19)) nc_f1(): void; ->nc_f1 : Symbol(nc_f1, Decl(commentsInheritance.ts, 129, 18)) +>nc_f1 : Symbol(i2.nc_f1, Decl(commentsInheritance.ts, 129, 18)) nc_l1: () => void; ->nc_l1 : Symbol(nc_l1, Decl(commentsInheritance.ts, 130, 18)) +>nc_l1 : Symbol(i2.nc_l1, Decl(commentsInheritance.ts, 130, 18)) } interface i3 extends i2 { >i3 : Symbol(i3, Decl(commentsInheritance.ts, 132, 1)) @@ -275,26 +275,26 @@ interface i3 extends i2 { /** i3 p1 */ p1: number; ->p1 : Symbol(p1, Decl(commentsInheritance.ts, 133, 25)) +>p1 : Symbol(i3.p1, Decl(commentsInheritance.ts, 133, 25)) /** * i3 f1 */ f1(): void; ->f1 : Symbol(f1, Decl(commentsInheritance.ts, 135, 15)) +>f1 : Symbol(i3.f1, Decl(commentsInheritance.ts, 135, 15)) /** i3 l1*/ l1: () => void; ->l1 : Symbol(l1, Decl(commentsInheritance.ts, 139, 15)) +>l1 : Symbol(i3.l1, Decl(commentsInheritance.ts, 139, 15)) nc_p1: number; ->nc_p1 : Symbol(nc_p1, Decl(commentsInheritance.ts, 141, 19)) +>nc_p1 : Symbol(i3.nc_p1, Decl(commentsInheritance.ts, 141, 19)) nc_f1(): void; ->nc_f1 : Symbol(nc_f1, Decl(commentsInheritance.ts, 142, 18)) +>nc_f1 : Symbol(i3.nc_f1, Decl(commentsInheritance.ts, 142, 18)) nc_l1: () => void; ->nc_l1 : Symbol(nc_l1, Decl(commentsInheritance.ts, 143, 18)) +>nc_l1 : Symbol(i3.nc_l1, Decl(commentsInheritance.ts, 143, 18)) } var i2_i: i2; >i2_i : Symbol(i2_i, Decl(commentsInheritance.ts, 146, 3)) diff --git a/tests/baselines/reference/commentsInterface.symbols b/tests/baselines/reference/commentsInterface.symbols index 78d89989ed1..6e3a9e27978 100644 --- a/tests/baselines/reference/commentsInterface.symbols +++ b/tests/baselines/reference/commentsInterface.symbols @@ -20,11 +20,11 @@ interface i2 { /** this is x*/ x: number; ->x : Symbol(x, Decl(commentsInterface.ts, 8, 14)) +>x : Symbol(i2.x, Decl(commentsInterface.ts, 8, 14)) /** this is foo*/ foo: (/**param help*/b: number) => string; ->foo : Symbol(foo, Decl(commentsInterface.ts, 10, 14)) +>foo : Symbol(i2.foo, Decl(commentsInterface.ts, 10, 14)) >b : Symbol(b, Decl(commentsInterface.ts, 12, 10)) /** this is indexer*/ @@ -37,10 +37,10 @@ interface i2 { >i1 : Symbol(i1, Decl(commentsInterface.ts, 0, 0)) nc_x: number; ->nc_x : Symbol(nc_x, Decl(commentsInterface.ts, 16, 27)) +>nc_x : Symbol(i2.nc_x, Decl(commentsInterface.ts, 16, 27)) nc_foo: (b: number) => string; ->nc_foo : Symbol(nc_foo, Decl(commentsInterface.ts, 17, 17)) +>nc_foo : Symbol(i2.nc_foo, Decl(commentsInterface.ts, 17, 17)) >b : Symbol(b, Decl(commentsInterface.ts, 18, 13)) [i: number]: number; @@ -53,16 +53,16 @@ interface i2 { /** this is fnfoo*/ fnfoo(/**param help*/b: number): string; ->fnfoo : Symbol(fnfoo, Decl(commentsInterface.ts, 21, 68)) +>fnfoo : Symbol(i2.fnfoo, Decl(commentsInterface.ts, 21, 68)) >b : Symbol(b, Decl(commentsInterface.ts, 23, 10)) nc_fnfoo(b: number): string; ->nc_fnfoo : Symbol(nc_fnfoo, Decl(commentsInterface.ts, 23, 44)) +>nc_fnfoo : Symbol(i2.nc_fnfoo, Decl(commentsInterface.ts, 23, 44)) >b : Symbol(b, Decl(commentsInterface.ts, 24, 13)) // nc_y nc_y: number; ->nc_y : Symbol(nc_y, Decl(commentsInterface.ts, 24, 32)) +>nc_y : Symbol(i2.nc_y, Decl(commentsInterface.ts, 24, 32)) } var i2_i: i2; >i2_i : Symbol(i2_i, Decl(commentsInterface.ts, 28, 3)) @@ -150,27 +150,27 @@ interface i3 { /** Comment i3 x*/ x: number; ->x : Symbol(x, Decl(commentsInterface.ts, 43, 14)) +>x : Symbol(i3.x, Decl(commentsInterface.ts, 43, 14)) /** Function i3 f*/ f(/**number parameter*/a: number): string; ->f : Symbol(f, Decl(commentsInterface.ts, 45, 14)) +>f : Symbol(i3.f, Decl(commentsInterface.ts, 45, 14)) >a : Symbol(a, Decl(commentsInterface.ts, 47, 6)) /** i3 l*/ l: (/**comment i3 l b*/b: number) => string; ->l : Symbol(l, Decl(commentsInterface.ts, 47, 46)) +>l : Symbol(i3.l, Decl(commentsInterface.ts, 47, 46)) >b : Symbol(b, Decl(commentsInterface.ts, 49, 8)) nc_x: number; ->nc_x : Symbol(nc_x, Decl(commentsInterface.ts, 49, 48)) +>nc_x : Symbol(i3.nc_x, Decl(commentsInterface.ts, 49, 48)) nc_f(a: number): string; ->nc_f : Symbol(nc_f, Decl(commentsInterface.ts, 50, 17)) +>nc_f : Symbol(i3.nc_f, Decl(commentsInterface.ts, 50, 17)) >a : Symbol(a, Decl(commentsInterface.ts, 51, 9)) nc_l: (b: number) => string; ->nc_l : Symbol(nc_l, Decl(commentsInterface.ts, 51, 28)) +>nc_l : Symbol(i3.nc_l, Decl(commentsInterface.ts, 51, 28)) >b : Symbol(b, Decl(commentsInterface.ts, 52, 11)) } var i3_i: i3; diff --git a/tests/baselines/reference/commentsOnObjectLiteral4.js b/tests/baselines/reference/commentsOnObjectLiteral4.js index 3b7efefdff4..23e238b8307 100644 --- a/tests/baselines/reference/commentsOnObjectLiteral4.js +++ b/tests/baselines/reference/commentsOnObjectLiteral4.js @@ -5,9 +5,10 @@ var v = { * @type {number} */ get bar(): number { - return this._bar; + return 12; } -} +} + //// [commentsOnObjectLiteral4.js] var v = { @@ -15,6 +16,6 @@ var v = { * @type {number} */ get bar() { - return this._bar; + return 12; } }; diff --git a/tests/baselines/reference/commentsOnObjectLiteral4.symbols b/tests/baselines/reference/commentsOnObjectLiteral4.symbols index c1762cb75c8..568d6332126 100644 --- a/tests/baselines/reference/commentsOnObjectLiteral4.symbols +++ b/tests/baselines/reference/commentsOnObjectLiteral4.symbols @@ -9,6 +9,7 @@ var v = { get bar(): number { >bar : Symbol(bar, Decl(commentsOnObjectLiteral4.ts, 1, 9)) - return this._bar; + return 12; } } + diff --git a/tests/baselines/reference/commentsOnObjectLiteral4.types b/tests/baselines/reference/commentsOnObjectLiteral4.types index 364df6e5ea1..5d20d4f79cc 100644 --- a/tests/baselines/reference/commentsOnObjectLiteral4.types +++ b/tests/baselines/reference/commentsOnObjectLiteral4.types @@ -1,8 +1,8 @@ === tests/cases/compiler/commentsOnObjectLiteral4.ts === var v = { ->v : { bar: number; } ->{ /** * @type {number} */ get bar(): number { return this._bar; }} : { bar: number; } +>v : { readonly bar: number; } +>{ /** * @type {number} */ get bar(): number { return 12; }} : { readonly bar: number; } /** * @type {number} @@ -10,9 +10,8 @@ var v = { get bar(): number { >bar : number - return this._bar; ->this._bar : any ->this : any ->_bar : any + return 12; +>12 : number } } + diff --git a/tests/baselines/reference/commentsOverloads.symbols b/tests/baselines/reference/commentsOverloads.symbols index b504e35c5ac..bcdcc32f4c3 100644 --- a/tests/baselines/reference/commentsOverloads.symbols +++ b/tests/baselines/reference/commentsOverloads.symbols @@ -97,53 +97,53 @@ interface i1 { /** foo 1*/ foo(a: number): number; ->foo : Symbol(foo, Decl(commentsOverloads.ts, 37, 24), Decl(commentsOverloads.ts, 39, 27), Decl(commentsOverloads.ts, 41, 27), Decl(commentsOverloads.ts, 43, 31)) +>foo : Symbol(i1.foo, Decl(commentsOverloads.ts, 37, 24), Decl(commentsOverloads.ts, 39, 27), Decl(commentsOverloads.ts, 41, 27), Decl(commentsOverloads.ts, 43, 31)) >a : Symbol(a, Decl(commentsOverloads.ts, 39, 8)) /** foo 2*/ foo(b: string): number; ->foo : Symbol(foo, Decl(commentsOverloads.ts, 37, 24), Decl(commentsOverloads.ts, 39, 27), Decl(commentsOverloads.ts, 41, 27), Decl(commentsOverloads.ts, 43, 31)) +>foo : Symbol(i1.foo, Decl(commentsOverloads.ts, 37, 24), Decl(commentsOverloads.ts, 39, 27), Decl(commentsOverloads.ts, 41, 27), Decl(commentsOverloads.ts, 43, 31)) >b : Symbol(b, Decl(commentsOverloads.ts, 41, 8)) // foo 3 foo(arr: number[]): number; ->foo : Symbol(foo, Decl(commentsOverloads.ts, 37, 24), Decl(commentsOverloads.ts, 39, 27), Decl(commentsOverloads.ts, 41, 27), Decl(commentsOverloads.ts, 43, 31)) +>foo : Symbol(i1.foo, Decl(commentsOverloads.ts, 37, 24), Decl(commentsOverloads.ts, 39, 27), Decl(commentsOverloads.ts, 41, 27), Decl(commentsOverloads.ts, 43, 31)) >arr : Symbol(arr, Decl(commentsOverloads.ts, 43, 8)) /** foo 4 */ foo(arr: string[]): number; ->foo : Symbol(foo, Decl(commentsOverloads.ts, 37, 24), Decl(commentsOverloads.ts, 39, 27), Decl(commentsOverloads.ts, 41, 27), Decl(commentsOverloads.ts, 43, 31)) +>foo : Symbol(i1.foo, Decl(commentsOverloads.ts, 37, 24), Decl(commentsOverloads.ts, 39, 27), Decl(commentsOverloads.ts, 41, 27), Decl(commentsOverloads.ts, 43, 31)) >arr : Symbol(arr, Decl(commentsOverloads.ts, 45, 8)) foo2(a: number): number; ->foo2 : Symbol(foo2, Decl(commentsOverloads.ts, 45, 31), Decl(commentsOverloads.ts, 47, 28)) +>foo2 : Symbol(i1.foo2, Decl(commentsOverloads.ts, 45, 31), Decl(commentsOverloads.ts, 47, 28)) >a : Symbol(a, Decl(commentsOverloads.ts, 47, 9)) /** foo2 2*/ foo2(b: string): number; ->foo2 : Symbol(foo2, Decl(commentsOverloads.ts, 45, 31), Decl(commentsOverloads.ts, 47, 28)) +>foo2 : Symbol(i1.foo2, Decl(commentsOverloads.ts, 45, 31), Decl(commentsOverloads.ts, 47, 28)) >b : Symbol(b, Decl(commentsOverloads.ts, 49, 9)) foo3(a: number): number; ->foo3 : Symbol(foo3, Decl(commentsOverloads.ts, 49, 28), Decl(commentsOverloads.ts, 50, 28)) +>foo3 : Symbol(i1.foo3, Decl(commentsOverloads.ts, 49, 28), Decl(commentsOverloads.ts, 50, 28)) >a : Symbol(a, Decl(commentsOverloads.ts, 50, 9)) foo3(b: string): number; ->foo3 : Symbol(foo3, Decl(commentsOverloads.ts, 49, 28), Decl(commentsOverloads.ts, 50, 28)) +>foo3 : Symbol(i1.foo3, Decl(commentsOverloads.ts, 49, 28), Decl(commentsOverloads.ts, 50, 28)) >b : Symbol(b, Decl(commentsOverloads.ts, 51, 9)) /** foo4 1*/ foo4(a: number): number; ->foo4 : Symbol(foo4, Decl(commentsOverloads.ts, 51, 28), Decl(commentsOverloads.ts, 53, 28), Decl(commentsOverloads.ts, 54, 28)) +>foo4 : Symbol(i1.foo4, Decl(commentsOverloads.ts, 51, 28), Decl(commentsOverloads.ts, 53, 28), Decl(commentsOverloads.ts, 54, 28)) >a : Symbol(a, Decl(commentsOverloads.ts, 53, 9)) foo4(b: string): number; ->foo4 : Symbol(foo4, Decl(commentsOverloads.ts, 51, 28), Decl(commentsOverloads.ts, 53, 28), Decl(commentsOverloads.ts, 54, 28)) +>foo4 : Symbol(i1.foo4, Decl(commentsOverloads.ts, 51, 28), Decl(commentsOverloads.ts, 53, 28), Decl(commentsOverloads.ts, 54, 28)) >b : Symbol(b, Decl(commentsOverloads.ts, 54, 9)) /** foo4 any */ foo4(c: any): any; ->foo4 : Symbol(foo4, Decl(commentsOverloads.ts, 51, 28), Decl(commentsOverloads.ts, 53, 28), Decl(commentsOverloads.ts, 54, 28)) +>foo4 : Symbol(i1.foo4, Decl(commentsOverloads.ts, 51, 28), Decl(commentsOverloads.ts, 53, 28), Decl(commentsOverloads.ts, 54, 28)) >c : Symbol(c, Decl(commentsOverloads.ts, 56, 9)) /// new 1 @@ -220,78 +220,78 @@ class c { >c : Symbol(c, Decl(commentsOverloads.ts, 87, 1)) public prop1(a: number): number; ->prop1 : Symbol(prop1, Decl(commentsOverloads.ts, 88, 9), Decl(commentsOverloads.ts, 89, 36), Decl(commentsOverloads.ts, 90, 36)) +>prop1 : Symbol(c.prop1, Decl(commentsOverloads.ts, 88, 9), Decl(commentsOverloads.ts, 89, 36), Decl(commentsOverloads.ts, 90, 36)) >a : Symbol(a, Decl(commentsOverloads.ts, 89, 17)) public prop1(b: string): number; ->prop1 : Symbol(prop1, Decl(commentsOverloads.ts, 88, 9), Decl(commentsOverloads.ts, 89, 36), Decl(commentsOverloads.ts, 90, 36)) +>prop1 : Symbol(c.prop1, Decl(commentsOverloads.ts, 88, 9), Decl(commentsOverloads.ts, 89, 36), Decl(commentsOverloads.ts, 90, 36)) >b : Symbol(b, Decl(commentsOverloads.ts, 90, 17)) public prop1(aorb: any) { ->prop1 : Symbol(prop1, Decl(commentsOverloads.ts, 88, 9), Decl(commentsOverloads.ts, 89, 36), Decl(commentsOverloads.ts, 90, 36)) +>prop1 : Symbol(c.prop1, Decl(commentsOverloads.ts, 88, 9), Decl(commentsOverloads.ts, 89, 36), Decl(commentsOverloads.ts, 90, 36)) >aorb : Symbol(aorb, Decl(commentsOverloads.ts, 91, 17)) return 10; } /** prop2 1*/ public prop2(a: number): number; ->prop2 : Symbol(prop2, Decl(commentsOverloads.ts, 93, 5), Decl(commentsOverloads.ts, 95, 36), Decl(commentsOverloads.ts, 96, 36)) +>prop2 : Symbol(c.prop2, Decl(commentsOverloads.ts, 93, 5), Decl(commentsOverloads.ts, 95, 36), Decl(commentsOverloads.ts, 96, 36)) >a : Symbol(a, Decl(commentsOverloads.ts, 95, 17)) public prop2(b: string): number; ->prop2 : Symbol(prop2, Decl(commentsOverloads.ts, 93, 5), Decl(commentsOverloads.ts, 95, 36), Decl(commentsOverloads.ts, 96, 36)) +>prop2 : Symbol(c.prop2, Decl(commentsOverloads.ts, 93, 5), Decl(commentsOverloads.ts, 95, 36), Decl(commentsOverloads.ts, 96, 36)) >b : Symbol(b, Decl(commentsOverloads.ts, 96, 17)) public prop2(aorb: any) { ->prop2 : Symbol(prop2, Decl(commentsOverloads.ts, 93, 5), Decl(commentsOverloads.ts, 95, 36), Decl(commentsOverloads.ts, 96, 36)) +>prop2 : Symbol(c.prop2, Decl(commentsOverloads.ts, 93, 5), Decl(commentsOverloads.ts, 95, 36), Decl(commentsOverloads.ts, 96, 36)) >aorb : Symbol(aorb, Decl(commentsOverloads.ts, 97, 17)) return 10; } public prop3(a: number): number; ->prop3 : Symbol(prop3, Decl(commentsOverloads.ts, 99, 5), Decl(commentsOverloads.ts, 100, 36), Decl(commentsOverloads.ts, 102, 36)) +>prop3 : Symbol(c.prop3, Decl(commentsOverloads.ts, 99, 5), Decl(commentsOverloads.ts, 100, 36), Decl(commentsOverloads.ts, 102, 36)) >a : Symbol(a, Decl(commentsOverloads.ts, 100, 17)) /** prop3 2*/ public prop3(b: string): number; ->prop3 : Symbol(prop3, Decl(commentsOverloads.ts, 99, 5), Decl(commentsOverloads.ts, 100, 36), Decl(commentsOverloads.ts, 102, 36)) +>prop3 : Symbol(c.prop3, Decl(commentsOverloads.ts, 99, 5), Decl(commentsOverloads.ts, 100, 36), Decl(commentsOverloads.ts, 102, 36)) >b : Symbol(b, Decl(commentsOverloads.ts, 102, 17)) public prop3(aorb: any) { ->prop3 : Symbol(prop3, Decl(commentsOverloads.ts, 99, 5), Decl(commentsOverloads.ts, 100, 36), Decl(commentsOverloads.ts, 102, 36)) +>prop3 : Symbol(c.prop3, Decl(commentsOverloads.ts, 99, 5), Decl(commentsOverloads.ts, 100, 36), Decl(commentsOverloads.ts, 102, 36)) >aorb : Symbol(aorb, Decl(commentsOverloads.ts, 103, 17)) return 10; } /** prop4 1*/ public prop4(a: number): number; ->prop4 : Symbol(prop4, Decl(commentsOverloads.ts, 105, 5), Decl(commentsOverloads.ts, 107, 36), Decl(commentsOverloads.ts, 109, 36)) +>prop4 : Symbol(c.prop4, Decl(commentsOverloads.ts, 105, 5), Decl(commentsOverloads.ts, 107, 36), Decl(commentsOverloads.ts, 109, 36)) >a : Symbol(a, Decl(commentsOverloads.ts, 107, 17)) /** prop4 2*/ public prop4(b: string): number; ->prop4 : Symbol(prop4, Decl(commentsOverloads.ts, 105, 5), Decl(commentsOverloads.ts, 107, 36), Decl(commentsOverloads.ts, 109, 36)) +>prop4 : Symbol(c.prop4, Decl(commentsOverloads.ts, 105, 5), Decl(commentsOverloads.ts, 107, 36), Decl(commentsOverloads.ts, 109, 36)) >b : Symbol(b, Decl(commentsOverloads.ts, 109, 17)) public prop4(aorb: any) { ->prop4 : Symbol(prop4, Decl(commentsOverloads.ts, 105, 5), Decl(commentsOverloads.ts, 107, 36), Decl(commentsOverloads.ts, 109, 36)) +>prop4 : Symbol(c.prop4, Decl(commentsOverloads.ts, 105, 5), Decl(commentsOverloads.ts, 107, 36), Decl(commentsOverloads.ts, 109, 36)) >aorb : Symbol(aorb, Decl(commentsOverloads.ts, 110, 17)) return 10; } /** prop5 1*/ public prop5(a: number): number; ->prop5 : Symbol(prop5, Decl(commentsOverloads.ts, 112, 5), Decl(commentsOverloads.ts, 114, 36), Decl(commentsOverloads.ts, 116, 36)) +>prop5 : Symbol(c.prop5, Decl(commentsOverloads.ts, 112, 5), Decl(commentsOverloads.ts, 114, 36), Decl(commentsOverloads.ts, 116, 36)) >a : Symbol(a, Decl(commentsOverloads.ts, 114, 17)) /** prop5 2*/ public prop5(b: string): number; ->prop5 : Symbol(prop5, Decl(commentsOverloads.ts, 112, 5), Decl(commentsOverloads.ts, 114, 36), Decl(commentsOverloads.ts, 116, 36)) +>prop5 : Symbol(c.prop5, Decl(commentsOverloads.ts, 112, 5), Decl(commentsOverloads.ts, 114, 36), Decl(commentsOverloads.ts, 116, 36)) >b : Symbol(b, Decl(commentsOverloads.ts, 116, 17)) /** Prop5 implementaion*/ public prop5(aorb: any) { ->prop5 : Symbol(prop5, Decl(commentsOverloads.ts, 112, 5), Decl(commentsOverloads.ts, 114, 36), Decl(commentsOverloads.ts, 116, 36)) +>prop5 : Symbol(c.prop5, Decl(commentsOverloads.ts, 112, 5), Decl(commentsOverloads.ts, 114, 36), Decl(commentsOverloads.ts, 116, 36)) >aorb : Symbol(aorb, Decl(commentsOverloads.ts, 118, 17)) return 10; diff --git a/tests/baselines/reference/commentsTypeParameters.symbols b/tests/baselines/reference/commentsTypeParameters.symbols index 466ca3ff9a9..26041d6b44f 100644 --- a/tests/baselines/reference/commentsTypeParameters.symbols +++ b/tests/baselines/reference/commentsTypeParameters.symbols @@ -4,7 +4,7 @@ class C { >T : Symbol(T, Decl(commentsTypeParameters.ts, 0, 8)) method(a: U) { ->method : Symbol(method, Decl(commentsTypeParameters.ts, 0, 47)) +>method : Symbol(C.method, Decl(commentsTypeParameters.ts, 0, 47)) >U : Symbol(U, Decl(commentsTypeParameters.ts, 1, 11)) >T : Symbol(T, Decl(commentsTypeParameters.ts, 0, 8)) >a : Symbol(a, Decl(commentsTypeParameters.ts, 1, 66)) @@ -18,7 +18,7 @@ class C { } private privatemethod(a: U) { ->privatemethod : Symbol(privatemethod, Decl(commentsTypeParameters.ts, 4, 5)) +>privatemethod : Symbol(C.privatemethod, Decl(commentsTypeParameters.ts, 4, 5)) >U : Symbol(U, Decl(commentsTypeParameters.ts, 6, 26)) >T : Symbol(T, Decl(commentsTypeParameters.ts, 0, 8)) >a : Symbol(a, Decl(commentsTypeParameters.ts, 6, 81)) diff --git a/tests/baselines/reference/commentsdoNotEmitComments.symbols b/tests/baselines/reference/commentsdoNotEmitComments.symbols index a7ba4076d9d..01555496dce 100644 --- a/tests/baselines/reference/commentsdoNotEmitComments.symbols +++ b/tests/baselines/reference/commentsdoNotEmitComments.symbols @@ -30,53 +30,53 @@ class c { /** property comment */ public b = 10; ->b : Symbol(b, Decl(commentsdoNotEmitComments.ts, 17, 5)) +>b : Symbol(c.b, Decl(commentsdoNotEmitComments.ts, 17, 5)) /** function comment */ public myFoo() { ->myFoo : Symbol(myFoo, Decl(commentsdoNotEmitComments.ts, 20, 18)) +>myFoo : Symbol(c.myFoo, Decl(commentsdoNotEmitComments.ts, 20, 18)) return this.b; ->this.b : Symbol(b, Decl(commentsdoNotEmitComments.ts, 17, 5)) +>this.b : Symbol(c.b, Decl(commentsdoNotEmitComments.ts, 17, 5)) >this : Symbol(c, Decl(commentsdoNotEmitComments.ts, 11, 9)) ->b : Symbol(b, Decl(commentsdoNotEmitComments.ts, 17, 5)) +>b : Symbol(c.b, Decl(commentsdoNotEmitComments.ts, 17, 5)) } /** getter comment*/ public get prop1() { ->prop1 : Symbol(prop1, Decl(commentsdoNotEmitComments.ts, 25, 5), Decl(commentsdoNotEmitComments.ts, 30, 5)) +>prop1 : Symbol(c.prop1, Decl(commentsdoNotEmitComments.ts, 25, 5), Decl(commentsdoNotEmitComments.ts, 30, 5)) return this.b; ->this.b : Symbol(b, Decl(commentsdoNotEmitComments.ts, 17, 5)) +>this.b : Symbol(c.b, Decl(commentsdoNotEmitComments.ts, 17, 5)) >this : Symbol(c, Decl(commentsdoNotEmitComments.ts, 11, 9)) ->b : Symbol(b, Decl(commentsdoNotEmitComments.ts, 17, 5)) +>b : Symbol(c.b, Decl(commentsdoNotEmitComments.ts, 17, 5)) } /** setter comment*/ public set prop1(val: number) { ->prop1 : Symbol(prop1, Decl(commentsdoNotEmitComments.ts, 25, 5), Decl(commentsdoNotEmitComments.ts, 30, 5)) +>prop1 : Symbol(c.prop1, Decl(commentsdoNotEmitComments.ts, 25, 5), Decl(commentsdoNotEmitComments.ts, 30, 5)) >val : Symbol(val, Decl(commentsdoNotEmitComments.ts, 33, 21)) this.b = val; ->this.b : Symbol(b, Decl(commentsdoNotEmitComments.ts, 17, 5)) +>this.b : Symbol(c.b, Decl(commentsdoNotEmitComments.ts, 17, 5)) >this : Symbol(c, Decl(commentsdoNotEmitComments.ts, 11, 9)) ->b : Symbol(b, Decl(commentsdoNotEmitComments.ts, 17, 5)) +>b : Symbol(c.b, Decl(commentsdoNotEmitComments.ts, 17, 5)) >val : Symbol(val, Decl(commentsdoNotEmitComments.ts, 33, 21)) } /** overload signature1*/ public foo1(a: number): string; ->foo1 : Symbol(foo1, Decl(commentsdoNotEmitComments.ts, 35, 5), Decl(commentsdoNotEmitComments.ts, 38, 35), Decl(commentsdoNotEmitComments.ts, 40, 35)) +>foo1 : Symbol(c.foo1, Decl(commentsdoNotEmitComments.ts, 35, 5), Decl(commentsdoNotEmitComments.ts, 38, 35), Decl(commentsdoNotEmitComments.ts, 40, 35)) >a : Symbol(a, Decl(commentsdoNotEmitComments.ts, 38, 16)) /** Overload signature 2*/ public foo1(b: string): string; ->foo1 : Symbol(foo1, Decl(commentsdoNotEmitComments.ts, 35, 5), Decl(commentsdoNotEmitComments.ts, 38, 35), Decl(commentsdoNotEmitComments.ts, 40, 35)) +>foo1 : Symbol(c.foo1, Decl(commentsdoNotEmitComments.ts, 35, 5), Decl(commentsdoNotEmitComments.ts, 38, 35), Decl(commentsdoNotEmitComments.ts, 40, 35)) >b : Symbol(b, Decl(commentsdoNotEmitComments.ts, 40, 16)) /** overload implementation signature*/ public foo1(aOrb) { ->foo1 : Symbol(foo1, Decl(commentsdoNotEmitComments.ts, 35, 5), Decl(commentsdoNotEmitComments.ts, 38, 35), Decl(commentsdoNotEmitComments.ts, 40, 35)) +>foo1 : Symbol(c.foo1, Decl(commentsdoNotEmitComments.ts, 35, 5), Decl(commentsdoNotEmitComments.ts, 38, 35), Decl(commentsdoNotEmitComments.ts, 40, 35)) >aOrb : Symbol(aOrb, Decl(commentsdoNotEmitComments.ts, 42, 16)) return aOrb.toString(); @@ -107,12 +107,12 @@ interface i1 { /** function property;*/ myFoo(/*param prop*/a: number): string; ->myFoo : Symbol(myFoo, Decl(commentsdoNotEmitComments.ts, 59, 24)) +>myFoo : Symbol(i1.myFoo, Decl(commentsdoNotEmitComments.ts, 59, 24)) >a : Symbol(a, Decl(commentsdoNotEmitComments.ts, 62, 10)) /** prop*/ prop: string; ->prop : Symbol(prop, Decl(commentsdoNotEmitComments.ts, 62, 43)) +>prop : Symbol(i1.prop, Decl(commentsdoNotEmitComments.ts, 62, 43)) } /**interface instance comments*/ @@ -129,7 +129,7 @@ module m1 { >b : Symbol(b, Decl(commentsdoNotEmitComments.ts, 72, 11)) constructor(public x: number) { ->x : Symbol(x, Decl(commentsdoNotEmitComments.ts, 75, 20)) +>x : Symbol(b.x, Decl(commentsdoNotEmitComments.ts, 75, 20)) } } diff --git a/tests/baselines/reference/commentsemitComments.symbols b/tests/baselines/reference/commentsemitComments.symbols index 6c0683d5372..eec41dccec6 100644 --- a/tests/baselines/reference/commentsemitComments.symbols +++ b/tests/baselines/reference/commentsemitComments.symbols @@ -30,53 +30,53 @@ class c { /** property comment */ public b = 10; ->b : Symbol(b, Decl(commentsemitComments.ts, 17, 5)) +>b : Symbol(c.b, Decl(commentsemitComments.ts, 17, 5)) /** function comment */ public myFoo() { ->myFoo : Symbol(myFoo, Decl(commentsemitComments.ts, 20, 18)) +>myFoo : Symbol(c.myFoo, Decl(commentsemitComments.ts, 20, 18)) return this.b; ->this.b : Symbol(b, Decl(commentsemitComments.ts, 17, 5)) +>this.b : Symbol(c.b, Decl(commentsemitComments.ts, 17, 5)) >this : Symbol(c, Decl(commentsemitComments.ts, 11, 9)) ->b : Symbol(b, Decl(commentsemitComments.ts, 17, 5)) +>b : Symbol(c.b, Decl(commentsemitComments.ts, 17, 5)) } /** getter comment*/ public get prop1() { ->prop1 : Symbol(prop1, Decl(commentsemitComments.ts, 25, 5), Decl(commentsemitComments.ts, 30, 5)) +>prop1 : Symbol(c.prop1, Decl(commentsemitComments.ts, 25, 5), Decl(commentsemitComments.ts, 30, 5)) return this.b; ->this.b : Symbol(b, Decl(commentsemitComments.ts, 17, 5)) +>this.b : Symbol(c.b, Decl(commentsemitComments.ts, 17, 5)) >this : Symbol(c, Decl(commentsemitComments.ts, 11, 9)) ->b : Symbol(b, Decl(commentsemitComments.ts, 17, 5)) +>b : Symbol(c.b, Decl(commentsemitComments.ts, 17, 5)) } /** setter comment*/ public set prop1(val: number) { ->prop1 : Symbol(prop1, Decl(commentsemitComments.ts, 25, 5), Decl(commentsemitComments.ts, 30, 5)) +>prop1 : Symbol(c.prop1, Decl(commentsemitComments.ts, 25, 5), Decl(commentsemitComments.ts, 30, 5)) >val : Symbol(val, Decl(commentsemitComments.ts, 33, 21)) this.b = val; ->this.b : Symbol(b, Decl(commentsemitComments.ts, 17, 5)) +>this.b : Symbol(c.b, Decl(commentsemitComments.ts, 17, 5)) >this : Symbol(c, Decl(commentsemitComments.ts, 11, 9)) ->b : Symbol(b, Decl(commentsemitComments.ts, 17, 5)) +>b : Symbol(c.b, Decl(commentsemitComments.ts, 17, 5)) >val : Symbol(val, Decl(commentsemitComments.ts, 33, 21)) } /** overload signature1*/ public foo1(a: number): string; ->foo1 : Symbol(foo1, Decl(commentsemitComments.ts, 35, 5), Decl(commentsemitComments.ts, 38, 35), Decl(commentsemitComments.ts, 40, 35)) +>foo1 : Symbol(c.foo1, Decl(commentsemitComments.ts, 35, 5), Decl(commentsemitComments.ts, 38, 35), Decl(commentsemitComments.ts, 40, 35)) >a : Symbol(a, Decl(commentsemitComments.ts, 38, 16)) /** Overload signature 2*/ public foo1(b: string): string; ->foo1 : Symbol(foo1, Decl(commentsemitComments.ts, 35, 5), Decl(commentsemitComments.ts, 38, 35), Decl(commentsemitComments.ts, 40, 35)) +>foo1 : Symbol(c.foo1, Decl(commentsemitComments.ts, 35, 5), Decl(commentsemitComments.ts, 38, 35), Decl(commentsemitComments.ts, 40, 35)) >b : Symbol(b, Decl(commentsemitComments.ts, 40, 16)) /** overload implementation signature*/ public foo1(aOrb) { ->foo1 : Symbol(foo1, Decl(commentsemitComments.ts, 35, 5), Decl(commentsemitComments.ts, 38, 35), Decl(commentsemitComments.ts, 40, 35)) +>foo1 : Symbol(c.foo1, Decl(commentsemitComments.ts, 35, 5), Decl(commentsemitComments.ts, 38, 35), Decl(commentsemitComments.ts, 40, 35)) >aOrb : Symbol(aOrb, Decl(commentsemitComments.ts, 42, 16)) return aOrb.toString(); @@ -107,12 +107,12 @@ interface i1 { /** function property;*/ myFoo(/*param prop*/a: number): string; ->myFoo : Symbol(myFoo, Decl(commentsemitComments.ts, 59, 24)) +>myFoo : Symbol(i1.myFoo, Decl(commentsemitComments.ts, 59, 24)) >a : Symbol(a, Decl(commentsemitComments.ts, 62, 10)) /** prop*/ prop: string; ->prop : Symbol(prop, Decl(commentsemitComments.ts, 62, 43)) +>prop : Symbol(i1.prop, Decl(commentsemitComments.ts, 62, 43)) } /**interface instance comments*/ @@ -129,7 +129,7 @@ module m1 { >b : Symbol(b, Decl(commentsemitComments.ts, 72, 11)) constructor(public x: number) { ->x : Symbol(x, Decl(commentsemitComments.ts, 75, 20)) +>x : Symbol(b.x, Decl(commentsemitComments.ts, 75, 20)) } } diff --git a/tests/baselines/reference/commonJSImportAsPrimaryExpression.symbols b/tests/baselines/reference/commonJSImportAsPrimaryExpression.symbols index b640adc58a4..4871e7993fb 100644 --- a/tests/baselines/reference/commonJSImportAsPrimaryExpression.symbols +++ b/tests/baselines/reference/commonJSImportAsPrimaryExpression.symbols @@ -17,7 +17,7 @@ export class C1 { >C1 : Symbol(C1, Decl(foo_0.ts, 0, 0)) m1 = 42; ->m1 : Symbol(m1, Decl(foo_0.ts, 0, 17)) +>m1 : Symbol(C1.m1, Decl(foo_0.ts, 0, 17)) static s1 = true; >s1 : Symbol(C1.s1, Decl(foo_0.ts, 1, 9)) diff --git a/tests/baselines/reference/commonJSImportNotAsPrimaryExpression.symbols b/tests/baselines/reference/commonJSImportNotAsPrimaryExpression.symbols index 68a852c6165..ae67c0a3175 100644 --- a/tests/baselines/reference/commonJSImportNotAsPrimaryExpression.symbols +++ b/tests/baselines/reference/commonJSImportNotAsPrimaryExpression.symbols @@ -43,7 +43,7 @@ export class C1 { >C1 : Symbol(C1, Decl(foo_0.ts, 0, 0)) m1 = 42; ->m1 : Symbol(m1, Decl(foo_0.ts, 0, 17)) +>m1 : Symbol(C1.m1, Decl(foo_0.ts, 0, 17)) static s1 = true; >s1 : Symbol(C1.s1, Decl(foo_0.ts, 1, 9)) @@ -53,10 +53,10 @@ export interface I1 { >I1 : Symbol(I1, Decl(foo_0.ts, 3, 1)) name: string; ->name : Symbol(name, Decl(foo_0.ts, 5, 21)) +>name : Symbol(I1.name, Decl(foo_0.ts, 5, 21)) age: number; ->age : Symbol(age, Decl(foo_0.ts, 6, 14)) +>age : Symbol(I1.age, Decl(foo_0.ts, 6, 14)) } export module M1 { @@ -66,7 +66,7 @@ export module M1 { >I2 : Symbol(I2, Decl(foo_0.ts, 10, 18)) foo: string; ->foo : Symbol(foo, Decl(foo_0.ts, 11, 22)) +>foo : Symbol(I2.foo, Decl(foo_0.ts, 11, 22)) } } diff --git a/tests/baselines/reference/comparisonOperatorWithIdenticalObjects.symbols b/tests/baselines/reference/comparisonOperatorWithIdenticalObjects.symbols index a5acf69be2f..72b111d3540 100644 --- a/tests/baselines/reference/comparisonOperatorWithIdenticalObjects.symbols +++ b/tests/baselines/reference/comparisonOperatorWithIdenticalObjects.symbols @@ -3,23 +3,23 @@ class A1 { >A1 : Symbol(A1, Decl(comparisonOperatorWithIdenticalObjects.ts, 0, 0)) public a: string; ->a : Symbol(a, Decl(comparisonOperatorWithIdenticalObjects.ts, 0, 10)) +>a : Symbol(A1.a, Decl(comparisonOperatorWithIdenticalObjects.ts, 0, 10)) public b: number; ->b : Symbol(b, Decl(comparisonOperatorWithIdenticalObjects.ts, 1, 21)) +>b : Symbol(A1.b, Decl(comparisonOperatorWithIdenticalObjects.ts, 1, 21)) public c: boolean; ->c : Symbol(c, Decl(comparisonOperatorWithIdenticalObjects.ts, 2, 21)) +>c : Symbol(A1.c, Decl(comparisonOperatorWithIdenticalObjects.ts, 2, 21)) public d: any; ->d : Symbol(d, Decl(comparisonOperatorWithIdenticalObjects.ts, 3, 22)) +>d : Symbol(A1.d, Decl(comparisonOperatorWithIdenticalObjects.ts, 3, 22)) public e: Object; ->e : Symbol(e, Decl(comparisonOperatorWithIdenticalObjects.ts, 4, 18)) +>e : Symbol(A1.e, Decl(comparisonOperatorWithIdenticalObjects.ts, 4, 18)) >Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) public fn(a: string): string { ->fn : Symbol(fn, Decl(comparisonOperatorWithIdenticalObjects.ts, 5, 21)) +>fn : Symbol(A1.fn, Decl(comparisonOperatorWithIdenticalObjects.ts, 5, 21)) >a : Symbol(a, Decl(comparisonOperatorWithIdenticalObjects.ts, 6, 14)) return null; @@ -29,23 +29,23 @@ class B1 { >B1 : Symbol(B1, Decl(comparisonOperatorWithIdenticalObjects.ts, 9, 1)) public a: string; ->a : Symbol(a, Decl(comparisonOperatorWithIdenticalObjects.ts, 10, 10)) +>a : Symbol(B1.a, Decl(comparisonOperatorWithIdenticalObjects.ts, 10, 10)) public b: number; ->b : Symbol(b, Decl(comparisonOperatorWithIdenticalObjects.ts, 11, 21)) +>b : Symbol(B1.b, Decl(comparisonOperatorWithIdenticalObjects.ts, 11, 21)) public c: boolean; ->c : Symbol(c, Decl(comparisonOperatorWithIdenticalObjects.ts, 12, 21)) +>c : Symbol(B1.c, Decl(comparisonOperatorWithIdenticalObjects.ts, 12, 21)) public d: any; ->d : Symbol(d, Decl(comparisonOperatorWithIdenticalObjects.ts, 13, 22)) +>d : Symbol(B1.d, Decl(comparisonOperatorWithIdenticalObjects.ts, 13, 22)) public e: Object; ->e : Symbol(e, Decl(comparisonOperatorWithIdenticalObjects.ts, 14, 18)) +>e : Symbol(B1.e, Decl(comparisonOperatorWithIdenticalObjects.ts, 14, 18)) >Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) public fn(b: string): string { ->fn : Symbol(fn, Decl(comparisonOperatorWithIdenticalObjects.ts, 15, 21)) +>fn : Symbol(B1.fn, Decl(comparisonOperatorWithIdenticalObjects.ts, 15, 21)) >b : Symbol(b, Decl(comparisonOperatorWithIdenticalObjects.ts, 16, 14)) return null; @@ -56,10 +56,10 @@ class Base { >Base : Symbol(Base, Decl(comparisonOperatorWithIdenticalObjects.ts, 19, 1)) private a: string; ->a : Symbol(a, Decl(comparisonOperatorWithIdenticalObjects.ts, 21, 12)) +>a : Symbol(Base.a, Decl(comparisonOperatorWithIdenticalObjects.ts, 21, 12)) private fn(b: string): string { ->fn : Symbol(fn, Decl(comparisonOperatorWithIdenticalObjects.ts, 22, 22)) +>fn : Symbol(Base.fn, Decl(comparisonOperatorWithIdenticalObjects.ts, 22, 22)) >b : Symbol(b, Decl(comparisonOperatorWithIdenticalObjects.ts, 23, 15)) return null; @@ -75,12 +75,12 @@ class B2 extends Base { } interface A3 { f(a: number): string; } >A3 : Symbol(A3, Decl(comparisonOperatorWithIdenticalObjects.ts, 28, 25)) ->f : Symbol(f, Decl(comparisonOperatorWithIdenticalObjects.ts, 30, 14)) +>f : Symbol(A3.f, Decl(comparisonOperatorWithIdenticalObjects.ts, 30, 14)) >a : Symbol(a, Decl(comparisonOperatorWithIdenticalObjects.ts, 30, 17)) interface B3 { f(a: number): string; } >B3 : Symbol(B3, Decl(comparisonOperatorWithIdenticalObjects.ts, 30, 38)) ->f : Symbol(f, Decl(comparisonOperatorWithIdenticalObjects.ts, 31, 14)) +>f : Symbol(B3.f, Decl(comparisonOperatorWithIdenticalObjects.ts, 31, 14)) >a : Symbol(a, Decl(comparisonOperatorWithIdenticalObjects.ts, 31, 17)) interface A4 { new (a: string): A1; } diff --git a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.errors.txt b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.errors.txt index fe608b14379..2efaf2e5ae2 100644 --- a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.errors.txt +++ b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.errors.txt @@ -1,70 +1,54 @@ tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(26,12): error TS2365: Operator '<' cannot be applied to types '{ [a: string]: string; }' and '{ [b: string]: number; }'. tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(27,12): error TS2365: Operator '<' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: string]: C; }'. tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(28,12): error TS2365: Operator '<' cannot be applied to types '{ [index: number]: Base; }' and '{ [index: number]: C; }'. -tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(29,12): error TS2365: Operator '<' cannot be applied to types '{ [index: number]: Derived; }' and '{ [index: string]: Base; }'. tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(31,12): error TS2365: Operator '<' cannot be applied to types '{ [b: string]: number; }' and '{ [a: string]: string; }'. tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(32,12): error TS2365: Operator '<' cannot be applied to types '{ [index: string]: C; }' and '{ [index: string]: Base; }'. tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(33,12): error TS2365: Operator '<' cannot be applied to types '{ [index: number]: C; }' and '{ [index: number]: Base; }'. -tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(34,12): error TS2365: Operator '<' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: number]: Derived; }'. tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(37,12): error TS2365: Operator '>' cannot be applied to types '{ [a: string]: string; }' and '{ [b: string]: number; }'. tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(38,12): error TS2365: Operator '>' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: string]: C; }'. tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(39,12): error TS2365: Operator '>' cannot be applied to types '{ [index: number]: Base; }' and '{ [index: number]: C; }'. -tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(40,12): error TS2365: Operator '>' cannot be applied to types '{ [index: number]: Derived; }' and '{ [index: string]: Base; }'. tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(42,12): error TS2365: Operator '>' cannot be applied to types '{ [b: string]: number; }' and '{ [a: string]: string; }'. tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(43,12): error TS2365: Operator '>' cannot be applied to types '{ [index: string]: C; }' and '{ [index: string]: Base; }'. tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(44,12): error TS2365: Operator '>' cannot be applied to types '{ [index: number]: C; }' and '{ [index: number]: Base; }'. -tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(45,12): error TS2365: Operator '>' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: number]: Derived; }'. tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(48,12): error TS2365: Operator '<=' cannot be applied to types '{ [a: string]: string; }' and '{ [b: string]: number; }'. tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(49,12): error TS2365: Operator '<=' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: string]: C; }'. tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(50,12): error TS2365: Operator '<=' cannot be applied to types '{ [index: number]: Base; }' and '{ [index: number]: C; }'. -tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(51,12): error TS2365: Operator '<=' cannot be applied to types '{ [index: number]: Derived; }' and '{ [index: string]: Base; }'. tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(53,12): error TS2365: Operator '<=' cannot be applied to types '{ [b: string]: number; }' and '{ [a: string]: string; }'. tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(54,12): error TS2365: Operator '<=' cannot be applied to types '{ [index: string]: C; }' and '{ [index: string]: Base; }'. tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(55,12): error TS2365: Operator '<=' cannot be applied to types '{ [index: number]: C; }' and '{ [index: number]: Base; }'. -tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(56,12): error TS2365: Operator '<=' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: number]: Derived; }'. tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(59,12): error TS2365: Operator '>=' cannot be applied to types '{ [a: string]: string; }' and '{ [b: string]: number; }'. tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(60,12): error TS2365: Operator '>=' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: string]: C; }'. tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(61,12): error TS2365: Operator '>=' cannot be applied to types '{ [index: number]: Base; }' and '{ [index: number]: C; }'. -tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(62,12): error TS2365: Operator '>=' cannot be applied to types '{ [index: number]: Derived; }' and '{ [index: string]: Base; }'. tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(64,12): error TS2365: Operator '>=' cannot be applied to types '{ [b: string]: number; }' and '{ [a: string]: string; }'. tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(65,12): error TS2365: Operator '>=' cannot be applied to types '{ [index: string]: C; }' and '{ [index: string]: Base; }'. tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(66,12): error TS2365: Operator '>=' cannot be applied to types '{ [index: number]: C; }' and '{ [index: number]: Base; }'. -tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(67,12): error TS2365: Operator '>=' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: number]: Derived; }'. tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(70,12): error TS2365: Operator '==' cannot be applied to types '{ [a: string]: string; }' and '{ [b: string]: number; }'. tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(71,12): error TS2365: Operator '==' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: string]: C; }'. tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(72,12): error TS2365: Operator '==' cannot be applied to types '{ [index: number]: Base; }' and '{ [index: number]: C; }'. -tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(73,12): error TS2365: Operator '==' cannot be applied to types '{ [index: number]: Derived; }' and '{ [index: string]: Base; }'. tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(75,12): error TS2365: Operator '==' cannot be applied to types '{ [b: string]: number; }' and '{ [a: string]: string; }'. tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(76,12): error TS2365: Operator '==' cannot be applied to types '{ [index: string]: C; }' and '{ [index: string]: Base; }'. tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(77,12): error TS2365: Operator '==' cannot be applied to types '{ [index: number]: C; }' and '{ [index: number]: Base; }'. -tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(78,12): error TS2365: Operator '==' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: number]: Derived; }'. tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(81,12): error TS2365: Operator '!=' cannot be applied to types '{ [a: string]: string; }' and '{ [b: string]: number; }'. tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(82,12): error TS2365: Operator '!=' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: string]: C; }'. tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(83,12): error TS2365: Operator '!=' cannot be applied to types '{ [index: number]: Base; }' and '{ [index: number]: C; }'. -tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(84,12): error TS2365: Operator '!=' cannot be applied to types '{ [index: number]: Derived; }' and '{ [index: string]: Base; }'. tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(86,12): error TS2365: Operator '!=' cannot be applied to types '{ [b: string]: number; }' and '{ [a: string]: string; }'. tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(87,12): error TS2365: Operator '!=' cannot be applied to types '{ [index: string]: C; }' and '{ [index: string]: Base; }'. tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(88,12): error TS2365: Operator '!=' cannot be applied to types '{ [index: number]: C; }' and '{ [index: number]: Base; }'. -tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(89,12): error TS2365: Operator '!=' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: number]: Derived; }'. tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(92,12): error TS2365: Operator '===' cannot be applied to types '{ [a: string]: string; }' and '{ [b: string]: number; }'. tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(93,12): error TS2365: Operator '===' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: string]: C; }'. tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(94,12): error TS2365: Operator '===' cannot be applied to types '{ [index: number]: Base; }' and '{ [index: number]: C; }'. -tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(95,12): error TS2365: Operator '===' cannot be applied to types '{ [index: number]: Derived; }' and '{ [index: string]: Base; }'. tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(97,12): error TS2365: Operator '===' cannot be applied to types '{ [b: string]: number; }' and '{ [a: string]: string; }'. tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(98,12): error TS2365: Operator '===' cannot be applied to types '{ [index: string]: C; }' and '{ [index: string]: Base; }'. tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(99,12): error TS2365: Operator '===' cannot be applied to types '{ [index: number]: C; }' and '{ [index: number]: Base; }'. -tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(100,12): error TS2365: Operator '===' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: number]: Derived; }'. tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(103,12): error TS2365: Operator '!==' cannot be applied to types '{ [a: string]: string; }' and '{ [b: string]: number; }'. tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(104,12): error TS2365: Operator '!==' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: string]: C; }'. tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(105,12): error TS2365: Operator '!==' cannot be applied to types '{ [index: number]: Base; }' and '{ [index: number]: C; }'. -tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(106,12): error TS2365: Operator '!==' cannot be applied to types '{ [index: number]: Derived; }' and '{ [index: string]: Base; }'. tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(108,12): error TS2365: Operator '!==' cannot be applied to types '{ [b: string]: number; }' and '{ [a: string]: string; }'. tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(109,12): error TS2365: Operator '!==' cannot be applied to types '{ [index: string]: C; }' and '{ [index: string]: Base; }'. tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(110,12): error TS2365: Operator '!==' cannot be applied to types '{ [index: number]: C; }' and '{ [index: number]: Base; }'. -tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(111,12): error TS2365: Operator '!==' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: number]: Derived; }'. -==== tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts (64 errors) ==== +==== tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts (48 errors) ==== class Base { public a: string; } @@ -100,8 +84,6 @@ tests/cases/conformance/expressions/binaryOperators/comparisonOperator/compariso ~~~~~~~ !!! error TS2365: Operator '<' cannot be applied to types '{ [index: number]: Base; }' and '{ [index: number]: C; }'. var r1a4 = a4 < b4; - ~~~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '{ [index: number]: Derived; }' and '{ [index: string]: Base; }'. var r1b1 = b1 < a1; ~~~~~~~ @@ -113,8 +95,6 @@ tests/cases/conformance/expressions/binaryOperators/comparisonOperator/compariso ~~~~~~~ !!! error TS2365: Operator '<' cannot be applied to types '{ [index: number]: C; }' and '{ [index: number]: Base; }'. var r1b4 = b4 < a4; - ~~~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: number]: Derived; }'. // operator > var r2a1 = a1 > b1; @@ -127,8 +107,6 @@ tests/cases/conformance/expressions/binaryOperators/comparisonOperator/compariso ~~~~~~~ !!! error TS2365: Operator '>' cannot be applied to types '{ [index: number]: Base; }' and '{ [index: number]: C; }'. var r2a4 = a4 > b4; - ~~~~~~~ -!!! error TS2365: Operator '>' cannot be applied to types '{ [index: number]: Derived; }' and '{ [index: string]: Base; }'. var r2b1 = b1 > a1; ~~~~~~~ @@ -140,8 +118,6 @@ tests/cases/conformance/expressions/binaryOperators/comparisonOperator/compariso ~~~~~~~ !!! error TS2365: Operator '>' cannot be applied to types '{ [index: number]: C; }' and '{ [index: number]: Base; }'. var r2b4 = b4 > a4; - ~~~~~~~ -!!! error TS2365: Operator '>' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: number]: Derived; }'. // operator <= var r3a1 = a1 <= b1; @@ -154,8 +130,6 @@ tests/cases/conformance/expressions/binaryOperators/comparisonOperator/compariso ~~~~~~~~ !!! error TS2365: Operator '<=' cannot be applied to types '{ [index: number]: Base; }' and '{ [index: number]: C; }'. var r3a4 = a4 <= b4; - ~~~~~~~~ -!!! error TS2365: Operator '<=' cannot be applied to types '{ [index: number]: Derived; }' and '{ [index: string]: Base; }'. var r3b1 = b1 <= a1; ~~~~~~~~ @@ -167,8 +141,6 @@ tests/cases/conformance/expressions/binaryOperators/comparisonOperator/compariso ~~~~~~~~ !!! error TS2365: Operator '<=' cannot be applied to types '{ [index: number]: C; }' and '{ [index: number]: Base; }'. var r3b4 = b4 <= a4; - ~~~~~~~~ -!!! error TS2365: Operator '<=' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: number]: Derived; }'. // operator >= var r4a1 = a1 >= b1; @@ -181,8 +153,6 @@ tests/cases/conformance/expressions/binaryOperators/comparisonOperator/compariso ~~~~~~~~ !!! error TS2365: Operator '>=' cannot be applied to types '{ [index: number]: Base; }' and '{ [index: number]: C; }'. var r4a4 = a4 >= b4; - ~~~~~~~~ -!!! error TS2365: Operator '>=' cannot be applied to types '{ [index: number]: Derived; }' and '{ [index: string]: Base; }'. var r4b1 = b1 >= a1; ~~~~~~~~ @@ -194,8 +164,6 @@ tests/cases/conformance/expressions/binaryOperators/comparisonOperator/compariso ~~~~~~~~ !!! error TS2365: Operator '>=' cannot be applied to types '{ [index: number]: C; }' and '{ [index: number]: Base; }'. var r4b4 = b4 >= a4; - ~~~~~~~~ -!!! error TS2365: Operator '>=' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: number]: Derived; }'. // operator == var r5a1 = a1 == b1; @@ -208,8 +176,6 @@ tests/cases/conformance/expressions/binaryOperators/comparisonOperator/compariso ~~~~~~~~ !!! error TS2365: Operator '==' cannot be applied to types '{ [index: number]: Base; }' and '{ [index: number]: C; }'. var r5a4 = a4 == b4; - ~~~~~~~~ -!!! error TS2365: Operator '==' cannot be applied to types '{ [index: number]: Derived; }' and '{ [index: string]: Base; }'. var r5b1 = b1 == a1; ~~~~~~~~ @@ -221,8 +187,6 @@ tests/cases/conformance/expressions/binaryOperators/comparisonOperator/compariso ~~~~~~~~ !!! error TS2365: Operator '==' cannot be applied to types '{ [index: number]: C; }' and '{ [index: number]: Base; }'. var r5b4 = b4 == a4; - ~~~~~~~~ -!!! error TS2365: Operator '==' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: number]: Derived; }'. // operator != var r6a1 = a1 != b1; @@ -235,8 +199,6 @@ tests/cases/conformance/expressions/binaryOperators/comparisonOperator/compariso ~~~~~~~~ !!! error TS2365: Operator '!=' cannot be applied to types '{ [index: number]: Base; }' and '{ [index: number]: C; }'. var r6a4 = a4 != b4; - ~~~~~~~~ -!!! error TS2365: Operator '!=' cannot be applied to types '{ [index: number]: Derived; }' and '{ [index: string]: Base; }'. var r6b1 = b1 != a1; ~~~~~~~~ @@ -248,8 +210,6 @@ tests/cases/conformance/expressions/binaryOperators/comparisonOperator/compariso ~~~~~~~~ !!! error TS2365: Operator '!=' cannot be applied to types '{ [index: number]: C; }' and '{ [index: number]: Base; }'. var r6b4 = b4 != a4; - ~~~~~~~~ -!!! error TS2365: Operator '!=' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: number]: Derived; }'. // operator === var r7a1 = a1 === b1; @@ -262,8 +222,6 @@ tests/cases/conformance/expressions/binaryOperators/comparisonOperator/compariso ~~~~~~~~~ !!! error TS2365: Operator '===' cannot be applied to types '{ [index: number]: Base; }' and '{ [index: number]: C; }'. var r7a4 = a4 === b4; - ~~~~~~~~~ -!!! error TS2365: Operator '===' cannot be applied to types '{ [index: number]: Derived; }' and '{ [index: string]: Base; }'. var r7b1 = b1 === a1; ~~~~~~~~~ @@ -275,8 +233,6 @@ tests/cases/conformance/expressions/binaryOperators/comparisonOperator/compariso ~~~~~~~~~ !!! error TS2365: Operator '===' cannot be applied to types '{ [index: number]: C; }' and '{ [index: number]: Base; }'. var r7b4 = b4 === a4; - ~~~~~~~~~ -!!! error TS2365: Operator '===' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: number]: Derived; }'. // operator !== var r8a1 = a1 !== b1; @@ -289,8 +245,6 @@ tests/cases/conformance/expressions/binaryOperators/comparisonOperator/compariso ~~~~~~~~~ !!! error TS2365: Operator '!==' cannot be applied to types '{ [index: number]: Base; }' and '{ [index: number]: C; }'. var r8a4 = a4 !== b4; - ~~~~~~~~~ -!!! error TS2365: Operator '!==' cannot be applied to types '{ [index: number]: Derived; }' and '{ [index: string]: Base; }'. var r8b1 = b1 !== a1; ~~~~~~~~~ @@ -301,6 +255,4 @@ tests/cases/conformance/expressions/binaryOperators/comparisonOperator/compariso var r8b3 = b3 !== a3; ~~~~~~~~~ !!! error TS2365: Operator '!==' cannot be applied to types '{ [index: number]: C; }' and '{ [index: number]: Base; }'. - var r8b4 = b4 !== a4; - ~~~~~~~~~ -!!! error TS2365: Operator '!==' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: number]: Derived; }'. \ No newline at end of file + var r8b4 = b4 !== a4; \ No newline at end of file diff --git a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedCallSignature.symbols b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedCallSignature.symbols index ef92cdd676a..6dc1e9221f5 100644 --- a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedCallSignature.symbols +++ b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedCallSignature.symbols @@ -3,7 +3,7 @@ class Base { >Base : Symbol(Base, Decl(comparisonOperatorWithNoRelationshipObjectsOnInstantiatedCallSignature.ts, 0, 0)) public a: string; ->a : Symbol(a, Decl(comparisonOperatorWithNoRelationshipObjectsOnInstantiatedCallSignature.ts, 0, 12)) +>a : Symbol(Base.a, Decl(comparisonOperatorWithNoRelationshipObjectsOnInstantiatedCallSignature.ts, 0, 12)) } class Derived extends Base { @@ -11,14 +11,14 @@ class Derived extends Base { >Base : Symbol(Base, Decl(comparisonOperatorWithNoRelationshipObjectsOnInstantiatedCallSignature.ts, 0, 0)) public b: string; ->b : Symbol(b, Decl(comparisonOperatorWithNoRelationshipObjectsOnInstantiatedCallSignature.ts, 4, 28)) +>b : Symbol(Derived.b, Decl(comparisonOperatorWithNoRelationshipObjectsOnInstantiatedCallSignature.ts, 4, 28)) } class C { >C : Symbol(C, Decl(comparisonOperatorWithNoRelationshipObjectsOnInstantiatedCallSignature.ts, 6, 1)) public c: string; ->c : Symbol(c, Decl(comparisonOperatorWithNoRelationshipObjectsOnInstantiatedCallSignature.ts, 8, 9)) +>c : Symbol(C.c, Decl(comparisonOperatorWithNoRelationshipObjectsOnInstantiatedCallSignature.ts, 8, 9)) } var a1: { fn(x: T): T }; diff --git a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedConstructorSignature.symbols b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedConstructorSignature.symbols index 08b23dac50a..444e2a06689 100644 --- a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedConstructorSignature.symbols +++ b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedConstructorSignature.symbols @@ -3,7 +3,7 @@ class Base { >Base : Symbol(Base, Decl(comparisonOperatorWithNoRelationshipObjectsOnInstantiatedConstructorSignature.ts, 0, 0)) public a: string; ->a : Symbol(a, Decl(comparisonOperatorWithNoRelationshipObjectsOnInstantiatedConstructorSignature.ts, 0, 12)) +>a : Symbol(Base.a, Decl(comparisonOperatorWithNoRelationshipObjectsOnInstantiatedConstructorSignature.ts, 0, 12)) } class Derived extends Base { @@ -11,14 +11,14 @@ class Derived extends Base { >Base : Symbol(Base, Decl(comparisonOperatorWithNoRelationshipObjectsOnInstantiatedConstructorSignature.ts, 0, 0)) public b: string; ->b : Symbol(b, Decl(comparisonOperatorWithNoRelationshipObjectsOnInstantiatedConstructorSignature.ts, 4, 28)) +>b : Symbol(Derived.b, Decl(comparisonOperatorWithNoRelationshipObjectsOnInstantiatedConstructorSignature.ts, 4, 28)) } class C { >C : Symbol(C, Decl(comparisonOperatorWithNoRelationshipObjectsOnInstantiatedConstructorSignature.ts, 6, 1)) public c: string; ->c : Symbol(c, Decl(comparisonOperatorWithNoRelationshipObjectsOnInstantiatedConstructorSignature.ts, 8, 9)) +>c : Symbol(C.c, Decl(comparisonOperatorWithNoRelationshipObjectsOnInstantiatedConstructorSignature.ts, 8, 9)) } var a1: { new (x: T): T }; diff --git a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnCallSignature.symbols b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnCallSignature.symbols index b82a68af007..3d21bd632f2 100644 --- a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnCallSignature.symbols +++ b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnCallSignature.symbols @@ -3,7 +3,7 @@ class Base { >Base : Symbol(Base, Decl(comparisonOperatorWithSubtypeObjectOnCallSignature.ts, 0, 0)) public a: string; ->a : Symbol(a, Decl(comparisonOperatorWithSubtypeObjectOnCallSignature.ts, 0, 12)) +>a : Symbol(Base.a, Decl(comparisonOperatorWithSubtypeObjectOnCallSignature.ts, 0, 12)) } class Derived extends Base { @@ -11,7 +11,7 @@ class Derived extends Base { >Base : Symbol(Base, Decl(comparisonOperatorWithSubtypeObjectOnCallSignature.ts, 0, 0)) public b: string; ->b : Symbol(b, Decl(comparisonOperatorWithSubtypeObjectOnCallSignature.ts, 4, 28)) +>b : Symbol(Derived.b, Decl(comparisonOperatorWithSubtypeObjectOnCallSignature.ts, 4, 28)) } var a1: { fn(): void }; diff --git a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnConstructorSignature.symbols b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnConstructorSignature.symbols index 6dd08fc0529..02abd793abd 100644 --- a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnConstructorSignature.symbols +++ b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnConstructorSignature.symbols @@ -3,7 +3,7 @@ class Base { >Base : Symbol(Base, Decl(comparisonOperatorWithSubtypeObjectOnConstructorSignature.ts, 0, 0)) public a: string; ->a : Symbol(a, Decl(comparisonOperatorWithSubtypeObjectOnConstructorSignature.ts, 0, 12)) +>a : Symbol(Base.a, Decl(comparisonOperatorWithSubtypeObjectOnConstructorSignature.ts, 0, 12)) } class Derived extends Base { @@ -11,7 +11,7 @@ class Derived extends Base { >Base : Symbol(Base, Decl(comparisonOperatorWithSubtypeObjectOnConstructorSignature.ts, 0, 0)) public b: string; ->b : Symbol(b, Decl(comparisonOperatorWithSubtypeObjectOnConstructorSignature.ts, 4, 28)) +>b : Symbol(Derived.b, Decl(comparisonOperatorWithSubtypeObjectOnConstructorSignature.ts, 4, 28)) } var a1: { new (): Base }; diff --git a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnIndexSignature.symbols b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnIndexSignature.symbols index be0537baee4..18ed4369fd7 100644 --- a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnIndexSignature.symbols +++ b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnIndexSignature.symbols @@ -3,7 +3,7 @@ class Base { >Base : Symbol(Base, Decl(comparisonOperatorWithSubtypeObjectOnIndexSignature.ts, 0, 0)) public a: string; ->a : Symbol(a, Decl(comparisonOperatorWithSubtypeObjectOnIndexSignature.ts, 0, 12)) +>a : Symbol(Base.a, Decl(comparisonOperatorWithSubtypeObjectOnIndexSignature.ts, 0, 12)) } class Derived extends Base { @@ -11,7 +11,7 @@ class Derived extends Base { >Base : Symbol(Base, Decl(comparisonOperatorWithSubtypeObjectOnIndexSignature.ts, 0, 0)) public b: string; ->b : Symbol(b, Decl(comparisonOperatorWithSubtypeObjectOnIndexSignature.ts, 4, 28)) +>b : Symbol(Derived.b, Decl(comparisonOperatorWithSubtypeObjectOnIndexSignature.ts, 4, 28)) } var a1: { [a: string]: string }; diff --git a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.symbols b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.symbols index 635f926438f..742e8c9d4e6 100644 --- a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.symbols +++ b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.symbols @@ -3,7 +3,7 @@ class Base { >Base : Symbol(Base, Decl(comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.ts, 0, 0)) public a: string; ->a : Symbol(a, Decl(comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.ts, 0, 12)) +>a : Symbol(Base.a, Decl(comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.ts, 0, 12)) } class Derived extends Base { @@ -11,7 +11,7 @@ class Derived extends Base { >Base : Symbol(Base, Decl(comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.ts, 0, 0)) public b: string; ->b : Symbol(b, Decl(comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.ts, 4, 28)) +>b : Symbol(Derived.b, Decl(comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.ts, 4, 28)) } var a1: { fn(x: T): T }; diff --git a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.symbols b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.symbols index 11f28765873..ce49067a1a8 100644 --- a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.symbols +++ b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.symbols @@ -3,7 +3,7 @@ class Base { >Base : Symbol(Base, Decl(comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.ts, 0, 0)) public a: string; ->a : Symbol(a, Decl(comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.ts, 0, 12)) +>a : Symbol(Base.a, Decl(comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.ts, 0, 12)) } class Derived extends Base { @@ -11,7 +11,7 @@ class Derived extends Base { >Base : Symbol(Base, Decl(comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.ts, 0, 0)) public b: string; ->b : Symbol(b, Decl(comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.ts, 4, 28)) +>b : Symbol(Derived.b, Decl(comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.ts, 4, 28)) } var a1: { new (x: T): T }; diff --git a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnOptionalProperty.symbols b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnOptionalProperty.symbols index 6c6a3fa3ae2..fb85585852b 100644 --- a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnOptionalProperty.symbols +++ b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnOptionalProperty.symbols @@ -3,17 +3,17 @@ interface I { >I : Symbol(I, Decl(comparisonOperatorWithSubtypeObjectOnOptionalProperty.ts, 0, 0)) a: string; ->a : Symbol(a, Decl(comparisonOperatorWithSubtypeObjectOnOptionalProperty.ts, 0, 13)) +>a : Symbol(I.a, Decl(comparisonOperatorWithSubtypeObjectOnOptionalProperty.ts, 0, 13)) b?: number; ->b : Symbol(b, Decl(comparisonOperatorWithSubtypeObjectOnOptionalProperty.ts, 1, 14)) +>b : Symbol(I.b, Decl(comparisonOperatorWithSubtypeObjectOnOptionalProperty.ts, 1, 14)) } interface J { >J : Symbol(J, Decl(comparisonOperatorWithSubtypeObjectOnOptionalProperty.ts, 3, 1)) a: string; ->a : Symbol(a, Decl(comparisonOperatorWithSubtypeObjectOnOptionalProperty.ts, 5, 13)) +>a : Symbol(J.a, Decl(comparisonOperatorWithSubtypeObjectOnOptionalProperty.ts, 5, 13)) } var a: I; diff --git a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnProperty.symbols b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnProperty.symbols index 52d6e35d65e..96799744c00 100644 --- a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnProperty.symbols +++ b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnProperty.symbols @@ -3,7 +3,7 @@ class Base { >Base : Symbol(Base, Decl(comparisonOperatorWithSubtypeObjectOnProperty.ts, 0, 0)) public a: string; ->a : Symbol(a, Decl(comparisonOperatorWithSubtypeObjectOnProperty.ts, 0, 12)) +>a : Symbol(Base.a, Decl(comparisonOperatorWithSubtypeObjectOnProperty.ts, 0, 12)) } class Derived extends Base { @@ -11,18 +11,18 @@ class Derived extends Base { >Base : Symbol(Base, Decl(comparisonOperatorWithSubtypeObjectOnProperty.ts, 0, 0)) public b: string; ->b : Symbol(b, Decl(comparisonOperatorWithSubtypeObjectOnProperty.ts, 4, 28)) +>b : Symbol(Derived.b, Decl(comparisonOperatorWithSubtypeObjectOnProperty.ts, 4, 28)) } class A1 { >A1 : Symbol(A1, Decl(comparisonOperatorWithSubtypeObjectOnProperty.ts, 6, 1)) public a: Base; ->a : Symbol(a, Decl(comparisonOperatorWithSubtypeObjectOnProperty.ts, 8, 10)) +>a : Symbol(A1.a, Decl(comparisonOperatorWithSubtypeObjectOnProperty.ts, 8, 10)) >Base : Symbol(Base, Decl(comparisonOperatorWithSubtypeObjectOnProperty.ts, 0, 0)) public b: Base; ->b : Symbol(b, Decl(comparisonOperatorWithSubtypeObjectOnProperty.ts, 9, 19)) +>b : Symbol(A1.b, Decl(comparisonOperatorWithSubtypeObjectOnProperty.ts, 9, 19)) >Base : Symbol(Base, Decl(comparisonOperatorWithSubtypeObjectOnProperty.ts, 0, 0)) } @@ -30,11 +30,11 @@ class B1 { >B1 : Symbol(B1, Decl(comparisonOperatorWithSubtypeObjectOnProperty.ts, 11, 1)) public a: Base; ->a : Symbol(a, Decl(comparisonOperatorWithSubtypeObjectOnProperty.ts, 13, 10)) +>a : Symbol(B1.a, Decl(comparisonOperatorWithSubtypeObjectOnProperty.ts, 13, 10)) >Base : Symbol(Base, Decl(comparisonOperatorWithSubtypeObjectOnProperty.ts, 0, 0)) public b: Derived; ->b : Symbol(b, Decl(comparisonOperatorWithSubtypeObjectOnProperty.ts, 14, 19)) +>b : Symbol(B1.b, Decl(comparisonOperatorWithSubtypeObjectOnProperty.ts, 14, 19)) >Derived : Symbol(Derived, Decl(comparisonOperatorWithSubtypeObjectOnProperty.ts, 2, 1)) } @@ -42,7 +42,7 @@ class A2 { >A2 : Symbol(A2, Decl(comparisonOperatorWithSubtypeObjectOnProperty.ts, 16, 1)) private a; ->a : Symbol(a, Decl(comparisonOperatorWithSubtypeObjectOnProperty.ts, 18, 10)) +>a : Symbol(A2.a, Decl(comparisonOperatorWithSubtypeObjectOnProperty.ts, 18, 10)) } class B2 extends A2 { @@ -50,7 +50,7 @@ class B2 extends A2 { >A2 : Symbol(A2, Decl(comparisonOperatorWithSubtypeObjectOnProperty.ts, 16, 1)) private b; ->b : Symbol(b, Decl(comparisonOperatorWithSubtypeObjectOnProperty.ts, 22, 21)) +>b : Symbol(B2.b, Decl(comparisonOperatorWithSubtypeObjectOnProperty.ts, 22, 21)) } var a1: A1; diff --git a/tests/baselines/reference/compilerOptionsDeclarationAndNoEmit.symbols b/tests/baselines/reference/compilerOptionsDeclarationAndNoEmit.symbols new file mode 100644 index 00000000000..4448defa95e --- /dev/null +++ b/tests/baselines/reference/compilerOptionsDeclarationAndNoEmit.symbols @@ -0,0 +1,6 @@ +=== tests/cases/compiler/a.ts === + +class c { +>c : Symbol(c, Decl(a.ts, 0, 0)) +} + diff --git a/tests/baselines/reference/compilerOptionsDeclarationAndNoEmit.types b/tests/baselines/reference/compilerOptionsDeclarationAndNoEmit.types new file mode 100644 index 00000000000..6f5caf9d48b --- /dev/null +++ b/tests/baselines/reference/compilerOptionsDeclarationAndNoEmit.types @@ -0,0 +1,6 @@ +=== tests/cases/compiler/a.ts === + +class c { +>c : c +} + diff --git a/tests/baselines/reference/compilerOptionsOutAndNoEmit.symbols b/tests/baselines/reference/compilerOptionsOutAndNoEmit.symbols new file mode 100644 index 00000000000..4448defa95e --- /dev/null +++ b/tests/baselines/reference/compilerOptionsOutAndNoEmit.symbols @@ -0,0 +1,6 @@ +=== tests/cases/compiler/a.ts === + +class c { +>c : Symbol(c, Decl(a.ts, 0, 0)) +} + diff --git a/tests/baselines/reference/compilerOptionsOutAndNoEmit.types b/tests/baselines/reference/compilerOptionsOutAndNoEmit.types new file mode 100644 index 00000000000..6f5caf9d48b --- /dev/null +++ b/tests/baselines/reference/compilerOptionsOutAndNoEmit.types @@ -0,0 +1,6 @@ +=== tests/cases/compiler/a.ts === + +class c { +>c : c +} + diff --git a/tests/baselines/reference/compilerOptionsOutDirAndNoEmit.symbols b/tests/baselines/reference/compilerOptionsOutDirAndNoEmit.symbols new file mode 100644 index 00000000000..4448defa95e --- /dev/null +++ b/tests/baselines/reference/compilerOptionsOutDirAndNoEmit.symbols @@ -0,0 +1,6 @@ +=== tests/cases/compiler/a.ts === + +class c { +>c : Symbol(c, Decl(a.ts, 0, 0)) +} + diff --git a/tests/baselines/reference/compilerOptionsOutDirAndNoEmit.types b/tests/baselines/reference/compilerOptionsOutDirAndNoEmit.types new file mode 100644 index 00000000000..6f5caf9d48b --- /dev/null +++ b/tests/baselines/reference/compilerOptionsOutDirAndNoEmit.types @@ -0,0 +1,6 @@ +=== tests/cases/compiler/a.ts === + +class c { +>c : c +} + diff --git a/tests/baselines/reference/compilerOptionsOutFileAndNoEmit.symbols b/tests/baselines/reference/compilerOptionsOutFileAndNoEmit.symbols new file mode 100644 index 00000000000..4448defa95e --- /dev/null +++ b/tests/baselines/reference/compilerOptionsOutFileAndNoEmit.symbols @@ -0,0 +1,6 @@ +=== tests/cases/compiler/a.ts === + +class c { +>c : Symbol(c, Decl(a.ts, 0, 0)) +} + diff --git a/tests/baselines/reference/compilerOptionsOutFileAndNoEmit.types b/tests/baselines/reference/compilerOptionsOutFileAndNoEmit.types new file mode 100644 index 00000000000..6f5caf9d48b --- /dev/null +++ b/tests/baselines/reference/compilerOptionsOutFileAndNoEmit.types @@ -0,0 +1,6 @@ +=== tests/cases/compiler/a.ts === + +class c { +>c : c +} + diff --git a/tests/baselines/reference/complexClassRelationships.symbols b/tests/baselines/reference/complexClassRelationships.symbols index 533c5171cf8..9f6b3adf98d 100644 --- a/tests/baselines/reference/complexClassRelationships.symbols +++ b/tests/baselines/reference/complexClassRelationships.symbols @@ -37,7 +37,7 @@ class Base { >Base : Symbol(Base, Decl(complexClassRelationships.ts, 11, 1)) ownerCollection: BaseCollection; ->ownerCollection : Symbol(ownerCollection, Decl(complexClassRelationships.ts, 12, 12)) +>ownerCollection : Symbol(Base.ownerCollection, Decl(complexClassRelationships.ts, 12, 12)) >BaseCollection : Symbol(BaseCollection, Decl(complexClassRelationships.ts, 6, 1)) >Base : Symbol(Base, Decl(complexClassRelationships.ts, 11, 1)) } @@ -46,7 +46,7 @@ class Thing { >Thing : Symbol(Thing, Decl(complexClassRelationships.ts, 14, 1)) public get Components(): ComponentCollection { return null } ->Components : Symbol(Components, Decl(complexClassRelationships.ts, 16, 13)) +>Components : Symbol(Thing.Components, Decl(complexClassRelationships.ts, 16, 13)) >ComponentCollection : Symbol(ComponentCollection, Decl(complexClassRelationships.ts, 18, 1)) } @@ -70,22 +70,22 @@ class Foo { >Foo : Symbol(Foo, Decl(complexClassRelationships.ts, 24, 1)) public get prop1() { ->prop1 : Symbol(prop1, Decl(complexClassRelationships.ts, 26, 11)) +>prop1 : Symbol(Foo.prop1, Decl(complexClassRelationships.ts, 26, 11)) return new GenericType(this); >GenericType : Symbol(GenericType, Decl(complexClassRelationships.ts, 36, 1)) >this : Symbol(Foo, Decl(complexClassRelationships.ts, 24, 1)) } public populate() { ->populate : Symbol(populate, Decl(complexClassRelationships.ts, 29, 5)) +>populate : Symbol(Foo.populate, Decl(complexClassRelationships.ts, 29, 5)) this.prop2; ->this.prop2 : Symbol(prop2, Decl(complexClassRelationships.ts, 32, 5)) +>this.prop2 : Symbol(Foo.prop2, Decl(complexClassRelationships.ts, 32, 5)) >this : Symbol(Foo, Decl(complexClassRelationships.ts, 24, 1)) ->prop2 : Symbol(prop2, Decl(complexClassRelationships.ts, 32, 5)) +>prop2 : Symbol(Foo.prop2, Decl(complexClassRelationships.ts, 32, 5)) } public get prop2(): BaseCollection { ->prop2 : Symbol(prop2, Decl(complexClassRelationships.ts, 32, 5)) +>prop2 : Symbol(Foo.prop2, Decl(complexClassRelationships.ts, 32, 5)) >BaseCollection : Symbol(BaseCollection, Decl(complexClassRelationships.ts, 6, 1)) >Derived : Symbol(Derived, Decl(complexClassRelationships.ts, 0, 0)) @@ -111,7 +111,7 @@ class FooBase { >FooBase : Symbol(FooBase, Decl(complexClassRelationships.ts, 40, 1)) public populate() { ->populate : Symbol(populate, Decl(complexClassRelationships.ts, 42, 15)) +>populate : Symbol(FooBase.populate, Decl(complexClassRelationships.ts, 42, 15)) } } diff --git a/tests/baselines/reference/compoundAdditionAssignmentLHSCanBeAssigned.types b/tests/baselines/reference/compoundAdditionAssignmentLHSCanBeAssigned.types index 92835611c6d..e40422450b4 100644 --- a/tests/baselines/reference/compoundAdditionAssignmentLHSCanBeAssigned.types +++ b/tests/baselines/reference/compoundAdditionAssignmentLHSCanBeAssigned.types @@ -98,7 +98,7 @@ x2 += E.a; x2 += {}; >x2 += {} : string >x2 : string ->{} : { [x: number]: undefined; } +>{} : {} x2 += null; >x2 += null : string diff --git a/tests/baselines/reference/compoundAdditionAssignmentLHSCannotBeAssigned.errors.txt b/tests/baselines/reference/compoundAdditionAssignmentLHSCannotBeAssigned.errors.txt index 535e4eb1a30..6bbebeb6ec7 100644 --- a/tests/baselines/reference/compoundAdditionAssignmentLHSCannotBeAssigned.errors.txt +++ b/tests/baselines/reference/compoundAdditionAssignmentLHSCannotBeAssigned.errors.txt @@ -2,7 +2,6 @@ tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmen tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentLHSCannotBeAssigned.ts(8,1): error TS2322: Type 'string' is not assignable to type 'number'. tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentLHSCannotBeAssigned.ts(11,1): error TS2322: Type 'string' is not assignable to type 'E'. tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentLHSCannotBeAssigned.ts(14,1): error TS2322: Type 'string' is not assignable to type '{ a: string; }'. - Property 'a' is missing in type 'String'. tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentLHSCannotBeAssigned.ts(17,1): error TS2322: Type 'string' is not assignable to type 'void'. @@ -29,7 +28,6 @@ tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmen x4 += ''; ~~ !!! error TS2322: Type 'string' is not assignable to type '{ a: string; }'. -!!! error TS2322: Property 'a' is missing in type 'String'. var x5: void; x5 += ''; diff --git a/tests/baselines/reference/computedPropertyNames10_ES5.symbols b/tests/baselines/reference/computedPropertyNames10_ES5.symbols index 17d1f7ca117..7f872b2abf0 100644 --- a/tests/baselines/reference/computedPropertyNames10_ES5.symbols +++ b/tests/baselines/reference/computedPropertyNames10_ES5.symbols @@ -29,7 +29,11 @@ var v = { >s : Symbol(s, Decl(computedPropertyNames10_ES5.ts, 0, 3)) [""]() { }, +>"" : Symbol([""], Decl(computedPropertyNames10_ES5.ts, 8, 15)) + [0]() { }, +>0 : Symbol([0], Decl(computedPropertyNames10_ES5.ts, 9, 15)) + [a]() { }, >a : Symbol(a, Decl(computedPropertyNames10_ES5.ts, 2, 3)) diff --git a/tests/baselines/reference/computedPropertyNames10_ES5.types b/tests/baselines/reference/computedPropertyNames10_ES5.types index 9dea9cfca93..b9d999397ab 100644 --- a/tests/baselines/reference/computedPropertyNames10_ES5.types +++ b/tests/baselines/reference/computedPropertyNames10_ES5.types @@ -9,8 +9,8 @@ var a: any; >a : any var v = { ->v : { [0](): void; [""](): void; } ->{ [s]() { }, [n]() { }, [s + s]() { }, [s + n]() { }, [+s]() { }, [""]() { }, [0]() { }, [a]() { }, [true]() { }, [`hello bye`]() { }, [`hello ${a} bye`]() { }} : { [0](): void; [""](): void; } +>v : { [x: string]: () => void; [x: number]: () => void; [0](): void; [""](): void; } +>{ [s]() { }, [n]() { }, [s + s]() { }, [s + n]() { }, [+s]() { }, [""]() { }, [0]() { }, [a]() { }, [true]() { }, [`hello bye`]() { }, [`hello ${a} bye`]() { }} : { [x: string]: () => void; [x: number]: () => void; [0](): void; [""](): void; } [s]() { }, >s : string diff --git a/tests/baselines/reference/computedPropertyNames10_ES6.symbols b/tests/baselines/reference/computedPropertyNames10_ES6.symbols index 4141b787208..5912c3f6941 100644 --- a/tests/baselines/reference/computedPropertyNames10_ES6.symbols +++ b/tests/baselines/reference/computedPropertyNames10_ES6.symbols @@ -29,7 +29,11 @@ var v = { >s : Symbol(s, Decl(computedPropertyNames10_ES6.ts, 0, 3)) [""]() { }, +>"" : Symbol([""], Decl(computedPropertyNames10_ES6.ts, 8, 15)) + [0]() { }, +>0 : Symbol([0], Decl(computedPropertyNames10_ES6.ts, 9, 15)) + [a]() { }, >a : Symbol(a, Decl(computedPropertyNames10_ES6.ts, 2, 3)) diff --git a/tests/baselines/reference/computedPropertyNames10_ES6.types b/tests/baselines/reference/computedPropertyNames10_ES6.types index d2faa138980..1883febb39b 100644 --- a/tests/baselines/reference/computedPropertyNames10_ES6.types +++ b/tests/baselines/reference/computedPropertyNames10_ES6.types @@ -9,8 +9,8 @@ var a: any; >a : any var v = { ->v : { [0](): void; [""](): void; } ->{ [s]() { }, [n]() { }, [s + s]() { }, [s + n]() { }, [+s]() { }, [""]() { }, [0]() { }, [a]() { }, [true]() { }, [`hello bye`]() { }, [`hello ${a} bye`]() { }} : { [0](): void; [""](): void; } +>v : { [x: string]: () => void; [x: number]: () => void; [0](): void; [""](): void; } +>{ [s]() { }, [n]() { }, [s + s]() { }, [s + n]() { }, [+s]() { }, [""]() { }, [0]() { }, [a]() { }, [true]() { }, [`hello bye`]() { }, [`hello ${a} bye`]() { }} : { [x: string]: () => void; [x: number]: () => void; [0](): void; [""](): void; } [s]() { }, >s : string diff --git a/tests/baselines/reference/computedPropertyNames11_ES5.js b/tests/baselines/reference/computedPropertyNames11_ES5.js index 0917f824770..64c0b0bd67e 100644 --- a/tests/baselines/reference/computedPropertyNames11_ES5.js +++ b/tests/baselines/reference/computedPropertyNames11_ES5.js @@ -46,8 +46,16 @@ var v = (_a = {}, enumerable: true, configurable: true }), - , - , + Object.defineProperty(_a, "", { + set: function (v) { }, + enumerable: true, + configurable: true + }), + Object.defineProperty(_a, 0, { + get: function () { return 0; }, + enumerable: true, + configurable: true + }), Object.defineProperty(_a, a, { set: function (v) { }, enumerable: true, diff --git a/tests/baselines/reference/computedPropertyNames11_ES5.symbols b/tests/baselines/reference/computedPropertyNames11_ES5.symbols index 34326273e59..f508047a864 100644 --- a/tests/baselines/reference/computedPropertyNames11_ES5.symbols +++ b/tests/baselines/reference/computedPropertyNames11_ES5.symbols @@ -31,9 +31,12 @@ var v = { >s : Symbol(s, Decl(computedPropertyNames11_ES5.ts, 0, 3)) set [""](v) { }, +>"" : Symbol([""], Decl(computedPropertyNames11_ES5.ts, 8, 29)) >v : Symbol(v, Decl(computedPropertyNames11_ES5.ts, 9, 13)) get [0]() { return 0; }, +>0 : Symbol([0], Decl(computedPropertyNames11_ES5.ts, 9, 20)) + set [a](v) { }, >a : Symbol(a, Decl(computedPropertyNames11_ES5.ts, 2, 3)) >v : Symbol(v, Decl(computedPropertyNames11_ES5.ts, 11, 12)) diff --git a/tests/baselines/reference/computedPropertyNames11_ES5.types b/tests/baselines/reference/computedPropertyNames11_ES5.types index e0787fc3ee7..e15b46cc6c1 100644 --- a/tests/baselines/reference/computedPropertyNames11_ES5.types +++ b/tests/baselines/reference/computedPropertyNames11_ES5.types @@ -9,8 +9,8 @@ var a: any; >a : any var v = { ->v : { [0]: number; [""]: any; } ->{ get [s]() { return 0; }, set [n](v) { }, get [s + s]() { return 0; }, set [s + n](v) { }, get [+s]() { return 0; }, set [""](v) { }, get [0]() { return 0; }, set [a](v) { }, get [true]() { return 0; }, set [`hello bye`](v) { }, get [`hello ${a} bye`]() { return 0; }} : { [0]: number; [""]: any; } +>v : { [x: string]: any; [x: number]: any; readonly [0]: number; [""]: any; } +>{ get [s]() { return 0; }, set [n](v) { }, get [s + s]() { return 0; }, set [s + n](v) { }, get [+s]() { return 0; }, set [""](v) { }, get [0]() { return 0; }, set [a](v) { }, get [true]() { return 0; }, set [`hello bye`](v) { }, get [`hello ${a} bye`]() { return 0; }} : { [x: string]: any; [x: number]: any; readonly [0]: number; [""]: any; } get [s]() { return 0; }, >s : string diff --git a/tests/baselines/reference/computedPropertyNames11_ES6.symbols b/tests/baselines/reference/computedPropertyNames11_ES6.symbols index 73503eb2758..8ffce9989c0 100644 --- a/tests/baselines/reference/computedPropertyNames11_ES6.symbols +++ b/tests/baselines/reference/computedPropertyNames11_ES6.symbols @@ -31,9 +31,12 @@ var v = { >s : Symbol(s, Decl(computedPropertyNames11_ES6.ts, 0, 3)) set [""](v) { }, +>"" : Symbol([""], Decl(computedPropertyNames11_ES6.ts, 8, 29)) >v : Symbol(v, Decl(computedPropertyNames11_ES6.ts, 9, 13)) get [0]() { return 0; }, +>0 : Symbol([0], Decl(computedPropertyNames11_ES6.ts, 9, 20)) + set [a](v) { }, >a : Symbol(a, Decl(computedPropertyNames11_ES6.ts, 2, 3)) >v : Symbol(v, Decl(computedPropertyNames11_ES6.ts, 11, 12)) diff --git a/tests/baselines/reference/computedPropertyNames11_ES6.types b/tests/baselines/reference/computedPropertyNames11_ES6.types index 8ad31a7c2a1..eb5fc105a7a 100644 --- a/tests/baselines/reference/computedPropertyNames11_ES6.types +++ b/tests/baselines/reference/computedPropertyNames11_ES6.types @@ -9,8 +9,8 @@ var a: any; >a : any var v = { ->v : { [0]: number; [""]: any; } ->{ get [s]() { return 0; }, set [n](v) { }, get [s + s]() { return 0; }, set [s + n](v) { }, get [+s]() { return 0; }, set [""](v) { }, get [0]() { return 0; }, set [a](v) { }, get [true]() { return 0; }, set [`hello bye`](v) { }, get [`hello ${a} bye`]() { return 0; }} : { [0]: number; [""]: any; } +>v : { [x: string]: any; [x: number]: any; readonly [0]: number; [""]: any; } +>{ get [s]() { return 0; }, set [n](v) { }, get [s + s]() { return 0; }, set [s + n](v) { }, get [+s]() { return 0; }, set [""](v) { }, get [0]() { return 0; }, set [a](v) { }, get [true]() { return 0; }, set [`hello bye`](v) { }, get [`hello ${a} bye`]() { return 0; }} : { [x: string]: any; [x: number]: any; readonly [0]: number; [""]: any; } get [s]() { return 0; }, >s : string diff --git a/tests/baselines/reference/computedPropertyNames13_ES5.symbols b/tests/baselines/reference/computedPropertyNames13_ES5.symbols index ea2e1b025e5..493ea44b339 100644 --- a/tests/baselines/reference/computedPropertyNames13_ES5.symbols +++ b/tests/baselines/reference/computedPropertyNames13_ES5.symbols @@ -29,7 +29,11 @@ class C { >s : Symbol(s, Decl(computedPropertyNames13_ES5.ts, 0, 3)) static [""]() { } +>"" : Symbol(C[[""]], Decl(computedPropertyNames13_ES5.ts, 8, 14)) + [0]() { } +>0 : Symbol(C[[0]], Decl(computedPropertyNames13_ES5.ts, 9, 21)) + [a]() { } >a : Symbol(a, Decl(computedPropertyNames13_ES5.ts, 2, 3)) diff --git a/tests/baselines/reference/computedPropertyNames13_ES6.symbols b/tests/baselines/reference/computedPropertyNames13_ES6.symbols index 21f7700acef..7c421d3f9f7 100644 --- a/tests/baselines/reference/computedPropertyNames13_ES6.symbols +++ b/tests/baselines/reference/computedPropertyNames13_ES6.symbols @@ -29,7 +29,11 @@ class C { >s : Symbol(s, Decl(computedPropertyNames13_ES6.ts, 0, 3)) static [""]() { } +>"" : Symbol(C[[""]], Decl(computedPropertyNames13_ES6.ts, 8, 14)) + [0]() { } +>0 : Symbol(C[[0]], Decl(computedPropertyNames13_ES6.ts, 9, 21)) + [a]() { } >a : Symbol(a, Decl(computedPropertyNames13_ES6.ts, 2, 3)) diff --git a/tests/baselines/reference/computedPropertyNames16_ES5.js b/tests/baselines/reference/computedPropertyNames16_ES5.js index 5d8471e6560..92b98ecb1ba 100644 --- a/tests/baselines/reference/computedPropertyNames16_ES5.js +++ b/tests/baselines/reference/computedPropertyNames16_ES5.js @@ -48,6 +48,16 @@ var C = (function () { enumerable: true, configurable: true }); + Object.defineProperty(C, "", { + set: function (v) { }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, 0, { + get: function () { return 0; }, + enumerable: true, + configurable: true + }); Object.defineProperty(C.prototype, a, { set: function (v) { }, enumerable: true, diff --git a/tests/baselines/reference/computedPropertyNames16_ES5.symbols b/tests/baselines/reference/computedPropertyNames16_ES5.symbols index 62450e0aa4a..43f6e208957 100644 --- a/tests/baselines/reference/computedPropertyNames16_ES5.symbols +++ b/tests/baselines/reference/computedPropertyNames16_ES5.symbols @@ -31,9 +31,12 @@ class C { >s : Symbol(s, Decl(computedPropertyNames16_ES5.ts, 0, 3)) static set [""](v) { } +>"" : Symbol(C[[""]], Decl(computedPropertyNames16_ES5.ts, 8, 28)) >v : Symbol(v, Decl(computedPropertyNames16_ES5.ts, 9, 20)) get [0]() { return 0; } +>0 : Symbol(C[[0]], Decl(computedPropertyNames16_ES5.ts, 9, 26)) + set [a](v) { } >a : Symbol(a, Decl(computedPropertyNames16_ES5.ts, 2, 3)) >v : Symbol(v, Decl(computedPropertyNames16_ES5.ts, 11, 12)) diff --git a/tests/baselines/reference/computedPropertyNames16_ES6.symbols b/tests/baselines/reference/computedPropertyNames16_ES6.symbols index dc241f67547..4febdc01b9b 100644 --- a/tests/baselines/reference/computedPropertyNames16_ES6.symbols +++ b/tests/baselines/reference/computedPropertyNames16_ES6.symbols @@ -31,9 +31,12 @@ class C { >s : Symbol(s, Decl(computedPropertyNames16_ES6.ts, 0, 3)) static set [""](v) { } +>"" : Symbol(C[[""]], Decl(computedPropertyNames16_ES6.ts, 8, 28)) >v : Symbol(v, Decl(computedPropertyNames16_ES6.ts, 9, 20)) get [0]() { return 0; } +>0 : Symbol(C[[0]], Decl(computedPropertyNames16_ES6.ts, 9, 26)) + set [a](v) { } >a : Symbol(a, Decl(computedPropertyNames16_ES6.ts, 2, 3)) >v : Symbol(v, Decl(computedPropertyNames16_ES6.ts, 11, 12)) diff --git a/tests/baselines/reference/computedPropertyNames18_ES5.types b/tests/baselines/reference/computedPropertyNames18_ES5.types index c60ab32d3f8..d6808a8edc0 100644 --- a/tests/baselines/reference/computedPropertyNames18_ES5.types +++ b/tests/baselines/reference/computedPropertyNames18_ES5.types @@ -3,8 +3,8 @@ function foo() { >foo : () => void var obj = { ->obj : {} ->{ [this.bar]: 0 } : {} +>obj : { [x: number]: number; } +>{ [this.bar]: 0 } : { [x: number]: number; } [this.bar]: 0 >this.bar : any diff --git a/tests/baselines/reference/computedPropertyNames18_ES6.types b/tests/baselines/reference/computedPropertyNames18_ES6.types index 33a15b6c5a9..11d58e48c69 100644 --- a/tests/baselines/reference/computedPropertyNames18_ES6.types +++ b/tests/baselines/reference/computedPropertyNames18_ES6.types @@ -3,8 +3,8 @@ function foo() { >foo : () => void var obj = { ->obj : {} ->{ [this.bar]: 0 } : {} +>obj : { [x: number]: number; } +>{ [this.bar]: 0 } : { [x: number]: number; } [this.bar]: 0 >this.bar : any diff --git a/tests/baselines/reference/computedPropertyNames1_ES5.types b/tests/baselines/reference/computedPropertyNames1_ES5.types index 6c94c846f30..bcff3b34177 100644 --- a/tests/baselines/reference/computedPropertyNames1_ES5.types +++ b/tests/baselines/reference/computedPropertyNames1_ES5.types @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/computedProperties/computedPropertyNames1_ES5.ts === var v = { ->v : {} ->{ get [0 + 1]() { return 0 }, set [0 + 1](v: string) { } //No error} : {} +>v : { [x: number]: number | string; } +>{ get [0 + 1]() { return 0 }, set [0 + 1](v: string) { } //No error} : { [x: number]: number | string; } get [0 + 1]() { return 0 }, >0 + 1 : number diff --git a/tests/baselines/reference/computedPropertyNames1_ES6.types b/tests/baselines/reference/computedPropertyNames1_ES6.types index 95e5a011ea2..df2237a463f 100644 --- a/tests/baselines/reference/computedPropertyNames1_ES6.types +++ b/tests/baselines/reference/computedPropertyNames1_ES6.types @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/computedProperties/computedPropertyNames1_ES6.ts === var v = { ->v : {} ->{ get [0 + 1]() { return 0 }, set [0 + 1](v: string) { } //No error} : {} +>v : { [x: number]: number | string; } +>{ get [0 + 1]() { return 0 }, set [0 + 1](v: string) { } //No error} : { [x: number]: number | string; } get [0 + 1]() { return 0 }, >0 + 1 : number diff --git a/tests/baselines/reference/computedPropertyNames20_ES5.types b/tests/baselines/reference/computedPropertyNames20_ES5.types index 91cc2c42963..65ee55be379 100644 --- a/tests/baselines/reference/computedPropertyNames20_ES5.types +++ b/tests/baselines/reference/computedPropertyNames20_ES5.types @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/computedProperties/computedPropertyNames20_ES5.ts === var obj = { ->obj : {} ->{ [this.bar]: 0} : {} +>obj : { [x: number]: number; } +>{ [this.bar]: 0} : { [x: number]: number; } [this.bar]: 0 >this.bar : any diff --git a/tests/baselines/reference/computedPropertyNames20_ES6.types b/tests/baselines/reference/computedPropertyNames20_ES6.types index 4ef6f675cce..91e5c8d7843 100644 --- a/tests/baselines/reference/computedPropertyNames20_ES6.types +++ b/tests/baselines/reference/computedPropertyNames20_ES6.types @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/computedProperties/computedPropertyNames20_ES6.ts === var obj = { ->obj : {} ->{ [this.bar]: 0} : {} +>obj : { [x: number]: number; } +>{ [this.bar]: 0} : { [x: number]: number; } [this.bar]: 0 >this.bar : any diff --git a/tests/baselines/reference/computedPropertyNames22_ES5.symbols b/tests/baselines/reference/computedPropertyNames22_ES5.symbols index a1e08e5f487..2e2b07473dd 100644 --- a/tests/baselines/reference/computedPropertyNames22_ES5.symbols +++ b/tests/baselines/reference/computedPropertyNames22_ES5.symbols @@ -3,15 +3,15 @@ class C { >C : Symbol(C, Decl(computedPropertyNames22_ES5.ts, 0, 0)) bar() { ->bar : Symbol(bar, Decl(computedPropertyNames22_ES5.ts, 0, 9)) +>bar : Symbol(C.bar, Decl(computedPropertyNames22_ES5.ts, 0, 9)) var obj = { >obj : Symbol(obj, Decl(computedPropertyNames22_ES5.ts, 2, 11)) [this.bar()]() { } ->this.bar : Symbol(bar, Decl(computedPropertyNames22_ES5.ts, 0, 9)) +>this.bar : Symbol(C.bar, Decl(computedPropertyNames22_ES5.ts, 0, 9)) >this : Symbol(C, Decl(computedPropertyNames22_ES5.ts, 0, 0)) ->bar : Symbol(bar, Decl(computedPropertyNames22_ES5.ts, 0, 9)) +>bar : Symbol(C.bar, Decl(computedPropertyNames22_ES5.ts, 0, 9)) }; return 0; diff --git a/tests/baselines/reference/computedPropertyNames22_ES5.types b/tests/baselines/reference/computedPropertyNames22_ES5.types index ca59250825c..eeec22d2e61 100644 --- a/tests/baselines/reference/computedPropertyNames22_ES5.types +++ b/tests/baselines/reference/computedPropertyNames22_ES5.types @@ -6,8 +6,8 @@ class C { >bar : () => number var obj = { ->obj : {} ->{ [this.bar()]() { } } : {} +>obj : { [x: number]: () => void; } +>{ [this.bar()]() { } } : { [x: number]: () => void; } [this.bar()]() { } >this.bar() : number diff --git a/tests/baselines/reference/computedPropertyNames22_ES6.symbols b/tests/baselines/reference/computedPropertyNames22_ES6.symbols index 5940bfb4cfb..39e3acb265c 100644 --- a/tests/baselines/reference/computedPropertyNames22_ES6.symbols +++ b/tests/baselines/reference/computedPropertyNames22_ES6.symbols @@ -3,15 +3,15 @@ class C { >C : Symbol(C, Decl(computedPropertyNames22_ES6.ts, 0, 0)) bar() { ->bar : Symbol(bar, Decl(computedPropertyNames22_ES6.ts, 0, 9)) +>bar : Symbol(C.bar, Decl(computedPropertyNames22_ES6.ts, 0, 9)) var obj = { >obj : Symbol(obj, Decl(computedPropertyNames22_ES6.ts, 2, 11)) [this.bar()]() { } ->this.bar : Symbol(bar, Decl(computedPropertyNames22_ES6.ts, 0, 9)) +>this.bar : Symbol(C.bar, Decl(computedPropertyNames22_ES6.ts, 0, 9)) >this : Symbol(C, Decl(computedPropertyNames22_ES6.ts, 0, 0)) ->bar : Symbol(bar, Decl(computedPropertyNames22_ES6.ts, 0, 9)) +>bar : Symbol(C.bar, Decl(computedPropertyNames22_ES6.ts, 0, 9)) }; return 0; diff --git a/tests/baselines/reference/computedPropertyNames22_ES6.types b/tests/baselines/reference/computedPropertyNames22_ES6.types index d5fbce29f7d..af9ef9d3a31 100644 --- a/tests/baselines/reference/computedPropertyNames22_ES6.types +++ b/tests/baselines/reference/computedPropertyNames22_ES6.types @@ -6,8 +6,8 @@ class C { >bar : () => number var obj = { ->obj : {} ->{ [this.bar()]() { } } : {} +>obj : { [x: number]: () => void; } +>{ [this.bar()]() { } } : { [x: number]: () => void; } [this.bar()]() { } >this.bar() : number diff --git a/tests/baselines/reference/computedPropertyNames25_ES5.symbols b/tests/baselines/reference/computedPropertyNames25_ES5.symbols index e11753857cc..896ba223099 100644 --- a/tests/baselines/reference/computedPropertyNames25_ES5.symbols +++ b/tests/baselines/reference/computedPropertyNames25_ES5.symbols @@ -3,7 +3,7 @@ class Base { >Base : Symbol(Base, Decl(computedPropertyNames25_ES5.ts, 0, 0)) bar() { ->bar : Symbol(bar, Decl(computedPropertyNames25_ES5.ts, 0, 12)) +>bar : Symbol(Base.bar, Decl(computedPropertyNames25_ES5.ts, 0, 12)) return 0; } @@ -13,7 +13,7 @@ class C extends Base { >Base : Symbol(Base, Decl(computedPropertyNames25_ES5.ts, 0, 0)) foo() { ->foo : Symbol(foo, Decl(computedPropertyNames25_ES5.ts, 5, 22)) +>foo : Symbol(C.foo, Decl(computedPropertyNames25_ES5.ts, 5, 22)) var obj = { >obj : Symbol(obj, Decl(computedPropertyNames25_ES5.ts, 7, 11)) diff --git a/tests/baselines/reference/computedPropertyNames25_ES5.types b/tests/baselines/reference/computedPropertyNames25_ES5.types index 6ca67cce410..f1acc296709 100644 --- a/tests/baselines/reference/computedPropertyNames25_ES5.types +++ b/tests/baselines/reference/computedPropertyNames25_ES5.types @@ -17,8 +17,8 @@ class C extends Base { >foo : () => number var obj = { ->obj : {} ->{ [super.bar()]() { } } : {} +>obj : { [x: number]: () => void; } +>{ [super.bar()]() { } } : { [x: number]: () => void; } [super.bar()]() { } >super.bar() : number diff --git a/tests/baselines/reference/computedPropertyNames25_ES6.symbols b/tests/baselines/reference/computedPropertyNames25_ES6.symbols index 8eb7393c6ac..dcb6177b0ea 100644 --- a/tests/baselines/reference/computedPropertyNames25_ES6.symbols +++ b/tests/baselines/reference/computedPropertyNames25_ES6.symbols @@ -3,7 +3,7 @@ class Base { >Base : Symbol(Base, Decl(computedPropertyNames25_ES6.ts, 0, 0)) bar() { ->bar : Symbol(bar, Decl(computedPropertyNames25_ES6.ts, 0, 12)) +>bar : Symbol(Base.bar, Decl(computedPropertyNames25_ES6.ts, 0, 12)) return 0; } @@ -13,7 +13,7 @@ class C extends Base { >Base : Symbol(Base, Decl(computedPropertyNames25_ES6.ts, 0, 0)) foo() { ->foo : Symbol(foo, Decl(computedPropertyNames25_ES6.ts, 5, 22)) +>foo : Symbol(C.foo, Decl(computedPropertyNames25_ES6.ts, 5, 22)) var obj = { >obj : Symbol(obj, Decl(computedPropertyNames25_ES6.ts, 7, 11)) diff --git a/tests/baselines/reference/computedPropertyNames25_ES6.types b/tests/baselines/reference/computedPropertyNames25_ES6.types index 1c093ebc59f..26c38013906 100644 --- a/tests/baselines/reference/computedPropertyNames25_ES6.types +++ b/tests/baselines/reference/computedPropertyNames25_ES6.types @@ -17,8 +17,8 @@ class C extends Base { >foo : () => number var obj = { ->obj : {} ->{ [super.bar()]() { } } : {} +>obj : { [x: number]: () => void; } +>{ [super.bar()]() { } } : { [x: number]: () => void; } [super.bar()]() { } >super.bar() : number diff --git a/tests/baselines/reference/computedPropertyNames28_ES5.types b/tests/baselines/reference/computedPropertyNames28_ES5.types index 273dcd426d8..89a2a7ac017 100644 --- a/tests/baselines/reference/computedPropertyNames28_ES5.types +++ b/tests/baselines/reference/computedPropertyNames28_ES5.types @@ -12,8 +12,8 @@ class C extends Base { >super : typeof Base var obj = { ->obj : {} ->{ [(super(), "prop")]() { } } : {} +>obj : { [x: string]: () => void; } +>{ [(super(), "prop")]() { } } : { [x: string]: () => void; } [(super(), "prop")]() { } >(super(), "prop") : string diff --git a/tests/baselines/reference/computedPropertyNames28_ES6.types b/tests/baselines/reference/computedPropertyNames28_ES6.types index a34fb33f6c7..df020c9a5ff 100644 --- a/tests/baselines/reference/computedPropertyNames28_ES6.types +++ b/tests/baselines/reference/computedPropertyNames28_ES6.types @@ -12,8 +12,8 @@ class C extends Base { >super : typeof Base var obj = { ->obj : {} ->{ [(super(), "prop")]() { } } : {} +>obj : { [x: string]: () => void; } +>{ [(super(), "prop")]() { } } : { [x: string]: () => void; } [(super(), "prop")]() { } >(super(), "prop") : string diff --git a/tests/baselines/reference/computedPropertyNames29_ES5.symbols b/tests/baselines/reference/computedPropertyNames29_ES5.symbols index c33a7390ce8..b78b4d0955c 100644 --- a/tests/baselines/reference/computedPropertyNames29_ES5.symbols +++ b/tests/baselines/reference/computedPropertyNames29_ES5.symbols @@ -3,16 +3,16 @@ class C { >C : Symbol(C, Decl(computedPropertyNames29_ES5.ts, 0, 0)) bar() { ->bar : Symbol(bar, Decl(computedPropertyNames29_ES5.ts, 0, 9)) +>bar : Symbol(C.bar, Decl(computedPropertyNames29_ES5.ts, 0, 9)) () => { var obj = { >obj : Symbol(obj, Decl(computedPropertyNames29_ES5.ts, 3, 15)) [this.bar()]() { } // needs capture ->this.bar : Symbol(bar, Decl(computedPropertyNames29_ES5.ts, 0, 9)) +>this.bar : Symbol(C.bar, Decl(computedPropertyNames29_ES5.ts, 0, 9)) >this : Symbol(C, Decl(computedPropertyNames29_ES5.ts, 0, 0)) ->bar : Symbol(bar, Decl(computedPropertyNames29_ES5.ts, 0, 9)) +>bar : Symbol(C.bar, Decl(computedPropertyNames29_ES5.ts, 0, 9)) }; } diff --git a/tests/baselines/reference/computedPropertyNames29_ES5.types b/tests/baselines/reference/computedPropertyNames29_ES5.types index f3448f10857..d2f89ef6b18 100644 --- a/tests/baselines/reference/computedPropertyNames29_ES5.types +++ b/tests/baselines/reference/computedPropertyNames29_ES5.types @@ -9,8 +9,8 @@ class C { >() => { var obj = { [this.bar()]() { } // needs capture }; } : () => void var obj = { ->obj : {} ->{ [this.bar()]() { } // needs capture } : {} +>obj : { [x: number]: () => void; } +>{ [this.bar()]() { } // needs capture } : { [x: number]: () => void; } [this.bar()]() { } // needs capture >this.bar() : number diff --git a/tests/baselines/reference/computedPropertyNames29_ES6.symbols b/tests/baselines/reference/computedPropertyNames29_ES6.symbols index 41631ea63bb..fe54d1a0325 100644 --- a/tests/baselines/reference/computedPropertyNames29_ES6.symbols +++ b/tests/baselines/reference/computedPropertyNames29_ES6.symbols @@ -3,16 +3,16 @@ class C { >C : Symbol(C, Decl(computedPropertyNames29_ES6.ts, 0, 0)) bar() { ->bar : Symbol(bar, Decl(computedPropertyNames29_ES6.ts, 0, 9)) +>bar : Symbol(C.bar, Decl(computedPropertyNames29_ES6.ts, 0, 9)) () => { var obj = { >obj : Symbol(obj, Decl(computedPropertyNames29_ES6.ts, 3, 15)) [this.bar()]() { } // needs capture ->this.bar : Symbol(bar, Decl(computedPropertyNames29_ES6.ts, 0, 9)) +>this.bar : Symbol(C.bar, Decl(computedPropertyNames29_ES6.ts, 0, 9)) >this : Symbol(C, Decl(computedPropertyNames29_ES6.ts, 0, 0)) ->bar : Symbol(bar, Decl(computedPropertyNames29_ES6.ts, 0, 9)) +>bar : Symbol(C.bar, Decl(computedPropertyNames29_ES6.ts, 0, 9)) }; } diff --git a/tests/baselines/reference/computedPropertyNames29_ES6.types b/tests/baselines/reference/computedPropertyNames29_ES6.types index cd01d37556a..bb324b2b382 100644 --- a/tests/baselines/reference/computedPropertyNames29_ES6.types +++ b/tests/baselines/reference/computedPropertyNames29_ES6.types @@ -9,8 +9,8 @@ class C { >() => { var obj = { [this.bar()]() { } // needs capture }; } : () => void var obj = { ->obj : {} ->{ [this.bar()]() { } // needs capture } : {} +>obj : { [x: number]: () => void; } +>{ [this.bar()]() { } // needs capture } : { [x: number]: () => void; } [this.bar()]() { } // needs capture >this.bar() : number diff --git a/tests/baselines/reference/computedPropertyNames31_ES5.symbols b/tests/baselines/reference/computedPropertyNames31_ES5.symbols index 82a6acb286c..9cb1b0184f7 100644 --- a/tests/baselines/reference/computedPropertyNames31_ES5.symbols +++ b/tests/baselines/reference/computedPropertyNames31_ES5.symbols @@ -3,7 +3,7 @@ class Base { >Base : Symbol(Base, Decl(computedPropertyNames31_ES5.ts, 0, 0)) bar() { ->bar : Symbol(bar, Decl(computedPropertyNames31_ES5.ts, 0, 12)) +>bar : Symbol(Base.bar, Decl(computedPropertyNames31_ES5.ts, 0, 12)) return 0; } @@ -13,7 +13,7 @@ class C extends Base { >Base : Symbol(Base, Decl(computedPropertyNames31_ES5.ts, 0, 0)) foo() { ->foo : Symbol(foo, Decl(computedPropertyNames31_ES5.ts, 5, 22)) +>foo : Symbol(C.foo, Decl(computedPropertyNames31_ES5.ts, 5, 22)) () => { var obj = { diff --git a/tests/baselines/reference/computedPropertyNames31_ES5.types b/tests/baselines/reference/computedPropertyNames31_ES5.types index 6c0f2572a06..832b2bc067a 100644 --- a/tests/baselines/reference/computedPropertyNames31_ES5.types +++ b/tests/baselines/reference/computedPropertyNames31_ES5.types @@ -20,8 +20,8 @@ class C extends Base { >() => { var obj = { [super.bar()]() { } // needs capture }; } : () => void var obj = { ->obj : {} ->{ [super.bar()]() { } // needs capture } : {} +>obj : { [x: number]: () => void; } +>{ [super.bar()]() { } // needs capture } : { [x: number]: () => void; } [super.bar()]() { } // needs capture >super.bar() : number diff --git a/tests/baselines/reference/computedPropertyNames31_ES6.symbols b/tests/baselines/reference/computedPropertyNames31_ES6.symbols index 778293bbb88..19cc6cd1bcd 100644 --- a/tests/baselines/reference/computedPropertyNames31_ES6.symbols +++ b/tests/baselines/reference/computedPropertyNames31_ES6.symbols @@ -3,7 +3,7 @@ class Base { >Base : Symbol(Base, Decl(computedPropertyNames31_ES6.ts, 0, 0)) bar() { ->bar : Symbol(bar, Decl(computedPropertyNames31_ES6.ts, 0, 12)) +>bar : Symbol(Base.bar, Decl(computedPropertyNames31_ES6.ts, 0, 12)) return 0; } @@ -13,7 +13,7 @@ class C extends Base { >Base : Symbol(Base, Decl(computedPropertyNames31_ES6.ts, 0, 0)) foo() { ->foo : Symbol(foo, Decl(computedPropertyNames31_ES6.ts, 5, 22)) +>foo : Symbol(C.foo, Decl(computedPropertyNames31_ES6.ts, 5, 22)) () => { var obj = { diff --git a/tests/baselines/reference/computedPropertyNames31_ES6.types b/tests/baselines/reference/computedPropertyNames31_ES6.types index eaddc036812..4f59b1e8c6d 100644 --- a/tests/baselines/reference/computedPropertyNames31_ES6.types +++ b/tests/baselines/reference/computedPropertyNames31_ES6.types @@ -20,8 +20,8 @@ class C extends Base { >() => { var obj = { [super.bar()]() { } // needs capture }; } : () => void var obj = { ->obj : {} ->{ [super.bar()]() { } // needs capture } : {} +>obj : { [x: number]: () => void; } +>{ [super.bar()]() { } // needs capture } : { [x: number]: () => void; } [super.bar()]() { } // needs capture >super.bar() : number diff --git a/tests/baselines/reference/computedPropertyNames33_ES5.symbols b/tests/baselines/reference/computedPropertyNames33_ES5.symbols index ae6dd01e7bc..90734fd07a0 100644 --- a/tests/baselines/reference/computedPropertyNames33_ES5.symbols +++ b/tests/baselines/reference/computedPropertyNames33_ES5.symbols @@ -8,7 +8,7 @@ class C { >T : Symbol(T, Decl(computedPropertyNames33_ES5.ts, 1, 8)) bar() { ->bar : Symbol(bar, Decl(computedPropertyNames33_ES5.ts, 1, 12)) +>bar : Symbol(C.bar, Decl(computedPropertyNames33_ES5.ts, 1, 12)) var obj = { >obj : Symbol(obj, Decl(computedPropertyNames33_ES5.ts, 3, 11)) diff --git a/tests/baselines/reference/computedPropertyNames33_ES5.types b/tests/baselines/reference/computedPropertyNames33_ES5.types index f44ac3ca769..7031981481f 100644 --- a/tests/baselines/reference/computedPropertyNames33_ES5.types +++ b/tests/baselines/reference/computedPropertyNames33_ES5.types @@ -12,8 +12,8 @@ class C { >bar : () => number var obj = { ->obj : {} ->{ [foo()]() { } } : {} +>obj : { [x: string]: () => void; } +>{ [foo()]() { } } : { [x: string]: () => void; } [foo()]() { } >foo() : string diff --git a/tests/baselines/reference/computedPropertyNames33_ES6.symbols b/tests/baselines/reference/computedPropertyNames33_ES6.symbols index cf0b3abde96..f51764af561 100644 --- a/tests/baselines/reference/computedPropertyNames33_ES6.symbols +++ b/tests/baselines/reference/computedPropertyNames33_ES6.symbols @@ -8,7 +8,7 @@ class C { >T : Symbol(T, Decl(computedPropertyNames33_ES6.ts, 1, 8)) bar() { ->bar : Symbol(bar, Decl(computedPropertyNames33_ES6.ts, 1, 12)) +>bar : Symbol(C.bar, Decl(computedPropertyNames33_ES6.ts, 1, 12)) var obj = { >obj : Symbol(obj, Decl(computedPropertyNames33_ES6.ts, 3, 11)) diff --git a/tests/baselines/reference/computedPropertyNames33_ES6.types b/tests/baselines/reference/computedPropertyNames33_ES6.types index 3081337c8bb..3c57daf2ace 100644 --- a/tests/baselines/reference/computedPropertyNames33_ES6.types +++ b/tests/baselines/reference/computedPropertyNames33_ES6.types @@ -12,8 +12,8 @@ class C { >bar : () => number var obj = { ->obj : {} ->{ [foo()]() { } } : {} +>obj : { [x: string]: () => void; } +>{ [foo()]() { } } : { [x: string]: () => void; } [foo()]() { } >foo() : string diff --git a/tests/baselines/reference/computedPropertyNames36_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames36_ES5.errors.txt index 6c38043c8e0..506a9ca15d1 100644 --- a/tests/baselines/reference/computedPropertyNames36_ES5.errors.txt +++ b/tests/baselines/reference/computedPropertyNames36_ES5.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames36_ES5.ts(8,5): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames36_ES5.ts(8,9): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. ==== tests/cases/conformance/es6/computedProperties/computedPropertyNames36_ES5.ts (1 errors) ==== @@ -10,7 +10,7 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames36_ES5.ts(8, // Computed properties get ["get1"]() { return new Foo } - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~ !!! error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. set ["set1"](p: Foo2) { } } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames36_ES5.js b/tests/baselines/reference/computedPropertyNames36_ES5.js index 884e425e25b..ec5643db26a 100644 --- a/tests/baselines/reference/computedPropertyNames36_ES5.js +++ b/tests/baselines/reference/computedPropertyNames36_ES5.js @@ -27,6 +27,10 @@ var C = (function () { Object.defineProperty(C.prototype, "get1", { // Computed properties get: function () { return new Foo; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, "set1", { set: function (p) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/computedPropertyNames36_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames36_ES6.errors.txt index 8127898fde4..cf50807ac54 100644 --- a/tests/baselines/reference/computedPropertyNames36_ES6.errors.txt +++ b/tests/baselines/reference/computedPropertyNames36_ES6.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames36_ES6.ts(8,5): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames36_ES6.ts(8,9): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. ==== tests/cases/conformance/es6/computedProperties/computedPropertyNames36_ES6.ts (1 errors) ==== @@ -10,7 +10,7 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames36_ES6.ts(8, // Computed properties get ["get1"]() { return new Foo } - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~ !!! error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. set ["set1"](p: Foo2) { } } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames37_ES5.js b/tests/baselines/reference/computedPropertyNames37_ES5.js index 8cdc0af30e7..914fd9a898e 100644 --- a/tests/baselines/reference/computedPropertyNames37_ES5.js +++ b/tests/baselines/reference/computedPropertyNames37_ES5.js @@ -27,6 +27,10 @@ var C = (function () { Object.defineProperty(C.prototype, "get1", { // Computed properties get: function () { return new Foo; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, "set1", { set: function (p) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/computedPropertyNames37_ES5.symbols b/tests/baselines/reference/computedPropertyNames37_ES5.symbols index 7932b2c8fdc..7763c5970a3 100644 --- a/tests/baselines/reference/computedPropertyNames37_ES5.symbols +++ b/tests/baselines/reference/computedPropertyNames37_ES5.symbols @@ -1,12 +1,12 @@ === tests/cases/conformance/es6/computedProperties/computedPropertyNames37_ES5.ts === class Foo { x } >Foo : Symbol(Foo, Decl(computedPropertyNames37_ES5.ts, 0, 0)) ->x : Symbol(x, Decl(computedPropertyNames37_ES5.ts, 0, 11)) +>x : Symbol(Foo.x, Decl(computedPropertyNames37_ES5.ts, 0, 11)) class Foo2 { x; y } >Foo2 : Symbol(Foo2, Decl(computedPropertyNames37_ES5.ts, 0, 15)) ->x : Symbol(x, Decl(computedPropertyNames37_ES5.ts, 1, 12)) ->y : Symbol(y, Decl(computedPropertyNames37_ES5.ts, 1, 15)) +>x : Symbol(Foo2.x, Decl(computedPropertyNames37_ES5.ts, 1, 12)) +>y : Symbol(Foo2.y, Decl(computedPropertyNames37_ES5.ts, 1, 15)) class C { >C : Symbol(C, Decl(computedPropertyNames37_ES5.ts, 1, 19)) @@ -17,9 +17,11 @@ class C { // Computed properties get ["get1"]() { return new Foo } +>"get1" : Symbol(C[["get1"]], Decl(computedPropertyNames37_ES5.ts, 4, 22)) >Foo : Symbol(Foo, Decl(computedPropertyNames37_ES5.ts, 0, 0)) set ["set1"](p: Foo2) { } +>"set1" : Symbol(C[["set1"]], Decl(computedPropertyNames37_ES5.ts, 7, 37)) >p : Symbol(p, Decl(computedPropertyNames37_ES5.ts, 8, 17)) >Foo2 : Symbol(Foo2, Decl(computedPropertyNames37_ES5.ts, 0, 15)) } diff --git a/tests/baselines/reference/computedPropertyNames37_ES6.symbols b/tests/baselines/reference/computedPropertyNames37_ES6.symbols index f4439ef4f92..d2e1e2fdc6e 100644 --- a/tests/baselines/reference/computedPropertyNames37_ES6.symbols +++ b/tests/baselines/reference/computedPropertyNames37_ES6.symbols @@ -1,12 +1,12 @@ === tests/cases/conformance/es6/computedProperties/computedPropertyNames37_ES6.ts === class Foo { x } >Foo : Symbol(Foo, Decl(computedPropertyNames37_ES6.ts, 0, 0)) ->x : Symbol(x, Decl(computedPropertyNames37_ES6.ts, 0, 11)) +>x : Symbol(Foo.x, Decl(computedPropertyNames37_ES6.ts, 0, 11)) class Foo2 { x; y } >Foo2 : Symbol(Foo2, Decl(computedPropertyNames37_ES6.ts, 0, 15)) ->x : Symbol(x, Decl(computedPropertyNames37_ES6.ts, 1, 12)) ->y : Symbol(y, Decl(computedPropertyNames37_ES6.ts, 1, 15)) +>x : Symbol(Foo2.x, Decl(computedPropertyNames37_ES6.ts, 1, 12)) +>y : Symbol(Foo2.y, Decl(computedPropertyNames37_ES6.ts, 1, 15)) class C { >C : Symbol(C, Decl(computedPropertyNames37_ES6.ts, 1, 19)) @@ -17,9 +17,11 @@ class C { // Computed properties get ["get1"]() { return new Foo } +>"get1" : Symbol(C[["get1"]], Decl(computedPropertyNames37_ES6.ts, 4, 22)) >Foo : Symbol(Foo, Decl(computedPropertyNames37_ES6.ts, 0, 0)) set ["set1"](p: Foo2) { } +>"set1" : Symbol(C[["set1"]], Decl(computedPropertyNames37_ES6.ts, 7, 37)) >p : Symbol(p, Decl(computedPropertyNames37_ES6.ts, 8, 17)) >Foo2 : Symbol(Foo2, Decl(computedPropertyNames37_ES6.ts, 0, 15)) } diff --git a/tests/baselines/reference/computedPropertyNames38_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames38_ES5.errors.txt index acc08ee5527..2e5313caa41 100644 --- a/tests/baselines/reference/computedPropertyNames38_ES5.errors.txt +++ b/tests/baselines/reference/computedPropertyNames38_ES5.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames38_ES5.ts(8,5): error TS2411: Property '[1 << 6]' of type 'Foo' is not assignable to string index type 'Foo2'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames38_ES5.ts(8,9): error TS2411: Property '[1 << 6]' of type 'Foo' is not assignable to string index type 'Foo2'. ==== tests/cases/conformance/es6/computedProperties/computedPropertyNames38_ES5.ts (1 errors) ==== @@ -10,7 +10,7 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames38_ES5.ts(8, // Computed properties get [1 << 6]() { return new Foo } - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~ !!! error TS2411: Property '[1 << 6]' of type 'Foo' is not assignable to string index type 'Foo2'. set [1 << 6](p: Foo2) { } } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames38_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames38_ES6.errors.txt index 0a95b37f9a9..4c6e78c5b04 100644 --- a/tests/baselines/reference/computedPropertyNames38_ES6.errors.txt +++ b/tests/baselines/reference/computedPropertyNames38_ES6.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames38_ES6.ts(8,5): error TS2411: Property '[1 << 6]' of type 'Foo' is not assignable to string index type 'Foo2'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames38_ES6.ts(8,9): error TS2411: Property '[1 << 6]' of type 'Foo' is not assignable to string index type 'Foo2'. ==== tests/cases/conformance/es6/computedProperties/computedPropertyNames38_ES6.ts (1 errors) ==== @@ -10,7 +10,7 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames38_ES6.ts(8, // Computed properties get [1 << 6]() { return new Foo } - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~ !!! error TS2411: Property '[1 << 6]' of type 'Foo' is not assignable to string index type 'Foo2'. set [1 << 6](p: Foo2) { } } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames39_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames39_ES5.errors.txt index 669314676f9..a204ef4ae34 100644 --- a/tests/baselines/reference/computedPropertyNames39_ES5.errors.txt +++ b/tests/baselines/reference/computedPropertyNames39_ES5.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames39_ES5.ts(8,5): error TS2412: Property '[1 << 6]' of type 'Foo' is not assignable to numeric index type 'Foo2'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames39_ES5.ts(8,9): error TS2412: Property '[1 << 6]' of type 'Foo' is not assignable to numeric index type 'Foo2'. ==== tests/cases/conformance/es6/computedProperties/computedPropertyNames39_ES5.ts (1 errors) ==== @@ -10,7 +10,7 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames39_ES5.ts(8, // Computed properties get [1 << 6]() { return new Foo } - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~ !!! error TS2412: Property '[1 << 6]' of type 'Foo' is not assignable to numeric index type 'Foo2'. set [1 << 6](p: Foo2) { } } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames39_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames39_ES6.errors.txt index 38f432162d5..d2e2494c87a 100644 --- a/tests/baselines/reference/computedPropertyNames39_ES6.errors.txt +++ b/tests/baselines/reference/computedPropertyNames39_ES6.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames39_ES6.ts(8,5): error TS2412: Property '[1 << 6]' of type 'Foo' is not assignable to numeric index type 'Foo2'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames39_ES6.ts(8,9): error TS2412: Property '[1 << 6]' of type 'Foo' is not assignable to numeric index type 'Foo2'. ==== tests/cases/conformance/es6/computedProperties/computedPropertyNames39_ES6.ts (1 errors) ==== @@ -10,7 +10,7 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames39_ES6.ts(8, // Computed properties get [1 << 6]() { return new Foo } - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~ !!! error TS2412: Property '[1 << 6]' of type 'Foo' is not assignable to numeric index type 'Foo2'. set [1 << 6](p: Foo2) { } } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames41_ES5.symbols b/tests/baselines/reference/computedPropertyNames41_ES5.symbols index e1438568f24..821a39c8d59 100644 --- a/tests/baselines/reference/computedPropertyNames41_ES5.symbols +++ b/tests/baselines/reference/computedPropertyNames41_ES5.symbols @@ -1,12 +1,12 @@ === tests/cases/conformance/es6/computedProperties/computedPropertyNames41_ES5.ts === class Foo { x } >Foo : Symbol(Foo, Decl(computedPropertyNames41_ES5.ts, 0, 0)) ->x : Symbol(x, Decl(computedPropertyNames41_ES5.ts, 0, 11)) +>x : Symbol(Foo.x, Decl(computedPropertyNames41_ES5.ts, 0, 11)) class Foo2 { x; y } >Foo2 : Symbol(Foo2, Decl(computedPropertyNames41_ES5.ts, 0, 15)) ->x : Symbol(x, Decl(computedPropertyNames41_ES5.ts, 1, 12)) ->y : Symbol(y, Decl(computedPropertyNames41_ES5.ts, 1, 15)) +>x : Symbol(Foo2.x, Decl(computedPropertyNames41_ES5.ts, 1, 12)) +>y : Symbol(Foo2.y, Decl(computedPropertyNames41_ES5.ts, 1, 15)) class C { >C : Symbol(C, Decl(computedPropertyNames41_ES5.ts, 1, 19)) @@ -17,5 +17,6 @@ class C { // Computed properties static [""]() { return new Foo } +>"" : Symbol(C[[""]], Decl(computedPropertyNames41_ES5.ts, 4, 28)) >Foo : Symbol(Foo, Decl(computedPropertyNames41_ES5.ts, 0, 0)) } diff --git a/tests/baselines/reference/computedPropertyNames41_ES6.symbols b/tests/baselines/reference/computedPropertyNames41_ES6.symbols index 3f4a7dff621..a075603e252 100644 --- a/tests/baselines/reference/computedPropertyNames41_ES6.symbols +++ b/tests/baselines/reference/computedPropertyNames41_ES6.symbols @@ -1,12 +1,12 @@ === tests/cases/conformance/es6/computedProperties/computedPropertyNames41_ES6.ts === class Foo { x } >Foo : Symbol(Foo, Decl(computedPropertyNames41_ES6.ts, 0, 0)) ->x : Symbol(x, Decl(computedPropertyNames41_ES6.ts, 0, 11)) +>x : Symbol(Foo.x, Decl(computedPropertyNames41_ES6.ts, 0, 11)) class Foo2 { x; y } >Foo2 : Symbol(Foo2, Decl(computedPropertyNames41_ES6.ts, 0, 15)) ->x : Symbol(x, Decl(computedPropertyNames41_ES6.ts, 1, 12)) ->y : Symbol(y, Decl(computedPropertyNames41_ES6.ts, 1, 15)) +>x : Symbol(Foo2.x, Decl(computedPropertyNames41_ES6.ts, 1, 12)) +>y : Symbol(Foo2.y, Decl(computedPropertyNames41_ES6.ts, 1, 15)) class C { >C : Symbol(C, Decl(computedPropertyNames41_ES6.ts, 1, 19)) @@ -17,5 +17,6 @@ class C { // Computed properties static [""]() { return new Foo } +>"" : Symbol(C[[""]], Decl(computedPropertyNames41_ES6.ts, 4, 28)) >Foo : Symbol(Foo, Decl(computedPropertyNames41_ES6.ts, 0, 0)) } diff --git a/tests/baselines/reference/computedPropertyNames43_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames43_ES5.errors.txt index 62c239a5a54..d777ae659de 100644 --- a/tests/baselines/reference/computedPropertyNames43_ES5.errors.txt +++ b/tests/baselines/reference/computedPropertyNames43_ES5.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames43_ES5.ts(10,5): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames43_ES5.ts(10,9): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. ==== tests/cases/conformance/es6/computedProperties/computedPropertyNames43_ES5.ts (1 errors) ==== @@ -12,7 +12,7 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames43_ES5.ts(10 class D extends C { // Computed properties get ["get1"]() { return new Foo } - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~ !!! error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. set ["set1"](p: Foo2) { } } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames43_ES5.js b/tests/baselines/reference/computedPropertyNames43_ES5.js index 9690d0b8196..c79a4d8d6d1 100644 --- a/tests/baselines/reference/computedPropertyNames43_ES5.js +++ b/tests/baselines/reference/computedPropertyNames43_ES5.js @@ -41,6 +41,10 @@ var D = (function (_super) { Object.defineProperty(D.prototype, "get1", { // Computed properties get: function () { return new Foo; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(D.prototype, "set1", { set: function (p) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/computedPropertyNames43_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames43_ES6.errors.txt index 0efe0ba39ec..6af43ebfa5c 100644 --- a/tests/baselines/reference/computedPropertyNames43_ES6.errors.txt +++ b/tests/baselines/reference/computedPropertyNames43_ES6.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames43_ES6.ts(10,5): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames43_ES6.ts(10,9): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. ==== tests/cases/conformance/es6/computedProperties/computedPropertyNames43_ES6.ts (1 errors) ==== @@ -12,7 +12,7 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames43_ES6.ts(10 class D extends C { // Computed properties get ["get1"]() { return new Foo } - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~ !!! error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. set ["set1"](p: Foo2) { } } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames44_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames44_ES5.errors.txt index 35ab422e093..43801ab3d62 100644 --- a/tests/baselines/reference/computedPropertyNames44_ES5.errors.txt +++ b/tests/baselines/reference/computedPropertyNames44_ES5.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES5.ts(6,5): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES5.ts(10,5): error TS2411: Property '["set1"]' of type 'Foo' is not assignable to string index type 'Foo2'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES5.ts(6,9): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES5.ts(10,9): error TS2411: Property '["set1"]' of type 'Foo' is not assignable to string index type 'Foo2'. ==== tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES5.ts (2 errors) ==== @@ -9,12 +9,12 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES5.ts(10 class C { [s: string]: Foo2; get ["get1"]() { return new Foo } - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~ !!! error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. } class D extends C { set ["set1"](p: Foo) { } - ~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~ !!! error TS2411: Property '["set1"]' of type 'Foo' is not assignable to string index type 'Foo2'. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames44_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames44_ES6.errors.txt index 5170746395c..28b861347a3 100644 --- a/tests/baselines/reference/computedPropertyNames44_ES6.errors.txt +++ b/tests/baselines/reference/computedPropertyNames44_ES6.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES6.ts(6,5): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES6.ts(10,5): error TS2411: Property '["set1"]' of type 'Foo' is not assignable to string index type 'Foo2'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES6.ts(6,9): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES6.ts(10,9): error TS2411: Property '["set1"]' of type 'Foo' is not assignable to string index type 'Foo2'. ==== tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES6.ts (2 errors) ==== @@ -9,12 +9,12 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES6.ts(10 class C { [s: string]: Foo2; get ["get1"]() { return new Foo } - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~ !!! error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. } class D extends C { set ["set1"](p: Foo) { } - ~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~ !!! error TS2411: Property '["set1"]' of type 'Foo' is not assignable to string index type 'Foo2'. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames45_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames45_ES5.errors.txt index 8baae68f337..f06d199ba5a 100644 --- a/tests/baselines/reference/computedPropertyNames45_ES5.errors.txt +++ b/tests/baselines/reference/computedPropertyNames45_ES5.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES5.ts(5,5): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES5.ts(11,5): error TS2411: Property '["set1"]' of type 'Foo' is not assignable to string index type 'Foo2'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES5.ts(5,9): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES5.ts(11,9): error TS2411: Property '["set1"]' of type 'Foo' is not assignable to string index type 'Foo2'. ==== tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES5.ts (2 errors) ==== @@ -8,7 +8,7 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES5.ts(11 class C { get ["get1"]() { return new Foo } - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~ !!! error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. } @@ -16,6 +16,6 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES5.ts(11 // No error when the indexer is in a class more derived than the computed property [s: string]: Foo2; set ["set1"](p: Foo) { } - ~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~ !!! error TS2411: Property '["set1"]' of type 'Foo' is not assignable to string index type 'Foo2'. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames45_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames45_ES6.errors.txt index e329785f4cf..626ed14ad1a 100644 --- a/tests/baselines/reference/computedPropertyNames45_ES6.errors.txt +++ b/tests/baselines/reference/computedPropertyNames45_ES6.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES6.ts(5,5): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES6.ts(11,5): error TS2411: Property '["set1"]' of type 'Foo' is not assignable to string index type 'Foo2'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES6.ts(5,9): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES6.ts(11,9): error TS2411: Property '["set1"]' of type 'Foo' is not assignable to string index type 'Foo2'. ==== tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES6.ts (2 errors) ==== @@ -8,7 +8,7 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES6.ts(11 class C { get ["get1"]() { return new Foo } - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~ !!! error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. } @@ -16,6 +16,6 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES6.ts(11 // No error when the indexer is in a class more derived than the computed property [s: string]: Foo2; set ["set1"](p: Foo) { } - ~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~ !!! error TS2411: Property '["set1"]' of type 'Foo' is not assignable to string index type 'Foo2'. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames46_ES5.types b/tests/baselines/reference/computedPropertyNames46_ES5.types index 394b22bd904..b8df0d56e13 100644 --- a/tests/baselines/reference/computedPropertyNames46_ES5.types +++ b/tests/baselines/reference/computedPropertyNames46_ES5.types @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/computedProperties/computedPropertyNames46_ES5.ts === var o = { ->o : {} ->{ ["" || 0]: 0} : {} +>o : { [x: string]: number; } +>{ ["" || 0]: 0} : { [x: string]: number; } ["" || 0]: 0 >"" || 0 : string | number diff --git a/tests/baselines/reference/computedPropertyNames46_ES6.types b/tests/baselines/reference/computedPropertyNames46_ES6.types index 864fd81321d..a786eca200c 100644 --- a/tests/baselines/reference/computedPropertyNames46_ES6.types +++ b/tests/baselines/reference/computedPropertyNames46_ES6.types @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/computedProperties/computedPropertyNames46_ES6.ts === var o = { ->o : {} ->{ ["" || 0]: 0} : {} +>o : { [x: string]: number; } +>{ ["" || 0]: 0} : { [x: string]: number; } ["" || 0]: 0 >"" || 0 : string | number diff --git a/tests/baselines/reference/computedPropertyNames47_ES5.types b/tests/baselines/reference/computedPropertyNames47_ES5.types index 6aa841ffd62..cdc2c3301f6 100644 --- a/tests/baselines/reference/computedPropertyNames47_ES5.types +++ b/tests/baselines/reference/computedPropertyNames47_ES5.types @@ -8,8 +8,8 @@ enum E2 { x } >x : E2 var o = { ->o : {} ->{ [E1.x || E2.x]: 0} : {} +>o : { [x: number]: number; } +>{ [E1.x || E2.x]: 0} : { [x: number]: number; } [E1.x || E2.x]: 0 >E1.x || E2.x : E1 | E2 diff --git a/tests/baselines/reference/computedPropertyNames47_ES6.types b/tests/baselines/reference/computedPropertyNames47_ES6.types index f038b172ca1..a923e934d66 100644 --- a/tests/baselines/reference/computedPropertyNames47_ES6.types +++ b/tests/baselines/reference/computedPropertyNames47_ES6.types @@ -8,8 +8,8 @@ enum E2 { x } >x : E2 var o = { ->o : {} ->{ [E1.x || E2.x]: 0} : {} +>o : { [x: number]: number; } +>{ [E1.x || E2.x]: 0} : { [x: number]: number; } [E1.x || E2.x]: 0 >E1.x || E2.x : E1 | E2 diff --git a/tests/baselines/reference/computedPropertyNames48_ES5.types b/tests/baselines/reference/computedPropertyNames48_ES5.types index 2b9131a11c8..12752d8abeb 100644 --- a/tests/baselines/reference/computedPropertyNames48_ES5.types +++ b/tests/baselines/reference/computedPropertyNames48_ES5.types @@ -39,9 +39,9 @@ extractIndexer({ }); // Should return string extractIndexer({ ->extractIndexer({ ["" || 0]: ""}) : any +>extractIndexer({ ["" || 0]: ""}) : string >extractIndexer : (p: { [n: number]: T; }) => T ->{ ["" || 0]: ""} : { [x: number]: undefined; } +>{ ["" || 0]: ""} : { [x: string]: string; } ["" || 0]: "" >"" || 0 : string | number diff --git a/tests/baselines/reference/computedPropertyNames48_ES6.types b/tests/baselines/reference/computedPropertyNames48_ES6.types index 2b803b19bd6..832bc3c7025 100644 --- a/tests/baselines/reference/computedPropertyNames48_ES6.types +++ b/tests/baselines/reference/computedPropertyNames48_ES6.types @@ -39,9 +39,9 @@ extractIndexer({ }); // Should return string extractIndexer({ ->extractIndexer({ ["" || 0]: ""}) : any +>extractIndexer({ ["" || 0]: ""}) : string >extractIndexer : (p: { [n: number]: T; }) => T ->{ ["" || 0]: ""} : { [x: number]: undefined; } +>{ ["" || 0]: ""} : { [x: string]: string; } ["" || 0]: "" >"" || 0 : string | number diff --git a/tests/baselines/reference/computedPropertyNames4_ES5.symbols b/tests/baselines/reference/computedPropertyNames4_ES5.symbols index be201486286..e49e333d738 100644 --- a/tests/baselines/reference/computedPropertyNames4_ES5.symbols +++ b/tests/baselines/reference/computedPropertyNames4_ES5.symbols @@ -31,7 +31,11 @@ var v = { >s : Symbol(s, Decl(computedPropertyNames4_ES5.ts, 0, 3)) [""]: 0, +>"" : Symbol([""], Decl(computedPropertyNames4_ES5.ts, 8, 12)) + [0]: 0, +>0 : Symbol([0], Decl(computedPropertyNames4_ES5.ts, 9, 12)) + [a]: 1, >a : Symbol(a, Decl(computedPropertyNames4_ES5.ts, 2, 3)) diff --git a/tests/baselines/reference/computedPropertyNames4_ES5.types b/tests/baselines/reference/computedPropertyNames4_ES5.types index 6984d2e69b8..3c5f884640f 100644 --- a/tests/baselines/reference/computedPropertyNames4_ES5.types +++ b/tests/baselines/reference/computedPropertyNames4_ES5.types @@ -9,8 +9,8 @@ var a: any; >a : any var v = { ->v : { [0]: number; [""]: number; } ->{ [s]: 0, [n]: n, [s + s]: 1, [s + n]: 2, [+s]: s, [""]: 0, [0]: 0, [a]: 1, [true]: 0, [`hello bye`]: 0, [`hello ${a} bye`]: 0} : { [0]: number; [""]: number; } +>v : { [x: string]: number | string; [x: number]: number | string; [0]: number; [""]: number; } +>{ [s]: 0, [n]: n, [s + s]: 1, [s + n]: 2, [+s]: s, [""]: 0, [0]: 0, [a]: 1, [true]: 0, [`hello bye`]: 0, [`hello ${a} bye`]: 0} : { [x: string]: number | string; [x: number]: number | string; [0]: number; [""]: number; } [s]: 0, >s : string diff --git a/tests/baselines/reference/computedPropertyNames4_ES6.symbols b/tests/baselines/reference/computedPropertyNames4_ES6.symbols index b531a1b3d28..345cdb1ad3e 100644 --- a/tests/baselines/reference/computedPropertyNames4_ES6.symbols +++ b/tests/baselines/reference/computedPropertyNames4_ES6.symbols @@ -31,7 +31,11 @@ var v = { >s : Symbol(s, Decl(computedPropertyNames4_ES6.ts, 0, 3)) [""]: 0, +>"" : Symbol([""], Decl(computedPropertyNames4_ES6.ts, 8, 12)) + [0]: 0, +>0 : Symbol([0], Decl(computedPropertyNames4_ES6.ts, 9, 12)) + [a]: 1, >a : Symbol(a, Decl(computedPropertyNames4_ES6.ts, 2, 3)) diff --git a/tests/baselines/reference/computedPropertyNames4_ES6.types b/tests/baselines/reference/computedPropertyNames4_ES6.types index 1fece561f5a..335c2415bd0 100644 --- a/tests/baselines/reference/computedPropertyNames4_ES6.types +++ b/tests/baselines/reference/computedPropertyNames4_ES6.types @@ -9,8 +9,8 @@ var a: any; >a : any var v = { ->v : { [0]: number; [""]: number; } ->{ [s]: 0, [n]: n, [s + s]: 1, [s + n]: 2, [+s]: s, [""]: 0, [0]: 0, [a]: 1, [true]: 0, [`hello bye`]: 0, [`hello ${a} bye`]: 0} : { [0]: number; [""]: number; } +>v : { [x: string]: number | string; [x: number]: number | string; [0]: number; [""]: number; } +>{ [s]: 0, [n]: n, [s + s]: 1, [s + n]: 2, [+s]: s, [""]: 0, [0]: 0, [a]: 1, [true]: 0, [`hello bye`]: 0, [`hello ${a} bye`]: 0} : { [x: string]: number | string; [x: number]: number | string; [0]: number; [""]: number; } [s]: 0, >s : string diff --git a/tests/baselines/reference/computedPropertyNames7_ES5.types b/tests/baselines/reference/computedPropertyNames7_ES5.types index 8ebd4d75668..3411198b590 100644 --- a/tests/baselines/reference/computedPropertyNames7_ES5.types +++ b/tests/baselines/reference/computedPropertyNames7_ES5.types @@ -6,8 +6,8 @@ enum E { >member : E } var v = { ->v : {} ->{ [E.member]: 0} : {} +>v : { [x: number]: number; } +>{ [E.member]: 0} : { [x: number]: number; } [E.member]: 0 >E.member : E diff --git a/tests/baselines/reference/computedPropertyNames7_ES6.types b/tests/baselines/reference/computedPropertyNames7_ES6.types index 3a78b9c0ec6..eb72d546dbc 100644 --- a/tests/baselines/reference/computedPropertyNames7_ES6.types +++ b/tests/baselines/reference/computedPropertyNames7_ES6.types @@ -6,8 +6,8 @@ enum E { >member : E } var v = { ->v : {} ->{ [E.member]: 0} : {} +>v : { [x: number]: number; } +>{ [E.member]: 0} : { [x: number]: number; } [E.member]: 0 >E.member : E diff --git a/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.types b/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.types index bea7267d7d1..09cad594624 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.types +++ b/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.types @@ -14,7 +14,7 @@ interface I { var o: I = { >o : I >I : I ->{ ["" + 0](y) { return y.length; }, ["" + 1]: y => y.length} : { [x: string]: (y: string) => number; [x: number]: undefined; } +>{ ["" + 0](y) { return y.length; }, ["" + 1]: y => y.length} : { [x: string]: (y: string) => number; } ["" + 0](y) { return y.length; }, >"" + 0 : string diff --git a/tests/baselines/reference/computedPropertyNamesContextualType1_ES6.symbols b/tests/baselines/reference/computedPropertyNamesContextualType1_ES6.symbols index 56da1f91a5e..ef5d519c3a0 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType1_ES6.symbols +++ b/tests/baselines/reference/computedPropertyNamesContextualType1_ES6.symbols @@ -17,13 +17,13 @@ var o: I = { ["" + 0](y) { return y.length; }, >y : Symbol(y, Decl(computedPropertyNamesContextualType1_ES6.ts, 6, 13)) ->y.length : Symbol(String.length, Decl(lib.d.ts, --, --)) +>y.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) >y : Symbol(y, Decl(computedPropertyNamesContextualType1_ES6.ts, 6, 13)) ->length : Symbol(String.length, Decl(lib.d.ts, --, --)) +>length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) ["" + 1]: y => y.length >y : Symbol(y, Decl(computedPropertyNamesContextualType1_ES6.ts, 7, 13)) ->y.length : Symbol(String.length, Decl(lib.d.ts, --, --)) +>y.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) >y : Symbol(y, Decl(computedPropertyNamesContextualType1_ES6.ts, 7, 13)) ->length : Symbol(String.length, Decl(lib.d.ts, --, --)) +>length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) } diff --git a/tests/baselines/reference/computedPropertyNamesContextualType1_ES6.types b/tests/baselines/reference/computedPropertyNamesContextualType1_ES6.types index c8d0be6e833..d9e9970ebec 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType1_ES6.types +++ b/tests/baselines/reference/computedPropertyNamesContextualType1_ES6.types @@ -14,7 +14,7 @@ interface I { var o: I = { >o : I >I : I ->{ ["" + 0](y) { return y.length; }, ["" + 1]: y => y.length} : { [x: string]: (y: string) => number; [x: number]: undefined; } +>{ ["" + 0](y) { return y.length; }, ["" + 1]: y => y.length} : { [x: string]: (y: string) => number; } ["" + 0](y) { return y.length; }, >"" + 0 : string diff --git a/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.types b/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.types index 52de216b803..5a5c48f2536 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.types +++ b/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.types @@ -14,7 +14,7 @@ interface I { var o: I = { >o : I >I : I ->{ [+"foo"](y) { return y.length; }, [+"bar"]: y => y.length} : { [x: string]: (y: string) => number; [x: number]: (y: string) => number; } +>{ [+"foo"](y) { return y.length; }, [+"bar"]: y => y.length} : { [x: number]: (y: string) => number; } [+"foo"](y) { return y.length; }, >+"foo" : number diff --git a/tests/baselines/reference/computedPropertyNamesContextualType2_ES6.symbols b/tests/baselines/reference/computedPropertyNamesContextualType2_ES6.symbols index 9412a9c8c34..d8cab4c4a52 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType2_ES6.symbols +++ b/tests/baselines/reference/computedPropertyNamesContextualType2_ES6.symbols @@ -17,13 +17,13 @@ var o: I = { [+"foo"](y) { return y.length; }, >y : Symbol(y, Decl(computedPropertyNamesContextualType2_ES6.ts, 6, 13)) ->y.length : Symbol(String.length, Decl(lib.d.ts, --, --)) +>y.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) >y : Symbol(y, Decl(computedPropertyNamesContextualType2_ES6.ts, 6, 13)) ->length : Symbol(String.length, Decl(lib.d.ts, --, --)) +>length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) [+"bar"]: y => y.length >y : Symbol(y, Decl(computedPropertyNamesContextualType2_ES6.ts, 7, 13)) ->y.length : Symbol(String.length, Decl(lib.d.ts, --, --)) +>y.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) >y : Symbol(y, Decl(computedPropertyNamesContextualType2_ES6.ts, 7, 13)) ->length : Symbol(String.length, Decl(lib.d.ts, --, --)) +>length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) } diff --git a/tests/baselines/reference/computedPropertyNamesContextualType2_ES6.types b/tests/baselines/reference/computedPropertyNamesContextualType2_ES6.types index cbbe0edc6a1..330351790ca 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType2_ES6.types +++ b/tests/baselines/reference/computedPropertyNamesContextualType2_ES6.types @@ -14,7 +14,7 @@ interface I { var o: I = { >o : I >I : I ->{ [+"foo"](y) { return y.length; }, [+"bar"]: y => y.length} : { [x: string]: (y: string) => number; [x: number]: (y: string) => number; } +>{ [+"foo"](y) { return y.length; }, [+"bar"]: y => y.length} : { [x: number]: (y: string) => number; } [+"foo"](y) { return y.length; }, >+"foo" : number diff --git a/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.types b/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.types index 5f647fb4c1b..faff27c9154 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.types +++ b/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.types @@ -10,7 +10,7 @@ interface I { var o: I = { >o : I >I : I ->{ [+"foo"](y) { return y.length; }, [+"bar"]: y => y.length} : { [x: string]: (y: string) => number; } +>{ [+"foo"](y) { return y.length; }, [+"bar"]: y => y.length} : { [x: number]: (y: string) => number; } [+"foo"](y) { return y.length; }, >+"foo" : number diff --git a/tests/baselines/reference/computedPropertyNamesContextualType3_ES6.symbols b/tests/baselines/reference/computedPropertyNamesContextualType3_ES6.symbols index 0b53cf3bfe4..deea9bff3df 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType3_ES6.symbols +++ b/tests/baselines/reference/computedPropertyNamesContextualType3_ES6.symbols @@ -13,13 +13,13 @@ var o: I = { [+"foo"](y) { return y.length; }, >y : Symbol(y, Decl(computedPropertyNamesContextualType3_ES6.ts, 5, 13)) ->y.length : Symbol(String.length, Decl(lib.d.ts, --, --)) +>y.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) >y : Symbol(y, Decl(computedPropertyNamesContextualType3_ES6.ts, 5, 13)) ->length : Symbol(String.length, Decl(lib.d.ts, --, --)) +>length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) [+"bar"]: y => y.length >y : Symbol(y, Decl(computedPropertyNamesContextualType3_ES6.ts, 6, 13)) ->y.length : Symbol(String.length, Decl(lib.d.ts, --, --)) +>y.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) >y : Symbol(y, Decl(computedPropertyNamesContextualType3_ES6.ts, 6, 13)) ->length : Symbol(String.length, Decl(lib.d.ts, --, --)) +>length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) } diff --git a/tests/baselines/reference/computedPropertyNamesContextualType3_ES6.types b/tests/baselines/reference/computedPropertyNamesContextualType3_ES6.types index e872df6f1b2..18c32957944 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType3_ES6.types +++ b/tests/baselines/reference/computedPropertyNamesContextualType3_ES6.types @@ -10,7 +10,7 @@ interface I { var o: I = { >o : I >I : I ->{ [+"foo"](y) { return y.length; }, [+"bar"]: y => y.length} : { [x: string]: (y: string) => number; } +>{ [+"foo"](y) { return y.length; }, [+"bar"]: y => y.length} : { [x: number]: (y: string) => number; } [+"foo"](y) { return y.length; }, >+"foo" : number diff --git a/tests/baselines/reference/computedPropertyNamesContextualType4_ES5.types b/tests/baselines/reference/computedPropertyNamesContextualType4_ES5.types index e5a57363ca0..6f75f1a3633 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType4_ES5.types +++ b/tests/baselines/reference/computedPropertyNamesContextualType4_ES5.types @@ -12,7 +12,7 @@ interface I { var o: I = { >o : I >I : I ->{ [""+"foo"]: "", [""+"bar"]: 0} : { [x: string]: string | number; [x: number]: undefined; } +>{ [""+"foo"]: "", [""+"bar"]: 0} : { [x: string]: string | number; } [""+"foo"]: "", >""+"foo" : string diff --git a/tests/baselines/reference/computedPropertyNamesContextualType4_ES6.types b/tests/baselines/reference/computedPropertyNamesContextualType4_ES6.types index bdfa569752b..9ee84176237 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType4_ES6.types +++ b/tests/baselines/reference/computedPropertyNamesContextualType4_ES6.types @@ -12,7 +12,7 @@ interface I { var o: I = { >o : I >I : I ->{ [""+"foo"]: "", [""+"bar"]: 0} : { [x: string]: string | number; [x: number]: undefined; } +>{ [""+"foo"]: "", [""+"bar"]: 0} : { [x: string]: string | number; } [""+"foo"]: "", >""+"foo" : string diff --git a/tests/baselines/reference/computedPropertyNamesContextualType5_ES5.types b/tests/baselines/reference/computedPropertyNamesContextualType5_ES5.types index e142fe937b9..38594f756ab 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType5_ES5.types +++ b/tests/baselines/reference/computedPropertyNamesContextualType5_ES5.types @@ -12,7 +12,7 @@ interface I { var o: I = { >o : I >I : I ->{ [+"foo"]: "", [+"bar"]: 0} : { [x: string]: string | number; [x: number]: string | number; } +>{ [+"foo"]: "", [+"bar"]: 0} : { [x: number]: string | number; } [+"foo"]: "", >+"foo" : number diff --git a/tests/baselines/reference/computedPropertyNamesContextualType5_ES6.types b/tests/baselines/reference/computedPropertyNamesContextualType5_ES6.types index 7b385b36770..a07b2e8cd95 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType5_ES6.types +++ b/tests/baselines/reference/computedPropertyNamesContextualType5_ES6.types @@ -12,7 +12,7 @@ interface I { var o: I = { >o : I >I : I ->{ [+"foo"]: "", [+"bar"]: 0} : { [x: string]: string | number; [x: number]: string | number; } +>{ [+"foo"]: "", [+"bar"]: 0} : { [x: number]: string | number; } [+"foo"]: "", >+"foo" : number diff --git a/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.types b/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.types index a3a393fba0c..b49724ccded 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.types +++ b/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.types @@ -19,7 +19,7 @@ declare function foo(obj: I): T foo({ >foo({ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]}) : string | (() => void) | boolean | number | number[] >foo : (obj: I) => T ->{ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: string]: string | (() => void) | boolean | number | number[]; 0: () => void; p: string; } +>{ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: string]: string | (() => void) | boolean | number | number[]; [x: number]: (() => void) | number | number[]; 0: () => void; p: string; } p: "", >p : string diff --git a/tests/baselines/reference/computedPropertyNamesContextualType6_ES6.types b/tests/baselines/reference/computedPropertyNamesContextualType6_ES6.types index 4abefe44843..e88959d7cdc 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType6_ES6.types +++ b/tests/baselines/reference/computedPropertyNamesContextualType6_ES6.types @@ -19,7 +19,7 @@ declare function foo(obj: I): T foo({ >foo({ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]}) : string | (() => void) | boolean | number | number[] >foo : (obj: I) => T ->{ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: string]: string | (() => void) | boolean | number | number[]; 0: () => void; p: string; } +>{ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: string]: string | (() => void) | boolean | number | number[]; [x: number]: (() => void) | number | number[]; 0: () => void; p: string; } p: "", >p : string diff --git a/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.types b/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.types index ae1004c9819..083388ba975 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.types +++ b/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.types @@ -19,7 +19,7 @@ declare function foo(obj: I): T foo({ >foo({ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]}) : (() => void) | number | number[] >foo : (obj: I) => T ->{ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: number]: (() => void) | number | number[]; 0: () => void; p: string; } +>{ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: string]: string | (() => void) | boolean | number | number[]; [x: number]: (() => void) | number | number[]; 0: () => void; p: string; } p: "", >p : string diff --git a/tests/baselines/reference/computedPropertyNamesContextualType7_ES6.types b/tests/baselines/reference/computedPropertyNamesContextualType7_ES6.types index e98e0fb8941..bc6ae72fb4f 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType7_ES6.types +++ b/tests/baselines/reference/computedPropertyNamesContextualType7_ES6.types @@ -19,7 +19,7 @@ declare function foo(obj: I): T foo({ >foo({ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]}) : (() => void) | number | number[] >foo : (obj: I) => T ->{ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: number]: (() => void) | number | number[]; 0: () => void; p: string; } +>{ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: string]: string | (() => void) | boolean | number | number[]; [x: number]: (() => void) | number | number[]; 0: () => void; p: string; } p: "", >p : string diff --git a/tests/baselines/reference/computedPropertyNamesContextualType8_ES5.errors.txt b/tests/baselines/reference/computedPropertyNamesContextualType8_ES5.errors.txt index 3376243e370..ee36609095a 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType8_ES5.errors.txt +++ b/tests/baselines/reference/computedPropertyNamesContextualType8_ES5.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES5.ts(6,5): error TS2322: Type '{ [x: string]: string | number; [x: number]: undefined; }' is not assignable to type 'I'. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES5.ts(6,5): error TS2322: Type '{ [x: string]: string | number; }' is not assignable to type 'I'. Index signatures are incompatible. Type 'string | number' is not assignable to type 'boolean'. Type 'string' is not assignable to type 'boolean'. @@ -12,7 +12,7 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualTy var o: I = { ~ -!!! error TS2322: Type '{ [x: string]: string | number; [x: number]: undefined; }' is not assignable to type 'I'. +!!! error TS2322: Type '{ [x: string]: string | number; }' is not assignable to type 'I'. !!! error TS2322: Index signatures are incompatible. !!! error TS2322: Type 'string | number' is not assignable to type 'boolean'. !!! error TS2322: Type 'string' is not assignable to type 'boolean'. diff --git a/tests/baselines/reference/computedPropertyNamesContextualType8_ES6.errors.txt b/tests/baselines/reference/computedPropertyNamesContextualType8_ES6.errors.txt index e4540337ed4..1048fd2e119 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType8_ES6.errors.txt +++ b/tests/baselines/reference/computedPropertyNamesContextualType8_ES6.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES6.ts(6,5): error TS2322: Type '{ [x: string]: string | number; [x: number]: undefined; }' is not assignable to type 'I'. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES6.ts(6,5): error TS2322: Type '{ [x: string]: string | number; }' is not assignable to type 'I'. Index signatures are incompatible. Type 'string | number' is not assignable to type 'boolean'. Type 'string' is not assignable to type 'boolean'. @@ -12,7 +12,7 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualTy var o: I = { ~ -!!! error TS2322: Type '{ [x: string]: string | number; [x: number]: undefined; }' is not assignable to type 'I'. +!!! error TS2322: Type '{ [x: string]: string | number; }' is not assignable to type 'I'. !!! error TS2322: Index signatures are incompatible. !!! error TS2322: Type 'string | number' is not assignable to type 'boolean'. !!! error TS2322: Type 'string' is not assignable to type 'boolean'. diff --git a/tests/baselines/reference/computedPropertyNamesContextualType9_ES5.errors.txt b/tests/baselines/reference/computedPropertyNamesContextualType9_ES5.errors.txt index d4085a37e60..e76b3a704dc 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType9_ES5.errors.txt +++ b/tests/baselines/reference/computedPropertyNamesContextualType9_ES5.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9_ES5.ts(6,5): error TS2322: Type '{ [x: string]: string | number; [x: number]: string | number; }' is not assignable to type 'I'. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9_ES5.ts(6,5): error TS2322: Type '{ [x: number]: string | number; }' is not assignable to type 'I'. Index signatures are incompatible. Type 'string | number' is not assignable to type 'boolean'. Type 'string' is not assignable to type 'boolean'. @@ -12,7 +12,7 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualTy var o: I = { ~ -!!! error TS2322: Type '{ [x: string]: string | number; [x: number]: string | number; }' is not assignable to type 'I'. +!!! error TS2322: Type '{ [x: number]: string | number; }' is not assignable to type 'I'. !!! error TS2322: Index signatures are incompatible. !!! error TS2322: Type 'string | number' is not assignable to type 'boolean'. !!! error TS2322: Type 'string' is not assignable to type 'boolean'. diff --git a/tests/baselines/reference/computedPropertyNamesContextualType9_ES6.errors.txt b/tests/baselines/reference/computedPropertyNamesContextualType9_ES6.errors.txt index eca1360c26f..468ad400c26 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType9_ES6.errors.txt +++ b/tests/baselines/reference/computedPropertyNamesContextualType9_ES6.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9_ES6.ts(6,5): error TS2322: Type '{ [x: string]: string | number; [x: number]: string | number; }' is not assignable to type 'I'. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9_ES6.ts(6,5): error TS2322: Type '{ [x: number]: string | number; }' is not assignable to type 'I'. Index signatures are incompatible. Type 'string | number' is not assignable to type 'boolean'. Type 'string' is not assignable to type 'boolean'. @@ -12,7 +12,7 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualTy var o: I = { ~ -!!! error TS2322: Type '{ [x: string]: string | number; [x: number]: string | number; }' is not assignable to type 'I'. +!!! error TS2322: Type '{ [x: number]: string | number; }' is not assignable to type 'I'. !!! error TS2322: Index signatures are incompatible. !!! error TS2322: Type 'string | number' is not assignable to type 'boolean'. !!! error TS2322: Type 'string' is not assignable to type 'boolean'. diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.js index e77eb79dc70..f04ea61379d 100644 --- a/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.js @@ -26,4 +26,6 @@ var _a; //// [computedPropertyNamesDeclarationEmit5_ES5.d.ts] -declare var v: {}; +declare var v: { + [x: string]: any; +}; diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.types b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.types index 62faa5c2716..0653059b535 100644 --- a/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.types +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.types @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit5_ES5.ts === var v = { ->v : {} ->{ ["" + ""]: 0, ["" + ""]() { }, get ["" + ""]() { return 0; }, set ["" + ""](x) { }} : {} +>v : { [x: string]: any; } +>{ ["" + ""]: 0, ["" + ""]() { }, get ["" + ""]() { return 0; }, set ["" + ""](x) { }} : { [x: string]: any; } ["" + ""]: 0, >"" + "" : string diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES6.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES6.js index e19ac43656e..de1f8c65d7f 100644 --- a/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES6.js +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES6.js @@ -16,4 +16,6 @@ var v = { //// [computedPropertyNamesDeclarationEmit5_ES6.d.ts] -declare var v: {}; +declare var v: { + [x: string]: any; +}; diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES6.types b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES6.types index 3eb313d2687..45d1e74f24a 100644 --- a/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES6.types +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES6.types @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit5_ES6.ts === var v = { ->v : {} ->{ ["" + ""]: 0, ["" + ""]() { }, get ["" + ""]() { return 0; }, set ["" + ""](x) { }} : {} +>v : { [x: string]: any; } +>{ ["" + ""]: 0, ["" + ""]() { }, get ["" + ""]() { return 0; }, set ["" + ""](x) { }} : { [x: string]: any; } ["" + ""]: 0, >"" + "" : string diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.js b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.js index 5c4be60bc6e..b03f4d3696e 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.js @@ -3,6 +3,9 @@ class C { ["hello"]() { debugger; } + get ["goodbye"]() { + return 0; + } } //// [computedPropertyNamesSourceMap1_ES5.js] @@ -12,6 +15,13 @@ var C = (function () { C.prototype["hello"] = function () { debugger; }; + Object.defineProperty(C.prototype, "goodbye", { + get: function () { + return 0; + }, + enumerable: true, + configurable: true + }); return C; }()); //# sourceMappingURL=computedPropertyNamesSourceMap1_ES5.js.map \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.js.map b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.js.map index e8d4e52ad96..e94da4e3f80 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.js.map +++ b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.js.map @@ -1,2 +1,2 @@ //// [computedPropertyNamesSourceMap1_ES5.js.map] -{"version":3,"file":"computedPropertyNamesSourceMap1_ES5.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap1_ES5.ts"],"names":[],"mappings":"AAAA;IAAA;IAIA,CAAC;IAHG,YAAC,OAAO,CAAC,GAAT;QACI,QAAQ,CAAC;IACb,CAAC;IACL,QAAC;AAAD,CAAC,AAJD,IAIC"} \ No newline at end of file +{"version":3,"file":"computedPropertyNamesSourceMap1_ES5.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap1_ES5.ts"],"names":[],"mappings":"AAAA;IAAA;IAOA,CAAC;IANG,YAAC,OAAO,CAAC,GAAT;QACI,QAAQ,CAAC;IACb,CAAC;IACD,sBAAI,aAAC,SAAU;aAAf;YACF,MAAM,CAAC,CAAC,CAAC;QACP,CAAC;;;OAAA;IACL,QAAC;AAAD,CAAC,AAPD,IAOC"} \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.sourcemap.txt b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.sourcemap.txt index 3a64433a709..41484b97c66 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.sourcemap.txt +++ b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.sourcemap.txt @@ -28,10 +28,13 @@ sourceFile:computedPropertyNamesSourceMap1_ES5.ts > ["hello"]() { > debugger; > } + > get ["goodbye"]() { + > return 0; + > } > 2 > } -1->Emitted(3, 5) Source(5, 1) + SourceIndex(0) -2 >Emitted(3, 6) Source(5, 2) + SourceIndex(0) +1->Emitted(3, 5) Source(8, 1) + SourceIndex(0) +2 >Emitted(3, 6) Source(8, 2) + SourceIndex(0) --- >>> C.prototype["hello"] = function () { 1->^^^^ @@ -65,21 +68,78 @@ sourceFile:computedPropertyNamesSourceMap1_ES5.ts >>> }; 1 >^^^^ 2 > ^ -3 > ^^^^^^^^^-> +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > > 2 > } 1 >Emitted(6, 5) Source(4, 5) + SourceIndex(0) 2 >Emitted(6, 6) Source(4, 6) + SourceIndex(0) --- +>>> Object.defineProperty(C.prototype, "goodbye", { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^ +4 > ^^^^^^^^^ +1-> + > +2 > get +3 > [ +4 > "goodbye"] +1->Emitted(7, 5) Source(5, 5) + SourceIndex(0) +2 >Emitted(7, 27) Source(5, 9) + SourceIndex(0) +3 >Emitted(7, 40) Source(5, 10) + SourceIndex(0) +4 >Emitted(7, 49) Source(5, 20) + SourceIndex(0) +--- +>>> get: function () { +1 >^^^^^^^^^^^^^ +2 > ^^^^^^^^^-> +1 > +1 >Emitted(8, 14) Source(5, 5) + SourceIndex(0) +--- +>>> return 0; +1->^^^^^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^ +5 > ^ +1->get ["goodbye"]() { + > +2 > return +3 > +4 > 0 +5 > ; +1->Emitted(9, 13) Source(6, 3) + SourceIndex(0) +2 >Emitted(9, 19) Source(6, 9) + SourceIndex(0) +3 >Emitted(9, 20) Source(6, 10) + SourceIndex(0) +4 >Emitted(9, 21) Source(6, 11) + SourceIndex(0) +5 >Emitted(9, 22) Source(6, 12) + SourceIndex(0) +--- +>>> }, +1 >^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(10, 9) Source(7, 5) + SourceIndex(0) +2 >Emitted(10, 10) Source(7, 6) + SourceIndex(0) +--- +>>> enumerable: true, +>>> configurable: true +>>> }); +1->^^^^^^^ +2 > ^^^^^^^-> +1-> +1->Emitted(13, 8) Source(7, 6) + SourceIndex(0) +--- >>> return C; 1->^^^^ 2 > ^^^^^^^^ 1-> > 2 > } -1->Emitted(7, 5) Source(5, 1) + SourceIndex(0) -2 >Emitted(7, 13) Source(5, 2) + SourceIndex(0) +1->Emitted(14, 5) Source(8, 1) + SourceIndex(0) +2 >Emitted(14, 13) Source(8, 2) + SourceIndex(0) --- >>>}()); 1 > @@ -94,10 +154,13 @@ sourceFile:computedPropertyNamesSourceMap1_ES5.ts > ["hello"]() { > debugger; > } + > get ["goodbye"]() { + > return 0; + > } > } -1 >Emitted(8, 1) Source(5, 1) + SourceIndex(0) -2 >Emitted(8, 2) Source(5, 2) + SourceIndex(0) -3 >Emitted(8, 2) Source(1, 1) + SourceIndex(0) -4 >Emitted(8, 6) Source(5, 2) + SourceIndex(0) +1 >Emitted(15, 1) Source(8, 1) + SourceIndex(0) +2 >Emitted(15, 2) Source(8, 2) + SourceIndex(0) +3 >Emitted(15, 2) Source(1, 1) + SourceIndex(0) +4 >Emitted(15, 6) Source(8, 2) + SourceIndex(0) --- >>>//# sourceMappingURL=computedPropertyNamesSourceMap1_ES5.js.map \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.symbols b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.symbols index 89463c12c44..9f4f5110e8f 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.symbols +++ b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.symbols @@ -3,6 +3,13 @@ class C { >C : Symbol(C, Decl(computedPropertyNamesSourceMap1_ES5.ts, 0, 0)) ["hello"]() { +>"hello" : Symbol(C[["hello"]], Decl(computedPropertyNamesSourceMap1_ES5.ts, 0, 9)) + debugger; } + get ["goodbye"]() { +>"goodbye" : Symbol(C[["goodbye"]], Decl(computedPropertyNamesSourceMap1_ES5.ts, 3, 5)) + + return 0; + } } diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.types b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.types index 7f467698a62..528591441b0 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.types +++ b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.types @@ -7,4 +7,10 @@ class C { debugger; } + get ["goodbye"]() { +>"goodbye" : string + + return 0; +>0 : number + } } diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.js b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.js index 749ab99b18b..9e2b762d93b 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.js +++ b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.js @@ -2,7 +2,10 @@ class C { ["hello"]() { debugger; - } + } + get ["goodbye"]() { + return 0; + } } //// [computedPropertyNamesSourceMap1_ES6.js] @@ -10,5 +13,8 @@ class C { ["hello"]() { debugger; } + get ["goodbye"]() { + return 0; + } } //# sourceMappingURL=computedPropertyNamesSourceMap1_ES6.js.map \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.js.map b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.js.map index 9ec6d18cc72..0c9a609211f 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.js.map +++ b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.js.map @@ -1,2 +1,2 @@ //// [computedPropertyNamesSourceMap1_ES6.js.map] -{"version":3,"file":"computedPropertyNamesSourceMap1_ES6.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap1_ES6.ts"],"names":[],"mappings":"AAAA;IACI,CAAC,OAAO,CAAC;QACL,QAAQ,CAAC;IACb,CAAC;AACL,CAAC;AAAA"} \ No newline at end of file +{"version":3,"file":"computedPropertyNamesSourceMap1_ES6.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap1_ES6.ts"],"names":[],"mappings":"AAAA;IACI,CAAC,OAAO,CAAC;QACL,QAAQ,CAAC;IAChB,CAAC;IACD,IAAI,CAAC,SAAS,CAAC;QACd,MAAM,CAAC,CAAC,CAAC;IACV,CAAC;AACF,CAAC;AAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.sourcemap.txt b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.sourcemap.txt index b589b7ad8ee..87f6e0f46ce 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.sourcemap.txt +++ b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.sourcemap.txt @@ -45,11 +45,57 @@ sourceFile:computedPropertyNamesSourceMap1_ES6.ts >>> } 1 >^^^^ 2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^-> 1 > - > + > 2 > } -1 >Emitted(4, 5) Source(4, 5) + SourceIndex(0) -2 >Emitted(4, 6) Source(4, 6) + SourceIndex(0) +1 >Emitted(4, 5) Source(4, 2) + SourceIndex(0) +2 >Emitted(4, 6) Source(4, 3) + SourceIndex(0) +--- +>>> get ["goodbye"]() { +1->^^^^ +2 > ^^^^ +3 > ^ +4 > ^^^^^^^^^ +5 > ^ +1-> + > +2 > get +3 > [ +4 > "goodbye" +5 > ] +1->Emitted(5, 5) Source(5, 2) + SourceIndex(0) +2 >Emitted(5, 9) Source(5, 6) + SourceIndex(0) +3 >Emitted(5, 10) Source(5, 7) + SourceIndex(0) +4 >Emitted(5, 19) Source(5, 16) + SourceIndex(0) +5 >Emitted(5, 20) Source(5, 17) + SourceIndex(0) +--- +>>> return 0; +1 >^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^ +5 > ^ +1 >() { + > +2 > return +3 > +4 > 0 +5 > ; +1 >Emitted(6, 9) Source(6, 3) + SourceIndex(0) +2 >Emitted(6, 15) Source(6, 9) + SourceIndex(0) +3 >Emitted(6, 16) Source(6, 10) + SourceIndex(0) +4 >Emitted(6, 17) Source(6, 11) + SourceIndex(0) +5 >Emitted(6, 18) Source(6, 12) + SourceIndex(0) +--- +>>> } +1 >^^^^ +2 > ^ +1 > + > +2 > } +1 >Emitted(7, 5) Source(7, 2) + SourceIndex(0) +2 >Emitted(7, 6) Source(7, 3) + SourceIndex(0) --- >>>} 1 > @@ -58,11 +104,11 @@ sourceFile:computedPropertyNamesSourceMap1_ES6.ts 1 > > 2 >} -1 >Emitted(5, 1) Source(5, 1) + SourceIndex(0) -2 >Emitted(5, 2) Source(5, 2) + SourceIndex(0) +1 >Emitted(8, 1) Source(8, 1) + SourceIndex(0) +2 >Emitted(8, 2) Source(8, 2) + SourceIndex(0) --- >>>//# sourceMappingURL=computedPropertyNamesSourceMap1_ES6.js.map1-> -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> -1->Emitted(6, 1) Source(5, 2) + SourceIndex(0) +1->Emitted(9, 1) Source(8, 2) + SourceIndex(0) --- \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.symbols b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.symbols index 45d2acb2b10..447bbaebb7c 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.symbols +++ b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.symbols @@ -3,6 +3,13 @@ class C { >C : Symbol(C, Decl(computedPropertyNamesSourceMap1_ES6.ts, 0, 0)) ["hello"]() { +>"hello" : Symbol(C[["hello"]], Decl(computedPropertyNamesSourceMap1_ES6.ts, 0, 9)) + debugger; - } + } + get ["goodbye"]() { +>"goodbye" : Symbol(C[["goodbye"]], Decl(computedPropertyNamesSourceMap1_ES6.ts, 3, 2)) + + return 0; + } } diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.types b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.types index 4a78685e8a9..cd7b75384b0 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.types +++ b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.types @@ -6,5 +6,11 @@ class C { >"hello" : string debugger; - } + } + get ["goodbye"]() { +>"goodbye" : string + + return 0; +>0 : number + } } diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js index 39e393c46cc..62285665bd0 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js @@ -2,7 +2,10 @@ var v = { ["hello"]() { debugger; - } + }, + get ["goodbye"]() { + return 0; + } } //// [computedPropertyNamesSourceMap2_ES5.js] @@ -10,6 +13,13 @@ var v = (_a = {}, _a["hello"] = function () { debugger; }, + Object.defineProperty(_a, "goodbye", { + get: function () { + return 0; + }, + enumerable: true, + configurable: true + }), _a ); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js.map b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js.map index baf1e998efd..74c3e241086 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js.map +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js.map @@ -1,2 +1,2 @@ //// [computedPropertyNamesSourceMap2_ES5.js.map] -{"version":3,"file":"computedPropertyNamesSourceMap2_ES5.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap2_ES5.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,GAAG;IACJ,GAAC,OAAO,CAAC,GAAT;QACI,QAAQ,CAAC;IACb,CAAC;;CACJ,CAAA"} \ No newline at end of file +{"version":3,"file":"computedPropertyNamesSourceMap2_ES5.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap2_ES5.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,GAAG;IACJ,GAAC,OAAO,CAAC,GAAT;QACI,QAAQ,CAAC;IAChB,CAAC;IACE,0BAAK,SAAU;aAAf;YACF,MAAM,CAAC,CAAC,CAAC;QACV,CAAC;;;MAAA;;CACD,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.sourcemap.txt b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.sourcemap.txt index f6501777985..280cd68b0cd 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.sourcemap.txt +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.sourcemap.txt @@ -56,12 +56,66 @@ sourceFile:computedPropertyNamesSourceMap2_ES5.ts >>> }, 1 >^^^^ 2 > ^ -3 > ^^-> +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > - > + > 2 > } -1 >Emitted(4, 5) Source(4, 5) + SourceIndex(0) -2 >Emitted(4, 6) Source(4, 6) + SourceIndex(0) +1 >Emitted(4, 5) Source(4, 2) + SourceIndex(0) +2 >Emitted(4, 6) Source(4, 3) + SourceIndex(0) +--- +>>> Object.defineProperty(_a, "goodbye", { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^ +1->, + > +2 > get [ +3 > "goodbye"] +1->Emitted(5, 5) Source(5, 5) + SourceIndex(0) +2 >Emitted(5, 31) Source(5, 10) + SourceIndex(0) +3 >Emitted(5, 40) Source(5, 20) + SourceIndex(0) +--- +>>> get: function () { +1 >^^^^^^^^^^^^^ +2 > ^^^^^^^^^-> +1 > +1 >Emitted(6, 14) Source(5, 5) + SourceIndex(0) +--- +>>> return 0; +1->^^^^^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^ +5 > ^ +1->get ["goodbye"]() { + > +2 > return +3 > +4 > 0 +5 > ; +1->Emitted(7, 13) Source(6, 3) + SourceIndex(0) +2 >Emitted(7, 19) Source(6, 9) + SourceIndex(0) +3 >Emitted(7, 20) Source(6, 10) + SourceIndex(0) +4 >Emitted(7, 21) Source(6, 11) + SourceIndex(0) +5 >Emitted(7, 22) Source(6, 12) + SourceIndex(0) +--- +>>> }, +1 >^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(8, 9) Source(7, 2) + SourceIndex(0) +2 >Emitted(8, 10) Source(7, 3) + SourceIndex(0) +--- +>>> enumerable: true, +>>> configurable: true +>>> }), +1->^^^^^^ +2 > ^-> +1-> +1->Emitted(11, 7) Source(7, 3) + SourceIndex(0) --- >>> _a >>>); @@ -71,8 +125,8 @@ sourceFile:computedPropertyNamesSourceMap2_ES5.ts 1-> >} 2 > -1->Emitted(6, 2) Source(5, 2) + SourceIndex(0) -2 >Emitted(6, 3) Source(5, 2) + SourceIndex(0) +1->Emitted(13, 2) Source(8, 2) + SourceIndex(0) +2 >Emitted(13, 3) Source(8, 2) + SourceIndex(0) --- >>>var _a; >>>//# sourceMappingURL=computedPropertyNamesSourceMap2_ES5.js.map \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.symbols b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.symbols index b9a389da636..e01453c1d12 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.symbols +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.symbols @@ -3,6 +3,13 @@ var v = { >v : Symbol(v, Decl(computedPropertyNamesSourceMap2_ES5.ts, 0, 3)) ["hello"]() { +>"hello" : Symbol(["hello"], Decl(computedPropertyNamesSourceMap2_ES5.ts, 0, 9)) + debugger; - } + }, + get ["goodbye"]() { +>"goodbye" : Symbol(["goodbye"], Decl(computedPropertyNamesSourceMap2_ES5.ts, 3, 3)) + + return 0; + } } diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.types b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.types index 147b2966509..29b64c990c2 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.types +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.types @@ -1,11 +1,17 @@ === tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2_ES5.ts === var v = { ->v : { ["hello"](): void; } ->{ ["hello"]() { debugger; }} : { ["hello"](): void; } +>v : { ["hello"](): void; readonly ["goodbye"]: number; } +>{ ["hello"]() { debugger; }, get ["goodbye"]() { return 0; }} : { ["hello"](): void; readonly ["goodbye"]: number; } ["hello"]() { >"hello" : string debugger; - } + }, + get ["goodbye"]() { +>"goodbye" : string + + return 0; +>0 : number + } } diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES6.js b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES6.js index 3d0274e65c7..d342fe272eb 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES6.js +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES6.js @@ -2,13 +2,19 @@ var v = { ["hello"]() { debugger; - } + }, + get ["goodbye"]() { + return 0; + } } //// [computedPropertyNamesSourceMap2_ES6.js] var v = { ["hello"]() { debugger; + }, + get ["goodbye"]() { + return 0; } }; //# sourceMappingURL=computedPropertyNamesSourceMap2_ES6.js.map \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES6.js.map b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES6.js.map index f8ca7ab5845..e1f238177b2 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES6.js.map +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES6.js.map @@ -1,2 +1,2 @@ //// [computedPropertyNamesSourceMap2_ES6.js.map] -{"version":3,"file":"computedPropertyNamesSourceMap2_ES6.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap2_ES6.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,GAAG;IACJ,CAAC,OAAO,CAAC;QACL,QAAQ,CAAC;IACb,CAAC;CACJ,CAAA"} \ No newline at end of file +{"version":3,"file":"computedPropertyNamesSourceMap2_ES6.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap2_ES6.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,GAAG;IACJ,CAAC,OAAO,CAAC;QACL,QAAQ,CAAC;IAChB,CAAC;IACD,IAAI,CAAC,SAAS,CAAC;QACd,MAAM,CAAC,CAAC,CAAC;IACV,CAAC;CACD,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES6.sourcemap.txt b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES6.sourcemap.txt index a6f9086e455..e0aeed1efbd 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES6.sourcemap.txt +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES6.sourcemap.txt @@ -51,14 +51,60 @@ sourceFile:computedPropertyNamesSourceMap2_ES6.ts 2 >Emitted(3, 17) Source(3, 17) + SourceIndex(0) 3 >Emitted(3, 18) Source(3, 18) + SourceIndex(0) --- +>>> }, +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(4, 5) Source(4, 2) + SourceIndex(0) +2 >Emitted(4, 6) Source(4, 3) + SourceIndex(0) +--- +>>> get ["goodbye"]() { +1->^^^^ +2 > ^^^^ +3 > ^ +4 > ^^^^^^^^^ +5 > ^ +1->, + > +2 > get +3 > [ +4 > "goodbye" +5 > ] +1->Emitted(5, 5) Source(5, 2) + SourceIndex(0) +2 >Emitted(5, 9) Source(5, 6) + SourceIndex(0) +3 >Emitted(5, 10) Source(5, 7) + SourceIndex(0) +4 >Emitted(5, 19) Source(5, 16) + SourceIndex(0) +5 >Emitted(5, 20) Source(5, 17) + SourceIndex(0) +--- +>>> return 0; +1 >^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^ +5 > ^ +1 >() { + > +2 > return +3 > +4 > 0 +5 > ; +1 >Emitted(6, 9) Source(6, 3) + SourceIndex(0) +2 >Emitted(6, 15) Source(6, 9) + SourceIndex(0) +3 >Emitted(6, 16) Source(6, 10) + SourceIndex(0) +4 >Emitted(6, 17) Source(6, 11) + SourceIndex(0) +5 >Emitted(6, 18) Source(6, 12) + SourceIndex(0) +--- >>> } 1 >^^^^ 2 > ^ 1 > - > + > 2 > } -1 >Emitted(4, 5) Source(4, 5) + SourceIndex(0) -2 >Emitted(4, 6) Source(4, 6) + SourceIndex(0) +1 >Emitted(7, 5) Source(7, 2) + SourceIndex(0) +2 >Emitted(7, 6) Source(7, 3) + SourceIndex(0) --- >>>}; 1 >^ @@ -67,7 +113,7 @@ sourceFile:computedPropertyNamesSourceMap2_ES6.ts 1 > >} 2 > -1 >Emitted(5, 2) Source(5, 2) + SourceIndex(0) -2 >Emitted(5, 3) Source(5, 2) + SourceIndex(0) +1 >Emitted(8, 2) Source(8, 2) + SourceIndex(0) +2 >Emitted(8, 3) Source(8, 2) + SourceIndex(0) --- >>>//# sourceMappingURL=computedPropertyNamesSourceMap2_ES6.js.map \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES6.symbols b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES6.symbols index 6c9d1e1d5fd..d4b85e28398 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES6.symbols +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES6.symbols @@ -3,6 +3,13 @@ var v = { >v : Symbol(v, Decl(computedPropertyNamesSourceMap2_ES6.ts, 0, 3)) ["hello"]() { +>"hello" : Symbol(["hello"], Decl(computedPropertyNamesSourceMap2_ES6.ts, 0, 9)) + debugger; - } + }, + get ["goodbye"]() { +>"goodbye" : Symbol(["goodbye"], Decl(computedPropertyNamesSourceMap2_ES6.ts, 3, 3)) + + return 0; + } } diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES6.types b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES6.types index 00334680362..fea16b5de8d 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES6.types +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES6.types @@ -1,11 +1,17 @@ === tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2_ES6.ts === var v = { ->v : { ["hello"](): void; } ->{ ["hello"]() { debugger; }} : { ["hello"](): void; } +>v : { ["hello"](): void; readonly ["goodbye"]: number; } +>{ ["hello"]() { debugger; }, get ["goodbye"]() { return 0; }} : { ["hello"](): void; readonly ["goodbye"]: number; } ["hello"]() { >"hello" : string debugger; - } + }, + get ["goodbye"]() { +>"goodbye" : string + + return 0; +>0 : number + } } diff --git a/tests/baselines/reference/concatError.symbols b/tests/baselines/reference/concatError.symbols index d4f04531fc7..23cc55c85be 100644 --- a/tests/baselines/reference/concatError.symbols +++ b/tests/baselines/reference/concatError.symbols @@ -14,15 +14,15 @@ var fa: number[]; fa = fa.concat([0]); >fa : Symbol(fa, Decl(concatError.ts, 8, 3)) ->fa.concat : Symbol(Array.concat, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>fa.concat : Symbol(Array.concat, Decl(lib.d.ts, --, --)) >fa : Symbol(fa, Decl(concatError.ts, 8, 3)) ->concat : Symbol(Array.concat, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>concat : Symbol(Array.concat, Decl(lib.d.ts, --, --)) fa = fa.concat(0); >fa : Symbol(fa, Decl(concatError.ts, 8, 3)) ->fa.concat : Symbol(Array.concat, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>fa.concat : Symbol(Array.concat, Decl(lib.d.ts, --, --)) >fa : Symbol(fa, Decl(concatError.ts, 8, 3)) ->concat : Symbol(Array.concat, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>concat : Symbol(Array.concat, Decl(lib.d.ts, --, --)) diff --git a/tests/baselines/reference/concatError.types b/tests/baselines/reference/concatError.types index c264e0b0204..21a5cc5d089 100644 --- a/tests/baselines/reference/concatError.types +++ b/tests/baselines/reference/concatError.types @@ -16,9 +16,9 @@ fa = fa.concat([0]); >fa = fa.concat([0]) : number[] >fa : number[] >fa.concat([0]) : number[] ->fa.concat : { (...items: U[]): number[]; (...items: number[]): number[]; } +>fa.concat : (...items: (number | number[])[]) => number[] >fa : number[] ->concat : { (...items: U[]): number[]; (...items: number[]): number[]; } +>concat : (...items: (number | number[])[]) => number[] >[0] : number[] >0 : number @@ -26,9 +26,9 @@ fa = fa.concat(0); >fa = fa.concat(0) : number[] >fa : number[] >fa.concat(0) : number[] ->fa.concat : { (...items: U[]): number[]; (...items: number[]): number[]; } +>fa.concat : (...items: (number | number[])[]) => number[] >fa : number[] ->concat : { (...items: U[]): number[]; (...items: number[]): number[]; } +>concat : (...items: (number | number[])[]) => number[] >0 : number diff --git a/tests/baselines/reference/conditionalOperatorConditionIsObjectType.symbols b/tests/baselines/reference/conditionalOperatorConditionIsObjectType.symbols index 0867a708770..2c000f17bf6 100644 --- a/tests/baselines/reference/conditionalOperatorConditionIsObjectType.symbols +++ b/tests/baselines/reference/conditionalOperatorConditionIsObjectType.symbols @@ -120,7 +120,7 @@ foo() ? exprAny1 : exprAny2; >exprAny2 : Symbol(exprAny2, Decl(conditionalOperatorConditionIsObjectType.ts, 9, 3)) new Date() ? exprBoolean1 : exprBoolean2; ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >exprBoolean1 : Symbol(exprBoolean1, Decl(conditionalOperatorConditionIsObjectType.ts, 4, 3)) >exprBoolean2 : Symbol(exprBoolean2, Decl(conditionalOperatorConditionIsObjectType.ts, 10, 3)) @@ -144,7 +144,7 @@ condObject.valueOf() ? exprIsObject1 : exprIsObject2; >exprIsObject2 : Symbol(exprIsObject2, Decl(conditionalOperatorConditionIsObjectType.ts, 13, 3)) new Date() ? exprString1 : exprBoolean1; // union ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >exprString1 : Symbol(exprString1, Decl(conditionalOperatorConditionIsObjectType.ts, 6, 3)) >exprBoolean1 : Symbol(exprBoolean1, Decl(conditionalOperatorConditionIsObjectType.ts, 4, 3)) @@ -237,7 +237,7 @@ var resultIsAny3 = foo() ? exprAny1 : exprAny2; var resultIsBoolean3 = new Date() ? exprBoolean1 : exprBoolean2; >resultIsBoolean3 : Symbol(resultIsBoolean3, Decl(conditionalOperatorConditionIsObjectType.ts, 58, 3)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >exprBoolean1 : Symbol(exprBoolean1, Decl(conditionalOperatorConditionIsObjectType.ts, 4, 3)) >exprBoolean2 : Symbol(exprBoolean2, Decl(conditionalOperatorConditionIsObjectType.ts, 10, 3)) diff --git a/tests/baselines/reference/conditionalOperatorWithIdenticalBCT.symbols b/tests/baselines/reference/conditionalOperatorWithIdenticalBCT.symbols index e4c2e43013d..0453539b1aa 100644 --- a/tests/baselines/reference/conditionalOperatorWithIdenticalBCT.symbols +++ b/tests/baselines/reference/conditionalOperatorWithIdenticalBCT.symbols @@ -2,19 +2,19 @@ //Cond ? Expr1 : Expr2, Expr1 and Expr2 have identical best common type class X { propertyX: any; propertyX1: number; propertyX2: string }; >X : Symbol(X, Decl(conditionalOperatorWithIdenticalBCT.ts, 0, 0)) ->propertyX : Symbol(propertyX, Decl(conditionalOperatorWithIdenticalBCT.ts, 1, 9)) ->propertyX1 : Symbol(propertyX1, Decl(conditionalOperatorWithIdenticalBCT.ts, 1, 25)) ->propertyX2 : Symbol(propertyX2, Decl(conditionalOperatorWithIdenticalBCT.ts, 1, 45)) +>propertyX : Symbol(X.propertyX, Decl(conditionalOperatorWithIdenticalBCT.ts, 1, 9)) +>propertyX1 : Symbol(X.propertyX1, Decl(conditionalOperatorWithIdenticalBCT.ts, 1, 25)) +>propertyX2 : Symbol(X.propertyX2, Decl(conditionalOperatorWithIdenticalBCT.ts, 1, 45)) class A extends X { propertyA: number }; >A : Symbol(A, Decl(conditionalOperatorWithIdenticalBCT.ts, 1, 67)) >X : Symbol(X, Decl(conditionalOperatorWithIdenticalBCT.ts, 0, 0)) ->propertyA : Symbol(propertyA, Decl(conditionalOperatorWithIdenticalBCT.ts, 2, 19)) +>propertyA : Symbol(A.propertyA, Decl(conditionalOperatorWithIdenticalBCT.ts, 2, 19)) class B extends X { propertyB: string }; >B : Symbol(B, Decl(conditionalOperatorWithIdenticalBCT.ts, 2, 40)) >X : Symbol(X, Decl(conditionalOperatorWithIdenticalBCT.ts, 0, 0)) ->propertyB : Symbol(propertyB, Decl(conditionalOperatorWithIdenticalBCT.ts, 3, 19)) +>propertyB : Symbol(B.propertyB, Decl(conditionalOperatorWithIdenticalBCT.ts, 3, 19)) var x: X; >x : Symbol(x, Decl(conditionalOperatorWithIdenticalBCT.ts, 5, 3)) diff --git a/tests/baselines/reference/constDeclarationShadowedByVarDeclaration3.symbols b/tests/baselines/reference/constDeclarationShadowedByVarDeclaration3.symbols index cca4cb6e12c..9867f80ba40 100644 --- a/tests/baselines/reference/constDeclarationShadowedByVarDeclaration3.symbols +++ b/tests/baselines/reference/constDeclarationShadowedByVarDeclaration3.symbols @@ -4,20 +4,20 @@ class Rule { >Rule : Symbol(Rule, Decl(constDeclarationShadowedByVarDeclaration3.ts, 0, 0)) public regex: RegExp = new RegExp(''); ->regex : Symbol(regex, Decl(constDeclarationShadowedByVarDeclaration3.ts, 1, 12)) +>regex : Symbol(Rule.regex, Decl(constDeclarationShadowedByVarDeclaration3.ts, 1, 12)) >RegExp : Symbol(RegExp, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >RegExp : Symbol(RegExp, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) public name: string = ''; ->name : Symbol(name, Decl(constDeclarationShadowedByVarDeclaration3.ts, 2, 42)) +>name : Symbol(Rule.name, Decl(constDeclarationShadowedByVarDeclaration3.ts, 2, 42)) constructor(name: string) { >name : Symbol(name, Decl(constDeclarationShadowedByVarDeclaration3.ts, 5, 16)) this.name = name; ->this.name : Symbol(name, Decl(constDeclarationShadowedByVarDeclaration3.ts, 2, 42)) +>this.name : Symbol(Rule.name, Decl(constDeclarationShadowedByVarDeclaration3.ts, 2, 42)) >this : Symbol(Rule, Decl(constDeclarationShadowedByVarDeclaration3.ts, 0, 0)) ->name : Symbol(name, Decl(constDeclarationShadowedByVarDeclaration3.ts, 2, 42)) +>name : Symbol(Rule.name, Decl(constDeclarationShadowedByVarDeclaration3.ts, 2, 42)) >name : Symbol(name, Decl(constDeclarationShadowedByVarDeclaration3.ts, 5, 16)) } } diff --git a/tests/baselines/reference/constDeclarations-access.errors.txt b/tests/baselines/reference/constDeclarations-access.errors.txt index 04b942aec09..3c748cc4a5f 100644 --- a/tests/baselines/reference/constDeclarations-access.errors.txt +++ b/tests/baselines/reference/constDeclarations-access.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/file2.ts(1,1): error TS2449: The operand of an increment or decrement operator cannot be a constant. +tests/cases/compiler/file2.ts(1,1): error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property. ==== tests/cases/compiler/file1.ts (0 errors) ==== @@ -8,4 +8,4 @@ tests/cases/compiler/file2.ts(1,1): error TS2449: The operand of an increment or ==== tests/cases/compiler/file2.ts (1 errors) ==== x++; ~ -!!! error TS2449: The operand of an increment or decrement operator cannot be a constant. \ No newline at end of file +!!! error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property. \ No newline at end of file diff --git a/tests/baselines/reference/constDeclarations-access2.errors.txt b/tests/baselines/reference/constDeclarations-access2.errors.txt index 6a360e11014..667f490a374 100644 --- a/tests/baselines/reference/constDeclarations-access2.errors.txt +++ b/tests/baselines/reference/constDeclarations-access2.errors.txt @@ -1,20 +1,20 @@ -tests/cases/compiler/constDeclarations-access2.ts(5,1): error TS2450: Left-hand side of assignment expression cannot be a constant. -tests/cases/compiler/constDeclarations-access2.ts(6,1): error TS2450: Left-hand side of assignment expression cannot be a constant. -tests/cases/compiler/constDeclarations-access2.ts(7,1): error TS2450: Left-hand side of assignment expression cannot be a constant. -tests/cases/compiler/constDeclarations-access2.ts(8,1): error TS2450: Left-hand side of assignment expression cannot be a constant. -tests/cases/compiler/constDeclarations-access2.ts(9,1): error TS2450: Left-hand side of assignment expression cannot be a constant. -tests/cases/compiler/constDeclarations-access2.ts(10,1): error TS2450: Left-hand side of assignment expression cannot be a constant. -tests/cases/compiler/constDeclarations-access2.ts(11,1): error TS2450: Left-hand side of assignment expression cannot be a constant. -tests/cases/compiler/constDeclarations-access2.ts(12,1): error TS2450: Left-hand side of assignment expression cannot be a constant. -tests/cases/compiler/constDeclarations-access2.ts(13,1): error TS2450: Left-hand side of assignment expression cannot be a constant. -tests/cases/compiler/constDeclarations-access2.ts(14,1): error TS2450: Left-hand side of assignment expression cannot be a constant. -tests/cases/compiler/constDeclarations-access2.ts(15,1): error TS2450: Left-hand side of assignment expression cannot be a constant. -tests/cases/compiler/constDeclarations-access2.ts(16,1): error TS2450: Left-hand side of assignment expression cannot be a constant. -tests/cases/compiler/constDeclarations-access2.ts(18,1): error TS2449: The operand of an increment or decrement operator cannot be a constant. -tests/cases/compiler/constDeclarations-access2.ts(19,1): error TS2449: The operand of an increment or decrement operator cannot be a constant. -tests/cases/compiler/constDeclarations-access2.ts(20,3): error TS2449: The operand of an increment or decrement operator cannot be a constant. -tests/cases/compiler/constDeclarations-access2.ts(21,3): error TS2449: The operand of an increment or decrement operator cannot be a constant. -tests/cases/compiler/constDeclarations-access2.ts(23,3): error TS2449: The operand of an increment or decrement operator cannot be a constant. +tests/cases/compiler/constDeclarations-access2.ts(5,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. +tests/cases/compiler/constDeclarations-access2.ts(6,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. +tests/cases/compiler/constDeclarations-access2.ts(7,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. +tests/cases/compiler/constDeclarations-access2.ts(8,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. +tests/cases/compiler/constDeclarations-access2.ts(9,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. +tests/cases/compiler/constDeclarations-access2.ts(10,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. +tests/cases/compiler/constDeclarations-access2.ts(11,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. +tests/cases/compiler/constDeclarations-access2.ts(12,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. +tests/cases/compiler/constDeclarations-access2.ts(13,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. +tests/cases/compiler/constDeclarations-access2.ts(14,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. +tests/cases/compiler/constDeclarations-access2.ts(15,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. +tests/cases/compiler/constDeclarations-access2.ts(16,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. +tests/cases/compiler/constDeclarations-access2.ts(18,1): error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property. +tests/cases/compiler/constDeclarations-access2.ts(19,1): error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property. +tests/cases/compiler/constDeclarations-access2.ts(20,3): error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property. +tests/cases/compiler/constDeclarations-access2.ts(21,3): error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property. +tests/cases/compiler/constDeclarations-access2.ts(23,3): error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property. ==== tests/cases/compiler/constDeclarations-access2.ts (17 errors) ==== @@ -24,57 +24,57 @@ tests/cases/compiler/constDeclarations-access2.ts(23,3): error TS2449: The opera // Errors x = 1; ~ -!!! error TS2450: Left-hand side of assignment expression cannot be a constant. +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. x += 2; ~ -!!! error TS2450: Left-hand side of assignment expression cannot be a constant. +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. x -= 3; ~ -!!! error TS2450: Left-hand side of assignment expression cannot be a constant. +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. x *= 4; ~ -!!! error TS2450: Left-hand side of assignment expression cannot be a constant. +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. x /= 5; ~ -!!! error TS2450: Left-hand side of assignment expression cannot be a constant. +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. x %= 6; ~ -!!! error TS2450: Left-hand side of assignment expression cannot be a constant. +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. x <<= 7; ~ -!!! error TS2450: Left-hand side of assignment expression cannot be a constant. +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. x >>= 8; ~ -!!! error TS2450: Left-hand side of assignment expression cannot be a constant. +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. x >>>= 9; ~ -!!! error TS2450: Left-hand side of assignment expression cannot be a constant. +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. x &= 10; ~ -!!! error TS2450: Left-hand side of assignment expression cannot be a constant. +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. x |= 11; ~ -!!! error TS2450: Left-hand side of assignment expression cannot be a constant. +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. x ^= 12; ~ -!!! error TS2450: Left-hand side of assignment expression cannot be a constant. +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. x++; ~ -!!! error TS2449: The operand of an increment or decrement operator cannot be a constant. +!!! error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property. x--; ~ -!!! error TS2449: The operand of an increment or decrement operator cannot be a constant. +!!! error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property. ++x; ~ -!!! error TS2449: The operand of an increment or decrement operator cannot be a constant. +!!! error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property. --x; ~ -!!! error TS2449: The operand of an increment or decrement operator cannot be a constant. +!!! error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property. ++((x)); ~~~~~ -!!! error TS2449: The operand of an increment or decrement operator cannot be a constant. +!!! error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property. // OK var a = x + 1; diff --git a/tests/baselines/reference/constDeclarations-access3.errors.txt b/tests/baselines/reference/constDeclarations-access3.errors.txt index 577b087dff0..a6cb124d28c 100644 --- a/tests/baselines/reference/constDeclarations-access3.errors.txt +++ b/tests/baselines/reference/constDeclarations-access3.errors.txt @@ -1,21 +1,21 @@ -tests/cases/compiler/constDeclarations-access3.ts(8,1): error TS2450: Left-hand side of assignment expression cannot be a constant. -tests/cases/compiler/constDeclarations-access3.ts(9,1): error TS2450: Left-hand side of assignment expression cannot be a constant. -tests/cases/compiler/constDeclarations-access3.ts(10,1): error TS2450: Left-hand side of assignment expression cannot be a constant. -tests/cases/compiler/constDeclarations-access3.ts(11,1): error TS2450: Left-hand side of assignment expression cannot be a constant. -tests/cases/compiler/constDeclarations-access3.ts(12,1): error TS2450: Left-hand side of assignment expression cannot be a constant. -tests/cases/compiler/constDeclarations-access3.ts(13,1): error TS2450: Left-hand side of assignment expression cannot be a constant. -tests/cases/compiler/constDeclarations-access3.ts(14,1): error TS2450: Left-hand side of assignment expression cannot be a constant. -tests/cases/compiler/constDeclarations-access3.ts(15,1): error TS2450: Left-hand side of assignment expression cannot be a constant. -tests/cases/compiler/constDeclarations-access3.ts(16,1): error TS2450: Left-hand side of assignment expression cannot be a constant. -tests/cases/compiler/constDeclarations-access3.ts(17,1): error TS2450: Left-hand side of assignment expression cannot be a constant. -tests/cases/compiler/constDeclarations-access3.ts(18,1): error TS2450: Left-hand side of assignment expression cannot be a constant. -tests/cases/compiler/constDeclarations-access3.ts(19,1): error TS2450: Left-hand side of assignment expression cannot be a constant. -tests/cases/compiler/constDeclarations-access3.ts(21,1): error TS2449: The operand of an increment or decrement operator cannot be a constant. -tests/cases/compiler/constDeclarations-access3.ts(22,1): error TS2449: The operand of an increment or decrement operator cannot be a constant. -tests/cases/compiler/constDeclarations-access3.ts(23,3): error TS2449: The operand of an increment or decrement operator cannot be a constant. -tests/cases/compiler/constDeclarations-access3.ts(24,3): error TS2449: The operand of an increment or decrement operator cannot be a constant. -tests/cases/compiler/constDeclarations-access3.ts(26,3): error TS2449: The operand of an increment or decrement operator cannot be a constant. -tests/cases/compiler/constDeclarations-access3.ts(28,1): error TS2450: Left-hand side of assignment expression cannot be a constant. +tests/cases/compiler/constDeclarations-access3.ts(8,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. +tests/cases/compiler/constDeclarations-access3.ts(9,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. +tests/cases/compiler/constDeclarations-access3.ts(10,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. +tests/cases/compiler/constDeclarations-access3.ts(11,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. +tests/cases/compiler/constDeclarations-access3.ts(12,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. +tests/cases/compiler/constDeclarations-access3.ts(13,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. +tests/cases/compiler/constDeclarations-access3.ts(14,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. +tests/cases/compiler/constDeclarations-access3.ts(15,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. +tests/cases/compiler/constDeclarations-access3.ts(16,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. +tests/cases/compiler/constDeclarations-access3.ts(17,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. +tests/cases/compiler/constDeclarations-access3.ts(18,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. +tests/cases/compiler/constDeclarations-access3.ts(19,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. +tests/cases/compiler/constDeclarations-access3.ts(21,1): error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property. +tests/cases/compiler/constDeclarations-access3.ts(22,1): error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property. +tests/cases/compiler/constDeclarations-access3.ts(23,3): error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property. +tests/cases/compiler/constDeclarations-access3.ts(24,3): error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property. +tests/cases/compiler/constDeclarations-access3.ts(26,3): error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property. +tests/cases/compiler/constDeclarations-access3.ts(28,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. ==== tests/cases/compiler/constDeclarations-access3.ts (18 errors) ==== @@ -28,61 +28,61 @@ tests/cases/compiler/constDeclarations-access3.ts(28,1): error TS2450: Left-hand // Errors M.x = 1; ~~~ -!!! error TS2450: Left-hand side of assignment expression cannot be a constant. +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. M.x += 2; ~~~ -!!! error TS2450: Left-hand side of assignment expression cannot be a constant. +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. M.x -= 3; ~~~ -!!! error TS2450: Left-hand side of assignment expression cannot be a constant. +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. M.x *= 4; ~~~ -!!! error TS2450: Left-hand side of assignment expression cannot be a constant. +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. M.x /= 5; ~~~ -!!! error TS2450: Left-hand side of assignment expression cannot be a constant. +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. M.x %= 6; ~~~ -!!! error TS2450: Left-hand side of assignment expression cannot be a constant. +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. M.x <<= 7; ~~~ -!!! error TS2450: Left-hand side of assignment expression cannot be a constant. +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. M.x >>= 8; ~~~ -!!! error TS2450: Left-hand side of assignment expression cannot be a constant. +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. M.x >>>= 9; ~~~ -!!! error TS2450: Left-hand side of assignment expression cannot be a constant. +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. M.x &= 10; ~~~ -!!! error TS2450: Left-hand side of assignment expression cannot be a constant. +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. M.x |= 11; ~~~ -!!! error TS2450: Left-hand side of assignment expression cannot be a constant. +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. M.x ^= 12; ~~~ -!!! error TS2450: Left-hand side of assignment expression cannot be a constant. +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. M.x++; ~~~ -!!! error TS2449: The operand of an increment or decrement operator cannot be a constant. +!!! error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property. M.x--; ~~~ -!!! error TS2449: The operand of an increment or decrement operator cannot be a constant. +!!! error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property. ++M.x; ~~~ -!!! error TS2449: The operand of an increment or decrement operator cannot be a constant. +!!! error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property. --M.x; ~~~ -!!! error TS2449: The operand of an increment or decrement operator cannot be a constant. +!!! error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property. ++((M.x)); ~~~~~~~ -!!! error TS2449: The operand of an increment or decrement operator cannot be a constant. +!!! error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property. M["x"] = 0; ~~~~~~ -!!! error TS2450: Left-hand side of assignment expression cannot be a constant. +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. // OK var a = M.x + 1; diff --git a/tests/baselines/reference/constDeclarations-access4.errors.txt b/tests/baselines/reference/constDeclarations-access4.errors.txt index 9745c0d2624..3d7d4a704a8 100644 --- a/tests/baselines/reference/constDeclarations-access4.errors.txt +++ b/tests/baselines/reference/constDeclarations-access4.errors.txt @@ -1,21 +1,21 @@ -tests/cases/compiler/constDeclarations-access4.ts(8,1): error TS2450: Left-hand side of assignment expression cannot be a constant. -tests/cases/compiler/constDeclarations-access4.ts(9,1): error TS2450: Left-hand side of assignment expression cannot be a constant. -tests/cases/compiler/constDeclarations-access4.ts(10,1): error TS2450: Left-hand side of assignment expression cannot be a constant. -tests/cases/compiler/constDeclarations-access4.ts(11,1): error TS2450: Left-hand side of assignment expression cannot be a constant. -tests/cases/compiler/constDeclarations-access4.ts(12,1): error TS2450: Left-hand side of assignment expression cannot be a constant. -tests/cases/compiler/constDeclarations-access4.ts(13,1): error TS2450: Left-hand side of assignment expression cannot be a constant. -tests/cases/compiler/constDeclarations-access4.ts(14,1): error TS2450: Left-hand side of assignment expression cannot be a constant. -tests/cases/compiler/constDeclarations-access4.ts(15,1): error TS2450: Left-hand side of assignment expression cannot be a constant. -tests/cases/compiler/constDeclarations-access4.ts(16,1): error TS2450: Left-hand side of assignment expression cannot be a constant. -tests/cases/compiler/constDeclarations-access4.ts(17,1): error TS2450: Left-hand side of assignment expression cannot be a constant. -tests/cases/compiler/constDeclarations-access4.ts(18,1): error TS2450: Left-hand side of assignment expression cannot be a constant. -tests/cases/compiler/constDeclarations-access4.ts(19,1): error TS2450: Left-hand side of assignment expression cannot be a constant. -tests/cases/compiler/constDeclarations-access4.ts(21,1): error TS2449: The operand of an increment or decrement operator cannot be a constant. -tests/cases/compiler/constDeclarations-access4.ts(22,1): error TS2449: The operand of an increment or decrement operator cannot be a constant. -tests/cases/compiler/constDeclarations-access4.ts(23,3): error TS2449: The operand of an increment or decrement operator cannot be a constant. -tests/cases/compiler/constDeclarations-access4.ts(24,3): error TS2449: The operand of an increment or decrement operator cannot be a constant. -tests/cases/compiler/constDeclarations-access4.ts(26,3): error TS2449: The operand of an increment or decrement operator cannot be a constant. -tests/cases/compiler/constDeclarations-access4.ts(28,1): error TS2450: Left-hand side of assignment expression cannot be a constant. +tests/cases/compiler/constDeclarations-access4.ts(8,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. +tests/cases/compiler/constDeclarations-access4.ts(9,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. +tests/cases/compiler/constDeclarations-access4.ts(10,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. +tests/cases/compiler/constDeclarations-access4.ts(11,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. +tests/cases/compiler/constDeclarations-access4.ts(12,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. +tests/cases/compiler/constDeclarations-access4.ts(13,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. +tests/cases/compiler/constDeclarations-access4.ts(14,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. +tests/cases/compiler/constDeclarations-access4.ts(15,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. +tests/cases/compiler/constDeclarations-access4.ts(16,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. +tests/cases/compiler/constDeclarations-access4.ts(17,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. +tests/cases/compiler/constDeclarations-access4.ts(18,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. +tests/cases/compiler/constDeclarations-access4.ts(19,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. +tests/cases/compiler/constDeclarations-access4.ts(21,1): error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property. +tests/cases/compiler/constDeclarations-access4.ts(22,1): error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property. +tests/cases/compiler/constDeclarations-access4.ts(23,3): error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property. +tests/cases/compiler/constDeclarations-access4.ts(24,3): error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property. +tests/cases/compiler/constDeclarations-access4.ts(26,3): error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property. +tests/cases/compiler/constDeclarations-access4.ts(28,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. ==== tests/cases/compiler/constDeclarations-access4.ts (18 errors) ==== @@ -28,61 +28,61 @@ tests/cases/compiler/constDeclarations-access4.ts(28,1): error TS2450: Left-hand // Errors M.x = 1; ~~~ -!!! error TS2450: Left-hand side of assignment expression cannot be a constant. +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. M.x += 2; ~~~ -!!! error TS2450: Left-hand side of assignment expression cannot be a constant. +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. M.x -= 3; ~~~ -!!! error TS2450: Left-hand side of assignment expression cannot be a constant. +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. M.x *= 4; ~~~ -!!! error TS2450: Left-hand side of assignment expression cannot be a constant. +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. M.x /= 5; ~~~ -!!! error TS2450: Left-hand side of assignment expression cannot be a constant. +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. M.x %= 6; ~~~ -!!! error TS2450: Left-hand side of assignment expression cannot be a constant. +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. M.x <<= 7; ~~~ -!!! error TS2450: Left-hand side of assignment expression cannot be a constant. +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. M.x >>= 8; ~~~ -!!! error TS2450: Left-hand side of assignment expression cannot be a constant. +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. M.x >>>= 9; ~~~ -!!! error TS2450: Left-hand side of assignment expression cannot be a constant. +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. M.x &= 10; ~~~ -!!! error TS2450: Left-hand side of assignment expression cannot be a constant. +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. M.x |= 11; ~~~ -!!! error TS2450: Left-hand side of assignment expression cannot be a constant. +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. M.x ^= 12; ~~~ -!!! error TS2450: Left-hand side of assignment expression cannot be a constant. +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. M.x++; ~~~ -!!! error TS2449: The operand of an increment or decrement operator cannot be a constant. +!!! error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property. M.x--; ~~~ -!!! error TS2449: The operand of an increment or decrement operator cannot be a constant. +!!! error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property. ++M.x; ~~~ -!!! error TS2449: The operand of an increment or decrement operator cannot be a constant. +!!! error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property. --M.x; ~~~ -!!! error TS2449: The operand of an increment or decrement operator cannot be a constant. +!!! error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property. ++((M.x)); ~~~~~~~ -!!! error TS2449: The operand of an increment or decrement operator cannot be a constant. +!!! error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property. M["x"] = 0; ~~~~~~ -!!! error TS2450: Left-hand side of assignment expression cannot be a constant. +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. // OK var a = M.x + 1; diff --git a/tests/baselines/reference/constDeclarations-access5.errors.txt b/tests/baselines/reference/constDeclarations-access5.errors.txt index 23200e50ee4..45160bbc7ce 100644 --- a/tests/baselines/reference/constDeclarations-access5.errors.txt +++ b/tests/baselines/reference/constDeclarations-access5.errors.txt @@ -1,21 +1,21 @@ -tests/cases/compiler/constDeclarations_access_2.ts(4,1): error TS2450: Left-hand side of assignment expression cannot be a constant. -tests/cases/compiler/constDeclarations_access_2.ts(5,1): error TS2450: Left-hand side of assignment expression cannot be a constant. -tests/cases/compiler/constDeclarations_access_2.ts(6,1): error TS2450: Left-hand side of assignment expression cannot be a constant. -tests/cases/compiler/constDeclarations_access_2.ts(7,1): error TS2450: Left-hand side of assignment expression cannot be a constant. -tests/cases/compiler/constDeclarations_access_2.ts(8,1): error TS2450: Left-hand side of assignment expression cannot be a constant. -tests/cases/compiler/constDeclarations_access_2.ts(9,1): error TS2450: Left-hand side of assignment expression cannot be a constant. -tests/cases/compiler/constDeclarations_access_2.ts(10,1): error TS2450: Left-hand side of assignment expression cannot be a constant. -tests/cases/compiler/constDeclarations_access_2.ts(11,1): error TS2450: Left-hand side of assignment expression cannot be a constant. -tests/cases/compiler/constDeclarations_access_2.ts(12,1): error TS2450: Left-hand side of assignment expression cannot be a constant. -tests/cases/compiler/constDeclarations_access_2.ts(13,1): error TS2450: Left-hand side of assignment expression cannot be a constant. -tests/cases/compiler/constDeclarations_access_2.ts(14,1): error TS2450: Left-hand side of assignment expression cannot be a constant. -tests/cases/compiler/constDeclarations_access_2.ts(15,1): error TS2450: Left-hand side of assignment expression cannot be a constant. -tests/cases/compiler/constDeclarations_access_2.ts(17,1): error TS2449: The operand of an increment or decrement operator cannot be a constant. -tests/cases/compiler/constDeclarations_access_2.ts(18,1): error TS2449: The operand of an increment or decrement operator cannot be a constant. -tests/cases/compiler/constDeclarations_access_2.ts(19,3): error TS2449: The operand of an increment or decrement operator cannot be a constant. -tests/cases/compiler/constDeclarations_access_2.ts(20,3): error TS2449: The operand of an increment or decrement operator cannot be a constant. -tests/cases/compiler/constDeclarations_access_2.ts(22,3): error TS2449: The operand of an increment or decrement operator cannot be a constant. -tests/cases/compiler/constDeclarations_access_2.ts(24,1): error TS2450: Left-hand side of assignment expression cannot be a constant. +tests/cases/compiler/constDeclarations_access_2.ts(4,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. +tests/cases/compiler/constDeclarations_access_2.ts(5,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. +tests/cases/compiler/constDeclarations_access_2.ts(6,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. +tests/cases/compiler/constDeclarations_access_2.ts(7,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. +tests/cases/compiler/constDeclarations_access_2.ts(8,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. +tests/cases/compiler/constDeclarations_access_2.ts(9,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. +tests/cases/compiler/constDeclarations_access_2.ts(10,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. +tests/cases/compiler/constDeclarations_access_2.ts(11,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. +tests/cases/compiler/constDeclarations_access_2.ts(12,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. +tests/cases/compiler/constDeclarations_access_2.ts(13,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. +tests/cases/compiler/constDeclarations_access_2.ts(14,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. +tests/cases/compiler/constDeclarations_access_2.ts(15,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. +tests/cases/compiler/constDeclarations_access_2.ts(17,1): error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property. +tests/cases/compiler/constDeclarations_access_2.ts(18,1): error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property. +tests/cases/compiler/constDeclarations_access_2.ts(19,3): error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property. +tests/cases/compiler/constDeclarations_access_2.ts(20,3): error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property. +tests/cases/compiler/constDeclarations_access_2.ts(22,3): error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property. +tests/cases/compiler/constDeclarations_access_2.ts(24,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. ==== tests/cases/compiler/constDeclarations_access_2.ts (18 errors) ==== @@ -24,61 +24,61 @@ tests/cases/compiler/constDeclarations_access_2.ts(24,1): error TS2450: Left-han // Errors m.x = 1; ~~~ -!!! error TS2450: Left-hand side of assignment expression cannot be a constant. +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. m.x += 2; ~~~ -!!! error TS2450: Left-hand side of assignment expression cannot be a constant. +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. m.x -= 3; ~~~ -!!! error TS2450: Left-hand side of assignment expression cannot be a constant. +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. m.x *= 4; ~~~ -!!! error TS2450: Left-hand side of assignment expression cannot be a constant. +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. m.x /= 5; ~~~ -!!! error TS2450: Left-hand side of assignment expression cannot be a constant. +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. m.x %= 6; ~~~ -!!! error TS2450: Left-hand side of assignment expression cannot be a constant. +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. m.x <<= 7; ~~~ -!!! error TS2450: Left-hand side of assignment expression cannot be a constant. +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. m.x >>= 8; ~~~ -!!! error TS2450: Left-hand side of assignment expression cannot be a constant. +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. m.x >>>= 9; ~~~ -!!! error TS2450: Left-hand side of assignment expression cannot be a constant. +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. m.x &= 10; ~~~ -!!! error TS2450: Left-hand side of assignment expression cannot be a constant. +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. m.x |= 11; ~~~ -!!! error TS2450: Left-hand side of assignment expression cannot be a constant. +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. m.x ^= 12; ~~~ -!!! error TS2450: Left-hand side of assignment expression cannot be a constant. +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. m m.x++; ~~~ -!!! error TS2449: The operand of an increment or decrement operator cannot be a constant. +!!! error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property. m.x--; ~~~ -!!! error TS2449: The operand of an increment or decrement operator cannot be a constant. +!!! error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property. ++m.x; ~~~ -!!! error TS2449: The operand of an increment or decrement operator cannot be a constant. +!!! error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property. --m.x; ~~~ -!!! error TS2449: The operand of an increment or decrement operator cannot be a constant. +!!! error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property. ++((m.x)); ~~~~~~~ -!!! error TS2449: The operand of an increment or decrement operator cannot be a constant. +!!! error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property. m["x"] = 0; ~~~~~~ -!!! error TS2450: Left-hand side of assignment expression cannot be a constant. +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. // OK var a = m.x + 1; diff --git a/tests/baselines/reference/constDeclarations-errors.errors.txt b/tests/baselines/reference/constDeclarations-errors.errors.txt index 10501beb1a5..98b12b616f7 100644 --- a/tests/baselines/reference/constDeclarations-errors.errors.txt +++ b/tests/baselines/reference/constDeclarations-errors.errors.txt @@ -4,7 +4,7 @@ tests/cases/compiler/constDeclarations-errors.ts(5,7): error TS1155: 'const' dec tests/cases/compiler/constDeclarations-errors.ts(5,11): error TS1155: 'const' declarations must be initialized tests/cases/compiler/constDeclarations-errors.ts(5,15): error TS1155: 'const' declarations must be initialized tests/cases/compiler/constDeclarations-errors.ts(5,27): error TS1155: 'const' declarations must be initialized -tests/cases/compiler/constDeclarations-errors.ts(10,27): error TS2449: The operand of an increment or decrement operator cannot be a constant. +tests/cases/compiler/constDeclarations-errors.ts(10,27): error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property. tests/cases/compiler/constDeclarations-errors.ts(13,11): error TS1155: 'const' declarations must be initialized tests/cases/compiler/constDeclarations-errors.ts(16,20): error TS1155: 'const' declarations must be initialized @@ -33,7 +33,7 @@ tests/cases/compiler/constDeclarations-errors.ts(16,20): error TS1155: 'const' d // error, assigning to a const for(const c8 = 0; c8 < 1; c8++) { } ~~ -!!! error TS2449: The operand of an increment or decrement operator cannot be a constant. +!!! error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property. // error, can not be unintalized for(const c9; c9 < 1;) { } diff --git a/tests/baselines/reference/constEnumPropertyAccess1.types b/tests/baselines/reference/constEnumPropertyAccess1.types index 5ed2b932bd0..f0e00fe7717 100644 --- a/tests/baselines/reference/constEnumPropertyAccess1.types +++ b/tests/baselines/reference/constEnumPropertyAccess1.types @@ -35,7 +35,7 @@ var o: { >idx : number } = { ->{ 1: true } : { [x: number]: boolean; 1: boolean; } +>{ 1: true } : { 1: boolean; } 1: true >true : boolean diff --git a/tests/baselines/reference/constEnumPropertyAccess2.errors.txt b/tests/baselines/reference/constEnumPropertyAccess2.errors.txt index 19b273faffa..a943ee00962 100644 --- a/tests/baselines/reference/constEnumPropertyAccess2.errors.txt +++ b/tests/baselines/reference/constEnumPropertyAccess2.errors.txt @@ -1,7 +1,7 @@ tests/cases/conformance/constEnums/constEnumPropertyAccess2.ts(14,9): error TS2475: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment. tests/cases/conformance/constEnums/constEnumPropertyAccess2.ts(15,12): error TS2476: A const enum member can only be accessed using a string literal. tests/cases/conformance/constEnums/constEnumPropertyAccess2.ts(17,1): error TS2322: Type 'string' is not assignable to type 'G'. -tests/cases/conformance/constEnums/constEnumPropertyAccess2.ts(19,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/constEnums/constEnumPropertyAccess2.ts(19,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. ==== tests/cases/conformance/constEnums/constEnumPropertyAccess2.ts (4 errors) ==== @@ -31,5 +31,5 @@ tests/cases/conformance/constEnums/constEnumPropertyAccess2.ts(19,1): error TS23 function foo(x: G) { } G.B = 3; ~~~ -!!! error TS2364: Invalid left-hand side of assignment expression. +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. \ No newline at end of file diff --git a/tests/baselines/reference/constIndexedAccess.symbols b/tests/baselines/reference/constIndexedAccess.symbols index 2ccb7f11686..f7ce6b78c2d 100644 --- a/tests/baselines/reference/constIndexedAccess.symbols +++ b/tests/baselines/reference/constIndexedAccess.symbols @@ -24,12 +24,12 @@ let test: indexAccess; let s = test[0]; >s : Symbol(s, Decl(constIndexedAccess.ts, 13, 3)) >test : Symbol(test, Decl(constIndexedAccess.ts, 11, 3)) ->0 : Symbol(indexAccess.0, Decl(constIndexedAccess.ts, 6, 23)) +>0 : Symbol(indexAccess[0], Decl(constIndexedAccess.ts, 6, 23)) let n = test[1]; >n : Symbol(n, Decl(constIndexedAccess.ts, 14, 3)) >test : Symbol(test, Decl(constIndexedAccess.ts, 11, 3)) ->1 : Symbol(indexAccess.1, Decl(constIndexedAccess.ts, 7, 14)) +>1 : Symbol(indexAccess[1], Decl(constIndexedAccess.ts, 7, 14)) let s1 = test[numbers.zero]; >s1 : Symbol(s1, Decl(constIndexedAccess.ts, 16, 3)) diff --git a/tests/baselines/reference/constantOverloadFunction.symbols b/tests/baselines/reference/constantOverloadFunction.symbols index 60234623ed6..6c894602f71 100644 --- a/tests/baselines/reference/constantOverloadFunction.symbols +++ b/tests/baselines/reference/constantOverloadFunction.symbols @@ -1,22 +1,22 @@ === tests/cases/compiler/constantOverloadFunction.ts === class Base { foo() { } } >Base : Symbol(Base, Decl(constantOverloadFunction.ts, 0, 0)) ->foo : Symbol(foo, Decl(constantOverloadFunction.ts, 0, 12)) +>foo : Symbol(Base.foo, Decl(constantOverloadFunction.ts, 0, 12)) class Derived1 extends Base { bar() { } } >Derived1 : Symbol(Derived1, Decl(constantOverloadFunction.ts, 0, 24)) >Base : Symbol(Base, Decl(constantOverloadFunction.ts, 0, 0)) ->bar : Symbol(bar, Decl(constantOverloadFunction.ts, 1, 29)) +>bar : Symbol(Derived1.bar, Decl(constantOverloadFunction.ts, 1, 29)) class Derived2 extends Base { baz() { } } >Derived2 : Symbol(Derived2, Decl(constantOverloadFunction.ts, 1, 41)) >Base : Symbol(Base, Decl(constantOverloadFunction.ts, 0, 0)) ->baz : Symbol(baz, Decl(constantOverloadFunction.ts, 2, 29)) +>baz : Symbol(Derived2.baz, Decl(constantOverloadFunction.ts, 2, 29)) class Derived3 extends Base { biz() { } } >Derived3 : Symbol(Derived3, Decl(constantOverloadFunction.ts, 2, 41)) >Base : Symbol(Base, Decl(constantOverloadFunction.ts, 0, 0)) ->biz : Symbol(biz, Decl(constantOverloadFunction.ts, 3, 29)) +>biz : Symbol(Derived3.biz, Decl(constantOverloadFunction.ts, 3, 29)) function foo(tagName: 'canvas'): Derived1; >foo : Symbol(foo, Decl(constantOverloadFunction.ts, 3, 41), Decl(constantOverloadFunction.ts, 5, 42), Decl(constantOverloadFunction.ts, 6, 40), Decl(constantOverloadFunction.ts, 7, 40), Decl(constantOverloadFunction.ts, 8, 36)) diff --git a/tests/baselines/reference/constantOverloadFunctionNoSubtypeError.errors.txt b/tests/baselines/reference/constantOverloadFunctionNoSubtypeError.errors.txt deleted file mode 100644 index 3c5e6f8efca..00000000000 --- a/tests/baselines/reference/constantOverloadFunctionNoSubtypeError.errors.txt +++ /dev/null @@ -1,26 +0,0 @@ -tests/cases/compiler/constantOverloadFunctionNoSubtypeError.ts(6,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/compiler/constantOverloadFunctionNoSubtypeError.ts(7,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/compiler/constantOverloadFunctionNoSubtypeError.ts(8,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. - - -==== tests/cases/compiler/constantOverloadFunctionNoSubtypeError.ts (3 errors) ==== - class Base { foo() { } } - class Derived1 extends Base { bar() { } } - class Derived2 extends Base { baz() { } } - class Derived3 extends Base { biz() { } } - - function foo(tagName: 'canvas'): Derived3; - ~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. - function foo(tagName: 'div'): Derived2; - ~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. - function foo(tagName: 'span'): Derived1; - ~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. - function foo(tagName: number): Base; - function foo(tagName: any): Base { - - return null; - } - \ No newline at end of file diff --git a/tests/baselines/reference/constantOverloadFunctionNoSubtypeError.symbols b/tests/baselines/reference/constantOverloadFunctionNoSubtypeError.symbols new file mode 100644 index 00000000000..a978214d4c3 --- /dev/null +++ b/tests/baselines/reference/constantOverloadFunctionNoSubtypeError.symbols @@ -0,0 +1,48 @@ +=== tests/cases/compiler/constantOverloadFunctionNoSubtypeError.ts === +class Base { foo() { } } +>Base : Symbol(Base, Decl(constantOverloadFunctionNoSubtypeError.ts, 0, 0)) +>foo : Symbol(Base.foo, Decl(constantOverloadFunctionNoSubtypeError.ts, 0, 12)) + +class Derived1 extends Base { bar() { } } +>Derived1 : Symbol(Derived1, Decl(constantOverloadFunctionNoSubtypeError.ts, 0, 24)) +>Base : Symbol(Base, Decl(constantOverloadFunctionNoSubtypeError.ts, 0, 0)) +>bar : Symbol(Derived1.bar, Decl(constantOverloadFunctionNoSubtypeError.ts, 1, 29)) + +class Derived2 extends Base { baz() { } } +>Derived2 : Symbol(Derived2, Decl(constantOverloadFunctionNoSubtypeError.ts, 1, 41)) +>Base : Symbol(Base, Decl(constantOverloadFunctionNoSubtypeError.ts, 0, 0)) +>baz : Symbol(Derived2.baz, Decl(constantOverloadFunctionNoSubtypeError.ts, 2, 29)) + +class Derived3 extends Base { biz() { } } +>Derived3 : Symbol(Derived3, Decl(constantOverloadFunctionNoSubtypeError.ts, 2, 41)) +>Base : Symbol(Base, Decl(constantOverloadFunctionNoSubtypeError.ts, 0, 0)) +>biz : Symbol(Derived3.biz, Decl(constantOverloadFunctionNoSubtypeError.ts, 3, 29)) + +function foo(tagName: 'canvas'): Derived3; +>foo : Symbol(foo, Decl(constantOverloadFunctionNoSubtypeError.ts, 3, 41), Decl(constantOverloadFunctionNoSubtypeError.ts, 5, 42), Decl(constantOverloadFunctionNoSubtypeError.ts, 6, 40), Decl(constantOverloadFunctionNoSubtypeError.ts, 7, 40), Decl(constantOverloadFunctionNoSubtypeError.ts, 8, 36)) +>tagName : Symbol(tagName, Decl(constantOverloadFunctionNoSubtypeError.ts, 5, 13)) +>Derived3 : Symbol(Derived3, Decl(constantOverloadFunctionNoSubtypeError.ts, 2, 41)) + +function foo(tagName: 'div'): Derived2; +>foo : Symbol(foo, Decl(constantOverloadFunctionNoSubtypeError.ts, 3, 41), Decl(constantOverloadFunctionNoSubtypeError.ts, 5, 42), Decl(constantOverloadFunctionNoSubtypeError.ts, 6, 40), Decl(constantOverloadFunctionNoSubtypeError.ts, 7, 40), Decl(constantOverloadFunctionNoSubtypeError.ts, 8, 36)) +>tagName : Symbol(tagName, Decl(constantOverloadFunctionNoSubtypeError.ts, 6, 13)) +>Derived2 : Symbol(Derived2, Decl(constantOverloadFunctionNoSubtypeError.ts, 1, 41)) + +function foo(tagName: 'span'): Derived1; +>foo : Symbol(foo, Decl(constantOverloadFunctionNoSubtypeError.ts, 3, 41), Decl(constantOverloadFunctionNoSubtypeError.ts, 5, 42), Decl(constantOverloadFunctionNoSubtypeError.ts, 6, 40), Decl(constantOverloadFunctionNoSubtypeError.ts, 7, 40), Decl(constantOverloadFunctionNoSubtypeError.ts, 8, 36)) +>tagName : Symbol(tagName, Decl(constantOverloadFunctionNoSubtypeError.ts, 7, 13)) +>Derived1 : Symbol(Derived1, Decl(constantOverloadFunctionNoSubtypeError.ts, 0, 24)) + +function foo(tagName: number): Base; +>foo : Symbol(foo, Decl(constantOverloadFunctionNoSubtypeError.ts, 3, 41), Decl(constantOverloadFunctionNoSubtypeError.ts, 5, 42), Decl(constantOverloadFunctionNoSubtypeError.ts, 6, 40), Decl(constantOverloadFunctionNoSubtypeError.ts, 7, 40), Decl(constantOverloadFunctionNoSubtypeError.ts, 8, 36)) +>tagName : Symbol(tagName, Decl(constantOverloadFunctionNoSubtypeError.ts, 8, 13)) +>Base : Symbol(Base, Decl(constantOverloadFunctionNoSubtypeError.ts, 0, 0)) + +function foo(tagName: any): Base { +>foo : Symbol(foo, Decl(constantOverloadFunctionNoSubtypeError.ts, 3, 41), Decl(constantOverloadFunctionNoSubtypeError.ts, 5, 42), Decl(constantOverloadFunctionNoSubtypeError.ts, 6, 40), Decl(constantOverloadFunctionNoSubtypeError.ts, 7, 40), Decl(constantOverloadFunctionNoSubtypeError.ts, 8, 36)) +>tagName : Symbol(tagName, Decl(constantOverloadFunctionNoSubtypeError.ts, 9, 13)) +>Base : Symbol(Base, Decl(constantOverloadFunctionNoSubtypeError.ts, 0, 0)) + + return null; +} + diff --git a/tests/baselines/reference/constantOverloadFunctionNoSubtypeError.types b/tests/baselines/reference/constantOverloadFunctionNoSubtypeError.types new file mode 100644 index 00000000000..121faab82d5 --- /dev/null +++ b/tests/baselines/reference/constantOverloadFunctionNoSubtypeError.types @@ -0,0 +1,49 @@ +=== tests/cases/compiler/constantOverloadFunctionNoSubtypeError.ts === +class Base { foo() { } } +>Base : Base +>foo : () => void + +class Derived1 extends Base { bar() { } } +>Derived1 : Derived1 +>Base : Base +>bar : () => void + +class Derived2 extends Base { baz() { } } +>Derived2 : Derived2 +>Base : Base +>baz : () => void + +class Derived3 extends Base { biz() { } } +>Derived3 : Derived3 +>Base : Base +>biz : () => void + +function foo(tagName: 'canvas'): Derived3; +>foo : { (tagName: "canvas"): Derived3; (tagName: "div"): Derived2; (tagName: "span"): Derived1; (tagName: number): Base; } +>tagName : "canvas" +>Derived3 : Derived3 + +function foo(tagName: 'div'): Derived2; +>foo : { (tagName: "canvas"): Derived3; (tagName: "div"): Derived2; (tagName: "span"): Derived1; (tagName: number): Base; } +>tagName : "div" +>Derived2 : Derived2 + +function foo(tagName: 'span'): Derived1; +>foo : { (tagName: "canvas"): Derived3; (tagName: "div"): Derived2; (tagName: "span"): Derived1; (tagName: number): Base; } +>tagName : "span" +>Derived1 : Derived1 + +function foo(tagName: number): Base; +>foo : { (tagName: "canvas"): Derived3; (tagName: "div"): Derived2; (tagName: "span"): Derived1; (tagName: number): Base; } +>tagName : number +>Base : Base + +function foo(tagName: any): Base { +>foo : { (tagName: "canvas"): Derived3; (tagName: "div"): Derived2; (tagName: "span"): Derived1; (tagName: number): Base; } +>tagName : any +>Base : Base + + return null; +>null : null +} + diff --git a/tests/baselines/reference/constraintCheckInGenericBaseTypeReference.symbols b/tests/baselines/reference/constraintCheckInGenericBaseTypeReference.symbols index ad63e11b7ed..ee19c63ffe8 100644 --- a/tests/baselines/reference/constraintCheckInGenericBaseTypeReference.symbols +++ b/tests/baselines/reference/constraintCheckInGenericBaseTypeReference.symbols @@ -4,7 +4,7 @@ class Constraint { >Constraint : Symbol(Constraint, Decl(constraintCheckInGenericBaseTypeReference.ts, 0, 0)) public method() { } ->method : Symbol(method, Decl(constraintCheckInGenericBaseTypeReference.ts, 1, 18)) +>method : Symbol(Constraint.method, Decl(constraintCheckInGenericBaseTypeReference.ts, 1, 18)) } class GenericBase { >GenericBase : Symbol(GenericBase, Decl(constraintCheckInGenericBaseTypeReference.ts, 3, 1)) @@ -12,7 +12,7 @@ class GenericBase { >Constraint : Symbol(Constraint, Decl(constraintCheckInGenericBaseTypeReference.ts, 0, 0)) public items: any; ->items : Symbol(items, Decl(constraintCheckInGenericBaseTypeReference.ts, 4, 41)) +>items : Symbol(GenericBase.items, Decl(constraintCheckInGenericBaseTypeReference.ts, 4, 41)) } class Derived extends GenericBase { >Derived : Symbol(Derived, Decl(constraintCheckInGenericBaseTypeReference.ts, 6, 1)) @@ -24,7 +24,7 @@ class TypeArg { >TypeArg : Symbol(TypeArg, Decl(constraintCheckInGenericBaseTypeReference.ts, 9, 1)) public method() { ->method : Symbol(method, Decl(constraintCheckInGenericBaseTypeReference.ts, 10, 15)) +>method : Symbol(TypeArg.method, Decl(constraintCheckInGenericBaseTypeReference.ts, 10, 15)) Container.People.items; >Container.People.items : Symbol(GenericBase.items, Decl(constraintCheckInGenericBaseTypeReference.ts, 4, 41)) diff --git a/tests/baselines/reference/constraintReferencingTypeParameterFromSameTypeParameterList.symbols b/tests/baselines/reference/constraintReferencingTypeParameterFromSameTypeParameterList.symbols index ec987116a43..4793aa63149 100644 --- a/tests/baselines/reference/constraintReferencingTypeParameterFromSameTypeParameterList.symbols +++ b/tests/baselines/reference/constraintReferencingTypeParameterFromSameTypeParameterList.symbols @@ -41,7 +41,7 @@ interface I3 { >U : Symbol(U, Decl(constraintReferencingTypeParameterFromSameTypeParameterList.ts, 16, 15)) method1(); ->method1 : Symbol(method1, Decl(constraintReferencingTypeParameterFromSameTypeParameterList.ts, 16, 35)) +>method1 : Symbol(I3.method1, Decl(constraintReferencingTypeParameterFromSameTypeParameterList.ts, 16, 35)) >X : Symbol(X, Decl(constraintReferencingTypeParameterFromSameTypeParameterList.ts, 17, 12)) >Y : Symbol(Y, Decl(constraintReferencingTypeParameterFromSameTypeParameterList.ts, 17, 14)) >T : Symbol(T, Decl(constraintReferencingTypeParameterFromSameTypeParameterList.ts, 16, 13)) diff --git a/tests/baselines/reference/constraintSatisfactionWithAny.symbols b/tests/baselines/reference/constraintSatisfactionWithAny.symbols index 52cfe211cff..824035a185c 100644 --- a/tests/baselines/reference/constraintSatisfactionWithAny.symbols +++ b/tests/baselines/reference/constraintSatisfactionWithAny.symbols @@ -4,7 +4,7 @@ function foo(x: T): T { return null; } >foo : Symbol(foo, Decl(constraintSatisfactionWithAny.ts, 0, 0)) >T : Symbol(T, Decl(constraintSatisfactionWithAny.ts, 2, 13)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(constraintSatisfactionWithAny.ts, 2, 31)) >T : Symbol(T, Decl(constraintSatisfactionWithAny.ts, 2, 13)) >T : Symbol(T, Decl(constraintSatisfactionWithAny.ts, 2, 13)) @@ -67,10 +67,10 @@ foo4(b); class C { >C : Symbol(C, Decl(constraintSatisfactionWithAny.ts, 16, 13)) >T : Symbol(T, Decl(constraintSatisfactionWithAny.ts, 22, 8)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) constructor(public x: T) { } ->x : Symbol(x, Decl(constraintSatisfactionWithAny.ts, 23, 16)) +>x : Symbol(C.x, Decl(constraintSatisfactionWithAny.ts, 23, 16)) >T : Symbol(T, Decl(constraintSatisfactionWithAny.ts, 22, 8)) } @@ -90,7 +90,7 @@ class C2 { >x : Symbol(x, Decl(constraintSatisfactionWithAny.ts, 29, 20)) constructor(public x: T) { } ->x : Symbol(x, Decl(constraintSatisfactionWithAny.ts, 30, 16)) +>x : Symbol(C2.x, Decl(constraintSatisfactionWithAny.ts, 30, 16)) >T : Symbol(T, Decl(constraintSatisfactionWithAny.ts, 29, 9)) } @@ -120,7 +120,7 @@ class C4(x:T) => T> { >T : Symbol(T, Decl(constraintSatisfactionWithAny.ts, 43, 20)) constructor(public x: T) { } ->x : Symbol(x, Decl(constraintSatisfactionWithAny.ts, 44, 16)) +>x : Symbol(C4.x, Decl(constraintSatisfactionWithAny.ts, 44, 16)) >T : Symbol(T, Decl(constraintSatisfactionWithAny.ts, 43, 9)) } diff --git a/tests/baselines/reference/constraintSatisfactionWithEmptyObject.symbols b/tests/baselines/reference/constraintSatisfactionWithEmptyObject.symbols index d53e51b6623..a766234e6aa 100644 --- a/tests/baselines/reference/constraintSatisfactionWithEmptyObject.symbols +++ b/tests/baselines/reference/constraintSatisfactionWithEmptyObject.symbols @@ -26,7 +26,7 @@ class C { >Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) constructor(public x: T) { } ->x : Symbol(x, Decl(constraintSatisfactionWithEmptyObject.ts, 9, 16)) +>x : Symbol(C.x, Decl(constraintSatisfactionWithEmptyObject.ts, 9, 16)) >T : Symbol(T, Decl(constraintSatisfactionWithEmptyObject.ts, 8, 8)) } @@ -40,7 +40,7 @@ interface I { >Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) x: T; ->x : Symbol(x, Decl(constraintSatisfactionWithEmptyObject.ts, 14, 31)) +>x : Symbol(I.x, Decl(constraintSatisfactionWithEmptyObject.ts, 14, 31)) >T : Symbol(T, Decl(constraintSatisfactionWithEmptyObject.ts, 14, 12)) } var i: I<{}>; @@ -70,7 +70,7 @@ class C2 { >T : Symbol(T, Decl(constraintSatisfactionWithEmptyObject.ts, 25, 9)) constructor(public x: T) { } ->x : Symbol(x, Decl(constraintSatisfactionWithEmptyObject.ts, 26, 16)) +>x : Symbol(C2.x, Decl(constraintSatisfactionWithEmptyObject.ts, 26, 16)) >T : Symbol(T, Decl(constraintSatisfactionWithEmptyObject.ts, 25, 9)) } @@ -83,7 +83,7 @@ interface I2 { >T : Symbol(T, Decl(constraintSatisfactionWithEmptyObject.ts, 31, 13)) x: T; ->x : Symbol(x, Decl(constraintSatisfactionWithEmptyObject.ts, 31, 28)) +>x : Symbol(I2.x, Decl(constraintSatisfactionWithEmptyObject.ts, 31, 28)) >T : Symbol(T, Decl(constraintSatisfactionWithEmptyObject.ts, 31, 13)) } var i2: I2<{}>; diff --git a/tests/baselines/reference/constraintsThatReferenceOtherContstraints1.symbols b/tests/baselines/reference/constraintsThatReferenceOtherContstraints1.symbols index fa754b23dea..38d163b947b 100644 --- a/tests/baselines/reference/constraintsThatReferenceOtherContstraints1.symbols +++ b/tests/baselines/reference/constraintsThatReferenceOtherContstraints1.symbols @@ -16,7 +16,7 @@ class Bar { >T : Symbol(T, Decl(constraintsThatReferenceOtherContstraints1.ts, 3, 10)) data: Foo; // Error 1 Type 'Object' does not satisfy the constraint 'T' for type parameter 'U extends T'. ->data : Symbol(data, Decl(constraintsThatReferenceOtherContstraints1.ts, 3, 42)) +>data : Symbol(Bar.data, Decl(constraintsThatReferenceOtherContstraints1.ts, 3, 42)) >Foo : Symbol(Foo, Decl(constraintsThatReferenceOtherContstraints1.ts, 0, 20)) >Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(constraintsThatReferenceOtherContstraints1.ts, 0, 0)) >Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(constraintsThatReferenceOtherContstraints1.ts, 0, 0)) diff --git a/tests/baselines/reference/constructSignatureAssignabilityInInheritance2.symbols b/tests/baselines/reference/constructSignatureAssignabilityInInheritance2.symbols index 8a6ec113423..4d63a7f2db4 100644 --- a/tests/baselines/reference/constructSignatureAssignabilityInInheritance2.symbols +++ b/tests/baselines/reference/constructSignatureAssignabilityInInheritance2.symbols @@ -3,51 +3,51 @@ class Base { foo: string; } >Base : Symbol(Base, Decl(constructSignatureAssignabilityInInheritance2.ts, 0, 0)) ->foo : Symbol(foo, Decl(constructSignatureAssignabilityInInheritance2.ts, 2, 12)) +>foo : Symbol(Base.foo, Decl(constructSignatureAssignabilityInInheritance2.ts, 2, 12)) class Derived extends Base { bar: string; } >Derived : Symbol(Derived, Decl(constructSignatureAssignabilityInInheritance2.ts, 2, 27)) >Base : Symbol(Base, Decl(constructSignatureAssignabilityInInheritance2.ts, 0, 0)) ->bar : Symbol(bar, Decl(constructSignatureAssignabilityInInheritance2.ts, 3, 28)) +>bar : Symbol(Derived.bar, Decl(constructSignatureAssignabilityInInheritance2.ts, 3, 28)) class Derived2 extends Derived { baz: string; } >Derived2 : Symbol(Derived2, Decl(constructSignatureAssignabilityInInheritance2.ts, 3, 43)) >Derived : Symbol(Derived, Decl(constructSignatureAssignabilityInInheritance2.ts, 2, 27)) ->baz : Symbol(baz, Decl(constructSignatureAssignabilityInInheritance2.ts, 4, 32)) +>baz : Symbol(Derived2.baz, Decl(constructSignatureAssignabilityInInheritance2.ts, 4, 32)) class OtherDerived extends Base { bing: string; } >OtherDerived : Symbol(OtherDerived, Decl(constructSignatureAssignabilityInInheritance2.ts, 4, 47)) >Base : Symbol(Base, Decl(constructSignatureAssignabilityInInheritance2.ts, 0, 0)) ->bing : Symbol(bing, Decl(constructSignatureAssignabilityInInheritance2.ts, 5, 33)) +>bing : Symbol(OtherDerived.bing, Decl(constructSignatureAssignabilityInInheritance2.ts, 5, 33)) interface A { // T >A : Symbol(A, Decl(constructSignatureAssignabilityInInheritance2.ts, 5, 49)) // M's a: new (x: number) => number[]; ->a : Symbol(a, Decl(constructSignatureAssignabilityInInheritance2.ts, 7, 13)) +>a : Symbol(A.a, Decl(constructSignatureAssignabilityInInheritance2.ts, 7, 13)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance2.ts, 9, 12)) a2: new (x: number) => string[]; ->a2 : Symbol(a2, Decl(constructSignatureAssignabilityInInheritance2.ts, 9, 35)) +>a2 : Symbol(A.a2, Decl(constructSignatureAssignabilityInInheritance2.ts, 9, 35)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance2.ts, 10, 13)) a3: new (x: number) => void; ->a3 : Symbol(a3, Decl(constructSignatureAssignabilityInInheritance2.ts, 10, 36)) +>a3 : Symbol(A.a3, Decl(constructSignatureAssignabilityInInheritance2.ts, 10, 36)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance2.ts, 11, 13)) a4: new (x: string, y: number) => string; ->a4 : Symbol(a4, Decl(constructSignatureAssignabilityInInheritance2.ts, 11, 32)) +>a4 : Symbol(A.a4, Decl(constructSignatureAssignabilityInInheritance2.ts, 11, 32)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance2.ts, 12, 13)) >y : Symbol(y, Decl(constructSignatureAssignabilityInInheritance2.ts, 12, 23)) a5: new (x: (arg: string) => number) => string; ->a5 : Symbol(a5, Decl(constructSignatureAssignabilityInInheritance2.ts, 12, 45)) +>a5 : Symbol(A.a5, Decl(constructSignatureAssignabilityInInheritance2.ts, 12, 45)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance2.ts, 13, 13)) >arg : Symbol(arg, Decl(constructSignatureAssignabilityInInheritance2.ts, 13, 17)) a6: new (x: (arg: Base) => Derived) => Base; ->a6 : Symbol(a6, Decl(constructSignatureAssignabilityInInheritance2.ts, 13, 51)) +>a6 : Symbol(A.a6, Decl(constructSignatureAssignabilityInInheritance2.ts, 13, 51)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance2.ts, 14, 13)) >arg : Symbol(arg, Decl(constructSignatureAssignabilityInInheritance2.ts, 14, 17)) >Base : Symbol(Base, Decl(constructSignatureAssignabilityInInheritance2.ts, 0, 0)) @@ -55,7 +55,7 @@ interface A { // T >Base : Symbol(Base, Decl(constructSignatureAssignabilityInInheritance2.ts, 0, 0)) a7: new (x: (arg: Base) => Derived) => (r: Base) => Derived; ->a7 : Symbol(a7, Decl(constructSignatureAssignabilityInInheritance2.ts, 14, 48)) +>a7 : Symbol(A.a7, Decl(constructSignatureAssignabilityInInheritance2.ts, 14, 48)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance2.ts, 15, 13)) >arg : Symbol(arg, Decl(constructSignatureAssignabilityInInheritance2.ts, 15, 17)) >Base : Symbol(Base, Decl(constructSignatureAssignabilityInInheritance2.ts, 0, 0)) @@ -65,7 +65,7 @@ interface A { // T >Derived : Symbol(Derived, Decl(constructSignatureAssignabilityInInheritance2.ts, 2, 27)) a8: new (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived; ->a8 : Symbol(a8, Decl(constructSignatureAssignabilityInInheritance2.ts, 15, 64)) +>a8 : Symbol(A.a8, Decl(constructSignatureAssignabilityInInheritance2.ts, 15, 64)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance2.ts, 16, 13)) >arg : Symbol(arg, Decl(constructSignatureAssignabilityInInheritance2.ts, 16, 17)) >Base : Symbol(Base, Decl(constructSignatureAssignabilityInInheritance2.ts, 0, 0)) @@ -79,7 +79,7 @@ interface A { // T >Derived : Symbol(Derived, Decl(constructSignatureAssignabilityInInheritance2.ts, 2, 27)) a9: new (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived; ->a9 : Symbol(a9, Decl(constructSignatureAssignabilityInInheritance2.ts, 16, 92)) +>a9 : Symbol(A.a9, Decl(constructSignatureAssignabilityInInheritance2.ts, 16, 92)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance2.ts, 17, 13)) >arg : Symbol(arg, Decl(constructSignatureAssignabilityInInheritance2.ts, 17, 17)) >Base : Symbol(Base, Decl(constructSignatureAssignabilityInInheritance2.ts, 0, 0)) @@ -93,13 +93,13 @@ interface A { // T >Derived : Symbol(Derived, Decl(constructSignatureAssignabilityInInheritance2.ts, 2, 27)) a10: new (...x: Derived[]) => Derived; ->a10 : Symbol(a10, Decl(constructSignatureAssignabilityInInheritance2.ts, 17, 92)) +>a10 : Symbol(A.a10, Decl(constructSignatureAssignabilityInInheritance2.ts, 17, 92)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance2.ts, 18, 14)) >Derived : Symbol(Derived, Decl(constructSignatureAssignabilityInInheritance2.ts, 2, 27)) >Derived : Symbol(Derived, Decl(constructSignatureAssignabilityInInheritance2.ts, 2, 27)) a11: new (x: { foo: string }, y: { foo: string; bar: string }) => Base; ->a11 : Symbol(a11, Decl(constructSignatureAssignabilityInInheritance2.ts, 18, 42)) +>a11 : Symbol(A.a11, Decl(constructSignatureAssignabilityInInheritance2.ts, 18, 42)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance2.ts, 19, 14)) >foo : Symbol(foo, Decl(constructSignatureAssignabilityInInheritance2.ts, 19, 18)) >y : Symbol(y, Decl(constructSignatureAssignabilityInInheritance2.ts, 19, 33)) @@ -108,7 +108,7 @@ interface A { // T >Base : Symbol(Base, Decl(constructSignatureAssignabilityInInheritance2.ts, 0, 0)) a12: new (x: Array, y: Array) => Array; ->a12 : Symbol(a12, Decl(constructSignatureAssignabilityInInheritance2.ts, 19, 75)) +>a12 : Symbol(A.a12, Decl(constructSignatureAssignabilityInInheritance2.ts, 19, 75)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance2.ts, 20, 14)) >Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >Base : Symbol(Base, Decl(constructSignatureAssignabilityInInheritance2.ts, 0, 0)) @@ -119,7 +119,7 @@ interface A { // T >Derived : Symbol(Derived, Decl(constructSignatureAssignabilityInInheritance2.ts, 2, 27)) a13: new (x: Array, y: Array) => Array; ->a13 : Symbol(a13, Decl(constructSignatureAssignabilityInInheritance2.ts, 20, 68)) +>a13 : Symbol(A.a13, Decl(constructSignatureAssignabilityInInheritance2.ts, 20, 68)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance2.ts, 21, 14)) >Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >Base : Symbol(Base, Decl(constructSignatureAssignabilityInInheritance2.ts, 0, 0)) @@ -130,14 +130,14 @@ interface A { // T >Derived : Symbol(Derived, Decl(constructSignatureAssignabilityInInheritance2.ts, 2, 27)) a14: new (x: { a: string; b: number }) => Object; ->a14 : Symbol(a14, Decl(constructSignatureAssignabilityInInheritance2.ts, 21, 67)) +>a14 : Symbol(A.a14, Decl(constructSignatureAssignabilityInInheritance2.ts, 21, 67)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance2.ts, 22, 14)) >a : Symbol(a, Decl(constructSignatureAssignabilityInInheritance2.ts, 22, 18)) >b : Symbol(b, Decl(constructSignatureAssignabilityInInheritance2.ts, 22, 29)) >Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) a15: { ->a15 : Symbol(a15, Decl(constructSignatureAssignabilityInInheritance2.ts, 22, 53)) +>a15 : Symbol(A.a15, Decl(constructSignatureAssignabilityInInheritance2.ts, 22, 53)) new (x: number): number[]; >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance2.ts, 24, 13)) @@ -147,7 +147,7 @@ interface A { // T }; a16: { ->a16 : Symbol(a16, Decl(constructSignatureAssignabilityInInheritance2.ts, 26, 6)) +>a16 : Symbol(A.a16, Decl(constructSignatureAssignabilityInInheritance2.ts, 26, 6)) new (x: T): number[]; >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance2.ts, 28, 13)) @@ -163,7 +163,7 @@ interface A { // T }; a17: { ->a17 : Symbol(a17, Decl(constructSignatureAssignabilityInInheritance2.ts, 30, 6)) +>a17 : Symbol(A.a17, Decl(constructSignatureAssignabilityInInheritance2.ts, 30, 6)) new (x: new (a: number) => number): number[]; >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance2.ts, 32, 13)) @@ -175,7 +175,7 @@ interface A { // T }; a18: { ->a18 : Symbol(a18, Decl(constructSignatureAssignabilityInInheritance2.ts, 34, 6)) +>a18 : Symbol(A.a18, Decl(constructSignatureAssignabilityInInheritance2.ts, 34, 6)) new (x: { >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance2.ts, 36, 13)) @@ -195,8 +195,8 @@ interface A { // T new (a: Date): Date; >a : Symbol(a, Decl(constructSignatureAssignabilityInInheritance2.ts, 42, 17)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) }): any[]; }; @@ -209,27 +209,27 @@ interface I extends A { // N's a: new (x: T) => T[]; // ok, instantiation of N is a subtype of M, T is number ->a : Symbol(a, Decl(constructSignatureAssignabilityInInheritance2.ts, 48, 23)) +>a : Symbol(I.a, Decl(constructSignatureAssignabilityInInheritance2.ts, 48, 23)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance2.ts, 50, 12)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance2.ts, 50, 15)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance2.ts, 50, 12)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance2.ts, 50, 12)) a2: new (x: T) => string[]; // ok ->a2 : Symbol(a2, Decl(constructSignatureAssignabilityInInheritance2.ts, 50, 28)) +>a2 : Symbol(I.a2, Decl(constructSignatureAssignabilityInInheritance2.ts, 50, 28)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance2.ts, 51, 13)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance2.ts, 51, 16)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance2.ts, 51, 13)) a3: new (x: T) => T; // ok since Base returns void ->a3 : Symbol(a3, Decl(constructSignatureAssignabilityInInheritance2.ts, 51, 34)) +>a3 : Symbol(I.a3, Decl(constructSignatureAssignabilityInInheritance2.ts, 51, 34)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance2.ts, 52, 13)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance2.ts, 52, 16)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance2.ts, 52, 13)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance2.ts, 52, 13)) a4: new (x: T, y: U) => T; // ok, instantiation of N is a subtype of M, T is string, U is number ->a4 : Symbol(a4, Decl(constructSignatureAssignabilityInInheritance2.ts, 52, 27)) +>a4 : Symbol(I.a4, Decl(constructSignatureAssignabilityInInheritance2.ts, 52, 27)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance2.ts, 53, 13)) >U : Symbol(U, Decl(constructSignatureAssignabilityInInheritance2.ts, 53, 15)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance2.ts, 53, 19)) @@ -239,7 +239,7 @@ interface I extends A { >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance2.ts, 53, 13)) a5: new (x: (arg: T) => U) => T; // ok, U is in a parameter position so inferences can be made ->a5 : Symbol(a5, Decl(constructSignatureAssignabilityInInheritance2.ts, 53, 36)) +>a5 : Symbol(I.a5, Decl(constructSignatureAssignabilityInInheritance2.ts, 53, 36)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance2.ts, 54, 13)) >U : Symbol(U, Decl(constructSignatureAssignabilityInInheritance2.ts, 54, 15)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance2.ts, 54, 19)) @@ -249,7 +249,7 @@ interface I extends A { >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance2.ts, 54, 13)) a6: new (x: (arg: T) => U) => T; // ok, same as a5 but with object type hierarchy ->a6 : Symbol(a6, Decl(constructSignatureAssignabilityInInheritance2.ts, 54, 42)) +>a6 : Symbol(I.a6, Decl(constructSignatureAssignabilityInInheritance2.ts, 54, 42)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance2.ts, 55, 13)) >Base : Symbol(Base, Decl(constructSignatureAssignabilityInInheritance2.ts, 0, 0)) >U : Symbol(U, Decl(constructSignatureAssignabilityInInheritance2.ts, 55, 28)) @@ -261,7 +261,7 @@ interface I extends A { >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance2.ts, 55, 13)) a7: new (x: (arg: T) => U) => (r: T) => U; // ok ->a7 : Symbol(a7, Decl(constructSignatureAssignabilityInInheritance2.ts, 55, 71)) +>a7 : Symbol(I.a7, Decl(constructSignatureAssignabilityInInheritance2.ts, 55, 71)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance2.ts, 56, 13)) >Base : Symbol(Base, Decl(constructSignatureAssignabilityInInheritance2.ts, 0, 0)) >U : Symbol(U, Decl(constructSignatureAssignabilityInInheritance2.ts, 56, 28)) @@ -275,7 +275,7 @@ interface I extends A { >U : Symbol(U, Decl(constructSignatureAssignabilityInInheritance2.ts, 56, 28)) a8: new (x: (arg: T) => U, y: (arg2: T) => U) => (r: T) => U; // ok ->a8 : Symbol(a8, Decl(constructSignatureAssignabilityInInheritance2.ts, 56, 81)) +>a8 : Symbol(I.a8, Decl(constructSignatureAssignabilityInInheritance2.ts, 56, 81)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance2.ts, 57, 13)) >Base : Symbol(Base, Decl(constructSignatureAssignabilityInInheritance2.ts, 0, 0)) >U : Symbol(U, Decl(constructSignatureAssignabilityInInheritance2.ts, 57, 28)) @@ -293,7 +293,7 @@ interface I extends A { >U : Symbol(U, Decl(constructSignatureAssignabilityInInheritance2.ts, 57, 28)) a9: new (x: (arg: T) => U, y: (arg2: { foo: string; bing: number }) => U) => (r: T) => U; // ok, same as a8 with compatible object literal ->a9 : Symbol(a9, Decl(constructSignatureAssignabilityInInheritance2.ts, 57, 100)) +>a9 : Symbol(I.a9, Decl(constructSignatureAssignabilityInInheritance2.ts, 57, 100)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance2.ts, 58, 13)) >Base : Symbol(Base, Decl(constructSignatureAssignabilityInInheritance2.ts, 0, 0)) >U : Symbol(U, Decl(constructSignatureAssignabilityInInheritance2.ts, 58, 28)) @@ -312,7 +312,7 @@ interface I extends A { >U : Symbol(U, Decl(constructSignatureAssignabilityInInheritance2.ts, 58, 28)) a10: new (...x: T[]) => T; // ok ->a10 : Symbol(a10, Decl(constructSignatureAssignabilityInInheritance2.ts, 58, 128)) +>a10 : Symbol(I.a10, Decl(constructSignatureAssignabilityInInheritance2.ts, 58, 128)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance2.ts, 59, 14)) >Derived : Symbol(Derived, Decl(constructSignatureAssignabilityInInheritance2.ts, 2, 27)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance2.ts, 59, 33)) @@ -320,7 +320,7 @@ interface I extends A { >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance2.ts, 59, 14)) a11: new (x: T, y: T) => T; // ok ->a11 : Symbol(a11, Decl(constructSignatureAssignabilityInInheritance2.ts, 59, 49)) +>a11 : Symbol(I.a11, Decl(constructSignatureAssignabilityInInheritance2.ts, 59, 49)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance2.ts, 60, 14)) >Base : Symbol(Base, Decl(constructSignatureAssignabilityInInheritance2.ts, 0, 0)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance2.ts, 60, 30)) @@ -330,7 +330,7 @@ interface I extends A { >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance2.ts, 60, 14)) a12: new >(x: Array, y: T) => Array; // ok, less specific parameter type ->a12 : Symbol(a12, Decl(constructSignatureAssignabilityInInheritance2.ts, 60, 47)) +>a12 : Symbol(I.a12, Decl(constructSignatureAssignabilityInInheritance2.ts, 60, 47)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance2.ts, 61, 14)) >Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >Base : Symbol(Base, Decl(constructSignatureAssignabilityInInheritance2.ts, 0, 0)) @@ -343,7 +343,7 @@ interface I extends A { >Derived : Symbol(Derived, Decl(constructSignatureAssignabilityInInheritance2.ts, 2, 27)) a13: new >(x: Array, y: T) => T; // ok, T = Array, satisfies constraint, contextual signature instantiation succeeds ->a13 : Symbol(a13, Decl(constructSignatureAssignabilityInInheritance2.ts, 61, 77)) +>a13 : Symbol(I.a13, Decl(constructSignatureAssignabilityInInheritance2.ts, 61, 77)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance2.ts, 62, 14)) >Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >Derived : Symbol(Derived, Decl(constructSignatureAssignabilityInInheritance2.ts, 2, 27)) @@ -355,7 +355,7 @@ interface I extends A { >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance2.ts, 62, 14)) a14: new (x: { a: T; b: T }) => T; // ok, best common type yields T = {} but that's satisfactory for this signature ->a14 : Symbol(a14, Decl(constructSignatureAssignabilityInInheritance2.ts, 62, 67)) +>a14 : Symbol(I.a14, Decl(constructSignatureAssignabilityInInheritance2.ts, 62, 67)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance2.ts, 63, 14)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance2.ts, 63, 17)) >a : Symbol(a, Decl(constructSignatureAssignabilityInInheritance2.ts, 63, 21)) @@ -365,21 +365,21 @@ interface I extends A { >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance2.ts, 63, 14)) a15: new (x: T) => T[]; // ok ->a15 : Symbol(a15, Decl(constructSignatureAssignabilityInInheritance2.ts, 63, 41)) +>a15 : Symbol(I.a15, Decl(constructSignatureAssignabilityInInheritance2.ts, 63, 41)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance2.ts, 64, 14)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance2.ts, 64, 17)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance2.ts, 64, 14)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance2.ts, 64, 14)) a16: new (x: T) => number[]; // ok ->a16 : Symbol(a16, Decl(constructSignatureAssignabilityInInheritance2.ts, 64, 30)) +>a16 : Symbol(I.a16, Decl(constructSignatureAssignabilityInInheritance2.ts, 64, 30)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance2.ts, 65, 14)) >Base : Symbol(Base, Decl(constructSignatureAssignabilityInInheritance2.ts, 0, 0)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance2.ts, 65, 30)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance2.ts, 65, 14)) a17: new (x: new (a: T) => T) => T[]; // ok ->a17 : Symbol(a17, Decl(constructSignatureAssignabilityInInheritance2.ts, 65, 48)) +>a17 : Symbol(I.a17, Decl(constructSignatureAssignabilityInInheritance2.ts, 65, 48)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance2.ts, 66, 14)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance2.ts, 66, 17)) >a : Symbol(a, Decl(constructSignatureAssignabilityInInheritance2.ts, 66, 25)) @@ -388,7 +388,7 @@ interface I extends A { >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance2.ts, 66, 14)) a18: new (x: new (a: T) => T) => T[]; // ok, no inferences for T but assignable to any ->a18 : Symbol(a18, Decl(constructSignatureAssignabilityInInheritance2.ts, 66, 44)) +>a18 : Symbol(I.a18, Decl(constructSignatureAssignabilityInInheritance2.ts, 66, 44)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance2.ts, 67, 14)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance2.ts, 67, 17)) >a : Symbol(a, Decl(constructSignatureAssignabilityInInheritance2.ts, 67, 25)) diff --git a/tests/baselines/reference/constructSignatureAssignabilityInInheritance3.errors.txt b/tests/baselines/reference/constructSignatureAssignabilityInInheritance3.errors.txt index 8d6273804f7..086372aac17 100644 --- a/tests/baselines/reference/constructSignatureAssignabilityInInheritance3.errors.txt +++ b/tests/baselines/reference/constructSignatureAssignabilityInInheritance3.errors.txt @@ -2,12 +2,12 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/construc Types of property 'a2' are incompatible. Type 'new (x: T) => U[]' is not assignable to type 'new (x: number) => string[]'. Types of parameters 'x' and 'x' are incompatible. - Type 'T' is not assignable to type 'number'. + Type 'number' is not assignable to type 'T'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/constructSignatureAssignabilityInInheritance3.ts(50,19): error TS2430: Interface 'I4' incorrectly extends interface 'A'. Types of property 'a8' are incompatible. Type 'new (x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U' is not assignable to type 'new (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived'. Types of parameters 'y' and 'y' are incompatible. - Type '(arg2: { foo: number; }) => any' is not assignable to type '(arg2: Base) => Derived'. + Type '(arg2: Base) => Derived' is not assignable to type '(arg2: { foo: number; }) => any'. Types of parameters 'arg2' and 'arg2' are incompatible. Type '{ foo: number; }' is not assignable to type 'Base'. Types of property 'foo' are incompatible. @@ -61,7 +61,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/construc !!! error TS2430: Types of property 'a2' are incompatible. !!! error TS2430: Type 'new (x: T) => U[]' is not assignable to type 'new (x: number) => string[]'. !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2430: Type 'T' is not assignable to type 'number'. +!!! error TS2430: Type 'number' is not assignable to type 'T'. a2: new (x: T) => U[]; // error, no contextual signature instantiation since I2.a2 is not generic } @@ -76,7 +76,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/construc !!! error TS2430: Types of property 'a8' are incompatible. !!! error TS2430: Type 'new (x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U' is not assignable to type 'new (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived'. !!! error TS2430: Types of parameters 'y' and 'y' are incompatible. -!!! error TS2430: Type '(arg2: { foo: number; }) => any' is not assignable to type '(arg2: Base) => Derived'. +!!! error TS2430: Type '(arg2: Base) => Derived' is not assignable to type '(arg2: { foo: number; }) => any'. !!! error TS2430: Types of parameters 'arg2' and 'arg2' are incompatible. !!! error TS2430: Type '{ foo: number; }' is not assignable to type 'Base'. !!! error TS2430: Types of property 'foo' are incompatible. diff --git a/tests/baselines/reference/constructSignatureAssignabilityInInheritance4.symbols b/tests/baselines/reference/constructSignatureAssignabilityInInheritance4.symbols index 33ae7e0f6d6..e26a33bba4e 100644 --- a/tests/baselines/reference/constructSignatureAssignabilityInInheritance4.symbols +++ b/tests/baselines/reference/constructSignatureAssignabilityInInheritance4.symbols @@ -3,48 +3,48 @@ class Base { foo: string; } >Base : Symbol(Base, Decl(constructSignatureAssignabilityInInheritance4.ts, 0, 0)) ->foo : Symbol(foo, Decl(constructSignatureAssignabilityInInheritance4.ts, 2, 12)) +>foo : Symbol(Base.foo, Decl(constructSignatureAssignabilityInInheritance4.ts, 2, 12)) class Derived extends Base { bar: string; } >Derived : Symbol(Derived, Decl(constructSignatureAssignabilityInInheritance4.ts, 2, 27)) >Base : Symbol(Base, Decl(constructSignatureAssignabilityInInheritance4.ts, 0, 0)) ->bar : Symbol(bar, Decl(constructSignatureAssignabilityInInheritance4.ts, 3, 28)) +>bar : Symbol(Derived.bar, Decl(constructSignatureAssignabilityInInheritance4.ts, 3, 28)) class Derived2 extends Derived { baz: string; } >Derived2 : Symbol(Derived2, Decl(constructSignatureAssignabilityInInheritance4.ts, 3, 43)) >Derived : Symbol(Derived, Decl(constructSignatureAssignabilityInInheritance4.ts, 2, 27)) ->baz : Symbol(baz, Decl(constructSignatureAssignabilityInInheritance4.ts, 4, 32)) +>baz : Symbol(Derived2.baz, Decl(constructSignatureAssignabilityInInheritance4.ts, 4, 32)) class OtherDerived extends Base { bing: string; } >OtherDerived : Symbol(OtherDerived, Decl(constructSignatureAssignabilityInInheritance4.ts, 4, 47)) >Base : Symbol(Base, Decl(constructSignatureAssignabilityInInheritance4.ts, 0, 0)) ->bing : Symbol(bing, Decl(constructSignatureAssignabilityInInheritance4.ts, 5, 33)) +>bing : Symbol(OtherDerived.bing, Decl(constructSignatureAssignabilityInInheritance4.ts, 5, 33)) interface A { // T >A : Symbol(A, Decl(constructSignatureAssignabilityInInheritance4.ts, 5, 49)) // M's a: new (x: T) => T[]; ->a : Symbol(a, Decl(constructSignatureAssignabilityInInheritance4.ts, 7, 13)) +>a : Symbol(A.a, Decl(constructSignatureAssignabilityInInheritance4.ts, 7, 13)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance4.ts, 9, 12)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance4.ts, 9, 15)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance4.ts, 9, 12)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance4.ts, 9, 12)) a2: new (x: T) => string[]; ->a2 : Symbol(a2, Decl(constructSignatureAssignabilityInInheritance4.ts, 9, 28)) +>a2 : Symbol(A.a2, Decl(constructSignatureAssignabilityInInheritance4.ts, 9, 28)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance4.ts, 10, 13)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance4.ts, 10, 16)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance4.ts, 10, 13)) a3: new (x: T) => void; ->a3 : Symbol(a3, Decl(constructSignatureAssignabilityInInheritance4.ts, 10, 34)) +>a3 : Symbol(A.a3, Decl(constructSignatureAssignabilityInInheritance4.ts, 10, 34)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance4.ts, 11, 13)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance4.ts, 11, 16)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance4.ts, 11, 13)) a4: new (x: T, y: U) => string; ->a4 : Symbol(a4, Decl(constructSignatureAssignabilityInInheritance4.ts, 11, 30)) +>a4 : Symbol(A.a4, Decl(constructSignatureAssignabilityInInheritance4.ts, 11, 30)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance4.ts, 12, 13)) >U : Symbol(U, Decl(constructSignatureAssignabilityInInheritance4.ts, 12, 15)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance4.ts, 12, 19)) @@ -53,7 +53,7 @@ interface A { // T >U : Symbol(U, Decl(constructSignatureAssignabilityInInheritance4.ts, 12, 15)) a5: new (x: (arg: T) => U) => T; ->a5 : Symbol(a5, Decl(constructSignatureAssignabilityInInheritance4.ts, 12, 41)) +>a5 : Symbol(A.a5, Decl(constructSignatureAssignabilityInInheritance4.ts, 12, 41)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance4.ts, 13, 13)) >U : Symbol(U, Decl(constructSignatureAssignabilityInInheritance4.ts, 13, 15)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance4.ts, 13, 19)) @@ -63,7 +63,7 @@ interface A { // T >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance4.ts, 13, 13)) a6: new (x: (arg: T) => Derived) => T; ->a6 : Symbol(a6, Decl(constructSignatureAssignabilityInInheritance4.ts, 13, 42)) +>a6 : Symbol(A.a6, Decl(constructSignatureAssignabilityInInheritance4.ts, 13, 42)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance4.ts, 14, 13)) >Base : Symbol(Base, Decl(constructSignatureAssignabilityInInheritance4.ts, 0, 0)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance4.ts, 14, 29)) @@ -73,7 +73,7 @@ interface A { // T >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance4.ts, 14, 13)) a11: new (x: { foo: T }, y: { foo: T; bar: T }) => Base; ->a11 : Symbol(a11, Decl(constructSignatureAssignabilityInInheritance4.ts, 14, 58)) +>a11 : Symbol(A.a11, Decl(constructSignatureAssignabilityInInheritance4.ts, 14, 58)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance4.ts, 15, 14)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance4.ts, 15, 17)) >foo : Symbol(foo, Decl(constructSignatureAssignabilityInInheritance4.ts, 15, 21)) @@ -86,7 +86,7 @@ interface A { // T >Base : Symbol(Base, Decl(constructSignatureAssignabilityInInheritance4.ts, 0, 0)) a15: new (x: { a: T; b: T }) => T[]; ->a15 : Symbol(a15, Decl(constructSignatureAssignabilityInInheritance4.ts, 15, 63)) +>a15 : Symbol(A.a15, Decl(constructSignatureAssignabilityInInheritance4.ts, 15, 63)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance4.ts, 16, 14)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance4.ts, 16, 17)) >a : Symbol(a, Decl(constructSignatureAssignabilityInInheritance4.ts, 16, 21)) @@ -96,7 +96,7 @@ interface A { // T >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance4.ts, 16, 14)) a16: new (x: { a: T; b: T }) => T[]; ->a16 : Symbol(a16, Decl(constructSignatureAssignabilityInInheritance4.ts, 16, 43)) +>a16 : Symbol(A.a16, Decl(constructSignatureAssignabilityInInheritance4.ts, 16, 43)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance4.ts, 17, 14)) >Base : Symbol(Base, Decl(constructSignatureAssignabilityInInheritance4.ts, 0, 0)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance4.ts, 17, 30)) @@ -107,7 +107,7 @@ interface A { // T >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance4.ts, 17, 14)) a17: { ->a17 : Symbol(a17, Decl(constructSignatureAssignabilityInInheritance4.ts, 17, 56)) +>a17 : Symbol(A.a17, Decl(constructSignatureAssignabilityInInheritance4.ts, 17, 56)) new (x: T): T[]; >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance4.ts, 19, 13)) @@ -125,7 +125,7 @@ interface A { // T }; a18: { ->a18 : Symbol(a18, Decl(constructSignatureAssignabilityInInheritance4.ts, 21, 6)) +>a18 : Symbol(A.a18, Decl(constructSignatureAssignabilityInInheritance4.ts, 21, 6)) new (x: T): number[]; >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance4.ts, 23, 13)) @@ -141,7 +141,7 @@ interface A { // T }; a19: { ->a19 : Symbol(a19, Decl(constructSignatureAssignabilityInInheritance4.ts, 25, 6)) +>a19 : Symbol(A.a19, Decl(constructSignatureAssignabilityInInheritance4.ts, 25, 6)) new (x: new (a: T) => T): T[]; >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance4.ts, 27, 13)) @@ -163,7 +163,7 @@ interface A { // T }; a20: { ->a20 : Symbol(a20, Decl(constructSignatureAssignabilityInInheritance4.ts, 29, 6)) +>a20 : Symbol(A.a20, Decl(constructSignatureAssignabilityInInheritance4.ts, 29, 6)) new (x: { >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance4.ts, 31, 13)) @@ -211,27 +211,27 @@ interface I extends A { // N's a: new (x: T) => T[]; // ok, instantiation of N is a subtype of M, T is number ->a : Symbol(a, Decl(constructSignatureAssignabilityInInheritance4.ts, 43, 23)) +>a : Symbol(I.a, Decl(constructSignatureAssignabilityInInheritance4.ts, 43, 23)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance4.ts, 45, 12)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance4.ts, 45, 15)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance4.ts, 45, 12)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance4.ts, 45, 12)) a2: new (x: T) => string[]; // ok ->a2 : Symbol(a2, Decl(constructSignatureAssignabilityInInheritance4.ts, 45, 28)) +>a2 : Symbol(I.a2, Decl(constructSignatureAssignabilityInInheritance4.ts, 45, 28)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance4.ts, 46, 13)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance4.ts, 46, 16)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance4.ts, 46, 13)) a3: new (x: T) => T; // ok since Base returns void ->a3 : Symbol(a3, Decl(constructSignatureAssignabilityInInheritance4.ts, 46, 34)) +>a3 : Symbol(I.a3, Decl(constructSignatureAssignabilityInInheritance4.ts, 46, 34)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance4.ts, 47, 13)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance4.ts, 47, 16)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance4.ts, 47, 13)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance4.ts, 47, 13)) a4: new (x: T, y: U) => string; // ok, instantiation of N is a subtype of M, T is string, U is number ->a4 : Symbol(a4, Decl(constructSignatureAssignabilityInInheritance4.ts, 47, 27)) +>a4 : Symbol(I.a4, Decl(constructSignatureAssignabilityInInheritance4.ts, 47, 27)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance4.ts, 48, 13)) >U : Symbol(U, Decl(constructSignatureAssignabilityInInheritance4.ts, 48, 15)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance4.ts, 48, 19)) @@ -240,7 +240,7 @@ interface I extends A { >U : Symbol(U, Decl(constructSignatureAssignabilityInInheritance4.ts, 48, 15)) a5: new (x: (arg: T) => U) => T; // ok, U is in a parameter position so inferences can be made ->a5 : Symbol(a5, Decl(constructSignatureAssignabilityInInheritance4.ts, 48, 41)) +>a5 : Symbol(I.a5, Decl(constructSignatureAssignabilityInInheritance4.ts, 48, 41)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance4.ts, 49, 13)) >U : Symbol(U, Decl(constructSignatureAssignabilityInInheritance4.ts, 49, 15)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance4.ts, 49, 19)) @@ -250,7 +250,7 @@ interface I extends A { >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance4.ts, 49, 13)) a6: new (x: (arg: T) => U) => T; // ok, same as a5 but with object type hierarchy ->a6 : Symbol(a6, Decl(constructSignatureAssignabilityInInheritance4.ts, 49, 42)) +>a6 : Symbol(I.a6, Decl(constructSignatureAssignabilityInInheritance4.ts, 49, 42)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance4.ts, 50, 13)) >Base : Symbol(Base, Decl(constructSignatureAssignabilityInInheritance4.ts, 0, 0)) >U : Symbol(U, Decl(constructSignatureAssignabilityInInheritance4.ts, 50, 28)) @@ -262,7 +262,7 @@ interface I extends A { >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance4.ts, 50, 13)) a11: new (x: { foo: T }, y: { foo: U; bar: U }) => Base; // ok ->a11 : Symbol(a11, Decl(constructSignatureAssignabilityInInheritance4.ts, 50, 71)) +>a11 : Symbol(I.a11, Decl(constructSignatureAssignabilityInInheritance4.ts, 50, 71)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance4.ts, 51, 14)) >U : Symbol(U, Decl(constructSignatureAssignabilityInInheritance4.ts, 51, 16)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance4.ts, 51, 20)) @@ -276,7 +276,7 @@ interface I extends A { >Base : Symbol(Base, Decl(constructSignatureAssignabilityInInheritance4.ts, 0, 0)) a15: new (x: { a: U; b: V; }) => U[]; // ok, T = U, T = V ->a15 : Symbol(a15, Decl(constructSignatureAssignabilityInInheritance4.ts, 51, 66)) +>a15 : Symbol(I.a15, Decl(constructSignatureAssignabilityInInheritance4.ts, 51, 66)) >U : Symbol(U, Decl(constructSignatureAssignabilityInInheritance4.ts, 52, 14)) >V : Symbol(V, Decl(constructSignatureAssignabilityInInheritance4.ts, 52, 16)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance4.ts, 52, 20)) @@ -287,7 +287,7 @@ interface I extends A { >U : Symbol(U, Decl(constructSignatureAssignabilityInInheritance4.ts, 52, 14)) a16: new (x: { a: T; b: T }) => T[]; // ok, more general parameter type ->a16 : Symbol(a16, Decl(constructSignatureAssignabilityInInheritance4.ts, 52, 47)) +>a16 : Symbol(I.a16, Decl(constructSignatureAssignabilityInInheritance4.ts, 52, 47)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance4.ts, 53, 14)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance4.ts, 53, 17)) >a : Symbol(a, Decl(constructSignatureAssignabilityInInheritance4.ts, 53, 21)) @@ -297,7 +297,7 @@ interface I extends A { >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance4.ts, 53, 14)) a17: new (x: T) => T[]; // ok, more general parameter type ->a17 : Symbol(a17, Decl(constructSignatureAssignabilityInInheritance4.ts, 53, 43)) +>a17 : Symbol(I.a17, Decl(constructSignatureAssignabilityInInheritance4.ts, 53, 43)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance4.ts, 54, 14)) >Base : Symbol(Base, Decl(constructSignatureAssignabilityInInheritance4.ts, 0, 0)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance4.ts, 54, 30)) @@ -305,14 +305,14 @@ interface I extends A { >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance4.ts, 54, 14)) a18: new (x: T) => number[]; // ok, more general parameter type ->a18 : Symbol(a18, Decl(constructSignatureAssignabilityInInheritance4.ts, 54, 43)) +>a18 : Symbol(I.a18, Decl(constructSignatureAssignabilityInInheritance4.ts, 54, 43)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance4.ts, 55, 14)) >Base : Symbol(Base, Decl(constructSignatureAssignabilityInInheritance4.ts, 0, 0)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance4.ts, 55, 30)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance4.ts, 55, 14)) a19: new (x: new (a: T) => T) => T[]; // ok ->a19 : Symbol(a19, Decl(constructSignatureAssignabilityInInheritance4.ts, 55, 48)) +>a19 : Symbol(I.a19, Decl(constructSignatureAssignabilityInInheritance4.ts, 55, 48)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance4.ts, 56, 14)) >Base : Symbol(Base, Decl(constructSignatureAssignabilityInInheritance4.ts, 0, 0)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance4.ts, 56, 30)) @@ -322,7 +322,7 @@ interface I extends A { >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance4.ts, 56, 14)) a20: new (x: new (a: T) => T) => any[]; // ok ->a20 : Symbol(a20, Decl(constructSignatureAssignabilityInInheritance4.ts, 56, 57)) +>a20 : Symbol(I.a20, Decl(constructSignatureAssignabilityInInheritance4.ts, 56, 57)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance4.ts, 57, 14)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance4.ts, 57, 22)) >Base : Symbol(Base, Decl(constructSignatureAssignabilityInInheritance4.ts, 0, 0)) diff --git a/tests/baselines/reference/constructSignatureAssignabilityInInheritance5.symbols b/tests/baselines/reference/constructSignatureAssignabilityInInheritance5.symbols index 1b35cd0c896..ec2c71160c5 100644 --- a/tests/baselines/reference/constructSignatureAssignabilityInInheritance5.symbols +++ b/tests/baselines/reference/constructSignatureAssignabilityInInheritance5.symbols @@ -4,51 +4,51 @@ class Base { foo: string; } >Base : Symbol(Base, Decl(constructSignatureAssignabilityInInheritance5.ts, 0, 0)) ->foo : Symbol(foo, Decl(constructSignatureAssignabilityInInheritance5.ts, 3, 12)) +>foo : Symbol(Base.foo, Decl(constructSignatureAssignabilityInInheritance5.ts, 3, 12)) class Derived extends Base { bar: string; } >Derived : Symbol(Derived, Decl(constructSignatureAssignabilityInInheritance5.ts, 3, 27)) >Base : Symbol(Base, Decl(constructSignatureAssignabilityInInheritance5.ts, 0, 0)) ->bar : Symbol(bar, Decl(constructSignatureAssignabilityInInheritance5.ts, 4, 28)) +>bar : Symbol(Derived.bar, Decl(constructSignatureAssignabilityInInheritance5.ts, 4, 28)) class Derived2 extends Derived { baz: string; } >Derived2 : Symbol(Derived2, Decl(constructSignatureAssignabilityInInheritance5.ts, 4, 43)) >Derived : Symbol(Derived, Decl(constructSignatureAssignabilityInInheritance5.ts, 3, 27)) ->baz : Symbol(baz, Decl(constructSignatureAssignabilityInInheritance5.ts, 5, 32)) +>baz : Symbol(Derived2.baz, Decl(constructSignatureAssignabilityInInheritance5.ts, 5, 32)) class OtherDerived extends Base { bing: string; } >OtherDerived : Symbol(OtherDerived, Decl(constructSignatureAssignabilityInInheritance5.ts, 5, 47)) >Base : Symbol(Base, Decl(constructSignatureAssignabilityInInheritance5.ts, 0, 0)) ->bing : Symbol(bing, Decl(constructSignatureAssignabilityInInheritance5.ts, 6, 33)) +>bing : Symbol(OtherDerived.bing, Decl(constructSignatureAssignabilityInInheritance5.ts, 6, 33)) interface A { // T >A : Symbol(A, Decl(constructSignatureAssignabilityInInheritance5.ts, 6, 49)) // M's a: new (x: number) => number[]; ->a : Symbol(a, Decl(constructSignatureAssignabilityInInheritance5.ts, 8, 13)) +>a : Symbol(A.a, Decl(constructSignatureAssignabilityInInheritance5.ts, 8, 13)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance5.ts, 10, 12)) a2: new (x: number) => string[]; ->a2 : Symbol(a2, Decl(constructSignatureAssignabilityInInheritance5.ts, 10, 35)) +>a2 : Symbol(A.a2, Decl(constructSignatureAssignabilityInInheritance5.ts, 10, 35)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance5.ts, 11, 13)) a3: new (x: number) => void; ->a3 : Symbol(a3, Decl(constructSignatureAssignabilityInInheritance5.ts, 11, 36)) +>a3 : Symbol(A.a3, Decl(constructSignatureAssignabilityInInheritance5.ts, 11, 36)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance5.ts, 12, 13)) a4: new (x: string, y: number) => string; ->a4 : Symbol(a4, Decl(constructSignatureAssignabilityInInheritance5.ts, 12, 32)) +>a4 : Symbol(A.a4, Decl(constructSignatureAssignabilityInInheritance5.ts, 12, 32)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance5.ts, 13, 13)) >y : Symbol(y, Decl(constructSignatureAssignabilityInInheritance5.ts, 13, 23)) a5: new (x: (arg: string) => number) => string; ->a5 : Symbol(a5, Decl(constructSignatureAssignabilityInInheritance5.ts, 13, 45)) +>a5 : Symbol(A.a5, Decl(constructSignatureAssignabilityInInheritance5.ts, 13, 45)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance5.ts, 14, 13)) >arg : Symbol(arg, Decl(constructSignatureAssignabilityInInheritance5.ts, 14, 17)) a6: new (x: (arg: Base) => Derived) => Base; ->a6 : Symbol(a6, Decl(constructSignatureAssignabilityInInheritance5.ts, 14, 51)) +>a6 : Symbol(A.a6, Decl(constructSignatureAssignabilityInInheritance5.ts, 14, 51)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance5.ts, 15, 13)) >arg : Symbol(arg, Decl(constructSignatureAssignabilityInInheritance5.ts, 15, 17)) >Base : Symbol(Base, Decl(constructSignatureAssignabilityInInheritance5.ts, 0, 0)) @@ -56,7 +56,7 @@ interface A { // T >Base : Symbol(Base, Decl(constructSignatureAssignabilityInInheritance5.ts, 0, 0)) a7: new (x: (arg: Base) => Derived) => (r: Base) => Derived; ->a7 : Symbol(a7, Decl(constructSignatureAssignabilityInInheritance5.ts, 15, 48)) +>a7 : Symbol(A.a7, Decl(constructSignatureAssignabilityInInheritance5.ts, 15, 48)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance5.ts, 16, 13)) >arg : Symbol(arg, Decl(constructSignatureAssignabilityInInheritance5.ts, 16, 17)) >Base : Symbol(Base, Decl(constructSignatureAssignabilityInInheritance5.ts, 0, 0)) @@ -66,7 +66,7 @@ interface A { // T >Derived : Symbol(Derived, Decl(constructSignatureAssignabilityInInheritance5.ts, 3, 27)) a8: new (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived; ->a8 : Symbol(a8, Decl(constructSignatureAssignabilityInInheritance5.ts, 16, 64)) +>a8 : Symbol(A.a8, Decl(constructSignatureAssignabilityInInheritance5.ts, 16, 64)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance5.ts, 17, 13)) >arg : Symbol(arg, Decl(constructSignatureAssignabilityInInheritance5.ts, 17, 17)) >Base : Symbol(Base, Decl(constructSignatureAssignabilityInInheritance5.ts, 0, 0)) @@ -80,7 +80,7 @@ interface A { // T >Derived : Symbol(Derived, Decl(constructSignatureAssignabilityInInheritance5.ts, 3, 27)) a9: new (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived; ->a9 : Symbol(a9, Decl(constructSignatureAssignabilityInInheritance5.ts, 17, 92)) +>a9 : Symbol(A.a9, Decl(constructSignatureAssignabilityInInheritance5.ts, 17, 92)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance5.ts, 18, 13)) >arg : Symbol(arg, Decl(constructSignatureAssignabilityInInheritance5.ts, 18, 17)) >Base : Symbol(Base, Decl(constructSignatureAssignabilityInInheritance5.ts, 0, 0)) @@ -94,13 +94,13 @@ interface A { // T >Derived : Symbol(Derived, Decl(constructSignatureAssignabilityInInheritance5.ts, 3, 27)) a10: new (...x: Derived[]) => Derived; ->a10 : Symbol(a10, Decl(constructSignatureAssignabilityInInheritance5.ts, 18, 92)) +>a10 : Symbol(A.a10, Decl(constructSignatureAssignabilityInInheritance5.ts, 18, 92)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance5.ts, 19, 14)) >Derived : Symbol(Derived, Decl(constructSignatureAssignabilityInInheritance5.ts, 3, 27)) >Derived : Symbol(Derived, Decl(constructSignatureAssignabilityInInheritance5.ts, 3, 27)) a11: new (x: { foo: string }, y: { foo: string; bar: string }) => Base; ->a11 : Symbol(a11, Decl(constructSignatureAssignabilityInInheritance5.ts, 19, 42)) +>a11 : Symbol(A.a11, Decl(constructSignatureAssignabilityInInheritance5.ts, 19, 42)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance5.ts, 20, 14)) >foo : Symbol(foo, Decl(constructSignatureAssignabilityInInheritance5.ts, 20, 18)) >y : Symbol(y, Decl(constructSignatureAssignabilityInInheritance5.ts, 20, 33)) @@ -109,7 +109,7 @@ interface A { // T >Base : Symbol(Base, Decl(constructSignatureAssignabilityInInheritance5.ts, 0, 0)) a12: new (x: Array, y: Array) => Array; ->a12 : Symbol(a12, Decl(constructSignatureAssignabilityInInheritance5.ts, 20, 75)) +>a12 : Symbol(A.a12, Decl(constructSignatureAssignabilityInInheritance5.ts, 20, 75)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance5.ts, 21, 14)) >Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >Base : Symbol(Base, Decl(constructSignatureAssignabilityInInheritance5.ts, 0, 0)) @@ -120,7 +120,7 @@ interface A { // T >Derived : Symbol(Derived, Decl(constructSignatureAssignabilityInInheritance5.ts, 3, 27)) a13: new (x: Array, y: Array) => Array; ->a13 : Symbol(a13, Decl(constructSignatureAssignabilityInInheritance5.ts, 21, 68)) +>a13 : Symbol(A.a13, Decl(constructSignatureAssignabilityInInheritance5.ts, 21, 68)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance5.ts, 22, 14)) >Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >Base : Symbol(Base, Decl(constructSignatureAssignabilityInInheritance5.ts, 0, 0)) @@ -131,7 +131,7 @@ interface A { // T >Derived : Symbol(Derived, Decl(constructSignatureAssignabilityInInheritance5.ts, 3, 27)) a14: new (x: { a: string; b: number }) => Object; ->a14 : Symbol(a14, Decl(constructSignatureAssignabilityInInheritance5.ts, 22, 67)) +>a14 : Symbol(A.a14, Decl(constructSignatureAssignabilityInInheritance5.ts, 22, 67)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance5.ts, 23, 14)) >a : Symbol(a, Decl(constructSignatureAssignabilityInInheritance5.ts, 23, 18)) >b : Symbol(b, Decl(constructSignatureAssignabilityInInheritance5.ts, 23, 29)) @@ -143,7 +143,7 @@ interface B extends A { >A : Symbol(A, Decl(constructSignatureAssignabilityInInheritance5.ts, 6, 49)) a: new (x: T) => T[]; ->a : Symbol(a, Decl(constructSignatureAssignabilityInInheritance5.ts, 26, 23)) +>a : Symbol(B.a, Decl(constructSignatureAssignabilityInInheritance5.ts, 26, 23)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance5.ts, 27, 12)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance5.ts, 27, 15)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance5.ts, 27, 12)) @@ -157,27 +157,27 @@ interface I extends B { // N's a: new (x: T) => T[]; // ok, instantiation of N is a subtype of M, T is number ->a : Symbol(a, Decl(constructSignatureAssignabilityInInheritance5.ts, 31, 23)) +>a : Symbol(I.a, Decl(constructSignatureAssignabilityInInheritance5.ts, 31, 23)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance5.ts, 33, 12)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance5.ts, 33, 15)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance5.ts, 33, 12)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance5.ts, 33, 12)) a2: new (x: T) => string[]; // ok ->a2 : Symbol(a2, Decl(constructSignatureAssignabilityInInheritance5.ts, 33, 28)) +>a2 : Symbol(I.a2, Decl(constructSignatureAssignabilityInInheritance5.ts, 33, 28)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance5.ts, 34, 13)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance5.ts, 34, 16)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance5.ts, 34, 13)) a3: new (x: T) => T; // ok since Base returns void ->a3 : Symbol(a3, Decl(constructSignatureAssignabilityInInheritance5.ts, 34, 34)) +>a3 : Symbol(I.a3, Decl(constructSignatureAssignabilityInInheritance5.ts, 34, 34)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance5.ts, 35, 13)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance5.ts, 35, 16)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance5.ts, 35, 13)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance5.ts, 35, 13)) a4: new (x: T, y: U) => T; // ok, instantiation of N is a subtype of M, T is string, U is number ->a4 : Symbol(a4, Decl(constructSignatureAssignabilityInInheritance5.ts, 35, 27)) +>a4 : Symbol(I.a4, Decl(constructSignatureAssignabilityInInheritance5.ts, 35, 27)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance5.ts, 36, 13)) >U : Symbol(U, Decl(constructSignatureAssignabilityInInheritance5.ts, 36, 15)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance5.ts, 36, 19)) @@ -187,7 +187,7 @@ interface I extends B { >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance5.ts, 36, 13)) a5: new (x: (arg: T) => U) => T; // ok, U is in a parameter position so inferences can be made ->a5 : Symbol(a5, Decl(constructSignatureAssignabilityInInheritance5.ts, 36, 36)) +>a5 : Symbol(I.a5, Decl(constructSignatureAssignabilityInInheritance5.ts, 36, 36)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance5.ts, 37, 13)) >U : Symbol(U, Decl(constructSignatureAssignabilityInInheritance5.ts, 37, 15)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance5.ts, 37, 19)) @@ -197,7 +197,7 @@ interface I extends B { >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance5.ts, 37, 13)) a6: new (x: (arg: T) => U) => T; // ok, same as a5 but with object type hierarchy ->a6 : Symbol(a6, Decl(constructSignatureAssignabilityInInheritance5.ts, 37, 42)) +>a6 : Symbol(I.a6, Decl(constructSignatureAssignabilityInInheritance5.ts, 37, 42)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance5.ts, 38, 13)) >Base : Symbol(Base, Decl(constructSignatureAssignabilityInInheritance5.ts, 0, 0)) >U : Symbol(U, Decl(constructSignatureAssignabilityInInheritance5.ts, 38, 28)) @@ -209,7 +209,7 @@ interface I extends B { >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance5.ts, 38, 13)) a7: new (x: (arg: T) => U) => (r: T) => U; // ok ->a7 : Symbol(a7, Decl(constructSignatureAssignabilityInInheritance5.ts, 38, 71)) +>a7 : Symbol(I.a7, Decl(constructSignatureAssignabilityInInheritance5.ts, 38, 71)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance5.ts, 39, 13)) >Base : Symbol(Base, Decl(constructSignatureAssignabilityInInheritance5.ts, 0, 0)) >U : Symbol(U, Decl(constructSignatureAssignabilityInInheritance5.ts, 39, 28)) @@ -223,7 +223,7 @@ interface I extends B { >U : Symbol(U, Decl(constructSignatureAssignabilityInInheritance5.ts, 39, 28)) a8: new (x: (arg: T) => U, y: (arg2: T) => U) => (r: T) => U; // ok ->a8 : Symbol(a8, Decl(constructSignatureAssignabilityInInheritance5.ts, 39, 81)) +>a8 : Symbol(I.a8, Decl(constructSignatureAssignabilityInInheritance5.ts, 39, 81)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance5.ts, 40, 13)) >Base : Symbol(Base, Decl(constructSignatureAssignabilityInInheritance5.ts, 0, 0)) >U : Symbol(U, Decl(constructSignatureAssignabilityInInheritance5.ts, 40, 28)) @@ -241,7 +241,7 @@ interface I extends B { >U : Symbol(U, Decl(constructSignatureAssignabilityInInheritance5.ts, 40, 28)) a9: new (x: (arg: T) => U, y: (arg2: { foo: string; bing: number }) => U) => (r: T) => U; // ok, same as a8 with compatible object literal ->a9 : Symbol(a9, Decl(constructSignatureAssignabilityInInheritance5.ts, 40, 100)) +>a9 : Symbol(I.a9, Decl(constructSignatureAssignabilityInInheritance5.ts, 40, 100)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance5.ts, 41, 13)) >Base : Symbol(Base, Decl(constructSignatureAssignabilityInInheritance5.ts, 0, 0)) >U : Symbol(U, Decl(constructSignatureAssignabilityInInheritance5.ts, 41, 28)) @@ -260,7 +260,7 @@ interface I extends B { >U : Symbol(U, Decl(constructSignatureAssignabilityInInheritance5.ts, 41, 28)) a10: new (...x: T[]) => T; // ok ->a10 : Symbol(a10, Decl(constructSignatureAssignabilityInInheritance5.ts, 41, 128)) +>a10 : Symbol(I.a10, Decl(constructSignatureAssignabilityInInheritance5.ts, 41, 128)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance5.ts, 42, 14)) >Derived : Symbol(Derived, Decl(constructSignatureAssignabilityInInheritance5.ts, 3, 27)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance5.ts, 42, 33)) @@ -268,7 +268,7 @@ interface I extends B { >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance5.ts, 42, 14)) a11: new (x: T, y: T) => T; // ok ->a11 : Symbol(a11, Decl(constructSignatureAssignabilityInInheritance5.ts, 42, 49)) +>a11 : Symbol(I.a11, Decl(constructSignatureAssignabilityInInheritance5.ts, 42, 49)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance5.ts, 43, 14)) >Base : Symbol(Base, Decl(constructSignatureAssignabilityInInheritance5.ts, 0, 0)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance5.ts, 43, 30)) @@ -278,7 +278,7 @@ interface I extends B { >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance5.ts, 43, 14)) a12: new >(x: Array, y: T) => Array; // ok, less specific parameter type ->a12 : Symbol(a12, Decl(constructSignatureAssignabilityInInheritance5.ts, 43, 47)) +>a12 : Symbol(I.a12, Decl(constructSignatureAssignabilityInInheritance5.ts, 43, 47)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance5.ts, 44, 14)) >Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >Base : Symbol(Base, Decl(constructSignatureAssignabilityInInheritance5.ts, 0, 0)) @@ -291,7 +291,7 @@ interface I extends B { >Derived : Symbol(Derived, Decl(constructSignatureAssignabilityInInheritance5.ts, 3, 27)) a13: new >(x: Array, y: T) => T; // ok, T = Array, satisfies constraint, contextual signature instantiation succeeds ->a13 : Symbol(a13, Decl(constructSignatureAssignabilityInInheritance5.ts, 44, 77)) +>a13 : Symbol(I.a13, Decl(constructSignatureAssignabilityInInheritance5.ts, 44, 77)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance5.ts, 45, 14)) >Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >Derived : Symbol(Derived, Decl(constructSignatureAssignabilityInInheritance5.ts, 3, 27)) @@ -303,7 +303,7 @@ interface I extends B { >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance5.ts, 45, 14)) a14: new (x: { a: T; b: T }) => T; // ok, best common type yields T = {} but that's satisfactory for this signature ->a14 : Symbol(a14, Decl(constructSignatureAssignabilityInInheritance5.ts, 45, 67)) +>a14 : Symbol(I.a14, Decl(constructSignatureAssignabilityInInheritance5.ts, 45, 67)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance5.ts, 46, 14)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance5.ts, 46, 17)) >a : Symbol(a, Decl(constructSignatureAssignabilityInInheritance5.ts, 46, 21)) diff --git a/tests/baselines/reference/constructSignatureAssignabilityInInheritance6.symbols b/tests/baselines/reference/constructSignatureAssignabilityInInheritance6.symbols index 6f80b15484c..bf1a70e1651 100644 --- a/tests/baselines/reference/constructSignatureAssignabilityInInheritance6.symbols +++ b/tests/baselines/reference/constructSignatureAssignabilityInInheritance6.symbols @@ -5,48 +5,48 @@ class Base { foo: string; } >Base : Symbol(Base, Decl(constructSignatureAssignabilityInInheritance6.ts, 0, 0)) ->foo : Symbol(foo, Decl(constructSignatureAssignabilityInInheritance6.ts, 4, 12)) +>foo : Symbol(Base.foo, Decl(constructSignatureAssignabilityInInheritance6.ts, 4, 12)) class Derived extends Base { bar: string; } >Derived : Symbol(Derived, Decl(constructSignatureAssignabilityInInheritance6.ts, 4, 27)) >Base : Symbol(Base, Decl(constructSignatureAssignabilityInInheritance6.ts, 0, 0)) ->bar : Symbol(bar, Decl(constructSignatureAssignabilityInInheritance6.ts, 5, 28)) +>bar : Symbol(Derived.bar, Decl(constructSignatureAssignabilityInInheritance6.ts, 5, 28)) class Derived2 extends Derived { baz: string; } >Derived2 : Symbol(Derived2, Decl(constructSignatureAssignabilityInInheritance6.ts, 5, 43)) >Derived : Symbol(Derived, Decl(constructSignatureAssignabilityInInheritance6.ts, 4, 27)) ->baz : Symbol(baz, Decl(constructSignatureAssignabilityInInheritance6.ts, 6, 32)) +>baz : Symbol(Derived2.baz, Decl(constructSignatureAssignabilityInInheritance6.ts, 6, 32)) class OtherDerived extends Base { bing: string; } >OtherDerived : Symbol(OtherDerived, Decl(constructSignatureAssignabilityInInheritance6.ts, 6, 47)) >Base : Symbol(Base, Decl(constructSignatureAssignabilityInInheritance6.ts, 0, 0)) ->bing : Symbol(bing, Decl(constructSignatureAssignabilityInInheritance6.ts, 7, 33)) +>bing : Symbol(OtherDerived.bing, Decl(constructSignatureAssignabilityInInheritance6.ts, 7, 33)) interface A { // T >A : Symbol(A, Decl(constructSignatureAssignabilityInInheritance6.ts, 7, 49)) // M's a: new (x: T) => T[]; ->a : Symbol(a, Decl(constructSignatureAssignabilityInInheritance6.ts, 9, 13)) +>a : Symbol(A.a, Decl(constructSignatureAssignabilityInInheritance6.ts, 9, 13)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance6.ts, 11, 12)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance6.ts, 11, 15)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance6.ts, 11, 12)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance6.ts, 11, 12)) a2: new (x: T) => string[]; ->a2 : Symbol(a2, Decl(constructSignatureAssignabilityInInheritance6.ts, 11, 28)) +>a2 : Symbol(A.a2, Decl(constructSignatureAssignabilityInInheritance6.ts, 11, 28)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance6.ts, 12, 13)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance6.ts, 12, 16)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance6.ts, 12, 13)) a3: new (x: T) => void; ->a3 : Symbol(a3, Decl(constructSignatureAssignabilityInInheritance6.ts, 12, 34)) +>a3 : Symbol(A.a3, Decl(constructSignatureAssignabilityInInheritance6.ts, 12, 34)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance6.ts, 13, 13)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance6.ts, 13, 16)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance6.ts, 13, 13)) a4: new (x: T, y: U) => string; ->a4 : Symbol(a4, Decl(constructSignatureAssignabilityInInheritance6.ts, 13, 30)) +>a4 : Symbol(A.a4, Decl(constructSignatureAssignabilityInInheritance6.ts, 13, 30)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance6.ts, 14, 13)) >U : Symbol(U, Decl(constructSignatureAssignabilityInInheritance6.ts, 14, 15)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance6.ts, 14, 19)) @@ -55,7 +55,7 @@ interface A { // T >U : Symbol(U, Decl(constructSignatureAssignabilityInInheritance6.ts, 14, 15)) a5: new (x: (arg: T) => U) => T; ->a5 : Symbol(a5, Decl(constructSignatureAssignabilityInInheritance6.ts, 14, 41)) +>a5 : Symbol(A.a5, Decl(constructSignatureAssignabilityInInheritance6.ts, 14, 41)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance6.ts, 15, 13)) >U : Symbol(U, Decl(constructSignatureAssignabilityInInheritance6.ts, 15, 15)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance6.ts, 15, 19)) @@ -65,7 +65,7 @@ interface A { // T >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance6.ts, 15, 13)) a6: new (x: (arg: T) => Derived) => T; ->a6 : Symbol(a6, Decl(constructSignatureAssignabilityInInheritance6.ts, 15, 42)) +>a6 : Symbol(A.a6, Decl(constructSignatureAssignabilityInInheritance6.ts, 15, 42)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance6.ts, 16, 13)) >Base : Symbol(Base, Decl(constructSignatureAssignabilityInInheritance6.ts, 0, 0)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance6.ts, 16, 29)) @@ -75,7 +75,7 @@ interface A { // T >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance6.ts, 16, 13)) a11: new (x: { foo: T }, y: { foo: T; bar: T }) => Base; ->a11 : Symbol(a11, Decl(constructSignatureAssignabilityInInheritance6.ts, 16, 58)) +>a11 : Symbol(A.a11, Decl(constructSignatureAssignabilityInInheritance6.ts, 16, 58)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance6.ts, 17, 14)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance6.ts, 17, 17)) >foo : Symbol(foo, Decl(constructSignatureAssignabilityInInheritance6.ts, 17, 21)) @@ -88,7 +88,7 @@ interface A { // T >Base : Symbol(Base, Decl(constructSignatureAssignabilityInInheritance6.ts, 0, 0)) a15: new (x: { a: T; b: T }) => T[]; ->a15 : Symbol(a15, Decl(constructSignatureAssignabilityInInheritance6.ts, 17, 63)) +>a15 : Symbol(A.a15, Decl(constructSignatureAssignabilityInInheritance6.ts, 17, 63)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance6.ts, 18, 14)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance6.ts, 18, 17)) >a : Symbol(a, Decl(constructSignatureAssignabilityInInheritance6.ts, 18, 21)) @@ -98,7 +98,7 @@ interface A { // T >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance6.ts, 18, 14)) a16: new (x: { a: T; b: T }) => T[]; ->a16 : Symbol(a16, Decl(constructSignatureAssignabilityInInheritance6.ts, 18, 43)) +>a16 : Symbol(A.a16, Decl(constructSignatureAssignabilityInInheritance6.ts, 18, 43)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance6.ts, 19, 14)) >Base : Symbol(Base, Decl(constructSignatureAssignabilityInInheritance6.ts, 0, 0)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance6.ts, 19, 30)) @@ -116,7 +116,7 @@ interface I extends A { >A : Symbol(A, Decl(constructSignatureAssignabilityInInheritance6.ts, 7, 49)) a: new (x: T) => T[]; ->a : Symbol(a, Decl(constructSignatureAssignabilityInInheritance6.ts, 23, 26)) +>a : Symbol(I.a, Decl(constructSignatureAssignabilityInInheritance6.ts, 23, 26)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance6.ts, 24, 12)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance6.ts, 23, 12)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance6.ts, 23, 12)) @@ -128,7 +128,7 @@ interface I2 extends A { >A : Symbol(A, Decl(constructSignatureAssignabilityInInheritance6.ts, 7, 49)) a2: new (x: T) => string[]; ->a2 : Symbol(a2, Decl(constructSignatureAssignabilityInInheritance6.ts, 27, 27)) +>a2 : Symbol(I2.a2, Decl(constructSignatureAssignabilityInInheritance6.ts, 27, 27)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance6.ts, 28, 13)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance6.ts, 27, 13)) } @@ -139,7 +139,7 @@ interface I3 extends A { >A : Symbol(A, Decl(constructSignatureAssignabilityInInheritance6.ts, 7, 49)) a3: new (x: T) => T; ->a3 : Symbol(a3, Decl(constructSignatureAssignabilityInInheritance6.ts, 31, 27)) +>a3 : Symbol(I3.a3, Decl(constructSignatureAssignabilityInInheritance6.ts, 31, 27)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance6.ts, 32, 13)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance6.ts, 31, 13)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance6.ts, 31, 13)) @@ -151,7 +151,7 @@ interface I4 extends A { >A : Symbol(A, Decl(constructSignatureAssignabilityInInheritance6.ts, 7, 49)) a4: new (x: T, y: U) => string; ->a4 : Symbol(a4, Decl(constructSignatureAssignabilityInInheritance6.ts, 35, 27)) +>a4 : Symbol(I4.a4, Decl(constructSignatureAssignabilityInInheritance6.ts, 35, 27)) >U : Symbol(U, Decl(constructSignatureAssignabilityInInheritance6.ts, 36, 13)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance6.ts, 36, 16)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance6.ts, 35, 13)) @@ -165,7 +165,7 @@ interface I5 extends A { >A : Symbol(A, Decl(constructSignatureAssignabilityInInheritance6.ts, 7, 49)) a5: new (x: (arg: T) => U) => T; ->a5 : Symbol(a5, Decl(constructSignatureAssignabilityInInheritance6.ts, 39, 27)) +>a5 : Symbol(I5.a5, Decl(constructSignatureAssignabilityInInheritance6.ts, 39, 27)) >U : Symbol(U, Decl(constructSignatureAssignabilityInInheritance6.ts, 40, 13)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance6.ts, 40, 16)) >arg : Symbol(arg, Decl(constructSignatureAssignabilityInInheritance6.ts, 40, 20)) @@ -180,7 +180,7 @@ interface I7 extends A { >A : Symbol(A, Decl(constructSignatureAssignabilityInInheritance6.ts, 7, 49)) a11: new (x: { foo: T }, y: { foo: U; bar: U }) => Base; ->a11 : Symbol(a11, Decl(constructSignatureAssignabilityInInheritance6.ts, 43, 27)) +>a11 : Symbol(I7.a11, Decl(constructSignatureAssignabilityInInheritance6.ts, 43, 27)) >U : Symbol(U, Decl(constructSignatureAssignabilityInInheritance6.ts, 44, 14)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance6.ts, 44, 17)) >foo : Symbol(foo, Decl(constructSignatureAssignabilityInInheritance6.ts, 44, 21)) @@ -199,7 +199,7 @@ interface I9 extends A { >A : Symbol(A, Decl(constructSignatureAssignabilityInInheritance6.ts, 7, 49)) a16: new (x: { a: T; b: T }) => T[]; ->a16 : Symbol(a16, Decl(constructSignatureAssignabilityInInheritance6.ts, 47, 27)) +>a16 : Symbol(I9.a16, Decl(constructSignatureAssignabilityInInheritance6.ts, 47, 27)) >x : Symbol(x, Decl(constructSignatureAssignabilityInInheritance6.ts, 48, 14)) >a : Symbol(a, Decl(constructSignatureAssignabilityInInheritance6.ts, 48, 18)) >T : Symbol(T, Decl(constructSignatureAssignabilityInInheritance6.ts, 47, 13)) diff --git a/tests/baselines/reference/constructSignaturesWithOverloads2.errors.txt b/tests/baselines/reference/constructSignaturesWithOverloads2.errors.txt index ceb828dd061..617f7b1502f 100644 --- a/tests/baselines/reference/constructSignaturesWithOverloads2.errors.txt +++ b/tests/baselines/reference/constructSignaturesWithOverloads2.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/types/objectTypeLiteral/constructSignatures/constructSignaturesWithOverloads2.ts(32,11): error TS2428: All declarations of an interface must have identical type parameters. +tests/cases/conformance/types/objectTypeLiteral/constructSignatures/constructSignaturesWithOverloads2.ts(32,11): error TS2428: All declarations of 'I' must have identical type parameters. ==== tests/cases/conformance/types/objectTypeLiteral/constructSignatures/constructSignaturesWithOverloads2.ts (1 errors) ==== @@ -35,7 +35,7 @@ tests/cases/conformance/types/objectTypeLiteral/constructSignatures/constructSig interface I { ~ -!!! error TS2428: All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations of 'I' must have identical type parameters. new (x: T, y?: number): C2; new (x: T, y: number): C2; } diff --git a/tests/baselines/reference/constructorArgs.symbols b/tests/baselines/reference/constructorArgs.symbols index 083a094a4cd..ef21795b66f 100644 --- a/tests/baselines/reference/constructorArgs.symbols +++ b/tests/baselines/reference/constructorArgs.symbols @@ -3,7 +3,7 @@ interface Options { >Options : Symbol(Options, Decl(constructorArgs.ts, 0, 0)) value: number; ->value : Symbol(value, Decl(constructorArgs.ts, 0, 19)) +>value : Symbol(Options.value, Decl(constructorArgs.ts, 0, 19)) } class Super { @@ -19,7 +19,7 @@ class Sub extends Super { >Super : Symbol(Super, Decl(constructorArgs.ts, 2, 1)) constructor(public options:Options) { ->options : Symbol(options, Decl(constructorArgs.ts, 10, 13)) +>options : Symbol(Sub.options, Decl(constructorArgs.ts, 10, 13)) >Options : Symbol(Options, Decl(constructorArgs.ts, 0, 0)) super(options.value); diff --git a/tests/baselines/reference/constructorHasPrototypeProperty.symbols b/tests/baselines/reference/constructorHasPrototypeProperty.symbols index 0a90834ac51..b3f610db6dc 100644 --- a/tests/baselines/reference/constructorHasPrototypeProperty.symbols +++ b/tests/baselines/reference/constructorHasPrototypeProperty.symbols @@ -6,7 +6,7 @@ module NonGeneric { >C : Symbol(C, Decl(constructorHasPrototypeProperty.ts, 0, 19)) foo: string; ->foo : Symbol(foo, Decl(constructorHasPrototypeProperty.ts, 1, 13)) +>foo : Symbol(C.foo, Decl(constructorHasPrototypeProperty.ts, 1, 13)) } class D extends C { @@ -14,7 +14,7 @@ module NonGeneric { >C : Symbol(C, Decl(constructorHasPrototypeProperty.ts, 0, 19)) bar: string; ->bar : Symbol(bar, Decl(constructorHasPrototypeProperty.ts, 5, 23)) +>bar : Symbol(D.bar, Decl(constructorHasPrototypeProperty.ts, 5, 23)) } var r = C.prototype; @@ -49,11 +49,11 @@ module Generic { >U : Symbol(U, Decl(constructorHasPrototypeProperty.ts, 16, 14)) foo: T; ->foo : Symbol(foo, Decl(constructorHasPrototypeProperty.ts, 16, 18)) +>foo : Symbol(C.foo, Decl(constructorHasPrototypeProperty.ts, 16, 18)) >T : Symbol(T, Decl(constructorHasPrototypeProperty.ts, 16, 12)) bar: U; ->bar : Symbol(bar, Decl(constructorHasPrototypeProperty.ts, 17, 15)) +>bar : Symbol(C.bar, Decl(constructorHasPrototypeProperty.ts, 17, 15)) >U : Symbol(U, Decl(constructorHasPrototypeProperty.ts, 16, 14)) } @@ -66,11 +66,11 @@ module Generic { >U : Symbol(U, Decl(constructorHasPrototypeProperty.ts, 21, 14)) baz: T; ->baz : Symbol(baz, Decl(constructorHasPrototypeProperty.ts, 21, 33)) +>baz : Symbol(D.baz, Decl(constructorHasPrototypeProperty.ts, 21, 33)) >T : Symbol(T, Decl(constructorHasPrototypeProperty.ts, 21, 12)) bing: U; ->bing : Symbol(bing, Decl(constructorHasPrototypeProperty.ts, 22, 15)) +>bing : Symbol(D.bing, Decl(constructorHasPrototypeProperty.ts, 22, 15)) >U : Symbol(U, Decl(constructorHasPrototypeProperty.ts, 21, 14)) } diff --git a/tests/baselines/reference/constructorImplementationWithDefaultValues.symbols b/tests/baselines/reference/constructorImplementationWithDefaultValues.symbols index a96e053132e..7403c126f45 100644 --- a/tests/baselines/reference/constructorImplementationWithDefaultValues.symbols +++ b/tests/baselines/reference/constructorImplementationWithDefaultValues.symbols @@ -34,7 +34,7 @@ class D { class E { >E : Symbol(E, Decl(constructorImplementationWithDefaultValues.ts, 12, 1)) >T : Symbol(T, Decl(constructorImplementationWithDefaultValues.ts, 14, 8)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) constructor(x); >x : Symbol(x, Decl(constructorImplementationWithDefaultValues.ts, 15, 16)) diff --git a/tests/baselines/reference/constructorOverloads2.symbols b/tests/baselines/reference/constructorOverloads2.symbols index b2b9db6eda3..d2c5acf3b67 100644 --- a/tests/baselines/reference/constructorOverloads2.symbols +++ b/tests/baselines/reference/constructorOverloads2.symbols @@ -12,7 +12,7 @@ class FooBase { >x : Symbol(x, Decl(constructorOverloads2.ts, 3, 16)) } bar1() { /*WScript.Echo("base bar1");*/ } ->bar1 : Symbol(bar1, Decl(constructorOverloads2.ts, 4, 5)) +>bar1 : Symbol(FooBase.bar1, Decl(constructorOverloads2.ts, 4, 5)) } class Foo extends FooBase { @@ -37,7 +37,7 @@ class Foo extends FooBase { >x : Symbol(x, Decl(constructorOverloads2.ts, 12, 16)) } bar1() { /*WScript.Echo("bar1");*/ } ->bar1 : Symbol(bar1, Decl(constructorOverloads2.ts, 14, 5)) +>bar1 : Symbol(Foo.bar1, Decl(constructorOverloads2.ts, 14, 5)) } var f1 = new Foo("hey"); diff --git a/tests/baselines/reference/constructorOverloadsWithOptionalParameters.symbols b/tests/baselines/reference/constructorOverloadsWithOptionalParameters.symbols index 68cecd8f912..08404ab84e7 100644 --- a/tests/baselines/reference/constructorOverloadsWithOptionalParameters.symbols +++ b/tests/baselines/reference/constructorOverloadsWithOptionalParameters.symbols @@ -3,7 +3,7 @@ class C { >C : Symbol(C, Decl(constructorOverloadsWithOptionalParameters.ts, 0, 0)) foo: string; ->foo : Symbol(foo, Decl(constructorOverloadsWithOptionalParameters.ts, 0, 9)) +>foo : Symbol(C.foo, Decl(constructorOverloadsWithOptionalParameters.ts, 0, 9)) constructor(x?, y?: any[]); >x : Symbol(x, Decl(constructorOverloadsWithOptionalParameters.ts, 2, 16)) @@ -18,7 +18,7 @@ class D { >T : Symbol(T, Decl(constructorOverloadsWithOptionalParameters.ts, 7, 8)) foo: string; ->foo : Symbol(foo, Decl(constructorOverloadsWithOptionalParameters.ts, 7, 12)) +>foo : Symbol(D.foo, Decl(constructorOverloadsWithOptionalParameters.ts, 7, 12)) constructor(x?, y?: any[]); >x : Symbol(x, Decl(constructorOverloadsWithOptionalParameters.ts, 9, 16)) diff --git a/tests/baselines/reference/constructorParameterProperties.errors.txt b/tests/baselines/reference/constructorParameterProperties.errors.txt index ab9bebe9d2d..2bc8aaad02b 100644 --- a/tests/baselines/reference/constructorParameterProperties.errors.txt +++ b/tests/baselines/reference/constructorParameterProperties.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties.ts(8,10): error TS2341: Property 'x' is private and only accessible within class 'C'. -tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties.ts(9,10): error TS2445: Property 'z' is protected and only accessible within class 'C' and its subclasses. -tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties.ts(18,10): error TS2341: Property 'x' is private and only accessible within class 'D'. +tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties.ts(8,12): error TS2341: Property 'x' is private and only accessible within class 'C'. +tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties.ts(9,12): error TS2445: Property 'z' is protected and only accessible within class 'C' and its subclasses. +tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties.ts(18,12): error TS2341: Property 'x' is private and only accessible within class 'D'. tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties.ts(19,12): error TS2339: Property 'a' does not exist on type 'D'. -tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties.ts(20,10): error TS2445: Property 'z' is protected and only accessible within class 'D' and its subclasses. +tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties.ts(20,12): error TS2445: Property 'z' is protected and only accessible within class 'D' and its subclasses. ==== tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties.ts (5 errors) ==== @@ -14,10 +14,10 @@ tests/cases/conformance/classes/constructorDeclarations/constructorParameters/co var c: C; var r = c.y; var r2 = c.x; // error - ~~~ + ~ !!! error TS2341: Property 'x' is private and only accessible within class 'C'. var r3 = c.z; // error - ~~~ + ~ !!! error TS2445: Property 'z' is protected and only accessible within class 'C' and its subclasses. class D { @@ -28,12 +28,12 @@ tests/cases/conformance/classes/constructorDeclarations/constructorParameters/co var d: D; var r = d.y; var r2 = d.x; // error - ~~~ + ~ !!! error TS2341: Property 'x' is private and only accessible within class 'D'. var r3 = d.a; // error ~ !!! error TS2339: Property 'a' does not exist on type 'D'. var r4 = d.z; // error - ~~~ + ~ !!! error TS2445: Property 'z' is protected and only accessible within class 'D' and its subclasses. \ No newline at end of file diff --git a/tests/baselines/reference/constructorReturnsInvalidType.errors.txt b/tests/baselines/reference/constructorReturnsInvalidType.errors.txt index a8fe1de4700..3b9a84fea98 100644 --- a/tests/baselines/reference/constructorReturnsInvalidType.errors.txt +++ b/tests/baselines/reference/constructorReturnsInvalidType.errors.txt @@ -1,5 +1,4 @@ tests/cases/compiler/constructorReturnsInvalidType.ts(3,16): error TS2322: Type 'number' is not assignable to type 'X'. - Property 'foo' is missing in type 'Number'. tests/cases/compiler/constructorReturnsInvalidType.ts(3,16): error TS2409: Return type of constructor signature must be assignable to the instance type of the class @@ -9,7 +8,6 @@ tests/cases/compiler/constructorReturnsInvalidType.ts(3,16): error TS2409: Retur return 1; ~ !!! error TS2322: Type 'number' is not assignable to type 'X'. -!!! error TS2322: Property 'foo' is missing in type 'Number'. ~ !!! error TS2409: Return type of constructor signature must be assignable to the instance type of the class } diff --git a/tests/baselines/reference/constructorWithAssignableReturnExpression.errors.txt b/tests/baselines/reference/constructorWithAssignableReturnExpression.errors.txt index 1f7d7133bd7..421e629c113 100644 --- a/tests/baselines/reference/constructorWithAssignableReturnExpression.errors.txt +++ b/tests/baselines/reference/constructorWithAssignableReturnExpression.errors.txt @@ -1,5 +1,4 @@ tests/cases/conformance/classes/constructorDeclarations/constructorWithAssignableReturnExpression.ts(12,16): error TS2322: Type 'number' is not assignable to type 'D'. - Property 'x' is missing in type 'Number'. tests/cases/conformance/classes/constructorDeclarations/constructorWithAssignableReturnExpression.ts(12,16): error TS2409: Return type of constructor signature must be assignable to the instance type of the class tests/cases/conformance/classes/constructorDeclarations/constructorWithAssignableReturnExpression.ts(26,16): error TS2322: Type '{ x: number; }' is not assignable to type 'F'. Types of property 'x' are incompatible. @@ -22,7 +21,6 @@ tests/cases/conformance/classes/constructorDeclarations/constructorWithAssignabl return 1; // error ~ !!! error TS2322: Type 'number' is not assignable to type 'D'. -!!! error TS2322: Property 'x' is missing in type 'Number'. ~ !!! error TS2409: Return type of constructor signature must be assignable to the instance type of the class } diff --git a/tests/baselines/reference/constructorWithExpressionLessReturn.symbols b/tests/baselines/reference/constructorWithExpressionLessReturn.symbols index 0d6f06a91a4..3424e53c51a 100644 --- a/tests/baselines/reference/constructorWithExpressionLessReturn.symbols +++ b/tests/baselines/reference/constructorWithExpressionLessReturn.symbols @@ -11,7 +11,7 @@ class D { >D : Symbol(D, Decl(constructorWithExpressionLessReturn.ts, 4, 1)) x: number; ->x : Symbol(x, Decl(constructorWithExpressionLessReturn.ts, 6, 9)) +>x : Symbol(D.x, Decl(constructorWithExpressionLessReturn.ts, 6, 9)) constructor() { return; @@ -22,7 +22,7 @@ class E { >E : Symbol(E, Decl(constructorWithExpressionLessReturn.ts, 11, 1)) constructor(public x: number) { ->x : Symbol(x, Decl(constructorWithExpressionLessReturn.ts, 14, 16)) +>x : Symbol(E.x, Decl(constructorWithExpressionLessReturn.ts, 14, 16)) return; } @@ -33,7 +33,7 @@ class F { >T : Symbol(T, Decl(constructorWithExpressionLessReturn.ts, 19, 8)) constructor(public x: T) { ->x : Symbol(x, Decl(constructorWithExpressionLessReturn.ts, 20, 16)) +>x : Symbol(F.x, Decl(constructorWithExpressionLessReturn.ts, 20, 16)) >T : Symbol(T, Decl(constructorWithExpressionLessReturn.ts, 19, 8)) return; diff --git a/tests/baselines/reference/constructorsWithSpecializedSignatures.errors.txt b/tests/baselines/reference/constructorsWithSpecializedSignatures.errors.txt index c4d0c7ffb66..4f869fd63a0 100644 --- a/tests/baselines/reference/constructorsWithSpecializedSignatures.errors.txt +++ b/tests/baselines/reference/constructorsWithSpecializedSignatures.errors.txt @@ -1,22 +1,12 @@ -tests/cases/compiler/constructorsWithSpecializedSignatures.ts(3,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/compiler/constructorsWithSpecializedSignatures.ts(4,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/compiler/constructorsWithSpecializedSignatures.ts(17,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/compiler/constructorsWithSpecializedSignatures.ts(18,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/compiler/constructorsWithSpecializedSignatures.ts(20,5): error TS2381: A signature with an implementation cannot use a string literal type. -tests/cases/compiler/constructorsWithSpecializedSignatures.ts(28,5): error TS2381: A signature with an implementation cannot use a string literal type. -tests/cases/compiler/constructorsWithSpecializedSignatures.ts(33,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/compiler/constructorsWithSpecializedSignatures.ts(34,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/compiler/constructorsWithSpecializedSignatures.ts(18,5): error TS2394: Overload signature is not compatible with function implementation. +tests/cases/compiler/constructorsWithSpecializedSignatures.ts(26,5): error TS2394: Overload signature is not compatible with function implementation. -==== tests/cases/compiler/constructorsWithSpecializedSignatures.ts (8 errors) ==== +==== tests/cases/compiler/constructorsWithSpecializedSignatures.ts (2 errors) ==== // errors declare class C { constructor(x: "hi"); - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. constructor(x: "foo"); - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. constructor(x: number); } @@ -30,35 +20,27 @@ tests/cases/compiler/constructorsWithSpecializedSignatures.ts(34,5): error TS238 // errors class D { constructor(x: "hi"); - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. constructor(x: "foo"); ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +!!! error TS2394: Overload signature is not compatible with function implementation. constructor(x: number); constructor(x: "hi") { } - ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2381: A signature with an implementation cannot use a string literal type. } // overloads are ok class D2 { constructor(x: "hi"); constructor(x: "foo"); + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2394: Overload signature is not compatible with function implementation. constructor(x: string); constructor(x: "hi") { } // error - ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2381: A signature with an implementation cannot use a string literal type. } // errors interface I { new (x: "hi"); - ~~~~~~~~~~~~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. new (x: "foo"); - ~~~~~~~~~~~~~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. new (x: number); } diff --git a/tests/baselines/reference/contextualSignatureInstatiationContravariance.symbols b/tests/baselines/reference/contextualSignatureInstatiationContravariance.symbols index c19c61cdbb0..37a0c4adb02 100644 --- a/tests/baselines/reference/contextualSignatureInstatiationContravariance.symbols +++ b/tests/baselines/reference/contextualSignatureInstatiationContravariance.symbols @@ -1,17 +1,17 @@ === tests/cases/compiler/contextualSignatureInstatiationContravariance.ts === interface Animal { x } >Animal : Symbol(Animal, Decl(contextualSignatureInstatiationContravariance.ts, 0, 0)) ->x : Symbol(x, Decl(contextualSignatureInstatiationContravariance.ts, 0, 18)) +>x : Symbol(Animal.x, Decl(contextualSignatureInstatiationContravariance.ts, 0, 18)) interface Giraffe extends Animal { y } >Giraffe : Symbol(Giraffe, Decl(contextualSignatureInstatiationContravariance.ts, 0, 22)) >Animal : Symbol(Animal, Decl(contextualSignatureInstatiationContravariance.ts, 0, 0)) ->y : Symbol(y, Decl(contextualSignatureInstatiationContravariance.ts, 1, 34)) +>y : Symbol(Giraffe.y, Decl(contextualSignatureInstatiationContravariance.ts, 1, 34)) interface Elephant extends Animal { y2 } >Elephant : Symbol(Elephant, Decl(contextualSignatureInstatiationContravariance.ts, 1, 38)) >Animal : Symbol(Animal, Decl(contextualSignatureInstatiationContravariance.ts, 0, 0)) ->y2 : Symbol(y2, Decl(contextualSignatureInstatiationContravariance.ts, 2, 35)) +>y2 : Symbol(Elephant.y2, Decl(contextualSignatureInstatiationContravariance.ts, 2, 35)) var f2: (x: T, y: T) => void; >f2 : Symbol(f2, Decl(contextualSignatureInstatiationContravariance.ts, 4, 3)) diff --git a/tests/baselines/reference/contextualSignatureInstatiationCovariance.symbols b/tests/baselines/reference/contextualSignatureInstatiationCovariance.symbols index 9b1b4c0c5f0..ff8582bb26a 100644 --- a/tests/baselines/reference/contextualSignatureInstatiationCovariance.symbols +++ b/tests/baselines/reference/contextualSignatureInstatiationCovariance.symbols @@ -1,17 +1,17 @@ === tests/cases/compiler/contextualSignatureInstatiationCovariance.ts === interface Animal { x } >Animal : Symbol(Animal, Decl(contextualSignatureInstatiationCovariance.ts, 0, 0)) ->x : Symbol(x, Decl(contextualSignatureInstatiationCovariance.ts, 0, 18)) +>x : Symbol(Animal.x, Decl(contextualSignatureInstatiationCovariance.ts, 0, 18)) interface TallThing { x2 } >TallThing : Symbol(TallThing, Decl(contextualSignatureInstatiationCovariance.ts, 0, 22)) ->x2 : Symbol(x2, Decl(contextualSignatureInstatiationCovariance.ts, 1, 21)) +>x2 : Symbol(TallThing.x2, Decl(contextualSignatureInstatiationCovariance.ts, 1, 21)) interface Giraffe extends Animal, TallThing { y } >Giraffe : Symbol(Giraffe, Decl(contextualSignatureInstatiationCovariance.ts, 1, 26)) >Animal : Symbol(Animal, Decl(contextualSignatureInstatiationCovariance.ts, 0, 0)) >TallThing : Symbol(TallThing, Decl(contextualSignatureInstatiationCovariance.ts, 0, 22)) ->y : Symbol(y, Decl(contextualSignatureInstatiationCovariance.ts, 2, 45)) +>y : Symbol(Giraffe.y, Decl(contextualSignatureInstatiationCovariance.ts, 2, 45)) var f2: (x: T, y: T) => void; >f2 : Symbol(f2, Decl(contextualSignatureInstatiationCovariance.ts, 4, 3)) diff --git a/tests/baselines/reference/contextualThisType.symbols b/tests/baselines/reference/contextualThisType.symbols index 5030a9bbcde..b5f4a7d7bb7 100644 --- a/tests/baselines/reference/contextualThisType.symbols +++ b/tests/baselines/reference/contextualThisType.symbols @@ -3,7 +3,7 @@ interface X { >X : Symbol(X, Decl(contextualThisType.ts, 0, 0)) a: (p: this) => this; ->a : Symbol(a, Decl(contextualThisType.ts, 0, 13)) +>a : Symbol(X.a, Decl(contextualThisType.ts, 0, 13)) >p : Symbol(p, Decl(contextualThisType.ts, 1, 8)) } diff --git a/tests/baselines/reference/contextualTypeAny.errors.txt b/tests/baselines/reference/contextualTypeAny.errors.txt new file mode 100644 index 00000000000..09970be986d --- /dev/null +++ b/tests/baselines/reference/contextualTypeAny.errors.txt @@ -0,0 +1,15 @@ +tests/cases/compiler/contextualTypeAny.ts(3,5): error TS2322: Type '{ p: string; q: any; }' is not assignable to type '{ [s: string]: number; }'. + Property 'p' is incompatible with index signature. + Type 'string' is not assignable to type 'number'. + + +==== tests/cases/compiler/contextualTypeAny.ts (1 errors) ==== + var x: any; + + var obj: { [s: string]: number } = { p: "", q: x }; + ~~~ +!!! error TS2322: Type '{ p: string; q: any; }' is not assignable to type '{ [s: string]: number; }'. +!!! error TS2322: Property 'p' is incompatible with index signature. +!!! error TS2322: Type 'string' is not assignable to type 'number'. + + var arr: number[] = ["", x]; \ No newline at end of file diff --git a/tests/baselines/reference/contextualTypeAny.symbols b/tests/baselines/reference/contextualTypeAny.symbols deleted file mode 100644 index 5132c948a2e..00000000000 --- a/tests/baselines/reference/contextualTypeAny.symbols +++ /dev/null @@ -1,15 +0,0 @@ -=== tests/cases/compiler/contextualTypeAny.ts === -var x: any; ->x : Symbol(x, Decl(contextualTypeAny.ts, 0, 3)) - -var obj: { [s: string]: number } = { p: "", q: x }; ->obj : Symbol(obj, Decl(contextualTypeAny.ts, 2, 3)) ->s : Symbol(s, Decl(contextualTypeAny.ts, 2, 12)) ->p : Symbol(p, Decl(contextualTypeAny.ts, 2, 36)) ->q : Symbol(q, Decl(contextualTypeAny.ts, 2, 43)) ->x : Symbol(x, Decl(contextualTypeAny.ts, 0, 3)) - -var arr: number[] = ["", x]; ->arr : Symbol(arr, Decl(contextualTypeAny.ts, 4, 3)) ->x : Symbol(x, Decl(contextualTypeAny.ts, 0, 3)) - diff --git a/tests/baselines/reference/contextualTypeAny.types b/tests/baselines/reference/contextualTypeAny.types deleted file mode 100644 index cace92d6567..00000000000 --- a/tests/baselines/reference/contextualTypeAny.types +++ /dev/null @@ -1,19 +0,0 @@ -=== tests/cases/compiler/contextualTypeAny.ts === -var x: any; ->x : any - -var obj: { [s: string]: number } = { p: "", q: x }; ->obj : { [s: string]: number; } ->s : string ->{ p: "", q: x } : { [x: string]: any; p: string; q: any; } ->p : string ->"" : string ->q : any ->x : any - -var arr: number[] = ["", x]; ->arr : number[] ->["", x] : any[] ->"" : string ->x : any - diff --git a/tests/baselines/reference/contextualTypeAppliedToVarArgs.symbols b/tests/baselines/reference/contextualTypeAppliedToVarArgs.symbols index bf8774cc7f0..4c87eef268c 100644 --- a/tests/baselines/reference/contextualTypeAppliedToVarArgs.symbols +++ b/tests/baselines/reference/contextualTypeAppliedToVarArgs.symbols @@ -15,7 +15,7 @@ class Foo{ Bar() { ->Bar : Symbol(Bar, Decl(contextualTypeAppliedToVarArgs.ts, 4, 10)) +>Bar : Symbol(Foo.Bar, Decl(contextualTypeAppliedToVarArgs.ts, 4, 10)) delegate(this, function (source, args2) >delegate : Symbol(delegate, Decl(contextualTypeAppliedToVarArgs.ts, 0, 0)) diff --git a/tests/baselines/reference/contextualTypeArrayReturnType.symbols b/tests/baselines/reference/contextualTypeArrayReturnType.symbols index ed0e22d698c..2982a1ce893 100644 --- a/tests/baselines/reference/contextualTypeArrayReturnType.symbols +++ b/tests/baselines/reference/contextualTypeArrayReturnType.symbols @@ -3,7 +3,7 @@ interface IBookStyle { >IBookStyle : Symbol(IBookStyle, Decl(contextualTypeArrayReturnType.ts, 0, 0)) initialLeftPageTransforms?: (width: number) => NamedTransform[]; ->initialLeftPageTransforms : Symbol(initialLeftPageTransforms, Decl(contextualTypeArrayReturnType.ts, 0, 22)) +>initialLeftPageTransforms : Symbol(IBookStyle.initialLeftPageTransforms, Decl(contextualTypeArrayReturnType.ts, 0, 22)) >width : Symbol(width, Decl(contextualTypeArrayReturnType.ts, 1, 33)) >NamedTransform : Symbol(NamedTransform, Decl(contextualTypeArrayReturnType.ts, 2, 1)) } @@ -20,7 +20,7 @@ interface Transform3D { >Transform3D : Symbol(Transform3D, Decl(contextualTypeArrayReturnType.ts, 6, 1)) cachedCss: string; ->cachedCss : Symbol(cachedCss, Decl(contextualTypeArrayReturnType.ts, 8, 23)) +>cachedCss : Symbol(Transform3D.cachedCss, Decl(contextualTypeArrayReturnType.ts, 8, 23)) } var style: IBookStyle = { diff --git a/tests/baselines/reference/contextualTypeArrayReturnType.types b/tests/baselines/reference/contextualTypeArrayReturnType.types index f270b33f568..6c91fd7b8b9 100644 --- a/tests/baselines/reference/contextualTypeArrayReturnType.types +++ b/tests/baselines/reference/contextualTypeArrayReturnType.types @@ -26,18 +26,18 @@ interface Transform3D { var style: IBookStyle = { >style : IBookStyle >IBookStyle : IBookStyle ->{ initialLeftPageTransforms: (width: number) => { return [ {'ry': null } ]; }} : { initialLeftPageTransforms: (width: number) => { [x: string]: any; 'ry': any; }[]; } +>{ initialLeftPageTransforms: (width: number) => { return [ {'ry': null } ]; }} : { initialLeftPageTransforms: (width: number) => { 'ry': any; }[]; } initialLeftPageTransforms: (width: number) => { ->initialLeftPageTransforms : (width: number) => { [x: string]: any; 'ry': any; }[] ->(width: number) => { return [ {'ry': null } ]; } : (width: number) => { [x: string]: any; 'ry': any; }[] +>initialLeftPageTransforms : (width: number) => { 'ry': any; }[] +>(width: number) => { return [ {'ry': null } ]; } : (width: number) => { 'ry': any; }[] >width : number return [ ->[ {'ry': null } ] : { [x: string]: null; 'ry': null; }[] +>[ {'ry': null } ] : { 'ry': null; }[] {'ry': null } ->{'ry': null } : { [x: string]: null; 'ry': null; } +>{'ry': null } : { 'ry': null; } >null : null ]; diff --git a/tests/baselines/reference/contextualTypeWithTuple.errors.txt b/tests/baselines/reference/contextualTypeWithTuple.errors.txt index e447ed62b39..a2d3b224ddc 100644 --- a/tests/baselines/reference/contextualTypeWithTuple.errors.txt +++ b/tests/baselines/reference/contextualTypeWithTuple.errors.txt @@ -3,7 +3,6 @@ tests/cases/conformance/types/tuple/contextualTypeWithTuple.ts(3,5): error TS232 Type '() => number | string | boolean' is not assignable to type '() => number | string'. Type 'number | string | boolean' is not assignable to type 'number | string'. Type 'boolean' is not assignable to type 'number | string'. - Type 'boolean' is not assignable to type 'string'. tests/cases/conformance/types/tuple/contextualTypeWithTuple.ts(15,1): error TS2322: Type '[number, string, boolean]' is not assignable to type '[number, string]'. tests/cases/conformance/types/tuple/contextualTypeWithTuple.ts(18,1): error TS2322: Type '[{}, number]' is not assignable to type '[{ a: string; }, number]'. Types of property '0' are incompatible. @@ -34,7 +33,6 @@ tests/cases/conformance/types/tuple/contextualTypeWithTuple.ts(25,1): error TS23 !!! error TS2322: Type '() => number | string | boolean' is not assignable to type '() => number | string'. !!! error TS2322: Type 'number | string | boolean' is not assignable to type 'number | string'. !!! error TS2322: Type 'boolean' is not assignable to type 'number | string'. -!!! error TS2322: Type 'boolean' is not assignable to type 'string'. var numStrBoolTuple: [number, string, boolean] = [5, "foo", true]; var objNumTuple: [{ a: string }, number] = [{ a: "world" }, 5]; var strTupleTuple: [string, [number, {}]] = ["bar", [5, { x: 1, y: 1 }]]; diff --git a/tests/baselines/reference/contextualTypeWithUnionTypeCallSignatures.symbols b/tests/baselines/reference/contextualTypeWithUnionTypeCallSignatures.symbols index 13f95623fd5..530779be29d 100644 --- a/tests/baselines/reference/contextualTypeWithUnionTypeCallSignatures.symbols +++ b/tests/baselines/reference/contextualTypeWithUnionTypeCallSignatures.symbols @@ -10,7 +10,7 @@ interface IWithNoCallSignatures { >IWithNoCallSignatures : Symbol(IWithNoCallSignatures, Decl(contextualTypeWithUnionTypeCallSignatures.ts, 0, 0)) foo: string; ->foo : Symbol(foo, Decl(contextualTypeWithUnionTypeCallSignatures.ts, 7, 33)) +>foo : Symbol(IWithNoCallSignatures.foo, Decl(contextualTypeWithUnionTypeCallSignatures.ts, 7, 33)) } interface IWithCallSignatures { >IWithCallSignatures : Symbol(IWithCallSignatures, Decl(contextualTypeWithUnionTypeCallSignatures.ts, 9, 1)) diff --git a/tests/baselines/reference/contextualTypeWithUnionTypeIndexSignatures.symbols b/tests/baselines/reference/contextualTypeWithUnionTypeIndexSignatures.symbols index 14b595f8b33..985bb52f243 100644 --- a/tests/baselines/reference/contextualTypeWithUnionTypeIndexSignatures.symbols +++ b/tests/baselines/reference/contextualTypeWithUnionTypeIndexSignatures.symbols @@ -18,7 +18,7 @@ interface IWithNoStringIndexSignature { >IWithNoStringIndexSignature : Symbol(IWithNoStringIndexSignature, Decl(contextualTypeWithUnionTypeIndexSignatures.ts, 7, 1)) foo: string; ->foo : Symbol(foo, Decl(contextualTypeWithUnionTypeIndexSignatures.ts, 9, 39)) +>foo : Symbol(IWithNoStringIndexSignature.foo, Decl(contextualTypeWithUnionTypeIndexSignatures.ts, 9, 39)) } interface IWithNoNumberIndexSignature { >IWithNoNumberIndexSignature : Symbol(IWithNoNumberIndexSignature, Decl(contextualTypeWithUnionTypeIndexSignatures.ts, 11, 1)) diff --git a/tests/baselines/reference/contextualTypeWithUnionTypeIndexSignatures.types b/tests/baselines/reference/contextualTypeWithUnionTypeIndexSignatures.types index 2f24ad08227..965e4d21d99 100644 --- a/tests/baselines/reference/contextualTypeWithUnionTypeIndexSignatures.types +++ b/tests/baselines/reference/contextualTypeWithUnionTypeIndexSignatures.types @@ -69,7 +69,7 @@ var x: IWithNoStringIndexSignature | IWithStringIndexSignature1 = { z: a => a }; >x : IWithNoStringIndexSignature | IWithStringIndexSignature1 >IWithNoStringIndexSignature : IWithNoStringIndexSignature >IWithStringIndexSignature1 : IWithStringIndexSignature1 ->{ z: a => a } : { [x: string]: (a: number) => number; z: (a: number) => number; } +>{ z: a => a } : { z: (a: number) => number; } >z : (a: number) => number >a => a : (a: number) => number >a : number @@ -79,7 +79,7 @@ var x: IWithNoStringIndexSignature | IWithStringIndexSignature1 = { foo: a => a >x : IWithNoStringIndexSignature | IWithStringIndexSignature1 >IWithNoStringIndexSignature : IWithNoStringIndexSignature >IWithStringIndexSignature1 : IWithStringIndexSignature1 ->{ foo: a => a } : { [x: string]: (a: any) => any; foo: (a: any) => any; } +>{ foo: a => a } : { foo: (a: any) => any; } >foo : (a: any) => any >a => a : (a: any) => any >a : any @@ -89,7 +89,7 @@ var x: IWithNoStringIndexSignature | IWithStringIndexSignature1 = { foo: "hello" >x : IWithNoStringIndexSignature | IWithStringIndexSignature1 >IWithNoStringIndexSignature : IWithNoStringIndexSignature >IWithStringIndexSignature1 : IWithStringIndexSignature1 ->{ foo: "hello" } : { [x: string]: string; foo: string; } +>{ foo: "hello" } : { foo: string; } >foo : string >"hello" : string @@ -97,7 +97,7 @@ var x2: IWithStringIndexSignature1 | IWithStringIndexSignature2 = { z: a => a.to >x2 : IWithStringIndexSignature1 | IWithStringIndexSignature2 >IWithStringIndexSignature1 : IWithStringIndexSignature1 >IWithStringIndexSignature2 : IWithStringIndexSignature2 ->{ z: a => a.toString() } : { [x: string]: (a: number) => string; z: (a: number) => string; } +>{ z: a => a.toString() } : { z: (a: number) => string; } >z : (a: number) => string >a => a.toString() : (a: number) => string >a : number @@ -110,7 +110,7 @@ var x2: IWithStringIndexSignature1 | IWithStringIndexSignature2 = { z: a => a }; >x2 : IWithStringIndexSignature1 | IWithStringIndexSignature2 >IWithStringIndexSignature1 : IWithStringIndexSignature1 >IWithStringIndexSignature2 : IWithStringIndexSignature2 ->{ z: a => a } : { [x: string]: (a: number) => number; z: (a: number) => number; } +>{ z: a => a } : { z: (a: number) => number; } >z : (a: number) => number >a => a : (a: number) => number >a : number @@ -124,7 +124,7 @@ var x3: IWithNoNumberIndexSignature | IWithNumberIndexSignature1 = { 1: a => a } >x3 : IWithNoNumberIndexSignature | IWithNumberIndexSignature1 >IWithNoNumberIndexSignature : IWithNoNumberIndexSignature >IWithNumberIndexSignature1 : IWithNumberIndexSignature1 ->{ 1: a => a } : { [x: number]: (a: number) => number; 1: (a: number) => number; } +>{ 1: a => a } : { 1: (a: number) => number; } >a => a : (a: number) => number >a : number >a : number @@ -133,7 +133,7 @@ var x3: IWithNoNumberIndexSignature | IWithNumberIndexSignature1 = { 0: a => a } >x3 : IWithNoNumberIndexSignature | IWithNumberIndexSignature1 >IWithNoNumberIndexSignature : IWithNoNumberIndexSignature >IWithNumberIndexSignature1 : IWithNumberIndexSignature1 ->{ 0: a => a } : { [x: number]: (a: any) => any; 0: (a: any) => any; } +>{ 0: a => a } : { 0: (a: any) => any; } >a => a : (a: any) => any >a : any >a : any @@ -142,14 +142,14 @@ var x3: IWithNoNumberIndexSignature | IWithNumberIndexSignature1 = { 0: "hello" >x3 : IWithNoNumberIndexSignature | IWithNumberIndexSignature1 >IWithNoNumberIndexSignature : IWithNoNumberIndexSignature >IWithNumberIndexSignature1 : IWithNumberIndexSignature1 ->{ 0: "hello" } : { [x: number]: string; 0: string; } +>{ 0: "hello" } : { 0: string; } >"hello" : string var x4: IWithNumberIndexSignature1 | IWithNumberIndexSignature2 = { 1: a => a.toString() }; // a should be number >x4 : IWithNumberIndexSignature1 | IWithNumberIndexSignature2 >IWithNumberIndexSignature1 : IWithNumberIndexSignature1 >IWithNumberIndexSignature2 : IWithNumberIndexSignature2 ->{ 1: a => a.toString() } : { [x: number]: (a: number) => string; 1: (a: number) => string; } +>{ 1: a => a.toString() } : { 1: (a: number) => string; } >a => a.toString() : (a: number) => string >a : number >a.toString() : string @@ -161,7 +161,7 @@ var x4: IWithNumberIndexSignature1 | IWithNumberIndexSignature2 = { 1: a => a }; >x4 : IWithNumberIndexSignature1 | IWithNumberIndexSignature2 >IWithNumberIndexSignature1 : IWithNumberIndexSignature1 >IWithNumberIndexSignature2 : IWithNumberIndexSignature2 ->{ 1: a => a } : { [x: number]: (a: number) => number; 1: (a: number) => number; } +>{ 1: a => a } : { 1: (a: number) => number; } >a => a : (a: number) => number >a : number >a : number diff --git a/tests/baselines/reference/contextualTypeWithUnionTypeMembers.symbols b/tests/baselines/reference/contextualTypeWithUnionTypeMembers.symbols index 5a0891c3b88..2b5eb35aa07 100644 --- a/tests/baselines/reference/contextualTypeWithUnionTypeMembers.symbols +++ b/tests/baselines/reference/contextualTypeWithUnionTypeMembers.symbols @@ -6,48 +6,48 @@ interface I1 { >T : Symbol(T, Decl(contextualTypeWithUnionTypeMembers.ts, 2, 13)) commonMethodType(a: string): string; ->commonMethodType : Symbol(commonMethodType, Decl(contextualTypeWithUnionTypeMembers.ts, 2, 17)) +>commonMethodType : Symbol(I1.commonMethodType, Decl(contextualTypeWithUnionTypeMembers.ts, 2, 17)) >a : Symbol(a, Decl(contextualTypeWithUnionTypeMembers.ts, 3, 21)) commonPropertyType: string; ->commonPropertyType : Symbol(commonPropertyType, Decl(contextualTypeWithUnionTypeMembers.ts, 3, 40)) +>commonPropertyType : Symbol(I1.commonPropertyType, Decl(contextualTypeWithUnionTypeMembers.ts, 3, 40)) commonMethodWithTypeParameter(a: T): T; ->commonMethodWithTypeParameter : Symbol(commonMethodWithTypeParameter, Decl(contextualTypeWithUnionTypeMembers.ts, 4, 31)) +>commonMethodWithTypeParameter : Symbol(I1.commonMethodWithTypeParameter, Decl(contextualTypeWithUnionTypeMembers.ts, 4, 31)) >a : Symbol(a, Decl(contextualTypeWithUnionTypeMembers.ts, 5, 34)) >T : Symbol(T, Decl(contextualTypeWithUnionTypeMembers.ts, 2, 13)) >T : Symbol(T, Decl(contextualTypeWithUnionTypeMembers.ts, 2, 13)) methodOnlyInI1(a: string): string; ->methodOnlyInI1 : Symbol(methodOnlyInI1, Decl(contextualTypeWithUnionTypeMembers.ts, 5, 43)) +>methodOnlyInI1 : Symbol(I1.methodOnlyInI1, Decl(contextualTypeWithUnionTypeMembers.ts, 5, 43)) >a : Symbol(a, Decl(contextualTypeWithUnionTypeMembers.ts, 7, 19)) propertyOnlyInI1: string; ->propertyOnlyInI1 : Symbol(propertyOnlyInI1, Decl(contextualTypeWithUnionTypeMembers.ts, 7, 38)) +>propertyOnlyInI1 : Symbol(I1.propertyOnlyInI1, Decl(contextualTypeWithUnionTypeMembers.ts, 7, 38)) } interface I2 { >I2 : Symbol(I2, Decl(contextualTypeWithUnionTypeMembers.ts, 9, 1)) >T : Symbol(T, Decl(contextualTypeWithUnionTypeMembers.ts, 10, 13)) commonMethodType(a: string): string; ->commonMethodType : Symbol(commonMethodType, Decl(contextualTypeWithUnionTypeMembers.ts, 10, 17)) +>commonMethodType : Symbol(I2.commonMethodType, Decl(contextualTypeWithUnionTypeMembers.ts, 10, 17)) >a : Symbol(a, Decl(contextualTypeWithUnionTypeMembers.ts, 11, 21)) commonPropertyType: string; ->commonPropertyType : Symbol(commonPropertyType, Decl(contextualTypeWithUnionTypeMembers.ts, 11, 40)) +>commonPropertyType : Symbol(I2.commonPropertyType, Decl(contextualTypeWithUnionTypeMembers.ts, 11, 40)) commonMethodWithTypeParameter(a: T): T; ->commonMethodWithTypeParameter : Symbol(commonMethodWithTypeParameter, Decl(contextualTypeWithUnionTypeMembers.ts, 12, 31)) +>commonMethodWithTypeParameter : Symbol(I2.commonMethodWithTypeParameter, Decl(contextualTypeWithUnionTypeMembers.ts, 12, 31)) >a : Symbol(a, Decl(contextualTypeWithUnionTypeMembers.ts, 13, 34)) >T : Symbol(T, Decl(contextualTypeWithUnionTypeMembers.ts, 10, 13)) >T : Symbol(T, Decl(contextualTypeWithUnionTypeMembers.ts, 10, 13)) methodOnlyInI2(a: string): string; ->methodOnlyInI2 : Symbol(methodOnlyInI2, Decl(contextualTypeWithUnionTypeMembers.ts, 13, 43)) +>methodOnlyInI2 : Symbol(I2.methodOnlyInI2, Decl(contextualTypeWithUnionTypeMembers.ts, 13, 43)) >a : Symbol(a, Decl(contextualTypeWithUnionTypeMembers.ts, 15, 19)) propertyOnlyInI2: string; ->propertyOnlyInI2 : Symbol(propertyOnlyInI2, Decl(contextualTypeWithUnionTypeMembers.ts, 15, 38)) +>propertyOnlyInI2 : Symbol(I2.propertyOnlyInI2, Decl(contextualTypeWithUnionTypeMembers.ts, 15, 38)) } // Let S be the set of types in U that has a property P. @@ -250,23 +250,23 @@ interface I11 { >I11 : Symbol(I11, Decl(contextualTypeWithUnionTypeMembers.ts, 74, 7)) commonMethodDifferentReturnType(a: string, b: number): string; ->commonMethodDifferentReturnType : Symbol(commonMethodDifferentReturnType, Decl(contextualTypeWithUnionTypeMembers.ts, 76, 15)) +>commonMethodDifferentReturnType : Symbol(I11.commonMethodDifferentReturnType, Decl(contextualTypeWithUnionTypeMembers.ts, 76, 15)) >a : Symbol(a, Decl(contextualTypeWithUnionTypeMembers.ts, 77, 36)) >b : Symbol(b, Decl(contextualTypeWithUnionTypeMembers.ts, 77, 46)) commonPropertyDifferentType: string; ->commonPropertyDifferentType : Symbol(commonPropertyDifferentType, Decl(contextualTypeWithUnionTypeMembers.ts, 77, 66)) +>commonPropertyDifferentType : Symbol(I11.commonPropertyDifferentType, Decl(contextualTypeWithUnionTypeMembers.ts, 77, 66)) } interface I21 { >I21 : Symbol(I21, Decl(contextualTypeWithUnionTypeMembers.ts, 79, 1)) commonMethodDifferentReturnType(a: string, b: number): number; ->commonMethodDifferentReturnType : Symbol(commonMethodDifferentReturnType, Decl(contextualTypeWithUnionTypeMembers.ts, 80, 15)) +>commonMethodDifferentReturnType : Symbol(I21.commonMethodDifferentReturnType, Decl(contextualTypeWithUnionTypeMembers.ts, 80, 15)) >a : Symbol(a, Decl(contextualTypeWithUnionTypeMembers.ts, 81, 36)) >b : Symbol(b, Decl(contextualTypeWithUnionTypeMembers.ts, 81, 46)) commonPropertyDifferentType: number; ->commonPropertyDifferentType : Symbol(commonPropertyDifferentType, Decl(contextualTypeWithUnionTypeMembers.ts, 81, 66)) +>commonPropertyDifferentType : Symbol(I21.commonPropertyDifferentType, Decl(contextualTypeWithUnionTypeMembers.ts, 81, 66)) } var i11: I11; >i11 : Symbol(i11, Decl(contextualTypeWithUnionTypeMembers.ts, 84, 3)) diff --git a/tests/baselines/reference/contextualTyping10.symbols b/tests/baselines/reference/contextualTyping10.symbols index 130116264e0..33e40d73bff 100644 --- a/tests/baselines/reference/contextualTyping10.symbols +++ b/tests/baselines/reference/contextualTyping10.symbols @@ -1,7 +1,7 @@ === tests/cases/compiler/contextualTyping10.ts === class foo { public bar:{id:number;}[] = [{id:1}, {id:2}]; } >foo : Symbol(foo, Decl(contextualTyping10.ts, 0, 0)) ->bar : Symbol(bar, Decl(contextualTyping10.ts, 0, 11)) +>bar : Symbol(foo.bar, Decl(contextualTyping10.ts, 0, 11)) >id : Symbol(id, Decl(contextualTyping10.ts, 0, 24)) >id : Symbol(id, Decl(contextualTyping10.ts, 0, 42)) >id : Symbol(id, Decl(contextualTyping10.ts, 0, 50)) diff --git a/tests/baselines/reference/contextualTyping14.symbols b/tests/baselines/reference/contextualTyping14.symbols index 7de67445ca8..1480db7d2cd 100644 --- a/tests/baselines/reference/contextualTyping14.symbols +++ b/tests/baselines/reference/contextualTyping14.symbols @@ -1,7 +1,7 @@ === tests/cases/compiler/contextualTyping14.ts === class foo { public bar:(a:number)=>number = function(a){return a}; } >foo : Symbol(foo, Decl(contextualTyping14.ts, 0, 0)) ->bar : Symbol(bar, Decl(contextualTyping14.ts, 0, 11)) +>bar : Symbol(foo.bar, Decl(contextualTyping14.ts, 0, 11)) >a : Symbol(a, Decl(contextualTyping14.ts, 0, 24)) >a : Symbol(a, Decl(contextualTyping14.ts, 0, 53)) >a : Symbol(a, Decl(contextualTyping14.ts, 0, 53)) diff --git a/tests/baselines/reference/contextualTyping15.symbols b/tests/baselines/reference/contextualTyping15.symbols index 902fb03dc70..f2ba2bf6768 100644 --- a/tests/baselines/reference/contextualTyping15.symbols +++ b/tests/baselines/reference/contextualTyping15.symbols @@ -1,6 +1,6 @@ === tests/cases/compiler/contextualTyping15.ts === class foo { public bar: { (): number; (i: number): number; } = function() { return 1 }; } >foo : Symbol(foo, Decl(contextualTyping15.ts, 0, 0)) ->bar : Symbol(bar, Decl(contextualTyping15.ts, 0, 11)) +>bar : Symbol(foo.bar, Decl(contextualTyping15.ts, 0, 11)) >i : Symbol(i, Decl(contextualTyping15.ts, 0, 39)) diff --git a/tests/baselines/reference/contextualTyping21.errors.txt b/tests/baselines/reference/contextualTyping21.errors.txt index 362ead49ad3..db6ecd32b97 100644 --- a/tests/baselines/reference/contextualTyping21.errors.txt +++ b/tests/baselines/reference/contextualTyping21.errors.txt @@ -1,7 +1,6 @@ tests/cases/compiler/contextualTyping21.ts(1,36): error TS2322: Type '({ id: number; } | number)[]' is not assignable to type '{ id: number; }[]'. Type '{ id: number; } | number' is not assignable to type '{ id: number; }'. Type 'number' is not assignable to type '{ id: number; }'. - Property 'id' is missing in type 'Number'. ==== tests/cases/compiler/contextualTyping21.ts (1 errors) ==== @@ -9,5 +8,4 @@ tests/cases/compiler/contextualTyping21.ts(1,36): error TS2322: Type '({ id: num ~~~ !!! error TS2322: Type '({ id: number; } | number)[]' is not assignable to type '{ id: number; }[]'. !!! error TS2322: Type '{ id: number; } | number' is not assignable to type '{ id: number; }'. -!!! error TS2322: Type 'number' is not assignable to type '{ id: number; }'. -!!! error TS2322: Property 'id' is missing in type 'Number'. \ No newline at end of file +!!! error TS2322: Type 'number' is not assignable to type '{ id: number; }'. \ No newline at end of file diff --git a/tests/baselines/reference/contextualTyping24.errors.txt b/tests/baselines/reference/contextualTyping24.errors.txt index a172600e1c5..ea973050625 100644 --- a/tests/baselines/reference/contextualTyping24.errors.txt +++ b/tests/baselines/reference/contextualTyping24.errors.txt @@ -1,11 +1,11 @@ -tests/cases/compiler/contextualTyping24.ts(1,55): error TS2322: Type '(a: string) => number' is not assignable to type '(a: { (): number; (i: number): number; }) => number'. +tests/cases/compiler/contextualTyping24.ts(1,55): error TS2322: Type '(this: void, a: string) => number' is not assignable to type '(a: { (): number; (i: number): number; }) => number'. Types of parameters 'a' and 'a' are incompatible. - Type 'string' is not assignable to type '{ (): number; (i: number): number; }'. + Type '{ (): number; (i: number): number; }' is not assignable to type 'string'. ==== tests/cases/compiler/contextualTyping24.ts (1 errors) ==== - var foo:(a:{():number; (i:number):number; })=>number; foo = function(a:string){return 5}; + var foo:(a:{():number; (i:number):number; })=>number; foo = function(this: void, a:string){return 5}; ~~~ -!!! error TS2322: Type '(a: string) => number' is not assignable to type '(a: { (): number; (i: number): number; }) => number'. +!!! error TS2322: Type '(this: void, a: string) => number' is not assignable to type '(a: { (): number; (i: number): number; }) => number'. !!! error TS2322: Types of parameters 'a' and 'a' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type '{ (): number; (i: number): number; }'. \ No newline at end of file +!!! error TS2322: Type '{ (): number; (i: number): number; }' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/contextualTyping24.js b/tests/baselines/reference/contextualTyping24.js index 04c4ecba21b..14c1feeb031 100644 --- a/tests/baselines/reference/contextualTyping24.js +++ b/tests/baselines/reference/contextualTyping24.js @@ -1,5 +1,5 @@ //// [contextualTyping24.ts] -var foo:(a:{():number; (i:number):number; })=>number; foo = function(a:string){return 5}; +var foo:(a:{():number; (i:number):number; })=>number; foo = function(this: void, a:string){return 5}; //// [contextualTyping24.js] var foo; diff --git a/tests/baselines/reference/contextualTyping3.symbols b/tests/baselines/reference/contextualTyping3.symbols index 584c399e4da..f685e0a0690 100644 --- a/tests/baselines/reference/contextualTyping3.symbols +++ b/tests/baselines/reference/contextualTyping3.symbols @@ -1,7 +1,7 @@ === tests/cases/compiler/contextualTyping3.ts === class foo { public bar:{id:number;} = {id:5}; } >foo : Symbol(foo, Decl(contextualTyping3.ts, 0, 0)) ->bar : Symbol(bar, Decl(contextualTyping3.ts, 0, 11)) +>bar : Symbol(foo.bar, Decl(contextualTyping3.ts, 0, 11)) >id : Symbol(id, Decl(contextualTyping3.ts, 0, 24)) >id : Symbol(id, Decl(contextualTyping3.ts, 0, 39)) diff --git a/tests/baselines/reference/contextualTyping33.errors.txt b/tests/baselines/reference/contextualTyping33.errors.txt index 4ed0787bde3..16c975391a3 100644 --- a/tests/baselines/reference/contextualTyping33.errors.txt +++ b/tests/baselines/reference/contextualTyping33.errors.txt @@ -1,6 +1,7 @@ tests/cases/compiler/contextualTyping33.ts(1,66): error TS2345: Argument of type '((() => number) | (() => string))[]' is not assignable to parameter of type '{ (): number; (i: number): number; }[]'. Type '(() => number) | (() => string)' is not assignable to type '{ (): number; (i: number): number; }'. Type '() => string' is not assignable to type '{ (): number; (i: number): number; }'. + Type 'string' is not assignable to type 'number'. ==== tests/cases/compiler/contextualTyping33.ts (1 errors) ==== @@ -8,4 +9,5 @@ tests/cases/compiler/contextualTyping33.ts(1,66): error TS2345: Argument of type ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '((() => number) | (() => string))[]' is not assignable to parameter of type '{ (): number; (i: number): number; }[]'. !!! error TS2345: Type '(() => number) | (() => string)' is not assignable to type '{ (): number; (i: number): number; }'. -!!! error TS2345: Type '() => string' is not assignable to type '{ (): number; (i: number): number; }'. \ No newline at end of file +!!! error TS2345: Type '() => string' is not assignable to type '{ (): number; (i: number): number; }'. +!!! error TS2345: Type 'string' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/contextualTyping39.errors.txt b/tests/baselines/reference/contextualTyping39.errors.txt index e43624fbead..9081480f4ba 100644 --- a/tests/baselines/reference/contextualTyping39.errors.txt +++ b/tests/baselines/reference/contextualTyping39.errors.txt @@ -1,9 +1,9 @@ -tests/cases/compiler/contextualTyping39.ts(1,11): error TS2352: Neither type '() => string' nor type '() => number' is assignable to the other. - Type 'string' is not assignable to type 'number'. +tests/cases/compiler/contextualTyping39.ts(1,11): error TS2352: Type '() => string' cannot be converted to type '() => number'. + Type 'string' is not comparable to type 'number'. ==== tests/cases/compiler/contextualTyping39.ts (1 errors) ==== var foo = <{ (): number; }> function() { return "err"; }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2352: Neither type '() => string' nor type '() => number' is assignable to the other. -!!! error TS2352: Type 'string' is not assignable to type 'number'. \ No newline at end of file +!!! error TS2352: Type '() => string' cannot be converted to type '() => number'. +!!! error TS2352: Type 'string' is not comparable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/contextualTyping41.errors.txt b/tests/baselines/reference/contextualTyping41.errors.txt index 1ed6da1b782..418d435e7fe 100644 --- a/tests/baselines/reference/contextualTyping41.errors.txt +++ b/tests/baselines/reference/contextualTyping41.errors.txt @@ -1,9 +1,9 @@ -tests/cases/compiler/contextualTyping41.ts(1,11): error TS2352: Neither type '() => string' nor type '{ (): number; (i: number): number; }' is assignable to the other. - Type 'string' is not assignable to type 'number'. +tests/cases/compiler/contextualTyping41.ts(1,11): error TS2352: Type '() => string' cannot be converted to type '{ (): number; (i: number): number; }'. + Type 'string' is not comparable to type 'number'. ==== tests/cases/compiler/contextualTyping41.ts (1 errors) ==== var foo = <{():number; (i:number):number; }> (function(){return "err";}); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2352: Neither type '() => string' nor type '{ (): number; (i: number): number; }' is assignable to the other. -!!! error TS2352: Type 'string' is not assignable to type 'number'. \ No newline at end of file +!!! error TS2352: Type '() => string' cannot be converted to type '{ (): number; (i: number): number; }'. +!!! error TS2352: Type 'string' is not comparable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/contextualTypingArrayOfLambdas.symbols b/tests/baselines/reference/contextualTypingArrayOfLambdas.symbols index 79355e0a7c6..b049c498f11 100644 --- a/tests/baselines/reference/contextualTypingArrayOfLambdas.symbols +++ b/tests/baselines/reference/contextualTypingArrayOfLambdas.symbols @@ -3,7 +3,7 @@ class A { >A : Symbol(A, Decl(contextualTypingArrayOfLambdas.ts, 0, 0)) foo: string; ->foo : Symbol(foo, Decl(contextualTypingArrayOfLambdas.ts, 0, 9)) +>foo : Symbol(A.foo, Decl(contextualTypingArrayOfLambdas.ts, 0, 9)) } class B extends A { @@ -11,7 +11,7 @@ class B extends A { >A : Symbol(A, Decl(contextualTypingArrayOfLambdas.ts, 0, 0)) bar: string; ->bar : Symbol(bar, Decl(contextualTypingArrayOfLambdas.ts, 4, 19)) +>bar : Symbol(B.bar, Decl(contextualTypingArrayOfLambdas.ts, 4, 19)) } class C extends A { @@ -19,7 +19,7 @@ class C extends A { >A : Symbol(A, Decl(contextualTypingArrayOfLambdas.ts, 0, 0)) baz: string; ->baz : Symbol(baz, Decl(contextualTypingArrayOfLambdas.ts, 8, 19)) +>baz : Symbol(C.baz, Decl(contextualTypingArrayOfLambdas.ts, 8, 19)) } var xs = [(x: A) => { }, (x: B) => { }, (x: C) => { }]; diff --git a/tests/baselines/reference/contextualTypingOfArrayLiterals1.errors.txt b/tests/baselines/reference/contextualTypingOfArrayLiterals1.errors.txt index a1bfaf56336..698a8e789f0 100644 --- a/tests/baselines/reference/contextualTypingOfArrayLiterals1.errors.txt +++ b/tests/baselines/reference/contextualTypingOfArrayLiterals1.errors.txt @@ -2,7 +2,6 @@ tests/cases/compiler/contextualTypingOfArrayLiterals1.ts(5,5): error TS2322: Typ Index signatures are incompatible. Type 'Date | number' is not assignable to type 'Date'. Type 'number' is not assignable to type 'Date'. - Property 'toDateString' is missing in type 'Number'. ==== tests/cases/compiler/contextualTypingOfArrayLiterals1.ts (1 errors) ==== @@ -16,7 +15,6 @@ tests/cases/compiler/contextualTypingOfArrayLiterals1.ts(5,5): error TS2322: Typ !!! error TS2322: Index signatures are incompatible. !!! error TS2322: Type 'Date | number' is not assignable to type 'Date'. !!! error TS2322: Type 'number' is not assignable to type 'Date'. -!!! error TS2322: Property 'toDateString' is missing in type 'Number'. var r2 = x3[1]; r2.getDate(); \ No newline at end of file diff --git a/tests/baselines/reference/contextualTypingOfConditionalExpression.symbols b/tests/baselines/reference/contextualTypingOfConditionalExpression.symbols index 1f8ad9f9c68..c0bd5e51561 100644 --- a/tests/baselines/reference/contextualTypingOfConditionalExpression.symbols +++ b/tests/baselines/reference/contextualTypingOfConditionalExpression.symbols @@ -15,21 +15,21 @@ class A { >A : Symbol(A, Decl(contextualTypingOfConditionalExpression.ts, 0, 82)) foo: number; ->foo : Symbol(foo, Decl(contextualTypingOfConditionalExpression.ts, 2, 9)) +>foo : Symbol(A.foo, Decl(contextualTypingOfConditionalExpression.ts, 2, 9)) } class B extends A { >B : Symbol(B, Decl(contextualTypingOfConditionalExpression.ts, 4, 1)) >A : Symbol(A, Decl(contextualTypingOfConditionalExpression.ts, 0, 82)) bar: number; ->bar : Symbol(bar, Decl(contextualTypingOfConditionalExpression.ts, 5, 19)) +>bar : Symbol(B.bar, Decl(contextualTypingOfConditionalExpression.ts, 5, 19)) } class C extends A { >C : Symbol(C, Decl(contextualTypingOfConditionalExpression.ts, 7, 1)) >A : Symbol(A, Decl(contextualTypingOfConditionalExpression.ts, 0, 82)) baz: number; ->baz : Symbol(baz, Decl(contextualTypingOfConditionalExpression.ts, 8, 19)) +>baz : Symbol(C.baz, Decl(contextualTypingOfConditionalExpression.ts, 8, 19)) } var x2: (a: A) => void = true ? (a) => a.foo : (b) => b.foo; diff --git a/tests/baselines/reference/contextualTypingOfConditionalExpression2.errors.txt b/tests/baselines/reference/contextualTypingOfConditionalExpression2.errors.txt index 08fe22c08e0..4f2adf9921e 100644 --- a/tests/baselines/reference/contextualTypingOfConditionalExpression2.errors.txt +++ b/tests/baselines/reference/contextualTypingOfConditionalExpression2.errors.txt @@ -1,8 +1,7 @@ tests/cases/compiler/contextualTypingOfConditionalExpression2.ts(11,5): error TS2322: Type '((a: C) => number) | ((b: number) => void)' is not assignable to type '(a: A) => void'. Type '(b: number) => void' is not assignable to type '(a: A) => void'. Types of parameters 'b' and 'a' are incompatible. - Type 'number' is not assignable to type 'A'. - Property 'foo' is missing in type 'Number'. + Type 'A' is not assignable to type 'number'. ==== tests/cases/compiler/contextualTypingOfConditionalExpression2.ts (1 errors) ==== @@ -21,6 +20,5 @@ tests/cases/compiler/contextualTypingOfConditionalExpression2.ts(11,5): error TS !!! error TS2322: Type '((a: C) => number) | ((b: number) => void)' is not assignable to type '(a: A) => void'. !!! error TS2322: Type '(b: number) => void' is not assignable to type '(a: A) => void'. !!! error TS2322: Types of parameters 'b' and 'a' are incompatible. -!!! error TS2322: Type 'number' is not assignable to type 'A'. -!!! error TS2322: Property 'foo' is missing in type 'Number'. +!!! error TS2322: Type 'A' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/contextualTypingOfGenericFunctionTypedArguments1.errors.txt b/tests/baselines/reference/contextualTypingOfGenericFunctionTypedArguments1.errors.txt index a11f0009016..c7b15e8efef 100644 --- a/tests/baselines/reference/contextualTypingOfGenericFunctionTypedArguments1.errors.txt +++ b/tests/baselines/reference/contextualTypingOfGenericFunctionTypedArguments1.errors.txt @@ -1,6 +1,5 @@ tests/cases/compiler/contextualTypingOfGenericFunctionTypedArguments1.ts(16,32): error TS2345: Argument of type '(x: number) => string' is not assignable to parameter of type '(x: number) => Date'. Type 'string' is not assignable to type 'Date'. - Property 'toDateString' is missing in type 'String'. tests/cases/compiler/contextualTypingOfGenericFunctionTypedArguments1.ts(17,32): error TS2345: Argument of type '(x: number) => string' is not assignable to parameter of type '(x: number) => Date'. Type 'string' is not assignable to type 'Date'. @@ -25,7 +24,6 @@ tests/cases/compiler/contextualTypingOfGenericFunctionTypedArguments1.ts(17,32): ~ !!! error TS2345: Argument of type '(x: number) => string' is not assignable to parameter of type '(x: number) => Date'. !!! error TS2345: Type 'string' is not assignable to type 'Date'. -!!! error TS2345: Property 'toDateString' is missing in type 'String'. var r6 = _.forEach(c2, (x) => { return x.toFixed() }); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: number) => string' is not assignable to parameter of type '(x: number) => Date'. diff --git a/tests/baselines/reference/contextualTypingOfLambdaWithMultipleSignatures.symbols b/tests/baselines/reference/contextualTypingOfLambdaWithMultipleSignatures.symbols index 3a0c8e5db97..a7a2730456a 100644 --- a/tests/baselines/reference/contextualTypingOfLambdaWithMultipleSignatures.symbols +++ b/tests/baselines/reference/contextualTypingOfLambdaWithMultipleSignatures.symbols @@ -3,11 +3,11 @@ interface Foo { >Foo : Symbol(Foo, Decl(contextualTypingOfLambdaWithMultipleSignatures.ts, 0, 0)) getFoo(n: number): void; ->getFoo : Symbol(getFoo, Decl(contextualTypingOfLambdaWithMultipleSignatures.ts, 0, 15), Decl(contextualTypingOfLambdaWithMultipleSignatures.ts, 1, 28)) +>getFoo : Symbol(Foo.getFoo, Decl(contextualTypingOfLambdaWithMultipleSignatures.ts, 0, 15), Decl(contextualTypingOfLambdaWithMultipleSignatures.ts, 1, 28)) >n : Symbol(n, Decl(contextualTypingOfLambdaWithMultipleSignatures.ts, 1, 11)) getFoo(s: string): void; ->getFoo : Symbol(getFoo, Decl(contextualTypingOfLambdaWithMultipleSignatures.ts, 0, 15), Decl(contextualTypingOfLambdaWithMultipleSignatures.ts, 1, 28)) +>getFoo : Symbol(Foo.getFoo, Decl(contextualTypingOfLambdaWithMultipleSignatures.ts, 0, 15), Decl(contextualTypingOfLambdaWithMultipleSignatures.ts, 1, 28)) >s : Symbol(s, Decl(contextualTypingOfLambdaWithMultipleSignatures.ts, 2, 11)) } diff --git a/tests/baselines/reference/contextualTypingOfObjectLiterals.errors.txt b/tests/baselines/reference/contextualTypingOfObjectLiterals.errors.txt deleted file mode 100644 index ac8063a4378..00000000000 --- a/tests/baselines/reference/contextualTypingOfObjectLiterals.errors.txt +++ /dev/null @@ -1,23 +0,0 @@ -tests/cases/compiler/contextualTypingOfObjectLiterals.ts(4,1): error TS2322: Type '{ x: string; }' is not assignable to type '{ [x: string]: string; }'. - Index signature is missing in type '{ x: string; }'. -tests/cases/compiler/contextualTypingOfObjectLiterals.ts(10,3): error TS2345: Argument of type '{ x: string; }' is not assignable to parameter of type '{ [s: string]: string; }'. - Index signature is missing in type '{ x: string; }'. - - -==== tests/cases/compiler/contextualTypingOfObjectLiterals.ts (2 errors) ==== - var obj1: { [x: string]: string; }; - var obj2 = {x: ""}; - obj1 = {}; // Ok - obj1 = obj2; // Error - indexer doesn't match - ~~~~ -!!! error TS2322: Type '{ x: string; }' is not assignable to type '{ [x: string]: string; }'. -!!! error TS2322: Index signature is missing in type '{ x: string; }'. - - function f(x: { [s: string]: string }) { } - - f({}); // Ok - f(obj1); // Ok - f(obj2); // Error - indexer doesn't match - ~~~~ -!!! error TS2345: Argument of type '{ x: string; }' is not assignable to parameter of type '{ [s: string]: string; }'. -!!! error TS2345: Index signature is missing in type '{ x: string; }'. \ No newline at end of file diff --git a/tests/baselines/reference/contextualTypingOfObjectLiterals.symbols b/tests/baselines/reference/contextualTypingOfObjectLiterals.symbols new file mode 100644 index 00000000000..afa34cfe481 --- /dev/null +++ b/tests/baselines/reference/contextualTypingOfObjectLiterals.symbols @@ -0,0 +1,32 @@ +=== tests/cases/compiler/contextualTypingOfObjectLiterals.ts === +var obj1: { [x: string]: string; }; +>obj1 : Symbol(obj1, Decl(contextualTypingOfObjectLiterals.ts, 0, 3)) +>x : Symbol(x, Decl(contextualTypingOfObjectLiterals.ts, 0, 13)) + +var obj2 = {x: ""}; +>obj2 : Symbol(obj2, Decl(contextualTypingOfObjectLiterals.ts, 1, 3)) +>x : Symbol(x, Decl(contextualTypingOfObjectLiterals.ts, 1, 12)) + +obj1 = {}; // Ok +>obj1 : Symbol(obj1, Decl(contextualTypingOfObjectLiterals.ts, 0, 3)) + +obj1 = obj2; // Error - indexer doesn't match +>obj1 : Symbol(obj1, Decl(contextualTypingOfObjectLiterals.ts, 0, 3)) +>obj2 : Symbol(obj2, Decl(contextualTypingOfObjectLiterals.ts, 1, 3)) + +function f(x: { [s: string]: string }) { } +>f : Symbol(f, Decl(contextualTypingOfObjectLiterals.ts, 3, 12)) +>x : Symbol(x, Decl(contextualTypingOfObjectLiterals.ts, 5, 11)) +>s : Symbol(s, Decl(contextualTypingOfObjectLiterals.ts, 5, 17)) + +f({}); // Ok +>f : Symbol(f, Decl(contextualTypingOfObjectLiterals.ts, 3, 12)) + +f(obj1); // Ok +>f : Symbol(f, Decl(contextualTypingOfObjectLiterals.ts, 3, 12)) +>obj1 : Symbol(obj1, Decl(contextualTypingOfObjectLiterals.ts, 0, 3)) + +f(obj2); // Error - indexer doesn't match +>f : Symbol(f, Decl(contextualTypingOfObjectLiterals.ts, 3, 12)) +>obj2 : Symbol(obj2, Decl(contextualTypingOfObjectLiterals.ts, 1, 3)) + diff --git a/tests/baselines/reference/contextualTypingOfObjectLiterals.types b/tests/baselines/reference/contextualTypingOfObjectLiterals.types new file mode 100644 index 00000000000..a99fb2f39af --- /dev/null +++ b/tests/baselines/reference/contextualTypingOfObjectLiterals.types @@ -0,0 +1,41 @@ +=== tests/cases/compiler/contextualTypingOfObjectLiterals.ts === +var obj1: { [x: string]: string; }; +>obj1 : { [x: string]: string; } +>x : string + +var obj2 = {x: ""}; +>obj2 : { x: string; } +>{x: ""} : { x: string; } +>x : string +>"" : string + +obj1 = {}; // Ok +>obj1 = {} : {} +>obj1 : { [x: string]: string; } +>{} : {} + +obj1 = obj2; // Error - indexer doesn't match +>obj1 = obj2 : { x: string; } +>obj1 : { [x: string]: string; } +>obj2 : { x: string; } + +function f(x: { [s: string]: string }) { } +>f : (x: { [s: string]: string; }) => void +>x : { [s: string]: string; } +>s : string + +f({}); // Ok +>f({}) : void +>f : (x: { [s: string]: string; }) => void +>{} : {} + +f(obj1); // Ok +>f(obj1) : void +>f : (x: { [s: string]: string; }) => void +>obj1 : { [x: string]: string; } + +f(obj2); // Error - indexer doesn't match +>f(obj2) : void +>f : (x: { [s: string]: string; }) => void +>obj2 : { x: string; } + diff --git a/tests/baselines/reference/contextuallyTypeCommaOperator01.js b/tests/baselines/reference/contextuallyTypeCommaOperator01.js new file mode 100644 index 00000000000..0da3ac91000 --- /dev/null +++ b/tests/baselines/reference/contextuallyTypeCommaOperator01.js @@ -0,0 +1,9 @@ +//// [contextuallyTypeCommaOperator01.ts] + +let x: (a: string) => string; + +x = (100, a => a); + +//// [contextuallyTypeCommaOperator01.js] +var x; +x = (100, function (a) { return a; }); diff --git a/tests/baselines/reference/contextuallyTypeCommaOperator01.symbols b/tests/baselines/reference/contextuallyTypeCommaOperator01.symbols new file mode 100644 index 00000000000..c07fd28ae77 --- /dev/null +++ b/tests/baselines/reference/contextuallyTypeCommaOperator01.symbols @@ -0,0 +1,11 @@ +=== tests/cases/conformance/types/contextualTypes/commaOperator/contextuallyTypeCommaOperator01.ts === + +let x: (a: string) => string; +>x : Symbol(x, Decl(contextuallyTypeCommaOperator01.ts, 1, 3)) +>a : Symbol(a, Decl(contextuallyTypeCommaOperator01.ts, 1, 8)) + +x = (100, a => a); +>x : Symbol(x, Decl(contextuallyTypeCommaOperator01.ts, 1, 3)) +>a : Symbol(a, Decl(contextuallyTypeCommaOperator01.ts, 3, 9)) +>a : Symbol(a, Decl(contextuallyTypeCommaOperator01.ts, 3, 9)) + diff --git a/tests/baselines/reference/contextuallyTypeCommaOperator01.types b/tests/baselines/reference/contextuallyTypeCommaOperator01.types new file mode 100644 index 00000000000..c3b7b700d64 --- /dev/null +++ b/tests/baselines/reference/contextuallyTypeCommaOperator01.types @@ -0,0 +1,16 @@ +=== tests/cases/conformance/types/contextualTypes/commaOperator/contextuallyTypeCommaOperator01.ts === + +let x: (a: string) => string; +>x : (a: string) => string +>a : string + +x = (100, a => a); +>x = (100, a => a) : (a: string) => string +>x : (a: string) => string +>(100, a => a) : (a: string) => string +>100, a => a : (a: string) => string +>100 : number +>a => a : (a: string) => string +>a : string +>a : string + diff --git a/tests/baselines/reference/contextuallyTypeCommaOperator02.errors.txt b/tests/baselines/reference/contextuallyTypeCommaOperator02.errors.txt new file mode 100644 index 00000000000..3214f7e5025 --- /dev/null +++ b/tests/baselines/reference/contextuallyTypeCommaOperator02.errors.txt @@ -0,0 +1,18 @@ +tests/cases/conformance/types/contextualTypes/commaOperator/contextuallyTypeCommaOperator02.ts(4,1): error TS2322: Type '(a: string) => number' is not assignable to type '(a: string) => string'. + Type 'number' is not assignable to type 'string'. +tests/cases/conformance/types/contextualTypes/commaOperator/contextuallyTypeCommaOperator02.ts(5,11): error TS2322: Type 'string' is not assignable to type 'number'. + + +==== tests/cases/conformance/types/contextualTypes/commaOperator/contextuallyTypeCommaOperator02.ts (2 errors) ==== + + let x: (a: string) => string; + + x = (100, a => { + ~ +!!! error TS2322: Type '(a: string) => number' is not assignable to type '(a: string) => string'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. + const b: number = a; + ~ +!!! error TS2322: Type 'string' is not assignable to type 'number'. + return b; + }); \ No newline at end of file diff --git a/tests/baselines/reference/contextuallyTypeCommaOperator02.js b/tests/baselines/reference/contextuallyTypeCommaOperator02.js new file mode 100644 index 00000000000..0f8d67dd0ef --- /dev/null +++ b/tests/baselines/reference/contextuallyTypeCommaOperator02.js @@ -0,0 +1,15 @@ +//// [contextuallyTypeCommaOperator02.ts] + +let x: (a: string) => string; + +x = (100, a => { + const b: number = a; + return b; +}); + +//// [contextuallyTypeCommaOperator02.js] +var x; +x = (100, function (a) { + var b = a; + return b; +}); diff --git a/tests/baselines/reference/contextuallyTypeCommaOperator03.errors.txt b/tests/baselines/reference/contextuallyTypeCommaOperator03.errors.txt new file mode 100644 index 00000000000..715b7cf70ea --- /dev/null +++ b/tests/baselines/reference/contextuallyTypeCommaOperator03.errors.txt @@ -0,0 +1,10 @@ +tests/cases/conformance/types/contextualTypes/commaOperator/contextuallyTypeCommaOperator03.ts(4,6): error TS7006: Parameter 'a' implicitly has an 'any' type. + + +==== tests/cases/conformance/types/contextualTypes/commaOperator/contextuallyTypeCommaOperator03.ts (1 errors) ==== + + let x: (a: string) => string; + + x = (a => a, b => b); + ~ +!!! error TS7006: Parameter 'a' implicitly has an 'any' type. \ No newline at end of file diff --git a/tests/baselines/reference/contextuallyTypeCommaOperator03.js b/tests/baselines/reference/contextuallyTypeCommaOperator03.js new file mode 100644 index 00000000000..c4754f28c41 --- /dev/null +++ b/tests/baselines/reference/contextuallyTypeCommaOperator03.js @@ -0,0 +1,9 @@ +//// [contextuallyTypeCommaOperator03.ts] + +let x: (a: string) => string; + +x = (a => a, b => b); + +//// [contextuallyTypeCommaOperator03.js] +var x; +x = (function (a) { return a; }, function (b) { return b; }); diff --git a/tests/baselines/reference/contextuallyTypeLogicalAnd01.js b/tests/baselines/reference/contextuallyTypeLogicalAnd01.js new file mode 100644 index 00000000000..b8b1f0d1e00 --- /dev/null +++ b/tests/baselines/reference/contextuallyTypeLogicalAnd01.js @@ -0,0 +1,11 @@ +//// [contextuallyTypeLogicalAnd01.ts] + +let x: (a: string) => string; +let y = true; + +x = y && (a => a); + +//// [contextuallyTypeLogicalAnd01.js] +var x; +var y = true; +x = y && (function (a) { return a; }); diff --git a/tests/baselines/reference/contextuallyTypeLogicalAnd01.symbols b/tests/baselines/reference/contextuallyTypeLogicalAnd01.symbols new file mode 100644 index 00000000000..4d69b43e669 --- /dev/null +++ b/tests/baselines/reference/contextuallyTypeLogicalAnd01.symbols @@ -0,0 +1,15 @@ +=== tests/cases/conformance/types/contextualTypes/logicalAnd/contextuallyTypeLogicalAnd01.ts === + +let x: (a: string) => string; +>x : Symbol(x, Decl(contextuallyTypeLogicalAnd01.ts, 1, 3)) +>a : Symbol(a, Decl(contextuallyTypeLogicalAnd01.ts, 1, 8)) + +let y = true; +>y : Symbol(y, Decl(contextuallyTypeLogicalAnd01.ts, 2, 3)) + +x = y && (a => a); +>x : Symbol(x, Decl(contextuallyTypeLogicalAnd01.ts, 1, 3)) +>y : Symbol(y, Decl(contextuallyTypeLogicalAnd01.ts, 2, 3)) +>a : Symbol(a, Decl(contextuallyTypeLogicalAnd01.ts, 4, 10)) +>a : Symbol(a, Decl(contextuallyTypeLogicalAnd01.ts, 4, 10)) + diff --git a/tests/baselines/reference/contextuallyTypeLogicalAnd01.types b/tests/baselines/reference/contextuallyTypeLogicalAnd01.types new file mode 100644 index 00000000000..a405888c8a9 --- /dev/null +++ b/tests/baselines/reference/contextuallyTypeLogicalAnd01.types @@ -0,0 +1,20 @@ +=== tests/cases/conformance/types/contextualTypes/logicalAnd/contextuallyTypeLogicalAnd01.ts === + +let x: (a: string) => string; +>x : (a: string) => string +>a : string + +let y = true; +>y : boolean +>true : boolean + +x = y && (a => a); +>x = y && (a => a) : (a: string) => string +>x : (a: string) => string +>y && (a => a) : (a: string) => string +>y : boolean +>(a => a) : (a: string) => string +>a => a : (a: string) => string +>a : string +>a : string + diff --git a/tests/baselines/reference/contextuallyTypeLogicalAnd02.errors.txt b/tests/baselines/reference/contextuallyTypeLogicalAnd02.errors.txt new file mode 100644 index 00000000000..7452d333d88 --- /dev/null +++ b/tests/baselines/reference/contextuallyTypeLogicalAnd02.errors.txt @@ -0,0 +1,19 @@ +tests/cases/conformance/types/contextualTypes/logicalAnd/contextuallyTypeLogicalAnd02.ts(5,1): error TS2322: Type '(a: string) => number' is not assignable to type '(a: string) => string'. + Type 'number' is not assignable to type 'string'. +tests/cases/conformance/types/contextualTypes/logicalAnd/contextuallyTypeLogicalAnd02.ts(6,11): error TS2322: Type 'string' is not assignable to type 'number'. + + +==== tests/cases/conformance/types/contextualTypes/logicalAnd/contextuallyTypeLogicalAnd02.ts (2 errors) ==== + + let x: (a: string) => string; + let y = true; + + x = y && (a => { + ~ +!!! error TS2322: Type '(a: string) => number' is not assignable to type '(a: string) => string'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. + const b: number = a; + ~ +!!! error TS2322: Type 'string' is not assignable to type 'number'. + return b; + }); \ No newline at end of file diff --git a/tests/baselines/reference/contextuallyTypeLogicalAnd02.js b/tests/baselines/reference/contextuallyTypeLogicalAnd02.js new file mode 100644 index 00000000000..6dc1fa5b26a --- /dev/null +++ b/tests/baselines/reference/contextuallyTypeLogicalAnd02.js @@ -0,0 +1,17 @@ +//// [contextuallyTypeLogicalAnd02.ts] + +let x: (a: string) => string; +let y = true; + +x = y && (a => { + const b: number = a; + return b; +}); + +//// [contextuallyTypeLogicalAnd02.js] +var x; +var y = true; +x = y && (function (a) { + var b = a; + return b; +}); diff --git a/tests/baselines/reference/contextuallyTypeLogicalAnd03.errors.txt b/tests/baselines/reference/contextuallyTypeLogicalAnd03.errors.txt new file mode 100644 index 00000000000..1430be00427 --- /dev/null +++ b/tests/baselines/reference/contextuallyTypeLogicalAnd03.errors.txt @@ -0,0 +1,11 @@ +tests/cases/conformance/types/contextualTypes/logicalAnd/contextuallyTypeLogicalAnd03.ts(5,6): error TS7006: Parameter 'a' implicitly has an 'any' type. + + +==== tests/cases/conformance/types/contextualTypes/logicalAnd/contextuallyTypeLogicalAnd03.ts (1 errors) ==== + + let x: (a: string) => string; + let y = true; + + x = (a => a) && (b => b); + ~ +!!! error TS7006: Parameter 'a' implicitly has an 'any' type. \ No newline at end of file diff --git a/tests/baselines/reference/contextuallyTypeLogicalAnd03.js b/tests/baselines/reference/contextuallyTypeLogicalAnd03.js new file mode 100644 index 00000000000..cbf1b3a319a --- /dev/null +++ b/tests/baselines/reference/contextuallyTypeLogicalAnd03.js @@ -0,0 +1,11 @@ +//// [contextuallyTypeLogicalAnd03.ts] + +let x: (a: string) => string; +let y = true; + +x = (a => a) && (b => b); + +//// [contextuallyTypeLogicalAnd03.js] +var x; +var y = true; +x = (function (a) { return a; }) && (function (b) { return b; }); diff --git a/tests/baselines/reference/contextuallyTypedBindingInitializer.js b/tests/baselines/reference/contextuallyTypedBindingInitializer.js new file mode 100644 index 00000000000..f2424ce55d7 --- /dev/null +++ b/tests/baselines/reference/contextuallyTypedBindingInitializer.js @@ -0,0 +1,51 @@ +//// [contextuallyTypedBindingInitializer.ts] +interface Show { + show: (x: number) => string; +} +function f({ show = v => v.toString() }: Show) {} +function f2({ "show": showRename = v => v.toString() }: Show) {} +function f3({ ["show"]: showRename = v => v.toString() }: Show) {} + +interface Nested { + nested: Show +} +function ff({ nested = { show: v => v.toString() } }: Nested) {} + +interface Tuples { + prop: [string, number]; +} +function g({ prop = ["hello", 1234] }: Tuples) {} + +interface StringUnion { + prop: "foo" | "bar"; +} +function h({ prop = "foo" }: StringUnion) {} + +interface StringIdentity { + stringIdentity(s: string): string; +} +let { stringIdentity: id = arg => arg }: StringIdentity = { stringIdentity: x => x}; + + + + +//// [contextuallyTypedBindingInitializer.js] +function f(_a) { + var _b = _a.show, show = _b === void 0 ? function (v) { return v.toString(); } : _b; +} +function f2(_a) { + var _b = _a["show"], showRename = _b === void 0 ? function (v) { return v.toString(); } : _b; +} +function f3(_a) { + var _b = "show", _c = _a[_b], showRename = _c === void 0 ? function (v) { return v.toString(); } : _c; +} +function ff(_a) { + var _b = _a.nested, nested = _b === void 0 ? { show: function (v) { return v.toString(); } } : _b; +} +function g(_a) { + var _b = _a.prop, prop = _b === void 0 ? ["hello", 1234] : _b; +} +function h(_a) { + var _b = _a.prop, prop = _b === void 0 ? "foo" : _b; +} +var _a = { stringIdentity: function (x) { return x; } }.stringIdentity, id = _a === void 0 ? function (arg) { return arg; } : _a; diff --git a/tests/baselines/reference/contextuallyTypedBindingInitializer.symbols b/tests/baselines/reference/contextuallyTypedBindingInitializer.symbols new file mode 100644 index 00000000000..67406172e7a --- /dev/null +++ b/tests/baselines/reference/contextuallyTypedBindingInitializer.symbols @@ -0,0 +1,94 @@ +=== tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTypedBindingInitializer.ts === +interface Show { +>Show : Symbol(Show, Decl(contextuallyTypedBindingInitializer.ts, 0, 0)) + + show: (x: number) => string; +>show : Symbol(Show.show, Decl(contextuallyTypedBindingInitializer.ts, 0, 16)) +>x : Symbol(x, Decl(contextuallyTypedBindingInitializer.ts, 1, 11)) +} +function f({ show = v => v.toString() }: Show) {} +>f : Symbol(f, Decl(contextuallyTypedBindingInitializer.ts, 2, 1)) +>show : Symbol(show, Decl(contextuallyTypedBindingInitializer.ts, 3, 12)) +>v : Symbol(v, Decl(contextuallyTypedBindingInitializer.ts, 3, 19)) +>v.toString : Symbol(Number.toString, Decl(lib.d.ts, --, --)) +>v : Symbol(v, Decl(contextuallyTypedBindingInitializer.ts, 3, 19)) +>toString : Symbol(Number.toString, Decl(lib.d.ts, --, --)) +>Show : Symbol(Show, Decl(contextuallyTypedBindingInitializer.ts, 0, 0)) + +function f2({ "show": showRename = v => v.toString() }: Show) {} +>f2 : Symbol(f2, Decl(contextuallyTypedBindingInitializer.ts, 3, 49)) +>showRename : Symbol(showRename, Decl(contextuallyTypedBindingInitializer.ts, 4, 13)) +>v : Symbol(v, Decl(contextuallyTypedBindingInitializer.ts, 4, 34)) +>v.toString : Symbol(Number.toString, Decl(lib.d.ts, --, --)) +>v : Symbol(v, Decl(contextuallyTypedBindingInitializer.ts, 4, 34)) +>toString : Symbol(Number.toString, Decl(lib.d.ts, --, --)) +>Show : Symbol(Show, Decl(contextuallyTypedBindingInitializer.ts, 0, 0)) + +function f3({ ["show"]: showRename = v => v.toString() }: Show) {} +>f3 : Symbol(f3, Decl(contextuallyTypedBindingInitializer.ts, 4, 64)) +>"show" : Symbol(showRename, Decl(contextuallyTypedBindingInitializer.ts, 5, 13)) +>showRename : Symbol(showRename, Decl(contextuallyTypedBindingInitializer.ts, 5, 13)) +>v : Symbol(v, Decl(contextuallyTypedBindingInitializer.ts, 5, 36)) +>v.toString : Symbol(Number.toString, Decl(lib.d.ts, --, --)) +>v : Symbol(v, Decl(contextuallyTypedBindingInitializer.ts, 5, 36)) +>toString : Symbol(Number.toString, Decl(lib.d.ts, --, --)) +>Show : Symbol(Show, Decl(contextuallyTypedBindingInitializer.ts, 0, 0)) + +interface Nested { +>Nested : Symbol(Nested, Decl(contextuallyTypedBindingInitializer.ts, 5, 66)) + + nested: Show +>nested : Symbol(Nested.nested, Decl(contextuallyTypedBindingInitializer.ts, 7, 18)) +>Show : Symbol(Show, Decl(contextuallyTypedBindingInitializer.ts, 0, 0)) +} +function ff({ nested = { show: v => v.toString() } }: Nested) {} +>ff : Symbol(ff, Decl(contextuallyTypedBindingInitializer.ts, 9, 1)) +>nested : Symbol(nested, Decl(contextuallyTypedBindingInitializer.ts, 10, 13)) +>show : Symbol(show, Decl(contextuallyTypedBindingInitializer.ts, 10, 24)) +>v : Symbol(v, Decl(contextuallyTypedBindingInitializer.ts, 10, 30)) +>v.toString : Symbol(Number.toString, Decl(lib.d.ts, --, --)) +>v : Symbol(v, Decl(contextuallyTypedBindingInitializer.ts, 10, 30)) +>toString : Symbol(Number.toString, Decl(lib.d.ts, --, --)) +>Nested : Symbol(Nested, Decl(contextuallyTypedBindingInitializer.ts, 5, 66)) + +interface Tuples { +>Tuples : Symbol(Tuples, Decl(contextuallyTypedBindingInitializer.ts, 10, 64)) + + prop: [string, number]; +>prop : Symbol(Tuples.prop, Decl(contextuallyTypedBindingInitializer.ts, 12, 18)) +} +function g({ prop = ["hello", 1234] }: Tuples) {} +>g : Symbol(g, Decl(contextuallyTypedBindingInitializer.ts, 14, 1)) +>prop : Symbol(prop, Decl(contextuallyTypedBindingInitializer.ts, 15, 12)) +>Tuples : Symbol(Tuples, Decl(contextuallyTypedBindingInitializer.ts, 10, 64)) + +interface StringUnion { +>StringUnion : Symbol(StringUnion, Decl(contextuallyTypedBindingInitializer.ts, 15, 49)) + + prop: "foo" | "bar"; +>prop : Symbol(StringUnion.prop, Decl(contextuallyTypedBindingInitializer.ts, 17, 23)) +} +function h({ prop = "foo" }: StringUnion) {} +>h : Symbol(h, Decl(contextuallyTypedBindingInitializer.ts, 19, 1)) +>prop : Symbol(prop, Decl(contextuallyTypedBindingInitializer.ts, 20, 12)) +>StringUnion : Symbol(StringUnion, Decl(contextuallyTypedBindingInitializer.ts, 15, 49)) + +interface StringIdentity { +>StringIdentity : Symbol(StringIdentity, Decl(contextuallyTypedBindingInitializer.ts, 20, 44)) + + stringIdentity(s: string): string; +>stringIdentity : Symbol(StringIdentity.stringIdentity, Decl(contextuallyTypedBindingInitializer.ts, 22, 26)) +>s : Symbol(s, Decl(contextuallyTypedBindingInitializer.ts, 23, 19)) +} +let { stringIdentity: id = arg => arg }: StringIdentity = { stringIdentity: x => x}; +>stringIdentity : Symbol(StringIdentity.stringIdentity, Decl(contextuallyTypedBindingInitializer.ts, 22, 26)) +>id : Symbol(id, Decl(contextuallyTypedBindingInitializer.ts, 25, 5)) +>arg : Symbol(arg, Decl(contextuallyTypedBindingInitializer.ts, 25, 26)) +>arg : Symbol(arg, Decl(contextuallyTypedBindingInitializer.ts, 25, 26)) +>StringIdentity : Symbol(StringIdentity, Decl(contextuallyTypedBindingInitializer.ts, 20, 44)) +>stringIdentity : Symbol(stringIdentity, Decl(contextuallyTypedBindingInitializer.ts, 25, 59)) +>x : Symbol(x, Decl(contextuallyTypedBindingInitializer.ts, 25, 75)) +>x : Symbol(x, Decl(contextuallyTypedBindingInitializer.ts, 25, 75)) + + + diff --git a/tests/baselines/reference/contextuallyTypedBindingInitializer.types b/tests/baselines/reference/contextuallyTypedBindingInitializer.types new file mode 100644 index 00000000000..0d4dfcdd5d9 --- /dev/null +++ b/tests/baselines/reference/contextuallyTypedBindingInitializer.types @@ -0,0 +1,110 @@ +=== tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTypedBindingInitializer.ts === +interface Show { +>Show : Show + + show: (x: number) => string; +>show : (x: number) => string +>x : number +} +function f({ show = v => v.toString() }: Show) {} +>f : ({show}: Show) => void +>show : (x: number) => string +>v => v.toString() : (v: number) => string +>v : number +>v.toString() : string +>v.toString : (radix?: number) => string +>v : number +>toString : (radix?: number) => string +>Show : Show + +function f2({ "show": showRename = v => v.toString() }: Show) {} +>f2 : ({"show": showRename}: Show) => void +>showRename : (x: number) => string +>v => v.toString() : (v: number) => string +>v : number +>v.toString() : string +>v.toString : (radix?: number) => string +>v : number +>toString : (radix?: number) => string +>Show : Show + +function f3({ ["show"]: showRename = v => v.toString() }: Show) {} +>f3 : ({["show"]: showRename}: Show) => void +>"show" : string +>showRename : (x: number) => string +>v => v.toString() : (v: number) => string +>v : number +>v.toString() : string +>v.toString : (radix?: number) => string +>v : number +>toString : (radix?: number) => string +>Show : Show + +interface Nested { +>Nested : Nested + + nested: Show +>nested : Show +>Show : Show +} +function ff({ nested = { show: v => v.toString() } }: Nested) {} +>ff : ({nested}: Nested) => void +>nested : Show +>{ show: v => v.toString() } : { show: (v: number) => string; } +>show : (v: number) => string +>v => v.toString() : (v: number) => string +>v : number +>v.toString() : string +>v.toString : (radix?: number) => string +>v : number +>toString : (radix?: number) => string +>Nested : Nested + +interface Tuples { +>Tuples : Tuples + + prop: [string, number]; +>prop : [string, number] +} +function g({ prop = ["hello", 1234] }: Tuples) {} +>g : ({prop}: Tuples) => void +>prop : [string, number] +>["hello", 1234] : [string, number] +>"hello" : string +>1234 : number +>Tuples : Tuples + +interface StringUnion { +>StringUnion : StringUnion + + prop: "foo" | "bar"; +>prop : "foo" | "bar" +} +function h({ prop = "foo" }: StringUnion) {} +>h : ({prop}: StringUnion) => void +>prop : "foo" | "bar" +>"foo" : "foo" +>StringUnion : StringUnion + +interface StringIdentity { +>StringIdentity : StringIdentity + + stringIdentity(s: string): string; +>stringIdentity : (s: string) => string +>s : string +} +let { stringIdentity: id = arg => arg }: StringIdentity = { stringIdentity: x => x}; +>stringIdentity : any +>id : (s: string) => string +>arg => arg : (arg: string) => string +>arg : string +>arg : string +>StringIdentity : StringIdentity +>{ stringIdentity: x => x} : { stringIdentity: (x: string) => string; } +>stringIdentity : (x: string) => string +>x => x : (x: string) => string +>x : string +>x : string + + + diff --git a/tests/baselines/reference/contextuallyTypedBindingInitializerNegative.errors.txt b/tests/baselines/reference/contextuallyTypedBindingInitializerNegative.errors.txt new file mode 100644 index 00000000000..42d617887e0 --- /dev/null +++ b/tests/baselines/reference/contextuallyTypedBindingInitializerNegative.errors.txt @@ -0,0 +1,69 @@ +tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTypedBindingInitializerNegative.ts(4,20): error TS2322: Type '(v: number) => number' is not assignable to type '(x: number) => string'. + Type 'number' is not assignable to type 'string'. +tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTypedBindingInitializerNegative.ts(5,23): error TS2322: Type '(v: number) => number' is not assignable to type '(x: number) => string'. + Type 'number' is not assignable to type 'string'. +tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTypedBindingInitializerNegative.ts(6,25): error TS2322: Type '(v: number) => number' is not assignable to type '(x: number) => string'. + Type 'number' is not assignable to type 'string'. +tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTypedBindingInitializerNegative.ts(11,23): error TS2322: Type '{ show: (v: number) => number; }' is not assignable to type 'Show'. + Types of property 'show' are incompatible. + Type '(v: number) => number' is not assignable to type '(x: number) => string'. + Type 'number' is not assignable to type 'string'. +tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTypedBindingInitializerNegative.ts(16,23): error TS2322: Type '(arg: string) => number' is not assignable to type '(s: string) => string'. + Type 'number' is not assignable to type 'string'. +tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTypedBindingInitializerNegative.ts(21,14): error TS2322: Type '[number, number]' is not assignable to type '[string, number]'. + Types of property '0' are incompatible. + Type 'number' is not assignable to type 'string'. +tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTypedBindingInitializerNegative.ts(26,14): error TS2322: Type '"baz"' is not assignable to type '"foo" | "bar"'. + + +==== tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTypedBindingInitializerNegative.ts (7 errors) ==== + interface Show { + show: (x: number) => string; + } + function f({ show: showRename = v => v }: Show) {} + ~~~~~~~~~~ +!!! error TS2322: Type '(v: number) => number' is not assignable to type '(x: number) => string'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. + function f2({ "show": showRename = v => v }: Show) {} + ~~~~~~~~~~ +!!! error TS2322: Type '(v: number) => number' is not assignable to type '(x: number) => string'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. + function f3({ ["show"]: showRename = v => v }: Show) {} + ~~~~~~~~~~ +!!! error TS2322: Type '(v: number) => number' is not assignable to type '(x: number) => string'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. + + interface Nested { + nested: Show + } + function ff({ nested: nestedRename = { show: v => v } }: Nested) {} + ~~~~~~~~~~~~ +!!! error TS2322: Type '{ show: (v: number) => number; }' is not assignable to type 'Show'. +!!! error TS2322: Types of property 'show' are incompatible. +!!! error TS2322: Type '(v: number) => number' is not assignable to type '(x: number) => string'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. + + interface StringIdentity { + stringIdentity(s: string): string; + } + let { stringIdentity: id = arg => arg.length }: StringIdentity = { stringIdentity: x => x}; + ~~ +!!! error TS2322: Type '(arg: string) => number' is not assignable to type '(s: string) => string'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. + + interface Tuples { + prop: [string, number]; + } + function g({ prop = [101, 1234] }: Tuples) {} + ~~~~ +!!! error TS2322: Type '[number, number]' is not assignable to type '[string, number]'. +!!! error TS2322: Types of property '0' are incompatible. +!!! error TS2322: Type 'number' is not assignable to type 'string'. + + interface StringUnion { + prop: "foo" | "bar"; + } + function h({ prop = "baz" }: StringUnion) {} + ~~~~ +!!! error TS2322: Type '"baz"' is not assignable to type '"foo" | "bar"'. + \ No newline at end of file diff --git a/tests/baselines/reference/contextuallyTypedBindingInitializerNegative.js b/tests/baselines/reference/contextuallyTypedBindingInitializerNegative.js new file mode 100644 index 00000000000..3f1ed156fdb --- /dev/null +++ b/tests/baselines/reference/contextuallyTypedBindingInitializerNegative.js @@ -0,0 +1,49 @@ +//// [contextuallyTypedBindingInitializerNegative.ts] +interface Show { + show: (x: number) => string; +} +function f({ show: showRename = v => v }: Show) {} +function f2({ "show": showRename = v => v }: Show) {} +function f3({ ["show"]: showRename = v => v }: Show) {} + +interface Nested { + nested: Show +} +function ff({ nested: nestedRename = { show: v => v } }: Nested) {} + +interface StringIdentity { + stringIdentity(s: string): string; +} +let { stringIdentity: id = arg => arg.length }: StringIdentity = { stringIdentity: x => x}; + +interface Tuples { + prop: [string, number]; +} +function g({ prop = [101, 1234] }: Tuples) {} + +interface StringUnion { + prop: "foo" | "bar"; +} +function h({ prop = "baz" }: StringUnion) {} + + +//// [contextuallyTypedBindingInitializerNegative.js] +function f(_a) { + var _b = _a.show, showRename = _b === void 0 ? function (v) { return v; } : _b; +} +function f2(_a) { + var _b = _a["show"], showRename = _b === void 0 ? function (v) { return v; } : _b; +} +function f3(_a) { + var _b = "show", _c = _a[_b], showRename = _c === void 0 ? function (v) { return v; } : _c; +} +function ff(_a) { + var _b = _a.nested, nestedRename = _b === void 0 ? { show: function (v) { return v; } } : _b; +} +var _a = { stringIdentity: function (x) { return x; } }.stringIdentity, id = _a === void 0 ? function (arg) { return arg.length; } : _a; +function g(_a) { + var _b = _a.prop, prop = _b === void 0 ? [101, 1234] : _b; +} +function h(_a) { + var _b = _a.prop, prop = _b === void 0 ? "baz" : _b; +} diff --git a/tests/baselines/reference/contextuallyTypedIife.js b/tests/baselines/reference/contextuallyTypedIife.js new file mode 100644 index 00000000000..0a84e45e30b --- /dev/null +++ b/tests/baselines/reference/contextuallyTypedIife.js @@ -0,0 +1,104 @@ +//// [contextuallyTypedIife.ts] +// arrow +(jake => { })("build"); +// function expression +(function (cats) { })("lol"); +// Lots of Irritating Superfluous Parentheses +(function (x) { } ("!")); +((((function (y) { }))))("-"); +// multiple arguments +((a, b, c) => { })("foo", 101, false); +// default parameters +((m = 10) => m + 1)(12); +((n = 10) => n + 1)(); +// optional parameters +((j?) => j + 1)(12); +((k?) => k + 1)(); +((l, o?) => l + o)(12); // o should be any +// rest parameters +((...numbers) => numbers.every(n => n > 0))(5,6,7); +((...mixed) => mixed.every(n => !!n))(5,'oops','oh no'); +((...noNumbers) => noNumbers.some(n => n > 0))(); +((first, ...rest) => first ? [] : rest.map(n => n > 0))(8,9,10); +// destructuring parameters (with defaults too!) +(({ q }) => q)({ q : 13 }); +(({ p = 14 }) => p)({ p : 15 }); +(({ r = 17 } = { r: 18 }) => r)({r : 19}); +(({ u = 22 } = { u: 23 }) => u)(); +// contextually typed parameters. +let twelve = (f => f(12))(i => i); +let eleven = (o => o.a(11))({ a: function(n) { return n; } }); + + +//// [contextuallyTypedIife.js] +// arrow +(function (jake) { })("build"); +// function expression +(function (cats) { })("lol"); +// Lots of Irritating Superfluous Parentheses +(function (x) { }("!")); +((((function (y) { }))))("-"); +// multiple arguments +(function (a, b, c) { })("foo", 101, false); +// default parameters +(function (m) { + if (m === void 0) { m = 10; } + return m + 1; +})(12); +(function (n) { + if (n === void 0) { n = 10; } + return n + 1; +})(); +// optional parameters +(function (j) { return j + 1; })(12); +(function (k) { return k + 1; })(); +(function (l, o) { return l + o; })(12); // o should be any +// rest parameters +(function () { + var numbers = []; + for (var _i = 0; _i < arguments.length; _i++) { + numbers[_i - 0] = arguments[_i]; + } + return numbers.every(function (n) { return n > 0; }); +})(5, 6, 7); +(function () { + var mixed = []; + for (var _i = 0; _i < arguments.length; _i++) { + mixed[_i - 0] = arguments[_i]; + } + return mixed.every(function (n) { return !!n; }); +})(5, 'oops', 'oh no'); +(function () { + var noNumbers = []; + for (var _i = 0; _i < arguments.length; _i++) { + noNumbers[_i - 0] = arguments[_i]; + } + return noNumbers.some(function (n) { return n > 0; }); +})(); +(function (first) { + var rest = []; + for (var _i = 1; _i < arguments.length; _i++) { + rest[_i - 1] = arguments[_i]; + } + return first ? [] : rest.map(function (n) { return n > 0; }); +})(8, 9, 10); +// destructuring parameters (with defaults too!) +(function (_a) { + var q = _a.q; + return q; +})({ q: 13 }); +(function (_a) { + var _b = _a.p, p = _b === void 0 ? 14 : _b; + return p; +})({ p: 15 }); +(function (_a) { + var _b = (_a === void 0 ? { r: 18 } : _a).r, r = _b === void 0 ? 17 : _b; + return r; +})({ r: 19 }); +(function (_a) { + var _b = (_a === void 0 ? { u: 23 } : _a).u, u = _b === void 0 ? 22 : _b; + return u; +})(); +// contextually typed parameters. +var twelve = (function (f) { return f(12); })(function (i) { return i; }); +var eleven = (function (o) { return o.a(11); })({ a: function (n) { return n; } }); diff --git a/tests/baselines/reference/contextuallyTypedIife.symbols b/tests/baselines/reference/contextuallyTypedIife.symbols new file mode 100644 index 00000000000..824ce6031ce --- /dev/null +++ b/tests/baselines/reference/contextuallyTypedIife.symbols @@ -0,0 +1,121 @@ +=== tests/cases/conformance/expressions/functions/contextuallyTypedIife.ts === +// arrow +(jake => { })("build"); +>jake : Symbol(jake, Decl(contextuallyTypedIife.ts, 1, 1)) + +// function expression +(function (cats) { })("lol"); +>cats : Symbol(cats, Decl(contextuallyTypedIife.ts, 3, 11)) + +// Lots of Irritating Superfluous Parentheses +(function (x) { } ("!")); +>x : Symbol(x, Decl(contextuallyTypedIife.ts, 5, 11)) + +((((function (y) { }))))("-"); +>y : Symbol(y, Decl(contextuallyTypedIife.ts, 6, 14)) + +// multiple arguments +((a, b, c) => { })("foo", 101, false); +>a : Symbol(a, Decl(contextuallyTypedIife.ts, 8, 2)) +>b : Symbol(b, Decl(contextuallyTypedIife.ts, 8, 4)) +>c : Symbol(c, Decl(contextuallyTypedIife.ts, 8, 7)) + +// default parameters +((m = 10) => m + 1)(12); +>m : Symbol(m, Decl(contextuallyTypedIife.ts, 10, 2)) +>m : Symbol(m, Decl(contextuallyTypedIife.ts, 10, 2)) + +((n = 10) => n + 1)(); +>n : Symbol(n, Decl(contextuallyTypedIife.ts, 11, 2)) +>n : Symbol(n, Decl(contextuallyTypedIife.ts, 11, 2)) + +// optional parameters +((j?) => j + 1)(12); +>j : Symbol(j, Decl(contextuallyTypedIife.ts, 13, 2)) +>j : Symbol(j, Decl(contextuallyTypedIife.ts, 13, 2)) + +((k?) => k + 1)(); +>k : Symbol(k, Decl(contextuallyTypedIife.ts, 14, 2)) +>k : Symbol(k, Decl(contextuallyTypedIife.ts, 14, 2)) + +((l, o?) => l + o)(12); // o should be any +>l : Symbol(l, Decl(contextuallyTypedIife.ts, 15, 2)) +>o : Symbol(o, Decl(contextuallyTypedIife.ts, 15, 4)) +>l : Symbol(l, Decl(contextuallyTypedIife.ts, 15, 2)) +>o : Symbol(o, Decl(contextuallyTypedIife.ts, 15, 4)) + +// rest parameters +((...numbers) => numbers.every(n => n > 0))(5,6,7); +>numbers : Symbol(numbers, Decl(contextuallyTypedIife.ts, 17, 2)) +>numbers.every : Symbol(Array.every, Decl(lib.d.ts, --, --)) +>numbers : Symbol(numbers, Decl(contextuallyTypedIife.ts, 17, 2)) +>every : Symbol(Array.every, Decl(lib.d.ts, --, --)) +>n : Symbol(n, Decl(contextuallyTypedIife.ts, 17, 31)) +>n : Symbol(n, Decl(contextuallyTypedIife.ts, 17, 31)) + +((...mixed) => mixed.every(n => !!n))(5,'oops','oh no'); +>mixed : Symbol(mixed, Decl(contextuallyTypedIife.ts, 18, 2)) +>mixed.every : Symbol(Array.every, Decl(lib.d.ts, --, --)) +>mixed : Symbol(mixed, Decl(contextuallyTypedIife.ts, 18, 2)) +>every : Symbol(Array.every, Decl(lib.d.ts, --, --)) +>n : Symbol(n, Decl(contextuallyTypedIife.ts, 18, 27)) +>n : Symbol(n, Decl(contextuallyTypedIife.ts, 18, 27)) + +((...noNumbers) => noNumbers.some(n => n > 0))(); +>noNumbers : Symbol(noNumbers, Decl(contextuallyTypedIife.ts, 19, 2)) +>noNumbers.some : Symbol(Array.some, Decl(lib.d.ts, --, --)) +>noNumbers : Symbol(noNumbers, Decl(contextuallyTypedIife.ts, 19, 2)) +>some : Symbol(Array.some, Decl(lib.d.ts, --, --)) +>n : Symbol(n, Decl(contextuallyTypedIife.ts, 19, 34)) +>n : Symbol(n, Decl(contextuallyTypedIife.ts, 19, 34)) + +((first, ...rest) => first ? [] : rest.map(n => n > 0))(8,9,10); +>first : Symbol(first, Decl(contextuallyTypedIife.ts, 20, 2)) +>rest : Symbol(rest, Decl(contextuallyTypedIife.ts, 20, 8)) +>first : Symbol(first, Decl(contextuallyTypedIife.ts, 20, 2)) +>rest.map : Symbol(Array.map, Decl(lib.d.ts, --, --)) +>rest : Symbol(rest, Decl(contextuallyTypedIife.ts, 20, 8)) +>map : Symbol(Array.map, Decl(lib.d.ts, --, --)) +>n : Symbol(n, Decl(contextuallyTypedIife.ts, 20, 43)) +>n : Symbol(n, Decl(contextuallyTypedIife.ts, 20, 43)) + +// destructuring parameters (with defaults too!) +(({ q }) => q)({ q : 13 }); +>q : Symbol(q, Decl(contextuallyTypedIife.ts, 22, 3)) +>q : Symbol(q, Decl(contextuallyTypedIife.ts, 22, 3)) +>q : Symbol(q, Decl(contextuallyTypedIife.ts, 22, 16)) + +(({ p = 14 }) => p)({ p : 15 }); +>p : Symbol(p, Decl(contextuallyTypedIife.ts, 23, 3)) +>p : Symbol(p, Decl(contextuallyTypedIife.ts, 23, 3)) +>p : Symbol(p, Decl(contextuallyTypedIife.ts, 23, 21)) + +(({ r = 17 } = { r: 18 }) => r)({r : 19}); +>r : Symbol(r, Decl(contextuallyTypedIife.ts, 24, 3)) +>r : Symbol(r, Decl(contextuallyTypedIife.ts, 24, 16)) +>r : Symbol(r, Decl(contextuallyTypedIife.ts, 24, 3)) +>r : Symbol(r, Decl(contextuallyTypedIife.ts, 24, 33)) + +(({ u = 22 } = { u: 23 }) => u)(); +>u : Symbol(u, Decl(contextuallyTypedIife.ts, 25, 3)) +>u : Symbol(u, Decl(contextuallyTypedIife.ts, 25, 16)) +>u : Symbol(u, Decl(contextuallyTypedIife.ts, 25, 3)) + +// contextually typed parameters. +let twelve = (f => f(12))(i => i); +>twelve : Symbol(twelve, Decl(contextuallyTypedIife.ts, 27, 3)) +>f : Symbol(f, Decl(contextuallyTypedIife.ts, 27, 14)) +>f : Symbol(f, Decl(contextuallyTypedIife.ts, 27, 14)) +>i : Symbol(i, Decl(contextuallyTypedIife.ts, 27, 26)) +>i : Symbol(i, Decl(contextuallyTypedIife.ts, 27, 26)) + +let eleven = (o => o.a(11))({ a: function(n) { return n; } }); +>eleven : Symbol(eleven, Decl(contextuallyTypedIife.ts, 28, 3)) +>o : Symbol(o, Decl(contextuallyTypedIife.ts, 28, 14)) +>o.a : Symbol(a, Decl(contextuallyTypedIife.ts, 28, 29)) +>o : Symbol(o, Decl(contextuallyTypedIife.ts, 28, 14)) +>a : Symbol(a, Decl(contextuallyTypedIife.ts, 28, 29)) +>a : Symbol(a, Decl(contextuallyTypedIife.ts, 28, 29)) +>n : Symbol(n, Decl(contextuallyTypedIife.ts, 28, 42)) +>n : Symbol(n, Decl(contextuallyTypedIife.ts, 28, 42)) + diff --git a/tests/baselines/reference/contextuallyTypedIife.types b/tests/baselines/reference/contextuallyTypedIife.types new file mode 100644 index 00000000000..0f2092ef7c3 --- /dev/null +++ b/tests/baselines/reference/contextuallyTypedIife.types @@ -0,0 +1,252 @@ +=== tests/cases/conformance/expressions/functions/contextuallyTypedIife.ts === +// arrow +(jake => { })("build"); +>(jake => { })("build") : void +>(jake => { }) : (jake: string) => void +>jake => { } : (jake: string) => void +>jake : string +>"build" : string + +// function expression +(function (cats) { })("lol"); +>(function (cats) { })("lol") : void +>(function (cats) { }) : (cats: string) => void +>function (cats) { } : (cats: string) => void +>cats : string +>"lol" : string + +// Lots of Irritating Superfluous Parentheses +(function (x) { } ("!")); +>(function (x) { } ("!")) : void +>function (x) { } ("!") : void +>function (x) { } : (x: string) => void +>x : string +>"!" : string + +((((function (y) { }))))("-"); +>((((function (y) { }))))("-") : void +>((((function (y) { })))) : (y: string) => void +>(((function (y) { }))) : (y: string) => void +>((function (y) { })) : (y: string) => void +>(function (y) { }) : (y: string) => void +>function (y) { } : (y: string) => void +>y : string +>"-" : string + +// multiple arguments +((a, b, c) => { })("foo", 101, false); +>((a, b, c) => { })("foo", 101, false) : void +>((a, b, c) => { }) : (a: string, b: number, c: boolean) => void +>(a, b, c) => { } : (a: string, b: number, c: boolean) => void +>a : string +>b : number +>c : boolean +>"foo" : string +>101 : number +>false : boolean + +// default parameters +((m = 10) => m + 1)(12); +>((m = 10) => m + 1)(12) : number +>((m = 10) => m + 1) : (m?: number) => number +>(m = 10) => m + 1 : (m?: number) => number +>m : number +>10 : number +>m + 1 : number +>m : number +>1 : number +>12 : number + +((n = 10) => n + 1)(); +>((n = 10) => n + 1)() : number +>((n = 10) => n + 1) : (n?: number) => number +>(n = 10) => n + 1 : (n?: number) => number +>n : number +>10 : number +>n + 1 : number +>n : number +>1 : number + +// optional parameters +((j?) => j + 1)(12); +>((j?) => j + 1)(12) : number +>((j?) => j + 1) : (j?: number) => number +>(j?) => j + 1 : (j?: number) => number +>j : number +>j + 1 : number +>j : number +>1 : number +>12 : number + +((k?) => k + 1)(); +>((k?) => k + 1)() : any +>((k?) => k + 1) : (k?: any) => any +>(k?) => k + 1 : (k?: any) => any +>k : any +>k + 1 : any +>k : any +>1 : number + +((l, o?) => l + o)(12); // o should be any +>((l, o?) => l + o)(12) : any +>((l, o?) => l + o) : (l: number, o?: any) => any +>(l, o?) => l + o : (l: number, o?: any) => any +>l : number +>o : any +>l + o : any +>l : number +>o : any +>12 : number + +// rest parameters +((...numbers) => numbers.every(n => n > 0))(5,6,7); +>((...numbers) => numbers.every(n => n > 0))(5,6,7) : boolean +>((...numbers) => numbers.every(n => n > 0)) : (...numbers: number[]) => boolean +>(...numbers) => numbers.every(n => n > 0) : (...numbers: number[]) => boolean +>numbers : number[] +>numbers.every(n => n > 0) : boolean +>numbers.every : (callbackfn: (value: number, index: number, array: number[]) => boolean, thisArg?: any) => boolean +>numbers : number[] +>every : (callbackfn: (value: number, index: number, array: number[]) => boolean, thisArg?: any) => boolean +>n => n > 0 : (n: number) => boolean +>n : number +>n > 0 : boolean +>n : number +>0 : number +>5 : number +>6 : number +>7 : number + +((...mixed) => mixed.every(n => !!n))(5,'oops','oh no'); +>((...mixed) => mixed.every(n => !!n))(5,'oops','oh no') : boolean +>((...mixed) => mixed.every(n => !!n)) : (...mixed: (number | string)[]) => boolean +>(...mixed) => mixed.every(n => !!n) : (...mixed: (number | string)[]) => boolean +>mixed : (number | string)[] +>mixed.every(n => !!n) : boolean +>mixed.every : (callbackfn: (value: number | string, index: number, array: (number | string)[]) => boolean, thisArg?: any) => boolean +>mixed : (number | string)[] +>every : (callbackfn: (value: number | string, index: number, array: (number | string)[]) => boolean, thisArg?: any) => boolean +>n => !!n : (n: number | string) => boolean +>n : number | string +>!!n : boolean +>!n : boolean +>n : number | string +>5 : number +>'oops' : string +>'oh no' : string + +((...noNumbers) => noNumbers.some(n => n > 0))(); +>((...noNumbers) => noNumbers.some(n => n > 0))() : boolean +>((...noNumbers) => noNumbers.some(n => n > 0)) : (...noNumbers: any[]) => boolean +>(...noNumbers) => noNumbers.some(n => n > 0) : (...noNumbers: any[]) => boolean +>noNumbers : any[] +>noNumbers.some(n => n > 0) : boolean +>noNumbers.some : (callbackfn: (value: any, index: number, array: any[]) => boolean, thisArg?: any) => boolean +>noNumbers : any[] +>some : (callbackfn: (value: any, index: number, array: any[]) => boolean, thisArg?: any) => boolean +>n => n > 0 : (n: any) => boolean +>n : any +>n > 0 : boolean +>n : any +>0 : number + +((first, ...rest) => first ? [] : rest.map(n => n > 0))(8,9,10); +>((first, ...rest) => first ? [] : rest.map(n => n > 0))(8,9,10) : boolean[] +>((first, ...rest) => first ? [] : rest.map(n => n > 0)) : (first: number, ...rest: number[]) => boolean[] +>(first, ...rest) => first ? [] : rest.map(n => n > 0) : (first: number, ...rest: number[]) => boolean[] +>first : number +>rest : number[] +>first ? [] : rest.map(n => n > 0) : boolean[] +>first : number +>[] : undefined[] +>rest.map(n => n > 0) : boolean[] +>rest.map : (callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[] +>rest : number[] +>map : (callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[] +>n => n > 0 : (n: number) => boolean +>n : number +>n > 0 : boolean +>n : number +>0 : number +>8 : number +>9 : number +>10 : number + +// destructuring parameters (with defaults too!) +(({ q }) => q)({ q : 13 }); +>(({ q }) => q)({ q : 13 }) : number +>(({ q }) => q) : ({q}: { q: number; }) => number +>({ q }) => q : ({q}: { q: number; }) => number +>q : number +>q : number +>{ q : 13 } : { q: number; } +>q : number +>13 : number + +(({ p = 14 }) => p)({ p : 15 }); +>(({ p = 14 }) => p)({ p : 15 }) : number +>(({ p = 14 }) => p) : ({p}: { p: number; }) => number +>({ p = 14 }) => p : ({p}: { p: number; }) => number +>p : number +>14 : number +>p : number +>{ p : 15 } : { p: number; } +>p : number +>15 : number + +(({ r = 17 } = { r: 18 }) => r)({r : 19}); +>(({ r = 17 } = { r: 18 }) => r)({r : 19}) : number +>(({ r = 17 } = { r: 18 }) => r) : ({r}?: { r: number; }) => number +>({ r = 17 } = { r: 18 }) => r : ({r}?: { r: number; }) => number +>r : number +>17 : number +>{ r: 18 } : { r: number; } +>r : number +>18 : number +>r : number +>{r : 19} : { r: number; } +>r : number +>19 : number + +(({ u = 22 } = { u: 23 }) => u)(); +>(({ u = 22 } = { u: 23 }) => u)() : number +>(({ u = 22 } = { u: 23 }) => u) : ({u}?: { u?: number; }) => number +>({ u = 22 } = { u: 23 }) => u : ({u}?: { u?: number; }) => number +>u : number +>22 : number +>{ u: 23 } : { u?: number; } +>u : number +>23 : number +>u : number + +// contextually typed parameters. +let twelve = (f => f(12))(i => i); +>twelve : any +>(f => f(12))(i => i) : any +>(f => f(12)) : (f: (i: any) => any) => any +>f => f(12) : (f: (i: any) => any) => any +>f : (i: any) => any +>f(12) : any +>f : (i: any) => any +>12 : number +>i => i : (i: any) => any +>i : any +>i : any + +let eleven = (o => o.a(11))({ a: function(n) { return n; } }); +>eleven : any +>(o => o.a(11))({ a: function(n) { return n; } }) : any +>(o => o.a(11)) : (o: { a: (n: any) => any; }) => any +>o => o.a(11) : (o: { a: (n: any) => any; }) => any +>o : { a: (n: any) => any; } +>o.a(11) : any +>o.a : (n: any) => any +>o : { a: (n: any) => any; } +>a : (n: any) => any +>11 : number +>{ a: function(n) { return n; } } : { a: (n: any) => any; } +>a : (n: any) => any +>function(n) { return n; } : (n: any) => any +>n : any +>n : any + diff --git a/tests/baselines/reference/contextuallyTypedObjectLiteralMethodDeclaration01.symbols b/tests/baselines/reference/contextuallyTypedObjectLiteralMethodDeclaration01.symbols index 3c26110157a..c240af42b91 100644 --- a/tests/baselines/reference/contextuallyTypedObjectLiteralMethodDeclaration01.symbols +++ b/tests/baselines/reference/contextuallyTypedObjectLiteralMethodDeclaration01.symbols @@ -4,26 +4,26 @@ interface A { >A : Symbol(A, Decl(contextuallyTypedObjectLiteralMethodDeclaration01.ts, 0, 0)) numProp: number; ->numProp : Symbol(numProp, Decl(contextuallyTypedObjectLiteralMethodDeclaration01.ts, 1, 13)) +>numProp : Symbol(A.numProp, Decl(contextuallyTypedObjectLiteralMethodDeclaration01.ts, 1, 13)) } interface B { >B : Symbol(B, Decl(contextuallyTypedObjectLiteralMethodDeclaration01.ts, 3, 1)) strProp: string; ->strProp : Symbol(strProp, Decl(contextuallyTypedObjectLiteralMethodDeclaration01.ts, 5, 14)) +>strProp : Symbol(B.strProp, Decl(contextuallyTypedObjectLiteralMethodDeclaration01.ts, 5, 14)) } interface Foo { >Foo : Symbol(Foo, Decl(contextuallyTypedObjectLiteralMethodDeclaration01.ts, 7, 1)) method1(arg: A): void; ->method1 : Symbol(method1, Decl(contextuallyTypedObjectLiteralMethodDeclaration01.ts, 9, 15)) +>method1 : Symbol(Foo.method1, Decl(contextuallyTypedObjectLiteralMethodDeclaration01.ts, 9, 15)) >arg : Symbol(arg, Decl(contextuallyTypedObjectLiteralMethodDeclaration01.ts, 10, 12)) >A : Symbol(A, Decl(contextuallyTypedObjectLiteralMethodDeclaration01.ts, 0, 0)) method2(arg: B): void; ->method2 : Symbol(method2, Decl(contextuallyTypedObjectLiteralMethodDeclaration01.ts, 10, 26)) +>method2 : Symbol(Foo.method2, Decl(contextuallyTypedObjectLiteralMethodDeclaration01.ts, 10, 26)) >arg : Symbol(arg, Decl(contextuallyTypedObjectLiteralMethodDeclaration01.ts, 11, 12)) >B : Symbol(B, Decl(contextuallyTypedObjectLiteralMethodDeclaration01.ts, 3, 1)) } diff --git a/tests/baselines/reference/contextuallyTypedStringLiteralsInJsxAttributes01.errors.txt b/tests/baselines/reference/contextuallyTypedStringLiteralsInJsxAttributes01.errors.txt new file mode 100644 index 00000000000..48e11fb1221 --- /dev/null +++ b/tests/baselines/reference/contextuallyTypedStringLiteralsInJsxAttributes01.errors.txt @@ -0,0 +1,26 @@ +tests/cases/conformance/types/contextualTypes/jsxAttributes/contextuallyTypedStringLiteralsInJsxAttributes01.tsx(16,15): error TS2322: Type '"f"' is not assignable to type '"A" | "B" | "C"'. +tests/cases/conformance/types/contextualTypes/jsxAttributes/contextuallyTypedStringLiteralsInJsxAttributes01.tsx(17,15): error TS2322: Type '"f"' is not assignable to type '"A" | "B" | "C"'. + + +==== tests/cases/conformance/types/contextualTypes/jsxAttributes/contextuallyTypedStringLiteralsInJsxAttributes01.tsx (2 errors) ==== + + namespace JSX { + export interface IntrinsicElements { + span: {}; + } + export interface Element { + something?: any; + } + } + + const FooComponent = (props: { foo: "A" | "B" | "C" }) => {props.foo}; + + ; + ; + + ; + ~~~~~~~~~ +!!! error TS2322: Type '"f"' is not assignable to type '"A" | "B" | "C"'. + ; + ~~~~~~~ +!!! error TS2322: Type '"f"' is not assignable to type '"A" | "B" | "C"'. \ No newline at end of file diff --git a/tests/baselines/reference/contextuallyTypedStringLiteralsInJsxAttributes01.js b/tests/baselines/reference/contextuallyTypedStringLiteralsInJsxAttributes01.js new file mode 100644 index 00000000000..d1b2ebf5ae5 --- /dev/null +++ b/tests/baselines/reference/contextuallyTypedStringLiteralsInJsxAttributes01.js @@ -0,0 +1,39 @@ +//// [contextuallyTypedStringLiteralsInJsxAttributes01.tsx] + +namespace JSX { + export interface IntrinsicElements { + span: {}; + } + export interface Element { + something?: any; + } +} + +const FooComponent = (props: { foo: "A" | "B" | "C" }) => {props.foo}; + +; +; + +; +; + +//// [contextuallyTypedStringLiteralsInJsxAttributes01.jsx] +var FooComponent = function (props) { return {props.foo}; }; +; +; +; +; + + +//// [contextuallyTypedStringLiteralsInJsxAttributes01.d.ts] +declare namespace JSX { + interface IntrinsicElements { + span: {}; + } + interface Element { + something?: any; + } +} +declare const FooComponent: (props: { + foo: "A" | "B" | "C"; +}) => JSX.Element; diff --git a/tests/baselines/reference/continueInLoopsWithCapturedBlockScopedBindings1.js b/tests/baselines/reference/continueInLoopsWithCapturedBlockScopedBindings1.js new file mode 100644 index 00000000000..431bdee6c88 --- /dev/null +++ b/tests/baselines/reference/continueInLoopsWithCapturedBlockScopedBindings1.js @@ -0,0 +1,30 @@ +//// [continueInLoopsWithCapturedBlockScopedBindings1.ts] +function foo() { + for (const i of [0, 1]) { + if (i === 0) { + continue; + } + + // Trigger non-simple-loop emit + (() => { + return i; + })(); + } +} + +//// [continueInLoopsWithCapturedBlockScopedBindings1.js] +function foo() { + var _loop_1 = function(i) { + if (i === 0) { + return "continue"; + } + // Trigger non-simple-loop emit + (function () { + return i; + })(); + }; + for (var _i = 0, _a = [0, 1]; _i < _a.length; _i++) { + var i = _a[_i]; + _loop_1(i); + } +} diff --git a/tests/baselines/reference/continueInLoopsWithCapturedBlockScopedBindings1.symbols b/tests/baselines/reference/continueInLoopsWithCapturedBlockScopedBindings1.symbols new file mode 100644 index 00000000000..bce177ca818 --- /dev/null +++ b/tests/baselines/reference/continueInLoopsWithCapturedBlockScopedBindings1.symbols @@ -0,0 +1,21 @@ +=== tests/cases/compiler/continueInLoopsWithCapturedBlockScopedBindings1.ts === +function foo() { +>foo : Symbol(foo, Decl(continueInLoopsWithCapturedBlockScopedBindings1.ts, 0, 0)) + + for (const i of [0, 1]) { +>i : Symbol(i, Decl(continueInLoopsWithCapturedBlockScopedBindings1.ts, 1, 14)) + + if (i === 0) { +>i : Symbol(i, Decl(continueInLoopsWithCapturedBlockScopedBindings1.ts, 1, 14)) + + continue; + } + + // Trigger non-simple-loop emit + (() => { + return i; +>i : Symbol(i, Decl(continueInLoopsWithCapturedBlockScopedBindings1.ts, 1, 14)) + + })(); + } +} diff --git a/tests/baselines/reference/continueInLoopsWithCapturedBlockScopedBindings1.types b/tests/baselines/reference/continueInLoopsWithCapturedBlockScopedBindings1.types new file mode 100644 index 00000000000..2aeb286d604 --- /dev/null +++ b/tests/baselines/reference/continueInLoopsWithCapturedBlockScopedBindings1.types @@ -0,0 +1,30 @@ +=== tests/cases/compiler/continueInLoopsWithCapturedBlockScopedBindings1.ts === +function foo() { +>foo : () => void + + for (const i of [0, 1]) { +>i : number +>[0, 1] : number[] +>0 : number +>1 : number + + if (i === 0) { +>i === 0 : boolean +>i : number +>0 : number + + continue; + } + + // Trigger non-simple-loop emit + (() => { +>(() => { return i; })() : number +>(() => { return i; }) : () => number +>() => { return i; } : () => number + + return i; +>i : number + + })(); + } +} diff --git a/tests/baselines/reference/controlFlowAssignmentExpression.js b/tests/baselines/reference/controlFlowAssignmentExpression.js new file mode 100644 index 00000000000..cf8d70b92de --- /dev/null +++ b/tests/baselines/reference/controlFlowAssignmentExpression.js @@ -0,0 +1,22 @@ +//// [controlFlowAssignmentExpression.ts] +let x: string | boolean | number; +let obj: any; + +x = ""; +x = x.length; +x; // number + +x = true; +(x = "", obj).foo = (x = x.length); +x; // number + + +//// [controlFlowAssignmentExpression.js] +var x; +var obj; +x = ""; +x = x.length; +x; // number +x = true; +(x = "", obj).foo = (x = x.length); +x; // number diff --git a/tests/baselines/reference/controlFlowAssignmentExpression.symbols b/tests/baselines/reference/controlFlowAssignmentExpression.symbols new file mode 100644 index 00000000000..470e3114ca8 --- /dev/null +++ b/tests/baselines/reference/controlFlowAssignmentExpression.symbols @@ -0,0 +1,33 @@ +=== tests/cases/conformance/controlFlow/controlFlowAssignmentExpression.ts === +let x: string | boolean | number; +>x : Symbol(x, Decl(controlFlowAssignmentExpression.ts, 0, 3)) + +let obj: any; +>obj : Symbol(obj, Decl(controlFlowAssignmentExpression.ts, 1, 3)) + +x = ""; +>x : Symbol(x, Decl(controlFlowAssignmentExpression.ts, 0, 3)) + +x = x.length; +>x : Symbol(x, Decl(controlFlowAssignmentExpression.ts, 0, 3)) +>x.length : Symbol(String.length, Decl(lib.d.ts, --, --)) +>x : Symbol(x, Decl(controlFlowAssignmentExpression.ts, 0, 3)) +>length : Symbol(String.length, Decl(lib.d.ts, --, --)) + +x; // number +>x : Symbol(x, Decl(controlFlowAssignmentExpression.ts, 0, 3)) + +x = true; +>x : Symbol(x, Decl(controlFlowAssignmentExpression.ts, 0, 3)) + +(x = "", obj).foo = (x = x.length); +>x : Symbol(x, Decl(controlFlowAssignmentExpression.ts, 0, 3)) +>obj : Symbol(obj, Decl(controlFlowAssignmentExpression.ts, 1, 3)) +>x : Symbol(x, Decl(controlFlowAssignmentExpression.ts, 0, 3)) +>x.length : Symbol(String.length, Decl(lib.d.ts, --, --)) +>x : Symbol(x, Decl(controlFlowAssignmentExpression.ts, 0, 3)) +>length : Symbol(String.length, Decl(lib.d.ts, --, --)) + +x; // number +>x : Symbol(x, Decl(controlFlowAssignmentExpression.ts, 0, 3)) + diff --git a/tests/baselines/reference/controlFlowAssignmentExpression.types b/tests/baselines/reference/controlFlowAssignmentExpression.types new file mode 100644 index 00000000000..24355fd8c4a --- /dev/null +++ b/tests/baselines/reference/controlFlowAssignmentExpression.types @@ -0,0 +1,47 @@ +=== tests/cases/conformance/controlFlow/controlFlowAssignmentExpression.ts === +let x: string | boolean | number; +>x : string | boolean | number + +let obj: any; +>obj : any + +x = ""; +>x = "" : string +>x : string | boolean | number +>"" : string + +x = x.length; +>x = x.length : number +>x : string | boolean | number +>x.length : number +>x : string +>length : number + +x; // number +>x : number + +x = true; +>x = true : boolean +>x : string | boolean | number +>true : boolean + +(x = "", obj).foo = (x = x.length); +>(x = "", obj).foo = (x = x.length) : number +>(x = "", obj).foo : any +>(x = "", obj) : any +>x = "", obj : any +>x = "" : string +>x : string | boolean | number +>"" : string +>obj : any +>foo : any +>(x = x.length) : number +>x = x.length : number +>x : string | boolean | number +>x.length : number +>x : string +>length : number + +x; // number +>x : number + diff --git a/tests/baselines/reference/controlFlowBinaryAndExpression.js b/tests/baselines/reference/controlFlowBinaryAndExpression.js new file mode 100644 index 00000000000..eb89d1a78cf --- /dev/null +++ b/tests/baselines/reference/controlFlowBinaryAndExpression.js @@ -0,0 +1,20 @@ +//// [controlFlowBinaryAndExpression.ts] +let x: string | number | boolean; +let cond: boolean; + +(x = "") && (x = 0); +x; // string | number + +x = ""; +cond && (x = 0); +x; // string | number + + +//// [controlFlowBinaryAndExpression.js] +var x; +var cond; +(x = "") && (x = 0); +x; // string | number +x = ""; +cond && (x = 0); +x; // string | number diff --git a/tests/baselines/reference/controlFlowBinaryAndExpression.symbols b/tests/baselines/reference/controlFlowBinaryAndExpression.symbols new file mode 100644 index 00000000000..5be553f6802 --- /dev/null +++ b/tests/baselines/reference/controlFlowBinaryAndExpression.symbols @@ -0,0 +1,24 @@ +=== tests/cases/conformance/controlFlow/controlFlowBinaryAndExpression.ts === +let x: string | number | boolean; +>x : Symbol(x, Decl(controlFlowBinaryAndExpression.ts, 0, 3)) + +let cond: boolean; +>cond : Symbol(cond, Decl(controlFlowBinaryAndExpression.ts, 1, 3)) + +(x = "") && (x = 0); +>x : Symbol(x, Decl(controlFlowBinaryAndExpression.ts, 0, 3)) +>x : Symbol(x, Decl(controlFlowBinaryAndExpression.ts, 0, 3)) + +x; // string | number +>x : Symbol(x, Decl(controlFlowBinaryAndExpression.ts, 0, 3)) + +x = ""; +>x : Symbol(x, Decl(controlFlowBinaryAndExpression.ts, 0, 3)) + +cond && (x = 0); +>cond : Symbol(cond, Decl(controlFlowBinaryAndExpression.ts, 1, 3)) +>x : Symbol(x, Decl(controlFlowBinaryAndExpression.ts, 0, 3)) + +x; // string | number +>x : Symbol(x, Decl(controlFlowBinaryAndExpression.ts, 0, 3)) + diff --git a/tests/baselines/reference/controlFlowBinaryAndExpression.types b/tests/baselines/reference/controlFlowBinaryAndExpression.types new file mode 100644 index 00000000000..8a1924c42eb --- /dev/null +++ b/tests/baselines/reference/controlFlowBinaryAndExpression.types @@ -0,0 +1,37 @@ +=== tests/cases/conformance/controlFlow/controlFlowBinaryAndExpression.ts === +let x: string | number | boolean; +>x : string | number | boolean + +let cond: boolean; +>cond : boolean + +(x = "") && (x = 0); +>(x = "") && (x = 0) : number +>(x = "") : string +>x = "" : string +>x : string | number | boolean +>"" : string +>(x = 0) : number +>x = 0 : number +>x : string | number | boolean +>0 : number + +x; // string | number +>x : string | number + +x = ""; +>x = "" : string +>x : string | number | boolean +>"" : string + +cond && (x = 0); +>cond && (x = 0) : number +>cond : boolean +>(x = 0) : number +>x = 0 : number +>x : string | number | boolean +>0 : number + +x; // string | number +>x : string | number + diff --git a/tests/baselines/reference/controlFlowBinaryOrExpression.js b/tests/baselines/reference/controlFlowBinaryOrExpression.js new file mode 100644 index 00000000000..fb48c5a23e0 --- /dev/null +++ b/tests/baselines/reference/controlFlowBinaryOrExpression.js @@ -0,0 +1,57 @@ +//// [controlFlowBinaryOrExpression.ts] +let x: string | number | boolean; +let cond: boolean; + +(x = "") || (x = 0); +x; // string | number + +x = ""; +cond || (x = 0); +x; // string | number + +export interface NodeList { + length: number; +} + +export interface HTMLCollection { + length: number; +} + +declare function isNodeList(sourceObj: any): sourceObj is NodeList; +declare function isHTMLCollection(sourceObj: any): sourceObj is HTMLCollection; + +type EventTargetLike = {a: string} | HTMLCollection | NodeList; + +var sourceObj: EventTargetLike = undefined; +if (isNodeList(sourceObj)) { + sourceObj.length; +} + +if (isHTMLCollection(sourceObj)) { + sourceObj.length; +} + +if (isNodeList(sourceObj) || isHTMLCollection(sourceObj)) { + sourceObj.length; +} + + +//// [controlFlowBinaryOrExpression.js] +"use strict"; +var x; +var cond; +(x = "") || (x = 0); +x; // string | number +x = ""; +cond || (x = 0); +x; // string | number +var sourceObj = undefined; +if (isNodeList(sourceObj)) { + sourceObj.length; +} +if (isHTMLCollection(sourceObj)) { + sourceObj.length; +} +if (isNodeList(sourceObj) || isHTMLCollection(sourceObj)) { + sourceObj.length; +} diff --git a/tests/baselines/reference/controlFlowBinaryOrExpression.symbols b/tests/baselines/reference/controlFlowBinaryOrExpression.symbols new file mode 100644 index 00000000000..e47bdb19d34 --- /dev/null +++ b/tests/baselines/reference/controlFlowBinaryOrExpression.symbols @@ -0,0 +1,93 @@ +=== tests/cases/conformance/controlFlow/controlFlowBinaryOrExpression.ts === +let x: string | number | boolean; +>x : Symbol(x, Decl(controlFlowBinaryOrExpression.ts, 0, 3)) + +let cond: boolean; +>cond : Symbol(cond, Decl(controlFlowBinaryOrExpression.ts, 1, 3)) + +(x = "") || (x = 0); +>x : Symbol(x, Decl(controlFlowBinaryOrExpression.ts, 0, 3)) +>x : Symbol(x, Decl(controlFlowBinaryOrExpression.ts, 0, 3)) + +x; // string | number +>x : Symbol(x, Decl(controlFlowBinaryOrExpression.ts, 0, 3)) + +x = ""; +>x : Symbol(x, Decl(controlFlowBinaryOrExpression.ts, 0, 3)) + +cond || (x = 0); +>cond : Symbol(cond, Decl(controlFlowBinaryOrExpression.ts, 1, 3)) +>x : Symbol(x, Decl(controlFlowBinaryOrExpression.ts, 0, 3)) + +x; // string | number +>x : Symbol(x, Decl(controlFlowBinaryOrExpression.ts, 0, 3)) + +export interface NodeList { +>NodeList : Symbol(NodeList, Decl(controlFlowBinaryOrExpression.ts, 8, 2)) + + length: number; +>length : Symbol(NodeList.length, Decl(controlFlowBinaryOrExpression.ts, 10, 27)) +} + +export interface HTMLCollection { +>HTMLCollection : Symbol(HTMLCollection, Decl(controlFlowBinaryOrExpression.ts, 12, 1)) + + length: number; +>length : Symbol(HTMLCollection.length, Decl(controlFlowBinaryOrExpression.ts, 14, 33)) +} + +declare function isNodeList(sourceObj: any): sourceObj is NodeList; +>isNodeList : Symbol(isNodeList, Decl(controlFlowBinaryOrExpression.ts, 16, 1)) +>sourceObj : Symbol(sourceObj, Decl(controlFlowBinaryOrExpression.ts, 18, 28)) +>sourceObj : Symbol(sourceObj, Decl(controlFlowBinaryOrExpression.ts, 18, 28)) +>NodeList : Symbol(NodeList, Decl(controlFlowBinaryOrExpression.ts, 8, 2)) + +declare function isHTMLCollection(sourceObj: any): sourceObj is HTMLCollection; +>isHTMLCollection : Symbol(isHTMLCollection, Decl(controlFlowBinaryOrExpression.ts, 18, 67)) +>sourceObj : Symbol(sourceObj, Decl(controlFlowBinaryOrExpression.ts, 19, 34)) +>sourceObj : Symbol(sourceObj, Decl(controlFlowBinaryOrExpression.ts, 19, 34)) +>HTMLCollection : Symbol(HTMLCollection, Decl(controlFlowBinaryOrExpression.ts, 12, 1)) + +type EventTargetLike = {a: string} | HTMLCollection | NodeList; +>EventTargetLike : Symbol(EventTargetLike, Decl(controlFlowBinaryOrExpression.ts, 19, 79)) +>a : Symbol(a, Decl(controlFlowBinaryOrExpression.ts, 21, 24)) +>HTMLCollection : Symbol(HTMLCollection, Decl(controlFlowBinaryOrExpression.ts, 12, 1)) +>NodeList : Symbol(NodeList, Decl(controlFlowBinaryOrExpression.ts, 8, 2)) + +var sourceObj: EventTargetLike = undefined; +>sourceObj : Symbol(sourceObj, Decl(controlFlowBinaryOrExpression.ts, 23, 3)) +>EventTargetLike : Symbol(EventTargetLike, Decl(controlFlowBinaryOrExpression.ts, 19, 79)) +>undefined : Symbol(undefined) + +if (isNodeList(sourceObj)) { +>isNodeList : Symbol(isNodeList, Decl(controlFlowBinaryOrExpression.ts, 16, 1)) +>sourceObj : Symbol(sourceObj, Decl(controlFlowBinaryOrExpression.ts, 23, 3)) + + sourceObj.length; +>sourceObj.length : Symbol(HTMLCollection.length, Decl(controlFlowBinaryOrExpression.ts, 14, 33)) +>sourceObj : Symbol(sourceObj, Decl(controlFlowBinaryOrExpression.ts, 23, 3)) +>length : Symbol(HTMLCollection.length, Decl(controlFlowBinaryOrExpression.ts, 14, 33)) +} + +if (isHTMLCollection(sourceObj)) { +>isHTMLCollection : Symbol(isHTMLCollection, Decl(controlFlowBinaryOrExpression.ts, 18, 67)) +>sourceObj : Symbol(sourceObj, Decl(controlFlowBinaryOrExpression.ts, 23, 3)) + + sourceObj.length; +>sourceObj.length : Symbol(HTMLCollection.length, Decl(controlFlowBinaryOrExpression.ts, 14, 33)) +>sourceObj : Symbol(sourceObj, Decl(controlFlowBinaryOrExpression.ts, 23, 3)) +>length : Symbol(HTMLCollection.length, Decl(controlFlowBinaryOrExpression.ts, 14, 33)) +} + +if (isNodeList(sourceObj) || isHTMLCollection(sourceObj)) { +>isNodeList : Symbol(isNodeList, Decl(controlFlowBinaryOrExpression.ts, 16, 1)) +>sourceObj : Symbol(sourceObj, Decl(controlFlowBinaryOrExpression.ts, 23, 3)) +>isHTMLCollection : Symbol(isHTMLCollection, Decl(controlFlowBinaryOrExpression.ts, 18, 67)) +>sourceObj : Symbol(sourceObj, Decl(controlFlowBinaryOrExpression.ts, 23, 3)) + + sourceObj.length; +>sourceObj.length : Symbol(HTMLCollection.length, Decl(controlFlowBinaryOrExpression.ts, 14, 33)) +>sourceObj : Symbol(sourceObj, Decl(controlFlowBinaryOrExpression.ts, 23, 3)) +>length : Symbol(HTMLCollection.length, Decl(controlFlowBinaryOrExpression.ts, 14, 33)) +} + diff --git a/tests/baselines/reference/controlFlowBinaryOrExpression.types b/tests/baselines/reference/controlFlowBinaryOrExpression.types new file mode 100644 index 00000000000..8c1cd32d8d9 --- /dev/null +++ b/tests/baselines/reference/controlFlowBinaryOrExpression.types @@ -0,0 +1,112 @@ +=== tests/cases/conformance/controlFlow/controlFlowBinaryOrExpression.ts === +let x: string | number | boolean; +>x : string | number | boolean + +let cond: boolean; +>cond : boolean + +(x = "") || (x = 0); +>(x = "") || (x = 0) : string | number +>(x = "") : string +>x = "" : string +>x : string | number | boolean +>"" : string +>(x = 0) : number +>x = 0 : number +>x : string | number | boolean +>0 : number + +x; // string | number +>x : string | number + +x = ""; +>x = "" : string +>x : string | number | boolean +>"" : string + +cond || (x = 0); +>cond || (x = 0) : boolean | number +>cond : boolean +>(x = 0) : number +>x = 0 : number +>x : string | number | boolean +>0 : number + +x; // string | number +>x : string | number + +export interface NodeList { +>NodeList : NodeList + + length: number; +>length : number +} + +export interface HTMLCollection { +>HTMLCollection : HTMLCollection + + length: number; +>length : number +} + +declare function isNodeList(sourceObj: any): sourceObj is NodeList; +>isNodeList : (sourceObj: any) => sourceObj is NodeList +>sourceObj : any +>sourceObj : any +>NodeList : NodeList + +declare function isHTMLCollection(sourceObj: any): sourceObj is HTMLCollection; +>isHTMLCollection : (sourceObj: any) => sourceObj is HTMLCollection +>sourceObj : any +>sourceObj : any +>HTMLCollection : HTMLCollection + +type EventTargetLike = {a: string} | HTMLCollection | NodeList; +>EventTargetLike : { a: string; } | HTMLCollection | NodeList +>a : string +>HTMLCollection : HTMLCollection +>NodeList : NodeList + +var sourceObj: EventTargetLike = undefined; +>sourceObj : { a: string; } | HTMLCollection | NodeList +>EventTargetLike : { a: string; } | HTMLCollection | NodeList +>undefined : any +>undefined : undefined + +if (isNodeList(sourceObj)) { +>isNodeList(sourceObj) : boolean +>isNodeList : (sourceObj: any) => sourceObj is NodeList +>sourceObj : { a: string; } | HTMLCollection + + sourceObj.length; +>sourceObj.length : number +>sourceObj : HTMLCollection +>length : number +} + +if (isHTMLCollection(sourceObj)) { +>isHTMLCollection(sourceObj) : boolean +>isHTMLCollection : (sourceObj: any) => sourceObj is HTMLCollection +>sourceObj : HTMLCollection | { a: string; } + + sourceObj.length; +>sourceObj.length : number +>sourceObj : HTMLCollection +>length : number +} + +if (isNodeList(sourceObj) || isHTMLCollection(sourceObj)) { +>isNodeList(sourceObj) || isHTMLCollection(sourceObj) : boolean +>isNodeList(sourceObj) : boolean +>isNodeList : (sourceObj: any) => sourceObj is NodeList +>sourceObj : HTMLCollection | { a: string; } +>isHTMLCollection(sourceObj) : boolean +>isHTMLCollection : (sourceObj: any) => sourceObj is HTMLCollection +>sourceObj : { a: string; } + + sourceObj.length; +>sourceObj.length : number +>sourceObj : HTMLCollection +>length : number +} + diff --git a/tests/baselines/reference/controlFlowCaching.js b/tests/baselines/reference/controlFlowCaching.js new file mode 100644 index 00000000000..fc102b8e823 --- /dev/null +++ b/tests/baselines/reference/controlFlowCaching.js @@ -0,0 +1,120 @@ +//// [controlFlowCaching.ts] + +// Repro for #8401 + +function f(dim, offsets, arr, acommon, centerAnchorLimit, g, has, lin) { + var isRtl = this._isRtl(); // chart mirroring + // prepare variable + var o = this.opt, ta = this.chart.theme.axis, position = o.position, + leftBottom = position !== "rightOrTop", rotation = o.rotation % 360, + start, stop, titlePos, titleRotation = 0, titleOffset, axisVector, tickVector, anchorOffset, labelOffset, labelAlign, + labelGap = this.chart.theme.axis.tick.labelGap, + taFont = o.font || (ta.majorTick && ta.majorTick.font) || (ta.tick && ta.tick.font), + taTitleFont = o.titleFont || (ta.title && ta.title.font), + taFontColor = o.fontColor || (ta.majorTick && ta.majorTick.fontColor) || (ta.tick && ta.tick.fontColor) || "black", + taTitleFontColor = o.titleFontColor || (ta.title && ta.title.fontColor) || "black", + taTitleGap = (o.titleGap == 0) ? 0 : o.titleGap || (ta.title && ta.title.gap) || 15, + taTitleOrientation = o.titleOrientation || (ta.title && ta.title.orientation) || "axis", + taMajorTick = this.chart.theme.getTick("major", o), + taMinorTick = this.chart.theme.getTick("minor", o), + taMicroTick = this.chart.theme.getTick("micro", o), + + taStroke = "stroke" in o ? o.stroke : ta.stroke, + size = taFont ? g.normalizedLength(g.splitFontString(taFont).size) : 0, + cosr = Math.abs(Math.cos(rotation * Math.PI / 180)), + sinr = Math.abs(Math.sin(rotation * Math.PI / 180)), + tsize = taTitleFont ? g.normalizedLength(g.splitFontString(taTitleFont).size) : 0; + if (rotation < 0) { + rotation += 360; + } + var cachedLabelW = this._getMaxLabelSize(); + cachedLabelW = cachedLabelW && cachedLabelW.majLabelW; + titleOffset = size * cosr + (cachedLabelW || 0) * sinr + labelGap + Math.max(taMajorTick.length > 0 ? taMajorTick.length : 0, + taMinorTick.length > 0 ? taMinorTick.length : 0) + + tsize + taTitleGap; + axisVector = { x: isRtl ? -1 : 1, y: 0 }; // chart mirroring + switch (rotation) { + default: + if (rotation < (90 - centerAnchorLimit)) { + labelOffset.y = leftBottom ? size : 0; + } else if (rotation < (90 + centerAnchorLimit)) { + labelOffset.x = -size * 0.4; + } else if (rotation < 180) { + labelOffset.y = leftBottom ? 0 : -size; + } else if (rotation < (270 - centerAnchorLimit)) { + labelOffset.y = leftBottom ? 0 : -size; + } else if (rotation < (270 + centerAnchorLimit)) { + labelOffset.y = leftBottom ? size * 0.4 : 0; + } else { + labelOffset.y = leftBottom ? size : 0; + } + } + + titleRotation = (taTitleOrientation && taTitleOrientation == "away") ? 180 : 0; + titlePos.y = offsets.t - titleOffset + (titleRotation ? 0 : tsize); + switch (labelAlign) { + case "start": + labelAlign = "end"; + break; + case "end": + labelAlign = "start"; + break; + case "middle": + labelOffset.y -= size; + break; + } + + let _ = rotation; +} + + +//// [controlFlowCaching.js] +// Repro for #8401 +function f(dim, offsets, arr, acommon, centerAnchorLimit, g, has, lin) { + var isRtl = this._isRtl(); // chart mirroring + // prepare variable + var o = this.opt, ta = this.chart.theme.axis, position = o.position, leftBottom = position !== "rightOrTop", rotation = o.rotation % 360, start, stop, titlePos, titleRotation = 0, titleOffset, axisVector, tickVector, anchorOffset, labelOffset, labelAlign, labelGap = this.chart.theme.axis.tick.labelGap, taFont = o.font || (ta.majorTick && ta.majorTick.font) || (ta.tick && ta.tick.font), taTitleFont = o.titleFont || (ta.title && ta.title.font), taFontColor = o.fontColor || (ta.majorTick && ta.majorTick.fontColor) || (ta.tick && ta.tick.fontColor) || "black", taTitleFontColor = o.titleFontColor || (ta.title && ta.title.fontColor) || "black", taTitleGap = (o.titleGap == 0) ? 0 : o.titleGap || (ta.title && ta.title.gap) || 15, taTitleOrientation = o.titleOrientation || (ta.title && ta.title.orientation) || "axis", taMajorTick = this.chart.theme.getTick("major", o), taMinorTick = this.chart.theme.getTick("minor", o), taMicroTick = this.chart.theme.getTick("micro", o), taStroke = "stroke" in o ? o.stroke : ta.stroke, size = taFont ? g.normalizedLength(g.splitFontString(taFont).size) : 0, cosr = Math.abs(Math.cos(rotation * Math.PI / 180)), sinr = Math.abs(Math.sin(rotation * Math.PI / 180)), tsize = taTitleFont ? g.normalizedLength(g.splitFontString(taTitleFont).size) : 0; + if (rotation < 0) { + rotation += 360; + } + var cachedLabelW = this._getMaxLabelSize(); + cachedLabelW = cachedLabelW && cachedLabelW.majLabelW; + titleOffset = size * cosr + (cachedLabelW || 0) * sinr + labelGap + Math.max(taMajorTick.length > 0 ? taMajorTick.length : 0, taMinorTick.length > 0 ? taMinorTick.length : 0) + + tsize + taTitleGap; + axisVector = { x: isRtl ? -1 : 1, y: 0 }; // chart mirroring + switch (rotation) { + default: + if (rotation < (90 - centerAnchorLimit)) { + labelOffset.y = leftBottom ? size : 0; + } + else if (rotation < (90 + centerAnchorLimit)) { + labelOffset.x = -size * 0.4; + } + else if (rotation < 180) { + labelOffset.y = leftBottom ? 0 : -size; + } + else if (rotation < (270 - centerAnchorLimit)) { + labelOffset.y = leftBottom ? 0 : -size; + } + else if (rotation < (270 + centerAnchorLimit)) { + labelOffset.y = leftBottom ? size * 0.4 : 0; + } + else { + labelOffset.y = leftBottom ? size : 0; + } + } + titleRotation = (taTitleOrientation && taTitleOrientation == "away") ? 180 : 0; + titlePos.y = offsets.t - titleOffset + (titleRotation ? 0 : tsize); + switch (labelAlign) { + case "start": + labelAlign = "end"; + break; + case "end": + labelAlign = "start"; + break; + case "middle": + labelOffset.y -= size; + break; + } + var _ = rotation; +} diff --git a/tests/baselines/reference/controlFlowCaching.symbols b/tests/baselines/reference/controlFlowCaching.symbols new file mode 100644 index 00000000000..74534ce75a1 --- /dev/null +++ b/tests/baselines/reference/controlFlowCaching.symbols @@ -0,0 +1,279 @@ +=== tests/cases/compiler/controlFlowCaching.ts === + +// Repro for #8401 + +function f(dim, offsets, arr, acommon, centerAnchorLimit, g, has, lin) { +>f : Symbol(f, Decl(controlFlowCaching.ts, 0, 0)) +>dim : Symbol(dim, Decl(controlFlowCaching.ts, 3, 11)) +>offsets : Symbol(offsets, Decl(controlFlowCaching.ts, 3, 15)) +>arr : Symbol(arr, Decl(controlFlowCaching.ts, 3, 24)) +>acommon : Symbol(acommon, Decl(controlFlowCaching.ts, 3, 29)) +>centerAnchorLimit : Symbol(centerAnchorLimit, Decl(controlFlowCaching.ts, 3, 38)) +>g : Symbol(g, Decl(controlFlowCaching.ts, 3, 57)) +>has : Symbol(has, Decl(controlFlowCaching.ts, 3, 60)) +>lin : Symbol(lin, Decl(controlFlowCaching.ts, 3, 65)) + + var isRtl = this._isRtl(); // chart mirroring +>isRtl : Symbol(isRtl, Decl(controlFlowCaching.ts, 4, 7)) + + // prepare variable + var o = this.opt, ta = this.chart.theme.axis, position = o.position, +>o : Symbol(o, Decl(controlFlowCaching.ts, 6, 7)) +>ta : Symbol(ta, Decl(controlFlowCaching.ts, 6, 21)) +>position : Symbol(position, Decl(controlFlowCaching.ts, 6, 49)) +>o : Symbol(o, Decl(controlFlowCaching.ts, 6, 7)) + + leftBottom = position !== "rightOrTop", rotation = o.rotation % 360, +>leftBottom : Symbol(leftBottom, Decl(controlFlowCaching.ts, 6, 72)) +>position : Symbol(position, Decl(controlFlowCaching.ts, 6, 49)) +>rotation : Symbol(rotation, Decl(controlFlowCaching.ts, 7, 47)) +>o : Symbol(o, Decl(controlFlowCaching.ts, 6, 7)) + + start, stop, titlePos, titleRotation = 0, titleOffset, axisVector, tickVector, anchorOffset, labelOffset, labelAlign, +>start : Symbol(start, Decl(controlFlowCaching.ts, 7, 76)) +>stop : Symbol(stop, Decl(controlFlowCaching.ts, 8, 14)) +>titlePos : Symbol(titlePos, Decl(controlFlowCaching.ts, 8, 20)) +>titleRotation : Symbol(titleRotation, Decl(controlFlowCaching.ts, 8, 30)) +>titleOffset : Symbol(titleOffset, Decl(controlFlowCaching.ts, 8, 49)) +>axisVector : Symbol(axisVector, Decl(controlFlowCaching.ts, 8, 62)) +>tickVector : Symbol(tickVector, Decl(controlFlowCaching.ts, 8, 74)) +>anchorOffset : Symbol(anchorOffset, Decl(controlFlowCaching.ts, 8, 86)) +>labelOffset : Symbol(labelOffset, Decl(controlFlowCaching.ts, 8, 100)) +>labelAlign : Symbol(labelAlign, Decl(controlFlowCaching.ts, 8, 113)) + + labelGap = this.chart.theme.axis.tick.labelGap, +>labelGap : Symbol(labelGap, Decl(controlFlowCaching.ts, 8, 125)) + + taFont = o.font || (ta.majorTick && ta.majorTick.font) || (ta.tick && ta.tick.font), +>taFont : Symbol(taFont, Decl(controlFlowCaching.ts, 9, 55)) +>o : Symbol(o, Decl(controlFlowCaching.ts, 6, 7)) +>ta : Symbol(ta, Decl(controlFlowCaching.ts, 6, 21)) +>ta : Symbol(ta, Decl(controlFlowCaching.ts, 6, 21)) +>ta : Symbol(ta, Decl(controlFlowCaching.ts, 6, 21)) +>ta : Symbol(ta, Decl(controlFlowCaching.ts, 6, 21)) + + taTitleFont = o.titleFont || (ta.title && ta.title.font), +>taTitleFont : Symbol(taTitleFont, Decl(controlFlowCaching.ts, 10, 92)) +>o : Symbol(o, Decl(controlFlowCaching.ts, 6, 7)) +>ta : Symbol(ta, Decl(controlFlowCaching.ts, 6, 21)) +>ta : Symbol(ta, Decl(controlFlowCaching.ts, 6, 21)) + + taFontColor = o.fontColor || (ta.majorTick && ta.majorTick.fontColor) || (ta.tick && ta.tick.fontColor) || "black", +>taFontColor : Symbol(taFontColor, Decl(controlFlowCaching.ts, 11, 65)) +>o : Symbol(o, Decl(controlFlowCaching.ts, 6, 7)) +>ta : Symbol(ta, Decl(controlFlowCaching.ts, 6, 21)) +>ta : Symbol(ta, Decl(controlFlowCaching.ts, 6, 21)) +>ta : Symbol(ta, Decl(controlFlowCaching.ts, 6, 21)) +>ta : Symbol(ta, Decl(controlFlowCaching.ts, 6, 21)) + + taTitleFontColor = o.titleFontColor || (ta.title && ta.title.fontColor) || "black", +>taTitleFontColor : Symbol(taTitleFontColor, Decl(controlFlowCaching.ts, 12, 123)) +>o : Symbol(o, Decl(controlFlowCaching.ts, 6, 7)) +>ta : Symbol(ta, Decl(controlFlowCaching.ts, 6, 21)) +>ta : Symbol(ta, Decl(controlFlowCaching.ts, 6, 21)) + + taTitleGap = (o.titleGap == 0) ? 0 : o.titleGap || (ta.title && ta.title.gap) || 15, +>taTitleGap : Symbol(taTitleGap, Decl(controlFlowCaching.ts, 13, 91)) +>o : Symbol(o, Decl(controlFlowCaching.ts, 6, 7)) +>o : Symbol(o, Decl(controlFlowCaching.ts, 6, 7)) +>ta : Symbol(ta, Decl(controlFlowCaching.ts, 6, 21)) +>ta : Symbol(ta, Decl(controlFlowCaching.ts, 6, 21)) + + taTitleOrientation = o.titleOrientation || (ta.title && ta.title.orientation) || "axis", +>taTitleOrientation : Symbol(taTitleOrientation, Decl(controlFlowCaching.ts, 14, 92)) +>o : Symbol(o, Decl(controlFlowCaching.ts, 6, 7)) +>ta : Symbol(ta, Decl(controlFlowCaching.ts, 6, 21)) +>ta : Symbol(ta, Decl(controlFlowCaching.ts, 6, 21)) + + taMajorTick = this.chart.theme.getTick("major", o), +>taMajorTick : Symbol(taMajorTick, Decl(controlFlowCaching.ts, 15, 96)) +>o : Symbol(o, Decl(controlFlowCaching.ts, 6, 7)) + + taMinorTick = this.chart.theme.getTick("minor", o), +>taMinorTick : Symbol(taMinorTick, Decl(controlFlowCaching.ts, 16, 59)) +>o : Symbol(o, Decl(controlFlowCaching.ts, 6, 7)) + + taMicroTick = this.chart.theme.getTick("micro", o), +>taMicroTick : Symbol(taMicroTick, Decl(controlFlowCaching.ts, 17, 59)) +>o : Symbol(o, Decl(controlFlowCaching.ts, 6, 7)) + + taStroke = "stroke" in o ? o.stroke : ta.stroke, +>taStroke : Symbol(taStroke, Decl(controlFlowCaching.ts, 18, 59)) +>o : Symbol(o, Decl(controlFlowCaching.ts, 6, 7)) +>o : Symbol(o, Decl(controlFlowCaching.ts, 6, 7)) +>ta : Symbol(ta, Decl(controlFlowCaching.ts, 6, 21)) + + size = taFont ? g.normalizedLength(g.splitFontString(taFont).size) : 0, +>size : Symbol(size, Decl(controlFlowCaching.ts, 20, 56)) +>taFont : Symbol(taFont, Decl(controlFlowCaching.ts, 9, 55)) +>g : Symbol(g, Decl(controlFlowCaching.ts, 3, 57)) +>g : Symbol(g, Decl(controlFlowCaching.ts, 3, 57)) +>taFont : Symbol(taFont, Decl(controlFlowCaching.ts, 9, 55)) + + cosr = Math.abs(Math.cos(rotation * Math.PI / 180)), +>cosr : Symbol(cosr, Decl(controlFlowCaching.ts, 21, 79)) +>Math.abs : Symbol(Math.abs, Decl(lib.d.ts, --, --)) +>Math : Symbol(Math, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>abs : Symbol(Math.abs, Decl(lib.d.ts, --, --)) +>Math.cos : Symbol(Math.cos, Decl(lib.d.ts, --, --)) +>Math : Symbol(Math, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>cos : Symbol(Math.cos, Decl(lib.d.ts, --, --)) +>rotation : Symbol(rotation, Decl(controlFlowCaching.ts, 7, 47)) +>Math.PI : Symbol(Math.PI, Decl(lib.d.ts, --, --)) +>Math : Symbol(Math, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>PI : Symbol(Math.PI, Decl(lib.d.ts, --, --)) + + sinr = Math.abs(Math.sin(rotation * Math.PI / 180)), +>sinr : Symbol(sinr, Decl(controlFlowCaching.ts, 22, 60)) +>Math.abs : Symbol(Math.abs, Decl(lib.d.ts, --, --)) +>Math : Symbol(Math, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>abs : Symbol(Math.abs, Decl(lib.d.ts, --, --)) +>Math.sin : Symbol(Math.sin, Decl(lib.d.ts, --, --)) +>Math : Symbol(Math, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>sin : Symbol(Math.sin, Decl(lib.d.ts, --, --)) +>rotation : Symbol(rotation, Decl(controlFlowCaching.ts, 7, 47)) +>Math.PI : Symbol(Math.PI, Decl(lib.d.ts, --, --)) +>Math : Symbol(Math, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>PI : Symbol(Math.PI, Decl(lib.d.ts, --, --)) + + tsize = taTitleFont ? g.normalizedLength(g.splitFontString(taTitleFont).size) : 0; +>tsize : Symbol(tsize, Decl(controlFlowCaching.ts, 23, 60)) +>taTitleFont : Symbol(taTitleFont, Decl(controlFlowCaching.ts, 10, 92)) +>g : Symbol(g, Decl(controlFlowCaching.ts, 3, 57)) +>g : Symbol(g, Decl(controlFlowCaching.ts, 3, 57)) +>taTitleFont : Symbol(taTitleFont, Decl(controlFlowCaching.ts, 10, 92)) + + if (rotation < 0) { +>rotation : Symbol(rotation, Decl(controlFlowCaching.ts, 7, 47)) + + rotation += 360; +>rotation : Symbol(rotation, Decl(controlFlowCaching.ts, 7, 47)) + } + var cachedLabelW = this._getMaxLabelSize(); +>cachedLabelW : Symbol(cachedLabelW, Decl(controlFlowCaching.ts, 28, 7)) + + cachedLabelW = cachedLabelW && cachedLabelW.majLabelW; +>cachedLabelW : Symbol(cachedLabelW, Decl(controlFlowCaching.ts, 28, 7)) +>cachedLabelW : Symbol(cachedLabelW, Decl(controlFlowCaching.ts, 28, 7)) +>cachedLabelW : Symbol(cachedLabelW, Decl(controlFlowCaching.ts, 28, 7)) + + titleOffset = size * cosr + (cachedLabelW || 0) * sinr + labelGap + Math.max(taMajorTick.length > 0 ? taMajorTick.length : 0, +>titleOffset : Symbol(titleOffset, Decl(controlFlowCaching.ts, 8, 49)) +>size : Symbol(size, Decl(controlFlowCaching.ts, 20, 56)) +>cosr : Symbol(cosr, Decl(controlFlowCaching.ts, 21, 79)) +>cachedLabelW : Symbol(cachedLabelW, Decl(controlFlowCaching.ts, 28, 7)) +>sinr : Symbol(sinr, Decl(controlFlowCaching.ts, 22, 60)) +>labelGap : Symbol(labelGap, Decl(controlFlowCaching.ts, 8, 125)) +>Math.max : Symbol(Math.max, Decl(lib.d.ts, --, --)) +>Math : Symbol(Math, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>max : Symbol(Math.max, Decl(lib.d.ts, --, --)) +>taMajorTick : Symbol(taMajorTick, Decl(controlFlowCaching.ts, 15, 96)) +>taMajorTick : Symbol(taMajorTick, Decl(controlFlowCaching.ts, 15, 96)) + + taMinorTick.length > 0 ? taMinorTick.length : 0) + +>taMinorTick : Symbol(taMinorTick, Decl(controlFlowCaching.ts, 16, 59)) +>taMinorTick : Symbol(taMinorTick, Decl(controlFlowCaching.ts, 16, 59)) + + tsize + taTitleGap; +>tsize : Symbol(tsize, Decl(controlFlowCaching.ts, 23, 60)) +>taTitleGap : Symbol(taTitleGap, Decl(controlFlowCaching.ts, 13, 91)) + + axisVector = { x: isRtl ? -1 : 1, y: 0 }; // chart mirroring +>axisVector : Symbol(axisVector, Decl(controlFlowCaching.ts, 8, 62)) +>x : Symbol(x, Decl(controlFlowCaching.ts, 33, 18)) +>isRtl : Symbol(isRtl, Decl(controlFlowCaching.ts, 4, 7)) +>y : Symbol(y, Decl(controlFlowCaching.ts, 33, 37)) + + switch (rotation) { +>rotation : Symbol(rotation, Decl(controlFlowCaching.ts, 7, 47)) + + default: + if (rotation < (90 - centerAnchorLimit)) { +>rotation : Symbol(rotation, Decl(controlFlowCaching.ts, 7, 47)) +>centerAnchorLimit : Symbol(centerAnchorLimit, Decl(controlFlowCaching.ts, 3, 38)) + + labelOffset.y = leftBottom ? size : 0; +>labelOffset : Symbol(labelOffset, Decl(controlFlowCaching.ts, 8, 100)) +>leftBottom : Symbol(leftBottom, Decl(controlFlowCaching.ts, 6, 72)) +>size : Symbol(size, Decl(controlFlowCaching.ts, 20, 56)) + + } else if (rotation < (90 + centerAnchorLimit)) { +>rotation : Symbol(rotation, Decl(controlFlowCaching.ts, 7, 47)) +>centerAnchorLimit : Symbol(centerAnchorLimit, Decl(controlFlowCaching.ts, 3, 38)) + + labelOffset.x = -size * 0.4; +>labelOffset : Symbol(labelOffset, Decl(controlFlowCaching.ts, 8, 100)) +>size : Symbol(size, Decl(controlFlowCaching.ts, 20, 56)) + + } else if (rotation < 180) { +>rotation : Symbol(rotation, Decl(controlFlowCaching.ts, 7, 47)) + + labelOffset.y = leftBottom ? 0 : -size; +>labelOffset : Symbol(labelOffset, Decl(controlFlowCaching.ts, 8, 100)) +>leftBottom : Symbol(leftBottom, Decl(controlFlowCaching.ts, 6, 72)) +>size : Symbol(size, Decl(controlFlowCaching.ts, 20, 56)) + + } else if (rotation < (270 - centerAnchorLimit)) { +>rotation : Symbol(rotation, Decl(controlFlowCaching.ts, 7, 47)) +>centerAnchorLimit : Symbol(centerAnchorLimit, Decl(controlFlowCaching.ts, 3, 38)) + + labelOffset.y = leftBottom ? 0 : -size; +>labelOffset : Symbol(labelOffset, Decl(controlFlowCaching.ts, 8, 100)) +>leftBottom : Symbol(leftBottom, Decl(controlFlowCaching.ts, 6, 72)) +>size : Symbol(size, Decl(controlFlowCaching.ts, 20, 56)) + + } else if (rotation < (270 + centerAnchorLimit)) { +>rotation : Symbol(rotation, Decl(controlFlowCaching.ts, 7, 47)) +>centerAnchorLimit : Symbol(centerAnchorLimit, Decl(controlFlowCaching.ts, 3, 38)) + + labelOffset.y = leftBottom ? size * 0.4 : 0; +>labelOffset : Symbol(labelOffset, Decl(controlFlowCaching.ts, 8, 100)) +>leftBottom : Symbol(leftBottom, Decl(controlFlowCaching.ts, 6, 72)) +>size : Symbol(size, Decl(controlFlowCaching.ts, 20, 56)) + + } else { + labelOffset.y = leftBottom ? size : 0; +>labelOffset : Symbol(labelOffset, Decl(controlFlowCaching.ts, 8, 100)) +>leftBottom : Symbol(leftBottom, Decl(controlFlowCaching.ts, 6, 72)) +>size : Symbol(size, Decl(controlFlowCaching.ts, 20, 56)) + } + } + + titleRotation = (taTitleOrientation && taTitleOrientation == "away") ? 180 : 0; +>titleRotation : Symbol(titleRotation, Decl(controlFlowCaching.ts, 8, 30)) +>taTitleOrientation : Symbol(taTitleOrientation, Decl(controlFlowCaching.ts, 14, 92)) +>taTitleOrientation : Symbol(taTitleOrientation, Decl(controlFlowCaching.ts, 14, 92)) + + titlePos.y = offsets.t - titleOffset + (titleRotation ? 0 : tsize); +>titlePos : Symbol(titlePos, Decl(controlFlowCaching.ts, 8, 20)) +>offsets : Symbol(offsets, Decl(controlFlowCaching.ts, 3, 15)) +>titleOffset : Symbol(titleOffset, Decl(controlFlowCaching.ts, 8, 49)) +>titleRotation : Symbol(titleRotation, Decl(controlFlowCaching.ts, 8, 30)) +>tsize : Symbol(tsize, Decl(controlFlowCaching.ts, 23, 60)) + + switch (labelAlign) { +>labelAlign : Symbol(labelAlign, Decl(controlFlowCaching.ts, 8, 113)) + + case "start": + labelAlign = "end"; +>labelAlign : Symbol(labelAlign, Decl(controlFlowCaching.ts, 8, 113)) + + break; + case "end": + labelAlign = "start"; +>labelAlign : Symbol(labelAlign, Decl(controlFlowCaching.ts, 8, 113)) + + break; + case "middle": + labelOffset.y -= size; +>labelOffset : Symbol(labelOffset, Decl(controlFlowCaching.ts, 8, 100)) +>size : Symbol(size, Decl(controlFlowCaching.ts, 20, 56)) + + break; + } + + let _ = rotation; +>_ : Symbol(_, Decl(controlFlowCaching.ts, 65, 7)) +>rotation : Symbol(rotation, Decl(controlFlowCaching.ts, 7, 47)) +} + diff --git a/tests/baselines/reference/controlFlowCaching.types b/tests/baselines/reference/controlFlowCaching.types new file mode 100644 index 00000000000..cd603b274d1 --- /dev/null +++ b/tests/baselines/reference/controlFlowCaching.types @@ -0,0 +1,607 @@ +=== tests/cases/compiler/controlFlowCaching.ts === + +// Repro for #8401 + +function f(dim, offsets, arr, acommon, centerAnchorLimit, g, has, lin) { +>f : (dim: any, offsets: any, arr: any, acommon: any, centerAnchorLimit: any, g: any, has: any, lin: any) => void +>dim : any +>offsets : any +>arr : any +>acommon : any +>centerAnchorLimit : any +>g : any +>has : any +>lin : any + + var isRtl = this._isRtl(); // chart mirroring +>isRtl : any +>this._isRtl() : any +>this._isRtl : any +>this : any +>_isRtl : any + + // prepare variable + var o = this.opt, ta = this.chart.theme.axis, position = o.position, +>o : any +>this.opt : any +>this : any +>opt : any +>ta : any +>this.chart.theme.axis : any +>this.chart.theme : any +>this.chart : any +>this : any +>chart : any +>theme : any +>axis : any +>position : any +>o.position : any +>o : any +>position : any + + leftBottom = position !== "rightOrTop", rotation = o.rotation % 360, +>leftBottom : boolean +>position !== "rightOrTop" : boolean +>position : any +>"rightOrTop" : string +>rotation : number +>o.rotation % 360 : number +>o.rotation : any +>o : any +>rotation : any +>360 : number + + start, stop, titlePos, titleRotation = 0, titleOffset, axisVector, tickVector, anchorOffset, labelOffset, labelAlign, +>start : any +>stop : any +>titlePos : any +>titleRotation : number +>0 : number +>titleOffset : any +>axisVector : any +>tickVector : any +>anchorOffset : any +>labelOffset : any +>labelAlign : any + + labelGap = this.chart.theme.axis.tick.labelGap, +>labelGap : any +>this.chart.theme.axis.tick.labelGap : any +>this.chart.theme.axis.tick : any +>this.chart.theme.axis : any +>this.chart.theme : any +>this.chart : any +>this : any +>chart : any +>theme : any +>axis : any +>tick : any +>labelGap : any + + taFont = o.font || (ta.majorTick && ta.majorTick.font) || (ta.tick && ta.tick.font), +>taFont : any +>o.font || (ta.majorTick && ta.majorTick.font) || (ta.tick && ta.tick.font) : any +>o.font || (ta.majorTick && ta.majorTick.font) : any +>o.font : any +>o : any +>font : any +>(ta.majorTick && ta.majorTick.font) : any +>ta.majorTick && ta.majorTick.font : any +>ta.majorTick : any +>ta : any +>majorTick : any +>ta.majorTick.font : any +>ta.majorTick : any +>ta : any +>majorTick : any +>font : any +>(ta.tick && ta.tick.font) : any +>ta.tick && ta.tick.font : any +>ta.tick : any +>ta : any +>tick : any +>ta.tick.font : any +>ta.tick : any +>ta : any +>tick : any +>font : any + + taTitleFont = o.titleFont || (ta.title && ta.title.font), +>taTitleFont : any +>o.titleFont || (ta.title && ta.title.font) : any +>o.titleFont : any +>o : any +>titleFont : any +>(ta.title && ta.title.font) : any +>ta.title && ta.title.font : any +>ta.title : any +>ta : any +>title : any +>ta.title.font : any +>ta.title : any +>ta : any +>title : any +>font : any + + taFontColor = o.fontColor || (ta.majorTick && ta.majorTick.fontColor) || (ta.tick && ta.tick.fontColor) || "black", +>taFontColor : any +>o.fontColor || (ta.majorTick && ta.majorTick.fontColor) || (ta.tick && ta.tick.fontColor) || "black" : any +>o.fontColor || (ta.majorTick && ta.majorTick.fontColor) || (ta.tick && ta.tick.fontColor) : any +>o.fontColor || (ta.majorTick && ta.majorTick.fontColor) : any +>o.fontColor : any +>o : any +>fontColor : any +>(ta.majorTick && ta.majorTick.fontColor) : any +>ta.majorTick && ta.majorTick.fontColor : any +>ta.majorTick : any +>ta : any +>majorTick : any +>ta.majorTick.fontColor : any +>ta.majorTick : any +>ta : any +>majorTick : any +>fontColor : any +>(ta.tick && ta.tick.fontColor) : any +>ta.tick && ta.tick.fontColor : any +>ta.tick : any +>ta : any +>tick : any +>ta.tick.fontColor : any +>ta.tick : any +>ta : any +>tick : any +>fontColor : any +>"black" : string + + taTitleFontColor = o.titleFontColor || (ta.title && ta.title.fontColor) || "black", +>taTitleFontColor : any +>o.titleFontColor || (ta.title && ta.title.fontColor) || "black" : any +>o.titleFontColor || (ta.title && ta.title.fontColor) : any +>o.titleFontColor : any +>o : any +>titleFontColor : any +>(ta.title && ta.title.fontColor) : any +>ta.title && ta.title.fontColor : any +>ta.title : any +>ta : any +>title : any +>ta.title.fontColor : any +>ta.title : any +>ta : any +>title : any +>fontColor : any +>"black" : string + + taTitleGap = (o.titleGap == 0) ? 0 : o.titleGap || (ta.title && ta.title.gap) || 15, +>taTitleGap : any +>(o.titleGap == 0) ? 0 : o.titleGap || (ta.title && ta.title.gap) || 15 : any +>(o.titleGap == 0) : boolean +>o.titleGap == 0 : boolean +>o.titleGap : any +>o : any +>titleGap : any +>0 : number +>0 : number +>o.titleGap || (ta.title && ta.title.gap) || 15 : any +>o.titleGap || (ta.title && ta.title.gap) : any +>o.titleGap : any +>o : any +>titleGap : any +>(ta.title && ta.title.gap) : any +>ta.title && ta.title.gap : any +>ta.title : any +>ta : any +>title : any +>ta.title.gap : any +>ta.title : any +>ta : any +>title : any +>gap : any +>15 : number + + taTitleOrientation = o.titleOrientation || (ta.title && ta.title.orientation) || "axis", +>taTitleOrientation : any +>o.titleOrientation || (ta.title && ta.title.orientation) || "axis" : any +>o.titleOrientation || (ta.title && ta.title.orientation) : any +>o.titleOrientation : any +>o : any +>titleOrientation : any +>(ta.title && ta.title.orientation) : any +>ta.title && ta.title.orientation : any +>ta.title : any +>ta : any +>title : any +>ta.title.orientation : any +>ta.title : any +>ta : any +>title : any +>orientation : any +>"axis" : string + + taMajorTick = this.chart.theme.getTick("major", o), +>taMajorTick : any +>this.chart.theme.getTick("major", o) : any +>this.chart.theme.getTick : any +>this.chart.theme : any +>this.chart : any +>this : any +>chart : any +>theme : any +>getTick : any +>"major" : string +>o : any + + taMinorTick = this.chart.theme.getTick("minor", o), +>taMinorTick : any +>this.chart.theme.getTick("minor", o) : any +>this.chart.theme.getTick : any +>this.chart.theme : any +>this.chart : any +>this : any +>chart : any +>theme : any +>getTick : any +>"minor" : string +>o : any + + taMicroTick = this.chart.theme.getTick("micro", o), +>taMicroTick : any +>this.chart.theme.getTick("micro", o) : any +>this.chart.theme.getTick : any +>this.chart.theme : any +>this.chart : any +>this : any +>chart : any +>theme : any +>getTick : any +>"micro" : string +>o : any + + taStroke = "stroke" in o ? o.stroke : ta.stroke, +>taStroke : any +>"stroke" in o ? o.stroke : ta.stroke : any +>"stroke" in o : boolean +>"stroke" : string +>o : any +>o.stroke : any +>o : any +>stroke : any +>ta.stroke : any +>ta : any +>stroke : any + + size = taFont ? g.normalizedLength(g.splitFontString(taFont).size) : 0, +>size : any +>taFont ? g.normalizedLength(g.splitFontString(taFont).size) : 0 : any +>taFont : any +>g.normalizedLength(g.splitFontString(taFont).size) : any +>g.normalizedLength : any +>g : any +>normalizedLength : any +>g.splitFontString(taFont).size : any +>g.splitFontString(taFont) : any +>g.splitFontString : any +>g : any +>splitFontString : any +>taFont : any +>size : any +>0 : number + + cosr = Math.abs(Math.cos(rotation * Math.PI / 180)), +>cosr : number +>Math.abs(Math.cos(rotation * Math.PI / 180)) : number +>Math.abs : (x: number) => number +>Math : Math +>abs : (x: number) => number +>Math.cos(rotation * Math.PI / 180) : number +>Math.cos : (x: number) => number +>Math : Math +>cos : (x: number) => number +>rotation * Math.PI / 180 : number +>rotation * Math.PI : number +>rotation : number +>Math.PI : number +>Math : Math +>PI : number +>180 : number + + sinr = Math.abs(Math.sin(rotation * Math.PI / 180)), +>sinr : number +>Math.abs(Math.sin(rotation * Math.PI / 180)) : number +>Math.abs : (x: number) => number +>Math : Math +>abs : (x: number) => number +>Math.sin(rotation * Math.PI / 180) : number +>Math.sin : (x: number) => number +>Math : Math +>sin : (x: number) => number +>rotation * Math.PI / 180 : number +>rotation * Math.PI : number +>rotation : number +>Math.PI : number +>Math : Math +>PI : number +>180 : number + + tsize = taTitleFont ? g.normalizedLength(g.splitFontString(taTitleFont).size) : 0; +>tsize : any +>taTitleFont ? g.normalizedLength(g.splitFontString(taTitleFont).size) : 0 : any +>taTitleFont : any +>g.normalizedLength(g.splitFontString(taTitleFont).size) : any +>g.normalizedLength : any +>g : any +>normalizedLength : any +>g.splitFontString(taTitleFont).size : any +>g.splitFontString(taTitleFont) : any +>g.splitFontString : any +>g : any +>splitFontString : any +>taTitleFont : any +>size : any +>0 : number + + if (rotation < 0) { +>rotation < 0 : boolean +>rotation : number +>0 : number + + rotation += 360; +>rotation += 360 : number +>rotation : number +>360 : number + } + var cachedLabelW = this._getMaxLabelSize(); +>cachedLabelW : any +>this._getMaxLabelSize() : any +>this._getMaxLabelSize : any +>this : any +>_getMaxLabelSize : any + + cachedLabelW = cachedLabelW && cachedLabelW.majLabelW; +>cachedLabelW = cachedLabelW && cachedLabelW.majLabelW : any +>cachedLabelW : any +>cachedLabelW && cachedLabelW.majLabelW : any +>cachedLabelW : any +>cachedLabelW.majLabelW : any +>cachedLabelW : any +>majLabelW : any + + titleOffset = size * cosr + (cachedLabelW || 0) * sinr + labelGap + Math.max(taMajorTick.length > 0 ? taMajorTick.length : 0, +>titleOffset = size * cosr + (cachedLabelW || 0) * sinr + labelGap + Math.max(taMajorTick.length > 0 ? taMajorTick.length : 0, taMinorTick.length > 0 ? taMinorTick.length : 0) + tsize + taTitleGap : any +>titleOffset : any +>size * cosr + (cachedLabelW || 0) * sinr + labelGap + Math.max(taMajorTick.length > 0 ? taMajorTick.length : 0, taMinorTick.length > 0 ? taMinorTick.length : 0) + tsize + taTitleGap : any +>size * cosr + (cachedLabelW || 0) * sinr + labelGap + Math.max(taMajorTick.length > 0 ? taMajorTick.length : 0, taMinorTick.length > 0 ? taMinorTick.length : 0) + tsize : any +>size * cosr + (cachedLabelW || 0) * sinr + labelGap + Math.max(taMajorTick.length > 0 ? taMajorTick.length : 0, taMinorTick.length > 0 ? taMinorTick.length : 0) : any +>size * cosr + (cachedLabelW || 0) * sinr + labelGap : any +>size * cosr + (cachedLabelW || 0) * sinr : number +>size * cosr : number +>size : any +>cosr : number +>(cachedLabelW || 0) * sinr : number +>(cachedLabelW || 0) : any +>cachedLabelW || 0 : any +>cachedLabelW : any +>0 : number +>sinr : number +>labelGap : any +>Math.max(taMajorTick.length > 0 ? taMajorTick.length : 0, taMinorTick.length > 0 ? taMinorTick.length : 0) : number +>Math.max : (...values: number[]) => number +>Math : Math +>max : (...values: number[]) => number +>taMajorTick.length > 0 ? taMajorTick.length : 0 : any +>taMajorTick.length > 0 : boolean +>taMajorTick.length : any +>taMajorTick : any +>length : any +>0 : number +>taMajorTick.length : any +>taMajorTick : any +>length : any +>0 : number + + taMinorTick.length > 0 ? taMinorTick.length : 0) + +>taMinorTick.length > 0 ? taMinorTick.length : 0 : any +>taMinorTick.length > 0 : boolean +>taMinorTick.length : any +>taMinorTick : any +>length : any +>0 : number +>taMinorTick.length : any +>taMinorTick : any +>length : any +>0 : number + + tsize + taTitleGap; +>tsize : any +>taTitleGap : any + + axisVector = { x: isRtl ? -1 : 1, y: 0 }; // chart mirroring +>axisVector = { x: isRtl ? -1 : 1, y: 0 } : { x: number; y: number; } +>axisVector : any +>{ x: isRtl ? -1 : 1, y: 0 } : { x: number; y: number; } +>x : number +>isRtl ? -1 : 1 : number +>isRtl : any +>-1 : number +>1 : number +>1 : number +>y : number +>0 : number + + switch (rotation) { +>rotation : number + + default: + if (rotation < (90 - centerAnchorLimit)) { +>rotation < (90 - centerAnchorLimit) : boolean +>rotation : number +>(90 - centerAnchorLimit) : number +>90 - centerAnchorLimit : number +>90 : number +>centerAnchorLimit : any + + labelOffset.y = leftBottom ? size : 0; +>labelOffset.y = leftBottom ? size : 0 : any +>labelOffset.y : any +>labelOffset : any +>y : any +>leftBottom ? size : 0 : any +>leftBottom : boolean +>size : any +>0 : number + + } else if (rotation < (90 + centerAnchorLimit)) { +>rotation < (90 + centerAnchorLimit) : boolean +>rotation : number +>(90 + centerAnchorLimit) : any +>90 + centerAnchorLimit : any +>90 : number +>centerAnchorLimit : any + + labelOffset.x = -size * 0.4; +>labelOffset.x = -size * 0.4 : number +>labelOffset.x : any +>labelOffset : any +>x : any +>-size * 0.4 : number +>-size : number +>size : any +>0.4 : number + + } else if (rotation < 180) { +>rotation < 180 : boolean +>rotation : number +>180 : number + + labelOffset.y = leftBottom ? 0 : -size; +>labelOffset.y = leftBottom ? 0 : -size : number +>labelOffset.y : any +>labelOffset : any +>y : any +>leftBottom ? 0 : -size : number +>leftBottom : boolean +>0 : number +>-size : number +>size : any + + } else if (rotation < (270 - centerAnchorLimit)) { +>rotation < (270 - centerAnchorLimit) : boolean +>rotation : number +>(270 - centerAnchorLimit) : number +>270 - centerAnchorLimit : number +>270 : number +>centerAnchorLimit : any + + labelOffset.y = leftBottom ? 0 : -size; +>labelOffset.y = leftBottom ? 0 : -size : number +>labelOffset.y : any +>labelOffset : any +>y : any +>leftBottom ? 0 : -size : number +>leftBottom : boolean +>0 : number +>-size : number +>size : any + + } else if (rotation < (270 + centerAnchorLimit)) { +>rotation < (270 + centerAnchorLimit) : boolean +>rotation : number +>(270 + centerAnchorLimit) : any +>270 + centerAnchorLimit : any +>270 : number +>centerAnchorLimit : any + + labelOffset.y = leftBottom ? size * 0.4 : 0; +>labelOffset.y = leftBottom ? size * 0.4 : 0 : number +>labelOffset.y : any +>labelOffset : any +>y : any +>leftBottom ? size * 0.4 : 0 : number +>leftBottom : boolean +>size * 0.4 : number +>size : any +>0.4 : number +>0 : number + + } else { + labelOffset.y = leftBottom ? size : 0; +>labelOffset.y = leftBottom ? size : 0 : any +>labelOffset.y : any +>labelOffset : any +>y : any +>leftBottom ? size : 0 : any +>leftBottom : boolean +>size : any +>0 : number + } + } + + titleRotation = (taTitleOrientation && taTitleOrientation == "away") ? 180 : 0; +>titleRotation = (taTitleOrientation && taTitleOrientation == "away") ? 180 : 0 : number +>titleRotation : number +>(taTitleOrientation && taTitleOrientation == "away") ? 180 : 0 : number +>(taTitleOrientation && taTitleOrientation == "away") : boolean +>taTitleOrientation && taTitleOrientation == "away" : boolean +>taTitleOrientation : any +>taTitleOrientation == "away" : boolean +>taTitleOrientation : any +>"away" : string +>180 : number +>0 : number + + titlePos.y = offsets.t - titleOffset + (titleRotation ? 0 : tsize); +>titlePos.y = offsets.t - titleOffset + (titleRotation ? 0 : tsize) : any +>titlePos.y : any +>titlePos : any +>y : any +>offsets.t - titleOffset + (titleRotation ? 0 : tsize) : any +>offsets.t - titleOffset : number +>offsets.t : any +>offsets : any +>t : any +>titleOffset : any +>(titleRotation ? 0 : tsize) : any +>titleRotation ? 0 : tsize : any +>titleRotation : number +>0 : number +>tsize : any + + switch (labelAlign) { +>labelAlign : any + + case "start": +>"start" : string + + labelAlign = "end"; +>labelAlign = "end" : string +>labelAlign : any +>"end" : string + + break; + case "end": +>"end" : string + + labelAlign = "start"; +>labelAlign = "start" : string +>labelAlign : any +>"start" : string + + break; + case "middle": +>"middle" : string + + labelOffset.y -= size; +>labelOffset.y -= size : number +>labelOffset.y : any +>labelOffset : any +>y : any +>size : any + + break; + } + + let _ = rotation; +>_ : number +>rotation : number +} + diff --git a/tests/baselines/reference/controlFlowCommaOperator.js b/tests/baselines/reference/controlFlowCommaOperator.js new file mode 100644 index 00000000000..55dcc77e075 --- /dev/null +++ b/tests/baselines/reference/controlFlowCommaOperator.js @@ -0,0 +1,48 @@ +//// [controlFlowCommaOperator.ts] +function f(x: string | number | boolean) { + let y: string | number | boolean = false; + let z: string | number | boolean = false; + if (y = "", typeof x === "string") { + x; // string + y; // string + z; // boolean + } + else if (z = 1, typeof x === "number") { + x; // number + y; // string + z; // number + } + else { + x; // boolean + y; // string + z; // number + } + x; // string | number | boolean + y; // string + z; // number | boolean +} + + +//// [controlFlowCommaOperator.js] +function f(x) { + var y = false; + var z = false; + if (y = "", typeof x === "string") { + x; // string + y; // string + z; // boolean + } + else if (z = 1, typeof x === "number") { + x; // number + y; // string + z; // number + } + else { + x; // boolean + y; // string + z; // number + } + x; // string | number | boolean + y; // string + z; // number | boolean +} diff --git a/tests/baselines/reference/controlFlowCommaOperator.symbols b/tests/baselines/reference/controlFlowCommaOperator.symbols new file mode 100644 index 00000000000..f1550b79a68 --- /dev/null +++ b/tests/baselines/reference/controlFlowCommaOperator.symbols @@ -0,0 +1,57 @@ +=== tests/cases/conformance/controlFlow/controlFlowCommaOperator.ts === +function f(x: string | number | boolean) { +>f : Symbol(f, Decl(controlFlowCommaOperator.ts, 0, 0)) +>x : Symbol(x, Decl(controlFlowCommaOperator.ts, 0, 11)) + + let y: string | number | boolean = false; +>y : Symbol(y, Decl(controlFlowCommaOperator.ts, 1, 7)) + + let z: string | number | boolean = false; +>z : Symbol(z, Decl(controlFlowCommaOperator.ts, 2, 7)) + + if (y = "", typeof x === "string") { +>y : Symbol(y, Decl(controlFlowCommaOperator.ts, 1, 7)) +>x : Symbol(x, Decl(controlFlowCommaOperator.ts, 0, 11)) + + x; // string +>x : Symbol(x, Decl(controlFlowCommaOperator.ts, 0, 11)) + + y; // string +>y : Symbol(y, Decl(controlFlowCommaOperator.ts, 1, 7)) + + z; // boolean +>z : Symbol(z, Decl(controlFlowCommaOperator.ts, 2, 7)) + } + else if (z = 1, typeof x === "number") { +>z : Symbol(z, Decl(controlFlowCommaOperator.ts, 2, 7)) +>x : Symbol(x, Decl(controlFlowCommaOperator.ts, 0, 11)) + + x; // number +>x : Symbol(x, Decl(controlFlowCommaOperator.ts, 0, 11)) + + y; // string +>y : Symbol(y, Decl(controlFlowCommaOperator.ts, 1, 7)) + + z; // number +>z : Symbol(z, Decl(controlFlowCommaOperator.ts, 2, 7)) + } + else { + x; // boolean +>x : Symbol(x, Decl(controlFlowCommaOperator.ts, 0, 11)) + + y; // string +>y : Symbol(y, Decl(controlFlowCommaOperator.ts, 1, 7)) + + z; // number +>z : Symbol(z, Decl(controlFlowCommaOperator.ts, 2, 7)) + } + x; // string | number | boolean +>x : Symbol(x, Decl(controlFlowCommaOperator.ts, 0, 11)) + + y; // string +>y : Symbol(y, Decl(controlFlowCommaOperator.ts, 1, 7)) + + z; // number | boolean +>z : Symbol(z, Decl(controlFlowCommaOperator.ts, 2, 7)) +} + diff --git a/tests/baselines/reference/controlFlowCommaOperator.types b/tests/baselines/reference/controlFlowCommaOperator.types new file mode 100644 index 00000000000..53014ceafa7 --- /dev/null +++ b/tests/baselines/reference/controlFlowCommaOperator.types @@ -0,0 +1,71 @@ +=== tests/cases/conformance/controlFlow/controlFlowCommaOperator.ts === +function f(x: string | number | boolean) { +>f : (x: string | number | boolean) => void +>x : string | number | boolean + + let y: string | number | boolean = false; +>y : string | number | boolean +>false : boolean + + let z: string | number | boolean = false; +>z : string | number | boolean +>false : boolean + + if (y = "", typeof x === "string") { +>y = "", typeof x === "string" : boolean +>y = "" : string +>y : string | number | boolean +>"" : string +>typeof x === "string" : boolean +>typeof x : string +>x : string | number | boolean +>"string" : string + + x; // string +>x : string + + y; // string +>y : string + + z; // boolean +>z : boolean + } + else if (z = 1, typeof x === "number") { +>z = 1, typeof x === "number" : boolean +>z = 1 : number +>z : string | number | boolean +>1 : number +>typeof x === "number" : boolean +>typeof x : string +>x : number | boolean +>"number" : string + + x; // number +>x : number + + y; // string +>y : string + + z; // number +>z : number + } + else { + x; // boolean +>x : boolean + + y; // string +>y : string + + z; // number +>z : number + } + x; // string | number | boolean +>x : string | number | boolean + + y; // string +>y : string + + z; // number | boolean +>z : boolean | number +} + diff --git a/tests/baselines/reference/controlFlowConditionalExpression.js b/tests/baselines/reference/controlFlowConditionalExpression.js new file mode 100644 index 00000000000..f39b999039b --- /dev/null +++ b/tests/baselines/reference/controlFlowConditionalExpression.js @@ -0,0 +1,13 @@ +//// [controlFlowConditionalExpression.ts] +let x: string | number | boolean; +let cond: boolean; + +cond ? x = "" : x = 3; +x; // string | number + + +//// [controlFlowConditionalExpression.js] +var x; +var cond; +cond ? x = "" : x = 3; +x; // string | number diff --git a/tests/baselines/reference/controlFlowConditionalExpression.symbols b/tests/baselines/reference/controlFlowConditionalExpression.symbols new file mode 100644 index 00000000000..b1a4074d08d --- /dev/null +++ b/tests/baselines/reference/controlFlowConditionalExpression.symbols @@ -0,0 +1,15 @@ +=== tests/cases/conformance/controlFlow/controlFlowConditionalExpression.ts === +let x: string | number | boolean; +>x : Symbol(x, Decl(controlFlowConditionalExpression.ts, 0, 3)) + +let cond: boolean; +>cond : Symbol(cond, Decl(controlFlowConditionalExpression.ts, 1, 3)) + +cond ? x = "" : x = 3; +>cond : Symbol(cond, Decl(controlFlowConditionalExpression.ts, 1, 3)) +>x : Symbol(x, Decl(controlFlowConditionalExpression.ts, 0, 3)) +>x : Symbol(x, Decl(controlFlowConditionalExpression.ts, 0, 3)) + +x; // string | number +>x : Symbol(x, Decl(controlFlowConditionalExpression.ts, 0, 3)) + diff --git a/tests/baselines/reference/controlFlowConditionalExpression.types b/tests/baselines/reference/controlFlowConditionalExpression.types new file mode 100644 index 00000000000..c6084e052b1 --- /dev/null +++ b/tests/baselines/reference/controlFlowConditionalExpression.types @@ -0,0 +1,20 @@ +=== tests/cases/conformance/controlFlow/controlFlowConditionalExpression.ts === +let x: string | number | boolean; +>x : string | number | boolean + +let cond: boolean; +>cond : boolean + +cond ? x = "" : x = 3; +>cond ? x = "" : x = 3 : string | number +>cond : boolean +>x = "" : string +>x : string | number | boolean +>"" : string +>x = 3 : number +>x : string | number | boolean +>3 : number + +x; // string | number +>x : string | number + diff --git a/tests/baselines/reference/controlFlowDeleteOperator.js b/tests/baselines/reference/controlFlowDeleteOperator.js new file mode 100644 index 00000000000..36ac88467d2 --- /dev/null +++ b/tests/baselines/reference/controlFlowDeleteOperator.js @@ -0,0 +1,36 @@ +//// [controlFlowDeleteOperator.ts] + +function f() { + let x: { a?: number | string, b: number | string } = { b: 1 }; + x.a; + x.b; + x.a = 1; + x.b = 1; + x.a; + x.b; + delete x.a; + delete x.b; + x.a; + x.b; + x; + delete x; // No effect + x; +} + +//// [controlFlowDeleteOperator.js] +function f() { + var x = { b: 1 }; + x.a; + x.b; + x.a = 1; + x.b = 1; + x.a; + x.b; + delete x.a; + delete x.b; + x.a; + x.b; + x; + delete x; // No effect + x; +} diff --git a/tests/baselines/reference/controlFlowDeleteOperator.symbols b/tests/baselines/reference/controlFlowDeleteOperator.symbols new file mode 100644 index 00000000000..029c9ddafcc --- /dev/null +++ b/tests/baselines/reference/controlFlowDeleteOperator.symbols @@ -0,0 +1,70 @@ +=== tests/cases/conformance/controlFlow/controlFlowDeleteOperator.ts === + +function f() { +>f : Symbol(f, Decl(controlFlowDeleteOperator.ts, 0, 0)) + + let x: { a?: number | string, b: number | string } = { b: 1 }; +>x : Symbol(x, Decl(controlFlowDeleteOperator.ts, 2, 7)) +>a : Symbol(a, Decl(controlFlowDeleteOperator.ts, 2, 12)) +>b : Symbol(b, Decl(controlFlowDeleteOperator.ts, 2, 33)) +>b : Symbol(b, Decl(controlFlowDeleteOperator.ts, 2, 58)) + + x.a; +>x.a : Symbol(a, Decl(controlFlowDeleteOperator.ts, 2, 12)) +>x : Symbol(x, Decl(controlFlowDeleteOperator.ts, 2, 7)) +>a : Symbol(a, Decl(controlFlowDeleteOperator.ts, 2, 12)) + + x.b; +>x.b : Symbol(b, Decl(controlFlowDeleteOperator.ts, 2, 33)) +>x : Symbol(x, Decl(controlFlowDeleteOperator.ts, 2, 7)) +>b : Symbol(b, Decl(controlFlowDeleteOperator.ts, 2, 33)) + + x.a = 1; +>x.a : Symbol(a, Decl(controlFlowDeleteOperator.ts, 2, 12)) +>x : Symbol(x, Decl(controlFlowDeleteOperator.ts, 2, 7)) +>a : Symbol(a, Decl(controlFlowDeleteOperator.ts, 2, 12)) + + x.b = 1; +>x.b : Symbol(b, Decl(controlFlowDeleteOperator.ts, 2, 33)) +>x : Symbol(x, Decl(controlFlowDeleteOperator.ts, 2, 7)) +>b : Symbol(b, Decl(controlFlowDeleteOperator.ts, 2, 33)) + + x.a; +>x.a : Symbol(a, Decl(controlFlowDeleteOperator.ts, 2, 12)) +>x : Symbol(x, Decl(controlFlowDeleteOperator.ts, 2, 7)) +>a : Symbol(a, Decl(controlFlowDeleteOperator.ts, 2, 12)) + + x.b; +>x.b : Symbol(b, Decl(controlFlowDeleteOperator.ts, 2, 33)) +>x : Symbol(x, Decl(controlFlowDeleteOperator.ts, 2, 7)) +>b : Symbol(b, Decl(controlFlowDeleteOperator.ts, 2, 33)) + + delete x.a; +>x.a : Symbol(a, Decl(controlFlowDeleteOperator.ts, 2, 12)) +>x : Symbol(x, Decl(controlFlowDeleteOperator.ts, 2, 7)) +>a : Symbol(a, Decl(controlFlowDeleteOperator.ts, 2, 12)) + + delete x.b; +>x.b : Symbol(b, Decl(controlFlowDeleteOperator.ts, 2, 33)) +>x : Symbol(x, Decl(controlFlowDeleteOperator.ts, 2, 7)) +>b : Symbol(b, Decl(controlFlowDeleteOperator.ts, 2, 33)) + + x.a; +>x.a : Symbol(a, Decl(controlFlowDeleteOperator.ts, 2, 12)) +>x : Symbol(x, Decl(controlFlowDeleteOperator.ts, 2, 7)) +>a : Symbol(a, Decl(controlFlowDeleteOperator.ts, 2, 12)) + + x.b; +>x.b : Symbol(b, Decl(controlFlowDeleteOperator.ts, 2, 33)) +>x : Symbol(x, Decl(controlFlowDeleteOperator.ts, 2, 7)) +>b : Symbol(b, Decl(controlFlowDeleteOperator.ts, 2, 33)) + + x; +>x : Symbol(x, Decl(controlFlowDeleteOperator.ts, 2, 7)) + + delete x; // No effect +>x : Symbol(x, Decl(controlFlowDeleteOperator.ts, 2, 7)) + + x; +>x : Symbol(x, Decl(controlFlowDeleteOperator.ts, 2, 7)) +} diff --git a/tests/baselines/reference/controlFlowDeleteOperator.types b/tests/baselines/reference/controlFlowDeleteOperator.types new file mode 100644 index 00000000000..365174db058 --- /dev/null +++ b/tests/baselines/reference/controlFlowDeleteOperator.types @@ -0,0 +1,79 @@ +=== tests/cases/conformance/controlFlow/controlFlowDeleteOperator.ts === + +function f() { +>f : () => void + + let x: { a?: number | string, b: number | string } = { b: 1 }; +>x : { a?: number | string | undefined; b: number | string; } +>a : number | string | undefined +>b : number | string +>{ b: 1 } : { b: number; } +>b : number +>1 : number + + x.a; +>x.a : number | string | undefined +>x : { a?: number | string | undefined; b: number | string; } +>a : number | string | undefined + + x.b; +>x.b : number | string +>x : { a?: number | string | undefined; b: number | string; } +>b : number | string + + x.a = 1; +>x.a = 1 : number +>x.a : number | string | undefined +>x : { a?: number | string | undefined; b: number | string; } +>a : number | string | undefined +>1 : number + + x.b = 1; +>x.b = 1 : number +>x.b : number | string +>x : { a?: number | string | undefined; b: number | string; } +>b : number | string +>1 : number + + x.a; +>x.a : number +>x : { a?: number | string | undefined; b: number | string; } +>a : number + + x.b; +>x.b : number +>x : { a?: number | string | undefined; b: number | string; } +>b : number + + delete x.a; +>delete x.a : boolean +>x.a : number +>x : { a?: number | string | undefined; b: number | string; } +>a : number + + delete x.b; +>delete x.b : boolean +>x.b : number +>x : { a?: number | string | undefined; b: number | string; } +>b : number + + x.a; +>x.a : undefined +>x : { a?: number | string | undefined; b: number | string; } +>a : undefined + + x.b; +>x.b : number | string +>x : { a?: number | string | undefined; b: number | string; } +>b : number | string + + x; +>x : { a?: number | string | undefined; b: number | string; } + + delete x; // No effect +>delete x : boolean +>x : { a?: number | string | undefined; b: number | string; } + + x; +>x : { a?: number | string | undefined; b: number | string; } +} diff --git a/tests/baselines/reference/controlFlowDestructuringDeclaration.js b/tests/baselines/reference/controlFlowDestructuringDeclaration.js new file mode 100644 index 00000000000..766fb6baeb2 --- /dev/null +++ b/tests/baselines/reference/controlFlowDestructuringDeclaration.js @@ -0,0 +1,113 @@ +//// [controlFlowDestructuringDeclaration.ts] + +function f1() { + let x: string | number = 1; + x; + let y: string | undefined = ""; + y; +} + +function f2() { + let [x]: [string | number] = [1]; + x; + let [y]: [string | undefined] = [""]; + y; + let [z = ""]: [string | undefined] = [undefined]; + z; +} + +function f3() { + let [x]: (string | number)[] = [1]; + x; + let [y]: (string | undefined)[] = [""]; + y; + let [z = ""]: (string | undefined)[] = [undefined]; + z; +} + +function f4() { + let { x }: { x: string | number } = { x: 1 }; + x; + let { y }: { y: string | undefined } = { y: "" }; + y; + let { z = "" }: { z: string | undefined } = { z: undefined }; + z; +} + +function f5() { + let { x }: { x?: string | number } = { x: 1 }; + x; + let { y }: { y?: string | undefined } = { y: "" }; + y; + let { z = "" }: { z?: string | undefined } = { z: undefined }; + z; +} + +function f6() { + let { x }: { x?: string | number } = {}; + x; + let { y }: { y?: string | undefined } = {}; + y; + let { z = "" }: { z?: string | undefined } = {}; + z; +} + +function f7() { + let o: { [x: string]: number } = { x: 1 }; + let { x }: { [x: string]: string | number } = o; + x; +} + + +//// [controlFlowDestructuringDeclaration.js] +function f1() { + var x = 1; + x; + var y = ""; + y; +} +function f2() { + var x = [1][0]; + x; + var y = [""][0]; + y; + var _a = [undefined][0], z = _a === void 0 ? "" : _a; + z; +} +function f3() { + var x = [1][0]; + x; + var y = [""][0]; + y; + var _a = [undefined][0], z = _a === void 0 ? "" : _a; + z; +} +function f4() { + var x = { x: 1 }.x; + x; + var y = { y: "" }.y; + y; + var _a = { z: undefined }.z, z = _a === void 0 ? "" : _a; + z; +} +function f5() { + var x = { x: 1 }.x; + x; + var y = { y: "" }.y; + y; + var _a = { z: undefined }.z, z = _a === void 0 ? "" : _a; + z; +} +function f6() { + var x = {}.x; + x; + var y = {}.y; + y; + var _a = {}.z, z = _a === void 0 ? "" : _a; + z; +} +function f7() { + var o = { x: 1 }; + var x = o.x; + x; +} diff --git a/tests/baselines/reference/controlFlowDestructuringDeclaration.symbols b/tests/baselines/reference/controlFlowDestructuringDeclaration.symbols new file mode 100644 index 00000000000..65f0e497942 --- /dev/null +++ b/tests/baselines/reference/controlFlowDestructuringDeclaration.symbols @@ -0,0 +1,164 @@ +=== tests/cases/conformance/controlFlow/controlFlowDestructuringDeclaration.ts === + +function f1() { +>f1 : Symbol(f1, Decl(controlFlowDestructuringDeclaration.ts, 0, 0)) + + let x: string | number = 1; +>x : Symbol(x, Decl(controlFlowDestructuringDeclaration.ts, 2, 7)) + + x; +>x : Symbol(x, Decl(controlFlowDestructuringDeclaration.ts, 2, 7)) + + let y: string | undefined = ""; +>y : Symbol(y, Decl(controlFlowDestructuringDeclaration.ts, 4, 7)) + + y; +>y : Symbol(y, Decl(controlFlowDestructuringDeclaration.ts, 4, 7)) +} + +function f2() { +>f2 : Symbol(f2, Decl(controlFlowDestructuringDeclaration.ts, 6, 1)) + + let [x]: [string | number] = [1]; +>x : Symbol(x, Decl(controlFlowDestructuringDeclaration.ts, 9, 9)) + + x; +>x : Symbol(x, Decl(controlFlowDestructuringDeclaration.ts, 9, 9)) + + let [y]: [string | undefined] = [""]; +>y : Symbol(y, Decl(controlFlowDestructuringDeclaration.ts, 11, 9)) + + y; +>y : Symbol(y, Decl(controlFlowDestructuringDeclaration.ts, 11, 9)) + + let [z = ""]: [string | undefined] = [undefined]; +>z : Symbol(z, Decl(controlFlowDestructuringDeclaration.ts, 13, 9)) +>undefined : Symbol(undefined) + + z; +>z : Symbol(z, Decl(controlFlowDestructuringDeclaration.ts, 13, 9)) +} + +function f3() { +>f3 : Symbol(f3, Decl(controlFlowDestructuringDeclaration.ts, 15, 1)) + + let [x]: (string | number)[] = [1]; +>x : Symbol(x, Decl(controlFlowDestructuringDeclaration.ts, 18, 9)) + + x; +>x : Symbol(x, Decl(controlFlowDestructuringDeclaration.ts, 18, 9)) + + let [y]: (string | undefined)[] = [""]; +>y : Symbol(y, Decl(controlFlowDestructuringDeclaration.ts, 20, 9)) + + y; +>y : Symbol(y, Decl(controlFlowDestructuringDeclaration.ts, 20, 9)) + + let [z = ""]: (string | undefined)[] = [undefined]; +>z : Symbol(z, Decl(controlFlowDestructuringDeclaration.ts, 22, 9)) +>undefined : Symbol(undefined) + + z; +>z : Symbol(z, Decl(controlFlowDestructuringDeclaration.ts, 22, 9)) +} + +function f4() { +>f4 : Symbol(f4, Decl(controlFlowDestructuringDeclaration.ts, 24, 1)) + + let { x }: { x: string | number } = { x: 1 }; +>x : Symbol(x, Decl(controlFlowDestructuringDeclaration.ts, 27, 9)) +>x : Symbol(x, Decl(controlFlowDestructuringDeclaration.ts, 27, 16)) +>x : Symbol(x, Decl(controlFlowDestructuringDeclaration.ts, 27, 41)) + + x; +>x : Symbol(x, Decl(controlFlowDestructuringDeclaration.ts, 27, 9)) + + let { y }: { y: string | undefined } = { y: "" }; +>y : Symbol(y, Decl(controlFlowDestructuringDeclaration.ts, 29, 9)) +>y : Symbol(y, Decl(controlFlowDestructuringDeclaration.ts, 29, 16)) +>y : Symbol(y, Decl(controlFlowDestructuringDeclaration.ts, 29, 44)) + + y; +>y : Symbol(y, Decl(controlFlowDestructuringDeclaration.ts, 29, 9)) + + let { z = "" }: { z: string | undefined } = { z: undefined }; +>z : Symbol(z, Decl(controlFlowDestructuringDeclaration.ts, 31, 9)) +>z : Symbol(z, Decl(controlFlowDestructuringDeclaration.ts, 31, 21)) +>z : Symbol(z, Decl(controlFlowDestructuringDeclaration.ts, 31, 49)) +>undefined : Symbol(undefined) + + z; +>z : Symbol(z, Decl(controlFlowDestructuringDeclaration.ts, 31, 9)) +} + +function f5() { +>f5 : Symbol(f5, Decl(controlFlowDestructuringDeclaration.ts, 33, 1)) + + let { x }: { x?: string | number } = { x: 1 }; +>x : Symbol(x, Decl(controlFlowDestructuringDeclaration.ts, 36, 9)) +>x : Symbol(x, Decl(controlFlowDestructuringDeclaration.ts, 36, 16)) +>x : Symbol(x, Decl(controlFlowDestructuringDeclaration.ts, 36, 42)) + + x; +>x : Symbol(x, Decl(controlFlowDestructuringDeclaration.ts, 36, 9)) + + let { y }: { y?: string | undefined } = { y: "" }; +>y : Symbol(y, Decl(controlFlowDestructuringDeclaration.ts, 38, 9)) +>y : Symbol(y, Decl(controlFlowDestructuringDeclaration.ts, 38, 16)) +>y : Symbol(y, Decl(controlFlowDestructuringDeclaration.ts, 38, 45)) + + y; +>y : Symbol(y, Decl(controlFlowDestructuringDeclaration.ts, 38, 9)) + + let { z = "" }: { z?: string | undefined } = { z: undefined }; +>z : Symbol(z, Decl(controlFlowDestructuringDeclaration.ts, 40, 9)) +>z : Symbol(z, Decl(controlFlowDestructuringDeclaration.ts, 40, 21)) +>z : Symbol(z, Decl(controlFlowDestructuringDeclaration.ts, 40, 50)) +>undefined : Symbol(undefined) + + z; +>z : Symbol(z, Decl(controlFlowDestructuringDeclaration.ts, 40, 9)) +} + +function f6() { +>f6 : Symbol(f6, Decl(controlFlowDestructuringDeclaration.ts, 42, 1)) + + let { x }: { x?: string | number } = {}; +>x : Symbol(x, Decl(controlFlowDestructuringDeclaration.ts, 45, 9)) +>x : Symbol(x, Decl(controlFlowDestructuringDeclaration.ts, 45, 16)) + + x; +>x : Symbol(x, Decl(controlFlowDestructuringDeclaration.ts, 45, 9)) + + let { y }: { y?: string | undefined } = {}; +>y : Symbol(y, Decl(controlFlowDestructuringDeclaration.ts, 47, 9)) +>y : Symbol(y, Decl(controlFlowDestructuringDeclaration.ts, 47, 16)) + + y; +>y : Symbol(y, Decl(controlFlowDestructuringDeclaration.ts, 47, 9)) + + let { z = "" }: { z?: string | undefined } = {}; +>z : Symbol(z, Decl(controlFlowDestructuringDeclaration.ts, 49, 9)) +>z : Symbol(z, Decl(controlFlowDestructuringDeclaration.ts, 49, 21)) + + z; +>z : Symbol(z, Decl(controlFlowDestructuringDeclaration.ts, 49, 9)) +} + +function f7() { +>f7 : Symbol(f7, Decl(controlFlowDestructuringDeclaration.ts, 51, 1)) + + let o: { [x: string]: number } = { x: 1 }; +>o : Symbol(o, Decl(controlFlowDestructuringDeclaration.ts, 54, 7)) +>x : Symbol(x, Decl(controlFlowDestructuringDeclaration.ts, 54, 14)) +>x : Symbol(x, Decl(controlFlowDestructuringDeclaration.ts, 54, 38)) + + let { x }: { [x: string]: string | number } = o; +>x : Symbol(x, Decl(controlFlowDestructuringDeclaration.ts, 55, 9)) +>x : Symbol(x, Decl(controlFlowDestructuringDeclaration.ts, 55, 18)) +>o : Symbol(o, Decl(controlFlowDestructuringDeclaration.ts, 54, 7)) + + x; +>x : Symbol(x, Decl(controlFlowDestructuringDeclaration.ts, 55, 9)) +} + diff --git a/tests/baselines/reference/controlFlowDestructuringDeclaration.types b/tests/baselines/reference/controlFlowDestructuringDeclaration.types new file mode 100644 index 00000000000..2e3b1f5647e --- /dev/null +++ b/tests/baselines/reference/controlFlowDestructuringDeclaration.types @@ -0,0 +1,196 @@ +=== tests/cases/conformance/controlFlow/controlFlowDestructuringDeclaration.ts === + +function f1() { +>f1 : () => void + + let x: string | number = 1; +>x : string | number +>1 : number + + x; +>x : number + + let y: string | undefined = ""; +>y : string | undefined +>"" : string + + y; +>y : string +} + +function f2() { +>f2 : () => void + + let [x]: [string | number] = [1]; +>x : string | number +>[1] : [number] +>1 : number + + x; +>x : number + + let [y]: [string | undefined] = [""]; +>y : string | undefined +>[""] : [string] +>"" : string + + y; +>y : string + + let [z = ""]: [string | undefined] = [undefined]; +>z : string +>"" : string +>[undefined] : [undefined] +>undefined : undefined + + z; +>z : string +} + +function f3() { +>f3 : () => void + + let [x]: (string | number)[] = [1]; +>x : string | number +>[1] : number[] +>1 : number + + x; +>x : number + + let [y]: (string | undefined)[] = [""]; +>y : string | undefined +>[""] : string[] +>"" : string + + y; +>y : string + + let [z = ""]: (string | undefined)[] = [undefined]; +>z : string +>"" : string +>[undefined] : undefined[] +>undefined : undefined + + z; +>z : string +} + +function f4() { +>f4 : () => void + + let { x }: { x: string | number } = { x: 1 }; +>x : string | number +>x : string | number +>{ x: 1 } : { x: number; } +>x : number +>1 : number + + x; +>x : number + + let { y }: { y: string | undefined } = { y: "" }; +>y : string | undefined +>y : string | undefined +>{ y: "" } : { y: string; } +>y : string +>"" : string + + y; +>y : string + + let { z = "" }: { z: string | undefined } = { z: undefined }; +>z : string +>"" : string +>z : string | undefined +>{ z: undefined } : { z: undefined; } +>z : undefined +>undefined : undefined + + z; +>z : string +} + +function f5() { +>f5 : () => void + + let { x }: { x?: string | number } = { x: 1 }; +>x : string | number | undefined +>x : string | number | undefined +>{ x: 1 } : { x: number; } +>x : number +>1 : number + + x; +>x : number + + let { y }: { y?: string | undefined } = { y: "" }; +>y : string | undefined +>y : string | undefined +>{ y: "" } : { y: string; } +>y : string +>"" : string + + y; +>y : string + + let { z = "" }: { z?: string | undefined } = { z: undefined }; +>z : string +>"" : string +>z : string | undefined +>{ z: undefined } : { z: undefined; } +>z : undefined +>undefined : undefined + + z; +>z : string +} + +function f6() { +>f6 : () => void + + let { x }: { x?: string | number } = {}; +>x : string | number | undefined +>x : string | number | undefined +>{} : {} + + x; +>x : string | number | undefined + + let { y }: { y?: string | undefined } = {}; +>y : string | undefined +>y : string | undefined +>{} : {} + + y; +>y : string | undefined + + let { z = "" }: { z?: string | undefined } = {}; +>z : string +>"" : string +>z : string | undefined +>{} : {} + + z; +>z : string +} + +function f7() { +>f7 : () => void + + let o: { [x: string]: number } = { x: 1 }; +>o : { [x: string]: number; } +>x : string +>{ x: 1 } : { x: number; } +>x : number +>1 : number + + let { x }: { [x: string]: string | number } = o; +>x : string | number +>x : string +>o : { [x: string]: number; } + + x; +>x : number +} + diff --git a/tests/baselines/reference/controlFlowDestructuringParameters.js b/tests/baselines/reference/controlFlowDestructuringParameters.js new file mode 100644 index 00000000000..66b8e656193 --- /dev/null +++ b/tests/baselines/reference/controlFlowDestructuringParameters.js @@ -0,0 +1,15 @@ +//// [controlFlowDestructuringParameters.ts] +// Repro for #8376 + + +[{ x: 1 }].map( + ({ x }) => x +); + + +//// [controlFlowDestructuringParameters.js] +// Repro for #8376 +[{ x: 1 }].map(function (_a) { + var x = _a.x; + return x; +}); diff --git a/tests/baselines/reference/controlFlowDestructuringParameters.symbols b/tests/baselines/reference/controlFlowDestructuringParameters.symbols new file mode 100644 index 00000000000..668d346b929 --- /dev/null +++ b/tests/baselines/reference/controlFlowDestructuringParameters.symbols @@ -0,0 +1,15 @@ +=== tests/cases/compiler/controlFlowDestructuringParameters.ts === +// Repro for #8376 + + +[{ x: 1 }].map( +>[{ x: 1 }].map : Symbol(Array.map, Decl(lib.d.ts, --, --)) +>x : Symbol(x, Decl(controlFlowDestructuringParameters.ts, 3, 2)) +>map : Symbol(Array.map, Decl(lib.d.ts, --, --)) + + ({ x }) => x +>x : Symbol(x, Decl(controlFlowDestructuringParameters.ts, 4, 4)) +>x : Symbol(x, Decl(controlFlowDestructuringParameters.ts, 4, 4)) + +); + diff --git a/tests/baselines/reference/controlFlowDestructuringParameters.types b/tests/baselines/reference/controlFlowDestructuringParameters.types new file mode 100644 index 00000000000..396852bf37a --- /dev/null +++ b/tests/baselines/reference/controlFlowDestructuringParameters.types @@ -0,0 +1,20 @@ +=== tests/cases/compiler/controlFlowDestructuringParameters.ts === +// Repro for #8376 + + +[{ x: 1 }].map( +>[{ x: 1 }].map( ({ x }) => x) : number[] +>[{ x: 1 }].map : (callbackfn: (value: { x: number; }, index: number, array: { x: number; }[]) => U, thisArg?: any) => U[] +>[{ x: 1 }] : { x: number; }[] +>{ x: 1 } : { x: number; } +>x : number +>1 : number +>map : (callbackfn: (value: { x: number; }, index: number, array: { x: number; }[]) => U, thisArg?: any) => U[] + + ({ x }) => x +>({ x }) => x : ({x}: { x: number; }) => number +>x : number +>x : number + +); + diff --git a/tests/baselines/reference/controlFlowDoWhileStatement.js b/tests/baselines/reference/controlFlowDoWhileStatement.js new file mode 100644 index 00000000000..635a5a59257 --- /dev/null +++ b/tests/baselines/reference/controlFlowDoWhileStatement.js @@ -0,0 +1,157 @@ +//// [controlFlowDoWhileStatement.ts] +let cond: boolean; +function a() { + let x: string | number; + x = ""; + do { + x; // string + } while (cond) +} +function b() { + let x: string | number; + x = ""; + do { + x; // string + x = 42; + break; + } while (cond) +} +function c() { + let x: string | number; + x = ""; + do { + x; // string + x = undefined; + if (typeof x === "string") continue; + break; + } while (cond) +} +function d() { + let x: string | number; + x = 1000; + do { + x; // number + x = ""; + } while (x = x.length) + x; // number +} +function e() { + let x: string | number; + x = ""; + do { + x = 42; + } while (cond) + x; // number +} +function f() { + let x: string | number | boolean | RegExp | Function; + x = ""; + do { + if (cond) { + x = 42; + break; + } + if (cond) { + x = true; + continue; + } + x = /a/; + } while (cond) + x; // number | boolean | RegExp +} +function g() { + let x: string | number | boolean | RegExp | Function; + x = ""; + do { + if (cond) { + x = 42; + break; + } + if (cond) { + x = true; + continue; + } + x = /a/; + } while (true) + x; // number +} + + +//// [controlFlowDoWhileStatement.js] +var cond; +function a() { + var x; + x = ""; + do { + x; // string + } while (cond); +} +function b() { + var x; + x = ""; + do { + x; // string + x = 42; + break; + } while (cond); +} +function c() { + var x; + x = ""; + do { + x; // string + x = undefined; + if (typeof x === "string") + continue; + break; + } while (cond); +} +function d() { + var x; + x = 1000; + do { + x; // number + x = ""; + } while (x = x.length); + x; // number +} +function e() { + var x; + x = ""; + do { + x = 42; + } while (cond); + x; // number +} +function f() { + var x; + x = ""; + do { + if (cond) { + x = 42; + break; + } + if (cond) { + x = true; + continue; + } + x = /a/; + } while (cond); + x; // number | boolean | RegExp +} +function g() { + var x; + x = ""; + do { + if (cond) { + x = 42; + break; + } + if (cond) { + x = true; + continue; + } + x = /a/; + } while (true); + x; // number +} diff --git a/tests/baselines/reference/controlFlowDoWhileStatement.symbols b/tests/baselines/reference/controlFlowDoWhileStatement.symbols new file mode 100644 index 00000000000..2a3f3858ec2 --- /dev/null +++ b/tests/baselines/reference/controlFlowDoWhileStatement.symbols @@ -0,0 +1,181 @@ +=== tests/cases/conformance/controlFlow/controlFlowDoWhileStatement.ts === +let cond: boolean; +>cond : Symbol(cond, Decl(controlFlowDoWhileStatement.ts, 0, 3)) + +function a() { +>a : Symbol(a, Decl(controlFlowDoWhileStatement.ts, 0, 18)) + + let x: string | number; +>x : Symbol(x, Decl(controlFlowDoWhileStatement.ts, 2, 7)) + + x = ""; +>x : Symbol(x, Decl(controlFlowDoWhileStatement.ts, 2, 7)) + + do { + x; // string +>x : Symbol(x, Decl(controlFlowDoWhileStatement.ts, 2, 7)) + + } while (cond) +>cond : Symbol(cond, Decl(controlFlowDoWhileStatement.ts, 0, 3)) +} +function b() { +>b : Symbol(b, Decl(controlFlowDoWhileStatement.ts, 7, 1)) + + let x: string | number; +>x : Symbol(x, Decl(controlFlowDoWhileStatement.ts, 9, 7)) + + x = ""; +>x : Symbol(x, Decl(controlFlowDoWhileStatement.ts, 9, 7)) + + do { + x; // string +>x : Symbol(x, Decl(controlFlowDoWhileStatement.ts, 9, 7)) + + x = 42; +>x : Symbol(x, Decl(controlFlowDoWhileStatement.ts, 9, 7)) + + break; + } while (cond) +>cond : Symbol(cond, Decl(controlFlowDoWhileStatement.ts, 0, 3)) +} +function c() { +>c : Symbol(c, Decl(controlFlowDoWhileStatement.ts, 16, 1)) + + let x: string | number; +>x : Symbol(x, Decl(controlFlowDoWhileStatement.ts, 18, 7)) + + x = ""; +>x : Symbol(x, Decl(controlFlowDoWhileStatement.ts, 18, 7)) + + do { + x; // string +>x : Symbol(x, Decl(controlFlowDoWhileStatement.ts, 18, 7)) + + x = undefined; +>x : Symbol(x, Decl(controlFlowDoWhileStatement.ts, 18, 7)) +>undefined : Symbol(undefined) + + if (typeof x === "string") continue; +>x : Symbol(x, Decl(controlFlowDoWhileStatement.ts, 18, 7)) + + break; + } while (cond) +>cond : Symbol(cond, Decl(controlFlowDoWhileStatement.ts, 0, 3)) +} +function d() { +>d : Symbol(d, Decl(controlFlowDoWhileStatement.ts, 26, 1)) + + let x: string | number; +>x : Symbol(x, Decl(controlFlowDoWhileStatement.ts, 28, 7)) + + x = 1000; +>x : Symbol(x, Decl(controlFlowDoWhileStatement.ts, 28, 7)) + + do { + x; // number +>x : Symbol(x, Decl(controlFlowDoWhileStatement.ts, 28, 7)) + + x = ""; +>x : Symbol(x, Decl(controlFlowDoWhileStatement.ts, 28, 7)) + + } while (x = x.length) +>x : Symbol(x, Decl(controlFlowDoWhileStatement.ts, 28, 7)) +>x.length : Symbol(String.length, Decl(lib.d.ts, --, --)) +>x : Symbol(x, Decl(controlFlowDoWhileStatement.ts, 28, 7)) +>length : Symbol(String.length, Decl(lib.d.ts, --, --)) + + x; // number +>x : Symbol(x, Decl(controlFlowDoWhileStatement.ts, 28, 7)) +} +function e() { +>e : Symbol(e, Decl(controlFlowDoWhileStatement.ts, 35, 1)) + + let x: string | number; +>x : Symbol(x, Decl(controlFlowDoWhileStatement.ts, 37, 7)) + + x = ""; +>x : Symbol(x, Decl(controlFlowDoWhileStatement.ts, 37, 7)) + + do { + x = 42; +>x : Symbol(x, Decl(controlFlowDoWhileStatement.ts, 37, 7)) + + } while (cond) +>cond : Symbol(cond, Decl(controlFlowDoWhileStatement.ts, 0, 3)) + + x; // number +>x : Symbol(x, Decl(controlFlowDoWhileStatement.ts, 37, 7)) +} +function f() { +>f : Symbol(f, Decl(controlFlowDoWhileStatement.ts, 43, 1)) + + let x: string | number | boolean | RegExp | Function; +>x : Symbol(x, Decl(controlFlowDoWhileStatement.ts, 45, 7)) +>RegExp : Symbol(RegExp, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) + + x = ""; +>x : Symbol(x, Decl(controlFlowDoWhileStatement.ts, 45, 7)) + + do { + if (cond) { +>cond : Symbol(cond, Decl(controlFlowDoWhileStatement.ts, 0, 3)) + + x = 42; +>x : Symbol(x, Decl(controlFlowDoWhileStatement.ts, 45, 7)) + + break; + } + if (cond) { +>cond : Symbol(cond, Decl(controlFlowDoWhileStatement.ts, 0, 3)) + + x = true; +>x : Symbol(x, Decl(controlFlowDoWhileStatement.ts, 45, 7)) + + continue; + } + x = /a/; +>x : Symbol(x, Decl(controlFlowDoWhileStatement.ts, 45, 7)) + + } while (cond) +>cond : Symbol(cond, Decl(controlFlowDoWhileStatement.ts, 0, 3)) + + x; // number | boolean | RegExp +>x : Symbol(x, Decl(controlFlowDoWhileStatement.ts, 45, 7)) +} +function g() { +>g : Symbol(g, Decl(controlFlowDoWhileStatement.ts, 59, 1)) + + let x: string | number | boolean | RegExp | Function; +>x : Symbol(x, Decl(controlFlowDoWhileStatement.ts, 61, 7)) +>RegExp : Symbol(RegExp, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) + + x = ""; +>x : Symbol(x, Decl(controlFlowDoWhileStatement.ts, 61, 7)) + + do { + if (cond) { +>cond : Symbol(cond, Decl(controlFlowDoWhileStatement.ts, 0, 3)) + + x = 42; +>x : Symbol(x, Decl(controlFlowDoWhileStatement.ts, 61, 7)) + + break; + } + if (cond) { +>cond : Symbol(cond, Decl(controlFlowDoWhileStatement.ts, 0, 3)) + + x = true; +>x : Symbol(x, Decl(controlFlowDoWhileStatement.ts, 61, 7)) + + continue; + } + x = /a/; +>x : Symbol(x, Decl(controlFlowDoWhileStatement.ts, 61, 7)) + + } while (true) + x; // number +>x : Symbol(x, Decl(controlFlowDoWhileStatement.ts, 61, 7)) +} + diff --git a/tests/baselines/reference/controlFlowDoWhileStatement.types b/tests/baselines/reference/controlFlowDoWhileStatement.types new file mode 100644 index 00000000000..a82ae1b716e --- /dev/null +++ b/tests/baselines/reference/controlFlowDoWhileStatement.types @@ -0,0 +1,220 @@ +=== tests/cases/conformance/controlFlow/controlFlowDoWhileStatement.ts === +let cond: boolean; +>cond : boolean + +function a() { +>a : () => void + + let x: string | number; +>x : string | number + + x = ""; +>x = "" : string +>x : string | number +>"" : string + + do { + x; // string +>x : string + + } while (cond) +>cond : boolean +} +function b() { +>b : () => void + + let x: string | number; +>x : string | number + + x = ""; +>x = "" : string +>x : string | number +>"" : string + + do { + x; // string +>x : string + + x = 42; +>x = 42 : number +>x : string | number +>42 : number + + break; + } while (cond) +>cond : boolean +} +function c() { +>c : () => void + + let x: string | number; +>x : string | number + + x = ""; +>x = "" : string +>x : string | number +>"" : string + + do { + x; // string +>x : string + + x = undefined; +>x = undefined : undefined +>x : string | number +>undefined : undefined + + if (typeof x === "string") continue; +>typeof x === "string" : boolean +>typeof x : string +>x : string | number +>"string" : string + + break; + } while (cond) +>cond : boolean +} +function d() { +>d : () => void + + let x: string | number; +>x : string | number + + x = 1000; +>x = 1000 : number +>x : string | number +>1000 : number + + do { + x; // number +>x : number + + x = ""; +>x = "" : string +>x : string | number +>"" : string + + } while (x = x.length) +>x = x.length : number +>x : string | number +>x.length : number +>x : string +>length : number + + x; // number +>x : number +} +function e() { +>e : () => void + + let x: string | number; +>x : string | number + + x = ""; +>x = "" : string +>x : string | number +>"" : string + + do { + x = 42; +>x = 42 : number +>x : string | number +>42 : number + + } while (cond) +>cond : boolean + + x; // number +>x : number +} +function f() { +>f : () => void + + let x: string | number | boolean | RegExp | Function; +>x : string | number | boolean | RegExp | Function +>RegExp : RegExp +>Function : Function + + x = ""; +>x = "" : string +>x : string | number | boolean | RegExp | Function +>"" : string + + do { + if (cond) { +>cond : boolean + + x = 42; +>x = 42 : number +>x : string | number | boolean | RegExp | Function +>42 : number + + break; + } + if (cond) { +>cond : boolean + + x = true; +>x = true : boolean +>x : string | number | boolean | RegExp | Function +>true : boolean + + continue; + } + x = /a/; +>x = /a/ : RegExp +>x : string | number | boolean | RegExp | Function +>/a/ : RegExp + + } while (cond) +>cond : boolean + + x; // number | boolean | RegExp +>x : number | boolean | RegExp +} +function g() { +>g : () => void + + let x: string | number | boolean | RegExp | Function; +>x : string | number | boolean | RegExp | Function +>RegExp : RegExp +>Function : Function + + x = ""; +>x = "" : string +>x : string | number | boolean | RegExp | Function +>"" : string + + do { + if (cond) { +>cond : boolean + + x = 42; +>x = 42 : number +>x : string | number | boolean | RegExp | Function +>42 : number + + break; + } + if (cond) { +>cond : boolean + + x = true; +>x = true : boolean +>x : string | number | boolean | RegExp | Function +>true : boolean + + continue; + } + x = /a/; +>x = /a/ : RegExp +>x : string | number | boolean | RegExp | Function +>/a/ : RegExp + + } while (true) +>true : boolean + + x; // number +>x : number +} + diff --git a/tests/baselines/reference/controlFlowForInStatement.js b/tests/baselines/reference/controlFlowForInStatement.js new file mode 100644 index 00000000000..1d3f29de2ad --- /dev/null +++ b/tests/baselines/reference/controlFlowForInStatement.js @@ -0,0 +1,37 @@ +//// [controlFlowForInStatement.ts] +let x: string | number | boolean | RegExp | Function; +let obj: any; +let cond: boolean; + +x = /a/; +for (let y in obj) { + x = y; + if (cond) { + x = 42; + continue; + } + if (cond) { + x = true; + break; + } +} +x; // RegExp | string | number | boolean + + +//// [controlFlowForInStatement.js] +var x; +var obj; +var cond; +x = /a/; +for (var y in obj) { + x = y; + if (cond) { + x = 42; + continue; + } + if (cond) { + x = true; + break; + } +} +x; // RegExp | string | number | boolean diff --git a/tests/baselines/reference/controlFlowForInStatement.symbols b/tests/baselines/reference/controlFlowForInStatement.symbols new file mode 100644 index 00000000000..8d01ff50193 --- /dev/null +++ b/tests/baselines/reference/controlFlowForInStatement.symbols @@ -0,0 +1,43 @@ +=== tests/cases/conformance/controlFlow/controlFlowForInStatement.ts === +let x: string | number | boolean | RegExp | Function; +>x : Symbol(x, Decl(controlFlowForInStatement.ts, 0, 3)) +>RegExp : Symbol(RegExp, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) + +let obj: any; +>obj : Symbol(obj, Decl(controlFlowForInStatement.ts, 1, 3)) + +let cond: boolean; +>cond : Symbol(cond, Decl(controlFlowForInStatement.ts, 2, 3)) + +x = /a/; +>x : Symbol(x, Decl(controlFlowForInStatement.ts, 0, 3)) + +for (let y in obj) { +>y : Symbol(y, Decl(controlFlowForInStatement.ts, 5, 8)) +>obj : Symbol(obj, Decl(controlFlowForInStatement.ts, 1, 3)) + + x = y; +>x : Symbol(x, Decl(controlFlowForInStatement.ts, 0, 3)) +>y : Symbol(y, Decl(controlFlowForInStatement.ts, 5, 8)) + + if (cond) { +>cond : Symbol(cond, Decl(controlFlowForInStatement.ts, 2, 3)) + + x = 42; +>x : Symbol(x, Decl(controlFlowForInStatement.ts, 0, 3)) + + continue; + } + if (cond) { +>cond : Symbol(cond, Decl(controlFlowForInStatement.ts, 2, 3)) + + x = true; +>x : Symbol(x, Decl(controlFlowForInStatement.ts, 0, 3)) + + break; + } +} +x; // RegExp | string | number | boolean +>x : Symbol(x, Decl(controlFlowForInStatement.ts, 0, 3)) + diff --git a/tests/baselines/reference/controlFlowForInStatement.types b/tests/baselines/reference/controlFlowForInStatement.types new file mode 100644 index 00000000000..e46db37bb16 --- /dev/null +++ b/tests/baselines/reference/controlFlowForInStatement.types @@ -0,0 +1,50 @@ +=== tests/cases/conformance/controlFlow/controlFlowForInStatement.ts === +let x: string | number | boolean | RegExp | Function; +>x : string | number | boolean | RegExp | Function +>RegExp : RegExp +>Function : Function + +let obj: any; +>obj : any + +let cond: boolean; +>cond : boolean + +x = /a/; +>x = /a/ : RegExp +>x : string | number | boolean | RegExp | Function +>/a/ : RegExp + +for (let y in obj) { +>y : string +>obj : any + + x = y; +>x = y : string +>x : string | number | boolean | RegExp | Function +>y : string + + if (cond) { +>cond : boolean + + x = 42; +>x = 42 : number +>x : string | number | boolean | RegExp | Function +>42 : number + + continue; + } + if (cond) { +>cond : boolean + + x = true; +>x = true : boolean +>x : string | number | boolean | RegExp | Function +>true : boolean + + break; + } +} +x; // RegExp | string | number | boolean +>x : RegExp | number | string | boolean + diff --git a/tests/baselines/reference/controlFlowForOfStatement.js b/tests/baselines/reference/controlFlowForOfStatement.js new file mode 100644 index 00000000000..31ba7f1a346 --- /dev/null +++ b/tests/baselines/reference/controlFlowForOfStatement.js @@ -0,0 +1,24 @@ +//// [controlFlowForOfStatement.ts] +let obj: number[]; +let x: string | number | boolean | RegExp; + +function a() { + x = true; + for (x of obj) { + x = x.toExponential(); + } + x; // string | boolean +} + + +//// [controlFlowForOfStatement.js] +var obj; +var x; +function a() { + x = true; + for (var _i = 0, obj_1 = obj; _i < obj_1.length; _i++) { + x = obj_1[_i]; + x = x.toExponential(); + } + x; // string | boolean +} diff --git a/tests/baselines/reference/controlFlowForOfStatement.symbols b/tests/baselines/reference/controlFlowForOfStatement.symbols new file mode 100644 index 00000000000..0f1e754be41 --- /dev/null +++ b/tests/baselines/reference/controlFlowForOfStatement.symbols @@ -0,0 +1,28 @@ +=== tests/cases/conformance/controlFlow/controlFlowForOfStatement.ts === +let obj: number[]; +>obj : Symbol(obj, Decl(controlFlowForOfStatement.ts, 0, 3)) + +let x: string | number | boolean | RegExp; +>x : Symbol(x, Decl(controlFlowForOfStatement.ts, 1, 3)) +>RegExp : Symbol(RegExp, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) + +function a() { +>a : Symbol(a, Decl(controlFlowForOfStatement.ts, 1, 42)) + + x = true; +>x : Symbol(x, Decl(controlFlowForOfStatement.ts, 1, 3)) + + for (x of obj) { +>x : Symbol(x, Decl(controlFlowForOfStatement.ts, 1, 3)) +>obj : Symbol(obj, Decl(controlFlowForOfStatement.ts, 0, 3)) + + x = x.toExponential(); +>x : Symbol(x, Decl(controlFlowForOfStatement.ts, 1, 3)) +>x.toExponential : Symbol(Number.toExponential, Decl(lib.d.ts, --, --)) +>x : Symbol(x, Decl(controlFlowForOfStatement.ts, 1, 3)) +>toExponential : Symbol(Number.toExponential, Decl(lib.d.ts, --, --)) + } + x; // string | boolean +>x : Symbol(x, Decl(controlFlowForOfStatement.ts, 1, 3)) +} + diff --git a/tests/baselines/reference/controlFlowForOfStatement.types b/tests/baselines/reference/controlFlowForOfStatement.types new file mode 100644 index 00000000000..437576e51b6 --- /dev/null +++ b/tests/baselines/reference/controlFlowForOfStatement.types @@ -0,0 +1,32 @@ +=== tests/cases/conformance/controlFlow/controlFlowForOfStatement.ts === +let obj: number[]; +>obj : number[] + +let x: string | number | boolean | RegExp; +>x : string | number | boolean | RegExp +>RegExp : RegExp + +function a() { +>a : () => void + + x = true; +>x = true : boolean +>x : string | number | boolean | RegExp +>true : boolean + + for (x of obj) { +>x : string | number | boolean | RegExp +>obj : number[] + + x = x.toExponential(); +>x = x.toExponential() : string +>x : string | number | boolean | RegExp +>x.toExponential() : string +>x.toExponential : (fractionDigits?: number) => string +>x : number +>toExponential : (fractionDigits?: number) => string + } + x; // string | boolean +>x : boolean | string +} + diff --git a/tests/baselines/reference/controlFlowForStatement.js b/tests/baselines/reference/controlFlowForStatement.js new file mode 100644 index 00000000000..d9b1d0814fe --- /dev/null +++ b/tests/baselines/reference/controlFlowForStatement.js @@ -0,0 +1,87 @@ +//// [controlFlowForStatement.ts] +let cond: boolean; +function a() { + let x: string | number | boolean; + for (x = ""; cond; x = 5) { + x; // string | number + } +} +function b() { + let x: string | number | boolean; + for (x = 5; cond; x = x.length) { + x; // number + x = ""; + } +} +function c() { + let x: string | number | boolean; + for (x = 5; x = x.toExponential(); x = 5) { + x; // string + } +} +function d() { + let x: string | number | boolean; + for (x = ""; typeof x === "string"; x = 5) { + x; // string + } +} +function e() { + let x: string | number | boolean | RegExp; + for (x = "" || 0; typeof x !== "string"; x = "" || true) { + x; // number | boolean + } +} +function f() { + let x: string | number | boolean; + for (; typeof x !== "string";) { + x; // number | boolean + if (typeof x === "number") break; + x = undefined; + } + x; // string | number +} + + +//// [controlFlowForStatement.js] +var cond; +function a() { + var x; + for (x = ""; cond; x = 5) { + x; // string | number + } +} +function b() { + var x; + for (x = 5; cond; x = x.length) { + x; // number + x = ""; + } +} +function c() { + var x; + for (x = 5; x = x.toExponential(); x = 5) { + x; // string + } +} +function d() { + var x; + for (x = ""; typeof x === "string"; x = 5) { + x; // string + } +} +function e() { + var x; + for (x = "" || 0; typeof x !== "string"; x = "" || true) { + x; // number | boolean + } +} +function f() { + var x; + for (; typeof x !== "string";) { + x; // number | boolean + if (typeof x === "number") + break; + x = undefined; + } + x; // string | number +} diff --git a/tests/baselines/reference/controlFlowForStatement.symbols b/tests/baselines/reference/controlFlowForStatement.symbols new file mode 100644 index 00000000000..1918fe0ca33 --- /dev/null +++ b/tests/baselines/reference/controlFlowForStatement.symbols @@ -0,0 +1,112 @@ +=== tests/cases/conformance/controlFlow/controlFlowForStatement.ts === +let cond: boolean; +>cond : Symbol(cond, Decl(controlFlowForStatement.ts, 0, 3)) + +function a() { +>a : Symbol(a, Decl(controlFlowForStatement.ts, 0, 18)) + + let x: string | number | boolean; +>x : Symbol(x, Decl(controlFlowForStatement.ts, 2, 7)) + + for (x = ""; cond; x = 5) { +>x : Symbol(x, Decl(controlFlowForStatement.ts, 2, 7)) +>cond : Symbol(cond, Decl(controlFlowForStatement.ts, 0, 3)) +>x : Symbol(x, Decl(controlFlowForStatement.ts, 2, 7)) + + x; // string | number +>x : Symbol(x, Decl(controlFlowForStatement.ts, 2, 7)) + } +} +function b() { +>b : Symbol(b, Decl(controlFlowForStatement.ts, 6, 1)) + + let x: string | number | boolean; +>x : Symbol(x, Decl(controlFlowForStatement.ts, 8, 7)) + + for (x = 5; cond; x = x.length) { +>x : Symbol(x, Decl(controlFlowForStatement.ts, 8, 7)) +>cond : Symbol(cond, Decl(controlFlowForStatement.ts, 0, 3)) +>x : Symbol(x, Decl(controlFlowForStatement.ts, 8, 7)) +>x.length : Symbol(String.length, Decl(lib.d.ts, --, --)) +>x : Symbol(x, Decl(controlFlowForStatement.ts, 8, 7)) +>length : Symbol(String.length, Decl(lib.d.ts, --, --)) + + x; // number +>x : Symbol(x, Decl(controlFlowForStatement.ts, 8, 7)) + + x = ""; +>x : Symbol(x, Decl(controlFlowForStatement.ts, 8, 7)) + } +} +function c() { +>c : Symbol(c, Decl(controlFlowForStatement.ts, 13, 1)) + + let x: string | number | boolean; +>x : Symbol(x, Decl(controlFlowForStatement.ts, 15, 7)) + + for (x = 5; x = x.toExponential(); x = 5) { +>x : Symbol(x, Decl(controlFlowForStatement.ts, 15, 7)) +>x : Symbol(x, Decl(controlFlowForStatement.ts, 15, 7)) +>x.toExponential : Symbol(Number.toExponential, Decl(lib.d.ts, --, --)) +>x : Symbol(x, Decl(controlFlowForStatement.ts, 15, 7)) +>toExponential : Symbol(Number.toExponential, Decl(lib.d.ts, --, --)) +>x : Symbol(x, Decl(controlFlowForStatement.ts, 15, 7)) + + x; // string +>x : Symbol(x, Decl(controlFlowForStatement.ts, 15, 7)) + } +} +function d() { +>d : Symbol(d, Decl(controlFlowForStatement.ts, 19, 1)) + + let x: string | number | boolean; +>x : Symbol(x, Decl(controlFlowForStatement.ts, 21, 7)) + + for (x = ""; typeof x === "string"; x = 5) { +>x : Symbol(x, Decl(controlFlowForStatement.ts, 21, 7)) +>x : Symbol(x, Decl(controlFlowForStatement.ts, 21, 7)) +>x : Symbol(x, Decl(controlFlowForStatement.ts, 21, 7)) + + x; // string +>x : Symbol(x, Decl(controlFlowForStatement.ts, 21, 7)) + } +} +function e() { +>e : Symbol(e, Decl(controlFlowForStatement.ts, 25, 1)) + + let x: string | number | boolean | RegExp; +>x : Symbol(x, Decl(controlFlowForStatement.ts, 27, 7)) +>RegExp : Symbol(RegExp, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) + + for (x = "" || 0; typeof x !== "string"; x = "" || true) { +>x : Symbol(x, Decl(controlFlowForStatement.ts, 27, 7)) +>x : Symbol(x, Decl(controlFlowForStatement.ts, 27, 7)) +>x : Symbol(x, Decl(controlFlowForStatement.ts, 27, 7)) + + x; // number | boolean +>x : Symbol(x, Decl(controlFlowForStatement.ts, 27, 7)) + } +} +function f() { +>f : Symbol(f, Decl(controlFlowForStatement.ts, 31, 1)) + + let x: string | number | boolean; +>x : Symbol(x, Decl(controlFlowForStatement.ts, 33, 7)) + + for (; typeof x !== "string";) { +>x : Symbol(x, Decl(controlFlowForStatement.ts, 33, 7)) + + x; // number | boolean +>x : Symbol(x, Decl(controlFlowForStatement.ts, 33, 7)) + + if (typeof x === "number") break; +>x : Symbol(x, Decl(controlFlowForStatement.ts, 33, 7)) + + x = undefined; +>x : Symbol(x, Decl(controlFlowForStatement.ts, 33, 7)) +>undefined : Symbol(undefined) + } + x; // string | number +>x : Symbol(x, Decl(controlFlowForStatement.ts, 33, 7)) +} + diff --git a/tests/baselines/reference/controlFlowForStatement.types b/tests/baselines/reference/controlFlowForStatement.types new file mode 100644 index 00000000000..cdf049b32d6 --- /dev/null +++ b/tests/baselines/reference/controlFlowForStatement.types @@ -0,0 +1,152 @@ +=== tests/cases/conformance/controlFlow/controlFlowForStatement.ts === +let cond: boolean; +>cond : boolean + +function a() { +>a : () => void + + let x: string | number | boolean; +>x : string | number | boolean + + for (x = ""; cond; x = 5) { +>x = "" : string +>x : string | number | boolean +>"" : string +>cond : boolean +>x = 5 : number +>x : string | number | boolean +>5 : number + + x; // string | number +>x : string | number + } +} +function b() { +>b : () => void + + let x: string | number | boolean; +>x : string | number | boolean + + for (x = 5; cond; x = x.length) { +>x = 5 : number +>x : string | number | boolean +>5 : number +>cond : boolean +>x = x.length : number +>x : string | number | boolean +>x.length : number +>x : string +>length : number + + x; // number +>x : number + + x = ""; +>x = "" : string +>x : string | number | boolean +>"" : string + } +} +function c() { +>c : () => void + + let x: string | number | boolean; +>x : string | number | boolean + + for (x = 5; x = x.toExponential(); x = 5) { +>x = 5 : number +>x : string | number | boolean +>5 : number +>x = x.toExponential() : string +>x : string | number | boolean +>x.toExponential() : string +>x.toExponential : (fractionDigits?: number) => string +>x : number +>toExponential : (fractionDigits?: number) => string +>x = 5 : number +>x : string | number | boolean +>5 : number + + x; // string +>x : string + } +} +function d() { +>d : () => void + + let x: string | number | boolean; +>x : string | number | boolean + + for (x = ""; typeof x === "string"; x = 5) { +>x = "" : string +>x : string | number | boolean +>"" : string +>typeof x === "string" : boolean +>typeof x : string +>x : string | number +>"string" : string +>x = 5 : number +>x : string | number | boolean +>5 : number + + x; // string +>x : string + } +} +function e() { +>e : () => void + + let x: string | number | boolean | RegExp; +>x : string | number | boolean | RegExp +>RegExp : RegExp + + for (x = "" || 0; typeof x !== "string"; x = "" || true) { +>x = "" || 0 : string | number +>x : string | number | boolean | RegExp +>"" || 0 : string | number +>"" : string +>0 : number +>typeof x !== "string" : boolean +>typeof x : string +>x : string | number | boolean +>"string" : string +>x = "" || true : string | boolean +>x : string | number | boolean | RegExp +>"" || true : string | boolean +>"" : string +>true : boolean + + x; // number | boolean +>x : number | boolean + } +} +function f() { +>f : () => void + + let x: string | number | boolean; +>x : string | number | boolean + + for (; typeof x !== "string";) { +>typeof x !== "string" : boolean +>typeof x : string +>x : string | number | boolean +>"string" : string + + x; // number | boolean +>x : number | boolean + + if (typeof x === "number") break; +>typeof x === "number" : boolean +>typeof x : string +>x : number | boolean +>"number" : string + + x = undefined; +>x = undefined : undefined +>x : string | number | boolean +>undefined : undefined + } + x; // string | number +>x : string | number +} + diff --git a/tests/baselines/reference/controlFlowIfStatement.js b/tests/baselines/reference/controlFlowIfStatement.js new file mode 100644 index 00000000000..a70c07d38dc --- /dev/null +++ b/tests/baselines/reference/controlFlowIfStatement.js @@ -0,0 +1,74 @@ +//// [controlFlowIfStatement.ts] +let x: string | number | boolean | RegExp; +let cond: boolean; + +x = /a/; +if (x /* RegExp */, (x = true)) { + x; // boolean + x = ""; +} +else { + x; // boolean + x = 42; +} +x; // string | number + +function a() { + let x: string | number; + if (cond) { + x = 42; + } + else { + x = ""; + return; + } + x; // number +} +function b() { + let x: string | number; + if (cond) { + x = 42; + throw ""; + } + else { + x = ""; + } + x; // string +} + + +//// [controlFlowIfStatement.js] +var x; +var cond; +x = /a/; +if (x /* RegExp */, (x = true)) { + x; // boolean + x = ""; +} +else { + x; // boolean + x = 42; +} +x; // string | number +function a() { + var x; + if (cond) { + x = 42; + } + else { + x = ""; + return; + } + x; // number +} +function b() { + var x; + if (cond) { + x = 42; + throw ""; + } + else { + x = ""; + } + x; // string +} diff --git a/tests/baselines/reference/controlFlowIfStatement.symbols b/tests/baselines/reference/controlFlowIfStatement.symbols new file mode 100644 index 00000000000..1d85b31c998 --- /dev/null +++ b/tests/baselines/reference/controlFlowIfStatement.symbols @@ -0,0 +1,74 @@ +=== tests/cases/conformance/controlFlow/controlFlowIfStatement.ts === +let x: string | number | boolean | RegExp; +>x : Symbol(x, Decl(controlFlowIfStatement.ts, 0, 3)) +>RegExp : Symbol(RegExp, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) + +let cond: boolean; +>cond : Symbol(cond, Decl(controlFlowIfStatement.ts, 1, 3)) + +x = /a/; +>x : Symbol(x, Decl(controlFlowIfStatement.ts, 0, 3)) + +if (x /* RegExp */, (x = true)) { +>x : Symbol(x, Decl(controlFlowIfStatement.ts, 0, 3)) +>x : Symbol(x, Decl(controlFlowIfStatement.ts, 0, 3)) + + x; // boolean +>x : Symbol(x, Decl(controlFlowIfStatement.ts, 0, 3)) + + x = ""; +>x : Symbol(x, Decl(controlFlowIfStatement.ts, 0, 3)) +} +else { + x; // boolean +>x : Symbol(x, Decl(controlFlowIfStatement.ts, 0, 3)) + + x = 42; +>x : Symbol(x, Decl(controlFlowIfStatement.ts, 0, 3)) +} +x; // string | number +>x : Symbol(x, Decl(controlFlowIfStatement.ts, 0, 3)) + +function a() { +>a : Symbol(a, Decl(controlFlowIfStatement.ts, 12, 2)) + + let x: string | number; +>x : Symbol(x, Decl(controlFlowIfStatement.ts, 15, 7)) + + if (cond) { +>cond : Symbol(cond, Decl(controlFlowIfStatement.ts, 1, 3)) + + x = 42; +>x : Symbol(x, Decl(controlFlowIfStatement.ts, 15, 7)) + } + else { + x = ""; +>x : Symbol(x, Decl(controlFlowIfStatement.ts, 15, 7)) + + return; + } + x; // number +>x : Symbol(x, Decl(controlFlowIfStatement.ts, 15, 7)) +} +function b() { +>b : Symbol(b, Decl(controlFlowIfStatement.ts, 24, 1)) + + let x: string | number; +>x : Symbol(x, Decl(controlFlowIfStatement.ts, 26, 7)) + + if (cond) { +>cond : Symbol(cond, Decl(controlFlowIfStatement.ts, 1, 3)) + + x = 42; +>x : Symbol(x, Decl(controlFlowIfStatement.ts, 26, 7)) + + throw ""; + } + else { + x = ""; +>x : Symbol(x, Decl(controlFlowIfStatement.ts, 26, 7)) + } + x; // string +>x : Symbol(x, Decl(controlFlowIfStatement.ts, 26, 7)) +} + diff --git a/tests/baselines/reference/controlFlowIfStatement.types b/tests/baselines/reference/controlFlowIfStatement.types new file mode 100644 index 00000000000..dc07e23275f --- /dev/null +++ b/tests/baselines/reference/controlFlowIfStatement.types @@ -0,0 +1,93 @@ +=== tests/cases/conformance/controlFlow/controlFlowIfStatement.ts === +let x: string | number | boolean | RegExp; +>x : string | number | boolean | RegExp +>RegExp : RegExp + +let cond: boolean; +>cond : boolean + +x = /a/; +>x = /a/ : RegExp +>x : string | number | boolean | RegExp +>/a/ : RegExp + +if (x /* RegExp */, (x = true)) { +>x /* RegExp */, (x = true) : boolean +>x : RegExp +>(x = true) : boolean +>x = true : boolean +>x : string | number | boolean | RegExp +>true : boolean + + x; // boolean +>x : boolean + + x = ""; +>x = "" : string +>x : string | number | boolean | RegExp +>"" : string +} +else { + x; // boolean +>x : boolean + + x = 42; +>x = 42 : number +>x : string | number | boolean | RegExp +>42 : number +} +x; // string | number +>x : string | number + +function a() { +>a : () => void + + let x: string | number; +>x : string | number + + if (cond) { +>cond : boolean + + x = 42; +>x = 42 : number +>x : string | number +>42 : number + } + else { + x = ""; +>x = "" : string +>x : string | number +>"" : string + + return; + } + x; // number +>x : number +} +function b() { +>b : () => void + + let x: string | number; +>x : string | number + + if (cond) { +>cond : boolean + + x = 42; +>x = 42 : number +>x : string | number +>42 : number + + throw ""; +>"" : string + } + else { + x = ""; +>x = "" : string +>x : string | number +>"" : string + } + x; // string +>x : string +} + diff --git a/tests/baselines/reference/controlFlowIteration.js b/tests/baselines/reference/controlFlowIteration.js new file mode 100644 index 00000000000..7b319ba8098 --- /dev/null +++ b/tests/baselines/reference/controlFlowIteration.js @@ -0,0 +1,40 @@ +//// [controlFlowIteration.ts] + +let cond: boolean; + +function ff() { + let x: string | undefined; + while (true) { + if (cond) { + x = ""; + } + else { + if (x) { + x.length; + } + if (x) { + x.length; + } + } + } +} + + +//// [controlFlowIteration.js] +var cond; +function ff() { + var x; + while (true) { + if (cond) { + x = ""; + } + else { + if (x) { + x.length; + } + if (x) { + x.length; + } + } + } +} diff --git a/tests/baselines/reference/controlFlowIteration.symbols b/tests/baselines/reference/controlFlowIteration.symbols new file mode 100644 index 00000000000..84c1c57b69b --- /dev/null +++ b/tests/baselines/reference/controlFlowIteration.symbols @@ -0,0 +1,39 @@ +=== tests/cases/conformance/controlFlow/controlFlowIteration.ts === + +let cond: boolean; +>cond : Symbol(cond, Decl(controlFlowIteration.ts, 1, 3)) + +function ff() { +>ff : Symbol(ff, Decl(controlFlowIteration.ts, 1, 18)) + + let x: string | undefined; +>x : Symbol(x, Decl(controlFlowIteration.ts, 4, 7)) + + while (true) { + if (cond) { +>cond : Symbol(cond, Decl(controlFlowIteration.ts, 1, 3)) + + x = ""; +>x : Symbol(x, Decl(controlFlowIteration.ts, 4, 7)) + } + else { + if (x) { +>x : Symbol(x, Decl(controlFlowIteration.ts, 4, 7)) + + x.length; +>x.length : Symbol(String.length, Decl(lib.d.ts, --, --)) +>x : Symbol(x, Decl(controlFlowIteration.ts, 4, 7)) +>length : Symbol(String.length, Decl(lib.d.ts, --, --)) + } + if (x) { +>x : Symbol(x, Decl(controlFlowIteration.ts, 4, 7)) + + x.length; +>x.length : Symbol(String.length, Decl(lib.d.ts, --, --)) +>x : Symbol(x, Decl(controlFlowIteration.ts, 4, 7)) +>length : Symbol(String.length, Decl(lib.d.ts, --, --)) + } + } + } +} + diff --git a/tests/baselines/reference/controlFlowIteration.types b/tests/baselines/reference/controlFlowIteration.types new file mode 100644 index 00000000000..cefb250e01d --- /dev/null +++ b/tests/baselines/reference/controlFlowIteration.types @@ -0,0 +1,43 @@ +=== tests/cases/conformance/controlFlow/controlFlowIteration.ts === + +let cond: boolean; +>cond : boolean + +function ff() { +>ff : () => never + + let x: string | undefined; +>x : string | undefined + + while (true) { +>true : boolean + + if (cond) { +>cond : boolean + + x = ""; +>x = "" : string +>x : string | undefined +>"" : string + } + else { + if (x) { +>x : string | undefined + + x.length; +>x.length : number +>x : string +>length : number + } + if (x) { +>x : string | undefined + + x.length; +>x.length : number +>x : string +>length : number + } + } + } +} + diff --git a/tests/baselines/reference/controlFlowIterationErrors.errors.txt b/tests/baselines/reference/controlFlowIterationErrors.errors.txt new file mode 100644 index 00000000000..737a9e9557b --- /dev/null +++ b/tests/baselines/reference/controlFlowIterationErrors.errors.txt @@ -0,0 +1,132 @@ +tests/cases/conformance/controlFlow/controlFlowIterationErrors.ts(12,17): error TS2345: Argument of type 'string | number' is not assignable to parameter of type 'string'. + Type 'number' is not assignable to type 'string'. +tests/cases/conformance/controlFlow/controlFlowIterationErrors.ts(23,17): error TS2345: Argument of type 'string | number' is not assignable to parameter of type 'string'. + Type 'number' is not assignable to type 'string'. +tests/cases/conformance/controlFlow/controlFlowIterationErrors.ts(35,17): error TS2345: Argument of type 'string | number' is not assignable to parameter of type 'number'. + Type 'string' is not assignable to type 'number'. +tests/cases/conformance/controlFlow/controlFlowIterationErrors.ts(46,17): error TS2345: Argument of type 'string | number' is not assignable to parameter of type 'number'. + Type 'string' is not assignable to type 'number'. +tests/cases/conformance/controlFlow/controlFlowIterationErrors.ts(77,13): error TS7022: 'y' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer. +tests/cases/conformance/controlFlow/controlFlowIterationErrors.ts(77,26): error TS2345: Argument of type 'string | number | boolean' is not assignable to parameter of type 'string | number'. + Type 'boolean' is not assignable to type 'string | number'. +tests/cases/conformance/controlFlow/controlFlowIterationErrors.ts(88,13): error TS7022: 'y' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer. +tests/cases/conformance/controlFlow/controlFlowIterationErrors.ts(88,26): error TS2345: Argument of type 'string | number | boolean' is not assignable to parameter of type 'string | number'. + Type 'boolean' is not assignable to type 'string | number'. + + +==== tests/cases/conformance/controlFlow/controlFlowIterationErrors.ts (8 errors) ==== + + let cond: boolean; + + function len(s: string) { + return s.length; + } + + function f1() { + let x: string | number | boolean; + x = ""; + while (cond) { + x = len(x); + ~ +!!! error TS2345: Argument of type 'string | number' is not assignable to parameter of type 'string'. +!!! error TS2345: Type 'number' is not assignable to type 'string'. + x; + } + x; + } + + function f2() { + let x: string | number | boolean; + x = ""; + while (cond) { + x; + x = len(x); + ~ +!!! error TS2345: Argument of type 'string | number' is not assignable to parameter of type 'string'. +!!! error TS2345: Type 'number' is not assignable to type 'string'. + } + x; + } + + declare function foo(x: string): number; + declare function foo(x: number): string; + + function g1() { + let x: string | number | boolean; + x = ""; + while (cond) { + x = foo(x); + ~ +!!! error TS2345: Argument of type 'string | number' is not assignable to parameter of type 'number'. +!!! error TS2345: Type 'string' is not assignable to type 'number'. + x; + } + x; + } + + function g2() { + let x: string | number | boolean; + x = ""; + while (cond) { + x; + x = foo(x); + ~ +!!! error TS2345: Argument of type 'string | number' is not assignable to parameter of type 'number'. +!!! error TS2345: Type 'string' is not assignable to type 'number'. + } + x; + } + + function asNumber(x: string | number): number { + return +x; + } + + function h1() { + let x: string | number | boolean; + x = "0"; + while (cond) { + x = +x + 1; + x; + } + } + + function h2() { + let x: string | number | boolean; + x = "0"; + while (cond) { + x = asNumber(x) + 1; + x; + } + } + + function h3() { + let x: string | number | boolean; + x = "0"; + while (cond) { + let y = asNumber(x); + ~ +!!! error TS7022: 'y' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer. + ~ +!!! error TS2345: Argument of type 'string | number | boolean' is not assignable to parameter of type 'string | number'. +!!! error TS2345: Type 'boolean' is not assignable to type 'string | number'. + x = y + 1; + x; + } + } + + function h4() { + let x: string | number | boolean; + x = "0"; + while (cond) { + x; + let y = asNumber(x); + ~ +!!! error TS7022: 'y' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer. + ~ +!!! error TS2345: Argument of type 'string | number | boolean' is not assignable to parameter of type 'string | number'. +!!! error TS2345: Type 'boolean' is not assignable to type 'string | number'. + x = y + 1; + x; + } + } + \ No newline at end of file diff --git a/tests/baselines/reference/controlFlowIterationErrors.js b/tests/baselines/reference/controlFlowIterationErrors.js new file mode 100644 index 00000000000..eed54cc53a7 --- /dev/null +++ b/tests/baselines/reference/controlFlowIterationErrors.js @@ -0,0 +1,174 @@ +//// [controlFlowIterationErrors.ts] + +let cond: boolean; + +function len(s: string) { + return s.length; +} + +function f1() { + let x: string | number | boolean; + x = ""; + while (cond) { + x = len(x); + x; + } + x; +} + +function f2() { + let x: string | number | boolean; + x = ""; + while (cond) { + x; + x = len(x); + } + x; +} + +declare function foo(x: string): number; +declare function foo(x: number): string; + +function g1() { + let x: string | number | boolean; + x = ""; + while (cond) { + x = foo(x); + x; + } + x; +} + +function g2() { + let x: string | number | boolean; + x = ""; + while (cond) { + x; + x = foo(x); + } + x; +} + +function asNumber(x: string | number): number { + return +x; +} + +function h1() { + let x: string | number | boolean; + x = "0"; + while (cond) { + x = +x + 1; + x; + } +} + +function h2() { + let x: string | number | boolean; + x = "0"; + while (cond) { + x = asNumber(x) + 1; + x; + } +} + +function h3() { + let x: string | number | boolean; + x = "0"; + while (cond) { + let y = asNumber(x); + x = y + 1; + x; + } +} + +function h4() { + let x: string | number | boolean; + x = "0"; + while (cond) { + x; + let y = asNumber(x); + x = y + 1; + x; + } +} + + +//// [controlFlowIterationErrors.js] +var cond; +function len(s) { + return s.length; +} +function f1() { + var x; + x = ""; + while (cond) { + x = len(x); + x; + } + x; +} +function f2() { + var x; + x = ""; + while (cond) { + x; + x = len(x); + } + x; +} +function g1() { + var x; + x = ""; + while (cond) { + x = foo(x); + x; + } + x; +} +function g2() { + var x; + x = ""; + while (cond) { + x; + x = foo(x); + } + x; +} +function asNumber(x) { + return +x; +} +function h1() { + var x; + x = "0"; + while (cond) { + x = +x + 1; + x; + } +} +function h2() { + var x; + x = "0"; + while (cond) { + x = asNumber(x) + 1; + x; + } +} +function h3() { + var x; + x = "0"; + while (cond) { + var y = asNumber(x); + x = y + 1; + x; + } +} +function h4() { + var x; + x = "0"; + while (cond) { + x; + var y = asNumber(x); + x = y + 1; + x; + } +} diff --git a/tests/baselines/reference/controlFlowLoopAnalysis.errors.txt b/tests/baselines/reference/controlFlowLoopAnalysis.errors.txt new file mode 100644 index 00000000000..0d08f93a8a8 --- /dev/null +++ b/tests/baselines/reference/controlFlowLoopAnalysis.errors.txt @@ -0,0 +1,58 @@ +tests/cases/compiler/controlFlowLoopAnalysis.ts(13,25): error TS2345: Argument of type 'number | undefined' is not assignable to parameter of type 'number'. + Type 'undefined' is not assignable to type 'number'. + + +==== tests/cases/compiler/controlFlowLoopAnalysis.ts (1 errors) ==== + + // Repro from #8418 + + let cond: boolean; + + function foo(x: number): number { return 1; } + + function test1() { + let x: number | undefined; + while (cond) { + while (cond) { + while (cond) { + x = foo(x); + ~ +!!! error TS2345: Argument of type 'number | undefined' is not assignable to parameter of type 'number'. +!!! error TS2345: Type 'undefined' is not assignable to type 'number'. + } + } + x = 1; + } + } + + // Repro from #8418 + + function test2() { + let x: number | undefined; + x = 1; + while (cond) { + while (cond) { + x = foo(x); + } + } + } + + // Repro from #8511 + + function mapUntilCant( + values: a[], + canTake: (value: a, index: number) => boolean, + mapping: (value: a, index: number) => b + ): b[] { + let result: b[] = []; + for (let index = 0, length = values.length; index < length; index++) { + let value = values[index]; + if (canTake(value, index)) { + result.push(mapping(value, index)); + } else { + return result; + } + } + return result; + } + \ No newline at end of file diff --git a/tests/baselines/reference/controlFlowLoopAnalysis.js b/tests/baselines/reference/controlFlowLoopAnalysis.js new file mode 100644 index 00000000000..77384ddedcf --- /dev/null +++ b/tests/baselines/reference/controlFlowLoopAnalysis.js @@ -0,0 +1,91 @@ +//// [controlFlowLoopAnalysis.ts] + +// Repro from #8418 + +let cond: boolean; + +function foo(x: number): number { return 1; } + +function test1() { + let x: number | undefined; + while (cond) { + while (cond) { + while (cond) { + x = foo(x); + } + } + x = 1; + } +} + +// Repro from #8418 + +function test2() { + let x: number | undefined; + x = 1; + while (cond) { + while (cond) { + x = foo(x); + } + } +} + +// Repro from #8511 + +function mapUntilCant( + values: a[], + canTake: (value: a, index: number) => boolean, + mapping: (value: a, index: number) => b +): b[] { + let result: b[] = []; + for (let index = 0, length = values.length; index < length; index++) { + let value = values[index]; + if (canTake(value, index)) { + result.push(mapping(value, index)); + } else { + return result; + } + } + return result; +} + + +//// [controlFlowLoopAnalysis.js] +// Repro from #8418 +var cond; +function foo(x) { return 1; } +function test1() { + var x; + while (cond) { + while (cond) { + while (cond) { + x = foo(x); + } + } + x = 1; + } +} +// Repro from #8418 +function test2() { + var x; + x = 1; + while (cond) { + while (cond) { + x = foo(x); + } + } +} +// Repro from #8511 +function mapUntilCant(values, canTake, mapping) { + var result = []; + for (var index = 0, length = values.length; index < length; index++) { + var value = values[index]; + if (canTake(value, index)) { + result.push(mapping(value, index)); + } + else { + return result; + } + } + return result; +} diff --git a/tests/baselines/reference/controlFlowTruthiness.js b/tests/baselines/reference/controlFlowTruthiness.js new file mode 100644 index 00000000000..b595bcbd180 --- /dev/null +++ b/tests/baselines/reference/controlFlowTruthiness.js @@ -0,0 +1,134 @@ +//// [controlFlowTruthiness.ts] + +declare function foo(): string | undefined; + +function f1() { + let x = foo(); + if (x) { + x; // string + } + else { + x; // string | undefined + } +} + +function f2() { + let x: string | undefined; + x = foo(); + if (x) { + x; // string + } + else { + x; // string | undefined + } +} + +function f3() { + let x: string | undefined; + if (x = foo()) { + x; // string + } + else { + x; // string | undefined + } +} + +function f4() { + let x: string | undefined; + if (!(x = foo())) { + x; // string | undefined + } + else { + x; // string + } +} + +function f5() { + let x: string | undefined; + let y: string | undefined; + if (x = y = foo()) { + x; // string + y; // string | undefined + } + else { + x; // string | undefined + y; // string | undefined + } +} + +function f6() { + let x: string | undefined; + let y: string | undefined; + if (x = foo(), y = foo()) { + x; // string | undefined + y; // string + } + else { + x; // string | undefined + y; // string | undefined + } +} + + +//// [controlFlowTruthiness.js] +function f1() { + var x = foo(); + if (x) { + x; // string + } + else { + x; // string | undefined + } +} +function f2() { + var x; + x = foo(); + if (x) { + x; // string + } + else { + x; // string | undefined + } +} +function f3() { + var x; + if (x = foo()) { + x; // string + } + else { + x; // string | undefined + } +} +function f4() { + var x; + if (!(x = foo())) { + x; // string | undefined + } + else { + x; // string + } +} +function f5() { + var x; + var y; + if (x = y = foo()) { + x; // string + y; // string | undefined + } + else { + x; // string | undefined + y; // string | undefined + } +} +function f6() { + var x; + var y; + if (x = foo(), y = foo()) { + x; // string | undefined + y; // string + } + else { + x; // string | undefined + y; // string | undefined + } +} diff --git a/tests/baselines/reference/controlFlowTruthiness.symbols b/tests/baselines/reference/controlFlowTruthiness.symbols new file mode 100644 index 00000000000..37c1fb135f2 --- /dev/null +++ b/tests/baselines/reference/controlFlowTruthiness.symbols @@ -0,0 +1,143 @@ +=== tests/cases/conformance/controlFlow/controlFlowTruthiness.ts === + +declare function foo(): string | undefined; +>foo : Symbol(foo, Decl(controlFlowTruthiness.ts, 0, 0)) + +function f1() { +>f1 : Symbol(f1, Decl(controlFlowTruthiness.ts, 1, 43)) + + let x = foo(); +>x : Symbol(x, Decl(controlFlowTruthiness.ts, 4, 7)) +>foo : Symbol(foo, Decl(controlFlowTruthiness.ts, 0, 0)) + + if (x) { +>x : Symbol(x, Decl(controlFlowTruthiness.ts, 4, 7)) + + x; // string +>x : Symbol(x, Decl(controlFlowTruthiness.ts, 4, 7)) + } + else { + x; // string | undefined +>x : Symbol(x, Decl(controlFlowTruthiness.ts, 4, 7)) + } +} + +function f2() { +>f2 : Symbol(f2, Decl(controlFlowTruthiness.ts, 11, 1)) + + let x: string | undefined; +>x : Symbol(x, Decl(controlFlowTruthiness.ts, 14, 7)) + + x = foo(); +>x : Symbol(x, Decl(controlFlowTruthiness.ts, 14, 7)) +>foo : Symbol(foo, Decl(controlFlowTruthiness.ts, 0, 0)) + + if (x) { +>x : Symbol(x, Decl(controlFlowTruthiness.ts, 14, 7)) + + x; // string +>x : Symbol(x, Decl(controlFlowTruthiness.ts, 14, 7)) + } + else { + x; // string | undefined +>x : Symbol(x, Decl(controlFlowTruthiness.ts, 14, 7)) + } +} + +function f3() { +>f3 : Symbol(f3, Decl(controlFlowTruthiness.ts, 22, 1)) + + let x: string | undefined; +>x : Symbol(x, Decl(controlFlowTruthiness.ts, 25, 7)) + + if (x = foo()) { +>x : Symbol(x, Decl(controlFlowTruthiness.ts, 25, 7)) +>foo : Symbol(foo, Decl(controlFlowTruthiness.ts, 0, 0)) + + x; // string +>x : Symbol(x, Decl(controlFlowTruthiness.ts, 25, 7)) + } + else { + x; // string | undefined +>x : Symbol(x, Decl(controlFlowTruthiness.ts, 25, 7)) + } +} + +function f4() { +>f4 : Symbol(f4, Decl(controlFlowTruthiness.ts, 32, 1)) + + let x: string | undefined; +>x : Symbol(x, Decl(controlFlowTruthiness.ts, 35, 7)) + + if (!(x = foo())) { +>x : Symbol(x, Decl(controlFlowTruthiness.ts, 35, 7)) +>foo : Symbol(foo, Decl(controlFlowTruthiness.ts, 0, 0)) + + x; // string | undefined +>x : Symbol(x, Decl(controlFlowTruthiness.ts, 35, 7)) + } + else { + x; // string +>x : Symbol(x, Decl(controlFlowTruthiness.ts, 35, 7)) + } +} + +function f5() { +>f5 : Symbol(f5, Decl(controlFlowTruthiness.ts, 42, 1)) + + let x: string | undefined; +>x : Symbol(x, Decl(controlFlowTruthiness.ts, 45, 7)) + + let y: string | undefined; +>y : Symbol(y, Decl(controlFlowTruthiness.ts, 46, 7)) + + if (x = y = foo()) { +>x : Symbol(x, Decl(controlFlowTruthiness.ts, 45, 7)) +>y : Symbol(y, Decl(controlFlowTruthiness.ts, 46, 7)) +>foo : Symbol(foo, Decl(controlFlowTruthiness.ts, 0, 0)) + + x; // string +>x : Symbol(x, Decl(controlFlowTruthiness.ts, 45, 7)) + + y; // string | undefined +>y : Symbol(y, Decl(controlFlowTruthiness.ts, 46, 7)) + } + else { + x; // string | undefined +>x : Symbol(x, Decl(controlFlowTruthiness.ts, 45, 7)) + + y; // string | undefined +>y : Symbol(y, Decl(controlFlowTruthiness.ts, 46, 7)) + } +} + +function f6() { +>f6 : Symbol(f6, Decl(controlFlowTruthiness.ts, 55, 1)) + + let x: string | undefined; +>x : Symbol(x, Decl(controlFlowTruthiness.ts, 58, 7)) + + let y: string | undefined; +>y : Symbol(y, Decl(controlFlowTruthiness.ts, 59, 7)) + + if (x = foo(), y = foo()) { +>x : Symbol(x, Decl(controlFlowTruthiness.ts, 58, 7)) +>foo : Symbol(foo, Decl(controlFlowTruthiness.ts, 0, 0)) +>y : Symbol(y, Decl(controlFlowTruthiness.ts, 59, 7)) +>foo : Symbol(foo, Decl(controlFlowTruthiness.ts, 0, 0)) + + x; // string | undefined +>x : Symbol(x, Decl(controlFlowTruthiness.ts, 58, 7)) + + y; // string +>y : Symbol(y, Decl(controlFlowTruthiness.ts, 59, 7)) + } + else { + x; // string | undefined +>x : Symbol(x, Decl(controlFlowTruthiness.ts, 58, 7)) + + y; // string | undefined +>y : Symbol(y, Decl(controlFlowTruthiness.ts, 59, 7)) + } +} + diff --git a/tests/baselines/reference/controlFlowTruthiness.types b/tests/baselines/reference/controlFlowTruthiness.types new file mode 100644 index 00000000000..2d35856fe83 --- /dev/null +++ b/tests/baselines/reference/controlFlowTruthiness.types @@ -0,0 +1,160 @@ +=== tests/cases/conformance/controlFlow/controlFlowTruthiness.ts === + +declare function foo(): string | undefined; +>foo : () => string | undefined + +function f1() { +>f1 : () => void + + let x = foo(); +>x : string | undefined +>foo() : string | undefined +>foo : () => string | undefined + + if (x) { +>x : string | undefined + + x; // string +>x : string + } + else { + x; // string | undefined +>x : string | undefined + } +} + +function f2() { +>f2 : () => void + + let x: string | undefined; +>x : string | undefined + + x = foo(); +>x = foo() : string | undefined +>x : string | undefined +>foo() : string | undefined +>foo : () => string | undefined + + if (x) { +>x : string | undefined + + x; // string +>x : string + } + else { + x; // string | undefined +>x : string | undefined + } +} + +function f3() { +>f3 : () => void + + let x: string | undefined; +>x : string | undefined + + if (x = foo()) { +>x = foo() : string | undefined +>x : string | undefined +>foo() : string | undefined +>foo : () => string | undefined + + x; // string +>x : string + } + else { + x; // string | undefined +>x : string | undefined + } +} + +function f4() { +>f4 : () => void + + let x: string | undefined; +>x : string | undefined + + if (!(x = foo())) { +>!(x = foo()) : boolean +>(x = foo()) : string | undefined +>x = foo() : string | undefined +>x : string | undefined +>foo() : string | undefined +>foo : () => string | undefined + + x; // string | undefined +>x : string | undefined + } + else { + x; // string +>x : string + } +} + +function f5() { +>f5 : () => void + + let x: string | undefined; +>x : string | undefined + + let y: string | undefined; +>y : string | undefined + + if (x = y = foo()) { +>x = y = foo() : string | undefined +>x : string | undefined +>y = foo() : string | undefined +>y : string | undefined +>foo() : string | undefined +>foo : () => string | undefined + + x; // string +>x : string + + y; // string | undefined +>y : string | undefined + } + else { + x; // string | undefined +>x : string | undefined + + y; // string | undefined +>y : string | undefined + } +} + +function f6() { +>f6 : () => void + + let x: string | undefined; +>x : string | undefined + + let y: string | undefined; +>y : string | undefined + + if (x = foo(), y = foo()) { +>x = foo(), y = foo() : string | undefined +>x = foo() : string | undefined +>x : string | undefined +>foo() : string | undefined +>foo : () => string | undefined +>y = foo() : string | undefined +>y : string | undefined +>foo() : string | undefined +>foo : () => string | undefined + + x; // string | undefined +>x : string | undefined + + y; // string +>y : string + } + else { + x; // string | undefined +>x : string | undefined + + y; // string | undefined +>y : string | undefined + } +} + diff --git a/tests/baselines/reference/controlFlowWhileStatement.js b/tests/baselines/reference/controlFlowWhileStatement.js new file mode 100644 index 00000000000..d9faf9bd0ea --- /dev/null +++ b/tests/baselines/reference/controlFlowWhileStatement.js @@ -0,0 +1,216 @@ +//// [controlFlowWhileStatement.ts] +let cond: boolean; +function a() { + let x: string | number; + x = ""; + while (cond) { + x; // string + } +} +function b() { + let x: string | number; + x = ""; + while (cond) { + x; // string + x = 42; + break; + } +} +function c() { + let x: string | number; + x = ""; + while (cond) { + x; // string + x = undefined; + if (typeof x === "string") continue; + break; + } +} +function d() { + let x: string | number; + x = ""; + while (x = x.length) { + x; // number + x = ""; + } +} +function e() { + let x: string | number; + x = ""; + while (cond) { + x; // string | number + x = 42; + x; // number + } + x; // string | number +} +function f() { + let x: string | number | boolean | RegExp | Function; + x = ""; + while (cond) { + if (cond) { + x = 42; + break; + } + if (cond) { + x = true; + continue; + } + x = /a/; + } + x; // string | number | boolean | RegExp +} +function g() { + let x: string | number | boolean | RegExp | Function; + x = ""; + while (true) { + if (cond) { + x = 42; + break; + } + if (cond) { + x = true; + continue; + } + x = /a/; + } + x; // number +} +function h1() { + let x: string | number | boolean; + x = ""; + while (x > 1) { + x; // string | number + x = 1; + x; // number + } + x; // string | number +} +declare function len(s: string | number): number; +function h2() { + let x: string | number | boolean; + x = ""; + while (cond) { + x = len(x); + x; // number + } + x; // string | number +} +function h3() { + let x: string | number | boolean; + x = ""; + while (cond) { + x; // string | number + x = len(x); + } + x; // string | number +} + + +//// [controlFlowWhileStatement.js] +var cond; +function a() { + var x; + x = ""; + while (cond) { + x; // string + } +} +function b() { + var x; + x = ""; + while (cond) { + x; // string + x = 42; + break; + } +} +function c() { + var x; + x = ""; + while (cond) { + x; // string + x = undefined; + if (typeof x === "string") + continue; + break; + } +} +function d() { + var x; + x = ""; + while (x = x.length) { + x; // number + x = ""; + } +} +function e() { + var x; + x = ""; + while (cond) { + x; // string | number + x = 42; + x; // number + } + x; // string | number +} +function f() { + var x; + x = ""; + while (cond) { + if (cond) { + x = 42; + break; + } + if (cond) { + x = true; + continue; + } + x = /a/; + } + x; // string | number | boolean | RegExp +} +function g() { + var x; + x = ""; + while (true) { + if (cond) { + x = 42; + break; + } + if (cond) { + x = true; + continue; + } + x = /a/; + } + x; // number +} +function h1() { + var x; + x = ""; + while (x > 1) { + x; // string | number + x = 1; + x; // number + } + x; // string | number +} +function h2() { + var x; + x = ""; + while (cond) { + x = len(x); + x; // number + } + x; // string | number +} +function h3() { + var x; + x = ""; + while (cond) { + x; // string | number + x = len(x); + } + x; // string | number +} diff --git a/tests/baselines/reference/controlFlowWhileStatement.symbols b/tests/baselines/reference/controlFlowWhileStatement.symbols new file mode 100644 index 00000000000..3b4def93b45 --- /dev/null +++ b/tests/baselines/reference/controlFlowWhileStatement.symbols @@ -0,0 +1,257 @@ +=== tests/cases/conformance/controlFlow/controlFlowWhileStatement.ts === +let cond: boolean; +>cond : Symbol(cond, Decl(controlFlowWhileStatement.ts, 0, 3)) + +function a() { +>a : Symbol(a, Decl(controlFlowWhileStatement.ts, 0, 18)) + + let x: string | number; +>x : Symbol(x, Decl(controlFlowWhileStatement.ts, 2, 7)) + + x = ""; +>x : Symbol(x, Decl(controlFlowWhileStatement.ts, 2, 7)) + + while (cond) { +>cond : Symbol(cond, Decl(controlFlowWhileStatement.ts, 0, 3)) + + x; // string +>x : Symbol(x, Decl(controlFlowWhileStatement.ts, 2, 7)) + } +} +function b() { +>b : Symbol(b, Decl(controlFlowWhileStatement.ts, 7, 1)) + + let x: string | number; +>x : Symbol(x, Decl(controlFlowWhileStatement.ts, 9, 7)) + + x = ""; +>x : Symbol(x, Decl(controlFlowWhileStatement.ts, 9, 7)) + + while (cond) { +>cond : Symbol(cond, Decl(controlFlowWhileStatement.ts, 0, 3)) + + x; // string +>x : Symbol(x, Decl(controlFlowWhileStatement.ts, 9, 7)) + + x = 42; +>x : Symbol(x, Decl(controlFlowWhileStatement.ts, 9, 7)) + + break; + } +} +function c() { +>c : Symbol(c, Decl(controlFlowWhileStatement.ts, 16, 1)) + + let x: string | number; +>x : Symbol(x, Decl(controlFlowWhileStatement.ts, 18, 7)) + + x = ""; +>x : Symbol(x, Decl(controlFlowWhileStatement.ts, 18, 7)) + + while (cond) { +>cond : Symbol(cond, Decl(controlFlowWhileStatement.ts, 0, 3)) + + x; // string +>x : Symbol(x, Decl(controlFlowWhileStatement.ts, 18, 7)) + + x = undefined; +>x : Symbol(x, Decl(controlFlowWhileStatement.ts, 18, 7)) +>undefined : Symbol(undefined) + + if (typeof x === "string") continue; +>x : Symbol(x, Decl(controlFlowWhileStatement.ts, 18, 7)) + + break; + } +} +function d() { +>d : Symbol(d, Decl(controlFlowWhileStatement.ts, 26, 1)) + + let x: string | number; +>x : Symbol(x, Decl(controlFlowWhileStatement.ts, 28, 7)) + + x = ""; +>x : Symbol(x, Decl(controlFlowWhileStatement.ts, 28, 7)) + + while (x = x.length) { +>x : Symbol(x, Decl(controlFlowWhileStatement.ts, 28, 7)) +>x.length : Symbol(String.length, Decl(lib.d.ts, --, --)) +>x : Symbol(x, Decl(controlFlowWhileStatement.ts, 28, 7)) +>length : Symbol(String.length, Decl(lib.d.ts, --, --)) + + x; // number +>x : Symbol(x, Decl(controlFlowWhileStatement.ts, 28, 7)) + + x = ""; +>x : Symbol(x, Decl(controlFlowWhileStatement.ts, 28, 7)) + } +} +function e() { +>e : Symbol(e, Decl(controlFlowWhileStatement.ts, 34, 1)) + + let x: string | number; +>x : Symbol(x, Decl(controlFlowWhileStatement.ts, 36, 7)) + + x = ""; +>x : Symbol(x, Decl(controlFlowWhileStatement.ts, 36, 7)) + + while (cond) { +>cond : Symbol(cond, Decl(controlFlowWhileStatement.ts, 0, 3)) + + x; // string | number +>x : Symbol(x, Decl(controlFlowWhileStatement.ts, 36, 7)) + + x = 42; +>x : Symbol(x, Decl(controlFlowWhileStatement.ts, 36, 7)) + + x; // number +>x : Symbol(x, Decl(controlFlowWhileStatement.ts, 36, 7)) + } + x; // string | number +>x : Symbol(x, Decl(controlFlowWhileStatement.ts, 36, 7)) +} +function f() { +>f : Symbol(f, Decl(controlFlowWhileStatement.ts, 44, 1)) + + let x: string | number | boolean | RegExp | Function; +>x : Symbol(x, Decl(controlFlowWhileStatement.ts, 46, 7)) +>RegExp : Symbol(RegExp, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) + + x = ""; +>x : Symbol(x, Decl(controlFlowWhileStatement.ts, 46, 7)) + + while (cond) { +>cond : Symbol(cond, Decl(controlFlowWhileStatement.ts, 0, 3)) + + if (cond) { +>cond : Symbol(cond, Decl(controlFlowWhileStatement.ts, 0, 3)) + + x = 42; +>x : Symbol(x, Decl(controlFlowWhileStatement.ts, 46, 7)) + + break; + } + if (cond) { +>cond : Symbol(cond, Decl(controlFlowWhileStatement.ts, 0, 3)) + + x = true; +>x : Symbol(x, Decl(controlFlowWhileStatement.ts, 46, 7)) + + continue; + } + x = /a/; +>x : Symbol(x, Decl(controlFlowWhileStatement.ts, 46, 7)) + } + x; // string | number | boolean | RegExp +>x : Symbol(x, Decl(controlFlowWhileStatement.ts, 46, 7)) +} +function g() { +>g : Symbol(g, Decl(controlFlowWhileStatement.ts, 60, 1)) + + let x: string | number | boolean | RegExp | Function; +>x : Symbol(x, Decl(controlFlowWhileStatement.ts, 62, 7)) +>RegExp : Symbol(RegExp, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) + + x = ""; +>x : Symbol(x, Decl(controlFlowWhileStatement.ts, 62, 7)) + + while (true) { + if (cond) { +>cond : Symbol(cond, Decl(controlFlowWhileStatement.ts, 0, 3)) + + x = 42; +>x : Symbol(x, Decl(controlFlowWhileStatement.ts, 62, 7)) + + break; + } + if (cond) { +>cond : Symbol(cond, Decl(controlFlowWhileStatement.ts, 0, 3)) + + x = true; +>x : Symbol(x, Decl(controlFlowWhileStatement.ts, 62, 7)) + + continue; + } + x = /a/; +>x : Symbol(x, Decl(controlFlowWhileStatement.ts, 62, 7)) + } + x; // number +>x : Symbol(x, Decl(controlFlowWhileStatement.ts, 62, 7)) +} +function h1() { +>h1 : Symbol(h1, Decl(controlFlowWhileStatement.ts, 76, 1)) + + let x: string | number | boolean; +>x : Symbol(x, Decl(controlFlowWhileStatement.ts, 78, 7)) + + x = ""; +>x : Symbol(x, Decl(controlFlowWhileStatement.ts, 78, 7)) + + while (x > 1) { +>x : Symbol(x, Decl(controlFlowWhileStatement.ts, 78, 7)) + + x; // string | number +>x : Symbol(x, Decl(controlFlowWhileStatement.ts, 78, 7)) + + x = 1; +>x : Symbol(x, Decl(controlFlowWhileStatement.ts, 78, 7)) + + x; // number +>x : Symbol(x, Decl(controlFlowWhileStatement.ts, 78, 7)) + } + x; // string | number +>x : Symbol(x, Decl(controlFlowWhileStatement.ts, 78, 7)) +} +declare function len(s: string | number): number; +>len : Symbol(len, Decl(controlFlowWhileStatement.ts, 86, 1)) +>s : Symbol(s, Decl(controlFlowWhileStatement.ts, 87, 21)) + +function h2() { +>h2 : Symbol(h2, Decl(controlFlowWhileStatement.ts, 87, 49)) + + let x: string | number | boolean; +>x : Symbol(x, Decl(controlFlowWhileStatement.ts, 89, 7)) + + x = ""; +>x : Symbol(x, Decl(controlFlowWhileStatement.ts, 89, 7)) + + while (cond) { +>cond : Symbol(cond, Decl(controlFlowWhileStatement.ts, 0, 3)) + + x = len(x); +>x : Symbol(x, Decl(controlFlowWhileStatement.ts, 89, 7)) +>len : Symbol(len, Decl(controlFlowWhileStatement.ts, 86, 1)) +>x : Symbol(x, Decl(controlFlowWhileStatement.ts, 89, 7)) + + x; // number +>x : Symbol(x, Decl(controlFlowWhileStatement.ts, 89, 7)) + } + x; // string | number +>x : Symbol(x, Decl(controlFlowWhileStatement.ts, 89, 7)) +} +function h3() { +>h3 : Symbol(h3, Decl(controlFlowWhileStatement.ts, 96, 1)) + + let x: string | number | boolean; +>x : Symbol(x, Decl(controlFlowWhileStatement.ts, 98, 7)) + + x = ""; +>x : Symbol(x, Decl(controlFlowWhileStatement.ts, 98, 7)) + + while (cond) { +>cond : Symbol(cond, Decl(controlFlowWhileStatement.ts, 0, 3)) + + x; // string | number +>x : Symbol(x, Decl(controlFlowWhileStatement.ts, 98, 7)) + + x = len(x); +>x : Symbol(x, Decl(controlFlowWhileStatement.ts, 98, 7)) +>len : Symbol(len, Decl(controlFlowWhileStatement.ts, 86, 1)) +>x : Symbol(x, Decl(controlFlowWhileStatement.ts, 98, 7)) + } + x; // string | number +>x : Symbol(x, Decl(controlFlowWhileStatement.ts, 98, 7)) +} + diff --git a/tests/baselines/reference/controlFlowWhileStatement.types b/tests/baselines/reference/controlFlowWhileStatement.types new file mode 100644 index 00000000000..a17c084228b --- /dev/null +++ b/tests/baselines/reference/controlFlowWhileStatement.types @@ -0,0 +1,310 @@ +=== tests/cases/conformance/controlFlow/controlFlowWhileStatement.ts === +let cond: boolean; +>cond : boolean + +function a() { +>a : () => void + + let x: string | number; +>x : string | number + + x = ""; +>x = "" : string +>x : string | number +>"" : string + + while (cond) { +>cond : boolean + + x; // string +>x : string + } +} +function b() { +>b : () => void + + let x: string | number; +>x : string | number + + x = ""; +>x = "" : string +>x : string | number +>"" : string + + while (cond) { +>cond : boolean + + x; // string +>x : string + + x = 42; +>x = 42 : number +>x : string | number +>42 : number + + break; + } +} +function c() { +>c : () => void + + let x: string | number; +>x : string | number + + x = ""; +>x = "" : string +>x : string | number +>"" : string + + while (cond) { +>cond : boolean + + x; // string +>x : string + + x = undefined; +>x = undefined : undefined +>x : string | number +>undefined : undefined + + if (typeof x === "string") continue; +>typeof x === "string" : boolean +>typeof x : string +>x : string | number +>"string" : string + + break; + } +} +function d() { +>d : () => void + + let x: string | number; +>x : string | number + + x = ""; +>x = "" : string +>x : string | number +>"" : string + + while (x = x.length) { +>x = x.length : number +>x : string | number +>x.length : number +>x : string +>length : number + + x; // number +>x : number + + x = ""; +>x = "" : string +>x : string | number +>"" : string + } +} +function e() { +>e : () => void + + let x: string | number; +>x : string | number + + x = ""; +>x = "" : string +>x : string | number +>"" : string + + while (cond) { +>cond : boolean + + x; // string | number +>x : string | number + + x = 42; +>x = 42 : number +>x : string | number +>42 : number + + x; // number +>x : number + } + x; // string | number +>x : string | number +} +function f() { +>f : () => void + + let x: string | number | boolean | RegExp | Function; +>x : string | number | boolean | RegExp | Function +>RegExp : RegExp +>Function : Function + + x = ""; +>x = "" : string +>x : string | number | boolean | RegExp | Function +>"" : string + + while (cond) { +>cond : boolean + + if (cond) { +>cond : boolean + + x = 42; +>x = 42 : number +>x : string | number | boolean | RegExp | Function +>42 : number + + break; + } + if (cond) { +>cond : boolean + + x = true; +>x = true : boolean +>x : string | number | boolean | RegExp | Function +>true : boolean + + continue; + } + x = /a/; +>x = /a/ : RegExp +>x : string | number | boolean | RegExp | Function +>/a/ : RegExp + } + x; // string | number | boolean | RegExp +>x : string | boolean | RegExp | number +} +function g() { +>g : () => void + + let x: string | number | boolean | RegExp | Function; +>x : string | number | boolean | RegExp | Function +>RegExp : RegExp +>Function : Function + + x = ""; +>x = "" : string +>x : string | number | boolean | RegExp | Function +>"" : string + + while (true) { +>true : boolean + + if (cond) { +>cond : boolean + + x = 42; +>x = 42 : number +>x : string | number | boolean | RegExp | Function +>42 : number + + break; + } + if (cond) { +>cond : boolean + + x = true; +>x = true : boolean +>x : string | number | boolean | RegExp | Function +>true : boolean + + continue; + } + x = /a/; +>x = /a/ : RegExp +>x : string | number | boolean | RegExp | Function +>/a/ : RegExp + } + x; // number +>x : number +} +function h1() { +>h1 : () => void + + let x: string | number | boolean; +>x : string | number | boolean + + x = ""; +>x = "" : string +>x : string | number | boolean +>"" : string + + while (x > 1) { +>x > 1 : boolean +>x : string | number +>1 : number + + x; // string | number +>x : string | number + + x = 1; +>x = 1 : number +>x : string | number | boolean +>1 : number + + x; // number +>x : number + } + x; // string | number +>x : string | number +} +declare function len(s: string | number): number; +>len : (s: string | number) => number +>s : string | number + +function h2() { +>h2 : () => void + + let x: string | number | boolean; +>x : string | number | boolean + + x = ""; +>x = "" : string +>x : string | number | boolean +>"" : string + + while (cond) { +>cond : boolean + + x = len(x); +>x = len(x) : number +>x : string | number | boolean +>len(x) : number +>len : (s: string | number) => number +>x : string | number + + x; // number +>x : number + } + x; // string | number +>x : string | number +} +function h3() { +>h3 : () => void + + let x: string | number | boolean; +>x : string | number | boolean + + x = ""; +>x = "" : string +>x : string | number | boolean +>"" : string + + while (cond) { +>cond : boolean + + x; // string | number +>x : string | number + + x = len(x); +>x = len(x) : number +>x : string | number | boolean +>len(x) : number +>len : (s: string | number) => number +>x : string | number + } + x; // string | number +>x : string | number +} + diff --git a/tests/baselines/reference/covariance1.symbols b/tests/baselines/reference/covariance1.symbols index db055e20bc6..8a9b39e0124 100644 --- a/tests/baselines/reference/covariance1.symbols +++ b/tests/baselines/reference/covariance1.symbols @@ -4,16 +4,16 @@ module M { interface X { m1:number; } >X : Symbol(X, Decl(covariance1.ts, 0, 10)) ->m1 : Symbol(m1, Decl(covariance1.ts, 2, 17)) +>m1 : Symbol(X.m1, Decl(covariance1.ts, 2, 17)) export class XX implements X { constructor(public m1:number) { } } >XX : Symbol(XX, Decl(covariance1.ts, 2, 30)) >X : Symbol(X, Decl(covariance1.ts, 0, 10)) ->m1 : Symbol(m1, Decl(covariance1.ts, 3, 47)) +>m1 : Symbol(XX.m1, Decl(covariance1.ts, 3, 47)) interface Y { x:X; } >Y : Symbol(Y, Decl(covariance1.ts, 3, 70)) ->x : Symbol(x, Decl(covariance1.ts, 5, 17)) +>x : Symbol(Y.x, Decl(covariance1.ts, 5, 17)) >X : Symbol(X, Decl(covariance1.ts, 0, 10)) export function f(y:Y) { } diff --git a/tests/baselines/reference/crashInResolveInterface.symbols b/tests/baselines/reference/crashInResolveInterface.symbols index c10bf0b26a8..52faf374c6c 100644 --- a/tests/baselines/reference/crashInResolveInterface.symbols +++ b/tests/baselines/reference/crashInResolveInterface.symbols @@ -8,14 +8,14 @@ interface C { >C : Symbol(C, Decl(file2.ts, 1, 17), Decl(file2.ts, 4, 1)) count(countTitle?: string): void; ->count : Symbol(count, Decl(file2.ts, 2, 13)) +>count : Symbol(C.count, Decl(file2.ts, 2, 13)) >countTitle : Symbol(countTitle, Decl(file2.ts, 3, 10)) } interface C { >C : Symbol(C, Decl(file2.ts, 1, 17), Decl(file2.ts, 4, 1)) log(message?: any, ...optionalParams: any[]): void; ->log : Symbol(log, Decl(file2.ts, 5, 13)) +>log : Symbol(C.log, Decl(file2.ts, 5, 13)) >message : Symbol(message, Decl(file2.ts, 6, 8)) >optionalParams : Symbol(optionalParams, Decl(file2.ts, 6, 22)) } @@ -26,7 +26,7 @@ interface Q { >T : Symbol(T, Decl(file1.ts, 0, 12)) each(action: (item: T, index: number) => void): void; ->each : Symbol(each, Decl(file1.ts, 0, 16)) +>each : Symbol(Q.each, Decl(file1.ts, 0, 16)) >action : Symbol(action, Decl(file1.ts, 1, 9)) >item : Symbol(item, Decl(file1.ts, 1, 18)) >T : Symbol(T, Decl(file1.ts, 0, 12)) diff --git a/tests/baselines/reference/crashInresolveReturnStatement.symbols b/tests/baselines/reference/crashInresolveReturnStatement.symbols index 359a62c7842..7df76ff49c2 100644 --- a/tests/baselines/reference/crashInresolveReturnStatement.symbols +++ b/tests/baselines/reference/crashInresolveReturnStatement.symbols @@ -3,7 +3,7 @@ class WorkItemToolbar { >WorkItemToolbar : Symbol(WorkItemToolbar, Decl(crashInresolveReturnStatement.ts, 0, 0)) public onToolbarItemClick() { ->onToolbarItemClick : Symbol(onToolbarItemClick, Decl(crashInresolveReturnStatement.ts, 0, 23)) +>onToolbarItemClick : Symbol(WorkItemToolbar.onToolbarItemClick, Decl(crashInresolveReturnStatement.ts, 0, 23)) WITDialogs.createCopyOfWorkItem(); >WITDialogs.createCopyOfWorkItem : Symbol(WITDialogs.createCopyOfWorkItem, Decl(crashInresolveReturnStatement.ts, 12, 18)) @@ -15,7 +15,7 @@ class CreateCopyOfWorkItemDialog { >CreateCopyOfWorkItemDialog : Symbol(CreateCopyOfWorkItemDialog, Decl(crashInresolveReturnStatement.ts, 4, 1)) public getDialogResult() { ->getDialogResult : Symbol(getDialogResult, Decl(crashInresolveReturnStatement.ts, 5, 34)) +>getDialogResult : Symbol(CreateCopyOfWorkItemDialog.getDialogResult, Decl(crashInresolveReturnStatement.ts, 5, 34)) return null; } diff --git a/tests/baselines/reference/crashInsourcePropertyIsRelatableToTargetProperty.errors.txt b/tests/baselines/reference/crashInsourcePropertyIsRelatableToTargetProperty.errors.txt index 450d180e884..2938f7bf18d 100644 --- a/tests/baselines/reference/crashInsourcePropertyIsRelatableToTargetProperty.errors.txt +++ b/tests/baselines/reference/crashInsourcePropertyIsRelatableToTargetProperty.errors.txt @@ -1,16 +1,13 @@ -tests/cases/compiler/crashInsourcePropertyIsRelatableToTargetProperty.ts(5,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. tests/cases/compiler/crashInsourcePropertyIsRelatableToTargetProperty.ts(9,5): error TS2322: Type '(x: "hi", items: string[]) => typeof foo' is not assignable to type 'D'. Property 'x' is missing in type '(x: "hi", items: string[]) => typeof foo'. -==== tests/cases/compiler/crashInsourcePropertyIsRelatableToTargetProperty.ts (2 errors) ==== +==== tests/cases/compiler/crashInsourcePropertyIsRelatableToTargetProperty.ts (1 errors) ==== class C { private x = 1; } class D extends C { } function foo(x: "hi", items: string[]): typeof foo; - ~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. function foo(x: string, items: string[]): typeof foo { return null; } diff --git a/tests/baselines/reference/cyclicModuleImport.symbols b/tests/baselines/reference/cyclicModuleImport.symbols index 86337812aad..14bdf2d47d3 100644 --- a/tests/baselines/reference/cyclicModuleImport.symbols +++ b/tests/baselines/reference/cyclicModuleImport.symbols @@ -10,10 +10,10 @@ declare module "SubModule" { >StaticVar : Symbol(SubModule.StaticVar, Decl(cyclicModuleImport.ts, 2, 21)) public InstanceVar: number; ->InstanceVar : Symbol(InstanceVar, Decl(cyclicModuleImport.ts, 3, 40)) +>InstanceVar : Symbol(SubModule.InstanceVar, Decl(cyclicModuleImport.ts, 3, 40)) public main: MainModule; ->main : Symbol(main, Decl(cyclicModuleImport.ts, 4, 35)) +>main : Symbol(SubModule.main, Decl(cyclicModuleImport.ts, 4, 35)) >MainModule : Symbol(MainModule, Decl(cyclicModuleImport.ts, 0, 28)) constructor(); @@ -29,7 +29,7 @@ declare module "MainModule" { >MainModule : Symbol(MainModule, Decl(cyclicModuleImport.ts, 11, 44)) public SubModule: SubModule; ->SubModule : Symbol(SubModule, Decl(cyclicModuleImport.ts, 12, 22)) +>SubModule : Symbol(MainModule.SubModule, Decl(cyclicModuleImport.ts, 12, 22)) >SubModule : Symbol(SubModule, Decl(cyclicModuleImport.ts, 10, 29)) constructor(); diff --git a/tests/baselines/reference/declFileAccessors.js b/tests/baselines/reference/declFileAccessors.js index e3616c79e38..2bd51bfbfb2 100644 --- a/tests/baselines/reference/declFileAccessors.js +++ b/tests/baselines/reference/declFileAccessors.js @@ -284,7 +284,7 @@ export declare class c1 { nc_p3: number; private nc_pp3; static nc_s3: string; - onlyGetter: number; + readonly onlyGetter: number; onlySetter: number; } //// [declFileAccessors_1.d.ts] @@ -302,6 +302,6 @@ declare class c2 { nc_p3: number; private nc_pp3; static nc_s3: string; - onlyGetter: number; + readonly onlyGetter: number; onlySetter: number; } diff --git a/tests/baselines/reference/declFileAccessors.symbols b/tests/baselines/reference/declFileAccessors.symbols index 7275dd8c191..3de90051ec4 100644 --- a/tests/baselines/reference/declFileAccessors.symbols +++ b/tests/baselines/reference/declFileAccessors.symbols @@ -6,24 +6,24 @@ export class c1 { /** getter property*/ public get p3() { ->p3 : Symbol(p3, Decl(declFileAccessors_0.ts, 2, 17), Decl(declFileAccessors_0.ts, 6, 5)) +>p3 : Symbol(c1.p3, Decl(declFileAccessors_0.ts, 2, 17), Decl(declFileAccessors_0.ts, 6, 5)) return 10; } /** setter property*/ public set p3(/** this is value*/value: number) { ->p3 : Symbol(p3, Decl(declFileAccessors_0.ts, 2, 17), Decl(declFileAccessors_0.ts, 6, 5)) +>p3 : Symbol(c1.p3, Decl(declFileAccessors_0.ts, 2, 17), Decl(declFileAccessors_0.ts, 6, 5)) >value : Symbol(value, Decl(declFileAccessors_0.ts, 8, 18)) } /** private getter property*/ private get pp3() { ->pp3 : Symbol(pp3, Decl(declFileAccessors_0.ts, 9, 5), Decl(declFileAccessors_0.ts, 13, 5)) +>pp3 : Symbol(c1.pp3, Decl(declFileAccessors_0.ts, 9, 5), Decl(declFileAccessors_0.ts, 13, 5)) return 10; } /** private setter property*/ private set pp3(/** this is value*/value: number) { ->pp3 : Symbol(pp3, Decl(declFileAccessors_0.ts, 9, 5), Decl(declFileAccessors_0.ts, 13, 5)) +>pp3 : Symbol(c1.pp3, Decl(declFileAccessors_0.ts, 9, 5), Decl(declFileAccessors_0.ts, 13, 5)) >value : Symbol(value, Decl(declFileAccessors_0.ts, 15, 20)) } /** static getter property*/ @@ -38,21 +38,21 @@ export class c1 { >value : Symbol(value, Decl(declFileAccessors_0.ts, 22, 18)) } public get nc_p3() { ->nc_p3 : Symbol(nc_p3, Decl(declFileAccessors_0.ts, 23, 5), Decl(declFileAccessors_0.ts, 26, 5)) +>nc_p3 : Symbol(c1.nc_p3, Decl(declFileAccessors_0.ts, 23, 5), Decl(declFileAccessors_0.ts, 26, 5)) return 10; } public set nc_p3(value: number) { ->nc_p3 : Symbol(nc_p3, Decl(declFileAccessors_0.ts, 23, 5), Decl(declFileAccessors_0.ts, 26, 5)) +>nc_p3 : Symbol(c1.nc_p3, Decl(declFileAccessors_0.ts, 23, 5), Decl(declFileAccessors_0.ts, 26, 5)) >value : Symbol(value, Decl(declFileAccessors_0.ts, 27, 21)) } private get nc_pp3() { ->nc_pp3 : Symbol(nc_pp3, Decl(declFileAccessors_0.ts, 28, 5), Decl(declFileAccessors_0.ts, 31, 5)) +>nc_pp3 : Symbol(c1.nc_pp3, Decl(declFileAccessors_0.ts, 28, 5), Decl(declFileAccessors_0.ts, 31, 5)) return 10; } private set nc_pp3(value: number) { ->nc_pp3 : Symbol(nc_pp3, Decl(declFileAccessors_0.ts, 28, 5), Decl(declFileAccessors_0.ts, 31, 5)) +>nc_pp3 : Symbol(c1.nc_pp3, Decl(declFileAccessors_0.ts, 28, 5), Decl(declFileAccessors_0.ts, 31, 5)) >value : Symbol(value, Decl(declFileAccessors_0.ts, 32, 23)) } static get nc_s3() { @@ -67,14 +67,14 @@ export class c1 { // Only getter property public get onlyGetter() { ->onlyGetter : Symbol(onlyGetter, Decl(declFileAccessors_0.ts, 38, 5)) +>onlyGetter : Symbol(c1.onlyGetter, Decl(declFileAccessors_0.ts, 38, 5)) return 10; } // Only setter property public set onlySetter(value: number) { ->onlySetter : Symbol(onlySetter, Decl(declFileAccessors_0.ts, 43, 5)) +>onlySetter : Symbol(c1.onlySetter, Decl(declFileAccessors_0.ts, 43, 5)) >value : Symbol(value, Decl(declFileAccessors_0.ts, 46, 26)) } } @@ -86,24 +86,24 @@ class c2 { /** getter property*/ public get p3() { ->p3 : Symbol(p3, Decl(declFileAccessors_1.ts, 1, 10), Decl(declFileAccessors_1.ts, 5, 5)) +>p3 : Symbol(c2.p3, Decl(declFileAccessors_1.ts, 1, 10), Decl(declFileAccessors_1.ts, 5, 5)) return 10; } /** setter property*/ public set p3(/** this is value*/value: number) { ->p3 : Symbol(p3, Decl(declFileAccessors_1.ts, 1, 10), Decl(declFileAccessors_1.ts, 5, 5)) +>p3 : Symbol(c2.p3, Decl(declFileAccessors_1.ts, 1, 10), Decl(declFileAccessors_1.ts, 5, 5)) >value : Symbol(value, Decl(declFileAccessors_1.ts, 7, 18)) } /** private getter property*/ private get pp3() { ->pp3 : Symbol(pp3, Decl(declFileAccessors_1.ts, 8, 5), Decl(declFileAccessors_1.ts, 12, 5)) +>pp3 : Symbol(c2.pp3, Decl(declFileAccessors_1.ts, 8, 5), Decl(declFileAccessors_1.ts, 12, 5)) return 10; } /** private setter property*/ private set pp3(/** this is value*/value: number) { ->pp3 : Symbol(pp3, Decl(declFileAccessors_1.ts, 8, 5), Decl(declFileAccessors_1.ts, 12, 5)) +>pp3 : Symbol(c2.pp3, Decl(declFileAccessors_1.ts, 8, 5), Decl(declFileAccessors_1.ts, 12, 5)) >value : Symbol(value, Decl(declFileAccessors_1.ts, 14, 20)) } /** static getter property*/ @@ -118,21 +118,21 @@ class c2 { >value : Symbol(value, Decl(declFileAccessors_1.ts, 21, 18)) } public get nc_p3() { ->nc_p3 : Symbol(nc_p3, Decl(declFileAccessors_1.ts, 22, 5), Decl(declFileAccessors_1.ts, 25, 5)) +>nc_p3 : Symbol(c2.nc_p3, Decl(declFileAccessors_1.ts, 22, 5), Decl(declFileAccessors_1.ts, 25, 5)) return 10; } public set nc_p3(value: number) { ->nc_p3 : Symbol(nc_p3, Decl(declFileAccessors_1.ts, 22, 5), Decl(declFileAccessors_1.ts, 25, 5)) +>nc_p3 : Symbol(c2.nc_p3, Decl(declFileAccessors_1.ts, 22, 5), Decl(declFileAccessors_1.ts, 25, 5)) >value : Symbol(value, Decl(declFileAccessors_1.ts, 26, 21)) } private get nc_pp3() { ->nc_pp3 : Symbol(nc_pp3, Decl(declFileAccessors_1.ts, 27, 5), Decl(declFileAccessors_1.ts, 30, 5)) +>nc_pp3 : Symbol(c2.nc_pp3, Decl(declFileAccessors_1.ts, 27, 5), Decl(declFileAccessors_1.ts, 30, 5)) return 10; } private set nc_pp3(value: number) { ->nc_pp3 : Symbol(nc_pp3, Decl(declFileAccessors_1.ts, 27, 5), Decl(declFileAccessors_1.ts, 30, 5)) +>nc_pp3 : Symbol(c2.nc_pp3, Decl(declFileAccessors_1.ts, 27, 5), Decl(declFileAccessors_1.ts, 30, 5)) >value : Symbol(value, Decl(declFileAccessors_1.ts, 31, 23)) } static get nc_s3() { @@ -147,14 +147,14 @@ class c2 { // Only getter property public get onlyGetter() { ->onlyGetter : Symbol(onlyGetter, Decl(declFileAccessors_1.ts, 37, 5)) +>onlyGetter : Symbol(c2.onlyGetter, Decl(declFileAccessors_1.ts, 37, 5)) return 10; } // Only setter property public set onlySetter(value: number) { ->onlySetter : Symbol(onlySetter, Decl(declFileAccessors_1.ts, 42, 5)) +>onlySetter : Symbol(c2.onlySetter, Decl(declFileAccessors_1.ts, 42, 5)) >value : Symbol(value, Decl(declFileAccessors_1.ts, 45, 26)) } } diff --git a/tests/baselines/reference/declFileConstructors.js b/tests/baselines/reference/declFileConstructors.js index 44e816712fb..8e92b1a36ae 100644 --- a/tests/baselines/reference/declFileConstructors.js +++ b/tests/baselines/reference/declFileConstructors.js @@ -247,7 +247,7 @@ export declare class ConstructorWithPrivateParameterProperty { constructor(x: string); } export declare class ConstructorWithOptionalParameterProperty { - x: string; + x?: string; constructor(x?: string); } export declare class ConstructorWithParameterInitializer { @@ -281,7 +281,7 @@ declare class GlobalConstructorWithPrivateParameterProperty { constructor(x: string); } declare class GlobalConstructorWithOptionalParameterProperty { - x: string; + x?: string; constructor(x?: string); } declare class GlobalConstructorWithParameterInitializer { diff --git a/tests/baselines/reference/declFileConstructors.symbols b/tests/baselines/reference/declFileConstructors.symbols index 1190c889dbf..ad86b6a721f 100644 --- a/tests/baselines/reference/declFileConstructors.symbols +++ b/tests/baselines/reference/declFileConstructors.symbols @@ -57,7 +57,7 @@ export class ConstructorWithPublicParameterProperty { >ConstructorWithPublicParameterProperty : Symbol(ConstructorWithPublicParameterProperty, Decl(declFileConstructors_0.ts, 26, 1)) constructor(public x: string) { ->x : Symbol(x, Decl(declFileConstructors_0.ts, 29, 16)) +>x : Symbol(ConstructorWithPublicParameterProperty.x, Decl(declFileConstructors_0.ts, 29, 16)) } } @@ -65,7 +65,7 @@ export class ConstructorWithPrivateParameterProperty { >ConstructorWithPrivateParameterProperty : Symbol(ConstructorWithPrivateParameterProperty, Decl(declFileConstructors_0.ts, 31, 1)) constructor(private x: string) { ->x : Symbol(x, Decl(declFileConstructors_0.ts, 34, 16)) +>x : Symbol(ConstructorWithPrivateParameterProperty.x, Decl(declFileConstructors_0.ts, 34, 16)) } } @@ -73,7 +73,7 @@ export class ConstructorWithOptionalParameterProperty { >ConstructorWithOptionalParameterProperty : Symbol(ConstructorWithOptionalParameterProperty, Decl(declFileConstructors_0.ts, 36, 1)) constructor(public x?: string) { ->x : Symbol(x, Decl(declFileConstructors_0.ts, 39, 16)) +>x : Symbol(ConstructorWithOptionalParameterProperty.x, Decl(declFileConstructors_0.ts, 39, 16)) } } @@ -81,7 +81,7 @@ export class ConstructorWithParameterInitializer { >ConstructorWithParameterInitializer : Symbol(ConstructorWithParameterInitializer, Decl(declFileConstructors_0.ts, 41, 1)) constructor(public x = "hello") { ->x : Symbol(x, Decl(declFileConstructors_0.ts, 44, 16)) +>x : Symbol(ConstructorWithParameterInitializer.x, Decl(declFileConstructors_0.ts, 44, 16)) } } @@ -143,7 +143,7 @@ class GlobalConstructorWithPublicParameterProperty { >GlobalConstructorWithPublicParameterProperty : Symbol(GlobalConstructorWithPublicParameterProperty, Decl(declFileConstructors_1.ts, 25, 1)) constructor(public x: string) { ->x : Symbol(x, Decl(declFileConstructors_1.ts, 28, 16)) +>x : Symbol(GlobalConstructorWithPublicParameterProperty.x, Decl(declFileConstructors_1.ts, 28, 16)) } } @@ -151,7 +151,7 @@ class GlobalConstructorWithPrivateParameterProperty { >GlobalConstructorWithPrivateParameterProperty : Symbol(GlobalConstructorWithPrivateParameterProperty, Decl(declFileConstructors_1.ts, 30, 1)) constructor(private x: string) { ->x : Symbol(x, Decl(declFileConstructors_1.ts, 33, 16)) +>x : Symbol(GlobalConstructorWithPrivateParameterProperty.x, Decl(declFileConstructors_1.ts, 33, 16)) } } @@ -159,7 +159,7 @@ class GlobalConstructorWithOptionalParameterProperty { >GlobalConstructorWithOptionalParameterProperty : Symbol(GlobalConstructorWithOptionalParameterProperty, Decl(declFileConstructors_1.ts, 35, 1)) constructor(public x?: string) { ->x : Symbol(x, Decl(declFileConstructors_1.ts, 38, 16)) +>x : Symbol(GlobalConstructorWithOptionalParameterProperty.x, Decl(declFileConstructors_1.ts, 38, 16)) } } @@ -167,6 +167,6 @@ class GlobalConstructorWithParameterInitializer { >GlobalConstructorWithParameterInitializer : Symbol(GlobalConstructorWithParameterInitializer, Decl(declFileConstructors_1.ts, 40, 1)) constructor(public x = "hello") { ->x : Symbol(x, Decl(declFileConstructors_1.ts, 43, 16)) +>x : Symbol(GlobalConstructorWithParameterInitializer.x, Decl(declFileConstructors_1.ts, 43, 16)) } } diff --git a/tests/baselines/reference/declFileExportAssignmentImportInternalModule.symbols b/tests/baselines/reference/declFileExportAssignmentImportInternalModule.symbols index 5953d446478..dc5382cbef6 100644 --- a/tests/baselines/reference/declFileExportAssignmentImportInternalModule.symbols +++ b/tests/baselines/reference/declFileExportAssignmentImportInternalModule.symbols @@ -17,13 +17,13 @@ module m3 { >connectExport : Symbol(connectExport, Decl(declFileExportAssignmentImportInternalModule.ts, 4, 9)) use: (mod: connectModule) => connectExport; ->use : Symbol(use, Decl(declFileExportAssignmentImportInternalModule.ts, 5, 40)) +>use : Symbol(connectExport.use, Decl(declFileExportAssignmentImportInternalModule.ts, 5, 40)) >mod : Symbol(mod, Decl(declFileExportAssignmentImportInternalModule.ts, 6, 18)) >connectModule : Symbol(connectModule, Decl(declFileExportAssignmentImportInternalModule.ts, 1, 22)) >connectExport : Symbol(connectExport, Decl(declFileExportAssignmentImportInternalModule.ts, 4, 9)) listen: (port: number) => void; ->listen : Symbol(listen, Decl(declFileExportAssignmentImportInternalModule.ts, 6, 55)) +>listen : Symbol(connectExport.listen, Decl(declFileExportAssignmentImportInternalModule.ts, 6, 55)) >port : Symbol(port, Decl(declFileExportAssignmentImportInternalModule.ts, 7, 21)) } diff --git a/tests/baselines/reference/declFileExportAssignmentOfGenericInterface.symbols b/tests/baselines/reference/declFileExportAssignmentOfGenericInterface.symbols index d8801ff3fe3..34b1cbff341 100644 --- a/tests/baselines/reference/declFileExportAssignmentOfGenericInterface.symbols +++ b/tests/baselines/reference/declFileExportAssignmentOfGenericInterface.symbols @@ -19,7 +19,7 @@ interface Foo { >T : Symbol(T, Decl(declFileExportAssignmentOfGenericInterface_0.ts, 1, 14)) a: string; ->a : Symbol(a, Decl(declFileExportAssignmentOfGenericInterface_0.ts, 1, 18)) +>a : Symbol(Foo.a, Decl(declFileExportAssignmentOfGenericInterface_0.ts, 1, 18)) } export = Foo; >Foo : Symbol(Foo, Decl(declFileExportAssignmentOfGenericInterface_0.ts, 0, 0)) diff --git a/tests/baselines/reference/declFileForClassWithMultipleBaseClasses.symbols b/tests/baselines/reference/declFileForClassWithMultipleBaseClasses.symbols index e20542996b2..92c82d6ed41 100644 --- a/tests/baselines/reference/declFileForClassWithMultipleBaseClasses.symbols +++ b/tests/baselines/reference/declFileForClassWithMultipleBaseClasses.symbols @@ -4,28 +4,28 @@ class A { >A : Symbol(A, Decl(declFileForClassWithMultipleBaseClasses.ts, 0, 0)) foo() { } ->foo : Symbol(foo, Decl(declFileForClassWithMultipleBaseClasses.ts, 1, 9)) +>foo : Symbol(A.foo, Decl(declFileForClassWithMultipleBaseClasses.ts, 1, 9)) } class B { >B : Symbol(B, Decl(declFileForClassWithMultipleBaseClasses.ts, 3, 1)) bar() { } ->bar : Symbol(bar, Decl(declFileForClassWithMultipleBaseClasses.ts, 5, 9)) +>bar : Symbol(B.bar, Decl(declFileForClassWithMultipleBaseClasses.ts, 5, 9)) } interface I { >I : Symbol(I, Decl(declFileForClassWithMultipleBaseClasses.ts, 7, 1), Decl(declFileForClassWithMultipleBaseClasses.ts, 23, 1)) baz(); ->baz : Symbol(baz, Decl(declFileForClassWithMultipleBaseClasses.ts, 9, 13)) +>baz : Symbol(I.baz, Decl(declFileForClassWithMultipleBaseClasses.ts, 9, 13)) } interface J { >J : Symbol(J, Decl(declFileForClassWithMultipleBaseClasses.ts, 11, 1)) bat(); ->bat : Symbol(bat, Decl(declFileForClassWithMultipleBaseClasses.ts, 13, 13)) +>bat : Symbol(J.bat, Decl(declFileForClassWithMultipleBaseClasses.ts, 13, 13)) } @@ -35,16 +35,16 @@ class D implements I, J { >J : Symbol(J, Decl(declFileForClassWithMultipleBaseClasses.ts, 11, 1)) baz() { } ->baz : Symbol(baz, Decl(declFileForClassWithMultipleBaseClasses.ts, 18, 25)) +>baz : Symbol(D.baz, Decl(declFileForClassWithMultipleBaseClasses.ts, 18, 25)) bat() { } ->bat : Symbol(bat, Decl(declFileForClassWithMultipleBaseClasses.ts, 19, 13)) +>bat : Symbol(D.bat, Decl(declFileForClassWithMultipleBaseClasses.ts, 19, 13)) foo() { } ->foo : Symbol(foo, Decl(declFileForClassWithMultipleBaseClasses.ts, 20, 13)) +>foo : Symbol(D.foo, Decl(declFileForClassWithMultipleBaseClasses.ts, 20, 13)) bar() { } ->bar : Symbol(bar, Decl(declFileForClassWithMultipleBaseClasses.ts, 21, 13)) +>bar : Symbol(D.bar, Decl(declFileForClassWithMultipleBaseClasses.ts, 21, 13)) } interface I extends A, B { diff --git a/tests/baselines/reference/declFileForClassWithPrivateOverloadedFunction.symbols b/tests/baselines/reference/declFileForClassWithPrivateOverloadedFunction.symbols index f28a8c2bfc7..69bf3db2cb3 100644 --- a/tests/baselines/reference/declFileForClassWithPrivateOverloadedFunction.symbols +++ b/tests/baselines/reference/declFileForClassWithPrivateOverloadedFunction.symbols @@ -4,14 +4,14 @@ class C { >C : Symbol(C, Decl(declFileForClassWithPrivateOverloadedFunction.ts, 0, 0)) private foo(x: number); ->foo : Symbol(foo, Decl(declFileForClassWithPrivateOverloadedFunction.ts, 1, 9), Decl(declFileForClassWithPrivateOverloadedFunction.ts, 2, 27), Decl(declFileForClassWithPrivateOverloadedFunction.ts, 3, 27)) +>foo : Symbol(C.foo, Decl(declFileForClassWithPrivateOverloadedFunction.ts, 1, 9), Decl(declFileForClassWithPrivateOverloadedFunction.ts, 2, 27), Decl(declFileForClassWithPrivateOverloadedFunction.ts, 3, 27)) >x : Symbol(x, Decl(declFileForClassWithPrivateOverloadedFunction.ts, 2, 16)) private foo(x: string); ->foo : Symbol(foo, Decl(declFileForClassWithPrivateOverloadedFunction.ts, 1, 9), Decl(declFileForClassWithPrivateOverloadedFunction.ts, 2, 27), Decl(declFileForClassWithPrivateOverloadedFunction.ts, 3, 27)) +>foo : Symbol(C.foo, Decl(declFileForClassWithPrivateOverloadedFunction.ts, 1, 9), Decl(declFileForClassWithPrivateOverloadedFunction.ts, 2, 27), Decl(declFileForClassWithPrivateOverloadedFunction.ts, 3, 27)) >x : Symbol(x, Decl(declFileForClassWithPrivateOverloadedFunction.ts, 3, 16)) private foo(x: any) { } ->foo : Symbol(foo, Decl(declFileForClassWithPrivateOverloadedFunction.ts, 1, 9), Decl(declFileForClassWithPrivateOverloadedFunction.ts, 2, 27), Decl(declFileForClassWithPrivateOverloadedFunction.ts, 3, 27)) +>foo : Symbol(C.foo, Decl(declFileForClassWithPrivateOverloadedFunction.ts, 1, 9), Decl(declFileForClassWithPrivateOverloadedFunction.ts, 2, 27), Decl(declFileForClassWithPrivateOverloadedFunction.ts, 3, 27)) >x : Symbol(x, Decl(declFileForClassWithPrivateOverloadedFunction.ts, 4, 16)) } diff --git a/tests/baselines/reference/declFileForInterfaceWithOptionalFunction.symbols b/tests/baselines/reference/declFileForInterfaceWithOptionalFunction.symbols index bcec395c80d..a6a3e272c94 100644 --- a/tests/baselines/reference/declFileForInterfaceWithOptionalFunction.symbols +++ b/tests/baselines/reference/declFileForInterfaceWithOptionalFunction.symbols @@ -4,10 +4,10 @@ interface I { >I : Symbol(I, Decl(declFileForInterfaceWithOptionalFunction.ts, 0, 0)) foo? (x?); ->foo : Symbol(foo, Decl(declFileForInterfaceWithOptionalFunction.ts, 1, 13)) +>foo : Symbol(I.foo, Decl(declFileForInterfaceWithOptionalFunction.ts, 1, 13)) >x : Symbol(x, Decl(declFileForInterfaceWithOptionalFunction.ts, 2, 10)) foo2? (x?: number): number; ->foo2 : Symbol(foo2, Decl(declFileForInterfaceWithOptionalFunction.ts, 2, 14)) +>foo2 : Symbol(I.foo2, Decl(declFileForInterfaceWithOptionalFunction.ts, 2, 14)) >x : Symbol(x, Decl(declFileForInterfaceWithOptionalFunction.ts, 3, 11)) } diff --git a/tests/baselines/reference/declFileForInterfaceWithRestParams.symbols b/tests/baselines/reference/declFileForInterfaceWithRestParams.symbols index 9a0fb4a71da..bccb096eb6c 100644 --- a/tests/baselines/reference/declFileForInterfaceWithRestParams.symbols +++ b/tests/baselines/reference/declFileForInterfaceWithRestParams.symbols @@ -4,18 +4,18 @@ interface I { >I : Symbol(I, Decl(declFileForInterfaceWithRestParams.ts, 0, 0)) foo(...x): typeof x; ->foo : Symbol(foo, Decl(declFileForInterfaceWithRestParams.ts, 1, 13)) +>foo : Symbol(I.foo, Decl(declFileForInterfaceWithRestParams.ts, 1, 13)) >x : Symbol(x, Decl(declFileForInterfaceWithRestParams.ts, 2, 8)) >x : Symbol(x, Decl(declFileForInterfaceWithRestParams.ts, 2, 8)) foo2(a: number, ...x): typeof x; ->foo2 : Symbol(foo2, Decl(declFileForInterfaceWithRestParams.ts, 2, 24)) +>foo2 : Symbol(I.foo2, Decl(declFileForInterfaceWithRestParams.ts, 2, 24)) >a : Symbol(a, Decl(declFileForInterfaceWithRestParams.ts, 3, 9)) >x : Symbol(x, Decl(declFileForInterfaceWithRestParams.ts, 3, 19)) >x : Symbol(x, Decl(declFileForInterfaceWithRestParams.ts, 3, 19)) foo3(b: string, ...x: string[]): typeof x; ->foo3 : Symbol(foo3, Decl(declFileForInterfaceWithRestParams.ts, 3, 36)) +>foo3 : Symbol(I.foo3, Decl(declFileForInterfaceWithRestParams.ts, 3, 36)) >b : Symbol(b, Decl(declFileForInterfaceWithRestParams.ts, 4, 9)) >x : Symbol(x, Decl(declFileForInterfaceWithRestParams.ts, 4, 19)) >x : Symbol(x, Decl(declFileForInterfaceWithRestParams.ts, 4, 19)) diff --git a/tests/baselines/reference/declFileForTypeParameters.symbols b/tests/baselines/reference/declFileForTypeParameters.symbols index 41c567d89df..8838c3cdd05 100644 --- a/tests/baselines/reference/declFileForTypeParameters.symbols +++ b/tests/baselines/reference/declFileForTypeParameters.symbols @@ -5,18 +5,18 @@ class C { >T : Symbol(T, Decl(declFileForTypeParameters.ts, 1, 8)) x: T; ->x : Symbol(x, Decl(declFileForTypeParameters.ts, 1, 12)) +>x : Symbol(C.x, Decl(declFileForTypeParameters.ts, 1, 12)) >T : Symbol(T, Decl(declFileForTypeParameters.ts, 1, 8)) foo(a: T): T { ->foo : Symbol(foo, Decl(declFileForTypeParameters.ts, 2, 9)) +>foo : Symbol(C.foo, Decl(declFileForTypeParameters.ts, 2, 9)) >a : Symbol(a, Decl(declFileForTypeParameters.ts, 3, 8)) >T : Symbol(T, Decl(declFileForTypeParameters.ts, 1, 8)) >T : Symbol(T, Decl(declFileForTypeParameters.ts, 1, 8)) return this.x; ->this.x : Symbol(x, Decl(declFileForTypeParameters.ts, 1, 12)) +>this.x : Symbol(C.x, Decl(declFileForTypeParameters.ts, 1, 12)) >this : Symbol(C, Decl(declFileForTypeParameters.ts, 0, 0)) ->x : Symbol(x, Decl(declFileForTypeParameters.ts, 1, 12)) +>x : Symbol(C.x, Decl(declFileForTypeParameters.ts, 1, 12)) } } diff --git a/tests/baselines/reference/declFileGenericClassWithGenericExtendedClass.symbols b/tests/baselines/reference/declFileGenericClassWithGenericExtendedClass.symbols index c732a6ad233..5d98c76ffa1 100644 --- a/tests/baselines/reference/declFileGenericClassWithGenericExtendedClass.symbols +++ b/tests/baselines/reference/declFileGenericClassWithGenericExtendedClass.symbols @@ -3,7 +3,7 @@ interface IFoo { >IFoo : Symbol(IFoo, Decl(declFileGenericClassWithGenericExtendedClass.ts, 0, 0)) baz: Baz; ->baz : Symbol(baz, Decl(declFileGenericClassWithGenericExtendedClass.ts, 0, 16)) +>baz : Symbol(IFoo.baz, Decl(declFileGenericClassWithGenericExtendedClass.ts, 0, 16)) >Baz : Symbol(Baz, Decl(declFileGenericClassWithGenericExtendedClass.ts, 7, 1)) } class Base { } @@ -21,7 +21,7 @@ interface IBar { >T : Symbol(T, Decl(declFileGenericClassWithGenericExtendedClass.ts, 5, 15)) derived: Derived; ->derived : Symbol(derived, Decl(declFileGenericClassWithGenericExtendedClass.ts, 5, 19)) +>derived : Symbol(IBar.derived, Decl(declFileGenericClassWithGenericExtendedClass.ts, 5, 19)) >Derived : Symbol(Derived, Decl(declFileGenericClassWithGenericExtendedClass.ts, 3, 17)) >T : Symbol(T, Decl(declFileGenericClassWithGenericExtendedClass.ts, 5, 15)) } @@ -31,7 +31,7 @@ class Baz implements IBar { >Baz : Symbol(Baz, Decl(declFileGenericClassWithGenericExtendedClass.ts, 7, 1)) derived: Derived; ->derived : Symbol(derived, Decl(declFileGenericClassWithGenericExtendedClass.ts, 8, 32)) +>derived : Symbol(Baz.derived, Decl(declFileGenericClassWithGenericExtendedClass.ts, 8, 32)) >Derived : Symbol(Derived, Decl(declFileGenericClassWithGenericExtendedClass.ts, 3, 17)) >Baz : Symbol(Baz, Decl(declFileGenericClassWithGenericExtendedClass.ts, 7, 1)) } diff --git a/tests/baselines/reference/declFileGenericType.symbols b/tests/baselines/reference/declFileGenericType.symbols index b98e0df59ac..608c1e20145 100644 --- a/tests/baselines/reference/declFileGenericType.symbols +++ b/tests/baselines/reference/declFileGenericType.symbols @@ -69,7 +69,7 @@ export module C { >T : Symbol(T, Decl(declFileGenericType.ts, 13, 19)) constructor(public val: T) { } ->val : Symbol(val, Decl(declFileGenericType.ts, 15, 20)) +>val : Symbol(D.val, Decl(declFileGenericType.ts, 15, 20)) >T : Symbol(T, Decl(declFileGenericType.ts, 13, 19)) } diff --git a/tests/baselines/reference/declFileGenericType2.symbols b/tests/baselines/reference/declFileGenericType2.symbols index fa1b63a2ac4..60ced2992d4 100644 --- a/tests/baselines/reference/declFileGenericType2.symbols +++ b/tests/baselines/reference/declFileGenericType2.symbols @@ -48,7 +48,7 @@ declare module templa.mvc.composite { >IModel : Symbol(IModel, Decl(declFileGenericType2.ts, 1, 27)) getControllers(): mvc.IController[]; ->getControllers : Symbol(getControllers, Decl(declFileGenericType2.ts, 14, 60)) +>getControllers : Symbol(ICompositeControllerModel.getControllers, Decl(declFileGenericType2.ts, 14, 60)) >mvc : Symbol(mvc, Decl(declFileGenericType2.ts, 1, 22), Decl(declFileGenericType2.ts, 5, 22), Decl(declFileGenericType2.ts, 9, 22), Decl(declFileGenericType2.ts, 13, 22)) >IController : Symbol(IController, Decl(declFileGenericType2.ts, 5, 27)) >mvc : Symbol(mvc, Decl(declFileGenericType2.ts, 1, 22), Decl(declFileGenericType2.ts, 5, 22), Decl(declFileGenericType2.ts, 9, 22), Decl(declFileGenericType2.ts, 13, 22)) @@ -125,7 +125,7 @@ module templa.dom.mvc.composite { >ModelType : Symbol(ModelType, Decl(declFileGenericType2.ts, 33, 52)) public _controllers: templa.mvc.IController[]; ->_controllers : Symbol(_controllers, Decl(declFileGenericType2.ts, 33, 179)) +>_controllers : Symbol(AbstractCompositeElementController._controllers, Decl(declFileGenericType2.ts, 33, 179)) >templa : Symbol(templa, Decl(declFileGenericType2.ts, 0, 0), Decl(declFileGenericType2.ts, 4, 1), Decl(declFileGenericType2.ts, 8, 1), Decl(declFileGenericType2.ts, 12, 1), Decl(declFileGenericType2.ts, 17, 1), Decl(declFileGenericType2.ts, 21, 1), Decl(declFileGenericType2.ts, 30, 1)) >mvc : Symbol(mvc, Decl(declFileGenericType2.ts, 1, 22), Decl(declFileGenericType2.ts, 5, 22), Decl(declFileGenericType2.ts, 9, 22), Decl(declFileGenericType2.ts, 13, 22)) >IController : Symbol(templa.mvc.IController, Decl(declFileGenericType2.ts, 5, 27)) @@ -138,9 +138,9 @@ module templa.dom.mvc.composite { >super : Symbol(AbstractElementController, Decl(declFileGenericType2.ts, 23, 23)) this._controllers = []; ->this._controllers : Symbol(_controllers, Decl(declFileGenericType2.ts, 33, 179)) +>this._controllers : Symbol(AbstractCompositeElementController._controllers, Decl(declFileGenericType2.ts, 33, 179)) >this : Symbol(AbstractCompositeElementController, Decl(declFileGenericType2.ts, 32, 33)) ->_controllers : Symbol(_controllers, Decl(declFileGenericType2.ts, 33, 179)) +>_controllers : Symbol(AbstractCompositeElementController._controllers, Decl(declFileGenericType2.ts, 33, 179)) } } } diff --git a/tests/baselines/reference/declFileImportModuleWithExportAssignment.symbols b/tests/baselines/reference/declFileImportModuleWithExportAssignment.symbols index a33e0fef758..1681dfa2782 100644 --- a/tests/baselines/reference/declFileImportModuleWithExportAssignment.symbols +++ b/tests/baselines/reference/declFileImportModuleWithExportAssignment.symbols @@ -29,13 +29,13 @@ module m2 { >connectExport : Symbol(connectExport, Decl(declFileImportModuleWithExportAssignment_0.ts, 4, 5)) use: (mod: connectModule) => connectExport; ->use : Symbol(use, Decl(declFileImportModuleWithExportAssignment_0.ts, 5, 36)) +>use : Symbol(connectExport.use, Decl(declFileImportModuleWithExportAssignment_0.ts, 5, 36)) >mod : Symbol(mod, Decl(declFileImportModuleWithExportAssignment_0.ts, 6, 14)) >connectModule : Symbol(connectModule, Decl(declFileImportModuleWithExportAssignment_0.ts, 1, 11)) >connectExport : Symbol(connectExport, Decl(declFileImportModuleWithExportAssignment_0.ts, 4, 5)) listen: (port: number) => void; ->listen : Symbol(listen, Decl(declFileImportModuleWithExportAssignment_0.ts, 6, 51)) +>listen : Symbol(connectExport.listen, Decl(declFileImportModuleWithExportAssignment_0.ts, 6, 51)) >port : Symbol(port, Decl(declFileImportModuleWithExportAssignment_0.ts, 7, 17)) } diff --git a/tests/baselines/reference/declFileMethods.symbols b/tests/baselines/reference/declFileMethods.symbols index 845f3044dae..723065c62e4 100644 --- a/tests/baselines/reference/declFileMethods.symbols +++ b/tests/baselines/reference/declFileMethods.symbols @@ -5,11 +5,11 @@ export class c1 { /** This comment should appear for foo*/ public foo() { ->foo : Symbol(foo, Decl(declFileMethods_0.ts, 1, 17)) +>foo : Symbol(c1.foo, Decl(declFileMethods_0.ts, 1, 17)) } /** This is comment for function signature*/ public fooWithParameters(/** this is comment about a*/a: string, ->fooWithParameters : Symbol(fooWithParameters, Decl(declFileMethods_0.ts, 4, 5)) +>fooWithParameters : Symbol(c1.fooWithParameters, Decl(declFileMethods_0.ts, 4, 5)) >a : Symbol(a, Decl(declFileMethods_0.ts, 6, 29)) /** this is comment for b*/ @@ -21,7 +21,7 @@ export class c1 { >a : Symbol(a, Decl(declFileMethods_0.ts, 6, 29)) } public fooWithRestParameters(a: string, ...rests: string[]) { ->fooWithRestParameters : Symbol(fooWithRestParameters, Decl(declFileMethods_0.ts, 10, 5)) +>fooWithRestParameters : Symbol(c1.fooWithRestParameters, Decl(declFileMethods_0.ts, 10, 5)) >a : Symbol(a, Decl(declFileMethods_0.ts, 11, 33)) >rests : Symbol(rests, Decl(declFileMethods_0.ts, 11, 43)) @@ -33,15 +33,15 @@ export class c1 { } public fooWithOverloads(a: string): string; ->fooWithOverloads : Symbol(fooWithOverloads, Decl(declFileMethods_0.ts, 13, 5), Decl(declFileMethods_0.ts, 15, 47), Decl(declFileMethods_0.ts, 16, 47)) +>fooWithOverloads : Symbol(c1.fooWithOverloads, Decl(declFileMethods_0.ts, 13, 5), Decl(declFileMethods_0.ts, 15, 47), Decl(declFileMethods_0.ts, 16, 47)) >a : Symbol(a, Decl(declFileMethods_0.ts, 15, 28)) public fooWithOverloads(a: number): number; ->fooWithOverloads : Symbol(fooWithOverloads, Decl(declFileMethods_0.ts, 13, 5), Decl(declFileMethods_0.ts, 15, 47), Decl(declFileMethods_0.ts, 16, 47)) +>fooWithOverloads : Symbol(c1.fooWithOverloads, Decl(declFileMethods_0.ts, 13, 5), Decl(declFileMethods_0.ts, 15, 47), Decl(declFileMethods_0.ts, 16, 47)) >a : Symbol(a, Decl(declFileMethods_0.ts, 16, 28)) public fooWithOverloads(a: any): any { ->fooWithOverloads : Symbol(fooWithOverloads, Decl(declFileMethods_0.ts, 13, 5), Decl(declFileMethods_0.ts, 15, 47), Decl(declFileMethods_0.ts, 16, 47)) +>fooWithOverloads : Symbol(c1.fooWithOverloads, Decl(declFileMethods_0.ts, 13, 5), Decl(declFileMethods_0.ts, 15, 47), Decl(declFileMethods_0.ts, 16, 47)) >a : Symbol(a, Decl(declFileMethods_0.ts, 17, 28)) return a; @@ -51,11 +51,11 @@ export class c1 { /** This comment should appear for privateFoo*/ private privateFoo() { ->privateFoo : Symbol(privateFoo, Decl(declFileMethods_0.ts, 19, 5)) +>privateFoo : Symbol(c1.privateFoo, Decl(declFileMethods_0.ts, 19, 5)) } /** This is comment for function signature*/ private privateFooWithParameters(/** this is comment about a*/a: string, ->privateFooWithParameters : Symbol(privateFooWithParameters, Decl(declFileMethods_0.ts, 24, 5)) +>privateFooWithParameters : Symbol(c1.privateFooWithParameters, Decl(declFileMethods_0.ts, 24, 5)) >a : Symbol(a, Decl(declFileMethods_0.ts, 26, 37)) /** this is comment for b*/ @@ -67,7 +67,7 @@ export class c1 { >a : Symbol(a, Decl(declFileMethods_0.ts, 26, 37)) } private privateFooWithRestParameters(a: string, ...rests: string[]) { ->privateFooWithRestParameters : Symbol(privateFooWithRestParameters, Decl(declFileMethods_0.ts, 30, 5)) +>privateFooWithRestParameters : Symbol(c1.privateFooWithRestParameters, Decl(declFileMethods_0.ts, 30, 5)) >a : Symbol(a, Decl(declFileMethods_0.ts, 31, 41)) >rests : Symbol(rests, Decl(declFileMethods_0.ts, 31, 51)) @@ -78,15 +78,15 @@ export class c1 { >join : Symbol(Array.join, Decl(lib.d.ts, --, --)) } private privateFooWithOverloads(a: string): string; ->privateFooWithOverloads : Symbol(privateFooWithOverloads, Decl(declFileMethods_0.ts, 33, 5), Decl(declFileMethods_0.ts, 34, 55), Decl(declFileMethods_0.ts, 35, 55)) +>privateFooWithOverloads : Symbol(c1.privateFooWithOverloads, Decl(declFileMethods_0.ts, 33, 5), Decl(declFileMethods_0.ts, 34, 55), Decl(declFileMethods_0.ts, 35, 55)) >a : Symbol(a, Decl(declFileMethods_0.ts, 34, 36)) private privateFooWithOverloads(a: number): number; ->privateFooWithOverloads : Symbol(privateFooWithOverloads, Decl(declFileMethods_0.ts, 33, 5), Decl(declFileMethods_0.ts, 34, 55), Decl(declFileMethods_0.ts, 35, 55)) +>privateFooWithOverloads : Symbol(c1.privateFooWithOverloads, Decl(declFileMethods_0.ts, 33, 5), Decl(declFileMethods_0.ts, 34, 55), Decl(declFileMethods_0.ts, 35, 55)) >a : Symbol(a, Decl(declFileMethods_0.ts, 35, 36)) private privateFooWithOverloads(a: any): any { ->privateFooWithOverloads : Symbol(privateFooWithOverloads, Decl(declFileMethods_0.ts, 33, 5), Decl(declFileMethods_0.ts, 34, 55), Decl(declFileMethods_0.ts, 35, 55)) +>privateFooWithOverloads : Symbol(c1.privateFooWithOverloads, Decl(declFileMethods_0.ts, 33, 5), Decl(declFileMethods_0.ts, 34, 55), Decl(declFileMethods_0.ts, 35, 55)) >a : Symbol(a, Decl(declFileMethods_0.ts, 36, 36)) return a; @@ -189,11 +189,11 @@ export interface I1 { /** This comment should appear for foo*/ foo(): string; ->foo : Symbol(foo, Decl(declFileMethods_0.ts, 79, 21)) +>foo : Symbol(I1.foo, Decl(declFileMethods_0.ts, 79, 21)) /** This is comment for function signature*/ fooWithParameters(/** this is comment about a*/a: string, ->fooWithParameters : Symbol(fooWithParameters, Decl(declFileMethods_0.ts, 81, 18)) +>fooWithParameters : Symbol(I1.fooWithParameters, Decl(declFileMethods_0.ts, 81, 18)) >a : Symbol(a, Decl(declFileMethods_0.ts, 84, 22)) /** this is comment for b*/ @@ -201,16 +201,16 @@ export interface I1 { >b : Symbol(b, Decl(declFileMethods_0.ts, 84, 61)) fooWithRestParameters(a: string, ...rests: string[]): string; ->fooWithRestParameters : Symbol(fooWithRestParameters, Decl(declFileMethods_0.ts, 86, 25)) +>fooWithRestParameters : Symbol(I1.fooWithRestParameters, Decl(declFileMethods_0.ts, 86, 25)) >a : Symbol(a, Decl(declFileMethods_0.ts, 88, 26)) >rests : Symbol(rests, Decl(declFileMethods_0.ts, 88, 36)) fooWithOverloads(a: string): string; ->fooWithOverloads : Symbol(fooWithOverloads, Decl(declFileMethods_0.ts, 88, 65), Decl(declFileMethods_0.ts, 90, 40)) +>fooWithOverloads : Symbol(I1.fooWithOverloads, Decl(declFileMethods_0.ts, 88, 65), Decl(declFileMethods_0.ts, 90, 40)) >a : Symbol(a, Decl(declFileMethods_0.ts, 90, 21)) fooWithOverloads(a: number): number; ->fooWithOverloads : Symbol(fooWithOverloads, Decl(declFileMethods_0.ts, 88, 65), Decl(declFileMethods_0.ts, 90, 40)) +>fooWithOverloads : Symbol(I1.fooWithOverloads, Decl(declFileMethods_0.ts, 88, 65), Decl(declFileMethods_0.ts, 90, 40)) >a : Symbol(a, Decl(declFileMethods_0.ts, 91, 21)) } @@ -220,11 +220,11 @@ class c2 { /** This comment should appear for foo*/ public foo() { ->foo : Symbol(foo, Decl(declFileMethods_1.ts, 0, 10)) +>foo : Symbol(c2.foo, Decl(declFileMethods_1.ts, 0, 10)) } /** This is comment for function signature*/ public fooWithParameters(/** this is comment about a*/a: string, ->fooWithParameters : Symbol(fooWithParameters, Decl(declFileMethods_1.ts, 3, 5)) +>fooWithParameters : Symbol(c2.fooWithParameters, Decl(declFileMethods_1.ts, 3, 5)) >a : Symbol(a, Decl(declFileMethods_1.ts, 5, 29)) /** this is comment for b*/ @@ -236,7 +236,7 @@ class c2 { >a : Symbol(a, Decl(declFileMethods_1.ts, 5, 29)) } public fooWithRestParameters(a: string, ...rests: string[]) { ->fooWithRestParameters : Symbol(fooWithRestParameters, Decl(declFileMethods_1.ts, 9, 5)) +>fooWithRestParameters : Symbol(c2.fooWithRestParameters, Decl(declFileMethods_1.ts, 9, 5)) >a : Symbol(a, Decl(declFileMethods_1.ts, 10, 33)) >rests : Symbol(rests, Decl(declFileMethods_1.ts, 10, 43)) @@ -248,15 +248,15 @@ class c2 { } public fooWithOverloads(a: string): string; ->fooWithOverloads : Symbol(fooWithOverloads, Decl(declFileMethods_1.ts, 12, 5), Decl(declFileMethods_1.ts, 14, 47), Decl(declFileMethods_1.ts, 15, 47)) +>fooWithOverloads : Symbol(c2.fooWithOverloads, Decl(declFileMethods_1.ts, 12, 5), Decl(declFileMethods_1.ts, 14, 47), Decl(declFileMethods_1.ts, 15, 47)) >a : Symbol(a, Decl(declFileMethods_1.ts, 14, 28)) public fooWithOverloads(a: number): number; ->fooWithOverloads : Symbol(fooWithOverloads, Decl(declFileMethods_1.ts, 12, 5), Decl(declFileMethods_1.ts, 14, 47), Decl(declFileMethods_1.ts, 15, 47)) +>fooWithOverloads : Symbol(c2.fooWithOverloads, Decl(declFileMethods_1.ts, 12, 5), Decl(declFileMethods_1.ts, 14, 47), Decl(declFileMethods_1.ts, 15, 47)) >a : Symbol(a, Decl(declFileMethods_1.ts, 15, 28)) public fooWithOverloads(a: any): any { ->fooWithOverloads : Symbol(fooWithOverloads, Decl(declFileMethods_1.ts, 12, 5), Decl(declFileMethods_1.ts, 14, 47), Decl(declFileMethods_1.ts, 15, 47)) +>fooWithOverloads : Symbol(c2.fooWithOverloads, Decl(declFileMethods_1.ts, 12, 5), Decl(declFileMethods_1.ts, 14, 47), Decl(declFileMethods_1.ts, 15, 47)) >a : Symbol(a, Decl(declFileMethods_1.ts, 16, 28)) return a; @@ -266,11 +266,11 @@ class c2 { /** This comment should appear for privateFoo*/ private privateFoo() { ->privateFoo : Symbol(privateFoo, Decl(declFileMethods_1.ts, 18, 5)) +>privateFoo : Symbol(c2.privateFoo, Decl(declFileMethods_1.ts, 18, 5)) } /** This is comment for function signature*/ private privateFooWithParameters(/** this is comment about a*/a: string, ->privateFooWithParameters : Symbol(privateFooWithParameters, Decl(declFileMethods_1.ts, 23, 5)) +>privateFooWithParameters : Symbol(c2.privateFooWithParameters, Decl(declFileMethods_1.ts, 23, 5)) >a : Symbol(a, Decl(declFileMethods_1.ts, 25, 37)) /** this is comment for b*/ @@ -282,7 +282,7 @@ class c2 { >a : Symbol(a, Decl(declFileMethods_1.ts, 25, 37)) } private privateFooWithRestParameters(a: string, ...rests: string[]) { ->privateFooWithRestParameters : Symbol(privateFooWithRestParameters, Decl(declFileMethods_1.ts, 29, 5)) +>privateFooWithRestParameters : Symbol(c2.privateFooWithRestParameters, Decl(declFileMethods_1.ts, 29, 5)) >a : Symbol(a, Decl(declFileMethods_1.ts, 30, 41)) >rests : Symbol(rests, Decl(declFileMethods_1.ts, 30, 51)) @@ -293,15 +293,15 @@ class c2 { >join : Symbol(Array.join, Decl(lib.d.ts, --, --)) } private privateFooWithOverloads(a: string): string; ->privateFooWithOverloads : Symbol(privateFooWithOverloads, Decl(declFileMethods_1.ts, 32, 5), Decl(declFileMethods_1.ts, 33, 55), Decl(declFileMethods_1.ts, 34, 55)) +>privateFooWithOverloads : Symbol(c2.privateFooWithOverloads, Decl(declFileMethods_1.ts, 32, 5), Decl(declFileMethods_1.ts, 33, 55), Decl(declFileMethods_1.ts, 34, 55)) >a : Symbol(a, Decl(declFileMethods_1.ts, 33, 36)) private privateFooWithOverloads(a: number): number; ->privateFooWithOverloads : Symbol(privateFooWithOverloads, Decl(declFileMethods_1.ts, 32, 5), Decl(declFileMethods_1.ts, 33, 55), Decl(declFileMethods_1.ts, 34, 55)) +>privateFooWithOverloads : Symbol(c2.privateFooWithOverloads, Decl(declFileMethods_1.ts, 32, 5), Decl(declFileMethods_1.ts, 33, 55), Decl(declFileMethods_1.ts, 34, 55)) >a : Symbol(a, Decl(declFileMethods_1.ts, 34, 36)) private privateFooWithOverloads(a: any): any { ->privateFooWithOverloads : Symbol(privateFooWithOverloads, Decl(declFileMethods_1.ts, 32, 5), Decl(declFileMethods_1.ts, 33, 55), Decl(declFileMethods_1.ts, 34, 55)) +>privateFooWithOverloads : Symbol(c2.privateFooWithOverloads, Decl(declFileMethods_1.ts, 32, 5), Decl(declFileMethods_1.ts, 33, 55), Decl(declFileMethods_1.ts, 34, 55)) >a : Symbol(a, Decl(declFileMethods_1.ts, 35, 36)) return a; @@ -404,11 +404,11 @@ interface I2 { /** This comment should appear for foo*/ foo(): string; ->foo : Symbol(foo, Decl(declFileMethods_1.ts, 78, 14)) +>foo : Symbol(I2.foo, Decl(declFileMethods_1.ts, 78, 14)) /** This is comment for function signature*/ fooWithParameters(/** this is comment about a*/a: string, ->fooWithParameters : Symbol(fooWithParameters, Decl(declFileMethods_1.ts, 80, 18)) +>fooWithParameters : Symbol(I2.fooWithParameters, Decl(declFileMethods_1.ts, 80, 18)) >a : Symbol(a, Decl(declFileMethods_1.ts, 83, 22)) /** this is comment for b*/ @@ -416,16 +416,16 @@ interface I2 { >b : Symbol(b, Decl(declFileMethods_1.ts, 83, 61)) fooWithRestParameters(a: string, ...rests: string[]): string; ->fooWithRestParameters : Symbol(fooWithRestParameters, Decl(declFileMethods_1.ts, 85, 25)) +>fooWithRestParameters : Symbol(I2.fooWithRestParameters, Decl(declFileMethods_1.ts, 85, 25)) >a : Symbol(a, Decl(declFileMethods_1.ts, 87, 26)) >rests : Symbol(rests, Decl(declFileMethods_1.ts, 87, 36)) fooWithOverloads(a: string): string; ->fooWithOverloads : Symbol(fooWithOverloads, Decl(declFileMethods_1.ts, 87, 65), Decl(declFileMethods_1.ts, 89, 40)) +>fooWithOverloads : Symbol(I2.fooWithOverloads, Decl(declFileMethods_1.ts, 87, 65), Decl(declFileMethods_1.ts, 89, 40)) >a : Symbol(a, Decl(declFileMethods_1.ts, 89, 21)) fooWithOverloads(a: number): number; ->fooWithOverloads : Symbol(fooWithOverloads, Decl(declFileMethods_1.ts, 87, 65), Decl(declFileMethods_1.ts, 89, 40)) +>fooWithOverloads : Symbol(I2.fooWithOverloads, Decl(declFileMethods_1.ts, 87, 65), Decl(declFileMethods_1.ts, 89, 40)) >a : Symbol(a, Decl(declFileMethods_1.ts, 90, 21)) } diff --git a/tests/baselines/reference/declFileObjectLiteralWithOnlyGetter.js b/tests/baselines/reference/declFileObjectLiteralWithOnlyGetter.js index 396ee75422e..eb440c028d5 100644 --- a/tests/baselines/reference/declFileObjectLiteralWithOnlyGetter.js +++ b/tests/baselines/reference/declFileObjectLiteralWithOnlyGetter.js @@ -22,9 +22,9 @@ var /*2*/ x = point.x; //// [declFileObjectLiteralWithOnlyGetter.d.ts] declare function makePoint(x: number): { - x: number; + readonly x: number; }; declare var point: { - x: number; + readonly x: number; }; declare var x: number; diff --git a/tests/baselines/reference/declFileObjectLiteralWithOnlyGetter.types b/tests/baselines/reference/declFileObjectLiteralWithOnlyGetter.types index c0fb7b763fc..dd3cbe20983 100644 --- a/tests/baselines/reference/declFileObjectLiteralWithOnlyGetter.types +++ b/tests/baselines/reference/declFileObjectLiteralWithOnlyGetter.types @@ -1,11 +1,11 @@ === tests/cases/compiler/declFileObjectLiteralWithOnlyGetter.ts === function /*1*/makePoint(x: number) { ->makePoint : (x: number) => { x: number; } +>makePoint : (x: number) => { readonly x: number; } >x : number return { ->{ get x() { return x; }, } : { x: number; } +>{ get x() { return x; }, } : { readonly x: number; } get x() { return x; }, >x : number @@ -14,14 +14,14 @@ function /*1*/makePoint(x: number) { }; }; var /*4*/point = makePoint(2); ->point : { x: number; } ->makePoint(2) : { x: number; } ->makePoint : (x: number) => { x: number; } +>point : { readonly x: number; } +>makePoint(2) : { readonly x: number; } +>makePoint : (x: number) => { readonly x: number; } >2 : number var /*2*/x = point./*3*/x; >x : number >point./*3*/x : number ->point : { x: number; } +>point : { readonly x: number; } >x : number diff --git a/tests/baselines/reference/declFileOptionalInterfaceMethod.symbols b/tests/baselines/reference/declFileOptionalInterfaceMethod.symbols index 2bf0c640fe5..ff6af2fd101 100644 --- a/tests/baselines/reference/declFileOptionalInterfaceMethod.symbols +++ b/tests/baselines/reference/declFileOptionalInterfaceMethod.symbols @@ -3,7 +3,7 @@ interface X { >X : Symbol(X, Decl(declFileOptionalInterfaceMethod.ts, 0, 0)) f? (); ->f : Symbol(f, Decl(declFileOptionalInterfaceMethod.ts, 0, 13)) +>f : Symbol(X.f, Decl(declFileOptionalInterfaceMethod.ts, 0, 13)) >T : Symbol(T, Decl(declFileOptionalInterfaceMethod.ts, 1, 8)) } diff --git a/tests/baselines/reference/declFilePrivateMethodOverloads.symbols b/tests/baselines/reference/declFilePrivateMethodOverloads.symbols index becc01438c2..6471ee7f5e7 100644 --- a/tests/baselines/reference/declFilePrivateMethodOverloads.symbols +++ b/tests/baselines/reference/declFilePrivateMethodOverloads.symbols @@ -4,13 +4,13 @@ interface IContext { >IContext : Symbol(IContext, Decl(declFilePrivateMethodOverloads.ts, 0, 0)) someMethod(); ->someMethod : Symbol(someMethod, Decl(declFilePrivateMethodOverloads.ts, 1, 20)) +>someMethod : Symbol(IContext.someMethod, Decl(declFilePrivateMethodOverloads.ts, 1, 20)) } class c1 { >c1 : Symbol(c1, Decl(declFilePrivateMethodOverloads.ts, 3, 1)) private _forEachBindingContext(bindingContext: IContext, fn: (bindingContext: IContext) => void); ->_forEachBindingContext : Symbol(_forEachBindingContext, Decl(declFilePrivateMethodOverloads.ts, 4, 10), Decl(declFilePrivateMethodOverloads.ts, 5, 101), Decl(declFilePrivateMethodOverloads.ts, 6, 113)) +>_forEachBindingContext : Symbol(c1._forEachBindingContext, Decl(declFilePrivateMethodOverloads.ts, 4, 10), Decl(declFilePrivateMethodOverloads.ts, 5, 101), Decl(declFilePrivateMethodOverloads.ts, 6, 113)) >bindingContext : Symbol(bindingContext, Decl(declFilePrivateMethodOverloads.ts, 5, 35)) >IContext : Symbol(IContext, Decl(declFilePrivateMethodOverloads.ts, 0, 0)) >fn : Symbol(fn, Decl(declFilePrivateMethodOverloads.ts, 5, 60)) @@ -18,7 +18,7 @@ class c1 { >IContext : Symbol(IContext, Decl(declFilePrivateMethodOverloads.ts, 0, 0)) private _forEachBindingContext(bindingContextArray: Array, fn: (bindingContext: IContext) => void); ->_forEachBindingContext : Symbol(_forEachBindingContext, Decl(declFilePrivateMethodOverloads.ts, 4, 10), Decl(declFilePrivateMethodOverloads.ts, 5, 101), Decl(declFilePrivateMethodOverloads.ts, 6, 113)) +>_forEachBindingContext : Symbol(c1._forEachBindingContext, Decl(declFilePrivateMethodOverloads.ts, 4, 10), Decl(declFilePrivateMethodOverloads.ts, 5, 101), Decl(declFilePrivateMethodOverloads.ts, 6, 113)) >bindingContextArray : Symbol(bindingContextArray, Decl(declFilePrivateMethodOverloads.ts, 6, 35)) >Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >IContext : Symbol(IContext, Decl(declFilePrivateMethodOverloads.ts, 0, 0)) @@ -27,7 +27,7 @@ class c1 { >IContext : Symbol(IContext, Decl(declFilePrivateMethodOverloads.ts, 0, 0)) private _forEachBindingContext(context, fn: (bindingContext: IContext) => void): void { ->_forEachBindingContext : Symbol(_forEachBindingContext, Decl(declFilePrivateMethodOverloads.ts, 4, 10), Decl(declFilePrivateMethodOverloads.ts, 5, 101), Decl(declFilePrivateMethodOverloads.ts, 6, 113)) +>_forEachBindingContext : Symbol(c1._forEachBindingContext, Decl(declFilePrivateMethodOverloads.ts, 4, 10), Decl(declFilePrivateMethodOverloads.ts, 5, 101), Decl(declFilePrivateMethodOverloads.ts, 6, 113)) >context : Symbol(context, Decl(declFilePrivateMethodOverloads.ts, 7, 35)) >fn : Symbol(fn, Decl(declFilePrivateMethodOverloads.ts, 7, 43)) >bindingContext : Symbol(bindingContext, Decl(declFilePrivateMethodOverloads.ts, 7, 49)) @@ -37,12 +37,12 @@ class c1 { } private overloadWithArityDifference(bindingContext: IContext); ->overloadWithArityDifference : Symbol(overloadWithArityDifference, Decl(declFilePrivateMethodOverloads.ts, 9, 5), Decl(declFilePrivateMethodOverloads.ts, 11, 66), Decl(declFilePrivateMethodOverloads.ts, 12, 118)) +>overloadWithArityDifference : Symbol(c1.overloadWithArityDifference, Decl(declFilePrivateMethodOverloads.ts, 9, 5), Decl(declFilePrivateMethodOverloads.ts, 11, 66), Decl(declFilePrivateMethodOverloads.ts, 12, 118)) >bindingContext : Symbol(bindingContext, Decl(declFilePrivateMethodOverloads.ts, 11, 40)) >IContext : Symbol(IContext, Decl(declFilePrivateMethodOverloads.ts, 0, 0)) private overloadWithArityDifference(bindingContextArray: Array, fn: (bindingContext: IContext) => void); ->overloadWithArityDifference : Symbol(overloadWithArityDifference, Decl(declFilePrivateMethodOverloads.ts, 9, 5), Decl(declFilePrivateMethodOverloads.ts, 11, 66), Decl(declFilePrivateMethodOverloads.ts, 12, 118)) +>overloadWithArityDifference : Symbol(c1.overloadWithArityDifference, Decl(declFilePrivateMethodOverloads.ts, 9, 5), Decl(declFilePrivateMethodOverloads.ts, 11, 66), Decl(declFilePrivateMethodOverloads.ts, 12, 118)) >bindingContextArray : Symbol(bindingContextArray, Decl(declFilePrivateMethodOverloads.ts, 12, 40)) >Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >IContext : Symbol(IContext, Decl(declFilePrivateMethodOverloads.ts, 0, 0)) @@ -51,7 +51,7 @@ class c1 { >IContext : Symbol(IContext, Decl(declFilePrivateMethodOverloads.ts, 0, 0)) private overloadWithArityDifference(context): void { ->overloadWithArityDifference : Symbol(overloadWithArityDifference, Decl(declFilePrivateMethodOverloads.ts, 9, 5), Decl(declFilePrivateMethodOverloads.ts, 11, 66), Decl(declFilePrivateMethodOverloads.ts, 12, 118)) +>overloadWithArityDifference : Symbol(c1.overloadWithArityDifference, Decl(declFilePrivateMethodOverloads.ts, 9, 5), Decl(declFilePrivateMethodOverloads.ts, 11, 66), Decl(declFilePrivateMethodOverloads.ts, 12, 118)) >context : Symbol(context, Decl(declFilePrivateMethodOverloads.ts, 13, 40)) // Function here @@ -61,16 +61,16 @@ declare class c2 { >c2 : Symbol(c2, Decl(declFilePrivateMethodOverloads.ts, 16, 1)) private overload1(context, fn); ->overload1 : Symbol(overload1, Decl(declFilePrivateMethodOverloads.ts, 17, 18)) +>overload1 : Symbol(c2.overload1, Decl(declFilePrivateMethodOverloads.ts, 17, 18)) >context : Symbol(context, Decl(declFilePrivateMethodOverloads.ts, 18, 22)) >fn : Symbol(fn, Decl(declFilePrivateMethodOverloads.ts, 18, 30)) private overload2(context); ->overload2 : Symbol(overload2, Decl(declFilePrivateMethodOverloads.ts, 18, 35), Decl(declFilePrivateMethodOverloads.ts, 20, 31)) +>overload2 : Symbol(c2.overload2, Decl(declFilePrivateMethodOverloads.ts, 18, 35), Decl(declFilePrivateMethodOverloads.ts, 20, 31)) >context : Symbol(context, Decl(declFilePrivateMethodOverloads.ts, 20, 22)) private overload2(context, fn); ->overload2 : Symbol(overload2, Decl(declFilePrivateMethodOverloads.ts, 18, 35), Decl(declFilePrivateMethodOverloads.ts, 20, 31)) +>overload2 : Symbol(c2.overload2, Decl(declFilePrivateMethodOverloads.ts, 18, 35), Decl(declFilePrivateMethodOverloads.ts, 20, 31)) >context : Symbol(context, Decl(declFilePrivateMethodOverloads.ts, 21, 22)) >fn : Symbol(fn, Decl(declFilePrivateMethodOverloads.ts, 21, 30)) } diff --git a/tests/baselines/reference/declFilePrivateStatic.js b/tests/baselines/reference/declFilePrivateStatic.js index dd81d94b3c5..30cd85444cf 100644 --- a/tests/baselines/reference/declFilePrivateStatic.js +++ b/tests/baselines/reference/declFilePrivateStatic.js @@ -52,8 +52,8 @@ declare class C { static y: number; private static a(); static b(): void; - private static c; - static d: number; + private static readonly c; + static readonly d: number; private static e; static f: any; } diff --git a/tests/baselines/reference/declFileTypeAnnotationParenType.symbols b/tests/baselines/reference/declFileTypeAnnotationParenType.symbols index bc5668b70bd..7186da48fd7 100644 --- a/tests/baselines/reference/declFileTypeAnnotationParenType.symbols +++ b/tests/baselines/reference/declFileTypeAnnotationParenType.symbols @@ -4,7 +4,7 @@ class c { >c : Symbol(c, Decl(declFileTypeAnnotationParenType.ts, 0, 0)) private p: string; ->p : Symbol(p, Decl(declFileTypeAnnotationParenType.ts, 1, 9)) +>p : Symbol(c.p, Decl(declFileTypeAnnotationParenType.ts, 1, 9)) } var x: (() => c)[] = [() => new c()]; diff --git a/tests/baselines/reference/declFileTypeAnnotationTypeAlias.symbols b/tests/baselines/reference/declFileTypeAnnotationTypeAlias.symbols index 27507817a77..d12902b6f19 100644 --- a/tests/baselines/reference/declFileTypeAnnotationTypeAlias.symbols +++ b/tests/baselines/reference/declFileTypeAnnotationTypeAlias.symbols @@ -40,7 +40,7 @@ interface Window { >Window : Symbol(Window, Decl(declFileTypeAnnotationTypeAlias.ts, 18, 1)) someMethod(); ->someMethod : Symbol(someMethod, Decl(declFileTypeAnnotationTypeAlias.ts, 20, 18)) +>someMethod : Symbol(Window.someMethod, Decl(declFileTypeAnnotationTypeAlias.ts, 20, 18)) } module M { diff --git a/tests/baselines/reference/declFileTypeAnnotationUnionType.symbols b/tests/baselines/reference/declFileTypeAnnotationUnionType.symbols index f57df197579..ac4884326eb 100644 --- a/tests/baselines/reference/declFileTypeAnnotationUnionType.symbols +++ b/tests/baselines/reference/declFileTypeAnnotationUnionType.symbols @@ -4,7 +4,7 @@ class c { >c : Symbol(c, Decl(declFileTypeAnnotationUnionType.ts, 0, 0)) private p: string; ->p : Symbol(p, Decl(declFileTypeAnnotationUnionType.ts, 1, 9)) +>p : Symbol(c.p, Decl(declFileTypeAnnotationUnionType.ts, 1, 9)) } module m { >m : Symbol(m, Decl(declFileTypeAnnotationUnionType.ts, 3, 1)) @@ -13,14 +13,14 @@ module m { >c : Symbol(c, Decl(declFileTypeAnnotationUnionType.ts, 4, 10)) private q: string; ->q : Symbol(q, Decl(declFileTypeAnnotationUnionType.ts, 5, 20)) +>q : Symbol(c.q, Decl(declFileTypeAnnotationUnionType.ts, 5, 20)) } export class g { >g : Symbol(g, Decl(declFileTypeAnnotationUnionType.ts, 7, 5)) >T : Symbol(T, Decl(declFileTypeAnnotationUnionType.ts, 8, 19)) private r: string; ->r : Symbol(r, Decl(declFileTypeAnnotationUnionType.ts, 8, 23)) +>r : Symbol(g.r, Decl(declFileTypeAnnotationUnionType.ts, 8, 23)) } } class g { @@ -28,7 +28,7 @@ class g { >T : Symbol(T, Decl(declFileTypeAnnotationUnionType.ts, 12, 8)) private s: string; ->s : Symbol(s, Decl(declFileTypeAnnotationUnionType.ts, 12, 12)) +>s : Symbol(g.s, Decl(declFileTypeAnnotationUnionType.ts, 12, 12)) } // Just the name diff --git a/tests/baselines/reference/declFileTypeofClass.symbols b/tests/baselines/reference/declFileTypeofClass.symbols index 26adfcc8ee4..0594edeef77 100644 --- a/tests/baselines/reference/declFileTypeofClass.symbols +++ b/tests/baselines/reference/declFileTypeofClass.symbols @@ -10,10 +10,10 @@ class c { >y : Symbol(c.y, Decl(declFileTypeofClass.ts, 2, 22)) private x3: string; ->x3 : Symbol(x3, Decl(declFileTypeofClass.ts, 3, 29)) +>x3 : Symbol(c.x3, Decl(declFileTypeofClass.ts, 3, 29)) public y3: number; ->y3 : Symbol(y3, Decl(declFileTypeofClass.ts, 4, 23)) +>y3 : Symbol(c.y3, Decl(declFileTypeofClass.ts, 4, 23)) } var x: c; diff --git a/tests/baselines/reference/declFileWithClassNameConflictingWithClassReferredByExtendsClause.symbols b/tests/baselines/reference/declFileWithClassNameConflictingWithClassReferredByExtendsClause.symbols index d2548af7c4f..dd591277cd3 100644 --- a/tests/baselines/reference/declFileWithClassNameConflictingWithClassReferredByExtendsClause.symbols +++ b/tests/baselines/reference/declFileWithClassNameConflictingWithClassReferredByExtendsClause.symbols @@ -9,7 +9,7 @@ declare module A.B.Base { >W : Symbol(W, Decl(declFileWithClassNameConflictingWithClassReferredByExtendsClause.ts, 1, 25)) id: number; ->id : Symbol(id, Decl(declFileWithClassNameConflictingWithClassReferredByExtendsClause.ts, 2, 20)) +>id : Symbol(W.id, Decl(declFileWithClassNameConflictingWithClassReferredByExtendsClause.ts, 2, 20)) } } module X.Y.base { @@ -28,7 +28,7 @@ module X.Y.base { >W : Symbol(A.B.Base.W, Decl(declFileWithClassNameConflictingWithClassReferredByExtendsClause.ts, 1, 25)) name: string; ->name : Symbol(name, Decl(declFileWithClassNameConflictingWithClassReferredByExtendsClause.ts, 8, 39)) +>name : Symbol(W.name, Decl(declFileWithClassNameConflictingWithClassReferredByExtendsClause.ts, 8, 39)) } } @@ -50,7 +50,7 @@ module X.Y.base.Z { >W : Symbol(W, Decl(declFileWithClassNameConflictingWithClassReferredByExtendsClause.ts, 6, 17)) value: boolean; ->value : Symbol(value, Decl(declFileWithClassNameConflictingWithClassReferredByExtendsClause.ts, 15, 47)) +>value : Symbol(W.value, Decl(declFileWithClassNameConflictingWithClassReferredByExtendsClause.ts, 15, 47)) } } diff --git a/tests/baselines/reference/declFileWithExtendsClauseThatHasItsContainerNameConflict.symbols b/tests/baselines/reference/declFileWithExtendsClauseThatHasItsContainerNameConflict.symbols index e5016ec9baa..552a4a44b35 100644 --- a/tests/baselines/reference/declFileWithExtendsClauseThatHasItsContainerNameConflict.symbols +++ b/tests/baselines/reference/declFileWithExtendsClauseThatHasItsContainerNameConflict.symbols @@ -18,7 +18,7 @@ module A.B { >EventManager : Symbol(EventManager, Decl(declFileWithExtendsClauseThatHasItsContainerNameConflict.ts, 6, 12)) id: number; ->id : Symbol(id, Decl(declFileWithExtendsClauseThatHasItsContainerNameConflict.ts, 7, 31)) +>id : Symbol(EventManager.id, Decl(declFileWithExtendsClauseThatHasItsContainerNameConflict.ts, 7, 31)) } } @@ -33,6 +33,6 @@ module A.B.C { >EventManager : Symbol(EventManager, Decl(declFileWithExtendsClauseThatHasItsContainerNameConflict.ts, 6, 12)) name: string; ->name : Symbol(name, Decl(declFileWithExtendsClauseThatHasItsContainerNameConflict.ts, 14, 51)) +>name : Symbol(ContextMenu.name, Decl(declFileWithExtendsClauseThatHasItsContainerNameConflict.ts, 14, 51)) } } diff --git a/tests/baselines/reference/declInput.symbols b/tests/baselines/reference/declInput.symbols index 90f075218c0..6faede31601 100644 --- a/tests/baselines/reference/declInput.symbols +++ b/tests/baselines/reference/declInput.symbols @@ -8,10 +8,10 @@ class bar { >bar : Symbol(bar, Decl(declInput.ts, 0, 0), Decl(declInput.ts, 2, 1)) public f() { return ''; } ->f : Symbol(f, Decl(declInput.ts, 4, 11)) +>f : Symbol(bar.f, Decl(declInput.ts, 4, 11)) public g() { return {a: null, b: undefined, c: void 4 }; } ->g : Symbol(g, Decl(declInput.ts, 5, 27)) +>g : Symbol(bar.g, Decl(declInput.ts, 5, 27)) >a : Symbol(a, Decl(declInput.ts, 6, 23)) >bar : Symbol(bar, Decl(declInput.ts, 0, 0), Decl(declInput.ts, 2, 1)) >b : Symbol(b, Decl(declInput.ts, 6, 36)) @@ -19,7 +19,7 @@ class bar { >c : Symbol(c, Decl(declInput.ts, 6, 50)) public h(x = 4, y = null, z = '') { x++; } ->h : Symbol(h, Decl(declInput.ts, 6, 65)) +>h : Symbol(bar.h, Decl(declInput.ts, 6, 65)) >x : Symbol(x, Decl(declInput.ts, 7, 11)) >y : Symbol(y, Decl(declInput.ts, 7, 17)) >z : Symbol(z, Decl(declInput.ts, 7, 27)) diff --git a/tests/baselines/reference/declInput3.symbols b/tests/baselines/reference/declInput3.symbols index 06f35db0164..c4097dd4b63 100644 --- a/tests/baselines/reference/declInput3.symbols +++ b/tests/baselines/reference/declInput3.symbols @@ -8,10 +8,10 @@ class bar { >bar : Symbol(bar, Decl(declInput3.ts, 2, 1)) public f() { return ''; } ->f : Symbol(f, Decl(declInput3.ts, 4, 11)) +>f : Symbol(bar.f, Decl(declInput3.ts, 4, 11)) public g() { return {a: null, b: undefined, c: void 4 }; } ->g : Symbol(g, Decl(declInput3.ts, 5, 27)) +>g : Symbol(bar.g, Decl(declInput3.ts, 5, 27)) >a : Symbol(a, Decl(declInput3.ts, 6, 23)) >bar : Symbol(bar, Decl(declInput3.ts, 2, 1)) >b : Symbol(b, Decl(declInput3.ts, 6, 36)) @@ -19,7 +19,7 @@ class bar { >c : Symbol(c, Decl(declInput3.ts, 6, 50)) public h(x = 4, y = null, z = '') { x++; } ->h : Symbol(h, Decl(declInput3.ts, 6, 65)) +>h : Symbol(bar.h, Decl(declInput3.ts, 6, 65)) >x : Symbol(x, Decl(declInput3.ts, 7, 11)) >y : Symbol(y, Decl(declInput3.ts, 7, 17)) >z : Symbol(z, Decl(declInput3.ts, 7, 27)) diff --git a/tests/baselines/reference/declInput4.symbols b/tests/baselines/reference/declInput4.symbols index 01af5987a7d..6420ad0916c 100644 --- a/tests/baselines/reference/declInput4.symbols +++ b/tests/baselines/reference/declInput4.symbols @@ -18,29 +18,29 @@ module M { >D : Symbol(D, Decl(declInput4.ts, 4, 19)) public m1: number; ->m1 : Symbol(m1, Decl(declInput4.ts, 5, 20)) +>m1 : Symbol(D.m1, Decl(declInput4.ts, 5, 20)) public m2: string; ->m2 : Symbol(m2, Decl(declInput4.ts, 6, 26)) +>m2 : Symbol(D.m2, Decl(declInput4.ts, 6, 26)) public m23: E; ->m23 : Symbol(m23, Decl(declInput4.ts, 7, 26)) +>m23 : Symbol(D.m23, Decl(declInput4.ts, 7, 26)) >E : Symbol(E, Decl(declInput4.ts, 1, 15)) public m24: I1; ->m24 : Symbol(m24, Decl(declInput4.ts, 8, 22)) +>m24 : Symbol(D.m24, Decl(declInput4.ts, 8, 22)) >I1 : Symbol(I1, Decl(declInput4.ts, 2, 21)) public m232(): E { return null;} ->m232 : Symbol(m232, Decl(declInput4.ts, 9, 23)) +>m232 : Symbol(D.m232, Decl(declInput4.ts, 9, 23)) >E : Symbol(E, Decl(declInput4.ts, 1, 15)) public m242(): I1 { return null; } ->m242 : Symbol(m242, Decl(declInput4.ts, 10, 40)) +>m242 : Symbol(D.m242, Decl(declInput4.ts, 10, 40)) >I1 : Symbol(I1, Decl(declInput4.ts, 2, 21)) public m26(i:I1) {} ->m26 : Symbol(m26, Decl(declInput4.ts, 11, 42)) +>m26 : Symbol(D.m26, Decl(declInput4.ts, 11, 42)) >i : Symbol(i, Decl(declInput4.ts, 12, 19)) >I1 : Symbol(I1, Decl(declInput4.ts, 2, 21)) } diff --git a/tests/baselines/reference/declarationEmitDefaultExportWithTempVarName.js b/tests/baselines/reference/declarationEmitDefaultExportWithTempVarName.js new file mode 100644 index 00000000000..a0c8ab59b97 --- /dev/null +++ b/tests/baselines/reference/declarationEmitDefaultExportWithTempVarName.js @@ -0,0 +1,19 @@ +//// [pi.ts] +export default 3.14159; + +//// [pi.js] +System.register([], function(exports_1, context_1) { + "use strict"; + var __moduleName = context_1 && context_1.id; + return { + setters:[], + execute: function() { + exports_1("default",3.14159); + } + } +}); + + +//// [pi.d.ts] +declare var _default: number; +export default _default; diff --git a/tests/baselines/reference/declarationEmitDefaultExportWithTempVarName.symbols b/tests/baselines/reference/declarationEmitDefaultExportWithTempVarName.symbols new file mode 100644 index 00000000000..a45ecb2e47e --- /dev/null +++ b/tests/baselines/reference/declarationEmitDefaultExportWithTempVarName.symbols @@ -0,0 +1,3 @@ +=== tests/cases/compiler/pi.ts === +export default 3.14159; +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/declarationEmitDefaultExportWithTempVarName.types b/tests/baselines/reference/declarationEmitDefaultExportWithTempVarName.types new file mode 100644 index 00000000000..a45ecb2e47e --- /dev/null +++ b/tests/baselines/reference/declarationEmitDefaultExportWithTempVarName.types @@ -0,0 +1,3 @@ +=== tests/cases/compiler/pi.ts === +export default 3.14159; +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/declarationEmitDefaultExportWithTempVarNameWithBundling.js b/tests/baselines/reference/declarationEmitDefaultExportWithTempVarNameWithBundling.js new file mode 100644 index 00000000000..adb081dc2a3 --- /dev/null +++ b/tests/baselines/reference/declarationEmitDefaultExportWithTempVarNameWithBundling.js @@ -0,0 +1,22 @@ +//// [pi.ts] + +export default 3.14159; + +//// [app.js] +System.register("pi", [], function(exports_1, context_1) { + "use strict"; + var __moduleName = context_1 && context_1.id; + return { + setters:[], + execute: function() { + exports_1("default",3.14159); + } + } +}); + + +//// [app.d.ts] +declare module "pi" { + var _default: number; + export default _default; +} diff --git a/tests/baselines/reference/declarationEmitDefaultExportWithTempVarNameWithBundling.symbols b/tests/baselines/reference/declarationEmitDefaultExportWithTempVarNameWithBundling.symbols new file mode 100644 index 00000000000..82f52e818e3 --- /dev/null +++ b/tests/baselines/reference/declarationEmitDefaultExportWithTempVarNameWithBundling.symbols @@ -0,0 +1,4 @@ +=== tests/cases/compiler/pi.ts === + +No type information for this code.export default 3.14159; +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/declarationEmitDefaultExportWithTempVarNameWithBundling.types b/tests/baselines/reference/declarationEmitDefaultExportWithTempVarNameWithBundling.types new file mode 100644 index 00000000000..82f52e818e3 --- /dev/null +++ b/tests/baselines/reference/declarationEmitDefaultExportWithTempVarNameWithBundling.types @@ -0,0 +1,4 @@ +=== tests/cases/compiler/pi.ts === + +No type information for this code.export default 3.14159; +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/declarationEmitDestructuring5.types b/tests/baselines/reference/declarationEmitDestructuring5.types index f09b1ebf50c..961dea62bcb 100644 --- a/tests/baselines/reference/declarationEmitDestructuring5.types +++ b/tests/baselines/reference/declarationEmitDestructuring5.types @@ -1,23 +1,23 @@ === tests/cases/compiler/declarationEmitDestructuring5.ts === function baz([, z, , ]) { } ->baz : ([, z, , ]: [any, any, any]) => void +>baz : ([, z, ,]: [any, any, any]) => void > : undefined >z : any > : undefined function foo([, b, ]: [any, any]): void { } ->foo : ([, b, ]: [any, any]) => void +>foo : ([, b,]: [any, any]) => void > : undefined >b : any function bar([z, , , ]) { } ->bar : ([z, , , ]: [any, any, any]) => void +>bar : ([z, , ,]: [any, any, any]) => void >z : any > : undefined > : undefined function bar1([z, , , ] = [1, 3, 4, 6, 7]) { } ->bar1 : ([z, , , ]?: [number, number, number, number, number]) => void +>bar1 : ([z, , ,]?: [number, number, number, number, number]) => void >z : number > : undefined > : undefined @@ -29,7 +29,7 @@ function bar1([z, , , ] = [1, 3, 4, 6, 7]) { } >7 : number function bar2([,,z, , , ]) { } ->bar2 : ([,,z, , , ]: [any, any, any, any, any]) => void +>bar2 : ([, , z, , ,]: [any, any, any, any, any]) => void > : undefined > : undefined >z : any diff --git a/tests/baselines/reference/declarationEmitDestructuringOptionalBindingParametersInOverloads.types b/tests/baselines/reference/declarationEmitDestructuringOptionalBindingParametersInOverloads.types index 1c75466f0c3..9eabfebe877 100644 --- a/tests/baselines/reference/declarationEmitDestructuringOptionalBindingParametersInOverloads.types +++ b/tests/baselines/reference/declarationEmitDestructuringOptionalBindingParametersInOverloads.types @@ -12,7 +12,7 @@ function foo(...rest: any[]) { } function foo2( { x, y, z }?: { x: string; y: number; z: boolean }); ->foo2 : ({ x, y, z }?: { x: string; y: number; z: boolean; }) => any +>foo2 : ({x, y, z}?: { x: string; y: number; z: boolean; }) => any >x : string >y : number >z : boolean @@ -21,7 +21,7 @@ function foo2( { x, y, z }?: { x: string; y: number; z: boolean }); >z : boolean function foo2(...rest: any[]) { ->foo2 : ({ x, y, z }?: { x: string; y: number; z: boolean; }) => any +>foo2 : ({x, y, z}?: { x: string; y: number; z: boolean; }) => any >rest : any[] } diff --git a/tests/baselines/reference/declarationEmitFirstTypeArgumentGenericFunctionType.js b/tests/baselines/reference/declarationEmitFirstTypeArgumentGenericFunctionType.js new file mode 100644 index 00000000000..b2bca641a5a --- /dev/null +++ b/tests/baselines/reference/declarationEmitFirstTypeArgumentGenericFunctionType.js @@ -0,0 +1,66 @@ +//// [declarationEmitFirstTypeArgumentGenericFunctionType.ts] + +class X { +} +var prop11: X< () => Tany >; // spaces before the first type argument +var prop12: X<(() => Tany)>; // spaces before the first type argument +function f1() { // Inferred return type + return prop11; +} +function f2() { // Inferred return type + return prop12; +} +function f3(): X< () => Tany> { // written with space before type argument + return prop11; +} +function f4(): X<(() => Tany)> { // written type with parenthesis + return prop12; +} +class Y { +} +var prop2: Y() => Tany>; // No space after second type argument +var prop2: Y() => Tany>; // space after second type argument +var prop3: Y< () => Tany, () => Tany>; // space before first type argument +var prop4: Y<(() => Tany), () => Tany>; // parenthesized first type argument + + +//// [declarationEmitFirstTypeArgumentGenericFunctionType.js] +class X { +} +var prop11; // spaces before the first type argument +var prop12; // spaces before the first type argument +function f1() { + return prop11; +} +function f2() { + return prop12; +} +function f3() { + return prop11; +} +function f4() { + return prop12; +} +class Y { +} +var prop2; // No space after second type argument +var prop2; // space after second type argument +var prop3; // space before first type argument +var prop4; // parenthesized first type argument + + +//// [declarationEmitFirstTypeArgumentGenericFunctionType.d.ts] +declare class X { +} +declare var prop11: X<(() => Tany)>; +declare var prop12: X<(() => Tany)>; +declare function f1(): X<(() => Tany)>; +declare function f2(): X<(() => Tany)>; +declare function f3(): X<(() => Tany)>; +declare function f4(): X<(() => Tany)>; +declare class Y { +} +declare var prop2: Y() => Tany>; +declare var prop2: Y() => Tany>; +declare var prop3: Y<(() => Tany), () => Tany>; +declare var prop4: Y<(() => Tany), () => Tany>; diff --git a/tests/baselines/reference/declarationEmitFirstTypeArgumentGenericFunctionType.symbols b/tests/baselines/reference/declarationEmitFirstTypeArgumentGenericFunctionType.symbols new file mode 100644 index 00000000000..ebbc2b764b0 --- /dev/null +++ b/tests/baselines/reference/declarationEmitFirstTypeArgumentGenericFunctionType.symbols @@ -0,0 +1,81 @@ +=== tests/cases/compiler/declarationEmitFirstTypeArgumentGenericFunctionType.ts === + +class X { +>X : Symbol(X, Decl(declarationEmitFirstTypeArgumentGenericFunctionType.ts, 0, 0)) +>A : Symbol(A, Decl(declarationEmitFirstTypeArgumentGenericFunctionType.ts, 1, 8)) +} +var prop11: X< () => Tany >; // spaces before the first type argument +>prop11 : Symbol(prop11, Decl(declarationEmitFirstTypeArgumentGenericFunctionType.ts, 3, 3)) +>X : Symbol(X, Decl(declarationEmitFirstTypeArgumentGenericFunctionType.ts, 0, 0)) +>Tany : Symbol(Tany, Decl(declarationEmitFirstTypeArgumentGenericFunctionType.ts, 3, 16)) +>Tany : Symbol(Tany, Decl(declarationEmitFirstTypeArgumentGenericFunctionType.ts, 3, 16)) + +var prop12: X<(() => Tany)>; // spaces before the first type argument +>prop12 : Symbol(prop12, Decl(declarationEmitFirstTypeArgumentGenericFunctionType.ts, 4, 3)) +>X : Symbol(X, Decl(declarationEmitFirstTypeArgumentGenericFunctionType.ts, 0, 0)) +>Tany : Symbol(Tany, Decl(declarationEmitFirstTypeArgumentGenericFunctionType.ts, 4, 16)) +>Tany : Symbol(Tany, Decl(declarationEmitFirstTypeArgumentGenericFunctionType.ts, 4, 16)) + +function f1() { // Inferred return type +>f1 : Symbol(f1, Decl(declarationEmitFirstTypeArgumentGenericFunctionType.ts, 4, 34)) + + return prop11; +>prop11 : Symbol(prop11, Decl(declarationEmitFirstTypeArgumentGenericFunctionType.ts, 3, 3)) +} +function f2() { // Inferred return type +>f2 : Symbol(f2, Decl(declarationEmitFirstTypeArgumentGenericFunctionType.ts, 7, 1)) + + return prop12; +>prop12 : Symbol(prop12, Decl(declarationEmitFirstTypeArgumentGenericFunctionType.ts, 4, 3)) +} +function f3(): X< () => Tany> { // written with space before type argument +>f3 : Symbol(f3, Decl(declarationEmitFirstTypeArgumentGenericFunctionType.ts, 10, 1)) +>X : Symbol(X, Decl(declarationEmitFirstTypeArgumentGenericFunctionType.ts, 0, 0)) +>Tany : Symbol(Tany, Decl(declarationEmitFirstTypeArgumentGenericFunctionType.ts, 11, 19)) +>Tany : Symbol(Tany, Decl(declarationEmitFirstTypeArgumentGenericFunctionType.ts, 11, 19)) + + return prop11; +>prop11 : Symbol(prop11, Decl(declarationEmitFirstTypeArgumentGenericFunctionType.ts, 3, 3)) +} +function f4(): X<(() => Tany)> { // written type with parenthesis +>f4 : Symbol(f4, Decl(declarationEmitFirstTypeArgumentGenericFunctionType.ts, 13, 1)) +>X : Symbol(X, Decl(declarationEmitFirstTypeArgumentGenericFunctionType.ts, 0, 0)) +>Tany : Symbol(Tany, Decl(declarationEmitFirstTypeArgumentGenericFunctionType.ts, 14, 19)) +>Tany : Symbol(Tany, Decl(declarationEmitFirstTypeArgumentGenericFunctionType.ts, 14, 19)) + + return prop12; +>prop12 : Symbol(prop12, Decl(declarationEmitFirstTypeArgumentGenericFunctionType.ts, 4, 3)) +} +class Y { +>Y : Symbol(Y, Decl(declarationEmitFirstTypeArgumentGenericFunctionType.ts, 16, 1)) +>A : Symbol(A, Decl(declarationEmitFirstTypeArgumentGenericFunctionType.ts, 17, 8)) +>B : Symbol(B, Decl(declarationEmitFirstTypeArgumentGenericFunctionType.ts, 17, 10)) +} +var prop2: Y() => Tany>; // No space after second type argument +>prop2 : Symbol(prop2, Decl(declarationEmitFirstTypeArgumentGenericFunctionType.ts, 19, 3), Decl(declarationEmitFirstTypeArgumentGenericFunctionType.ts, 20, 3)) +>Y : Symbol(Y, Decl(declarationEmitFirstTypeArgumentGenericFunctionType.ts, 16, 1)) +>Tany : Symbol(Tany, Decl(declarationEmitFirstTypeArgumentGenericFunctionType.ts, 19, 24)) +>Tany : Symbol(Tany, Decl(declarationEmitFirstTypeArgumentGenericFunctionType.ts, 19, 24)) + +var prop2: Y() => Tany>; // space after second type argument +>prop2 : Symbol(prop2, Decl(declarationEmitFirstTypeArgumentGenericFunctionType.ts, 19, 3), Decl(declarationEmitFirstTypeArgumentGenericFunctionType.ts, 20, 3)) +>Y : Symbol(Y, Decl(declarationEmitFirstTypeArgumentGenericFunctionType.ts, 16, 1)) +>Tany : Symbol(Tany, Decl(declarationEmitFirstTypeArgumentGenericFunctionType.ts, 20, 24)) +>Tany : Symbol(Tany, Decl(declarationEmitFirstTypeArgumentGenericFunctionType.ts, 20, 24)) + +var prop3: Y< () => Tany, () => Tany>; // space before first type argument +>prop3 : Symbol(prop3, Decl(declarationEmitFirstTypeArgumentGenericFunctionType.ts, 21, 3)) +>Y : Symbol(Y, Decl(declarationEmitFirstTypeArgumentGenericFunctionType.ts, 16, 1)) +>Tany : Symbol(Tany, Decl(declarationEmitFirstTypeArgumentGenericFunctionType.ts, 21, 15)) +>Tany : Symbol(Tany, Decl(declarationEmitFirstTypeArgumentGenericFunctionType.ts, 21, 15)) +>Tany : Symbol(Tany, Decl(declarationEmitFirstTypeArgumentGenericFunctionType.ts, 21, 33)) +>Tany : Symbol(Tany, Decl(declarationEmitFirstTypeArgumentGenericFunctionType.ts, 21, 33)) + +var prop4: Y<(() => Tany), () => Tany>; // parenthesized first type argument +>prop4 : Symbol(prop4, Decl(declarationEmitFirstTypeArgumentGenericFunctionType.ts, 22, 3)) +>Y : Symbol(Y, Decl(declarationEmitFirstTypeArgumentGenericFunctionType.ts, 16, 1)) +>Tany : Symbol(Tany, Decl(declarationEmitFirstTypeArgumentGenericFunctionType.ts, 22, 15)) +>Tany : Symbol(Tany, Decl(declarationEmitFirstTypeArgumentGenericFunctionType.ts, 22, 15)) +>Tany : Symbol(Tany, Decl(declarationEmitFirstTypeArgumentGenericFunctionType.ts, 22, 34)) +>Tany : Symbol(Tany, Decl(declarationEmitFirstTypeArgumentGenericFunctionType.ts, 22, 34)) + diff --git a/tests/baselines/reference/declarationEmitFirstTypeArgumentGenericFunctionType.types b/tests/baselines/reference/declarationEmitFirstTypeArgumentGenericFunctionType.types new file mode 100644 index 00000000000..4dd6ecba987 --- /dev/null +++ b/tests/baselines/reference/declarationEmitFirstTypeArgumentGenericFunctionType.types @@ -0,0 +1,81 @@ +=== tests/cases/compiler/declarationEmitFirstTypeArgumentGenericFunctionType.ts === + +class X { +>X : X +>A : A +} +var prop11: X< () => Tany >; // spaces before the first type argument +>prop11 : X<(() => Tany)> +>X : X +>Tany : Tany +>Tany : Tany + +var prop12: X<(() => Tany)>; // spaces before the first type argument +>prop12 : X<(() => Tany)> +>X : X +>Tany : Tany +>Tany : Tany + +function f1() { // Inferred return type +>f1 : () => X<(() => Tany)> + + return prop11; +>prop11 : X<(() => Tany)> +} +function f2() { // Inferred return type +>f2 : () => X<(() => Tany)> + + return prop12; +>prop12 : X<(() => Tany)> +} +function f3(): X< () => Tany> { // written with space before type argument +>f3 : () => X<(() => Tany)> +>X : X +>Tany : Tany +>Tany : Tany + + return prop11; +>prop11 : X<(() => Tany)> +} +function f4(): X<(() => Tany)> { // written type with parenthesis +>f4 : () => X<(() => Tany)> +>X : X +>Tany : Tany +>Tany : Tany + + return prop12; +>prop12 : X<(() => Tany)> +} +class Y { +>Y : Y +>A : A +>B : B +} +var prop2: Y() => Tany>; // No space after second type argument +>prop2 : Y() => Tany> +>Y : Y +>Tany : Tany +>Tany : Tany + +var prop2: Y() => Tany>; // space after second type argument +>prop2 : Y() => Tany> +>Y : Y +>Tany : Tany +>Tany : Tany + +var prop3: Y< () => Tany, () => Tany>; // space before first type argument +>prop3 : Y<(() => Tany), () => Tany> +>Y : Y +>Tany : Tany +>Tany : Tany +>Tany : Tany +>Tany : Tany + +var prop4: Y<(() => Tany), () => Tany>; // parenthesized first type argument +>prop4 : Y<(() => Tany), () => Tany> +>Y : Y +>Tany : Tany +>Tany : Tany +>Tany : Tany +>Tany : Tany + diff --git a/tests/baselines/reference/declarationEmitIdentifierPredicates01.js b/tests/baselines/reference/declarationEmitIdentifierPredicates01.js new file mode 100644 index 00000000000..73141eb9af9 --- /dev/null +++ b/tests/baselines/reference/declarationEmitIdentifierPredicates01.js @@ -0,0 +1,16 @@ +//// [declarationEmitIdentifierPredicates01.ts] + +export function f(x: any): x is number { + return typeof x === "number"; +} + +//// [declarationEmitIdentifierPredicates01.js] +"use strict"; +function f(x) { + return typeof x === "number"; +} +exports.f = f; + + +//// [declarationEmitIdentifierPredicates01.d.ts] +export declare function f(x: any): x is number; diff --git a/tests/baselines/reference/declarationEmitIdentifierPredicates01.symbols b/tests/baselines/reference/declarationEmitIdentifierPredicates01.symbols new file mode 100644 index 00000000000..eb8b1151ceb --- /dev/null +++ b/tests/baselines/reference/declarationEmitIdentifierPredicates01.symbols @@ -0,0 +1,10 @@ +=== tests/cases/conformance/declarationEmit/typePredicates/declarationEmitIdentifierPredicates01.ts === + +export function f(x: any): x is number { +>f : Symbol(f, Decl(declarationEmitIdentifierPredicates01.ts, 0, 0)) +>x : Symbol(x, Decl(declarationEmitIdentifierPredicates01.ts, 1, 18)) +>x : Symbol(x, Decl(declarationEmitIdentifierPredicates01.ts, 1, 18)) + + return typeof x === "number"; +>x : Symbol(x, Decl(declarationEmitIdentifierPredicates01.ts, 1, 18)) +} diff --git a/tests/baselines/reference/declarationEmitIdentifierPredicates01.types b/tests/baselines/reference/declarationEmitIdentifierPredicates01.types new file mode 100644 index 00000000000..7d8a5668265 --- /dev/null +++ b/tests/baselines/reference/declarationEmitIdentifierPredicates01.types @@ -0,0 +1,13 @@ +=== tests/cases/conformance/declarationEmit/typePredicates/declarationEmitIdentifierPredicates01.ts === + +export function f(x: any): x is number { +>f : (x: any) => x is number +>x : any +>x : any + + return typeof x === "number"; +>typeof x === "number" : boolean +>typeof x : string +>x : any +>"number" : string +} diff --git a/tests/baselines/reference/declarationEmitIdentifierPredicatesWithPrivateName01.errors.txt b/tests/baselines/reference/declarationEmitIdentifierPredicatesWithPrivateName01.errors.txt new file mode 100644 index 00000000000..e9084c45490 --- /dev/null +++ b/tests/baselines/reference/declarationEmitIdentifierPredicatesWithPrivateName01.errors.txt @@ -0,0 +1,14 @@ +tests/cases/conformance/declarationEmit/typePredicates/declarationEmitIdentifierPredicatesWithPrivateName01.ts(6,33): error TS4060: Return type of exported function has or is using private name 'I'. + + +==== tests/cases/conformance/declarationEmit/typePredicates/declarationEmitIdentifierPredicatesWithPrivateName01.ts (1 errors) ==== + + interface I { + a: number; + } + + export function f(x: any): x is I { + ~ +!!! error TS4060: Return type of exported function has or is using private name 'I'. + return typeof x.a === "number"; + } \ No newline at end of file diff --git a/tests/baselines/reference/declarationEmitIdentifierPredicatesWithPrivateName01.js b/tests/baselines/reference/declarationEmitIdentifierPredicatesWithPrivateName01.js new file mode 100644 index 00000000000..234542d8d99 --- /dev/null +++ b/tests/baselines/reference/declarationEmitIdentifierPredicatesWithPrivateName01.js @@ -0,0 +1,16 @@ +//// [declarationEmitIdentifierPredicatesWithPrivateName01.ts] + +interface I { + a: number; +} + +export function f(x: any): x is I { + return typeof x.a === "number"; +} + +//// [declarationEmitIdentifierPredicatesWithPrivateName01.js] +"use strict"; +function f(x) { + return typeof x.a === "number"; +} +exports.f = f; diff --git a/tests/baselines/reference/declarationEmitPromise.js b/tests/baselines/reference/declarationEmitPromise.js new file mode 100644 index 00000000000..a4bbdd74dde --- /dev/null +++ b/tests/baselines/reference/declarationEmitPromise.js @@ -0,0 +1,63 @@ +//// [declarationEmitPromise.ts] + +export class bluebird { + static all: Array>; +} + +export async function runSampleWorks( + a: bluebird, b?: bluebird, c?: bluebird, d?: bluebird, e?: bluebird) { + let result = await (bluebird.all as any)([a, b, c, d, e].filter(el => !!el)); + let func = (f: (a: A, b?: B, c?: C, d?: D, e?: E) => T): T => + f.apply(this, result); + let rfunc: typeof func & {} = func as any; // <- This is the only difference + return rfunc +} + +export async function runSampleBreaks( + a: bluebird, b?: bluebird, c?: bluebird, d?: bluebird, e?: bluebird) { + let result = await (bluebird.all as any)([a, b, c, d, e].filter(el => !!el)); + let func = (f: (a: A, b?: B, c?: C, d?: D, e?: E) => T): T => + f.apply(this, result); + let rfunc: typeof func = func as any; // <- This is the only difference + return rfunc +} + +//// [declarationEmitPromise.js] +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator.throw(value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments)).next()); + }); +}; +class bluebird { +} +exports.bluebird = bluebird; +function runSampleWorks(a, b, c, d, e) { + return __awaiter(this, void 0, void 0, function* () { + let result = yield bluebird.all([a, b, c, d, e].filter(el => !!el)); + let func = (f) => f.apply(this, result); + let rfunc = func; // <- This is the only difference + return rfunc; + }); +} +exports.runSampleWorks = runSampleWorks; +function runSampleBreaks(a, b, c, d, e) { + return __awaiter(this, void 0, void 0, function* () { + let result = yield bluebird.all([a, b, c, d, e].filter(el => !!el)); + let func = (f) => f.apply(this, result); + let rfunc = func; // <- This is the only difference + return rfunc; + }); +} +exports.runSampleBreaks = runSampleBreaks; + + +//// [declarationEmitPromise.d.ts] +export declare class bluebird { + static all: Array>; +} +export declare function runSampleWorks(a: bluebird, b?: bluebird, c?: bluebird, d?: bluebird, e?: bluebird): Promise<((f: (a: A, b?: B, c?: C, d?: D, e?: E) => T) => T) & {}>; +export declare function runSampleBreaks(a: bluebird, b?: bluebird, c?: bluebird, d?: bluebird, e?: bluebird): Promise<((f: (a: A, b?: B, c?: C, d?: D, e?: E) => T) => T)>; diff --git a/tests/baselines/reference/declarationEmitPromise.symbols b/tests/baselines/reference/declarationEmitPromise.symbols new file mode 100644 index 00000000000..2c37e1dfa78 --- /dev/null +++ b/tests/baselines/reference/declarationEmitPromise.symbols @@ -0,0 +1,155 @@ +=== tests/cases/compiler/declarationEmitPromise.ts === + +export class bluebird { +>bluebird : Symbol(bluebird, Decl(declarationEmitPromise.ts, 0, 0)) +>T : Symbol(T, Decl(declarationEmitPromise.ts, 1, 22)) + + static all: Array>; +>all : Symbol(bluebird.all, Decl(declarationEmitPromise.ts, 1, 26)) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>bluebird : Symbol(bluebird, Decl(declarationEmitPromise.ts, 0, 0)) +} + +export async function runSampleWorks( +>runSampleWorks : Symbol(runSampleWorks, Decl(declarationEmitPromise.ts, 3, 1)) +>A : Symbol(A, Decl(declarationEmitPromise.ts, 5, 37)) +>B : Symbol(B, Decl(declarationEmitPromise.ts, 5, 39)) +>C : Symbol(C, Decl(declarationEmitPromise.ts, 5, 42)) +>D : Symbol(D, Decl(declarationEmitPromise.ts, 5, 45)) +>E : Symbol(E, Decl(declarationEmitPromise.ts, 5, 48)) + + a: bluebird, b?: bluebird, c?: bluebird, d?: bluebird, e?: bluebird) { +>a : Symbol(a, Decl(declarationEmitPromise.ts, 5, 52)) +>bluebird : Symbol(bluebird, Decl(declarationEmitPromise.ts, 0, 0)) +>A : Symbol(A, Decl(declarationEmitPromise.ts, 5, 37)) +>b : Symbol(b, Decl(declarationEmitPromise.ts, 6, 19)) +>bluebird : Symbol(bluebird, Decl(declarationEmitPromise.ts, 0, 0)) +>B : Symbol(B, Decl(declarationEmitPromise.ts, 5, 39)) +>c : Symbol(c, Decl(declarationEmitPromise.ts, 6, 36)) +>bluebird : Symbol(bluebird, Decl(declarationEmitPromise.ts, 0, 0)) +>C : Symbol(C, Decl(declarationEmitPromise.ts, 5, 42)) +>d : Symbol(d, Decl(declarationEmitPromise.ts, 6, 53)) +>bluebird : Symbol(bluebird, Decl(declarationEmitPromise.ts, 0, 0)) +>D : Symbol(D, Decl(declarationEmitPromise.ts, 5, 45)) +>e : Symbol(e, Decl(declarationEmitPromise.ts, 6, 70)) +>bluebird : Symbol(bluebird, Decl(declarationEmitPromise.ts, 0, 0)) +>E : Symbol(E, Decl(declarationEmitPromise.ts, 5, 48)) + + let result = await (bluebird.all as any)([a, b, c, d, e].filter(el => !!el)); +>result : Symbol(result, Decl(declarationEmitPromise.ts, 7, 7)) +>bluebird.all : Symbol(bluebird.all, Decl(declarationEmitPromise.ts, 1, 26)) +>bluebird : Symbol(bluebird, Decl(declarationEmitPromise.ts, 0, 0)) +>all : Symbol(bluebird.all, Decl(declarationEmitPromise.ts, 1, 26)) +>[a, b, c, d, e].filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --)) +>a : Symbol(a, Decl(declarationEmitPromise.ts, 5, 52)) +>b : Symbol(b, Decl(declarationEmitPromise.ts, 6, 19)) +>c : Symbol(c, Decl(declarationEmitPromise.ts, 6, 36)) +>d : Symbol(d, Decl(declarationEmitPromise.ts, 6, 53)) +>e : Symbol(e, Decl(declarationEmitPromise.ts, 6, 70)) +>filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --)) +>el : Symbol(el, Decl(declarationEmitPromise.ts, 7, 68)) +>el : Symbol(el, Decl(declarationEmitPromise.ts, 7, 68)) + + let func = (f: (a: A, b?: B, c?: C, d?: D, e?: E) => T): T => +>func : Symbol(func, Decl(declarationEmitPromise.ts, 8, 7)) +>T : Symbol(T, Decl(declarationEmitPromise.ts, 8, 16)) +>f : Symbol(f, Decl(declarationEmitPromise.ts, 8, 19)) +>a : Symbol(a, Decl(declarationEmitPromise.ts, 8, 23)) +>A : Symbol(A, Decl(declarationEmitPromise.ts, 5, 37)) +>b : Symbol(b, Decl(declarationEmitPromise.ts, 8, 28)) +>B : Symbol(B, Decl(declarationEmitPromise.ts, 5, 39)) +>c : Symbol(c, Decl(declarationEmitPromise.ts, 8, 35)) +>C : Symbol(C, Decl(declarationEmitPromise.ts, 5, 42)) +>d : Symbol(d, Decl(declarationEmitPromise.ts, 8, 42)) +>D : Symbol(D, Decl(declarationEmitPromise.ts, 5, 45)) +>e : Symbol(e, Decl(declarationEmitPromise.ts, 8, 49)) +>E : Symbol(E, Decl(declarationEmitPromise.ts, 5, 48)) +>T : Symbol(T, Decl(declarationEmitPromise.ts, 8, 16)) +>T : Symbol(T, Decl(declarationEmitPromise.ts, 8, 16)) + + f.apply(this, result); +>f.apply : Symbol(Function.apply, Decl(lib.es5.d.ts, --, --)) +>f : Symbol(f, Decl(declarationEmitPromise.ts, 8, 19)) +>apply : Symbol(Function.apply, Decl(lib.es5.d.ts, --, --)) +>result : Symbol(result, Decl(declarationEmitPromise.ts, 7, 7)) + + let rfunc: typeof func & {} = func as any; // <- This is the only difference +>rfunc : Symbol(rfunc, Decl(declarationEmitPromise.ts, 10, 7)) +>func : Symbol(func, Decl(declarationEmitPromise.ts, 8, 7)) +>func : Symbol(func, Decl(declarationEmitPromise.ts, 8, 7)) + + return rfunc +>rfunc : Symbol(rfunc, Decl(declarationEmitPromise.ts, 10, 7)) +} + +export async function runSampleBreaks( +>runSampleBreaks : Symbol(runSampleBreaks, Decl(declarationEmitPromise.ts, 12, 1)) +>A : Symbol(A, Decl(declarationEmitPromise.ts, 14, 38)) +>B : Symbol(B, Decl(declarationEmitPromise.ts, 14, 40)) +>C : Symbol(C, Decl(declarationEmitPromise.ts, 14, 43)) +>D : Symbol(D, Decl(declarationEmitPromise.ts, 14, 46)) +>E : Symbol(E, Decl(declarationEmitPromise.ts, 14, 49)) + + a: bluebird, b?: bluebird, c?: bluebird, d?: bluebird, e?: bluebird) { +>a : Symbol(a, Decl(declarationEmitPromise.ts, 14, 53)) +>bluebird : Symbol(bluebird, Decl(declarationEmitPromise.ts, 0, 0)) +>A : Symbol(A, Decl(declarationEmitPromise.ts, 14, 38)) +>b : Symbol(b, Decl(declarationEmitPromise.ts, 15, 19)) +>bluebird : Symbol(bluebird, Decl(declarationEmitPromise.ts, 0, 0)) +>B : Symbol(B, Decl(declarationEmitPromise.ts, 14, 40)) +>c : Symbol(c, Decl(declarationEmitPromise.ts, 15, 36)) +>bluebird : Symbol(bluebird, Decl(declarationEmitPromise.ts, 0, 0)) +>C : Symbol(C, Decl(declarationEmitPromise.ts, 14, 43)) +>d : Symbol(d, Decl(declarationEmitPromise.ts, 15, 53)) +>bluebird : Symbol(bluebird, Decl(declarationEmitPromise.ts, 0, 0)) +>D : Symbol(D, Decl(declarationEmitPromise.ts, 14, 46)) +>e : Symbol(e, Decl(declarationEmitPromise.ts, 15, 70)) +>bluebird : Symbol(bluebird, Decl(declarationEmitPromise.ts, 0, 0)) +>E : Symbol(E, Decl(declarationEmitPromise.ts, 14, 49)) + + let result = await (bluebird.all as any)([a, b, c, d, e].filter(el => !!el)); +>result : Symbol(result, Decl(declarationEmitPromise.ts, 16, 7)) +>bluebird.all : Symbol(bluebird.all, Decl(declarationEmitPromise.ts, 1, 26)) +>bluebird : Symbol(bluebird, Decl(declarationEmitPromise.ts, 0, 0)) +>all : Symbol(bluebird.all, Decl(declarationEmitPromise.ts, 1, 26)) +>[a, b, c, d, e].filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --)) +>a : Symbol(a, Decl(declarationEmitPromise.ts, 14, 53)) +>b : Symbol(b, Decl(declarationEmitPromise.ts, 15, 19)) +>c : Symbol(c, Decl(declarationEmitPromise.ts, 15, 36)) +>d : Symbol(d, Decl(declarationEmitPromise.ts, 15, 53)) +>e : Symbol(e, Decl(declarationEmitPromise.ts, 15, 70)) +>filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --)) +>el : Symbol(el, Decl(declarationEmitPromise.ts, 16, 68)) +>el : Symbol(el, Decl(declarationEmitPromise.ts, 16, 68)) + + let func = (f: (a: A, b?: B, c?: C, d?: D, e?: E) => T): T => +>func : Symbol(func, Decl(declarationEmitPromise.ts, 17, 7)) +>T : Symbol(T, Decl(declarationEmitPromise.ts, 17, 16)) +>f : Symbol(f, Decl(declarationEmitPromise.ts, 17, 19)) +>a : Symbol(a, Decl(declarationEmitPromise.ts, 17, 23)) +>A : Symbol(A, Decl(declarationEmitPromise.ts, 14, 38)) +>b : Symbol(b, Decl(declarationEmitPromise.ts, 17, 28)) +>B : Symbol(B, Decl(declarationEmitPromise.ts, 14, 40)) +>c : Symbol(c, Decl(declarationEmitPromise.ts, 17, 35)) +>C : Symbol(C, Decl(declarationEmitPromise.ts, 14, 43)) +>d : Symbol(d, Decl(declarationEmitPromise.ts, 17, 42)) +>D : Symbol(D, Decl(declarationEmitPromise.ts, 14, 46)) +>e : Symbol(e, Decl(declarationEmitPromise.ts, 17, 49)) +>E : Symbol(E, Decl(declarationEmitPromise.ts, 14, 49)) +>T : Symbol(T, Decl(declarationEmitPromise.ts, 17, 16)) +>T : Symbol(T, Decl(declarationEmitPromise.ts, 17, 16)) + + f.apply(this, result); +>f.apply : Symbol(Function.apply, Decl(lib.es5.d.ts, --, --)) +>f : Symbol(f, Decl(declarationEmitPromise.ts, 17, 19)) +>apply : Symbol(Function.apply, Decl(lib.es5.d.ts, --, --)) +>result : Symbol(result, Decl(declarationEmitPromise.ts, 16, 7)) + + let rfunc: typeof func = func as any; // <- This is the only difference +>rfunc : Symbol(rfunc, Decl(declarationEmitPromise.ts, 19, 7)) +>func : Symbol(func, Decl(declarationEmitPromise.ts, 17, 7)) +>func : Symbol(func, Decl(declarationEmitPromise.ts, 17, 7)) + + return rfunc +>rfunc : Symbol(rfunc, Decl(declarationEmitPromise.ts, 19, 7)) +} diff --git a/tests/baselines/reference/declarationEmitPromise.types b/tests/baselines/reference/declarationEmitPromise.types new file mode 100644 index 00000000000..4edaa444326 --- /dev/null +++ b/tests/baselines/reference/declarationEmitPromise.types @@ -0,0 +1,181 @@ +=== tests/cases/compiler/declarationEmitPromise.ts === + +export class bluebird { +>bluebird : bluebird +>T : T + + static all: Array>; +>all : bluebird[] +>Array : T[] +>bluebird : bluebird +} + +export async function runSampleWorks( +>runSampleWorks : (a: bluebird, b?: bluebird, c?: bluebird, d?: bluebird, e?: bluebird) => Promise<((f: (a: A, b?: B, c?: C, d?: D, e?: E) => T) => T) & {}> +>A : A +>B : B +>C : C +>D : D +>E : E + + a: bluebird, b?: bluebird, c?: bluebird, d?: bluebird, e?: bluebird) { +>a : bluebird +>bluebird : bluebird +>A : A +>b : bluebird +>bluebird : bluebird +>B : B +>c : bluebird +>bluebird : bluebird +>C : C +>d : bluebird +>bluebird : bluebird +>D : D +>e : bluebird +>bluebird : bluebird +>E : E + + let result = await (bluebird.all as any)([a, b, c, d, e].filter(el => !!el)); +>result : any +>await (bluebird.all as any)([a, b, c, d, e].filter(el => !!el)) : any +>(bluebird.all as any)([a, b, c, d, e].filter(el => !!el)) : any +>(bluebird.all as any) : any +>bluebird.all as any : any +>bluebird.all : bluebird[] +>bluebird : typeof bluebird +>all : bluebird[] +>[a, b, c, d, e].filter(el => !!el) : bluebird[] +>[a, b, c, d, e].filter : (callbackfn: (value: bluebird, index: number, array: bluebird[]) => any, thisArg?: any) => bluebird[] +>[a, b, c, d, e] : bluebird[] +>a : bluebird +>b : bluebird +>c : bluebird +>d : bluebird +>e : bluebird +>filter : (callbackfn: (value: bluebird, index: number, array: bluebird[]) => any, thisArg?: any) => bluebird[] +>el => !!el : (el: bluebird) => boolean +>el : bluebird +>!!el : boolean +>!el : boolean +>el : bluebird + + let func = (f: (a: A, b?: B, c?: C, d?: D, e?: E) => T): T => +>func : (f: (a: A, b?: B, c?: C, d?: D, e?: E) => T) => T +>(f: (a: A, b?: B, c?: C, d?: D, e?: E) => T): T => f.apply(this, result) : (f: (a: A, b?: B, c?: C, d?: D, e?: E) => T) => T +>T : T +>f : (a: A, b?: B, c?: C, d?: D, e?: E) => T +>a : A +>A : A +>b : B +>B : B +>c : C +>C : C +>d : D +>D : D +>e : E +>E : E +>T : T +>T : T + + f.apply(this, result); +>f.apply(this, result) : any +>f.apply : (this: Function, thisArg: any, argArray?: any) => any +>f : (a: A, b?: B, c?: C, d?: D, e?: E) => T +>apply : (this: Function, thisArg: any, argArray?: any) => any +>this : any +>result : any + + let rfunc: typeof func & {} = func as any; // <- This is the only difference +>rfunc : ((f: (a: A, b?: B, c?: C, d?: D, e?: E) => T) => T) & {} +>func : (f: (a: A, b?: B, c?: C, d?: D, e?: E) => T) => T +>func as any : any +>func : (f: (a: A, b?: B, c?: C, d?: D, e?: E) => T) => T + + return rfunc +>rfunc : ((f: (a: A, b?: B, c?: C, d?: D, e?: E) => T) => T) & {} +} + +export async function runSampleBreaks( +>runSampleBreaks : (a: bluebird, b?: bluebird, c?: bluebird, d?: bluebird, e?: bluebird) => Promise<((f: (a: A, b?: B, c?: C, d?: D, e?: E) => T) => T)> +>A : A +>B : B +>C : C +>D : D +>E : E + + a: bluebird, b?: bluebird, c?: bluebird, d?: bluebird, e?: bluebird) { +>a : bluebird +>bluebird : bluebird +>A : A +>b : bluebird +>bluebird : bluebird +>B : B +>c : bluebird +>bluebird : bluebird +>C : C +>d : bluebird +>bluebird : bluebird +>D : D +>e : bluebird +>bluebird : bluebird +>E : E + + let result = await (bluebird.all as any)([a, b, c, d, e].filter(el => !!el)); +>result : any +>await (bluebird.all as any)([a, b, c, d, e].filter(el => !!el)) : any +>(bluebird.all as any)([a, b, c, d, e].filter(el => !!el)) : any +>(bluebird.all as any) : any +>bluebird.all as any : any +>bluebird.all : bluebird[] +>bluebird : typeof bluebird +>all : bluebird[] +>[a, b, c, d, e].filter(el => !!el) : bluebird[] +>[a, b, c, d, e].filter : (callbackfn: (value: bluebird, index: number, array: bluebird[]) => any, thisArg?: any) => bluebird[] +>[a, b, c, d, e] : bluebird[] +>a : bluebird +>b : bluebird +>c : bluebird +>d : bluebird +>e : bluebird +>filter : (callbackfn: (value: bluebird, index: number, array: bluebird[]) => any, thisArg?: any) => bluebird[] +>el => !!el : (el: bluebird) => boolean +>el : bluebird +>!!el : boolean +>!el : boolean +>el : bluebird + + let func = (f: (a: A, b?: B, c?: C, d?: D, e?: E) => T): T => +>func : (f: (a: A, b?: B, c?: C, d?: D, e?: E) => T) => T +>(f: (a: A, b?: B, c?: C, d?: D, e?: E) => T): T => f.apply(this, result) : (f: (a: A, b?: B, c?: C, d?: D, e?: E) => T) => T +>T : T +>f : (a: A, b?: B, c?: C, d?: D, e?: E) => T +>a : A +>A : A +>b : B +>B : B +>c : C +>C : C +>d : D +>D : D +>e : E +>E : E +>T : T +>T : T + + f.apply(this, result); +>f.apply(this, result) : any +>f.apply : (this: Function, thisArg: any, argArray?: any) => any +>f : (a: A, b?: B, c?: C, d?: D, e?: E) => T +>apply : (this: Function, thisArg: any, argArray?: any) => any +>this : any +>result : any + + let rfunc: typeof func = func as any; // <- This is the only difference +>rfunc : (f: (a: A, b?: B, c?: C, d?: D, e?: E) => T) => T +>func : (f: (a: A, b?: B, c?: C, d?: D, e?: E) => T) => T +>func as any : any +>func : (f: (a: A, b?: B, c?: C, d?: D, e?: E) => T) => T + + return rfunc +>rfunc : (f: (a: A, b?: B, c?: C, d?: D, e?: E) => T) => T +} diff --git a/tests/baselines/reference/declarationEmitThisPredicates01.js b/tests/baselines/reference/declarationEmitThisPredicates01.js new file mode 100644 index 00000000000..d05b5c46dad --- /dev/null +++ b/tests/baselines/reference/declarationEmitThisPredicates01.js @@ -0,0 +1,43 @@ +//// [declarationEmitThisPredicates01.ts] + +export class C { + m(): this is D { + return this instanceof D; + } +} + +export class D extends C { +} + +//// [declarationEmitThisPredicates01.js] +"use strict"; +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var C = (function () { + function C() { + } + C.prototype.m = function () { + return this instanceof D; + }; + return C; +}()); +exports.C = C; +var D = (function (_super) { + __extends(D, _super); + function D() { + _super.apply(this, arguments); + } + return D; +}(C)); +exports.D = D; + + +//// [declarationEmitThisPredicates01.d.ts] +export declare class C { + m(): this is D; +} +export declare class D extends C { +} diff --git a/tests/baselines/reference/declarationEmitThisPredicates01.symbols b/tests/baselines/reference/declarationEmitThisPredicates01.symbols new file mode 100644 index 00000000000..af5da751b8c --- /dev/null +++ b/tests/baselines/reference/declarationEmitThisPredicates01.symbols @@ -0,0 +1,19 @@ +=== tests/cases/conformance/declarationEmit/typePredicates/declarationEmitThisPredicates01.ts === + +export class C { +>C : Symbol(C, Decl(declarationEmitThisPredicates01.ts, 0, 0)) + + m(): this is D { +>m : Symbol(C.m, Decl(declarationEmitThisPredicates01.ts, 1, 16)) +>D : Symbol(D, Decl(declarationEmitThisPredicates01.ts, 5, 1)) + + return this instanceof D; +>this : Symbol(C, Decl(declarationEmitThisPredicates01.ts, 0, 0)) +>D : Symbol(D, Decl(declarationEmitThisPredicates01.ts, 5, 1)) + } +} + +export class D extends C { +>D : Symbol(D, Decl(declarationEmitThisPredicates01.ts, 5, 1)) +>C : Symbol(C, Decl(declarationEmitThisPredicates01.ts, 0, 0)) +} diff --git a/tests/baselines/reference/declarationEmitThisPredicates01.types b/tests/baselines/reference/declarationEmitThisPredicates01.types new file mode 100644 index 00000000000..9d801a40965 --- /dev/null +++ b/tests/baselines/reference/declarationEmitThisPredicates01.types @@ -0,0 +1,20 @@ +=== tests/cases/conformance/declarationEmit/typePredicates/declarationEmitThisPredicates01.ts === + +export class C { +>C : C + + m(): this is D { +>m : () => this is D +>D : D + + return this instanceof D; +>this instanceof D : boolean +>this : this +>D : typeof D + } +} + +export class D extends C { +>D : D +>C : C +} diff --git a/tests/baselines/reference/declarationEmitThisPredicates02.errors.txt b/tests/baselines/reference/declarationEmitThisPredicates02.errors.txt new file mode 100644 index 00000000000..4d95cf01136 --- /dev/null +++ b/tests/baselines/reference/declarationEmitThisPredicates02.errors.txt @@ -0,0 +1,19 @@ +tests/cases/conformance/declarationEmit/typePredicates/declarationEmitThisPredicates02.ts(9,10): error TS2526: A 'this' type is available only in a non-static member of a class or interface. + + +==== tests/cases/conformance/declarationEmit/typePredicates/declarationEmitThisPredicates02.ts (1 errors) ==== + + export interface Foo { + a: string; + b: number; + c: boolean; + } + + export const obj = { + m(): this is Foo { + ~~~~ +!!! error TS2526: A 'this' type is available only in a non-static member of a class or interface. + let dis = this as Foo; + return dis.a != null && dis.b != null && dis.c != null; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/declarationEmitThisPredicates02.js b/tests/baselines/reference/declarationEmitThisPredicates02.js new file mode 100644 index 00000000000..e938a615b6d --- /dev/null +++ b/tests/baselines/reference/declarationEmitThisPredicates02.js @@ -0,0 +1,34 @@ +//// [declarationEmitThisPredicates02.ts] + +export interface Foo { + a: string; + b: number; + c: boolean; +} + +export const obj = { + m(): this is Foo { + let dis = this as Foo; + return dis.a != null && dis.b != null && dis.c != null; + } +} + +//// [declarationEmitThisPredicates02.js] +"use strict"; +exports.obj = { + m: function () { + var dis = this; + return dis.a != null && dis.b != null && dis.c != null; + } +}; + + +//// [declarationEmitThisPredicates02.d.ts] +export interface Foo { + a: string; + b: number; + c: boolean; +} +export declare const obj: { + m(): this is Foo; +}; diff --git a/tests/baselines/reference/declarationEmitThisPredicatesWithPrivateName01.errors.txt b/tests/baselines/reference/declarationEmitThisPredicatesWithPrivateName01.errors.txt new file mode 100644 index 00000000000..67c76283f80 --- /dev/null +++ b/tests/baselines/reference/declarationEmitThisPredicatesWithPrivateName01.errors.txt @@ -0,0 +1,15 @@ +tests/cases/conformance/declarationEmit/typePredicates/declarationEmitThisPredicatesWithPrivateName01.ts(3,18): error TS4055: Return type of public method from exported class has or is using private name 'D'. + + +==== tests/cases/conformance/declarationEmit/typePredicates/declarationEmitThisPredicatesWithPrivateName01.ts (1 errors) ==== + + export class C { + m(): this is D { + ~ +!!! error TS4055: Return type of public method from exported class has or is using private name 'D'. + return this instanceof D; + } + } + + class D extends C { + } \ No newline at end of file diff --git a/tests/baselines/reference/declarationEmitThisPredicatesWithPrivateName01.js b/tests/baselines/reference/declarationEmitThisPredicatesWithPrivateName01.js new file mode 100644 index 00000000000..e34dcc9810f --- /dev/null +++ b/tests/baselines/reference/declarationEmitThisPredicatesWithPrivateName01.js @@ -0,0 +1,34 @@ +//// [declarationEmitThisPredicatesWithPrivateName01.ts] + +export class C { + m(): this is D { + return this instanceof D; + } +} + +class D extends C { +} + +//// [declarationEmitThisPredicatesWithPrivateName01.js] +"use strict"; +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var C = (function () { + function C() { + } + C.prototype.m = function () { + return this instanceof D; + }; + return C; +}()); +exports.C = C; +var D = (function (_super) { + __extends(D, _super); + function D() { + _super.apply(this, arguments); + } + return D; +}(C)); diff --git a/tests/baselines/reference/declarationEmitThisPredicatesWithPrivateName02.errors.txt b/tests/baselines/reference/declarationEmitThisPredicatesWithPrivateName02.errors.txt new file mode 100644 index 00000000000..86c0f478133 --- /dev/null +++ b/tests/baselines/reference/declarationEmitThisPredicatesWithPrivateName02.errors.txt @@ -0,0 +1,22 @@ +tests/cases/conformance/declarationEmit/typePredicates/declarationEmitThisPredicatesWithPrivateName02.ts(8,14): error TS4025: Exported variable 'obj' has or is using private name 'Foo'. +tests/cases/conformance/declarationEmit/typePredicates/declarationEmitThisPredicatesWithPrivateName02.ts(9,10): error TS2526: A 'this' type is available only in a non-static member of a class or interface. + + +==== tests/cases/conformance/declarationEmit/typePredicates/declarationEmitThisPredicatesWithPrivateName02.ts (2 errors) ==== + + interface Foo { + a: string; + b: number; + c: boolean; + } + + export const obj = { + ~~~ +!!! error TS4025: Exported variable 'obj' has or is using private name 'Foo'. + m(): this is Foo { + ~~~~ +!!! error TS2526: A 'this' type is available only in a non-static member of a class or interface. + let dis = this as Foo; + return dis.a != null && dis.b != null && dis.c != null; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/declarationEmitThisPredicatesWithPrivateName02.js b/tests/baselines/reference/declarationEmitThisPredicatesWithPrivateName02.js new file mode 100644 index 00000000000..df0d5b7903a --- /dev/null +++ b/tests/baselines/reference/declarationEmitThisPredicatesWithPrivateName02.js @@ -0,0 +1,23 @@ +//// [declarationEmitThisPredicatesWithPrivateName02.ts] + +interface Foo { + a: string; + b: number; + c: boolean; +} + +export const obj = { + m(): this is Foo { + let dis = this as Foo; + return dis.a != null && dis.b != null && dis.c != null; + } +} + +//// [declarationEmitThisPredicatesWithPrivateName02.js] +"use strict"; +exports.obj = { + m: function () { + var dis = this; + return dis.a != null && dis.b != null && dis.c != null; + } +}; diff --git a/tests/baselines/reference/declarationEmit_UnknownImport.errors.txt b/tests/baselines/reference/declarationEmit_UnknownImport.errors.txt new file mode 100644 index 00000000000..9d333e66129 --- /dev/null +++ b/tests/baselines/reference/declarationEmit_UnknownImport.errors.txt @@ -0,0 +1,15 @@ +tests/cases/compiler/declarationEmit_UnknownImport.ts(2,14): error TS2304: Cannot find name 'SomeNonExistingName'. +tests/cases/compiler/declarationEmit_UnknownImport.ts(2,14): error TS2503: Cannot find namespace 'SomeNonExistingName'. +tests/cases/compiler/declarationEmit_UnknownImport.ts(2,14): error TS4000: Import declaration 'Foo' is using private name 'SomeNonExistingName'. + + +==== tests/cases/compiler/declarationEmit_UnknownImport.ts (3 errors) ==== + + import Foo = SomeNonExistingName + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'SomeNonExistingName'. + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2503: Cannot find namespace 'SomeNonExistingName'. + ~~~~~~~~~~~~~~~~~~~ +!!! error TS4000: Import declaration 'Foo' is using private name 'SomeNonExistingName'. + export {Foo} \ No newline at end of file diff --git a/tests/baselines/reference/declarationEmit_UnknownImport.js b/tests/baselines/reference/declarationEmit_UnknownImport.js new file mode 100644 index 00000000000..05449c08b6a --- /dev/null +++ b/tests/baselines/reference/declarationEmit_UnknownImport.js @@ -0,0 +1,9 @@ +//// [declarationEmit_UnknownImport.ts] + +import Foo = SomeNonExistingName +export {Foo} + +//// [declarationEmit_UnknownImport.js] +"use strict"; +var Foo = SomeNonExistingName; +exports.Foo = Foo; diff --git a/tests/baselines/reference/declarationEmit_UnknownImport2.errors.txt b/tests/baselines/reference/declarationEmit_UnknownImport2.errors.txt new file mode 100644 index 00000000000..72dbde546f1 --- /dev/null +++ b/tests/baselines/reference/declarationEmit_UnknownImport2.errors.txt @@ -0,0 +1,21 @@ +tests/cases/compiler/declarationEmit_UnknownImport2.ts(2,12): error TS1005: '=' expected. +tests/cases/compiler/declarationEmit_UnknownImport2.ts(2,12): error TS2304: Cannot find name 'From'. +tests/cases/compiler/declarationEmit_UnknownImport2.ts(2,12): error TS2503: Cannot find namespace 'From'. +tests/cases/compiler/declarationEmit_UnknownImport2.ts(2,12): error TS4000: Import declaration 'Foo' is using private name 'From'. +tests/cases/compiler/declarationEmit_UnknownImport2.ts(2,17): error TS1005: ';' expected. + + +==== tests/cases/compiler/declarationEmit_UnknownImport2.ts (5 errors) ==== + + import Foo From './Foo'; // Syntax error + ~~~~ +!!! error TS1005: '=' expected. + ~~~~ +!!! error TS2304: Cannot find name 'From'. + ~~~~ +!!! error TS2503: Cannot find namespace 'From'. + ~~~~ +!!! error TS4000: Import declaration 'Foo' is using private name 'From'. + ~~~~~~~ +!!! error TS1005: ';' expected. + export default Foo \ No newline at end of file diff --git a/tests/baselines/reference/declarationEmit_UnknownImport2.js b/tests/baselines/reference/declarationEmit_UnknownImport2.js new file mode 100644 index 00000000000..7f20d9ec9b8 --- /dev/null +++ b/tests/baselines/reference/declarationEmit_UnknownImport2.js @@ -0,0 +1,11 @@ +//// [declarationEmit_UnknownImport2.ts] + +import Foo From './Foo'; // Syntax error +export default Foo + +//// [declarationEmit_UnknownImport2.js] +"use strict"; +var Foo = From; +'./Foo'; // Syntax error +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = Foo; diff --git a/tests/baselines/reference/declarationEmit_bindingPatterns.js b/tests/baselines/reference/declarationEmit_bindingPatterns.js new file mode 100644 index 00000000000..c2063ead215 --- /dev/null +++ b/tests/baselines/reference/declarationEmit_bindingPatterns.js @@ -0,0 +1,26 @@ +//// [declarationEmit_bindingPatterns.ts] + +const k = ({x: z = 'y'}) => { } + +var a; +function f({} = a, [] = a, { p: {} = a} = a) { +} + +//// [declarationEmit_bindingPatterns.js] +var k = function (_a) { + var _b = _a.x, z = _b === void 0 ? 'y' : _b; +}; +var a; +function f(_a, _b, _c) { + var _a = a; + var _b = a; + var _d = (_c === void 0 ? a : _c).p, _e = _d === void 0 ? a : _d; +} + + +//// [declarationEmit_bindingPatterns.d.ts] +declare const k: ({x: z}: { + x?: string; +}) => void; +declare var a: any; +declare function f({}?: any, []?: any, {p: {}}?: any): void; diff --git a/tests/baselines/reference/declarationEmit_bindingPatterns.symbols b/tests/baselines/reference/declarationEmit_bindingPatterns.symbols new file mode 100644 index 00000000000..b39aca17ea3 --- /dev/null +++ b/tests/baselines/reference/declarationEmit_bindingPatterns.symbols @@ -0,0 +1,17 @@ +=== tests/cases/compiler/declarationEmit_bindingPatterns.ts === + +const k = ({x: z = 'y'}) => { } +>k : Symbol(k, Decl(declarationEmit_bindingPatterns.ts, 1, 5)) +>x : Symbol(x) +>z : Symbol(z, Decl(declarationEmit_bindingPatterns.ts, 1, 12)) + +var a; +>a : Symbol(a, Decl(declarationEmit_bindingPatterns.ts, 3, 3)) + +function f({} = a, [] = a, { p: {} = a} = a) { +>f : Symbol(f, Decl(declarationEmit_bindingPatterns.ts, 3, 6)) +>a : Symbol(a, Decl(declarationEmit_bindingPatterns.ts, 3, 3)) +>a : Symbol(a, Decl(declarationEmit_bindingPatterns.ts, 3, 3)) +>a : Symbol(a, Decl(declarationEmit_bindingPatterns.ts, 3, 3)) +>a : Symbol(a, Decl(declarationEmit_bindingPatterns.ts, 3, 3)) +} diff --git a/tests/baselines/reference/declarationEmit_bindingPatterns.types b/tests/baselines/reference/declarationEmit_bindingPatterns.types new file mode 100644 index 00000000000..eff2d4bd4a3 --- /dev/null +++ b/tests/baselines/reference/declarationEmit_bindingPatterns.types @@ -0,0 +1,20 @@ +=== tests/cases/compiler/declarationEmit_bindingPatterns.ts === + +const k = ({x: z = 'y'}) => { } +>k : ({x: z}: { x?: string; }) => void +>({x: z = 'y'}) => { } : ({x: z}: { x?: string; }) => void +>x : any +>z : string +>'y' : string + +var a; +>a : any + +function f({} = a, [] = a, { p: {} = a} = a) { +>f : ({}?: any, []?: any, {p: {}}?: any) => void +>a : any +>a : any +>p : any +>a : any +>a : any +} diff --git a/tests/baselines/reference/declarationEmit_classMemberNameConflict.js b/tests/baselines/reference/declarationEmit_classMemberNameConflict.js new file mode 100644 index 00000000000..55acb13d2b9 --- /dev/null +++ b/tests/baselines/reference/declarationEmit_classMemberNameConflict.js @@ -0,0 +1,112 @@ +//// [declarationEmit_classMemberNameConflict.ts] + +export class C1 { + C1() { } // has to be the same as the class name + + bar() { + return function (t: typeof C1) { + }; + } +} + +export class C2 { + C2: any // has to be the same as the class name + + bar() { + return function (t: typeof C2) { + }; + } +} + +export class C3 { + get C3() { return 0; } // has to be the same as the class name + + bar() { + return function (t: typeof C3) { + }; + } +} + +export class C4 { + set C4(v) { } // has to be the same as the class name + + bar() { + return function (t: typeof C4) { + }; + } +} + +//// [declarationEmit_classMemberNameConflict.js] +"use strict"; +var C1 = (function () { + function C1() { + } + C1.prototype.C1 = function () { }; // has to be the same as the class name + C1.prototype.bar = function () { + return function (t) { + }; + }; + return C1; +}()); +exports.C1 = C1; +var C2 = (function () { + function C2() { + } + C2.prototype.bar = function () { + return function (t) { + }; + }; + return C2; +}()); +exports.C2 = C2; +var C3 = (function () { + function C3() { + } + Object.defineProperty(C3.prototype, "C3", { + get: function () { return 0; } // has to be the same as the class name + , + enumerable: true, + configurable: true + }); + C3.prototype.bar = function () { + return function (t) { + }; + }; + return C3; +}()); +exports.C3 = C3; +var C4 = (function () { + function C4() { + } + Object.defineProperty(C4.prototype, "C4", { + set: function (v) { } // has to be the same as the class name + , + enumerable: true, + configurable: true + }); + C4.prototype.bar = function () { + return function (t) { + }; + }; + return C4; +}()); +exports.C4 = C4; + + +//// [declarationEmit_classMemberNameConflict.d.ts] +export declare class C1 { + C1(): void; + bar(): (t: typeof C1) => void; +} +export declare class C2 { + C2: any; + bar(): (t: typeof C2) => void; +} +export declare class C3 { + readonly C3: number; + bar(): (t: typeof C3) => void; +} +export declare class C4 { + C4: any; + bar(): (t: typeof C4) => void; +} diff --git a/tests/baselines/reference/declarationEmit_classMemberNameConflict.symbols b/tests/baselines/reference/declarationEmit_classMemberNameConflict.symbols new file mode 100644 index 00000000000..2b8959289a8 --- /dev/null +++ b/tests/baselines/reference/declarationEmit_classMemberNameConflict.symbols @@ -0,0 +1,70 @@ +=== tests/cases/compiler/declarationEmit_classMemberNameConflict.ts === + +export class C1 { +>C1 : Symbol(C1, Decl(declarationEmit_classMemberNameConflict.ts, 0, 0)) + + C1() { } // has to be the same as the class name +>C1 : Symbol(C1.C1, Decl(declarationEmit_classMemberNameConflict.ts, 1, 17)) + + bar() { +>bar : Symbol(C1.bar, Decl(declarationEmit_classMemberNameConflict.ts, 2, 12)) + + return function (t: typeof C1) { +>t : Symbol(t, Decl(declarationEmit_classMemberNameConflict.ts, 5, 25)) +>C1 : Symbol(C1, Decl(declarationEmit_classMemberNameConflict.ts, 0, 0)) + + }; + } +} + +export class C2 { +>C2 : Symbol(C2, Decl(declarationEmit_classMemberNameConflict.ts, 8, 1)) + + C2: any // has to be the same as the class name +>C2 : Symbol(C2.C2, Decl(declarationEmit_classMemberNameConflict.ts, 10, 17)) + + bar() { +>bar : Symbol(C2.bar, Decl(declarationEmit_classMemberNameConflict.ts, 11, 11)) + + return function (t: typeof C2) { +>t : Symbol(t, Decl(declarationEmit_classMemberNameConflict.ts, 14, 25)) +>C2 : Symbol(C2, Decl(declarationEmit_classMemberNameConflict.ts, 8, 1)) + + }; + } +} + +export class C3 { +>C3 : Symbol(C3, Decl(declarationEmit_classMemberNameConflict.ts, 17, 1)) + + get C3() { return 0; } // has to be the same as the class name +>C3 : Symbol(C3.C3, Decl(declarationEmit_classMemberNameConflict.ts, 19, 17)) + + bar() { +>bar : Symbol(C3.bar, Decl(declarationEmit_classMemberNameConflict.ts, 20, 26)) + + return function (t: typeof C3) { +>t : Symbol(t, Decl(declarationEmit_classMemberNameConflict.ts, 23, 25)) +>C3 : Symbol(C3, Decl(declarationEmit_classMemberNameConflict.ts, 17, 1)) + + }; + } +} + +export class C4 { +>C4 : Symbol(C4, Decl(declarationEmit_classMemberNameConflict.ts, 26, 1)) + + set C4(v) { } // has to be the same as the class name +>C4 : Symbol(C4.C4, Decl(declarationEmit_classMemberNameConflict.ts, 28, 17)) +>v : Symbol(v, Decl(declarationEmit_classMemberNameConflict.ts, 29, 11)) + + bar() { +>bar : Symbol(C4.bar, Decl(declarationEmit_classMemberNameConflict.ts, 29, 17)) + + return function (t: typeof C4) { +>t : Symbol(t, Decl(declarationEmit_classMemberNameConflict.ts, 32, 25)) +>C4 : Symbol(C4, Decl(declarationEmit_classMemberNameConflict.ts, 26, 1)) + + }; + } +} diff --git a/tests/baselines/reference/declarationEmit_classMemberNameConflict.types b/tests/baselines/reference/declarationEmit_classMemberNameConflict.types new file mode 100644 index 00000000000..c76072413e5 --- /dev/null +++ b/tests/baselines/reference/declarationEmit_classMemberNameConflict.types @@ -0,0 +1,75 @@ +=== tests/cases/compiler/declarationEmit_classMemberNameConflict.ts === + +export class C1 { +>C1 : C1 + + C1() { } // has to be the same as the class name +>C1 : () => void + + bar() { +>bar : () => (t: typeof C1) => void + + return function (t: typeof C1) { +>function (t: typeof C1) { } : (t: typeof C1) => void +>t : typeof C1 +>C1 : typeof C1 + + }; + } +} + +export class C2 { +>C2 : C2 + + C2: any // has to be the same as the class name +>C2 : any + + bar() { +>bar : () => (t: typeof C2) => void + + return function (t: typeof C2) { +>function (t: typeof C2) { } : (t: typeof C2) => void +>t : typeof C2 +>C2 : typeof C2 + + }; + } +} + +export class C3 { +>C3 : C3 + + get C3() { return 0; } // has to be the same as the class name +>C3 : number +>0 : number + + bar() { +>bar : () => (t: typeof C3) => void + + return function (t: typeof C3) { +>function (t: typeof C3) { } : (t: typeof C3) => void +>t : typeof C3 +>C3 : typeof C3 + + }; + } +} + +export class C4 { +>C4 : C4 + + set C4(v) { } // has to be the same as the class name +>C4 : any +>v : any + + bar() { +>bar : () => (t: typeof C4) => void + + return function (t: typeof C4) { +>function (t: typeof C4) { } : (t: typeof C4) => void +>t : typeof C4 +>C4 : typeof C4 + + }; + } +} diff --git a/tests/baselines/reference/declarationEmit_classMemberNameConflict2.js b/tests/baselines/reference/declarationEmit_classMemberNameConflict2.js new file mode 100644 index 00000000000..03dc5cdbafd --- /dev/null +++ b/tests/baselines/reference/declarationEmit_classMemberNameConflict2.js @@ -0,0 +1,59 @@ +//// [declarationEmit_classMemberNameConflict2.ts] + +const Bar = 'bar'; + +enum Hello { + World +} + +enum Hello1 { + World1 +} + +class Foo { + // Same names + string => OK + Bar = Bar; + + // Same names + enum => OK + Hello = Hello; + + // Different names + enum => OK + Hello2 = Hello1; +} + +//// [declarationEmit_classMemberNameConflict2.js] +var Bar = 'bar'; +var Hello; +(function (Hello) { + Hello[Hello["World"] = 0] = "World"; +})(Hello || (Hello = {})); +var Hello1; +(function (Hello1) { + Hello1[Hello1["World1"] = 0] = "World1"; +})(Hello1 || (Hello1 = {})); +var Foo = (function () { + function Foo() { + // Same names + string => OK + this.Bar = Bar; + // Same names + enum => OK + this.Hello = Hello; + // Different names + enum => OK + this.Hello2 = Hello1; + } + return Foo; +}()); + + +//// [declarationEmit_classMemberNameConflict2.d.ts] +declare const Bar: string; +declare enum Hello { + World = 0, +} +declare enum Hello1 { + World1 = 0, +} +declare class Foo { + Bar: string; + Hello: typeof Hello; + Hello2: typeof Hello1; +} diff --git a/tests/baselines/reference/declarationEmit_classMemberNameConflict2.symbols b/tests/baselines/reference/declarationEmit_classMemberNameConflict2.symbols new file mode 100644 index 00000000000..e7c4b6f060c --- /dev/null +++ b/tests/baselines/reference/declarationEmit_classMemberNameConflict2.symbols @@ -0,0 +1,37 @@ +=== tests/cases/compiler/declarationEmit_classMemberNameConflict2.ts === + +const Bar = 'bar'; +>Bar : Symbol(Bar, Decl(declarationEmit_classMemberNameConflict2.ts, 1, 5)) + +enum Hello { +>Hello : Symbol(Hello, Decl(declarationEmit_classMemberNameConflict2.ts, 1, 18)) + + World +>World : Symbol(Hello.World, Decl(declarationEmit_classMemberNameConflict2.ts, 3, 12)) +} + +enum Hello1 { +>Hello1 : Symbol(Hello1, Decl(declarationEmit_classMemberNameConflict2.ts, 5, 1)) + + World1 +>World1 : Symbol(Hello1.World1, Decl(declarationEmit_classMemberNameConflict2.ts, 7, 13)) +} + +class Foo { +>Foo : Symbol(Foo, Decl(declarationEmit_classMemberNameConflict2.ts, 9, 1)) + + // Same names + string => OK + Bar = Bar; +>Bar : Symbol(Foo.Bar, Decl(declarationEmit_classMemberNameConflict2.ts, 11, 11)) +>Bar : Symbol(Bar, Decl(declarationEmit_classMemberNameConflict2.ts, 1, 5)) + + // Same names + enum => OK + Hello = Hello; +>Hello : Symbol(Foo.Hello, Decl(declarationEmit_classMemberNameConflict2.ts, 13, 14)) +>Hello : Symbol(Hello, Decl(declarationEmit_classMemberNameConflict2.ts, 1, 18)) + + // Different names + enum => OK + Hello2 = Hello1; +>Hello2 : Symbol(Foo.Hello2, Decl(declarationEmit_classMemberNameConflict2.ts, 16, 18)) +>Hello1 : Symbol(Hello1, Decl(declarationEmit_classMemberNameConflict2.ts, 5, 1)) +} diff --git a/tests/baselines/reference/declarationEmit_classMemberNameConflict2.types b/tests/baselines/reference/declarationEmit_classMemberNameConflict2.types new file mode 100644 index 00000000000..9f8ddd8a2d5 --- /dev/null +++ b/tests/baselines/reference/declarationEmit_classMemberNameConflict2.types @@ -0,0 +1,38 @@ +=== tests/cases/compiler/declarationEmit_classMemberNameConflict2.ts === + +const Bar = 'bar'; +>Bar : string +>'bar' : string + +enum Hello { +>Hello : Hello + + World +>World : Hello +} + +enum Hello1 { +>Hello1 : Hello1 + + World1 +>World1 : Hello1 +} + +class Foo { +>Foo : Foo + + // Same names + string => OK + Bar = Bar; +>Bar : string +>Bar : string + + // Same names + enum => OK + Hello = Hello; +>Hello : typeof Hello +>Hello : typeof Hello + + // Different names + enum => OK + Hello2 = Hello1; +>Hello2 : typeof Hello1 +>Hello1 : typeof Hello1 +} diff --git a/tests/baselines/reference/declarationEmit_expressionInExtends.js b/tests/baselines/reference/declarationEmit_expressionInExtends.js new file mode 100644 index 00000000000..061042aa34b --- /dev/null +++ b/tests/baselines/reference/declarationEmit_expressionInExtends.js @@ -0,0 +1,49 @@ +//// [declarationEmit_expressionInExtends.ts] + +var x: { + new(s: any): Q; +} + +class Q { + s: string; +} + +class B extends x { +} + +var q: B; +q.s; + +//// [declarationEmit_expressionInExtends.js] +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var x; +var Q = (function () { + function Q() { + } + return Q; +}()); +var B = (function (_super) { + __extends(B, _super); + function B() { + _super.apply(this, arguments); + } + return B; +}(x)); +var q; +q.s; + + +//// [declarationEmit_expressionInExtends.d.ts] +declare var x: { + new (s: any): Q; +}; +declare class Q { + s: string; +} +declare class B extends x { +} +declare var q: B; diff --git a/tests/baselines/reference/declarationEmit_expressionInExtends.symbols b/tests/baselines/reference/declarationEmit_expressionInExtends.symbols new file mode 100644 index 00000000000..319914702ac --- /dev/null +++ b/tests/baselines/reference/declarationEmit_expressionInExtends.symbols @@ -0,0 +1,32 @@ +=== tests/cases/compiler/declarationEmit_expressionInExtends.ts === + +var x: { +>x : Symbol(x, Decl(declarationEmit_expressionInExtends.ts, 1, 3)) + + new(s: any): Q; +>T : Symbol(T, Decl(declarationEmit_expressionInExtends.ts, 2, 8)) +>s : Symbol(s, Decl(declarationEmit_expressionInExtends.ts, 2, 11)) +>Q : Symbol(Q, Decl(declarationEmit_expressionInExtends.ts, 3, 1)) +} + +class Q { +>Q : Symbol(Q, Decl(declarationEmit_expressionInExtends.ts, 3, 1)) + + s: string; +>s : Symbol(Q.s, Decl(declarationEmit_expressionInExtends.ts, 5, 9)) +} + +class B extends x { +>B : Symbol(B, Decl(declarationEmit_expressionInExtends.ts, 7, 1)) +>x : Symbol(x, Decl(declarationEmit_expressionInExtends.ts, 1, 3)) +} + +var q: B; +>q : Symbol(q, Decl(declarationEmit_expressionInExtends.ts, 12, 3)) +>B : Symbol(B, Decl(declarationEmit_expressionInExtends.ts, 7, 1)) + +q.s; +>q.s : Symbol(Q.s, Decl(declarationEmit_expressionInExtends.ts, 5, 9)) +>q : Symbol(q, Decl(declarationEmit_expressionInExtends.ts, 12, 3)) +>s : Symbol(Q.s, Decl(declarationEmit_expressionInExtends.ts, 5, 9)) + diff --git a/tests/baselines/reference/declarationEmit_expressionInExtends.types b/tests/baselines/reference/declarationEmit_expressionInExtends.types new file mode 100644 index 00000000000..2e810fccf68 --- /dev/null +++ b/tests/baselines/reference/declarationEmit_expressionInExtends.types @@ -0,0 +1,32 @@ +=== tests/cases/compiler/declarationEmit_expressionInExtends.ts === + +var x: { +>x : new (s: any) => Q + + new(s: any): Q; +>T : T +>s : any +>Q : Q +} + +class Q { +>Q : Q + + s: string; +>s : string +} + +class B extends x { +>B : B +>x : Q +} + +var q: B; +>q : B +>B : B + +q.s; +>q.s : string +>q : B +>s : string + diff --git a/tests/baselines/reference/declarationEmit_expressionInExtends2.js b/tests/baselines/reference/declarationEmit_expressionInExtends2.js new file mode 100644 index 00000000000..da0478e26d0 --- /dev/null +++ b/tests/baselines/reference/declarationEmit_expressionInExtends2.js @@ -0,0 +1,45 @@ +//// [declarationEmit_expressionInExtends2.ts] + +class C { + x: T; + y: U; +} + +function getClass(c: T) { + return C; +} + +class MyClass extends getClass(2) { +} + +//// [declarationEmit_expressionInExtends2.js] +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var C = (function () { + function C() { + } + return C; +}()); +function getClass(c) { + return C; +} +var MyClass = (function (_super) { + __extends(MyClass, _super); + function MyClass() { + _super.apply(this, arguments); + } + return MyClass; +}(getClass(2))); + + +//// [declarationEmit_expressionInExtends2.d.ts] +declare class C { + x: T; + y: U; +} +declare function getClass(c: T): typeof C; +declare class MyClass extends C { +} diff --git a/tests/baselines/reference/declarationEmit_expressionInExtends2.symbols b/tests/baselines/reference/declarationEmit_expressionInExtends2.symbols new file mode 100644 index 00000000000..03a36a49b15 --- /dev/null +++ b/tests/baselines/reference/declarationEmit_expressionInExtends2.symbols @@ -0,0 +1,30 @@ +=== tests/cases/compiler/declarationEmit_expressionInExtends2.ts === + +class C { +>C : Symbol(C, Decl(declarationEmit_expressionInExtends2.ts, 0, 0)) +>T : Symbol(T, Decl(declarationEmit_expressionInExtends2.ts, 1, 8)) +>U : Symbol(U, Decl(declarationEmit_expressionInExtends2.ts, 1, 10)) + + x: T; +>x : Symbol(C.x, Decl(declarationEmit_expressionInExtends2.ts, 1, 15)) +>T : Symbol(T, Decl(declarationEmit_expressionInExtends2.ts, 1, 8)) + + y: U; +>y : Symbol(C.y, Decl(declarationEmit_expressionInExtends2.ts, 2, 9)) +>U : Symbol(U, Decl(declarationEmit_expressionInExtends2.ts, 1, 10)) +} + +function getClass(c: T) { +>getClass : Symbol(getClass, Decl(declarationEmit_expressionInExtends2.ts, 4, 1)) +>T : Symbol(T, Decl(declarationEmit_expressionInExtends2.ts, 6, 18)) +>c : Symbol(c, Decl(declarationEmit_expressionInExtends2.ts, 6, 21)) +>T : Symbol(T, Decl(declarationEmit_expressionInExtends2.ts, 6, 18)) + + return C; +>C : Symbol(C, Decl(declarationEmit_expressionInExtends2.ts, 0, 0)) +} + +class MyClass extends getClass(2) { +>MyClass : Symbol(MyClass, Decl(declarationEmit_expressionInExtends2.ts, 8, 1)) +>getClass : Symbol(getClass, Decl(declarationEmit_expressionInExtends2.ts, 4, 1)) +} diff --git a/tests/baselines/reference/declarationEmit_expressionInExtends2.types b/tests/baselines/reference/declarationEmit_expressionInExtends2.types new file mode 100644 index 00000000000..77a1539267d --- /dev/null +++ b/tests/baselines/reference/declarationEmit_expressionInExtends2.types @@ -0,0 +1,32 @@ +=== tests/cases/compiler/declarationEmit_expressionInExtends2.ts === + +class C { +>C : C +>T : T +>U : U + + x: T; +>x : T +>T : T + + y: U; +>y : U +>U : U +} + +function getClass(c: T) { +>getClass : (c: T) => typeof C +>T : T +>c : T +>T : T + + return C; +>C : typeof C +} + +class MyClass extends getClass(2) { +>MyClass : MyClass +>getClass(2) : C +>getClass : (c: T) => typeof C +>2 : number +} diff --git a/tests/baselines/reference/declarationEmit_expressionInExtends3.errors.txt b/tests/baselines/reference/declarationEmit_expressionInExtends3.errors.txt new file mode 100644 index 00000000000..2783810c568 --- /dev/null +++ b/tests/baselines/reference/declarationEmit_expressionInExtends3.errors.txt @@ -0,0 +1,52 @@ +tests/cases/compiler/declarationEmit_expressionInExtends3.ts(29,30): error TS4020: Extends clause of exported class 'MyClass' has or is using private name 'LocalClass'. +tests/cases/compiler/declarationEmit_expressionInExtends3.ts(37,31): error TS4020: Extends clause of exported class 'MyClass3' has or is using private name 'LocalInterface'. + + +==== tests/cases/compiler/declarationEmit_expressionInExtends3.ts (2 errors) ==== + + export class ExportedClass { + x: T; + } + + class LocalClass { + x: T; + y: U; + } + + export interface ExportedInterface { + x: number; + } + + interface LocalInterface { + x: number; + } + + function getLocalClass(c: T) { + return LocalClass; + } + + function getExportedClass(c: T) { + return ExportedClass; + } + + + + export class MyClass extends getLocalClass(undefined) { // error LocalClass is inaccisible + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS4020: Extends clause of exported class 'MyClass' has or is using private name 'LocalClass'. + } + + + export class MyClass2 extends getExportedClass(undefined) { // OK + } + + + export class MyClass3 extends getExportedClass(undefined) { // Error LocalInterface is inaccisble + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS4020: Extends clause of exported class 'MyClass3' has or is using private name 'LocalInterface'. + } + + + export class MyClass4 extends getExportedClass(undefined) { // OK + } + \ No newline at end of file diff --git a/tests/baselines/reference/declarationEmit_expressionInExtends3.js b/tests/baselines/reference/declarationEmit_expressionInExtends3.js new file mode 100644 index 00000000000..10ef42d6838 --- /dev/null +++ b/tests/baselines/reference/declarationEmit_expressionInExtends3.js @@ -0,0 +1,101 @@ +//// [declarationEmit_expressionInExtends3.ts] + +export class ExportedClass { + x: T; +} + +class LocalClass { + x: T; + y: U; +} + +export interface ExportedInterface { + x: number; +} + +interface LocalInterface { + x: number; +} + +function getLocalClass(c: T) { + return LocalClass; +} + +function getExportedClass(c: T) { + return ExportedClass; +} + + + +export class MyClass extends getLocalClass(undefined) { // error LocalClass is inaccisible +} + + +export class MyClass2 extends getExportedClass(undefined) { // OK +} + + +export class MyClass3 extends getExportedClass(undefined) { // Error LocalInterface is inaccisble +} + + +export class MyClass4 extends getExportedClass(undefined) { // OK +} + + +//// [declarationEmit_expressionInExtends3.js] +"use strict"; +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var ExportedClass = (function () { + function ExportedClass() { + } + return ExportedClass; +}()); +exports.ExportedClass = ExportedClass; +var LocalClass = (function () { + function LocalClass() { + } + return LocalClass; +}()); +function getLocalClass(c) { + return LocalClass; +} +function getExportedClass(c) { + return ExportedClass; +} +var MyClass = (function (_super) { + __extends(MyClass, _super); + function MyClass() { + _super.apply(this, arguments); + } + return MyClass; +}(getLocalClass(undefined))); +exports.MyClass = MyClass; +var MyClass2 = (function (_super) { + __extends(MyClass2, _super); + function MyClass2() { + _super.apply(this, arguments); + } + return MyClass2; +}(getExportedClass(undefined))); +exports.MyClass2 = MyClass2; +var MyClass3 = (function (_super) { + __extends(MyClass3, _super); + function MyClass3() { + _super.apply(this, arguments); + } + return MyClass3; +}(getExportedClass(undefined))); +exports.MyClass3 = MyClass3; +var MyClass4 = (function (_super) { + __extends(MyClass4, _super); + function MyClass4() { + _super.apply(this, arguments); + } + return MyClass4; +}(getExportedClass(undefined))); +exports.MyClass4 = MyClass4; diff --git a/tests/baselines/reference/declarationEmit_expressionInExtends4.errors.txt b/tests/baselines/reference/declarationEmit_expressionInExtends4.errors.txt new file mode 100644 index 00000000000..df3a6533260 --- /dev/null +++ b/tests/baselines/reference/declarationEmit_expressionInExtends4.errors.txt @@ -0,0 +1,35 @@ +tests/cases/compiler/declarationEmit_expressionInExtends4.ts(2,10): error TS4060: Return type of exported function has or is using private name 'D'. +tests/cases/compiler/declarationEmit_expressionInExtends4.ts(6,17): error TS2315: Type 'D' is not generic. +tests/cases/compiler/declarationEmit_expressionInExtends4.ts(10,18): error TS2304: Cannot find name 'SomeUndefinedFunction'. +tests/cases/compiler/declarationEmit_expressionInExtends4.ts(15,18): error TS2304: Cannot find name 'SomeUndefinedFunction'. +tests/cases/compiler/declarationEmit_expressionInExtends4.ts(15,18): error TS4020: Extends clause of exported class 'C3' has or is using private name 'SomeUndefinedFunction'. + + +==== tests/cases/compiler/declarationEmit_expressionInExtends4.ts (5 errors) ==== + + function getSomething() { + ~~~~~~~~~~~~ +!!! error TS4060: Return type of exported function has or is using private name 'D'. + return class D { } + } + + class C extends getSomething() { + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2315: Type 'D' is not generic. + + } + + class C2 extends SomeUndefinedFunction() { + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'SomeUndefinedFunction'. + + } + + + class C3 extends SomeUndefinedFunction { + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'SomeUndefinedFunction'. + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS4020: Extends clause of exported class 'C3' has or is using private name 'SomeUndefinedFunction'. + + } \ No newline at end of file diff --git a/tests/baselines/reference/declarationEmit_expressionInExtends4.js b/tests/baselines/reference/declarationEmit_expressionInExtends4.js new file mode 100644 index 00000000000..39ee7ce1e69 --- /dev/null +++ b/tests/baselines/reference/declarationEmit_expressionInExtends4.js @@ -0,0 +1,53 @@ +//// [declarationEmit_expressionInExtends4.ts] + +function getSomething() { + return class D { } +} + +class C extends getSomething() { + +} + +class C2 extends SomeUndefinedFunction() { + +} + + +class C3 extends SomeUndefinedFunction { + +} + +//// [declarationEmit_expressionInExtends4.js] +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +function getSomething() { + return (function () { + function D() { + } + return D; + }()); +} +var C = (function (_super) { + __extends(C, _super); + function C() { + _super.apply(this, arguments); + } + return C; +}(getSomething())); +var C2 = (function (_super) { + __extends(C2, _super); + function C2() { + _super.apply(this, arguments); + } + return C2; +}(SomeUndefinedFunction())); +var C3 = (function (_super) { + __extends(C3, _super); + function C3() { + _super.apply(this, arguments); + } + return C3; +}(SomeUndefinedFunction)); diff --git a/tests/baselines/reference/declarationEmit_inferedDefaultExportType.js b/tests/baselines/reference/declarationEmit_inferedDefaultExportType.js new file mode 100644 index 00000000000..ee80738a269 --- /dev/null +++ b/tests/baselines/reference/declarationEmit_inferedDefaultExportType.js @@ -0,0 +1,26 @@ +//// [declarationEmit_inferedDefaultExportType.ts] + +// test.ts +export default { + foo: [], + bar: undefined, + baz: null +} + +//// [declarationEmit_inferedDefaultExportType.js] +"use strict"; +exports.__esModule = true; +exports["default"] = { + foo: [], + bar: undefined, + baz: null +}; + + +//// [declarationEmit_inferedDefaultExportType.d.ts] +declare var _default: { + foo: any[]; + bar: any; + baz: any; +}; +export default _default; diff --git a/tests/baselines/reference/declarationEmit_inferedDefaultExportType.symbols b/tests/baselines/reference/declarationEmit_inferedDefaultExportType.symbols new file mode 100644 index 00000000000..7e8cdea2c75 --- /dev/null +++ b/tests/baselines/reference/declarationEmit_inferedDefaultExportType.symbols @@ -0,0 +1,14 @@ +=== tests/cases/compiler/declarationEmit_inferedDefaultExportType.ts === + +// test.ts +export default { + foo: [], +>foo : Symbol(foo, Decl(declarationEmit_inferedDefaultExportType.ts, 2, 16)) + + bar: undefined, +>bar : Symbol(bar, Decl(declarationEmit_inferedDefaultExportType.ts, 3, 10)) +>undefined : Symbol(undefined) + + baz: null +>baz : Symbol(baz, Decl(declarationEmit_inferedDefaultExportType.ts, 4, 17)) +} diff --git a/tests/baselines/reference/declarationEmit_inferedDefaultExportType.types b/tests/baselines/reference/declarationEmit_inferedDefaultExportType.types new file mode 100644 index 00000000000..0f5d0ceed91 --- /dev/null +++ b/tests/baselines/reference/declarationEmit_inferedDefaultExportType.types @@ -0,0 +1,18 @@ +=== tests/cases/compiler/declarationEmit_inferedDefaultExportType.ts === + +// test.ts +export default { +>{ foo: [], bar: undefined, baz: null} : { foo: undefined[]; bar: undefined; baz: null; } + + foo: [], +>foo : undefined[] +>[] : undefined[] + + bar: undefined, +>bar : undefined +>undefined : undefined + + baz: null +>baz : null +>null : null +} diff --git a/tests/baselines/reference/declarationEmit_inferedDefaultExportType2.js b/tests/baselines/reference/declarationEmit_inferedDefaultExportType2.js new file mode 100644 index 00000000000..617d4a9966b --- /dev/null +++ b/tests/baselines/reference/declarationEmit_inferedDefaultExportType2.js @@ -0,0 +1,25 @@ +//// [declarationEmit_inferedDefaultExportType2.ts] + +// test.ts +export = { + foo: [], + bar: undefined, + baz: null +} + +//// [declarationEmit_inferedDefaultExportType2.js] +"use strict"; +module.exports = { + foo: [], + bar: undefined, + baz: null +}; + + +//// [declarationEmit_inferedDefaultExportType2.d.ts] +declare var _default: { + foo: any[]; + bar: any; + baz: any; +}; +export = _default; diff --git a/tests/baselines/reference/declarationEmit_inferedDefaultExportType2.symbols b/tests/baselines/reference/declarationEmit_inferedDefaultExportType2.symbols new file mode 100644 index 00000000000..d04c50c0d7c --- /dev/null +++ b/tests/baselines/reference/declarationEmit_inferedDefaultExportType2.symbols @@ -0,0 +1,14 @@ +=== tests/cases/compiler/declarationEmit_inferedDefaultExportType2.ts === + +// test.ts +export = { + foo: [], +>foo : Symbol(foo, Decl(declarationEmit_inferedDefaultExportType2.ts, 2, 10)) + + bar: undefined, +>bar : Symbol(bar, Decl(declarationEmit_inferedDefaultExportType2.ts, 3, 10)) +>undefined : Symbol(undefined) + + baz: null +>baz : Symbol(baz, Decl(declarationEmit_inferedDefaultExportType2.ts, 4, 17)) +} diff --git a/tests/baselines/reference/declarationEmit_inferedDefaultExportType2.types b/tests/baselines/reference/declarationEmit_inferedDefaultExportType2.types new file mode 100644 index 00000000000..5c8cbbb158c --- /dev/null +++ b/tests/baselines/reference/declarationEmit_inferedDefaultExportType2.types @@ -0,0 +1,18 @@ +=== tests/cases/compiler/declarationEmit_inferedDefaultExportType2.ts === + +// test.ts +export = { +>{ foo: [], bar: undefined, baz: null} : { foo: undefined[]; bar: undefined; baz: null; } + + foo: [], +>foo : undefined[] +>[] : undefined[] + + bar: undefined, +>bar : undefined +>undefined : undefined + + baz: null +>baz : null +>null : null +} diff --git a/tests/baselines/reference/declarationEmit_invalidExport.errors.txt b/tests/baselines/reference/declarationEmit_invalidExport.errors.txt new file mode 100644 index 00000000000..19d650d6d6f --- /dev/null +++ b/tests/baselines/reference/declarationEmit_invalidExport.errors.txt @@ -0,0 +1,19 @@ +tests/cases/compiler/declarationEmit_invalidExport.ts(3,3): error TS7027: Unreachable code detected. +tests/cases/compiler/declarationEmit_invalidExport.ts(5,30): error TS4081: Exported type alias 'MyClass' has or is using private name 'myClass'. +tests/cases/compiler/declarationEmit_invalidExport.ts(6,1): error TS1128: Declaration or statement expected. + + +==== tests/cases/compiler/declarationEmit_invalidExport.ts (3 errors) ==== + + if (false) { + export var myClass = 0; + ~~~~~~ +!!! error TS7027: Unreachable code detected. + } + export type MyClass = typeof myClass; + ~~~~~~~ +!!! error TS4081: Exported type alias 'MyClass' has or is using private name 'myClass'. + } + ~ +!!! error TS1128: Declaration or statement expected. + \ No newline at end of file diff --git a/tests/baselines/reference/declarationEmit_invalidExport.js b/tests/baselines/reference/declarationEmit_invalidExport.js new file mode 100644 index 00000000000..61682ca5642 --- /dev/null +++ b/tests/baselines/reference/declarationEmit_invalidExport.js @@ -0,0 +1,14 @@ +//// [declarationEmit_invalidExport.ts] + +if (false) { + export var myClass = 0; +} +export type MyClass = typeof myClass; +} + + +//// [declarationEmit_invalidExport.js] +"use strict"; +if (false) { + exports.myClass = 0; +} diff --git a/tests/baselines/reference/declarationEmit_protectedMembers.js b/tests/baselines/reference/declarationEmit_protectedMembers.js index 5aad004939d..192f0647ed6 100644 --- a/tests/baselines/reference/declarationEmit_protectedMembers.js +++ b/tests/baselines/reference/declarationEmit_protectedMembers.js @@ -135,7 +135,7 @@ declare class C1 { protected static sx: number; protected static sf(): number; protected static staticSetter: number; - protected static staticGetter: number; + protected static readonly staticGetter: number; } declare class C2 extends C1 { protected f(): number; @@ -146,7 +146,7 @@ declare class C3 extends C2 { static sx: number; f(): number; static sf(): number; - static staticGetter: number; + static readonly staticGetter: number; } declare class C4 { protected a: number; diff --git a/tests/baselines/reference/declarationEmit_protectedMembers.symbols b/tests/baselines/reference/declarationEmit_protectedMembers.symbols index cbf3db094ea..ee9f5ce199d 100644 --- a/tests/baselines/reference/declarationEmit_protectedMembers.symbols +++ b/tests/baselines/reference/declarationEmit_protectedMembers.symbols @@ -5,23 +5,23 @@ class C1 { >C1 : Symbol(C1, Decl(declarationEmit_protectedMembers.ts, 0, 0)) protected x: number; ->x : Symbol(x, Decl(declarationEmit_protectedMembers.ts, 2, 10)) +>x : Symbol(C1.x, Decl(declarationEmit_protectedMembers.ts, 2, 10)) protected f() { ->f : Symbol(f, Decl(declarationEmit_protectedMembers.ts, 3, 24)) +>f : Symbol(C1.f, Decl(declarationEmit_protectedMembers.ts, 3, 24)) return this.x; ->this.x : Symbol(x, Decl(declarationEmit_protectedMembers.ts, 2, 10)) +>this.x : Symbol(C1.x, Decl(declarationEmit_protectedMembers.ts, 2, 10)) >this : Symbol(C1, Decl(declarationEmit_protectedMembers.ts, 0, 0)) ->x : Symbol(x, Decl(declarationEmit_protectedMembers.ts, 2, 10)) +>x : Symbol(C1.x, Decl(declarationEmit_protectedMembers.ts, 2, 10)) } protected set accessor(a: number) { } ->accessor : Symbol(accessor, Decl(declarationEmit_protectedMembers.ts, 7, 5), Decl(declarationEmit_protectedMembers.ts, 9, 41)) +>accessor : Symbol(C1.accessor, Decl(declarationEmit_protectedMembers.ts, 7, 5), Decl(declarationEmit_protectedMembers.ts, 9, 41)) >a : Symbol(a, Decl(declarationEmit_protectedMembers.ts, 9, 27)) protected get accessor() { return 0; } ->accessor : Symbol(accessor, Decl(declarationEmit_protectedMembers.ts, 7, 5), Decl(declarationEmit_protectedMembers.ts, 9, 41)) +>accessor : Symbol(C1.accessor, Decl(declarationEmit_protectedMembers.ts, 7, 5), Decl(declarationEmit_protectedMembers.ts, 9, 41)) protected static sx: number; >sx : Symbol(C1.sx, Decl(declarationEmit_protectedMembers.ts, 10, 42)) @@ -49,7 +49,7 @@ class C2 extends C1 { >C1 : Symbol(C1, Decl(declarationEmit_protectedMembers.ts, 0, 0)) protected f() { ->f : Symbol(f, Decl(declarationEmit_protectedMembers.ts, 23, 21)) +>f : Symbol(C2.f, Decl(declarationEmit_protectedMembers.ts, 23, 21)) return super.f() + this.x; >super.f : Symbol(C1.f, Decl(declarationEmit_protectedMembers.ts, 3, 24)) @@ -78,13 +78,13 @@ class C3 extends C2 { >C2 : Symbol(C2, Decl(declarationEmit_protectedMembers.ts, 20, 1)) x: number; ->x : Symbol(x, Decl(declarationEmit_protectedMembers.ts, 33, 21)) +>x : Symbol(C3.x, Decl(declarationEmit_protectedMembers.ts, 33, 21)) static sx: number; >sx : Symbol(C3.sx, Decl(declarationEmit_protectedMembers.ts, 34, 14)) f() { ->f : Symbol(f, Decl(declarationEmit_protectedMembers.ts, 35, 22)) +>f : Symbol(C3.f, Decl(declarationEmit_protectedMembers.ts, 35, 22)) return super.f(); >super.f : Symbol(C2.f, Decl(declarationEmit_protectedMembers.ts, 23, 21)) @@ -109,6 +109,6 @@ class C4 { >C4 : Symbol(C4, Decl(declarationEmit_protectedMembers.ts, 44, 1)) constructor(protected a: number, protected b) { } ->a : Symbol(a, Decl(declarationEmit_protectedMembers.ts, 48, 16)) ->b : Symbol(b, Decl(declarationEmit_protectedMembers.ts, 48, 36)) +>a : Symbol(C4.a, Decl(declarationEmit_protectedMembers.ts, 48, 16)) +>b : Symbol(C4.b, Decl(declarationEmit_protectedMembers.ts, 48, 36)) } diff --git a/tests/baselines/reference/declarationEmit_readonly.js b/tests/baselines/reference/declarationEmit_readonly.js new file mode 100644 index 00000000000..4925e5dafae --- /dev/null +++ b/tests/baselines/reference/declarationEmit_readonly.js @@ -0,0 +1,20 @@ +//// [declarationEmit_readonly.ts] + +class C { + constructor(readonly x: number) {} +} + +//// [declarationEmit_readonly.js] +var C = (function () { + function C(x) { + this.x = x; + } + return C; +}()); + + +//// [declarationEmit_readonly.d.ts] +declare class C { + readonly x: number; + constructor(x: number); +} diff --git a/tests/baselines/reference/declarationEmit_readonly.symbols b/tests/baselines/reference/declarationEmit_readonly.symbols new file mode 100644 index 00000000000..eadb7dc3ddf --- /dev/null +++ b/tests/baselines/reference/declarationEmit_readonly.symbols @@ -0,0 +1,8 @@ +=== tests/cases/conformance/classes/constructorDeclarations/constructorParameters/declarationEmit_readonly.ts === + +class C { +>C : Symbol(C, Decl(declarationEmit_readonly.ts, 0, 0)) + + constructor(readonly x: number) {} +>x : Symbol(C.x, Decl(declarationEmit_readonly.ts, 2, 16)) +} diff --git a/tests/baselines/reference/declarationEmit_readonly.types b/tests/baselines/reference/declarationEmit_readonly.types new file mode 100644 index 00000000000..3036c234ae5 --- /dev/null +++ b/tests/baselines/reference/declarationEmit_readonly.types @@ -0,0 +1,8 @@ +=== tests/cases/conformance/classes/constructorDeclarations/constructorParameters/declarationEmit_readonly.ts === + +class C { +>C : C + + constructor(readonly x: number) {} +>x : number +} diff --git a/tests/baselines/reference/declarationMerging1.js b/tests/baselines/reference/declarationMerging1.js new file mode 100644 index 00000000000..6b863def1c7 --- /dev/null +++ b/tests/baselines/reference/declarationMerging1.js @@ -0,0 +1,21 @@ +//// [tests/cases/compiler/declarationMerging1.ts] //// + +//// [file1.ts] +class A { + protected _f: number; + getF() { return this._f; } +} + +//// [file2.ts] +interface A { + run(); +} + +//// [file1.js] +var A = (function () { + function A() { + } + A.prototype.getF = function () { return this._f; }; + return A; +}()); +//// [file2.js] diff --git a/tests/baselines/reference/declarationMerging1.symbols b/tests/baselines/reference/declarationMerging1.symbols new file mode 100644 index 00000000000..7c15b18c5e2 --- /dev/null +++ b/tests/baselines/reference/declarationMerging1.symbols @@ -0,0 +1,21 @@ +=== tests/cases/compiler/file1.ts === +class A { +>A : Symbol(A, Decl(file1.ts, 0, 0), Decl(file2.ts, 0, 0)) + + protected _f: number; +>_f : Symbol(A._f, Decl(file1.ts, 0, 9)) + + getF() { return this._f; } +>getF : Symbol(A.getF, Decl(file1.ts, 1, 25)) +>this._f : Symbol(A._f, Decl(file1.ts, 0, 9)) +>this : Symbol(A, Decl(file1.ts, 0, 0), Decl(file2.ts, 0, 0)) +>_f : Symbol(A._f, Decl(file1.ts, 0, 9)) +} + +=== tests/cases/compiler/file2.ts === +interface A { +>A : Symbol(A, Decl(file1.ts, 0, 0), Decl(file2.ts, 0, 0)) + + run(); +>run : Symbol(A.run, Decl(file2.ts, 0, 13)) +} diff --git a/tests/baselines/reference/declarationMerging1.types b/tests/baselines/reference/declarationMerging1.types new file mode 100644 index 00000000000..9802d2ab542 --- /dev/null +++ b/tests/baselines/reference/declarationMerging1.types @@ -0,0 +1,21 @@ +=== tests/cases/compiler/file1.ts === +class A { +>A : A + + protected _f: number; +>_f : number + + getF() { return this._f; } +>getF : () => number +>this._f : number +>this : this +>_f : number +} + +=== tests/cases/compiler/file2.ts === +interface A { +>A : A + + run(); +>run : () => any +} diff --git a/tests/baselines/reference/declarationMerging2.js b/tests/baselines/reference/declarationMerging2.js new file mode 100644 index 00000000000..3157445fa36 --- /dev/null +++ b/tests/baselines/reference/declarationMerging2.js @@ -0,0 +1,32 @@ +//// [tests/cases/compiler/declarationMerging2.ts] //// + +//// [a.ts] + +export class A { + protected _f: number; + getF() { return this._f; } +} + +//// [b.ts] +export {} +declare module "./a" { + interface A { + run(); + } +} + +//// [a.js] +define(["require", "exports"], function (require, exports) { + "use strict"; + var A = (function () { + function A() { + } + A.prototype.getF = function () { return this._f; }; + return A; + }()); + exports.A = A; +}); +//// [b.js] +define(["require", "exports"], function (require, exports) { + "use strict"; +}); diff --git a/tests/baselines/reference/declarationMerging2.symbols b/tests/baselines/reference/declarationMerging2.symbols new file mode 100644 index 00000000000..050b5414da5 --- /dev/null +++ b/tests/baselines/reference/declarationMerging2.symbols @@ -0,0 +1,25 @@ +=== tests/cases/compiler/a.ts === + +export class A { +>A : Symbol(A, Decl(a.ts, 0, 0), Decl(b.ts, 1, 22)) + + protected _f: number; +>_f : Symbol(A._f, Decl(a.ts, 1, 16)) + + getF() { return this._f; } +>getF : Symbol(A.getF, Decl(a.ts, 2, 25)) +>this._f : Symbol(A._f, Decl(a.ts, 1, 16)) +>this : Symbol(A, Decl(a.ts, 0, 0), Decl(b.ts, 1, 22)) +>_f : Symbol(A._f, Decl(a.ts, 1, 16)) +} + +=== tests/cases/compiler/b.ts === +export {} +declare module "./a" { + interface A { +>A : Symbol(A, Decl(a.ts, 0, 0), Decl(b.ts, 1, 22)) + + run(); +>run : Symbol(A.run, Decl(b.ts, 2, 17)) + } +} diff --git a/tests/baselines/reference/declarationMerging2.types b/tests/baselines/reference/declarationMerging2.types new file mode 100644 index 00000000000..79e2818cf52 --- /dev/null +++ b/tests/baselines/reference/declarationMerging2.types @@ -0,0 +1,25 @@ +=== tests/cases/compiler/a.ts === + +export class A { +>A : A + + protected _f: number; +>_f : number + + getF() { return this._f; } +>getF : () => number +>this._f : number +>this : this +>_f : number +} + +=== tests/cases/compiler/b.ts === +export {} +declare module "./a" { + interface A { +>A : A + + run(); +>run : () => any + } +} diff --git a/tests/baselines/reference/declarationsAndAssignments.errors.txt b/tests/baselines/reference/declarationsAndAssignments.errors.txt index 7c4671022ea..517eaafe4ab 100644 --- a/tests/baselines/reference/declarationsAndAssignments.errors.txt +++ b/tests/baselines/reference/declarationsAndAssignments.errors.txt @@ -11,8 +11,8 @@ tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(62,13): tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(62,16): error TS2525: Initializer provides no value for this binding element and the binding element has no default value. tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(63,13): error TS2525: Initializer provides no value for this binding element and the binding element has no default value. tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(63,16): error TS2525: Initializer provides no value for this binding element and the binding element has no default value. -tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(67,9): error TS2461: Type '{ [x: number]: undefined; }' is not an array type. -tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(68,9): error TS2461: Type '{ [x: number]: number; 0: number; 1: number; }' is not an array type. +tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(67,9): error TS2461: Type '{}' is not an array type. +tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(68,9): error TS2461: Type '{ 0: number; 1: number; }' is not an array type. tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(73,11): error TS2525: Initializer provides no value for this binding element and the binding element has no default value. tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(73,14): error TS2525: Initializer provides no value for this binding element and the binding element has no default value. tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(74,11): error TS2459: Type 'undefined[]' has no property 'a' and no string index signature. @@ -122,10 +122,10 @@ tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(138,9): function f9() { var [a, b] = {}; // Error, not array type ~~~~~~ -!!! error TS2461: Type '{ [x: number]: undefined; }' is not an array type. +!!! error TS2461: Type '{}' is not an array type. var [c, d] = { 0: 10, 1: 20 }; // Error, not array type ~~~~~~ -!!! error TS2461: Type '{ [x: number]: number; 0: number; 1: number; }' is not an array type. +!!! error TS2461: Type '{ 0: number; 1: number; }' is not an array type. var [e, f] = [10, 20]; } diff --git a/tests/baselines/reference/declareExternalModuleWithExportAssignedFundule.symbols b/tests/baselines/reference/declareExternalModuleWithExportAssignedFundule.symbols index 0b1b06cc99e..af691ce828c 100644 --- a/tests/baselines/reference/declareExternalModuleWithExportAssignedFundule.symbols +++ b/tests/baselines/reference/declareExternalModuleWithExportAssignedFundule.symbols @@ -16,12 +16,12 @@ declare module "express" { >ExpressServer : Symbol(ExpressServer, Decl(declareExternalModuleWithExportAssignedFundule.ts, 6, 20)) enable(name: string): ExpressServer; ->enable : Symbol(enable, Decl(declareExternalModuleWithExportAssignedFundule.ts, 8, 40)) +>enable : Symbol(ExpressServer.enable, Decl(declareExternalModuleWithExportAssignedFundule.ts, 8, 40)) >name : Symbol(name, Decl(declareExternalModuleWithExportAssignedFundule.ts, 10, 19)) >ExpressServer : Symbol(ExpressServer, Decl(declareExternalModuleWithExportAssignedFundule.ts, 6, 20)) post(path: RegExp, handler: (req: Function) => void ): void; ->post : Symbol(post, Decl(declareExternalModuleWithExportAssignedFundule.ts, 10, 48)) +>post : Symbol(ExpressServer.post, Decl(declareExternalModuleWithExportAssignedFundule.ts, 10, 48)) >path : Symbol(path, Decl(declareExternalModuleWithExportAssignedFundule.ts, 12, 17)) >RegExp : Symbol(RegExp, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >handler : Symbol(handler, Decl(declareExternalModuleWithExportAssignedFundule.ts, 12, 30)) diff --git a/tests/baselines/reference/declareFileExportAssignment.symbols b/tests/baselines/reference/declareFileExportAssignment.symbols index bb626e9eeab..012b5db24b1 100644 --- a/tests/baselines/reference/declareFileExportAssignment.symbols +++ b/tests/baselines/reference/declareFileExportAssignment.symbols @@ -14,13 +14,13 @@ module m2 { >connectExport : Symbol(connectExport, Decl(declareFileExportAssignment.ts, 3, 5)) use: (mod: connectModule) => connectExport; ->use : Symbol(use, Decl(declareFileExportAssignment.ts, 4, 36)) +>use : Symbol(connectExport.use, Decl(declareFileExportAssignment.ts, 4, 36)) >mod : Symbol(mod, Decl(declareFileExportAssignment.ts, 5, 14)) >connectModule : Symbol(connectModule, Decl(declareFileExportAssignment.ts, 0, 11)) >connectExport : Symbol(connectExport, Decl(declareFileExportAssignment.ts, 3, 5)) listen: (port: number) => void; ->listen : Symbol(listen, Decl(declareFileExportAssignment.ts, 5, 51)) +>listen : Symbol(connectExport.listen, Decl(declareFileExportAssignment.ts, 5, 51)) >port : Symbol(port, Decl(declareFileExportAssignment.ts, 6, 17)) } diff --git a/tests/baselines/reference/declareFileExportAssignmentWithVarFromVariableStatement.symbols b/tests/baselines/reference/declareFileExportAssignmentWithVarFromVariableStatement.symbols index e829c3d2f92..e757604a920 100644 --- a/tests/baselines/reference/declareFileExportAssignmentWithVarFromVariableStatement.symbols +++ b/tests/baselines/reference/declareFileExportAssignmentWithVarFromVariableStatement.symbols @@ -14,13 +14,13 @@ module m2 { >connectExport : Symbol(connectExport, Decl(declareFileExportAssignmentWithVarFromVariableStatement.ts, 3, 5)) use: (mod: connectModule) => connectExport; ->use : Symbol(use, Decl(declareFileExportAssignmentWithVarFromVariableStatement.ts, 4, 36)) +>use : Symbol(connectExport.use, Decl(declareFileExportAssignmentWithVarFromVariableStatement.ts, 4, 36)) >mod : Symbol(mod, Decl(declareFileExportAssignmentWithVarFromVariableStatement.ts, 5, 14)) >connectModule : Symbol(connectModule, Decl(declareFileExportAssignmentWithVarFromVariableStatement.ts, 0, 11)) >connectExport : Symbol(connectExport, Decl(declareFileExportAssignmentWithVarFromVariableStatement.ts, 3, 5)) listen: (port: number) => void; ->listen : Symbol(listen, Decl(declareFileExportAssignmentWithVarFromVariableStatement.ts, 5, 51)) +>listen : Symbol(connectExport.listen, Decl(declareFileExportAssignmentWithVarFromVariableStatement.ts, 5, 51)) >port : Symbol(port, Decl(declareFileExportAssignmentWithVarFromVariableStatement.ts, 6, 17)) } diff --git a/tests/baselines/reference/declaredExternalModule.symbols b/tests/baselines/reference/declaredExternalModule.symbols index e6fde33f2d0..fb331ecf011 100644 --- a/tests/baselines/reference/declaredExternalModule.symbols +++ b/tests/baselines/reference/declaredExternalModule.symbols @@ -15,13 +15,13 @@ declare module 'connect' { >connectExport : Symbol(connectExport, Decl(declaredExternalModule.ts, 6, 5)) use: (mod: connectModule) => connectExport; ->use : Symbol(use, Decl(declaredExternalModule.ts, 8, 29)) +>use : Symbol(connectExport.use, Decl(declaredExternalModule.ts, 8, 29)) >mod : Symbol(mod, Decl(declaredExternalModule.ts, 10, 14)) >connectModule : Symbol(connectModule, Decl(declaredExternalModule.ts, 0, 26)) >connectExport : Symbol(connectExport, Decl(declaredExternalModule.ts, 6, 5)) listen: (port: number) => void; ->listen : Symbol(listen, Decl(declaredExternalModule.ts, 10, 51)) +>listen : Symbol(connectExport.listen, Decl(declaredExternalModule.ts, 10, 51)) >port : Symbol(port, Decl(declaredExternalModule.ts, 12, 17)) } diff --git a/tests/baselines/reference/declaredExternalModuleWithExportAssignment.symbols b/tests/baselines/reference/declaredExternalModuleWithExportAssignment.symbols index 360f57d7a9a..efba0c20c41 100644 --- a/tests/baselines/reference/declaredExternalModuleWithExportAssignment.symbols +++ b/tests/baselines/reference/declaredExternalModuleWithExportAssignment.symbols @@ -13,13 +13,13 @@ declare module 'connect' { >connectExport : Symbol(connectExport, Decl(declaredExternalModuleWithExportAssignment.ts, 3, 5)) use: (mod: connectModule) => connectExport; ->use : Symbol(use, Decl(declaredExternalModuleWithExportAssignment.ts, 5, 29)) +>use : Symbol(connectExport.use, Decl(declaredExternalModuleWithExportAssignment.ts, 5, 29)) >mod : Symbol(mod, Decl(declaredExternalModuleWithExportAssignment.ts, 6, 14)) >connectModule : Symbol(connectModule, Decl(declaredExternalModuleWithExportAssignment.ts, 0, 26)) >connectExport : Symbol(connectExport, Decl(declaredExternalModuleWithExportAssignment.ts, 3, 5)) listen: (port: number) => void; ->listen : Symbol(listen, Decl(declaredExternalModuleWithExportAssignment.ts, 6, 51)) +>listen : Symbol(connectExport.listen, Decl(declaredExternalModuleWithExportAssignment.ts, 6, 51)) >port : Symbol(port, Decl(declaredExternalModuleWithExportAssignment.ts, 7, 17)) } diff --git a/tests/baselines/reference/decoratedClassFromExternalModule.js b/tests/baselines/reference/decoratedClassFromExternalModule.js index 000fe2f37d6..ce397323d9c 100644 --- a/tests/baselines/reference/decoratedClassFromExternalModule.js +++ b/tests/baselines/reference/decoratedClassFromExternalModule.js @@ -17,7 +17,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, return c > 3 && r && Object.defineProperty(target, key, r), r; }; function decorate(target) { } -let Decorated = class { +let Decorated = class Decorated { }; Decorated = __decorate([ decorate diff --git a/tests/baselines/reference/decoratedDefaultExportsGetExportedAmd.js b/tests/baselines/reference/decoratedDefaultExportsGetExportedAmd.js index dbbe72ba52c..14ede865a2f 100644 --- a/tests/baselines/reference/decoratedDefaultExportsGetExportedAmd.js +++ b/tests/baselines/reference/decoratedDefaultExportsGetExportedAmd.js @@ -23,7 +23,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, define(["require", "exports"], function (require, exports) { "use strict"; var decorator; - let Foo = class { + let Foo = class Foo { }; Foo = __decorate([ decorator diff --git a/tests/baselines/reference/decoratedDefaultExportsGetExportedAmd.symbols b/tests/baselines/reference/decoratedDefaultExportsGetExportedAmd.symbols index 4414fd9ef87..3e7ec568927 100644 --- a/tests/baselines/reference/decoratedDefaultExportsGetExportedAmd.symbols +++ b/tests/baselines/reference/decoratedDefaultExportsGetExportedAmd.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/moduleExportsAmd/a.ts === var decorator: ClassDecorator; >decorator : Symbol(decorator, Decl(a.ts, 0, 3)) ->ClassDecorator : Symbol(ClassDecorator, Decl(lib.d.ts, --, --)) +>ClassDecorator : Symbol(ClassDecorator, Decl(lib.es5.d.ts, --, --)) @decorator >decorator : Symbol(decorator, Decl(a.ts, 0, 3)) @@ -12,7 +12,7 @@ export default class Foo {} === tests/cases/conformance/es6/moduleExportsAmd/b.ts === var decorator: ClassDecorator; >decorator : Symbol(decorator, Decl(b.ts, 0, 3)) ->ClassDecorator : Symbol(ClassDecorator, Decl(lib.d.ts, --, --)) +>ClassDecorator : Symbol(ClassDecorator, Decl(lib.es5.d.ts, --, --)) @decorator >decorator : Symbol(decorator, Decl(b.ts, 0, 3)) diff --git a/tests/baselines/reference/decoratedDefaultExportsGetExportedCommonjs.js b/tests/baselines/reference/decoratedDefaultExportsGetExportedCommonjs.js index ab518d73cb9..ecc04859234 100644 --- a/tests/baselines/reference/decoratedDefaultExportsGetExportedCommonjs.js +++ b/tests/baselines/reference/decoratedDefaultExportsGetExportedCommonjs.js @@ -22,7 +22,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, return c > 3 && r && Object.defineProperty(target, key, r), r; }; var decorator; -let Foo = class { +let Foo = class Foo { }; Foo = __decorate([ decorator diff --git a/tests/baselines/reference/decoratedDefaultExportsGetExportedCommonjs.symbols b/tests/baselines/reference/decoratedDefaultExportsGetExportedCommonjs.symbols index 4eafc337573..383d7d2c0d2 100644 --- a/tests/baselines/reference/decoratedDefaultExportsGetExportedCommonjs.symbols +++ b/tests/baselines/reference/decoratedDefaultExportsGetExportedCommonjs.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/moduleExportsCommonjs/a.ts === var decorator: ClassDecorator; >decorator : Symbol(decorator, Decl(a.ts, 0, 3)) ->ClassDecorator : Symbol(ClassDecorator, Decl(lib.d.ts, --, --)) +>ClassDecorator : Symbol(ClassDecorator, Decl(lib.es5.d.ts, --, --)) @decorator >decorator : Symbol(decorator, Decl(a.ts, 0, 3)) @@ -12,7 +12,7 @@ export default class Foo {} === tests/cases/conformance/es6/moduleExportsCommonjs/b.ts === var decorator: ClassDecorator; >decorator : Symbol(decorator, Decl(b.ts, 0, 3)) ->ClassDecorator : Symbol(ClassDecorator, Decl(lib.d.ts, --, --)) +>ClassDecorator : Symbol(ClassDecorator, Decl(lib.es5.d.ts, --, --)) @decorator >decorator : Symbol(decorator, Decl(b.ts, 0, 3)) diff --git a/tests/baselines/reference/decoratedDefaultExportsGetExportedSystem.js b/tests/baselines/reference/decoratedDefaultExportsGetExportedSystem.js index be20d5ffc12..d5cd115edc0 100644 --- a/tests/baselines/reference/decoratedDefaultExportsGetExportedSystem.js +++ b/tests/baselines/reference/decoratedDefaultExportsGetExportedSystem.js @@ -13,8 +13,9 @@ var decorator: ClassDecorator; export default class {} //// [a.js] -System.register([], function(exports_1, __moduleName) { +System.register([], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); @@ -25,7 +26,7 @@ System.register([], function(exports_1, __moduleName) { return { setters:[], execute: function() { - let Foo = class { + Foo = class Foo { }; Foo = __decorate([ decorator @@ -35,8 +36,9 @@ System.register([], function(exports_1, __moduleName) { } }); //// [b.js] -System.register([], function(exports_1, __moduleName) { +System.register([], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); @@ -47,7 +49,7 @@ System.register([], function(exports_1, __moduleName) { return { setters:[], execute: function() { - let default_1 = class { + default_1 = class { }; default_1 = __decorate([ decorator diff --git a/tests/baselines/reference/decoratedDefaultExportsGetExportedSystem.symbols b/tests/baselines/reference/decoratedDefaultExportsGetExportedSystem.symbols index 3751c992fa5..73898da76c4 100644 --- a/tests/baselines/reference/decoratedDefaultExportsGetExportedSystem.symbols +++ b/tests/baselines/reference/decoratedDefaultExportsGetExportedSystem.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/moduleExportsSystem/a.ts === var decorator: ClassDecorator; >decorator : Symbol(decorator, Decl(a.ts, 0, 3)) ->ClassDecorator : Symbol(ClassDecorator, Decl(lib.d.ts, --, --)) +>ClassDecorator : Symbol(ClassDecorator, Decl(lib.es5.d.ts, --, --)) @decorator >decorator : Symbol(decorator, Decl(a.ts, 0, 3)) @@ -12,7 +12,7 @@ export default class Foo {} === tests/cases/conformance/es6/moduleExportsSystem/b.ts === var decorator: ClassDecorator; >decorator : Symbol(decorator, Decl(b.ts, 0, 3)) ->ClassDecorator : Symbol(ClassDecorator, Decl(lib.d.ts, --, --)) +>ClassDecorator : Symbol(ClassDecorator, Decl(lib.es5.d.ts, --, --)) @decorator >decorator : Symbol(decorator, Decl(b.ts, 0, 3)) diff --git a/tests/baselines/reference/decoratedDefaultExportsGetExportedUmd.js b/tests/baselines/reference/decoratedDefaultExportsGetExportedUmd.js index f8cb770f1d2..c7b59d01469 100644 --- a/tests/baselines/reference/decoratedDefaultExportsGetExportedUmd.js +++ b/tests/baselines/reference/decoratedDefaultExportsGetExportedUmd.js @@ -30,7 +30,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, })(function (require, exports) { "use strict"; var decorator; - let Foo = class { + let Foo = class Foo { }; Foo = __decorate([ decorator diff --git a/tests/baselines/reference/decoratedDefaultExportsGetExportedUmd.symbols b/tests/baselines/reference/decoratedDefaultExportsGetExportedUmd.symbols index 5ea35d450d0..f93e5411306 100644 --- a/tests/baselines/reference/decoratedDefaultExportsGetExportedUmd.symbols +++ b/tests/baselines/reference/decoratedDefaultExportsGetExportedUmd.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/moduleExportsUmd/a.ts === var decorator: ClassDecorator; >decorator : Symbol(decorator, Decl(a.ts, 0, 3)) ->ClassDecorator : Symbol(ClassDecorator, Decl(lib.d.ts, --, --)) +>ClassDecorator : Symbol(ClassDecorator, Decl(lib.es5.d.ts, --, --)) @decorator >decorator : Symbol(decorator, Decl(a.ts, 0, 3)) @@ -12,7 +12,7 @@ export default class Foo {} === tests/cases/conformance/es6/moduleExportsUmd/b.ts === var decorator: ClassDecorator; >decorator : Symbol(decorator, Decl(b.ts, 0, 3)) ->ClassDecorator : Symbol(ClassDecorator, Decl(lib.d.ts, --, --)) +>ClassDecorator : Symbol(ClassDecorator, Decl(lib.es5.d.ts, --, --)) @decorator >decorator : Symbol(decorator, Decl(b.ts, 0, 3)) diff --git a/tests/baselines/reference/decoratorMetadata.symbols b/tests/baselines/reference/decoratorMetadata.symbols index 842982286d4..ab0ae42dbb3 100644 --- a/tests/baselines/reference/decoratorMetadata.symbols +++ b/tests/baselines/reference/decoratorMetadata.symbols @@ -16,7 +16,7 @@ class MyComponent { >MyComponent : Symbol(MyComponent, Decl(component.ts, 2, 27)) constructor(public Service: Service) { ->Service : Symbol(Service, Decl(component.ts, 6, 16)) +>Service : Symbol(MyComponent.Service, Decl(component.ts, 6, 16)) >Service : Symbol(Service, Decl(component.ts, 0, 6)) } @@ -24,7 +24,7 @@ class MyComponent { >decorator : Symbol(decorator, Decl(component.ts, 2, 11)) method(x: this) { ->method : Symbol(method, Decl(component.ts, 7, 5)) +>method : Symbol(MyComponent.method, Decl(component.ts, 7, 5)) >x : Symbol(x, Decl(component.ts, 10, 11)) } } diff --git a/tests/baselines/reference/decoratorMetadataForMethodWithNoReturnTypeAnnotation01.symbols b/tests/baselines/reference/decoratorMetadataForMethodWithNoReturnTypeAnnotation01.symbols index 79c6fcbf24f..cf550fb26e1 100644 --- a/tests/baselines/reference/decoratorMetadataForMethodWithNoReturnTypeAnnotation01.symbols +++ b/tests/baselines/reference/decoratorMetadataForMethodWithNoReturnTypeAnnotation01.symbols @@ -16,7 +16,7 @@ class MyClass { >decorator : Symbol(decorator, Decl(decoratorMetadataForMethodWithNoReturnTypeAnnotation01.ts, 1, 11)) doSomething() { ->doSomething : Symbol(doSomething, Decl(decoratorMetadataForMethodWithNoReturnTypeAnnotation01.ts, 6, 5)) +>doSomething : Symbol(MyClass.doSomething, Decl(decoratorMetadataForMethodWithNoReturnTypeAnnotation01.ts, 6, 5)) } } diff --git a/tests/baselines/reference/decoratorMetadataOnInferredType.symbols b/tests/baselines/reference/decoratorMetadataOnInferredType.symbols index 09530f9cecf..5e0568a44a2 100644 --- a/tests/baselines/reference/decoratorMetadataOnInferredType.symbols +++ b/tests/baselines/reference/decoratorMetadataOnInferredType.symbols @@ -32,7 +32,7 @@ export class B { >decorator : Symbol(decorator, Decl(decoratorMetadataOnInferredType.ts, 7, 1)) x = new A(); ->x : Symbol(x, Decl(decoratorMetadataOnInferredType.ts, 12, 16)) +>x : Symbol(B.x, Decl(decoratorMetadataOnInferredType.ts, 12, 16)) >A : Symbol(A, Decl(decoratorMetadataOnInferredType.ts, 3, 2)) } diff --git a/tests/baselines/reference/decoratorMetadataWithConstructorType.symbols b/tests/baselines/reference/decoratorMetadataWithConstructorType.symbols index db1c388f206..5ee6edd1aee 100644 --- a/tests/baselines/reference/decoratorMetadataWithConstructorType.symbols +++ b/tests/baselines/reference/decoratorMetadataWithConstructorType.symbols @@ -32,7 +32,7 @@ export class B { >decorator : Symbol(decorator, Decl(decoratorMetadataWithConstructorType.ts, 7, 1)) x: A = new A(); ->x : Symbol(x, Decl(decoratorMetadataWithConstructorType.ts, 12, 16)) +>x : Symbol(B.x, Decl(decoratorMetadataWithConstructorType.ts, 12, 16)) >A : Symbol(A, Decl(decoratorMetadataWithConstructorType.ts, 3, 2)) >A : Symbol(A, Decl(decoratorMetadataWithConstructorType.ts, 3, 2)) } diff --git a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision.symbols b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision.symbols index c967239df99..20b77b7550f 100644 --- a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision.symbols +++ b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision.symbols @@ -3,7 +3,7 @@ export class db { >db : Symbol(db, Decl(db.ts, 0, 0)) public doSomething() { ->doSomething : Symbol(doSomething, Decl(db.ts, 0, 17)) +>doSomething : Symbol(db.doSomething, Decl(db.ts, 0, 17)) } } @@ -25,7 +25,7 @@ class MyClass { >MyClass : Symbol(MyClass, Decl(service.ts, 3, 1)) db: db; ->db : Symbol(db, Decl(service.ts, 5, 15)) +>db : Symbol(MyClass.db, Decl(service.ts, 5, 15)) >db : Symbol(db, Decl(service.ts, 0, 8)) constructor(db: db) { @@ -33,16 +33,16 @@ class MyClass { >db : Symbol(db, Decl(service.ts, 0, 8)) this.db = db; ->this.db : Symbol(db, Decl(service.ts, 5, 15)) +>this.db : Symbol(MyClass.db, Decl(service.ts, 5, 15)) >this : Symbol(MyClass, Decl(service.ts, 3, 1)) ->db : Symbol(db, Decl(service.ts, 5, 15)) +>db : Symbol(MyClass.db, Decl(service.ts, 5, 15)) >db : Symbol(db, Decl(service.ts, 8, 16)) this.db.doSomething(); >this.db.doSomething : Symbol(db.doSomething, Decl(db.ts, 0, 17)) ->this.db : Symbol(db, Decl(service.ts, 5, 15)) +>this.db : Symbol(MyClass.db, Decl(service.ts, 5, 15)) >this : Symbol(MyClass, Decl(service.ts, 3, 1)) ->db : Symbol(db, Decl(service.ts, 5, 15)) +>db : Symbol(MyClass.db, Decl(service.ts, 5, 15)) >doSomething : Symbol(db.doSomething, Decl(db.ts, 0, 17)) } } diff --git a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision2.symbols b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision2.symbols index d79b05f68f6..b25eaf73fbd 100644 --- a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision2.symbols +++ b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision2.symbols @@ -3,7 +3,7 @@ export class db { >db : Symbol(db, Decl(db.ts, 0, 0)) public doSomething() { ->doSomething : Symbol(doSomething, Decl(db.ts, 0, 17)) +>doSomething : Symbol(db.doSomething, Decl(db.ts, 0, 17)) } } @@ -26,7 +26,7 @@ class MyClass { >MyClass : Symbol(MyClass, Decl(service.ts, 3, 1)) db: Database; ->db : Symbol(db, Decl(service.ts, 5, 15)) +>db : Symbol(MyClass.db, Decl(service.ts, 5, 15)) >Database : Symbol(Database, Decl(service.ts, 0, 8)) constructor(db: Database) { // no collision @@ -34,16 +34,16 @@ class MyClass { >Database : Symbol(Database, Decl(service.ts, 0, 8)) this.db = db; ->this.db : Symbol(db, Decl(service.ts, 5, 15)) +>this.db : Symbol(MyClass.db, Decl(service.ts, 5, 15)) >this : Symbol(MyClass, Decl(service.ts, 3, 1)) ->db : Symbol(db, Decl(service.ts, 5, 15)) +>db : Symbol(MyClass.db, Decl(service.ts, 5, 15)) >db : Symbol(db, Decl(service.ts, 8, 16)) this.db.doSomething(); >this.db.doSomething : Symbol(Database.doSomething, Decl(db.ts, 0, 17)) ->this.db : Symbol(db, Decl(service.ts, 5, 15)) +>this.db : Symbol(MyClass.db, Decl(service.ts, 5, 15)) >this : Symbol(MyClass, Decl(service.ts, 3, 1)) ->db : Symbol(db, Decl(service.ts, 5, 15)) +>db : Symbol(MyClass.db, Decl(service.ts, 5, 15)) >doSomething : Symbol(Database.doSomething, Decl(db.ts, 0, 17)) } } diff --git a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision3.symbols b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision3.symbols index b34468c7bd5..867b519a166 100644 --- a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision3.symbols +++ b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision3.symbols @@ -16,7 +16,7 @@ class MyClass { >MyClass : Symbol(MyClass, Decl(service.ts, 3, 1)) db: db.db; ->db : Symbol(db, Decl(service.ts, 5, 15)) +>db : Symbol(MyClass.db, Decl(service.ts, 5, 15)) >db : Symbol(db, Decl(service.ts, 0, 0)) >db : Symbol(db.db, Decl(db.ts, 0, 0)) @@ -26,16 +26,16 @@ class MyClass { >db : Symbol(db.db, Decl(db.ts, 0, 0)) this.db = db; ->this.db : Symbol(db, Decl(service.ts, 5, 15)) +>this.db : Symbol(MyClass.db, Decl(service.ts, 5, 15)) >this : Symbol(MyClass, Decl(service.ts, 3, 1)) ->db : Symbol(db, Decl(service.ts, 5, 15)) +>db : Symbol(MyClass.db, Decl(service.ts, 5, 15)) >db : Symbol(db, Decl(service.ts, 8, 16)) this.db.doSomething(); >this.db.doSomething : Symbol(db.db.doSomething, Decl(db.ts, 0, 17)) ->this.db : Symbol(db, Decl(service.ts, 5, 15)) +>this.db : Symbol(MyClass.db, Decl(service.ts, 5, 15)) >this : Symbol(MyClass, Decl(service.ts, 3, 1)) ->db : Symbol(db, Decl(service.ts, 5, 15)) +>db : Symbol(MyClass.db, Decl(service.ts, 5, 15)) >doSomething : Symbol(db.db.doSomething, Decl(db.ts, 0, 17)) } } @@ -47,7 +47,7 @@ export class db { >db : Symbol(db, Decl(db.ts, 0, 0)) public doSomething() { ->doSomething : Symbol(doSomething, Decl(db.ts, 0, 17)) +>doSomething : Symbol(db.doSomething, Decl(db.ts, 0, 17)) } } diff --git a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision5.symbols b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision5.symbols index 6047d7f2882..dbf9d93654b 100644 --- a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision5.symbols +++ b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision5.symbols @@ -3,7 +3,7 @@ export default class db { >db : Symbol(db, Decl(db.ts, 0, 0)) public doSomething() { ->doSomething : Symbol(doSomething, Decl(db.ts, 0, 25)) +>doSomething : Symbol(db.doSomething, Decl(db.ts, 0, 25)) } } @@ -25,7 +25,7 @@ class MyClass { >MyClass : Symbol(MyClass, Decl(service.ts, 3, 1)) db: db; ->db : Symbol(db, Decl(service.ts, 5, 15)) +>db : Symbol(MyClass.db, Decl(service.ts, 5, 15)) >db : Symbol(db, Decl(service.ts, 0, 6)) constructor(db: db) { // collision @@ -33,16 +33,16 @@ class MyClass { >db : Symbol(db, Decl(service.ts, 0, 6)) this.db = db; ->this.db : Symbol(db, Decl(service.ts, 5, 15)) +>this.db : Symbol(MyClass.db, Decl(service.ts, 5, 15)) >this : Symbol(MyClass, Decl(service.ts, 3, 1)) ->db : Symbol(db, Decl(service.ts, 5, 15)) +>db : Symbol(MyClass.db, Decl(service.ts, 5, 15)) >db : Symbol(db, Decl(service.ts, 8, 16)) this.db.doSomething(); >this.db.doSomething : Symbol(db.doSomething, Decl(db.ts, 0, 25)) ->this.db : Symbol(db, Decl(service.ts, 5, 15)) +>this.db : Symbol(MyClass.db, Decl(service.ts, 5, 15)) >this : Symbol(MyClass, Decl(service.ts, 3, 1)) ->db : Symbol(db, Decl(service.ts, 5, 15)) +>db : Symbol(MyClass.db, Decl(service.ts, 5, 15)) >doSomething : Symbol(db.doSomething, Decl(db.ts, 0, 25)) } } diff --git a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision6.symbols b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision6.symbols index 27f807503bf..9225cdd1212 100644 --- a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision6.symbols +++ b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision6.symbols @@ -3,7 +3,7 @@ export default class db { >db : Symbol(db, Decl(db.ts, 0, 0)) public doSomething() { ->doSomething : Symbol(doSomething, Decl(db.ts, 0, 25)) +>doSomething : Symbol(db.doSomething, Decl(db.ts, 0, 25)) } } @@ -25,7 +25,7 @@ class MyClass { >MyClass : Symbol(MyClass, Decl(service.ts, 3, 1)) db: database; ->db : Symbol(db, Decl(service.ts, 5, 15)) +>db : Symbol(MyClass.db, Decl(service.ts, 5, 15)) >database : Symbol(database, Decl(service.ts, 0, 6)) constructor(db: database) { // no collision @@ -33,16 +33,16 @@ class MyClass { >database : Symbol(database, Decl(service.ts, 0, 6)) this.db = db; ->this.db : Symbol(db, Decl(service.ts, 5, 15)) +>this.db : Symbol(MyClass.db, Decl(service.ts, 5, 15)) >this : Symbol(MyClass, Decl(service.ts, 3, 1)) ->db : Symbol(db, Decl(service.ts, 5, 15)) +>db : Symbol(MyClass.db, Decl(service.ts, 5, 15)) >db : Symbol(db, Decl(service.ts, 8, 16)) this.db.doSomething(); >this.db.doSomething : Symbol(database.doSomething, Decl(db.ts, 0, 25)) ->this.db : Symbol(db, Decl(service.ts, 5, 15)) +>this.db : Symbol(MyClass.db, Decl(service.ts, 5, 15)) >this : Symbol(MyClass, Decl(service.ts, 3, 1)) ->db : Symbol(db, Decl(service.ts, 5, 15)) +>db : Symbol(MyClass.db, Decl(service.ts, 5, 15)) >doSomething : Symbol(database.doSomething, Decl(db.ts, 0, 25)) } } diff --git a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision8.symbols b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision8.symbols index 1b73ea2e9a3..079c9c8ee91 100644 --- a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision8.symbols +++ b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision8.symbols @@ -16,7 +16,7 @@ class MyClass { >MyClass : Symbol(MyClass, Decl(service.ts, 3, 1)) db: database.db; ->db : Symbol(db, Decl(service.ts, 5, 15)) +>db : Symbol(MyClass.db, Decl(service.ts, 5, 15)) >database : Symbol(database, Decl(service.ts, 0, 0)) >db : Symbol(database.db, Decl(db.ts, 0, 0)) @@ -26,16 +26,16 @@ class MyClass { >db : Symbol(database.db, Decl(db.ts, 0, 0)) this.db = db; ->this.db : Symbol(db, Decl(service.ts, 5, 15)) +>this.db : Symbol(MyClass.db, Decl(service.ts, 5, 15)) >this : Symbol(MyClass, Decl(service.ts, 3, 1)) ->db : Symbol(db, Decl(service.ts, 5, 15)) +>db : Symbol(MyClass.db, Decl(service.ts, 5, 15)) >db : Symbol(db, Decl(service.ts, 8, 16)) this.db.doSomething(); >this.db.doSomething : Symbol(database.db.doSomething, Decl(db.ts, 0, 17)) ->this.db : Symbol(db, Decl(service.ts, 5, 15)) +>this.db : Symbol(MyClass.db, Decl(service.ts, 5, 15)) >this : Symbol(MyClass, Decl(service.ts, 3, 1)) ->db : Symbol(db, Decl(service.ts, 5, 15)) +>db : Symbol(MyClass.db, Decl(service.ts, 5, 15)) >doSomething : Symbol(database.db.doSomething, Decl(db.ts, 0, 17)) } } @@ -47,7 +47,7 @@ export class db { >db : Symbol(db, Decl(db.ts, 0, 0)) public doSomething() { ->doSomething : Symbol(doSomething, Decl(db.ts, 0, 17)) +>doSomething : Symbol(db.doSomething, Decl(db.ts, 0, 17)) } } diff --git a/tests/baselines/reference/decoratorOnClass1.es6.js b/tests/baselines/reference/decoratorOnClass1.es6.js new file mode 100644 index 00000000000..7a02b9f5cd8 --- /dev/null +++ b/tests/baselines/reference/decoratorOnClass1.es6.js @@ -0,0 +1,22 @@ +//// [decoratorOnClass1.es6.ts] +declare function dec(target: T): T; + +@dec +class C { +} + +let c = new C(); + +//// [decoratorOnClass1.es6.js] +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +let C = class C { +}; +C = __decorate([ + dec +], C); +let c = new C(); diff --git a/tests/baselines/reference/decoratorOnClass1.es6.symbols b/tests/baselines/reference/decoratorOnClass1.es6.symbols new file mode 100644 index 00000000000..aac2535d9cf --- /dev/null +++ b/tests/baselines/reference/decoratorOnClass1.es6.symbols @@ -0,0 +1,19 @@ +=== tests/cases/conformance/es6/decorators/class/decoratorOnClass1.es6.ts === +declare function dec(target: T): T; +>dec : Symbol(dec, Decl(decoratorOnClass1.es6.ts, 0, 0)) +>T : Symbol(T, Decl(decoratorOnClass1.es6.ts, 0, 21)) +>target : Symbol(target, Decl(decoratorOnClass1.es6.ts, 0, 24)) +>T : Symbol(T, Decl(decoratorOnClass1.es6.ts, 0, 21)) +>T : Symbol(T, Decl(decoratorOnClass1.es6.ts, 0, 21)) + +@dec +>dec : Symbol(dec, Decl(decoratorOnClass1.es6.ts, 0, 0)) + +class C { +>C : Symbol(C, Decl(decoratorOnClass1.es6.ts, 0, 38)) +} + +let c = new C(); +>c : Symbol(c, Decl(decoratorOnClass1.es6.ts, 6, 3)) +>C : Symbol(C, Decl(decoratorOnClass1.es6.ts, 0, 38)) + diff --git a/tests/baselines/reference/decoratorOnClass1.es6.types b/tests/baselines/reference/decoratorOnClass1.es6.types new file mode 100644 index 00000000000..fe7ef79ea62 --- /dev/null +++ b/tests/baselines/reference/decoratorOnClass1.es6.types @@ -0,0 +1,20 @@ +=== tests/cases/conformance/es6/decorators/class/decoratorOnClass1.es6.ts === +declare function dec(target: T): T; +>dec : (target: T) => T +>T : T +>target : T +>T : T +>T : T + +@dec +>dec : (target: T) => T + +class C { +>C : C +} + +let c = new C(); +>c : C +>new C() : C +>C : typeof C + diff --git a/tests/baselines/reference/decoratorOnClass2.es6.js b/tests/baselines/reference/decoratorOnClass2.es6.js new file mode 100644 index 00000000000..872f241bc9c --- /dev/null +++ b/tests/baselines/reference/decoratorOnClass2.es6.js @@ -0,0 +1,22 @@ +//// [decoratorOnClass2.es6.ts] +declare function dec(target: T): T; + +@dec +export class C { +} + +let c = new C(); + +//// [decoratorOnClass2.es6.js] +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +export let C = class C { +}; +C = __decorate([ + dec +], C); +let c = new C(); diff --git a/tests/baselines/reference/decoratorOnClass2.es6.symbols b/tests/baselines/reference/decoratorOnClass2.es6.symbols new file mode 100644 index 00000000000..af0dc7c1fad --- /dev/null +++ b/tests/baselines/reference/decoratorOnClass2.es6.symbols @@ -0,0 +1,19 @@ +=== tests/cases/conformance/es6/decorators/class/decoratorOnClass2.es6.ts === +declare function dec(target: T): T; +>dec : Symbol(dec, Decl(decoratorOnClass2.es6.ts, 0, 0)) +>T : Symbol(T, Decl(decoratorOnClass2.es6.ts, 0, 21)) +>target : Symbol(target, Decl(decoratorOnClass2.es6.ts, 0, 24)) +>T : Symbol(T, Decl(decoratorOnClass2.es6.ts, 0, 21)) +>T : Symbol(T, Decl(decoratorOnClass2.es6.ts, 0, 21)) + +@dec +>dec : Symbol(dec, Decl(decoratorOnClass2.es6.ts, 0, 0)) + +export class C { +>C : Symbol(C, Decl(decoratorOnClass2.es6.ts, 0, 38)) +} + +let c = new C(); +>c : Symbol(c, Decl(decoratorOnClass2.es6.ts, 6, 3)) +>C : Symbol(C, Decl(decoratorOnClass2.es6.ts, 0, 38)) + diff --git a/tests/baselines/reference/decoratorOnClass2.es6.types b/tests/baselines/reference/decoratorOnClass2.es6.types new file mode 100644 index 00000000000..2845ab1b977 --- /dev/null +++ b/tests/baselines/reference/decoratorOnClass2.es6.types @@ -0,0 +1,20 @@ +=== tests/cases/conformance/es6/decorators/class/decoratorOnClass2.es6.ts === +declare function dec(target: T): T; +>dec : (target: T) => T +>T : T +>target : T +>T : T +>T : T + +@dec +>dec : (target: T) => T + +export class C { +>C : C +} + +let c = new C(); +>c : C +>new C() : C +>C : typeof C + diff --git a/tests/baselines/reference/decoratorOnClass3.es6.js b/tests/baselines/reference/decoratorOnClass3.es6.js new file mode 100644 index 00000000000..a6b1d6e2589 --- /dev/null +++ b/tests/baselines/reference/decoratorOnClass3.es6.js @@ -0,0 +1,23 @@ +//// [decoratorOnClass3.es6.ts] +declare function dec(target: T): T; + +@dec +export default class C { +} + +let c = new C(); + +//// [decoratorOnClass3.es6.js] +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +let C = class C { +}; +C = __decorate([ + dec +], C); +export default C; +let c = new C(); diff --git a/tests/baselines/reference/decoratorOnClass3.es6.symbols b/tests/baselines/reference/decoratorOnClass3.es6.symbols new file mode 100644 index 00000000000..d769d1c97a1 --- /dev/null +++ b/tests/baselines/reference/decoratorOnClass3.es6.symbols @@ -0,0 +1,19 @@ +=== tests/cases/conformance/es6/decorators/class/decoratorOnClass3.es6.ts === +declare function dec(target: T): T; +>dec : Symbol(dec, Decl(decoratorOnClass3.es6.ts, 0, 0)) +>T : Symbol(T, Decl(decoratorOnClass3.es6.ts, 0, 21)) +>target : Symbol(target, Decl(decoratorOnClass3.es6.ts, 0, 24)) +>T : Symbol(T, Decl(decoratorOnClass3.es6.ts, 0, 21)) +>T : Symbol(T, Decl(decoratorOnClass3.es6.ts, 0, 21)) + +@dec +>dec : Symbol(dec, Decl(decoratorOnClass3.es6.ts, 0, 0)) + +export default class C { +>C : Symbol(C, Decl(decoratorOnClass3.es6.ts, 0, 38)) +} + +let c = new C(); +>c : Symbol(c, Decl(decoratorOnClass3.es6.ts, 6, 3)) +>C : Symbol(C, Decl(decoratorOnClass3.es6.ts, 0, 38)) + diff --git a/tests/baselines/reference/decoratorOnClass3.es6.types b/tests/baselines/reference/decoratorOnClass3.es6.types new file mode 100644 index 00000000000..7b19c4bad8e --- /dev/null +++ b/tests/baselines/reference/decoratorOnClass3.es6.types @@ -0,0 +1,20 @@ +=== tests/cases/conformance/es6/decorators/class/decoratorOnClass3.es6.ts === +declare function dec(target: T): T; +>dec : (target: T) => T +>T : T +>target : T +>T : T +>T : T + +@dec +>dec : (target: T) => T + +export default class C { +>C : C +} + +let c = new C(); +>c : C +>new C() : C +>C : typeof C + diff --git a/tests/baselines/reference/decoratorOnClass4.es6.js b/tests/baselines/reference/decoratorOnClass4.es6.js new file mode 100644 index 00000000000..0435c822da6 --- /dev/null +++ b/tests/baselines/reference/decoratorOnClass4.es6.js @@ -0,0 +1,20 @@ +//// [decoratorOnClass4.es6.ts] +declare function dec(target: T): T; + +@dec +export default class { +} + +//// [decoratorOnClass4.es6.js] +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +let default_1 = class { +}; +default_1 = __decorate([ + dec +], default_1); +export default default_1; diff --git a/tests/baselines/reference/decoratorOnClass4.es6.symbols b/tests/baselines/reference/decoratorOnClass4.es6.symbols new file mode 100644 index 00000000000..fff39c72f1c --- /dev/null +++ b/tests/baselines/reference/decoratorOnClass4.es6.symbols @@ -0,0 +1,13 @@ +=== tests/cases/conformance/es6/decorators/class/decoratorOnClass4.es6.ts === +declare function dec(target: T): T; +>dec : Symbol(dec, Decl(decoratorOnClass4.es6.ts, 0, 0)) +>T : Symbol(T, Decl(decoratorOnClass4.es6.ts, 0, 21)) +>target : Symbol(target, Decl(decoratorOnClass4.es6.ts, 0, 24)) +>T : Symbol(T, Decl(decoratorOnClass4.es6.ts, 0, 21)) +>T : Symbol(T, Decl(decoratorOnClass4.es6.ts, 0, 21)) + +@dec +>dec : Symbol(dec, Decl(decoratorOnClass4.es6.ts, 0, 0)) + +export default class { +} diff --git a/tests/baselines/reference/decoratorOnClass4.es6.types b/tests/baselines/reference/decoratorOnClass4.es6.types new file mode 100644 index 00000000000..7dfce858076 --- /dev/null +++ b/tests/baselines/reference/decoratorOnClass4.es6.types @@ -0,0 +1,13 @@ +=== tests/cases/conformance/es6/decorators/class/decoratorOnClass4.es6.ts === +declare function dec(target: T): T; +>dec : (target: T) => T +>T : T +>target : T +>T : T +>T : T + +@dec +>dec : (target: T) => T + +export default class { +} diff --git a/tests/baselines/reference/decoratorOnClass5.es6.js b/tests/baselines/reference/decoratorOnClass5.es6.js new file mode 100644 index 00000000000..58c5f0d4f29 --- /dev/null +++ b/tests/baselines/reference/decoratorOnClass5.es6.js @@ -0,0 +1,27 @@ +//// [decoratorOnClass5.es6.ts] +declare function dec(target: T): T; + +@dec +class C { + static x() { return C.y; } + static y = 1; +} + +let c = new C(); + +//// [decoratorOnClass5.es6.js] +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +let C_1; +let C = C_1 = class C { + static x() { return C_1.y; } +}; +C.y = 1; +C = C_1 = __decorate([ + dec +], C); +let c = new C(); diff --git a/tests/baselines/reference/decoratorOnClass5.es6.symbols b/tests/baselines/reference/decoratorOnClass5.es6.symbols new file mode 100644 index 00000000000..aa62a593019 --- /dev/null +++ b/tests/baselines/reference/decoratorOnClass5.es6.symbols @@ -0,0 +1,28 @@ +=== tests/cases/conformance/es6/decorators/class/decoratorOnClass5.es6.ts === +declare function dec(target: T): T; +>dec : Symbol(dec, Decl(decoratorOnClass5.es6.ts, 0, 0)) +>T : Symbol(T, Decl(decoratorOnClass5.es6.ts, 0, 21)) +>target : Symbol(target, Decl(decoratorOnClass5.es6.ts, 0, 24)) +>T : Symbol(T, Decl(decoratorOnClass5.es6.ts, 0, 21)) +>T : Symbol(T, Decl(decoratorOnClass5.es6.ts, 0, 21)) + +@dec +>dec : Symbol(dec, Decl(decoratorOnClass5.es6.ts, 0, 0)) + +class C { +>C : Symbol(C, Decl(decoratorOnClass5.es6.ts, 0, 38)) + + static x() { return C.y; } +>x : Symbol(C.x, Decl(decoratorOnClass5.es6.ts, 3, 9)) +>C.y : Symbol(C.y, Decl(decoratorOnClass5.es6.ts, 4, 30)) +>C : Symbol(C, Decl(decoratorOnClass5.es6.ts, 0, 38)) +>y : Symbol(C.y, Decl(decoratorOnClass5.es6.ts, 4, 30)) + + static y = 1; +>y : Symbol(C.y, Decl(decoratorOnClass5.es6.ts, 4, 30)) +} + +let c = new C(); +>c : Symbol(c, Decl(decoratorOnClass5.es6.ts, 8, 3)) +>C : Symbol(C, Decl(decoratorOnClass5.es6.ts, 0, 38)) + diff --git a/tests/baselines/reference/decoratorOnClass5.es6.types b/tests/baselines/reference/decoratorOnClass5.es6.types new file mode 100644 index 00000000000..5532c50fe52 --- /dev/null +++ b/tests/baselines/reference/decoratorOnClass5.es6.types @@ -0,0 +1,30 @@ +=== tests/cases/conformance/es6/decorators/class/decoratorOnClass5.es6.ts === +declare function dec(target: T): T; +>dec : (target: T) => T +>T : T +>target : T +>T : T +>T : T + +@dec +>dec : (target: T) => T + +class C { +>C : C + + static x() { return C.y; } +>x : () => number +>C.y : number +>C : typeof C +>y : number + + static y = 1; +>y : number +>1 : number +} + +let c = new C(); +>c : C +>new C() : C +>C : typeof C + diff --git a/tests/baselines/reference/decoratorOnClass6.es6.js b/tests/baselines/reference/decoratorOnClass6.es6.js new file mode 100644 index 00000000000..03b8ace2b5b --- /dev/null +++ b/tests/baselines/reference/decoratorOnClass6.es6.js @@ -0,0 +1,27 @@ +//// [decoratorOnClass6.es6.ts] +declare function dec(target: T): T; + +@dec +export class C { + static x() { return C.y; } + static y = 1; +} + +let c = new C(); + +//// [decoratorOnClass6.es6.js] +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +let C_1; +export let C = C_1 = class C { + static x() { return C_1.y; } +}; +C.y = 1; +C = C_1 = __decorate([ + dec +], C); +let c = new C(); diff --git a/tests/baselines/reference/decoratorOnClass6.es6.symbols b/tests/baselines/reference/decoratorOnClass6.es6.symbols new file mode 100644 index 00000000000..f778128e40b --- /dev/null +++ b/tests/baselines/reference/decoratorOnClass6.es6.symbols @@ -0,0 +1,28 @@ +=== tests/cases/conformance/es6/decorators/class/decoratorOnClass6.es6.ts === +declare function dec(target: T): T; +>dec : Symbol(dec, Decl(decoratorOnClass6.es6.ts, 0, 0)) +>T : Symbol(T, Decl(decoratorOnClass6.es6.ts, 0, 21)) +>target : Symbol(target, Decl(decoratorOnClass6.es6.ts, 0, 24)) +>T : Symbol(T, Decl(decoratorOnClass6.es6.ts, 0, 21)) +>T : Symbol(T, Decl(decoratorOnClass6.es6.ts, 0, 21)) + +@dec +>dec : Symbol(dec, Decl(decoratorOnClass6.es6.ts, 0, 0)) + +export class C { +>C : Symbol(C, Decl(decoratorOnClass6.es6.ts, 0, 38)) + + static x() { return C.y; } +>x : Symbol(C.x, Decl(decoratorOnClass6.es6.ts, 3, 16)) +>C.y : Symbol(C.y, Decl(decoratorOnClass6.es6.ts, 4, 30)) +>C : Symbol(C, Decl(decoratorOnClass6.es6.ts, 0, 38)) +>y : Symbol(C.y, Decl(decoratorOnClass6.es6.ts, 4, 30)) + + static y = 1; +>y : Symbol(C.y, Decl(decoratorOnClass6.es6.ts, 4, 30)) +} + +let c = new C(); +>c : Symbol(c, Decl(decoratorOnClass6.es6.ts, 8, 3)) +>C : Symbol(C, Decl(decoratorOnClass6.es6.ts, 0, 38)) + diff --git a/tests/baselines/reference/decoratorOnClass6.es6.types b/tests/baselines/reference/decoratorOnClass6.es6.types new file mode 100644 index 00000000000..0b335558400 --- /dev/null +++ b/tests/baselines/reference/decoratorOnClass6.es6.types @@ -0,0 +1,30 @@ +=== tests/cases/conformance/es6/decorators/class/decoratorOnClass6.es6.ts === +declare function dec(target: T): T; +>dec : (target: T) => T +>T : T +>target : T +>T : T +>T : T + +@dec +>dec : (target: T) => T + +export class C { +>C : C + + static x() { return C.y; } +>x : () => number +>C.y : number +>C : typeof C +>y : number + + static y = 1; +>y : number +>1 : number +} + +let c = new C(); +>c : C +>new C() : C +>C : typeof C + diff --git a/tests/baselines/reference/decoratorOnClass7.es6.js b/tests/baselines/reference/decoratorOnClass7.es6.js new file mode 100644 index 00000000000..3ffd0f1574f --- /dev/null +++ b/tests/baselines/reference/decoratorOnClass7.es6.js @@ -0,0 +1,28 @@ +//// [decoratorOnClass7.es6.ts] +declare function dec(target: T): T; + +@dec +export default class C { + static x() { return C.y; } + static y = 1; +} + +let c = new C(); + +//// [decoratorOnClass7.es6.js] +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +let C_1; +let C = C_1 = class C { + static x() { return C_1.y; } +}; +C.y = 1; +C = C_1 = __decorate([ + dec +], C); +export default C; +let c = new C(); diff --git a/tests/baselines/reference/decoratorOnClass7.es6.symbols b/tests/baselines/reference/decoratorOnClass7.es6.symbols new file mode 100644 index 00000000000..d010757a9df --- /dev/null +++ b/tests/baselines/reference/decoratorOnClass7.es6.symbols @@ -0,0 +1,28 @@ +=== tests/cases/conformance/es6/decorators/class/decoratorOnClass7.es6.ts === +declare function dec(target: T): T; +>dec : Symbol(dec, Decl(decoratorOnClass7.es6.ts, 0, 0)) +>T : Symbol(T, Decl(decoratorOnClass7.es6.ts, 0, 21)) +>target : Symbol(target, Decl(decoratorOnClass7.es6.ts, 0, 24)) +>T : Symbol(T, Decl(decoratorOnClass7.es6.ts, 0, 21)) +>T : Symbol(T, Decl(decoratorOnClass7.es6.ts, 0, 21)) + +@dec +>dec : Symbol(dec, Decl(decoratorOnClass7.es6.ts, 0, 0)) + +export default class C { +>C : Symbol(C, Decl(decoratorOnClass7.es6.ts, 0, 38)) + + static x() { return C.y; } +>x : Symbol(C.x, Decl(decoratorOnClass7.es6.ts, 3, 24)) +>C.y : Symbol(C.y, Decl(decoratorOnClass7.es6.ts, 4, 30)) +>C : Symbol(C, Decl(decoratorOnClass7.es6.ts, 0, 38)) +>y : Symbol(C.y, Decl(decoratorOnClass7.es6.ts, 4, 30)) + + static y = 1; +>y : Symbol(C.y, Decl(decoratorOnClass7.es6.ts, 4, 30)) +} + +let c = new C(); +>c : Symbol(c, Decl(decoratorOnClass7.es6.ts, 8, 3)) +>C : Symbol(C, Decl(decoratorOnClass7.es6.ts, 0, 38)) + diff --git a/tests/baselines/reference/decoratorOnClass7.es6.types b/tests/baselines/reference/decoratorOnClass7.es6.types new file mode 100644 index 00000000000..af7ae0516e3 --- /dev/null +++ b/tests/baselines/reference/decoratorOnClass7.es6.types @@ -0,0 +1,30 @@ +=== tests/cases/conformance/es6/decorators/class/decoratorOnClass7.es6.ts === +declare function dec(target: T): T; +>dec : (target: T) => T +>T : T +>target : T +>T : T +>T : T + +@dec +>dec : (target: T) => T + +export default class C { +>C : C + + static x() { return C.y; } +>x : () => number +>C.y : number +>C : typeof C +>y : number + + static y = 1; +>y : number +>1 : number +} + +let c = new C(); +>c : C +>new C() : C +>C : typeof C + diff --git a/tests/baselines/reference/decoratorOnClass8.es6.js b/tests/baselines/reference/decoratorOnClass8.es6.js new file mode 100644 index 00000000000..7104098a5f5 --- /dev/null +++ b/tests/baselines/reference/decoratorOnClass8.es6.js @@ -0,0 +1,22 @@ +//// [decoratorOnClass8.es6.ts] +declare function dec(target: T): T; + +@dec +export default class { + static y = 1; +} + +//// [decoratorOnClass8.es6.js] +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +let default_1 = class { +}; +default_1.y = 1; +default_1 = __decorate([ + dec +], default_1); +export default default_1; diff --git a/tests/baselines/reference/decoratorOnClass8.es6.symbols b/tests/baselines/reference/decoratorOnClass8.es6.symbols new file mode 100644 index 00000000000..b219f50ff3d --- /dev/null +++ b/tests/baselines/reference/decoratorOnClass8.es6.symbols @@ -0,0 +1,15 @@ +=== tests/cases/conformance/es6/decorators/class/decoratorOnClass8.es6.ts === +declare function dec(target: T): T; +>dec : Symbol(dec, Decl(decoratorOnClass8.es6.ts, 0, 0)) +>T : Symbol(T, Decl(decoratorOnClass8.es6.ts, 0, 21)) +>target : Symbol(target, Decl(decoratorOnClass8.es6.ts, 0, 24)) +>T : Symbol(T, Decl(decoratorOnClass8.es6.ts, 0, 21)) +>T : Symbol(T, Decl(decoratorOnClass8.es6.ts, 0, 21)) + +@dec +>dec : Symbol(dec, Decl(decoratorOnClass8.es6.ts, 0, 0)) + +export default class { + static y = 1; +>y : Symbol(default.y, Decl(decoratorOnClass8.es6.ts, 3, 22)) +} diff --git a/tests/baselines/reference/decoratorOnClass8.es6.types b/tests/baselines/reference/decoratorOnClass8.es6.types new file mode 100644 index 00000000000..045b036e335 --- /dev/null +++ b/tests/baselines/reference/decoratorOnClass8.es6.types @@ -0,0 +1,16 @@ +=== tests/cases/conformance/es6/decorators/class/decoratorOnClass8.es6.ts === +declare function dec(target: T): T; +>dec : (target: T) => T +>T : T +>target : T +>T : T +>T : T + +@dec +>dec : (target: T) => T + +export default class { + static y = 1; +>y : number +>1 : number +} diff --git a/tests/baselines/reference/decoratorOnClassAccessor1.symbols b/tests/baselines/reference/decoratorOnClassAccessor1.symbols index 6b8e3a16c18..54fe1c7345d 100644 --- a/tests/baselines/reference/decoratorOnClassAccessor1.symbols +++ b/tests/baselines/reference/decoratorOnClassAccessor1.symbols @@ -15,5 +15,5 @@ class C { @dec get accessor() { return 1; } >dec : Symbol(dec, Decl(decoratorOnClassAccessor1.ts, 0, 0)) ->accessor : Symbol(accessor, Decl(decoratorOnClassAccessor1.ts, 2, 9)) +>accessor : Symbol(C.accessor, Decl(decoratorOnClassAccessor1.ts, 2, 9)) } diff --git a/tests/baselines/reference/decoratorOnClassAccessor2.symbols b/tests/baselines/reference/decoratorOnClassAccessor2.symbols index 936afa14de9..cb85e3b261c 100644 --- a/tests/baselines/reference/decoratorOnClassAccessor2.symbols +++ b/tests/baselines/reference/decoratorOnClassAccessor2.symbols @@ -15,5 +15,5 @@ class C { @dec public get accessor() { return 1; } >dec : Symbol(dec, Decl(decoratorOnClassAccessor2.ts, 0, 0)) ->accessor : Symbol(accessor, Decl(decoratorOnClassAccessor2.ts, 2, 9)) +>accessor : Symbol(C.accessor, Decl(decoratorOnClassAccessor2.ts, 2, 9)) } diff --git a/tests/baselines/reference/decoratorOnClassAccessor4.symbols b/tests/baselines/reference/decoratorOnClassAccessor4.symbols index 0acd491abed..47776e58aa5 100644 --- a/tests/baselines/reference/decoratorOnClassAccessor4.symbols +++ b/tests/baselines/reference/decoratorOnClassAccessor4.symbols @@ -15,6 +15,6 @@ class C { @dec set accessor(value: number) { } >dec : Symbol(dec, Decl(decoratorOnClassAccessor4.ts, 0, 0)) ->accessor : Symbol(accessor, Decl(decoratorOnClassAccessor4.ts, 2, 9)) +>accessor : Symbol(C.accessor, Decl(decoratorOnClassAccessor4.ts, 2, 9)) >value : Symbol(value, Decl(decoratorOnClassAccessor4.ts, 3, 22)) } diff --git a/tests/baselines/reference/decoratorOnClassAccessor5.symbols b/tests/baselines/reference/decoratorOnClassAccessor5.symbols index 0585cff96b6..d35e97ece50 100644 --- a/tests/baselines/reference/decoratorOnClassAccessor5.symbols +++ b/tests/baselines/reference/decoratorOnClassAccessor5.symbols @@ -15,6 +15,6 @@ class C { @dec public set accessor(value: number) { } >dec : Symbol(dec, Decl(decoratorOnClassAccessor5.ts, 0, 0)) ->accessor : Symbol(accessor, Decl(decoratorOnClassAccessor5.ts, 2, 9)) +>accessor : Symbol(C.accessor, Decl(decoratorOnClassAccessor5.ts, 2, 9)) >value : Symbol(value, Decl(decoratorOnClassAccessor5.ts, 3, 29)) } diff --git a/tests/baselines/reference/decoratorOnClassMethod1.symbols b/tests/baselines/reference/decoratorOnClassMethod1.symbols index 8a92ad7b01b..bc2143f72a9 100644 --- a/tests/baselines/reference/decoratorOnClassMethod1.symbols +++ b/tests/baselines/reference/decoratorOnClassMethod1.symbols @@ -15,5 +15,5 @@ class C { @dec method() {} >dec : Symbol(dec, Decl(decoratorOnClassMethod1.ts, 0, 0)) ->method : Symbol(method, Decl(decoratorOnClassMethod1.ts, 2, 9)) +>method : Symbol(C.method, Decl(decoratorOnClassMethod1.ts, 2, 9)) } diff --git a/tests/baselines/reference/decoratorOnClassMethod13.symbols b/tests/baselines/reference/decoratorOnClassMethod13.symbols index 6dfcd15d040..7cd369be144 100644 --- a/tests/baselines/reference/decoratorOnClassMethod13.symbols +++ b/tests/baselines/reference/decoratorOnClassMethod13.symbols @@ -5,9 +5,9 @@ declare function dec(target: any, propertyKey: string, descriptor: TypedPrope >target : Symbol(target, Decl(decoratorOnClassMethod13.ts, 0, 24)) >propertyKey : Symbol(propertyKey, Decl(decoratorOnClassMethod13.ts, 0, 36)) >descriptor : Symbol(descriptor, Decl(decoratorOnClassMethod13.ts, 0, 57)) ->TypedPropertyDescriptor : Symbol(TypedPropertyDescriptor, Decl(lib.d.ts, --, --)) +>TypedPropertyDescriptor : Symbol(TypedPropertyDescriptor, Decl(lib.es5.d.ts, --, --)) >T : Symbol(T, Decl(decoratorOnClassMethod13.ts, 0, 21)) ->TypedPropertyDescriptor : Symbol(TypedPropertyDescriptor, Decl(lib.d.ts, --, --)) +>TypedPropertyDescriptor : Symbol(TypedPropertyDescriptor, Decl(lib.es5.d.ts, --, --)) >T : Symbol(T, Decl(decoratorOnClassMethod13.ts, 0, 21)) class C { @@ -15,7 +15,9 @@ class C { @dec ["1"]() { } >dec : Symbol(dec, Decl(decoratorOnClassMethod13.ts, 0, 0)) +>"1" : Symbol(C[["1"]], Decl(decoratorOnClassMethod13.ts, 2, 9)) @dec ["b"]() { } >dec : Symbol(dec, Decl(decoratorOnClassMethod13.ts, 0, 0)) +>"b" : Symbol(C[["b"]], Decl(decoratorOnClassMethod13.ts, 3, 20)) } diff --git a/tests/baselines/reference/decoratorOnClassMethod2.symbols b/tests/baselines/reference/decoratorOnClassMethod2.symbols index ebab8905469..addfdb70d40 100644 --- a/tests/baselines/reference/decoratorOnClassMethod2.symbols +++ b/tests/baselines/reference/decoratorOnClassMethod2.symbols @@ -15,5 +15,5 @@ class C { @dec public method() {} >dec : Symbol(dec, Decl(decoratorOnClassMethod2.ts, 0, 0)) ->method : Symbol(method, Decl(decoratorOnClassMethod2.ts, 2, 9)) +>method : Symbol(C.method, Decl(decoratorOnClassMethod2.ts, 2, 9)) } diff --git a/tests/baselines/reference/decoratorOnClassMethod4.symbols b/tests/baselines/reference/decoratorOnClassMethod4.symbols index 745fb8c4ce7..da0e9eafca7 100644 --- a/tests/baselines/reference/decoratorOnClassMethod4.symbols +++ b/tests/baselines/reference/decoratorOnClassMethod4.symbols @@ -5,9 +5,9 @@ declare function dec(target: any, propertyKey: string, descriptor: TypedPrope >target : Symbol(target, Decl(decoratorOnClassMethod4.ts, 0, 24)) >propertyKey : Symbol(propertyKey, Decl(decoratorOnClassMethod4.ts, 0, 36)) >descriptor : Symbol(descriptor, Decl(decoratorOnClassMethod4.ts, 0, 57)) ->TypedPropertyDescriptor : Symbol(TypedPropertyDescriptor, Decl(lib.d.ts, --, --)) +>TypedPropertyDescriptor : Symbol(TypedPropertyDescriptor, Decl(lib.es5.d.ts, --, --)) >T : Symbol(T, Decl(decoratorOnClassMethod4.ts, 0, 21)) ->TypedPropertyDescriptor : Symbol(TypedPropertyDescriptor, Decl(lib.d.ts, --, --)) +>TypedPropertyDescriptor : Symbol(TypedPropertyDescriptor, Decl(lib.es5.d.ts, --, --)) >T : Symbol(T, Decl(decoratorOnClassMethod4.ts, 0, 21)) class C { @@ -15,4 +15,5 @@ class C { @dec ["method"]() {} >dec : Symbol(dec, Decl(decoratorOnClassMethod4.ts, 0, 0)) +>"method" : Symbol(C[["method"]], Decl(decoratorOnClassMethod4.ts, 2, 9)) } diff --git a/tests/baselines/reference/decoratorOnClassMethod5.symbols b/tests/baselines/reference/decoratorOnClassMethod5.symbols index 124ace783fe..bd895deeea8 100644 --- a/tests/baselines/reference/decoratorOnClassMethod5.symbols +++ b/tests/baselines/reference/decoratorOnClassMethod5.symbols @@ -5,9 +5,9 @@ declare function dec(): (target: any, propertyKey: string, descriptor: TypedP >target : Symbol(target, Decl(decoratorOnClassMethod5.ts, 0, 28)) >propertyKey : Symbol(propertyKey, Decl(decoratorOnClassMethod5.ts, 0, 40)) >descriptor : Symbol(descriptor, Decl(decoratorOnClassMethod5.ts, 0, 61)) ->TypedPropertyDescriptor : Symbol(TypedPropertyDescriptor, Decl(lib.d.ts, --, --)) +>TypedPropertyDescriptor : Symbol(TypedPropertyDescriptor, Decl(lib.es5.d.ts, --, --)) >T : Symbol(T, Decl(decoratorOnClassMethod5.ts, 0, 25)) ->TypedPropertyDescriptor : Symbol(TypedPropertyDescriptor, Decl(lib.d.ts, --, --)) +>TypedPropertyDescriptor : Symbol(TypedPropertyDescriptor, Decl(lib.es5.d.ts, --, --)) >T : Symbol(T, Decl(decoratorOnClassMethod5.ts, 0, 25)) class C { @@ -15,4 +15,5 @@ class C { @dec() ["method"]() {} >dec : Symbol(dec, Decl(decoratorOnClassMethod5.ts, 0, 0)) +>"method" : Symbol(C[["method"]], Decl(decoratorOnClassMethod5.ts, 2, 9)) } diff --git a/tests/baselines/reference/decoratorOnClassMethod7.symbols b/tests/baselines/reference/decoratorOnClassMethod7.symbols index e870a798559..9ec0de0c205 100644 --- a/tests/baselines/reference/decoratorOnClassMethod7.symbols +++ b/tests/baselines/reference/decoratorOnClassMethod7.symbols @@ -5,9 +5,9 @@ declare function dec(target: any, propertyKey: string, descriptor: TypedPrope >target : Symbol(target, Decl(decoratorOnClassMethod7.ts, 0, 24)) >propertyKey : Symbol(propertyKey, Decl(decoratorOnClassMethod7.ts, 0, 36)) >descriptor : Symbol(descriptor, Decl(decoratorOnClassMethod7.ts, 0, 57)) ->TypedPropertyDescriptor : Symbol(TypedPropertyDescriptor, Decl(lib.d.ts, --, --)) +>TypedPropertyDescriptor : Symbol(TypedPropertyDescriptor, Decl(lib.es5.d.ts, --, --)) >T : Symbol(T, Decl(decoratorOnClassMethod7.ts, 0, 21)) ->TypedPropertyDescriptor : Symbol(TypedPropertyDescriptor, Decl(lib.d.ts, --, --)) +>TypedPropertyDescriptor : Symbol(TypedPropertyDescriptor, Decl(lib.es5.d.ts, --, --)) >T : Symbol(T, Decl(decoratorOnClassMethod7.ts, 0, 21)) class C { @@ -15,4 +15,5 @@ class C { @dec public ["method"]() {} >dec : Symbol(dec, Decl(decoratorOnClassMethod7.ts, 0, 0)) +>"method" : Symbol(C[["method"]], Decl(decoratorOnClassMethod7.ts, 2, 9)) } diff --git a/tests/baselines/reference/decoratorOnClassMethodOverload2.symbols b/tests/baselines/reference/decoratorOnClassMethodOverload2.symbols index f05dd624345..71f5c5f8479 100644 --- a/tests/baselines/reference/decoratorOnClassMethodOverload2.symbols +++ b/tests/baselines/reference/decoratorOnClassMethodOverload2.symbols @@ -14,11 +14,11 @@ class C { >C : Symbol(C, Decl(decoratorOnClassMethodOverload2.ts, 0, 126)) method() ->method : Symbol(method, Decl(decoratorOnClassMethodOverload2.ts, 2, 9), Decl(decoratorOnClassMethodOverload2.ts, 3, 12)) +>method : Symbol(C.method, Decl(decoratorOnClassMethodOverload2.ts, 2, 9), Decl(decoratorOnClassMethodOverload2.ts, 3, 12)) @dec >dec : Symbol(dec, Decl(decoratorOnClassMethodOverload2.ts, 0, 0)) method() { } ->method : Symbol(method, Decl(decoratorOnClassMethodOverload2.ts, 2, 9), Decl(decoratorOnClassMethodOverload2.ts, 3, 12)) +>method : Symbol(C.method, Decl(decoratorOnClassMethodOverload2.ts, 2, 9), Decl(decoratorOnClassMethodOverload2.ts, 3, 12)) } diff --git a/tests/baselines/reference/decoratorOnClassMethodParameter1.symbols b/tests/baselines/reference/decoratorOnClassMethodParameter1.symbols index 1358343a9c5..8ce7338dde8 100644 --- a/tests/baselines/reference/decoratorOnClassMethodParameter1.symbols +++ b/tests/baselines/reference/decoratorOnClassMethodParameter1.symbols @@ -10,7 +10,7 @@ class C { >C : Symbol(C, Decl(decoratorOnClassMethodParameter1.ts, 0, 97)) method(@dec p: number) {} ->method : Symbol(method, Decl(decoratorOnClassMethodParameter1.ts, 2, 9)) +>method : Symbol(C.method, Decl(decoratorOnClassMethodParameter1.ts, 2, 9)) >dec : Symbol(dec, Decl(decoratorOnClassMethodParameter1.ts, 0, 0)) >p : Symbol(p, Decl(decoratorOnClassMethodParameter1.ts, 3, 11)) } diff --git a/tests/baselines/reference/decoratorOnClassProperty1.symbols b/tests/baselines/reference/decoratorOnClassProperty1.symbols index 1cf97d5ec3b..3cf25a6fbf1 100644 --- a/tests/baselines/reference/decoratorOnClassProperty1.symbols +++ b/tests/baselines/reference/decoratorOnClassProperty1.symbols @@ -9,5 +9,5 @@ class C { @dec prop; >dec : Symbol(dec, Decl(decoratorOnClassProperty1.ts, 0, 0)) ->prop : Symbol(prop, Decl(decoratorOnClassProperty1.ts, 2, 9)) +>prop : Symbol(C.prop, Decl(decoratorOnClassProperty1.ts, 2, 9)) } diff --git a/tests/baselines/reference/decoratorOnClassProperty10.symbols b/tests/baselines/reference/decoratorOnClassProperty10.symbols index 22af0bd8b50..ef207c95b84 100644 --- a/tests/baselines/reference/decoratorOnClassProperty10.symbols +++ b/tests/baselines/reference/decoratorOnClassProperty10.symbols @@ -10,5 +10,5 @@ class C { @dec() prop; >dec : Symbol(dec, Decl(decoratorOnClassProperty10.ts, 0, 0)) ->prop : Symbol(prop, Decl(decoratorOnClassProperty10.ts, 2, 9)) +>prop : Symbol(C.prop, Decl(decoratorOnClassProperty10.ts, 2, 9)) } diff --git a/tests/baselines/reference/decoratorOnClassProperty2.symbols b/tests/baselines/reference/decoratorOnClassProperty2.symbols index 3383fb1418a..dc86a331166 100644 --- a/tests/baselines/reference/decoratorOnClassProperty2.symbols +++ b/tests/baselines/reference/decoratorOnClassProperty2.symbols @@ -9,5 +9,5 @@ class C { @dec public prop; >dec : Symbol(dec, Decl(decoratorOnClassProperty2.ts, 0, 0)) ->prop : Symbol(prop, Decl(decoratorOnClassProperty2.ts, 2, 9)) +>prop : Symbol(C.prop, Decl(decoratorOnClassProperty2.ts, 2, 9)) } diff --git a/tests/baselines/reference/decrementOperatorWithAnyOtherType.symbols b/tests/baselines/reference/decrementOperatorWithAnyOtherType.symbols index 594e6d50ac4..cbef7442578 100644 --- a/tests/baselines/reference/decrementOperatorWithAnyOtherType.symbols +++ b/tests/baselines/reference/decrementOperatorWithAnyOtherType.symbols @@ -19,7 +19,7 @@ class A { >A : Symbol(A, Decl(decrementOperatorWithAnyOtherType.ts, 5, 23)) public a: any; ->a : Symbol(a, Decl(decrementOperatorWithAnyOtherType.ts, 6, 9)) +>a : Symbol(A.a, Decl(decrementOperatorWithAnyOtherType.ts, 6, 9)) } module M { >M : Symbol(M, Decl(decrementOperatorWithAnyOtherType.ts, 8, 1)) diff --git a/tests/baselines/reference/decrementOperatorWithEnumType.errors.txt b/tests/baselines/reference/decrementOperatorWithEnumType.errors.txt index a0c30e9dc93..29e06bc6a4e 100644 --- a/tests/baselines/reference/decrementOperatorWithEnumType.errors.txt +++ b/tests/baselines/reference/decrementOperatorWithEnumType.errors.txt @@ -1,21 +1,27 @@ -tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumType.ts(7,23): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumType.ts(6,25): error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumType.ts(7,23): error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumType.ts(10,3): error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property. tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumType.ts(12,1): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumType.ts(12,7): error TS2304: Cannot find name 'A'. -==== tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumType.ts (3 errors) ==== +==== tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumType.ts (5 errors) ==== // -- operator on enum type enum ENUM1 { A, B, "" }; // expression var ResultIsNumber1 = --ENUM1["A"]; + ~~~~~~~~~~ +!!! error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property. var ResultIsNumber2 = ENUM1.A--; ~~~~~~~ -!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property. // miss assignment operator --ENUM1["A"]; + ~~~~~~~~~~ +!!! error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property. ENUM1[A]--; ~~~~~~~~ diff --git a/tests/baselines/reference/decrementOperatorWithNumberType.symbols b/tests/baselines/reference/decrementOperatorWithNumberType.symbols index 40d9a67735e..eeb1f8e8fb2 100644 --- a/tests/baselines/reference/decrementOperatorWithNumberType.symbols +++ b/tests/baselines/reference/decrementOperatorWithNumberType.symbols @@ -10,7 +10,7 @@ class A { >A : Symbol(A, Decl(decrementOperatorWithNumberType.ts, 2, 31)) public a: number; ->a : Symbol(a, Decl(decrementOperatorWithNumberType.ts, 4, 9)) +>a : Symbol(A.a, Decl(decrementOperatorWithNumberType.ts, 4, 9)) } module M { >M : Symbol(M, Decl(decrementOperatorWithNumberType.ts, 6, 1)) diff --git a/tests/baselines/reference/deduplicateImportsInSystem.errors.txt b/tests/baselines/reference/deduplicateImportsInSystem.errors.txt new file mode 100644 index 00000000000..d1bfe88160e --- /dev/null +++ b/tests/baselines/reference/deduplicateImportsInSystem.errors.txt @@ -0,0 +1,32 @@ +tests/cases/compiler/deduplicateImportsInSystem.ts(1,17): error TS2307: Cannot find module 'f1'. +tests/cases/compiler/deduplicateImportsInSystem.ts(2,17): error TS2307: Cannot find module 'f2'. +tests/cases/compiler/deduplicateImportsInSystem.ts(3,17): error TS2307: Cannot find module 'f3'. +tests/cases/compiler/deduplicateImportsInSystem.ts(4,17): error TS2307: Cannot find module 'f2'. +tests/cases/compiler/deduplicateImportsInSystem.ts(5,17): error TS2307: Cannot find module 'f2'. +tests/cases/compiler/deduplicateImportsInSystem.ts(6,17): error TS2307: Cannot find module 'f1'. +tests/cases/compiler/deduplicateImportsInSystem.ts(8,1): error TS2304: Cannot find name 'console'. + + +==== tests/cases/compiler/deduplicateImportsInSystem.ts (7 errors) ==== + import {A} from "f1"; + ~~~~ +!!! error TS2307: Cannot find module 'f1'. + import {B} from "f2"; + ~~~~ +!!! error TS2307: Cannot find module 'f2'. + import {C} from "f3"; + ~~~~ +!!! error TS2307: Cannot find module 'f3'. + import {D} from 'f2'; + ~~~~ +!!! error TS2307: Cannot find module 'f2'. + import {E} from "f2"; + ~~~~ +!!! error TS2307: Cannot find module 'f2'. + import {F} from 'f1'; + ~~~~ +!!! error TS2307: Cannot find module 'f1'. + + console.log(A + B + C + D + E + F) + ~~~~~~~ +!!! error TS2304: Cannot find name 'console'. \ No newline at end of file diff --git a/tests/baselines/reference/deduplicateImportsInSystem.js b/tests/baselines/reference/deduplicateImportsInSystem.js new file mode 100644 index 00000000000..accc4954e65 --- /dev/null +++ b/tests/baselines/reference/deduplicateImportsInSystem.js @@ -0,0 +1,34 @@ +//// [deduplicateImportsInSystem.ts] +import {A} from "f1"; +import {B} from "f2"; +import {C} from "f3"; +import {D} from 'f2'; +import {E} from "f2"; +import {F} from 'f1'; + +console.log(A + B + C + D + E + F) + +//// [deduplicateImportsInSystem.js] +System.register(["f1", "f2", "f3"], function(exports_1, context_1) { + "use strict"; + var __moduleName = context_1 && context_1.id; + var f1_1, f2_1, f3_1, f2_2, f2_3, f1_2; + return { + setters:[ + function (f1_1_1) { + f1_1 = f1_1_1; + f1_2 = f1_1_1; + }, + function (f2_1_1) { + f2_1 = f2_1_1; + f2_2 = f2_1_1; + f2_3 = f2_1_1; + }, + function (f3_1_1) { + f3_1 = f3_1_1; + }], + execute: function() { + console.log(f1_1.A + f2_1.B + f3_1.C + f2_2.D + f2_3.E + f1_2.F); + } + } +}); diff --git a/tests/baselines/reference/defaultArgsInFunctionExpressions.errors.txt b/tests/baselines/reference/defaultArgsInFunctionExpressions.errors.txt index 156fdcc4c7a..60a9e92bc95 100644 --- a/tests/baselines/reference/defaultArgsInFunctionExpressions.errors.txt +++ b/tests/baselines/reference/defaultArgsInFunctionExpressions.errors.txt @@ -2,9 +2,9 @@ tests/cases/compiler/defaultArgsInFunctionExpressions.ts(4,19): error TS2345: Ar tests/cases/compiler/defaultArgsInFunctionExpressions.ts(5,1): error TS2322: Type 'number' is not assignable to type 'string'. tests/cases/compiler/defaultArgsInFunctionExpressions.ts(8,20): error TS2322: Type 'number' is not assignable to type 'string'. tests/cases/compiler/defaultArgsInFunctionExpressions.ts(11,1): error TS2322: Type 'string' is not assignable to type 'number'. -tests/cases/compiler/defaultArgsInFunctionExpressions.ts(14,51): error TS2352: Neither type 'string' nor type 'number' is assignable to the other. +tests/cases/compiler/defaultArgsInFunctionExpressions.ts(14,51): error TS2352: Type 'string' cannot be converted to type 'number'. tests/cases/compiler/defaultArgsInFunctionExpressions.ts(17,41): error TS2322: Type 'string' is not assignable to type 'number'. -tests/cases/compiler/defaultArgsInFunctionExpressions.ts(20,62): error TS2352: Neither type 'string' nor type 'number' is assignable to the other. +tests/cases/compiler/defaultArgsInFunctionExpressions.ts(20,62): error TS2352: Type 'string' cannot be converted to type 'number'. tests/cases/compiler/defaultArgsInFunctionExpressions.ts(28,15): error TS2304: Cannot find name 'T'. @@ -32,7 +32,7 @@ tests/cases/compiler/defaultArgsInFunctionExpressions.ts(28,15): error TS2304: C // Contextually type the default arg with the type annotation var f3 = function (a: (s: string) => any = (s) => s) { }; ~~~~~~~~~ -!!! error TS2352: Neither type 'string' nor type 'number' is assignable to the other. +!!! error TS2352: Type 'string' cannot be converted to type 'number'. // Type check using the function's contextual type var f4: (a: number) => void = function (a = "") { }; @@ -42,7 +42,7 @@ tests/cases/compiler/defaultArgsInFunctionExpressions.ts(28,15): error TS2304: C // Contextually type the default arg using the function's contextual type var f5: (a: (s: string) => any) => void = function (a = s => s) { }; ~~~~~~~~~ -!!! error TS2352: Neither type 'string' nor type 'number' is assignable to the other. +!!! error TS2352: Type 'string' cannot be converted to type 'number'. // Instantiated module module T { } diff --git a/tests/baselines/reference/defaultExportInAwaitExpression01.js b/tests/baselines/reference/defaultExportInAwaitExpression01.js new file mode 100644 index 00000000000..afd4dfa7a56 --- /dev/null +++ b/tests/baselines/reference/defaultExportInAwaitExpression01.js @@ -0,0 +1,53 @@ +//// [tests/cases/conformance/es6/modules/defaultExportInAwaitExpression01.ts] //// + +//// [a.ts] +const x = new Promise( ( resolve, reject ) => { resolve( {} ); } ); +export default x; + +//// [b.ts] +import x from './a'; + +( async function() { + const value = await x; +}() ); + + +//// [a.js] +(function (factory) { + if (typeof module === 'object' && typeof module.exports === 'object') { + var v = factory(require, exports); if (v !== undefined) module.exports = v; + } + else if (typeof define === 'function' && define.amd) { + define(["require", "exports"], factory); + } +})(function (require, exports) { + "use strict"; + const x = new Promise((resolve, reject) => { resolve({}); }); + Object.defineProperty(exports, "__esModule", { value: true }); + exports.default = x; +}); +//// [b.js] +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator.throw(value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments)).next()); + }); +}; +(function (factory) { + if (typeof module === 'object' && typeof module.exports === 'object') { + var v = factory(require, exports); if (v !== undefined) module.exports = v; + } + else if (typeof define === 'function' && define.amd) { + define(["require", "exports", './a'], factory); + } +})(function (require, exports) { + "use strict"; + const a_1 = require('./a'); + (function () { + return __awaiter(this, void 0, void 0, function* () { + const value = yield a_1.default; + }); + }()); +}); diff --git a/tests/baselines/reference/defaultExportInAwaitExpression01.symbols b/tests/baselines/reference/defaultExportInAwaitExpression01.symbols new file mode 100644 index 00000000000..eb833f63895 --- /dev/null +++ b/tests/baselines/reference/defaultExportInAwaitExpression01.symbols @@ -0,0 +1,22 @@ +=== tests/cases/conformance/es6/modules/a.ts === +const x = new Promise( ( resolve, reject ) => { resolve( {} ); } ); +>x : Symbol(x, Decl(a.ts, 0, 5)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>resolve : Symbol(resolve, Decl(a.ts, 0, 24)) +>reject : Symbol(reject, Decl(a.ts, 0, 33)) +>resolve : Symbol(resolve, Decl(a.ts, 0, 24)) + +export default x; +>x : Symbol(x, Decl(a.ts, 0, 5)) + +=== tests/cases/conformance/es6/modules/b.ts === +import x from './a'; +>x : Symbol(x, Decl(b.ts, 0, 6)) + +( async function() { + const value = await x; +>value : Symbol(value, Decl(b.ts, 3, 9)) +>x : Symbol(x, Decl(b.ts, 0, 6)) + +}() ); + diff --git a/tests/baselines/reference/defaultExportInAwaitExpression01.types b/tests/baselines/reference/defaultExportInAwaitExpression01.types new file mode 100644 index 00000000000..1f7de76b90e --- /dev/null +++ b/tests/baselines/reference/defaultExportInAwaitExpression01.types @@ -0,0 +1,31 @@ +=== tests/cases/conformance/es6/modules/a.ts === +const x = new Promise( ( resolve, reject ) => { resolve( {} ); } ); +>x : Promise<{}> +>new Promise( ( resolve, reject ) => { resolve( {} ); } ) : Promise<{}> +>Promise : PromiseConstructor +>( resolve, reject ) => { resolve( {} ); } : (resolve: (value?: {} | PromiseLike<{}>) => void, reject: (reason?: any) => void) => void +>resolve : (value?: {} | PromiseLike<{}>) => void +>reject : (reason?: any) => void +>resolve( {} ) : void +>resolve : (value?: {} | PromiseLike<{}>) => void +>{} : {} + +export default x; +>x : Promise<{}> + +=== tests/cases/conformance/es6/modules/b.ts === +import x from './a'; +>x : Promise<{}> + +( async function() { +>( async function() { const value = await x;}() ) : Promise +>async function() { const value = await x;}() : Promise +>async function() { const value = await x;} : () => Promise + + const value = await x; +>value : {} +>await x : {} +>x : Promise<{}> + +}() ); + diff --git a/tests/baselines/reference/defaultExportInAwaitExpression02.js b/tests/baselines/reference/defaultExportInAwaitExpression02.js new file mode 100644 index 00000000000..70a9ce6c2d3 --- /dev/null +++ b/tests/baselines/reference/defaultExportInAwaitExpression02.js @@ -0,0 +1,35 @@ +//// [tests/cases/conformance/es6/modules/defaultExportInAwaitExpression02.ts] //// + +//// [a.ts] +const x = new Promise( ( resolve, reject ) => { resolve( {} ); } ); +export default x; + +//// [b.ts] +import x from './a'; + +( async function() { + const value = await x; +}() ); + + +//// [a.js] +"use strict"; +const x = new Promise((resolve, reject) => { resolve({}); }); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = x; +//// [b.js] +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator.throw(value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments)).next()); + }); +}; +const a_1 = require('./a'); +(function () { + return __awaiter(this, void 0, void 0, function* () { + const value = yield a_1.default; + }); +}()); diff --git a/tests/baselines/reference/defaultExportInAwaitExpression02.symbols b/tests/baselines/reference/defaultExportInAwaitExpression02.symbols new file mode 100644 index 00000000000..eb833f63895 --- /dev/null +++ b/tests/baselines/reference/defaultExportInAwaitExpression02.symbols @@ -0,0 +1,22 @@ +=== tests/cases/conformance/es6/modules/a.ts === +const x = new Promise( ( resolve, reject ) => { resolve( {} ); } ); +>x : Symbol(x, Decl(a.ts, 0, 5)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>resolve : Symbol(resolve, Decl(a.ts, 0, 24)) +>reject : Symbol(reject, Decl(a.ts, 0, 33)) +>resolve : Symbol(resolve, Decl(a.ts, 0, 24)) + +export default x; +>x : Symbol(x, Decl(a.ts, 0, 5)) + +=== tests/cases/conformance/es6/modules/b.ts === +import x from './a'; +>x : Symbol(x, Decl(b.ts, 0, 6)) + +( async function() { + const value = await x; +>value : Symbol(value, Decl(b.ts, 3, 9)) +>x : Symbol(x, Decl(b.ts, 0, 6)) + +}() ); + diff --git a/tests/baselines/reference/defaultExportInAwaitExpression02.types b/tests/baselines/reference/defaultExportInAwaitExpression02.types new file mode 100644 index 00000000000..1f7de76b90e --- /dev/null +++ b/tests/baselines/reference/defaultExportInAwaitExpression02.types @@ -0,0 +1,31 @@ +=== tests/cases/conformance/es6/modules/a.ts === +const x = new Promise( ( resolve, reject ) => { resolve( {} ); } ); +>x : Promise<{}> +>new Promise( ( resolve, reject ) => { resolve( {} ); } ) : Promise<{}> +>Promise : PromiseConstructor +>( resolve, reject ) => { resolve( {} ); } : (resolve: (value?: {} | PromiseLike<{}>) => void, reject: (reason?: any) => void) => void +>resolve : (value?: {} | PromiseLike<{}>) => void +>reject : (reason?: any) => void +>resolve( {} ) : void +>resolve : (value?: {} | PromiseLike<{}>) => void +>{} : {} + +export default x; +>x : Promise<{}> + +=== tests/cases/conformance/es6/modules/b.ts === +import x from './a'; +>x : Promise<{}> + +( async function() { +>( async function() { const value = await x;}() ) : Promise +>async function() { const value = await x;}() : Promise +>async function() { const value = await x;} : () => Promise + + const value = await x; +>value : {} +>await x : {} +>x : Promise<{}> + +}() ); + diff --git a/tests/baselines/reference/defaultExportsGetExportedSystem.js b/tests/baselines/reference/defaultExportsGetExportedSystem.js index f67ccb6ee23..eaf6d323f09 100644 --- a/tests/baselines/reference/defaultExportsGetExportedSystem.js +++ b/tests/baselines/reference/defaultExportsGetExportedSystem.js @@ -8,21 +8,23 @@ export default function foo() {} //// [a.js] -System.register([], function(exports_1, __moduleName) { +System.register([], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; var Foo; return { setters:[], execute: function() { - class Foo { - } + Foo = class Foo { + }; exports_1("default", Foo); } } }); //// [b.js] -System.register([], function(exports_1, __moduleName) { +System.register([], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; function foo() { } exports_1("default", foo); return { diff --git a/tests/baselines/reference/defaultIndexProps1.symbols b/tests/baselines/reference/defaultIndexProps1.symbols index e294b9e7dba..ac1220688a5 100644 --- a/tests/baselines/reference/defaultIndexProps1.symbols +++ b/tests/baselines/reference/defaultIndexProps1.symbols @@ -3,7 +3,7 @@ class Foo { >Foo : Symbol(Foo, Decl(defaultIndexProps1.ts, 0, 0)) public v = "Yo"; ->v : Symbol(v, Decl(defaultIndexProps1.ts, 0, 11)) +>v : Symbol(Foo.v, Decl(defaultIndexProps1.ts, 0, 11)) } var f = new Foo(); diff --git a/tests/baselines/reference/defaultIndexProps2.symbols b/tests/baselines/reference/defaultIndexProps2.symbols index 53d433351c3..5c9880c55f3 100644 --- a/tests/baselines/reference/defaultIndexProps2.symbols +++ b/tests/baselines/reference/defaultIndexProps2.symbols @@ -3,7 +3,7 @@ class Foo { >Foo : Symbol(Foo, Decl(defaultIndexProps2.ts, 0, 0)) public v = "Yo"; ->v : Symbol(v, Decl(defaultIndexProps2.ts, 0, 11)) +>v : Symbol(Foo.v, Decl(defaultIndexProps2.ts, 0, 11)) } var f = new Foo(); diff --git a/tests/baselines/reference/defaultOfAnyInStrictNullChecks.js b/tests/baselines/reference/defaultOfAnyInStrictNullChecks.js new file mode 100644 index 00000000000..7706181b343 --- /dev/null +++ b/tests/baselines/reference/defaultOfAnyInStrictNullChecks.js @@ -0,0 +1,22 @@ +//// [defaultOfAnyInStrictNullChecks.ts] + +// Regression test for #8295 + +function foo() { + try { + } + catch (e) { + let s = e.message; + } +} + + +//// [defaultOfAnyInStrictNullChecks.js] +// Regression test for #8295 +function foo() { + try { + } + catch (e) { + var s = e.message; + } +} diff --git a/tests/baselines/reference/defaultOfAnyInStrictNullChecks.symbols b/tests/baselines/reference/defaultOfAnyInStrictNullChecks.symbols new file mode 100644 index 00000000000..c7de7f6b2f3 --- /dev/null +++ b/tests/baselines/reference/defaultOfAnyInStrictNullChecks.symbols @@ -0,0 +1,18 @@ +=== tests/cases/compiler/defaultOfAnyInStrictNullChecks.ts === + +// Regression test for #8295 + +function foo() { +>foo : Symbol(foo, Decl(defaultOfAnyInStrictNullChecks.ts, 0, 0)) + + try { + } + catch (e) { +>e : Symbol(e, Decl(defaultOfAnyInStrictNullChecks.ts, 6, 11)) + + let s = e.message; +>s : Symbol(s, Decl(defaultOfAnyInStrictNullChecks.ts, 7, 11)) +>e : Symbol(e, Decl(defaultOfAnyInStrictNullChecks.ts, 6, 11)) + } +} + diff --git a/tests/baselines/reference/defaultOfAnyInStrictNullChecks.types b/tests/baselines/reference/defaultOfAnyInStrictNullChecks.types new file mode 100644 index 00000000000..8e4c1adcd61 --- /dev/null +++ b/tests/baselines/reference/defaultOfAnyInStrictNullChecks.types @@ -0,0 +1,20 @@ +=== tests/cases/compiler/defaultOfAnyInStrictNullChecks.ts === + +// Regression test for #8295 + +function foo() { +>foo : () => void + + try { + } + catch (e) { +>e : any + + let s = e.message; +>s : any +>e.message : any +>e : any +>message : any + } +} + diff --git a/tests/baselines/reference/deleteOperatorWithBooleanType.symbols b/tests/baselines/reference/deleteOperatorWithBooleanType.symbols index 71cb78760f6..e3ecfc3f0b1 100644 --- a/tests/baselines/reference/deleteOperatorWithBooleanType.symbols +++ b/tests/baselines/reference/deleteOperatorWithBooleanType.symbols @@ -10,7 +10,7 @@ class A { >A : Symbol(A, Decl(deleteOperatorWithBooleanType.ts, 3, 40)) public a: boolean; ->a : Symbol(a, Decl(deleteOperatorWithBooleanType.ts, 5, 9)) +>a : Symbol(A.a, Decl(deleteOperatorWithBooleanType.ts, 5, 9)) static foo() { return false; } >foo : Symbol(A.foo, Decl(deleteOperatorWithBooleanType.ts, 6, 22)) diff --git a/tests/baselines/reference/deleteOperatorWithNumberType.symbols b/tests/baselines/reference/deleteOperatorWithNumberType.symbols index 589b1f91db2..4d59a0ba7bf 100644 --- a/tests/baselines/reference/deleteOperatorWithNumberType.symbols +++ b/tests/baselines/reference/deleteOperatorWithNumberType.symbols @@ -13,7 +13,7 @@ class A { >A : Symbol(A, Decl(deleteOperatorWithNumberType.ts, 4, 36)) public a: number; ->a : Symbol(a, Decl(deleteOperatorWithNumberType.ts, 6, 9)) +>a : Symbol(A.a, Decl(deleteOperatorWithNumberType.ts, 6, 9)) static foo() { return 1; } >foo : Symbol(A.foo, Decl(deleteOperatorWithNumberType.ts, 7, 21)) diff --git a/tests/baselines/reference/deleteOperatorWithStringType.symbols b/tests/baselines/reference/deleteOperatorWithStringType.symbols index 204aac0123b..e3f7fd30d7c 100644 --- a/tests/baselines/reference/deleteOperatorWithStringType.symbols +++ b/tests/baselines/reference/deleteOperatorWithStringType.symbols @@ -13,7 +13,7 @@ class A { >A : Symbol(A, Decl(deleteOperatorWithStringType.ts, 4, 40)) public a: string; ->a : Symbol(a, Decl(deleteOperatorWithStringType.ts, 6, 9)) +>a : Symbol(A.a, Decl(deleteOperatorWithStringType.ts, 6, 9)) static foo() { return ""; } >foo : Symbol(A.foo, Decl(deleteOperatorWithStringType.ts, 7, 21)) diff --git a/tests/baselines/reference/derivedClassOverridesProtectedMembers.symbols b/tests/baselines/reference/derivedClassOverridesProtectedMembers.symbols index 3c826325b91..690916db87c 100644 --- a/tests/baselines/reference/derivedClassOverridesProtectedMembers.symbols +++ b/tests/baselines/reference/derivedClassOverridesProtectedMembers.symbols @@ -13,25 +13,25 @@ class Base { >Base : Symbol(Base, Decl(derivedClassOverridesProtectedMembers.ts, 2, 36)) protected a: typeof x; ->a : Symbol(a, Decl(derivedClassOverridesProtectedMembers.ts, 4, 12)) +>a : Symbol(Base.a, Decl(derivedClassOverridesProtectedMembers.ts, 4, 12)) >x : Symbol(x, Decl(derivedClassOverridesProtectedMembers.ts, 1, 3)) protected b(a: typeof x) { } ->b : Symbol(b, Decl(derivedClassOverridesProtectedMembers.ts, 5, 26)) +>b : Symbol(Base.b, Decl(derivedClassOverridesProtectedMembers.ts, 5, 26)) >a : Symbol(a, Decl(derivedClassOverridesProtectedMembers.ts, 6, 16)) >x : Symbol(x, Decl(derivedClassOverridesProtectedMembers.ts, 1, 3)) protected get c() { return x; } ->c : Symbol(c, Decl(derivedClassOverridesProtectedMembers.ts, 6, 32), Decl(derivedClassOverridesProtectedMembers.ts, 7, 35)) +>c : Symbol(Base.c, Decl(derivedClassOverridesProtectedMembers.ts, 6, 32), Decl(derivedClassOverridesProtectedMembers.ts, 7, 35)) >x : Symbol(x, Decl(derivedClassOverridesProtectedMembers.ts, 1, 3)) protected set c(v: typeof x) { } ->c : Symbol(c, Decl(derivedClassOverridesProtectedMembers.ts, 6, 32), Decl(derivedClassOverridesProtectedMembers.ts, 7, 35)) +>c : Symbol(Base.c, Decl(derivedClassOverridesProtectedMembers.ts, 6, 32), Decl(derivedClassOverridesProtectedMembers.ts, 7, 35)) >v : Symbol(v, Decl(derivedClassOverridesProtectedMembers.ts, 8, 20)) >x : Symbol(x, Decl(derivedClassOverridesProtectedMembers.ts, 1, 3)) protected d: (a: typeof x) => void; ->d : Symbol(d, Decl(derivedClassOverridesProtectedMembers.ts, 8, 36)) +>d : Symbol(Base.d, Decl(derivedClassOverridesProtectedMembers.ts, 8, 36)) >a : Symbol(a, Decl(derivedClassOverridesProtectedMembers.ts, 9, 18)) >x : Symbol(x, Decl(derivedClassOverridesProtectedMembers.ts, 1, 3)) @@ -68,25 +68,25 @@ class Derived extends Base { >Base : Symbol(Base, Decl(derivedClassOverridesProtectedMembers.ts, 2, 36)) protected a: typeof y; ->a : Symbol(a, Decl(derivedClassOverridesProtectedMembers.ts, 20, 28)) +>a : Symbol(Derived.a, Decl(derivedClassOverridesProtectedMembers.ts, 20, 28)) >y : Symbol(y, Decl(derivedClassOverridesProtectedMembers.ts, 2, 3)) protected b(a: typeof y) { } ->b : Symbol(b, Decl(derivedClassOverridesProtectedMembers.ts, 21, 26)) +>b : Symbol(Derived.b, Decl(derivedClassOverridesProtectedMembers.ts, 21, 26)) >a : Symbol(a, Decl(derivedClassOverridesProtectedMembers.ts, 22, 16)) >y : Symbol(y, Decl(derivedClassOverridesProtectedMembers.ts, 2, 3)) protected get c() { return y; } ->c : Symbol(c, Decl(derivedClassOverridesProtectedMembers.ts, 22, 32), Decl(derivedClassOverridesProtectedMembers.ts, 23, 35)) +>c : Symbol(Derived.c, Decl(derivedClassOverridesProtectedMembers.ts, 22, 32), Decl(derivedClassOverridesProtectedMembers.ts, 23, 35)) >y : Symbol(y, Decl(derivedClassOverridesProtectedMembers.ts, 2, 3)) protected set c(v: typeof y) { } ->c : Symbol(c, Decl(derivedClassOverridesProtectedMembers.ts, 22, 32), Decl(derivedClassOverridesProtectedMembers.ts, 23, 35)) +>c : Symbol(Derived.c, Decl(derivedClassOverridesProtectedMembers.ts, 22, 32), Decl(derivedClassOverridesProtectedMembers.ts, 23, 35)) >v : Symbol(v, Decl(derivedClassOverridesProtectedMembers.ts, 24, 20)) >y : Symbol(y, Decl(derivedClassOverridesProtectedMembers.ts, 2, 3)) protected d: (a: typeof y) => void; ->d : Symbol(d, Decl(derivedClassOverridesProtectedMembers.ts, 24, 36)) +>d : Symbol(Derived.d, Decl(derivedClassOverridesProtectedMembers.ts, 24, 36)) >a : Symbol(a, Decl(derivedClassOverridesProtectedMembers.ts, 25, 18)) >y : Symbol(y, Decl(derivedClassOverridesProtectedMembers.ts, 2, 3)) diff --git a/tests/baselines/reference/derivedClassOverridesProtectedMembers2.symbols b/tests/baselines/reference/derivedClassOverridesProtectedMembers2.symbols index b1160328160..d6f70480844 100644 --- a/tests/baselines/reference/derivedClassOverridesProtectedMembers2.symbols +++ b/tests/baselines/reference/derivedClassOverridesProtectedMembers2.symbols @@ -12,25 +12,25 @@ class Base { >Base : Symbol(Base, Decl(derivedClassOverridesProtectedMembers2.ts, 1, 36)) protected a: typeof x; ->a : Symbol(a, Decl(derivedClassOverridesProtectedMembers2.ts, 3, 12)) +>a : Symbol(Base.a, Decl(derivedClassOverridesProtectedMembers2.ts, 3, 12)) >x : Symbol(x, Decl(derivedClassOverridesProtectedMembers2.ts, 0, 3)) protected b(a: typeof x) { } ->b : Symbol(b, Decl(derivedClassOverridesProtectedMembers2.ts, 4, 26)) +>b : Symbol(Base.b, Decl(derivedClassOverridesProtectedMembers2.ts, 4, 26)) >a : Symbol(a, Decl(derivedClassOverridesProtectedMembers2.ts, 5, 16)) >x : Symbol(x, Decl(derivedClassOverridesProtectedMembers2.ts, 0, 3)) protected get c() { return x; } ->c : Symbol(c, Decl(derivedClassOverridesProtectedMembers2.ts, 5, 32), Decl(derivedClassOverridesProtectedMembers2.ts, 6, 35)) +>c : Symbol(Base.c, Decl(derivedClassOverridesProtectedMembers2.ts, 5, 32), Decl(derivedClassOverridesProtectedMembers2.ts, 6, 35)) >x : Symbol(x, Decl(derivedClassOverridesProtectedMembers2.ts, 0, 3)) protected set c(v: typeof x) { } ->c : Symbol(c, Decl(derivedClassOverridesProtectedMembers2.ts, 5, 32), Decl(derivedClassOverridesProtectedMembers2.ts, 6, 35)) +>c : Symbol(Base.c, Decl(derivedClassOverridesProtectedMembers2.ts, 5, 32), Decl(derivedClassOverridesProtectedMembers2.ts, 6, 35)) >v : Symbol(v, Decl(derivedClassOverridesProtectedMembers2.ts, 7, 20)) >x : Symbol(x, Decl(derivedClassOverridesProtectedMembers2.ts, 0, 3)) protected d: (a: typeof x) => void ; ->d : Symbol(d, Decl(derivedClassOverridesProtectedMembers2.ts, 7, 36)) +>d : Symbol(Base.d, Decl(derivedClassOverridesProtectedMembers2.ts, 7, 36)) >a : Symbol(a, Decl(derivedClassOverridesProtectedMembers2.ts, 8, 18)) >x : Symbol(x, Decl(derivedClassOverridesProtectedMembers2.ts, 0, 3)) @@ -68,25 +68,25 @@ class Derived extends Base { >Base : Symbol(Base, Decl(derivedClassOverridesProtectedMembers2.ts, 1, 36)) a: typeof y; ->a : Symbol(a, Decl(derivedClassOverridesProtectedMembers2.ts, 20, 28)) +>a : Symbol(Derived.a, Decl(derivedClassOverridesProtectedMembers2.ts, 20, 28)) >y : Symbol(y, Decl(derivedClassOverridesProtectedMembers2.ts, 1, 3)) b(a: typeof y) { } ->b : Symbol(b, Decl(derivedClassOverridesProtectedMembers2.ts, 21, 16)) +>b : Symbol(Derived.b, Decl(derivedClassOverridesProtectedMembers2.ts, 21, 16)) >a : Symbol(a, Decl(derivedClassOverridesProtectedMembers2.ts, 22, 6)) >y : Symbol(y, Decl(derivedClassOverridesProtectedMembers2.ts, 1, 3)) get c() { return y; } ->c : Symbol(c, Decl(derivedClassOverridesProtectedMembers2.ts, 22, 22), Decl(derivedClassOverridesProtectedMembers2.ts, 23, 25)) +>c : Symbol(Derived.c, Decl(derivedClassOverridesProtectedMembers2.ts, 22, 22), Decl(derivedClassOverridesProtectedMembers2.ts, 23, 25)) >y : Symbol(y, Decl(derivedClassOverridesProtectedMembers2.ts, 1, 3)) set c(v: typeof y) { } ->c : Symbol(c, Decl(derivedClassOverridesProtectedMembers2.ts, 22, 22), Decl(derivedClassOverridesProtectedMembers2.ts, 23, 25)) +>c : Symbol(Derived.c, Decl(derivedClassOverridesProtectedMembers2.ts, 22, 22), Decl(derivedClassOverridesProtectedMembers2.ts, 23, 25)) >v : Symbol(v, Decl(derivedClassOverridesProtectedMembers2.ts, 24, 10)) >y : Symbol(y, Decl(derivedClassOverridesProtectedMembers2.ts, 1, 3)) d: (a: typeof y) => void; ->d : Symbol(d, Decl(derivedClassOverridesProtectedMembers2.ts, 24, 26)) +>d : Symbol(Derived.d, Decl(derivedClassOverridesProtectedMembers2.ts, 24, 26)) >a : Symbol(a, Decl(derivedClassOverridesProtectedMembers2.ts, 25, 8)) >y : Symbol(y, Decl(derivedClassOverridesProtectedMembers2.ts, 1, 3)) diff --git a/tests/baselines/reference/derivedClassOverridesWithoutSubtype.symbols b/tests/baselines/reference/derivedClassOverridesWithoutSubtype.symbols index 452da91f034..67d5354cd5f 100644 --- a/tests/baselines/reference/derivedClassOverridesWithoutSubtype.symbols +++ b/tests/baselines/reference/derivedClassOverridesWithoutSubtype.symbols @@ -3,7 +3,7 @@ class Base { >Base : Symbol(Base, Decl(derivedClassOverridesWithoutSubtype.ts, 0, 0)) x: { ->x : Symbol(x, Decl(derivedClassOverridesWithoutSubtype.ts, 0, 12)) +>x : Symbol(Base.x, Decl(derivedClassOverridesWithoutSubtype.ts, 0, 12)) foo: string; >foo : Symbol(foo, Decl(derivedClassOverridesWithoutSubtype.ts, 1, 8)) @@ -15,7 +15,7 @@ class Derived extends Base { >Base : Symbol(Base, Decl(derivedClassOverridesWithoutSubtype.ts, 0, 0)) x: { ->x : Symbol(x, Decl(derivedClassOverridesWithoutSubtype.ts, 6, 28)) +>x : Symbol(Derived.x, Decl(derivedClassOverridesWithoutSubtype.ts, 6, 28)) foo: any; >foo : Symbol(foo, Decl(derivedClassOverridesWithoutSubtype.ts, 7, 8)) diff --git a/tests/baselines/reference/derivedClassParameterProperties.errors.txt b/tests/baselines/reference/derivedClassParameterProperties.errors.txt index 0dba0d24cb0..27bb9af63a1 100644 --- a/tests/baselines/reference/derivedClassParameterProperties.errors.txt +++ b/tests/baselines/reference/derivedClassParameterProperties.errors.txt @@ -1,10 +1,15 @@ tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassParameterProperties.ts(15,5): error TS2376: A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties. tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassParameterProperties.ts(30,5): error TS2376: A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties. +tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassParameterProperties.ts(47,9): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassParameterProperties.ts(56,5): error TS2376: A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties. +tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassParameterProperties.ts(57,9): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. +tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassParameterProperties.ts(58,9): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassParameterProperties.ts(79,5): error TS2376: A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties. +tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassParameterProperties.ts(80,9): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. +tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassParameterProperties.ts(81,9): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. -==== tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassParameterProperties.ts (4 errors) ==== +==== tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassParameterProperties.ts (9 errors) ==== // ordering of super calls in derived constructors matters depending on other class contents class Base { @@ -62,8 +67,10 @@ tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassP a: number; constructor(y: string) { this.a = 1; + ~~~~ +!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. var b = 2; - super(); // ok + super(); // error: "super" has to be called before "this" accessing } } @@ -74,8 +81,12 @@ tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassP ~~~~~~~~~~~~~~~~~~~~~~~~ this.a = 3; ~~~~~~~~~~~~~~~~~~~ + ~~~~ +!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. this.b = 3; ~~~~~~~~~~~~~~~~~~~ + ~~~~ +!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. super(); // error ~~~~~~~~~~~~~~~~~~~~~~~~~ } @@ -103,8 +114,12 @@ tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassP ~~~~~~~~~~~~~~~~~~~~~~~~ this.a = 3; ~~~~~~~~~~~~~~~~~~~ + ~~~~ +!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. this.b = 3; ~~~~~~~~~~~~~~~~~~~ + ~~~~ +!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. super(); // error ~~~~~~~~~~~~~~~~~~~~~~~~~ } diff --git a/tests/baselines/reference/derivedClassParameterProperties.js b/tests/baselines/reference/derivedClassParameterProperties.js index c0a1736a2a3..8e5fa82cf0f 100644 --- a/tests/baselines/reference/derivedClassParameterProperties.js +++ b/tests/baselines/reference/derivedClassParameterProperties.js @@ -47,7 +47,7 @@ class Derived6 extends Base { constructor(y: string) { this.a = 1; var b = 2; - super(); // ok + super(); // error: "super" has to be called before "this" accessing } } @@ -155,7 +155,7 @@ var Derived6 = (function (_super) { function Derived6(y) { this.a = 1; var b = 2; - _super.call(this); // ok + _super.call(this); // error: "super" has to be called before "this" accessing } return Derived6; }(Base)); diff --git a/tests/baselines/reference/derivedClassSuperCallsWithThisArg.errors.txt b/tests/baselines/reference/derivedClassSuperCallsWithThisArg.errors.txt index ef43d1d6f52..d381eff17dc 100644 --- a/tests/baselines/reference/derivedClassSuperCallsWithThisArg.errors.txt +++ b/tests/baselines/reference/derivedClassSuperCallsWithThisArg.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsWithThisArg.ts(14,15): error TS2332: 'this' cannot be referenced in current location. -tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsWithThisArg.ts(20,21): error TS2332: 'this' cannot be referenced in current location. +tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsWithThisArg.ts(8,15): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. +tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsWithThisArg.ts(14,15): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. ==== tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsWithThisArg.ts (2 errors) ==== @@ -11,6 +11,8 @@ tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassS class Derived extends Base { constructor() { super(this); // ok + ~~~~ +!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. } } @@ -18,15 +20,13 @@ tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassS constructor(public a: string) { super(this); // error ~~~~ -!!! error TS2332: 'this' cannot be referenced in current location. +!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. } } class Derived3 extends Base { constructor(public a: string) { super(() => this); // error - ~~~~ -!!! error TS2332: 'this' cannot be referenced in current location. } } diff --git a/tests/baselines/reference/derivedClassTransitivity.errors.txt b/tests/baselines/reference/derivedClassTransitivity.errors.txt index c6b620beb18..5be930fa5da 100644 --- a/tests/baselines/reference/derivedClassTransitivity.errors.txt +++ b/tests/baselines/reference/derivedClassTransitivity.errors.txt @@ -2,7 +2,7 @@ tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassTra Types of property 'foo' are incompatible. Type '(x?: string) => void' is not assignable to type '(x: number) => void'. Types of parameters 'x' and 'x' are incompatible. - Type 'string' is not assignable to type 'number'. + Type 'number' is not assignable to type 'string'. ==== tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassTransitivity.ts (1 errors) ==== @@ -29,6 +29,6 @@ tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassTra !!! error TS2322: Types of property 'foo' are incompatible. !!! error TS2322: Type '(x?: string) => void' is not assignable to type '(x: number) => void'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. var r = c.foo(1); var r2 = e.foo(''); \ No newline at end of file diff --git a/tests/baselines/reference/derivedClassTransitivity2.errors.txt b/tests/baselines/reference/derivedClassTransitivity2.errors.txt index a8d2003c876..e5f09911f55 100644 --- a/tests/baselines/reference/derivedClassTransitivity2.errors.txt +++ b/tests/baselines/reference/derivedClassTransitivity2.errors.txt @@ -2,7 +2,7 @@ tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassTra Types of property 'foo' are incompatible. Type '(x: number, y?: string) => void' is not assignable to type '(x: number, y: number) => void'. Types of parameters 'y' and 'y' are incompatible. - Type 'string' is not assignable to type 'number'. + Type 'number' is not assignable to type 'string'. ==== tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassTransitivity2.ts (1 errors) ==== @@ -29,6 +29,6 @@ tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassTra !!! error TS2322: Types of property 'foo' are incompatible. !!! error TS2322: Type '(x: number, y?: string) => void' is not assignable to type '(x: number, y: number) => void'. !!! error TS2322: Types of parameters 'y' and 'y' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. var r = c.foo(1, 1); var r2 = e.foo(1, ''); \ No newline at end of file diff --git a/tests/baselines/reference/derivedClassTransitivity3.errors.txt b/tests/baselines/reference/derivedClassTransitivity3.errors.txt index 9d301255dfd..b3e59a0bf4c 100644 --- a/tests/baselines/reference/derivedClassTransitivity3.errors.txt +++ b/tests/baselines/reference/derivedClassTransitivity3.errors.txt @@ -2,7 +2,7 @@ tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassTra Types of property 'foo' are incompatible. Type '(x: string, y?: number) => void' is not assignable to type '(x: string, y: string) => void'. Types of parameters 'y' and 'y' are incompatible. - Type 'number' is not assignable to type 'string'. + Type 'string' is not assignable to type 'number'. ==== tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassTransitivity3.ts (1 errors) ==== @@ -29,6 +29,6 @@ tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassTra !!! error TS2322: Types of property 'foo' are incompatible. !!! error TS2322: Type '(x: string, y?: number) => void' is not assignable to type '(x: string, y: string) => void'. !!! error TS2322: Types of parameters 'y' and 'y' are incompatible. -!!! error TS2322: Type 'number' is not assignable to type 'string'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. var r = c.foo('', ''); var r2 = e.foo('', 1); \ No newline at end of file diff --git a/tests/baselines/reference/derivedClassTransitivity4.errors.txt b/tests/baselines/reference/derivedClassTransitivity4.errors.txt index c1a80e0a1d7..06319b16317 100644 --- a/tests/baselines/reference/derivedClassTransitivity4.errors.txt +++ b/tests/baselines/reference/derivedClassTransitivity4.errors.txt @@ -2,8 +2,8 @@ tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassTra Types of property 'foo' are incompatible. Type '(x?: string) => void' is not assignable to type '(x: number) => void'. Types of parameters 'x' and 'x' are incompatible. - Type 'string' is not assignable to type 'number'. -tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassTransitivity4.ts(19,9): error TS2445: Property 'foo' is protected and only accessible within class 'C' and its subclasses. + Type 'number' is not assignable to type 'string'. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassTransitivity4.ts(19,11): error TS2445: Property 'foo' is protected and only accessible within class 'C' and its subclasses. ==== tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassTransitivity4.ts (2 errors) ==== @@ -30,8 +30,8 @@ tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassTra !!! error TS2322: Types of property 'foo' are incompatible. !!! error TS2322: Type '(x?: string) => void' is not assignable to type '(x: number) => void'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. var r = c.foo(1); - ~~~~~ + ~~~ !!! error TS2445: Property 'foo' is protected and only accessible within class 'C' and its subclasses. var r2 = e.foo(''); \ No newline at end of file diff --git a/tests/baselines/reference/derivedClassWithPrivateStaticShadowingPublicStatic.errors.txt b/tests/baselines/reference/derivedClassWithPrivateStaticShadowingPublicStatic.errors.txt index 2e5d6f57c86..88ec9eb44a8 100644 --- a/tests/baselines/reference/derivedClassWithPrivateStaticShadowingPublicStatic.errors.txt +++ b/tests/baselines/reference/derivedClassWithPrivateStaticShadowingPublicStatic.errors.txt @@ -4,10 +4,10 @@ tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWit Property 'x' is private in type 'typeof Derived' but not in type 'typeof Base'. tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateStaticShadowingPublicStatic.ts(19,24): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateStaticShadowingPublicStatic.ts(20,24): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateStaticShadowingPublicStatic.ts(24,10): error TS2341: Property 'x' is private and only accessible within class 'Derived'. -tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateStaticShadowingPublicStatic.ts(27,10): error TS2341: Property 'fn' is private and only accessible within class 'Derived'. -tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateStaticShadowingPublicStatic.ts(32,10): error TS2341: Property 'a' is private and only accessible within class 'Derived'. -tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateStaticShadowingPublicStatic.ts(33,1): error TS2341: Property 'a' is private and only accessible within class 'Derived'. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateStaticShadowingPublicStatic.ts(24,18): error TS2341: Property 'x' is private and only accessible within class 'Derived'. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateStaticShadowingPublicStatic.ts(27,18): error TS2341: Property 'fn' is private and only accessible within class 'Derived'. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateStaticShadowingPublicStatic.ts(32,18): error TS2341: Property 'a' is private and only accessible within class 'Derived'. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateStaticShadowingPublicStatic.ts(33,9): error TS2341: Property 'a' is private and only accessible within class 'Derived'. ==== tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateStaticShadowingPublicStatic.ts (9 errors) ==== @@ -46,20 +46,20 @@ tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWit var r = Base.x; // ok var r2 = Derived.x; // error - ~~~~~~~~~ + ~ !!! error TS2341: Property 'x' is private and only accessible within class 'Derived'. var r3 = Base.fn(); // ok var r4 = Derived.fn(); // error - ~~~~~~~~~~ + ~~ !!! error TS2341: Property 'fn' is private and only accessible within class 'Derived'. var r5 = Base.a; // ok Base.a = 2; // ok var r6 = Derived.a; // error - ~~~~~~~~~ + ~ !!! error TS2341: Property 'a' is private and only accessible within class 'Derived'. Derived.a = 2; // error - ~~~~~~~~~ + ~ !!! error TS2341: Property 'a' is private and only accessible within class 'Derived'. \ No newline at end of file diff --git a/tests/baselines/reference/derivedClasses.symbols b/tests/baselines/reference/derivedClasses.symbols index f265c2dce53..61f4d7b81dc 100644 --- a/tests/baselines/reference/derivedClasses.symbols +++ b/tests/baselines/reference/derivedClasses.symbols @@ -4,7 +4,7 @@ class Red extends Color { >Color : Symbol(Color, Decl(derivedClasses.ts, 5, 1)) public shade() { ->shade : Symbol(shade, Decl(derivedClasses.ts, 0, 25)) +>shade : Symbol(Red.shade, Decl(derivedClasses.ts, 0, 25)) var getHue = () => { return this.hue(); }; >getHue : Symbol(getHue, Decl(derivedClasses.ts, 2, 8)) @@ -21,10 +21,10 @@ class Color { >Color : Symbol(Color, Decl(derivedClasses.ts, 5, 1)) public shade() { return "some shade"; } ->shade : Symbol(shade, Decl(derivedClasses.ts, 7, 13)) +>shade : Symbol(Color.shade, Decl(derivedClasses.ts, 7, 13)) public hue() { return "some hue"; } ->hue : Symbol(hue, Decl(derivedClasses.ts, 8, 43)) +>hue : Symbol(Color.hue, Decl(derivedClasses.ts, 8, 43)) } class Blue extends Color { @@ -32,7 +32,7 @@ class Blue extends Color { >Color : Symbol(Color, Decl(derivedClasses.ts, 5, 1)) public shade() { ->shade : Symbol(shade, Decl(derivedClasses.ts, 12, 26)) +>shade : Symbol(Blue.shade, Decl(derivedClasses.ts, 12, 26)) var getHue = () => { return this.hue(); }; >getHue : Symbol(getHue, Decl(derivedClasses.ts, 15, 8)) diff --git a/tests/baselines/reference/derivedTypeDoesNotRequireExtendsClause.symbols b/tests/baselines/reference/derivedTypeDoesNotRequireExtendsClause.symbols index e0f41b72f76..ef62a0fe7c5 100644 --- a/tests/baselines/reference/derivedTypeDoesNotRequireExtendsClause.symbols +++ b/tests/baselines/reference/derivedTypeDoesNotRequireExtendsClause.symbols @@ -3,17 +3,17 @@ class Base { >Base : Symbol(Base, Decl(derivedTypeDoesNotRequireExtendsClause.ts, 0, 0)) foo: string; ->foo : Symbol(foo, Decl(derivedTypeDoesNotRequireExtendsClause.ts, 0, 12)) +>foo : Symbol(Base.foo, Decl(derivedTypeDoesNotRequireExtendsClause.ts, 0, 12)) } class Derived { >Derived : Symbol(Derived, Decl(derivedTypeDoesNotRequireExtendsClause.ts, 2, 1)) foo: string; ->foo : Symbol(foo, Decl(derivedTypeDoesNotRequireExtendsClause.ts, 4, 15)) +>foo : Symbol(Derived.foo, Decl(derivedTypeDoesNotRequireExtendsClause.ts, 4, 15)) bar: number; ->bar : Symbol(bar, Decl(derivedTypeDoesNotRequireExtendsClause.ts, 5, 16)) +>bar : Symbol(Derived.bar, Decl(derivedTypeDoesNotRequireExtendsClause.ts, 5, 16)) } class Derived2 extends Base { @@ -21,7 +21,7 @@ class Derived2 extends Base { >Base : Symbol(Base, Decl(derivedTypeDoesNotRequireExtendsClause.ts, 0, 0)) bar: string; ->bar : Symbol(bar, Decl(derivedTypeDoesNotRequireExtendsClause.ts, 9, 29)) +>bar : Symbol(Derived2.bar, Decl(derivedTypeDoesNotRequireExtendsClause.ts, 9, 29)) } var b: Base; diff --git a/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment2.errors.txt b/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment2.errors.txt index 91405285973..3348effe822 100644 --- a/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment2.errors.txt +++ b/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment2.errors.txt @@ -5,7 +5,6 @@ tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAss Types of property '1' are incompatible. Type 'number' is not assignable to type 'boolean'. tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment2.ts(17,6): error TS2322: Type 'string' is not assignable to type 'Number'. - Property 'toFixed' is missing in type 'String'. tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment2.ts(22,5): error TS2322: Type 'number[]' is not assignable to type '[number, number]'. Property '0' is missing in type 'number[]'. tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment2.ts(23,5): error TS2322: Type 'number[]' is not assignable to type '[string, string]'. @@ -43,7 +42,6 @@ tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAss var [b3 = "string", b4, b5] = bar(); // Error ~~ !!! error TS2322: Type 'string' is not assignable to type 'Number'. -!!! error TS2322: Property 'toFixed' is missing in type 'String'. // V is an array assignment pattern, S is the type Any or an array-like type (section 3.3.2), and, for each assignment element E in V, // S is not a tuple- like type and the numeric index signature type of S is assignable to the target given in E. diff --git a/tests/baselines/reference/destructuringInFunctionType.js b/tests/baselines/reference/destructuringInFunctionType.js new file mode 100644 index 00000000000..ac187f5b43d --- /dev/null +++ b/tests/baselines/reference/destructuringInFunctionType.js @@ -0,0 +1,61 @@ +//// [destructuringInFunctionType.ts] + +interface a { a } +interface b { b } +interface c { c } + +type T1 = ([a, b, c]); +type F1 = ([a, b, c]) => void; + +type T2 = ({ a }); +type F2 = ({ a }) => void; + +type T3 = ([{ a: b }, { b: a }]); +type F3 = ([{ a: b }, { b: a }]) => void; + +type T4 = ([{ a: [b, c] }]); +type F4 = ([{ a: [b, c] }]) => void; + +type C1 = new ([{ a: [b, c] }]) => void; + +var v1 = ([a, b, c]) => "hello"; +var v2: ([a, b, c]) => string; + + +//// [destructuringInFunctionType.js] +var v1 = function (_a) { + var a = _a[0], b = _a[1], c = _a[2]; + return "hello"; +}; +var v2; + + +//// [destructuringInFunctionType.d.ts] +interface a { + a: any; +} +interface b { + b: any; +} +interface c { + c: any; +} +declare type T1 = ([a, b, c]); +declare type F1 = ([a, b, c]) => void; +declare type T2 = ({ + a; +}); +declare type F2 = ({a}) => void; +declare type T3 = ([{ + a: b; +}, { + b: a; +}]); +declare type F3 = ([{a: b}, {b: a}]) => void; +declare type T4 = ([{ + a: [b, c]; +}]); +declare type F4 = ([{a: [b, c]}]) => void; +declare type C1 = new ([{a: [b, c]}]) => void; +declare var v1: ([a, b, c]: [any, any, any]) => string; +declare var v2: ([a, b, c]) => string; diff --git a/tests/baselines/reference/destructuringInFunctionType.symbols b/tests/baselines/reference/destructuringInFunctionType.symbols new file mode 100644 index 00000000000..d73215a2ce6 --- /dev/null +++ b/tests/baselines/reference/destructuringInFunctionType.symbols @@ -0,0 +1,78 @@ +=== tests/cases/conformance/es6/destructuring/destructuringInFunctionType.ts === + +interface a { a } +>a : Symbol(a, Decl(destructuringInFunctionType.ts, 0, 0)) +>a : Symbol(a.a, Decl(destructuringInFunctionType.ts, 1, 13)) + +interface b { b } +>b : Symbol(b, Decl(destructuringInFunctionType.ts, 1, 17)) +>b : Symbol(b.b, Decl(destructuringInFunctionType.ts, 2, 13)) + +interface c { c } +>c : Symbol(c, Decl(destructuringInFunctionType.ts, 2, 17)) +>c : Symbol(c.c, Decl(destructuringInFunctionType.ts, 3, 13)) + +type T1 = ([a, b, c]); +>T1 : Symbol(T1, Decl(destructuringInFunctionType.ts, 3, 17)) +>a : Symbol(a, Decl(destructuringInFunctionType.ts, 0, 0)) +>b : Symbol(b, Decl(destructuringInFunctionType.ts, 1, 17)) +>c : Symbol(c, Decl(destructuringInFunctionType.ts, 2, 17)) + +type F1 = ([a, b, c]) => void; +>F1 : Symbol(F1, Decl(destructuringInFunctionType.ts, 5, 22)) +>a : Symbol(a, Decl(destructuringInFunctionType.ts, 6, 12)) +>b : Symbol(b, Decl(destructuringInFunctionType.ts, 6, 14)) +>c : Symbol(c, Decl(destructuringInFunctionType.ts, 6, 17)) + +type T2 = ({ a }); +>T2 : Symbol(T2, Decl(destructuringInFunctionType.ts, 6, 30)) +>a : Symbol(a, Decl(destructuringInFunctionType.ts, 8, 12)) + +type F2 = ({ a }) => void; +>F2 : Symbol(F2, Decl(destructuringInFunctionType.ts, 8, 18)) +>a : Symbol(a, Decl(destructuringInFunctionType.ts, 9, 12)) + +type T3 = ([{ a: b }, { b: a }]); +>T3 : Symbol(T3, Decl(destructuringInFunctionType.ts, 9, 26)) +>a : Symbol(a, Decl(destructuringInFunctionType.ts, 11, 13)) +>b : Symbol(b, Decl(destructuringInFunctionType.ts, 1, 17)) +>b : Symbol(b, Decl(destructuringInFunctionType.ts, 11, 23)) +>a : Symbol(a, Decl(destructuringInFunctionType.ts, 0, 0)) + +type F3 = ([{ a: b }, { b: a }]) => void; +>F3 : Symbol(F3, Decl(destructuringInFunctionType.ts, 11, 33)) +>a : Symbol(a) +>b : Symbol(b, Decl(destructuringInFunctionType.ts, 12, 13)) +>b : Symbol(b) +>a : Symbol(a, Decl(destructuringInFunctionType.ts, 12, 23)) + +type T4 = ([{ a: [b, c] }]); +>T4 : Symbol(T4, Decl(destructuringInFunctionType.ts, 12, 41)) +>a : Symbol(a, Decl(destructuringInFunctionType.ts, 14, 13)) +>b : Symbol(b, Decl(destructuringInFunctionType.ts, 1, 17)) +>c : Symbol(c, Decl(destructuringInFunctionType.ts, 2, 17)) + +type F4 = ([{ a: [b, c] }]) => void; +>F4 : Symbol(F4, Decl(destructuringInFunctionType.ts, 14, 28)) +>a : Symbol(a) +>b : Symbol(b, Decl(destructuringInFunctionType.ts, 15, 18)) +>c : Symbol(c, Decl(destructuringInFunctionType.ts, 15, 20)) + +type C1 = new ([{ a: [b, c] }]) => void; +>C1 : Symbol(C1, Decl(destructuringInFunctionType.ts, 15, 36)) +>a : Symbol(a) +>b : Symbol(b, Decl(destructuringInFunctionType.ts, 17, 22)) +>c : Symbol(c, Decl(destructuringInFunctionType.ts, 17, 24)) + +var v1 = ([a, b, c]) => "hello"; +>v1 : Symbol(v1, Decl(destructuringInFunctionType.ts, 19, 3)) +>a : Symbol(a, Decl(destructuringInFunctionType.ts, 19, 11)) +>b : Symbol(b, Decl(destructuringInFunctionType.ts, 19, 13)) +>c : Symbol(c, Decl(destructuringInFunctionType.ts, 19, 16)) + +var v2: ([a, b, c]) => string; +>v2 : Symbol(v2, Decl(destructuringInFunctionType.ts, 20, 3)) +>a : Symbol(a, Decl(destructuringInFunctionType.ts, 20, 10)) +>b : Symbol(b, Decl(destructuringInFunctionType.ts, 20, 12)) +>c : Symbol(c, Decl(destructuringInFunctionType.ts, 20, 15)) + diff --git a/tests/baselines/reference/destructuringInFunctionType.types b/tests/baselines/reference/destructuringInFunctionType.types new file mode 100644 index 00000000000..0cf057e06a3 --- /dev/null +++ b/tests/baselines/reference/destructuringInFunctionType.types @@ -0,0 +1,80 @@ +=== tests/cases/conformance/es6/destructuring/destructuringInFunctionType.ts === + +interface a { a } +>a : a +>a : any + +interface b { b } +>b : b +>b : any + +interface c { c } +>c : c +>c : any + +type T1 = ([a, b, c]); +>T1 : [a, b, c] +>a : a +>b : b +>c : c + +type F1 = ([a, b, c]) => void; +>F1 : ([a, b, c]: [any, any, any]) => void +>a : any +>b : any +>c : any + +type T2 = ({ a }); +>T2 : { a: any; } +>a : any + +type F2 = ({ a }) => void; +>F2 : ({a}: { a: any; }) => void +>a : any + +type T3 = ([{ a: b }, { b: a }]); +>T3 : [{ a: b; }, { b: a; }] +>a : b +>b : b +>b : a +>a : a + +type F3 = ([{ a: b }, { b: a }]) => void; +>F3 : ([{a: b}, {b: a}]: [{ a: any; }, { b: any; }]) => void +>a : any +>b : any +>b : any +>a : any + +type T4 = ([{ a: [b, c] }]); +>T4 : [{ a: [b, c]; }] +>a : [b, c] +>b : b +>c : c + +type F4 = ([{ a: [b, c] }]) => void; +>F4 : ([{a: [b, c]}]: [{ a: [any, any]; }]) => void +>a : any +>b : any +>c : any + +type C1 = new ([{ a: [b, c] }]) => void; +>C1 : new ([{a: [b, c]}]: [{ a: [any, any]; }]) => void +>a : any +>b : any +>c : any + +var v1 = ([a, b, c]) => "hello"; +>v1 : ([a, b, c]: [any, any, any]) => string +>([a, b, c]) => "hello" : ([a, b, c]: [any, any, any]) => string +>a : any +>b : any +>c : any +>"hello" : string + +var v2: ([a, b, c]) => string; +>v2 : ([a, b, c]: [any, any, any]) => string +>a : any +>b : any +>c : any + diff --git a/tests/baselines/reference/destructuringInVariableDeclarations1.js b/tests/baselines/reference/destructuringInVariableDeclarations1.js new file mode 100644 index 00000000000..707218b41e2 --- /dev/null +++ b/tests/baselines/reference/destructuringInVariableDeclarations1.js @@ -0,0 +1,13 @@ +//// [destructuringInVariableDeclarations1.ts] +export let { toString } = 1; +{ + let { toFixed } = 1; +} + + +//// [destructuringInVariableDeclarations1.js] +"use strict"; +exports.toString = (1).toString; +{ + let { toFixed } = 1; +} diff --git a/tests/baselines/reference/destructuringInVariableDeclarations1.symbols b/tests/baselines/reference/destructuringInVariableDeclarations1.symbols new file mode 100644 index 00000000000..4043bcc734d --- /dev/null +++ b/tests/baselines/reference/destructuringInVariableDeclarations1.symbols @@ -0,0 +1,8 @@ +=== tests/cases/compiler/destructuringInVariableDeclarations1.ts === +export let { toString } = 1; +>toString : Symbol(toString, Decl(destructuringInVariableDeclarations1.ts, 0, 12)) +{ + let { toFixed } = 1; +>toFixed : Symbol(toFixed, Decl(destructuringInVariableDeclarations1.ts, 2, 9)) +} + diff --git a/tests/baselines/reference/destructuringInVariableDeclarations1.types b/tests/baselines/reference/destructuringInVariableDeclarations1.types new file mode 100644 index 00000000000..84a60c844a3 --- /dev/null +++ b/tests/baselines/reference/destructuringInVariableDeclarations1.types @@ -0,0 +1,10 @@ +=== tests/cases/compiler/destructuringInVariableDeclarations1.ts === +export let { toString } = 1; +>toString : (radix?: number) => string +>1 : number +{ + let { toFixed } = 1; +>toFixed : (fractionDigits?: number) => string +>1 : number +} + diff --git a/tests/baselines/reference/destructuringInVariableDeclarations2.js b/tests/baselines/reference/destructuringInVariableDeclarations2.js new file mode 100644 index 00000000000..9c1366bd8e0 --- /dev/null +++ b/tests/baselines/reference/destructuringInVariableDeclarations2.js @@ -0,0 +1,14 @@ +//// [destructuringInVariableDeclarations2.ts] +let { toString } = 1; +{ + let { toFixed } = 1; +} +export {}; + + +//// [destructuringInVariableDeclarations2.js] +"use strict"; +let { toString } = 1; +{ + let { toFixed } = 1; +} diff --git a/tests/baselines/reference/destructuringInVariableDeclarations2.symbols b/tests/baselines/reference/destructuringInVariableDeclarations2.symbols new file mode 100644 index 00000000000..f05ddf0c758 --- /dev/null +++ b/tests/baselines/reference/destructuringInVariableDeclarations2.symbols @@ -0,0 +1,9 @@ +=== tests/cases/compiler/destructuringInVariableDeclarations2.ts === +let { toString } = 1; +>toString : Symbol(toString, Decl(destructuringInVariableDeclarations2.ts, 0, 5)) +{ + let { toFixed } = 1; +>toFixed : Symbol(toFixed, Decl(destructuringInVariableDeclarations2.ts, 2, 9)) +} +export {}; + diff --git a/tests/baselines/reference/destructuringInVariableDeclarations2.types b/tests/baselines/reference/destructuringInVariableDeclarations2.types new file mode 100644 index 00000000000..b7456d30285 --- /dev/null +++ b/tests/baselines/reference/destructuringInVariableDeclarations2.types @@ -0,0 +1,11 @@ +=== tests/cases/compiler/destructuringInVariableDeclarations2.ts === +let { toString } = 1; +>toString : (radix?: number) => string +>1 : number +{ + let { toFixed } = 1; +>toFixed : (fractionDigits?: number) => string +>1 : number +} +export {}; + diff --git a/tests/baselines/reference/destructuringInVariableDeclarations3.js b/tests/baselines/reference/destructuringInVariableDeclarations3.js new file mode 100644 index 00000000000..8da039fe98e --- /dev/null +++ b/tests/baselines/reference/destructuringInVariableDeclarations3.js @@ -0,0 +1,15 @@ +//// [destructuringInVariableDeclarations3.ts] +export let { toString } = 1; +{ + let { toFixed } = 1; +} + + +//// [destructuringInVariableDeclarations3.js] +define(["require", "exports"], function (require, exports) { + "use strict"; + exports.toString = (1).toString; + { + let { toFixed } = 1; + } +}); diff --git a/tests/baselines/reference/destructuringInVariableDeclarations3.symbols b/tests/baselines/reference/destructuringInVariableDeclarations3.symbols new file mode 100644 index 00000000000..84b131a8ad0 --- /dev/null +++ b/tests/baselines/reference/destructuringInVariableDeclarations3.symbols @@ -0,0 +1,8 @@ +=== tests/cases/compiler/destructuringInVariableDeclarations3.ts === +export let { toString } = 1; +>toString : Symbol(toString, Decl(destructuringInVariableDeclarations3.ts, 0, 12)) +{ + let { toFixed } = 1; +>toFixed : Symbol(toFixed, Decl(destructuringInVariableDeclarations3.ts, 2, 9)) +} + diff --git a/tests/baselines/reference/destructuringInVariableDeclarations3.types b/tests/baselines/reference/destructuringInVariableDeclarations3.types new file mode 100644 index 00000000000..970d6deb1ed --- /dev/null +++ b/tests/baselines/reference/destructuringInVariableDeclarations3.types @@ -0,0 +1,10 @@ +=== tests/cases/compiler/destructuringInVariableDeclarations3.ts === +export let { toString } = 1; +>toString : (radix?: number) => string +>1 : number +{ + let { toFixed } = 1; +>toFixed : (fractionDigits?: number) => string +>1 : number +} + diff --git a/tests/baselines/reference/destructuringInVariableDeclarations4.js b/tests/baselines/reference/destructuringInVariableDeclarations4.js new file mode 100644 index 00000000000..d4b30405143 --- /dev/null +++ b/tests/baselines/reference/destructuringInVariableDeclarations4.js @@ -0,0 +1,16 @@ +//// [destructuringInVariableDeclarations4.ts] +let { toString } = 1; +{ + let { toFixed } = 1; +} +export {}; + + +//// [destructuringInVariableDeclarations4.js] +define(["require", "exports"], function (require, exports) { + "use strict"; + let { toString } = 1; + { + let { toFixed } = 1; + } +}); diff --git a/tests/baselines/reference/destructuringInVariableDeclarations4.symbols b/tests/baselines/reference/destructuringInVariableDeclarations4.symbols new file mode 100644 index 00000000000..e599d7c5793 --- /dev/null +++ b/tests/baselines/reference/destructuringInVariableDeclarations4.symbols @@ -0,0 +1,9 @@ +=== tests/cases/compiler/destructuringInVariableDeclarations4.ts === +let { toString } = 1; +>toString : Symbol(toString, Decl(destructuringInVariableDeclarations4.ts, 0, 5)) +{ + let { toFixed } = 1; +>toFixed : Symbol(toFixed, Decl(destructuringInVariableDeclarations4.ts, 2, 9)) +} +export {}; + diff --git a/tests/baselines/reference/destructuringInVariableDeclarations4.types b/tests/baselines/reference/destructuringInVariableDeclarations4.types new file mode 100644 index 00000000000..628fe7a9562 --- /dev/null +++ b/tests/baselines/reference/destructuringInVariableDeclarations4.types @@ -0,0 +1,11 @@ +=== tests/cases/compiler/destructuringInVariableDeclarations4.ts === +let { toString } = 1; +>toString : (radix?: number) => string +>1 : number +{ + let { toFixed } = 1; +>toFixed : (fractionDigits?: number) => string +>1 : number +} +export {}; + diff --git a/tests/baselines/reference/destructuringInVariableDeclarations5.js b/tests/baselines/reference/destructuringInVariableDeclarations5.js new file mode 100644 index 00000000000..8938757adc2 --- /dev/null +++ b/tests/baselines/reference/destructuringInVariableDeclarations5.js @@ -0,0 +1,22 @@ +//// [destructuringInVariableDeclarations5.ts] +export let { toString } = 1; +{ + let { toFixed } = 1; +} + + +//// [destructuringInVariableDeclarations5.js] +(function (factory) { + if (typeof module === 'object' && typeof module.exports === 'object') { + var v = factory(require, exports); if (v !== undefined) module.exports = v; + } + else if (typeof define === 'function' && define.amd) { + define(["require", "exports"], factory); + } +})(function (require, exports) { + "use strict"; + exports.toString = (1).toString; + { + let { toFixed } = 1; + } +}); diff --git a/tests/baselines/reference/destructuringInVariableDeclarations5.symbols b/tests/baselines/reference/destructuringInVariableDeclarations5.symbols new file mode 100644 index 00000000000..60719928617 --- /dev/null +++ b/tests/baselines/reference/destructuringInVariableDeclarations5.symbols @@ -0,0 +1,8 @@ +=== tests/cases/compiler/destructuringInVariableDeclarations5.ts === +export let { toString } = 1; +>toString : Symbol(toString, Decl(destructuringInVariableDeclarations5.ts, 0, 12)) +{ + let { toFixed } = 1; +>toFixed : Symbol(toFixed, Decl(destructuringInVariableDeclarations5.ts, 2, 9)) +} + diff --git a/tests/baselines/reference/destructuringInVariableDeclarations5.types b/tests/baselines/reference/destructuringInVariableDeclarations5.types new file mode 100644 index 00000000000..9a890916d17 --- /dev/null +++ b/tests/baselines/reference/destructuringInVariableDeclarations5.types @@ -0,0 +1,10 @@ +=== tests/cases/compiler/destructuringInVariableDeclarations5.ts === +export let { toString } = 1; +>toString : (radix?: number) => string +>1 : number +{ + let { toFixed } = 1; +>toFixed : (fractionDigits?: number) => string +>1 : number +} + diff --git a/tests/baselines/reference/destructuringInVariableDeclarations6.js b/tests/baselines/reference/destructuringInVariableDeclarations6.js new file mode 100644 index 00000000000..b9dddb673cf --- /dev/null +++ b/tests/baselines/reference/destructuringInVariableDeclarations6.js @@ -0,0 +1,23 @@ +//// [destructuringInVariableDeclarations6.ts] +let { toString } = 1; +{ + let { toFixed } = 1; +} +export {}; + + +//// [destructuringInVariableDeclarations6.js] +(function (factory) { + if (typeof module === 'object' && typeof module.exports === 'object') { + var v = factory(require, exports); if (v !== undefined) module.exports = v; + } + else if (typeof define === 'function' && define.amd) { + define(["require", "exports"], factory); + } +})(function (require, exports) { + "use strict"; + let { toString } = 1; + { + let { toFixed } = 1; + } +}); diff --git a/tests/baselines/reference/destructuringInVariableDeclarations6.symbols b/tests/baselines/reference/destructuringInVariableDeclarations6.symbols new file mode 100644 index 00000000000..71072de351e --- /dev/null +++ b/tests/baselines/reference/destructuringInVariableDeclarations6.symbols @@ -0,0 +1,9 @@ +=== tests/cases/compiler/destructuringInVariableDeclarations6.ts === +let { toString } = 1; +>toString : Symbol(toString, Decl(destructuringInVariableDeclarations6.ts, 0, 5)) +{ + let { toFixed } = 1; +>toFixed : Symbol(toFixed, Decl(destructuringInVariableDeclarations6.ts, 2, 9)) +} +export {}; + diff --git a/tests/baselines/reference/destructuringInVariableDeclarations6.types b/tests/baselines/reference/destructuringInVariableDeclarations6.types new file mode 100644 index 00000000000..cf1105b575a --- /dev/null +++ b/tests/baselines/reference/destructuringInVariableDeclarations6.types @@ -0,0 +1,11 @@ +=== tests/cases/compiler/destructuringInVariableDeclarations6.ts === +let { toString } = 1; +>toString : (radix?: number) => string +>1 : number +{ + let { toFixed } = 1; +>toFixed : (fractionDigits?: number) => string +>1 : number +} +export {}; + diff --git a/tests/baselines/reference/destructuringInVariableDeclarations7.js b/tests/baselines/reference/destructuringInVariableDeclarations7.js new file mode 100644 index 00000000000..129a9db8d15 --- /dev/null +++ b/tests/baselines/reference/destructuringInVariableDeclarations7.js @@ -0,0 +1,22 @@ +//// [destructuringInVariableDeclarations7.ts] +export let { toString } = 1; +{ + let { toFixed } = 1; +} + + +//// [destructuringInVariableDeclarations7.js] +System.register([], function(exports_1, context_1) { + "use strict"; + var __moduleName = context_1 && context_1.id; + var toString; + return { + setters:[], + execute: function() { + exports_1("toString", toString = (1).toString); + { + let { toFixed } = 1; + } + } + } +}); diff --git a/tests/baselines/reference/destructuringInVariableDeclarations7.symbols b/tests/baselines/reference/destructuringInVariableDeclarations7.symbols new file mode 100644 index 00000000000..7fde898296b --- /dev/null +++ b/tests/baselines/reference/destructuringInVariableDeclarations7.symbols @@ -0,0 +1,8 @@ +=== tests/cases/compiler/destructuringInVariableDeclarations7.ts === +export let { toString } = 1; +>toString : Symbol(toString, Decl(destructuringInVariableDeclarations7.ts, 0, 12)) +{ + let { toFixed } = 1; +>toFixed : Symbol(toFixed, Decl(destructuringInVariableDeclarations7.ts, 2, 9)) +} + diff --git a/tests/baselines/reference/destructuringInVariableDeclarations7.types b/tests/baselines/reference/destructuringInVariableDeclarations7.types new file mode 100644 index 00000000000..c0c1b571215 --- /dev/null +++ b/tests/baselines/reference/destructuringInVariableDeclarations7.types @@ -0,0 +1,10 @@ +=== tests/cases/compiler/destructuringInVariableDeclarations7.ts === +export let { toString } = 1; +>toString : (radix?: number) => string +>1 : number +{ + let { toFixed } = 1; +>toFixed : (fractionDigits?: number) => string +>1 : number +} + diff --git a/tests/baselines/reference/destructuringInVariableDeclarations8.js b/tests/baselines/reference/destructuringInVariableDeclarations8.js new file mode 100644 index 00000000000..bc19fa118f6 --- /dev/null +++ b/tests/baselines/reference/destructuringInVariableDeclarations8.js @@ -0,0 +1,23 @@ +//// [destructuringInVariableDeclarations8.ts] +let { toString } = 1; +{ + let { toFixed } = 1; +} +export {}; + + +//// [destructuringInVariableDeclarations8.js] +System.register([], function(exports_1, context_1) { + "use strict"; + var __moduleName = context_1 && context_1.id; + var toString; + return { + setters:[], + execute: function() { + ({ toString } = 1); + { + let { toFixed } = 1; + } + } + } +}); diff --git a/tests/baselines/reference/destructuringInVariableDeclarations8.symbols b/tests/baselines/reference/destructuringInVariableDeclarations8.symbols new file mode 100644 index 00000000000..887ea4ffa4c --- /dev/null +++ b/tests/baselines/reference/destructuringInVariableDeclarations8.symbols @@ -0,0 +1,9 @@ +=== tests/cases/compiler/destructuringInVariableDeclarations8.ts === +let { toString } = 1; +>toString : Symbol(toString, Decl(destructuringInVariableDeclarations8.ts, 0, 5)) +{ + let { toFixed } = 1; +>toFixed : Symbol(toFixed, Decl(destructuringInVariableDeclarations8.ts, 2, 9)) +} +export {}; + diff --git a/tests/baselines/reference/destructuringInVariableDeclarations8.types b/tests/baselines/reference/destructuringInVariableDeclarations8.types new file mode 100644 index 00000000000..ef376563551 --- /dev/null +++ b/tests/baselines/reference/destructuringInVariableDeclarations8.types @@ -0,0 +1,11 @@ +=== tests/cases/compiler/destructuringInVariableDeclarations8.ts === +let { toString } = 1; +>toString : (radix?: number) => string +>1 : number +{ + let { toFixed } = 1; +>toFixed : (fractionDigits?: number) => string +>1 : number +} +export {}; + diff --git a/tests/baselines/reference/destructuringObjectBindingPatternAndAssignment1ES5.types b/tests/baselines/reference/destructuringObjectBindingPatternAndAssignment1ES5.types index 476b5bee0cc..cb6052d93fd 100644 --- a/tests/baselines/reference/destructuringObjectBindingPatternAndAssignment1ES5.types +++ b/tests/baselines/reference/destructuringObjectBindingPatternAndAssignment1ES5.types @@ -69,7 +69,7 @@ function foo(): F { >F : F return { ->{ 1: true } : { [x: number]: boolean; 1: boolean; } +>{ 1: true } : { 1: boolean; } 1: true >true : boolean @@ -82,7 +82,7 @@ function bar(): F { >F : F return { ->{ 2: true } : { [x: number]: boolean; 2: boolean; } +>{ 2: true } : { 2: boolean; } 2: true >true : boolean @@ -114,7 +114,7 @@ function foo1(): F1 { >F1 : F1 return { ->{ "prop1": 2 } : { [x: string]: number; "prop1": number; } +>{ "prop1": 2 } : { "prop1": number; } "prop1": 2 >2 : number diff --git a/tests/baselines/reference/destructuringObjectBindingPatternAndAssignment1ES6.types b/tests/baselines/reference/destructuringObjectBindingPatternAndAssignment1ES6.types index 7a7f631eddf..2d77c20f65b 100644 --- a/tests/baselines/reference/destructuringObjectBindingPatternAndAssignment1ES6.types +++ b/tests/baselines/reference/destructuringObjectBindingPatternAndAssignment1ES6.types @@ -69,7 +69,7 @@ function foo(): F { >F : F return { ->{ 1: true } : { [x: number]: boolean; 1: boolean; } +>{ 1: true } : { 1: boolean; } 1: true >true : boolean @@ -82,7 +82,7 @@ function bar(): F { >F : F return { ->{ 2: true } : { [x: number]: boolean; 2: boolean; } +>{ 2: true } : { 2: boolean; } 2: true >true : boolean @@ -114,7 +114,7 @@ function foo1(): F1 { >F1 : F1 return { ->{ "prop1": 2 } : { [x: string]: number; "prop1": number; } +>{ "prop1": 2 } : { "prop1": number; } "prop1": 2 >2 : number diff --git a/tests/baselines/reference/destructuringParameterDeclaration2.errors.txt b/tests/baselines/reference/destructuringParameterDeclaration2.errors.txt index c8037255a32..d68220c8308 100644 --- a/tests/baselines/reference/destructuringParameterDeclaration2.errors.txt +++ b/tests/baselines/reference/destructuringParameterDeclaration2.errors.txt @@ -7,8 +7,6 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts( Type '() => number | string[][] | string' is not assignable to type '() => number | string[][]'. Type 'number | string[][] | string' is not assignable to type 'number | string[][]'. Type 'string' is not assignable to type 'number | string[][]'. - Type 'string' is not assignable to type 'string[][]'. - Property 'push' is missing in type 'String'. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(16,8): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(16,16): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(23,14): error TS2345: Argument of type '{ x: string; y: boolean; }' is not assignable to parameter of type '{ x: number; y: any; }'. @@ -30,11 +28,9 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts( tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(38,4): error TS2345: Argument of type '{ b: boolean; }' is not assignable to parameter of type '{ b: number | string; }'. Types of property 'b' are incompatible. Type 'boolean' is not assignable to type 'number | string'. - Type 'boolean' is not assignable to type 'string'. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(39,4): error TS2345: Argument of type '[number, number, boolean, boolean]' is not assignable to parameter of type '[any, any, [[any]]]'. Types of property '2' are incompatible. Type 'boolean' is not assignable to type '[[any]]'. - Property '0' is missing in type 'Boolean'. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(40,4): error TS2345: Argument of type '[number, number, [[string]]]' is not assignable to parameter of type '[any, any, [[number]]]'. Types of property '2' are incompatible. Type '[[string]]' is not assignable to type '[[number]]'. @@ -48,8 +44,8 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts( Types of property 'd4' are incompatible. Type '({x, y, c}: { x: any; y: any; c: any; }) => void' is not assignable to type '({x, y, z}?: { x: any; y: any; z: any; }) => any'. Types of parameters '__0' and '__0' are incompatible. - Type '{ x: any; y: any; c: any; }' is not assignable to type '{ x: any; y: any; z: any; }'. - Property 'z' is missing in type '{ x: any; y: any; c: any; }'. + Type '{ x: any; y: any; z: any; }' is not assignable to type '{ x: any; y: any; c: any; }'. + Property 'c' is missing in type '{ x: any; y: any; z: any; }'. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(56,8): error TS2463: A binding pattern parameter cannot be optional in an implementation signature. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(65,18): error TS2300: Duplicate identifier 'number'. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(65,26): error TS2300: Duplicate identifier 'number'. @@ -77,8 +73,6 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts( !!! error TS2345: Type '() => number | string[][] | string' is not assignable to type '() => number | string[][]'. !!! error TS2345: Type 'number | string[][] | string' is not assignable to type 'number | string[][]'. !!! error TS2345: Type 'string' is not assignable to type 'number | string[][]'. -!!! error TS2345: Type 'string' is not assignable to type 'string[][]'. -!!! error TS2345: Property 'push' is missing in type 'String'. // If the declaration includes an initializer expression (which is permitted only @@ -140,13 +134,11 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts( !!! error TS2345: Argument of type '{ b: boolean; }' is not assignable to parameter of type '{ b: number | string; }'. !!! error TS2345: Types of property 'b' are incompatible. !!! error TS2345: Type 'boolean' is not assignable to type 'number | string'. -!!! error TS2345: Type 'boolean' is not assignable to type 'string'. c5([1, 2, false, true]); // Error, implied type is [any, any, [[any]]] ~~~~~~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '[number, number, boolean, boolean]' is not assignable to parameter of type '[any, any, [[any]]]'. !!! error TS2345: Types of property '2' are incompatible. !!! error TS2345: Type 'boolean' is not assignable to type '[[any]]'. -!!! error TS2345: Property '0' is missing in type 'Boolean'. c6([1, 2, [["string"]]]); // Error, implied type is [any, any, [[number]]] // Use initializer ~~~~~~~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '[number, number, [[string]]]' is not assignable to parameter of type '[any, any, [[number]]]'. @@ -180,8 +172,8 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts( !!! error TS2420: Types of property 'd4' are incompatible. !!! error TS2420: Type '({x, y, c}: { x: any; y: any; c: any; }) => void' is not assignable to type '({x, y, z}?: { x: any; y: any; z: any; }) => any'. !!! error TS2420: Types of parameters '__0' and '__0' are incompatible. -!!! error TS2420: Type '{ x: any; y: any; c: any; }' is not assignable to type '{ x: any; y: any; z: any; }'. -!!! error TS2420: Property 'z' is missing in type '{ x: any; y: any; c: any; }'. +!!! error TS2420: Type '{ x: any; y: any; z: any; }' is not assignable to type '{ x: any; y: any; c: any; }'. +!!! error TS2420: Property 'c' is missing in type '{ x: any; y: any; z: any; }'. d3([a, b, c]?) { } // Error, binding pattern can't be optional in implementation signature ~~~~~~~~~~ !!! error TS2463: A binding pattern parameter cannot be optional in an implementation signature. diff --git a/tests/baselines/reference/destructuringParameterDeclaration3ES5.symbols b/tests/baselines/reference/destructuringParameterDeclaration3ES5.symbols index c4dc8fd0f79..b9bf9ee54e2 100644 --- a/tests/baselines/reference/destructuringParameterDeclaration3ES5.symbols +++ b/tests/baselines/reference/destructuringParameterDeclaration3ES5.symbols @@ -8,19 +8,19 @@ type arrayString = Array >arrayString : Symbol(arrayString, Decl(destructuringParameterDeclaration3ES5.ts, 0, 0)) ->Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>String : Symbol(String, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) type someArray = Array | number[]; >someArray : Symbol(someArray, Decl(destructuringParameterDeclaration3ES5.ts, 7, 32)) ->Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>String : Symbol(String, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) type stringOrNumArray = Array; >stringOrNumArray : Symbol(stringOrNumArray, Decl(destructuringParameterDeclaration3ES5.ts, 8, 42)) ->Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>String : Symbol(String, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) function a1(...x: (number|string)[]) { } >a1 : Symbol(a1, Decl(destructuringParameterDeclaration3ES5.ts, 9, 45)) @@ -33,8 +33,8 @@ function a2(...a) { } function a3(...a: Array) { } >a3 : Symbol(a3, Decl(destructuringParameterDeclaration3ES5.ts, 12, 21)) >a : Symbol(a, Decl(destructuringParameterDeclaration3ES5.ts, 13, 12)) ->Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>String : Symbol(String, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) function a4(...a: arrayString) { } >a4 : Symbol(a4, Decl(destructuringParameterDeclaration3ES5.ts, 13, 36)) @@ -122,7 +122,7 @@ const enum E1 { a, b } function foo1(...a: T[]) { } >foo1 : Symbol(foo1, Decl(destructuringParameterDeclaration3ES5.ts, 39, 22)) >T : Symbol(T, Decl(destructuringParameterDeclaration3ES5.ts, 40, 14)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >a : Symbol(a, Decl(destructuringParameterDeclaration3ES5.ts, 40, 32)) >T : Symbol(T, Decl(destructuringParameterDeclaration3ES5.ts, 40, 14)) diff --git a/tests/baselines/reference/destructuringParameterDeclaration3ES6.symbols b/tests/baselines/reference/destructuringParameterDeclaration3ES6.symbols index 46682802e2a..e372d6d02a3 100644 --- a/tests/baselines/reference/destructuringParameterDeclaration3ES6.symbols +++ b/tests/baselines/reference/destructuringParameterDeclaration3ES6.symbols @@ -8,19 +8,19 @@ type arrayString = Array >arrayString : Symbol(arrayString, Decl(destructuringParameterDeclaration3ES6.ts, 0, 0)) ->Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>String : Symbol(String, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) type someArray = Array | number[]; >someArray : Symbol(someArray, Decl(destructuringParameterDeclaration3ES6.ts, 7, 32)) ->Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>String : Symbol(String, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) type stringOrNumArray = Array; >stringOrNumArray : Symbol(stringOrNumArray, Decl(destructuringParameterDeclaration3ES6.ts, 8, 42)) ->Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>String : Symbol(String, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) function a1(...x: (number|string)[]) { } >a1 : Symbol(a1, Decl(destructuringParameterDeclaration3ES6.ts, 9, 45)) @@ -33,8 +33,8 @@ function a2(...a) { } function a3(...a: Array) { } >a3 : Symbol(a3, Decl(destructuringParameterDeclaration3ES6.ts, 12, 21)) >a : Symbol(a, Decl(destructuringParameterDeclaration3ES6.ts, 13, 12)) ->Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>String : Symbol(String, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) function a4(...a: arrayString) { } >a4 : Symbol(a4, Decl(destructuringParameterDeclaration3ES6.ts, 13, 36)) @@ -122,7 +122,7 @@ const enum E1 { a, b } function foo1(...a: T[]) { } >foo1 : Symbol(foo1, Decl(destructuringParameterDeclaration3ES6.ts, 39, 22)) >T : Symbol(T, Decl(destructuringParameterDeclaration3ES6.ts, 40, 14)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >a : Symbol(a, Decl(destructuringParameterDeclaration3ES6.ts, 40, 32)) >T : Symbol(T, Decl(destructuringParameterDeclaration3ES6.ts, 40, 14)) diff --git a/tests/baselines/reference/destructuringParameterDeclaration4.errors.txt b/tests/baselines/reference/destructuringParameterDeclaration4.errors.txt index 7e71a2cd753..aa5a8e8daea 100644 --- a/tests/baselines/reference/destructuringParameterDeclaration4.errors.txt +++ b/tests/baselines/reference/destructuringParameterDeclaration4.errors.txt @@ -1,12 +1,10 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(11,13): error TS2370: A rest parameter must be of an array type. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(13,13): error TS2370: A rest parameter must be of an array type. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(20,19): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'number | string'. - Type 'boolean' is not assignable to type 'string'. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(21,7): error TS2304: Cannot find name 'array2'. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(22,4): error TS2345: Argument of type '[number, number, string, boolean, boolean]' is not assignable to parameter of type '[any, any, [[any]]]'. Types of property '2' are incompatible. Type 'string' is not assignable to type '[[any]]'. - Property '0' is missing in type 'String'. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(23,4): error TS2345: Argument of type '[number, number]' is not assignable to parameter of type '[any, any, [[any]]]'. Property '2' is missing in type '[number, number]'. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(24,4): error TS2345: Argument of type '(number | string)[]' is not assignable to parameter of type 'number[]'. @@ -44,7 +42,6 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts( a1(1, 2, "hello", true); // Error, parameter type is (number|string)[] ~~~~ !!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'number | string'. -!!! error TS2345: Type 'boolean' is not assignable to type 'string'. a1(...array2); // Error parameter type is (number|string)[] ~~~~~~ !!! error TS2304: Cannot find name 'array2'. @@ -53,7 +50,6 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts( !!! error TS2345: Argument of type '[number, number, string, boolean, boolean]' is not assignable to parameter of type '[any, any, [[any]]]'. !!! error TS2345: Types of property '2' are incompatible. !!! error TS2345: Type 'string' is not assignable to type '[[any]]'. -!!! error TS2345: Property '0' is missing in type 'String'. a5([1, 2]); // Error, parameter type is [any, any, [[any]]] ~~~~~~ !!! error TS2345: Argument of type '[number, number]' is not assignable to parameter of type '[any, any, [[any]]]'. diff --git a/tests/baselines/reference/destructuringParameterDeclaration5.errors.txt b/tests/baselines/reference/destructuringParameterDeclaration5.errors.txt index c60e2b75c37..2afb25502c7 100644 --- a/tests/baselines/reference/destructuringParameterDeclaration5.errors.txt +++ b/tests/baselines/reference/destructuringParameterDeclaration5.errors.txt @@ -1,6 +1,7 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration5.ts(47,4): error TS2345: Argument of type '{ y: Class; }' is not assignable to parameter of type '{ y: D; }'. Types of property 'y' are incompatible. Type 'Class' is not assignable to type 'D'. + Property 'foo' is missing in type 'Class'. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration5.ts(48,4): error TS2345: Argument of type '{}' is not assignable to parameter of type '{ y: D; }'. Property 'y' is missing in type '{}'. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration5.ts(49,4): error TS2345: Argument of type '{ y: number; }' is not assignable to parameter of type '{ y: D; }'. @@ -63,6 +64,7 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration5.ts( !!! error TS2345: Argument of type '{ y: Class; }' is not assignable to parameter of type '{ y: D; }'. !!! error TS2345: Types of property 'y' are incompatible. !!! error TS2345: Type 'Class' is not assignable to type 'D'. +!!! error TS2345: Property 'foo' is missing in type 'Class'. d3({}); ~~ !!! error TS2345: Argument of type '{}' is not assignable to parameter of type '{ y: D; }'. diff --git a/tests/baselines/reference/destructuringWithGenericParameter.symbols b/tests/baselines/reference/destructuringWithGenericParameter.symbols index 0c489cf1ef2..9a795cb5441 100644 --- a/tests/baselines/reference/destructuringWithGenericParameter.symbols +++ b/tests/baselines/reference/destructuringWithGenericParameter.symbols @@ -4,7 +4,7 @@ class GenericClass { >T : Symbol(T, Decl(destructuringWithGenericParameter.ts, 0, 19)) payload: T; ->payload : Symbol(payload, Decl(destructuringWithGenericParameter.ts, 0, 23)) +>payload : Symbol(GenericClass.payload, Decl(destructuringWithGenericParameter.ts, 0, 23)) >T : Symbol(T, Decl(destructuringWithGenericParameter.ts, 0, 19)) } diff --git a/tests/baselines/reference/destructuringWithLiteralInitializers.types b/tests/baselines/reference/destructuringWithLiteralInitializers.types index da1e4bfd6f3..9b970679f74 100644 --- a/tests/baselines/reference/destructuringWithLiteralInitializers.types +++ b/tests/baselines/reference/destructuringWithLiteralInitializers.types @@ -1,13 +1,13 @@ === tests/cases/conformance/es6/destructuring/destructuringWithLiteralInitializers.ts === // (arg: { x: any, y: any }) => void function f1({ x, y }) { } ->f1 : ({ x, y }: { x: any; y: any; }) => void +>f1 : ({x, y}: { x: any; y: any; }) => void >x : any >y : any f1({ x: 1, y: 1 }); >f1({ x: 1, y: 1 }) : void ->f1 : ({ x, y }: { x: any; y: any; }) => void +>f1 : ({x, y}: { x: any; y: any; }) => void >{ x: 1, y: 1 } : { x: number; y: number; } >x : number >1 : number @@ -16,21 +16,21 @@ f1({ x: 1, y: 1 }); // (arg: { x: any, y?: number }) => void function f2({ x, y = 0 }) { } ->f2 : ({ x, y = 0 }: { x: any; y?: number; }) => void +>f2 : ({x, y}: { x: any; y?: number; }) => void >x : any >y : number >0 : number f2({ x: 1 }); >f2({ x: 1 }) : void ->f2 : ({ x, y = 0 }: { x: any; y?: number; }) => void +>f2 : ({x, y}: { x: any; y?: number; }) => void >{ x: 1 } : { x: number; } >x : number >1 : number f2({ x: 1, y: 1 }); >f2({ x: 1, y: 1 }) : void ->f2 : ({ x, y = 0 }: { x: any; y?: number; }) => void +>f2 : ({x, y}: { x: any; y?: number; }) => void >{ x: 1, y: 1 } : { x: number; y: number; } >x : number >1 : number @@ -39,7 +39,7 @@ f2({ x: 1, y: 1 }); // (arg: { x?: number, y?: number }) => void function f3({ x = 0, y = 0 }) { } ->f3 : ({ x = 0, y = 0 }: { x?: number; y?: number; }) => void +>f3 : ({x, y}: { x?: number; y?: number; }) => void >x : number >0 : number >y : number @@ -47,26 +47,26 @@ function f3({ x = 0, y = 0 }) { } f3({}); >f3({}) : void ->f3 : ({ x = 0, y = 0 }: { x?: number; y?: number; }) => void +>f3 : ({x, y}: { x?: number; y?: number; }) => void >{} : {} f3({ x: 1 }); >f3({ x: 1 }) : void ->f3 : ({ x = 0, y = 0 }: { x?: number; y?: number; }) => void +>f3 : ({x, y}: { x?: number; y?: number; }) => void >{ x: 1 } : { x: number; } >x : number >1 : number f3({ y: 1 }); >f3({ y: 1 }) : void ->f3 : ({ x = 0, y = 0 }: { x?: number; y?: number; }) => void +>f3 : ({x, y}: { x?: number; y?: number; }) => void >{ y: 1 } : { y: number; } >y : number >1 : number f3({ x: 1, y: 1 }); >f3({ x: 1, y: 1 }) : void ->f3 : ({ x = 0, y = 0 }: { x?: number; y?: number; }) => void +>f3 : ({x, y}: { x?: number; y?: number; }) => void >{ x: 1, y: 1 } : { x: number; y: number; } >x : number >1 : number @@ -75,7 +75,7 @@ f3({ x: 1, y: 1 }); // (arg?: { x: number, y: number }) => void function f4({ x, y } = { x: 0, y: 0 }) { } ->f4 : ({ x, y }?: { x: number; y: number; }) => void +>f4 : ({x, y}?: { x: number; y: number; }) => void >x : number >y : number >{ x: 0, y: 0 } : { x: number; y: number; } @@ -86,11 +86,11 @@ function f4({ x, y } = { x: 0, y: 0 }) { } f4(); >f4() : void ->f4 : ({ x, y }?: { x: number; y: number; }) => void +>f4 : ({x, y}?: { x: number; y: number; }) => void f4({ x: 1, y: 1 }); >f4({ x: 1, y: 1 }) : void ->f4 : ({ x, y }?: { x: number; y: number; }) => void +>f4 : ({x, y}?: { x: number; y: number; }) => void >{ x: 1, y: 1 } : { x: number; y: number; } >x : number >1 : number @@ -99,7 +99,7 @@ f4({ x: 1, y: 1 }); // (arg?: { x: number, y?: number }) => void function f5({ x, y = 0 } = { x: 0 }) { } ->f5 : ({ x, y = 0 }?: { x: number; y?: number; }) => void +>f5 : ({x, y}?: { x: number; y?: number; }) => void >x : number >y : number >0 : number @@ -109,18 +109,18 @@ function f5({ x, y = 0 } = { x: 0 }) { } f5(); >f5() : void ->f5 : ({ x, y = 0 }?: { x: number; y?: number; }) => void +>f5 : ({x, y}?: { x: number; y?: number; }) => void f5({ x: 1 }); >f5({ x: 1 }) : void ->f5 : ({ x, y = 0 }?: { x: number; y?: number; }) => void +>f5 : ({x, y}?: { x: number; y?: number; }) => void >{ x: 1 } : { x: number; } >x : number >1 : number f5({ x: 1, y: 1 }); >f5({ x: 1, y: 1 }) : void ->f5 : ({ x, y = 0 }?: { x: number; y?: number; }) => void +>f5 : ({x, y}?: { x: number; y?: number; }) => void >{ x: 1, y: 1 } : { x: number; y: number; } >x : number >1 : number @@ -129,7 +129,7 @@ f5({ x: 1, y: 1 }); // (arg?: { x?: number, y?: number }) => void function f6({ x = 0, y = 0 } = {}) { } ->f6 : ({ x = 0, y = 0 }?: { x?: number; y?: number; }) => void +>f6 : ({x, y}?: { x?: number; y?: number; }) => void >x : number >0 : number >y : number @@ -138,30 +138,30 @@ function f6({ x = 0, y = 0 } = {}) { } f6(); >f6() : void ->f6 : ({ x = 0, y = 0 }?: { x?: number; y?: number; }) => void +>f6 : ({x, y}?: { x?: number; y?: number; }) => void f6({}); >f6({}) : void ->f6 : ({ x = 0, y = 0 }?: { x?: number; y?: number; }) => void +>f6 : ({x, y}?: { x?: number; y?: number; }) => void >{} : {} f6({ x: 1 }); >f6({ x: 1 }) : void ->f6 : ({ x = 0, y = 0 }?: { x?: number; y?: number; }) => void +>f6 : ({x, y}?: { x?: number; y?: number; }) => void >{ x: 1 } : { x: number; } >x : number >1 : number f6({ y: 1 }); >f6({ y: 1 }) : void ->f6 : ({ x = 0, y = 0 }?: { x?: number; y?: number; }) => void +>f6 : ({x, y}?: { x?: number; y?: number; }) => void >{ y: 1 } : { y: number; } >y : number >1 : number f6({ x: 1, y: 1 }); >f6({ x: 1, y: 1 }) : void ->f6 : ({ x = 0, y = 0 }?: { x?: number; y?: number; }) => void +>f6 : ({x, y}?: { x?: number; y?: number; }) => void >{ x: 1, y: 1 } : { x: number; y: number; } >x : number >1 : number @@ -170,7 +170,7 @@ f6({ x: 1, y: 1 }); // (arg?: { a: { x?: number, y?: number } }) => void function f7({ a: { x = 0, y = 0 } } = { a: {} }) { } ->f7 : ({ a: { x = 0, y = 0 } }?: { a: { x?: number; y?: number; }; }) => void +>f7 : ({a: {x, y}}?: { a: { x?: number; y?: number; }; }) => void >a : any >x : number >0 : number @@ -182,18 +182,18 @@ function f7({ a: { x = 0, y = 0 } } = { a: {} }) { } f7(); >f7() : void ->f7 : ({ a: { x = 0, y = 0 } }?: { a: { x?: number; y?: number; }; }) => void +>f7 : ({a: {x, y}}?: { a: { x?: number; y?: number; }; }) => void f7({ a: {} }); >f7({ a: {} }) : void ->f7 : ({ a: { x = 0, y = 0 } }?: { a: { x?: number; y?: number; }; }) => void +>f7 : ({a: {x, y}}?: { a: { x?: number; y?: number; }; }) => void >{ a: {} } : { a: {}; } >a : {} >{} : {} f7({ a: { x: 1 } }); >f7({ a: { x: 1 } }) : void ->f7 : ({ a: { x = 0, y = 0 } }?: { a: { x?: number; y?: number; }; }) => void +>f7 : ({a: {x, y}}?: { a: { x?: number; y?: number; }; }) => void >{ a: { x: 1 } } : { a: { x: number; }; } >a : { x: number; } >{ x: 1 } : { x: number; } @@ -202,7 +202,7 @@ f7({ a: { x: 1 } }); f7({ a: { y: 1 } }); >f7({ a: { y: 1 } }) : void ->f7 : ({ a: { x = 0, y = 0 } }?: { a: { x?: number; y?: number; }; }) => void +>f7 : ({a: {x, y}}?: { a: { x?: number; y?: number; }; }) => void >{ a: { y: 1 } } : { a: { y: number; }; } >a : { y: number; } >{ y: 1 } : { y: number; } @@ -211,7 +211,7 @@ f7({ a: { y: 1 } }); f7({ a: { x: 1, y: 1 } }); >f7({ a: { x: 1, y: 1 } }) : void ->f7 : ({ a: { x = 0, y = 0 } }?: { a: { x?: number; y?: number; }; }) => void +>f7 : ({a: {x, y}}?: { a: { x?: number; y?: number; }; }) => void >{ a: { x: 1, y: 1 } } : { a: { x: number; y: number; }; } >a : { x: number; y: number; } >{ x: 1, y: 1 } : { x: number; y: number; } @@ -235,7 +235,7 @@ g1([1, 1]); // (arg: [number, number]) => void function g2([x = 0, y = 0]) { } ->g2 : ([x = 0, y = 0]: [number, number]) => void +>g2 : ([x, y]: [number, number]) => void >x : number >0 : number >y : number @@ -243,7 +243,7 @@ function g2([x = 0, y = 0]) { } g2([1, 1]); >g2([1, 1]) : void ->g2 : ([x = 0, y = 0]: [number, number]) => void +>g2 : ([x, y]: [number, number]) => void >[1, 1] : [number, number] >1 : number >1 : number @@ -270,7 +270,7 @@ g3([1, 1]); // (arg?: [number, number]) => void function g4([x, y = 0] = [0]) { } ->g4 : ([x, y = 0]?: [number, number]) => void +>g4 : ([x, y]?: [number, number]) => void >x : number >y : number >0 : number @@ -279,18 +279,18 @@ function g4([x, y = 0] = [0]) { } g4(); >g4() : void ->g4 : ([x, y = 0]?: [number, number]) => void +>g4 : ([x, y]?: [number, number]) => void g4([1, 1]); >g4([1, 1]) : void ->g4 : ([x, y = 0]?: [number, number]) => void +>g4 : ([x, y]?: [number, number]) => void >[1, 1] : [number, number] >1 : number >1 : number // (arg?: [number, number]) => void function g5([x = 0, y = 0] = []) { } ->g5 : ([x = 0, y = 0]?: [number, number]) => void +>g5 : ([x, y]?: [number, number]) => void >x : number >0 : number >y : number @@ -299,11 +299,11 @@ function g5([x = 0, y = 0] = []) { } g5(); >g5() : void ->g5 : ([x = 0, y = 0]?: [number, number]) => void +>g5 : ([x, y]?: [number, number]) => void g5([1, 1]); >g5([1, 1]) : void ->g5 : ([x = 0, y = 0]?: [number, number]) => void +>g5 : ([x, y]?: [number, number]) => void >[1, 1] : [number, number] >1 : number >1 : number diff --git a/tests/baselines/reference/destructuringWithNewExpression.symbols b/tests/baselines/reference/destructuringWithNewExpression.symbols index c7dce468485..1f2bb93530f 100644 --- a/tests/baselines/reference/destructuringWithNewExpression.symbols +++ b/tests/baselines/reference/destructuringWithNewExpression.symbols @@ -3,7 +3,7 @@ class C { >C : Symbol(C, Decl(destructuringWithNewExpression.ts, 0, 0)) x = 0; ->x : Symbol(x, Decl(destructuringWithNewExpression.ts, 0, 9)) +>x : Symbol(C.x, Decl(destructuringWithNewExpression.ts, 0, 9)) } var { x } = new C; diff --git a/tests/baselines/reference/detachedCommentAtStartOfConstructor1.symbols b/tests/baselines/reference/detachedCommentAtStartOfConstructor1.symbols index 9590abaa460..d8531e9ff02 100644 --- a/tests/baselines/reference/detachedCommentAtStartOfConstructor1.symbols +++ b/tests/baselines/reference/detachedCommentAtStartOfConstructor1.symbols @@ -3,10 +3,10 @@ class TestFile { >TestFile : Symbol(TestFile, Decl(detachedCommentAtStartOfConstructor1.ts, 0, 0)) public message: string; ->message : Symbol(message, Decl(detachedCommentAtStartOfConstructor1.ts, 0, 16)) +>message : Symbol(TestFile.message, Decl(detachedCommentAtStartOfConstructor1.ts, 0, 16)) public name; ->name : Symbol(name, Decl(detachedCommentAtStartOfConstructor1.ts, 1, 27)) +>name : Symbol(TestFile.name, Decl(detachedCommentAtStartOfConstructor1.ts, 1, 27)) constructor(message: string) { >message : Symbol(message, Decl(detachedCommentAtStartOfConstructor1.ts, 3, 16)) @@ -16,14 +16,14 @@ class TestFile { var getMessage = () => message + this.name; >getMessage : Symbol(getMessage, Decl(detachedCommentAtStartOfConstructor1.ts, 6, 11)) >message : Symbol(message, Decl(detachedCommentAtStartOfConstructor1.ts, 3, 16)) ->this.name : Symbol(name, Decl(detachedCommentAtStartOfConstructor1.ts, 1, 27)) +>this.name : Symbol(TestFile.name, Decl(detachedCommentAtStartOfConstructor1.ts, 1, 27)) >this : Symbol(TestFile, Decl(detachedCommentAtStartOfConstructor1.ts, 0, 0)) ->name : Symbol(name, Decl(detachedCommentAtStartOfConstructor1.ts, 1, 27)) +>name : Symbol(TestFile.name, Decl(detachedCommentAtStartOfConstructor1.ts, 1, 27)) this.message = getMessage(); ->this.message : Symbol(message, Decl(detachedCommentAtStartOfConstructor1.ts, 0, 16)) +>this.message : Symbol(TestFile.message, Decl(detachedCommentAtStartOfConstructor1.ts, 0, 16)) >this : Symbol(TestFile, Decl(detachedCommentAtStartOfConstructor1.ts, 0, 0)) ->message : Symbol(message, Decl(detachedCommentAtStartOfConstructor1.ts, 0, 16)) +>message : Symbol(TestFile.message, Decl(detachedCommentAtStartOfConstructor1.ts, 0, 16)) >getMessage : Symbol(getMessage, Decl(detachedCommentAtStartOfConstructor1.ts, 6, 11)) } } diff --git a/tests/baselines/reference/detachedCommentAtStartOfConstructor2.symbols b/tests/baselines/reference/detachedCommentAtStartOfConstructor2.symbols index 78af9430034..a8af5379524 100644 --- a/tests/baselines/reference/detachedCommentAtStartOfConstructor2.symbols +++ b/tests/baselines/reference/detachedCommentAtStartOfConstructor2.symbols @@ -3,10 +3,10 @@ class TestFile { >TestFile : Symbol(TestFile, Decl(detachedCommentAtStartOfConstructor2.ts, 0, 0)) public message: string; ->message : Symbol(message, Decl(detachedCommentAtStartOfConstructor2.ts, 0, 16)) +>message : Symbol(TestFile.message, Decl(detachedCommentAtStartOfConstructor2.ts, 0, 16)) public name: string; ->name : Symbol(name, Decl(detachedCommentAtStartOfConstructor2.ts, 1, 27)) +>name : Symbol(TestFile.name, Decl(detachedCommentAtStartOfConstructor2.ts, 1, 27)) constructor(message: string) { >message : Symbol(message, Decl(detachedCommentAtStartOfConstructor2.ts, 3, 16)) @@ -17,14 +17,14 @@ class TestFile { var getMessage = () => message + this.name; >getMessage : Symbol(getMessage, Decl(detachedCommentAtStartOfConstructor2.ts, 7, 11)) >message : Symbol(message, Decl(detachedCommentAtStartOfConstructor2.ts, 3, 16)) ->this.name : Symbol(name, Decl(detachedCommentAtStartOfConstructor2.ts, 1, 27)) +>this.name : Symbol(TestFile.name, Decl(detachedCommentAtStartOfConstructor2.ts, 1, 27)) >this : Symbol(TestFile, Decl(detachedCommentAtStartOfConstructor2.ts, 0, 0)) ->name : Symbol(name, Decl(detachedCommentAtStartOfConstructor2.ts, 1, 27)) +>name : Symbol(TestFile.name, Decl(detachedCommentAtStartOfConstructor2.ts, 1, 27)) this.message = getMessage(); ->this.message : Symbol(message, Decl(detachedCommentAtStartOfConstructor2.ts, 0, 16)) +>this.message : Symbol(TestFile.message, Decl(detachedCommentAtStartOfConstructor2.ts, 0, 16)) >this : Symbol(TestFile, Decl(detachedCommentAtStartOfConstructor2.ts, 0, 0)) ->message : Symbol(message, Decl(detachedCommentAtStartOfConstructor2.ts, 0, 16)) +>message : Symbol(TestFile.message, Decl(detachedCommentAtStartOfConstructor2.ts, 0, 16)) >getMessage : Symbol(getMessage, Decl(detachedCommentAtStartOfConstructor2.ts, 7, 11)) } } diff --git a/tests/baselines/reference/detachedCommentAtStartOfLambdaFunction1.symbols b/tests/baselines/reference/detachedCommentAtStartOfLambdaFunction1.symbols index aa34885d79b..8eb7fc137b1 100644 --- a/tests/baselines/reference/detachedCommentAtStartOfLambdaFunction1.symbols +++ b/tests/baselines/reference/detachedCommentAtStartOfLambdaFunction1.symbols @@ -3,10 +3,10 @@ class TestFile { >TestFile : Symbol(TestFile, Decl(detachedCommentAtStartOfLambdaFunction1.ts, 0, 0)) name: string; ->name : Symbol(name, Decl(detachedCommentAtStartOfLambdaFunction1.ts, 0, 16)) +>name : Symbol(TestFile.name, Decl(detachedCommentAtStartOfLambdaFunction1.ts, 0, 16)) foo(message: string): () => string { ->foo : Symbol(foo, Decl(detachedCommentAtStartOfLambdaFunction1.ts, 1, 17)) +>foo : Symbol(TestFile.foo, Decl(detachedCommentAtStartOfLambdaFunction1.ts, 1, 17)) >message : Symbol(message, Decl(detachedCommentAtStartOfLambdaFunction1.ts, 2, 8)) return (...x: string[]) => @@ -17,8 +17,8 @@ class TestFile { /// message + this.name; >message : Symbol(message, Decl(detachedCommentAtStartOfLambdaFunction1.ts, 2, 8)) ->this.name : Symbol(name, Decl(detachedCommentAtStartOfLambdaFunction1.ts, 0, 16)) +>this.name : Symbol(TestFile.name, Decl(detachedCommentAtStartOfLambdaFunction1.ts, 0, 16)) >this : Symbol(TestFile, Decl(detachedCommentAtStartOfLambdaFunction1.ts, 0, 0)) ->name : Symbol(name, Decl(detachedCommentAtStartOfLambdaFunction1.ts, 0, 16)) +>name : Symbol(TestFile.name, Decl(detachedCommentAtStartOfLambdaFunction1.ts, 0, 16)) } } diff --git a/tests/baselines/reference/detachedCommentAtStartOfLambdaFunction2.symbols b/tests/baselines/reference/detachedCommentAtStartOfLambdaFunction2.symbols index 29cef430c3a..72178fd3059 100644 --- a/tests/baselines/reference/detachedCommentAtStartOfLambdaFunction2.symbols +++ b/tests/baselines/reference/detachedCommentAtStartOfLambdaFunction2.symbols @@ -3,10 +3,10 @@ class TestFile { >TestFile : Symbol(TestFile, Decl(detachedCommentAtStartOfLambdaFunction2.ts, 0, 0)) name: string; ->name : Symbol(name, Decl(detachedCommentAtStartOfLambdaFunction2.ts, 0, 16)) +>name : Symbol(TestFile.name, Decl(detachedCommentAtStartOfLambdaFunction2.ts, 0, 16)) foo(message: string): () => string { ->foo : Symbol(foo, Decl(detachedCommentAtStartOfLambdaFunction2.ts, 1, 17)) +>foo : Symbol(TestFile.foo, Decl(detachedCommentAtStartOfLambdaFunction2.ts, 1, 17)) >message : Symbol(message, Decl(detachedCommentAtStartOfLambdaFunction2.ts, 2, 8)) return (...x: string[]) => @@ -18,8 +18,8 @@ class TestFile { message + this.name; >message : Symbol(message, Decl(detachedCommentAtStartOfLambdaFunction2.ts, 2, 8)) ->this.name : Symbol(name, Decl(detachedCommentAtStartOfLambdaFunction2.ts, 0, 16)) +>this.name : Symbol(TestFile.name, Decl(detachedCommentAtStartOfLambdaFunction2.ts, 0, 16)) >this : Symbol(TestFile, Decl(detachedCommentAtStartOfLambdaFunction2.ts, 0, 0)) ->name : Symbol(name, Decl(detachedCommentAtStartOfLambdaFunction2.ts, 0, 16)) +>name : Symbol(TestFile.name, Decl(detachedCommentAtStartOfLambdaFunction2.ts, 0, 16)) } } diff --git a/tests/baselines/reference/doNotEmitPinnedCommentOnNotEmittedNode.symbols b/tests/baselines/reference/doNotEmitPinnedCommentOnNotEmittedNode.symbols index c733d886ff3..bd6f35e406f 100644 --- a/tests/baselines/reference/doNotEmitPinnedCommentOnNotEmittedNode.symbols +++ b/tests/baselines/reference/doNotEmitPinnedCommentOnNotEmittedNode.symbols @@ -5,12 +5,12 @@ class C { /*! remove pinned comment anywhere else */ public foo(x: string, y: any) ->foo : Symbol(foo, Decl(file1.ts, 1, 9), Decl(file1.ts, 3, 33)) +>foo : Symbol(C.foo, Decl(file1.ts, 1, 9), Decl(file1.ts, 3, 33)) >x : Symbol(x, Decl(file1.ts, 3, 15)) >y : Symbol(y, Decl(file1.ts, 3, 25)) public foo(x: string, y: number) { } ->foo : Symbol(foo, Decl(file1.ts, 1, 9), Decl(file1.ts, 3, 33)) +>foo : Symbol(C.foo, Decl(file1.ts, 1, 9), Decl(file1.ts, 3, 33)) >x : Symbol(x, Decl(file1.ts, 4, 15)) >y : Symbol(y, Decl(file1.ts, 4, 25)) } diff --git a/tests/baselines/reference/doNotEmitPinnedCommentOnNotEmittedNodets.symbols b/tests/baselines/reference/doNotEmitPinnedCommentOnNotEmittedNodets.symbols index dcd27478115..7b96fc028b1 100644 --- a/tests/baselines/reference/doNotEmitPinnedCommentOnNotEmittedNodets.symbols +++ b/tests/baselines/reference/doNotEmitPinnedCommentOnNotEmittedNodets.symbols @@ -5,12 +5,12 @@ class C { /*! remove pinned comment anywhere else */ public foo(x: string, y: any) ->foo : Symbol(foo, Decl(doNotEmitPinnedCommentOnNotEmittedNodets.ts, 1, 9), Decl(doNotEmitPinnedCommentOnNotEmittedNodets.ts, 3, 33)) +>foo : Symbol(C.foo, Decl(doNotEmitPinnedCommentOnNotEmittedNodets.ts, 1, 9), Decl(doNotEmitPinnedCommentOnNotEmittedNodets.ts, 3, 33)) >x : Symbol(x, Decl(doNotEmitPinnedCommentOnNotEmittedNodets.ts, 3, 15)) >y : Symbol(y, Decl(doNotEmitPinnedCommentOnNotEmittedNodets.ts, 3, 25)) public foo(x: string, y: number) { } ->foo : Symbol(foo, Decl(doNotEmitPinnedCommentOnNotEmittedNodets.ts, 1, 9), Decl(doNotEmitPinnedCommentOnNotEmittedNodets.ts, 3, 33)) +>foo : Symbol(C.foo, Decl(doNotEmitPinnedCommentOnNotEmittedNodets.ts, 1, 9), Decl(doNotEmitPinnedCommentOnNotEmittedNodets.ts, 3, 33)) >x : Symbol(x, Decl(doNotEmitPinnedCommentOnNotEmittedNodets.ts, 4, 15)) >y : Symbol(y, Decl(doNotEmitPinnedCommentOnNotEmittedNodets.ts, 4, 25)) } diff --git a/tests/baselines/reference/doNotWidenAtObjectLiteralPropertyAssignment.symbols b/tests/baselines/reference/doNotWidenAtObjectLiteralPropertyAssignment.symbols index 7aaf3b98f4a..7a1073d6ebf 100644 --- a/tests/baselines/reference/doNotWidenAtObjectLiteralPropertyAssignment.symbols +++ b/tests/baselines/reference/doNotWidenAtObjectLiteralPropertyAssignment.symbols @@ -3,18 +3,18 @@ interface ITestEventInterval { >ITestEventInterval : Symbol(ITestEventInterval, Decl(doNotWidenAtObjectLiteralPropertyAssignment.ts, 0, 0)) begin: number; ->begin : Symbol(begin, Decl(doNotWidenAtObjectLiteralPropertyAssignment.ts, 0, 30)) +>begin : Symbol(ITestEventInterval.begin, Decl(doNotWidenAtObjectLiteralPropertyAssignment.ts, 0, 30)) } interface IIntervalTreeNode { >IIntervalTreeNode : Symbol(IIntervalTreeNode, Decl(doNotWidenAtObjectLiteralPropertyAssignment.ts, 2, 1)) interval: ITestEventInterval; ->interval : Symbol(interval, Decl(doNotWidenAtObjectLiteralPropertyAssignment.ts, 4, 29)) +>interval : Symbol(IIntervalTreeNode.interval, Decl(doNotWidenAtObjectLiteralPropertyAssignment.ts, 4, 29)) >ITestEventInterval : Symbol(ITestEventInterval, Decl(doNotWidenAtObjectLiteralPropertyAssignment.ts, 0, 0)) children?: IIntervalTreeNode[]; ->children : Symbol(children, Decl(doNotWidenAtObjectLiteralPropertyAssignment.ts, 5, 33)) +>children : Symbol(IIntervalTreeNode.children, Decl(doNotWidenAtObjectLiteralPropertyAssignment.ts, 5, 33)) >IIntervalTreeNode : Symbol(IIntervalTreeNode, Decl(doNotWidenAtObjectLiteralPropertyAssignment.ts, 2, 1)) } diff --git a/tests/baselines/reference/dontShowCompilerGeneratedMembers.errors.txt b/tests/baselines/reference/dontShowCompilerGeneratedMembers.errors.txt index c13a6b5fe2a..d53571cc4a8 100644 --- a/tests/baselines/reference/dontShowCompilerGeneratedMembers.errors.txt +++ b/tests/baselines/reference/dontShowCompilerGeneratedMembers.errors.txt @@ -1,5 +1,4 @@ tests/cases/compiler/dontShowCompilerGeneratedMembers.ts(1,5): error TS2322: Type 'number' is not assignable to type '{ (): any; x: number; }'. - Property 'x' is missing in type 'Number'. tests/cases/compiler/dontShowCompilerGeneratedMembers.ts(3,6): error TS1139: Type parameter declaration expected. tests/cases/compiler/dontShowCompilerGeneratedMembers.ts(4,1): error TS1109: Expression expected. @@ -8,7 +7,6 @@ tests/cases/compiler/dontShowCompilerGeneratedMembers.ts(4,1): error TS1109: Exp var f: { ~ !!! error TS2322: Type 'number' is not assignable to type '{ (): any; x: number; }'. -!!! error TS2322: Property 'x' is missing in type 'Number'. x: number; <- ~ diff --git a/tests/baselines/reference/dottedNamesInSystem.js b/tests/baselines/reference/dottedNamesInSystem.js new file mode 100644 index 00000000000..4f1814f393d --- /dev/null +++ b/tests/baselines/reference/dottedNamesInSystem.js @@ -0,0 +1,35 @@ +//// [dottedNamesInSystem.ts] +export namespace A.B.C { + export function foo() {} +} + +export function bar() { + return A.B.C.foo(); +} + +//// [dottedNamesInSystem.js] +System.register([], function(exports_1, context_1) { + "use strict"; + var __moduleName = context_1 && context_1.id; + var A; + function bar() { + return A.B.C.foo(); + } + exports_1("bar", bar); + return { + setters:[], + execute: function() { + (function (A) { + var B; + (function (B) { + var C; + (function (C) { + function foo() { } + C.foo = foo; + })(C = B.C || (B.C = {})); + })(B = A.B || (A.B = {})); + })(A = A || (A = {})); + exports_1("A", A); + } + } +}); diff --git a/tests/baselines/reference/dottedNamesInSystem.symbols b/tests/baselines/reference/dottedNamesInSystem.symbols new file mode 100644 index 00000000000..bfbc57ed1ba --- /dev/null +++ b/tests/baselines/reference/dottedNamesInSystem.symbols @@ -0,0 +1,22 @@ +=== tests/cases/compiler/dottedNamesInSystem.ts === +export namespace A.B.C { +>A : Symbol(A, Decl(dottedNamesInSystem.ts, 0, 0)) +>B : Symbol(B, Decl(dottedNamesInSystem.ts, 0, 19)) +>C : Symbol(C, Decl(dottedNamesInSystem.ts, 0, 21)) + + export function foo() {} +>foo : Symbol(foo, Decl(dottedNamesInSystem.ts, 0, 24)) +} + +export function bar() { +>bar : Symbol(bar, Decl(dottedNamesInSystem.ts, 2, 1)) + + return A.B.C.foo(); +>A.B.C.foo : Symbol(A.B.C.foo, Decl(dottedNamesInSystem.ts, 0, 24)) +>A.B.C : Symbol(A.B.C, Decl(dottedNamesInSystem.ts, 0, 21)) +>A.B : Symbol(A.B, Decl(dottedNamesInSystem.ts, 0, 19)) +>A : Symbol(A, Decl(dottedNamesInSystem.ts, 0, 0)) +>B : Symbol(A.B, Decl(dottedNamesInSystem.ts, 0, 19)) +>C : Symbol(A.B.C, Decl(dottedNamesInSystem.ts, 0, 21)) +>foo : Symbol(A.B.C.foo, Decl(dottedNamesInSystem.ts, 0, 24)) +} diff --git a/tests/baselines/reference/dottedNamesInSystem.types b/tests/baselines/reference/dottedNamesInSystem.types new file mode 100644 index 00000000000..78de0e33883 --- /dev/null +++ b/tests/baselines/reference/dottedNamesInSystem.types @@ -0,0 +1,23 @@ +=== tests/cases/compiler/dottedNamesInSystem.ts === +export namespace A.B.C { +>A : typeof A +>B : typeof B +>C : typeof C + + export function foo() {} +>foo : () => void +} + +export function bar() { +>bar : () => void + + return A.B.C.foo(); +>A.B.C.foo() : void +>A.B.C.foo : () => void +>A.B.C : typeof A.B.C +>A.B : typeof A.B +>A : typeof A +>B : typeof A.B +>C : typeof A.B.C +>foo : () => void +} diff --git a/tests/baselines/reference/dottedSymbolResolution1.symbols b/tests/baselines/reference/dottedSymbolResolution1.symbols index 25ff8a6fe92..e5e866fe0c9 100644 --- a/tests/baselines/reference/dottedSymbolResolution1.symbols +++ b/tests/baselines/reference/dottedSymbolResolution1.symbols @@ -3,7 +3,7 @@ interface JQuery { >JQuery : Symbol(JQuery, Decl(dottedSymbolResolution1.ts, 0, 0)) find(selector: string): JQuery; ->find : Symbol(find, Decl(dottedSymbolResolution1.ts, 0, 18)) +>find : Symbol(JQuery.find, Decl(dottedSymbolResolution1.ts, 0, 18)) >selector : Symbol(selector, Decl(dottedSymbolResolution1.ts, 1, 9)) >JQuery : Symbol(JQuery, Decl(dottedSymbolResolution1.ts, 0, 0)) } @@ -23,7 +23,7 @@ interface JQueryStatic { class Base { foo() { } } >Base : Symbol(Base, Decl(dottedSymbolResolution1.ts, 8, 1)) ->foo : Symbol(foo, Decl(dottedSymbolResolution1.ts, 10, 12)) +>foo : Symbol(Base.foo, Decl(dottedSymbolResolution1.ts, 10, 12)) function each(collection: string, callback: (indexInArray: any, valueOfElement: any) => any): any; >each : Symbol(each, Decl(dottedSymbolResolution1.ts, 10, 24), Decl(dottedSymbolResolution1.ts, 12, 98), Decl(dottedSymbolResolution1.ts, 13, 102)) diff --git a/tests/baselines/reference/doubleUnderStringLiteralAssignability.errors.txt b/tests/baselines/reference/doubleUnderStringLiteralAssignability.errors.txt new file mode 100644 index 00000000000..c4226a83bfc --- /dev/null +++ b/tests/baselines/reference/doubleUnderStringLiteralAssignability.errors.txt @@ -0,0 +1,11 @@ +tests/cases/compiler/doubleUnderStringLiteralAssignability.ts(2,5): error TS2322: Type '"no_dunder"' is not assignable to type '"__dunder"'. + + +==== tests/cases/compiler/doubleUnderStringLiteralAssignability.ts (1 errors) ==== + var shouldBeOk: '__dunder' = '__dunder'; + var bad: '__dunder' = 'no_dunder'; + ~~~ +!!! error TS2322: Type '"no_dunder"' is not assignable to type '"__dunder"'. + var okok: '___thunder' = '___thunder'; + var alsoOk: '_sunder' = '_sunder'; + \ No newline at end of file diff --git a/tests/baselines/reference/doubleUnderStringLiteralAssignability.js b/tests/baselines/reference/doubleUnderStringLiteralAssignability.js new file mode 100644 index 00000000000..baf2b521948 --- /dev/null +++ b/tests/baselines/reference/doubleUnderStringLiteralAssignability.js @@ -0,0 +1,12 @@ +//// [doubleUnderStringLiteralAssignability.ts] +var shouldBeOk: '__dunder' = '__dunder'; +var bad: '__dunder' = 'no_dunder'; +var okok: '___thunder' = '___thunder'; +var alsoOk: '_sunder' = '_sunder'; + + +//// [doubleUnderStringLiteralAssignability.js] +var shouldBeOk = '__dunder'; +var bad = 'no_dunder'; +var okok = '___thunder'; +var alsoOk = '_sunder'; diff --git a/tests/baselines/reference/downlevelLetConst16.js b/tests/baselines/reference/downlevelLetConst16.js index 4b9d4c438fc..edc778209be 100644 --- a/tests/baselines/reference/downlevelLetConst16.js +++ b/tests/baselines/reference/downlevelLetConst16.js @@ -367,7 +367,7 @@ var M4; use(z); })(M4 || (M4 = {})); function foo3() { - for (var x_7 = void 0;;) { + for (var x_7;;) { use(x_7); } for (var y_7 = [][0];;) { diff --git a/tests/baselines/reference/downlevelLetConst17.js b/tests/baselines/reference/downlevelLetConst17.js index 56ab1e6df54..49212b267f0 100644 --- a/tests/baselines/reference/downlevelLetConst17.js +++ b/tests/baselines/reference/downlevelLetConst17.js @@ -86,7 +86,7 @@ for (;;) { var x_4 = 10; use(x_4); } -for (var x_5 = void 0;;) { +for (var x_5;;) { use(x_5); x_5 = 1; } diff --git a/tests/baselines/reference/downlevelLetConst17.types b/tests/baselines/reference/downlevelLetConst17.types index 824abcc76be..4f539835ada 100644 --- a/tests/baselines/reference/downlevelLetConst17.types +++ b/tests/baselines/reference/downlevelLetConst17.types @@ -139,23 +139,23 @@ do { >true : boolean for (let x in []) { ->x : any +>x : string >[] : undefined[] use(x); >use(x) : any >use : (a: any) => any ->x : any +>x : string } for (const x in []) { ->x : any +>x : string >[] : undefined[] use(x); >use(x) : any >use : (a: any) => any ->x : any +>x : string } for (const x of []) { diff --git a/tests/baselines/reference/downlevelLetConst18.errors.txt b/tests/baselines/reference/downlevelLetConst18.errors.txt new file mode 100644 index 00000000000..5b91498f173 --- /dev/null +++ b/tests/baselines/reference/downlevelLetConst18.errors.txt @@ -0,0 +1,40 @@ +tests/cases/compiler/downlevelLetConst18.ts(5,14): error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. +tests/cases/compiler/downlevelLetConst18.ts(9,14): error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. + + +==== tests/cases/compiler/downlevelLetConst18.ts (2 errors) ==== + + 'use strict' + + for (let x; ;) { + function foo() { x }; + ~~~ +!!! error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. + } + + for (let x; ;) { + function foo1() { x }; + ~~~~ +!!! error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. + } + + for (let x; ;) { + (() => { x })(); + } + + for (const x = 1; ;) { + (() => { x })(); + } + + for (let x; ;) { + ({ foo() { x }}) + } + + for (let x; ;) { + ({ get foo() { return x } }) + } + + for (let x; ;) { + ({ set foo(v) { x } }) + } + \ No newline at end of file diff --git a/tests/baselines/reference/downlevelLetConst18.symbols b/tests/baselines/reference/downlevelLetConst18.symbols deleted file mode 100644 index a1df0dc6ae9..00000000000 --- a/tests/baselines/reference/downlevelLetConst18.symbols +++ /dev/null @@ -1,59 +0,0 @@ -=== tests/cases/compiler/downlevelLetConst18.ts === - -'use strict' - -for (let x; ;) { ->x : Symbol(x, Decl(downlevelLetConst18.ts, 3, 8)) - - function foo() { x }; ->foo : Symbol(foo, Decl(downlevelLetConst18.ts, 3, 16)) ->x : Symbol(x, Decl(downlevelLetConst18.ts, 3, 8)) -} - -for (let x; ;) { ->x : Symbol(x, Decl(downlevelLetConst18.ts, 7, 8)) - - function foo1() { x }; ->foo1 : Symbol(foo1, Decl(downlevelLetConst18.ts, 7, 16)) ->x : Symbol(x, Decl(downlevelLetConst18.ts, 7, 8)) -} - -for (let x; ;) { ->x : Symbol(x, Decl(downlevelLetConst18.ts, 11, 8)) - - (() => { x })(); ->x : Symbol(x, Decl(downlevelLetConst18.ts, 11, 8)) -} - -for (const x = 1; ;) { ->x : Symbol(x, Decl(downlevelLetConst18.ts, 15, 10)) - - (() => { x })(); ->x : Symbol(x, Decl(downlevelLetConst18.ts, 15, 10)) -} - -for (let x; ;) { ->x : Symbol(x, Decl(downlevelLetConst18.ts, 19, 8)) - - ({ foo() { x }}) ->foo : Symbol(foo, Decl(downlevelLetConst18.ts, 20, 6)) ->x : Symbol(x, Decl(downlevelLetConst18.ts, 19, 8)) -} - -for (let x; ;) { ->x : Symbol(x, Decl(downlevelLetConst18.ts, 23, 8)) - - ({ get foo() { return x } }) ->foo : Symbol(foo, Decl(downlevelLetConst18.ts, 24, 6)) ->x : Symbol(x, Decl(downlevelLetConst18.ts, 23, 8)) -} - -for (let x; ;) { ->x : Symbol(x, Decl(downlevelLetConst18.ts, 27, 8)) - - ({ set foo(v) { x } }) ->foo : Symbol(foo, Decl(downlevelLetConst18.ts, 28, 6)) ->v : Symbol(v, Decl(downlevelLetConst18.ts, 28, 15)) ->x : Symbol(x, Decl(downlevelLetConst18.ts, 27, 8)) -} - diff --git a/tests/baselines/reference/downlevelLetConst18.types b/tests/baselines/reference/downlevelLetConst18.types deleted file mode 100644 index 42421aa80c0..00000000000 --- a/tests/baselines/reference/downlevelLetConst18.types +++ /dev/null @@ -1,73 +0,0 @@ -=== tests/cases/compiler/downlevelLetConst18.ts === - -'use strict' ->'use strict' : string - -for (let x; ;) { ->x : any - - function foo() { x }; ->foo : () => void ->x : any -} - -for (let x; ;) { ->x : any - - function foo1() { x }; ->foo1 : () => void ->x : any -} - -for (let x; ;) { ->x : any - - (() => { x })(); ->(() => { x })() : void ->(() => { x }) : () => void ->() => { x } : () => void ->x : any -} - -for (const x = 1; ;) { ->x : number ->1 : number - - (() => { x })(); ->(() => { x })() : void ->(() => { x }) : () => void ->() => { x } : () => void ->x : number -} - -for (let x; ;) { ->x : any - - ({ foo() { x }}) ->({ foo() { x }}) : { foo(): void; } ->{ foo() { x }} : { foo(): void; } ->foo : () => void ->x : any -} - -for (let x; ;) { ->x : any - - ({ get foo() { return x } }) ->({ get foo() { return x } }) : { foo: any; } ->{ get foo() { return x } } : { foo: any; } ->foo : any ->x : any -} - -for (let x; ;) { ->x : any - - ({ set foo(v) { x } }) ->({ set foo(v) { x } }) : { foo: any; } ->{ set foo(v) { x } } : { foo: any; } ->foo : any ->v : any ->x : any -} - diff --git a/tests/baselines/reference/downlevelLetConst19.errors.txt b/tests/baselines/reference/downlevelLetConst19.errors.txt new file mode 100644 index 00000000000..ef8583347bd --- /dev/null +++ b/tests/baselines/reference/downlevelLetConst19.errors.txt @@ -0,0 +1,25 @@ +tests/cases/compiler/downlevelLetConst19.ts(9,14): error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. + + +==== tests/cases/compiler/downlevelLetConst19.ts (1 errors) ==== + 'use strict' + declare function use(a: any); + var x; + function a() { + { + let x; + use(x); + + function b() { + ~ +!!! error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. + { + let x; + use(x); + } + use(x); + } + } + use(x) + } + use(x) \ No newline at end of file diff --git a/tests/baselines/reference/downlevelLetConst19.symbols b/tests/baselines/reference/downlevelLetConst19.symbols deleted file mode 100644 index 9ed23e43447..00000000000 --- a/tests/baselines/reference/downlevelLetConst19.symbols +++ /dev/null @@ -1,42 +0,0 @@ -=== tests/cases/compiler/downlevelLetConst19.ts === -'use strict' -declare function use(a: any); ->use : Symbol(use, Decl(downlevelLetConst19.ts, 0, 12)) ->a : Symbol(a, Decl(downlevelLetConst19.ts, 1, 21)) - -var x; ->x : Symbol(x, Decl(downlevelLetConst19.ts, 2, 3)) - -function a() { ->a : Symbol(a, Decl(downlevelLetConst19.ts, 2, 6)) - { - let x; ->x : Symbol(x, Decl(downlevelLetConst19.ts, 5, 7)) - - use(x); ->use : Symbol(use, Decl(downlevelLetConst19.ts, 0, 12)) ->x : Symbol(x, Decl(downlevelLetConst19.ts, 5, 7)) - - function b() { ->b : Symbol(b, Decl(downlevelLetConst19.ts, 6, 11)) - { - let x; ->x : Symbol(x, Decl(downlevelLetConst19.ts, 10, 15)) - - use(x); ->use : Symbol(use, Decl(downlevelLetConst19.ts, 0, 12)) ->x : Symbol(x, Decl(downlevelLetConst19.ts, 10, 15)) - } - use(x); ->use : Symbol(use, Decl(downlevelLetConst19.ts, 0, 12)) ->x : Symbol(x, Decl(downlevelLetConst19.ts, 5, 7)) - } - } - use(x) ->use : Symbol(use, Decl(downlevelLetConst19.ts, 0, 12)) ->x : Symbol(x, Decl(downlevelLetConst19.ts, 2, 3)) -} -use(x) ->use : Symbol(use, Decl(downlevelLetConst19.ts, 0, 12)) ->x : Symbol(x, Decl(downlevelLetConst19.ts, 2, 3)) - diff --git a/tests/baselines/reference/downlevelLetConst19.types b/tests/baselines/reference/downlevelLetConst19.types deleted file mode 100644 index 687033c195a..00000000000 --- a/tests/baselines/reference/downlevelLetConst19.types +++ /dev/null @@ -1,49 +0,0 @@ -=== tests/cases/compiler/downlevelLetConst19.ts === -'use strict' ->'use strict' : string - -declare function use(a: any); ->use : (a: any) => any ->a : any - -var x; ->x : any - -function a() { ->a : () => void - { - let x; ->x : any - - use(x); ->use(x) : any ->use : (a: any) => any ->x : any - - function b() { ->b : () => void - { - let x; ->x : any - - use(x); ->use(x) : any ->use : (a: any) => any ->x : any - } - use(x); ->use(x) : any ->use : (a: any) => any ->x : any - } - } - use(x) ->use(x) : any ->use : (a: any) => any ->x : any -} -use(x) ->use(x) : any ->use : (a: any) => any ->x : any - diff --git a/tests/baselines/reference/duplicateExportAssignments.errors.txt b/tests/baselines/reference/duplicateExportAssignments.errors.txt index a76513133b9..17ad0a39847 100644 --- a/tests/baselines/reference/duplicateExportAssignments.errors.txt +++ b/tests/baselines/reference/duplicateExportAssignments.errors.txt @@ -1,4 +1,3 @@ -tests/cases/conformance/externalModules/foo1.ts(3,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/conformance/externalModules/foo1.ts(3,1): error TS2300: Duplicate identifier 'export='. tests/cases/conformance/externalModules/foo1.ts(4,1): error TS2300: Duplicate identifier 'export='. tests/cases/conformance/externalModules/foo2.ts(3,1): error TS2300: Duplicate identifier 'export='. @@ -12,13 +11,11 @@ tests/cases/conformance/externalModules/foo5.ts(5,1): error TS2300: Duplicate id tests/cases/conformance/externalModules/foo5.ts(6,1): error TS2300: Duplicate identifier 'export='. -==== tests/cases/conformance/externalModules/foo1.ts (3 errors) ==== +==== tests/cases/conformance/externalModules/foo1.ts (2 errors) ==== var x = 10; var y = 20; export = x; ~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. - ~~~~~~~~~~~ !!! error TS2300: Duplicate identifier 'export='. export = y; ~~~~~~~~~~~ diff --git a/tests/baselines/reference/duplicateLabel3.types b/tests/baselines/reference/duplicateLabel3.types index 920a077aa9e..bcbe11beee3 100644 --- a/tests/baselines/reference/duplicateLabel3.types +++ b/tests/baselines/reference/duplicateLabel3.types @@ -7,7 +7,7 @@ while (true) { >true : boolean function f() { ->f : () => void +>f : () => never target: >target : any diff --git a/tests/baselines/reference/duplicateLocalVariable1.errors.txt b/tests/baselines/reference/duplicateLocalVariable1.errors.txt index 0a49c71e29b..b264574ea09 100644 --- a/tests/baselines/reference/duplicateLocalVariable1.errors.txt +++ b/tests/baselines/reference/duplicateLocalVariable1.errors.txt @@ -1,11 +1,12 @@ tests/cases/compiler/duplicateLocalVariable1.ts(2,4): error TS1005: ';' expected. tests/cases/compiler/duplicateLocalVariable1.ts(2,11): error TS1146: Declaration expected. tests/cases/compiler/duplicateLocalVariable1.ts(2,13): error TS2304: Cannot find name 'commonjs'. -tests/cases/compiler/duplicateLocalVariable1.ts(12,14): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. -tests/cases/compiler/duplicateLocalVariable1.ts(187,22): error TS2403: Subsequent variable declarations must have the same type. Variable 'i' must be of type 'any', but here has type 'number'. +tests/cases/compiler/duplicateLocalVariable1.ts(187,22): error TS2403: Subsequent variable declarations must have the same type. Variable 'i' must be of type 'string', but here has type 'number'. +tests/cases/compiler/duplicateLocalVariable1.ts(187,29): error TS2365: Operator '<' cannot be applied to types 'string' and 'number'. +tests/cases/compiler/duplicateLocalVariable1.ts(187,37): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. -==== tests/cases/compiler/duplicateLocalVariable1.ts (5 errors) ==== +==== tests/cases/compiler/duplicateLocalVariable1.ts (6 errors) ==== / /@module: commonjs ~ @@ -24,8 +25,6 @@ tests/cases/compiler/duplicateLocalVariable1.ts(187,22): error TS2403: Subsequen var TestFileDir = ".\\TempTestFiles"; export class TestCase { - ~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. constructor (public name: string, public test: ()=>boolean, public errorMessageRegEx?: string) { } } @@ -202,7 +201,11 @@ tests/cases/compiler/duplicateLocalVariable1.ts(187,22): error TS2403: Subsequen var bytes = []; for (var i = 0; i < 14; i++) { ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'i' must be of type 'any', but here has type 'number'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'i' must be of type 'string', but here has type 'number'. + ~~~~~~ +!!! error TS2365: Operator '<' cannot be applied to types 'string' and 'number'. + ~ +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. bytes.push(fb.readByte()); } var expected = [0xEF, 0xBB, 0xBF, 0x54, 0xC3, 0xA8, 0xE1, 0xB4, 0xA3, 0xE2, 0x80, 0xA0, 0x0D, 0x0A]; diff --git a/tests/baselines/reference/duplicateLocalVariable2.errors.txt b/tests/baselines/reference/duplicateLocalVariable2.errors.txt index 0fbe0018bf8..5e89cc422cc 100644 --- a/tests/baselines/reference/duplicateLocalVariable2.errors.txt +++ b/tests/baselines/reference/duplicateLocalVariable2.errors.txt @@ -1,7 +1,9 @@ -tests/cases/compiler/duplicateLocalVariable2.ts(27,22): error TS2403: Subsequent variable declarations must have the same type. Variable 'i' must be of type 'any', but here has type 'number'. +tests/cases/compiler/duplicateLocalVariable2.ts(27,22): error TS2403: Subsequent variable declarations must have the same type. Variable 'i' must be of type 'string', but here has type 'number'. +tests/cases/compiler/duplicateLocalVariable2.ts(27,29): error TS2365: Operator '<' cannot be applied to types 'string' and 'number'. +tests/cases/compiler/duplicateLocalVariable2.ts(27,37): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. -==== tests/cases/compiler/duplicateLocalVariable2.ts (1 errors) ==== +==== tests/cases/compiler/duplicateLocalVariable2.ts (3 errors) ==== export class TestCase { constructor (public name: string, public test: ()=>boolean, public errorMessageRegEx?: string) { } @@ -30,7 +32,11 @@ tests/cases/compiler/duplicateLocalVariable2.ts(27,22): error TS2403: Subsequent var bytes = []; for (var i = 0; i < 14; i++) { ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'i' must be of type 'any', but here has type 'number'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'i' must be of type 'string', but here has type 'number'. + ~~~~~~ +!!! error TS2365: Operator '<' cannot be applied to types 'string' and 'number'. + ~ +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. bytes.push(fb.readByte()); } var expected = [0xEF]; diff --git a/tests/baselines/reference/duplicateOverloadInTypeAugmentation1.symbols b/tests/baselines/reference/duplicateOverloadInTypeAugmentation1.symbols index a1c083fbc15..02589e011c4 100644 --- a/tests/baselines/reference/duplicateOverloadInTypeAugmentation1.symbols +++ b/tests/baselines/reference/duplicateOverloadInTypeAugmentation1.symbols @@ -4,7 +4,7 @@ interface Array { >T : Symbol(T, Decl(lib.d.ts, --, --), Decl(duplicateOverloadInTypeAugmentation1.ts, 0, 16)) reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, ->reduce : Symbol(reduce, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(duplicateOverloadInTypeAugmentation1.ts, 0, 20), Decl(duplicateOverloadInTypeAugmentation1.ts, 2, 29)) +>reduce : Symbol(Array.reduce, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(duplicateOverloadInTypeAugmentation1.ts, 0, 20), Decl(duplicateOverloadInTypeAugmentation1.ts, 2, 29)) >callbackfn : Symbol(callbackfn, Decl(duplicateOverloadInTypeAugmentation1.ts, 1, 11)) >previousValue : Symbol(previousValue, Decl(duplicateOverloadInTypeAugmentation1.ts, 1, 24)) >T : Symbol(T, Decl(lib.d.ts, --, --), Decl(duplicateOverloadInTypeAugmentation1.ts, 0, 16)) @@ -21,7 +21,7 @@ interface Array { >T : Symbol(T, Decl(lib.d.ts, --, --), Decl(duplicateOverloadInTypeAugmentation1.ts, 0, 16)) reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, ->reduce : Symbol(reduce, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(duplicateOverloadInTypeAugmentation1.ts, 0, 20), Decl(duplicateOverloadInTypeAugmentation1.ts, 2, 29)) +>reduce : Symbol(Array.reduce, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(duplicateOverloadInTypeAugmentation1.ts, 0, 20), Decl(duplicateOverloadInTypeAugmentation1.ts, 2, 29)) >U : Symbol(U, Decl(duplicateOverloadInTypeAugmentation1.ts, 3, 11)) >callbackfn : Symbol(callbackfn, Decl(duplicateOverloadInTypeAugmentation1.ts, 3, 14)) >previousValue : Symbol(previousValue, Decl(duplicateOverloadInTypeAugmentation1.ts, 3, 27)) diff --git a/tests/baselines/reference/duplicateVariablesByScope.symbols b/tests/baselines/reference/duplicateVariablesByScope.symbols index 9dd280d2756..88eb44d0181 100644 --- a/tests/baselines/reference/duplicateVariablesByScope.symbols +++ b/tests/baselines/reference/duplicateVariablesByScope.symbols @@ -41,7 +41,7 @@ class C { >C : Symbol(C, Decl(duplicateVariablesByScope.ts, 20, 1)) foo() { ->foo : Symbol(foo, Decl(duplicateVariablesByScope.ts, 22, 9)) +>foo : Symbol(C.foo, Decl(duplicateVariablesByScope.ts, 22, 9)) try { var x = 1; diff --git a/tests/baselines/reference/dynamicRequire.js b/tests/baselines/reference/dynamicRequire.js new file mode 100644 index 00000000000..28b35970601 --- /dev/null +++ b/tests/baselines/reference/dynamicRequire.js @@ -0,0 +1,10 @@ +//// [a.js] + +function foo(name) { + var s = require("t/" + name) +} + +//// [a_out.js] +function foo(name) { + var s = require("t/" + name); +} diff --git a/tests/baselines/reference/dynamicRequire.symbols b/tests/baselines/reference/dynamicRequire.symbols new file mode 100644 index 00000000000..c307d578de7 --- /dev/null +++ b/tests/baselines/reference/dynamicRequire.symbols @@ -0,0 +1,10 @@ +=== tests/cases/compiler/a.js === + +function foo(name) { +>foo : Symbol(foo, Decl(a.js, 0, 0)) +>name : Symbol(name, Decl(a.js, 1, 13)) + + var s = require("t/" + name) +>s : Symbol(s, Decl(a.js, 2, 7)) +>name : Symbol(name, Decl(a.js, 1, 13)) +} diff --git a/tests/baselines/reference/dynamicRequire.types b/tests/baselines/reference/dynamicRequire.types new file mode 100644 index 00000000000..43eea88a05b --- /dev/null +++ b/tests/baselines/reference/dynamicRequire.types @@ -0,0 +1,14 @@ +=== tests/cases/compiler/a.js === + +function foo(name) { +>foo : (name: any) => void +>name : any + + var s = require("t/" + name) +>s : any +>require("t/" + name) : any +>require : any +>"t/" + name : string +>"t/" : string +>name : any +} diff --git a/tests/baselines/reference/emitArrowFunctionES6.types b/tests/baselines/reference/emitArrowFunctionES6.types index cc48cecd96a..d37c08f855c 100644 --- a/tests/baselines/reference/emitArrowFunctionES6.types +++ b/tests/baselines/reference/emitArrowFunctionES6.types @@ -64,31 +64,31 @@ var p4 = ([, ...a]) => { }; >a : any[] var p5 = ([a = 1]) => { }; ->p5 : ([a = 1]: [number]) => void ->([a = 1]) => { } : ([a = 1]: [number]) => void +>p5 : ([a]: [number]) => void +>([a = 1]) => { } : ([a]: [number]) => void >a : number >1 : number var p6 = ({ a }) => { }; ->p6 : ({ a }: { a: any; }) => void ->({ a }) => { } : ({ a }: { a: any; }) => void +>p6 : ({a}: { a: any; }) => void +>({ a }) => { } : ({a}: { a: any; }) => void >a : any var p7 = ({ a: { b } }) => { }; ->p7 : ({ a: { b } }: { a: { b: any; }; }) => void ->({ a: { b } }) => { } : ({ a: { b } }: { a: { b: any; }; }) => void +>p7 : ({a: {b}}: { a: { b: any; }; }) => void +>({ a: { b } }) => { } : ({a: {b}}: { a: { b: any; }; }) => void >a : any >b : any var p8 = ({ a = 1 }) => { }; ->p8 : ({ a = 1 }: { a?: number; }) => void ->({ a = 1 }) => { } : ({ a = 1 }: { a?: number; }) => void +>p8 : ({a}: { a?: number; }) => void +>({ a = 1 }) => { } : ({a}: { a?: number; }) => void >a : number >1 : number var p9 = ({ a: { b = 1 } = { b: 1 } }) => { }; ->p9 : ({ a: { b = 1 } = { b: 1 } }: { a?: { b?: number; }; }) => void ->({ a: { b = 1 } = { b: 1 } }) => { } : ({ a: { b = 1 } = { b: 1 } }: { a?: { b?: number; }; }) => void +>p9 : ({a: {b}}: { a?: { b?: number; }; }) => void +>({ a: { b = 1 } = { b: 1 } }) => { } : ({a: {b}}: { a?: { b?: number; }; }) => void >a : any >b : number >1 : number @@ -97,8 +97,8 @@ var p9 = ({ a: { b = 1 } = { b: 1 } }) => { }; >1 : number var p10 = ([{ value, done }]) => { }; ->p10 : ([{ value, done }]: [{ value: any; done: any; }]) => void ->([{ value, done }]) => { } : ([{ value, done }]: [{ value: any; done: any; }]) => void +>p10 : ([{value, done}]: [{ value: any; done: any; }]) => void +>([{ value, done }]) => { } : ([{value, done}]: [{ value: any; done: any; }]) => void >value : any >done : any diff --git a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments14_ES6.symbols b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments14_ES6.symbols index f5846be3738..fe6788b31f5 100644 --- a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments14_ES6.symbols +++ b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments14_ES6.symbols @@ -4,9 +4,9 @@ function f() { >f : Symbol(f, Decl(emitArrowFunctionWhenUsingArguments14_ES6.ts, 0, 0)) if (Math.random()) { ->Math.random : Symbol(Math.random, Decl(lib.d.ts, --, --)) ->Math : Symbol(Math, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->random : Symbol(Math.random, Decl(lib.d.ts, --, --)) +>Math.random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --)) +>Math : Symbol(Math, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --)) let arguments = 100; >arguments : Symbol(arguments, Decl(emitArrowFunctionWhenUsingArguments14_ES6.ts, 3, 11)) diff --git a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments15_ES6.symbols b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments15_ES6.symbols index 648f04b0814..63ee68f0aa7 100644 --- a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments15_ES6.symbols +++ b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments15_ES6.symbols @@ -7,9 +7,9 @@ function f() { >arguments : Symbol(arguments, Decl(emitArrowFunctionWhenUsingArguments15_ES6.ts, 2, 7)) if (Math.random()) { ->Math.random : Symbol(Math.random, Decl(lib.d.ts, --, --)) ->Math : Symbol(Math, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->random : Symbol(Math.random, Decl(lib.d.ts, --, --)) +>Math.random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --)) +>Math : Symbol(Math, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --)) const arguments = 100; >arguments : Symbol(arguments, Decl(emitArrowFunctionWhenUsingArguments15_ES6.ts, 4, 13)) diff --git a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments16_ES6.symbols b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments16_ES6.symbols index bc9fcbfa159..6ea3019f1e6 100644 --- a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments16_ES6.symbols +++ b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments16_ES6.symbols @@ -7,9 +7,9 @@ function f() { >arguments : Symbol(arguments, Decl(emitArrowFunctionWhenUsingArguments16_ES6.ts, 2, 7), Decl(emitArrowFunctionWhenUsingArguments16_ES6.ts, 6, 7)) if (Math.random()) { ->Math.random : Symbol(Math.random, Decl(lib.d.ts, --, --)) ->Math : Symbol(Math, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->random : Symbol(Math.random, Decl(lib.d.ts, --, --)) +>Math.random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --)) +>Math : Symbol(Math, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --)) return () => arguments[0]; >arguments : Symbol(arguments) diff --git a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments17_ES6.symbols b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments17_ES6.symbols index 65f4e121d10..a7d5e457056 100644 --- a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments17_ES6.symbols +++ b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments17_ES6.symbols @@ -8,9 +8,9 @@ function f() { >arguments : Symbol(arguments, Decl(emitArrowFunctionWhenUsingArguments17_ES6.ts, 2, 25)) if (Math.random()) { ->Math.random : Symbol(Math.random, Decl(lib.d.ts, --, --)) ->Math : Symbol(Math, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->random : Symbol(Math.random, Decl(lib.d.ts, --, --)) +>Math.random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --)) +>Math : Symbol(Math, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --)) return () => arguments[0]; >arguments : Symbol(arguments) diff --git a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments18_ES6.symbols b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments18_ES6.symbols index a15a10c29d8..e59ed6b8537 100644 --- a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments18_ES6.symbols +++ b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments18_ES6.symbols @@ -9,9 +9,9 @@ function f() { >arguments : Symbol(arguments, Decl(emitArrowFunctionWhenUsingArguments18_ES6.ts, 2, 31)) if (Math.random()) { ->Math.random : Symbol(Math.random, Decl(lib.d.ts, --, --)) ->Math : Symbol(Math, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->random : Symbol(Math.random, Decl(lib.d.ts, --, --)) +>Math.random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --)) +>Math : Symbol(Math, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --)) return () => arguments; >arguments : Symbol(arguments) diff --git a/tests/baselines/reference/emitClassDeclarationWithConstructorInES6.symbols b/tests/baselines/reference/emitClassDeclarationWithConstructorInES6.symbols index 8186b029471..72de9b39dda 100644 --- a/tests/baselines/reference/emitClassDeclarationWithConstructorInES6.symbols +++ b/tests/baselines/reference/emitClassDeclarationWithConstructorInES6.symbols @@ -3,30 +3,30 @@ class A { >A : Symbol(A, Decl(emitClassDeclarationWithConstructorInES6.ts, 0, 0)) y: number; ->y : Symbol(y, Decl(emitClassDeclarationWithConstructorInES6.ts, 0, 9)) +>y : Symbol(A.y, Decl(emitClassDeclarationWithConstructorInES6.ts, 0, 9)) constructor(x: number) { >x : Symbol(x, Decl(emitClassDeclarationWithConstructorInES6.ts, 2, 16)) } foo(a: any); ->foo : Symbol(foo, Decl(emitClassDeclarationWithConstructorInES6.ts, 3, 5), Decl(emitClassDeclarationWithConstructorInES6.ts, 4, 16)) +>foo : Symbol(A.foo, Decl(emitClassDeclarationWithConstructorInES6.ts, 3, 5), Decl(emitClassDeclarationWithConstructorInES6.ts, 4, 16)) >a : Symbol(a, Decl(emitClassDeclarationWithConstructorInES6.ts, 4, 8)) foo() { } ->foo : Symbol(foo, Decl(emitClassDeclarationWithConstructorInES6.ts, 3, 5), Decl(emitClassDeclarationWithConstructorInES6.ts, 4, 16)) +>foo : Symbol(A.foo, Decl(emitClassDeclarationWithConstructorInES6.ts, 3, 5), Decl(emitClassDeclarationWithConstructorInES6.ts, 4, 16)) } class B { >B : Symbol(B, Decl(emitClassDeclarationWithConstructorInES6.ts, 6, 1)) y: number; ->y : Symbol(y, Decl(emitClassDeclarationWithConstructorInES6.ts, 8, 9)) +>y : Symbol(B.y, Decl(emitClassDeclarationWithConstructorInES6.ts, 8, 9)) x: string = "hello"; ->x : Symbol(x, Decl(emitClassDeclarationWithConstructorInES6.ts, 9, 14)) +>x : Symbol(B.x, Decl(emitClassDeclarationWithConstructorInES6.ts, 9, 14)) _bar: string; ->_bar : Symbol(_bar, Decl(emitClassDeclarationWithConstructorInES6.ts, 10, 24)) +>_bar : Symbol(B._bar, Decl(emitClassDeclarationWithConstructorInES6.ts, 10, 24)) constructor(x: number, z = "hello", ...args) { >x : Symbol(x, Decl(emitClassDeclarationWithConstructorInES6.ts, 13, 16)) @@ -34,23 +34,23 @@ class B { >args : Symbol(args, Decl(emitClassDeclarationWithConstructorInES6.ts, 13, 39)) this.y = 10; ->this.y : Symbol(y, Decl(emitClassDeclarationWithConstructorInES6.ts, 8, 9)) +>this.y : Symbol(B.y, Decl(emitClassDeclarationWithConstructorInES6.ts, 8, 9)) >this : Symbol(B, Decl(emitClassDeclarationWithConstructorInES6.ts, 6, 1)) ->y : Symbol(y, Decl(emitClassDeclarationWithConstructorInES6.ts, 8, 9)) +>y : Symbol(B.y, Decl(emitClassDeclarationWithConstructorInES6.ts, 8, 9)) } baz(...args): string; ->baz : Symbol(baz, Decl(emitClassDeclarationWithConstructorInES6.ts, 15, 5), Decl(emitClassDeclarationWithConstructorInES6.ts, 16, 25)) +>baz : Symbol(B.baz, Decl(emitClassDeclarationWithConstructorInES6.ts, 15, 5), Decl(emitClassDeclarationWithConstructorInES6.ts, 16, 25)) >args : Symbol(args, Decl(emitClassDeclarationWithConstructorInES6.ts, 16, 8)) baz(z: string, v: number): string { ->baz : Symbol(baz, Decl(emitClassDeclarationWithConstructorInES6.ts, 15, 5), Decl(emitClassDeclarationWithConstructorInES6.ts, 16, 25)) +>baz : Symbol(B.baz, Decl(emitClassDeclarationWithConstructorInES6.ts, 15, 5), Decl(emitClassDeclarationWithConstructorInES6.ts, 16, 25)) >z : Symbol(z, Decl(emitClassDeclarationWithConstructorInES6.ts, 17, 8)) >v : Symbol(v, Decl(emitClassDeclarationWithConstructorInES6.ts, 17, 18)) return this._bar; ->this._bar : Symbol(_bar, Decl(emitClassDeclarationWithConstructorInES6.ts, 10, 24)) +>this._bar : Symbol(B._bar, Decl(emitClassDeclarationWithConstructorInES6.ts, 10, 24)) >this : Symbol(B, Decl(emitClassDeclarationWithConstructorInES6.ts, 6, 1)) ->_bar : Symbol(_bar, Decl(emitClassDeclarationWithConstructorInES6.ts, 10, 24)) +>_bar : Symbol(B._bar, Decl(emitClassDeclarationWithConstructorInES6.ts, 10, 24)) } } diff --git a/tests/baselines/reference/emitClassDeclarationWithExtensionInES6.symbols b/tests/baselines/reference/emitClassDeclarationWithExtensionInES6.symbols index 586a924a260..799c5a8b3bb 100644 --- a/tests/baselines/reference/emitClassDeclarationWithExtensionInES6.symbols +++ b/tests/baselines/reference/emitClassDeclarationWithExtensionInES6.symbols @@ -3,7 +3,7 @@ class B { >B : Symbol(B, Decl(emitClassDeclarationWithExtensionInES6.ts, 0, 0)) baz(a: string, y = 10) { } ->baz : Symbol(baz, Decl(emitClassDeclarationWithExtensionInES6.ts, 0, 9)) +>baz : Symbol(B.baz, Decl(emitClassDeclarationWithExtensionInES6.ts, 0, 9)) >a : Symbol(a, Decl(emitClassDeclarationWithExtensionInES6.ts, 1, 8)) >y : Symbol(y, Decl(emitClassDeclarationWithExtensionInES6.ts, 1, 18)) } @@ -12,10 +12,10 @@ class C extends B { >B : Symbol(B, Decl(emitClassDeclarationWithExtensionInES6.ts, 0, 0)) foo() { } ->foo : Symbol(foo, Decl(emitClassDeclarationWithExtensionInES6.ts, 3, 19)) +>foo : Symbol(C.foo, Decl(emitClassDeclarationWithExtensionInES6.ts, 3, 19)) baz(a: string, y:number) { ->baz : Symbol(baz, Decl(emitClassDeclarationWithExtensionInES6.ts, 4, 13)) +>baz : Symbol(C.baz, Decl(emitClassDeclarationWithExtensionInES6.ts, 4, 13)) >a : Symbol(a, Decl(emitClassDeclarationWithExtensionInES6.ts, 5, 8)) >y : Symbol(y, Decl(emitClassDeclarationWithExtensionInES6.ts, 5, 18)) @@ -37,7 +37,7 @@ class D extends C { } foo() { ->foo : Symbol(foo, Decl(emitClassDeclarationWithExtensionInES6.ts, 12, 5)) +>foo : Symbol(D.foo, Decl(emitClassDeclarationWithExtensionInES6.ts, 12, 5)) super.foo(); >super.foo : Symbol(C.foo, Decl(emitClassDeclarationWithExtensionInES6.ts, 3, 19)) @@ -46,7 +46,7 @@ class D extends C { } baz() { ->baz : Symbol(baz, Decl(emitClassDeclarationWithExtensionInES6.ts, 16, 5)) +>baz : Symbol(D.baz, Decl(emitClassDeclarationWithExtensionInES6.ts, 16, 5)) super.baz("hello", 10); >super.baz : Symbol(C.baz, Decl(emitClassDeclarationWithExtensionInES6.ts, 4, 13)) diff --git a/tests/baselines/reference/emitClassDeclarationWithGetterSetterInES6.symbols b/tests/baselines/reference/emitClassDeclarationWithGetterSetterInES6.symbols index b2b1a000dc9..89c49123e77 100644 --- a/tests/baselines/reference/emitClassDeclarationWithGetterSetterInES6.symbols +++ b/tests/baselines/reference/emitClassDeclarationWithGetterSetterInES6.symbols @@ -3,15 +3,15 @@ class C { >C : Symbol(C, Decl(emitClassDeclarationWithGetterSetterInES6.ts, 0, 0)) _name: string; ->_name : Symbol(_name, Decl(emitClassDeclarationWithGetterSetterInES6.ts, 0, 9)) +>_name : Symbol(C._name, Decl(emitClassDeclarationWithGetterSetterInES6.ts, 0, 9)) get name(): string { ->name : Symbol(name, Decl(emitClassDeclarationWithGetterSetterInES6.ts, 1, 18)) +>name : Symbol(C.name, Decl(emitClassDeclarationWithGetterSetterInES6.ts, 1, 18)) return this._name; ->this._name : Symbol(_name, Decl(emitClassDeclarationWithGetterSetterInES6.ts, 0, 9)) +>this._name : Symbol(C._name, Decl(emitClassDeclarationWithGetterSetterInES6.ts, 0, 9)) >this : Symbol(C, Decl(emitClassDeclarationWithGetterSetterInES6.ts, 0, 0)) ->_name : Symbol(_name, Decl(emitClassDeclarationWithGetterSetterInES6.ts, 0, 9)) +>_name : Symbol(C._name, Decl(emitClassDeclarationWithGetterSetterInES6.ts, 0, 9)) } static get name2(): string { >name2 : Symbol(C.name2, Decl(emitClassDeclarationWithGetterSetterInES6.ts, 4, 5)) @@ -19,24 +19,32 @@ class C { return "BYE"; } static get ["computedname"]() { +>"computedname" : Symbol(C[["computedname"]], Decl(emitClassDeclarationWithGetterSetterInES6.ts, 7, 5), Decl(emitClassDeclarationWithGetterSetterInES6.ts, 24, 33)) + return ""; } get ["computedname1"]() { +>"computedname1" : Symbol(C[["computedname1"]], Decl(emitClassDeclarationWithGetterSetterInES6.ts, 10, 5)) + return ""; } get ["computedname2"]() { +>"computedname2" : Symbol(C[["computedname2"]], Decl(emitClassDeclarationWithGetterSetterInES6.ts, 13, 5)) + return ""; } set ["computedname3"](x: any) { +>"computedname3" : Symbol(C[["computedname3"]], Decl(emitClassDeclarationWithGetterSetterInES6.ts, 16, 5)) >x : Symbol(x, Decl(emitClassDeclarationWithGetterSetterInES6.ts, 18, 26)) } set ["computedname4"](y: string) { +>"computedname4" : Symbol(C[["computedname4"]], Decl(emitClassDeclarationWithGetterSetterInES6.ts, 19, 5)) >y : Symbol(y, Decl(emitClassDeclarationWithGetterSetterInES6.ts, 20, 26)) } set foo(a: string) { } ->foo : Symbol(foo, Decl(emitClassDeclarationWithGetterSetterInES6.ts, 21, 5)) +>foo : Symbol(C.foo, Decl(emitClassDeclarationWithGetterSetterInES6.ts, 21, 5)) >a : Symbol(a, Decl(emitClassDeclarationWithGetterSetterInES6.ts, 23, 12)) static set bar(b: number) { } @@ -44,5 +52,6 @@ class C { >b : Symbol(b, Decl(emitClassDeclarationWithGetterSetterInES6.ts, 24, 19)) static set ["computedname"](b: string) { } +>"computedname" : Symbol(C[["computedname"]], Decl(emitClassDeclarationWithGetterSetterInES6.ts, 7, 5), Decl(emitClassDeclarationWithGetterSetterInES6.ts, 24, 33)) >b : Symbol(b, Decl(emitClassDeclarationWithGetterSetterInES6.ts, 25, 32)) } diff --git a/tests/baselines/reference/emitClassDeclarationWithLiteralPropertyNameInES6.symbols b/tests/baselines/reference/emitClassDeclarationWithLiteralPropertyNameInES6.symbols index fdceb9831c1..cb716163d6a 100644 --- a/tests/baselines/reference/emitClassDeclarationWithLiteralPropertyNameInES6.symbols +++ b/tests/baselines/reference/emitClassDeclarationWithLiteralPropertyNameInES6.symbols @@ -10,7 +10,7 @@ class B { 0b1110() {} 11() { } interface() { } ->interface : Symbol(interface, Decl(emitClassDeclarationWithLiteralPropertyNameInES6.ts, 7, 12)) +>interface : Symbol(B.interface, Decl(emitClassDeclarationWithLiteralPropertyNameInES6.ts, 7, 12)) static "hi" = 10000; static 22 = "twenty-two"; diff --git a/tests/baselines/reference/emitClassDeclarationWithMethodInES6.symbols b/tests/baselines/reference/emitClassDeclarationWithMethodInES6.symbols index 970076f6b78..54522c5834a 100644 --- a/tests/baselines/reference/emitClassDeclarationWithMethodInES6.symbols +++ b/tests/baselines/reference/emitClassDeclarationWithMethodInES6.symbols @@ -3,38 +3,46 @@ class D { >D : Symbol(D, Decl(emitClassDeclarationWithMethodInES6.ts, 0, 0)) _bar: string; ->_bar : Symbol(_bar, Decl(emitClassDeclarationWithMethodInES6.ts, 0, 9)) +>_bar : Symbol(D._bar, Decl(emitClassDeclarationWithMethodInES6.ts, 0, 9)) foo() { } ->foo : Symbol(foo, Decl(emitClassDeclarationWithMethodInES6.ts, 1, 17)) +>foo : Symbol(D.foo, Decl(emitClassDeclarationWithMethodInES6.ts, 1, 17)) ["computedName1"]() { } +>"computedName1" : Symbol(D[["computedName1"]], Decl(emitClassDeclarationWithMethodInES6.ts, 2, 13)) + ["computedName2"](a: string) { } +>"computedName2" : Symbol(D[["computedName2"]], Decl(emitClassDeclarationWithMethodInES6.ts, 3, 27)) >a : Symbol(a, Decl(emitClassDeclarationWithMethodInES6.ts, 4, 22)) ["computedName3"](a: string): number { return 1; } +>"computedName3" : Symbol(D[["computedName3"]], Decl(emitClassDeclarationWithMethodInES6.ts, 4, 36)) >a : Symbol(a, Decl(emitClassDeclarationWithMethodInES6.ts, 5, 22)) bar(): string { ->bar : Symbol(bar, Decl(emitClassDeclarationWithMethodInES6.ts, 5, 54)) +>bar : Symbol(D.bar, Decl(emitClassDeclarationWithMethodInES6.ts, 5, 54)) return this._bar; ->this._bar : Symbol(_bar, Decl(emitClassDeclarationWithMethodInES6.ts, 0, 9)) +>this._bar : Symbol(D._bar, Decl(emitClassDeclarationWithMethodInES6.ts, 0, 9)) >this : Symbol(D, Decl(emitClassDeclarationWithMethodInES6.ts, 0, 0)) ->_bar : Symbol(_bar, Decl(emitClassDeclarationWithMethodInES6.ts, 0, 9)) +>_bar : Symbol(D._bar, Decl(emitClassDeclarationWithMethodInES6.ts, 0, 9)) } baz(a: any, x: string): string { ->baz : Symbol(baz, Decl(emitClassDeclarationWithMethodInES6.ts, 8, 5)) +>baz : Symbol(D.baz, Decl(emitClassDeclarationWithMethodInES6.ts, 8, 5)) >a : Symbol(a, Decl(emitClassDeclarationWithMethodInES6.ts, 9, 8)) >x : Symbol(x, Decl(emitClassDeclarationWithMethodInES6.ts, 9, 15)) return "HELLO"; } static ["computedname4"]() { } +>"computedname4" : Symbol(D[["computedname4"]], Decl(emitClassDeclarationWithMethodInES6.ts, 11, 5)) + static ["computedname5"](a: string) { } +>"computedname5" : Symbol(D[["computedname5"]], Decl(emitClassDeclarationWithMethodInES6.ts, 12, 34)) >a : Symbol(a, Decl(emitClassDeclarationWithMethodInES6.ts, 13, 29)) static ["computedname6"](a: string): boolean { return true; } +>"computedname6" : Symbol(D[["computedname6"]], Decl(emitClassDeclarationWithMethodInES6.ts, 13, 43)) >a : Symbol(a, Decl(emitClassDeclarationWithMethodInES6.ts, 14, 29)) static staticMethod() { diff --git a/tests/baselines/reference/emitClassDeclarationWithPropertyAssignmentInES6.symbols b/tests/baselines/reference/emitClassDeclarationWithPropertyAssignmentInES6.symbols index 67878625bda..c7c17891f14 100644 --- a/tests/baselines/reference/emitClassDeclarationWithPropertyAssignmentInES6.symbols +++ b/tests/baselines/reference/emitClassDeclarationWithPropertyAssignmentInES6.symbols @@ -3,23 +3,23 @@ class C { >C : Symbol(C, Decl(emitClassDeclarationWithPropertyAssignmentInES6.ts, 0, 0)) x: string = "Hello world"; ->x : Symbol(x, Decl(emitClassDeclarationWithPropertyAssignmentInES6.ts, 0, 9)) +>x : Symbol(C.x, Decl(emitClassDeclarationWithPropertyAssignmentInES6.ts, 0, 9)) } class D { >D : Symbol(D, Decl(emitClassDeclarationWithPropertyAssignmentInES6.ts, 2, 1)) x: string = "Hello world"; ->x : Symbol(x, Decl(emitClassDeclarationWithPropertyAssignmentInES6.ts, 4, 9)) +>x : Symbol(D.x, Decl(emitClassDeclarationWithPropertyAssignmentInES6.ts, 4, 9)) y: number; ->y : Symbol(y, Decl(emitClassDeclarationWithPropertyAssignmentInES6.ts, 5, 30)) +>y : Symbol(D.y, Decl(emitClassDeclarationWithPropertyAssignmentInES6.ts, 5, 30)) constructor() { this.y = 10; ->this.y : Symbol(y, Decl(emitClassDeclarationWithPropertyAssignmentInES6.ts, 5, 30)) +>this.y : Symbol(D.y, Decl(emitClassDeclarationWithPropertyAssignmentInES6.ts, 5, 30)) >this : Symbol(D, Decl(emitClassDeclarationWithPropertyAssignmentInES6.ts, 2, 1)) ->y : Symbol(y, Decl(emitClassDeclarationWithPropertyAssignmentInES6.ts, 5, 30)) +>y : Symbol(D.y, Decl(emitClassDeclarationWithPropertyAssignmentInES6.ts, 5, 30)) } } @@ -28,7 +28,7 @@ class E extends D{ >D : Symbol(D, Decl(emitClassDeclarationWithPropertyAssignmentInES6.ts, 2, 1)) z: boolean = true; ->z : Symbol(z, Decl(emitClassDeclarationWithPropertyAssignmentInES6.ts, 12, 18)) +>z : Symbol(E.z, Decl(emitClassDeclarationWithPropertyAssignmentInES6.ts, 12, 18)) } class F extends D{ @@ -36,18 +36,18 @@ class F extends D{ >D : Symbol(D, Decl(emitClassDeclarationWithPropertyAssignmentInES6.ts, 2, 1)) z: boolean = true; ->z : Symbol(z, Decl(emitClassDeclarationWithPropertyAssignmentInES6.ts, 16, 18)) +>z : Symbol(F.z, Decl(emitClassDeclarationWithPropertyAssignmentInES6.ts, 16, 18)) j: string; ->j : Symbol(j, Decl(emitClassDeclarationWithPropertyAssignmentInES6.ts, 17, 22)) +>j : Symbol(F.j, Decl(emitClassDeclarationWithPropertyAssignmentInES6.ts, 17, 22)) constructor() { super(); >super : Symbol(D, Decl(emitClassDeclarationWithPropertyAssignmentInES6.ts, 2, 1)) this.j = "HI"; ->this.j : Symbol(j, Decl(emitClassDeclarationWithPropertyAssignmentInES6.ts, 17, 22)) +>this.j : Symbol(F.j, Decl(emitClassDeclarationWithPropertyAssignmentInES6.ts, 17, 22)) >this : Symbol(F, Decl(emitClassDeclarationWithPropertyAssignmentInES6.ts, 14, 1)) ->j : Symbol(j, Decl(emitClassDeclarationWithPropertyAssignmentInES6.ts, 17, 22)) +>j : Symbol(F.j, Decl(emitClassDeclarationWithPropertyAssignmentInES6.ts, 17, 22)) } } diff --git a/tests/baselines/reference/emitClassDeclarationWithStaticPropertyAssignmentInES6.symbols b/tests/baselines/reference/emitClassDeclarationWithStaticPropertyAssignmentInES6.symbols index 1b64646f788..268ab96f2ec 100644 --- a/tests/baselines/reference/emitClassDeclarationWithStaticPropertyAssignmentInES6.symbols +++ b/tests/baselines/reference/emitClassDeclarationWithStaticPropertyAssignmentInES6.symbols @@ -10,7 +10,7 @@ class D { >D : Symbol(D, Decl(emitClassDeclarationWithStaticPropertyAssignmentInES6.ts, 2, 1)) x = 20000; ->x : Symbol(x, Decl(emitClassDeclarationWithStaticPropertyAssignmentInES6.ts, 4, 9)) +>x : Symbol(D.x, Decl(emitClassDeclarationWithStaticPropertyAssignmentInES6.ts, 4, 9)) static b = true; >b : Symbol(D.b, Decl(emitClassDeclarationWithStaticPropertyAssignmentInES6.ts, 5, 14)) diff --git a/tests/baselines/reference/emitClassDeclarationWithSuperMethodCall01.symbols b/tests/baselines/reference/emitClassDeclarationWithSuperMethodCall01.symbols index 13ce54e0641..dc749161623 100644 --- a/tests/baselines/reference/emitClassDeclarationWithSuperMethodCall01.symbols +++ b/tests/baselines/reference/emitClassDeclarationWithSuperMethodCall01.symbols @@ -4,7 +4,7 @@ class Parent { >Parent : Symbol(Parent, Decl(emitClassDeclarationWithSuperMethodCall01.ts, 0, 0)) foo() { ->foo : Symbol(foo, Decl(emitClassDeclarationWithSuperMethodCall01.ts, 1, 14)) +>foo : Symbol(Parent.foo, Decl(emitClassDeclarationWithSuperMethodCall01.ts, 1, 14)) } } @@ -13,7 +13,7 @@ class Foo extends Parent { >Parent : Symbol(Parent, Decl(emitClassDeclarationWithSuperMethodCall01.ts, 0, 0)) foo() { ->foo : Symbol(foo, Decl(emitClassDeclarationWithSuperMethodCall01.ts, 6, 26)) +>foo : Symbol(Foo.foo, Decl(emitClassDeclarationWithSuperMethodCall01.ts, 6, 26)) var x = () => super.foo(); >x : Symbol(x, Decl(emitClassDeclarationWithSuperMethodCall01.ts, 8, 11)) diff --git a/tests/baselines/reference/emitClassDeclarationWithThisKeywordInES6.symbols b/tests/baselines/reference/emitClassDeclarationWithThisKeywordInES6.symbols index 32220451b9c..9690894a2eb 100644 --- a/tests/baselines/reference/emitClassDeclarationWithThisKeywordInES6.symbols +++ b/tests/baselines/reference/emitClassDeclarationWithThisKeywordInES6.symbols @@ -3,47 +3,47 @@ class B { >B : Symbol(B, Decl(emitClassDeclarationWithThisKeywordInES6.ts, 0, 0)) x = 10; ->x : Symbol(x, Decl(emitClassDeclarationWithThisKeywordInES6.ts, 0, 9)) +>x : Symbol(B.x, Decl(emitClassDeclarationWithThisKeywordInES6.ts, 0, 9)) constructor() { this.x = 10; ->this.x : Symbol(x, Decl(emitClassDeclarationWithThisKeywordInES6.ts, 0, 9)) +>this.x : Symbol(B.x, Decl(emitClassDeclarationWithThisKeywordInES6.ts, 0, 9)) >this : Symbol(B, Decl(emitClassDeclarationWithThisKeywordInES6.ts, 0, 0)) ->x : Symbol(x, Decl(emitClassDeclarationWithThisKeywordInES6.ts, 0, 9)) +>x : Symbol(B.x, Decl(emitClassDeclarationWithThisKeywordInES6.ts, 0, 9)) } static log(a: number) { } >log : Symbol(B.log, Decl(emitClassDeclarationWithThisKeywordInES6.ts, 4, 5)) >a : Symbol(a, Decl(emitClassDeclarationWithThisKeywordInES6.ts, 5, 15)) foo() { ->foo : Symbol(foo, Decl(emitClassDeclarationWithThisKeywordInES6.ts, 5, 29)) +>foo : Symbol(B.foo, Decl(emitClassDeclarationWithThisKeywordInES6.ts, 5, 29)) B.log(this.x); >B.log : Symbol(B.log, Decl(emitClassDeclarationWithThisKeywordInES6.ts, 4, 5)) >B : Symbol(B, Decl(emitClassDeclarationWithThisKeywordInES6.ts, 0, 0)) >log : Symbol(B.log, Decl(emitClassDeclarationWithThisKeywordInES6.ts, 4, 5)) ->this.x : Symbol(x, Decl(emitClassDeclarationWithThisKeywordInES6.ts, 0, 9)) +>this.x : Symbol(B.x, Decl(emitClassDeclarationWithThisKeywordInES6.ts, 0, 9)) >this : Symbol(B, Decl(emitClassDeclarationWithThisKeywordInES6.ts, 0, 0)) ->x : Symbol(x, Decl(emitClassDeclarationWithThisKeywordInES6.ts, 0, 9)) +>x : Symbol(B.x, Decl(emitClassDeclarationWithThisKeywordInES6.ts, 0, 9)) } get X() { ->X : Symbol(X, Decl(emitClassDeclarationWithThisKeywordInES6.ts, 8, 5)) +>X : Symbol(B.X, Decl(emitClassDeclarationWithThisKeywordInES6.ts, 8, 5)) return this.x; ->this.x : Symbol(x, Decl(emitClassDeclarationWithThisKeywordInES6.ts, 0, 9)) +>this.x : Symbol(B.x, Decl(emitClassDeclarationWithThisKeywordInES6.ts, 0, 9)) >this : Symbol(B, Decl(emitClassDeclarationWithThisKeywordInES6.ts, 0, 0)) ->x : Symbol(x, Decl(emitClassDeclarationWithThisKeywordInES6.ts, 0, 9)) +>x : Symbol(B.x, Decl(emitClassDeclarationWithThisKeywordInES6.ts, 0, 9)) } set bX(y: number) { ->bX : Symbol(bX, Decl(emitClassDeclarationWithThisKeywordInES6.ts, 12, 5)) +>bX : Symbol(B.bX, Decl(emitClassDeclarationWithThisKeywordInES6.ts, 12, 5)) >y : Symbol(y, Decl(emitClassDeclarationWithThisKeywordInES6.ts, 14, 11)) this.x = y; ->this.x : Symbol(x, Decl(emitClassDeclarationWithThisKeywordInES6.ts, 0, 9)) +>this.x : Symbol(B.x, Decl(emitClassDeclarationWithThisKeywordInES6.ts, 0, 9)) >this : Symbol(B, Decl(emitClassDeclarationWithThisKeywordInES6.ts, 0, 0)) ->x : Symbol(x, Decl(emitClassDeclarationWithThisKeywordInES6.ts, 0, 9)) +>x : Symbol(B.x, Decl(emitClassDeclarationWithThisKeywordInES6.ts, 0, 9)) >y : Symbol(y, Decl(emitClassDeclarationWithThisKeywordInES6.ts, 14, 11)) } } diff --git a/tests/baselines/reference/emitClassDeclarationWithTypeArgumentAndOverloadInES6.symbols b/tests/baselines/reference/emitClassDeclarationWithTypeArgumentAndOverloadInES6.symbols index 092dbf10c7b..d87213d5651 100644 --- a/tests/baselines/reference/emitClassDeclarationWithTypeArgumentAndOverloadInES6.symbols +++ b/tests/baselines/reference/emitClassDeclarationWithTypeArgumentAndOverloadInES6.symbols @@ -4,11 +4,11 @@ class B { >T : Symbol(T, Decl(emitClassDeclarationWithTypeArgumentAndOverloadInES6.ts, 0, 8)) x: T; ->x : Symbol(x, Decl(emitClassDeclarationWithTypeArgumentAndOverloadInES6.ts, 0, 12)) +>x : Symbol(B.x, Decl(emitClassDeclarationWithTypeArgumentAndOverloadInES6.ts, 0, 12)) >T : Symbol(T, Decl(emitClassDeclarationWithTypeArgumentAndOverloadInES6.ts, 0, 8)) B: T; ->B : Symbol(B, Decl(emitClassDeclarationWithTypeArgumentAndOverloadInES6.ts, 1, 9)) +>B : Symbol(B.B, Decl(emitClassDeclarationWithTypeArgumentAndOverloadInES6.ts, 1, 9)) >T : Symbol(T, Decl(emitClassDeclarationWithTypeArgumentAndOverloadInES6.ts, 0, 8)) constructor(a: any) @@ -22,52 +22,52 @@ class B { constructor(a: T) { this.B = a;} >a : Symbol(a, Decl(emitClassDeclarationWithTypeArgumentAndOverloadInES6.ts, 6, 16)) >T : Symbol(T, Decl(emitClassDeclarationWithTypeArgumentAndOverloadInES6.ts, 0, 8)) ->this.B : Symbol(B, Decl(emitClassDeclarationWithTypeArgumentAndOverloadInES6.ts, 1, 9)) +>this.B : Symbol(B.B, Decl(emitClassDeclarationWithTypeArgumentAndOverloadInES6.ts, 1, 9)) >this : Symbol(B, Decl(emitClassDeclarationWithTypeArgumentAndOverloadInES6.ts, 0, 0)) ->B : Symbol(B, Decl(emitClassDeclarationWithTypeArgumentAndOverloadInES6.ts, 1, 9)) +>B : Symbol(B.B, Decl(emitClassDeclarationWithTypeArgumentAndOverloadInES6.ts, 1, 9)) >a : Symbol(a, Decl(emitClassDeclarationWithTypeArgumentAndOverloadInES6.ts, 6, 16)) foo(a: T) ->foo : Symbol(foo, Decl(emitClassDeclarationWithTypeArgumentAndOverloadInES6.ts, 6, 36), Decl(emitClassDeclarationWithTypeArgumentAndOverloadInES6.ts, 8, 13), Decl(emitClassDeclarationWithTypeArgumentAndOverloadInES6.ts, 9, 15), Decl(emitClassDeclarationWithTypeArgumentAndOverloadInES6.ts, 10, 18)) +>foo : Symbol(B.foo, Decl(emitClassDeclarationWithTypeArgumentAndOverloadInES6.ts, 6, 36), Decl(emitClassDeclarationWithTypeArgumentAndOverloadInES6.ts, 8, 13), Decl(emitClassDeclarationWithTypeArgumentAndOverloadInES6.ts, 9, 15), Decl(emitClassDeclarationWithTypeArgumentAndOverloadInES6.ts, 10, 18)) >a : Symbol(a, Decl(emitClassDeclarationWithTypeArgumentAndOverloadInES6.ts, 8, 8)) >T : Symbol(T, Decl(emitClassDeclarationWithTypeArgumentAndOverloadInES6.ts, 0, 8)) foo(a: any) ->foo : Symbol(foo, Decl(emitClassDeclarationWithTypeArgumentAndOverloadInES6.ts, 6, 36), Decl(emitClassDeclarationWithTypeArgumentAndOverloadInES6.ts, 8, 13), Decl(emitClassDeclarationWithTypeArgumentAndOverloadInES6.ts, 9, 15), Decl(emitClassDeclarationWithTypeArgumentAndOverloadInES6.ts, 10, 18)) +>foo : Symbol(B.foo, Decl(emitClassDeclarationWithTypeArgumentAndOverloadInES6.ts, 6, 36), Decl(emitClassDeclarationWithTypeArgumentAndOverloadInES6.ts, 8, 13), Decl(emitClassDeclarationWithTypeArgumentAndOverloadInES6.ts, 9, 15), Decl(emitClassDeclarationWithTypeArgumentAndOverloadInES6.ts, 10, 18)) >a : Symbol(a, Decl(emitClassDeclarationWithTypeArgumentAndOverloadInES6.ts, 9, 8)) foo(b: string) ->foo : Symbol(foo, Decl(emitClassDeclarationWithTypeArgumentAndOverloadInES6.ts, 6, 36), Decl(emitClassDeclarationWithTypeArgumentAndOverloadInES6.ts, 8, 13), Decl(emitClassDeclarationWithTypeArgumentAndOverloadInES6.ts, 9, 15), Decl(emitClassDeclarationWithTypeArgumentAndOverloadInES6.ts, 10, 18)) +>foo : Symbol(B.foo, Decl(emitClassDeclarationWithTypeArgumentAndOverloadInES6.ts, 6, 36), Decl(emitClassDeclarationWithTypeArgumentAndOverloadInES6.ts, 8, 13), Decl(emitClassDeclarationWithTypeArgumentAndOverloadInES6.ts, 9, 15), Decl(emitClassDeclarationWithTypeArgumentAndOverloadInES6.ts, 10, 18)) >b : Symbol(b, Decl(emitClassDeclarationWithTypeArgumentAndOverloadInES6.ts, 10, 8)) foo(): T { ->foo : Symbol(foo, Decl(emitClassDeclarationWithTypeArgumentAndOverloadInES6.ts, 6, 36), Decl(emitClassDeclarationWithTypeArgumentAndOverloadInES6.ts, 8, 13), Decl(emitClassDeclarationWithTypeArgumentAndOverloadInES6.ts, 9, 15), Decl(emitClassDeclarationWithTypeArgumentAndOverloadInES6.ts, 10, 18)) +>foo : Symbol(B.foo, Decl(emitClassDeclarationWithTypeArgumentAndOverloadInES6.ts, 6, 36), Decl(emitClassDeclarationWithTypeArgumentAndOverloadInES6.ts, 8, 13), Decl(emitClassDeclarationWithTypeArgumentAndOverloadInES6.ts, 9, 15), Decl(emitClassDeclarationWithTypeArgumentAndOverloadInES6.ts, 10, 18)) >T : Symbol(T, Decl(emitClassDeclarationWithTypeArgumentAndOverloadInES6.ts, 0, 8)) return this.x; ->this.x : Symbol(x, Decl(emitClassDeclarationWithTypeArgumentAndOverloadInES6.ts, 0, 12)) +>this.x : Symbol(B.x, Decl(emitClassDeclarationWithTypeArgumentAndOverloadInES6.ts, 0, 12)) >this : Symbol(B, Decl(emitClassDeclarationWithTypeArgumentAndOverloadInES6.ts, 0, 0)) ->x : Symbol(x, Decl(emitClassDeclarationWithTypeArgumentAndOverloadInES6.ts, 0, 12)) +>x : Symbol(B.x, Decl(emitClassDeclarationWithTypeArgumentAndOverloadInES6.ts, 0, 12)) } get BB(): T { ->BB : Symbol(BB, Decl(emitClassDeclarationWithTypeArgumentAndOverloadInES6.ts, 13, 5)) +>BB : Symbol(B.BB, Decl(emitClassDeclarationWithTypeArgumentAndOverloadInES6.ts, 13, 5)) >T : Symbol(T, Decl(emitClassDeclarationWithTypeArgumentAndOverloadInES6.ts, 0, 8)) return this.B; ->this.B : Symbol(B, Decl(emitClassDeclarationWithTypeArgumentAndOverloadInES6.ts, 1, 9)) +>this.B : Symbol(B.B, Decl(emitClassDeclarationWithTypeArgumentAndOverloadInES6.ts, 1, 9)) >this : Symbol(B, Decl(emitClassDeclarationWithTypeArgumentAndOverloadInES6.ts, 0, 0)) ->B : Symbol(B, Decl(emitClassDeclarationWithTypeArgumentAndOverloadInES6.ts, 1, 9)) +>B : Symbol(B.B, Decl(emitClassDeclarationWithTypeArgumentAndOverloadInES6.ts, 1, 9)) } set BBWith(c: T) { ->BBWith : Symbol(BBWith, Decl(emitClassDeclarationWithTypeArgumentAndOverloadInES6.ts, 17, 5)) +>BBWith : Symbol(B.BBWith, Decl(emitClassDeclarationWithTypeArgumentAndOverloadInES6.ts, 17, 5)) >c : Symbol(c, Decl(emitClassDeclarationWithTypeArgumentAndOverloadInES6.ts, 18, 15)) >T : Symbol(T, Decl(emitClassDeclarationWithTypeArgumentAndOverloadInES6.ts, 0, 8)) this.B = c; ->this.B : Symbol(B, Decl(emitClassDeclarationWithTypeArgumentAndOverloadInES6.ts, 1, 9)) +>this.B : Symbol(B.B, Decl(emitClassDeclarationWithTypeArgumentAndOverloadInES6.ts, 1, 9)) >this : Symbol(B, Decl(emitClassDeclarationWithTypeArgumentAndOverloadInES6.ts, 0, 0)) ->B : Symbol(B, Decl(emitClassDeclarationWithTypeArgumentAndOverloadInES6.ts, 1, 9)) +>B : Symbol(B.B, Decl(emitClassDeclarationWithTypeArgumentAndOverloadInES6.ts, 1, 9)) >c : Symbol(c, Decl(emitClassDeclarationWithTypeArgumentAndOverloadInES6.ts, 18, 15)) } } diff --git a/tests/baselines/reference/emitClassDeclarationWithTypeArgumentInES6.symbols b/tests/baselines/reference/emitClassDeclarationWithTypeArgumentInES6.symbols index 58f44b69f01..5db5fb703ae 100644 --- a/tests/baselines/reference/emitClassDeclarationWithTypeArgumentInES6.symbols +++ b/tests/baselines/reference/emitClassDeclarationWithTypeArgumentInES6.symbols @@ -4,48 +4,48 @@ class B { >T : Symbol(T, Decl(emitClassDeclarationWithTypeArgumentInES6.ts, 0, 8)) x: T; ->x : Symbol(x, Decl(emitClassDeclarationWithTypeArgumentInES6.ts, 0, 12)) +>x : Symbol(B.x, Decl(emitClassDeclarationWithTypeArgumentInES6.ts, 0, 12)) >T : Symbol(T, Decl(emitClassDeclarationWithTypeArgumentInES6.ts, 0, 8)) B: T; ->B : Symbol(B, Decl(emitClassDeclarationWithTypeArgumentInES6.ts, 1, 9)) +>B : Symbol(B.B, Decl(emitClassDeclarationWithTypeArgumentInES6.ts, 1, 9)) >T : Symbol(T, Decl(emitClassDeclarationWithTypeArgumentInES6.ts, 0, 8)) constructor(a: T) { this.B = a;} >a : Symbol(a, Decl(emitClassDeclarationWithTypeArgumentInES6.ts, 3, 16)) >T : Symbol(T, Decl(emitClassDeclarationWithTypeArgumentInES6.ts, 0, 8)) ->this.B : Symbol(B, Decl(emitClassDeclarationWithTypeArgumentInES6.ts, 1, 9)) +>this.B : Symbol(B.B, Decl(emitClassDeclarationWithTypeArgumentInES6.ts, 1, 9)) >this : Symbol(B, Decl(emitClassDeclarationWithTypeArgumentInES6.ts, 0, 0)) ->B : Symbol(B, Decl(emitClassDeclarationWithTypeArgumentInES6.ts, 1, 9)) +>B : Symbol(B.B, Decl(emitClassDeclarationWithTypeArgumentInES6.ts, 1, 9)) >a : Symbol(a, Decl(emitClassDeclarationWithTypeArgumentInES6.ts, 3, 16)) foo(): T { ->foo : Symbol(foo, Decl(emitClassDeclarationWithTypeArgumentInES6.ts, 3, 36)) +>foo : Symbol(B.foo, Decl(emitClassDeclarationWithTypeArgumentInES6.ts, 3, 36)) >T : Symbol(T, Decl(emitClassDeclarationWithTypeArgumentInES6.ts, 0, 8)) return this.x; ->this.x : Symbol(x, Decl(emitClassDeclarationWithTypeArgumentInES6.ts, 0, 12)) +>this.x : Symbol(B.x, Decl(emitClassDeclarationWithTypeArgumentInES6.ts, 0, 12)) >this : Symbol(B, Decl(emitClassDeclarationWithTypeArgumentInES6.ts, 0, 0)) ->x : Symbol(x, Decl(emitClassDeclarationWithTypeArgumentInES6.ts, 0, 12)) +>x : Symbol(B.x, Decl(emitClassDeclarationWithTypeArgumentInES6.ts, 0, 12)) } get BB(): T { ->BB : Symbol(BB, Decl(emitClassDeclarationWithTypeArgumentInES6.ts, 6, 5)) +>BB : Symbol(B.BB, Decl(emitClassDeclarationWithTypeArgumentInES6.ts, 6, 5)) >T : Symbol(T, Decl(emitClassDeclarationWithTypeArgumentInES6.ts, 0, 8)) return this.B; ->this.B : Symbol(B, Decl(emitClassDeclarationWithTypeArgumentInES6.ts, 1, 9)) +>this.B : Symbol(B.B, Decl(emitClassDeclarationWithTypeArgumentInES6.ts, 1, 9)) >this : Symbol(B, Decl(emitClassDeclarationWithTypeArgumentInES6.ts, 0, 0)) ->B : Symbol(B, Decl(emitClassDeclarationWithTypeArgumentInES6.ts, 1, 9)) +>B : Symbol(B.B, Decl(emitClassDeclarationWithTypeArgumentInES6.ts, 1, 9)) } set BBWith(c: T) { ->BBWith : Symbol(BBWith, Decl(emitClassDeclarationWithTypeArgumentInES6.ts, 9, 5)) +>BBWith : Symbol(B.BBWith, Decl(emitClassDeclarationWithTypeArgumentInES6.ts, 9, 5)) >c : Symbol(c, Decl(emitClassDeclarationWithTypeArgumentInES6.ts, 10, 15)) >T : Symbol(T, Decl(emitClassDeclarationWithTypeArgumentInES6.ts, 0, 8)) this.B = c; ->this.B : Symbol(B, Decl(emitClassDeclarationWithTypeArgumentInES6.ts, 1, 9)) +>this.B : Symbol(B.B, Decl(emitClassDeclarationWithTypeArgumentInES6.ts, 1, 9)) >this : Symbol(B, Decl(emitClassDeclarationWithTypeArgumentInES6.ts, 0, 0)) ->B : Symbol(B, Decl(emitClassDeclarationWithTypeArgumentInES6.ts, 1, 9)) +>B : Symbol(B.B, Decl(emitClassDeclarationWithTypeArgumentInES6.ts, 1, 9)) >c : Symbol(c, Decl(emitClassDeclarationWithTypeArgumentInES6.ts, 10, 15)) } } diff --git a/tests/baselines/reference/emitDefaultParametersMethod.symbols b/tests/baselines/reference/emitDefaultParametersMethod.symbols index 866380e2dd5..df316896d5c 100644 --- a/tests/baselines/reference/emitDefaultParametersMethod.symbols +++ b/tests/baselines/reference/emitDefaultParametersMethod.symbols @@ -9,22 +9,22 @@ class C { >y : Symbol(y, Decl(emitDefaultParametersMethod.ts, 1, 49)) public foo(x: string, t = false) { } ->foo : Symbol(foo, Decl(emitDefaultParametersMethod.ts, 1, 66)) +>foo : Symbol(C.foo, Decl(emitDefaultParametersMethod.ts, 1, 66)) >x : Symbol(x, Decl(emitDefaultParametersMethod.ts, 3, 15)) >t : Symbol(t, Decl(emitDefaultParametersMethod.ts, 3, 25)) public foo1(x: string, t = false, ...rest) { } ->foo1 : Symbol(foo1, Decl(emitDefaultParametersMethod.ts, 3, 40)) +>foo1 : Symbol(C.foo1, Decl(emitDefaultParametersMethod.ts, 3, 40)) >x : Symbol(x, Decl(emitDefaultParametersMethod.ts, 4, 16)) >t : Symbol(t, Decl(emitDefaultParametersMethod.ts, 4, 26)) >rest : Symbol(rest, Decl(emitDefaultParametersMethod.ts, 4, 37)) public bar(t = false) { } ->bar : Symbol(bar, Decl(emitDefaultParametersMethod.ts, 4, 50)) +>bar : Symbol(C.bar, Decl(emitDefaultParametersMethod.ts, 4, 50)) >t : Symbol(t, Decl(emitDefaultParametersMethod.ts, 5, 15)) public boo(t = false, ...rest) { } ->boo : Symbol(boo, Decl(emitDefaultParametersMethod.ts, 5, 29)) +>boo : Symbol(C.boo, Decl(emitDefaultParametersMethod.ts, 5, 29)) >t : Symbol(t, Decl(emitDefaultParametersMethod.ts, 6, 15)) >rest : Symbol(rest, Decl(emitDefaultParametersMethod.ts, 6, 25)) } diff --git a/tests/baselines/reference/emitDefaultParametersMethodES6.symbols b/tests/baselines/reference/emitDefaultParametersMethodES6.symbols index ce23b016bcf..e15937c1af6 100644 --- a/tests/baselines/reference/emitDefaultParametersMethodES6.symbols +++ b/tests/baselines/reference/emitDefaultParametersMethodES6.symbols @@ -9,22 +9,22 @@ class C { >y : Symbol(y, Decl(emitDefaultParametersMethodES6.ts, 1, 49)) public foo(x: string, t = false) { } ->foo : Symbol(foo, Decl(emitDefaultParametersMethodES6.ts, 1, 66)) +>foo : Symbol(C.foo, Decl(emitDefaultParametersMethodES6.ts, 1, 66)) >x : Symbol(x, Decl(emitDefaultParametersMethodES6.ts, 3, 15)) >t : Symbol(t, Decl(emitDefaultParametersMethodES6.ts, 3, 25)) public foo1(x: string, t = false, ...rest) { } ->foo1 : Symbol(foo1, Decl(emitDefaultParametersMethodES6.ts, 3, 40)) +>foo1 : Symbol(C.foo1, Decl(emitDefaultParametersMethodES6.ts, 3, 40)) >x : Symbol(x, Decl(emitDefaultParametersMethodES6.ts, 4, 16)) >t : Symbol(t, Decl(emitDefaultParametersMethodES6.ts, 4, 26)) >rest : Symbol(rest, Decl(emitDefaultParametersMethodES6.ts, 4, 37)) public bar(t = false) { } ->bar : Symbol(bar, Decl(emitDefaultParametersMethodES6.ts, 4, 50)) +>bar : Symbol(C.bar, Decl(emitDefaultParametersMethodES6.ts, 4, 50)) >t : Symbol(t, Decl(emitDefaultParametersMethodES6.ts, 5, 15)) public boo(t = false, ...rest) { } ->boo : Symbol(boo, Decl(emitDefaultParametersMethodES6.ts, 5, 29)) +>boo : Symbol(C.boo, Decl(emitDefaultParametersMethodES6.ts, 5, 29)) >t : Symbol(t, Decl(emitDefaultParametersMethodES6.ts, 6, 15)) >rest : Symbol(rest, Decl(emitDefaultParametersMethodES6.ts, 6, 25)) } diff --git a/tests/baselines/reference/emitMemberAccessExpression.symbols b/tests/baselines/reference/emitMemberAccessExpression.symbols index 64302521706..ac0f8852d2a 100644 --- a/tests/baselines/reference/emitMemberAccessExpression.symbols +++ b/tests/baselines/reference/emitMemberAccessExpression.symbols @@ -29,7 +29,7 @@ module Microsoft.PeopleAtWork.Model { >_Person : Symbol(_Person, Decl(emitMemberAccessExpression_file2.ts, 2, 37)) public populate(raw: any) { ->populate : Symbol(populate, Decl(emitMemberAccessExpression_file2.ts, 3, 26)) +>populate : Symbol(_Person.populate, Decl(emitMemberAccessExpression_file2.ts, 3, 26)) >raw : Symbol(raw, Decl(emitMemberAccessExpression_file2.ts, 4, 24)) var res = Model.KnockoutExtentions; diff --git a/tests/baselines/reference/emitRestParametersMethod.symbols b/tests/baselines/reference/emitRestParametersMethod.symbols index 2bfbda925bf..b07c410d02c 100644 --- a/tests/baselines/reference/emitRestParametersMethod.symbols +++ b/tests/baselines/reference/emitRestParametersMethod.symbols @@ -7,11 +7,11 @@ class C { >rest : Symbol(rest, Decl(emitRestParametersMethod.ts, 1, 29)) public bar(...rest) { } ->bar : Symbol(bar, Decl(emitRestParametersMethod.ts, 1, 42)) +>bar : Symbol(C.bar, Decl(emitRestParametersMethod.ts, 1, 42)) >rest : Symbol(rest, Decl(emitRestParametersMethod.ts, 3, 15)) public foo(x: number, ...rest) { } ->foo : Symbol(foo, Decl(emitRestParametersMethod.ts, 3, 27)) +>foo : Symbol(C.foo, Decl(emitRestParametersMethod.ts, 3, 27)) >x : Symbol(x, Decl(emitRestParametersMethod.ts, 4, 15)) >rest : Symbol(rest, Decl(emitRestParametersMethod.ts, 4, 25)) } @@ -23,11 +23,11 @@ class D { >rest : Symbol(rest, Decl(emitRestParametersMethod.ts, 8, 16)) public bar(...rest) { } ->bar : Symbol(bar, Decl(emitRestParametersMethod.ts, 8, 28)) +>bar : Symbol(D.bar, Decl(emitRestParametersMethod.ts, 8, 28)) >rest : Symbol(rest, Decl(emitRestParametersMethod.ts, 10, 15)) public foo(x: number, ...rest) { } ->foo : Symbol(foo, Decl(emitRestParametersMethod.ts, 10, 27)) +>foo : Symbol(D.foo, Decl(emitRestParametersMethod.ts, 10, 27)) >x : Symbol(x, Decl(emitRestParametersMethod.ts, 11, 15)) >rest : Symbol(rest, Decl(emitRestParametersMethod.ts, 11, 25)) } diff --git a/tests/baselines/reference/emitRestParametersMethodES6.symbols b/tests/baselines/reference/emitRestParametersMethodES6.symbols index e79ab9bb26e..0968d3e4585 100644 --- a/tests/baselines/reference/emitRestParametersMethodES6.symbols +++ b/tests/baselines/reference/emitRestParametersMethodES6.symbols @@ -7,11 +7,11 @@ class C { >rest : Symbol(rest, Decl(emitRestParametersMethodES6.ts, 1, 29)) public bar(...rest) { } ->bar : Symbol(bar, Decl(emitRestParametersMethodES6.ts, 1, 42)) +>bar : Symbol(C.bar, Decl(emitRestParametersMethodES6.ts, 1, 42)) >rest : Symbol(rest, Decl(emitRestParametersMethodES6.ts, 3, 15)) public foo(x: number, ...rest) { } ->foo : Symbol(foo, Decl(emitRestParametersMethodES6.ts, 3, 27)) +>foo : Symbol(C.foo, Decl(emitRestParametersMethodES6.ts, 3, 27)) >x : Symbol(x, Decl(emitRestParametersMethodES6.ts, 4, 15)) >rest : Symbol(rest, Decl(emitRestParametersMethodES6.ts, 4, 25)) } @@ -23,11 +23,11 @@ class D { >rest : Symbol(rest, Decl(emitRestParametersMethodES6.ts, 8, 16)) public bar(...rest) { } ->bar : Symbol(bar, Decl(emitRestParametersMethodES6.ts, 8, 28)) +>bar : Symbol(D.bar, Decl(emitRestParametersMethodES6.ts, 8, 28)) >rest : Symbol(rest, Decl(emitRestParametersMethodES6.ts, 10, 15)) public foo(x: number, ...rest) { } ->foo : Symbol(foo, Decl(emitRestParametersMethodES6.ts, 10, 27)) +>foo : Symbol(D.foo, Decl(emitRestParametersMethodES6.ts, 10, 27)) >x : Symbol(x, Decl(emitRestParametersMethodES6.ts, 11, 15)) >rest : Symbol(rest, Decl(emitRestParametersMethodES6.ts, 11, 25)) } diff --git a/tests/baselines/reference/emitSuperCallBeforeEmitParameterPropertyDeclaration1.js b/tests/baselines/reference/emitSuperCallBeforeEmitParameterPropertyDeclaration1.js new file mode 100644 index 00000000000..88ce3f1418b --- /dev/null +++ b/tests/baselines/reference/emitSuperCallBeforeEmitParameterPropertyDeclaration1.js @@ -0,0 +1,37 @@ +//// [emitSuperCallBeforeEmitParameterPropertyDeclaration1.ts] +class A { + blub = 6; +} + + +class B extends A { + constructor(public x: number) { + "use strict"; + 'someStringForEgngInject'; + super() + } +} + + +//// [emitSuperCallBeforeEmitParameterPropertyDeclaration1.js] +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var A = (function () { + function A() { + this.blub = 6; + } + return A; +}()); +var B = (function (_super) { + __extends(B, _super); + function B(x) { + "use strict"; + 'someStringForEgngInject'; + _super.call(this); + this.x = x; + } + return B; +}(A)); diff --git a/tests/baselines/reference/emitSuperCallBeforeEmitParameterPropertyDeclaration1.symbols b/tests/baselines/reference/emitSuperCallBeforeEmitParameterPropertyDeclaration1.symbols new file mode 100644 index 00000000000..95f21be3b2d --- /dev/null +++ b/tests/baselines/reference/emitSuperCallBeforeEmitParameterPropertyDeclaration1.symbols @@ -0,0 +1,23 @@ +=== tests/cases/compiler/emitSuperCallBeforeEmitParameterPropertyDeclaration1.ts === +class A { +>A : Symbol(A, Decl(emitSuperCallBeforeEmitParameterPropertyDeclaration1.ts, 0, 0)) + + blub = 6; +>blub : Symbol(A.blub, Decl(emitSuperCallBeforeEmitParameterPropertyDeclaration1.ts, 0, 9)) +} + + +class B extends A { +>B : Symbol(B, Decl(emitSuperCallBeforeEmitParameterPropertyDeclaration1.ts, 2, 1)) +>A : Symbol(A, Decl(emitSuperCallBeforeEmitParameterPropertyDeclaration1.ts, 0, 0)) + + constructor(public x: number) { +>x : Symbol(B.x, Decl(emitSuperCallBeforeEmitParameterPropertyDeclaration1.ts, 6, 16)) + + "use strict"; + 'someStringForEgngInject'; + super() +>super : Symbol(A, Decl(emitSuperCallBeforeEmitParameterPropertyDeclaration1.ts, 0, 0)) + } +} + diff --git a/tests/baselines/reference/emitSuperCallBeforeEmitParameterPropertyDeclaration1.types b/tests/baselines/reference/emitSuperCallBeforeEmitParameterPropertyDeclaration1.types new file mode 100644 index 00000000000..cfdf0af0300 --- /dev/null +++ b/tests/baselines/reference/emitSuperCallBeforeEmitParameterPropertyDeclaration1.types @@ -0,0 +1,29 @@ +=== tests/cases/compiler/emitSuperCallBeforeEmitParameterPropertyDeclaration1.ts === +class A { +>A : A + + blub = 6; +>blub : number +>6 : number +} + + +class B extends A { +>B : B +>A : A + + constructor(public x: number) { +>x : number + + "use strict"; +>"use strict" : string + + 'someStringForEgngInject'; +>'someStringForEgngInject' : string + + super() +>super() : void +>super : typeof A + } +} + diff --git a/tests/baselines/reference/emitSuperCallBeforeEmitParameterPropertyDeclaration1ES6.js b/tests/baselines/reference/emitSuperCallBeforeEmitParameterPropertyDeclaration1ES6.js new file mode 100644 index 00000000000..2e594dba0ec --- /dev/null +++ b/tests/baselines/reference/emitSuperCallBeforeEmitParameterPropertyDeclaration1ES6.js @@ -0,0 +1,29 @@ +//// [emitSuperCallBeforeEmitParameterPropertyDeclaration1ES6.ts] +class A { + blub = 6; +} + + +class B extends A { + constructor(public x: number) { + "use strict"; + 'someStringForEgngInject'; + super() + } +} + + +//// [emitSuperCallBeforeEmitParameterPropertyDeclaration1ES6.js] +class A { + constructor() { + this.blub = 6; + } +} +class B extends A { + constructor(x) { + "use strict"; + 'someStringForEgngInject'; + super(); + this.x = x; + } +} diff --git a/tests/baselines/reference/emitSuperCallBeforeEmitParameterPropertyDeclaration1ES6.symbols b/tests/baselines/reference/emitSuperCallBeforeEmitParameterPropertyDeclaration1ES6.symbols new file mode 100644 index 00000000000..0b11b7079e5 --- /dev/null +++ b/tests/baselines/reference/emitSuperCallBeforeEmitParameterPropertyDeclaration1ES6.symbols @@ -0,0 +1,23 @@ +=== tests/cases/compiler/emitSuperCallBeforeEmitParameterPropertyDeclaration1ES6.ts === +class A { +>A : Symbol(A, Decl(emitSuperCallBeforeEmitParameterPropertyDeclaration1ES6.ts, 0, 0)) + + blub = 6; +>blub : Symbol(A.blub, Decl(emitSuperCallBeforeEmitParameterPropertyDeclaration1ES6.ts, 0, 9)) +} + + +class B extends A { +>B : Symbol(B, Decl(emitSuperCallBeforeEmitParameterPropertyDeclaration1ES6.ts, 2, 1)) +>A : Symbol(A, Decl(emitSuperCallBeforeEmitParameterPropertyDeclaration1ES6.ts, 0, 0)) + + constructor(public x: number) { +>x : Symbol(B.x, Decl(emitSuperCallBeforeEmitParameterPropertyDeclaration1ES6.ts, 6, 16)) + + "use strict"; + 'someStringForEgngInject'; + super() +>super : Symbol(A, Decl(emitSuperCallBeforeEmitParameterPropertyDeclaration1ES6.ts, 0, 0)) + } +} + diff --git a/tests/baselines/reference/emitSuperCallBeforeEmitParameterPropertyDeclaration1ES6.types b/tests/baselines/reference/emitSuperCallBeforeEmitParameterPropertyDeclaration1ES6.types new file mode 100644 index 00000000000..4424042c241 --- /dev/null +++ b/tests/baselines/reference/emitSuperCallBeforeEmitParameterPropertyDeclaration1ES6.types @@ -0,0 +1,29 @@ +=== tests/cases/compiler/emitSuperCallBeforeEmitParameterPropertyDeclaration1ES6.ts === +class A { +>A : A + + blub = 6; +>blub : number +>6 : number +} + + +class B extends A { +>B : B +>A : A + + constructor(public x: number) { +>x : number + + "use strict"; +>"use strict" : string + + 'someStringForEgngInject'; +>'someStringForEgngInject' : string + + super() +>super() : void +>super : typeof A + } +} + diff --git a/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclaration1.js b/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclaration1.js new file mode 100644 index 00000000000..920ad1f7bda --- /dev/null +++ b/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclaration1.js @@ -0,0 +1,39 @@ +//// [emitSuperCallBeforeEmitPropertyDeclaration1.ts] +class A { + blub = 6; +} + + +class B extends A { + + blub = 12; + + constructor() { + "use strict"; + 'someStringForEgngInject'; + super() + } +} + +//// [emitSuperCallBeforeEmitPropertyDeclaration1.js] +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var A = (function () { + function A() { + this.blub = 6; + } + return A; +}()); +var B = (function (_super) { + __extends(B, _super); + function B() { + "use strict"; + 'someStringForEgngInject'; + _super.call(this); + this.blub = 12; + } + return B; +}(A)); diff --git a/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclaration1.symbols b/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclaration1.symbols new file mode 100644 index 00000000000..d4101787c83 --- /dev/null +++ b/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclaration1.symbols @@ -0,0 +1,23 @@ +=== tests/cases/compiler/emitSuperCallBeforeEmitPropertyDeclaration1.ts === +class A { +>A : Symbol(A, Decl(emitSuperCallBeforeEmitPropertyDeclaration1.ts, 0, 0)) + + blub = 6; +>blub : Symbol(A.blub, Decl(emitSuperCallBeforeEmitPropertyDeclaration1.ts, 0, 9)) +} + + +class B extends A { +>B : Symbol(B, Decl(emitSuperCallBeforeEmitPropertyDeclaration1.ts, 2, 1)) +>A : Symbol(A, Decl(emitSuperCallBeforeEmitPropertyDeclaration1.ts, 0, 0)) + + blub = 12; +>blub : Symbol(B.blub, Decl(emitSuperCallBeforeEmitPropertyDeclaration1.ts, 5, 19)) + + constructor() { + "use strict"; + 'someStringForEgngInject'; + super() +>super : Symbol(A, Decl(emitSuperCallBeforeEmitPropertyDeclaration1.ts, 0, 0)) + } +} diff --git a/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclaration1.types b/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclaration1.types new file mode 100644 index 00000000000..2d16fed121d --- /dev/null +++ b/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclaration1.types @@ -0,0 +1,30 @@ +=== tests/cases/compiler/emitSuperCallBeforeEmitPropertyDeclaration1.ts === +class A { +>A : A + + blub = 6; +>blub : number +>6 : number +} + + +class B extends A { +>B : B +>A : A + + blub = 12; +>blub : number +>12 : number + + constructor() { + "use strict"; +>"use strict" : string + + 'someStringForEgngInject'; +>'someStringForEgngInject' : string + + super() +>super() : void +>super : typeof A + } +} diff --git a/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclaration1ES6.js b/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclaration1ES6.js new file mode 100644 index 00000000000..4b3e9e73b9f --- /dev/null +++ b/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclaration1ES6.js @@ -0,0 +1,29 @@ +//// [emitSuperCallBeforeEmitPropertyDeclaration1ES6.ts] +class A { + blub = 6; +} + + +class B extends A { + + blub = 12; + + constructor() { + 'someStringForEgngInject'; + super() + } +} + +//// [emitSuperCallBeforeEmitPropertyDeclaration1ES6.js] +class A { + constructor() { + this.blub = 6; + } +} +class B extends A { + constructor() { + 'someStringForEgngInject'; + super(); + this.blub = 12; + } +} diff --git a/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclaration1ES6.symbols b/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclaration1ES6.symbols new file mode 100644 index 00000000000..4018bfa664c --- /dev/null +++ b/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclaration1ES6.symbols @@ -0,0 +1,22 @@ +=== tests/cases/compiler/emitSuperCallBeforeEmitPropertyDeclaration1ES6.ts === +class A { +>A : Symbol(A, Decl(emitSuperCallBeforeEmitPropertyDeclaration1ES6.ts, 0, 0)) + + blub = 6; +>blub : Symbol(A.blub, Decl(emitSuperCallBeforeEmitPropertyDeclaration1ES6.ts, 0, 9)) +} + + +class B extends A { +>B : Symbol(B, Decl(emitSuperCallBeforeEmitPropertyDeclaration1ES6.ts, 2, 1)) +>A : Symbol(A, Decl(emitSuperCallBeforeEmitPropertyDeclaration1ES6.ts, 0, 0)) + + blub = 12; +>blub : Symbol(B.blub, Decl(emitSuperCallBeforeEmitPropertyDeclaration1ES6.ts, 5, 19)) + + constructor() { + 'someStringForEgngInject'; + super() +>super : Symbol(A, Decl(emitSuperCallBeforeEmitPropertyDeclaration1ES6.ts, 0, 0)) + } +} diff --git a/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclaration1ES6.types b/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclaration1ES6.types new file mode 100644 index 00000000000..39e8f885777 --- /dev/null +++ b/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclaration1ES6.types @@ -0,0 +1,27 @@ +=== tests/cases/compiler/emitSuperCallBeforeEmitPropertyDeclaration1ES6.ts === +class A { +>A : A + + blub = 6; +>blub : number +>6 : number +} + + +class B extends A { +>B : B +>A : A + + blub = 12; +>blub : number +>12 : number + + constructor() { + 'someStringForEgngInject'; +>'someStringForEgngInject' : string + + super() +>super() : void +>super : typeof A + } +} diff --git a/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.js b/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.js new file mode 100644 index 00000000000..3fa18140034 --- /dev/null +++ b/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.js @@ -0,0 +1,38 @@ +//// [emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.ts] +class A { + blub = 6; +} + + +class B extends A { + blah = 2; + constructor(public x: number) { + "use strict"; + 'someStringForEgngInject'; + super() + } +} + +//// [emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.js] +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var A = (function () { + function A() { + this.blub = 6; + } + return A; +}()); +var B = (function (_super) { + __extends(B, _super); + function B(x) { + "use strict"; + 'someStringForEgngInject'; + _super.call(this); + this.x = x; + this.blah = 2; + } + return B; +}(A)); diff --git a/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.symbols b/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.symbols new file mode 100644 index 00000000000..0904aeaf477 --- /dev/null +++ b/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.symbols @@ -0,0 +1,25 @@ +=== tests/cases/compiler/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.ts === +class A { +>A : Symbol(A, Decl(emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.ts, 0, 0)) + + blub = 6; +>blub : Symbol(A.blub, Decl(emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.ts, 0, 9)) +} + + +class B extends A { +>B : Symbol(B, Decl(emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.ts, 2, 1)) +>A : Symbol(A, Decl(emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.ts, 0, 0)) + + blah = 2; +>blah : Symbol(B.blah, Decl(emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.ts, 5, 19)) + + constructor(public x: number) { +>x : Symbol(B.x, Decl(emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.ts, 7, 16)) + + "use strict"; + 'someStringForEgngInject'; + super() +>super : Symbol(A, Decl(emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.ts, 0, 0)) + } +} diff --git a/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.types b/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.types new file mode 100644 index 00000000000..acb5703581a --- /dev/null +++ b/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.types @@ -0,0 +1,32 @@ +=== tests/cases/compiler/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.ts === +class A { +>A : A + + blub = 6; +>blub : number +>6 : number +} + + +class B extends A { +>B : B +>A : A + + blah = 2; +>blah : number +>2 : number + + constructor(public x: number) { +>x : number + + "use strict"; +>"use strict" : string + + 'someStringForEgngInject'; +>'someStringForEgngInject' : string + + super() +>super() : void +>super : typeof A + } +} diff --git a/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1ES6.js b/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1ES6.js new file mode 100644 index 00000000000..5e27acf8d9a --- /dev/null +++ b/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1ES6.js @@ -0,0 +1,30 @@ +//// [emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1ES6.ts] +class A { + blub = 6; +} + + +class B extends A { + blah = 2; + constructor(public x: number) { + "use strict"; + 'someStringForEgngInject'; + super() + } +} + +//// [emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1ES6.js] +class A { + constructor() { + this.blub = 6; + } +} +class B extends A { + constructor(x) { + "use strict"; + 'someStringForEgngInject'; + super(); + this.x = x; + this.blah = 2; + } +} diff --git a/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1ES6.symbols b/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1ES6.symbols new file mode 100644 index 00000000000..ed0089cdbe2 --- /dev/null +++ b/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1ES6.symbols @@ -0,0 +1,25 @@ +=== tests/cases/compiler/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1ES6.ts === +class A { +>A : Symbol(A, Decl(emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1ES6.ts, 0, 0)) + + blub = 6; +>blub : Symbol(A.blub, Decl(emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1ES6.ts, 0, 9)) +} + + +class B extends A { +>B : Symbol(B, Decl(emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1ES6.ts, 2, 1)) +>A : Symbol(A, Decl(emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1ES6.ts, 0, 0)) + + blah = 2; +>blah : Symbol(B.blah, Decl(emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1ES6.ts, 5, 19)) + + constructor(public x: number) { +>x : Symbol(B.x, Decl(emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1ES6.ts, 7, 16)) + + "use strict"; + 'someStringForEgngInject'; + super() +>super : Symbol(A, Decl(emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1ES6.ts, 0, 0)) + } +} diff --git a/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1ES6.types b/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1ES6.types new file mode 100644 index 00000000000..96fc1fc2dc3 --- /dev/null +++ b/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1ES6.types @@ -0,0 +1,32 @@ +=== tests/cases/compiler/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1ES6.ts === +class A { +>A : A + + blub = 6; +>blub : number +>6 : number +} + + +class B extends A { +>B : B +>A : A + + blah = 2; +>blah : number +>2 : number + + constructor(public x: number) { +>x : number + + "use strict"; +>"use strict" : string + + 'someStringForEgngInject'; +>'someStringForEgngInject' : string + + super() +>super() : void +>super : typeof A + } +} diff --git a/tests/baselines/reference/emptyIndexer.symbols b/tests/baselines/reference/emptyIndexer.symbols index 6c3bad02349..3fe3844eb81 100644 --- a/tests/baselines/reference/emptyIndexer.symbols +++ b/tests/baselines/reference/emptyIndexer.symbols @@ -3,7 +3,7 @@ interface I1 { >I1 : Symbol(I1, Decl(emptyIndexer.ts, 0, 0)) m(): number; ->m : Symbol(m, Decl(emptyIndexer.ts, 0, 14)) +>m : Symbol(I1.m, Decl(emptyIndexer.ts, 0, 14)) } interface I2 { diff --git a/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES5.types b/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES5.types index ed6b935db0f..3640d468a59 100644 --- a/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES5.types +++ b/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES5.types @@ -62,7 +62,7 @@ } function f({} = a, [] = a, { p: {} = a} = a) { ->f : ({}?: any, []?: any, { p: {} = a}?: any) => ({}?: any, []?: any, { p: {} = a }?: any) => any +>f : ({}?: any, []?: any, {p: {}}?: any) => ({}?: any, []?: any, {p: {}}?: any) => any >a : any >a : any >p : any @@ -70,7 +70,7 @@ >a : any return ({} = a, [] = a, { p: {} = a } = a) => a; ->({} = a, [] = a, { p: {} = a } = a) => a : ({}?: any, []?: any, { p: {} = a }?: any) => any +>({} = a, [] = a, { p: {} = a } = a) => a : ({}?: any, []?: any, {p: {}}?: any) => any >a : any >a : any >p : any diff --git a/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES6.types b/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES6.types index fcb48048148..20b7d5ec2b6 100644 --- a/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES6.types +++ b/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES6.types @@ -62,7 +62,7 @@ } function f({} = a, [] = a, { p: {} = a} = a) { ->f : ({}?: any, []?: any, { p: {} = a}?: any) => ({}?: any, []?: any, { p: {} = a }?: any) => any +>f : ({}?: any, []?: any, {p: {}}?: any) => ({}?: any, []?: any, {p: {}}?: any) => any >a : any >a : any >p : any @@ -70,7 +70,7 @@ >a : any return ({} = a, [] = a, { p: {} = a } = a) => a; ->({} = a, [] = a, { p: {} = a } = a) => a : ({}?: any, []?: any, { p: {} = a }?: any) => any +>({} = a, [] = a, { p: {} = a } = a) => a : ({}?: any, []?: any, {p: {}}?: any) => any >a : any >a : any >p : any diff --git a/tests/baselines/reference/enumAssignability.errors.txt b/tests/baselines/reference/enumAssignability.errors.txt index 1316727076f..bfabb5eae88 100644 --- a/tests/baselines/reference/enumAssignability.errors.txt +++ b/tests/baselines/reference/enumAssignability.errors.txt @@ -3,23 +3,16 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssi tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(29,9): error TS2322: Type 'E' is not assignable to type 'string'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(30,9): error TS2322: Type 'E' is not assignable to type 'boolean'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(31,9): error TS2322: Type 'E' is not assignable to type 'Date'. - Property 'toDateString' is missing in type 'Number'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(33,9): error TS2322: Type 'E' is not assignable to type 'void'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(36,9): error TS2322: Type 'E' is not assignable to type '() => {}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(37,9): error TS2322: Type 'E' is not assignable to type 'Function'. - Property 'apply' is missing in type 'Number'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(38,9): error TS2322: Type 'E' is not assignable to type '(x: number) => string'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(39,5): error TS2322: Type 'E' is not assignable to type 'C'. - Property 'foo' is missing in type 'Number'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(40,5): error TS2322: Type 'E' is not assignable to type 'I'. - Property 'foo' is missing in type 'Number'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(41,9): error TS2322: Type 'E' is not assignable to type 'number[]'. - Property 'length' is missing in type 'Number'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(42,9): error TS2322: Type 'E' is not assignable to type '{ foo: string; }'. - Property 'foo' is missing in type 'Number'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(43,9): error TS2322: Type 'E' is not assignable to type '(x: T) => T'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(45,9): error TS2322: Type 'E' is not assignable to type 'String'. - Property 'charAt' is missing in type 'Number'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(48,9): error TS2322: Type 'E' is not assignable to type 'T'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(49,9): error TS2322: Type 'E' is not assignable to type 'U'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(50,9): error TS2322: Type 'E' is not assignable to type 'V'. @@ -69,7 +62,6 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssi var ee: Date = e; ~~ !!! error TS2322: Type 'E' is not assignable to type 'Date'. -!!! error TS2322: Property 'toDateString' is missing in type 'Number'. var f: any = e; // ok var g: void = e; ~ @@ -82,26 +74,21 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssi var k: Function = e; ~ !!! error TS2322: Type 'E' is not assignable to type 'Function'. -!!! error TS2322: Property 'apply' is missing in type 'Number'. var l: (x: number) => string = e; ~ !!! error TS2322: Type 'E' is not assignable to type '(x: number) => string'. ac = e; ~~ !!! error TS2322: Type 'E' is not assignable to type 'C'. -!!! error TS2322: Property 'foo' is missing in type 'Number'. ai = e; ~~ !!! error TS2322: Type 'E' is not assignable to type 'I'. -!!! error TS2322: Property 'foo' is missing in type 'Number'. var m: number[] = e; ~ !!! error TS2322: Type 'E' is not assignable to type 'number[]'. -!!! error TS2322: Property 'length' is missing in type 'Number'. var n: { foo: string } = e; ~ !!! error TS2322: Type 'E' is not assignable to type '{ foo: string; }'. -!!! error TS2322: Property 'foo' is missing in type 'Number'. var o: (x: T) => T = e; ~ !!! error TS2322: Type 'E' is not assignable to type '(x: T) => T'. @@ -109,7 +96,6 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssi var q: String = e; ~ !!! error TS2322: Type 'E' is not assignable to type 'String'. -!!! error TS2322: Property 'charAt' is missing in type 'Number'. function foo(x: T, y: U, z: V) { x = e; diff --git a/tests/baselines/reference/enumAssignmentCompat.errors.txt b/tests/baselines/reference/enumAssignmentCompat.errors.txt index 3cddaf45966..f1a01247146 100644 --- a/tests/baselines/reference/enumAssignmentCompat.errors.txt +++ b/tests/baselines/reference/enumAssignmentCompat.errors.txt @@ -1,9 +1,7 @@ tests/cases/compiler/enumAssignmentCompat.ts(26,5): error TS2322: Type 'typeof W' is not assignable to type 'number'. tests/cases/compiler/enumAssignmentCompat.ts(28,5): error TS2322: Type 'W' is not assignable to type 'typeof W'. - Property 'D' is missing in type 'Number'. tests/cases/compiler/enumAssignmentCompat.ts(30,5): error TS2322: Type 'number' is not assignable to type 'typeof W'. tests/cases/compiler/enumAssignmentCompat.ts(32,5): error TS2322: Type 'W' is not assignable to type 'WStatic'. - Property 'a' is missing in type 'Number'. tests/cases/compiler/enumAssignmentCompat.ts(33,5): error TS2322: Type 'number' is not assignable to type 'WStatic'. @@ -40,7 +38,6 @@ tests/cases/compiler/enumAssignmentCompat.ts(33,5): error TS2322: Type 'number' var b: typeof W = W.a; // error ~ !!! error TS2322: Type 'W' is not assignable to type 'typeof W'. -!!! error TS2322: Property 'D' is missing in type 'Number'. var c: typeof W.a = W.a; var d: typeof W = 3; // error ~ @@ -49,7 +46,6 @@ tests/cases/compiler/enumAssignmentCompat.ts(33,5): error TS2322: Type 'number' var f: WStatic = W.a; // error ~ !!! error TS2322: Type 'W' is not assignable to type 'WStatic'. -!!! error TS2322: Property 'a' is missing in type 'Number'. var g: WStatic = 5; // error ~ !!! error TS2322: Type 'number' is not assignable to type 'WStatic'. diff --git a/tests/baselines/reference/enumAssignmentCompat2.errors.txt b/tests/baselines/reference/enumAssignmentCompat2.errors.txt index d87d6acf6a0..4e0660eaae3 100644 --- a/tests/baselines/reference/enumAssignmentCompat2.errors.txt +++ b/tests/baselines/reference/enumAssignmentCompat2.errors.txt @@ -1,9 +1,7 @@ tests/cases/compiler/enumAssignmentCompat2.ts(25,5): error TS2322: Type 'typeof W' is not assignable to type 'number'. tests/cases/compiler/enumAssignmentCompat2.ts(27,5): error TS2322: Type 'W' is not assignable to type 'typeof W'. - Property 'a' is missing in type 'Number'. tests/cases/compiler/enumAssignmentCompat2.ts(29,5): error TS2322: Type 'number' is not assignable to type 'typeof W'. tests/cases/compiler/enumAssignmentCompat2.ts(31,5): error TS2322: Type 'W' is not assignable to type 'WStatic'. - Property 'a' is missing in type 'Number'. tests/cases/compiler/enumAssignmentCompat2.ts(32,5): error TS2322: Type 'number' is not assignable to type 'WStatic'. @@ -39,7 +37,6 @@ tests/cases/compiler/enumAssignmentCompat2.ts(32,5): error TS2322: Type 'number' var b: typeof W = W.a; // error ~ !!! error TS2322: Type 'W' is not assignable to type 'typeof W'. -!!! error TS2322: Property 'a' is missing in type 'Number'. var c: typeof W.a = W.a; var d: typeof W = 3; // error ~ @@ -48,7 +45,6 @@ tests/cases/compiler/enumAssignmentCompat2.ts(32,5): error TS2322: Type 'number' var f: WStatic = W.a; // error ~ !!! error TS2322: Type 'W' is not assignable to type 'WStatic'. -!!! error TS2322: Property 'a' is missing in type 'Number'. var g: WStatic = 5; // error ~ !!! error TS2322: Type 'number' is not assignable to type 'WStatic'. diff --git a/tests/baselines/reference/enumAssignmentCompat4.js b/tests/baselines/reference/enumAssignmentCompat4.js new file mode 100644 index 00000000000..ad28324ce0f --- /dev/null +++ b/tests/baselines/reference/enumAssignmentCompat4.js @@ -0,0 +1,51 @@ +//// [enumAssignmentCompat4.ts] +namespace M { + export enum MyEnum { + BAR + } + export var object2 = { + foo: MyEnum.BAR + }; +} + +namespace N { + export enum MyEnum { + FOO + }; + export var object1 = { + foo: MyEnum.FOO + }; +} + +let broken = [ + N.object1, + M.object2 +]; + + +//// [enumAssignmentCompat4.js] +var M; +(function (M) { + (function (MyEnum) { + MyEnum[MyEnum["BAR"] = 0] = "BAR"; + })(M.MyEnum || (M.MyEnum = {})); + var MyEnum = M.MyEnum; + M.object2 = { + foo: MyEnum.BAR + }; +})(M || (M = {})); +var N; +(function (N) { + (function (MyEnum) { + MyEnum[MyEnum["FOO"] = 0] = "FOO"; + })(N.MyEnum || (N.MyEnum = {})); + var MyEnum = N.MyEnum; + ; + N.object1 = { + foo: MyEnum.FOO + }; +})(N || (N = {})); +var broken = [ + N.object1, + M.object2 +]; diff --git a/tests/baselines/reference/enumAssignmentCompat4.symbols b/tests/baselines/reference/enumAssignmentCompat4.symbols new file mode 100644 index 00000000000..a3a80731610 --- /dev/null +++ b/tests/baselines/reference/enumAssignmentCompat4.symbols @@ -0,0 +1,59 @@ +=== tests/cases/compiler/enumAssignmentCompat4.ts === +namespace M { +>M : Symbol(M, Decl(enumAssignmentCompat4.ts, 0, 0)) + + export enum MyEnum { +>MyEnum : Symbol(MyEnum, Decl(enumAssignmentCompat4.ts, 0, 13)) + + BAR +>BAR : Symbol(MyEnum.BAR, Decl(enumAssignmentCompat4.ts, 1, 24)) + } + export var object2 = { +>object2 : Symbol(object2, Decl(enumAssignmentCompat4.ts, 4, 14)) + + foo: MyEnum.BAR +>foo : Symbol(foo, Decl(enumAssignmentCompat4.ts, 4, 26)) +>MyEnum.BAR : Symbol(MyEnum.BAR, Decl(enumAssignmentCompat4.ts, 1, 24)) +>MyEnum : Symbol(MyEnum, Decl(enumAssignmentCompat4.ts, 0, 13)) +>BAR : Symbol(MyEnum.BAR, Decl(enumAssignmentCompat4.ts, 1, 24)) + + }; +} + +namespace N { +>N : Symbol(N, Decl(enumAssignmentCompat4.ts, 7, 1)) + + export enum MyEnum { +>MyEnum : Symbol(MyEnum, Decl(enumAssignmentCompat4.ts, 9, 13)) + + FOO +>FOO : Symbol(MyEnum.FOO, Decl(enumAssignmentCompat4.ts, 10, 24)) + + }; + export var object1 = { +>object1 : Symbol(object1, Decl(enumAssignmentCompat4.ts, 13, 14)) + + foo: MyEnum.FOO +>foo : Symbol(foo, Decl(enumAssignmentCompat4.ts, 13, 26)) +>MyEnum.FOO : Symbol(MyEnum.FOO, Decl(enumAssignmentCompat4.ts, 10, 24)) +>MyEnum : Symbol(MyEnum, Decl(enumAssignmentCompat4.ts, 9, 13)) +>FOO : Symbol(MyEnum.FOO, Decl(enumAssignmentCompat4.ts, 10, 24)) + + }; +} + +let broken = [ +>broken : Symbol(broken, Decl(enumAssignmentCompat4.ts, 18, 3)) + + N.object1, +>N.object1 : Symbol(N.object1, Decl(enumAssignmentCompat4.ts, 13, 14)) +>N : Symbol(N, Decl(enumAssignmentCompat4.ts, 7, 1)) +>object1 : Symbol(N.object1, Decl(enumAssignmentCompat4.ts, 13, 14)) + + M.object2 +>M.object2 : Symbol(M.object2, Decl(enumAssignmentCompat4.ts, 4, 14)) +>M : Symbol(M, Decl(enumAssignmentCompat4.ts, 0, 0)) +>object2 : Symbol(M.object2, Decl(enumAssignmentCompat4.ts, 4, 14)) + +]; + diff --git a/tests/baselines/reference/enumAssignmentCompat4.types b/tests/baselines/reference/enumAssignmentCompat4.types new file mode 100644 index 00000000000..db7f5ce8ba2 --- /dev/null +++ b/tests/baselines/reference/enumAssignmentCompat4.types @@ -0,0 +1,62 @@ +=== tests/cases/compiler/enumAssignmentCompat4.ts === +namespace M { +>M : typeof M + + export enum MyEnum { +>MyEnum : MyEnum + + BAR +>BAR : MyEnum + } + export var object2 = { +>object2 : { foo: MyEnum; } +>{ foo: MyEnum.BAR } : { foo: MyEnum; } + + foo: MyEnum.BAR +>foo : MyEnum +>MyEnum.BAR : MyEnum +>MyEnum : typeof MyEnum +>BAR : MyEnum + + }; +} + +namespace N { +>N : typeof N + + export enum MyEnum { +>MyEnum : MyEnum + + FOO +>FOO : MyEnum + + }; + export var object1 = { +>object1 : { foo: MyEnum; } +>{ foo: MyEnum.FOO } : { foo: MyEnum; } + + foo: MyEnum.FOO +>foo : MyEnum +>MyEnum.FOO : MyEnum +>MyEnum : typeof MyEnum +>FOO : MyEnum + + }; +} + +let broken = [ +>broken : ({ foo: N.MyEnum; } | { foo: M.MyEnum; })[] +>[ N.object1, M.object2] : ({ foo: N.MyEnum; } | { foo: M.MyEnum; })[] + + N.object1, +>N.object1 : { foo: N.MyEnum; } +>N : typeof N +>object1 : { foo: N.MyEnum; } + + M.object2 +>M.object2 : { foo: M.MyEnum; } +>M : typeof M +>object2 : { foo: M.MyEnum; } + +]; + diff --git a/tests/baselines/reference/enumBasics.js b/tests/baselines/reference/enumBasics.js index 25aec5a72d8..4ac41c0f3d1 100644 --- a/tests/baselines/reference/enumBasics.js +++ b/tests/baselines/reference/enumBasics.js @@ -12,10 +12,10 @@ var x: number = E1.A; // Enum object type is anonymous with properties of the enum type and numeric indexer var e = E1; var e: { - A: E1; - B: E1; - C: E1; - [n: number]: string; + readonly A: E1; + readonly B: E1; + readonly C: E1; + readonly [n: number]: string; }; var e: typeof E1; diff --git a/tests/baselines/reference/enumBasics.symbols b/tests/baselines/reference/enumBasics.symbols index 23f2a400741..ce81a80ca5f 100644 --- a/tests/baselines/reference/enumBasics.symbols +++ b/tests/baselines/reference/enumBasics.symbols @@ -28,20 +28,20 @@ var e = E1; var e: { >e : Symbol(e, Decl(enumBasics.ts, 11, 3), Decl(enumBasics.ts, 12, 3), Decl(enumBasics.ts, 18, 3)) - A: E1; + readonly A: E1; >A : Symbol(A, Decl(enumBasics.ts, 12, 8)) >E1 : Symbol(E1, Decl(enumBasics.ts, 0, 0)) - B: E1; ->B : Symbol(B, Decl(enumBasics.ts, 13, 10)) + readonly B: E1; +>B : Symbol(B, Decl(enumBasics.ts, 13, 19)) >E1 : Symbol(E1, Decl(enumBasics.ts, 0, 0)) - C: E1; ->C : Symbol(C, Decl(enumBasics.ts, 14, 10)) + readonly C: E1; +>C : Symbol(C, Decl(enumBasics.ts, 14, 19)) >E1 : Symbol(E1, Decl(enumBasics.ts, 0, 0)) - [n: number]: string; ->n : Symbol(n, Decl(enumBasics.ts, 16, 5)) + readonly [n: number]: string; +>n : Symbol(n, Decl(enumBasics.ts, 16, 14)) }; var e: typeof E1; diff --git a/tests/baselines/reference/enumBasics.types b/tests/baselines/reference/enumBasics.types index 87f6f12b6b2..cecd8f51136 100644 --- a/tests/baselines/reference/enumBasics.types +++ b/tests/baselines/reference/enumBasics.types @@ -28,19 +28,19 @@ var e = E1; var e: { >e : typeof E1 - A: E1; + readonly A: E1; >A : E1 >E1 : E1 - B: E1; + readonly B: E1; >B : E1 >E1 : E1 - C: E1; + readonly C: E1; >C : E1 >E1 : E1 - [n: number]: string; + readonly [n: number]: string; >n : number }; diff --git a/tests/baselines/reference/equalityStrictNulls.errors.txt b/tests/baselines/reference/equalityStrictNulls.errors.txt new file mode 100644 index 00000000000..54b581c87e6 --- /dev/null +++ b/tests/baselines/reference/equalityStrictNulls.errors.txt @@ -0,0 +1,84 @@ +tests/cases/conformance/types/typeRelationships/comparable/equalityStrictNulls.ts(60,9): error TS2365: Operator '>' cannot be applied to types 'number' and 'undefined'. +tests/cases/conformance/types/typeRelationships/comparable/equalityStrictNulls.ts(62,9): error TS2365: Operator '<' cannot be applied to types 'number' and 'undefined'. +tests/cases/conformance/types/typeRelationships/comparable/equalityStrictNulls.ts(64,9): error TS2365: Operator '>=' cannot be applied to types 'number' and 'undefined'. +tests/cases/conformance/types/typeRelationships/comparable/equalityStrictNulls.ts(66,9): error TS2365: Operator '<=' cannot be applied to types 'number' and 'undefined'. + + +==== tests/cases/conformance/types/typeRelationships/comparable/equalityStrictNulls.ts (4 errors) ==== + + function f1(x: string) { + if (x == undefined) { + } + if (x != undefined) { + } + if (x === undefined) { + } + if (x !== undefined) { + } + if (x == null) { + } + if (x != null) { + } + if (x === null) { + } + if (x !== null) { + } + if (undefined == x) { + } + if (undefined != x) { + } + if (undefined === x) { + } + if (undefined !== x) { + } + if (null == x) { + } + if (null != x) { + } + if (null === x) { + } + if (null !== x) { + } + } + + function f2() { + if (undefined == undefined) { + } + if (undefined == null) { + } + if (null == undefined) { + } + if (null == null) { + } + } + + function f3(a: number, b: boolean, c: { x: number }, d: number | string) { + if (a == null) { + } + if (b == null) { + } + if (c == null) { + } + if (d == null) { + } + } + + function f4(x: number) { + if (x > undefined) { + ~~~~~~~~~~~~~ +!!! error TS2365: Operator '>' cannot be applied to types 'number' and 'undefined'. + } + if (x < undefined) { + ~~~~~~~~~~~~~ +!!! error TS2365: Operator '<' cannot be applied to types 'number' and 'undefined'. + } + if (x >= undefined) { + ~~~~~~~~~~~~~~ +!!! error TS2365: Operator '>=' cannot be applied to types 'number' and 'undefined'. + } + if (x <= undefined) { + ~~~~~~~~~~~~~~ +!!! error TS2365: Operator '<=' cannot be applied to types 'number' and 'undefined'. + } + } + \ No newline at end of file diff --git a/tests/baselines/reference/equalityStrictNulls.js b/tests/baselines/reference/equalityStrictNulls.js new file mode 100644 index 00000000000..99ff801a52c --- /dev/null +++ b/tests/baselines/reference/equalityStrictNulls.js @@ -0,0 +1,136 @@ +//// [equalityStrictNulls.ts] + +function f1(x: string) { + if (x == undefined) { + } + if (x != undefined) { + } + if (x === undefined) { + } + if (x !== undefined) { + } + if (x == null) { + } + if (x != null) { + } + if (x === null) { + } + if (x !== null) { + } + if (undefined == x) { + } + if (undefined != x) { + } + if (undefined === x) { + } + if (undefined !== x) { + } + if (null == x) { + } + if (null != x) { + } + if (null === x) { + } + if (null !== x) { + } +} + +function f2() { + if (undefined == undefined) { + } + if (undefined == null) { + } + if (null == undefined) { + } + if (null == null) { + } +} + +function f3(a: number, b: boolean, c: { x: number }, d: number | string) { + if (a == null) { + } + if (b == null) { + } + if (c == null) { + } + if (d == null) { + } +} + +function f4(x: number) { + if (x > undefined) { + } + if (x < undefined) { + } + if (x >= undefined) { + } + if (x <= undefined) { + } +} + + +//// [equalityStrictNulls.js] +function f1(x) { + if (x == undefined) { + } + if (x != undefined) { + } + if (x === undefined) { + } + if (x !== undefined) { + } + if (x == null) { + } + if (x != null) { + } + if (x === null) { + } + if (x !== null) { + } + if (undefined == x) { + } + if (undefined != x) { + } + if (undefined === x) { + } + if (undefined !== x) { + } + if (null == x) { + } + if (null != x) { + } + if (null === x) { + } + if (null !== x) { + } +} +function f2() { + if (undefined == undefined) { + } + if (undefined == null) { + } + if (null == undefined) { + } + if (null == null) { + } +} +function f3(a, b, c, d) { + if (a == null) { + } + if (b == null) { + } + if (c == null) { + } + if (d == null) { + } +} +function f4(x) { + if (x > undefined) { + } + if (x < undefined) { + } + if (x >= undefined) { + } + if (x <= undefined) { + } +} diff --git a/tests/baselines/reference/equalityWithIntersectionTypes01.errors.txt b/tests/baselines/reference/equalityWithIntersectionTypes01.errors.txt new file mode 100644 index 00000000000..8bffff2218b --- /dev/null +++ b/tests/baselines/reference/equalityWithIntersectionTypes01.errors.txt @@ -0,0 +1,51 @@ +tests/cases/conformance/types/typeRelationships/comparable/equalityWithIntersectionTypes01.ts(17,5): error TS2365: Operator '===' cannot be applied to types 'I1 & I3' and 'I2'. +tests/cases/conformance/types/typeRelationships/comparable/equalityWithIntersectionTypes01.ts(17,16): error TS2365: Operator '===' cannot be applied to types 'I2' and 'I1 & I3'. +tests/cases/conformance/types/typeRelationships/comparable/equalityWithIntersectionTypes01.ts(19,10): error TS2365: Operator '!==' cannot be applied to types 'I1 & I3' and 'I2'. +tests/cases/conformance/types/typeRelationships/comparable/equalityWithIntersectionTypes01.ts(19,21): error TS2365: Operator '!==' cannot be applied to types 'I2' and 'I1 & I3'. +tests/cases/conformance/types/typeRelationships/comparable/equalityWithIntersectionTypes01.ts(21,10): error TS2365: Operator '==' cannot be applied to types 'I1 & I3' and 'I2'. +tests/cases/conformance/types/typeRelationships/comparable/equalityWithIntersectionTypes01.ts(21,20): error TS2365: Operator '==' cannot be applied to types 'I2' and 'I1 & I3'. +tests/cases/conformance/types/typeRelationships/comparable/equalityWithIntersectionTypes01.ts(23,10): error TS2365: Operator '!=' cannot be applied to types 'I1 & I3' and 'I2'. +tests/cases/conformance/types/typeRelationships/comparable/equalityWithIntersectionTypes01.ts(23,20): error TS2365: Operator '!=' cannot be applied to types 'I2' and 'I1 & I3'. + + +==== tests/cases/conformance/types/typeRelationships/comparable/equalityWithIntersectionTypes01.ts (8 errors) ==== + interface I1 { + p1: number + } + + interface I2 extends I1 { + p2: number; + } + + interface I3 { + p3: number; + } + + var x = { p1: 10, p2: 20, p3: 30 }; + var y: I1 & I3 = x; + var z: I2 = x; + + if (y === z || z === y) { + ~~~~~~~ +!!! error TS2365: Operator '===' cannot be applied to types 'I1 & I3' and 'I2'. + ~~~~~~~ +!!! error TS2365: Operator '===' cannot be applied to types 'I2' and 'I1 & I3'. + } + else if (y !== z || z !== y) { + ~~~~~~~ +!!! error TS2365: Operator '!==' cannot be applied to types 'I1 & I3' and 'I2'. + ~~~~~~~ +!!! error TS2365: Operator '!==' cannot be applied to types 'I2' and 'I1 & I3'. + } + else if (y == z || z == y) { + ~~~~~~ +!!! error TS2365: Operator '==' cannot be applied to types 'I1 & I3' and 'I2'. + ~~~~~~ +!!! error TS2365: Operator '==' cannot be applied to types 'I2' and 'I1 & I3'. + } + else if (y != z || z != y) { + ~~~~~~ +!!! error TS2365: Operator '!=' cannot be applied to types 'I1 & I3' and 'I2'. + ~~~~~~ +!!! error TS2365: Operator '!=' cannot be applied to types 'I2' and 'I1 & I3'. + } \ No newline at end of file diff --git a/tests/baselines/reference/equalityWithIntersectionTypes01.js b/tests/baselines/reference/equalityWithIntersectionTypes01.js new file mode 100644 index 00000000000..151809bb6f8 --- /dev/null +++ b/tests/baselines/reference/equalityWithIntersectionTypes01.js @@ -0,0 +1,38 @@ +//// [equalityWithIntersectionTypes01.ts] +interface I1 { + p1: number +} + +interface I2 extends I1 { + p2: number; +} + +interface I3 { + p3: number; +} + +var x = { p1: 10, p2: 20, p3: 30 }; +var y: I1 & I3 = x; +var z: I2 = x; + +if (y === z || z === y) { +} +else if (y !== z || z !== y) { +} +else if (y == z || z == y) { +} +else if (y != z || z != y) { +} + +//// [equalityWithIntersectionTypes01.js] +var x = { p1: 10, p2: 20, p3: 30 }; +var y = x; +var z = x; +if (y === z || z === y) { +} +else if (y !== z || z !== y) { +} +else if (y == z || z == y) { +} +else if (y != z || z != y) { +} diff --git a/tests/baselines/reference/equalityWithUnionTypes01.js b/tests/baselines/reference/equalityWithUnionTypes01.js new file mode 100644 index 00000000000..05e9f25cd69 --- /dev/null +++ b/tests/baselines/reference/equalityWithUnionTypes01.js @@ -0,0 +1,34 @@ +//// [equalityWithUnionTypes01.ts] +interface I1 { + p1: number +} + +interface I2 extends I1 { + p2: number; +} + +var x = { p1: 10, p2: 20 }; +var y: number | I2 = x; +var z: I1 = x; + +if (y === z || z === y) { +} +else if (y !== z || z !== y) { +} +else if (y == z || z == y) { +} +else if (y != z || z != y) { +} + +//// [equalityWithUnionTypes01.js] +var x = { p1: 10, p2: 20 }; +var y = x; +var z = x; +if (y === z || z === y) { +} +else if (y !== z || z !== y) { +} +else if (y == z || z == y) { +} +else if (y != z || z != y) { +} diff --git a/tests/baselines/reference/equalityWithUnionTypes01.symbols b/tests/baselines/reference/equalityWithUnionTypes01.symbols new file mode 100644 index 00000000000..0b1a6892517 --- /dev/null +++ b/tests/baselines/reference/equalityWithUnionTypes01.symbols @@ -0,0 +1,55 @@ +=== tests/cases/conformance/types/typeRelationships/comparable/equalityWithUnionTypes01.ts === +interface I1 { +>I1 : Symbol(I1, Decl(equalityWithUnionTypes01.ts, 0, 0)) + + p1: number +>p1 : Symbol(I1.p1, Decl(equalityWithUnionTypes01.ts, 0, 14)) +} + +interface I2 extends I1 { +>I2 : Symbol(I2, Decl(equalityWithUnionTypes01.ts, 2, 1)) +>I1 : Symbol(I1, Decl(equalityWithUnionTypes01.ts, 0, 0)) + + p2: number; +>p2 : Symbol(I2.p2, Decl(equalityWithUnionTypes01.ts, 4, 25)) +} + +var x = { p1: 10, p2: 20 }; +>x : Symbol(x, Decl(equalityWithUnionTypes01.ts, 8, 3)) +>p1 : Symbol(p1, Decl(equalityWithUnionTypes01.ts, 8, 9)) +>p2 : Symbol(p2, Decl(equalityWithUnionTypes01.ts, 8, 17)) + +var y: number | I2 = x; +>y : Symbol(y, Decl(equalityWithUnionTypes01.ts, 9, 3)) +>I2 : Symbol(I2, Decl(equalityWithUnionTypes01.ts, 2, 1)) +>x : Symbol(x, Decl(equalityWithUnionTypes01.ts, 8, 3)) + +var z: I1 = x; +>z : Symbol(z, Decl(equalityWithUnionTypes01.ts, 10, 3)) +>I1 : Symbol(I1, Decl(equalityWithUnionTypes01.ts, 0, 0)) +>x : Symbol(x, Decl(equalityWithUnionTypes01.ts, 8, 3)) + +if (y === z || z === y) { +>y : Symbol(y, Decl(equalityWithUnionTypes01.ts, 9, 3)) +>z : Symbol(z, Decl(equalityWithUnionTypes01.ts, 10, 3)) +>z : Symbol(z, Decl(equalityWithUnionTypes01.ts, 10, 3)) +>y : Symbol(y, Decl(equalityWithUnionTypes01.ts, 9, 3)) +} +else if (y !== z || z !== y) { +>y : Symbol(y, Decl(equalityWithUnionTypes01.ts, 9, 3)) +>z : Symbol(z, Decl(equalityWithUnionTypes01.ts, 10, 3)) +>z : Symbol(z, Decl(equalityWithUnionTypes01.ts, 10, 3)) +>y : Symbol(y, Decl(equalityWithUnionTypes01.ts, 9, 3)) +} +else if (y == z || z == y) { +>y : Symbol(y, Decl(equalityWithUnionTypes01.ts, 9, 3)) +>z : Symbol(z, Decl(equalityWithUnionTypes01.ts, 10, 3)) +>z : Symbol(z, Decl(equalityWithUnionTypes01.ts, 10, 3)) +>y : Symbol(y, Decl(equalityWithUnionTypes01.ts, 9, 3)) +} +else if (y != z || z != y) { +>y : Symbol(y, Decl(equalityWithUnionTypes01.ts, 9, 3)) +>z : Symbol(z, Decl(equalityWithUnionTypes01.ts, 10, 3)) +>z : Symbol(z, Decl(equalityWithUnionTypes01.ts, 10, 3)) +>y : Symbol(y, Decl(equalityWithUnionTypes01.ts, 9, 3)) +} diff --git a/tests/baselines/reference/equalityWithUnionTypes01.types b/tests/baselines/reference/equalityWithUnionTypes01.types new file mode 100644 index 00000000000..61e38030949 --- /dev/null +++ b/tests/baselines/reference/equalityWithUnionTypes01.types @@ -0,0 +1,70 @@ +=== tests/cases/conformance/types/typeRelationships/comparable/equalityWithUnionTypes01.ts === +interface I1 { +>I1 : I1 + + p1: number +>p1 : number +} + +interface I2 extends I1 { +>I2 : I2 +>I1 : I1 + + p2: number; +>p2 : number +} + +var x = { p1: 10, p2: 20 }; +>x : { p1: number; p2: number; } +>{ p1: 10, p2: 20 } : { p1: number; p2: number; } +>p1 : number +>10 : number +>p2 : number +>20 : number + +var y: number | I2 = x; +>y : number | I2 +>I2 : I2 +>x : { p1: number; p2: number; } + +var z: I1 = x; +>z : I1 +>I1 : I1 +>x : { p1: number; p2: number; } + +if (y === z || z === y) { +>y === z || z === y : boolean +>y === z : boolean +>y : I2 +>z : I1 +>z === y : boolean +>z : I1 +>y : I2 +} +else if (y !== z || z !== y) { +>y !== z || z !== y : boolean +>y !== z : boolean +>y : I2 +>z : I1 +>z !== y : boolean +>z : I1 +>y : I2 +} +else if (y == z || z == y) { +>y == z || z == y : boolean +>y == z : boolean +>y : I2 +>z : I1 +>z == y : boolean +>z : I1 +>y : I2 +} +else if (y != z || z != y) { +>y != z || z != y : boolean +>y != z : boolean +>y : I2 +>z : I1 +>z != y : boolean +>z : I1 +>y : I2 +} diff --git a/tests/baselines/reference/errorMessagesIntersectionTypes01.errors.txt b/tests/baselines/reference/errorMessagesIntersectionTypes01.errors.txt new file mode 100644 index 00000000000..6b36f29a63e --- /dev/null +++ b/tests/baselines/reference/errorMessagesIntersectionTypes01.errors.txt @@ -0,0 +1,26 @@ +tests/cases/compiler/errorMessagesIntersectionTypes01.ts(14,5): error TS2322: Type '{ fooProp: string; } & Bar' is not assignable to type 'FooBar'. + Types of property 'fooProp' are incompatible. + Type 'string' is not assignable to type 'boolean'. + + +==== tests/cases/compiler/errorMessagesIntersectionTypes01.ts (1 errors) ==== + interface Foo { + fooProp: boolean; + } + + interface Bar { + barProp: string; + } + + interface FooBar extends Foo, Bar { + } + + declare function mixBar(obj: T): T & Bar; + + let fooBar: FooBar = mixBar({ + ~~~~~~ +!!! error TS2322: Type '{ fooProp: string; } & Bar' is not assignable to type 'FooBar'. +!!! error TS2322: Types of property 'fooProp' are incompatible. +!!! error TS2322: Type 'string' is not assignable to type 'boolean'. + fooProp: "frizzlebizzle" + }); \ No newline at end of file diff --git a/tests/baselines/reference/errorMessagesIntersectionTypes01.js b/tests/baselines/reference/errorMessagesIntersectionTypes01.js new file mode 100644 index 00000000000..d0cd23ac53d --- /dev/null +++ b/tests/baselines/reference/errorMessagesIntersectionTypes01.js @@ -0,0 +1,22 @@ +//// [errorMessagesIntersectionTypes01.ts] +interface Foo { + fooProp: boolean; +} + +interface Bar { + barProp: string; +} + +interface FooBar extends Foo, Bar { +} + +declare function mixBar(obj: T): T & Bar; + +let fooBar: FooBar = mixBar({ + fooProp: "frizzlebizzle" +}); + +//// [errorMessagesIntersectionTypes01.js] +var fooBar = mixBar({ + fooProp: "frizzlebizzle" +}); diff --git a/tests/baselines/reference/errorMessagesIntersectionTypes02.errors.txt b/tests/baselines/reference/errorMessagesIntersectionTypes02.errors.txt new file mode 100644 index 00000000000..6a9dd26706c --- /dev/null +++ b/tests/baselines/reference/errorMessagesIntersectionTypes02.errors.txt @@ -0,0 +1,26 @@ +tests/cases/compiler/errorMessagesIntersectionTypes02.ts(14,5): error TS2322: Type '{ fooProp: string; } & Bar' is not assignable to type 'FooBar'. + Types of property 'fooProp' are incompatible. + Type 'string' is not assignable to type '"hello" | "world"'. + + +==== tests/cases/compiler/errorMessagesIntersectionTypes02.ts (1 errors) ==== + interface Foo { + fooProp: "hello" | "world"; + } + + interface Bar { + barProp: string; + } + + interface FooBar extends Foo, Bar { + } + + declare function mixBar(obj: T): T & Bar; + + let fooBar: FooBar = mixBar({ + ~~~~~~ +!!! error TS2322: Type '{ fooProp: string; } & Bar' is not assignable to type 'FooBar'. +!!! error TS2322: Types of property 'fooProp' are incompatible. +!!! error TS2322: Type 'string' is not assignable to type '"hello" | "world"'. + fooProp: "frizzlebizzle" + }); \ No newline at end of file diff --git a/tests/baselines/reference/errorMessagesIntersectionTypes02.js b/tests/baselines/reference/errorMessagesIntersectionTypes02.js new file mode 100644 index 00000000000..c5c24031877 --- /dev/null +++ b/tests/baselines/reference/errorMessagesIntersectionTypes02.js @@ -0,0 +1,22 @@ +//// [errorMessagesIntersectionTypes02.ts] +interface Foo { + fooProp: "hello" | "world"; +} + +interface Bar { + barProp: string; +} + +interface FooBar extends Foo, Bar { +} + +declare function mixBar(obj: T): T & Bar; + +let fooBar: FooBar = mixBar({ + fooProp: "frizzlebizzle" +}); + +//// [errorMessagesIntersectionTypes02.js] +var fooBar = mixBar({ + fooProp: "frizzlebizzle" +}); diff --git a/tests/baselines/reference/errorMessagesIntersectionTypes03.errors.txt b/tests/baselines/reference/errorMessagesIntersectionTypes03.errors.txt new file mode 100644 index 00000000000..e37ff82aa7b --- /dev/null +++ b/tests/baselines/reference/errorMessagesIntersectionTypes03.errors.txt @@ -0,0 +1,42 @@ +tests/cases/compiler/errorMessagesIntersectionTypes03.ts(17,5): error TS2322: Type 'A & B' is not assignable to type 'T'. +tests/cases/compiler/errorMessagesIntersectionTypes03.ts(18,5): error TS2322: Type 'A & B' is not assignable to type 'U'. +tests/cases/compiler/errorMessagesIntersectionTypes03.ts(19,5): error TS2322: Type 'A & B' is not assignable to type 'V'. +tests/cases/compiler/errorMessagesIntersectionTypes03.ts(22,5): error TS2322: Type 'T & B' is not assignable to type 'U'. +tests/cases/compiler/errorMessagesIntersectionTypes03.ts(23,5): error TS2322: Type 'T & B' is not assignable to type 'V'. + + +==== tests/cases/compiler/errorMessagesIntersectionTypes03.ts (5 errors) ==== + interface A { + a; + } + + interface B { + b; + } + + function f(): void { + let t: T; + let u: U; + let v: V; + + let a_and_b: A & B; + let t_and_b: T & B; + + t = a_and_b; + ~ +!!! error TS2322: Type 'A & B' is not assignable to type 'T'. + u = a_and_b; + ~ +!!! error TS2322: Type 'A & B' is not assignable to type 'U'. + v = a_and_b; + ~ +!!! error TS2322: Type 'A & B' is not assignable to type 'V'. + + t = t_and_b; + u = t_and_b; + ~ +!!! error TS2322: Type 'T & B' is not assignable to type 'U'. + v = t_and_b; + ~ +!!! error TS2322: Type 'T & B' is not assignable to type 'V'. + } \ No newline at end of file diff --git a/tests/baselines/reference/errorMessagesIntersectionTypes03.js b/tests/baselines/reference/errorMessagesIntersectionTypes03.js new file mode 100644 index 00000000000..278b81a329a --- /dev/null +++ b/tests/baselines/reference/errorMessagesIntersectionTypes03.js @@ -0,0 +1,40 @@ +//// [errorMessagesIntersectionTypes03.ts] +interface A { + a; +} + +interface B { + b; +} + +function f(): void { + let t: T; + let u: U; + let v: V; + + let a_and_b: A & B; + let t_and_b: T & B; + + t = a_and_b; + u = a_and_b; + v = a_and_b; + + t = t_and_b; + u = t_and_b; + v = t_and_b; +} + +//// [errorMessagesIntersectionTypes03.js] +function f() { + var t; + var u; + var v; + var a_and_b; + var t_and_b; + t = a_and_b; + u = a_and_b; + v = a_and_b; + t = t_and_b; + u = t_and_b; + v = t_and_b; +} diff --git a/tests/baselines/reference/errorMessagesIntersectionTypes04.errors.txt b/tests/baselines/reference/errorMessagesIntersectionTypes04.errors.txt new file mode 100644 index 00000000000..7582c68ecec --- /dev/null +++ b/tests/baselines/reference/errorMessagesIntersectionTypes04.errors.txt @@ -0,0 +1,37 @@ +tests/cases/compiler/errorMessagesIntersectionTypes04.ts(17,5): error TS2322: Type 'A & B' is not assignable to type 'number'. +tests/cases/compiler/errorMessagesIntersectionTypes04.ts(18,5): error TS2322: Type 'A & B' is not assignable to type 'boolean'. +tests/cases/compiler/errorMessagesIntersectionTypes04.ts(19,5): error TS2322: Type 'A & B' is not assignable to type 'string'. +tests/cases/compiler/errorMessagesIntersectionTypes04.ts(21,5): error TS2322: Type 'number & boolean' is not assignable to type 'string'. + + +==== tests/cases/compiler/errorMessagesIntersectionTypes04.ts (4 errors) ==== + interface A { + a; + } + + interface B { + b; + } + + function f(): void { + let num: number; + let bool: boolean; + let str: string; + + let a_and_b: A & B; + let num_and_bool: number & boolean; + + num = a_and_b; + ~~~ +!!! error TS2322: Type 'A & B' is not assignable to type 'number'. + bool = a_and_b; + ~~~~ +!!! error TS2322: Type 'A & B' is not assignable to type 'boolean'. + str = a_and_b; + ~~~ +!!! error TS2322: Type 'A & B' is not assignable to type 'string'. + + str = num_and_bool; + ~~~ +!!! error TS2322: Type 'number & boolean' is not assignable to type 'string'. + } \ No newline at end of file diff --git a/tests/baselines/reference/errorMessagesIntersectionTypes04.js b/tests/baselines/reference/errorMessagesIntersectionTypes04.js new file mode 100644 index 00000000000..f663e1a7907 --- /dev/null +++ b/tests/baselines/reference/errorMessagesIntersectionTypes04.js @@ -0,0 +1,36 @@ +//// [errorMessagesIntersectionTypes04.ts] +interface A { + a; +} + +interface B { + b; +} + +function f(): void { + let num: number; + let bool: boolean; + let str: string; + + let a_and_b: A & B; + let num_and_bool: number & boolean; + + num = a_and_b; + bool = a_and_b; + str = a_and_b; + + str = num_and_bool; +} + +//// [errorMessagesIntersectionTypes04.js] +function f() { + var num; + var bool; + var str; + var a_and_b; + var num_and_bool; + num = a_and_b; + bool = a_and_b; + str = a_and_b; + str = num_and_bool; +} diff --git a/tests/baselines/reference/errorSuperPropertyAccess.errors.txt b/tests/baselines/reference/errorSuperPropertyAccess.errors.txt index c54ace99f17..7fd6e467eaf 100644 --- a/tests/baselines/reference/errorSuperPropertyAccess.errors.txt +++ b/tests/baselines/reference/errorSuperPropertyAccess.errors.txt @@ -25,15 +25,15 @@ tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(99,19): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword. tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(109,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword. tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(110,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword. -tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(111,9): error TS2341: Property 'privateStaticFunc' is private and only accessible within class 'SomeBase'. +tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(111,15): error TS2341: Property 'privateStaticFunc' is private and only accessible within class 'SomeBase'. tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(113,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(114,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword. tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(115,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword. -tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(116,9): error TS2341: Property 'privateStaticFunc' is private and only accessible within class 'SomeBase'. +tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(116,15): error TS2341: Property 'privateStaticFunc' is private and only accessible within class 'SomeBase'. tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(119,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(120,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword. tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(121,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword. -tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(122,9): error TS2341: Property 'privateStaticFunc' is private and only accessible within class 'SomeBase'. +tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(122,15): error TS2341: Property 'privateStaticFunc' is private and only accessible within class 'SomeBase'. tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(127,16): error TS2660: 'super' can only be referenced in members of derived classes or object literal expressions. tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(127,30): error TS2660: 'super' can only be referenced in members of derived classes or object literal expressions. @@ -204,7 +204,7 @@ tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess ~~~~~~~~~~~~~~~~~~~ !!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword. super.privateStaticFunc(); - ~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~ !!! error TS2341: Property 'privateStaticFunc' is private and only accessible within class 'SomeBase'. } static get a() { @@ -217,7 +217,7 @@ tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess ~~~~~~~~~~~~~~~~~~~ !!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword. super.privateStaticFunc(); - ~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~ !!! error TS2341: Property 'privateStaticFunc' is private and only accessible within class 'SomeBase'. return ''; } @@ -231,7 +231,7 @@ tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess ~~~~~~~~~~~~~~~~~~~ !!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword. super.privateStaticFunc(); - ~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~ !!! error TS2341: Property 'privateStaticFunc' is private and only accessible within class 'SomeBase'. } } diff --git a/tests/baselines/reference/es2015modulekind.symbols b/tests/baselines/reference/es2015modulekind.symbols index 227443ac06b..8a772e31895 100644 --- a/tests/baselines/reference/es2015modulekind.symbols +++ b/tests/baselines/reference/es2015modulekind.symbols @@ -9,7 +9,7 @@ export default class A } public B() ->B : Symbol(B, Decl(es2015modulekind.ts, 6, 5)) +>B : Symbol(A.B, Decl(es2015modulekind.ts, 6, 5)) { return 42; } diff --git a/tests/baselines/reference/es2015modulekindWithES6Target.symbols b/tests/baselines/reference/es2015modulekindWithES6Target.symbols index 2ff208ac704..4a7c6469ca5 100644 --- a/tests/baselines/reference/es2015modulekindWithES6Target.symbols +++ b/tests/baselines/reference/es2015modulekindWithES6Target.symbols @@ -9,7 +9,7 @@ export default class A } public B() ->B : Symbol(B, Decl(es2015modulekindWithES6Target.ts, 6, 5)) +>B : Symbol(A.B, Decl(es2015modulekindWithES6Target.ts, 6, 5)) { return 42; } diff --git a/tests/baselines/reference/es3-amd.symbols b/tests/baselines/reference/es3-amd.symbols index f6d1211ad4e..1f9efe3e590 100644 --- a/tests/baselines/reference/es3-amd.symbols +++ b/tests/baselines/reference/es3-amd.symbols @@ -9,7 +9,7 @@ class A } public B() ->B : Symbol(B, Decl(es3-amd.ts, 6, 5)) +>B : Symbol(A.B, Decl(es3-amd.ts, 6, 5)) { return 42; } diff --git a/tests/baselines/reference/es3-declaration-amd.symbols b/tests/baselines/reference/es3-declaration-amd.symbols index aec4af2bb60..5930b908e2f 100644 --- a/tests/baselines/reference/es3-declaration-amd.symbols +++ b/tests/baselines/reference/es3-declaration-amd.symbols @@ -9,7 +9,7 @@ class A } public B() ->B : Symbol(B, Decl(es3-declaration-amd.ts, 6, 5)) +>B : Symbol(A.B, Decl(es3-declaration-amd.ts, 6, 5)) { return 42; } diff --git a/tests/baselines/reference/es3-sourcemap-amd.symbols b/tests/baselines/reference/es3-sourcemap-amd.symbols index ca20348a0f5..919e2cfa46c 100644 --- a/tests/baselines/reference/es3-sourcemap-amd.symbols +++ b/tests/baselines/reference/es3-sourcemap-amd.symbols @@ -9,7 +9,7 @@ class A } public B() ->B : Symbol(B, Decl(es3-sourcemap-amd.ts, 6, 5)) +>B : Symbol(A.B, Decl(es3-sourcemap-amd.ts, 6, 5)) { return 42; } diff --git a/tests/baselines/reference/es5-amd.symbols b/tests/baselines/reference/es5-amd.symbols index cf99349fc1d..33ed9bc6423 100644 --- a/tests/baselines/reference/es5-amd.symbols +++ b/tests/baselines/reference/es5-amd.symbols @@ -9,7 +9,7 @@ class A } public B() ->B : Symbol(B, Decl(es5-amd.ts, 6, 5)) +>B : Symbol(A.B, Decl(es5-amd.ts, 6, 5)) { return 42; } diff --git a/tests/baselines/reference/es5-commonjs.symbols b/tests/baselines/reference/es5-commonjs.symbols index 41e4484afcd..a2319b14ce7 100644 --- a/tests/baselines/reference/es5-commonjs.symbols +++ b/tests/baselines/reference/es5-commonjs.symbols @@ -9,7 +9,7 @@ export default class A } public B() ->B : Symbol(B, Decl(es5-commonjs.ts, 6, 5)) +>B : Symbol(A.B, Decl(es5-commonjs.ts, 6, 5)) { return 42; } diff --git a/tests/baselines/reference/es5-commonjs4.symbols b/tests/baselines/reference/es5-commonjs4.symbols index 22d41128d74..83006bd9aa5 100644 --- a/tests/baselines/reference/es5-commonjs4.symbols +++ b/tests/baselines/reference/es5-commonjs4.symbols @@ -9,7 +9,7 @@ export default class A } public B() ->B : Symbol(B, Decl(es5-commonjs4.ts, 6, 5)) +>B : Symbol(A.B, Decl(es5-commonjs4.ts, 6, 5)) { return 42; } diff --git a/tests/baselines/reference/es5-declaration-amd.symbols b/tests/baselines/reference/es5-declaration-amd.symbols index a2504a0ea84..0df2ad428f0 100644 --- a/tests/baselines/reference/es5-declaration-amd.symbols +++ b/tests/baselines/reference/es5-declaration-amd.symbols @@ -9,7 +9,7 @@ class A } public B() ->B : Symbol(B, Decl(es5-declaration-amd.ts, 6, 5)) +>B : Symbol(A.B, Decl(es5-declaration-amd.ts, 6, 5)) { return 42; } diff --git a/tests/baselines/reference/es5-souremap-amd.symbols b/tests/baselines/reference/es5-souremap-amd.symbols index 14b22cc74c6..c725434096d 100644 --- a/tests/baselines/reference/es5-souremap-amd.symbols +++ b/tests/baselines/reference/es5-souremap-amd.symbols @@ -9,7 +9,7 @@ class A } public B() ->B : Symbol(B, Decl(es5-souremap-amd.ts, 6, 5)) +>B : Symbol(A.B, Decl(es5-souremap-amd.ts, 6, 5)) { return 42; } diff --git a/tests/baselines/reference/es5-system.js b/tests/baselines/reference/es5-system.js index 1cd1dac13d1..9cf5ea87f1f 100644 --- a/tests/baselines/reference/es5-system.js +++ b/tests/baselines/reference/es5-system.js @@ -15,8 +15,9 @@ export default class A //// [es5-system.js] -System.register([], function(exports_1, __moduleName) { +System.register([], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; var A; return { setters:[], diff --git a/tests/baselines/reference/es5-system.symbols b/tests/baselines/reference/es5-system.symbols index 5211e3c4259..f2c4b38aba2 100644 --- a/tests/baselines/reference/es5-system.symbols +++ b/tests/baselines/reference/es5-system.symbols @@ -9,7 +9,7 @@ export default class A } public B() ->B : Symbol(B, Decl(es5-system.ts, 6, 5)) +>B : Symbol(A.B, Decl(es5-system.ts, 6, 5)) { return 42; } diff --git a/tests/baselines/reference/es5-umd.symbols b/tests/baselines/reference/es5-umd.symbols index f570afd9548..73dd7ebbe5b 100644 --- a/tests/baselines/reference/es5-umd.symbols +++ b/tests/baselines/reference/es5-umd.symbols @@ -9,7 +9,7 @@ class A } public B() ->B : Symbol(B, Decl(es5-umd.ts, 6, 5)) +>B : Symbol(A.B, Decl(es5-umd.ts, 6, 5)) { return 42; } diff --git a/tests/baselines/reference/es5-umd2.symbols b/tests/baselines/reference/es5-umd2.symbols index 3b911d7e6f0..f017c6b72db 100644 --- a/tests/baselines/reference/es5-umd2.symbols +++ b/tests/baselines/reference/es5-umd2.symbols @@ -9,7 +9,7 @@ export class A } public B() ->B : Symbol(B, Decl(es5-umd2.ts, 6, 5)) +>B : Symbol(A.B, Decl(es5-umd2.ts, 6, 5)) { return 42; } diff --git a/tests/baselines/reference/es5-umd3.symbols b/tests/baselines/reference/es5-umd3.symbols index 3f830ae3637..ca0203b029c 100644 --- a/tests/baselines/reference/es5-umd3.symbols +++ b/tests/baselines/reference/es5-umd3.symbols @@ -9,7 +9,7 @@ export default class A } public B() ->B : Symbol(B, Decl(es5-umd3.ts, 6, 5)) +>B : Symbol(A.B, Decl(es5-umd3.ts, 6, 5)) { return 42; } diff --git a/tests/baselines/reference/es5-umd4.symbols b/tests/baselines/reference/es5-umd4.symbols index cdf1e135cf7..790c8cccb97 100644 --- a/tests/baselines/reference/es5-umd4.symbols +++ b/tests/baselines/reference/es5-umd4.symbols @@ -9,7 +9,7 @@ class A } public B() ->B : Symbol(B, Decl(es5-umd4.ts, 6, 5)) +>B : Symbol(A.B, Decl(es5-umd4.ts, 6, 5)) { return 42; } diff --git a/tests/baselines/reference/es5ExportDefaultClassDeclaration.symbols b/tests/baselines/reference/es5ExportDefaultClassDeclaration.symbols index 24196766dfa..8aaa8a4e532 100644 --- a/tests/baselines/reference/es5ExportDefaultClassDeclaration.symbols +++ b/tests/baselines/reference/es5ExportDefaultClassDeclaration.symbols @@ -4,6 +4,6 @@ export default class C { >C : Symbol(C, Decl(es5ExportDefaultClassDeclaration.ts, 0, 0)) method() { } ->method : Symbol(method, Decl(es5ExportDefaultClassDeclaration.ts, 1, 24)) +>method : Symbol(C.method, Decl(es5ExportDefaultClassDeclaration.ts, 1, 24)) } diff --git a/tests/baselines/reference/es5ExportDefaultClassDeclaration2.symbols b/tests/baselines/reference/es5ExportDefaultClassDeclaration2.symbols index 0780ff7a3c8..05947d5a557 100644 --- a/tests/baselines/reference/es5ExportDefaultClassDeclaration2.symbols +++ b/tests/baselines/reference/es5ExportDefaultClassDeclaration2.symbols @@ -2,6 +2,6 @@ export default class { method() { } ->method : Symbol(method, Decl(es5ExportDefaultClassDeclaration2.ts, 1, 22)) +>method : Symbol(default.method, Decl(es5ExportDefaultClassDeclaration2.ts, 1, 22)) } diff --git a/tests/baselines/reference/es5ExportDefaultClassDeclaration3.symbols b/tests/baselines/reference/es5ExportDefaultClassDeclaration3.symbols index b5262b94688..d5c8243161b 100644 --- a/tests/baselines/reference/es5ExportDefaultClassDeclaration3.symbols +++ b/tests/baselines/reference/es5ExportDefaultClassDeclaration3.symbols @@ -9,7 +9,7 @@ export default class C { >C : Symbol(C, Decl(es5ExportDefaultClassDeclaration3.ts, 1, 24)) method(): C { ->method : Symbol(method, Decl(es5ExportDefaultClassDeclaration3.ts, 3, 24)) +>method : Symbol(C.method, Decl(es5ExportDefaultClassDeclaration3.ts, 3, 24)) >C : Symbol(C, Decl(es5ExportDefaultClassDeclaration3.ts, 1, 24)) return new C(); diff --git a/tests/baselines/reference/es5ExportDefaultClassDeclaration4.symbols b/tests/baselines/reference/es5ExportDefaultClassDeclaration4.symbols index 6c30ffed858..15faf638ca1 100644 --- a/tests/baselines/reference/es5ExportDefaultClassDeclaration4.symbols +++ b/tests/baselines/reference/es5ExportDefaultClassDeclaration4.symbols @@ -9,7 +9,7 @@ declare module "foo" { >C : Symbol(C, Decl(es5ExportDefaultClassDeclaration4.ts, 2, 25)) method(): C; ->method : Symbol(method, Decl(es5ExportDefaultClassDeclaration4.ts, 4, 28)) +>method : Symbol(C.method, Decl(es5ExportDefaultClassDeclaration4.ts, 4, 28)) >C : Symbol(C, Decl(es5ExportDefaultClassDeclaration4.ts, 2, 25)) } diff --git a/tests/baselines/reference/es5ExportEqualsDts.symbols b/tests/baselines/reference/es5ExportEqualsDts.symbols index 52bf357d177..46bc29b58dd 100644 --- a/tests/baselines/reference/es5ExportEqualsDts.symbols +++ b/tests/baselines/reference/es5ExportEqualsDts.symbols @@ -4,7 +4,7 @@ class A { >A : Symbol(A, Decl(es5ExportEqualsDts.ts, 0, 0), Decl(es5ExportEqualsDts.ts, 6, 1)) foo() { ->foo : Symbol(foo, Decl(es5ExportEqualsDts.ts, 1, 9)) +>foo : Symbol(A.foo, Decl(es5ExportEqualsDts.ts, 1, 9)) var aVal: A.B; >aVal : Symbol(aVal, Decl(es5ExportEqualsDts.ts, 3, 11)) diff --git a/tests/baselines/reference/es5ModuleWithModuleGenAmd.symbols b/tests/baselines/reference/es5ModuleWithModuleGenAmd.symbols index 1a853eb37d0..b9df217a403 100644 --- a/tests/baselines/reference/es5ModuleWithModuleGenAmd.symbols +++ b/tests/baselines/reference/es5ModuleWithModuleGenAmd.symbols @@ -7,7 +7,7 @@ export class A } public B() ->B : Symbol(B, Decl(es5ModuleWithModuleGenAmd.ts, 4, 5)) +>B : Symbol(A.B, Decl(es5ModuleWithModuleGenAmd.ts, 4, 5)) { return 42; } diff --git a/tests/baselines/reference/es5ModuleWithModuleGenCommonjs.symbols b/tests/baselines/reference/es5ModuleWithModuleGenCommonjs.symbols index a69ce05f1ae..9917d5c3713 100644 --- a/tests/baselines/reference/es5ModuleWithModuleGenCommonjs.symbols +++ b/tests/baselines/reference/es5ModuleWithModuleGenCommonjs.symbols @@ -7,7 +7,7 @@ export class A } public B() ->B : Symbol(B, Decl(es5ModuleWithModuleGenCommonjs.ts, 4, 5)) +>B : Symbol(A.B, Decl(es5ModuleWithModuleGenCommonjs.ts, 4, 5)) { return 42; } diff --git a/tests/baselines/reference/es5ModuleWithoutModuleGenTarget.errors.txt b/tests/baselines/reference/es5ModuleWithoutModuleGenTarget.errors.txt deleted file mode 100644 index 90f10087194..00000000000 --- a/tests/baselines/reference/es5ModuleWithoutModuleGenTarget.errors.txt +++ /dev/null @@ -1,17 +0,0 @@ -tests/cases/compiler/es5ModuleWithoutModuleGenTarget.ts(1,14): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. - - -==== tests/cases/compiler/es5ModuleWithoutModuleGenTarget.ts (1 errors) ==== - export class A - ~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. - { - constructor () - { - } - - public B() - { - return 42; - } - } \ No newline at end of file diff --git a/tests/baselines/reference/es5ModuleWithoutModuleGenTarget.symbols b/tests/baselines/reference/es5ModuleWithoutModuleGenTarget.symbols new file mode 100644 index 00000000000..436e4a5351a --- /dev/null +++ b/tests/baselines/reference/es5ModuleWithoutModuleGenTarget.symbols @@ -0,0 +1,14 @@ +=== tests/cases/compiler/es5ModuleWithoutModuleGenTarget.ts === +export class A +>A : Symbol(A, Decl(es5ModuleWithoutModuleGenTarget.ts, 0, 0)) +{ + constructor () + { + } + + public B() +>B : Symbol(A.B, Decl(es5ModuleWithoutModuleGenTarget.ts, 4, 5)) + { + return 42; + } +} diff --git a/tests/baselines/reference/es5ModuleWithoutModuleGenTarget.types b/tests/baselines/reference/es5ModuleWithoutModuleGenTarget.types new file mode 100644 index 00000000000..251e2be25a9 --- /dev/null +++ b/tests/baselines/reference/es5ModuleWithoutModuleGenTarget.types @@ -0,0 +1,15 @@ +=== tests/cases/compiler/es5ModuleWithoutModuleGenTarget.ts === +export class A +>A : A +{ + constructor () + { + } + + public B() +>B : () => number + { + return 42; +>42 : number + } +} diff --git a/tests/baselines/reference/es6-amd.symbols b/tests/baselines/reference/es6-amd.symbols index ad5cf38e7cd..fb9b1c57b27 100644 --- a/tests/baselines/reference/es6-amd.symbols +++ b/tests/baselines/reference/es6-amd.symbols @@ -9,7 +9,7 @@ class A } public B() ->B : Symbol(B, Decl(es6-amd.ts, 6, 5)) +>B : Symbol(A.B, Decl(es6-amd.ts, 6, 5)) { return 42; } diff --git a/tests/baselines/reference/es6-declaration-amd.symbols b/tests/baselines/reference/es6-declaration-amd.symbols index f1a728396cc..6811dfe793d 100644 --- a/tests/baselines/reference/es6-declaration-amd.symbols +++ b/tests/baselines/reference/es6-declaration-amd.symbols @@ -9,7 +9,7 @@ class A } public B() ->B : Symbol(B, Decl(es6-declaration-amd.ts, 6, 5)) +>B : Symbol(A.B, Decl(es6-declaration-amd.ts, 6, 5)) { return 42; } diff --git a/tests/baselines/reference/es6-sourcemap-amd.symbols b/tests/baselines/reference/es6-sourcemap-amd.symbols index 13be6367ba0..e5f731234f3 100644 --- a/tests/baselines/reference/es6-sourcemap-amd.symbols +++ b/tests/baselines/reference/es6-sourcemap-amd.symbols @@ -9,7 +9,7 @@ class A } public B() ->B : Symbol(B, Decl(es6-sourcemap-amd.ts, 6, 5)) +>B : Symbol(A.B, Decl(es6-sourcemap-amd.ts, 6, 5)) { return 42; } diff --git a/tests/baselines/reference/es6-umd.symbols b/tests/baselines/reference/es6-umd.symbols index f7c57215ea6..50584887fb3 100644 --- a/tests/baselines/reference/es6-umd.symbols +++ b/tests/baselines/reference/es6-umd.symbols @@ -9,7 +9,7 @@ class A } public B() ->B : Symbol(B, Decl(es6-umd.ts, 6, 5)) +>B : Symbol(A.B, Decl(es6-umd.ts, 6, 5)) { return 42; } diff --git a/tests/baselines/reference/es6-umd2.symbols b/tests/baselines/reference/es6-umd2.symbols index 88acf127279..d998e4b68ee 100644 --- a/tests/baselines/reference/es6-umd2.symbols +++ b/tests/baselines/reference/es6-umd2.symbols @@ -9,7 +9,7 @@ export class A } public B() ->B : Symbol(B, Decl(es6-umd2.ts, 6, 5)) +>B : Symbol(A.B, Decl(es6-umd2.ts, 6, 5)) { return 42; } diff --git a/tests/baselines/reference/es6ClassTest3.symbols b/tests/baselines/reference/es6ClassTest3.symbols index cf2284e95ee..94404b6777a 100644 --- a/tests/baselines/reference/es6ClassTest3.symbols +++ b/tests/baselines/reference/es6ClassTest3.symbols @@ -6,30 +6,30 @@ module M { >Visibility : Symbol(Visibility, Decl(es6ClassTest3.ts, 0, 10)) public foo() { }; ->foo : Symbol(foo, Decl(es6ClassTest3.ts, 1, 19)) +>foo : Symbol(Visibility.foo, Decl(es6ClassTest3.ts, 1, 19)) private bar() { }; ->bar : Symbol(bar, Decl(es6ClassTest3.ts, 2, 22)) +>bar : Symbol(Visibility.bar, Decl(es6ClassTest3.ts, 2, 22)) private x: number; ->x : Symbol(x, Decl(es6ClassTest3.ts, 3, 23)) +>x : Symbol(Visibility.x, Decl(es6ClassTest3.ts, 3, 23)) public y: number; ->y : Symbol(y, Decl(es6ClassTest3.ts, 4, 26)) +>y : Symbol(Visibility.y, Decl(es6ClassTest3.ts, 4, 26)) public z: number; ->z : Symbol(z, Decl(es6ClassTest3.ts, 5, 22)) +>z : Symbol(Visibility.z, Decl(es6ClassTest3.ts, 5, 22)) constructor() { this.x = 1; ->this.x : Symbol(x, Decl(es6ClassTest3.ts, 3, 23)) +>this.x : Symbol(Visibility.x, Decl(es6ClassTest3.ts, 3, 23)) >this : Symbol(Visibility, Decl(es6ClassTest3.ts, 0, 10)) ->x : Symbol(x, Decl(es6ClassTest3.ts, 3, 23)) +>x : Symbol(Visibility.x, Decl(es6ClassTest3.ts, 3, 23)) this.y = 2; ->this.y : Symbol(y, Decl(es6ClassTest3.ts, 4, 26)) +>this.y : Symbol(Visibility.y, Decl(es6ClassTest3.ts, 4, 26)) >this : Symbol(Visibility, Decl(es6ClassTest3.ts, 0, 10)) ->y : Symbol(y, Decl(es6ClassTest3.ts, 4, 26)) +>y : Symbol(Visibility.y, Decl(es6ClassTest3.ts, 4, 26)) } } } diff --git a/tests/baselines/reference/es6ClassTest4.symbols b/tests/baselines/reference/es6ClassTest4.symbols index 41a329a3d51..e9dd7513fed 100644 --- a/tests/baselines/reference/es6ClassTest4.symbols +++ b/tests/baselines/reference/es6ClassTest4.symbols @@ -3,19 +3,19 @@ declare class Point >Point : Symbol(Point, Decl(es6ClassTest4.ts, 0, 0)) { x: number; ->x : Symbol(x, Decl(es6ClassTest4.ts, 1, 1)) +>x : Symbol(Point.x, Decl(es6ClassTest4.ts, 1, 1)) y: number; ->y : Symbol(y, Decl(es6ClassTest4.ts, 2, 14)) +>y : Symbol(Point.y, Decl(es6ClassTest4.ts, 2, 14)) add(dx: number, dy: number): Point; ->add : Symbol(add, Decl(es6ClassTest4.ts, 3, 14)) +>add : Symbol(Point.add, Decl(es6ClassTest4.ts, 3, 14)) >dx : Symbol(dx, Decl(es6ClassTest4.ts, 4, 8)) >dy : Symbol(dy, Decl(es6ClassTest4.ts, 4, 19)) >Point : Symbol(Point, Decl(es6ClassTest4.ts, 0, 0)) mult(p: Point): Point; ->mult : Symbol(mult, Decl(es6ClassTest4.ts, 4, 39)) +>mult : Symbol(Point.mult, Decl(es6ClassTest4.ts, 4, 39)) >p : Symbol(p, Decl(es6ClassTest4.ts, 5, 9)) >Point : Symbol(Point, Decl(es6ClassTest4.ts, 0, 0)) >Point : Symbol(Point, Decl(es6ClassTest4.ts, 0, 0)) diff --git a/tests/baselines/reference/es6ClassTest5.symbols b/tests/baselines/reference/es6ClassTest5.symbols index 89c6921e163..063265e0dad 100644 --- a/tests/baselines/reference/es6ClassTest5.symbols +++ b/tests/baselines/reference/es6ClassTest5.symbols @@ -3,7 +3,7 @@ class C1T5 { >C1T5 : Symbol(C1T5, Decl(es6ClassTest5.ts, 0, 0)) foo: (i: number, s: string) => number = ->foo : Symbol(foo, Decl(es6ClassTest5.ts, 0, 12)) +>foo : Symbol(C1T5.foo, Decl(es6ClassTest5.ts, 0, 12)) >i : Symbol(i, Decl(es6ClassTest5.ts, 1, 10)) >s : Symbol(s, Decl(es6ClassTest5.ts, 1, 20)) @@ -21,6 +21,6 @@ class bigClass { >bigClass : Symbol(bigClass, Decl(es6ClassTest5.ts, 6, 14)) public break = 1; ->break : Symbol(break, Decl(es6ClassTest5.ts, 8, 17)) +>break : Symbol(bigClass.break, Decl(es6ClassTest5.ts, 8, 17)) } diff --git a/tests/baselines/reference/es6ClassTest8.symbols b/tests/baselines/reference/es6ClassTest8.symbols index b02b80e7017..3894b884a1f 100644 --- a/tests/baselines/reference/es6ClassTest8.symbols +++ b/tests/baselines/reference/es6ClassTest8.symbols @@ -58,13 +58,13 @@ class Vector { >Vector : Symbol(Vector, Decl(es6ClassTest8.ts, 10, 1)) constructor(public x: number, ->x : Symbol(x, Decl(es6ClassTest8.ts, 18, 16)) +>x : Symbol(Vector.x, Decl(es6ClassTest8.ts, 18, 16)) public y: number, ->y : Symbol(y, Decl(es6ClassTest8.ts, 18, 33)) +>y : Symbol(Vector.y, Decl(es6ClassTest8.ts, 18, 33)) public z: number) { ->z : Symbol(z, Decl(es6ClassTest8.ts, 19, 33)) +>z : Symbol(Vector.z, Decl(es6ClassTest8.ts, 19, 33)) } static dot(v1:Vector, v2:Vector):Vector {return null;} @@ -81,19 +81,19 @@ class Camera { >Camera : Symbol(Camera, Decl(es6ClassTest8.ts, 25, 1)) public forward: Vector; ->forward : Symbol(forward, Decl(es6ClassTest8.ts, 27, 14)) +>forward : Symbol(Camera.forward, Decl(es6ClassTest8.ts, 27, 14)) >Vector : Symbol(Vector, Decl(es6ClassTest8.ts, 10, 1)) public right: Vector; ->right : Symbol(right, Decl(es6ClassTest8.ts, 28, 27)) +>right : Symbol(Camera.right, Decl(es6ClassTest8.ts, 28, 27)) >Vector : Symbol(Vector, Decl(es6ClassTest8.ts, 10, 1)) public up: Vector; ->up : Symbol(up, Decl(es6ClassTest8.ts, 29, 25)) +>up : Symbol(Camera.up, Decl(es6ClassTest8.ts, 29, 25)) >Vector : Symbol(Vector, Decl(es6ClassTest8.ts, 10, 1)) constructor(public pos: Vector, lookAt: Vector) { ->pos : Symbol(pos, Decl(es6ClassTest8.ts, 31, 16)) +>pos : Symbol(Camera.pos, Decl(es6ClassTest8.ts, 31, 16)) >Vector : Symbol(Vector, Decl(es6ClassTest8.ts, 10, 1)) >lookAt : Symbol(lookAt, Decl(es6ClassTest8.ts, 31, 35)) >Vector : Symbol(Vector, Decl(es6ClassTest8.ts, 10, 1)) @@ -103,9 +103,9 @@ class Camera { >Vector : Symbol(Vector, Decl(es6ClassTest8.ts, 10, 1)) this.forward = Vector.norm(Vector.minus(lookAt,this.pos)); ->this.forward : Symbol(forward, Decl(es6ClassTest8.ts, 27, 14)) +>this.forward : Symbol(Camera.forward, Decl(es6ClassTest8.ts, 27, 14)) >this : Symbol(Camera, Decl(es6ClassTest8.ts, 25, 1)) ->forward : Symbol(forward, Decl(es6ClassTest8.ts, 27, 14)) +>forward : Symbol(Camera.forward, Decl(es6ClassTest8.ts, 27, 14)) >Vector.norm : Symbol(Vector.norm, Decl(es6ClassTest8.ts, 12, 14)) >Vector : Symbol(Vector, Decl(es6ClassTest8.ts, 10, 1)) >norm : Symbol(Vector.norm, Decl(es6ClassTest8.ts, 12, 14)) @@ -113,14 +113,14 @@ class Camera { >Vector : Symbol(Vector, Decl(es6ClassTest8.ts, 10, 1)) >minus : Symbol(Vector.minus, Decl(es6ClassTest8.ts, 13, 47)) >lookAt : Symbol(lookAt, Decl(es6ClassTest8.ts, 31, 35)) ->this.pos : Symbol(pos, Decl(es6ClassTest8.ts, 31, 16)) +>this.pos : Symbol(Camera.pos, Decl(es6ClassTest8.ts, 31, 16)) >this : Symbol(Camera, Decl(es6ClassTest8.ts, 25, 1)) ->pos : Symbol(pos, Decl(es6ClassTest8.ts, 31, 16)) +>pos : Symbol(Camera.pos, Decl(es6ClassTest8.ts, 31, 16)) this.right = Vector.times(down, Vector.norm(Vector.cross(this.forward, down))); ->this.right : Symbol(right, Decl(es6ClassTest8.ts, 28, 27)) +>this.right : Symbol(Camera.right, Decl(es6ClassTest8.ts, 28, 27)) >this : Symbol(Camera, Decl(es6ClassTest8.ts, 25, 1)) ->right : Symbol(right, Decl(es6ClassTest8.ts, 28, 27)) +>right : Symbol(Camera.right, Decl(es6ClassTest8.ts, 28, 27)) >Vector.times : Symbol(Vector.times, Decl(es6ClassTest8.ts, 14, 60)) >Vector : Symbol(Vector, Decl(es6ClassTest8.ts, 10, 1)) >times : Symbol(Vector.times, Decl(es6ClassTest8.ts, 14, 60)) @@ -131,15 +131,15 @@ class Camera { >Vector.cross : Symbol(Vector.cross, Decl(es6ClassTest8.ts, 15, 60)) >Vector : Symbol(Vector, Decl(es6ClassTest8.ts, 10, 1)) >cross : Symbol(Vector.cross, Decl(es6ClassTest8.ts, 15, 60)) ->this.forward : Symbol(forward, Decl(es6ClassTest8.ts, 27, 14)) +>this.forward : Symbol(Camera.forward, Decl(es6ClassTest8.ts, 27, 14)) >this : Symbol(Camera, Decl(es6ClassTest8.ts, 25, 1)) ->forward : Symbol(forward, Decl(es6ClassTest8.ts, 27, 14)) +>forward : Symbol(Camera.forward, Decl(es6ClassTest8.ts, 27, 14)) >down : Symbol(down, Decl(es6ClassTest8.ts, 32, 11)) this.up = Vector.times(down, Vector.norm(Vector.cross(this.forward, this.right))); ->this.up : Symbol(up, Decl(es6ClassTest8.ts, 29, 25)) +>this.up : Symbol(Camera.up, Decl(es6ClassTest8.ts, 29, 25)) >this : Symbol(Camera, Decl(es6ClassTest8.ts, 25, 1)) ->up : Symbol(up, Decl(es6ClassTest8.ts, 29, 25)) +>up : Symbol(Camera.up, Decl(es6ClassTest8.ts, 29, 25)) >Vector.times : Symbol(Vector.times, Decl(es6ClassTest8.ts, 14, 60)) >Vector : Symbol(Vector, Decl(es6ClassTest8.ts, 10, 1)) >times : Symbol(Vector.times, Decl(es6ClassTest8.ts, 14, 60)) @@ -150,12 +150,12 @@ class Camera { >Vector.cross : Symbol(Vector.cross, Decl(es6ClassTest8.ts, 15, 60)) >Vector : Symbol(Vector, Decl(es6ClassTest8.ts, 10, 1)) >cross : Symbol(Vector.cross, Decl(es6ClassTest8.ts, 15, 60)) ->this.forward : Symbol(forward, Decl(es6ClassTest8.ts, 27, 14)) +>this.forward : Symbol(Camera.forward, Decl(es6ClassTest8.ts, 27, 14)) >this : Symbol(Camera, Decl(es6ClassTest8.ts, 25, 1)) ->forward : Symbol(forward, Decl(es6ClassTest8.ts, 27, 14)) ->this.right : Symbol(right, Decl(es6ClassTest8.ts, 28, 27)) +>forward : Symbol(Camera.forward, Decl(es6ClassTest8.ts, 27, 14)) +>this.right : Symbol(Camera.right, Decl(es6ClassTest8.ts, 28, 27)) >this : Symbol(Camera, Decl(es6ClassTest8.ts, 25, 1)) ->right : Symbol(right, Decl(es6ClassTest8.ts, 28, 27)) +>right : Symbol(Camera.right, Decl(es6ClassTest8.ts, 28, 27)) } } diff --git a/tests/baselines/reference/es6ExportDefaultClassDeclaration.symbols b/tests/baselines/reference/es6ExportDefaultClassDeclaration.symbols index 02aa5575190..3e5ce34c7d7 100644 --- a/tests/baselines/reference/es6ExportDefaultClassDeclaration.symbols +++ b/tests/baselines/reference/es6ExportDefaultClassDeclaration.symbols @@ -4,6 +4,6 @@ export default class C { >C : Symbol(C, Decl(es6ExportDefaultClassDeclaration.ts, 0, 0)) method() { } ->method : Symbol(method, Decl(es6ExportDefaultClassDeclaration.ts, 1, 24)) +>method : Symbol(C.method, Decl(es6ExportDefaultClassDeclaration.ts, 1, 24)) } diff --git a/tests/baselines/reference/es6ExportDefaultClassDeclaration2.symbols b/tests/baselines/reference/es6ExportDefaultClassDeclaration2.symbols index 168c402d3e4..a52c754c581 100644 --- a/tests/baselines/reference/es6ExportDefaultClassDeclaration2.symbols +++ b/tests/baselines/reference/es6ExportDefaultClassDeclaration2.symbols @@ -2,6 +2,6 @@ export default class { method() { } ->method : Symbol(method, Decl(es6ExportDefaultClassDeclaration2.ts, 1, 22)) +>method : Symbol(default.method, Decl(es6ExportDefaultClassDeclaration2.ts, 1, 22)) } diff --git a/tests/baselines/reference/es6ExportEqualsInterop.js b/tests/baselines/reference/es6ExportEqualsInterop.js index 1ad4222d222..6e9589acc9a 100644 --- a/tests/baselines/reference/es6ExportEqualsInterop.js +++ b/tests/baselines/reference/es6ExportEqualsInterop.js @@ -275,6 +275,8 @@ function_module_1.a; class_1.a; class_module_1.a; // named export +var interface_2 = require("interface"); +exports.a1 = interface_2.a; var variable_2 = require("variable"); exports.a2 = variable_2.a; var interface_variable_2 = require("interface-variable"); @@ -285,8 +287,12 @@ var interface_module_2 = require("interface-module"); exports.a5 = interface_module_2.a; var variable_module_2 = require("variable-module"); exports.a6 = variable_module_2.a; +var function_2 = require("function"); +exports.a7 = function_2.a; var function_module_2 = require("function-module"); exports.a8 = function_module_2.a; +var class_2 = require("class"); +exports.a9 = class_2.a; var class_module_2 = require("class-module"); exports.a0 = class_module_2.a; // export-star diff --git a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport.js b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport.js index d7dfe29208d..4bff2abf82d 100644 --- a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport.js +++ b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport.js @@ -31,16 +31,16 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.default = {}; //// [es6ImportDefaultBindingFollowedWithNamedImport_1.js] "use strict"; -var es6ImportDefaultBindingFollowedWithNamedImport_0_1 = require("./es6ImportDefaultBindingFollowedWithNamedImport_0"); +const es6ImportDefaultBindingFollowedWithNamedImport_0_1 = require("./es6ImportDefaultBindingFollowedWithNamedImport_0"); var x1 = es6ImportDefaultBindingFollowedWithNamedImport_0_1.a; -var es6ImportDefaultBindingFollowedWithNamedImport_0_2 = require("./es6ImportDefaultBindingFollowedWithNamedImport_0"); +const es6ImportDefaultBindingFollowedWithNamedImport_0_2 = require("./es6ImportDefaultBindingFollowedWithNamedImport_0"); var x1 = es6ImportDefaultBindingFollowedWithNamedImport_0_2.a; -var es6ImportDefaultBindingFollowedWithNamedImport_0_3 = require("./es6ImportDefaultBindingFollowedWithNamedImport_0"); +const es6ImportDefaultBindingFollowedWithNamedImport_0_3 = require("./es6ImportDefaultBindingFollowedWithNamedImport_0"); var x1 = es6ImportDefaultBindingFollowedWithNamedImport_0_3.x; var x1 = es6ImportDefaultBindingFollowedWithNamedImport_0_3.a; -var es6ImportDefaultBindingFollowedWithNamedImport_0_4 = require("./es6ImportDefaultBindingFollowedWithNamedImport_0"); +const es6ImportDefaultBindingFollowedWithNamedImport_0_4 = require("./es6ImportDefaultBindingFollowedWithNamedImport_0"); var x1 = es6ImportDefaultBindingFollowedWithNamedImport_0_4.x; -var es6ImportDefaultBindingFollowedWithNamedImport_0_5 = require("./es6ImportDefaultBindingFollowedWithNamedImport_0"); +const es6ImportDefaultBindingFollowedWithNamedImport_0_5 = require("./es6ImportDefaultBindingFollowedWithNamedImport_0"); var x1 = es6ImportDefaultBindingFollowedWithNamedImport_0_5.m; diff --git a/tests/baselines/reference/es6ImportNameSpaceImport.js b/tests/baselines/reference/es6ImportNameSpaceImport.js index 685e1cf643c..8e109779f45 100644 --- a/tests/baselines/reference/es6ImportNameSpaceImport.js +++ b/tests/baselines/reference/es6ImportNameSpaceImport.js @@ -15,7 +15,7 @@ import * as nameSpaceBinding2 from "./es6ImportNameSpaceImport_0"; // elide this exports.a = 10; //// [es6ImportNameSpaceImport_1.js] "use strict"; -var nameSpaceBinding = require("./es6ImportNameSpaceImport_0"); +const nameSpaceBinding = require("./es6ImportNameSpaceImport_0"); var x = nameSpaceBinding.a; diff --git a/tests/baselines/reference/es6ImportNamedImport.js b/tests/baselines/reference/es6ImportNamedImport.js index 73fe8f4ec1b..8dbdf7ce6f1 100644 --- a/tests/baselines/reference/es6ImportNamedImport.js +++ b/tests/baselines/reference/es6ImportNamedImport.js @@ -53,26 +53,26 @@ exports.z2 = 10; exports.aaaa = 10; //// [es6ImportNamedImport_1.js] "use strict"; -var es6ImportNamedImport_0_1 = require("./es6ImportNamedImport_0"); +const es6ImportNamedImport_0_1 = require("./es6ImportNamedImport_0"); var xxxx = es6ImportNamedImport_0_1.a; -var es6ImportNamedImport_0_2 = require("./es6ImportNamedImport_0"); +const es6ImportNamedImport_0_2 = require("./es6ImportNamedImport_0"); var xxxx = es6ImportNamedImport_0_2.a; -var es6ImportNamedImport_0_3 = require("./es6ImportNamedImport_0"); +const es6ImportNamedImport_0_3 = require("./es6ImportNamedImport_0"); var xxxx = es6ImportNamedImport_0_3.x; var xxxx = es6ImportNamedImport_0_3.a; -var es6ImportNamedImport_0_4 = require("./es6ImportNamedImport_0"); +const es6ImportNamedImport_0_4 = require("./es6ImportNamedImport_0"); var xxxx = es6ImportNamedImport_0_4.x; -var es6ImportNamedImport_0_5 = require("./es6ImportNamedImport_0"); +const es6ImportNamedImport_0_5 = require("./es6ImportNamedImport_0"); var xxxx = es6ImportNamedImport_0_5.m; -var es6ImportNamedImport_0_6 = require("./es6ImportNamedImport_0"); +const es6ImportNamedImport_0_6 = require("./es6ImportNamedImport_0"); var xxxx = es6ImportNamedImport_0_6.a1; var xxxx = es6ImportNamedImport_0_6.x1; -var es6ImportNamedImport_0_7 = require("./es6ImportNamedImport_0"); +const es6ImportNamedImport_0_7 = require("./es6ImportNamedImport_0"); var xxxx = es6ImportNamedImport_0_7.a1; var xxxx = es6ImportNamedImport_0_7.x1; -var es6ImportNamedImport_0_8 = require("./es6ImportNamedImport_0"); +const es6ImportNamedImport_0_8 = require("./es6ImportNamedImport_0"); var z111 = es6ImportNamedImport_0_8.z1; -var es6ImportNamedImport_0_9 = require("./es6ImportNamedImport_0"); +const es6ImportNamedImport_0_9 = require("./es6ImportNamedImport_0"); var z2 = es6ImportNamedImport_0_9.z2; // z2 shouldn't give redeclare error diff --git a/tests/baselines/reference/es6ImportNamedImportInExportAssignment.js b/tests/baselines/reference/es6ImportNamedImportInExportAssignment.js index b67f61e88ae..38766d32cd9 100644 --- a/tests/baselines/reference/es6ImportNamedImportInExportAssignment.js +++ b/tests/baselines/reference/es6ImportNamedImportInExportAssignment.js @@ -13,7 +13,7 @@ export = a; exports.a = 10; //// [es6ImportNamedImportInExportAssignment_1.js] "use strict"; -var es6ImportNamedImportInExportAssignment_0_1 = require("./es6ImportNamedImportInExportAssignment_0"); +const es6ImportNamedImportInExportAssignment_0_1 = require("./es6ImportNamedImportInExportAssignment_0"); module.exports = es6ImportNamedImportInExportAssignment_0_1.a; diff --git a/tests/baselines/reference/es6ImportNamedImportWithTypesAndValues.symbols b/tests/baselines/reference/es6ImportNamedImportWithTypesAndValues.symbols index cff0406b220..5abd8c88867 100644 --- a/tests/baselines/reference/es6ImportNamedImportWithTypesAndValues.symbols +++ b/tests/baselines/reference/es6ImportNamedImportWithTypesAndValues.symbols @@ -4,27 +4,27 @@ export interface I { >I : Symbol(I, Decl(server.ts, 0, 0)) prop: string; ->prop : Symbol(prop, Decl(server.ts, 1, 20)) +>prop : Symbol(I.prop, Decl(server.ts, 1, 20)) } export interface I2 { >I2 : Symbol(I2, Decl(server.ts, 3, 1)) prop2: string; ->prop2 : Symbol(prop2, Decl(server.ts, 4, 21)) +>prop2 : Symbol(I2.prop2, Decl(server.ts, 4, 21)) } export class C implements I { >C : Symbol(C, Decl(server.ts, 6, 1)) >I : Symbol(I, Decl(server.ts, 0, 0)) prop = "hello"; ->prop : Symbol(prop, Decl(server.ts, 7, 29)) +>prop : Symbol(C.prop, Decl(server.ts, 7, 29)) } export class C2 implements I2 { >C2 : Symbol(C2, Decl(server.ts, 9, 1)) >I2 : Symbol(I2, Decl(server.ts, 3, 1)) prop2 = "world"; ->prop2 : Symbol(prop2, Decl(server.ts, 10, 31)) +>prop2 : Symbol(C2.prop2, Decl(server.ts, 10, 31)) } === tests/cases/compiler/client.ts === diff --git a/tests/baselines/reference/es6ImportWithoutFromClause.js b/tests/baselines/reference/es6ImportWithoutFromClause.js index 9666409b924..cc8509baade 100644 --- a/tests/baselines/reference/es6ImportWithoutFromClause.js +++ b/tests/baselines/reference/es6ImportWithoutFromClause.js @@ -17,3 +17,4 @@ import "es6ImportWithoutFromClause_0"; //// [es6ImportWithoutFromClause_0.d.ts] export declare var a: number; //// [es6ImportWithoutFromClause_1.d.ts] +import "es6ImportWithoutFromClause_0"; diff --git a/tests/baselines/reference/es6ImportWithoutFromClauseAmd.js b/tests/baselines/reference/es6ImportWithoutFromClauseAmd.js index 39b6b04464c..ea533a9a963 100644 --- a/tests/baselines/reference/es6ImportWithoutFromClauseAmd.js +++ b/tests/baselines/reference/es6ImportWithoutFromClauseAmd.js @@ -36,3 +36,5 @@ export declare var a: number; //// [es6ImportWithoutFromClauseAmd_1.d.ts] export declare var b: number; //// [es6ImportWithoutFromClauseAmd_2.d.ts] +import "es6ImportWithoutFromClauseAmd_0"; +import "es6ImportWithoutFromClauseAmd_2"; diff --git a/tests/baselines/reference/es6ImportWithoutFromClauseInEs5.js b/tests/baselines/reference/es6ImportWithoutFromClauseInEs5.js index c39cd1172a0..d0f7c9fbe65 100644 --- a/tests/baselines/reference/es6ImportWithoutFromClauseInEs5.js +++ b/tests/baselines/reference/es6ImportWithoutFromClauseInEs5.js @@ -18,3 +18,4 @@ require("es6ImportWithoutFromClauseInEs5_0"); //// [es6ImportWithoutFromClauseInEs5_0.d.ts] export declare var a: number; //// [es6ImportWithoutFromClauseInEs5_1.d.ts] +import "es6ImportWithoutFromClauseInEs5_0"; diff --git a/tests/baselines/reference/es6ImportWithoutFromClauseNonInstantiatedModule.js b/tests/baselines/reference/es6ImportWithoutFromClauseNonInstantiatedModule.js index e63dd4bb53a..51bb0f3338d 100644 --- a/tests/baselines/reference/es6ImportWithoutFromClauseNonInstantiatedModule.js +++ b/tests/baselines/reference/es6ImportWithoutFromClauseNonInstantiatedModule.js @@ -17,3 +17,4 @@ import "es6ImportWithoutFromClauseNonInstantiatedModule_0"; export interface i { } //// [es6ImportWithoutFromClauseNonInstantiatedModule_1.d.ts] +import "es6ImportWithoutFromClauseNonInstantiatedModule_0"; diff --git a/tests/baselines/reference/es6Module.symbols b/tests/baselines/reference/es6Module.symbols index 8887adfff37..6849e2904da 100644 --- a/tests/baselines/reference/es6Module.symbols +++ b/tests/baselines/reference/es6Module.symbols @@ -7,7 +7,7 @@ export class A } public B() ->B : Symbol(B, Decl(es6Module.ts, 4, 5)) +>B : Symbol(A.B, Decl(es6Module.ts, 4, 5)) { return 42; } diff --git a/tests/baselines/reference/es6ModuleClassDeclaration.symbols b/tests/baselines/reference/es6ModuleClassDeclaration.symbols index 5ad84b94f0a..424a7245587 100644 --- a/tests/baselines/reference/es6ModuleClassDeclaration.symbols +++ b/tests/baselines/reference/es6ModuleClassDeclaration.symbols @@ -5,10 +5,10 @@ export class c { constructor() { } private x = 10; ->x : Symbol(x, Decl(es6ModuleClassDeclaration.ts, 2, 5)) +>x : Symbol(c.x, Decl(es6ModuleClassDeclaration.ts, 2, 5)) public y = 30; ->y : Symbol(y, Decl(es6ModuleClassDeclaration.ts, 3, 19)) +>y : Symbol(c.y, Decl(es6ModuleClassDeclaration.ts, 3, 19)) static k = 20; >k : Symbol(c.k, Decl(es6ModuleClassDeclaration.ts, 4, 18)) @@ -17,10 +17,10 @@ export class c { >l : Symbol(c.l, Decl(es6ModuleClassDeclaration.ts, 5, 18)) private method1() { ->method1 : Symbol(method1, Decl(es6ModuleClassDeclaration.ts, 6, 26)) +>method1 : Symbol(c.method1, Decl(es6ModuleClassDeclaration.ts, 6, 26)) } public method2() { ->method2 : Symbol(method2, Decl(es6ModuleClassDeclaration.ts, 8, 5)) +>method2 : Symbol(c.method2, Decl(es6ModuleClassDeclaration.ts, 8, 5)) } static method3() { >method3 : Symbol(c.method3, Decl(es6ModuleClassDeclaration.ts, 10, 5)) @@ -35,10 +35,10 @@ class c2 { constructor() { } private x = 10; ->x : Symbol(x, Decl(es6ModuleClassDeclaration.ts, 18, 5)) +>x : Symbol(c2.x, Decl(es6ModuleClassDeclaration.ts, 18, 5)) public y = 30; ->y : Symbol(y, Decl(es6ModuleClassDeclaration.ts, 19, 19)) +>y : Symbol(c2.y, Decl(es6ModuleClassDeclaration.ts, 19, 19)) static k = 20; >k : Symbol(c2.k, Decl(es6ModuleClassDeclaration.ts, 20, 18)) @@ -47,10 +47,10 @@ class c2 { >l : Symbol(c2.l, Decl(es6ModuleClassDeclaration.ts, 21, 18)) private method1() { ->method1 : Symbol(method1, Decl(es6ModuleClassDeclaration.ts, 22, 26)) +>method1 : Symbol(c2.method1, Decl(es6ModuleClassDeclaration.ts, 22, 26)) } public method2() { ->method2 : Symbol(method2, Decl(es6ModuleClassDeclaration.ts, 24, 5)) +>method2 : Symbol(c2.method2, Decl(es6ModuleClassDeclaration.ts, 24, 5)) } static method3() { >method3 : Symbol(c2.method3, Decl(es6ModuleClassDeclaration.ts, 26, 5)) @@ -74,10 +74,10 @@ export module m1 { constructor() { } private x = 10; ->x : Symbol(x, Decl(es6ModuleClassDeclaration.ts, 38, 9)) +>x : Symbol(c3.x, Decl(es6ModuleClassDeclaration.ts, 38, 9)) public y = 30; ->y : Symbol(y, Decl(es6ModuleClassDeclaration.ts, 39, 23)) +>y : Symbol(c3.y, Decl(es6ModuleClassDeclaration.ts, 39, 23)) static k = 20; >k : Symbol(c3.k, Decl(es6ModuleClassDeclaration.ts, 40, 22)) @@ -86,10 +86,10 @@ export module m1 { >l : Symbol(c3.l, Decl(es6ModuleClassDeclaration.ts, 41, 22)) private method1() { ->method1 : Symbol(method1, Decl(es6ModuleClassDeclaration.ts, 42, 30)) +>method1 : Symbol(c3.method1, Decl(es6ModuleClassDeclaration.ts, 42, 30)) } public method2() { ->method2 : Symbol(method2, Decl(es6ModuleClassDeclaration.ts, 44, 9)) +>method2 : Symbol(c3.method2, Decl(es6ModuleClassDeclaration.ts, 44, 9)) } static method3() { >method3 : Symbol(c3.method3, Decl(es6ModuleClassDeclaration.ts, 46, 9)) @@ -104,10 +104,10 @@ export module m1 { constructor() { } private x = 10; ->x : Symbol(x, Decl(es6ModuleClassDeclaration.ts, 54, 9)) +>x : Symbol(c4.x, Decl(es6ModuleClassDeclaration.ts, 54, 9)) public y = 30; ->y : Symbol(y, Decl(es6ModuleClassDeclaration.ts, 55, 23)) +>y : Symbol(c4.y, Decl(es6ModuleClassDeclaration.ts, 55, 23)) static k = 20; >k : Symbol(c4.k, Decl(es6ModuleClassDeclaration.ts, 56, 22)) @@ -116,10 +116,10 @@ export module m1 { >l : Symbol(c4.l, Decl(es6ModuleClassDeclaration.ts, 57, 22)) private method1() { ->method1 : Symbol(method1, Decl(es6ModuleClassDeclaration.ts, 58, 30)) +>method1 : Symbol(c4.method1, Decl(es6ModuleClassDeclaration.ts, 58, 30)) } public method2() { ->method2 : Symbol(method2, Decl(es6ModuleClassDeclaration.ts, 60, 9)) +>method2 : Symbol(c4.method2, Decl(es6ModuleClassDeclaration.ts, 60, 9)) } static method3() { >method3 : Symbol(c4.method3, Decl(es6ModuleClassDeclaration.ts, 62, 9)) @@ -149,10 +149,10 @@ module m2 { constructor() { } private x = 10; ->x : Symbol(x, Decl(es6ModuleClassDeclaration.ts, 76, 9)) +>x : Symbol(c3.x, Decl(es6ModuleClassDeclaration.ts, 76, 9)) public y = 30; ->y : Symbol(y, Decl(es6ModuleClassDeclaration.ts, 77, 23)) +>y : Symbol(c3.y, Decl(es6ModuleClassDeclaration.ts, 77, 23)) static k = 20; >k : Symbol(c3.k, Decl(es6ModuleClassDeclaration.ts, 78, 22)) @@ -161,10 +161,10 @@ module m2 { >l : Symbol(c3.l, Decl(es6ModuleClassDeclaration.ts, 79, 22)) private method1() { ->method1 : Symbol(method1, Decl(es6ModuleClassDeclaration.ts, 80, 30)) +>method1 : Symbol(c3.method1, Decl(es6ModuleClassDeclaration.ts, 80, 30)) } public method2() { ->method2 : Symbol(method2, Decl(es6ModuleClassDeclaration.ts, 82, 9)) +>method2 : Symbol(c3.method2, Decl(es6ModuleClassDeclaration.ts, 82, 9)) } static method3() { >method3 : Symbol(c3.method3, Decl(es6ModuleClassDeclaration.ts, 84, 9)) @@ -179,10 +179,10 @@ module m2 { constructor() { } private x = 10; ->x : Symbol(x, Decl(es6ModuleClassDeclaration.ts, 92, 9)) +>x : Symbol(c4.x, Decl(es6ModuleClassDeclaration.ts, 92, 9)) public y = 30; ->y : Symbol(y, Decl(es6ModuleClassDeclaration.ts, 93, 23)) +>y : Symbol(c4.y, Decl(es6ModuleClassDeclaration.ts, 93, 23)) static k = 20; >k : Symbol(c4.k, Decl(es6ModuleClassDeclaration.ts, 94, 22)) @@ -191,10 +191,10 @@ module m2 { >l : Symbol(c4.l, Decl(es6ModuleClassDeclaration.ts, 95, 22)) private method1() { ->method1 : Symbol(method1, Decl(es6ModuleClassDeclaration.ts, 96, 30)) +>method1 : Symbol(c4.method1, Decl(es6ModuleClassDeclaration.ts, 96, 30)) } public method2() { ->method2 : Symbol(method2, Decl(es6ModuleClassDeclaration.ts, 98, 9)) +>method2 : Symbol(c4.method2, Decl(es6ModuleClassDeclaration.ts, 98, 9)) } static method3() { >method3 : Symbol(c4.method3, Decl(es6ModuleClassDeclaration.ts, 100, 9)) diff --git a/tests/baselines/reference/es6ModuleWithModuleGenTargetAmd.symbols b/tests/baselines/reference/es6ModuleWithModuleGenTargetAmd.symbols index 24367cc28ad..fd566b39990 100644 --- a/tests/baselines/reference/es6ModuleWithModuleGenTargetAmd.symbols +++ b/tests/baselines/reference/es6ModuleWithModuleGenTargetAmd.symbols @@ -7,7 +7,7 @@ export class A } public B() ->B : Symbol(B, Decl(es6ModuleWithModuleGenTargetAmd.ts, 4, 5)) +>B : Symbol(A.B, Decl(es6ModuleWithModuleGenTargetAmd.ts, 4, 5)) { return 42; } diff --git a/tests/baselines/reference/es6ModuleWithModuleGenTargetCommonjs.symbols b/tests/baselines/reference/es6ModuleWithModuleGenTargetCommonjs.symbols index 4a84c00c48f..a143a75f988 100644 --- a/tests/baselines/reference/es6ModuleWithModuleGenTargetCommonjs.symbols +++ b/tests/baselines/reference/es6ModuleWithModuleGenTargetCommonjs.symbols @@ -7,7 +7,7 @@ export class A } public B() ->B : Symbol(B, Decl(es6ModuleWithModuleGenTargetCommonjs.ts, 4, 5)) +>B : Symbol(A.B, Decl(es6ModuleWithModuleGenTargetCommonjs.ts, 4, 5)) { return 42; } diff --git a/tests/baselines/reference/es6modulekind.symbols b/tests/baselines/reference/es6modulekind.symbols index 0b5eeb2a6fb..877199729e6 100644 --- a/tests/baselines/reference/es6modulekind.symbols +++ b/tests/baselines/reference/es6modulekind.symbols @@ -9,7 +9,7 @@ export default class A } public B() ->B : Symbol(B, Decl(es6modulekind.ts, 6, 5)) +>B : Symbol(A.B, Decl(es6modulekind.ts, 6, 5)) { return 42; } diff --git a/tests/baselines/reference/es6modulekindWithES2015Target.symbols b/tests/baselines/reference/es6modulekindWithES2015Target.symbols index 98b91a0411b..2b6f8a03aa7 100644 --- a/tests/baselines/reference/es6modulekindWithES2015Target.symbols +++ b/tests/baselines/reference/es6modulekindWithES2015Target.symbols @@ -9,7 +9,7 @@ export default class A } public B() ->B : Symbol(B, Decl(es6modulekindWithES2015Target.ts, 6, 5)) +>B : Symbol(A.B, Decl(es6modulekindWithES2015Target.ts, 6, 5)) { return 42; } diff --git a/tests/baselines/reference/escapedIdentifiers.symbols b/tests/baselines/reference/escapedIdentifiers.symbols index a99e067b898..735dede00e2 100644 --- a/tests/baselines/reference/escapedIdentifiers.symbols +++ b/tests/baselines/reference/escapedIdentifiers.symbols @@ -70,13 +70,13 @@ class classType1 { >classType1 : Symbol(classType1, Decl(escapedIdentifiers.ts, 32, 26)) public foo1: number; ->foo1 : Symbol(foo1, Decl(escapedIdentifiers.ts, 36, 18)) +>foo1 : Symbol(classType1.foo1, Decl(escapedIdentifiers.ts, 36, 18)) } class classType\u0032 { >classType\u0032 : Symbol(classType\u0032, Decl(escapedIdentifiers.ts, 38, 1)) public foo2: number; ->foo2 : Symbol(foo2, Decl(escapedIdentifiers.ts, 39, 23)) +>foo2 : Symbol(classType\u0032.foo2, Decl(escapedIdentifiers.ts, 39, 23)) } var classType1Object1 = new classType1(); @@ -120,13 +120,13 @@ interface interfaceType1 { >interfaceType1 : Symbol(interfaceType1, Decl(escapedIdentifiers.ts, 50, 27)) bar1: number; ->bar1 : Symbol(bar1, Decl(escapedIdentifiers.ts, 53, 26)) +>bar1 : Symbol(interfaceType1.bar1, Decl(escapedIdentifiers.ts, 53, 26)) } interface interfaceType\u0032 { >interfaceType\u0032 : Symbol(interfaceType\u0032, Decl(escapedIdentifiers.ts, 55, 1)) bar2: number; ->bar2 : Symbol(bar2, Decl(escapedIdentifiers.ts, 56, 31)) +>bar2 : Symbol(interfaceType\u0032.bar2, Decl(escapedIdentifiers.ts, 56, 31)) } var interfaceType1Object1 = { bar1: 0 }; @@ -175,7 +175,7 @@ class testClass { >testClass : Symbol(testClass, Decl(escapedIdentifiers.ts, 67, 31)) public func(arg1: number, arg\u0032: string, arg\u0033: boolean, arg4: number) { ->func : Symbol(func, Decl(escapedIdentifiers.ts, 71, 17)) +>func : Symbol(testClass.func, Decl(escapedIdentifiers.ts, 71, 17)) >arg1 : Symbol(arg1, Decl(escapedIdentifiers.ts, 72, 16)) >arg\u0032 : Symbol(arg\u0032, Decl(escapedIdentifiers.ts, 72, 29)) >arg\u0033 : Symbol(arg\u0033, Decl(escapedIdentifiers.ts, 72, 48)) @@ -200,10 +200,10 @@ class constructorTestClass { >constructorTestClass : Symbol(constructorTestClass, Decl(escapedIdentifiers.ts, 78, 1)) constructor (public arg1: number,public arg\u0032: string,public arg\u0033: boolean,public arg4: number) { ->arg1 : Symbol(arg1, Decl(escapedIdentifiers.ts, 82, 17)) ->arg\u0032 : Symbol(arg\u0032, Decl(escapedIdentifiers.ts, 82, 37)) ->arg\u0033 : Symbol(arg\u0033, Decl(escapedIdentifiers.ts, 82, 62)) ->arg4 : Symbol(arg4, Decl(escapedIdentifiers.ts, 82, 88)) +>arg1 : Symbol(constructorTestClass.arg1, Decl(escapedIdentifiers.ts, 82, 17)) +>arg\u0032 : Symbol(constructorTestClass.arg\u0032, Decl(escapedIdentifiers.ts, 82, 37)) +>arg\u0033 : Symbol(constructorTestClass.arg\u0033, Decl(escapedIdentifiers.ts, 82, 62)) +>arg4 : Symbol(constructorTestClass.arg4, Decl(escapedIdentifiers.ts, 82, 88)) } } var constructorTestObject = new constructorTestClass(1, 'string', true, 2); diff --git a/tests/baselines/reference/everyTypeAssignableToAny.symbols b/tests/baselines/reference/everyTypeAssignableToAny.symbols index be88c481ece..caf8c5e47d6 100644 --- a/tests/baselines/reference/everyTypeAssignableToAny.symbols +++ b/tests/baselines/reference/everyTypeAssignableToAny.symbols @@ -6,7 +6,7 @@ class C { >C : Symbol(C, Decl(everyTypeAssignableToAny.ts, 0, 11)) foo: string; ->foo : Symbol(foo, Decl(everyTypeAssignableToAny.ts, 2, 9)) +>foo : Symbol(C.foo, Decl(everyTypeAssignableToAny.ts, 2, 9)) } var ac: C; >ac : Symbol(ac, Decl(everyTypeAssignableToAny.ts, 5, 3)) @@ -16,7 +16,7 @@ interface I { >I : Symbol(I, Decl(everyTypeAssignableToAny.ts, 5, 10)) foo: string; ->foo : Symbol(foo, Decl(everyTypeAssignableToAny.ts, 6, 13)) +>foo : Symbol(I.foo, Decl(everyTypeAssignableToAny.ts, 6, 13)) } var ai: I; >ai : Symbol(ai, Decl(everyTypeAssignableToAny.ts, 9, 3)) @@ -41,7 +41,7 @@ var d: boolean; var e: Date; >e : Symbol(e, Decl(everyTypeAssignableToAny.ts, 17, 3)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) var f: any; >f : Symbol(f, Decl(everyTypeAssignableToAny.ts, 18, 3)) @@ -83,11 +83,11 @@ var o: (x: T) => T; var p: Number; >p : Symbol(p, Decl(everyTypeAssignableToAny.ts, 28, 3)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) var q: String; >q : Symbol(q, Decl(everyTypeAssignableToAny.ts, 29, 3)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) a = b; >a : Symbol(a, Decl(everyTypeAssignableToAny.ts, 0, 3)) @@ -166,7 +166,7 @@ function foo(x: T, y: U, z: V) { >T : Symbol(T, Decl(everyTypeAssignableToAny.ts, 50, 13)) >U : Symbol(U, Decl(everyTypeAssignableToAny.ts, 50, 15)) >V : Symbol(V, Decl(everyTypeAssignableToAny.ts, 50, 32)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(everyTypeAssignableToAny.ts, 50, 49)) >T : Symbol(T, Decl(everyTypeAssignableToAny.ts, 50, 13)) >y : Symbol(y, Decl(everyTypeAssignableToAny.ts, 50, 54)) diff --git a/tests/baselines/reference/everyTypeWithAnnotationAndInitializer.symbols b/tests/baselines/reference/everyTypeWithAnnotationAndInitializer.symbols index e76b3784e8a..8667507fb51 100644 --- a/tests/baselines/reference/everyTypeWithAnnotationAndInitializer.symbols +++ b/tests/baselines/reference/everyTypeWithAnnotationAndInitializer.symbols @@ -3,7 +3,7 @@ interface I { >I : Symbol(I, Decl(everyTypeWithAnnotationAndInitializer.ts, 0, 0)) id: number; ->id : Symbol(id, Decl(everyTypeWithAnnotationAndInitializer.ts, 0, 13)) +>id : Symbol(I.id, Decl(everyTypeWithAnnotationAndInitializer.ts, 0, 13)) } class C implements I { @@ -11,7 +11,7 @@ class C implements I { >I : Symbol(I, Decl(everyTypeWithAnnotationAndInitializer.ts, 0, 0)) id: number; ->id : Symbol(id, Decl(everyTypeWithAnnotationAndInitializer.ts, 4, 22)) +>id : Symbol(C.id, Decl(everyTypeWithAnnotationAndInitializer.ts, 4, 22)) } class D{ @@ -19,16 +19,16 @@ class D{ >T : Symbol(T, Decl(everyTypeWithAnnotationAndInitializer.ts, 8, 8)) source: T; ->source : Symbol(source, Decl(everyTypeWithAnnotationAndInitializer.ts, 8, 11)) +>source : Symbol(D.source, Decl(everyTypeWithAnnotationAndInitializer.ts, 8, 11)) >T : Symbol(T, Decl(everyTypeWithAnnotationAndInitializer.ts, 8, 8)) recurse: D; ->recurse : Symbol(recurse, Decl(everyTypeWithAnnotationAndInitializer.ts, 9, 14)) +>recurse : Symbol(D.recurse, Decl(everyTypeWithAnnotationAndInitializer.ts, 9, 14)) >D : Symbol(D, Decl(everyTypeWithAnnotationAndInitializer.ts, 6, 1)) >T : Symbol(T, Decl(everyTypeWithAnnotationAndInitializer.ts, 8, 8)) wrapped: D> ->wrapped : Symbol(wrapped, Decl(everyTypeWithAnnotationAndInitializer.ts, 10, 18)) +>wrapped : Symbol(D.wrapped, Decl(everyTypeWithAnnotationAndInitializer.ts, 10, 18)) >D : Symbol(D, Decl(everyTypeWithAnnotationAndInitializer.ts, 6, 1)) >D : Symbol(D, Decl(everyTypeWithAnnotationAndInitializer.ts, 6, 1)) >T : Symbol(T, Decl(everyTypeWithAnnotationAndInitializer.ts, 8, 8)) @@ -45,7 +45,7 @@ module M { >A : Symbol(A, Decl(everyTypeWithAnnotationAndInitializer.ts, 16, 10)) name: string; ->name : Symbol(name, Decl(everyTypeWithAnnotationAndInitializer.ts, 17, 20)) +>name : Symbol(A.name, Decl(everyTypeWithAnnotationAndInitializer.ts, 17, 20)) } export function F2(x: number): string { return x.toString(); } @@ -64,8 +64,8 @@ var aString: string = 'this is a string'; var aDate: Date = new Date(12); >aDate : Symbol(aDate, Decl(everyTypeWithAnnotationAndInitializer.ts, 26, 3)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) var anObject: Object = new Object(); >anObject : Symbol(anObject, Decl(everyTypeWithAnnotationAndInitializer.ts, 27, 3)) diff --git a/tests/baselines/reference/everyTypeWithAnnotationAndInvalidInitializer.errors.txt b/tests/baselines/reference/everyTypeWithAnnotationAndInvalidInitializer.errors.txt index 12478442472..13c2058b657 100644 --- a/tests/baselines/reference/everyTypeWithAnnotationAndInvalidInitializer.errors.txt +++ b/tests/baselines/reference/everyTypeWithAnnotationAndInvalidInitializer.errors.txt @@ -1,7 +1,6 @@ tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(34,5): error TS2322: Type 'string' is not assignable to type 'number'. tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(35,5): error TS2322: Type 'number' is not assignable to type 'string'. tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(36,5): error TS2322: Type 'number' is not assignable to type 'Date'. - Property 'toDateString' is missing in type 'Number'. tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(38,5): error TS2322: Type 'number' is not assignable to type 'void'. tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(40,5): error TS2322: Type 'D<{}>' is not assignable to type 'I'. Property 'id' is missing in type 'D<{}>'. @@ -17,10 +16,10 @@ tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAnd Type 'number' is not assignable to type 'string'. tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(46,5): error TS2322: Type '(x: number) => boolean' is not assignable to type '(x: string) => number'. Types of parameters 'x' and 'x' are incompatible. - Type 'number' is not assignable to type 'string'. + Type 'string' is not assignable to type 'number'. tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(47,5): error TS2322: Type '(x: number) => boolean' is not assignable to type '(x: string) => number'. Types of parameters 'x' and 'x' are incompatible. - Type 'number' is not assignable to type 'string'. + Type 'string' is not assignable to type 'number'. tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(48,5): error TS2322: Type '(x: string) => string' is not assignable to type '(x: string) => number'. Type 'string' is not assignable to type 'number'. tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(50,5): error TS2322: Type 'typeof N' is not assignable to type 'typeof M'. @@ -76,7 +75,6 @@ tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAnd var aDate: Date = 9.9; ~~~~~ !!! error TS2322: Type 'number' is not assignable to type 'Date'. -!!! error TS2322: Property 'toDateString' is missing in type 'Number'. var aVoid: void = 9.9; ~~~~~ @@ -109,12 +107,12 @@ tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAnd ~~~~~~~~~ !!! error TS2322: Type '(x: number) => boolean' is not assignable to type '(x: string) => number'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2322: Type 'number' is not assignable to type 'string'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. var anOtherFunction: (x: string) => number = F2; ~~~~~~~~~~~~~~~ !!! error TS2322: Type '(x: number) => boolean' is not assignable to type '(x: string) => number'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2322: Type 'number' is not assignable to type 'string'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. var aLambda: typeof F = (x) => 'a string'; ~~~~~~~ !!! error TS2322: Type '(x: string) => string' is not assignable to type '(x: string) => number'. diff --git a/tests/baselines/reference/everyTypeWithInitializer.symbols b/tests/baselines/reference/everyTypeWithInitializer.symbols index 078f2e305d1..ba269fbc536 100644 --- a/tests/baselines/reference/everyTypeWithInitializer.symbols +++ b/tests/baselines/reference/everyTypeWithInitializer.symbols @@ -3,7 +3,7 @@ interface I { >I : Symbol(I, Decl(everyTypeWithInitializer.ts, 0, 0)) id: number; ->id : Symbol(id, Decl(everyTypeWithInitializer.ts, 0, 13)) +>id : Symbol(I.id, Decl(everyTypeWithInitializer.ts, 0, 13)) } class C implements I { @@ -11,7 +11,7 @@ class C implements I { >I : Symbol(I, Decl(everyTypeWithInitializer.ts, 0, 0)) id: number; ->id : Symbol(id, Decl(everyTypeWithInitializer.ts, 4, 22)) +>id : Symbol(C.id, Decl(everyTypeWithInitializer.ts, 4, 22)) } class D{ @@ -19,16 +19,16 @@ class D{ >T : Symbol(T, Decl(everyTypeWithInitializer.ts, 8, 8)) source: T; ->source : Symbol(source, Decl(everyTypeWithInitializer.ts, 8, 11)) +>source : Symbol(D.source, Decl(everyTypeWithInitializer.ts, 8, 11)) >T : Symbol(T, Decl(everyTypeWithInitializer.ts, 8, 8)) recurse: D; ->recurse : Symbol(recurse, Decl(everyTypeWithInitializer.ts, 9, 14)) +>recurse : Symbol(D.recurse, Decl(everyTypeWithInitializer.ts, 9, 14)) >D : Symbol(D, Decl(everyTypeWithInitializer.ts, 6, 1)) >T : Symbol(T, Decl(everyTypeWithInitializer.ts, 8, 8)) wrapped: D> ->wrapped : Symbol(wrapped, Decl(everyTypeWithInitializer.ts, 10, 18)) +>wrapped : Symbol(D.wrapped, Decl(everyTypeWithInitializer.ts, 10, 18)) >D : Symbol(D, Decl(everyTypeWithInitializer.ts, 6, 1)) >D : Symbol(D, Decl(everyTypeWithInitializer.ts, 6, 1)) >T : Symbol(T, Decl(everyTypeWithInitializer.ts, 8, 8)) @@ -45,7 +45,7 @@ module M { >A : Symbol(A, Decl(everyTypeWithInitializer.ts, 16, 10)) name: string; ->name : Symbol(name, Decl(everyTypeWithInitializer.ts, 17, 20)) +>name : Symbol(A.name, Decl(everyTypeWithInitializer.ts, 17, 20)) } export function F2(x: number): string { return x.toString(); } @@ -64,7 +64,7 @@ var aString = 'this is a string'; var aDate = new Date(12); >aDate : Symbol(aDate, Decl(everyTypeWithInitializer.ts, 26, 3)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) var anObject = new Object(); >anObject : Symbol(anObject, Decl(everyTypeWithInitializer.ts, 27, 3)) diff --git a/tests/baselines/reference/excessPropertyErrorForFunctionTypes.errors.txt b/tests/baselines/reference/excessPropertyErrorForFunctionTypes.errors.txt new file mode 100644 index 00000000000..dc9d6821e55 --- /dev/null +++ b/tests/baselines/reference/excessPropertyErrorForFunctionTypes.errors.txt @@ -0,0 +1,12 @@ +tests/cases/compiler/excessPropertyErrorForFunctionTypes.ts(4,44): error TS2322: Type '{ a: number; c: number; d: number; }' is not assignable to type '{ a: number; c: number; } | (() => any)'. + Object literal may only specify known properties, and 'd' does not exist in type '{ a: number; c: number; } | (() => any)'. + + +==== tests/cases/compiler/excessPropertyErrorForFunctionTypes.ts (1 errors) ==== + type FunctionType = () => any; + type DoesntWork = { a: number, c: number } | FunctionType; + + let doesntWork: DoesntWork = { a: 1, c: 2, d: 3 } + ~~~~ +!!! error TS2322: Type '{ a: number; c: number; d: number; }' is not assignable to type '{ a: number; c: number; } | (() => any)'. +!!! error TS2322: Object literal may only specify known properties, and 'd' does not exist in type '{ a: number; c: number; } | (() => any)'. \ No newline at end of file diff --git a/tests/baselines/reference/excessPropertyErrorForFunctionTypes.js b/tests/baselines/reference/excessPropertyErrorForFunctionTypes.js new file mode 100644 index 00000000000..d81608c79ba --- /dev/null +++ b/tests/baselines/reference/excessPropertyErrorForFunctionTypes.js @@ -0,0 +1,8 @@ +//// [excessPropertyErrorForFunctionTypes.ts] +type FunctionType = () => any; +type DoesntWork = { a: number, c: number } | FunctionType; + +let doesntWork: DoesntWork = { a: 1, c: 2, d: 3 } + +//// [excessPropertyErrorForFunctionTypes.js] +var doesntWork = { a: 1, c: 2, d: 3 }; diff --git a/tests/baselines/reference/exportAssignClassAndModule.symbols b/tests/baselines/reference/exportAssignClassAndModule.symbols index 016e91f79a2..6f0141a82ff 100644 --- a/tests/baselines/reference/exportAssignClassAndModule.symbols +++ b/tests/baselines/reference/exportAssignClassAndModule.symbols @@ -22,7 +22,7 @@ class Foo { >Foo : Symbol(Foo, Decl(exportAssignClassAndModule_0.ts, 0, 0), Decl(exportAssignClassAndModule_0.ts, 2, 1)) x: Foo.Bar; ->x : Symbol(x, Decl(exportAssignClassAndModule_0.ts, 0, 11)) +>x : Symbol(Foo.x, Decl(exportAssignClassAndModule_0.ts, 0, 11)) >Foo : Symbol(Foo, Decl(exportAssignClassAndModule_0.ts, 0, 0), Decl(exportAssignClassAndModule_0.ts, 2, 1)) >Bar : Symbol(Foo.Bar, Decl(exportAssignClassAndModule_0.ts, 3, 12)) } diff --git a/tests/baselines/reference/exportAssignDottedName.errors.txt b/tests/baselines/reference/exportAssignDottedName.errors.txt deleted file mode 100644 index 3ed4f3c888f..00000000000 --- a/tests/baselines/reference/exportAssignDottedName.errors.txt +++ /dev/null @@ -1,14 +0,0 @@ -tests/cases/conformance/externalModules/foo1.ts(1,17): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. - - -==== tests/cases/conformance/externalModules/foo2.ts (0 errors) ==== - import foo1 = require('./foo1'); - export = foo1.x; // Ok - -==== tests/cases/conformance/externalModules/foo1.ts (1 errors) ==== - export function x(){ - ~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. - return true; - } - \ No newline at end of file diff --git a/tests/baselines/reference/exportAssignDottedName.symbols b/tests/baselines/reference/exportAssignDottedName.symbols new file mode 100644 index 00000000000..b7503380452 --- /dev/null +++ b/tests/baselines/reference/exportAssignDottedName.symbols @@ -0,0 +1,16 @@ +=== tests/cases/conformance/externalModules/foo2.ts === +import foo1 = require('./foo1'); +>foo1 : Symbol(foo1, Decl(foo2.ts, 0, 0)) + +export = foo1.x; // Ok +>foo1.x : Symbol(foo1.x, Decl(foo1.ts, 0, 0)) +>foo1 : Symbol(foo1, Decl(foo2.ts, 0, 0)) +>x : Symbol(foo1.x, Decl(foo1.ts, 0, 0)) + +=== tests/cases/conformance/externalModules/foo1.ts === +export function x(){ +>x : Symbol(x, Decl(foo1.ts, 0, 0)) + + return true; +} + diff --git a/tests/baselines/reference/exportAssignDottedName.types b/tests/baselines/reference/exportAssignDottedName.types new file mode 100644 index 00000000000..6fceb21231c --- /dev/null +++ b/tests/baselines/reference/exportAssignDottedName.types @@ -0,0 +1,17 @@ +=== tests/cases/conformance/externalModules/foo2.ts === +import foo1 = require('./foo1'); +>foo1 : typeof foo1 + +export = foo1.x; // Ok +>foo1.x : () => boolean +>foo1 : typeof foo1 +>x : () => boolean + +=== tests/cases/conformance/externalModules/foo1.ts === +export function x(){ +>x : () => boolean + + return true; +>true : boolean +} + diff --git a/tests/baselines/reference/exportAssignImportedIdentifier.errors.txt b/tests/baselines/reference/exportAssignImportedIdentifier.errors.txt deleted file mode 100644 index 167c0baca3d..00000000000 --- a/tests/baselines/reference/exportAssignImportedIdentifier.errors.txt +++ /dev/null @@ -1,18 +0,0 @@ -tests/cases/conformance/externalModules/foo1.ts(1,17): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. - - -==== tests/cases/conformance/externalModules/foo3.ts (0 errors) ==== - import foo2 = require('./foo2'); - var x = foo2(); // should be boolean -==== tests/cases/conformance/externalModules/foo1.ts (1 errors) ==== - export function x(){ - ~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. - return true; - } - -==== tests/cases/conformance/externalModules/foo2.ts (0 errors) ==== - import foo1 = require('./foo1'); - var x = foo1.x; - export = x; - \ No newline at end of file diff --git a/tests/baselines/reference/exportAssignImportedIdentifier.symbols b/tests/baselines/reference/exportAssignImportedIdentifier.symbols new file mode 100644 index 00000000000..8089e498250 --- /dev/null +++ b/tests/baselines/reference/exportAssignImportedIdentifier.symbols @@ -0,0 +1,28 @@ +=== tests/cases/conformance/externalModules/foo3.ts === +import foo2 = require('./foo2'); +>foo2 : Symbol(foo2, Decl(foo3.ts, 0, 0)) + +var x = foo2(); // should be boolean +>x : Symbol(x, Decl(foo3.ts, 1, 3)) +>foo2 : Symbol(foo2, Decl(foo3.ts, 0, 0)) + +=== tests/cases/conformance/externalModules/foo1.ts === +export function x(){ +>x : Symbol(x, Decl(foo1.ts, 0, 0)) + + return true; +} + +=== tests/cases/conformance/externalModules/foo2.ts === +import foo1 = require('./foo1'); +>foo1 : Symbol(foo1, Decl(foo2.ts, 0, 0)) + +var x = foo1.x; +>x : Symbol(x, Decl(foo2.ts, 1, 3)) +>foo1.x : Symbol(foo1.x, Decl(foo1.ts, 0, 0)) +>foo1 : Symbol(foo1, Decl(foo2.ts, 0, 0)) +>x : Symbol(foo1.x, Decl(foo1.ts, 0, 0)) + +export = x; +>x : Symbol(x, Decl(foo2.ts, 1, 3)) + diff --git a/tests/baselines/reference/exportAssignImportedIdentifier.types b/tests/baselines/reference/exportAssignImportedIdentifier.types new file mode 100644 index 00000000000..e70de693624 --- /dev/null +++ b/tests/baselines/reference/exportAssignImportedIdentifier.types @@ -0,0 +1,30 @@ +=== tests/cases/conformance/externalModules/foo3.ts === +import foo2 = require('./foo2'); +>foo2 : () => boolean + +var x = foo2(); // should be boolean +>x : boolean +>foo2() : boolean +>foo2 : () => boolean + +=== tests/cases/conformance/externalModules/foo1.ts === +export function x(){ +>x : () => boolean + + return true; +>true : boolean +} + +=== tests/cases/conformance/externalModules/foo2.ts === +import foo1 = require('./foo1'); +>foo1 : typeof foo1 + +var x = foo1.x; +>x : () => boolean +>foo1.x : () => boolean +>foo1 : typeof foo1 +>x : () => boolean + +export = x; +>x : () => boolean + diff --git a/tests/baselines/reference/exportAssignNonIdentifier.errors.txt b/tests/baselines/reference/exportAssignNonIdentifier.errors.txt index 9e8bfa8d747..df227ff6c0b 100644 --- a/tests/baselines/reference/exportAssignNonIdentifier.errors.txt +++ b/tests/baselines/reference/exportAssignNonIdentifier.errors.txt @@ -1,12 +1,9 @@ -tests/cases/conformance/externalModules/foo1.ts(2,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/conformance/externalModules/foo6.ts(1,14): error TS1109: Expression expected. -==== tests/cases/conformance/externalModules/foo1.ts (1 errors) ==== +==== tests/cases/conformance/externalModules/foo1.ts (0 errors) ==== var x = 10; export = typeof x; // Ok - ~~~~~~~~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ==== tests/cases/conformance/externalModules/foo2.ts (0 errors) ==== export = "sausages"; // Ok diff --git a/tests/baselines/reference/exportAssignTypes.errors.txt b/tests/baselines/reference/exportAssignTypes.errors.txt deleted file mode 100644 index 9d39f48fec8..00000000000 --- a/tests/baselines/reference/exportAssignTypes.errors.txt +++ /dev/null @@ -1,57 +0,0 @@ -tests/cases/conformance/externalModules/expString.ts(2,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. - - -==== tests/cases/conformance/externalModules/consumer.ts (0 errors) ==== - import iString = require('./expString'); - var v1: string = iString; - - import iNumber = require('./expNumber'); - var v2: number = iNumber; - - import iBoolean = require('./expBoolean'); - var v3: boolean = iBoolean; - - import iArray = require('./expArray'); - var v4: Array = iArray; - - import iObject = require('./expObject'); - var v5: Object = iObject; - - import iAny = require('./expAny'); - var v6 = iAny; - - import iGeneric = require('./expGeneric'); - var v7: {(p1: x): x} = iGeneric; - -==== tests/cases/conformance/externalModules/expString.ts (1 errors) ==== - var x = "test"; - export = x; - ~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. - -==== tests/cases/conformance/externalModules/expNumber.ts (0 errors) ==== - var x = 42; - export = x; - -==== tests/cases/conformance/externalModules/expBoolean.ts (0 errors) ==== - var x = true; - export = x; - -==== tests/cases/conformance/externalModules/expArray.ts (0 errors) ==== - var x = [1,2]; - export = x; - -==== tests/cases/conformance/externalModules/expObject.ts (0 errors) ==== - var x = { answer: 42, when: 1776}; - export = x; - -==== tests/cases/conformance/externalModules/expAny.ts (0 errors) ==== - var x; - export = x; - -==== tests/cases/conformance/externalModules/expGeneric.ts (0 errors) ==== - function x(a: T){ - return a; - } - export = x; - \ No newline at end of file diff --git a/tests/baselines/reference/exportAssignTypes.symbols b/tests/baselines/reference/exportAssignTypes.symbols new file mode 100644 index 00000000000..4936d7388fe --- /dev/null +++ b/tests/baselines/reference/exportAssignTypes.symbols @@ -0,0 +1,113 @@ +=== tests/cases/conformance/externalModules/consumer.ts === +import iString = require('./expString'); +>iString : Symbol(iString, Decl(consumer.ts, 0, 0)) + +var v1: string = iString; +>v1 : Symbol(v1, Decl(consumer.ts, 1, 3)) +>iString : Symbol(iString, Decl(consumer.ts, 0, 0)) + +import iNumber = require('./expNumber'); +>iNumber : Symbol(iNumber, Decl(consumer.ts, 1, 25)) + +var v2: number = iNumber; +>v2 : Symbol(v2, Decl(consumer.ts, 4, 3)) +>iNumber : Symbol(iNumber, Decl(consumer.ts, 1, 25)) + +import iBoolean = require('./expBoolean'); +>iBoolean : Symbol(iBoolean, Decl(consumer.ts, 4, 25)) + +var v3: boolean = iBoolean; +>v3 : Symbol(v3, Decl(consumer.ts, 7, 3)) +>iBoolean : Symbol(iBoolean, Decl(consumer.ts, 4, 25)) + +import iArray = require('./expArray'); +>iArray : Symbol(iArray, Decl(consumer.ts, 7, 27)) + +var v4: Array = iArray; +>v4 : Symbol(v4, Decl(consumer.ts, 10, 3)) +>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>iArray : Symbol(iArray, Decl(consumer.ts, 7, 27)) + +import iObject = require('./expObject'); +>iObject : Symbol(iObject, Decl(consumer.ts, 10, 31)) + +var v5: Object = iObject; +>v5 : Symbol(v5, Decl(consumer.ts, 13, 3)) +>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>iObject : Symbol(iObject, Decl(consumer.ts, 10, 31)) + +import iAny = require('./expAny'); +>iAny : Symbol(iAny, Decl(consumer.ts, 13, 25)) + +var v6 = iAny; +>v6 : Symbol(v6, Decl(consumer.ts, 16, 3)) +>iAny : Symbol(iAny, Decl(consumer.ts, 13, 25)) + +import iGeneric = require('./expGeneric'); +>iGeneric : Symbol(iGeneric, Decl(consumer.ts, 16, 14)) + +var v7: {(p1: x): x} = iGeneric; +>v7 : Symbol(v7, Decl(consumer.ts, 19, 3)) +>x : Symbol(x, Decl(consumer.ts, 19, 10)) +>p1 : Symbol(p1, Decl(consumer.ts, 19, 13)) +>x : Symbol(x, Decl(consumer.ts, 19, 10)) +>x : Symbol(x, Decl(consumer.ts, 19, 10)) +>iGeneric : Symbol(iGeneric, Decl(consumer.ts, 16, 14)) + +=== tests/cases/conformance/externalModules/expString.ts === +var x = "test"; +>x : Symbol(x, Decl(expString.ts, 0, 3)) + +export = x; +>x : Symbol(x, Decl(expString.ts, 0, 3)) + +=== tests/cases/conformance/externalModules/expNumber.ts === +var x = 42; +>x : Symbol(x, Decl(expNumber.ts, 0, 3)) + +export = x; +>x : Symbol(x, Decl(expNumber.ts, 0, 3)) + +=== tests/cases/conformance/externalModules/expBoolean.ts === +var x = true; +>x : Symbol(x, Decl(expBoolean.ts, 0, 3)) + +export = x; +>x : Symbol(x, Decl(expBoolean.ts, 0, 3)) + +=== tests/cases/conformance/externalModules/expArray.ts === +var x = [1,2]; +>x : Symbol(x, Decl(expArray.ts, 0, 3)) + +export = x; +>x : Symbol(x, Decl(expArray.ts, 0, 3)) + +=== tests/cases/conformance/externalModules/expObject.ts === +var x = { answer: 42, when: 1776}; +>x : Symbol(x, Decl(expObject.ts, 0, 3)) +>answer : Symbol(answer, Decl(expObject.ts, 0, 9)) +>when : Symbol(when, Decl(expObject.ts, 0, 21)) + +export = x; +>x : Symbol(x, Decl(expObject.ts, 0, 3)) + +=== tests/cases/conformance/externalModules/expAny.ts === +var x; +>x : Symbol(x, Decl(expAny.ts, 0, 3)) + +export = x; +>x : Symbol(x, Decl(expAny.ts, 0, 3)) + +=== tests/cases/conformance/externalModules/expGeneric.ts === +function x(a: T){ +>x : Symbol(x, Decl(expGeneric.ts, 0, 0)) +>T : Symbol(T, Decl(expGeneric.ts, 0, 11)) +>a : Symbol(a, Decl(expGeneric.ts, 0, 14)) +>T : Symbol(T, Decl(expGeneric.ts, 0, 11)) + + return a; +>a : Symbol(a, Decl(expGeneric.ts, 0, 14)) +} +export = x; +>x : Symbol(x, Decl(expGeneric.ts, 0, 0)) + diff --git a/tests/baselines/reference/exportAssignTypes.types b/tests/baselines/reference/exportAssignTypes.types new file mode 100644 index 00000000000..dc99d1512f1 --- /dev/null +++ b/tests/baselines/reference/exportAssignTypes.types @@ -0,0 +1,122 @@ +=== tests/cases/conformance/externalModules/consumer.ts === +import iString = require('./expString'); +>iString : string + +var v1: string = iString; +>v1 : string +>iString : string + +import iNumber = require('./expNumber'); +>iNumber : number + +var v2: number = iNumber; +>v2 : number +>iNumber : number + +import iBoolean = require('./expBoolean'); +>iBoolean : boolean + +var v3: boolean = iBoolean; +>v3 : boolean +>iBoolean : boolean + +import iArray = require('./expArray'); +>iArray : number[] + +var v4: Array = iArray; +>v4 : number[] +>Array : T[] +>iArray : number[] + +import iObject = require('./expObject'); +>iObject : { answer: number; when: number; } + +var v5: Object = iObject; +>v5 : Object +>Object : Object +>iObject : { answer: number; when: number; } + +import iAny = require('./expAny'); +>iAny : any + +var v6 = iAny; +>v6 : any +>iAny : any + +import iGeneric = require('./expGeneric'); +>iGeneric : (a: T) => T + +var v7: {(p1: x): x} = iGeneric; +>v7 : (p1: x) => x +>x : x +>p1 : x +>x : x +>x : x +>iGeneric : (a: T) => T + +=== tests/cases/conformance/externalModules/expString.ts === +var x = "test"; +>x : string +>"test" : string + +export = x; +>x : string + +=== tests/cases/conformance/externalModules/expNumber.ts === +var x = 42; +>x : number +>42 : number + +export = x; +>x : number + +=== tests/cases/conformance/externalModules/expBoolean.ts === +var x = true; +>x : boolean +>true : boolean + +export = x; +>x : boolean + +=== tests/cases/conformance/externalModules/expArray.ts === +var x = [1,2]; +>x : number[] +>[1,2] : number[] +>1 : number +>2 : number + +export = x; +>x : number[] + +=== tests/cases/conformance/externalModules/expObject.ts === +var x = { answer: 42, when: 1776}; +>x : { answer: number; when: number; } +>{ answer: 42, when: 1776} : { answer: number; when: number; } +>answer : number +>42 : number +>when : number +>1776 : number + +export = x; +>x : { answer: number; when: number; } + +=== tests/cases/conformance/externalModules/expAny.ts === +var x; +>x : any + +export = x; +>x : any + +=== tests/cases/conformance/externalModules/expGeneric.ts === +function x(a: T){ +>x : (a: T) => T +>T : T +>a : T +>T : T + + return a; +>a : T +} +export = x; +>x : (a: T) => T + diff --git a/tests/baselines/reference/exportAssignValueAndType.symbols b/tests/baselines/reference/exportAssignValueAndType.symbols index faca2c6ffd0..3d5495b4874 100644 --- a/tests/baselines/reference/exportAssignValueAndType.symbols +++ b/tests/baselines/reference/exportAssignValueAndType.symbols @@ -4,7 +4,7 @@ declare module http { export interface Server { openPort: number; } >Server : Symbol(Server, Decl(exportAssignValueAndType.ts, 0, 21)) ->openPort : Symbol(openPort, Decl(exportAssignValueAndType.ts, 1, 26)) +>openPort : Symbol(Server.openPort, Decl(exportAssignValueAndType.ts, 1, 26)) } interface server { @@ -15,8 +15,8 @@ interface server { >Server : Symbol(http.Server, Decl(exportAssignValueAndType.ts, 0, 21)) startTime: Date; ->startTime : Symbol(startTime, Decl(exportAssignValueAndType.ts, 5, 20)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>startTime : Symbol(server.startTime, Decl(exportAssignValueAndType.ts, 5, 20)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) } var x = 5; @@ -24,7 +24,7 @@ var x = 5; var server = new Date(); >server : Symbol(server, Decl(exportAssignValueAndType.ts, 2, 1), Decl(exportAssignValueAndType.ts, 10, 3)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) export = server; >server : Symbol(server, Decl(exportAssignValueAndType.ts, 2, 1), Decl(exportAssignValueAndType.ts, 10, 3)) diff --git a/tests/baselines/reference/exportAssignedTypeAsTypeAnnotation.symbols b/tests/baselines/reference/exportAssignedTypeAsTypeAnnotation.symbols index e79faf36f35..79392369c3f 100644 --- a/tests/baselines/reference/exportAssignedTypeAsTypeAnnotation.symbols +++ b/tests/baselines/reference/exportAssignedTypeAsTypeAnnotation.symbols @@ -13,10 +13,10 @@ interface x { >x : Symbol(x, Decl(exportAssignedTypeAsTypeAnnotation_0.ts, 0, 0)) (): Date; ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) foo: string; ->foo : Symbol(foo, Decl(exportAssignedTypeAsTypeAnnotation_0.ts, 2, 13)) +>foo : Symbol(x.foo, Decl(exportAssignedTypeAsTypeAnnotation_0.ts, 2, 13)) } export = x; >x : Symbol(x, Decl(exportAssignedTypeAsTypeAnnotation_0.ts, 0, 0)) diff --git a/tests/baselines/reference/exportAssignmentClass.symbols b/tests/baselines/reference/exportAssignmentClass.symbols index d0935ca8f8c..73a16572d65 100644 --- a/tests/baselines/reference/exportAssignmentClass.symbols +++ b/tests/baselines/reference/exportAssignmentClass.symbols @@ -15,7 +15,7 @@ var x = d.p; === tests/cases/compiler/exportAssignmentClass_A.ts === class C { public p = 0; } >C : Symbol(C, Decl(exportAssignmentClass_A.ts, 0, 0)) ->p : Symbol(p, Decl(exportAssignmentClass_A.ts, 0, 9)) +>p : Symbol(C.p, Decl(exportAssignmentClass_A.ts, 0, 9)) export = C; >C : Symbol(C, Decl(exportAssignmentClass_A.ts, 0, 0)) diff --git a/tests/baselines/reference/exportAssignmentConstrainedGenericType.errors.txt b/tests/baselines/reference/exportAssignmentConstrainedGenericType.errors.txt index 946bc8ee8b1..cf63c48925f 100644 --- a/tests/baselines/reference/exportAssignmentConstrainedGenericType.errors.txt +++ b/tests/baselines/reference/exportAssignmentConstrainedGenericType.errors.txt @@ -1,5 +1,4 @@ tests/cases/conformance/externalModules/foo_1.ts(2,17): error TS2345: Argument of type 'boolean' is not assignable to parameter of type '{ a: string; b: number; }'. - Property 'a' is missing in type 'Boolean'. ==== tests/cases/conformance/externalModules/foo_1.ts (1 errors) ==== @@ -7,7 +6,6 @@ tests/cases/conformance/externalModules/foo_1.ts(2,17): error TS2345: Argument o var x = new foo(true); // Should error ~~~~ !!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type '{ a: string; b: number; }'. -!!! error TS2345: Property 'a' is missing in type 'Boolean'. var y = new foo({a: "test", b: 42}); // Should be OK var z: number = y.test.b; ==== tests/cases/conformance/externalModules/foo_0.ts (0 errors) ==== diff --git a/tests/baselines/reference/exportAssignmentGenericType.symbols b/tests/baselines/reference/exportAssignmentGenericType.symbols index ca228e7092e..7bf0ac178b5 100644 --- a/tests/baselines/reference/exportAssignmentGenericType.symbols +++ b/tests/baselines/reference/exportAssignmentGenericType.symbols @@ -18,7 +18,7 @@ class Foo{ >T : Symbol(T, Decl(foo_0.ts, 0, 10)) test: T; ->test : Symbol(test, Decl(foo_0.ts, 0, 13)) +>test : Symbol(Foo.test, Decl(foo_0.ts, 0, 13)) >T : Symbol(T, Decl(foo_0.ts, 0, 10)) } export = Foo; diff --git a/tests/baselines/reference/exportAssignmentInterface.symbols b/tests/baselines/reference/exportAssignmentInterface.symbols index 22f344a2cb9..d76c78303e8 100644 --- a/tests/baselines/reference/exportAssignmentInterface.symbols +++ b/tests/baselines/reference/exportAssignmentInterface.symbols @@ -17,7 +17,7 @@ interface A { >A : Symbol(A, Decl(exportAssignmentInterface_A.ts, 0, 0)) p1: number; ->p1 : Symbol(p1, Decl(exportAssignmentInterface_A.ts, 0, 13)) +>p1 : Symbol(A.p1, Decl(exportAssignmentInterface_A.ts, 0, 13)) } export = A; diff --git a/tests/baselines/reference/exportAssignmentMergedInterface.symbols b/tests/baselines/reference/exportAssignmentMergedInterface.symbols index a199ed4e6c5..2eb5593aa44 100644 --- a/tests/baselines/reference/exportAssignmentMergedInterface.symbols +++ b/tests/baselines/reference/exportAssignmentMergedInterface.symbols @@ -42,7 +42,7 @@ interface Foo { >a : Symbol(a, Decl(foo_0.ts, 1, 2)) b: string; ->b : Symbol(b, Decl(foo_0.ts, 1, 19)) +>b : Symbol(Foo.b, Decl(foo_0.ts, 1, 19)) } interface Foo { >Foo : Symbol(Foo, Decl(foo_0.ts, 0, 0), Decl(foo_0.ts, 3, 1)) @@ -51,10 +51,10 @@ interface Foo { >a : Symbol(a, Decl(foo_0.ts, 5, 2)) c: boolean; ->c : Symbol(c, Decl(foo_0.ts, 5, 21)) +>c : Symbol(Foo.c, Decl(foo_0.ts, 5, 21)) d: {x: number; y: number}; ->d : Symbol(d, Decl(foo_0.ts, 6, 12)) +>d : Symbol(Foo.d, Decl(foo_0.ts, 6, 12)) >x : Symbol(x, Decl(foo_0.ts, 7, 5)) >y : Symbol(y, Decl(foo_0.ts, 7, 15)) } diff --git a/tests/baselines/reference/exportAssignmentOfGenericType1.symbols b/tests/baselines/reference/exportAssignmentOfGenericType1.symbols index 8ae7dbc73a9..263d7e5f6af 100644 --- a/tests/baselines/reference/exportAssignmentOfGenericType1.symbols +++ b/tests/baselines/reference/exportAssignmentOfGenericType1.symbols @@ -24,6 +24,6 @@ export = T; class T { foo: X; } >T : Symbol(T, Decl(exportAssignmentOfGenericType1_0.ts, 0, 11)) >X : Symbol(X, Decl(exportAssignmentOfGenericType1_0.ts, 1, 8)) ->foo : Symbol(foo, Decl(exportAssignmentOfGenericType1_0.ts, 1, 12)) +>foo : Symbol(T.foo, Decl(exportAssignmentOfGenericType1_0.ts, 1, 12)) >X : Symbol(X, Decl(exportAssignmentOfGenericType1_0.ts, 1, 8)) diff --git a/tests/baselines/reference/exportAssignmentTopLevelClodule.symbols b/tests/baselines/reference/exportAssignmentTopLevelClodule.symbols index d672457f451..c024b8d51e2 100644 --- a/tests/baselines/reference/exportAssignmentTopLevelClodule.symbols +++ b/tests/baselines/reference/exportAssignmentTopLevelClodule.symbols @@ -17,7 +17,7 @@ class Foo { >Foo : Symbol(Foo, Decl(foo_0.ts, 0, 0), Decl(foo_0.ts, 2, 1)) test = "test"; ->test : Symbol(test, Decl(foo_0.ts, 0, 11)) +>test : Symbol(Foo.test, Decl(foo_0.ts, 0, 11)) } module Foo { >Foo : Symbol(Foo, Decl(foo_0.ts, 0, 0), Decl(foo_0.ts, 2, 1)) diff --git a/tests/baselines/reference/exportAssignmentWithImportStatementPrivacyError.symbols b/tests/baselines/reference/exportAssignmentWithImportStatementPrivacyError.symbols index 80a48dff3ad..30ef72d18bf 100644 --- a/tests/baselines/reference/exportAssignmentWithImportStatementPrivacyError.symbols +++ b/tests/baselines/reference/exportAssignmentWithImportStatementPrivacyError.symbols @@ -14,13 +14,13 @@ module m2 { >connectExport : Symbol(connectExport, Decl(exportAssignmentWithImportStatementPrivacyError.ts, 3, 5)) use: (mod: connectModule) => connectExport; ->use : Symbol(use, Decl(exportAssignmentWithImportStatementPrivacyError.ts, 4, 36)) +>use : Symbol(connectExport.use, Decl(exportAssignmentWithImportStatementPrivacyError.ts, 4, 36)) >mod : Symbol(mod, Decl(exportAssignmentWithImportStatementPrivacyError.ts, 5, 14)) >connectModule : Symbol(connectModule, Decl(exportAssignmentWithImportStatementPrivacyError.ts, 0, 11)) >connectExport : Symbol(connectExport, Decl(exportAssignmentWithImportStatementPrivacyError.ts, 3, 5)) listen: (port: number) => void; ->listen : Symbol(listen, Decl(exportAssignmentWithImportStatementPrivacyError.ts, 5, 51)) +>listen : Symbol(connectExport.listen, Decl(exportAssignmentWithImportStatementPrivacyError.ts, 5, 51)) >port : Symbol(port, Decl(exportAssignmentWithImportStatementPrivacyError.ts, 6, 17)) } diff --git a/tests/baselines/reference/exportAssignmentWithPrivacyError.symbols b/tests/baselines/reference/exportAssignmentWithPrivacyError.symbols index f69a4e00823..35807a4edea 100644 --- a/tests/baselines/reference/exportAssignmentWithPrivacyError.symbols +++ b/tests/baselines/reference/exportAssignmentWithPrivacyError.symbols @@ -11,13 +11,13 @@ interface connectexport { >connectexport : Symbol(connectexport, Decl(exportAssignmentWithPrivacyError.ts, 2, 1)) use: (mod: connectmodule) => connectexport; ->use : Symbol(use, Decl(exportAssignmentWithPrivacyError.ts, 3, 25)) +>use : Symbol(connectexport.use, Decl(exportAssignmentWithPrivacyError.ts, 3, 25)) >mod : Symbol(mod, Decl(exportAssignmentWithPrivacyError.ts, 4, 10)) >connectmodule : Symbol(connectmodule, Decl(exportAssignmentWithPrivacyError.ts, 0, 0)) >connectexport : Symbol(connectexport, Decl(exportAssignmentWithPrivacyError.ts, 2, 1)) listen: (port: number) => void; ->listen : Symbol(listen, Decl(exportAssignmentWithPrivacyError.ts, 4, 47)) +>listen : Symbol(connectexport.listen, Decl(exportAssignmentWithPrivacyError.ts, 4, 47)) >port : Symbol(port, Decl(exportAssignmentWithPrivacyError.ts, 5, 13)) } diff --git a/tests/baselines/reference/exportCodeGen.symbols b/tests/baselines/reference/exportCodeGen.symbols index fbc70cf8324..b664704d049 100644 --- a/tests/baselines/reference/exportCodeGen.symbols +++ b/tests/baselines/reference/exportCodeGen.symbols @@ -66,11 +66,11 @@ module E { export interface I { id: number } >I : Symbol(I, Decl(exportCodeGen.ts, 35, 28)) ->id : Symbol(id, Decl(exportCodeGen.ts, 36, 24)) +>id : Symbol(I.id, Decl(exportCodeGen.ts, 36, 24)) export class C { name: string } >C : Symbol(C, Decl(exportCodeGen.ts, 36, 37)) ->name : Symbol(name, Decl(exportCodeGen.ts, 37, 20)) +>name : Symbol(C.name, Decl(exportCodeGen.ts, 37, 20)) export module M { >M : Symbol(M, Decl(exportCodeGen.ts, 37, 35)) @@ -94,11 +94,11 @@ module F { interface I { id: number } >I : Symbol(I, Decl(exportCodeGen.ts, 47, 21)) ->id : Symbol(id, Decl(exportCodeGen.ts, 48, 17)) +>id : Symbol(I.id, Decl(exportCodeGen.ts, 48, 17)) class C { name: string } >C : Symbol(C, Decl(exportCodeGen.ts, 48, 30)) ->name : Symbol(name, Decl(exportCodeGen.ts, 49, 13)) +>name : Symbol(C.name, Decl(exportCodeGen.ts, 49, 13)) module M { >M : Symbol(M, Decl(exportCodeGen.ts, 49, 28)) diff --git a/tests/baselines/reference/exportDeclaredModule.errors.txt b/tests/baselines/reference/exportDeclaredModule.errors.txt deleted file mode 100644 index c235d4c448f..00000000000 --- a/tests/baselines/reference/exportDeclaredModule.errors.txt +++ /dev/null @@ -1,16 +0,0 @@ -tests/cases/conformance/externalModules/foo1.ts(6,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. - - -==== tests/cases/conformance/externalModules/foo2.ts (0 errors) ==== - import foo1 = require('./foo1'); - var x: number = foo1.b(); -==== tests/cases/conformance/externalModules/foo1.ts (1 errors) ==== - - declare module M1 { - export var a: string; - export function b(): number; - } - export = M1; - ~~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. - \ No newline at end of file diff --git a/tests/baselines/reference/exportDeclaredModule.symbols b/tests/baselines/reference/exportDeclaredModule.symbols new file mode 100644 index 00000000000..a5259f795d9 --- /dev/null +++ b/tests/baselines/reference/exportDeclaredModule.symbols @@ -0,0 +1,24 @@ +=== tests/cases/conformance/externalModules/foo2.ts === +import foo1 = require('./foo1'); +>foo1 : Symbol(foo1, Decl(foo2.ts, 0, 0)) + +var x: number = foo1.b(); +>x : Symbol(x, Decl(foo2.ts, 1, 3)) +>foo1.b : Symbol(foo1.b, Decl(foo1.ts, 2, 22)) +>foo1 : Symbol(foo1, Decl(foo2.ts, 0, 0)) +>b : Symbol(foo1.b, Decl(foo1.ts, 2, 22)) + +=== tests/cases/conformance/externalModules/foo1.ts === + +declare module M1 { +>M1 : Symbol(M1, Decl(foo1.ts, 0, 0)) + + export var a: string; +>a : Symbol(a, Decl(foo1.ts, 2, 11)) + + export function b(): number; +>b : Symbol(b, Decl(foo1.ts, 2, 22)) +} +export = M1; +>M1 : Symbol(M1, Decl(foo1.ts, 0, 0)) + diff --git a/tests/baselines/reference/exportDeclaredModule.types b/tests/baselines/reference/exportDeclaredModule.types new file mode 100644 index 00000000000..00bb50ffa09 --- /dev/null +++ b/tests/baselines/reference/exportDeclaredModule.types @@ -0,0 +1,25 @@ +=== tests/cases/conformance/externalModules/foo2.ts === +import foo1 = require('./foo1'); +>foo1 : typeof foo1 + +var x: number = foo1.b(); +>x : number +>foo1.b() : number +>foo1.b : () => number +>foo1 : typeof foo1 +>b : () => number + +=== tests/cases/conformance/externalModules/foo1.ts === + +declare module M1 { +>M1 : typeof M1 + + export var a: string; +>a : string + + export function b(): number; +>b : () => number +} +export = M1; +>M1 : typeof M1 + diff --git a/tests/baselines/reference/exportDefaultInJsFile01.errors.txt b/tests/baselines/reference/exportDefaultInJsFile01.errors.txt new file mode 100644 index 00000000000..34035e1e14e --- /dev/null +++ b/tests/baselines/reference/exportDefaultInJsFile01.errors.txt @@ -0,0 +1,7 @@ +error TS5055: Cannot write file 'tests/cases/conformance/salsa/myFile01.js' because it would overwrite input file. + + +!!! error TS5055: Cannot write file 'tests/cases/conformance/salsa/myFile01.js' because it would overwrite input file. +==== tests/cases/conformance/salsa/myFile01.js (0 errors) ==== + + export default "hello"; \ No newline at end of file diff --git a/tests/baselines/reference/exportDefaultInJsFile02.errors.txt b/tests/baselines/reference/exportDefaultInJsFile02.errors.txt new file mode 100644 index 00000000000..5e17306e066 --- /dev/null +++ b/tests/baselines/reference/exportDefaultInJsFile02.errors.txt @@ -0,0 +1,7 @@ +error TS5055: Cannot write file 'tests/cases/conformance/salsa/myFile02.js' because it would overwrite input file. + + +!!! error TS5055: Cannot write file 'tests/cases/conformance/salsa/myFile02.js' because it would overwrite input file. +==== tests/cases/conformance/salsa/myFile02.js (0 errors) ==== + + export default "hello"; \ No newline at end of file diff --git a/tests/baselines/reference/exportEqualNamespaces.symbols b/tests/baselines/reference/exportEqualNamespaces.symbols index 1773883c68b..0c2890b028a 100644 --- a/tests/baselines/reference/exportEqualNamespaces.symbols +++ b/tests/baselines/reference/exportEqualNamespaces.symbols @@ -15,8 +15,8 @@ interface server { >Server : Symbol(server.Server, Decl(exportEqualNamespaces.ts, 0, 23)) startTime: Date; ->startTime : Symbol(startTime, Decl(exportEqualNamespaces.ts, 5, 22)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>startTime : Symbol(server.startTime, Decl(exportEqualNamespaces.ts, 5, 22)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) } var x = 5; @@ -24,7 +24,7 @@ var x = 5; var server = new Date(); >server : Symbol(server, Decl(exportEqualNamespaces.ts, 0, 0), Decl(exportEqualNamespaces.ts, 2, 1), Decl(exportEqualNamespaces.ts, 10, 3)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) export = server; >server : Symbol(server, Decl(exportEqualNamespaces.ts, 0, 0), Decl(exportEqualNamespaces.ts, 2, 1), Decl(exportEqualNamespaces.ts, 10, 3)) diff --git a/tests/baselines/reference/exportEqualsAmd.js b/tests/baselines/reference/exportEqualsAmd.js new file mode 100644 index 00000000000..a0f029589d6 --- /dev/null +++ b/tests/baselines/reference/exportEqualsAmd.js @@ -0,0 +1,9 @@ +//// [exportEqualsAmd.ts] +export = { ["hi"]: "there" }; + +//// [exportEqualsAmd.js] +define(["require", "exports"], function (require, exports) { + "use strict"; + return (_a = {}, _a["hi"] = "there", _a); + var _a; +}); diff --git a/tests/baselines/reference/exportEqualsAmd.symbols b/tests/baselines/reference/exportEqualsAmd.symbols new file mode 100644 index 00000000000..0a35efe187f --- /dev/null +++ b/tests/baselines/reference/exportEqualsAmd.symbols @@ -0,0 +1,4 @@ +=== tests/cases/compiler/exportEqualsAmd.ts === +export = { ["hi"]: "there" }; +>"hi" : Symbol(["hi"], Decl(exportEqualsAmd.ts, 0, 10)) + diff --git a/tests/baselines/reference/exportEqualsAmd.types b/tests/baselines/reference/exportEqualsAmd.types new file mode 100644 index 00000000000..f5b1bb49910 --- /dev/null +++ b/tests/baselines/reference/exportEqualsAmd.types @@ -0,0 +1,6 @@ +=== tests/cases/compiler/exportEqualsAmd.ts === +export = { ["hi"]: "there" }; +>{ ["hi"]: "there" } : { ["hi"]: string; } +>"hi" : string +>"there" : string + diff --git a/tests/baselines/reference/exportEqualsCommonJs.js b/tests/baselines/reference/exportEqualsCommonJs.js new file mode 100644 index 00000000000..01b7a43b310 --- /dev/null +++ b/tests/baselines/reference/exportEqualsCommonJs.js @@ -0,0 +1,7 @@ +//// [exportEqualsCommonJs.ts] +export = { ["hi"]: "there" }; + +//// [exportEqualsCommonJs.js] +"use strict"; +module.exports = (_a = {}, _a["hi"] = "there", _a); +var _a; diff --git a/tests/baselines/reference/exportEqualsCommonJs.symbols b/tests/baselines/reference/exportEqualsCommonJs.symbols new file mode 100644 index 00000000000..ce82666336d --- /dev/null +++ b/tests/baselines/reference/exportEqualsCommonJs.symbols @@ -0,0 +1,4 @@ +=== tests/cases/compiler/exportEqualsCommonJs.ts === +export = { ["hi"]: "there" }; +>"hi" : Symbol(["hi"], Decl(exportEqualsCommonJs.ts, 0, 10)) + diff --git a/tests/baselines/reference/exportEqualsCommonJs.types b/tests/baselines/reference/exportEqualsCommonJs.types new file mode 100644 index 00000000000..13b968595be --- /dev/null +++ b/tests/baselines/reference/exportEqualsCommonJs.types @@ -0,0 +1,6 @@ +=== tests/cases/compiler/exportEqualsCommonJs.ts === +export = { ["hi"]: "there" }; +>{ ["hi"]: "there" } : { ["hi"]: string; } +>"hi" : string +>"there" : string + diff --git a/tests/baselines/reference/exportEqualsDefaultProperty.js b/tests/baselines/reference/exportEqualsDefaultProperty.js new file mode 100644 index 00000000000..6d75ef5d95d --- /dev/null +++ b/tests/baselines/reference/exportEqualsDefaultProperty.js @@ -0,0 +1,27 @@ +//// [tests/cases/compiler/exportEqualsDefaultProperty.ts] //// + +//// [exp.ts] + +var x = { + "greeting": "hello, world", + "default": 42 +}; + +export = x + +//// [imp.ts] +import foo from "./exp"; +foo.toExponential(2); + + +//// [exp.js] +"use strict"; +var x = { + "greeting": "hello, world", + "default": 42 +}; +module.exports = x; +//// [imp.js] +"use strict"; +var exp_1 = require("./exp"); +exp_1["default"].toExponential(2); diff --git a/tests/baselines/reference/exportEqualsDefaultProperty.symbols b/tests/baselines/reference/exportEqualsDefaultProperty.symbols new file mode 100644 index 00000000000..54bbbde6956 --- /dev/null +++ b/tests/baselines/reference/exportEqualsDefaultProperty.symbols @@ -0,0 +1,21 @@ +=== tests/cases/compiler/exp.ts === + +var x = { +>x : Symbol(x, Decl(exp.ts, 1, 3)) + + "greeting": "hello, world", + "default": 42 +}; + +export = x +>x : Symbol(x, Decl(exp.ts, 1, 3)) + +=== tests/cases/compiler/imp.ts === +import foo from "./exp"; +>foo : Symbol(foo, Decl(imp.ts, 0, 6)) + +foo.toExponential(2); +>foo.toExponential : Symbol(Number.toExponential, Decl(lib.d.ts, --, --)) +>foo : Symbol(foo, Decl(imp.ts, 0, 6)) +>toExponential : Symbol(Number.toExponential, Decl(lib.d.ts, --, --)) + diff --git a/tests/baselines/reference/exportEqualsDefaultProperty.types b/tests/baselines/reference/exportEqualsDefaultProperty.types new file mode 100644 index 00000000000..31a6c8052f9 --- /dev/null +++ b/tests/baselines/reference/exportEqualsDefaultProperty.types @@ -0,0 +1,28 @@ +=== tests/cases/compiler/exp.ts === + +var x = { +>x : { "greeting": string; "default": number; } +>{ "greeting": "hello, world", "default": 42} : { "greeting": string; "default": number; } + + "greeting": "hello, world", +>"hello, world" : string + + "default": 42 +>42 : number + +}; + +export = x +>x : { "greeting": string; "default": number; } + +=== tests/cases/compiler/imp.ts === +import foo from "./exp"; +>foo : number + +foo.toExponential(2); +>foo.toExponential(2) : string +>foo.toExponential : (fractionDigits?: number) => string +>foo : number +>toExponential : (fractionDigits?: number) => string +>2 : number + diff --git a/tests/baselines/reference/exportEqualsOfModule.js b/tests/baselines/reference/exportEqualsOfModule.js new file mode 100644 index 00000000000..9c8196c7491 --- /dev/null +++ b/tests/baselines/reference/exportEqualsOfModule.js @@ -0,0 +1,23 @@ +//// [exportEqualsOfModule.ts] +declare module '~popsicle/dist/request' { + export class Request {} +} + +declare module '~popsicle/dist/common' { + import { Request } from '~popsicle/dist/request'; + export { Request }; +} + +declare module 'popsicle' { + import alias = require('~popsicle/dist/common'); + export = alias; +} + +declare module 'popsicle-proxy-agent' { + import { Request } from 'popsicle'; + function proxy(): (request: Request) => any; + export = proxy; +} + + +//// [exportEqualsOfModule.js] diff --git a/tests/baselines/reference/exportEqualsOfModule.symbols b/tests/baselines/reference/exportEqualsOfModule.symbols new file mode 100644 index 00000000000..20548930f03 --- /dev/null +++ b/tests/baselines/reference/exportEqualsOfModule.symbols @@ -0,0 +1,35 @@ +=== tests/cases/compiler/exportEqualsOfModule.ts === +declare module '~popsicle/dist/request' { + export class Request {} +>Request : Symbol(Request, Decl(exportEqualsOfModule.ts, 0, 41)) +} + +declare module '~popsicle/dist/common' { + import { Request } from '~popsicle/dist/request'; +>Request : Symbol(Request, Decl(exportEqualsOfModule.ts, 5, 12)) + + export { Request }; +>Request : Symbol(Request, Decl(exportEqualsOfModule.ts, 6, 12)) +} + +declare module 'popsicle' { + import alias = require('~popsicle/dist/common'); +>alias : Symbol(alias, Decl(exportEqualsOfModule.ts, 9, 27)) + + export = alias; +>alias : Symbol(alias, Decl(exportEqualsOfModule.ts, 9, 27)) +} + +declare module 'popsicle-proxy-agent' { + import { Request } from 'popsicle'; +>Request : Symbol(Request, Decl(exportEqualsOfModule.ts, 15, 12)) + + function proxy(): (request: Request) => any; +>proxy : Symbol(proxy, Decl(exportEqualsOfModule.ts, 15, 39)) +>request : Symbol(request, Decl(exportEqualsOfModule.ts, 16, 23)) +>Request : Symbol(Request, Decl(exportEqualsOfModule.ts, 15, 12)) + + export = proxy; +>proxy : Symbol(proxy, Decl(exportEqualsOfModule.ts, 15, 39)) +} + diff --git a/tests/baselines/reference/exportEqualsOfModule.types b/tests/baselines/reference/exportEqualsOfModule.types new file mode 100644 index 00000000000..d96557c93be --- /dev/null +++ b/tests/baselines/reference/exportEqualsOfModule.types @@ -0,0 +1,35 @@ +=== tests/cases/compiler/exportEqualsOfModule.ts === +declare module '~popsicle/dist/request' { + export class Request {} +>Request : Request +} + +declare module '~popsicle/dist/common' { + import { Request } from '~popsicle/dist/request'; +>Request : typeof Request + + export { Request }; +>Request : typeof Request +} + +declare module 'popsicle' { + import alias = require('~popsicle/dist/common'); +>alias : typeof alias + + export = alias; +>alias : typeof alias +} + +declare module 'popsicle-proxy-agent' { + import { Request } from 'popsicle'; +>Request : typeof Request + + function proxy(): (request: Request) => any; +>proxy : () => (request: Request) => any +>request : Request +>Request : Request + + export = proxy; +>proxy : () => (request: Request) => any +} + diff --git a/tests/baselines/reference/exportEqualsUmd.js b/tests/baselines/reference/exportEqualsUmd.js new file mode 100644 index 00000000000..615cc2cddbe --- /dev/null +++ b/tests/baselines/reference/exportEqualsUmd.js @@ -0,0 +1,16 @@ +//// [exportEqualsUmd.ts] +export = { ["hi"]: "there" }; + +//// [exportEqualsUmd.js] +(function (factory) { + if (typeof module === 'object' && typeof module.exports === 'object') { + var v = factory(require, exports); if (v !== undefined) module.exports = v; + } + else if (typeof define === 'function' && define.amd) { + define(["require", "exports"], factory); + } +})(function (require, exports) { + "use strict"; + return (_a = {}, _a["hi"] = "there", _a); + var _a; +}); diff --git a/tests/baselines/reference/exportEqualsUmd.symbols b/tests/baselines/reference/exportEqualsUmd.symbols new file mode 100644 index 00000000000..b6c669e31a3 --- /dev/null +++ b/tests/baselines/reference/exportEqualsUmd.symbols @@ -0,0 +1,4 @@ +=== tests/cases/compiler/exportEqualsUmd.ts === +export = { ["hi"]: "there" }; +>"hi" : Symbol(["hi"], Decl(exportEqualsUmd.ts, 0, 10)) + diff --git a/tests/baselines/reference/exportEqualsUmd.types b/tests/baselines/reference/exportEqualsUmd.types new file mode 100644 index 00000000000..ab456f0ae48 --- /dev/null +++ b/tests/baselines/reference/exportEqualsUmd.types @@ -0,0 +1,6 @@ +=== tests/cases/compiler/exportEqualsUmd.ts === +export = { ["hi"]: "there" }; +>{ ["hi"]: "there" } : { ["hi"]: string; } +>"hi" : string +>"there" : string + diff --git a/tests/baselines/reference/exportImport.symbols b/tests/baselines/reference/exportImport.symbols index 02132338834..9f76955b9e6 100644 --- a/tests/baselines/reference/exportImport.symbols +++ b/tests/baselines/reference/exportImport.symbols @@ -19,7 +19,7 @@ export = Widget1 class Widget1 { name = 'one'; } >Widget1 : Symbol(Widget1, Decl(w1.ts, 1, 16)) ->name : Symbol(name, Decl(w1.ts, 2, 15)) +>name : Symbol(Widget1.name, Decl(w1.ts, 2, 15)) === tests/cases/compiler/exporter.ts === export import w = require('./w1'); diff --git a/tests/baselines/reference/exportImportAlias.symbols b/tests/baselines/reference/exportImportAlias.symbols index 131f53919ab..0f74969e591 100644 --- a/tests/baselines/reference/exportImportAlias.symbols +++ b/tests/baselines/reference/exportImportAlias.symbols @@ -11,8 +11,8 @@ module A { >Point : Symbol(Point, Decl(exportImportAlias.ts, 4, 32)) constructor(public x: number, public y: number) { } ->x : Symbol(x, Decl(exportImportAlias.ts, 6, 20)) ->y : Symbol(y, Decl(exportImportAlias.ts, 6, 37)) +>x : Symbol(Point.x, Decl(exportImportAlias.ts, 6, 20)) +>y : Symbol(Point.y, Decl(exportImportAlias.ts, 6, 37)) } export module B { >B : Symbol(B, Decl(exportImportAlias.ts, 7, 5)) @@ -21,7 +21,7 @@ module A { >Id : Symbol(Id, Decl(exportImportAlias.ts, 8, 21)) name: string; ->name : Symbol(name, Decl(exportImportAlias.ts, 9, 29)) +>name : Symbol(Id.name, Decl(exportImportAlias.ts, 9, 29)) } } } @@ -79,8 +79,8 @@ module X { >Point : Symbol(Point, Decl(exportImportAlias.ts, 29, 21)) constructor(public x: number, public y: number) { } ->x : Symbol(x, Decl(exportImportAlias.ts, 31, 24)) ->y : Symbol(y, Decl(exportImportAlias.ts, 31, 41)) +>x : Symbol(Point.x, Decl(exportImportAlias.ts, 31, 24)) +>y : Symbol(Point.y, Decl(exportImportAlias.ts, 31, 41)) } } } @@ -118,7 +118,7 @@ module K { >L : Symbol(L, Decl(exportImportAlias.ts, 45, 10), Decl(exportImportAlias.ts, 48, 5)) constructor(public name: string) { } ->name : Symbol(name, Decl(exportImportAlias.ts, 47, 20)) +>name : Symbol(L.name, Decl(exportImportAlias.ts, 47, 20)) } export module L { @@ -131,10 +131,10 @@ module K { >Point : Symbol(Point, Decl(exportImportAlias.ts, 51, 26)) x: number; ->x : Symbol(x, Decl(exportImportAlias.ts, 52, 32)) +>x : Symbol(Point.x, Decl(exportImportAlias.ts, 52, 32)) y: number; ->y : Symbol(y, Decl(exportImportAlias.ts, 53, 22)) +>y : Symbol(Point.y, Decl(exportImportAlias.ts, 53, 22)) } } } diff --git a/tests/baselines/reference/exportImportAndClodule.symbols b/tests/baselines/reference/exportImportAndClodule.symbols index 23995243bf9..1c6cbc6b784 100644 --- a/tests/baselines/reference/exportImportAndClodule.symbols +++ b/tests/baselines/reference/exportImportAndClodule.symbols @@ -6,7 +6,7 @@ module K { >L : Symbol(L, Decl(exportImportAndClodule.ts, 0, 10), Decl(exportImportAndClodule.ts, 3, 5)) constructor(public name: string) { } ->name : Symbol(name, Decl(exportImportAndClodule.ts, 2, 20)) +>name : Symbol(L.name, Decl(exportImportAndClodule.ts, 2, 20)) } export module L { >L : Symbol(L, Decl(exportImportAndClodule.ts, 0, 10), Decl(exportImportAndClodule.ts, 3, 5)) @@ -18,10 +18,10 @@ module K { >Point : Symbol(Point, Decl(exportImportAndClodule.ts, 5, 26)) x: number; ->x : Symbol(x, Decl(exportImportAndClodule.ts, 6, 32)) +>x : Symbol(Point.x, Decl(exportImportAndClodule.ts, 6, 32)) y: number; ->y : Symbol(y, Decl(exportImportAndClodule.ts, 7, 22)) +>y : Symbol(Point.y, Decl(exportImportAndClodule.ts, 7, 22)) } } } diff --git a/tests/baselines/reference/exportImportNonInstantiatedModule.symbols b/tests/baselines/reference/exportImportNonInstantiatedModule.symbols index 6e044368bfb..1556427e09e 100644 --- a/tests/baselines/reference/exportImportNonInstantiatedModule.symbols +++ b/tests/baselines/reference/exportImportNonInstantiatedModule.symbols @@ -4,7 +4,7 @@ module A { export interface I { x: number } >I : Symbol(I, Decl(exportImportNonInstantiatedModule.ts, 0, 10)) ->x : Symbol(x, Decl(exportImportNonInstantiatedModule.ts, 1, 24)) +>x : Symbol(I.x, Decl(exportImportNonInstantiatedModule.ts, 1, 24)) } module B { diff --git a/tests/baselines/reference/exportImportNonInstantiatedModule2.symbols b/tests/baselines/reference/exportImportNonInstantiatedModule2.symbols index 02ccf97b161..148fd03b828 100644 --- a/tests/baselines/reference/exportImportNonInstantiatedModule2.symbols +++ b/tests/baselines/reference/exportImportNonInstantiatedModule2.symbols @@ -17,7 +17,7 @@ export = Widget1 interface Widget1 { name: string; } >Widget1 : Symbol(Widget1, Decl(w1.ts, 1, 16)) ->name : Symbol(name, Decl(w1.ts, 2, 19)) +>name : Symbol(Widget1.name, Decl(w1.ts, 2, 19)) === tests/cases/compiler/exporter.ts === export import w = require('./w1'); diff --git a/tests/baselines/reference/exportNonInitializedVariablesSystem.js b/tests/baselines/reference/exportNonInitializedVariablesSystem.js index 53d8a5424ef..2a8e2022c95 100644 --- a/tests/baselines/reference/exportNonInitializedVariablesSystem.js +++ b/tests/baselines/reference/exportNonInitializedVariablesSystem.js @@ -35,8 +35,9 @@ export let h1: D = new D; //// [exportNonInitializedVariablesSystem.js] -System.register([], function(exports_1, __moduleName) { +System.register([], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; var a, b, c, d, A, e, f, B, C, a1, b1, c1, d1, D, e1, f1, g1, h1; return { setters:[], diff --git a/tests/baselines/reference/exportNonVisibleType.errors.txt b/tests/baselines/reference/exportNonVisibleType.errors.txt deleted file mode 100644 index bc4dac4ca58..00000000000 --- a/tests/baselines/reference/exportNonVisibleType.errors.txt +++ /dev/null @@ -1,39 +0,0 @@ -tests/cases/conformance/externalModules/foo1.ts(7,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. - - -==== tests/cases/conformance/externalModules/foo1.ts (1 errors) ==== - interface I1 { - a: string; - b: number; - } - - var x: I1 = {a: "test", b: 42}; - export = x; // Should fail, I1 not exported. - ~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. - - -==== tests/cases/conformance/externalModules/foo2.ts (0 errors) ==== - interface I1 { - a: string; - b: number; - } - - class C1 { - m1: I1; - } - - export = C1; // Should fail, type I1 of visible member C1.m1 not exported. - -==== tests/cases/conformance/externalModules/foo3.ts (0 errors) ==== - interface I1 { - a: string; - b: number; - } - - class C1 { - private m1: I1; - } - - export = C1; // Should work, private type I1 of visible class C1 only used in private member m1. - \ No newline at end of file diff --git a/tests/baselines/reference/exportNonVisibleType.symbols b/tests/baselines/reference/exportNonVisibleType.symbols new file mode 100644 index 00000000000..6d08b3cf447 --- /dev/null +++ b/tests/baselines/reference/exportNonVisibleType.symbols @@ -0,0 +1,65 @@ +=== tests/cases/conformance/externalModules/foo1.ts === +interface I1 { +>I1 : Symbol(I1, Decl(foo1.ts, 0, 0)) + + a: string; +>a : Symbol(I1.a, Decl(foo1.ts, 0, 14)) + + b: number; +>b : Symbol(I1.b, Decl(foo1.ts, 1, 11)) +} + +var x: I1 = {a: "test", b: 42}; +>x : Symbol(x, Decl(foo1.ts, 5, 3)) +>I1 : Symbol(I1, Decl(foo1.ts, 0, 0)) +>a : Symbol(a, Decl(foo1.ts, 5, 13)) +>b : Symbol(b, Decl(foo1.ts, 5, 23)) + +export = x; // Should fail, I1 not exported. +>x : Symbol(x, Decl(foo1.ts, 5, 3)) + + +=== tests/cases/conformance/externalModules/foo2.ts === +interface I1 { +>I1 : Symbol(I1, Decl(foo2.ts, 0, 0)) + + a: string; +>a : Symbol(I1.a, Decl(foo2.ts, 0, 14)) + + b: number; +>b : Symbol(I1.b, Decl(foo2.ts, 1, 11)) +} + +class C1 { +>C1 : Symbol(C1, Decl(foo2.ts, 3, 1)) + + m1: I1; +>m1 : Symbol(C1.m1, Decl(foo2.ts, 5, 10)) +>I1 : Symbol(I1, Decl(foo2.ts, 0, 0)) +} + +export = C1; // Should fail, type I1 of visible member C1.m1 not exported. +>C1 : Symbol(C1, Decl(foo2.ts, 3, 1)) + +=== tests/cases/conformance/externalModules/foo3.ts === +interface I1 { +>I1 : Symbol(I1, Decl(foo3.ts, 0, 0)) + + a: string; +>a : Symbol(I1.a, Decl(foo3.ts, 0, 14)) + + b: number; +>b : Symbol(I1.b, Decl(foo3.ts, 1, 11)) +} + +class C1 { +>C1 : Symbol(C1, Decl(foo3.ts, 3, 1)) + + private m1: I1; +>m1 : Symbol(C1.m1, Decl(foo3.ts, 5, 10)) +>I1 : Symbol(I1, Decl(foo3.ts, 0, 0)) +} + +export = C1; // Should work, private type I1 of visible class C1 only used in private member m1. +>C1 : Symbol(C1, Decl(foo3.ts, 3, 1)) + diff --git a/tests/baselines/reference/exportNonVisibleType.types b/tests/baselines/reference/exportNonVisibleType.types new file mode 100644 index 00000000000..2ad420ac531 --- /dev/null +++ b/tests/baselines/reference/exportNonVisibleType.types @@ -0,0 +1,68 @@ +=== tests/cases/conformance/externalModules/foo1.ts === +interface I1 { +>I1 : I1 + + a: string; +>a : string + + b: number; +>b : number +} + +var x: I1 = {a: "test", b: 42}; +>x : I1 +>I1 : I1 +>{a: "test", b: 42} : { a: string; b: number; } +>a : string +>"test" : string +>b : number +>42 : number + +export = x; // Should fail, I1 not exported. +>x : I1 + + +=== tests/cases/conformance/externalModules/foo2.ts === +interface I1 { +>I1 : I1 + + a: string; +>a : string + + b: number; +>b : number +} + +class C1 { +>C1 : C1 + + m1: I1; +>m1 : I1 +>I1 : I1 +} + +export = C1; // Should fail, type I1 of visible member C1.m1 not exported. +>C1 : C1 + +=== tests/cases/conformance/externalModules/foo3.ts === +interface I1 { +>I1 : I1 + + a: string; +>a : string + + b: number; +>b : number +} + +class C1 { +>C1 : C1 + + private m1: I1; +>m1 : I1 +>I1 : I1 +} + +export = C1; // Should work, private type I1 of visible class C1 only used in private member m1. +>C1 : C1 + diff --git a/tests/baselines/reference/exportPrivateType.symbols b/tests/baselines/reference/exportPrivateType.symbols index ecb71869b39..a955870e99d 100644 --- a/tests/baselines/reference/exportPrivateType.symbols +++ b/tests/baselines/reference/exportPrivateType.symbols @@ -6,10 +6,10 @@ module foo { >C1 : Symbol(C1, Decl(exportPrivateType.ts, 0, 12)) x: string; ->x : Symbol(x, Decl(exportPrivateType.ts, 1, 14)) +>x : Symbol(C1.x, Decl(exportPrivateType.ts, 1, 14)) y: C1; ->y : Symbol(y, Decl(exportPrivateType.ts, 2, 18)) +>y : Symbol(C1.y, Decl(exportPrivateType.ts, 2, 18)) >C1 : Symbol(C1, Decl(exportPrivateType.ts, 0, 12)) } @@ -17,7 +17,7 @@ module foo { >C2 : Symbol(C2, Decl(exportPrivateType.ts, 4, 5)) test() { return true; } ->test : Symbol(test, Decl(exportPrivateType.ts, 6, 14)) +>test : Symbol(C2.test, Decl(exportPrivateType.ts, 6, 14)) } interface I1 { @@ -37,10 +37,10 @@ module foo { >I2 : Symbol(I2, Decl(exportPrivateType.ts, 13, 5)) x: string; ->x : Symbol(x, Decl(exportPrivateType.ts, 15, 18)) +>x : Symbol(I2.x, Decl(exportPrivateType.ts, 15, 18)) y: number; ->y : Symbol(y, Decl(exportPrivateType.ts, 16, 18)) +>y : Symbol(I2.y, Decl(exportPrivateType.ts, 16, 18)) } // None of the types are exported, so per section 10.3, should all be errors diff --git a/tests/baselines/reference/exportRedeclarationTypeAliases.js b/tests/baselines/reference/exportRedeclarationTypeAliases.js new file mode 100644 index 00000000000..b1e2e200634 --- /dev/null +++ b/tests/baselines/reference/exportRedeclarationTypeAliases.js @@ -0,0 +1,9 @@ +//// [exportRedeclarationTypeAliases.ts] +export type Foo = number; +export function Foo(): number; +export function Foo(): any {} + +//// [exportRedeclarationTypeAliases.js] +"use strict"; +function Foo() { } +exports.Foo = Foo; diff --git a/tests/baselines/reference/exportRedeclarationTypeAliases.symbols b/tests/baselines/reference/exportRedeclarationTypeAliases.symbols new file mode 100644 index 00000000000..6561692e307 --- /dev/null +++ b/tests/baselines/reference/exportRedeclarationTypeAliases.symbols @@ -0,0 +1,10 @@ +=== tests/cases/compiler/exportRedeclarationTypeAliases.ts === +export type Foo = number; +>Foo : Symbol(Foo, Decl(exportRedeclarationTypeAliases.ts, 0, 0), Decl(exportRedeclarationTypeAliases.ts, 0, 25), Decl(exportRedeclarationTypeAliases.ts, 1, 30)) + +export function Foo(): number; +>Foo : Symbol(Foo, Decl(exportRedeclarationTypeAliases.ts, 0, 0), Decl(exportRedeclarationTypeAliases.ts, 0, 25), Decl(exportRedeclarationTypeAliases.ts, 1, 30)) + +export function Foo(): any {} +>Foo : Symbol(Foo, Decl(exportRedeclarationTypeAliases.ts, 0, 0), Decl(exportRedeclarationTypeAliases.ts, 0, 25), Decl(exportRedeclarationTypeAliases.ts, 1, 30)) + diff --git a/tests/baselines/reference/exportRedeclarationTypeAliases.types b/tests/baselines/reference/exportRedeclarationTypeAliases.types new file mode 100644 index 00000000000..f5c987373b6 --- /dev/null +++ b/tests/baselines/reference/exportRedeclarationTypeAliases.types @@ -0,0 +1,10 @@ +=== tests/cases/compiler/exportRedeclarationTypeAliases.ts === +export type Foo = number; +>Foo : number + +export function Foo(): number; +>Foo : () => number + +export function Foo(): any {} +>Foo : () => number + diff --git a/tests/baselines/reference/exportSpecifierForAGlobal.errors.txt b/tests/baselines/reference/exportSpecifierForAGlobal.errors.txt new file mode 100644 index 00000000000..559b9d5fbfe --- /dev/null +++ b/tests/baselines/reference/exportSpecifierForAGlobal.errors.txt @@ -0,0 +1,16 @@ +tests/cases/compiler/b.ts(1,9): error TS2661: Cannot export 'X'. Only local declarations can be exported from a module. + + +==== tests/cases/compiler/a.d.ts (0 errors) ==== + + declare class X { } + +==== tests/cases/compiler/b.ts (1 errors) ==== + export {X}; + ~ +!!! error TS2661: Cannot export 'X'. Only local declarations can be exported from a module. + export function f() { + var x: X; + return x; + } + \ No newline at end of file diff --git a/tests/baselines/reference/exportSpecifierForAGlobal.symbols b/tests/baselines/reference/exportSpecifierForAGlobal.symbols deleted file mode 100644 index b38fc7be270..00000000000 --- a/tests/baselines/reference/exportSpecifierForAGlobal.symbols +++ /dev/null @@ -1,20 +0,0 @@ -=== tests/cases/compiler/a.d.ts === - -declare class X { } ->X : Symbol(X, Decl(a.d.ts, 0, 0)) - -=== tests/cases/compiler/b.ts === -export {X}; ->X : Symbol(X, Decl(b.ts, 0, 8)) - -export function f() { ->f : Symbol(f, Decl(b.ts, 0, 11)) - - var x: X; ->x : Symbol(x, Decl(b.ts, 2, 7)) ->X : Symbol(X, Decl(a.d.ts, 0, 0)) - - return x; ->x : Symbol(x, Decl(b.ts, 2, 7)) -} - diff --git a/tests/baselines/reference/exportSpecifierForAGlobal.types b/tests/baselines/reference/exportSpecifierForAGlobal.types deleted file mode 100644 index e3d728ad0d0..00000000000 --- a/tests/baselines/reference/exportSpecifierForAGlobal.types +++ /dev/null @@ -1,20 +0,0 @@ -=== tests/cases/compiler/a.d.ts === - -declare class X { } ->X : X - -=== tests/cases/compiler/b.ts === -export {X}; ->X : typeof X - -export function f() { ->f : () => X - - var x: X; ->x : X ->X : X - - return x; ->x : X -} - diff --git a/tests/baselines/reference/exportSpecifierReferencingOuterDeclaration1.errors.txt b/tests/baselines/reference/exportSpecifierReferencingOuterDeclaration1.errors.txt new file mode 100644 index 00000000000..6ff2e71d26e --- /dev/null +++ b/tests/baselines/reference/exportSpecifierReferencingOuterDeclaration1.errors.txt @@ -0,0 +1,11 @@ +tests/cases/compiler/exportSpecifierReferencingOuterDeclaration1.ts(3,14): error TS2661: Cannot export 'X'. Only local declarations can be exported from a module. + + +==== tests/cases/compiler/exportSpecifierReferencingOuterDeclaration1.ts (1 errors) ==== + declare module X { export interface bar { } } + declare module "m" { + export { X }; + ~ +!!! error TS2661: Cannot export 'X'. Only local declarations can be exported from a module. + export function foo(): X.bar; + } \ No newline at end of file diff --git a/tests/baselines/reference/exportSpecifierReferencingOuterDeclaration1.symbols b/tests/baselines/reference/exportSpecifierReferencingOuterDeclaration1.symbols deleted file mode 100644 index 16abde86d32..00000000000 --- a/tests/baselines/reference/exportSpecifierReferencingOuterDeclaration1.symbols +++ /dev/null @@ -1,14 +0,0 @@ -=== tests/cases/compiler/exportSpecifierReferencingOuterDeclaration1.ts === -declare module X { export interface bar { } } ->X : Symbol(X, Decl(exportSpecifierReferencingOuterDeclaration1.ts, 0, 0)) ->bar : Symbol(bar, Decl(exportSpecifierReferencingOuterDeclaration1.ts, 0, 18)) - -declare module "m" { - export { X }; ->X : Symbol(X, Decl(exportSpecifierReferencingOuterDeclaration1.ts, 2, 12)) - - export function foo(): X.bar; ->foo : Symbol(foo, Decl(exportSpecifierReferencingOuterDeclaration1.ts, 2, 17)) ->X : Symbol(X, Decl(exportSpecifierReferencingOuterDeclaration1.ts, 0, 0)) ->bar : Symbol(X.bar, Decl(exportSpecifierReferencingOuterDeclaration1.ts, 0, 18)) -} diff --git a/tests/baselines/reference/exportSpecifierReferencingOuterDeclaration1.types b/tests/baselines/reference/exportSpecifierReferencingOuterDeclaration1.types deleted file mode 100644 index be03554a1b0..00000000000 --- a/tests/baselines/reference/exportSpecifierReferencingOuterDeclaration1.types +++ /dev/null @@ -1,14 +0,0 @@ -=== tests/cases/compiler/exportSpecifierReferencingOuterDeclaration1.ts === -declare module X { export interface bar { } } ->X : any ->bar : bar - -declare module "m" { - export { X }; ->X : any - - export function foo(): X.bar; ->foo : () => X.bar ->X : any ->bar : X.bar -} diff --git a/tests/baselines/reference/exportSpecifierReferencingOuterDeclaration2.errors.txt b/tests/baselines/reference/exportSpecifierReferencingOuterDeclaration2.errors.txt new file mode 100644 index 00000000000..83b8366d40c --- /dev/null +++ b/tests/baselines/reference/exportSpecifierReferencingOuterDeclaration2.errors.txt @@ -0,0 +1,11 @@ +tests/cases/compiler/exportSpecifierReferencingOuterDeclaration2_B.ts(1,10): error TS2661: Cannot export 'X'. Only local declarations can be exported from a module. + + +==== tests/cases/compiler/exportSpecifierReferencingOuterDeclaration2_A.ts (0 errors) ==== + declare module X { export interface bar { } } + +==== tests/cases/compiler/exportSpecifierReferencingOuterDeclaration2_B.ts (1 errors) ==== + export { X }; + ~ +!!! error TS2661: Cannot export 'X'. Only local declarations can be exported from a module. + export declare function foo(): X.bar; \ No newline at end of file diff --git a/tests/baselines/reference/exportSpecifierReferencingOuterDeclaration2.symbols b/tests/baselines/reference/exportSpecifierReferencingOuterDeclaration2.symbols deleted file mode 100644 index 9a57645b1cb..00000000000 --- a/tests/baselines/reference/exportSpecifierReferencingOuterDeclaration2.symbols +++ /dev/null @@ -1,14 +0,0 @@ -=== tests/cases/compiler/exportSpecifierReferencingOuterDeclaration2_A.ts === -declare module X { export interface bar { } } ->X : Symbol(X, Decl(exportSpecifierReferencingOuterDeclaration2_A.ts, 0, 0)) ->bar : Symbol(bar, Decl(exportSpecifierReferencingOuterDeclaration2_A.ts, 0, 18)) - -=== tests/cases/compiler/exportSpecifierReferencingOuterDeclaration2_B.ts === -export { X }; ->X : Symbol(X, Decl(exportSpecifierReferencingOuterDeclaration2_B.ts, 0, 8)) - -export declare function foo(): X.bar; ->foo : Symbol(foo, Decl(exportSpecifierReferencingOuterDeclaration2_B.ts, 0, 13)) ->X : Symbol(X, Decl(exportSpecifierReferencingOuterDeclaration2_A.ts, 0, 0)) ->bar : Symbol(X.bar, Decl(exportSpecifierReferencingOuterDeclaration2_A.ts, 0, 18)) - diff --git a/tests/baselines/reference/exportSpecifierReferencingOuterDeclaration2.types b/tests/baselines/reference/exportSpecifierReferencingOuterDeclaration2.types deleted file mode 100644 index fa59948c116..00000000000 --- a/tests/baselines/reference/exportSpecifierReferencingOuterDeclaration2.types +++ /dev/null @@ -1,14 +0,0 @@ -=== tests/cases/compiler/exportSpecifierReferencingOuterDeclaration2_A.ts === -declare module X { export interface bar { } } ->X : any ->bar : bar - -=== tests/cases/compiler/exportSpecifierReferencingOuterDeclaration2_B.ts === -export { X }; ->X : any - -export declare function foo(): X.bar; ->foo : () => X.bar ->X : any ->bar : X.bar - diff --git a/tests/baselines/reference/exportStarForValues.symbols b/tests/baselines/reference/exportStarForValues.symbols index 6694afecdc6..343c7b23a14 100644 --- a/tests/baselines/reference/exportStarForValues.symbols +++ b/tests/baselines/reference/exportStarForValues.symbols @@ -2,7 +2,7 @@ export interface Foo { x } >Foo : Symbol(Foo, Decl(file1.ts, 0, 0)) ->x : Symbol(x, Decl(file1.ts, 1, 22)) +>x : Symbol(Foo.x, Decl(file1.ts, 1, 22)) === tests/cases/compiler/file2.ts === export * from "file1" diff --git a/tests/baselines/reference/exportStarForValues10.js b/tests/baselines/reference/exportStarForValues10.js index 1149baf8b27..d37ca3304f3 100644 --- a/tests/baselines/reference/exportStarForValues10.js +++ b/tests/baselines/reference/exportStarForValues10.js @@ -13,8 +13,9 @@ export * from "file1"; var x = 1; //// [file0.js] -System.register([], function(exports_1, __moduleName) { +System.register([], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; var v; return { setters:[], @@ -24,8 +25,9 @@ System.register([], function(exports_1, __moduleName) { } }); //// [file1.js] -System.register([], function(exports_1, __moduleName) { +System.register([], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; return { setters:[], execute: function() { @@ -33,8 +35,9 @@ System.register([], function(exports_1, __moduleName) { } }); //// [file2.js] -System.register(["file0"], function(exports_1, __moduleName) { +System.register(["file0"], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; var x; function exportStar_1(m) { var exports = {}; diff --git a/tests/baselines/reference/exportStarForValues10.symbols b/tests/baselines/reference/exportStarForValues10.symbols index 2de35864d27..d1dc20f9140 100644 --- a/tests/baselines/reference/exportStarForValues10.symbols +++ b/tests/baselines/reference/exportStarForValues10.symbols @@ -6,7 +6,7 @@ export var v = 1; === tests/cases/compiler/file1.ts === export interface Foo { x } >Foo : Symbol(Foo, Decl(file1.ts, 0, 0)) ->x : Symbol(x, Decl(file1.ts, 0, 22)) +>x : Symbol(Foo.x, Decl(file1.ts, 0, 22)) === tests/cases/compiler/file2.ts === export * from "file0"; diff --git a/tests/baselines/reference/exportStarForValues2.symbols b/tests/baselines/reference/exportStarForValues2.symbols index 0fa739f5431..fe5529b0f6d 100644 --- a/tests/baselines/reference/exportStarForValues2.symbols +++ b/tests/baselines/reference/exportStarForValues2.symbols @@ -2,7 +2,7 @@ export interface Foo { x } >Foo : Symbol(Foo, Decl(file1.ts, 0, 0)) ->x : Symbol(x, Decl(file1.ts, 1, 22)) +>x : Symbol(Foo.x, Decl(file1.ts, 1, 22)) === tests/cases/compiler/file2.ts === export * from "file1" diff --git a/tests/baselines/reference/exportStarForValues3.symbols b/tests/baselines/reference/exportStarForValues3.symbols index a79aeb36588..5a9cc5f8d52 100644 --- a/tests/baselines/reference/exportStarForValues3.symbols +++ b/tests/baselines/reference/exportStarForValues3.symbols @@ -2,12 +2,12 @@ export interface Foo { x } >Foo : Symbol(Foo, Decl(file1.ts, 0, 0)) ->x : Symbol(x, Decl(file1.ts, 1, 22)) +>x : Symbol(Foo.x, Decl(file1.ts, 1, 22)) === tests/cases/compiler/file2.ts === export interface A { x } >A : Symbol(A, Decl(file2.ts, 0, 0)) ->x : Symbol(x, Decl(file2.ts, 0, 20)) +>x : Symbol(A.x, Decl(file2.ts, 0, 20)) export * from "file1" var x = 1; @@ -16,7 +16,7 @@ var x = 1; === tests/cases/compiler/file3.ts === export interface B { x } >B : Symbol(B, Decl(file3.ts, 0, 0)) ->x : Symbol(x, Decl(file3.ts, 0, 20)) +>x : Symbol(B.x, Decl(file3.ts, 0, 20)) export * from "file1" var x = 1; @@ -25,7 +25,7 @@ var x = 1; === tests/cases/compiler/file4.ts === export interface C { x } >C : Symbol(C, Decl(file4.ts, 0, 0)) ->x : Symbol(x, Decl(file4.ts, 0, 20)) +>x : Symbol(C.x, Decl(file4.ts, 0, 20)) export * from "file2" export * from "file3" diff --git a/tests/baselines/reference/exportStarForValues4.symbols b/tests/baselines/reference/exportStarForValues4.symbols index 465d6ed3237..a6812b72952 100644 --- a/tests/baselines/reference/exportStarForValues4.symbols +++ b/tests/baselines/reference/exportStarForValues4.symbols @@ -2,12 +2,12 @@ export interface Foo { x } >Foo : Symbol(Foo, Decl(file1.ts, 0, 0)) ->x : Symbol(x, Decl(file1.ts, 1, 22)) +>x : Symbol(Foo.x, Decl(file1.ts, 1, 22)) === tests/cases/compiler/file2.ts === export interface A { x } >A : Symbol(A, Decl(file2.ts, 0, 0)) ->x : Symbol(x, Decl(file2.ts, 0, 20)) +>x : Symbol(A.x, Decl(file2.ts, 0, 20)) export * from "file1" export * from "file3" @@ -17,7 +17,7 @@ var x = 1; === tests/cases/compiler/file3.ts === export interface B { x } >B : Symbol(B, Decl(file3.ts, 0, 0)) ->x : Symbol(x, Decl(file3.ts, 0, 20)) +>x : Symbol(B.x, Decl(file3.ts, 0, 20)) export * from "file2" var x = 1; diff --git a/tests/baselines/reference/exportStarForValues5.symbols b/tests/baselines/reference/exportStarForValues5.symbols index a2950afa73f..06e6a859e23 100644 --- a/tests/baselines/reference/exportStarForValues5.symbols +++ b/tests/baselines/reference/exportStarForValues5.symbols @@ -2,7 +2,7 @@ export interface Foo { x } >Foo : Symbol(Foo, Decl(file1.ts, 0, 0)) ->x : Symbol(x, Decl(file1.ts, 1, 22)) +>x : Symbol(Foo.x, Decl(file1.ts, 1, 22)) === tests/cases/compiler/file2.ts === export * from "file1" diff --git a/tests/baselines/reference/exportStarForValues6.js b/tests/baselines/reference/exportStarForValues6.js index f2257277630..8c31f6b4d16 100644 --- a/tests/baselines/reference/exportStarForValues6.js +++ b/tests/baselines/reference/exportStarForValues6.js @@ -9,8 +9,9 @@ export * from "file1" export var x = 1; //// [file1.js] -System.register([], function(exports_1, __moduleName) { +System.register([], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; return { setters:[], execute: function() { @@ -18,8 +19,9 @@ System.register([], function(exports_1, __moduleName) { } }); //// [file2.js] -System.register([], function(exports_1, __moduleName) { +System.register([], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; var x; return { setters:[], diff --git a/tests/baselines/reference/exportStarForValues6.symbols b/tests/baselines/reference/exportStarForValues6.symbols index c57baf301dd..1eba5698be5 100644 --- a/tests/baselines/reference/exportStarForValues6.symbols +++ b/tests/baselines/reference/exportStarForValues6.symbols @@ -2,7 +2,7 @@ export interface Foo { x } >Foo : Symbol(Foo, Decl(file1.ts, 0, 0)) ->x : Symbol(x, Decl(file1.ts, 1, 22)) +>x : Symbol(Foo.x, Decl(file1.ts, 1, 22)) === tests/cases/compiler/file2.ts === export * from "file1" diff --git a/tests/baselines/reference/exportStarForValues7.symbols b/tests/baselines/reference/exportStarForValues7.symbols index b59f2890047..952b7e3eff5 100644 --- a/tests/baselines/reference/exportStarForValues7.symbols +++ b/tests/baselines/reference/exportStarForValues7.symbols @@ -2,7 +2,7 @@ export interface Foo { x } >Foo : Symbol(Foo, Decl(file1.ts, 0, 0)) ->x : Symbol(x, Decl(file1.ts, 1, 22)) +>x : Symbol(Foo.x, Decl(file1.ts, 1, 22)) === tests/cases/compiler/file2.ts === export * from "file1" diff --git a/tests/baselines/reference/exportStarForValues8.symbols b/tests/baselines/reference/exportStarForValues8.symbols index be958ecabe8..3b893dfa42b 100644 --- a/tests/baselines/reference/exportStarForValues8.symbols +++ b/tests/baselines/reference/exportStarForValues8.symbols @@ -2,12 +2,12 @@ export interface Foo { x } >Foo : Symbol(Foo, Decl(file1.ts, 0, 0)) ->x : Symbol(x, Decl(file1.ts, 1, 22)) +>x : Symbol(Foo.x, Decl(file1.ts, 1, 22)) === tests/cases/compiler/file2.ts === export interface A { x } >A : Symbol(A, Decl(file2.ts, 0, 0)) ->x : Symbol(x, Decl(file2.ts, 0, 20)) +>x : Symbol(A.x, Decl(file2.ts, 0, 20)) export * from "file1" export var x = 1; @@ -16,7 +16,7 @@ export var x = 1; === tests/cases/compiler/file3.ts === export interface B { x } >B : Symbol(B, Decl(file3.ts, 0, 0)) ->x : Symbol(x, Decl(file3.ts, 0, 20)) +>x : Symbol(B.x, Decl(file3.ts, 0, 20)) export * from "file1" export var x = 1; @@ -25,7 +25,7 @@ export var x = 1; === tests/cases/compiler/file4.ts === export interface C { x } >C : Symbol(C, Decl(file4.ts, 0, 0)) ->x : Symbol(x, Decl(file4.ts, 0, 20)) +>x : Symbol(C.x, Decl(file4.ts, 0, 20)) export * from "file2" export * from "file3" diff --git a/tests/baselines/reference/exportStarForValues9.symbols b/tests/baselines/reference/exportStarForValues9.symbols index 0684c9e7b7c..e311f661a00 100644 --- a/tests/baselines/reference/exportStarForValues9.symbols +++ b/tests/baselines/reference/exportStarForValues9.symbols @@ -2,12 +2,12 @@ export interface Foo { x } >Foo : Symbol(Foo, Decl(file1.ts, 0, 0)) ->x : Symbol(x, Decl(file1.ts, 1, 22)) +>x : Symbol(Foo.x, Decl(file1.ts, 1, 22)) === tests/cases/compiler/file2.ts === export interface A { x } >A : Symbol(A, Decl(file2.ts, 0, 0)) ->x : Symbol(x, Decl(file2.ts, 0, 20)) +>x : Symbol(A.x, Decl(file2.ts, 0, 20)) export * from "file1" export * from "file3" @@ -17,7 +17,7 @@ export var x = 1; === tests/cases/compiler/file3.ts === export interface B { x } >B : Symbol(B, Decl(file3.ts, 0, 0)) ->x : Symbol(x, Decl(file3.ts, 0, 20)) +>x : Symbol(B.x, Decl(file3.ts, 0, 20)) export * from "file2" export var x = 1; diff --git a/tests/baselines/reference/exportStarForValuesInSystem.js b/tests/baselines/reference/exportStarForValuesInSystem.js index 33ca1f8b24d..49c6877377a 100644 --- a/tests/baselines/reference/exportStarForValuesInSystem.js +++ b/tests/baselines/reference/exportStarForValuesInSystem.js @@ -9,8 +9,9 @@ export * from "file1" var x = 1; //// [file1.js] -System.register([], function(exports_1, __moduleName) { +System.register([], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; return { setters:[], execute: function() { @@ -18,8 +19,9 @@ System.register([], function(exports_1, __moduleName) { } }); //// [file2.js] -System.register([], function(exports_1, __moduleName) { +System.register([], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; var x; return { setters:[], diff --git a/tests/baselines/reference/exportStarForValuesInSystem.symbols b/tests/baselines/reference/exportStarForValuesInSystem.symbols index c9ef9830c60..d4ffe0eeaa2 100644 --- a/tests/baselines/reference/exportStarForValuesInSystem.symbols +++ b/tests/baselines/reference/exportStarForValuesInSystem.symbols @@ -2,7 +2,7 @@ export interface Foo { x } >Foo : Symbol(Foo, Decl(file1.ts, 0, 0)) ->x : Symbol(x, Decl(file1.ts, 1, 22)) +>x : Symbol(Foo.x, Decl(file1.ts, 1, 22)) === tests/cases/compiler/file2.ts === export * from "file1" diff --git a/tests/baselines/reference/exportedInterfaceInaccessibleInCallbackInModule.symbols b/tests/baselines/reference/exportedInterfaceInaccessibleInCallbackInModule.symbols index 3127de7b6a2..2df8685b830 100644 --- a/tests/baselines/reference/exportedInterfaceInaccessibleInCallbackInModule.symbols +++ b/tests/baselines/reference/exportedInterfaceInaccessibleInCallbackInModule.symbols @@ -24,7 +24,7 @@ export declare class TPromise { // removing this method fixes the error squiggle..... public then(success?: (value:V)=>TPromise, error?: (err:any)=>TPromise, progress?:ProgressCallback): TPromise; ->then : Symbol(then, Decl(exportedInterfaceInaccessibleInCallbackInModule.ts, 7, 119)) +>then : Symbol(TPromise.then, Decl(exportedInterfaceInaccessibleInCallbackInModule.ts, 7, 119)) >U : Symbol(U, Decl(exportedInterfaceInaccessibleInCallbackInModule.ts, 10, 13)) >success : Symbol(success, Decl(exportedInterfaceInaccessibleInCallbackInModule.ts, 10, 16)) >value : Symbol(value, Decl(exportedInterfaceInaccessibleInCallbackInModule.ts, 10, 27)) diff --git a/tests/baselines/reference/exportsAndImports1-es6.js b/tests/baselines/reference/exportsAndImports1-es6.js index ece98a80318..3ac5aeb0dc5 100644 --- a/tests/baselines/reference/exportsAndImports1-es6.js +++ b/tests/baselines/reference/exportsAndImports1-es6.js @@ -67,7 +67,7 @@ exports.M = t1_1.M; exports.a = t1_1.a; //// [t3.js] "use strict"; -var t1_1 = require("./t1"); +const t1_1 = require("./t1"); exports.v = t1_1.v; exports.f = t1_1.f; exports.C = t1_1.C; diff --git a/tests/baselines/reference/exportsAndImports2-es6.js b/tests/baselines/reference/exportsAndImports2-es6.js index 865534b2851..56639bdbecf 100644 --- a/tests/baselines/reference/exportsAndImports2-es6.js +++ b/tests/baselines/reference/exportsAndImports2-es6.js @@ -24,6 +24,6 @@ exports.y = t1_1.x; exports.x = t1_1.y; //// [t3.js] "use strict"; -var t1_1 = require("./t1"); +const t1_1 = require("./t1"); exports.y = t1_1.x; exports.x = t1_1.y; diff --git a/tests/baselines/reference/exportsAndImports3-es6.js b/tests/baselines/reference/exportsAndImports3-es6.js index ed509d31437..ea16836b1f2 100644 --- a/tests/baselines/reference/exportsAndImports3-es6.js +++ b/tests/baselines/reference/exportsAndImports3-es6.js @@ -69,7 +69,7 @@ exports.M = t1_1.M1; exports.a = t1_1.a1; //// [t3.js] "use strict"; -var t1_1 = require("./t1"); +const t1_1 = require("./t1"); exports.v = t1_1.v1; exports.f = t1_1.f1; exports.C = t1_1.C1; diff --git a/tests/baselines/reference/exportsAndImports4-es6.js b/tests/baselines/reference/exportsAndImports4-es6.js index 39c6583e935..8a8d4f81225 100644 --- a/tests/baselines/reference/exportsAndImports4-es6.js +++ b/tests/baselines/reference/exportsAndImports4-es6.js @@ -45,24 +45,24 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.default = "hello"; //// [t3.js] "use strict"; -var a = require("./t1"); +const a = require("./t1"); exports.a = a; a.default; -var t1_1 = require("./t1"); +const t1_1 = require("./t1"); exports.b = t1_1.default; t1_1.default; -var c = require("./t1"); +const c = require("./t1"); exports.c = c; c.default; -var t1_2 = require("./t1"); +const t1_2 = require("./t1"); exports.d = t1_2.default; t1_2.default; -var t1_3 = require("./t1"), e2 = t1_3; +const t1_3 = require("./t1"), e2 = t1_3; exports.e1 = t1_3.default; exports.e2 = e2; t1_3.default; e2.default; -var t1_4 = require("./t1"); +const t1_4 = require("./t1"); exports.f1 = t1_4.default; exports.f2 = t1_4.default; t1_4.default; diff --git a/tests/baselines/reference/exportsAndImportsWithUnderscores1.errors.txt b/tests/baselines/reference/exportsAndImportsWithUnderscores1.errors.txt new file mode 100644 index 00000000000..7a65dd62c2b --- /dev/null +++ b/tests/baselines/reference/exportsAndImportsWithUnderscores1.errors.txt @@ -0,0 +1,18 @@ +tests/cases/conformance/es6/modules/m1.ts(6,5): error TS1005: ',' expected. + + +==== tests/cases/conformance/es6/modules/m1.ts (1 errors) ==== + + var R: any + export default R = { + "__": 20, + "_": 10 + "___": 30 + ~~~~~ +!!! error TS1005: ',' expected. + } + +==== tests/cases/conformance/es6/modules/m2.ts (0 errors) ==== + import R from "./m1"; + const { __, _, ___ } = R; + \ No newline at end of file diff --git a/tests/baselines/reference/exportsAndImportsWithUnderscores1.js b/tests/baselines/reference/exportsAndImportsWithUnderscores1.js new file mode 100644 index 00000000000..d14eab3c251 --- /dev/null +++ b/tests/baselines/reference/exportsAndImportsWithUnderscores1.js @@ -0,0 +1,29 @@ +//// [tests/cases/conformance/es6/modules/exportsAndImportsWithUnderscores1.ts] //// + +//// [m1.ts] + +var R: any +export default R = { + "__": 20, + "_": 10 + "___": 30 +} + +//// [m2.ts] +import R from "./m1"; +const { __, _, ___ } = R; + + +//// [m1.js] +"use strict"; +var R; +exports.__esModule = true; +exports["default"] = R = { + "__": 20, + "_": 10, + "___": 30 +}; +//// [m2.js] +"use strict"; +var m1_1 = require("./m1"); +var __ = m1_1["default"].__, _ = m1_1["default"]._, ___ = m1_1["default"].___; diff --git a/tests/baselines/reference/exportsAndImportsWithUnderscores2.js b/tests/baselines/reference/exportsAndImportsWithUnderscores2.js new file mode 100644 index 00000000000..5d1dcbb9322 --- /dev/null +++ b/tests/baselines/reference/exportsAndImportsWithUnderscores2.js @@ -0,0 +1,27 @@ +//// [tests/cases/conformance/es6/modules/exportsAndImportsWithUnderscores2.ts] //// + +//// [m1.ts] + +var R: any +export default R = { + "__esmodule": true, + "__proto__": {} +} + +//// [m2.ts] +import R from "./m1"; +const { __esmodule, __proto__ } = R; + + +//// [m1.js] +"use strict"; +var R; +exports.__esModule = true; +exports["default"] = R = { + "__esmodule": true, + "__proto__": {} +}; +//// [m2.js] +"use strict"; +var m1_1 = require("./m1"); +var __esmodule = m1_1["default"].__esmodule, __proto__ = m1_1["default"].__proto__; diff --git a/tests/baselines/reference/exportsAndImportsWithUnderscores2.symbols b/tests/baselines/reference/exportsAndImportsWithUnderscores2.symbols new file mode 100644 index 00000000000..d5f5ef17a62 --- /dev/null +++ b/tests/baselines/reference/exportsAndImportsWithUnderscores2.symbols @@ -0,0 +1,21 @@ +=== tests/cases/conformance/es6/modules/m1.ts === + +var R: any +>R : Symbol(R, Decl(m1.ts, 1, 3)) + +export default R = { +>R : Symbol(R, Decl(m1.ts, 1, 3)) + + "__esmodule": true, + "__proto__": {} +} + +=== tests/cases/conformance/es6/modules/m2.ts === +import R from "./m1"; +>R : Symbol(R, Decl(m2.ts, 0, 6)) + +const { __esmodule, __proto__ } = R; +>__esmodule : Symbol(__esmodule, Decl(m2.ts, 1, 7)) +>__proto__ : Symbol(__proto__, Decl(m2.ts, 1, 19)) +>R : Symbol(R, Decl(m2.ts, 0, 6)) + diff --git a/tests/baselines/reference/exportsAndImportsWithUnderscores2.types b/tests/baselines/reference/exportsAndImportsWithUnderscores2.types new file mode 100644 index 00000000000..a684440f5bd --- /dev/null +++ b/tests/baselines/reference/exportsAndImportsWithUnderscores2.types @@ -0,0 +1,26 @@ +=== tests/cases/conformance/es6/modules/m1.ts === + +var R: any +>R : any + +export default R = { +>R = { "__esmodule": true, "__proto__": {}} : { "__esmodule": boolean; "__proto__": {}; } +>R : any +>{ "__esmodule": true, "__proto__": {}} : { "__esmodule": boolean; "__proto__": {}; } + + "__esmodule": true, +>true : boolean + + "__proto__": {} +>{} : {} +} + +=== tests/cases/conformance/es6/modules/m2.ts === +import R from "./m1"; +>R : { "__esmodule": boolean; "__proto__": {}; } + +const { __esmodule, __proto__ } = R; +>__esmodule : boolean +>__proto__ : {} +>R : { "__esmodule": boolean; "__proto__": {}; } + diff --git a/tests/baselines/reference/exportsAndImportsWithUnderscores3.js b/tests/baselines/reference/exportsAndImportsWithUnderscores3.js new file mode 100644 index 00000000000..477f870742d --- /dev/null +++ b/tests/baselines/reference/exportsAndImportsWithUnderscores3.js @@ -0,0 +1,29 @@ +//// [tests/cases/conformance/es6/modules/exportsAndImportsWithUnderscores3.ts] //// + +//// [m1.ts] + +var R: any +export default R = { + "___": 30, + "___hello": 21, + "_hi": 40, +} + +//// [m2.ts] +import R from "./m1"; +const { ___, ___hello, _hi } = R; + + +//// [m1.js] +"use strict"; +var R; +exports.__esModule = true; +exports["default"] = R = { + "___": 30, + "___hello": 21, + "_hi": 40 +}; +//// [m2.js] +"use strict"; +var m1_1 = require("./m1"); +var ___ = m1_1["default"].___, ___hello = m1_1["default"].___hello, _hi = m1_1["default"]._hi; diff --git a/tests/baselines/reference/exportsAndImportsWithUnderscores3.symbols b/tests/baselines/reference/exportsAndImportsWithUnderscores3.symbols new file mode 100644 index 00000000000..cd4ba38e8c9 --- /dev/null +++ b/tests/baselines/reference/exportsAndImportsWithUnderscores3.symbols @@ -0,0 +1,23 @@ +=== tests/cases/conformance/es6/modules/m1.ts === + +var R: any +>R : Symbol(R, Decl(m1.ts, 1, 3)) + +export default R = { +>R : Symbol(R, Decl(m1.ts, 1, 3)) + + "___": 30, + "___hello": 21, + "_hi": 40, +} + +=== tests/cases/conformance/es6/modules/m2.ts === +import R from "./m1"; +>R : Symbol(R, Decl(m2.ts, 0, 6)) + +const { ___, ___hello, _hi } = R; +>___ : Symbol(___, Decl(m2.ts, 1, 7)) +>___hello : Symbol(___hello, Decl(m2.ts, 1, 12)) +>_hi : Symbol(_hi, Decl(m2.ts, 1, 22)) +>R : Symbol(R, Decl(m2.ts, 0, 6)) + diff --git a/tests/baselines/reference/exportsAndImportsWithUnderscores3.types b/tests/baselines/reference/exportsAndImportsWithUnderscores3.types new file mode 100644 index 00000000000..5addb44172d --- /dev/null +++ b/tests/baselines/reference/exportsAndImportsWithUnderscores3.types @@ -0,0 +1,30 @@ +=== tests/cases/conformance/es6/modules/m1.ts === + +var R: any +>R : any + +export default R = { +>R = { "___": 30, "___hello": 21, "_hi": 40,} : { "___": number; "___hello": number; "_hi": number; } +>R : any +>{ "___": 30, "___hello": 21, "_hi": 40,} : { "___": number; "___hello": number; "_hi": number; } + + "___": 30, +>30 : number + + "___hello": 21, +>21 : number + + "_hi": 40, +>40 : number +} + +=== tests/cases/conformance/es6/modules/m2.ts === +import R from "./m1"; +>R : { "___": number; "___hello": number; "_hi": number; } + +const { ___, ___hello, _hi } = R; +>___ : number +>___hello : number +>_hi : number +>R : { "___": number; "___hello": number; "_hi": number; } + diff --git a/tests/baselines/reference/exportsAndImportsWithUnderscores4.js b/tests/baselines/reference/exportsAndImportsWithUnderscores4.js new file mode 100644 index 00000000000..22cd7c2e71a --- /dev/null +++ b/tests/baselines/reference/exportsAndImportsWithUnderscores4.js @@ -0,0 +1,75 @@ +//// [tests/cases/conformance/es6/modules/exportsAndImportsWithUnderscores4.ts] //// + +//// [m1.ts] + +declare var console: any; +export function _() { + console.log("_"); +} +export function __() { + console.log("__"); +} +export function ___() { + console.log("___"); +} +export function _hi() { + console.log("_hi"); +} +export function __proto() { + console.log("__proto"); +} +export function __esmodule() { + console.log("__esmodule"); +} +export function ___hello(){ + console.log("___hello"); +} + +//// [m2.ts] +import {_, __, ___hello, __esmodule, __proto, _hi} from "./m1"; +_(); +__(); +___hello(); +__esmodule(); +__proto(); +_hi(); + +//// [m1.js] +"use strict"; +function _() { + console.log("_"); +} +exports._ = _; +function __() { + console.log("__"); +} +exports.__ = __; +function ___() { + console.log("___"); +} +exports.___ = ___; +function _hi() { + console.log("_hi"); +} +exports._hi = _hi; +function __proto() { + console.log("__proto"); +} +exports.__proto = __proto; +function __esmodule() { + console.log("__esmodule"); +} +exports.__esmodule = __esmodule; +function ___hello() { + console.log("___hello"); +} +exports.___hello = ___hello; +//// [m2.js] +"use strict"; +var m1_1 = require("./m1"); +m1_1._(); +m1_1.__(); +m1_1.___hello(); +m1_1.__esmodule(); +m1_1.__proto(); +m1_1._hi(); diff --git a/tests/baselines/reference/exportsAndImportsWithUnderscores4.symbols b/tests/baselines/reference/exportsAndImportsWithUnderscores4.symbols new file mode 100644 index 00000000000..a8fb3f307b5 --- /dev/null +++ b/tests/baselines/reference/exportsAndImportsWithUnderscores4.symbols @@ -0,0 +1,75 @@ +=== tests/cases/conformance/es6/modules/m1.ts === + +declare var console: any; +>console : Symbol(console, Decl(m1.ts, 1, 11)) + +export function _() { +>_ : Symbol(_, Decl(m1.ts, 1, 25)) + + console.log("_"); +>console : Symbol(console, Decl(m1.ts, 1, 11)) +} +export function __() { +>__ : Symbol(__, Decl(m1.ts, 4, 1)) + + console.log("__"); +>console : Symbol(console, Decl(m1.ts, 1, 11)) +} +export function ___() { +>___ : Symbol(___, Decl(m1.ts, 7, 1)) + + console.log("___"); +>console : Symbol(console, Decl(m1.ts, 1, 11)) +} +export function _hi() { +>_hi : Symbol(_hi, Decl(m1.ts, 10, 1)) + + console.log("_hi"); +>console : Symbol(console, Decl(m1.ts, 1, 11)) +} +export function __proto() { +>__proto : Symbol(__proto, Decl(m1.ts, 13, 1)) + + console.log("__proto"); +>console : Symbol(console, Decl(m1.ts, 1, 11)) +} +export function __esmodule() { +>__esmodule : Symbol(__esmodule, Decl(m1.ts, 16, 1)) + + console.log("__esmodule"); +>console : Symbol(console, Decl(m1.ts, 1, 11)) +} +export function ___hello(){ +>___hello : Symbol(___hello, Decl(m1.ts, 19, 1)) + + console.log("___hello"); +>console : Symbol(console, Decl(m1.ts, 1, 11)) +} + +=== tests/cases/conformance/es6/modules/m2.ts === +import {_, __, ___hello, __esmodule, __proto, _hi} from "./m1"; +>_ : Symbol(_, Decl(m2.ts, 0, 8)) +>__ : Symbol(__, Decl(m2.ts, 0, 10)) +>___hello : Symbol(___hello, Decl(m2.ts, 0, 14)) +>__esmodule : Symbol(__esmodule, Decl(m2.ts, 0, 24)) +>__proto : Symbol(__proto, Decl(m2.ts, 0, 36)) +>_hi : Symbol(_hi, Decl(m2.ts, 0, 45)) + +_(); +>_ : Symbol(_, Decl(m2.ts, 0, 8)) + +__(); +>__ : Symbol(__, Decl(m2.ts, 0, 10)) + +___hello(); +>___hello : Symbol(___hello, Decl(m2.ts, 0, 14)) + +__esmodule(); +>__esmodule : Symbol(__esmodule, Decl(m2.ts, 0, 24)) + +__proto(); +>__proto : Symbol(__proto, Decl(m2.ts, 0, 36)) + +_hi(); +>_hi : Symbol(_hi, Decl(m2.ts, 0, 45)) + diff --git a/tests/baselines/reference/exportsAndImportsWithUnderscores4.types b/tests/baselines/reference/exportsAndImportsWithUnderscores4.types new file mode 100644 index 00000000000..a9042042285 --- /dev/null +++ b/tests/baselines/reference/exportsAndImportsWithUnderscores4.types @@ -0,0 +1,109 @@ +=== tests/cases/conformance/es6/modules/m1.ts === + +declare var console: any; +>console : any + +export function _() { +>_ : () => void + + console.log("_"); +>console.log("_") : any +>console.log : any +>console : any +>log : any +>"_" : string +} +export function __() { +>__ : () => void + + console.log("__"); +>console.log("__") : any +>console.log : any +>console : any +>log : any +>"__" : string +} +export function ___() { +>___ : () => void + + console.log("___"); +>console.log("___") : any +>console.log : any +>console : any +>log : any +>"___" : string +} +export function _hi() { +>_hi : () => void + + console.log("_hi"); +>console.log("_hi") : any +>console.log : any +>console : any +>log : any +>"_hi" : string +} +export function __proto() { +>__proto : () => void + + console.log("__proto"); +>console.log("__proto") : any +>console.log : any +>console : any +>log : any +>"__proto" : string +} +export function __esmodule() { +>__esmodule : () => void + + console.log("__esmodule"); +>console.log("__esmodule") : any +>console.log : any +>console : any +>log : any +>"__esmodule" : string +} +export function ___hello(){ +>___hello : () => void + + console.log("___hello"); +>console.log("___hello") : any +>console.log : any +>console : any +>log : any +>"___hello" : string +} + +=== tests/cases/conformance/es6/modules/m2.ts === +import {_, __, ___hello, __esmodule, __proto, _hi} from "./m1"; +>_ : () => void +>__ : () => void +>___hello : () => void +>__esmodule : () => void +>__proto : () => void +>_hi : () => void + +_(); +>_() : void +>_ : () => void + +__(); +>__() : void +>__ : () => void + +___hello(); +>___hello() : void +>___hello : () => void + +__esmodule(); +>__esmodule() : void +>__esmodule : () => void + +__proto(); +>__proto() : void +>__proto : () => void + +_hi(); +>_hi() : void +>_hi : () => void + diff --git a/tests/baselines/reference/extBaseClass1.symbols b/tests/baselines/reference/extBaseClass1.symbols index 416fa910f31..cf7781df07d 100644 --- a/tests/baselines/reference/extBaseClass1.symbols +++ b/tests/baselines/reference/extBaseClass1.symbols @@ -6,7 +6,7 @@ module M { >B : Symbol(B, Decl(extBaseClass1.ts, 0, 10)) public x=10; ->x : Symbol(x, Decl(extBaseClass1.ts, 1, 20)) +>x : Symbol(B.x, Decl(extBaseClass1.ts, 1, 20)) } export class C extends B { diff --git a/tests/baselines/reference/extendAndImplementTheSameBaseType.symbols b/tests/baselines/reference/extendAndImplementTheSameBaseType.symbols index c211fa4955b..45f25090af8 100644 --- a/tests/baselines/reference/extendAndImplementTheSameBaseType.symbols +++ b/tests/baselines/reference/extendAndImplementTheSameBaseType.symbols @@ -3,10 +3,10 @@ class C { >C : Symbol(C, Decl(extendAndImplementTheSameBaseType.ts, 0, 0)) foo: number ->foo : Symbol(foo, Decl(extendAndImplementTheSameBaseType.ts, 0, 9)) +>foo : Symbol(C.foo, Decl(extendAndImplementTheSameBaseType.ts, 0, 9)) bar() {} ->bar : Symbol(bar, Decl(extendAndImplementTheSameBaseType.ts, 1, 15)) +>bar : Symbol(C.bar, Decl(extendAndImplementTheSameBaseType.ts, 1, 15)) } class D extends C implements C { >D : Symbol(D, Decl(extendAndImplementTheSameBaseType.ts, 3, 1)) @@ -14,7 +14,7 @@ class D extends C implements C { >C : Symbol(C, Decl(extendAndImplementTheSameBaseType.ts, 0, 0)) baz() { } ->baz : Symbol(baz, Decl(extendAndImplementTheSameBaseType.ts, 4, 32)) +>baz : Symbol(D.baz, Decl(extendAndImplementTheSameBaseType.ts, 4, 32)) } var c: C; diff --git a/tests/baselines/reference/extendBaseClassBeforeItsDeclared.symbols b/tests/baselines/reference/extendBaseClassBeforeItsDeclared.symbols index 88aca935113..ab122b43c90 100644 --- a/tests/baselines/reference/extendBaseClassBeforeItsDeclared.symbols +++ b/tests/baselines/reference/extendBaseClassBeforeItsDeclared.symbols @@ -5,5 +5,5 @@ class derived extends base { } class base { constructor (public n: number) { } } >base : Symbol(base, Decl(extendBaseClassBeforeItsDeclared.ts, 0, 30)) ->n : Symbol(n, Decl(extendBaseClassBeforeItsDeclared.ts, 2, 26)) +>n : Symbol(base.n, Decl(extendBaseClassBeforeItsDeclared.ts, 2, 26)) diff --git a/tests/baselines/reference/extendBooleanInterface.symbols b/tests/baselines/reference/extendBooleanInterface.symbols index be2fb30226d..9ae4c46e3c7 100644 --- a/tests/baselines/reference/extendBooleanInterface.symbols +++ b/tests/baselines/reference/extendBooleanInterface.symbols @@ -3,10 +3,10 @@ interface Boolean { >Boolean : Symbol(Boolean, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(extendBooleanInterface.ts, 0, 0)) doStuff(): string; ->doStuff : Symbol(doStuff, Decl(extendBooleanInterface.ts, 0, 19)) +>doStuff : Symbol(Boolean.doStuff, Decl(extendBooleanInterface.ts, 0, 19)) doOtherStuff(x: T): T; ->doOtherStuff : Symbol(doOtherStuff, Decl(extendBooleanInterface.ts, 1, 22)) +>doOtherStuff : Symbol(Boolean.doOtherStuff, Decl(extendBooleanInterface.ts, 1, 22)) >T : Symbol(T, Decl(extendBooleanInterface.ts, 2, 17)) >x : Symbol(x, Decl(extendBooleanInterface.ts, 2, 20)) >T : Symbol(T, Decl(extendBooleanInterface.ts, 2, 17)) diff --git a/tests/baselines/reference/extendNonClassSymbol1.symbols b/tests/baselines/reference/extendNonClassSymbol1.symbols index 7c03ef3a97f..2b171308823 100644 --- a/tests/baselines/reference/extendNonClassSymbol1.symbols +++ b/tests/baselines/reference/extendNonClassSymbol1.symbols @@ -1,7 +1,7 @@ === tests/cases/compiler/extendNonClassSymbol1.ts === class A { foo() { } } >A : Symbol(A, Decl(extendNonClassSymbol1.ts, 0, 0)) ->foo : Symbol(foo, Decl(extendNonClassSymbol1.ts, 0, 9)) +>foo : Symbol(A.foo, Decl(extendNonClassSymbol1.ts, 0, 9)) var x = A; >x : Symbol(x, Decl(extendNonClassSymbol1.ts, 1, 3)) diff --git a/tests/baselines/reference/extendNumberInterface.symbols b/tests/baselines/reference/extendNumberInterface.symbols index 218f0f41cb2..febe4993e2a 100644 --- a/tests/baselines/reference/extendNumberInterface.symbols +++ b/tests/baselines/reference/extendNumberInterface.symbols @@ -1,12 +1,12 @@ === tests/cases/conformance/types/primitives/number/extendNumberInterface.ts === interface Number { ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(extendNumberInterface.ts, 0, 0)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(extendNumberInterface.ts, 0, 0)) doStuff(): string; ->doStuff : Symbol(doStuff, Decl(extendNumberInterface.ts, 0, 18)) +>doStuff : Symbol(Number.doStuff, Decl(extendNumberInterface.ts, 0, 18)) doOtherStuff(x:T): T; ->doOtherStuff : Symbol(doOtherStuff, Decl(extendNumberInterface.ts, 1, 22)) +>doOtherStuff : Symbol(Number.doOtherStuff, Decl(extendNumberInterface.ts, 1, 22)) >T : Symbol(T, Decl(extendNumberInterface.ts, 2, 17)) >x : Symbol(x, Decl(extendNumberInterface.ts, 2, 20)) >T : Symbol(T, Decl(extendNumberInterface.ts, 2, 17)) diff --git a/tests/baselines/reference/extendStringInterface.symbols b/tests/baselines/reference/extendStringInterface.symbols index aa20b2e2c15..67773fa30bd 100644 --- a/tests/baselines/reference/extendStringInterface.symbols +++ b/tests/baselines/reference/extendStringInterface.symbols @@ -1,12 +1,12 @@ === tests/cases/conformance/types/primitives/string/extendStringInterface.ts === interface String { ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(extendStringInterface.ts, 0, 0)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(extendStringInterface.ts, 0, 0)) doStuff(): string; ->doStuff : Symbol(doStuff, Decl(extendStringInterface.ts, 0, 18)) +>doStuff : Symbol(String.doStuff, Decl(extendStringInterface.ts, 0, 18)) doOtherStuff(x:T): T; ->doOtherStuff : Symbol(doOtherStuff, Decl(extendStringInterface.ts, 1, 22)) +>doOtherStuff : Symbol(String.doOtherStuff, Decl(extendStringInterface.ts, 1, 22)) >T : Symbol(T, Decl(extendStringInterface.ts, 2, 17)) >x : Symbol(x, Decl(extendStringInterface.ts, 2, 20)) >T : Symbol(T, Decl(extendStringInterface.ts, 2, 17)) diff --git a/tests/baselines/reference/extendedInterfaceGenericType.symbols b/tests/baselines/reference/extendedInterfaceGenericType.symbols index 47e17b1e6a1..334981bc56d 100644 --- a/tests/baselines/reference/extendedInterfaceGenericType.symbols +++ b/tests/baselines/reference/extendedInterfaceGenericType.symbols @@ -4,14 +4,14 @@ interface Alpha { >T : Symbol(T, Decl(extendedInterfaceGenericType.ts, 0, 16)) takesArgOfT(arg: T): Alpha; ->takesArgOfT : Symbol(takesArgOfT, Decl(extendedInterfaceGenericType.ts, 0, 20)) +>takesArgOfT : Symbol(Alpha.takesArgOfT, Decl(extendedInterfaceGenericType.ts, 0, 20)) >arg : Symbol(arg, Decl(extendedInterfaceGenericType.ts, 1, 16)) >T : Symbol(T, Decl(extendedInterfaceGenericType.ts, 0, 16)) >Alpha : Symbol(Alpha, Decl(extendedInterfaceGenericType.ts, 0, 0)) >T : Symbol(T, Decl(extendedInterfaceGenericType.ts, 0, 16)) makeBetaOfNumber(): Beta; ->makeBetaOfNumber : Symbol(makeBetaOfNumber, Decl(extendedInterfaceGenericType.ts, 1, 34)) +>makeBetaOfNumber : Symbol(Alpha.makeBetaOfNumber, Decl(extendedInterfaceGenericType.ts, 1, 34)) >Beta : Symbol(Beta, Decl(extendedInterfaceGenericType.ts, 3, 1)) } interface Beta extends Alpha { diff --git a/tests/baselines/reference/extendedInterfacesWithDuplicateTypeParameters.errors.txt b/tests/baselines/reference/extendedInterfacesWithDuplicateTypeParameters.errors.txt index 7d7fea1b2c6..7b47fee05af 100644 --- a/tests/baselines/reference/extendedInterfacesWithDuplicateTypeParameters.errors.txt +++ b/tests/baselines/reference/extendedInterfacesWithDuplicateTypeParameters.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/extendedInterfacesWithDuplicateTypeParameters.ts(1,42): error TS2300: Duplicate identifier 'A'. -tests/cases/compiler/extendedInterfacesWithDuplicateTypeParameters.ts(9,11): error TS2428: All declarations of an interface must have identical type parameters. +tests/cases/compiler/extendedInterfacesWithDuplicateTypeParameters.ts(9,11): error TS2428: All declarations of 'InterfaceWithSomeTypars' must have identical type parameters. tests/cases/compiler/extendedInterfacesWithDuplicateTypeParameters.ts(9,38): error TS2300: Duplicate identifier 'C'. @@ -16,7 +16,7 @@ tests/cases/compiler/extendedInterfacesWithDuplicateTypeParameters.ts(9,38): err interface InterfaceWithSomeTypars { // should error ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2428: All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations of 'InterfaceWithSomeTypars' must have identical type parameters. ~ !!! error TS2300: Duplicate identifier 'C'. bar2(): void; diff --git a/tests/baselines/reference/extendingClassFromAliasAndUsageInIndexer.symbols b/tests/baselines/reference/extendingClassFromAliasAndUsageInIndexer.symbols index 33e0c226e67..fcf5a71330a 100644 --- a/tests/baselines/reference/extendingClassFromAliasAndUsageInIndexer.symbols +++ b/tests/baselines/reference/extendingClassFromAliasAndUsageInIndexer.symbols @@ -12,7 +12,7 @@ interface IHasVisualizationModel { >IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(extendingClassFromAliasAndUsageInIndexer_main.ts, 2, 79)) VisualizationModel: typeof Backbone.Model; ->VisualizationModel : Symbol(VisualizationModel, Decl(extendingClassFromAliasAndUsageInIndexer_main.ts, 3, 34)) +>VisualizationModel : Symbol(IHasVisualizationModel.VisualizationModel, Decl(extendingClassFromAliasAndUsageInIndexer_main.ts, 3, 34)) >Backbone.Model : Symbol(Backbone.Model, Decl(extendingClassFromAliasAndUsageInIndexer_backbone.ts, 0, 0)) >Backbone : Symbol(Backbone, Decl(extendingClassFromAliasAndUsageInIndexer_main.ts, 0, 0)) >Model : Symbol(Backbone.Model, Decl(extendingClassFromAliasAndUsageInIndexer_backbone.ts, 0, 0)) @@ -49,7 +49,7 @@ export class Model { >Model : Symbol(Model, Decl(extendingClassFromAliasAndUsageInIndexer_backbone.ts, 0, 0)) public someData: string; ->someData : Symbol(someData, Decl(extendingClassFromAliasAndUsageInIndexer_backbone.ts, 0, 20)) +>someData : Symbol(Model.someData, Decl(extendingClassFromAliasAndUsageInIndexer_backbone.ts, 0, 20)) } === tests/cases/compiler/extendingClassFromAliasAndUsageInIndexer_moduleA.ts === diff --git a/tests/baselines/reference/extendingClassFromAliasAndUsageInIndexer.types b/tests/baselines/reference/extendingClassFromAliasAndUsageInIndexer.types index e1bfd195698..9825a75a220 100644 --- a/tests/baselines/reference/extendingClassFromAliasAndUsageInIndexer.types +++ b/tests/baselines/reference/extendingClassFromAliasAndUsageInIndexer.types @@ -26,7 +26,7 @@ var moduleMap: { [key: string]: IHasVisualizationModel } = { >moduleMap : { [key: string]: IHasVisualizationModel; } >key : string >IHasVisualizationModel : IHasVisualizationModel ->{ "moduleA": moduleA, "moduleB": moduleB} : { [x: string]: typeof moduleA; "moduleA": typeof moduleA; "moduleB": typeof moduleB; } +>{ "moduleA": moduleA, "moduleB": moduleB} : { "moduleA": typeof moduleA; "moduleB": typeof moduleB; } "moduleA": moduleA, >moduleA : typeof moduleA diff --git a/tests/baselines/reference/externModuleClobber.symbols b/tests/baselines/reference/externModuleClobber.symbols index af4b19ad7c9..ad965a15879 100644 --- a/tests/baselines/reference/externModuleClobber.symbols +++ b/tests/baselines/reference/externModuleClobber.symbols @@ -9,7 +9,7 @@ declare module EM { >EC : Symbol(EC, Decl(externModuleClobber.ts, 1, 26)) public getPosition() : EM.Position; ->getPosition : Symbol(getPosition, Decl(externModuleClobber.ts, 3, 18)) +>getPosition : Symbol(EC.getPosition, Decl(externModuleClobber.ts, 3, 18)) >EM : Symbol(EM, Decl(externModuleClobber.ts, 0, 0)) >Position : Symbol(Position, Decl(externModuleClobber.ts, 0, 19)) } diff --git a/tests/baselines/reference/externalModuleAssignToVar.symbols b/tests/baselines/reference/externalModuleAssignToVar.symbols index 373dd3f793e..9e049b0bda6 100644 --- a/tests/baselines/reference/externalModuleAssignToVar.symbols +++ b/tests/baselines/reference/externalModuleAssignToVar.symbols @@ -41,7 +41,7 @@ y3 = ext3; // ok === tests/cases/compiler/externalModuleAssignToVar_ext.ts === class D { foo: string; } >D : Symbol(D, Decl(externalModuleAssignToVar_ext.ts, 0, 0)) ->foo : Symbol(foo, Decl(externalModuleAssignToVar_ext.ts, 0, 9)) +>foo : Symbol(D.foo, Decl(externalModuleAssignToVar_ext.ts, 0, 9)) export = D; >D : Symbol(D, Decl(externalModuleAssignToVar_ext.ts, 0, 0)) @@ -49,12 +49,12 @@ export = D; === tests/cases/compiler/externalModuleAssignToVar_core_require.ts === export class C { bar: string; } >C : Symbol(C, Decl(externalModuleAssignToVar_core_require.ts, 0, 0)) ->bar : Symbol(bar, Decl(externalModuleAssignToVar_core_require.ts, 0, 16)) +>bar : Symbol(C.bar, Decl(externalModuleAssignToVar_core_require.ts, 0, 16)) === tests/cases/compiler/externalModuleAssignToVar_core_require2.ts === class C { baz: string; } >C : Symbol(C, Decl(externalModuleAssignToVar_core_require2.ts, 0, 0)) ->baz : Symbol(baz, Decl(externalModuleAssignToVar_core_require2.ts, 0, 9)) +>baz : Symbol(C.baz, Decl(externalModuleAssignToVar_core_require2.ts, 0, 9)) export = C; >C : Symbol(C, Decl(externalModuleAssignToVar_core_require2.ts, 0, 0)) diff --git a/tests/baselines/reference/externalModuleImmutableBindings.errors.txt b/tests/baselines/reference/externalModuleImmutableBindings.errors.txt index a6040c154f0..c8c61b2dc81 100644 --- a/tests/baselines/reference/externalModuleImmutableBindings.errors.txt +++ b/tests/baselines/reference/externalModuleImmutableBindings.errors.txt @@ -1,11 +1,23 @@ +tests/cases/compiler/f2.ts(7,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. +tests/cases/compiler/f2.ts(8,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. tests/cases/compiler/f2.ts(9,7): error TS2339: Property 'blah' does not exist on type 'typeof "tests/cases/compiler/f1"'. +tests/cases/compiler/f2.ts(12,1): error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property. +tests/cases/compiler/f2.ts(13,1): error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property. +tests/cases/compiler/f2.ts(17,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. +tests/cases/compiler/f2.ts(18,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. tests/cases/compiler/f2.ts(19,8): error TS2339: Property 'blah' does not exist on type 'typeof "tests/cases/compiler/f1"'. +tests/cases/compiler/f2.ts(22,1): error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property. +tests/cases/compiler/f2.ts(23,1): error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property. tests/cases/compiler/f2.ts(27,6): error TS2405: The left-hand side of a 'for...in' statement must be of type 'string' or 'any'. +tests/cases/compiler/f2.ts(28,6): error TS2485: The left-hand side of a 'for...of' statement cannot be a constant or a read-only property. tests/cases/compiler/f2.ts(29,6): error TS2405: The left-hand side of a 'for...in' statement must be of type 'string' or 'any'. +tests/cases/compiler/f2.ts(30,6): error TS2485: The left-hand side of a 'for...of' statement cannot be a constant or a read-only property. tests/cases/compiler/f2.ts(31,12): error TS2339: Property 'blah' does not exist on type 'typeof "tests/cases/compiler/f1"'. tests/cases/compiler/f2.ts(32,12): error TS2339: Property 'blah' does not exist on type 'typeof "tests/cases/compiler/f1"'. tests/cases/compiler/f2.ts(36,6): error TS2405: The left-hand side of a 'for...in' statement must be of type 'string' or 'any'. +tests/cases/compiler/f2.ts(37,6): error TS2485: The left-hand side of a 'for...of' statement cannot be a constant or a read-only property. tests/cases/compiler/f2.ts(38,6): error TS2405: The left-hand side of a 'for...in' statement must be of type 'string' or 'any'. +tests/cases/compiler/f2.ts(39,6): error TS2485: The left-hand side of a 'for...of' statement cannot be a constant or a read-only property. tests/cases/compiler/f2.ts(40,13): error TS2339: Property 'blah' does not exist on type 'typeof "tests/cases/compiler/f1"'. tests/cases/compiler/f2.ts(41,13): error TS2339: Property 'blah' does not exist on type 'typeof "tests/cases/compiler/f1"'. @@ -13,7 +25,7 @@ tests/cases/compiler/f2.ts(41,13): error TS2339: Property 'blah' does not exist ==== tests/cases/compiler/f1.ts (0 errors) ==== export var x = 1; -==== tests/cases/compiler/f2.ts (10 errors) ==== +==== tests/cases/compiler/f2.ts (22 errors) ==== // all mutations below are illegal and should be fixed import * as stuff from './f1'; @@ -21,26 +33,42 @@ tests/cases/compiler/f2.ts(41,13): error TS2339: Property 'blah' does not exist var n = 'baz'; stuff.x = 0; + ~~~~~~~ +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. stuff['x'] = 1; + ~~~~~~~~~~ +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. stuff.blah = 2; ~~~~ !!! error TS2339: Property 'blah' does not exist on type 'typeof "tests/cases/compiler/f1"'. stuff[n] = 3; stuff.x++; + ~~~~~~~ +!!! error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property. stuff['x']++; + ~~~~~~~~~~ +!!! error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property. stuff['blah']++; stuff[n]++; (stuff.x) = 0; + ~~~~~~~~~ +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. (stuff['x']) = 1; + ~~~~~~~~~~~~ +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. (stuff.blah) = 2; ~~~~ !!! error TS2339: Property 'blah' does not exist on type 'typeof "tests/cases/compiler/f1"'. (stuff[n]) = 3; (stuff.x)++; + ~~~~~~~~~ +!!! error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property. (stuff['x'])++; + ~~~~~~~~~~~~ +!!! error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property. (stuff['blah'])++; (stuff[n])++; @@ -48,10 +76,14 @@ tests/cases/compiler/f2.ts(41,13): error TS2339: Property 'blah' does not exist ~~~~~~~ !!! error TS2405: The left-hand side of a 'for...in' statement must be of type 'string' or 'any'. for (stuff.x of []) {} + ~~~~~~~ +!!! error TS2485: The left-hand side of a 'for...of' statement cannot be a constant or a read-only property. for (stuff['x'] in []) {} ~~~~~~~~~~ !!! error TS2405: The left-hand side of a 'for...in' statement must be of type 'string' or 'any'. for (stuff['x'] of []) {} + ~~~~~~~~~~ +!!! error TS2485: The left-hand side of a 'for...of' statement cannot be a constant or a read-only property. for (stuff.blah in []) {} ~~~~ !!! error TS2339: Property 'blah' does not exist on type 'typeof "tests/cases/compiler/f1"'. @@ -65,10 +97,14 @@ tests/cases/compiler/f2.ts(41,13): error TS2339: Property 'blah' does not exist ~~~~~~~~~ !!! error TS2405: The left-hand side of a 'for...in' statement must be of type 'string' or 'any'. for ((stuff.x) of []) {} + ~~~~~~~~~ +!!! error TS2485: The left-hand side of a 'for...of' statement cannot be a constant or a read-only property. for ((stuff['x']) in []) {} ~~~~~~~~~~~~ !!! error TS2405: The left-hand side of a 'for...in' statement must be of type 'string' or 'any'. for ((stuff['x']) of []) {} + ~~~~~~~~~~~~ +!!! error TS2485: The left-hand side of a 'for...of' statement cannot be a constant or a read-only property. for ((stuff.blah) in []) {} ~~~~ !!! error TS2339: Property 'blah' does not exist on type 'typeof "tests/cases/compiler/f1"'. diff --git a/tests/baselines/reference/externalModuleQualification.symbols b/tests/baselines/reference/externalModuleQualification.symbols index dc056802c76..002a680a610 100644 --- a/tests/baselines/reference/externalModuleQualification.symbols +++ b/tests/baselines/reference/externalModuleQualification.symbols @@ -9,7 +9,7 @@ export class DiffEditor { >C : Symbol(C, Decl(externalModuleQualification.ts, 1, 29)) private previousDiffAction: NavigateAction; ->previousDiffAction : Symbol(previousDiffAction, Decl(externalModuleQualification.ts, 1, 34)) +>previousDiffAction : Symbol(DiffEditor.previousDiffAction, Decl(externalModuleQualification.ts, 1, 34)) >NavigateAction : Symbol(NavigateAction, Decl(externalModuleQualification.ts, 5, 1)) constructor(id: string = ID) { @@ -21,7 +21,7 @@ class NavigateAction { >NavigateAction : Symbol(NavigateAction, Decl(externalModuleQualification.ts, 5, 1)) f(editor: DiffEditor) { ->f : Symbol(f, Decl(externalModuleQualification.ts, 6, 22)) +>f : Symbol(NavigateAction.f, Decl(externalModuleQualification.ts, 6, 22)) >editor : Symbol(editor, Decl(externalModuleQualification.ts, 7, 6)) >DiffEditor : Symbol(DiffEditor, Decl(externalModuleQualification.ts, 0, 23)) } diff --git a/tests/baselines/reference/externalModuleWithoutCompilerFlag1.errors.txt b/tests/baselines/reference/externalModuleWithoutCompilerFlag1.errors.txt deleted file mode 100644 index e2ffd4ec372..00000000000 --- a/tests/baselines/reference/externalModuleWithoutCompilerFlag1.errors.txt +++ /dev/null @@ -1,10 +0,0 @@ -tests/cases/compiler/externalModuleWithoutCompilerFlag1.ts(3,17): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. - - -==== tests/cases/compiler/externalModuleWithoutCompilerFlag1.ts (1 errors) ==== - - // Not on line 0 because we want to verify the error is placed in the appropriate location. - export module M { - ~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. - } \ No newline at end of file diff --git a/tests/baselines/reference/externalModuleWithoutCompilerFlag1.symbols b/tests/baselines/reference/externalModuleWithoutCompilerFlag1.symbols new file mode 100644 index 00000000000..21426e15e5d --- /dev/null +++ b/tests/baselines/reference/externalModuleWithoutCompilerFlag1.symbols @@ -0,0 +1,6 @@ +=== tests/cases/compiler/externalModuleWithoutCompilerFlag1.ts === + +// Not on line 0 because we want to verify the error is placed in the appropriate location. + export module M { +>M : Symbol(M, Decl(externalModuleWithoutCompilerFlag1.ts, 0, 0)) +} diff --git a/tests/baselines/reference/externalModuleWithoutCompilerFlag1.types b/tests/baselines/reference/externalModuleWithoutCompilerFlag1.types new file mode 100644 index 00000000000..26d360d63a9 --- /dev/null +++ b/tests/baselines/reference/externalModuleWithoutCompilerFlag1.types @@ -0,0 +1,6 @@ +=== tests/cases/compiler/externalModuleWithoutCompilerFlag1.ts === + +// Not on line 0 because we want to verify the error is placed in the appropriate location. + export module M { +>M : any +} diff --git a/tests/baselines/reference/fallFromLastCase1.js b/tests/baselines/reference/fallFromLastCase1.js new file mode 100644 index 00000000000..3c2461db514 --- /dev/null +++ b/tests/baselines/reference/fallFromLastCase1.js @@ -0,0 +1,44 @@ +//// [fallFromLastCase1.ts] + +declare function use(a: string); + +function foo1(a: number) { + switch (a) { + case 1: + use("1"); + break; + case 2: + use("2"); + } +} + + +function foo2(a: number) { + switch (a) { + case 1: + use("1"); + break; + default: + use("2"); + } +} + +//// [fallFromLastCase1.js] +function foo1(a) { + switch (a) { + case 1: + use("1"); + break; + case 2: + use("2"); + } +} +function foo2(a) { + switch (a) { + case 1: + use("1"); + break; + default: + use("2"); + } +} diff --git a/tests/baselines/reference/fallFromLastCase1.symbols b/tests/baselines/reference/fallFromLastCase1.symbols new file mode 100644 index 00000000000..c4967e5e775 --- /dev/null +++ b/tests/baselines/reference/fallFromLastCase1.symbols @@ -0,0 +1,42 @@ +=== tests/cases/compiler/fallFromLastCase1.ts === + +declare function use(a: string); +>use : Symbol(use, Decl(fallFromLastCase1.ts, 0, 0)) +>a : Symbol(a, Decl(fallFromLastCase1.ts, 1, 21)) + +function foo1(a: number) { +>foo1 : Symbol(foo1, Decl(fallFromLastCase1.ts, 1, 32)) +>a : Symbol(a, Decl(fallFromLastCase1.ts, 3, 14)) + + switch (a) { +>a : Symbol(a, Decl(fallFromLastCase1.ts, 3, 14)) + + case 1: + use("1"); +>use : Symbol(use, Decl(fallFromLastCase1.ts, 0, 0)) + + break; + case 2: + use("2"); +>use : Symbol(use, Decl(fallFromLastCase1.ts, 0, 0)) + } +} + + +function foo2(a: number) { +>foo2 : Symbol(foo2, Decl(fallFromLastCase1.ts, 11, 1)) +>a : Symbol(a, Decl(fallFromLastCase1.ts, 14, 14)) + + switch (a) { +>a : Symbol(a, Decl(fallFromLastCase1.ts, 14, 14)) + + case 1: + use("1"); +>use : Symbol(use, Decl(fallFromLastCase1.ts, 0, 0)) + + break; + default: + use("2"); +>use : Symbol(use, Decl(fallFromLastCase1.ts, 0, 0)) + } +} diff --git a/tests/baselines/reference/fallFromLastCase1.types b/tests/baselines/reference/fallFromLastCase1.types new file mode 100644 index 00000000000..47e444ee17d --- /dev/null +++ b/tests/baselines/reference/fallFromLastCase1.types @@ -0,0 +1,56 @@ +=== tests/cases/compiler/fallFromLastCase1.ts === + +declare function use(a: string); +>use : (a: string) => any +>a : string + +function foo1(a: number) { +>foo1 : (a: number) => void +>a : number + + switch (a) { +>a : number + + case 1: +>1 : number + + use("1"); +>use("1") : any +>use : (a: string) => any +>"1" : string + + break; + case 2: +>2 : number + + use("2"); +>use("2") : any +>use : (a: string) => any +>"2" : string + } +} + + +function foo2(a: number) { +>foo2 : (a: number) => void +>a : number + + switch (a) { +>a : number + + case 1: +>1 : number + + use("1"); +>use("1") : any +>use : (a: string) => any +>"1" : string + + break; + default: + use("2"); +>use("2") : any +>use : (a: string) => any +>"2" : string + } +} diff --git a/tests/baselines/reference/fallFromLastCase2.errors.txt b/tests/baselines/reference/fallFromLastCase2.errors.txt new file mode 100644 index 00000000000..ccf7f6ebc1b --- /dev/null +++ b/tests/baselines/reference/fallFromLastCase2.errors.txt @@ -0,0 +1,36 @@ +tests/cases/compiler/fallFromLastCase2.ts(9,9): error TS7029: Fallthrough case in switch. +tests/cases/compiler/fallFromLastCase2.ts(22,9): error TS7029: Fallthrough case in switch. + + +==== tests/cases/compiler/fallFromLastCase2.ts (2 errors) ==== + + declare function use(a: string); + + function foo1(a: number) { + switch (a) { + case 1: + use("1"); + break; + case 2: + ~~~~ +!!! error TS7029: Fallthrough case in switch. + use("2"); + case 3: + use("3"); + } + } + + + function foo2(a: number) { + switch (a) { + case 1: + use("1"); + break; + default: + ~~~~~~~ +!!! error TS7029: Fallthrough case in switch. + use("2"); + case 2: + use("3"); + } + } \ No newline at end of file diff --git a/tests/baselines/reference/fallFromLastCase2.js b/tests/baselines/reference/fallFromLastCase2.js new file mode 100644 index 00000000000..fd1d7c20d07 --- /dev/null +++ b/tests/baselines/reference/fallFromLastCase2.js @@ -0,0 +1,52 @@ +//// [fallFromLastCase2.ts] + +declare function use(a: string); + +function foo1(a: number) { + switch (a) { + case 1: + use("1"); + break; + case 2: + use("2"); + case 3: + use("3"); + } +} + + +function foo2(a: number) { + switch (a) { + case 1: + use("1"); + break; + default: + use("2"); + case 2: + use("3"); + } +} + +//// [fallFromLastCase2.js] +function foo1(a) { + switch (a) { + case 1: + use("1"); + break; + case 2: + use("2"); + case 3: + use("3"); + } +} +function foo2(a) { + switch (a) { + case 1: + use("1"); + break; + default: + use("2"); + case 2: + use("3"); + } +} diff --git a/tests/baselines/reference/fallbackToBindingPatternForTypeInference.js b/tests/baselines/reference/fallbackToBindingPatternForTypeInference.js new file mode 100644 index 00000000000..1c02ae83982 --- /dev/null +++ b/tests/baselines/reference/fallbackToBindingPatternForTypeInference.js @@ -0,0 +1,30 @@ +//// [fallbackToBindingPatternForTypeInference.ts] +declare function trans(f: (x: T) => string): number; +trans(({a}) => a); +trans(([b,c]) => 'foo'); +trans(({d: [e,f]}) => 'foo'); +trans(([{g},{h}]) => 'foo'); +trans(({a, b = 10}) => a); + + +//// [fallbackToBindingPatternForTypeInference.js] +trans(function (_a) { + var a = _a.a; + return a; +}); +trans(function (_a) { + var b = _a[0], c = _a[1]; + return 'foo'; +}); +trans(function (_a) { + var _b = _a.d, e = _b[0], f = _b[1]; + return 'foo'; +}); +trans(function (_a) { + var g = _a[0].g, h = _a[1].h; + return 'foo'; +}); +trans(function (_a) { + var a = _a.a, _b = _a.b, b = _b === void 0 ? 10 : _b; + return a; +}); diff --git a/tests/baselines/reference/fallbackToBindingPatternForTypeInference.symbols b/tests/baselines/reference/fallbackToBindingPatternForTypeInference.symbols new file mode 100644 index 00000000000..f57b234f39f --- /dev/null +++ b/tests/baselines/reference/fallbackToBindingPatternForTypeInference.symbols @@ -0,0 +1,34 @@ +=== tests/cases/compiler/fallbackToBindingPatternForTypeInference.ts === +declare function trans(f: (x: T) => string): number; +>trans : Symbol(trans, Decl(fallbackToBindingPatternForTypeInference.ts, 0, 0)) +>T : Symbol(T, Decl(fallbackToBindingPatternForTypeInference.ts, 0, 23)) +>f : Symbol(f, Decl(fallbackToBindingPatternForTypeInference.ts, 0, 26)) +>x : Symbol(x, Decl(fallbackToBindingPatternForTypeInference.ts, 0, 30)) +>T : Symbol(T, Decl(fallbackToBindingPatternForTypeInference.ts, 0, 23)) + +trans(({a}) => a); +>trans : Symbol(trans, Decl(fallbackToBindingPatternForTypeInference.ts, 0, 0)) +>a : Symbol(a, Decl(fallbackToBindingPatternForTypeInference.ts, 1, 8)) +>a : Symbol(a, Decl(fallbackToBindingPatternForTypeInference.ts, 1, 8)) + +trans(([b,c]) => 'foo'); +>trans : Symbol(trans, Decl(fallbackToBindingPatternForTypeInference.ts, 0, 0)) +>b : Symbol(b, Decl(fallbackToBindingPatternForTypeInference.ts, 2, 8)) +>c : Symbol(c, Decl(fallbackToBindingPatternForTypeInference.ts, 2, 10)) + +trans(({d: [e,f]}) => 'foo'); +>trans : Symbol(trans, Decl(fallbackToBindingPatternForTypeInference.ts, 0, 0)) +>e : Symbol(e, Decl(fallbackToBindingPatternForTypeInference.ts, 3, 12)) +>f : Symbol(f, Decl(fallbackToBindingPatternForTypeInference.ts, 3, 14)) + +trans(([{g},{h}]) => 'foo'); +>trans : Symbol(trans, Decl(fallbackToBindingPatternForTypeInference.ts, 0, 0)) +>g : Symbol(g, Decl(fallbackToBindingPatternForTypeInference.ts, 4, 9)) +>h : Symbol(h, Decl(fallbackToBindingPatternForTypeInference.ts, 4, 13)) + +trans(({a, b = 10}) => a); +>trans : Symbol(trans, Decl(fallbackToBindingPatternForTypeInference.ts, 0, 0)) +>a : Symbol(a, Decl(fallbackToBindingPatternForTypeInference.ts, 5, 8)) +>b : Symbol(b, Decl(fallbackToBindingPatternForTypeInference.ts, 5, 10)) +>a : Symbol(a, Decl(fallbackToBindingPatternForTypeInference.ts, 5, 8)) + diff --git a/tests/baselines/reference/fallbackToBindingPatternForTypeInference.types b/tests/baselines/reference/fallbackToBindingPatternForTypeInference.types new file mode 100644 index 00000000000..fc41085098a --- /dev/null +++ b/tests/baselines/reference/fallbackToBindingPatternForTypeInference.types @@ -0,0 +1,49 @@ +=== tests/cases/compiler/fallbackToBindingPatternForTypeInference.ts === +declare function trans(f: (x: T) => string): number; +>trans : (f: (x: T) => string) => number +>T : T +>f : (x: T) => string +>x : T +>T : T + +trans(({a}) => a); +>trans(({a}) => a) : number +>trans : (f: (x: T) => string) => number +>({a}) => a : ({a}: { a: any; }) => any +>a : any +>a : any + +trans(([b,c]) => 'foo'); +>trans(([b,c]) => 'foo') : number +>trans : (f: (x: T) => string) => number +>([b,c]) => 'foo' : ([b, c]: [any, any]) => string +>b : any +>c : any +>'foo' : string + +trans(({d: [e,f]}) => 'foo'); +>trans(({d: [e,f]}) => 'foo') : number +>trans : (f: (x: T) => string) => number +>({d: [e,f]}) => 'foo' : ({d: [e, f]}: { d: [any, any]; }) => string +>d : any +>e : any +>f : any +>'foo' : string + +trans(([{g},{h}]) => 'foo'); +>trans(([{g},{h}]) => 'foo') : number +>trans : (f: (x: T) => string) => number +>([{g},{h}]) => 'foo' : ([{g}, {h}]: [{ g: any; }, { h: any; }]) => string +>g : any +>h : any +>'foo' : string + +trans(({a, b = 10}) => a); +>trans(({a, b = 10}) => a) : number +>trans : (f: (x: T) => string) => number +>({a, b = 10}) => a : ({a, b}: { a: any; b?: number; }) => any +>a : any +>b : number +>10 : number +>a : any + diff --git a/tests/baselines/reference/fatArrowSelf.symbols b/tests/baselines/reference/fatArrowSelf.symbols index 4008b648ae6..df9c912e292 100644 --- a/tests/baselines/reference/fatArrowSelf.symbols +++ b/tests/baselines/reference/fatArrowSelf.symbols @@ -12,7 +12,7 @@ module Events { >EventEmitter : Symbol(EventEmitter, Decl(fatArrowSelf.ts, 3, 5)) public addListener(type:string, listener:ListenerCallback) { ->addListener : Symbol(addListener, Decl(fatArrowSelf.ts, 4, 31)) +>addListener : Symbol(EventEmitter.addListener, Decl(fatArrowSelf.ts, 4, 31)) >type : Symbol(type, Decl(fatArrowSelf.ts, 5, 28)) >listener : Symbol(listener, Decl(fatArrowSelf.ts, 5, 40)) >ListenerCallback : Symbol(ListenerCallback, Decl(fatArrowSelf.ts, 0, 15)) @@ -27,31 +27,31 @@ module Consumer { >EventEmitterConsummer : Symbol(EventEmitterConsummer, Decl(fatArrowSelf.ts, 10, 17)) constructor (private emitter: Events.EventEmitter) { } ->emitter : Symbol(emitter, Decl(fatArrowSelf.ts, 12, 21)) +>emitter : Symbol(EventEmitterConsummer.emitter, Decl(fatArrowSelf.ts, 12, 21)) >Events : Symbol(Events, Decl(fatArrowSelf.ts, 0, 0)) >EventEmitter : Symbol(Events.EventEmitter, Decl(fatArrowSelf.ts, 3, 5)) private register() { ->register : Symbol(register, Decl(fatArrowSelf.ts, 12, 62)) +>register : Symbol(EventEmitterConsummer.register, Decl(fatArrowSelf.ts, 12, 62)) this.emitter.addListener('change', (e) => { >this.emitter.addListener : Symbol(Events.EventEmitter.addListener, Decl(fatArrowSelf.ts, 4, 31)) ->this.emitter : Symbol(emitter, Decl(fatArrowSelf.ts, 12, 21)) +>this.emitter : Symbol(EventEmitterConsummer.emitter, Decl(fatArrowSelf.ts, 12, 21)) >this : Symbol(EventEmitterConsummer, Decl(fatArrowSelf.ts, 10, 17)) ->emitter : Symbol(emitter, Decl(fatArrowSelf.ts, 12, 21)) +>emitter : Symbol(EventEmitterConsummer.emitter, Decl(fatArrowSelf.ts, 12, 21)) >addListener : Symbol(Events.EventEmitter.addListener, Decl(fatArrowSelf.ts, 4, 31)) >e : Symbol(e, Decl(fatArrowSelf.ts, 15, 48)) this.changed(); ->this.changed : Symbol(changed, Decl(fatArrowSelf.ts, 18, 9)) +>this.changed : Symbol(EventEmitterConsummer.changed, Decl(fatArrowSelf.ts, 18, 9)) >this : Symbol(EventEmitterConsummer, Decl(fatArrowSelf.ts, 10, 17)) ->changed : Symbol(changed, Decl(fatArrowSelf.ts, 18, 9)) +>changed : Symbol(EventEmitterConsummer.changed, Decl(fatArrowSelf.ts, 18, 9)) }); } private changed() { ->changed : Symbol(changed, Decl(fatArrowSelf.ts, 18, 9)) +>changed : Symbol(EventEmitterConsummer.changed, Decl(fatArrowSelf.ts, 18, 9)) } } } diff --git a/tests/baselines/reference/fatarrowfunctionsInFunctionParameterDefaults.types b/tests/baselines/reference/fatarrowfunctionsInFunctionParameterDefaults.types index 55d72e854d3..39cd994dcc1 100644 --- a/tests/baselines/reference/fatarrowfunctionsInFunctionParameterDefaults.types +++ b/tests/baselines/reference/fatarrowfunctionsInFunctionParameterDefaults.types @@ -16,8 +16,8 @@ function fn(x = () => this, y = x()) { fn.call(4); // Should be 4 >fn.call(4) : any ->fn.call : (thisArg: any, ...argArray: any[]) => any +>fn.call : (this: Function, thisArg: any, ...argArray: any[]) => any >fn : (x?: () => any, y?: any) => any ->call : (thisArg: any, ...argArray: any[]) => any +>call : (this: Function, thisArg: any, ...argArray: any[]) => any >4 : number diff --git a/tests/baselines/reference/fillInMissingTypeArgsOnConstructCalls.symbols b/tests/baselines/reference/fillInMissingTypeArgsOnConstructCalls.symbols index 97d485c4b56..e3ad22f6a05 100644 --- a/tests/baselines/reference/fillInMissingTypeArgsOnConstructCalls.symbols +++ b/tests/baselines/reference/fillInMissingTypeArgsOnConstructCalls.symbols @@ -5,7 +5,7 @@ class A{ >Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) list: T ; ->list : Symbol(list, Decl(fillInMissingTypeArgsOnConstructCalls.ts, 0, 26)) +>list : Symbol(A.list, Decl(fillInMissingTypeArgsOnConstructCalls.ts, 0, 26)) >T : Symbol(T, Decl(fillInMissingTypeArgsOnConstructCalls.ts, 0, 8)) } var a = new A(); diff --git a/tests/baselines/reference/fixingTypeParametersRepeatedly3.symbols b/tests/baselines/reference/fixingTypeParametersRepeatedly3.symbols index a849adb6235..c08fa6d9694 100644 --- a/tests/baselines/reference/fixingTypeParametersRepeatedly3.symbols +++ b/tests/baselines/reference/fixingTypeParametersRepeatedly3.symbols @@ -3,14 +3,14 @@ interface Base { >Base : Symbol(Base, Decl(fixingTypeParametersRepeatedly3.ts, 0, 0)) baseProp; ->baseProp : Symbol(baseProp, Decl(fixingTypeParametersRepeatedly3.ts, 0, 16)) +>baseProp : Symbol(Base.baseProp, Decl(fixingTypeParametersRepeatedly3.ts, 0, 16)) } interface Derived extends Base { >Derived : Symbol(Derived, Decl(fixingTypeParametersRepeatedly3.ts, 2, 1)) >Base : Symbol(Base, Decl(fixingTypeParametersRepeatedly3.ts, 0, 0)) toBase?(): Base; ->toBase : Symbol(toBase, Decl(fixingTypeParametersRepeatedly3.ts, 3, 32)) +>toBase : Symbol(Derived.toBase, Decl(fixingTypeParametersRepeatedly3.ts, 3, 32)) >Base : Symbol(Base, Decl(fixingTypeParametersRepeatedly3.ts, 0, 0)) } diff --git a/tests/baselines/reference/fluentClasses.symbols b/tests/baselines/reference/fluentClasses.symbols index 3125235b6b1..d33bd8697ce 100644 --- a/tests/baselines/reference/fluentClasses.symbols +++ b/tests/baselines/reference/fluentClasses.symbols @@ -3,7 +3,7 @@ class A { >A : Symbol(A, Decl(fluentClasses.ts, 0, 0)) foo() { ->foo : Symbol(foo, Decl(fluentClasses.ts, 0, 9)) +>foo : Symbol(A.foo, Decl(fluentClasses.ts, 0, 9)) return this; >this : Symbol(A, Decl(fluentClasses.ts, 0, 0)) @@ -14,7 +14,7 @@ class B extends A { >A : Symbol(A, Decl(fluentClasses.ts, 0, 0)) bar() { ->bar : Symbol(bar, Decl(fluentClasses.ts, 5, 19)) +>bar : Symbol(B.bar, Decl(fluentClasses.ts, 5, 19)) return this; >this : Symbol(B, Decl(fluentClasses.ts, 4, 1)) @@ -25,7 +25,7 @@ class C extends B { >B : Symbol(B, Decl(fluentClasses.ts, 4, 1)) baz() { ->baz : Symbol(baz, Decl(fluentClasses.ts, 10, 19)) +>baz : Symbol(C.baz, Decl(fluentClasses.ts, 10, 19)) return this; >this : Symbol(C, Decl(fluentClasses.ts, 9, 1)) diff --git a/tests/baselines/reference/fluentInterfaces.symbols b/tests/baselines/reference/fluentInterfaces.symbols index e059cdc127e..d3bc1020f52 100644 --- a/tests/baselines/reference/fluentInterfaces.symbols +++ b/tests/baselines/reference/fluentInterfaces.symbols @@ -3,21 +3,21 @@ interface A { >A : Symbol(A, Decl(fluentInterfaces.ts, 0, 0)) foo(): this; ->foo : Symbol(foo, Decl(fluentInterfaces.ts, 0, 13)) +>foo : Symbol(A.foo, Decl(fluentInterfaces.ts, 0, 13)) } interface B extends A { >B : Symbol(B, Decl(fluentInterfaces.ts, 2, 1)) >A : Symbol(A, Decl(fluentInterfaces.ts, 0, 0)) bar(): this; ->bar : Symbol(bar, Decl(fluentInterfaces.ts, 3, 23)) +>bar : Symbol(B.bar, Decl(fluentInterfaces.ts, 3, 23)) } interface C extends B { >C : Symbol(C, Decl(fluentInterfaces.ts, 5, 1)) >B : Symbol(B, Decl(fluentInterfaces.ts, 2, 1)) baz(): this; ->baz : Symbol(baz, Decl(fluentInterfaces.ts, 6, 23)) +>baz : Symbol(C.baz, Decl(fluentInterfaces.ts, 6, 23)) } var c: C; >c : Symbol(c, Decl(fluentInterfaces.ts, 9, 3)) diff --git a/tests/baselines/reference/for-inStatementsArray.js b/tests/baselines/reference/for-inStatementsArray.js new file mode 100644 index 00000000000..e3d331e2d8c --- /dev/null +++ b/tests/baselines/reference/for-inStatementsArray.js @@ -0,0 +1,76 @@ +//// [for-inStatementsArray.ts] +let a: Date[]; +let b: boolean[]; + +for (let x in a) { + let a1 = a[x]; + let a2 = a[(x)]; + let a3 = a[+x]; + let b1 = b[x]; + let b2 = b[(x)]; + let b3 = b[+x]; +} + +for (let x in a) { + for (let y in a) { + for (let z in a) { + let a1 = a[x]; + let a2 = a[y]; + let a3 = a[z]; + } + } +} + +let i: string; +let j: string; +for (i in a) { + for (j in b) { + let a1 = a[i]; + let a2 = a[j]; + } +} + +var s: string; +for (var s in a) { + let a1 = a[s]; +} +for (s in a) { + let a1 = a[s]; +} + + +//// [for-inStatementsArray.js] +var a; +var b; +for (var x in a) { + var a1 = a[x]; + var a2 = a[(x)]; + var a3 = a[+x]; + var b1 = b[x]; + var b2 = b[(x)]; + var b3 = b[+x]; +} +for (var x in a) { + for (var y in a) { + for (var z in a) { + var a1 = a[x]; + var a2 = a[y]; + var a3 = a[z]; + } + } +} +var i; +var j; +for (i in a) { + for (j in b) { + var a1 = a[i]; + var a2 = a[j]; + } +} +var s; +for (var s in a) { + var a1 = a[s]; +} +for (s in a) { + var a1 = a[s]; +} diff --git a/tests/baselines/reference/for-inStatementsArray.symbols b/tests/baselines/reference/for-inStatementsArray.symbols new file mode 100644 index 00000000000..0d594c193cb --- /dev/null +++ b/tests/baselines/reference/for-inStatementsArray.symbols @@ -0,0 +1,121 @@ +=== tests/cases/conformance/statements/for-inStatements/for-inStatementsArray.ts === +let a: Date[]; +>a : Symbol(a, Decl(for-inStatementsArray.ts, 0, 3)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) + +let b: boolean[]; +>b : Symbol(b, Decl(for-inStatementsArray.ts, 1, 3)) + +for (let x in a) { +>x : Symbol(x, Decl(for-inStatementsArray.ts, 3, 8)) +>a : Symbol(a, Decl(for-inStatementsArray.ts, 0, 3)) + + let a1 = a[x]; +>a1 : Symbol(a1, Decl(for-inStatementsArray.ts, 4, 7)) +>a : Symbol(a, Decl(for-inStatementsArray.ts, 0, 3)) +>x : Symbol(x, Decl(for-inStatementsArray.ts, 3, 8)) + + let a2 = a[(x)]; +>a2 : Symbol(a2, Decl(for-inStatementsArray.ts, 5, 7)) +>a : Symbol(a, Decl(for-inStatementsArray.ts, 0, 3)) +>x : Symbol(x, Decl(for-inStatementsArray.ts, 3, 8)) + + let a3 = a[+x]; +>a3 : Symbol(a3, Decl(for-inStatementsArray.ts, 6, 7)) +>a : Symbol(a, Decl(for-inStatementsArray.ts, 0, 3)) +>x : Symbol(x, Decl(for-inStatementsArray.ts, 3, 8)) + + let b1 = b[x]; +>b1 : Symbol(b1, Decl(for-inStatementsArray.ts, 7, 7)) +>b : Symbol(b, Decl(for-inStatementsArray.ts, 1, 3)) +>x : Symbol(x, Decl(for-inStatementsArray.ts, 3, 8)) + + let b2 = b[(x)]; +>b2 : Symbol(b2, Decl(for-inStatementsArray.ts, 8, 7)) +>b : Symbol(b, Decl(for-inStatementsArray.ts, 1, 3)) +>x : Symbol(x, Decl(for-inStatementsArray.ts, 3, 8)) + + let b3 = b[+x]; +>b3 : Symbol(b3, Decl(for-inStatementsArray.ts, 9, 7)) +>b : Symbol(b, Decl(for-inStatementsArray.ts, 1, 3)) +>x : Symbol(x, Decl(for-inStatementsArray.ts, 3, 8)) +} + +for (let x in a) { +>x : Symbol(x, Decl(for-inStatementsArray.ts, 12, 8)) +>a : Symbol(a, Decl(for-inStatementsArray.ts, 0, 3)) + + for (let y in a) { +>y : Symbol(y, Decl(for-inStatementsArray.ts, 13, 12)) +>a : Symbol(a, Decl(for-inStatementsArray.ts, 0, 3)) + + for (let z in a) { +>z : Symbol(z, Decl(for-inStatementsArray.ts, 14, 16)) +>a : Symbol(a, Decl(for-inStatementsArray.ts, 0, 3)) + + let a1 = a[x]; +>a1 : Symbol(a1, Decl(for-inStatementsArray.ts, 15, 15)) +>a : Symbol(a, Decl(for-inStatementsArray.ts, 0, 3)) +>x : Symbol(x, Decl(for-inStatementsArray.ts, 12, 8)) + + let a2 = a[y]; +>a2 : Symbol(a2, Decl(for-inStatementsArray.ts, 16, 15)) +>a : Symbol(a, Decl(for-inStatementsArray.ts, 0, 3)) +>y : Symbol(y, Decl(for-inStatementsArray.ts, 13, 12)) + + let a3 = a[z]; +>a3 : Symbol(a3, Decl(for-inStatementsArray.ts, 17, 15)) +>a : Symbol(a, Decl(for-inStatementsArray.ts, 0, 3)) +>z : Symbol(z, Decl(for-inStatementsArray.ts, 14, 16)) + } + } +} + +let i: string; +>i : Symbol(i, Decl(for-inStatementsArray.ts, 22, 3)) + +let j: string; +>j : Symbol(j, Decl(for-inStatementsArray.ts, 23, 3)) + +for (i in a) { +>i : Symbol(i, Decl(for-inStatementsArray.ts, 22, 3)) +>a : Symbol(a, Decl(for-inStatementsArray.ts, 0, 3)) + + for (j in b) { +>j : Symbol(j, Decl(for-inStatementsArray.ts, 23, 3)) +>b : Symbol(b, Decl(for-inStatementsArray.ts, 1, 3)) + + let a1 = a[i]; +>a1 : Symbol(a1, Decl(for-inStatementsArray.ts, 26, 11)) +>a : Symbol(a, Decl(for-inStatementsArray.ts, 0, 3)) +>i : Symbol(i, Decl(for-inStatementsArray.ts, 22, 3)) + + let a2 = a[j]; +>a2 : Symbol(a2, Decl(for-inStatementsArray.ts, 27, 11)) +>a : Symbol(a, Decl(for-inStatementsArray.ts, 0, 3)) +>j : Symbol(j, Decl(for-inStatementsArray.ts, 23, 3)) + } +} + +var s: string; +>s : Symbol(s, Decl(for-inStatementsArray.ts, 31, 3), Decl(for-inStatementsArray.ts, 32, 8)) + +for (var s in a) { +>s : Symbol(s, Decl(for-inStatementsArray.ts, 31, 3), Decl(for-inStatementsArray.ts, 32, 8)) +>a : Symbol(a, Decl(for-inStatementsArray.ts, 0, 3)) + + let a1 = a[s]; +>a1 : Symbol(a1, Decl(for-inStatementsArray.ts, 33, 7)) +>a : Symbol(a, Decl(for-inStatementsArray.ts, 0, 3)) +>s : Symbol(s, Decl(for-inStatementsArray.ts, 31, 3), Decl(for-inStatementsArray.ts, 32, 8)) +} +for (s in a) { +>s : Symbol(s, Decl(for-inStatementsArray.ts, 31, 3), Decl(for-inStatementsArray.ts, 32, 8)) +>a : Symbol(a, Decl(for-inStatementsArray.ts, 0, 3)) + + let a1 = a[s]; +>a1 : Symbol(a1, Decl(for-inStatementsArray.ts, 36, 7)) +>a : Symbol(a, Decl(for-inStatementsArray.ts, 0, 3)) +>s : Symbol(s, Decl(for-inStatementsArray.ts, 31, 3), Decl(for-inStatementsArray.ts, 32, 8)) +} + diff --git a/tests/baselines/reference/for-inStatementsArray.types b/tests/baselines/reference/for-inStatementsArray.types new file mode 100644 index 00000000000..048b2819ff7 --- /dev/null +++ b/tests/baselines/reference/for-inStatementsArray.types @@ -0,0 +1,138 @@ +=== tests/cases/conformance/statements/for-inStatements/for-inStatementsArray.ts === +let a: Date[]; +>a : Date[] +>Date : Date + +let b: boolean[]; +>b : boolean[] + +for (let x in a) { +>x : string +>a : Date[] + + let a1 = a[x]; +>a1 : Date +>a[x] : Date +>a : Date[] +>x : string + + let a2 = a[(x)]; +>a2 : Date +>a[(x)] : Date +>a : Date[] +>(x) : string +>x : string + + let a3 = a[+x]; +>a3 : Date +>a[+x] : Date +>a : Date[] +>+x : number +>x : string + + let b1 = b[x]; +>b1 : boolean +>b[x] : boolean +>b : boolean[] +>x : string + + let b2 = b[(x)]; +>b2 : boolean +>b[(x)] : boolean +>b : boolean[] +>(x) : string +>x : string + + let b3 = b[+x]; +>b3 : boolean +>b[+x] : boolean +>b : boolean[] +>+x : number +>x : string +} + +for (let x in a) { +>x : string +>a : Date[] + + for (let y in a) { +>y : string +>a : Date[] + + for (let z in a) { +>z : string +>a : Date[] + + let a1 = a[x]; +>a1 : Date +>a[x] : Date +>a : Date[] +>x : string + + let a2 = a[y]; +>a2 : Date +>a[y] : Date +>a : Date[] +>y : string + + let a3 = a[z]; +>a3 : Date +>a[z] : Date +>a : Date[] +>z : string + } + } +} + +let i: string; +>i : string + +let j: string; +>j : string + +for (i in a) { +>i : string +>a : Date[] + + for (j in b) { +>j : string +>b : boolean[] + + let a1 = a[i]; +>a1 : Date +>a[i] : Date +>a : Date[] +>i : string + + let a2 = a[j]; +>a2 : Date +>a[j] : Date +>a : Date[] +>j : string + } +} + +var s: string; +>s : string + +for (var s in a) { +>s : string +>a : Date[] + + let a1 = a[s]; +>a1 : Date +>a[s] : Date +>a : Date[] +>s : string +} +for (s in a) { +>s : string +>a : Date[] + + let a1 = a[s]; +>a1 : Date +>a[s] : Date +>a : Date[] +>s : string +} + diff --git a/tests/baselines/reference/for-inStatementsArrayErrors.errors.txt b/tests/baselines/reference/for-inStatementsArrayErrors.errors.txt new file mode 100644 index 00000000000..6886d992bb2 --- /dev/null +++ b/tests/baselines/reference/for-inStatementsArrayErrors.errors.txt @@ -0,0 +1,40 @@ +tests/cases/conformance/statements/for-inStatements/for-inStatementsArrayErrors.ts(5,14): error TS7015: Element implicitly has an 'any' type because index expression is not of type 'number'. +tests/cases/conformance/statements/for-inStatements/for-inStatementsArrayErrors.ts(6,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/statements/for-inStatements/for-inStatementsArrayErrors.ts(7,9): error TS2365: Operator '===' cannot be applied to types 'string' and 'number'. +tests/cases/conformance/statements/for-inStatements/for-inStatementsArrayErrors.ts(9,16): error TS2339: Property 'unknownProperty' does not exist on type 'string'. +tests/cases/conformance/statements/for-inStatements/for-inStatementsArrayErrors.ts(13,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'i' must be of type 'number', but here has type 'string'. +tests/cases/conformance/statements/for-inStatements/for-inStatementsArrayErrors.ts(17,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'j' must be of type 'any', but here has type 'string'. + + +==== tests/cases/conformance/statements/for-inStatements/for-inStatementsArrayErrors.ts (6 errors) ==== + + let a: Date[]; + + for (let x in a) { + let a1 = a[x + 1]; + ~~~~~~~~ +!!! error TS7015: Element implicitly has an 'any' type because index expression is not of type 'number'. + let a2 = a[x - 1]; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + if (x === 1) { + ~~~~~~~ +!!! error TS2365: Operator '===' cannot be applied to types 'string' and 'number'. + } + let a3 = x.unknownProperty; + ~~~~~~~~~~~~~~~ +!!! error TS2339: Property 'unknownProperty' does not exist on type 'string'. + } + + var i: number; + for (var i in a ) { + ~ +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'i' must be of type 'number', but here has type 'string'. + } + + var j: any; + for (var j in a ) { + ~ +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'j' must be of type 'any', but here has type 'string'. + } + \ No newline at end of file diff --git a/tests/baselines/reference/for-inStatementsArrayErrors.js b/tests/baselines/reference/for-inStatementsArrayErrors.js new file mode 100644 index 00000000000..981a840695c --- /dev/null +++ b/tests/baselines/reference/for-inStatementsArrayErrors.js @@ -0,0 +1,36 @@ +//// [for-inStatementsArrayErrors.ts] + +let a: Date[]; + +for (let x in a) { + let a1 = a[x + 1]; + let a2 = a[x - 1]; + if (x === 1) { + } + let a3 = x.unknownProperty; +} + +var i: number; +for (var i in a ) { +} + +var j: any; +for (var j in a ) { +} + + +//// [for-inStatementsArrayErrors.js] +var a; +for (var x in a) { + var a1 = a[x + 1]; + var a2 = a[x - 1]; + if (x === 1) { + } + var a3 = x.unknownProperty; +} +var i; +for (var i in a) { +} +var j; +for (var j in a) { +} diff --git a/tests/baselines/reference/for-inStatementsDestructuring.errors.txt b/tests/baselines/reference/for-inStatementsDestructuring.errors.txt index e540b182cf5..e54f2c93272 100644 --- a/tests/baselines/reference/for-inStatementsDestructuring.errors.txt +++ b/tests/baselines/reference/for-inStatementsDestructuring.errors.txt @@ -1,7 +1,10 @@ +tests/cases/conformance/statements/for-inStatements/for-inStatementsDestructuring.ts(1,10): error TS2461: Type 'string' is not an array type. tests/cases/conformance/statements/for-inStatements/for-inStatementsDestructuring.ts(1,10): error TS2491: The left-hand side of a 'for...in' statement cannot be a destructuring pattern. -==== tests/cases/conformance/statements/for-inStatements/for-inStatementsDestructuring.ts (1 errors) ==== +==== tests/cases/conformance/statements/for-inStatements/for-inStatementsDestructuring.ts (2 errors) ==== for (var [a, b] in []) {} ~~~~~~ +!!! error TS2461: Type 'string' is not an array type. + ~~~~~~ !!! error TS2491: The left-hand side of a 'for...in' statement cannot be a destructuring pattern. \ No newline at end of file diff --git a/tests/baselines/reference/for-inStatementsDestructuring2.errors.txt b/tests/baselines/reference/for-inStatementsDestructuring2.errors.txt index 56d2436d4c7..7589610a64e 100644 --- a/tests/baselines/reference/for-inStatementsDestructuring2.errors.txt +++ b/tests/baselines/reference/for-inStatementsDestructuring2.errors.txt @@ -1,7 +1,13 @@ tests/cases/conformance/statements/for-inStatements/for-inStatementsDestructuring2.ts(1,10): error TS2491: The left-hand side of a 'for...in' statement cannot be a destructuring pattern. +tests/cases/conformance/statements/for-inStatements/for-inStatementsDestructuring2.ts(1,11): error TS2459: Type 'string' has no property 'a' and no string index signature. +tests/cases/conformance/statements/for-inStatements/for-inStatementsDestructuring2.ts(1,14): error TS2459: Type 'string' has no property 'b' and no string index signature. -==== tests/cases/conformance/statements/for-inStatements/for-inStatementsDestructuring2.ts (1 errors) ==== +==== tests/cases/conformance/statements/for-inStatements/for-inStatementsDestructuring2.ts (3 errors) ==== for (var {a, b} in []) {} ~~~~~~ -!!! error TS2491: The left-hand side of a 'for...in' statement cannot be a destructuring pattern. \ No newline at end of file +!!! error TS2491: The left-hand side of a 'for...in' statement cannot be a destructuring pattern. + ~ +!!! error TS2459: Type 'string' has no property 'a' and no string index signature. + ~ +!!! error TS2459: Type 'string' has no property 'b' and no string index signature. \ No newline at end of file diff --git a/tests/baselines/reference/for-inStatementsInvalid.errors.txt b/tests/baselines/reference/for-inStatementsInvalid.errors.txt index 67e536a3069..00ab58ab94d 100644 --- a/tests/baselines/reference/for-inStatementsInvalid.errors.txt +++ b/tests/baselines/reference/for-inStatementsInvalid.errors.txt @@ -7,7 +7,6 @@ tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts(1 tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts(18,15): error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts(19,15): error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts(20,15): error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. -tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts(21,15): error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts(22,15): error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts(29,23): error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts(38,23): error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. @@ -16,7 +15,7 @@ tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts(5 tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts(62,15): error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. -==== tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts (16 errors) ==== +==== tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts (15 errors) ==== var aNumber: number; for (aNumber in {}) { } ~~~~~~~ @@ -56,8 +55,6 @@ tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts(6 ~~~~~~~~~~ !!! error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. for (var x in 42 ? d[x] : c[x]) { } - ~~~~~~~~~~~~~~~~ -!!! error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. for (var x in c[23]) { } ~~~~~ !!! error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. diff --git a/tests/baselines/reference/for-of13.symbols b/tests/baselines/reference/for-of13.symbols index bcfc3f981bd..d257ed5290a 100644 --- a/tests/baselines/reference/for-of13.symbols +++ b/tests/baselines/reference/for-of13.symbols @@ -4,6 +4,6 @@ var v: string; for (v of [""].values()) { } >v : Symbol(v, Decl(for-of13.ts, 0, 3)) ->[""].values : Symbol(Array.values, Decl(lib.d.ts, --, --)) ->values : Symbol(Array.values, Decl(lib.d.ts, --, --)) +>[""].values : Symbol(Array.values, Decl(lib.es2015.iterable.d.ts, --, --)) +>values : Symbol(Array.values, Decl(lib.es2015.iterable.d.ts, --, --)) diff --git a/tests/baselines/reference/for-of18.symbols b/tests/baselines/reference/for-of18.symbols index 34e11d3d388..b9d32662713 100644 --- a/tests/baselines/reference/for-of18.symbols +++ b/tests/baselines/reference/for-of18.symbols @@ -10,7 +10,7 @@ class StringIterator { >StringIterator : Symbol(StringIterator, Decl(for-of18.ts, 1, 33)) next() { ->next : Symbol(next, Decl(for-of18.ts, 3, 22)) +>next : Symbol(StringIterator.next, Decl(for-of18.ts, 3, 22)) return { value: "", @@ -22,9 +22,9 @@ class StringIterator { }; } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; >this : Symbol(StringIterator, Decl(for-of18.ts, 1, 33)) diff --git a/tests/baselines/reference/for-of19.symbols b/tests/baselines/reference/for-of19.symbols index 81aafd32d13..e1a129aa324 100644 --- a/tests/baselines/reference/for-of19.symbols +++ b/tests/baselines/reference/for-of19.symbols @@ -14,7 +14,7 @@ class FooIterator { >FooIterator : Symbol(FooIterator, Decl(for-of19.ts, 4, 13)) next() { ->next : Symbol(next, Decl(for-of19.ts, 5, 19)) +>next : Symbol(FooIterator.next, Decl(for-of19.ts, 5, 19)) return { value: new Foo, @@ -27,9 +27,9 @@ class FooIterator { }; } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; >this : Symbol(FooIterator, Decl(for-of19.ts, 4, 13)) diff --git a/tests/baselines/reference/for-of2.errors.txt b/tests/baselines/reference/for-of2.errors.txt index 0b5133cde13..f4f39f60f67 100644 --- a/tests/baselines/reference/for-of2.errors.txt +++ b/tests/baselines/reference/for-of2.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/es6/for-ofStatements/for-of2.ts(1,7): error TS1155: 'const' declarations must be initialized -tests/cases/conformance/es6/for-ofStatements/for-of2.ts(2,6): error TS2485: The left-hand side of a 'for...of' statement cannot be a previously defined constant. +tests/cases/conformance/es6/for-ofStatements/for-of2.ts(2,6): error TS2485: The left-hand side of a 'for...of' statement cannot be a constant or a read-only property. ==== tests/cases/conformance/es6/for-ofStatements/for-of2.ts (2 errors) ==== @@ -8,4 +8,4 @@ tests/cases/conformance/es6/for-ofStatements/for-of2.ts(2,6): error TS2485: The !!! error TS1155: 'const' declarations must be initialized for (v of []) { } ~ -!!! error TS2485: The left-hand side of a 'for...of' statement cannot be a previously defined constant. \ No newline at end of file +!!! error TS2485: The left-hand side of a 'for...of' statement cannot be a constant or a read-only property. \ No newline at end of file diff --git a/tests/baselines/reference/for-of20.symbols b/tests/baselines/reference/for-of20.symbols index 727b69e3c9d..20b444e6bcc 100644 --- a/tests/baselines/reference/for-of20.symbols +++ b/tests/baselines/reference/for-of20.symbols @@ -14,7 +14,7 @@ class FooIterator { >FooIterator : Symbol(FooIterator, Decl(for-of20.ts, 4, 13)) next() { ->next : Symbol(next, Decl(for-of20.ts, 5, 19)) +>next : Symbol(FooIterator.next, Decl(for-of20.ts, 5, 19)) return { value: new Foo, @@ -27,9 +27,9 @@ class FooIterator { }; } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; >this : Symbol(FooIterator, Decl(for-of20.ts, 4, 13)) diff --git a/tests/baselines/reference/for-of21.symbols b/tests/baselines/reference/for-of21.symbols index 1464a42aab2..71403edfc9e 100644 --- a/tests/baselines/reference/for-of21.symbols +++ b/tests/baselines/reference/for-of21.symbols @@ -14,7 +14,7 @@ class FooIterator { >FooIterator : Symbol(FooIterator, Decl(for-of21.ts, 4, 13)) next() { ->next : Symbol(next, Decl(for-of21.ts, 5, 19)) +>next : Symbol(FooIterator.next, Decl(for-of21.ts, 5, 19)) return { value: new Foo, @@ -27,9 +27,9 @@ class FooIterator { }; } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; >this : Symbol(FooIterator, Decl(for-of21.ts, 4, 13)) diff --git a/tests/baselines/reference/for-of22.symbols b/tests/baselines/reference/for-of22.symbols index 1aac39dae6e..36a522759cf 100644 --- a/tests/baselines/reference/for-of22.symbols +++ b/tests/baselines/reference/for-of22.symbols @@ -15,7 +15,7 @@ class FooIterator { >FooIterator : Symbol(FooIterator, Decl(for-of22.ts, 5, 13)) next() { ->next : Symbol(next, Decl(for-of22.ts, 6, 19)) +>next : Symbol(FooIterator.next, Decl(for-of22.ts, 6, 19)) return { value: new Foo, @@ -28,9 +28,9 @@ class FooIterator { }; } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; >this : Symbol(FooIterator, Decl(for-of22.ts, 5, 13)) diff --git a/tests/baselines/reference/for-of23.symbols b/tests/baselines/reference/for-of23.symbols index f4f34fcef93..3be07f4fd4a 100644 --- a/tests/baselines/reference/for-of23.symbols +++ b/tests/baselines/reference/for-of23.symbols @@ -14,7 +14,7 @@ class FooIterator { >FooIterator : Symbol(FooIterator, Decl(for-of23.ts, 4, 13)) next() { ->next : Symbol(next, Decl(for-of23.ts, 5, 19)) +>next : Symbol(FooIterator.next, Decl(for-of23.ts, 5, 19)) return { value: new Foo, @@ -27,9 +27,9 @@ class FooIterator { }; } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; >this : Symbol(FooIterator, Decl(for-of23.ts, 4, 13)) diff --git a/tests/baselines/reference/for-of25.symbols b/tests/baselines/reference/for-of25.symbols index dfa358da0bd..e21348ba565 100644 --- a/tests/baselines/reference/for-of25.symbols +++ b/tests/baselines/reference/for-of25.symbols @@ -10,9 +10,9 @@ class StringIterator { >StringIterator : Symbol(StringIterator, Decl(for-of25.ts, 1, 37)) [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return x; >x : Symbol(x, Decl(for-of25.ts, 0, 3)) diff --git a/tests/baselines/reference/for-of26.symbols b/tests/baselines/reference/for-of26.symbols index 9f4d1455c3f..947240bf8e3 100644 --- a/tests/baselines/reference/for-of26.symbols +++ b/tests/baselines/reference/for-of26.symbols @@ -10,15 +10,15 @@ class StringIterator { >StringIterator : Symbol(StringIterator, Decl(for-of26.ts, 1, 37)) next() { ->next : Symbol(next, Decl(for-of26.ts, 3, 22)) +>next : Symbol(StringIterator.next, Decl(for-of26.ts, 3, 22)) return x; >x : Symbol(x, Decl(for-of26.ts, 0, 3)) } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; >this : Symbol(StringIterator, Decl(for-of26.ts, 1, 37)) diff --git a/tests/baselines/reference/for-of27.symbols b/tests/baselines/reference/for-of27.symbols index 57148c53f13..b2b733ab13b 100644 --- a/tests/baselines/reference/for-of27.symbols +++ b/tests/baselines/reference/for-of27.symbols @@ -7,7 +7,7 @@ class StringIterator { >StringIterator : Symbol(StringIterator, Decl(for-of27.ts, 0, 37)) [Symbol.iterator]: any; ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) } diff --git a/tests/baselines/reference/for-of28.symbols b/tests/baselines/reference/for-of28.symbols index 91081d3abdf..52ed4fd7459 100644 --- a/tests/baselines/reference/for-of28.symbols +++ b/tests/baselines/reference/for-of28.symbols @@ -7,12 +7,12 @@ class StringIterator { >StringIterator : Symbol(StringIterator, Decl(for-of28.ts, 0, 37)) next: any; ->next : Symbol(next, Decl(for-of28.ts, 2, 22)) +>next : Symbol(StringIterator.next, Decl(for-of28.ts, 2, 22)) [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; >this : Symbol(StringIterator, Decl(for-of28.ts, 0, 37)) diff --git a/tests/baselines/reference/for-of37.symbols b/tests/baselines/reference/for-of37.symbols index b8ce9da9ce2..c9c5c627b8a 100644 --- a/tests/baselines/reference/for-of37.symbols +++ b/tests/baselines/reference/for-of37.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/for-ofStatements/for-of37.ts === var map = new Map([["", true]]); >map : Symbol(map, Decl(for-of37.ts, 0, 3)) ->Map : Symbol(Map, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Map : Symbol(Map, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --)) for (var v of map) { >v : Symbol(v, Decl(for-of37.ts, 1, 8)) diff --git a/tests/baselines/reference/for-of38.symbols b/tests/baselines/reference/for-of38.symbols index 18d2dda6db8..d1df1afea3b 100644 --- a/tests/baselines/reference/for-of38.symbols +++ b/tests/baselines/reference/for-of38.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/for-ofStatements/for-of38.ts === var map = new Map([["", true]]); >map : Symbol(map, Decl(for-of38.ts, 0, 3)) ->Map : Symbol(Map, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Map : Symbol(Map, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --)) for (var [k, v] of map) { >k : Symbol(k, Decl(for-of38.ts, 1, 10)) diff --git a/tests/baselines/reference/for-of40.symbols b/tests/baselines/reference/for-of40.symbols index a9177d12435..37fff144559 100644 --- a/tests/baselines/reference/for-of40.symbols +++ b/tests/baselines/reference/for-of40.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/for-ofStatements/for-of40.ts === var map = new Map([["", true]]); >map : Symbol(map, Decl(for-of40.ts, 0, 3)) ->Map : Symbol(Map, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Map : Symbol(Map, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --)) for (var [k = "", v = false] of map) { >k : Symbol(k, Decl(for-of40.ts, 1, 10)) diff --git a/tests/baselines/reference/for-of44.symbols b/tests/baselines/reference/for-of44.symbols index d7057da0ee2..fb951a6ef8a 100644 --- a/tests/baselines/reference/for-of44.symbols +++ b/tests/baselines/reference/for-of44.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/for-ofStatements/for-of44.ts === var array: [number, string | boolean | symbol][] = [[0, ""], [0, true], [1, Symbol()]] >array : Symbol(array, Decl(for-of44.ts, 0, 3)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) for (var [num, strBoolSym] of array) { >num : Symbol(num, Decl(for-of44.ts, 1, 10)) diff --git a/tests/baselines/reference/for-of45.symbols b/tests/baselines/reference/for-of45.symbols index 7d8ffd4ba86..3a0968069c8 100644 --- a/tests/baselines/reference/for-of45.symbols +++ b/tests/baselines/reference/for-of45.symbols @@ -5,7 +5,7 @@ var k: string, v: boolean; var map = new Map([["", true]]); >map : Symbol(map, Decl(for-of45.ts, 1, 3)) ->Map : Symbol(Map, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Map : Symbol(Map, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --)) for ([k = "", v = false] of map) { >k : Symbol(k, Decl(for-of45.ts, 0, 3)) diff --git a/tests/baselines/reference/for-of45.types b/tests/baselines/reference/for-of45.types index b71e062eccf..7c853993b0a 100644 --- a/tests/baselines/reference/for-of45.types +++ b/tests/baselines/reference/for-of45.types @@ -13,7 +13,7 @@ var map = new Map([["", true]]); >true : boolean for ([k = "", v = false] of map) { ->[k = "", v = false] : (string | boolean)[] +>[k = "", v = false] : [string, boolean] >k = "" : string >k : string >"" : string diff --git a/tests/baselines/reference/for-of50.symbols b/tests/baselines/reference/for-of50.symbols index 435390f2a6e..ad9b06d48a9 100644 --- a/tests/baselines/reference/for-of50.symbols +++ b/tests/baselines/reference/for-of50.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/for-ofStatements/for-of50.ts === var map = new Map([["", true]]); >map : Symbol(map, Decl(for-of50.ts, 0, 3)) ->Map : Symbol(Map, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Map : Symbol(Map, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --)) for (const [k, v] of map) { >k : Symbol(k, Decl(for-of50.ts, 1, 12)) diff --git a/tests/baselines/reference/for-of57.symbols b/tests/baselines/reference/for-of57.symbols index 191377bdd47..7428ab54b83 100644 --- a/tests/baselines/reference/for-of57.symbols +++ b/tests/baselines/reference/for-of57.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/for-ofStatements/for-of57.ts === var iter: Iterable; >iter : Symbol(iter, Decl(for-of57.ts, 0, 3)) ->Iterable : Symbol(Iterable, Decl(lib.d.ts, --, --)) +>Iterable : Symbol(Iterable, Decl(lib.es2015.iterable.d.ts, --, --)) for (let num of iter) { } >num : Symbol(num, Decl(for-of57.ts, 1, 8)) diff --git a/tests/baselines/reference/forInBreakStatements.types b/tests/baselines/reference/forInBreakStatements.types index 7714429e5af..4f4b9b3bef9 100644 --- a/tests/baselines/reference/forInBreakStatements.types +++ b/tests/baselines/reference/forInBreakStatements.types @@ -1,7 +1,7 @@ === tests/cases/conformance/statements/breakStatements/forInBreakStatements.ts === for(var x in {}) { ->x : any +>x : string >{} : {} break; @@ -11,7 +11,7 @@ ONE: >ONE : any for(var x in {}) { ->x : any +>x : string >{} : {} break ONE; @@ -25,7 +25,7 @@ THREE: >THREE : any for(var x in {}) { ->x : any +>x : string >{} : {} break THREE; @@ -36,14 +36,14 @@ FOUR: >FOUR : any for(var x in {}) { ->x : any +>x : string >{} : {} FIVE: >FIVE : any for(var x in {}) { ->x : any +>x : string >{} : {} break FOUR; @@ -52,14 +52,14 @@ for(var x in {}) { } for(var x in {}) { ->x : any +>x : string >{} : {} SIX: >SIX : any for(var x in {}) break SIX; ->x : any +>x : string >{} : {} >SIX : any } @@ -68,11 +68,11 @@ SEVEN: >SEVEN : any for (var x in {}) for (var x in {}) for (var x in {}) break SEVEN; ->x : any +>x : string >{} : {} ->x : any +>x : string >{} : {} ->x : any +>x : string >{} : {} >SEVEN : any @@ -80,7 +80,7 @@ EIGHT: >EIGHT : any for (var x in {}){ ->x : any +>x : string >{} : {} var fn = function () { } diff --git a/tests/baselines/reference/forInContinueStatements.types b/tests/baselines/reference/forInContinueStatements.types index 572fd16053d..e45cc798542 100644 --- a/tests/baselines/reference/forInContinueStatements.types +++ b/tests/baselines/reference/forInContinueStatements.types @@ -1,7 +1,7 @@ === tests/cases/conformance/statements/continueStatements/forInContinueStatements.ts === for(var x in {}) { ->x : any +>x : string >{} : {} continue; @@ -11,7 +11,7 @@ ONE: >ONE : any for(var x in {}) { ->x : any +>x : string >{} : {} continue ONE; @@ -25,7 +25,7 @@ THREE: >THREE : any for(var x in {}) { ->x : any +>x : string >{} : {} continue THREE; @@ -36,14 +36,14 @@ FOUR: >FOUR : any for(var x in {}) { ->x : any +>x : string >{} : {} FIVE: >FIVE : any for(var x in {}) { ->x : any +>x : string >{} : {} continue FOUR; @@ -52,14 +52,14 @@ for(var x in {}) { } for(var x in {}) { ->x : any +>x : string >{} : {} SIX: >SIX : any for(var x in {}) continue SIX; ->x : any +>x : string >{} : {} >SIX : any } @@ -68,11 +68,11 @@ SEVEN: >SEVEN : any for (var x in {}) for (var x in {}) for (var x in {}) continue SEVEN; ->x : any +>x : string >{} : {} ->x : any +>x : string >{} : {} ->x : any +>x : string >{} : {} >SEVEN : any @@ -80,7 +80,7 @@ EIGHT: >EIGHT : any for (var x in {}){ ->x : any +>x : string >{} : {} var fn = function () { } diff --git a/tests/baselines/reference/forInStatement1.types b/tests/baselines/reference/forInStatement1.types index 8ccacc9e2f7..ed2e568a39e 100644 --- a/tests/baselines/reference/forInStatement1.types +++ b/tests/baselines/reference/forInStatement1.types @@ -3,6 +3,6 @@ var expr: any; >expr : any for (var a in expr) { ->a : any +>a : string >expr : any } diff --git a/tests/baselines/reference/forInStatement3.types b/tests/baselines/reference/forInStatement3.types index 1d3803065bd..d3767790ed2 100644 --- a/tests/baselines/reference/forInStatement3.types +++ b/tests/baselines/reference/forInStatement3.types @@ -8,7 +8,7 @@ function F() { >T : T for (var a in expr) { ->a : any +>a : string >expr : T } } diff --git a/tests/baselines/reference/forStatements.symbols b/tests/baselines/reference/forStatements.symbols index 2d5250217f9..84cd7dc70d1 100644 --- a/tests/baselines/reference/forStatements.symbols +++ b/tests/baselines/reference/forStatements.symbols @@ -4,7 +4,7 @@ interface I { >I : Symbol(I, Decl(forStatements.ts, 0, 0)) id: number; ->id : Symbol(id, Decl(forStatements.ts, 1, 13)) +>id : Symbol(I.id, Decl(forStatements.ts, 1, 13)) } class C implements I { @@ -12,7 +12,7 @@ class C implements I { >I : Symbol(I, Decl(forStatements.ts, 0, 0)) id: number; ->id : Symbol(id, Decl(forStatements.ts, 5, 22)) +>id : Symbol(C.id, Decl(forStatements.ts, 5, 22)) } class D{ @@ -20,16 +20,16 @@ class D{ >T : Symbol(T, Decl(forStatements.ts, 9, 8)) source: T; ->source : Symbol(source, Decl(forStatements.ts, 9, 11)) +>source : Symbol(D.source, Decl(forStatements.ts, 9, 11)) >T : Symbol(T, Decl(forStatements.ts, 9, 8)) recurse: D; ->recurse : Symbol(recurse, Decl(forStatements.ts, 10, 14)) +>recurse : Symbol(D.recurse, Decl(forStatements.ts, 10, 14)) >D : Symbol(D, Decl(forStatements.ts, 7, 1)) >T : Symbol(T, Decl(forStatements.ts, 9, 8)) wrapped: D> ->wrapped : Symbol(wrapped, Decl(forStatements.ts, 11, 18)) +>wrapped : Symbol(D.wrapped, Decl(forStatements.ts, 11, 18)) >D : Symbol(D, Decl(forStatements.ts, 7, 1)) >D : Symbol(D, Decl(forStatements.ts, 7, 1)) >T : Symbol(T, Decl(forStatements.ts, 9, 8)) @@ -46,7 +46,7 @@ module M { >A : Symbol(A, Decl(forStatements.ts, 17, 10)) name: string; ->name : Symbol(name, Decl(forStatements.ts, 18, 20)) +>name : Symbol(A.name, Decl(forStatements.ts, 18, 20)) } export function F2(x: number): string { return x.toString(); } @@ -65,8 +65,8 @@ for(var aString: string = 'this is a string';;){} for(var aDate: Date = new Date(12);;){} >aDate : Symbol(aDate, Decl(forStatements.ts, 27, 7)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) for(var anObject: Object = new Object();;){} >anObject : Symbol(anObject, Decl(forStatements.ts, 28, 7)) diff --git a/tests/baselines/reference/forStatementsMultipleValidDecl.symbols b/tests/baselines/reference/forStatementsMultipleValidDecl.symbols index d2d8ac01003..89e36c4a8f5 100644 --- a/tests/baselines/reference/forStatementsMultipleValidDecl.symbols +++ b/tests/baselines/reference/forStatementsMultipleValidDecl.symbols @@ -21,8 +21,8 @@ function declSpace() { } interface Point { x: number; y: number; } >Point : Symbol(Point, Decl(forStatementsMultipleValidDecl.ts, 10, 1)) ->x : Symbol(x, Decl(forStatementsMultipleValidDecl.ts, 11, 17)) ->y : Symbol(y, Decl(forStatementsMultipleValidDecl.ts, 11, 28)) +>x : Symbol(Point.x, Decl(forStatementsMultipleValidDecl.ts, 11, 17)) +>y : Symbol(Point.y, Decl(forStatementsMultipleValidDecl.ts, 11, 28)) for (var p: Point; ;) { } >p : Symbol(p, Decl(forStatementsMultipleValidDecl.ts, 13, 8), Decl(forStatementsMultipleValidDecl.ts, 14, 8), Decl(forStatementsMultipleValidDecl.ts, 15, 8), Decl(forStatementsMultipleValidDecl.ts, 16, 8), Decl(forStatementsMultipleValidDecl.ts, 17, 8), Decl(forStatementsMultipleValidDecl.ts, 18, 8), Decl(forStatementsMultipleValidDecl.ts, 19, 8)) diff --git a/tests/baselines/reference/forStatementsMultipleValidDecl.types b/tests/baselines/reference/forStatementsMultipleValidDecl.types index acb26f17312..ae5959f1bd3 100644 --- a/tests/baselines/reference/forStatementsMultipleValidDecl.types +++ b/tests/baselines/reference/forStatementsMultipleValidDecl.types @@ -16,7 +16,7 @@ for (var x = undefined; ;) { } // new declaration space, making redeclaring x as a string valid function declSpace() { ->declSpace : () => void +>declSpace : () => never for (var x = 'this is a string'; ;) { } >x : string diff --git a/tests/baselines/reference/functionAndImportNameConflict.errors.txt b/tests/baselines/reference/functionAndImportNameConflict.errors.txt new file mode 100644 index 00000000000..4ca496cfb65 --- /dev/null +++ b/tests/baselines/reference/functionAndImportNameConflict.errors.txt @@ -0,0 +1,13 @@ +tests/cases/compiler/f2.ts(1,9): error TS2440: Import declaration conflicts with local declaration of 'f' + + +==== tests/cases/compiler/f1.ts (0 errors) ==== + export function f() { + } + +==== tests/cases/compiler/f2.ts (1 errors) ==== + import {f} from './f1'; + ~ +!!! error TS2440: Import declaration conflicts with local declaration of 'f' + export function f() { + } \ No newline at end of file diff --git a/tests/baselines/reference/functionAndImportNameConflict.js b/tests/baselines/reference/functionAndImportNameConflict.js new file mode 100644 index 00000000000..8391823aa3a --- /dev/null +++ b/tests/baselines/reference/functionAndImportNameConflict.js @@ -0,0 +1,21 @@ +//// [tests/cases/compiler/functionAndImportNameConflict.ts] //// + +//// [f1.ts] +export function f() { +} + +//// [f2.ts] +import {f} from './f1'; +export function f() { +} + +//// [f1.js] +"use strict"; +function f() { +} +exports.f = f; +//// [f2.js] +"use strict"; +function f() { +} +exports.f = f; diff --git a/tests/baselines/reference/functionCall5.symbols b/tests/baselines/reference/functionCall5.symbols index de166231204..e06c801eba8 100644 --- a/tests/baselines/reference/functionCall5.symbols +++ b/tests/baselines/reference/functionCall5.symbols @@ -2,7 +2,7 @@ module m1 { export class c1 { public a; }} >m1 : Symbol(m1, Decl(functionCall5.ts, 0, 0)) >c1 : Symbol(c1, Decl(functionCall5.ts, 0, 11)) ->a : Symbol(a, Decl(functionCall5.ts, 0, 29)) +>a : Symbol(c1.a, Decl(functionCall5.ts, 0, 29)) function foo():m1.c1{return new m1.c1();}; >foo : Symbol(foo, Decl(functionCall5.ts, 0, 42)) diff --git a/tests/baselines/reference/functionCall7.errors.txt b/tests/baselines/reference/functionCall7.errors.txt index 19e572fa58d..576ea9c266e 100644 --- a/tests/baselines/reference/functionCall7.errors.txt +++ b/tests/baselines/reference/functionCall7.errors.txt @@ -1,6 +1,5 @@ tests/cases/compiler/functionCall7.ts(5,1): error TS2346: Supplied parameters do not match any signature of call target. tests/cases/compiler/functionCall7.ts(6,5): error TS2345: Argument of type 'number' is not assignable to parameter of type 'c1'. - Property 'a' is missing in type 'Number'. tests/cases/compiler/functionCall7.ts(7,1): error TS2346: Supplied parameters do not match any signature of call target. @@ -15,7 +14,6 @@ tests/cases/compiler/functionCall7.ts(7,1): error TS2346: Supplied parameters do foo(4); ~ !!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'c1'. -!!! error TS2345: Property 'a' is missing in type 'Number'. foo(); ~~~~~ !!! error TS2346: Supplied parameters do not match any signature of call target. diff --git a/tests/baselines/reference/functionConstraintSatisfaction.symbols b/tests/baselines/reference/functionConstraintSatisfaction.symbols index 969ac928374..6c7ca5f7713 100644 --- a/tests/baselines/reference/functionConstraintSatisfaction.symbols +++ b/tests/baselines/reference/functionConstraintSatisfaction.symbols @@ -23,7 +23,7 @@ class C { >C : Symbol(C, Decl(functionConstraintSatisfaction.ts, 7, 9)) foo: string; ->foo : Symbol(foo, Decl(functionConstraintSatisfaction.ts, 9, 9)) +>foo : Symbol(C.foo, Decl(functionConstraintSatisfaction.ts, 9, 9)) } var a: { (): string }; @@ -103,7 +103,7 @@ class C2 { >T : Symbol(T, Decl(functionConstraintSatisfaction.ts, 32, 9)) foo: T; ->foo : Symbol(foo, Decl(functionConstraintSatisfaction.ts, 32, 13)) +>foo : Symbol(C2.foo, Decl(functionConstraintSatisfaction.ts, 32, 13)) >T : Symbol(T, Decl(functionConstraintSatisfaction.ts, 32, 9)) } @@ -154,7 +154,7 @@ var r11 = foo((x: U) => x); >r11 : Symbol(r11, Decl(functionConstraintSatisfaction.ts, 42, 3)) >foo : Symbol(foo, Decl(functionConstraintSatisfaction.ts, 0, 0)) >U : Symbol(U, Decl(functionConstraintSatisfaction.ts, 42, 15)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(functionConstraintSatisfaction.ts, 42, 31)) >U : Symbol(U, Decl(functionConstraintSatisfaction.ts, 42, 15)) >x : Symbol(x, Decl(functionConstraintSatisfaction.ts, 42, 31)) @@ -193,7 +193,7 @@ var r16 = foo(c2); interface F2 extends Function { foo: string; } >F2 : Symbol(F2, Decl(functionConstraintSatisfaction.ts, 47, 18)) >Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->foo : Symbol(foo, Decl(functionConstraintSatisfaction.ts, 49, 31)) +>foo : Symbol(F2.foo, Decl(functionConstraintSatisfaction.ts, 49, 31)) var f2: F2; >f2 : Symbol(f2, Decl(functionConstraintSatisfaction.ts, 50, 3)) diff --git a/tests/baselines/reference/functionConstraintSatisfaction2.errors.txt b/tests/baselines/reference/functionConstraintSatisfaction2.errors.txt index 7b3aa92828d..7d3fa793ec8 100644 --- a/tests/baselines/reference/functionConstraintSatisfaction2.errors.txt +++ b/tests/baselines/reference/functionConstraintSatisfaction2.errors.txt @@ -1,12 +1,11 @@ tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(5,5): error TS2345: Argument of type 'number' is not assignable to parameter of type 'Function'. - Property 'apply' is missing in type 'Number'. tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(6,1): error TS2346: Supplied parameters do not match any signature of call target. tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(7,1): error TS2346: Supplied parameters do not match any signature of call target. tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(23,14): error TS2345: Argument of type 'Function' is not assignable to parameter of type '(x: string) => string'. Type 'Function' provides no match for the signature '(x: string): string' tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(24,15): error TS2345: Argument of type '(x: string[]) => string[]' is not assignable to parameter of type '(x: string) => string'. Types of parameters 'x' and 'x' are incompatible. - Type 'string[]' is not assignable to type 'string'. + Type 'string' is not assignable to type 'string[]'. tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(25,15): error TS2345: Argument of type 'typeof C' is not assignable to parameter of type '(x: string) => string'. Type 'typeof C' provides no match for the signature '(x: string): string' tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(26,15): error TS2345: Argument of type 'new (x: string) => string' is not assignable to parameter of type '(x: string) => string'. @@ -20,9 +19,11 @@ tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstrain Type 'F2' provides no match for the signature '(x: string): string' tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(37,10): error TS2345: Argument of type 'T' is not assignable to parameter of type '(x: string) => string'. Type '() => void' is not assignable to type '(x: string) => string'. + Type 'void' is not assignable to type 'string'. tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(38,10): error TS2345: Argument of type 'U' is not assignable to parameter of type '(x: string) => string'. Type 'T' is not assignable to type '(x: string) => string'. Type '() => void' is not assignable to type '(x: string) => string'. + Type 'void' is not assignable to type 'string'. ==== tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts (13 errors) ==== @@ -33,7 +34,6 @@ tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstrain foo(1); ~ !!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'Function'. -!!! error TS2345: Property 'apply' is missing in type 'Number'. foo(() => { }, 1); ~~~~~~~~~~~~~~~~~ !!! error TS2346: Supplied parameters do not match any signature of call target. @@ -63,7 +63,7 @@ tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstrain ~~~~~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: string[]) => string[]' is not assignable to parameter of type '(x: string) => string'. !!! error TS2345: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2345: Type 'string[]' is not assignable to type 'string'. +!!! error TS2345: Type 'string' is not assignable to type 'string[]'. var r6 = foo2(C); ~ !!! error TS2345: Argument of type 'typeof C' is not assignable to parameter of type '(x: string) => string'. @@ -97,10 +97,12 @@ tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstrain ~ !!! error TS2345: Argument of type 'T' is not assignable to parameter of type '(x: string) => string'. !!! error TS2345: Type '() => void' is not assignable to type '(x: string) => string'. +!!! error TS2345: Type 'void' is not assignable to type 'string'. foo2(y); ~ !!! error TS2345: Argument of type 'U' is not assignable to parameter of type '(x: string) => string'. !!! error TS2345: Type 'T' is not assignable to type '(x: string) => string'. !!! error TS2345: Type '() => void' is not assignable to type '(x: string) => string'. +!!! error TS2345: Type 'void' is not assignable to type 'string'. } \ No newline at end of file diff --git a/tests/baselines/reference/functionConstraintSatisfaction3.symbols b/tests/baselines/reference/functionConstraintSatisfaction3.symbols index 74f3a65aa8e..70f71602c06 100644 --- a/tests/baselines/reference/functionConstraintSatisfaction3.symbols +++ b/tests/baselines/reference/functionConstraintSatisfaction3.symbols @@ -23,7 +23,7 @@ class C { >C : Symbol(C, Decl(functionConstraintSatisfaction3.ts, 7, 9)) foo: string; ->foo : Symbol(foo, Decl(functionConstraintSatisfaction3.ts, 9, 9)) +>foo : Symbol(C.foo, Decl(functionConstraintSatisfaction3.ts, 9, 9)) } var a: { (): string }; @@ -88,7 +88,7 @@ class C2 { >T : Symbol(T, Decl(functionConstraintSatisfaction3.ts, 29, 9)) foo: T; ->foo : Symbol(foo, Decl(functionConstraintSatisfaction3.ts, 29, 13)) +>foo : Symbol(C2.foo, Decl(functionConstraintSatisfaction3.ts, 29, 13)) >T : Symbol(T, Decl(functionConstraintSatisfaction3.ts, 29, 9)) } diff --git a/tests/baselines/reference/functionExpressionContextualTyping1.symbols b/tests/baselines/reference/functionExpressionContextualTyping1.symbols index 736fa86b9ca..7d4b0ccbb6b 100644 --- a/tests/baselines/reference/functionExpressionContextualTyping1.symbols +++ b/tests/baselines/reference/functionExpressionContextualTyping1.symbols @@ -30,14 +30,14 @@ class Class { >T : Symbol(T, Decl(functionExpressionContextualTyping1.ts, 13, 12)) foo() { } ->foo : Symbol(foo, Decl(functionExpressionContextualTyping1.ts, 13, 16)) +>foo : Symbol(Class.foo, Decl(functionExpressionContextualTyping1.ts, 13, 16)) } var a1: (c: Class) => number = (a1) => { >a1 : Symbol(a1, Decl(functionExpressionContextualTyping1.ts, 17, 3)) >c : Symbol(c, Decl(functionExpressionContextualTyping1.ts, 17, 9)) >Class : Symbol(Class, Decl(functionExpressionContextualTyping1.ts, 11, 1)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >a1 : Symbol(a1, Decl(functionExpressionContextualTyping1.ts, 17, 40)) a1.foo(); diff --git a/tests/baselines/reference/functionImplementationErrors.errors.txt b/tests/baselines/reference/functionImplementationErrors.errors.txt index 86ecb6a6057..dc5ad5a2747 100644 --- a/tests/baselines/reference/functionImplementationErrors.errors.txt +++ b/tests/baselines/reference/functionImplementationErrors.errors.txt @@ -30,13 +30,10 @@ tests/cases/conformance/functions/functionImplementationErrors.ts(70,11): error }; var f3 = () => { ~~~~~~~ - return ''; - ~~~~~~~~~~~~~~ - return 3; - ~~~~~~~~~~~~~ - }; - ~ !!! error TS2354: No best common type exists among return expressions. + return ''; + return 3; + }; // FunctionExpression with no return type annotation with return branch of number[] and other of string[] var f4 = function () { @@ -94,13 +91,10 @@ tests/cases/conformance/functions/functionImplementationErrors.ts(70,11): error }; var f10 = () => { ~~~~~~~ - return new Derived1(); - ~~~~~~~~~~~~~~~~~~~~~~~~~~ - return new Derived2(); - ~~~~~~~~~~~~~~~~~~~~~~~~~~ - }; - ~ !!! error TS2354: No best common type exists among return expressions. + return new Derived1(); + return new Derived2(); + }; function f11() { ~~~ !!! error TS2354: No best common type exists among return expressions. @@ -115,11 +109,8 @@ tests/cases/conformance/functions/functionImplementationErrors.ts(70,11): error }; var f13 = () => { ~~~~~~~ - return new Base(); - ~~~~~~~~~~~~~~~~~~~~~~ - return new AnotherClass(); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - }; - ~ !!! error TS2354: No best common type exists among return expressions. + return new Base(); + return new AnotherClass(); + }; \ No newline at end of file diff --git a/tests/baselines/reference/functionImplementations.symbols b/tests/baselines/reference/functionImplementations.symbols index 07945b5f765..1d8c5b2618b 100644 --- a/tests/baselines/reference/functionImplementations.symbols +++ b/tests/baselines/reference/functionImplementations.symbols @@ -150,12 +150,12 @@ var n = function () { // FunctionExpression with no return type annotation with multiple return statements with subtype relation between returns class Base { private m; } >Base : Symbol(Base, Decl(functionImplementations.ts, 70, 4)) ->m : Symbol(m, Decl(functionImplementations.ts, 77, 12)) +>m : Symbol(Base.m, Decl(functionImplementations.ts, 77, 12)) class Derived extends Base { private q; } >Derived : Symbol(Derived, Decl(functionImplementations.ts, 77, 25)) >Base : Symbol(Base, Decl(functionImplementations.ts, 70, 4)) ->q : Symbol(q, Decl(functionImplementations.ts, 78, 28)) +>q : Symbol(Derived.q, Decl(functionImplementations.ts, 78, 28)) var b: Base; >b : Symbol(b, Decl(functionImplementations.ts, 79, 3), Decl(functionImplementations.ts, 80, 3)) @@ -261,11 +261,11 @@ function f6(): number { class Derived2 extends Base { private r: string; } >Derived2 : Symbol(Derived2, Decl(functionImplementations.ts, 124, 1)) >Base : Symbol(Base, Decl(functionImplementations.ts, 70, 4)) ->r : Symbol(r, Decl(functionImplementations.ts, 126, 29)) +>r : Symbol(Derived2.r, Decl(functionImplementations.ts, 126, 29)) class AnotherClass { private x } >AnotherClass : Symbol(AnotherClass, Decl(functionImplementations.ts, 126, 50)) ->x : Symbol(x, Decl(functionImplementations.ts, 127, 20)) +>x : Symbol(AnotherClass.x, Decl(functionImplementations.ts, 127, 20)) // if f is a contextually typed function expression, the inferred return type is the union type // of the types of the return statement expressions in the function body, diff --git a/tests/baselines/reference/functionLikeInParameterInitializer.errors.txt b/tests/baselines/reference/functionLikeInParameterInitializer.errors.txt new file mode 100644 index 00000000000..b6ae78623b8 --- /dev/null +++ b/tests/baselines/reference/functionLikeInParameterInitializer.errors.txt @@ -0,0 +1,34 @@ +tests/cases/compiler/functionLikeInParameterInitializer.ts(2,34): error TS2373: Initializer of parameter 'func' cannot reference identifier 'foo' declared after it. +tests/cases/compiler/functionLikeInParameterInitializer.ts(6,44): error TS2373: Initializer of parameter 'func' cannot reference identifier 'foo' declared after it. +tests/cases/compiler/functionLikeInParameterInitializer.ts(11,50): error TS2373: Initializer of parameter 'func' cannot reference identifier 'foo' declared after it. +tests/cases/compiler/functionLikeInParameterInitializer.ts(16,41): error TS2373: Initializer of parameter 'func' cannot reference identifier 'foo' declared after it. + + +==== tests/cases/compiler/functionLikeInParameterInitializer.ts (4 errors) ==== + // error + export function bar(func = () => foo) { + ~~~ +!!! error TS2373: Initializer of parameter 'func' cannot reference identifier 'foo' declared after it. + let foo = "in"; + } + // error + export function baz1(func = { f() { return foo } }) { + ~~~ +!!! error TS2373: Initializer of parameter 'func' cannot reference identifier 'foo' declared after it. + let foo = "in"; + } + + // error + export function baz2(func = function () { return foo }) { + ~~~ +!!! error TS2373: Initializer of parameter 'func' cannot reference identifier 'foo' declared after it. + let foo = "in"; + } + + // error + export function baz3(func = class { x = foo }) { + ~~~ +!!! error TS2373: Initializer of parameter 'func' cannot reference identifier 'foo' declared after it. + let foo = "in"; + } + \ No newline at end of file diff --git a/tests/baselines/reference/functionLikeInParameterInitializer.js b/tests/baselines/reference/functionLikeInParameterInitializer.js new file mode 100644 index 00000000000..bf1d887b435 --- /dev/null +++ b/tests/baselines/reference/functionLikeInParameterInitializer.js @@ -0,0 +1,52 @@ +//// [functionLikeInParameterInitializer.ts] +// error +export function bar(func = () => foo) { + let foo = "in"; +} +// error +export function baz1(func = { f() { return foo } }) { + let foo = "in"; +} + +// error +export function baz2(func = function () { return foo }) { + let foo = "in"; +} + +// error +export function baz3(func = class { x = foo }) { + let foo = "in"; +} + + +//// [functionLikeInParameterInitializer.js] +"use strict"; +// error +function bar(func) { + if (func === void 0) { func = function () { return foo; }; } + var foo = "in"; +} +exports.bar = bar; +// error +function baz1(func) { + if (func === void 0) { func = { f: function () { return foo; } }; } + var foo = "in"; +} +exports.baz1 = baz1; +// error +function baz2(func) { + if (func === void 0) { func = function () { return foo; }; } + var foo = "in"; +} +exports.baz2 = baz2; +// error +function baz3(func) { + if (func === void 0) { func = (function () { + function class_1() { + this.x = foo; + } + return class_1; + }()); } + var foo = "in"; +} +exports.baz3 = baz3; diff --git a/tests/baselines/reference/functionOverloadErrors.errors.txt b/tests/baselines/reference/functionOverloadErrors.errors.txt index ae1dfeae4d1..1ec0344ac62 100644 --- a/tests/baselines/reference/functionOverloadErrors.errors.txt +++ b/tests/baselines/reference/functionOverloadErrors.errors.txt @@ -4,8 +4,8 @@ tests/cases/conformance/functions/functionOverloadErrors.ts(50,25): error TS2304 tests/cases/conformance/functions/functionOverloadErrors.ts(51,32): error TS2304: Cannot find name 'window'. tests/cases/conformance/functions/functionOverloadErrors.ts(65,13): error TS2385: Overload signatures must all be public, private or protected. tests/cases/conformance/functions/functionOverloadErrors.ts(68,13): error TS2385: Overload signatures must all be public, private or protected. -tests/cases/conformance/functions/functionOverloadErrors.ts(75,21): error TS2383: Overload signatures must all be exported or not exported. -tests/cases/conformance/functions/functionOverloadErrors.ts(79,14): error TS2383: Overload signatures must all be exported or not exported. +tests/cases/conformance/functions/functionOverloadErrors.ts(75,21): error TS2383: Overload signatures must all be exported or non-exported. +tests/cases/conformance/functions/functionOverloadErrors.ts(79,14): error TS2383: Overload signatures must all be exported or non-exported. tests/cases/conformance/functions/functionOverloadErrors.ts(85,18): error TS2384: Overload signatures must all be ambient or non-ambient. tests/cases/conformance/functions/functionOverloadErrors.ts(90,18): error TS2384: Overload signatures must all be ambient or non-ambient. tests/cases/conformance/functions/functionOverloadErrors.ts(94,10): error TS2394: Overload signature is not compatible with function implementation. @@ -103,13 +103,13 @@ tests/cases/conformance/functions/functionOverloadErrors.ts(116,19): error TS237 module M { export function fn1(); ~~~ -!!! error TS2383: Overload signatures must all be exported or not exported. +!!! error TS2383: Overload signatures must all be exported or non-exported. function fn1(n: string); function fn1() { } function fn2(n: string); ~~~ -!!! error TS2383: Overload signatures must all be exported or not exported. +!!! error TS2383: Overload signatures must all be exported or non-exported. export function fn2(); export function fn2() { } } diff --git a/tests/baselines/reference/functionOverloads44.symbols b/tests/baselines/reference/functionOverloads44.symbols index 3520777a835..9b1ef6c93a8 100644 --- a/tests/baselines/reference/functionOverloads44.symbols +++ b/tests/baselines/reference/functionOverloads44.symbols @@ -1,17 +1,17 @@ === tests/cases/compiler/functionOverloads44.ts === interface Animal { animal } >Animal : Symbol(Animal, Decl(functionOverloads44.ts, 0, 0)) ->animal : Symbol(animal, Decl(functionOverloads44.ts, 0, 18)) +>animal : Symbol(Animal.animal, Decl(functionOverloads44.ts, 0, 18)) interface Dog extends Animal { dog } >Dog : Symbol(Dog, Decl(functionOverloads44.ts, 0, 27)) >Animal : Symbol(Animal, Decl(functionOverloads44.ts, 0, 0)) ->dog : Symbol(dog, Decl(functionOverloads44.ts, 1, 30)) +>dog : Symbol(Dog.dog, Decl(functionOverloads44.ts, 1, 30)) interface Cat extends Animal { cat } >Cat : Symbol(Cat, Decl(functionOverloads44.ts, 1, 36)) >Animal : Symbol(Animal, Decl(functionOverloads44.ts, 0, 0)) ->cat : Symbol(cat, Decl(functionOverloads44.ts, 2, 30)) +>cat : Symbol(Cat.cat, Decl(functionOverloads44.ts, 2, 30)) function foo1(bar: { a:number }[]): Dog; >foo1 : Symbol(foo1, Decl(functionOverloads44.ts, 2, 36), Decl(functionOverloads44.ts, 4, 40), Decl(functionOverloads44.ts, 5, 43)) diff --git a/tests/baselines/reference/functionOverloads45.symbols b/tests/baselines/reference/functionOverloads45.symbols index 28599339099..628ab14e3d1 100644 --- a/tests/baselines/reference/functionOverloads45.symbols +++ b/tests/baselines/reference/functionOverloads45.symbols @@ -1,17 +1,17 @@ === tests/cases/compiler/functionOverloads45.ts === interface Animal { animal } >Animal : Symbol(Animal, Decl(functionOverloads45.ts, 0, 0)) ->animal : Symbol(animal, Decl(functionOverloads45.ts, 0, 18)) +>animal : Symbol(Animal.animal, Decl(functionOverloads45.ts, 0, 18)) interface Dog extends Animal { dog } >Dog : Symbol(Dog, Decl(functionOverloads45.ts, 0, 27)) >Animal : Symbol(Animal, Decl(functionOverloads45.ts, 0, 0)) ->dog : Symbol(dog, Decl(functionOverloads45.ts, 1, 30)) +>dog : Symbol(Dog.dog, Decl(functionOverloads45.ts, 1, 30)) interface Cat extends Animal { cat } >Cat : Symbol(Cat, Decl(functionOverloads45.ts, 1, 36)) >Animal : Symbol(Animal, Decl(functionOverloads45.ts, 0, 0)) ->cat : Symbol(cat, Decl(functionOverloads45.ts, 2, 30)) +>cat : Symbol(Cat.cat, Decl(functionOverloads45.ts, 2, 30)) function foo1(bar: { a:number }[]): Cat; >foo1 : Symbol(foo1, Decl(functionOverloads45.ts, 2, 36), Decl(functionOverloads45.ts, 4, 40), Decl(functionOverloads45.ts, 5, 40)) diff --git a/tests/baselines/reference/functionOverloads7.symbols b/tests/baselines/reference/functionOverloads7.symbols index 1d2fe3ea6a2..f1b29f951e7 100644 --- a/tests/baselines/reference/functionOverloads7.symbols +++ b/tests/baselines/reference/functionOverloads7.symbols @@ -3,30 +3,30 @@ class foo { >foo : Symbol(foo, Decl(functionOverloads7.ts, 0, 0)) private bar(); ->bar : Symbol(bar, Decl(functionOverloads7.ts, 0, 11), Decl(functionOverloads7.ts, 1, 17), Decl(functionOverloads7.ts, 2, 28)) +>bar : Symbol(foo.bar, Decl(functionOverloads7.ts, 0, 11), Decl(functionOverloads7.ts, 1, 17), Decl(functionOverloads7.ts, 2, 28)) private bar(foo: string); ->bar : Symbol(bar, Decl(functionOverloads7.ts, 0, 11), Decl(functionOverloads7.ts, 1, 17), Decl(functionOverloads7.ts, 2, 28)) +>bar : Symbol(foo.bar, Decl(functionOverloads7.ts, 0, 11), Decl(functionOverloads7.ts, 1, 17), Decl(functionOverloads7.ts, 2, 28)) >foo : Symbol(foo, Decl(functionOverloads7.ts, 2, 15)) private bar(foo?: any){ return "foo" } ->bar : Symbol(bar, Decl(functionOverloads7.ts, 0, 11), Decl(functionOverloads7.ts, 1, 17), Decl(functionOverloads7.ts, 2, 28)) +>bar : Symbol(foo.bar, Decl(functionOverloads7.ts, 0, 11), Decl(functionOverloads7.ts, 1, 17), Decl(functionOverloads7.ts, 2, 28)) >foo : Symbol(foo, Decl(functionOverloads7.ts, 3, 15)) public n() { ->n : Symbol(n, Decl(functionOverloads7.ts, 3, 41)) +>n : Symbol(foo.n, Decl(functionOverloads7.ts, 3, 41)) var foo = this.bar(); >foo : Symbol(foo, Decl(functionOverloads7.ts, 5, 8)) ->this.bar : Symbol(bar, Decl(functionOverloads7.ts, 0, 11), Decl(functionOverloads7.ts, 1, 17), Decl(functionOverloads7.ts, 2, 28)) +>this.bar : Symbol(foo.bar, Decl(functionOverloads7.ts, 0, 11), Decl(functionOverloads7.ts, 1, 17), Decl(functionOverloads7.ts, 2, 28)) >this : Symbol(foo, Decl(functionOverloads7.ts, 0, 0)) ->bar : Symbol(bar, Decl(functionOverloads7.ts, 0, 11), Decl(functionOverloads7.ts, 1, 17), Decl(functionOverloads7.ts, 2, 28)) +>bar : Symbol(foo.bar, Decl(functionOverloads7.ts, 0, 11), Decl(functionOverloads7.ts, 1, 17), Decl(functionOverloads7.ts, 2, 28)) foo = this.bar("test"); >foo : Symbol(foo, Decl(functionOverloads7.ts, 5, 8)) ->this.bar : Symbol(bar, Decl(functionOverloads7.ts, 0, 11), Decl(functionOverloads7.ts, 1, 17), Decl(functionOverloads7.ts, 2, 28)) +>this.bar : Symbol(foo.bar, Decl(functionOverloads7.ts, 0, 11), Decl(functionOverloads7.ts, 1, 17), Decl(functionOverloads7.ts, 2, 28)) >this : Symbol(foo, Decl(functionOverloads7.ts, 0, 0)) ->bar : Symbol(bar, Decl(functionOverloads7.ts, 0, 11), Decl(functionOverloads7.ts, 1, 17), Decl(functionOverloads7.ts, 2, 28)) +>bar : Symbol(foo.bar, Decl(functionOverloads7.ts, 0, 11), Decl(functionOverloads7.ts, 1, 17), Decl(functionOverloads7.ts, 2, 28)) } } diff --git a/tests/baselines/reference/functionOverloadsOnGenericArity1.symbols b/tests/baselines/reference/functionOverloadsOnGenericArity1.symbols index d4721e5ec08..57c1edcd8f0 100644 --- a/tests/baselines/reference/functionOverloadsOnGenericArity1.symbols +++ b/tests/baselines/reference/functionOverloadsOnGenericArity1.symbols @@ -4,11 +4,11 @@ interface C { >C : Symbol(C, Decl(functionOverloadsOnGenericArity1.ts, 0, 0)) f(): string; ->f : Symbol(f, Decl(functionOverloadsOnGenericArity1.ts, 1, 13), Decl(functionOverloadsOnGenericArity1.ts, 2, 18)) +>f : Symbol(C.f, Decl(functionOverloadsOnGenericArity1.ts, 1, 13), Decl(functionOverloadsOnGenericArity1.ts, 2, 18)) >T : Symbol(T, Decl(functionOverloadsOnGenericArity1.ts, 2, 5)) f(): string; ->f : Symbol(f, Decl(functionOverloadsOnGenericArity1.ts, 1, 13), Decl(functionOverloadsOnGenericArity1.ts, 2, 18)) +>f : Symbol(C.f, Decl(functionOverloadsOnGenericArity1.ts, 1, 13), Decl(functionOverloadsOnGenericArity1.ts, 2, 18)) >T : Symbol(T, Decl(functionOverloadsOnGenericArity1.ts, 3, 5)) >U : Symbol(U, Decl(functionOverloadsOnGenericArity1.ts, 3, 7)) diff --git a/tests/baselines/reference/functionOverloadsOnGenericArity2.symbols b/tests/baselines/reference/functionOverloadsOnGenericArity2.symbols index 0dda3ba81a8..750da358d67 100644 --- a/tests/baselines/reference/functionOverloadsOnGenericArity2.symbols +++ b/tests/baselines/reference/functionOverloadsOnGenericArity2.symbols @@ -3,18 +3,18 @@ interface I { >I : Symbol(I, Decl(functionOverloadsOnGenericArity2.ts, 0, 0)) then(p: string): string; ->then : Symbol(then, Decl(functionOverloadsOnGenericArity2.ts, 0, 13), Decl(functionOverloadsOnGenericArity2.ts, 1, 28), Decl(functionOverloadsOnGenericArity2.ts, 2, 31)) +>then : Symbol(I.then, Decl(functionOverloadsOnGenericArity2.ts, 0, 13), Decl(functionOverloadsOnGenericArity2.ts, 1, 28), Decl(functionOverloadsOnGenericArity2.ts, 2, 31)) >p : Symbol(p, Decl(functionOverloadsOnGenericArity2.ts, 1, 9)) then(p: string): string; ->then : Symbol(then, Decl(functionOverloadsOnGenericArity2.ts, 0, 13), Decl(functionOverloadsOnGenericArity2.ts, 1, 28), Decl(functionOverloadsOnGenericArity2.ts, 2, 31)) +>then : Symbol(I.then, Decl(functionOverloadsOnGenericArity2.ts, 0, 13), Decl(functionOverloadsOnGenericArity2.ts, 1, 28), Decl(functionOverloadsOnGenericArity2.ts, 2, 31)) >U : Symbol(U, Decl(functionOverloadsOnGenericArity2.ts, 2, 9)) >p : Symbol(p, Decl(functionOverloadsOnGenericArity2.ts, 2, 12)) then(p: string): Date; ->then : Symbol(then, Decl(functionOverloadsOnGenericArity2.ts, 0, 13), Decl(functionOverloadsOnGenericArity2.ts, 1, 28), Decl(functionOverloadsOnGenericArity2.ts, 2, 31)) +>then : Symbol(I.then, Decl(functionOverloadsOnGenericArity2.ts, 0, 13), Decl(functionOverloadsOnGenericArity2.ts, 1, 28), Decl(functionOverloadsOnGenericArity2.ts, 2, 31)) >U : Symbol(U, Decl(functionOverloadsOnGenericArity2.ts, 3, 9)) >T : Symbol(T, Decl(functionOverloadsOnGenericArity2.ts, 3, 11)) >p : Symbol(p, Decl(functionOverloadsOnGenericArity2.ts, 3, 15)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) } diff --git a/tests/baselines/reference/functionOverloadsRecursiveGenericReturnType.symbols b/tests/baselines/reference/functionOverloadsRecursiveGenericReturnType.symbols index 42ed87e64d1..67f6545d387 100644 --- a/tests/baselines/reference/functionOverloadsRecursiveGenericReturnType.symbols +++ b/tests/baselines/reference/functionOverloadsRecursiveGenericReturnType.symbols @@ -4,7 +4,7 @@ class B{ >V : Symbol(V, Decl(functionOverloadsRecursiveGenericReturnType.ts, 0, 8)) private id: V; ->id : Symbol(id, Decl(functionOverloadsRecursiveGenericReturnType.ts, 0, 11)) +>id : Symbol(B.id, Decl(functionOverloadsRecursiveGenericReturnType.ts, 0, 11)) >V : Symbol(V, Decl(functionOverloadsRecursiveGenericReturnType.ts, 0, 8)) } @@ -13,7 +13,7 @@ class A{ >U : Symbol(U, Decl(functionOverloadsRecursiveGenericReturnType.ts, 4, 8)) GetEnumerator: () => B; ->GetEnumerator : Symbol(GetEnumerator, Decl(functionOverloadsRecursiveGenericReturnType.ts, 4, 11)) +>GetEnumerator : Symbol(A.GetEnumerator, Decl(functionOverloadsRecursiveGenericReturnType.ts, 4, 11)) >B : Symbol(B, Decl(functionOverloadsRecursiveGenericReturnType.ts, 0, 0)) >U : Symbol(U, Decl(functionOverloadsRecursiveGenericReturnType.ts, 4, 8)) } diff --git a/tests/baselines/reference/functionSignatureAssignmentCompat1.errors.txt b/tests/baselines/reference/functionSignatureAssignmentCompat1.errors.txt index 86c4728dda2..f91a4f91547 100644 --- a/tests/baselines/reference/functionSignatureAssignmentCompat1.errors.txt +++ b/tests/baselines/reference/functionSignatureAssignmentCompat1.errors.txt @@ -1,6 +1,6 @@ tests/cases/compiler/functionSignatureAssignmentCompat1.ts(10,5): error TS2322: Type '(delimiter?: string) => ParserFunc' is not assignable to type 'ParserFunc'. Types of parameters 'delimiter' and 'eventEmitter' are incompatible. - Type 'string' is not assignable to type 'number'. + Type 'number' is not assignable to type 'string'. ==== tests/cases/compiler/functionSignatureAssignmentCompat1.ts (1 errors) ==== @@ -17,5 +17,5 @@ tests/cases/compiler/functionSignatureAssignmentCompat1.ts(10,5): error TS2322: ~ !!! error TS2322: Type '(delimiter?: string) => ParserFunc' is not assignable to type 'ParserFunc'. !!! error TS2322: Types of parameters 'delimiter' and 'eventEmitter' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. var e: ParserFunc = parsers.readline(); // ok \ No newline at end of file diff --git a/tests/baselines/reference/functionSubtypingOfVarArgs.symbols b/tests/baselines/reference/functionSubtypingOfVarArgs.symbols index 3aa266ec030..b77b48590e8 100644 --- a/tests/baselines/reference/functionSubtypingOfVarArgs.symbols +++ b/tests/baselines/reference/functionSubtypingOfVarArgs.symbols @@ -3,18 +3,18 @@ class EventBase { >EventBase : Symbol(EventBase, Decl(functionSubtypingOfVarArgs.ts, 0, 0)) private _listeners = []; ->_listeners : Symbol(_listeners, Decl(functionSubtypingOfVarArgs.ts, 0, 17)) +>_listeners : Symbol(EventBase._listeners, Decl(functionSubtypingOfVarArgs.ts, 0, 17)) add(listener: (...args: any[]) => void): void { ->add : Symbol(add, Decl(functionSubtypingOfVarArgs.ts, 1, 28)) +>add : Symbol(EventBase.add, Decl(functionSubtypingOfVarArgs.ts, 1, 28)) >listener : Symbol(listener, Decl(functionSubtypingOfVarArgs.ts, 3, 8)) >args : Symbol(args, Decl(functionSubtypingOfVarArgs.ts, 3, 19)) this._listeners.push(listener); >this._listeners.push : Symbol(Array.push, Decl(lib.d.ts, --, --)) ->this._listeners : Symbol(_listeners, Decl(functionSubtypingOfVarArgs.ts, 0, 17)) +>this._listeners : Symbol(EventBase._listeners, Decl(functionSubtypingOfVarArgs.ts, 0, 17)) >this : Symbol(EventBase, Decl(functionSubtypingOfVarArgs.ts, 0, 0)) ->_listeners : Symbol(_listeners, Decl(functionSubtypingOfVarArgs.ts, 0, 17)) +>_listeners : Symbol(EventBase._listeners, Decl(functionSubtypingOfVarArgs.ts, 0, 17)) >push : Symbol(Array.push, Decl(lib.d.ts, --, --)) >listener : Symbol(listener, Decl(functionSubtypingOfVarArgs.ts, 3, 8)) } @@ -25,7 +25,7 @@ class StringEvent extends EventBase { // should work >EventBase : Symbol(EventBase, Decl(functionSubtypingOfVarArgs.ts, 0, 0)) add(listener: (items: string) => void ) { // valid, items is subtype of args ->add : Symbol(add, Decl(functionSubtypingOfVarArgs.ts, 8, 37)) +>add : Symbol(StringEvent.add, Decl(functionSubtypingOfVarArgs.ts, 8, 37)) >listener : Symbol(listener, Decl(functionSubtypingOfVarArgs.ts, 9, 8)) >items : Symbol(items, Decl(functionSubtypingOfVarArgs.ts, 9, 19)) diff --git a/tests/baselines/reference/functionSubtypingOfVarArgs2.symbols b/tests/baselines/reference/functionSubtypingOfVarArgs2.symbols index c2f77199e28..f624730fd0c 100644 --- a/tests/baselines/reference/functionSubtypingOfVarArgs2.symbols +++ b/tests/baselines/reference/functionSubtypingOfVarArgs2.symbols @@ -3,19 +3,19 @@ class EventBase { >EventBase : Symbol(EventBase, Decl(functionSubtypingOfVarArgs2.ts, 0, 0)) private _listeners: { (...args: any[]): void; }[] = []; ->_listeners : Symbol(_listeners, Decl(functionSubtypingOfVarArgs2.ts, 0, 17)) +>_listeners : Symbol(EventBase._listeners, Decl(functionSubtypingOfVarArgs2.ts, 0, 17)) >args : Symbol(args, Decl(functionSubtypingOfVarArgs2.ts, 1, 27)) add(listener: (...args: any[]) => void): void { ->add : Symbol(add, Decl(functionSubtypingOfVarArgs2.ts, 1, 59)) +>add : Symbol(EventBase.add, Decl(functionSubtypingOfVarArgs2.ts, 1, 59)) >listener : Symbol(listener, Decl(functionSubtypingOfVarArgs2.ts, 3, 8)) >args : Symbol(args, Decl(functionSubtypingOfVarArgs2.ts, 3, 19)) this._listeners.push(listener); >this._listeners.push : Symbol(Array.push, Decl(lib.d.ts, --, --)) ->this._listeners : Symbol(_listeners, Decl(functionSubtypingOfVarArgs2.ts, 0, 17)) +>this._listeners : Symbol(EventBase._listeners, Decl(functionSubtypingOfVarArgs2.ts, 0, 17)) >this : Symbol(EventBase, Decl(functionSubtypingOfVarArgs2.ts, 0, 0)) ->_listeners : Symbol(_listeners, Decl(functionSubtypingOfVarArgs2.ts, 0, 17)) +>_listeners : Symbol(EventBase._listeners, Decl(functionSubtypingOfVarArgs2.ts, 0, 17)) >push : Symbol(Array.push, Decl(lib.d.ts, --, --)) >listener : Symbol(listener, Decl(functionSubtypingOfVarArgs2.ts, 3, 8)) } @@ -26,7 +26,7 @@ class StringEvent extends EventBase { >EventBase : Symbol(EventBase, Decl(functionSubtypingOfVarArgs2.ts, 0, 0)) add(listener: (items: string, moreitems: number) => void ) { ->add : Symbol(add, Decl(functionSubtypingOfVarArgs2.ts, 8, 37)) +>add : Symbol(StringEvent.add, Decl(functionSubtypingOfVarArgs2.ts, 8, 37)) >listener : Symbol(listener, Decl(functionSubtypingOfVarArgs2.ts, 9, 8)) >items : Symbol(items, Decl(functionSubtypingOfVarArgs2.ts, 9, 19)) >moreitems : Symbol(moreitems, Decl(functionSubtypingOfVarArgs2.ts, 9, 33)) diff --git a/tests/baselines/reference/functionType.types b/tests/baselines/reference/functionType.types index e7ea7a47edf..ac3d5c9944d 100644 --- a/tests/baselines/reference/functionType.types +++ b/tests/baselines/reference/functionType.types @@ -4,9 +4,9 @@ function salt() {} salt.apply("hello", []); >salt.apply("hello", []) : any ->salt.apply : (thisArg: any, argArray?: any) => any +>salt.apply : (this: Function, thisArg: any, argArray?: any) => any >salt : () => void ->apply : (thisArg: any, argArray?: any) => any +>apply : (this: Function, thisArg: any, argArray?: any) => any >"hello" : string >[] : undefined[] diff --git a/tests/baselines/reference/functionTypeArgumentArrayAssignment.symbols b/tests/baselines/reference/functionTypeArgumentArrayAssignment.symbols index 4b597bea9ae..33bf258606e 100644 --- a/tests/baselines/reference/functionTypeArgumentArrayAssignment.symbols +++ b/tests/baselines/reference/functionTypeArgumentArrayAssignment.symbols @@ -7,11 +7,11 @@ module test { >T : Symbol(T, Decl(functionTypeArgumentArrayAssignment.ts, 1, 20)) foo: T; ->foo : Symbol(foo, Decl(functionTypeArgumentArrayAssignment.ts, 1, 24)) +>foo : Symbol(Array.foo, Decl(functionTypeArgumentArrayAssignment.ts, 1, 24)) >T : Symbol(T, Decl(functionTypeArgumentArrayAssignment.ts, 1, 20)) length: number; ->length : Symbol(length, Decl(functionTypeArgumentArrayAssignment.ts, 2, 15)) +>length : Symbol(Array.length, Decl(functionTypeArgumentArrayAssignment.ts, 2, 15)) } function map() { diff --git a/tests/baselines/reference/functionsMissingReturnStatementsAndExpressions.errors.txt b/tests/baselines/reference/functionsMissingReturnStatementsAndExpressions.errors.txt index 58ffd051d4d..1ccc296b75b 100644 --- a/tests/baselines/reference/functionsMissingReturnStatementsAndExpressions.errors.txt +++ b/tests/baselines/reference/functionsMissingReturnStatementsAndExpressions.errors.txt @@ -1,9 +1,10 @@ tests/cases/compiler/functionsMissingReturnStatementsAndExpressions.ts(3,16): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value. -tests/cases/compiler/functionsMissingReturnStatementsAndExpressions.ts(95,16): error TS2378: A 'get' accessor must return a value. -tests/cases/compiler/functionsMissingReturnStatementsAndExpressions.ts(118,5): error TS1003: Identifier expected. +tests/cases/compiler/functionsMissingReturnStatementsAndExpressions.ts(101,17): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value. +tests/cases/compiler/functionsMissingReturnStatementsAndExpressions.ts(106,16): error TS2378: A 'get' accessor must return a value. +tests/cases/compiler/functionsMissingReturnStatementsAndExpressions.ts(129,5): error TS1003: Identifier expected. -==== tests/cases/compiler/functionsMissingReturnStatementsAndExpressions.ts (3 errors) ==== +==== tests/cases/compiler/functionsMissingReturnStatementsAndExpressions.ts (4 errors) ==== function f1(): string { @@ -98,6 +99,19 @@ tests/cases/compiler/functionsMissingReturnStatementsAndExpressions.ts(118,5): e return "Okay, not type annotated."; } + function f19(): void | number { + // Okay; function return type is union containing void + } + + function f20(): any | number { + // Okay; function return type is union containing any + } + + function f21(): number | string { + ~~~~~~~~~~~~~~~ +!!! error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value. + // Not okay; union does not contain void or any + } class C { public get m1() { diff --git a/tests/baselines/reference/functionsMissingReturnStatementsAndExpressions.js b/tests/baselines/reference/functionsMissingReturnStatementsAndExpressions.js index 4dfe851683a..17468722e20 100644 --- a/tests/baselines/reference/functionsMissingReturnStatementsAndExpressions.js +++ b/tests/baselines/reference/functionsMissingReturnStatementsAndExpressions.js @@ -91,6 +91,17 @@ function f18() { return "Okay, not type annotated."; } +function f19(): void | number { + // Okay; function return type is union containing void +} + +function f20(): any | number { + // Okay; function return type is union containing any +} + +function f21(): number | string { + // Not okay; union does not contain void or any +} class C { public get m1() { @@ -191,6 +202,15 @@ function f17() { function f18() { return "Okay, not type annotated."; } +function f19() { + // Okay; function return type is union containing void +} +function f20() { + // Okay; function return type is union containing any +} +function f21() { + // Not okay; union does not contain void or any +} var C = (function () { function C() { } diff --git a/tests/baselines/reference/funduleUsedAcrossFileBoundary.symbols b/tests/baselines/reference/funduleUsedAcrossFileBoundary.symbols index e0ca752d307..b094ebbfe8c 100644 --- a/tests/baselines/reference/funduleUsedAcrossFileBoundary.symbols +++ b/tests/baselines/reference/funduleUsedAcrossFileBoundary.symbols @@ -13,7 +13,7 @@ declare module Q { >T : Symbol(T, Decl(funduleUsedAcrossFileBoundary_file1.ts, 2, 22)) foo: string; ->foo : Symbol(foo, Decl(funduleUsedAcrossFileBoundary_file1.ts, 2, 26)) +>foo : Symbol(Promise.foo, Decl(funduleUsedAcrossFileBoundary_file1.ts, 2, 26)) } export function defer(): string; >defer : Symbol(defer, Decl(funduleUsedAcrossFileBoundary_file1.ts, 4, 5)) diff --git a/tests/baselines/reference/fuzzy.errors.txt b/tests/baselines/reference/fuzzy.errors.txt index 0aa8207ff98..19f0ad56a5e 100644 --- a/tests/baselines/reference/fuzzy.errors.txt +++ b/tests/baselines/reference/fuzzy.errors.txt @@ -4,8 +4,7 @@ tests/cases/compiler/fuzzy.ts(21,20): error TS2322: Type '{ anything: number; on Types of property 'oneI' are incompatible. Type 'this' is not assignable to type 'I'. Type 'C' is not assignable to type 'I'. - Property 'alsoWorks' is missing in type 'C'. -tests/cases/compiler/fuzzy.ts(25,20): error TS2352: Neither type '{ oneI: this; }' nor type 'R' is assignable to the other. +tests/cases/compiler/fuzzy.ts(25,20): error TS2352: Type '{ oneI: this; }' cannot be converted to type 'R'. Property 'anything' is missing in type '{ oneI: this; }'. @@ -39,13 +38,12 @@ tests/cases/compiler/fuzzy.ts(25,20): error TS2352: Neither type '{ oneI: this; !!! error TS2322: Types of property 'oneI' are incompatible. !!! error TS2322: Type 'this' is not assignable to type 'I'. !!! error TS2322: Type 'C' is not assignable to type 'I'. -!!! error TS2322: Property 'alsoWorks' is missing in type 'C'. } worksToo():R { return ({ oneI: this }); ~~~~~~~~~~~~~~~~~~~ -!!! error TS2352: Neither type '{ oneI: this; }' nor type 'R' is assignable to the other. +!!! error TS2352: Type '{ oneI: this; }' cannot be converted to type 'R'. !!! error TS2352: Property 'anything' is missing in type '{ oneI: this; }'. } } diff --git a/tests/baselines/reference/generatedContextualTyping.symbols b/tests/baselines/reference/generatedContextualTyping.symbols index bc50fcc25c6..a31e38e8648 100644 --- a/tests/baselines/reference/generatedContextualTyping.symbols +++ b/tests/baselines/reference/generatedContextualTyping.symbols @@ -2,22 +2,22 @@ class Base { private p; } >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->p : Symbol(p, Decl(generatedContextualTyping.ts, 1, 12)) +>p : Symbol(Base.p, Decl(generatedContextualTyping.ts, 1, 12)) class Derived1 extends Base { private m; } >Derived1 : Symbol(Derived1, Decl(generatedContextualTyping.ts, 1, 25)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->m : Symbol(m, Decl(generatedContextualTyping.ts, 2, 29)) +>m : Symbol(Derived1.m, Decl(generatedContextualTyping.ts, 2, 29)) class Derived2 extends Base { private n; } >Derived2 : Symbol(Derived2, Decl(generatedContextualTyping.ts, 2, 42)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 3, 29)) +>n : Symbol(Derived2.n, Decl(generatedContextualTyping.ts, 3, 29)) interface Genric { func(n: T[]); } >Genric : Symbol(Genric, Decl(generatedContextualTyping.ts, 3, 42)) >T : Symbol(T, Decl(generatedContextualTyping.ts, 4, 17)) ->func : Symbol(func, Decl(generatedContextualTyping.ts, 4, 21)) +>func : Symbol(Genric.func, Decl(generatedContextualTyping.ts, 4, 21)) >n : Symbol(n, Decl(generatedContextualTyping.ts, 4, 27)) >T : Symbol(T, Decl(generatedContextualTyping.ts, 4, 17)) @@ -114,21 +114,21 @@ var x12: Genric = { func: n => { return [d1, d2]; } }; class x13 { member: () => Base[] = () => [d1, d2] } >x13 : Symbol(x13, Decl(generatedContextualTyping.ts, 17, 60)) ->member : Symbol(member, Decl(generatedContextualTyping.ts, 18, 11)) +>member : Symbol(x13.member, Decl(generatedContextualTyping.ts, 18, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) >d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x14 { member: () => Base[] = function() { return [d1, d2] } } >x14 : Symbol(x14, Decl(generatedContextualTyping.ts, 18, 51)) ->member : Symbol(member, Decl(generatedContextualTyping.ts, 19, 11)) +>member : Symbol(x14.member, Decl(generatedContextualTyping.ts, 19, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) >d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x15 { member: () => Base[] = function named() { return [d1, d2] } } >x15 : Symbol(x15, Decl(generatedContextualTyping.ts, 19, 67)) ->member : Symbol(member, Decl(generatedContextualTyping.ts, 20, 11)) +>member : Symbol(x15.member, Decl(generatedContextualTyping.ts, 20, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >named : Symbol(named, Decl(generatedContextualTyping.ts, 20, 34)) >d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) @@ -136,21 +136,21 @@ class x15 { member: () => Base[] = function named() { return [d1, d2] } } class x16 { member: { (): Base[]; } = () => [d1, d2] } >x16 : Symbol(x16, Decl(generatedContextualTyping.ts, 20, 73)) ->member : Symbol(member, Decl(generatedContextualTyping.ts, 21, 11)) +>member : Symbol(x16.member, Decl(generatedContextualTyping.ts, 21, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) >d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x17 { member: { (): Base[]; } = function() { return [d1, d2] } } >x17 : Symbol(x17, Decl(generatedContextualTyping.ts, 21, 54)) ->member : Symbol(member, Decl(generatedContextualTyping.ts, 22, 11)) +>member : Symbol(x17.member, Decl(generatedContextualTyping.ts, 22, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) >d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x18 { member: { (): Base[]; } = function named() { return [d1, d2] } } >x18 : Symbol(x18, Decl(generatedContextualTyping.ts, 22, 70)) ->member : Symbol(member, Decl(generatedContextualTyping.ts, 23, 11)) +>member : Symbol(x18.member, Decl(generatedContextualTyping.ts, 23, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >named : Symbol(named, Decl(generatedContextualTyping.ts, 23, 37)) >d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) @@ -158,14 +158,14 @@ class x18 { member: { (): Base[]; } = function named() { return [d1, d2] } } class x19 { member: Base[] = [d1, d2] } >x19 : Symbol(x19, Decl(generatedContextualTyping.ts, 23, 76)) ->member : Symbol(member, Decl(generatedContextualTyping.ts, 24, 11)) +>member : Symbol(x19.member, Decl(generatedContextualTyping.ts, 24, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) >d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x20 { member: Array = [d1, d2] } >x20 : Symbol(x20, Decl(generatedContextualTyping.ts, 24, 39)) ->member : Symbol(member, Decl(generatedContextualTyping.ts, 25, 11)) +>member : Symbol(x20.member, Decl(generatedContextualTyping.ts, 25, 11)) >Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) @@ -173,7 +173,7 @@ class x20 { member: Array = [d1, d2] } class x21 { member: { [n: number]: Base; } = [d1, d2] } >x21 : Symbol(x21, Decl(generatedContextualTyping.ts, 25, 44)) ->member : Symbol(member, Decl(generatedContextualTyping.ts, 26, 11)) +>member : Symbol(x21.member, Decl(generatedContextualTyping.ts, 26, 11)) >n : Symbol(n, Decl(generatedContextualTyping.ts, 26, 23)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) @@ -181,7 +181,7 @@ class x21 { member: { [n: number]: Base; } = [d1, d2] } class x22 { member: {n: Base[]; } = { n: [d1, d2] } } >x22 : Symbol(x22, Decl(generatedContextualTyping.ts, 26, 55)) ->member : Symbol(member, Decl(generatedContextualTyping.ts, 27, 11)) +>member : Symbol(x22.member, Decl(generatedContextualTyping.ts, 27, 11)) >n : Symbol(n, Decl(generatedContextualTyping.ts, 27, 21)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >n : Symbol(n, Decl(generatedContextualTyping.ts, 27, 38)) @@ -190,7 +190,7 @@ class x22 { member: {n: Base[]; } = { n: [d1, d2] } } class x23 { member: (s: Base[]) => any = n => { var n: Base[]; return null; } } >x23 : Symbol(x23, Decl(generatedContextualTyping.ts, 27, 54)) ->member : Symbol(member, Decl(generatedContextualTyping.ts, 28, 11)) +>member : Symbol(x23.member, Decl(generatedContextualTyping.ts, 28, 11)) >s : Symbol(s, Decl(generatedContextualTyping.ts, 28, 21)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >n : Symbol(n, Decl(generatedContextualTyping.ts, 28, 40), Decl(generatedContextualTyping.ts, 28, 51)) @@ -199,7 +199,7 @@ class x23 { member: (s: Base[]) => any = n => { var n: Base[]; return null; } } class x24 { member: Genric = { func: n => { return [d1, d2]; } } } >x24 : Symbol(x24, Decl(generatedContextualTyping.ts, 28, 79)) ->member : Symbol(member, Decl(generatedContextualTyping.ts, 29, 11)) +>member : Symbol(x24.member, Decl(generatedContextualTyping.ts, 29, 11)) >Genric : Symbol(Genric, Decl(generatedContextualTyping.ts, 3, 42)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >func : Symbol(func, Decl(generatedContextualTyping.ts, 29, 36)) @@ -209,21 +209,21 @@ class x24 { member: Genric = { func: n => { return [d1, d2]; } } } class x25 { private member: () => Base[] = () => [d1, d2] } >x25 : Symbol(x25, Decl(generatedContextualTyping.ts, 29, 72)) ->member : Symbol(member, Decl(generatedContextualTyping.ts, 30, 11)) +>member : Symbol(x25.member, Decl(generatedContextualTyping.ts, 30, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) >d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x26 { private member: () => Base[] = function() { return [d1, d2] } } >x26 : Symbol(x26, Decl(generatedContextualTyping.ts, 30, 59)) ->member : Symbol(member, Decl(generatedContextualTyping.ts, 31, 11)) +>member : Symbol(x26.member, Decl(generatedContextualTyping.ts, 31, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) >d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x27 { private member: () => Base[] = function named() { return [d1, d2] } } >x27 : Symbol(x27, Decl(generatedContextualTyping.ts, 31, 75)) ->member : Symbol(member, Decl(generatedContextualTyping.ts, 32, 11)) +>member : Symbol(x27.member, Decl(generatedContextualTyping.ts, 32, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >named : Symbol(named, Decl(generatedContextualTyping.ts, 32, 42)) >d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) @@ -231,21 +231,21 @@ class x27 { private member: () => Base[] = function named() { return [d1, d2] } class x28 { private member: { (): Base[]; } = () => [d1, d2] } >x28 : Symbol(x28, Decl(generatedContextualTyping.ts, 32, 81)) ->member : Symbol(member, Decl(generatedContextualTyping.ts, 33, 11)) +>member : Symbol(x28.member, Decl(generatedContextualTyping.ts, 33, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) >d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x29 { private member: { (): Base[]; } = function() { return [d1, d2] } } >x29 : Symbol(x29, Decl(generatedContextualTyping.ts, 33, 62)) ->member : Symbol(member, Decl(generatedContextualTyping.ts, 34, 11)) +>member : Symbol(x29.member, Decl(generatedContextualTyping.ts, 34, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) >d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x30 { private member: { (): Base[]; } = function named() { return [d1, d2] } } >x30 : Symbol(x30, Decl(generatedContextualTyping.ts, 34, 78)) ->member : Symbol(member, Decl(generatedContextualTyping.ts, 35, 11)) +>member : Symbol(x30.member, Decl(generatedContextualTyping.ts, 35, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >named : Symbol(named, Decl(generatedContextualTyping.ts, 35, 45)) >d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) @@ -253,14 +253,14 @@ class x30 { private member: { (): Base[]; } = function named() { return [d1, d2] class x31 { private member: Base[] = [d1, d2] } >x31 : Symbol(x31, Decl(generatedContextualTyping.ts, 35, 84)) ->member : Symbol(member, Decl(generatedContextualTyping.ts, 36, 11)) +>member : Symbol(x31.member, Decl(generatedContextualTyping.ts, 36, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) >d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x32 { private member: Array = [d1, d2] } >x32 : Symbol(x32, Decl(generatedContextualTyping.ts, 36, 47)) ->member : Symbol(member, Decl(generatedContextualTyping.ts, 37, 11)) +>member : Symbol(x32.member, Decl(generatedContextualTyping.ts, 37, 11)) >Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) @@ -268,7 +268,7 @@ class x32 { private member: Array = [d1, d2] } class x33 { private member: { [n: number]: Base; } = [d1, d2] } >x33 : Symbol(x33, Decl(generatedContextualTyping.ts, 37, 52)) ->member : Symbol(member, Decl(generatedContextualTyping.ts, 38, 11)) +>member : Symbol(x33.member, Decl(generatedContextualTyping.ts, 38, 11)) >n : Symbol(n, Decl(generatedContextualTyping.ts, 38, 31)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) @@ -276,7 +276,7 @@ class x33 { private member: { [n: number]: Base; } = [d1, d2] } class x34 { private member: {n: Base[]; } = { n: [d1, d2] } } >x34 : Symbol(x34, Decl(generatedContextualTyping.ts, 38, 63)) ->member : Symbol(member, Decl(generatedContextualTyping.ts, 39, 11)) +>member : Symbol(x34.member, Decl(generatedContextualTyping.ts, 39, 11)) >n : Symbol(n, Decl(generatedContextualTyping.ts, 39, 29)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >n : Symbol(n, Decl(generatedContextualTyping.ts, 39, 46)) @@ -285,7 +285,7 @@ class x34 { private member: {n: Base[]; } = { n: [d1, d2] } } class x35 { private member: (s: Base[]) => any = n => { var n: Base[]; return null; } } >x35 : Symbol(x35, Decl(generatedContextualTyping.ts, 39, 62)) ->member : Symbol(member, Decl(generatedContextualTyping.ts, 40, 11)) +>member : Symbol(x35.member, Decl(generatedContextualTyping.ts, 40, 11)) >s : Symbol(s, Decl(generatedContextualTyping.ts, 40, 29)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >n : Symbol(n, Decl(generatedContextualTyping.ts, 40, 48), Decl(generatedContextualTyping.ts, 40, 59)) @@ -294,7 +294,7 @@ class x35 { private member: (s: Base[]) => any = n => { var n: Base[]; return nu class x36 { private member: Genric = { func: n => { return [d1, d2]; } } } >x36 : Symbol(x36, Decl(generatedContextualTyping.ts, 40, 87)) ->member : Symbol(member, Decl(generatedContextualTyping.ts, 41, 11)) +>member : Symbol(x36.member, Decl(generatedContextualTyping.ts, 41, 11)) >Genric : Symbol(Genric, Decl(generatedContextualTyping.ts, 3, 42)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >func : Symbol(func, Decl(generatedContextualTyping.ts, 41, 44)) @@ -304,21 +304,21 @@ class x36 { private member: Genric = { func: n => { return [d1, d2]; } } } class x37 { public member: () => Base[] = () => [d1, d2] } >x37 : Symbol(x37, Decl(generatedContextualTyping.ts, 41, 80)) ->member : Symbol(member, Decl(generatedContextualTyping.ts, 42, 11)) +>member : Symbol(x37.member, Decl(generatedContextualTyping.ts, 42, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) >d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x38 { public member: () => Base[] = function() { return [d1, d2] } } >x38 : Symbol(x38, Decl(generatedContextualTyping.ts, 42, 58)) ->member : Symbol(member, Decl(generatedContextualTyping.ts, 43, 11)) +>member : Symbol(x38.member, Decl(generatedContextualTyping.ts, 43, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) >d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x39 { public member: () => Base[] = function named() { return [d1, d2] } } >x39 : Symbol(x39, Decl(generatedContextualTyping.ts, 43, 74)) ->member : Symbol(member, Decl(generatedContextualTyping.ts, 44, 11)) +>member : Symbol(x39.member, Decl(generatedContextualTyping.ts, 44, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >named : Symbol(named, Decl(generatedContextualTyping.ts, 44, 41)) >d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) @@ -326,21 +326,21 @@ class x39 { public member: () => Base[] = function named() { return [d1, d2] } } class x40 { public member: { (): Base[]; } = () => [d1, d2] } >x40 : Symbol(x40, Decl(generatedContextualTyping.ts, 44, 80)) ->member : Symbol(member, Decl(generatedContextualTyping.ts, 45, 11)) +>member : Symbol(x40.member, Decl(generatedContextualTyping.ts, 45, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) >d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x41 { public member: { (): Base[]; } = function() { return [d1, d2] } } >x41 : Symbol(x41, Decl(generatedContextualTyping.ts, 45, 61)) ->member : Symbol(member, Decl(generatedContextualTyping.ts, 46, 11)) +>member : Symbol(x41.member, Decl(generatedContextualTyping.ts, 46, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) >d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x42 { public member: { (): Base[]; } = function named() { return [d1, d2] } } >x42 : Symbol(x42, Decl(generatedContextualTyping.ts, 46, 77)) ->member : Symbol(member, Decl(generatedContextualTyping.ts, 47, 11)) +>member : Symbol(x42.member, Decl(generatedContextualTyping.ts, 47, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >named : Symbol(named, Decl(generatedContextualTyping.ts, 47, 44)) >d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) @@ -348,14 +348,14 @@ class x42 { public member: { (): Base[]; } = function named() { return [d1, d2] class x43 { public member: Base[] = [d1, d2] } >x43 : Symbol(x43, Decl(generatedContextualTyping.ts, 47, 83)) ->member : Symbol(member, Decl(generatedContextualTyping.ts, 48, 11)) +>member : Symbol(x43.member, Decl(generatedContextualTyping.ts, 48, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) >d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x44 { public member: Array = [d1, d2] } >x44 : Symbol(x44, Decl(generatedContextualTyping.ts, 48, 46)) ->member : Symbol(member, Decl(generatedContextualTyping.ts, 49, 11)) +>member : Symbol(x44.member, Decl(generatedContextualTyping.ts, 49, 11)) >Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) @@ -363,7 +363,7 @@ class x44 { public member: Array = [d1, d2] } class x45 { public member: { [n: number]: Base; } = [d1, d2] } >x45 : Symbol(x45, Decl(generatedContextualTyping.ts, 49, 51)) ->member : Symbol(member, Decl(generatedContextualTyping.ts, 50, 11)) +>member : Symbol(x45.member, Decl(generatedContextualTyping.ts, 50, 11)) >n : Symbol(n, Decl(generatedContextualTyping.ts, 50, 30)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) @@ -371,7 +371,7 @@ class x45 { public member: { [n: number]: Base; } = [d1, d2] } class x46 { public member: {n: Base[]; } = { n: [d1, d2] } } >x46 : Symbol(x46, Decl(generatedContextualTyping.ts, 50, 62)) ->member : Symbol(member, Decl(generatedContextualTyping.ts, 51, 11)) +>member : Symbol(x46.member, Decl(generatedContextualTyping.ts, 51, 11)) >n : Symbol(n, Decl(generatedContextualTyping.ts, 51, 28)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >n : Symbol(n, Decl(generatedContextualTyping.ts, 51, 45)) @@ -380,7 +380,7 @@ class x46 { public member: {n: Base[]; } = { n: [d1, d2] } } class x47 { public member: (s: Base[]) => any = n => { var n: Base[]; return null; } } >x47 : Symbol(x47, Decl(generatedContextualTyping.ts, 51, 61)) ->member : Symbol(member, Decl(generatedContextualTyping.ts, 52, 11)) +>member : Symbol(x47.member, Decl(generatedContextualTyping.ts, 52, 11)) >s : Symbol(s, Decl(generatedContextualTyping.ts, 52, 28)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >n : Symbol(n, Decl(generatedContextualTyping.ts, 52, 47), Decl(generatedContextualTyping.ts, 52, 58)) @@ -389,7 +389,7 @@ class x47 { public member: (s: Base[]) => any = n => { var n: Base[]; return nul class x48 { public member: Genric = { func: n => { return [d1, d2]; } } } >x48 : Symbol(x48, Decl(generatedContextualTyping.ts, 52, 86)) ->member : Symbol(member, Decl(generatedContextualTyping.ts, 53, 11)) +>member : Symbol(x48.member, Decl(generatedContextualTyping.ts, 53, 11)) >Genric : Symbol(Genric, Decl(generatedContextualTyping.ts, 3, 42)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >func : Symbol(func, Decl(generatedContextualTyping.ts, 53, 43)) @@ -779,21 +779,21 @@ class x96 { constructor(parm: Genric = { func: n => { return [d1, d2]; } } class x97 { constructor(public parm: () => Base[] = () => [d1, d2]) { } } >x97 : Symbol(x97, Decl(generatedContextualTyping.ts, 101, 87)) ->parm : Symbol(parm, Decl(generatedContextualTyping.ts, 102, 24)) +>parm : Symbol(x97.parm, Decl(generatedContextualTyping.ts, 102, 24)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) >d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x98 { constructor(public parm: () => Base[] = function() { return [d1, d2] }) { } } >x98 : Symbol(x98, Decl(generatedContextualTyping.ts, 102, 73)) ->parm : Symbol(parm, Decl(generatedContextualTyping.ts, 103, 24)) +>parm : Symbol(x98.parm, Decl(generatedContextualTyping.ts, 103, 24)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) >d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x99 { constructor(public parm: () => Base[] = function named() { return [d1, d2] }) { } } >x99 : Symbol(x99, Decl(generatedContextualTyping.ts, 103, 89)) ->parm : Symbol(parm, Decl(generatedContextualTyping.ts, 104, 24)) +>parm : Symbol(x99.parm, Decl(generatedContextualTyping.ts, 104, 24)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >named : Symbol(named, Decl(generatedContextualTyping.ts, 104, 51)) >d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) @@ -801,21 +801,21 @@ class x99 { constructor(public parm: () => Base[] = function named() { return [d class x100 { constructor(public parm: { (): Base[]; } = () => [d1, d2]) { } } >x100 : Symbol(x100, Decl(generatedContextualTyping.ts, 104, 95)) ->parm : Symbol(parm, Decl(generatedContextualTyping.ts, 105, 25)) +>parm : Symbol(x100.parm, Decl(generatedContextualTyping.ts, 105, 25)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) >d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x101 { constructor(public parm: { (): Base[]; } = function() { return [d1, d2] }) { } } >x101 : Symbol(x101, Decl(generatedContextualTyping.ts, 105, 77)) ->parm : Symbol(parm, Decl(generatedContextualTyping.ts, 106, 25)) +>parm : Symbol(x101.parm, Decl(generatedContextualTyping.ts, 106, 25)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) >d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x102 { constructor(public parm: { (): Base[]; } = function named() { return [d1, d2] }) { } } >x102 : Symbol(x102, Decl(generatedContextualTyping.ts, 106, 93)) ->parm : Symbol(parm, Decl(generatedContextualTyping.ts, 107, 25)) +>parm : Symbol(x102.parm, Decl(generatedContextualTyping.ts, 107, 25)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >named : Symbol(named, Decl(generatedContextualTyping.ts, 107, 55)) >d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) @@ -823,14 +823,14 @@ class x102 { constructor(public parm: { (): Base[]; } = function named() { retur class x103 { constructor(public parm: Base[] = [d1, d2]) { } } >x103 : Symbol(x103, Decl(generatedContextualTyping.ts, 107, 99)) ->parm : Symbol(parm, Decl(generatedContextualTyping.ts, 108, 25)) +>parm : Symbol(x103.parm, Decl(generatedContextualTyping.ts, 108, 25)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) >d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x104 { constructor(public parm: Array = [d1, d2]) { } } >x104 : Symbol(x104, Decl(generatedContextualTyping.ts, 108, 62)) ->parm : Symbol(parm, Decl(generatedContextualTyping.ts, 109, 25)) +>parm : Symbol(x104.parm, Decl(generatedContextualTyping.ts, 109, 25)) >Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) @@ -838,7 +838,7 @@ class x104 { constructor(public parm: Array = [d1, d2]) { } } class x105 { constructor(public parm: { [n: number]: Base; } = [d1, d2]) { } } >x105 : Symbol(x105, Decl(generatedContextualTyping.ts, 109, 67)) ->parm : Symbol(parm, Decl(generatedContextualTyping.ts, 110, 25)) +>parm : Symbol(x105.parm, Decl(generatedContextualTyping.ts, 110, 25)) >n : Symbol(n, Decl(generatedContextualTyping.ts, 110, 41)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) @@ -846,7 +846,7 @@ class x105 { constructor(public parm: { [n: number]: Base; } = [d1, d2]) { } } class x106 { constructor(public parm: {n: Base[]; } = { n: [d1, d2] }) { } } >x106 : Symbol(x106, Decl(generatedContextualTyping.ts, 110, 78)) ->parm : Symbol(parm, Decl(generatedContextualTyping.ts, 111, 25)) +>parm : Symbol(x106.parm, Decl(generatedContextualTyping.ts, 111, 25)) >n : Symbol(n, Decl(generatedContextualTyping.ts, 111, 39)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >n : Symbol(n, Decl(generatedContextualTyping.ts, 111, 56)) @@ -855,7 +855,7 @@ class x106 { constructor(public parm: {n: Base[]; } = { n: [d1, d2] }) { } } class x107 { constructor(public parm: (s: Base[]) => any = n => { var n: Base[]; return null; }) { } } >x107 : Symbol(x107, Decl(generatedContextualTyping.ts, 111, 77)) ->parm : Symbol(parm, Decl(generatedContextualTyping.ts, 112, 25)) +>parm : Symbol(x107.parm, Decl(generatedContextualTyping.ts, 112, 25)) >s : Symbol(s, Decl(generatedContextualTyping.ts, 112, 39)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >n : Symbol(n, Decl(generatedContextualTyping.ts, 112, 58), Decl(generatedContextualTyping.ts, 112, 69)) @@ -864,7 +864,7 @@ class x107 { constructor(public parm: (s: Base[]) => any = n => { var n: Base[]; class x108 { constructor(public parm: Genric = { func: n => { return [d1, d2]; } }) { } } >x108 : Symbol(x108, Decl(generatedContextualTyping.ts, 112, 102)) ->parm : Symbol(parm, Decl(generatedContextualTyping.ts, 113, 25)) +>parm : Symbol(x108.parm, Decl(generatedContextualTyping.ts, 113, 25)) >Genric : Symbol(Genric, Decl(generatedContextualTyping.ts, 3, 42)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >func : Symbol(func, Decl(generatedContextualTyping.ts, 113, 54)) @@ -874,21 +874,21 @@ class x108 { constructor(public parm: Genric = { func: n => { return [d1, class x109 { constructor(private parm: () => Base[] = () => [d1, d2]) { } } >x109 : Symbol(x109, Decl(generatedContextualTyping.ts, 113, 95)) ->parm : Symbol(parm, Decl(generatedContextualTyping.ts, 114, 25)) +>parm : Symbol(x109.parm, Decl(generatedContextualTyping.ts, 114, 25)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) >d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x110 { constructor(private parm: () => Base[] = function() { return [d1, d2] }) { } } >x110 : Symbol(x110, Decl(generatedContextualTyping.ts, 114, 75)) ->parm : Symbol(parm, Decl(generatedContextualTyping.ts, 115, 25)) +>parm : Symbol(x110.parm, Decl(generatedContextualTyping.ts, 115, 25)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) >d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x111 { constructor(private parm: () => Base[] = function named() { return [d1, d2] }) { } } >x111 : Symbol(x111, Decl(generatedContextualTyping.ts, 115, 91)) ->parm : Symbol(parm, Decl(generatedContextualTyping.ts, 116, 25)) +>parm : Symbol(x111.parm, Decl(generatedContextualTyping.ts, 116, 25)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >named : Symbol(named, Decl(generatedContextualTyping.ts, 116, 53)) >d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) @@ -896,21 +896,21 @@ class x111 { constructor(private parm: () => Base[] = function named() { return class x112 { constructor(private parm: { (): Base[]; } = () => [d1, d2]) { } } >x112 : Symbol(x112, Decl(generatedContextualTyping.ts, 116, 97)) ->parm : Symbol(parm, Decl(generatedContextualTyping.ts, 117, 25)) +>parm : Symbol(x112.parm, Decl(generatedContextualTyping.ts, 117, 25)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) >d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x113 { constructor(private parm: { (): Base[]; } = function() { return [d1, d2] }) { } } >x113 : Symbol(x113, Decl(generatedContextualTyping.ts, 117, 78)) ->parm : Symbol(parm, Decl(generatedContextualTyping.ts, 118, 25)) +>parm : Symbol(x113.parm, Decl(generatedContextualTyping.ts, 118, 25)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) >d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x114 { constructor(private parm: { (): Base[]; } = function named() { return [d1, d2] }) { } } >x114 : Symbol(x114, Decl(generatedContextualTyping.ts, 118, 94)) ->parm : Symbol(parm, Decl(generatedContextualTyping.ts, 119, 25)) +>parm : Symbol(x114.parm, Decl(generatedContextualTyping.ts, 119, 25)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >named : Symbol(named, Decl(generatedContextualTyping.ts, 119, 56)) >d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) @@ -918,14 +918,14 @@ class x114 { constructor(private parm: { (): Base[]; } = function named() { retu class x115 { constructor(private parm: Base[] = [d1, d2]) { } } >x115 : Symbol(x115, Decl(generatedContextualTyping.ts, 119, 100)) ->parm : Symbol(parm, Decl(generatedContextualTyping.ts, 120, 25)) +>parm : Symbol(x115.parm, Decl(generatedContextualTyping.ts, 120, 25)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) >d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x116 { constructor(private parm: Array = [d1, d2]) { } } >x116 : Symbol(x116, Decl(generatedContextualTyping.ts, 120, 63)) ->parm : Symbol(parm, Decl(generatedContextualTyping.ts, 121, 25)) +>parm : Symbol(x116.parm, Decl(generatedContextualTyping.ts, 121, 25)) >Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) @@ -933,7 +933,7 @@ class x116 { constructor(private parm: Array = [d1, d2]) { } } class x117 { constructor(private parm: { [n: number]: Base; } = [d1, d2]) { } } >x117 : Symbol(x117, Decl(generatedContextualTyping.ts, 121, 68)) ->parm : Symbol(parm, Decl(generatedContextualTyping.ts, 122, 25)) +>parm : Symbol(x117.parm, Decl(generatedContextualTyping.ts, 122, 25)) >n : Symbol(n, Decl(generatedContextualTyping.ts, 122, 42)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) @@ -941,7 +941,7 @@ class x117 { constructor(private parm: { [n: number]: Base; } = [d1, d2]) { } } class x118 { constructor(private parm: {n: Base[]; } = { n: [d1, d2] }) { } } >x118 : Symbol(x118, Decl(generatedContextualTyping.ts, 122, 79)) ->parm : Symbol(parm, Decl(generatedContextualTyping.ts, 123, 25)) +>parm : Symbol(x118.parm, Decl(generatedContextualTyping.ts, 123, 25)) >n : Symbol(n, Decl(generatedContextualTyping.ts, 123, 40)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >n : Symbol(n, Decl(generatedContextualTyping.ts, 123, 57)) @@ -950,7 +950,7 @@ class x118 { constructor(private parm: {n: Base[]; } = { n: [d1, d2] }) { } } class x119 { constructor(private parm: (s: Base[]) => any = n => { var n: Base[]; return null; }) { } } >x119 : Symbol(x119, Decl(generatedContextualTyping.ts, 123, 78)) ->parm : Symbol(parm, Decl(generatedContextualTyping.ts, 124, 25)) +>parm : Symbol(x119.parm, Decl(generatedContextualTyping.ts, 124, 25)) >s : Symbol(s, Decl(generatedContextualTyping.ts, 124, 40)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >n : Symbol(n, Decl(generatedContextualTyping.ts, 124, 59), Decl(generatedContextualTyping.ts, 124, 70)) @@ -959,7 +959,7 @@ class x119 { constructor(private parm: (s: Base[]) => any = n => { var n: Base[] class x120 { constructor(private parm: Genric = { func: n => { return [d1, d2]; } }) { } } >x120 : Symbol(x120, Decl(generatedContextualTyping.ts, 124, 103)) ->parm : Symbol(parm, Decl(generatedContextualTyping.ts, 125, 25)) +>parm : Symbol(x120.parm, Decl(generatedContextualTyping.ts, 125, 25)) >Genric : Symbol(Genric, Decl(generatedContextualTyping.ts, 3, 42)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >func : Symbol(func, Decl(generatedContextualTyping.ts, 125, 55)) diff --git a/tests/baselines/reference/generativeRecursionWithTypeOf.symbols b/tests/baselines/reference/generativeRecursionWithTypeOf.symbols index 630923d2c59..5f8f4b78af4 100644 --- a/tests/baselines/reference/generativeRecursionWithTypeOf.symbols +++ b/tests/baselines/reference/generativeRecursionWithTypeOf.symbols @@ -8,7 +8,7 @@ class C { >x : Symbol(x, Decl(generativeRecursionWithTypeOf.ts, 1, 15)) type: T; ->type : Symbol(type, Decl(generativeRecursionWithTypeOf.ts, 1, 29)) +>type : Symbol(C.type, Decl(generativeRecursionWithTypeOf.ts, 1, 29)) >T : Symbol(T, Decl(generativeRecursionWithTypeOf.ts, 0, 8)) } diff --git a/tests/baselines/reference/generatorES6_2.symbols b/tests/baselines/reference/generatorES6_2.symbols index a64b1304692..2b4d93ca940 100644 --- a/tests/baselines/reference/generatorES6_2.symbols +++ b/tests/baselines/reference/generatorES6_2.symbols @@ -3,7 +3,7 @@ class C { >C : Symbol(C, Decl(generatorES6_2.ts, 0, 0)) public * foo() { ->foo : Symbol(foo, Decl(generatorES6_2.ts, 0, 9)) +>foo : Symbol(C.foo, Decl(generatorES6_2.ts, 0, 9)) yield 1 } diff --git a/tests/baselines/reference/generatorES6_6.symbols b/tests/baselines/reference/generatorES6_6.symbols index 96b8b861c8b..e277757e98d 100644 --- a/tests/baselines/reference/generatorES6_6.symbols +++ b/tests/baselines/reference/generatorES6_6.symbols @@ -3,9 +3,9 @@ class C { >C : Symbol(C, Decl(generatorES6_6.ts, 0, 0)) *[Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) let a = yield 1; >a : Symbol(a, Decl(generatorES6_6.ts, 2, 7)) diff --git a/tests/baselines/reference/generatorInAmbientContext5.symbols b/tests/baselines/reference/generatorInAmbientContext5.symbols index 78139a7e597..df432c2a67d 100644 --- a/tests/baselines/reference/generatorInAmbientContext5.symbols +++ b/tests/baselines/reference/generatorInAmbientContext5.symbols @@ -3,5 +3,5 @@ class C { >C : Symbol(C, Decl(generatorInAmbientContext5.ts, 0, 0)) *generator(): any { } ->generator : Symbol(generator, Decl(generatorInAmbientContext5.ts, 0, 9)) +>generator : Symbol(C.generator, Decl(generatorInAmbientContext5.ts, 0, 9)) } diff --git a/tests/baselines/reference/generatorOverloads4.symbols b/tests/baselines/reference/generatorOverloads4.symbols index 341ba9c4a0d..f7ab5bc1f95 100644 --- a/tests/baselines/reference/generatorOverloads4.symbols +++ b/tests/baselines/reference/generatorOverloads4.symbols @@ -3,17 +3,17 @@ class C { >C : Symbol(C, Decl(generatorOverloads4.ts, 0, 0)) f(s: string): Iterable; ->f : Symbol(f, Decl(generatorOverloads4.ts, 0, 9), Decl(generatorOverloads4.ts, 1, 32), Decl(generatorOverloads4.ts, 2, 32)) +>f : Symbol(C.f, Decl(generatorOverloads4.ts, 0, 9), Decl(generatorOverloads4.ts, 1, 32), Decl(generatorOverloads4.ts, 2, 32)) >s : Symbol(s, Decl(generatorOverloads4.ts, 1, 6)) ->Iterable : Symbol(Iterable, Decl(lib.d.ts, --, --)) +>Iterable : Symbol(Iterable, Decl(lib.es2015.iterable.d.ts, --, --)) f(s: number): Iterable; ->f : Symbol(f, Decl(generatorOverloads4.ts, 0, 9), Decl(generatorOverloads4.ts, 1, 32), Decl(generatorOverloads4.ts, 2, 32)) +>f : Symbol(C.f, Decl(generatorOverloads4.ts, 0, 9), Decl(generatorOverloads4.ts, 1, 32), Decl(generatorOverloads4.ts, 2, 32)) >s : Symbol(s, Decl(generatorOverloads4.ts, 2, 6)) ->Iterable : Symbol(Iterable, Decl(lib.d.ts, --, --)) +>Iterable : Symbol(Iterable, Decl(lib.es2015.iterable.d.ts, --, --)) *f(s: any): Iterable { } ->f : Symbol(f, Decl(generatorOverloads4.ts, 0, 9), Decl(generatorOverloads4.ts, 1, 32), Decl(generatorOverloads4.ts, 2, 32)) +>f : Symbol(C.f, Decl(generatorOverloads4.ts, 0, 9), Decl(generatorOverloads4.ts, 1, 32), Decl(generatorOverloads4.ts, 2, 32)) >s : Symbol(s, Decl(generatorOverloads4.ts, 3, 7)) ->Iterable : Symbol(Iterable, Decl(lib.d.ts, --, --)) +>Iterable : Symbol(Iterable, Decl(lib.es2015.iterable.d.ts, --, --)) } diff --git a/tests/baselines/reference/generatorOverloads5.symbols b/tests/baselines/reference/generatorOverloads5.symbols index 07de0c87f51..feb27cabed0 100644 --- a/tests/baselines/reference/generatorOverloads5.symbols +++ b/tests/baselines/reference/generatorOverloads5.symbols @@ -5,15 +5,15 @@ module M { function f(s: string): Iterable; >f : Symbol(f, Decl(generatorOverloads5.ts, 0, 10), Decl(generatorOverloads5.ts, 1, 41), Decl(generatorOverloads5.ts, 2, 41)) >s : Symbol(s, Decl(generatorOverloads5.ts, 1, 15)) ->Iterable : Symbol(Iterable, Decl(lib.d.ts, --, --)) +>Iterable : Symbol(Iterable, Decl(lib.es2015.iterable.d.ts, --, --)) function f(s: number): Iterable; >f : Symbol(f, Decl(generatorOverloads5.ts, 0, 10), Decl(generatorOverloads5.ts, 1, 41), Decl(generatorOverloads5.ts, 2, 41)) >s : Symbol(s, Decl(generatorOverloads5.ts, 2, 15)) ->Iterable : Symbol(Iterable, Decl(lib.d.ts, --, --)) +>Iterable : Symbol(Iterable, Decl(lib.es2015.iterable.d.ts, --, --)) function* f(s: any): Iterable { } >f : Symbol(f, Decl(generatorOverloads5.ts, 0, 10), Decl(generatorOverloads5.ts, 1, 41), Decl(generatorOverloads5.ts, 2, 41)) >s : Symbol(s, Decl(generatorOverloads5.ts, 3, 16)) ->Iterable : Symbol(Iterable, Decl(lib.d.ts, --, --)) +>Iterable : Symbol(Iterable, Decl(lib.es2015.iterable.d.ts, --, --)) } diff --git a/tests/baselines/reference/generatorTypeCheck1.symbols b/tests/baselines/reference/generatorTypeCheck1.symbols index b9456ccba48..dbb6db06833 100644 --- a/tests/baselines/reference/generatorTypeCheck1.symbols +++ b/tests/baselines/reference/generatorTypeCheck1.symbols @@ -1,5 +1,5 @@ === tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck1.ts === function* g1(): Iterator { } >g1 : Symbol(g1, Decl(generatorTypeCheck1.ts, 0, 0)) ->Iterator : Symbol(Iterator, Decl(lib.d.ts, --, --)) +>Iterator : Symbol(Iterator, Decl(lib.es2015.iterable.d.ts, --, --)) diff --git a/tests/baselines/reference/generatorTypeCheck10.symbols b/tests/baselines/reference/generatorTypeCheck10.symbols index 2112a9b1ebc..3d6f8cf889a 100644 --- a/tests/baselines/reference/generatorTypeCheck10.symbols +++ b/tests/baselines/reference/generatorTypeCheck10.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck10.ts === function* g(): IterableIterator { >g : Symbol(g, Decl(generatorTypeCheck10.ts, 0, 0)) ->IterableIterator : Symbol(IterableIterator, Decl(lib.d.ts, --, --)) +>IterableIterator : Symbol(IterableIterator, Decl(lib.es2015.iterable.d.ts, --, --)) return; } diff --git a/tests/baselines/reference/generatorTypeCheck11.symbols b/tests/baselines/reference/generatorTypeCheck11.symbols index 439b97caa7f..aea1ffd781c 100644 --- a/tests/baselines/reference/generatorTypeCheck11.symbols +++ b/tests/baselines/reference/generatorTypeCheck11.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck11.ts === function* g(): IterableIterator { >g : Symbol(g, Decl(generatorTypeCheck11.ts, 0, 0)) ->IterableIterator : Symbol(IterableIterator, Decl(lib.d.ts, --, --)) +>IterableIterator : Symbol(IterableIterator, Decl(lib.es2015.iterable.d.ts, --, --)) return 0; } diff --git a/tests/baselines/reference/generatorTypeCheck12.symbols b/tests/baselines/reference/generatorTypeCheck12.symbols index 1c7661a06cf..2dc7d5d42ab 100644 --- a/tests/baselines/reference/generatorTypeCheck12.symbols +++ b/tests/baselines/reference/generatorTypeCheck12.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck12.ts === function* g(): IterableIterator { >g : Symbol(g, Decl(generatorTypeCheck12.ts, 0, 0)) ->IterableIterator : Symbol(IterableIterator, Decl(lib.d.ts, --, --)) +>IterableIterator : Symbol(IterableIterator, Decl(lib.es2015.iterable.d.ts, --, --)) return ""; } diff --git a/tests/baselines/reference/generatorTypeCheck13.symbols b/tests/baselines/reference/generatorTypeCheck13.symbols index 7d9587e5ac9..494356185c8 100644 --- a/tests/baselines/reference/generatorTypeCheck13.symbols +++ b/tests/baselines/reference/generatorTypeCheck13.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck13.ts === function* g(): IterableIterator { >g : Symbol(g, Decl(generatorTypeCheck13.ts, 0, 0)) ->IterableIterator : Symbol(IterableIterator, Decl(lib.d.ts, --, --)) +>IterableIterator : Symbol(IterableIterator, Decl(lib.es2015.iterable.d.ts, --, --)) yield 0; return ""; diff --git a/tests/baselines/reference/generatorTypeCheck17.symbols b/tests/baselines/reference/generatorTypeCheck17.symbols index 523579dd47b..6e4941dd7cf 100644 --- a/tests/baselines/reference/generatorTypeCheck17.symbols +++ b/tests/baselines/reference/generatorTypeCheck17.symbols @@ -1,16 +1,16 @@ === tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck17.ts === class Foo { x: number } >Foo : Symbol(Foo, Decl(generatorTypeCheck17.ts, 0, 0)) ->x : Symbol(x, Decl(generatorTypeCheck17.ts, 0, 11)) +>x : Symbol(Foo.x, Decl(generatorTypeCheck17.ts, 0, 11)) class Bar extends Foo { y: string } >Bar : Symbol(Bar, Decl(generatorTypeCheck17.ts, 0, 23)) >Foo : Symbol(Foo, Decl(generatorTypeCheck17.ts, 0, 0)) ->y : Symbol(y, Decl(generatorTypeCheck17.ts, 1, 23)) +>y : Symbol(Bar.y, Decl(generatorTypeCheck17.ts, 1, 23)) function* g(): IterableIterator { >g : Symbol(g, Decl(generatorTypeCheck17.ts, 1, 35)) ->IterableIterator : Symbol(IterableIterator, Decl(lib.d.ts, --, --)) +>IterableIterator : Symbol(IterableIterator, Decl(lib.es2015.iterable.d.ts, --, --)) >Foo : Symbol(Foo, Decl(generatorTypeCheck17.ts, 0, 0)) yield; diff --git a/tests/baselines/reference/generatorTypeCheck19.symbols b/tests/baselines/reference/generatorTypeCheck19.symbols index b74b5f727a6..bb72f4b5646 100644 --- a/tests/baselines/reference/generatorTypeCheck19.symbols +++ b/tests/baselines/reference/generatorTypeCheck19.symbols @@ -1,16 +1,16 @@ === tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck19.ts === class Foo { x: number } >Foo : Symbol(Foo, Decl(generatorTypeCheck19.ts, 0, 0)) ->x : Symbol(x, Decl(generatorTypeCheck19.ts, 0, 11)) +>x : Symbol(Foo.x, Decl(generatorTypeCheck19.ts, 0, 11)) class Bar extends Foo { y: string } >Bar : Symbol(Bar, Decl(generatorTypeCheck19.ts, 0, 23)) >Foo : Symbol(Foo, Decl(generatorTypeCheck19.ts, 0, 0)) ->y : Symbol(y, Decl(generatorTypeCheck19.ts, 1, 23)) +>y : Symbol(Bar.y, Decl(generatorTypeCheck19.ts, 1, 23)) function* g(): IterableIterator { >g : Symbol(g, Decl(generatorTypeCheck19.ts, 1, 35)) ->IterableIterator : Symbol(IterableIterator, Decl(lib.d.ts, --, --)) +>IterableIterator : Symbol(IterableIterator, Decl(lib.es2015.iterable.d.ts, --, --)) >Foo : Symbol(Foo, Decl(generatorTypeCheck19.ts, 0, 0)) yield; diff --git a/tests/baselines/reference/generatorTypeCheck2.symbols b/tests/baselines/reference/generatorTypeCheck2.symbols index 5741e089d1b..33c0200c0c9 100644 --- a/tests/baselines/reference/generatorTypeCheck2.symbols +++ b/tests/baselines/reference/generatorTypeCheck2.symbols @@ -1,5 +1,5 @@ === tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck2.ts === function* g1(): Iterable { } >g1 : Symbol(g1, Decl(generatorTypeCheck2.ts, 0, 0)) ->Iterable : Symbol(Iterable, Decl(lib.d.ts, --, --)) +>Iterable : Symbol(Iterable, Decl(lib.es2015.iterable.d.ts, --, --)) diff --git a/tests/baselines/reference/generatorTypeCheck26.symbols b/tests/baselines/reference/generatorTypeCheck26.symbols index 2f2c27d2810..b5f5a65669e 100644 --- a/tests/baselines/reference/generatorTypeCheck26.symbols +++ b/tests/baselines/reference/generatorTypeCheck26.symbols @@ -1,20 +1,20 @@ === tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck26.ts === function* g(): IterableIterator<(x: string) => number> { >g : Symbol(g, Decl(generatorTypeCheck26.ts, 0, 0)) ->IterableIterator : Symbol(IterableIterator, Decl(lib.d.ts, --, --)) +>IterableIterator : Symbol(IterableIterator, Decl(lib.es2015.iterable.d.ts, --, --)) >x : Symbol(x, Decl(generatorTypeCheck26.ts, 0, 33)) yield x => x.length; >x : Symbol(x, Decl(generatorTypeCheck26.ts, 1, 9)) ->x.length : Symbol(String.length, Decl(lib.d.ts, --, --)) +>x.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) >x : Symbol(x, Decl(generatorTypeCheck26.ts, 1, 9)) ->length : Symbol(String.length, Decl(lib.d.ts, --, --)) +>length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) yield *[x => x.length]; >x : Symbol(x, Decl(generatorTypeCheck26.ts, 2, 12)) ->x.length : Symbol(String.length, Decl(lib.d.ts, --, --)) +>x.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) >x : Symbol(x, Decl(generatorTypeCheck26.ts, 2, 12)) ->length : Symbol(String.length, Decl(lib.d.ts, --, --)) +>length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) return x => x.length; >x : Symbol(x, Decl(generatorTypeCheck26.ts, 3, 10)) diff --git a/tests/baselines/reference/generatorTypeCheck27.symbols b/tests/baselines/reference/generatorTypeCheck27.symbols index 27c5cbf5db8..58f5e562423 100644 --- a/tests/baselines/reference/generatorTypeCheck27.symbols +++ b/tests/baselines/reference/generatorTypeCheck27.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck27.ts === function* g(): IterableIterator<(x: string) => number> { >g : Symbol(g, Decl(generatorTypeCheck27.ts, 0, 0)) ->IterableIterator : Symbol(IterableIterator, Decl(lib.d.ts, --, --)) +>IterableIterator : Symbol(IterableIterator, Decl(lib.es2015.iterable.d.ts, --, --)) >x : Symbol(x, Decl(generatorTypeCheck27.ts, 0, 33)) yield * function* () { diff --git a/tests/baselines/reference/generatorTypeCheck28.symbols b/tests/baselines/reference/generatorTypeCheck28.symbols index a7e799679d7..c07d0819244 100644 --- a/tests/baselines/reference/generatorTypeCheck28.symbols +++ b/tests/baselines/reference/generatorTypeCheck28.symbols @@ -1,20 +1,20 @@ === tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck28.ts === function* g(): IterableIterator<(x: string) => number> { >g : Symbol(g, Decl(generatorTypeCheck28.ts, 0, 0)) ->IterableIterator : Symbol(IterableIterator, Decl(lib.d.ts, --, --)) +>IterableIterator : Symbol(IterableIterator, Decl(lib.es2015.iterable.d.ts, --, --)) >x : Symbol(x, Decl(generatorTypeCheck28.ts, 0, 33)) yield * { *[Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) yield x => x.length; >x : Symbol(x, Decl(generatorTypeCheck28.ts, 3, 17)) ->x.length : Symbol(String.length, Decl(lib.d.ts, --, --)) +>x.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) >x : Symbol(x, Decl(generatorTypeCheck28.ts, 3, 17)) ->length : Symbol(String.length, Decl(lib.d.ts, --, --)) +>length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) } }; } diff --git a/tests/baselines/reference/generatorTypeCheck29.symbols b/tests/baselines/reference/generatorTypeCheck29.symbols index 4b332f6c86b..5ea31ccb0cd 100644 --- a/tests/baselines/reference/generatorTypeCheck29.symbols +++ b/tests/baselines/reference/generatorTypeCheck29.symbols @@ -1,8 +1,8 @@ === tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck29.ts === function* g2(): Iterator number>> { >g2 : Symbol(g2, Decl(generatorTypeCheck29.ts, 0, 0)) ->Iterator : Symbol(Iterator, Decl(lib.d.ts, --, --)) ->Iterable : Symbol(Iterable, Decl(lib.d.ts, --, --)) +>Iterator : Symbol(Iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Iterable : Symbol(Iterable, Decl(lib.es2015.iterable.d.ts, --, --)) >x : Symbol(x, Decl(generatorTypeCheck29.ts, 0, 35)) yield function* () { diff --git a/tests/baselines/reference/generatorTypeCheck3.symbols b/tests/baselines/reference/generatorTypeCheck3.symbols index 6e97cd6f280..4533e1d9d2f 100644 --- a/tests/baselines/reference/generatorTypeCheck3.symbols +++ b/tests/baselines/reference/generatorTypeCheck3.symbols @@ -1,5 +1,5 @@ === tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck3.ts === function* g1(): IterableIterator { } >g1 : Symbol(g1, Decl(generatorTypeCheck3.ts, 0, 0)) ->IterableIterator : Symbol(IterableIterator, Decl(lib.d.ts, --, --)) +>IterableIterator : Symbol(IterableIterator, Decl(lib.es2015.iterable.d.ts, --, --)) diff --git a/tests/baselines/reference/generatorTypeCheck30.symbols b/tests/baselines/reference/generatorTypeCheck30.symbols index 3c56fde9039..f1626cf067f 100644 --- a/tests/baselines/reference/generatorTypeCheck30.symbols +++ b/tests/baselines/reference/generatorTypeCheck30.symbols @@ -1,8 +1,8 @@ === tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck30.ts === function* g2(): Iterator number>> { >g2 : Symbol(g2, Decl(generatorTypeCheck30.ts, 0, 0)) ->Iterator : Symbol(Iterator, Decl(lib.d.ts, --, --)) ->Iterable : Symbol(Iterable, Decl(lib.d.ts, --, --)) +>Iterator : Symbol(Iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Iterable : Symbol(Iterable, Decl(lib.es2015.iterable.d.ts, --, --)) >x : Symbol(x, Decl(generatorTypeCheck30.ts, 0, 35)) yield function* () { diff --git a/tests/baselines/reference/generatorTypeCheck39.errors.txt b/tests/baselines/reference/generatorTypeCheck39.errors.txt index ae24837f712..aabb5a47a35 100644 --- a/tests/baselines/reference/generatorTypeCheck39.errors.txt +++ b/tests/baselines/reference/generatorTypeCheck39.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck39.ts(5,16): error TS1163: A 'yield' expression is only allowed in a generator body. -tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck39.ts(6,11): error TS1219: Experimental support for decorators is a feature that is subject to change in a future release. Specify '--experimentalDecorators' to remove this warning. +tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck39.ts(6,11): error TS1219: Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning. tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck39.ts(7,13): error TS1163: A 'yield' expression is only allowed in a generator body. @@ -13,7 +13,7 @@ tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck39.ts(7,13): erro !!! error TS1163: A 'yield' expression is only allowed in a generator body. class C { ~ -!!! error TS1219: Experimental support for decorators is a feature that is subject to change in a future release. Specify '--experimentalDecorators' to remove this warning. +!!! error TS1219: Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning. x = yield 0; ~~~~~ !!! error TS1163: A 'yield' expression is only allowed in a generator body. diff --git a/tests/baselines/reference/generatorTypeCheck39.js b/tests/baselines/reference/generatorTypeCheck39.js index 43df3b8e205..1e0009d24ed 100644 --- a/tests/baselines/reference/generatorTypeCheck39.js +++ b/tests/baselines/reference/generatorTypeCheck39.js @@ -20,7 +20,7 @@ function decorator(x) { return y => { }; } function* g() { - let C = class { + let C = class C { constructor() { this.x = yield 0; } diff --git a/tests/baselines/reference/generatorTypeCheck41.types b/tests/baselines/reference/generatorTypeCheck41.types index 926aef95ce5..0bed082dc43 100644 --- a/tests/baselines/reference/generatorTypeCheck41.types +++ b/tests/baselines/reference/generatorTypeCheck41.types @@ -3,8 +3,8 @@ function* g() { >g : () => IterableIterator let x = { ->x : {} ->{ [yield 0]: 0 } : {} +>x : { [x: number]: number; } +>{ [yield 0]: 0 } : { [x: number]: number; } [yield 0]: 0 >yield 0 : any diff --git a/tests/baselines/reference/generatorTypeCheck42.types b/tests/baselines/reference/generatorTypeCheck42.types index 855c4697f40..7538b8f2499 100644 --- a/tests/baselines/reference/generatorTypeCheck42.types +++ b/tests/baselines/reference/generatorTypeCheck42.types @@ -3,8 +3,8 @@ function* g() { >g : () => IterableIterator let x = { ->x : {} ->{ [yield 0]() { } } : {} +>x : { [x: number]: () => void; } +>{ [yield 0]() { } } : { [x: number]: () => void; } [yield 0]() { >yield 0 : any diff --git a/tests/baselines/reference/generatorTypeCheck43.types b/tests/baselines/reference/generatorTypeCheck43.types index 50fc7e30c86..a132dfcb015 100644 --- a/tests/baselines/reference/generatorTypeCheck43.types +++ b/tests/baselines/reference/generatorTypeCheck43.types @@ -3,8 +3,8 @@ function* g() { >g : () => IterableIterator let x = { ->x : {} ->{ *[yield 0]() { } } : {} +>x : { [x: number]: () => IterableIterator; } +>{ *[yield 0]() { } } : { [x: number]: () => IterableIterator; } *[yield 0]() { >yield 0 : any diff --git a/tests/baselines/reference/generatorTypeCheck44.types b/tests/baselines/reference/generatorTypeCheck44.types index 2fc67f90556..5c432e41cbe 100644 --- a/tests/baselines/reference/generatorTypeCheck44.types +++ b/tests/baselines/reference/generatorTypeCheck44.types @@ -3,8 +3,8 @@ function* g() { >g : () => IterableIterator let x = { ->x : {} ->{ get [yield 0]() { return 0; } } : {} +>x : { [x: number]: number; } +>{ get [yield 0]() { return 0; } } : { [x: number]: number; } get [yield 0]() { >yield 0 : any diff --git a/tests/baselines/reference/generatorTypeCheck45.symbols b/tests/baselines/reference/generatorTypeCheck45.symbols index a637f154dc4..fa8cdacfcd3 100644 --- a/tests/baselines/reference/generatorTypeCheck45.symbols +++ b/tests/baselines/reference/generatorTypeCheck45.symbols @@ -6,7 +6,7 @@ declare function foo(x: T, fun: () => Iterator<(x: T) => U>, fun2: (y: U) >x : Symbol(x, Decl(generatorTypeCheck45.ts, 0, 27)) >T : Symbol(T, Decl(generatorTypeCheck45.ts, 0, 21)) >fun : Symbol(fun, Decl(generatorTypeCheck45.ts, 0, 32)) ->Iterator : Symbol(Iterator, Decl(lib.d.ts, --, --)) +>Iterator : Symbol(Iterator, Decl(lib.es2015.iterable.d.ts, --, --)) >x : Symbol(x, Decl(generatorTypeCheck45.ts, 0, 54)) >T : Symbol(T, Decl(generatorTypeCheck45.ts, 0, 21)) >U : Symbol(U, Decl(generatorTypeCheck45.ts, 0, 23)) @@ -19,9 +19,9 @@ declare function foo(x: T, fun: () => Iterator<(x: T) => U>, fun2: (y: U) foo("", function* () { yield x => x.length }, p => undefined); // T is fixed, should be string >foo : Symbol(foo, Decl(generatorTypeCheck45.ts, 0, 0)) >x : Symbol(x, Decl(generatorTypeCheck45.ts, 2, 28)) ->x.length : Symbol(String.length, Decl(lib.d.ts, --, --)) +>x.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) >x : Symbol(x, Decl(generatorTypeCheck45.ts, 2, 28)) ->length : Symbol(String.length, Decl(lib.d.ts, --, --)) +>length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) >p : Symbol(p, Decl(generatorTypeCheck45.ts, 2, 45)) >undefined : Symbol(undefined) diff --git a/tests/baselines/reference/generatorTypeCheck46.symbols b/tests/baselines/reference/generatorTypeCheck46.symbols index abb170b12a7..e2a10557c86 100644 --- a/tests/baselines/reference/generatorTypeCheck46.symbols +++ b/tests/baselines/reference/generatorTypeCheck46.symbols @@ -6,7 +6,7 @@ declare function foo(x: T, fun: () => Iterable<(x: T) => U>, fun2: (y: U) >x : Symbol(x, Decl(generatorTypeCheck46.ts, 0, 27)) >T : Symbol(T, Decl(generatorTypeCheck46.ts, 0, 21)) >fun : Symbol(fun, Decl(generatorTypeCheck46.ts, 0, 32)) ->Iterable : Symbol(Iterable, Decl(lib.d.ts, --, --)) +>Iterable : Symbol(Iterable, Decl(lib.es2015.iterable.d.ts, --, --)) >x : Symbol(x, Decl(generatorTypeCheck46.ts, 0, 54)) >T : Symbol(T, Decl(generatorTypeCheck46.ts, 0, 21)) >U : Symbol(U, Decl(generatorTypeCheck46.ts, 0, 23)) @@ -21,15 +21,15 @@ foo("", function* () { yield* { *[Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) yield x => x.length >x : Symbol(x, Decl(generatorTypeCheck46.ts, 5, 17)) ->x.length : Symbol(String.length, Decl(lib.d.ts, --, --)) +>x.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) >x : Symbol(x, Decl(generatorTypeCheck46.ts, 5, 17)) ->length : Symbol(String.length, Decl(lib.d.ts, --, --)) +>length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) } } }, p => undefined); // T is fixed, should be string diff --git a/tests/baselines/reference/generatorTypeCheck59.errors.txt b/tests/baselines/reference/generatorTypeCheck59.errors.txt index d8179803821..cba90154701 100644 --- a/tests/baselines/reference/generatorTypeCheck59.errors.txt +++ b/tests/baselines/reference/generatorTypeCheck59.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck59.ts(3,11): error TS1163: A 'yield' expression is only allowed in a generator body. -tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck59.ts(4,9): error TS1219: Experimental support for decorators is a feature that is subject to change in a future release. Specify '--experimentalDecorators' to remove this warning. +tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck59.ts(4,9): error TS1219: Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning. ==== tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck59.ts (2 errors) ==== @@ -10,6 +10,6 @@ tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck59.ts(4,9): error !!! error TS1163: A 'yield' expression is only allowed in a generator body. m() { } ~ -!!! error TS1219: Experimental support for decorators is a feature that is subject to change in a future release. Specify '--experimentalDecorators' to remove this warning. +!!! error TS1219: Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning. }; } \ No newline at end of file diff --git a/tests/baselines/reference/generatorTypeCheck61.errors.txt b/tests/baselines/reference/generatorTypeCheck61.errors.txt index b38e96d31ce..ccc99f7ffbd 100644 --- a/tests/baselines/reference/generatorTypeCheck61.errors.txt +++ b/tests/baselines/reference/generatorTypeCheck61.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck61.ts(2,7): error TS1163: A 'yield' expression is only allowed in a generator body. -tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck61.ts(3,11): error TS1219: Experimental support for decorators is a feature that is subject to change in a future release. Specify '--experimentalDecorators' to remove this warning. +tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck61.ts(3,11): error TS1219: Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning. ==== tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck61.ts (2 errors) ==== @@ -9,5 +9,5 @@ tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck61.ts(3,11): erro !!! error TS1163: A 'yield' expression is only allowed in a generator body. class C {}; ~ -!!! error TS1219: Experimental support for decorators is a feature that is subject to change in a future release. Specify '--experimentalDecorators' to remove this warning. +!!! error TS1219: Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning. } \ No newline at end of file diff --git a/tests/baselines/reference/generatorTypeCheck61.js b/tests/baselines/reference/generatorTypeCheck61.js index b2434ee590c..9cc157f2684 100644 --- a/tests/baselines/reference/generatorTypeCheck61.js +++ b/tests/baselines/reference/generatorTypeCheck61.js @@ -12,7 +12,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, return c > 3 && r && Object.defineProperty(target, key, r), r; }; function* g() { - let C = class { + let C = class C { }; C = __decorate([ (yield 0) diff --git a/tests/baselines/reference/genericAndNonGenericInterfaceWithTheSameName.errors.txt b/tests/baselines/reference/genericAndNonGenericInterfaceWithTheSameName.errors.txt index 4c3245b11f7..8d9ebb8d276 100644 --- a/tests/baselines/reference/genericAndNonGenericInterfaceWithTheSameName.errors.txt +++ b/tests/baselines/reference/genericAndNonGenericInterfaceWithTheSameName.errors.txt @@ -1,6 +1,6 @@ -tests/cases/conformance/interfaces/declarationMerging/genericAndNonGenericInterfaceWithTheSameName.ts(7,11): error TS2428: All declarations of an interface must have identical type parameters. -tests/cases/conformance/interfaces/declarationMerging/genericAndNonGenericInterfaceWithTheSameName.ts(16,15): error TS2428: All declarations of an interface must have identical type parameters. -tests/cases/conformance/interfaces/declarationMerging/genericAndNonGenericInterfaceWithTheSameName.ts(40,22): error TS2428: All declarations of an interface must have identical type parameters. +tests/cases/conformance/interfaces/declarationMerging/genericAndNonGenericInterfaceWithTheSameName.ts(7,11): error TS2428: All declarations of 'A' must have identical type parameters. +tests/cases/conformance/interfaces/declarationMerging/genericAndNonGenericInterfaceWithTheSameName.ts(16,15): error TS2428: All declarations of 'A' must have identical type parameters. +tests/cases/conformance/interfaces/declarationMerging/genericAndNonGenericInterfaceWithTheSameName.ts(40,22): error TS2428: All declarations of 'A' must have identical type parameters. ==== tests/cases/conformance/interfaces/declarationMerging/genericAndNonGenericInterfaceWithTheSameName.ts (3 errors) ==== @@ -12,7 +12,7 @@ tests/cases/conformance/interfaces/declarationMerging/genericAndNonGenericInterf interface A { // error ~ -!!! error TS2428: All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations of 'A' must have identical type parameters. bar: T; } @@ -23,7 +23,7 @@ tests/cases/conformance/interfaces/declarationMerging/genericAndNonGenericInterf interface A { // error ~ -!!! error TS2428: All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations of 'A' must have identical type parameters. foo: string; } } @@ -49,7 +49,7 @@ tests/cases/conformance/interfaces/declarationMerging/genericAndNonGenericInterf module M3 { export interface A { // error ~ -!!! error TS2428: All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations of 'A' must have identical type parameters. bar: T; } } \ No newline at end of file diff --git a/tests/baselines/reference/genericAndNonGenericInterfaceWithTheSameName2.symbols b/tests/baselines/reference/genericAndNonGenericInterfaceWithTheSameName2.symbols index 05b131090c0..e0d66e64854 100644 --- a/tests/baselines/reference/genericAndNonGenericInterfaceWithTheSameName2.symbols +++ b/tests/baselines/reference/genericAndNonGenericInterfaceWithTheSameName2.symbols @@ -9,7 +9,7 @@ module M { >T : Symbol(T, Decl(genericAndNonGenericInterfaceWithTheSameName2.ts, 3, 16)) bar: T; ->bar : Symbol(bar, Decl(genericAndNonGenericInterfaceWithTheSameName2.ts, 3, 20)) +>bar : Symbol(A.bar, Decl(genericAndNonGenericInterfaceWithTheSameName2.ts, 3, 20)) >T : Symbol(T, Decl(genericAndNonGenericInterfaceWithTheSameName2.ts, 3, 16)) } } @@ -21,7 +21,7 @@ module M2 { >A : Symbol(A, Decl(genericAndNonGenericInterfaceWithTheSameName2.ts, 8, 11)) foo: string; ->foo : Symbol(foo, Decl(genericAndNonGenericInterfaceWithTheSameName2.ts, 9, 17)) +>foo : Symbol(A.foo, Decl(genericAndNonGenericInterfaceWithTheSameName2.ts, 9, 17)) } } @@ -36,7 +36,7 @@ module N { >T : Symbol(T, Decl(genericAndNonGenericInterfaceWithTheSameName2.ts, 16, 20)) bar: T; ->bar : Symbol(bar, Decl(genericAndNonGenericInterfaceWithTheSameName2.ts, 16, 24)) +>bar : Symbol(A.bar, Decl(genericAndNonGenericInterfaceWithTheSameName2.ts, 16, 24)) >T : Symbol(T, Decl(genericAndNonGenericInterfaceWithTheSameName2.ts, 16, 20)) } } @@ -48,7 +48,7 @@ module N { >A : Symbol(A, Decl(genericAndNonGenericInterfaceWithTheSameName2.ts, 21, 15)) foo: string; ->foo : Symbol(foo, Decl(genericAndNonGenericInterfaceWithTheSameName2.ts, 22, 21)) +>foo : Symbol(A.foo, Decl(genericAndNonGenericInterfaceWithTheSameName2.ts, 22, 21)) } } } diff --git a/tests/baselines/reference/genericArgumentCallSigAssignmentCompat.symbols b/tests/baselines/reference/genericArgumentCallSigAssignmentCompat.symbols index b38008c38ce..0b09ec06a64 100644 --- a/tests/baselines/reference/genericArgumentCallSigAssignmentCompat.symbols +++ b/tests/baselines/reference/genericArgumentCallSigAssignmentCompat.symbols @@ -19,7 +19,7 @@ module Underscore { >Static : Symbol(Static, Decl(genericArgumentCallSigAssignmentCompat.ts, 3, 5)) all(list: T[], iterator?: Iterator, context?: any): boolean; ->all : Symbol(all, Decl(genericArgumentCallSigAssignmentCompat.ts, 5, 29)) +>all : Symbol(Static.all, Decl(genericArgumentCallSigAssignmentCompat.ts, 5, 29)) >T : Symbol(T, Decl(genericArgumentCallSigAssignmentCompat.ts, 6, 12)) >list : Symbol(list, Decl(genericArgumentCallSigAssignmentCompat.ts, 6, 15)) >T : Symbol(T, Decl(genericArgumentCallSigAssignmentCompat.ts, 6, 12)) @@ -29,7 +29,7 @@ module Underscore { >context : Symbol(context, Decl(genericArgumentCallSigAssignmentCompat.ts, 6, 58)) identity(value: T): T; ->identity : Symbol(identity, Decl(genericArgumentCallSigAssignmentCompat.ts, 6, 83)) +>identity : Symbol(Static.identity, Decl(genericArgumentCallSigAssignmentCompat.ts, 6, 83)) >T : Symbol(T, Decl(genericArgumentCallSigAssignmentCompat.ts, 7, 17)) >value : Symbol(value, Decl(genericArgumentCallSigAssignmentCompat.ts, 7, 20)) >T : Symbol(T, Decl(genericArgumentCallSigAssignmentCompat.ts, 7, 17)) diff --git a/tests/baselines/reference/genericArrayExtenstions.errors.txt b/tests/baselines/reference/genericArrayExtenstions.errors.txt index 7b332366fed..ac0b4072849 100644 --- a/tests/baselines/reference/genericArrayExtenstions.errors.txt +++ b/tests/baselines/reference/genericArrayExtenstions.errors.txt @@ -1,13 +1,10 @@ -tests/cases/compiler/genericArrayExtenstions.ts(1,22): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/compiler/genericArrayExtenstions.ts(1,22): error TS2420: Class 'ObservableArray' incorrectly implements interface 'T[]'. Property 'length' is missing in type 'ObservableArray'. -==== tests/cases/compiler/genericArrayExtenstions.ts (2 errors) ==== +==== tests/cases/compiler/genericArrayExtenstions.ts (1 errors) ==== export declare class ObservableArray implements Array { // MS.Entertainment.ObservableArray ~~~~~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. - ~~~~~~~~~~~~~~~ !!! error TS2420: Class 'ObservableArray' incorrectly implements interface 'T[]'. !!! error TS2420: Property 'length' is missing in type 'ObservableArray'. concat(...items: U[]): T[]; diff --git a/tests/baselines/reference/genericAssignmentCompatWithInterfaces1.errors.txt b/tests/baselines/reference/genericAssignmentCompatWithInterfaces1.errors.txt index f335319cafd..63679ff03b7 100644 --- a/tests/baselines/reference/genericAssignmentCompatWithInterfaces1.errors.txt +++ b/tests/baselines/reference/genericAssignmentCompatWithInterfaces1.errors.txt @@ -4,7 +4,7 @@ tests/cases/compiler/genericAssignmentCompatWithInterfaces1.ts(12,5): error TS23 Types of property 'compareTo' are incompatible. Type '(other: number) => number' is not assignable to type '(other: string) => number'. Types of parameters 'other' and 'other' are incompatible. - Type 'number' is not assignable to type 'string'. + Type 'string' is not assignable to type 'number'. tests/cases/compiler/genericAssignmentCompatWithInterfaces1.ts(13,5): error TS2322: Type '{ x: A; }' is not assignable to type 'I'. Types of property 'x' are incompatible. Type 'A' is not assignable to type 'Comparable'. @@ -36,7 +36,7 @@ tests/cases/compiler/genericAssignmentCompatWithInterfaces1.ts(17,5): error TS23 !!! error TS2322: Types of property 'compareTo' are incompatible. !!! error TS2322: Type '(other: number) => number' is not assignable to type '(other: string) => number'. !!! error TS2322: Types of parameters 'other' and 'other' are incompatible. -!!! error TS2322: Type 'number' is not assignable to type 'string'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. var a2: I = function (): { x: A } { ~~ !!! error TS2322: Type '{ x: A; }' is not assignable to type 'I'. diff --git a/tests/baselines/reference/genericBaseClassLiteralProperty.symbols b/tests/baselines/reference/genericBaseClassLiteralProperty.symbols index f499e243eaa..c03aaa631ff 100644 --- a/tests/baselines/reference/genericBaseClassLiteralProperty.symbols +++ b/tests/baselines/reference/genericBaseClassLiteralProperty.symbols @@ -4,11 +4,11 @@ class BaseClass { >T : Symbol(T, Decl(genericBaseClassLiteralProperty.ts, 0, 16)) public _getValue1: { (): T; }; ->_getValue1 : Symbol(_getValue1, Decl(genericBaseClassLiteralProperty.ts, 0, 20)) +>_getValue1 : Symbol(BaseClass._getValue1, Decl(genericBaseClassLiteralProperty.ts, 0, 20)) >T : Symbol(T, Decl(genericBaseClassLiteralProperty.ts, 0, 16)) public _getValue2: () => T; ->_getValue2 : Symbol(_getValue2, Decl(genericBaseClassLiteralProperty.ts, 1, 34)) +>_getValue2 : Symbol(BaseClass._getValue2, Decl(genericBaseClassLiteralProperty.ts, 1, 34)) >T : Symbol(T, Decl(genericBaseClassLiteralProperty.ts, 0, 16)) } @@ -17,7 +17,7 @@ class SubClass extends BaseClass { >BaseClass : Symbol(BaseClass, Decl(genericBaseClassLiteralProperty.ts, 0, 0)) public Error(): void { ->Error : Symbol(Error, Decl(genericBaseClassLiteralProperty.ts, 5, 42)) +>Error : Symbol(SubClass.Error, Decl(genericBaseClassLiteralProperty.ts, 5, 42)) var x : number = this._getValue1(); >x : Symbol(x, Decl(genericBaseClassLiteralProperty.ts, 8, 11)) diff --git a/tests/baselines/reference/genericBaseClassLiteralProperty2.symbols b/tests/baselines/reference/genericBaseClassLiteralProperty2.symbols index 5ddccd40e38..2fa917493d2 100644 --- a/tests/baselines/reference/genericBaseClassLiteralProperty2.symbols +++ b/tests/baselines/reference/genericBaseClassLiteralProperty2.symbols @@ -8,15 +8,15 @@ class BaseCollection2 { >CollectionItem2 : Symbol(CollectionItem2, Decl(genericBaseClassLiteralProperty2.ts, 0, 0)) _itemsByKey: { [key: string]: TItem; }; ->_itemsByKey : Symbol(_itemsByKey, Decl(genericBaseClassLiteralProperty2.ts, 2, 54)) +>_itemsByKey : Symbol(BaseCollection2._itemsByKey, Decl(genericBaseClassLiteralProperty2.ts, 2, 54)) >key : Symbol(key, Decl(genericBaseClassLiteralProperty2.ts, 3, 20)) >TItem : Symbol(TItem, Decl(genericBaseClassLiteralProperty2.ts, 2, 22)) constructor() { this._itemsByKey = {}; ->this._itemsByKey : Symbol(_itemsByKey, Decl(genericBaseClassLiteralProperty2.ts, 2, 54)) +>this._itemsByKey : Symbol(BaseCollection2._itemsByKey, Decl(genericBaseClassLiteralProperty2.ts, 2, 54)) >this : Symbol(BaseCollection2, Decl(genericBaseClassLiteralProperty2.ts, 0, 25)) ->_itemsByKey : Symbol(_itemsByKey, Decl(genericBaseClassLiteralProperty2.ts, 2, 54)) +>_itemsByKey : Symbol(BaseCollection2._itemsByKey, Decl(genericBaseClassLiteralProperty2.ts, 2, 54)) } } @@ -26,7 +26,7 @@ class DataView2 extends BaseCollection2 { >CollectionItem2 : Symbol(CollectionItem2, Decl(genericBaseClassLiteralProperty2.ts, 0, 0)) fillItems(item: CollectionItem2) { ->fillItems : Symbol(fillItems, Decl(genericBaseClassLiteralProperty2.ts, 9, 58)) +>fillItems : Symbol(DataView2.fillItems, Decl(genericBaseClassLiteralProperty2.ts, 9, 58)) >item : Symbol(item, Decl(genericBaseClassLiteralProperty2.ts, 10, 14)) >CollectionItem2 : Symbol(CollectionItem2, Decl(genericBaseClassLiteralProperty2.ts, 0, 0)) diff --git a/tests/baselines/reference/genericBaseClassLiteralProperty2.types b/tests/baselines/reference/genericBaseClassLiteralProperty2.types index d7d512165f0..3e320824925 100644 --- a/tests/baselines/reference/genericBaseClassLiteralProperty2.types +++ b/tests/baselines/reference/genericBaseClassLiteralProperty2.types @@ -14,11 +14,11 @@ class BaseCollection2 { constructor() { this._itemsByKey = {}; ->this._itemsByKey = {} : { [x: string]: undefined; } +>this._itemsByKey = {} : {} >this._itemsByKey : { [key: string]: TItem; } >this : this >_itemsByKey : { [key: string]: TItem; } ->{} : { [x: string]: undefined; } +>{} : {} } } diff --git a/tests/baselines/reference/genericCallTypeArgumentInference.symbols b/tests/baselines/reference/genericCallTypeArgumentInference.symbols index 2e86bda4ca4..ac802fa3641 100644 --- a/tests/baselines/reference/genericCallTypeArgumentInference.symbols +++ b/tests/baselines/reference/genericCallTypeArgumentInference.symbols @@ -57,14 +57,14 @@ class C { >U : Symbol(U, Decl(genericCallTypeArgumentInference.ts, 20, 10)) constructor(public t: T, public u: U) { ->t : Symbol(t, Decl(genericCallTypeArgumentInference.ts, 21, 16)) +>t : Symbol(C.t, Decl(genericCallTypeArgumentInference.ts, 21, 16)) >T : Symbol(T, Decl(genericCallTypeArgumentInference.ts, 20, 8)) ->u : Symbol(u, Decl(genericCallTypeArgumentInference.ts, 21, 28)) +>u : Symbol(C.u, Decl(genericCallTypeArgumentInference.ts, 21, 28)) >U : Symbol(U, Decl(genericCallTypeArgumentInference.ts, 20, 10)) } foo(t: T, u: U) { ->foo : Symbol(foo, Decl(genericCallTypeArgumentInference.ts, 22, 5)) +>foo : Symbol(C.foo, Decl(genericCallTypeArgumentInference.ts, 22, 5)) >t : Symbol(t, Decl(genericCallTypeArgumentInference.ts, 24, 8)) >T : Symbol(T, Decl(genericCallTypeArgumentInference.ts, 20, 8)) >u : Symbol(u, Decl(genericCallTypeArgumentInference.ts, 24, 13)) @@ -75,7 +75,7 @@ class C { } foo2(t: T, u: U) { ->foo2 : Symbol(foo2, Decl(genericCallTypeArgumentInference.ts, 26, 5)) +>foo2 : Symbol(C.foo2, Decl(genericCallTypeArgumentInference.ts, 26, 5)) >t : Symbol(t, Decl(genericCallTypeArgumentInference.ts, 28, 9)) >T : Symbol(T, Decl(genericCallTypeArgumentInference.ts, 20, 8)) >u : Symbol(u, Decl(genericCallTypeArgumentInference.ts, 28, 14)) @@ -86,7 +86,7 @@ class C { } foo3(t: T, u: U) { ->foo3 : Symbol(foo3, Decl(genericCallTypeArgumentInference.ts, 30, 5)) +>foo3 : Symbol(C.foo3, Decl(genericCallTypeArgumentInference.ts, 30, 5)) >T : Symbol(T, Decl(genericCallTypeArgumentInference.ts, 32, 9)) >t : Symbol(t, Decl(genericCallTypeArgumentInference.ts, 32, 12)) >T : Symbol(T, Decl(genericCallTypeArgumentInference.ts, 32, 9)) @@ -98,7 +98,7 @@ class C { } foo4(t: T, u: U) { ->foo4 : Symbol(foo4, Decl(genericCallTypeArgumentInference.ts, 34, 5)) +>foo4 : Symbol(C.foo4, Decl(genericCallTypeArgumentInference.ts, 34, 5)) >U : Symbol(U, Decl(genericCallTypeArgumentInference.ts, 36, 9)) >t : Symbol(t, Decl(genericCallTypeArgumentInference.ts, 36, 12)) >T : Symbol(T, Decl(genericCallTypeArgumentInference.ts, 20, 8)) @@ -110,7 +110,7 @@ class C { } foo5(t: T, u: U) { ->foo5 : Symbol(foo5, Decl(genericCallTypeArgumentInference.ts, 38, 5)) +>foo5 : Symbol(C.foo5, Decl(genericCallTypeArgumentInference.ts, 38, 5)) >T : Symbol(T, Decl(genericCallTypeArgumentInference.ts, 40, 9)) >U : Symbol(U, Decl(genericCallTypeArgumentInference.ts, 40, 11)) >t : Symbol(t, Decl(genericCallTypeArgumentInference.ts, 40, 14)) @@ -123,7 +123,7 @@ class C { } foo6() { ->foo6 : Symbol(foo6, Decl(genericCallTypeArgumentInference.ts, 42, 5)) +>foo6 : Symbol(C.foo6, Decl(genericCallTypeArgumentInference.ts, 42, 5)) >T : Symbol(T, Decl(genericCallTypeArgumentInference.ts, 44, 9)) >U : Symbol(U, Decl(genericCallTypeArgumentInference.ts, 44, 11)) @@ -136,7 +136,7 @@ class C { } foo7(u: U) { ->foo7 : Symbol(foo7, Decl(genericCallTypeArgumentInference.ts, 47, 5)) +>foo7 : Symbol(C.foo7, Decl(genericCallTypeArgumentInference.ts, 47, 5)) >T : Symbol(T, Decl(genericCallTypeArgumentInference.ts, 49, 9)) >U : Symbol(U, Decl(genericCallTypeArgumentInference.ts, 49, 11)) >u : Symbol(u, Decl(genericCallTypeArgumentInference.ts, 49, 15)) @@ -151,7 +151,7 @@ class C { } foo8() { ->foo8 : Symbol(foo8, Decl(genericCallTypeArgumentInference.ts, 52, 5)) +>foo8 : Symbol(C.foo8, Decl(genericCallTypeArgumentInference.ts, 52, 5)) >T : Symbol(T, Decl(genericCallTypeArgumentInference.ts, 54, 9)) >U : Symbol(U, Decl(genericCallTypeArgumentInference.ts, 54, 11)) @@ -228,7 +228,7 @@ interface I { >U : Symbol(U, Decl(genericCallTypeArgumentInference.ts, 70, 14)) foo(t: T, u: U): T; ->foo : Symbol(foo, Decl(genericCallTypeArgumentInference.ts, 71, 21)) +>foo : Symbol(I.foo, Decl(genericCallTypeArgumentInference.ts, 71, 21)) >t : Symbol(t, Decl(genericCallTypeArgumentInference.ts, 72, 8)) >T : Symbol(T, Decl(genericCallTypeArgumentInference.ts, 70, 12)) >u : Symbol(u, Decl(genericCallTypeArgumentInference.ts, 72, 13)) @@ -236,7 +236,7 @@ interface I { >T : Symbol(T, Decl(genericCallTypeArgumentInference.ts, 70, 12)) foo2(t: T, u: U): U; ->foo2 : Symbol(foo2, Decl(genericCallTypeArgumentInference.ts, 72, 23)) +>foo2 : Symbol(I.foo2, Decl(genericCallTypeArgumentInference.ts, 72, 23)) >t : Symbol(t, Decl(genericCallTypeArgumentInference.ts, 73, 9)) >T : Symbol(T, Decl(genericCallTypeArgumentInference.ts, 70, 12)) >u : Symbol(u, Decl(genericCallTypeArgumentInference.ts, 73, 14)) @@ -244,7 +244,7 @@ interface I { >U : Symbol(U, Decl(genericCallTypeArgumentInference.ts, 70, 14)) foo3(t: T, u: U): T; ->foo3 : Symbol(foo3, Decl(genericCallTypeArgumentInference.ts, 73, 24)) +>foo3 : Symbol(I.foo3, Decl(genericCallTypeArgumentInference.ts, 73, 24)) >T : Symbol(T, Decl(genericCallTypeArgumentInference.ts, 74, 9)) >t : Symbol(t, Decl(genericCallTypeArgumentInference.ts, 74, 12)) >T : Symbol(T, Decl(genericCallTypeArgumentInference.ts, 74, 9)) @@ -253,7 +253,7 @@ interface I { >T : Symbol(T, Decl(genericCallTypeArgumentInference.ts, 74, 9)) foo4(t: T, u: U): T; ->foo4 : Symbol(foo4, Decl(genericCallTypeArgumentInference.ts, 74, 27)) +>foo4 : Symbol(I.foo4, Decl(genericCallTypeArgumentInference.ts, 74, 27)) >U : Symbol(U, Decl(genericCallTypeArgumentInference.ts, 75, 9)) >t : Symbol(t, Decl(genericCallTypeArgumentInference.ts, 75, 12)) >T : Symbol(T, Decl(genericCallTypeArgumentInference.ts, 70, 12)) @@ -262,7 +262,7 @@ interface I { >T : Symbol(T, Decl(genericCallTypeArgumentInference.ts, 70, 12)) foo5(t: T, u: U): T; ->foo5 : Symbol(foo5, Decl(genericCallTypeArgumentInference.ts, 75, 27)) +>foo5 : Symbol(I.foo5, Decl(genericCallTypeArgumentInference.ts, 75, 27)) >T : Symbol(T, Decl(genericCallTypeArgumentInference.ts, 76, 9)) >U : Symbol(U, Decl(genericCallTypeArgumentInference.ts, 76, 11)) >t : Symbol(t, Decl(genericCallTypeArgumentInference.ts, 76, 15)) @@ -272,13 +272,13 @@ interface I { >T : Symbol(T, Decl(genericCallTypeArgumentInference.ts, 76, 9)) foo6(): T; ->foo6 : Symbol(foo6, Decl(genericCallTypeArgumentInference.ts, 76, 30)) +>foo6 : Symbol(I.foo6, Decl(genericCallTypeArgumentInference.ts, 76, 30)) >T : Symbol(T, Decl(genericCallTypeArgumentInference.ts, 77, 9)) >U : Symbol(U, Decl(genericCallTypeArgumentInference.ts, 77, 11)) >T : Symbol(T, Decl(genericCallTypeArgumentInference.ts, 77, 9)) foo7(u: U): T; ->foo7 : Symbol(foo7, Decl(genericCallTypeArgumentInference.ts, 77, 20)) +>foo7 : Symbol(I.foo7, Decl(genericCallTypeArgumentInference.ts, 77, 20)) >T : Symbol(T, Decl(genericCallTypeArgumentInference.ts, 78, 9)) >U : Symbol(U, Decl(genericCallTypeArgumentInference.ts, 78, 11)) >u : Symbol(u, Decl(genericCallTypeArgumentInference.ts, 78, 15)) @@ -286,7 +286,7 @@ interface I { >T : Symbol(T, Decl(genericCallTypeArgumentInference.ts, 78, 9)) foo8(): T; ->foo8 : Symbol(foo8, Decl(genericCallTypeArgumentInference.ts, 78, 24)) +>foo8 : Symbol(I.foo8, Decl(genericCallTypeArgumentInference.ts, 78, 24)) >T : Symbol(T, Decl(genericCallTypeArgumentInference.ts, 79, 9)) >U : Symbol(U, Decl(genericCallTypeArgumentInference.ts, 79, 11)) >T : Symbol(T, Decl(genericCallTypeArgumentInference.ts, 79, 9)) diff --git a/tests/baselines/reference/genericCallWithConstraintsTypeArgumentInference.symbols b/tests/baselines/reference/genericCallWithConstraintsTypeArgumentInference.symbols index 5d419b8f992..ec209ed0ece 100644 --- a/tests/baselines/reference/genericCallWithConstraintsTypeArgumentInference.symbols +++ b/tests/baselines/reference/genericCallWithConstraintsTypeArgumentInference.symbols @@ -3,17 +3,17 @@ class Base { foo: string; } >Base : Symbol(Base, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 0, 0)) ->foo : Symbol(foo, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 2, 12)) +>foo : Symbol(Base.foo, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 2, 12)) class Derived extends Base { bar: string; } >Derived : Symbol(Derived, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 2, 27)) >Base : Symbol(Base, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 0, 0)) ->bar : Symbol(bar, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 3, 28)) +>bar : Symbol(Derived.bar, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 3, 28)) class Derived2 extends Derived { baz: string; } >Derived2 : Symbol(Derived2, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 3, 43)) >Derived : Symbol(Derived, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 2, 27)) ->baz : Symbol(baz, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 4, 32)) +>baz : Symbol(Derived2.baz, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 4, 32)) var b: Base; >b : Symbol(b, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 5, 3)) @@ -112,14 +112,14 @@ class C { >Derived : Symbol(Derived, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 2, 27)) constructor(public t: T, public u: U) { ->t : Symbol(t, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 34, 16)) +>t : Symbol(C.t, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 34, 16)) >T : Symbol(T, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 33, 8)) ->u : Symbol(u, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 34, 28)) +>u : Symbol(C.u, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 34, 28)) >U : Symbol(U, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 33, 23)) } foo(t: T, u: U) { ->foo : Symbol(foo, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 35, 5)) +>foo : Symbol(C.foo, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 35, 5)) >t : Symbol(t, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 37, 8)) >T : Symbol(T, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 33, 8)) >u : Symbol(u, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 37, 13)) @@ -130,7 +130,7 @@ class C { } foo2(t: T, u: U) { ->foo2 : Symbol(foo2, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 39, 5)) +>foo2 : Symbol(C.foo2, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 39, 5)) >t : Symbol(t, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 41, 9)) >T : Symbol(T, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 33, 8)) >u : Symbol(u, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 41, 14)) @@ -141,7 +141,7 @@ class C { } foo3(t: T, u: U) { ->foo3 : Symbol(foo3, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 43, 5)) +>foo3 : Symbol(C.foo3, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 43, 5)) >T : Symbol(T, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 45, 9)) >Derived : Symbol(Derived, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 2, 27)) >t : Symbol(t, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 45, 28)) @@ -154,7 +154,7 @@ class C { } foo4(t: T, u: U) { ->foo4 : Symbol(foo4, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 47, 5)) +>foo4 : Symbol(C.foo4, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 47, 5)) >U : Symbol(U, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 49, 9)) >Derived2 : Symbol(Derived2, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 3, 43)) >t : Symbol(t, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 49, 29)) @@ -167,7 +167,7 @@ class C { } foo5(t: T, u: U) { ->foo5 : Symbol(foo5, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 51, 5)) +>foo5 : Symbol(C.foo5, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 51, 5)) >T : Symbol(T, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 53, 9)) >Derived : Symbol(Derived, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 2, 27)) >U : Symbol(U, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 53, 27)) @@ -182,7 +182,7 @@ class C { } foo6() { ->foo6 : Symbol(foo6, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 55, 5)) +>foo6 : Symbol(C.foo6, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 55, 5)) >T : Symbol(T, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 57, 9)) >Derived : Symbol(Derived, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 2, 27)) >U : Symbol(U, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 57, 27)) @@ -197,7 +197,7 @@ class C { } foo7(u: U) { ->foo7 : Symbol(foo7, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 60, 5)) +>foo7 : Symbol(C.foo7, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 60, 5)) >T : Symbol(T, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 62, 9)) >Base : Symbol(Base, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 0, 0)) >U : Symbol(U, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 62, 24)) @@ -214,7 +214,7 @@ class C { } foo8() { ->foo8 : Symbol(foo8, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 65, 5)) +>foo8 : Symbol(C.foo8, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 65, 5)) >T : Symbol(T, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 67, 9)) >Base : Symbol(Base, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 0, 0)) >U : Symbol(U, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 67, 24)) @@ -316,7 +316,7 @@ interface I { >U : Symbol(U, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 84, 27)) foo(t: T, u: U): T; ->foo : Symbol(foo, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 85, 21)) +>foo : Symbol(I.foo, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 85, 21)) >t : Symbol(t, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 86, 8)) >T : Symbol(T, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 84, 12)) >u : Symbol(u, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 86, 13)) @@ -324,7 +324,7 @@ interface I { >T : Symbol(T, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 84, 12)) foo2(t: T, u: U): U; ->foo2 : Symbol(foo2, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 86, 23)) +>foo2 : Symbol(I.foo2, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 86, 23)) >t : Symbol(t, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 87, 9)) >T : Symbol(T, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 84, 12)) >u : Symbol(u, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 87, 14)) @@ -332,7 +332,7 @@ interface I { >U : Symbol(U, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 84, 27)) foo3(t: T, u: U): T; ->foo3 : Symbol(foo3, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 87, 24)) +>foo3 : Symbol(I.foo3, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 87, 24)) >T : Symbol(T, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 88, 9)) >Derived : Symbol(Derived, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 2, 27)) >t : Symbol(t, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 88, 28)) @@ -342,7 +342,7 @@ interface I { >T : Symbol(T, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 88, 9)) foo4(t: T, u: U): T; ->foo4 : Symbol(foo4, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 88, 43)) +>foo4 : Symbol(I.foo4, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 88, 43)) >U : Symbol(U, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 89, 9)) >Derived2 : Symbol(Derived2, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 3, 43)) >t : Symbol(t, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 89, 29)) @@ -352,7 +352,7 @@ interface I { >T : Symbol(T, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 84, 12)) foo5(t: T, u: U): T; ->foo5 : Symbol(foo5, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 89, 44)) +>foo5 : Symbol(I.foo5, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 89, 44)) >T : Symbol(T, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 90, 9)) >Derived : Symbol(Derived, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 2, 27)) >U : Symbol(U, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 90, 27)) @@ -364,7 +364,7 @@ interface I { >T : Symbol(T, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 90, 9)) foo6(): T; ->foo6 : Symbol(foo6, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 90, 63)) +>foo6 : Symbol(I.foo6, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 90, 63)) >T : Symbol(T, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 91, 9)) >Derived : Symbol(Derived, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 2, 27)) >U : Symbol(U, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 91, 27)) @@ -372,7 +372,7 @@ interface I { >T : Symbol(T, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 91, 9)) foo7(u: U): T; ->foo7 : Symbol(foo7, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 91, 53)) +>foo7 : Symbol(I.foo7, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 91, 53)) >T : Symbol(T, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 92, 9)) >Base : Symbol(Base, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 0, 0)) >U : Symbol(U, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 92, 24)) @@ -382,7 +382,7 @@ interface I { >T : Symbol(T, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 92, 9)) foo8(): T; ->foo8 : Symbol(foo8, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 92, 53)) +>foo8 : Symbol(I.foo8, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 92, 53)) >T : Symbol(T, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 93, 9)) >Base : Symbol(Base, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 0, 0)) >U : Symbol(U, Decl(genericCallWithConstraintsTypeArgumentInference.ts, 93, 24)) diff --git a/tests/baselines/reference/genericCallWithConstraintsTypeArgumentInference2.errors.txt b/tests/baselines/reference/genericCallWithConstraintsTypeArgumentInference2.errors.txt index 6ac3c9e6703..805bde82b64 100644 --- a/tests/baselines/reference/genericCallWithConstraintsTypeArgumentInference2.errors.txt +++ b/tests/baselines/reference/genericCallWithConstraintsTypeArgumentInference2.errors.txt @@ -1,5 +1,4 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithConstraintsTypeArgumentInference2.ts(11,26): error TS2345: Argument of type 'number' is not assignable to parameter of type 'Date'. - Property 'toDateString' is missing in type 'Number'. ==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithConstraintsTypeArgumentInference2.ts (1 errors) ==== @@ -16,5 +15,4 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithCon var r4 = foo(1); // error ~ !!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'Date'. -!!! error TS2345: Property 'toDateString' is missing in type 'Number'. var r5 = foo(new Date()); // no error \ No newline at end of file diff --git a/tests/baselines/reference/genericCallWithFixedArguments.symbols b/tests/baselines/reference/genericCallWithFixedArguments.symbols index c47c5ef8f06..6eaa789f9e4 100644 --- a/tests/baselines/reference/genericCallWithFixedArguments.symbols +++ b/tests/baselines/reference/genericCallWithFixedArguments.symbols @@ -1,11 +1,11 @@ === tests/cases/compiler/genericCallWithFixedArguments.ts === class A { foo() { } } >A : Symbol(A, Decl(genericCallWithFixedArguments.ts, 0, 0)) ->foo : Symbol(foo, Decl(genericCallWithFixedArguments.ts, 0, 9)) +>foo : Symbol(A.foo, Decl(genericCallWithFixedArguments.ts, 0, 9)) class B { bar() { }} >B : Symbol(B, Decl(genericCallWithFixedArguments.ts, 0, 21)) ->bar : Symbol(bar, Decl(genericCallWithFixedArguments.ts, 1, 9)) +>bar : Symbol(B.bar, Decl(genericCallWithFixedArguments.ts, 1, 9)) function g(x) { } >g : Symbol(g, Decl(genericCallWithFixedArguments.ts, 1, 20)) diff --git a/tests/baselines/reference/genericCallWithFunctionTypedArguments4.symbols b/tests/baselines/reference/genericCallWithFunctionTypedArguments4.symbols index 9aa87c28240..2c0fa9e3765 100644 --- a/tests/baselines/reference/genericCallWithFunctionTypedArguments4.symbols +++ b/tests/baselines/reference/genericCallWithFunctionTypedArguments4.symbols @@ -3,11 +3,11 @@ class C { foo: string } >C : Symbol(C, Decl(genericCallWithFunctionTypedArguments4.ts, 0, 0)) ->foo : Symbol(foo, Decl(genericCallWithFunctionTypedArguments4.ts, 2, 9)) +>foo : Symbol(C.foo, Decl(genericCallWithFunctionTypedArguments4.ts, 2, 9)) class D { bar: string } >D : Symbol(D, Decl(genericCallWithFunctionTypedArguments4.ts, 2, 23)) ->bar : Symbol(bar, Decl(genericCallWithFunctionTypedArguments4.ts, 3, 9)) +>bar : Symbol(D.bar, Decl(genericCallWithFunctionTypedArguments4.ts, 3, 9)) var a: { >a : Symbol(a, Decl(genericCallWithFunctionTypedArguments4.ts, 4, 3)) diff --git a/tests/baselines/reference/genericCallWithGenericSignatureArguments2.errors.txt b/tests/baselines/reference/genericCallWithGenericSignatureArguments2.errors.txt index c264058ad9f..e3da7eaeaec 100644 --- a/tests/baselines/reference/genericCallWithGenericSignatureArguments2.errors.txt +++ b/tests/baselines/reference/genericCallWithGenericSignatureArguments2.errors.txt @@ -4,17 +4,14 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGen tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(16,22): error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(25,23): error TS2345: Argument of type '(a: T) => T' is not assignable to parameter of type '(x: Date) => Date'. Types of parameters 'a' and 'x' are incompatible. - Type 'T' is not assignable to type 'Date'. - Type 'RegExp' is not assignable to type 'Date'. - Property 'toDateString' is missing in type 'RegExp'. + Type 'Date' is not assignable to type 'T'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(37,36): error TS2345: Argument of type '(x: E) => F' is not assignable to parameter of type '(x: E) => E'. Type 'F' is not assignable to type 'E'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(50,21): error TS2345: Argument of type 'Date' is not assignable to parameter of type 'T'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(51,22): error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(60,23): error TS2345: Argument of type '(a: T) => T' is not assignable to parameter of type '(x: Date) => Date'. Types of parameters 'a' and 'x' are incompatible. - Type 'T' is not assignable to type 'Date'. - Type 'RegExp' is not assignable to type 'Date'. + Type 'Date' is not assignable to type 'T'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(67,51): error TS2304: Cannot find name 'U'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(67,57): error TS2304: Cannot find name 'U'. @@ -55,9 +52,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGen ~~~~~~~~~~~ !!! error TS2345: Argument of type '(a: T) => T' is not assignable to parameter of type '(x: Date) => Date'. !!! error TS2345: Types of parameters 'a' and 'x' are incompatible. -!!! error TS2345: Type 'T' is not assignable to type 'Date'. -!!! error TS2345: Type 'RegExp' is not assignable to type 'Date'. -!!! error TS2345: Property 'toDateString' is missing in type 'RegExp'. +!!! error TS2345: Type 'Date' is not assignable to type 'T'. var r7b = foo2((a) => a, (b) => b); // valid, T is inferred to be Date } @@ -103,8 +98,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGen ~~~~~~~~~~~ !!! error TS2345: Argument of type '(a: T) => T' is not assignable to parameter of type '(x: Date) => Date'. !!! error TS2345: Types of parameters 'a' and 'x' are incompatible. -!!! error TS2345: Type 'T' is not assignable to type 'Date'. -!!! error TS2345: Type 'RegExp' is not assignable to type 'Date'. +!!! error TS2345: Type 'Date' is not assignable to type 'T'. var r7b = foo2((a) => a, (b) => b); } diff --git a/tests/baselines/reference/genericCallWithObjectTypeArgs2.symbols b/tests/baselines/reference/genericCallWithObjectTypeArgs2.symbols index f567499d4c9..3a5e2d948ba 100644 --- a/tests/baselines/reference/genericCallWithObjectTypeArgs2.symbols +++ b/tests/baselines/reference/genericCallWithObjectTypeArgs2.symbols @@ -3,21 +3,21 @@ class Base { >Base : Symbol(Base, Decl(genericCallWithObjectTypeArgs2.ts, 0, 0)) x: string; ->x : Symbol(x, Decl(genericCallWithObjectTypeArgs2.ts, 0, 12)) +>x : Symbol(Base.x, Decl(genericCallWithObjectTypeArgs2.ts, 0, 12)) } class Derived extends Base { >Derived : Symbol(Derived, Decl(genericCallWithObjectTypeArgs2.ts, 2, 1)) >Base : Symbol(Base, Decl(genericCallWithObjectTypeArgs2.ts, 0, 0)) y: string; ->y : Symbol(y, Decl(genericCallWithObjectTypeArgs2.ts, 3, 28)) +>y : Symbol(Derived.y, Decl(genericCallWithObjectTypeArgs2.ts, 3, 28)) } class Derived2 extends Base { >Derived2 : Symbol(Derived2, Decl(genericCallWithObjectTypeArgs2.ts, 5, 1)) >Base : Symbol(Base, Decl(genericCallWithObjectTypeArgs2.ts, 0, 0)) z: string; ->z : Symbol(z, Decl(genericCallWithObjectTypeArgs2.ts, 6, 29)) +>z : Symbol(Derived2.z, Decl(genericCallWithObjectTypeArgs2.ts, 6, 29)) } // returns {}[] @@ -93,11 +93,11 @@ interface I { >U : Symbol(U, Decl(genericCallWithObjectTypeArgs2.ts, 25, 14)) x: T; ->x : Symbol(x, Decl(genericCallWithObjectTypeArgs2.ts, 25, 19)) +>x : Symbol(I.x, Decl(genericCallWithObjectTypeArgs2.ts, 25, 19)) >T : Symbol(T, Decl(genericCallWithObjectTypeArgs2.ts, 25, 12)) y: U; ->y : Symbol(y, Decl(genericCallWithObjectTypeArgs2.ts, 26, 9)) +>y : Symbol(I.y, Decl(genericCallWithObjectTypeArgs2.ts, 26, 9)) >U : Symbol(U, Decl(genericCallWithObjectTypeArgs2.ts, 25, 14)) } diff --git a/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints.symbols b/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints.symbols index 50f20f55bea..20e04f26340 100644 --- a/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints.symbols +++ b/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints.symbols @@ -6,17 +6,17 @@ class C { >C : Symbol(C, Decl(genericCallWithObjectTypeArgsAndConstraints.ts, 0, 0)) x: string; ->x : Symbol(x, Decl(genericCallWithObjectTypeArgsAndConstraints.ts, 3, 9)) +>x : Symbol(C.x, Decl(genericCallWithObjectTypeArgsAndConstraints.ts, 3, 9)) } class D { >D : Symbol(D, Decl(genericCallWithObjectTypeArgsAndConstraints.ts, 5, 1)) x: string; ->x : Symbol(x, Decl(genericCallWithObjectTypeArgsAndConstraints.ts, 7, 9)) +>x : Symbol(D.x, Decl(genericCallWithObjectTypeArgsAndConstraints.ts, 7, 9)) y: string; ->y : Symbol(y, Decl(genericCallWithObjectTypeArgsAndConstraints.ts, 8, 14)) +>y : Symbol(D.y, Decl(genericCallWithObjectTypeArgsAndConstraints.ts, 8, 14)) } class X { @@ -24,7 +24,7 @@ class X { >T : Symbol(T, Decl(genericCallWithObjectTypeArgsAndConstraints.ts, 12, 8)) x: T; ->x : Symbol(x, Decl(genericCallWithObjectTypeArgsAndConstraints.ts, 12, 12)) +>x : Symbol(X.x, Decl(genericCallWithObjectTypeArgsAndConstraints.ts, 12, 12)) >T : Symbol(T, Decl(genericCallWithObjectTypeArgsAndConstraints.ts, 12, 8)) } diff --git a/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints2.symbols b/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints2.symbols index 864927a3a8c..27c015ffcff 100644 --- a/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints2.symbols +++ b/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints2.symbols @@ -6,14 +6,14 @@ class Base { >Base : Symbol(Base, Decl(genericCallWithObjectTypeArgsAndConstraints2.ts, 0, 0)) x: string; ->x : Symbol(x, Decl(genericCallWithObjectTypeArgsAndConstraints2.ts, 3, 12)) +>x : Symbol(Base.x, Decl(genericCallWithObjectTypeArgsAndConstraints2.ts, 3, 12)) } class Derived extends Base { >Derived : Symbol(Derived, Decl(genericCallWithObjectTypeArgsAndConstraints2.ts, 5, 1)) >Base : Symbol(Base, Decl(genericCallWithObjectTypeArgsAndConstraints2.ts, 0, 0)) y: string; ->y : Symbol(y, Decl(genericCallWithObjectTypeArgsAndConstraints2.ts, 6, 28)) +>y : Symbol(Derived.y, Decl(genericCallWithObjectTypeArgsAndConstraints2.ts, 6, 28)) } function f(x: { foo: T; bar: T }) { @@ -55,7 +55,7 @@ interface I { >T : Symbol(T, Decl(genericCallWithObjectTypeArgsAndConstraints2.ts, 18, 12)) a: T; ->a : Symbol(a, Decl(genericCallWithObjectTypeArgsAndConstraints2.ts, 18, 16)) +>a : Symbol(I.a, Decl(genericCallWithObjectTypeArgsAndConstraints2.ts, 18, 16)) >T : Symbol(T, Decl(genericCallWithObjectTypeArgsAndConstraints2.ts, 18, 12)) } function f2(x: I) { diff --git a/tests/baselines/reference/genericCallWithObjectTypeArgsAndIndexers.symbols b/tests/baselines/reference/genericCallWithObjectTypeArgsAndIndexers.symbols index 3824029dfec..4aa4807b637 100644 --- a/tests/baselines/reference/genericCallWithObjectTypeArgsAndIndexers.symbols +++ b/tests/baselines/reference/genericCallWithObjectTypeArgsAndIndexers.symbols @@ -20,7 +20,7 @@ var a: { [x: number]: Date; >x : Symbol(x, Decl(genericCallWithObjectTypeArgsAndIndexers.ts, 8, 5)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) }; var r = foo(a); @@ -31,7 +31,7 @@ var r = foo(a); function other(arg: T) { >other : Symbol(other, Decl(genericCallWithObjectTypeArgsAndIndexers.ts, 10, 15)) >T : Symbol(T, Decl(genericCallWithObjectTypeArgsAndIndexers.ts, 12, 15)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >arg : Symbol(arg, Decl(genericCallWithObjectTypeArgsAndIndexers.ts, 12, 31)) >T : Symbol(T, Decl(genericCallWithObjectTypeArgsAndIndexers.ts, 12, 15)) diff --git a/tests/baselines/reference/genericCallWithObjectTypeArgsAndIndexersErrors.symbols b/tests/baselines/reference/genericCallWithObjectTypeArgsAndIndexersErrors.symbols index 0f3fe58da01..e8371f0cf76 100644 --- a/tests/baselines/reference/genericCallWithObjectTypeArgsAndIndexersErrors.symbols +++ b/tests/baselines/reference/genericCallWithObjectTypeArgsAndIndexersErrors.symbols @@ -40,7 +40,7 @@ function other3(arg: T) { >T : Symbol(T, Decl(genericCallWithObjectTypeArgsAndIndexersErrors.ts, 14, 16)) >U : Symbol(U, Decl(genericCallWithObjectTypeArgsAndIndexersErrors.ts, 14, 28)) >U : Symbol(U, Decl(genericCallWithObjectTypeArgsAndIndexersErrors.ts, 14, 28)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >arg : Symbol(arg, Decl(genericCallWithObjectTypeArgsAndIndexersErrors.ts, 14, 45)) >T : Symbol(T, Decl(genericCallWithObjectTypeArgsAndIndexersErrors.ts, 14, 16)) diff --git a/tests/baselines/reference/genericCallWithObjectTypeArgsAndNumericIndexer.symbols b/tests/baselines/reference/genericCallWithObjectTypeArgsAndNumericIndexer.symbols index 4e7622d3d81..58d9d2a3770 100644 --- a/tests/baselines/reference/genericCallWithObjectTypeArgsAndNumericIndexer.symbols +++ b/tests/baselines/reference/genericCallWithObjectTypeArgsAndNumericIndexer.symbols @@ -14,7 +14,7 @@ function foo(x: T) { var a: { [x: number]: Date }; >a : Symbol(a, Decl(genericCallWithObjectTypeArgsAndNumericIndexer.ts, 6, 3)) >x : Symbol(x, Decl(genericCallWithObjectTypeArgsAndNumericIndexer.ts, 6, 10)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) var r = foo(a); >r : Symbol(r, Decl(genericCallWithObjectTypeArgsAndNumericIndexer.ts, 7, 3)) @@ -41,7 +41,7 @@ function other(arg: T) { function other2(arg: T) { >other2 : Symbol(other2, Decl(genericCallWithObjectTypeArgsAndNumericIndexer.ts, 12, 1)) >T : Symbol(T, Decl(genericCallWithObjectTypeArgsAndNumericIndexer.ts, 14, 16)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >arg : Symbol(arg, Decl(genericCallWithObjectTypeArgsAndNumericIndexer.ts, 14, 32)) >T : Symbol(T, Decl(genericCallWithObjectTypeArgsAndNumericIndexer.ts, 14, 16)) @@ -63,9 +63,9 @@ function other2(arg: T) { function other3(arg: T) { >other3 : Symbol(other3, Decl(genericCallWithObjectTypeArgsAndNumericIndexer.ts, 18, 1)) >T : Symbol(T, Decl(genericCallWithObjectTypeArgsAndNumericIndexer.ts, 20, 16)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >U : Symbol(U, Decl(genericCallWithObjectTypeArgsAndNumericIndexer.ts, 20, 31)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >arg : Symbol(arg, Decl(genericCallWithObjectTypeArgsAndNumericIndexer.ts, 20, 48)) >T : Symbol(T, Decl(genericCallWithObjectTypeArgsAndNumericIndexer.ts, 20, 16)) diff --git a/tests/baselines/reference/genericCallWithObjectTypeArgsAndStringIndexer.symbols b/tests/baselines/reference/genericCallWithObjectTypeArgsAndStringIndexer.symbols index 932cedf148e..56f1015f620 100644 --- a/tests/baselines/reference/genericCallWithObjectTypeArgsAndStringIndexer.symbols +++ b/tests/baselines/reference/genericCallWithObjectTypeArgsAndStringIndexer.symbols @@ -14,7 +14,7 @@ function foo(x: T) { var a: { [x: string]: Date }; >a : Symbol(a, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 6, 3)) >x : Symbol(x, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 6, 10)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) var r = foo(a); >r : Symbol(r, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 7, 3)) @@ -41,7 +41,7 @@ function other(arg: T) { function other2(arg: T) { >other2 : Symbol(other2, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 12, 1)) >T : Symbol(T, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 14, 16)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >arg : Symbol(arg, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 14, 32)) >T : Symbol(T, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 14, 16)) @@ -57,16 +57,16 @@ function other2(arg: T) { var d: Date = r2['hm']; // ok >d : Symbol(d, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 17, 7)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >r2 : Symbol(r2, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 16, 7)) } function other3(arg: T) { >other3 : Symbol(other3, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 18, 1)) >T : Symbol(T, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 20, 16)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >U : Symbol(U, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 20, 31)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >arg : Symbol(arg, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 20, 48)) >T : Symbol(T, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 20, 16)) @@ -82,7 +82,7 @@ function other3(arg: T) { var d: Date = r2['hm']; // ok >d : Symbol(d, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 23, 7)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >r2 : Symbol(r2, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 22, 7)) // BUG 821629 diff --git a/tests/baselines/reference/genericCallWithTupleType.errors.txt b/tests/baselines/reference/genericCallWithTupleType.errors.txt index d03f8d5e68a..24e0505d009 100644 --- a/tests/baselines/reference/genericCallWithTupleType.errors.txt +++ b/tests/baselines/reference/genericCallWithTupleType.errors.txt @@ -3,15 +3,14 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTup Type '() => string | number | boolean' is not assignable to type '() => string | number'. Type 'string | number | boolean' is not assignable to type 'string | number'. Type 'boolean' is not assignable to type 'string | number'. - Type 'boolean' is not assignable to type 'number'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTupleType.ts(14,1): error TS2322: Type '{ a: string; }' is not assignable to type 'string | number'. Type '{ a: string; }' is not assignable to type 'number'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTupleType.ts(22,1): error TS2322: Type '[number, string]' is not assignable to type '[string, number]'. Types of property '0' are incompatible. Type 'number' is not assignable to type 'string'. -tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTupleType.ts(23,1): error TS2322: Type '[{ [x: number]: undefined; }, {}]' is not assignable to type '[string, number]'. +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTupleType.ts(23,1): error TS2322: Type '[{}, {}]' is not assignable to type '[string, number]'. Types of property '0' are incompatible. - Type '{ [x: number]: undefined; }' is not assignable to type 'string'. + Type '{}' is not assignable to type 'string'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTupleType.ts(24,1): error TS2322: Type '[{}]' is not assignable to type '[{}, {}]'. Property '1' is missing in type '[{}]'. @@ -35,7 +34,6 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTup !!! error TS2322: Type '() => string | number | boolean' is not assignable to type '() => string | number'. !!! error TS2322: Type 'string | number | boolean' is not assignable to type 'string | number'. !!! error TS2322: Type 'boolean' is not assignable to type 'string | number'. -!!! error TS2322: Type 'boolean' is not assignable to type 'number'. var e3 = i1.tuple1[2]; // {} i1.tuple1[3] = { a: "string" }; ~~~~~~~~~~~~ @@ -55,9 +53,9 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTup !!! error TS2322: Type 'number' is not assignable to type 'string'. i1.tuple1 = [{}, {}]; ~~~~~~~~~ -!!! error TS2322: Type '[{ [x: number]: undefined; }, {}]' is not assignable to type '[string, number]'. +!!! error TS2322: Type '[{}, {}]' is not assignable to type '[string, number]'. !!! error TS2322: Types of property '0' are incompatible. -!!! error TS2322: Type '{ [x: number]: undefined; }' is not assignable to type 'string'. +!!! error TS2322: Type '{}' is not assignable to type 'string'. i2.tuple1 = [{}]; ~~~~~~~~~ !!! error TS2322: Type '[{}]' is not assignable to type '[{}, {}]'. diff --git a/tests/baselines/reference/genericCallbacksAndClassHierarchy.symbols b/tests/baselines/reference/genericCallbacksAndClassHierarchy.symbols index be46c49a9ca..bd833c6f235 100644 --- a/tests/baselines/reference/genericCallbacksAndClassHierarchy.symbols +++ b/tests/baselines/reference/genericCallbacksAndClassHierarchy.symbols @@ -7,7 +7,7 @@ module M { >T : Symbol(T, Decl(genericCallbacksAndClassHierarchy.ts, 1, 23)) subscribe(callback: (newValue: T) => void ): any; ->subscribe : Symbol(subscribe, Decl(genericCallbacksAndClassHierarchy.ts, 1, 27)) +>subscribe : Symbol(I.subscribe, Decl(genericCallbacksAndClassHierarchy.ts, 1, 27)) >callback : Symbol(callback, Decl(genericCallbacksAndClassHierarchy.ts, 2, 18)) >newValue : Symbol(newValue, Decl(genericCallbacksAndClassHierarchy.ts, 2, 29)) >T : Symbol(T, Decl(genericCallbacksAndClassHierarchy.ts, 1, 23)) @@ -17,7 +17,7 @@ module M { >T : Symbol(T, Decl(genericCallbacksAndClassHierarchy.ts, 4, 20)) public value: I; ->value : Symbol(value, Decl(genericCallbacksAndClassHierarchy.ts, 4, 24)) +>value : Symbol(C1.value, Decl(genericCallbacksAndClassHierarchy.ts, 4, 24)) >I : Symbol(I, Decl(genericCallbacksAndClassHierarchy.ts, 0, 10)) >T : Symbol(T, Decl(genericCallbacksAndClassHierarchy.ts, 4, 20)) } @@ -26,7 +26,7 @@ module M { >T : Symbol(T, Decl(genericCallbacksAndClassHierarchy.ts, 7, 19)) public dummy: any; ->dummy : Symbol(dummy, Decl(genericCallbacksAndClassHierarchy.ts, 7, 23)) +>dummy : Symbol(A.dummy, Decl(genericCallbacksAndClassHierarchy.ts, 7, 23)) } export class B extends C1> { } >B : Symbol(B, Decl(genericCallbacksAndClassHierarchy.ts, 9, 5)) @@ -40,7 +40,7 @@ module M { >T : Symbol(T, Decl(genericCallbacksAndClassHierarchy.ts, 11, 19)) _subscribe(viewModel: B): void { ->_subscribe : Symbol(_subscribe, Decl(genericCallbacksAndClassHierarchy.ts, 11, 23)) +>_subscribe : Symbol(D._subscribe, Decl(genericCallbacksAndClassHierarchy.ts, 11, 23)) >viewModel : Symbol(viewModel, Decl(genericCallbacksAndClassHierarchy.ts, 12, 19)) >B : Symbol(B, Decl(genericCallbacksAndClassHierarchy.ts, 9, 5)) >T : Symbol(T, Decl(genericCallbacksAndClassHierarchy.ts, 11, 19)) diff --git a/tests/baselines/reference/genericClassExpressionInFunction.symbols b/tests/baselines/reference/genericClassExpressionInFunction.symbols index b5a6b8c6c70..2384cd2ed47 100644 --- a/tests/baselines/reference/genericClassExpressionInFunction.symbols +++ b/tests/baselines/reference/genericClassExpressionInFunction.symbols @@ -4,7 +4,7 @@ class A { >T : Symbol(T, Decl(genericClassExpressionInFunction.ts, 0, 8)) genericVar: T ->genericVar : Symbol(genericVar, Decl(genericClassExpressionInFunction.ts, 0, 12)) +>genericVar : Symbol(A.genericVar, Decl(genericClassExpressionInFunction.ts, 0, 12)) >T : Symbol(T, Decl(genericClassExpressionInFunction.ts, 0, 8)) } function B1() { @@ -21,7 +21,7 @@ class B2 { >V : Symbol(V, Decl(genericClassExpressionInFunction.ts, 7, 9)) anon = class extends A { } ->anon : Symbol(anon, Decl(genericClassExpressionInFunction.ts, 7, 13)) +>anon : Symbol(B2.anon, Decl(genericClassExpressionInFunction.ts, 7, 13)) >A : Symbol(A, Decl(genericClassExpressionInFunction.ts, 0, 0)) >V : Symbol(V, Decl(genericClassExpressionInFunction.ts, 7, 9)) } @@ -41,7 +41,7 @@ class K extends B1() { >B1 : Symbol(B1, Decl(genericClassExpressionInFunction.ts, 2, 1)) namae: string; ->namae : Symbol(namae, Decl(genericClassExpressionInFunction.ts, 14, 30)) +>namae : Symbol(K.namae, Decl(genericClassExpressionInFunction.ts, 14, 30)) } class C extends (new B2().anon) { >C : Symbol(C, Decl(genericClassExpressionInFunction.ts, 16, 1)) @@ -50,7 +50,7 @@ class C extends (new B2().anon) { >anon : Symbol(B2.anon, Decl(genericClassExpressionInFunction.ts, 7, 13)) name: string; ->name : Symbol(name, Decl(genericClassExpressionInFunction.ts, 17, 41)) +>name : Symbol(C.name, Decl(genericClassExpressionInFunction.ts, 17, 41)) } let b3Number = B3(); >b3Number : Symbol(b3Number, Decl(genericClassExpressionInFunction.ts, 20, 3)) @@ -61,7 +61,7 @@ class S extends b3Number { >b3Number : Symbol(b3Number, Decl(genericClassExpressionInFunction.ts, 20, 3)) nom: string; ->nom : Symbol(nom, Decl(genericClassExpressionInFunction.ts, 21, 34)) +>nom : Symbol(S.nom, Decl(genericClassExpressionInFunction.ts, 21, 34)) } var c = new C(); >c : Symbol(c, Decl(genericClassExpressionInFunction.ts, 24, 3)) diff --git a/tests/baselines/reference/genericClassPropertyInheritanceSpecialization.symbols b/tests/baselines/reference/genericClassPropertyInheritanceSpecialization.symbols index 291f439c9a9..f0f3fdd4713 100644 --- a/tests/baselines/reference/genericClassPropertyInheritanceSpecialization.symbols +++ b/tests/baselines/reference/genericClassPropertyInheritanceSpecialization.symbols @@ -4,7 +4,7 @@ interface KnockoutObservableBase { >T : Symbol(T, Decl(genericClassPropertyInheritanceSpecialization.ts, 0, 33)) peek(): T; ->peek : Symbol(peek, Decl(genericClassPropertyInheritanceSpecialization.ts, 0, 37)) +>peek : Symbol(KnockoutObservableBase.peek, Decl(genericClassPropertyInheritanceSpecialization.ts, 0, 37)) >T : Symbol(T, Decl(genericClassPropertyInheritanceSpecialization.ts, 0, 33)) (): T; @@ -22,17 +22,17 @@ interface KnockoutObservable extends KnockoutObservableBase { >T : Symbol(T, Decl(genericClassPropertyInheritanceSpecialization.ts, 6, 29)) equalityComparer(a: T, b: T): boolean; ->equalityComparer : Symbol(equalityComparer, Decl(genericClassPropertyInheritanceSpecialization.ts, 6, 67)) +>equalityComparer : Symbol(KnockoutObservable.equalityComparer, Decl(genericClassPropertyInheritanceSpecialization.ts, 6, 67)) >a : Symbol(a, Decl(genericClassPropertyInheritanceSpecialization.ts, 7, 21)) >T : Symbol(T, Decl(genericClassPropertyInheritanceSpecialization.ts, 6, 29)) >b : Symbol(b, Decl(genericClassPropertyInheritanceSpecialization.ts, 7, 26)) >T : Symbol(T, Decl(genericClassPropertyInheritanceSpecialization.ts, 6, 29)) valueHasMutated(): void; ->valueHasMutated : Symbol(valueHasMutated, Decl(genericClassPropertyInheritanceSpecialization.ts, 7, 42)) +>valueHasMutated : Symbol(KnockoutObservable.valueHasMutated, Decl(genericClassPropertyInheritanceSpecialization.ts, 7, 42)) valueWillMutate(): void; ->valueWillMutate : Symbol(valueWillMutate, Decl(genericClassPropertyInheritanceSpecialization.ts, 8, 28)) +>valueWillMutate : Symbol(KnockoutObservable.valueWillMutate, Decl(genericClassPropertyInheritanceSpecialization.ts, 8, 28)) } interface KnockoutObservableArray extends KnockoutObservable { @@ -42,19 +42,19 @@ interface KnockoutObservableArray extends KnockoutObservable { >T : Symbol(T, Decl(genericClassPropertyInheritanceSpecialization.ts, 12, 34)) indexOf(searchElement: T, fromIndex?: number): number; ->indexOf : Symbol(indexOf, Decl(genericClassPropertyInheritanceSpecialization.ts, 12, 70)) +>indexOf : Symbol(KnockoutObservableArray.indexOf, Decl(genericClassPropertyInheritanceSpecialization.ts, 12, 70)) >searchElement : Symbol(searchElement, Decl(genericClassPropertyInheritanceSpecialization.ts, 13, 12)) >T : Symbol(T, Decl(genericClassPropertyInheritanceSpecialization.ts, 12, 34)) >fromIndex : Symbol(fromIndex, Decl(genericClassPropertyInheritanceSpecialization.ts, 13, 29)) slice(start: number, end?: number): T[]; ->slice : Symbol(slice, Decl(genericClassPropertyInheritanceSpecialization.ts, 13, 58)) +>slice : Symbol(KnockoutObservableArray.slice, Decl(genericClassPropertyInheritanceSpecialization.ts, 13, 58)) >start : Symbol(start, Decl(genericClassPropertyInheritanceSpecialization.ts, 14, 10)) >end : Symbol(end, Decl(genericClassPropertyInheritanceSpecialization.ts, 14, 24)) >T : Symbol(T, Decl(genericClassPropertyInheritanceSpecialization.ts, 12, 34)) splice(start: number, deleteCount?: number, ...items: T[]): T[]; ->splice : Symbol(splice, Decl(genericClassPropertyInheritanceSpecialization.ts, 14, 44)) +>splice : Symbol(KnockoutObservableArray.splice, Decl(genericClassPropertyInheritanceSpecialization.ts, 14, 44)) >start : Symbol(start, Decl(genericClassPropertyInheritanceSpecialization.ts, 15, 11)) >deleteCount : Symbol(deleteCount, Decl(genericClassPropertyInheritanceSpecialization.ts, 15, 25)) >items : Symbol(items, Decl(genericClassPropertyInheritanceSpecialization.ts, 15, 47)) @@ -62,29 +62,29 @@ interface KnockoutObservableArray extends KnockoutObservable { >T : Symbol(T, Decl(genericClassPropertyInheritanceSpecialization.ts, 12, 34)) pop(): T; ->pop : Symbol(pop, Decl(genericClassPropertyInheritanceSpecialization.ts, 15, 68)) +>pop : Symbol(KnockoutObservableArray.pop, Decl(genericClassPropertyInheritanceSpecialization.ts, 15, 68)) >T : Symbol(T, Decl(genericClassPropertyInheritanceSpecialization.ts, 12, 34)) push(...items: T[]): void; ->push : Symbol(push, Decl(genericClassPropertyInheritanceSpecialization.ts, 16, 13)) +>push : Symbol(KnockoutObservableArray.push, Decl(genericClassPropertyInheritanceSpecialization.ts, 16, 13)) >items : Symbol(items, Decl(genericClassPropertyInheritanceSpecialization.ts, 17, 9)) >T : Symbol(T, Decl(genericClassPropertyInheritanceSpecialization.ts, 12, 34)) shift(): T; ->shift : Symbol(shift, Decl(genericClassPropertyInheritanceSpecialization.ts, 17, 30)) +>shift : Symbol(KnockoutObservableArray.shift, Decl(genericClassPropertyInheritanceSpecialization.ts, 17, 30)) >T : Symbol(T, Decl(genericClassPropertyInheritanceSpecialization.ts, 12, 34)) unshift(...items: T[]): number; ->unshift : Symbol(unshift, Decl(genericClassPropertyInheritanceSpecialization.ts, 18, 15)) +>unshift : Symbol(KnockoutObservableArray.unshift, Decl(genericClassPropertyInheritanceSpecialization.ts, 18, 15)) >items : Symbol(items, Decl(genericClassPropertyInheritanceSpecialization.ts, 19, 12)) >T : Symbol(T, Decl(genericClassPropertyInheritanceSpecialization.ts, 12, 34)) reverse(): T[]; ->reverse : Symbol(reverse, Decl(genericClassPropertyInheritanceSpecialization.ts, 19, 35)) +>reverse : Symbol(KnockoutObservableArray.reverse, Decl(genericClassPropertyInheritanceSpecialization.ts, 19, 35)) >T : Symbol(T, Decl(genericClassPropertyInheritanceSpecialization.ts, 12, 34)) sort(compareFunction?: (a: T, b: T) => number): void; ->sort : Symbol(sort, Decl(genericClassPropertyInheritanceSpecialization.ts, 20, 19)) +>sort : Symbol(KnockoutObservableArray.sort, Decl(genericClassPropertyInheritanceSpecialization.ts, 20, 19)) >compareFunction : Symbol(compareFunction, Decl(genericClassPropertyInheritanceSpecialization.ts, 21, 9)) >a : Symbol(a, Decl(genericClassPropertyInheritanceSpecialization.ts, 21, 28)) >T : Symbol(T, Decl(genericClassPropertyInheritanceSpecialization.ts, 12, 34)) @@ -92,31 +92,31 @@ interface KnockoutObservableArray extends KnockoutObservable { >T : Symbol(T, Decl(genericClassPropertyInheritanceSpecialization.ts, 12, 34)) replace(oldItem: T, newItem: T): void; ->replace : Symbol(replace, Decl(genericClassPropertyInheritanceSpecialization.ts, 21, 57)) +>replace : Symbol(KnockoutObservableArray.replace, Decl(genericClassPropertyInheritanceSpecialization.ts, 21, 57)) >oldItem : Symbol(oldItem, Decl(genericClassPropertyInheritanceSpecialization.ts, 22, 12)) >T : Symbol(T, Decl(genericClassPropertyInheritanceSpecialization.ts, 12, 34)) >newItem : Symbol(newItem, Decl(genericClassPropertyInheritanceSpecialization.ts, 22, 23)) >T : Symbol(T, Decl(genericClassPropertyInheritanceSpecialization.ts, 12, 34)) remove(item: T): T[]; ->remove : Symbol(remove, Decl(genericClassPropertyInheritanceSpecialization.ts, 22, 42)) +>remove : Symbol(KnockoutObservableArray.remove, Decl(genericClassPropertyInheritanceSpecialization.ts, 22, 42)) >item : Symbol(item, Decl(genericClassPropertyInheritanceSpecialization.ts, 23, 11)) >T : Symbol(T, Decl(genericClassPropertyInheritanceSpecialization.ts, 12, 34)) >T : Symbol(T, Decl(genericClassPropertyInheritanceSpecialization.ts, 12, 34)) removeAll(items?: T[]): T[]; ->removeAll : Symbol(removeAll, Decl(genericClassPropertyInheritanceSpecialization.ts, 23, 25)) +>removeAll : Symbol(KnockoutObservableArray.removeAll, Decl(genericClassPropertyInheritanceSpecialization.ts, 23, 25)) >items : Symbol(items, Decl(genericClassPropertyInheritanceSpecialization.ts, 24, 14)) >T : Symbol(T, Decl(genericClassPropertyInheritanceSpecialization.ts, 12, 34)) >T : Symbol(T, Decl(genericClassPropertyInheritanceSpecialization.ts, 12, 34)) destroy(item: T): void; ->destroy : Symbol(destroy, Decl(genericClassPropertyInheritanceSpecialization.ts, 24, 32)) +>destroy : Symbol(KnockoutObservableArray.destroy, Decl(genericClassPropertyInheritanceSpecialization.ts, 24, 32)) >item : Symbol(item, Decl(genericClassPropertyInheritanceSpecialization.ts, 25, 12)) >T : Symbol(T, Decl(genericClassPropertyInheritanceSpecialization.ts, 12, 34)) destroyAll(items?: T[]): void; ->destroyAll : Symbol(destroyAll, Decl(genericClassPropertyInheritanceSpecialization.ts, 25, 27)) +>destroyAll : Symbol(KnockoutObservableArray.destroyAll, Decl(genericClassPropertyInheritanceSpecialization.ts, 25, 27)) >items : Symbol(items, Decl(genericClassPropertyInheritanceSpecialization.ts, 26, 15)) >T : Symbol(T, Decl(genericClassPropertyInheritanceSpecialization.ts, 12, 34)) } @@ -125,7 +125,7 @@ interface KnockoutObservableArrayStatic { >KnockoutObservableArrayStatic : Symbol(KnockoutObservableArrayStatic, Decl(genericClassPropertyInheritanceSpecialization.ts, 27, 1)) fn: KnockoutObservableArray; ->fn : Symbol(fn, Decl(genericClassPropertyInheritanceSpecialization.ts, 29, 41)) +>fn : Symbol(KnockoutObservableArrayStatic.fn, Decl(genericClassPropertyInheritanceSpecialization.ts, 29, 41)) >KnockoutObservableArray : Symbol(KnockoutObservableArray, Decl(genericClassPropertyInheritanceSpecialization.ts, 10, 1)) (value?: T[]): KnockoutObservableArray; @@ -154,18 +154,18 @@ module Portal.Controls.Validators { >TValue : Symbol(TValue, Decl(genericClassPropertyInheritanceSpecialization.ts, 41, 27)) private _subscription; ->_subscription : Symbol(_subscription, Decl(genericClassPropertyInheritanceSpecialization.ts, 41, 36)) +>_subscription : Symbol(Validator._subscription, Decl(genericClassPropertyInheritanceSpecialization.ts, 41, 36)) public message: KnockoutObservable; ->message : Symbol(message, Decl(genericClassPropertyInheritanceSpecialization.ts, 42, 30)) +>message : Symbol(Validator.message, Decl(genericClassPropertyInheritanceSpecialization.ts, 42, 30)) >KnockoutObservable : Symbol(KnockoutObservable, Decl(genericClassPropertyInheritanceSpecialization.ts, 4, 1)) public validationState: KnockoutObservable; ->validationState : Symbol(validationState, Decl(genericClassPropertyInheritanceSpecialization.ts, 43, 51)) +>validationState : Symbol(Validator.validationState, Decl(genericClassPropertyInheritanceSpecialization.ts, 43, 51)) >KnockoutObservable : Symbol(KnockoutObservable, Decl(genericClassPropertyInheritanceSpecialization.ts, 4, 1)) public validate: KnockoutObservable; ->validate : Symbol(validate, Decl(genericClassPropertyInheritanceSpecialization.ts, 44, 59)) +>validate : Symbol(Validator.validate, Decl(genericClassPropertyInheritanceSpecialization.ts, 44, 59)) >KnockoutObservable : Symbol(KnockoutObservable, Decl(genericClassPropertyInheritanceSpecialization.ts, 4, 1)) >TValue : Symbol(TValue, Decl(genericClassPropertyInheritanceSpecialization.ts, 41, 27)) @@ -173,10 +173,10 @@ module Portal.Controls.Validators { >message : Symbol(message, Decl(genericClassPropertyInheritanceSpecialization.ts, 46, 20)) public destroy(): void { } ->destroy : Symbol(destroy, Decl(genericClassPropertyInheritanceSpecialization.ts, 46, 41)) +>destroy : Symbol(Validator.destroy, Decl(genericClassPropertyInheritanceSpecialization.ts, 46, 41)) public _validate(value: TValue): number {return 0 } ->_validate : Symbol(_validate, Decl(genericClassPropertyInheritanceSpecialization.ts, 47, 34)) +>_validate : Symbol(Validator._validate, Decl(genericClassPropertyInheritanceSpecialization.ts, 47, 34)) >value : Symbol(value, Decl(genericClassPropertyInheritanceSpecialization.ts, 48, 25)) >TValue : Symbol(TValue, Decl(genericClassPropertyInheritanceSpecialization.ts, 41, 27)) } @@ -216,7 +216,7 @@ interface Contract { >TValue : Symbol(TValue, Decl(genericClassPropertyInheritanceSpecialization.ts, 63, 19)) validators: KnockoutObservableArray>; ->validators : Symbol(validators, Decl(genericClassPropertyInheritanceSpecialization.ts, 63, 28)) +>validators : Symbol(Contract.validators, Decl(genericClassPropertyInheritanceSpecialization.ts, 63, 28)) >KnockoutObservableArray : Symbol(KnockoutObservableArray, Decl(genericClassPropertyInheritanceSpecialization.ts, 10, 1)) >PortalFx : Symbol(PortalFx, Decl(genericClassPropertyInheritanceSpecialization.ts, 50, 1)) >ViewModels : Symbol(PortalFx.ViewModels, Decl(genericClassPropertyInheritanceSpecialization.ts, 52, 16)) @@ -234,7 +234,7 @@ class ViewModel implements Contract { >TValue : Symbol(TValue, Decl(genericClassPropertyInheritanceSpecialization.ts, 69, 16)) public validators: KnockoutObservableArray> = ko.observableArray>(); ->validators : Symbol(validators, Decl(genericClassPropertyInheritanceSpecialization.ts, 69, 53)) +>validators : Symbol(ViewModel.validators, Decl(genericClassPropertyInheritanceSpecialization.ts, 69, 53)) >KnockoutObservableArray : Symbol(KnockoutObservableArray, Decl(genericClassPropertyInheritanceSpecialization.ts, 10, 1)) >PortalFx : Symbol(PortalFx, Decl(genericClassPropertyInheritanceSpecialization.ts, 50, 1)) >ViewModels : Symbol(PortalFx.ViewModels, Decl(genericClassPropertyInheritanceSpecialization.ts, 52, 16)) diff --git a/tests/baselines/reference/genericClassWithObjectTypeArgsAndConstraints.symbols b/tests/baselines/reference/genericClassWithObjectTypeArgsAndConstraints.symbols index a178f5b97e8..c7d369987c9 100644 --- a/tests/baselines/reference/genericClassWithObjectTypeArgsAndConstraints.symbols +++ b/tests/baselines/reference/genericClassWithObjectTypeArgsAndConstraints.symbols @@ -6,17 +6,17 @@ class C { >C : Symbol(C, Decl(genericClassWithObjectTypeArgsAndConstraints.ts, 0, 0)) x: string; ->x : Symbol(x, Decl(genericClassWithObjectTypeArgsAndConstraints.ts, 3, 9)) +>x : Symbol(C.x, Decl(genericClassWithObjectTypeArgsAndConstraints.ts, 3, 9)) } class D { >D : Symbol(D, Decl(genericClassWithObjectTypeArgsAndConstraints.ts, 5, 1)) x: string; ->x : Symbol(x, Decl(genericClassWithObjectTypeArgsAndConstraints.ts, 7, 9)) +>x : Symbol(D.x, Decl(genericClassWithObjectTypeArgsAndConstraints.ts, 7, 9)) y: string; ->y : Symbol(y, Decl(genericClassWithObjectTypeArgsAndConstraints.ts, 8, 14)) +>y : Symbol(D.y, Decl(genericClassWithObjectTypeArgsAndConstraints.ts, 8, 14)) } class X { @@ -24,7 +24,7 @@ class X { >T : Symbol(T, Decl(genericClassWithObjectTypeArgsAndConstraints.ts, 12, 8)) x: T; ->x : Symbol(x, Decl(genericClassWithObjectTypeArgsAndConstraints.ts, 12, 12)) +>x : Symbol(X.x, Decl(genericClassWithObjectTypeArgsAndConstraints.ts, 12, 12)) >T : Symbol(T, Decl(genericClassWithObjectTypeArgsAndConstraints.ts, 12, 8)) } @@ -37,7 +37,7 @@ module Class { >x : Symbol(x, Decl(genericClassWithObjectTypeArgsAndConstraints.ts, 17, 23)) foo(t: X, t2: X) { ->foo : Symbol(foo, Decl(genericClassWithObjectTypeArgsAndConstraints.ts, 17, 38)) +>foo : Symbol(G.foo, Decl(genericClassWithObjectTypeArgsAndConstraints.ts, 17, 38)) >T : Symbol(T, Decl(genericClassWithObjectTypeArgsAndConstraints.ts, 18, 12)) >x : Symbol(x, Decl(genericClassWithObjectTypeArgsAndConstraints.ts, 18, 23)) >t : Symbol(t, Decl(genericClassWithObjectTypeArgsAndConstraints.ts, 18, 37)) @@ -94,7 +94,7 @@ module Class { >C : Symbol(C, Decl(genericClassWithObjectTypeArgsAndConstraints.ts, 0, 0)) foo2(t: X, t2: X) { ->foo2 : Symbol(foo2, Decl(genericClassWithObjectTypeArgsAndConstraints.ts, 30, 27)) +>foo2 : Symbol(G2.foo2, Decl(genericClassWithObjectTypeArgsAndConstraints.ts, 30, 27)) >T : Symbol(T, Decl(genericClassWithObjectTypeArgsAndConstraints.ts, 31, 13)) >C : Symbol(C, Decl(genericClassWithObjectTypeArgsAndConstraints.ts, 0, 0)) >t : Symbol(t, Decl(genericClassWithObjectTypeArgsAndConstraints.ts, 31, 26)) @@ -143,7 +143,7 @@ module Interface { >x : Symbol(x, Decl(genericClassWithObjectTypeArgsAndConstraints.ts, 42, 27)) foo(t: X, t2: X): T; ->foo : Symbol(foo, Decl(genericClassWithObjectTypeArgsAndConstraints.ts, 42, 42)) +>foo : Symbol(G.foo, Decl(genericClassWithObjectTypeArgsAndConstraints.ts, 42, 42)) >T : Symbol(T, Decl(genericClassWithObjectTypeArgsAndConstraints.ts, 43, 12)) >x : Symbol(x, Decl(genericClassWithObjectTypeArgsAndConstraints.ts, 43, 23)) >t : Symbol(t, Decl(genericClassWithObjectTypeArgsAndConstraints.ts, 43, 37)) @@ -193,7 +193,7 @@ module Interface { >C : Symbol(C, Decl(genericClassWithObjectTypeArgsAndConstraints.ts, 0, 0)) foo2(t: X, t2: X): T; ->foo2 : Symbol(foo2, Decl(genericClassWithObjectTypeArgsAndConstraints.ts, 52, 31)) +>foo2 : Symbol(G2.foo2, Decl(genericClassWithObjectTypeArgsAndConstraints.ts, 52, 31)) >T : Symbol(T, Decl(genericClassWithObjectTypeArgsAndConstraints.ts, 53, 13)) >C : Symbol(C, Decl(genericClassWithObjectTypeArgsAndConstraints.ts, 0, 0)) >t : Symbol(t, Decl(genericClassWithObjectTypeArgsAndConstraints.ts, 53, 26)) diff --git a/tests/baselines/reference/genericClassWithStaticFactory.symbols b/tests/baselines/reference/genericClassWithStaticFactory.symbols index 47b7f5f736b..eb4c58ab3cc 100644 --- a/tests/baselines/reference/genericClassWithStaticFactory.symbols +++ b/tests/baselines/reference/genericClassWithStaticFactory.symbols @@ -7,36 +7,36 @@ module Editor { >T : Symbol(T, Decl(genericClassWithStaticFactory.ts, 2, 22)) public next: List; ->next : Symbol(next, Decl(genericClassWithStaticFactory.ts, 2, 26)) +>next : Symbol(List.next, Decl(genericClassWithStaticFactory.ts, 2, 26)) >List : Symbol(List, Decl(genericClassWithStaticFactory.ts, 0, 15)) >T : Symbol(T, Decl(genericClassWithStaticFactory.ts, 2, 22)) public prev: List; ->prev : Symbol(prev, Decl(genericClassWithStaticFactory.ts, 3, 29)) +>prev : Symbol(List.prev, Decl(genericClassWithStaticFactory.ts, 3, 29)) >List : Symbol(List, Decl(genericClassWithStaticFactory.ts, 0, 15)) >T : Symbol(T, Decl(genericClassWithStaticFactory.ts, 2, 22)) private listFactory: ListFactory; ->listFactory : Symbol(listFactory, Decl(genericClassWithStaticFactory.ts, 4, 29)) +>listFactory : Symbol(List.listFactory, Decl(genericClassWithStaticFactory.ts, 4, 29)) >ListFactory : Symbol(ListFactory, Decl(genericClassWithStaticFactory.ts, 106, 5)) >T : Symbol(T, Decl(genericClassWithStaticFactory.ts, 2, 22)) constructor(public isHead: boolean, public data: T) { ->isHead : Symbol(isHead, Decl(genericClassWithStaticFactory.ts, 7, 20)) ->data : Symbol(data, Decl(genericClassWithStaticFactory.ts, 7, 43)) +>isHead : Symbol(List.isHead, Decl(genericClassWithStaticFactory.ts, 7, 20)) +>data : Symbol(List.data, Decl(genericClassWithStaticFactory.ts, 7, 43)) >T : Symbol(T, Decl(genericClassWithStaticFactory.ts, 2, 22)) this.listFactory = new ListFactory(); ->this.listFactory : Symbol(listFactory, Decl(genericClassWithStaticFactory.ts, 4, 29)) +>this.listFactory : Symbol(List.listFactory, Decl(genericClassWithStaticFactory.ts, 4, 29)) >this : Symbol(List, Decl(genericClassWithStaticFactory.ts, 0, 15)) ->listFactory : Symbol(listFactory, Decl(genericClassWithStaticFactory.ts, 4, 29)) +>listFactory : Symbol(List.listFactory, Decl(genericClassWithStaticFactory.ts, 4, 29)) >ListFactory : Symbol(ListFactory, Decl(genericClassWithStaticFactory.ts, 106, 5)) >T : Symbol(T, Decl(genericClassWithStaticFactory.ts, 2, 22)) } public add(data: T): List { ->add : Symbol(add, Decl(genericClassWithStaticFactory.ts, 10, 9)) +>add : Symbol(List.add, Decl(genericClassWithStaticFactory.ts, 10, 9)) >data : Symbol(data, Decl(genericClassWithStaticFactory.ts, 12, 19)) >T : Symbol(T, Decl(genericClassWithStaticFactory.ts, 2, 22)) >List : Symbol(List, Decl(genericClassWithStaticFactory.ts, 0, 15)) @@ -45,17 +45,17 @@ module Editor { var entry = this.listFactory.MakeEntry(data); >entry : Symbol(entry, Decl(genericClassWithStaticFactory.ts, 13, 15)) >this.listFactory.MakeEntry : Symbol(ListFactory.MakeEntry, Decl(genericClassWithStaticFactory.ts, 115, 9)) ->this.listFactory : Symbol(listFactory, Decl(genericClassWithStaticFactory.ts, 4, 29)) +>this.listFactory : Symbol(List.listFactory, Decl(genericClassWithStaticFactory.ts, 4, 29)) >this : Symbol(List, Decl(genericClassWithStaticFactory.ts, 0, 15)) ->listFactory : Symbol(listFactory, Decl(genericClassWithStaticFactory.ts, 4, 29)) +>listFactory : Symbol(List.listFactory, Decl(genericClassWithStaticFactory.ts, 4, 29)) >MakeEntry : Symbol(ListFactory.MakeEntry, Decl(genericClassWithStaticFactory.ts, 115, 9)) >data : Symbol(data, Decl(genericClassWithStaticFactory.ts, 12, 19)) this.prev.next = entry; >this.prev.next : Symbol(List.next, Decl(genericClassWithStaticFactory.ts, 2, 26)) ->this.prev : Symbol(prev, Decl(genericClassWithStaticFactory.ts, 3, 29)) +>this.prev : Symbol(List.prev, Decl(genericClassWithStaticFactory.ts, 3, 29)) >this : Symbol(List, Decl(genericClassWithStaticFactory.ts, 0, 15)) ->prev : Symbol(prev, Decl(genericClassWithStaticFactory.ts, 3, 29)) +>prev : Symbol(List.prev, Decl(genericClassWithStaticFactory.ts, 3, 29)) >next : Symbol(List.next, Decl(genericClassWithStaticFactory.ts, 2, 26)) >entry : Symbol(entry, Decl(genericClassWithStaticFactory.ts, 13, 15)) @@ -69,14 +69,14 @@ module Editor { >entry.prev : Symbol(List.prev, Decl(genericClassWithStaticFactory.ts, 3, 29)) >entry : Symbol(entry, Decl(genericClassWithStaticFactory.ts, 13, 15)) >prev : Symbol(List.prev, Decl(genericClassWithStaticFactory.ts, 3, 29)) ->this.prev : Symbol(prev, Decl(genericClassWithStaticFactory.ts, 3, 29)) +>this.prev : Symbol(List.prev, Decl(genericClassWithStaticFactory.ts, 3, 29)) >this : Symbol(List, Decl(genericClassWithStaticFactory.ts, 0, 15)) ->prev : Symbol(prev, Decl(genericClassWithStaticFactory.ts, 3, 29)) +>prev : Symbol(List.prev, Decl(genericClassWithStaticFactory.ts, 3, 29)) this.prev = entry; ->this.prev : Symbol(prev, Decl(genericClassWithStaticFactory.ts, 3, 29)) +>this.prev : Symbol(List.prev, Decl(genericClassWithStaticFactory.ts, 3, 29)) >this : Symbol(List, Decl(genericClassWithStaticFactory.ts, 0, 15)) ->prev : Symbol(prev, Decl(genericClassWithStaticFactory.ts, 3, 29)) +>prev : Symbol(List.prev, Decl(genericClassWithStaticFactory.ts, 3, 29)) >entry : Symbol(entry, Decl(genericClassWithStaticFactory.ts, 13, 15)) return entry; @@ -84,7 +84,7 @@ module Editor { } public count(): number { ->count : Symbol(count, Decl(genericClassWithStaticFactory.ts, 20, 9)) +>count : Symbol(List.count, Decl(genericClassWithStaticFactory.ts, 20, 9)) var entry: List; >entry : Symbol(entry, Decl(genericClassWithStaticFactory.ts, 23, 15)) @@ -96,9 +96,9 @@ module Editor { entry = this.next; >entry : Symbol(entry, Decl(genericClassWithStaticFactory.ts, 23, 15)) ->this.next : Symbol(next, Decl(genericClassWithStaticFactory.ts, 2, 26)) +>this.next : Symbol(List.next, Decl(genericClassWithStaticFactory.ts, 2, 26)) >this : Symbol(List, Decl(genericClassWithStaticFactory.ts, 0, 15)) ->next : Symbol(next, Decl(genericClassWithStaticFactory.ts, 2, 26)) +>next : Symbol(List.next, Decl(genericClassWithStaticFactory.ts, 2, 26)) for (i = 0; !(entry.isHead); i++) { >i : Symbol(i, Decl(genericClassWithStaticFactory.ts, 24, 15)) @@ -119,29 +119,29 @@ module Editor { } public isEmpty(): boolean { ->isEmpty : Symbol(isEmpty, Decl(genericClassWithStaticFactory.ts, 32, 9)) +>isEmpty : Symbol(List.isEmpty, Decl(genericClassWithStaticFactory.ts, 32, 9)) return (this.next == this); ->this.next : Symbol(next, Decl(genericClassWithStaticFactory.ts, 2, 26)) +>this.next : Symbol(List.next, Decl(genericClassWithStaticFactory.ts, 2, 26)) >this : Symbol(List, Decl(genericClassWithStaticFactory.ts, 0, 15)) ->next : Symbol(next, Decl(genericClassWithStaticFactory.ts, 2, 26)) +>next : Symbol(List.next, Decl(genericClassWithStaticFactory.ts, 2, 26)) >this : Symbol(List, Decl(genericClassWithStaticFactory.ts, 0, 15)) } public first(): T { ->first : Symbol(first, Decl(genericClassWithStaticFactory.ts, 36, 9)) +>first : Symbol(List.first, Decl(genericClassWithStaticFactory.ts, 36, 9)) >T : Symbol(T, Decl(genericClassWithStaticFactory.ts, 2, 22)) if (this.isEmpty()) ->this.isEmpty : Symbol(isEmpty, Decl(genericClassWithStaticFactory.ts, 32, 9)) +>this.isEmpty : Symbol(List.isEmpty, Decl(genericClassWithStaticFactory.ts, 32, 9)) >this : Symbol(List, Decl(genericClassWithStaticFactory.ts, 0, 15)) ->isEmpty : Symbol(isEmpty, Decl(genericClassWithStaticFactory.ts, 32, 9)) +>isEmpty : Symbol(List.isEmpty, Decl(genericClassWithStaticFactory.ts, 32, 9)) { return this.next.data; >this.next.data : Symbol(List.data, Decl(genericClassWithStaticFactory.ts, 7, 43)) ->this.next : Symbol(next, Decl(genericClassWithStaticFactory.ts, 2, 26)) +>this.next : Symbol(List.next, Decl(genericClassWithStaticFactory.ts, 2, 26)) >this : Symbol(List, Decl(genericClassWithStaticFactory.ts, 0, 15)) ->next : Symbol(next, Decl(genericClassWithStaticFactory.ts, 2, 26)) +>next : Symbol(List.next, Decl(genericClassWithStaticFactory.ts, 2, 26)) >data : Symbol(List.data, Decl(genericClassWithStaticFactory.ts, 7, 43)) } else { @@ -150,7 +150,7 @@ module Editor { } public pushEntry(entry: List): void { ->pushEntry : Symbol(pushEntry, Decl(genericClassWithStaticFactory.ts, 46, 9)) +>pushEntry : Symbol(List.pushEntry, Decl(genericClassWithStaticFactory.ts, 46, 9)) >entry : Symbol(entry, Decl(genericClassWithStaticFactory.ts, 48, 25)) >List : Symbol(List, Decl(genericClassWithStaticFactory.ts, 0, 15)) >T : Symbol(T, Decl(genericClassWithStaticFactory.ts, 2, 22)) @@ -164,9 +164,9 @@ module Editor { >entry.next : Symbol(List.next, Decl(genericClassWithStaticFactory.ts, 2, 26)) >entry : Symbol(entry, Decl(genericClassWithStaticFactory.ts, 48, 25)) >next : Symbol(List.next, Decl(genericClassWithStaticFactory.ts, 2, 26)) ->this.next : Symbol(next, Decl(genericClassWithStaticFactory.ts, 2, 26)) +>this.next : Symbol(List.next, Decl(genericClassWithStaticFactory.ts, 2, 26)) >this : Symbol(List, Decl(genericClassWithStaticFactory.ts, 0, 15)) ->next : Symbol(next, Decl(genericClassWithStaticFactory.ts, 2, 26)) +>next : Symbol(List.next, Decl(genericClassWithStaticFactory.ts, 2, 26)) entry.prev = this; >entry.prev : Symbol(List.prev, Decl(genericClassWithStaticFactory.ts, 3, 29)) @@ -175,9 +175,9 @@ module Editor { >this : Symbol(List, Decl(genericClassWithStaticFactory.ts, 0, 15)) this.next = entry; ->this.next : Symbol(next, Decl(genericClassWithStaticFactory.ts, 2, 26)) +>this.next : Symbol(List.next, Decl(genericClassWithStaticFactory.ts, 2, 26)) >this : Symbol(List, Decl(genericClassWithStaticFactory.ts, 0, 15)) ->next : Symbol(next, Decl(genericClassWithStaticFactory.ts, 2, 26)) +>next : Symbol(List.next, Decl(genericClassWithStaticFactory.ts, 2, 26)) >entry : Symbol(entry, Decl(genericClassWithStaticFactory.ts, 48, 25)) entry.next.prev = entry; // entry.next.prev does not show intellisense, but entry.prev.prev does @@ -190,16 +190,16 @@ module Editor { } public push(data: T): void { ->push : Symbol(push, Decl(genericClassWithStaticFactory.ts, 54, 9)) +>push : Symbol(List.push, Decl(genericClassWithStaticFactory.ts, 54, 9)) >data : Symbol(data, Decl(genericClassWithStaticFactory.ts, 56, 20)) >T : Symbol(T, Decl(genericClassWithStaticFactory.ts, 2, 22)) var entry = this.listFactory.MakeEntry(data); >entry : Symbol(entry, Decl(genericClassWithStaticFactory.ts, 57, 15)) >this.listFactory.MakeEntry : Symbol(ListFactory.MakeEntry, Decl(genericClassWithStaticFactory.ts, 115, 9)) ->this.listFactory : Symbol(listFactory, Decl(genericClassWithStaticFactory.ts, 4, 29)) +>this.listFactory : Symbol(List.listFactory, Decl(genericClassWithStaticFactory.ts, 4, 29)) >this : Symbol(List, Decl(genericClassWithStaticFactory.ts, 0, 15)) ->listFactory : Symbol(listFactory, Decl(genericClassWithStaticFactory.ts, 4, 29)) +>listFactory : Symbol(List.listFactory, Decl(genericClassWithStaticFactory.ts, 4, 29)) >MakeEntry : Symbol(ListFactory.MakeEntry, Decl(genericClassWithStaticFactory.ts, 115, 9)) >data : Symbol(data, Decl(genericClassWithStaticFactory.ts, 56, 20)) @@ -218,9 +218,9 @@ module Editor { >entry.next : Symbol(List.next, Decl(genericClassWithStaticFactory.ts, 2, 26)) >entry : Symbol(entry, Decl(genericClassWithStaticFactory.ts, 57, 15)) >next : Symbol(List.next, Decl(genericClassWithStaticFactory.ts, 2, 26)) ->this.next : Symbol(next, Decl(genericClassWithStaticFactory.ts, 2, 26)) +>this.next : Symbol(List.next, Decl(genericClassWithStaticFactory.ts, 2, 26)) >this : Symbol(List, Decl(genericClassWithStaticFactory.ts, 0, 15)) ->next : Symbol(next, Decl(genericClassWithStaticFactory.ts, 2, 26)) +>next : Symbol(List.next, Decl(genericClassWithStaticFactory.ts, 2, 26)) entry.prev = this; >entry.prev : Symbol(List.prev, Decl(genericClassWithStaticFactory.ts, 3, 29)) @@ -229,9 +229,9 @@ module Editor { >this : Symbol(List, Decl(genericClassWithStaticFactory.ts, 0, 15)) this.next = entry; ->this.next : Symbol(next, Decl(genericClassWithStaticFactory.ts, 2, 26)) +>this.next : Symbol(List.next, Decl(genericClassWithStaticFactory.ts, 2, 26)) >this : Symbol(List, Decl(genericClassWithStaticFactory.ts, 0, 15)) ->next : Symbol(next, Decl(genericClassWithStaticFactory.ts, 2, 26)) +>next : Symbol(List.next, Decl(genericClassWithStaticFactory.ts, 2, 26)) >entry : Symbol(entry, Decl(genericClassWithStaticFactory.ts, 57, 15)) entry.next.prev = entry; // entry.next.prev does not show intellisense, but entry.prev.prev does @@ -244,7 +244,7 @@ module Editor { } public popEntry(head: List): List { ->popEntry : Symbol(popEntry, Decl(genericClassWithStaticFactory.ts, 64, 9)) +>popEntry : Symbol(List.popEntry, Decl(genericClassWithStaticFactory.ts, 64, 9)) >head : Symbol(head, Decl(genericClassWithStaticFactory.ts, 66, 24)) >List : Symbol(List, Decl(genericClassWithStaticFactory.ts, 0, 15)) >T : Symbol(T, Decl(genericClassWithStaticFactory.ts, 2, 22)) @@ -253,9 +253,9 @@ module Editor { if (this.next.isHead) { >this.next.isHead : Symbol(List.isHead, Decl(genericClassWithStaticFactory.ts, 7, 20)) ->this.next : Symbol(next, Decl(genericClassWithStaticFactory.ts, 2, 26)) +>this.next : Symbol(List.next, Decl(genericClassWithStaticFactory.ts, 2, 26)) >this : Symbol(List, Decl(genericClassWithStaticFactory.ts, 0, 15)) ->next : Symbol(next, Decl(genericClassWithStaticFactory.ts, 2, 26)) +>next : Symbol(List.next, Decl(genericClassWithStaticFactory.ts, 2, 26)) >isHead : Symbol(List.isHead, Decl(genericClassWithStaticFactory.ts, 7, 20)) return null; @@ -263,18 +263,18 @@ module Editor { else { return this.listFactory.RemoveEntry(this.next); >this.listFactory.RemoveEntry : Symbol(ListFactory.RemoveEntry, Decl(genericClassWithStaticFactory.ts, 122, 9)) ->this.listFactory : Symbol(listFactory, Decl(genericClassWithStaticFactory.ts, 4, 29)) +>this.listFactory : Symbol(List.listFactory, Decl(genericClassWithStaticFactory.ts, 4, 29)) >this : Symbol(List, Decl(genericClassWithStaticFactory.ts, 0, 15)) ->listFactory : Symbol(listFactory, Decl(genericClassWithStaticFactory.ts, 4, 29)) +>listFactory : Symbol(List.listFactory, Decl(genericClassWithStaticFactory.ts, 4, 29)) >RemoveEntry : Symbol(ListFactory.RemoveEntry, Decl(genericClassWithStaticFactory.ts, 122, 9)) ->this.next : Symbol(next, Decl(genericClassWithStaticFactory.ts, 2, 26)) +>this.next : Symbol(List.next, Decl(genericClassWithStaticFactory.ts, 2, 26)) >this : Symbol(List, Decl(genericClassWithStaticFactory.ts, 0, 15)) ->next : Symbol(next, Decl(genericClassWithStaticFactory.ts, 2, 26)) +>next : Symbol(List.next, Decl(genericClassWithStaticFactory.ts, 2, 26)) } } public insertEntry(entry: List): List { ->insertEntry : Symbol(insertEntry, Decl(genericClassWithStaticFactory.ts, 73, 9)) +>insertEntry : Symbol(List.insertEntry, Decl(genericClassWithStaticFactory.ts, 73, 9)) >entry : Symbol(entry, Decl(genericClassWithStaticFactory.ts, 75, 27)) >List : Symbol(List, Decl(genericClassWithStaticFactory.ts, 0, 15)) >T : Symbol(T, Decl(genericClassWithStaticFactory.ts, 2, 22)) @@ -288,9 +288,9 @@ module Editor { this.prev.next = entry; >this.prev.next : Symbol(List.next, Decl(genericClassWithStaticFactory.ts, 2, 26)) ->this.prev : Symbol(prev, Decl(genericClassWithStaticFactory.ts, 3, 29)) +>this.prev : Symbol(List.prev, Decl(genericClassWithStaticFactory.ts, 3, 29)) >this : Symbol(List, Decl(genericClassWithStaticFactory.ts, 0, 15)) ->prev : Symbol(prev, Decl(genericClassWithStaticFactory.ts, 3, 29)) +>prev : Symbol(List.prev, Decl(genericClassWithStaticFactory.ts, 3, 29)) >next : Symbol(List.next, Decl(genericClassWithStaticFactory.ts, 2, 26)) >entry : Symbol(entry, Decl(genericClassWithStaticFactory.ts, 75, 27)) @@ -304,14 +304,14 @@ module Editor { >entry.prev : Symbol(List.prev, Decl(genericClassWithStaticFactory.ts, 3, 29)) >entry : Symbol(entry, Decl(genericClassWithStaticFactory.ts, 75, 27)) >prev : Symbol(List.prev, Decl(genericClassWithStaticFactory.ts, 3, 29)) ->this.prev : Symbol(prev, Decl(genericClassWithStaticFactory.ts, 3, 29)) +>this.prev : Symbol(List.prev, Decl(genericClassWithStaticFactory.ts, 3, 29)) >this : Symbol(List, Decl(genericClassWithStaticFactory.ts, 0, 15)) ->prev : Symbol(prev, Decl(genericClassWithStaticFactory.ts, 3, 29)) +>prev : Symbol(List.prev, Decl(genericClassWithStaticFactory.ts, 3, 29)) this.prev = entry; ->this.prev : Symbol(prev, Decl(genericClassWithStaticFactory.ts, 3, 29)) +>this.prev : Symbol(List.prev, Decl(genericClassWithStaticFactory.ts, 3, 29)) >this : Symbol(List, Decl(genericClassWithStaticFactory.ts, 0, 15)) ->prev : Symbol(prev, Decl(genericClassWithStaticFactory.ts, 3, 29)) +>prev : Symbol(List.prev, Decl(genericClassWithStaticFactory.ts, 3, 29)) >entry : Symbol(entry, Decl(genericClassWithStaticFactory.ts, 75, 27)) return entry; @@ -319,7 +319,7 @@ module Editor { } public insertAfter(data: T): List { ->insertAfter : Symbol(insertAfter, Decl(genericClassWithStaticFactory.ts, 82, 9)) +>insertAfter : Symbol(List.insertAfter, Decl(genericClassWithStaticFactory.ts, 82, 9)) >data : Symbol(data, Decl(genericClassWithStaticFactory.ts, 84, 27)) >T : Symbol(T, Decl(genericClassWithStaticFactory.ts, 2, 22)) >List : Symbol(List, Decl(genericClassWithStaticFactory.ts, 0, 15)) @@ -330,9 +330,9 @@ module Editor { >List : Symbol(List, Decl(genericClassWithStaticFactory.ts, 0, 15)) >T : Symbol(T, Decl(genericClassWithStaticFactory.ts, 2, 22)) >this.listFactory.MakeEntry : Symbol(ListFactory.MakeEntry, Decl(genericClassWithStaticFactory.ts, 115, 9)) ->this.listFactory : Symbol(listFactory, Decl(genericClassWithStaticFactory.ts, 4, 29)) +>this.listFactory : Symbol(List.listFactory, Decl(genericClassWithStaticFactory.ts, 4, 29)) >this : Symbol(List, Decl(genericClassWithStaticFactory.ts, 0, 15)) ->listFactory : Symbol(listFactory, Decl(genericClassWithStaticFactory.ts, 4, 29)) +>listFactory : Symbol(List.listFactory, Decl(genericClassWithStaticFactory.ts, 4, 29)) >MakeEntry : Symbol(ListFactory.MakeEntry, Decl(genericClassWithStaticFactory.ts, 115, 9)) >data : Symbol(data, Decl(genericClassWithStaticFactory.ts, 84, 27)) @@ -340,9 +340,9 @@ module Editor { >entry.next : Symbol(List.next, Decl(genericClassWithStaticFactory.ts, 2, 26)) >entry : Symbol(entry, Decl(genericClassWithStaticFactory.ts, 85, 15)) >next : Symbol(List.next, Decl(genericClassWithStaticFactory.ts, 2, 26)) ->this.next : Symbol(next, Decl(genericClassWithStaticFactory.ts, 2, 26)) +>this.next : Symbol(List.next, Decl(genericClassWithStaticFactory.ts, 2, 26)) >this : Symbol(List, Decl(genericClassWithStaticFactory.ts, 0, 15)) ->next : Symbol(next, Decl(genericClassWithStaticFactory.ts, 2, 26)) +>next : Symbol(List.next, Decl(genericClassWithStaticFactory.ts, 2, 26)) entry.prev = this; >entry.prev : Symbol(List.prev, Decl(genericClassWithStaticFactory.ts, 3, 29)) @@ -351,9 +351,9 @@ module Editor { >this : Symbol(List, Decl(genericClassWithStaticFactory.ts, 0, 15)) this.next = entry; ->this.next : Symbol(next, Decl(genericClassWithStaticFactory.ts, 2, 26)) +>this.next : Symbol(List.next, Decl(genericClassWithStaticFactory.ts, 2, 26)) >this : Symbol(List, Decl(genericClassWithStaticFactory.ts, 0, 15)) ->next : Symbol(next, Decl(genericClassWithStaticFactory.ts, 2, 26)) +>next : Symbol(List.next, Decl(genericClassWithStaticFactory.ts, 2, 26)) >entry : Symbol(entry, Decl(genericClassWithStaticFactory.ts, 85, 15)) entry.next.prev = entry;// entry.next.prev does not show intellisense, but entry.prev.prev does @@ -369,7 +369,7 @@ module Editor { } public insertEntryBefore(entry: List): List { ->insertEntryBefore : Symbol(insertEntryBefore, Decl(genericClassWithStaticFactory.ts, 91, 9)) +>insertEntryBefore : Symbol(List.insertEntryBefore, Decl(genericClassWithStaticFactory.ts, 91, 9)) >entry : Symbol(entry, Decl(genericClassWithStaticFactory.ts, 93, 33)) >List : Symbol(List, Decl(genericClassWithStaticFactory.ts, 0, 15)) >T : Symbol(T, Decl(genericClassWithStaticFactory.ts, 2, 22)) @@ -378,9 +378,9 @@ module Editor { this.prev.next = entry; >this.prev.next : Symbol(List.next, Decl(genericClassWithStaticFactory.ts, 2, 26)) ->this.prev : Symbol(prev, Decl(genericClassWithStaticFactory.ts, 3, 29)) +>this.prev : Symbol(List.prev, Decl(genericClassWithStaticFactory.ts, 3, 29)) >this : Symbol(List, Decl(genericClassWithStaticFactory.ts, 0, 15)) ->prev : Symbol(prev, Decl(genericClassWithStaticFactory.ts, 3, 29)) +>prev : Symbol(List.prev, Decl(genericClassWithStaticFactory.ts, 3, 29)) >next : Symbol(List.next, Decl(genericClassWithStaticFactory.ts, 2, 26)) >entry : Symbol(entry, Decl(genericClassWithStaticFactory.ts, 93, 33)) @@ -394,14 +394,14 @@ module Editor { >entry.prev : Symbol(List.prev, Decl(genericClassWithStaticFactory.ts, 3, 29)) >entry : Symbol(entry, Decl(genericClassWithStaticFactory.ts, 93, 33)) >prev : Symbol(List.prev, Decl(genericClassWithStaticFactory.ts, 3, 29)) ->this.prev : Symbol(prev, Decl(genericClassWithStaticFactory.ts, 3, 29)) +>this.prev : Symbol(List.prev, Decl(genericClassWithStaticFactory.ts, 3, 29)) >this : Symbol(List, Decl(genericClassWithStaticFactory.ts, 0, 15)) ->prev : Symbol(prev, Decl(genericClassWithStaticFactory.ts, 3, 29)) +>prev : Symbol(List.prev, Decl(genericClassWithStaticFactory.ts, 3, 29)) this.prev = entry; ->this.prev : Symbol(prev, Decl(genericClassWithStaticFactory.ts, 3, 29)) +>this.prev : Symbol(List.prev, Decl(genericClassWithStaticFactory.ts, 3, 29)) >this : Symbol(List, Decl(genericClassWithStaticFactory.ts, 0, 15)) ->prev : Symbol(prev, Decl(genericClassWithStaticFactory.ts, 3, 29)) +>prev : Symbol(List.prev, Decl(genericClassWithStaticFactory.ts, 3, 29)) >entry : Symbol(entry, Decl(genericClassWithStaticFactory.ts, 93, 33)) return entry; @@ -409,7 +409,7 @@ module Editor { } public insertBefore(data: T): List { ->insertBefore : Symbol(insertBefore, Decl(genericClassWithStaticFactory.ts, 100, 9)) +>insertBefore : Symbol(List.insertBefore, Decl(genericClassWithStaticFactory.ts, 100, 9)) >data : Symbol(data, Decl(genericClassWithStaticFactory.ts, 102, 28)) >T : Symbol(T, Decl(genericClassWithStaticFactory.ts, 2, 22)) >List : Symbol(List, Decl(genericClassWithStaticFactory.ts, 0, 15)) @@ -418,16 +418,16 @@ module Editor { var entry = this.listFactory.MakeEntry(data); >entry : Symbol(entry, Decl(genericClassWithStaticFactory.ts, 103, 15)) >this.listFactory.MakeEntry : Symbol(ListFactory.MakeEntry, Decl(genericClassWithStaticFactory.ts, 115, 9)) ->this.listFactory : Symbol(listFactory, Decl(genericClassWithStaticFactory.ts, 4, 29)) +>this.listFactory : Symbol(List.listFactory, Decl(genericClassWithStaticFactory.ts, 4, 29)) >this : Symbol(List, Decl(genericClassWithStaticFactory.ts, 0, 15)) ->listFactory : Symbol(listFactory, Decl(genericClassWithStaticFactory.ts, 4, 29)) +>listFactory : Symbol(List.listFactory, Decl(genericClassWithStaticFactory.ts, 4, 29)) >MakeEntry : Symbol(ListFactory.MakeEntry, Decl(genericClassWithStaticFactory.ts, 115, 9)) >data : Symbol(data, Decl(genericClassWithStaticFactory.ts, 102, 28)) return this.insertEntryBefore(entry); ->this.insertEntryBefore : Symbol(insertEntryBefore, Decl(genericClassWithStaticFactory.ts, 91, 9)) +>this.insertEntryBefore : Symbol(List.insertEntryBefore, Decl(genericClassWithStaticFactory.ts, 91, 9)) >this : Symbol(List, Decl(genericClassWithStaticFactory.ts, 0, 15)) ->insertEntryBefore : Symbol(insertEntryBefore, Decl(genericClassWithStaticFactory.ts, 91, 9)) +>insertEntryBefore : Symbol(List.insertEntryBefore, Decl(genericClassWithStaticFactory.ts, 91, 9)) >entry : Symbol(entry, Decl(genericClassWithStaticFactory.ts, 103, 15)) } } @@ -437,7 +437,7 @@ module Editor { >T : Symbol(T, Decl(genericClassWithStaticFactory.ts, 108, 29)) public MakeHead(): List { ->MakeHead : Symbol(MakeHead, Decl(genericClassWithStaticFactory.ts, 108, 33)) +>MakeHead : Symbol(ListFactory.MakeHead, Decl(genericClassWithStaticFactory.ts, 108, 33)) >T : Symbol(T, Decl(genericClassWithStaticFactory.ts, 110, 24)) >List : Symbol(List, Decl(genericClassWithStaticFactory.ts, 0, 15)) >T : Symbol(T, Decl(genericClassWithStaticFactory.ts, 110, 24)) @@ -466,7 +466,7 @@ module Editor { } public MakeEntry(data: T): List { ->MakeEntry : Symbol(MakeEntry, Decl(genericClassWithStaticFactory.ts, 115, 9)) +>MakeEntry : Symbol(ListFactory.MakeEntry, Decl(genericClassWithStaticFactory.ts, 115, 9)) >T : Symbol(T, Decl(genericClassWithStaticFactory.ts, 117, 25)) >data : Symbol(data, Decl(genericClassWithStaticFactory.ts, 117, 28)) >T : Symbol(T, Decl(genericClassWithStaticFactory.ts, 117, 25)) @@ -498,7 +498,7 @@ module Editor { } public RemoveEntry(entry: List): List { ->RemoveEntry : Symbol(RemoveEntry, Decl(genericClassWithStaticFactory.ts, 122, 9)) +>RemoveEntry : Symbol(ListFactory.RemoveEntry, Decl(genericClassWithStaticFactory.ts, 122, 9)) >T : Symbol(T, Decl(genericClassWithStaticFactory.ts, 124, 27)) >entry : Symbol(entry, Decl(genericClassWithStaticFactory.ts, 124, 30)) >List : Symbol(List, Decl(genericClassWithStaticFactory.ts, 0, 15)) diff --git a/tests/baselines/reference/genericClasses0.symbols b/tests/baselines/reference/genericClasses0.symbols index 764cd04c962..57fbb65056f 100644 --- a/tests/baselines/reference/genericClasses0.symbols +++ b/tests/baselines/reference/genericClasses0.symbols @@ -4,7 +4,7 @@ class C { >T : Symbol(T, Decl(genericClasses0.ts, 0, 8)) public x: T; ->x : Symbol(x, Decl(genericClasses0.ts, 0, 12)) +>x : Symbol(C.x, Decl(genericClasses0.ts, 0, 12)) >T : Symbol(T, Decl(genericClasses0.ts, 0, 8)) } diff --git a/tests/baselines/reference/genericClasses1.symbols b/tests/baselines/reference/genericClasses1.symbols index d2100b5e3b3..fbbd3110cdf 100644 --- a/tests/baselines/reference/genericClasses1.symbols +++ b/tests/baselines/reference/genericClasses1.symbols @@ -4,7 +4,7 @@ class C { >T : Symbol(T, Decl(genericClasses1.ts, 0, 8)) public x: T; ->x : Symbol(x, Decl(genericClasses1.ts, 0, 12)) +>x : Symbol(C.x, Decl(genericClasses1.ts, 0, 12)) >T : Symbol(T, Decl(genericClasses1.ts, 0, 8)) } diff --git a/tests/baselines/reference/genericClasses2.symbols b/tests/baselines/reference/genericClasses2.symbols index e9af0c44941..a5153a26fc3 100644 --- a/tests/baselines/reference/genericClasses2.symbols +++ b/tests/baselines/reference/genericClasses2.symbols @@ -4,7 +4,7 @@ interface Foo { >T : Symbol(T, Decl(genericClasses2.ts, 0, 14)) a: T; ->a : Symbol(a, Decl(genericClasses2.ts, 0, 18)) +>a : Symbol(Foo.a, Decl(genericClasses2.ts, 0, 18)) >T : Symbol(T, Decl(genericClasses2.ts, 0, 14)) } @@ -13,16 +13,16 @@ class C { >T : Symbol(T, Decl(genericClasses2.ts, 4, 8)) public x: T; ->x : Symbol(x, Decl(genericClasses2.ts, 4, 12)) +>x : Symbol(C.x, Decl(genericClasses2.ts, 4, 12)) >T : Symbol(T, Decl(genericClasses2.ts, 4, 8)) public y: Foo; ->y : Symbol(y, Decl(genericClasses2.ts, 5, 13)) +>y : Symbol(C.y, Decl(genericClasses2.ts, 5, 13)) >Foo : Symbol(Foo, Decl(genericClasses2.ts, 0, 0)) >T : Symbol(T, Decl(genericClasses2.ts, 4, 8)) public z: Foo; ->z : Symbol(z, Decl(genericClasses2.ts, 6, 18)) +>z : Symbol(C.z, Decl(genericClasses2.ts, 6, 18)) >Foo : Symbol(Foo, Decl(genericClasses2.ts, 0, 0)) } diff --git a/tests/baselines/reference/genericClasses3.symbols b/tests/baselines/reference/genericClasses3.symbols index 06b0d8437d5..31b99b4247d 100644 --- a/tests/baselines/reference/genericClasses3.symbols +++ b/tests/baselines/reference/genericClasses3.symbols @@ -4,11 +4,11 @@ class B { >T : Symbol(T, Decl(genericClasses3.ts, 0, 8)) a: T; ->a : Symbol(a, Decl(genericClasses3.ts, 0, 12)) +>a : Symbol(B.a, Decl(genericClasses3.ts, 0, 12)) >T : Symbol(T, Decl(genericClasses3.ts, 0, 8)) b: T; ->b : Symbol(b, Decl(genericClasses3.ts, 1, 9)) +>b : Symbol(B.b, Decl(genericClasses3.ts, 1, 9)) >T : Symbol(T, Decl(genericClasses3.ts, 0, 8)) } @@ -19,7 +19,7 @@ class C extends B { >T : Symbol(T, Decl(genericClasses3.ts, 5, 8)) public x: T; ->x : Symbol(x, Decl(genericClasses3.ts, 5, 25)) +>x : Symbol(C.x, Decl(genericClasses3.ts, 5, 25)) >T : Symbol(T, Decl(genericClasses3.ts, 5, 8)) } diff --git a/tests/baselines/reference/genericClasses4.symbols b/tests/baselines/reference/genericClasses4.symbols index d910cbc152d..651d61528b5 100644 --- a/tests/baselines/reference/genericClasses4.symbols +++ b/tests/baselines/reference/genericClasses4.symbols @@ -5,13 +5,13 @@ class Vec2_T >A : Symbol(A, Decl(genericClasses4.ts, 1, 13)) { constructor(public x: A, public y: A) { } ->x : Symbol(x, Decl(genericClasses4.ts, 3, 16)) +>x : Symbol(Vec2_T.x, Decl(genericClasses4.ts, 3, 16)) >A : Symbol(A, Decl(genericClasses4.ts, 1, 13)) ->y : Symbol(y, Decl(genericClasses4.ts, 3, 28)) +>y : Symbol(Vec2_T.y, Decl(genericClasses4.ts, 3, 28)) >A : Symbol(A, Decl(genericClasses4.ts, 1, 13)) fmap(f: (a: A) => B): Vec2_T { ->fmap : Symbol(fmap, Decl(genericClasses4.ts, 3, 45)) +>fmap : Symbol(Vec2_T.fmap, Decl(genericClasses4.ts, 3, 45)) >B : Symbol(B, Decl(genericClasses4.ts, 4, 9)) >f : Symbol(f, Decl(genericClasses4.ts, 4, 12)) >a : Symbol(a, Decl(genericClasses4.ts, 4, 16)) @@ -24,17 +24,17 @@ class Vec2_T >x : Symbol(x, Decl(genericClasses4.ts, 5, 11)) >B : Symbol(B, Decl(genericClasses4.ts, 4, 9)) >f : Symbol(f, Decl(genericClasses4.ts, 4, 12)) ->this.x : Symbol(x, Decl(genericClasses4.ts, 3, 16)) +>this.x : Symbol(Vec2_T.x, Decl(genericClasses4.ts, 3, 16)) >this : Symbol(Vec2_T, Decl(genericClasses4.ts, 0, 0)) ->x : Symbol(x, Decl(genericClasses4.ts, 3, 16)) +>x : Symbol(Vec2_T.x, Decl(genericClasses4.ts, 3, 16)) var y:B = f(this.y); >y : Symbol(y, Decl(genericClasses4.ts, 6, 11)) >B : Symbol(B, Decl(genericClasses4.ts, 4, 9)) >f : Symbol(f, Decl(genericClasses4.ts, 4, 12)) ->this.y : Symbol(y, Decl(genericClasses4.ts, 3, 28)) +>this.y : Symbol(Vec2_T.y, Decl(genericClasses4.ts, 3, 28)) >this : Symbol(Vec2_T, Decl(genericClasses4.ts, 0, 0)) ->y : Symbol(y, Decl(genericClasses4.ts, 3, 28)) +>y : Symbol(Vec2_T.y, Decl(genericClasses4.ts, 3, 28)) var retval: Vec2_T = new Vec2_T(x, y); >retval : Symbol(retval, Decl(genericClasses4.ts, 7, 11)) @@ -48,7 +48,7 @@ class Vec2_T >retval : Symbol(retval, Decl(genericClasses4.ts, 7, 11)) } apply(f: Vec2_T<(a: A) => B>): Vec2_T { ->apply : Symbol(apply, Decl(genericClasses4.ts, 9, 5)) +>apply : Symbol(Vec2_T.apply, Decl(genericClasses4.ts, 9, 5)) >B : Symbol(B, Decl(genericClasses4.ts, 10, 10)) >f : Symbol(f, Decl(genericClasses4.ts, 10, 13)) >Vec2_T : Symbol(Vec2_T, Decl(genericClasses4.ts, 0, 0)) @@ -64,9 +64,9 @@ class Vec2_T >f.x : Symbol(Vec2_T.x, Decl(genericClasses4.ts, 3, 16)) >f : Symbol(f, Decl(genericClasses4.ts, 10, 13)) >x : Symbol(Vec2_T.x, Decl(genericClasses4.ts, 3, 16)) ->this.x : Symbol(x, Decl(genericClasses4.ts, 3, 16)) +>this.x : Symbol(Vec2_T.x, Decl(genericClasses4.ts, 3, 16)) >this : Symbol(Vec2_T, Decl(genericClasses4.ts, 0, 0)) ->x : Symbol(x, Decl(genericClasses4.ts, 3, 16)) +>x : Symbol(Vec2_T.x, Decl(genericClasses4.ts, 3, 16)) var y:B = f.y(this.y); >y : Symbol(y, Decl(genericClasses4.ts, 12, 11)) @@ -74,9 +74,9 @@ class Vec2_T >f.y : Symbol(Vec2_T.y, Decl(genericClasses4.ts, 3, 28)) >f : Symbol(f, Decl(genericClasses4.ts, 10, 13)) >y : Symbol(Vec2_T.y, Decl(genericClasses4.ts, 3, 28)) ->this.y : Symbol(y, Decl(genericClasses4.ts, 3, 28)) +>this.y : Symbol(Vec2_T.y, Decl(genericClasses4.ts, 3, 28)) >this : Symbol(Vec2_T, Decl(genericClasses4.ts, 0, 0)) ->y : Symbol(y, Decl(genericClasses4.ts, 3, 28)) +>y : Symbol(Vec2_T.y, Decl(genericClasses4.ts, 3, 28)) var retval: Vec2_T = new Vec2_T(x, y); >retval : Symbol(retval, Decl(genericClasses4.ts, 13, 11)) diff --git a/tests/baselines/reference/genericClassesInModule2.symbols b/tests/baselines/reference/genericClassesInModule2.symbols index a767d64de07..764b5b66462 100644 --- a/tests/baselines/reference/genericClassesInModule2.symbols +++ b/tests/baselines/reference/genericClassesInModule2.symbols @@ -4,7 +4,7 @@ export class A{ >T1 : Symbol(T1, Decl(genericClassesInModule2.ts, 0, 15)) constructor( public callback: (self: A) => void) { ->callback : Symbol(callback, Decl(genericClassesInModule2.ts, 1, 16)) +>callback : Symbol(A.callback, Decl(genericClassesInModule2.ts, 1, 16)) >self : Symbol(self, Decl(genericClassesInModule2.ts, 1, 35)) >A : Symbol(A, Decl(genericClassesInModule2.ts, 0, 0)) >T1 : Symbol(T1, Decl(genericClassesInModule2.ts, 0, 15)) @@ -15,7 +15,7 @@ export class A{ >this : Symbol(A, Decl(genericClassesInModule2.ts, 0, 0)) } AAA( callback: (self: A) => void) { ->AAA : Symbol(AAA, Decl(genericClassesInModule2.ts, 3, 5)) +>AAA : Symbol(A.AAA, Decl(genericClassesInModule2.ts, 3, 5)) >callback : Symbol(callback, Decl(genericClassesInModule2.ts, 4, 8)) >self : Symbol(self, Decl(genericClassesInModule2.ts, 4, 20)) >A : Symbol(A, Decl(genericClassesInModule2.ts, 0, 0)) @@ -33,7 +33,7 @@ export interface C{ >T1 : Symbol(T1, Decl(genericClassesInModule2.ts, 9, 19)) child: B; ->child : Symbol(child, Decl(genericClassesInModule2.ts, 9, 23)) +>child : Symbol(C.child, Decl(genericClassesInModule2.ts, 9, 23)) >B : Symbol(B, Decl(genericClassesInModule2.ts, 13, 1)) >T1 : Symbol(T1, Decl(genericClassesInModule2.ts, 9, 19)) @@ -54,7 +54,7 @@ export class B { >T2 : Symbol(T2, Decl(genericClassesInModule2.ts, 15, 15)) constructor(public parent: T2) { } ->parent : Symbol(parent, Decl(genericClassesInModule2.ts, 16, 16)) +>parent : Symbol(B.parent, Decl(genericClassesInModule2.ts, 16, 16)) >T2 : Symbol(T2, Decl(genericClassesInModule2.ts, 15, 15)) } diff --git a/tests/baselines/reference/genericCloduleInModule.symbols b/tests/baselines/reference/genericCloduleInModule.symbols index 0becc7469a1..34b48f1539e 100644 --- a/tests/baselines/reference/genericCloduleInModule.symbols +++ b/tests/baselines/reference/genericCloduleInModule.symbols @@ -7,7 +7,7 @@ module A { >T : Symbol(T, Decl(genericCloduleInModule.ts, 1, 19)) foo() { } ->foo : Symbol(foo, Decl(genericCloduleInModule.ts, 1, 23)) +>foo : Symbol(B.foo, Decl(genericCloduleInModule.ts, 1, 23)) static bar() { } >bar : Symbol(B.bar, Decl(genericCloduleInModule.ts, 2, 17)) diff --git a/tests/baselines/reference/genericCombinators2.errors.txt b/tests/baselines/reference/genericCombinators2.errors.txt index d590f1030c3..5be717109c8 100644 --- a/tests/baselines/reference/genericCombinators2.errors.txt +++ b/tests/baselines/reference/genericCombinators2.errors.txt @@ -1,6 +1,5 @@ tests/cases/compiler/genericCombinators2.ts(15,43): error TS2345: Argument of type '(x: number, y: string) => string' is not assignable to parameter of type '(x: number, y: string) => Date'. Type 'string' is not assignable to type 'Date'. - Property 'toDateString' is missing in type 'String'. tests/cases/compiler/genericCombinators2.ts(16,43): error TS2345: Argument of type '(x: number, y: string) => string' is not assignable to parameter of type '(x: number, y: string) => Date'. Type 'string' is not assignable to type 'Date'. @@ -24,7 +23,6 @@ tests/cases/compiler/genericCombinators2.ts(16,43): error TS2345: Argument of ty ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: number, y: string) => string' is not assignable to parameter of type '(x: number, y: string) => Date'. !!! error TS2345: Type 'string' is not assignable to type 'Date'. -!!! error TS2345: Property 'toDateString' is missing in type 'String'. var r5b = _.map(c2, rf1); ~~~ !!! error TS2345: Argument of type '(x: number, y: string) => string' is not assignable to parameter of type '(x: number, y: string) => Date'. diff --git a/tests/baselines/reference/genericConstraint3.symbols b/tests/baselines/reference/genericConstraint3.symbols index 57cb9d03115..6a22a0996c0 100644 --- a/tests/baselines/reference/genericConstraint3.symbols +++ b/tests/baselines/reference/genericConstraint3.symbols @@ -2,7 +2,7 @@ interface C;; var x =
one
/* intervening comment */
two
;;
{"str";}; @@ -218,9 +226,13 @@ tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(35,21): error TS17002 >; >; ; + ~ +!!! error TS17008: JSX element 'a' has no corresponding closing tag. ~ !!! error TS1005: '{' expected. ; + ~ +!!! error TS17008: JSX element 'a' has no corresponding closing tag. ~ !!! error TS1005: '{' expected. ~ @@ -230,4 +242,4 @@ tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(35,21): error TS17002 ~~~ !!! error TS1003: Identifier expected. -!!! error TS17002: Expected corresponding JSX closing tag for 'a'. \ No newline at end of file +!!! error TS1005: '; + ~~~ +!!! error TS17008: JSX element 'div' has no corresponding closing tag. + ~~~~~~ +!!! error TS17002: Expected corresponding JSX closing tag for 'span'. + + +!!! error TS1005: '; + ~~~~~~~ +!!! error TS17002: Expected corresponding JSX closing tag for 'div'. + + +==== tests/cases/conformance/jsx/Error3.tsx (2 errors) ==== + let x3 =
; + ~~~ +!!! error TS17008: JSX element 'div' has no corresponding closing tag. + + + +!!! error TS1005: '
; + ~~~ +!!! error TS17008: JSX element 'div' has no corresponding closing tag. + ~~~~~~~ +!!! error TS17002: Expected corresponding JSX closing tag for 'div'. + + +!!! error TS1005: ' + ~~~ +!!! error TS17008: JSX element 'div' has no corresponding closing tag. + ~~~~ +!!! error TS17008: JSX element 'span' has no corresponding closing tag. + + + +!!! error TS1005: '
; + +//// [Error2.tsx] +let x2 =
; + + +//// [Error3.tsx] +let x3 =
; + + +//// [Error4.tsx] +let x4 =
; + +//// [Error5.tsx] +let x5 =
+ + + +//// [file.jsx] +//// [Error1.jsx] +// Issue error about missing span closing tag, not missing div closing tag +var x1 =
; +; +//// [Error2.jsx] +var x2 =
; +//// [Error3.jsx] +var x3 =
; + +; +//// [Error4.jsx] +var x4 =
; +; +//// [Error5.jsx] +var x5 =
+ +; diff --git a/tests/baselines/reference/jsxPreserveWithJsInput.js b/tests/baselines/reference/jsxPreserveWithJsInput.js new file mode 100644 index 00000000000..2cc59ffa355 --- /dev/null +++ b/tests/baselines/reference/jsxPreserveWithJsInput.js @@ -0,0 +1,29 @@ +//// [tests/cases/compiler/jsxPreserveWithJsInput.ts] //// + +//// [a.js] + +var elemA = 42; + +//// [b.jsx] +var elemB = {"test"}; + +//// [c.js] +var elemC = {42}; + +//// [d.ts] +var elemD = 42; + +//// [e.tsx] +var elemE = {true}; + + +//// [a.js] +var elemA = 42; +//// [b.jsx] +var elemB = {"test"}; +//// [c.js] +var elemC = {42}; +//// [d.js] +var elemD = 42; +//// [e.jsx] +var elemE = {true}; diff --git a/tests/baselines/reference/jsxPreserveWithJsInput.symbols b/tests/baselines/reference/jsxPreserveWithJsInput.symbols new file mode 100644 index 00000000000..6ad2f614875 --- /dev/null +++ b/tests/baselines/reference/jsxPreserveWithJsInput.symbols @@ -0,0 +1,27 @@ +=== tests/cases/compiler/a.js === + +var elemA = 42; +>elemA : Symbol(elemA, Decl(a.js, 1, 3)) + +=== tests/cases/compiler/b.jsx === +var elemB = {"test"}; +>elemB : Symbol(elemB, Decl(b.jsx, 0, 3)) +>b : Symbol(unknown) +>b : Symbol(unknown) + +=== tests/cases/compiler/c.js === +var elemC = {42}; +>elemC : Symbol(elemC, Decl(c.js, 0, 3)) +>c : Symbol(unknown) +>c : Symbol(unknown) + +=== tests/cases/compiler/d.ts === +var elemD = 42; +>elemD : Symbol(elemD, Decl(d.ts, 0, 3)) + +=== tests/cases/compiler/e.tsx === +var elemE = {true}; +>elemE : Symbol(elemE, Decl(e.tsx, 0, 3)) +>e : Symbol(unknown) +>e : Symbol(unknown) + diff --git a/tests/baselines/reference/jsxPreserveWithJsInput.types b/tests/baselines/reference/jsxPreserveWithJsInput.types new file mode 100644 index 00000000000..7f4ed6daa2b --- /dev/null +++ b/tests/baselines/reference/jsxPreserveWithJsInput.types @@ -0,0 +1,35 @@ +=== tests/cases/compiler/a.js === + +var elemA = 42; +>elemA : number +>42 : number + +=== tests/cases/compiler/b.jsx === +var elemB = {"test"}; +>elemB : any +>{"test"} : any +>b : any +>"test" : string +>b : any + +=== tests/cases/compiler/c.js === +var elemC = {42}; +>elemC : any +>{42} : any +>c : any +>42 : number +>c : any + +=== tests/cases/compiler/d.ts === +var elemD = 42; +>elemD : number +>42 : number + +=== tests/cases/compiler/e.tsx === +var elemE = {true}; +>elemE : any +>{true} : any +>e : any +>true : boolean +>e : any + diff --git a/tests/baselines/reference/jsxReactTestSuite.symbols b/tests/baselines/reference/jsxReactTestSuite.symbols index b86054ac560..956b4cff6f7 100644 --- a/tests/baselines/reference/jsxReactTestSuite.symbols +++ b/tests/baselines/reference/jsxReactTestSuite.symbols @@ -37,21 +37,36 @@ declare var hasOwnProperty:any; >hasOwnProperty : Symbol(hasOwnProperty, Decl(jsxReactTestSuite.tsx, 12, 11))
text
; +>div : Symbol(unknown) +>div : Symbol(unknown)
+>div : Symbol(unknown) + {this.props.children}
; +>div : Symbol(unknown)
+>div : Symbol(unknown) +

+>div : Symbol(unknown) +>br : Symbol(unknown) +>div : Symbol(unknown) + {foo}
{bar}
>Component : Symbol(Component, Decl(jsxReactTestSuite.tsx, 2, 11)) >foo : Symbol(foo, Decl(jsxReactTestSuite.tsx, 7, 11)) +>br : Symbol(unknown) >bar : Symbol(bar, Decl(jsxReactTestSuite.tsx, 8, 11)) >Component : Symbol(Component, Decl(jsxReactTestSuite.tsx, 2, 11))
+>br : Symbol(unknown) +
; +>div : Symbol(unknown) @@ -74,6 +89,8 @@ var x = >x : Symbol(x, Decl(jsxReactTestSuite.tsx, 10, 11), Decl(jsxReactTestSuite.tsx, 35, 3))
div : Symbol(unknown) + attr1={ >attr1 : Symbol(unknown) @@ -97,51 +114,74 @@ var x = >attr4 : Symbol(unknown)
; +>div : Symbol(unknown) (
+>div : Symbol(unknown) + {/* A comment at the beginning */} {/* A second comment at the beginning */} +>span : Symbol(unknown) + {/* A nested comment */} +>span : Symbol(unknown) + {/* A sandwiched comment */}
+>br : Symbol(unknown) + {/* A comment at the end */} {/* A second comment at the end */}
+>div : Symbol(unknown) + ); (
div : Symbol(unknown) + /* a multi-line comment */ attr1="foo"> >attr1 : Symbol(unknown) span : Symbol(unknown) + attr2="bar" >attr2 : Symbol(unknown) />
+>div : Symbol(unknown) + );
 
; +>div : Symbol(unknown) +>div : Symbol(unknown)
 
; +>div : Symbol(unknown) +>div : Symbol(unknown) testing; +>hasOwnProperty : Symbol(unknown) +>hasOwnProperty : Symbol(unknown) ; >Component : Symbol(Component, Decl(jsxReactTestSuite.tsx, 2, 11)) >constructor : Symbol(unknown) ; ->Component : Symbol(unknown) +>Namespace : Symbol(Namespace, Decl(jsxReactTestSuite.tsx, 6, 11)) ; ->Component : Symbol(unknown) +>Namespace : Symbol(Namespace, Decl(jsxReactTestSuite.tsx, 6, 11)) Component : Symbol(Component, Decl(jsxReactTestSuite.tsx, 2, 11)) @@ -158,6 +198,7 @@ var x = >sound : Symbol(unknown) ; +>font-face : Symbol(unknown) ; >Component : Symbol(Component, Decl(jsxReactTestSuite.tsx, 2, 11)) @@ -165,6 +206,7 @@ var x = >y : Symbol(y, Decl(jsxReactTestSuite.tsx, 9, 11)) ; +>x-component : Symbol(unknown) ; >Component : Symbol(Component, Decl(jsxReactTestSuite.tsx, 2, 11)) diff --git a/tests/baselines/reference/jsxReactTestSuite.types b/tests/baselines/reference/jsxReactTestSuite.types index 88c2c278e59..8bab7ce6e7d 100644 --- a/tests/baselines/reference/jsxReactTestSuite.types +++ b/tests/baselines/reference/jsxReactTestSuite.types @@ -235,11 +235,14 @@ var x = ; > : any +>Namespace.Component : any >Namespace : any >Component : any ; > : any +>Namespace.DeepNamespace.Component : any +>Namespace.DeepNamespace : any >Namespace : any >DeepNamespace : any >Component : any diff --git a/tests/baselines/reference/keepImportsInDts1.js b/tests/baselines/reference/keepImportsInDts1.js new file mode 100644 index 00000000000..8189ce43088 --- /dev/null +++ b/tests/baselines/reference/keepImportsInDts1.js @@ -0,0 +1,16 @@ +//// [tests/cases/compiler/keepImportsInDts1.ts] //// + +//// [test.d.ts] + +export {}; +//// [main.ts] +import "test" + +//// [main.js] +define(["require", "exports", "test"], function (require, exports) { + "use strict"; +}); + + +//// [main.d.ts] +import "test"; diff --git a/tests/baselines/reference/keepImportsInDts1.symbols b/tests/baselines/reference/keepImportsInDts1.symbols new file mode 100644 index 00000000000..92bd84c2088 --- /dev/null +++ b/tests/baselines/reference/keepImportsInDts1.symbols @@ -0,0 +1,6 @@ +=== c:/test.d.ts === + +No type information for this code.export {}; +No type information for this code.=== c:/app/main.ts === +import "test" +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/keepImportsInDts1.types b/tests/baselines/reference/keepImportsInDts1.types new file mode 100644 index 00000000000..92bd84c2088 --- /dev/null +++ b/tests/baselines/reference/keepImportsInDts1.types @@ -0,0 +1,6 @@ +=== c:/test.d.ts === + +No type information for this code.export {}; +No type information for this code.=== c:/app/main.ts === +import "test" +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/keepImportsInDts2.js b/tests/baselines/reference/keepImportsInDts2.js new file mode 100644 index 00000000000..559b4814526 --- /dev/null +++ b/tests/baselines/reference/keepImportsInDts2.js @@ -0,0 +1,22 @@ +//// [tests/cases/compiler/keepImportsInDts2.ts] //// + +//// [test.ts] + +export {}; +//// [main.ts] +import "./folder/test" + +//// [test.js] +define(["require", "exports"], function (require, exports) { + "use strict"; +}); +//// [main.js] +define(["require", "exports", "./folder/test"], function (require, exports) { + "use strict"; +}); + + +//// [test.d.ts] +export { }; +//// [main.d.ts] +import "./folder/test"; diff --git a/tests/baselines/reference/keepImportsInDts2.symbols b/tests/baselines/reference/keepImportsInDts2.symbols new file mode 100644 index 00000000000..ce6f4c7c168 --- /dev/null +++ b/tests/baselines/reference/keepImportsInDts2.symbols @@ -0,0 +1,6 @@ +=== tests/cases/compiler/folder/test.ts === + +No type information for this code.export {}; +No type information for this code.=== tests/cases/compiler/main.ts === +import "./folder/test" +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/keepImportsInDts2.types b/tests/baselines/reference/keepImportsInDts2.types new file mode 100644 index 00000000000..ce6f4c7c168 --- /dev/null +++ b/tests/baselines/reference/keepImportsInDts2.types @@ -0,0 +1,6 @@ +=== tests/cases/compiler/folder/test.ts === + +No type information for this code.export {}; +No type information for this code.=== tests/cases/compiler/main.ts === +import "./folder/test" +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/keepImportsInDts3.js b/tests/baselines/reference/keepImportsInDts3.js new file mode 100644 index 00000000000..e48ba693726 --- /dev/null +++ b/tests/baselines/reference/keepImportsInDts3.js @@ -0,0 +1,24 @@ +//// [tests/cases/compiler/keepImportsInDts3.ts] //// + +//// [test.ts] + +export {}; +//// [main.ts] +import "test" + +//// [outputfile.js] +define("test", ["require", "exports"], function (require, exports) { + "use strict"; +}); +define("app/main", ["require", "exports", "test"], function (require, exports) { + "use strict"; +}); + + +//// [outputfile.d.ts] +declare module "test" { + export { }; +} +declare module "app/main" { + import "test"; +} diff --git a/tests/baselines/reference/keepImportsInDts3.symbols b/tests/baselines/reference/keepImportsInDts3.symbols new file mode 100644 index 00000000000..29c4a4e44b4 --- /dev/null +++ b/tests/baselines/reference/keepImportsInDts3.symbols @@ -0,0 +1,6 @@ +=== c:/test.ts === + +No type information for this code.export {}; +No type information for this code.=== c:/app/main.ts === +import "test" +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/keepImportsInDts3.types b/tests/baselines/reference/keepImportsInDts3.types new file mode 100644 index 00000000000..29c4a4e44b4 --- /dev/null +++ b/tests/baselines/reference/keepImportsInDts3.types @@ -0,0 +1,6 @@ +=== c:/test.ts === + +No type information for this code.export {}; +No type information for this code.=== c:/app/main.ts === +import "test" +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/keepImportsInDts4.js b/tests/baselines/reference/keepImportsInDts4.js new file mode 100644 index 00000000000..badec87984e --- /dev/null +++ b/tests/baselines/reference/keepImportsInDts4.js @@ -0,0 +1,24 @@ +//// [tests/cases/compiler/keepImportsInDts4.ts] //// + +//// [test.ts] + +export {}; +//// [main.ts] +import "./folder/test" + +//// [outputfile.js] +define("folder/test", ["require", "exports"], function (require, exports) { + "use strict"; +}); +define("main", ["require", "exports", "folder/test"], function (require, exports) { + "use strict"; +}); + + +//// [outputfile.d.ts] +declare module "folder/test" { + export { }; +} +declare module "main" { + import "folder/test"; +} diff --git a/tests/baselines/reference/keepImportsInDts4.symbols b/tests/baselines/reference/keepImportsInDts4.symbols new file mode 100644 index 00000000000..ce6f4c7c168 --- /dev/null +++ b/tests/baselines/reference/keepImportsInDts4.symbols @@ -0,0 +1,6 @@ +=== tests/cases/compiler/folder/test.ts === + +No type information for this code.export {}; +No type information for this code.=== tests/cases/compiler/main.ts === +import "./folder/test" +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/keepImportsInDts4.types b/tests/baselines/reference/keepImportsInDts4.types new file mode 100644 index 00000000000..ce6f4c7c168 --- /dev/null +++ b/tests/baselines/reference/keepImportsInDts4.types @@ -0,0 +1,6 @@ +=== tests/cases/compiler/folder/test.ts === + +No type information for this code.export {}; +No type information for this code.=== tests/cases/compiler/main.ts === +import "./folder/test" +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/keywordInJsxIdentifier.symbols b/tests/baselines/reference/keywordInJsxIdentifier.symbols index 874d7801a7f..3cb977bee81 100644 --- a/tests/baselines/reference/keywordInJsxIdentifier.symbols +++ b/tests/baselines/reference/keywordInJsxIdentifier.symbols @@ -4,14 +4,18 @@ declare var React: any; >React : Symbol(React, Decl(keywordInJsxIdentifier.tsx, 1, 11)) ; +>foo : Symbol(unknown) >class-id : Symbol(unknown) ; +>foo : Symbol(unknown) >class : Symbol(unknown) ; +>foo : Symbol(unknown) >class-id : Symbol(unknown) ; +>foo : Symbol(unknown) >class : Symbol(unknown) diff --git a/tests/baselines/reference/lastPropertyInLiteralWins.errors.txt b/tests/baselines/reference/lastPropertyInLiteralWins.errors.txt index d503f59c602..51fce2d29d4 100644 --- a/tests/baselines/reference/lastPropertyInLiteralWins.errors.txt +++ b/tests/baselines/reference/lastPropertyInLiteralWins.errors.txt @@ -1,6 +1,8 @@ tests/cases/compiler/lastPropertyInLiteralWins.ts(7,6): error TS2345: Argument of type '{ thunk: (num: number) => void; }' is not assignable to parameter of type 'Thing'. Types of property 'thunk' are incompatible. Type '(num: number) => void' is not assignable to type '(str: string) => void'. + Types of parameters 'num' and 'str' are incompatible. + Type 'string' is not assignable to type 'number'. tests/cases/compiler/lastPropertyInLiteralWins.ts(8,5): error TS2300: Duplicate identifier 'thunk'. tests/cases/compiler/lastPropertyInLiteralWins.ts(9,5): error TS2300: Duplicate identifier 'thunk'. tests/cases/compiler/lastPropertyInLiteralWins.ts(13,5): error TS2300: Duplicate identifier 'thunk'. @@ -29,6 +31,8 @@ tests/cases/compiler/lastPropertyInLiteralWins.ts(14,5): error TS2300: Duplicate !!! error TS2345: Argument of type '{ thunk: (num: number) => void; }' is not assignable to parameter of type 'Thing'. !!! error TS2345: Types of property 'thunk' are incompatible. !!! error TS2345: Type '(num: number) => void' is not assignable to type '(str: string) => void'. +!!! error TS2345: Types of parameters 'num' and 'str' are incompatible. +!!! error TS2345: Type 'string' is not assignable to type 'number'. test({ // Should be OK. Last 'thunk' is of correct type thunk: (num: number) => {}, diff --git a/tests/baselines/reference/letDeclarations-access.symbols b/tests/baselines/reference/letDeclarations-access.symbols index 060ebc80b80..078ad740d20 100644 --- a/tests/baselines/reference/letDeclarations-access.symbols +++ b/tests/baselines/reference/letDeclarations-access.symbols @@ -81,7 +81,7 @@ x; >x : Symbol(x, Decl(letDeclarations-access.ts, 1, 3)) x.toString(); ->x.toString : Symbol(Number.toString, Decl(lib.d.ts, --, --)) +>x.toString : Symbol(Number.toString, Decl(lib.es5.d.ts, --, --)) >x : Symbol(x, Decl(letDeclarations-access.ts, 1, 3)) ->toString : Symbol(Number.toString, Decl(lib.d.ts, --, --)) +>toString : Symbol(Number.toString, Decl(lib.es5.d.ts, --, --)) diff --git a/tests/baselines/reference/letDeclarations-es5.types b/tests/baselines/reference/letDeclarations-es5.types index 005e0b26155..f6e8d418632 100644 --- a/tests/baselines/reference/letDeclarations-es5.types +++ b/tests/baselines/reference/letDeclarations-es5.types @@ -29,7 +29,7 @@ let l9 = 0, l10 :string = "", l11 = null; >null : null for(let l11 in {}) { } ->l11 : any +>l11 : string >{} : {} for(let l12 = 0; l12 < 9; l12++) { } diff --git a/tests/baselines/reference/letDeclarations.types b/tests/baselines/reference/letDeclarations.types index 55be4326b19..bb20f895a14 100644 --- a/tests/baselines/reference/letDeclarations.types +++ b/tests/baselines/reference/letDeclarations.types @@ -29,7 +29,7 @@ let l9 = 0, l10 :string = "", l11 = null; >null : null for(let l11 in {}) { } ->l11 : any +>l11 : string >{} : {} for(let l12 = 0; l12 < 9; l12++) { } diff --git a/tests/baselines/reference/letIdentifierInElementAccess01.js b/tests/baselines/reference/letIdentifierInElementAccess01.js new file mode 100644 index 00000000000..5e5e857479c --- /dev/null +++ b/tests/baselines/reference/letIdentifierInElementAccess01.js @@ -0,0 +1,7 @@ +//// [letIdentifierInElementAccess01.ts] +var let: any = {}; +(let[0] = 100); + +//// [letIdentifierInElementAccess01.js] +var let = {}; +(let[0] = 100); diff --git a/tests/baselines/reference/letIdentifierInElementAccess01.symbols b/tests/baselines/reference/letIdentifierInElementAccess01.symbols new file mode 100644 index 00000000000..a655b5703b0 --- /dev/null +++ b/tests/baselines/reference/letIdentifierInElementAccess01.symbols @@ -0,0 +1,7 @@ +=== tests/cases/conformance/expressions/elementAccess/letIdentifierInElementAccess01.ts === +var let: any = {}; +>let : Symbol(let, Decl(letIdentifierInElementAccess01.ts, 0, 3)) + +(let[0] = 100); +>let : Symbol(let, Decl(letIdentifierInElementAccess01.ts, 0, 3)) + diff --git a/tests/baselines/reference/letIdentifierInElementAccess01.types b/tests/baselines/reference/letIdentifierInElementAccess01.types new file mode 100644 index 00000000000..187fd7e221c --- /dev/null +++ b/tests/baselines/reference/letIdentifierInElementAccess01.types @@ -0,0 +1,13 @@ +=== tests/cases/conformance/expressions/elementAccess/letIdentifierInElementAccess01.ts === +var let: any = {}; +>let : any +>{} : {} + +(let[0] = 100); +>(let[0] = 100) : number +>let[0] = 100 : number +>let[0] : any +>let : any +>0 : number +>100 : number + diff --git a/tests/baselines/reference/letInVarDeclOfForIn_ES5.types b/tests/baselines/reference/letInVarDeclOfForIn_ES5.types index ac1ca3f27c9..095ae16b91e 100644 --- a/tests/baselines/reference/letInVarDeclOfForIn_ES5.types +++ b/tests/baselines/reference/letInVarDeclOfForIn_ES5.types @@ -2,7 +2,7 @@ // should not be an error for (var let in [1,2,3]) {} ->let : any +>let : string >[1,2,3] : number[] >1 : number >2 : number @@ -10,7 +10,7 @@ for (var let in [1,2,3]) {} { for (var let in [1,2,3]) {} ->let : any +>let : string >[1,2,3] : number[] >1 : number >2 : number diff --git a/tests/baselines/reference/letInVarDeclOfForIn_ES6.types b/tests/baselines/reference/letInVarDeclOfForIn_ES6.types index 3c508bd8e2b..a5e2ce108db 100644 --- a/tests/baselines/reference/letInVarDeclOfForIn_ES6.types +++ b/tests/baselines/reference/letInVarDeclOfForIn_ES6.types @@ -2,7 +2,7 @@ // should not be an error for (var let in [1,2,3]) {} ->let : any +>let : string >[1,2,3] : number[] >1 : number >2 : number @@ -10,7 +10,7 @@ for (var let in [1,2,3]) {} { for (var let in [1,2,3]) {} ->let : any +>let : string >[1,2,3] : number[] >1 : number >2 : number diff --git a/tests/baselines/reference/libdtsFix.symbols b/tests/baselines/reference/libdtsFix.symbols index 158b0587ec6..5399b7150e4 100644 --- a/tests/baselines/reference/libdtsFix.symbols +++ b/tests/baselines/reference/libdtsFix.symbols @@ -3,6 +3,6 @@ interface HTMLElement { >HTMLElement : Symbol(HTMLElement, Decl(libdtsFix.ts, 0, 0)) type: string; ->type : Symbol(type, Decl(libdtsFix.ts, 0, 23)) +>type : Symbol(HTMLElement.type, Decl(libdtsFix.ts, 0, 23)) } diff --git a/tests/baselines/reference/library-reference-1.js b/tests/baselines/reference/library-reference-1.js new file mode 100644 index 00000000000..e709db72dea --- /dev/null +++ b/tests/baselines/reference/library-reference-1.js @@ -0,0 +1,17 @@ +//// [tests/cases/conformance/references/library-reference-1.ts] //// + +//// [index.d.ts] + +// We can find typings in the ./types folder + +declare var $: { foo(): void }; + + +//// [consumer.ts] +/// +$.foo(); + + +//// [consumer.js] +/// +$.foo(); diff --git a/tests/baselines/reference/library-reference-1.symbols b/tests/baselines/reference/library-reference-1.symbols new file mode 100644 index 00000000000..0e848c626c5 --- /dev/null +++ b/tests/baselines/reference/library-reference-1.symbols @@ -0,0 +1,16 @@ +=== /consumer.ts === +/// +$.foo(); +>$.foo : Symbol(foo, Decl(index.d.ts, 3, 16)) +>$ : Symbol($, Decl(index.d.ts, 3, 11)) +>foo : Symbol(foo, Decl(index.d.ts, 3, 16)) + +=== /types/jquery/index.d.ts === + +// We can find typings in the ./types folder + +declare var $: { foo(): void }; +>$ : Symbol($, Decl(index.d.ts, 3, 11)) +>foo : Symbol(foo, Decl(index.d.ts, 3, 16)) + + diff --git a/tests/baselines/reference/library-reference-1.trace.json b/tests/baselines/reference/library-reference-1.trace.json new file mode 100644 index 00000000000..1b8c237dff1 --- /dev/null +++ b/tests/baselines/reference/library-reference-1.trace.json @@ -0,0 +1,7 @@ +[ + "======== Resolving type reference directive 'jquery', containing file '/consumer.ts', root directory '/'. ========", + "Resolving with primary search path '/types/'", + "File '/types/jquery/package.json' does not exist.", + "File '/types/jquery/index.d.ts' exist - use it as a name resolution result.", + "======== Type reference directive 'jquery' was successfully resolved to '/types/jquery/index.d.ts', primary: true. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/library-reference-1.types b/tests/baselines/reference/library-reference-1.types new file mode 100644 index 00000000000..99133f2f8df --- /dev/null +++ b/tests/baselines/reference/library-reference-1.types @@ -0,0 +1,17 @@ +=== /consumer.ts === +/// +$.foo(); +>$.foo() : void +>$.foo : () => void +>$ : { foo(): void; } +>foo : () => void + +=== /types/jquery/index.d.ts === + +// We can find typings in the ./types folder + +declare var $: { foo(): void }; +>$ : { foo(): void; } +>foo : () => void + + diff --git a/tests/baselines/reference/library-reference-10.js b/tests/baselines/reference/library-reference-10.js new file mode 100644 index 00000000000..a6dbdfce610 --- /dev/null +++ b/tests/baselines/reference/library-reference-10.js @@ -0,0 +1,22 @@ +//// [tests/cases/conformance/references/library-reference-10.ts] //// + +//// [package.json] + +// package.json in a primary reference can refer to another file + +{ + "typings": "jquery.d.ts" +} + +//// [jquery.d.ts] +declare var $: { foo(): void }; + + +//// [consumer.ts] +/// +$.foo(); + + +//// [consumer.js] +/// +$.foo(); diff --git a/tests/baselines/reference/library-reference-10.symbols b/tests/baselines/reference/library-reference-10.symbols new file mode 100644 index 00000000000..9d0f7e4781e --- /dev/null +++ b/tests/baselines/reference/library-reference-10.symbols @@ -0,0 +1,13 @@ +=== /consumer.ts === +/// +$.foo(); +>$.foo : Symbol(foo, Decl(jquery.d.ts, 0, 16)) +>$ : Symbol($, Decl(jquery.d.ts, 0, 11)) +>foo : Symbol(foo, Decl(jquery.d.ts, 0, 16)) + +=== /types/jquery/jquery.d.ts === +declare var $: { foo(): void }; +>$ : Symbol($, Decl(jquery.d.ts, 0, 11)) +>foo : Symbol(foo, Decl(jquery.d.ts, 0, 16)) + + diff --git a/tests/baselines/reference/library-reference-10.trace.json b/tests/baselines/reference/library-reference-10.trace.json new file mode 100644 index 00000000000..e6a1918a446 --- /dev/null +++ b/tests/baselines/reference/library-reference-10.trace.json @@ -0,0 +1,8 @@ +[ + "======== Resolving type reference directive 'jquery', containing file '/consumer.ts', root directory '/'. ========", + "Resolving with primary search path '/types/'", + "Found 'package.json' at '/types/jquery/package.json'.", + "'package.json' has 'typings' field 'jquery.d.ts' that references '/types/jquery/jquery.d.ts'.", + "File '/types/jquery/jquery.d.ts' exist - use it as a name resolution result.", + "======== Type reference directive 'jquery' was successfully resolved to '/types/jquery/jquery.d.ts', primary: true. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/library-reference-10.types b/tests/baselines/reference/library-reference-10.types new file mode 100644 index 00000000000..42d78f72865 --- /dev/null +++ b/tests/baselines/reference/library-reference-10.types @@ -0,0 +1,14 @@ +=== /consumer.ts === +/// +$.foo(); +>$.foo() : void +>$.foo : () => void +>$ : { foo(): void; } +>foo : () => void + +=== /types/jquery/jquery.d.ts === +declare var $: { foo(): void }; +>$ : { foo(): void; } +>foo : () => void + + diff --git a/tests/baselines/reference/library-reference-11.js b/tests/baselines/reference/library-reference-11.js new file mode 100644 index 00000000000..773fe5a890a --- /dev/null +++ b/tests/baselines/reference/library-reference-11.js @@ -0,0 +1,22 @@ +//// [tests/cases/conformance/references/library-reference-11.ts] //// + +//// [package.json] + +// package.json in a secondary reference can refer to another file + +{ + "typings": "jquery.d.ts" +} + +//// [jquery.d.ts] +declare var $: { foo(): void }; + + +//// [consumer.ts] +/// +$.foo(); + + +//// [consumer.js] +/// +$.foo(); diff --git a/tests/baselines/reference/library-reference-11.symbols b/tests/baselines/reference/library-reference-11.symbols new file mode 100644 index 00000000000..22b8bdf1b44 --- /dev/null +++ b/tests/baselines/reference/library-reference-11.symbols @@ -0,0 +1,13 @@ +=== /a/b/consumer.ts === +/// +$.foo(); +>$.foo : Symbol(foo, Decl(jquery.d.ts, 0, 16)) +>$ : Symbol($, Decl(jquery.d.ts, 0, 11)) +>foo : Symbol(foo, Decl(jquery.d.ts, 0, 16)) + +=== /a/node_modules/jquery/jquery.d.ts === +declare var $: { foo(): void }; +>$ : Symbol($, Decl(jquery.d.ts, 0, 11)) +>foo : Symbol(foo, Decl(jquery.d.ts, 0, 16)) + + diff --git a/tests/baselines/reference/library-reference-11.trace.json b/tests/baselines/reference/library-reference-11.trace.json new file mode 100644 index 00000000000..e0af1e39c5a --- /dev/null +++ b/tests/baselines/reference/library-reference-11.trace.json @@ -0,0 +1,21 @@ +[ + "======== Resolving type reference directive 'jquery', containing file '/a/b/consumer.ts', root directory not set. ========", + "Root directory cannot be determined, skipping primary search paths.", + "Looking up in 'node_modules' folder, initial location '/a/b'", + "File '/a/b/node_modules/jquery.ts' does not exist.", + "File '/a/b/node_modules/jquery.d.ts' does not exist.", + "File '/a/b/node_modules/jquery/package.json' does not exist.", + "File '/a/b/node_modules/jquery/index.ts' does not exist.", + "File '/a/b/node_modules/jquery/index.d.ts' does not exist.", + "File '/a/b/node_modules/@types/jquery.ts' does not exist.", + "File '/a/b/node_modules/@types/jquery.d.ts' does not exist.", + "File '/a/b/node_modules/@types/jquery/package.json' does not exist.", + "File '/a/b/node_modules/@types/jquery/index.ts' does not exist.", + "File '/a/b/node_modules/@types/jquery/index.d.ts' does not exist.", + "File '/a/node_modules/jquery.ts' does not exist.", + "File '/a/node_modules/jquery.d.ts' does not exist.", + "Found 'package.json' at '/a/node_modules/jquery/package.json'.", + "'package.json' has 'typings' field 'jquery.d.ts' that references '/a/node_modules/jquery/jquery.d.ts'.", + "File '/a/node_modules/jquery/jquery.d.ts' exist - use it as a name resolution result.", + "======== Type reference directive 'jquery' was successfully resolved to '/a/node_modules/jquery/jquery.d.ts', primary: false. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/library-reference-11.types b/tests/baselines/reference/library-reference-11.types new file mode 100644 index 00000000000..267ee08e6d6 --- /dev/null +++ b/tests/baselines/reference/library-reference-11.types @@ -0,0 +1,14 @@ +=== /a/b/consumer.ts === +/// +$.foo(); +>$.foo() : void +>$.foo : () => void +>$ : { foo(): void; } +>foo : () => void + +=== /a/node_modules/jquery/jquery.d.ts === +declare var $: { foo(): void }; +>$ : { foo(): void; } +>foo : () => void + + diff --git a/tests/baselines/reference/library-reference-12.js b/tests/baselines/reference/library-reference-12.js new file mode 100644 index 00000000000..42d0f650b50 --- /dev/null +++ b/tests/baselines/reference/library-reference-12.js @@ -0,0 +1,22 @@ +//// [tests/cases/conformance/references/library-reference-12.ts] //// + +//// [package.json] + +// package.json in a secondary reference can refer to another file + +{ + "types": "dist/jquery.d.ts" +} + +//// [jquery.d.ts] +declare var $: { foo(): void }; + + +//// [consumer.ts] +/// +$.foo(); + + +//// [consumer.js] +/// +$.foo(); diff --git a/tests/baselines/reference/library-reference-12.symbols b/tests/baselines/reference/library-reference-12.symbols new file mode 100644 index 00000000000..2e25588bf77 --- /dev/null +++ b/tests/baselines/reference/library-reference-12.symbols @@ -0,0 +1,13 @@ +=== /a/b/consumer.ts === +/// +$.foo(); +>$.foo : Symbol(foo, Decl(jquery.d.ts, 0, 16)) +>$ : Symbol($, Decl(jquery.d.ts, 0, 11)) +>foo : Symbol(foo, Decl(jquery.d.ts, 0, 16)) + +=== /a/node_modules/jquery/dist/jquery.d.ts === +declare var $: { foo(): void }; +>$ : Symbol($, Decl(jquery.d.ts, 0, 11)) +>foo : Symbol(foo, Decl(jquery.d.ts, 0, 16)) + + diff --git a/tests/baselines/reference/library-reference-12.trace.json b/tests/baselines/reference/library-reference-12.trace.json new file mode 100644 index 00000000000..2cdf1f5f20a --- /dev/null +++ b/tests/baselines/reference/library-reference-12.trace.json @@ -0,0 +1,21 @@ +[ + "======== Resolving type reference directive 'jquery', containing file '/a/b/consumer.ts', root directory not set. ========", + "Root directory cannot be determined, skipping primary search paths.", + "Looking up in 'node_modules' folder, initial location '/a/b'", + "File '/a/b/node_modules/jquery.ts' does not exist.", + "File '/a/b/node_modules/jquery.d.ts' does not exist.", + "File '/a/b/node_modules/jquery/package.json' does not exist.", + "File '/a/b/node_modules/jquery/index.ts' does not exist.", + "File '/a/b/node_modules/jquery/index.d.ts' does not exist.", + "File '/a/b/node_modules/@types/jquery.ts' does not exist.", + "File '/a/b/node_modules/@types/jquery.d.ts' does not exist.", + "File '/a/b/node_modules/@types/jquery/package.json' does not exist.", + "File '/a/b/node_modules/@types/jquery/index.ts' does not exist.", + "File '/a/b/node_modules/@types/jquery/index.d.ts' does not exist.", + "File '/a/node_modules/jquery.ts' does not exist.", + "File '/a/node_modules/jquery.d.ts' does not exist.", + "Found 'package.json' at '/a/node_modules/jquery/package.json'.", + "'package.json' has 'types' field 'dist/jquery.d.ts' that references '/a/node_modules/jquery/dist/jquery.d.ts'.", + "File '/a/node_modules/jquery/dist/jquery.d.ts' exist - use it as a name resolution result.", + "======== Type reference directive 'jquery' was successfully resolved to '/a/node_modules/jquery/dist/jquery.d.ts', primary: false. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/library-reference-12.types b/tests/baselines/reference/library-reference-12.types new file mode 100644 index 00000000000..2ab9fb8ba95 --- /dev/null +++ b/tests/baselines/reference/library-reference-12.types @@ -0,0 +1,14 @@ +=== /a/b/consumer.ts === +/// +$.foo(); +>$.foo() : void +>$.foo : () => void +>$ : { foo(): void; } +>foo : () => void + +=== /a/node_modules/jquery/dist/jquery.d.ts === +declare var $: { foo(): void }; +>$ : { foo(): void; } +>foo : () => void + + diff --git a/tests/baselines/reference/library-reference-13.js b/tests/baselines/reference/library-reference-13.js new file mode 100644 index 00000000000..be52aba1a39 --- /dev/null +++ b/tests/baselines/reference/library-reference-13.js @@ -0,0 +1,12 @@ +//// [tests/cases/conformance/references/library-reference-13.ts] //// + +//// [index.d.ts] +declare var $: { foo(): void }; + + +//// [consumer.ts] +$.foo(); + + +//// [consumer.js] +$.foo(); diff --git a/tests/baselines/reference/library-reference-13.symbols b/tests/baselines/reference/library-reference-13.symbols new file mode 100644 index 00000000000..04d50373caa --- /dev/null +++ b/tests/baselines/reference/library-reference-13.symbols @@ -0,0 +1,12 @@ +=== /a/b/consumer.ts === +$.foo(); +>$.foo : Symbol(foo, Decl(index.d.ts, 0, 16)) +>$ : Symbol($, Decl(index.d.ts, 0, 11)) +>foo : Symbol(foo, Decl(index.d.ts, 0, 16)) + +=== /a/types/jquery/index.d.ts === +declare var $: { foo(): void }; +>$ : Symbol($, Decl(index.d.ts, 0, 11)) +>foo : Symbol(foo, Decl(index.d.ts, 0, 16)) + + diff --git a/tests/baselines/reference/library-reference-13.trace.json b/tests/baselines/reference/library-reference-13.trace.json new file mode 100644 index 00000000000..2133414f414 --- /dev/null +++ b/tests/baselines/reference/library-reference-13.trace.json @@ -0,0 +1,7 @@ +[ + "======== Resolving type reference directive 'jquery', containing file not set, root directory '/a'. ========", + "Resolving with primary search path '/a/types/'", + "File '/a/types/jquery/package.json' does not exist.", + "File '/a/types/jquery/index.d.ts' exist - use it as a name resolution result.", + "======== Type reference directive 'jquery' was successfully resolved to '/a/types/jquery/index.d.ts', primary: true. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/library-reference-13.types b/tests/baselines/reference/library-reference-13.types new file mode 100644 index 00000000000..b00d778c5b2 --- /dev/null +++ b/tests/baselines/reference/library-reference-13.types @@ -0,0 +1,13 @@ +=== /a/b/consumer.ts === +$.foo(); +>$.foo() : void +>$.foo : () => void +>$ : { foo(): void; } +>foo : () => void + +=== /a/types/jquery/index.d.ts === +declare var $: { foo(): void }; +>$ : { foo(): void; } +>foo : () => void + + diff --git a/tests/baselines/reference/library-reference-14.js b/tests/baselines/reference/library-reference-14.js new file mode 100644 index 00000000000..0fb5ff04fb9 --- /dev/null +++ b/tests/baselines/reference/library-reference-14.js @@ -0,0 +1,13 @@ +//// [tests/cases/conformance/references/library-reference-14.ts] //// + +//// [index.d.ts] + +declare var $: { foo(): void }; + + +//// [consumer.ts] +$.foo(); + + +//// [consumer.js] +$.foo(); diff --git a/tests/baselines/reference/library-reference-14.symbols b/tests/baselines/reference/library-reference-14.symbols new file mode 100644 index 00000000000..162afc50ca7 --- /dev/null +++ b/tests/baselines/reference/library-reference-14.symbols @@ -0,0 +1,13 @@ +=== /a/b/consumer.ts === +$.foo(); +>$.foo : Symbol(foo, Decl(index.d.ts, 1, 16)) +>$ : Symbol($, Decl(index.d.ts, 1, 11)) +>foo : Symbol(foo, Decl(index.d.ts, 1, 16)) + +=== /a/types/jquery/index.d.ts === + +declare var $: { foo(): void }; +>$ : Symbol($, Decl(index.d.ts, 1, 11)) +>foo : Symbol(foo, Decl(index.d.ts, 1, 16)) + + diff --git a/tests/baselines/reference/library-reference-14.trace.json b/tests/baselines/reference/library-reference-14.trace.json new file mode 100644 index 00000000000..2133414f414 --- /dev/null +++ b/tests/baselines/reference/library-reference-14.trace.json @@ -0,0 +1,7 @@ +[ + "======== Resolving type reference directive 'jquery', containing file not set, root directory '/a'. ========", + "Resolving with primary search path '/a/types/'", + "File '/a/types/jquery/package.json' does not exist.", + "File '/a/types/jquery/index.d.ts' exist - use it as a name resolution result.", + "======== Type reference directive 'jquery' was successfully resolved to '/a/types/jquery/index.d.ts', primary: true. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/library-reference-14.types b/tests/baselines/reference/library-reference-14.types new file mode 100644 index 00000000000..f4196e10744 --- /dev/null +++ b/tests/baselines/reference/library-reference-14.types @@ -0,0 +1,14 @@ +=== /a/b/consumer.ts === +$.foo(); +>$.foo() : void +>$.foo : () => void +>$ : { foo(): void; } +>foo : () => void + +=== /a/types/jquery/index.d.ts === + +declare var $: { foo(): void }; +>$ : { foo(): void; } +>foo : () => void + + diff --git a/tests/baselines/reference/library-reference-15.errors.txt b/tests/baselines/reference/library-reference-15.errors.txt new file mode 100644 index 00000000000..a311633ca76 --- /dev/null +++ b/tests/baselines/reference/library-reference-15.errors.txt @@ -0,0 +1,15 @@ +error TS2304: Cannot find name 'jquery'. +/a/b/consumer.ts(1,1): error TS2304: Cannot find name '$'. + + +!!! error TS2304: Cannot find name 'jquery'. +==== /a/b/consumer.ts (1 errors) ==== + $.foo(); + ~ +!!! error TS2304: Cannot find name '$'. + +==== /a/types/jquery/index.d.ts (0 errors) ==== + + declare var $: { foo(): void }; + + \ No newline at end of file diff --git a/tests/baselines/reference/library-reference-15.js b/tests/baselines/reference/library-reference-15.js new file mode 100644 index 00000000000..f9aa7038d53 --- /dev/null +++ b/tests/baselines/reference/library-reference-15.js @@ -0,0 +1,13 @@ +//// [tests/cases/conformance/references/library-reference-15.ts] //// + +//// [index.d.ts] + +declare var $: { foo(): void }; + + +//// [consumer.ts] +$.foo(); + + +//// [consumer.js] +$.foo(); diff --git a/tests/baselines/reference/library-reference-15.trace.json b/tests/baselines/reference/library-reference-15.trace.json new file mode 100644 index 00000000000..9a19d75ffac --- /dev/null +++ b/tests/baselines/reference/library-reference-15.trace.json @@ -0,0 +1,5 @@ +[ + "======== Resolving type reference directive 'jquery', containing file not set, root directory not set. ========", + "Root directory cannot be determined, skipping primary search paths.", + "Containing file is not specified and root directory cannot be determined, skipping lookup in 'node_modules' folder." +] \ No newline at end of file diff --git a/tests/baselines/reference/library-reference-2.js b/tests/baselines/reference/library-reference-2.js new file mode 100644 index 00000000000..20729db6c60 --- /dev/null +++ b/tests/baselines/reference/library-reference-2.js @@ -0,0 +1,22 @@ +//// [tests/cases/conformance/references/library-reference-2.ts] //// + +//// [package.json] + +// package.json in a primary reference can refer to another file + +{ + "types": "jquery.d.ts" +} + +//// [jquery.d.ts] +declare var $: { foo(): void }; + + +//// [consumer.ts] +/// +$.foo(); + + +//// [consumer.js] +/// +$.foo(); diff --git a/tests/baselines/reference/library-reference-2.symbols b/tests/baselines/reference/library-reference-2.symbols new file mode 100644 index 00000000000..9d0f7e4781e --- /dev/null +++ b/tests/baselines/reference/library-reference-2.symbols @@ -0,0 +1,13 @@ +=== /consumer.ts === +/// +$.foo(); +>$.foo : Symbol(foo, Decl(jquery.d.ts, 0, 16)) +>$ : Symbol($, Decl(jquery.d.ts, 0, 11)) +>foo : Symbol(foo, Decl(jquery.d.ts, 0, 16)) + +=== /types/jquery/jquery.d.ts === +declare var $: { foo(): void }; +>$ : Symbol($, Decl(jquery.d.ts, 0, 11)) +>foo : Symbol(foo, Decl(jquery.d.ts, 0, 16)) + + diff --git a/tests/baselines/reference/library-reference-2.trace.json b/tests/baselines/reference/library-reference-2.trace.json new file mode 100644 index 00000000000..b5ef5f3e208 --- /dev/null +++ b/tests/baselines/reference/library-reference-2.trace.json @@ -0,0 +1,8 @@ +[ + "======== Resolving type reference directive 'jquery', containing file '/consumer.ts', root directory '/'. ========", + "Resolving with primary search path '/types/'", + "Found 'package.json' at '/types/jquery/package.json'.", + "'package.json' has 'types' field 'jquery.d.ts' that references '/types/jquery/jquery.d.ts'.", + "File '/types/jquery/jquery.d.ts' exist - use it as a name resolution result.", + "======== Type reference directive 'jquery' was successfully resolved to '/types/jquery/jquery.d.ts', primary: true. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/library-reference-2.types b/tests/baselines/reference/library-reference-2.types new file mode 100644 index 00000000000..42d78f72865 --- /dev/null +++ b/tests/baselines/reference/library-reference-2.types @@ -0,0 +1,14 @@ +=== /consumer.ts === +/// +$.foo(); +>$.foo() : void +>$.foo : () => void +>$ : { foo(): void; } +>foo : () => void + +=== /types/jquery/jquery.d.ts === +declare var $: { foo(): void }; +>$ : { foo(): void; } +>foo : () => void + + diff --git a/tests/baselines/reference/library-reference-3.js b/tests/baselines/reference/library-reference-3.js new file mode 100644 index 00000000000..6f9ad2d43d2 --- /dev/null +++ b/tests/baselines/reference/library-reference-3.js @@ -0,0 +1,16 @@ +//// [tests/cases/conformance/references/library-reference-3.ts] //// + +//// [index.d.ts] + +// Secondary references are possible + +declare var $: { foo(): void }; + +//// [consumer.ts] +/// +$.foo(); + + +//// [consumer.js] +/// +$.foo(); diff --git a/tests/baselines/reference/library-reference-3.symbols b/tests/baselines/reference/library-reference-3.symbols new file mode 100644 index 00000000000..a1785fd77c9 --- /dev/null +++ b/tests/baselines/reference/library-reference-3.symbols @@ -0,0 +1,15 @@ +=== /src/consumer.ts === +/// +$.foo(); +>$.foo : Symbol(foo, Decl(index.d.ts, 3, 16)) +>$ : Symbol($, Decl(index.d.ts, 3, 11)) +>foo : Symbol(foo, Decl(index.d.ts, 3, 16)) + +=== /src/node_modules/jquery/index.d.ts === + +// Secondary references are possible + +declare var $: { foo(): void }; +>$ : Symbol($, Decl(index.d.ts, 3, 11)) +>foo : Symbol(foo, Decl(index.d.ts, 3, 16)) + diff --git a/tests/baselines/reference/library-reference-3.trace.json b/tests/baselines/reference/library-reference-3.trace.json new file mode 100644 index 00000000000..30dbbc3fca4 --- /dev/null +++ b/tests/baselines/reference/library-reference-3.trace.json @@ -0,0 +1,10 @@ +[ + "======== Resolving type reference directive 'jquery', containing file '/src/consumer.ts', root directory '/src'. ========", + "Resolving with primary search path '/src/types/'", + "File '/src/types/jquery/package.json' does not exist.", + "File '/src/types/jquery/index.d.ts' does not exist.", + "Resolving with primary search path '/src/node_modules/'", + "File '/src/node_modules/jquery/package.json' does not exist.", + "File '/src/node_modules/jquery/index.d.ts' exist - use it as a name resolution result.", + "======== Type reference directive 'jquery' was successfully resolved to '/src/node_modules/jquery/index.d.ts', primary: true. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/library-reference-3.types b/tests/baselines/reference/library-reference-3.types new file mode 100644 index 00000000000..ed7da59525f --- /dev/null +++ b/tests/baselines/reference/library-reference-3.types @@ -0,0 +1,16 @@ +=== /src/consumer.ts === +/// +$.foo(); +>$.foo() : void +>$.foo : () => void +>$ : { foo(): void; } +>foo : () => void + +=== /src/node_modules/jquery/index.d.ts === + +// Secondary references are possible + +declare var $: { foo(): void }; +>$ : { foo(): void; } +>foo : () => void + diff --git a/tests/baselines/reference/library-reference-4.js b/tests/baselines/reference/library-reference-4.js new file mode 100644 index 00000000000..39e4b1d73a5 --- /dev/null +++ b/tests/baselines/reference/library-reference-4.js @@ -0,0 +1,27 @@ +//// [tests/cases/conformance/references/library-reference-4.ts] //// + +//// [index.d.ts] + +// Secondary references may be duplicated if they agree in content + +/// +declare var foo: any; + +//// [index.d.ts] +declare var alpha: any; + +//// [index.d.ts] +/// +declare var bar: any; + +//// [index.d.ts] +declare var alpha: any; + +//// [root.ts] +/// +/// + + +//// [root.js] +/// +/// diff --git a/tests/baselines/reference/library-reference-4.symbols b/tests/baselines/reference/library-reference-4.symbols new file mode 100644 index 00000000000..f7c082a946d --- /dev/null +++ b/tests/baselines/reference/library-reference-4.symbols @@ -0,0 +1,21 @@ +=== /src/root.ts === +/// +No type information for this code./// +No type information for this code. +No type information for this code.=== /node_modules/foo/index.d.ts === + +// Secondary references may be duplicated if they agree in content + +/// +declare var foo: any; +>foo : Symbol(foo, Decl(index.d.ts, 4, 11)) + +=== /node_modules/foo/node_modules/alpha/index.d.ts === +declare var alpha: any; +>alpha : Symbol(alpha, Decl(index.d.ts, 0, 11)) + +=== /node_modules/bar/index.d.ts === +/// +declare var bar: any; +>bar : Symbol(bar, Decl(index.d.ts, 1, 11)) + diff --git a/tests/baselines/reference/library-reference-4.trace.json b/tests/baselines/reference/library-reference-4.trace.json new file mode 100644 index 00000000000..90b6eb7b01d --- /dev/null +++ b/tests/baselines/reference/library-reference-4.trace.json @@ -0,0 +1,90 @@ +[ + "======== Resolving type reference directive 'foo', containing file '/src/root.ts', root directory '/src'. ========", + "Resolving with primary search path '/src/types/'", + "File '/src/types/foo/package.json' does not exist.", + "File '/src/types/foo/index.d.ts' does not exist.", + "Resolving with primary search path '/src/node_modules/'", + "File '/src/node_modules/foo/package.json' does not exist.", + "File '/src/node_modules/foo/index.d.ts' does not exist.", + "Resolving with primary search path '/src/node_modules/@types/'", + "File '/src/node_modules/@types/foo/package.json' does not exist.", + "File '/src/node_modules/@types/foo/index.d.ts' does not exist.", + "Looking up in 'node_modules' folder, initial location '/src'", + "File '/src/node_modules/foo.ts' does not exist.", + "File '/src/node_modules/foo.d.ts' does not exist.", + "File '/src/node_modules/foo/package.json' does not exist.", + "File '/src/node_modules/foo/index.ts' does not exist.", + "File '/src/node_modules/foo/index.d.ts' does not exist.", + "File '/src/node_modules/@types/foo.ts' does not exist.", + "File '/src/node_modules/@types/foo.d.ts' does not exist.", + "File '/src/node_modules/@types/foo/package.json' does not exist.", + "File '/src/node_modules/@types/foo/index.ts' does not exist.", + "File '/src/node_modules/@types/foo/index.d.ts' does not exist.", + "File '/node_modules/foo.ts' does not exist.", + "File '/node_modules/foo.d.ts' does not exist.", + "File '/node_modules/foo/package.json' does not exist.", + "File '/node_modules/foo/index.ts' does not exist.", + "File '/node_modules/foo/index.d.ts' exist - use it as a name resolution result.", + "======== Type reference directive 'foo' was successfully resolved to '/node_modules/foo/index.d.ts', primary: false. ========", + "======== Resolving type reference directive 'bar', containing file '/src/root.ts', root directory '/src'. ========", + "Resolving with primary search path '/src/types/'", + "File '/src/types/bar/package.json' does not exist.", + "File '/src/types/bar/index.d.ts' does not exist.", + "Resolving with primary search path '/src/node_modules/'", + "File '/src/node_modules/bar/package.json' does not exist.", + "File '/src/node_modules/bar/index.d.ts' does not exist.", + "Resolving with primary search path '/src/node_modules/@types/'", + "File '/src/node_modules/@types/bar/package.json' does not exist.", + "File '/src/node_modules/@types/bar/index.d.ts' does not exist.", + "Looking up in 'node_modules' folder, initial location '/src'", + "File '/src/node_modules/bar.ts' does not exist.", + "File '/src/node_modules/bar.d.ts' does not exist.", + "File '/src/node_modules/bar/package.json' does not exist.", + "File '/src/node_modules/bar/index.ts' does not exist.", + "File '/src/node_modules/bar/index.d.ts' does not exist.", + "File '/src/node_modules/@types/bar.ts' does not exist.", + "File '/src/node_modules/@types/bar.d.ts' does not exist.", + "File '/src/node_modules/@types/bar/package.json' does not exist.", + "File '/src/node_modules/@types/bar/index.ts' does not exist.", + "File '/src/node_modules/@types/bar/index.d.ts' does not exist.", + "File '/node_modules/bar.ts' does not exist.", + "File '/node_modules/bar.d.ts' does not exist.", + "File '/node_modules/bar/package.json' does not exist.", + "File '/node_modules/bar/index.ts' does not exist.", + "File '/node_modules/bar/index.d.ts' exist - use it as a name resolution result.", + "======== Type reference directive 'bar' was successfully resolved to '/node_modules/bar/index.d.ts', primary: false. ========", + "======== Resolving type reference directive 'alpha', containing file '/node_modules/foo/index.d.ts', root directory '/src'. ========", + "Resolving with primary search path '/src/types/'", + "File '/src/types/alpha/package.json' does not exist.", + "File '/src/types/alpha/index.d.ts' does not exist.", + "Resolving with primary search path '/src/node_modules/'", + "File '/src/node_modules/alpha/package.json' does not exist.", + "File '/src/node_modules/alpha/index.d.ts' does not exist.", + "Resolving with primary search path '/src/node_modules/@types/'", + "File '/src/node_modules/@types/alpha/package.json' does not exist.", + "File '/src/node_modules/@types/alpha/index.d.ts' does not exist.", + "Looking up in 'node_modules' folder, initial location '/node_modules/foo'", + "File '/node_modules/foo/node_modules/alpha.ts' does not exist.", + "File '/node_modules/foo/node_modules/alpha.d.ts' does not exist.", + "File '/node_modules/foo/node_modules/alpha/package.json' does not exist.", + "File '/node_modules/foo/node_modules/alpha/index.ts' does not exist.", + "File '/node_modules/foo/node_modules/alpha/index.d.ts' exist - use it as a name resolution result.", + "======== Type reference directive 'alpha' was successfully resolved to '/node_modules/foo/node_modules/alpha/index.d.ts', primary: false. ========", + "======== Resolving type reference directive 'alpha', containing file '/node_modules/bar/index.d.ts', root directory '/src'. ========", + "Resolving with primary search path '/src/types/'", + "File '/src/types/alpha/package.json' does not exist.", + "File '/src/types/alpha/index.d.ts' does not exist.", + "Resolving with primary search path '/src/node_modules/'", + "File '/src/node_modules/alpha/package.json' does not exist.", + "File '/src/node_modules/alpha/index.d.ts' does not exist.", + "Resolving with primary search path '/src/node_modules/@types/'", + "File '/src/node_modules/@types/alpha/package.json' does not exist.", + "File '/src/node_modules/@types/alpha/index.d.ts' does not exist.", + "Looking up in 'node_modules' folder, initial location '/node_modules/bar'", + "File '/node_modules/bar/node_modules/alpha.ts' does not exist.", + "File '/node_modules/bar/node_modules/alpha.d.ts' does not exist.", + "File '/node_modules/bar/node_modules/alpha/package.json' does not exist.", + "File '/node_modules/bar/node_modules/alpha/index.ts' does not exist.", + "File '/node_modules/bar/node_modules/alpha/index.d.ts' exist - use it as a name resolution result.", + "======== Type reference directive 'alpha' was successfully resolved to '/node_modules/bar/node_modules/alpha/index.d.ts', primary: false. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/library-reference-4.types b/tests/baselines/reference/library-reference-4.types new file mode 100644 index 00000000000..a0a7d370b4c --- /dev/null +++ b/tests/baselines/reference/library-reference-4.types @@ -0,0 +1,21 @@ +=== /src/root.ts === +/// +No type information for this code./// +No type information for this code. +No type information for this code.=== /node_modules/foo/index.d.ts === + +// Secondary references may be duplicated if they agree in content + +/// +declare var foo: any; +>foo : any + +=== /node_modules/foo/node_modules/alpha/index.d.ts === +declare var alpha: any; +>alpha : any + +=== /node_modules/bar/index.d.ts === +/// +declare var bar: any; +>bar : any + diff --git a/tests/baselines/reference/library-reference-5.errors.txt b/tests/baselines/reference/library-reference-5.errors.txt new file mode 100644 index 00000000000..ea571cad1a3 --- /dev/null +++ b/tests/baselines/reference/library-reference-5.errors.txt @@ -0,0 +1,26 @@ +/node_modules/bar/index.d.ts(1,1): message TS4090: Conflicting library definitions for 'alpha' found at '/node_modules/bar/node_modules/alpha/index.d.ts' and '/node_modules/foo/node_modules/alpha/index.d.ts'. Copy the correct file to the 'typings' folder to resolve this conflict. + + +==== /src/root.ts (0 errors) ==== + /// + /// + +==== /node_modules/foo/index.d.ts (0 errors) ==== + + // Secondary references may not be duplicated if they disagree in content + + /// + declare var foo: any; + +==== /node_modules/foo/node_modules/alpha/index.d.ts (0 errors) ==== + declare var alpha: any; + +==== /node_modules/bar/index.d.ts (1 errors) ==== + /// + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! message TS4090: Conflicting library definitions for 'alpha' found at 'index.d.ts' and 'index.d.ts'. Copy the correct file to the 'typings' folder to resolve this conflict. + declare var bar: any; + +==== /node_modules/bar/node_modules/alpha/index.d.ts (0 errors) ==== + declare var alpha: {}; + \ No newline at end of file diff --git a/tests/baselines/reference/library-reference-5.js b/tests/baselines/reference/library-reference-5.js new file mode 100644 index 00000000000..40d2131920e --- /dev/null +++ b/tests/baselines/reference/library-reference-5.js @@ -0,0 +1,27 @@ +//// [tests/cases/conformance/references/library-reference-5.ts] //// + +//// [index.d.ts] + +// Secondary references may not be duplicated if they disagree in content + +/// +declare var foo: any; + +//// [index.d.ts] +declare var alpha: any; + +//// [index.d.ts] +/// +declare var bar: any; + +//// [index.d.ts] +declare var alpha: {}; + +//// [root.ts] +/// +/// + + +//// [root.js] +/// +/// diff --git a/tests/baselines/reference/library-reference-5.trace.json b/tests/baselines/reference/library-reference-5.trace.json new file mode 100644 index 00000000000..272009782b5 --- /dev/null +++ b/tests/baselines/reference/library-reference-5.trace.json @@ -0,0 +1,58 @@ +[ + "======== Resolving type reference directive 'foo', containing file '/src/root.ts', root directory not set. ========", + "Root directory cannot be determined, skipping primary search paths.", + "Looking up in 'node_modules' folder, initial location '/src'", + "File '/src/node_modules/foo.ts' does not exist.", + "File '/src/node_modules/foo.d.ts' does not exist.", + "File '/src/node_modules/foo/package.json' does not exist.", + "File '/src/node_modules/foo/index.ts' does not exist.", + "File '/src/node_modules/foo/index.d.ts' does not exist.", + "File '/src/node_modules/@types/foo.ts' does not exist.", + "File '/src/node_modules/@types/foo.d.ts' does not exist.", + "File '/src/node_modules/@types/foo/package.json' does not exist.", + "File '/src/node_modules/@types/foo/index.ts' does not exist.", + "File '/src/node_modules/@types/foo/index.d.ts' does not exist.", + "File '/node_modules/foo.ts' does not exist.", + "File '/node_modules/foo.d.ts' does not exist.", + "File '/node_modules/foo/package.json' does not exist.", + "File '/node_modules/foo/index.ts' does not exist.", + "File '/node_modules/foo/index.d.ts' exist - use it as a name resolution result.", + "======== Type reference directive 'foo' was successfully resolved to '/node_modules/foo/index.d.ts', primary: false. ========", + "======== Resolving type reference directive 'bar', containing file '/src/root.ts', root directory not set. ========", + "Root directory cannot be determined, skipping primary search paths.", + "Looking up in 'node_modules' folder, initial location '/src'", + "File '/src/node_modules/bar.ts' does not exist.", + "File '/src/node_modules/bar.d.ts' does not exist.", + "File '/src/node_modules/bar/package.json' does not exist.", + "File '/src/node_modules/bar/index.ts' does not exist.", + "File '/src/node_modules/bar/index.d.ts' does not exist.", + "File '/src/node_modules/@types/bar.ts' does not exist.", + "File '/src/node_modules/@types/bar.d.ts' does not exist.", + "File '/src/node_modules/@types/bar/package.json' does not exist.", + "File '/src/node_modules/@types/bar/index.ts' does not exist.", + "File '/src/node_modules/@types/bar/index.d.ts' does not exist.", + "File '/node_modules/bar.ts' does not exist.", + "File '/node_modules/bar.d.ts' does not exist.", + "File '/node_modules/bar/package.json' does not exist.", + "File '/node_modules/bar/index.ts' does not exist.", + "File '/node_modules/bar/index.d.ts' exist - use it as a name resolution result.", + "======== Type reference directive 'bar' was successfully resolved to '/node_modules/bar/index.d.ts', primary: false. ========", + "======== Resolving type reference directive 'alpha', containing file '/node_modules/foo/index.d.ts', root directory not set. ========", + "Root directory cannot be determined, skipping primary search paths.", + "Looking up in 'node_modules' folder, initial location '/node_modules/foo'", + "File '/node_modules/foo/node_modules/alpha.ts' does not exist.", + "File '/node_modules/foo/node_modules/alpha.d.ts' does not exist.", + "File '/node_modules/foo/node_modules/alpha/package.json' does not exist.", + "File '/node_modules/foo/node_modules/alpha/index.ts' does not exist.", + "File '/node_modules/foo/node_modules/alpha/index.d.ts' exist - use it as a name resolution result.", + "======== Type reference directive 'alpha' was successfully resolved to '/node_modules/foo/node_modules/alpha/index.d.ts', primary: false. ========", + "======== Resolving type reference directive 'alpha', containing file '/node_modules/bar/index.d.ts', root directory not set. ========", + "Root directory cannot be determined, skipping primary search paths.", + "Looking up in 'node_modules' folder, initial location '/node_modules/bar'", + "File '/node_modules/bar/node_modules/alpha.ts' does not exist.", + "File '/node_modules/bar/node_modules/alpha.d.ts' does not exist.", + "File '/node_modules/bar/node_modules/alpha/package.json' does not exist.", + "File '/node_modules/bar/node_modules/alpha/index.ts' does not exist.", + "File '/node_modules/bar/node_modules/alpha/index.d.ts' exist - use it as a name resolution result.", + "======== Type reference directive 'alpha' was successfully resolved to '/node_modules/bar/node_modules/alpha/index.d.ts', primary: false. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/library-reference-6.js b/tests/baselines/reference/library-reference-6.js new file mode 100644 index 00000000000..d78a3a131a1 --- /dev/null +++ b/tests/baselines/reference/library-reference-6.js @@ -0,0 +1,16 @@ +//// [tests/cases/conformance/references/library-reference-6.ts] //// + +//// [index.d.ts] + +// The primary lookup folder is relative to tsconfig.json, if present + +declare var alpha: { a: string }; + +//// [foo.ts] +/// +var x: string = alpha.a; + + +//// [foo.js] +/// +var x = alpha.a; diff --git a/tests/baselines/reference/library-reference-6.symbols b/tests/baselines/reference/library-reference-6.symbols new file mode 100644 index 00000000000..328842f804c --- /dev/null +++ b/tests/baselines/reference/library-reference-6.symbols @@ -0,0 +1,16 @@ +=== /src/foo.ts === +/// +var x: string = alpha.a; +>x : Symbol(x, Decl(foo.ts, 1, 3)) +>alpha.a : Symbol(a, Decl(index.d.ts, 3, 20)) +>alpha : Symbol(alpha, Decl(index.d.ts, 3, 11)) +>a : Symbol(a, Decl(index.d.ts, 3, 20)) + +=== /types/alpha/index.d.ts === + +// The primary lookup folder is relative to tsconfig.json, if present + +declare var alpha: { a: string }; +>alpha : Symbol(alpha, Decl(index.d.ts, 3, 11)) +>a : Symbol(a, Decl(index.d.ts, 3, 20)) + diff --git a/tests/baselines/reference/library-reference-6.trace.json b/tests/baselines/reference/library-reference-6.trace.json new file mode 100644 index 00000000000..426214fdcfc --- /dev/null +++ b/tests/baselines/reference/library-reference-6.trace.json @@ -0,0 +1,7 @@ +[ + "======== Resolving type reference directive 'alpha', containing file '/src/foo.ts', root directory '/'. ========", + "Resolving with primary search path '/types/'", + "File '/types/alpha/package.json' does not exist.", + "File '/types/alpha/index.d.ts' exist - use it as a name resolution result.", + "======== Type reference directive 'alpha' was successfully resolved to '/types/alpha/index.d.ts', primary: true. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/library-reference-6.types b/tests/baselines/reference/library-reference-6.types new file mode 100644 index 00000000000..2f6c1e49b89 --- /dev/null +++ b/tests/baselines/reference/library-reference-6.types @@ -0,0 +1,16 @@ +=== /src/foo.ts === +/// +var x: string = alpha.a; +>x : string +>alpha.a : string +>alpha : { a: string; } +>a : string + +=== /types/alpha/index.d.ts === + +// The primary lookup folder is relative to tsconfig.json, if present + +declare var alpha: { a: string }; +>alpha : { a: string; } +>a : string + diff --git a/tests/baselines/reference/library-reference-7.js b/tests/baselines/reference/library-reference-7.js new file mode 100644 index 00000000000..f1ef6ca4eab --- /dev/null +++ b/tests/baselines/reference/library-reference-7.js @@ -0,0 +1,16 @@ +//// [tests/cases/conformance/references/library-reference-7.ts] //// + +//// [index.d.ts] + +// Secondary references are possible + +declare var $: { foo(): void }; + +//// [consumer.ts] +/// +$.foo(); + + +//// [consumer.js] +/// +$.foo(); diff --git a/tests/baselines/reference/library-reference-7.symbols b/tests/baselines/reference/library-reference-7.symbols new file mode 100644 index 00000000000..a1785fd77c9 --- /dev/null +++ b/tests/baselines/reference/library-reference-7.symbols @@ -0,0 +1,15 @@ +=== /src/consumer.ts === +/// +$.foo(); +>$.foo : Symbol(foo, Decl(index.d.ts, 3, 16)) +>$ : Symbol($, Decl(index.d.ts, 3, 11)) +>foo : Symbol(foo, Decl(index.d.ts, 3, 16)) + +=== /src/node_modules/jquery/index.d.ts === + +// Secondary references are possible + +declare var $: { foo(): void }; +>$ : Symbol($, Decl(index.d.ts, 3, 11)) +>foo : Symbol(foo, Decl(index.d.ts, 3, 16)) + diff --git a/tests/baselines/reference/library-reference-7.trace.json b/tests/baselines/reference/library-reference-7.trace.json new file mode 100644 index 00000000000..419fe6d055d --- /dev/null +++ b/tests/baselines/reference/library-reference-7.trace.json @@ -0,0 +1,11 @@ +[ + "======== Resolving type reference directive 'jquery', containing file '/src/consumer.ts', root directory not set. ========", + "Root directory cannot be determined, skipping primary search paths.", + "Looking up in 'node_modules' folder, initial location '/src'", + "File '/src/node_modules/jquery.ts' does not exist.", + "File '/src/node_modules/jquery.d.ts' does not exist.", + "File '/src/node_modules/jquery/package.json' does not exist.", + "File '/src/node_modules/jquery/index.ts' does not exist.", + "File '/src/node_modules/jquery/index.d.ts' exist - use it as a name resolution result.", + "======== Type reference directive 'jquery' was successfully resolved to '/src/node_modules/jquery/index.d.ts', primary: false. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/library-reference-7.types b/tests/baselines/reference/library-reference-7.types new file mode 100644 index 00000000000..ed7da59525f --- /dev/null +++ b/tests/baselines/reference/library-reference-7.types @@ -0,0 +1,16 @@ +=== /src/consumer.ts === +/// +$.foo(); +>$.foo() : void +>$.foo : () => void +>$ : { foo(): void; } +>foo : () => void + +=== /src/node_modules/jquery/index.d.ts === + +// Secondary references are possible + +declare var $: { foo(): void }; +>$ : { foo(): void; } +>foo : () => void + diff --git a/tests/baselines/reference/library-reference-8.js b/tests/baselines/reference/library-reference-8.js new file mode 100644 index 00000000000..a48b226cb62 --- /dev/null +++ b/tests/baselines/reference/library-reference-8.js @@ -0,0 +1,24 @@ +//// [tests/cases/conformance/references/library-reference-8.ts] //// + +//// [index.d.ts] + +// Don't crash in circular library reference situations + +/// +declare var alpha: { a: string }; + +//// [index.d.ts] +/// +declare var beta: { b: string }; + +//// [foo.ts] +/// +/// +var x: string = alpha.a + beta.b; + + + +//// [foo.js] +/// +/// +var x = alpha.a + beta.b; diff --git a/tests/baselines/reference/library-reference-8.symbols b/tests/baselines/reference/library-reference-8.symbols new file mode 100644 index 00000000000..299a60f1b1d --- /dev/null +++ b/tests/baselines/reference/library-reference-8.symbols @@ -0,0 +1,28 @@ +=== /foo.ts === +/// +/// +var x: string = alpha.a + beta.b; +>x : Symbol(x, Decl(foo.ts, 2, 3)) +>alpha.a : Symbol(a, Decl(index.d.ts, 4, 20)) +>alpha : Symbol(alpha, Decl(index.d.ts, 4, 11)) +>a : Symbol(a, Decl(index.d.ts, 4, 20)) +>beta.b : Symbol(b, Decl(index.d.ts, 1, 19)) +>beta : Symbol(beta, Decl(index.d.ts, 1, 11)) +>b : Symbol(b, Decl(index.d.ts, 1, 19)) + + +=== /types/alpha/index.d.ts === + +// Don't crash in circular library reference situations + +/// +declare var alpha: { a: string }; +>alpha : Symbol(alpha, Decl(index.d.ts, 4, 11)) +>a : Symbol(a, Decl(index.d.ts, 4, 20)) + +=== /types/beta/index.d.ts === +/// +declare var beta: { b: string }; +>beta : Symbol(beta, Decl(index.d.ts, 1, 11)) +>b : Symbol(b, Decl(index.d.ts, 1, 19)) + diff --git a/tests/baselines/reference/library-reference-8.trace.json b/tests/baselines/reference/library-reference-8.trace.json new file mode 100644 index 00000000000..b1dc6478688 --- /dev/null +++ b/tests/baselines/reference/library-reference-8.trace.json @@ -0,0 +1,22 @@ +[ + "======== Resolving type reference directive 'alpha', containing file '/foo.ts', root directory '/'. ========", + "Resolving with primary search path '/types/'", + "File '/types/alpha/package.json' does not exist.", + "File '/types/alpha/index.d.ts' exist - use it as a name resolution result.", + "======== Type reference directive 'alpha' was successfully resolved to '/types/alpha/index.d.ts', primary: true. ========", + "======== Resolving type reference directive 'beta', containing file '/foo.ts', root directory '/'. ========", + "Resolving with primary search path '/types/'", + "File '/types/beta/package.json' does not exist.", + "File '/types/beta/index.d.ts' exist - use it as a name resolution result.", + "======== Type reference directive 'beta' was successfully resolved to '/types/beta/index.d.ts', primary: true. ========", + "======== Resolving type reference directive 'beta', containing file '/types/alpha/index.d.ts', root directory '/'. ========", + "Resolving with primary search path '/types/'", + "File '/types/beta/package.json' does not exist.", + "File '/types/beta/index.d.ts' exist - use it as a name resolution result.", + "======== Type reference directive 'beta' was successfully resolved to '/types/beta/index.d.ts', primary: true. ========", + "======== Resolving type reference directive 'alpha', containing file '/types/beta/index.d.ts', root directory '/'. ========", + "Resolving with primary search path '/types/'", + "File '/types/alpha/package.json' does not exist.", + "File '/types/alpha/index.d.ts' exist - use it as a name resolution result.", + "======== Type reference directive 'alpha' was successfully resolved to '/types/alpha/index.d.ts', primary: true. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/library-reference-8.types b/tests/baselines/reference/library-reference-8.types new file mode 100644 index 00000000000..b0780d90f63 --- /dev/null +++ b/tests/baselines/reference/library-reference-8.types @@ -0,0 +1,29 @@ +=== /foo.ts === +/// +/// +var x: string = alpha.a + beta.b; +>x : string +>alpha.a + beta.b : string +>alpha.a : string +>alpha : { a: string; } +>a : string +>beta.b : string +>beta : { b: string; } +>b : string + + +=== /types/alpha/index.d.ts === + +// Don't crash in circular library reference situations + +/// +declare var alpha: { a: string }; +>alpha : { a: string; } +>a : string + +=== /types/beta/index.d.ts === +/// +declare var beta: { b: string }; +>beta : { b: string; } +>b : string + diff --git a/tests/baselines/reference/library-reference-9.js b/tests/baselines/reference/library-reference-9.js new file mode 100644 index 00000000000..ccb3b3213a9 --- /dev/null +++ b/tests/baselines/reference/library-reference-9.js @@ -0,0 +1,16 @@ +//// [tests/cases/conformance/references/library-reference-9.ts] //// + +//// [index.d.ts] + +// Use types search path + +declare var alpha: { a: string }; + +//// [foo.ts] +/// +var x: string = alpha.a; + + +//// [foo.js] +/// +var x = alpha.a; diff --git a/tests/baselines/reference/library-reference-9.symbols b/tests/baselines/reference/library-reference-9.symbols new file mode 100644 index 00000000000..62cde2117df --- /dev/null +++ b/tests/baselines/reference/library-reference-9.symbols @@ -0,0 +1,16 @@ +=== /base/src/foo.ts === +/// +var x: string = alpha.a; +>x : Symbol(x, Decl(foo.ts, 1, 3)) +>alpha.a : Symbol(a, Decl(index.d.ts, 3, 20)) +>alpha : Symbol(alpha, Decl(index.d.ts, 3, 11)) +>a : Symbol(a, Decl(index.d.ts, 3, 20)) + +=== /share/typelib/alpha/index.d.ts === + +// Use types search path + +declare var alpha: { a: string }; +>alpha : Symbol(alpha, Decl(index.d.ts, 3, 11)) +>a : Symbol(a, Decl(index.d.ts, 3, 20)) + diff --git a/tests/baselines/reference/library-reference-9.trace.json b/tests/baselines/reference/library-reference-9.trace.json new file mode 100644 index 00000000000..e2fdfdc0550 --- /dev/null +++ b/tests/baselines/reference/library-reference-9.trace.json @@ -0,0 +1,7 @@ +[ + "======== Resolving type reference directive 'alpha', containing file '/base/src/foo.ts', root directory '/'. ========", + "Resolving with primary search path '/share/typelib'", + "File '/share/typelib/alpha/package.json' does not exist.", + "File '/share/typelib/alpha/index.d.ts' exist - use it as a name resolution result.", + "======== Type reference directive 'alpha' was successfully resolved to '/share/typelib/alpha/index.d.ts', primary: true. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/library-reference-9.types b/tests/baselines/reference/library-reference-9.types new file mode 100644 index 00000000000..8df2179e249 --- /dev/null +++ b/tests/baselines/reference/library-reference-9.types @@ -0,0 +1,16 @@ +=== /base/src/foo.ts === +/// +var x: string = alpha.a; +>x : string +>alpha.a : string +>alpha : { a: string; } +>a : string + +=== /share/typelib/alpha/index.d.ts === + +// Use types search path + +declare var alpha: { a: string }; +>alpha : { a: string; } +>a : string + diff --git a/tests/baselines/reference/library_DatePrototypeProperties.symbols b/tests/baselines/reference/library_DatePrototypeProperties.symbols index 8aa5f81f2f5..4601adcde18 100644 --- a/tests/baselines/reference/library_DatePrototypeProperties.symbols +++ b/tests/baselines/reference/library_DatePrototypeProperties.symbols @@ -4,308 +4,308 @@ Date.prototype.constructor; >Date.prototype.constructor : Symbol(Object.constructor, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >constructor : Symbol(Object.constructor, Decl(lib.d.ts, --, --)) Date.prototype.toString(); >Date.prototype.toString : Symbol(Date.toString, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >toString : Symbol(Date.toString, Decl(lib.d.ts, --, --)) Date.prototype.toDateString(); >Date.prototype.toDateString : Symbol(Date.toDateString, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >toDateString : Symbol(Date.toDateString, Decl(lib.d.ts, --, --)) Date.prototype.toTimeString(); >Date.prototype.toTimeString : Symbol(Date.toTimeString, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >toTimeString : Symbol(Date.toTimeString, Decl(lib.d.ts, --, --)) Date.prototype.toLocaleString(); ->Date.prototype.toLocaleString : Symbol(Date.toLocaleString, Decl(lib.d.ts, --, --)) +>Date.prototype.toLocaleString : Symbol(Date.toLocaleString, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->toLocaleString : Symbol(Date.toLocaleString, Decl(lib.d.ts, --, --)) +>toLocaleString : Symbol(Date.toLocaleString, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) Date.prototype.toLocaleDateString(); ->Date.prototype.toLocaleDateString : Symbol(Date.toLocaleDateString, Decl(lib.d.ts, --, --)) +>Date.prototype.toLocaleDateString : Symbol(Date.toLocaleDateString, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->toLocaleDateString : Symbol(Date.toLocaleDateString, Decl(lib.d.ts, --, --)) +>toLocaleDateString : Symbol(Date.toLocaleDateString, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) Date.prototype.toLocaleTimeString(); ->Date.prototype.toLocaleTimeString : Symbol(Date.toLocaleTimeString, Decl(lib.d.ts, --, --)) +>Date.prototype.toLocaleTimeString : Symbol(Date.toLocaleTimeString, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->toLocaleTimeString : Symbol(Date.toLocaleTimeString, Decl(lib.d.ts, --, --)) +>toLocaleTimeString : Symbol(Date.toLocaleTimeString, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) Date.prototype.valueOf(); >Date.prototype.valueOf : Symbol(Date.valueOf, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >valueOf : Symbol(Date.valueOf, Decl(lib.d.ts, --, --)) Date.prototype.getTime(); >Date.prototype.getTime : Symbol(Date.getTime, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >getTime : Symbol(Date.getTime, Decl(lib.d.ts, --, --)) Date.prototype.getFullYear(); >Date.prototype.getFullYear : Symbol(Date.getFullYear, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >getFullYear : Symbol(Date.getFullYear, Decl(lib.d.ts, --, --)) Date.prototype.getUTCFullYear(); >Date.prototype.getUTCFullYear : Symbol(Date.getUTCFullYear, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >getUTCFullYear : Symbol(Date.getUTCFullYear, Decl(lib.d.ts, --, --)) Date.prototype.getMonth(); >Date.prototype.getMonth : Symbol(Date.getMonth, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >getMonth : Symbol(Date.getMonth, Decl(lib.d.ts, --, --)) Date.prototype.getUTCMonth(); >Date.prototype.getUTCMonth : Symbol(Date.getUTCMonth, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >getUTCMonth : Symbol(Date.getUTCMonth, Decl(lib.d.ts, --, --)) Date.prototype.getDate(); >Date.prototype.getDate : Symbol(Date.getDate, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >getDate : Symbol(Date.getDate, Decl(lib.d.ts, --, --)) Date.prototype.getUTCDate(); >Date.prototype.getUTCDate : Symbol(Date.getUTCDate, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >getUTCDate : Symbol(Date.getUTCDate, Decl(lib.d.ts, --, --)) Date.prototype.getDay(); >Date.prototype.getDay : Symbol(Date.getDay, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >getDay : Symbol(Date.getDay, Decl(lib.d.ts, --, --)) Date.prototype.getUTCDay(); >Date.prototype.getUTCDay : Symbol(Date.getUTCDay, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >getUTCDay : Symbol(Date.getUTCDay, Decl(lib.d.ts, --, --)) Date.prototype.getHours(); >Date.prototype.getHours : Symbol(Date.getHours, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >getHours : Symbol(Date.getHours, Decl(lib.d.ts, --, --)) Date.prototype.getUTCHours(); >Date.prototype.getUTCHours : Symbol(Date.getUTCHours, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >getUTCHours : Symbol(Date.getUTCHours, Decl(lib.d.ts, --, --)) Date.prototype.getMinutes(); >Date.prototype.getMinutes : Symbol(Date.getMinutes, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >getMinutes : Symbol(Date.getMinutes, Decl(lib.d.ts, --, --)) Date.prototype.getUTCMinutes(); >Date.prototype.getUTCMinutes : Symbol(Date.getUTCMinutes, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >getUTCMinutes : Symbol(Date.getUTCMinutes, Decl(lib.d.ts, --, --)) Date.prototype.getSeconds(); >Date.prototype.getSeconds : Symbol(Date.getSeconds, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >getSeconds : Symbol(Date.getSeconds, Decl(lib.d.ts, --, --)) Date.prototype.getUTCSeconds(); >Date.prototype.getUTCSeconds : Symbol(Date.getUTCSeconds, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >getUTCSeconds : Symbol(Date.getUTCSeconds, Decl(lib.d.ts, --, --)) Date.prototype.getMilliseconds(); >Date.prototype.getMilliseconds : Symbol(Date.getMilliseconds, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >getMilliseconds : Symbol(Date.getMilliseconds, Decl(lib.d.ts, --, --)) Date.prototype.getUTCMilliseconds(); >Date.prototype.getUTCMilliseconds : Symbol(Date.getUTCMilliseconds, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >getUTCMilliseconds : Symbol(Date.getUTCMilliseconds, Decl(lib.d.ts, --, --)) Date.prototype.getTimezoneOffset(); >Date.prototype.getTimezoneOffset : Symbol(Date.getTimezoneOffset, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >getTimezoneOffset : Symbol(Date.getTimezoneOffset, Decl(lib.d.ts, --, --)) Date.prototype.setTime(0); >Date.prototype.setTime : Symbol(Date.setTime, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >setTime : Symbol(Date.setTime, Decl(lib.d.ts, --, --)) Date.prototype.setMilliseconds(0); >Date.prototype.setMilliseconds : Symbol(Date.setMilliseconds, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >setMilliseconds : Symbol(Date.setMilliseconds, Decl(lib.d.ts, --, --)) Date.prototype.setUTCMilliseconds(0); >Date.prototype.setUTCMilliseconds : Symbol(Date.setUTCMilliseconds, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >setUTCMilliseconds : Symbol(Date.setUTCMilliseconds, Decl(lib.d.ts, --, --)) Date.prototype.setSeconds(0); >Date.prototype.setSeconds : Symbol(Date.setSeconds, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >setSeconds : Symbol(Date.setSeconds, Decl(lib.d.ts, --, --)) Date.prototype.setUTCSeconds(0); >Date.prototype.setUTCSeconds : Symbol(Date.setUTCSeconds, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >setUTCSeconds : Symbol(Date.setUTCSeconds, Decl(lib.d.ts, --, --)) Date.prototype.setMinutes(0); >Date.prototype.setMinutes : Symbol(Date.setMinutes, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >setMinutes : Symbol(Date.setMinutes, Decl(lib.d.ts, --, --)) Date.prototype.setUTCMinutes(0); >Date.prototype.setUTCMinutes : Symbol(Date.setUTCMinutes, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >setUTCMinutes : Symbol(Date.setUTCMinutes, Decl(lib.d.ts, --, --)) Date.prototype.setHours(0); >Date.prototype.setHours : Symbol(Date.setHours, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >setHours : Symbol(Date.setHours, Decl(lib.d.ts, --, --)) Date.prototype.setUTCHours(0); >Date.prototype.setUTCHours : Symbol(Date.setUTCHours, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >setUTCHours : Symbol(Date.setUTCHours, Decl(lib.d.ts, --, --)) Date.prototype.setDate(0); >Date.prototype.setDate : Symbol(Date.setDate, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >setDate : Symbol(Date.setDate, Decl(lib.d.ts, --, --)) Date.prototype.setUTCDate(0); >Date.prototype.setUTCDate : Symbol(Date.setUTCDate, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >setUTCDate : Symbol(Date.setUTCDate, Decl(lib.d.ts, --, --)) Date.prototype.setMonth(0); >Date.prototype.setMonth : Symbol(Date.setMonth, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >setMonth : Symbol(Date.setMonth, Decl(lib.d.ts, --, --)) Date.prototype.setUTCMonth(0); >Date.prototype.setUTCMonth : Symbol(Date.setUTCMonth, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >setUTCMonth : Symbol(Date.setUTCMonth, Decl(lib.d.ts, --, --)) Date.prototype.setFullYear(0); >Date.prototype.setFullYear : Symbol(Date.setFullYear, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >setFullYear : Symbol(Date.setFullYear, Decl(lib.d.ts, --, --)) Date.prototype.setUTCFullYear(0); >Date.prototype.setUTCFullYear : Symbol(Date.setUTCFullYear, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >setUTCFullYear : Symbol(Date.setUTCFullYear, Decl(lib.d.ts, --, --)) Date.prototype.toUTCString(); >Date.prototype.toUTCString : Symbol(Date.toUTCString, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >toUTCString : Symbol(Date.toUTCString, Decl(lib.d.ts, --, --)) Date.prototype.toISOString(); >Date.prototype.toISOString : Symbol(Date.toISOString, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >toISOString : Symbol(Date.toISOString, Decl(lib.d.ts, --, --)) Date.prototype.toJSON(null); >Date.prototype.toJSON : Symbol(Date.toJSON, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >toJSON : Symbol(Date.toJSON, Decl(lib.d.ts, --, --)) diff --git a/tests/baselines/reference/library_DatePrototypeProperties.types b/tests/baselines/reference/library_DatePrototypeProperties.types index 79aad91245b..c048b9833d6 100644 --- a/tests/baselines/reference/library_DatePrototypeProperties.types +++ b/tests/baselines/reference/library_DatePrototypeProperties.types @@ -34,27 +34,27 @@ Date.prototype.toTimeString(); Date.prototype.toLocaleString(); >Date.prototype.toLocaleString() : string ->Date.prototype.toLocaleString : () => string +>Date.prototype.toLocaleString : { (): string; (locales?: string[], options?: Intl.DateTimeFormatOptions): string; (locale?: string, options?: Intl.DateTimeFormatOptions): string; } >Date.prototype : Date >Date : DateConstructor >prototype : Date ->toLocaleString : () => string +>toLocaleString : { (): string; (locales?: string[], options?: Intl.DateTimeFormatOptions): string; (locale?: string, options?: Intl.DateTimeFormatOptions): string; } Date.prototype.toLocaleDateString(); >Date.prototype.toLocaleDateString() : string ->Date.prototype.toLocaleDateString : () => string +>Date.prototype.toLocaleDateString : { (): string; (locales?: string[], options?: Intl.DateTimeFormatOptions): string; (locale?: string, options?: Intl.DateTimeFormatOptions): string; } >Date.prototype : Date >Date : DateConstructor >prototype : Date ->toLocaleDateString : () => string +>toLocaleDateString : { (): string; (locales?: string[], options?: Intl.DateTimeFormatOptions): string; (locale?: string, options?: Intl.DateTimeFormatOptions): string; } Date.prototype.toLocaleTimeString(); >Date.prototype.toLocaleTimeString() : string ->Date.prototype.toLocaleTimeString : () => string +>Date.prototype.toLocaleTimeString : { (): string; (locale?: string[], options?: Intl.DateTimeFormatOptions): string; (locale?: string, options?: Intl.DateTimeFormatOptions): string; } >Date.prototype : Date >Date : DateConstructor >prototype : Date ->toLocaleTimeString : () => string +>toLocaleTimeString : { (): string; (locale?: string[], options?: Intl.DateTimeFormatOptions): string; (locale?: string, options?: Intl.DateTimeFormatOptions): string; } Date.prototype.valueOf(); >Date.prototype.valueOf() : number diff --git a/tests/baselines/reference/library_StringSlice.symbols b/tests/baselines/reference/library_StringSlice.symbols index de79b8755ac..bdf661c5ab2 100644 --- a/tests/baselines/reference/library_StringSlice.symbols +++ b/tests/baselines/reference/library_StringSlice.symbols @@ -3,21 +3,21 @@ String.prototype.slice(); >String.prototype.slice : Symbol(String.slice, Decl(lib.d.ts, --, --)) >String.prototype : Symbol(StringConstructor.prototype, Decl(lib.d.ts, --, --)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(StringConstructor.prototype, Decl(lib.d.ts, --, --)) >slice : Symbol(String.slice, Decl(lib.d.ts, --, --)) String.prototype.slice(0); >String.prototype.slice : Symbol(String.slice, Decl(lib.d.ts, --, --)) >String.prototype : Symbol(StringConstructor.prototype, Decl(lib.d.ts, --, --)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(StringConstructor.prototype, Decl(lib.d.ts, --, --)) >slice : Symbol(String.slice, Decl(lib.d.ts, --, --)) String.prototype.slice(0,1); >String.prototype.slice : Symbol(String.slice, Decl(lib.d.ts, --, --)) >String.prototype : Symbol(StringConstructor.prototype, Decl(lib.d.ts, --, --)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(StringConstructor.prototype, Decl(lib.d.ts, --, --)) >slice : Symbol(String.slice, Decl(lib.d.ts, --, --)) diff --git a/tests/baselines/reference/listFailure.symbols b/tests/baselines/reference/listFailure.symbols index 53b1acf09ee..d582c46633e 100644 --- a/tests/baselines/reference/listFailure.symbols +++ b/tests/baselines/reference/listFailure.symbols @@ -6,14 +6,14 @@ module Editor { >Buffer : Symbol(Buffer, Decl(listFailure.ts, 0, 15)) lines: List = ListMakeHead(); ->lines : Symbol(lines, Decl(listFailure.ts, 2, 25)) +>lines : Symbol(Buffer.lines, Decl(listFailure.ts, 2, 25)) >List : Symbol(List, Decl(listFailure.ts, 24, 5)) >Line : Symbol(Line, Decl(listFailure.ts, 37, 5)) >ListMakeHead : Symbol(ListMakeHead, Decl(listFailure.ts, 16, 5)) >Line : Symbol(Line, Decl(listFailure.ts, 37, 5)) addLine(lineText: string): List { ->addLine : Symbol(addLine, Decl(listFailure.ts, 3, 46)) +>addLine : Symbol(Buffer.addLine, Decl(listFailure.ts, 3, 46)) >lineText : Symbol(lineText, Decl(listFailure.ts, 5, 16)) >List : Symbol(List, Decl(listFailure.ts, 24, 5)) >Line : Symbol(Line, Decl(listFailure.ts, 37, 5)) @@ -26,9 +26,9 @@ module Editor { var lineEntry = this.lines.add(line); >lineEntry : Symbol(lineEntry, Decl(listFailure.ts, 8, 15)) >this.lines.add : Symbol(List.add, Decl(listFailure.ts, 27, 29)) ->this.lines : Symbol(lines, Decl(listFailure.ts, 2, 25)) +>this.lines : Symbol(Buffer.lines, Decl(listFailure.ts, 2, 25)) >this : Symbol(Buffer, Decl(listFailure.ts, 0, 15)) ->lines : Symbol(lines, Decl(listFailure.ts, 2, 25)) +>lines : Symbol(Buffer.lines, Decl(listFailure.ts, 2, 25)) >add : Symbol(List.add, Decl(listFailure.ts, 27, 29)) >line : Symbol(line, Decl(listFailure.ts, 7, 15)) @@ -75,32 +75,32 @@ module Editor { >T : Symbol(T, Decl(listFailure.ts, 26, 15)) public next: List; ->next : Symbol(next, Decl(listFailure.ts, 26, 19)) +>next : Symbol(List.next, Decl(listFailure.ts, 26, 19)) >List : Symbol(List, Decl(listFailure.ts, 24, 5)) >T : Symbol(T, Decl(listFailure.ts, 26, 15)) add(data: T): List { ->add : Symbol(add, Decl(listFailure.ts, 27, 29)) +>add : Symbol(List.add, Decl(listFailure.ts, 27, 29)) >data : Symbol(data, Decl(listFailure.ts, 29, 12)) >T : Symbol(T, Decl(listFailure.ts, 26, 15)) >List : Symbol(List, Decl(listFailure.ts, 24, 5)) >T : Symbol(T, Decl(listFailure.ts, 26, 15)) this.next = ListMakeEntry(data); ->this.next : Symbol(next, Decl(listFailure.ts, 26, 19)) +>this.next : Symbol(List.next, Decl(listFailure.ts, 26, 19)) >this : Symbol(List, Decl(listFailure.ts, 24, 5)) ->next : Symbol(next, Decl(listFailure.ts, 26, 19)) +>next : Symbol(List.next, Decl(listFailure.ts, 26, 19)) >ListMakeEntry : Symbol(ListMakeEntry, Decl(listFailure.ts, 20, 5)) >data : Symbol(data, Decl(listFailure.ts, 29, 12)) return this.next; ->this.next : Symbol(next, Decl(listFailure.ts, 26, 19)) +>this.next : Symbol(List.next, Decl(listFailure.ts, 26, 19)) >this : Symbol(List, Decl(listFailure.ts, 24, 5)) ->next : Symbol(next, Decl(listFailure.ts, 26, 19)) +>next : Symbol(List.next, Decl(listFailure.ts, 26, 19)) } popEntry(head: List): List { ->popEntry : Symbol(popEntry, Decl(listFailure.ts, 32, 9)) +>popEntry : Symbol(List.popEntry, Decl(listFailure.ts, 32, 9)) >head : Symbol(head, Decl(listFailure.ts, 34, 17)) >List : Symbol(List, Decl(listFailure.ts, 24, 5)) >T : Symbol(T, Decl(listFailure.ts, 26, 15)) @@ -109,9 +109,9 @@ module Editor { return (ListRemoveEntry(this.next)); >ListRemoveEntry : Symbol(ListRemoveEntry, Decl(listFailure.ts, 12, 5)) ->this.next : Symbol(next, Decl(listFailure.ts, 26, 19)) +>this.next : Symbol(List.next, Decl(listFailure.ts, 26, 19)) >this : Symbol(List, Decl(listFailure.ts, 24, 5)) ->next : Symbol(next, Decl(listFailure.ts, 26, 19)) +>next : Symbol(List.next, Decl(listFailure.ts, 26, 19)) } } diff --git a/tests/baselines/reference/literals-negative.errors.txt b/tests/baselines/reference/literals-negative.errors.txt index d783e5dfa02..2024066d9f2 100644 --- a/tests/baselines/reference/literals-negative.errors.txt +++ b/tests/baselines/reference/literals-negative.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/literals-negative.ts(5,9): error TS2352: Neither type 'number' nor type 'boolean' is assignable to the other. +tests/cases/compiler/literals-negative.ts(5,9): error TS2352: Type 'number' cannot be converted to type 'boolean'. ==== tests/cases/compiler/literals-negative.ts (1 errors) ==== @@ -8,7 +8,7 @@ tests/cases/compiler/literals-negative.ts(5,9): error TS2352: Neither type 'numb var s = (null); var b = (n); ~~~~~~~~~~~~ -!!! error TS2352: Neither type 'number' nor type 'boolean' is assignable to the other. +!!! error TS2352: Type 'number' cannot be converted to type 'boolean'. function isVoid() : void { } diff --git a/tests/baselines/reference/localClassesInLoop_ES6.symbols b/tests/baselines/reference/localClassesInLoop_ES6.symbols index 17e8102ad05..f70373a4d73 100644 --- a/tests/baselines/reference/localClassesInLoop_ES6.symbols +++ b/tests/baselines/reference/localClassesInLoop_ES6.symbols @@ -17,9 +17,9 @@ for (let x = 0; x < 2; ++x) { >C : Symbol(C, Decl(localClassesInLoop_ES6.ts, 5, 29)) data.push(() => C); ->data.push : Symbol(Array.push, Decl(lib.d.ts, --, --)) +>data.push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --)) >data : Symbol(data, Decl(localClassesInLoop_ES6.ts, 4, 3)) ->push : Symbol(Array.push, Decl(lib.d.ts, --, --)) +>push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --)) >C : Symbol(C, Decl(localClassesInLoop_ES6.ts, 5, 29)) } diff --git a/tests/baselines/reference/localTypes1.symbols b/tests/baselines/reference/localTypes1.symbols index 53d4191ae61..3ee47086b26 100644 --- a/tests/baselines/reference/localTypes1.symbols +++ b/tests/baselines/reference/localTypes1.symbols @@ -15,14 +15,14 @@ function f1() { >C : Symbol(C, Decl(localTypes1.ts, 4, 5)) x: E; ->x : Symbol(x, Decl(localTypes1.ts, 5, 13)) +>x : Symbol(C.x, Decl(localTypes1.ts, 5, 13)) >E : Symbol(E, Decl(localTypes1.ts, 1, 15)) } interface I { >I : Symbol(I, Decl(localTypes1.ts, 7, 5)) x: E; ->x : Symbol(x, Decl(localTypes1.ts, 8, 17)) +>x : Symbol(I.x, Decl(localTypes1.ts, 8, 17)) >E : Symbol(E, Decl(localTypes1.ts, 1, 15)) } type A = I[]; @@ -64,14 +64,14 @@ function f2() { >C : Symbol(C, Decl(localTypes1.ts, 21, 9)) x: E; ->x : Symbol(x, Decl(localTypes1.ts, 22, 17)) +>x : Symbol(C.x, Decl(localTypes1.ts, 22, 17)) >E : Symbol(E, Decl(localTypes1.ts, 18, 18)) } interface I { >I : Symbol(I, Decl(localTypes1.ts, 24, 9)) x: E; ->x : Symbol(x, Decl(localTypes1.ts, 25, 21)) +>x : Symbol(I.x, Decl(localTypes1.ts, 25, 21)) >E : Symbol(E, Decl(localTypes1.ts, 18, 18)) } type A = I[]; @@ -118,14 +118,14 @@ function f3(b: boolean) { >C : Symbol(C, Decl(localTypes1.ts, 41, 16)) x: E; ->x : Symbol(x, Decl(localTypes1.ts, 42, 21)) +>x : Symbol(C.x, Decl(localTypes1.ts, 42, 21)) >E : Symbol(E, Decl(localTypes1.ts, 37, 15)) } interface I { >I : Symbol(I, Decl(localTypes1.ts, 44, 13)) x: E; ->x : Symbol(x, Decl(localTypes1.ts, 45, 25)) +>x : Symbol(I.x, Decl(localTypes1.ts, 45, 25)) >E : Symbol(E, Decl(localTypes1.ts, 37, 15)) } type A = I[]; @@ -153,14 +153,14 @@ function f3(b: boolean) { >A : Symbol(A, Decl(localTypes1.ts, 53, 14)) x: E; ->x : Symbol(x, Decl(localTypes1.ts, 54, 21)) +>x : Symbol(A.x, Decl(localTypes1.ts, 54, 21)) >E : Symbol(E, Decl(localTypes1.ts, 37, 15)) } interface J { >J : Symbol(J, Decl(localTypes1.ts, 56, 13)) x: E; ->x : Symbol(x, Decl(localTypes1.ts, 57, 25)) +>x : Symbol(J.x, Decl(localTypes1.ts, 57, 25)) >E : Symbol(E, Decl(localTypes1.ts, 37, 15)) } type C = J[]; @@ -204,7 +204,7 @@ function f5() { >C : Symbol(C, Decl(localTypes1.ts, 72, 9)) x: E; ->x : Symbol(x, Decl(localTypes1.ts, 73, 17)) +>x : Symbol(C.x, Decl(localTypes1.ts, 73, 17)) >E : Symbol(E, Decl(localTypes1.ts, 69, 26)) } return new C(); @@ -225,7 +225,7 @@ function f5() { >C : Symbol(C, Decl(localTypes1.ts, 81, 9)) x: E; ->x : Symbol(x, Decl(localTypes1.ts, 82, 17)) +>x : Symbol(C.x, Decl(localTypes1.ts, 82, 17)) >E : Symbol(E, Decl(localTypes1.ts, 78, 20)) } return new C(); @@ -249,12 +249,12 @@ class A { >C : Symbol(C, Decl(localTypes1.ts, 93, 9)) x: E; ->x : Symbol(x, Decl(localTypes1.ts, 94, 17)) +>x : Symbol(C.x, Decl(localTypes1.ts, 94, 17)) >E : Symbol(E, Decl(localTypes1.ts, 90, 19)) } } m() { ->m : Symbol(m, Decl(localTypes1.ts, 97, 5)) +>m : Symbol(A.m, Decl(localTypes1.ts, 97, 5)) enum E { >E : Symbol(E, Decl(localTypes1.ts, 98, 9)) @@ -268,14 +268,14 @@ class A { >C : Symbol(C, Decl(localTypes1.ts, 101, 9)) x: E; ->x : Symbol(x, Decl(localTypes1.ts, 102, 17)) +>x : Symbol(C.x, Decl(localTypes1.ts, 102, 17)) >E : Symbol(E, Decl(localTypes1.ts, 98, 9)) } return new C(); >C : Symbol(C, Decl(localTypes1.ts, 101, 9)) } get p() { ->p : Symbol(p, Decl(localTypes1.ts, 106, 5)) +>p : Symbol(A.p, Decl(localTypes1.ts, 106, 5)) enum E { >E : Symbol(E, Decl(localTypes1.ts, 107, 13)) @@ -289,7 +289,7 @@ class A { >C : Symbol(C, Decl(localTypes1.ts, 110, 9)) x: E; ->x : Symbol(x, Decl(localTypes1.ts, 111, 17)) +>x : Symbol(C.x, Decl(localTypes1.ts, 111, 17)) >E : Symbol(E, Decl(localTypes1.ts, 107, 13)) } return new C(); @@ -304,7 +304,7 @@ function f6() { >A : Symbol(A, Decl(localTypes1.ts, 118, 15)) a: string; ->a : Symbol(a, Decl(localTypes1.ts, 119, 13)) +>a : Symbol(A.a, Decl(localTypes1.ts, 119, 13)) } function g() { >g : Symbol(g, Decl(localTypes1.ts, 121, 5)) @@ -314,7 +314,7 @@ function f6() { >A : Symbol(A, Decl(localTypes1.ts, 118, 15)) b: string; ->b : Symbol(b, Decl(localTypes1.ts, 123, 27)) +>b : Symbol(B.b, Decl(localTypes1.ts, 123, 27)) } function h() { >h : Symbol(h, Decl(localTypes1.ts, 125, 9)) @@ -324,7 +324,7 @@ function f6() { >B : Symbol(B, Decl(localTypes1.ts, 122, 18)) c: string; ->c : Symbol(c, Decl(localTypes1.ts, 127, 31)) +>c : Symbol(C.c, Decl(localTypes1.ts, 127, 31)) } var x = new C(); >x : Symbol(x, Decl(localTypes1.ts, 130, 15)) diff --git a/tests/baselines/reference/localTypes2.symbols b/tests/baselines/reference/localTypes2.symbols index 3054c6f552d..52ff438f049 100644 --- a/tests/baselines/reference/localTypes2.symbols +++ b/tests/baselines/reference/localTypes2.symbols @@ -9,8 +9,8 @@ function f1() { >C : Symbol(C, Decl(localTypes2.ts, 1, 18)) constructor(public x: number, public y: number) { } ->x : Symbol(x, Decl(localTypes2.ts, 3, 24)) ->y : Symbol(y, Decl(localTypes2.ts, 3, 41)) +>x : Symbol(C.x, Decl(localTypes2.ts, 3, 24)) +>y : Symbol(C.y, Decl(localTypes2.ts, 3, 41)) } return C; >C : Symbol(C, Decl(localTypes2.ts, 1, 18)) @@ -47,11 +47,11 @@ function f2() { >C : Symbol(C, Decl(localTypes2.ts, 14, 27)) public x = x; ->x : Symbol(x, Decl(localTypes2.ts, 15, 17)) +>x : Symbol(C.x, Decl(localTypes2.ts, 15, 17)) >x : Symbol(x, Decl(localTypes2.ts, 14, 15)) constructor(public y: number) { } ->y : Symbol(y, Decl(localTypes2.ts, 17, 24)) +>y : Symbol(C.y, Decl(localTypes2.ts, 17, 24)) } return C; >C : Symbol(C, Decl(localTypes2.ts, 14, 27)) @@ -89,11 +89,11 @@ function f3() { >C : Symbol(C, Decl(localTypes2.ts, 28, 38)) public x = x; ->x : Symbol(x, Decl(localTypes2.ts, 29, 17)) +>x : Symbol(C.x, Decl(localTypes2.ts, 29, 17)) >x : Symbol(x, Decl(localTypes2.ts, 28, 15)) public y = y; ->y : Symbol(y, Decl(localTypes2.ts, 30, 25)) +>y : Symbol(C.y, Decl(localTypes2.ts, 30, 25)) >y : Symbol(y, Decl(localTypes2.ts, 28, 25)) } return C; diff --git a/tests/baselines/reference/localTypes3.symbols b/tests/baselines/reference/localTypes3.symbols index fe7082e4577..c10b463d697 100644 --- a/tests/baselines/reference/localTypes3.symbols +++ b/tests/baselines/reference/localTypes3.symbols @@ -11,9 +11,9 @@ function f1() { >Y : Symbol(Y, Decl(localTypes3.ts, 2, 18)) constructor(public x: X, public y: Y) { } ->x : Symbol(x, Decl(localTypes3.ts, 3, 24)) +>x : Symbol(C.x, Decl(localTypes3.ts, 3, 24)) >X : Symbol(X, Decl(localTypes3.ts, 2, 16)) ->y : Symbol(y, Decl(localTypes3.ts, 3, 36)) +>y : Symbol(C.y, Decl(localTypes3.ts, 3, 36)) >Y : Symbol(Y, Decl(localTypes3.ts, 2, 18)) } return C; @@ -54,11 +54,11 @@ function f2() { >Y : Symbol(Y, Decl(localTypes3.ts, 15, 16)) public x = x; ->x : Symbol(x, Decl(localTypes3.ts, 15, 20)) +>x : Symbol(C.x, Decl(localTypes3.ts, 15, 20)) >x : Symbol(x, Decl(localTypes3.ts, 14, 18)) constructor(public y: Y) { } ->y : Symbol(y, Decl(localTypes3.ts, 17, 24)) +>y : Symbol(C.y, Decl(localTypes3.ts, 17, 24)) >Y : Symbol(Y, Decl(localTypes3.ts, 15, 16)) } return C; @@ -101,11 +101,11 @@ function f3() { >C : Symbol(C, Decl(localTypes3.ts, 28, 34)) public x = x; ->x : Symbol(x, Decl(localTypes3.ts, 29, 17)) +>x : Symbol(C.x, Decl(localTypes3.ts, 29, 17)) >x : Symbol(x, Decl(localTypes3.ts, 28, 21)) public y = y; ->y : Symbol(y, Decl(localTypes3.ts, 30, 25)) +>y : Symbol(C.y, Decl(localTypes3.ts, 30, 25)) >y : Symbol(y, Decl(localTypes3.ts, 28, 26)) } return C; diff --git a/tests/baselines/reference/localTypes5.symbols b/tests/baselines/reference/localTypes5.symbols index 41851a617de..175469e7a72 100644 --- a/tests/baselines/reference/localTypes5.symbols +++ b/tests/baselines/reference/localTypes5.symbols @@ -7,7 +7,7 @@ function foo() { >X : Symbol(X, Decl(localTypes5.ts, 0, 19)) m() { ->m : Symbol(m, Decl(localTypes5.ts, 1, 13)) +>m : Symbol(X.m, Decl(localTypes5.ts, 1, 13)) >B : Symbol(B, Decl(localTypes5.ts, 2, 10)) >C : Symbol(C, Decl(localTypes5.ts, 2, 12)) @@ -22,7 +22,7 @@ function foo() { >Y : Symbol(Y, Decl(localTypes5.ts, 3, 36)) })(); ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) } } var x = new X(); diff --git a/tests/baselines/reference/logicalAndOperatorWithEveryType.types b/tests/baselines/reference/logicalAndOperatorWithEveryType.types index bd913e94da5..b2628eed921 100644 --- a/tests/baselines/reference/logicalAndOperatorWithEveryType.types +++ b/tests/baselines/reference/logicalAndOperatorWithEveryType.types @@ -623,7 +623,7 @@ var rj8 = a8 && undefined; var rj9 = null && undefined; >rj9 : any ->null && undefined : undefined +>null && undefined : null >null : null >undefined : undefined diff --git a/tests/baselines/reference/logicalNotOperatorInvalidOperations.errors.txt b/tests/baselines/reference/logicalNotOperatorInvalidOperations.errors.txt index 07262962b08..c7d66e17f9d 100644 --- a/tests/baselines/reference/logicalNotOperatorInvalidOperations.errors.txt +++ b/tests/baselines/reference/logicalNotOperatorInvalidOperations.errors.txt @@ -1,19 +1,13 @@ -tests/cases/conformance/expressions/unaryOperators/logicalNotOperator/logicalNotOperatorInvalidOperations.ts(5,17): error TS1005: ',' expected. -tests/cases/conformance/expressions/unaryOperators/logicalNotOperator/logicalNotOperatorInvalidOperations.ts(5,18): error TS1109: Expression expected. tests/cases/conformance/expressions/unaryOperators/logicalNotOperator/logicalNotOperatorInvalidOperations.ts(8,16): error TS2365: Operator '+' cannot be applied to types 'boolean' and 'number'. tests/cases/conformance/expressions/unaryOperators/logicalNotOperator/logicalNotOperatorInvalidOperations.ts(11,16): error TS1109: Expression expected. -==== tests/cases/conformance/expressions/unaryOperators/logicalNotOperator/logicalNotOperatorInvalidOperations.ts (4 errors) ==== +==== tests/cases/conformance/expressions/unaryOperators/logicalNotOperator/logicalNotOperatorInvalidOperations.ts (2 errors) ==== // Unary operator ! var b: number; // operand before ! var BOOLEAN1 = b!; //expect error - ~ -!!! error TS1005: ',' expected. - ~ -!!! error TS1109: Expression expected. // miss parentheses var BOOLEAN2 = !b + b; diff --git a/tests/baselines/reference/logicalNotOperatorInvalidOperations.js b/tests/baselines/reference/logicalNotOperatorInvalidOperations.js index 7b16f2ef36f..0cb941b0e41 100644 --- a/tests/baselines/reference/logicalNotOperatorInvalidOperations.js +++ b/tests/baselines/reference/logicalNotOperatorInvalidOperations.js @@ -15,8 +15,7 @@ var BOOLEAN3 =!; // Unary operator ! var b; // operand before ! -var BOOLEAN1 = b; -!; //expect error +var BOOLEAN1 = b; //expect error // miss parentheses var BOOLEAN2 = !b + b; // miss an operand diff --git a/tests/baselines/reference/logicalNotOperatorWithBooleanType.symbols b/tests/baselines/reference/logicalNotOperatorWithBooleanType.symbols index b42b9d7922e..d94e5d36074 100644 --- a/tests/baselines/reference/logicalNotOperatorWithBooleanType.symbols +++ b/tests/baselines/reference/logicalNotOperatorWithBooleanType.symbols @@ -10,7 +10,7 @@ class A { >A : Symbol(A, Decl(logicalNotOperatorWithBooleanType.ts, 3, 40)) public a: boolean; ->a : Symbol(a, Decl(logicalNotOperatorWithBooleanType.ts, 5, 9)) +>a : Symbol(A.a, Decl(logicalNotOperatorWithBooleanType.ts, 5, 9)) static foo() { return false; } >foo : Symbol(A.foo, Decl(logicalNotOperatorWithBooleanType.ts, 6, 22)) diff --git a/tests/baselines/reference/logicalNotOperatorWithNumberType.symbols b/tests/baselines/reference/logicalNotOperatorWithNumberType.symbols index 4f277a8db54..25fac1015d2 100644 --- a/tests/baselines/reference/logicalNotOperatorWithNumberType.symbols +++ b/tests/baselines/reference/logicalNotOperatorWithNumberType.symbols @@ -13,7 +13,7 @@ class A { >A : Symbol(A, Decl(logicalNotOperatorWithNumberType.ts, 4, 36)) public a: number; ->a : Symbol(a, Decl(logicalNotOperatorWithNumberType.ts, 6, 9)) +>a : Symbol(A.a, Decl(logicalNotOperatorWithNumberType.ts, 6, 9)) static foo() { return 1; } >foo : Symbol(A.foo, Decl(logicalNotOperatorWithNumberType.ts, 7, 21)) diff --git a/tests/baselines/reference/logicalNotOperatorWithStringType.symbols b/tests/baselines/reference/logicalNotOperatorWithStringType.symbols index e91c8b71572..50432fe2333 100644 --- a/tests/baselines/reference/logicalNotOperatorWithStringType.symbols +++ b/tests/baselines/reference/logicalNotOperatorWithStringType.symbols @@ -13,7 +13,7 @@ class A { >A : Symbol(A, Decl(logicalNotOperatorWithStringType.ts, 4, 40)) public a: string; ->a : Symbol(a, Decl(logicalNotOperatorWithStringType.ts, 6, 9)) +>a : Symbol(A.a, Decl(logicalNotOperatorWithStringType.ts, 6, 9)) static foo() { return ""; } >foo : Symbol(A.foo, Decl(logicalNotOperatorWithStringType.ts, 7, 21)) diff --git a/tests/baselines/reference/looseThisTypeInFunctions.errors.txt b/tests/baselines/reference/looseThisTypeInFunctions.errors.txt new file mode 100644 index 00000000000..bf76c9c9641 --- /dev/null +++ b/tests/baselines/reference/looseThisTypeInFunctions.errors.txt @@ -0,0 +1,67 @@ +tests/cases/conformance/types/thisType/looseThisTypeInFunctions.ts(21,1): error TS2322: Type '(this: C, m: number) => number' is not assignable to type '(this: void, m: number) => number'. + The 'this' types of each signature are incompatible. + Type 'void' is not assignable to type 'C'. +tests/cases/conformance/types/thisType/looseThisTypeInFunctions.ts(33,28): error TS2339: Property 'length' does not exist on type 'number'. +tests/cases/conformance/types/thisType/looseThisTypeInFunctions.ts(37,9): error TS2684: The 'this' context of type 'void' is not assignable to method's 'this' of type 'I'. +tests/cases/conformance/types/thisType/looseThisTypeInFunctions.ts(46,20): error TS2339: Property 'length' does not exist on type 'number'. + + +==== tests/cases/conformance/types/thisType/looseThisTypeInFunctions.ts (4 errors) ==== + interface I { + n: number; + explicitThis(this: this, m: number): number; + } + interface Unused { + implicitNoThis(m: number): number; + } + class C implements I { + n: number; + explicitThis(this: this, m: number): number { + return this.n + m; + } + implicitThis(m: number): number { + return this.n + m; + } + explicitVoid(this: void, m: number): number { + return m + 1; + } + } + let c = new C(); + c.explicitVoid = c.explicitThis; // error, 'void' is missing everything + ~~~~~~~~~~~~~~ +!!! error TS2322: Type '(this: C, m: number) => number' is not assignable to type '(this: void, m: number) => number'. +!!! error TS2322: The 'this' types of each signature are incompatible. +!!! error TS2322: Type 'void' is not assignable to type 'C'. + let o = { + n: 101, + explicitThis: function (m: number) { + return m + this.n.length; // error, 'length' does not exist on 'number' + }, + implicitThis(m: number): number { return m; } + }; + let i: I = o; + let o2: I = { + n: 1001, + explicitThis: function (m) { + return m + this.n.length; // error, this.n: number, no member 'length' + ~~~~~~ +!!! error TS2339: Property 'length' does not exist on type 'number'. + }, + } + let x = i.explicitThis; + let n = x(12); // callee:void doesn't match this:I + ~~~~~ +!!! error TS2684: The 'this' context of type 'void' is not assignable to method's 'this' of type 'I'. + let u: Unused; + let y = u.implicitNoThis; + n = y(12); // ok, callee:void matches this:any + c.explicitVoid = c.implicitThis // ok, implicitThis(this:any) + o.implicitThis = c.implicitThis; // ok, implicitThis(this:any) + o.implicitThis = c.explicitThis; // ok, implicitThis(this:any) is assignable to explicitThis(this: this) + o.implicitThis = i.explicitThis; + i.explicitThis = function(m) { + return this.n.length; // error, this.n: number + ~~~~~~ +!!! error TS2339: Property 'length' does not exist on type 'number'. + } + \ No newline at end of file diff --git a/tests/baselines/reference/looseThisTypeInFunctions.js b/tests/baselines/reference/looseThisTypeInFunctions.js new file mode 100644 index 00000000000..cb1fbcc8b95 --- /dev/null +++ b/tests/baselines/reference/looseThisTypeInFunctions.js @@ -0,0 +1,93 @@ +//// [looseThisTypeInFunctions.ts] +interface I { + n: number; + explicitThis(this: this, m: number): number; +} +interface Unused { + implicitNoThis(m: number): number; +} +class C implements I { + n: number; + explicitThis(this: this, m: number): number { + return this.n + m; + } + implicitThis(m: number): number { + return this.n + m; + } + explicitVoid(this: void, m: number): number { + return m + 1; + } +} +let c = new C(); +c.explicitVoid = c.explicitThis; // error, 'void' is missing everything +let o = { + n: 101, + explicitThis: function (m: number) { + return m + this.n.length; // error, 'length' does not exist on 'number' + }, + implicitThis(m: number): number { return m; } +}; +let i: I = o; +let o2: I = { + n: 1001, + explicitThis: function (m) { + return m + this.n.length; // error, this.n: number, no member 'length' + }, +} +let x = i.explicitThis; +let n = x(12); // callee:void doesn't match this:I +let u: Unused; +let y = u.implicitNoThis; +n = y(12); // ok, callee:void matches this:any +c.explicitVoid = c.implicitThis // ok, implicitThis(this:any) +o.implicitThis = c.implicitThis; // ok, implicitThis(this:any) +o.implicitThis = c.explicitThis; // ok, implicitThis(this:any) is assignable to explicitThis(this: this) +o.implicitThis = i.explicitThis; +i.explicitThis = function(m) { + return this.n.length; // error, this.n: number +} + + +//// [looseThisTypeInFunctions.js] +var C = (function () { + function C() { + } + C.prototype.explicitThis = function (m) { + return this.n + m; + }; + C.prototype.implicitThis = function (m) { + return this.n + m; + }; + C.prototype.explicitVoid = function (m) { + return m + 1; + }; + return C; +}()); +var c = new C(); +c.explicitVoid = c.explicitThis; // error, 'void' is missing everything +var o = { + n: 101, + explicitThis: function (m) { + return m + this.n.length; // error, 'length' does not exist on 'number' + }, + implicitThis: function (m) { return m; } +}; +var i = o; +var o2 = { + n: 1001, + explicitThis: function (m) { + return m + this.n.length; // error, this.n: number, no member 'length' + } +}; +var x = i.explicitThis; +var n = x(12); // callee:void doesn't match this:I +var u; +var y = u.implicitNoThis; +n = y(12); // ok, callee:void matches this:any +c.explicitVoid = c.implicitThis; // ok, implicitThis(this:any) +o.implicitThis = c.implicitThis; // ok, implicitThis(this:any) +o.implicitThis = c.explicitThis; // ok, implicitThis(this:any) is assignable to explicitThis(this: this) +o.implicitThis = i.explicitThis; +i.explicitThis = function (m) { + return this.n.length; // error, this.n: number +}; diff --git a/tests/baselines/reference/m7Bugs.symbols b/tests/baselines/reference/m7Bugs.symbols index be6d798a8a5..3dd3ab25102 100644 --- a/tests/baselines/reference/m7Bugs.symbols +++ b/tests/baselines/reference/m7Bugs.symbols @@ -4,7 +4,7 @@ interface ISomething { >ISomething : Symbol(ISomething, Decl(m7Bugs.ts, 0, 0)) something: number; ->something : Symbol(something, Decl(m7Bugs.ts, 1, 22)) +>something : Symbol(ISomething.something, Decl(m7Bugs.ts, 1, 22)) } var s: ISomething = ({ }); @@ -16,7 +16,7 @@ var s: ISomething = ({ }); // scenario 2 interface A { x: string; } >A : Symbol(A, Decl(m7Bugs.ts, 5, 38)) ->x : Symbol(x, Decl(m7Bugs.ts, 9, 13)) +>x : Symbol(A.x, Decl(m7Bugs.ts, 9, 13)) interface B extends A { } >B : Symbol(B, Decl(m7Bugs.ts, 9, 26)) @@ -31,7 +31,7 @@ class C1 { >C1 : Symbol(C1, Decl(m7Bugs.ts, 13, 18)) public x: string; ->x : Symbol(x, Decl(m7Bugs.ts, 15, 10)) +>x : Symbol(C1.x, Decl(m7Bugs.ts, 15, 10)) } class C2 extends C1 {} diff --git a/tests/baselines/reference/malformedTags.js b/tests/baselines/reference/malformedTags.js new file mode 100644 index 00000000000..33b2c1e6f41 --- /dev/null +++ b/tests/baselines/reference/malformedTags.js @@ -0,0 +1,17 @@ +//// [myFile02.js] + +/** + * Checks if `value` is classified as an `Array` object. + * + * @type Function + */ +var isArray = Array.isArray; + + +//// [myFile02.js] +/** + * Checks if `value` is classified as an `Array` object. + * + * @type Function + */ +var isArray = Array.isArray; diff --git a/tests/baselines/reference/malformedTags.symbols b/tests/baselines/reference/malformedTags.symbols new file mode 100644 index 00000000000..df953a82497 --- /dev/null +++ b/tests/baselines/reference/malformedTags.symbols @@ -0,0 +1,13 @@ +=== tests/cases/conformance/salsa/myFile02.js === + +/** + * Checks if `value` is classified as an `Array` object. + * + * @type Function + */ +var isArray = Array.isArray; +>isArray : Symbol(isArray, Decl(myFile02.js, 6, 3)) +>Array.isArray : Symbol(ArrayConstructor.isArray, Decl(lib.d.ts, --, --)) +>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>isArray : Symbol(ArrayConstructor.isArray, Decl(lib.d.ts, --, --)) + diff --git a/tests/baselines/reference/malformedTags.types b/tests/baselines/reference/malformedTags.types new file mode 100644 index 00000000000..acf442f7cba --- /dev/null +++ b/tests/baselines/reference/malformedTags.types @@ -0,0 +1,13 @@ +=== tests/cases/conformance/salsa/myFile02.js === + +/** + * Checks if `value` is classified as an `Array` object. + * + * @type Function + */ +var isArray = Array.isArray; +>isArray : (arg: any) => arg is any[] +>Array.isArray : (arg: any) => arg is any[] +>Array : ArrayConstructor +>isArray : (arg: any) => arg is any[] + diff --git a/tests/baselines/reference/maxConstraints.errors.txt b/tests/baselines/reference/maxConstraints.errors.txt index 03e7158f725..a7d07a5b5f2 100644 --- a/tests/baselines/reference/maxConstraints.errors.txt +++ b/tests/baselines/reference/maxConstraints.errors.txt @@ -1,5 +1,4 @@ tests/cases/compiler/maxConstraints.ts(8,22): error TS2345: Argument of type 'number' is not assignable to parameter of type 'Comparable'. - Property 'compareTo' is missing in type 'Number'. ==== tests/cases/compiler/maxConstraints.ts (1 errors) ==== @@ -12,5 +11,4 @@ tests/cases/compiler/maxConstraints.ts(8,22): error TS2345: Argument of type 'nu var max2: Comparer = (x, y) => { return (x.compareTo(y) > 0) ? x : y }; var maxResult = max2(1, 2); ~ -!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'Comparable'. -!!! error TS2345: Property 'compareTo' is missing in type 'Number'. \ No newline at end of file +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'Comparable'. \ No newline at end of file diff --git a/tests/baselines/reference/memberFunctionsWithPrivateOverloads.errors.txt b/tests/baselines/reference/memberFunctionsWithPrivateOverloads.errors.txt index d6c3d4a659c..97ac52a293d 100644 --- a/tests/baselines/reference/memberFunctionsWithPrivateOverloads.errors.txt +++ b/tests/baselines/reference/memberFunctionsWithPrivateOverloads.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPrivateOverloads.ts(43,9): error TS2341: Property 'foo' is private and only accessible within class 'C'. -tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPrivateOverloads.ts(46,10): error TS2341: Property 'foo' is private and only accessible within class 'D'. -tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPrivateOverloads.ts(48,10): error TS2341: Property 'foo' is private and only accessible within class 'C'. -tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPrivateOverloads.ts(49,10): error TS2341: Property 'bar' is private and only accessible within class 'D'. +tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPrivateOverloads.ts(43,11): error TS2341: Property 'foo' is private and only accessible within class 'C'. +tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPrivateOverloads.ts(46,12): error TS2341: Property 'foo' is private and only accessible within class 'D'. +tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPrivateOverloads.ts(48,12): error TS2341: Property 'foo' is private and only accessible within class 'C'. +tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPrivateOverloads.ts(49,12): error TS2341: Property 'bar' is private and only accessible within class 'D'. ==== tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPrivateOverloads.ts (4 errors) ==== @@ -48,17 +48,17 @@ tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclara var c: C; var r = c.foo(1); // error - ~~~~~ + ~~~ !!! error TS2341: Property 'foo' is private and only accessible within class 'C'. var d: D; var r2 = d.foo(2); // error - ~~~~~ + ~~~ !!! error TS2341: Property 'foo' is private and only accessible within class 'D'. var r3 = C.foo(1); // error - ~~~~~ + ~~~ !!! error TS2341: Property 'foo' is private and only accessible within class 'C'. var r4 = D.bar(''); // error - ~~~~~ + ~~~ !!! error TS2341: Property 'bar' is private and only accessible within class 'D'. \ No newline at end of file diff --git a/tests/baselines/reference/memberFunctionsWithPublicOverloads.symbols b/tests/baselines/reference/memberFunctionsWithPublicOverloads.symbols index 435af50a5f7..66161e3e514 100644 --- a/tests/baselines/reference/memberFunctionsWithPublicOverloads.symbols +++ b/tests/baselines/reference/memberFunctionsWithPublicOverloads.symbols @@ -3,34 +3,34 @@ class C { >C : Symbol(C, Decl(memberFunctionsWithPublicOverloads.ts, 0, 0)) public foo(x: number); ->foo : Symbol(foo, Decl(memberFunctionsWithPublicOverloads.ts, 0, 9), Decl(memberFunctionsWithPublicOverloads.ts, 1, 26), Decl(memberFunctionsWithPublicOverloads.ts, 2, 37)) +>foo : Symbol(C.foo, Decl(memberFunctionsWithPublicOverloads.ts, 0, 9), Decl(memberFunctionsWithPublicOverloads.ts, 1, 26), Decl(memberFunctionsWithPublicOverloads.ts, 2, 37)) >x : Symbol(x, Decl(memberFunctionsWithPublicOverloads.ts, 1, 15)) public foo(x: number, y: string); ->foo : Symbol(foo, Decl(memberFunctionsWithPublicOverloads.ts, 0, 9), Decl(memberFunctionsWithPublicOverloads.ts, 1, 26), Decl(memberFunctionsWithPublicOverloads.ts, 2, 37)) +>foo : Symbol(C.foo, Decl(memberFunctionsWithPublicOverloads.ts, 0, 9), Decl(memberFunctionsWithPublicOverloads.ts, 1, 26), Decl(memberFunctionsWithPublicOverloads.ts, 2, 37)) >x : Symbol(x, Decl(memberFunctionsWithPublicOverloads.ts, 2, 15)) >y : Symbol(y, Decl(memberFunctionsWithPublicOverloads.ts, 2, 25)) public foo(x: any, y?: any) { } ->foo : Symbol(foo, Decl(memberFunctionsWithPublicOverloads.ts, 0, 9), Decl(memberFunctionsWithPublicOverloads.ts, 1, 26), Decl(memberFunctionsWithPublicOverloads.ts, 2, 37)) +>foo : Symbol(C.foo, Decl(memberFunctionsWithPublicOverloads.ts, 0, 9), Decl(memberFunctionsWithPublicOverloads.ts, 1, 26), Decl(memberFunctionsWithPublicOverloads.ts, 2, 37)) >x : Symbol(x, Decl(memberFunctionsWithPublicOverloads.ts, 3, 15)) >y : Symbol(y, Decl(memberFunctionsWithPublicOverloads.ts, 3, 22)) public bar(x: 'hi'); ->bar : Symbol(bar, Decl(memberFunctionsWithPublicOverloads.ts, 3, 35), Decl(memberFunctionsWithPublicOverloads.ts, 5, 24), Decl(memberFunctionsWithPublicOverloads.ts, 6, 26), Decl(memberFunctionsWithPublicOverloads.ts, 7, 37)) +>bar : Symbol(C.bar, Decl(memberFunctionsWithPublicOverloads.ts, 3, 35), Decl(memberFunctionsWithPublicOverloads.ts, 5, 24), Decl(memberFunctionsWithPublicOverloads.ts, 6, 26), Decl(memberFunctionsWithPublicOverloads.ts, 7, 37)) >x : Symbol(x, Decl(memberFunctionsWithPublicOverloads.ts, 5, 15)) public bar(x: string); ->bar : Symbol(bar, Decl(memberFunctionsWithPublicOverloads.ts, 3, 35), Decl(memberFunctionsWithPublicOverloads.ts, 5, 24), Decl(memberFunctionsWithPublicOverloads.ts, 6, 26), Decl(memberFunctionsWithPublicOverloads.ts, 7, 37)) +>bar : Symbol(C.bar, Decl(memberFunctionsWithPublicOverloads.ts, 3, 35), Decl(memberFunctionsWithPublicOverloads.ts, 5, 24), Decl(memberFunctionsWithPublicOverloads.ts, 6, 26), Decl(memberFunctionsWithPublicOverloads.ts, 7, 37)) >x : Symbol(x, Decl(memberFunctionsWithPublicOverloads.ts, 6, 15)) public bar(x: number, y: string); ->bar : Symbol(bar, Decl(memberFunctionsWithPublicOverloads.ts, 3, 35), Decl(memberFunctionsWithPublicOverloads.ts, 5, 24), Decl(memberFunctionsWithPublicOverloads.ts, 6, 26), Decl(memberFunctionsWithPublicOverloads.ts, 7, 37)) +>bar : Symbol(C.bar, Decl(memberFunctionsWithPublicOverloads.ts, 3, 35), Decl(memberFunctionsWithPublicOverloads.ts, 5, 24), Decl(memberFunctionsWithPublicOverloads.ts, 6, 26), Decl(memberFunctionsWithPublicOverloads.ts, 7, 37)) >x : Symbol(x, Decl(memberFunctionsWithPublicOverloads.ts, 7, 15)) >y : Symbol(y, Decl(memberFunctionsWithPublicOverloads.ts, 7, 25)) public bar(x: any, y?: any) { } ->bar : Symbol(bar, Decl(memberFunctionsWithPublicOverloads.ts, 3, 35), Decl(memberFunctionsWithPublicOverloads.ts, 5, 24), Decl(memberFunctionsWithPublicOverloads.ts, 6, 26), Decl(memberFunctionsWithPublicOverloads.ts, 7, 37)) +>bar : Symbol(C.bar, Decl(memberFunctionsWithPublicOverloads.ts, 3, 35), Decl(memberFunctionsWithPublicOverloads.ts, 5, 24), Decl(memberFunctionsWithPublicOverloads.ts, 6, 26), Decl(memberFunctionsWithPublicOverloads.ts, 7, 37)) >x : Symbol(x, Decl(memberFunctionsWithPublicOverloads.ts, 8, 15)) >y : Symbol(y, Decl(memberFunctionsWithPublicOverloads.ts, 8, 22)) @@ -72,38 +72,38 @@ class D { >T : Symbol(T, Decl(memberFunctionsWithPublicOverloads.ts, 20, 8)) public foo(x: number); ->foo : Symbol(foo, Decl(memberFunctionsWithPublicOverloads.ts, 20, 12), Decl(memberFunctionsWithPublicOverloads.ts, 21, 26), Decl(memberFunctionsWithPublicOverloads.ts, 22, 27)) +>foo : Symbol(D.foo, Decl(memberFunctionsWithPublicOverloads.ts, 20, 12), Decl(memberFunctionsWithPublicOverloads.ts, 21, 26), Decl(memberFunctionsWithPublicOverloads.ts, 22, 27)) >x : Symbol(x, Decl(memberFunctionsWithPublicOverloads.ts, 21, 15)) public foo(x: T, y: T); ->foo : Symbol(foo, Decl(memberFunctionsWithPublicOverloads.ts, 20, 12), Decl(memberFunctionsWithPublicOverloads.ts, 21, 26), Decl(memberFunctionsWithPublicOverloads.ts, 22, 27)) +>foo : Symbol(D.foo, Decl(memberFunctionsWithPublicOverloads.ts, 20, 12), Decl(memberFunctionsWithPublicOverloads.ts, 21, 26), Decl(memberFunctionsWithPublicOverloads.ts, 22, 27)) >x : Symbol(x, Decl(memberFunctionsWithPublicOverloads.ts, 22, 15)) >T : Symbol(T, Decl(memberFunctionsWithPublicOverloads.ts, 20, 8)) >y : Symbol(y, Decl(memberFunctionsWithPublicOverloads.ts, 22, 20)) >T : Symbol(T, Decl(memberFunctionsWithPublicOverloads.ts, 20, 8)) public foo(x: any, y?: any) { } ->foo : Symbol(foo, Decl(memberFunctionsWithPublicOverloads.ts, 20, 12), Decl(memberFunctionsWithPublicOverloads.ts, 21, 26), Decl(memberFunctionsWithPublicOverloads.ts, 22, 27)) +>foo : Symbol(D.foo, Decl(memberFunctionsWithPublicOverloads.ts, 20, 12), Decl(memberFunctionsWithPublicOverloads.ts, 21, 26), Decl(memberFunctionsWithPublicOverloads.ts, 22, 27)) >x : Symbol(x, Decl(memberFunctionsWithPublicOverloads.ts, 23, 15)) >y : Symbol(y, Decl(memberFunctionsWithPublicOverloads.ts, 23, 22)) public bar(x: 'hi'); ->bar : Symbol(bar, Decl(memberFunctionsWithPublicOverloads.ts, 23, 35), Decl(memberFunctionsWithPublicOverloads.ts, 25, 24), Decl(memberFunctionsWithPublicOverloads.ts, 26, 26), Decl(memberFunctionsWithPublicOverloads.ts, 27, 27)) +>bar : Symbol(D.bar, Decl(memberFunctionsWithPublicOverloads.ts, 23, 35), Decl(memberFunctionsWithPublicOverloads.ts, 25, 24), Decl(memberFunctionsWithPublicOverloads.ts, 26, 26), Decl(memberFunctionsWithPublicOverloads.ts, 27, 27)) >x : Symbol(x, Decl(memberFunctionsWithPublicOverloads.ts, 25, 15)) public bar(x: string); ->bar : Symbol(bar, Decl(memberFunctionsWithPublicOverloads.ts, 23, 35), Decl(memberFunctionsWithPublicOverloads.ts, 25, 24), Decl(memberFunctionsWithPublicOverloads.ts, 26, 26), Decl(memberFunctionsWithPublicOverloads.ts, 27, 27)) +>bar : Symbol(D.bar, Decl(memberFunctionsWithPublicOverloads.ts, 23, 35), Decl(memberFunctionsWithPublicOverloads.ts, 25, 24), Decl(memberFunctionsWithPublicOverloads.ts, 26, 26), Decl(memberFunctionsWithPublicOverloads.ts, 27, 27)) >x : Symbol(x, Decl(memberFunctionsWithPublicOverloads.ts, 26, 15)) public bar(x: T, y: T); ->bar : Symbol(bar, Decl(memberFunctionsWithPublicOverloads.ts, 23, 35), Decl(memberFunctionsWithPublicOverloads.ts, 25, 24), Decl(memberFunctionsWithPublicOverloads.ts, 26, 26), Decl(memberFunctionsWithPublicOverloads.ts, 27, 27)) +>bar : Symbol(D.bar, Decl(memberFunctionsWithPublicOverloads.ts, 23, 35), Decl(memberFunctionsWithPublicOverloads.ts, 25, 24), Decl(memberFunctionsWithPublicOverloads.ts, 26, 26), Decl(memberFunctionsWithPublicOverloads.ts, 27, 27)) >x : Symbol(x, Decl(memberFunctionsWithPublicOverloads.ts, 27, 15)) >T : Symbol(T, Decl(memberFunctionsWithPublicOverloads.ts, 20, 8)) >y : Symbol(y, Decl(memberFunctionsWithPublicOverloads.ts, 27, 20)) >T : Symbol(T, Decl(memberFunctionsWithPublicOverloads.ts, 20, 8)) public bar(x: any, y?: any) { } ->bar : Symbol(bar, Decl(memberFunctionsWithPublicOverloads.ts, 23, 35), Decl(memberFunctionsWithPublicOverloads.ts, 25, 24), Decl(memberFunctionsWithPublicOverloads.ts, 26, 26), Decl(memberFunctionsWithPublicOverloads.ts, 27, 27)) +>bar : Symbol(D.bar, Decl(memberFunctionsWithPublicOverloads.ts, 23, 35), Decl(memberFunctionsWithPublicOverloads.ts, 25, 24), Decl(memberFunctionsWithPublicOverloads.ts, 26, 26), Decl(memberFunctionsWithPublicOverloads.ts, 27, 27)) >x : Symbol(x, Decl(memberFunctionsWithPublicOverloads.ts, 28, 15)) >y : Symbol(y, Decl(memberFunctionsWithPublicOverloads.ts, 28, 22)) diff --git a/tests/baselines/reference/memberFunctionsWithPublicPrivateOverloads.errors.txt b/tests/baselines/reference/memberFunctionsWithPublicPrivateOverloads.errors.txt index 64d2f3d3059..16825f02c22 100644 --- a/tests/baselines/reference/memberFunctionsWithPublicPrivateOverloads.errors.txt +++ b/tests/baselines/reference/memberFunctionsWithPublicPrivateOverloads.errors.txt @@ -11,8 +11,8 @@ tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclara tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPublicPrivateOverloads.ts(45,19): error TS2385: Overload signatures must all be public, private or protected. tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPublicPrivateOverloads.ts(49,19): error TS2385: Overload signatures must all be public, private or protected. tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPublicPrivateOverloads.ts(53,19): error TS2385: Overload signatures must all be public, private or protected. -tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPublicPrivateOverloads.ts(59,9): error TS2341: Property 'foo' is private and only accessible within class 'C'. -tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPublicPrivateOverloads.ts(62,10): error TS2341: Property 'foo' is private and only accessible within class 'D'. +tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPublicPrivateOverloads.ts(59,11): error TS2341: Property 'foo' is private and only accessible within class 'C'. +tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPublicPrivateOverloads.ts(62,12): error TS2341: Property 'foo' is private and only accessible within class 'D'. ==== tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPublicPrivateOverloads.ts (15 errors) ==== @@ -101,10 +101,10 @@ tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclara var c: C; var r = c.foo(1); // error - ~~~~~ + ~~~ !!! error TS2341: Property 'foo' is private and only accessible within class 'C'. var d: D; var r2 = d.foo(2); // error - ~~~~~ + ~~~ !!! error TS2341: Property 'foo' is private and only accessible within class 'D'. \ No newline at end of file diff --git a/tests/baselines/reference/memberVariableDeclarations1.symbols b/tests/baselines/reference/memberVariableDeclarations1.symbols index fbd3529262b..d2c76c705c8 100644 --- a/tests/baselines/reference/memberVariableDeclarations1.symbols +++ b/tests/baselines/reference/memberVariableDeclarations1.symbols @@ -5,20 +5,20 @@ class Employee { >Employee : Symbol(Employee, Decl(memberVariableDeclarations1.ts, 0, 0)) public name: string; ->name : Symbol(name, Decl(memberVariableDeclarations1.ts, 2, 16)) +>name : Symbol(Employee.name, Decl(memberVariableDeclarations1.ts, 2, 16)) public address: string; ->address : Symbol(address, Decl(memberVariableDeclarations1.ts, 3, 24)) +>address : Symbol(Employee.address, Decl(memberVariableDeclarations1.ts, 3, 24)) public retired = false; ->retired : Symbol(retired, Decl(memberVariableDeclarations1.ts, 4, 27)) +>retired : Symbol(Employee.retired, Decl(memberVariableDeclarations1.ts, 4, 27)) public manager: Employee = null; ->manager : Symbol(manager, Decl(memberVariableDeclarations1.ts, 5, 27)) +>manager : Symbol(Employee.manager, Decl(memberVariableDeclarations1.ts, 5, 27)) >Employee : Symbol(Employee, Decl(memberVariableDeclarations1.ts, 0, 0)) public reports: Employee[] = []; ->reports : Symbol(reports, Decl(memberVariableDeclarations1.ts, 6, 36)) +>reports : Symbol(Employee.reports, Decl(memberVariableDeclarations1.ts, 6, 36)) >Employee : Symbol(Employee, Decl(memberVariableDeclarations1.ts, 0, 0)) } @@ -26,37 +26,37 @@ class Employee2 { >Employee2 : Symbol(Employee2, Decl(memberVariableDeclarations1.ts, 8, 1)) public name: string; ->name : Symbol(name, Decl(memberVariableDeclarations1.ts, 10, 17)) +>name : Symbol(Employee2.name, Decl(memberVariableDeclarations1.ts, 10, 17)) public address: string; ->address : Symbol(address, Decl(memberVariableDeclarations1.ts, 11, 24)) +>address : Symbol(Employee2.address, Decl(memberVariableDeclarations1.ts, 11, 24)) public retired: boolean; ->retired : Symbol(retired, Decl(memberVariableDeclarations1.ts, 12, 27)) +>retired : Symbol(Employee2.retired, Decl(memberVariableDeclarations1.ts, 12, 27)) public manager: Employee; ->manager : Symbol(manager, Decl(memberVariableDeclarations1.ts, 13, 28)) +>manager : Symbol(Employee2.manager, Decl(memberVariableDeclarations1.ts, 13, 28)) >Employee : Symbol(Employee, Decl(memberVariableDeclarations1.ts, 0, 0)) public reports: Employee[]; ->reports : Symbol(reports, Decl(memberVariableDeclarations1.ts, 14, 29)) +>reports : Symbol(Employee2.reports, Decl(memberVariableDeclarations1.ts, 14, 29)) >Employee : Symbol(Employee, Decl(memberVariableDeclarations1.ts, 0, 0)) constructor() { this.retired = false; ->this.retired : Symbol(retired, Decl(memberVariableDeclarations1.ts, 12, 27)) +>this.retired : Symbol(Employee2.retired, Decl(memberVariableDeclarations1.ts, 12, 27)) >this : Symbol(Employee2, Decl(memberVariableDeclarations1.ts, 8, 1)) ->retired : Symbol(retired, Decl(memberVariableDeclarations1.ts, 12, 27)) +>retired : Symbol(Employee2.retired, Decl(memberVariableDeclarations1.ts, 12, 27)) this.manager = null; ->this.manager : Symbol(manager, Decl(memberVariableDeclarations1.ts, 13, 28)) +>this.manager : Symbol(Employee2.manager, Decl(memberVariableDeclarations1.ts, 13, 28)) >this : Symbol(Employee2, Decl(memberVariableDeclarations1.ts, 8, 1)) ->manager : Symbol(manager, Decl(memberVariableDeclarations1.ts, 13, 28)) +>manager : Symbol(Employee2.manager, Decl(memberVariableDeclarations1.ts, 13, 28)) this.reports = []; ->this.reports : Symbol(reports, Decl(memberVariableDeclarations1.ts, 14, 29)) +>this.reports : Symbol(Employee2.reports, Decl(memberVariableDeclarations1.ts, 14, 29)) >this : Symbol(Employee2, Decl(memberVariableDeclarations1.ts, 8, 1)) ->reports : Symbol(reports, Decl(memberVariableDeclarations1.ts, 14, 29)) +>reports : Symbol(Employee2.reports, Decl(memberVariableDeclarations1.ts, 14, 29)) } } diff --git a/tests/baselines/reference/mergeThreeInterfaces.symbols b/tests/baselines/reference/mergeThreeInterfaces.symbols index 24bebf49de6..3d73c41948b 100644 --- a/tests/baselines/reference/mergeThreeInterfaces.symbols +++ b/tests/baselines/reference/mergeThreeInterfaces.symbols @@ -6,21 +6,21 @@ interface A { >A : Symbol(A, Decl(mergeThreeInterfaces.ts, 0, 0), Decl(mergeThreeInterfaces.ts, 5, 1), Decl(mergeThreeInterfaces.ts, 9, 1)) foo: string; ->foo : Symbol(foo, Decl(mergeThreeInterfaces.ts, 3, 13)) +>foo : Symbol(A.foo, Decl(mergeThreeInterfaces.ts, 3, 13)) } interface A { >A : Symbol(A, Decl(mergeThreeInterfaces.ts, 0, 0), Decl(mergeThreeInterfaces.ts, 5, 1), Decl(mergeThreeInterfaces.ts, 9, 1)) bar: number; ->bar : Symbol(bar, Decl(mergeThreeInterfaces.ts, 7, 13)) +>bar : Symbol(A.bar, Decl(mergeThreeInterfaces.ts, 7, 13)) } interface A { >A : Symbol(A, Decl(mergeThreeInterfaces.ts, 0, 0), Decl(mergeThreeInterfaces.ts, 5, 1), Decl(mergeThreeInterfaces.ts, 9, 1)) baz: boolean; ->baz : Symbol(baz, Decl(mergeThreeInterfaces.ts, 11, 13)) +>baz : Symbol(A.baz, Decl(mergeThreeInterfaces.ts, 11, 13)) } var a: A; @@ -51,7 +51,7 @@ interface B { >T : Symbol(T, Decl(mergeThreeInterfaces.ts, 21, 12), Decl(mergeThreeInterfaces.ts, 25, 12), Decl(mergeThreeInterfaces.ts, 29, 12)) foo: T; ->foo : Symbol(foo, Decl(mergeThreeInterfaces.ts, 21, 16)) +>foo : Symbol(B.foo, Decl(mergeThreeInterfaces.ts, 21, 16)) >T : Symbol(T, Decl(mergeThreeInterfaces.ts, 21, 12), Decl(mergeThreeInterfaces.ts, 25, 12), Decl(mergeThreeInterfaces.ts, 29, 12)) } @@ -60,7 +60,7 @@ interface B { >T : Symbol(T, Decl(mergeThreeInterfaces.ts, 21, 12), Decl(mergeThreeInterfaces.ts, 25, 12), Decl(mergeThreeInterfaces.ts, 29, 12)) bar: T; ->bar : Symbol(bar, Decl(mergeThreeInterfaces.ts, 25, 16)) +>bar : Symbol(B.bar, Decl(mergeThreeInterfaces.ts, 25, 16)) >T : Symbol(T, Decl(mergeThreeInterfaces.ts, 21, 12), Decl(mergeThreeInterfaces.ts, 25, 12), Decl(mergeThreeInterfaces.ts, 29, 12)) } @@ -69,7 +69,7 @@ interface B { >T : Symbol(T, Decl(mergeThreeInterfaces.ts, 21, 12), Decl(mergeThreeInterfaces.ts, 25, 12), Decl(mergeThreeInterfaces.ts, 29, 12)) baz: T; ->baz : Symbol(baz, Decl(mergeThreeInterfaces.ts, 29, 16)) +>baz : Symbol(B.baz, Decl(mergeThreeInterfaces.ts, 29, 16)) >T : Symbol(T, Decl(mergeThreeInterfaces.ts, 21, 12), Decl(mergeThreeInterfaces.ts, 25, 12), Decl(mergeThreeInterfaces.ts, 29, 12)) } @@ -103,21 +103,21 @@ module M { >A : Symbol(A, Decl(mergeThreeInterfaces.ts, 39, 10), Decl(mergeThreeInterfaces.ts, 42, 5), Decl(mergeThreeInterfaces.ts, 46, 5)) foo: string; ->foo : Symbol(foo, Decl(mergeThreeInterfaces.ts, 40, 17)) +>foo : Symbol(A.foo, Decl(mergeThreeInterfaces.ts, 40, 17)) } interface A { >A : Symbol(A, Decl(mergeThreeInterfaces.ts, 39, 10), Decl(mergeThreeInterfaces.ts, 42, 5), Decl(mergeThreeInterfaces.ts, 46, 5)) bar: number; ->bar : Symbol(bar, Decl(mergeThreeInterfaces.ts, 44, 17)) +>bar : Symbol(A.bar, Decl(mergeThreeInterfaces.ts, 44, 17)) } interface A { >A : Symbol(A, Decl(mergeThreeInterfaces.ts, 39, 10), Decl(mergeThreeInterfaces.ts, 42, 5), Decl(mergeThreeInterfaces.ts, 46, 5)) baz: boolean; ->baz : Symbol(baz, Decl(mergeThreeInterfaces.ts, 48, 17)) +>baz : Symbol(A.baz, Decl(mergeThreeInterfaces.ts, 48, 17)) } var a: A; @@ -149,7 +149,7 @@ module M { >T : Symbol(T, Decl(mergeThreeInterfaces.ts, 59, 16), Decl(mergeThreeInterfaces.ts, 63, 16), Decl(mergeThreeInterfaces.ts, 67, 16)) foo: T; ->foo : Symbol(foo, Decl(mergeThreeInterfaces.ts, 59, 20)) +>foo : Symbol(B.foo, Decl(mergeThreeInterfaces.ts, 59, 20)) >T : Symbol(T, Decl(mergeThreeInterfaces.ts, 59, 16), Decl(mergeThreeInterfaces.ts, 63, 16), Decl(mergeThreeInterfaces.ts, 67, 16)) } @@ -158,7 +158,7 @@ module M { >T : Symbol(T, Decl(mergeThreeInterfaces.ts, 59, 16), Decl(mergeThreeInterfaces.ts, 63, 16), Decl(mergeThreeInterfaces.ts, 67, 16)) bar: T; ->bar : Symbol(bar, Decl(mergeThreeInterfaces.ts, 63, 20)) +>bar : Symbol(B.bar, Decl(mergeThreeInterfaces.ts, 63, 20)) >T : Symbol(T, Decl(mergeThreeInterfaces.ts, 59, 16), Decl(mergeThreeInterfaces.ts, 63, 16), Decl(mergeThreeInterfaces.ts, 67, 16)) } @@ -167,7 +167,7 @@ module M { >T : Symbol(T, Decl(mergeThreeInterfaces.ts, 59, 16), Decl(mergeThreeInterfaces.ts, 63, 16), Decl(mergeThreeInterfaces.ts, 67, 16)) baz: T; ->baz : Symbol(baz, Decl(mergeThreeInterfaces.ts, 67, 20)) +>baz : Symbol(B.baz, Decl(mergeThreeInterfaces.ts, 67, 20)) >T : Symbol(T, Decl(mergeThreeInterfaces.ts, 59, 16), Decl(mergeThreeInterfaces.ts, 63, 16), Decl(mergeThreeInterfaces.ts, 67, 16)) } diff --git a/tests/baselines/reference/mergeThreeInterfaces2.symbols b/tests/baselines/reference/mergeThreeInterfaces2.symbols index 66942fd660d..8499e605f45 100644 --- a/tests/baselines/reference/mergeThreeInterfaces2.symbols +++ b/tests/baselines/reference/mergeThreeInterfaces2.symbols @@ -9,7 +9,7 @@ module M2 { >A : Symbol(A, Decl(mergeThreeInterfaces2.ts, 3, 11), Decl(mergeThreeInterfaces2.ts, 13, 11), Decl(mergeThreeInterfaces2.ts, 16, 5)) foo: string; ->foo : Symbol(foo, Decl(mergeThreeInterfaces2.ts, 4, 24)) +>foo : Symbol(A.foo, Decl(mergeThreeInterfaces2.ts, 4, 24)) } var a: A; @@ -36,14 +36,14 @@ module M2 { >A : Symbol(A, Decl(mergeThreeInterfaces2.ts, 3, 11), Decl(mergeThreeInterfaces2.ts, 13, 11), Decl(mergeThreeInterfaces2.ts, 16, 5)) bar: number; ->bar : Symbol(bar, Decl(mergeThreeInterfaces2.ts, 14, 24)) +>bar : Symbol(A.bar, Decl(mergeThreeInterfaces2.ts, 14, 24)) } export interface A { >A : Symbol(A, Decl(mergeThreeInterfaces2.ts, 3, 11), Decl(mergeThreeInterfaces2.ts, 13, 11), Decl(mergeThreeInterfaces2.ts, 16, 5)) baz: boolean; ->baz : Symbol(baz, Decl(mergeThreeInterfaces2.ts, 18, 24)) +>baz : Symbol(A.baz, Decl(mergeThreeInterfaces2.ts, 18, 24)) } var a: A; @@ -80,7 +80,7 @@ module M2 { >A : Symbol(A, Decl(mergeThreeInterfaces2.ts, 30, 22), Decl(mergeThreeInterfaces2.ts, 42, 22), Decl(mergeThreeInterfaces2.ts, 56, 22)) foo: string; ->foo : Symbol(foo, Decl(mergeThreeInterfaces2.ts, 31, 28)) +>foo : Symbol(A.foo, Decl(mergeThreeInterfaces2.ts, 31, 28)) } var a: A; @@ -111,7 +111,7 @@ module M2 { >A : Symbol(A, Decl(mergeThreeInterfaces2.ts, 30, 22), Decl(mergeThreeInterfaces2.ts, 42, 22), Decl(mergeThreeInterfaces2.ts, 56, 22)) bar: number; ->bar : Symbol(bar, Decl(mergeThreeInterfaces2.ts, 43, 28)) +>bar : Symbol(A.bar, Decl(mergeThreeInterfaces2.ts, 43, 28)) } var a: A; @@ -148,7 +148,7 @@ module M2 { >A : Symbol(A, Decl(mergeThreeInterfaces2.ts, 30, 22), Decl(mergeThreeInterfaces2.ts, 42, 22), Decl(mergeThreeInterfaces2.ts, 56, 22)) baz: boolean; ->baz : Symbol(baz, Decl(mergeThreeInterfaces2.ts, 57, 28)) +>baz : Symbol(A.baz, Decl(mergeThreeInterfaces2.ts, 57, 28)) } var a: A; diff --git a/tests/baselines/reference/mergeTwoInterfaces.symbols b/tests/baselines/reference/mergeTwoInterfaces.symbols index d34ad6ec9a2..c2c78eb83e8 100644 --- a/tests/baselines/reference/mergeTwoInterfaces.symbols +++ b/tests/baselines/reference/mergeTwoInterfaces.symbols @@ -6,14 +6,14 @@ interface A { >A : Symbol(A, Decl(mergeTwoInterfaces.ts, 0, 0), Decl(mergeTwoInterfaces.ts, 5, 1)) foo: string; ->foo : Symbol(foo, Decl(mergeTwoInterfaces.ts, 3, 13)) +>foo : Symbol(A.foo, Decl(mergeTwoInterfaces.ts, 3, 13)) } interface A { >A : Symbol(A, Decl(mergeTwoInterfaces.ts, 0, 0), Decl(mergeTwoInterfaces.ts, 5, 1)) bar: number; ->bar : Symbol(bar, Decl(mergeTwoInterfaces.ts, 7, 13)) +>bar : Symbol(A.bar, Decl(mergeTwoInterfaces.ts, 7, 13)) } var a: A; @@ -38,10 +38,10 @@ interface B { >T : Symbol(T, Decl(mergeTwoInterfaces.ts, 16, 12), Decl(mergeTwoInterfaces.ts, 21, 12)) baz: string; ->baz : Symbol(baz, Decl(mergeTwoInterfaces.ts, 16, 16)) +>baz : Symbol(B.baz, Decl(mergeTwoInterfaces.ts, 16, 16)) foo: T; ->foo : Symbol(foo, Decl(mergeTwoInterfaces.ts, 17, 16)) +>foo : Symbol(B.foo, Decl(mergeTwoInterfaces.ts, 17, 16)) >T : Symbol(T, Decl(mergeTwoInterfaces.ts, 16, 12), Decl(mergeTwoInterfaces.ts, 21, 12)) } @@ -50,7 +50,7 @@ interface B { >T : Symbol(T, Decl(mergeTwoInterfaces.ts, 16, 12), Decl(mergeTwoInterfaces.ts, 21, 12)) bar: T; ->bar : Symbol(bar, Decl(mergeTwoInterfaces.ts, 21, 16)) +>bar : Symbol(B.bar, Decl(mergeTwoInterfaces.ts, 21, 16)) >T : Symbol(T, Decl(mergeTwoInterfaces.ts, 16, 12), Decl(mergeTwoInterfaces.ts, 21, 12)) } @@ -78,14 +78,14 @@ module M { >A : Symbol(A, Decl(mergeTwoInterfaces.ts, 30, 10), Decl(mergeTwoInterfaces.ts, 33, 5)) foo: string; ->foo : Symbol(foo, Decl(mergeTwoInterfaces.ts, 31, 17)) +>foo : Symbol(A.foo, Decl(mergeTwoInterfaces.ts, 31, 17)) } interface A { >A : Symbol(A, Decl(mergeTwoInterfaces.ts, 30, 10), Decl(mergeTwoInterfaces.ts, 33, 5)) bar: number; ->bar : Symbol(bar, Decl(mergeTwoInterfaces.ts, 35, 17)) +>bar : Symbol(A.bar, Decl(mergeTwoInterfaces.ts, 35, 17)) } var a: A; @@ -110,7 +110,7 @@ module M { >T : Symbol(T, Decl(mergeTwoInterfaces.ts, 44, 16), Decl(mergeTwoInterfaces.ts, 48, 16)) foo: T; ->foo : Symbol(foo, Decl(mergeTwoInterfaces.ts, 44, 20)) +>foo : Symbol(B.foo, Decl(mergeTwoInterfaces.ts, 44, 20)) >T : Symbol(T, Decl(mergeTwoInterfaces.ts, 44, 16), Decl(mergeTwoInterfaces.ts, 48, 16)) } @@ -119,7 +119,7 @@ module M { >T : Symbol(T, Decl(mergeTwoInterfaces.ts, 44, 16), Decl(mergeTwoInterfaces.ts, 48, 16)) bar: T; ->bar : Symbol(bar, Decl(mergeTwoInterfaces.ts, 48, 20)) +>bar : Symbol(B.bar, Decl(mergeTwoInterfaces.ts, 48, 20)) >T : Symbol(T, Decl(mergeTwoInterfaces.ts, 44, 16), Decl(mergeTwoInterfaces.ts, 48, 16)) } diff --git a/tests/baselines/reference/mergeTwoInterfaces2.symbols b/tests/baselines/reference/mergeTwoInterfaces2.symbols index 661fbdc14d4..ea438343ad9 100644 --- a/tests/baselines/reference/mergeTwoInterfaces2.symbols +++ b/tests/baselines/reference/mergeTwoInterfaces2.symbols @@ -9,7 +9,7 @@ module M2 { >A : Symbol(A, Decl(mergeTwoInterfaces2.ts, 3, 11), Decl(mergeTwoInterfaces2.ts, 13, 11)) foo: string; ->foo : Symbol(foo, Decl(mergeTwoInterfaces2.ts, 4, 24)) +>foo : Symbol(A.foo, Decl(mergeTwoInterfaces2.ts, 4, 24)) } var a: A; @@ -36,7 +36,7 @@ module M2 { >A : Symbol(A, Decl(mergeTwoInterfaces2.ts, 3, 11), Decl(mergeTwoInterfaces2.ts, 13, 11)) bar: number; ->bar : Symbol(bar, Decl(mergeTwoInterfaces2.ts, 14, 24)) +>bar : Symbol(A.bar, Decl(mergeTwoInterfaces2.ts, 14, 24)) } var a: A; @@ -67,7 +67,7 @@ module M2 { >A : Symbol(A, Decl(mergeTwoInterfaces2.ts, 25, 22), Decl(mergeTwoInterfaces2.ts, 37, 22)) foo: string; ->foo : Symbol(foo, Decl(mergeTwoInterfaces2.ts, 26, 28)) +>foo : Symbol(A.foo, Decl(mergeTwoInterfaces2.ts, 26, 28)) } var a: A; @@ -98,7 +98,7 @@ module M2 { >A : Symbol(A, Decl(mergeTwoInterfaces2.ts, 25, 22), Decl(mergeTwoInterfaces2.ts, 37, 22)) bar: number; ->bar : Symbol(bar, Decl(mergeTwoInterfaces2.ts, 38, 28)) +>bar : Symbol(A.bar, Decl(mergeTwoInterfaces2.ts, 38, 28)) } var a: A; diff --git a/tests/baselines/reference/mergeWithImportedNamespace.js b/tests/baselines/reference/mergeWithImportedNamespace.js new file mode 100644 index 00000000000..60f6fedd3f2 --- /dev/null +++ b/tests/baselines/reference/mergeWithImportedNamespace.js @@ -0,0 +1,20 @@ +//// [tests/cases/compiler/mergeWithImportedNamespace.ts] //// + +//// [f1.ts] +export namespace N { export var x = 1; } + +//// [f2.ts] +import {N} from "./f1"; +// partial revert of https://github.com/Microsoft/TypeScript/pull/7583 to prevent breaking changes +export namespace N { + export interface I {x: any} +} + +//// [f1.js] +"use strict"; +var N; +(function (N) { + N.x = 1; +})(N = exports.N || (exports.N = {})); +//// [f2.js] +"use strict"; diff --git a/tests/baselines/reference/mergeWithImportedNamespace.symbols b/tests/baselines/reference/mergeWithImportedNamespace.symbols new file mode 100644 index 00000000000..58b0f0a811f --- /dev/null +++ b/tests/baselines/reference/mergeWithImportedNamespace.symbols @@ -0,0 +1,17 @@ +=== tests/cases/compiler/f1.ts === +export namespace N { export var x = 1; } +>N : Symbol(N, Decl(f1.ts, 0, 0)) +>x : Symbol(x, Decl(f1.ts, 0, 31)) + +=== tests/cases/compiler/f2.ts === +import {N} from "./f1"; +>N : Symbol(N, Decl(f2.ts, 0, 8), Decl(f2.ts, 0, 23)) + +// partial revert of https://github.com/Microsoft/TypeScript/pull/7583 to prevent breaking changes +export namespace N { +>N : Symbol(N, Decl(f2.ts, 0, 23)) + + export interface I {x: any} +>I : Symbol(I, Decl(f2.ts, 2, 20)) +>x : Symbol(I.x, Decl(f2.ts, 3, 24)) +} diff --git a/tests/baselines/reference/mergeWithImportedNamespace.types b/tests/baselines/reference/mergeWithImportedNamespace.types new file mode 100644 index 00000000000..d6c1df3b609 --- /dev/null +++ b/tests/baselines/reference/mergeWithImportedNamespace.types @@ -0,0 +1,18 @@ +=== tests/cases/compiler/f1.ts === +export namespace N { export var x = 1; } +>N : typeof N +>x : number +>1 : number + +=== tests/cases/compiler/f2.ts === +import {N} from "./f1"; +>N : typeof N + +// partial revert of https://github.com/Microsoft/TypeScript/pull/7583 to prevent breaking changes +export namespace N { +>N : any + + export interface I {x: any} +>I : I +>x : any +} diff --git a/tests/baselines/reference/mergeWithImportedType.js b/tests/baselines/reference/mergeWithImportedType.js new file mode 100644 index 00000000000..89fc353d395 --- /dev/null +++ b/tests/baselines/reference/mergeWithImportedType.js @@ -0,0 +1,18 @@ +//// [tests/cases/compiler/mergeWithImportedType.ts] //// + +//// [f1.ts] +export enum E {X} + +//// [f2.ts] +import {E} from "./f1"; +// partial revert of https://github.com/Microsoft/TypeScript/pull/7583 to prevent breaking changes +export type E = E; + +//// [f1.js] +"use strict"; +(function (E) { + E[E["X"] = 0] = "X"; +})(exports.E || (exports.E = {})); +var E = exports.E; +//// [f2.js] +"use strict"; diff --git a/tests/baselines/reference/mergeWithImportedType.symbols b/tests/baselines/reference/mergeWithImportedType.symbols new file mode 100644 index 00000000000..d14d76f91e7 --- /dev/null +++ b/tests/baselines/reference/mergeWithImportedType.symbols @@ -0,0 +1,14 @@ +=== tests/cases/compiler/f1.ts === +export enum E {X} +>E : Symbol(E, Decl(f1.ts, 0, 0)) +>X : Symbol(E.X, Decl(f1.ts, 0, 15)) + +=== tests/cases/compiler/f2.ts === +import {E} from "./f1"; +>E : Symbol(E, Decl(f2.ts, 0, 8), Decl(f2.ts, 0, 23)) + +// partial revert of https://github.com/Microsoft/TypeScript/pull/7583 to prevent breaking changes +export type E = E; +>E : Symbol(E, Decl(f2.ts, 0, 23)) +>E : Symbol(E, Decl(f2.ts, 0, 8), Decl(f2.ts, 0, 23)) + diff --git a/tests/baselines/reference/mergeWithImportedType.types b/tests/baselines/reference/mergeWithImportedType.types new file mode 100644 index 00000000000..583492444c5 --- /dev/null +++ b/tests/baselines/reference/mergeWithImportedType.types @@ -0,0 +1,14 @@ +=== tests/cases/compiler/f1.ts === +export enum E {X} +>E : E +>X : E + +=== tests/cases/compiler/f2.ts === +import {E} from "./f1"; +>E : typeof E + +// partial revert of https://github.com/Microsoft/TypeScript/pull/7583 to prevent breaking changes +export type E = E; +>E : E +>E : E + diff --git a/tests/baselines/reference/mergedClassInterface.symbols b/tests/baselines/reference/mergedClassInterface.symbols index 1c452851780..8de9a9557c1 100644 --- a/tests/baselines/reference/mergedClassInterface.symbols +++ b/tests/baselines/reference/mergedClassInterface.symbols @@ -29,28 +29,28 @@ interface C5 { >C5 : Symbol(C5, Decl(file1.ts, 16, 12), Decl(file1.ts, 20, 1), Decl(file1.ts, 24, 1), Decl(file1.ts, 28, 1)) x1: number; ->x1 : Symbol(x1, Decl(file1.ts, 18, 14)) +>x1 : Symbol(C5.x1, Decl(file1.ts, 18, 14)) } declare class C5 { >C5 : Symbol(C5, Decl(file1.ts, 16, 12), Decl(file1.ts, 20, 1), Decl(file1.ts, 24, 1), Decl(file1.ts, 28, 1)) x2: number; ->x2 : Symbol(x2, Decl(file1.ts, 22, 18)) +>x2 : Symbol(C5.x2, Decl(file1.ts, 22, 18)) } interface C5 { >C5 : Symbol(C5, Decl(file1.ts, 16, 12), Decl(file1.ts, 20, 1), Decl(file1.ts, 24, 1), Decl(file1.ts, 28, 1)) x3: number; ->x3 : Symbol(x3, Decl(file1.ts, 26, 14)) +>x3 : Symbol(C5.x3, Decl(file1.ts, 26, 14)) } interface C5 { >C5 : Symbol(C5, Decl(file1.ts, 16, 12), Decl(file1.ts, 20, 1), Decl(file1.ts, 24, 1), Decl(file1.ts, 28, 1)) x4: number; ->x4 : Symbol(x4, Decl(file1.ts, 30, 14)) +>x4 : Symbol(C5.x4, Decl(file1.ts, 30, 14)) } // checks if properties actually were merged diff --git a/tests/baselines/reference/mergedDeclarations1.symbols b/tests/baselines/reference/mergedDeclarations1.symbols index 733b9c4ee32..1e84f89aacd 100644 --- a/tests/baselines/reference/mergedDeclarations1.symbols +++ b/tests/baselines/reference/mergedDeclarations1.symbols @@ -3,10 +3,10 @@ interface Point { >Point : Symbol(Point, Decl(mergedDeclarations1.ts, 0, 0)) x: number; ->x : Symbol(x, Decl(mergedDeclarations1.ts, 0, 17)) +>x : Symbol(Point.x, Decl(mergedDeclarations1.ts, 0, 17)) y: number; ->y : Symbol(y, Decl(mergedDeclarations1.ts, 1, 14)) +>y : Symbol(Point.y, Decl(mergedDeclarations1.ts, 1, 14)) } function point(x: number, y: number): Point { >point : Symbol(point, Decl(mergedDeclarations1.ts, 3, 1), Decl(mergedDeclarations1.ts, 6, 1)) diff --git a/tests/baselines/reference/mergedDeclarations5.js b/tests/baselines/reference/mergedDeclarations5.js new file mode 100644 index 00000000000..ce4b929c7f9 --- /dev/null +++ b/tests/baselines/reference/mergedDeclarations5.js @@ -0,0 +1,34 @@ +//// [tests/cases/compiler/mergedDeclarations5.ts] //// + +//// [a.ts] +class A { + protected foo() {} +} +//// [b.ts] +interface A { } + +class B extends A { + protected foo() {} +} + +//// [a.js] +var A = (function () { + function A() { + } + A.prototype.foo = function () { }; + return A; +}()); +//// [b.js] +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var B = (function (_super) { + __extends(B, _super); + function B() { + _super.apply(this, arguments); + } + B.prototype.foo = function () { }; + return B; +}(A)); diff --git a/tests/baselines/reference/mergedDeclarations5.symbols b/tests/baselines/reference/mergedDeclarations5.symbols new file mode 100644 index 00000000000..1cbb5c333ba --- /dev/null +++ b/tests/baselines/reference/mergedDeclarations5.symbols @@ -0,0 +1,18 @@ +=== tests/cases/compiler/a.ts === +class A { +>A : Symbol(A, Decl(a.ts, 0, 0), Decl(b.ts, 0, 0)) + + protected foo() {} +>foo : Symbol(A.foo, Decl(a.ts, 0, 9)) +} +=== tests/cases/compiler/b.ts === +interface A { } +>A : Symbol(A, Decl(a.ts, 0, 0), Decl(b.ts, 0, 0)) + +class B extends A { +>B : Symbol(B, Decl(b.ts, 0, 15)) +>A : Symbol(A, Decl(a.ts, 0, 0), Decl(b.ts, 0, 0)) + + protected foo() {} +>foo : Symbol(B.foo, Decl(b.ts, 2, 19)) +} diff --git a/tests/baselines/reference/mergedDeclarations5.types b/tests/baselines/reference/mergedDeclarations5.types new file mode 100644 index 00000000000..5c31617a92b --- /dev/null +++ b/tests/baselines/reference/mergedDeclarations5.types @@ -0,0 +1,18 @@ +=== tests/cases/compiler/a.ts === +class A { +>A : A + + protected foo() {} +>foo : () => void +} +=== tests/cases/compiler/b.ts === +interface A { } +>A : A + +class B extends A { +>B : B +>A : A + + protected foo() {} +>foo : () => void +} diff --git a/tests/baselines/reference/mergedDeclarations6.js b/tests/baselines/reference/mergedDeclarations6.js new file mode 100644 index 00000000000..696ad27b2a6 --- /dev/null +++ b/tests/baselines/reference/mergedDeclarations6.js @@ -0,0 +1,57 @@ +//// [tests/cases/compiler/mergedDeclarations6.ts] //// + +//// [a.ts] + +export class A { + protected protected: any; + + protected setProtected(val: any) { + this.protected = val; + } +} + +//// [b.ts] +import {A} from './a'; + +declare module "./a" { + interface A { } +} + +export class B extends A { + protected setProtected() { + + } +} + +//// [a.js] +define(["require", "exports"], function (require, exports) { + "use strict"; + var A = (function () { + function A() { + } + A.prototype.setProtected = function (val) { + this.protected = val; + }; + return A; + }()); + exports.A = A; +}); +//// [b.js] +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +define(["require", "exports", './a'], function (require, exports, a_1) { + "use strict"; + var B = (function (_super) { + __extends(B, _super); + function B() { + _super.apply(this, arguments); + } + B.prototype.setProtected = function () { + }; + return B; + }(a_1.A)); + exports.B = B; +}); diff --git a/tests/baselines/reference/mergedDeclarations6.symbols b/tests/baselines/reference/mergedDeclarations6.symbols new file mode 100644 index 00000000000..a51dcf75e9c --- /dev/null +++ b/tests/baselines/reference/mergedDeclarations6.symbols @@ -0,0 +1,38 @@ +=== tests/cases/compiler/a.ts === + +export class A { +>A : Symbol(A, Decl(a.ts, 0, 0), Decl(b.ts, 2, 22)) + + protected protected: any; +>protected : Symbol(A.protected, Decl(a.ts, 1, 16)) + + protected setProtected(val: any) { +>setProtected : Symbol(A.setProtected, Decl(a.ts, 2, 29)) +>val : Symbol(val, Decl(a.ts, 4, 27)) + + this.protected = val; +>this.protected : Symbol(A.protected, Decl(a.ts, 1, 16)) +>this : Symbol(A, Decl(a.ts, 0, 0), Decl(b.ts, 2, 22)) +>protected : Symbol(A.protected, Decl(a.ts, 1, 16)) +>val : Symbol(val, Decl(a.ts, 4, 27)) + } +} + +=== tests/cases/compiler/b.ts === +import {A} from './a'; +>A : Symbol(A, Decl(b.ts, 0, 8)) + +declare module "./a" { + interface A { } +>A : Symbol(A, Decl(a.ts, 0, 0), Decl(b.ts, 2, 22)) +} + +export class B extends A { +>B : Symbol(B, Decl(b.ts, 4, 1)) +>A : Symbol(A, Decl(b.ts, 0, 8)) + + protected setProtected() { +>setProtected : Symbol(B.setProtected, Decl(b.ts, 6, 26)) + + } +} diff --git a/tests/baselines/reference/mergedDeclarations6.types b/tests/baselines/reference/mergedDeclarations6.types new file mode 100644 index 00000000000..6198c08f6b5 --- /dev/null +++ b/tests/baselines/reference/mergedDeclarations6.types @@ -0,0 +1,39 @@ +=== tests/cases/compiler/a.ts === + +export class A { +>A : A + + protected protected: any; +>protected : any + + protected setProtected(val: any) { +>setProtected : (val: any) => void +>val : any + + this.protected = val; +>this.protected = val : any +>this.protected : any +>this : this +>protected : any +>val : any + } +} + +=== tests/cases/compiler/b.ts === +import {A} from './a'; +>A : typeof A + +declare module "./a" { + interface A { } +>A : A +} + +export class B extends A { +>B : B +>A : A + + protected setProtected() { +>setProtected : () => void + + } +} diff --git a/tests/baselines/reference/mergedInheritedClassInterface.symbols b/tests/baselines/reference/mergedInheritedClassInterface.symbols index 5f4ae67df6f..b829ba073d8 100644 --- a/tests/baselines/reference/mergedInheritedClassInterface.symbols +++ b/tests/baselines/reference/mergedInheritedClassInterface.symbols @@ -3,20 +3,20 @@ interface BaseInterface { >BaseInterface : Symbol(BaseInterface, Decl(mergedInheritedClassInterface.ts, 0, 0)) required: number; ->required : Symbol(required, Decl(mergedInheritedClassInterface.ts, 0, 25)) +>required : Symbol(BaseInterface.required, Decl(mergedInheritedClassInterface.ts, 0, 25)) optional?: number; ->optional : Symbol(optional, Decl(mergedInheritedClassInterface.ts, 1, 21)) +>optional : Symbol(BaseInterface.optional, Decl(mergedInheritedClassInterface.ts, 1, 21)) } class BaseClass { >BaseClass : Symbol(BaseClass, Decl(mergedInheritedClassInterface.ts, 3, 1)) baseMethod() { } ->baseMethod : Symbol(baseMethod, Decl(mergedInheritedClassInterface.ts, 5, 17)) +>baseMethod : Symbol(BaseClass.baseMethod, Decl(mergedInheritedClassInterface.ts, 5, 17)) baseNumber: number; ->baseNumber : Symbol(baseNumber, Decl(mergedInheritedClassInterface.ts, 6, 20)) +>baseNumber : Symbol(BaseClass.baseNumber, Decl(mergedInheritedClassInterface.ts, 6, 20)) } interface Child extends BaseInterface { @@ -24,7 +24,7 @@ interface Child extends BaseInterface { >BaseInterface : Symbol(BaseInterface, Decl(mergedInheritedClassInterface.ts, 0, 0)) additional: number; ->additional : Symbol(additional, Decl(mergedInheritedClassInterface.ts, 10, 39)) +>additional : Symbol(Child.additional, Decl(mergedInheritedClassInterface.ts, 10, 39)) } class Child extends BaseClass { @@ -32,10 +32,10 @@ class Child extends BaseClass { >BaseClass : Symbol(BaseClass, Decl(mergedInheritedClassInterface.ts, 3, 1)) classNumber: number; ->classNumber : Symbol(classNumber, Decl(mergedInheritedClassInterface.ts, 14, 31)) +>classNumber : Symbol(Child.classNumber, Decl(mergedInheritedClassInterface.ts, 14, 31)) method() { } ->method : Symbol(method, Decl(mergedInheritedClassInterface.ts, 15, 24)) +>method : Symbol(Child.method, Decl(mergedInheritedClassInterface.ts, 15, 24)) } interface ChildNoBaseClass extends BaseInterface { @@ -43,16 +43,16 @@ interface ChildNoBaseClass extends BaseInterface { >BaseInterface : Symbol(BaseInterface, Decl(mergedInheritedClassInterface.ts, 0, 0)) additional2: string; ->additional2 : Symbol(additional2, Decl(mergedInheritedClassInterface.ts, 19, 50)) +>additional2 : Symbol(ChildNoBaseClass.additional2, Decl(mergedInheritedClassInterface.ts, 19, 50)) } class ChildNoBaseClass { >ChildNoBaseClass : Symbol(ChildNoBaseClass, Decl(mergedInheritedClassInterface.ts, 17, 1), Decl(mergedInheritedClassInterface.ts, 21, 1)) classString: string; ->classString : Symbol(classString, Decl(mergedInheritedClassInterface.ts, 22, 24)) +>classString : Symbol(ChildNoBaseClass.classString, Decl(mergedInheritedClassInterface.ts, 22, 24)) method2() { } ->method2 : Symbol(method2, Decl(mergedInheritedClassInterface.ts, 23, 24)) +>method2 : Symbol(ChildNoBaseClass.method2, Decl(mergedInheritedClassInterface.ts, 23, 24)) } class Grandchild extends ChildNoBaseClass { >Grandchild : Symbol(Grandchild, Decl(mergedInheritedClassInterface.ts, 25, 1)) diff --git a/tests/baselines/reference/mergedInterfaceFromMultipleFiles1.symbols b/tests/baselines/reference/mergedInterfaceFromMultipleFiles1.symbols index 78383c29377..4dffd06bcde 100644 --- a/tests/baselines/reference/mergedInterfaceFromMultipleFiles1.symbols +++ b/tests/baselines/reference/mergedInterfaceFromMultipleFiles1.symbols @@ -3,15 +3,15 @@ interface D { bar(): number; } >D : Symbol(D, Decl(mergedInterfaceFromMultipleFiles1_1.ts, 0, 0)) ->bar : Symbol(bar, Decl(mergedInterfaceFromMultipleFiles1_1.ts, 2, 13)) +>bar : Symbol(D.bar, Decl(mergedInterfaceFromMultipleFiles1_1.ts, 2, 13)) interface C extends D { >C : Symbol(C, Decl(mergedInterfaceFromMultipleFiles1_0.ts, 1, 30), Decl(mergedInterfaceFromMultipleFiles1_1.ts, 2, 30)) >D : Symbol(D, Decl(mergedInterfaceFromMultipleFiles1_1.ts, 0, 0)) b(): Date; ->b : Symbol(b, Decl(mergedInterfaceFromMultipleFiles1_1.ts, 4, 23)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>b : Symbol(C.b, Decl(mergedInterfaceFromMultipleFiles1_1.ts, 4, 23)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) } var c:C; @@ -38,7 +38,7 @@ var d: number = c.a(); var e: Date = c.b(); >e : Symbol(e, Decl(mergedInterfaceFromMultipleFiles1_1.ts, 12, 3)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >c.b : Symbol(C.b, Decl(mergedInterfaceFromMultipleFiles1_1.ts, 4, 23)) >c : Symbol(c, Decl(mergedInterfaceFromMultipleFiles1_1.ts, 8, 3)) >b : Symbol(C.b, Decl(mergedInterfaceFromMultipleFiles1_1.ts, 4, 23)) @@ -47,13 +47,13 @@ var e: Date = c.b(); interface I { foo(): string; } >I : Symbol(I, Decl(mergedInterfaceFromMultipleFiles1_0.ts, 0, 0)) ->foo : Symbol(foo, Decl(mergedInterfaceFromMultipleFiles1_0.ts, 1, 13)) +>foo : Symbol(I.foo, Decl(mergedInterfaceFromMultipleFiles1_0.ts, 1, 13)) interface C extends I { >C : Symbol(C, Decl(mergedInterfaceFromMultipleFiles1_0.ts, 1, 30), Decl(mergedInterfaceFromMultipleFiles1_1.ts, 2, 30)) >I : Symbol(I, Decl(mergedInterfaceFromMultipleFiles1_0.ts, 0, 0)) a(): number; ->a : Symbol(a, Decl(mergedInterfaceFromMultipleFiles1_0.ts, 3, 23)) +>a : Symbol(C.a, Decl(mergedInterfaceFromMultipleFiles1_0.ts, 3, 23)) } diff --git a/tests/baselines/reference/mergedInterfacesWithInheritedPrivates.errors.txt b/tests/baselines/reference/mergedInterfacesWithInheritedPrivates.errors.txt index 92d4cb17e72..3bd351ed003 100644 --- a/tests/baselines/reference/mergedInterfacesWithInheritedPrivates.errors.txt +++ b/tests/baselines/reference/mergedInterfacesWithInheritedPrivates.errors.txt @@ -2,7 +2,7 @@ tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithInheri Types have separate declarations of a private property 'x'. tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithInheritedPrivates.ts(19,7): error TS2420: Class 'E' incorrectly implements interface 'A'. Property 'x' is private in type 'A' but not in type 'E'. -tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithInheritedPrivates.ts(26,9): error TS2341: Property 'x' is private and only accessible within class 'C'. +tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithInheritedPrivates.ts(26,11): error TS2341: Property 'x' is private and only accessible within class 'C'. ==== tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithInheritedPrivates.ts (3 errors) ==== @@ -38,5 +38,5 @@ tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithInheri var a: A; var r = a.x; // error - ~~~ + ~ !!! error TS2341: Property 'x' is private and only accessible within class 'C'. \ No newline at end of file diff --git a/tests/baselines/reference/mergedInterfacesWithInheritedPrivates2.errors.txt b/tests/baselines/reference/mergedInterfacesWithInheritedPrivates2.errors.txt index 8fc1f0fe819..eaf516146f4 100644 --- a/tests/baselines/reference/mergedInterfacesWithInheritedPrivates2.errors.txt +++ b/tests/baselines/reference/mergedInterfacesWithInheritedPrivates2.errors.txt @@ -4,8 +4,8 @@ tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithInheri Property 'w' is private in type 'C2' but not in type 'E'. tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithInheritedPrivates2.ts(23,7): error TS2420: Class 'E' incorrectly implements interface 'A'. Property 'x' is missing in type 'E'. -tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithInheritedPrivates2.ts(30,9): error TS2341: Property 'x' is private and only accessible within class 'C'. -tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithInheritedPrivates2.ts(31,10): error TS2341: Property 'w' is private and only accessible within class 'C2'. +tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithInheritedPrivates2.ts(30,11): error TS2341: Property 'x' is private and only accessible within class 'C'. +tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithInheritedPrivates2.ts(31,12): error TS2341: Property 'w' is private and only accessible within class 'C2'. ==== tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithInheritedPrivates2.ts (5 errors) ==== @@ -48,8 +48,8 @@ tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithInheri var a: A; var r = a.x; // error - ~~~ + ~ !!! error TS2341: Property 'x' is private and only accessible within class 'C'. var r2 = a.w; // error - ~~~ + ~ !!! error TS2341: Property 'w' is private and only accessible within class 'C2'. \ No newline at end of file diff --git a/tests/baselines/reference/mergedInterfacesWithMultipleBases.symbols b/tests/baselines/reference/mergedInterfacesWithMultipleBases.symbols index b3fe87bca29..c4275b45908 100644 --- a/tests/baselines/reference/mergedInterfacesWithMultipleBases.symbols +++ b/tests/baselines/reference/mergedInterfacesWithMultipleBases.symbols @@ -6,14 +6,14 @@ class C { >C : Symbol(C, Decl(mergedInterfacesWithMultipleBases.ts, 0, 0)) a: number; ->a : Symbol(a, Decl(mergedInterfacesWithMultipleBases.ts, 3, 9)) +>a : Symbol(C.a, Decl(mergedInterfacesWithMultipleBases.ts, 3, 9)) } class C2 { >C2 : Symbol(C2, Decl(mergedInterfacesWithMultipleBases.ts, 5, 1)) b: number; ->b : Symbol(b, Decl(mergedInterfacesWithMultipleBases.ts, 7, 10)) +>b : Symbol(C2.b, Decl(mergedInterfacesWithMultipleBases.ts, 7, 10)) } interface A extends C { @@ -21,7 +21,7 @@ interface A extends C { >C : Symbol(C, Decl(mergedInterfacesWithMultipleBases.ts, 0, 0)) y: string; ->y : Symbol(y, Decl(mergedInterfacesWithMultipleBases.ts, 11, 23)) +>y : Symbol(A.y, Decl(mergedInterfacesWithMultipleBases.ts, 11, 23)) } interface A extends C2 { @@ -29,7 +29,7 @@ interface A extends C2 { >C2 : Symbol(C2, Decl(mergedInterfacesWithMultipleBases.ts, 5, 1)) z: string; ->z : Symbol(z, Decl(mergedInterfacesWithMultipleBases.ts, 15, 24)) +>z : Symbol(A.z, Decl(mergedInterfacesWithMultipleBases.ts, 15, 24)) } class D implements A { @@ -37,16 +37,16 @@ class D implements A { >A : Symbol(A, Decl(mergedInterfacesWithMultipleBases.ts, 9, 1), Decl(mergedInterfacesWithMultipleBases.ts, 13, 1)) a: number; ->a : Symbol(a, Decl(mergedInterfacesWithMultipleBases.ts, 19, 22)) +>a : Symbol(D.a, Decl(mergedInterfacesWithMultipleBases.ts, 19, 22)) b: number; ->b : Symbol(b, Decl(mergedInterfacesWithMultipleBases.ts, 20, 14)) +>b : Symbol(D.b, Decl(mergedInterfacesWithMultipleBases.ts, 20, 14)) y: string; ->y : Symbol(y, Decl(mergedInterfacesWithMultipleBases.ts, 21, 14)) +>y : Symbol(D.y, Decl(mergedInterfacesWithMultipleBases.ts, 21, 14)) z: string; ->z : Symbol(z, Decl(mergedInterfacesWithMultipleBases.ts, 22, 14)) +>z : Symbol(D.z, Decl(mergedInterfacesWithMultipleBases.ts, 22, 14)) } var a: A; @@ -68,7 +68,7 @@ module M { >T : Symbol(T, Decl(mergedInterfacesWithMultipleBases.ts, 31, 12)) a: T; ->a : Symbol(a, Decl(mergedInterfacesWithMultipleBases.ts, 31, 16)) +>a : Symbol(C.a, Decl(mergedInterfacesWithMultipleBases.ts, 31, 16)) >T : Symbol(T, Decl(mergedInterfacesWithMultipleBases.ts, 31, 12)) } @@ -77,7 +77,7 @@ module M { >T : Symbol(T, Decl(mergedInterfacesWithMultipleBases.ts, 35, 13)) b: T; ->b : Symbol(b, Decl(mergedInterfacesWithMultipleBases.ts, 35, 17)) +>b : Symbol(C2.b, Decl(mergedInterfacesWithMultipleBases.ts, 35, 17)) >T : Symbol(T, Decl(mergedInterfacesWithMultipleBases.ts, 35, 13)) } @@ -88,7 +88,7 @@ module M { >T : Symbol(T, Decl(mergedInterfacesWithMultipleBases.ts, 39, 16), Decl(mergedInterfacesWithMultipleBases.ts, 43, 16)) y: T; ->y : Symbol(y, Decl(mergedInterfacesWithMultipleBases.ts, 39, 33)) +>y : Symbol(A.y, Decl(mergedInterfacesWithMultipleBases.ts, 39, 33)) >T : Symbol(T, Decl(mergedInterfacesWithMultipleBases.ts, 39, 16), Decl(mergedInterfacesWithMultipleBases.ts, 43, 16)) } @@ -98,7 +98,7 @@ module M { >C2 : Symbol(C2, Decl(mergedInterfacesWithMultipleBases.ts, 33, 5)) z: T; ->z : Symbol(z, Decl(mergedInterfacesWithMultipleBases.ts, 43, 39)) +>z : Symbol(A.z, Decl(mergedInterfacesWithMultipleBases.ts, 43, 39)) >T : Symbol(T, Decl(mergedInterfacesWithMultipleBases.ts, 39, 16), Decl(mergedInterfacesWithMultipleBases.ts, 43, 16)) } @@ -107,15 +107,15 @@ module M { >A : Symbol(A, Decl(mergedInterfacesWithMultipleBases.ts, 37, 5), Decl(mergedInterfacesWithMultipleBases.ts, 41, 5)) a: boolean; ->a : Symbol(a, Decl(mergedInterfacesWithMultipleBases.ts, 47, 35)) +>a : Symbol(D.a, Decl(mergedInterfacesWithMultipleBases.ts, 47, 35)) b: string; ->b : Symbol(b, Decl(mergedInterfacesWithMultipleBases.ts, 48, 19)) +>b : Symbol(D.b, Decl(mergedInterfacesWithMultipleBases.ts, 48, 19)) y: boolean; ->y : Symbol(y, Decl(mergedInterfacesWithMultipleBases.ts, 49, 18)) +>y : Symbol(D.y, Decl(mergedInterfacesWithMultipleBases.ts, 49, 18)) z: boolean; ->z : Symbol(z, Decl(mergedInterfacesWithMultipleBases.ts, 50, 19)) +>z : Symbol(D.z, Decl(mergedInterfacesWithMultipleBases.ts, 50, 19)) } } diff --git a/tests/baselines/reference/mergedInterfacesWithMultipleBases2.symbols b/tests/baselines/reference/mergedInterfacesWithMultipleBases2.symbols index 7424e0d110b..a71f3838f7f 100644 --- a/tests/baselines/reference/mergedInterfacesWithMultipleBases2.symbols +++ b/tests/baselines/reference/mergedInterfacesWithMultipleBases2.symbols @@ -6,28 +6,28 @@ class C { >C : Symbol(C, Decl(mergedInterfacesWithMultipleBases2.ts, 0, 0)) a: number; ->a : Symbol(a, Decl(mergedInterfacesWithMultipleBases2.ts, 3, 9)) +>a : Symbol(C.a, Decl(mergedInterfacesWithMultipleBases2.ts, 3, 9)) } class C2 { >C2 : Symbol(C2, Decl(mergedInterfacesWithMultipleBases2.ts, 5, 1)) b: number; ->b : Symbol(b, Decl(mergedInterfacesWithMultipleBases2.ts, 7, 10)) +>b : Symbol(C2.b, Decl(mergedInterfacesWithMultipleBases2.ts, 7, 10)) } class C3 { >C3 : Symbol(C3, Decl(mergedInterfacesWithMultipleBases2.ts, 9, 1)) c: string; ->c : Symbol(c, Decl(mergedInterfacesWithMultipleBases2.ts, 11, 10)) +>c : Symbol(C3.c, Decl(mergedInterfacesWithMultipleBases2.ts, 11, 10)) } class C4 { >C4 : Symbol(C4, Decl(mergedInterfacesWithMultipleBases2.ts, 13, 1)) d: string; ->d : Symbol(d, Decl(mergedInterfacesWithMultipleBases2.ts, 15, 10)) +>d : Symbol(C4.d, Decl(mergedInterfacesWithMultipleBases2.ts, 15, 10)) } @@ -37,7 +37,7 @@ interface A extends C, C3 { >C3 : Symbol(C3, Decl(mergedInterfacesWithMultipleBases2.ts, 9, 1)) y: string; ->y : Symbol(y, Decl(mergedInterfacesWithMultipleBases2.ts, 20, 27)) +>y : Symbol(A.y, Decl(mergedInterfacesWithMultipleBases2.ts, 20, 27)) } interface A extends C2, C4 { @@ -46,7 +46,7 @@ interface A extends C2, C4 { >C4 : Symbol(C4, Decl(mergedInterfacesWithMultipleBases2.ts, 13, 1)) z: string; ->z : Symbol(z, Decl(mergedInterfacesWithMultipleBases2.ts, 24, 28)) +>z : Symbol(A.z, Decl(mergedInterfacesWithMultipleBases2.ts, 24, 28)) } class D implements A { @@ -54,22 +54,22 @@ class D implements A { >A : Symbol(A, Decl(mergedInterfacesWithMultipleBases2.ts, 17, 1), Decl(mergedInterfacesWithMultipleBases2.ts, 22, 1)) a: number; ->a : Symbol(a, Decl(mergedInterfacesWithMultipleBases2.ts, 28, 22)) +>a : Symbol(D.a, Decl(mergedInterfacesWithMultipleBases2.ts, 28, 22)) b: number; ->b : Symbol(b, Decl(mergedInterfacesWithMultipleBases2.ts, 29, 14)) +>b : Symbol(D.b, Decl(mergedInterfacesWithMultipleBases2.ts, 29, 14)) c: string; ->c : Symbol(c, Decl(mergedInterfacesWithMultipleBases2.ts, 30, 14)) +>c : Symbol(D.c, Decl(mergedInterfacesWithMultipleBases2.ts, 30, 14)) d: string; ->d : Symbol(d, Decl(mergedInterfacesWithMultipleBases2.ts, 31, 14)) +>d : Symbol(D.d, Decl(mergedInterfacesWithMultipleBases2.ts, 31, 14)) y: string; ->y : Symbol(y, Decl(mergedInterfacesWithMultipleBases2.ts, 32, 14)) +>y : Symbol(D.y, Decl(mergedInterfacesWithMultipleBases2.ts, 32, 14)) z: string; ->z : Symbol(z, Decl(mergedInterfacesWithMultipleBases2.ts, 33, 14)) +>z : Symbol(D.z, Decl(mergedInterfacesWithMultipleBases2.ts, 33, 14)) } var a: A; @@ -91,7 +91,7 @@ module M { >T : Symbol(T, Decl(mergedInterfacesWithMultipleBases2.ts, 42, 12)) a: T; ->a : Symbol(a, Decl(mergedInterfacesWithMultipleBases2.ts, 42, 16)) +>a : Symbol(C.a, Decl(mergedInterfacesWithMultipleBases2.ts, 42, 16)) >T : Symbol(T, Decl(mergedInterfacesWithMultipleBases2.ts, 42, 12)) } @@ -100,7 +100,7 @@ module M { >T : Symbol(T, Decl(mergedInterfacesWithMultipleBases2.ts, 46, 13)) b: T; ->b : Symbol(b, Decl(mergedInterfacesWithMultipleBases2.ts, 46, 17)) +>b : Symbol(C2.b, Decl(mergedInterfacesWithMultipleBases2.ts, 46, 17)) >T : Symbol(T, Decl(mergedInterfacesWithMultipleBases2.ts, 46, 13)) } @@ -109,7 +109,7 @@ module M { >T : Symbol(T, Decl(mergedInterfacesWithMultipleBases2.ts, 50, 13)) c: T; ->c : Symbol(c, Decl(mergedInterfacesWithMultipleBases2.ts, 50, 17)) +>c : Symbol(C3.c, Decl(mergedInterfacesWithMultipleBases2.ts, 50, 17)) >T : Symbol(T, Decl(mergedInterfacesWithMultipleBases2.ts, 50, 13)) } @@ -118,7 +118,7 @@ module M { >T : Symbol(T, Decl(mergedInterfacesWithMultipleBases2.ts, 54, 13)) d: T; ->d : Symbol(d, Decl(mergedInterfacesWithMultipleBases2.ts, 54, 17)) +>d : Symbol(C4.d, Decl(mergedInterfacesWithMultipleBases2.ts, 54, 17)) >T : Symbol(T, Decl(mergedInterfacesWithMultipleBases2.ts, 54, 13)) } @@ -131,7 +131,7 @@ module M { >T : Symbol(T, Decl(mergedInterfacesWithMultipleBases2.ts, 58, 16), Decl(mergedInterfacesWithMultipleBases2.ts, 62, 16)) y: T; ->y : Symbol(y, Decl(mergedInterfacesWithMultipleBases2.ts, 58, 40)) +>y : Symbol(A.y, Decl(mergedInterfacesWithMultipleBases2.ts, 58, 40)) >T : Symbol(T, Decl(mergedInterfacesWithMultipleBases2.ts, 58, 16), Decl(mergedInterfacesWithMultipleBases2.ts, 62, 16)) } @@ -142,7 +142,7 @@ module M { >C4 : Symbol(C4, Decl(mergedInterfacesWithMultipleBases2.ts, 52, 5)) z: T; ->z : Symbol(z, Decl(mergedInterfacesWithMultipleBases2.ts, 62, 51)) +>z : Symbol(A.z, Decl(mergedInterfacesWithMultipleBases2.ts, 62, 51)) >T : Symbol(T, Decl(mergedInterfacesWithMultipleBases2.ts, 58, 16), Decl(mergedInterfacesWithMultipleBases2.ts, 62, 16)) } @@ -151,21 +151,21 @@ module M { >A : Symbol(A, Decl(mergedInterfacesWithMultipleBases2.ts, 56, 5), Decl(mergedInterfacesWithMultipleBases2.ts, 60, 5)) a: boolean; ->a : Symbol(a, Decl(mergedInterfacesWithMultipleBases2.ts, 66, 35)) +>a : Symbol(D.a, Decl(mergedInterfacesWithMultipleBases2.ts, 66, 35)) b: string; ->b : Symbol(b, Decl(mergedInterfacesWithMultipleBases2.ts, 67, 19)) +>b : Symbol(D.b, Decl(mergedInterfacesWithMultipleBases2.ts, 67, 19)) c: boolean; ->c : Symbol(c, Decl(mergedInterfacesWithMultipleBases2.ts, 68, 18)) +>c : Symbol(D.c, Decl(mergedInterfacesWithMultipleBases2.ts, 68, 18)) d: string; ->d : Symbol(d, Decl(mergedInterfacesWithMultipleBases2.ts, 69, 19)) +>d : Symbol(D.d, Decl(mergedInterfacesWithMultipleBases2.ts, 69, 19)) y: boolean; ->y : Symbol(y, Decl(mergedInterfacesWithMultipleBases2.ts, 70, 18)) +>y : Symbol(D.y, Decl(mergedInterfacesWithMultipleBases2.ts, 70, 18)) z: boolean; ->z : Symbol(z, Decl(mergedInterfacesWithMultipleBases2.ts, 71, 19)) +>z : Symbol(D.z, Decl(mergedInterfacesWithMultipleBases2.ts, 71, 19)) } } diff --git a/tests/baselines/reference/mergedInterfacesWithMultipleBases3.symbols b/tests/baselines/reference/mergedInterfacesWithMultipleBases3.symbols index 1aa65e8825a..de2bff45743 100644 --- a/tests/baselines/reference/mergedInterfacesWithMultipleBases3.symbols +++ b/tests/baselines/reference/mergedInterfacesWithMultipleBases3.symbols @@ -7,7 +7,7 @@ class C { >T : Symbol(T, Decl(mergedInterfacesWithMultipleBases3.ts, 3, 8)) a: T; ->a : Symbol(a, Decl(mergedInterfacesWithMultipleBases3.ts, 3, 12)) +>a : Symbol(C.a, Decl(mergedInterfacesWithMultipleBases3.ts, 3, 12)) >T : Symbol(T, Decl(mergedInterfacesWithMultipleBases3.ts, 3, 8)) } @@ -16,7 +16,7 @@ class C2 { >T : Symbol(T, Decl(mergedInterfacesWithMultipleBases3.ts, 7, 9)) b: T; ->b : Symbol(b, Decl(mergedInterfacesWithMultipleBases3.ts, 7, 13)) +>b : Symbol(C2.b, Decl(mergedInterfacesWithMultipleBases3.ts, 7, 13)) >T : Symbol(T, Decl(mergedInterfacesWithMultipleBases3.ts, 7, 9)) } @@ -25,7 +25,7 @@ class C3 { >T : Symbol(T, Decl(mergedInterfacesWithMultipleBases3.ts, 11, 9)) c: T; ->c : Symbol(c, Decl(mergedInterfacesWithMultipleBases3.ts, 11, 13)) +>c : Symbol(C3.c, Decl(mergedInterfacesWithMultipleBases3.ts, 11, 13)) >T : Symbol(T, Decl(mergedInterfacesWithMultipleBases3.ts, 11, 9)) } @@ -34,7 +34,7 @@ class C4 { >T : Symbol(T, Decl(mergedInterfacesWithMultipleBases3.ts, 15, 9)) d: T; ->d : Symbol(d, Decl(mergedInterfacesWithMultipleBases3.ts, 15, 13)) +>d : Symbol(C4.d, Decl(mergedInterfacesWithMultipleBases3.ts, 15, 13)) >T : Symbol(T, Decl(mergedInterfacesWithMultipleBases3.ts, 15, 9)) } @@ -45,7 +45,7 @@ interface A extends C, C3 { >C3 : Symbol(C3, Decl(mergedInterfacesWithMultipleBases3.ts, 9, 1)) y: T; ->y : Symbol(y, Decl(mergedInterfacesWithMultipleBases3.ts, 19, 46)) +>y : Symbol(A.y, Decl(mergedInterfacesWithMultipleBases3.ts, 19, 46)) >T : Symbol(T, Decl(mergedInterfacesWithMultipleBases3.ts, 19, 12), Decl(mergedInterfacesWithMultipleBases3.ts, 23, 12)) } @@ -56,7 +56,7 @@ interface A extends C, C4 { >C4 : Symbol(C4, Decl(mergedInterfacesWithMultipleBases3.ts, 13, 1)) z: T; ->z : Symbol(z, Decl(mergedInterfacesWithMultipleBases3.ts, 23, 46)) +>z : Symbol(A.z, Decl(mergedInterfacesWithMultipleBases3.ts, 23, 46)) >T : Symbol(T, Decl(mergedInterfacesWithMultipleBases3.ts, 19, 12), Decl(mergedInterfacesWithMultipleBases3.ts, 23, 12)) } @@ -65,21 +65,21 @@ class D implements A { >A : Symbol(A, Decl(mergedInterfacesWithMultipleBases3.ts, 17, 1), Decl(mergedInterfacesWithMultipleBases3.ts, 21, 1)) a: string; ->a : Symbol(a, Decl(mergedInterfacesWithMultipleBases3.ts, 27, 31)) +>a : Symbol(D.a, Decl(mergedInterfacesWithMultipleBases3.ts, 27, 31)) b: Date; ->b : Symbol(b, Decl(mergedInterfacesWithMultipleBases3.ts, 28, 14)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>b : Symbol(D.b, Decl(mergedInterfacesWithMultipleBases3.ts, 28, 14)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) c: string; ->c : Symbol(c, Decl(mergedInterfacesWithMultipleBases3.ts, 29, 12)) +>c : Symbol(D.c, Decl(mergedInterfacesWithMultipleBases3.ts, 29, 12)) d: string; ->d : Symbol(d, Decl(mergedInterfacesWithMultipleBases3.ts, 30, 14)) +>d : Symbol(D.d, Decl(mergedInterfacesWithMultipleBases3.ts, 30, 14)) y: boolean; ->y : Symbol(y, Decl(mergedInterfacesWithMultipleBases3.ts, 31, 14)) +>y : Symbol(D.y, Decl(mergedInterfacesWithMultipleBases3.ts, 31, 14)) z: boolean; ->z : Symbol(z, Decl(mergedInterfacesWithMultipleBases3.ts, 32, 15)) +>z : Symbol(D.z, Decl(mergedInterfacesWithMultipleBases3.ts, 32, 15)) } diff --git a/tests/baselines/reference/mergedModuleDeclarationCodeGen.errors.txt b/tests/baselines/reference/mergedModuleDeclarationCodeGen.errors.txt deleted file mode 100644 index a39c1c4d91a..00000000000 --- a/tests/baselines/reference/mergedModuleDeclarationCodeGen.errors.txt +++ /dev/null @@ -1,21 +0,0 @@ -tests/cases/compiler/mergedModuleDeclarationCodeGen.ts(1,15): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. - - -==== tests/cases/compiler/mergedModuleDeclarationCodeGen.ts (1 errors) ==== - export module X { - ~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. - export module Y { - class A { - constructor(Y: any) { - new B(); - } - } - } - } - export module X { - export module Y { - export class B { - } - } - } \ No newline at end of file diff --git a/tests/baselines/reference/mergedModuleDeclarationCodeGen.symbols b/tests/baselines/reference/mergedModuleDeclarationCodeGen.symbols new file mode 100644 index 00000000000..21ec69df7df --- /dev/null +++ b/tests/baselines/reference/mergedModuleDeclarationCodeGen.symbols @@ -0,0 +1,30 @@ +=== tests/cases/compiler/mergedModuleDeclarationCodeGen.ts === +export module X { +>X : Symbol(X, Decl(mergedModuleDeclarationCodeGen.ts, 0, 0), Decl(mergedModuleDeclarationCodeGen.ts, 8, 1)) + + export module Y { +>Y : Symbol(Y, Decl(mergedModuleDeclarationCodeGen.ts, 0, 17), Decl(mergedModuleDeclarationCodeGen.ts, 9, 17)) + + class A { +>A : Symbol(A, Decl(mergedModuleDeclarationCodeGen.ts, 1, 21)) + + constructor(Y: any) { +>Y : Symbol(Y, Decl(mergedModuleDeclarationCodeGen.ts, 3, 24)) + + new B(); +>B : Symbol(B, Decl(mergedModuleDeclarationCodeGen.ts, 10, 21)) + } + } + } +} +export module X { +>X : Symbol(X, Decl(mergedModuleDeclarationCodeGen.ts, 0, 0), Decl(mergedModuleDeclarationCodeGen.ts, 8, 1)) + + export module Y { +>Y : Symbol(Y, Decl(mergedModuleDeclarationCodeGen.ts, 0, 17), Decl(mergedModuleDeclarationCodeGen.ts, 9, 17)) + + export class B { +>B : Symbol(B, Decl(mergedModuleDeclarationCodeGen.ts, 10, 21)) + } + } +} diff --git a/tests/baselines/reference/mergedModuleDeclarationCodeGen.types b/tests/baselines/reference/mergedModuleDeclarationCodeGen.types new file mode 100644 index 00000000000..8d250250323 --- /dev/null +++ b/tests/baselines/reference/mergedModuleDeclarationCodeGen.types @@ -0,0 +1,31 @@ +=== tests/cases/compiler/mergedModuleDeclarationCodeGen.ts === +export module X { +>X : typeof X + + export module Y { +>Y : typeof Y + + class A { +>A : A + + constructor(Y: any) { +>Y : any + + new B(); +>new B() : B +>B : typeof B + } + } + } +} +export module X { +>X : typeof X + + export module Y { +>Y : typeof Y + + export class B { +>B : B + } + } +} diff --git a/tests/baselines/reference/methodContainingLocalFunction.symbols b/tests/baselines/reference/methodContainingLocalFunction.symbols index e449d68562f..0559ad5140b 100644 --- a/tests/baselines/reference/methodContainingLocalFunction.symbols +++ b/tests/baselines/reference/methodContainingLocalFunction.symbols @@ -5,7 +5,7 @@ class BugExhibition { >T : Symbol(T, Decl(methodContainingLocalFunction.ts, 1, 20)) public exhibitBug() { ->exhibitBug : Symbol(exhibitBug, Decl(methodContainingLocalFunction.ts, 1, 24)) +>exhibitBug : Symbol(BugExhibition.exhibitBug, Decl(methodContainingLocalFunction.ts, 1, 24)) function localFunction() { } >localFunction : Symbol(localFunction, Decl(methodContainingLocalFunction.ts, 2, 25)) @@ -45,7 +45,7 @@ class BugExhibition3 { >T : Symbol(T, Decl(methodContainingLocalFunction.ts, 18, 21)) public exhibitBug() { ->exhibitBug : Symbol(exhibitBug, Decl(methodContainingLocalFunction.ts, 18, 25)) +>exhibitBug : Symbol(BugExhibition3.exhibitBug, Decl(methodContainingLocalFunction.ts, 18, 25)) function localGenericFunction(u?: U) { } >localGenericFunction : Symbol(localGenericFunction, Decl(methodContainingLocalFunction.ts, 19, 25)) @@ -66,7 +66,7 @@ class C { >C : Symbol(C, Decl(methodContainingLocalFunction.ts, 24, 1)) exhibit() { ->exhibit : Symbol(exhibit, Decl(methodContainingLocalFunction.ts, 26, 9)) +>exhibit : Symbol(C.exhibit, Decl(methodContainingLocalFunction.ts, 26, 9)) var funcExpr = (u?: U) => { }; >funcExpr : Symbol(funcExpr, Decl(methodContainingLocalFunction.ts, 28, 11)) diff --git a/tests/baselines/reference/methodSignatureDeclarationEmit1.symbols b/tests/baselines/reference/methodSignatureDeclarationEmit1.symbols index 80e0d2e1e6c..d562b80d5dc 100644 --- a/tests/baselines/reference/methodSignatureDeclarationEmit1.symbols +++ b/tests/baselines/reference/methodSignatureDeclarationEmit1.symbols @@ -3,15 +3,15 @@ class C { >C : Symbol(C, Decl(methodSignatureDeclarationEmit1.ts, 0, 0)) public foo(n: number): void; ->foo : Symbol(foo, Decl(methodSignatureDeclarationEmit1.ts, 0, 9), Decl(methodSignatureDeclarationEmit1.ts, 1, 30), Decl(methodSignatureDeclarationEmit1.ts, 2, 30)) +>foo : Symbol(C.foo, Decl(methodSignatureDeclarationEmit1.ts, 0, 9), Decl(methodSignatureDeclarationEmit1.ts, 1, 30), Decl(methodSignatureDeclarationEmit1.ts, 2, 30)) >n : Symbol(n, Decl(methodSignatureDeclarationEmit1.ts, 1, 13)) public foo(s: string): void; ->foo : Symbol(foo, Decl(methodSignatureDeclarationEmit1.ts, 0, 9), Decl(methodSignatureDeclarationEmit1.ts, 1, 30), Decl(methodSignatureDeclarationEmit1.ts, 2, 30)) +>foo : Symbol(C.foo, Decl(methodSignatureDeclarationEmit1.ts, 0, 9), Decl(methodSignatureDeclarationEmit1.ts, 1, 30), Decl(methodSignatureDeclarationEmit1.ts, 2, 30)) >s : Symbol(s, Decl(methodSignatureDeclarationEmit1.ts, 2, 13)) public foo(a: any): void { ->foo : Symbol(foo, Decl(methodSignatureDeclarationEmit1.ts, 0, 9), Decl(methodSignatureDeclarationEmit1.ts, 1, 30), Decl(methodSignatureDeclarationEmit1.ts, 2, 30)) +>foo : Symbol(C.foo, Decl(methodSignatureDeclarationEmit1.ts, 0, 9), Decl(methodSignatureDeclarationEmit1.ts, 1, 30), Decl(methodSignatureDeclarationEmit1.ts, 2, 30)) >a : Symbol(a, Decl(methodSignatureDeclarationEmit1.ts, 3, 13)) } } diff --git a/tests/baselines/reference/mismatchedGenericArguments1.symbols b/tests/baselines/reference/mismatchedGenericArguments1.symbols index f540c3d7ccb..f0f7b99759e 100644 --- a/tests/baselines/reference/mismatchedGenericArguments1.symbols +++ b/tests/baselines/reference/mismatchedGenericArguments1.symbols @@ -4,7 +4,7 @@ interface IFoo { >T : Symbol(T, Decl(mismatchedGenericArguments1.ts, 0, 15)) foo(x: T): T; ->foo : Symbol(foo, Decl(mismatchedGenericArguments1.ts, 0, 19)) +>foo : Symbol(IFoo.foo, Decl(mismatchedGenericArguments1.ts, 0, 19)) >T : Symbol(T, Decl(mismatchedGenericArguments1.ts, 1, 7)) >x : Symbol(x, Decl(mismatchedGenericArguments1.ts, 1, 10)) >T : Symbol(T, Decl(mismatchedGenericArguments1.ts, 1, 7)) @@ -17,7 +17,7 @@ class C implements IFoo { >T : Symbol(T, Decl(mismatchedGenericArguments1.ts, 3, 8)) foo(x: string): number { ->foo : Symbol(foo, Decl(mismatchedGenericArguments1.ts, 3, 31)) +>foo : Symbol(C.foo, Decl(mismatchedGenericArguments1.ts, 3, 31)) >x : Symbol(x, Decl(mismatchedGenericArguments1.ts, 4, 7)) return null; @@ -31,7 +31,7 @@ class C2 implements IFoo { >T : Symbol(T, Decl(mismatchedGenericArguments1.ts, 9, 9)) foo(x: string): number { ->foo : Symbol(foo, Decl(mismatchedGenericArguments1.ts, 9, 32)) +>foo : Symbol(C2.foo, Decl(mismatchedGenericArguments1.ts, 9, 32)) >U : Symbol(U, Decl(mismatchedGenericArguments1.ts, 10, 7)) >x : Symbol(x, Decl(mismatchedGenericArguments1.ts, 10, 10)) diff --git a/tests/baselines/reference/missingImportAfterModuleImport.symbols b/tests/baselines/reference/missingImportAfterModuleImport.symbols index 3ed1d93431c..5493d58c528 100644 --- a/tests/baselines/reference/missingImportAfterModuleImport.symbols +++ b/tests/baselines/reference/missingImportAfterModuleImport.symbols @@ -8,7 +8,7 @@ class MainModule { // public static SubModule: SubModule; public SubModule: SubModule; ->SubModule : Symbol(SubModule, Decl(missingImportAfterModuleImport_1.ts, 2, 18)) +>SubModule : Symbol(MainModule.SubModule, Decl(missingImportAfterModuleImport_1.ts, 2, 18)) >SubModule : Symbol(SubModule, Decl(missingImportAfterModuleImport_1.ts, 0, 0)) constructor() { } @@ -27,7 +27,7 @@ declare module "SubModule" { >StaticVar : Symbol(SubModule.StaticVar, Decl(missingImportAfterModuleImport_0.ts, 2, 21)) public InstanceVar: number; ->InstanceVar : Symbol(InstanceVar, Decl(missingImportAfterModuleImport_0.ts, 3, 40)) +>InstanceVar : Symbol(SubModule.InstanceVar, Decl(missingImportAfterModuleImport_0.ts, 3, 40)) constructor(); } diff --git a/tests/baselines/reference/missingSelf.symbols b/tests/baselines/reference/missingSelf.symbols index b4b5bd0b905..8822ca416c0 100644 --- a/tests/baselines/reference/missingSelf.symbols +++ b/tests/baselines/reference/missingSelf.symbols @@ -3,26 +3,26 @@ class CalcButton >CalcButton : Symbol(CalcButton, Decl(missingSelf.ts, 0, 0)) { public a() { this.onClick(); } ->a : Symbol(a, Decl(missingSelf.ts, 1, 1)) ->this.onClick : Symbol(onClick, Decl(missingSelf.ts, 2, 34)) +>a : Symbol(CalcButton.a, Decl(missingSelf.ts, 1, 1)) +>this.onClick : Symbol(CalcButton.onClick, Decl(missingSelf.ts, 2, 34)) >this : Symbol(CalcButton, Decl(missingSelf.ts, 0, 0)) ->onClick : Symbol(onClick, Decl(missingSelf.ts, 2, 34)) +>onClick : Symbol(CalcButton.onClick, Decl(missingSelf.ts, 2, 34)) public onClick() { } ->onClick : Symbol(onClick, Decl(missingSelf.ts, 2, 34)) +>onClick : Symbol(CalcButton.onClick, Decl(missingSelf.ts, 2, 34)) } class CalcButton2 >CalcButton2 : Symbol(CalcButton2, Decl(missingSelf.ts, 4, 1)) { public b() { () => this.onClick(); } ->b : Symbol(b, Decl(missingSelf.ts, 7, 1)) ->this.onClick : Symbol(onClick, Decl(missingSelf.ts, 8, 40)) +>b : Symbol(CalcButton2.b, Decl(missingSelf.ts, 7, 1)) +>this.onClick : Symbol(CalcButton2.onClick, Decl(missingSelf.ts, 8, 40)) >this : Symbol(CalcButton2, Decl(missingSelf.ts, 4, 1)) ->onClick : Symbol(onClick, Decl(missingSelf.ts, 8, 40)) +>onClick : Symbol(CalcButton2.onClick, Decl(missingSelf.ts, 8, 40)) public onClick() { } ->onClick : Symbol(onClick, Decl(missingSelf.ts, 8, 40)) +>onClick : Symbol(CalcButton2.onClick, Decl(missingSelf.ts, 8, 40)) } var c = new CalcButton(); diff --git a/tests/baselines/reference/missingTypeArguments3.symbols b/tests/baselines/reference/missingTypeArguments3.symbols index 4bd7943eace..d23f8da313f 100644 --- a/tests/baselines/reference/missingTypeArguments3.symbols +++ b/tests/baselines/reference/missingTypeArguments3.symbols @@ -7,13 +7,13 @@ declare module linq { >T : Symbol(T, Decl(missingTypeArguments3.ts, 2, 25)) OrderByDescending(keySelector?: string): OrderedEnumerable; ->OrderByDescending : Symbol(OrderByDescending, Decl(missingTypeArguments3.ts, 2, 29)) +>OrderByDescending : Symbol(Enumerable.OrderByDescending, Decl(missingTypeArguments3.ts, 2, 29)) >keySelector : Symbol(keySelector, Decl(missingTypeArguments3.ts, 3, 26)) >OrderedEnumerable : Symbol(OrderedEnumerable, Decl(missingTypeArguments3.ts, 7, 5)) >T : Symbol(T, Decl(missingTypeArguments3.ts, 2, 25)) GroupBy(keySelector: (element: T) => TKey): Enumerable>; ->GroupBy : Symbol(GroupBy, Decl(missingTypeArguments3.ts, 3, 70), Decl(missingTypeArguments3.ts, 4, 88)) +>GroupBy : Symbol(Enumerable.GroupBy, Decl(missingTypeArguments3.ts, 3, 70), Decl(missingTypeArguments3.ts, 4, 88)) >TKey : Symbol(TKey, Decl(missingTypeArguments3.ts, 4, 16)) >keySelector : Symbol(keySelector, Decl(missingTypeArguments3.ts, 4, 22)) >element : Symbol(element, Decl(missingTypeArguments3.ts, 4, 36)) @@ -25,7 +25,7 @@ declare module linq { >T : Symbol(T, Decl(missingTypeArguments3.ts, 2, 25)) GroupBy(keySelector: (element: T) => TKey, elementSelector: (element: T) => TElement): Enumerable>; ->GroupBy : Symbol(GroupBy, Decl(missingTypeArguments3.ts, 3, 70), Decl(missingTypeArguments3.ts, 4, 88)) +>GroupBy : Symbol(Enumerable.GroupBy, Decl(missingTypeArguments3.ts, 3, 70), Decl(missingTypeArguments3.ts, 4, 88)) >TKey : Symbol(TKey, Decl(missingTypeArguments3.ts, 5, 16)) >TElement : Symbol(TElement, Decl(missingTypeArguments3.ts, 5, 21)) >keySelector : Symbol(keySelector, Decl(missingTypeArguments3.ts, 5, 32)) @@ -42,7 +42,7 @@ declare module linq { >TElement : Symbol(TElement, Decl(missingTypeArguments3.ts, 5, 21)) ToDictionary(keySelector: (element: T) => TKey): Dictionary; ->ToDictionary : Symbol(ToDictionary, Decl(missingTypeArguments3.ts, 5, 148)) +>ToDictionary : Symbol(Enumerable.ToDictionary, Decl(missingTypeArguments3.ts, 5, 148)) >TKey : Symbol(TKey, Decl(missingTypeArguments3.ts, 6, 21)) >keySelector : Symbol(keySelector, Decl(missingTypeArguments3.ts, 6, 27)) >element : Symbol(element, Decl(missingTypeArguments3.ts, 6, 41)) @@ -60,7 +60,7 @@ declare module linq { >T : Symbol(T, Decl(missingTypeArguments3.ts, 9, 32)) ThenBy(keySelector: (element: T) => TCompare): OrderedEnumerable; // used to incorrectly think this was missing a type argument ->ThenBy : Symbol(ThenBy, Decl(missingTypeArguments3.ts, 9, 58)) +>ThenBy : Symbol(OrderedEnumerable.ThenBy, Decl(missingTypeArguments3.ts, 9, 58)) >TCompare : Symbol(TCompare, Decl(missingTypeArguments3.ts, 10, 15)) >keySelector : Symbol(keySelector, Decl(missingTypeArguments3.ts, 10, 25)) >element : Symbol(element, Decl(missingTypeArguments3.ts, 10, 39)) @@ -78,7 +78,7 @@ declare module linq { >TElement : Symbol(TElement, Decl(missingTypeArguments3.ts, 13, 28)) Key(): TKey; ->Key : Symbol(Key, Decl(missingTypeArguments3.ts, 13, 69)) +>Key : Symbol(Grouping.Key, Decl(missingTypeArguments3.ts, 13, 69)) >TKey : Symbol(TKey, Decl(missingTypeArguments3.ts, 13, 23)) } @@ -88,19 +88,19 @@ declare module linq { >TElement : Symbol(TElement, Decl(missingTypeArguments3.ts, 17, 26)) Count(): number; ->Count : Symbol(Count, Decl(missingTypeArguments3.ts, 17, 38)) +>Count : Symbol(Lookup.Count, Decl(missingTypeArguments3.ts, 17, 38)) Get(key): Enumerable; ->Get : Symbol(Get, Decl(missingTypeArguments3.ts, 18, 24)) +>Get : Symbol(Lookup.Get, Decl(missingTypeArguments3.ts, 18, 24)) >key : Symbol(key, Decl(missingTypeArguments3.ts, 19, 12)) >Enumerable : Symbol(Enumerable, Decl(missingTypeArguments3.ts, 0, 21)) Contains(key): boolean; ->Contains : Symbol(Contains, Decl(missingTypeArguments3.ts, 19, 34)) +>Contains : Symbol(Lookup.Contains, Decl(missingTypeArguments3.ts, 19, 34)) >key : Symbol(key, Decl(missingTypeArguments3.ts, 20, 17)) ToEnumerable(): Enumerable>; ->ToEnumerable : Symbol(ToEnumerable, Decl(missingTypeArguments3.ts, 20, 31)) +>ToEnumerable : Symbol(Lookup.ToEnumerable, Decl(missingTypeArguments3.ts, 20, 31)) >Enumerable : Symbol(Enumerable, Decl(missingTypeArguments3.ts, 0, 21)) >Grouping : Symbol(Grouping, Decl(missingTypeArguments3.ts, 11, 5)) >TKey : Symbol(TKey, Decl(missingTypeArguments3.ts, 17, 21)) @@ -112,43 +112,43 @@ declare module linq { >TValue : Symbol(TValue, Decl(missingTypeArguments3.ts, 24, 30)) Add(key: TKey, value: TValue): void; ->Add : Symbol(Add, Decl(missingTypeArguments3.ts, 24, 40)) +>Add : Symbol(Dictionary.Add, Decl(missingTypeArguments3.ts, 24, 40)) >key : Symbol(key, Decl(missingTypeArguments3.ts, 25, 12)) >TKey : Symbol(TKey, Decl(missingTypeArguments3.ts, 24, 25)) >value : Symbol(value, Decl(missingTypeArguments3.ts, 25, 22)) >TValue : Symbol(TValue, Decl(missingTypeArguments3.ts, 24, 30)) Get(ke: TKey): TValue; ->Get : Symbol(Get, Decl(missingTypeArguments3.ts, 25, 44)) +>Get : Symbol(Dictionary.Get, Decl(missingTypeArguments3.ts, 25, 44)) >ke : Symbol(ke, Decl(missingTypeArguments3.ts, 26, 12)) >TKey : Symbol(TKey, Decl(missingTypeArguments3.ts, 24, 25)) >TValue : Symbol(TValue, Decl(missingTypeArguments3.ts, 24, 30)) Set(key: TKey, value: TValue): boolean; ->Set : Symbol(Set, Decl(missingTypeArguments3.ts, 26, 30)) +>Set : Symbol(Dictionary.Set, Decl(missingTypeArguments3.ts, 26, 30)) >key : Symbol(key, Decl(missingTypeArguments3.ts, 27, 12)) >TKey : Symbol(TKey, Decl(missingTypeArguments3.ts, 24, 25)) >value : Symbol(value, Decl(missingTypeArguments3.ts, 27, 22)) >TValue : Symbol(TValue, Decl(missingTypeArguments3.ts, 24, 30)) Contains(key: TKey): boolean; ->Contains : Symbol(Contains, Decl(missingTypeArguments3.ts, 27, 47)) +>Contains : Symbol(Dictionary.Contains, Decl(missingTypeArguments3.ts, 27, 47)) >key : Symbol(key, Decl(missingTypeArguments3.ts, 28, 17)) >TKey : Symbol(TKey, Decl(missingTypeArguments3.ts, 24, 25)) Clear(): void; ->Clear : Symbol(Clear, Decl(missingTypeArguments3.ts, 28, 37)) +>Clear : Symbol(Dictionary.Clear, Decl(missingTypeArguments3.ts, 28, 37)) Remove(key: TKey): void; ->Remove : Symbol(Remove, Decl(missingTypeArguments3.ts, 29, 22)) +>Remove : Symbol(Dictionary.Remove, Decl(missingTypeArguments3.ts, 29, 22)) >key : Symbol(key, Decl(missingTypeArguments3.ts, 30, 15)) >TKey : Symbol(TKey, Decl(missingTypeArguments3.ts, 24, 25)) Count(): number; ->Count : Symbol(Count, Decl(missingTypeArguments3.ts, 30, 32)) +>Count : Symbol(Dictionary.Count, Decl(missingTypeArguments3.ts, 30, 32)) ToEnumerable(): Enumerable>; ->ToEnumerable : Symbol(ToEnumerable, Decl(missingTypeArguments3.ts, 31, 24)) +>ToEnumerable : Symbol(Dictionary.ToEnumerable, Decl(missingTypeArguments3.ts, 31, 24)) >Enumerable : Symbol(Enumerable, Decl(missingTypeArguments3.ts, 0, 21)) >KeyValuePair : Symbol(KeyValuePair, Decl(missingTypeArguments3.ts, 33, 5)) >TKey : Symbol(TKey, Decl(missingTypeArguments3.ts, 24, 25)) @@ -161,11 +161,11 @@ declare module linq { >TValue : Symbol(TValue, Decl(missingTypeArguments3.ts, 35, 32)) Key: TKey; ->Key : Symbol(Key, Decl(missingTypeArguments3.ts, 35, 42)) +>Key : Symbol(KeyValuePair.Key, Decl(missingTypeArguments3.ts, 35, 42)) >TKey : Symbol(TKey, Decl(missingTypeArguments3.ts, 35, 27)) Value: TValue; ->Value : Symbol(Value, Decl(missingTypeArguments3.ts, 36, 18)) +>Value : Symbol(KeyValuePair.Value, Decl(missingTypeArguments3.ts, 36, 18)) >TValue : Symbol(TValue, Decl(missingTypeArguments3.ts, 35, 32)) } } diff --git a/tests/baselines/reference/mixedExports.symbols b/tests/baselines/reference/mixedExports.symbols index 317b60e0a8c..1ebcd5d080a 100644 --- a/tests/baselines/reference/mixedExports.symbols +++ b/tests/baselines/reference/mixedExports.symbols @@ -27,12 +27,12 @@ module A { interface X {x} >X : Symbol(X, Decl(mixedExports.ts, 11, 10), Decl(mixedExports.ts, 12, 20), Decl(mixedExports.ts, 13, 23)) ->x : Symbol(x, Decl(mixedExports.ts, 12, 18)) +>x : Symbol(X.x, Decl(mixedExports.ts, 12, 18)) export module X {} >X : Symbol(X, Decl(mixedExports.ts, 12, 20)) interface X {y} >X : Symbol(X, Decl(mixedExports.ts, 11, 10), Decl(mixedExports.ts, 12, 20), Decl(mixedExports.ts, 13, 23)) ->y : Symbol(y, Decl(mixedExports.ts, 14, 18)) +>y : Symbol(X.y, Decl(mixedExports.ts, 14, 18)) } diff --git a/tests/baselines/reference/modifierOnClassDeclarationMemberInFunction.symbols b/tests/baselines/reference/modifierOnClassDeclarationMemberInFunction.symbols index a411bee09cb..b41f51ffac7 100644 --- a/tests/baselines/reference/modifierOnClassDeclarationMemberInFunction.symbols +++ b/tests/baselines/reference/modifierOnClassDeclarationMemberInFunction.symbols @@ -7,12 +7,12 @@ function f() { >C : Symbol(C, Decl(modifierOnClassDeclarationMemberInFunction.ts, 1, 14)) public baz = 1; ->baz : Symbol(baz, Decl(modifierOnClassDeclarationMemberInFunction.ts, 2, 13)) +>baz : Symbol(C.baz, Decl(modifierOnClassDeclarationMemberInFunction.ts, 2, 13)) static foo() { } >foo : Symbol(C.foo, Decl(modifierOnClassDeclarationMemberInFunction.ts, 3, 23)) public bar() { } ->bar : Symbol(bar, Decl(modifierOnClassDeclarationMemberInFunction.ts, 4, 24)) +>bar : Symbol(C.bar, Decl(modifierOnClassDeclarationMemberInFunction.ts, 4, 24)) } } diff --git a/tests/baselines/reference/modifiersOnInterfaceIndexSignature1.errors.txt b/tests/baselines/reference/modifiersOnInterfaceIndexSignature1.errors.txt index b325710a9f0..e09a73ff68a 100644 --- a/tests/baselines/reference/modifiersOnInterfaceIndexSignature1.errors.txt +++ b/tests/baselines/reference/modifiersOnInterfaceIndexSignature1.errors.txt @@ -1,9 +1,9 @@ -tests/cases/compiler/modifiersOnInterfaceIndexSignature1.ts(2,3): error TS1145: Modifiers not permitted on index signature members. +tests/cases/compiler/modifiersOnInterfaceIndexSignature1.ts(2,3): error TS1071: 'public' modifier cannot appear on an index signature. ==== tests/cases/compiler/modifiersOnInterfaceIndexSignature1.ts (1 errors) ==== interface I { public [a: string]: number; ~~~~~~ -!!! error TS1145: Modifiers not permitted on index signature members. +!!! error TS1071: 'public' modifier cannot appear on an index signature. } \ No newline at end of file diff --git a/tests/baselines/reference/modularizeLibrary_ErrorFromUsingES6ArrayWithOnlyES6ArrayLib.errors.txt b/tests/baselines/reference/modularizeLibrary_ErrorFromUsingES6ArrayWithOnlyES6ArrayLib.errors.txt new file mode 100644 index 00000000000..f796092fb14 --- /dev/null +++ b/tests/baselines/reference/modularizeLibrary_ErrorFromUsingES6ArrayWithOnlyES6ArrayLib.errors.txt @@ -0,0 +1,20 @@ +error TS2318: Cannot find global type 'Boolean'. +error TS2318: Cannot find global type 'IArguments'. +error TS2318: Cannot find global type 'Number'. +tests/cases/compiler/modularizeLibrary_ErrorFromUsingES6ArrayWithOnlyES6ArrayLib.ts(4,12): error TS2304: Cannot find name 'Array'. + + +!!! error TS2318: Cannot find global type 'Boolean'. +!!! error TS2318: Cannot find global type 'IArguments'. +!!! error TS2318: Cannot find global type 'Number'. +==== tests/cases/compiler/modularizeLibrary_ErrorFromUsingES6ArrayWithOnlyES6ArrayLib.ts (1 errors) ==== + + // Error missing basic JavaScript objects + function f(x: number, y: number, z: number) { + return Array.from(arguments); + ~~~~~ +!!! error TS2304: Cannot find name 'Array'. + } + + f(1, 2, 3); + \ No newline at end of file diff --git a/tests/baselines/reference/modularizeLibrary_ErrorFromUsingES6ArrayWithOnlyES6ArrayLib.js b/tests/baselines/reference/modularizeLibrary_ErrorFromUsingES6ArrayWithOnlyES6ArrayLib.js new file mode 100644 index 00000000000..61591a5f7e1 --- /dev/null +++ b/tests/baselines/reference/modularizeLibrary_ErrorFromUsingES6ArrayWithOnlyES6ArrayLib.js @@ -0,0 +1,16 @@ +//// [modularizeLibrary_ErrorFromUsingES6ArrayWithOnlyES6ArrayLib.ts] + +// Error missing basic JavaScript objects +function f(x: number, y: number, z: number) { + return Array.from(arguments); +} + +f(1, 2, 3); + + +//// [modularizeLibrary_ErrorFromUsingES6ArrayWithOnlyES6ArrayLib.js] +// Error missing basic JavaScript objects +function f(x, y, z) { + return Array.from(arguments); +} +f(1, 2, 3); diff --git a/tests/baselines/reference/modularizeLibrary_ErrorFromUsingES6FeaturesWithOnlyES5Lib.errors.txt b/tests/baselines/reference/modularizeLibrary_ErrorFromUsingES6FeaturesWithOnlyES5Lib.errors.txt new file mode 100644 index 00000000000..c8a69546ee0 --- /dev/null +++ b/tests/baselines/reference/modularizeLibrary_ErrorFromUsingES6FeaturesWithOnlyES5Lib.errors.txt @@ -0,0 +1,94 @@ +tests/cases/compiler/modularizeLibrary_ErrorFromUsingES6FeaturesWithOnlyES5Lib.ts(5,18): error TS2339: Property 'from' does not exist on type 'ArrayConstructor'. +tests/cases/compiler/modularizeLibrary_ErrorFromUsingES6FeaturesWithOnlyES5Lib.ts(11,13): error TS2304: Cannot find name 'Map'. +tests/cases/compiler/modularizeLibrary_ErrorFromUsingES6FeaturesWithOnlyES5Lib.ts(18,5): error TS2339: Property 'name' does not exist on type '() => void'. +tests/cases/compiler/modularizeLibrary_ErrorFromUsingES6FeaturesWithOnlyES5Lib.ts(21,6): error TS2339: Property 'sign' does not exist on type 'Math'. +tests/cases/compiler/modularizeLibrary_ErrorFromUsingES6FeaturesWithOnlyES5Lib.ts(26,6): error TS2304: Cannot find name 'Symbol'. +tests/cases/compiler/modularizeLibrary_ErrorFromUsingES6FeaturesWithOnlyES5Lib.ts(30,18): error TS2304: Cannot find name 'Symbol'. +tests/cases/compiler/modularizeLibrary_ErrorFromUsingES6FeaturesWithOnlyES5Lib.ts(34,13): error TS2304: Cannot find name 'Proxy'. +tests/cases/compiler/modularizeLibrary_ErrorFromUsingES6FeaturesWithOnlyES5Lib.ts(37,1): error TS2304: Cannot find name 'Reflect'. +tests/cases/compiler/modularizeLibrary_ErrorFromUsingES6FeaturesWithOnlyES5Lib.ts(41,5): error TS2339: Property 'flags' does not exist on type 'RegExp'. +tests/cases/compiler/modularizeLibrary_ErrorFromUsingES6FeaturesWithOnlyES5Lib.ts(45,5): error TS2339: Property 'includes' does not exist on type 'string'. +tests/cases/compiler/modularizeLibrary_ErrorFromUsingES6FeaturesWithOnlyES5Lib.ts(48,9): error TS2304: Cannot find name 'Symbol'. +tests/cases/compiler/modularizeLibrary_ErrorFromUsingES6FeaturesWithOnlyES5Lib.ts(52,6): error TS2304: Cannot find name 'Symbol'. + + +==== tests/cases/compiler/modularizeLibrary_ErrorFromUsingES6FeaturesWithOnlyES5Lib.ts (12 errors) ==== + + // All will be error from using ES6 features but only include ES5 library + // Using Es6 array + function f(x: number, y: number, z: number) { + return Array.from(arguments); + ~~~~ +!!! error TS2339: Property 'from' does not exist on type 'ArrayConstructor'. + } + + f(1, 2, 3); // no error + + // Using ES6 collection + var m = new Map(); + ~~~ +!!! error TS2304: Cannot find name 'Map'. + m.clear(); + // Using ES6 iterable + m.keys(); + + // Using ES6 function + function Baz() { } + Baz.name; + ~~~~ +!!! error TS2339: Property 'name' does not exist on type '() => void'. + + // Using ES6 math + Math.sign(1); + ~~~~ +!!! error TS2339: Property 'sign' does not exist on type 'Math'. + + // Using ES6 object + var o = { + a: 2, + [Symbol.hasInstance](value: any) { + ~~~~~~ +!!! error TS2304: Cannot find name 'Symbol'. + return false; + } + }; + o.hasOwnProperty(Symbol.hasInstance); + ~~~~~~ +!!! error TS2304: Cannot find name 'Symbol'. + + // Using Es6 proxy + var t = {} + var p = new Proxy(t, {}); + ~~~~~ +!!! error TS2304: Cannot find name 'Proxy'. + + // Using ES6 reflect + Reflect.isExtensible({}); + ~~~~~~~ +!!! error TS2304: Cannot find name 'Reflect'. + + // Using Es6 regexp + var reg = new RegExp("/s"); + reg.flags; + ~~~~~ +!!! error TS2339: Property 'flags' does not exist on type 'RegExp'. + + // Using ES6 string + var str = "Hello world"; + str.includes("hello", 0); + ~~~~~~~~ +!!! error TS2339: Property 'includes' does not exist on type 'string'. + + // Using ES6 symbol + var s = Symbol(); + ~~~~~~ +!!! error TS2304: Cannot find name 'Symbol'. + + // Using ES6 wellknown-symbol + const o1 = { + [Symbol.hasInstance](value: any) { + ~~~~~~ +!!! error TS2304: Cannot find name 'Symbol'. + return false; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/modularizeLibrary_ErrorFromUsingES6FeaturesWithOnlyES5Lib.js b/tests/baselines/reference/modularizeLibrary_ErrorFromUsingES6FeaturesWithOnlyES5Lib.js new file mode 100644 index 00000000000..257df4278fe --- /dev/null +++ b/tests/baselines/reference/modularizeLibrary_ErrorFromUsingES6FeaturesWithOnlyES5Lib.js @@ -0,0 +1,101 @@ +//// [modularizeLibrary_ErrorFromUsingES6FeaturesWithOnlyES5Lib.ts] + +// All will be error from using ES6 features but only include ES5 library +// Using Es6 array +function f(x: number, y: number, z: number) { + return Array.from(arguments); +} + +f(1, 2, 3); // no error + +// Using ES6 collection +var m = new Map(); +m.clear(); +// Using ES6 iterable +m.keys(); + +// Using ES6 function +function Baz() { } +Baz.name; + +// Using ES6 math +Math.sign(1); + +// Using ES6 object +var o = { + a: 2, + [Symbol.hasInstance](value: any) { + return false; + } +}; +o.hasOwnProperty(Symbol.hasInstance); + +// Using Es6 proxy +var t = {} +var p = new Proxy(t, {}); + +// Using ES6 reflect +Reflect.isExtensible({}); + +// Using Es6 regexp +var reg = new RegExp("/s"); +reg.flags; + +// Using ES6 string +var str = "Hello world"; +str.includes("hello", 0); + +// Using ES6 symbol +var s = Symbol(); + +// Using ES6 wellknown-symbol +const o1 = { + [Symbol.hasInstance](value: any) { + return false; + } +} + +//// [modularizeLibrary_ErrorFromUsingES6FeaturesWithOnlyES5Lib.js] +// All will be error from using ES6 features but only include ES5 library +// Using Es6 array +function f(x, y, z) { + return Array.from(arguments); +} +f(1, 2, 3); // no error +// Using ES6 collection +var m = new Map(); +m.clear(); +// Using ES6 iterable +m.keys(); +// Using ES6 function +function Baz() { } +Baz.name; +// Using ES6 math +Math.sign(1); +// Using ES6 object +var o = { + a: 2, + [Symbol.hasInstance](value) { + return false; + } +}; +o.hasOwnProperty(Symbol.hasInstance); +// Using Es6 proxy +var t = {}; +var p = new Proxy(t, {}); +// Using ES6 reflect +Reflect.isExtensible({}); +// Using Es6 regexp +var reg = new RegExp("/s"); +reg.flags; +// Using ES6 string +var str = "Hello world"; +str.includes("hello", 0); +// Using ES6 symbol +var s = Symbol(); +// Using ES6 wellknown-symbol +const o1 = { + [Symbol.hasInstance](value) { + return false; + } +}; diff --git a/tests/baselines/reference/modularizeLibrary_ErrorFromUsingWellknownSymbolWithOutES6WellknownSymbolLib.errors.txt b/tests/baselines/reference/modularizeLibrary_ErrorFromUsingWellknownSymbolWithOutES6WellknownSymbolLib.errors.txt new file mode 100644 index 00000000000..b5da9f97867 --- /dev/null +++ b/tests/baselines/reference/modularizeLibrary_ErrorFromUsingWellknownSymbolWithOutES6WellknownSymbolLib.errors.txt @@ -0,0 +1,17 @@ +tests/cases/compiler/modularizeLibrary_ErrorFromUsingWellknownSymbolWithOutES6WellknownSymbolLib.ts(8,1): error TS2322: Type 'boolean' is not assignable to type 'string'. +tests/cases/compiler/modularizeLibrary_ErrorFromUsingWellknownSymbolWithOutES6WellknownSymbolLib.ts(8,3): error TS2304: Cannot find name 'Symbol'. + + +==== tests/cases/compiler/modularizeLibrary_ErrorFromUsingWellknownSymbolWithOutES6WellknownSymbolLib.ts (2 errors) ==== + + function f(x: number, y: number, z: number) { + return Array.from(arguments); + } + + f(1, 2, 3); // no error + let a = ['c', 'd']; + a[Symbol.isConcatSpreadable] = false; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type 'boolean' is not assignable to type 'string'. + ~~~~~~ +!!! error TS2304: Cannot find name 'Symbol'. \ No newline at end of file diff --git a/tests/baselines/reference/modularizeLibrary_ErrorFromUsingWellknownSymbolWithOutES6WellknownSymbolLib.js b/tests/baselines/reference/modularizeLibrary_ErrorFromUsingWellknownSymbolWithOutES6WellknownSymbolLib.js new file mode 100644 index 00000000000..e150560cc6a --- /dev/null +++ b/tests/baselines/reference/modularizeLibrary_ErrorFromUsingWellknownSymbolWithOutES6WellknownSymbolLib.js @@ -0,0 +1,17 @@ +//// [modularizeLibrary_ErrorFromUsingWellknownSymbolWithOutES6WellknownSymbolLib.ts] + +function f(x: number, y: number, z: number) { + return Array.from(arguments); +} + +f(1, 2, 3); // no error +let a = ['c', 'd']; +a[Symbol.isConcatSpreadable] = false; + +//// [modularizeLibrary_ErrorFromUsingWellknownSymbolWithOutES6WellknownSymbolLib.js] +function f(x, y, z) { + return Array.from(arguments); +} +f(1, 2, 3); // no error +var a = ['c', 'd']; +a[Symbol.isConcatSpreadable] = false; diff --git a/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions1.js b/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions1.js new file mode 100644 index 00000000000..9a5ed619b2d --- /dev/null +++ b/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions1.js @@ -0,0 +1,158 @@ +//// [modularizeLibrary_NoErrorDuplicateLibOptions1.ts] + +// Using Es6 array +function f(x: number, y: number, z: number) { + return Array.from(arguments); +} + +f(1, 2, 3); // no error + +// Using ES6 collection +var m = new Map(); +m.clear(); +// Using ES6 iterable +m.keys(); + +// Using ES6 function +function Baz() { } +Baz.name; + +// Using ES6 generator +function* gen() { + let i = 0; + while (i < 10) { + yield i; + i++; + } +} + +function* gen2() { + let i = 0; + while (i < 10) { + yield i; + i++; + } +} + +// Using ES6 math +Math.sign(1); + +// Using ES6 object +var o = { + a: 2, + [Symbol.hasInstance](value: any) { + return false; + } +}; +o.hasOwnProperty(Symbol.hasInstance); + +// Using ES6 promise +async function out() { + return new Promise(function (resolve, reject) {}); +} + +declare var console: any; +out().then(() => { + console.log("Yea!"); +}); + +// Using Es6 proxy +var t = {} +var p = new Proxy(t, {}); + +// Using ES6 reflect +Reflect.isExtensible({}); + +// Using Es6 regexp +var reg = new RegExp("/s"); +reg.flags; + +// Using ES6 string +var str = "Hello world"; +str.includes("hello", 0); + +// Using ES6 symbol +var s = Symbol(); + +// Using ES6 wellknown-symbol +const o1 = { + [Symbol.hasInstance](value: any) { + return false; + } +} + +//// [modularizeLibrary_NoErrorDuplicateLibOptions1.js] +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator.throw(value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments)).next()); + }); +}; +// Using Es6 array +function f(x, y, z) { + return Array.from(arguments); +} +f(1, 2, 3); // no error +// Using ES6 collection +var m = new Map(); +m.clear(); +// Using ES6 iterable +m.keys(); +// Using ES6 function +function Baz() { } +Baz.name; +// Using ES6 generator +function* gen() { + let i = 0; + while (i < 10) { + yield i; + i++; + } +} +function* gen2() { + let i = 0; + while (i < 10) { + yield i; + i++; + } +} +// Using ES6 math +Math.sign(1); +// Using ES6 object +var o = { + a: 2, + [Symbol.hasInstance](value) { + return false; + } +}; +o.hasOwnProperty(Symbol.hasInstance); +// Using ES6 promise +function out() { + return __awaiter(this, void 0, void 0, function* () { + return new Promise(function (resolve, reject) { }); + }); +} +out().then(() => { + console.log("Yea!"); +}); +// Using Es6 proxy +var t = {}; +var p = new Proxy(t, {}); +// Using ES6 reflect +Reflect.isExtensible({}); +// Using Es6 regexp +var reg = new RegExp("/s"); +reg.flags; +// Using ES6 string +var str = "Hello world"; +str.includes("hello", 0); +// Using ES6 symbol +var s = Symbol(); +// Using ES6 wellknown-symbol +const o1 = { + [Symbol.hasInstance](value) { + return false; + } +}; diff --git a/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions1.symbols b/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions1.symbols new file mode 100644 index 00000000000..3bbe91bc9fa --- /dev/null +++ b/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions1.symbols @@ -0,0 +1,184 @@ +=== tests/cases/compiler/modularizeLibrary_NoErrorDuplicateLibOptions1.ts === + +// Using Es6 array +function f(x: number, y: number, z: number) { +>f : Symbol(f, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 0, 0)) +>x : Symbol(x, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 2, 11)) +>y : Symbol(y, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 2, 21)) +>z : Symbol(z, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 2, 32)) + + return Array.from(arguments); +>Array.from : Symbol(ArrayConstructor.from, Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>Array : Symbol(Array, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>from : Symbol(ArrayConstructor.from, Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>arguments : Symbol(arguments) +} + +f(1, 2, 3); // no error +>f : Symbol(f, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 0, 0)) + +// Using ES6 collection +var m = new Map(); +>m : Symbol(m, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 9, 3)) +>Map : Symbol(Map, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --)) + +m.clear(); +>m.clear : Symbol(Map.clear, Decl(lib.es2015.collection.d.ts, --, --)) +>m : Symbol(m, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 9, 3)) +>clear : Symbol(Map.clear, Decl(lib.es2015.collection.d.ts, --, --)) + +// Using ES6 iterable +m.keys(); +>m.keys : Symbol(Map.keys, Decl(lib.es2015.iterable.d.ts, --, --)) +>m : Symbol(m, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 9, 3)) +>keys : Symbol(Map.keys, Decl(lib.es2015.iterable.d.ts, --, --)) + +// Using ES6 function +function Baz() { } +>Baz : Symbol(Baz, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 12, 9)) + +Baz.name; +>Baz.name : Symbol(Function.name, Decl(lib.es2015.core.d.ts, --, --)) +>Baz : Symbol(Baz, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 12, 9)) +>name : Symbol(Function.name, Decl(lib.es2015.core.d.ts, --, --)) + +// Using ES6 generator +function* gen() { +>gen : Symbol(gen, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 16, 9)) + + let i = 0; +>i : Symbol(i, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 20, 7)) + + while (i < 10) { +>i : Symbol(i, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 20, 7)) + + yield i; +>i : Symbol(i, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 20, 7)) + + i++; +>i : Symbol(i, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 20, 7)) + } +} + +function* gen2() { +>gen2 : Symbol(gen2, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 25, 1)) + + let i = 0; +>i : Symbol(i, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 28, 7)) + + while (i < 10) { +>i : Symbol(i, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 28, 7)) + + yield i; +>i : Symbol(i, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 28, 7)) + + i++; +>i : Symbol(i, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 28, 7)) + } +} + +// Using ES6 math +Math.sign(1); +>Math.sign : Symbol(Math.sign, Decl(lib.es2015.core.d.ts, --, --)) +>Math : Symbol(Math, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>sign : Symbol(Math.sign, Decl(lib.es2015.core.d.ts, --, --)) + +// Using ES6 object +var o = { +>o : Symbol(o, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 39, 3)) + + a: 2, +>a : Symbol(a, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 39, 9)) + + [Symbol.hasInstance](value: any) { +>Symbol.hasInstance : Symbol(SymbolConstructor.hasInstance, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>hasInstance : Symbol(SymbolConstructor.hasInstance, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>value : Symbol(value, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 41, 25)) + + return false; + } +}; +o.hasOwnProperty(Symbol.hasInstance); +>o.hasOwnProperty : Symbol(Object.hasOwnProperty, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>o : Symbol(o, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 39, 3)) +>hasOwnProperty : Symbol(Object.hasOwnProperty, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>Symbol.hasInstance : Symbol(SymbolConstructor.hasInstance, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>hasInstance : Symbol(SymbolConstructor.hasInstance, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) + +// Using ES6 promise +async function out() { +>out : Symbol(out, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 45, 37)) + + return new Promise(function (resolve, reject) {}); +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>resolve : Symbol(resolve, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 49, 33)) +>reject : Symbol(reject, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 49, 41)) +} + +declare var console: any; +>console : Symbol(console, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 52, 11)) + +out().then(() => { +>out().then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>out : Symbol(out, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 45, 37)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + + console.log("Yea!"); +>console : Symbol(console, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 52, 11)) + +}); + +// Using Es6 proxy +var t = {} +>t : Symbol(t, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 58, 3)) + +var p = new Proxy(t, {}); +>p : Symbol(p, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 59, 3)) +>Proxy : Symbol(Proxy, Decl(lib.es2015.proxy.d.ts, --, --)) +>t : Symbol(t, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 58, 3)) + +// Using ES6 reflect +Reflect.isExtensible({}); +>Reflect.isExtensible : Symbol(Reflect.isExtensible, Decl(lib.es2015.reflect.d.ts, --, --)) +>Reflect : Symbol(Reflect, Decl(lib.es2015.reflect.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>isExtensible : Symbol(Reflect.isExtensible, Decl(lib.es2015.reflect.d.ts, --, --)) + +// Using Es6 regexp +var reg = new RegExp("/s"); +>reg : Symbol(reg, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 65, 3)) +>RegExp : Symbol(RegExp, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + +reg.flags; +>reg.flags : Symbol(RegExp.flags, Decl(lib.es2015.core.d.ts, --, --)) +>reg : Symbol(reg, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 65, 3)) +>flags : Symbol(RegExp.flags, Decl(lib.es2015.core.d.ts, --, --)) + +// Using ES6 string +var str = "Hello world"; +>str : Symbol(str, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 69, 3)) + +str.includes("hello", 0); +>str.includes : Symbol(String.includes, Decl(lib.es2015.core.d.ts, --, --)) +>str : Symbol(str, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 69, 3)) +>includes : Symbol(String.includes, Decl(lib.es2015.core.d.ts, --, --)) + +// Using ES6 symbol +var s = Symbol(); +>s : Symbol(s, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 73, 3)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) + +// Using ES6 wellknown-symbol +const o1 = { +>o1 : Symbol(o1, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 76, 5)) + + [Symbol.hasInstance](value: any) { +>Symbol.hasInstance : Symbol(SymbolConstructor.hasInstance, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>hasInstance : Symbol(SymbolConstructor.hasInstance, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>value : Symbol(value, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 77, 25)) + + return false; + } +} diff --git a/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions1.types b/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions1.types new file mode 100644 index 00000000000..16051c14b7c --- /dev/null +++ b/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions1.types @@ -0,0 +1,231 @@ +=== tests/cases/compiler/modularizeLibrary_NoErrorDuplicateLibOptions1.ts === + +// Using Es6 array +function f(x: number, y: number, z: number) { +>f : (x: number, y: number, z: number) => any[] +>x : number +>y : number +>z : number + + return Array.from(arguments); +>Array.from(arguments) : any[] +>Array.from : { (iterable: Iterable, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; (iterable: Iterable): T[]; (arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; (arrayLike: ArrayLike): T[]; } +>Array : ArrayConstructor +>from : { (iterable: Iterable, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; (iterable: Iterable): T[]; (arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; (arrayLike: ArrayLike): T[]; } +>arguments : IArguments +} + +f(1, 2, 3); // no error +>f(1, 2, 3) : any[] +>f : (x: number, y: number, z: number) => any[] +>1 : number +>2 : number +>3 : number + +// Using ES6 collection +var m = new Map(); +>m : Map +>new Map() : Map +>Map : MapConstructor + +m.clear(); +>m.clear() : void +>m.clear : () => void +>m : Map +>clear : () => void + +// Using ES6 iterable +m.keys(); +>m.keys() : IterableIterator +>m.keys : () => IterableIterator +>m : Map +>keys : () => IterableIterator + +// Using ES6 function +function Baz() { } +>Baz : () => void + +Baz.name; +>Baz.name : string +>Baz : () => void +>name : string + +// Using ES6 generator +function* gen() { +>gen : () => IterableIterator + + let i = 0; +>i : number +>0 : number + + while (i < 10) { +>i < 10 : boolean +>i : number +>10 : number + + yield i; +>yield i : any +>i : number + + i++; +>i++ : number +>i : number + } +} + +function* gen2() { +>gen2 : () => IterableIterator + + let i = 0; +>i : number +>0 : number + + while (i < 10) { +>i < 10 : boolean +>i : number +>10 : number + + yield i; +>yield i : any +>i : number + + i++; +>i++ : number +>i : number + } +} + +// Using ES6 math +Math.sign(1); +>Math.sign(1) : number +>Math.sign : (x: number) => number +>Math : Math +>sign : (x: number) => number +>1 : number + +// Using ES6 object +var o = { +>o : { a: number; [Symbol.hasInstance](value: any): boolean; } +>{ a: 2, [Symbol.hasInstance](value: any) { return false; }} : { a: number; [Symbol.hasInstance](value: any): boolean; } + + a: 2, +>a : number +>2 : number + + [Symbol.hasInstance](value: any) { +>Symbol.hasInstance : symbol +>Symbol : SymbolConstructor +>hasInstance : symbol +>value : any + + return false; +>false : boolean + } +}; +o.hasOwnProperty(Symbol.hasInstance); +>o.hasOwnProperty(Symbol.hasInstance) : boolean +>o.hasOwnProperty : { (v: string | number | symbol): boolean; (v: string): boolean; } +>o : { a: number; [Symbol.hasInstance](value: any): boolean; } +>hasOwnProperty : { (v: string | number | symbol): boolean; (v: string): boolean; } +>Symbol.hasInstance : symbol +>Symbol : SymbolConstructor +>hasInstance : symbol + +// Using ES6 promise +async function out() { +>out : () => Promise<{}> + + return new Promise(function (resolve, reject) {}); +>new Promise(function (resolve, reject) {}) : Promise<{}> +>Promise : PromiseConstructor +>function (resolve, reject) {} : (resolve: (value?: {} | PromiseLike<{}>) => void, reject: (reason?: any) => void) => void +>resolve : (value?: {} | PromiseLike<{}>) => void +>reject : (reason?: any) => void +} + +declare var console: any; +>console : any + +out().then(() => { +>out().then(() => { console.log("Yea!");}) : Promise +>out().then : { (onfulfilled?: (value: {}) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled?: (value: {}) => TResult | PromiseLike, onrejected?: (reason: any) => void): Promise; } +>out() : Promise<{}> +>out : () => Promise<{}> +>then : { (onfulfilled?: (value: {}) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled?: (value: {}) => TResult | PromiseLike, onrejected?: (reason: any) => void): Promise; } +>() => { console.log("Yea!");} : () => void + + console.log("Yea!"); +>console.log("Yea!") : any +>console.log : any +>console : any +>log : any +>"Yea!" : string + +}); + +// Using Es6 proxy +var t = {} +>t : {} +>{} : {} + +var p = new Proxy(t, {}); +>p : {} +>new Proxy(t, {}) : {} +>Proxy : ProxyConstructor +>t : {} +>{} : {} + +// Using ES6 reflect +Reflect.isExtensible({}); +>Reflect.isExtensible({}) : boolean +>Reflect.isExtensible : (target: any) => boolean +>Reflect : typeof Reflect +>isExtensible : (target: any) => boolean +>{} : {} + +// Using Es6 regexp +var reg = new RegExp("/s"); +>reg : RegExp +>new RegExp("/s") : RegExp +>RegExp : RegExpConstructor +>"/s" : string + +reg.flags; +>reg.flags : string +>reg : RegExp +>flags : string + +// Using ES6 string +var str = "Hello world"; +>str : string +>"Hello world" : string + +str.includes("hello", 0); +>str.includes("hello", 0) : boolean +>str.includes : (searchString: string, position?: number) => boolean +>str : string +>includes : (searchString: string, position?: number) => boolean +>"hello" : string +>0 : number + +// Using ES6 symbol +var s = Symbol(); +>s : symbol +>Symbol() : symbol +>Symbol : SymbolConstructor + +// Using ES6 wellknown-symbol +const o1 = { +>o1 : { [Symbol.hasInstance](value: any): boolean; } +>{ [Symbol.hasInstance](value: any) { return false; }} : { [Symbol.hasInstance](value: any): boolean; } + + [Symbol.hasInstance](value: any) { +>Symbol.hasInstance : symbol +>Symbol : SymbolConstructor +>hasInstance : symbol +>value : any + + return false; +>false : boolean + } +} diff --git a/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions2.js b/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions2.js new file mode 100644 index 00000000000..c4c2d6853af --- /dev/null +++ b/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions2.js @@ -0,0 +1,158 @@ +//// [modularizeLibrary_NoErrorDuplicateLibOptions2.ts] + +// Using Es6 array +function f(x: number, y: number, z: number) { + return Array.from(arguments); +} + +f(1, 2, 3); // no error + +// Using ES6 collection +var m = new Map(); +m.clear(); +// Using ES6 iterable +m.keys(); + +// Using ES6 function +function Baz() { } +Baz.name; + +// Using ES6 generator +function* gen() { + let i = 0; + while (i < 10) { + yield i; + i++; + } +} + +function* gen2() { + let i = 0; + while (i < 10) { + yield i; + i++; + } +} + +// Using ES6 math +Math.sign(1); + +// Using ES6 object +var o = { + a: 2, + [Symbol.hasInstance](value: any) { + return false; + } +}; +o.hasOwnProperty(Symbol.hasInstance); + +// Using ES6 promise +async function out() { + return new Promise(function (resolve, reject) {}); +} + +declare var console: any; +out().then(() => { + console.log("Yea!"); +}); + +// Using Es6 proxy +var t = {} +var p = new Proxy(t, {}); + +// Using ES6 reflect +Reflect.isExtensible({}); + +// Using Es6 regexp +var reg = new RegExp("/s"); +reg.flags; + +// Using ES6 string +var str = "Hello world"; +str.includes("hello", 0); + +// Using ES6 symbol +var s = Symbol(); + +// Using ES6 wellknown-symbol +const o1 = { + [Symbol.hasInstance](value: any) { + return false; + } +} + +//// [modularizeLibrary_NoErrorDuplicateLibOptions2.js] +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator.throw(value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments)).next()); + }); +}; +// Using Es6 array +function f(x, y, z) { + return Array.from(arguments); +} +f(1, 2, 3); // no error +// Using ES6 collection +var m = new Map(); +m.clear(); +// Using ES6 iterable +m.keys(); +// Using ES6 function +function Baz() { } +Baz.name; +// Using ES6 generator +function* gen() { + let i = 0; + while (i < 10) { + yield i; + i++; + } +} +function* gen2() { + let i = 0; + while (i < 10) { + yield i; + i++; + } +} +// Using ES6 math +Math.sign(1); +// Using ES6 object +var o = { + a: 2, + [Symbol.hasInstance](value) { + return false; + } +}; +o.hasOwnProperty(Symbol.hasInstance); +// Using ES6 promise +function out() { + return __awaiter(this, void 0, void 0, function* () { + return new Promise(function (resolve, reject) { }); + }); +} +out().then(() => { + console.log("Yea!"); +}); +// Using Es6 proxy +var t = {}; +var p = new Proxy(t, {}); +// Using ES6 reflect +Reflect.isExtensible({}); +// Using Es6 regexp +var reg = new RegExp("/s"); +reg.flags; +// Using ES6 string +var str = "Hello world"; +str.includes("hello", 0); +// Using ES6 symbol +var s = Symbol(); +// Using ES6 wellknown-symbol +const o1 = { + [Symbol.hasInstance](value) { + return false; + } +}; diff --git a/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions2.symbols b/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions2.symbols new file mode 100644 index 00000000000..89cb8fe7179 --- /dev/null +++ b/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions2.symbols @@ -0,0 +1,184 @@ +=== tests/cases/compiler/modularizeLibrary_NoErrorDuplicateLibOptions2.ts === + +// Using Es6 array +function f(x: number, y: number, z: number) { +>f : Symbol(f, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 0, 0)) +>x : Symbol(x, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 2, 11)) +>y : Symbol(y, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 2, 21)) +>z : Symbol(z, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 2, 32)) + + return Array.from(arguments); +>Array.from : Symbol(ArrayConstructor.from, Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>Array : Symbol(Array, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>from : Symbol(ArrayConstructor.from, Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>arguments : Symbol(arguments) +} + +f(1, 2, 3); // no error +>f : Symbol(f, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 0, 0)) + +// Using ES6 collection +var m = new Map(); +>m : Symbol(m, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 9, 3)) +>Map : Symbol(Map, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --)) + +m.clear(); +>m.clear : Symbol(Map.clear, Decl(lib.es2015.collection.d.ts, --, --)) +>m : Symbol(m, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 9, 3)) +>clear : Symbol(Map.clear, Decl(lib.es2015.collection.d.ts, --, --)) + +// Using ES6 iterable +m.keys(); +>m.keys : Symbol(Map.keys, Decl(lib.es2015.iterable.d.ts, --, --)) +>m : Symbol(m, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 9, 3)) +>keys : Symbol(Map.keys, Decl(lib.es2015.iterable.d.ts, --, --)) + +// Using ES6 function +function Baz() { } +>Baz : Symbol(Baz, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 12, 9)) + +Baz.name; +>Baz.name : Symbol(Function.name, Decl(lib.es2015.core.d.ts, --, --)) +>Baz : Symbol(Baz, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 12, 9)) +>name : Symbol(Function.name, Decl(lib.es2015.core.d.ts, --, --)) + +// Using ES6 generator +function* gen() { +>gen : Symbol(gen, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 16, 9)) + + let i = 0; +>i : Symbol(i, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 20, 7)) + + while (i < 10) { +>i : Symbol(i, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 20, 7)) + + yield i; +>i : Symbol(i, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 20, 7)) + + i++; +>i : Symbol(i, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 20, 7)) + } +} + +function* gen2() { +>gen2 : Symbol(gen2, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 25, 1)) + + let i = 0; +>i : Symbol(i, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 28, 7)) + + while (i < 10) { +>i : Symbol(i, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 28, 7)) + + yield i; +>i : Symbol(i, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 28, 7)) + + i++; +>i : Symbol(i, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 28, 7)) + } +} + +// Using ES6 math +Math.sign(1); +>Math.sign : Symbol(Math.sign, Decl(lib.es2015.core.d.ts, --, --)) +>Math : Symbol(Math, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>sign : Symbol(Math.sign, Decl(lib.es2015.core.d.ts, --, --)) + +// Using ES6 object +var o = { +>o : Symbol(o, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 39, 3)) + + a: 2, +>a : Symbol(a, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 39, 9)) + + [Symbol.hasInstance](value: any) { +>Symbol.hasInstance : Symbol(SymbolConstructor.hasInstance, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>hasInstance : Symbol(SymbolConstructor.hasInstance, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>value : Symbol(value, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 41, 25)) + + return false; + } +}; +o.hasOwnProperty(Symbol.hasInstance); +>o.hasOwnProperty : Symbol(Object.hasOwnProperty, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>o : Symbol(o, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 39, 3)) +>hasOwnProperty : Symbol(Object.hasOwnProperty, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>Symbol.hasInstance : Symbol(SymbolConstructor.hasInstance, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>hasInstance : Symbol(SymbolConstructor.hasInstance, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) + +// Using ES6 promise +async function out() { +>out : Symbol(out, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 45, 37)) + + return new Promise(function (resolve, reject) {}); +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>resolve : Symbol(resolve, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 49, 33)) +>reject : Symbol(reject, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 49, 41)) +} + +declare var console: any; +>console : Symbol(console, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 52, 11)) + +out().then(() => { +>out().then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>out : Symbol(out, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 45, 37)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + + console.log("Yea!"); +>console : Symbol(console, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 52, 11)) + +}); + +// Using Es6 proxy +var t = {} +>t : Symbol(t, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 58, 3)) + +var p = new Proxy(t, {}); +>p : Symbol(p, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 59, 3)) +>Proxy : Symbol(Proxy, Decl(lib.es2015.proxy.d.ts, --, --)) +>t : Symbol(t, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 58, 3)) + +// Using ES6 reflect +Reflect.isExtensible({}); +>Reflect.isExtensible : Symbol(Reflect.isExtensible, Decl(lib.es2015.reflect.d.ts, --, --)) +>Reflect : Symbol(Reflect, Decl(lib.es2015.reflect.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>isExtensible : Symbol(Reflect.isExtensible, Decl(lib.es2015.reflect.d.ts, --, --)) + +// Using Es6 regexp +var reg = new RegExp("/s"); +>reg : Symbol(reg, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 65, 3)) +>RegExp : Symbol(RegExp, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + +reg.flags; +>reg.flags : Symbol(RegExp.flags, Decl(lib.es2015.core.d.ts, --, --)) +>reg : Symbol(reg, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 65, 3)) +>flags : Symbol(RegExp.flags, Decl(lib.es2015.core.d.ts, --, --)) + +// Using ES6 string +var str = "Hello world"; +>str : Symbol(str, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 69, 3)) + +str.includes("hello", 0); +>str.includes : Symbol(String.includes, Decl(lib.es2015.core.d.ts, --, --)) +>str : Symbol(str, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 69, 3)) +>includes : Symbol(String.includes, Decl(lib.es2015.core.d.ts, --, --)) + +// Using ES6 symbol +var s = Symbol(); +>s : Symbol(s, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 73, 3)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) + +// Using ES6 wellknown-symbol +const o1 = { +>o1 : Symbol(o1, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 76, 5)) + + [Symbol.hasInstance](value: any) { +>Symbol.hasInstance : Symbol(SymbolConstructor.hasInstance, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>hasInstance : Symbol(SymbolConstructor.hasInstance, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>value : Symbol(value, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 77, 25)) + + return false; + } +} diff --git a/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions2.types b/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions2.types new file mode 100644 index 00000000000..a7d8e77e28c --- /dev/null +++ b/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions2.types @@ -0,0 +1,231 @@ +=== tests/cases/compiler/modularizeLibrary_NoErrorDuplicateLibOptions2.ts === + +// Using Es6 array +function f(x: number, y: number, z: number) { +>f : (x: number, y: number, z: number) => any[] +>x : number +>y : number +>z : number + + return Array.from(arguments); +>Array.from(arguments) : any[] +>Array.from : { (iterable: Iterable, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; (iterable: Iterable): T[]; (arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; (arrayLike: ArrayLike): T[]; } +>Array : ArrayConstructor +>from : { (iterable: Iterable, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; (iterable: Iterable): T[]; (arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; (arrayLike: ArrayLike): T[]; } +>arguments : IArguments +} + +f(1, 2, 3); // no error +>f(1, 2, 3) : any[] +>f : (x: number, y: number, z: number) => any[] +>1 : number +>2 : number +>3 : number + +// Using ES6 collection +var m = new Map(); +>m : Map +>new Map() : Map +>Map : MapConstructor + +m.clear(); +>m.clear() : void +>m.clear : () => void +>m : Map +>clear : () => void + +// Using ES6 iterable +m.keys(); +>m.keys() : IterableIterator +>m.keys : () => IterableIterator +>m : Map +>keys : () => IterableIterator + +// Using ES6 function +function Baz() { } +>Baz : () => void + +Baz.name; +>Baz.name : string +>Baz : () => void +>name : string + +// Using ES6 generator +function* gen() { +>gen : () => IterableIterator + + let i = 0; +>i : number +>0 : number + + while (i < 10) { +>i < 10 : boolean +>i : number +>10 : number + + yield i; +>yield i : any +>i : number + + i++; +>i++ : number +>i : number + } +} + +function* gen2() { +>gen2 : () => IterableIterator + + let i = 0; +>i : number +>0 : number + + while (i < 10) { +>i < 10 : boolean +>i : number +>10 : number + + yield i; +>yield i : any +>i : number + + i++; +>i++ : number +>i : number + } +} + +// Using ES6 math +Math.sign(1); +>Math.sign(1) : number +>Math.sign : (x: number) => number +>Math : Math +>sign : (x: number) => number +>1 : number + +// Using ES6 object +var o = { +>o : { a: number; [Symbol.hasInstance](value: any): boolean; } +>{ a: 2, [Symbol.hasInstance](value: any) { return false; }} : { a: number; [Symbol.hasInstance](value: any): boolean; } + + a: 2, +>a : number +>2 : number + + [Symbol.hasInstance](value: any) { +>Symbol.hasInstance : symbol +>Symbol : SymbolConstructor +>hasInstance : symbol +>value : any + + return false; +>false : boolean + } +}; +o.hasOwnProperty(Symbol.hasInstance); +>o.hasOwnProperty(Symbol.hasInstance) : boolean +>o.hasOwnProperty : { (v: string | number | symbol): boolean; (v: string): boolean; } +>o : { a: number; [Symbol.hasInstance](value: any): boolean; } +>hasOwnProperty : { (v: string | number | symbol): boolean; (v: string): boolean; } +>Symbol.hasInstance : symbol +>Symbol : SymbolConstructor +>hasInstance : symbol + +// Using ES6 promise +async function out() { +>out : () => Promise<{}> + + return new Promise(function (resolve, reject) {}); +>new Promise(function (resolve, reject) {}) : Promise<{}> +>Promise : PromiseConstructor +>function (resolve, reject) {} : (resolve: (value?: {} | PromiseLike<{}>) => void, reject: (reason?: any) => void) => void +>resolve : (value?: {} | PromiseLike<{}>) => void +>reject : (reason?: any) => void +} + +declare var console: any; +>console : any + +out().then(() => { +>out().then(() => { console.log("Yea!");}) : Promise +>out().then : { (onfulfilled?: (value: {}) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled?: (value: {}) => TResult | PromiseLike, onrejected?: (reason: any) => void): Promise; } +>out() : Promise<{}> +>out : () => Promise<{}> +>then : { (onfulfilled?: (value: {}) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled?: (value: {}) => TResult | PromiseLike, onrejected?: (reason: any) => void): Promise; } +>() => { console.log("Yea!");} : () => void + + console.log("Yea!"); +>console.log("Yea!") : any +>console.log : any +>console : any +>log : any +>"Yea!" : string + +}); + +// Using Es6 proxy +var t = {} +>t : {} +>{} : {} + +var p = new Proxy(t, {}); +>p : {} +>new Proxy(t, {}) : {} +>Proxy : ProxyConstructor +>t : {} +>{} : {} + +// Using ES6 reflect +Reflect.isExtensible({}); +>Reflect.isExtensible({}) : boolean +>Reflect.isExtensible : (target: any) => boolean +>Reflect : typeof Reflect +>isExtensible : (target: any) => boolean +>{} : {} + +// Using Es6 regexp +var reg = new RegExp("/s"); +>reg : RegExp +>new RegExp("/s") : RegExp +>RegExp : RegExpConstructor +>"/s" : string + +reg.flags; +>reg.flags : string +>reg : RegExp +>flags : string + +// Using ES6 string +var str = "Hello world"; +>str : string +>"Hello world" : string + +str.includes("hello", 0); +>str.includes("hello", 0) : boolean +>str.includes : (searchString: string, position?: number) => boolean +>str : string +>includes : (searchString: string, position?: number) => boolean +>"hello" : string +>0 : number + +// Using ES6 symbol +var s = Symbol(); +>s : symbol +>Symbol() : symbol +>Symbol : SymbolConstructor + +// Using ES6 wellknown-symbol +const o1 = { +>o1 : { [Symbol.hasInstance](value: any): boolean; } +>{ [Symbol.hasInstance](value: any) { return false; }} : { [Symbol.hasInstance](value: any): boolean; } + + [Symbol.hasInstance](value: any) { +>Symbol.hasInstance : symbol +>Symbol : SymbolConstructor +>hasInstance : symbol +>value : any + + return false; +>false : boolean + } +} diff --git a/tests/baselines/reference/modularizeLibrary_TargetES5UsingES6Lib.js b/tests/baselines/reference/modularizeLibrary_TargetES5UsingES6Lib.js new file mode 100644 index 00000000000..8736c51cd16 --- /dev/null +++ b/tests/baselines/reference/modularizeLibrary_TargetES5UsingES6Lib.js @@ -0,0 +1,158 @@ +//// [modularizeLibrary_TargetES5UsingES6Lib.ts] + +// Using Es6 array +function f(x: number, y: number, z: number) { + return Array.from(arguments); +} + +f(1, 2, 3); // no error + +// Using ES6 collection +var m = new Map(); +m.clear(); +// Using ES6 iterable +m.keys(); + +// Using ES6 function +function Baz() { } +Baz.name; + +// Using ES6 generator +function* gen() { + let i = 0; + while (i < 10) { + yield i; + i++; + } +} + +function* gen2() { + let i = 0; + while (i < 10) { + yield i; + i++; + } +} + +// Using ES6 math +Math.sign(1); + +// Using ES6 object +var o = { + a: 2, + [Symbol.hasInstance](value: any) { + return false; + } +}; +o.hasOwnProperty(Symbol.hasInstance); + +// Using ES6 promise +async function out() { + return new Promise(function (resolve, reject) {}); +} + +declare var console: any; +out().then(() => { + console.log("Yea!"); +}); + +// Using Es6 proxy +var t = {} +var p = new Proxy(t, {}); + +// Using ES6 reflect +Reflect.isExtensible({}); + +// Using Es6 regexp +var reg = new RegExp("/s"); +reg.flags; + +// Using ES6 string +var str = "Hello world"; +str.includes("hello", 0); + +// Using ES6 symbol +var s = Symbol(); + +// Using ES6 wellknown-symbol +const o1 = { + [Symbol.hasInstance](value: any) { + return false; + } +} + +//// [modularizeLibrary_TargetES5UsingES6Lib.js] +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator.throw(value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments)).next()); + }); +}; +// Using Es6 array +function f(x, y, z) { + return Array.from(arguments); +} +f(1, 2, 3); // no error +// Using ES6 collection +var m = new Map(); +m.clear(); +// Using ES6 iterable +m.keys(); +// Using ES6 function +function Baz() { } +Baz.name; +// Using ES6 generator +function* gen() { + let i = 0; + while (i < 10) { + yield i; + i++; + } +} +function* gen2() { + let i = 0; + while (i < 10) { + yield i; + i++; + } +} +// Using ES6 math +Math.sign(1); +// Using ES6 object +var o = { + a: 2, + [Symbol.hasInstance](value) { + return false; + } +}; +o.hasOwnProperty(Symbol.hasInstance); +// Using ES6 promise +function out() { + return __awaiter(this, void 0, void 0, function* () { + return new Promise(function (resolve, reject) { }); + }); +} +out().then(() => { + console.log("Yea!"); +}); +// Using Es6 proxy +var t = {}; +var p = new Proxy(t, {}); +// Using ES6 reflect +Reflect.isExtensible({}); +// Using Es6 regexp +var reg = new RegExp("/s"); +reg.flags; +// Using ES6 string +var str = "Hello world"; +str.includes("hello", 0); +// Using ES6 symbol +var s = Symbol(); +// Using ES6 wellknown-symbol +const o1 = { + [Symbol.hasInstance](value) { + return false; + } +}; diff --git a/tests/baselines/reference/modularizeLibrary_TargetES5UsingES6Lib.symbols b/tests/baselines/reference/modularizeLibrary_TargetES5UsingES6Lib.symbols new file mode 100644 index 00000000000..c8ccdd98653 --- /dev/null +++ b/tests/baselines/reference/modularizeLibrary_TargetES5UsingES6Lib.symbols @@ -0,0 +1,184 @@ +=== tests/cases/compiler/modularizeLibrary_TargetES5UsingES6Lib.ts === + +// Using Es6 array +function f(x: number, y: number, z: number) { +>f : Symbol(f, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 0, 0)) +>x : Symbol(x, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 2, 11)) +>y : Symbol(y, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 2, 21)) +>z : Symbol(z, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 2, 32)) + + return Array.from(arguments); +>Array.from : Symbol(ArrayConstructor.from, Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>Array : Symbol(Array, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>from : Symbol(ArrayConstructor.from, Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>arguments : Symbol(arguments) +} + +f(1, 2, 3); // no error +>f : Symbol(f, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 0, 0)) + +// Using ES6 collection +var m = new Map(); +>m : Symbol(m, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 9, 3)) +>Map : Symbol(Map, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --)) + +m.clear(); +>m.clear : Symbol(Map.clear, Decl(lib.es2015.collection.d.ts, --, --)) +>m : Symbol(m, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 9, 3)) +>clear : Symbol(Map.clear, Decl(lib.es2015.collection.d.ts, --, --)) + +// Using ES6 iterable +m.keys(); +>m.keys : Symbol(Map.keys, Decl(lib.es2015.iterable.d.ts, --, --)) +>m : Symbol(m, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 9, 3)) +>keys : Symbol(Map.keys, Decl(lib.es2015.iterable.d.ts, --, --)) + +// Using ES6 function +function Baz() { } +>Baz : Symbol(Baz, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 12, 9)) + +Baz.name; +>Baz.name : Symbol(Function.name, Decl(lib.es2015.core.d.ts, --, --)) +>Baz : Symbol(Baz, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 12, 9)) +>name : Symbol(Function.name, Decl(lib.es2015.core.d.ts, --, --)) + +// Using ES6 generator +function* gen() { +>gen : Symbol(gen, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 16, 9)) + + let i = 0; +>i : Symbol(i, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 20, 7)) + + while (i < 10) { +>i : Symbol(i, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 20, 7)) + + yield i; +>i : Symbol(i, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 20, 7)) + + i++; +>i : Symbol(i, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 20, 7)) + } +} + +function* gen2() { +>gen2 : Symbol(gen2, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 25, 1)) + + let i = 0; +>i : Symbol(i, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 28, 7)) + + while (i < 10) { +>i : Symbol(i, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 28, 7)) + + yield i; +>i : Symbol(i, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 28, 7)) + + i++; +>i : Symbol(i, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 28, 7)) + } +} + +// Using ES6 math +Math.sign(1); +>Math.sign : Symbol(Math.sign, Decl(lib.es2015.core.d.ts, --, --)) +>Math : Symbol(Math, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>sign : Symbol(Math.sign, Decl(lib.es2015.core.d.ts, --, --)) + +// Using ES6 object +var o = { +>o : Symbol(o, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 39, 3)) + + a: 2, +>a : Symbol(a, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 39, 9)) + + [Symbol.hasInstance](value: any) { +>Symbol.hasInstance : Symbol(SymbolConstructor.hasInstance, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>hasInstance : Symbol(SymbolConstructor.hasInstance, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>value : Symbol(value, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 41, 25)) + + return false; + } +}; +o.hasOwnProperty(Symbol.hasInstance); +>o.hasOwnProperty : Symbol(Object.hasOwnProperty, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>o : Symbol(o, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 39, 3)) +>hasOwnProperty : Symbol(Object.hasOwnProperty, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>Symbol.hasInstance : Symbol(SymbolConstructor.hasInstance, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>hasInstance : Symbol(SymbolConstructor.hasInstance, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) + +// Using ES6 promise +async function out() { +>out : Symbol(out, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 45, 37)) + + return new Promise(function (resolve, reject) {}); +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>resolve : Symbol(resolve, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 49, 33)) +>reject : Symbol(reject, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 49, 41)) +} + +declare var console: any; +>console : Symbol(console, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 52, 11)) + +out().then(() => { +>out().then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>out : Symbol(out, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 45, 37)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + + console.log("Yea!"); +>console : Symbol(console, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 52, 11)) + +}); + +// Using Es6 proxy +var t = {} +>t : Symbol(t, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 58, 3)) + +var p = new Proxy(t, {}); +>p : Symbol(p, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 59, 3)) +>Proxy : Symbol(Proxy, Decl(lib.es2015.proxy.d.ts, --, --)) +>t : Symbol(t, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 58, 3)) + +// Using ES6 reflect +Reflect.isExtensible({}); +>Reflect.isExtensible : Symbol(Reflect.isExtensible, Decl(lib.es2015.reflect.d.ts, --, --)) +>Reflect : Symbol(Reflect, Decl(lib.es2015.reflect.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>isExtensible : Symbol(Reflect.isExtensible, Decl(lib.es2015.reflect.d.ts, --, --)) + +// Using Es6 regexp +var reg = new RegExp("/s"); +>reg : Symbol(reg, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 65, 3)) +>RegExp : Symbol(RegExp, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + +reg.flags; +>reg.flags : Symbol(RegExp.flags, Decl(lib.es2015.core.d.ts, --, --)) +>reg : Symbol(reg, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 65, 3)) +>flags : Symbol(RegExp.flags, Decl(lib.es2015.core.d.ts, --, --)) + +// Using ES6 string +var str = "Hello world"; +>str : Symbol(str, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 69, 3)) + +str.includes("hello", 0); +>str.includes : Symbol(String.includes, Decl(lib.es2015.core.d.ts, --, --)) +>str : Symbol(str, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 69, 3)) +>includes : Symbol(String.includes, Decl(lib.es2015.core.d.ts, --, --)) + +// Using ES6 symbol +var s = Symbol(); +>s : Symbol(s, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 73, 3)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) + +// Using ES6 wellknown-symbol +const o1 = { +>o1 : Symbol(o1, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 76, 5)) + + [Symbol.hasInstance](value: any) { +>Symbol.hasInstance : Symbol(SymbolConstructor.hasInstance, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>hasInstance : Symbol(SymbolConstructor.hasInstance, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>value : Symbol(value, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 77, 25)) + + return false; + } +} diff --git a/tests/baselines/reference/modularizeLibrary_TargetES5UsingES6Lib.types b/tests/baselines/reference/modularizeLibrary_TargetES5UsingES6Lib.types new file mode 100644 index 00000000000..8272465da5e --- /dev/null +++ b/tests/baselines/reference/modularizeLibrary_TargetES5UsingES6Lib.types @@ -0,0 +1,231 @@ +=== tests/cases/compiler/modularizeLibrary_TargetES5UsingES6Lib.ts === + +// Using Es6 array +function f(x: number, y: number, z: number) { +>f : (x: number, y: number, z: number) => any[] +>x : number +>y : number +>z : number + + return Array.from(arguments); +>Array.from(arguments) : any[] +>Array.from : { (iterable: Iterable, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; (iterable: Iterable): T[]; (arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; (arrayLike: ArrayLike): T[]; } +>Array : ArrayConstructor +>from : { (iterable: Iterable, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; (iterable: Iterable): T[]; (arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; (arrayLike: ArrayLike): T[]; } +>arguments : IArguments +} + +f(1, 2, 3); // no error +>f(1, 2, 3) : any[] +>f : (x: number, y: number, z: number) => any[] +>1 : number +>2 : number +>3 : number + +// Using ES6 collection +var m = new Map(); +>m : Map +>new Map() : Map +>Map : MapConstructor + +m.clear(); +>m.clear() : void +>m.clear : () => void +>m : Map +>clear : () => void + +// Using ES6 iterable +m.keys(); +>m.keys() : IterableIterator +>m.keys : () => IterableIterator +>m : Map +>keys : () => IterableIterator + +// Using ES6 function +function Baz() { } +>Baz : () => void + +Baz.name; +>Baz.name : string +>Baz : () => void +>name : string + +// Using ES6 generator +function* gen() { +>gen : () => IterableIterator + + let i = 0; +>i : number +>0 : number + + while (i < 10) { +>i < 10 : boolean +>i : number +>10 : number + + yield i; +>yield i : any +>i : number + + i++; +>i++ : number +>i : number + } +} + +function* gen2() { +>gen2 : () => IterableIterator + + let i = 0; +>i : number +>0 : number + + while (i < 10) { +>i < 10 : boolean +>i : number +>10 : number + + yield i; +>yield i : any +>i : number + + i++; +>i++ : number +>i : number + } +} + +// Using ES6 math +Math.sign(1); +>Math.sign(1) : number +>Math.sign : (x: number) => number +>Math : Math +>sign : (x: number) => number +>1 : number + +// Using ES6 object +var o = { +>o : { a: number; [Symbol.hasInstance](value: any): boolean; } +>{ a: 2, [Symbol.hasInstance](value: any) { return false; }} : { a: number; [Symbol.hasInstance](value: any): boolean; } + + a: 2, +>a : number +>2 : number + + [Symbol.hasInstance](value: any) { +>Symbol.hasInstance : symbol +>Symbol : SymbolConstructor +>hasInstance : symbol +>value : any + + return false; +>false : boolean + } +}; +o.hasOwnProperty(Symbol.hasInstance); +>o.hasOwnProperty(Symbol.hasInstance) : boolean +>o.hasOwnProperty : { (v: string | number | symbol): boolean; (v: string): boolean; } +>o : { a: number; [Symbol.hasInstance](value: any): boolean; } +>hasOwnProperty : { (v: string | number | symbol): boolean; (v: string): boolean; } +>Symbol.hasInstance : symbol +>Symbol : SymbolConstructor +>hasInstance : symbol + +// Using ES6 promise +async function out() { +>out : () => Promise<{}> + + return new Promise(function (resolve, reject) {}); +>new Promise(function (resolve, reject) {}) : Promise<{}> +>Promise : PromiseConstructor +>function (resolve, reject) {} : (resolve: (value?: {} | PromiseLike<{}>) => void, reject: (reason?: any) => void) => void +>resolve : (value?: {} | PromiseLike<{}>) => void +>reject : (reason?: any) => void +} + +declare var console: any; +>console : any + +out().then(() => { +>out().then(() => { console.log("Yea!");}) : Promise +>out().then : { (onfulfilled?: (value: {}) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled?: (value: {}) => TResult | PromiseLike, onrejected?: (reason: any) => void): Promise; } +>out() : Promise<{}> +>out : () => Promise<{}> +>then : { (onfulfilled?: (value: {}) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled?: (value: {}) => TResult | PromiseLike, onrejected?: (reason: any) => void): Promise; } +>() => { console.log("Yea!");} : () => void + + console.log("Yea!"); +>console.log("Yea!") : any +>console.log : any +>console : any +>log : any +>"Yea!" : string + +}); + +// Using Es6 proxy +var t = {} +>t : {} +>{} : {} + +var p = new Proxy(t, {}); +>p : {} +>new Proxy(t, {}) : {} +>Proxy : ProxyConstructor +>t : {} +>{} : {} + +// Using ES6 reflect +Reflect.isExtensible({}); +>Reflect.isExtensible({}) : boolean +>Reflect.isExtensible : (target: any) => boolean +>Reflect : typeof Reflect +>isExtensible : (target: any) => boolean +>{} : {} + +// Using Es6 regexp +var reg = new RegExp("/s"); +>reg : RegExp +>new RegExp("/s") : RegExp +>RegExp : RegExpConstructor +>"/s" : string + +reg.flags; +>reg.flags : string +>reg : RegExp +>flags : string + +// Using ES6 string +var str = "Hello world"; +>str : string +>"Hello world" : string + +str.includes("hello", 0); +>str.includes("hello", 0) : boolean +>str.includes : (searchString: string, position?: number) => boolean +>str : string +>includes : (searchString: string, position?: number) => boolean +>"hello" : string +>0 : number + +// Using ES6 symbol +var s = Symbol(); +>s : symbol +>Symbol() : symbol +>Symbol : SymbolConstructor + +// Using ES6 wellknown-symbol +const o1 = { +>o1 : { [Symbol.hasInstance](value: any): boolean; } +>{ [Symbol.hasInstance](value: any) { return false; }} : { [Symbol.hasInstance](value: any): boolean; } + + [Symbol.hasInstance](value: any) { +>Symbol.hasInstance : symbol +>Symbol : SymbolConstructor +>hasInstance : symbol +>value : any + + return false; +>false : boolean + } +} diff --git a/tests/baselines/reference/modularizeLibrary_TargetES6UsingES6Lib.js b/tests/baselines/reference/modularizeLibrary_TargetES6UsingES6Lib.js new file mode 100644 index 00000000000..137bd1063b8 --- /dev/null +++ b/tests/baselines/reference/modularizeLibrary_TargetES6UsingES6Lib.js @@ -0,0 +1,99 @@ +//// [modularizeLibrary_TargetES6UsingES6Lib.ts] + +// Using Es6 array +function f(x: number, y: number, z: number) { + return Array.from(arguments); +} + +f(1, 2, 3); // no error + +// Using ES6 collection +var m = new Map(); +m.clear(); +// Using ES6 iterable +m.keys(); + +// Using ES6 function +function Baz() { } +Baz.name; + +// Using ES6 math +Math.sign(1); + +// Using ES6 object +var o = { + a: 2, + [Symbol.hasInstance](value: any) { + return false; + } +}; +o.hasOwnProperty(Symbol.hasInstance); + +// Using Es6 proxy +var t = {} +var p = new Proxy(t, {}); + +// Using ES6 reflect +Reflect.isExtensible({}); + +// Using Es6 regexp +var reg = new RegExp("/s"); +reg.flags; + +// Using ES6 string +var str = "Hello world"; +str.includes("hello", 0); + +// Using ES6 symbol +var s = Symbol(); + +// Using ES6 wellknown-symbol +const o1 = { + [Symbol.hasInstance](value: any) { + return false; + } +} + +//// [modularizeLibrary_TargetES6UsingES6Lib.js] +// Using Es6 array +function f(x, y, z) { + return Array.from(arguments); +} +f(1, 2, 3); // no error +// Using ES6 collection +var m = new Map(); +m.clear(); +// Using ES6 iterable +m.keys(); +// Using ES6 function +function Baz() { } +Baz.name; +// Using ES6 math +Math.sign(1); +// Using ES6 object +var o = { + a: 2, + [Symbol.hasInstance](value) { + return false; + } +}; +o.hasOwnProperty(Symbol.hasInstance); +// Using Es6 proxy +var t = {}; +var p = new Proxy(t, {}); +// Using ES6 reflect +Reflect.isExtensible({}); +// Using Es6 regexp +var reg = new RegExp("/s"); +reg.flags; +// Using ES6 string +var str = "Hello world"; +str.includes("hello", 0); +// Using ES6 symbol +var s = Symbol(); +// Using ES6 wellknown-symbol +const o1 = { + [Symbol.hasInstance](value) { + return false; + } +}; diff --git a/tests/baselines/reference/modularizeLibrary_TargetES6UsingES6Lib.symbols b/tests/baselines/reference/modularizeLibrary_TargetES6UsingES6Lib.symbols new file mode 100644 index 00000000000..d3d3e3d1ed6 --- /dev/null +++ b/tests/baselines/reference/modularizeLibrary_TargetES6UsingES6Lib.symbols @@ -0,0 +1,126 @@ +=== tests/cases/compiler/modularizeLibrary_TargetES6UsingES6Lib.ts === + +// Using Es6 array +function f(x: number, y: number, z: number) { +>f : Symbol(f, Decl(modularizeLibrary_TargetES6UsingES6Lib.ts, 0, 0)) +>x : Symbol(x, Decl(modularizeLibrary_TargetES6UsingES6Lib.ts, 2, 11)) +>y : Symbol(y, Decl(modularizeLibrary_TargetES6UsingES6Lib.ts, 2, 21)) +>z : Symbol(z, Decl(modularizeLibrary_TargetES6UsingES6Lib.ts, 2, 32)) + + return Array.from(arguments); +>Array.from : Symbol(ArrayConstructor.from, Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>from : Symbol(ArrayConstructor.from, Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>arguments : Symbol(arguments) +} + +f(1, 2, 3); // no error +>f : Symbol(f, Decl(modularizeLibrary_TargetES6UsingES6Lib.ts, 0, 0)) + +// Using ES6 collection +var m = new Map(); +>m : Symbol(m, Decl(modularizeLibrary_TargetES6UsingES6Lib.ts, 9, 3)) +>Map : Symbol(Map, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --)) + +m.clear(); +>m.clear : Symbol(Map.clear, Decl(lib.es2015.collection.d.ts, --, --)) +>m : Symbol(m, Decl(modularizeLibrary_TargetES6UsingES6Lib.ts, 9, 3)) +>clear : Symbol(Map.clear, Decl(lib.es2015.collection.d.ts, --, --)) + +// Using ES6 iterable +m.keys(); +>m.keys : Symbol(Map.keys, Decl(lib.es2015.iterable.d.ts, --, --)) +>m : Symbol(m, Decl(modularizeLibrary_TargetES6UsingES6Lib.ts, 9, 3)) +>keys : Symbol(Map.keys, Decl(lib.es2015.iterable.d.ts, --, --)) + +// Using ES6 function +function Baz() { } +>Baz : Symbol(Baz, Decl(modularizeLibrary_TargetES6UsingES6Lib.ts, 12, 9)) + +Baz.name; +>Baz.name : Symbol(Function.name, Decl(lib.es2015.core.d.ts, --, --)) +>Baz : Symbol(Baz, Decl(modularizeLibrary_TargetES6UsingES6Lib.ts, 12, 9)) +>name : Symbol(Function.name, Decl(lib.es2015.core.d.ts, --, --)) + +// Using ES6 math +Math.sign(1); +>Math.sign : Symbol(Math.sign, Decl(lib.es2015.core.d.ts, --, --)) +>Math : Symbol(Math, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>sign : Symbol(Math.sign, Decl(lib.es2015.core.d.ts, --, --)) + +// Using ES6 object +var o = { +>o : Symbol(o, Decl(modularizeLibrary_TargetES6UsingES6Lib.ts, 22, 3)) + + a: 2, +>a : Symbol(a, Decl(modularizeLibrary_TargetES6UsingES6Lib.ts, 22, 9)) + + [Symbol.hasInstance](value: any) { +>Symbol.hasInstance : Symbol(SymbolConstructor.hasInstance, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>hasInstance : Symbol(SymbolConstructor.hasInstance, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>value : Symbol(value, Decl(modularizeLibrary_TargetES6UsingES6Lib.ts, 24, 25)) + + return false; + } +}; +o.hasOwnProperty(Symbol.hasInstance); +>o.hasOwnProperty : Symbol(Object.hasOwnProperty, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>o : Symbol(o, Decl(modularizeLibrary_TargetES6UsingES6Lib.ts, 22, 3)) +>hasOwnProperty : Symbol(Object.hasOwnProperty, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>Symbol.hasInstance : Symbol(SymbolConstructor.hasInstance, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>hasInstance : Symbol(SymbolConstructor.hasInstance, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) + +// Using Es6 proxy +var t = {} +>t : Symbol(t, Decl(modularizeLibrary_TargetES6UsingES6Lib.ts, 31, 3)) + +var p = new Proxy(t, {}); +>p : Symbol(p, Decl(modularizeLibrary_TargetES6UsingES6Lib.ts, 32, 3)) +>Proxy : Symbol(Proxy, Decl(lib.es2015.proxy.d.ts, --, --)) +>t : Symbol(t, Decl(modularizeLibrary_TargetES6UsingES6Lib.ts, 31, 3)) + +// Using ES6 reflect +Reflect.isExtensible({}); +>Reflect.isExtensible : Symbol(Reflect.isExtensible, Decl(lib.es2015.reflect.d.ts, --, --)) +>Reflect : Symbol(Reflect, Decl(lib.es2015.reflect.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>isExtensible : Symbol(Reflect.isExtensible, Decl(lib.es2015.reflect.d.ts, --, --)) + +// Using Es6 regexp +var reg = new RegExp("/s"); +>reg : Symbol(reg, Decl(modularizeLibrary_TargetES6UsingES6Lib.ts, 38, 3)) +>RegExp : Symbol(RegExp, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) + +reg.flags; +>reg.flags : Symbol(RegExp.flags, Decl(lib.es2015.core.d.ts, --, --)) +>reg : Symbol(reg, Decl(modularizeLibrary_TargetES6UsingES6Lib.ts, 38, 3)) +>flags : Symbol(RegExp.flags, Decl(lib.es2015.core.d.ts, --, --)) + +// Using ES6 string +var str = "Hello world"; +>str : Symbol(str, Decl(modularizeLibrary_TargetES6UsingES6Lib.ts, 42, 3)) + +str.includes("hello", 0); +>str.includes : Symbol(String.includes, Decl(lib.es2015.core.d.ts, --, --)) +>str : Symbol(str, Decl(modularizeLibrary_TargetES6UsingES6Lib.ts, 42, 3)) +>includes : Symbol(String.includes, Decl(lib.es2015.core.d.ts, --, --)) + +// Using ES6 symbol +var s = Symbol(); +>s : Symbol(s, Decl(modularizeLibrary_TargetES6UsingES6Lib.ts, 46, 3)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) + +// Using ES6 wellknown-symbol +const o1 = { +>o1 : Symbol(o1, Decl(modularizeLibrary_TargetES6UsingES6Lib.ts, 49, 5)) + + [Symbol.hasInstance](value: any) { +>Symbol.hasInstance : Symbol(SymbolConstructor.hasInstance, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>hasInstance : Symbol(SymbolConstructor.hasInstance, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>value : Symbol(value, Decl(modularizeLibrary_TargetES6UsingES6Lib.ts, 50, 25)) + + return false; + } +} diff --git a/tests/baselines/reference/modularizeLibrary_TargetES6UsingES6Lib.types b/tests/baselines/reference/modularizeLibrary_TargetES6UsingES6Lib.types new file mode 100644 index 00000000000..7af40d3684c --- /dev/null +++ b/tests/baselines/reference/modularizeLibrary_TargetES6UsingES6Lib.types @@ -0,0 +1,154 @@ +=== tests/cases/compiler/modularizeLibrary_TargetES6UsingES6Lib.ts === + +// Using Es6 array +function f(x: number, y: number, z: number) { +>f : (x: number, y: number, z: number) => any[] +>x : number +>y : number +>z : number + + return Array.from(arguments); +>Array.from(arguments) : any[] +>Array.from : { (iterable: Iterable, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; (iterable: Iterable): T[]; (arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; (arrayLike: ArrayLike): T[]; } +>Array : ArrayConstructor +>from : { (iterable: Iterable, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; (iterable: Iterable): T[]; (arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; (arrayLike: ArrayLike): T[]; } +>arguments : IArguments +} + +f(1, 2, 3); // no error +>f(1, 2, 3) : any[] +>f : (x: number, y: number, z: number) => any[] +>1 : number +>2 : number +>3 : number + +// Using ES6 collection +var m = new Map(); +>m : Map +>new Map() : Map +>Map : MapConstructor + +m.clear(); +>m.clear() : void +>m.clear : () => void +>m : Map +>clear : () => void + +// Using ES6 iterable +m.keys(); +>m.keys() : IterableIterator +>m.keys : () => IterableIterator +>m : Map +>keys : () => IterableIterator + +// Using ES6 function +function Baz() { } +>Baz : () => void + +Baz.name; +>Baz.name : string +>Baz : () => void +>name : string + +// Using ES6 math +Math.sign(1); +>Math.sign(1) : number +>Math.sign : (x: number) => number +>Math : Math +>sign : (x: number) => number +>1 : number + +// Using ES6 object +var o = { +>o : { a: number; [Symbol.hasInstance](value: any): boolean; } +>{ a: 2, [Symbol.hasInstance](value: any) { return false; }} : { a: number; [Symbol.hasInstance](value: any): boolean; } + + a: 2, +>a : number +>2 : number + + [Symbol.hasInstance](value: any) { +>Symbol.hasInstance : symbol +>Symbol : SymbolConstructor +>hasInstance : symbol +>value : any + + return false; +>false : boolean + } +}; +o.hasOwnProperty(Symbol.hasInstance); +>o.hasOwnProperty(Symbol.hasInstance) : boolean +>o.hasOwnProperty : { (v: string): boolean; (v: string | number | symbol): boolean; } +>o : { a: number; [Symbol.hasInstance](value: any): boolean; } +>hasOwnProperty : { (v: string): boolean; (v: string | number | symbol): boolean; } +>Symbol.hasInstance : symbol +>Symbol : SymbolConstructor +>hasInstance : symbol + +// Using Es6 proxy +var t = {} +>t : {} +>{} : {} + +var p = new Proxy(t, {}); +>p : {} +>new Proxy(t, {}) : {} +>Proxy : ProxyConstructor +>t : {} +>{} : {} + +// Using ES6 reflect +Reflect.isExtensible({}); +>Reflect.isExtensible({}) : boolean +>Reflect.isExtensible : (target: any) => boolean +>Reflect : typeof Reflect +>isExtensible : (target: any) => boolean +>{} : {} + +// Using Es6 regexp +var reg = new RegExp("/s"); +>reg : RegExp +>new RegExp("/s") : RegExp +>RegExp : RegExpConstructor +>"/s" : string + +reg.flags; +>reg.flags : string +>reg : RegExp +>flags : string + +// Using ES6 string +var str = "Hello world"; +>str : string +>"Hello world" : string + +str.includes("hello", 0); +>str.includes("hello", 0) : boolean +>str.includes : (searchString: string, position?: number) => boolean +>str : string +>includes : (searchString: string, position?: number) => boolean +>"hello" : string +>0 : number + +// Using ES6 symbol +var s = Symbol(); +>s : symbol +>Symbol() : symbol +>Symbol : SymbolConstructor + +// Using ES6 wellknown-symbol +const o1 = { +>o1 : { [Symbol.hasInstance](value: any): boolean; } +>{ [Symbol.hasInstance](value: any) { return false; }} : { [Symbol.hasInstance](value: any): boolean; } + + [Symbol.hasInstance](value: any) { +>Symbol.hasInstance : symbol +>Symbol : SymbolConstructor +>hasInstance : symbol +>value : any + + return false; +>false : boolean + } +} diff --git a/tests/baselines/reference/modularizeLibrary_UsingES5LibAndES6ArrayLib.js b/tests/baselines/reference/modularizeLibrary_UsingES5LibAndES6ArrayLib.js new file mode 100644 index 00000000000..29e0afc711c --- /dev/null +++ b/tests/baselines/reference/modularizeLibrary_UsingES5LibAndES6ArrayLib.js @@ -0,0 +1,15 @@ +//// [modularizeLibrary_UsingES5LibAndES6ArrayLib.ts] + +// No error +function f(x: number, y: number, z: number) { + return Array.from(arguments); +} + +f(1, 2, 3); + +//// [modularizeLibrary_UsingES5LibAndES6ArrayLib.js] +// No error +function f(x, y, z) { + return Array.from(arguments); +} +f(1, 2, 3); diff --git a/tests/baselines/reference/modularizeLibrary_UsingES5LibAndES6ArrayLib.symbols b/tests/baselines/reference/modularizeLibrary_UsingES5LibAndES6ArrayLib.symbols new file mode 100644 index 00000000000..ce03d4cfc59 --- /dev/null +++ b/tests/baselines/reference/modularizeLibrary_UsingES5LibAndES6ArrayLib.symbols @@ -0,0 +1,19 @@ +=== tests/cases/compiler/modularizeLibrary_UsingES5LibAndES6ArrayLib.ts === + +// No error +function f(x: number, y: number, z: number) { +>f : Symbol(f, Decl(modularizeLibrary_UsingES5LibAndES6ArrayLib.ts, 0, 0)) +>x : Symbol(x, Decl(modularizeLibrary_UsingES5LibAndES6ArrayLib.ts, 2, 11)) +>y : Symbol(y, Decl(modularizeLibrary_UsingES5LibAndES6ArrayLib.ts, 2, 21)) +>z : Symbol(z, Decl(modularizeLibrary_UsingES5LibAndES6ArrayLib.ts, 2, 32)) + + return Array.from(arguments); +>Array.from : Symbol(ArrayConstructor.from, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>Array : Symbol(Array, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>from : Symbol(ArrayConstructor.from, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>arguments : Symbol(arguments) +} + +f(1, 2, 3); +>f : Symbol(f, Decl(modularizeLibrary_UsingES5LibAndES6ArrayLib.ts, 0, 0)) + diff --git a/tests/baselines/reference/modularizeLibrary_UsingES5LibAndES6ArrayLib.types b/tests/baselines/reference/modularizeLibrary_UsingES5LibAndES6ArrayLib.types new file mode 100644 index 00000000000..d17a6fcbcbb --- /dev/null +++ b/tests/baselines/reference/modularizeLibrary_UsingES5LibAndES6ArrayLib.types @@ -0,0 +1,24 @@ +=== tests/cases/compiler/modularizeLibrary_UsingES5LibAndES6ArrayLib.ts === + +// No error +function f(x: number, y: number, z: number) { +>f : (x: number, y: number, z: number) => any[] +>x : number +>y : number +>z : number + + return Array.from(arguments); +>Array.from(arguments) : any[] +>Array.from : { (arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; (arrayLike: ArrayLike): T[]; } +>Array : ArrayConstructor +>from : { (arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; (arrayLike: ArrayLike): T[]; } +>arguments : IArguments +} + +f(1, 2, 3); +>f(1, 2, 3) : any[] +>f : (x: number, y: number, z: number) => any[] +>1 : number +>2 : number +>3 : number + diff --git a/tests/baselines/reference/modularizeLibrary_UsingES5LibAndES6FeatureLibs.js b/tests/baselines/reference/modularizeLibrary_UsingES5LibAndES6FeatureLibs.js new file mode 100644 index 00000000000..892bc688524 --- /dev/null +++ b/tests/baselines/reference/modularizeLibrary_UsingES5LibAndES6FeatureLibs.js @@ -0,0 +1,27 @@ +//// [modularizeLibrary_UsingES5LibAndES6FeatureLibs.ts] + +var s = Symbol(); +var t = {}; +var p = new Proxy(t, {}); + +Reflect.ownKeys({}); + +function* idGen() { + let i = 10; + while (i < 20) { + yield i + 2; + } +} + + +//// [modularizeLibrary_UsingES5LibAndES6FeatureLibs.js] +var s = Symbol(); +var t = {}; +var p = new Proxy(t, {}); +Reflect.ownKeys({}); +function* idGen() { + let i = 10; + while (i < 20) { + yield i + 2; + } +} diff --git a/tests/baselines/reference/modularizeLibrary_UsingES5LibAndES6FeatureLibs.symbols b/tests/baselines/reference/modularizeLibrary_UsingES5LibAndES6FeatureLibs.symbols new file mode 100644 index 00000000000..e6f7584c471 --- /dev/null +++ b/tests/baselines/reference/modularizeLibrary_UsingES5LibAndES6FeatureLibs.symbols @@ -0,0 +1,33 @@ +=== tests/cases/compiler/modularizeLibrary_UsingES5LibAndES6FeatureLibs.ts === + +var s = Symbol(); +>s : Symbol(s, Decl(modularizeLibrary_UsingES5LibAndES6FeatureLibs.ts, 1, 3)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) + +var t = {}; +>t : Symbol(t, Decl(modularizeLibrary_UsingES5LibAndES6FeatureLibs.ts, 2, 3)) + +var p = new Proxy(t, {}); +>p : Symbol(p, Decl(modularizeLibrary_UsingES5LibAndES6FeatureLibs.ts, 3, 3)) +>Proxy : Symbol(Proxy, Decl(lib.es2015.proxy.d.ts, --, --)) +>t : Symbol(t, Decl(modularizeLibrary_UsingES5LibAndES6FeatureLibs.ts, 2, 3)) + +Reflect.ownKeys({}); +>Reflect.ownKeys : Symbol(Reflect.ownKeys, Decl(lib.es2015.reflect.d.ts, --, --)) +>Reflect : Symbol(Reflect, Decl(lib.es2015.reflect.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>ownKeys : Symbol(Reflect.ownKeys, Decl(lib.es2015.reflect.d.ts, --, --)) + +function* idGen() { +>idGen : Symbol(idGen, Decl(modularizeLibrary_UsingES5LibAndES6FeatureLibs.ts, 5, 20)) + + let i = 10; +>i : Symbol(i, Decl(modularizeLibrary_UsingES5LibAndES6FeatureLibs.ts, 8, 7)) + + while (i < 20) { +>i : Symbol(i, Decl(modularizeLibrary_UsingES5LibAndES6FeatureLibs.ts, 8, 7)) + + yield i + 2; +>i : Symbol(i, Decl(modularizeLibrary_UsingES5LibAndES6FeatureLibs.ts, 8, 7)) + } +} + diff --git a/tests/baselines/reference/modularizeLibrary_UsingES5LibAndES6FeatureLibs.types b/tests/baselines/reference/modularizeLibrary_UsingES5LibAndES6FeatureLibs.types new file mode 100644 index 00000000000..820c2f6dc8a --- /dev/null +++ b/tests/baselines/reference/modularizeLibrary_UsingES5LibAndES6FeatureLibs.types @@ -0,0 +1,45 @@ +=== tests/cases/compiler/modularizeLibrary_UsingES5LibAndES6FeatureLibs.ts === + +var s = Symbol(); +>s : symbol +>Symbol() : symbol +>Symbol : SymbolConstructor + +var t = {}; +>t : {} +>{} : {} + +var p = new Proxy(t, {}); +>p : {} +>new Proxy(t, {}) : {} +>Proxy : ProxyConstructor +>t : {} +>{} : {} + +Reflect.ownKeys({}); +>Reflect.ownKeys({}) : (string | number | symbol)[] +>Reflect.ownKeys : (target: any) => (string | number | symbol)[] +>Reflect : typeof Reflect +>ownKeys : (target: any) => (string | number | symbol)[] +>{} : {} + +function* idGen() { +>idGen : () => IterableIterator + + let i = 10; +>i : number +>10 : number + + while (i < 20) { +>i < 20 : boolean +>i : number +>20 : number + + yield i + 2; +>yield i + 2 : any +>i + 2 : number +>i : number +>2 : number + } +} + diff --git a/tests/baselines/reference/modularizeLibrary_UsingES5LibES6ArrayLibES6WellknownSymbolLib.js b/tests/baselines/reference/modularizeLibrary_UsingES5LibES6ArrayLibES6WellknownSymbolLib.js new file mode 100644 index 00000000000..7755fc72ce8 --- /dev/null +++ b/tests/baselines/reference/modularizeLibrary_UsingES5LibES6ArrayLibES6WellknownSymbolLib.js @@ -0,0 +1,17 @@ +//// [modularizeLibrary_UsingES5LibES6ArrayLibES6WellknownSymbolLib.ts] + +function f(x: number, y: number, z: number) { + return Array.from(arguments); +} + +f(1, 2, 3); // no error +let a = ['c', 'd']; +a[Symbol.isConcatSpreadable] = false; + +//// [modularizeLibrary_UsingES5LibES6ArrayLibES6WellknownSymbolLib.js] +function f(x, y, z) { + return Array.from(arguments); +} +f(1, 2, 3); // no error +var a = ['c', 'd']; +a[Symbol.isConcatSpreadable] = false; diff --git a/tests/baselines/reference/modularizeLibrary_UsingES5LibES6ArrayLibES6WellknownSymbolLib.symbols b/tests/baselines/reference/modularizeLibrary_UsingES5LibES6ArrayLibES6WellknownSymbolLib.symbols new file mode 100644 index 00000000000..0ed5ec38513 --- /dev/null +++ b/tests/baselines/reference/modularizeLibrary_UsingES5LibES6ArrayLibES6WellknownSymbolLib.symbols @@ -0,0 +1,27 @@ +=== tests/cases/compiler/modularizeLibrary_UsingES5LibES6ArrayLibES6WellknownSymbolLib.ts === + +function f(x: number, y: number, z: number) { +>f : Symbol(f, Decl(modularizeLibrary_UsingES5LibES6ArrayLibES6WellknownSymbolLib.ts, 0, 0)) +>x : Symbol(x, Decl(modularizeLibrary_UsingES5LibES6ArrayLibES6WellknownSymbolLib.ts, 1, 11)) +>y : Symbol(y, Decl(modularizeLibrary_UsingES5LibES6ArrayLibES6WellknownSymbolLib.ts, 1, 21)) +>z : Symbol(z, Decl(modularizeLibrary_UsingES5LibES6ArrayLibES6WellknownSymbolLib.ts, 1, 32)) + + return Array.from(arguments); +>Array.from : Symbol(ArrayConstructor.from, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>Array : Symbol(Array, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>from : Symbol(ArrayConstructor.from, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>arguments : Symbol(arguments) +} + +f(1, 2, 3); // no error +>f : Symbol(f, Decl(modularizeLibrary_UsingES5LibES6ArrayLibES6WellknownSymbolLib.ts, 0, 0)) + +let a = ['c', 'd']; +>a : Symbol(a, Decl(modularizeLibrary_UsingES5LibES6ArrayLibES6WellknownSymbolLib.ts, 6, 3)) + +a[Symbol.isConcatSpreadable] = false; +>a : Symbol(a, Decl(modularizeLibrary_UsingES5LibES6ArrayLibES6WellknownSymbolLib.ts, 6, 3)) +>Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) + diff --git a/tests/baselines/reference/modularizeLibrary_UsingES5LibES6ArrayLibES6WellknownSymbolLib.types b/tests/baselines/reference/modularizeLibrary_UsingES5LibES6ArrayLibES6WellknownSymbolLib.types new file mode 100644 index 00000000000..3ae08c79fd4 --- /dev/null +++ b/tests/baselines/reference/modularizeLibrary_UsingES5LibES6ArrayLibES6WellknownSymbolLib.types @@ -0,0 +1,38 @@ +=== tests/cases/compiler/modularizeLibrary_UsingES5LibES6ArrayLibES6WellknownSymbolLib.ts === + +function f(x: number, y: number, z: number) { +>f : (x: number, y: number, z: number) => any[] +>x : number +>y : number +>z : number + + return Array.from(arguments); +>Array.from(arguments) : any[] +>Array.from : { (arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; (arrayLike: ArrayLike): T[]; } +>Array : ArrayConstructor +>from : { (arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; (arrayLike: ArrayLike): T[]; } +>arguments : IArguments +} + +f(1, 2, 3); // no error +>f(1, 2, 3) : any[] +>f : (x: number, y: number, z: number) => any[] +>1 : number +>2 : number +>3 : number + +let a = ['c', 'd']; +>a : string[] +>['c', 'd'] : string[] +>'c' : string +>'d' : string + +a[Symbol.isConcatSpreadable] = false; +>a[Symbol.isConcatSpreadable] = false : boolean +>a[Symbol.isConcatSpreadable] : any +>a : string[] +>Symbol.isConcatSpreadable : symbol +>Symbol : SymbolConstructor +>isConcatSpreadable : symbol +>false : boolean + diff --git a/tests/baselines/reference/moduleAliasInterface.symbols b/tests/baselines/reference/moduleAliasInterface.symbols index 9c4cfdf9b14..c7c85213fa1 100644 --- a/tests/baselines/reference/moduleAliasInterface.symbols +++ b/tests/baselines/reference/moduleAliasInterface.symbols @@ -40,7 +40,7 @@ module editor { >Mode : Symbol(modes.Mode, Decl(moduleAliasInterface.ts, 3, 2)) public foo(p1:modes.IMode) { ->foo : Symbol(foo, Decl(moduleAliasInterface.ts, 19, 50)) +>foo : Symbol(Bug.foo, Decl(moduleAliasInterface.ts, 19, 50)) >p1 : Symbol(p1, Decl(moduleAliasInterface.ts, 20, 13)) >modes : Symbol(modes, Decl(moduleAliasInterface.ts, 12, 15)) >IMode : Symbol(modes.IMode, Decl(moduleAliasInterface.ts, 0, 15)) diff --git a/tests/baselines/reference/moduleAndInterfaceSharingName4.symbols b/tests/baselines/reference/moduleAndInterfaceSharingName4.symbols index 383b1801b2d..cb59e73e4ef 100644 --- a/tests/baselines/reference/moduleAndInterfaceSharingName4.symbols +++ b/tests/baselines/reference/moduleAndInterfaceSharingName4.symbols @@ -15,7 +15,7 @@ declare module D3 { >Color : Symbol(Color, Decl(moduleAndInterfaceSharingName4.ts, 3, 18)) darker: Color; ->darker : Symbol(darker, Decl(moduleAndInterfaceSharingName4.ts, 4, 32)) +>darker : Symbol(Color.darker, Decl(moduleAndInterfaceSharingName4.ts, 4, 32)) >Color : Symbol(Color, Decl(moduleAndInterfaceSharingName4.ts, 3, 18)) } } diff --git a/tests/baselines/reference/moduleAugmentationCollidingNamesInAugmentation1.js b/tests/baselines/reference/moduleAugmentationCollidingNamesInAugmentation1.js new file mode 100644 index 00000000000..2e84e1492be --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationCollidingNamesInAugmentation1.js @@ -0,0 +1,77 @@ +//// [tests/cases/compiler/moduleAugmentationCollidingNamesInAugmentation1.ts] //// + +//// [map1.ts] + +import { Observable } from "./observable" + +(Observable.prototype).map = function() { } + +declare module "./observable" { + interface I {x0} +} + +//// [map2.ts] +import { Observable } from "./observable" + +(Observable.prototype).map = function() { } + +declare module "./observable" { + interface I {x1} +} + + +//// [observable.ts] +export declare class Observable { + filter(pred: (e:T) => boolean): Observable; +} + +//// [main.ts] +import { Observable } from "./observable" +import "./map1"; +import "./map2"; + +let x: Observable; + + +//// [observable.js] +define(["require", "exports"], function (require, exports) { + "use strict"; +}); +//// [map1.js] +define(["require", "exports", "./observable"], function (require, exports, observable_1) { + "use strict"; + observable_1.Observable.prototype.map = function () { }; +}); +//// [map2.js] +define(["require", "exports", "./observable"], function (require, exports, observable_1) { + "use strict"; + observable_1.Observable.prototype.map = function () { }; +}); +//// [main.js] +define(["require", "exports", "./map1", "./map2"], function (require, exports) { + "use strict"; + var x; +}); + + +//// [observable.d.ts] +export declare class Observable { + filter(pred: (e: T) => boolean): Observable; +} +//// [map1.d.ts] +declare module "./observable" { + interface I { + x0: any; + } +} +export {}; +//// [map2.d.ts] +declare module "./observable" { + interface I { + x1: any; + } +} +export {}; +//// [main.d.ts] +import "./map1"; +import "./map2"; diff --git a/tests/baselines/reference/moduleAugmentationCollidingNamesInAugmentation1.symbols b/tests/baselines/reference/moduleAugmentationCollidingNamesInAugmentation1.symbols new file mode 100644 index 00000000000..ce701a7c59d --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationCollidingNamesInAugmentation1.symbols @@ -0,0 +1,57 @@ +=== tests/cases/compiler/map1.ts === + +import { Observable } from "./observable" +>Observable : Symbol(Observable, Decl(map1.ts, 1, 8)) + +(Observable.prototype).map = function() { } +>Observable.prototype : Symbol(Observable.prototype) +>Observable : Symbol(Observable, Decl(map1.ts, 1, 8)) +>prototype : Symbol(Observable.prototype) + +declare module "./observable" { + interface I {x0} +>I : Symbol(I, Decl(map1.ts, 5, 31), Decl(map2.ts, 4, 31)) +>x0 : Symbol(I.x0, Decl(map1.ts, 6, 17)) +} + +=== tests/cases/compiler/map2.ts === +import { Observable } from "./observable" +>Observable : Symbol(Observable, Decl(map2.ts, 0, 8)) + +(Observable.prototype).map = function() { } +>Observable.prototype : Symbol(Observable.prototype) +>Observable : Symbol(Observable, Decl(map2.ts, 0, 8)) +>prototype : Symbol(Observable.prototype) + +declare module "./observable" { + interface I {x1} +>I : Symbol(I, Decl(map1.ts, 5, 31), Decl(map2.ts, 4, 31)) +>x1 : Symbol(I.x1, Decl(map2.ts, 5, 17)) +} + + +=== tests/cases/compiler/observable.ts === +export declare class Observable { +>Observable : Symbol(Observable, Decl(observable.ts, 0, 0)) +>T : Symbol(T, Decl(observable.ts, 0, 32)) + + filter(pred: (e:T) => boolean): Observable; +>filter : Symbol(Observable.filter, Decl(observable.ts, 0, 36)) +>pred : Symbol(pred, Decl(observable.ts, 1, 11)) +>e : Symbol(e, Decl(observable.ts, 1, 18)) +>T : Symbol(T, Decl(observable.ts, 0, 32)) +>Observable : Symbol(Observable, Decl(observable.ts, 0, 0)) +>T : Symbol(T, Decl(observable.ts, 0, 32)) +} + +=== tests/cases/compiler/main.ts === +import { Observable } from "./observable" +>Observable : Symbol(Observable, Decl(main.ts, 0, 8)) + +import "./map1"; +import "./map2"; + +let x: Observable; +>x : Symbol(x, Decl(main.ts, 4, 3)) +>Observable : Symbol(Observable, Decl(main.ts, 0, 8)) + diff --git a/tests/baselines/reference/moduleAugmentationCollidingNamesInAugmentation1.types b/tests/baselines/reference/moduleAugmentationCollidingNamesInAugmentation1.types new file mode 100644 index 00000000000..e87560c6a3d --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationCollidingNamesInAugmentation1.types @@ -0,0 +1,69 @@ +=== tests/cases/compiler/map1.ts === + +import { Observable } from "./observable" +>Observable : typeof Observable + +(Observable.prototype).map = function() { } +>(Observable.prototype).map = function() { } : () => void +>(Observable.prototype).map : any +>(Observable.prototype) : any +>Observable.prototype : any +>Observable.prototype : Observable +>Observable : typeof Observable +>prototype : Observable +>map : any +>function() { } : () => void + +declare module "./observable" { + interface I {x0} +>I : I +>x0 : any +} + +=== tests/cases/compiler/map2.ts === +import { Observable } from "./observable" +>Observable : typeof Observable + +(Observable.prototype).map = function() { } +>(Observable.prototype).map = function() { } : () => void +>(Observable.prototype).map : any +>(Observable.prototype) : any +>Observable.prototype : any +>Observable.prototype : Observable +>Observable : typeof Observable +>prototype : Observable +>map : any +>function() { } : () => void + +declare module "./observable" { + interface I {x1} +>I : I +>x1 : any +} + + +=== tests/cases/compiler/observable.ts === +export declare class Observable { +>Observable : Observable +>T : T + + filter(pred: (e:T) => boolean): Observable; +>filter : (pred: (e: T) => boolean) => Observable +>pred : (e: T) => boolean +>e : T +>T : T +>Observable : Observable +>T : T +} + +=== tests/cases/compiler/main.ts === +import { Observable } from "./observable" +>Observable : typeof Observable + +import "./map1"; +import "./map2"; + +let x: Observable; +>x : Observable +>Observable : Observable + diff --git a/tests/baselines/reference/moduleAugmentationDeclarationEmit1.js b/tests/baselines/reference/moduleAugmentationDeclarationEmit1.js new file mode 100644 index 00000000000..7b44fb7a637 --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationDeclarationEmit1.js @@ -0,0 +1,69 @@ +//// [tests/cases/compiler/moduleAugmentationDeclarationEmit1.ts] //// + +//// [map.ts] + +import { Observable } from "./observable" + +(Observable.prototype).map = function() { } + +declare module "./observable" { + interface Observable { + map(proj: (e:T) => U): Observable + } + namespace Observable { + let someAnotherValue: number; + } +} + +//// [observable.ts] +export declare class Observable { + filter(pred: (e:T) => boolean): Observable; +} + +export namespace Observable { + let someValue: number; +} + + +//// [main.ts] +import { Observable } from "./observable" +import "./map"; + +let x: Observable; +let y = x.map(x => x + 1); + +//// [observable.js] +"use strict"; +var Observable; +(function (Observable) { + var someValue; +})(Observable = exports.Observable || (exports.Observable = {})); +//// [map.js] +"use strict"; +var observable_1 = require("./observable"); +observable_1.Observable.prototype.map = function () { }; +//// [main.js] +"use strict"; +require("./map"); +var x; +var y = x.map(function (x) { return x + 1; }); + + +//// [observable.d.ts] +export declare class Observable { + filter(pred: (e: T) => boolean): Observable; +} +export declare namespace Observable { +} +//// [map.d.ts] +declare module "./observable" { + interface Observable { + map(proj: (e: T) => U): Observable; + } + namespace Observable { + let someAnotherValue: number; + } +} +export {}; +//// [main.d.ts] +import "./map"; diff --git a/tests/baselines/reference/moduleAugmentationDeclarationEmit1.symbols b/tests/baselines/reference/moduleAugmentationDeclarationEmit1.symbols new file mode 100644 index 00000000000..17e31591be0 --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationDeclarationEmit1.symbols @@ -0,0 +1,73 @@ +=== tests/cases/compiler/map.ts === + +import { Observable } from "./observable" +>Observable : Symbol(Observable, Decl(map.ts, 1, 8)) + +(Observable.prototype).map = function() { } +>Observable.prototype : Symbol(Observable.prototype) +>Observable : Symbol(Observable, Decl(map.ts, 1, 8)) +>prototype : Symbol(Observable.prototype) + +declare module "./observable" { + interface Observable { +>Observable : Symbol(Observable, Decl(observable.ts, 0, 0), Decl(observable.ts, 2, 1), Decl(map.ts, 5, 31), Decl(map.ts, 8, 5)) +>T : Symbol(T, Decl(observable.ts, 0, 32), Decl(map.ts, 6, 25)) + + map(proj: (e:T) => U): Observable +>map : Symbol(Observable.map, Decl(map.ts, 6, 29)) +>U : Symbol(U, Decl(map.ts, 7, 12)) +>proj : Symbol(proj, Decl(map.ts, 7, 15)) +>e : Symbol(e, Decl(map.ts, 7, 22)) +>T : Symbol(T, Decl(observable.ts, 0, 32), Decl(map.ts, 6, 25)) +>U : Symbol(U, Decl(map.ts, 7, 12)) +>Observable : Symbol(Observable, Decl(observable.ts, 0, 0), Decl(observable.ts, 2, 1), Decl(map.ts, 5, 31), Decl(map.ts, 8, 5)) +>U : Symbol(U, Decl(map.ts, 7, 12)) + } + namespace Observable { +>Observable : Symbol(Observable, Decl(observable.ts, 0, 0), Decl(observable.ts, 2, 1), Decl(map.ts, 5, 31), Decl(map.ts, 8, 5)) + + let someAnotherValue: number; +>someAnotherValue : Symbol(someAnotherValue, Decl(map.ts, 10, 11)) + } +} + +=== tests/cases/compiler/observable.ts === +export declare class Observable { +>Observable : Symbol(Observable, Decl(observable.ts, 0, 0), Decl(observable.ts, 2, 1), Decl(map.ts, 5, 31), Decl(map.ts, 8, 5)) +>T : Symbol(T, Decl(observable.ts, 0, 32), Decl(map.ts, 6, 25)) + + filter(pred: (e:T) => boolean): Observable; +>filter : Symbol(Observable.filter, Decl(observable.ts, 0, 36)) +>pred : Symbol(pred, Decl(observable.ts, 1, 11)) +>e : Symbol(e, Decl(observable.ts, 1, 18)) +>T : Symbol(T, Decl(observable.ts, 0, 32), Decl(map.ts, 6, 25)) +>Observable : Symbol(Observable, Decl(observable.ts, 0, 0), Decl(observable.ts, 2, 1), Decl(map.ts, 5, 31), Decl(map.ts, 8, 5)) +>T : Symbol(T, Decl(observable.ts, 0, 32), Decl(map.ts, 6, 25)) +} + +export namespace Observable { +>Observable : Symbol(Observable, Decl(observable.ts, 0, 0), Decl(observable.ts, 2, 1), Decl(map.ts, 5, 31), Decl(map.ts, 8, 5)) + + let someValue: number; +>someValue : Symbol(someValue, Decl(observable.ts, 5, 7)) +} + + +=== tests/cases/compiler/main.ts === +import { Observable } from "./observable" +>Observable : Symbol(Observable, Decl(main.ts, 0, 8)) + +import "./map"; + +let x: Observable; +>x : Symbol(x, Decl(main.ts, 3, 3)) +>Observable : Symbol(Observable, Decl(main.ts, 0, 8)) + +let y = x.map(x => x + 1); +>y : Symbol(y, Decl(main.ts, 4, 3)) +>x.map : Symbol(Observable.map, Decl(map.ts, 6, 29)) +>x : Symbol(x, Decl(main.ts, 3, 3)) +>map : Symbol(Observable.map, Decl(map.ts, 6, 29)) +>x : Symbol(x, Decl(main.ts, 4, 14)) +>x : Symbol(x, Decl(main.ts, 4, 14)) + diff --git a/tests/baselines/reference/moduleAugmentationDeclarationEmit1.types b/tests/baselines/reference/moduleAugmentationDeclarationEmit1.types new file mode 100644 index 00000000000..fad835029c2 --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationDeclarationEmit1.types @@ -0,0 +1,83 @@ +=== tests/cases/compiler/map.ts === + +import { Observable } from "./observable" +>Observable : typeof Observable + +(Observable.prototype).map = function() { } +>(Observable.prototype).map = function() { } : () => void +>(Observable.prototype).map : any +>(Observable.prototype) : any +>Observable.prototype : any +>Observable.prototype : Observable +>Observable : typeof Observable +>prototype : Observable +>map : any +>function() { } : () => void + +declare module "./observable" { + interface Observable { +>Observable : Observable +>T : T + + map(proj: (e:T) => U): Observable +>map : (proj: (e: T) => U) => Observable +>U : U +>proj : (e: T) => U +>e : T +>T : T +>U : U +>Observable : Observable +>U : U + } + namespace Observable { +>Observable : typeof Observable + + let someAnotherValue: number; +>someAnotherValue : number + } +} + +=== tests/cases/compiler/observable.ts === +export declare class Observable { +>Observable : Observable +>T : T + + filter(pred: (e:T) => boolean): Observable; +>filter : (pred: (e: T) => boolean) => Observable +>pred : (e: T) => boolean +>e : T +>T : T +>Observable : Observable +>T : T +} + +export namespace Observable { +>Observable : typeof Observable + + let someValue: number; +>someValue : number +} + + +=== tests/cases/compiler/main.ts === +import { Observable } from "./observable" +>Observable : typeof Observable + +import "./map"; + +let x: Observable; +>x : Observable +>Observable : Observable + +let y = x.map(x => x + 1); +>y : Observable +>x.map(x => x + 1) : Observable +>x.map : (proj: (e: number) => U) => Observable +>x : Observable +>map : (proj: (e: number) => U) => Observable +>x => x + 1 : (x: number) => number +>x : number +>x + 1 : number +>x : number +>1 : number + diff --git a/tests/baselines/reference/moduleAugmentationDeclarationEmit2.js b/tests/baselines/reference/moduleAugmentationDeclarationEmit2.js new file mode 100644 index 00000000000..547d017c502 --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationDeclarationEmit2.js @@ -0,0 +1,74 @@ +//// [tests/cases/compiler/moduleAugmentationDeclarationEmit2.ts] //// + +//// [map.ts] + +import { Observable } from "./observable" + +(Observable.prototype).map = function() { } + +declare module "./observable" { + interface Observable { + map(proj: (e:T) => U): Observable + } + namespace Observable { + let someAnotherValue: string; + } +} + +//// [observable.ts] +export declare class Observable { + filter(pred: (e:T) => boolean): Observable; +} + +export namespace Observable { + export let someValue: number; +} + + +//// [main.ts] +import { Observable } from "./observable" +import "./map"; + +let x: Observable; +let y = x.map(x => x + 1); +let z1 = Observable.someValue.toFixed(); +let z2 = Observable.someAnotherValue.toLowerCase(); + +//// [observable.js] +"use strict"; +var Observable; +(function (Observable) { +})(Observable = exports.Observable || (exports.Observable = {})); +//// [map.js] +"use strict"; +var observable_1 = require("./observable"); +observable_1.Observable.prototype.map = function () { }; +//// [main.js] +"use strict"; +var observable_1 = require("./observable"); +require("./map"); +var x; +var y = x.map(function (x) { return x + 1; }); +var z1 = observable_1.Observable.someValue.toFixed(); +var z2 = observable_1.Observable.someAnotherValue.toLowerCase(); + + +//// [observable.d.ts] +export declare class Observable { + filter(pred: (e: T) => boolean): Observable; +} +export declare namespace Observable { + let someValue: number; +} +//// [map.d.ts] +declare module "./observable" { + interface Observable { + map(proj: (e: T) => U): Observable; + } + namespace Observable { + let someAnotherValue: string; + } +} +export {}; +//// [main.d.ts] +import "./map"; diff --git a/tests/baselines/reference/moduleAugmentationDeclarationEmit2.symbols b/tests/baselines/reference/moduleAugmentationDeclarationEmit2.symbols new file mode 100644 index 00000000000..38a0506d179 --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationDeclarationEmit2.symbols @@ -0,0 +1,89 @@ +=== tests/cases/compiler/map.ts === + +import { Observable } from "./observable" +>Observable : Symbol(Observable, Decl(map.ts, 1, 8)) + +(Observable.prototype).map = function() { } +>Observable.prototype : Symbol(Observable.prototype) +>Observable : Symbol(Observable, Decl(map.ts, 1, 8)) +>prototype : Symbol(Observable.prototype) + +declare module "./observable" { + interface Observable { +>Observable : Symbol(Observable, Decl(observable.ts, 0, 0), Decl(observable.ts, 2, 1), Decl(map.ts, 5, 31), Decl(map.ts, 8, 5)) +>T : Symbol(T, Decl(observable.ts, 0, 32), Decl(map.ts, 6, 25)) + + map(proj: (e:T) => U): Observable +>map : Symbol(Observable.map, Decl(map.ts, 6, 29)) +>U : Symbol(U, Decl(map.ts, 7, 12)) +>proj : Symbol(proj, Decl(map.ts, 7, 15)) +>e : Symbol(e, Decl(map.ts, 7, 22)) +>T : Symbol(T, Decl(observable.ts, 0, 32), Decl(map.ts, 6, 25)) +>U : Symbol(U, Decl(map.ts, 7, 12)) +>Observable : Symbol(Observable, Decl(observable.ts, 0, 0), Decl(observable.ts, 2, 1), Decl(map.ts, 5, 31), Decl(map.ts, 8, 5)) +>U : Symbol(U, Decl(map.ts, 7, 12)) + } + namespace Observable { +>Observable : Symbol(Observable, Decl(observable.ts, 0, 0), Decl(observable.ts, 2, 1), Decl(map.ts, 5, 31), Decl(map.ts, 8, 5)) + + let someAnotherValue: string; +>someAnotherValue : Symbol(someAnotherValue, Decl(map.ts, 10, 11)) + } +} + +=== tests/cases/compiler/observable.ts === +export declare class Observable { +>Observable : Symbol(Observable, Decl(observable.ts, 0, 0), Decl(observable.ts, 2, 1), Decl(map.ts, 5, 31), Decl(map.ts, 8, 5)) +>T : Symbol(T, Decl(observable.ts, 0, 32), Decl(map.ts, 6, 25)) + + filter(pred: (e:T) => boolean): Observable; +>filter : Symbol(Observable.filter, Decl(observable.ts, 0, 36)) +>pred : Symbol(pred, Decl(observable.ts, 1, 11)) +>e : Symbol(e, Decl(observable.ts, 1, 18)) +>T : Symbol(T, Decl(observable.ts, 0, 32), Decl(map.ts, 6, 25)) +>Observable : Symbol(Observable, Decl(observable.ts, 0, 0), Decl(observable.ts, 2, 1), Decl(map.ts, 5, 31), Decl(map.ts, 8, 5)) +>T : Symbol(T, Decl(observable.ts, 0, 32), Decl(map.ts, 6, 25)) +} + +export namespace Observable { +>Observable : Symbol(Observable, Decl(observable.ts, 0, 0), Decl(observable.ts, 2, 1), Decl(map.ts, 5, 31), Decl(map.ts, 8, 5)) + + export let someValue: number; +>someValue : Symbol(someValue, Decl(observable.ts, 5, 14)) +} + + +=== tests/cases/compiler/main.ts === +import { Observable } from "./observable" +>Observable : Symbol(Observable, Decl(main.ts, 0, 8)) + +import "./map"; + +let x: Observable; +>x : Symbol(x, Decl(main.ts, 3, 3)) +>Observable : Symbol(Observable, Decl(main.ts, 0, 8)) + +let y = x.map(x => x + 1); +>y : Symbol(y, Decl(main.ts, 4, 3)) +>x.map : Symbol(Observable.map, Decl(map.ts, 6, 29)) +>x : Symbol(x, Decl(main.ts, 3, 3)) +>map : Symbol(Observable.map, Decl(map.ts, 6, 29)) +>x : Symbol(x, Decl(main.ts, 4, 14)) +>x : Symbol(x, Decl(main.ts, 4, 14)) + +let z1 = Observable.someValue.toFixed(); +>z1 : Symbol(z1, Decl(main.ts, 5, 3)) +>Observable.someValue.toFixed : Symbol(Number.toFixed, Decl(lib.d.ts, --, --)) +>Observable.someValue : Symbol(Observable.someValue, Decl(observable.ts, 5, 14)) +>Observable : Symbol(Observable, Decl(main.ts, 0, 8)) +>someValue : Symbol(Observable.someValue, Decl(observable.ts, 5, 14)) +>toFixed : Symbol(Number.toFixed, Decl(lib.d.ts, --, --)) + +let z2 = Observable.someAnotherValue.toLowerCase(); +>z2 : Symbol(z2, Decl(main.ts, 6, 3)) +>Observable.someAnotherValue.toLowerCase : Symbol(String.toLowerCase, Decl(lib.d.ts, --, --)) +>Observable.someAnotherValue : Symbol(Observable.someAnotherValue, Decl(map.ts, 10, 11)) +>Observable : Symbol(Observable, Decl(main.ts, 0, 8)) +>someAnotherValue : Symbol(Observable.someAnotherValue, Decl(map.ts, 10, 11)) +>toLowerCase : Symbol(String.toLowerCase, Decl(lib.d.ts, --, --)) + diff --git a/tests/baselines/reference/moduleAugmentationDeclarationEmit2.types b/tests/baselines/reference/moduleAugmentationDeclarationEmit2.types new file mode 100644 index 00000000000..85e4ead2ac0 --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationDeclarationEmit2.types @@ -0,0 +1,101 @@ +=== tests/cases/compiler/map.ts === + +import { Observable } from "./observable" +>Observable : typeof Observable + +(Observable.prototype).map = function() { } +>(Observable.prototype).map = function() { } : () => void +>(Observable.prototype).map : any +>(Observable.prototype) : any +>Observable.prototype : any +>Observable.prototype : Observable +>Observable : typeof Observable +>prototype : Observable +>map : any +>function() { } : () => void + +declare module "./observable" { + interface Observable { +>Observable : Observable +>T : T + + map(proj: (e:T) => U): Observable +>map : (proj: (e: T) => U) => Observable +>U : U +>proj : (e: T) => U +>e : T +>T : T +>U : U +>Observable : Observable +>U : U + } + namespace Observable { +>Observable : typeof Observable + + let someAnotherValue: string; +>someAnotherValue : string + } +} + +=== tests/cases/compiler/observable.ts === +export declare class Observable { +>Observable : Observable +>T : T + + filter(pred: (e:T) => boolean): Observable; +>filter : (pred: (e: T) => boolean) => Observable +>pred : (e: T) => boolean +>e : T +>T : T +>Observable : Observable +>T : T +} + +export namespace Observable { +>Observable : typeof Observable + + export let someValue: number; +>someValue : number +} + + +=== tests/cases/compiler/main.ts === +import { Observable } from "./observable" +>Observable : typeof Observable + +import "./map"; + +let x: Observable; +>x : Observable +>Observable : Observable + +let y = x.map(x => x + 1); +>y : Observable +>x.map(x => x + 1) : Observable +>x.map : (proj: (e: number) => U) => Observable +>x : Observable +>map : (proj: (e: number) => U) => Observable +>x => x + 1 : (x: number) => number +>x : number +>x + 1 : number +>x : number +>1 : number + +let z1 = Observable.someValue.toFixed(); +>z1 : string +>Observable.someValue.toFixed() : string +>Observable.someValue.toFixed : (fractionDigits?: number) => string +>Observable.someValue : number +>Observable : typeof Observable +>someValue : number +>toFixed : (fractionDigits?: number) => string + +let z2 = Observable.someAnotherValue.toLowerCase(); +>z2 : string +>Observable.someAnotherValue.toLowerCase() : string +>Observable.someAnotherValue.toLowerCase : () => string +>Observable.someAnotherValue : string +>Observable : typeof Observable +>someAnotherValue : string +>toLowerCase : () => string + diff --git a/tests/baselines/reference/moduleAugmentationDisallowedExtensions.errors.txt b/tests/baselines/reference/moduleAugmentationDisallowedExtensions.errors.txt new file mode 100644 index 00000000000..25577578ceb --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationDisallowedExtensions.errors.txt @@ -0,0 +1,75 @@ +tests/cases/compiler/x.ts(18,5): error TS2667: Imports are not permitted in module augmentations. Consider moving them to the enclosing external module. +tests/cases/compiler/x.ts(18,26): error TS2307: Cannot find module './x0'. +tests/cases/compiler/x.ts(19,5): error TS2667: Imports are not permitted in module augmentations. Consider moving them to the enclosing external module. +tests/cases/compiler/x.ts(19,21): error TS2307: Cannot find module './x0'. +tests/cases/compiler/x.ts(20,5): error TS2666: Exports and export assignments are not permitted in module augmentations. +tests/cases/compiler/x.ts(20,19): error TS2307: Cannot find module './x0'. +tests/cases/compiler/x.ts(21,5): error TS2666: Exports and export assignments are not permitted in module augmentations. +tests/cases/compiler/x.ts(21,21): error TS2307: Cannot find module './x0'. +tests/cases/compiler/x.ts(25,5): error TS2666: Exports and export assignments are not permitted in module augmentations. + + +==== tests/cases/compiler/x0.ts (0 errors) ==== + + export let a = 1; + +==== tests/cases/compiler/x.ts (9 errors) ==== + + namespace N1 { + export let x = 1; + } + + declare module "./observable" { + var x: number; + let y: number; + const z: number; + let {x1, y1, z0: {n}, z1: {arr: [el1, el2, el3]}}: {x1: number, y1: string, z0: {n: number}, z1: {arr: number[]} } + interface A { x } + namespace N { + export class C {} + } + class Cls {} + function foo(): number; + type T = number; + import * as all from "./x0"; + ~~~~~~ +!!! error TS2667: Imports are not permitted in module augmentations. Consider moving them to the enclosing external module. + ~~~~~~ +!!! error TS2307: Cannot find module './x0'. + import {a} from "./x0"; + ~~~~~~ +!!! error TS2667: Imports are not permitted in module augmentations. Consider moving them to the enclosing external module. + ~~~~~~ +!!! error TS2307: Cannot find module './x0'. + export * from "./x0"; + ~~~~~~ +!!! error TS2666: Exports and export assignments are not permitted in module augmentations. + ~~~~~~ +!!! error TS2307: Cannot find module './x0'. + export {a} from "./x0"; + ~~~~~~ +!!! error TS2666: Exports and export assignments are not permitted in module augmentations. + ~~~~~~ +!!! error TS2307: Cannot find module './x0'. + } + + declare module "./test" { + export = N1; + ~~~~~~ +!!! error TS2666: Exports and export assignments are not permitted in module augmentations. + } + export {} + +==== tests/cases/compiler/observable.ts (0 errors) ==== + export declare class Observable { + filter(pred: (e:T) => boolean): Observable; + } + export var x = 1; + +==== tests/cases/compiler/test.ts (0 errors) ==== + export let b = 1; + +==== tests/cases/compiler/main.ts (0 errors) ==== + import { Observable } from "./observable" + import "./x"; + \ No newline at end of file diff --git a/tests/baselines/reference/moduleAugmentationDisallowedExtensions.js b/tests/baselines/reference/moduleAugmentationDisallowedExtensions.js new file mode 100644 index 00000000000..8c497d63c42 --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationDisallowedExtensions.js @@ -0,0 +1,67 @@ +//// [tests/cases/compiler/moduleAugmentationDisallowedExtensions.ts] //// + +//// [x0.ts] + +export let a = 1; + +//// [x.ts] + +namespace N1 { + export let x = 1; +} + +declare module "./observable" { + var x: number; + let y: number; + const z: number; + let {x1, y1, z0: {n}, z1: {arr: [el1, el2, el3]}}: {x1: number, y1: string, z0: {n: number}, z1: {arr: number[]} } + interface A { x } + namespace N { + export class C {} + } + class Cls {} + function foo(): number; + type T = number; + import * as all from "./x0"; + import {a} from "./x0"; + export * from "./x0"; + export {a} from "./x0"; +} + +declare module "./test" { + export = N1; +} +export {} + +//// [observable.ts] +export declare class Observable { + filter(pred: (e:T) => boolean): Observable; +} +export var x = 1; + +//// [test.ts] +export let b = 1; + +//// [main.ts] +import { Observable } from "./observable" +import "./x"; + + +//// [x0.js] +"use strict"; +exports.a = 1; +//// [x.js] +"use strict"; +var N1; +(function (N1) { + N1.x = 1; +})(N1 || (N1 = {})); +//// [observable.js] +"use strict"; +exports.x = 1; +//// [test.js] +"use strict"; +exports.b = 1; +//// [main.js] +"use strict"; +require("./x"); diff --git a/tests/baselines/reference/moduleAugmentationExtendAmbientModule1.js b/tests/baselines/reference/moduleAugmentationExtendAmbientModule1.js new file mode 100644 index 00000000000..0a8b1b0b4b5 --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationExtendAmbientModule1.js @@ -0,0 +1,45 @@ +//// [tests/cases/compiler/moduleAugmentationExtendAmbientModule1.ts] //// + +//// [map.ts] + +import { Observable } from "observable" + +(Observable.prototype).map = function() { } + +declare module "observable" { + interface Observable { + map(proj: (e:T) => U): Observable + } + namespace Observable { + let someAnotherValue: number; + } +} + +//// [observable.d.ts] +declare module "observable" { + class Observable { + filter(pred: (e:T) => boolean): Observable; + } + namespace Observable { + let someValue: number; + } +} + +//// [main.ts] + +/// +import { Observable } from "observable" +import "./map"; + +let x: Observable; +let y = x.map(x => x + 1); + +//// [map.js] +"use strict"; +var observable_1 = require("observable"); +observable_1.Observable.prototype.map = function () { }; +//// [main.js] +"use strict"; +require("./map"); +var x; +var y = x.map(function (x) { return x + 1; }); diff --git a/tests/baselines/reference/moduleAugmentationExtendAmbientModule1.symbols b/tests/baselines/reference/moduleAugmentationExtendAmbientModule1.symbols new file mode 100644 index 00000000000..62ac82b6953 --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationExtendAmbientModule1.symbols @@ -0,0 +1,75 @@ +=== tests/cases/compiler/main.ts === + +/// +import { Observable } from "observable" +>Observable : Symbol(Observable, Decl(main.ts, 2, 8)) + +import "./map"; + +let x: Observable; +>x : Symbol(x, Decl(main.ts, 5, 3)) +>Observable : Symbol(Observable, Decl(main.ts, 2, 8)) + +let y = x.map(x => x + 1); +>y : Symbol(y, Decl(main.ts, 6, 3)) +>x.map : Symbol(Observable.map, Decl(map.ts, 6, 29)) +>x : Symbol(x, Decl(main.ts, 5, 3)) +>map : Symbol(Observable.map, Decl(map.ts, 6, 29)) +>x : Symbol(x, Decl(main.ts, 6, 14)) +>x : Symbol(x, Decl(main.ts, 6, 14)) + +=== tests/cases/compiler/map.ts === + +import { Observable } from "observable" +>Observable : Symbol(Observable, Decl(map.ts, 1, 8)) + +(Observable.prototype).map = function() { } +>Observable.prototype : Symbol(Observable.prototype) +>Observable : Symbol(Observable, Decl(map.ts, 1, 8)) +>prototype : Symbol(Observable.prototype) + +declare module "observable" { + interface Observable { +>Observable : Symbol(Observable, Decl(observable.d.ts, 0, 29), Decl(observable.d.ts, 3, 5), Decl(map.ts, 5, 29), Decl(map.ts, 8, 5)) +>T : Symbol(T, Decl(observable.d.ts, 1, 21), Decl(map.ts, 6, 25)) + + map(proj: (e:T) => U): Observable +>map : Symbol(Observable.map, Decl(map.ts, 6, 29)) +>U : Symbol(U, Decl(map.ts, 7, 12)) +>proj : Symbol(proj, Decl(map.ts, 7, 15)) +>e : Symbol(e, Decl(map.ts, 7, 22)) +>T : Symbol(T, Decl(observable.d.ts, 1, 21), Decl(map.ts, 6, 25)) +>U : Symbol(U, Decl(map.ts, 7, 12)) +>Observable : Symbol(Observable, Decl(observable.d.ts, 0, 29), Decl(observable.d.ts, 3, 5), Decl(map.ts, 5, 29), Decl(map.ts, 8, 5)) +>U : Symbol(U, Decl(map.ts, 7, 12)) + } + namespace Observable { +>Observable : Symbol(Observable, Decl(observable.d.ts, 0, 29), Decl(observable.d.ts, 3, 5), Decl(map.ts, 5, 29), Decl(map.ts, 8, 5)) + + let someAnotherValue: number; +>someAnotherValue : Symbol(someAnotherValue, Decl(map.ts, 10, 11)) + } +} + +=== tests/cases/compiler/observable.d.ts === +declare module "observable" { + class Observable { +>Observable : Symbol(Observable, Decl(observable.d.ts, 0, 29), Decl(observable.d.ts, 3, 5), Decl(map.ts, 5, 29), Decl(map.ts, 8, 5)) +>T : Symbol(T, Decl(observable.d.ts, 1, 21), Decl(map.ts, 6, 25)) + + filter(pred: (e:T) => boolean): Observable; +>filter : Symbol(Observable.filter, Decl(observable.d.ts, 1, 25)) +>pred : Symbol(pred, Decl(observable.d.ts, 2, 15)) +>e : Symbol(e, Decl(observable.d.ts, 2, 22)) +>T : Symbol(T, Decl(observable.d.ts, 1, 21), Decl(map.ts, 6, 25)) +>Observable : Symbol(Observable, Decl(observable.d.ts, 0, 29), Decl(observable.d.ts, 3, 5), Decl(map.ts, 5, 29), Decl(map.ts, 8, 5)) +>T : Symbol(T, Decl(observable.d.ts, 1, 21), Decl(map.ts, 6, 25)) + } + namespace Observable { +>Observable : Symbol(Observable, Decl(observable.d.ts, 0, 29), Decl(observable.d.ts, 3, 5), Decl(map.ts, 5, 29), Decl(map.ts, 8, 5)) + + let someValue: number; +>someValue : Symbol(someValue, Decl(observable.d.ts, 5, 11)) + } +} + diff --git a/tests/baselines/reference/moduleAugmentationExtendAmbientModule1.types b/tests/baselines/reference/moduleAugmentationExtendAmbientModule1.types new file mode 100644 index 00000000000..e6ee79e3585 --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationExtendAmbientModule1.types @@ -0,0 +1,85 @@ +=== tests/cases/compiler/main.ts === + +/// +import { Observable } from "observable" +>Observable : typeof Observable + +import "./map"; + +let x: Observable; +>x : Observable +>Observable : Observable + +let y = x.map(x => x + 1); +>y : Observable +>x.map(x => x + 1) : Observable +>x.map : (proj: (e: number) => U) => Observable +>x : Observable +>map : (proj: (e: number) => U) => Observable +>x => x + 1 : (x: number) => number +>x : number +>x + 1 : number +>x : number +>1 : number + +=== tests/cases/compiler/map.ts === + +import { Observable } from "observable" +>Observable : typeof Observable + +(Observable.prototype).map = function() { } +>(Observable.prototype).map = function() { } : () => void +>(Observable.prototype).map : any +>(Observable.prototype) : any +>Observable.prototype : any +>Observable.prototype : Observable +>Observable : typeof Observable +>prototype : Observable +>map : any +>function() { } : () => void + +declare module "observable" { + interface Observable { +>Observable : Observable +>T : T + + map(proj: (e:T) => U): Observable +>map : (proj: (e: T) => U) => Observable +>U : U +>proj : (e: T) => U +>e : T +>T : T +>U : U +>Observable : Observable +>U : U + } + namespace Observable { +>Observable : typeof Observable + + let someAnotherValue: number; +>someAnotherValue : number + } +} + +=== tests/cases/compiler/observable.d.ts === +declare module "observable" { + class Observable { +>Observable : Observable +>T : T + + filter(pred: (e:T) => boolean): Observable; +>filter : (pred: (e: T) => boolean) => Observable +>pred : (e: T) => boolean +>e : T +>T : T +>Observable : Observable +>T : T + } + namespace Observable { +>Observable : typeof Observable + + let someValue: number; +>someValue : number + } +} + diff --git a/tests/baselines/reference/moduleAugmentationExtendAmbientModule2.js b/tests/baselines/reference/moduleAugmentationExtendAmbientModule2.js new file mode 100644 index 00000000000..2d65953e2a3 --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationExtendAmbientModule2.js @@ -0,0 +1,66 @@ +//// [tests/cases/compiler/moduleAugmentationExtendAmbientModule2.ts] //// + +//// [map.ts] + +import { Observable } from "observable" + +(Observable.prototype).map = function() { } + +declare module "observable" { + interface Observable { + map(proj: (e:T) => U): Observable + } + namespace Observable { + let someAnotherValue: string; + } +} + +//// [observable.d.ts] +declare module "observable" { + class Observable { + filter(pred: (e:T) => boolean): Observable; + } + namespace Observable { + export let someValue: number; + } +} + +//// [main.ts] + +/// +import { Observable } from "observable" +import "./map"; + +let x: Observable; +let y = x.map(x => x + 1); +let z1 = Observable.someValue.toFixed(); +let z2 = Observable.someAnotherValue.toLowerCase(); + +//// [map.js] +"use strict"; +var observable_1 = require("observable"); +observable_1.Observable.prototype.map = function () { }; +//// [main.js] +"use strict"; +/// +var observable_1 = require("observable"); +require("./map"); +var x; +var y = x.map(function (x) { return x + 1; }); +var z1 = observable_1.Observable.someValue.toFixed(); +var z2 = observable_1.Observable.someAnotherValue.toLowerCase(); + + +//// [map.d.ts] +declare module "observable" { + interface Observable { + map(proj: (e: T) => U): Observable; + } + namespace Observable { + let someAnotherValue: string; + } +} +export {}; +//// [main.d.ts] +/// +import "./map"; diff --git a/tests/baselines/reference/moduleAugmentationExtendAmbientModule2.symbols b/tests/baselines/reference/moduleAugmentationExtendAmbientModule2.symbols new file mode 100644 index 00000000000..bbd3b6e5f79 --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationExtendAmbientModule2.symbols @@ -0,0 +1,91 @@ +=== tests/cases/compiler/main.ts === + +/// +import { Observable } from "observable" +>Observable : Symbol(Observable, Decl(main.ts, 2, 8)) + +import "./map"; + +let x: Observable; +>x : Symbol(x, Decl(main.ts, 5, 3)) +>Observable : Symbol(Observable, Decl(main.ts, 2, 8)) + +let y = x.map(x => x + 1); +>y : Symbol(y, Decl(main.ts, 6, 3)) +>x.map : Symbol(Observable.map, Decl(map.ts, 6, 29)) +>x : Symbol(x, Decl(main.ts, 5, 3)) +>map : Symbol(Observable.map, Decl(map.ts, 6, 29)) +>x : Symbol(x, Decl(main.ts, 6, 14)) +>x : Symbol(x, Decl(main.ts, 6, 14)) + +let z1 = Observable.someValue.toFixed(); +>z1 : Symbol(z1, Decl(main.ts, 7, 3)) +>Observable.someValue.toFixed : Symbol(Number.toFixed, Decl(lib.d.ts, --, --)) +>Observable.someValue : Symbol(Observable.someValue, Decl(observable.d.ts, 5, 18)) +>Observable : Symbol(Observable, Decl(main.ts, 2, 8)) +>someValue : Symbol(Observable.someValue, Decl(observable.d.ts, 5, 18)) +>toFixed : Symbol(Number.toFixed, Decl(lib.d.ts, --, --)) + +let z2 = Observable.someAnotherValue.toLowerCase(); +>z2 : Symbol(z2, Decl(main.ts, 8, 3)) +>Observable.someAnotherValue.toLowerCase : Symbol(String.toLowerCase, Decl(lib.d.ts, --, --)) +>Observable.someAnotherValue : Symbol(Observable.someAnotherValue, Decl(map.ts, 10, 11)) +>Observable : Symbol(Observable, Decl(main.ts, 2, 8)) +>someAnotherValue : Symbol(Observable.someAnotherValue, Decl(map.ts, 10, 11)) +>toLowerCase : Symbol(String.toLowerCase, Decl(lib.d.ts, --, --)) + +=== tests/cases/compiler/map.ts === + +import { Observable } from "observable" +>Observable : Symbol(Observable, Decl(map.ts, 1, 8)) + +(Observable.prototype).map = function() { } +>Observable.prototype : Symbol(Observable.prototype) +>Observable : Symbol(Observable, Decl(map.ts, 1, 8)) +>prototype : Symbol(Observable.prototype) + +declare module "observable" { + interface Observable { +>Observable : Symbol(Observable, Decl(observable.d.ts, 0, 29), Decl(observable.d.ts, 3, 5), Decl(map.ts, 5, 29), Decl(map.ts, 8, 5)) +>T : Symbol(T, Decl(observable.d.ts, 1, 21), Decl(map.ts, 6, 25)) + + map(proj: (e:T) => U): Observable +>map : Symbol(Observable.map, Decl(map.ts, 6, 29)) +>U : Symbol(U, Decl(map.ts, 7, 12)) +>proj : Symbol(proj, Decl(map.ts, 7, 15)) +>e : Symbol(e, Decl(map.ts, 7, 22)) +>T : Symbol(T, Decl(observable.d.ts, 1, 21), Decl(map.ts, 6, 25)) +>U : Symbol(U, Decl(map.ts, 7, 12)) +>Observable : Symbol(Observable, Decl(observable.d.ts, 0, 29), Decl(observable.d.ts, 3, 5), Decl(map.ts, 5, 29), Decl(map.ts, 8, 5)) +>U : Symbol(U, Decl(map.ts, 7, 12)) + } + namespace Observable { +>Observable : Symbol(Observable, Decl(observable.d.ts, 0, 29), Decl(observable.d.ts, 3, 5), Decl(map.ts, 5, 29), Decl(map.ts, 8, 5)) + + let someAnotherValue: string; +>someAnotherValue : Symbol(someAnotherValue, Decl(map.ts, 10, 11)) + } +} + +=== tests/cases/compiler/observable.d.ts === +declare module "observable" { + class Observable { +>Observable : Symbol(Observable, Decl(observable.d.ts, 0, 29), Decl(observable.d.ts, 3, 5), Decl(map.ts, 5, 29), Decl(map.ts, 8, 5)) +>T : Symbol(T, Decl(observable.d.ts, 1, 21), Decl(map.ts, 6, 25)) + + filter(pred: (e:T) => boolean): Observable; +>filter : Symbol(Observable.filter, Decl(observable.d.ts, 1, 25)) +>pred : Symbol(pred, Decl(observable.d.ts, 2, 15)) +>e : Symbol(e, Decl(observable.d.ts, 2, 22)) +>T : Symbol(T, Decl(observable.d.ts, 1, 21), Decl(map.ts, 6, 25)) +>Observable : Symbol(Observable, Decl(observable.d.ts, 0, 29), Decl(observable.d.ts, 3, 5), Decl(map.ts, 5, 29), Decl(map.ts, 8, 5)) +>T : Symbol(T, Decl(observable.d.ts, 1, 21), Decl(map.ts, 6, 25)) + } + namespace Observable { +>Observable : Symbol(Observable, Decl(observable.d.ts, 0, 29), Decl(observable.d.ts, 3, 5), Decl(map.ts, 5, 29), Decl(map.ts, 8, 5)) + + export let someValue: number; +>someValue : Symbol(someValue, Decl(observable.d.ts, 5, 18)) + } +} + diff --git a/tests/baselines/reference/moduleAugmentationExtendAmbientModule2.types b/tests/baselines/reference/moduleAugmentationExtendAmbientModule2.types new file mode 100644 index 00000000000..70288e48f02 --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationExtendAmbientModule2.types @@ -0,0 +1,103 @@ +=== tests/cases/compiler/main.ts === + +/// +import { Observable } from "observable" +>Observable : typeof Observable + +import "./map"; + +let x: Observable; +>x : Observable +>Observable : Observable + +let y = x.map(x => x + 1); +>y : Observable +>x.map(x => x + 1) : Observable +>x.map : (proj: (e: number) => U) => Observable +>x : Observable +>map : (proj: (e: number) => U) => Observable +>x => x + 1 : (x: number) => number +>x : number +>x + 1 : number +>x : number +>1 : number + +let z1 = Observable.someValue.toFixed(); +>z1 : string +>Observable.someValue.toFixed() : string +>Observable.someValue.toFixed : (fractionDigits?: number) => string +>Observable.someValue : number +>Observable : typeof Observable +>someValue : number +>toFixed : (fractionDigits?: number) => string + +let z2 = Observable.someAnotherValue.toLowerCase(); +>z2 : string +>Observable.someAnotherValue.toLowerCase() : string +>Observable.someAnotherValue.toLowerCase : () => string +>Observable.someAnotherValue : string +>Observable : typeof Observable +>someAnotherValue : string +>toLowerCase : () => string + +=== tests/cases/compiler/map.ts === + +import { Observable } from "observable" +>Observable : typeof Observable + +(Observable.prototype).map = function() { } +>(Observable.prototype).map = function() { } : () => void +>(Observable.prototype).map : any +>(Observable.prototype) : any +>Observable.prototype : any +>Observable.prototype : Observable +>Observable : typeof Observable +>prototype : Observable +>map : any +>function() { } : () => void + +declare module "observable" { + interface Observable { +>Observable : Observable +>T : T + + map(proj: (e:T) => U): Observable +>map : (proj: (e: T) => U) => Observable +>U : U +>proj : (e: T) => U +>e : T +>T : T +>U : U +>Observable : Observable +>U : U + } + namespace Observable { +>Observable : typeof Observable + + let someAnotherValue: string; +>someAnotherValue : string + } +} + +=== tests/cases/compiler/observable.d.ts === +declare module "observable" { + class Observable { +>Observable : Observable +>T : T + + filter(pred: (e:T) => boolean): Observable; +>filter : (pred: (e: T) => boolean) => Observable +>pred : (e: T) => boolean +>e : T +>T : T +>Observable : Observable +>T : T + } + namespace Observable { +>Observable : typeof Observable + + export let someValue: number; +>someValue : number + } +} + diff --git a/tests/baselines/reference/moduleAugmentationExtendFileModule1.js b/tests/baselines/reference/moduleAugmentationExtendFileModule1.js new file mode 100644 index 00000000000..a539100c2ed --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationExtendFileModule1.js @@ -0,0 +1,49 @@ +//// [tests/cases/compiler/moduleAugmentationExtendFileModule1.ts] //// + +//// [map.ts] + +import { Observable } from "./observable" + +(Observable.prototype).map = function() { } + +declare module "./observable" { + interface Observable { + map(proj: (e:T) => U): Observable + } + namespace Observable { + let someAnotherValue: number; + } +} + +//// [observable.ts] +export declare class Observable { + filter(pred: (e:T) => boolean): Observable; +} + +export namespace Observable { + let someValue: number; +} + + +//// [main.ts] +import { Observable } from "./observable" +import "./map"; + +let x: Observable; +let y = x.map(x => x + 1); + +//// [observable.js] +"use strict"; +var Observable; +(function (Observable) { + var someValue; +})(Observable = exports.Observable || (exports.Observable = {})); +//// [map.js] +"use strict"; +var observable_1 = require("./observable"); +observable_1.Observable.prototype.map = function () { }; +//// [main.js] +"use strict"; +require("./map"); +var x; +var y = x.map(function (x) { return x + 1; }); diff --git a/tests/baselines/reference/moduleAugmentationExtendFileModule1.symbols b/tests/baselines/reference/moduleAugmentationExtendFileModule1.symbols new file mode 100644 index 00000000000..17e31591be0 --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationExtendFileModule1.symbols @@ -0,0 +1,73 @@ +=== tests/cases/compiler/map.ts === + +import { Observable } from "./observable" +>Observable : Symbol(Observable, Decl(map.ts, 1, 8)) + +(Observable.prototype).map = function() { } +>Observable.prototype : Symbol(Observable.prototype) +>Observable : Symbol(Observable, Decl(map.ts, 1, 8)) +>prototype : Symbol(Observable.prototype) + +declare module "./observable" { + interface Observable { +>Observable : Symbol(Observable, Decl(observable.ts, 0, 0), Decl(observable.ts, 2, 1), Decl(map.ts, 5, 31), Decl(map.ts, 8, 5)) +>T : Symbol(T, Decl(observable.ts, 0, 32), Decl(map.ts, 6, 25)) + + map(proj: (e:T) => U): Observable +>map : Symbol(Observable.map, Decl(map.ts, 6, 29)) +>U : Symbol(U, Decl(map.ts, 7, 12)) +>proj : Symbol(proj, Decl(map.ts, 7, 15)) +>e : Symbol(e, Decl(map.ts, 7, 22)) +>T : Symbol(T, Decl(observable.ts, 0, 32), Decl(map.ts, 6, 25)) +>U : Symbol(U, Decl(map.ts, 7, 12)) +>Observable : Symbol(Observable, Decl(observable.ts, 0, 0), Decl(observable.ts, 2, 1), Decl(map.ts, 5, 31), Decl(map.ts, 8, 5)) +>U : Symbol(U, Decl(map.ts, 7, 12)) + } + namespace Observable { +>Observable : Symbol(Observable, Decl(observable.ts, 0, 0), Decl(observable.ts, 2, 1), Decl(map.ts, 5, 31), Decl(map.ts, 8, 5)) + + let someAnotherValue: number; +>someAnotherValue : Symbol(someAnotherValue, Decl(map.ts, 10, 11)) + } +} + +=== tests/cases/compiler/observable.ts === +export declare class Observable { +>Observable : Symbol(Observable, Decl(observable.ts, 0, 0), Decl(observable.ts, 2, 1), Decl(map.ts, 5, 31), Decl(map.ts, 8, 5)) +>T : Symbol(T, Decl(observable.ts, 0, 32), Decl(map.ts, 6, 25)) + + filter(pred: (e:T) => boolean): Observable; +>filter : Symbol(Observable.filter, Decl(observable.ts, 0, 36)) +>pred : Symbol(pred, Decl(observable.ts, 1, 11)) +>e : Symbol(e, Decl(observable.ts, 1, 18)) +>T : Symbol(T, Decl(observable.ts, 0, 32), Decl(map.ts, 6, 25)) +>Observable : Symbol(Observable, Decl(observable.ts, 0, 0), Decl(observable.ts, 2, 1), Decl(map.ts, 5, 31), Decl(map.ts, 8, 5)) +>T : Symbol(T, Decl(observable.ts, 0, 32), Decl(map.ts, 6, 25)) +} + +export namespace Observable { +>Observable : Symbol(Observable, Decl(observable.ts, 0, 0), Decl(observable.ts, 2, 1), Decl(map.ts, 5, 31), Decl(map.ts, 8, 5)) + + let someValue: number; +>someValue : Symbol(someValue, Decl(observable.ts, 5, 7)) +} + + +=== tests/cases/compiler/main.ts === +import { Observable } from "./observable" +>Observable : Symbol(Observable, Decl(main.ts, 0, 8)) + +import "./map"; + +let x: Observable; +>x : Symbol(x, Decl(main.ts, 3, 3)) +>Observable : Symbol(Observable, Decl(main.ts, 0, 8)) + +let y = x.map(x => x + 1); +>y : Symbol(y, Decl(main.ts, 4, 3)) +>x.map : Symbol(Observable.map, Decl(map.ts, 6, 29)) +>x : Symbol(x, Decl(main.ts, 3, 3)) +>map : Symbol(Observable.map, Decl(map.ts, 6, 29)) +>x : Symbol(x, Decl(main.ts, 4, 14)) +>x : Symbol(x, Decl(main.ts, 4, 14)) + diff --git a/tests/baselines/reference/moduleAugmentationExtendFileModule1.types b/tests/baselines/reference/moduleAugmentationExtendFileModule1.types new file mode 100644 index 00000000000..fad835029c2 --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationExtendFileModule1.types @@ -0,0 +1,83 @@ +=== tests/cases/compiler/map.ts === + +import { Observable } from "./observable" +>Observable : typeof Observable + +(Observable.prototype).map = function() { } +>(Observable.prototype).map = function() { } : () => void +>(Observable.prototype).map : any +>(Observable.prototype) : any +>Observable.prototype : any +>Observable.prototype : Observable +>Observable : typeof Observable +>prototype : Observable +>map : any +>function() { } : () => void + +declare module "./observable" { + interface Observable { +>Observable : Observable +>T : T + + map(proj: (e:T) => U): Observable +>map : (proj: (e: T) => U) => Observable +>U : U +>proj : (e: T) => U +>e : T +>T : T +>U : U +>Observable : Observable +>U : U + } + namespace Observable { +>Observable : typeof Observable + + let someAnotherValue: number; +>someAnotherValue : number + } +} + +=== tests/cases/compiler/observable.ts === +export declare class Observable { +>Observable : Observable +>T : T + + filter(pred: (e:T) => boolean): Observable; +>filter : (pred: (e: T) => boolean) => Observable +>pred : (e: T) => boolean +>e : T +>T : T +>Observable : Observable +>T : T +} + +export namespace Observable { +>Observable : typeof Observable + + let someValue: number; +>someValue : number +} + + +=== tests/cases/compiler/main.ts === +import { Observable } from "./observable" +>Observable : typeof Observable + +import "./map"; + +let x: Observable; +>x : Observable +>Observable : Observable + +let y = x.map(x => x + 1); +>y : Observable +>x.map(x => x + 1) : Observable +>x.map : (proj: (e: number) => U) => Observable +>x : Observable +>map : (proj: (e: number) => U) => Observable +>x => x + 1 : (x: number) => number +>x : number +>x + 1 : number +>x : number +>1 : number + diff --git a/tests/baselines/reference/moduleAugmentationExtendFileModule2.js b/tests/baselines/reference/moduleAugmentationExtendFileModule2.js new file mode 100644 index 00000000000..389f2119aba --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationExtendFileModule2.js @@ -0,0 +1,53 @@ +//// [tests/cases/compiler/moduleAugmentationExtendFileModule2.ts] //// + +//// [map.ts] + +import { Observable } from "./observable" + +(Observable.prototype).map = function() { } + +declare module "./observable" { + interface Observable { + map(proj: (e:T) => U): Observable + } + namespace Observable { + let someAnotherValue: string; + } +} + +//// [observable.ts] +export declare class Observable { + filter(pred: (e:T) => boolean): Observable; +} + +export namespace Observable { + export let someValue: number; +} + + +//// [main.ts] +import { Observable } from "./observable" +import "./map"; + +let x: Observable; +let y = x.map(x => x + 1); +let z1 = Observable.someValue.toFixed(); +let z2 = Observable.someAnotherValue.toLowerCase(); + +//// [observable.js] +"use strict"; +var Observable; +(function (Observable) { +})(Observable = exports.Observable || (exports.Observable = {})); +//// [map.js] +"use strict"; +var observable_1 = require("./observable"); +observable_1.Observable.prototype.map = function () { }; +//// [main.js] +"use strict"; +var observable_1 = require("./observable"); +require("./map"); +var x; +var y = x.map(function (x) { return x + 1; }); +var z1 = observable_1.Observable.someValue.toFixed(); +var z2 = observable_1.Observable.someAnotherValue.toLowerCase(); diff --git a/tests/baselines/reference/moduleAugmentationExtendFileModule2.symbols b/tests/baselines/reference/moduleAugmentationExtendFileModule2.symbols new file mode 100644 index 00000000000..38a0506d179 --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationExtendFileModule2.symbols @@ -0,0 +1,89 @@ +=== tests/cases/compiler/map.ts === + +import { Observable } from "./observable" +>Observable : Symbol(Observable, Decl(map.ts, 1, 8)) + +(Observable.prototype).map = function() { } +>Observable.prototype : Symbol(Observable.prototype) +>Observable : Symbol(Observable, Decl(map.ts, 1, 8)) +>prototype : Symbol(Observable.prototype) + +declare module "./observable" { + interface Observable { +>Observable : Symbol(Observable, Decl(observable.ts, 0, 0), Decl(observable.ts, 2, 1), Decl(map.ts, 5, 31), Decl(map.ts, 8, 5)) +>T : Symbol(T, Decl(observable.ts, 0, 32), Decl(map.ts, 6, 25)) + + map(proj: (e:T) => U): Observable +>map : Symbol(Observable.map, Decl(map.ts, 6, 29)) +>U : Symbol(U, Decl(map.ts, 7, 12)) +>proj : Symbol(proj, Decl(map.ts, 7, 15)) +>e : Symbol(e, Decl(map.ts, 7, 22)) +>T : Symbol(T, Decl(observable.ts, 0, 32), Decl(map.ts, 6, 25)) +>U : Symbol(U, Decl(map.ts, 7, 12)) +>Observable : Symbol(Observable, Decl(observable.ts, 0, 0), Decl(observable.ts, 2, 1), Decl(map.ts, 5, 31), Decl(map.ts, 8, 5)) +>U : Symbol(U, Decl(map.ts, 7, 12)) + } + namespace Observable { +>Observable : Symbol(Observable, Decl(observable.ts, 0, 0), Decl(observable.ts, 2, 1), Decl(map.ts, 5, 31), Decl(map.ts, 8, 5)) + + let someAnotherValue: string; +>someAnotherValue : Symbol(someAnotherValue, Decl(map.ts, 10, 11)) + } +} + +=== tests/cases/compiler/observable.ts === +export declare class Observable { +>Observable : Symbol(Observable, Decl(observable.ts, 0, 0), Decl(observable.ts, 2, 1), Decl(map.ts, 5, 31), Decl(map.ts, 8, 5)) +>T : Symbol(T, Decl(observable.ts, 0, 32), Decl(map.ts, 6, 25)) + + filter(pred: (e:T) => boolean): Observable; +>filter : Symbol(Observable.filter, Decl(observable.ts, 0, 36)) +>pred : Symbol(pred, Decl(observable.ts, 1, 11)) +>e : Symbol(e, Decl(observable.ts, 1, 18)) +>T : Symbol(T, Decl(observable.ts, 0, 32), Decl(map.ts, 6, 25)) +>Observable : Symbol(Observable, Decl(observable.ts, 0, 0), Decl(observable.ts, 2, 1), Decl(map.ts, 5, 31), Decl(map.ts, 8, 5)) +>T : Symbol(T, Decl(observable.ts, 0, 32), Decl(map.ts, 6, 25)) +} + +export namespace Observable { +>Observable : Symbol(Observable, Decl(observable.ts, 0, 0), Decl(observable.ts, 2, 1), Decl(map.ts, 5, 31), Decl(map.ts, 8, 5)) + + export let someValue: number; +>someValue : Symbol(someValue, Decl(observable.ts, 5, 14)) +} + + +=== tests/cases/compiler/main.ts === +import { Observable } from "./observable" +>Observable : Symbol(Observable, Decl(main.ts, 0, 8)) + +import "./map"; + +let x: Observable; +>x : Symbol(x, Decl(main.ts, 3, 3)) +>Observable : Symbol(Observable, Decl(main.ts, 0, 8)) + +let y = x.map(x => x + 1); +>y : Symbol(y, Decl(main.ts, 4, 3)) +>x.map : Symbol(Observable.map, Decl(map.ts, 6, 29)) +>x : Symbol(x, Decl(main.ts, 3, 3)) +>map : Symbol(Observable.map, Decl(map.ts, 6, 29)) +>x : Symbol(x, Decl(main.ts, 4, 14)) +>x : Symbol(x, Decl(main.ts, 4, 14)) + +let z1 = Observable.someValue.toFixed(); +>z1 : Symbol(z1, Decl(main.ts, 5, 3)) +>Observable.someValue.toFixed : Symbol(Number.toFixed, Decl(lib.d.ts, --, --)) +>Observable.someValue : Symbol(Observable.someValue, Decl(observable.ts, 5, 14)) +>Observable : Symbol(Observable, Decl(main.ts, 0, 8)) +>someValue : Symbol(Observable.someValue, Decl(observable.ts, 5, 14)) +>toFixed : Symbol(Number.toFixed, Decl(lib.d.ts, --, --)) + +let z2 = Observable.someAnotherValue.toLowerCase(); +>z2 : Symbol(z2, Decl(main.ts, 6, 3)) +>Observable.someAnotherValue.toLowerCase : Symbol(String.toLowerCase, Decl(lib.d.ts, --, --)) +>Observable.someAnotherValue : Symbol(Observable.someAnotherValue, Decl(map.ts, 10, 11)) +>Observable : Symbol(Observable, Decl(main.ts, 0, 8)) +>someAnotherValue : Symbol(Observable.someAnotherValue, Decl(map.ts, 10, 11)) +>toLowerCase : Symbol(String.toLowerCase, Decl(lib.d.ts, --, --)) + diff --git a/tests/baselines/reference/moduleAugmentationExtendFileModule2.types b/tests/baselines/reference/moduleAugmentationExtendFileModule2.types new file mode 100644 index 00000000000..85e4ead2ac0 --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationExtendFileModule2.types @@ -0,0 +1,101 @@ +=== tests/cases/compiler/map.ts === + +import { Observable } from "./observable" +>Observable : typeof Observable + +(Observable.prototype).map = function() { } +>(Observable.prototype).map = function() { } : () => void +>(Observable.prototype).map : any +>(Observable.prototype) : any +>Observable.prototype : any +>Observable.prototype : Observable +>Observable : typeof Observable +>prototype : Observable +>map : any +>function() { } : () => void + +declare module "./observable" { + interface Observable { +>Observable : Observable +>T : T + + map(proj: (e:T) => U): Observable +>map : (proj: (e: T) => U) => Observable +>U : U +>proj : (e: T) => U +>e : T +>T : T +>U : U +>Observable : Observable +>U : U + } + namespace Observable { +>Observable : typeof Observable + + let someAnotherValue: string; +>someAnotherValue : string + } +} + +=== tests/cases/compiler/observable.ts === +export declare class Observable { +>Observable : Observable +>T : T + + filter(pred: (e:T) => boolean): Observable; +>filter : (pred: (e: T) => boolean) => Observable +>pred : (e: T) => boolean +>e : T +>T : T +>Observable : Observable +>T : T +} + +export namespace Observable { +>Observable : typeof Observable + + export let someValue: number; +>someValue : number +} + + +=== tests/cases/compiler/main.ts === +import { Observable } from "./observable" +>Observable : typeof Observable + +import "./map"; + +let x: Observable; +>x : Observable +>Observable : Observable + +let y = x.map(x => x + 1); +>y : Observable +>x.map(x => x + 1) : Observable +>x.map : (proj: (e: number) => U) => Observable +>x : Observable +>map : (proj: (e: number) => U) => Observable +>x => x + 1 : (x: number) => number +>x : number +>x + 1 : number +>x : number +>1 : number + +let z1 = Observable.someValue.toFixed(); +>z1 : string +>Observable.someValue.toFixed() : string +>Observable.someValue.toFixed : (fractionDigits?: number) => string +>Observable.someValue : number +>Observable : typeof Observable +>someValue : number +>toFixed : (fractionDigits?: number) => string + +let z2 = Observable.someAnotherValue.toLowerCase(); +>z2 : string +>Observable.someAnotherValue.toLowerCase() : string +>Observable.someAnotherValue.toLowerCase : () => string +>Observable.someAnotherValue : string +>Observable : typeof Observable +>someAnotherValue : string +>toLowerCase : () => string + diff --git a/tests/baselines/reference/moduleAugmentationGlobal1.js b/tests/baselines/reference/moduleAugmentationGlobal1.js new file mode 100644 index 00000000000..99351642a18 --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationGlobal1.js @@ -0,0 +1,45 @@ +//// [tests/cases/compiler/moduleAugmentationGlobal1.ts] //// + +//// [f1.ts] + +export class A {x: number;} + +//// [f2.ts] +import {A} from "./f1"; + +// change the shape of Array +declare global { + interface Array { + getA(): A; + } +} + +let x = [1]; +let y = x.getA().x; + + +//// [f1.js] +"use strict"; +var A = (function () { + function A() { + } + return A; +}()); +exports.A = A; +//// [f2.js] +"use strict"; +var x = [1]; +var y = x.getA().x; + + +//// [f1.d.ts] +export declare class A { + x: number; +} +//// [f2.d.ts] +import { A } from "./f1"; +declare global { + interface Array { + getA(): A; + } +} diff --git a/tests/baselines/reference/moduleAugmentationGlobal1.symbols b/tests/baselines/reference/moduleAugmentationGlobal1.symbols new file mode 100644 index 00000000000..4115379b0f2 --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationGlobal1.symbols @@ -0,0 +1,35 @@ +=== tests/cases/compiler/f1.ts === + +export class A {x: number;} +>A : Symbol(A, Decl(f1.ts, 0, 0)) +>x : Symbol(A.x, Decl(f1.ts, 1, 16)) + +=== tests/cases/compiler/f2.ts === +import {A} from "./f1"; +>A : Symbol(A, Decl(f2.ts, 0, 8)) + +// change the shape of Array +declare global { +>global : Symbol(, Decl(f2.ts, 0, 23)) + + interface Array { +>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(f2.ts, 3, 16)) +>T : Symbol(T, Decl(lib.d.ts, --, --), Decl(f2.ts, 4, 20)) + + getA(): A; +>getA : Symbol(Array.getA, Decl(f2.ts, 4, 24)) +>A : Symbol(A, Decl(f2.ts, 0, 8)) + } +} + +let x = [1]; +>x : Symbol(x, Decl(f2.ts, 9, 3)) + +let y = x.getA().x; +>y : Symbol(y, Decl(f2.ts, 10, 3)) +>x.getA().x : Symbol(A.x, Decl(f1.ts, 1, 16)) +>x.getA : Symbol(Array.getA, Decl(f2.ts, 4, 24)) +>x : Symbol(x, Decl(f2.ts, 9, 3)) +>getA : Symbol(Array.getA, Decl(f2.ts, 4, 24)) +>x : Symbol(A.x, Decl(f1.ts, 1, 16)) + diff --git a/tests/baselines/reference/moduleAugmentationGlobal1.types b/tests/baselines/reference/moduleAugmentationGlobal1.types new file mode 100644 index 00000000000..9963cbe1162 --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationGlobal1.types @@ -0,0 +1,38 @@ +=== tests/cases/compiler/f1.ts === + +export class A {x: number;} +>A : A +>x : number + +=== tests/cases/compiler/f2.ts === +import {A} from "./f1"; +>A : typeof A + +// change the shape of Array +declare global { +>global : any + + interface Array { +>Array : T[] +>T : T + + getA(): A; +>getA : () => A +>A : A + } +} + +let x = [1]; +>x : number[] +>[1] : number[] +>1 : number + +let y = x.getA().x; +>y : number +>x.getA().x : number +>x.getA() : A +>x.getA : () => A +>x : number[] +>getA : () => A +>x : number + diff --git a/tests/baselines/reference/moduleAugmentationGlobal2.js b/tests/baselines/reference/moduleAugmentationGlobal2.js new file mode 100644 index 00000000000..90e8373302e --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationGlobal2.js @@ -0,0 +1,45 @@ +//// [tests/cases/compiler/moduleAugmentationGlobal2.ts] //// + +//// [f1.ts] + +export class A {}; +//// [f2.ts] + +// change the shape of Array +import {A} from "./f1"; + +declare global { + interface Array { + getCountAsString(): string; + } +} + +let x = [1]; +let y = x.getCountAsString().toLowerCase(); + + +//// [f1.js] +"use strict"; +var A = (function () { + function A() { + } + return A; +}()); +exports.A = A; +; +//// [f2.js] +"use strict"; +var x = [1]; +var y = x.getCountAsString().toLowerCase(); + + +//// [f1.d.ts] +export declare class A { +} +//// [f2.d.ts] +declare global { + interface Array { + getCountAsString(): string; + } +} +export {}; diff --git a/tests/baselines/reference/moduleAugmentationGlobal2.symbols b/tests/baselines/reference/moduleAugmentationGlobal2.symbols new file mode 100644 index 00000000000..48fe93353fb --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationGlobal2.symbols @@ -0,0 +1,34 @@ +=== tests/cases/compiler/f1.ts === + +export class A {}; +>A : Symbol(A, Decl(f1.ts, 0, 0)) + +=== tests/cases/compiler/f2.ts === + +// change the shape of Array +import {A} from "./f1"; +>A : Symbol(A, Decl(f2.ts, 2, 8)) + +declare global { +>global : Symbol(, Decl(f2.ts, 2, 23)) + + interface Array { +>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(f2.ts, 4, 16)) +>T : Symbol(T, Decl(lib.d.ts, --, --), Decl(f2.ts, 5, 20)) + + getCountAsString(): string; +>getCountAsString : Symbol(Array.getCountAsString, Decl(f2.ts, 5, 24)) + } +} + +let x = [1]; +>x : Symbol(x, Decl(f2.ts, 10, 3)) + +let y = x.getCountAsString().toLowerCase(); +>y : Symbol(y, Decl(f2.ts, 11, 3)) +>x.getCountAsString().toLowerCase : Symbol(String.toLowerCase, Decl(lib.d.ts, --, --)) +>x.getCountAsString : Symbol(Array.getCountAsString, Decl(f2.ts, 5, 24)) +>x : Symbol(x, Decl(f2.ts, 10, 3)) +>getCountAsString : Symbol(Array.getCountAsString, Decl(f2.ts, 5, 24)) +>toLowerCase : Symbol(String.toLowerCase, Decl(lib.d.ts, --, --)) + diff --git a/tests/baselines/reference/moduleAugmentationGlobal2.types b/tests/baselines/reference/moduleAugmentationGlobal2.types new file mode 100644 index 00000000000..96252569da6 --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationGlobal2.types @@ -0,0 +1,38 @@ +=== tests/cases/compiler/f1.ts === + +export class A {}; +>A : A + +=== tests/cases/compiler/f2.ts === + +// change the shape of Array +import {A} from "./f1"; +>A : typeof A + +declare global { +>global : any + + interface Array { +>Array : T[] +>T : T + + getCountAsString(): string; +>getCountAsString : () => string + } +} + +let x = [1]; +>x : number[] +>[1] : number[] +>1 : number + +let y = x.getCountAsString().toLowerCase(); +>y : string +>x.getCountAsString().toLowerCase() : string +>x.getCountAsString().toLowerCase : () => string +>x.getCountAsString() : string +>x.getCountAsString : () => string +>x : number[] +>getCountAsString : () => string +>toLowerCase : () => string + diff --git a/tests/baselines/reference/moduleAugmentationGlobal3.js b/tests/baselines/reference/moduleAugmentationGlobal3.js new file mode 100644 index 00000000000..caa080a558c --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationGlobal3.js @@ -0,0 +1,53 @@ +//// [tests/cases/compiler/moduleAugmentationGlobal3.ts] //// + +//// [f1.ts] + +export class A {}; +//// [f2.ts] + +// change the shape of Array +import {A} from "./f1"; + +declare global { + interface Array { + getCountAsString(): string; + } +} + +//// [f3.ts] +import "./f2"; + +let x = [1]; +let y = x.getCountAsString().toLowerCase(); + + +//// [f1.js] +"use strict"; +var A = (function () { + function A() { + } + return A; +}()); +exports.A = A; +; +//// [f2.js] +"use strict"; +//// [f3.js] +"use strict"; +require("./f2"); +var x = [1]; +var y = x.getCountAsString().toLowerCase(); + + +//// [f1.d.ts] +export declare class A { +} +//// [f2.d.ts] +declare global { + interface Array { + getCountAsString(): string; + } +} +export {}; +//// [f3.d.ts] +import "./f2"; diff --git a/tests/baselines/reference/moduleAugmentationGlobal3.symbols b/tests/baselines/reference/moduleAugmentationGlobal3.symbols new file mode 100644 index 00000000000..41c7f25b818 --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationGlobal3.symbols @@ -0,0 +1,37 @@ +=== tests/cases/compiler/f1.ts === + +export class A {}; +>A : Symbol(A, Decl(f1.ts, 0, 0)) + +=== tests/cases/compiler/f2.ts === + +// change the shape of Array +import {A} from "./f1"; +>A : Symbol(A, Decl(f2.ts, 2, 8)) + +declare global { +>global : Symbol(, Decl(f2.ts, 2, 23)) + + interface Array { +>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(f2.ts, 4, 16)) +>T : Symbol(T, Decl(lib.d.ts, --, --), Decl(f2.ts, 5, 20)) + + getCountAsString(): string; +>getCountAsString : Symbol(Array.getCountAsString, Decl(f2.ts, 5, 24)) + } +} + +=== tests/cases/compiler/f3.ts === +import "./f2"; + +let x = [1]; +>x : Symbol(x, Decl(f3.ts, 2, 3)) + +let y = x.getCountAsString().toLowerCase(); +>y : Symbol(y, Decl(f3.ts, 3, 3)) +>x.getCountAsString().toLowerCase : Symbol(String.toLowerCase, Decl(lib.d.ts, --, --)) +>x.getCountAsString : Symbol(Array.getCountAsString, Decl(f2.ts, 5, 24)) +>x : Symbol(x, Decl(f3.ts, 2, 3)) +>getCountAsString : Symbol(Array.getCountAsString, Decl(f2.ts, 5, 24)) +>toLowerCase : Symbol(String.toLowerCase, Decl(lib.d.ts, --, --)) + diff --git a/tests/baselines/reference/moduleAugmentationGlobal3.types b/tests/baselines/reference/moduleAugmentationGlobal3.types new file mode 100644 index 00000000000..0e8e731aec1 --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationGlobal3.types @@ -0,0 +1,41 @@ +=== tests/cases/compiler/f1.ts === + +export class A {}; +>A : A + +=== tests/cases/compiler/f2.ts === + +// change the shape of Array +import {A} from "./f1"; +>A : typeof A + +declare global { +>global : any + + interface Array { +>Array : T[] +>T : T + + getCountAsString(): string; +>getCountAsString : () => string + } +} + +=== tests/cases/compiler/f3.ts === +import "./f2"; + +let x = [1]; +>x : number[] +>[1] : number[] +>1 : number + +let y = x.getCountAsString().toLowerCase(); +>y : string +>x.getCountAsString().toLowerCase() : string +>x.getCountAsString().toLowerCase : () => string +>x.getCountAsString() : string +>x.getCountAsString : () => string +>x : number[] +>getCountAsString : () => string +>toLowerCase : () => string + diff --git a/tests/baselines/reference/moduleAugmentationGlobal4.js b/tests/baselines/reference/moduleAugmentationGlobal4.js new file mode 100644 index 00000000000..38f186d0e05 --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationGlobal4.js @@ -0,0 +1,49 @@ +//// [tests/cases/compiler/moduleAugmentationGlobal4.ts] //// + +//// [f1.ts] + +declare global { + interface Something {x} +} +export {}; +//// [f2.ts] + +declare global { + interface Something {y} +} +export {}; +//// [f3.ts] +import "./f1"; +import "./f2"; + + + +//// [f1.js] +"use strict"; +//// [f2.js] +"use strict"; +//// [f3.js] +"use strict"; +require("./f1"); +require("./f2"); + + +//// [f1.d.ts] +declare global { + interface Something { + x: any; + } +} +export { }; +export {}; +//// [f2.d.ts] +declare global { + interface Something { + y: any; + } +} +export { }; +export {}; +//// [f3.d.ts] +import "./f1"; +import "./f2"; diff --git a/tests/baselines/reference/moduleAugmentationGlobal4.symbols b/tests/baselines/reference/moduleAugmentationGlobal4.symbols new file mode 100644 index 00000000000..f9cdac3fc2e --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationGlobal4.symbols @@ -0,0 +1,26 @@ +=== tests/cases/compiler/f1.ts === + +declare global { +>global : Symbol(, Decl(f1.ts, 0, 0)) + + interface Something {x} +>Something : Symbol(Something, Decl(f1.ts, 1, 16), Decl(f2.ts, 1, 16)) +>x : Symbol(Something.x, Decl(f1.ts, 2, 25)) +} +export {}; +=== tests/cases/compiler/f2.ts === + +declare global { +>global : Symbol(, Decl(f2.ts, 0, 0)) + + interface Something {y} +>Something : Symbol(Something, Decl(f1.ts, 1, 16), Decl(f2.ts, 1, 16)) +>y : Symbol(Something.y, Decl(f2.ts, 2, 25)) +} +export {}; +=== tests/cases/compiler/f3.ts === +import "./f1"; +No type information for this code.import "./f2"; +No type information for this code. +No type information for this code. +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/moduleAugmentationGlobal4.types b/tests/baselines/reference/moduleAugmentationGlobal4.types new file mode 100644 index 00000000000..e3e780d69ff --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationGlobal4.types @@ -0,0 +1,26 @@ +=== tests/cases/compiler/f1.ts === + +declare global { +>global : any + + interface Something {x} +>Something : Something +>x : any +} +export {}; +=== tests/cases/compiler/f2.ts === + +declare global { +>global : any + + interface Something {y} +>Something : Something +>y : any +} +export {}; +=== tests/cases/compiler/f3.ts === +import "./f1"; +No type information for this code.import "./f2"; +No type information for this code. +No type information for this code. +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/moduleAugmentationGlobal5.js b/tests/baselines/reference/moduleAugmentationGlobal5.js new file mode 100644 index 00000000000..70c81893bd8 --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationGlobal5.js @@ -0,0 +1,36 @@ +//// [tests/cases/compiler/moduleAugmentationGlobal5.ts] //// + +//// [f1.d.ts] + +declare module "A" { + global { + interface Something {x} + } +} +//// [f2.d.ts] +declare module "B" { + global { + interface Something {y} + } +} +//// [f3.ts] +/// +/// +import "A"; +import "B"; + + + +//// [f3.js] +"use strict"; +/// +/// +require("A"); +require("B"); + + +//// [f3.d.ts] +/// +/// +import "A"; +import "B"; diff --git a/tests/baselines/reference/moduleAugmentationGlobal5.symbols b/tests/baselines/reference/moduleAugmentationGlobal5.symbols new file mode 100644 index 00000000000..27548b05ef2 --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationGlobal5.symbols @@ -0,0 +1,28 @@ +=== tests/cases/compiler/f3.ts === +/// +No type information for this code./// +No type information for this code.import "A"; +No type information for this code.import "B"; +No type information for this code. +No type information for this code. +No type information for this code.=== tests/cases/compiler/f1.d.ts === + +declare module "A" { + global { +>global : Symbol(, Decl(f1.d.ts, 1, 20)) + + interface Something {x} +>Something : Symbol(Something, Decl(f1.d.ts, 2, 12), Decl(f2.d.ts, 1, 12)) +>x : Symbol(Something.x, Decl(f1.d.ts, 3, 29)) + } +} +=== tests/cases/compiler/f2.d.ts === +declare module "B" { + global { +>global : Symbol(, Decl(f2.d.ts, 0, 20)) + + interface Something {y} +>Something : Symbol(Something, Decl(f1.d.ts, 2, 12), Decl(f2.d.ts, 1, 12)) +>y : Symbol(Something.y, Decl(f2.d.ts, 2, 29)) + } +} diff --git a/tests/baselines/reference/moduleAugmentationGlobal5.types b/tests/baselines/reference/moduleAugmentationGlobal5.types new file mode 100644 index 00000000000..b2e6139eb26 --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationGlobal5.types @@ -0,0 +1,28 @@ +=== tests/cases/compiler/f3.ts === +/// +No type information for this code./// +No type information for this code.import "A"; +No type information for this code.import "B"; +No type information for this code. +No type information for this code. +No type information for this code.=== tests/cases/compiler/f1.d.ts === + +declare module "A" { + global { +>global : any + + interface Something {x} +>Something : Something +>x : any + } +} +=== tests/cases/compiler/f2.d.ts === +declare module "B" { + global { +>global : any + + interface Something {y} +>Something : Something +>y : any + } +} diff --git a/tests/baselines/reference/moduleAugmentationGlobal6.errors.txt b/tests/baselines/reference/moduleAugmentationGlobal6.errors.txt new file mode 100644 index 00000000000..849c45111ac --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationGlobal6.errors.txt @@ -0,0 +1,9 @@ +tests/cases/compiler/moduleAugmentationGlobal6.ts(1,9): error TS2669: Augmentations for the global scope can only be directly nested in external modules or ambient module declarations. + + +==== tests/cases/compiler/moduleAugmentationGlobal6.ts (1 errors) ==== + declare global { + ~~~~~~ +!!! error TS2669: Augmentations for the global scope can only be directly nested in external modules or ambient module declarations. + interface Array { x } + } \ No newline at end of file diff --git a/tests/baselines/reference/moduleAugmentationGlobal6.js b/tests/baselines/reference/moduleAugmentationGlobal6.js new file mode 100644 index 00000000000..ac988f670d2 --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationGlobal6.js @@ -0,0 +1,6 @@ +//// [moduleAugmentationGlobal6.ts] +declare global { + interface Array { x } +} + +//// [moduleAugmentationGlobal6.js] diff --git a/tests/baselines/reference/moduleAugmentationGlobal6_1.errors.txt b/tests/baselines/reference/moduleAugmentationGlobal6_1.errors.txt new file mode 100644 index 00000000000..01315f9fcbc --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationGlobal6_1.errors.txt @@ -0,0 +1,12 @@ +tests/cases/compiler/moduleAugmentationGlobal6_1.ts(1,1): error TS2669: Augmentations for the global scope can only be directly nested in external modules or ambient module declarations. +tests/cases/compiler/moduleAugmentationGlobal6_1.ts(1,1): error TS2670: Augmentations for the global scope should have 'declare' modifier unless they appear in already ambient context. + + +==== tests/cases/compiler/moduleAugmentationGlobal6_1.ts (2 errors) ==== + global { + ~~~~~~ +!!! error TS2669: Augmentations for the global scope can only be directly nested in external modules or ambient module declarations. + ~~~~~~ +!!! error TS2670: Augmentations for the global scope should have 'declare' modifier unless they appear in already ambient context. + interface Array { x } + } \ No newline at end of file diff --git a/tests/baselines/reference/moduleAugmentationGlobal6_1.js b/tests/baselines/reference/moduleAugmentationGlobal6_1.js new file mode 100644 index 00000000000..5ae85debbe2 --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationGlobal6_1.js @@ -0,0 +1,6 @@ +//// [moduleAugmentationGlobal6_1.ts] +global { + interface Array { x } +} + +//// [moduleAugmentationGlobal6_1.js] diff --git a/tests/baselines/reference/moduleAugmentationGlobal7.errors.txt b/tests/baselines/reference/moduleAugmentationGlobal7.errors.txt new file mode 100644 index 00000000000..3ba8003288c --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationGlobal7.errors.txt @@ -0,0 +1,11 @@ +tests/cases/compiler/moduleAugmentationGlobal7.ts(2,13): error TS2669: Augmentations for the global scope can only be directly nested in external modules or ambient module declarations. + + +==== tests/cases/compiler/moduleAugmentationGlobal7.ts (1 errors) ==== + namespace A { + declare global { + ~~~~~~ +!!! error TS2669: Augmentations for the global scope can only be directly nested in external modules or ambient module declarations. + interface Array { x } + } + } \ No newline at end of file diff --git a/tests/baselines/reference/moduleAugmentationGlobal7.js b/tests/baselines/reference/moduleAugmentationGlobal7.js new file mode 100644 index 00000000000..54c6ddc0de7 --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationGlobal7.js @@ -0,0 +1,8 @@ +//// [moduleAugmentationGlobal7.ts] +namespace A { + declare global { + interface Array { x } + } +} + +//// [moduleAugmentationGlobal7.js] diff --git a/tests/baselines/reference/moduleAugmentationGlobal7_1.errors.txt b/tests/baselines/reference/moduleAugmentationGlobal7_1.errors.txt new file mode 100644 index 00000000000..c2e8282f2bf --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationGlobal7_1.errors.txt @@ -0,0 +1,14 @@ +tests/cases/compiler/moduleAugmentationGlobal7_1.ts(2,5): error TS2669: Augmentations for the global scope can only be directly nested in external modules or ambient module declarations. +tests/cases/compiler/moduleAugmentationGlobal7_1.ts(2,5): error TS2670: Augmentations for the global scope should have 'declare' modifier unless they appear in already ambient context. + + +==== tests/cases/compiler/moduleAugmentationGlobal7_1.ts (2 errors) ==== + namespace A { + global { + ~~~~~~ +!!! error TS2669: Augmentations for the global scope can only be directly nested in external modules or ambient module declarations. + ~~~~~~ +!!! error TS2670: Augmentations for the global scope should have 'declare' modifier unless they appear in already ambient context. + interface Array { x } + } + } \ No newline at end of file diff --git a/tests/baselines/reference/moduleAugmentationGlobal7_1.js b/tests/baselines/reference/moduleAugmentationGlobal7_1.js new file mode 100644 index 00000000000..745be0d76a0 --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationGlobal7_1.js @@ -0,0 +1,8 @@ +//// [moduleAugmentationGlobal7_1.ts] +namespace A { + global { + interface Array { x } + } +} + +//// [moduleAugmentationGlobal7_1.js] diff --git a/tests/baselines/reference/moduleAugmentationGlobal8.errors.txt b/tests/baselines/reference/moduleAugmentationGlobal8.errors.txt new file mode 100644 index 00000000000..09c84fea2c2 --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationGlobal8.errors.txt @@ -0,0 +1,13 @@ +tests/cases/compiler/moduleAugmentationGlobal8.ts(2,13): error TS2669: Augmentations for the global scope can only be directly nested in external modules or ambient module declarations. + + +==== tests/cases/compiler/moduleAugmentationGlobal8.ts (1 errors) ==== + namespace A { + declare global { + ~~~~~~ +!!! error TS2669: Augmentations for the global scope can only be directly nested in external modules or ambient module declarations. + interface Array { x } + } + } + export {} + \ No newline at end of file diff --git a/tests/baselines/reference/moduleAugmentationGlobal8.js b/tests/baselines/reference/moduleAugmentationGlobal8.js new file mode 100644 index 00000000000..261dfd21b58 --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationGlobal8.js @@ -0,0 +1,13 @@ +//// [moduleAugmentationGlobal8.ts] +namespace A { + declare global { + interface Array { x } + } +} +export {} + + +//// [moduleAugmentationGlobal8.js] +define(["require", "exports"], function (require, exports) { + "use strict"; +}); diff --git a/tests/baselines/reference/moduleAugmentationGlobal8_1.errors.txt b/tests/baselines/reference/moduleAugmentationGlobal8_1.errors.txt new file mode 100644 index 00000000000..022a4f5ec1a --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationGlobal8_1.errors.txt @@ -0,0 +1,16 @@ +tests/cases/compiler/moduleAugmentationGlobal8_1.ts(2,5): error TS2669: Augmentations for the global scope can only be directly nested in external modules or ambient module declarations. +tests/cases/compiler/moduleAugmentationGlobal8_1.ts(2,5): error TS2670: Augmentations for the global scope should have 'declare' modifier unless they appear in already ambient context. + + +==== tests/cases/compiler/moduleAugmentationGlobal8_1.ts (2 errors) ==== + namespace A { + global { + ~~~~~~ +!!! error TS2669: Augmentations for the global scope can only be directly nested in external modules or ambient module declarations. + ~~~~~~ +!!! error TS2670: Augmentations for the global scope should have 'declare' modifier unless they appear in already ambient context. + interface Array { x } + } + } + export {} + \ No newline at end of file diff --git a/tests/baselines/reference/moduleAugmentationGlobal8_1.js b/tests/baselines/reference/moduleAugmentationGlobal8_1.js new file mode 100644 index 00000000000..2ac585a711b --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationGlobal8_1.js @@ -0,0 +1,13 @@ +//// [moduleAugmentationGlobal8_1.ts] +namespace A { + global { + interface Array { x } + } +} +export {} + + +//// [moduleAugmentationGlobal8_1.js] +define(["require", "exports"], function (require, exports) { + "use strict"; +}); diff --git a/tests/baselines/reference/moduleAugmentationImportsAndExports1.js b/tests/baselines/reference/moduleAugmentationImportsAndExports1.js new file mode 100644 index 00000000000..8e0b7dad19d --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationImportsAndExports1.js @@ -0,0 +1,72 @@ +//// [tests/cases/compiler/moduleAugmentationImportsAndExports1.ts] //// + +//// [f1.ts] + +export class A {} + +//// [f2.ts] +export class B { + n: number; +} + +//// [f3.ts] +import {A} from "./f1"; +import {B} from "./f2"; + +A.prototype.foo = function () { return undefined; } +declare module "./f1" { + interface A { + foo(): B; + } +} + +//// [f4.ts] +import {A} from "./f1"; +import "./f3"; + +let a: A; +let b = a.foo().n; + +//// [f1.js] +"use strict"; +var A = (function () { + function A() { + } + return A; +}()); +exports.A = A; +//// [f2.js] +"use strict"; +var B = (function () { + function B() { + } + return B; +}()); +exports.B = B; +//// [f3.js] +"use strict"; +var f1_1 = require("./f1"); +f1_1.A.prototype.foo = function () { return undefined; }; +//// [f4.js] +"use strict"; +require("./f3"); +var a; +var b = a.foo().n; + + +//// [f1.d.ts] +export declare class A { +} +//// [f2.d.ts] +export declare class B { + n: number; +} +//// [f3.d.ts] +import { B } from "./f2"; +declare module "./f1" { + interface A { + foo(): B; + } +} +//// [f4.d.ts] +import "./f3"; diff --git a/tests/baselines/reference/moduleAugmentationImportsAndExports1.symbols b/tests/baselines/reference/moduleAugmentationImportsAndExports1.symbols new file mode 100644 index 00000000000..84daab19bf5 --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationImportsAndExports1.symbols @@ -0,0 +1,56 @@ +=== tests/cases/compiler/f1.ts === + +export class A {} +>A : Symbol(A, Decl(f1.ts, 0, 0), Decl(f3.ts, 4, 23)) + +=== tests/cases/compiler/f2.ts === +export class B { +>B : Symbol(B, Decl(f2.ts, 0, 0)) + + n: number; +>n : Symbol(B.n, Decl(f2.ts, 0, 16)) +} + +=== tests/cases/compiler/f3.ts === +import {A} from "./f1"; +>A : Symbol(A, Decl(f3.ts, 0, 8)) + +import {B} from "./f2"; +>B : Symbol(B, Decl(f3.ts, 1, 8)) + +A.prototype.foo = function () { return undefined; } +>A.prototype.foo : Symbol(A.foo, Decl(f3.ts, 5, 17)) +>A.prototype : Symbol(A.prototype) +>A : Symbol(A, Decl(f3.ts, 0, 8)) +>prototype : Symbol(A.prototype) +>foo : Symbol(A.foo, Decl(f3.ts, 5, 17)) +>undefined : Symbol(undefined) + +declare module "./f1" { + interface A { +>A : Symbol(A, Decl(f1.ts, 0, 0), Decl(f3.ts, 4, 23)) + + foo(): B; +>foo : Symbol(A.foo, Decl(f3.ts, 5, 17)) +>B : Symbol(B, Decl(f3.ts, 1, 8)) + } +} + +=== tests/cases/compiler/f4.ts === +import {A} from "./f1"; +>A : Symbol(A, Decl(f4.ts, 0, 8)) + +import "./f3"; + +let a: A; +>a : Symbol(a, Decl(f4.ts, 3, 3)) +>A : Symbol(A, Decl(f4.ts, 0, 8)) + +let b = a.foo().n; +>b : Symbol(b, Decl(f4.ts, 4, 3)) +>a.foo().n : Symbol(B.n, Decl(f2.ts, 0, 16)) +>a.foo : Symbol(A.foo, Decl(f3.ts, 5, 17)) +>a : Symbol(a, Decl(f4.ts, 3, 3)) +>foo : Symbol(A.foo, Decl(f3.ts, 5, 17)) +>n : Symbol(B.n, Decl(f2.ts, 0, 16)) + diff --git a/tests/baselines/reference/moduleAugmentationImportsAndExports1.types b/tests/baselines/reference/moduleAugmentationImportsAndExports1.types new file mode 100644 index 00000000000..886a04b54ef --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationImportsAndExports1.types @@ -0,0 +1,59 @@ +=== tests/cases/compiler/f1.ts === + +export class A {} +>A : A + +=== tests/cases/compiler/f2.ts === +export class B { +>B : B + + n: number; +>n : number +} + +=== tests/cases/compiler/f3.ts === +import {A} from "./f1"; +>A : typeof A + +import {B} from "./f2"; +>B : typeof B + +A.prototype.foo = function () { return undefined; } +>A.prototype.foo = function () { return undefined; } : () => any +>A.prototype.foo : () => B +>A.prototype : A +>A : typeof A +>prototype : A +>foo : () => B +>function () { return undefined; } : () => any +>undefined : undefined + +declare module "./f1" { + interface A { +>A : A + + foo(): B; +>foo : () => B +>B : B + } +} + +=== tests/cases/compiler/f4.ts === +import {A} from "./f1"; +>A : typeof A + +import "./f3"; + +let a: A; +>a : A +>A : A + +let b = a.foo().n; +>b : number +>a.foo().n : number +>a.foo() : B +>a.foo : () => B +>a : A +>foo : () => B +>n : number + diff --git a/tests/baselines/reference/moduleAugmentationImportsAndExports2.errors.txt b/tests/baselines/reference/moduleAugmentationImportsAndExports2.errors.txt new file mode 100644 index 00000000000..9c49d38572b --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationImportsAndExports2.errors.txt @@ -0,0 +1,70 @@ +tests/cases/compiler/f3.ts(3,13): error TS2339: Property 'foo' does not exist on type 'A'. +tests/cases/compiler/f3.ts(11,5): error TS2667: Imports are not permitted in module augmentations. Consider moving them to the enclosing external module. +tests/cases/compiler/f3.ts(11,21): error TS2307: Cannot find module './f2'. +tests/cases/compiler/f3.ts(12,5): error TS2666: Exports and export assignments are not permitted in module augmentations. +tests/cases/compiler/f3.ts(12,21): error TS2307: Cannot find module './f2'. +tests/cases/compiler/f3.ts(13,5): error TS2667: Imports are not permitted in module augmentations. Consider moving them to the enclosing external module. +tests/cases/compiler/f3.ts(13,16): error TS4000: Import declaration 'I' is using private name 'N'. +tests/cases/compiler/f3.ts(14,5): error TS2667: Imports are not permitted in module augmentations. Consider moving them to the enclosing external module. +tests/cases/compiler/f3.ts(14,16): error TS4000: Import declaration 'C' is using private name 'N'. +tests/cases/compiler/f4.ts(5,11): error TS2339: Property 'foo' does not exist on type 'A'. + + +==== tests/cases/compiler/f1.ts (0 errors) ==== + + export class A {} + +==== tests/cases/compiler/f2.ts (0 errors) ==== + export class B { + n: number; + } + +==== tests/cases/compiler/f3.ts (9 errors) ==== + import {A} from "./f1"; + + A.prototype.foo = function () { return undefined; } + ~~~ +!!! error TS2339: Property 'foo' does not exist on type 'A'. + + namespace N { + export interface Ifc { a } + export interface Cls { a } + } + + declare module "./f1" { + import {B} from "./f2"; + ~~~~~~ +!!! error TS2667: Imports are not permitted in module augmentations. Consider moving them to the enclosing external module. + ~~~~~~ +!!! error TS2307: Cannot find module './f2'. + export {B} from "./f2"; + ~~~~~~ +!!! error TS2666: Exports and export assignments are not permitted in module augmentations. + ~~~~~~ +!!! error TS2307: Cannot find module './f2'. + import I = N.Ifc; + ~~~~~~ +!!! error TS2667: Imports are not permitted in module augmentations. Consider moving them to the enclosing external module. + ~ +!!! error TS4000: Import declaration 'I' is using private name 'N'. + import C = N.Cls; + ~~~~~~ +!!! error TS2667: Imports are not permitted in module augmentations. Consider moving them to the enclosing external module. + ~ +!!! error TS4000: Import declaration 'C' is using private name 'N'. + // should have explicit export + interface A { + foo(): B; + bar(): I; + baz(): C; + } + } + +==== tests/cases/compiler/f4.ts (1 errors) ==== + import {A} from "./f1"; + import "./f3"; + + let a: A; + let b = a.foo().n; + ~~~ +!!! error TS2339: Property 'foo' does not exist on type 'A'. \ No newline at end of file diff --git a/tests/baselines/reference/moduleAugmentationImportsAndExports2.js b/tests/baselines/reference/moduleAugmentationImportsAndExports2.js new file mode 100644 index 00000000000..498df8ab90e --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationImportsAndExports2.js @@ -0,0 +1,77 @@ +//// [tests/cases/compiler/moduleAugmentationImportsAndExports2.ts] //// + +//// [f1.ts] + +export class A {} + +//// [f2.ts] +export class B { + n: number; +} + +//// [f3.ts] +import {A} from "./f1"; + +A.prototype.foo = function () { return undefined; } + +namespace N { + export interface Ifc { a } + export interface Cls { a } +} + +declare module "./f1" { + import {B} from "./f2"; + export {B} from "./f2"; + import I = N.Ifc; + import C = N.Cls; + // should have explicit export + interface A { + foo(): B; + bar(): I; + baz(): C; + } +} + +//// [f4.ts] +import {A} from "./f1"; +import "./f3"; + +let a: A; +let b = a.foo().n; + +//// [f1.js] +"use strict"; +var A = (function () { + function A() { + } + return A; +}()); +exports.A = A; +//// [f2.js] +"use strict"; +var B = (function () { + function B() { + } + return B; +}()); +exports.B = B; +//// [f3.js] +"use strict"; +var f1_1 = require("./f1"); +f1_1.A.prototype.foo = function () { return undefined; }; +//// [f4.js] +"use strict"; +require("./f3"); +var a; +var b = a.foo().n; + + +//// [f1.d.ts] +export declare class A { +} +//// [f2.d.ts] +export declare class B { + n: number; +} +//// [f4.d.ts] +import "./f3"; diff --git a/tests/baselines/reference/moduleAugmentationImportsAndExports3.errors.txt b/tests/baselines/reference/moduleAugmentationImportsAndExports3.errors.txt new file mode 100644 index 00000000000..c2c43c85af3 --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationImportsAndExports3.errors.txt @@ -0,0 +1,56 @@ +tests/cases/compiler/f3.ts(11,5): error TS2667: Imports are not permitted in module augmentations. Consider moving them to the enclosing external module. +tests/cases/compiler/f3.ts(11,21): error TS2307: Cannot find module './f2'. +tests/cases/compiler/f3.ts(12,5): error TS2667: Imports are not permitted in module augmentations. Consider moving them to the enclosing external module. +tests/cases/compiler/f3.ts(12,16): error TS4000: Import declaration 'I' is using private name 'N'. +tests/cases/compiler/f3.ts(13,5): error TS2667: Imports are not permitted in module augmentations. Consider moving them to the enclosing external module. +tests/cases/compiler/f3.ts(13,16): error TS4000: Import declaration 'C' is using private name 'N'. + + +==== tests/cases/compiler/f1.ts (0 errors) ==== + + export class A {} + +==== tests/cases/compiler/f2.ts (0 errors) ==== + export class B { + n: number; + } + +==== tests/cases/compiler/f3.ts (6 errors) ==== + import {A} from "./f1"; + + A.prototype.foo = function () { return undefined; } + + namespace N { + export interface Ifc { a } + export interface Cls { a } + } + + declare module "./f1" { + import {B} from "./f2"; + ~~~~~~ +!!! error TS2667: Imports are not permitted in module augmentations. Consider moving them to the enclosing external module. + ~~~~~~ +!!! error TS2307: Cannot find module './f2'. + import I = N.Ifc; + ~~~~~~ +!!! error TS2667: Imports are not permitted in module augmentations. Consider moving them to the enclosing external module. + ~ +!!! error TS4000: Import declaration 'I' is using private name 'N'. + import C = N.Cls; + ~~~~~~ +!!! error TS2667: Imports are not permitted in module augmentations. Consider moving them to the enclosing external module. + ~ +!!! error TS4000: Import declaration 'C' is using private name 'N'. + interface A { + foo(): B; + bar(): I; + baz(): C; + } + } + +==== tests/cases/compiler/f4.ts (0 errors) ==== + import {A} from "./f1"; + import "./f3"; + + let a: A; + let b = a.foo().n; \ No newline at end of file diff --git a/tests/baselines/reference/moduleAugmentationImportsAndExports3.js b/tests/baselines/reference/moduleAugmentationImportsAndExports3.js new file mode 100644 index 00000000000..8d9e69c5076 --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationImportsAndExports3.js @@ -0,0 +1,75 @@ +//// [tests/cases/compiler/moduleAugmentationImportsAndExports3.ts] //// + +//// [f1.ts] + +export class A {} + +//// [f2.ts] +export class B { + n: number; +} + +//// [f3.ts] +import {A} from "./f1"; + +A.prototype.foo = function () { return undefined; } + +namespace N { + export interface Ifc { a } + export interface Cls { a } +} + +declare module "./f1" { + import {B} from "./f2"; + import I = N.Ifc; + import C = N.Cls; + interface A { + foo(): B; + bar(): I; + baz(): C; + } +} + +//// [f4.ts] +import {A} from "./f1"; +import "./f3"; + +let a: A; +let b = a.foo().n; + +//// [f1.js] +"use strict"; +var A = (function () { + function A() { + } + return A; +}()); +exports.A = A; +//// [f2.js] +"use strict"; +var B = (function () { + function B() { + } + return B; +}()); +exports.B = B; +//// [f3.js] +"use strict"; +var f1_1 = require("./f1"); +f1_1.A.prototype.foo = function () { return undefined; }; +//// [f4.js] +"use strict"; +require("./f3"); +var a; +var b = a.foo().n; + + +//// [f1.d.ts] +export declare class A { +} +//// [f2.d.ts] +export declare class B { + n: number; +} +//// [f4.d.ts] +import "./f3"; diff --git a/tests/baselines/reference/moduleAugmentationImportsAndExports4.js b/tests/baselines/reference/moduleAugmentationImportsAndExports4.js new file mode 100644 index 00000000000..53095555815 --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationImportsAndExports4.js @@ -0,0 +1,68 @@ +//// [tests/cases/compiler/moduleAugmentationImportsAndExports4.ts] //// + +//// [f1.ts] + +export class A {} + +//// [f2.ts] +export class B { + n: number; +} + +//// [f3.ts] +import {A} from "./f1"; +import {B} from "./f2"; + +A.prototype.foo = function () { return undefined; } + +namespace N { + export interface Ifc { a: number; } + export interface Cls { b: number; } +} +import I = N.Ifc; +import C = N.Cls; + +declare module "./f1" { + interface A { + foo(): B; + bar(): I; + baz(): C; + } +} + +//// [f4.ts] +import {A} from "./f1"; +import "./f3"; + +let a: A; +let b = a.foo().n; +let c = a.bar().a; +let d = a.baz().b; + +//// [f1.js] +"use strict"; +var A = (function () { + function A() { + } + return A; +}()); +exports.A = A; +//// [f2.js] +"use strict"; +var B = (function () { + function B() { + } + return B; +}()); +exports.B = B; +//// [f3.js] +"use strict"; +var f1_1 = require("./f1"); +f1_1.A.prototype.foo = function () { return undefined; }; +//// [f4.js] +"use strict"; +require("./f3"); +var a; +var b = a.foo().n; +var c = a.bar().a; +var d = a.baz().b; diff --git a/tests/baselines/reference/moduleAugmentationImportsAndExports4.symbols b/tests/baselines/reference/moduleAugmentationImportsAndExports4.symbols new file mode 100644 index 00000000000..fd1ec87b2a2 --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationImportsAndExports4.symbols @@ -0,0 +1,101 @@ +=== tests/cases/compiler/f1.ts === + +export class A {} +>A : Symbol(A, Decl(f1.ts, 0, 0), Decl(f3.ts, 12, 23)) + +=== tests/cases/compiler/f2.ts === +export class B { +>B : Symbol(B, Decl(f2.ts, 0, 0)) + + n: number; +>n : Symbol(B.n, Decl(f2.ts, 0, 16)) +} + +=== tests/cases/compiler/f3.ts === +import {A} from "./f1"; +>A : Symbol(A, Decl(f3.ts, 0, 8)) + +import {B} from "./f2"; +>B : Symbol(B, Decl(f3.ts, 1, 8)) + +A.prototype.foo = function () { return undefined; } +>A.prototype.foo : Symbol(A.foo, Decl(f3.ts, 13, 17)) +>A.prototype : Symbol(A.prototype) +>A : Symbol(A, Decl(f3.ts, 0, 8)) +>prototype : Symbol(A.prototype) +>foo : Symbol(A.foo, Decl(f3.ts, 13, 17)) +>undefined : Symbol(undefined) + +namespace N { +>N : Symbol(N, Decl(f3.ts, 3, 51)) + + export interface Ifc { a: number; } +>Ifc : Symbol(Ifc, Decl(f3.ts, 5, 13)) +>a : Symbol(Ifc.a, Decl(f3.ts, 6, 26)) + + export interface Cls { b: number; } +>Cls : Symbol(Cls, Decl(f3.ts, 6, 39)) +>b : Symbol(Cls.b, Decl(f3.ts, 7, 26)) +} +import I = N.Ifc; +>I : Symbol(I, Decl(f3.ts, 8, 1)) +>N : Symbol(N, Decl(f3.ts, 3, 51)) +>Ifc : Symbol(I, Decl(f3.ts, 5, 13)) + +import C = N.Cls; +>C : Symbol(C, Decl(f3.ts, 9, 17)) +>N : Symbol(N, Decl(f3.ts, 3, 51)) +>Cls : Symbol(C, Decl(f3.ts, 6, 39)) + +declare module "./f1" { + interface A { +>A : Symbol(A, Decl(f1.ts, 0, 0), Decl(f3.ts, 12, 23)) + + foo(): B; +>foo : Symbol(A.foo, Decl(f3.ts, 13, 17)) +>B : Symbol(B, Decl(f3.ts, 1, 8)) + + bar(): I; +>bar : Symbol(A.bar, Decl(f3.ts, 14, 17)) +>I : Symbol(I, Decl(f3.ts, 8, 1)) + + baz(): C; +>baz : Symbol(A.baz, Decl(f3.ts, 15, 17)) +>C : Symbol(C, Decl(f3.ts, 9, 17)) + } +} + +=== tests/cases/compiler/f4.ts === +import {A} from "./f1"; +>A : Symbol(A, Decl(f4.ts, 0, 8)) + +import "./f3"; + +let a: A; +>a : Symbol(a, Decl(f4.ts, 3, 3)) +>A : Symbol(A, Decl(f4.ts, 0, 8)) + +let b = a.foo().n; +>b : Symbol(b, Decl(f4.ts, 4, 3)) +>a.foo().n : Symbol(B.n, Decl(f2.ts, 0, 16)) +>a.foo : Symbol(A.foo, Decl(f3.ts, 13, 17)) +>a : Symbol(a, Decl(f4.ts, 3, 3)) +>foo : Symbol(A.foo, Decl(f3.ts, 13, 17)) +>n : Symbol(B.n, Decl(f2.ts, 0, 16)) + +let c = a.bar().a; +>c : Symbol(c, Decl(f4.ts, 5, 3)) +>a.bar().a : Symbol(N.Ifc.a, Decl(f3.ts, 6, 26)) +>a.bar : Symbol(A.bar, Decl(f3.ts, 14, 17)) +>a : Symbol(a, Decl(f4.ts, 3, 3)) +>bar : Symbol(A.bar, Decl(f3.ts, 14, 17)) +>a : Symbol(N.Ifc.a, Decl(f3.ts, 6, 26)) + +let d = a.baz().b; +>d : Symbol(d, Decl(f4.ts, 6, 3)) +>a.baz().b : Symbol(N.Cls.b, Decl(f3.ts, 7, 26)) +>a.baz : Symbol(A.baz, Decl(f3.ts, 15, 17)) +>a : Symbol(a, Decl(f4.ts, 3, 3)) +>baz : Symbol(A.baz, Decl(f3.ts, 15, 17)) +>b : Symbol(N.Cls.b, Decl(f3.ts, 7, 26)) + diff --git a/tests/baselines/reference/moduleAugmentationImportsAndExports4.types b/tests/baselines/reference/moduleAugmentationImportsAndExports4.types new file mode 100644 index 00000000000..454dc5d27ec --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationImportsAndExports4.types @@ -0,0 +1,106 @@ +=== tests/cases/compiler/f1.ts === + +export class A {} +>A : A + +=== tests/cases/compiler/f2.ts === +export class B { +>B : B + + n: number; +>n : number +} + +=== tests/cases/compiler/f3.ts === +import {A} from "./f1"; +>A : typeof A + +import {B} from "./f2"; +>B : typeof B + +A.prototype.foo = function () { return undefined; } +>A.prototype.foo = function () { return undefined; } : () => any +>A.prototype.foo : () => B +>A.prototype : A +>A : typeof A +>prototype : A +>foo : () => B +>function () { return undefined; } : () => any +>undefined : undefined + +namespace N { +>N : any + + export interface Ifc { a: number; } +>Ifc : Ifc +>a : number + + export interface Cls { b: number; } +>Cls : Cls +>b : number +} +import I = N.Ifc; +>I : any +>N : any +>Ifc : I + +import C = N.Cls; +>C : any +>N : any +>Cls : C + +declare module "./f1" { + interface A { +>A : A + + foo(): B; +>foo : () => B +>B : B + + bar(): I; +>bar : () => I +>I : I + + baz(): C; +>baz : () => C +>C : C + } +} + +=== tests/cases/compiler/f4.ts === +import {A} from "./f1"; +>A : typeof A + +import "./f3"; + +let a: A; +>a : A +>A : A + +let b = a.foo().n; +>b : number +>a.foo().n : number +>a.foo() : B +>a.foo : () => B +>a : A +>foo : () => B +>n : number + +let c = a.bar().a; +>c : number +>a.bar().a : number +>a.bar() : N.Ifc +>a.bar : () => N.Ifc +>a : A +>bar : () => N.Ifc +>a : number + +let d = a.baz().b; +>d : number +>a.baz().b : number +>a.baz() : N.Cls +>a.baz : () => N.Cls +>a : A +>baz : () => N.Cls +>b : number + diff --git a/tests/baselines/reference/moduleAugmentationImportsAndExports5.errors.txt b/tests/baselines/reference/moduleAugmentationImportsAndExports5.errors.txt new file mode 100644 index 00000000000..5f783453888 --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationImportsAndExports5.errors.txt @@ -0,0 +1,46 @@ +tests/cases/compiler/f3.ts(10,12): error TS4000: Import declaration 'I' is using private name 'N'. +tests/cases/compiler/f3.ts(11,12): error TS4000: Import declaration 'C' is using private name 'N'. + + +==== tests/cases/compiler/f1.ts (0 errors) ==== + + export class A {} + +==== tests/cases/compiler/f2.ts (0 errors) ==== + export class B { + n: number; + } + +==== tests/cases/compiler/f3.ts (2 errors) ==== + import {A} from "./f1"; + import {B} from "./f2"; + + A.prototype.foo = function () { return undefined; } + + namespace N { + export interface Ifc { a: number; } + export interface Cls { b: number; } + } + import I = N.Ifc; + ~ +!!! error TS4000: Import declaration 'I' is using private name 'N'. + import C = N.Cls; + ~ +!!! error TS4000: Import declaration 'C' is using private name 'N'. + + declare module "./f1" { + interface A { + foo(): B; + bar(): I; + baz(): C; + } + } + +==== tests/cases/compiler/f4.ts (0 errors) ==== + import {A} from "./f1"; + import "./f3"; + + let a: A; + let b = a.foo().n; + let c = a.bar().a; + let d = a.baz().b; \ No newline at end of file diff --git a/tests/baselines/reference/moduleAugmentationImportsAndExports5.js b/tests/baselines/reference/moduleAugmentationImportsAndExports5.js new file mode 100644 index 00000000000..c3cba4c01f8 --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationImportsAndExports5.js @@ -0,0 +1,79 @@ +//// [tests/cases/compiler/moduleAugmentationImportsAndExports5.ts] //// + +//// [f1.ts] + +export class A {} + +//// [f2.ts] +export class B { + n: number; +} + +//// [f3.ts] +import {A} from "./f1"; +import {B} from "./f2"; + +A.prototype.foo = function () { return undefined; } + +namespace N { + export interface Ifc { a: number; } + export interface Cls { b: number; } +} +import I = N.Ifc; +import C = N.Cls; + +declare module "./f1" { + interface A { + foo(): B; + bar(): I; + baz(): C; + } +} + +//// [f4.ts] +import {A} from "./f1"; +import "./f3"; + +let a: A; +let b = a.foo().n; +let c = a.bar().a; +let d = a.baz().b; + +//// [f1.js] +"use strict"; +var A = (function () { + function A() { + } + return A; +}()); +exports.A = A; +//// [f2.js] +"use strict"; +var B = (function () { + function B() { + } + return B; +}()); +exports.B = B; +//// [f3.js] +"use strict"; +var f1_1 = require("./f1"); +f1_1.A.prototype.foo = function () { return undefined; }; +//// [f4.js] +"use strict"; +require("./f3"); +var a; +var b = a.foo().n; +var c = a.bar().a; +var d = a.baz().b; + + +//// [f1.d.ts] +export declare class A { +} +//// [f2.d.ts] +export declare class B { + n: number; +} +//// [f4.d.ts] +import "./f3"; diff --git a/tests/baselines/reference/moduleAugmentationImportsAndExports6.js b/tests/baselines/reference/moduleAugmentationImportsAndExports6.js new file mode 100644 index 00000000000..f5aff705eb4 --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationImportsAndExports6.js @@ -0,0 +1,98 @@ +//// [tests/cases/compiler/moduleAugmentationImportsAndExports6.ts] //// + +//// [f1.ts] + +export class A {} + +//// [f2.ts] +export class B { + n: number; +} + +//// [f3.ts] +import {A} from "./f1"; +import {B} from "./f2"; + +A.prototype.foo = function () { return undefined; } + +export namespace N { + export interface Ifc { a: number; } + export interface Cls { b: number; } +} +import I = N.Ifc; +import C = N.Cls; + +declare module "./f1" { + interface A { + foo(): B; + bar(): I; + baz(): C; + } +} + +//// [f4.ts] +import {A} from "./f1"; +import "./f3"; + +let a: A; +let b = a.foo().n; +let c = a.bar().a; +let d = a.baz().b; + +//// [f1.js] +"use strict"; +var A = (function () { + function A() { + } + return A; +}()); +exports.A = A; +//// [f2.js] +"use strict"; +var B = (function () { + function B() { + } + return B; +}()); +exports.B = B; +//// [f3.js] +"use strict"; +var f1_1 = require("./f1"); +f1_1.A.prototype.foo = function () { return undefined; }; +//// [f4.js] +"use strict"; +require("./f3"); +var a; +var b = a.foo().n; +var c = a.bar().a; +var d = a.baz().b; + + +//// [f1.d.ts] +export declare class A { +} +//// [f2.d.ts] +export declare class B { + n: number; +} +//// [f3.d.ts] +import { B } from "./f2"; +export declare namespace N { + interface Ifc { + a: number; + } + interface Cls { + b: number; + } +} +import I = N.Ifc; +import C = N.Cls; +declare module "./f1" { + interface A { + foo(): B; + bar(): I; + baz(): C; + } +} +//// [f4.d.ts] +import "./f3"; diff --git a/tests/baselines/reference/moduleAugmentationImportsAndExports6.symbols b/tests/baselines/reference/moduleAugmentationImportsAndExports6.symbols new file mode 100644 index 00000000000..5c9be6d9448 --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationImportsAndExports6.symbols @@ -0,0 +1,101 @@ +=== tests/cases/compiler/f1.ts === + +export class A {} +>A : Symbol(A, Decl(f1.ts, 0, 0), Decl(f3.ts, 12, 23)) + +=== tests/cases/compiler/f2.ts === +export class B { +>B : Symbol(B, Decl(f2.ts, 0, 0)) + + n: number; +>n : Symbol(B.n, Decl(f2.ts, 0, 16)) +} + +=== tests/cases/compiler/f3.ts === +import {A} from "./f1"; +>A : Symbol(A, Decl(f3.ts, 0, 8)) + +import {B} from "./f2"; +>B : Symbol(B, Decl(f3.ts, 1, 8)) + +A.prototype.foo = function () { return undefined; } +>A.prototype.foo : Symbol(A.foo, Decl(f3.ts, 13, 17)) +>A.prototype : Symbol(A.prototype) +>A : Symbol(A, Decl(f3.ts, 0, 8)) +>prototype : Symbol(A.prototype) +>foo : Symbol(A.foo, Decl(f3.ts, 13, 17)) +>undefined : Symbol(undefined) + +export namespace N { +>N : Symbol(N, Decl(f3.ts, 3, 51)) + + export interface Ifc { a: number; } +>Ifc : Symbol(Ifc, Decl(f3.ts, 5, 20)) +>a : Symbol(Ifc.a, Decl(f3.ts, 6, 26)) + + export interface Cls { b: number; } +>Cls : Symbol(Cls, Decl(f3.ts, 6, 39)) +>b : Symbol(Cls.b, Decl(f3.ts, 7, 26)) +} +import I = N.Ifc; +>I : Symbol(I, Decl(f3.ts, 8, 1)) +>N : Symbol(N, Decl(f3.ts, 3, 51)) +>Ifc : Symbol(I, Decl(f3.ts, 5, 20)) + +import C = N.Cls; +>C : Symbol(C, Decl(f3.ts, 9, 17)) +>N : Symbol(N, Decl(f3.ts, 3, 51)) +>Cls : Symbol(C, Decl(f3.ts, 6, 39)) + +declare module "./f1" { + interface A { +>A : Symbol(A, Decl(f1.ts, 0, 0), Decl(f3.ts, 12, 23)) + + foo(): B; +>foo : Symbol(A.foo, Decl(f3.ts, 13, 17)) +>B : Symbol(B, Decl(f3.ts, 1, 8)) + + bar(): I; +>bar : Symbol(A.bar, Decl(f3.ts, 14, 17)) +>I : Symbol(I, Decl(f3.ts, 8, 1)) + + baz(): C; +>baz : Symbol(A.baz, Decl(f3.ts, 15, 17)) +>C : Symbol(C, Decl(f3.ts, 9, 17)) + } +} + +=== tests/cases/compiler/f4.ts === +import {A} from "./f1"; +>A : Symbol(A, Decl(f4.ts, 0, 8)) + +import "./f3"; + +let a: A; +>a : Symbol(a, Decl(f4.ts, 3, 3)) +>A : Symbol(A, Decl(f4.ts, 0, 8)) + +let b = a.foo().n; +>b : Symbol(b, Decl(f4.ts, 4, 3)) +>a.foo().n : Symbol(B.n, Decl(f2.ts, 0, 16)) +>a.foo : Symbol(A.foo, Decl(f3.ts, 13, 17)) +>a : Symbol(a, Decl(f4.ts, 3, 3)) +>foo : Symbol(A.foo, Decl(f3.ts, 13, 17)) +>n : Symbol(B.n, Decl(f2.ts, 0, 16)) + +let c = a.bar().a; +>c : Symbol(c, Decl(f4.ts, 5, 3)) +>a.bar().a : Symbol(N.Ifc.a, Decl(f3.ts, 6, 26)) +>a.bar : Symbol(A.bar, Decl(f3.ts, 14, 17)) +>a : Symbol(a, Decl(f4.ts, 3, 3)) +>bar : Symbol(A.bar, Decl(f3.ts, 14, 17)) +>a : Symbol(N.Ifc.a, Decl(f3.ts, 6, 26)) + +let d = a.baz().b; +>d : Symbol(d, Decl(f4.ts, 6, 3)) +>a.baz().b : Symbol(N.Cls.b, Decl(f3.ts, 7, 26)) +>a.baz : Symbol(A.baz, Decl(f3.ts, 15, 17)) +>a : Symbol(a, Decl(f4.ts, 3, 3)) +>baz : Symbol(A.baz, Decl(f3.ts, 15, 17)) +>b : Symbol(N.Cls.b, Decl(f3.ts, 7, 26)) + diff --git a/tests/baselines/reference/moduleAugmentationImportsAndExports6.types b/tests/baselines/reference/moduleAugmentationImportsAndExports6.types new file mode 100644 index 00000000000..0c201599b52 --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationImportsAndExports6.types @@ -0,0 +1,106 @@ +=== tests/cases/compiler/f1.ts === + +export class A {} +>A : A + +=== tests/cases/compiler/f2.ts === +export class B { +>B : B + + n: number; +>n : number +} + +=== tests/cases/compiler/f3.ts === +import {A} from "./f1"; +>A : typeof A + +import {B} from "./f2"; +>B : typeof B + +A.prototype.foo = function () { return undefined; } +>A.prototype.foo = function () { return undefined; } : () => any +>A.prototype.foo : () => B +>A.prototype : A +>A : typeof A +>prototype : A +>foo : () => B +>function () { return undefined; } : () => any +>undefined : undefined + +export namespace N { +>N : any + + export interface Ifc { a: number; } +>Ifc : Ifc +>a : number + + export interface Cls { b: number; } +>Cls : Cls +>b : number +} +import I = N.Ifc; +>I : any +>N : any +>Ifc : I + +import C = N.Cls; +>C : any +>N : any +>Cls : C + +declare module "./f1" { + interface A { +>A : A + + foo(): B; +>foo : () => B +>B : B + + bar(): I; +>bar : () => I +>I : I + + baz(): C; +>baz : () => C +>C : C + } +} + +=== tests/cases/compiler/f4.ts === +import {A} from "./f1"; +>A : typeof A + +import "./f3"; + +let a: A; +>a : A +>A : A + +let b = a.foo().n; +>b : number +>a.foo().n : number +>a.foo() : B +>a.foo : () => B +>a : A +>foo : () => B +>n : number + +let c = a.bar().a; +>c : number +>a.bar().a : number +>a.bar() : N.Ifc +>a.bar : () => N.Ifc +>a : A +>bar : () => N.Ifc +>a : number + +let d = a.baz().b; +>d : number +>a.baz().b : number +>a.baz() : N.Cls +>a.baz : () => N.Cls +>a : A +>baz : () => N.Cls +>b : number + diff --git a/tests/baselines/reference/moduleAugmentationInAmbientModule1.js b/tests/baselines/reference/moduleAugmentationInAmbientModule1.js new file mode 100644 index 00000000000..aecb8954d53 --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationInAmbientModule1.js @@ -0,0 +1,39 @@ +//// [tests/cases/compiler/moduleAugmentationInAmbientModule1.ts] //// + +//// [O.d.ts] + + +declare module "Observable" { + class Observable {} +} + +declare module "M" { + class Cls { x: number } +} + +declare module "Map" { + import { Cls } from "M"; + module "Observable" { + interface Observable { + foo(): Cls; + } + } +} + +//// [main.ts] +/// + +import {Observable} from "Observable"; +let x: Observable; +x.foo().x; + + +//// [main.js] +/// +"use strict"; +var x; +x.foo().x; + + +//// [main.d.ts] +/// diff --git a/tests/baselines/reference/moduleAugmentationInAmbientModule1.symbols b/tests/baselines/reference/moduleAugmentationInAmbientModule1.symbols new file mode 100644 index 00000000000..6d9c185ca08 --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationInAmbientModule1.symbols @@ -0,0 +1,46 @@ +=== tests/cases/compiler/main.ts === +/// + +import {Observable} from "Observable"; +>Observable : Symbol(Observable, Decl(main.ts, 2, 8)) + +let x: Observable; +>x : Symbol(x, Decl(main.ts, 3, 3)) +>Observable : Symbol(Observable, Decl(main.ts, 2, 8)) + +x.foo().x; +>x.foo().x : Symbol(Cls.x, Decl(O.d.ts, 7, 15)) +>x.foo : Symbol(Observable.foo, Decl(O.d.ts, 13, 30)) +>x : Symbol(x, Decl(main.ts, 3, 3)) +>foo : Symbol(Observable.foo, Decl(O.d.ts, 13, 30)) +>x : Symbol(Cls.x, Decl(O.d.ts, 7, 15)) + +=== tests/cases/compiler/O.d.ts === + + +declare module "Observable" { + class Observable {} +>Observable : Symbol(Observable, Decl(O.d.ts, 2, 29), Decl(O.d.ts, 12, 25)) +} + +declare module "M" { + class Cls { x: number } +>Cls : Symbol(Cls, Decl(O.d.ts, 6, 20)) +>x : Symbol(Cls.x, Decl(O.d.ts, 7, 15)) +} + +declare module "Map" { + import { Cls } from "M"; +>Cls : Symbol(Cls, Decl(O.d.ts, 11, 12)) + + module "Observable" { + interface Observable { +>Observable : Symbol(Observable, Decl(O.d.ts, 2, 29), Decl(O.d.ts, 12, 25)) + + foo(): Cls; +>foo : Symbol(Observable.foo, Decl(O.d.ts, 13, 30)) +>Cls : Symbol(Cls, Decl(O.d.ts, 11, 12)) + } + } +} + diff --git a/tests/baselines/reference/moduleAugmentationInAmbientModule1.types b/tests/baselines/reference/moduleAugmentationInAmbientModule1.types new file mode 100644 index 00000000000..0be2a787cb6 --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationInAmbientModule1.types @@ -0,0 +1,47 @@ +=== tests/cases/compiler/main.ts === +/// + +import {Observable} from "Observable"; +>Observable : typeof Observable + +let x: Observable; +>x : Observable +>Observable : Observable + +x.foo().x; +>x.foo().x : number +>x.foo() : Cls +>x.foo : () => Cls +>x : Observable +>foo : () => Cls +>x : number + +=== tests/cases/compiler/O.d.ts === + + +declare module "Observable" { + class Observable {} +>Observable : Observable +} + +declare module "M" { + class Cls { x: number } +>Cls : Cls +>x : number +} + +declare module "Map" { + import { Cls } from "M"; +>Cls : typeof Cls + + module "Observable" { + interface Observable { +>Observable : Observable + + foo(): Cls; +>foo : () => Cls +>Cls : Cls + } + } +} + diff --git a/tests/baselines/reference/moduleAugmentationInAmbientModule2.js b/tests/baselines/reference/moduleAugmentationInAmbientModule2.js new file mode 100644 index 00000000000..5529afc674f --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationInAmbientModule2.js @@ -0,0 +1,36 @@ +//// [tests/cases/compiler/moduleAugmentationInAmbientModule2.ts] //// + +//// [O.d.ts] + +declare module "Observable" { + class Observable {} +} + +declare module "M" { + class Cls { x: number } +} + +declare module "Map" { + import { Cls } from "M"; + module "Observable" { + interface Observable { + foo(): Cls; + } + } +} + +//// [main.ts] +/// + +import {Observable} from "Observable"; +import "Map"; +let x: Observable; +x.foo().x; + + +//// [main.js] +/// +"use strict"; +require("Map"); +var x; +x.foo().x; diff --git a/tests/baselines/reference/moduleAugmentationInAmbientModule2.symbols b/tests/baselines/reference/moduleAugmentationInAmbientModule2.symbols new file mode 100644 index 00000000000..5bf797dcf08 --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationInAmbientModule2.symbols @@ -0,0 +1,46 @@ +=== tests/cases/compiler/main.ts === +/// + +import {Observable} from "Observable"; +>Observable : Symbol(Observable, Decl(main.ts, 2, 8)) + +import "Map"; +let x: Observable; +>x : Symbol(x, Decl(main.ts, 4, 3)) +>Observable : Symbol(Observable, Decl(main.ts, 2, 8)) + +x.foo().x; +>x.foo().x : Symbol(Cls.x, Decl(O.d.ts, 6, 15)) +>x.foo : Symbol(Observable.foo, Decl(O.d.ts, 12, 30)) +>x : Symbol(x, Decl(main.ts, 4, 3)) +>foo : Symbol(Observable.foo, Decl(O.d.ts, 12, 30)) +>x : Symbol(Cls.x, Decl(O.d.ts, 6, 15)) + +=== tests/cases/compiler/O.d.ts === + +declare module "Observable" { + class Observable {} +>Observable : Symbol(Observable, Decl(O.d.ts, 1, 29), Decl(O.d.ts, 11, 25)) +} + +declare module "M" { + class Cls { x: number } +>Cls : Symbol(Cls, Decl(O.d.ts, 5, 20)) +>x : Symbol(Cls.x, Decl(O.d.ts, 6, 15)) +} + +declare module "Map" { + import { Cls } from "M"; +>Cls : Symbol(Cls, Decl(O.d.ts, 10, 12)) + + module "Observable" { + interface Observable { +>Observable : Symbol(Observable, Decl(O.d.ts, 1, 29), Decl(O.d.ts, 11, 25)) + + foo(): Cls; +>foo : Symbol(Observable.foo, Decl(O.d.ts, 12, 30)) +>Cls : Symbol(Cls, Decl(O.d.ts, 10, 12)) + } + } +} + diff --git a/tests/baselines/reference/moduleAugmentationInAmbientModule2.types b/tests/baselines/reference/moduleAugmentationInAmbientModule2.types new file mode 100644 index 00000000000..31ea8904c2a --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationInAmbientModule2.types @@ -0,0 +1,47 @@ +=== tests/cases/compiler/main.ts === +/// + +import {Observable} from "Observable"; +>Observable : typeof Observable + +import "Map"; +let x: Observable; +>x : Observable +>Observable : Observable + +x.foo().x; +>x.foo().x : number +>x.foo() : Cls +>x.foo : () => Cls +>x : Observable +>foo : () => Cls +>x : number + +=== tests/cases/compiler/O.d.ts === + +declare module "Observable" { + class Observable {} +>Observable : Observable +} + +declare module "M" { + class Cls { x: number } +>Cls : Cls +>x : number +} + +declare module "Map" { + import { Cls } from "M"; +>Cls : typeof Cls + + module "Observable" { + interface Observable { +>Observable : Observable + + foo(): Cls; +>foo : () => Cls +>Cls : Cls + } + } +} + diff --git a/tests/baselines/reference/moduleAugmentationInAmbientModule3.js b/tests/baselines/reference/moduleAugmentationInAmbientModule3.js new file mode 100644 index 00000000000..3a94c50ef1f --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationInAmbientModule3.js @@ -0,0 +1,47 @@ +//// [tests/cases/compiler/moduleAugmentationInAmbientModule3.ts] //// + +//// [O.d.ts] + +declare module "Observable" { + class Observable {} +} + +declare module "M" { + class Cls { x: number } +} + +declare module "Map" { + import { Cls } from "M"; + module "Observable" { + interface Observable { + foo(): Cls; + } + } +} + +declare module "Map" { + class Cls2 { x2: number } + module "Observable" { + interface Observable { + foo2(): Cls2; + } + } +} + +//// [main.ts] +/// + +import {Observable} from "Observable"; +import "Map"; +let x: Observable; +x.foo().x; +x.foo2().x2; + + +//// [main.js] +/// +"use strict"; +require("Map"); +var x; +x.foo().x; +x.foo2().x2; diff --git a/tests/baselines/reference/moduleAugmentationInAmbientModule3.symbols b/tests/baselines/reference/moduleAugmentationInAmbientModule3.symbols new file mode 100644 index 00000000000..2bde1316107 --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationInAmbientModule3.symbols @@ -0,0 +1,69 @@ +=== tests/cases/compiler/main.ts === +/// + +import {Observable} from "Observable"; +>Observable : Symbol(Observable, Decl(main.ts, 2, 8)) + +import "Map"; +let x: Observable; +>x : Symbol(x, Decl(main.ts, 4, 3)) +>Observable : Symbol(Observable, Decl(main.ts, 2, 8)) + +x.foo().x; +>x.foo().x : Symbol(Cls.x, Decl(O.d.ts, 6, 15)) +>x.foo : Symbol(Observable.foo, Decl(O.d.ts, 12, 30)) +>x : Symbol(x, Decl(main.ts, 4, 3)) +>foo : Symbol(Observable.foo, Decl(O.d.ts, 12, 30)) +>x : Symbol(Cls.x, Decl(O.d.ts, 6, 15)) + +x.foo2().x2; +>x.foo2().x2 : Symbol(Cls2.x2, Decl(O.d.ts, 19, 16)) +>x.foo2 : Symbol(Observable.foo2, Decl(O.d.ts, 21, 30)) +>x : Symbol(x, Decl(main.ts, 4, 3)) +>foo2 : Symbol(Observable.foo2, Decl(O.d.ts, 21, 30)) +>x2 : Symbol(Cls2.x2, Decl(O.d.ts, 19, 16)) + +=== tests/cases/compiler/O.d.ts === + +declare module "Observable" { + class Observable {} +>Observable : Symbol(Observable, Decl(O.d.ts, 1, 29), Decl(O.d.ts, 11, 25), Decl(O.d.ts, 20, 25)) +} + +declare module "M" { + class Cls { x: number } +>Cls : Symbol(Cls, Decl(O.d.ts, 5, 20)) +>x : Symbol(Cls.x, Decl(O.d.ts, 6, 15)) +} + +declare module "Map" { + import { Cls } from "M"; +>Cls : Symbol(Cls, Decl(O.d.ts, 10, 12)) + + module "Observable" { + interface Observable { +>Observable : Symbol(Observable, Decl(O.d.ts, 1, 29), Decl(O.d.ts, 11, 25), Decl(O.d.ts, 20, 25)) + + foo(): Cls; +>foo : Symbol(Observable.foo, Decl(O.d.ts, 12, 30)) +>Cls : Symbol(Cls, Decl(O.d.ts, 10, 12)) + } + } +} + +declare module "Map" { + class Cls2 { x2: number } +>Cls2 : Symbol(Cls2, Decl(O.d.ts, 18, 22)) +>x2 : Symbol(Cls2.x2, Decl(O.d.ts, 19, 16)) + + module "Observable" { + interface Observable { +>Observable : Symbol(Observable, Decl(O.d.ts, 1, 29), Decl(O.d.ts, 11, 25), Decl(O.d.ts, 20, 25)) + + foo2(): Cls2; +>foo2 : Symbol(Observable.foo2, Decl(O.d.ts, 21, 30)) +>Cls2 : Symbol(Cls2, Decl(O.d.ts, 18, 22)) + } + } +} + diff --git a/tests/baselines/reference/moduleAugmentationInAmbientModule3.types b/tests/baselines/reference/moduleAugmentationInAmbientModule3.types new file mode 100644 index 00000000000..2cec5edc6bf --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationInAmbientModule3.types @@ -0,0 +1,71 @@ +=== tests/cases/compiler/main.ts === +/// + +import {Observable} from "Observable"; +>Observable : typeof Observable + +import "Map"; +let x: Observable; +>x : Observable +>Observable : Observable + +x.foo().x; +>x.foo().x : number +>x.foo() : Cls +>x.foo : () => Cls +>x : Observable +>foo : () => Cls +>x : number + +x.foo2().x2; +>x.foo2().x2 : number +>x.foo2() : Cls2 +>x.foo2 : () => Cls2 +>x : Observable +>foo2 : () => Cls2 +>x2 : number + +=== tests/cases/compiler/O.d.ts === + +declare module "Observable" { + class Observable {} +>Observable : Observable +} + +declare module "M" { + class Cls { x: number } +>Cls : Cls +>x : number +} + +declare module "Map" { + import { Cls } from "M"; +>Cls : typeof Cls + + module "Observable" { + interface Observable { +>Observable : Observable + + foo(): Cls; +>foo : () => Cls +>Cls : Cls + } + } +} + +declare module "Map" { + class Cls2 { x2: number } +>Cls2 : Cls2 +>x2 : number + + module "Observable" { + interface Observable { +>Observable : Observable + + foo2(): Cls2; +>foo2 : () => Cls2 +>Cls2 : Cls2 + } + } +} + diff --git a/tests/baselines/reference/moduleAugmentationInAmbientModule4.js b/tests/baselines/reference/moduleAugmentationInAmbientModule4.js new file mode 100644 index 00000000000..bf0339d3107 --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationInAmbientModule4.js @@ -0,0 +1,50 @@ +//// [tests/cases/compiler/moduleAugmentationInAmbientModule4.ts] //// + +//// [O.d.ts] + +declare module "Observable" { + class Observable {} +} + +declare module "M" { + class Cls { x: number } +} + +declare module "Map" { + import { Cls } from "M"; + module "Observable" { + interface Observable { + foo(): Cls; + } + } +} + +//// [O2.d.ts] +declare module "Map" { + class Cls2 { x2: number } + module "Observable" { + interface Observable { + foo2(): Cls2; + } + } +} + +//// [main.ts] +/// +/// + +import {Observable} from "Observable"; +import "Map"; +let x: Observable; +x.foo().x; +x.foo2().x2; + + +//// [main.js] +/// +/// +"use strict"; +require("Map"); +var x; +x.foo().x; +x.foo2().x2; diff --git a/tests/baselines/reference/moduleAugmentationInAmbientModule4.symbols b/tests/baselines/reference/moduleAugmentationInAmbientModule4.symbols new file mode 100644 index 00000000000..6e01ff8a204 --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationInAmbientModule4.symbols @@ -0,0 +1,71 @@ +=== tests/cases/compiler/main.ts === +/// +/// + +import {Observable} from "Observable"; +>Observable : Symbol(Observable, Decl(main.ts, 3, 8)) + +import "Map"; +let x: Observable; +>x : Symbol(x, Decl(main.ts, 5, 3)) +>Observable : Symbol(Observable, Decl(main.ts, 3, 8)) + +x.foo().x; +>x.foo().x : Symbol(Cls.x, Decl(O.d.ts, 6, 15)) +>x.foo : Symbol(Observable.foo, Decl(O.d.ts, 12, 30)) +>x : Symbol(x, Decl(main.ts, 5, 3)) +>foo : Symbol(Observable.foo, Decl(O.d.ts, 12, 30)) +>x : Symbol(Cls.x, Decl(O.d.ts, 6, 15)) + +x.foo2().x2; +>x.foo2().x2 : Symbol(Cls2.x2, Decl(O2.d.ts, 1, 16)) +>x.foo2 : Symbol(Observable.foo2, Decl(O2.d.ts, 3, 30)) +>x : Symbol(x, Decl(main.ts, 5, 3)) +>foo2 : Symbol(Observable.foo2, Decl(O2.d.ts, 3, 30)) +>x2 : Symbol(Cls2.x2, Decl(O2.d.ts, 1, 16)) + +=== tests/cases/compiler/O.d.ts === + +declare module "Observable" { + class Observable {} +>Observable : Symbol(Observable, Decl(O.d.ts, 1, 29), Decl(O.d.ts, 11, 25), Decl(O2.d.ts, 2, 25)) +} + +declare module "M" { + class Cls { x: number } +>Cls : Symbol(Cls, Decl(O.d.ts, 5, 20)) +>x : Symbol(Cls.x, Decl(O.d.ts, 6, 15)) +} + +declare module "Map" { + import { Cls } from "M"; +>Cls : Symbol(Cls, Decl(O.d.ts, 10, 12)) + + module "Observable" { + interface Observable { +>Observable : Symbol(Observable, Decl(O.d.ts, 1, 29), Decl(O.d.ts, 11, 25), Decl(O2.d.ts, 2, 25)) + + foo(): Cls; +>foo : Symbol(Observable.foo, Decl(O.d.ts, 12, 30)) +>Cls : Symbol(Cls, Decl(O.d.ts, 10, 12)) + } + } +} + +=== tests/cases/compiler/O2.d.ts === +declare module "Map" { + class Cls2 { x2: number } +>Cls2 : Symbol(Cls2, Decl(O2.d.ts, 0, 22)) +>x2 : Symbol(Cls2.x2, Decl(O2.d.ts, 1, 16)) + + module "Observable" { + interface Observable { +>Observable : Symbol(Observable, Decl(O.d.ts, 1, 29), Decl(O.d.ts, 11, 25), Decl(O2.d.ts, 2, 25)) + + foo2(): Cls2; +>foo2 : Symbol(Observable.foo2, Decl(O2.d.ts, 3, 30)) +>Cls2 : Symbol(Cls2, Decl(O2.d.ts, 0, 22)) + } + } +} + diff --git a/tests/baselines/reference/moduleAugmentationInAmbientModule4.types b/tests/baselines/reference/moduleAugmentationInAmbientModule4.types new file mode 100644 index 00000000000..04791aef860 --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationInAmbientModule4.types @@ -0,0 +1,73 @@ +=== tests/cases/compiler/main.ts === +/// +/// + +import {Observable} from "Observable"; +>Observable : typeof Observable + +import "Map"; +let x: Observable; +>x : Observable +>Observable : Observable + +x.foo().x; +>x.foo().x : number +>x.foo() : Cls +>x.foo : () => Cls +>x : Observable +>foo : () => Cls +>x : number + +x.foo2().x2; +>x.foo2().x2 : number +>x.foo2() : Cls2 +>x.foo2 : () => Cls2 +>x : Observable +>foo2 : () => Cls2 +>x2 : number + +=== tests/cases/compiler/O.d.ts === + +declare module "Observable" { + class Observable {} +>Observable : Observable +} + +declare module "M" { + class Cls { x: number } +>Cls : Cls +>x : number +} + +declare module "Map" { + import { Cls } from "M"; +>Cls : typeof Cls + + module "Observable" { + interface Observable { +>Observable : Observable + + foo(): Cls; +>foo : () => Cls +>Cls : Cls + } + } +} + +=== tests/cases/compiler/O2.d.ts === +declare module "Map" { + class Cls2 { x2: number } +>Cls2 : Cls2 +>x2 : number + + module "Observable" { + interface Observable { +>Observable : Observable + + foo2(): Cls2; +>foo2 : () => Cls2 +>Cls2 : Cls2 + } + } +} + diff --git a/tests/baselines/reference/moduleAugmentationInAmbientModule5.js b/tests/baselines/reference/moduleAugmentationInAmbientModule5.js new file mode 100644 index 00000000000..2e6503c4774 --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationInAmbientModule5.js @@ -0,0 +1,36 @@ +//// [tests/cases/compiler/moduleAugmentationInAmbientModule5.ts] //// + +//// [array.d.ts] + +declare module "A" { + class A { x: number; } +} + +declare module "array" { + import {A} from "A"; + global { + interface Array { + getA(): A; + } + } +} + +//// [f.ts] +/// +import "array"; + +let x = [1]; +let y = x.getA().x; + + +//// [f.js] +"use strict"; +/// +require("array"); +var x = [1]; +var y = x.getA().x; + + +//// [f.d.ts] +/// +import "array"; diff --git a/tests/baselines/reference/moduleAugmentationInAmbientModule5.symbols b/tests/baselines/reference/moduleAugmentationInAmbientModule5.symbols new file mode 100644 index 00000000000..76b135307dd --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationInAmbientModule5.symbols @@ -0,0 +1,41 @@ +=== tests/cases/compiler/f.ts === +/// +import "array"; + +let x = [1]; +>x : Symbol(x, Decl(f.ts, 3, 3)) + +let y = x.getA().x; +>y : Symbol(y, Decl(f.ts, 4, 3)) +>x.getA().x : Symbol(A.x, Decl(array.d.ts, 2, 13)) +>x.getA : Symbol(Array.getA, Decl(array.d.ts, 8, 28)) +>x : Symbol(x, Decl(f.ts, 3, 3)) +>getA : Symbol(Array.getA, Decl(array.d.ts, 8, 28)) +>x : Symbol(A.x, Decl(array.d.ts, 2, 13)) + +=== tests/cases/compiler/array.d.ts === + +declare module "A" { + class A { x: number; } +>A : Symbol(A, Decl(array.d.ts, 1, 20)) +>x : Symbol(A.x, Decl(array.d.ts, 2, 13)) +} + +declare module "array" { + import {A} from "A"; +>A : Symbol(A, Decl(array.d.ts, 6, 12)) + + global { +>global : Symbol(, Decl(array.d.ts, 6, 24)) + + interface Array { +>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(array.d.ts, 7, 12)) +>T : Symbol(T, Decl(lib.d.ts, --, --), Decl(array.d.ts, 8, 24)) + + getA(): A; +>getA : Symbol(Array.getA, Decl(array.d.ts, 8, 28)) +>A : Symbol(A, Decl(array.d.ts, 6, 12)) + } + } +} + diff --git a/tests/baselines/reference/moduleAugmentationInAmbientModule5.types b/tests/baselines/reference/moduleAugmentationInAmbientModule5.types new file mode 100644 index 00000000000..998452be450 --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationInAmbientModule5.types @@ -0,0 +1,44 @@ +=== tests/cases/compiler/f.ts === +/// +import "array"; + +let x = [1]; +>x : number[] +>[1] : number[] +>1 : number + +let y = x.getA().x; +>y : number +>x.getA().x : number +>x.getA() : A +>x.getA : () => A +>x : number[] +>getA : () => A +>x : number + +=== tests/cases/compiler/array.d.ts === + +declare module "A" { + class A { x: number; } +>A : A +>x : number +} + +declare module "array" { + import {A} from "A"; +>A : typeof A + + global { +>global : any + + interface Array { +>Array : T[] +>T : T + + getA(): A; +>getA : () => A +>A : A + } + } +} + diff --git a/tests/baselines/reference/moduleAugmentationInDependency.js b/tests/baselines/reference/moduleAugmentationInDependency.js new file mode 100644 index 00000000000..1c5995339c3 --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationInDependency.js @@ -0,0 +1,13 @@ +//// [tests/cases/compiler/moduleAugmentationInDependency.ts] //// + +//// [index.d.ts] +declare module "ext" { +} +export {}; + +//// [app.ts] +import "A" + +//// [app.js] +"use strict"; +require("A"); diff --git a/tests/baselines/reference/moduleAugmentationInDependency.symbols b/tests/baselines/reference/moduleAugmentationInDependency.symbols new file mode 100644 index 00000000000..82f1faedbf5 --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationInDependency.symbols @@ -0,0 +1,8 @@ +=== /node_modules/A/index.d.ts === +declare module "ext" { +No type information for this code.} +No type information for this code.export {}; +No type information for this code. +No type information for this code.=== /src/app.ts === +import "A" +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/moduleAugmentationInDependency.types b/tests/baselines/reference/moduleAugmentationInDependency.types new file mode 100644 index 00000000000..82f1faedbf5 --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationInDependency.types @@ -0,0 +1,8 @@ +=== /node_modules/A/index.d.ts === +declare module "ext" { +No type information for this code.} +No type information for this code.export {}; +No type information for this code. +No type information for this code.=== /src/app.ts === +import "A" +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/moduleAugmentationInDependency2.errors.txt b/tests/baselines/reference/moduleAugmentationInDependency2.errors.txt new file mode 100644 index 00000000000..eb53c5265b6 --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationInDependency2.errors.txt @@ -0,0 +1,12 @@ +/node_modules/A/index.ts(1,16): error TS2664: Invalid module name in augmentation, module 'ext' cannot be found. + + +==== /node_modules/A/index.ts (1 errors) ==== + declare module "ext" { + ~~~~~ +!!! error TS2664: Invalid module name in augmentation, module 'ext' cannot be found. + } + export {}; + +==== /src/app.ts (0 errors) ==== + import "A" \ No newline at end of file diff --git a/tests/baselines/reference/moduleAugmentationInDependency2.js b/tests/baselines/reference/moduleAugmentationInDependency2.js new file mode 100644 index 00000000000..381f1e72d8f --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationInDependency2.js @@ -0,0 +1,15 @@ +//// [tests/cases/compiler/moduleAugmentationInDependency2.ts] //// + +//// [index.ts] +declare module "ext" { +} +export {}; + +//// [app.ts] +import "A" + +//// [index.js] +"use strict"; +//// [app.js] +"use strict"; +require("A"); diff --git a/tests/baselines/reference/moduleAugmentationNoNewNames.js b/tests/baselines/reference/moduleAugmentationNoNewNames.js new file mode 100644 index 00000000000..ccd4a668497 --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationNoNewNames.js @@ -0,0 +1,41 @@ +//// [tests/cases/compiler/moduleAugmentationNoNewNames.ts] //// + +//// [map.ts] + +import { Observable } from "./observable" + +(Observable.prototype).map = function() { } + +declare module "./observable" { + interface Observable { + map(proj: (e:T) => U): Observable + } + class Bar {} + let y: number, z: string; + let {a: x, b: x1}: {a: number, b: number}; + module Z {} +} + +//// [observable.ts] +export declare class Observable { + filter(pred: (e:T) => boolean): Observable; +} + +//// [main.ts] +import { Observable } from "./observable" +import "./map"; + +let x: Observable; +let y = x.map(x => x + 1); + +//// [observable.js] +"use strict"; +//// [map.js] +"use strict"; +var observable_1 = require("./observable"); +observable_1.Observable.prototype.map = function () { }; +//// [main.js] +"use strict"; +require("./map"); +var x; +var y = x.map(function (x) { return x + 1; }); diff --git a/tests/baselines/reference/moduleAugmentationNoNewNames.symbols b/tests/baselines/reference/moduleAugmentationNoNewNames.symbols new file mode 100644 index 00000000000..a340d3820a2 --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationNoNewNames.symbols @@ -0,0 +1,76 @@ +=== tests/cases/compiler/map.ts === + +import { Observable } from "./observable" +>Observable : Symbol(Observable, Decl(map.ts, 1, 8)) + +(Observable.prototype).map = function() { } +>Observable.prototype : Symbol(Observable.prototype) +>Observable : Symbol(Observable, Decl(map.ts, 1, 8)) +>prototype : Symbol(Observable.prototype) + +declare module "./observable" { + interface Observable { +>Observable : Symbol(Observable, Decl(observable.ts, 0, 0), Decl(map.ts, 5, 31)) +>T : Symbol(T, Decl(observable.ts, 0, 32), Decl(map.ts, 6, 25)) + + map(proj: (e:T) => U): Observable +>map : Symbol(Observable.map, Decl(map.ts, 6, 29)) +>U : Symbol(U, Decl(map.ts, 7, 12)) +>proj : Symbol(proj, Decl(map.ts, 7, 15)) +>e : Symbol(e, Decl(map.ts, 7, 22)) +>T : Symbol(T, Decl(observable.ts, 0, 32), Decl(map.ts, 6, 25)) +>U : Symbol(U, Decl(map.ts, 7, 12)) +>Observable : Symbol(Observable, Decl(observable.ts, 0, 0), Decl(map.ts, 5, 31)) +>U : Symbol(U, Decl(map.ts, 7, 12)) + } + class Bar {} +>Bar : Symbol(Bar, Decl(map.ts, 8, 5)) + + let y: number, z: string; +>y : Symbol(y, Decl(map.ts, 10, 7)) +>z : Symbol(z, Decl(map.ts, 10, 18)) + + let {a: x, b: x1}: {a: number, b: number}; +>a : Symbol(a, Decl(map.ts, 11, 24)) +>x : Symbol(x, Decl(map.ts, 11, 9)) +>b : Symbol(b, Decl(map.ts, 11, 34)) +>x1 : Symbol(x1, Decl(map.ts, 11, 14)) +>a : Symbol(a, Decl(map.ts, 11, 24)) +>b : Symbol(b, Decl(map.ts, 11, 34)) + + module Z {} +>Z : Symbol(Z, Decl(map.ts, 11, 46)) +} + +=== tests/cases/compiler/observable.ts === +export declare class Observable { +>Observable : Symbol(Observable, Decl(observable.ts, 0, 0), Decl(map.ts, 5, 31)) +>T : Symbol(T, Decl(observable.ts, 0, 32), Decl(map.ts, 6, 25)) + + filter(pred: (e:T) => boolean): Observable; +>filter : Symbol(Observable.filter, Decl(observable.ts, 0, 36)) +>pred : Symbol(pred, Decl(observable.ts, 1, 11)) +>e : Symbol(e, Decl(observable.ts, 1, 18)) +>T : Symbol(T, Decl(observable.ts, 0, 32), Decl(map.ts, 6, 25)) +>Observable : Symbol(Observable, Decl(observable.ts, 0, 0), Decl(map.ts, 5, 31)) +>T : Symbol(T, Decl(observable.ts, 0, 32), Decl(map.ts, 6, 25)) +} + +=== tests/cases/compiler/main.ts === +import { Observable } from "./observable" +>Observable : Symbol(Observable, Decl(main.ts, 0, 8)) + +import "./map"; + +let x: Observable; +>x : Symbol(x, Decl(main.ts, 3, 3)) +>Observable : Symbol(Observable, Decl(main.ts, 0, 8)) + +let y = x.map(x => x + 1); +>y : Symbol(y, Decl(main.ts, 4, 3)) +>x.map : Symbol(Observable.map, Decl(map.ts, 6, 29)) +>x : Symbol(x, Decl(main.ts, 3, 3)) +>map : Symbol(Observable.map, Decl(map.ts, 6, 29)) +>x : Symbol(x, Decl(main.ts, 4, 14)) +>x : Symbol(x, Decl(main.ts, 4, 14)) + diff --git a/tests/baselines/reference/moduleAugmentationNoNewNames.types b/tests/baselines/reference/moduleAugmentationNoNewNames.types new file mode 100644 index 00000000000..37dc54b6663 --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationNoNewNames.types @@ -0,0 +1,86 @@ +=== tests/cases/compiler/map.ts === + +import { Observable } from "./observable" +>Observable : typeof Observable + +(Observable.prototype).map = function() { } +>(Observable.prototype).map = function() { } : () => void +>(Observable.prototype).map : any +>(Observable.prototype) : any +>Observable.prototype : any +>Observable.prototype : Observable +>Observable : typeof Observable +>prototype : Observable +>map : any +>function() { } : () => void + +declare module "./observable" { + interface Observable { +>Observable : Observable +>T : T + + map(proj: (e:T) => U): Observable +>map : (proj: (e: T) => U) => Observable +>U : U +>proj : (e: T) => U +>e : T +>T : T +>U : U +>Observable : Observable +>U : U + } + class Bar {} +>Bar : Bar + + let y: number, z: string; +>y : number +>z : string + + let {a: x, b: x1}: {a: number, b: number}; +>a : any +>x : number +>b : any +>x1 : number +>a : number +>b : number + + module Z {} +>Z : any +} + +=== tests/cases/compiler/observable.ts === +export declare class Observable { +>Observable : Observable +>T : T + + filter(pred: (e:T) => boolean): Observable; +>filter : (pred: (e: T) => boolean) => Observable +>pred : (e: T) => boolean +>e : T +>T : T +>Observable : Observable +>T : T +} + +=== tests/cases/compiler/main.ts === +import { Observable } from "./observable" +>Observable : typeof Observable + +import "./map"; + +let x: Observable; +>x : Observable +>Observable : Observable + +let y = x.map(x => x + 1); +>y : Observable +>x.map(x => x + 1) : Observable +>x.map : (proj: (e: number) => U) => Observable +>x : Observable +>map : (proj: (e: number) => U) => Observable +>x => x + 1 : (x: number) => number +>x : number +>x + 1 : number +>x : number +>1 : number + diff --git a/tests/baselines/reference/moduleAugmentationsBundledOutput1.js b/tests/baselines/reference/moduleAugmentationsBundledOutput1.js new file mode 100644 index 00000000000..504c015bcb8 --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationsBundledOutput1.js @@ -0,0 +1,144 @@ +//// [tests/cases/compiler/moduleAugmentationsBundledOutput1.ts] //// + +//// [m1.ts] + +export class Cls { +} + +//// [m2.ts] +import {Cls} from "./m1"; +(Cls.prototype).foo = function() { return 1; }; +(Cls.prototype).bar = function() { return "1"; }; + +declare module "./m1" { + interface Cls { + foo(): number; + } +} + +declare module "./m1" { + interface Cls { + bar(): string; + } +} + +//// [m3.ts] +export class C1 { x: number } +export class C2 { x: string } + +//// [m4.ts] +import {Cls} from "./m1"; +import {C1, C2} from "./m3"; +(Cls.prototype).baz1 = function() { return undefined }; +(Cls.prototype).baz2 = function() { return undefined }; + +declare module "./m1" { + interface Cls { + baz1(): C1; + } +} + +declare module "./m1" { + interface Cls { + baz2(): C2; + } +} + +//// [test.ts] +import { Cls } from "./m1"; +import "m2"; +import "m4"; +let c: Cls; +c.foo().toExponential(); +c.bar().toLowerCase(); +c.baz1().x.toExponential(); +c.baz2().x.toLowerCase(); + + +//// [out.js] +define("m1", ["require", "exports"], function (require, exports) { + "use strict"; + var Cls = (function () { + function Cls() { + } + return Cls; + }()); + exports.Cls = Cls; +}); +define("m2", ["require", "exports", "m1"], function (require, exports, m1_1) { + "use strict"; + m1_1.Cls.prototype.foo = function () { return 1; }; + m1_1.Cls.prototype.bar = function () { return "1"; }; +}); +define("m3", ["require", "exports"], function (require, exports) { + "use strict"; + var C1 = (function () { + function C1() { + } + return C1; + }()); + exports.C1 = C1; + var C2 = (function () { + function C2() { + } + return C2; + }()); + exports.C2 = C2; +}); +define("m4", ["require", "exports", "m1"], function (require, exports, m1_2) { + "use strict"; + m1_2.Cls.prototype.baz1 = function () { return undefined; }; + m1_2.Cls.prototype.baz2 = function () { return undefined; }; +}); +define("test", ["require", "exports", "m2", "m4"], function (require, exports) { + "use strict"; + var c; + c.foo().toExponential(); + c.bar().toLowerCase(); + c.baz1().x.toExponential(); + c.baz2().x.toLowerCase(); +}); + + +//// [out.d.ts] +declare module "m1" { + export class Cls { + } +} +declare module "m2" { + module "m1" { + interface Cls { + foo(): number; + } + } + module "m1" { + interface Cls { + bar(): string; + } + } +} +declare module "m3" { + export class C1 { + x: number; + } + export class C2 { + x: string; + } +} +declare module "m4" { + import { C1, C2 } from "m3"; + module "m1" { + interface Cls { + baz1(): C1; + } + } + module "m1" { + interface Cls { + baz2(): C2; + } + } +} +declare module "test" { + import "m2"; + import "m4"; +} diff --git a/tests/baselines/reference/moduleAugmentationsBundledOutput1.symbols b/tests/baselines/reference/moduleAugmentationsBundledOutput1.symbols new file mode 100644 index 00000000000..5f98b39c228 --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationsBundledOutput1.symbols @@ -0,0 +1,129 @@ +=== tests/cases/compiler/m1.ts === + +export class Cls { +>Cls : Symbol(Cls, Decl(m1.ts, 0, 0), Decl(m2.ts, 4, 23), Decl(m2.ts, 10, 23), Decl(m4.ts, 5, 23), Decl(m4.ts, 11, 23)) +} + +=== tests/cases/compiler/m2.ts === +import {Cls} from "./m1"; +>Cls : Symbol(Cls, Decl(m2.ts, 0, 8)) + +(Cls.prototype).foo = function() { return 1; }; +>Cls.prototype : Symbol(Cls.prototype) +>Cls : Symbol(Cls, Decl(m2.ts, 0, 8)) +>prototype : Symbol(Cls.prototype) + +(Cls.prototype).bar = function() { return "1"; }; +>Cls.prototype : Symbol(Cls.prototype) +>Cls : Symbol(Cls, Decl(m2.ts, 0, 8)) +>prototype : Symbol(Cls.prototype) + +declare module "./m1" { + interface Cls { +>Cls : Symbol(Cls, Decl(m1.ts, 0, 0), Decl(m2.ts, 4, 23), Decl(m2.ts, 10, 23), Decl(m4.ts, 5, 23), Decl(m4.ts, 11, 23)) + + foo(): number; +>foo : Symbol(Cls.foo, Decl(m2.ts, 5, 19)) + } +} + +declare module "./m1" { + interface Cls { +>Cls : Symbol(Cls, Decl(m1.ts, 0, 0), Decl(m2.ts, 4, 23), Decl(m2.ts, 10, 23), Decl(m4.ts, 5, 23), Decl(m4.ts, 11, 23)) + + bar(): string; +>bar : Symbol(Cls.bar, Decl(m2.ts, 11, 19)) + } +} + +=== tests/cases/compiler/m3.ts === +export class C1 { x: number } +>C1 : Symbol(C1, Decl(m3.ts, 0, 0)) +>x : Symbol(C1.x, Decl(m3.ts, 0, 17)) + +export class C2 { x: string } +>C2 : Symbol(C2, Decl(m3.ts, 0, 29)) +>x : Symbol(C2.x, Decl(m3.ts, 1, 17)) + +=== tests/cases/compiler/m4.ts === +import {Cls} from "./m1"; +>Cls : Symbol(Cls, Decl(m4.ts, 0, 8)) + +import {C1, C2} from "./m3"; +>C1 : Symbol(C1, Decl(m4.ts, 1, 8)) +>C2 : Symbol(C2, Decl(m4.ts, 1, 11)) + +(Cls.prototype).baz1 = function() { return undefined }; +>Cls.prototype : Symbol(Cls.prototype) +>Cls : Symbol(Cls, Decl(m4.ts, 0, 8)) +>prototype : Symbol(Cls.prototype) +>undefined : Symbol(undefined) + +(Cls.prototype).baz2 = function() { return undefined }; +>Cls.prototype : Symbol(Cls.prototype) +>Cls : Symbol(Cls, Decl(m4.ts, 0, 8)) +>prototype : Symbol(Cls.prototype) +>undefined : Symbol(undefined) + +declare module "./m1" { + interface Cls { +>Cls : Symbol(Cls, Decl(m1.ts, 0, 0), Decl(m2.ts, 4, 23), Decl(m2.ts, 10, 23), Decl(m4.ts, 5, 23), Decl(m4.ts, 11, 23)) + + baz1(): C1; +>baz1 : Symbol(Cls.baz1, Decl(m4.ts, 6, 19)) +>C1 : Symbol(C1, Decl(m4.ts, 1, 8)) + } +} + +declare module "./m1" { + interface Cls { +>Cls : Symbol(Cls, Decl(m1.ts, 0, 0), Decl(m2.ts, 4, 23), Decl(m2.ts, 10, 23), Decl(m4.ts, 5, 23), Decl(m4.ts, 11, 23)) + + baz2(): C2; +>baz2 : Symbol(Cls.baz2, Decl(m4.ts, 12, 19)) +>C2 : Symbol(C2, Decl(m4.ts, 1, 11)) + } +} + +=== tests/cases/compiler/test.ts === +import { Cls } from "./m1"; +>Cls : Symbol(Cls, Decl(test.ts, 0, 8)) + +import "m2"; +import "m4"; +let c: Cls; +>c : Symbol(c, Decl(test.ts, 3, 3)) +>Cls : Symbol(Cls, Decl(test.ts, 0, 8)) + +c.foo().toExponential(); +>c.foo().toExponential : Symbol(Number.toExponential, Decl(lib.d.ts, --, --)) +>c.foo : Symbol(Cls.foo, Decl(m2.ts, 5, 19)) +>c : Symbol(c, Decl(test.ts, 3, 3)) +>foo : Symbol(Cls.foo, Decl(m2.ts, 5, 19)) +>toExponential : Symbol(Number.toExponential, Decl(lib.d.ts, --, --)) + +c.bar().toLowerCase(); +>c.bar().toLowerCase : Symbol(String.toLowerCase, Decl(lib.d.ts, --, --)) +>c.bar : Symbol(Cls.bar, Decl(m2.ts, 11, 19)) +>c : Symbol(c, Decl(test.ts, 3, 3)) +>bar : Symbol(Cls.bar, Decl(m2.ts, 11, 19)) +>toLowerCase : Symbol(String.toLowerCase, Decl(lib.d.ts, --, --)) + +c.baz1().x.toExponential(); +>c.baz1().x.toExponential : Symbol(Number.toExponential, Decl(lib.d.ts, --, --)) +>c.baz1().x : Symbol(C1.x, Decl(m3.ts, 0, 17)) +>c.baz1 : Symbol(Cls.baz1, Decl(m4.ts, 6, 19)) +>c : Symbol(c, Decl(test.ts, 3, 3)) +>baz1 : Symbol(Cls.baz1, Decl(m4.ts, 6, 19)) +>x : Symbol(C1.x, Decl(m3.ts, 0, 17)) +>toExponential : Symbol(Number.toExponential, Decl(lib.d.ts, --, --)) + +c.baz2().x.toLowerCase(); +>c.baz2().x.toLowerCase : Symbol(String.toLowerCase, Decl(lib.d.ts, --, --)) +>c.baz2().x : Symbol(C2.x, Decl(m3.ts, 1, 17)) +>c.baz2 : Symbol(Cls.baz2, Decl(m4.ts, 12, 19)) +>c : Symbol(c, Decl(test.ts, 3, 3)) +>baz2 : Symbol(Cls.baz2, Decl(m4.ts, 12, 19)) +>x : Symbol(C2.x, Decl(m3.ts, 1, 17)) +>toLowerCase : Symbol(String.toLowerCase, Decl(lib.d.ts, --, --)) + diff --git a/tests/baselines/reference/moduleAugmentationsBundledOutput1.types b/tests/baselines/reference/moduleAugmentationsBundledOutput1.types new file mode 100644 index 00000000000..80e9127905d --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationsBundledOutput1.types @@ -0,0 +1,163 @@ +=== tests/cases/compiler/m1.ts === + +export class Cls { +>Cls : Cls +} + +=== tests/cases/compiler/m2.ts === +import {Cls} from "./m1"; +>Cls : typeof Cls + +(Cls.prototype).foo = function() { return 1; }; +>(Cls.prototype).foo = function() { return 1; } : () => number +>(Cls.prototype).foo : any +>(Cls.prototype) : any +>Cls.prototype : any +>Cls.prototype : Cls +>Cls : typeof Cls +>prototype : Cls +>foo : any +>function() { return 1; } : () => number +>1 : number + +(Cls.prototype).bar = function() { return "1"; }; +>(Cls.prototype).bar = function() { return "1"; } : () => string +>(Cls.prototype).bar : any +>(Cls.prototype) : any +>Cls.prototype : any +>Cls.prototype : Cls +>Cls : typeof Cls +>prototype : Cls +>bar : any +>function() { return "1"; } : () => string +>"1" : string + +declare module "./m1" { + interface Cls { +>Cls : Cls + + foo(): number; +>foo : () => number + } +} + +declare module "./m1" { + interface Cls { +>Cls : Cls + + bar(): string; +>bar : () => string + } +} + +=== tests/cases/compiler/m3.ts === +export class C1 { x: number } +>C1 : C1 +>x : number + +export class C2 { x: string } +>C2 : C2 +>x : string + +=== tests/cases/compiler/m4.ts === +import {Cls} from "./m1"; +>Cls : typeof Cls + +import {C1, C2} from "./m3"; +>C1 : typeof C1 +>C2 : typeof C2 + +(Cls.prototype).baz1 = function() { return undefined }; +>(Cls.prototype).baz1 = function() { return undefined } : () => any +>(Cls.prototype).baz1 : any +>(Cls.prototype) : any +>Cls.prototype : any +>Cls.prototype : Cls +>Cls : typeof Cls +>prototype : Cls +>baz1 : any +>function() { return undefined } : () => any +>undefined : undefined + +(Cls.prototype).baz2 = function() { return undefined }; +>(Cls.prototype).baz2 = function() { return undefined } : () => any +>(Cls.prototype).baz2 : any +>(Cls.prototype) : any +>Cls.prototype : any +>Cls.prototype : Cls +>Cls : typeof Cls +>prototype : Cls +>baz2 : any +>function() { return undefined } : () => any +>undefined : undefined + +declare module "./m1" { + interface Cls { +>Cls : Cls + + baz1(): C1; +>baz1 : () => C1 +>C1 : C1 + } +} + +declare module "./m1" { + interface Cls { +>Cls : Cls + + baz2(): C2; +>baz2 : () => C2 +>C2 : C2 + } +} + +=== tests/cases/compiler/test.ts === +import { Cls } from "./m1"; +>Cls : typeof Cls + +import "m2"; +import "m4"; +let c: Cls; +>c : Cls +>Cls : Cls + +c.foo().toExponential(); +>c.foo().toExponential() : string +>c.foo().toExponential : (fractionDigits?: number) => string +>c.foo() : number +>c.foo : () => number +>c : Cls +>foo : () => number +>toExponential : (fractionDigits?: number) => string + +c.bar().toLowerCase(); +>c.bar().toLowerCase() : string +>c.bar().toLowerCase : () => string +>c.bar() : string +>c.bar : () => string +>c : Cls +>bar : () => string +>toLowerCase : () => string + +c.baz1().x.toExponential(); +>c.baz1().x.toExponential() : string +>c.baz1().x.toExponential : (fractionDigits?: number) => string +>c.baz1().x : number +>c.baz1() : C1 +>c.baz1 : () => C1 +>c : Cls +>baz1 : () => C1 +>x : number +>toExponential : (fractionDigits?: number) => string + +c.baz2().x.toLowerCase(); +>c.baz2().x.toLowerCase() : string +>c.baz2().x.toLowerCase : () => string +>c.baz2().x : string +>c.baz2() : C2 +>c.baz2 : () => C2 +>c : Cls +>baz2 : () => C2 +>x : string +>toLowerCase : () => string + diff --git a/tests/baselines/reference/moduleAugmentationsImports1.js b/tests/baselines/reference/moduleAugmentationsImports1.js new file mode 100644 index 00000000000..922bb61d952 --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationsImports1.js @@ -0,0 +1,105 @@ +//// [tests/cases/compiler/moduleAugmentationsImports1.ts] //// + +//// [a.ts] + +export class A {} + +//// [b.ts] +export class B {x: number;} + +//// [c.d.ts] +declare module "C" { + class Cls {y: string; } +} + +//// [d.ts] +/// + +import {A} from "./a"; +import {B} from "./b"; +import {Cls} from "C"; + +A.prototype.getB = function () { return undefined; } +A.prototype.getCls = function () { return undefined; } + +declare module "./a" { + interface A { + getB(): B; + } +} + +declare module "./a" { + interface A { + getCls(): Cls; + } +} + +//// [main.ts] +import {A} from "./a"; +import "d"; + +let a: A; +let b = a.getB().x.toFixed(); +let c = a.getCls().y.toLowerCase(); + +//// [f.js] +define("a", ["require", "exports"], function (require, exports) { + "use strict"; + var A = (function () { + function A() { + } + return A; + }()); + exports.A = A; +}); +define("b", ["require", "exports"], function (require, exports) { + "use strict"; + var B = (function () { + function B() { + } + return B; + }()); + exports.B = B; +}); +/// +define("d", ["require", "exports", "a"], function (require, exports, a_1) { + "use strict"; + a_1.A.prototype.getB = function () { return undefined; }; + a_1.A.prototype.getCls = function () { return undefined; }; +}); +define("main", ["require", "exports", "d"], function (require, exports) { + "use strict"; + var a; + var b = a.getB().x.toFixed(); + var c = a.getCls().y.toLowerCase(); +}); + + +//// [f.d.ts] +/// +declare module "a" { + export class A { + } +} +declare module "b" { + export class B { + x: number; + } +} +declare module "d" { + import { B } from "b"; + import { Cls } from "C"; + module "a" { + interface A { + getB(): B; + } + } + module "a" { + interface A { + getCls(): Cls; + } + } +} +declare module "main" { + import "d"; +} diff --git a/tests/baselines/reference/moduleAugmentationsImports1.symbols b/tests/baselines/reference/moduleAugmentationsImports1.symbols new file mode 100644 index 00000000000..685ee9bb31c --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationsImports1.symbols @@ -0,0 +1,95 @@ +=== tests/cases/compiler/a.ts === + +export class A {} +>A : Symbol(A, Decl(a.ts, 0, 0), Decl(d.ts, 9, 22), Decl(d.ts, 15, 22)) + +=== tests/cases/compiler/b.ts === +export class B {x: number;} +>B : Symbol(B, Decl(b.ts, 0, 0)) +>x : Symbol(B.x, Decl(b.ts, 0, 16)) + +=== tests/cases/compiler/c.d.ts === +declare module "C" { + class Cls {y: string; } +>Cls : Symbol(Cls, Decl(c.d.ts, 0, 20)) +>y : Symbol(Cls.y, Decl(c.d.ts, 1, 15)) +} + +=== tests/cases/compiler/d.ts === +/// + +import {A} from "./a"; +>A : Symbol(A, Decl(d.ts, 2, 8)) + +import {B} from "./b"; +>B : Symbol(B, Decl(d.ts, 3, 8)) + +import {Cls} from "C"; +>Cls : Symbol(Cls, Decl(d.ts, 4, 8)) + +A.prototype.getB = function () { return undefined; } +>A.prototype.getB : Symbol(A.getB, Decl(d.ts, 10, 17)) +>A.prototype : Symbol(A.prototype) +>A : Symbol(A, Decl(d.ts, 2, 8)) +>prototype : Symbol(A.prototype) +>getB : Symbol(A.getB, Decl(d.ts, 10, 17)) +>undefined : Symbol(undefined) + +A.prototype.getCls = function () { return undefined; } +>A.prototype.getCls : Symbol(A.getCls, Decl(d.ts, 16, 17)) +>A.prototype : Symbol(A.prototype) +>A : Symbol(A, Decl(d.ts, 2, 8)) +>prototype : Symbol(A.prototype) +>getCls : Symbol(A.getCls, Decl(d.ts, 16, 17)) +>undefined : Symbol(undefined) + +declare module "./a" { + interface A { +>A : Symbol(A, Decl(a.ts, 0, 0), Decl(d.ts, 9, 22), Decl(d.ts, 15, 22)) + + getB(): B; +>getB : Symbol(A.getB, Decl(d.ts, 10, 17)) +>B : Symbol(B, Decl(d.ts, 3, 8)) + } +} + +declare module "./a" { + interface A { +>A : Symbol(A, Decl(a.ts, 0, 0), Decl(d.ts, 9, 22), Decl(d.ts, 15, 22)) + + getCls(): Cls; +>getCls : Symbol(A.getCls, Decl(d.ts, 16, 17)) +>Cls : Symbol(Cls, Decl(d.ts, 4, 8)) + } +} + +=== tests/cases/compiler/main.ts === +import {A} from "./a"; +>A : Symbol(A, Decl(main.ts, 0, 8)) + +import "d"; + +let a: A; +>a : Symbol(a, Decl(main.ts, 3, 3)) +>A : Symbol(A, Decl(main.ts, 0, 8)) + +let b = a.getB().x.toFixed(); +>b : Symbol(b, Decl(main.ts, 4, 3)) +>a.getB().x.toFixed : Symbol(Number.toFixed, Decl(lib.d.ts, --, --)) +>a.getB().x : Symbol(B.x, Decl(b.ts, 0, 16)) +>a.getB : Symbol(A.getB, Decl(d.ts, 10, 17)) +>a : Symbol(a, Decl(main.ts, 3, 3)) +>getB : Symbol(A.getB, Decl(d.ts, 10, 17)) +>x : Symbol(B.x, Decl(b.ts, 0, 16)) +>toFixed : Symbol(Number.toFixed, Decl(lib.d.ts, --, --)) + +let c = a.getCls().y.toLowerCase(); +>c : Symbol(c, Decl(main.ts, 5, 3)) +>a.getCls().y.toLowerCase : Symbol(String.toLowerCase, Decl(lib.d.ts, --, --)) +>a.getCls().y : Symbol(Cls.y, Decl(c.d.ts, 1, 15)) +>a.getCls : Symbol(A.getCls, Decl(d.ts, 16, 17)) +>a : Symbol(a, Decl(main.ts, 3, 3)) +>getCls : Symbol(A.getCls, Decl(d.ts, 16, 17)) +>y : Symbol(Cls.y, Decl(c.d.ts, 1, 15)) +>toLowerCase : Symbol(String.toLowerCase, Decl(lib.d.ts, --, --)) + diff --git a/tests/baselines/reference/moduleAugmentationsImports1.types b/tests/baselines/reference/moduleAugmentationsImports1.types new file mode 100644 index 00000000000..bf0bfee0a7a --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationsImports1.types @@ -0,0 +1,103 @@ +=== tests/cases/compiler/a.ts === + +export class A {} +>A : A + +=== tests/cases/compiler/b.ts === +export class B {x: number;} +>B : B +>x : number + +=== tests/cases/compiler/c.d.ts === +declare module "C" { + class Cls {y: string; } +>Cls : Cls +>y : string +} + +=== tests/cases/compiler/d.ts === +/// + +import {A} from "./a"; +>A : typeof A + +import {B} from "./b"; +>B : typeof B + +import {Cls} from "C"; +>Cls : typeof Cls + +A.prototype.getB = function () { return undefined; } +>A.prototype.getB = function () { return undefined; } : () => any +>A.prototype.getB : () => B +>A.prototype : A +>A : typeof A +>prototype : A +>getB : () => B +>function () { return undefined; } : () => any +>undefined : undefined + +A.prototype.getCls = function () { return undefined; } +>A.prototype.getCls = function () { return undefined; } : () => any +>A.prototype.getCls : () => Cls +>A.prototype : A +>A : typeof A +>prototype : A +>getCls : () => Cls +>function () { return undefined; } : () => any +>undefined : undefined + +declare module "./a" { + interface A { +>A : A + + getB(): B; +>getB : () => B +>B : B + } +} + +declare module "./a" { + interface A { +>A : A + + getCls(): Cls; +>getCls : () => Cls +>Cls : Cls + } +} + +=== tests/cases/compiler/main.ts === +import {A} from "./a"; +>A : typeof A + +import "d"; + +let a: A; +>a : A +>A : A + +let b = a.getB().x.toFixed(); +>b : string +>a.getB().x.toFixed() : string +>a.getB().x.toFixed : (fractionDigits?: number) => string +>a.getB().x : number +>a.getB() : B +>a.getB : () => B +>a : A +>getB : () => B +>x : number +>toFixed : (fractionDigits?: number) => string + +let c = a.getCls().y.toLowerCase(); +>c : string +>a.getCls().y.toLowerCase() : string +>a.getCls().y.toLowerCase : () => string +>a.getCls().y : string +>a.getCls() : Cls +>a.getCls : () => Cls +>a : A +>getCls : () => Cls +>y : string +>toLowerCase : () => string + diff --git a/tests/baselines/reference/moduleAugmentationsImports2.js b/tests/baselines/reference/moduleAugmentationsImports2.js new file mode 100644 index 00000000000..605a07e29e1 --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationsImports2.js @@ -0,0 +1,116 @@ +//// [tests/cases/compiler/moduleAugmentationsImports2.ts] //// + +//// [a.ts] + +export class A {} + +//// [b.ts] +export class B {x: number;} + +//// [c.d.ts] +declare module "C" { + class Cls {y: string; } +} + +//// [d.ts] +/// + +import {A} from "./a"; +import {B} from "./b"; + +A.prototype.getB = function () { return undefined; } + +declare module "./a" { + interface A { + getB(): B; + } +} + +//// [e.ts] +import {A} from "./a"; +import {Cls} from "C"; + +A.prototype.getCls = function () { return undefined; } + +declare module "./a" { + interface A { + getCls(): Cls; + } +} + +//// [main.ts] +import {A} from "./a"; +import "d"; +import "e"; + +let a: A; +let b = a.getB().x.toFixed(); +let c = a.getCls().y.toLowerCase(); + +//// [f.js] +define("a", ["require", "exports"], function (require, exports) { + "use strict"; + var A = (function () { + function A() { + } + return A; + }()); + exports.A = A; +}); +define("b", ["require", "exports"], function (require, exports) { + "use strict"; + var B = (function () { + function B() { + } + return B; + }()); + exports.B = B; +}); +/// +define("d", ["require", "exports", "a"], function (require, exports, a_1) { + "use strict"; + a_1.A.prototype.getB = function () { return undefined; }; +}); +define("e", ["require", "exports", "a"], function (require, exports, a_2) { + "use strict"; + a_2.A.prototype.getCls = function () { return undefined; }; +}); +define("main", ["require", "exports", "d", "e"], function (require, exports) { + "use strict"; + var a; + var b = a.getB().x.toFixed(); + var c = a.getCls().y.toLowerCase(); +}); + + +//// [f.d.ts] +/// +declare module "a" { + export class A { + } +} +declare module "b" { + export class B { + x: number; + } +} +declare module "d" { + import { B } from "b"; + module "a" { + interface A { + getB(): B; + } + } +} +declare module "e" { + import { Cls } from "C"; + module "a" { + interface A { + getCls(): Cls; + } + } +} +declare module "main" { + import "d"; + import "e"; +} diff --git a/tests/baselines/reference/moduleAugmentationsImports2.symbols b/tests/baselines/reference/moduleAugmentationsImports2.symbols new file mode 100644 index 00000000000..126e407da8a --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationsImports2.symbols @@ -0,0 +1,100 @@ +=== tests/cases/compiler/a.ts === + +export class A {} +>A : Symbol(A, Decl(a.ts, 0, 0), Decl(d.ts, 7, 22), Decl(e.ts, 5, 22)) + +=== tests/cases/compiler/b.ts === +export class B {x: number;} +>B : Symbol(B, Decl(b.ts, 0, 0)) +>x : Symbol(B.x, Decl(b.ts, 0, 16)) + +=== tests/cases/compiler/c.d.ts === +declare module "C" { + class Cls {y: string; } +>Cls : Symbol(Cls, Decl(c.d.ts, 0, 20)) +>y : Symbol(Cls.y, Decl(c.d.ts, 1, 15)) +} + +=== tests/cases/compiler/d.ts === +/// + +import {A} from "./a"; +>A : Symbol(A, Decl(d.ts, 2, 8)) + +import {B} from "./b"; +>B : Symbol(B, Decl(d.ts, 3, 8)) + +A.prototype.getB = function () { return undefined; } +>A.prototype.getB : Symbol(A.getB, Decl(d.ts, 8, 17)) +>A.prototype : Symbol(A.prototype) +>A : Symbol(A, Decl(d.ts, 2, 8)) +>prototype : Symbol(A.prototype) +>getB : Symbol(A.getB, Decl(d.ts, 8, 17)) +>undefined : Symbol(undefined) + +declare module "./a" { + interface A { +>A : Symbol(A, Decl(a.ts, 0, 0), Decl(d.ts, 7, 22), Decl(e.ts, 5, 22)) + + getB(): B; +>getB : Symbol(A.getB, Decl(d.ts, 8, 17)) +>B : Symbol(B, Decl(d.ts, 3, 8)) + } +} + +=== tests/cases/compiler/e.ts === +import {A} from "./a"; +>A : Symbol(A, Decl(e.ts, 0, 8)) + +import {Cls} from "C"; +>Cls : Symbol(Cls, Decl(e.ts, 1, 8)) + +A.prototype.getCls = function () { return undefined; } +>A.prototype.getCls : Symbol(A.getCls, Decl(e.ts, 6, 17)) +>A.prototype : Symbol(A.prototype) +>A : Symbol(A, Decl(e.ts, 0, 8)) +>prototype : Symbol(A.prototype) +>getCls : Symbol(A.getCls, Decl(e.ts, 6, 17)) +>undefined : Symbol(undefined) + +declare module "./a" { + interface A { +>A : Symbol(A, Decl(a.ts, 0, 0), Decl(d.ts, 7, 22), Decl(e.ts, 5, 22)) + + getCls(): Cls; +>getCls : Symbol(A.getCls, Decl(e.ts, 6, 17)) +>Cls : Symbol(Cls, Decl(e.ts, 1, 8)) + } +} + +=== tests/cases/compiler/main.ts === +import {A} from "./a"; +>A : Symbol(A, Decl(main.ts, 0, 8)) + +import "d"; +import "e"; + +let a: A; +>a : Symbol(a, Decl(main.ts, 4, 3)) +>A : Symbol(A, Decl(main.ts, 0, 8)) + +let b = a.getB().x.toFixed(); +>b : Symbol(b, Decl(main.ts, 5, 3)) +>a.getB().x.toFixed : Symbol(Number.toFixed, Decl(lib.d.ts, --, --)) +>a.getB().x : Symbol(B.x, Decl(b.ts, 0, 16)) +>a.getB : Symbol(A.getB, Decl(d.ts, 8, 17)) +>a : Symbol(a, Decl(main.ts, 4, 3)) +>getB : Symbol(A.getB, Decl(d.ts, 8, 17)) +>x : Symbol(B.x, Decl(b.ts, 0, 16)) +>toFixed : Symbol(Number.toFixed, Decl(lib.d.ts, --, --)) + +let c = a.getCls().y.toLowerCase(); +>c : Symbol(c, Decl(main.ts, 6, 3)) +>a.getCls().y.toLowerCase : Symbol(String.toLowerCase, Decl(lib.d.ts, --, --)) +>a.getCls().y : Symbol(Cls.y, Decl(c.d.ts, 1, 15)) +>a.getCls : Symbol(A.getCls, Decl(e.ts, 6, 17)) +>a : Symbol(a, Decl(main.ts, 4, 3)) +>getCls : Symbol(A.getCls, Decl(e.ts, 6, 17)) +>y : Symbol(Cls.y, Decl(c.d.ts, 1, 15)) +>toLowerCase : Symbol(String.toLowerCase, Decl(lib.d.ts, --, --)) + diff --git a/tests/baselines/reference/moduleAugmentationsImports2.types b/tests/baselines/reference/moduleAugmentationsImports2.types new file mode 100644 index 00000000000..56b40625600 --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationsImports2.types @@ -0,0 +1,108 @@ +=== tests/cases/compiler/a.ts === + +export class A {} +>A : A + +=== tests/cases/compiler/b.ts === +export class B {x: number;} +>B : B +>x : number + +=== tests/cases/compiler/c.d.ts === +declare module "C" { + class Cls {y: string; } +>Cls : Cls +>y : string +} + +=== tests/cases/compiler/d.ts === +/// + +import {A} from "./a"; +>A : typeof A + +import {B} from "./b"; +>B : typeof B + +A.prototype.getB = function () { return undefined; } +>A.prototype.getB = function () { return undefined; } : () => any +>A.prototype.getB : () => B +>A.prototype : A +>A : typeof A +>prototype : A +>getB : () => B +>function () { return undefined; } : () => any +>undefined : undefined + +declare module "./a" { + interface A { +>A : A + + getB(): B; +>getB : () => B +>B : B + } +} + +=== tests/cases/compiler/e.ts === +import {A} from "./a"; +>A : typeof A + +import {Cls} from "C"; +>Cls : typeof Cls + +A.prototype.getCls = function () { return undefined; } +>A.prototype.getCls = function () { return undefined; } : () => any +>A.prototype.getCls : () => Cls +>A.prototype : A +>A : typeof A +>prototype : A +>getCls : () => Cls +>function () { return undefined; } : () => any +>undefined : undefined + +declare module "./a" { + interface A { +>A : A + + getCls(): Cls; +>getCls : () => Cls +>Cls : Cls + } +} + +=== tests/cases/compiler/main.ts === +import {A} from "./a"; +>A : typeof A + +import "d"; +import "e"; + +let a: A; +>a : A +>A : A + +let b = a.getB().x.toFixed(); +>b : string +>a.getB().x.toFixed() : string +>a.getB().x.toFixed : (fractionDigits?: number) => string +>a.getB().x : number +>a.getB() : B +>a.getB : () => B +>a : A +>getB : () => B +>x : number +>toFixed : (fractionDigits?: number) => string + +let c = a.getCls().y.toLowerCase(); +>c : string +>a.getCls().y.toLowerCase() : string +>a.getCls().y.toLowerCase : () => string +>a.getCls().y : string +>a.getCls() : Cls +>a.getCls : () => Cls +>a : A +>getCls : () => Cls +>y : string +>toLowerCase : () => string + diff --git a/tests/baselines/reference/moduleAugmentationsImports3.js b/tests/baselines/reference/moduleAugmentationsImports3.js new file mode 100644 index 00000000000..0a946f42be3 --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationsImports3.js @@ -0,0 +1,103 @@ +//// [tests/cases/compiler/moduleAugmentationsImports3.ts] //// + +//// [a.ts] + +export class A {} + +//// [b.ts] +export class B {x: number;} + +//// [c.d.ts] +declare module "C" { + class Cls {y: string; } +} + +//// [d.d.ts] +declare module "D" { + import {A} from "a"; + import {B} from "b"; + module "a" { + interface A { + getB(): B; + } + } +} + +//// [e.ts] +/// +import {A} from "./a"; +import {Cls} from "C"; + +A.prototype.getCls = function () { return undefined; } + +declare module "./a" { + interface A { + getCls(): Cls; + } +} + +//// [main.ts] +/// +import {A} from "./a"; +import "D"; +import "e"; + +let a: A; +let b = a.getB().x.toFixed(); +let c = a.getCls().y.toLowerCase(); + +//// [f.js] +define("a", ["require", "exports"], function (require, exports) { + "use strict"; + var A = (function () { + function A() { + } + return A; + }()); + exports.A = A; +}); +define("b", ["require", "exports"], function (require, exports) { + "use strict"; + var B = (function () { + function B() { + } + return B; + }()); + exports.B = B; +}); +define("e", ["require", "exports", "a"], function (require, exports, a_1) { + "use strict"; + a_1.A.prototype.getCls = function () { return undefined; }; +}); +define("main", ["require", "exports", "D", "e"], function (require, exports) { + "use strict"; + var a; + var b = a.getB().x.toFixed(); + var c = a.getCls().y.toLowerCase(); +}); + + +//// [f.d.ts] +/// +/// +declare module "a" { + export class A { + } +} +declare module "b" { + export class B { + x: number; + } +} +declare module "e" { + import { Cls } from "C"; + module "a" { + interface A { + getCls(): Cls; + } + } +} +declare module "main" { + import "D"; + import "e"; +} diff --git a/tests/baselines/reference/moduleAugmentationsImports3.symbols b/tests/baselines/reference/moduleAugmentationsImports3.symbols new file mode 100644 index 00000000000..fba58ffad8a --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationsImports3.symbols @@ -0,0 +1,94 @@ +=== tests/cases/compiler/main.ts === +/// +import {A} from "./a"; +>A : Symbol(A, Decl(main.ts, 1, 8)) + +import "D"; +import "e"; + +let a: A; +>a : Symbol(a, Decl(main.ts, 5, 3)) +>A : Symbol(A, Decl(main.ts, 1, 8)) + +let b = a.getB().x.toFixed(); +>b : Symbol(b, Decl(main.ts, 6, 3)) +>a.getB().x.toFixed : Symbol(Number.toFixed, Decl(lib.d.ts, --, --)) +>a.getB().x : Symbol(B.x, Decl(b.ts, 0, 16)) +>a.getB : Symbol(A.getB, Decl(d.d.ts, 4, 21)) +>a : Symbol(a, Decl(main.ts, 5, 3)) +>getB : Symbol(A.getB, Decl(d.d.ts, 4, 21)) +>x : Symbol(B.x, Decl(b.ts, 0, 16)) +>toFixed : Symbol(Number.toFixed, Decl(lib.d.ts, --, --)) + +let c = a.getCls().y.toLowerCase(); +>c : Symbol(c, Decl(main.ts, 7, 3)) +>a.getCls().y.toLowerCase : Symbol(String.toLowerCase, Decl(lib.d.ts, --, --)) +>a.getCls().y : Symbol(Cls.y, Decl(c.d.ts, 1, 15)) +>a.getCls : Symbol(A.getCls, Decl(e.ts, 7, 17)) +>a : Symbol(a, Decl(main.ts, 5, 3)) +>getCls : Symbol(A.getCls, Decl(e.ts, 7, 17)) +>y : Symbol(Cls.y, Decl(c.d.ts, 1, 15)) +>toLowerCase : Symbol(String.toLowerCase, Decl(lib.d.ts, --, --)) + +=== tests/cases/compiler/a.ts === + +export class A {} +>A : Symbol(A, Decl(a.ts, 0, 0), Decl(d.d.ts, 3, 16), Decl(e.ts, 6, 22)) + +=== tests/cases/compiler/b.ts === +export class B {x: number;} +>B : Symbol(B, Decl(b.ts, 0, 0)) +>x : Symbol(B.x, Decl(b.ts, 0, 16)) + +=== tests/cases/compiler/c.d.ts === +declare module "C" { + class Cls {y: string; } +>Cls : Symbol(Cls, Decl(c.d.ts, 0, 20)) +>y : Symbol(Cls.y, Decl(c.d.ts, 1, 15)) +} + +=== tests/cases/compiler/d.d.ts === +declare module "D" { + import {A} from "a"; +>A : Symbol(A, Decl(d.d.ts, 1, 12)) + + import {B} from "b"; +>B : Symbol(B, Decl(d.d.ts, 2, 12)) + + module "a" { + interface A { +>A : Symbol(A, Decl(a.ts, 0, 0), Decl(d.d.ts, 3, 16), Decl(e.ts, 6, 22)) + + getB(): B; +>getB : Symbol(A.getB, Decl(d.d.ts, 4, 21)) +>B : Symbol(B, Decl(d.d.ts, 2, 12)) + } + } +} + +=== tests/cases/compiler/e.ts === +/// +import {A} from "./a"; +>A : Symbol(A, Decl(e.ts, 1, 8)) + +import {Cls} from "C"; +>Cls : Symbol(Cls, Decl(e.ts, 2, 8)) + +A.prototype.getCls = function () { return undefined; } +>A.prototype.getCls : Symbol(A.getCls, Decl(e.ts, 7, 17)) +>A.prototype : Symbol(A.prototype) +>A : Symbol(A, Decl(e.ts, 1, 8)) +>prototype : Symbol(A.prototype) +>getCls : Symbol(A.getCls, Decl(e.ts, 7, 17)) +>undefined : Symbol(undefined) + +declare module "./a" { + interface A { +>A : Symbol(A, Decl(a.ts, 0, 0), Decl(d.d.ts, 3, 16), Decl(e.ts, 6, 22)) + + getCls(): Cls; +>getCls : Symbol(A.getCls, Decl(e.ts, 7, 17)) +>Cls : Symbol(Cls, Decl(e.ts, 2, 8)) + } +} + diff --git a/tests/baselines/reference/moduleAugmentationsImports3.types b/tests/baselines/reference/moduleAugmentationsImports3.types new file mode 100644 index 00000000000..04d17296c56 --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationsImports3.types @@ -0,0 +1,100 @@ +=== tests/cases/compiler/main.ts === +/// +import {A} from "./a"; +>A : typeof A + +import "D"; +import "e"; + +let a: A; +>a : A +>A : A + +let b = a.getB().x.toFixed(); +>b : string +>a.getB().x.toFixed() : string +>a.getB().x.toFixed : (fractionDigits?: number) => string +>a.getB().x : number +>a.getB() : B +>a.getB : () => B +>a : A +>getB : () => B +>x : number +>toFixed : (fractionDigits?: number) => string + +let c = a.getCls().y.toLowerCase(); +>c : string +>a.getCls().y.toLowerCase() : string +>a.getCls().y.toLowerCase : () => string +>a.getCls().y : string +>a.getCls() : Cls +>a.getCls : () => Cls +>a : A +>getCls : () => Cls +>y : string +>toLowerCase : () => string + +=== tests/cases/compiler/a.ts === + +export class A {} +>A : A + +=== tests/cases/compiler/b.ts === +export class B {x: number;} +>B : B +>x : number + +=== tests/cases/compiler/c.d.ts === +declare module "C" { + class Cls {y: string; } +>Cls : Cls +>y : string +} + +=== tests/cases/compiler/d.d.ts === +declare module "D" { + import {A} from "a"; +>A : typeof A + + import {B} from "b"; +>B : typeof B + + module "a" { + interface A { +>A : A + + getB(): B; +>getB : () => B +>B : B + } + } +} + +=== tests/cases/compiler/e.ts === +/// +import {A} from "./a"; +>A : typeof A + +import {Cls} from "C"; +>Cls : typeof Cls + +A.prototype.getCls = function () { return undefined; } +>A.prototype.getCls = function () { return undefined; } : () => any +>A.prototype.getCls : () => Cls +>A.prototype : A +>A : typeof A +>prototype : A +>getCls : () => Cls +>function () { return undefined; } : () => any +>undefined : undefined + +declare module "./a" { + interface A { +>A : A + + getCls(): Cls; +>getCls : () => Cls +>Cls : Cls + } +} + diff --git a/tests/baselines/reference/moduleAugmentationsImports4.js b/tests/baselines/reference/moduleAugmentationsImports4.js new file mode 100644 index 00000000000..a48bbb04631 --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationsImports4.js @@ -0,0 +1,92 @@ +//// [tests/cases/compiler/moduleAugmentationsImports4.ts] //// + +//// [a.ts] + +export class A {} + +//// [b.ts] +export class B {x: number;} + +//// [c.d.ts] +declare module "C" { + class Cls {y: string; } +} + +//// [d.d.ts] +declare module "D" { + import {A} from "a"; + import {B} from "b"; + module "a" { + interface A { + getB(): B; + } + } +} + +//// [e.d.ts] +/// +declare module "E" { + import {A} from "a"; + import {Cls} from "C"; + + module "a" { + interface A { + getCls(): Cls; + } + } +} + +//// [main.ts] +/// +/// +import {A} from "./a"; +import "D"; +import "E"; + +let a: A; +let b = a.getB().x.toFixed(); +let c = a.getCls().y.toLowerCase(); + +//// [f.js] +define("a", ["require", "exports"], function (require, exports) { + "use strict"; + var A = (function () { + function A() { + } + return A; + }()); + exports.A = A; +}); +define("b", ["require", "exports"], function (require, exports) { + "use strict"; + var B = (function () { + function B() { + } + return B; + }()); + exports.B = B; +}); +define("main", ["require", "exports", "D", "E"], function (require, exports) { + "use strict"; + var a; + var b = a.getB().x.toFixed(); + var c = a.getCls().y.toLowerCase(); +}); + + +//// [f.d.ts] +/// +/// +declare module "a" { + export class A { + } +} +declare module "b" { + export class B { + x: number; + } +} +declare module "main" { + import "D"; + import "E"; +} diff --git a/tests/baselines/reference/moduleAugmentationsImports4.symbols b/tests/baselines/reference/moduleAugmentationsImports4.symbols new file mode 100644 index 00000000000..77b5431850e --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationsImports4.symbols @@ -0,0 +1,89 @@ +=== tests/cases/compiler/main.ts === +/// +/// +import {A} from "./a"; +>A : Symbol(A, Decl(main.ts, 2, 8)) + +import "D"; +import "E"; + +let a: A; +>a : Symbol(a, Decl(main.ts, 6, 3)) +>A : Symbol(A, Decl(main.ts, 2, 8)) + +let b = a.getB().x.toFixed(); +>b : Symbol(b, Decl(main.ts, 7, 3)) +>a.getB().x.toFixed : Symbol(Number.toFixed, Decl(lib.d.ts, --, --)) +>a.getB().x : Symbol(B.x, Decl(b.ts, 0, 16)) +>a.getB : Symbol(A.getB, Decl(d.d.ts, 4, 21)) +>a : Symbol(a, Decl(main.ts, 6, 3)) +>getB : Symbol(A.getB, Decl(d.d.ts, 4, 21)) +>x : Symbol(B.x, Decl(b.ts, 0, 16)) +>toFixed : Symbol(Number.toFixed, Decl(lib.d.ts, --, --)) + +let c = a.getCls().y.toLowerCase(); +>c : Symbol(c, Decl(main.ts, 8, 3)) +>a.getCls().y.toLowerCase : Symbol(String.toLowerCase, Decl(lib.d.ts, --, --)) +>a.getCls().y : Symbol(Cls.y, Decl(c.d.ts, 1, 15)) +>a.getCls : Symbol(A.getCls, Decl(e.d.ts, 6, 21)) +>a : Symbol(a, Decl(main.ts, 6, 3)) +>getCls : Symbol(A.getCls, Decl(e.d.ts, 6, 21)) +>y : Symbol(Cls.y, Decl(c.d.ts, 1, 15)) +>toLowerCase : Symbol(String.toLowerCase, Decl(lib.d.ts, --, --)) + +=== tests/cases/compiler/a.ts === + +export class A {} +>A : Symbol(A, Decl(a.ts, 0, 0), Decl(d.d.ts, 3, 16), Decl(e.d.ts, 5, 16)) + +=== tests/cases/compiler/b.ts === +export class B {x: number;} +>B : Symbol(B, Decl(b.ts, 0, 0)) +>x : Symbol(B.x, Decl(b.ts, 0, 16)) + +=== tests/cases/compiler/c.d.ts === +declare module "C" { + class Cls {y: string; } +>Cls : Symbol(Cls, Decl(c.d.ts, 0, 20)) +>y : Symbol(Cls.y, Decl(c.d.ts, 1, 15)) +} + +=== tests/cases/compiler/d.d.ts === +declare module "D" { + import {A} from "a"; +>A : Symbol(A, Decl(d.d.ts, 1, 12)) + + import {B} from "b"; +>B : Symbol(B, Decl(d.d.ts, 2, 12)) + + module "a" { + interface A { +>A : Symbol(A, Decl(a.ts, 0, 0), Decl(d.d.ts, 3, 16), Decl(e.d.ts, 5, 16)) + + getB(): B; +>getB : Symbol(A.getB, Decl(d.d.ts, 4, 21)) +>B : Symbol(B, Decl(d.d.ts, 2, 12)) + } + } +} + +=== tests/cases/compiler/e.d.ts === +/// +declare module "E" { + import {A} from "a"; +>A : Symbol(A, Decl(e.d.ts, 2, 12)) + + import {Cls} from "C"; +>Cls : Symbol(Cls, Decl(e.d.ts, 3, 12)) + + module "a" { + interface A { +>A : Symbol(A, Decl(a.ts, 0, 0), Decl(d.d.ts, 3, 16), Decl(e.d.ts, 5, 16)) + + getCls(): Cls; +>getCls : Symbol(A.getCls, Decl(e.d.ts, 6, 21)) +>Cls : Symbol(Cls, Decl(e.d.ts, 3, 12)) + } + } +} + diff --git a/tests/baselines/reference/moduleAugmentationsImports4.types b/tests/baselines/reference/moduleAugmentationsImports4.types new file mode 100644 index 00000000000..53d570e14e6 --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationsImports4.types @@ -0,0 +1,93 @@ +=== tests/cases/compiler/main.ts === +/// +/// +import {A} from "./a"; +>A : typeof A + +import "D"; +import "E"; + +let a: A; +>a : A +>A : A + +let b = a.getB().x.toFixed(); +>b : string +>a.getB().x.toFixed() : string +>a.getB().x.toFixed : (fractionDigits?: number) => string +>a.getB().x : number +>a.getB() : B +>a.getB : () => B +>a : A +>getB : () => B +>x : number +>toFixed : (fractionDigits?: number) => string + +let c = a.getCls().y.toLowerCase(); +>c : string +>a.getCls().y.toLowerCase() : string +>a.getCls().y.toLowerCase : () => string +>a.getCls().y : string +>a.getCls() : Cls +>a.getCls : () => Cls +>a : A +>getCls : () => Cls +>y : string +>toLowerCase : () => string + +=== tests/cases/compiler/a.ts === + +export class A {} +>A : A + +=== tests/cases/compiler/b.ts === +export class B {x: number;} +>B : B +>x : number + +=== tests/cases/compiler/c.d.ts === +declare module "C" { + class Cls {y: string; } +>Cls : Cls +>y : string +} + +=== tests/cases/compiler/d.d.ts === +declare module "D" { + import {A} from "a"; +>A : typeof A + + import {B} from "b"; +>B : typeof B + + module "a" { + interface A { +>A : A + + getB(): B; +>getB : () => B +>B : B + } + } +} + +=== tests/cases/compiler/e.d.ts === +/// +declare module "E" { + import {A} from "a"; +>A : typeof A + + import {Cls} from "C"; +>Cls : typeof Cls + + module "a" { + interface A { +>A : A + + getCls(): Cls; +>getCls : () => Cls +>Cls : Cls + } + } +} + diff --git a/tests/baselines/reference/moduleCodeGenTest5.symbols b/tests/baselines/reference/moduleCodeGenTest5.symbols index 1e68d449665..f93e8ef6297 100644 --- a/tests/baselines/reference/moduleCodeGenTest5.symbols +++ b/tests/baselines/reference/moduleCodeGenTest5.symbols @@ -15,19 +15,19 @@ export class C1 { >C1 : Symbol(C1, Decl(moduleCodeGenTest5.ts, 4, 16)) public p1 = 0; ->p1 : Symbol(p1, Decl(moduleCodeGenTest5.ts, 6, 17)) +>p1 : Symbol(C1.p1, Decl(moduleCodeGenTest5.ts, 6, 17)) public p2() {} ->p2 : Symbol(p2, Decl(moduleCodeGenTest5.ts, 7, 15)) +>p2 : Symbol(C1.p2, Decl(moduleCodeGenTest5.ts, 7, 15)) } class C2{ >C2 : Symbol(C2, Decl(moduleCodeGenTest5.ts, 9, 1)) public p1 = 0; ->p1 : Symbol(p1, Decl(moduleCodeGenTest5.ts, 10, 9)) +>p1 : Symbol(C2.p1, Decl(moduleCodeGenTest5.ts, 10, 9)) public p2() {} ->p2 : Symbol(p2, Decl(moduleCodeGenTest5.ts, 11, 15)) +>p2 : Symbol(C2.p2, Decl(moduleCodeGenTest5.ts, 11, 15)) } export enum E1 {A=0} diff --git a/tests/baselines/reference/moduleElementsInWrongContext.js b/tests/baselines/reference/moduleElementsInWrongContext.js index 26fd511a955..0f898ce3818 100644 --- a/tests/baselines/reference/moduleElementsInWrongContext.js +++ b/tests/baselines/reference/moduleElementsInWrongContext.js @@ -34,6 +34,8 @@ { var v; function foo() { } + var ambient_2 = require("ambient"); + exports.b = ambient_2.baz; exports["default"] = v; var C = (function () { function C() { diff --git a/tests/baselines/reference/moduleElementsInWrongContext2.js b/tests/baselines/reference/moduleElementsInWrongContext2.js index 24fccc02dc5..f5810d15dc7 100644 --- a/tests/baselines/reference/moduleElementsInWrongContext2.js +++ b/tests/baselines/reference/moduleElementsInWrongContext2.js @@ -34,6 +34,8 @@ function blah () { function blah() { var v; function foo() { } + var ambient_2 = require("ambient"); + exports.b = ambient_2.baz; exports["default"] = v; var C = (function () { function C() { diff --git a/tests/baselines/reference/moduleElementsInWrongContext3.js b/tests/baselines/reference/moduleElementsInWrongContext3.js index c5c0d491cd3..11e3637041a 100644 --- a/tests/baselines/reference/moduleElementsInWrongContext3.js +++ b/tests/baselines/reference/moduleElementsInWrongContext3.js @@ -37,6 +37,8 @@ var P; { var v; function foo() { } + var ambient_2 = require("ambient"); + P.b = ambient_2.baz; P["default"] = v; var C = (function () { function C() { diff --git a/tests/baselines/reference/moduleIdentifiers.symbols b/tests/baselines/reference/moduleIdentifiers.symbols index ffb3ffa7335..1edbf333875 100644 --- a/tests/baselines/reference/moduleIdentifiers.symbols +++ b/tests/baselines/reference/moduleIdentifiers.symbols @@ -4,8 +4,8 @@ module M { interface P { x: number; y: number; } >P : Symbol(P, Decl(moduleIdentifiers.ts, 0, 10)) ->x : Symbol(x, Decl(moduleIdentifiers.ts, 1, 17)) ->y : Symbol(y, Decl(moduleIdentifiers.ts, 1, 28)) +>x : Symbol(P.x, Decl(moduleIdentifiers.ts, 1, 17)) +>y : Symbol(P.y, Decl(moduleIdentifiers.ts, 1, 28)) export var a = 1 >a : Symbol(a, Decl(moduleIdentifiers.ts, 2, 14)) diff --git a/tests/baselines/reference/moduleMemberWithoutTypeAnnotation1.symbols b/tests/baselines/reference/moduleMemberWithoutTypeAnnotation1.symbols index fb743ea4f57..de787349442 100644 --- a/tests/baselines/reference/moduleMemberWithoutTypeAnnotation1.symbols +++ b/tests/baselines/reference/moduleMemberWithoutTypeAnnotation1.symbols @@ -7,7 +7,7 @@ module TypeScript.Parser { >SyntaxCursor : Symbol(SyntaxCursor, Decl(moduleMemberWithoutTypeAnnotation1.ts, 0, 26)) public currentNode(): SyntaxNode { ->currentNode : Symbol(currentNode, Decl(moduleMemberWithoutTypeAnnotation1.ts, 1, 24)) +>currentNode : Symbol(SyntaxCursor.currentNode, Decl(moduleMemberWithoutTypeAnnotation1.ts, 1, 24)) >SyntaxNode : Symbol(SyntaxNode, Decl(moduleMemberWithoutTypeAnnotation1.ts, 24, 19)) return null; @@ -28,7 +28,7 @@ module TypeScript { >PositionedElement : Symbol(PositionedElement, Decl(moduleMemberWithoutTypeAnnotation1.ts, 10, 38)) public childIndex(child: ISyntaxElement) { ->childIndex : Symbol(childIndex, Decl(moduleMemberWithoutTypeAnnotation1.ts, 12, 36)) +>childIndex : Symbol(PositionedElement.childIndex, Decl(moduleMemberWithoutTypeAnnotation1.ts, 12, 36)) >child : Symbol(child, Decl(moduleMemberWithoutTypeAnnotation1.ts, 13, 26)) >ISyntaxElement : Symbol(ISyntaxElement, Decl(moduleMemberWithoutTypeAnnotation1.ts, 8, 19)) @@ -59,22 +59,22 @@ module TypeScript { >SyntaxNode : Symbol(SyntaxNode, Decl(moduleMemberWithoutTypeAnnotation1.ts, 24, 19)) public findToken(position: number, includeSkippedTokens: boolean = false): PositionedToken { ->findToken : Symbol(findToken, Decl(moduleMemberWithoutTypeAnnotation1.ts, 25, 29)) +>findToken : Symbol(SyntaxNode.findToken, Decl(moduleMemberWithoutTypeAnnotation1.ts, 25, 29)) >position : Symbol(position, Decl(moduleMemberWithoutTypeAnnotation1.ts, 26, 25)) >includeSkippedTokens : Symbol(includeSkippedTokens, Decl(moduleMemberWithoutTypeAnnotation1.ts, 26, 42)) >PositionedToken : Symbol(PositionedToken, Decl(moduleMemberWithoutTypeAnnotation1.ts, 16, 5)) var positionedToken = this.findTokenInternal(null, position, 0); >positionedToken : Symbol(positionedToken, Decl(moduleMemberWithoutTypeAnnotation1.ts, 27, 15)) ->this.findTokenInternal : Symbol(findTokenInternal, Decl(moduleMemberWithoutTypeAnnotation1.ts, 29, 9)) +>this.findTokenInternal : Symbol(SyntaxNode.findTokenInternal, Decl(moduleMemberWithoutTypeAnnotation1.ts, 29, 9)) >this : Symbol(SyntaxNode, Decl(moduleMemberWithoutTypeAnnotation1.ts, 24, 19)) ->findTokenInternal : Symbol(findTokenInternal, Decl(moduleMemberWithoutTypeAnnotation1.ts, 29, 9)) +>findTokenInternal : Symbol(SyntaxNode.findTokenInternal, Decl(moduleMemberWithoutTypeAnnotation1.ts, 29, 9)) >position : Symbol(position, Decl(moduleMemberWithoutTypeAnnotation1.ts, 26, 25)) return null; } findTokenInternal(x, y, z) { ->findTokenInternal : Symbol(findTokenInternal, Decl(moduleMemberWithoutTypeAnnotation1.ts, 29, 9)) +>findTokenInternal : Symbol(SyntaxNode.findTokenInternal, Decl(moduleMemberWithoutTypeAnnotation1.ts, 29, 9)) >x : Symbol(x, Decl(moduleMemberWithoutTypeAnnotation1.ts, 30, 26)) >y : Symbol(y, Decl(moduleMemberWithoutTypeAnnotation1.ts, 30, 28)) >z : Symbol(z, Decl(moduleMemberWithoutTypeAnnotation1.ts, 30, 31)) @@ -96,7 +96,7 @@ module TypeScript.Syntax { >ISyntaxToken : Symbol(ISyntaxToken, Decl(moduleMemberWithoutTypeAnnotation1.ts, 9, 40)) private findTokenInternal(parent: PositionedElement, position: number, fullStart: number) { ->findTokenInternal : Symbol(findTokenInternal, Decl(moduleMemberWithoutTypeAnnotation1.ts, 39, 79)) +>findTokenInternal : Symbol(VariableWidthTokenWithTrailingTrivia.findTokenInternal, Decl(moduleMemberWithoutTypeAnnotation1.ts, 39, 79)) >parent : Symbol(parent, Decl(moduleMemberWithoutTypeAnnotation1.ts, 40, 34)) >PositionedElement : Symbol(PositionedElement, Decl(moduleMemberWithoutTypeAnnotation1.ts, 10, 38)) >position : Symbol(position, Decl(moduleMemberWithoutTypeAnnotation1.ts, 40, 60)) diff --git a/tests/baselines/reference/moduleMemberWithoutTypeAnnotation2.symbols b/tests/baselines/reference/moduleMemberWithoutTypeAnnotation2.symbols index e69b8c37458..f771bbc3c79 100644 --- a/tests/baselines/reference/moduleMemberWithoutTypeAnnotation2.symbols +++ b/tests/baselines/reference/moduleMemberWithoutTypeAnnotation2.symbols @@ -9,7 +9,7 @@ module TypeScript { >IDiagnosticWriter : Symbol(IDiagnosticWriter, Decl(moduleMemberWithoutTypeAnnotation2.ts, 1, 39)) Alert(output: string): void; ->Alert : Symbol(Alert, Decl(moduleMemberWithoutTypeAnnotation2.ts, 3, 44)) +>Alert : Symbol(IDiagnosticWriter.Alert, Decl(moduleMemberWithoutTypeAnnotation2.ts, 3, 44)) >output : Symbol(output, Decl(moduleMemberWithoutTypeAnnotation2.ts, 4, 18)) } diff --git a/tests/baselines/reference/moduleMerge.symbols b/tests/baselines/reference/moduleMerge.symbols index 2c288be6ff6..738aedfc28e 100644 --- a/tests/baselines/reference/moduleMerge.symbols +++ b/tests/baselines/reference/moduleMerge.symbols @@ -8,7 +8,7 @@ module A >B : Symbol(B, Decl(moduleMerge.ts, 3, 1)) { public Hello(): string ->Hello : Symbol(Hello, Decl(moduleMerge.ts, 5, 5)) +>Hello : Symbol(B.Hello, Decl(moduleMerge.ts, 5, 5)) { return "from private B"; } @@ -22,7 +22,7 @@ module A >B : Symbol(B, Decl(moduleMerge.ts, 14, 1)) { public Hello(): string ->Hello : Symbol(Hello, Decl(moduleMerge.ts, 16, 5)) +>Hello : Symbol(B.Hello, Decl(moduleMerge.ts, 16, 5)) { return "from export B"; } diff --git a/tests/baselines/reference/moduleMergeConstructor.symbols b/tests/baselines/reference/moduleMergeConstructor.symbols index a960ad07e7e..8d9a773f144 100644 --- a/tests/baselines/reference/moduleMergeConstructor.symbols +++ b/tests/baselines/reference/moduleMergeConstructor.symbols @@ -6,7 +6,7 @@ declare module "foo" { constructor(); method1(): any; ->method1 : Symbol(method1, Decl(foo.d.ts, 3, 22)) +>method1 : Symbol(Foo.method1, Decl(foo.d.ts, 3, 22)) } } @@ -16,7 +16,7 @@ declare module "foo" { >Foo : Symbol(Foo, Decl(foo.d.ts, 1, 22), Decl(foo-ext.d.ts, 0, 22)) method2(): any; ->method2 : Symbol(method2, Decl(foo-ext.d.ts, 1, 26)) +>method2 : Symbol(Foo.method2, Decl(foo-ext.d.ts, 1, 26)) } } @@ -28,15 +28,15 @@ class Test { >Test : Symbol(Test, Decl(index.ts, 0, 27)) bar: foo.Foo; ->bar : Symbol(bar, Decl(index.ts, 2, 12)) +>bar : Symbol(Test.bar, Decl(index.ts, 2, 12)) >foo : Symbol(foo, Decl(index.ts, 0, 6)) >Foo : Symbol(foo.Foo, Decl(foo.d.ts, 1, 22), Decl(foo-ext.d.ts, 0, 22)) constructor() { this.bar = new foo.Foo(); ->this.bar : Symbol(bar, Decl(index.ts, 2, 12)) +>this.bar : Symbol(Test.bar, Decl(index.ts, 2, 12)) >this : Symbol(Test, Decl(index.ts, 0, 27)) ->bar : Symbol(bar, Decl(index.ts, 2, 12)) +>bar : Symbol(Test.bar, Decl(index.ts, 2, 12)) >foo.Foo : Symbol(foo.Foo, Decl(foo.d.ts, 1, 22), Decl(foo-ext.d.ts, 0, 22)) >foo : Symbol(foo, Decl(index.ts, 0, 6)) >Foo : Symbol(foo.Foo, Decl(foo.d.ts, 1, 22), Decl(foo-ext.d.ts, 0, 22)) diff --git a/tests/baselines/reference/moduleNoneErrors.errors.txt b/tests/baselines/reference/moduleNoneErrors.errors.txt new file mode 100644 index 00000000000..cb943050fa8 --- /dev/null +++ b/tests/baselines/reference/moduleNoneErrors.errors.txt @@ -0,0 +1,10 @@ +tests/cases/compiler/a.ts(1,14): error TS1148: Cannot compile modules unless the '--module' flag is provided with a valid module type. Consider setting the 'module' compiler option in a 'tsconfig.json' file. + + +==== tests/cases/compiler/a.ts (1 errors) ==== + export class Foo { + ~~~ +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided with a valid module type. Consider setting the 'module' compiler option in a 'tsconfig.json' file. + foo: string; + } + \ No newline at end of file diff --git a/tests/baselines/reference/moduleNoneErrors.js b/tests/baselines/reference/moduleNoneErrors.js new file mode 100644 index 00000000000..c18f11d24b3 --- /dev/null +++ b/tests/baselines/reference/moduleNoneErrors.js @@ -0,0 +1,14 @@ +//// [a.ts] +export class Foo { + foo: string; +} + + +//// [a.js] +"use strict"; +var Foo = (function () { + function Foo() { + } + return Foo; +}()); +exports.Foo = Foo; diff --git a/tests/baselines/reference/modulePrologueSystem.js b/tests/baselines/reference/modulePrologueSystem.js index 04519898166..13f7d35b001 100644 --- a/tests/baselines/reference/modulePrologueSystem.js +++ b/tests/baselines/reference/modulePrologueSystem.js @@ -4,8 +4,9 @@ export class Foo {} //// [modulePrologueSystem.js] -System.register([], function(exports_1, __moduleName) { +System.register([], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; var Foo; return { setters:[], diff --git a/tests/baselines/reference/moduleReopenedTypeOtherBlock.symbols b/tests/baselines/reference/moduleReopenedTypeOtherBlock.symbols index 1a5017b89c7..d4bb9defa38 100644 --- a/tests/baselines/reference/moduleReopenedTypeOtherBlock.symbols +++ b/tests/baselines/reference/moduleReopenedTypeOtherBlock.symbols @@ -7,14 +7,14 @@ module M { export interface I { n: number; } >I : Symbol(I, Decl(moduleReopenedTypeOtherBlock.ts, 1, 23)) ->n : Symbol(n, Decl(moduleReopenedTypeOtherBlock.ts, 2, 24)) +>n : Symbol(I.n, Decl(moduleReopenedTypeOtherBlock.ts, 2, 24)) } module M { >M : Symbol(M, Decl(moduleReopenedTypeOtherBlock.ts, 0, 0), Decl(moduleReopenedTypeOtherBlock.ts, 3, 1)) export class C2 { f(): I { return null; } } >C2 : Symbol(C2, Decl(moduleReopenedTypeOtherBlock.ts, 4, 10)) ->f : Symbol(f, Decl(moduleReopenedTypeOtherBlock.ts, 5, 21)) +>f : Symbol(C2.f, Decl(moduleReopenedTypeOtherBlock.ts, 5, 21)) >I : Symbol(I, Decl(moduleReopenedTypeOtherBlock.ts, 1, 23)) } diff --git a/tests/baselines/reference/moduleReopenedTypeSameBlock.symbols b/tests/baselines/reference/moduleReopenedTypeSameBlock.symbols index a593b63cd01..3ee83c80746 100644 --- a/tests/baselines/reference/moduleReopenedTypeSameBlock.symbols +++ b/tests/baselines/reference/moduleReopenedTypeSameBlock.symbols @@ -8,11 +8,11 @@ module M { export interface I { n: number; } >I : Symbol(I, Decl(moduleReopenedTypeSameBlock.ts, 1, 10)) ->n : Symbol(n, Decl(moduleReopenedTypeSameBlock.ts, 2, 24)) +>n : Symbol(I.n, Decl(moduleReopenedTypeSameBlock.ts, 2, 24)) export class C2 { f(): I { return null; } } >C2 : Symbol(C2, Decl(moduleReopenedTypeSameBlock.ts, 2, 37)) ->f : Symbol(f, Decl(moduleReopenedTypeSameBlock.ts, 3, 21)) +>f : Symbol(C2.f, Decl(moduleReopenedTypeSameBlock.ts, 3, 21)) >I : Symbol(I, Decl(moduleReopenedTypeSameBlock.ts, 1, 10)) } diff --git a/tests/baselines/reference/moduleResolutionWithSymlinks.js b/tests/baselines/reference/moduleResolutionWithSymlinks.js new file mode 100644 index 00000000000..4123430045e --- /dev/null +++ b/tests/baselines/reference/moduleResolutionWithSymlinks.js @@ -0,0 +1,37 @@ +//// [tests/cases/compiler/moduleResolutionWithSymlinks.ts] //// + +//// [index.ts] + +export class MyClass{} + +//// [index.ts] +import {MyClass} from "library-a"; +export { MyClass as MyClass2 } + +//// [app.ts] +import { MyClass } from "./library-a"; +import { MyClass2 } from "./library-b"; + +let x: MyClass; +let y: MyClass2; +x = y; +y = x; + +//// [index.js] +"use strict"; +var MyClass = (function () { + function MyClass() { + } + return MyClass; +}()); +exports.MyClass = MyClass; +//// [index.js] +"use strict"; +var library_a_1 = require("library-a"); +exports.MyClass2 = library_a_1.MyClass; +//// [app.js] +"use strict"; +var x; +var y; +x = y; +y = x; diff --git a/tests/baselines/reference/moduleResolutionWithSymlinks.symbols b/tests/baselines/reference/moduleResolutionWithSymlinks.symbols new file mode 100644 index 00000000000..ea73755deef --- /dev/null +++ b/tests/baselines/reference/moduleResolutionWithSymlinks.symbols @@ -0,0 +1,36 @@ +=== /src/app.ts === +import { MyClass } from "./library-a"; +>MyClass : Symbol(MyClass, Decl(app.ts, 0, 8)) + +import { MyClass2 } from "./library-b"; +>MyClass2 : Symbol(MyClass2, Decl(app.ts, 1, 8)) + +let x: MyClass; +>x : Symbol(x, Decl(app.ts, 3, 3)) +>MyClass : Symbol(MyClass, Decl(app.ts, 0, 8)) + +let y: MyClass2; +>y : Symbol(y, Decl(app.ts, 4, 3)) +>MyClass2 : Symbol(MyClass2, Decl(app.ts, 1, 8)) + +x = y; +>x : Symbol(x, Decl(app.ts, 3, 3)) +>y : Symbol(y, Decl(app.ts, 4, 3)) + +y = x; +>y : Symbol(y, Decl(app.ts, 4, 3)) +>x : Symbol(x, Decl(app.ts, 3, 3)) + +=== /src/library-a/index.ts === + +export class MyClass{} +>MyClass : Symbol(MyClass, Decl(index.ts, 0, 0)) + +=== /src/library-b/index.ts === +import {MyClass} from "library-a"; +>MyClass : Symbol(MyClass, Decl(index.ts, 0, 8)) + +export { MyClass as MyClass2 } +>MyClass : Symbol(MyClass2, Decl(index.ts, 1, 8)) +>MyClass2 : Symbol(MyClass2, Decl(index.ts, 1, 8)) + diff --git a/tests/baselines/reference/moduleResolutionWithSymlinks.trace.json b/tests/baselines/reference/moduleResolutionWithSymlinks.trace.json new file mode 100644 index 00000000000..7f1c2890180 --- /dev/null +++ b/tests/baselines/reference/moduleResolutionWithSymlinks.trace.json @@ -0,0 +1,32 @@ +[ + "======== Resolving module './library-a' from '/src/app.ts'. ========", + "Module resolution kind is not specified, using 'NodeJs'.", + "Loading module as file / folder, candidate module location '/src/library-a'.", + "File '/src/library-a.ts' does not exist.", + "File '/src/library-a.tsx' does not exist.", + "File '/src/library-a.d.ts' does not exist.", + "File '/src/library-a/package.json' does not exist.", + "File '/src/library-a/index.ts' exist - use it as a name resolution result.", + "Resolving real path for '/src/library-a/index.ts', result '/src/library-a/index.ts'", + "======== Module name './library-a' was successfully resolved to '/src/library-a/index.ts'. ========", + "======== Resolving module './library-b' from '/src/app.ts'. ========", + "Module resolution kind is not specified, using 'NodeJs'.", + "Loading module as file / folder, candidate module location '/src/library-b'.", + "File '/src/library-b.ts' does not exist.", + "File '/src/library-b.tsx' does not exist.", + "File '/src/library-b.d.ts' does not exist.", + "File '/src/library-b/package.json' does not exist.", + "File '/src/library-b/index.ts' exist - use it as a name resolution result.", + "Resolving real path for '/src/library-b/index.ts', result '/src/library-b/index.ts'", + "======== Module name './library-b' was successfully resolved to '/src/library-b/index.ts'. ========", + "======== Resolving module 'library-a' from '/src/library-b/index.ts'. ========", + "Module resolution kind is not specified, using 'NodeJs'.", + "Loading module 'library-a' from 'node_modules' folder.", + "File '/src/library-b/node_modules/library-a.ts' does not exist.", + "File '/src/library-b/node_modules/library-a.tsx' does not exist.", + "File '/src/library-b/node_modules/library-a.d.ts' does not exist.", + "File '/src/library-b/node_modules/library-a/package.json' does not exist.", + "File '/src/library-b/node_modules/library-a/index.ts' exist - use it as a name resolution result.", + "Resolving real path for '/src/library-b/node_modules/library-a/index.ts', result '/src/library-a/index.ts'", + "======== Module name 'library-a' was successfully resolved to '/src/library-a/index.ts'. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/moduleResolutionWithSymlinks.types b/tests/baselines/reference/moduleResolutionWithSymlinks.types new file mode 100644 index 00000000000..8344adbe817 --- /dev/null +++ b/tests/baselines/reference/moduleResolutionWithSymlinks.types @@ -0,0 +1,38 @@ +=== /src/app.ts === +import { MyClass } from "./library-a"; +>MyClass : typeof MyClass + +import { MyClass2 } from "./library-b"; +>MyClass2 : typeof MyClass + +let x: MyClass; +>x : MyClass +>MyClass : MyClass + +let y: MyClass2; +>y : MyClass +>MyClass2 : MyClass + +x = y; +>x = y : MyClass +>x : MyClass +>y : MyClass + +y = x; +>y = x : MyClass +>y : MyClass +>x : MyClass + +=== /src/library-a/index.ts === + +export class MyClass{} +>MyClass : MyClass + +=== /src/library-b/index.ts === +import {MyClass} from "library-a"; +>MyClass : typeof MyClass + +export { MyClass as MyClass2 } +>MyClass : typeof MyClass +>MyClass2 : typeof MyClass + diff --git a/tests/baselines/reference/moduleScoping.errors.txt b/tests/baselines/reference/moduleScoping.errors.txt deleted file mode 100644 index 961715f2e71..00000000000 --- a/tests/baselines/reference/moduleScoping.errors.txt +++ /dev/null @@ -1,26 +0,0 @@ -tests/cases/conformance/externalModules/file3.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. - - -==== tests/cases/conformance/externalModules/file1.ts (0 errors) ==== - var v1 = "sausages"; // Global scope - -==== tests/cases/conformance/externalModules/file2.ts (0 errors) ==== - var v2 = 42; // Global scope - var v4 = () => 5; - -==== tests/cases/conformance/externalModules/file3.ts (1 errors) ==== - export var v3 = true; - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. - var v2 = [1,2,3]; // Module scope. Should not appear in global scope - -==== tests/cases/conformance/externalModules/file4.ts (0 errors) ==== - import file3 = require('./file3'); - var t1 = v1; - var t2 = v2; - var t3 = file3.v3; - var v4 = {a: true, b: NaN}; // Should shadow global v2 in this module - -==== tests/cases/conformance/externalModules/file5.ts (0 errors) ==== - var x = v2; // Should be global v2 of type number again - \ No newline at end of file diff --git a/tests/baselines/reference/moduleScoping.symbols b/tests/baselines/reference/moduleScoping.symbols new file mode 100644 index 00000000000..7a63e8a60fc --- /dev/null +++ b/tests/baselines/reference/moduleScoping.symbols @@ -0,0 +1,47 @@ +=== tests/cases/conformance/externalModules/file1.ts === +var v1 = "sausages"; // Global scope +>v1 : Symbol(v1, Decl(file1.ts, 0, 3)) + +=== tests/cases/conformance/externalModules/file2.ts === +var v2 = 42; // Global scope +>v2 : Symbol(v2, Decl(file2.ts, 0, 3)) + +var v4 = () => 5; +>v4 : Symbol(v4, Decl(file2.ts, 1, 3)) + +=== tests/cases/conformance/externalModules/file3.ts === +export var v3 = true; +>v3 : Symbol(v3, Decl(file3.ts, 0, 10)) + +var v2 = [1,2,3]; // Module scope. Should not appear in global scope +>v2 : Symbol(v2, Decl(file3.ts, 1, 3)) + +=== tests/cases/conformance/externalModules/file4.ts === +import file3 = require('./file3'); +>file3 : Symbol(file3, Decl(file4.ts, 0, 0)) + +var t1 = v1; +>t1 : Symbol(t1, Decl(file4.ts, 1, 3)) +>v1 : Symbol(v1, Decl(file1.ts, 0, 3)) + +var t2 = v2; +>t2 : Symbol(t2, Decl(file4.ts, 2, 3)) +>v2 : Symbol(v2, Decl(file2.ts, 0, 3)) + +var t3 = file3.v3; +>t3 : Symbol(t3, Decl(file4.ts, 3, 3)) +>file3.v3 : Symbol(file3.v3, Decl(file3.ts, 0, 10)) +>file3 : Symbol(file3, Decl(file4.ts, 0, 0)) +>v3 : Symbol(file3.v3, Decl(file3.ts, 0, 10)) + +var v4 = {a: true, b: NaN}; // Should shadow global v2 in this module +>v4 : Symbol(v4, Decl(file4.ts, 4, 3)) +>a : Symbol(a, Decl(file4.ts, 4, 10)) +>b : Symbol(b, Decl(file4.ts, 4, 18)) +>NaN : Symbol(NaN, Decl(lib.d.ts, --, --)) + +=== tests/cases/conformance/externalModules/file5.ts === +var x = v2; // Should be global v2 of type number again +>x : Symbol(x, Decl(file5.ts, 0, 3)) +>v2 : Symbol(v2, Decl(file2.ts, 0, 3)) + diff --git a/tests/baselines/reference/moduleScoping.types b/tests/baselines/reference/moduleScoping.types new file mode 100644 index 00000000000..b2ee83dc69b --- /dev/null +++ b/tests/baselines/reference/moduleScoping.types @@ -0,0 +1,58 @@ +=== tests/cases/conformance/externalModules/file1.ts === +var v1 = "sausages"; // Global scope +>v1 : string +>"sausages" : string + +=== tests/cases/conformance/externalModules/file2.ts === +var v2 = 42; // Global scope +>v2 : number +>42 : number + +var v4 = () => 5; +>v4 : () => number +>() => 5 : () => number +>5 : number + +=== tests/cases/conformance/externalModules/file3.ts === +export var v3 = true; +>v3 : boolean +>true : boolean + +var v2 = [1,2,3]; // Module scope. Should not appear in global scope +>v2 : number[] +>[1,2,3] : number[] +>1 : number +>2 : number +>3 : number + +=== tests/cases/conformance/externalModules/file4.ts === +import file3 = require('./file3'); +>file3 : typeof file3 + +var t1 = v1; +>t1 : string +>v1 : string + +var t2 = v2; +>t2 : number +>v2 : number + +var t3 = file3.v3; +>t3 : boolean +>file3.v3 : boolean +>file3 : typeof file3 +>v3 : boolean + +var v4 = {a: true, b: NaN}; // Should shadow global v2 in this module +>v4 : { a: boolean; b: number; } +>{a: true, b: NaN} : { a: boolean; b: number; } +>a : boolean +>true : boolean +>b : number +>NaN : number + +=== tests/cases/conformance/externalModules/file5.ts === +var x = v2; // Should be global v2 of type number again +>x : number +>v2 : number + diff --git a/tests/baselines/reference/moduleVisibilityTest1.symbols b/tests/baselines/reference/moduleVisibilityTest1.symbols index 9879d8a0151..7c939fee5c3 100644 --- a/tests/baselines/reference/moduleVisibilityTest1.symbols +++ b/tests/baselines/reference/moduleVisibilityTest1.symbols @@ -59,40 +59,40 @@ module M { >I : Symbol(I, Decl(moduleVisibilityTest1.ts, 27, 15)) someMethod():number; ->someMethod : Symbol(someMethod, Decl(moduleVisibilityTest1.ts, 30, 21)) +>someMethod : Symbol(I.someMethod, Decl(moduleVisibilityTest1.ts, 30, 21)) } class B {public b = 0;} >B : Symbol(B, Decl(moduleVisibilityTest1.ts, 32, 2)) ->b : Symbol(b, Decl(moduleVisibilityTest1.ts, 34, 11)) +>b : Symbol(B.b, Decl(moduleVisibilityTest1.ts, 34, 11)) export class C implements I { >C : Symbol(C, Decl(moduleVisibilityTest1.ts, 34, 25)) >I : Symbol(I, Decl(moduleVisibilityTest1.ts, 27, 15)) public someMethodThatCallsAnOuterMethod() {return OuterInnerAlias.someExportedOuterInnerFunc();} ->someMethodThatCallsAnOuterMethod : Symbol(someMethodThatCallsAnOuterMethod, Decl(moduleVisibilityTest1.ts, 36, 31)) +>someMethodThatCallsAnOuterMethod : Symbol(C.someMethodThatCallsAnOuterMethod, Decl(moduleVisibilityTest1.ts, 36, 31)) >OuterInnerAlias.someExportedOuterInnerFunc : Symbol(OuterInnerAlias.someExportedOuterInnerFunc, Decl(moduleVisibilityTest1.ts, 5, 30)) >OuterInnerAlias : Symbol(OuterInnerAlias, Decl(moduleVisibilityTest1.ts, 8, 1)) >someExportedOuterInnerFunc : Symbol(OuterInnerAlias.someExportedOuterInnerFunc, Decl(moduleVisibilityTest1.ts, 5, 30)) public someMethodThatCallsAnInnerMethod() {return InnerMod.someExportedInnerFunc();} ->someMethodThatCallsAnInnerMethod : Symbol(someMethodThatCallsAnInnerMethod, Decl(moduleVisibilityTest1.ts, 37, 98)) +>someMethodThatCallsAnInnerMethod : Symbol(C.someMethodThatCallsAnInnerMethod, Decl(moduleVisibilityTest1.ts, 37, 98)) >InnerMod.someExportedInnerFunc : Symbol(InnerMod.someExportedInnerFunc, Decl(moduleVisibilityTest1.ts, 14, 25)) >InnerMod : Symbol(InnerMod, Decl(moduleVisibilityTest1.ts, 12, 10)) >someExportedInnerFunc : Symbol(InnerMod.someExportedInnerFunc, Decl(moduleVisibilityTest1.ts, 14, 25)) public someMethodThatCallsAnOuterInnerMethod() {return OuterMod.someExportedOuterFunc();} ->someMethodThatCallsAnOuterInnerMethod : Symbol(someMethodThatCallsAnOuterInnerMethod, Decl(moduleVisibilityTest1.ts, 38, 86)) +>someMethodThatCallsAnOuterInnerMethod : Symbol(C.someMethodThatCallsAnOuterInnerMethod, Decl(moduleVisibilityTest1.ts, 38, 86)) >OuterMod.someExportedOuterFunc : Symbol(OuterMod.someExportedOuterFunc, Decl(moduleVisibilityTest1.ts, 2, 17)) >OuterMod : Symbol(OuterMod, Decl(moduleVisibilityTest1.ts, 0, 0)) >someExportedOuterFunc : Symbol(OuterMod.someExportedOuterFunc, Decl(moduleVisibilityTest1.ts, 2, 17)) public someMethod() { return 0; } ->someMethod : Symbol(someMethod, Decl(moduleVisibilityTest1.ts, 39, 91)) +>someMethod : Symbol(C.someMethod, Decl(moduleVisibilityTest1.ts, 39, 91)) public someProp = 1; ->someProp : Symbol(someProp, Decl(moduleVisibilityTest1.ts, 40, 35)) +>someProp : Symbol(C.someProp, Decl(moduleVisibilityTest1.ts, 40, 35)) constructor() { function someInnerFunc() { return 2; } diff --git a/tests/baselines/reference/moduleWithStatementsOfEveryKind.symbols b/tests/baselines/reference/moduleWithStatementsOfEveryKind.symbols index d121e6b5367..48b5f8607be 100644 --- a/tests/baselines/reference/moduleWithStatementsOfEveryKind.symbols +++ b/tests/baselines/reference/moduleWithStatementsOfEveryKind.symbols @@ -4,23 +4,23 @@ module A { class A { s: string } >A : Symbol(A, Decl(moduleWithStatementsOfEveryKind.ts, 0, 10)) ->s : Symbol(s, Decl(moduleWithStatementsOfEveryKind.ts, 1, 13)) +>s : Symbol(A.s, Decl(moduleWithStatementsOfEveryKind.ts, 1, 13)) class AA { s: T } >AA : Symbol(AA, Decl(moduleWithStatementsOfEveryKind.ts, 1, 25)) >T : Symbol(T, Decl(moduleWithStatementsOfEveryKind.ts, 2, 13)) ->s : Symbol(s, Decl(moduleWithStatementsOfEveryKind.ts, 2, 17)) +>s : Symbol(AA.s, Decl(moduleWithStatementsOfEveryKind.ts, 2, 17)) >T : Symbol(T, Decl(moduleWithStatementsOfEveryKind.ts, 2, 13)) interface I { id: number } >I : Symbol(I, Decl(moduleWithStatementsOfEveryKind.ts, 2, 24)) ->id : Symbol(id, Decl(moduleWithStatementsOfEveryKind.ts, 3, 17)) +>id : Symbol(I.id, Decl(moduleWithStatementsOfEveryKind.ts, 3, 17)) class B extends AA implements I { id: number } >B : Symbol(B, Decl(moduleWithStatementsOfEveryKind.ts, 3, 30)) >AA : Symbol(AA, Decl(moduleWithStatementsOfEveryKind.ts, 1, 25)) >I : Symbol(I, Decl(moduleWithStatementsOfEveryKind.ts, 2, 24)) ->id : Symbol(id, Decl(moduleWithStatementsOfEveryKind.ts, 5, 45)) +>id : Symbol(B.id, Decl(moduleWithStatementsOfEveryKind.ts, 5, 45)) class BB extends A { >BB : Symbol(BB, Decl(moduleWithStatementsOfEveryKind.ts, 5, 58)) @@ -28,7 +28,7 @@ module A { >A : Symbol(A, Decl(moduleWithStatementsOfEveryKind.ts, 0, 10)) id: number; ->id : Symbol(id, Decl(moduleWithStatementsOfEveryKind.ts, 6, 27)) +>id : Symbol(BB.id, Decl(moduleWithStatementsOfEveryKind.ts, 6, 27)) } module Module { @@ -36,7 +36,7 @@ module A { class A { s: string } >A : Symbol(A, Decl(moduleWithStatementsOfEveryKind.ts, 10, 19)) ->s : Symbol(s, Decl(moduleWithStatementsOfEveryKind.ts, 11, 17)) +>s : Symbol(A.s, Decl(moduleWithStatementsOfEveryKind.ts, 11, 17)) } enum Color { Blue, Red } >Color : Symbol(Color, Decl(moduleWithStatementsOfEveryKind.ts, 12, 5)) @@ -82,23 +82,23 @@ module Y { export class A { s: string } >A : Symbol(A, Decl(moduleWithStatementsOfEveryKind.ts, 29, 10)) ->s : Symbol(s, Decl(moduleWithStatementsOfEveryKind.ts, 30, 20)) +>s : Symbol(A.s, Decl(moduleWithStatementsOfEveryKind.ts, 30, 20)) export class AA { s: T } >AA : Symbol(AA, Decl(moduleWithStatementsOfEveryKind.ts, 30, 32)) >T : Symbol(T, Decl(moduleWithStatementsOfEveryKind.ts, 31, 20)) ->s : Symbol(s, Decl(moduleWithStatementsOfEveryKind.ts, 31, 24)) +>s : Symbol(AA.s, Decl(moduleWithStatementsOfEveryKind.ts, 31, 24)) >T : Symbol(T, Decl(moduleWithStatementsOfEveryKind.ts, 31, 20)) export interface I { id: number } >I : Symbol(I, Decl(moduleWithStatementsOfEveryKind.ts, 31, 31)) ->id : Symbol(id, Decl(moduleWithStatementsOfEveryKind.ts, 32, 24)) +>id : Symbol(I.id, Decl(moduleWithStatementsOfEveryKind.ts, 32, 24)) export class B extends AA implements I { id: number } >B : Symbol(B, Decl(moduleWithStatementsOfEveryKind.ts, 32, 37)) >AA : Symbol(AA, Decl(moduleWithStatementsOfEveryKind.ts, 30, 32)) >I : Symbol(I, Decl(moduleWithStatementsOfEveryKind.ts, 31, 31)) ->id : Symbol(id, Decl(moduleWithStatementsOfEveryKind.ts, 34, 52)) +>id : Symbol(B.id, Decl(moduleWithStatementsOfEveryKind.ts, 34, 52)) export class BB extends A { >BB : Symbol(BB, Decl(moduleWithStatementsOfEveryKind.ts, 34, 65)) @@ -106,7 +106,7 @@ module Y { >A : Symbol(A, Decl(moduleWithStatementsOfEveryKind.ts, 29, 10)) id: number; ->id : Symbol(id, Decl(moduleWithStatementsOfEveryKind.ts, 35, 34)) +>id : Symbol(BB.id, Decl(moduleWithStatementsOfEveryKind.ts, 35, 34)) } export module Module { @@ -114,7 +114,7 @@ module Y { class A { s: string } >A : Symbol(A, Decl(moduleWithStatementsOfEveryKind.ts, 39, 26)) ->s : Symbol(s, Decl(moduleWithStatementsOfEveryKind.ts, 40, 17)) +>s : Symbol(A.s, Decl(moduleWithStatementsOfEveryKind.ts, 40, 17)) } export enum Color { Blue, Red } >Color : Symbol(Color, Decl(moduleWithStatementsOfEveryKind.ts, 41, 5)) diff --git a/tests/baselines/reference/module_augmentUninstantiatedModule.js b/tests/baselines/reference/module_augmentUninstantiatedModule.js new file mode 100644 index 00000000000..d3c231fda4e --- /dev/null +++ b/tests/baselines/reference/module_augmentUninstantiatedModule.js @@ -0,0 +1,12 @@ +//// [module_augmentUninstantiatedModule.ts] +declare module "foo" { + namespace M {} + var M; + export = M; +} + +declare module "bar" { + module "foo" {} +} + +//// [module_augmentUninstantiatedModule.js] diff --git a/tests/baselines/reference/module_augmentUninstantiatedModule.symbols b/tests/baselines/reference/module_augmentUninstantiatedModule.symbols new file mode 100644 index 00000000000..d405f9549ea --- /dev/null +++ b/tests/baselines/reference/module_augmentUninstantiatedModule.symbols @@ -0,0 +1,15 @@ +=== tests/cases/compiler/module_augmentUninstantiatedModule.ts === +declare module "foo" { + namespace M {} +>M : Symbol(, Decl(module_augmentUninstantiatedModule.ts, 0, 22), Decl(module_augmentUninstantiatedModule.ts, 2, 6), Decl(module_augmentUninstantiatedModule.ts, 6, 22)) + + var M; +>M : Symbol(, Decl(module_augmentUninstantiatedModule.ts, 0, 22), Decl(module_augmentUninstantiatedModule.ts, 2, 6), Decl(module_augmentUninstantiatedModule.ts, 6, 22)) + + export = M; +>M : Symbol(M, Decl(module_augmentUninstantiatedModule.ts, 0, 22), Decl(module_augmentUninstantiatedModule.ts, 2, 6)) +} + +declare module "bar" { + module "foo" {} +} diff --git a/tests/baselines/reference/module_augmentUninstantiatedModule.types b/tests/baselines/reference/module_augmentUninstantiatedModule.types new file mode 100644 index 00000000000..0c27cc3acf9 --- /dev/null +++ b/tests/baselines/reference/module_augmentUninstantiatedModule.types @@ -0,0 +1,15 @@ +=== tests/cases/compiler/module_augmentUninstantiatedModule.ts === +declare module "foo" { + namespace M {} +>M : any + + var M; +>M : any + + export = M; +>M : any +} + +declare module "bar" { + module "foo" {} +} diff --git a/tests/baselines/reference/module_augmentUninstantiatedModule2.js b/tests/baselines/reference/module_augmentUninstantiatedModule2.js new file mode 100644 index 00000000000..2e7b4d917db --- /dev/null +++ b/tests/baselines/reference/module_augmentUninstantiatedModule2.js @@ -0,0 +1,6 @@ +//// [module_augmentUninstantiatedModule2.ts] +declare var ng: ng.IAngularStatic; declare module ng { export interface IModule { name: string; } export interface IAngularStatic { module: (s: string) => IModule; } } export = ng; + +//// [module_augmentUninstantiatedModule2.js] +"use strict"; +module.exports = ng; diff --git a/tests/baselines/reference/module_augmentUninstantiatedModule2.symbols b/tests/baselines/reference/module_augmentUninstantiatedModule2.symbols new file mode 100644 index 00000000000..42e27aa9eae --- /dev/null +++ b/tests/baselines/reference/module_augmentUninstantiatedModule2.symbols @@ -0,0 +1,6 @@ +=== tests/cases/compiler/module_augmentUninstantiatedModule2.ts === +declare var ng: ng.IAngularStatic; declare module ng { export interface IModule { name: string; } export interface IAngularStatic { module: (s: string) => IModule; } } export = ng; +>ng : Symbol(ng, Decl(module_augmentUninstantiatedModule2.ts, 0, 11), Decl(module_augmentUninstantiatedModule2.ts, 0, 34)) +>ng : Symbol(ng, Decl(module_augmentUninstantiatedModule2.ts, 0, 11), Decl(module_augmentUninstantiatedModule2.ts, 0, 34)) +>IAngularStatic : Symbol(ng.IAngularStatic, Decl(module_augmentUninstantiatedModule2.ts, 5, 4)) + diff --git a/tests/baselines/reference/module_augmentUninstantiatedModule2.types b/tests/baselines/reference/module_augmentUninstantiatedModule2.types new file mode 100644 index 00000000000..2875ace3c1b --- /dev/null +++ b/tests/baselines/reference/module_augmentUninstantiatedModule2.types @@ -0,0 +1,6 @@ +=== tests/cases/compiler/module_augmentUninstantiatedModule2.ts === +declare var ng: ng.IAngularStatic; declare module ng { export interface IModule { name: string; } export interface IAngularStatic { module: (s: string) => IModule; } } export = ng; +>ng : ng.IAngularStatic +>ng : any +>IAngularStatic : ng.IAngularStatic + diff --git a/tests/baselines/reference/moduledecl.js b/tests/baselines/reference/moduledecl.js index 2e765e512d8..f4efbadbf3e 100644 --- a/tests/baselines/reference/moduledecl.js +++ b/tests/baselines/reference/moduledecl.js @@ -459,10 +459,10 @@ declare module exportTests { class C3_public { private getC2_private(); private setC2_private(arg); - private c2; + private readonly c2; getC1_public(): C1_public; setC1_public(arg: C1_public): void; - c1: C1_public; + readonly c1: C1_public; } } declare module mAmbient { diff --git a/tests/baselines/reference/moduledecl.symbols b/tests/baselines/reference/moduledecl.symbols index 178c406f8cd..f0b2db9121c 100644 --- a/tests/baselines/reference/moduledecl.symbols +++ b/tests/baselines/reference/moduledecl.symbols @@ -65,10 +65,10 @@ module m0 { >c1 : Symbol(c1, Decl(moduledecl.ts, 25, 5)) public a : ()=>string; ->a : Symbol(a, Decl(moduledecl.ts, 27, 14)) +>a : Symbol(c1.a, Decl(moduledecl.ts, 27, 14)) private b: ()=>number; ->b : Symbol(b, Decl(moduledecl.ts, 28, 30)) +>b : Symbol(c1.b, Decl(moduledecl.ts, 28, 30)) private static s1; >s1 : Symbol(c1.s1, Decl(moduledecl.ts, 29, 30)) @@ -141,10 +141,10 @@ module m1 { >c1 : Symbol(c1, Decl(moduledecl.ts, 54, 5)) public a: () =>string; ->a : Symbol(a, Decl(moduledecl.ts, 56, 21)) +>a : Symbol(c1.a, Decl(moduledecl.ts, 56, 21)) private b: () =>number; ->b : Symbol(b, Decl(moduledecl.ts, 57, 30)) +>b : Symbol(c1.b, Decl(moduledecl.ts, 57, 30)) private static s1; >s1 : Symbol(c1.s1, Decl(moduledecl.ts, 58, 31)) @@ -153,21 +153,21 @@ module m1 { >s2 : Symbol(c1.s2, Decl(moduledecl.ts, 59, 26)) public d() { ->d : Symbol(d, Decl(moduledecl.ts, 60, 25)) +>d : Symbol(c1.d, Decl(moduledecl.ts, 60, 25)) return "Hello"; } public e: { x: number; y: string; }; ->e : Symbol(e, Decl(moduledecl.ts, 64, 9)) +>e : Symbol(c1.e, Decl(moduledecl.ts, 64, 9)) >x : Symbol(x, Decl(moduledecl.ts, 66, 19)) >y : Symbol(y, Decl(moduledecl.ts, 66, 30)) constructor (public n, public n2: number, private n3, private n4: string) { ->n : Symbol(n, Decl(moduledecl.ts, 67, 21)) ->n2 : Symbol(n2, Decl(moduledecl.ts, 67, 30)) ->n3 : Symbol(n3, Decl(moduledecl.ts, 67, 49)) ->n4 : Symbol(n4, Decl(moduledecl.ts, 67, 61)) +>n : Symbol(c1.n, Decl(moduledecl.ts, 67, 21)) +>n2 : Symbol(c1.n2, Decl(moduledecl.ts, 67, 30)) +>n3 : Symbol(c1.n3, Decl(moduledecl.ts, 67, 49)) +>n4 : Symbol(c1.n4, Decl(moduledecl.ts, 67, 61)) } } @@ -312,13 +312,13 @@ module exportTests { >C1_public : Symbol(C1_public, Decl(moduledecl.ts, 138, 20)) private f2() { ->f2 : Symbol(f2, Decl(moduledecl.ts, 139, 28)) +>f2 : Symbol(C1_public.f2, Decl(moduledecl.ts, 139, 28)) return 30; } public f3() { ->f3 : Symbol(f3, Decl(moduledecl.ts, 142, 9)) +>f3 : Symbol(C1_public.f3, Decl(moduledecl.ts, 142, 9)) return "string"; } @@ -327,13 +327,13 @@ module exportTests { >C2_private : Symbol(C2_private, Decl(moduledecl.ts, 147, 5)) private f2() { ->f2 : Symbol(f2, Decl(moduledecl.ts, 148, 22)) +>f2 : Symbol(C2_private.f2, Decl(moduledecl.ts, 148, 22)) return 30; } public f3() { ->f3 : Symbol(f3, Decl(moduledecl.ts, 151, 9)) +>f3 : Symbol(C2_private.f3, Decl(moduledecl.ts, 151, 9)) return "string"; } @@ -343,35 +343,35 @@ module exportTests { >C3_public : Symbol(C3_public, Decl(moduledecl.ts, 156, 5)) private getC2_private() { ->getC2_private : Symbol(getC2_private, Decl(moduledecl.ts, 158, 28)) +>getC2_private : Symbol(C3_public.getC2_private, Decl(moduledecl.ts, 158, 28)) return new C2_private(); >C2_private : Symbol(C2_private, Decl(moduledecl.ts, 147, 5)) } private setC2_private(arg: C2_private) { ->setC2_private : Symbol(setC2_private, Decl(moduledecl.ts, 161, 9)) +>setC2_private : Symbol(C3_public.setC2_private, Decl(moduledecl.ts, 161, 9)) >arg : Symbol(arg, Decl(moduledecl.ts, 162, 30)) >C2_private : Symbol(C2_private, Decl(moduledecl.ts, 147, 5)) } private get c2() { ->c2 : Symbol(c2, Decl(moduledecl.ts, 163, 9)) +>c2 : Symbol(C3_public.c2, Decl(moduledecl.ts, 163, 9)) return new C2_private(); >C2_private : Symbol(C2_private, Decl(moduledecl.ts, 147, 5)) } public getC1_public() { ->getC1_public : Symbol(getC1_public, Decl(moduledecl.ts, 166, 9)) +>getC1_public : Symbol(C3_public.getC1_public, Decl(moduledecl.ts, 166, 9)) return new C1_public(); >C1_public : Symbol(C1_public, Decl(moduledecl.ts, 138, 20)) } public setC1_public(arg: C1_public) { ->setC1_public : Symbol(setC1_public, Decl(moduledecl.ts, 169, 9)) +>setC1_public : Symbol(C3_public.setC1_public, Decl(moduledecl.ts, 169, 9)) >arg : Symbol(arg, Decl(moduledecl.ts, 170, 28)) >C1_public : Symbol(C1_public, Decl(moduledecl.ts, 138, 20)) } public get c1() { ->c1 : Symbol(c1, Decl(moduledecl.ts, 171, 9)) +>c1 : Symbol(C3_public.c1, Decl(moduledecl.ts, 171, 9)) return new C1_public(); >C1_public : Symbol(C1_public, Decl(moduledecl.ts, 138, 20)) @@ -386,7 +386,7 @@ declare module mAmbient { >C : Symbol(C, Decl(moduledecl.ts, 178, 25)) public myProp: number; ->myProp : Symbol(myProp, Decl(moduledecl.ts, 179, 13)) +>myProp : Symbol(C.myProp, Decl(moduledecl.ts, 179, 13)) } function foo() : C; @@ -401,10 +401,10 @@ declare module mAmbient { >B : Symbol(B, Decl(moduledecl.ts, 184, 16)) x: number; ->x : Symbol(x, Decl(moduledecl.ts, 185, 17)) +>x : Symbol(B.x, Decl(moduledecl.ts, 185, 17)) y: C; ->y : Symbol(y, Decl(moduledecl.ts, 186, 18)) +>y : Symbol(B.y, Decl(moduledecl.ts, 186, 18)) >C : Symbol(C, Decl(moduledecl.ts, 178, 25)) } enum e { @@ -427,7 +427,7 @@ declare module mAmbient { >C : Symbol(C, Decl(moduledecl.ts, 195, 15)) public myProp: number; ->myProp : Symbol(myProp, Decl(moduledecl.ts, 196, 17)) +>myProp : Symbol(C.myProp, Decl(moduledecl.ts, 196, 17)) } function foo(): C; @@ -442,10 +442,10 @@ declare module mAmbient { >B : Symbol(B, Decl(moduledecl.ts, 201, 20)) x: number; ->x : Symbol(x, Decl(moduledecl.ts, 202, 21)) +>x : Symbol(B.x, Decl(moduledecl.ts, 202, 21)) y: C; ->y : Symbol(y, Decl(moduledecl.ts, 203, 22)) +>y : Symbol(B.y, Decl(moduledecl.ts, 203, 22)) >C : Symbol(C, Decl(moduledecl.ts, 195, 15)) } enum e { diff --git a/tests/baselines/reference/multiExtendsSplitInterfaces2.symbols b/tests/baselines/reference/multiExtendsSplitInterfaces2.symbols index c9f390f1621..0572d2df333 100644 --- a/tests/baselines/reference/multiExtendsSplitInterfaces2.symbols +++ b/tests/baselines/reference/multiExtendsSplitInterfaces2.symbols @@ -3,7 +3,7 @@ interface A { >A : Symbol(A, Decl(multiExtendsSplitInterfaces2.ts, 0, 0)) a: number; ->a : Symbol(a, Decl(multiExtendsSplitInterfaces2.ts, 0, 13)) +>a : Symbol(A.a, Decl(multiExtendsSplitInterfaces2.ts, 0, 13)) } interface I extends A { @@ -11,14 +11,14 @@ interface I extends A { >A : Symbol(A, Decl(multiExtendsSplitInterfaces2.ts, 0, 0)) i1: number; ->i1 : Symbol(i1, Decl(multiExtendsSplitInterfaces2.ts, 4, 23)) +>i1 : Symbol(I.i1, Decl(multiExtendsSplitInterfaces2.ts, 4, 23)) } interface B { >B : Symbol(B, Decl(multiExtendsSplitInterfaces2.ts, 6, 1)) b: number; ->b : Symbol(b, Decl(multiExtendsSplitInterfaces2.ts, 8, 13)) +>b : Symbol(B.b, Decl(multiExtendsSplitInterfaces2.ts, 8, 13)) } interface I extends B { @@ -26,7 +26,7 @@ interface I extends B { >B : Symbol(B, Decl(multiExtendsSplitInterfaces2.ts, 6, 1)) i2: number; ->i2 : Symbol(i2, Decl(multiExtendsSplitInterfaces2.ts, 12, 23)) +>i2 : Symbol(I.i2, Decl(multiExtendsSplitInterfaces2.ts, 12, 23)) } var i: I; diff --git a/tests/baselines/reference/multiImportExport.symbols b/tests/baselines/reference/multiImportExport.symbols index 45b59752b2a..e4bac0d7662 100644 --- a/tests/baselines/reference/multiImportExport.symbols +++ b/tests/baselines/reference/multiImportExport.symbols @@ -35,7 +35,7 @@ class Adder { >Adder : Symbol(Adder, Decl(Adder.ts, 0, 0)) add(a: number, b: number) { ->add : Symbol(add, Decl(Adder.ts, 0, 13)) +>add : Symbol(Adder.add, Decl(Adder.ts, 0, 13)) >a : Symbol(a, Decl(Adder.ts, 1, 8)) >b : Symbol(b, Decl(Adder.ts, 1, 18)) diff --git a/tests/baselines/reference/multiModuleClodule1.symbols b/tests/baselines/reference/multiModuleClodule1.symbols index 8f83e58ed26..7fdbd064e3d 100644 --- a/tests/baselines/reference/multiModuleClodule1.symbols +++ b/tests/baselines/reference/multiModuleClodule1.symbols @@ -6,10 +6,10 @@ class C { >x : Symbol(x, Decl(multiModuleClodule1.ts, 1, 16)) foo() { } ->foo : Symbol(foo, Decl(multiModuleClodule1.ts, 1, 30)) +>foo : Symbol(C.foo, Decl(multiModuleClodule1.ts, 1, 30)) bar() { } ->bar : Symbol(bar, Decl(multiModuleClodule1.ts, 2, 13)) +>bar : Symbol(C.bar, Decl(multiModuleClodule1.ts, 2, 13)) static boo() { } >boo : Symbol(C.boo, Decl(multiModuleClodule1.ts, 3, 13)) diff --git a/tests/baselines/reference/multipleNumericIndexers.errors.txt b/tests/baselines/reference/multipleNumericIndexers.errors.txt index 856fdbe47ff..82fc444ac65 100644 --- a/tests/baselines/reference/multipleNumericIndexers.errors.txt +++ b/tests/baselines/reference/multipleNumericIndexers.errors.txt @@ -3,7 +3,7 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/multipleNumericI tests/cases/conformance/types/objectTypeLiteral/indexSignatures/multipleNumericIndexers.ts(15,5): error TS2375: Duplicate number index signature. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/multipleNumericIndexers.ts(20,5): error TS2375: Duplicate number index signature. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/multipleNumericIndexers.ts(25,5): error TS2375: Duplicate number index signature. -tests/cases/conformance/types/objectTypeLiteral/indexSignatures/multipleNumericIndexers.ts(28,11): error TS2428: All declarations of an interface must have identical type parameters. +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/multipleNumericIndexers.ts(28,11): error TS2428: All declarations of 'I' must have identical type parameters. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/multipleNumericIndexers.ts(29,5): error TS2375: Duplicate number index signature. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/multipleNumericIndexers.ts(30,5): error TS2375: Duplicate number index signature. @@ -48,7 +48,7 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/multipleNumericI interface I { ~ -!!! error TS2428: All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations of 'I' must have identical type parameters. [x: number]: string; ~~~~~~~~~~~~~~~~~~~~ !!! error TS2375: Duplicate number index signature. diff --git a/tests/baselines/reference/mutrec.symbols b/tests/baselines/reference/mutrec.symbols index 2a24cc4c65e..c4bf8753373 100644 --- a/tests/baselines/reference/mutrec.symbols +++ b/tests/baselines/reference/mutrec.symbols @@ -3,7 +3,7 @@ interface A { >A : Symbol(A, Decl(mutrec.ts, 0, 0)) x:B[]; ->x : Symbol(x, Decl(mutrec.ts, 0, 13)) +>x : Symbol(A.x, Decl(mutrec.ts, 0, 13)) >B : Symbol(B, Decl(mutrec.ts, 2, 1)) } @@ -11,7 +11,7 @@ interface B { >B : Symbol(B, Decl(mutrec.ts, 2, 1)) x:A[]; ->x : Symbol(x, Decl(mutrec.ts, 4, 13)) +>x : Symbol(B.x, Decl(mutrec.ts, 4, 13)) >A : Symbol(A, Decl(mutrec.ts, 0, 0)) } @@ -33,7 +33,7 @@ interface I1 { >I1 : Symbol(I1, Decl(mutrec.ts, 10, 5)) y:I2; ->y : Symbol(y, Decl(mutrec.ts, 12, 14)) +>y : Symbol(I1.y, Decl(mutrec.ts, 12, 14)) >I2 : Symbol(I2, Decl(mutrec.ts, 14, 1)) } @@ -41,7 +41,7 @@ interface I2 { >I2 : Symbol(I2, Decl(mutrec.ts, 14, 1)) y:I3; ->y : Symbol(y, Decl(mutrec.ts, 16, 14)) +>y : Symbol(I2.y, Decl(mutrec.ts, 16, 14)) >I3 : Symbol(I3, Decl(mutrec.ts, 18, 1)) } @@ -49,7 +49,7 @@ interface I3 { >I3 : Symbol(I3, Decl(mutrec.ts, 18, 1)) y:I1; ->y : Symbol(y, Decl(mutrec.ts, 20, 14)) +>y : Symbol(I3.y, Decl(mutrec.ts, 20, 14)) >I1 : Symbol(I1, Decl(mutrec.ts, 10, 5)) } @@ -79,7 +79,7 @@ interface I4 { >I4 : Symbol(I4, Decl(mutrec.ts, 28, 6)) y:I5; ->y : Symbol(y, Decl(mutrec.ts, 30, 14)) +>y : Symbol(I4.y, Decl(mutrec.ts, 30, 14)) >I5 : Symbol(I5, Decl(mutrec.ts, 32, 1)) } @@ -87,7 +87,7 @@ interface I5 { >I5 : Symbol(I5, Decl(mutrec.ts, 32, 1)) y:I4; ->y : Symbol(y, Decl(mutrec.ts, 34, 14)) +>y : Symbol(I5.y, Decl(mutrec.ts, 34, 14)) >I4 : Symbol(I4, Decl(mutrec.ts, 28, 6)) } diff --git a/tests/baselines/reference/mutuallyRecursiveGenericBaseTypes1.symbols b/tests/baselines/reference/mutuallyRecursiveGenericBaseTypes1.symbols index 67871a590cb..6d42a8c83f9 100644 --- a/tests/baselines/reference/mutuallyRecursiveGenericBaseTypes1.symbols +++ b/tests/baselines/reference/mutuallyRecursiveGenericBaseTypes1.symbols @@ -4,15 +4,15 @@ interface A { >T : Symbol(T, Decl(mutuallyRecursiveGenericBaseTypes1.ts, 0, 12)) foo(): B; // instead of B does see this ->foo : Symbol(foo, Decl(mutuallyRecursiveGenericBaseTypes1.ts, 0, 16), Decl(mutuallyRecursiveGenericBaseTypes1.ts, 1, 16)) +>foo : Symbol(A.foo, Decl(mutuallyRecursiveGenericBaseTypes1.ts, 0, 16), Decl(mutuallyRecursiveGenericBaseTypes1.ts, 1, 16)) >B : Symbol(B, Decl(mutuallyRecursiveGenericBaseTypes1.ts, 5, 1)) >T : Symbol(T, Decl(mutuallyRecursiveGenericBaseTypes1.ts, 0, 12)) foo(): void; // instead of B does see this ->foo : Symbol(foo, Decl(mutuallyRecursiveGenericBaseTypes1.ts, 0, 16), Decl(mutuallyRecursiveGenericBaseTypes1.ts, 1, 16)) +>foo : Symbol(A.foo, Decl(mutuallyRecursiveGenericBaseTypes1.ts, 0, 16), Decl(mutuallyRecursiveGenericBaseTypes1.ts, 1, 16)) foo2(): B; ->foo2 : Symbol(foo2, Decl(mutuallyRecursiveGenericBaseTypes1.ts, 2, 16)) +>foo2 : Symbol(A.foo2, Decl(mutuallyRecursiveGenericBaseTypes1.ts, 2, 16)) >B : Symbol(B, Decl(mutuallyRecursiveGenericBaseTypes1.ts, 5, 1)) } @@ -23,7 +23,7 @@ interface B extends A { >T : Symbol(T, Decl(mutuallyRecursiveGenericBaseTypes1.ts, 7, 12)) bar(): void; ->bar : Symbol(bar, Decl(mutuallyRecursiveGenericBaseTypes1.ts, 7, 29)) +>bar : Symbol(B.bar, Decl(mutuallyRecursiveGenericBaseTypes1.ts, 7, 29)) } var b: B; diff --git a/tests/baselines/reference/mutuallyRecursiveGenericBaseTypes2.symbols b/tests/baselines/reference/mutuallyRecursiveGenericBaseTypes2.symbols index d66f6a0c66f..11d5535a6a7 100644 --- a/tests/baselines/reference/mutuallyRecursiveGenericBaseTypes2.symbols +++ b/tests/baselines/reference/mutuallyRecursiveGenericBaseTypes2.symbols @@ -4,7 +4,7 @@ class foo >T : Symbol(T, Decl(mutuallyRecursiveGenericBaseTypes2.ts, 0, 10)) { bar(): foo2 { return null; } ->bar : Symbol(bar, Decl(mutuallyRecursiveGenericBaseTypes2.ts, 1, 1)) +>bar : Symbol(foo.bar, Decl(mutuallyRecursiveGenericBaseTypes2.ts, 1, 1)) >foo2 : Symbol(foo2, Decl(mutuallyRecursiveGenericBaseTypes2.ts, 3, 1)) >T : Symbol(T, Decl(mutuallyRecursiveGenericBaseTypes2.ts, 0, 10)) } diff --git a/tests/baselines/reference/nameCollision.symbols b/tests/baselines/reference/nameCollision.symbols index 064726e21fa..bd14bc6a95f 100644 --- a/tests/baselines/reference/nameCollision.symbols +++ b/tests/baselines/reference/nameCollision.symbols @@ -27,7 +27,7 @@ module B { >B : Symbol(B, Decl(nameCollision.ts, 11, 10)) name: string; ->name : Symbol(name, Decl(nameCollision.ts, 14, 13)) +>name : Symbol(B.name, Decl(nameCollision.ts, 14, 13)) } } @@ -80,7 +80,7 @@ module D { >D : Symbol(D, Decl(nameCollision.ts, 39, 10)) id: number; ->id : Symbol(id, Decl(nameCollision.ts, 40, 24)) +>id : Symbol(D.id, Decl(nameCollision.ts, 40, 24)) } export var E = 'hello'; diff --git a/tests/baselines/reference/namedFunctionExpressionAssignedToClassProperty.symbols b/tests/baselines/reference/namedFunctionExpressionAssignedToClassProperty.symbols index 707bc64571f..d75eb3c5303 100644 --- a/tests/baselines/reference/namedFunctionExpressionAssignedToClassProperty.symbols +++ b/tests/baselines/reference/namedFunctionExpressionAssignedToClassProperty.symbols @@ -3,7 +3,7 @@ class Foo{ >Foo : Symbol(Foo, Decl(namedFunctionExpressionAssignedToClassProperty.ts, 0, 0)) a = function bar(){ ->a : Symbol(a, Decl(namedFunctionExpressionAssignedToClassProperty.ts, 0, 10)) +>a : Symbol(Foo.a, Decl(namedFunctionExpressionAssignedToClassProperty.ts, 0, 10)) >bar : Symbol(bar, Decl(namedFunctionExpressionAssignedToClassProperty.ts, 2, 10)) }; // this shouldn't crash the compiler... diff --git a/tests/baselines/reference/narrowTypeByInstanceof.symbols b/tests/baselines/reference/narrowTypeByInstanceof.symbols index 3e620fd105c..994327ab21c 100644 --- a/tests/baselines/reference/narrowTypeByInstanceof.symbols +++ b/tests/baselines/reference/narrowTypeByInstanceof.symbols @@ -3,7 +3,7 @@ >Match : Symbol(Match, Decl(narrowTypeByInstanceof.ts, 0, 0)) public range(): any { ->range : Symbol(range, Decl(narrowTypeByInstanceof.ts, 0, 17)) +>range : Symbol(Match.range, Decl(narrowTypeByInstanceof.ts, 0, 17)) return undefined; >undefined : Symbol(undefined) @@ -14,7 +14,7 @@ >FileMatch : Symbol(FileMatch, Decl(narrowTypeByInstanceof.ts, 4, 5)) public resource(): any { ->resource : Symbol(resource, Decl(narrowTypeByInstanceof.ts, 6, 21)) +>resource : Symbol(FileMatch.resource, Decl(narrowTypeByInstanceof.ts, 6, 21)) return undefined; >undefined : Symbol(undefined) diff --git a/tests/baselines/reference/narrowingOfDottedNames.js b/tests/baselines/reference/narrowingOfDottedNames.js new file mode 100644 index 00000000000..14cdcd55631 --- /dev/null +++ b/tests/baselines/reference/narrowingOfDottedNames.js @@ -0,0 +1,80 @@ +//// [narrowingOfDottedNames.ts] +// Repro from #8383 + +class A { + prop: { a: string; }; +} + +class B { + prop: { b: string; } +} + +function isA(x: any): x is A { + return x instanceof A; +} + +function isB(x: any): x is B { + return x instanceof B; +} + +function f1(x: A | B) { + while (true) { + if (x instanceof A) { + x.prop.a; + } + else if (x instanceof B) { + x.prop.b; + } + } +} + +function f2(x: A | B) { + while (true) { + if (isA(x)) { + x.prop.a; + } + else if (isB(x)) { + x.prop.b; + } + } +} + + +//// [narrowingOfDottedNames.js] +// Repro from #8383 +var A = (function () { + function A() { + } + return A; +}()); +var B = (function () { + function B() { + } + return B; +}()); +function isA(x) { + return x instanceof A; +} +function isB(x) { + return x instanceof B; +} +function f1(x) { + while (true) { + if (x instanceof A) { + x.prop.a; + } + else if (x instanceof B) { + x.prop.b; + } + } +} +function f2(x) { + while (true) { + if (isA(x)) { + x.prop.a; + } + else if (isB(x)) { + x.prop.b; + } + } +} diff --git a/tests/baselines/reference/narrowingOfDottedNames.symbols b/tests/baselines/reference/narrowingOfDottedNames.symbols new file mode 100644 index 00000000000..98f75372a4e --- /dev/null +++ b/tests/baselines/reference/narrowingOfDottedNames.symbols @@ -0,0 +1,105 @@ +=== tests/cases/compiler/narrowingOfDottedNames.ts === +// Repro from #8383 + +class A { +>A : Symbol(A, Decl(narrowingOfDottedNames.ts, 0, 0)) + + prop: { a: string; }; +>prop : Symbol(A.prop, Decl(narrowingOfDottedNames.ts, 2, 9)) +>a : Symbol(a, Decl(narrowingOfDottedNames.ts, 3, 11)) +} + +class B { +>B : Symbol(B, Decl(narrowingOfDottedNames.ts, 4, 1)) + + prop: { b: string; } +>prop : Symbol(B.prop, Decl(narrowingOfDottedNames.ts, 6, 9)) +>b : Symbol(b, Decl(narrowingOfDottedNames.ts, 7, 11)) +} + +function isA(x: any): x is A { +>isA : Symbol(isA, Decl(narrowingOfDottedNames.ts, 8, 1)) +>x : Symbol(x, Decl(narrowingOfDottedNames.ts, 10, 13)) +>x : Symbol(x, Decl(narrowingOfDottedNames.ts, 10, 13)) +>A : Symbol(A, Decl(narrowingOfDottedNames.ts, 0, 0)) + + return x instanceof A; +>x : Symbol(x, Decl(narrowingOfDottedNames.ts, 10, 13)) +>A : Symbol(A, Decl(narrowingOfDottedNames.ts, 0, 0)) +} + +function isB(x: any): x is B { +>isB : Symbol(isB, Decl(narrowingOfDottedNames.ts, 12, 1)) +>x : Symbol(x, Decl(narrowingOfDottedNames.ts, 14, 13)) +>x : Symbol(x, Decl(narrowingOfDottedNames.ts, 14, 13)) +>B : Symbol(B, Decl(narrowingOfDottedNames.ts, 4, 1)) + + return x instanceof B; +>x : Symbol(x, Decl(narrowingOfDottedNames.ts, 14, 13)) +>B : Symbol(B, Decl(narrowingOfDottedNames.ts, 4, 1)) +} + +function f1(x: A | B) { +>f1 : Symbol(f1, Decl(narrowingOfDottedNames.ts, 16, 1)) +>x : Symbol(x, Decl(narrowingOfDottedNames.ts, 18, 12)) +>A : Symbol(A, Decl(narrowingOfDottedNames.ts, 0, 0)) +>B : Symbol(B, Decl(narrowingOfDottedNames.ts, 4, 1)) + + while (true) { + if (x instanceof A) { +>x : Symbol(x, Decl(narrowingOfDottedNames.ts, 18, 12)) +>A : Symbol(A, Decl(narrowingOfDottedNames.ts, 0, 0)) + + x.prop.a; +>x.prop.a : Symbol(a, Decl(narrowingOfDottedNames.ts, 3, 11)) +>x.prop : Symbol(A.prop, Decl(narrowingOfDottedNames.ts, 2, 9)) +>x : Symbol(x, Decl(narrowingOfDottedNames.ts, 18, 12)) +>prop : Symbol(A.prop, Decl(narrowingOfDottedNames.ts, 2, 9)) +>a : Symbol(a, Decl(narrowingOfDottedNames.ts, 3, 11)) + } + else if (x instanceof B) { +>x : Symbol(x, Decl(narrowingOfDottedNames.ts, 18, 12)) +>B : Symbol(B, Decl(narrowingOfDottedNames.ts, 4, 1)) + + x.prop.b; +>x.prop.b : Symbol(b, Decl(narrowingOfDottedNames.ts, 7, 11)) +>x.prop : Symbol(B.prop, Decl(narrowingOfDottedNames.ts, 6, 9)) +>x : Symbol(x, Decl(narrowingOfDottedNames.ts, 18, 12)) +>prop : Symbol(B.prop, Decl(narrowingOfDottedNames.ts, 6, 9)) +>b : Symbol(b, Decl(narrowingOfDottedNames.ts, 7, 11)) + } + } +} + +function f2(x: A | B) { +>f2 : Symbol(f2, Decl(narrowingOfDottedNames.ts, 27, 1)) +>x : Symbol(x, Decl(narrowingOfDottedNames.ts, 29, 12)) +>A : Symbol(A, Decl(narrowingOfDottedNames.ts, 0, 0)) +>B : Symbol(B, Decl(narrowingOfDottedNames.ts, 4, 1)) + + while (true) { + if (isA(x)) { +>isA : Symbol(isA, Decl(narrowingOfDottedNames.ts, 8, 1)) +>x : Symbol(x, Decl(narrowingOfDottedNames.ts, 29, 12)) + + x.prop.a; +>x.prop.a : Symbol(a, Decl(narrowingOfDottedNames.ts, 3, 11)) +>x.prop : Symbol(A.prop, Decl(narrowingOfDottedNames.ts, 2, 9)) +>x : Symbol(x, Decl(narrowingOfDottedNames.ts, 29, 12)) +>prop : Symbol(A.prop, Decl(narrowingOfDottedNames.ts, 2, 9)) +>a : Symbol(a, Decl(narrowingOfDottedNames.ts, 3, 11)) + } + else if (isB(x)) { +>isB : Symbol(isB, Decl(narrowingOfDottedNames.ts, 12, 1)) +>x : Symbol(x, Decl(narrowingOfDottedNames.ts, 29, 12)) + + x.prop.b; +>x.prop.b : Symbol(b, Decl(narrowingOfDottedNames.ts, 7, 11)) +>x.prop : Symbol(B.prop, Decl(narrowingOfDottedNames.ts, 6, 9)) +>x : Symbol(x, Decl(narrowingOfDottedNames.ts, 29, 12)) +>prop : Symbol(B.prop, Decl(narrowingOfDottedNames.ts, 6, 9)) +>b : Symbol(b, Decl(narrowingOfDottedNames.ts, 7, 11)) + } + } +} + diff --git a/tests/baselines/reference/narrowingOfDottedNames.types b/tests/baselines/reference/narrowingOfDottedNames.types new file mode 100644 index 00000000000..9ab15afbd08 --- /dev/null +++ b/tests/baselines/reference/narrowingOfDottedNames.types @@ -0,0 +1,115 @@ +=== tests/cases/compiler/narrowingOfDottedNames.ts === +// Repro from #8383 + +class A { +>A : A + + prop: { a: string; }; +>prop : { a: string; } +>a : string +} + +class B { +>B : B + + prop: { b: string; } +>prop : { b: string; } +>b : string +} + +function isA(x: any): x is A { +>isA : (x: any) => x is A +>x : any +>x : any +>A : A + + return x instanceof A; +>x instanceof A : boolean +>x : any +>A : typeof A +} + +function isB(x: any): x is B { +>isB : (x: any) => x is B +>x : any +>x : any +>B : B + + return x instanceof B; +>x instanceof B : boolean +>x : any +>B : typeof B +} + +function f1(x: A | B) { +>f1 : (x: A | B) => never +>x : A | B +>A : A +>B : B + + while (true) { +>true : boolean + + if (x instanceof A) { +>x instanceof A : boolean +>x : A | B +>A : typeof A + + x.prop.a; +>x.prop.a : string +>x.prop : { a: string; } +>x : A +>prop : { a: string; } +>a : string + } + else if (x instanceof B) { +>x instanceof B : boolean +>x : B +>B : typeof B + + x.prop.b; +>x.prop.b : string +>x.prop : { b: string; } +>x : B +>prop : { b: string; } +>b : string + } + } +} + +function f2(x: A | B) { +>f2 : (x: A | B) => never +>x : A | B +>A : A +>B : B + + while (true) { +>true : boolean + + if (isA(x)) { +>isA(x) : boolean +>isA : (x: any) => x is A +>x : A | B + + x.prop.a; +>x.prop.a : string +>x.prop : { a: string; } +>x : A +>prop : { a: string; } +>a : string + } + else if (isB(x)) { +>isB(x) : boolean +>isB : (x: any) => x is B +>x : B + + x.prop.b; +>x.prop.b : string +>x.prop : { b: string; } +>x : B +>prop : { b: string; } +>b : string + } + } +} + diff --git a/tests/baselines/reference/negateOperatorWithAnyOtherType.symbols b/tests/baselines/reference/negateOperatorWithAnyOtherType.symbols index 891fc363dbd..8c45ccfbc19 100644 --- a/tests/baselines/reference/negateOperatorWithAnyOtherType.symbols +++ b/tests/baselines/reference/negateOperatorWithAnyOtherType.symbols @@ -31,7 +31,7 @@ class A { >A : Symbol(A, Decl(negateOperatorWithAnyOtherType.ts, 11, 1)) public a: any; ->a : Symbol(a, Decl(negateOperatorWithAnyOtherType.ts, 12, 9)) +>a : Symbol(A.a, Decl(negateOperatorWithAnyOtherType.ts, 12, 9)) static foo() { >foo : Symbol(A.foo, Decl(negateOperatorWithAnyOtherType.ts, 13, 18)) diff --git a/tests/baselines/reference/negateOperatorWithBooleanType.symbols b/tests/baselines/reference/negateOperatorWithBooleanType.symbols index 55b35026b97..a7568eeafe7 100644 --- a/tests/baselines/reference/negateOperatorWithBooleanType.symbols +++ b/tests/baselines/reference/negateOperatorWithBooleanType.symbols @@ -10,7 +10,7 @@ class A { >A : Symbol(A, Decl(negateOperatorWithBooleanType.ts, 3, 40)) public a: boolean; ->a : Symbol(a, Decl(negateOperatorWithBooleanType.ts, 5, 9)) +>a : Symbol(A.a, Decl(negateOperatorWithBooleanType.ts, 5, 9)) static foo() { return false; } >foo : Symbol(A.foo, Decl(negateOperatorWithBooleanType.ts, 6, 22)) diff --git a/tests/baselines/reference/negateOperatorWithEnumType.symbols b/tests/baselines/reference/negateOperatorWithEnumType.symbols index 9d97cda0466..98af23bb121 100644 --- a/tests/baselines/reference/negateOperatorWithEnumType.symbols +++ b/tests/baselines/reference/negateOperatorWithEnumType.symbols @@ -26,7 +26,7 @@ var ResultIsNumber3 = -(ENUM1.B + ENUM1[""]); >ENUM1 : Symbol(ENUM1, Decl(negateOperatorWithEnumType.ts, 2, 14)) >B : Symbol(ENUM1.B, Decl(negateOperatorWithEnumType.ts, 3, 15)) >ENUM1 : Symbol(ENUM1, Decl(negateOperatorWithEnumType.ts, 2, 14)) ->"" : Symbol(ENUM1."", Decl(negateOperatorWithEnumType.ts, 3, 18)) +>"" : Symbol(ENUM1[""], Decl(negateOperatorWithEnumType.ts, 3, 18)) // miss assignment operators -ENUM; diff --git a/tests/baselines/reference/negateOperatorWithNumberType.symbols b/tests/baselines/reference/negateOperatorWithNumberType.symbols index 1f75d922b09..cf042284898 100644 --- a/tests/baselines/reference/negateOperatorWithNumberType.symbols +++ b/tests/baselines/reference/negateOperatorWithNumberType.symbols @@ -13,7 +13,7 @@ class A { >A : Symbol(A, Decl(negateOperatorWithNumberType.ts, 4, 36)) public a: number; ->a : Symbol(a, Decl(negateOperatorWithNumberType.ts, 6, 9)) +>a : Symbol(A.a, Decl(negateOperatorWithNumberType.ts, 6, 9)) static foo() { return 1; } >foo : Symbol(A.foo, Decl(negateOperatorWithNumberType.ts, 7, 21)) diff --git a/tests/baselines/reference/negateOperatorWithStringType.symbols b/tests/baselines/reference/negateOperatorWithStringType.symbols index 5ef0afc7e1c..497e3c7cb00 100644 --- a/tests/baselines/reference/negateOperatorWithStringType.symbols +++ b/tests/baselines/reference/negateOperatorWithStringType.symbols @@ -13,7 +13,7 @@ class A { >A : Symbol(A, Decl(negateOperatorWithStringType.ts, 4, 40)) public a: string; ->a : Symbol(a, Decl(negateOperatorWithStringType.ts, 6, 9)) +>a : Symbol(A.a, Decl(negateOperatorWithStringType.ts, 6, 9)) static foo() { return ""; } >foo : Symbol(A.foo, Decl(negateOperatorWithStringType.ts, 7, 21)) diff --git a/tests/baselines/reference/nestedBlockScopedBindings1.js b/tests/baselines/reference/nestedBlockScopedBindings1.js new file mode 100644 index 00000000000..ea2745c472e --- /dev/null +++ b/tests/baselines/reference/nestedBlockScopedBindings1.js @@ -0,0 +1,97 @@ +//// [nestedBlockScopedBindings1.ts] +function a0() { + { + let x = 1; + } + { + let x = 1; + } +} + +function a1() { + { + let x; + } + { + let x = 1; + } +} + +function a2() { + { + let x = 1; + } + { + let x; + } +} + +function a3() { + { + let x = 1; + } + switch (1) { + case 1: + let x; + break; + } +} + + +function a4() { + { + let x; + } + switch (1) { + case 1: + let x = 1; + break; + } +} + + +//// [nestedBlockScopedBindings1.js] +function a0() { + { + var x = 1; + } + { + var x = 1; + } +} +function a1() { + { + var x = void 0; + } + { + var x = 1; + } +} +function a2() { + { + var x = 1; + } + { + var x = void 0; + } +} +function a3() { + { + var x = 1; + } + switch (1) { + case 1: + var x = void 0; + break; + } +} +function a4() { + { + var x = void 0; + } + switch (1) { + case 1: + var x = 1; + break; + } +} diff --git a/tests/baselines/reference/nestedBlockScopedBindings1.symbols b/tests/baselines/reference/nestedBlockScopedBindings1.symbols new file mode 100644 index 00000000000..80348a13911 --- /dev/null +++ b/tests/baselines/reference/nestedBlockScopedBindings1.symbols @@ -0,0 +1,68 @@ +=== tests/cases/compiler/nestedBlockScopedBindings1.ts === +function a0() { +>a0 : Symbol(a0, Decl(nestedBlockScopedBindings1.ts, 0, 0)) + { + let x = 1; +>x : Symbol(x, Decl(nestedBlockScopedBindings1.ts, 2, 11)) + } + { + let x = 1; +>x : Symbol(x, Decl(nestedBlockScopedBindings1.ts, 5, 11)) + } +} + +function a1() { +>a1 : Symbol(a1, Decl(nestedBlockScopedBindings1.ts, 7, 1)) + { + let x; +>x : Symbol(x, Decl(nestedBlockScopedBindings1.ts, 11, 11)) + } + { + let x = 1; +>x : Symbol(x, Decl(nestedBlockScopedBindings1.ts, 14, 11)) + } +} + +function a2() { +>a2 : Symbol(a2, Decl(nestedBlockScopedBindings1.ts, 16, 1)) + { + let x = 1; +>x : Symbol(x, Decl(nestedBlockScopedBindings1.ts, 20, 11)) + } + { + let x; +>x : Symbol(x, Decl(nestedBlockScopedBindings1.ts, 23, 11)) + } +} + +function a3() { +>a3 : Symbol(a3, Decl(nestedBlockScopedBindings1.ts, 25, 1)) + { + let x = 1; +>x : Symbol(x, Decl(nestedBlockScopedBindings1.ts, 29, 11)) + } + switch (1) { + case 1: + let x; +>x : Symbol(x, Decl(nestedBlockScopedBindings1.ts, 33, 15)) + + break; + } +} + + +function a4() { +>a4 : Symbol(a4, Decl(nestedBlockScopedBindings1.ts, 36, 1)) + { + let x; +>x : Symbol(x, Decl(nestedBlockScopedBindings1.ts, 41, 11)) + } + switch (1) { + case 1: + let x = 1; +>x : Symbol(x, Decl(nestedBlockScopedBindings1.ts, 45, 15)) + + break; + } +} + diff --git a/tests/baselines/reference/nestedBlockScopedBindings1.types b/tests/baselines/reference/nestedBlockScopedBindings1.types new file mode 100644 index 00000000000..6d5b47a348b --- /dev/null +++ b/tests/baselines/reference/nestedBlockScopedBindings1.types @@ -0,0 +1,82 @@ +=== tests/cases/compiler/nestedBlockScopedBindings1.ts === +function a0() { +>a0 : () => void + { + let x = 1; +>x : number +>1 : number + } + { + let x = 1; +>x : number +>1 : number + } +} + +function a1() { +>a1 : () => void + { + let x; +>x : any + } + { + let x = 1; +>x : number +>1 : number + } +} + +function a2() { +>a2 : () => void + { + let x = 1; +>x : number +>1 : number + } + { + let x; +>x : any + } +} + +function a3() { +>a3 : () => void + { + let x = 1; +>x : number +>1 : number + } + switch (1) { +>1 : number + + case 1: +>1 : number + + let x; +>x : any + + break; + } +} + + +function a4() { +>a4 : () => void + { + let x; +>x : any + } + switch (1) { +>1 : number + + case 1: +>1 : number + + let x = 1; +>x : number +>1 : number + + break; + } +} + diff --git a/tests/baselines/reference/nestedBlockScopedBindings10.js b/tests/baselines/reference/nestedBlockScopedBindings10.js new file mode 100644 index 00000000000..4cac5bceeeb --- /dev/null +++ b/tests/baselines/reference/nestedBlockScopedBindings10.js @@ -0,0 +1,24 @@ +//// [nestedBlockScopedBindings10.ts] +{ + let x; + x = 1; +} + +switch (1) { + case 1: + let y; + y = 1; + break; +} + +//// [nestedBlockScopedBindings10.js] +{ + var x = void 0; + x = 1; +} +switch (1) { + case 1: + var y = void 0; + y = 1; + break; +} diff --git a/tests/baselines/reference/nestedBlockScopedBindings10.symbols b/tests/baselines/reference/nestedBlockScopedBindings10.symbols new file mode 100644 index 00000000000..a569e1b1f92 --- /dev/null +++ b/tests/baselines/reference/nestedBlockScopedBindings10.symbols @@ -0,0 +1,19 @@ +=== tests/cases/compiler/nestedBlockScopedBindings10.ts === +{ + let x; +>x : Symbol(x, Decl(nestedBlockScopedBindings10.ts, 1, 7)) + + x = 1; +>x : Symbol(x, Decl(nestedBlockScopedBindings10.ts, 1, 7)) +} + +switch (1) { + case 1: + let y; +>y : Symbol(y, Decl(nestedBlockScopedBindings10.ts, 7, 11)) + + y = 1; +>y : Symbol(y, Decl(nestedBlockScopedBindings10.ts, 7, 11)) + + break; +} diff --git a/tests/baselines/reference/nestedBlockScopedBindings10.types b/tests/baselines/reference/nestedBlockScopedBindings10.types new file mode 100644 index 00000000000..ee2701cdcf1 --- /dev/null +++ b/tests/baselines/reference/nestedBlockScopedBindings10.types @@ -0,0 +1,27 @@ +=== tests/cases/compiler/nestedBlockScopedBindings10.ts === +{ + let x; +>x : any + + x = 1; +>x = 1 : number +>x : any +>1 : number +} + +switch (1) { +>1 : number + + case 1: +>1 : number + + let y; +>y : any + + y = 1; +>y = 1 : number +>y : any +>1 : number + + break; +} diff --git a/tests/baselines/reference/nestedBlockScopedBindings11.js b/tests/baselines/reference/nestedBlockScopedBindings11.js new file mode 100644 index 00000000000..23a536bcbb1 --- /dev/null +++ b/tests/baselines/reference/nestedBlockScopedBindings11.js @@ -0,0 +1,28 @@ +//// [nestedBlockScopedBindings11.ts] +var x; +{ + let x; + () => x; +} + +var y; +switch (1) { + case 1: + let y; + () => y; + break; +} + +//// [nestedBlockScopedBindings11.js] +var x; +{ + var x_1; + (function () { return x_1; }); +} +var y; +switch (1) { + case 1: + var y_1; + (function () { return y_1; }); + break; +} diff --git a/tests/baselines/reference/nestedBlockScopedBindings11.symbols b/tests/baselines/reference/nestedBlockScopedBindings11.symbols new file mode 100644 index 00000000000..fb3886fedee --- /dev/null +++ b/tests/baselines/reference/nestedBlockScopedBindings11.symbols @@ -0,0 +1,24 @@ +=== tests/cases/compiler/nestedBlockScopedBindings11.ts === +var x; +>x : Symbol(x, Decl(nestedBlockScopedBindings11.ts, 0, 3)) +{ + let x; +>x : Symbol(x, Decl(nestedBlockScopedBindings11.ts, 2, 7)) + + () => x; +>x : Symbol(x, Decl(nestedBlockScopedBindings11.ts, 2, 7)) +} + +var y; +>y : Symbol(y, Decl(nestedBlockScopedBindings11.ts, 6, 3)) + +switch (1) { + case 1: + let y; +>y : Symbol(y, Decl(nestedBlockScopedBindings11.ts, 9, 11)) + + () => y; +>y : Symbol(y, Decl(nestedBlockScopedBindings11.ts, 9, 11)) + + break; +} diff --git a/tests/baselines/reference/nestedBlockScopedBindings11.types b/tests/baselines/reference/nestedBlockScopedBindings11.types new file mode 100644 index 00000000000..ab7b4228278 --- /dev/null +++ b/tests/baselines/reference/nestedBlockScopedBindings11.types @@ -0,0 +1,30 @@ +=== tests/cases/compiler/nestedBlockScopedBindings11.ts === +var x; +>x : any +{ + let x; +>x : any + + () => x; +>() => x : () => any +>x : any +} + +var y; +>y : any + +switch (1) { +>1 : number + + case 1: +>1 : number + + let y; +>y : any + + () => y; +>() => y : () => any +>y : any + + break; +} diff --git a/tests/baselines/reference/nestedBlockScopedBindings12.js b/tests/baselines/reference/nestedBlockScopedBindings12.js new file mode 100644 index 00000000000..0b3e323a263 --- /dev/null +++ b/tests/baselines/reference/nestedBlockScopedBindings12.js @@ -0,0 +1,28 @@ +//// [nestedBlockScopedBindings12.ts] +var x; +{ + let x; + x = 1; +} + +var y; +switch (1) { + case 1: + let y; + y = 1; + break; +} + +//// [nestedBlockScopedBindings12.js] +var x; +{ + var x_1; + x_1 = 1; +} +var y; +switch (1) { + case 1: + var y_1; + y_1 = 1; + break; +} diff --git a/tests/baselines/reference/nestedBlockScopedBindings12.symbols b/tests/baselines/reference/nestedBlockScopedBindings12.symbols new file mode 100644 index 00000000000..bff0293e45f --- /dev/null +++ b/tests/baselines/reference/nestedBlockScopedBindings12.symbols @@ -0,0 +1,24 @@ +=== tests/cases/compiler/nestedBlockScopedBindings12.ts === +var x; +>x : Symbol(x, Decl(nestedBlockScopedBindings12.ts, 0, 3)) +{ + let x; +>x : Symbol(x, Decl(nestedBlockScopedBindings12.ts, 2, 7)) + + x = 1; +>x : Symbol(x, Decl(nestedBlockScopedBindings12.ts, 2, 7)) +} + +var y; +>y : Symbol(y, Decl(nestedBlockScopedBindings12.ts, 6, 3)) + +switch (1) { + case 1: + let y; +>y : Symbol(y, Decl(nestedBlockScopedBindings12.ts, 9, 11)) + + y = 1; +>y : Symbol(y, Decl(nestedBlockScopedBindings12.ts, 9, 11)) + + break; +} diff --git a/tests/baselines/reference/nestedBlockScopedBindings12.types b/tests/baselines/reference/nestedBlockScopedBindings12.types new file mode 100644 index 00000000000..8c1fdda0ce0 --- /dev/null +++ b/tests/baselines/reference/nestedBlockScopedBindings12.types @@ -0,0 +1,32 @@ +=== tests/cases/compiler/nestedBlockScopedBindings12.ts === +var x; +>x : any +{ + let x; +>x : any + + x = 1; +>x = 1 : number +>x : any +>1 : number +} + +var y; +>y : any + +switch (1) { +>1 : number + + case 1: +>1 : number + + let y; +>y : any + + y = 1; +>y = 1 : number +>y : any +>1 : number + + break; +} diff --git a/tests/baselines/reference/nestedBlockScopedBindings13.errors.txt b/tests/baselines/reference/nestedBlockScopedBindings13.errors.txt new file mode 100644 index 00000000000..0421583cff9 --- /dev/null +++ b/tests/baselines/reference/nestedBlockScopedBindings13.errors.txt @@ -0,0 +1,18 @@ +tests/cases/compiler/nestedBlockScopedBindings13.ts(2,5): error TS7027: Unreachable code detected. +tests/cases/compiler/nestedBlockScopedBindings13.ts(7,5): error TS7027: Unreachable code detected. + + +==== tests/cases/compiler/nestedBlockScopedBindings13.ts (2 errors) ==== + for (; false;) { + let x; + ~~~ +!!! error TS7027: Unreachable code detected. + () => x; + } + + for (; false;) { + let y; + ~~~ +!!! error TS7027: Unreachable code detected. + y = 1; + } \ No newline at end of file diff --git a/tests/baselines/reference/nestedBlockScopedBindings13.js b/tests/baselines/reference/nestedBlockScopedBindings13.js new file mode 100644 index 00000000000..86e5635df68 --- /dev/null +++ b/tests/baselines/reference/nestedBlockScopedBindings13.js @@ -0,0 +1,23 @@ +//// [nestedBlockScopedBindings13.ts] +for (; false;) { + let x; + () => x; +} + +for (; false;) { + let y; + y = 1; +} + +//// [nestedBlockScopedBindings13.js] +var _loop_1 = function() { + var x; + (function () { return x; }); +}; +for (; false;) { + _loop_1(); +} +for (; false;) { + var y = void 0; + y = 1; +} diff --git a/tests/baselines/reference/nestedBlockScopedBindings14.errors.txt b/tests/baselines/reference/nestedBlockScopedBindings14.errors.txt new file mode 100644 index 00000000000..1b5babb4c25 --- /dev/null +++ b/tests/baselines/reference/nestedBlockScopedBindings14.errors.txt @@ -0,0 +1,20 @@ +tests/cases/compiler/nestedBlockScopedBindings14.ts(3,5): error TS7027: Unreachable code detected. +tests/cases/compiler/nestedBlockScopedBindings14.ts(9,5): error TS7027: Unreachable code detected. + + +==== tests/cases/compiler/nestedBlockScopedBindings14.ts (2 errors) ==== + var x; + for (; false;) { + let x; + ~~~ +!!! error TS7027: Unreachable code detected. + () => x; + } + + var y; + for (; false;) { + let y; + ~~~ +!!! error TS7027: Unreachable code detected. + y = 1; + } \ No newline at end of file diff --git a/tests/baselines/reference/nestedBlockScopedBindings14.js b/tests/baselines/reference/nestedBlockScopedBindings14.js new file mode 100644 index 00000000000..1180f587420 --- /dev/null +++ b/tests/baselines/reference/nestedBlockScopedBindings14.js @@ -0,0 +1,27 @@ +//// [nestedBlockScopedBindings14.ts] +var x; +for (; false;) { + let x; + () => x; +} + +var y; +for (; false;) { + let y; + y = 1; +} + +//// [nestedBlockScopedBindings14.js] +var x; +var _loop_1 = function() { + var x_1; + (function () { return x_1; }); +}; +for (; false;) { + _loop_1(); +} +var y; +for (; false;) { + var y_1 = void 0; + y_1 = 1; +} diff --git a/tests/baselines/reference/nestedBlockScopedBindings15.errors.txt b/tests/baselines/reference/nestedBlockScopedBindings15.errors.txt new file mode 100644 index 00000000000..b60a502b528 --- /dev/null +++ b/tests/baselines/reference/nestedBlockScopedBindings15.errors.txt @@ -0,0 +1,46 @@ +tests/cases/compiler/nestedBlockScopedBindings15.ts(3,9): error TS7027: Unreachable code detected. +tests/cases/compiler/nestedBlockScopedBindings15.ts(10,9): error TS7027: Unreachable code detected. +tests/cases/compiler/nestedBlockScopedBindings15.ts(16,5): error TS7027: Unreachable code detected. +tests/cases/compiler/nestedBlockScopedBindings15.ts(25,5): error TS7027: Unreachable code detected. + + +==== tests/cases/compiler/nestedBlockScopedBindings15.ts (4 errors) ==== + for (; false;) { + { + let x; + ~~~ +!!! error TS7027: Unreachable code detected. + () => x; + } + } + + for (; false;) { + { + let y; + ~~~ +!!! error TS7027: Unreachable code detected. + y = 1; + } + } + + for (; false;) { + switch (1){ + ~~~~~~ +!!! error TS7027: Unreachable code detected. + case 1: + let z0; + () => z0; + break; + } + } + + for (; false;) { + switch (1){ + ~~~~~~ +!!! error TS7027: Unreachable code detected. + case 1: + let z; + z = 1; + break; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/nestedBlockScopedBindings15.js b/tests/baselines/reference/nestedBlockScopedBindings15.js new file mode 100644 index 00000000000..8e294de98e4 --- /dev/null +++ b/tests/baselines/reference/nestedBlockScopedBindings15.js @@ -0,0 +1,68 @@ +//// [nestedBlockScopedBindings15.ts] +for (; false;) { + { + let x; + () => x; + } +} + +for (; false;) { + { + let y; + y = 1; + } +} + +for (; false;) { + switch (1){ + case 1: + let z0; + () => z0; + break; + } +} + +for (; false;) { + switch (1){ + case 1: + let z; + z = 1; + break; + } +} + +//// [nestedBlockScopedBindings15.js] +var _loop_1 = function() { + { + var x_1; + (function () { return x_1; }); + } +}; +for (; false;) { + _loop_1(); +} +for (; false;) { + { + var y = void 0; + y = 1; + } +} +var _loop_2 = function() { + switch (1) { + case 1: + var z0_1; + (function () { return z0_1; }); + break; + } +}; +for (; false;) { + _loop_2(); +} +for (; false;) { + switch (1) { + case 1: + var z = void 0; + z = 1; + break; + } +} diff --git a/tests/baselines/reference/nestedBlockScopedBindings16.errors.txt b/tests/baselines/reference/nestedBlockScopedBindings16.errors.txt new file mode 100644 index 00000000000..806f58231a0 --- /dev/null +++ b/tests/baselines/reference/nestedBlockScopedBindings16.errors.txt @@ -0,0 +1,50 @@ +tests/cases/compiler/nestedBlockScopedBindings16.ts(4,9): error TS7027: Unreachable code detected. +tests/cases/compiler/nestedBlockScopedBindings16.ts(12,9): error TS7027: Unreachable code detected. +tests/cases/compiler/nestedBlockScopedBindings16.ts(19,5): error TS7027: Unreachable code detected. +tests/cases/compiler/nestedBlockScopedBindings16.ts(29,5): error TS7027: Unreachable code detected. + + +==== tests/cases/compiler/nestedBlockScopedBindings16.ts (4 errors) ==== + var x; + for (; false;) { + { + let x; + ~~~ +!!! error TS7027: Unreachable code detected. + () => x; + } + } + + var y; + for (; false;) { + { + let y; + ~~~ +!!! error TS7027: Unreachable code detected. + y = 1; + } + } + + var z0; + for (; false;) { + switch (1){ + ~~~~~~ +!!! error TS7027: Unreachable code detected. + case 1: + let z0; + () => z0; + break; + } + } + + var z; + for (; false;) { + switch (1){ + ~~~~~~ +!!! error TS7027: Unreachable code detected. + case 1: + let z; + z = 1; + break; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/nestedBlockScopedBindings16.js b/tests/baselines/reference/nestedBlockScopedBindings16.js new file mode 100644 index 00000000000..91f67d0d8f2 --- /dev/null +++ b/tests/baselines/reference/nestedBlockScopedBindings16.js @@ -0,0 +1,76 @@ +//// [nestedBlockScopedBindings16.ts] +var x; +for (; false;) { + { + let x; + () => x; + } +} + +var y; +for (; false;) { + { + let y; + y = 1; + } +} + +var z0; +for (; false;) { + switch (1){ + case 1: + let z0; + () => z0; + break; + } +} + +var z; +for (; false;) { + switch (1){ + case 1: + let z; + z = 1; + break; + } +} + +//// [nestedBlockScopedBindings16.js] +var x; +var _loop_1 = function() { + { + var x_1; + (function () { return x_1; }); + } +}; +for (; false;) { + _loop_1(); +} +var y; +for (; false;) { + { + var y_1 = void 0; + y_1 = 1; + } +} +var z0; +var _loop_2 = function() { + switch (1) { + case 1: + var z0_1; + (function () { return z0_1; }); + break; + } +}; +for (; false;) { + _loop_2(); +} +var z; +for (; false;) { + switch (1) { + case 1: + var z_1 = void 0; + z_1 = 1; + break; + } +} diff --git a/tests/baselines/reference/nestedBlockScopedBindings2.js b/tests/baselines/reference/nestedBlockScopedBindings2.js new file mode 100644 index 00000000000..f3a8d7f0f67 --- /dev/null +++ b/tests/baselines/reference/nestedBlockScopedBindings2.js @@ -0,0 +1,244 @@ +//// [nestedBlockScopedBindings2.ts] +function a0() { + { + let x = 1; + () => x; + } + { + let x = 1; + } +} + +function a1() { + { + let x; + } + { + let x = 1; + () => x; + } +} + +function a2() { + { + let x = 1; + () => x; + } + { + let x; + () => x; + } +} + + +function a3() { + { + let x = 1; + () => x; + } + switch (1) { + case 1: + let x; + () => x; + break; + } +} + + +function a4() { + { + let x; + } + switch (1) { + case 1: + let x; + () => x; + break; + } +} + + +function a5() { + { + let x; + () => x; + } + switch (1) { + case 1: + let x; + break; + } +} + +function a6() { + switch (1) { + case 1: + let x; + break; + } + switch (1) { + case 1: + let x; + break; + } +} + +function a7() { + switch (1) { + case 1: + let x; + () => x; + break; + } + switch (1) { + case 1: + let x; + break; + } +} + +function a8() { + switch (1) { + case 1: + let x; + break; + } + switch (1) { + case 1: + let x; + () => x; + break; + } +} + +function a9() { + switch (1) { + case 1: + let x; + () => x; + break; + } + switch (1) { + case 1: + let x; + () => x; + break; + } +} + + +//// [nestedBlockScopedBindings2.js] +function a0() { + { + var x_1 = 1; + (function () { return x_1; }); + } + { + var x = 1; + } +} +function a1() { + { + var x = void 0; + } + { + var x_2 = 1; + (function () { return x_2; }); + } +} +function a2() { + { + var x_3 = 1; + (function () { return x_3; }); + } + { + var x_4; + (function () { return x_4; }); + } +} +function a3() { + { + var x_5 = 1; + (function () { return x_5; }); + } + switch (1) { + case 1: + var x_6; + (function () { return x_6; }); + break; + } +} +function a4() { + { + var x = void 0; + } + switch (1) { + case 1: + var x_7; + (function () { return x_7; }); + break; + } +} +function a5() { + { + var x_8; + (function () { return x_8; }); + } + switch (1) { + case 1: + var x = void 0; + break; + } +} +function a6() { + switch (1) { + case 1: + var x = void 0; + break; + } + switch (1) { + case 1: + var x = void 0; + break; + } +} +function a7() { + switch (1) { + case 1: + var x_9; + (function () { return x_9; }); + break; + } + switch (1) { + case 1: + var x = void 0; + break; + } +} +function a8() { + switch (1) { + case 1: + var x = void 0; + break; + } + switch (1) { + case 1: + var x_10; + (function () { return x_10; }); + break; + } +} +function a9() { + switch (1) { + case 1: + var x_11; + (function () { return x_11; }); + break; + } + switch (1) { + case 1: + var x_12; + (function () { return x_12; }); + break; + } +} diff --git a/tests/baselines/reference/nestedBlockScopedBindings2.symbols b/tests/baselines/reference/nestedBlockScopedBindings2.symbols new file mode 100644 index 00000000000..e97e1539e95 --- /dev/null +++ b/tests/baselines/reference/nestedBlockScopedBindings2.symbols @@ -0,0 +1,197 @@ +=== tests/cases/compiler/nestedBlockScopedBindings2.ts === +function a0() { +>a0 : Symbol(a0, Decl(nestedBlockScopedBindings2.ts, 0, 0)) + { + let x = 1; +>x : Symbol(x, Decl(nestedBlockScopedBindings2.ts, 2, 11)) + + () => x; +>x : Symbol(x, Decl(nestedBlockScopedBindings2.ts, 2, 11)) + } + { + let x = 1; +>x : Symbol(x, Decl(nestedBlockScopedBindings2.ts, 6, 11)) + } +} + +function a1() { +>a1 : Symbol(a1, Decl(nestedBlockScopedBindings2.ts, 8, 1)) + { + let x; +>x : Symbol(x, Decl(nestedBlockScopedBindings2.ts, 12, 11)) + } + { + let x = 1; +>x : Symbol(x, Decl(nestedBlockScopedBindings2.ts, 15, 11)) + + () => x; +>x : Symbol(x, Decl(nestedBlockScopedBindings2.ts, 15, 11)) + } +} + +function a2() { +>a2 : Symbol(a2, Decl(nestedBlockScopedBindings2.ts, 18, 1)) + { + let x = 1; +>x : Symbol(x, Decl(nestedBlockScopedBindings2.ts, 22, 11)) + + () => x; +>x : Symbol(x, Decl(nestedBlockScopedBindings2.ts, 22, 11)) + } + { + let x; +>x : Symbol(x, Decl(nestedBlockScopedBindings2.ts, 26, 11)) + + () => x; +>x : Symbol(x, Decl(nestedBlockScopedBindings2.ts, 26, 11)) + } +} + + +function a3() { +>a3 : Symbol(a3, Decl(nestedBlockScopedBindings2.ts, 29, 1)) + { + let x = 1; +>x : Symbol(x, Decl(nestedBlockScopedBindings2.ts, 34, 11)) + + () => x; +>x : Symbol(x, Decl(nestedBlockScopedBindings2.ts, 34, 11)) + } + switch (1) { + case 1: + let x; +>x : Symbol(x, Decl(nestedBlockScopedBindings2.ts, 39, 15)) + + () => x; +>x : Symbol(x, Decl(nestedBlockScopedBindings2.ts, 39, 15)) + + break; + } +} + + +function a4() { +>a4 : Symbol(a4, Decl(nestedBlockScopedBindings2.ts, 43, 1)) + { + let x; +>x : Symbol(x, Decl(nestedBlockScopedBindings2.ts, 48, 11)) + } + switch (1) { + case 1: + let x; +>x : Symbol(x, Decl(nestedBlockScopedBindings2.ts, 52, 15)) + + () => x; +>x : Symbol(x, Decl(nestedBlockScopedBindings2.ts, 52, 15)) + + break; + } +} + + +function a5() { +>a5 : Symbol(a5, Decl(nestedBlockScopedBindings2.ts, 56, 1)) + { + let x; +>x : Symbol(x, Decl(nestedBlockScopedBindings2.ts, 61, 11)) + + () => x; +>x : Symbol(x, Decl(nestedBlockScopedBindings2.ts, 61, 11)) + } + switch (1) { + case 1: + let x; +>x : Symbol(x, Decl(nestedBlockScopedBindings2.ts, 66, 15)) + + break; + } +} + +function a6() { +>a6 : Symbol(a6, Decl(nestedBlockScopedBindings2.ts, 69, 1)) + + switch (1) { + case 1: + let x; +>x : Symbol(x, Decl(nestedBlockScopedBindings2.ts, 74, 15)) + + break; + } + switch (1) { + case 1: + let x; +>x : Symbol(x, Decl(nestedBlockScopedBindings2.ts, 79, 15)) + + break; + } +} + +function a7() { +>a7 : Symbol(a7, Decl(nestedBlockScopedBindings2.ts, 82, 1)) + + switch (1) { + case 1: + let x; +>x : Symbol(x, Decl(nestedBlockScopedBindings2.ts, 87, 15)) + + () => x; +>x : Symbol(x, Decl(nestedBlockScopedBindings2.ts, 87, 15)) + + break; + } + switch (1) { + case 1: + let x; +>x : Symbol(x, Decl(nestedBlockScopedBindings2.ts, 93, 15)) + + break; + } +} + +function a8() { +>a8 : Symbol(a8, Decl(nestedBlockScopedBindings2.ts, 96, 1)) + + switch (1) { + case 1: + let x; +>x : Symbol(x, Decl(nestedBlockScopedBindings2.ts, 101, 15)) + + break; + } + switch (1) { + case 1: + let x; +>x : Symbol(x, Decl(nestedBlockScopedBindings2.ts, 106, 15)) + + () => x; +>x : Symbol(x, Decl(nestedBlockScopedBindings2.ts, 106, 15)) + + break; + } +} + +function a9() { +>a9 : Symbol(a9, Decl(nestedBlockScopedBindings2.ts, 110, 1)) + + switch (1) { + case 1: + let x; +>x : Symbol(x, Decl(nestedBlockScopedBindings2.ts, 115, 15)) + + () => x; +>x : Symbol(x, Decl(nestedBlockScopedBindings2.ts, 115, 15)) + + break; + } + switch (1) { + case 1: + let x; +>x : Symbol(x, Decl(nestedBlockScopedBindings2.ts, 121, 15)) + + () => x; +>x : Symbol(x, Decl(nestedBlockScopedBindings2.ts, 121, 15)) + + break; + } +} + diff --git a/tests/baselines/reference/nestedBlockScopedBindings2.types b/tests/baselines/reference/nestedBlockScopedBindings2.types new file mode 100644 index 00000000000..adb33b4dc76 --- /dev/null +++ b/tests/baselines/reference/nestedBlockScopedBindings2.types @@ -0,0 +1,258 @@ +=== tests/cases/compiler/nestedBlockScopedBindings2.ts === +function a0() { +>a0 : () => void + { + let x = 1; +>x : number +>1 : number + + () => x; +>() => x : () => number +>x : number + } + { + let x = 1; +>x : number +>1 : number + } +} + +function a1() { +>a1 : () => void + { + let x; +>x : any + } + { + let x = 1; +>x : number +>1 : number + + () => x; +>() => x : () => number +>x : number + } +} + +function a2() { +>a2 : () => void + { + let x = 1; +>x : number +>1 : number + + () => x; +>() => x : () => number +>x : number + } + { + let x; +>x : any + + () => x; +>() => x : () => any +>x : any + } +} + + +function a3() { +>a3 : () => void + { + let x = 1; +>x : number +>1 : number + + () => x; +>() => x : () => number +>x : number + } + switch (1) { +>1 : number + + case 1: +>1 : number + + let x; +>x : any + + () => x; +>() => x : () => any +>x : any + + break; + } +} + + +function a4() { +>a4 : () => void + { + let x; +>x : any + } + switch (1) { +>1 : number + + case 1: +>1 : number + + let x; +>x : any + + () => x; +>() => x : () => any +>x : any + + break; + } +} + + +function a5() { +>a5 : () => void + { + let x; +>x : any + + () => x; +>() => x : () => any +>x : any + } + switch (1) { +>1 : number + + case 1: +>1 : number + + let x; +>x : any + + break; + } +} + +function a6() { +>a6 : () => void + + switch (1) { +>1 : number + + case 1: +>1 : number + + let x; +>x : any + + break; + } + switch (1) { +>1 : number + + case 1: +>1 : number + + let x; +>x : any + + break; + } +} + +function a7() { +>a7 : () => void + + switch (1) { +>1 : number + + case 1: +>1 : number + + let x; +>x : any + + () => x; +>() => x : () => any +>x : any + + break; + } + switch (1) { +>1 : number + + case 1: +>1 : number + + let x; +>x : any + + break; + } +} + +function a8() { +>a8 : () => void + + switch (1) { +>1 : number + + case 1: +>1 : number + + let x; +>x : any + + break; + } + switch (1) { +>1 : number + + case 1: +>1 : number + + let x; +>x : any + + () => x; +>() => x : () => any +>x : any + + break; + } +} + +function a9() { +>a9 : () => void + + switch (1) { +>1 : number + + case 1: +>1 : number + + let x; +>x : any + + () => x; +>() => x : () => any +>x : any + + break; + } + switch (1) { +>1 : number + + case 1: +>1 : number + + let x; +>x : any + + () => x; +>() => x : () => any +>x : any + + break; + } +} + diff --git a/tests/baselines/reference/nestedBlockScopedBindings3.js b/tests/baselines/reference/nestedBlockScopedBindings3.js new file mode 100644 index 00000000000..f9474381816 --- /dev/null +++ b/tests/baselines/reference/nestedBlockScopedBindings3.js @@ -0,0 +1,156 @@ +//// [nestedBlockScopedBindings3.ts] +function a0() { + { + for (let x = 0; x < 1; ) { + () => x; + } + } + { + for (let x;;) { + () => x; + } + } +} + +function a1() { + for (let x; x < 1;) { + () => x; + } + for (let x;;) { + () => x; + } +} + +function a2() { + for (let x; x < 1;) { + x = x + 1; + } + for (let x;;) { + x = x + 2; + } +} + + +function a3() { + for (let x; x < 1;) { + x = x + 1; + } + switch (1) { + case 1: + let x; + break; + } +} + +function a4() { + for (let x; x < 1;) { + x = x + 1; + () => x; + } + switch (1) { + case 1: + let x; + break; + } +} + + +function a5() { + for (let x; x < 1;) { + x = x + 1; + () => x; + } + switch (1) { + case 1: + let x; + () => x; + break; + } +} + +//// [nestedBlockScopedBindings3.js] +function a0() { + { + var _loop_1 = function(x) { + (function () { return x; }); + }; + for (var x = 0; x < 1;) { + _loop_1(x); + } + } + { + var _loop_2 = function(x) { + (function () { return x; }); + }; + for (var x = void 0;;) { + _loop_2(x); + } + } +} +function a1() { + var _loop_3 = function(x) { + (function () { return x; }); + }; + for (var x = void 0; x < 1;) { + _loop_3(x); + } + var _loop_4 = function(x) { + (function () { return x; }); + }; + for (var x = void 0;;) { + _loop_4(x); + } +} +function a2() { + for (var x = void 0; x < 1;) { + x = x + 1; + } + for (var x = void 0;;) { + x = x + 2; + } +} +function a3() { + for (var x = void 0; x < 1;) { + x = x + 1; + } + switch (1) { + case 1: + var x = void 0; + break; + } +} +function a4() { + var _loop_5 = function(x) { + x = x + 1; + (function () { return x; }); + out_x_1 = x; + }; + var out_x_1; + for (var x = void 0; x < 1;) { + _loop_5(x); + x = out_x_1; + } + switch (1) { + case 1: + var x = void 0; + break; + } +} +function a5() { + var _loop_6 = function(x) { + x = x + 1; + (function () { return x; }); + out_x_2 = x; + }; + var out_x_2; + for (var x = void 0; x < 1;) { + _loop_6(x); + x = out_x_2; + } + switch (1) { + case 1: + var x_1; + (function () { return x_1; }); + break; + } +} diff --git a/tests/baselines/reference/nestedBlockScopedBindings3.symbols b/tests/baselines/reference/nestedBlockScopedBindings3.symbols new file mode 100644 index 00000000000..160f40a0472 --- /dev/null +++ b/tests/baselines/reference/nestedBlockScopedBindings3.symbols @@ -0,0 +1,130 @@ +=== tests/cases/compiler/nestedBlockScopedBindings3.ts === +function a0() { +>a0 : Symbol(a0, Decl(nestedBlockScopedBindings3.ts, 0, 0)) + { + for (let x = 0; x < 1; ) { +>x : Symbol(x, Decl(nestedBlockScopedBindings3.ts, 2, 16)) +>x : Symbol(x, Decl(nestedBlockScopedBindings3.ts, 2, 16)) + + () => x; +>x : Symbol(x, Decl(nestedBlockScopedBindings3.ts, 2, 16)) + } + } + { + for (let x;;) { +>x : Symbol(x, Decl(nestedBlockScopedBindings3.ts, 7, 16)) + + () => x; +>x : Symbol(x, Decl(nestedBlockScopedBindings3.ts, 7, 16)) + } + } +} + +function a1() { +>a1 : Symbol(a1, Decl(nestedBlockScopedBindings3.ts, 11, 1)) + + for (let x; x < 1;) { +>x : Symbol(x, Decl(nestedBlockScopedBindings3.ts, 14, 12)) +>x : Symbol(x, Decl(nestedBlockScopedBindings3.ts, 14, 12)) + + () => x; +>x : Symbol(x, Decl(nestedBlockScopedBindings3.ts, 14, 12)) + } + for (let x;;) { +>x : Symbol(x, Decl(nestedBlockScopedBindings3.ts, 17, 12)) + + () => x; +>x : Symbol(x, Decl(nestedBlockScopedBindings3.ts, 17, 12)) + } +} + +function a2() { +>a2 : Symbol(a2, Decl(nestedBlockScopedBindings3.ts, 20, 1)) + + for (let x; x < 1;) { +>x : Symbol(x, Decl(nestedBlockScopedBindings3.ts, 23, 12)) +>x : Symbol(x, Decl(nestedBlockScopedBindings3.ts, 23, 12)) + + x = x + 1; +>x : Symbol(x, Decl(nestedBlockScopedBindings3.ts, 23, 12)) +>x : Symbol(x, Decl(nestedBlockScopedBindings3.ts, 23, 12)) + } + for (let x;;) { +>x : Symbol(x, Decl(nestedBlockScopedBindings3.ts, 26, 12)) + + x = x + 2; +>x : Symbol(x, Decl(nestedBlockScopedBindings3.ts, 26, 12)) +>x : Symbol(x, Decl(nestedBlockScopedBindings3.ts, 26, 12)) + } +} + + +function a3() { +>a3 : Symbol(a3, Decl(nestedBlockScopedBindings3.ts, 29, 1)) + + for (let x; x < 1;) { +>x : Symbol(x, Decl(nestedBlockScopedBindings3.ts, 33, 12)) +>x : Symbol(x, Decl(nestedBlockScopedBindings3.ts, 33, 12)) + + x = x + 1; +>x : Symbol(x, Decl(nestedBlockScopedBindings3.ts, 33, 12)) +>x : Symbol(x, Decl(nestedBlockScopedBindings3.ts, 33, 12)) + } + switch (1) { + case 1: + let x; +>x : Symbol(x, Decl(nestedBlockScopedBindings3.ts, 38, 15)) + + break; + } +} + +function a4() { +>a4 : Symbol(a4, Decl(nestedBlockScopedBindings3.ts, 41, 1)) + + for (let x; x < 1;) { +>x : Symbol(x, Decl(nestedBlockScopedBindings3.ts, 44, 12)) +>x : Symbol(x, Decl(nestedBlockScopedBindings3.ts, 44, 12)) + + x = x + 1; +>x : Symbol(x, Decl(nestedBlockScopedBindings3.ts, 44, 12)) +>x : Symbol(x, Decl(nestedBlockScopedBindings3.ts, 44, 12)) + + () => x; +>x : Symbol(x, Decl(nestedBlockScopedBindings3.ts, 44, 12)) + } + switch (1) { + case 1: + let x; +>x : Symbol(x, Decl(nestedBlockScopedBindings3.ts, 50, 15)) + + break; + } +} + + +function a5() { +>a5 : Symbol(a5, Decl(nestedBlockScopedBindings3.ts, 53, 1)) + + for (let x; x < 1;) { +>x : Symbol(x, Decl(nestedBlockScopedBindings3.ts, 57, 12)) +>x : Symbol(x, Decl(nestedBlockScopedBindings3.ts, 57, 12)) + + x = x + 1; +>x : Symbol(x, Decl(nestedBlockScopedBindings3.ts, 57, 12)) +>x : Symbol(x, Decl(nestedBlockScopedBindings3.ts, 57, 12)) + + () => x; +>x : Symbol(x, Decl(nestedBlockScopedBindings3.ts, 57, 12)) + } + switch (1) { + case 1: + let x; +>x : Symbol(x, Decl(nestedBlockScopedBindings3.ts, 63, 15)) + + () => x; +>x : Symbol(x, Decl(nestedBlockScopedBindings3.ts, 63, 15)) + + break; + } +} diff --git a/tests/baselines/reference/nestedBlockScopedBindings3.types b/tests/baselines/reference/nestedBlockScopedBindings3.types new file mode 100644 index 00000000000..f153a9a7cea --- /dev/null +++ b/tests/baselines/reference/nestedBlockScopedBindings3.types @@ -0,0 +1,177 @@ +=== tests/cases/compiler/nestedBlockScopedBindings3.ts === +function a0() { +>a0 : () => never + { + for (let x = 0; x < 1; ) { +>x : number +>0 : number +>x < 1 : boolean +>x : number +>1 : number + + () => x; +>() => x : () => number +>x : number + } + } + { + for (let x;;) { +>x : any + + () => x; +>() => x : () => any +>x : any + } + } +} + +function a1() { +>a1 : () => never + + for (let x; x < 1;) { +>x : any +>x < 1 : boolean +>x : any +>1 : number + + () => x; +>() => x : () => any +>x : any + } + for (let x;;) { +>x : any + + () => x; +>() => x : () => any +>x : any + } +} + +function a2() { +>a2 : () => never + + for (let x; x < 1;) { +>x : any +>x < 1 : boolean +>x : any +>1 : number + + x = x + 1; +>x = x + 1 : any +>x : any +>x + 1 : any +>x : any +>1 : number + } + for (let x;;) { +>x : any + + x = x + 2; +>x = x + 2 : any +>x : any +>x + 2 : any +>x : any +>2 : number + } +} + + +function a3() { +>a3 : () => void + + for (let x; x < 1;) { +>x : any +>x < 1 : boolean +>x : any +>1 : number + + x = x + 1; +>x = x + 1 : any +>x : any +>x + 1 : any +>x : any +>1 : number + } + switch (1) { +>1 : number + + case 1: +>1 : number + + let x; +>x : any + + break; + } +} + +function a4() { +>a4 : () => void + + for (let x; x < 1;) { +>x : any +>x < 1 : boolean +>x : any +>1 : number + + x = x + 1; +>x = x + 1 : any +>x : any +>x + 1 : any +>x : any +>1 : number + + () => x; +>() => x : () => any +>x : any + } + switch (1) { +>1 : number + + case 1: +>1 : number + + let x; +>x : any + + break; + } +} + + +function a5() { +>a5 : () => void + + for (let x; x < 1;) { +>x : any +>x < 1 : boolean +>x : any +>1 : number + + x = x + 1; +>x = x + 1 : any +>x : any +>x + 1 : any +>x : any +>1 : number + + () => x; +>() => x : () => any +>x : any + } + switch (1) { +>1 : number + + case 1: +>1 : number + + let x; +>x : any + + () => x; +>() => x : () => any +>x : any + + break; + } +} diff --git a/tests/baselines/reference/nestedBlockScopedBindings4.js b/tests/baselines/reference/nestedBlockScopedBindings4.js new file mode 100644 index 00000000000..6b391070d93 --- /dev/null +++ b/tests/baselines/reference/nestedBlockScopedBindings4.js @@ -0,0 +1,103 @@ +//// [nestedBlockScopedBindings4.ts] +function a0() { + for (let x; x < 1;) { + x = x + 1; + } + for (let x;;) { + x = x + 2; + } +} + +function a1() { + for (let x; x < 1;) { + x = x + 1; + () => x; + } + for (let x;;) { + x = x + 2; + } +} + +function a2() { + for (let x; x < 1;) { + x = x + 1; + } + for (let x;;) { + x = x + 2; + () => x; + } +} + + +function a3() { + for (let x; x < 1;) { + x = x + 1; + () => x; + } + for (let x;;) { + x = x + 2; + () => x; + } +} + +//// [nestedBlockScopedBindings4.js] +function a0() { + for (var x = void 0; x < 1;) { + x = x + 1; + } + for (var x = void 0;;) { + x = x + 2; + } +} +function a1() { + var _loop_1 = function(x) { + x = x + 1; + (function () { return x; }); + out_x_1 = x; + }; + var out_x_1; + for (var x = void 0; x < 1;) { + _loop_1(x); + x = out_x_1; + } + for (var x = void 0;;) { + x = x + 2; + } +} +function a2() { + for (var x = void 0; x < 1;) { + x = x + 1; + } + var _loop_2 = function(x) { + x = x + 2; + (function () { return x; }); + out_x_2 = x; + }; + var out_x_2; + for (var x = void 0;;) { + _loop_2(x); + x = out_x_2; + } +} +function a3() { + var _loop_3 = function(x) { + x = x + 1; + (function () { return x; }); + out_x_3 = x; + }; + var out_x_3; + for (var x = void 0; x < 1;) { + _loop_3(x); + x = out_x_3; + } + var _loop_4 = function(x) { + x = x + 2; + (function () { return x; }); + out_x_4 = x; + }; + var out_x_4; + for (var x = void 0;;) { + _loop_4(x); + x = out_x_4; + } +} diff --git a/tests/baselines/reference/nestedBlockScopedBindings4.symbols b/tests/baselines/reference/nestedBlockScopedBindings4.symbols new file mode 100644 index 00000000000..dac99d8158f --- /dev/null +++ b/tests/baselines/reference/nestedBlockScopedBindings4.symbols @@ -0,0 +1,93 @@ +=== tests/cases/compiler/nestedBlockScopedBindings4.ts === +function a0() { +>a0 : Symbol(a0, Decl(nestedBlockScopedBindings4.ts, 0, 0)) + + for (let x; x < 1;) { +>x : Symbol(x, Decl(nestedBlockScopedBindings4.ts, 1, 12)) +>x : Symbol(x, Decl(nestedBlockScopedBindings4.ts, 1, 12)) + + x = x + 1; +>x : Symbol(x, Decl(nestedBlockScopedBindings4.ts, 1, 12)) +>x : Symbol(x, Decl(nestedBlockScopedBindings4.ts, 1, 12)) + } + for (let x;;) { +>x : Symbol(x, Decl(nestedBlockScopedBindings4.ts, 4, 12)) + + x = x + 2; +>x : Symbol(x, Decl(nestedBlockScopedBindings4.ts, 4, 12)) +>x : Symbol(x, Decl(nestedBlockScopedBindings4.ts, 4, 12)) + } +} + +function a1() { +>a1 : Symbol(a1, Decl(nestedBlockScopedBindings4.ts, 7, 1)) + + for (let x; x < 1;) { +>x : Symbol(x, Decl(nestedBlockScopedBindings4.ts, 10, 12)) +>x : Symbol(x, Decl(nestedBlockScopedBindings4.ts, 10, 12)) + + x = x + 1; +>x : Symbol(x, Decl(nestedBlockScopedBindings4.ts, 10, 12)) +>x : Symbol(x, Decl(nestedBlockScopedBindings4.ts, 10, 12)) + + () => x; +>x : Symbol(x, Decl(nestedBlockScopedBindings4.ts, 10, 12)) + } + for (let x;;) { +>x : Symbol(x, Decl(nestedBlockScopedBindings4.ts, 14, 12)) + + x = x + 2; +>x : Symbol(x, Decl(nestedBlockScopedBindings4.ts, 14, 12)) +>x : Symbol(x, Decl(nestedBlockScopedBindings4.ts, 14, 12)) + } +} + +function a2() { +>a2 : Symbol(a2, Decl(nestedBlockScopedBindings4.ts, 17, 1)) + + for (let x; x < 1;) { +>x : Symbol(x, Decl(nestedBlockScopedBindings4.ts, 20, 12)) +>x : Symbol(x, Decl(nestedBlockScopedBindings4.ts, 20, 12)) + + x = x + 1; +>x : Symbol(x, Decl(nestedBlockScopedBindings4.ts, 20, 12)) +>x : Symbol(x, Decl(nestedBlockScopedBindings4.ts, 20, 12)) + } + for (let x;;) { +>x : Symbol(x, Decl(nestedBlockScopedBindings4.ts, 23, 12)) + + x = x + 2; +>x : Symbol(x, Decl(nestedBlockScopedBindings4.ts, 23, 12)) +>x : Symbol(x, Decl(nestedBlockScopedBindings4.ts, 23, 12)) + + () => x; +>x : Symbol(x, Decl(nestedBlockScopedBindings4.ts, 23, 12)) + } +} + + +function a3() { +>a3 : Symbol(a3, Decl(nestedBlockScopedBindings4.ts, 27, 1)) + + for (let x; x < 1;) { +>x : Symbol(x, Decl(nestedBlockScopedBindings4.ts, 31, 12)) +>x : Symbol(x, Decl(nestedBlockScopedBindings4.ts, 31, 12)) + + x = x + 1; +>x : Symbol(x, Decl(nestedBlockScopedBindings4.ts, 31, 12)) +>x : Symbol(x, Decl(nestedBlockScopedBindings4.ts, 31, 12)) + + () => x; +>x : Symbol(x, Decl(nestedBlockScopedBindings4.ts, 31, 12)) + } + for (let x;;) { +>x : Symbol(x, Decl(nestedBlockScopedBindings4.ts, 35, 12)) + + x = x + 2; +>x : Symbol(x, Decl(nestedBlockScopedBindings4.ts, 35, 12)) +>x : Symbol(x, Decl(nestedBlockScopedBindings4.ts, 35, 12)) + + () => x; +>x : Symbol(x, Decl(nestedBlockScopedBindings4.ts, 35, 12)) + } +} diff --git a/tests/baselines/reference/nestedBlockScopedBindings4.types b/tests/baselines/reference/nestedBlockScopedBindings4.types new file mode 100644 index 00000000000..5d0ed2a1d91 --- /dev/null +++ b/tests/baselines/reference/nestedBlockScopedBindings4.types @@ -0,0 +1,129 @@ +=== tests/cases/compiler/nestedBlockScopedBindings4.ts === +function a0() { +>a0 : () => never + + for (let x; x < 1;) { +>x : any +>x < 1 : boolean +>x : any +>1 : number + + x = x + 1; +>x = x + 1 : any +>x : any +>x + 1 : any +>x : any +>1 : number + } + for (let x;;) { +>x : any + + x = x + 2; +>x = x + 2 : any +>x : any +>x + 2 : any +>x : any +>2 : number + } +} + +function a1() { +>a1 : () => never + + for (let x; x < 1;) { +>x : any +>x < 1 : boolean +>x : any +>1 : number + + x = x + 1; +>x = x + 1 : any +>x : any +>x + 1 : any +>x : any +>1 : number + + () => x; +>() => x : () => any +>x : any + } + for (let x;;) { +>x : any + + x = x + 2; +>x = x + 2 : any +>x : any +>x + 2 : any +>x : any +>2 : number + } +} + +function a2() { +>a2 : () => never + + for (let x; x < 1;) { +>x : any +>x < 1 : boolean +>x : any +>1 : number + + x = x + 1; +>x = x + 1 : any +>x : any +>x + 1 : any +>x : any +>1 : number + } + for (let x;;) { +>x : any + + x = x + 2; +>x = x + 2 : any +>x : any +>x + 2 : any +>x : any +>2 : number + + () => x; +>() => x : () => any +>x : any + } +} + + +function a3() { +>a3 : () => never + + for (let x; x < 1;) { +>x : any +>x < 1 : boolean +>x : any +>1 : number + + x = x + 1; +>x = x + 1 : any +>x : any +>x + 1 : any +>x : any +>1 : number + + () => x; +>() => x : () => any +>x : any + } + for (let x;;) { +>x : any + + x = x + 2; +>x = x + 2 : any +>x : any +>x + 2 : any +>x : any +>2 : number + + () => x; +>() => x : () => any +>x : any + } +} diff --git a/tests/baselines/reference/nestedBlockScopedBindings5.errors.txt b/tests/baselines/reference/nestedBlockScopedBindings5.errors.txt new file mode 100644 index 00000000000..a40f6a29aea --- /dev/null +++ b/tests/baselines/reference/nestedBlockScopedBindings5.errors.txt @@ -0,0 +1,92 @@ +tests/cases/compiler/nestedBlockScopedBindings5.ts(37,9): error TS7027: Unreachable code detected. +tests/cases/compiler/nestedBlockScopedBindings5.ts(54,9): error TS7027: Unreachable code detected. +tests/cases/compiler/nestedBlockScopedBindings5.ts(71,9): error TS7027: Unreachable code detected. + + +==== tests/cases/compiler/nestedBlockScopedBindings5.ts (3 errors) ==== + function a0() { + for (let x in []) { + x = x + 1; + } + for (let x;;) { + x = x + 2; + } + } + + function a1() { + for (let x in []) { + x = x + 1; + () => x; + } + for (let x;;) { + x = x + 2; + } + } + + function a2() { + for (let x in []) { + x = x + 1; + } + for (let x;;) { + x = x + 2; + () => x; + } + } + + + function a3() { + for (let x in []) { + x = x + 1; + () => x; + } + for (let x;false;) { + x = x + 2; + ~ +!!! error TS7027: Unreachable code detected. + () => x; + } + switch (1) { + case 1: + let x; + () => x; + break; + } + + } + + function a4() { + for (let x in []) { + x = x + 1; + } + for (let x;false;) { + x = x + 2; + ~ +!!! error TS7027: Unreachable code detected. + } + switch (1) { + case 1: + let x; + () => x; + break; + } + + } + + function a5() { + let y; + for (let x in []) { + x = x + 1; + } + for (let x;false;) { + x = x + 2; + ~ +!!! error TS7027: Unreachable code detected. + () => x; + } + switch (1) { + case 1: + let x; + break; + } + + } \ No newline at end of file diff --git a/tests/baselines/reference/nestedBlockScopedBindings5.js b/tests/baselines/reference/nestedBlockScopedBindings5.js new file mode 100644 index 00000000000..df4fcf76423 --- /dev/null +++ b/tests/baselines/reference/nestedBlockScopedBindings5.js @@ -0,0 +1,178 @@ +//// [nestedBlockScopedBindings5.ts] +function a0() { + for (let x in []) { + x = x + 1; + } + for (let x;;) { + x = x + 2; + } +} + +function a1() { + for (let x in []) { + x = x + 1; + () => x; + } + for (let x;;) { + x = x + 2; + } +} + +function a2() { + for (let x in []) { + x = x + 1; + } + for (let x;;) { + x = x + 2; + () => x; + } +} + + +function a3() { + for (let x in []) { + x = x + 1; + () => x; + } + for (let x;false;) { + x = x + 2; + () => x; + } + switch (1) { + case 1: + let x; + () => x; + break; + } + +} + +function a4() { + for (let x in []) { + x = x + 1; + } + for (let x;false;) { + x = x + 2; + } + switch (1) { + case 1: + let x; + () => x; + break; + } + +} + +function a5() { + let y; + for (let x in []) { + x = x + 1; + } + for (let x;false;) { + x = x + 2; + () => x; + } + switch (1) { + case 1: + let x; + break; + } + +} + +//// [nestedBlockScopedBindings5.js] +function a0() { + for (var x in []) { + x = x + 1; + } + for (var x = void 0;;) { + x = x + 2; + } +} +function a1() { + var _loop_1 = function(x) { + x = x + 1; + (function () { return x; }); + }; + for (var x in []) { + _loop_1(x); + } + for (var x = void 0;;) { + x = x + 2; + } +} +function a2() { + for (var x in []) { + x = x + 1; + } + var _loop_2 = function(x) { + x = x + 2; + (function () { return x; }); + out_x_1 = x; + }; + var out_x_1; + for (var x = void 0;;) { + _loop_2(x); + x = out_x_1; + } +} +function a3() { + var _loop_3 = function(x) { + x = x + 1; + (function () { return x; }); + }; + for (var x in []) { + _loop_3(x); + } + var _loop_4 = function(x) { + x = x + 2; + (function () { return x; }); + out_x_2 = x; + }; + var out_x_2; + for (var x = void 0; false;) { + _loop_4(x); + x = out_x_2; + } + switch (1) { + case 1: + var x_1; + (function () { return x_1; }); + break; + } +} +function a4() { + for (var x in []) { + x = x + 1; + } + for (var x = void 0; false;) { + x = x + 2; + } + switch (1) { + case 1: + var x_2; + (function () { return x_2; }); + break; + } +} +function a5() { + var y; + for (var x in []) { + x = x + 1; + } + var _loop_5 = function(x) { + x = x + 2; + (function () { return x; }); + out_x_3 = x; + }; + var out_x_3; + for (var x = void 0; false;) { + _loop_5(x); + x = out_x_3; + } + switch (1) { + case 1: + var x = void 0; + break; + } +} diff --git a/tests/baselines/reference/nestedBlockScopedBindings6.js b/tests/baselines/reference/nestedBlockScopedBindings6.js new file mode 100644 index 00000000000..be9771471e9 --- /dev/null +++ b/tests/baselines/reference/nestedBlockScopedBindings6.js @@ -0,0 +1,203 @@ +//// [nestedBlockScopedBindings6.ts] +function a0() { + for (let x of [1]) { + x = x + 1; + } + for (let x;;) { + x = x + 2; + } +} + +function a1() { + for (let x of [1]) { + x = x + 1; + () => x; + } + for (let x;;) { + x = x + 2; + } +} + +function a2() { + for (let x of [1]) { + x = x + 1; + } + for (let x;;) { + x = x + 2; + () => x; + } +} + +function a3() { + for (let x of [1]) { + x = x + 1; + () => x; + } + for (let x;;) { + x = x + 2; + () => x; + } +} + +function a4() { + for (let x of [1]) { + x = x + 1; + () => x; + } + switch (1) { + case 1: + let x; + break; + } +} + + +function a5() { + for (let x of [1]) { + x = x + 1; + } + switch (1) { + case 1: + let x; + () => x; + break; + } +} + +function a6() { + for (let x of [1]) { + x = x + 1; + } + switch (1) { + case 1: + let x; + break; + } +} + +function a7() { + for (let x of [1]) { + x = x + 1; + () => x; + } + switch (1) { + case 1: + let x; + () => x; + break; + } +} + +//// [nestedBlockScopedBindings6.js] +function a0() { + for (var _i = 0, _a = [1]; _i < _a.length; _i++) { + var x = _a[_i]; + x = x + 1; + } + for (var x = void 0;;) { + x = x + 2; + } +} +function a1() { + var _loop_1 = function(x) { + x = x + 1; + (function () { return x; }); + }; + for (var _i = 0, _a = [1]; _i < _a.length; _i++) { + var x = _a[_i]; + _loop_1(x); + } + for (var x = void 0;;) { + x = x + 2; + } +} +function a2() { + for (var _i = 0, _a = [1]; _i < _a.length; _i++) { + var x = _a[_i]; + x = x + 1; + } + var _loop_2 = function(x) { + x = x + 2; + (function () { return x; }); + out_x_1 = x; + }; + var out_x_1; + for (var x = void 0;;) { + _loop_2(x); + x = out_x_1; + } +} +function a3() { + var _loop_3 = function(x) { + x = x + 1; + (function () { return x; }); + }; + for (var _i = 0, _a = [1]; _i < _a.length; _i++) { + var x = _a[_i]; + _loop_3(x); + } + var _loop_4 = function(x) { + x = x + 2; + (function () { return x; }); + out_x_2 = x; + }; + var out_x_2; + for (var x = void 0;;) { + _loop_4(x); + x = out_x_2; + } +} +function a4() { + var _loop_5 = function(x) { + x = x + 1; + (function () { return x; }); + }; + for (var _i = 0, _a = [1]; _i < _a.length; _i++) { + var x = _a[_i]; + _loop_5(x); + } + switch (1) { + case 1: + var x = void 0; + break; + } +} +function a5() { + for (var _i = 0, _a = [1]; _i < _a.length; _i++) { + var x = _a[_i]; + x = x + 1; + } + switch (1) { + case 1: + var x_1; + (function () { return x_1; }); + break; + } +} +function a6() { + for (var _i = 0, _a = [1]; _i < _a.length; _i++) { + var x = _a[_i]; + x = x + 1; + } + switch (1) { + case 1: + var x = void 0; + break; + } +} +function a7() { + var _loop_6 = function(x) { + x = x + 1; + (function () { return x; }); + }; + for (var _i = 0, _a = [1]; _i < _a.length; _i++) { + var x = _a[_i]; + _loop_6(x); + } + switch (1) { + case 1: + var x_2; + (function () { return x_2; }); + break; + } +} diff --git a/tests/baselines/reference/nestedBlockScopedBindings6.symbols b/tests/baselines/reference/nestedBlockScopedBindings6.symbols new file mode 100644 index 00000000000..43cfcb43814 --- /dev/null +++ b/tests/baselines/reference/nestedBlockScopedBindings6.symbols @@ -0,0 +1,177 @@ +=== tests/cases/compiler/nestedBlockScopedBindings6.ts === +function a0() { +>a0 : Symbol(a0, Decl(nestedBlockScopedBindings6.ts, 0, 0)) + + for (let x of [1]) { +>x : Symbol(x, Decl(nestedBlockScopedBindings6.ts, 1, 12)) + + x = x + 1; +>x : Symbol(x, Decl(nestedBlockScopedBindings6.ts, 1, 12)) +>x : Symbol(x, Decl(nestedBlockScopedBindings6.ts, 1, 12)) + } + for (let x;;) { +>x : Symbol(x, Decl(nestedBlockScopedBindings6.ts, 4, 12)) + + x = x + 2; +>x : Symbol(x, Decl(nestedBlockScopedBindings6.ts, 4, 12)) +>x : Symbol(x, Decl(nestedBlockScopedBindings6.ts, 4, 12)) + } +} + +function a1() { +>a1 : Symbol(a1, Decl(nestedBlockScopedBindings6.ts, 7, 1)) + + for (let x of [1]) { +>x : Symbol(x, Decl(nestedBlockScopedBindings6.ts, 10, 12)) + + x = x + 1; +>x : Symbol(x, Decl(nestedBlockScopedBindings6.ts, 10, 12)) +>x : Symbol(x, Decl(nestedBlockScopedBindings6.ts, 10, 12)) + + () => x; +>x : Symbol(x, Decl(nestedBlockScopedBindings6.ts, 10, 12)) + } + for (let x;;) { +>x : Symbol(x, Decl(nestedBlockScopedBindings6.ts, 14, 12)) + + x = x + 2; +>x : Symbol(x, Decl(nestedBlockScopedBindings6.ts, 14, 12)) +>x : Symbol(x, Decl(nestedBlockScopedBindings6.ts, 14, 12)) + } +} + +function a2() { +>a2 : Symbol(a2, Decl(nestedBlockScopedBindings6.ts, 17, 1)) + + for (let x of [1]) { +>x : Symbol(x, Decl(nestedBlockScopedBindings6.ts, 20, 12)) + + x = x + 1; +>x : Symbol(x, Decl(nestedBlockScopedBindings6.ts, 20, 12)) +>x : Symbol(x, Decl(nestedBlockScopedBindings6.ts, 20, 12)) + } + for (let x;;) { +>x : Symbol(x, Decl(nestedBlockScopedBindings6.ts, 23, 12)) + + x = x + 2; +>x : Symbol(x, Decl(nestedBlockScopedBindings6.ts, 23, 12)) +>x : Symbol(x, Decl(nestedBlockScopedBindings6.ts, 23, 12)) + + () => x; +>x : Symbol(x, Decl(nestedBlockScopedBindings6.ts, 23, 12)) + } +} + +function a3() { +>a3 : Symbol(a3, Decl(nestedBlockScopedBindings6.ts, 27, 1)) + + for (let x of [1]) { +>x : Symbol(x, Decl(nestedBlockScopedBindings6.ts, 30, 12)) + + x = x + 1; +>x : Symbol(x, Decl(nestedBlockScopedBindings6.ts, 30, 12)) +>x : Symbol(x, Decl(nestedBlockScopedBindings6.ts, 30, 12)) + + () => x; +>x : Symbol(x, Decl(nestedBlockScopedBindings6.ts, 30, 12)) + } + for (let x;;) { +>x : Symbol(x, Decl(nestedBlockScopedBindings6.ts, 34, 12)) + + x = x + 2; +>x : Symbol(x, Decl(nestedBlockScopedBindings6.ts, 34, 12)) +>x : Symbol(x, Decl(nestedBlockScopedBindings6.ts, 34, 12)) + + () => x; +>x : Symbol(x, Decl(nestedBlockScopedBindings6.ts, 34, 12)) + } +} + +function a4() { +>a4 : Symbol(a4, Decl(nestedBlockScopedBindings6.ts, 38, 1)) + + for (let x of [1]) { +>x : Symbol(x, Decl(nestedBlockScopedBindings6.ts, 41, 12)) + + x = x + 1; +>x : Symbol(x, Decl(nestedBlockScopedBindings6.ts, 41, 12)) +>x : Symbol(x, Decl(nestedBlockScopedBindings6.ts, 41, 12)) + + () => x; +>x : Symbol(x, Decl(nestedBlockScopedBindings6.ts, 41, 12)) + } + switch (1) { + case 1: + let x; +>x : Symbol(x, Decl(nestedBlockScopedBindings6.ts, 47, 15)) + + break; + } +} + + +function a5() { +>a5 : Symbol(a5, Decl(nestedBlockScopedBindings6.ts, 50, 1)) + + for (let x of [1]) { +>x : Symbol(x, Decl(nestedBlockScopedBindings6.ts, 54, 12)) + + x = x + 1; +>x : Symbol(x, Decl(nestedBlockScopedBindings6.ts, 54, 12)) +>x : Symbol(x, Decl(nestedBlockScopedBindings6.ts, 54, 12)) + } + switch (1) { + case 1: + let x; +>x : Symbol(x, Decl(nestedBlockScopedBindings6.ts, 59, 15)) + + () => x; +>x : Symbol(x, Decl(nestedBlockScopedBindings6.ts, 59, 15)) + + break; + } +} + +function a6() { +>a6 : Symbol(a6, Decl(nestedBlockScopedBindings6.ts, 63, 1)) + + for (let x of [1]) { +>x : Symbol(x, Decl(nestedBlockScopedBindings6.ts, 66, 12)) + + x = x + 1; +>x : Symbol(x, Decl(nestedBlockScopedBindings6.ts, 66, 12)) +>x : Symbol(x, Decl(nestedBlockScopedBindings6.ts, 66, 12)) + } + switch (1) { + case 1: + let x; +>x : Symbol(x, Decl(nestedBlockScopedBindings6.ts, 71, 15)) + + break; + } +} + +function a7() { +>a7 : Symbol(a7, Decl(nestedBlockScopedBindings6.ts, 74, 1)) + + for (let x of [1]) { +>x : Symbol(x, Decl(nestedBlockScopedBindings6.ts, 77, 12)) + + x = x + 1; +>x : Symbol(x, Decl(nestedBlockScopedBindings6.ts, 77, 12)) +>x : Symbol(x, Decl(nestedBlockScopedBindings6.ts, 77, 12)) + + () => x; +>x : Symbol(x, Decl(nestedBlockScopedBindings6.ts, 77, 12)) + } + switch (1) { + case 1: + let x; +>x : Symbol(x, Decl(nestedBlockScopedBindings6.ts, 83, 15)) + + () => x; +>x : Symbol(x, Decl(nestedBlockScopedBindings6.ts, 83, 15)) + + break; + } +} diff --git a/tests/baselines/reference/nestedBlockScopedBindings6.types b/tests/baselines/reference/nestedBlockScopedBindings6.types new file mode 100644 index 00000000000..f6c918766ae --- /dev/null +++ b/tests/baselines/reference/nestedBlockScopedBindings6.types @@ -0,0 +1,253 @@ +=== tests/cases/compiler/nestedBlockScopedBindings6.ts === +function a0() { +>a0 : () => never + + for (let x of [1]) { +>x : number +>[1] : number[] +>1 : number + + x = x + 1; +>x = x + 1 : number +>x : number +>x + 1 : number +>x : number +>1 : number + } + for (let x;;) { +>x : any + + x = x + 2; +>x = x + 2 : any +>x : any +>x + 2 : any +>x : any +>2 : number + } +} + +function a1() { +>a1 : () => never + + for (let x of [1]) { +>x : number +>[1] : number[] +>1 : number + + x = x + 1; +>x = x + 1 : number +>x : number +>x + 1 : number +>x : number +>1 : number + + () => x; +>() => x : () => number +>x : number + } + for (let x;;) { +>x : any + + x = x + 2; +>x = x + 2 : any +>x : any +>x + 2 : any +>x : any +>2 : number + } +} + +function a2() { +>a2 : () => never + + for (let x of [1]) { +>x : number +>[1] : number[] +>1 : number + + x = x + 1; +>x = x + 1 : number +>x : number +>x + 1 : number +>x : number +>1 : number + } + for (let x;;) { +>x : any + + x = x + 2; +>x = x + 2 : any +>x : any +>x + 2 : any +>x : any +>2 : number + + () => x; +>() => x : () => any +>x : any + } +} + +function a3() { +>a3 : () => never + + for (let x of [1]) { +>x : number +>[1] : number[] +>1 : number + + x = x + 1; +>x = x + 1 : number +>x : number +>x + 1 : number +>x : number +>1 : number + + () => x; +>() => x : () => number +>x : number + } + for (let x;;) { +>x : any + + x = x + 2; +>x = x + 2 : any +>x : any +>x + 2 : any +>x : any +>2 : number + + () => x; +>() => x : () => any +>x : any + } +} + +function a4() { +>a4 : () => void + + for (let x of [1]) { +>x : number +>[1] : number[] +>1 : number + + x = x + 1; +>x = x + 1 : number +>x : number +>x + 1 : number +>x : number +>1 : number + + () => x; +>() => x : () => number +>x : number + } + switch (1) { +>1 : number + + case 1: +>1 : number + + let x; +>x : any + + break; + } +} + + +function a5() { +>a5 : () => void + + for (let x of [1]) { +>x : number +>[1] : number[] +>1 : number + + x = x + 1; +>x = x + 1 : number +>x : number +>x + 1 : number +>x : number +>1 : number + } + switch (1) { +>1 : number + + case 1: +>1 : number + + let x; +>x : any + + () => x; +>() => x : () => any +>x : any + + break; + } +} + +function a6() { +>a6 : () => void + + for (let x of [1]) { +>x : number +>[1] : number[] +>1 : number + + x = x + 1; +>x = x + 1 : number +>x : number +>x + 1 : number +>x : number +>1 : number + } + switch (1) { +>1 : number + + case 1: +>1 : number + + let x; +>x : any + + break; + } +} + +function a7() { +>a7 : () => void + + for (let x of [1]) { +>x : number +>[1] : number[] +>1 : number + + x = x + 1; +>x = x + 1 : number +>x : number +>x + 1 : number +>x : number +>1 : number + + () => x; +>() => x : () => number +>x : number + } + switch (1) { +>1 : number + + case 1: +>1 : number + + let x; +>x : any + + () => x; +>() => x : () => any +>x : any + + break; + } +} diff --git a/tests/baselines/reference/nestedBlockScopedBindings7.errors.txt b/tests/baselines/reference/nestedBlockScopedBindings7.errors.txt new file mode 100644 index 00000000000..274ef8bf6c3 --- /dev/null +++ b/tests/baselines/reference/nestedBlockScopedBindings7.errors.txt @@ -0,0 +1,16 @@ +tests/cases/compiler/nestedBlockScopedBindings7.ts(2,5): error TS7027: Unreachable code detected. +tests/cases/compiler/nestedBlockScopedBindings7.ts(6,5): error TS7027: Unreachable code detected. + + +==== tests/cases/compiler/nestedBlockScopedBindings7.ts (2 errors) ==== + for (let x; false;) { + () => x; + ~ +!!! error TS7027: Unreachable code detected. + } + + for (let y; false;) { + y = 1; + ~ +!!! error TS7027: Unreachable code detected. + } \ No newline at end of file diff --git a/tests/baselines/reference/nestedBlockScopedBindings7.js b/tests/baselines/reference/nestedBlockScopedBindings7.js new file mode 100644 index 00000000000..df0e6c52a62 --- /dev/null +++ b/tests/baselines/reference/nestedBlockScopedBindings7.js @@ -0,0 +1,19 @@ +//// [nestedBlockScopedBindings7.ts] +for (let x; false;) { + () => x; +} + +for (let y; false;) { + y = 1; +} + +//// [nestedBlockScopedBindings7.js] +var _loop_1 = function(x) { + (function () { return x; }); +}; +for (var x = void 0; false;) { + _loop_1(x); +} +for (var y = void 0; false;) { + y = 1; +} diff --git a/tests/baselines/reference/nestedBlockScopedBindings8.errors.txt b/tests/baselines/reference/nestedBlockScopedBindings8.errors.txt new file mode 100644 index 00000000000..73f580ae3cb --- /dev/null +++ b/tests/baselines/reference/nestedBlockScopedBindings8.errors.txt @@ -0,0 +1,18 @@ +tests/cases/compiler/nestedBlockScopedBindings8.ts(3,5): error TS7027: Unreachable code detected. +tests/cases/compiler/nestedBlockScopedBindings8.ts(8,5): error TS7027: Unreachable code detected. + + +==== tests/cases/compiler/nestedBlockScopedBindings8.ts (2 errors) ==== + var x; + for (let x; false; ) { + () => x; + ~ +!!! error TS7027: Unreachable code detected. + } + + var y; + for (let y; false; ) { + y = 1; + ~ +!!! error TS7027: Unreachable code detected. + } \ No newline at end of file diff --git a/tests/baselines/reference/nestedBlockScopedBindings8.js b/tests/baselines/reference/nestedBlockScopedBindings8.js new file mode 100644 index 00000000000..772dc020d6d --- /dev/null +++ b/tests/baselines/reference/nestedBlockScopedBindings8.js @@ -0,0 +1,23 @@ +//// [nestedBlockScopedBindings8.ts] +var x; +for (let x; false; ) { + () => x; +} + +var y; +for (let y; false; ) { + y = 1; +} + +//// [nestedBlockScopedBindings8.js] +var x; +var _loop_1 = function(x_1) { + (function () { return x_1; }); +}; +for (var x_1; false;) { + _loop_1(x_1); +} +var y; +for (var y_1; false;) { + y_1 = 1; +} diff --git a/tests/baselines/reference/nestedBlockScopedBindings9.js b/tests/baselines/reference/nestedBlockScopedBindings9.js new file mode 100644 index 00000000000..9f037924c68 --- /dev/null +++ b/tests/baselines/reference/nestedBlockScopedBindings9.js @@ -0,0 +1,24 @@ +//// [nestedBlockScopedBindings9.ts] +{ + let x; + () => x; +} + +switch (1) { + case 1: + let y; + () => y; + break; +} + +//// [nestedBlockScopedBindings9.js] +{ + var x_1; + (function () { return x_1; }); +} +switch (1) { + case 1: + var y_1; + (function () { return y_1; }); + break; +} diff --git a/tests/baselines/reference/nestedBlockScopedBindings9.symbols b/tests/baselines/reference/nestedBlockScopedBindings9.symbols new file mode 100644 index 00000000000..1564c9e8931 --- /dev/null +++ b/tests/baselines/reference/nestedBlockScopedBindings9.symbols @@ -0,0 +1,19 @@ +=== tests/cases/compiler/nestedBlockScopedBindings9.ts === +{ + let x; +>x : Symbol(x, Decl(nestedBlockScopedBindings9.ts, 1, 7)) + + () => x; +>x : Symbol(x, Decl(nestedBlockScopedBindings9.ts, 1, 7)) +} + +switch (1) { + case 1: + let y; +>y : Symbol(y, Decl(nestedBlockScopedBindings9.ts, 7, 11)) + + () => y; +>y : Symbol(y, Decl(nestedBlockScopedBindings9.ts, 7, 11)) + + break; +} diff --git a/tests/baselines/reference/nestedBlockScopedBindings9.types b/tests/baselines/reference/nestedBlockScopedBindings9.types new file mode 100644 index 00000000000..b889421e7dd --- /dev/null +++ b/tests/baselines/reference/nestedBlockScopedBindings9.types @@ -0,0 +1,25 @@ +=== tests/cases/compiler/nestedBlockScopedBindings9.ts === +{ + let x; +>x : any + + () => x; +>() => x : () => any +>x : any +} + +switch (1) { +>1 : number + + case 1: +>1 : number + + let y; +>y : any + + () => y; +>() => y : () => any +>y : any + + break; +} diff --git a/tests/baselines/reference/nestedGenerics.symbols b/tests/baselines/reference/nestedGenerics.symbols index 24b3e1eb89d..87ba74a503a 100644 --- a/tests/baselines/reference/nestedGenerics.symbols +++ b/tests/baselines/reference/nestedGenerics.symbols @@ -4,7 +4,7 @@ interface Foo { >T : Symbol(T, Decl(nestedGenerics.ts, 0, 14)) t: T; ->t : Symbol(t, Decl(nestedGenerics.ts, 0, 18)) +>t : Symbol(Foo.t, Decl(nestedGenerics.ts, 0, 18)) >T : Symbol(T, Decl(nestedGenerics.ts, 0, 14)) } diff --git a/tests/baselines/reference/nestedInfinitelyExpandedRecursiveTypes.symbols b/tests/baselines/reference/nestedInfinitelyExpandedRecursiveTypes.symbols index 28206f8dec2..d9fec01208e 100644 --- a/tests/baselines/reference/nestedInfinitelyExpandedRecursiveTypes.symbols +++ b/tests/baselines/reference/nestedInfinitelyExpandedRecursiveTypes.symbols @@ -4,7 +4,7 @@ interface F { >T : Symbol(T, Decl(nestedInfinitelyExpandedRecursiveTypes.ts, 0, 12)) t: G T>>; ->t : Symbol(t, Decl(nestedInfinitelyExpandedRecursiveTypes.ts, 0, 16)) +>t : Symbol(F.t, Decl(nestedInfinitelyExpandedRecursiveTypes.ts, 0, 16)) >G : Symbol(G, Decl(nestedInfinitelyExpandedRecursiveTypes.ts, 2, 1)) >F : Symbol(F, Decl(nestedInfinitelyExpandedRecursiveTypes.ts, 0, 0)) >T : Symbol(T, Decl(nestedInfinitelyExpandedRecursiveTypes.ts, 0, 12)) @@ -14,7 +14,7 @@ interface G { >U : Symbol(U, Decl(nestedInfinitelyExpandedRecursiveTypes.ts, 3, 12)) t: G U>>; ->t : Symbol(t, Decl(nestedInfinitelyExpandedRecursiveTypes.ts, 3, 16)) +>t : Symbol(G.t, Decl(nestedInfinitelyExpandedRecursiveTypes.ts, 3, 16)) >G : Symbol(G, Decl(nestedInfinitelyExpandedRecursiveTypes.ts, 2, 1)) >G : Symbol(G, Decl(nestedInfinitelyExpandedRecursiveTypes.ts, 2, 1)) >U : Symbol(U, Decl(nestedInfinitelyExpandedRecursiveTypes.ts, 3, 12)) diff --git a/tests/baselines/reference/nestedModules.symbols b/tests/baselines/reference/nestedModules.symbols index 7ff4efd30f6..642d181f2c5 100644 --- a/tests/baselines/reference/nestedModules.symbols +++ b/tests/baselines/reference/nestedModules.symbols @@ -8,10 +8,10 @@ module A.B.C { >Point : Symbol(Point, Decl(nestedModules.ts, 0, 14)) x: number; ->x : Symbol(x, Decl(nestedModules.ts, 1, 28)) +>x : Symbol(Point.x, Decl(nestedModules.ts, 1, 28)) y: number; ->y : Symbol(y, Decl(nestedModules.ts, 2, 18)) +>y : Symbol(Point.y, Decl(nestedModules.ts, 2, 18)) } } @@ -38,8 +38,8 @@ module M2.X { >Point : Symbol(Point, Decl(nestedModules.ts, 13, 13), Decl(nestedModules.ts, 21, 18)) x: number; y: number; ->x : Symbol(x, Decl(nestedModules.ts, 14, 28)) ->y : Symbol(y, Decl(nestedModules.ts, 15, 18)) +>x : Symbol(Point.x, Decl(nestedModules.ts, 14, 28)) +>y : Symbol(Point.y, Decl(nestedModules.ts, 15, 18)) } } diff --git a/tests/baselines/reference/nestedSelf.symbols b/tests/baselines/reference/nestedSelf.symbols index a14a9b9d374..50bdd9981e2 100644 --- a/tests/baselines/reference/nestedSelf.symbols +++ b/tests/baselines/reference/nestedSelf.symbols @@ -6,16 +6,16 @@ module M { >C : Symbol(C, Decl(nestedSelf.ts, 0, 10)) public n = 42; ->n : Symbol(n, Decl(nestedSelf.ts, 1, 17)) +>n : Symbol(C.n, Decl(nestedSelf.ts, 1, 17)) public foo() { [1,2,3].map((x) => { return this.n * x; })} ->foo : Symbol(foo, Decl(nestedSelf.ts, 2, 17)) +>foo : Symbol(C.foo, Decl(nestedSelf.ts, 2, 17)) >[1,2,3].map : Symbol(Array.map, Decl(lib.d.ts, --, --)) >map : Symbol(Array.map, Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(nestedSelf.ts, 3, 31)) ->this.n : Symbol(n, Decl(nestedSelf.ts, 1, 17)) +>this.n : Symbol(C.n, Decl(nestedSelf.ts, 1, 17)) >this : Symbol(C, Decl(nestedSelf.ts, 0, 10)) ->n : Symbol(n, Decl(nestedSelf.ts, 1, 17)) +>n : Symbol(C.n, Decl(nestedSelf.ts, 1, 17)) >x : Symbol(x, Decl(nestedSelf.ts, 3, 31)) } } diff --git a/tests/baselines/reference/neverType.js b/tests/baselines/reference/neverType.js new file mode 100644 index 00000000000..8c2c0293c21 --- /dev/null +++ b/tests/baselines/reference/neverType.js @@ -0,0 +1,138 @@ +//// [neverType.ts] + +function error(message: string) { + throw new Error(message); +} + +function fail() { + return error("Something failed"); +} + +function infiniteLoop() { + while (true) { + } +} + +function move1(direction: "up" | "down") { + switch (direction) { + case "up": + return 1; + case "down": + return -1; + } + return error("Should never get here"); +} + +function move2(direction: "up" | "down") { + return direction === "up" ? 1 : + direction === "down" ? -1 : + error("Should never get here"); +} + +function check(x: T | undefined) { + return x || error("Undefined value"); +} + +function f1(x: string | number) { + if (typeof x === "boolean") { + x; // never + } +} + +function f2(x: string | number) { + while (true) { + if (typeof x === "boolean") { + return x; // never + } + } +} + +function failOrThrow(shouldFail: boolean) { + if (shouldFail) { + return fail(); + } + throw new Error(); +} + +function test(cb: () => string) { + let s = cb(); + return s; +} + +let errorCallback = () => error("Error callback"); + +test(() => "hello"); +test(() => fail()); +test(() => { throw new Error(); }) +test(errorCallback); + + +//// [neverType.js] +function error(message) { + throw new Error(message); +} +function fail() { + return error("Something failed"); +} +function infiniteLoop() { + while (true) { + } +} +function move1(direction) { + switch (direction) { + case "up": + return 1; + case "down": + return -1; + } + return error("Should never get here"); +} +function move2(direction) { + return direction === "up" ? 1 : + direction === "down" ? -1 : + error("Should never get here"); +} +function check(x) { + return x || error("Undefined value"); +} +function f1(x) { + if (typeof x === "boolean") { + x; // never + } +} +function f2(x) { + while (true) { + if (typeof x === "boolean") { + return x; // never + } + } +} +function failOrThrow(shouldFail) { + if (shouldFail) { + return fail(); + } + throw new Error(); +} +function test(cb) { + var s = cb(); + return s; +} +var errorCallback = function () { return error("Error callback"); }; +test(function () { return "hello"; }); +test(function () { return fail(); }); +test(function () { throw new Error(); }); +test(errorCallback); + + +//// [neverType.d.ts] +declare function error(message: string): never; +declare function fail(): never; +declare function infiniteLoop(): never; +declare function move1(direction: "up" | "down"): number; +declare function move2(direction: "up" | "down"): number; +declare function check(x: T | undefined): T; +declare function f1(x: string | number): void; +declare function f2(x: string | number): never; +declare function failOrThrow(shouldFail: boolean): never; +declare function test(cb: () => string): string; +declare let errorCallback: () => never; diff --git a/tests/baselines/reference/neverType.symbols b/tests/baselines/reference/neverType.symbols new file mode 100644 index 00000000000..e1c4e98c24c --- /dev/null +++ b/tests/baselines/reference/neverType.symbols @@ -0,0 +1,137 @@ +=== tests/cases/conformance/types/never/neverType.ts === + +function error(message: string) { +>error : Symbol(error, Decl(neverType.ts, 0, 0)) +>message : Symbol(message, Decl(neverType.ts, 1, 15)) + + throw new Error(message); +>Error : Symbol(Error, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>message : Symbol(message, Decl(neverType.ts, 1, 15)) +} + +function fail() { +>fail : Symbol(fail, Decl(neverType.ts, 3, 1)) + + return error("Something failed"); +>error : Symbol(error, Decl(neverType.ts, 0, 0)) +} + +function infiniteLoop() { +>infiniteLoop : Symbol(infiniteLoop, Decl(neverType.ts, 7, 1)) + + while (true) { + } +} + +function move1(direction: "up" | "down") { +>move1 : Symbol(move1, Decl(neverType.ts, 12, 1)) +>direction : Symbol(direction, Decl(neverType.ts, 14, 15)) + + switch (direction) { +>direction : Symbol(direction, Decl(neverType.ts, 14, 15)) + + case "up": + return 1; + case "down": + return -1; + } + return error("Should never get here"); +>error : Symbol(error, Decl(neverType.ts, 0, 0)) +} + +function move2(direction: "up" | "down") { +>move2 : Symbol(move2, Decl(neverType.ts, 22, 1)) +>direction : Symbol(direction, Decl(neverType.ts, 24, 15)) + + return direction === "up" ? 1 : +>direction : Symbol(direction, Decl(neverType.ts, 24, 15)) + + direction === "down" ? -1 : +>direction : Symbol(direction, Decl(neverType.ts, 24, 15)) + + error("Should never get here"); +>error : Symbol(error, Decl(neverType.ts, 0, 0)) +} + +function check(x: T | undefined) { +>check : Symbol(check, Decl(neverType.ts, 28, 1)) +>T : Symbol(T, Decl(neverType.ts, 30, 15)) +>x : Symbol(x, Decl(neverType.ts, 30, 18)) +>T : Symbol(T, Decl(neverType.ts, 30, 15)) + + return x || error("Undefined value"); +>x : Symbol(x, Decl(neverType.ts, 30, 18)) +>error : Symbol(error, Decl(neverType.ts, 0, 0)) +} + +function f1(x: string | number) { +>f1 : Symbol(f1, Decl(neverType.ts, 32, 1)) +>x : Symbol(x, Decl(neverType.ts, 34, 12)) + + if (typeof x === "boolean") { +>x : Symbol(x, Decl(neverType.ts, 34, 12)) + + x; // never +>x : Symbol(x, Decl(neverType.ts, 34, 12)) + } +} + +function f2(x: string | number) { +>f2 : Symbol(f2, Decl(neverType.ts, 38, 1)) +>x : Symbol(x, Decl(neverType.ts, 40, 12)) + + while (true) { + if (typeof x === "boolean") { +>x : Symbol(x, Decl(neverType.ts, 40, 12)) + + return x; // never +>x : Symbol(x, Decl(neverType.ts, 40, 12)) + } + } +} + +function failOrThrow(shouldFail: boolean) { +>failOrThrow : Symbol(failOrThrow, Decl(neverType.ts, 46, 1)) +>shouldFail : Symbol(shouldFail, Decl(neverType.ts, 48, 21)) + + if (shouldFail) { +>shouldFail : Symbol(shouldFail, Decl(neverType.ts, 48, 21)) + + return fail(); +>fail : Symbol(fail, Decl(neverType.ts, 3, 1)) + } + throw new Error(); +>Error : Symbol(Error, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +} + +function test(cb: () => string) { +>test : Symbol(test, Decl(neverType.ts, 53, 1)) +>cb : Symbol(cb, Decl(neverType.ts, 55, 14)) + + let s = cb(); +>s : Symbol(s, Decl(neverType.ts, 56, 7)) +>cb : Symbol(cb, Decl(neverType.ts, 55, 14)) + + return s; +>s : Symbol(s, Decl(neverType.ts, 56, 7)) +} + +let errorCallback = () => error("Error callback"); +>errorCallback : Symbol(errorCallback, Decl(neverType.ts, 60, 3)) +>error : Symbol(error, Decl(neverType.ts, 0, 0)) + +test(() => "hello"); +>test : Symbol(test, Decl(neverType.ts, 53, 1)) + +test(() => fail()); +>test : Symbol(test, Decl(neverType.ts, 53, 1)) +>fail : Symbol(fail, Decl(neverType.ts, 3, 1)) + +test(() => { throw new Error(); }) +>test : Symbol(test, Decl(neverType.ts, 53, 1)) +>Error : Symbol(Error, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) + +test(errorCallback); +>test : Symbol(test, Decl(neverType.ts, 53, 1)) +>errorCallback : Symbol(errorCallback, Decl(neverType.ts, 60, 3)) + diff --git a/tests/baselines/reference/neverType.types b/tests/baselines/reference/neverType.types new file mode 100644 index 00000000000..e6b36bcbace --- /dev/null +++ b/tests/baselines/reference/neverType.types @@ -0,0 +1,189 @@ +=== tests/cases/conformance/types/never/neverType.ts === + +function error(message: string) { +>error : (message: string) => never +>message : string + + throw new Error(message); +>new Error(message) : Error +>Error : ErrorConstructor +>message : string +} + +function fail() { +>fail : () => never + + return error("Something failed"); +>error("Something failed") : never +>error : (message: string) => never +>"Something failed" : string +} + +function infiniteLoop() { +>infiniteLoop : () => never + + while (true) { +>true : boolean + } +} + +function move1(direction: "up" | "down") { +>move1 : (direction: "up" | "down") => number +>direction : "up" | "down" + + switch (direction) { +>direction : "up" | "down" + + case "up": +>"up" : string + + return 1; +>1 : number + + case "down": +>"down" : string + + return -1; +>-1 : number +>1 : number + } + return error("Should never get here"); +>error("Should never get here") : never +>error : (message: string) => never +>"Should never get here" : string +} + +function move2(direction: "up" | "down") { +>move2 : (direction: "up" | "down") => number +>direction : "up" | "down" + + return direction === "up" ? 1 : +>direction === "up" ? 1 : direction === "down" ? -1 : error("Should never get here") : number +>direction === "up" : boolean +>direction : "up" | "down" +>"up" : string +>1 : number + + direction === "down" ? -1 : +>direction === "down" ? -1 : error("Should never get here") : number +>direction === "down" : boolean +>direction : "up" | "down" +>"down" : string +>-1 : number +>1 : number + + error("Should never get here"); +>error("Should never get here") : never +>error : (message: string) => never +>"Should never get here" : string +} + +function check(x: T | undefined) { +>check : (x: T | undefined) => T +>T : T +>x : T | undefined +>T : T + + return x || error("Undefined value"); +>x || error("Undefined value") : T +>x : T | undefined +>error("Undefined value") : never +>error : (message: string) => never +>"Undefined value" : string +} + +function f1(x: string | number) { +>f1 : (x: string | number) => void +>x : string | number + + if (typeof x === "boolean") { +>typeof x === "boolean" : boolean +>typeof x : string +>x : string | number +>"boolean" : string + + x; // never +>x : never + } +} + +function f2(x: string | number) { +>f2 : (x: string | number) => never +>x : string | number + + while (true) { +>true : boolean + + if (typeof x === "boolean") { +>typeof x === "boolean" : boolean +>typeof x : string +>x : string | number +>"boolean" : string + + return x; // never +>x : never + } + } +} + +function failOrThrow(shouldFail: boolean) { +>failOrThrow : (shouldFail: boolean) => never +>shouldFail : boolean + + if (shouldFail) { +>shouldFail : boolean + + return fail(); +>fail() : never +>fail : () => never + } + throw new Error(); +>new Error() : Error +>Error : ErrorConstructor +} + +function test(cb: () => string) { +>test : (cb: () => string) => string +>cb : () => string + + let s = cb(); +>s : string +>cb() : string +>cb : () => string + + return s; +>s : string +} + +let errorCallback = () => error("Error callback"); +>errorCallback : () => never +>() => error("Error callback") : () => never +>error("Error callback") : never +>error : (message: string) => never +>"Error callback" : string + +test(() => "hello"); +>test(() => "hello") : string +>test : (cb: () => string) => string +>() => "hello" : () => string +>"hello" : string + +test(() => fail()); +>test(() => fail()) : string +>test : (cb: () => string) => string +>() => fail() : () => never +>fail() : never +>fail : () => never + +test(() => { throw new Error(); }) +>test(() => { throw new Error(); }) : string +>test : (cb: () => string) => string +>() => { throw new Error(); } : () => never +>new Error() : Error +>Error : ErrorConstructor + +test(errorCallback); +>test(errorCallback) : string +>test : (cb: () => string) => string +>errorCallback : () => never + diff --git a/tests/baselines/reference/neverTypeErrors1.errors.txt b/tests/baselines/reference/neverTypeErrors1.errors.txt new file mode 100644 index 00000000000..8fd6f9c924e --- /dev/null +++ b/tests/baselines/reference/neverTypeErrors1.errors.txt @@ -0,0 +1,50 @@ +tests/cases/conformance/types/never/neverTypeErrors1.ts(3,5): error TS2322: Type 'number' is not assignable to type 'never'. +tests/cases/conformance/types/never/neverTypeErrors1.ts(4,5): error TS2322: Type 'string' is not assignable to type 'never'. +tests/cases/conformance/types/never/neverTypeErrors1.ts(5,5): error TS2322: Type 'boolean' is not assignable to type 'never'. +tests/cases/conformance/types/never/neverTypeErrors1.ts(6,5): error TS2322: Type 'undefined' is not assignable to type 'never'. +tests/cases/conformance/types/never/neverTypeErrors1.ts(7,5): error TS2322: Type 'null' is not assignable to type 'never'. +tests/cases/conformance/types/never/neverTypeErrors1.ts(8,5): error TS2322: Type '{}' is not assignable to type 'never'. +tests/cases/conformance/types/never/neverTypeErrors1.ts(12,5): error TS2322: Type 'undefined' is not assignable to type 'never'. +tests/cases/conformance/types/never/neverTypeErrors1.ts(16,12): error TS2322: Type 'number' is not assignable to type 'never'. +tests/cases/conformance/types/never/neverTypeErrors1.ts(19,16): error TS2534: A function returning 'never' cannot have a reachable end point. + + +==== tests/cases/conformance/types/never/neverTypeErrors1.ts (9 errors) ==== + function f1() { + let x: never; + x = 1; + ~ +!!! error TS2322: Type 'number' is not assignable to type 'never'. + x = "abc"; + ~ +!!! error TS2322: Type 'string' is not assignable to type 'never'. + x = false; + ~ +!!! error TS2322: Type 'boolean' is not assignable to type 'never'. + x = undefined; + ~ +!!! error TS2322: Type 'undefined' is not assignable to type 'never'. + x = null; + ~ +!!! error TS2322: Type 'null' is not assignable to type 'never'. + x = {}; + ~ +!!! error TS2322: Type '{}' is not assignable to type 'never'. + } + + function f2(): never { + return; + ~~~~~~~ +!!! error TS2322: Type 'undefined' is not assignable to type 'never'. + } + + function f3(): never { + return 1; + ~ +!!! error TS2322: Type 'number' is not assignable to type 'never'. + } + + function f4(): never { + ~~~~~ +!!! error TS2534: A function returning 'never' cannot have a reachable end point. + } \ No newline at end of file diff --git a/tests/baselines/reference/neverTypeErrors1.js b/tests/baselines/reference/neverTypeErrors1.js new file mode 100644 index 00000000000..81b3f8f9cdb --- /dev/null +++ b/tests/baselines/reference/neverTypeErrors1.js @@ -0,0 +1,40 @@ +//// [neverTypeErrors1.ts] +function f1() { + let x: never; + x = 1; + x = "abc"; + x = false; + x = undefined; + x = null; + x = {}; +} + +function f2(): never { + return; +} + +function f3(): never { + return 1; +} + +function f4(): never { +} + +//// [neverTypeErrors1.js] +function f1() { + var x; + x = 1; + x = "abc"; + x = false; + x = undefined; + x = null; + x = {}; +} +function f2() { + return; +} +function f3() { + return 1; +} +function f4() { +} diff --git a/tests/baselines/reference/neverTypeErrors2.errors.txt b/tests/baselines/reference/neverTypeErrors2.errors.txt new file mode 100644 index 00000000000..c6292657ad1 --- /dev/null +++ b/tests/baselines/reference/neverTypeErrors2.errors.txt @@ -0,0 +1,51 @@ +tests/cases/conformance/types/never/neverTypeErrors2.ts(4,5): error TS2322: Type 'number' is not assignable to type 'never'. +tests/cases/conformance/types/never/neverTypeErrors2.ts(5,5): error TS2322: Type 'string' is not assignable to type 'never'. +tests/cases/conformance/types/never/neverTypeErrors2.ts(6,5): error TS2322: Type 'boolean' is not assignable to type 'never'. +tests/cases/conformance/types/never/neverTypeErrors2.ts(7,5): error TS2322: Type 'undefined' is not assignable to type 'never'. +tests/cases/conformance/types/never/neverTypeErrors2.ts(8,5): error TS2322: Type 'null' is not assignable to type 'never'. +tests/cases/conformance/types/never/neverTypeErrors2.ts(9,5): error TS2322: Type '{}' is not assignable to type 'never'. +tests/cases/conformance/types/never/neverTypeErrors2.ts(13,5): error TS2322: Type 'undefined' is not assignable to type 'never'. +tests/cases/conformance/types/never/neverTypeErrors2.ts(17,12): error TS2322: Type 'number' is not assignable to type 'never'. +tests/cases/conformance/types/never/neverTypeErrors2.ts(20,16): error TS2534: A function returning 'never' cannot have a reachable end point. + + +==== tests/cases/conformance/types/never/neverTypeErrors2.ts (9 errors) ==== + + function f1() { + let x: never; + x = 1; + ~ +!!! error TS2322: Type 'number' is not assignable to type 'never'. + x = "abc"; + ~ +!!! error TS2322: Type 'string' is not assignable to type 'never'. + x = false; + ~ +!!! error TS2322: Type 'boolean' is not assignable to type 'never'. + x = undefined; + ~ +!!! error TS2322: Type 'undefined' is not assignable to type 'never'. + x = null; + ~ +!!! error TS2322: Type 'null' is not assignable to type 'never'. + x = {}; + ~ +!!! error TS2322: Type '{}' is not assignable to type 'never'. + } + + function f2(): never { + return; + ~~~~~~~ +!!! error TS2322: Type 'undefined' is not assignable to type 'never'. + } + + function f3(): never { + return 1; + ~ +!!! error TS2322: Type 'number' is not assignable to type 'never'. + } + + function f4(): never { + ~~~~~ +!!! error TS2534: A function returning 'never' cannot have a reachable end point. + } \ No newline at end of file diff --git a/tests/baselines/reference/neverTypeErrors2.js b/tests/baselines/reference/neverTypeErrors2.js new file mode 100644 index 00000000000..18c92922bc1 --- /dev/null +++ b/tests/baselines/reference/neverTypeErrors2.js @@ -0,0 +1,41 @@ +//// [neverTypeErrors2.ts] + +function f1() { + let x: never; + x = 1; + x = "abc"; + x = false; + x = undefined; + x = null; + x = {}; +} + +function f2(): never { + return; +} + +function f3(): never { + return 1; +} + +function f4(): never { +} + +//// [neverTypeErrors2.js] +function f1() { + var x; + x = 1; + x = "abc"; + x = false; + x = undefined; + x = null; + x = {}; +} +function f2() { + return; +} +function f3() { + return 1; +} +function f4() { +} diff --git a/tests/baselines/reference/newArrays.symbols b/tests/baselines/reference/newArrays.symbols index 663b6380bc7..4a312365b3f 100644 --- a/tests/baselines/reference/newArrays.symbols +++ b/tests/baselines/reference/newArrays.symbols @@ -9,30 +9,30 @@ module M { >Gar : Symbol(Gar, Decl(newArrays.ts, 1, 13)) public fa: Foo[]; ->fa : Symbol(fa, Decl(newArrays.ts, 2, 12)) +>fa : Symbol(Gar.fa, Decl(newArrays.ts, 2, 12)) >Foo : Symbol(Foo, Decl(newArrays.ts, 0, 10)) public x = 10; ->x : Symbol(x, Decl(newArrays.ts, 3, 19)) +>x : Symbol(Gar.x, Decl(newArrays.ts, 3, 19)) public y = 10; ->y : Symbol(y, Decl(newArrays.ts, 4, 16)) +>y : Symbol(Gar.y, Decl(newArrays.ts, 4, 16)) public m () { ->m : Symbol(m, Decl(newArrays.ts, 5, 16)) +>m : Symbol(Gar.m, Decl(newArrays.ts, 5, 16)) this.fa = new Array(this.x * this.y); ->this.fa : Symbol(fa, Decl(newArrays.ts, 2, 12)) +>this.fa : Symbol(Gar.fa, Decl(newArrays.ts, 2, 12)) >this : Symbol(Gar, Decl(newArrays.ts, 1, 13)) ->fa : Symbol(fa, Decl(newArrays.ts, 2, 12)) +>fa : Symbol(Gar.fa, Decl(newArrays.ts, 2, 12)) >Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >Foo : Symbol(Foo, Decl(newArrays.ts, 0, 10)) ->this.x : Symbol(x, Decl(newArrays.ts, 3, 19)) +>this.x : Symbol(Gar.x, Decl(newArrays.ts, 3, 19)) >this : Symbol(Gar, Decl(newArrays.ts, 1, 13)) ->x : Symbol(x, Decl(newArrays.ts, 3, 19)) ->this.y : Symbol(y, Decl(newArrays.ts, 4, 16)) +>x : Symbol(Gar.x, Decl(newArrays.ts, 3, 19)) +>this.y : Symbol(Gar.y, Decl(newArrays.ts, 4, 16)) >this : Symbol(Gar, Decl(newArrays.ts, 1, 13)) ->y : Symbol(y, Decl(newArrays.ts, 4, 16)) +>y : Symbol(Gar.y, Decl(newArrays.ts, 4, 16)) } } } diff --git a/tests/baselines/reference/newNamesInGlobalAugmentations1.errors.txt b/tests/baselines/reference/newNamesInGlobalAugmentations1.errors.txt new file mode 100644 index 00000000000..f469885e405 --- /dev/null +++ b/tests/baselines/reference/newNamesInGlobalAugmentations1.errors.txt @@ -0,0 +1,26 @@ +tests/cases/compiler/f1.d.ts(13,5): error TS2667: Imports are not permitted in module augmentations. Consider moving them to the enclosing external module. + + +==== tests/cases/compiler/f1.d.ts (1 errors) ==== + + export {}; + + declare module M.M1 { + export let x: number; + } + declare global { + interface SymbolConstructor { + observable: symbol; + } + class Cls {x} + let [a, b]: number[]; + export import X = M.M1.x; + ~~~~~~ +!!! error TS2667: Imports are not permitted in module augmentations. Consider moving them to the enclosing external module. + } + +==== tests/cases/compiler/main.ts (0 errors) ==== + + Symbol.observable; + new Cls().x + let c = a + b + X; \ No newline at end of file diff --git a/tests/baselines/reference/newNamesInGlobalAugmentations1.js b/tests/baselines/reference/newNamesInGlobalAugmentations1.js new file mode 100644 index 00000000000..0400f4c3751 --- /dev/null +++ b/tests/baselines/reference/newNamesInGlobalAugmentations1.js @@ -0,0 +1,28 @@ +//// [tests/cases/compiler/newNamesInGlobalAugmentations1.ts] //// + +//// [f1.d.ts] + +export {}; + +declare module M.M1 { + export let x: number; +} +declare global { + interface SymbolConstructor { + observable: symbol; + } + class Cls {x} + let [a, b]: number[]; + export import X = M.M1.x; +} + +//// [main.ts] + +Symbol.observable; +new Cls().x +let c = a + b + X; + +//// [main.js] +Symbol.observable; +new Cls().x; +let c = a + b + X; diff --git a/tests/baselines/reference/newWithSpreadES5.symbols b/tests/baselines/reference/newWithSpreadES5.symbols index 021674ef337..7db4e6f1063 100644 --- a/tests/baselines/reference/newWithSpreadES5.symbols +++ b/tests/baselines/reference/newWithSpreadES5.symbols @@ -15,7 +15,7 @@ interface A { >A : Symbol(A, Decl(newWithSpreadES5.ts, 4, 30)) f: { ->f : Symbol(f, Decl(newWithSpreadES5.ts, 6, 13)) +>f : Symbol(A.f, Decl(newWithSpreadES5.ts, 6, 13)) new (x: number, y: number, ...z: string[]); >x : Symbol(x, Decl(newWithSpreadES5.ts, 8, 13)) @@ -202,61 +202,61 @@ new B(1, 2, ...a, "string"); // Property access expression new c["a-b"](1, 2, "string"); >c : Symbol(c, Decl(newWithSpreadES5.ts, 26, 3)) ->"a-b" : Symbol(C."a-b", Decl(newWithSpreadES5.ts, 16, 13)) +>"a-b" : Symbol(C["a-b"], Decl(newWithSpreadES5.ts, 16, 13)) new c["a-b"](1, 2, ...a); >c : Symbol(c, Decl(newWithSpreadES5.ts, 26, 3)) ->"a-b" : Symbol(C."a-b", Decl(newWithSpreadES5.ts, 16, 13)) +>"a-b" : Symbol(C["a-b"], Decl(newWithSpreadES5.ts, 16, 13)) >a : Symbol(a, Decl(newWithSpreadES5.ts, 24, 3)) new c["a-b"](1, 2, ...a, "string"); >c : Symbol(c, Decl(newWithSpreadES5.ts, 26, 3)) ->"a-b" : Symbol(C."a-b", Decl(newWithSpreadES5.ts, 16, 13)) +>"a-b" : Symbol(C["a-b"], Decl(newWithSpreadES5.ts, 16, 13)) >a : Symbol(a, Decl(newWithSpreadES5.ts, 24, 3)) // Parenthesised expression new (c["a-b"])(1, 2, "string"); >c : Symbol(c, Decl(newWithSpreadES5.ts, 26, 3)) ->"a-b" : Symbol(C."a-b", Decl(newWithSpreadES5.ts, 16, 13)) +>"a-b" : Symbol(C["a-b"], Decl(newWithSpreadES5.ts, 16, 13)) new (c["a-b"])(1, 2, ...a); >c : Symbol(c, Decl(newWithSpreadES5.ts, 26, 3)) ->"a-b" : Symbol(C."a-b", Decl(newWithSpreadES5.ts, 16, 13)) +>"a-b" : Symbol(C["a-b"], Decl(newWithSpreadES5.ts, 16, 13)) >a : Symbol(a, Decl(newWithSpreadES5.ts, 24, 3)) new (c["a-b"])(1, 2, ...a, "string"); >c : Symbol(c, Decl(newWithSpreadES5.ts, 26, 3)) ->"a-b" : Symbol(C."a-b", Decl(newWithSpreadES5.ts, 16, 13)) +>"a-b" : Symbol(C["a-b"], Decl(newWithSpreadES5.ts, 16, 13)) >a : Symbol(a, Decl(newWithSpreadES5.ts, 24, 3)) // Element access expression new g[1]["a-b"](1, 2, "string"); >g : Symbol(g, Decl(newWithSpreadES5.ts, 29, 3)) ->"a-b" : Symbol(C."a-b", Decl(newWithSpreadES5.ts, 16, 13)) +>"a-b" : Symbol(C["a-b"], Decl(newWithSpreadES5.ts, 16, 13)) new g[1]["a-b"](1, 2, ...a); >g : Symbol(g, Decl(newWithSpreadES5.ts, 29, 3)) ->"a-b" : Symbol(C."a-b", Decl(newWithSpreadES5.ts, 16, 13)) +>"a-b" : Symbol(C["a-b"], Decl(newWithSpreadES5.ts, 16, 13)) >a : Symbol(a, Decl(newWithSpreadES5.ts, 24, 3)) new g[1]["a-b"](1, 2, ...a, "string"); >g : Symbol(g, Decl(newWithSpreadES5.ts, 29, 3)) ->"a-b" : Symbol(C."a-b", Decl(newWithSpreadES5.ts, 16, 13)) +>"a-b" : Symbol(C["a-b"], Decl(newWithSpreadES5.ts, 16, 13)) >a : Symbol(a, Decl(newWithSpreadES5.ts, 24, 3)) // Element access expression with a punctuated key new h["a-b"]["a-b"](1, 2, "string"); >h : Symbol(h, Decl(newWithSpreadES5.ts, 30, 3)) ->"a-b" : Symbol(C."a-b", Decl(newWithSpreadES5.ts, 16, 13)) +>"a-b" : Symbol(C["a-b"], Decl(newWithSpreadES5.ts, 16, 13)) new h["a-b"]["a-b"](1, 2, ...a); >h : Symbol(h, Decl(newWithSpreadES5.ts, 30, 3)) ->"a-b" : Symbol(C."a-b", Decl(newWithSpreadES5.ts, 16, 13)) +>"a-b" : Symbol(C["a-b"], Decl(newWithSpreadES5.ts, 16, 13)) >a : Symbol(a, Decl(newWithSpreadES5.ts, 24, 3)) new h["a-b"]["a-b"](1, 2, ...a, "string"); >h : Symbol(h, Decl(newWithSpreadES5.ts, 30, 3)) ->"a-b" : Symbol(C."a-b", Decl(newWithSpreadES5.ts, 16, 13)) +>"a-b" : Symbol(C["a-b"], Decl(newWithSpreadES5.ts, 16, 13)) >a : Symbol(a, Decl(newWithSpreadES5.ts, 24, 3)) // Element access expression with a number diff --git a/tests/baselines/reference/newWithSpreadES6.symbols b/tests/baselines/reference/newWithSpreadES6.symbols index 51a34ad73ef..946aeeb5c1a 100644 --- a/tests/baselines/reference/newWithSpreadES6.symbols +++ b/tests/baselines/reference/newWithSpreadES6.symbols @@ -16,7 +16,7 @@ interface A { >A : Symbol(A, Decl(newWithSpreadES6.ts, 5, 1)) f: { ->f : Symbol(f, Decl(newWithSpreadES6.ts, 7, 13)) +>f : Symbol(A.f, Decl(newWithSpreadES6.ts, 7, 13)) new (x: number, y: number, ...z: string[]); >x : Symbol(x, Decl(newWithSpreadES6.ts, 9, 13)) @@ -203,61 +203,61 @@ new B(1, 2, ...a, "string"); // Property access expression new c["a-b"](1, 2, "string"); >c : Symbol(c, Decl(newWithSpreadES6.ts, 27, 3)) ->"a-b" : Symbol(C."a-b", Decl(newWithSpreadES6.ts, 17, 13)) +>"a-b" : Symbol(C["a-b"], Decl(newWithSpreadES6.ts, 17, 13)) new c["a-b"](1, 2, ...a); >c : Symbol(c, Decl(newWithSpreadES6.ts, 27, 3)) ->"a-b" : Symbol(C."a-b", Decl(newWithSpreadES6.ts, 17, 13)) +>"a-b" : Symbol(C["a-b"], Decl(newWithSpreadES6.ts, 17, 13)) >a : Symbol(a, Decl(newWithSpreadES6.ts, 25, 3)) new c["a-b"](1, 2, ...a, "string"); >c : Symbol(c, Decl(newWithSpreadES6.ts, 27, 3)) ->"a-b" : Symbol(C."a-b", Decl(newWithSpreadES6.ts, 17, 13)) +>"a-b" : Symbol(C["a-b"], Decl(newWithSpreadES6.ts, 17, 13)) >a : Symbol(a, Decl(newWithSpreadES6.ts, 25, 3)) // Parenthesised expression new (c["a-b"])(1, 2, "string"); >c : Symbol(c, Decl(newWithSpreadES6.ts, 27, 3)) ->"a-b" : Symbol(C."a-b", Decl(newWithSpreadES6.ts, 17, 13)) +>"a-b" : Symbol(C["a-b"], Decl(newWithSpreadES6.ts, 17, 13)) new (c["a-b"])(1, 2, ...a); >c : Symbol(c, Decl(newWithSpreadES6.ts, 27, 3)) ->"a-b" : Symbol(C."a-b", Decl(newWithSpreadES6.ts, 17, 13)) +>"a-b" : Symbol(C["a-b"], Decl(newWithSpreadES6.ts, 17, 13)) >a : Symbol(a, Decl(newWithSpreadES6.ts, 25, 3)) new (c["a-b"])(1, 2, ...a, "string"); >c : Symbol(c, Decl(newWithSpreadES6.ts, 27, 3)) ->"a-b" : Symbol(C."a-b", Decl(newWithSpreadES6.ts, 17, 13)) +>"a-b" : Symbol(C["a-b"], Decl(newWithSpreadES6.ts, 17, 13)) >a : Symbol(a, Decl(newWithSpreadES6.ts, 25, 3)) // Element access expression new g[1]["a-b"](1, 2, "string"); >g : Symbol(g, Decl(newWithSpreadES6.ts, 30, 3)) ->"a-b" : Symbol(C."a-b", Decl(newWithSpreadES6.ts, 17, 13)) +>"a-b" : Symbol(C["a-b"], Decl(newWithSpreadES6.ts, 17, 13)) new g[1]["a-b"](1, 2, ...a); >g : Symbol(g, Decl(newWithSpreadES6.ts, 30, 3)) ->"a-b" : Symbol(C."a-b", Decl(newWithSpreadES6.ts, 17, 13)) +>"a-b" : Symbol(C["a-b"], Decl(newWithSpreadES6.ts, 17, 13)) >a : Symbol(a, Decl(newWithSpreadES6.ts, 25, 3)) new g[1]["a-b"](1, 2, ...a, "string"); >g : Symbol(g, Decl(newWithSpreadES6.ts, 30, 3)) ->"a-b" : Symbol(C."a-b", Decl(newWithSpreadES6.ts, 17, 13)) +>"a-b" : Symbol(C["a-b"], Decl(newWithSpreadES6.ts, 17, 13)) >a : Symbol(a, Decl(newWithSpreadES6.ts, 25, 3)) // Element access expression with a punctuated key new h["a-b"]["a-b"](1, 2, "string"); >h : Symbol(h, Decl(newWithSpreadES6.ts, 31, 3)) ->"a-b" : Symbol(C."a-b", Decl(newWithSpreadES6.ts, 17, 13)) +>"a-b" : Symbol(C["a-b"], Decl(newWithSpreadES6.ts, 17, 13)) new h["a-b"]["a-b"](1, 2, ...a); >h : Symbol(h, Decl(newWithSpreadES6.ts, 31, 3)) ->"a-b" : Symbol(C."a-b", Decl(newWithSpreadES6.ts, 17, 13)) +>"a-b" : Symbol(C["a-b"], Decl(newWithSpreadES6.ts, 17, 13)) >a : Symbol(a, Decl(newWithSpreadES6.ts, 25, 3)) new h["a-b"]["a-b"](1, 2, ...a, "string"); >h : Symbol(h, Decl(newWithSpreadES6.ts, 31, 3)) ->"a-b" : Symbol(C."a-b", Decl(newWithSpreadES6.ts, 17, 13)) +>"a-b" : Symbol(C["a-b"], Decl(newWithSpreadES6.ts, 17, 13)) >a : Symbol(a, Decl(newWithSpreadES6.ts, 25, 3)) // Element access expression with a number diff --git a/tests/baselines/reference/noCollisionThisExpressionAndLocalVarInMethod.symbols b/tests/baselines/reference/noCollisionThisExpressionAndLocalVarInMethod.symbols index 72e0d20a9b2..02b8d0d0985 100644 --- a/tests/baselines/reference/noCollisionThisExpressionAndLocalVarInMethod.symbols +++ b/tests/baselines/reference/noCollisionThisExpressionAndLocalVarInMethod.symbols @@ -6,7 +6,7 @@ class a { >a : Symbol(a, Decl(noCollisionThisExpressionAndLocalVarInMethod.ts, 0, 14)) method1() { ->method1 : Symbol(method1, Decl(noCollisionThisExpressionAndLocalVarInMethod.ts, 1, 9)) +>method1 : Symbol(a.method1, Decl(noCollisionThisExpressionAndLocalVarInMethod.ts, 1, 9)) return { doStuff: (callback) => () => { @@ -23,7 +23,7 @@ class a { } } method2() { ->method2 : Symbol(method2, Decl(noCollisionThisExpressionAndLocalVarInMethod.ts, 9, 5)) +>method2 : Symbol(a.method2, Decl(noCollisionThisExpressionAndLocalVarInMethod.ts, 9, 5)) var _this = 2; >_this : Symbol(_this, Decl(noCollisionThisExpressionAndLocalVarInMethod.ts, 11, 11)) diff --git a/tests/baselines/reference/noCollisionThisExpressionAndLocalVarInProperty.symbols b/tests/baselines/reference/noCollisionThisExpressionAndLocalVarInProperty.symbols index 0dc4cf1d84e..095a1e87b80 100644 --- a/tests/baselines/reference/noCollisionThisExpressionAndLocalVarInProperty.symbols +++ b/tests/baselines/reference/noCollisionThisExpressionAndLocalVarInProperty.symbols @@ -3,7 +3,7 @@ class class1 { >class1 : Symbol(class1, Decl(noCollisionThisExpressionAndLocalVarInProperty.ts, 0, 0)) public prop1 = { ->prop1 : Symbol(prop1, Decl(noCollisionThisExpressionAndLocalVarInProperty.ts, 0, 14)) +>prop1 : Symbol(class1.prop1, Decl(noCollisionThisExpressionAndLocalVarInProperty.ts, 0, 14)) doStuff: (callback) => () => { >doStuff : Symbol(doStuff, Decl(noCollisionThisExpressionAndLocalVarInProperty.ts, 1, 20)) @@ -27,7 +27,7 @@ class class2 { >_this : Symbol(_this, Decl(noCollisionThisExpressionAndLocalVarInProperty.ts, 11, 11)) } public prop1 = { ->prop1 : Symbol(prop1, Decl(noCollisionThisExpressionAndLocalVarInProperty.ts, 12, 5)) +>prop1 : Symbol(class2.prop1, Decl(noCollisionThisExpressionAndLocalVarInProperty.ts, 12, 5)) doStuff: (callback) => () => { >doStuff : Symbol(doStuff, Decl(noCollisionThisExpressionAndLocalVarInProperty.ts, 13, 20)) diff --git a/tests/baselines/reference/noErrorsInCallback.errors.txt b/tests/baselines/reference/noErrorsInCallback.errors.txt index 90fdbbd77a5..f0bfe00199e 100644 --- a/tests/baselines/reference/noErrorsInCallback.errors.txt +++ b/tests/baselines/reference/noErrorsInCallback.errors.txt @@ -1,5 +1,5 @@ -tests/cases/compiler/noErrorsInCallback.ts(4,19): error TS2345: Argument of type '{ [x: number]: undefined; }' is not assignable to parameter of type 'string'. -tests/cases/compiler/noErrorsInCallback.ts(6,23): error TS2345: Argument of type '{ [x: number]: undefined; }' is not assignable to parameter of type 'string'. +tests/cases/compiler/noErrorsInCallback.ts(4,19): error TS2345: Argument of type '{}' is not assignable to parameter of type 'string'. +tests/cases/compiler/noErrorsInCallback.ts(6,23): error TS2345: Argument of type '{}' is not assignable to parameter of type 'string'. ==== tests/cases/compiler/noErrorsInCallback.ts (2 errors) ==== @@ -8,10 +8,10 @@ tests/cases/compiler/noErrorsInCallback.ts(6,23): error TS2345: Argument of type } var one = new Bar({}); // Error ~~ -!!! error TS2345: Argument of type '{ [x: number]: undefined; }' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type '{}' is not assignable to parameter of type 'string'. [].forEach(() => { var two = new Bar({}); // No error? ~~ -!!! error TS2345: Argument of type '{ [x: number]: undefined; }' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type '{}' is not assignable to parameter of type 'string'. }); \ No newline at end of file diff --git a/tests/baselines/reference/noImplicitAnyAndPrivateMembersWithoutTypeAnnotations.symbols b/tests/baselines/reference/noImplicitAnyAndPrivateMembersWithoutTypeAnnotations.symbols index 1673c50f69f..0cfd1cbff07 100644 --- a/tests/baselines/reference/noImplicitAnyAndPrivateMembersWithoutTypeAnnotations.symbols +++ b/tests/baselines/reference/noImplicitAnyAndPrivateMembersWithoutTypeAnnotations.symbols @@ -12,6 +12,6 @@ declare class Something >someStaticVar : Symbol(Something.someStaticVar, Decl(test.d.ts, 1, 1)) private someVar; ->someVar : Symbol(someVar, Decl(test.d.ts, 2, 33)) +>someVar : Symbol(Something.someVar, Decl(test.d.ts, 2, 33)) } diff --git a/tests/baselines/reference/noImplicitAnyDestructuringInPrivateMethod.js b/tests/baselines/reference/noImplicitAnyDestructuringInPrivateMethod.js new file mode 100644 index 00000000000..2d7d930703c --- /dev/null +++ b/tests/baselines/reference/noImplicitAnyDestructuringInPrivateMethod.js @@ -0,0 +1,34 @@ +//// [noImplicitAnyDestructuringInPrivateMethod.ts] +type Arg = { + a: number; +}; +export class Bar { + private bar({ a, }: Arg): number { + return a; + } +} +export declare class Bar2 { + private bar({ a, }); +} + +//// [noImplicitAnyDestructuringInPrivateMethod.js] +"use strict"; +var Bar = (function () { + function Bar() { + } + Bar.prototype.bar = function (_a) { + var a = _a.a; + return a; + }; + return Bar; +}()); +exports.Bar = Bar; + + +//// [noImplicitAnyDestructuringInPrivateMethod.d.ts] +export declare class Bar { + private bar({a}); +} +export declare class Bar2 { + private bar({a}); +} diff --git a/tests/baselines/reference/noImplicitAnyDestructuringInPrivateMethod.symbols b/tests/baselines/reference/noImplicitAnyDestructuringInPrivateMethod.symbols new file mode 100644 index 00000000000..0b1ce5cfe48 --- /dev/null +++ b/tests/baselines/reference/noImplicitAnyDestructuringInPrivateMethod.symbols @@ -0,0 +1,27 @@ +=== tests/cases/compiler/noImplicitAnyDestructuringInPrivateMethod.ts === +type Arg = { +>Arg : Symbol(Arg, Decl(noImplicitAnyDestructuringInPrivateMethod.ts, 0, 0)) + + a: number; +>a : Symbol(a, Decl(noImplicitAnyDestructuringInPrivateMethod.ts, 0, 12)) + +}; +export class Bar { +>Bar : Symbol(Bar, Decl(noImplicitAnyDestructuringInPrivateMethod.ts, 2, 2)) + + private bar({ a, }: Arg): number { +>bar : Symbol(Bar.bar, Decl(noImplicitAnyDestructuringInPrivateMethod.ts, 3, 18)) +>a : Symbol(a, Decl(noImplicitAnyDestructuringInPrivateMethod.ts, 4, 17)) +>Arg : Symbol(Arg, Decl(noImplicitAnyDestructuringInPrivateMethod.ts, 0, 0)) + + return a; +>a : Symbol(a, Decl(noImplicitAnyDestructuringInPrivateMethod.ts, 4, 17)) + } +} +export declare class Bar2 { +>Bar2 : Symbol(Bar2, Decl(noImplicitAnyDestructuringInPrivateMethod.ts, 7, 1)) + + private bar({ a, }); +>bar : Symbol(Bar2.bar, Decl(noImplicitAnyDestructuringInPrivateMethod.ts, 8, 27)) +>a : Symbol(a, Decl(noImplicitAnyDestructuringInPrivateMethod.ts, 9, 17)) +} diff --git a/tests/baselines/reference/noImplicitAnyDestructuringInPrivateMethod.types b/tests/baselines/reference/noImplicitAnyDestructuringInPrivateMethod.types new file mode 100644 index 00000000000..a399e59e3c3 --- /dev/null +++ b/tests/baselines/reference/noImplicitAnyDestructuringInPrivateMethod.types @@ -0,0 +1,27 @@ +=== tests/cases/compiler/noImplicitAnyDestructuringInPrivateMethod.ts === +type Arg = { +>Arg : { a: number; } + + a: number; +>a : number + +}; +export class Bar { +>Bar : Bar + + private bar({ a, }: Arg): number { +>bar : ({a}: { a: number; }) => number +>a : number +>Arg : { a: number; } + + return a; +>a : number + } +} +export declare class Bar2 { +>Bar2 : Bar2 + + private bar({ a, }); +>bar : ({a}: { a: any; }) => any +>a : any +} diff --git a/tests/baselines/reference/noImplicitAnyDestructuringParameterDeclaration.errors.txt b/tests/baselines/reference/noImplicitAnyDestructuringParameterDeclaration.errors.txt new file mode 100644 index 00000000000..a15f9c07cd3 --- /dev/null +++ b/tests/baselines/reference/noImplicitAnyDestructuringParameterDeclaration.errors.txt @@ -0,0 +1,55 @@ +tests/cases/compiler/noImplicitAnyDestructuringParameterDeclaration.ts(1,14): error TS7031: Binding element 'a' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyDestructuringParameterDeclaration.ts(1,19): error TS7031: Binding element 'b' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyDestructuringParameterDeclaration.ts(1,23): error TS7006: Parameter 'c' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyDestructuringParameterDeclaration.ts(1,26): error TS7006: Parameter 'd' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyDestructuringParameterDeclaration.ts(3,14): error TS7031: Binding element 'a' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyDestructuringParameterDeclaration.ts(3,31): error TS7031: Binding element 'b' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyDestructuringParameterDeclaration.ts(3,42): error TS7006: Parameter 'c' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyDestructuringParameterDeclaration.ts(3,57): error TS7006: Parameter 'd' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyDestructuringParameterDeclaration.ts(7,20): error TS7008: Member 'b' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyDestructuringParameterDeclaration.ts(7,30): error TS7008: Member 'b' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyDestructuringParameterDeclaration.ts(9,14): error TS7031: Binding element 'a1' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyDestructuringParameterDeclaration.ts(9,34): error TS7031: Binding element 'b1' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyDestructuringParameterDeclaration.ts(9,54): error TS7006: Parameter 'c1' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyDestructuringParameterDeclaration.ts(9,70): error TS7006: Parameter 'd1' implicitly has an 'any' type. + + +==== tests/cases/compiler/noImplicitAnyDestructuringParameterDeclaration.ts (14 errors) ==== + function f1([a], {b}, c, d) { // error + ~ +!!! error TS7031: Binding element 'a' implicitly has an 'any' type. + ~ +!!! error TS7031: Binding element 'b' implicitly has an 'any' type. + ~ +!!! error TS7006: Parameter 'c' implicitly has an 'any' type. + ~ +!!! error TS7006: Parameter 'd' implicitly has an 'any' type. + } + function f2([a = undefined], {b = null}, c = undefined, d = null) { // error + ~ +!!! error TS7031: Binding element 'a' implicitly has an 'any' type. + ~ +!!! error TS7031: Binding element 'b' implicitly has an 'any' type. + ~~~~~~~~~~~~~ +!!! error TS7006: Parameter 'c' implicitly has an 'any' type. + ~~~~~~~~ +!!! error TS7006: Parameter 'd' implicitly has an 'any' type. + } + function f3([a]: [any], {b}: { b: any }, c: any, d: any) { + } + function f4({b}: { b }, x: { b }) { // error in type instead + ~ +!!! error TS7008: Member 'b' implicitly has an 'any' type. + ~ +!!! error TS7008: Member 'b' implicitly has an 'any' type. + } + function f5([a1] = [undefined], {b1} = { b1: null }, c1 = undefined, d1 = null) { // error + ~~ +!!! error TS7031: Binding element 'a1' implicitly has an 'any' type. + ~~ +!!! error TS7031: Binding element 'b1' implicitly has an 'any' type. + ~~~~~~~~~~~~~~ +!!! error TS7006: Parameter 'c1' implicitly has an 'any' type. + ~~~~~~~~~ +!!! error TS7006: Parameter 'd1' implicitly has an 'any' type. + } \ No newline at end of file diff --git a/tests/baselines/reference/noImplicitAnyDestructuringParameterDeclaration.js b/tests/baselines/reference/noImplicitAnyDestructuringParameterDeclaration.js new file mode 100644 index 00000000000..d587f8789a9 --- /dev/null +++ b/tests/baselines/reference/noImplicitAnyDestructuringParameterDeclaration.js @@ -0,0 +1,36 @@ +//// [noImplicitAnyDestructuringParameterDeclaration.ts] +function f1([a], {b}, c, d) { // error +} +function f2([a = undefined], {b = null}, c = undefined, d = null) { // error +} +function f3([a]: [any], {b}: { b: any }, c: any, d: any) { +} +function f4({b}: { b }, x: { b }) { // error in type instead +} +function f5([a1] = [undefined], {b1} = { b1: null }, c1 = undefined, d1 = null) { // error +} + +//// [noImplicitAnyDestructuringParameterDeclaration.js] +function f1(_a, _b, c, d) { + var a = _a[0]; + var b = _b.b; +} +function f2(_a, _b, c, d) { + var _c = _a[0], a = _c === void 0 ? undefined : _c; + var _d = _b.b, b = _d === void 0 ? null : _d; + if (c === void 0) { c = undefined; } + if (d === void 0) { d = null; } +} +function f3(_a, _b, c, d) { + var a = _a[0]; + var b = _b.b; +} +function f4(_a, x) { + var b = _a.b; +} +function f5(_a, _b, c1, d1) { + var a1 = (_a === void 0 ? [undefined] : _a)[0]; + var b1 = (_b === void 0 ? { b1: null } : _b).b1; + if (c1 === void 0) { c1 = undefined; } + if (d1 === void 0) { d1 = null; } +} diff --git a/tests/baselines/reference/noImplicitAnyDestructuringVarDeclaration.errors.txt b/tests/baselines/reference/noImplicitAnyDestructuringVarDeclaration.errors.txt new file mode 100644 index 00000000000..10d6b05c622 --- /dev/null +++ b/tests/baselines/reference/noImplicitAnyDestructuringVarDeclaration.errors.txt @@ -0,0 +1,69 @@ +tests/cases/compiler/noImplicitAnyDestructuringVarDeclaration.ts(1,5): error TS1182: A destructuring declaration must have an initializer. +tests/cases/compiler/noImplicitAnyDestructuringVarDeclaration.ts(1,6): error TS7031: Binding element 'a' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyDestructuringVarDeclaration.ts(1,10): error TS1182: A destructuring declaration must have an initializer. +tests/cases/compiler/noImplicitAnyDestructuringVarDeclaration.ts(1,11): error TS7031: Binding element 'b' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyDestructuringVarDeclaration.ts(1,15): error TS7005: Variable 'c' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyDestructuringVarDeclaration.ts(1,18): error TS7005: Variable 'd' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyDestructuringVarDeclaration.ts(3,5): error TS1182: A destructuring declaration must have an initializer. +tests/cases/compiler/noImplicitAnyDestructuringVarDeclaration.ts(3,6): error TS7031: Binding element 'a1' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyDestructuringVarDeclaration.ts(3,23): error TS1182: A destructuring declaration must have an initializer. +tests/cases/compiler/noImplicitAnyDestructuringVarDeclaration.ts(3,24): error TS7031: Binding element 'b1' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyDestructuringVarDeclaration.ts(3,36): error TS7005: Variable 'c1' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyDestructuringVarDeclaration.ts(3,52): error TS7005: Variable 'd1' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyDestructuringVarDeclaration.ts(5,5): error TS1182: A destructuring declaration must have an initializer. +tests/cases/compiler/noImplicitAnyDestructuringVarDeclaration.ts(5,18): error TS1182: A destructuring declaration must have an initializer. +tests/cases/compiler/noImplicitAnyDestructuringVarDeclaration.ts(7,5): error TS1182: A destructuring declaration must have an initializer. +tests/cases/compiler/noImplicitAnyDestructuringVarDeclaration.ts(7,13): error TS7008: Member 'b3' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyDestructuringVarDeclaration.ts(7,25): error TS7008: Member 'b3' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyDestructuringVarDeclaration.ts(9,6): error TS7031: Binding element 'a1' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyDestructuringVarDeclaration.ts(9,26): error TS7031: Binding element 'b1' implicitly has an 'any' type. + + +==== tests/cases/compiler/noImplicitAnyDestructuringVarDeclaration.ts (19 errors) ==== + var [a], {b}, c, d; // error + ~~~ +!!! error TS1182: A destructuring declaration must have an initializer. + ~ +!!! error TS7031: Binding element 'a' implicitly has an 'any' type. + ~~~ +!!! error TS1182: A destructuring declaration must have an initializer. + ~ +!!! error TS7031: Binding element 'b' implicitly has an 'any' type. + ~ +!!! error TS7005: Variable 'c' implicitly has an 'any' type. + ~ +!!! error TS7005: Variable 'd' implicitly has an 'any' type. + + var [a1 = undefined], {b1 = null}, c1 = undefined, d1 = null; // error + ~~~~~~~~~~~~~~~~ +!!! error TS1182: A destructuring declaration must have an initializer. + ~~ +!!! error TS7031: Binding element 'a1' implicitly has an 'any' type. + ~~~~~~~~~~~ +!!! error TS1182: A destructuring declaration must have an initializer. + ~~ +!!! error TS7031: Binding element 'b1' implicitly has an 'any' type. + ~~ +!!! error TS7005: Variable 'c1' implicitly has an 'any' type. + ~~ +!!! error TS7005: Variable 'd1' implicitly has an 'any' type. + + var [a2]: [any], {b2}: { b2: any }, c2: any, d2: any; + ~~~~ +!!! error TS1182: A destructuring declaration must have an initializer. + ~~~~ +!!! error TS1182: A destructuring declaration must have an initializer. + + var {b3}: { b3 }, c3: { b3 }; // error in type instead + ~~~~ +!!! error TS1182: A destructuring declaration must have an initializer. + ~~ +!!! error TS7008: Member 'b3' implicitly has an 'any' type. + ~~ +!!! error TS7008: Member 'b3' implicitly has an 'any' type. + + var [a1] = [undefined], {b1} = { b1: null }, c1 = undefined, d1 = null; // error + ~~ +!!! error TS7031: Binding element 'a1' implicitly has an 'any' type. + ~~ +!!! error TS7031: Binding element 'b1' implicitly has an 'any' type. \ No newline at end of file diff --git a/tests/baselines/reference/noImplicitAnyDestructuringVarDeclaration.js b/tests/baselines/reference/noImplicitAnyDestructuringVarDeclaration.js new file mode 100644 index 00000000000..cbc15c01e9e --- /dev/null +++ b/tests/baselines/reference/noImplicitAnyDestructuringVarDeclaration.js @@ -0,0 +1,17 @@ +//// [noImplicitAnyDestructuringVarDeclaration.ts] +var [a], {b}, c, d; // error + +var [a1 = undefined], {b1 = null}, c1 = undefined, d1 = null; // error + +var [a2]: [any], {b2}: { b2: any }, c2: any, d2: any; + +var {b3}: { b3 }, c3: { b3 }; // error in type instead + +var [a1] = [undefined], {b1} = { b1: null }, c1 = undefined, d1 = null; // error + +//// [noImplicitAnyDestructuringVarDeclaration.js] +var a = (void 0)[0], b = (void 0).b, c, d; // error +var _a = (void 0)[0], a1 = _a === void 0 ? undefined : _a, _b = (void 0).b1, b1 = _b === void 0 ? null : _b, c1 = undefined, d1 = null; // error +var a2 = (void 0)[0], b2 = (void 0).b2, c2, d2; +var b3 = (void 0).b3, c3; // error in type instead +var a1 = [undefined][0], b1 = { b1: null }.b1, c1 = undefined, d1 = null; // error diff --git a/tests/baselines/reference/noImplicitAnyInCastExpression.errors.txt b/tests/baselines/reference/noImplicitAnyInCastExpression.errors.txt index 66a7773ab49..8243a9c68ce 100644 --- a/tests/baselines/reference/noImplicitAnyInCastExpression.errors.txt +++ b/tests/baselines/reference/noImplicitAnyInCastExpression.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/noImplicitAnyInCastExpression.ts(16,2): error TS2352: Neither type '{ c: null; }' nor type 'IFoo' is assignable to the other. +tests/cases/compiler/noImplicitAnyInCastExpression.ts(16,2): error TS2352: Type '{ c: null; }' cannot be converted to type 'IFoo'. Property 'a' is missing in type '{ c: null; }'. @@ -20,5 +20,5 @@ tests/cases/compiler/noImplicitAnyInCastExpression.ts(16,2): error TS2352: Neith // Neither types is assignable to each other ({ c: null }); ~~~~~~~~~~~~~~~~~ -!!! error TS2352: Neither type '{ c: null; }' nor type 'IFoo' is assignable to the other. +!!! error TS2352: Type '{ c: null; }' cannot be converted to type 'IFoo'. !!! error TS2352: Property 'a' is missing in type '{ c: null; }'. \ No newline at end of file diff --git a/tests/baselines/reference/noImplicitAnyIndexing.errors.txt b/tests/baselines/reference/noImplicitAnyIndexing.errors.txt index 8b75459ebd0..8f4cf616bda 100644 --- a/tests/baselines/reference/noImplicitAnyIndexing.errors.txt +++ b/tests/baselines/reference/noImplicitAnyIndexing.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/noImplicitAnyIndexing.ts(13,26): error TS7017: Index signature of object type implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyIndexing.ts(13,26): error TS7015: Element implicitly has an 'any' type because index expression is not of type 'number'. tests/cases/compiler/noImplicitAnyIndexing.ts(20,9): error TS7017: Index signature of object type implicitly has an 'any' type. tests/cases/compiler/noImplicitAnyIndexing.ts(23,9): error TS7017: Index signature of object type implicitly has an 'any' type. tests/cases/compiler/noImplicitAnyIndexing.ts(31,10): error TS7017: Index signature of object type implicitly has an 'any' type. @@ -19,7 +19,7 @@ tests/cases/compiler/noImplicitAnyIndexing.ts(31,10): error TS7017: Index signat // Should be implicit 'any' ; property access fails, no string indexer. var strRepresentation3 = MyEmusEnum["monehh"]; ~~~~~~~~~~~~~~~~~~~~ -!!! error TS7017: Index signature of object type implicitly has an 'any' type. +!!! error TS7015: Element implicitly has an 'any' type because index expression is not of type 'number'. // Should be okay; should be a MyEmusEnum var strRepresentation4 = MyEmusEnum["emu"]; diff --git a/tests/baselines/reference/noImplicitAnyIndexingSuppressed.types b/tests/baselines/reference/noImplicitAnyIndexingSuppressed.types index b7b21bf8f92..d82b37e0f9e 100644 --- a/tests/baselines/reference/noImplicitAnyIndexingSuppressed.types +++ b/tests/baselines/reference/noImplicitAnyIndexingSuppressed.types @@ -87,7 +87,7 @@ interface MyMap { var m: MyMap = { >m : MyMap >MyMap : MyMap ->{ "0": 0, "1": 1, "2": 2, "Okay that's enough for today.": NaN} : { [x: string]: number; "0": number; "1": number; "2": number; "Okay that's enough for today.": number; } +>{ "0": 0, "1": 1, "2": 2, "Okay that's enough for today.": NaN} : { "0": number; "1": number; "2": number; "Okay that's enough for today.": number; } "0": 0, >0 : number diff --git a/tests/baselines/reference/noImplicitReturnInConstructors.js b/tests/baselines/reference/noImplicitReturnInConstructors.js new file mode 100644 index 00000000000..f1c4c8caa60 --- /dev/null +++ b/tests/baselines/reference/noImplicitReturnInConstructors.js @@ -0,0 +1,14 @@ +//// [noImplicitReturnInConstructors.ts] +class C { + constructor() { + return; + } +} + +//// [noImplicitReturnInConstructors.js] +var C = (function () { + function C() { + return; + } + return C; +}()); diff --git a/tests/baselines/reference/noImplicitReturnInConstructors.symbols b/tests/baselines/reference/noImplicitReturnInConstructors.symbols new file mode 100644 index 00000000000..326a390ead8 --- /dev/null +++ b/tests/baselines/reference/noImplicitReturnInConstructors.symbols @@ -0,0 +1,8 @@ +=== tests/cases/compiler/noImplicitReturnInConstructors.ts === +class C { +>C : Symbol(C, Decl(noImplicitReturnInConstructors.ts, 0, 0)) + + constructor() { + return; + } +} diff --git a/tests/baselines/reference/noImplicitReturnInConstructors.types b/tests/baselines/reference/noImplicitReturnInConstructors.types new file mode 100644 index 00000000000..304c7b5db50 --- /dev/null +++ b/tests/baselines/reference/noImplicitReturnInConstructors.types @@ -0,0 +1,8 @@ +=== tests/cases/compiler/noImplicitReturnInConstructors.ts === +class C { +>C : C + + constructor() { + return; + } +} diff --git a/tests/baselines/reference/noImplicitReturnsInAsync1.js b/tests/baselines/reference/noImplicitReturnsInAsync1.js new file mode 100644 index 00000000000..6192e9e7f24 --- /dev/null +++ b/tests/baselines/reference/noImplicitReturnsInAsync1.js @@ -0,0 +1,26 @@ +//// [noImplicitReturnsInAsync1.ts] + +async function test(isError: boolean = false) { + if (isError === true) { + return; + } + let x = await Promise.resolve("The test is passed without an error."); +} + +//// [noImplicitReturnsInAsync1.js] +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator.throw(value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments)).next()); + }); +}; +function test(isError = false) { + return __awaiter(this, void 0, void 0, function* () { + if (isError === true) { + return; + } + let x = yield Promise.resolve("The test is passed without an error."); + }); +} diff --git a/tests/baselines/reference/noImplicitReturnsInAsync1.symbols b/tests/baselines/reference/noImplicitReturnsInAsync1.symbols new file mode 100644 index 00000000000..7bf70fbf04e --- /dev/null +++ b/tests/baselines/reference/noImplicitReturnsInAsync1.symbols @@ -0,0 +1,17 @@ +=== tests/cases/compiler/noImplicitReturnsInAsync1.ts === + +async function test(isError: boolean = false) { +>test : Symbol(test, Decl(noImplicitReturnsInAsync1.ts, 0, 0)) +>isError : Symbol(isError, Decl(noImplicitReturnsInAsync1.ts, 1, 20)) + + if (isError === true) { +>isError : Symbol(isError, Decl(noImplicitReturnsInAsync1.ts, 1, 20)) + + return; + } + let x = await Promise.resolve("The test is passed without an error."); +>x : Symbol(x, Decl(noImplicitReturnsInAsync1.ts, 5, 7)) +>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +} diff --git a/tests/baselines/reference/noImplicitReturnsInAsync1.types b/tests/baselines/reference/noImplicitReturnsInAsync1.types new file mode 100644 index 00000000000..23f0892f30e --- /dev/null +++ b/tests/baselines/reference/noImplicitReturnsInAsync1.types @@ -0,0 +1,23 @@ +=== tests/cases/compiler/noImplicitReturnsInAsync1.ts === + +async function test(isError: boolean = false) { +>test : (isError?: boolean) => Promise +>isError : boolean +>false : boolean + + if (isError === true) { +>isError === true : boolean +>isError : boolean +>true : boolean + + return; + } + let x = await Promise.resolve("The test is passed without an error."); +>x : string +>await Promise.resolve("The test is passed without an error.") : string +>Promise.resolve("The test is passed without an error.") : Promise +>Promise.resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>Promise : PromiseConstructor +>resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>"The test is passed without an error." : string +} diff --git a/tests/baselines/reference/noImplicitReturnsInAsync2.errors.txt b/tests/baselines/reference/noImplicitReturnsInAsync2.errors.txt new file mode 100644 index 00000000000..83673ff518b --- /dev/null +++ b/tests/baselines/reference/noImplicitReturnsInAsync2.errors.txt @@ -0,0 +1,45 @@ +tests/cases/compiler/noImplicitReturnsInAsync2.ts(3,16): error TS7030: Not all code paths return a value. +tests/cases/compiler/noImplicitReturnsInAsync2.ts(25,48): error TS7030: Not all code paths return a value. + + +==== tests/cases/compiler/noImplicitReturnsInAsync2.ts (2 errors) ==== + + // Should be an error, Promise, currently retorted correctly + async function test3(isError: boolean = true) { + ~~~~~ +!!! error TS7030: Not all code paths return a value. + if (isError === true) { + return 6; + } + } + + // Should not be an error, Promise, currently **not** working + async function test4(isError: boolean = true) { + if (isError === true) { + return undefined; + } + } + + // should not be error, Promise currently working correctly + async function test5(isError: boolean = true): Promise { //should not be error + if (isError === true) { + return undefined; + } + } + + + // should be error, currently reported correctly + async function test6(isError: boolean = true): Promise { + ~~~~~~~~~~~~~~~ +!!! error TS7030: Not all code paths return a value. + if (isError === true) { + return undefined; + } + } + + // infered to be Promise, should not be an error, currently reported correctly + async function test7(isError: boolean = true) { + if (isError === true) { + return; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/noImplicitReturnsInAsync2.js b/tests/baselines/reference/noImplicitReturnsInAsync2.js new file mode 100644 index 00000000000..5e034237fef --- /dev/null +++ b/tests/baselines/reference/noImplicitReturnsInAsync2.js @@ -0,0 +1,87 @@ +//// [noImplicitReturnsInAsync2.ts] + +// Should be an error, Promise, currently retorted correctly +async function test3(isError: boolean = true) { + if (isError === true) { + return 6; + } +} + +// Should not be an error, Promise, currently **not** working +async function test4(isError: boolean = true) { + if (isError === true) { + return undefined; + } +} + +// should not be error, Promise currently working correctly +async function test5(isError: boolean = true): Promise { //should not be error + if (isError === true) { + return undefined; + } +} + + +// should be error, currently reported correctly +async function test6(isError: boolean = true): Promise { + if (isError === true) { + return undefined; + } +} + +// infered to be Promise, should not be an error, currently reported correctly +async function test7(isError: boolean = true) { + if (isError === true) { + return; + } +} + +//// [noImplicitReturnsInAsync2.js] +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator.throw(value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments)).next()); + }); +}; +// Should be an error, Promise, currently retorted correctly +function test3(isError = true) { + return __awaiter(this, void 0, void 0, function* () { + if (isError === true) { + return 6; + } + }); +} +// Should not be an error, Promise, currently **not** working +function test4(isError = true) { + return __awaiter(this, void 0, void 0, function* () { + if (isError === true) { + return undefined; + } + }); +} +// should not be error, Promise currently working correctly +function test5(isError = true) { + return __awaiter(this, void 0, void 0, function* () { + if (isError === true) { + return undefined; + } + }); +} +// should be error, currently reported correctly +function test6(isError = true) { + return __awaiter(this, void 0, void 0, function* () { + if (isError === true) { + return undefined; + } + }); +} +// infered to be Promise, should not be an error, currently reported correctly +function test7(isError = true) { + return __awaiter(this, void 0, void 0, function* () { + if (isError === true) { + return; + } + }); +} diff --git a/tests/baselines/reference/noImplicitReturnsWithProtectedBlocks1.js b/tests/baselines/reference/noImplicitReturnsWithProtectedBlocks1.js new file mode 100644 index 00000000000..7f0b89153b5 --- /dev/null +++ b/tests/baselines/reference/noImplicitReturnsWithProtectedBlocks1.js @@ -0,0 +1,22 @@ +//// [noImplicitReturnsWithProtectedBlocks1.ts] +declare function log(s: string): void; +declare function get(): number; + +function main1() : number { + try { + return get(); + } + finally { + log("in finally"); + } +} + +//// [noImplicitReturnsWithProtectedBlocks1.js] +function main1() { + try { + return get(); + } + finally { + log("in finally"); + } +} diff --git a/tests/baselines/reference/noImplicitReturnsWithProtectedBlocks1.symbols b/tests/baselines/reference/noImplicitReturnsWithProtectedBlocks1.symbols new file mode 100644 index 00000000000..1defb4bbca3 --- /dev/null +++ b/tests/baselines/reference/noImplicitReturnsWithProtectedBlocks1.symbols @@ -0,0 +1,20 @@ +=== tests/cases/compiler/noImplicitReturnsWithProtectedBlocks1.ts === +declare function log(s: string): void; +>log : Symbol(log, Decl(noImplicitReturnsWithProtectedBlocks1.ts, 0, 0)) +>s : Symbol(s, Decl(noImplicitReturnsWithProtectedBlocks1.ts, 0, 21)) + +declare function get(): number; +>get : Symbol(get, Decl(noImplicitReturnsWithProtectedBlocks1.ts, 0, 38)) + +function main1() : number { +>main1 : Symbol(main1, Decl(noImplicitReturnsWithProtectedBlocks1.ts, 1, 31)) + + try { + return get(); +>get : Symbol(get, Decl(noImplicitReturnsWithProtectedBlocks1.ts, 0, 38)) + } + finally { + log("in finally"); +>log : Symbol(log, Decl(noImplicitReturnsWithProtectedBlocks1.ts, 0, 0)) + } +} diff --git a/tests/baselines/reference/noImplicitReturnsWithProtectedBlocks1.types b/tests/baselines/reference/noImplicitReturnsWithProtectedBlocks1.types new file mode 100644 index 00000000000..90db4fb42e1 --- /dev/null +++ b/tests/baselines/reference/noImplicitReturnsWithProtectedBlocks1.types @@ -0,0 +1,23 @@ +=== tests/cases/compiler/noImplicitReturnsWithProtectedBlocks1.ts === +declare function log(s: string): void; +>log : (s: string) => void +>s : string + +declare function get(): number; +>get : () => number + +function main1() : number { +>main1 : () => number + + try { + return get(); +>get() : number +>get : () => number + } + finally { + log("in finally"); +>log("in finally") : void +>log : (s: string) => void +>"in finally" : string + } +} diff --git a/tests/baselines/reference/noImplicitReturnsWithProtectedBlocks2.errors.txt b/tests/baselines/reference/noImplicitReturnsWithProtectedBlocks2.errors.txt new file mode 100644 index 00000000000..a77bd0462cd --- /dev/null +++ b/tests/baselines/reference/noImplicitReturnsWithProtectedBlocks2.errors.txt @@ -0,0 +1,20 @@ +tests/cases/compiler/noImplicitReturnsWithProtectedBlocks2.ts(4,20): error TS7030: Not all code paths return a value. + + +==== tests/cases/compiler/noImplicitReturnsWithProtectedBlocks2.ts (1 errors) ==== + declare function log(s: string): void; + declare function get(): number; + + function main1() : number { + ~~~~~~ +!!! error TS7030: Not all code paths return a value. + try { + return get(); + } + catch(e) { + log("in catch"); + } + finally { + log("in finally"); + } + } \ No newline at end of file diff --git a/tests/baselines/reference/noImplicitReturnsWithProtectedBlocks2.js b/tests/baselines/reference/noImplicitReturnsWithProtectedBlocks2.js new file mode 100644 index 00000000000..857a9686232 --- /dev/null +++ b/tests/baselines/reference/noImplicitReturnsWithProtectedBlocks2.js @@ -0,0 +1,28 @@ +//// [noImplicitReturnsWithProtectedBlocks2.ts] +declare function log(s: string): void; +declare function get(): number; + +function main1() : number { + try { + return get(); + } + catch(e) { + log("in catch"); + } + finally { + log("in finally"); + } +} + +//// [noImplicitReturnsWithProtectedBlocks2.js] +function main1() { + try { + return get(); + } + catch (e) { + log("in catch"); + } + finally { + log("in finally"); + } +} diff --git a/tests/baselines/reference/noImplicitReturnsWithProtectedBlocks3.errors.txt b/tests/baselines/reference/noImplicitReturnsWithProtectedBlocks3.errors.txt new file mode 100644 index 00000000000..56f9c701b55 --- /dev/null +++ b/tests/baselines/reference/noImplicitReturnsWithProtectedBlocks3.errors.txt @@ -0,0 +1,17 @@ +tests/cases/compiler/noImplicitReturnsWithProtectedBlocks3.ts(4,20): error TS7030: Not all code paths return a value. + + +==== tests/cases/compiler/noImplicitReturnsWithProtectedBlocks3.ts (1 errors) ==== + declare function log(s: string): void; + declare function get(): number; + + function main1() : number { + ~~~~~~ +!!! error TS7030: Not all code paths return a value. + try { + return get(); + } + catch(e) { + log("in catch"); + } + } \ No newline at end of file diff --git a/tests/baselines/reference/noImplicitReturnsWithProtectedBlocks3.js b/tests/baselines/reference/noImplicitReturnsWithProtectedBlocks3.js new file mode 100644 index 00000000000..a70996983f6 --- /dev/null +++ b/tests/baselines/reference/noImplicitReturnsWithProtectedBlocks3.js @@ -0,0 +1,22 @@ +//// [noImplicitReturnsWithProtectedBlocks3.ts] +declare function log(s: string): void; +declare function get(): number; + +function main1() : number { + try { + return get(); + } + catch(e) { + log("in catch"); + } +} + +//// [noImplicitReturnsWithProtectedBlocks3.js] +function main1() { + try { + return get(); + } + catch (e) { + log("in catch"); + } +} diff --git a/tests/baselines/reference/noImplicitReturnsWithoutReturnExpression.errors.txt b/tests/baselines/reference/noImplicitReturnsWithoutReturnExpression.errors.txt new file mode 100644 index 00000000000..83d9a65e95d --- /dev/null +++ b/tests/baselines/reference/noImplicitReturnsWithoutReturnExpression.errors.txt @@ -0,0 +1,34 @@ +tests/cases/compiler/noImplicitReturnsWithoutReturnExpression.ts(2,5): error TS7030: Not all code paths return a value. +tests/cases/compiler/noImplicitReturnsWithoutReturnExpression.ts(22,9): error TS7030: Not all code paths return a value. + + +==== tests/cases/compiler/noImplicitReturnsWithoutReturnExpression.ts (2 errors) ==== + function isMissingReturnExpression(): number { + return; + ~~~~~~~ +!!! error TS7030: Not all code paths return a value. + } + + function isMissingReturnExpression2(): any { + return; + } + + function isMissingReturnExpression3(): number|void { + return; + } + + function isMissingReturnExpression4(): void { + return; + } + + function isMissingReturnExpression5(x) { + if (x) { + return 0; + } + else { + return; + ~~~~~~~ +!!! error TS7030: Not all code paths return a value. + } + } + \ No newline at end of file diff --git a/tests/baselines/reference/noImplicitReturnsWithoutReturnExpression.js b/tests/baselines/reference/noImplicitReturnsWithoutReturnExpression.js new file mode 100644 index 00000000000..8c9123f6e17 --- /dev/null +++ b/tests/baselines/reference/noImplicitReturnsWithoutReturnExpression.js @@ -0,0 +1,48 @@ +//// [noImplicitReturnsWithoutReturnExpression.ts] +function isMissingReturnExpression(): number { + return; +} + +function isMissingReturnExpression2(): any { + return; +} + +function isMissingReturnExpression3(): number|void { + return; +} + +function isMissingReturnExpression4(): void { + return; +} + +function isMissingReturnExpression5(x) { + if (x) { + return 0; + } + else { + return; + } +} + + +//// [noImplicitReturnsWithoutReturnExpression.js] +function isMissingReturnExpression() { + return; +} +function isMissingReturnExpression2() { + return; +} +function isMissingReturnExpression3() { + return; +} +function isMissingReturnExpression4() { + return; +} +function isMissingReturnExpression5(x) { + if (x) { + return 0; + } + else { + return; + } +} diff --git a/tests/baselines/reference/noImplicitThisFunctions.errors.txt b/tests/baselines/reference/noImplicitThisFunctions.errors.txt new file mode 100644 index 00000000000..5f66ac3553f --- /dev/null +++ b/tests/baselines/reference/noImplicitThisFunctions.errors.txt @@ -0,0 +1,28 @@ +tests/cases/compiler/noImplicitThisFunctions.ts(14,12): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. +tests/cases/compiler/noImplicitThisFunctions.ts(18,38): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. + + +==== tests/cases/compiler/noImplicitThisFunctions.ts (2 errors) ==== + + function f1(x) { + // implicit any is still allowed + return x + 1; + } + + function f2(y: number) { + // ok: no reference to this + return y + 1; + } + + function f3(z: number): number { + // error: this is implicitly any + return this.a + z; + ~~~~ +!!! error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. + } + + // error: `this` is `window`, but is still of type `any` + let f4: (b: number) => number = b => this.c + b; + ~~~~ +!!! error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. + \ No newline at end of file diff --git a/tests/baselines/reference/noImplicitThisFunctions.js b/tests/baselines/reference/noImplicitThisFunctions.js new file mode 100644 index 00000000000..80ceccbe751 --- /dev/null +++ b/tests/baselines/reference/noImplicitThisFunctions.js @@ -0,0 +1,37 @@ +//// [noImplicitThisFunctions.ts] + +function f1(x) { + // implicit any is still allowed + return x + 1; +} + +function f2(y: number) { + // ok: no reference to this + return y + 1; +} + +function f3(z: number): number { + // error: this is implicitly any + return this.a + z; +} + +// error: `this` is `window`, but is still of type `any` +let f4: (b: number) => number = b => this.c + b; + + +//// [noImplicitThisFunctions.js] +var _this = this; +function f1(x) { + // implicit any is still allowed + return x + 1; +} +function f2(y) { + // ok: no reference to this + return y + 1; +} +function f3(z) { + // error: this is implicitly any + return this.a + z; +} +// error: `this` is `window`, but is still of type `any` +var f4 = function (b) { return _this.c + b; }; diff --git a/tests/baselines/reference/noImplicitThisObjectLiterals.errors.txt b/tests/baselines/reference/noImplicitThisObjectLiterals.errors.txt new file mode 100644 index 00000000000..6f25f2d3a08 --- /dev/null +++ b/tests/baselines/reference/noImplicitThisObjectLiterals.errors.txt @@ -0,0 +1,22 @@ +tests/cases/compiler/noImplicitThisObjectLiterals.ts(2,8): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. +tests/cases/compiler/noImplicitThisObjectLiterals.ts(4,16): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. +tests/cases/compiler/noImplicitThisObjectLiterals.ts(7,16): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. + + +==== tests/cases/compiler/noImplicitThisObjectLiterals.ts (3 errors) ==== + let o = { + d: this, // error, this: any + ~~~~ +!!! error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. + m() { + return this.d.length; // error, this: any + ~~~~ +!!! error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. + }, + f: function() { + return this.d.length; // error, this: any + ~~~~ +!!! error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. + } + } + \ No newline at end of file diff --git a/tests/baselines/reference/noImplicitThisObjectLiterals.js b/tests/baselines/reference/noImplicitThisObjectLiterals.js new file mode 100644 index 00000000000..3888708a8da --- /dev/null +++ b/tests/baselines/reference/noImplicitThisObjectLiterals.js @@ -0,0 +1,22 @@ +//// [noImplicitThisObjectLiterals.ts] +let o = { + d: this, // error, this: any + m() { + return this.d.length; // error, this: any + }, + f: function() { + return this.d.length; // error, this: any + } +} + + +//// [noImplicitThisObjectLiterals.js] +var o = { + d: this, + m: function () { + return this.d.length; // error, this: any + }, + f: function () { + return this.d.length; // error, this: any + } +}; diff --git a/tests/baselines/reference/noImplicitUseStrict_amd.js b/tests/baselines/reference/noImplicitUseStrict_amd.js new file mode 100644 index 00000000000..ac15f548c47 --- /dev/null +++ b/tests/baselines/reference/noImplicitUseStrict_amd.js @@ -0,0 +1,8 @@ +//// [noImplicitUseStrict_amd.ts] + +export var x = 0; + +//// [noImplicitUseStrict_amd.js] +define(["require", "exports"], function (require, exports) { + exports.x = 0; +}); diff --git a/tests/baselines/reference/noImplicitUseStrict_amd.symbols b/tests/baselines/reference/noImplicitUseStrict_amd.symbols new file mode 100644 index 00000000000..de1faa2213c --- /dev/null +++ b/tests/baselines/reference/noImplicitUseStrict_amd.symbols @@ -0,0 +1,5 @@ +=== tests/cases/compiler/noImplicitUseStrict_amd.ts === + +export var x = 0; +>x : Symbol(x, Decl(noImplicitUseStrict_amd.ts, 1, 10)) + diff --git a/tests/baselines/reference/noImplicitUseStrict_amd.types b/tests/baselines/reference/noImplicitUseStrict_amd.types new file mode 100644 index 00000000000..c9e1b5749dc --- /dev/null +++ b/tests/baselines/reference/noImplicitUseStrict_amd.types @@ -0,0 +1,6 @@ +=== tests/cases/compiler/noImplicitUseStrict_amd.ts === + +export var x = 0; +>x : number +>0 : number + diff --git a/tests/baselines/reference/noImplicitUseStrict_commonjs.js b/tests/baselines/reference/noImplicitUseStrict_commonjs.js new file mode 100644 index 00000000000..9c726938f04 --- /dev/null +++ b/tests/baselines/reference/noImplicitUseStrict_commonjs.js @@ -0,0 +1,6 @@ +//// [noImplicitUseStrict_commonjs.ts] + +export var x = 0; + +//// [noImplicitUseStrict_commonjs.js] +exports.x = 0; diff --git a/tests/baselines/reference/noImplicitUseStrict_commonjs.symbols b/tests/baselines/reference/noImplicitUseStrict_commonjs.symbols new file mode 100644 index 00000000000..af53dc272d2 --- /dev/null +++ b/tests/baselines/reference/noImplicitUseStrict_commonjs.symbols @@ -0,0 +1,5 @@ +=== tests/cases/compiler/noImplicitUseStrict_commonjs.ts === + +export var x = 0; +>x : Symbol(x, Decl(noImplicitUseStrict_commonjs.ts, 1, 10)) + diff --git a/tests/baselines/reference/noImplicitUseStrict_commonjs.types b/tests/baselines/reference/noImplicitUseStrict_commonjs.types new file mode 100644 index 00000000000..9999d3b94ba --- /dev/null +++ b/tests/baselines/reference/noImplicitUseStrict_commonjs.types @@ -0,0 +1,6 @@ +=== tests/cases/compiler/noImplicitUseStrict_commonjs.ts === + +export var x = 0; +>x : number +>0 : number + diff --git a/tests/baselines/reference/noImplicitUseStrict_es6.js b/tests/baselines/reference/noImplicitUseStrict_es6.js new file mode 100644 index 00000000000..27dbbc7ea79 --- /dev/null +++ b/tests/baselines/reference/noImplicitUseStrict_es6.js @@ -0,0 +1,6 @@ +//// [noImplicitUseStrict_es6.ts] + +export var x = 0; + +//// [noImplicitUseStrict_es6.js] +export var x = 0; diff --git a/tests/baselines/reference/noImplicitUseStrict_es6.symbols b/tests/baselines/reference/noImplicitUseStrict_es6.symbols new file mode 100644 index 00000000000..31bc1904ff9 --- /dev/null +++ b/tests/baselines/reference/noImplicitUseStrict_es6.symbols @@ -0,0 +1,5 @@ +=== tests/cases/compiler/noImplicitUseStrict_es6.ts === + +export var x = 0; +>x : Symbol(x, Decl(noImplicitUseStrict_es6.ts, 1, 10)) + diff --git a/tests/baselines/reference/noImplicitUseStrict_es6.types b/tests/baselines/reference/noImplicitUseStrict_es6.types new file mode 100644 index 00000000000..838c7316be0 --- /dev/null +++ b/tests/baselines/reference/noImplicitUseStrict_es6.types @@ -0,0 +1,6 @@ +=== tests/cases/compiler/noImplicitUseStrict_es6.ts === + +export var x = 0; +>x : number +>0 : number + diff --git a/tests/baselines/reference/noImplicitUseStrict_system.js b/tests/baselines/reference/noImplicitUseStrict_system.js new file mode 100644 index 00000000000..cf5a7e1b261 --- /dev/null +++ b/tests/baselines/reference/noImplicitUseStrict_system.js @@ -0,0 +1,15 @@ +//// [noImplicitUseStrict_system.ts] + +export var x = 0; + +//// [noImplicitUseStrict_system.js] +System.register([], function(exports_1, context_1) { + var __moduleName = context_1 && context_1.id; + var x; + return { + setters:[], + execute: function() { + exports_1("x", x = 0); + } + } +}); diff --git a/tests/baselines/reference/noImplicitUseStrict_system.symbols b/tests/baselines/reference/noImplicitUseStrict_system.symbols new file mode 100644 index 00000000000..62b89a6593d --- /dev/null +++ b/tests/baselines/reference/noImplicitUseStrict_system.symbols @@ -0,0 +1,5 @@ +=== tests/cases/compiler/noImplicitUseStrict_system.ts === + +export var x = 0; +>x : Symbol(x, Decl(noImplicitUseStrict_system.ts, 1, 10)) + diff --git a/tests/baselines/reference/noImplicitUseStrict_system.types b/tests/baselines/reference/noImplicitUseStrict_system.types new file mode 100644 index 00000000000..1da563f938b --- /dev/null +++ b/tests/baselines/reference/noImplicitUseStrict_system.types @@ -0,0 +1,6 @@ +=== tests/cases/compiler/noImplicitUseStrict_system.ts === + +export var x = 0; +>x : number +>0 : number + diff --git a/tests/baselines/reference/noImplicitUseStrict_umd.js b/tests/baselines/reference/noImplicitUseStrict_umd.js new file mode 100644 index 00000000000..ca252daeb9d --- /dev/null +++ b/tests/baselines/reference/noImplicitUseStrict_umd.js @@ -0,0 +1,15 @@ +//// [noImplicitUseStrict_umd.ts] + +export var x = 0; + +//// [noImplicitUseStrict_umd.js] +(function (factory) { + if (typeof module === 'object' && typeof module.exports === 'object') { + var v = factory(require, exports); if (v !== undefined) module.exports = v; + } + else if (typeof define === 'function' && define.amd) { + define(["require", "exports"], factory); + } +})(function (require, exports) { + exports.x = 0; +}); diff --git a/tests/baselines/reference/noImplicitUseStrict_umd.symbols b/tests/baselines/reference/noImplicitUseStrict_umd.symbols new file mode 100644 index 00000000000..a72a251ad09 --- /dev/null +++ b/tests/baselines/reference/noImplicitUseStrict_umd.symbols @@ -0,0 +1,5 @@ +=== tests/cases/compiler/noImplicitUseStrict_umd.ts === + +export var x = 0; +>x : Symbol(x, Decl(noImplicitUseStrict_umd.ts, 1, 10)) + diff --git a/tests/baselines/reference/noImplicitUseStrict_umd.types b/tests/baselines/reference/noImplicitUseStrict_umd.types new file mode 100644 index 00000000000..6a3fd6ece77 --- /dev/null +++ b/tests/baselines/reference/noImplicitUseStrict_umd.types @@ -0,0 +1,6 @@ +=== tests/cases/compiler/noImplicitUseStrict_umd.ts === + +export var x = 0; +>x : number +>0 : number + diff --git a/tests/baselines/reference/nominalSubtypeCheckOfTypeParameter.symbols b/tests/baselines/reference/nominalSubtypeCheckOfTypeParameter.symbols index f25acc772a6..c7d9a1b50f4 100644 --- a/tests/baselines/reference/nominalSubtypeCheckOfTypeParameter.symbols +++ b/tests/baselines/reference/nominalSubtypeCheckOfTypeParameter.symbols @@ -5,11 +5,11 @@ interface Tuple { >S : Symbol(S, Decl(nominalSubtypeCheckOfTypeParameter.ts, 0, 18)) first: T ->first : Symbol(first, Decl(nominalSubtypeCheckOfTypeParameter.ts, 0, 23)) +>first : Symbol(Tuple.first, Decl(nominalSubtypeCheckOfTypeParameter.ts, 0, 23)) >T : Symbol(T, Decl(nominalSubtypeCheckOfTypeParameter.ts, 0, 16)) second: S ->second : Symbol(second, Decl(nominalSubtypeCheckOfTypeParameter.ts, 1, 12)) +>second : Symbol(Tuple.second, Decl(nominalSubtypeCheckOfTypeParameter.ts, 1, 12)) >S : Symbol(S, Decl(nominalSubtypeCheckOfTypeParameter.ts, 0, 18)) } @@ -18,14 +18,14 @@ interface Sequence { >T : Symbol(T, Decl(nominalSubtypeCheckOfTypeParameter.ts, 5, 19)) hasNext(): boolean ->hasNext : Symbol(hasNext, Decl(nominalSubtypeCheckOfTypeParameter.ts, 5, 23)) +>hasNext : Symbol(Sequence.hasNext, Decl(nominalSubtypeCheckOfTypeParameter.ts, 5, 23)) pop(): T ->pop : Symbol(pop, Decl(nominalSubtypeCheckOfTypeParameter.ts, 6, 22)) +>pop : Symbol(Sequence.pop, Decl(nominalSubtypeCheckOfTypeParameter.ts, 6, 22)) >T : Symbol(T, Decl(nominalSubtypeCheckOfTypeParameter.ts, 5, 19)) zip(seq: Sequence): Sequence> ->zip : Symbol(zip, Decl(nominalSubtypeCheckOfTypeParameter.ts, 7, 14)) +>zip : Symbol(Sequence.zip, Decl(nominalSubtypeCheckOfTypeParameter.ts, 7, 14)) >S : Symbol(S, Decl(nominalSubtypeCheckOfTypeParameter.ts, 8, 10)) >seq : Symbol(seq, Decl(nominalSubtypeCheckOfTypeParameter.ts, 8, 13)) >Sequence : Symbol(Sequence, Decl(nominalSubtypeCheckOfTypeParameter.ts, 3, 1)) @@ -45,10 +45,10 @@ interface List extends Sequence { >T : Symbol(T, Decl(nominalSubtypeCheckOfTypeParameter.ts, 13, 15)) getLength(): number ->getLength : Symbol(getLength, Decl(nominalSubtypeCheckOfTypeParameter.ts, 13, 39)) +>getLength : Symbol(List.getLength, Decl(nominalSubtypeCheckOfTypeParameter.ts, 13, 39)) zip(seq: Sequence): List> ->zip : Symbol(zip, Decl(nominalSubtypeCheckOfTypeParameter.ts, 14, 23)) +>zip : Symbol(List.zip, Decl(nominalSubtypeCheckOfTypeParameter.ts, 14, 23)) >S : Symbol(S, Decl(nominalSubtypeCheckOfTypeParameter.ts, 15, 10)) >seq : Symbol(seq, Decl(nominalSubtypeCheckOfTypeParameter.ts, 15, 13)) >Sequence : Symbol(Sequence, Decl(nominalSubtypeCheckOfTypeParameter.ts, 3, 1)) diff --git a/tests/baselines/reference/nominalSubtypeCheckOfTypeParameter2.symbols b/tests/baselines/reference/nominalSubtypeCheckOfTypeParameter2.symbols index 3249c465a98..53c740cccaa 100644 --- a/tests/baselines/reference/nominalSubtypeCheckOfTypeParameter2.symbols +++ b/tests/baselines/reference/nominalSubtypeCheckOfTypeParameter2.symbols @@ -4,7 +4,7 @@ interface B { >T : Symbol(T, Decl(nominalSubtypeCheckOfTypeParameter2.ts, 0, 12)) bar: T; ->bar : Symbol(bar, Decl(nominalSubtypeCheckOfTypeParameter2.ts, 0, 16)) +>bar : Symbol(B.bar, Decl(nominalSubtypeCheckOfTypeParameter2.ts, 0, 16)) >T : Symbol(T, Decl(nominalSubtypeCheckOfTypeParameter2.ts, 0, 12)) } @@ -16,7 +16,7 @@ interface A extends B { >T : Symbol(T, Decl(nominalSubtypeCheckOfTypeParameter2.ts, 5, 12)) foo: T; ->foo : Symbol(foo, Decl(nominalSubtypeCheckOfTypeParameter2.ts, 5, 29)) +>foo : Symbol(A.foo, Decl(nominalSubtypeCheckOfTypeParameter2.ts, 5, 29)) >T : Symbol(T, Decl(nominalSubtypeCheckOfTypeParameter2.ts, 5, 12)) } @@ -28,7 +28,7 @@ interface A2 extends B> { >B : Symbol(B, Decl(nominalSubtypeCheckOfTypeParameter2.ts, 0, 0)) baz: T; ->baz : Symbol(baz, Decl(nominalSubtypeCheckOfTypeParameter2.ts, 10, 38)) +>baz : Symbol(A2.baz, Decl(nominalSubtypeCheckOfTypeParameter2.ts, 10, 38)) >T : Symbol(T, Decl(nominalSubtypeCheckOfTypeParameter2.ts, 10, 13)) } @@ -37,7 +37,7 @@ interface C { >T : Symbol(T, Decl(nominalSubtypeCheckOfTypeParameter2.ts, 14, 12)) bam: T; ->bam : Symbol(bam, Decl(nominalSubtypeCheckOfTypeParameter2.ts, 14, 16)) +>bam : Symbol(C.bam, Decl(nominalSubtypeCheckOfTypeParameter2.ts, 14, 16)) >T : Symbol(T, Decl(nominalSubtypeCheckOfTypeParameter2.ts, 14, 12)) } @@ -50,6 +50,6 @@ interface A3 extends B> { >T : Symbol(T, Decl(nominalSubtypeCheckOfTypeParameter2.ts, 19, 13)) bing: T; ->bing : Symbol(bing, Decl(nominalSubtypeCheckOfTypeParameter2.ts, 19, 33)) +>bing : Symbol(A3.bing, Decl(nominalSubtypeCheckOfTypeParameter2.ts, 19, 33)) >T : Symbol(T, Decl(nominalSubtypeCheckOfTypeParameter2.ts, 19, 13)) } diff --git a/tests/baselines/reference/nonConflictingRecursiveBaseTypeMembers.symbols b/tests/baselines/reference/nonConflictingRecursiveBaseTypeMembers.symbols index f3ff334931c..4c92f8cb109 100644 --- a/tests/baselines/reference/nonConflictingRecursiveBaseTypeMembers.symbols +++ b/tests/baselines/reference/nonConflictingRecursiveBaseTypeMembers.symbols @@ -4,7 +4,7 @@ interface A { >T : Symbol(T, Decl(nonConflictingRecursiveBaseTypeMembers.ts, 0, 12)) x: C ->x : Symbol(x, Decl(nonConflictingRecursiveBaseTypeMembers.ts, 0, 16)) +>x : Symbol(A.x, Decl(nonConflictingRecursiveBaseTypeMembers.ts, 0, 16)) >C : Symbol(C, Decl(nonConflictingRecursiveBaseTypeMembers.ts, 6, 1)) >T : Symbol(T, Decl(nonConflictingRecursiveBaseTypeMembers.ts, 0, 12)) } @@ -14,7 +14,7 @@ interface B { >T : Symbol(T, Decl(nonConflictingRecursiveBaseTypeMembers.ts, 4, 12)) x: C ->x : Symbol(x, Decl(nonConflictingRecursiveBaseTypeMembers.ts, 4, 16)) +>x : Symbol(B.x, Decl(nonConflictingRecursiveBaseTypeMembers.ts, 4, 16)) >C : Symbol(C, Decl(nonConflictingRecursiveBaseTypeMembers.ts, 6, 1)) >T : Symbol(T, Decl(nonConflictingRecursiveBaseTypeMembers.ts, 4, 12)) } diff --git a/tests/baselines/reference/nonContextuallyTypedLogicalOr.symbols b/tests/baselines/reference/nonContextuallyTypedLogicalOr.symbols index 738f4fed916..2d921f6631c 100644 --- a/tests/baselines/reference/nonContextuallyTypedLogicalOr.symbols +++ b/tests/baselines/reference/nonContextuallyTypedLogicalOr.symbols @@ -3,20 +3,20 @@ interface Contextual { >Contextual : Symbol(Contextual, Decl(nonContextuallyTypedLogicalOr.ts, 0, 0)) dummy; ->dummy : Symbol(dummy, Decl(nonContextuallyTypedLogicalOr.ts, 0, 22)) +>dummy : Symbol(Contextual.dummy, Decl(nonContextuallyTypedLogicalOr.ts, 0, 22)) p?: number; ->p : Symbol(p, Decl(nonContextuallyTypedLogicalOr.ts, 1, 10)) +>p : Symbol(Contextual.p, Decl(nonContextuallyTypedLogicalOr.ts, 1, 10)) } interface Ellement { >Ellement : Symbol(Ellement, Decl(nonContextuallyTypedLogicalOr.ts, 3, 1)) dummy; ->dummy : Symbol(dummy, Decl(nonContextuallyTypedLogicalOr.ts, 5, 20)) +>dummy : Symbol(Ellement.dummy, Decl(nonContextuallyTypedLogicalOr.ts, 5, 20)) p: any; ->p : Symbol(p, Decl(nonContextuallyTypedLogicalOr.ts, 6, 10)) +>p : Symbol(Ellement.p, Decl(nonContextuallyTypedLogicalOr.ts, 6, 10)) } var c: Contextual; diff --git a/tests/baselines/reference/nonGenericClassExtendingGenericClassWithAny.symbols b/tests/baselines/reference/nonGenericClassExtendingGenericClassWithAny.symbols index 47daa69239a..54b1dc0c6f3 100644 --- a/tests/baselines/reference/nonGenericClassExtendingGenericClassWithAny.symbols +++ b/tests/baselines/reference/nonGenericClassExtendingGenericClassWithAny.symbols @@ -4,7 +4,7 @@ class Foo { >T : Symbol(T, Decl(nonGenericClassExtendingGenericClassWithAny.ts, 0, 10)) t: T; ->t : Symbol(t, Decl(nonGenericClassExtendingGenericClassWithAny.ts, 0, 14)) +>t : Symbol(Foo.t, Decl(nonGenericClassExtendingGenericClassWithAny.ts, 0, 14)) >T : Symbol(T, Decl(nonGenericClassExtendingGenericClassWithAny.ts, 0, 10)) } diff --git a/tests/baselines/reference/nonIdenticalTypeConstraints.errors.txt b/tests/baselines/reference/nonIdenticalTypeConstraints.errors.txt new file mode 100644 index 00000000000..627b38579a2 --- /dev/null +++ b/tests/baselines/reference/nonIdenticalTypeConstraints.errors.txt @@ -0,0 +1,50 @@ +tests/cases/compiler/nonIdenticalTypeConstraints.ts(10,11): error TS2428: All declarations of 'Foo' must have identical type parameters. +tests/cases/compiler/nonIdenticalTypeConstraints.ts(16,7): error TS2428: All declarations of 'Qux' must have identical type parameters. +tests/cases/compiler/nonIdenticalTypeConstraints.ts(36,11): error TS2428: All declarations of 'Quux' must have identical type parameters. + + +==== tests/cases/compiler/nonIdenticalTypeConstraints.ts (3 errors) ==== + class Different { + a: number; + b: string; + c: boolean; + } + + class Foo { + n: T; + } + interface Foo { + ~~~ +!!! error TS2428: All declarations of 'Foo' must have identical type parameters. + y: T; + } + interface Qux { + y: T; + } + class Qux { + ~~~ +!!! error TS2428: All declarations of 'Qux' must have identical type parameters. + n: T; + } + + class Bar { + n: T; + } + interface Bar { + y: T; + } + interface Baz { + y: T; + } + class Baz { + n: T; + } + + class Quux { + n: T; + } + interface Quux { + ~~~~ +!!! error TS2428: All declarations of 'Quux' must have identical type parameters. + m: U; + } \ No newline at end of file diff --git a/tests/baselines/reference/nonIdenticalTypeConstraints.js b/tests/baselines/reference/nonIdenticalTypeConstraints.js new file mode 100644 index 00000000000..73748f63885 --- /dev/null +++ b/tests/baselines/reference/nonIdenticalTypeConstraints.js @@ -0,0 +1,71 @@ +//// [nonIdenticalTypeConstraints.ts] +class Different { + a: number; + b: string; + c: boolean; +} + +class Foo { + n: T; +} +interface Foo { + y: T; +} +interface Qux { + y: T; +} +class Qux { + n: T; +} + +class Bar { + n: T; +} +interface Bar { + y: T; +} +interface Baz { + y: T; +} +class Baz { + n: T; +} + +class Quux { + n: T; +} +interface Quux { + m: U; +} + +//// [nonIdenticalTypeConstraints.js] +var Different = (function () { + function Different() { + } + return Different; +}()); +var Foo = (function () { + function Foo() { + } + return Foo; +}()); +var Qux = (function () { + function Qux() { + } + return Qux; +}()); +var Bar = (function () { + function Bar() { + } + return Bar; +}()); +var Baz = (function () { + function Baz() { + } + return Baz; +}()); +var Quux = (function () { + function Quux() { + } + return Quux; +}()); diff --git a/tests/baselines/reference/nonInstantiatedModule.symbols b/tests/baselines/reference/nonInstantiatedModule.symbols index 0d67b0318f8..aac81ee5565 100644 --- a/tests/baselines/reference/nonInstantiatedModule.symbols +++ b/tests/baselines/reference/nonInstantiatedModule.symbols @@ -4,8 +4,8 @@ module M { export interface Point { x: number; y: number } >Point : Symbol(Point, Decl(nonInstantiatedModule.ts, 0, 10)) ->x : Symbol(x, Decl(nonInstantiatedModule.ts, 1, 28)) ->y : Symbol(y, Decl(nonInstantiatedModule.ts, 1, 39)) +>x : Symbol(Point.x, Decl(nonInstantiatedModule.ts, 1, 28)) +>y : Symbol(Point.y, Decl(nonInstantiatedModule.ts, 1, 39)) export var a = 1; >a : Symbol(a, Decl(nonInstantiatedModule.ts, 2, 14)) @@ -58,10 +58,10 @@ module M2 { >Point : Symbol(Point, Decl(nonInstantiatedModule.ts, 15, 11), Decl(nonInstantiatedModule.ts, 20, 5)) x: number; ->x : Symbol(x, Decl(nonInstantiatedModule.ts, 22, 28)) +>x : Symbol(Point.x, Decl(nonInstantiatedModule.ts, 22, 28)) y: number; ->y : Symbol(y, Decl(nonInstantiatedModule.ts, 23, 18)) +>y : Symbol(Point.y, Decl(nonInstantiatedModule.ts, 23, 18)) } } @@ -97,8 +97,8 @@ module M3 { >Point : Symbol(Point, Decl(nonInstantiatedModule.ts, 35, 25)) x: number; y: number; ->x : Symbol(x, Decl(nonInstantiatedModule.ts, 36, 32)) ->y : Symbol(y, Decl(nonInstantiatedModule.ts, 37, 22)) +>x : Symbol(Point.x, Decl(nonInstantiatedModule.ts, 36, 32)) +>y : Symbol(Point.y, Decl(nonInstantiatedModule.ts, 37, 22)) } } @@ -106,6 +106,6 @@ module M3 { >Utils : Symbol(Utils, Decl(nonInstantiatedModule.ts, 34, 11), Decl(nonInstantiatedModule.ts, 39, 5)) name: string; ->name : Symbol(name, Decl(nonInstantiatedModule.ts, 41, 24)) +>name : Symbol(Utils.name, Decl(nonInstantiatedModule.ts, 41, 24)) } } diff --git a/tests/baselines/reference/nonMergedOverloads.errors.txt b/tests/baselines/reference/nonMergedOverloads.errors.txt index f5fb58247da..b21a471ea8c 100644 --- a/tests/baselines/reference/nonMergedOverloads.errors.txt +++ b/tests/baselines/reference/nonMergedOverloads.errors.txt @@ -1,18 +1,15 @@ tests/cases/compiler/nonMergedOverloads.ts(1,5): error TS2300: Duplicate identifier 'f'. -tests/cases/compiler/nonMergedOverloads.ts(3,17): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/compiler/nonMergedOverloads.ts(3,17): error TS2300: Duplicate identifier 'f'. tests/cases/compiler/nonMergedOverloads.ts(4,17): error TS2300: Duplicate identifier 'f'. -==== tests/cases/compiler/nonMergedOverloads.ts (4 errors) ==== +==== tests/cases/compiler/nonMergedOverloads.ts (3 errors) ==== var f = 10; ~ !!! error TS2300: Duplicate identifier 'f'. export function f(); ~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. - ~ !!! error TS2300: Duplicate identifier 'f'. export function f() { ~ diff --git a/tests/baselines/reference/null.symbols b/tests/baselines/reference/null.symbols index bd3d835995b..f1d888e6889 100644 --- a/tests/baselines/reference/null.symbols +++ b/tests/baselines/reference/null.symbols @@ -30,10 +30,10 @@ interface I { >I : Symbol(I, Decl(null.ts, 13, 1)) x:any; ->x : Symbol(x, Decl(null.ts, 14, 13)) +>x : Symbol(I.x, Decl(null.ts, 14, 13)) y:number; ->y : Symbol(y, Decl(null.ts, 15, 10)) +>y : Symbol(I.y, Decl(null.ts, 15, 10)) } var w:I={x:null,y:3}; >w : Symbol(w, Decl(null.ts, 18, 3)) diff --git a/tests/baselines/reference/nullAssignableToEveryType.symbols b/tests/baselines/reference/nullAssignableToEveryType.symbols index a01077c8eb4..969686563a3 100644 --- a/tests/baselines/reference/nullAssignableToEveryType.symbols +++ b/tests/baselines/reference/nullAssignableToEveryType.symbols @@ -3,7 +3,7 @@ class C { >C : Symbol(C, Decl(nullAssignableToEveryType.ts, 0, 0)) foo: string; ->foo : Symbol(foo, Decl(nullAssignableToEveryType.ts, 0, 9)) +>foo : Symbol(C.foo, Decl(nullAssignableToEveryType.ts, 0, 9)) } var ac: C; >ac : Symbol(ac, Decl(nullAssignableToEveryType.ts, 3, 3)) @@ -13,7 +13,7 @@ interface I { >I : Symbol(I, Decl(nullAssignableToEveryType.ts, 3, 10)) foo: string; ->foo : Symbol(foo, Decl(nullAssignableToEveryType.ts, 4, 13)) +>foo : Symbol(I.foo, Decl(nullAssignableToEveryType.ts, 4, 13)) } var ai: I; >ai : Symbol(ai, Decl(nullAssignableToEveryType.ts, 7, 3)) @@ -38,7 +38,7 @@ var d: boolean = null; var e: Date = null; >e : Symbol(e, Decl(nullAssignableToEveryType.ts, 15, 3)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) var f: any = null; >f : Symbol(f, Decl(nullAssignableToEveryType.ts, 16, 3)) @@ -89,18 +89,18 @@ var o: (x: T) => T = null; var p: Number = null; >p : Symbol(p, Decl(nullAssignableToEveryType.ts, 29, 3)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) var q: String = null; >q : Symbol(q, Decl(nullAssignableToEveryType.ts, 30, 3)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo(x: T, y: U, z: V) { >foo : Symbol(foo, Decl(nullAssignableToEveryType.ts, 30, 21)) >T : Symbol(T, Decl(nullAssignableToEveryType.ts, 32, 13)) >U : Symbol(U, Decl(nullAssignableToEveryType.ts, 32, 15)) >V : Symbol(V, Decl(nullAssignableToEveryType.ts, 32, 18)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(nullAssignableToEveryType.ts, 32, 35)) >T : Symbol(T, Decl(nullAssignableToEveryType.ts, 32, 13)) >y : Symbol(y, Decl(nullAssignableToEveryType.ts, 32, 40)) diff --git a/tests/baselines/reference/nullIsSubtypeOfEverythingButUndefined.symbols b/tests/baselines/reference/nullIsSubtypeOfEverythingButUndefined.symbols index cb6fab17560..3d4fb84145e 100644 --- a/tests/baselines/reference/nullIsSubtypeOfEverythingButUndefined.symbols +++ b/tests/baselines/reference/nullIsSubtypeOfEverythingButUndefined.symbols @@ -39,11 +39,11 @@ var r3 = true ? null : true; var r4 = true ? new Date() : null; >r4 : Symbol(r4, Decl(nullIsSubtypeOfEverythingButUndefined.ts, 18, 3), Decl(nullIsSubtypeOfEverythingButUndefined.ts, 19, 3)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) var r4 = true ? null : new Date(); >r4 : Symbol(r4, Decl(nullIsSubtypeOfEverythingButUndefined.ts, 18, 3), Decl(nullIsSubtypeOfEverythingButUndefined.ts, 19, 3)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) var r5 = true ? /1/ : null; >r5 : Symbol(r5, Decl(nullIsSubtypeOfEverythingButUndefined.ts, 21, 3), Decl(nullIsSubtypeOfEverythingButUndefined.ts, 22, 3)) @@ -81,7 +81,7 @@ var r8b = true ? null : (x: T) => { return x }; // type parameters not identi interface I1 { foo: number; } >I1 : Symbol(I1, Decl(nullIsSubtypeOfEverythingButUndefined.ts, 31, 50)) ->foo : Symbol(foo, Decl(nullIsSubtypeOfEverythingButUndefined.ts, 33, 14)) +>foo : Symbol(I1.foo, Decl(nullIsSubtypeOfEverythingButUndefined.ts, 33, 14)) var i1: I1; >i1 : Symbol(i1, Decl(nullIsSubtypeOfEverythingButUndefined.ts, 34, 3)) @@ -97,7 +97,7 @@ var r9 = true ? null : i1; class C1 { foo: number; } >C1 : Symbol(C1, Decl(nullIsSubtypeOfEverythingButUndefined.ts, 36, 26)) ->foo : Symbol(foo, Decl(nullIsSubtypeOfEverythingButUndefined.ts, 38, 10)) +>foo : Symbol(C1.foo, Decl(nullIsSubtypeOfEverythingButUndefined.ts, 38, 10)) var c1: C1; >c1 : Symbol(c1, Decl(nullIsSubtypeOfEverythingButUndefined.ts, 39, 3)) @@ -114,7 +114,7 @@ var r10 = true ? null : c1; class C2 { foo: T; } >C2 : Symbol(C2, Decl(nullIsSubtypeOfEverythingButUndefined.ts, 41, 27)) >T : Symbol(T, Decl(nullIsSubtypeOfEverythingButUndefined.ts, 43, 9)) ->foo : Symbol(foo, Decl(nullIsSubtypeOfEverythingButUndefined.ts, 43, 13)) +>foo : Symbol(C2.foo, Decl(nullIsSubtypeOfEverythingButUndefined.ts, 43, 13)) >T : Symbol(T, Decl(nullIsSubtypeOfEverythingButUndefined.ts, 43, 9)) var c2: C2; @@ -176,7 +176,7 @@ var r15 = true ? null : af; class c { baz: string } >c : Symbol(c, Decl(nullIsSubtypeOfEverythingButUndefined.ts, 61, 27), Decl(nullIsSubtypeOfEverythingButUndefined.ts, 63, 23)) ->baz : Symbol(baz, Decl(nullIsSubtypeOfEverythingButUndefined.ts, 63, 9)) +>baz : Symbol(c.baz, Decl(nullIsSubtypeOfEverythingButUndefined.ts, 63, 9)) module c { >c : Symbol(c, Decl(nullIsSubtypeOfEverythingButUndefined.ts, 61, 27), Decl(nullIsSubtypeOfEverythingButUndefined.ts, 63, 23)) diff --git a/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations.errors.txt b/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations.errors.txt index 35673eb3072..bb01b2fe125 100644 --- a/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations.errors.txt +++ b/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations.errors.txt @@ -5,10 +5,9 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerCo tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(36,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(50,5): error TS2412: Property '2.0' of type 'number' is not assignable to numeric index type 'string'. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(68,5): error TS2412: Property '2.0' of type 'number' is not assignable to numeric index type 'string'. -tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(78,5): error TS2322: Type '{ [x: number]: string | number; 1.0: string; 2.0: number; a: string; b: number; c: () => void; "d": string; "e": number; "3.0": string; "4.0": number; f: any; X: string; foo(): string; }' is not assignable to type '{ [x: number]: string; }'. - Index signatures are incompatible. - Type 'string | number' is not assignable to type 'string'. - Type 'number' is not assignable to type 'string'. +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(78,5): error TS2322: Type '{ 1.0: string; 2.0: number; a: string; b: number; c: () => void; "d": string; "e": number; "3.0": string; "4.0": number; f: any; X: string; foo(): string; }' is not assignable to type '{ [x: number]: string; }'. + Property '2.0' is incompatible with index signature. + Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(88,9): error TS2304: Cannot find name 'Myn'. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(90,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(93,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. @@ -108,10 +107,9 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerCo // error var b: { [x: number]: string; } = { ~ -!!! error TS2322: Type '{ [x: number]: string | number; 1.0: string; 2.0: number; a: string; b: number; c: () => void; "d": string; "e": number; "3.0": string; "4.0": number; f: any; X: string; foo(): string; }' is not assignable to type '{ [x: number]: string; }'. -!!! error TS2322: Index signatures are incompatible. -!!! error TS2322: Type 'string | number' is not assignable to type 'string'. -!!! error TS2322: Type 'number' is not assignable to type 'string'. +!!! error TS2322: Type '{ 1.0: string; 2.0: number; a: string; b: number; c: () => void; "d": string; "e": number; "3.0": string; "4.0": number; f: any; X: string; foo(): string; }' is not assignable to type '{ [x: number]: string; }'. +!!! error TS2322: Property '2.0' is incompatible with index signature. +!!! error TS2322: Type 'number' is not assignable to type 'string'. a: '', b: 1, c: () => { }, diff --git a/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.errors.txt b/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.errors.txt index ff18160e9a5..332b356c732 100644 --- a/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.errors.txt +++ b/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.errors.txt @@ -1,10 +1,9 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations2.ts(16,5): error TS2412: Property '3.0' of type 'number' is not assignable to numeric index type 'A'. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations2.ts(25,5): error TS2412: Property '3.0' of type 'number' is not assignable to numeric index type 'A'. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations2.ts(34,5): error TS2412: Property '3.0' of type 'number' is not assignable to numeric index type 'A'. -tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations2.ts(39,5): error TS2322: Type '{ [x: number]: A | number; 1.0: A; 2.0: B; 3.0: number; "2.5": B; "4.0": string; }' is not assignable to type '{ [x: number]: A; }'. - Index signatures are incompatible. - Type 'A | number' is not assignable to type 'A'. - Type 'number' is not assignable to type 'A'. +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations2.ts(39,5): error TS2322: Type '{ 1.0: A; 2.0: B; 3.0: number; "2.5": B; "4.0": string; }' is not assignable to type '{ [x: number]: A; }'. + Property '3.0' is incompatible with index signature. + Type 'number' is not assignable to type 'A'. ==== tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations2.ts (4 errors) ==== @@ -54,10 +53,9 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerCo // error var b: { [x: number]: A } = { ~ -!!! error TS2322: Type '{ [x: number]: A | number; 1.0: A; 2.0: B; 3.0: number; "2.5": B; "4.0": string; }' is not assignable to type '{ [x: number]: A; }'. -!!! error TS2322: Index signatures are incompatible. -!!! error TS2322: Type 'A | number' is not assignable to type 'A'. -!!! error TS2322: Type 'number' is not assignable to type 'A'. +!!! error TS2322: Type '{ 1.0: A; 2.0: B; 3.0: number; "2.5": B; "4.0": string; }' is not assignable to type '{ [x: number]: A; }'. +!!! error TS2322: Property '3.0' is incompatible with index signature. +!!! error TS2322: Type 'number' is not assignable to type 'A'. 1.0: new A(), 2.0: new B(), "2.5": new B(), diff --git a/tests/baselines/reference/numericIndexerConstraint1.errors.txt b/tests/baselines/reference/numericIndexerConstraint1.errors.txt index 42cf293fe60..0d4bb17002b 100644 --- a/tests/baselines/reference/numericIndexerConstraint1.errors.txt +++ b/tests/baselines/reference/numericIndexerConstraint1.errors.txt @@ -1,5 +1,4 @@ tests/cases/compiler/numericIndexerConstraint1.ts(3,5): error TS2322: Type 'number' is not assignable to type 'Foo'. - Property 'foo' is missing in type 'Number'. ==== tests/cases/compiler/numericIndexerConstraint1.ts (1 errors) ==== @@ -8,5 +7,4 @@ tests/cases/compiler/numericIndexerConstraint1.ts(3,5): error TS2322: Type 'numb var result: Foo = x["one"]; // error ~~~~~~ !!! error TS2322: Type 'number' is not assignable to type 'Foo'. -!!! error TS2322: Property 'foo' is missing in type 'Number'. \ No newline at end of file diff --git a/tests/baselines/reference/numericIndexerConstraint2.errors.txt b/tests/baselines/reference/numericIndexerConstraint2.errors.txt index 385efbcead2..5c0337acc32 100644 --- a/tests/baselines/reference/numericIndexerConstraint2.errors.txt +++ b/tests/baselines/reference/numericIndexerConstraint2.errors.txt @@ -1,5 +1,6 @@ tests/cases/compiler/numericIndexerConstraint2.ts(4,1): error TS2322: Type '{ one: number; }' is not assignable to type '{ [index: string]: Foo; }'. - Index signature is missing in type '{ one: number; }'. + Property 'one' is incompatible with index signature. + Type 'number' is not assignable to type 'Foo'. ==== tests/cases/compiler/numericIndexerConstraint2.ts (1 errors) ==== @@ -9,4 +10,5 @@ tests/cases/compiler/numericIndexerConstraint2.ts(4,1): error TS2322: Type '{ on x = a; ~ !!! error TS2322: Type '{ one: number; }' is not assignable to type '{ [index: string]: Foo; }'. -!!! error TS2322: Index signature is missing in type '{ one: number; }'. \ No newline at end of file +!!! error TS2322: Property 'one' is incompatible with index signature. +!!! error TS2322: Type 'number' is not assignable to type 'Foo'. \ No newline at end of file diff --git a/tests/baselines/reference/numericIndexerConstraint3.symbols b/tests/baselines/reference/numericIndexerConstraint3.symbols index bdf58cb1372..5b784742ad8 100644 --- a/tests/baselines/reference/numericIndexerConstraint3.symbols +++ b/tests/baselines/reference/numericIndexerConstraint3.symbols @@ -3,7 +3,7 @@ class A { >A : Symbol(A, Decl(numericIndexerConstraint3.ts, 0, 0)) foo: number; ->foo : Symbol(foo, Decl(numericIndexerConstraint3.ts, 0, 9)) +>foo : Symbol(A.foo, Decl(numericIndexerConstraint3.ts, 0, 9)) } class B extends A { @@ -11,7 +11,7 @@ class B extends A { >A : Symbol(A, Decl(numericIndexerConstraint3.ts, 0, 0)) bar: string; ->bar : Symbol(bar, Decl(numericIndexerConstraint3.ts, 4, 19)) +>bar : Symbol(B.bar, Decl(numericIndexerConstraint3.ts, 4, 19)) } class C { diff --git a/tests/baselines/reference/numericIndexerConstraint4.symbols b/tests/baselines/reference/numericIndexerConstraint4.symbols index 63d976ea1b1..46301a6787b 100644 --- a/tests/baselines/reference/numericIndexerConstraint4.symbols +++ b/tests/baselines/reference/numericIndexerConstraint4.symbols @@ -3,7 +3,7 @@ class A { >A : Symbol(A, Decl(numericIndexerConstraint4.ts, 0, 0)) foo: number; ->foo : Symbol(foo, Decl(numericIndexerConstraint4.ts, 0, 9)) +>foo : Symbol(A.foo, Decl(numericIndexerConstraint4.ts, 0, 9)) } class B extends A { @@ -11,7 +11,7 @@ class B extends A { >A : Symbol(A, Decl(numericIndexerConstraint4.ts, 0, 0)) bar: string; ->bar : Symbol(bar, Decl(numericIndexerConstraint4.ts, 4, 19)) +>bar : Symbol(B.bar, Decl(numericIndexerConstraint4.ts, 4, 19)) } var x: { diff --git a/tests/baselines/reference/numericIndexerConstraint4.types b/tests/baselines/reference/numericIndexerConstraint4.types index 97e72b5088d..c8af4d54a9a 100644 --- a/tests/baselines/reference/numericIndexerConstraint4.types +++ b/tests/baselines/reference/numericIndexerConstraint4.types @@ -22,7 +22,7 @@ var x: { >A : A } = { data: new B() } ->{ data: new B() } : { [x: number]: undefined; data: B; } +>{ data: new B() } : { data: B; } >data : B >new B() : B >B : typeof B diff --git a/tests/baselines/reference/numericIndexerConstraint5.errors.txt b/tests/baselines/reference/numericIndexerConstraint5.errors.txt index 98acc65eeb7..cb888de08c4 100644 --- a/tests/baselines/reference/numericIndexerConstraint5.errors.txt +++ b/tests/baselines/reference/numericIndexerConstraint5.errors.txt @@ -1,5 +1,6 @@ tests/cases/compiler/numericIndexerConstraint5.ts(2,5): error TS2322: Type '{ 0: Date; name: string; }' is not assignable to type '{ [name: number]: string; }'. - Index signature is missing in type '{ 0: Date; name: string; }'. + Property '0' is incompatible with index signature. + Type 'Date' is not assignable to type 'string'. ==== tests/cases/compiler/numericIndexerConstraint5.ts (1 errors) ==== @@ -7,4 +8,5 @@ tests/cases/compiler/numericIndexerConstraint5.ts(2,5): error TS2322: Type '{ 0: var z: { [name: number]: string } = x; ~ !!! error TS2322: Type '{ 0: Date; name: string; }' is not assignable to type '{ [name: number]: string; }'. -!!! error TS2322: Index signature is missing in type '{ 0: Date; name: string; }'. \ No newline at end of file +!!! error TS2322: Property '0' is incompatible with index signature. +!!! error TS2322: Type 'Date' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/numericIndexingResults.symbols b/tests/baselines/reference/numericIndexingResults.symbols index 16a6e9386da..49a38fef567 100644 --- a/tests/baselines/reference/numericIndexingResults.symbols +++ b/tests/baselines/reference/numericIndexingResults.symbols @@ -16,12 +16,12 @@ var c: C; var r1 = c['1']; >r1 : Symbol(r1, Decl(numericIndexingResults.ts, 7, 3), Decl(numericIndexingResults.ts, 21, 3), Decl(numericIndexingResults.ts, 34, 3)) >c : Symbol(c, Decl(numericIndexingResults.ts, 6, 3)) ->'1' : Symbol(C.1, Decl(numericIndexingResults.ts, 1, 24)) +>'1' : Symbol(C[1], Decl(numericIndexingResults.ts, 1, 24)) var r2 = c['2']; >r2 : Symbol(r2, Decl(numericIndexingResults.ts, 8, 3), Decl(numericIndexingResults.ts, 22, 3), Decl(numericIndexingResults.ts, 35, 3)) >c : Symbol(c, Decl(numericIndexingResults.ts, 6, 3)) ->'2' : Symbol(C."2", Decl(numericIndexingResults.ts, 2, 11)) +>'2' : Symbol(C["2"], Decl(numericIndexingResults.ts, 2, 11)) var r3 = c['3']; >r3 : Symbol(r3, Decl(numericIndexingResults.ts, 9, 3), Decl(numericIndexingResults.ts, 23, 3), Decl(numericIndexingResults.ts, 36, 3), Decl(numericIndexingResults.ts, 44, 3), Decl(numericIndexingResults.ts, 52, 3)) @@ -30,12 +30,12 @@ var r3 = c['3']; var r4 = c[1]; >r4 : Symbol(r4, Decl(numericIndexingResults.ts, 10, 3), Decl(numericIndexingResults.ts, 24, 3), Decl(numericIndexingResults.ts, 37, 3), Decl(numericIndexingResults.ts, 45, 3), Decl(numericIndexingResults.ts, 53, 3)) >c : Symbol(c, Decl(numericIndexingResults.ts, 6, 3)) ->1 : Symbol(C.1, Decl(numericIndexingResults.ts, 1, 24)) +>1 : Symbol(C[1], Decl(numericIndexingResults.ts, 1, 24)) var r5 = c[2]; >r5 : Symbol(r5, Decl(numericIndexingResults.ts, 11, 3), Decl(numericIndexingResults.ts, 25, 3), Decl(numericIndexingResults.ts, 38, 3), Decl(numericIndexingResults.ts, 46, 3), Decl(numericIndexingResults.ts, 54, 3)) >c : Symbol(c, Decl(numericIndexingResults.ts, 6, 3)) ->2 : Symbol(C."2", Decl(numericIndexingResults.ts, 2, 11)) +>2 : Symbol(C["2"], Decl(numericIndexingResults.ts, 2, 11)) var r6 = c[3]; >r6 : Symbol(r6, Decl(numericIndexingResults.ts, 12, 3), Decl(numericIndexingResults.ts, 26, 3), Decl(numericIndexingResults.ts, 39, 3), Decl(numericIndexingResults.ts, 47, 3), Decl(numericIndexingResults.ts, 55, 3)) @@ -58,12 +58,12 @@ var i: I var r1 = i['1']; >r1 : Symbol(r1, Decl(numericIndexingResults.ts, 7, 3), Decl(numericIndexingResults.ts, 21, 3), Decl(numericIndexingResults.ts, 34, 3)) >i : Symbol(i, Decl(numericIndexingResults.ts, 20, 3)) ->'1' : Symbol(I.1, Decl(numericIndexingResults.ts, 15, 24)) +>'1' : Symbol(I[1], Decl(numericIndexingResults.ts, 15, 24)) var r2 = i['2']; >r2 : Symbol(r2, Decl(numericIndexingResults.ts, 8, 3), Decl(numericIndexingResults.ts, 22, 3), Decl(numericIndexingResults.ts, 35, 3)) >i : Symbol(i, Decl(numericIndexingResults.ts, 20, 3)) ->'2' : Symbol(I."2", Decl(numericIndexingResults.ts, 16, 14)) +>'2' : Symbol(I["2"], Decl(numericIndexingResults.ts, 16, 14)) var r3 = i['3']; >r3 : Symbol(r3, Decl(numericIndexingResults.ts, 9, 3), Decl(numericIndexingResults.ts, 23, 3), Decl(numericIndexingResults.ts, 36, 3), Decl(numericIndexingResults.ts, 44, 3), Decl(numericIndexingResults.ts, 52, 3)) @@ -72,12 +72,12 @@ var r3 = i['3']; var r4 = i[1]; >r4 : Symbol(r4, Decl(numericIndexingResults.ts, 10, 3), Decl(numericIndexingResults.ts, 24, 3), Decl(numericIndexingResults.ts, 37, 3), Decl(numericIndexingResults.ts, 45, 3), Decl(numericIndexingResults.ts, 53, 3)) >i : Symbol(i, Decl(numericIndexingResults.ts, 20, 3)) ->1 : Symbol(I.1, Decl(numericIndexingResults.ts, 15, 24)) +>1 : Symbol(I[1], Decl(numericIndexingResults.ts, 15, 24)) var r5 = i[2]; >r5 : Symbol(r5, Decl(numericIndexingResults.ts, 11, 3), Decl(numericIndexingResults.ts, 25, 3), Decl(numericIndexingResults.ts, 38, 3), Decl(numericIndexingResults.ts, 46, 3), Decl(numericIndexingResults.ts, 54, 3)) >i : Symbol(i, Decl(numericIndexingResults.ts, 20, 3)) ->2 : Symbol(I."2", Decl(numericIndexingResults.ts, 16, 14)) +>2 : Symbol(I["2"], Decl(numericIndexingResults.ts, 16, 14)) var r6 = i[3]; >r6 : Symbol(r6, Decl(numericIndexingResults.ts, 12, 3), Decl(numericIndexingResults.ts, 26, 3), Decl(numericIndexingResults.ts, 39, 3), Decl(numericIndexingResults.ts, 47, 3), Decl(numericIndexingResults.ts, 55, 3)) diff --git a/tests/baselines/reference/numericIndexingResults.types b/tests/baselines/reference/numericIndexingResults.types index 560bbdc74a8..9a060b388e3 100644 --- a/tests/baselines/reference/numericIndexingResults.types +++ b/tests/baselines/reference/numericIndexingResults.types @@ -151,7 +151,7 @@ var r6 = a[3]; var b: { [x: number]: string } = { 1: '', "2": '' } >b : { [x: number]: string; } >x : number ->{ 1: '', "2": '' } : { [x: number]: string; 1: string; "2": string; } +>{ 1: '', "2": '' } : { 1: string; "2": string; } >'' : string >'' : string @@ -194,7 +194,7 @@ var r6 = b[3]; var b2: { [x: number]: string; 1: string; "2": string; } = { 1: '', "2": '' } >b2 : { [x: number]: string; 1: string; "2": string; } >x : number ->{ 1: '', "2": '' } : { [x: number]: string; 1: string; "2": string; } +>{ 1: '', "2": '' } : { 1: string; "2": string; } >'' : string >'' : string diff --git a/tests/baselines/reference/objectIndexer.symbols b/tests/baselines/reference/objectIndexer.symbols index 33885a40e27..56d1d4242ca 100644 --- a/tests/baselines/reference/objectIndexer.symbols +++ b/tests/baselines/reference/objectIndexer.symbols @@ -18,14 +18,14 @@ class Emitter { >Emitter : Symbol(Emitter, Decl(objectIndexer.ts, 6, 1)) private listeners: IMap; ->listeners : Symbol(listeners, Decl(objectIndexer.ts, 8, 15)) +>listeners : Symbol(Emitter.listeners, Decl(objectIndexer.ts, 8, 15)) >IMap : Symbol(IMap, Decl(objectIndexer.ts, 2, 1)) constructor () { this.listeners = {}; ->this.listeners : Symbol(listeners, Decl(objectIndexer.ts, 8, 15)) +>this.listeners : Symbol(Emitter.listeners, Decl(objectIndexer.ts, 8, 15)) >this : Symbol(Emitter, Decl(objectIndexer.ts, 6, 1)) ->listeners : Symbol(listeners, Decl(objectIndexer.ts, 8, 15)) +>listeners : Symbol(Emitter.listeners, Decl(objectIndexer.ts, 8, 15)) } } diff --git a/tests/baselines/reference/objectIndexer.types b/tests/baselines/reference/objectIndexer.types index 3dcd7bcb77e..b11c475a386 100644 --- a/tests/baselines/reference/objectIndexer.types +++ b/tests/baselines/reference/objectIndexer.types @@ -23,11 +23,11 @@ class Emitter { constructor () { this.listeners = {}; ->this.listeners = {} : { [x: string]: undefined; } +>this.listeners = {} : {} >this.listeners : IMap >this : this >listeners : IMap ->{} : { [x: string]: undefined; } +>{} : {} } } diff --git a/tests/baselines/reference/objectLiteralArraySpecialization.symbols b/tests/baselines/reference/objectLiteralArraySpecialization.symbols index 4cc1188dcc4..0b91dd4a350 100644 --- a/tests/baselines/reference/objectLiteralArraySpecialization.symbols +++ b/tests/baselines/reference/objectLiteralArraySpecialization.symbols @@ -12,12 +12,12 @@ interface MyArrayWrapper { >T : Symbol(T, Decl(objectLiteralArraySpecialization.ts, 1, 25)) constructor(initialItems?: T[]); ->constructor : Symbol(constructor, Decl(objectLiteralArraySpecialization.ts, 1, 29)) +>constructor : Symbol(MyArrayWrapper.constructor, Decl(objectLiteralArraySpecialization.ts, 1, 29)) >initialItems : Symbol(initialItems, Decl(objectLiteralArraySpecialization.ts, 2, 13)) >T : Symbol(T, Decl(objectLiteralArraySpecialization.ts, 1, 25)) doSomething(predicate: (x: T, y: T) => boolean): void; ->doSomething : Symbol(doSomething, Decl(objectLiteralArraySpecialization.ts, 2, 33)) +>doSomething : Symbol(MyArrayWrapper.doSomething, Decl(objectLiteralArraySpecialization.ts, 2, 33)) >predicate : Symbol(predicate, Decl(objectLiteralArraySpecialization.ts, 3, 13)) >x : Symbol(x, Decl(objectLiteralArraySpecialization.ts, 3, 25)) >T : Symbol(T, Decl(objectLiteralArraySpecialization.ts, 1, 25)) diff --git a/tests/baselines/reference/objectLiteralContextualTyping.symbols b/tests/baselines/reference/objectLiteralContextualTyping.symbols index 23a468eac3f..171ae48776f 100644 --- a/tests/baselines/reference/objectLiteralContextualTyping.symbols +++ b/tests/baselines/reference/objectLiteralContextualTyping.symbols @@ -8,10 +8,10 @@ interface Item { >Item : Symbol(Item, Decl(objectLiteralContextualTyping.ts, 0, 0)) name: string; ->name : Symbol(name, Decl(objectLiteralContextualTyping.ts, 5, 16)) +>name : Symbol(Item.name, Decl(objectLiteralContextualTyping.ts, 5, 16)) description?: string; ->description : Symbol(description, Decl(objectLiteralContextualTyping.ts, 6, 17)) +>description : Symbol(Item.description, Decl(objectLiteralContextualTyping.ts, 6, 17)) } declare function foo(item: Item): string; diff --git a/tests/baselines/reference/objectLiteralErrors.errors.txt b/tests/baselines/reference/objectLiteralErrors.errors.txt index 19935f52bdc..134b79a443e 100644 --- a/tests/baselines/reference/objectLiteralErrors.errors.txt +++ b/tests/baselines/reference/objectLiteralErrors.errors.txt @@ -89,11 +89,11 @@ tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(39,26) tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(40,13): error TS2300: Duplicate identifier 'a'. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(40,46): error TS1119: An object literal cannot have property and accessor with the same name. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(40,46): error TS2300: Duplicate identifier 'a'. -tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(43,12): error TS2380: 'get' and 'set' accessor must have the same type. -tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(43,43): error TS2380: 'get' and 'set' accessor must have the same type. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(43,16): error TS2380: 'get' and 'set' accessor must have the same type. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(43,47): error TS2380: 'get' and 'set' accessor must have the same type. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(44,29): error TS2322: Type 'number' is not assignable to type 'string'. -tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(45,12): error TS2380: 'get' and 'set' accessor must have the same type. -tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(45,51): error TS2380: 'get' and 'set' accessor must have the same type. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(45,16): error TS2380: 'get' and 'set' accessor must have the same type. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(45,55): error TS2380: 'get' and 'set' accessor must have the same type. ==== tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts (96 errors) ==== @@ -322,16 +322,16 @@ tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(45,51) // Get and set accessor with mismatched type annotations var g1 = { get a(): number { return 4; }, set a(n: string) { } }; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~ !!! error TS2380: 'get' and 'set' accessor must have the same type. - ~~~~~~~~~~~~~~~~~~~~ + ~ !!! error TS2380: 'get' and 'set' accessor must have the same type. var g2 = { get a() { return 4; }, set a(n: string) { } }; ~ !!! error TS2322: Type 'number' is not assignable to type 'string'. var g3 = { get a(): number { return undefined; }, set a(n: string) { } }; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~ !!! error TS2380: 'get' and 'set' accessor must have the same type. - ~~~~~~~~~~~~~~~~~~~~ + ~ !!! error TS2380: 'get' and 'set' accessor must have the same type. \ No newline at end of file diff --git a/tests/baselines/reference/objectLiteralGettersAndSetters.errors.txt b/tests/baselines/reference/objectLiteralGettersAndSetters.errors.txt index 4e04b856d8c..1290859fbf9 100644 --- a/tests/baselines/reference/objectLiteralGettersAndSetters.errors.txt +++ b/tests/baselines/reference/objectLiteralGettersAndSetters.errors.txt @@ -79,13 +79,13 @@ tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetter var getter1 = { get x(): string { return undefined; } }; ~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. - var getter1: { x: string; } + var getter1: { readonly x: string; } // Get accessor only, type of the property is the inferred return type of the get accessor var getter2 = { get x() { return ''; } }; ~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. - var getter2: { x: string; } + var getter2: { readonly x: string; } // Set accessor only, type of the property is the param type of the set accessor var setter1 = { set x(n: number) { } }; diff --git a/tests/baselines/reference/objectLiteralGettersAndSetters.js b/tests/baselines/reference/objectLiteralGettersAndSetters.js index d226c2c5569..d3a9d643086 100644 --- a/tests/baselines/reference/objectLiteralGettersAndSetters.js +++ b/tests/baselines/reference/objectLiteralGettersAndSetters.js @@ -17,11 +17,11 @@ var callSig3: { num: (n: number) => string; }; // Get accessor only, type of the property is the annotated return type of the get accessor var getter1 = { get x(): string { return undefined; } }; -var getter1: { x: string; } +var getter1: { readonly x: string; } // Get accessor only, type of the property is the inferred return type of the get accessor var getter2 = { get x() { return ''; } }; -var getter2: { x: string; } +var getter2: { readonly x: string; } // Set accessor only, type of the property is the param type of the set accessor var setter1 = { set x(n: number) { } }; diff --git a/tests/baselines/reference/objectLiteralIndexerErrors.errors.txt b/tests/baselines/reference/objectLiteralIndexerErrors.errors.txt index c35e49f02a3..9d5ff7ea0a2 100644 --- a/tests/baselines/reference/objectLiteralIndexerErrors.errors.txt +++ b/tests/baselines/reference/objectLiteralIndexerErrors.errors.txt @@ -1,9 +1,13 @@ -tests/cases/compiler/objectLiteralIndexerErrors.ts(13,5): error TS2322: Type '{ [x: string]: A; [x: number]: A; 0: A; x: B; }' is not assignable to type '{ [s: string]: A; [n: number]: B; }'. - Index signatures are incompatible. +tests/cases/compiler/objectLiteralIndexerErrors.ts(13,5): error TS2322: Type '{ 0: A; x: B; }' is not assignable to type '{ [s: string]: A; [n: number]: B; }'. + Property '0' is incompatible with index signature. + Type 'A' is not assignable to type 'B'. + Property 'y' is missing in type 'A'. +tests/cases/compiler/objectLiteralIndexerErrors.ts(14,1): error TS2322: Type '{ 0: A; x: any; }' is not assignable to type '{ [s: string]: A; [n: number]: B; }'. + Property '0' is incompatible with index signature. Type 'A' is not assignable to type 'B'. -==== tests/cases/compiler/objectLiteralIndexerErrors.ts (1 errors) ==== +==== tests/cases/compiler/objectLiteralIndexerErrors.ts (2 errors) ==== interface A { x: number; } @@ -18,7 +22,12 @@ tests/cases/compiler/objectLiteralIndexerErrors.ts(13,5): error TS2322: Type '{ var o1: { [s: string]: A;[n: number]: B; } = { x: b, 0: a }; // both indexers are A ~~ -!!! error TS2322: Type '{ [x: string]: A; [x: number]: A; 0: A; x: B; }' is not assignable to type '{ [s: string]: A; [n: number]: B; }'. -!!! error TS2322: Index signatures are incompatible. +!!! error TS2322: Type '{ 0: A; x: B; }' is not assignable to type '{ [s: string]: A; [n: number]: B; }'. +!!! error TS2322: Property '0' is incompatible with index signature. !!! error TS2322: Type 'A' is not assignable to type 'B'. - o1 = { x: c, 0: a }; // string indexer is any, number indexer is A \ No newline at end of file +!!! error TS2322: Property 'y' is missing in type 'A'. + o1 = { x: c, 0: a }; // string indexer is any, number indexer is A + ~~ +!!! error TS2322: Type '{ 0: A; x: any; }' is not assignable to type '{ [s: string]: A; [n: number]: B; }'. +!!! error TS2322: Property '0' is incompatible with index signature. +!!! error TS2322: Type 'A' is not assignable to type 'B'. \ No newline at end of file diff --git a/tests/baselines/reference/objectLiteralIndexerNoImplicitAny.types b/tests/baselines/reference/objectLiteralIndexerNoImplicitAny.types index a49f76d02e9..b0ddd9f60d0 100644 --- a/tests/baselines/reference/objectLiteralIndexerNoImplicitAny.types +++ b/tests/baselines/reference/objectLiteralIndexerNoImplicitAny.types @@ -9,7 +9,7 @@ interface I { var x: I = { >x : I >I : I ->{ p: null} : { [x: string]: null; p: null; } +>{ p: null} : { p: null; } p: null >p : null diff --git a/tests/baselines/reference/objectLiteralIndexers.symbols b/tests/baselines/reference/objectLiteralIndexers.symbols index 424e95be0fa..53e1c82aca4 100644 --- a/tests/baselines/reference/objectLiteralIndexers.symbols +++ b/tests/baselines/reference/objectLiteralIndexers.symbols @@ -3,7 +3,7 @@ interface A { >A : Symbol(A, Decl(objectLiteralIndexers.ts, 0, 0)) x: number; ->x : Symbol(x, Decl(objectLiteralIndexers.ts, 0, 13)) +>x : Symbol(A.x, Decl(objectLiteralIndexers.ts, 0, 13)) } interface B extends A { @@ -11,7 +11,7 @@ interface B extends A { >A : Symbol(A, Decl(objectLiteralIndexers.ts, 0, 0)) y: string; ->y : Symbol(y, Decl(objectLiteralIndexers.ts, 4, 23)) +>y : Symbol(B.y, Decl(objectLiteralIndexers.ts, 4, 23)) } var a: A; diff --git a/tests/baselines/reference/objectLiteralIndexers.types b/tests/baselines/reference/objectLiteralIndexers.types index d5add00ebaf..9e3aa4bac49 100644 --- a/tests/baselines/reference/objectLiteralIndexers.types +++ b/tests/baselines/reference/objectLiteralIndexers.types @@ -31,23 +31,23 @@ var o1: { [s: string]: A;[n: number]: B; } = { x: a, 0: b }; // string indexer i >A : A >n : number >B : B ->{ x: a, 0: b } : { [x: string]: A; [x: number]: B; 0: B; x: A; } +>{ x: a, 0: b } : { 0: B; x: A; } >x : A >a : A >b : B o1 = { x: b, 0: c }; // both indexers are any ->o1 = { x: b, 0: c } : { [x: string]: any; [x: number]: any; 0: any; x: B; } +>o1 = { x: b, 0: c } : { 0: any; x: B; } >o1 : { [s: string]: A; [n: number]: B; } ->{ x: b, 0: c } : { [x: string]: any; [x: number]: any; 0: any; x: B; } +>{ x: b, 0: c } : { 0: any; x: B; } >x : B >b : B >c : any o1 = { x: c, 0: b }; // string indexer is any, number indexer is B ->o1 = { x: c, 0: b } : { [x: string]: any; [x: number]: B; 0: B; x: any; } +>o1 = { x: c, 0: b } : { 0: B; x: any; } >o1 : { [s: string]: A; [n: number]: B; } ->{ x: c, 0: b } : { [x: string]: any; [x: number]: B; 0: B; x: any; } +>{ x: c, 0: b } : { 0: B; x: any; } >x : any >c : any >b : B diff --git a/tests/baselines/reference/objectLiteralMemberWithQuestionMark1.errors.txt b/tests/baselines/reference/objectLiteralMemberWithQuestionMark1.errors.txt index b10ba701143..f77bad8664c 100644 --- a/tests/baselines/reference/objectLiteralMemberWithQuestionMark1.errors.txt +++ b/tests/baselines/reference/objectLiteralMemberWithQuestionMark1.errors.txt @@ -1,7 +1,7 @@ -tests/cases/compiler/objectLiteralMemberWithQuestionMark1.ts(1,14): error TS1112: A class member cannot be declared optional. +tests/cases/compiler/objectLiteralMemberWithQuestionMark1.ts(1,14): error TS1162: An object member cannot be declared optional. ==== tests/cases/compiler/objectLiteralMemberWithQuestionMark1.ts (1 errors) ==== var v = { foo?() { } } ~ -!!! error TS1112: A class member cannot be declared optional. \ No newline at end of file +!!! error TS1162: An object member cannot be declared optional. \ No newline at end of file diff --git a/tests/baselines/reference/objectTypeHidingMembersOfObject.symbols b/tests/baselines/reference/objectTypeHidingMembersOfObject.symbols index 5c88d538fdb..b3462d920be 100644 --- a/tests/baselines/reference/objectTypeHidingMembersOfObject.symbols +++ b/tests/baselines/reference/objectTypeHidingMembersOfObject.symbols @@ -5,7 +5,7 @@ class C { >C : Symbol(C, Decl(objectTypeHidingMembersOfObject.ts, 0, 0)) valueOf() { } ->valueOf : Symbol(valueOf, Decl(objectTypeHidingMembersOfObject.ts, 2, 9)) +>valueOf : Symbol(C.valueOf, Decl(objectTypeHidingMembersOfObject.ts, 2, 9)) } var c: C; @@ -22,7 +22,7 @@ interface I { >I : Symbol(I, Decl(objectTypeHidingMembersOfObject.ts, 7, 27)) valueOf(): void; ->valueOf : Symbol(valueOf, Decl(objectTypeHidingMembersOfObject.ts, 9, 13)) +>valueOf : Symbol(I.valueOf, Decl(objectTypeHidingMembersOfObject.ts, 9, 13)) } var i: I; diff --git a/tests/baselines/reference/objectTypePropertyAccess.symbols b/tests/baselines/reference/objectTypePropertyAccess.symbols index 2117b9ce35a..072ddf5f476 100644 --- a/tests/baselines/reference/objectTypePropertyAccess.symbols +++ b/tests/baselines/reference/objectTypePropertyAccess.symbols @@ -4,7 +4,7 @@ class C { >C : Symbol(C, Decl(objectTypePropertyAccess.ts, 0, 0)) foo: string; ->foo : Symbol(foo, Decl(objectTypePropertyAccess.ts, 1, 9)) +>foo : Symbol(C.foo, Decl(objectTypePropertyAccess.ts, 1, 9)) } var c: C; @@ -37,7 +37,7 @@ interface I { >I : Symbol(I, Decl(objectTypePropertyAccess.ts, 9, 18)) bar: string; ->bar : Symbol(bar, Decl(objectTypePropertyAccess.ts, 11, 13)) +>bar : Symbol(I.bar, Decl(objectTypePropertyAccess.ts, 11, 13)) } var i: I; >i : Symbol(i, Decl(objectTypePropertyAccess.ts, 14, 3)) diff --git a/tests/baselines/reference/objectTypeWithCallSignatureAppearsToBeFunctionType.types b/tests/baselines/reference/objectTypeWithCallSignatureAppearsToBeFunctionType.types index 74d8ef57d67..80408cff962 100644 --- a/tests/baselines/reference/objectTypeWithCallSignatureAppearsToBeFunctionType.types +++ b/tests/baselines/reference/objectTypeWithCallSignatureAppearsToBeFunctionType.types @@ -21,9 +21,9 @@ var r2b: (x: any, y?: any) => any = i.apply; >r2b : (x: any, y?: any) => any >x : any >y : any ->i.apply : (thisArg: any, argArray?: any) => any +>i.apply : (this: Function, thisArg: any, argArray?: any) => any >i : I ->apply : (thisArg: any, argArray?: any) => any +>apply : (this: Function, thisArg: any, argArray?: any) => any var b: { >b : () => void @@ -40,7 +40,7 @@ var rb4: (x: any, y?: any) => any = b.apply; >rb4 : (x: any, y?: any) => any >x : any >y : any ->b.apply : (thisArg: any, argArray?: any) => any +>b.apply : (this: Function, thisArg: any, argArray?: any) => any >b : () => void ->apply : (thisArg: any, argArray?: any) => any +>apply : (this: Function, thisArg: any, argArray?: any) => any diff --git a/tests/baselines/reference/objectTypeWithCallSignatureHidingMembersOfExtendedFunction.symbols b/tests/baselines/reference/objectTypeWithCallSignatureHidingMembersOfExtendedFunction.symbols index 2d80be5f4ea..8700c3a042f 100644 --- a/tests/baselines/reference/objectTypeWithCallSignatureHidingMembersOfExtendedFunction.symbols +++ b/tests/baselines/reference/objectTypeWithCallSignatureHidingMembersOfExtendedFunction.symbols @@ -6,7 +6,7 @@ interface Function { >Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(objectTypeWithCallSignatureHidingMembersOfExtendedFunction.ts, 0, 0)) data: number; ->data : Symbol(data, Decl(objectTypeWithCallSignatureHidingMembersOfExtendedFunction.ts, 3, 20)) +>data : Symbol(Function.data, Decl(objectTypeWithCallSignatureHidingMembersOfExtendedFunction.ts, 3, 20)) [x: string]: Object; >x : Symbol(x, Decl(objectTypeWithCallSignatureHidingMembersOfExtendedFunction.ts, 5, 5)) @@ -18,12 +18,12 @@ interface I { (): void; apply(a: any, b?: any): void; ->apply : Symbol(apply, Decl(objectTypeWithCallSignatureHidingMembersOfExtendedFunction.ts, 9, 13)) +>apply : Symbol(I.apply, Decl(objectTypeWithCallSignatureHidingMembersOfExtendedFunction.ts, 9, 13)) >a : Symbol(a, Decl(objectTypeWithCallSignatureHidingMembersOfExtendedFunction.ts, 10, 10)) >b : Symbol(b, Decl(objectTypeWithCallSignatureHidingMembersOfExtendedFunction.ts, 10, 17)) call(thisArg: number, ...argArray: number[]): any; ->call : Symbol(call, Decl(objectTypeWithCallSignatureHidingMembersOfExtendedFunction.ts, 10, 33)) +>call : Symbol(I.call, Decl(objectTypeWithCallSignatureHidingMembersOfExtendedFunction.ts, 10, 33)) >thisArg : Symbol(thisArg, Decl(objectTypeWithCallSignatureHidingMembersOfExtendedFunction.ts, 11, 9)) >argArray : Symbol(argArray, Decl(objectTypeWithCallSignatureHidingMembersOfExtendedFunction.ts, 11, 25)) } diff --git a/tests/baselines/reference/objectTypeWithCallSignatureHidingMembersOfFunction.symbols b/tests/baselines/reference/objectTypeWithCallSignatureHidingMembersOfFunction.symbols index 07b0ca1a9c1..96cb451f861 100644 --- a/tests/baselines/reference/objectTypeWithCallSignatureHidingMembersOfFunction.symbols +++ b/tests/baselines/reference/objectTypeWithCallSignatureHidingMembersOfFunction.symbols @@ -7,12 +7,12 @@ interface I { (): void; apply(a: any, b?: any): void; ->apply : Symbol(apply, Decl(objectTypeWithCallSignatureHidingMembersOfFunction.ts, 4, 13)) +>apply : Symbol(I.apply, Decl(objectTypeWithCallSignatureHidingMembersOfFunction.ts, 4, 13)) >a : Symbol(a, Decl(objectTypeWithCallSignatureHidingMembersOfFunction.ts, 5, 10)) >b : Symbol(b, Decl(objectTypeWithCallSignatureHidingMembersOfFunction.ts, 5, 17)) call(thisArg: number, ...argArray: number[]): any; ->call : Symbol(call, Decl(objectTypeWithCallSignatureHidingMembersOfFunction.ts, 5, 33)) +>call : Symbol(I.call, Decl(objectTypeWithCallSignatureHidingMembersOfFunction.ts, 5, 33)) >thisArg : Symbol(thisArg, Decl(objectTypeWithCallSignatureHidingMembersOfFunction.ts, 6, 9)) >argArray : Symbol(argArray, Decl(objectTypeWithCallSignatureHidingMembersOfFunction.ts, 6, 25)) } diff --git a/tests/baselines/reference/objectTypeWithConstructSignatureHidingMembersOfExtendedFunction.symbols b/tests/baselines/reference/objectTypeWithConstructSignatureHidingMembersOfExtendedFunction.symbols index 009291b0fb3..70175ae0d73 100644 --- a/tests/baselines/reference/objectTypeWithConstructSignatureHidingMembersOfExtendedFunction.symbols +++ b/tests/baselines/reference/objectTypeWithConstructSignatureHidingMembersOfExtendedFunction.symbols @@ -3,7 +3,7 @@ interface Function { >Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(objectTypeWithConstructSignatureHidingMembersOfExtendedFunction.ts, 0, 0)) data: number; ->data : Symbol(data, Decl(objectTypeWithConstructSignatureHidingMembersOfExtendedFunction.ts, 0, 20)) +>data : Symbol(Function.data, Decl(objectTypeWithConstructSignatureHidingMembersOfExtendedFunction.ts, 0, 20)) [x: string]: Object; >x : Symbol(x, Decl(objectTypeWithConstructSignatureHidingMembersOfExtendedFunction.ts, 2, 5)) @@ -15,12 +15,12 @@ interface I { new(): number; apply(a: any, b?: any): void; ->apply : Symbol(apply, Decl(objectTypeWithConstructSignatureHidingMembersOfExtendedFunction.ts, 6, 18)) +>apply : Symbol(I.apply, Decl(objectTypeWithConstructSignatureHidingMembersOfExtendedFunction.ts, 6, 18)) >a : Symbol(a, Decl(objectTypeWithConstructSignatureHidingMembersOfExtendedFunction.ts, 7, 10)) >b : Symbol(b, Decl(objectTypeWithConstructSignatureHidingMembersOfExtendedFunction.ts, 7, 17)) call(thisArg: number, ...argArray: number[]): any; ->call : Symbol(call, Decl(objectTypeWithConstructSignatureHidingMembersOfExtendedFunction.ts, 7, 33)) +>call : Symbol(I.call, Decl(objectTypeWithConstructSignatureHidingMembersOfExtendedFunction.ts, 7, 33)) >thisArg : Symbol(thisArg, Decl(objectTypeWithConstructSignatureHidingMembersOfExtendedFunction.ts, 8, 9)) >argArray : Symbol(argArray, Decl(objectTypeWithConstructSignatureHidingMembersOfExtendedFunction.ts, 8, 25)) } diff --git a/tests/baselines/reference/objectTypeWithConstructSignatureHidingMembersOfFunction.symbols b/tests/baselines/reference/objectTypeWithConstructSignatureHidingMembersOfFunction.symbols index c623bcb6f63..9d128975147 100644 --- a/tests/baselines/reference/objectTypeWithConstructSignatureHidingMembersOfFunction.symbols +++ b/tests/baselines/reference/objectTypeWithConstructSignatureHidingMembersOfFunction.symbols @@ -4,12 +4,12 @@ interface I { new(): number; apply(a: any, b?: any): void; ->apply : Symbol(apply, Decl(objectTypeWithConstructSignatureHidingMembersOfFunction.ts, 1, 18)) +>apply : Symbol(I.apply, Decl(objectTypeWithConstructSignatureHidingMembersOfFunction.ts, 1, 18)) >a : Symbol(a, Decl(objectTypeWithConstructSignatureHidingMembersOfFunction.ts, 2, 10)) >b : Symbol(b, Decl(objectTypeWithConstructSignatureHidingMembersOfFunction.ts, 2, 17)) call(thisArg: number, ...argArray: number[]): any; ->call : Symbol(call, Decl(objectTypeWithConstructSignatureHidingMembersOfFunction.ts, 2, 33)) +>call : Symbol(I.call, Decl(objectTypeWithConstructSignatureHidingMembersOfFunction.ts, 2, 33)) >thisArg : Symbol(thisArg, Decl(objectTypeWithConstructSignatureHidingMembersOfFunction.ts, 3, 9)) >argArray : Symbol(argArray, Decl(objectTypeWithConstructSignatureHidingMembersOfFunction.ts, 3, 25)) } diff --git a/tests/baselines/reference/objectTypeWithNumericProperty.symbols b/tests/baselines/reference/objectTypeWithNumericProperty.symbols index 20e54fe1c64..73ff7149d0f 100644 --- a/tests/baselines/reference/objectTypeWithNumericProperty.symbols +++ b/tests/baselines/reference/objectTypeWithNumericProperty.symbols @@ -15,22 +15,22 @@ var c: C; var r1 = c[1]; >r1 : Symbol(r1, Decl(objectTypeWithNumericProperty.ts, 8, 3), Decl(objectTypeWithNumericProperty.ts, 19, 3), Decl(objectTypeWithNumericProperty.ts, 29, 3), Decl(objectTypeWithNumericProperty.ts, 39, 3)) >c : Symbol(c, Decl(objectTypeWithNumericProperty.ts, 7, 3)) ->1 : Symbol(C.1, Decl(objectTypeWithNumericProperty.ts, 2, 9)) +>1 : Symbol(C[1], Decl(objectTypeWithNumericProperty.ts, 2, 9)) var r2 = c[1.1]; >r2 : Symbol(r2, Decl(objectTypeWithNumericProperty.ts, 9, 3), Decl(objectTypeWithNumericProperty.ts, 20, 3), Decl(objectTypeWithNumericProperty.ts, 30, 3), Decl(objectTypeWithNumericProperty.ts, 40, 3)) >c : Symbol(c, Decl(objectTypeWithNumericProperty.ts, 7, 3)) ->1.1 : Symbol(C.1.1, Decl(objectTypeWithNumericProperty.ts, 3, 14)) +>1.1 : Symbol(C[1.1], Decl(objectTypeWithNumericProperty.ts, 3, 14)) var r3 = c['1']; >r3 : Symbol(r3, Decl(objectTypeWithNumericProperty.ts, 10, 3), Decl(objectTypeWithNumericProperty.ts, 21, 3), Decl(objectTypeWithNumericProperty.ts, 31, 3), Decl(objectTypeWithNumericProperty.ts, 41, 3)) >c : Symbol(c, Decl(objectTypeWithNumericProperty.ts, 7, 3)) ->'1' : Symbol(C.1, Decl(objectTypeWithNumericProperty.ts, 2, 9)) +>'1' : Symbol(C[1], Decl(objectTypeWithNumericProperty.ts, 2, 9)) var r4 = c['1.1']; >r4 : Symbol(r4, Decl(objectTypeWithNumericProperty.ts, 11, 3), Decl(objectTypeWithNumericProperty.ts, 22, 3), Decl(objectTypeWithNumericProperty.ts, 32, 3), Decl(objectTypeWithNumericProperty.ts, 42, 3)) >c : Symbol(c, Decl(objectTypeWithNumericProperty.ts, 7, 3)) ->'1.1' : Symbol(C.1.1, Decl(objectTypeWithNumericProperty.ts, 3, 14)) +>'1.1' : Symbol(C[1.1], Decl(objectTypeWithNumericProperty.ts, 3, 14)) interface I { >I : Symbol(I, Decl(objectTypeWithNumericProperty.ts, 11, 18)) @@ -46,22 +46,22 @@ var i: I; var r1 = i[1]; >r1 : Symbol(r1, Decl(objectTypeWithNumericProperty.ts, 8, 3), Decl(objectTypeWithNumericProperty.ts, 19, 3), Decl(objectTypeWithNumericProperty.ts, 29, 3), Decl(objectTypeWithNumericProperty.ts, 39, 3)) >i : Symbol(i, Decl(objectTypeWithNumericProperty.ts, 18, 3)) ->1 : Symbol(I.1, Decl(objectTypeWithNumericProperty.ts, 13, 13)) +>1 : Symbol(I[1], Decl(objectTypeWithNumericProperty.ts, 13, 13)) var r2 = i[1.1]; >r2 : Symbol(r2, Decl(objectTypeWithNumericProperty.ts, 9, 3), Decl(objectTypeWithNumericProperty.ts, 20, 3), Decl(objectTypeWithNumericProperty.ts, 30, 3), Decl(objectTypeWithNumericProperty.ts, 40, 3)) >i : Symbol(i, Decl(objectTypeWithNumericProperty.ts, 18, 3)) ->1.1 : Symbol(I.1.1, Decl(objectTypeWithNumericProperty.ts, 14, 14)) +>1.1 : Symbol(I[1.1], Decl(objectTypeWithNumericProperty.ts, 14, 14)) var r3 = i['1']; >r3 : Symbol(r3, Decl(objectTypeWithNumericProperty.ts, 10, 3), Decl(objectTypeWithNumericProperty.ts, 21, 3), Decl(objectTypeWithNumericProperty.ts, 31, 3), Decl(objectTypeWithNumericProperty.ts, 41, 3)) >i : Symbol(i, Decl(objectTypeWithNumericProperty.ts, 18, 3)) ->'1' : Symbol(I.1, Decl(objectTypeWithNumericProperty.ts, 13, 13)) +>'1' : Symbol(I[1], Decl(objectTypeWithNumericProperty.ts, 13, 13)) var r4 = i['1.1']; >r4 : Symbol(r4, Decl(objectTypeWithNumericProperty.ts, 11, 3), Decl(objectTypeWithNumericProperty.ts, 22, 3), Decl(objectTypeWithNumericProperty.ts, 32, 3), Decl(objectTypeWithNumericProperty.ts, 42, 3)) >i : Symbol(i, Decl(objectTypeWithNumericProperty.ts, 18, 3)) ->'1.1' : Symbol(I.1.1, Decl(objectTypeWithNumericProperty.ts, 14, 14)) +>'1.1' : Symbol(I[1.1], Decl(objectTypeWithNumericProperty.ts, 14, 14)) var a: { >a : Symbol(a, Decl(objectTypeWithNumericProperty.ts, 24, 3)) diff --git a/tests/baselines/reference/objectTypeWithStringNamedNumericProperty.symbols b/tests/baselines/reference/objectTypeWithStringNamedNumericProperty.symbols index d3c463d9a15..480886711d5 100644 --- a/tests/baselines/reference/objectTypeWithStringNamedNumericProperty.symbols +++ b/tests/baselines/reference/objectTypeWithStringNamedNumericProperty.symbols @@ -15,13 +15,13 @@ class C { "1.": string; "1..": boolean; "1.0": Date; ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) "-1.0": RegExp; >RegExp : Symbol(RegExp, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) "-1": Date; ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) } var c: C; @@ -31,47 +31,47 @@ var c: C; var r1 = c['0.1']; >r1 : Symbol(r1, Decl(objectTypeWithStringNamedNumericProperty.ts, 17, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 48, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 78, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 108, 3)) >c : Symbol(c, Decl(objectTypeWithStringNamedNumericProperty.ts, 16, 3)) ->'0.1' : Symbol(C."0.1", Decl(objectTypeWithStringNamedNumericProperty.ts, 5, 9)) +>'0.1' : Symbol(C["0.1"], Decl(objectTypeWithStringNamedNumericProperty.ts, 5, 9)) var r2 = c['.1']; >r2 : Symbol(r2, Decl(objectTypeWithStringNamedNumericProperty.ts, 18, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 49, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 79, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 109, 3)) >c : Symbol(c, Decl(objectTypeWithStringNamedNumericProperty.ts, 16, 3)) ->'.1' : Symbol(C.".1", Decl(objectTypeWithStringNamedNumericProperty.ts, 6, 16)) +>'.1' : Symbol(C[".1"], Decl(objectTypeWithStringNamedNumericProperty.ts, 6, 16)) var r3 = c['1']; >r3 : Symbol(r3, Decl(objectTypeWithStringNamedNumericProperty.ts, 19, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 20, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 22, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 25, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 50, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 51, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 53, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 56, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 80, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 81, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 83, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 86, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 110, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 111, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 113, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 116, 3)) >c : Symbol(c, Decl(objectTypeWithStringNamedNumericProperty.ts, 16, 3)) ->'1' : Symbol(C."1", Decl(objectTypeWithStringNamedNumericProperty.ts, 7, 17)) +>'1' : Symbol(C["1"], Decl(objectTypeWithStringNamedNumericProperty.ts, 7, 17)) var r3 = c[1]; >r3 : Symbol(r3, Decl(objectTypeWithStringNamedNumericProperty.ts, 19, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 20, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 22, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 25, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 50, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 51, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 53, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 56, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 80, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 81, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 83, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 86, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 110, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 111, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 113, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 116, 3)) >c : Symbol(c, Decl(objectTypeWithStringNamedNumericProperty.ts, 16, 3)) ->1 : Symbol(C."1", Decl(objectTypeWithStringNamedNumericProperty.ts, 7, 17)) +>1 : Symbol(C["1"], Decl(objectTypeWithStringNamedNumericProperty.ts, 7, 17)) var r4 = c['1.']; >r4 : Symbol(r4, Decl(objectTypeWithStringNamedNumericProperty.ts, 21, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 52, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 82, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 112, 3)) >c : Symbol(c, Decl(objectTypeWithStringNamedNumericProperty.ts, 16, 3)) ->'1.' : Symbol(C."1.", Decl(objectTypeWithStringNamedNumericProperty.ts, 8, 16)) +>'1.' : Symbol(C["1."], Decl(objectTypeWithStringNamedNumericProperty.ts, 8, 16)) var r3 = c[1.]; // same as indexing by 1 when done numerically >r3 : Symbol(r3, Decl(objectTypeWithStringNamedNumericProperty.ts, 19, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 20, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 22, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 25, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 50, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 51, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 53, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 56, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 80, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 81, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 83, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 86, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 110, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 111, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 113, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 116, 3)) >c : Symbol(c, Decl(objectTypeWithStringNamedNumericProperty.ts, 16, 3)) ->1. : Symbol(C."1", Decl(objectTypeWithStringNamedNumericProperty.ts, 7, 17)) +>1. : Symbol(C["1"], Decl(objectTypeWithStringNamedNumericProperty.ts, 7, 17)) var r5 = c['1..']; >r5 : Symbol(r5, Decl(objectTypeWithStringNamedNumericProperty.ts, 23, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 54, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 84, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 114, 3)) >c : Symbol(c, Decl(objectTypeWithStringNamedNumericProperty.ts, 16, 3)) ->'1..' : Symbol(C."1..", Decl(objectTypeWithStringNamedNumericProperty.ts, 9, 17)) +>'1..' : Symbol(C["1.."], Decl(objectTypeWithStringNamedNumericProperty.ts, 9, 17)) var r6 = c['1.0']; >r6 : Symbol(r6, Decl(objectTypeWithStringNamedNumericProperty.ts, 24, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 55, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 85, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 115, 3)) >c : Symbol(c, Decl(objectTypeWithStringNamedNumericProperty.ts, 16, 3)) ->'1.0' : Symbol(C."1.0", Decl(objectTypeWithStringNamedNumericProperty.ts, 10, 19)) +>'1.0' : Symbol(C["1.0"], Decl(objectTypeWithStringNamedNumericProperty.ts, 10, 19)) var r3 = c[1.0]; // same as indexing by 1 when done numerically >r3 : Symbol(r3, Decl(objectTypeWithStringNamedNumericProperty.ts, 19, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 20, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 22, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 25, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 50, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 51, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 53, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 56, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 80, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 81, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 83, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 86, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 110, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 111, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 113, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 116, 3)) >c : Symbol(c, Decl(objectTypeWithStringNamedNumericProperty.ts, 16, 3)) ->1.0 : Symbol(C."1", Decl(objectTypeWithStringNamedNumericProperty.ts, 7, 17)) +>1.0 : Symbol(C["1"], Decl(objectTypeWithStringNamedNumericProperty.ts, 7, 17)) // BUG 823822 var r7 = i[-1]; @@ -85,17 +85,17 @@ var r7 = i[-1.0]; var r8 = i["-1.0"]; >r8 : Symbol(r8, Decl(objectTypeWithStringNamedNumericProperty.ts, 29, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 60, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 90, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 120, 3)) >i : Symbol(i, Decl(objectTypeWithStringNamedNumericProperty.ts, 47, 3)) ->"-1.0" : Symbol(I."-1.0", Decl(objectTypeWithStringNamedNumericProperty.ts, 42, 16)) +>"-1.0" : Symbol(I["-1.0"], Decl(objectTypeWithStringNamedNumericProperty.ts, 42, 16)) var r9 = i["-1"]; >r9 : Symbol(r9, Decl(objectTypeWithStringNamedNumericProperty.ts, 30, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 61, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 91, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 121, 3)) >i : Symbol(i, Decl(objectTypeWithStringNamedNumericProperty.ts, 47, 3)) ->"-1" : Symbol(I."-1", Decl(objectTypeWithStringNamedNumericProperty.ts, 43, 19)) +>"-1" : Symbol(I["-1"], Decl(objectTypeWithStringNamedNumericProperty.ts, 43, 19)) var r10 = i[0x1] >r10 : Symbol(r10, Decl(objectTypeWithStringNamedNumericProperty.ts, 31, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 62, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 92, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 122, 3)) >i : Symbol(i, Decl(objectTypeWithStringNamedNumericProperty.ts, 47, 3)) ->0x1 : Symbol(I."1", Decl(objectTypeWithStringNamedNumericProperty.ts, 38, 17)) +>0x1 : Symbol(I["1"], Decl(objectTypeWithStringNamedNumericProperty.ts, 38, 17)) var r11 = i[-0x1] >r11 : Symbol(r11, Decl(objectTypeWithStringNamedNumericProperty.ts, 32, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 63, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 93, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 123, 3)) @@ -104,7 +104,7 @@ var r11 = i[-0x1] var r12 = i[01] >r12 : Symbol(r12, Decl(objectTypeWithStringNamedNumericProperty.ts, 33, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 64, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 94, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 124, 3)) >i : Symbol(i, Decl(objectTypeWithStringNamedNumericProperty.ts, 47, 3)) ->01 : Symbol(I."1", Decl(objectTypeWithStringNamedNumericProperty.ts, 38, 17)) +>01 : Symbol(I["1"], Decl(objectTypeWithStringNamedNumericProperty.ts, 38, 17)) var r13 = i[-01] >r13 : Symbol(r13, Decl(objectTypeWithStringNamedNumericProperty.ts, 34, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 65, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 95, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 125, 3)) @@ -121,13 +121,13 @@ interface I { "1.": string; "1..": boolean; "1.0": Date; ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) "-1.0": RegExp; >RegExp : Symbol(RegExp, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) "-1": Date; ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) } var i: I; @@ -137,47 +137,47 @@ var i: I; var r1 = i['0.1']; >r1 : Symbol(r1, Decl(objectTypeWithStringNamedNumericProperty.ts, 17, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 48, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 78, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 108, 3)) >i : Symbol(i, Decl(objectTypeWithStringNamedNumericProperty.ts, 47, 3)) ->'0.1' : Symbol(I."0.1", Decl(objectTypeWithStringNamedNumericProperty.ts, 36, 13)) +>'0.1' : Symbol(I["0.1"], Decl(objectTypeWithStringNamedNumericProperty.ts, 36, 13)) var r2 = i['.1']; >r2 : Symbol(r2, Decl(objectTypeWithStringNamedNumericProperty.ts, 18, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 49, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 79, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 109, 3)) >i : Symbol(i, Decl(objectTypeWithStringNamedNumericProperty.ts, 47, 3)) ->'.1' : Symbol(I.".1", Decl(objectTypeWithStringNamedNumericProperty.ts, 37, 16)) +>'.1' : Symbol(I[".1"], Decl(objectTypeWithStringNamedNumericProperty.ts, 37, 16)) var r3 = i['1']; >r3 : Symbol(r3, Decl(objectTypeWithStringNamedNumericProperty.ts, 19, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 20, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 22, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 25, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 50, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 51, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 53, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 56, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 80, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 81, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 83, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 86, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 110, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 111, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 113, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 116, 3)) >i : Symbol(i, Decl(objectTypeWithStringNamedNumericProperty.ts, 47, 3)) ->'1' : Symbol(I."1", Decl(objectTypeWithStringNamedNumericProperty.ts, 38, 17)) +>'1' : Symbol(I["1"], Decl(objectTypeWithStringNamedNumericProperty.ts, 38, 17)) var r3 = c[1]; >r3 : Symbol(r3, Decl(objectTypeWithStringNamedNumericProperty.ts, 19, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 20, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 22, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 25, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 50, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 51, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 53, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 56, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 80, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 81, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 83, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 86, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 110, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 111, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 113, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 116, 3)) >c : Symbol(c, Decl(objectTypeWithStringNamedNumericProperty.ts, 16, 3)) ->1 : Symbol(C."1", Decl(objectTypeWithStringNamedNumericProperty.ts, 7, 17)) +>1 : Symbol(C["1"], Decl(objectTypeWithStringNamedNumericProperty.ts, 7, 17)) var r4 = i['1.']; >r4 : Symbol(r4, Decl(objectTypeWithStringNamedNumericProperty.ts, 21, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 52, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 82, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 112, 3)) >i : Symbol(i, Decl(objectTypeWithStringNamedNumericProperty.ts, 47, 3)) ->'1.' : Symbol(I."1.", Decl(objectTypeWithStringNamedNumericProperty.ts, 39, 16)) +>'1.' : Symbol(I["1."], Decl(objectTypeWithStringNamedNumericProperty.ts, 39, 16)) var r3 = c[1.]; // same as indexing by 1 when done numerically >r3 : Symbol(r3, Decl(objectTypeWithStringNamedNumericProperty.ts, 19, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 20, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 22, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 25, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 50, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 51, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 53, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 56, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 80, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 81, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 83, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 86, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 110, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 111, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 113, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 116, 3)) >c : Symbol(c, Decl(objectTypeWithStringNamedNumericProperty.ts, 16, 3)) ->1. : Symbol(C."1", Decl(objectTypeWithStringNamedNumericProperty.ts, 7, 17)) +>1. : Symbol(C["1"], Decl(objectTypeWithStringNamedNumericProperty.ts, 7, 17)) var r5 = i['1..']; >r5 : Symbol(r5, Decl(objectTypeWithStringNamedNumericProperty.ts, 23, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 54, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 84, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 114, 3)) >i : Symbol(i, Decl(objectTypeWithStringNamedNumericProperty.ts, 47, 3)) ->'1..' : Symbol(I."1..", Decl(objectTypeWithStringNamedNumericProperty.ts, 40, 17)) +>'1..' : Symbol(I["1.."], Decl(objectTypeWithStringNamedNumericProperty.ts, 40, 17)) var r6 = i['1.0']; >r6 : Symbol(r6, Decl(objectTypeWithStringNamedNumericProperty.ts, 24, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 55, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 85, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 115, 3)) >i : Symbol(i, Decl(objectTypeWithStringNamedNumericProperty.ts, 47, 3)) ->'1.0' : Symbol(I."1.0", Decl(objectTypeWithStringNamedNumericProperty.ts, 41, 19)) +>'1.0' : Symbol(I["1.0"], Decl(objectTypeWithStringNamedNumericProperty.ts, 41, 19)) var r3 = c[1.0]; // same as indexing by 1 when done numerically >r3 : Symbol(r3, Decl(objectTypeWithStringNamedNumericProperty.ts, 19, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 20, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 22, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 25, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 50, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 51, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 53, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 56, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 80, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 81, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 83, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 86, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 110, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 111, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 113, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 116, 3)) >c : Symbol(c, Decl(objectTypeWithStringNamedNumericProperty.ts, 16, 3)) ->1.0 : Symbol(C."1", Decl(objectTypeWithStringNamedNumericProperty.ts, 7, 17)) +>1.0 : Symbol(C["1"], Decl(objectTypeWithStringNamedNumericProperty.ts, 7, 17)) // BUG 823822 var r7 = i[-1]; @@ -191,17 +191,17 @@ var r7 = i[-1.0]; var r8 = i["-1.0"]; >r8 : Symbol(r8, Decl(objectTypeWithStringNamedNumericProperty.ts, 29, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 60, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 90, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 120, 3)) >i : Symbol(i, Decl(objectTypeWithStringNamedNumericProperty.ts, 47, 3)) ->"-1.0" : Symbol(I."-1.0", Decl(objectTypeWithStringNamedNumericProperty.ts, 42, 16)) +>"-1.0" : Symbol(I["-1.0"], Decl(objectTypeWithStringNamedNumericProperty.ts, 42, 16)) var r9 = i["-1"]; >r9 : Symbol(r9, Decl(objectTypeWithStringNamedNumericProperty.ts, 30, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 61, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 91, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 121, 3)) >i : Symbol(i, Decl(objectTypeWithStringNamedNumericProperty.ts, 47, 3)) ->"-1" : Symbol(I."-1", Decl(objectTypeWithStringNamedNumericProperty.ts, 43, 19)) +>"-1" : Symbol(I["-1"], Decl(objectTypeWithStringNamedNumericProperty.ts, 43, 19)) var r10 = i[0x1] >r10 : Symbol(r10, Decl(objectTypeWithStringNamedNumericProperty.ts, 31, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 62, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 92, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 122, 3)) >i : Symbol(i, Decl(objectTypeWithStringNamedNumericProperty.ts, 47, 3)) ->0x1 : Symbol(I."1", Decl(objectTypeWithStringNamedNumericProperty.ts, 38, 17)) +>0x1 : Symbol(I["1"], Decl(objectTypeWithStringNamedNumericProperty.ts, 38, 17)) var r11 = i[-0x1] >r11 : Symbol(r11, Decl(objectTypeWithStringNamedNumericProperty.ts, 32, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 63, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 93, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 123, 3)) @@ -210,7 +210,7 @@ var r11 = i[-0x1] var r12 = i[01] >r12 : Symbol(r12, Decl(objectTypeWithStringNamedNumericProperty.ts, 33, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 64, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 94, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 124, 3)) >i : Symbol(i, Decl(objectTypeWithStringNamedNumericProperty.ts, 47, 3)) ->01 : Symbol(I."1", Decl(objectTypeWithStringNamedNumericProperty.ts, 38, 17)) +>01 : Symbol(I["1"], Decl(objectTypeWithStringNamedNumericProperty.ts, 38, 17)) var r13 = i[-01] >r13 : Symbol(r13, Decl(objectTypeWithStringNamedNumericProperty.ts, 34, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 65, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 95, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 125, 3)) @@ -227,13 +227,13 @@ var a: { "1.": string; "1..": boolean; "1.0": Date; ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) "-1.0": RegExp; >RegExp : Symbol(RegExp, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) "-1": Date; ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) } var r1 = a['0.1']; @@ -254,7 +254,7 @@ var r3 = a['1']; var r3 = c[1]; >r3 : Symbol(r3, Decl(objectTypeWithStringNamedNumericProperty.ts, 19, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 20, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 22, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 25, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 50, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 51, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 53, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 56, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 80, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 81, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 83, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 86, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 110, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 111, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 113, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 116, 3)) >c : Symbol(c, Decl(objectTypeWithStringNamedNumericProperty.ts, 16, 3)) ->1 : Symbol(C."1", Decl(objectTypeWithStringNamedNumericProperty.ts, 7, 17)) +>1 : Symbol(C["1"], Decl(objectTypeWithStringNamedNumericProperty.ts, 7, 17)) var r4 = a['1.']; >r4 : Symbol(r4, Decl(objectTypeWithStringNamedNumericProperty.ts, 21, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 52, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 82, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 112, 3)) @@ -264,7 +264,7 @@ var r4 = a['1.']; var r3 = c[1.]; // same as indexing by 1 when done numerically >r3 : Symbol(r3, Decl(objectTypeWithStringNamedNumericProperty.ts, 19, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 20, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 22, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 25, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 50, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 51, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 53, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 56, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 80, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 81, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 83, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 86, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 110, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 111, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 113, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 116, 3)) >c : Symbol(c, Decl(objectTypeWithStringNamedNumericProperty.ts, 16, 3)) ->1. : Symbol(C."1", Decl(objectTypeWithStringNamedNumericProperty.ts, 7, 17)) +>1. : Symbol(C["1"], Decl(objectTypeWithStringNamedNumericProperty.ts, 7, 17)) var r5 = a['1..']; >r5 : Symbol(r5, Decl(objectTypeWithStringNamedNumericProperty.ts, 23, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 54, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 84, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 114, 3)) @@ -279,7 +279,7 @@ var r6 = a['1.0']; var r3 = c[1.0]; // same as indexing by 1 when done numerically >r3 : Symbol(r3, Decl(objectTypeWithStringNamedNumericProperty.ts, 19, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 20, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 22, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 25, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 50, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 51, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 53, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 56, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 80, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 81, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 83, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 86, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 110, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 111, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 113, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 116, 3)) >c : Symbol(c, Decl(objectTypeWithStringNamedNumericProperty.ts, 16, 3)) ->1.0 : Symbol(C."1", Decl(objectTypeWithStringNamedNumericProperty.ts, 7, 17)) +>1.0 : Symbol(C["1"], Decl(objectTypeWithStringNamedNumericProperty.ts, 7, 17)) // BUG 823822 var r7 = i[-1]; @@ -293,17 +293,17 @@ var r7 = i[-1.0]; var r8 = i["-1.0"]; >r8 : Symbol(r8, Decl(objectTypeWithStringNamedNumericProperty.ts, 29, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 60, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 90, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 120, 3)) >i : Symbol(i, Decl(objectTypeWithStringNamedNumericProperty.ts, 47, 3)) ->"-1.0" : Symbol(I."-1.0", Decl(objectTypeWithStringNamedNumericProperty.ts, 42, 16)) +>"-1.0" : Symbol(I["-1.0"], Decl(objectTypeWithStringNamedNumericProperty.ts, 42, 16)) var r9 = i["-1"]; >r9 : Symbol(r9, Decl(objectTypeWithStringNamedNumericProperty.ts, 30, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 61, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 91, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 121, 3)) >i : Symbol(i, Decl(objectTypeWithStringNamedNumericProperty.ts, 47, 3)) ->"-1" : Symbol(I."-1", Decl(objectTypeWithStringNamedNumericProperty.ts, 43, 19)) +>"-1" : Symbol(I["-1"], Decl(objectTypeWithStringNamedNumericProperty.ts, 43, 19)) var r10 = i[0x1] >r10 : Symbol(r10, Decl(objectTypeWithStringNamedNumericProperty.ts, 31, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 62, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 92, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 122, 3)) >i : Symbol(i, Decl(objectTypeWithStringNamedNumericProperty.ts, 47, 3)) ->0x1 : Symbol(I."1", Decl(objectTypeWithStringNamedNumericProperty.ts, 38, 17)) +>0x1 : Symbol(I["1"], Decl(objectTypeWithStringNamedNumericProperty.ts, 38, 17)) var r11 = i[-0x1] >r11 : Symbol(r11, Decl(objectTypeWithStringNamedNumericProperty.ts, 32, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 63, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 93, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 123, 3)) @@ -312,7 +312,7 @@ var r11 = i[-0x1] var r12 = i[01] >r12 : Symbol(r12, Decl(objectTypeWithStringNamedNumericProperty.ts, 33, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 64, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 94, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 124, 3)) >i : Symbol(i, Decl(objectTypeWithStringNamedNumericProperty.ts, 47, 3)) ->01 : Symbol(I."1", Decl(objectTypeWithStringNamedNumericProperty.ts, 38, 17)) +>01 : Symbol(I["1"], Decl(objectTypeWithStringNamedNumericProperty.ts, 38, 17)) var r13 = i[-01] >r13 : Symbol(r13, Decl(objectTypeWithStringNamedNumericProperty.ts, 34, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 65, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 95, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 125, 3)) @@ -329,11 +329,11 @@ var b = { "1.": "", "1..": true, "1.0": new Date(), ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) "-1.0": /123/, "-1": Date ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) }; @@ -355,7 +355,7 @@ var r3 = b['1']; var r3 = c[1]; >r3 : Symbol(r3, Decl(objectTypeWithStringNamedNumericProperty.ts, 19, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 20, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 22, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 25, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 50, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 51, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 53, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 56, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 80, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 81, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 83, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 86, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 110, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 111, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 113, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 116, 3)) >c : Symbol(c, Decl(objectTypeWithStringNamedNumericProperty.ts, 16, 3)) ->1 : Symbol(C."1", Decl(objectTypeWithStringNamedNumericProperty.ts, 7, 17)) +>1 : Symbol(C["1"], Decl(objectTypeWithStringNamedNumericProperty.ts, 7, 17)) var r4 = b['1.']; >r4 : Symbol(r4, Decl(objectTypeWithStringNamedNumericProperty.ts, 21, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 52, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 82, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 112, 3)) @@ -365,7 +365,7 @@ var r4 = b['1.']; var r3 = c[1.]; // same as indexing by 1 when done numerically >r3 : Symbol(r3, Decl(objectTypeWithStringNamedNumericProperty.ts, 19, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 20, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 22, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 25, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 50, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 51, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 53, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 56, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 80, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 81, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 83, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 86, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 110, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 111, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 113, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 116, 3)) >c : Symbol(c, Decl(objectTypeWithStringNamedNumericProperty.ts, 16, 3)) ->1. : Symbol(C."1", Decl(objectTypeWithStringNamedNumericProperty.ts, 7, 17)) +>1. : Symbol(C["1"], Decl(objectTypeWithStringNamedNumericProperty.ts, 7, 17)) var r5 = b['1..']; >r5 : Symbol(r5, Decl(objectTypeWithStringNamedNumericProperty.ts, 23, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 54, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 84, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 114, 3)) @@ -380,7 +380,7 @@ var r6 = b['1.0']; var r3 = c[1.0]; // same as indexing by 1 when done numerically >r3 : Symbol(r3, Decl(objectTypeWithStringNamedNumericProperty.ts, 19, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 20, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 22, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 25, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 50, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 51, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 53, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 56, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 80, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 81, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 83, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 86, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 110, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 111, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 113, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 116, 3)) >c : Symbol(c, Decl(objectTypeWithStringNamedNumericProperty.ts, 16, 3)) ->1.0 : Symbol(C."1", Decl(objectTypeWithStringNamedNumericProperty.ts, 7, 17)) +>1.0 : Symbol(C["1"], Decl(objectTypeWithStringNamedNumericProperty.ts, 7, 17)) // BUG 823822 var r7 = i[-1]; @@ -394,17 +394,17 @@ var r7 = i[-1.0]; var r8 = i["-1.0"]; >r8 : Symbol(r8, Decl(objectTypeWithStringNamedNumericProperty.ts, 29, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 60, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 90, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 120, 3)) >i : Symbol(i, Decl(objectTypeWithStringNamedNumericProperty.ts, 47, 3)) ->"-1.0" : Symbol(I."-1.0", Decl(objectTypeWithStringNamedNumericProperty.ts, 42, 16)) +>"-1.0" : Symbol(I["-1.0"], Decl(objectTypeWithStringNamedNumericProperty.ts, 42, 16)) var r9 = i["-1"]; >r9 : Symbol(r9, Decl(objectTypeWithStringNamedNumericProperty.ts, 30, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 61, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 91, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 121, 3)) >i : Symbol(i, Decl(objectTypeWithStringNamedNumericProperty.ts, 47, 3)) ->"-1" : Symbol(I."-1", Decl(objectTypeWithStringNamedNumericProperty.ts, 43, 19)) +>"-1" : Symbol(I["-1"], Decl(objectTypeWithStringNamedNumericProperty.ts, 43, 19)) var r10 = i[0x1] >r10 : Symbol(r10, Decl(objectTypeWithStringNamedNumericProperty.ts, 31, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 62, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 92, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 122, 3)) >i : Symbol(i, Decl(objectTypeWithStringNamedNumericProperty.ts, 47, 3)) ->0x1 : Symbol(I."1", Decl(objectTypeWithStringNamedNumericProperty.ts, 38, 17)) +>0x1 : Symbol(I["1"], Decl(objectTypeWithStringNamedNumericProperty.ts, 38, 17)) var r11 = i[-0x1] >r11 : Symbol(r11, Decl(objectTypeWithStringNamedNumericProperty.ts, 32, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 63, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 93, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 123, 3)) @@ -413,7 +413,7 @@ var r11 = i[-0x1] var r12 = i[01] >r12 : Symbol(r12, Decl(objectTypeWithStringNamedNumericProperty.ts, 33, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 64, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 94, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 124, 3)) >i : Symbol(i, Decl(objectTypeWithStringNamedNumericProperty.ts, 47, 3)) ->01 : Symbol(I."1", Decl(objectTypeWithStringNamedNumericProperty.ts, 38, 17)) +>01 : Symbol(I["1"], Decl(objectTypeWithStringNamedNumericProperty.ts, 38, 17)) var r13 = i[-01] >r13 : Symbol(r13, Decl(objectTypeWithStringNamedNumericProperty.ts, 34, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 65, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 95, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 125, 3)) diff --git a/tests/baselines/reference/objectTypeWithStringNamedPropertyOfIllegalCharacters.symbols b/tests/baselines/reference/objectTypeWithStringNamedPropertyOfIllegalCharacters.symbols index aa76e7e92c8..773fb3f5760 100644 --- a/tests/baselines/reference/objectTypeWithStringNamedPropertyOfIllegalCharacters.symbols +++ b/tests/baselines/reference/objectTypeWithStringNamedPropertyOfIllegalCharacters.symbols @@ -16,7 +16,7 @@ var c: C; var r = c[" "]; >r : Symbol(r, Decl(objectTypeWithStringNamedPropertyOfIllegalCharacters.ts, 9, 3), Decl(objectTypeWithStringNamedPropertyOfIllegalCharacters.ts, 22, 3), Decl(objectTypeWithStringNamedPropertyOfIllegalCharacters.ts, 35, 3), Decl(objectTypeWithStringNamedPropertyOfIllegalCharacters.ts, 47, 3)) >c : Symbol(c, Decl(objectTypeWithStringNamedPropertyOfIllegalCharacters.ts, 8, 3)) ->" " : Symbol(C." ", Decl(objectTypeWithStringNamedPropertyOfIllegalCharacters.ts, 0, 9)) +>" " : Symbol(C[" "], Decl(objectTypeWithStringNamedPropertyOfIllegalCharacters.ts, 0, 9)) var r2 = c[" "]; >r2 : Symbol(r2, Decl(objectTypeWithStringNamedPropertyOfIllegalCharacters.ts, 10, 3), Decl(objectTypeWithStringNamedPropertyOfIllegalCharacters.ts, 23, 3), Decl(objectTypeWithStringNamedPropertyOfIllegalCharacters.ts, 36, 3), Decl(objectTypeWithStringNamedPropertyOfIllegalCharacters.ts, 48, 3)) @@ -25,13 +25,13 @@ var r2 = c[" "]; var r3 = c["a b"]; >r3 : Symbol(r3, Decl(objectTypeWithStringNamedPropertyOfIllegalCharacters.ts, 11, 3), Decl(objectTypeWithStringNamedPropertyOfIllegalCharacters.ts, 24, 3), Decl(objectTypeWithStringNamedPropertyOfIllegalCharacters.ts, 37, 3), Decl(objectTypeWithStringNamedPropertyOfIllegalCharacters.ts, 49, 3)) >c : Symbol(c, Decl(objectTypeWithStringNamedPropertyOfIllegalCharacters.ts, 8, 3)) ->"a b" : Symbol(C."a b", Decl(objectTypeWithStringNamedPropertyOfIllegalCharacters.ts, 1, 18)) +>"a b" : Symbol(C["a b"], Decl(objectTypeWithStringNamedPropertyOfIllegalCharacters.ts, 1, 18)) // BUG 817263 var r4 = c["~!@#$%^&*()_+{}|:'<>?\/.,`"]; >r4 : Symbol(r4, Decl(objectTypeWithStringNamedPropertyOfIllegalCharacters.ts, 13, 3), Decl(objectTypeWithStringNamedPropertyOfIllegalCharacters.ts, 26, 3), Decl(objectTypeWithStringNamedPropertyOfIllegalCharacters.ts, 39, 3), Decl(objectTypeWithStringNamedPropertyOfIllegalCharacters.ts, 51, 3)) >c : Symbol(c, Decl(objectTypeWithStringNamedPropertyOfIllegalCharacters.ts, 8, 3)) ->"~!@#$%^&*()_+{}|:'<>?\/.,`" : Symbol(C."~!@#$%^&*()_+{}|:'<>?\/.,`", Decl(objectTypeWithStringNamedPropertyOfIllegalCharacters.ts, 2, 20)) +>"~!@#$%^&*()_+{}|:'<>?\/.,`" : Symbol(C["~!@#$%^&*()_+{}|:'<>?\/.,`"], Decl(objectTypeWithStringNamedPropertyOfIllegalCharacters.ts, 2, 20)) interface I { >I : Symbol(I, Decl(objectTypeWithStringNamedPropertyOfIllegalCharacters.ts, 13, 41)) @@ -48,7 +48,7 @@ var i: I; var r = i[" "]; >r : Symbol(r, Decl(objectTypeWithStringNamedPropertyOfIllegalCharacters.ts, 9, 3), Decl(objectTypeWithStringNamedPropertyOfIllegalCharacters.ts, 22, 3), Decl(objectTypeWithStringNamedPropertyOfIllegalCharacters.ts, 35, 3), Decl(objectTypeWithStringNamedPropertyOfIllegalCharacters.ts, 47, 3)) >i : Symbol(i, Decl(objectTypeWithStringNamedPropertyOfIllegalCharacters.ts, 21, 3)) ->" " : Symbol(I." ", Decl(objectTypeWithStringNamedPropertyOfIllegalCharacters.ts, 15, 13)) +>" " : Symbol(I[" "], Decl(objectTypeWithStringNamedPropertyOfIllegalCharacters.ts, 15, 13)) var r2 = i[" "]; >r2 : Symbol(r2, Decl(objectTypeWithStringNamedPropertyOfIllegalCharacters.ts, 10, 3), Decl(objectTypeWithStringNamedPropertyOfIllegalCharacters.ts, 23, 3), Decl(objectTypeWithStringNamedPropertyOfIllegalCharacters.ts, 36, 3), Decl(objectTypeWithStringNamedPropertyOfIllegalCharacters.ts, 48, 3)) @@ -57,13 +57,13 @@ var r2 = i[" "]; var r3 = i["a b"]; >r3 : Symbol(r3, Decl(objectTypeWithStringNamedPropertyOfIllegalCharacters.ts, 11, 3), Decl(objectTypeWithStringNamedPropertyOfIllegalCharacters.ts, 24, 3), Decl(objectTypeWithStringNamedPropertyOfIllegalCharacters.ts, 37, 3), Decl(objectTypeWithStringNamedPropertyOfIllegalCharacters.ts, 49, 3)) >i : Symbol(i, Decl(objectTypeWithStringNamedPropertyOfIllegalCharacters.ts, 21, 3)) ->"a b" : Symbol(I."a b", Decl(objectTypeWithStringNamedPropertyOfIllegalCharacters.ts, 16, 18)) +>"a b" : Symbol(I["a b"], Decl(objectTypeWithStringNamedPropertyOfIllegalCharacters.ts, 16, 18)) // BUG 817263 var r4 = i["~!@#$%^&*()_+{}|:'<>?\/.,`"]; >r4 : Symbol(r4, Decl(objectTypeWithStringNamedPropertyOfIllegalCharacters.ts, 13, 3), Decl(objectTypeWithStringNamedPropertyOfIllegalCharacters.ts, 26, 3), Decl(objectTypeWithStringNamedPropertyOfIllegalCharacters.ts, 39, 3), Decl(objectTypeWithStringNamedPropertyOfIllegalCharacters.ts, 51, 3)) >i : Symbol(i, Decl(objectTypeWithStringNamedPropertyOfIllegalCharacters.ts, 21, 3)) ->"~!@#$%^&*()_+{}|:'<>?\/.,`" : Symbol(I."~!@#$%^&*()_+{}|:'<>?\/.,`", Decl(objectTypeWithStringNamedPropertyOfIllegalCharacters.ts, 17, 20)) +>"~!@#$%^&*()_+{}|:'<>?\/.,`" : Symbol(I["~!@#$%^&*()_+{}|:'<>?\/.,`"], Decl(objectTypeWithStringNamedPropertyOfIllegalCharacters.ts, 17, 20)) var a: { diff --git a/tests/baselines/reference/objectTypesIdentity.symbols b/tests/baselines/reference/objectTypesIdentity.symbols index a39b47acf55..8691978a527 100644 --- a/tests/baselines/reference/objectTypesIdentity.symbols +++ b/tests/baselines/reference/objectTypesIdentity.symbols @@ -5,14 +5,14 @@ class A { >A : Symbol(A, Decl(objectTypesIdentity.ts, 0, 0)) foo: string; ->foo : Symbol(foo, Decl(objectTypesIdentity.ts, 2, 9)) +>foo : Symbol(A.foo, Decl(objectTypesIdentity.ts, 2, 9)) } class B { >B : Symbol(B, Decl(objectTypesIdentity.ts, 4, 1)) foo: string; ->foo : Symbol(foo, Decl(objectTypesIdentity.ts, 6, 9)) +>foo : Symbol(B.foo, Decl(objectTypesIdentity.ts, 6, 9)) } class C { @@ -20,7 +20,7 @@ class C { >T : Symbol(T, Decl(objectTypesIdentity.ts, 10, 8)) foo: T; ->foo : Symbol(foo, Decl(objectTypesIdentity.ts, 10, 12)) +>foo : Symbol(C.foo, Decl(objectTypesIdentity.ts, 10, 12)) >T : Symbol(T, Decl(objectTypesIdentity.ts, 10, 8)) } @@ -28,7 +28,7 @@ interface I { >I : Symbol(I, Decl(objectTypesIdentity.ts, 12, 1)) foo: string; ->foo : Symbol(foo, Decl(objectTypesIdentity.ts, 14, 13)) +>foo : Symbol(I.foo, Decl(objectTypesIdentity.ts, 14, 13)) } var a: { foo: string; } diff --git a/tests/baselines/reference/objectTypesIdentity2.symbols b/tests/baselines/reference/objectTypesIdentity2.symbols index 6db54e5b59a..eb04eaf03c7 100644 --- a/tests/baselines/reference/objectTypesIdentity2.symbols +++ b/tests/baselines/reference/objectTypesIdentity2.symbols @@ -5,14 +5,14 @@ class A { >A : Symbol(A, Decl(objectTypesIdentity2.ts, 0, 0)) foo: number; ->foo : Symbol(foo, Decl(objectTypesIdentity2.ts, 2, 9)) +>foo : Symbol(A.foo, Decl(objectTypesIdentity2.ts, 2, 9)) } class B { >B : Symbol(B, Decl(objectTypesIdentity2.ts, 4, 1)) foo: boolean; ->foo : Symbol(foo, Decl(objectTypesIdentity2.ts, 6, 9)) +>foo : Symbol(B.foo, Decl(objectTypesIdentity2.ts, 6, 9)) } class C { @@ -20,7 +20,7 @@ class C { >T : Symbol(T, Decl(objectTypesIdentity2.ts, 10, 8)) foo: T; ->foo : Symbol(foo, Decl(objectTypesIdentity2.ts, 10, 12)) +>foo : Symbol(C.foo, Decl(objectTypesIdentity2.ts, 10, 12)) >T : Symbol(T, Decl(objectTypesIdentity2.ts, 10, 8)) } @@ -28,8 +28,8 @@ interface I { >I : Symbol(I, Decl(objectTypesIdentity2.ts, 12, 1)) foo: Date; ->foo : Symbol(foo, Decl(objectTypesIdentity2.ts, 14, 13)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>foo : Symbol(I.foo, Decl(objectTypesIdentity2.ts, 14, 13)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) } var a: { foo: RegExp; } diff --git a/tests/baselines/reference/objectTypesIdentityWithCallSignatures.symbols b/tests/baselines/reference/objectTypesIdentityWithCallSignatures.symbols index e1131a019c0..72906bc9880 100644 --- a/tests/baselines/reference/objectTypesIdentityWithCallSignatures.symbols +++ b/tests/baselines/reference/objectTypesIdentityWithCallSignatures.symbols @@ -5,7 +5,7 @@ class A { >A : Symbol(A, Decl(objectTypesIdentityWithCallSignatures.ts, 0, 0)) foo(x: string): string { return null; } ->foo : Symbol(foo, Decl(objectTypesIdentityWithCallSignatures.ts, 2, 9)) +>foo : Symbol(A.foo, Decl(objectTypesIdentityWithCallSignatures.ts, 2, 9)) >x : Symbol(x, Decl(objectTypesIdentityWithCallSignatures.ts, 3, 8)) } @@ -13,7 +13,7 @@ class B { >B : Symbol(B, Decl(objectTypesIdentityWithCallSignatures.ts, 4, 1)) foo(x: string): string { return null; } ->foo : Symbol(foo, Decl(objectTypesIdentityWithCallSignatures.ts, 6, 9)) +>foo : Symbol(B.foo, Decl(objectTypesIdentityWithCallSignatures.ts, 6, 9)) >x : Symbol(x, Decl(objectTypesIdentityWithCallSignatures.ts, 7, 8)) } @@ -22,7 +22,7 @@ class C { >T : Symbol(T, Decl(objectTypesIdentityWithCallSignatures.ts, 10, 8)) foo(x: T): T { return null; } ->foo : Symbol(foo, Decl(objectTypesIdentityWithCallSignatures.ts, 10, 12)) +>foo : Symbol(C.foo, Decl(objectTypesIdentityWithCallSignatures.ts, 10, 12)) >x : Symbol(x, Decl(objectTypesIdentityWithCallSignatures.ts, 11, 8)) >T : Symbol(T, Decl(objectTypesIdentityWithCallSignatures.ts, 10, 8)) >T : Symbol(T, Decl(objectTypesIdentityWithCallSignatures.ts, 10, 8)) @@ -32,7 +32,7 @@ interface I { >I : Symbol(I, Decl(objectTypesIdentityWithCallSignatures.ts, 12, 1)) foo(x: string): string; ->foo : Symbol(foo, Decl(objectTypesIdentityWithCallSignatures.ts, 14, 13)) +>foo : Symbol(I.foo, Decl(objectTypesIdentityWithCallSignatures.ts, 14, 13)) >x : Symbol(x, Decl(objectTypesIdentityWithCallSignatures.ts, 15, 8)) } @@ -41,7 +41,7 @@ interface I2 { >T : Symbol(T, Decl(objectTypesIdentityWithCallSignatures.ts, 18, 13)) foo(x: T): T; ->foo : Symbol(foo, Decl(objectTypesIdentityWithCallSignatures.ts, 18, 17)) +>foo : Symbol(I2.foo, Decl(objectTypesIdentityWithCallSignatures.ts, 18, 17)) >x : Symbol(x, Decl(objectTypesIdentityWithCallSignatures.ts, 19, 8)) >T : Symbol(T, Decl(objectTypesIdentityWithCallSignatures.ts, 18, 13)) >T : Symbol(T, Decl(objectTypesIdentityWithCallSignatures.ts, 18, 13)) diff --git a/tests/baselines/reference/objectTypesIdentityWithCallSignatures2.symbols b/tests/baselines/reference/objectTypesIdentityWithCallSignatures2.symbols index 7e081608bc0..fb01ef775c4 100644 --- a/tests/baselines/reference/objectTypesIdentityWithCallSignatures2.symbols +++ b/tests/baselines/reference/objectTypesIdentityWithCallSignatures2.symbols @@ -5,7 +5,7 @@ class A { >A : Symbol(A, Decl(objectTypesIdentityWithCallSignatures2.ts, 0, 0)) foo(x: string): string { return null; } ->foo : Symbol(foo, Decl(objectTypesIdentityWithCallSignatures2.ts, 2, 9)) +>foo : Symbol(A.foo, Decl(objectTypesIdentityWithCallSignatures2.ts, 2, 9)) >x : Symbol(x, Decl(objectTypesIdentityWithCallSignatures2.ts, 3, 8)) } @@ -13,7 +13,7 @@ class B { >B : Symbol(B, Decl(objectTypesIdentityWithCallSignatures2.ts, 4, 1)) foo(x: number): string { return null; } ->foo : Symbol(foo, Decl(objectTypesIdentityWithCallSignatures2.ts, 6, 9)) +>foo : Symbol(B.foo, Decl(objectTypesIdentityWithCallSignatures2.ts, 6, 9)) >x : Symbol(x, Decl(objectTypesIdentityWithCallSignatures2.ts, 7, 8)) } @@ -22,7 +22,7 @@ class C { >T : Symbol(T, Decl(objectTypesIdentityWithCallSignatures2.ts, 10, 8)) foo(x: T): T { return null; } ->foo : Symbol(foo, Decl(objectTypesIdentityWithCallSignatures2.ts, 10, 12)) +>foo : Symbol(C.foo, Decl(objectTypesIdentityWithCallSignatures2.ts, 10, 12)) >x : Symbol(x, Decl(objectTypesIdentityWithCallSignatures2.ts, 11, 8)) >T : Symbol(T, Decl(objectTypesIdentityWithCallSignatures2.ts, 10, 8)) >T : Symbol(T, Decl(objectTypesIdentityWithCallSignatures2.ts, 10, 8)) @@ -32,7 +32,7 @@ interface I { >I : Symbol(I, Decl(objectTypesIdentityWithCallSignatures2.ts, 12, 1)) foo(x: boolean): string; ->foo : Symbol(foo, Decl(objectTypesIdentityWithCallSignatures2.ts, 14, 13)) +>foo : Symbol(I.foo, Decl(objectTypesIdentityWithCallSignatures2.ts, 14, 13)) >x : Symbol(x, Decl(objectTypesIdentityWithCallSignatures2.ts, 15, 8)) } @@ -41,7 +41,7 @@ interface I2 { >T : Symbol(T, Decl(objectTypesIdentityWithCallSignatures2.ts, 18, 13)) foo(x: T): T; ->foo : Symbol(foo, Decl(objectTypesIdentityWithCallSignatures2.ts, 18, 17)) +>foo : Symbol(I2.foo, Decl(objectTypesIdentityWithCallSignatures2.ts, 18, 17)) >x : Symbol(x, Decl(objectTypesIdentityWithCallSignatures2.ts, 19, 8)) >T : Symbol(T, Decl(objectTypesIdentityWithCallSignatures2.ts, 18, 13)) >T : Symbol(T, Decl(objectTypesIdentityWithCallSignatures2.ts, 18, 13)) @@ -51,7 +51,7 @@ var a: { foo(x: Date): string } >a : Symbol(a, Decl(objectTypesIdentityWithCallSignatures2.ts, 22, 3)) >foo : Symbol(foo, Decl(objectTypesIdentityWithCallSignatures2.ts, 22, 8)) >x : Symbol(x, Decl(objectTypesIdentityWithCallSignatures2.ts, 22, 13)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) var b = { foo(x: RegExp) { return ''; } }; >b : Symbol(b, Decl(objectTypesIdentityWithCallSignatures2.ts, 23, 3)) diff --git a/tests/baselines/reference/objectTypesIdentityWithCallSignaturesDifferingParamCounts.symbols b/tests/baselines/reference/objectTypesIdentityWithCallSignaturesDifferingParamCounts.symbols index 9341ba35c42..9bf5c16e351 100644 --- a/tests/baselines/reference/objectTypesIdentityWithCallSignaturesDifferingParamCounts.symbols +++ b/tests/baselines/reference/objectTypesIdentityWithCallSignaturesDifferingParamCounts.symbols @@ -5,7 +5,7 @@ class A { >A : Symbol(A, Decl(objectTypesIdentityWithCallSignaturesDifferingParamCounts.ts, 0, 0)) foo(x: string): string { return null; } ->foo : Symbol(foo, Decl(objectTypesIdentityWithCallSignaturesDifferingParamCounts.ts, 2, 9)) +>foo : Symbol(A.foo, Decl(objectTypesIdentityWithCallSignaturesDifferingParamCounts.ts, 2, 9)) >x : Symbol(x, Decl(objectTypesIdentityWithCallSignaturesDifferingParamCounts.ts, 3, 8)) } @@ -13,7 +13,7 @@ class B { >B : Symbol(B, Decl(objectTypesIdentityWithCallSignaturesDifferingParamCounts.ts, 4, 1)) foo(x: string, y: string): string { return null; } ->foo : Symbol(foo, Decl(objectTypesIdentityWithCallSignaturesDifferingParamCounts.ts, 6, 9)) +>foo : Symbol(B.foo, Decl(objectTypesIdentityWithCallSignaturesDifferingParamCounts.ts, 6, 9)) >x : Symbol(x, Decl(objectTypesIdentityWithCallSignaturesDifferingParamCounts.ts, 7, 8)) >y : Symbol(y, Decl(objectTypesIdentityWithCallSignaturesDifferingParamCounts.ts, 7, 18)) } @@ -23,7 +23,7 @@ class C { >T : Symbol(T, Decl(objectTypesIdentityWithCallSignaturesDifferingParamCounts.ts, 10, 8)) foo(x: T, y: T): T { return null; } ->foo : Symbol(foo, Decl(objectTypesIdentityWithCallSignaturesDifferingParamCounts.ts, 10, 12)) +>foo : Symbol(C.foo, Decl(objectTypesIdentityWithCallSignaturesDifferingParamCounts.ts, 10, 12)) >x : Symbol(x, Decl(objectTypesIdentityWithCallSignaturesDifferingParamCounts.ts, 11, 8)) >T : Symbol(T, Decl(objectTypesIdentityWithCallSignaturesDifferingParamCounts.ts, 10, 8)) >y : Symbol(y, Decl(objectTypesIdentityWithCallSignaturesDifferingParamCounts.ts, 11, 13)) @@ -35,7 +35,7 @@ interface I { >I : Symbol(I, Decl(objectTypesIdentityWithCallSignaturesDifferingParamCounts.ts, 12, 1)) foo(x: string): string; ->foo : Symbol(foo, Decl(objectTypesIdentityWithCallSignaturesDifferingParamCounts.ts, 14, 13)) +>foo : Symbol(I.foo, Decl(objectTypesIdentityWithCallSignaturesDifferingParamCounts.ts, 14, 13)) >x : Symbol(x, Decl(objectTypesIdentityWithCallSignaturesDifferingParamCounts.ts, 15, 8)) } @@ -44,7 +44,7 @@ interface I2 { >T : Symbol(T, Decl(objectTypesIdentityWithCallSignaturesDifferingParamCounts.ts, 18, 13)) foo(x: T): T; ->foo : Symbol(foo, Decl(objectTypesIdentityWithCallSignaturesDifferingParamCounts.ts, 18, 17)) +>foo : Symbol(I2.foo, Decl(objectTypesIdentityWithCallSignaturesDifferingParamCounts.ts, 18, 17)) >x : Symbol(x, Decl(objectTypesIdentityWithCallSignaturesDifferingParamCounts.ts, 19, 8)) >T : Symbol(T, Decl(objectTypesIdentityWithCallSignaturesDifferingParamCounts.ts, 18, 13)) >T : Symbol(T, Decl(objectTypesIdentityWithCallSignaturesDifferingParamCounts.ts, 18, 13)) diff --git a/tests/baselines/reference/objectTypesIdentityWithCallSignaturesWithOverloads.symbols b/tests/baselines/reference/objectTypesIdentityWithCallSignaturesWithOverloads.symbols index 6575c6787fd..81dcabbf47e 100644 --- a/tests/baselines/reference/objectTypesIdentityWithCallSignaturesWithOverloads.symbols +++ b/tests/baselines/reference/objectTypesIdentityWithCallSignaturesWithOverloads.symbols @@ -5,15 +5,15 @@ class A { >A : Symbol(A, Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 0, 0)) foo(x: number): number; ->foo : Symbol(foo, Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 2, 9), Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 3, 27), Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 4, 27)) +>foo : Symbol(A.foo, Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 2, 9), Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 3, 27), Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 4, 27)) >x : Symbol(x, Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 3, 8)) foo(x: string): string; ->foo : Symbol(foo, Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 2, 9), Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 3, 27), Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 4, 27)) +>foo : Symbol(A.foo, Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 2, 9), Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 3, 27), Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 4, 27)) >x : Symbol(x, Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 4, 8)) foo(x: any): any { return null; } ->foo : Symbol(foo, Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 2, 9), Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 3, 27), Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 4, 27)) +>foo : Symbol(A.foo, Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 2, 9), Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 3, 27), Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 4, 27)) >x : Symbol(x, Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 5, 8)) } @@ -21,15 +21,15 @@ class B { >B : Symbol(B, Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 6, 1)) foo(x: number): number; ->foo : Symbol(foo, Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 8, 9), Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 9, 27), Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 10, 27)) +>foo : Symbol(B.foo, Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 8, 9), Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 9, 27), Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 10, 27)) >x : Symbol(x, Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 9, 8)) foo(x: string): string; ->foo : Symbol(foo, Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 8, 9), Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 9, 27), Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 10, 27)) +>foo : Symbol(B.foo, Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 8, 9), Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 9, 27), Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 10, 27)) >x : Symbol(x, Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 10, 8)) foo(x: any): any { return null; } ->foo : Symbol(foo, Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 8, 9), Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 9, 27), Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 10, 27)) +>foo : Symbol(B.foo, Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 8, 9), Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 9, 27), Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 10, 27)) >x : Symbol(x, Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 11, 8)) } @@ -38,21 +38,21 @@ class C { >T : Symbol(T, Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 14, 8)) foo(x: number): number; ->foo : Symbol(foo, Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 14, 12), Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 15, 27), Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 16, 27), Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 17, 17)) +>foo : Symbol(C.foo, Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 14, 12), Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 15, 27), Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 16, 27), Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 17, 17)) >x : Symbol(x, Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 15, 8)) foo(x: string): string; ->foo : Symbol(foo, Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 14, 12), Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 15, 27), Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 16, 27), Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 17, 17)) +>foo : Symbol(C.foo, Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 14, 12), Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 15, 27), Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 16, 27), Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 17, 17)) >x : Symbol(x, Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 16, 8)) foo(x: T): T; ->foo : Symbol(foo, Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 14, 12), Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 15, 27), Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 16, 27), Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 17, 17)) +>foo : Symbol(C.foo, Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 14, 12), Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 15, 27), Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 16, 27), Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 17, 17)) >x : Symbol(x, Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 17, 8)) >T : Symbol(T, Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 14, 8)) >T : Symbol(T, Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 14, 8)) foo(x: any): any { return null; } ->foo : Symbol(foo, Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 14, 12), Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 15, 27), Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 16, 27), Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 17, 17)) +>foo : Symbol(C.foo, Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 14, 12), Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 15, 27), Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 16, 27), Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 17, 17)) >x : Symbol(x, Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 18, 8)) } @@ -60,11 +60,11 @@ interface I { >I : Symbol(I, Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 19, 1)) foo(x: number): number; ->foo : Symbol(foo, Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 21, 13), Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 22, 27)) +>foo : Symbol(I.foo, Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 21, 13), Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 22, 27)) >x : Symbol(x, Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 22, 8)) foo(x: string): string; ->foo : Symbol(foo, Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 21, 13), Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 22, 27)) +>foo : Symbol(I.foo, Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 21, 13), Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 22, 27)) >x : Symbol(x, Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 23, 8)) } @@ -73,15 +73,15 @@ interface I2 { >T : Symbol(T, Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 26, 13)) foo(x: number): number; ->foo : Symbol(foo, Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 26, 17), Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 27, 27), Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 28, 27)) +>foo : Symbol(I2.foo, Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 26, 17), Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 27, 27), Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 28, 27)) >x : Symbol(x, Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 27, 8)) foo(x: string): string; ->foo : Symbol(foo, Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 26, 17), Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 27, 27), Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 28, 27)) +>foo : Symbol(I2.foo, Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 26, 17), Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 27, 27), Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 28, 27)) >x : Symbol(x, Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 28, 8)) foo(x: T): T; ->foo : Symbol(foo, Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 26, 17), Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 27, 27), Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 28, 27)) +>foo : Symbol(I2.foo, Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 26, 17), Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 27, 27), Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 28, 27)) >x : Symbol(x, Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 29, 8)) >T : Symbol(T, Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 26, 13)) >T : Symbol(T, Decl(objectTypesIdentityWithCallSignaturesWithOverloads.ts, 26, 13)) diff --git a/tests/baselines/reference/objectTypesIdentityWithConstructSignatures2.symbols b/tests/baselines/reference/objectTypesIdentityWithConstructSignatures2.symbols index 90ec832873c..64677b63c5f 100644 --- a/tests/baselines/reference/objectTypesIdentityWithConstructSignatures2.symbols +++ b/tests/baselines/reference/objectTypesIdentityWithConstructSignatures2.symbols @@ -37,7 +37,7 @@ interface I2 { var a: { new(x: Date): string } >a : Symbol(a, Decl(objectTypesIdentityWithConstructSignatures2.ts, 18, 3)) >x : Symbol(x, Decl(objectTypesIdentityWithConstructSignatures2.ts, 18, 13)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) var b = { new(x: RegExp) { return ''; } }; // not a construct signature, function called new >b : Symbol(b, Decl(objectTypesIdentityWithConstructSignatures2.ts, 19, 3)) diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignatures.symbols b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignatures.symbols index 8fdebdcccbe..42367d7ed38 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignatures.symbols +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignatures.symbols @@ -5,7 +5,7 @@ class A { >A : Symbol(A, Decl(objectTypesIdentityWithGenericCallSignatures.ts, 0, 0)) foo(x: T): T { return null; } ->foo : Symbol(foo, Decl(objectTypesIdentityWithGenericCallSignatures.ts, 2, 9)) +>foo : Symbol(A.foo, Decl(objectTypesIdentityWithGenericCallSignatures.ts, 2, 9)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignatures.ts, 3, 8)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignatures.ts, 3, 11)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignatures.ts, 3, 8)) @@ -17,7 +17,7 @@ class B { >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignatures.ts, 6, 8)) foo(x: T): T { return null; } ->foo : Symbol(foo, Decl(objectTypesIdentityWithGenericCallSignatures.ts, 6, 12)) +>foo : Symbol(B.foo, Decl(objectTypesIdentityWithGenericCallSignatures.ts, 6, 12)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignatures.ts, 7, 8)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignatures.ts, 6, 8)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignatures.ts, 6, 8)) @@ -28,7 +28,7 @@ class C { >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignatures.ts, 10, 8)) foo(x: T): T { return null; } ->foo : Symbol(foo, Decl(objectTypesIdentityWithGenericCallSignatures.ts, 10, 12)) +>foo : Symbol(C.foo, Decl(objectTypesIdentityWithGenericCallSignatures.ts, 10, 12)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignatures.ts, 11, 8)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignatures.ts, 10, 8)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignatures.ts, 10, 8)) @@ -39,7 +39,7 @@ interface I { >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignatures.ts, 14, 12)) foo(x: T): T; ->foo : Symbol(foo, Decl(objectTypesIdentityWithGenericCallSignatures.ts, 14, 16)) +>foo : Symbol(I.foo, Decl(objectTypesIdentityWithGenericCallSignatures.ts, 14, 16)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignatures.ts, 15, 8)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignatures.ts, 14, 12)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignatures.ts, 14, 12)) @@ -49,7 +49,7 @@ interface I2 { >I2 : Symbol(I2, Decl(objectTypesIdentityWithGenericCallSignatures.ts, 16, 1)) foo(x: T): T; ->foo : Symbol(foo, Decl(objectTypesIdentityWithGenericCallSignatures.ts, 18, 14)) +>foo : Symbol(I2.foo, Decl(objectTypesIdentityWithGenericCallSignatures.ts, 18, 14)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignatures.ts, 19, 8)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignatures.ts, 19, 11)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignatures.ts, 19, 8)) diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignatures2.symbols b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignatures2.symbols index 2ca97948a99..a9925925c9e 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignatures2.symbols +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignatures2.symbols @@ -5,7 +5,7 @@ class A { >A : Symbol(A, Decl(objectTypesIdentityWithGenericCallSignatures2.ts, 0, 0)) foo(x: T, y: U): T { return null; } ->foo : Symbol(foo, Decl(objectTypesIdentityWithGenericCallSignatures2.ts, 2, 9)) +>foo : Symbol(A.foo, Decl(objectTypesIdentityWithGenericCallSignatures2.ts, 2, 9)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignatures2.ts, 3, 8)) >U : Symbol(U, Decl(objectTypesIdentityWithGenericCallSignatures2.ts, 3, 10)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignatures2.ts, 3, 14)) @@ -21,7 +21,7 @@ class B { >U : Symbol(U, Decl(objectTypesIdentityWithGenericCallSignatures2.ts, 6, 10)) foo(x: T, y: U): T { return null; } ->foo : Symbol(foo, Decl(objectTypesIdentityWithGenericCallSignatures2.ts, 6, 15)) +>foo : Symbol(B.foo, Decl(objectTypesIdentityWithGenericCallSignatures2.ts, 6, 15)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignatures2.ts, 7, 8)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignatures2.ts, 6, 8)) >y : Symbol(y, Decl(objectTypesIdentityWithGenericCallSignatures2.ts, 7, 13)) @@ -35,7 +35,7 @@ class C { >U : Symbol(U, Decl(objectTypesIdentityWithGenericCallSignatures2.ts, 10, 10)) foo(x: T, y: U): T { return null; } ->foo : Symbol(foo, Decl(objectTypesIdentityWithGenericCallSignatures2.ts, 10, 15)) +>foo : Symbol(C.foo, Decl(objectTypesIdentityWithGenericCallSignatures2.ts, 10, 15)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignatures2.ts, 11, 8)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignatures2.ts, 10, 8)) >y : Symbol(y, Decl(objectTypesIdentityWithGenericCallSignatures2.ts, 11, 13)) @@ -49,7 +49,7 @@ interface I { >U : Symbol(U, Decl(objectTypesIdentityWithGenericCallSignatures2.ts, 14, 14)) foo(x: T, y: U): T; ->foo : Symbol(foo, Decl(objectTypesIdentityWithGenericCallSignatures2.ts, 14, 19)) +>foo : Symbol(I.foo, Decl(objectTypesIdentityWithGenericCallSignatures2.ts, 14, 19)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignatures2.ts, 15, 8)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignatures2.ts, 14, 12)) >y : Symbol(y, Decl(objectTypesIdentityWithGenericCallSignatures2.ts, 15, 13)) @@ -61,7 +61,7 @@ interface I2 { >I2 : Symbol(I2, Decl(objectTypesIdentityWithGenericCallSignatures2.ts, 16, 1)) foo(x: T, y: U): T; ->foo : Symbol(foo, Decl(objectTypesIdentityWithGenericCallSignatures2.ts, 18, 14)) +>foo : Symbol(I2.foo, Decl(objectTypesIdentityWithGenericCallSignatures2.ts, 18, 14)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignatures2.ts, 19, 8)) >U : Symbol(U, Decl(objectTypesIdentityWithGenericCallSignatures2.ts, 19, 10)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignatures2.ts, 19, 14)) diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.symbols b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.symbols index b8432af2425..7d017936a04 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.symbols +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.symbols @@ -7,9 +7,9 @@ class A { >A : Symbol(A, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 0, 0)) foo(x: T): string { return null; } ->foo : Symbol(foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 4, 9)) +>foo : Symbol(A.foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 4, 9)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 5, 8)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 5, 24)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 5, 8)) } @@ -20,7 +20,7 @@ class B> { >Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) foo(x: T): string { return null; } ->foo : Symbol(foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 8, 34)) +>foo : Symbol(B.foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 8, 34)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 9, 8)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 8, 8)) } @@ -28,10 +28,10 @@ class B> { class C { >C : Symbol(C, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 10, 1)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 12, 8)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) foo(x: T): string { return null; } ->foo : Symbol(foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 12, 27)) +>foo : Symbol(C.foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 12, 27)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 13, 8)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 12, 8)) } @@ -39,10 +39,10 @@ class C { interface I { >I : Symbol(I, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 14, 1)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 16, 12)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) foo(x: T): string; ->foo : Symbol(foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 16, 31)) +>foo : Symbol(I.foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 16, 31)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 17, 8)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 16, 12)) } @@ -51,7 +51,7 @@ interface I2 { >I2 : Symbol(I2, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 18, 1)) foo(x: T): string; ->foo : Symbol(foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 20, 14)) +>foo : Symbol(I2.foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 20, 14)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 21, 8)) >Boolean : Symbol(Boolean, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 21, 27)) @@ -108,13 +108,13 @@ function foo1c(x: C); >foo1c : Symbol(foo1c, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 33, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 35, 29), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 36, 29)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 35, 15)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 10, 1)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo1c(x: C); // error >foo1c : Symbol(foo1c, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 33, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 35, 29), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 36, 29)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 36, 15)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 10, 1)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo1c(x: any) { } >foo1c : Symbol(foo1c, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 33, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 35, 29), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 36, 29)) @@ -124,13 +124,13 @@ function foo2(x: I); >foo2 : Symbol(foo2, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 37, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 39, 28), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 40, 28)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 39, 14)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 14, 1)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo2(x: I); // error >foo2 : Symbol(foo2, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 37, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 39, 28), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 40, 28)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 40, 14)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 14, 1)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo2(x: any) { } >foo2 : Symbol(foo2, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 37, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 39, 28), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 40, 28)) @@ -188,7 +188,7 @@ function foo5b(x: C); // ok >foo5b : Symbol(foo5b, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 53, 25), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 55, 21), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 56, 29)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 56, 15)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 10, 1)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo5b(x: any) { } >foo5b : Symbol(foo5b, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 53, 25), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 55, 21), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 56, 29)) @@ -203,7 +203,7 @@ function foo6(x: I); // ok >foo6 : Symbol(foo6, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 57, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 59, 20), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 60, 28)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 60, 14)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 14, 1)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo6(x: any) { } >foo6 : Symbol(foo6, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 57, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 59, 20), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 60, 28)) @@ -233,7 +233,7 @@ function foo8(x: I); // ok >foo8 : Symbol(foo8, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 65, 25), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 67, 35), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 68, 28)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 68, 14)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 14, 1)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo8(x: any) { } >foo8 : Symbol(foo8, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 65, 25), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 67, 35), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 68, 28)) @@ -249,7 +249,7 @@ function foo9(x: C); // ok >foo9 : Symbol(foo9, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 69, 25), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 71, 35), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 72, 28)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 72, 14)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 10, 1)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo9(x: any) { } >foo9 : Symbol(foo9, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 69, 25), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 71, 35), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 72, 28)) @@ -289,13 +289,13 @@ function foo12(x: I); >foo12 : Symbol(foo12, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 81, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 83, 29), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 84, 29)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 83, 15)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 14, 1)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo12(x: C); // ok >foo12 : Symbol(foo12, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 81, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 83, 29), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 84, 29)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 84, 15)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 10, 1)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo12(x: any) { } >foo12 : Symbol(foo12, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 81, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 83, 29), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 84, 29)) @@ -310,7 +310,7 @@ function foo12b(x: C); // ok >foo12b : Symbol(foo12b, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 85, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 87, 23), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 88, 30)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 88, 16)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 10, 1)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo12b(x: any) { } >foo12b : Symbol(foo12b, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 85, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 87, 23), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 88, 30)) @@ -320,7 +320,7 @@ function foo13(x: I); >foo13 : Symbol(foo13, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 89, 27), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 91, 29), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 92, 28)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 91, 15)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 14, 1)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo13(x: typeof a); // ok >foo13 : Symbol(foo13, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 89, 27), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 91, 29), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 92, 28)) @@ -335,7 +335,7 @@ function foo14(x: I); >foo14 : Symbol(foo14, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 93, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 95, 29), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 96, 28)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 95, 15)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 14, 1)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo14(x: typeof b); // ok >foo14 : Symbol(foo14, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 93, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 95, 29), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 96, 28)) @@ -355,7 +355,7 @@ function foo15(x: C); // ok >foo15 : Symbol(foo15, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 97, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 99, 22), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 100, 29)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 100, 15)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 10, 1)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo15(x: any) { } >foo15 : Symbol(foo15, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 97, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 99, 22), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 100, 29)) diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.symbols b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.symbols index e8c34a1bf99..e37b606be59 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.symbols +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.symbols @@ -7,11 +7,11 @@ class A { >A : Symbol(A, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 0, 0)) foo(x: T, y: U): string { return null; } ->foo : Symbol(foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 4, 9)) +>foo : Symbol(A.foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 4, 9)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 5, 8)) >U : Symbol(U, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 5, 20)) >U : Symbol(U, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 5, 20)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 5, 37)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 5, 8)) >y : Symbol(y, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 5, 42)) @@ -26,7 +26,7 @@ class B> { >Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) foo(x: T, y: U): string { return null; } ->foo : Symbol(foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 8, 47)) +>foo : Symbol(B.foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 8, 47)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 9, 8)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 8, 8)) >y : Symbol(y, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 9, 13)) @@ -38,10 +38,10 @@ class C { >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 12, 8)) >U : Symbol(U, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 12, 20)) >U : Symbol(U, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 12, 20)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) foo(x: T, y: U): string { return null; } ->foo : Symbol(foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 12, 40)) +>foo : Symbol(C.foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 12, 40)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 13, 8)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 12, 8)) >y : Symbol(y, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 13, 13)) @@ -53,10 +53,10 @@ class D { >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 16, 8)) >U : Symbol(U, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 16, 20)) >U : Symbol(U, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 16, 20)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) foo(x: T, y: U): string { return null; } ->foo : Symbol(foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 16, 40)) +>foo : Symbol(D.foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 16, 40)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 17, 8)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 16, 8)) >y : Symbol(y, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 17, 13)) @@ -68,10 +68,10 @@ interface I { >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 20, 12)) >U : Symbol(U, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 20, 24)) >U : Symbol(U, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 20, 24)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) foo(x: T, y: U): string; ->foo : Symbol(foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 20, 44)) +>foo : Symbol(I.foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 20, 44)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 21, 8)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 20, 12)) >y : Symbol(y, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 21, 13)) @@ -82,7 +82,7 @@ interface I2 { >I2 : Symbol(I2, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 22, 1)) foo(x: T, y: U): string; ->foo : Symbol(foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 24, 14)) +>foo : Symbol(I2.foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 24, 14)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 25, 8)) >U : Symbol(U, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 25, 20)) >U : Symbol(U, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 25, 20)) @@ -153,15 +153,15 @@ function foo1c(x: C); >foo1c : Symbol(foo1c, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 37, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 39, 37), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 40, 37)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 39, 15)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 10, 1)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo1c(x: C); // error >foo1c : Symbol(foo1c, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 37, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 39, 37), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 40, 37)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 40, 15)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 10, 1)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo1c(x: any) { } >foo1c : Symbol(foo1c, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 37, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 39, 37), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 40, 37)) @@ -171,15 +171,15 @@ function foo2(x: I); >foo2 : Symbol(foo2, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 41, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 43, 36), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 44, 36)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 43, 14)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 18, 1)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo2(x: I); // error >foo2 : Symbol(foo2, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 41, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 43, 36), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 44, 36)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 44, 14)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 18, 1)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo2(x: any) { } >foo2 : Symbol(foo2, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 41, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 43, 36), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 44, 36)) @@ -238,8 +238,8 @@ function foo5b(x: C); // ok >foo5b : Symbol(foo5b, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 57, 25), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 59, 21), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 60, 37)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 60, 15)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 10, 1)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo5b(x: any) { } >foo5b : Symbol(foo5b, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 57, 25), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 59, 21), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 60, 37)) @@ -249,15 +249,15 @@ function foo5c(x: C); >foo5c : Symbol(foo5c, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 61, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 63, 37), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 64, 37)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 63, 15)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 10, 1)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo5c(x: D); // ok >foo5c : Symbol(foo5c, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 61, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 63, 37), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 64, 37)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 64, 15)) >D : Symbol(D, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 14, 1)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo5c(x: any) { } >foo5c : Symbol(foo5c, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 61, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 63, 37), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 64, 37)) @@ -267,14 +267,14 @@ function foo6c(x: C); >foo6c : Symbol(foo6c, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 65, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 67, 37), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 68, 34)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 67, 15)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 10, 1)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo6c(x: D); // error, "any" does not satisfy the constraint >foo6c : Symbol(foo6c, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 65, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 67, 37), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 68, 34)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 68, 15)) >D : Symbol(D, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 14, 1)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo6c(x: any) { } >foo6c : Symbol(foo6c, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 65, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 67, 37), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 68, 34)) @@ -289,8 +289,8 @@ function foo6(x: I); // ok >foo6 : Symbol(foo6, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 69, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 71, 20), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 72, 36)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 72, 14)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 18, 1)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo6(x: any) { } >foo6 : Symbol(foo6, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 69, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 71, 20), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 72, 36)) @@ -321,8 +321,8 @@ function foo8(x: I); // ok >foo8 : Symbol(foo8, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 77, 25), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 79, 50), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 80, 36)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 80, 14)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 18, 1)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo8(x: any) { } >foo8 : Symbol(foo8, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 77, 25), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 79, 50), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 80, 36)) @@ -339,8 +339,8 @@ function foo9(x: C); // ok >foo9 : Symbol(foo9, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 81, 25), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 83, 50), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 84, 36)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 84, 14)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 10, 1)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo9(x: any) { } >foo9 : Symbol(foo9, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 81, 25), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 83, 50), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 84, 36)) @@ -382,15 +382,15 @@ function foo12(x: I); >foo12 : Symbol(foo12, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 93, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 95, 37), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 96, 37)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 95, 15)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 18, 1)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo12(x: C); // ok >foo12 : Symbol(foo12, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 93, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 95, 37), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 96, 37)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 96, 15)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 10, 1)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo12(x: any) { } >foo12 : Symbol(foo12, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 93, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 95, 37), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 96, 37)) @@ -405,8 +405,8 @@ function foo12b(x: C); // ok >foo12b : Symbol(foo12b, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 97, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 99, 23), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 100, 38)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 100, 16)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 10, 1)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo12b(x: any) { } >foo12b : Symbol(foo12b, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 97, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 99, 23), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 100, 38)) @@ -416,8 +416,8 @@ function foo13(x: I); >foo13 : Symbol(foo13, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 101, 27), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 103, 37), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 104, 28)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 103, 15)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 18, 1)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo13(x: typeof a); // ok >foo13 : Symbol(foo13, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 101, 27), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 103, 37), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 104, 28)) @@ -432,8 +432,8 @@ function foo14(x: I); >foo14 : Symbol(foo14, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 105, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 107, 37), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 108, 28)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 107, 15)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 18, 1)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo14(x: typeof b); // ok >foo14 : Symbol(foo14, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 105, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 107, 37), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 108, 28)) @@ -453,8 +453,8 @@ function foo15(x: C); // ok >foo15 : Symbol(foo15, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 109, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 111, 22), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 112, 37)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 112, 15)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 10, 1)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo15(x: any) { } >foo15 : Symbol(foo15, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 109, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 111, 22), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 112, 37)) diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.symbols b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.symbols index 6bcbd98f225..c622452a8e1 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.symbols +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.symbols @@ -5,20 +5,20 @@ class One { foo: string } >One : Symbol(One, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.ts, 0, 0)) ->foo : Symbol(foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.ts, 4, 11)) +>foo : Symbol(One.foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.ts, 4, 11)) class Two { foo: string } >Two : Symbol(Two, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.ts, 4, 25)) ->foo : Symbol(foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.ts, 5, 11)) +>foo : Symbol(Two.foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.ts, 5, 11)) interface Three { foo: string } >Three : Symbol(Three, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.ts, 5, 25)) ->foo : Symbol(foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.ts, 6, 17)) +>foo : Symbol(Three.foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.ts, 6, 17)) interface Four { foo: T } >Four : Symbol(Four, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.ts, 6, 31)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.ts, 7, 15)) ->foo : Symbol(foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.ts, 7, 19)) +>foo : Symbol(Four.foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.ts, 7, 19)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.ts, 7, 15)) interface Five extends Four { } @@ -33,7 +33,7 @@ interface Six { >U : Symbol(U, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.ts, 9, 16)) foo: T; ->foo : Symbol(foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.ts, 9, 21)) +>foo : Symbol(Six.foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.ts, 9, 21)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.ts, 9, 14)) } @@ -41,7 +41,7 @@ class A { >A : Symbol(A, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.ts, 11, 1)) foo(x: T, y: U): string { return null; } ->foo : Symbol(foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.ts, 13, 9)) +>foo : Symbol(A.foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.ts, 13, 9)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.ts, 14, 8)) >U : Symbol(U, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.ts, 14, 20)) >U : Symbol(U, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.ts, 14, 20)) @@ -60,7 +60,7 @@ class B { >Two : Symbol(Two, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.ts, 4, 25)) foo(x: T, y: U): string { return null; } ->foo : Symbol(foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.ts, 17, 37)) +>foo : Symbol(B.foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.ts, 17, 37)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.ts, 18, 8)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.ts, 17, 8)) >y : Symbol(y, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.ts, 18, 13)) @@ -75,7 +75,7 @@ class C { >Three : Symbol(Three, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.ts, 5, 25)) foo(x: T, y: U): string { return null; } ->foo : Symbol(foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.ts, 21, 39)) +>foo : Symbol(C.foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.ts, 21, 39)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.ts, 22, 8)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.ts, 21, 8)) >y : Symbol(y, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.ts, 22, 13)) @@ -90,7 +90,7 @@ class D> { >Four : Symbol(Four, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.ts, 6, 31)) foo(x: T, y: U): string { return null; } ->foo : Symbol(foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.ts, 25, 46)) +>foo : Symbol(D.foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.ts, 25, 46)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.ts, 26, 8)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.ts, 25, 8)) >y : Symbol(y, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.ts, 26, 13)) @@ -105,7 +105,7 @@ interface I> { >Five : Symbol(Five, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.ts, 7, 28)) foo(x: T, y: U): string; ->foo : Symbol(foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.ts, 29, 50)) +>foo : Symbol(I.foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.ts, 29, 50)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.ts, 30, 8)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.ts, 29, 12)) >y : Symbol(y, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.ts, 30, 13)) @@ -116,7 +116,7 @@ interface I2 { >I2 : Symbol(I2, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.ts, 31, 1)) foo>(x: T, y: U): string; ->foo : Symbol(foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.ts, 33, 14)) +>foo : Symbol(I2.foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.ts, 33, 14)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.ts, 34, 8)) >U : Symbol(U, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.ts, 34, 20)) >U : Symbol(U, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.ts, 34, 20)) diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.symbols b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.symbols index e199d538e4b..a3f4f8038a0 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.symbols +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.symbols @@ -7,7 +7,7 @@ class A { >A : Symbol(A, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.ts, 0, 0)) foo(x: T): string { return null; } ->foo : Symbol(foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.ts, 4, 9)) +>foo : Symbol(A.foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.ts, 4, 9)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.ts, 5, 8)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.ts, 5, 11)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.ts, 5, 8)) @@ -18,7 +18,7 @@ class B { >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.ts, 8, 8)) foo(x: T): number { return null; } ->foo : Symbol(foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.ts, 8, 12)) +>foo : Symbol(B.foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.ts, 8, 12)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.ts, 9, 8)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.ts, 8, 8)) } @@ -28,7 +28,7 @@ class C { >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.ts, 12, 8)) foo(x: T): boolean { return null; } ->foo : Symbol(foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.ts, 12, 12)) +>foo : Symbol(C.foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.ts, 12, 12)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.ts, 13, 8)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.ts, 12, 8)) } @@ -38,17 +38,17 @@ interface I { >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.ts, 16, 12)) foo(x: T): Date; ->foo : Symbol(foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.ts, 16, 16)) +>foo : Symbol(I.foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.ts, 16, 16)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.ts, 17, 8)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.ts, 16, 12)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) } interface I2 { >I2 : Symbol(I2, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.ts, 18, 1)) foo(x: T): RegExp; ->foo : Symbol(foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.ts, 20, 14)) +>foo : Symbol(I2.foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.ts, 20, 14)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.ts, 21, 8)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.ts, 21, 11)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.ts, 21, 8)) diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.symbols b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.symbols index a0c520ef3fa..d90a4b1d545 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.symbols +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.symbols @@ -7,9 +7,9 @@ class A { >A : Symbol(A, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 0, 0)) foo(x: T): string { return null; } ->foo : Symbol(foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 4, 9)) +>foo : Symbol(A.foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 4, 9)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 5, 8)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 5, 24)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 5, 8)) } @@ -17,10 +17,10 @@ class A { class B { >B : Symbol(B, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 6, 1)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 8, 8)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) foo(x: T): number { return null; } ->foo : Symbol(foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 8, 25)) +>foo : Symbol(B.foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 8, 25)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 9, 8)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 8, 8)) } @@ -28,10 +28,10 @@ class B { class C { >C : Symbol(C, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 10, 1)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 12, 8)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) foo(x: T): boolean { return null; } ->foo : Symbol(foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 12, 25)) +>foo : Symbol(C.foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 12, 25)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 13, 8)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 12, 8)) } @@ -39,22 +39,22 @@ class C { interface I { >I : Symbol(I, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 14, 1)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 16, 12)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) foo(x: T): Date; ->foo : Symbol(foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 16, 29)) +>foo : Symbol(I.foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 16, 29)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 17, 8)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 16, 12)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) } interface I2 { >I2 : Symbol(I2, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 18, 1)) foo(x: T): RegExp; ->foo : Symbol(foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 20, 14)) +>foo : Symbol(I2.foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 20, 14)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 21, 8)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 21, 24)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 21, 8)) >RegExp : Symbol(RegExp, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) @@ -64,7 +64,7 @@ var a: { foo(x: T): T } >a : Symbol(a, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 24, 3)) >foo : Symbol(foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 24, 8)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 24, 13)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 24, 29)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 24, 13)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 24, 13)) @@ -73,7 +73,7 @@ var b = { foo(x: T) { return null; } }; >b : Symbol(b, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 25, 3)) >foo : Symbol(foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 25, 9)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 25, 14)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 25, 30)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 25, 14)) @@ -95,13 +95,13 @@ function foo1b(x: B); >foo1b : Symbol(foo1b, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 29, 25), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 31, 27), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 32, 27)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 31, 15)) >B : Symbol(B, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 6, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo1b(x: B); // error >foo1b : Symbol(foo1b, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 29, 25), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 31, 27), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 32, 27)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 32, 15)) >B : Symbol(B, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 6, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo1b(x: any) { } >foo1b : Symbol(foo1b, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 29, 25), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 31, 27), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 32, 27)) @@ -111,13 +111,13 @@ function foo1c(x: C); >foo1c : Symbol(foo1c, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 33, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 35, 27), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 36, 27)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 35, 15)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 10, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo1c(x: C); // error >foo1c : Symbol(foo1c, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 33, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 35, 27), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 36, 27)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 36, 15)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 10, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo1c(x: any) { } >foo1c : Symbol(foo1c, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 33, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 35, 27), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 36, 27)) @@ -127,13 +127,13 @@ function foo2(x: I); >foo2 : Symbol(foo2, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 37, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 39, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 40, 26)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 39, 14)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 14, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo2(x: I); // error >foo2 : Symbol(foo2, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 37, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 39, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 40, 26)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 40, 14)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 14, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo2(x: any) { } >foo2 : Symbol(foo2, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 37, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 39, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 40, 26)) @@ -176,7 +176,7 @@ function foo5(x: B); // ok >foo5 : Symbol(foo5, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 49, 25), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 51, 20), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 52, 26)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 52, 14)) >B : Symbol(B, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 6, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo5(x: any) { } >foo5 : Symbol(foo5, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 49, 25), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 51, 20), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 52, 26)) @@ -191,7 +191,7 @@ function foo5b(x: C); // ok >foo5b : Symbol(foo5b, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 53, 25), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 55, 21), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 56, 27)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 56, 15)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 10, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo5b(x: any) { } >foo5b : Symbol(foo5b, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 53, 25), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 55, 21), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 56, 27)) @@ -206,7 +206,7 @@ function foo6(x: I); // ok >foo6 : Symbol(foo6, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 57, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 59, 20), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 60, 26)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 60, 14)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 14, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo6(x: any) { } >foo6 : Symbol(foo6, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 57, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 59, 20), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 60, 26)) @@ -230,13 +230,13 @@ function foo8(x: B); >foo8 : Symbol(foo8, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 65, 25), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 67, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 68, 26)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 67, 14)) >B : Symbol(B, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 6, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo8(x: I); // ok >foo8 : Symbol(foo8, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 65, 25), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 67, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 68, 26)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 68, 14)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 14, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo8(x: any) { } >foo8 : Symbol(foo8, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 65, 25), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 67, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 68, 26)) @@ -246,13 +246,13 @@ function foo9(x: B); >foo9 : Symbol(foo9, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 69, 25), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 71, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 72, 26)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 71, 14)) >B : Symbol(B, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 6, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo9(x: C); // ok >foo9 : Symbol(foo9, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 69, 25), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 71, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 72, 26)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 72, 14)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 10, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo9(x: any) { } >foo9 : Symbol(foo9, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 69, 25), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 71, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 72, 26)) @@ -262,7 +262,7 @@ function foo10(x: B); >foo10 : Symbol(foo10, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 73, 25), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 75, 27), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 76, 28)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 75, 15)) >B : Symbol(B, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 6, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo10(x: typeof a); // ok >foo10 : Symbol(foo10, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 73, 25), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 75, 27), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 76, 28)) @@ -277,7 +277,7 @@ function foo11(x: B); >foo11 : Symbol(foo11, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 77, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 79, 27), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 80, 28)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 79, 15)) >B : Symbol(B, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 6, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo11(x: typeof b); // ok >foo11 : Symbol(foo11, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 77, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 79, 27), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 80, 28)) @@ -292,13 +292,13 @@ function foo12(x: I); >foo12 : Symbol(foo12, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 81, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 83, 27), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 84, 27)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 83, 15)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 14, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo12(x: C); // ok >foo12 : Symbol(foo12, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 81, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 83, 27), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 84, 27)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 84, 15)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 10, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo12(x: any) { } >foo12 : Symbol(foo12, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 81, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 83, 27), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 84, 27)) @@ -313,7 +313,7 @@ function foo12b(x: C); // ok >foo12b : Symbol(foo12b, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 85, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 87, 23), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 88, 28)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 88, 16)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 10, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo12b(x: any) { } >foo12b : Symbol(foo12b, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 85, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 87, 23), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 88, 28)) @@ -323,7 +323,7 @@ function foo13(x: I); >foo13 : Symbol(foo13, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 89, 27), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 91, 27), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 92, 28)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 91, 15)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 14, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo13(x: typeof a); // ok >foo13 : Symbol(foo13, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 89, 27), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 91, 27), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 92, 28)) @@ -338,7 +338,7 @@ function foo14(x: I); >foo14 : Symbol(foo14, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 93, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 95, 27), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 96, 28)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 95, 15)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 14, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo14(x: typeof b); // ok >foo14 : Symbol(foo14, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 93, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 95, 27), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 96, 28)) @@ -358,7 +358,7 @@ function foo15(x: C); // ok >foo15 : Symbol(foo15, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 97, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 99, 22), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 100, 27)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 100, 15)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 10, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo15(x: any) { } >foo15 : Symbol(foo15, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 97, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 99, 22), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 100, 27)) diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.symbols b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.symbols index a4760572e7d..748c945d8d0 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.symbols +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.symbols @@ -5,7 +5,7 @@ class A { >A : Symbol(A, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 0, 0)) foo(x: T): T { return null; } ->foo : Symbol(foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 2, 9)) +>foo : Symbol(A.foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 2, 9)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 3, 8)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 3, 11)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 3, 8)) @@ -18,7 +18,7 @@ class B { >V : Symbol(V, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 6, 10)) foo(x: U): U { return null; } ->foo : Symbol(foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 6, 15)) +>foo : Symbol(B.foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 6, 15)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 7, 8)) >U : Symbol(U, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 6, 8)) >U : Symbol(U, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 6, 8)) @@ -31,7 +31,7 @@ class C { >X : Symbol(X, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 10, 13)) foo(x: V): V { return null; } ->foo : Symbol(foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 10, 18)) +>foo : Symbol(C.foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 10, 18)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 11, 8)) >V : Symbol(V, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 10, 8)) >V : Symbol(V, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 10, 8)) @@ -45,7 +45,7 @@ interface I { >A : Symbol(A, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 14, 20)) foo(x: X): X; ->foo : Symbol(foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 14, 25)) +>foo : Symbol(I.foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 14, 25)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 15, 8)) >X : Symbol(X, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 14, 12)) >X : Symbol(X, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 14, 12)) @@ -55,7 +55,7 @@ interface I2 { >I2 : Symbol(I2, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 16, 1)) foo(x: Y): Y; ->foo : Symbol(foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 18, 14)) +>foo : Symbol(I2.foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 18, 14)) >Y : Symbol(Y, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 19, 8)) >Z : Symbol(Z, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 19, 10)) >A : Symbol(A, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 19, 13)) @@ -211,7 +211,7 @@ function foo6(x: I); // ok >foo6 : Symbol(foo6, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 55, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 57, 20), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 58, 51)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 58, 14)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 12, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo6(x: any) { } >foo6 : Symbol(foo6, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 55, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 57, 20), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 58, 51)) @@ -240,7 +240,7 @@ function foo8(x: I); // error >foo8 : Symbol(foo8, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 63, 25), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 65, 36), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 66, 51)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 66, 14)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 12, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo8(x: any) { } >foo8 : Symbol(foo8, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 63, 25), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 65, 36), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 66, 51)) @@ -294,14 +294,14 @@ function foo12(x: I, number, Date, string>); >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 81, 15)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 12, 1)) >B : Symbol(B, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 4, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo12(x: C, number, Date>); // error >foo12 : Symbol(foo12, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 79, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 81, 62), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 82, 54)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 82, 15)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 8, 1)) >B : Symbol(B, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 4, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo12(x: any) { } >foo12 : Symbol(foo12, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 79, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 81, 62), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 82, 54)) @@ -325,9 +325,9 @@ function foo13(x: I); >foo13 : Symbol(foo13, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 87, 27), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 89, 49), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 90, 28)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 89, 15)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 12, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >RegExp : Symbol(RegExp, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo13(x: typeof a); // ok >foo13 : Symbol(foo13, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 87, 27), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 89, 49), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 90, 28)) @@ -342,7 +342,7 @@ function foo14(x: I); >foo14 : Symbol(foo14, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 91, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 93, 52), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 94, 28)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 93, 15)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 12, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >RegExp : Symbol(RegExp, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo14(x: typeof b); // ok diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts2.symbols b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts2.symbols index d1f87946de5..a69ddbe5647 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts2.symbols +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts2.symbols @@ -85,7 +85,7 @@ function foo13(x: I); >foo13 : Symbol(foo13, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts2.ts, 23, 25), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts2.ts, 25, 52), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts2.ts, 26, 28)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts2.ts, 25, 15)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts2.ts, 0, 0)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo13(x: typeof a); // ok >foo13 : Symbol(foo13, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts2.ts, 23, 25), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts2.ts, 25, 52), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts2.ts, 26, 28)) @@ -100,7 +100,7 @@ function foo14(x: I); >foo14 : Symbol(foo14, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts2.ts, 27, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts2.ts, 29, 52), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts2.ts, 30, 22)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts2.ts, 29, 15)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts2.ts, 0, 0)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo14(x: I2); // error >foo14 : Symbol(foo14, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts2.ts, 27, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts2.ts, 29, 52), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts2.ts, 30, 22)) @@ -129,7 +129,7 @@ function foo15(x: I); >foo15 : Symbol(foo15, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts2.ts, 35, 27), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts2.ts, 37, 52), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts2.ts, 38, 22)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts2.ts, 37, 15)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts2.ts, 0, 0)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo15(x: I2); // ok >foo15 : Symbol(foo15, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts2.ts, 35, 27), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts2.ts, 37, 52), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts2.ts, 38, 22)) diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterNames.symbols b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterNames.symbols index 94e6aaf0139..851388a4604 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterNames.symbols +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterNames.symbols @@ -5,7 +5,7 @@ class A { >A : Symbol(A, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterNames.ts, 0, 0)) foo(x: T): T { return null; } ->foo : Symbol(foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterNames.ts, 2, 9)) +>foo : Symbol(A.foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterNames.ts, 2, 9)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterNames.ts, 3, 8)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterNames.ts, 3, 11)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterNames.ts, 3, 8)) @@ -17,7 +17,7 @@ class B { >U : Symbol(U, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterNames.ts, 6, 8)) foo(x: U): U { return null; } ->foo : Symbol(foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterNames.ts, 6, 12)) +>foo : Symbol(B.foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterNames.ts, 6, 12)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterNames.ts, 7, 8)) >U : Symbol(U, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterNames.ts, 6, 8)) >U : Symbol(U, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterNames.ts, 6, 8)) @@ -28,7 +28,7 @@ class C { >V : Symbol(V, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterNames.ts, 10, 8)) foo(x: V): V { return null; } ->foo : Symbol(foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterNames.ts, 10, 12)) +>foo : Symbol(C.foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterNames.ts, 10, 12)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterNames.ts, 11, 8)) >V : Symbol(V, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterNames.ts, 10, 8)) >V : Symbol(V, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterNames.ts, 10, 8)) @@ -39,7 +39,7 @@ interface I { >X : Symbol(X, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterNames.ts, 14, 12)) foo(x: X): X; ->foo : Symbol(foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterNames.ts, 14, 16)) +>foo : Symbol(I.foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterNames.ts, 14, 16)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterNames.ts, 15, 8)) >X : Symbol(X, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterNames.ts, 14, 12)) >X : Symbol(X, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterNames.ts, 14, 12)) @@ -49,7 +49,7 @@ interface I2 { >I2 : Symbol(I2, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterNames.ts, 16, 1)) foo(x: Y): Y; ->foo : Symbol(foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterNames.ts, 18, 14)) +>foo : Symbol(I2.foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterNames.ts, 18, 14)) >Y : Symbol(Y, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterNames.ts, 19, 8)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterNames.ts, 19, 11)) >Y : Symbol(Y, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterNames.ts, 19, 8)) diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams.symbols b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams.symbols index 0bb008d82be..9edbcf9e6ad 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams.symbols +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams.symbols @@ -7,7 +7,7 @@ class A { >A : Symbol(A, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams.ts, 0, 0)) foo(x: T, y?: T): T { return null; } ->foo : Symbol(foo, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams.ts, 4, 9)) +>foo : Symbol(A.foo, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams.ts, 4, 9)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams.ts, 5, 8)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams.ts, 5, 11)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams.ts, 5, 8)) @@ -21,7 +21,7 @@ class B { >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams.ts, 8, 8)) foo(x: T, y?: T): T { return null; } ->foo : Symbol(foo, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams.ts, 8, 12)) +>foo : Symbol(B.foo, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams.ts, 8, 12)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams.ts, 9, 8)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams.ts, 8, 8)) >y : Symbol(y, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams.ts, 9, 13)) @@ -34,7 +34,7 @@ class C { >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams.ts, 12, 8)) foo(x: T, y?: T): T { return null; } ->foo : Symbol(foo, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams.ts, 12, 12)) +>foo : Symbol(C.foo, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams.ts, 12, 12)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams.ts, 13, 8)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams.ts, 12, 8)) >y : Symbol(y, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams.ts, 13, 13)) @@ -47,7 +47,7 @@ interface I { >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams.ts, 16, 12)) foo(x: T, y?: T): T; ->foo : Symbol(foo, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams.ts, 16, 16)) +>foo : Symbol(I.foo, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams.ts, 16, 16)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams.ts, 17, 8)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams.ts, 16, 12)) >y : Symbol(y, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams.ts, 17, 13)) @@ -59,7 +59,7 @@ interface I2 { >I2 : Symbol(I2, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams.ts, 18, 1)) foo(x: T, y?: T): T; ->foo : Symbol(foo, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams.ts, 20, 14)) +>foo : Symbol(I2.foo, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams.ts, 20, 14)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams.ts, 21, 8)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams.ts, 21, 11)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams.ts, 21, 8)) diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams2.symbols b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams2.symbols index 8878d73f576..9fcac2f65ed 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams2.symbols +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams2.symbols @@ -7,7 +7,7 @@ class A { >A : Symbol(A, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams2.ts, 0, 0)) foo(x: T, y?: U): T { return null; } ->foo : Symbol(foo, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams2.ts, 4, 9)) +>foo : Symbol(A.foo, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams2.ts, 4, 9)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams2.ts, 5, 8)) >U : Symbol(U, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams2.ts, 5, 10)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams2.ts, 5, 14)) @@ -23,7 +23,7 @@ class B { >U : Symbol(U, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams2.ts, 8, 10)) foo(x: T, y?: U): T { return null; } ->foo : Symbol(foo, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams2.ts, 8, 15)) +>foo : Symbol(B.foo, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams2.ts, 8, 15)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams2.ts, 9, 8)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams2.ts, 8, 8)) >y : Symbol(y, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams2.ts, 9, 13)) @@ -37,7 +37,7 @@ class C { >U : Symbol(U, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams2.ts, 12, 10)) foo(x: T, y?: U): T { return null; } ->foo : Symbol(foo, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams2.ts, 12, 15)) +>foo : Symbol(C.foo, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams2.ts, 12, 15)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams2.ts, 13, 8)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams2.ts, 12, 8)) >y : Symbol(y, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams2.ts, 13, 13)) @@ -51,7 +51,7 @@ interface I { >U : Symbol(U, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams2.ts, 16, 14)) foo(x: T, y?: U): T; ->foo : Symbol(foo, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams2.ts, 16, 19)) +>foo : Symbol(I.foo, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams2.ts, 16, 19)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams2.ts, 17, 8)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams2.ts, 16, 12)) >y : Symbol(y, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams2.ts, 17, 13)) @@ -63,7 +63,7 @@ interface I2 { >I2 : Symbol(I2, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams2.ts, 18, 1)) foo(x: T, y?: U): T; ->foo : Symbol(foo, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams2.ts, 20, 14)) +>foo : Symbol(I2.foo, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams2.ts, 20, 14)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams2.ts, 21, 8)) >U : Symbol(U, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams2.ts, 21, 10)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams2.ts, 21, 14)) diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams3.symbols b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams3.symbols index b1cfab012bf..ff215bfbe58 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams3.symbols +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams3.symbols @@ -7,7 +7,7 @@ class A { >A : Symbol(A, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams3.ts, 0, 0)) foo(x: T, y?: U): T { return null; } ->foo : Symbol(foo, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams3.ts, 4, 9)) +>foo : Symbol(A.foo, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams3.ts, 4, 9)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams3.ts, 5, 8)) >U : Symbol(U, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams3.ts, 5, 10)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams3.ts, 5, 14)) @@ -23,7 +23,7 @@ class B { >U : Symbol(U, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams3.ts, 8, 10)) foo(x: T, y: U): T { return null; } ->foo : Symbol(foo, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams3.ts, 8, 15)) +>foo : Symbol(B.foo, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams3.ts, 8, 15)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams3.ts, 9, 8)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams3.ts, 8, 8)) >y : Symbol(y, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams3.ts, 9, 13)) @@ -37,7 +37,7 @@ class C { >U : Symbol(U, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams3.ts, 12, 10)) foo(x: T, y?: U): T { return null; } ->foo : Symbol(foo, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams3.ts, 12, 15)) +>foo : Symbol(C.foo, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams3.ts, 12, 15)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams3.ts, 13, 8)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams3.ts, 12, 8)) >y : Symbol(y, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams3.ts, 13, 13)) @@ -51,7 +51,7 @@ interface I { >U : Symbol(U, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams3.ts, 16, 14)) foo(x: T, y?: U): T; ->foo : Symbol(foo, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams3.ts, 16, 19)) +>foo : Symbol(I.foo, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams3.ts, 16, 19)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams3.ts, 17, 8)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams3.ts, 16, 12)) >y : Symbol(y, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams3.ts, 17, 13)) @@ -63,7 +63,7 @@ interface I2 { >I2 : Symbol(I2, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams3.ts, 18, 1)) foo(x: T, y: U): T; ->foo : Symbol(foo, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams3.ts, 20, 14)) +>foo : Symbol(I2.foo, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams3.ts, 20, 14)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams3.ts, 21, 8)) >U : Symbol(U, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams3.ts, 21, 10)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesOptionalParams3.ts, 21, 14)) diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.symbols b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.symbols index fb3fba82cb2..c95d5234ac5 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.symbols +++ b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.symbols @@ -16,7 +16,7 @@ class B> { class C { >C : Symbol(C, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 6, 1)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 8, 8)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) constructor(x: T) { return null; } >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 9, 16)) @@ -26,7 +26,7 @@ class C { interface I { >I : Symbol(I, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 10, 1)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 12, 12)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) new(x: T): string; >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 13, 8)) @@ -78,13 +78,13 @@ function foo1c(x: C); >foo1c : Symbol(foo1c, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 25, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 27, 29), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 28, 29)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 27, 15)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 6, 1)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo1c(x: C); // error >foo1c : Symbol(foo1c, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 25, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 27, 29), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 28, 29)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 28, 15)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 6, 1)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo1c(x: any) { } >foo1c : Symbol(foo1c, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 25, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 27, 29), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 28, 29)) @@ -94,13 +94,13 @@ function foo2(x: I); >foo2 : Symbol(foo2, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 29, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 31, 28), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 32, 28)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 31, 14)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 10, 1)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo2(x: I); // error >foo2 : Symbol(foo2, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 29, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 31, 28), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 32, 28)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 32, 14)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 10, 1)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo2(x: any) { } >foo2 : Symbol(foo2, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 29, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 31, 28), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 32, 28)) @@ -144,7 +144,7 @@ function foo8(x: I); // ok >foo8 : Symbol(foo8, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 41, 25), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 43, 35), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 44, 28)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 44, 14)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 10, 1)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo8(x: any) { } >foo8 : Symbol(foo8, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 41, 25), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 43, 35), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 44, 28)) @@ -160,7 +160,7 @@ function foo9(x: C); // error, types are structurally equal >foo9 : Symbol(foo9, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 45, 25), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 47, 35), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 48, 28)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 48, 14)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 6, 1)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo9(x: any) { } >foo9 : Symbol(foo9, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 45, 25), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 47, 35), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 48, 28)) @@ -200,13 +200,13 @@ function foo12(x: I); >foo12 : Symbol(foo12, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 57, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 59, 29), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 60, 29)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 59, 15)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 10, 1)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo12(x: C); // ok >foo12 : Symbol(foo12, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 57, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 59, 29), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 60, 29)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 60, 15)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 6, 1)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo12(x: any) { } >foo12 : Symbol(foo12, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 57, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 59, 29), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 60, 29)) @@ -221,7 +221,7 @@ function foo12b(x: C); // ok >foo12b : Symbol(foo12b, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 61, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 63, 23), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 64, 30)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 64, 16)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 6, 1)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo12b(x: any) { } >foo12b : Symbol(foo12b, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 61, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 63, 23), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 64, 30)) @@ -231,7 +231,7 @@ function foo13(x: I); >foo13 : Symbol(foo13, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 65, 27), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 67, 29), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 68, 28)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 67, 15)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 10, 1)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo13(x: typeof a); // ok >foo13 : Symbol(foo13, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 65, 27), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 67, 29), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 68, 28)) @@ -246,7 +246,7 @@ function foo14(x: I); >foo14 : Symbol(foo14, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 69, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 71, 29), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 72, 28)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 71, 15)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 10, 1)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo14(x: typeof b); // ok >foo14 : Symbol(foo14, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 69, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 71, 29), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 72, 28)) diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.symbols b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.symbols index ce55a114621..8d82f4ea140 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.symbols +++ b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.symbols @@ -22,7 +22,7 @@ class C { >T : Symbol(T, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 8, 8)) >U : Symbol(U, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 8, 20)) >U : Symbol(U, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 8, 20)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) constructor(x: T, y: U) { return null; } >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 9, 16)) @@ -36,7 +36,7 @@ class D { >T : Symbol(T, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 12, 8)) >U : Symbol(U, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 12, 20)) >U : Symbol(U, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 12, 20)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) constructor(x: T, y: U) { return null; } >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 13, 16)) @@ -50,7 +50,7 @@ interface I { >T : Symbol(T, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 16, 12)) >U : Symbol(U, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 16, 24)) >U : Symbol(U, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 16, 24)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) new(x: T, y: U): string; >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 17, 8)) @@ -118,15 +118,15 @@ function foo1c(x: C); >foo1c : Symbol(foo1c, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 29, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 31, 37), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 32, 37)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 31, 15)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 6, 1)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo1c(x: C); // error >foo1c : Symbol(foo1c, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 29, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 31, 37), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 32, 37)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 32, 15)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 6, 1)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo1c(x: any) { } >foo1c : Symbol(foo1c, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 29, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 31, 37), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 32, 37)) @@ -136,15 +136,15 @@ function foo2(x: I); >foo2 : Symbol(foo2, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 33, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 35, 36), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 36, 36)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 35, 14)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 14, 1)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo2(x: I); // error >foo2 : Symbol(foo2, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 33, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 35, 36), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 36, 36)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 36, 14)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 14, 1)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo2(x: any) { } >foo2 : Symbol(foo2, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 33, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 35, 36), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 36, 36)) @@ -182,15 +182,15 @@ function foo5c(x: C); >foo5c : Symbol(foo5c, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 45, 25), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 47, 37), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 48, 37)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 47, 15)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 6, 1)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo5c(x: D); // ok >foo5c : Symbol(foo5c, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 45, 25), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 47, 37), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 48, 37)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 48, 15)) >D : Symbol(D, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 10, 1)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo5c(x: any) { } >foo5c : Symbol(foo5c, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 45, 25), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 47, 37), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 48, 37)) @@ -200,14 +200,14 @@ function foo6c(x: C); >foo6c : Symbol(foo6c, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 49, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 51, 37), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 52, 34)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 51, 15)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 6, 1)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo6c(x: D); // ok >foo6c : Symbol(foo6c, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 49, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 51, 37), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 52, 34)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 52, 15)) >D : Symbol(D, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 10, 1)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo6c(x: any) { } >foo6c : Symbol(foo6c, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 49, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 51, 37), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 52, 34)) @@ -224,8 +224,8 @@ function foo8(x: I); // ok >foo8 : Symbol(foo8, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 53, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 55, 50), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 56, 36)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 56, 14)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 14, 1)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo8(x: any) { } >foo8 : Symbol(foo8, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 53, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 55, 50), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 56, 36)) @@ -242,8 +242,8 @@ function foo9(x: C); // error, types are structurally equal >foo9 : Symbol(foo9, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 57, 25), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 59, 50), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 60, 36)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 60, 14)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 6, 1)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo9(x: any) { } >foo9 : Symbol(foo9, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 57, 25), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 59, 50), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 60, 36)) @@ -285,15 +285,15 @@ function foo12(x: I); >foo12 : Symbol(foo12, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 69, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 71, 37), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 72, 37)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 71, 15)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 14, 1)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo12(x: C); // ok >foo12 : Symbol(foo12, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 69, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 71, 37), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 72, 37)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 72, 15)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 6, 1)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo12(x: any) { } >foo12 : Symbol(foo12, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 69, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 71, 37), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 72, 37)) @@ -308,8 +308,8 @@ function foo12b(x: C); // ok >foo12b : Symbol(foo12b, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 73, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 75, 23), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 76, 38)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 76, 16)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 6, 1)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo12b(x: any) { } >foo12b : Symbol(foo12b, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 73, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 75, 23), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 76, 38)) @@ -319,8 +319,8 @@ function foo13(x: I); >foo13 : Symbol(foo13, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 77, 27), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 79, 37), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 80, 28)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 79, 15)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 14, 1)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo13(x: typeof a); // ok >foo13 : Symbol(foo13, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 77, 27), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 79, 37), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 80, 28)) @@ -335,8 +335,8 @@ function foo14(x: I); >foo14 : Symbol(foo14, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 81, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 83, 37), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 84, 28)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 83, 15)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 14, 1)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo14(x: typeof b); // ok >foo14 : Symbol(foo14, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 81, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 83, 37), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 84, 28)) diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints3.symbols b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints3.symbols index 4d7adc798f9..ffd5363f030 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints3.symbols +++ b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints3.symbols @@ -5,20 +5,20 @@ class One { foo: string } >One : Symbol(One, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints3.ts, 0, 0)) ->foo : Symbol(foo, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints3.ts, 4, 11)) +>foo : Symbol(One.foo, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints3.ts, 4, 11)) class Two { foo: string } >Two : Symbol(Two, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints3.ts, 4, 25)) ->foo : Symbol(foo, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints3.ts, 5, 11)) +>foo : Symbol(Two.foo, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints3.ts, 5, 11)) interface Three { foo: string } >Three : Symbol(Three, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints3.ts, 5, 25)) ->foo : Symbol(foo, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints3.ts, 6, 17)) +>foo : Symbol(Three.foo, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints3.ts, 6, 17)) interface Four { foo: T } >Four : Symbol(Four, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints3.ts, 6, 31)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints3.ts, 7, 15)) ->foo : Symbol(foo, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints3.ts, 7, 19)) +>foo : Symbol(Four.foo, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints3.ts, 7, 19)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints3.ts, 7, 15)) interface Five extends Four { } @@ -33,7 +33,7 @@ interface Six { >U : Symbol(U, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints3.ts, 9, 16)) foo: T; ->foo : Symbol(foo, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints3.ts, 9, 21)) +>foo : Symbol(Six.foo, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints3.ts, 9, 21)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints3.ts, 9, 14)) } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType.symbols b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType.symbols index 422b5820a8b..418ed27a99d 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType.symbols +++ b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType.symbols @@ -28,7 +28,7 @@ interface I { new(x: T): Date; >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType.ts, 13, 8)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType.ts, 12, 12)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) } interface I2 { diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.symbols b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.symbols index e44493e933b..23702ebab68 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.symbols +++ b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.symbols @@ -6,7 +6,7 @@ class B { >B : Symbol(B, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 0, 0)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 4, 8)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) constructor(x: T) { return null; } >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 5, 16)) @@ -16,7 +16,7 @@ class B { class C { >C : Symbol(C, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 6, 1)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 8, 8)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) constructor(x: T) { return null; } >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 9, 16)) @@ -26,12 +26,12 @@ class C { interface I { >I : Symbol(I, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 10, 1)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 12, 12)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) new(x: T): Date; >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 13, 8)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 12, 12)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) } interface I2 { @@ -39,7 +39,7 @@ interface I2 { new(x: T): RegExp; >T : Symbol(T, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 17, 8)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 17, 24)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 17, 8)) >RegExp : Symbol(RegExp, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) @@ -48,7 +48,7 @@ interface I2 { var a: { new(x: T): T } >a : Symbol(a, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 20, 3)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 20, 13)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 20, 29)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 20, 13)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 20, 13)) @@ -57,7 +57,7 @@ var b = { new(x: T) { return null; } }; // not a construct signa >b : Symbol(b, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 21, 3)) >new : Symbol(new, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 21, 9)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 21, 14)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 21, 30)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 21, 14)) @@ -65,13 +65,13 @@ function foo1b(x: B); >foo1b : Symbol(foo1b, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 21, 55), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 23, 27), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 24, 27)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 23, 15)) >B : Symbol(B, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 0, 0)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo1b(x: B); // error >foo1b : Symbol(foo1b, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 21, 55), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 23, 27), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 24, 27)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 24, 15)) >B : Symbol(B, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 0, 0)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo1b(x: any) { } >foo1b : Symbol(foo1b, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 21, 55), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 23, 27), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 24, 27)) @@ -81,13 +81,13 @@ function foo1c(x: C); >foo1c : Symbol(foo1c, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 25, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 27, 27), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 28, 27)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 27, 15)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 6, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo1c(x: C); // error >foo1c : Symbol(foo1c, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 25, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 27, 27), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 28, 27)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 28, 15)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 6, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo1c(x: any) { } >foo1c : Symbol(foo1c, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 25, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 27, 27), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 28, 27)) @@ -97,13 +97,13 @@ function foo2(x: I); >foo2 : Symbol(foo2, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 29, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 31, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 32, 26)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 31, 14)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 10, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo2(x: I); // error >foo2 : Symbol(foo2, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 29, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 31, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 32, 26)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 32, 14)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 10, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo2(x: any) { } >foo2 : Symbol(foo2, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 29, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 31, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 32, 26)) @@ -141,13 +141,13 @@ function foo8(x: B); >foo8 : Symbol(foo8, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 41, 25), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 43, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 44, 26)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 43, 14)) >B : Symbol(B, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 0, 0)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo8(x: I); // ok >foo8 : Symbol(foo8, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 41, 25), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 43, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 44, 26)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 44, 14)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 10, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo8(x: any) { } >foo8 : Symbol(foo8, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 41, 25), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 43, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 44, 26)) @@ -157,13 +157,13 @@ function foo9(x: B); >foo9 : Symbol(foo9, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 45, 25), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 47, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 48, 26)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 47, 14)) >B : Symbol(B, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 0, 0)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo9(x: C); // error since types are structurally equal >foo9 : Symbol(foo9, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 45, 25), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 47, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 48, 26)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 48, 14)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 6, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo9(x: any) { } >foo9 : Symbol(foo9, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 45, 25), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 47, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 48, 26)) @@ -173,7 +173,7 @@ function foo10(x: B); >foo10 : Symbol(foo10, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 49, 25), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 51, 27), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 52, 28)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 51, 15)) >B : Symbol(B, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 0, 0)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo10(x: typeof a); // ok >foo10 : Symbol(foo10, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 49, 25), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 51, 27), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 52, 28)) @@ -188,7 +188,7 @@ function foo11(x: B); >foo11 : Symbol(foo11, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 53, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 55, 27), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 56, 28)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 55, 15)) >B : Symbol(B, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 0, 0)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo11(x: typeof b); // ok >foo11 : Symbol(foo11, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 53, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 55, 27), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 56, 28)) @@ -203,13 +203,13 @@ function foo12(x: I); >foo12 : Symbol(foo12, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 57, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 59, 27), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 60, 27)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 59, 15)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 10, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo12(x: C); // ok >foo12 : Symbol(foo12, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 57, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 59, 27), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 60, 27)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 60, 15)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 6, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo12(x: any) { } >foo12 : Symbol(foo12, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 57, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 59, 27), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 60, 27)) @@ -224,7 +224,7 @@ function foo12b(x: C); // ok >foo12b : Symbol(foo12b, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 61, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 63, 23), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 64, 28)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 64, 16)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 6, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo12b(x: any) { } >foo12b : Symbol(foo12b, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 61, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 63, 23), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 64, 28)) @@ -234,7 +234,7 @@ function foo13(x: I); >foo13 : Symbol(foo13, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 65, 27), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 67, 27), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 68, 28)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 67, 15)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 10, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo13(x: typeof a); // ok >foo13 : Symbol(foo13, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 65, 27), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 67, 27), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 68, 28)) @@ -249,7 +249,7 @@ function foo14(x: I); >foo14 : Symbol(foo14, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 69, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 71, 27), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 72, 28)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 71, 15)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 10, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo14(x: typeof b); // ok >foo14 : Symbol(foo14, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 69, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 71, 27), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 72, 28)) @@ -269,7 +269,7 @@ function foo15(x: C); // ok >foo15 : Symbol(foo15, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 73, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 75, 22), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 76, 27)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 76, 15)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 6, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo15(x: any) { } >foo15 : Symbol(foo15, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 73, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 75, 22), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 76, 27)) diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.symbols b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.symbols index 48f28e40b8a..e03c24b2ce5 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.symbols +++ b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.symbols @@ -159,7 +159,7 @@ function foo8(x: I); // BUG 832086 >foo8 : Symbol(foo8, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts, 39, 25), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts, 41, 36), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts, 42, 51)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts, 42, 14)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts, 8, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo8(x: any) { } >foo8 : Symbol(foo8, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts, 39, 25), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts, 41, 36), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts, 42, 51)) @@ -213,14 +213,14 @@ function foo12(x: I, number, Date, string>); >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts, 57, 15)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts, 8, 1)) >B : Symbol(B, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts, 0, 0)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo12(x: C, number, Date>); // ok >foo12 : Symbol(foo12, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts, 55, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts, 57, 62), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts, 58, 54)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts, 58, 15)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts, 4, 1)) >B : Symbol(B, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts, 0, 0)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo12(x: any) { } >foo12 : Symbol(foo12, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts, 55, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts, 57, 62), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts, 58, 54)) @@ -244,9 +244,9 @@ function foo13(x: I); >foo13 : Symbol(foo13, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts, 63, 27), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts, 65, 49), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts, 66, 28)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts, 65, 15)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts, 8, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >RegExp : Symbol(RegExp, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo13(x: typeof a); // ok >foo13 : Symbol(foo13, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts, 63, 27), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts, 65, 49), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts, 66, 28)) @@ -261,7 +261,7 @@ function foo14(x: I); >foo14 : Symbol(foo14, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts, 67, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts, 69, 52), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts, 70, 28)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts, 69, 15)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts, 8, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >RegExp : Symbol(RegExp, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo14(x: typeof b); // ok diff --git a/tests/baselines/reference/objectTypesIdentityWithNumericIndexers1.types b/tests/baselines/reference/objectTypesIdentityWithNumericIndexers1.types index 2284d06ffbd..c5de5c7b9b4 100644 --- a/tests/baselines/reference/objectTypesIdentityWithNumericIndexers1.types +++ b/tests/baselines/reference/objectTypesIdentityWithNumericIndexers1.types @@ -50,7 +50,7 @@ var a: { var b: { [x: number]: string; } = { foo: '' }; >b : { [x: number]: string; } >x : number ->{ foo: '' } : { [x: number]: undefined; foo: string; } +>{ foo: '' } : { foo: string; } >foo : string >'' : string diff --git a/tests/baselines/reference/objectTypesIdentityWithNumericIndexers2.symbols b/tests/baselines/reference/objectTypesIdentityWithNumericIndexers2.symbols index 375fff858fb..5fde90941ef 100644 --- a/tests/baselines/reference/objectTypesIdentityWithNumericIndexers2.symbols +++ b/tests/baselines/reference/objectTypesIdentityWithNumericIndexers2.symbols @@ -3,12 +3,12 @@ class Base { foo: string; } >Base : Symbol(Base, Decl(objectTypesIdentityWithNumericIndexers2.ts, 0, 0)) ->foo : Symbol(foo, Decl(objectTypesIdentityWithNumericIndexers2.ts, 2, 12)) +>foo : Symbol(Base.foo, Decl(objectTypesIdentityWithNumericIndexers2.ts, 2, 12)) class Derived extends Base { bar: string; } >Derived : Symbol(Derived, Decl(objectTypesIdentityWithNumericIndexers2.ts, 2, 27)) >Base : Symbol(Base, Decl(objectTypesIdentityWithNumericIndexers2.ts, 0, 0)) ->bar : Symbol(bar, Decl(objectTypesIdentityWithNumericIndexers2.ts, 3, 28)) +>bar : Symbol(Derived.bar, Decl(objectTypesIdentityWithNumericIndexers2.ts, 3, 28)) class A { >A : Symbol(A, Decl(objectTypesIdentityWithNumericIndexers2.ts, 3, 43)) diff --git a/tests/baselines/reference/objectTypesIdentityWithNumericIndexers2.types b/tests/baselines/reference/objectTypesIdentityWithNumericIndexers2.types index 1a580297b1b..17fc6a07a00 100644 --- a/tests/baselines/reference/objectTypesIdentityWithNumericIndexers2.types +++ b/tests/baselines/reference/objectTypesIdentityWithNumericIndexers2.types @@ -64,7 +64,7 @@ var b: { [x: number]: Derived; } = { foo: null }; >b : { [x: number]: Derived; } >x : number >Derived : Derived ->{ foo: null } : { [x: number]: undefined; foo: Derived; } +>{ foo: null } : { foo: Derived; } >foo : Derived >null : Derived >Derived : Derived diff --git a/tests/baselines/reference/objectTypesIdentityWithNumericIndexers3.types b/tests/baselines/reference/objectTypesIdentityWithNumericIndexers3.types index ae384bbb4db..99e6b8c8632 100644 --- a/tests/baselines/reference/objectTypesIdentityWithNumericIndexers3.types +++ b/tests/baselines/reference/objectTypesIdentityWithNumericIndexers3.types @@ -50,7 +50,7 @@ var a: { var b: { [x: number]: string; } = { foo: '' }; >b : { [x: number]: string; } >x : number ->{ foo: '' } : { [x: number]: undefined; foo: string; } +>{ foo: '' } : { foo: string; } >foo : string >'' : string diff --git a/tests/baselines/reference/objectTypesIdentityWithOptionality.symbols b/tests/baselines/reference/objectTypesIdentityWithOptionality.symbols index 595295418f5..90a69d7bb7a 100644 --- a/tests/baselines/reference/objectTypesIdentityWithOptionality.symbols +++ b/tests/baselines/reference/objectTypesIdentityWithOptionality.symbols @@ -5,14 +5,14 @@ class A { >A : Symbol(A, Decl(objectTypesIdentityWithOptionality.ts, 0, 0)) foo: string; ->foo : Symbol(foo, Decl(objectTypesIdentityWithOptionality.ts, 2, 9)) +>foo : Symbol(A.foo, Decl(objectTypesIdentityWithOptionality.ts, 2, 9)) } class B { >B : Symbol(B, Decl(objectTypesIdentityWithOptionality.ts, 4, 1)) foo: string; ->foo : Symbol(foo, Decl(objectTypesIdentityWithOptionality.ts, 6, 9)) +>foo : Symbol(B.foo, Decl(objectTypesIdentityWithOptionality.ts, 6, 9)) } class C { @@ -20,7 +20,7 @@ class C { >T : Symbol(T, Decl(objectTypesIdentityWithOptionality.ts, 10, 8)) foo: T; ->foo : Symbol(foo, Decl(objectTypesIdentityWithOptionality.ts, 10, 12)) +>foo : Symbol(C.foo, Decl(objectTypesIdentityWithOptionality.ts, 10, 12)) >T : Symbol(T, Decl(objectTypesIdentityWithOptionality.ts, 10, 8)) } @@ -28,7 +28,7 @@ interface I { >I : Symbol(I, Decl(objectTypesIdentityWithOptionality.ts, 12, 1)) foo?: string; ->foo : Symbol(foo, Decl(objectTypesIdentityWithOptionality.ts, 14, 13)) +>foo : Symbol(I.foo, Decl(objectTypesIdentityWithOptionality.ts, 14, 13)) } var a: { foo?: string; } diff --git a/tests/baselines/reference/objectTypesIdentityWithPrivates.symbols b/tests/baselines/reference/objectTypesIdentityWithPrivates.symbols index d7680f7fb91..c6cd57f9930 100644 --- a/tests/baselines/reference/objectTypesIdentityWithPrivates.symbols +++ b/tests/baselines/reference/objectTypesIdentityWithPrivates.symbols @@ -5,14 +5,14 @@ class A { >A : Symbol(A, Decl(objectTypesIdentityWithPrivates.ts, 0, 0)) private foo: string; ->foo : Symbol(foo, Decl(objectTypesIdentityWithPrivates.ts, 2, 9)) +>foo : Symbol(A.foo, Decl(objectTypesIdentityWithPrivates.ts, 2, 9)) } class B { >B : Symbol(B, Decl(objectTypesIdentityWithPrivates.ts, 4, 1)) private foo: string; ->foo : Symbol(foo, Decl(objectTypesIdentityWithPrivates.ts, 6, 9)) +>foo : Symbol(B.foo, Decl(objectTypesIdentityWithPrivates.ts, 6, 9)) } class C { @@ -20,7 +20,7 @@ class C { >T : Symbol(T, Decl(objectTypesIdentityWithPrivates.ts, 10, 8)) private foo: T; ->foo : Symbol(foo, Decl(objectTypesIdentityWithPrivates.ts, 10, 12)) +>foo : Symbol(C.foo, Decl(objectTypesIdentityWithPrivates.ts, 10, 12)) >T : Symbol(T, Decl(objectTypesIdentityWithPrivates.ts, 10, 8)) } @@ -28,7 +28,7 @@ interface I { >I : Symbol(I, Decl(objectTypesIdentityWithPrivates.ts, 12, 1)) foo: string; ->foo : Symbol(foo, Decl(objectTypesIdentityWithPrivates.ts, 14, 13)) +>foo : Symbol(I.foo, Decl(objectTypesIdentityWithPrivates.ts, 14, 13)) } class PA extends A { diff --git a/tests/baselines/reference/objectTypesIdentityWithPrivates2.symbols b/tests/baselines/reference/objectTypesIdentityWithPrivates2.symbols index 1a33946229e..ddd75660ad8 100644 --- a/tests/baselines/reference/objectTypesIdentityWithPrivates2.symbols +++ b/tests/baselines/reference/objectTypesIdentityWithPrivates2.symbols @@ -6,7 +6,7 @@ class C { >T : Symbol(T, Decl(objectTypesIdentityWithPrivates2.ts, 2, 8)) private foo: T; ->foo : Symbol(foo, Decl(objectTypesIdentityWithPrivates2.ts, 2, 12)) +>foo : Symbol(C.foo, Decl(objectTypesIdentityWithPrivates2.ts, 2, 12)) >T : Symbol(T, Decl(objectTypesIdentityWithPrivates2.ts, 2, 8)) } diff --git a/tests/baselines/reference/objectTypesIdentityWithPrivates3.errors.txt b/tests/baselines/reference/objectTypesIdentityWithPrivates3.errors.txt index 9cbaa730022..2342065605b 100644 --- a/tests/baselines/reference/objectTypesIdentityWithPrivates3.errors.txt +++ b/tests/baselines/reference/objectTypesIdentityWithPrivates3.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithPrivates3.ts(25,1): error TS2352: Neither type 'C3' nor type 'C4' is assignable to the other. +tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithPrivates3.ts(25,1): error TS2352: Type 'C3' cannot be converted to type 'C4'. Property 'y' is missing in type 'C3'. @@ -29,5 +29,5 @@ tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectType var c3: C3; c3; // Should fail (private x originates in the same declaration, but different types) ~~~~~~ -!!! error TS2352: Neither type 'C3' nor type 'C4' is assignable to the other. +!!! error TS2352: Type 'C3' cannot be converted to type 'C4'. !!! error TS2352: Property 'y' is missing in type 'C3'. \ No newline at end of file diff --git a/tests/baselines/reference/objectTypesIdentityWithPublics.symbols b/tests/baselines/reference/objectTypesIdentityWithPublics.symbols index ebfb52e3d2e..794301f6fc3 100644 --- a/tests/baselines/reference/objectTypesIdentityWithPublics.symbols +++ b/tests/baselines/reference/objectTypesIdentityWithPublics.symbols @@ -5,14 +5,14 @@ class A { >A : Symbol(A, Decl(objectTypesIdentityWithPublics.ts, 0, 0)) public foo: string; ->foo : Symbol(foo, Decl(objectTypesIdentityWithPublics.ts, 2, 9)) +>foo : Symbol(A.foo, Decl(objectTypesIdentityWithPublics.ts, 2, 9)) } class B { >B : Symbol(B, Decl(objectTypesIdentityWithPublics.ts, 4, 1)) public foo: string; ->foo : Symbol(foo, Decl(objectTypesIdentityWithPublics.ts, 6, 9)) +>foo : Symbol(B.foo, Decl(objectTypesIdentityWithPublics.ts, 6, 9)) } class C { @@ -20,7 +20,7 @@ class C { >T : Symbol(T, Decl(objectTypesIdentityWithPublics.ts, 10, 8)) public foo: T; ->foo : Symbol(foo, Decl(objectTypesIdentityWithPublics.ts, 10, 12)) +>foo : Symbol(C.foo, Decl(objectTypesIdentityWithPublics.ts, 10, 12)) >T : Symbol(T, Decl(objectTypesIdentityWithPublics.ts, 10, 8)) } @@ -28,7 +28,7 @@ interface I { >I : Symbol(I, Decl(objectTypesIdentityWithPublics.ts, 12, 1)) foo: string; ->foo : Symbol(foo, Decl(objectTypesIdentityWithPublics.ts, 14, 13)) +>foo : Symbol(I.foo, Decl(objectTypesIdentityWithPublics.ts, 14, 13)) } var a: { foo: string; } diff --git a/tests/baselines/reference/objectTypesIdentityWithStringIndexers.types b/tests/baselines/reference/objectTypesIdentityWithStringIndexers.types index a7eeb672504..8393eaf68a0 100644 --- a/tests/baselines/reference/objectTypesIdentityWithStringIndexers.types +++ b/tests/baselines/reference/objectTypesIdentityWithStringIndexers.types @@ -50,7 +50,7 @@ var a: { var b: { [x: string]: string; } = { foo: '' }; >b : { [x: string]: string; } >x : string ->{ foo: '' } : { [x: string]: string; foo: string; } +>{ foo: '' } : { foo: string; } >foo : string >'' : string diff --git a/tests/baselines/reference/objectTypesIdentityWithStringIndexers2.symbols b/tests/baselines/reference/objectTypesIdentityWithStringIndexers2.symbols index 2df0bf01b1d..dd2e561e67d 100644 --- a/tests/baselines/reference/objectTypesIdentityWithStringIndexers2.symbols +++ b/tests/baselines/reference/objectTypesIdentityWithStringIndexers2.symbols @@ -3,12 +3,12 @@ class Base { foo: string; } >Base : Symbol(Base, Decl(objectTypesIdentityWithStringIndexers2.ts, 0, 0)) ->foo : Symbol(foo, Decl(objectTypesIdentityWithStringIndexers2.ts, 2, 12)) +>foo : Symbol(Base.foo, Decl(objectTypesIdentityWithStringIndexers2.ts, 2, 12)) class Derived extends Base { bar: string; } >Derived : Symbol(Derived, Decl(objectTypesIdentityWithStringIndexers2.ts, 2, 27)) >Base : Symbol(Base, Decl(objectTypesIdentityWithStringIndexers2.ts, 0, 0)) ->bar : Symbol(bar, Decl(objectTypesIdentityWithStringIndexers2.ts, 3, 28)) +>bar : Symbol(Derived.bar, Decl(objectTypesIdentityWithStringIndexers2.ts, 3, 28)) class A { >A : Symbol(A, Decl(objectTypesIdentityWithStringIndexers2.ts, 3, 43)) diff --git a/tests/baselines/reference/objectTypesIdentityWithStringIndexers2.types b/tests/baselines/reference/objectTypesIdentityWithStringIndexers2.types index d1394252117..814d0c91814 100644 --- a/tests/baselines/reference/objectTypesIdentityWithStringIndexers2.types +++ b/tests/baselines/reference/objectTypesIdentityWithStringIndexers2.types @@ -64,7 +64,7 @@ var b: { [x: string]: Derived; } = { foo: null }; >b : { [x: string]: Derived; } >x : string >Derived : Derived ->{ foo: null } : { [x: string]: Derived; foo: Derived; } +>{ foo: null } : { foo: Derived; } >foo : Derived >null : Derived >Derived : Derived diff --git a/tests/baselines/reference/objectTypesWithOptionalProperties.errors.txt b/tests/baselines/reference/objectTypesWithOptionalProperties.errors.txt index a2269c29d11..74057195c64 100644 --- a/tests/baselines/reference/objectTypesWithOptionalProperties.errors.txt +++ b/tests/baselines/reference/objectTypesWithOptionalProperties.errors.txt @@ -1,9 +1,7 @@ -tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties.ts(12,6): error TS1112: A class member cannot be declared optional. -tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties.ts(20,6): error TS1112: A class member cannot be declared optional. tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties.ts(24,6): error TS1162: An object member cannot be declared optional. -==== tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties.ts (3 errors) ==== +==== tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties.ts (1 errors) ==== // Basic uses of optional properties var a: { @@ -15,9 +13,7 @@ tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWith } class C { - x?: number; // error - ~ -!!! error TS1112: A class member cannot be declared optional. + x?: number; // ok } interface I2 { @@ -25,9 +21,7 @@ tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWith } class C2 { - x?: T; // error - ~ -!!! error TS1112: A class member cannot be declared optional. + x?: T; // ok } var b = { diff --git a/tests/baselines/reference/objectTypesWithOptionalProperties.js b/tests/baselines/reference/objectTypesWithOptionalProperties.js index 98141c048dd..9b2ada010d9 100644 --- a/tests/baselines/reference/objectTypesWithOptionalProperties.js +++ b/tests/baselines/reference/objectTypesWithOptionalProperties.js @@ -10,7 +10,7 @@ interface I { } class C { - x?: number; // error + x?: number; // ok } interface I2 { @@ -18,7 +18,7 @@ interface I2 { } class C2 { - x?: T; // error + x?: T; // ok } var b = { diff --git a/tests/baselines/reference/operatorsAndIntersectionTypes.js b/tests/baselines/reference/operatorsAndIntersectionTypes.js new file mode 100644 index 00000000000..6f5b3d329d1 --- /dev/null +++ b/tests/baselines/reference/operatorsAndIntersectionTypes.js @@ -0,0 +1,57 @@ +//// [operatorsAndIntersectionTypes.ts] +type Guid = string & { $Guid }; // Tagged string type +type SerialNo = number & { $SerialNo }; // Tagged number type + +function createGuid() { + return "21EC2020-3AEA-4069-A2DD-08002B30309D" as Guid; +} + +function createSerialNo() { + return 12345 as SerialNo; +} + +let map1: { [x: string]: number } = {}; +let guid = createGuid(); +map1[guid] = 123; // Can with tagged string + +let map2: { [x: number]: string } = {}; +let serialNo = createSerialNo(); +map2[serialNo] = "hello"; // Can index with tagged number + +const s1 = "{" + guid + "}"; +const s2 = guid.toLowerCase(); +const s3 = guid + guid; +const s4 = guid + serialNo; +const s5 = serialNo.toPrecision(0); +const n1 = serialNo * 3; +const n2 = serialNo + serialNo; +const b1 = guid === ""; +const b2 = guid === guid; +const b3 = serialNo === 0; +const b4 = serialNo === serialNo; + + +//// [operatorsAndIntersectionTypes.js] +function createGuid() { + return "21EC2020-3AEA-4069-A2DD-08002B30309D"; +} +function createSerialNo() { + return 12345; +} +var map1 = {}; +var guid = createGuid(); +map1[guid] = 123; // Can with tagged string +var map2 = {}; +var serialNo = createSerialNo(); +map2[serialNo] = "hello"; // Can index with tagged number +var s1 = "{" + guid + "}"; +var s2 = guid.toLowerCase(); +var s3 = guid + guid; +var s4 = guid + serialNo; +var s5 = serialNo.toPrecision(0); +var n1 = serialNo * 3; +var n2 = serialNo + serialNo; +var b1 = guid === ""; +var b2 = guid === guid; +var b3 = serialNo === 0; +var b4 = serialNo === serialNo; diff --git a/tests/baselines/reference/operatorsAndIntersectionTypes.symbols b/tests/baselines/reference/operatorsAndIntersectionTypes.symbols new file mode 100644 index 00000000000..7ffc093e4af --- /dev/null +++ b/tests/baselines/reference/operatorsAndIntersectionTypes.symbols @@ -0,0 +1,100 @@ +=== tests/cases/conformance/types/intersection/operatorsAndIntersectionTypes.ts === +type Guid = string & { $Guid }; // Tagged string type +>Guid : Symbol(Guid, Decl(operatorsAndIntersectionTypes.ts, 0, 0)) +>$Guid : Symbol($Guid, Decl(operatorsAndIntersectionTypes.ts, 0, 22)) + +type SerialNo = number & { $SerialNo }; // Tagged number type +>SerialNo : Symbol(SerialNo, Decl(operatorsAndIntersectionTypes.ts, 0, 31)) +>$SerialNo : Symbol($SerialNo, Decl(operatorsAndIntersectionTypes.ts, 1, 26)) + +function createGuid() { +>createGuid : Symbol(createGuid, Decl(operatorsAndIntersectionTypes.ts, 1, 39)) + + return "21EC2020-3AEA-4069-A2DD-08002B30309D" as Guid; +>Guid : Symbol(Guid, Decl(operatorsAndIntersectionTypes.ts, 0, 0)) +} + +function createSerialNo() { +>createSerialNo : Symbol(createSerialNo, Decl(operatorsAndIntersectionTypes.ts, 5, 1)) + + return 12345 as SerialNo; +>SerialNo : Symbol(SerialNo, Decl(operatorsAndIntersectionTypes.ts, 0, 31)) +} + +let map1: { [x: string]: number } = {}; +>map1 : Symbol(map1, Decl(operatorsAndIntersectionTypes.ts, 11, 3)) +>x : Symbol(x, Decl(operatorsAndIntersectionTypes.ts, 11, 13)) + +let guid = createGuid(); +>guid : Symbol(guid, Decl(operatorsAndIntersectionTypes.ts, 12, 3)) +>createGuid : Symbol(createGuid, Decl(operatorsAndIntersectionTypes.ts, 1, 39)) + +map1[guid] = 123; // Can with tagged string +>map1 : Symbol(map1, Decl(operatorsAndIntersectionTypes.ts, 11, 3)) +>guid : Symbol(guid, Decl(operatorsAndIntersectionTypes.ts, 12, 3)) + +let map2: { [x: number]: string } = {}; +>map2 : Symbol(map2, Decl(operatorsAndIntersectionTypes.ts, 15, 3)) +>x : Symbol(x, Decl(operatorsAndIntersectionTypes.ts, 15, 13)) + +let serialNo = createSerialNo(); +>serialNo : Symbol(serialNo, Decl(operatorsAndIntersectionTypes.ts, 16, 3)) +>createSerialNo : Symbol(createSerialNo, Decl(operatorsAndIntersectionTypes.ts, 5, 1)) + +map2[serialNo] = "hello"; // Can index with tagged number +>map2 : Symbol(map2, Decl(operatorsAndIntersectionTypes.ts, 15, 3)) +>serialNo : Symbol(serialNo, Decl(operatorsAndIntersectionTypes.ts, 16, 3)) + +const s1 = "{" + guid + "}"; +>s1 : Symbol(s1, Decl(operatorsAndIntersectionTypes.ts, 19, 5)) +>guid : Symbol(guid, Decl(operatorsAndIntersectionTypes.ts, 12, 3)) + +const s2 = guid.toLowerCase(); +>s2 : Symbol(s2, Decl(operatorsAndIntersectionTypes.ts, 20, 5)) +>guid.toLowerCase : Symbol(String.toLowerCase, Decl(lib.d.ts, --, --)) +>guid : Symbol(guid, Decl(operatorsAndIntersectionTypes.ts, 12, 3)) +>toLowerCase : Symbol(String.toLowerCase, Decl(lib.d.ts, --, --)) + +const s3 = guid + guid; +>s3 : Symbol(s3, Decl(operatorsAndIntersectionTypes.ts, 21, 5)) +>guid : Symbol(guid, Decl(operatorsAndIntersectionTypes.ts, 12, 3)) +>guid : Symbol(guid, Decl(operatorsAndIntersectionTypes.ts, 12, 3)) + +const s4 = guid + serialNo; +>s4 : Symbol(s4, Decl(operatorsAndIntersectionTypes.ts, 22, 5)) +>guid : Symbol(guid, Decl(operatorsAndIntersectionTypes.ts, 12, 3)) +>serialNo : Symbol(serialNo, Decl(operatorsAndIntersectionTypes.ts, 16, 3)) + +const s5 = serialNo.toPrecision(0); +>s5 : Symbol(s5, Decl(operatorsAndIntersectionTypes.ts, 23, 5)) +>serialNo.toPrecision : Symbol(Number.toPrecision, Decl(lib.d.ts, --, --)) +>serialNo : Symbol(serialNo, Decl(operatorsAndIntersectionTypes.ts, 16, 3)) +>toPrecision : Symbol(Number.toPrecision, Decl(lib.d.ts, --, --)) + +const n1 = serialNo * 3; +>n1 : Symbol(n1, Decl(operatorsAndIntersectionTypes.ts, 24, 5)) +>serialNo : Symbol(serialNo, Decl(operatorsAndIntersectionTypes.ts, 16, 3)) + +const n2 = serialNo + serialNo; +>n2 : Symbol(n2, Decl(operatorsAndIntersectionTypes.ts, 25, 5)) +>serialNo : Symbol(serialNo, Decl(operatorsAndIntersectionTypes.ts, 16, 3)) +>serialNo : Symbol(serialNo, Decl(operatorsAndIntersectionTypes.ts, 16, 3)) + +const b1 = guid === ""; +>b1 : Symbol(b1, Decl(operatorsAndIntersectionTypes.ts, 26, 5)) +>guid : Symbol(guid, Decl(operatorsAndIntersectionTypes.ts, 12, 3)) + +const b2 = guid === guid; +>b2 : Symbol(b2, Decl(operatorsAndIntersectionTypes.ts, 27, 5)) +>guid : Symbol(guid, Decl(operatorsAndIntersectionTypes.ts, 12, 3)) +>guid : Symbol(guid, Decl(operatorsAndIntersectionTypes.ts, 12, 3)) + +const b3 = serialNo === 0; +>b3 : Symbol(b3, Decl(operatorsAndIntersectionTypes.ts, 28, 5)) +>serialNo : Symbol(serialNo, Decl(operatorsAndIntersectionTypes.ts, 16, 3)) + +const b4 = serialNo === serialNo; +>b4 : Symbol(b4, Decl(operatorsAndIntersectionTypes.ts, 29, 5)) +>serialNo : Symbol(serialNo, Decl(operatorsAndIntersectionTypes.ts, 16, 3)) +>serialNo : Symbol(serialNo, Decl(operatorsAndIntersectionTypes.ts, 16, 3)) + diff --git a/tests/baselines/reference/operatorsAndIntersectionTypes.types b/tests/baselines/reference/operatorsAndIntersectionTypes.types new file mode 100644 index 00000000000..6b5987d3a69 --- /dev/null +++ b/tests/baselines/reference/operatorsAndIntersectionTypes.types @@ -0,0 +1,132 @@ +=== tests/cases/conformance/types/intersection/operatorsAndIntersectionTypes.ts === +type Guid = string & { $Guid }; // Tagged string type +>Guid : string & { $Guid: any; } +>$Guid : any + +type SerialNo = number & { $SerialNo }; // Tagged number type +>SerialNo : number & { $SerialNo: any; } +>$SerialNo : any + +function createGuid() { +>createGuid : () => string & { $Guid: any; } + + return "21EC2020-3AEA-4069-A2DD-08002B30309D" as Guid; +>"21EC2020-3AEA-4069-A2DD-08002B30309D" as Guid : string & { $Guid: any; } +>"21EC2020-3AEA-4069-A2DD-08002B30309D" : string +>Guid : string & { $Guid: any; } +} + +function createSerialNo() { +>createSerialNo : () => number & { $SerialNo: any; } + + return 12345 as SerialNo; +>12345 as SerialNo : number & { $SerialNo: any; } +>12345 : number +>SerialNo : number & { $SerialNo: any; } +} + +let map1: { [x: string]: number } = {}; +>map1 : { [x: string]: number; } +>x : string +>{} : {} + +let guid = createGuid(); +>guid : string & { $Guid: any; } +>createGuid() : string & { $Guid: any; } +>createGuid : () => string & { $Guid: any; } + +map1[guid] = 123; // Can with tagged string +>map1[guid] = 123 : number +>map1[guid] : number +>map1 : { [x: string]: number; } +>guid : string & { $Guid: any; } +>123 : number + +let map2: { [x: number]: string } = {}; +>map2 : { [x: number]: string; } +>x : number +>{} : {} + +let serialNo = createSerialNo(); +>serialNo : number & { $SerialNo: any; } +>createSerialNo() : number & { $SerialNo: any; } +>createSerialNo : () => number & { $SerialNo: any; } + +map2[serialNo] = "hello"; // Can index with tagged number +>map2[serialNo] = "hello" : string +>map2[serialNo] : string +>map2 : { [x: number]: string; } +>serialNo : number & { $SerialNo: any; } +>"hello" : string + +const s1 = "{" + guid + "}"; +>s1 : string +>"{" + guid + "}" : string +>"{" + guid : string +>"{" : string +>guid : string & { $Guid: any; } +>"}" : string + +const s2 = guid.toLowerCase(); +>s2 : string +>guid.toLowerCase() : string +>guid.toLowerCase : () => string +>guid : string & { $Guid: any; } +>toLowerCase : () => string + +const s3 = guid + guid; +>s3 : string +>guid + guid : string +>guid : string & { $Guid: any; } +>guid : string & { $Guid: any; } + +const s4 = guid + serialNo; +>s4 : string +>guid + serialNo : string +>guid : string & { $Guid: any; } +>serialNo : number & { $SerialNo: any; } + +const s5 = serialNo.toPrecision(0); +>s5 : string +>serialNo.toPrecision(0) : string +>serialNo.toPrecision : (precision?: number) => string +>serialNo : number & { $SerialNo: any; } +>toPrecision : (precision?: number) => string +>0 : number + +const n1 = serialNo * 3; +>n1 : number +>serialNo * 3 : number +>serialNo : number & { $SerialNo: any; } +>3 : number + +const n2 = serialNo + serialNo; +>n2 : number +>serialNo + serialNo : number +>serialNo : number & { $SerialNo: any; } +>serialNo : number & { $SerialNo: any; } + +const b1 = guid === ""; +>b1 : boolean +>guid === "" : boolean +>guid : string & { $Guid: any; } +>"" : string + +const b2 = guid === guid; +>b2 : boolean +>guid === guid : boolean +>guid : string & { $Guid: any; } +>guid : string & { $Guid: any; } + +const b3 = serialNo === 0; +>b3 : boolean +>serialNo === 0 : boolean +>serialNo : number & { $SerialNo: any; } +>0 : number + +const b4 = serialNo === serialNo; +>b4 : boolean +>serialNo === serialNo : boolean +>serialNo : number & { $SerialNo: any; } +>serialNo : number & { $SerialNo: any; } + diff --git a/tests/baselines/reference/optionalAccessorsInInterface1.symbols b/tests/baselines/reference/optionalAccessorsInInterface1.symbols index 6c9c8ab1429..905aefa02ba 100644 --- a/tests/baselines/reference/optionalAccessorsInInterface1.symbols +++ b/tests/baselines/reference/optionalAccessorsInInterface1.symbols @@ -3,10 +3,10 @@ interface MyPropertyDescriptor { >MyPropertyDescriptor : Symbol(MyPropertyDescriptor, Decl(optionalAccessorsInInterface1.ts, 0, 0)) get? (): any; ->get : Symbol(get, Decl(optionalAccessorsInInterface1.ts, 0, 32)) +>get : Symbol(MyPropertyDescriptor.get, Decl(optionalAccessorsInInterface1.ts, 0, 32)) set? (v: any): void; ->set : Symbol(set, Decl(optionalAccessorsInInterface1.ts, 1, 17)) +>set : Symbol(MyPropertyDescriptor.set, Decl(optionalAccessorsInInterface1.ts, 1, 17)) >v : Symbol(v, Decl(optionalAccessorsInInterface1.ts, 2, 10)) } @@ -25,10 +25,10 @@ interface MyPropertyDescriptor2 { >MyPropertyDescriptor2 : Symbol(MyPropertyDescriptor2, Decl(optionalAccessorsInInterface1.ts, 6, 65)) get?: () => any; ->get : Symbol(get, Decl(optionalAccessorsInInterface1.ts, 8, 33)) +>get : Symbol(MyPropertyDescriptor2.get, Decl(optionalAccessorsInInterface1.ts, 8, 33)) set?: (v: any) => void; ->set : Symbol(set, Decl(optionalAccessorsInInterface1.ts, 9, 20)) +>set : Symbol(MyPropertyDescriptor2.set, Decl(optionalAccessorsInInterface1.ts, 9, 20)) >v : Symbol(v, Decl(optionalAccessorsInInterface1.ts, 10, 11)) } diff --git a/tests/baselines/reference/optionalConstructorArgInSuper.symbols b/tests/baselines/reference/optionalConstructorArgInSuper.symbols index a912d8f62e3..000032d1757 100644 --- a/tests/baselines/reference/optionalConstructorArgInSuper.symbols +++ b/tests/baselines/reference/optionalConstructorArgInSuper.symbols @@ -6,7 +6,7 @@ class Base { >opt : Symbol(opt, Decl(optionalConstructorArgInSuper.ts, 1, 16)) foo(other?) { } ->foo : Symbol(foo, Decl(optionalConstructorArgInSuper.ts, 1, 25)) +>foo : Symbol(Base.foo, Decl(optionalConstructorArgInSuper.ts, 1, 25)) >other : Symbol(other, Decl(optionalConstructorArgInSuper.ts, 2, 8)) } class Derived extends Base { diff --git a/tests/baselines/reference/optionalFunctionArgAssignability.errors.txt b/tests/baselines/reference/optionalFunctionArgAssignability.errors.txt index 52fb45e40d2..024c5c1ea2b 100644 --- a/tests/baselines/reference/optionalFunctionArgAssignability.errors.txt +++ b/tests/baselines/reference/optionalFunctionArgAssignability.errors.txt @@ -1,6 +1,6 @@ tests/cases/compiler/optionalFunctionArgAssignability.ts(7,1): error TS2322: Type '(onFulFill?: (value: number) => U, onReject?: (reason: any) => U) => Promise' is not assignable to type '(onFulfill?: (value: string) => U, onReject?: (reason: any) => U) => Promise'. Types of parameters 'onFulFill' and 'onFulfill' are incompatible. - Type '(value: number) => any' is not assignable to type '(value: string) => any'. + Type '(value: string) => any' is not assignable to type '(value: number) => any'. Types of parameters 'value' and 'value' are incompatible. Type 'number' is not assignable to type 'string'. @@ -16,7 +16,7 @@ tests/cases/compiler/optionalFunctionArgAssignability.ts(7,1): error TS2322: Typ ~ !!! error TS2322: Type '(onFulFill?: (value: number) => U, onReject?: (reason: any) => U) => Promise' is not assignable to type '(onFulfill?: (value: string) => U, onReject?: (reason: any) => U) => Promise'. !!! error TS2322: Types of parameters 'onFulFill' and 'onFulfill' are incompatible. -!!! error TS2322: Type '(value: number) => any' is not assignable to type '(value: string) => any'. +!!! error TS2322: Type '(value: string) => any' is not assignable to type '(value: number) => any'. !!! error TS2322: Types of parameters 'value' and 'value' are incompatible. !!! error TS2322: Type 'number' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/optionalMethods.js b/tests/baselines/reference/optionalMethods.js new file mode 100644 index 00000000000..42decf512e4 --- /dev/null +++ b/tests/baselines/reference/optionalMethods.js @@ -0,0 +1,147 @@ +//// [optionalMethods.ts] + +interface Foo { + a: number; + b?: number; + f(): number; + g?(): number; +} + +function test1(x: Foo) { + x.a; + x.b; + x.f; + x.g; + let f1 = x.f(); + let g1 = x.g && x.g(); + let g2 = x.g ? x.g() : 0; +} + +class Bar { + a: number; + b?: number; + c? = 2; + constructor(public d?: number, public e = 10) {} + f() { + return 1; + } + g?(): number; // Body of optional method can be omitted + h?() { + return 2; + } +} + +function test2(x: Bar) { + x.a; + x.b; + x.c; + x.d; + x.e; + x.f; + x.g; + let f1 = x.f(); + let g1 = x.g && x.g(); + let g2 = x.g ? x.g() : 0; + let h1 = x.h && x.h(); + let h2 = x.h ? x.h() : 0; +} + +class Base { + a?: number; + f?(): number; +} + +class Derived extends Base { + a = 1; + f(): number { return 1; } +} + + +//// [optionalMethods.js] +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +function test1(x) { + x.a; + x.b; + x.f; + x.g; + var f1 = x.f(); + var g1 = x.g && x.g(); + var g2 = x.g ? x.g() : 0; +} +var Bar = (function () { + function Bar(d, e) { + if (e === void 0) { e = 10; } + this.d = d; + this.e = e; + this.c = 2; + } + Bar.prototype.f = function () { + return 1; + }; + Bar.prototype.h = function () { + return 2; + }; + return Bar; +}()); +function test2(x) { + x.a; + x.b; + x.c; + x.d; + x.e; + x.f; + x.g; + var f1 = x.f(); + var g1 = x.g && x.g(); + var g2 = x.g ? x.g() : 0; + var h1 = x.h && x.h(); + var h2 = x.h ? x.h() : 0; +} +var Base = (function () { + function Base() { + } + return Base; +}()); +var Derived = (function (_super) { + __extends(Derived, _super); + function Derived() { + _super.apply(this, arguments); + this.a = 1; + } + Derived.prototype.f = function () { return 1; }; + return Derived; +}(Base)); + + +//// [optionalMethods.d.ts] +interface Foo { + a: number; + b?: number; + f(): number; + g?(): number; +} +declare function test1(x: Foo): void; +declare class Bar { + d?: number; + e: number; + a: number; + b?: number; + c?: number | undefined; + constructor(d?: number, e?: number); + f(): number; + g?(): number; + h?(): number; +} +declare function test2(x: Bar): void; +declare class Base { + a?: number; + f?(): number; +} +declare class Derived extends Base { + a: number; + f(): number; +} diff --git a/tests/baselines/reference/optionalMethods.symbols b/tests/baselines/reference/optionalMethods.symbols new file mode 100644 index 00000000000..55c5ec958da --- /dev/null +++ b/tests/baselines/reference/optionalMethods.symbols @@ -0,0 +1,203 @@ +=== tests/cases/conformance/types/namedTypes/optionalMethods.ts === + +interface Foo { +>Foo : Symbol(Foo, Decl(optionalMethods.ts, 0, 0)) + + a: number; +>a : Symbol(Foo.a, Decl(optionalMethods.ts, 1, 15)) + + b?: number; +>b : Symbol(Foo.b, Decl(optionalMethods.ts, 2, 14)) + + f(): number; +>f : Symbol(Foo.f, Decl(optionalMethods.ts, 3, 15)) + + g?(): number; +>g : Symbol(Foo.g, Decl(optionalMethods.ts, 4, 16)) +} + +function test1(x: Foo) { +>test1 : Symbol(test1, Decl(optionalMethods.ts, 6, 1)) +>x : Symbol(x, Decl(optionalMethods.ts, 8, 15)) +>Foo : Symbol(Foo, Decl(optionalMethods.ts, 0, 0)) + + x.a; +>x.a : Symbol(Foo.a, Decl(optionalMethods.ts, 1, 15)) +>x : Symbol(x, Decl(optionalMethods.ts, 8, 15)) +>a : Symbol(Foo.a, Decl(optionalMethods.ts, 1, 15)) + + x.b; +>x.b : Symbol(Foo.b, Decl(optionalMethods.ts, 2, 14)) +>x : Symbol(x, Decl(optionalMethods.ts, 8, 15)) +>b : Symbol(Foo.b, Decl(optionalMethods.ts, 2, 14)) + + x.f; +>x.f : Symbol(Foo.f, Decl(optionalMethods.ts, 3, 15)) +>x : Symbol(x, Decl(optionalMethods.ts, 8, 15)) +>f : Symbol(Foo.f, Decl(optionalMethods.ts, 3, 15)) + + x.g; +>x.g : Symbol(Foo.g, Decl(optionalMethods.ts, 4, 16)) +>x : Symbol(x, Decl(optionalMethods.ts, 8, 15)) +>g : Symbol(Foo.g, Decl(optionalMethods.ts, 4, 16)) + + let f1 = x.f(); +>f1 : Symbol(f1, Decl(optionalMethods.ts, 13, 7)) +>x.f : Symbol(Foo.f, Decl(optionalMethods.ts, 3, 15)) +>x : Symbol(x, Decl(optionalMethods.ts, 8, 15)) +>f : Symbol(Foo.f, Decl(optionalMethods.ts, 3, 15)) + + let g1 = x.g && x.g(); +>g1 : Symbol(g1, Decl(optionalMethods.ts, 14, 7)) +>x.g : Symbol(Foo.g, Decl(optionalMethods.ts, 4, 16)) +>x : Symbol(x, Decl(optionalMethods.ts, 8, 15)) +>g : Symbol(Foo.g, Decl(optionalMethods.ts, 4, 16)) +>x.g : Symbol(Foo.g, Decl(optionalMethods.ts, 4, 16)) +>x : Symbol(x, Decl(optionalMethods.ts, 8, 15)) +>g : Symbol(Foo.g, Decl(optionalMethods.ts, 4, 16)) + + let g2 = x.g ? x.g() : 0; +>g2 : Symbol(g2, Decl(optionalMethods.ts, 15, 7)) +>x.g : Symbol(Foo.g, Decl(optionalMethods.ts, 4, 16)) +>x : Symbol(x, Decl(optionalMethods.ts, 8, 15)) +>g : Symbol(Foo.g, Decl(optionalMethods.ts, 4, 16)) +>x.g : Symbol(Foo.g, Decl(optionalMethods.ts, 4, 16)) +>x : Symbol(x, Decl(optionalMethods.ts, 8, 15)) +>g : Symbol(Foo.g, Decl(optionalMethods.ts, 4, 16)) +} + +class Bar { +>Bar : Symbol(Bar, Decl(optionalMethods.ts, 16, 1)) + + a: number; +>a : Symbol(Bar.a, Decl(optionalMethods.ts, 18, 11)) + + b?: number; +>b : Symbol(Bar.b, Decl(optionalMethods.ts, 19, 14)) + + c? = 2; +>c : Symbol(Bar.c, Decl(optionalMethods.ts, 20, 15)) + + constructor(public d?: number, public e = 10) {} +>d : Symbol(Bar.d, Decl(optionalMethods.ts, 22, 16)) +>e : Symbol(Bar.e, Decl(optionalMethods.ts, 22, 34)) + + f() { +>f : Symbol(Bar.f, Decl(optionalMethods.ts, 22, 52)) + + return 1; + } + g?(): number; // Body of optional method can be omitted +>g : Symbol(Bar.g, Decl(optionalMethods.ts, 25, 5)) + + h?() { +>h : Symbol(Bar.h, Decl(optionalMethods.ts, 26, 17)) + + return 2; + } +} + +function test2(x: Bar) { +>test2 : Symbol(test2, Decl(optionalMethods.ts, 30, 1)) +>x : Symbol(x, Decl(optionalMethods.ts, 32, 15)) +>Bar : Symbol(Bar, Decl(optionalMethods.ts, 16, 1)) + + x.a; +>x.a : Symbol(Bar.a, Decl(optionalMethods.ts, 18, 11)) +>x : Symbol(x, Decl(optionalMethods.ts, 32, 15)) +>a : Symbol(Bar.a, Decl(optionalMethods.ts, 18, 11)) + + x.b; +>x.b : Symbol(Bar.b, Decl(optionalMethods.ts, 19, 14)) +>x : Symbol(x, Decl(optionalMethods.ts, 32, 15)) +>b : Symbol(Bar.b, Decl(optionalMethods.ts, 19, 14)) + + x.c; +>x.c : Symbol(Bar.c, Decl(optionalMethods.ts, 20, 15)) +>x : Symbol(x, Decl(optionalMethods.ts, 32, 15)) +>c : Symbol(Bar.c, Decl(optionalMethods.ts, 20, 15)) + + x.d; +>x.d : Symbol(Bar.d, Decl(optionalMethods.ts, 22, 16)) +>x : Symbol(x, Decl(optionalMethods.ts, 32, 15)) +>d : Symbol(Bar.d, Decl(optionalMethods.ts, 22, 16)) + + x.e; +>x.e : Symbol(Bar.e, Decl(optionalMethods.ts, 22, 34)) +>x : Symbol(x, Decl(optionalMethods.ts, 32, 15)) +>e : Symbol(Bar.e, Decl(optionalMethods.ts, 22, 34)) + + x.f; +>x.f : Symbol(Bar.f, Decl(optionalMethods.ts, 22, 52)) +>x : Symbol(x, Decl(optionalMethods.ts, 32, 15)) +>f : Symbol(Bar.f, Decl(optionalMethods.ts, 22, 52)) + + x.g; +>x.g : Symbol(Bar.g, Decl(optionalMethods.ts, 25, 5)) +>x : Symbol(x, Decl(optionalMethods.ts, 32, 15)) +>g : Symbol(Bar.g, Decl(optionalMethods.ts, 25, 5)) + + let f1 = x.f(); +>f1 : Symbol(f1, Decl(optionalMethods.ts, 40, 7)) +>x.f : Symbol(Bar.f, Decl(optionalMethods.ts, 22, 52)) +>x : Symbol(x, Decl(optionalMethods.ts, 32, 15)) +>f : Symbol(Bar.f, Decl(optionalMethods.ts, 22, 52)) + + let g1 = x.g && x.g(); +>g1 : Symbol(g1, Decl(optionalMethods.ts, 41, 7)) +>x.g : Symbol(Bar.g, Decl(optionalMethods.ts, 25, 5)) +>x : Symbol(x, Decl(optionalMethods.ts, 32, 15)) +>g : Symbol(Bar.g, Decl(optionalMethods.ts, 25, 5)) +>x.g : Symbol(Bar.g, Decl(optionalMethods.ts, 25, 5)) +>x : Symbol(x, Decl(optionalMethods.ts, 32, 15)) +>g : Symbol(Bar.g, Decl(optionalMethods.ts, 25, 5)) + + let g2 = x.g ? x.g() : 0; +>g2 : Symbol(g2, Decl(optionalMethods.ts, 42, 7)) +>x.g : Symbol(Bar.g, Decl(optionalMethods.ts, 25, 5)) +>x : Symbol(x, Decl(optionalMethods.ts, 32, 15)) +>g : Symbol(Bar.g, Decl(optionalMethods.ts, 25, 5)) +>x.g : Symbol(Bar.g, Decl(optionalMethods.ts, 25, 5)) +>x : Symbol(x, Decl(optionalMethods.ts, 32, 15)) +>g : Symbol(Bar.g, Decl(optionalMethods.ts, 25, 5)) + + let h1 = x.h && x.h(); +>h1 : Symbol(h1, Decl(optionalMethods.ts, 43, 7)) +>x.h : Symbol(Bar.h, Decl(optionalMethods.ts, 26, 17)) +>x : Symbol(x, Decl(optionalMethods.ts, 32, 15)) +>h : Symbol(Bar.h, Decl(optionalMethods.ts, 26, 17)) +>x.h : Symbol(Bar.h, Decl(optionalMethods.ts, 26, 17)) +>x : Symbol(x, Decl(optionalMethods.ts, 32, 15)) +>h : Symbol(Bar.h, Decl(optionalMethods.ts, 26, 17)) + + let h2 = x.h ? x.h() : 0; +>h2 : Symbol(h2, Decl(optionalMethods.ts, 44, 7)) +>x.h : Symbol(Bar.h, Decl(optionalMethods.ts, 26, 17)) +>x : Symbol(x, Decl(optionalMethods.ts, 32, 15)) +>h : Symbol(Bar.h, Decl(optionalMethods.ts, 26, 17)) +>x.h : Symbol(Bar.h, Decl(optionalMethods.ts, 26, 17)) +>x : Symbol(x, Decl(optionalMethods.ts, 32, 15)) +>h : Symbol(Bar.h, Decl(optionalMethods.ts, 26, 17)) +} + +class Base { +>Base : Symbol(Base, Decl(optionalMethods.ts, 45, 1)) + + a?: number; +>a : Symbol(Base.a, Decl(optionalMethods.ts, 47, 12)) + + f?(): number; +>f : Symbol(Base.f, Decl(optionalMethods.ts, 48, 15)) +} + +class Derived extends Base { +>Derived : Symbol(Derived, Decl(optionalMethods.ts, 50, 1)) +>Base : Symbol(Base, Decl(optionalMethods.ts, 45, 1)) + + a = 1; +>a : Symbol(Derived.a, Decl(optionalMethods.ts, 52, 28)) + + f(): number { return 1; } +>f : Symbol(Derived.f, Decl(optionalMethods.ts, 53, 10)) +} + diff --git a/tests/baselines/reference/optionalMethods.types b/tests/baselines/reference/optionalMethods.types new file mode 100644 index 00000000000..70fda27c012 --- /dev/null +++ b/tests/baselines/reference/optionalMethods.types @@ -0,0 +1,226 @@ +=== tests/cases/conformance/types/namedTypes/optionalMethods.ts === + +interface Foo { +>Foo : Foo + + a: number; +>a : number + + b?: number; +>b : number | undefined + + f(): number; +>f : () => number + + g?(): number; +>g : (() => number) | undefined +} + +function test1(x: Foo) { +>test1 : (x: Foo) => void +>x : Foo +>Foo : Foo + + x.a; +>x.a : number +>x : Foo +>a : number + + x.b; +>x.b : number | undefined +>x : Foo +>b : number | undefined + + x.f; +>x.f : () => number +>x : Foo +>f : () => number + + x.g; +>x.g : (() => number) | undefined +>x : Foo +>g : (() => number) | undefined + + let f1 = x.f(); +>f1 : number +>x.f() : number +>x.f : () => number +>x : Foo +>f : () => number + + let g1 = x.g && x.g(); +>g1 : number | undefined +>x.g && x.g() : number | undefined +>x.g : (() => number) | undefined +>x : Foo +>g : (() => number) | undefined +>x.g() : number +>x.g : () => number +>x : Foo +>g : () => number + + let g2 = x.g ? x.g() : 0; +>g2 : number +>x.g ? x.g() : 0 : number +>x.g : (() => number) | undefined +>x : Foo +>g : (() => number) | undefined +>x.g() : number +>x.g : () => number +>x : Foo +>g : () => number +>0 : number +} + +class Bar { +>Bar : Bar + + a: number; +>a : number + + b?: number; +>b : number | undefined + + c? = 2; +>c : number | undefined +>2 : number + + constructor(public d?: number, public e = 10) {} +>d : number | undefined +>e : number +>10 : number + + f() { +>f : () => number + + return 1; +>1 : number + } + g?(): number; // Body of optional method can be omitted +>g : (() => number) | undefined + + h?() { +>h : (() => number) | undefined + + return 2; +>2 : number + } +} + +function test2(x: Bar) { +>test2 : (x: Bar) => void +>x : Bar +>Bar : Bar + + x.a; +>x.a : number +>x : Bar +>a : number + + x.b; +>x.b : number | undefined +>x : Bar +>b : number | undefined + + x.c; +>x.c : number | undefined +>x : Bar +>c : number | undefined + + x.d; +>x.d : number | undefined +>x : Bar +>d : number | undefined + + x.e; +>x.e : number +>x : Bar +>e : number + + x.f; +>x.f : () => number +>x : Bar +>f : () => number + + x.g; +>x.g : (() => number) | undefined +>x : Bar +>g : (() => number) | undefined + + let f1 = x.f(); +>f1 : number +>x.f() : number +>x.f : () => number +>x : Bar +>f : () => number + + let g1 = x.g && x.g(); +>g1 : number | undefined +>x.g && x.g() : number | undefined +>x.g : (() => number) | undefined +>x : Bar +>g : (() => number) | undefined +>x.g() : number +>x.g : () => number +>x : Bar +>g : () => number + + let g2 = x.g ? x.g() : 0; +>g2 : number +>x.g ? x.g() : 0 : number +>x.g : (() => number) | undefined +>x : Bar +>g : (() => number) | undefined +>x.g() : number +>x.g : () => number +>x : Bar +>g : () => number +>0 : number + + let h1 = x.h && x.h(); +>h1 : number | undefined +>x.h && x.h() : number | undefined +>x.h : (() => number) | undefined +>x : Bar +>h : (() => number) | undefined +>x.h() : number +>x.h : () => number +>x : Bar +>h : () => number + + let h2 = x.h ? x.h() : 0; +>h2 : number +>x.h ? x.h() : 0 : number +>x.h : (() => number) | undefined +>x : Bar +>h : (() => number) | undefined +>x.h() : number +>x.h : () => number +>x : Bar +>h : () => number +>0 : number +} + +class Base { +>Base : Base + + a?: number; +>a : number | undefined + + f?(): number; +>f : (() => number) | undefined +} + +class Derived extends Base { +>Derived : Derived +>Base : Base + + a = 1; +>a : number +>1 : number + + f(): number { return 1; } +>f : () => number +>1 : number +} + diff --git a/tests/baselines/reference/optionalParamAssignmentCompat.errors.txt b/tests/baselines/reference/optionalParamAssignmentCompat.errors.txt index de02509d124..5ab492540ac 100644 --- a/tests/baselines/reference/optionalParamAssignmentCompat.errors.txt +++ b/tests/baselines/reference/optionalParamAssignmentCompat.errors.txt @@ -1,6 +1,6 @@ tests/cases/compiler/optionalParamAssignmentCompat.ts(10,5): error TS2322: Type '(p1?: string) => I1' is not assignable to type 'I1'. Types of parameters 'p1' and 'p1' are incompatible. - Type 'string' is not assignable to type 'number'. + Type 'number' is not assignable to type 'string'. ==== tests/cases/compiler/optionalParamAssignmentCompat.ts (1 errors) ==== @@ -17,5 +17,5 @@ tests/cases/compiler/optionalParamAssignmentCompat.ts(10,5): error TS2322: Type ~ !!! error TS2322: Type '(p1?: string) => I1' is not assignable to type 'I1'. !!! error TS2322: Types of parameters 'p1' and 'p1' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/optionalParamInOverride.symbols b/tests/baselines/reference/optionalParamInOverride.symbols index b15802b7294..0d33d6c8d06 100644 --- a/tests/baselines/reference/optionalParamInOverride.symbols +++ b/tests/baselines/reference/optionalParamInOverride.symbols @@ -3,14 +3,14 @@ class Z { >Z : Symbol(Z, Decl(optionalParamInOverride.ts, 0, 0)) public func(): void { } ->func : Symbol(func, Decl(optionalParamInOverride.ts, 0, 9)) +>func : Symbol(Z.func, Decl(optionalParamInOverride.ts, 0, 9)) } class Y extends Z { >Y : Symbol(Y, Decl(optionalParamInOverride.ts, 2, 1)) >Z : Symbol(Z, Decl(optionalParamInOverride.ts, 0, 0)) public func(value?: any): void { } ->func : Symbol(func, Decl(optionalParamInOverride.ts, 3, 19)) +>func : Symbol(Y.func, Decl(optionalParamInOverride.ts, 3, 19)) >value : Symbol(value, Decl(optionalParamInOverride.ts, 4, 16)) } diff --git a/tests/baselines/reference/optionalParamTypeComparison.errors.txt b/tests/baselines/reference/optionalParamTypeComparison.errors.txt index 98a07570c65..287c1123211 100644 --- a/tests/baselines/reference/optionalParamTypeComparison.errors.txt +++ b/tests/baselines/reference/optionalParamTypeComparison.errors.txt @@ -1,9 +1,9 @@ tests/cases/compiler/optionalParamTypeComparison.ts(4,1): error TS2322: Type '(s: string, b?: boolean) => void' is not assignable to type '(s: string, n?: number) => void'. Types of parameters 'b' and 'n' are incompatible. - Type 'boolean' is not assignable to type 'number'. + Type 'number' is not assignable to type 'boolean'. tests/cases/compiler/optionalParamTypeComparison.ts(5,1): error TS2322: Type '(s: string, n?: number) => void' is not assignable to type '(s: string, b?: boolean) => void'. Types of parameters 'n' and 'b' are incompatible. - Type 'number' is not assignable to type 'boolean'. + Type 'boolean' is not assignable to type 'number'. ==== tests/cases/compiler/optionalParamTypeComparison.ts (2 errors) ==== @@ -14,9 +14,9 @@ tests/cases/compiler/optionalParamTypeComparison.ts(5,1): error TS2322: Type '(s ~ !!! error TS2322: Type '(s: string, b?: boolean) => void' is not assignable to type '(s: string, n?: number) => void'. !!! error TS2322: Types of parameters 'b' and 'n' are incompatible. -!!! error TS2322: Type 'boolean' is not assignable to type 'number'. +!!! error TS2322: Type 'number' is not assignable to type 'boolean'. g = f; ~ !!! error TS2322: Type '(s: string, n?: number) => void' is not assignable to type '(s: string, b?: boolean) => void'. !!! error TS2322: Types of parameters 'n' and 'b' are incompatible. -!!! error TS2322: Type 'number' is not assignable to type 'boolean'. \ No newline at end of file +!!! error TS2322: Type 'boolean' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/out-flag.symbols b/tests/baselines/reference/out-flag.symbols index 8f7e559b8fa..2a6a1775dd7 100644 --- a/tests/baselines/reference/out-flag.symbols +++ b/tests/baselines/reference/out-flag.symbols @@ -7,13 +7,13 @@ class MyClass { // my function comments public Count(): number ->Count : Symbol(Count, Decl(out-flag.ts, 4, 1)) +>Count : Symbol(MyClass.Count, Decl(out-flag.ts, 4, 1)) { return 42; } public SetCount(value: number) ->SetCount : Symbol(SetCount, Decl(out-flag.ts, 9, 5)) +>SetCount : Symbol(MyClass.SetCount, Decl(out-flag.ts, 9, 5)) >value : Symbol(value, Decl(out-flag.ts, 11, 20)) { // diff --git a/tests/baselines/reference/outFilerootDirModuleNamesSystem.js b/tests/baselines/reference/outFilerootDirModuleNamesSystem.js index e6ac346dc7f..18ec6ecc19b 100644 --- a/tests/baselines/reference/outFilerootDirModuleNamesSystem.js +++ b/tests/baselines/reference/outFilerootDirModuleNamesSystem.js @@ -11,8 +11,9 @@ export default function foo() { new Foo(); } //// [output.js] -System.register("b", ["a"], function(exports_1, __moduleName) { +System.register("b", ["a"], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; var a_1; function foo() { new a_1.default(); } exports_1("default", foo); @@ -25,8 +26,9 @@ System.register("b", ["a"], function(exports_1, __moduleName) { } } }); -System.register("a", ["b"], function(exports_2, __moduleName) { +System.register("a", ["b"], function(exports_2, context_2) { "use strict"; + var __moduleName = context_2 && context_2.id; var b_1; var Foo; return { @@ -35,8 +37,8 @@ System.register("a", ["b"], function(exports_2, __moduleName) { b_1 = b_1_1; }], execute: function() { - class Foo { - } + Foo = class Foo { + }; exports_2("default", Foo); b_1.default(); } diff --git a/tests/baselines/reference/outModuleConcatSystem.js b/tests/baselines/reference/outModuleConcatSystem.js index bd2753c6d5f..59bbb363022 100644 --- a/tests/baselines/reference/outModuleConcatSystem.js +++ b/tests/baselines/reference/outModuleConcatSystem.js @@ -14,8 +14,9 @@ var __extends = (this && this.__extends) || function (d, b) { function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; -System.register("ref/a", [], function(exports_1, __moduleName) { +System.register("ref/a", [], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; var A; return { setters:[], @@ -29,8 +30,9 @@ System.register("ref/a", [], function(exports_1, __moduleName) { } } }); -System.register("b", ["ref/a"], function(exports_2, __moduleName) { +System.register("b", ["ref/a"], function(exports_2, context_2) { "use strict"; + var __moduleName = context_2 && context_2.id; var a_1; var B; return { diff --git a/tests/baselines/reference/outModuleConcatSystem.js.map b/tests/baselines/reference/outModuleConcatSystem.js.map index 47d3ba2d39c..be6e66c3cf4 100644 --- a/tests/baselines/reference/outModuleConcatSystem.js.map +++ b/tests/baselines/reference/outModuleConcatSystem.js.map @@ -1,2 +1,2 @@ //// [all.js.map] -{"version":3,"file":"all.js","sourceRoot":"","sources":["tests/cases/compiler/ref/a.ts","tests/cases/compiler/b.ts"],"names":[],"mappings":";;;;;;;;;;;YACA;gBAAA;gBAAiB,CAAC;gBAAD,QAAC;YAAD,CAAC,AAAlB,IAAkB;YAAlB,iBAAkB,CAAA;;;;;;;;;;;;;;YCAlB;gBAAuB,qBAAC;gBAAxB;oBAAuB,8BAAC;gBAAG,CAAC;gBAAD,QAAC;YAAD,CAAC,AAA5B,CAAuB,KAAC,GAAI;YAA5B,iBAA4B,CAAA"} \ No newline at end of file +{"version":3,"file":"all.js","sourceRoot":"","sources":["tests/cases/compiler/ref/a.ts","tests/cases/compiler/b.ts"],"names":[],"mappings":";;;;;;;;;;;;YACA;gBAAA;gBAAiB,CAAC;gBAAD,QAAC;YAAD,CAAC,AAAlB,IAAkB;YAAlB,iBAAkB,CAAA;;;;;;;;;;;;;;;YCAlB;gBAAuB,qBAAC;gBAAxB;oBAAuB,8BAAC;gBAAG,CAAC;gBAAD,QAAC;YAAD,CAAC,AAA5B,CAAuB,KAAC,GAAI;YAA5B,iBAA4B,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/outModuleConcatSystem.sourcemap.txt b/tests/baselines/reference/outModuleConcatSystem.sourcemap.txt index 0b1f9cc5294..0281bdec5bd 100644 --- a/tests/baselines/reference/outModuleConcatSystem.sourcemap.txt +++ b/tests/baselines/reference/outModuleConcatSystem.sourcemap.txt @@ -13,8 +13,9 @@ sourceFile:tests/cases/compiler/ref/a.ts >>> function __() { this.constructor = d; } >>> d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); >>>}; ->>>System.register("ref/a", [], function(exports_1, __moduleName) { +>>>System.register("ref/a", [], function(exports_1, context_1) { >>> "use strict"; +>>> var __moduleName = context_1 && context_1.id; >>> var A; >>> return { >>> setters:[], @@ -24,13 +25,13 @@ sourceFile:tests/cases/compiler/ref/a.ts 2 > ^^^^^^^^^^^^^^^^^^^-> 1 > > -1 >Emitted(12, 13) Source(2, 1) + SourceIndex(0) +1 >Emitted(13, 13) Source(2, 1) + SourceIndex(0) --- >>> function A() { 1->^^^^^^^^^^^^^^^^ 2 > ^^-> 1-> -1->Emitted(13, 17) Source(2, 1) + SourceIndex(0) +1->Emitted(14, 17) Source(2, 1) + SourceIndex(0) --- >>> } 1->^^^^^^^^^^^^^^^^ @@ -38,16 +39,16 @@ sourceFile:tests/cases/compiler/ref/a.ts 3 > ^^^^^^^^^-> 1->export class A { 2 > } -1->Emitted(14, 17) Source(2, 18) + SourceIndex(0) -2 >Emitted(14, 18) Source(2, 19) + SourceIndex(0) +1->Emitted(15, 17) Source(2, 18) + SourceIndex(0) +2 >Emitted(15, 18) Source(2, 19) + SourceIndex(0) --- >>> return A; 1->^^^^^^^^^^^^^^^^ 2 > ^^^^^^^^ 1-> 2 > } -1->Emitted(15, 17) Source(2, 18) + SourceIndex(0) -2 >Emitted(15, 25) Source(2, 19) + SourceIndex(0) +1->Emitted(16, 17) Source(2, 18) + SourceIndex(0) +2 >Emitted(16, 25) Source(2, 19) + SourceIndex(0) --- >>> }()); 1 >^^^^^^^^^^^^ @@ -59,10 +60,10 @@ sourceFile:tests/cases/compiler/ref/a.ts 2 > } 3 > 4 > export class A { } -1 >Emitted(16, 13) Source(2, 18) + SourceIndex(0) -2 >Emitted(16, 14) Source(2, 19) + SourceIndex(0) -3 >Emitted(16, 14) Source(2, 1) + SourceIndex(0) -4 >Emitted(16, 18) Source(2, 19) + SourceIndex(0) +1 >Emitted(17, 13) Source(2, 18) + SourceIndex(0) +2 >Emitted(17, 14) Source(2, 19) + SourceIndex(0) +3 >Emitted(17, 14) Source(2, 1) + SourceIndex(0) +4 >Emitted(17, 18) Source(2, 19) + SourceIndex(0) --- >>> exports_1("A", A); 1->^^^^^^^^^^^^ @@ -71,9 +72,9 @@ sourceFile:tests/cases/compiler/ref/a.ts 1-> 2 > export class A { } 3 > -1->Emitted(17, 13) Source(2, 1) + SourceIndex(0) -2 >Emitted(17, 30) Source(2, 19) + SourceIndex(0) -3 >Emitted(17, 31) Source(2, 19) + SourceIndex(0) +1->Emitted(18, 13) Source(2, 1) + SourceIndex(0) +2 >Emitted(18, 30) Source(2, 19) + SourceIndex(0) +3 >Emitted(18, 31) Source(2, 19) + SourceIndex(0) --- ------------------------------------------------------------------- emittedFile:all.js @@ -82,8 +83,9 @@ sourceFile:tests/cases/compiler/b.ts >>> } >>> } >>>}); ->>>System.register("b", ["ref/a"], function(exports_2, __moduleName) { +>>>System.register("b", ["ref/a"], function(exports_2, context_2) { >>> "use strict"; +>>> var __moduleName = context_2 && context_2.id; >>> var a_1; >>> var B; >>> return { @@ -97,29 +99,29 @@ sourceFile:tests/cases/compiler/b.ts 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 >import {A} from "./ref/a"; > -1 >Emitted(31, 13) Source(2, 1) + SourceIndex(1) +1 >Emitted(33, 13) Source(2, 1) + SourceIndex(1) --- >>> __extends(B, _super); 1->^^^^^^^^^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^ 1->export class B extends 2 > A -1->Emitted(32, 17) Source(2, 24) + SourceIndex(1) -2 >Emitted(32, 38) Source(2, 25) + SourceIndex(1) +1->Emitted(34, 17) Source(2, 24) + SourceIndex(1) +2 >Emitted(34, 38) Source(2, 25) + SourceIndex(1) --- >>> function B() { 1 >^^^^^^^^^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > -1 >Emitted(33, 17) Source(2, 1) + SourceIndex(1) +1 >Emitted(35, 17) Source(2, 1) + SourceIndex(1) --- >>> _super.apply(this, arguments); 1->^^^^^^^^^^^^^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1->export class B extends 2 > A -1->Emitted(34, 21) Source(2, 24) + SourceIndex(1) -2 >Emitted(34, 51) Source(2, 25) + SourceIndex(1) +1->Emitted(36, 21) Source(2, 24) + SourceIndex(1) +2 >Emitted(36, 51) Source(2, 25) + SourceIndex(1) --- >>> } 1 >^^^^^^^^^^^^^^^^ @@ -127,16 +129,16 @@ sourceFile:tests/cases/compiler/b.ts 3 > ^^^^^^^^^-> 1 > { 2 > } -1 >Emitted(35, 17) Source(2, 28) + SourceIndex(1) -2 >Emitted(35, 18) Source(2, 29) + SourceIndex(1) +1 >Emitted(37, 17) Source(2, 28) + SourceIndex(1) +2 >Emitted(37, 18) Source(2, 29) + SourceIndex(1) --- >>> return B; 1->^^^^^^^^^^^^^^^^ 2 > ^^^^^^^^ 1-> 2 > } -1->Emitted(36, 17) Source(2, 28) + SourceIndex(1) -2 >Emitted(36, 25) Source(2, 29) + SourceIndex(1) +1->Emitted(38, 17) Source(2, 28) + SourceIndex(1) +2 >Emitted(38, 25) Source(2, 29) + SourceIndex(1) --- >>> }(a_1.A)); 1 >^^^^^^^^^^^^ @@ -152,12 +154,12 @@ sourceFile:tests/cases/compiler/b.ts 4 > export class B extends 5 > A 6 > { } -1 >Emitted(37, 13) Source(2, 28) + SourceIndex(1) -2 >Emitted(37, 14) Source(2, 29) + SourceIndex(1) -3 >Emitted(37, 14) Source(2, 1) + SourceIndex(1) -4 >Emitted(37, 15) Source(2, 24) + SourceIndex(1) -5 >Emitted(37, 20) Source(2, 25) + SourceIndex(1) -6 >Emitted(37, 23) Source(2, 29) + SourceIndex(1) +1 >Emitted(39, 13) Source(2, 28) + SourceIndex(1) +2 >Emitted(39, 14) Source(2, 29) + SourceIndex(1) +3 >Emitted(39, 14) Source(2, 1) + SourceIndex(1) +4 >Emitted(39, 15) Source(2, 24) + SourceIndex(1) +5 >Emitted(39, 20) Source(2, 25) + SourceIndex(1) +6 >Emitted(39, 23) Source(2, 29) + SourceIndex(1) --- >>> exports_2("B", B); 1->^^^^^^^^^^^^ @@ -166,9 +168,9 @@ sourceFile:tests/cases/compiler/b.ts 1-> 2 > export class B extends A { } 3 > -1->Emitted(38, 13) Source(2, 1) + SourceIndex(1) -2 >Emitted(38, 30) Source(2, 29) + SourceIndex(1) -3 >Emitted(38, 31) Source(2, 29) + SourceIndex(1) +1->Emitted(40, 13) Source(2, 1) + SourceIndex(1) +2 >Emitted(40, 30) Source(2, 29) + SourceIndex(1) +3 >Emitted(40, 31) Source(2, 29) + SourceIndex(1) --- >>> } >>> } diff --git a/tests/baselines/reference/outModuleTripleSlashRefs.symbols b/tests/baselines/reference/outModuleTripleSlashRefs.symbols index f8d550aedb6..5f137a95361 100644 --- a/tests/baselines/reference/outModuleTripleSlashRefs.symbols +++ b/tests/baselines/reference/outModuleTripleSlashRefs.symbols @@ -5,7 +5,7 @@ export class A { >A : Symbol(A, Decl(a.ts, 0, 0)) member: typeof GlobalFoo; ->member : Symbol(member, Decl(a.ts, 2, 16)) +>member : Symbol(A.member, Decl(a.ts, 2, 16)) >GlobalFoo : Symbol(GlobalFoo, Decl(b.ts, 4, 11)) } @@ -15,7 +15,7 @@ class Foo { >Foo : Symbol(Foo, Decl(b.ts, 0, 0)) member: Bar; ->member : Symbol(member, Decl(b.ts, 1, 11)) +>member : Symbol(Foo.member, Decl(b.ts, 1, 11)) >Bar : Symbol(Bar, Decl(c.d.ts, 0, 0)) } declare var GlobalFoo: Foo; @@ -28,7 +28,7 @@ declare class Bar { >Bar : Symbol(Bar, Decl(c.d.ts, 0, 0)) member: Baz; ->member : Symbol(member, Decl(c.d.ts, 1, 19)) +>member : Symbol(Bar.member, Decl(c.d.ts, 1, 19)) >Baz : Symbol(Baz, Decl(d.d.ts, 0, 0)) } @@ -37,7 +37,7 @@ declare class Baz { >Baz : Symbol(Baz, Decl(d.d.ts, 0, 0)) member: number; ->member : Symbol(member, Decl(d.d.ts, 0, 19)) +>member : Symbol(Baz.member, Decl(d.d.ts, 0, 19)) } === tests/cases/compiler/b.ts === diff --git a/tests/baselines/reference/overloadBindingAcrossDeclarationBoundaries.symbols b/tests/baselines/reference/overloadBindingAcrossDeclarationBoundaries.symbols index 65f64fa8915..0791f7009d0 100644 --- a/tests/baselines/reference/overloadBindingAcrossDeclarationBoundaries.symbols +++ b/tests/baselines/reference/overloadBindingAcrossDeclarationBoundaries.symbols @@ -3,37 +3,37 @@ interface Opt1 { >Opt1 : Symbol(Opt1, Decl(overloadBindingAcrossDeclarationBoundaries.ts, 0, 0)) p?: any; ->p : Symbol(p, Decl(overloadBindingAcrossDeclarationBoundaries.ts, 0, 16)) +>p : Symbol(Opt1.p, Decl(overloadBindingAcrossDeclarationBoundaries.ts, 0, 16)) } interface Opt2 { >Opt2 : Symbol(Opt2, Decl(overloadBindingAcrossDeclarationBoundaries.ts, 2, 1)) q?: any; ->q : Symbol(q, Decl(overloadBindingAcrossDeclarationBoundaries.ts, 3, 16)) +>q : Symbol(Opt2.q, Decl(overloadBindingAcrossDeclarationBoundaries.ts, 3, 16)) } interface Opt3 { >Opt3 : Symbol(Opt3, Decl(overloadBindingAcrossDeclarationBoundaries.ts, 5, 1)) r?: any; ->r : Symbol(r, Decl(overloadBindingAcrossDeclarationBoundaries.ts, 6, 16)) +>r : Symbol(Opt3.r, Decl(overloadBindingAcrossDeclarationBoundaries.ts, 6, 16)) } interface Opt4 { >Opt4 : Symbol(Opt4, Decl(overloadBindingAcrossDeclarationBoundaries.ts, 8, 1)) s?: any; ->s : Symbol(s, Decl(overloadBindingAcrossDeclarationBoundaries.ts, 9, 16)) +>s : Symbol(Opt4.s, Decl(overloadBindingAcrossDeclarationBoundaries.ts, 9, 16)) } interface A { >A : Symbol(A, Decl(overloadBindingAcrossDeclarationBoundaries.ts, 11, 1), Decl(overloadBindingAcrossDeclarationBoundaries.ts, 19, 1)) a(o: Opt1): Opt1; ->a : Symbol(a, Decl(overloadBindingAcrossDeclarationBoundaries.ts, 12, 13), Decl(overloadBindingAcrossDeclarationBoundaries.ts, 13, 21), Decl(overloadBindingAcrossDeclarationBoundaries.ts, 20, 13), Decl(overloadBindingAcrossDeclarationBoundaries.ts, 21, 21)) +>a : Symbol(A.a, Decl(overloadBindingAcrossDeclarationBoundaries.ts, 12, 13), Decl(overloadBindingAcrossDeclarationBoundaries.ts, 13, 21), Decl(overloadBindingAcrossDeclarationBoundaries.ts, 20, 13), Decl(overloadBindingAcrossDeclarationBoundaries.ts, 21, 21)) >o : Symbol(o, Decl(overloadBindingAcrossDeclarationBoundaries.ts, 13, 6)) >Opt1 : Symbol(Opt1, Decl(overloadBindingAcrossDeclarationBoundaries.ts, 0, 0)) >Opt1 : Symbol(Opt1, Decl(overloadBindingAcrossDeclarationBoundaries.ts, 0, 0)) a(o: Opt2): Opt2; ->a : Symbol(a, Decl(overloadBindingAcrossDeclarationBoundaries.ts, 12, 13), Decl(overloadBindingAcrossDeclarationBoundaries.ts, 13, 21), Decl(overloadBindingAcrossDeclarationBoundaries.ts, 20, 13), Decl(overloadBindingAcrossDeclarationBoundaries.ts, 21, 21)) +>a : Symbol(A.a, Decl(overloadBindingAcrossDeclarationBoundaries.ts, 12, 13), Decl(overloadBindingAcrossDeclarationBoundaries.ts, 13, 21), Decl(overloadBindingAcrossDeclarationBoundaries.ts, 20, 13), Decl(overloadBindingAcrossDeclarationBoundaries.ts, 21, 21)) >o : Symbol(o, Decl(overloadBindingAcrossDeclarationBoundaries.ts, 14, 6)) >Opt2 : Symbol(Opt2, Decl(overloadBindingAcrossDeclarationBoundaries.ts, 2, 1)) >Opt2 : Symbol(Opt2, Decl(overloadBindingAcrossDeclarationBoundaries.ts, 2, 1)) @@ -62,13 +62,13 @@ interface A { >A : Symbol(A, Decl(overloadBindingAcrossDeclarationBoundaries.ts, 11, 1), Decl(overloadBindingAcrossDeclarationBoundaries.ts, 19, 1)) a(o: Opt3): Opt3; ->a : Symbol(a, Decl(overloadBindingAcrossDeclarationBoundaries.ts, 12, 13), Decl(overloadBindingAcrossDeclarationBoundaries.ts, 13, 21), Decl(overloadBindingAcrossDeclarationBoundaries.ts, 20, 13), Decl(overloadBindingAcrossDeclarationBoundaries.ts, 21, 21)) +>a : Symbol(A.a, Decl(overloadBindingAcrossDeclarationBoundaries.ts, 12, 13), Decl(overloadBindingAcrossDeclarationBoundaries.ts, 13, 21), Decl(overloadBindingAcrossDeclarationBoundaries.ts, 20, 13), Decl(overloadBindingAcrossDeclarationBoundaries.ts, 21, 21)) >o : Symbol(o, Decl(overloadBindingAcrossDeclarationBoundaries.ts, 21, 6)) >Opt3 : Symbol(Opt3, Decl(overloadBindingAcrossDeclarationBoundaries.ts, 5, 1)) >Opt3 : Symbol(Opt3, Decl(overloadBindingAcrossDeclarationBoundaries.ts, 5, 1)) a(o: Opt4): Opt4; ->a : Symbol(a, Decl(overloadBindingAcrossDeclarationBoundaries.ts, 12, 13), Decl(overloadBindingAcrossDeclarationBoundaries.ts, 13, 21), Decl(overloadBindingAcrossDeclarationBoundaries.ts, 20, 13), Decl(overloadBindingAcrossDeclarationBoundaries.ts, 21, 21)) +>a : Symbol(A.a, Decl(overloadBindingAcrossDeclarationBoundaries.ts, 12, 13), Decl(overloadBindingAcrossDeclarationBoundaries.ts, 13, 21), Decl(overloadBindingAcrossDeclarationBoundaries.ts, 20, 13), Decl(overloadBindingAcrossDeclarationBoundaries.ts, 21, 21)) >o : Symbol(o, Decl(overloadBindingAcrossDeclarationBoundaries.ts, 22, 6)) >Opt4 : Symbol(Opt4, Decl(overloadBindingAcrossDeclarationBoundaries.ts, 8, 1)) >Opt4 : Symbol(Opt4, Decl(overloadBindingAcrossDeclarationBoundaries.ts, 8, 1)) diff --git a/tests/baselines/reference/overloadBindingAcrossDeclarationBoundaries2.symbols b/tests/baselines/reference/overloadBindingAcrossDeclarationBoundaries2.symbols index 534475bcc30..7fd32af7cec 100644 --- a/tests/baselines/reference/overloadBindingAcrossDeclarationBoundaries2.symbols +++ b/tests/baselines/reference/overloadBindingAcrossDeclarationBoundaries2.symbols @@ -3,38 +3,38 @@ interface Opt1 { >Opt1 : Symbol(Opt1, Decl(overloadBindingAcrossDeclarationBoundaries_file0.ts, 0, 0)) p?: any; ->p : Symbol(p, Decl(overloadBindingAcrossDeclarationBoundaries_file0.ts, 0, 16)) +>p : Symbol(Opt1.p, Decl(overloadBindingAcrossDeclarationBoundaries_file0.ts, 0, 16)) } interface Opt2 { >Opt2 : Symbol(Opt2, Decl(overloadBindingAcrossDeclarationBoundaries_file0.ts, 2, 1)) q?: any; ->q : Symbol(q, Decl(overloadBindingAcrossDeclarationBoundaries_file0.ts, 3, 16)) +>q : Symbol(Opt2.q, Decl(overloadBindingAcrossDeclarationBoundaries_file0.ts, 3, 16)) } interface Opt3 { >Opt3 : Symbol(Opt3, Decl(overloadBindingAcrossDeclarationBoundaries_file0.ts, 5, 1)) r?: any; ->r : Symbol(r, Decl(overloadBindingAcrossDeclarationBoundaries_file0.ts, 6, 16)) +>r : Symbol(Opt3.r, Decl(overloadBindingAcrossDeclarationBoundaries_file0.ts, 6, 16)) } interface Opt4 { >Opt4 : Symbol(Opt4, Decl(overloadBindingAcrossDeclarationBoundaries_file0.ts, 8, 1)) s?: any; ->s : Symbol(s, Decl(overloadBindingAcrossDeclarationBoundaries_file0.ts, 9, 16)) +>s : Symbol(Opt4.s, Decl(overloadBindingAcrossDeclarationBoundaries_file0.ts, 9, 16)) } interface A { >A : Symbol(A, Decl(overloadBindingAcrossDeclarationBoundaries_file0.ts, 11, 1), Decl(overloadBindingAcrossDeclarationBoundaries_file1.ts, 0, 0)) a(o: Opt1): Opt1; ->a : Symbol(a, Decl(overloadBindingAcrossDeclarationBoundaries_file0.ts, 13, 13), Decl(overloadBindingAcrossDeclarationBoundaries_file0.ts, 14, 21), Decl(overloadBindingAcrossDeclarationBoundaries_file1.ts, 0, 13), Decl(overloadBindingAcrossDeclarationBoundaries_file1.ts, 1, 21)) +>a : Symbol(A.a, Decl(overloadBindingAcrossDeclarationBoundaries_file0.ts, 13, 13), Decl(overloadBindingAcrossDeclarationBoundaries_file0.ts, 14, 21), Decl(overloadBindingAcrossDeclarationBoundaries_file1.ts, 0, 13), Decl(overloadBindingAcrossDeclarationBoundaries_file1.ts, 1, 21)) >o : Symbol(o, Decl(overloadBindingAcrossDeclarationBoundaries_file0.ts, 14, 6)) >Opt1 : Symbol(Opt1, Decl(overloadBindingAcrossDeclarationBoundaries_file0.ts, 0, 0)) >Opt1 : Symbol(Opt1, Decl(overloadBindingAcrossDeclarationBoundaries_file0.ts, 0, 0)) a(o: Opt2): Opt2; ->a : Symbol(a, Decl(overloadBindingAcrossDeclarationBoundaries_file0.ts, 13, 13), Decl(overloadBindingAcrossDeclarationBoundaries_file0.ts, 14, 21), Decl(overloadBindingAcrossDeclarationBoundaries_file1.ts, 0, 13), Decl(overloadBindingAcrossDeclarationBoundaries_file1.ts, 1, 21)) +>a : Symbol(A.a, Decl(overloadBindingAcrossDeclarationBoundaries_file0.ts, 13, 13), Decl(overloadBindingAcrossDeclarationBoundaries_file0.ts, 14, 21), Decl(overloadBindingAcrossDeclarationBoundaries_file1.ts, 0, 13), Decl(overloadBindingAcrossDeclarationBoundaries_file1.ts, 1, 21)) >o : Symbol(o, Decl(overloadBindingAcrossDeclarationBoundaries_file0.ts, 15, 6)) >Opt2 : Symbol(Opt2, Decl(overloadBindingAcrossDeclarationBoundaries_file0.ts, 2, 1)) >Opt2 : Symbol(Opt2, Decl(overloadBindingAcrossDeclarationBoundaries_file0.ts, 2, 1)) @@ -65,13 +65,13 @@ interface A { >A : Symbol(A, Decl(overloadBindingAcrossDeclarationBoundaries_file0.ts, 11, 1), Decl(overloadBindingAcrossDeclarationBoundaries_file1.ts, 0, 0)) a(o: Opt3): Opt3; ->a : Symbol(a, Decl(overloadBindingAcrossDeclarationBoundaries_file0.ts, 13, 13), Decl(overloadBindingAcrossDeclarationBoundaries_file0.ts, 14, 21), Decl(overloadBindingAcrossDeclarationBoundaries_file1.ts, 0, 13), Decl(overloadBindingAcrossDeclarationBoundaries_file1.ts, 1, 21)) +>a : Symbol(A.a, Decl(overloadBindingAcrossDeclarationBoundaries_file0.ts, 13, 13), Decl(overloadBindingAcrossDeclarationBoundaries_file0.ts, 14, 21), Decl(overloadBindingAcrossDeclarationBoundaries_file1.ts, 0, 13), Decl(overloadBindingAcrossDeclarationBoundaries_file1.ts, 1, 21)) >o : Symbol(o, Decl(overloadBindingAcrossDeclarationBoundaries_file1.ts, 1, 6)) >Opt3 : Symbol(Opt3, Decl(overloadBindingAcrossDeclarationBoundaries_file0.ts, 5, 1)) >Opt3 : Symbol(Opt3, Decl(overloadBindingAcrossDeclarationBoundaries_file0.ts, 5, 1)) a(o: Opt4): Opt4; ->a : Symbol(a, Decl(overloadBindingAcrossDeclarationBoundaries_file0.ts, 13, 13), Decl(overloadBindingAcrossDeclarationBoundaries_file0.ts, 14, 21), Decl(overloadBindingAcrossDeclarationBoundaries_file1.ts, 0, 13), Decl(overloadBindingAcrossDeclarationBoundaries_file1.ts, 1, 21)) +>a : Symbol(A.a, Decl(overloadBindingAcrossDeclarationBoundaries_file0.ts, 13, 13), Decl(overloadBindingAcrossDeclarationBoundaries_file0.ts, 14, 21), Decl(overloadBindingAcrossDeclarationBoundaries_file1.ts, 0, 13), Decl(overloadBindingAcrossDeclarationBoundaries_file1.ts, 1, 21)) >o : Symbol(o, Decl(overloadBindingAcrossDeclarationBoundaries_file1.ts, 2, 6)) >Opt4 : Symbol(Opt4, Decl(overloadBindingAcrossDeclarationBoundaries_file0.ts, 8, 1)) >Opt4 : Symbol(Opt4, Decl(overloadBindingAcrossDeclarationBoundaries_file0.ts, 8, 1)) diff --git a/tests/baselines/reference/overloadCrash.symbols b/tests/baselines/reference/overloadCrash.symbols index 791411540b3..8345107dc45 100644 --- a/tests/baselines/reference/overloadCrash.symbols +++ b/tests/baselines/reference/overloadCrash.symbols @@ -1,20 +1,20 @@ === tests/cases/compiler/overloadCrash.ts === interface I1 {a:number; b:number;}; >I1 : Symbol(I1, Decl(overloadCrash.ts, 0, 0)) ->a : Symbol(a, Decl(overloadCrash.ts, 0, 14)) ->b : Symbol(b, Decl(overloadCrash.ts, 0, 23)) +>a : Symbol(I1.a, Decl(overloadCrash.ts, 0, 14)) +>b : Symbol(I1.b, Decl(overloadCrash.ts, 0, 23)) interface I2 {c:number; d:number;}; >I2 : Symbol(I2, Decl(overloadCrash.ts, 0, 35)) ->c : Symbol(c, Decl(overloadCrash.ts, 1, 14)) ->d : Symbol(d, Decl(overloadCrash.ts, 1, 23)) +>c : Symbol(I2.c, Decl(overloadCrash.ts, 1, 14)) +>d : Symbol(I2.d, Decl(overloadCrash.ts, 1, 23)) interface I3 {a:number; b:number; c:number; d:number;}; >I3 : Symbol(I3, Decl(overloadCrash.ts, 1, 35)) ->a : Symbol(a, Decl(overloadCrash.ts, 2, 14)) ->b : Symbol(b, Decl(overloadCrash.ts, 2, 23)) ->c : Symbol(c, Decl(overloadCrash.ts, 2, 33)) ->d : Symbol(d, Decl(overloadCrash.ts, 2, 43)) +>a : Symbol(I3.a, Decl(overloadCrash.ts, 2, 14)) +>b : Symbol(I3.b, Decl(overloadCrash.ts, 2, 23)) +>c : Symbol(I3.c, Decl(overloadCrash.ts, 2, 33)) +>d : Symbol(I3.d, Decl(overloadCrash.ts, 2, 43)) declare function foo(...n:I1[]); >foo : Symbol(foo, Decl(overloadCrash.ts, 2, 55), Decl(overloadCrash.ts, 4, 32)) diff --git a/tests/baselines/reference/overloadGenericFunctionWithRestArgs.symbols b/tests/baselines/reference/overloadGenericFunctionWithRestArgs.symbols index 52ee82e5d3c..c98e0c35d5a 100644 --- a/tests/baselines/reference/overloadGenericFunctionWithRestArgs.symbols +++ b/tests/baselines/reference/overloadGenericFunctionWithRestArgs.symbols @@ -4,7 +4,7 @@ class B{ >V : Symbol(V, Decl(overloadGenericFunctionWithRestArgs.ts, 0, 8)) private id: V; ->id : Symbol(id, Decl(overloadGenericFunctionWithRestArgs.ts, 0, 11)) +>id : Symbol(B.id, Decl(overloadGenericFunctionWithRestArgs.ts, 0, 11)) >V : Symbol(V, Decl(overloadGenericFunctionWithRestArgs.ts, 0, 8)) } class A{ @@ -12,7 +12,7 @@ class A{ >U : Symbol(U, Decl(overloadGenericFunctionWithRestArgs.ts, 3, 8)) GetEnumerator: () => B; ->GetEnumerator : Symbol(GetEnumerator, Decl(overloadGenericFunctionWithRestArgs.ts, 3, 11)) +>GetEnumerator : Symbol(A.GetEnumerator, Decl(overloadGenericFunctionWithRestArgs.ts, 3, 11)) >B : Symbol(B, Decl(overloadGenericFunctionWithRestArgs.ts, 0, 0)) >U : Symbol(U, Decl(overloadGenericFunctionWithRestArgs.ts, 3, 8)) } diff --git a/tests/baselines/reference/overloadModifiersMustAgree.errors.txt b/tests/baselines/reference/overloadModifiersMustAgree.errors.txt index 0efdbcdd1f6..8fbc4b4fda5 100644 --- a/tests/baselines/reference/overloadModifiersMustAgree.errors.txt +++ b/tests/baselines/reference/overloadModifiersMustAgree.errors.txt @@ -1,6 +1,6 @@ tests/cases/compiler/overloadModifiersMustAgree.ts(2,12): error TS2385: Overload signatures must all be public, private or protected. tests/cases/compiler/overloadModifiersMustAgree.ts(6,18): error TS2384: Overload signatures must all be ambient or non-ambient. -tests/cases/compiler/overloadModifiersMustAgree.ts(7,17): error TS2383: Overload signatures must all be exported or not exported. +tests/cases/compiler/overloadModifiersMustAgree.ts(7,17): error TS2383: Overload signatures must all be exported or non-exported. tests/cases/compiler/overloadModifiersMustAgree.ts(12,5): error TS2386: Overload signatures must all be optional or required. @@ -17,7 +17,7 @@ tests/cases/compiler/overloadModifiersMustAgree.ts(12,5): error TS2386: Overload !!! error TS2384: Overload signatures must all be ambient or non-ambient. export function bar(s: string); ~~~ -!!! error TS2383: Overload signatures must all be exported or not exported. +!!! error TS2383: Overload signatures must all be exported or non-exported. function bar(s?: string) { } interface I { diff --git a/tests/baselines/reference/overloadOnConstAsTypeAnnotation.errors.txt b/tests/baselines/reference/overloadOnConstAsTypeAnnotation.errors.txt deleted file mode 100644 index a78e0c8abcf..00000000000 --- a/tests/baselines/reference/overloadOnConstAsTypeAnnotation.errors.txt +++ /dev/null @@ -1,11 +0,0 @@ -tests/cases/compiler/overloadOnConstAsTypeAnnotation.ts(2,8): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/compiler/overloadOnConstAsTypeAnnotation.ts(2,37): error TS1005: ';' expected. - - -==== tests/cases/compiler/overloadOnConstAsTypeAnnotation.ts (2 errors) ==== - - var f: (x: 'hi') => number = ('hi') => { return 1; }; - ~~~~~~~~~~~~~~~~~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. - ~~ -!!! error TS1005: ';' expected. \ No newline at end of file diff --git a/tests/baselines/reference/overloadOnConstAsTypeAnnotation.js b/tests/baselines/reference/overloadOnConstAsTypeAnnotation.js index aa5c8701f28..94250b48cbc 100644 --- a/tests/baselines/reference/overloadOnConstAsTypeAnnotation.js +++ b/tests/baselines/reference/overloadOnConstAsTypeAnnotation.js @@ -1,10 +1,6 @@ //// [overloadOnConstAsTypeAnnotation.ts] -var f: (x: 'hi') => number = ('hi') => { return 1; }; +var f: (x: 'hi') => number = (x: 'hi') => { return 1; }; //// [overloadOnConstAsTypeAnnotation.js] -var f = ('hi'); -{ - return 1; -} -; +var f = function (x) { return 1; }; diff --git a/tests/baselines/reference/overloadOnConstAsTypeAnnotation.symbols b/tests/baselines/reference/overloadOnConstAsTypeAnnotation.symbols new file mode 100644 index 00000000000..c420e50cda2 --- /dev/null +++ b/tests/baselines/reference/overloadOnConstAsTypeAnnotation.symbols @@ -0,0 +1,7 @@ +=== tests/cases/compiler/overloadOnConstAsTypeAnnotation.ts === + +var f: (x: 'hi') => number = (x: 'hi') => { return 1; }; +>f : Symbol(f, Decl(overloadOnConstAsTypeAnnotation.ts, 1, 3)) +>x : Symbol(x, Decl(overloadOnConstAsTypeAnnotation.ts, 1, 8)) +>x : Symbol(x, Decl(overloadOnConstAsTypeAnnotation.ts, 1, 30)) + diff --git a/tests/baselines/reference/overloadOnConstAsTypeAnnotation.types b/tests/baselines/reference/overloadOnConstAsTypeAnnotation.types new file mode 100644 index 00000000000..10a185708d4 --- /dev/null +++ b/tests/baselines/reference/overloadOnConstAsTypeAnnotation.types @@ -0,0 +1,9 @@ +=== tests/cases/compiler/overloadOnConstAsTypeAnnotation.ts === + +var f: (x: 'hi') => number = (x: 'hi') => { return 1; }; +>f : (x: "hi") => number +>x : "hi" +>(x: 'hi') => { return 1; } : (x: "hi") => number +>x : "hi" +>1 : number + diff --git a/tests/baselines/reference/overloadOnConstConstraintChecks1.symbols b/tests/baselines/reference/overloadOnConstConstraintChecks1.symbols index 2eedf3254a2..6e86ccc2eb1 100644 --- a/tests/baselines/reference/overloadOnConstConstraintChecks1.symbols +++ b/tests/baselines/reference/overloadOnConstConstraintChecks1.symbols @@ -1,43 +1,43 @@ === tests/cases/compiler/overloadOnConstConstraintChecks1.ts === class Base { foo() { } } >Base : Symbol(Base, Decl(overloadOnConstConstraintChecks1.ts, 0, 0)) ->foo : Symbol(foo, Decl(overloadOnConstConstraintChecks1.ts, 0, 12)) +>foo : Symbol(Base.foo, Decl(overloadOnConstConstraintChecks1.ts, 0, 12)) class Derived1 extends Base { bar() { } } >Derived1 : Symbol(Derived1, Decl(overloadOnConstConstraintChecks1.ts, 0, 24)) >Base : Symbol(Base, Decl(overloadOnConstConstraintChecks1.ts, 0, 0)) ->bar : Symbol(bar, Decl(overloadOnConstConstraintChecks1.ts, 1, 29)) +>bar : Symbol(Derived1.bar, Decl(overloadOnConstConstraintChecks1.ts, 1, 29)) class Derived2 extends Base { baz() { } } >Derived2 : Symbol(Derived2, Decl(overloadOnConstConstraintChecks1.ts, 1, 41)) >Base : Symbol(Base, Decl(overloadOnConstConstraintChecks1.ts, 0, 0)) ->baz : Symbol(baz, Decl(overloadOnConstConstraintChecks1.ts, 2, 29)) +>baz : Symbol(Derived2.baz, Decl(overloadOnConstConstraintChecks1.ts, 2, 29)) class Derived3 extends Base { biz() { } } >Derived3 : Symbol(Derived3, Decl(overloadOnConstConstraintChecks1.ts, 2, 41)) >Base : Symbol(Base, Decl(overloadOnConstConstraintChecks1.ts, 0, 0)) ->biz : Symbol(biz, Decl(overloadOnConstConstraintChecks1.ts, 3, 29)) +>biz : Symbol(Derived3.biz, Decl(overloadOnConstConstraintChecks1.ts, 3, 29)) interface MyDoc { // Document >MyDoc : Symbol(MyDoc, Decl(overloadOnConstConstraintChecks1.ts, 3, 41)) createElement(tagName: string): Base; ->createElement : Symbol(createElement, Decl(overloadOnConstConstraintChecks1.ts, 5, 17), Decl(overloadOnConstConstraintChecks1.ts, 6, 41), Decl(overloadOnConstConstraintChecks1.ts, 7, 47), Decl(overloadOnConstConstraintChecks1.ts, 8, 44)) +>createElement : Symbol(MyDoc.createElement, Decl(overloadOnConstConstraintChecks1.ts, 5, 17), Decl(overloadOnConstConstraintChecks1.ts, 6, 41), Decl(overloadOnConstConstraintChecks1.ts, 7, 47), Decl(overloadOnConstConstraintChecks1.ts, 8, 44)) >tagName : Symbol(tagName, Decl(overloadOnConstConstraintChecks1.ts, 6, 18)) >Base : Symbol(Base, Decl(overloadOnConstConstraintChecks1.ts, 0, 0)) createElement(tagName: 'canvas'): Derived1; ->createElement : Symbol(createElement, Decl(overloadOnConstConstraintChecks1.ts, 5, 17), Decl(overloadOnConstConstraintChecks1.ts, 6, 41), Decl(overloadOnConstConstraintChecks1.ts, 7, 47), Decl(overloadOnConstConstraintChecks1.ts, 8, 44)) +>createElement : Symbol(MyDoc.createElement, Decl(overloadOnConstConstraintChecks1.ts, 5, 17), Decl(overloadOnConstConstraintChecks1.ts, 6, 41), Decl(overloadOnConstConstraintChecks1.ts, 7, 47), Decl(overloadOnConstConstraintChecks1.ts, 8, 44)) >tagName : Symbol(tagName, Decl(overloadOnConstConstraintChecks1.ts, 7, 18)) >Derived1 : Symbol(Derived1, Decl(overloadOnConstConstraintChecks1.ts, 0, 24)) createElement(tagName: 'div'): Derived2; ->createElement : Symbol(createElement, Decl(overloadOnConstConstraintChecks1.ts, 5, 17), Decl(overloadOnConstConstraintChecks1.ts, 6, 41), Decl(overloadOnConstConstraintChecks1.ts, 7, 47), Decl(overloadOnConstConstraintChecks1.ts, 8, 44)) +>createElement : Symbol(MyDoc.createElement, Decl(overloadOnConstConstraintChecks1.ts, 5, 17), Decl(overloadOnConstConstraintChecks1.ts, 6, 41), Decl(overloadOnConstConstraintChecks1.ts, 7, 47), Decl(overloadOnConstConstraintChecks1.ts, 8, 44)) >tagName : Symbol(tagName, Decl(overloadOnConstConstraintChecks1.ts, 8, 18)) >Derived2 : Symbol(Derived2, Decl(overloadOnConstConstraintChecks1.ts, 1, 41)) createElement(tagName: 'span'): Derived3; ->createElement : Symbol(createElement, Decl(overloadOnConstConstraintChecks1.ts, 5, 17), Decl(overloadOnConstConstraintChecks1.ts, 6, 41), Decl(overloadOnConstConstraintChecks1.ts, 7, 47), Decl(overloadOnConstConstraintChecks1.ts, 8, 44)) +>createElement : Symbol(MyDoc.createElement, Decl(overloadOnConstConstraintChecks1.ts, 5, 17), Decl(overloadOnConstConstraintChecks1.ts, 6, 41), Decl(overloadOnConstConstraintChecks1.ts, 7, 47), Decl(overloadOnConstConstraintChecks1.ts, 8, 44)) >tagName : Symbol(tagName, Decl(overloadOnConstConstraintChecks1.ts, 9, 18)) >Derived3 : Symbol(Derived3, Decl(overloadOnConstConstraintChecks1.ts, 2, 41)) @@ -49,27 +49,27 @@ class D implements MyDoc { >MyDoc : Symbol(MyDoc, Decl(overloadOnConstConstraintChecks1.ts, 3, 41)) createElement(tagName:string): Base; ->createElement : Symbol(createElement, Decl(overloadOnConstConstraintChecks1.ts, 13, 26), Decl(overloadOnConstConstraintChecks1.ts, 14, 40), Decl(overloadOnConstConstraintChecks1.ts, 15, 47), Decl(overloadOnConstConstraintChecks1.ts, 16, 44), Decl(overloadOnConstConstraintChecks1.ts, 17, 45)) +>createElement : Symbol(D.createElement, Decl(overloadOnConstConstraintChecks1.ts, 13, 26), Decl(overloadOnConstConstraintChecks1.ts, 14, 40), Decl(overloadOnConstConstraintChecks1.ts, 15, 47), Decl(overloadOnConstConstraintChecks1.ts, 16, 44), Decl(overloadOnConstConstraintChecks1.ts, 17, 45)) >tagName : Symbol(tagName, Decl(overloadOnConstConstraintChecks1.ts, 14, 18)) >Base : Symbol(Base, Decl(overloadOnConstConstraintChecks1.ts, 0, 0)) createElement(tagName: 'canvas'): Derived1; ->createElement : Symbol(createElement, Decl(overloadOnConstConstraintChecks1.ts, 13, 26), Decl(overloadOnConstConstraintChecks1.ts, 14, 40), Decl(overloadOnConstConstraintChecks1.ts, 15, 47), Decl(overloadOnConstConstraintChecks1.ts, 16, 44), Decl(overloadOnConstConstraintChecks1.ts, 17, 45)) +>createElement : Symbol(D.createElement, Decl(overloadOnConstConstraintChecks1.ts, 13, 26), Decl(overloadOnConstConstraintChecks1.ts, 14, 40), Decl(overloadOnConstConstraintChecks1.ts, 15, 47), Decl(overloadOnConstConstraintChecks1.ts, 16, 44), Decl(overloadOnConstConstraintChecks1.ts, 17, 45)) >tagName : Symbol(tagName, Decl(overloadOnConstConstraintChecks1.ts, 15, 18)) >Derived1 : Symbol(Derived1, Decl(overloadOnConstConstraintChecks1.ts, 0, 24)) createElement(tagName: 'div'): Derived2; ->createElement : Symbol(createElement, Decl(overloadOnConstConstraintChecks1.ts, 13, 26), Decl(overloadOnConstConstraintChecks1.ts, 14, 40), Decl(overloadOnConstConstraintChecks1.ts, 15, 47), Decl(overloadOnConstConstraintChecks1.ts, 16, 44), Decl(overloadOnConstConstraintChecks1.ts, 17, 45)) +>createElement : Symbol(D.createElement, Decl(overloadOnConstConstraintChecks1.ts, 13, 26), Decl(overloadOnConstConstraintChecks1.ts, 14, 40), Decl(overloadOnConstConstraintChecks1.ts, 15, 47), Decl(overloadOnConstConstraintChecks1.ts, 16, 44), Decl(overloadOnConstConstraintChecks1.ts, 17, 45)) >tagName : Symbol(tagName, Decl(overloadOnConstConstraintChecks1.ts, 16, 18)) >Derived2 : Symbol(Derived2, Decl(overloadOnConstConstraintChecks1.ts, 1, 41)) createElement(tagName: 'span'): Derived3; ->createElement : Symbol(createElement, Decl(overloadOnConstConstraintChecks1.ts, 13, 26), Decl(overloadOnConstConstraintChecks1.ts, 14, 40), Decl(overloadOnConstConstraintChecks1.ts, 15, 47), Decl(overloadOnConstConstraintChecks1.ts, 16, 44), Decl(overloadOnConstConstraintChecks1.ts, 17, 45)) +>createElement : Symbol(D.createElement, Decl(overloadOnConstConstraintChecks1.ts, 13, 26), Decl(overloadOnConstConstraintChecks1.ts, 14, 40), Decl(overloadOnConstConstraintChecks1.ts, 15, 47), Decl(overloadOnConstConstraintChecks1.ts, 16, 44), Decl(overloadOnConstConstraintChecks1.ts, 17, 45)) >tagName : Symbol(tagName, Decl(overloadOnConstConstraintChecks1.ts, 17, 18)) >Derived3 : Symbol(Derived3, Decl(overloadOnConstConstraintChecks1.ts, 2, 41)) createElement(tagName:any): Base { ->createElement : Symbol(createElement, Decl(overloadOnConstConstraintChecks1.ts, 13, 26), Decl(overloadOnConstConstraintChecks1.ts, 14, 40), Decl(overloadOnConstConstraintChecks1.ts, 15, 47), Decl(overloadOnConstConstraintChecks1.ts, 16, 44), Decl(overloadOnConstConstraintChecks1.ts, 17, 45)) +>createElement : Symbol(D.createElement, Decl(overloadOnConstConstraintChecks1.ts, 13, 26), Decl(overloadOnConstConstraintChecks1.ts, 14, 40), Decl(overloadOnConstConstraintChecks1.ts, 15, 47), Decl(overloadOnConstConstraintChecks1.ts, 16, 44), Decl(overloadOnConstConstraintChecks1.ts, 17, 45)) >tagName : Symbol(tagName, Decl(overloadOnConstConstraintChecks1.ts, 18, 18)) >Base : Symbol(Base, Decl(overloadOnConstConstraintChecks1.ts, 0, 0)) diff --git a/tests/baselines/reference/overloadOnConstConstraintChecks2.symbols b/tests/baselines/reference/overloadOnConstConstraintChecks2.symbols index 0c5bd49b4f3..1ef43f1f941 100644 --- a/tests/baselines/reference/overloadOnConstConstraintChecks2.symbols +++ b/tests/baselines/reference/overloadOnConstConstraintChecks2.symbols @@ -11,7 +11,7 @@ class C extends A { >A : Symbol(A, Decl(overloadOnConstConstraintChecks2.ts, 0, 0)) public foo() { } ->foo : Symbol(foo, Decl(overloadOnConstConstraintChecks2.ts, 2, 19)) +>foo : Symbol(C.foo, Decl(overloadOnConstConstraintChecks2.ts, 2, 19)) } function foo(name: 'hi'): B; >foo : Symbol(foo, Decl(overloadOnConstConstraintChecks2.ts, 4, 1), Decl(overloadOnConstConstraintChecks2.ts, 5, 28), Decl(overloadOnConstConstraintChecks2.ts, 6, 29), Decl(overloadOnConstConstraintChecks2.ts, 7, 30)) diff --git a/tests/baselines/reference/overloadOnConstConstraintChecks3.symbols b/tests/baselines/reference/overloadOnConstConstraintChecks3.symbols index 5748fd441a5..3232ca9a94b 100644 --- a/tests/baselines/reference/overloadOnConstConstraintChecks3.symbols +++ b/tests/baselines/reference/overloadOnConstConstraintChecks3.symbols @@ -1,7 +1,7 @@ === tests/cases/compiler/overloadOnConstConstraintChecks3.ts === class A { private x = 1} >A : Symbol(A, Decl(overloadOnConstConstraintChecks3.ts, 0, 0)) ->x : Symbol(x, Decl(overloadOnConstConstraintChecks3.ts, 0, 9)) +>x : Symbol(A.x, Decl(overloadOnConstConstraintChecks3.ts, 0, 9)) class B extends A {} >B : Symbol(B, Decl(overloadOnConstConstraintChecks3.ts, 0, 24)) @@ -12,7 +12,7 @@ class C extends A { >A : Symbol(A, Decl(overloadOnConstConstraintChecks3.ts, 0, 0)) public foo() { } ->foo : Symbol(foo, Decl(overloadOnConstConstraintChecks3.ts, 2, 19)) +>foo : Symbol(C.foo, Decl(overloadOnConstConstraintChecks3.ts, 2, 19)) } function foo(name: 'hi'): B; >foo : Symbol(foo, Decl(overloadOnConstConstraintChecks3.ts, 4, 1), Decl(overloadOnConstConstraintChecks3.ts, 5, 28), Decl(overloadOnConstConstraintChecks3.ts, 6, 29), Decl(overloadOnConstConstraintChecks3.ts, 7, 30)) diff --git a/tests/baselines/reference/overloadOnConstConstraintChecks4.symbols b/tests/baselines/reference/overloadOnConstConstraintChecks4.symbols index 6e2a34b55e9..d50030fde3d 100644 --- a/tests/baselines/reference/overloadOnConstConstraintChecks4.symbols +++ b/tests/baselines/reference/overloadOnConstConstraintChecks4.symbols @@ -5,7 +5,7 @@ class Z { } class A extends Z { private x = 1 } >A : Symbol(A, Decl(overloadOnConstConstraintChecks4.ts, 0, 11)) >Z : Symbol(Z, Decl(overloadOnConstConstraintChecks4.ts, 0, 0)) ->x : Symbol(x, Decl(overloadOnConstConstraintChecks4.ts, 1, 19)) +>x : Symbol(A.x, Decl(overloadOnConstConstraintChecks4.ts, 1, 19)) class B extends A {} >B : Symbol(B, Decl(overloadOnConstConstraintChecks4.ts, 1, 35)) @@ -16,7 +16,7 @@ class C extends A { >A : Symbol(A, Decl(overloadOnConstConstraintChecks4.ts, 0, 11)) public foo() { } ->foo : Symbol(foo, Decl(overloadOnConstConstraintChecks4.ts, 3, 19)) +>foo : Symbol(C.foo, Decl(overloadOnConstConstraintChecks4.ts, 3, 19)) } function foo(name: 'hi'): B; >foo : Symbol(foo, Decl(overloadOnConstConstraintChecks4.ts, 5, 1), Decl(overloadOnConstConstraintChecks4.ts, 6, 28), Decl(overloadOnConstConstraintChecks4.ts, 7, 29), Decl(overloadOnConstConstraintChecks4.ts, 8, 30)) diff --git a/tests/baselines/reference/overloadOnConstDuplicateOverloads1.errors.txt b/tests/baselines/reference/overloadOnConstDuplicateOverloads1.errors.txt deleted file mode 100644 index 0f5126b5920..00000000000 --- a/tests/baselines/reference/overloadOnConstDuplicateOverloads1.errors.txt +++ /dev/null @@ -1,19 +0,0 @@ -tests/cases/compiler/overloadOnConstDuplicateOverloads1.ts(1,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/compiler/overloadOnConstDuplicateOverloads1.ts(2,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. - - -==== tests/cases/compiler/overloadOnConstDuplicateOverloads1.ts (2 errors) ==== - function foo(a: 'hi', x: string); - ~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. - function foo(a: 'hi', x: string); - ~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. - function foo(a: any, x: any) { - } - - function foo2(a: 'hi', x: string); - function foo2(a: 'hi', x: string); - function foo2(a: string, x: string); - function foo2(a: any, x: any) { - } \ No newline at end of file diff --git a/tests/baselines/reference/overloadOnConstDuplicateOverloads1.symbols b/tests/baselines/reference/overloadOnConstDuplicateOverloads1.symbols new file mode 100644 index 00000000000..5ac0cfbd00c --- /dev/null +++ b/tests/baselines/reference/overloadOnConstDuplicateOverloads1.symbols @@ -0,0 +1,37 @@ +=== tests/cases/compiler/overloadOnConstDuplicateOverloads1.ts === +function foo(a: 'hi', x: string); +>foo : Symbol(foo, Decl(overloadOnConstDuplicateOverloads1.ts, 0, 0), Decl(overloadOnConstDuplicateOverloads1.ts, 0, 33), Decl(overloadOnConstDuplicateOverloads1.ts, 1, 33)) +>a : Symbol(a, Decl(overloadOnConstDuplicateOverloads1.ts, 0, 13)) +>x : Symbol(x, Decl(overloadOnConstDuplicateOverloads1.ts, 0, 21)) + +function foo(a: 'hi', x: string); +>foo : Symbol(foo, Decl(overloadOnConstDuplicateOverloads1.ts, 0, 0), Decl(overloadOnConstDuplicateOverloads1.ts, 0, 33), Decl(overloadOnConstDuplicateOverloads1.ts, 1, 33)) +>a : Symbol(a, Decl(overloadOnConstDuplicateOverloads1.ts, 1, 13)) +>x : Symbol(x, Decl(overloadOnConstDuplicateOverloads1.ts, 1, 21)) + +function foo(a: any, x: any) { +>foo : Symbol(foo, Decl(overloadOnConstDuplicateOverloads1.ts, 0, 0), Decl(overloadOnConstDuplicateOverloads1.ts, 0, 33), Decl(overloadOnConstDuplicateOverloads1.ts, 1, 33)) +>a : Symbol(a, Decl(overloadOnConstDuplicateOverloads1.ts, 2, 13)) +>x : Symbol(x, Decl(overloadOnConstDuplicateOverloads1.ts, 2, 20)) +} + +function foo2(a: 'hi', x: string); +>foo2 : Symbol(foo2, Decl(overloadOnConstDuplicateOverloads1.ts, 3, 1), Decl(overloadOnConstDuplicateOverloads1.ts, 5, 34), Decl(overloadOnConstDuplicateOverloads1.ts, 6, 34), Decl(overloadOnConstDuplicateOverloads1.ts, 7, 36)) +>a : Symbol(a, Decl(overloadOnConstDuplicateOverloads1.ts, 5, 14)) +>x : Symbol(x, Decl(overloadOnConstDuplicateOverloads1.ts, 5, 22)) + +function foo2(a: 'hi', x: string); +>foo2 : Symbol(foo2, Decl(overloadOnConstDuplicateOverloads1.ts, 3, 1), Decl(overloadOnConstDuplicateOverloads1.ts, 5, 34), Decl(overloadOnConstDuplicateOverloads1.ts, 6, 34), Decl(overloadOnConstDuplicateOverloads1.ts, 7, 36)) +>a : Symbol(a, Decl(overloadOnConstDuplicateOverloads1.ts, 6, 14)) +>x : Symbol(x, Decl(overloadOnConstDuplicateOverloads1.ts, 6, 22)) + +function foo2(a: string, x: string); +>foo2 : Symbol(foo2, Decl(overloadOnConstDuplicateOverloads1.ts, 3, 1), Decl(overloadOnConstDuplicateOverloads1.ts, 5, 34), Decl(overloadOnConstDuplicateOverloads1.ts, 6, 34), Decl(overloadOnConstDuplicateOverloads1.ts, 7, 36)) +>a : Symbol(a, Decl(overloadOnConstDuplicateOverloads1.ts, 7, 14)) +>x : Symbol(x, Decl(overloadOnConstDuplicateOverloads1.ts, 7, 24)) + +function foo2(a: any, x: any) { +>foo2 : Symbol(foo2, Decl(overloadOnConstDuplicateOverloads1.ts, 3, 1), Decl(overloadOnConstDuplicateOverloads1.ts, 5, 34), Decl(overloadOnConstDuplicateOverloads1.ts, 6, 34), Decl(overloadOnConstDuplicateOverloads1.ts, 7, 36)) +>a : Symbol(a, Decl(overloadOnConstDuplicateOverloads1.ts, 8, 14)) +>x : Symbol(x, Decl(overloadOnConstDuplicateOverloads1.ts, 8, 21)) +} diff --git a/tests/baselines/reference/overloadOnConstDuplicateOverloads1.types b/tests/baselines/reference/overloadOnConstDuplicateOverloads1.types new file mode 100644 index 00000000000..f74bb5bf958 --- /dev/null +++ b/tests/baselines/reference/overloadOnConstDuplicateOverloads1.types @@ -0,0 +1,37 @@ +=== tests/cases/compiler/overloadOnConstDuplicateOverloads1.ts === +function foo(a: 'hi', x: string); +>foo : { (a: "hi", x: string): any; (a: "hi", x: string): any; } +>a : "hi" +>x : string + +function foo(a: 'hi', x: string); +>foo : { (a: "hi", x: string): any; (a: "hi", x: string): any; } +>a : "hi" +>x : string + +function foo(a: any, x: any) { +>foo : { (a: "hi", x: string): any; (a: "hi", x: string): any; } +>a : any +>x : any +} + +function foo2(a: 'hi', x: string); +>foo2 : { (a: "hi", x: string): any; (a: "hi", x: string): any; (a: string, x: string): any; } +>a : "hi" +>x : string + +function foo2(a: 'hi', x: string); +>foo2 : { (a: "hi", x: string): any; (a: "hi", x: string): any; (a: string, x: string): any; } +>a : "hi" +>x : string + +function foo2(a: string, x: string); +>foo2 : { (a: "hi", x: string): any; (a: "hi", x: string): any; (a: string, x: string): any; } +>a : string +>x : string + +function foo2(a: any, x: any) { +>foo2 : { (a: "hi", x: string): any; (a: "hi", x: string): any; (a: string, x: string): any; } +>a : any +>x : any +} diff --git a/tests/baselines/reference/overloadOnConstInBaseWithBadImplementationInDerived.errors.txt b/tests/baselines/reference/overloadOnConstInBaseWithBadImplementationInDerived.errors.txt deleted file mode 100644 index e040559a054..00000000000 --- a/tests/baselines/reference/overloadOnConstInBaseWithBadImplementationInDerived.errors.txt +++ /dev/null @@ -1,17 +0,0 @@ -tests/cases/compiler/overloadOnConstInBaseWithBadImplementationInDerived.ts(2,29): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/compiler/overloadOnConstInBaseWithBadImplementationInDerived.ts(6,29): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. - - -==== tests/cases/compiler/overloadOnConstInBaseWithBadImplementationInDerived.ts (2 errors) ==== - interface I { - x1(a: number, callback: (x: 'hi') => number); - ~~~~~~~~~~~~~~~~~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. - } - - class C implements I { - x1(a: number, callback: (x: 'hi') => number) { // error - ~~~~~~~~~~~~~~~~~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. - } - } \ No newline at end of file diff --git a/tests/baselines/reference/overloadOnConstInBaseWithBadImplementationInDerived.symbols b/tests/baselines/reference/overloadOnConstInBaseWithBadImplementationInDerived.symbols new file mode 100644 index 00000000000..de3aae746a2 --- /dev/null +++ b/tests/baselines/reference/overloadOnConstInBaseWithBadImplementationInDerived.symbols @@ -0,0 +1,22 @@ +=== tests/cases/compiler/overloadOnConstInBaseWithBadImplementationInDerived.ts === +interface I { +>I : Symbol(I, Decl(overloadOnConstInBaseWithBadImplementationInDerived.ts, 0, 0)) + + x1(a: number, callback: (x: 'hi') => number); +>x1 : Symbol(I.x1, Decl(overloadOnConstInBaseWithBadImplementationInDerived.ts, 0, 13)) +>a : Symbol(a, Decl(overloadOnConstInBaseWithBadImplementationInDerived.ts, 1, 7)) +>callback : Symbol(callback, Decl(overloadOnConstInBaseWithBadImplementationInDerived.ts, 1, 17)) +>x : Symbol(x, Decl(overloadOnConstInBaseWithBadImplementationInDerived.ts, 1, 29)) +} + +class C implements I { +>C : Symbol(C, Decl(overloadOnConstInBaseWithBadImplementationInDerived.ts, 2, 1)) +>I : Symbol(I, Decl(overloadOnConstInBaseWithBadImplementationInDerived.ts, 0, 0)) + + x1(a: number, callback: (x: 'hi') => number) { // error +>x1 : Symbol(C.x1, Decl(overloadOnConstInBaseWithBadImplementationInDerived.ts, 4, 22)) +>a : Symbol(a, Decl(overloadOnConstInBaseWithBadImplementationInDerived.ts, 5, 7)) +>callback : Symbol(callback, Decl(overloadOnConstInBaseWithBadImplementationInDerived.ts, 5, 17)) +>x : Symbol(x, Decl(overloadOnConstInBaseWithBadImplementationInDerived.ts, 5, 29)) + } +} diff --git a/tests/baselines/reference/overloadOnConstInBaseWithBadImplementationInDerived.types b/tests/baselines/reference/overloadOnConstInBaseWithBadImplementationInDerived.types new file mode 100644 index 00000000000..079ae80b364 --- /dev/null +++ b/tests/baselines/reference/overloadOnConstInBaseWithBadImplementationInDerived.types @@ -0,0 +1,22 @@ +=== tests/cases/compiler/overloadOnConstInBaseWithBadImplementationInDerived.ts === +interface I { +>I : I + + x1(a: number, callback: (x: 'hi') => number); +>x1 : (a: number, callback: (x: "hi") => number) => any +>a : number +>callback : (x: "hi") => number +>x : "hi" +} + +class C implements I { +>C : C +>I : I + + x1(a: number, callback: (x: 'hi') => number) { // error +>x1 : (a: number, callback: (x: "hi") => number) => void +>a : number +>callback : (x: "hi") => number +>x : "hi" + } +} diff --git a/tests/baselines/reference/overloadOnConstInCallback1.errors.txt b/tests/baselines/reference/overloadOnConstInCallback1.errors.txt deleted file mode 100644 index 5d594204933..00000000000 --- a/tests/baselines/reference/overloadOnConstInCallback1.errors.txt +++ /dev/null @@ -1,15 +0,0 @@ -tests/cases/compiler/overloadOnConstInCallback1.ts(2,29): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. - - -==== tests/cases/compiler/overloadOnConstInCallback1.ts (1 errors) ==== - class C { - x1(a: number, callback: (x: 'hi') => number); // error - ~~~~~~~~~~~~~~~~~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. - x1(a: number, callback: (x: any) => number) { - callback('hi'); - callback('bye'); - var hm = "hm"; - callback(hm); - } - } \ No newline at end of file diff --git a/tests/baselines/reference/overloadOnConstInCallback1.symbols b/tests/baselines/reference/overloadOnConstInCallback1.symbols new file mode 100644 index 00000000000..935d7f3b607 --- /dev/null +++ b/tests/baselines/reference/overloadOnConstInCallback1.symbols @@ -0,0 +1,30 @@ +=== tests/cases/compiler/overloadOnConstInCallback1.ts === +class C { +>C : Symbol(C, Decl(overloadOnConstInCallback1.ts, 0, 0)) + + x1(a: number, callback: (x: 'hi') => number); // error +>x1 : Symbol(C.x1, Decl(overloadOnConstInCallback1.ts, 0, 9), Decl(overloadOnConstInCallback1.ts, 1, 49)) +>a : Symbol(a, Decl(overloadOnConstInCallback1.ts, 1, 7)) +>callback : Symbol(callback, Decl(overloadOnConstInCallback1.ts, 1, 17)) +>x : Symbol(x, Decl(overloadOnConstInCallback1.ts, 1, 29)) + + x1(a: number, callback: (x: any) => number) { +>x1 : Symbol(C.x1, Decl(overloadOnConstInCallback1.ts, 0, 9), Decl(overloadOnConstInCallback1.ts, 1, 49)) +>a : Symbol(a, Decl(overloadOnConstInCallback1.ts, 2, 7)) +>callback : Symbol(callback, Decl(overloadOnConstInCallback1.ts, 2, 17)) +>x : Symbol(x, Decl(overloadOnConstInCallback1.ts, 2, 29)) + + callback('hi'); +>callback : Symbol(callback, Decl(overloadOnConstInCallback1.ts, 2, 17)) + + callback('bye'); +>callback : Symbol(callback, Decl(overloadOnConstInCallback1.ts, 2, 17)) + + var hm = "hm"; +>hm : Symbol(hm, Decl(overloadOnConstInCallback1.ts, 5, 11)) + + callback(hm); +>callback : Symbol(callback, Decl(overloadOnConstInCallback1.ts, 2, 17)) +>hm : Symbol(hm, Decl(overloadOnConstInCallback1.ts, 5, 11)) + } +} diff --git a/tests/baselines/reference/overloadOnConstInCallback1.types b/tests/baselines/reference/overloadOnConstInCallback1.types new file mode 100644 index 00000000000..c8c123df1e8 --- /dev/null +++ b/tests/baselines/reference/overloadOnConstInCallback1.types @@ -0,0 +1,36 @@ +=== tests/cases/compiler/overloadOnConstInCallback1.ts === +class C { +>C : C + + x1(a: number, callback: (x: 'hi') => number); // error +>x1 : (a: number, callback: (x: "hi") => number) => any +>a : number +>callback : (x: "hi") => number +>x : "hi" + + x1(a: number, callback: (x: any) => number) { +>x1 : (a: number, callback: (x: "hi") => number) => any +>a : number +>callback : (x: any) => number +>x : any + + callback('hi'); +>callback('hi') : number +>callback : (x: any) => number +>'hi' : string + + callback('bye'); +>callback('bye') : number +>callback : (x: any) => number +>'bye' : string + + var hm = "hm"; +>hm : string +>"hm" : string + + callback(hm); +>callback(hm) : number +>callback : (x: any) => number +>hm : string + } +} diff --git a/tests/baselines/reference/overloadOnConstInObjectLiteralImplementingAnInterface.errors.txt b/tests/baselines/reference/overloadOnConstInObjectLiteralImplementingAnInterface.errors.txt deleted file mode 100644 index 5788a9e6bbe..00000000000 --- a/tests/baselines/reference/overloadOnConstInObjectLiteralImplementingAnInterface.errors.txt +++ /dev/null @@ -1,14 +0,0 @@ -tests/cases/compiler/overloadOnConstInObjectLiteralImplementingAnInterface.ts(2,29): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/compiler/overloadOnConstInObjectLiteralImplementingAnInterface.ts(5,35): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. - - -==== tests/cases/compiler/overloadOnConstInObjectLiteralImplementingAnInterface.ts (2 errors) ==== - interface I { - x1(a: number, callback: (x: 'hi') => number); - ~~~~~~~~~~~~~~~~~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. - } - - var i2: I = { x1: (a: number, cb: (x: 'hi') => number) => { } }; // error - ~~~~~~~~~~~~~~~~~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. \ No newline at end of file diff --git a/tests/baselines/reference/overloadOnConstInObjectLiteralImplementingAnInterface.symbols b/tests/baselines/reference/overloadOnConstInObjectLiteralImplementingAnInterface.symbols new file mode 100644 index 00000000000..98873216523 --- /dev/null +++ b/tests/baselines/reference/overloadOnConstInObjectLiteralImplementingAnInterface.symbols @@ -0,0 +1,19 @@ +=== tests/cases/compiler/overloadOnConstInObjectLiteralImplementingAnInterface.ts === +interface I { +>I : Symbol(I, Decl(overloadOnConstInObjectLiteralImplementingAnInterface.ts, 0, 0)) + + x1(a: number, callback: (x: 'hi') => number); +>x1 : Symbol(I.x1, Decl(overloadOnConstInObjectLiteralImplementingAnInterface.ts, 0, 13)) +>a : Symbol(a, Decl(overloadOnConstInObjectLiteralImplementingAnInterface.ts, 1, 7)) +>callback : Symbol(callback, Decl(overloadOnConstInObjectLiteralImplementingAnInterface.ts, 1, 17)) +>x : Symbol(x, Decl(overloadOnConstInObjectLiteralImplementingAnInterface.ts, 1, 29)) +} + +var i2: I = { x1: (a: number, cb: (x: 'hi') => number) => { } }; // error +>i2 : Symbol(i2, Decl(overloadOnConstInObjectLiteralImplementingAnInterface.ts, 4, 3)) +>I : Symbol(I, Decl(overloadOnConstInObjectLiteralImplementingAnInterface.ts, 0, 0)) +>x1 : Symbol(x1, Decl(overloadOnConstInObjectLiteralImplementingAnInterface.ts, 4, 13)) +>a : Symbol(a, Decl(overloadOnConstInObjectLiteralImplementingAnInterface.ts, 4, 19)) +>cb : Symbol(cb, Decl(overloadOnConstInObjectLiteralImplementingAnInterface.ts, 4, 29)) +>x : Symbol(x, Decl(overloadOnConstInObjectLiteralImplementingAnInterface.ts, 4, 35)) + diff --git a/tests/baselines/reference/overloadOnConstInObjectLiteralImplementingAnInterface.types b/tests/baselines/reference/overloadOnConstInObjectLiteralImplementingAnInterface.types new file mode 100644 index 00000000000..e22162d1e7a --- /dev/null +++ b/tests/baselines/reference/overloadOnConstInObjectLiteralImplementingAnInterface.types @@ -0,0 +1,21 @@ +=== tests/cases/compiler/overloadOnConstInObjectLiteralImplementingAnInterface.ts === +interface I { +>I : I + + x1(a: number, callback: (x: 'hi') => number); +>x1 : (a: number, callback: (x: "hi") => number) => any +>a : number +>callback : (x: "hi") => number +>x : "hi" +} + +var i2: I = { x1: (a: number, cb: (x: 'hi') => number) => { } }; // error +>i2 : I +>I : I +>{ x1: (a: number, cb: (x: 'hi') => number) => { } } : { x1: (a: number, cb: (x: "hi") => number) => void; } +>x1 : (a: number, cb: (x: "hi") => number) => void +>(a: number, cb: (x: 'hi') => number) => { } : (a: number, cb: (x: "hi") => number) => void +>a : number +>cb : (x: "hi") => number +>x : "hi" + diff --git a/tests/baselines/reference/overloadOnConstInheritance1.symbols b/tests/baselines/reference/overloadOnConstInheritance1.symbols index c5cc9b52abc..4cd7ef13209 100644 --- a/tests/baselines/reference/overloadOnConstInheritance1.symbols +++ b/tests/baselines/reference/overloadOnConstInheritance1.symbols @@ -3,11 +3,11 @@ interface Base { >Base : Symbol(Base, Decl(overloadOnConstInheritance1.ts, 0, 0)) addEventListener(x: string): any; ->addEventListener : Symbol(addEventListener, Decl(overloadOnConstInheritance1.ts, 0, 16), Decl(overloadOnConstInheritance1.ts, 1, 37)) +>addEventListener : Symbol(Base.addEventListener, Decl(overloadOnConstInheritance1.ts, 0, 16), Decl(overloadOnConstInheritance1.ts, 1, 37)) >x : Symbol(x, Decl(overloadOnConstInheritance1.ts, 1, 21)) addEventListener(x: 'foo'): string; ->addEventListener : Symbol(addEventListener, Decl(overloadOnConstInheritance1.ts, 0, 16), Decl(overloadOnConstInheritance1.ts, 1, 37)) +>addEventListener : Symbol(Base.addEventListener, Decl(overloadOnConstInheritance1.ts, 0, 16), Decl(overloadOnConstInheritance1.ts, 1, 37)) >x : Symbol(x, Decl(overloadOnConstInheritance1.ts, 2, 21)) } interface Deriver extends Base { @@ -15,11 +15,11 @@ interface Deriver extends Base { >Base : Symbol(Base, Decl(overloadOnConstInheritance1.ts, 0, 0)) addEventListener(x: string): any; ->addEventListener : Symbol(addEventListener, Decl(overloadOnConstInheritance1.ts, 4, 32), Decl(overloadOnConstInheritance1.ts, 5, 37)) +>addEventListener : Symbol(Deriver.addEventListener, Decl(overloadOnConstInheritance1.ts, 4, 32), Decl(overloadOnConstInheritance1.ts, 5, 37)) >x : Symbol(x, Decl(overloadOnConstInheritance1.ts, 5, 21)) addEventListener(x: 'bar'): string; ->addEventListener : Symbol(addEventListener, Decl(overloadOnConstInheritance1.ts, 4, 32), Decl(overloadOnConstInheritance1.ts, 5, 37)) +>addEventListener : Symbol(Deriver.addEventListener, Decl(overloadOnConstInheritance1.ts, 4, 32), Decl(overloadOnConstInheritance1.ts, 5, 37)) >x : Symbol(x, Decl(overloadOnConstInheritance1.ts, 6, 21)) } diff --git a/tests/baselines/reference/overloadOnConstInheritance2.errors.txt b/tests/baselines/reference/overloadOnConstInheritance2.errors.txt index 4b502f145a6..8d104fc1ab0 100644 --- a/tests/baselines/reference/overloadOnConstInheritance2.errors.txt +++ b/tests/baselines/reference/overloadOnConstInheritance2.errors.txt @@ -1,11 +1,11 @@ tests/cases/compiler/overloadOnConstInheritance2.ts(5,11): error TS2430: Interface 'Deriver' incorrectly extends interface 'Base'. Types of property 'addEventListener' are incompatible. Type '(x: "bar") => string' is not assignable to type '{ (x: string): any; (x: "foo"): string; }'. - Type '(x: "bar") => string' provides no match for the signature '(x: string): any' -tests/cases/compiler/overloadOnConstInheritance2.ts(6,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. + Types of parameters 'x' and 'x' are incompatible. + Type '"foo"' is not assignable to type '"bar"'. -==== tests/cases/compiler/overloadOnConstInheritance2.ts (2 errors) ==== +==== tests/cases/compiler/overloadOnConstInheritance2.ts (1 errors) ==== interface Base { addEventListener(x: string): any; addEventListener(x: 'foo'): string; @@ -15,9 +15,8 @@ tests/cases/compiler/overloadOnConstInheritance2.ts(6,5): error TS2382: Speciali !!! error TS2430: Interface 'Deriver' incorrectly extends interface 'Base'. !!! error TS2430: Types of property 'addEventListener' are incompatible. !!! error TS2430: Type '(x: "bar") => string' is not assignable to type '{ (x: string): any; (x: "foo"): string; }'. -!!! error TS2430: Type '(x: "bar") => string' provides no match for the signature '(x: string): any' +!!! error TS2430: Types of parameters 'x' and 'x' are incompatible. +!!! error TS2430: Type '"foo"' is not assignable to type '"bar"'. addEventListener(x: 'bar'): string; // shouldn't need to redeclare the string overload - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. } \ No newline at end of file diff --git a/tests/baselines/reference/overloadOnConstInheritance3.errors.txt b/tests/baselines/reference/overloadOnConstInheritance3.errors.txt deleted file mode 100644 index 6d9f9b00692..00000000000 --- a/tests/baselines/reference/overloadOnConstInheritance3.errors.txt +++ /dev/null @@ -1,27 +0,0 @@ -tests/cases/compiler/overloadOnConstInheritance3.ts(4,11): error TS2430: Interface 'Deriver' incorrectly extends interface 'Base'. - Types of property 'addEventListener' are incompatible. - Type '{ (x: "bar"): string; (x: "foo"): string; }' is not assignable to type '(x: string) => any'. - Type '{ (x: "bar"): string; (x: "foo"): string; }' provides no match for the signature '(x: string): any' -tests/cases/compiler/overloadOnConstInheritance3.ts(6,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/compiler/overloadOnConstInheritance3.ts(7,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. - - -==== tests/cases/compiler/overloadOnConstInheritance3.ts (3 errors) ==== - interface Base { - addEventListener(x: string): any; - } - interface Deriver extends Base { - ~~~~~~~ -!!! error TS2430: Interface 'Deriver' incorrectly extends interface 'Base'. -!!! error TS2430: Types of property 'addEventListener' are incompatible. -!!! error TS2430: Type '{ (x: "bar"): string; (x: "foo"): string; }' is not assignable to type '(x: string) => any'. -!!! error TS2430: Type '{ (x: "bar"): string; (x: "foo"): string; }' provides no match for the signature '(x: string): any' - // shouldn't need to redeclare the string overload - addEventListener(x: 'bar'): string; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. - addEventListener(x: 'foo'): string; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. - } - \ No newline at end of file diff --git a/tests/baselines/reference/overloadOnConstInheritance3.symbols b/tests/baselines/reference/overloadOnConstInheritance3.symbols new file mode 100644 index 00000000000..e73c3e88084 --- /dev/null +++ b/tests/baselines/reference/overloadOnConstInheritance3.symbols @@ -0,0 +1,22 @@ +=== tests/cases/compiler/overloadOnConstInheritance3.ts === +interface Base { +>Base : Symbol(Base, Decl(overloadOnConstInheritance3.ts, 0, 0)) + + addEventListener(x: string): any; +>addEventListener : Symbol(Base.addEventListener, Decl(overloadOnConstInheritance3.ts, 0, 16)) +>x : Symbol(x, Decl(overloadOnConstInheritance3.ts, 1, 21)) +} +interface Deriver extends Base { +>Deriver : Symbol(Deriver, Decl(overloadOnConstInheritance3.ts, 2, 1)) +>Base : Symbol(Base, Decl(overloadOnConstInheritance3.ts, 0, 0)) + + // shouldn't need to redeclare the string overload + addEventListener(x: 'bar'): string; +>addEventListener : Symbol(Deriver.addEventListener, Decl(overloadOnConstInheritance3.ts, 3, 32), Decl(overloadOnConstInheritance3.ts, 5, 39)) +>x : Symbol(x, Decl(overloadOnConstInheritance3.ts, 5, 21)) + + addEventListener(x: 'foo'): string; +>addEventListener : Symbol(Deriver.addEventListener, Decl(overloadOnConstInheritance3.ts, 3, 32), Decl(overloadOnConstInheritance3.ts, 5, 39)) +>x : Symbol(x, Decl(overloadOnConstInheritance3.ts, 6, 21)) +} + diff --git a/tests/baselines/reference/overloadOnConstInheritance3.types b/tests/baselines/reference/overloadOnConstInheritance3.types new file mode 100644 index 00000000000..bd8d4ba1917 --- /dev/null +++ b/tests/baselines/reference/overloadOnConstInheritance3.types @@ -0,0 +1,22 @@ +=== tests/cases/compiler/overloadOnConstInheritance3.ts === +interface Base { +>Base : Base + + addEventListener(x: string): any; +>addEventListener : (x: string) => any +>x : string +} +interface Deriver extends Base { +>Deriver : Deriver +>Base : Base + + // shouldn't need to redeclare the string overload + addEventListener(x: 'bar'): string; +>addEventListener : { (x: "bar"): string; (x: "foo"): string; } +>x : "bar" + + addEventListener(x: 'foo'): string; +>addEventListener : { (x: "bar"): string; (x: "foo"): string; } +>x : "foo" +} + diff --git a/tests/baselines/reference/overloadOnConstInheritance4.errors.txt b/tests/baselines/reference/overloadOnConstInheritance4.errors.txt deleted file mode 100644 index 54200023408..00000000000 --- a/tests/baselines/reference/overloadOnConstInheritance4.errors.txt +++ /dev/null @@ -1,21 +0,0 @@ -tests/cases/compiler/overloadOnConstInheritance4.ts(2,29): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/compiler/overloadOnConstInheritance4.ts(5,29): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/compiler/overloadOnConstInheritance4.ts(6,29): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. - - -==== tests/cases/compiler/overloadOnConstInheritance4.ts (3 errors) ==== - interface I { - x1(a: number, callback: (x: 'hi') => number); - ~~~~~~~~~~~~~~~~~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. - } - class C implements I { - x1(a: number, callback: (x: 'hi') => number); - ~~~~~~~~~~~~~~~~~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. - x1(a: number, callback: (x: 'hi') => number) { - ~~~~~~~~~~~~~~~~~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. - } - } - \ No newline at end of file diff --git a/tests/baselines/reference/overloadOnConstInheritance4.symbols b/tests/baselines/reference/overloadOnConstInheritance4.symbols new file mode 100644 index 00000000000..8902b0442fd --- /dev/null +++ b/tests/baselines/reference/overloadOnConstInheritance4.symbols @@ -0,0 +1,28 @@ +=== tests/cases/compiler/overloadOnConstInheritance4.ts === +interface I { +>I : Symbol(I, Decl(overloadOnConstInheritance4.ts, 0, 0)) + + x1(a: number, callback: (x: 'hi') => number); +>x1 : Symbol(I.x1, Decl(overloadOnConstInheritance4.ts, 0, 13)) +>a : Symbol(a, Decl(overloadOnConstInheritance4.ts, 1, 7)) +>callback : Symbol(callback, Decl(overloadOnConstInheritance4.ts, 1, 17)) +>x : Symbol(x, Decl(overloadOnConstInheritance4.ts, 1, 29)) +} +class C implements I { +>C : Symbol(C, Decl(overloadOnConstInheritance4.ts, 2, 1)) +>I : Symbol(I, Decl(overloadOnConstInheritance4.ts, 0, 0)) + + x1(a: number, callback: (x: 'hi') => number); +>x1 : Symbol(C.x1, Decl(overloadOnConstInheritance4.ts, 3, 22), Decl(overloadOnConstInheritance4.ts, 4, 49)) +>a : Symbol(a, Decl(overloadOnConstInheritance4.ts, 4, 7)) +>callback : Symbol(callback, Decl(overloadOnConstInheritance4.ts, 4, 17)) +>x : Symbol(x, Decl(overloadOnConstInheritance4.ts, 4, 29)) + + x1(a: number, callback: (x: 'hi') => number) { +>x1 : Symbol(C.x1, Decl(overloadOnConstInheritance4.ts, 3, 22), Decl(overloadOnConstInheritance4.ts, 4, 49)) +>a : Symbol(a, Decl(overloadOnConstInheritance4.ts, 5, 7)) +>callback : Symbol(callback, Decl(overloadOnConstInheritance4.ts, 5, 17)) +>x : Symbol(x, Decl(overloadOnConstInheritance4.ts, 5, 29)) + } +} + diff --git a/tests/baselines/reference/overloadOnConstInheritance4.types b/tests/baselines/reference/overloadOnConstInheritance4.types new file mode 100644 index 00000000000..cacd3adfcc9 --- /dev/null +++ b/tests/baselines/reference/overloadOnConstInheritance4.types @@ -0,0 +1,28 @@ +=== tests/cases/compiler/overloadOnConstInheritance4.ts === +interface I { +>I : I + + x1(a: number, callback: (x: 'hi') => number); +>x1 : (a: number, callback: (x: "hi") => number) => any +>a : number +>callback : (x: "hi") => number +>x : "hi" +} +class C implements I { +>C : C +>I : I + + x1(a: number, callback: (x: 'hi') => number); +>x1 : (a: number, callback: (x: "hi") => number) => any +>a : number +>callback : (x: "hi") => number +>x : "hi" + + x1(a: number, callback: (x: 'hi') => number) { +>x1 : (a: number, callback: (x: "hi") => number) => any +>a : number +>callback : (x: "hi") => number +>x : "hi" + } +} + diff --git a/tests/baselines/reference/overloadOnConstNoAnyImplementation.errors.txt b/tests/baselines/reference/overloadOnConstNoAnyImplementation.errors.txt index 2827a97ca82..fe5219606ff 100644 --- a/tests/baselines/reference/overloadOnConstNoAnyImplementation.errors.txt +++ b/tests/baselines/reference/overloadOnConstNoAnyImplementation.errors.txt @@ -1,16 +1,9 @@ -tests/cases/compiler/overloadOnConstNoAnyImplementation.ts(1,28): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/compiler/overloadOnConstNoAnyImplementation.ts(2,28): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. tests/cases/compiler/overloadOnConstNoAnyImplementation.ts(9,8): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. -tests/cases/compiler/overloadOnConstNoAnyImplementation.ts(14,7): error TS2381: A signature with an implementation cannot use a string literal type. -==== tests/cases/compiler/overloadOnConstNoAnyImplementation.ts (4 errors) ==== +==== tests/cases/compiler/overloadOnConstNoAnyImplementation.ts (1 errors) ==== function x1(a: number, cb: (x: 'hi') => number); - ~~~~~~~~~~~~~~~~~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. function x1(a: number, cb: (x: 'bye') => number); - ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. function x1(a: number, cb: (x: string) => number) { cb('hi'); cb('bye'); @@ -25,6 +18,4 @@ tests/cases/compiler/overloadOnConstNoAnyImplementation.ts(14,7): error TS2381: var cb: (number) => number = (x: number) => 1; x1(1, cb); x1(1, (x: 'hi') => 1); // error - ~~~~~~~~~~~~~~ -!!! error TS2381: A signature with an implementation cannot use a string literal type. x1(1, (x: string) => 1); \ No newline at end of file diff --git a/tests/baselines/reference/overloadOnConstNoAnyImplementation2.errors.txt b/tests/baselines/reference/overloadOnConstNoAnyImplementation2.errors.txt index aab390c48e8..8723a79d474 100644 --- a/tests/baselines/reference/overloadOnConstNoAnyImplementation2.errors.txt +++ b/tests/baselines/reference/overloadOnConstNoAnyImplementation2.errors.txt @@ -1,21 +1,19 @@ -tests/cases/compiler/overloadOnConstNoAnyImplementation2.ts(2,29): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/compiler/overloadOnConstNoAnyImplementation2.ts(6,29): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. tests/cases/compiler/overloadOnConstNoAnyImplementation2.ts(12,18): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. -tests/cases/compiler/overloadOnConstNoAnyImplementation2.ts(17,9): error TS2381: A signature with an implementation cannot use a string literal type. -tests/cases/compiler/overloadOnConstNoAnyImplementation2.ts(18,9): error TS2381: A signature with an implementation cannot use a string literal type. +tests/cases/compiler/overloadOnConstNoAnyImplementation2.ts(18,9): error TS2345: Argument of type '(x: "bye") => number' is not assignable to parameter of type '(x: "hi") => number'. + Types of parameters 'x' and 'x' are incompatible. + Type '"hi"' is not assignable to type '"bye"'. +tests/cases/compiler/overloadOnConstNoAnyImplementation2.ts(21,9): error TS2345: Argument of type '(x: number) => number' is not assignable to parameter of type '(x: "hi") => number'. + Types of parameters 'x' and 'x' are incompatible. + Type '"hi"' is not assignable to type 'number'. -==== tests/cases/compiler/overloadOnConstNoAnyImplementation2.ts (5 errors) ==== +==== tests/cases/compiler/overloadOnConstNoAnyImplementation2.ts (3 errors) ==== interface I { x1(a: number, callback: (x: 'hi') => number); - ~~~~~~~~~~~~~~~~~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. } class C { x1(a: number, callback: (x: 'hi') => number); - ~~~~~~~~~~~~~~~~~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. x1(a: number, callback: (x: string) => number) { callback('hi'); callback('bye'); @@ -29,11 +27,15 @@ tests/cases/compiler/overloadOnConstNoAnyImplementation2.ts(18,9): error TS2381: var c: C; c.x1(1, (x: 'hi') => { return 1; } ); - ~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2381: A signature with an implementation cannot use a string literal type. c.x1(1, (x: 'bye') => { return 1; } ); ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2381: A signature with an implementation cannot use a string literal type. +!!! error TS2345: Argument of type '(x: "bye") => number' is not assignable to parameter of type '(x: "hi") => number'. +!!! error TS2345: Types of parameters 'x' and 'x' are incompatible. +!!! error TS2345: Type '"hi"' is not assignable to type '"bye"'. c.x1(1, (x) => { return 1; } ); - c.x1(1, (x: number) => { return 1; } ); \ No newline at end of file + c.x1(1, (x: number) => { return 1; } ); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2345: Argument of type '(x: number) => number' is not assignable to parameter of type '(x: "hi") => number'. +!!! error TS2345: Types of parameters 'x' and 'x' are incompatible. +!!! error TS2345: Type '"hi"' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/overloadOnConstNoNonSpecializedSignature.errors.txt b/tests/baselines/reference/overloadOnConstNoNonSpecializedSignature.errors.txt deleted file mode 100644 index 6b96abce29e..00000000000 --- a/tests/baselines/reference/overloadOnConstNoNonSpecializedSignature.errors.txt +++ /dev/null @@ -1,11 +0,0 @@ -tests/cases/compiler/overloadOnConstNoNonSpecializedSignature.ts(2,4): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. - - -==== tests/cases/compiler/overloadOnConstNoNonSpecializedSignature.ts (1 errors) ==== - class C { - x1(a: 'hi'); // error, no non-specialized signature in overload list - ~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. - x1(a: string) { } - } - \ No newline at end of file diff --git a/tests/baselines/reference/overloadOnConstNoNonSpecializedSignature.symbols b/tests/baselines/reference/overloadOnConstNoNonSpecializedSignature.symbols new file mode 100644 index 00000000000..bb1633940ba --- /dev/null +++ b/tests/baselines/reference/overloadOnConstNoNonSpecializedSignature.symbols @@ -0,0 +1,13 @@ +=== tests/cases/compiler/overloadOnConstNoNonSpecializedSignature.ts === +class C { +>C : Symbol(C, Decl(overloadOnConstNoNonSpecializedSignature.ts, 0, 0)) + + x1(a: 'hi'); // error, no non-specialized signature in overload list +>x1 : Symbol(C.x1, Decl(overloadOnConstNoNonSpecializedSignature.ts, 0, 9), Decl(overloadOnConstNoNonSpecializedSignature.ts, 1, 15)) +>a : Symbol(a, Decl(overloadOnConstNoNonSpecializedSignature.ts, 1, 6)) + + x1(a: string) { } +>x1 : Symbol(C.x1, Decl(overloadOnConstNoNonSpecializedSignature.ts, 0, 9), Decl(overloadOnConstNoNonSpecializedSignature.ts, 1, 15)) +>a : Symbol(a, Decl(overloadOnConstNoNonSpecializedSignature.ts, 2, 6)) +} + diff --git a/tests/baselines/reference/overloadOnConstNoNonSpecializedSignature.types b/tests/baselines/reference/overloadOnConstNoNonSpecializedSignature.types new file mode 100644 index 00000000000..09360b748c3 --- /dev/null +++ b/tests/baselines/reference/overloadOnConstNoNonSpecializedSignature.types @@ -0,0 +1,13 @@ +=== tests/cases/compiler/overloadOnConstNoNonSpecializedSignature.ts === +class C { +>C : C + + x1(a: 'hi'); // error, no non-specialized signature in overload list +>x1 : (a: "hi") => any +>a : "hi" + + x1(a: string) { } +>x1 : (a: "hi") => any +>a : string +} + diff --git a/tests/baselines/reference/overloadOnConstNoStringImplementation.errors.txt b/tests/baselines/reference/overloadOnConstNoStringImplementation.errors.txt deleted file mode 100644 index 12dcdaf9769..00000000000 --- a/tests/baselines/reference/overloadOnConstNoStringImplementation.errors.txt +++ /dev/null @@ -1,27 +0,0 @@ -tests/cases/compiler/overloadOnConstNoStringImplementation.ts(1,28): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/compiler/overloadOnConstNoStringImplementation.ts(2,28): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/compiler/overloadOnConstNoStringImplementation.ts(14,7): error TS2381: A signature with an implementation cannot use a string literal type. - - -==== tests/cases/compiler/overloadOnConstNoStringImplementation.ts (3 errors) ==== - function x2(a: number, cb: (x: 'hi') => number); - ~~~~~~~~~~~~~~~~~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. - function x2(a: number, cb: (x: 'bye') => number); - ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. - function x2(a: number, cb: (x: any) => number) { - cb('hi'); - cb('bye'); - var hm = 'hm'; - cb(hm); // should this work without a string definition? - cb('uh'); - cb(1); - } - - var cb: (number) => number = (x: number) => 1; - x2(1, cb); // error - x2(1, (x: 'hi') => 1); // error - ~~~~~~~~~~~~~~ -!!! error TS2381: A signature with an implementation cannot use a string literal type. - x2(1, (x: string) => 1); \ No newline at end of file diff --git a/tests/baselines/reference/overloadOnConstNoStringImplementation.symbols b/tests/baselines/reference/overloadOnConstNoStringImplementation.symbols new file mode 100644 index 00000000000..a8d3bd7953d --- /dev/null +++ b/tests/baselines/reference/overloadOnConstNoStringImplementation.symbols @@ -0,0 +1,56 @@ +=== tests/cases/compiler/overloadOnConstNoStringImplementation.ts === +function x2(a: number, cb: (x: 'hi') => number); +>x2 : Symbol(x2, Decl(overloadOnConstNoStringImplementation.ts, 0, 0), Decl(overloadOnConstNoStringImplementation.ts, 0, 48), Decl(overloadOnConstNoStringImplementation.ts, 1, 49)) +>a : Symbol(a, Decl(overloadOnConstNoStringImplementation.ts, 0, 12)) +>cb : Symbol(cb, Decl(overloadOnConstNoStringImplementation.ts, 0, 22)) +>x : Symbol(x, Decl(overloadOnConstNoStringImplementation.ts, 0, 28)) + +function x2(a: number, cb: (x: 'bye') => number); +>x2 : Symbol(x2, Decl(overloadOnConstNoStringImplementation.ts, 0, 0), Decl(overloadOnConstNoStringImplementation.ts, 0, 48), Decl(overloadOnConstNoStringImplementation.ts, 1, 49)) +>a : Symbol(a, Decl(overloadOnConstNoStringImplementation.ts, 1, 12)) +>cb : Symbol(cb, Decl(overloadOnConstNoStringImplementation.ts, 1, 22)) +>x : Symbol(x, Decl(overloadOnConstNoStringImplementation.ts, 1, 28)) + +function x2(a: number, cb: (x: any) => number) { +>x2 : Symbol(x2, Decl(overloadOnConstNoStringImplementation.ts, 0, 0), Decl(overloadOnConstNoStringImplementation.ts, 0, 48), Decl(overloadOnConstNoStringImplementation.ts, 1, 49)) +>a : Symbol(a, Decl(overloadOnConstNoStringImplementation.ts, 2, 12)) +>cb : Symbol(cb, Decl(overloadOnConstNoStringImplementation.ts, 2, 22)) +>x : Symbol(x, Decl(overloadOnConstNoStringImplementation.ts, 2, 28)) + + cb('hi'); +>cb : Symbol(cb, Decl(overloadOnConstNoStringImplementation.ts, 2, 22)) + + cb('bye'); +>cb : Symbol(cb, Decl(overloadOnConstNoStringImplementation.ts, 2, 22)) + + var hm = 'hm'; +>hm : Symbol(hm, Decl(overloadOnConstNoStringImplementation.ts, 5, 7)) + + cb(hm); // should this work without a string definition? +>cb : Symbol(cb, Decl(overloadOnConstNoStringImplementation.ts, 2, 22)) +>hm : Symbol(hm, Decl(overloadOnConstNoStringImplementation.ts, 5, 7)) + + cb('uh'); +>cb : Symbol(cb, Decl(overloadOnConstNoStringImplementation.ts, 2, 22)) + + cb(1); +>cb : Symbol(cb, Decl(overloadOnConstNoStringImplementation.ts, 2, 22)) +} + +var cb: (number) => number = (x: number) => 1; +>cb : Symbol(cb, Decl(overloadOnConstNoStringImplementation.ts, 11, 3)) +>number : Symbol(number, Decl(overloadOnConstNoStringImplementation.ts, 11, 9)) +>x : Symbol(x, Decl(overloadOnConstNoStringImplementation.ts, 11, 30)) + +x2(1, cb); // error +>x2 : Symbol(x2, Decl(overloadOnConstNoStringImplementation.ts, 0, 0), Decl(overloadOnConstNoStringImplementation.ts, 0, 48), Decl(overloadOnConstNoStringImplementation.ts, 1, 49)) +>cb : Symbol(cb, Decl(overloadOnConstNoStringImplementation.ts, 11, 3)) + +x2(1, (x: 'hi') => 1); // error +>x2 : Symbol(x2, Decl(overloadOnConstNoStringImplementation.ts, 0, 0), Decl(overloadOnConstNoStringImplementation.ts, 0, 48), Decl(overloadOnConstNoStringImplementation.ts, 1, 49)) +>x : Symbol(x, Decl(overloadOnConstNoStringImplementation.ts, 13, 7)) + +x2(1, (x: string) => 1); +>x2 : Symbol(x2, Decl(overloadOnConstNoStringImplementation.ts, 0, 0), Decl(overloadOnConstNoStringImplementation.ts, 0, 48), Decl(overloadOnConstNoStringImplementation.ts, 1, 49)) +>x : Symbol(x, Decl(overloadOnConstNoStringImplementation.ts, 14, 7)) + diff --git a/tests/baselines/reference/overloadOnConstNoStringImplementation.types b/tests/baselines/reference/overloadOnConstNoStringImplementation.types new file mode 100644 index 00000000000..9161620841f --- /dev/null +++ b/tests/baselines/reference/overloadOnConstNoStringImplementation.types @@ -0,0 +1,78 @@ +=== tests/cases/compiler/overloadOnConstNoStringImplementation.ts === +function x2(a: number, cb: (x: 'hi') => number); +>x2 : { (a: number, cb: (x: "hi") => number): any; (a: number, cb: (x: "bye") => number): any; } +>a : number +>cb : (x: "hi") => number +>x : "hi" + +function x2(a: number, cb: (x: 'bye') => number); +>x2 : { (a: number, cb: (x: "hi") => number): any; (a: number, cb: (x: "bye") => number): any; } +>a : number +>cb : (x: "bye") => number +>x : "bye" + +function x2(a: number, cb: (x: any) => number) { +>x2 : { (a: number, cb: (x: "hi") => number): any; (a: number, cb: (x: "bye") => number): any; } +>a : number +>cb : (x: any) => number +>x : any + + cb('hi'); +>cb('hi') : number +>cb : (x: any) => number +>'hi' : string + + cb('bye'); +>cb('bye') : number +>cb : (x: any) => number +>'bye' : string + + var hm = 'hm'; +>hm : string +>'hm' : string + + cb(hm); // should this work without a string definition? +>cb(hm) : number +>cb : (x: any) => number +>hm : string + + cb('uh'); +>cb('uh') : number +>cb : (x: any) => number +>'uh' : string + + cb(1); +>cb(1) : number +>cb : (x: any) => number +>1 : number +} + +var cb: (number) => number = (x: number) => 1; +>cb : (number: any) => number +>number : any +>(x: number) => 1 : (x: number) => number +>x : number +>1 : number + +x2(1, cb); // error +>x2(1, cb) : any +>x2 : { (a: number, cb: (x: "hi") => number): any; (a: number, cb: (x: "bye") => number): any; } +>1 : number +>cb : (number: any) => number + +x2(1, (x: 'hi') => 1); // error +>x2(1, (x: 'hi') => 1) : any +>x2 : { (a: number, cb: (x: "hi") => number): any; (a: number, cb: (x: "bye") => number): any; } +>1 : number +>(x: 'hi') => 1 : (x: "hi") => number +>x : "hi" +>1 : number + +x2(1, (x: string) => 1); +>x2(1, (x: string) => 1) : any +>x2 : { (a: number, cb: (x: "hi") => number): any; (a: number, cb: (x: "bye") => number): any; } +>1 : number +>(x: string) => 1 : (x: string) => number +>x : string +>1 : number + diff --git a/tests/baselines/reference/overloadOnConstNoStringImplementation2.errors.txt b/tests/baselines/reference/overloadOnConstNoStringImplementation2.errors.txt index c85b004f160..e7ac72eb052 100644 --- a/tests/baselines/reference/overloadOnConstNoStringImplementation2.errors.txt +++ b/tests/baselines/reference/overloadOnConstNoStringImplementation2.errors.txt @@ -1,20 +1,18 @@ -tests/cases/compiler/overloadOnConstNoStringImplementation2.ts(2,29): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/compiler/overloadOnConstNoStringImplementation2.ts(6,29): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/compiler/overloadOnConstNoStringImplementation2.ts(17,9): error TS2381: A signature with an implementation cannot use a string literal type. -tests/cases/compiler/overloadOnConstNoStringImplementation2.ts(18,9): error TS2381: A signature with an implementation cannot use a string literal type. +tests/cases/compiler/overloadOnConstNoStringImplementation2.ts(18,9): error TS2345: Argument of type '(x: "bye") => number' is not assignable to parameter of type '(x: "hi") => number'. + Types of parameters 'x' and 'x' are incompatible. + Type '"hi"' is not assignable to type '"bye"'. +tests/cases/compiler/overloadOnConstNoStringImplementation2.ts(20,9): error TS2345: Argument of type '(x: number) => number' is not assignable to parameter of type '(x: "hi") => number'. + Types of parameters 'x' and 'x' are incompatible. + Type '"hi"' is not assignable to type 'number'. -==== tests/cases/compiler/overloadOnConstNoStringImplementation2.ts (4 errors) ==== +==== tests/cases/compiler/overloadOnConstNoStringImplementation2.ts (2 errors) ==== interface I { x1(a: number, callback: (x: 'hi') => number); - ~~~~~~~~~~~~~~~~~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. } class C implements I { x1(a: number, callback: (x: 'hi') => number); - ~~~~~~~~~~~~~~~~~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. x1(a: number, callback: (x: any) => number) { callback('hi'); callback('bye'); @@ -26,10 +24,14 @@ tests/cases/compiler/overloadOnConstNoStringImplementation2.ts(18,9): error TS23 var c: C; c.x1(1, (x: 'hi') => { return 1; } ); - ~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2381: A signature with an implementation cannot use a string literal type. c.x1(1, (x: 'bye') => { return 1; } ); ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2381: A signature with an implementation cannot use a string literal type. +!!! error TS2345: Argument of type '(x: "bye") => number' is not assignable to parameter of type '(x: "hi") => number'. +!!! error TS2345: Types of parameters 'x' and 'x' are incompatible. +!!! error TS2345: Type '"hi"' is not assignable to type '"bye"'. c.x1(1, (x: string) => { return 1; } ); - c.x1(1, (x: number) => { return 1; } ); \ No newline at end of file + c.x1(1, (x: number) => { return 1; } ); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2345: Argument of type '(x: number) => number' is not assignable to parameter of type '(x: "hi") => number'. +!!! error TS2345: Types of parameters 'x' and 'x' are incompatible. +!!! error TS2345: Type '"hi"' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/overloadOnConstantsInvalidOverload1.errors.txt b/tests/baselines/reference/overloadOnConstantsInvalidOverload1.errors.txt index 4fea7cc1227..3fe0a43d855 100644 --- a/tests/baselines/reference/overloadOnConstantsInvalidOverload1.errors.txt +++ b/tests/baselines/reference/overloadOnConstantsInvalidOverload1.errors.txt @@ -1,9 +1,8 @@ -tests/cases/compiler/overloadOnConstantsInvalidOverload1.ts(6,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/compiler/overloadOnConstantsInvalidOverload1.ts(7,10): error TS2381: A signature with an implementation cannot use a string literal type. +tests/cases/compiler/overloadOnConstantsInvalidOverload1.ts(6,10): error TS2394: Overload signature is not compatible with function implementation. tests/cases/compiler/overloadOnConstantsInvalidOverload1.ts(11,5): error TS2345: Argument of type '"HI"' is not assignable to parameter of type '"SPAN"'. -==== tests/cases/compiler/overloadOnConstantsInvalidOverload1.ts (3 errors) ==== +==== tests/cases/compiler/overloadOnConstantsInvalidOverload1.ts (2 errors) ==== class Base { foo() { } } class Derived1 extends Base { bar() { } } class Derived2 extends Base { baz() { } } @@ -11,10 +10,8 @@ tests/cases/compiler/overloadOnConstantsInvalidOverload1.ts(11,5): error TS2345: function foo(name: "SPAN"): Derived1; ~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +!!! error TS2394: Overload signature is not compatible with function implementation. function foo(name: "DIV"): Derived2 { - ~~~ -!!! error TS2381: A signature with an implementation cannot use a string literal type. return null; } diff --git a/tests/baselines/reference/overloadOnGenericArity.symbols b/tests/baselines/reference/overloadOnGenericArity.symbols index a9fddb65177..a50a788b4e8 100644 --- a/tests/baselines/reference/overloadOnGenericArity.symbols +++ b/tests/baselines/reference/overloadOnGenericArity.symbols @@ -3,14 +3,14 @@ interface Test { >Test : Symbol(Test, Decl(overloadOnGenericArity.ts, 0, 0)) then(p: string): string; ->then : Symbol(then, Decl(overloadOnGenericArity.ts, 0, 16), Decl(overloadOnGenericArity.ts, 1, 31)) +>then : Symbol(Test.then, Decl(overloadOnGenericArity.ts, 0, 16), Decl(overloadOnGenericArity.ts, 1, 31)) >U : Symbol(U, Decl(overloadOnGenericArity.ts, 1, 9)) >p : Symbol(p, Decl(overloadOnGenericArity.ts, 1, 12)) then(p: string): Date; // Error: Overloads cannot differ only by return type ->then : Symbol(then, Decl(overloadOnGenericArity.ts, 0, 16), Decl(overloadOnGenericArity.ts, 1, 31)) +>then : Symbol(Test.then, Decl(overloadOnGenericArity.ts, 0, 16), Decl(overloadOnGenericArity.ts, 1, 31)) >p : Symbol(p, Decl(overloadOnGenericArity.ts, 2, 9)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) } diff --git a/tests/baselines/reference/overloadOnGenericClassAndNonGenericClass.symbols b/tests/baselines/reference/overloadOnGenericClassAndNonGenericClass.symbols index 8c4b74f89a2..daf7c34cf00 100644 --- a/tests/baselines/reference/overloadOnGenericClassAndNonGenericClass.symbols +++ b/tests/baselines/reference/overloadOnGenericClassAndNonGenericClass.symbols @@ -1,29 +1,29 @@ === tests/cases/compiler/overloadOnGenericClassAndNonGenericClass.ts === class A { a; } >A : Symbol(A, Decl(overloadOnGenericClassAndNonGenericClass.ts, 0, 0)) ->a : Symbol(a, Decl(overloadOnGenericClassAndNonGenericClass.ts, 0, 9)) +>a : Symbol(A.a, Decl(overloadOnGenericClassAndNonGenericClass.ts, 0, 9)) class B { b; } >B : Symbol(B, Decl(overloadOnGenericClassAndNonGenericClass.ts, 0, 14)) ->b : Symbol(b, Decl(overloadOnGenericClassAndNonGenericClass.ts, 1, 9)) +>b : Symbol(B.b, Decl(overloadOnGenericClassAndNonGenericClass.ts, 1, 9)) class C { c; } >C : Symbol(C, Decl(overloadOnGenericClassAndNonGenericClass.ts, 1, 14)) ->c : Symbol(c, Decl(overloadOnGenericClassAndNonGenericClass.ts, 2, 9)) +>c : Symbol(C.c, Decl(overloadOnGenericClassAndNonGenericClass.ts, 2, 9)) class X { x: T; } >X : Symbol(X, Decl(overloadOnGenericClassAndNonGenericClass.ts, 2, 14)) >T : Symbol(T, Decl(overloadOnGenericClassAndNonGenericClass.ts, 3, 8)) ->x : Symbol(x, Decl(overloadOnGenericClassAndNonGenericClass.ts, 3, 12)) +>x : Symbol(X.x, Decl(overloadOnGenericClassAndNonGenericClass.ts, 3, 12)) >T : Symbol(T, Decl(overloadOnGenericClassAndNonGenericClass.ts, 3, 8)) class X1 { x: string; } >X1 : Symbol(X1, Decl(overloadOnGenericClassAndNonGenericClass.ts, 3, 20)) ->x : Symbol(x, Decl(overloadOnGenericClassAndNonGenericClass.ts, 4, 10)) +>x : Symbol(X1.x, Decl(overloadOnGenericClassAndNonGenericClass.ts, 4, 10)) class X2 { x: string; } >X2 : Symbol(X2, Decl(overloadOnGenericClassAndNonGenericClass.ts, 4, 23)) ->x : Symbol(x, Decl(overloadOnGenericClassAndNonGenericClass.ts, 5, 10)) +>x : Symbol(X2.x, Decl(overloadOnGenericClassAndNonGenericClass.ts, 5, 10)) function f(a: X1): A; >f : Symbol(f, Decl(overloadOnGenericClassAndNonGenericClass.ts, 5, 23), Decl(overloadOnGenericClassAndNonGenericClass.ts, 6, 21), Decl(overloadOnGenericClassAndNonGenericClass.ts, 7, 26)) diff --git a/tests/baselines/reference/overloadResolutionOverNonCTObjectLit.symbols b/tests/baselines/reference/overloadResolutionOverNonCTObjectLit.symbols index d352216b74e..7ca4614ebe7 100644 --- a/tests/baselines/reference/overloadResolutionOverNonCTObjectLit.symbols +++ b/tests/baselines/reference/overloadResolutionOverNonCTObjectLit.symbols @@ -6,13 +6,13 @@ module Bugs { >IToken : Symbol(IToken, Decl(overloadResolutionOverNonCTObjectLit.ts, 0, 13)) startIndex:number; ->startIndex : Symbol(startIndex, Decl(overloadResolutionOverNonCTObjectLit.ts, 1, 41)) +>startIndex : Symbol(IToken.startIndex, Decl(overloadResolutionOverNonCTObjectLit.ts, 1, 41)) type:string; ->type : Symbol(type, Decl(overloadResolutionOverNonCTObjectLit.ts, 2, 50)) +>type : Symbol(IToken.type, Decl(overloadResolutionOverNonCTObjectLit.ts, 2, 50)) bracket:number; ->bracket : Symbol(bracket, Decl(overloadResolutionOverNonCTObjectLit.ts, 3, 44)) +>bracket : Symbol(IToken.bracket, Decl(overloadResolutionOverNonCTObjectLit.ts, 3, 44)) } export interface IState { @@ -24,11 +24,11 @@ module Bugs { >IToken : Symbol(IToken, Decl(overloadResolutionOverNonCTObjectLit.ts, 0, 13)) state: IState; ->state : Symbol(state, Decl(overloadResolutionOverNonCTObjectLit.ts, 10, 61)) +>state : Symbol(IStateToken.state, Decl(overloadResolutionOverNonCTObjectLit.ts, 10, 61)) >IState : Symbol(IState, Decl(overloadResolutionOverNonCTObjectLit.ts, 5, 17)) length: number; ->length : Symbol(length, Decl(overloadResolutionOverNonCTObjectLit.ts, 11, 46)) +>length : Symbol(IStateToken.length, Decl(overloadResolutionOverNonCTObjectLit.ts, 11, 46)) } function bug3() { diff --git a/tests/baselines/reference/overloadRet.symbols b/tests/baselines/reference/overloadRet.symbols index 0c645b7c4b8..cfb33663b7f 100644 --- a/tests/baselines/reference/overloadRet.symbols +++ b/tests/baselines/reference/overloadRet.symbols @@ -3,36 +3,36 @@ interface I { >I : Symbol(I, Decl(overloadRet.ts, 0, 0)) f(s:string):number; ->f : Symbol(f, Decl(overloadRet.ts, 0, 13), Decl(overloadRet.ts, 1, 23)) +>f : Symbol(I.f, Decl(overloadRet.ts, 0, 13), Decl(overloadRet.ts, 1, 23)) >s : Symbol(s, Decl(overloadRet.ts, 1, 6)) f(n:number):string; ->f : Symbol(f, Decl(overloadRet.ts, 0, 13), Decl(overloadRet.ts, 1, 23)) +>f : Symbol(I.f, Decl(overloadRet.ts, 0, 13), Decl(overloadRet.ts, 1, 23)) >n : Symbol(n, Decl(overloadRet.ts, 2, 6)) g(n:number):any; ->g : Symbol(g, Decl(overloadRet.ts, 2, 23), Decl(overloadRet.ts, 3, 20)) +>g : Symbol(I.g, Decl(overloadRet.ts, 2, 23), Decl(overloadRet.ts, 3, 20)) >n : Symbol(n, Decl(overloadRet.ts, 3, 6)) g(n:number,m:number):string; ->g : Symbol(g, Decl(overloadRet.ts, 2, 23), Decl(overloadRet.ts, 3, 20)) +>g : Symbol(I.g, Decl(overloadRet.ts, 2, 23), Decl(overloadRet.ts, 3, 20)) >n : Symbol(n, Decl(overloadRet.ts, 4, 6)) >m : Symbol(m, Decl(overloadRet.ts, 4, 15)) h(n:number):I; ->h : Symbol(h, Decl(overloadRet.ts, 4, 32), Decl(overloadRet.ts, 5, 18)) +>h : Symbol(I.h, Decl(overloadRet.ts, 4, 32), Decl(overloadRet.ts, 5, 18)) >n : Symbol(n, Decl(overloadRet.ts, 5, 6)) >I : Symbol(I, Decl(overloadRet.ts, 0, 0)) h(b:boolean):number; ->h : Symbol(h, Decl(overloadRet.ts, 4, 32), Decl(overloadRet.ts, 5, 18)) +>h : Symbol(I.h, Decl(overloadRet.ts, 4, 32), Decl(overloadRet.ts, 5, 18)) >b : Symbol(b, Decl(overloadRet.ts, 6, 6)) i(b:boolean):number; ->i : Symbol(i, Decl(overloadRet.ts, 6, 24), Decl(overloadRet.ts, 7, 24)) +>i : Symbol(I.i, Decl(overloadRet.ts, 6, 24), Decl(overloadRet.ts, 7, 24)) >b : Symbol(b, Decl(overloadRet.ts, 7, 6)) i(b:boolean):any; ->i : Symbol(i, Decl(overloadRet.ts, 6, 24), Decl(overloadRet.ts, 7, 24)) +>i : Symbol(I.i, Decl(overloadRet.ts, 6, 24), Decl(overloadRet.ts, 7, 24)) >b : Symbol(b, Decl(overloadRet.ts, 8, 6)) } diff --git a/tests/baselines/reference/overloadReturnTypes.symbols b/tests/baselines/reference/overloadReturnTypes.symbols index b76efb4a0d6..88fda7bfdbb 100644 --- a/tests/baselines/reference/overloadReturnTypes.symbols +++ b/tests/baselines/reference/overloadReturnTypes.symbols @@ -41,17 +41,17 @@ interface IFace { >IFace : Symbol(IFace, Decl(overloadReturnTypes.ts, 14, 1)) attr(name:string):string; ->attr : Symbol(attr, Decl(overloadReturnTypes.ts, 17, 17), Decl(overloadReturnTypes.ts, 18, 26), Decl(overloadReturnTypes.ts, 19, 45)) +>attr : Symbol(IFace.attr, Decl(overloadReturnTypes.ts, 17, 17), Decl(overloadReturnTypes.ts, 18, 26), Decl(overloadReturnTypes.ts, 19, 45)) >name : Symbol(name, Decl(overloadReturnTypes.ts, 18, 6)) attr(name: string, value: string): Accessor; ->attr : Symbol(attr, Decl(overloadReturnTypes.ts, 17, 17), Decl(overloadReturnTypes.ts, 18, 26), Decl(overloadReturnTypes.ts, 19, 45)) +>attr : Symbol(IFace.attr, Decl(overloadReturnTypes.ts, 17, 17), Decl(overloadReturnTypes.ts, 18, 26), Decl(overloadReturnTypes.ts, 19, 45)) >name : Symbol(name, Decl(overloadReturnTypes.ts, 19, 6)) >value : Symbol(value, Decl(overloadReturnTypes.ts, 19, 19)) >Accessor : Symbol(Accessor, Decl(overloadReturnTypes.ts, 0, 0)) attr(map: any): Accessor; ->attr : Symbol(attr, Decl(overloadReturnTypes.ts, 17, 17), Decl(overloadReturnTypes.ts, 18, 26), Decl(overloadReturnTypes.ts, 19, 45)) +>attr : Symbol(IFace.attr, Decl(overloadReturnTypes.ts, 17, 17), Decl(overloadReturnTypes.ts, 18, 26), Decl(overloadReturnTypes.ts, 19, 45)) >map : Symbol(map, Decl(overloadReturnTypes.ts, 20, 6)) >Accessor : Symbol(Accessor, Decl(overloadReturnTypes.ts, 0, 0)) } diff --git a/tests/baselines/reference/overloadingOnConstants2.errors.txt b/tests/baselines/reference/overloadingOnConstants2.errors.txt index b448deaadc7..f50a6bbd8c3 100644 --- a/tests/baselines/reference/overloadingOnConstants2.errors.txt +++ b/tests/baselines/reference/overloadingOnConstants2.errors.txt @@ -1,10 +1,9 @@ -tests/cases/compiler/overloadingOnConstants2.ts(8,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/compiler/overloadingOnConstants2.ts(9,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/compiler/overloadingOnConstants2.ts(9,10): error TS2394: Overload signature is not compatible with function implementation. tests/cases/compiler/overloadingOnConstants2.ts(15,13): error TS2345: Argument of type '"um"' is not assignable to parameter of type '"bye"'. -tests/cases/compiler/overloadingOnConstants2.ts(19,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/compiler/overloadingOnConstants2.ts(19,10): error TS2394: Overload signature is not compatible with function implementation. -==== tests/cases/compiler/overloadingOnConstants2.ts (4 errors) ==== +==== tests/cases/compiler/overloadingOnConstants2.ts (3 errors) ==== class C { private x = 1; } @@ -13,11 +12,9 @@ tests/cases/compiler/overloadingOnConstants2.ts(19,10): error TS2382: Specialize private y = 1; } function foo(x: "hi", items: string[]): D; - ~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. function foo(x: "bye", items: string[]): E; ~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +!!! error TS2394: Overload signature is not compatible with function implementation. function foo(x: string, items: string[]): C { return null; } @@ -31,7 +28,7 @@ tests/cases/compiler/overloadingOnConstants2.ts(19,10): error TS2382: Specialize //function bar(x: "hi", items: string[]): D; function bar(x: "bye", items: string[]): E; ~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +!!! error TS2394: Overload signature is not compatible with function implementation. function bar(x: string, items: string[]): C; function bar(x: string, items: string[]): C { return null; diff --git a/tests/baselines/reference/overloadingOnConstantsInImplementation.errors.txt b/tests/baselines/reference/overloadingOnConstantsInImplementation.errors.txt deleted file mode 100644 index 19afdb26806..00000000000 --- a/tests/baselines/reference/overloadingOnConstantsInImplementation.errors.txt +++ /dev/null @@ -1,16 +0,0 @@ -tests/cases/compiler/overloadingOnConstantsInImplementation.ts(1,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/compiler/overloadingOnConstantsInImplementation.ts(2,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/compiler/overloadingOnConstantsInImplementation.ts(3,10): error TS2381: A signature with an implementation cannot use a string literal type. - - -==== tests/cases/compiler/overloadingOnConstantsInImplementation.ts (3 errors) ==== - function foo(a: 'hi', x: string); - ~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. - function foo(a: 'hi', x: string); - ~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. - function foo(a: 'hi', x: any) { - ~~~ -!!! error TS2381: A signature with an implementation cannot use a string literal type. - } \ No newline at end of file diff --git a/tests/baselines/reference/overloadingOnConstantsInImplementation.symbols b/tests/baselines/reference/overloadingOnConstantsInImplementation.symbols new file mode 100644 index 00000000000..5cf7b2ba928 --- /dev/null +++ b/tests/baselines/reference/overloadingOnConstantsInImplementation.symbols @@ -0,0 +1,16 @@ +=== tests/cases/compiler/overloadingOnConstantsInImplementation.ts === +function foo(a: 'hi', x: string); +>foo : Symbol(foo, Decl(overloadingOnConstantsInImplementation.ts, 0, 0), Decl(overloadingOnConstantsInImplementation.ts, 0, 33), Decl(overloadingOnConstantsInImplementation.ts, 1, 33)) +>a : Symbol(a, Decl(overloadingOnConstantsInImplementation.ts, 0, 13)) +>x : Symbol(x, Decl(overloadingOnConstantsInImplementation.ts, 0, 21)) + +function foo(a: 'hi', x: string); +>foo : Symbol(foo, Decl(overloadingOnConstantsInImplementation.ts, 0, 0), Decl(overloadingOnConstantsInImplementation.ts, 0, 33), Decl(overloadingOnConstantsInImplementation.ts, 1, 33)) +>a : Symbol(a, Decl(overloadingOnConstantsInImplementation.ts, 1, 13)) +>x : Symbol(x, Decl(overloadingOnConstantsInImplementation.ts, 1, 21)) + +function foo(a: 'hi', x: any) { +>foo : Symbol(foo, Decl(overloadingOnConstantsInImplementation.ts, 0, 0), Decl(overloadingOnConstantsInImplementation.ts, 0, 33), Decl(overloadingOnConstantsInImplementation.ts, 1, 33)) +>a : Symbol(a, Decl(overloadingOnConstantsInImplementation.ts, 2, 13)) +>x : Symbol(x, Decl(overloadingOnConstantsInImplementation.ts, 2, 21)) +} diff --git a/tests/baselines/reference/overloadingOnConstantsInImplementation.types b/tests/baselines/reference/overloadingOnConstantsInImplementation.types new file mode 100644 index 00000000000..0cdb13e995f --- /dev/null +++ b/tests/baselines/reference/overloadingOnConstantsInImplementation.types @@ -0,0 +1,16 @@ +=== tests/cases/compiler/overloadingOnConstantsInImplementation.ts === +function foo(a: 'hi', x: string); +>foo : { (a: "hi", x: string): any; (a: "hi", x: string): any; } +>a : "hi" +>x : string + +function foo(a: 'hi', x: string); +>foo : { (a: "hi", x: string): any; (a: "hi", x: string): any; } +>a : "hi" +>x : string + +function foo(a: 'hi', x: any) { +>foo : { (a: "hi", x: string): any; (a: "hi", x: string): any; } +>a : "hi" +>x : any +} diff --git a/tests/baselines/reference/overloadresolutionWithConstraintCheckingDeferred.errors.txt b/tests/baselines/reference/overloadresolutionWithConstraintCheckingDeferred.errors.txt index 45c9f99b691..3c06fd43275 100644 --- a/tests/baselines/reference/overloadresolutionWithConstraintCheckingDeferred.errors.txt +++ b/tests/baselines/reference/overloadresolutionWithConstraintCheckingDeferred.errors.txt @@ -5,8 +5,8 @@ tests/cases/compiler/overloadresolutionWithConstraintCheckingDeferred.ts(16,5): tests/cases/compiler/overloadresolutionWithConstraintCheckingDeferred.ts(16,38): error TS2344: Type 'D' does not satisfy the constraint 'A'. tests/cases/compiler/overloadresolutionWithConstraintCheckingDeferred.ts(18,27): error TS2345: Argument of type '(x: D) => G' is not assignable to parameter of type '(x: B) => any'. Types of parameters 'x' and 'x' are incompatible. - Type 'D' is not assignable to type 'B'. - Property 'x' is missing in type 'D'. + Type 'B' is not assignable to type 'D'. + Property 'q' is missing in type 'B'. tests/cases/compiler/overloadresolutionWithConstraintCheckingDeferred.ts(19,14): error TS2344: Type 'D' does not satisfy the constraint 'A'. @@ -39,16 +39,13 @@ tests/cases/compiler/overloadresolutionWithConstraintCheckingDeferred.ts(19,14): var result3: string = foo(x => { // x has type D ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2345: Argument of type '(x: D) => G' is not assignable to parameter of type '(x: B) => any'. +!!! error TS2345: Types of parameters 'x' and 'x' are incompatible. +!!! error TS2345: Type 'B' is not assignable to type 'D'. +!!! error TS2345: Property 'q' is missing in type 'B'. var y: G; // error that D does not satisfy constraint, y is of type G, entire call to foo is an error - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~ !!! error TS2344: Type 'D' does not satisfy the constraint 'A'. return y; - ~~~~~~~~~~~~~ }); - ~ -!!! error TS2345: Argument of type '(x: D) => G' is not assignable to parameter of type '(x: B) => any'. -!!! error TS2345: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2345: Type 'D' is not assignable to type 'B'. -!!! error TS2345: Property 'x' is missing in type 'D'. \ No newline at end of file diff --git a/tests/baselines/reference/overloadsWithConstraints.symbols b/tests/baselines/reference/overloadsWithConstraints.symbols index 4b33826e6b8..d3a3574da6a 100644 --- a/tests/baselines/reference/overloadsWithConstraints.symbols +++ b/tests/baselines/reference/overloadsWithConstraints.symbols @@ -2,7 +2,7 @@ declare function f(x: T): T; >f : Symbol(f, Decl(overloadsWithConstraints.ts, 0, 0), Decl(overloadsWithConstraints.ts, 0, 46)) >T : Symbol(T, Decl(overloadsWithConstraints.ts, 0, 19)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(overloadsWithConstraints.ts, 0, 37)) >T : Symbol(T, Decl(overloadsWithConstraints.ts, 0, 19)) >T : Symbol(T, Decl(overloadsWithConstraints.ts, 0, 19)) @@ -10,7 +10,7 @@ declare function f(x: T): T; declare function f(x: T): T >f : Symbol(f, Decl(overloadsWithConstraints.ts, 0, 0), Decl(overloadsWithConstraints.ts, 0, 46)) >T : Symbol(T, Decl(overloadsWithConstraints.ts, 1, 19)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(overloadsWithConstraints.ts, 1, 37)) >T : Symbol(T, Decl(overloadsWithConstraints.ts, 1, 19)) >T : Symbol(T, Decl(overloadsWithConstraints.ts, 1, 19)) diff --git a/tests/baselines/reference/parameterPropertyInitializerInInitializers.symbols b/tests/baselines/reference/parameterPropertyInitializerInInitializers.symbols index c05adb9e8ca..e355a40d85e 100644 --- a/tests/baselines/reference/parameterPropertyInitializerInInitializers.symbols +++ b/tests/baselines/reference/parameterPropertyInitializerInInitializers.symbols @@ -3,7 +3,7 @@ class Foo { >Foo : Symbol(Foo, Decl(parameterPropertyInitializerInInitializers.ts, 0, 0)) constructor(public x: number, public y: number = x) { } ->x : Symbol(x, Decl(parameterPropertyInitializerInInitializers.ts, 1, 16)) ->y : Symbol(y, Decl(parameterPropertyInitializerInInitializers.ts, 1, 33)) +>x : Symbol(Foo.x, Decl(parameterPropertyInitializerInInitializers.ts, 1, 16)) +>y : Symbol(Foo.y, Decl(parameterPropertyInitializerInInitializers.ts, 1, 33)) >x : Symbol(x, Decl(parameterPropertyInitializerInInitializers.ts, 1, 16)) } diff --git a/tests/baselines/reference/parameterPropertyReferencingOtherParameter.symbols b/tests/baselines/reference/parameterPropertyReferencingOtherParameter.symbols index fb6d289f241..97c0c22bc8c 100644 --- a/tests/baselines/reference/parameterPropertyReferencingOtherParameter.symbols +++ b/tests/baselines/reference/parameterPropertyReferencingOtherParameter.symbols @@ -3,8 +3,8 @@ class Foo { >Foo : Symbol(Foo, Decl(parameterPropertyReferencingOtherParameter.ts, 0, 0)) constructor(public x: number, public y: number = x) { } ->x : Symbol(x, Decl(parameterPropertyReferencingOtherParameter.ts, 1, 16)) ->y : Symbol(y, Decl(parameterPropertyReferencingOtherParameter.ts, 1, 33)) +>x : Symbol(Foo.x, Decl(parameterPropertyReferencingOtherParameter.ts, 1, 16)) +>y : Symbol(Foo.y, Decl(parameterPropertyReferencingOtherParameter.ts, 1, 33)) >x : Symbol(x, Decl(parameterPropertyReferencingOtherParameter.ts, 1, 16)) } diff --git a/tests/baselines/reference/parameterReferenceInInitializer1.js b/tests/baselines/reference/parameterReferenceInInitializer1.js new file mode 100644 index 00000000000..51f98603de8 --- /dev/null +++ b/tests/baselines/reference/parameterReferenceInInitializer1.js @@ -0,0 +1,26 @@ +//// [parameterReferenceInInitializer1.ts] +function fn(y: Y, set: (y: Y, x: number) => void): a { + return undefined; +} +interface Y { x: number } + +class C { + constructor( + y: Y, + public x = fn(y, (y, x) => y.x = x) // expected to work, but actually doesn't + ) { + } +} + +//// [parameterReferenceInInitializer1.js] +function fn(y, set) { + return undefined; +} +var C = (function () { + function C(y, x // expected to work, but actually doesn't + ) { + if (x === void 0) { x = fn(y, function (y, x) { return y.x = x; }); } + this.x = x; + } + return C; +}()); diff --git a/tests/baselines/reference/parameterReferenceInInitializer1.symbols b/tests/baselines/reference/parameterReferenceInInitializer1.symbols new file mode 100644 index 00000000000..9981db39bb0 --- /dev/null +++ b/tests/baselines/reference/parameterReferenceInInitializer1.symbols @@ -0,0 +1,41 @@ +=== tests/cases/compiler/parameterReferenceInInitializer1.ts === +function fn(y: Y, set: (y: Y, x: number) => void): a { +>fn : Symbol(fn, Decl(parameterReferenceInInitializer1.ts, 0, 0)) +>a : Symbol(a, Decl(parameterReferenceInInitializer1.ts, 0, 12)) +>y : Symbol(y, Decl(parameterReferenceInInitializer1.ts, 0, 15)) +>Y : Symbol(Y, Decl(parameterReferenceInInitializer1.ts, 2, 1)) +>set : Symbol(set, Decl(parameterReferenceInInitializer1.ts, 0, 20)) +>y : Symbol(y, Decl(parameterReferenceInInitializer1.ts, 0, 27)) +>Y : Symbol(Y, Decl(parameterReferenceInInitializer1.ts, 2, 1)) +>x : Symbol(x, Decl(parameterReferenceInInitializer1.ts, 0, 32)) +>a : Symbol(a, Decl(parameterReferenceInInitializer1.ts, 0, 12)) + + return undefined; +>undefined : Symbol(undefined) +} +interface Y { x: number } +>Y : Symbol(Y, Decl(parameterReferenceInInitializer1.ts, 2, 1)) +>x : Symbol(Y.x, Decl(parameterReferenceInInitializer1.ts, 3, 13)) + +class C { +>C : Symbol(C, Decl(parameterReferenceInInitializer1.ts, 3, 25)) + + constructor( + y: Y, +>y : Symbol(y, Decl(parameterReferenceInInitializer1.ts, 6, 16)) +>Y : Symbol(Y, Decl(parameterReferenceInInitializer1.ts, 2, 1)) + + public x = fn(y, (y, x) => y.x = x) // expected to work, but actually doesn't +>x : Symbol(C.x, Decl(parameterReferenceInInitializer1.ts, 7, 13)) +>fn : Symbol(fn, Decl(parameterReferenceInInitializer1.ts, 0, 0)) +>y : Symbol(y, Decl(parameterReferenceInInitializer1.ts, 6, 16)) +>y : Symbol(y, Decl(parameterReferenceInInitializer1.ts, 8, 26)) +>x : Symbol(x, Decl(parameterReferenceInInitializer1.ts, 8, 28)) +>y.x : Symbol(Y.x, Decl(parameterReferenceInInitializer1.ts, 3, 13)) +>y : Symbol(y, Decl(parameterReferenceInInitializer1.ts, 8, 26)) +>x : Symbol(Y.x, Decl(parameterReferenceInInitializer1.ts, 3, 13)) +>x : Symbol(x, Decl(parameterReferenceInInitializer1.ts, 8, 28)) + + ) { + } +} diff --git a/tests/baselines/reference/parameterReferenceInInitializer1.types b/tests/baselines/reference/parameterReferenceInInitializer1.types new file mode 100644 index 00000000000..b73e3256a06 --- /dev/null +++ b/tests/baselines/reference/parameterReferenceInInitializer1.types @@ -0,0 +1,44 @@ +=== tests/cases/compiler/parameterReferenceInInitializer1.ts === +function fn(y: Y, set: (y: Y, x: number) => void): a { +>fn : (y: Y, set: (y: Y, x: number) => void) => a +>a : a +>y : Y +>Y : Y +>set : (y: Y, x: number) => void +>y : Y +>Y : Y +>x : number +>a : a + + return undefined; +>undefined : undefined +} +interface Y { x: number } +>Y : Y +>x : number + +class C { +>C : C + + constructor( + y: Y, +>y : Y +>Y : Y + + public x = fn(y, (y, x) => y.x = x) // expected to work, but actually doesn't +>x : {} +>fn(y, (y, x) => y.x = x) : {} +>fn : (y: Y, set: (y: Y, x: number) => void) => a +>y : Y +>(y, x) => y.x = x : (y: Y, x: number) => number +>y : Y +>x : number +>y.x = x : number +>y.x : number +>y : Y +>x : number +>x : number + + ) { + } +} diff --git a/tests/baselines/reference/parameterReferenceInInitializer2.js b/tests/baselines/reference/parameterReferenceInInitializer2.js new file mode 100644 index 00000000000..c66a1d8cd54 --- /dev/null +++ b/tests/baselines/reference/parameterReferenceInInitializer2.js @@ -0,0 +1,10 @@ +//// [parameterReferenceInInitializer2.ts] +function Example(x = function(x: any) { return x; }) { // Error: parameter 'x' cannot be + // referenced in its initializer +} + +//// [parameterReferenceInInitializer2.js] +function Example(x) { + if (x === void 0) { x = function (x) { return x; }; } + // referenced in its initializer +} diff --git a/tests/baselines/reference/parameterReferenceInInitializer2.symbols b/tests/baselines/reference/parameterReferenceInInitializer2.symbols new file mode 100644 index 00000000000..126745373c3 --- /dev/null +++ b/tests/baselines/reference/parameterReferenceInInitializer2.symbols @@ -0,0 +1,9 @@ +=== tests/cases/compiler/parameterReferenceInInitializer2.ts === +function Example(x = function(x: any) { return x; }) { // Error: parameter 'x' cannot be +>Example : Symbol(Example, Decl(parameterReferenceInInitializer2.ts, 0, 0)) +>x : Symbol(x, Decl(parameterReferenceInInitializer2.ts, 0, 17)) +>x : Symbol(x, Decl(parameterReferenceInInitializer2.ts, 0, 30)) +>x : Symbol(x, Decl(parameterReferenceInInitializer2.ts, 0, 30)) + + // referenced in its initializer +} diff --git a/tests/baselines/reference/parameterReferenceInInitializer2.types b/tests/baselines/reference/parameterReferenceInInitializer2.types new file mode 100644 index 00000000000..b137bccf709 --- /dev/null +++ b/tests/baselines/reference/parameterReferenceInInitializer2.types @@ -0,0 +1,10 @@ +=== tests/cases/compiler/parameterReferenceInInitializer2.ts === +function Example(x = function(x: any) { return x; }) { // Error: parameter 'x' cannot be +>Example : (x?: (x: any) => any) => void +>x : (x: any) => any +>function(x: any) { return x; } : (x: any) => any +>x : any +>x : any + + // referenced in its initializer +} diff --git a/tests/baselines/reference/parameterReferencesOtherParameter1.symbols b/tests/baselines/reference/parameterReferencesOtherParameter1.symbols index 7e7eec1a3cb..02e5cce5c20 100644 --- a/tests/baselines/reference/parameterReferencesOtherParameter1.symbols +++ b/tests/baselines/reference/parameterReferencesOtherParameter1.symbols @@ -3,7 +3,7 @@ class Model { >Model : Symbol(Model, Decl(parameterReferencesOtherParameter1.ts, 0, 0)) public name: string; ->name : Symbol(name, Decl(parameterReferencesOtherParameter1.ts, 0, 13)) +>name : Symbol(Model.name, Decl(parameterReferencesOtherParameter1.ts, 0, 13)) } class UI { diff --git a/tests/baselines/reference/parameterReferencesOtherParameter2.symbols b/tests/baselines/reference/parameterReferencesOtherParameter2.symbols index 2d63c7a3334..94f9b43bb27 100644 --- a/tests/baselines/reference/parameterReferencesOtherParameter2.symbols +++ b/tests/baselines/reference/parameterReferencesOtherParameter2.symbols @@ -3,7 +3,7 @@ class Model { >Model : Symbol(Model, Decl(parameterReferencesOtherParameter2.ts, 0, 0)) public name: string; ->name : Symbol(name, Decl(parameterReferencesOtherParameter2.ts, 0, 13)) +>name : Symbol(Model.name, Decl(parameterReferencesOtherParameter2.ts, 0, 13)) } class UI { diff --git a/tests/baselines/reference/parametersWithNoAnnotationAreAny.symbols b/tests/baselines/reference/parametersWithNoAnnotationAreAny.symbols index 9771d7f05ca..257679f61b2 100644 --- a/tests/baselines/reference/parametersWithNoAnnotationAreAny.symbols +++ b/tests/baselines/reference/parametersWithNoAnnotationAreAny.symbols @@ -25,7 +25,7 @@ class C { >C : Symbol(C, Decl(parametersWithNoAnnotationAreAny.ts, 3, 21)) foo(x) { ->foo : Symbol(foo, Decl(parametersWithNoAnnotationAreAny.ts, 5, 9)) +>foo : Symbol(C.foo, Decl(parametersWithNoAnnotationAreAny.ts, 5, 9)) >x : Symbol(x, Decl(parametersWithNoAnnotationAreAny.ts, 6, 8)) return x; @@ -37,11 +37,11 @@ interface I { >I : Symbol(I, Decl(parametersWithNoAnnotationAreAny.ts, 9, 1)) foo(x); ->foo : Symbol(foo, Decl(parametersWithNoAnnotationAreAny.ts, 11, 13)) +>foo : Symbol(I.foo, Decl(parametersWithNoAnnotationAreAny.ts, 11, 13)) >x : Symbol(x, Decl(parametersWithNoAnnotationAreAny.ts, 12, 8)) foo2(x, y); ->foo2 : Symbol(foo2, Decl(parametersWithNoAnnotationAreAny.ts, 12, 11)) +>foo2 : Symbol(I.foo2, Decl(parametersWithNoAnnotationAreAny.ts, 12, 11)) >x : Symbol(x, Decl(parametersWithNoAnnotationAreAny.ts, 13, 9)) >y : Symbol(y, Decl(parametersWithNoAnnotationAreAny.ts, 13, 11)) } diff --git a/tests/baselines/reference/parenthesizedContexualTyping3.symbols b/tests/baselines/reference/parenthesizedContexualTyping3.symbols index 4db888efd61..1d4bce3f230 100644 --- a/tests/baselines/reference/parenthesizedContexualTyping3.symbols +++ b/tests/baselines/reference/parenthesizedContexualTyping3.symbols @@ -9,7 +9,7 @@ function tempFun(tempStrs: TemplateStringsArray, g: (x: T) => T, x: T): T; >tempFun : Symbol(tempFun, Decl(parenthesizedContexualTyping3.ts, 0, 0), Decl(parenthesizedContexualTyping3.ts, 6, 77), Decl(parenthesizedContexualTyping3.ts, 7, 93)) >T : Symbol(T, Decl(parenthesizedContexualTyping3.ts, 6, 17)) >tempStrs : Symbol(tempStrs, Decl(parenthesizedContexualTyping3.ts, 6, 20)) ->TemplateStringsArray : Symbol(TemplateStringsArray, Decl(lib.d.ts, --, --)) +>TemplateStringsArray : Symbol(TemplateStringsArray, Decl(lib.es5.d.ts, --, --)) >g : Symbol(g, Decl(parenthesizedContexualTyping3.ts, 6, 51)) >x : Symbol(x, Decl(parenthesizedContexualTyping3.ts, 6, 56)) >T : Symbol(T, Decl(parenthesizedContexualTyping3.ts, 6, 17)) @@ -22,7 +22,7 @@ function tempFun(tempStrs: TemplateStringsArray, g: (x: T) => T, h: (y: T) => >tempFun : Symbol(tempFun, Decl(parenthesizedContexualTyping3.ts, 0, 0), Decl(parenthesizedContexualTyping3.ts, 6, 77), Decl(parenthesizedContexualTyping3.ts, 7, 93)) >T : Symbol(T, Decl(parenthesizedContexualTyping3.ts, 7, 17)) >tempStrs : Symbol(tempStrs, Decl(parenthesizedContexualTyping3.ts, 7, 20)) ->TemplateStringsArray : Symbol(TemplateStringsArray, Decl(lib.d.ts, --, --)) +>TemplateStringsArray : Symbol(TemplateStringsArray, Decl(lib.es5.d.ts, --, --)) >g : Symbol(g, Decl(parenthesizedContexualTyping3.ts, 7, 51)) >x : Symbol(x, Decl(parenthesizedContexualTyping3.ts, 7, 56)) >T : Symbol(T, Decl(parenthesizedContexualTyping3.ts, 7, 17)) @@ -39,7 +39,7 @@ function tempFun(tempStrs: TemplateStringsArray, g: (x: T) => T, x: T): T { >tempFun : Symbol(tempFun, Decl(parenthesizedContexualTyping3.ts, 0, 0), Decl(parenthesizedContexualTyping3.ts, 6, 77), Decl(parenthesizedContexualTyping3.ts, 7, 93)) >T : Symbol(T, Decl(parenthesizedContexualTyping3.ts, 8, 17)) >tempStrs : Symbol(tempStrs, Decl(parenthesizedContexualTyping3.ts, 8, 20)) ->TemplateStringsArray : Symbol(TemplateStringsArray, Decl(lib.d.ts, --, --)) +>TemplateStringsArray : Symbol(TemplateStringsArray, Decl(lib.es5.d.ts, --, --)) >g : Symbol(g, Decl(parenthesizedContexualTyping3.ts, 8, 51)) >x : Symbol(x, Decl(parenthesizedContexualTyping3.ts, 8, 56)) >T : Symbol(T, Decl(parenthesizedContexualTyping3.ts, 8, 17)) diff --git a/tests/baselines/reference/parseClassDeclarationInStrictModeByDefaultInES6.errors.txt b/tests/baselines/reference/parseClassDeclarationInStrictModeByDefaultInES6.errors.txt index e1b0bb34529..6f45030a650 100644 --- a/tests/baselines/reference/parseClassDeclarationInStrictModeByDefaultInES6.errors.txt +++ b/tests/baselines/reference/parseClassDeclarationInStrictModeByDefaultInES6.errors.txt @@ -2,7 +2,6 @@ tests/cases/conformance/es6/classDeclaration/parseClassDeclarationInStrictModeBy tests/cases/conformance/es6/classDeclaration/parseClassDeclarationInStrictModeByDefaultInES6.ts(5,17): error TS1210: Invalid use of 'eval'. Class definitions are automatically in strict mode. tests/cases/conformance/es6/classDeclaration/parseClassDeclarationInStrictModeByDefaultInES6.ts(6,9): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. tests/cases/conformance/es6/classDeclaration/parseClassDeclarationInStrictModeByDefaultInES6.ts(6,9): error TS2322: Type 'string' is not assignable to type 'IArguments'. - Property 'callee' is missing in type 'String'. ==== tests/cases/conformance/es6/classDeclaration/parseClassDeclarationInStrictModeByDefaultInES6.ts (4 errors) ==== @@ -20,6 +19,5 @@ tests/cases/conformance/es6/classDeclaration/parseClassDeclarationInStrictModeBy !!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. ~~~~~~~~~ !!! error TS2322: Type 'string' is not assignable to type 'IArguments'. -!!! error TS2322: Property 'callee' is missing in type 'String'. } } \ No newline at end of file diff --git a/tests/baselines/reference/parseShortform.symbols b/tests/baselines/reference/parseShortform.symbols index 31310e7bbb7..f0caf5f7d12 100644 --- a/tests/baselines/reference/parseShortform.symbols +++ b/tests/baselines/reference/parseShortform.symbols @@ -3,7 +3,7 @@ interface I { >I : Symbol(I, Decl(parseShortform.ts, 0, 0)) w: { ->w : Symbol(w, Decl(parseShortform.ts, 0, 13)) +>w : Symbol(I.w, Decl(parseShortform.ts, 0, 13)) z: I; >z : Symbol(z, Decl(parseShortform.ts, 1, 8)) @@ -22,13 +22,13 @@ interface I { }; x: boolean; ->x : Symbol(x, Decl(parseShortform.ts, 6, 6)) +>x : Symbol(I.x, Decl(parseShortform.ts, 6, 6)) y: (s: string) => boolean; ->y : Symbol(y, Decl(parseShortform.ts, 7, 15)) +>y : Symbol(I.y, Decl(parseShortform.ts, 7, 15)) >s : Symbol(s, Decl(parseShortform.ts, 8, 8)) z: I; ->z : Symbol(z, Decl(parseShortform.ts, 8, 30)) +>z : Symbol(I.z, Decl(parseShortform.ts, 8, 30)) >I : Symbol(I, Decl(parseShortform.ts, 0, 0)) } diff --git a/tests/baselines/reference/parser0_004152.errors.txt b/tests/baselines/reference/parser0_004152.errors.txt index 85c450ef39f..dfff2ea1a09 100644 --- a/tests/baselines/reference/parser0_004152.errors.txt +++ b/tests/baselines/reference/parser0_004152.errors.txt @@ -1,4 +1,3 @@ -tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(1,14): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,28): error TS2304: Cannot find name 'DisplayPosition'. tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,45): error TS1137: Expression or comma expected. tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,46): error TS1005: ';' expected. @@ -35,10 +34,8 @@ tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,97): error T tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(3,25): error TS2304: Cannot find name 'SeedCoords'. -==== tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts (35 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts (34 errors) ==== export class Game { - ~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. private position = new DisplayPosition([), 3, 3, 3, 3, 3, 0, 3, 3, 3, 3, 3, 3, 0], NoMove, 0); ~~~~~~~~~~~~~~~ !!! error TS2304: Cannot find name 'DisplayPosition'. diff --git a/tests/baselines/reference/parser509546.errors.txt b/tests/baselines/reference/parser509546.errors.txt deleted file mode 100644 index 65e524cb0e7..00000000000 --- a/tests/baselines/reference/parser509546.errors.txt +++ /dev/null @@ -1,10 +0,0 @@ -tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509546.ts(1,14): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. - - -==== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509546.ts (1 errors) ==== - export class Logger { - ~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. - public - } - \ No newline at end of file diff --git a/tests/baselines/reference/parser509546.symbols b/tests/baselines/reference/parser509546.symbols new file mode 100644 index 00000000000..a288b0c782e --- /dev/null +++ b/tests/baselines/reference/parser509546.symbols @@ -0,0 +1,8 @@ +=== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509546.ts === +export class Logger { +>Logger : Symbol(Logger, Decl(parser509546.ts, 0, 0)) + + public +>public : Symbol(Logger.public, Decl(parser509546.ts, 0, 21)) +} + diff --git a/tests/baselines/reference/parser509546.types b/tests/baselines/reference/parser509546.types new file mode 100644 index 00000000000..250b249c045 --- /dev/null +++ b/tests/baselines/reference/parser509546.types @@ -0,0 +1,8 @@ +=== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509546.ts === +export class Logger { +>Logger : Logger + + public +>public : any +} + diff --git a/tests/baselines/reference/parser509546_1.errors.txt b/tests/baselines/reference/parser509546_1.errors.txt deleted file mode 100644 index 1098adc1463..00000000000 --- a/tests/baselines/reference/parser509546_1.errors.txt +++ /dev/null @@ -1,10 +0,0 @@ -tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509546_1.ts(1,14): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. - - -==== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509546_1.ts (1 errors) ==== - export class Logger { - ~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. - public - } - \ No newline at end of file diff --git a/tests/baselines/reference/parser509546_1.symbols b/tests/baselines/reference/parser509546_1.symbols new file mode 100644 index 00000000000..356345d31c4 --- /dev/null +++ b/tests/baselines/reference/parser509546_1.symbols @@ -0,0 +1,8 @@ +=== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509546_1.ts === +export class Logger { +>Logger : Symbol(Logger, Decl(parser509546_1.ts, 0, 0)) + + public +>public : Symbol(Logger.public, Decl(parser509546_1.ts, 0, 21)) +} + diff --git a/tests/baselines/reference/parser509546_1.types b/tests/baselines/reference/parser509546_1.types new file mode 100644 index 00000000000..8392297ec27 --- /dev/null +++ b/tests/baselines/reference/parser509546_1.types @@ -0,0 +1,8 @@ +=== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509546_1.ts === +export class Logger { +>Logger : Logger + + public +>public : any +} + diff --git a/tests/baselines/reference/parser509546_2.errors.txt b/tests/baselines/reference/parser509546_2.errors.txt deleted file mode 100644 index ad551887dda..00000000000 --- a/tests/baselines/reference/parser509546_2.errors.txt +++ /dev/null @@ -1,12 +0,0 @@ -tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509546_2.ts(3,14): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. - - -==== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509546_2.ts (1 errors) ==== - "use strict"; - - export class Logger { - ~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. - public - } - \ No newline at end of file diff --git a/tests/baselines/reference/parser509546_2.symbols b/tests/baselines/reference/parser509546_2.symbols new file mode 100644 index 00000000000..89f4980a002 --- /dev/null +++ b/tests/baselines/reference/parser509546_2.symbols @@ -0,0 +1,10 @@ +=== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509546_2.ts === +"use strict"; + +export class Logger { +>Logger : Symbol(Logger, Decl(parser509546_2.ts, 0, 13)) + + public +>public : Symbol(Logger.public, Decl(parser509546_2.ts, 2, 21)) +} + diff --git a/tests/baselines/reference/parser509546_2.types b/tests/baselines/reference/parser509546_2.types new file mode 100644 index 00000000000..211553286a5 --- /dev/null +++ b/tests/baselines/reference/parser509546_2.types @@ -0,0 +1,11 @@ +=== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509546_2.ts === +"use strict"; +>"use strict" : string + +export class Logger { +>Logger : Logger + + public +>public : any +} + diff --git a/tests/baselines/reference/parser618973.errors.txt b/tests/baselines/reference/parser618973.errors.txt index b76aa15c858..5c67c9066b6 100644 --- a/tests/baselines/reference/parser618973.errors.txt +++ b/tests/baselines/reference/parser618973.errors.txt @@ -1,13 +1,10 @@ tests/cases/conformance/parser/ecmascript5/RegressionTests/parser618973.ts(1,8): error TS1030: 'export' modifier already seen. -tests/cases/conformance/parser/ecmascript5/RegressionTests/parser618973.ts(1,21): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. -==== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser618973.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser618973.ts (1 errors) ==== export export class Foo { ~~~~~~ !!! error TS1030: 'export' modifier already seen. - ~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. public Bar() { } } \ No newline at end of file diff --git a/tests/baselines/reference/parser643728.symbols b/tests/baselines/reference/parser643728.symbols index 705e4b1ba9d..ffa2ed06746 100644 --- a/tests/baselines/reference/parser643728.symbols +++ b/tests/baselines/reference/parser643728.symbols @@ -3,9 +3,9 @@ interface C { >C : Symbol(C, Decl(parser643728.ts, 0, 0)) foo; ->foo : Symbol(foo, Decl(parser643728.ts, 0, 13)) +>foo : Symbol(C.foo, Decl(parser643728.ts, 0, 13)) new; ->new : Symbol(new, Decl(parser643728.ts, 1, 8)) +>new : Symbol(C.new, Decl(parser643728.ts, 1, 8)) } diff --git a/tests/baselines/reference/parserAccessors2.symbols b/tests/baselines/reference/parserAccessors2.symbols index d4371695610..1d83ee847d5 100644 --- a/tests/baselines/reference/parserAccessors2.symbols +++ b/tests/baselines/reference/parserAccessors2.symbols @@ -3,6 +3,6 @@ class C { >C : Symbol(C, Decl(parserAccessors2.ts, 0, 0)) set Foo(a) { } ->Foo : Symbol(Foo, Decl(parserAccessors2.ts, 0, 9)) +>Foo : Symbol(C.Foo, Decl(parserAccessors2.ts, 0, 9)) >a : Symbol(a, Decl(parserAccessors2.ts, 1, 12)) } diff --git a/tests/baselines/reference/parserArgumentList1.errors.txt b/tests/baselines/reference/parserArgumentList1.errors.txt index 01575cec0c4..f01dfb531f0 100644 --- a/tests/baselines/reference/parserArgumentList1.errors.txt +++ b/tests/baselines/reference/parserArgumentList1.errors.txt @@ -1,12 +1,9 @@ -tests/cases/conformance/parser/ecmascript5/parserArgumentList1.ts(1,17): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/conformance/parser/ecmascript5/parserArgumentList1.ts(1,35): error TS2304: Cannot find name 'HTMLElement'. tests/cases/conformance/parser/ecmascript5/parserArgumentList1.ts(2,42): error TS2304: Cannot find name '_classNameRegexp'. -==== tests/cases/conformance/parser/ecmascript5/parserArgumentList1.ts (3 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/parserArgumentList1.ts (2 errors) ==== export function removeClass (node:HTMLElement, className:string) { - ~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ~~~~~~~~~~~ !!! error TS2304: Cannot find name 'HTMLElement'. node.className = node.className.replace(_classNameRegexp(className), function (everything, leftDelimiter, name, rightDelimiter) { diff --git a/tests/baselines/reference/parserClass1.errors.txt b/tests/baselines/reference/parserClass1.errors.txt index 03ec87f66a6..dd9e39b4075 100644 --- a/tests/baselines/reference/parserClass1.errors.txt +++ b/tests/baselines/reference/parserClass1.errors.txt @@ -1,11 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClass1.ts(1,18): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClass1.ts(1,40): error TS2304: Cannot find name 'ILogger'. -==== tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClass1.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClass1.ts (1 errors) ==== export class NullLogger implements ILogger { - ~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ~~~~~~~ !!! error TS2304: Cannot find name 'ILogger'. public information(): boolean { return false; } diff --git a/tests/baselines/reference/parserClass2.errors.txt b/tests/baselines/reference/parserClass2.errors.txt index ee67b262fe5..6bd60fc84d7 100644 --- a/tests/baselines/reference/parserClass2.errors.txt +++ b/tests/baselines/reference/parserClass2.errors.txt @@ -1,15 +1,12 @@ -tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClass2.ts(3,18): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClass2.ts(3,43): error TS2304: Cannot find name 'ILogger'. tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClass2.ts(4,37): error TS2304: Cannot find name 'ILogger'. tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClass2.ts(5,18): error TS2339: Property '_information' does not exist on type 'LoggerAdapter'. -==== tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClass2.ts (4 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClass2.ts (3 errors) ==== export class LoggerAdapter implements ILogger { - ~~~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ~~~~~~~ !!! error TS2304: Cannot find name 'ILogger'. constructor (public logger: ILogger) { diff --git a/tests/baselines/reference/parserClassDeclaration16.symbols b/tests/baselines/reference/parserClassDeclaration16.symbols index 770793b8ff9..f5afdd07a2e 100644 --- a/tests/baselines/reference/parserClassDeclaration16.symbols +++ b/tests/baselines/reference/parserClassDeclaration16.symbols @@ -3,8 +3,8 @@ class C { >C : Symbol(C, Decl(parserClassDeclaration16.ts, 0, 0)) foo(); ->foo : Symbol(foo, Decl(parserClassDeclaration16.ts, 0, 9), Decl(parserClassDeclaration16.ts, 1, 9)) +>foo : Symbol(C.foo, Decl(parserClassDeclaration16.ts, 0, 9), Decl(parserClassDeclaration16.ts, 1, 9)) foo() { } ->foo : Symbol(foo, Decl(parserClassDeclaration16.ts, 0, 9), Decl(parserClassDeclaration16.ts, 1, 9)) +>foo : Symbol(C.foo, Decl(parserClassDeclaration16.ts, 0, 9), Decl(parserClassDeclaration16.ts, 1, 9)) } diff --git a/tests/baselines/reference/parserClassDeclaration17.symbols b/tests/baselines/reference/parserClassDeclaration17.symbols index 7d230821d8a..fc8655b784f 100644 --- a/tests/baselines/reference/parserClassDeclaration17.symbols +++ b/tests/baselines/reference/parserClassDeclaration17.symbols @@ -3,13 +3,13 @@ declare class Enumerator { >Enumerator : Symbol(Enumerator, Decl(parserClassDeclaration17.ts, 0, 0)) public atEnd(): boolean; ->atEnd : Symbol(atEnd, Decl(parserClassDeclaration17.ts, 0, 26)) +>atEnd : Symbol(Enumerator.atEnd, Decl(parserClassDeclaration17.ts, 0, 26)) public moveNext(); ->moveNext : Symbol(moveNext, Decl(parserClassDeclaration17.ts, 1, 28)) +>moveNext : Symbol(Enumerator.moveNext, Decl(parserClassDeclaration17.ts, 1, 28)) public item(): any; ->item : Symbol(item, Decl(parserClassDeclaration17.ts, 2, 22)) +>item : Symbol(Enumerator.item, Decl(parserClassDeclaration17.ts, 2, 22)) constructor (o: any); >o : Symbol(o, Decl(parserClassDeclaration17.ts, 4, 17)) diff --git a/tests/baselines/reference/parserClassDeclaration19.symbols b/tests/baselines/reference/parserClassDeclaration19.symbols index e9ac1a666c7..9e9f64ca282 100644 --- a/tests/baselines/reference/parserClassDeclaration19.symbols +++ b/tests/baselines/reference/parserClassDeclaration19.symbols @@ -3,7 +3,7 @@ class C { >C : Symbol(C, Decl(parserClassDeclaration19.ts, 0, 0)) foo(); ->foo : Symbol(foo, Decl(parserClassDeclaration19.ts, 0, 9), Decl(parserClassDeclaration19.ts, 1, 10)) +>foo : Symbol(C.foo, Decl(parserClassDeclaration19.ts, 0, 9), Decl(parserClassDeclaration19.ts, 1, 10)) "foo"() { } } diff --git a/tests/baselines/reference/parserClassDeclaration26.symbols b/tests/baselines/reference/parserClassDeclaration26.symbols index 09b9cbfd3a4..7ad2b33c5f5 100644 --- a/tests/baselines/reference/parserClassDeclaration26.symbols +++ b/tests/baselines/reference/parserClassDeclaration26.symbols @@ -3,8 +3,8 @@ class C { >C : Symbol(C, Decl(parserClassDeclaration26.ts, 0, 0)) var ->var : Symbol(var, Decl(parserClassDeclaration26.ts, 0, 9)) +>var : Symbol(C.var, Decl(parserClassDeclaration26.ts, 0, 9)) public ->public : Symbol(public, Decl(parserClassDeclaration26.ts, 1, 6)) +>public : Symbol(C.public, Decl(parserClassDeclaration26.ts, 1, 6)) } diff --git a/tests/baselines/reference/parserConstructorDeclaration5.errors.txt b/tests/baselines/reference/parserConstructorDeclaration5.errors.txt deleted file mode 100644 index 4589ad95a32..00000000000 --- a/tests/baselines/reference/parserConstructorDeclaration5.errors.txt +++ /dev/null @@ -1,9 +0,0 @@ -tests/cases/conformance/parser/ecmascript5/ConstructorDeclarations/parserConstructorDeclaration5.ts(2,3): error TS1089: 'private' modifier cannot appear on a constructor declaration. - - -==== tests/cases/conformance/parser/ecmascript5/ConstructorDeclarations/parserConstructorDeclaration5.ts (1 errors) ==== - class C { - private constructor() { } - ~~~~~~~ -!!! error TS1089: 'private' modifier cannot appear on a constructor declaration. - } \ No newline at end of file diff --git a/tests/baselines/reference/parserConstructorDeclaration5.symbols b/tests/baselines/reference/parserConstructorDeclaration5.symbols new file mode 100644 index 00000000000..6eb3d32a0f0 --- /dev/null +++ b/tests/baselines/reference/parserConstructorDeclaration5.symbols @@ -0,0 +1,6 @@ +=== tests/cases/conformance/parser/ecmascript5/ConstructorDeclarations/parserConstructorDeclaration5.ts === +class C { +>C : Symbol(C, Decl(parserConstructorDeclaration5.ts, 0, 0)) + + private constructor() { } +} diff --git a/tests/baselines/reference/parserConstructorDeclaration5.types b/tests/baselines/reference/parserConstructorDeclaration5.types new file mode 100644 index 00000000000..ae5d2c44b49 --- /dev/null +++ b/tests/baselines/reference/parserConstructorDeclaration5.types @@ -0,0 +1,6 @@ +=== tests/cases/conformance/parser/ecmascript5/ConstructorDeclarations/parserConstructorDeclaration5.ts === +class C { +>C : C + + private constructor() { } +} diff --git a/tests/baselines/reference/parserES5ForOfStatement19.errors.txt b/tests/baselines/reference/parserES5ForOfStatement19.errors.txt new file mode 100644 index 00000000000..9d0bb02f1ef --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement19.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement19.ts(1,16): error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. + + +==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement19.ts (1 errors) ==== + for (var of in of) { } + ~~ +!!! error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement19.symbols b/tests/baselines/reference/parserES5ForOfStatement19.symbols deleted file mode 100644 index 93ba77e3db9..00000000000 --- a/tests/baselines/reference/parserES5ForOfStatement19.symbols +++ /dev/null @@ -1,5 +0,0 @@ -=== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement19.ts === -for (var of in of) { } ->of : Symbol(of, Decl(parserES5ForOfStatement19.ts, 0, 8)) ->of : Symbol(of, Decl(parserES5ForOfStatement19.ts, 0, 8)) - diff --git a/tests/baselines/reference/parserES5ForOfStatement19.types b/tests/baselines/reference/parserES5ForOfStatement19.types deleted file mode 100644 index 13abc7ae757..00000000000 --- a/tests/baselines/reference/parserES5ForOfStatement19.types +++ /dev/null @@ -1,5 +0,0 @@ -=== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement19.ts === -for (var of in of) { } ->of : any ->of : any - diff --git a/tests/baselines/reference/parserES5ForOfStatement20.errors.txt b/tests/baselines/reference/parserES5ForOfStatement20.errors.txt index 4aee32394b6..2bfc54590ad 100644 --- a/tests/baselines/reference/parserES5ForOfStatement20.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement20.errors.txt @@ -1,7 +1,10 @@ tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement20.ts(1,10): error TS1189: The variable declaration of a 'for...in' statement cannot have an initializer. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement20.ts(1,20): error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. -==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement20.ts (1 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement20.ts (2 errors) ==== for (var of = 0 in of) { } ~~ -!!! error TS1189: The variable declaration of a 'for...in' statement cannot have an initializer. \ No newline at end of file +!!! error TS1189: The variable declaration of a 'for...in' statement cannot have an initializer. + ~~ +!!! error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. \ No newline at end of file diff --git a/tests/baselines/reference/parserEnum1.errors.txt b/tests/baselines/reference/parserEnum1.errors.txt deleted file mode 100644 index dd8cd23fe2c..00000000000 --- a/tests/baselines/reference/parserEnum1.errors.txt +++ /dev/null @@ -1,14 +0,0 @@ -tests/cases/conformance/parser/ecmascript5/EnumDeclarations/parserEnum1.ts(3,17): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. - - -==== tests/cases/conformance/parser/ecmascript5/EnumDeclarations/parserEnum1.ts (1 errors) ==== - - - export enum SignatureFlags { - ~~~~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. - None = 0, - IsIndexer = 1, - IsStringIndexer = 1 << 1, - IsNumberIndexer = 1 << 2, - } \ No newline at end of file diff --git a/tests/baselines/reference/parserEnum1.symbols b/tests/baselines/reference/parserEnum1.symbols new file mode 100644 index 00000000000..ec9a3d8aa21 --- /dev/null +++ b/tests/baselines/reference/parserEnum1.symbols @@ -0,0 +1,18 @@ +=== tests/cases/conformance/parser/ecmascript5/EnumDeclarations/parserEnum1.ts === + + + export enum SignatureFlags { +>SignatureFlags : Symbol(SignatureFlags, Decl(parserEnum1.ts, 0, 0)) + + None = 0, +>None : Symbol(SignatureFlags.None, Decl(parserEnum1.ts, 2, 32)) + + IsIndexer = 1, +>IsIndexer : Symbol(SignatureFlags.IsIndexer, Decl(parserEnum1.ts, 3, 17)) + + IsStringIndexer = 1 << 1, +>IsStringIndexer : Symbol(SignatureFlags.IsStringIndexer, Decl(parserEnum1.ts, 4, 22)) + + IsNumberIndexer = 1 << 2, +>IsNumberIndexer : Symbol(SignatureFlags.IsNumberIndexer, Decl(parserEnum1.ts, 5, 33)) + } diff --git a/tests/baselines/reference/parserEnum1.types b/tests/baselines/reference/parserEnum1.types new file mode 100644 index 00000000000..34d11a1858d --- /dev/null +++ b/tests/baselines/reference/parserEnum1.types @@ -0,0 +1,26 @@ +=== tests/cases/conformance/parser/ecmascript5/EnumDeclarations/parserEnum1.ts === + + + export enum SignatureFlags { +>SignatureFlags : SignatureFlags + + None = 0, +>None : SignatureFlags +>0 : number + + IsIndexer = 1, +>IsIndexer : SignatureFlags +>1 : number + + IsStringIndexer = 1 << 1, +>IsStringIndexer : SignatureFlags +>1 << 1 : number +>1 : number +>1 : number + + IsNumberIndexer = 1 << 2, +>IsNumberIndexer : SignatureFlags +>1 << 2 : number +>1 : number +>2 : number + } diff --git a/tests/baselines/reference/parserEnum2.errors.txt b/tests/baselines/reference/parserEnum2.errors.txt deleted file mode 100644 index 242b624ad88..00000000000 --- a/tests/baselines/reference/parserEnum2.errors.txt +++ /dev/null @@ -1,14 +0,0 @@ -tests/cases/conformance/parser/ecmascript5/EnumDeclarations/parserEnum2.ts(3,17): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. - - -==== tests/cases/conformance/parser/ecmascript5/EnumDeclarations/parserEnum2.ts (1 errors) ==== - - - export enum SignatureFlags { - ~~~~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. - None = 0, - IsIndexer = 1, - IsStringIndexer = 1 << 1, - IsNumberIndexer = 1 << 2 - } \ No newline at end of file diff --git a/tests/baselines/reference/parserEnum2.symbols b/tests/baselines/reference/parserEnum2.symbols new file mode 100644 index 00000000000..dc745ca726e --- /dev/null +++ b/tests/baselines/reference/parserEnum2.symbols @@ -0,0 +1,18 @@ +=== tests/cases/conformance/parser/ecmascript5/EnumDeclarations/parserEnum2.ts === + + + export enum SignatureFlags { +>SignatureFlags : Symbol(SignatureFlags, Decl(parserEnum2.ts, 0, 0)) + + None = 0, +>None : Symbol(SignatureFlags.None, Decl(parserEnum2.ts, 2, 32)) + + IsIndexer = 1, +>IsIndexer : Symbol(SignatureFlags.IsIndexer, Decl(parserEnum2.ts, 3, 17)) + + IsStringIndexer = 1 << 1, +>IsStringIndexer : Symbol(SignatureFlags.IsStringIndexer, Decl(parserEnum2.ts, 4, 22)) + + IsNumberIndexer = 1 << 2 +>IsNumberIndexer : Symbol(SignatureFlags.IsNumberIndexer, Decl(parserEnum2.ts, 5, 33)) + } diff --git a/tests/baselines/reference/parserEnum2.types b/tests/baselines/reference/parserEnum2.types new file mode 100644 index 00000000000..6d119d8f079 --- /dev/null +++ b/tests/baselines/reference/parserEnum2.types @@ -0,0 +1,26 @@ +=== tests/cases/conformance/parser/ecmascript5/EnumDeclarations/parserEnum2.ts === + + + export enum SignatureFlags { +>SignatureFlags : SignatureFlags + + None = 0, +>None : SignatureFlags +>0 : number + + IsIndexer = 1, +>IsIndexer : SignatureFlags +>1 : number + + IsStringIndexer = 1 << 1, +>IsStringIndexer : SignatureFlags +>1 << 1 : number +>1 : number +>1 : number + + IsNumberIndexer = 1 << 2 +>IsNumberIndexer : SignatureFlags +>1 << 2 : number +>1 : number +>2 : number + } diff --git a/tests/baselines/reference/parserEnum3.errors.txt b/tests/baselines/reference/parserEnum3.errors.txt deleted file mode 100644 index e0b3691dbde..00000000000 --- a/tests/baselines/reference/parserEnum3.errors.txt +++ /dev/null @@ -1,10 +0,0 @@ -tests/cases/conformance/parser/ecmascript5/EnumDeclarations/parserEnum3.ts(3,17): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. - - -==== tests/cases/conformance/parser/ecmascript5/EnumDeclarations/parserEnum3.ts (1 errors) ==== - - - export enum SignatureFlags { - ~~~~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. - } \ No newline at end of file diff --git a/tests/baselines/reference/parserEnum3.symbols b/tests/baselines/reference/parserEnum3.symbols new file mode 100644 index 00000000000..01e55693335 --- /dev/null +++ b/tests/baselines/reference/parserEnum3.symbols @@ -0,0 +1,6 @@ +=== tests/cases/conformance/parser/ecmascript5/EnumDeclarations/parserEnum3.ts === + + + export enum SignatureFlags { +>SignatureFlags : Symbol(SignatureFlags, Decl(parserEnum3.ts, 0, 0)) + } diff --git a/tests/baselines/reference/parserEnum3.types b/tests/baselines/reference/parserEnum3.types new file mode 100644 index 00000000000..21527136b32 --- /dev/null +++ b/tests/baselines/reference/parserEnum3.types @@ -0,0 +1,6 @@ +=== tests/cases/conformance/parser/ecmascript5/EnumDeclarations/parserEnum3.ts === + + + export enum SignatureFlags { +>SignatureFlags : SignatureFlags + } diff --git a/tests/baselines/reference/parserEnum4.errors.txt b/tests/baselines/reference/parserEnum4.errors.txt index 9329b484c92..d9a57b21daa 100644 --- a/tests/baselines/reference/parserEnum4.errors.txt +++ b/tests/baselines/reference/parserEnum4.errors.txt @@ -1,13 +1,10 @@ -tests/cases/conformance/parser/ecmascript5/EnumDeclarations/parserEnum4.ts(3,17): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/conformance/parser/ecmascript5/EnumDeclarations/parserEnum4.ts(4,9): error TS1132: Enum member expected. -==== tests/cases/conformance/parser/ecmascript5/EnumDeclarations/parserEnum4.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/EnumDeclarations/parserEnum4.ts (1 errors) ==== export enum SignatureFlags { - ~~~~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. , ~ !!! error TS1132: Enum member expected. diff --git a/tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable1.symbols b/tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable1.symbols index 7b8be05f923..e9209df72f2 100644 --- a/tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable1.symbols +++ b/tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable1.symbols @@ -4,7 +4,7 @@ interface IPoint { >IPoint : Symbol(IPoint, Decl(parserErrorRecovery_IncompleteMemberVariable1.ts, 0, 0)) getDist(): number; ->getDist : Symbol(getDist, Decl(parserErrorRecovery_IncompleteMemberVariable1.ts, 1, 18)) +>getDist : Symbol(IPoint.getDist, Decl(parserErrorRecovery_IncompleteMemberVariable1.ts, 1, 18)) } // Module @@ -17,31 +17,31 @@ module Shapes { >IPoint : Symbol(IPoint, Decl(parserErrorRecovery_IncompleteMemberVariable1.ts, 0, 0)) public con: "hello"; ->con : Symbol(con, Decl(parserErrorRecovery_IncompleteMemberVariable1.ts, 9, 42)) +>con : Symbol(Point.con, Decl(parserErrorRecovery_IncompleteMemberVariable1.ts, 9, 42)) // Constructor constructor (public x: number, public y: number) { } ->x : Symbol(x, Decl(parserErrorRecovery_IncompleteMemberVariable1.ts, 13, 21)) ->y : Symbol(y, Decl(parserErrorRecovery_IncompleteMemberVariable1.ts, 13, 38)) +>x : Symbol(Point.x, Decl(parserErrorRecovery_IncompleteMemberVariable1.ts, 13, 21)) +>y : Symbol(Point.y, Decl(parserErrorRecovery_IncompleteMemberVariable1.ts, 13, 38)) // Instance member getDist() { return Math.sqrt(this.x * this.x + this.y * this.y); } ->getDist : Symbol(getDist, Decl(parserErrorRecovery_IncompleteMemberVariable1.ts, 13, 60)) +>getDist : Symbol(Point.getDist, Decl(parserErrorRecovery_IncompleteMemberVariable1.ts, 13, 60)) >Math.sqrt : Symbol(Math.sqrt, Decl(lib.d.ts, --, --)) >Math : Symbol(Math, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >sqrt : Symbol(Math.sqrt, Decl(lib.d.ts, --, --)) ->this.x : Symbol(x, Decl(parserErrorRecovery_IncompleteMemberVariable1.ts, 13, 21)) +>this.x : Symbol(Point.x, Decl(parserErrorRecovery_IncompleteMemberVariable1.ts, 13, 21)) >this : Symbol(Point, Decl(parserErrorRecovery_IncompleteMemberVariable1.ts, 6, 15)) ->x : Symbol(x, Decl(parserErrorRecovery_IncompleteMemberVariable1.ts, 13, 21)) ->this.x : Symbol(x, Decl(parserErrorRecovery_IncompleteMemberVariable1.ts, 13, 21)) +>x : Symbol(Point.x, Decl(parserErrorRecovery_IncompleteMemberVariable1.ts, 13, 21)) +>this.x : Symbol(Point.x, Decl(parserErrorRecovery_IncompleteMemberVariable1.ts, 13, 21)) >this : Symbol(Point, Decl(parserErrorRecovery_IncompleteMemberVariable1.ts, 6, 15)) ->x : Symbol(x, Decl(parserErrorRecovery_IncompleteMemberVariable1.ts, 13, 21)) ->this.y : Symbol(y, Decl(parserErrorRecovery_IncompleteMemberVariable1.ts, 13, 38)) +>x : Symbol(Point.x, Decl(parserErrorRecovery_IncompleteMemberVariable1.ts, 13, 21)) +>this.y : Symbol(Point.y, Decl(parserErrorRecovery_IncompleteMemberVariable1.ts, 13, 38)) >this : Symbol(Point, Decl(parserErrorRecovery_IncompleteMemberVariable1.ts, 6, 15)) ->y : Symbol(y, Decl(parserErrorRecovery_IncompleteMemberVariable1.ts, 13, 38)) ->this.y : Symbol(y, Decl(parserErrorRecovery_IncompleteMemberVariable1.ts, 13, 38)) +>y : Symbol(Point.y, Decl(parserErrorRecovery_IncompleteMemberVariable1.ts, 13, 38)) +>this.y : Symbol(Point.y, Decl(parserErrorRecovery_IncompleteMemberVariable1.ts, 13, 38)) >this : Symbol(Point, Decl(parserErrorRecovery_IncompleteMemberVariable1.ts, 6, 15)) ->y : Symbol(y, Decl(parserErrorRecovery_IncompleteMemberVariable1.ts, 13, 38)) +>y : Symbol(Point.y, Decl(parserErrorRecovery_IncompleteMemberVariable1.ts, 13, 38)) // Static member static origin = new Point(0, 0); diff --git a/tests/baselines/reference/parserExportAsFunctionIdentifier.symbols b/tests/baselines/reference/parserExportAsFunctionIdentifier.symbols index 6d81e8fdae3..d60cf30c821 100644 --- a/tests/baselines/reference/parserExportAsFunctionIdentifier.symbols +++ b/tests/baselines/reference/parserExportAsFunctionIdentifier.symbols @@ -3,7 +3,7 @@ interface Foo { >Foo : Symbol(Foo, Decl(parserExportAsFunctionIdentifier.ts, 0, 0)) export(): string; ->export : Symbol(export, Decl(parserExportAsFunctionIdentifier.ts, 0, 15)) +>export : Symbol(Foo.export, Decl(parserExportAsFunctionIdentifier.ts, 0, 15)) } var f: Foo; diff --git a/tests/baselines/reference/parserExportAssignment1.errors.txt b/tests/baselines/reference/parserExportAssignment1.errors.txt index cb989f655ce..41a428f6da2 100644 --- a/tests/baselines/reference/parserExportAssignment1.errors.txt +++ b/tests/baselines/reference/parserExportAssignment1.errors.txt @@ -1,10 +1,7 @@ -tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment1.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment1.ts(1,10): error TS2304: Cannot find name 'foo'. -==== tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment1.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment1.ts (1 errors) ==== export = foo - ~~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ~~~ !!! error TS2304: Cannot find name 'foo'. \ No newline at end of file diff --git a/tests/baselines/reference/parserExportAssignment1.js b/tests/baselines/reference/parserExportAssignment1.js index cecfe2789f4..725084ff0bc 100644 --- a/tests/baselines/reference/parserExportAssignment1.js +++ b/tests/baselines/reference/parserExportAssignment1.js @@ -3,3 +3,4 @@ export = foo //// [parserExportAssignment1.js] "use strict"; +module.exports = foo; diff --git a/tests/baselines/reference/parserExportAssignment2.errors.txt b/tests/baselines/reference/parserExportAssignment2.errors.txt index 7e7fcbd950f..bd9291c4930 100644 --- a/tests/baselines/reference/parserExportAssignment2.errors.txt +++ b/tests/baselines/reference/parserExportAssignment2.errors.txt @@ -1,10 +1,7 @@ -tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment2.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment2.ts(1,10): error TS2304: Cannot find name 'foo'. -==== tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment2.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment2.ts (1 errors) ==== export = foo; - ~~~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ~~~ !!! error TS2304: Cannot find name 'foo'. \ No newline at end of file diff --git a/tests/baselines/reference/parserExportAssignment2.js b/tests/baselines/reference/parserExportAssignment2.js index cf3f5a11145..204b2515943 100644 --- a/tests/baselines/reference/parserExportAssignment2.js +++ b/tests/baselines/reference/parserExportAssignment2.js @@ -3,3 +3,4 @@ export = foo; //// [parserExportAssignment2.js] "use strict"; +module.exports = foo; diff --git a/tests/baselines/reference/parserExportAssignment3.errors.txt b/tests/baselines/reference/parserExportAssignment3.errors.txt index 5e2ff747e2d..57bda04945e 100644 --- a/tests/baselines/reference/parserExportAssignment3.errors.txt +++ b/tests/baselines/reference/parserExportAssignment3.errors.txt @@ -1,10 +1,7 @@ -tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment3.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment3.ts(1,9): error TS1109: Expression expected. -==== tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment3.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment3.ts (1 errors) ==== export = - ~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. !!! error TS1109: Expression expected. \ No newline at end of file diff --git a/tests/baselines/reference/parserExportAssignment3.js b/tests/baselines/reference/parserExportAssignment3.js index 55dd6f107bb..604eb51cc74 100644 --- a/tests/baselines/reference/parserExportAssignment3.js +++ b/tests/baselines/reference/parserExportAssignment3.js @@ -3,3 +3,4 @@ export = //// [parserExportAssignment3.js] "use strict"; +module.exports = ; diff --git a/tests/baselines/reference/parserExportAssignment4.errors.txt b/tests/baselines/reference/parserExportAssignment4.errors.txt index 10830b9b977..950baf4b72c 100644 --- a/tests/baselines/reference/parserExportAssignment4.errors.txt +++ b/tests/baselines/reference/parserExportAssignment4.errors.txt @@ -1,10 +1,7 @@ -tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment4.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment4.ts(1,10): error TS1109: Expression expected. -==== tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment4.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment4.ts (1 errors) ==== export = ; - ~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ~ !!! error TS1109: Expression expected. \ No newline at end of file diff --git a/tests/baselines/reference/parserExportAssignment4.js b/tests/baselines/reference/parserExportAssignment4.js index 8c2c3a8746b..50b68506d79 100644 --- a/tests/baselines/reference/parserExportAssignment4.js +++ b/tests/baselines/reference/parserExportAssignment4.js @@ -3,3 +3,4 @@ export = ; //// [parserExportAssignment4.js] "use strict"; +module.exports = ; diff --git a/tests/baselines/reference/parserExportAssignment7.errors.txt b/tests/baselines/reference/parserExportAssignment7.errors.txt index c4ecd785484..3f1c14ddf70 100644 --- a/tests/baselines/reference/parserExportAssignment7.errors.txt +++ b/tests/baselines/reference/parserExportAssignment7.errors.txt @@ -1,12 +1,9 @@ -tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment7.ts(1,14): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment7.ts(4,1): error TS2309: An export assignment cannot be used in a module with other exported elements. tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment7.ts(4,10): error TS2304: Cannot find name 'B'. -==== tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment7.ts (3 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment7.ts (2 errors) ==== export class C { - ~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. } export = B; diff --git a/tests/baselines/reference/parserExportAssignment7.js b/tests/baselines/reference/parserExportAssignment7.js index baf8ec5b6bb..f359ada1e91 100644 --- a/tests/baselines/reference/parserExportAssignment7.js +++ b/tests/baselines/reference/parserExportAssignment7.js @@ -12,3 +12,4 @@ var C = (function () { return C; }()); exports.C = C; +module.exports = B; diff --git a/tests/baselines/reference/parserExportAssignment8.errors.txt b/tests/baselines/reference/parserExportAssignment8.errors.txt index 39ccc32e495..4d4a3ad7eb1 100644 --- a/tests/baselines/reference/parserExportAssignment8.errors.txt +++ b/tests/baselines/reference/parserExportAssignment8.errors.txt @@ -1,13 +1,10 @@ -tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment8.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment8.ts(1,1): error TS2309: An export assignment cannot be used in a module with other exported elements. tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment8.ts(1,10): error TS2304: Cannot find name 'B'. -==== tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment8.ts (3 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment8.ts (2 errors) ==== export = B; ~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. - ~~~~~~~~~~~ !!! error TS2309: An export assignment cannot be used in a module with other exported elements. ~ !!! error TS2304: Cannot find name 'B'. diff --git a/tests/baselines/reference/parserExportAssignment8.js b/tests/baselines/reference/parserExportAssignment8.js index 23f94dbe1e3..16a50a30b3c 100644 --- a/tests/baselines/reference/parserExportAssignment8.js +++ b/tests/baselines/reference/parserExportAssignment8.js @@ -12,3 +12,4 @@ var C = (function () { return C; }()); exports.C = C; +module.exports = B; diff --git a/tests/baselines/reference/parserForOfStatement19.errors.txt b/tests/baselines/reference/parserForOfStatement19.errors.txt new file mode 100644 index 00000000000..a111498efe7 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement19.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement19.ts(1,16): error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. + + +==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement19.ts (1 errors) ==== + for (var of in of) { } + ~~ +!!! error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement19.symbols b/tests/baselines/reference/parserForOfStatement19.symbols deleted file mode 100644 index 1e123349e13..00000000000 --- a/tests/baselines/reference/parserForOfStatement19.symbols +++ /dev/null @@ -1,5 +0,0 @@ -=== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement19.ts === -for (var of in of) { } ->of : Symbol(of, Decl(parserForOfStatement19.ts, 0, 8)) ->of : Symbol(of, Decl(parserForOfStatement19.ts, 0, 8)) - diff --git a/tests/baselines/reference/parserForOfStatement19.types b/tests/baselines/reference/parserForOfStatement19.types deleted file mode 100644 index 6fcc5e8f792..00000000000 --- a/tests/baselines/reference/parserForOfStatement19.types +++ /dev/null @@ -1,5 +0,0 @@ -=== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement19.ts === -for (var of in of) { } ->of : any ->of : any - diff --git a/tests/baselines/reference/parserForOfStatement20.errors.txt b/tests/baselines/reference/parserForOfStatement20.errors.txt index 461f307f6b9..f2b6ac39a83 100644 --- a/tests/baselines/reference/parserForOfStatement20.errors.txt +++ b/tests/baselines/reference/parserForOfStatement20.errors.txt @@ -1,7 +1,10 @@ tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement20.ts(1,10): error TS1189: The variable declaration of a 'for...in' statement cannot have an initializer. +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement20.ts(1,20): error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. -==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement20.ts (1 errors) ==== +==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement20.ts (2 errors) ==== for (var of = 0 in of) { } ~~ -!!! error TS1189: The variable declaration of a 'for...in' statement cannot have an initializer. \ No newline at end of file +!!! error TS1189: The variable declaration of a 'for...in' statement cannot have an initializer. + ~~ +!!! error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. \ No newline at end of file diff --git a/tests/baselines/reference/parserImportDeclaration1.js b/tests/baselines/reference/parserImportDeclaration1.js index d70a75641ec..cf6d431fbab 100644 --- a/tests/baselines/reference/parserImportDeclaration1.js +++ b/tests/baselines/reference/parserImportDeclaration1.js @@ -2,3 +2,4 @@ import TypeScript = TypeScriptServices.TypeScript; //// [parserImportDeclaration1.js] +var TypeScript = TypeScriptServices.TypeScript; diff --git a/tests/baselines/reference/parserIndexMemberDeclaration10.errors.txt b/tests/baselines/reference/parserIndexMemberDeclaration10.errors.txt index d448aaa3f29..1e94ed36b23 100644 --- a/tests/baselines/reference/parserIndexMemberDeclaration10.errors.txt +++ b/tests/baselines/reference/parserIndexMemberDeclaration10.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration10.ts(2,11): error TS1030: 'static' modifier already seen. +tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration10.ts(2,4): error TS1071: 'static' modifier cannot appear on an index signature. ==== tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration10.ts (1 errors) ==== class C { static static [x: string]: string; - ~~~~~~ -!!! error TS1030: 'static' modifier already seen. + ~~~~~~ +!!! error TS1071: 'static' modifier cannot appear on an index signature. } \ No newline at end of file diff --git a/tests/baselines/reference/parserIndexMemberDeclaration2.symbols b/tests/baselines/reference/parserIndexMemberDeclaration2.symbols index 1b42a8f8160..0031cde94be 100644 --- a/tests/baselines/reference/parserIndexMemberDeclaration2.symbols +++ b/tests/baselines/reference/parserIndexMemberDeclaration2.symbols @@ -6,5 +6,5 @@ class C { >a : Symbol(a, Decl(parserIndexMemberDeclaration2.ts, 1, 4)) public v: number ->v : Symbol(v, Decl(parserIndexMemberDeclaration2.ts, 1, 22)) +>v : Symbol(C.v, Decl(parserIndexMemberDeclaration2.ts, 1, 22)) } diff --git a/tests/baselines/reference/parserIndexMemberDeclaration3.symbols b/tests/baselines/reference/parserIndexMemberDeclaration3.symbols index 6961a37f497..7db6c7dd93e 100644 --- a/tests/baselines/reference/parserIndexMemberDeclaration3.symbols +++ b/tests/baselines/reference/parserIndexMemberDeclaration3.symbols @@ -6,5 +6,5 @@ class C { >a : Symbol(a, Decl(parserIndexMemberDeclaration3.ts, 1, 4)) public v: number ->v : Symbol(v, Decl(parserIndexMemberDeclaration3.ts, 1, 23)) +>v : Symbol(C.v, Decl(parserIndexMemberDeclaration3.ts, 1, 23)) } diff --git a/tests/baselines/reference/parserIndexMemberDeclaration4.symbols b/tests/baselines/reference/parserIndexMemberDeclaration4.symbols index 29b101d05d8..9b5f99d6ba8 100644 --- a/tests/baselines/reference/parserIndexMemberDeclaration4.symbols +++ b/tests/baselines/reference/parserIndexMemberDeclaration4.symbols @@ -4,5 +4,5 @@ class C { [a: string]: number; public v: number >a : Symbol(a, Decl(parserIndexMemberDeclaration4.ts, 1, 4)) ->v : Symbol(v, Decl(parserIndexMemberDeclaration4.ts, 1, 23)) +>v : Symbol(C.v, Decl(parserIndexMemberDeclaration4.ts, 1, 23)) } diff --git a/tests/baselines/reference/parserIndexMemberDeclaration6.errors.txt b/tests/baselines/reference/parserIndexMemberDeclaration6.errors.txt index 713031dbe4f..df15ae5950e 100644 --- a/tests/baselines/reference/parserIndexMemberDeclaration6.errors.txt +++ b/tests/baselines/reference/parserIndexMemberDeclaration6.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration6.ts(2,4): error TS1145: Modifiers not permitted on index signature members. +tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration6.ts(2,4): error TS1071: 'static' modifier cannot appear on an index signature. ==== tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration6.ts (1 errors) ==== class C { static [x: string]: string; ~~~~~~ -!!! error TS1145: Modifiers not permitted on index signature members. +!!! error TS1071: 'static' modifier cannot appear on an index signature. } \ No newline at end of file diff --git a/tests/baselines/reference/parserIndexMemberDeclaration7.errors.txt b/tests/baselines/reference/parserIndexMemberDeclaration7.errors.txt index 64984ee642f..ebbfaf8af4d 100644 --- a/tests/baselines/reference/parserIndexMemberDeclaration7.errors.txt +++ b/tests/baselines/reference/parserIndexMemberDeclaration7.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration7.ts(2,4): error TS1145: Modifiers not permitted on index signature members. +tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration7.ts(2,4): error TS1071: 'public' modifier cannot appear on an index signature. ==== tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration7.ts (1 errors) ==== class C { public [x: string]: string; ~~~~~~ -!!! error TS1145: Modifiers not permitted on index signature members. +!!! error TS1071: 'public' modifier cannot appear on an index signature. } \ No newline at end of file diff --git a/tests/baselines/reference/parserIndexMemberDeclaration8.errors.txt b/tests/baselines/reference/parserIndexMemberDeclaration8.errors.txt index 1fffaa299ce..4a5eec13cb5 100644 --- a/tests/baselines/reference/parserIndexMemberDeclaration8.errors.txt +++ b/tests/baselines/reference/parserIndexMemberDeclaration8.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration8.ts(2,4): error TS1145: Modifiers not permitted on index signature members. +tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration8.ts(2,4): error TS1071: 'private' modifier cannot appear on an index signature. ==== tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration8.ts (1 errors) ==== class C { private [x: string]: string; ~~~~~~~ -!!! error TS1145: Modifiers not permitted on index signature members. +!!! error TS1071: 'private' modifier cannot appear on an index signature. } \ No newline at end of file diff --git a/tests/baselines/reference/parserIndexMemberDeclaration9.errors.txt b/tests/baselines/reference/parserIndexMemberDeclaration9.errors.txt index 493a7894499..88360adcd70 100644 --- a/tests/baselines/reference/parserIndexMemberDeclaration9.errors.txt +++ b/tests/baselines/reference/parserIndexMemberDeclaration9.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration9.ts(2,4): error TS1031: 'export' modifier cannot appear on a class element. +tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration9.ts(2,4): error TS1071: 'export' modifier cannot appear on an index signature. ==== tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration9.ts (1 errors) ==== class C { export [x: string]: string; ~~~~~~ -!!! error TS1031: 'export' modifier cannot appear on a class element. +!!! error TS1071: 'export' modifier cannot appear on an index signature. } \ No newline at end of file diff --git a/tests/baselines/reference/parserInterfaceDeclaration3.errors.txt b/tests/baselines/reference/parserInterfaceDeclaration3.errors.txt index 8e84ca940a4..f074a38bd79 100644 --- a/tests/baselines/reference/parserInterfaceDeclaration3.errors.txt +++ b/tests/baselines/reference/parserInterfaceDeclaration3.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/InterfaceDeclarations/parserInterfaceDeclaration3.ts(1,1): error TS1044: 'public' modifier cannot appear on a module element. +tests/cases/conformance/parser/ecmascript5/InterfaceDeclarations/parserInterfaceDeclaration3.ts(1,1): error TS1044: 'public' modifier cannot appear on a module or namespace element. ==== tests/cases/conformance/parser/ecmascript5/InterfaceDeclarations/parserInterfaceDeclaration3.ts (1 errors) ==== public interface I { ~~~~~~ -!!! error TS1044: 'public' modifier cannot appear on a module element. +!!! error TS1044: 'public' modifier cannot appear on a module or namespace element. } \ No newline at end of file diff --git a/tests/baselines/reference/parserInterfaceDeclaration4.errors.txt b/tests/baselines/reference/parserInterfaceDeclaration4.errors.txt index 97a691a5230..aa1fe1aa6e7 100644 --- a/tests/baselines/reference/parserInterfaceDeclaration4.errors.txt +++ b/tests/baselines/reference/parserInterfaceDeclaration4.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/InterfaceDeclarations/parserInterfaceDeclaration4.ts(1,1): error TS1044: 'static' modifier cannot appear on a module element. +tests/cases/conformance/parser/ecmascript5/InterfaceDeclarations/parserInterfaceDeclaration4.ts(1,1): error TS1044: 'static' modifier cannot appear on a module or namespace element. ==== tests/cases/conformance/parser/ecmascript5/InterfaceDeclarations/parserInterfaceDeclaration4.ts (1 errors) ==== static interface I { ~~~~~~ -!!! error TS1044: 'static' modifier cannot appear on a module element. +!!! error TS1044: 'static' modifier cannot appear on a module or namespace element. } \ No newline at end of file diff --git a/tests/baselines/reference/parserInterfaceDeclaration6.errors.txt b/tests/baselines/reference/parserInterfaceDeclaration6.errors.txt index 6820ecdd48c..07734135de4 100644 --- a/tests/baselines/reference/parserInterfaceDeclaration6.errors.txt +++ b/tests/baselines/reference/parserInterfaceDeclaration6.errors.txt @@ -1,11 +1,8 @@ tests/cases/conformance/parser/ecmascript5/InterfaceDeclarations/parserInterfaceDeclaration6.ts(1,8): error TS1030: 'export' modifier already seen. -tests/cases/conformance/parser/ecmascript5/InterfaceDeclarations/parserInterfaceDeclaration6.ts(1,25): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. -==== tests/cases/conformance/parser/ecmascript5/InterfaceDeclarations/parserInterfaceDeclaration6.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/InterfaceDeclarations/parserInterfaceDeclaration6.ts (1 errors) ==== export export interface I { ~~~~~~ !!! error TS1030: 'export' modifier already seen. - ~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. } \ No newline at end of file diff --git a/tests/baselines/reference/parserInterfaceDeclaration7.errors.txt b/tests/baselines/reference/parserInterfaceDeclaration7.errors.txt deleted file mode 100644 index ecd59ae29e8..00000000000 --- a/tests/baselines/reference/parserInterfaceDeclaration7.errors.txt +++ /dev/null @@ -1,8 +0,0 @@ -tests/cases/conformance/parser/ecmascript5/InterfaceDeclarations/parserInterfaceDeclaration7.ts(1,18): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. - - -==== tests/cases/conformance/parser/ecmascript5/InterfaceDeclarations/parserInterfaceDeclaration7.ts (1 errors) ==== - export interface I { - ~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. - } \ No newline at end of file diff --git a/tests/baselines/reference/parserInterfaceDeclaration7.symbols b/tests/baselines/reference/parserInterfaceDeclaration7.symbols new file mode 100644 index 00000000000..c873239c716 --- /dev/null +++ b/tests/baselines/reference/parserInterfaceDeclaration7.symbols @@ -0,0 +1,4 @@ +=== tests/cases/conformance/parser/ecmascript5/InterfaceDeclarations/parserInterfaceDeclaration7.ts === +export interface I { +>I : Symbol(I, Decl(parserInterfaceDeclaration7.ts, 0, 0)) +} diff --git a/tests/baselines/reference/parserInterfaceDeclaration7.types b/tests/baselines/reference/parserInterfaceDeclaration7.types new file mode 100644 index 00000000000..8119f50c9f2 --- /dev/null +++ b/tests/baselines/reference/parserInterfaceDeclaration7.types @@ -0,0 +1,4 @@ +=== tests/cases/conformance/parser/ecmascript5/InterfaceDeclarations/parserInterfaceDeclaration7.ts === +export interface I { +>I : I +} diff --git a/tests/baselines/reference/parserMemberAccessorDeclaration15.errors.txt b/tests/baselines/reference/parserMemberAccessorDeclaration15.errors.txt index f76264f6090..cba1e1fee92 100644 --- a/tests/baselines/reference/parserMemberAccessorDeclaration15.errors.txt +++ b/tests/baselines/reference/parserMemberAccessorDeclaration15.errors.txt @@ -1,12 +1,9 @@ -tests/cases/conformance/parser/ecmascript5/MemberAccessorDeclarations/parserMemberAccessorDeclaration15.ts(2,8): error TS2369: A parameter property is only allowed in a constructor implementation. tests/cases/conformance/parser/ecmascript5/MemberAccessorDeclarations/parserMemberAccessorDeclaration15.ts(2,12): error TS2369: A parameter property is only allowed in a constructor implementation. -==== tests/cases/conformance/parser/ecmascript5/MemberAccessorDeclarations/parserMemberAccessorDeclaration15.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/MemberAccessorDeclarations/parserMemberAccessorDeclaration15.ts (1 errors) ==== class C { set Foo(public a: number) { } - ~~~ -!!! error TS2369: A parameter property is only allowed in a constructor implementation. ~~~~~~~~~~~~~~~~ !!! error TS2369: A parameter property is only allowed in a constructor implementation. } \ No newline at end of file diff --git a/tests/baselines/reference/parserMemberAccessorDeclaration4.symbols b/tests/baselines/reference/parserMemberAccessorDeclaration4.symbols index 2750f28943e..f446aa992ca 100644 --- a/tests/baselines/reference/parserMemberAccessorDeclaration4.symbols +++ b/tests/baselines/reference/parserMemberAccessorDeclaration4.symbols @@ -3,6 +3,6 @@ class C { >C : Symbol(C, Decl(parserMemberAccessorDeclaration4.ts, 0, 0)) set a(i) { } ->a : Symbol(a, Decl(parserMemberAccessorDeclaration4.ts, 0, 9)) +>a : Symbol(C.a, Decl(parserMemberAccessorDeclaration4.ts, 0, 9)) >i : Symbol(i, Decl(parserMemberAccessorDeclaration4.ts, 1, 8)) } diff --git a/tests/baselines/reference/parserMethodSignature1.symbols b/tests/baselines/reference/parserMethodSignature1.symbols index 2c12a156ef0..a905dc1056c 100644 --- a/tests/baselines/reference/parserMethodSignature1.symbols +++ b/tests/baselines/reference/parserMethodSignature1.symbols @@ -3,5 +3,5 @@ interface I { >I : Symbol(I, Decl(parserMethodSignature1.ts, 0, 0)) A(); ->A : Symbol(A, Decl(parserMethodSignature1.ts, 0, 13)) +>A : Symbol(I.A, Decl(parserMethodSignature1.ts, 0, 13)) } diff --git a/tests/baselines/reference/parserMethodSignature2.symbols b/tests/baselines/reference/parserMethodSignature2.symbols index ba86c20293e..7c7013e1b13 100644 --- a/tests/baselines/reference/parserMethodSignature2.symbols +++ b/tests/baselines/reference/parserMethodSignature2.symbols @@ -3,5 +3,5 @@ interface I { >I : Symbol(I, Decl(parserMethodSignature2.ts, 0, 0)) B?(); ->B : Symbol(B, Decl(parserMethodSignature2.ts, 0, 13)) +>B : Symbol(I.B, Decl(parserMethodSignature2.ts, 0, 13)) } diff --git a/tests/baselines/reference/parserMethodSignature3.symbols b/tests/baselines/reference/parserMethodSignature3.symbols index ce4c0f05561..5f6efea534b 100644 --- a/tests/baselines/reference/parserMethodSignature3.symbols +++ b/tests/baselines/reference/parserMethodSignature3.symbols @@ -3,6 +3,6 @@ interface I { >I : Symbol(I, Decl(parserMethodSignature3.ts, 0, 0)) C(); ->C : Symbol(C, Decl(parserMethodSignature3.ts, 0, 13)) +>C : Symbol(I.C, Decl(parserMethodSignature3.ts, 0, 13)) >T : Symbol(T, Decl(parserMethodSignature3.ts, 1, 4)) } diff --git a/tests/baselines/reference/parserMethodSignature4.symbols b/tests/baselines/reference/parserMethodSignature4.symbols index d1612bf2f4f..7ebcbcbcf5a 100644 --- a/tests/baselines/reference/parserMethodSignature4.symbols +++ b/tests/baselines/reference/parserMethodSignature4.symbols @@ -3,6 +3,6 @@ interface I { >I : Symbol(I, Decl(parserMethodSignature4.ts, 0, 0)) D?(); ->D : Symbol(D, Decl(parserMethodSignature4.ts, 0, 13)) +>D : Symbol(I.D, Decl(parserMethodSignature4.ts, 0, 13)) >T : Symbol(T, Decl(parserMethodSignature4.ts, 1, 5)) } diff --git a/tests/baselines/reference/parserModifierOnPropertySignature1.errors.txt b/tests/baselines/reference/parserModifierOnPropertySignature1.errors.txt index 4c8750a80c4..1ddb9712bf2 100644 --- a/tests/baselines/reference/parserModifierOnPropertySignature1.errors.txt +++ b/tests/baselines/reference/parserModifierOnPropertySignature1.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserModifierOnPropertySignature1.ts(2,5): error TS1131: Property or signature expected. +tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserModifierOnPropertySignature1.ts(2,5): error TS1070: 'public' modifier cannot appear on a type member. ==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserModifierOnPropertySignature1.ts (1 errors) ==== interface Foo{ public biz; ~~~~~~ -!!! error TS1131: Property or signature expected. +!!! error TS1070: 'public' modifier cannot appear on a type member. } \ No newline at end of file diff --git a/tests/baselines/reference/parserModifierOnPropertySignature2.symbols b/tests/baselines/reference/parserModifierOnPropertySignature2.symbols index ac17a3810bf..496f5736141 100644 --- a/tests/baselines/reference/parserModifierOnPropertySignature2.symbols +++ b/tests/baselines/reference/parserModifierOnPropertySignature2.symbols @@ -3,9 +3,9 @@ interface Foo{ >Foo : Symbol(Foo, Decl(parserModifierOnPropertySignature2.ts, 0, 0)) public ->public : Symbol(public, Decl(parserModifierOnPropertySignature2.ts, 0, 14)) +>public : Symbol(Foo.public, Decl(parserModifierOnPropertySignature2.ts, 0, 14)) biz; ->biz : Symbol(biz, Decl(parserModifierOnPropertySignature2.ts, 1, 10)) +>biz : Symbol(Foo.biz, Decl(parserModifierOnPropertySignature2.ts, 1, 10)) } diff --git a/tests/baselines/reference/parserModifierOnStatementInBlock1.errors.txt b/tests/baselines/reference/parserModifierOnStatementInBlock1.errors.txt index c73c52ddd35..e394705fac0 100644 --- a/tests/baselines/reference/parserModifierOnStatementInBlock1.errors.txt +++ b/tests/baselines/reference/parserModifierOnStatementInBlock1.errors.txt @@ -1,11 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserModifierOnStatementInBlock1.ts(1,17): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserModifierOnStatementInBlock1.ts(2,4): error TS1184: Modifiers cannot appear here. -==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserModifierOnStatementInBlock1.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserModifierOnStatementInBlock1.ts (1 errors) ==== export function foo() { - ~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. export var x = this; ~~~~~~ !!! error TS1184: Modifiers cannot appear here. diff --git a/tests/baselines/reference/parserModifierOnStatementInBlock3.errors.txt b/tests/baselines/reference/parserModifierOnStatementInBlock3.errors.txt index a480a0c4330..9c1ccf68351 100644 --- a/tests/baselines/reference/parserModifierOnStatementInBlock3.errors.txt +++ b/tests/baselines/reference/parserModifierOnStatementInBlock3.errors.txt @@ -1,11 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserModifierOnStatementInBlock3.ts(1,17): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserModifierOnStatementInBlock3.ts(2,4): error TS1184: Modifiers cannot appear here. -==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserModifierOnStatementInBlock3.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserModifierOnStatementInBlock3.ts (1 errors) ==== export function foo() { - ~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. export function bar() { ~~~~~~ !!! error TS1184: Modifiers cannot appear here. diff --git a/tests/baselines/reference/parserModule1.errors.txt b/tests/baselines/reference/parserModule1.errors.txt deleted file mode 100644 index dc5c9c2dd35..00000000000 --- a/tests/baselines/reference/parserModule1.errors.txt +++ /dev/null @@ -1,37 +0,0 @@ -tests/cases/conformance/parser/ecmascript5/ModuleDeclarations/parserModule1.ts(1,19): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. - - -==== tests/cases/conformance/parser/ecmascript5/ModuleDeclarations/parserModule1.ts (1 errors) ==== - export module CompilerDiagnostics { - ~~~~~~~~~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. - export var debug = false; - export interface IDiagnosticWriter { - Alert(output: string): void; - } - - export var diagnosticWriter: IDiagnosticWriter = null; - - export var analysisPass: number = 0; - - export function Alert(output: string) { - if (diagnosticWriter) { - diagnosticWriter.Alert(output); - } - } - - export function debugPrint(s: string) { - if (debug) { - Alert(s); - } - } - - export function assert(condition: boolean, s: string) { - if (debug) { - if (!condition) { - Alert(s); - } - } - } - - } \ No newline at end of file diff --git a/tests/baselines/reference/parserModule1.symbols b/tests/baselines/reference/parserModule1.symbols new file mode 100644 index 00000000000..5215a2e656d --- /dev/null +++ b/tests/baselines/reference/parserModule1.symbols @@ -0,0 +1,69 @@ +=== tests/cases/conformance/parser/ecmascript5/ModuleDeclarations/parserModule1.ts === + export module CompilerDiagnostics { +>CompilerDiagnostics : Symbol(CompilerDiagnostics, Decl(parserModule1.ts, 0, 0)) + + export var debug = false; +>debug : Symbol(debug, Decl(parserModule1.ts, 1, 18)) + + export interface IDiagnosticWriter { +>IDiagnosticWriter : Symbol(IDiagnosticWriter, Decl(parserModule1.ts, 1, 33)) + + Alert(output: string): void; +>Alert : Symbol(IDiagnosticWriter.Alert, Decl(parserModule1.ts, 2, 44)) +>output : Symbol(output, Decl(parserModule1.ts, 3, 18)) + } + + export var diagnosticWriter: IDiagnosticWriter = null; +>diagnosticWriter : Symbol(diagnosticWriter, Decl(parserModule1.ts, 6, 18)) +>IDiagnosticWriter : Symbol(IDiagnosticWriter, Decl(parserModule1.ts, 1, 33)) + + export var analysisPass: number = 0; +>analysisPass : Symbol(analysisPass, Decl(parserModule1.ts, 8, 18)) + + export function Alert(output: string) { +>Alert : Symbol(Alert, Decl(parserModule1.ts, 8, 44)) +>output : Symbol(output, Decl(parserModule1.ts, 10, 30)) + + if (diagnosticWriter) { +>diagnosticWriter : Symbol(diagnosticWriter, Decl(parserModule1.ts, 6, 18)) + + diagnosticWriter.Alert(output); +>diagnosticWriter.Alert : Symbol(IDiagnosticWriter.Alert, Decl(parserModule1.ts, 2, 44)) +>diagnosticWriter : Symbol(diagnosticWriter, Decl(parserModule1.ts, 6, 18)) +>Alert : Symbol(IDiagnosticWriter.Alert, Decl(parserModule1.ts, 2, 44)) +>output : Symbol(output, Decl(parserModule1.ts, 10, 30)) + } + } + + export function debugPrint(s: string) { +>debugPrint : Symbol(debugPrint, Decl(parserModule1.ts, 14, 9)) +>s : Symbol(s, Decl(parserModule1.ts, 16, 35)) + + if (debug) { +>debug : Symbol(debug, Decl(parserModule1.ts, 1, 18)) + + Alert(s); +>Alert : Symbol(Alert, Decl(parserModule1.ts, 8, 44)) +>s : Symbol(s, Decl(parserModule1.ts, 16, 35)) + } + } + + export function assert(condition: boolean, s: string) { +>assert : Symbol(assert, Decl(parserModule1.ts, 20, 9)) +>condition : Symbol(condition, Decl(parserModule1.ts, 22, 31)) +>s : Symbol(s, Decl(parserModule1.ts, 22, 50)) + + if (debug) { +>debug : Symbol(debug, Decl(parserModule1.ts, 1, 18)) + + if (!condition) { +>condition : Symbol(condition, Decl(parserModule1.ts, 22, 31)) + + Alert(s); +>Alert : Symbol(Alert, Decl(parserModule1.ts, 8, 44)) +>s : Symbol(s, Decl(parserModule1.ts, 22, 50)) + } + } + } + + } diff --git a/tests/baselines/reference/parserModule1.types b/tests/baselines/reference/parserModule1.types new file mode 100644 index 00000000000..2d3b670aaa6 --- /dev/null +++ b/tests/baselines/reference/parserModule1.types @@ -0,0 +1,76 @@ +=== tests/cases/conformance/parser/ecmascript5/ModuleDeclarations/parserModule1.ts === + export module CompilerDiagnostics { +>CompilerDiagnostics : typeof CompilerDiagnostics + + export var debug = false; +>debug : boolean +>false : boolean + + export interface IDiagnosticWriter { +>IDiagnosticWriter : IDiagnosticWriter + + Alert(output: string): void; +>Alert : (output: string) => void +>output : string + } + + export var diagnosticWriter: IDiagnosticWriter = null; +>diagnosticWriter : IDiagnosticWriter +>IDiagnosticWriter : IDiagnosticWriter +>null : null + + export var analysisPass: number = 0; +>analysisPass : number +>0 : number + + export function Alert(output: string) { +>Alert : (output: string) => void +>output : string + + if (diagnosticWriter) { +>diagnosticWriter : IDiagnosticWriter + + diagnosticWriter.Alert(output); +>diagnosticWriter.Alert(output) : void +>diagnosticWriter.Alert : (output: string) => void +>diagnosticWriter : IDiagnosticWriter +>Alert : (output: string) => void +>output : string + } + } + + export function debugPrint(s: string) { +>debugPrint : (s: string) => void +>s : string + + if (debug) { +>debug : boolean + + Alert(s); +>Alert(s) : void +>Alert : (output: string) => void +>s : string + } + } + + export function assert(condition: boolean, s: string) { +>assert : (condition: boolean, s: string) => void +>condition : boolean +>s : string + + if (debug) { +>debug : boolean + + if (!condition) { +>!condition : boolean +>condition : boolean + + Alert(s); +>Alert(s) : void +>Alert : (output: string) => void +>s : string + } + } + } + + } diff --git a/tests/baselines/reference/parserOptionalTypeMembers1.symbols b/tests/baselines/reference/parserOptionalTypeMembers1.symbols index ce12a4ec19b..fb4d93d7f9c 100644 --- a/tests/baselines/reference/parserOptionalTypeMembers1.symbols +++ b/tests/baselines/reference/parserOptionalTypeMembers1.symbols @@ -3,21 +3,21 @@ interface PropertyDescriptor2 { >PropertyDescriptor2 : Symbol(PropertyDescriptor2, Decl(parserOptionalTypeMembers1.ts, 0, 0)) configurable?: boolean; ->configurable : Symbol(configurable, Decl(parserOptionalTypeMembers1.ts, 0, 31)) +>configurable : Symbol(PropertyDescriptor2.configurable, Decl(parserOptionalTypeMembers1.ts, 0, 31)) enumerable?: boolean; ->enumerable : Symbol(enumerable, Decl(parserOptionalTypeMembers1.ts, 1, 27)) +>enumerable : Symbol(PropertyDescriptor2.enumerable, Decl(parserOptionalTypeMembers1.ts, 1, 27)) value?: any; ->value : Symbol(value, Decl(parserOptionalTypeMembers1.ts, 2, 25)) +>value : Symbol(PropertyDescriptor2.value, Decl(parserOptionalTypeMembers1.ts, 2, 25)) writable?: boolean; ->writable : Symbol(writable, Decl(parserOptionalTypeMembers1.ts, 3, 16)) +>writable : Symbol(PropertyDescriptor2.writable, Decl(parserOptionalTypeMembers1.ts, 3, 16)) get?(): any; ->get : Symbol(get, Decl(parserOptionalTypeMembers1.ts, 4, 23)) +>get : Symbol(PropertyDescriptor2.get, Decl(parserOptionalTypeMembers1.ts, 4, 23)) set?(v: any): void; ->set : Symbol(set, Decl(parserOptionalTypeMembers1.ts, 5, 16)) +>set : Symbol(PropertyDescriptor2.set, Decl(parserOptionalTypeMembers1.ts, 5, 16)) >v : Symbol(v, Decl(parserOptionalTypeMembers1.ts, 6, 9)) } diff --git a/tests/baselines/reference/parserPropertySignature1.symbols b/tests/baselines/reference/parserPropertySignature1.symbols index 6b8a26c4164..e32b1173d53 100644 --- a/tests/baselines/reference/parserPropertySignature1.symbols +++ b/tests/baselines/reference/parserPropertySignature1.symbols @@ -3,5 +3,5 @@ interface I { >I : Symbol(I, Decl(parserPropertySignature1.ts, 0, 0)) A; ->A : Symbol(A, Decl(parserPropertySignature1.ts, 0, 13)) +>A : Symbol(I.A, Decl(parserPropertySignature1.ts, 0, 13)) } diff --git a/tests/baselines/reference/parserPropertySignature2.symbols b/tests/baselines/reference/parserPropertySignature2.symbols index 334c0655908..6ec329e7b6d 100644 --- a/tests/baselines/reference/parserPropertySignature2.symbols +++ b/tests/baselines/reference/parserPropertySignature2.symbols @@ -3,5 +3,5 @@ interface I { >I : Symbol(I, Decl(parserPropertySignature2.ts, 0, 0)) B?; ->B : Symbol(B, Decl(parserPropertySignature2.ts, 0, 13)) +>B : Symbol(I.B, Decl(parserPropertySignature2.ts, 0, 13)) } diff --git a/tests/baselines/reference/parserPropertySignature3.symbols b/tests/baselines/reference/parserPropertySignature3.symbols index c2b70b58be8..84e39dab5ec 100644 --- a/tests/baselines/reference/parserPropertySignature3.symbols +++ b/tests/baselines/reference/parserPropertySignature3.symbols @@ -3,5 +3,5 @@ interface I { >I : Symbol(I, Decl(parserPropertySignature3.ts, 0, 0)) C:any; ->C : Symbol(C, Decl(parserPropertySignature3.ts, 0, 13)) +>C : Symbol(I.C, Decl(parserPropertySignature3.ts, 0, 13)) } diff --git a/tests/baselines/reference/parserPropertySignature4.symbols b/tests/baselines/reference/parserPropertySignature4.symbols index cd61b14d34c..071a826b7f9 100644 --- a/tests/baselines/reference/parserPropertySignature4.symbols +++ b/tests/baselines/reference/parserPropertySignature4.symbols @@ -3,5 +3,5 @@ interface I { >I : Symbol(I, Decl(parserPropertySignature4.ts, 0, 0)) D?:any; ->D : Symbol(D, Decl(parserPropertySignature4.ts, 0, 13)) +>D : Symbol(I.D, Decl(parserPropertySignature4.ts, 0, 13)) } diff --git a/tests/baselines/reference/parserSymbolIndexer3.errors.txt b/tests/baselines/reference/parserSymbolIndexer3.errors.txt index 5484a096d4c..27d3a522b3e 100644 --- a/tests/baselines/reference/parserSymbolIndexer3.errors.txt +++ b/tests/baselines/reference/parserSymbolIndexer3.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer3.ts(2,13): error TS1023: An index signature parameter type must be 'string' or 'number'. +tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer3.ts(2,5): error TS1071: 'static' modifier cannot appear on an index signature. ==== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer3.ts (1 errors) ==== class C { static [s: symbol]: string; - ~ -!!! error TS1023: An index signature parameter type must be 'string' or 'number'. + ~~~~~~ +!!! error TS1071: 'static' modifier cannot appear on an index signature. } \ No newline at end of file diff --git a/tests/baselines/reference/parserSymbolProperty1.symbols b/tests/baselines/reference/parserSymbolProperty1.symbols index b337b6ae30b..4622f37a0e4 100644 --- a/tests/baselines/reference/parserSymbolProperty1.symbols +++ b/tests/baselines/reference/parserSymbolProperty1.symbols @@ -3,7 +3,7 @@ interface I { >I : Symbol(I, Decl(parserSymbolProperty1.ts, 0, 0)) [Symbol.iterator]: string; ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) } diff --git a/tests/baselines/reference/parserSymbolProperty2.symbols b/tests/baselines/reference/parserSymbolProperty2.symbols index d4bfa388fa8..f5bb7fa0f53 100644 --- a/tests/baselines/reference/parserSymbolProperty2.symbols +++ b/tests/baselines/reference/parserSymbolProperty2.symbols @@ -3,7 +3,7 @@ interface I { >I : Symbol(I, Decl(parserSymbolProperty2.ts, 0, 0)) [Symbol.unscopables](): string; ->Symbol.unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, --, --)) +>Symbol.unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) } diff --git a/tests/baselines/reference/parserSymbolProperty3.symbols b/tests/baselines/reference/parserSymbolProperty3.symbols index b740d5be4ad..9d2266ad4b7 100644 --- a/tests/baselines/reference/parserSymbolProperty3.symbols +++ b/tests/baselines/reference/parserSymbolProperty3.symbols @@ -3,7 +3,7 @@ declare class C { >C : Symbol(C, Decl(parserSymbolProperty3.ts, 0, 0)) [Symbol.unscopables](): string; ->Symbol.unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, --, --)) +>Symbol.unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) } diff --git a/tests/baselines/reference/parserSymbolProperty4.symbols b/tests/baselines/reference/parserSymbolProperty4.symbols index 65250e977b7..e37cb6bc011 100644 --- a/tests/baselines/reference/parserSymbolProperty4.symbols +++ b/tests/baselines/reference/parserSymbolProperty4.symbols @@ -3,7 +3,7 @@ declare class C { >C : Symbol(C, Decl(parserSymbolProperty4.ts, 0, 0)) [Symbol.toPrimitive]: string; ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) } diff --git a/tests/baselines/reference/parserSymbolProperty5.symbols b/tests/baselines/reference/parserSymbolProperty5.symbols index c883c0aa12f..f8fb7d93417 100644 --- a/tests/baselines/reference/parserSymbolProperty5.symbols +++ b/tests/baselines/reference/parserSymbolProperty5.symbols @@ -3,7 +3,7 @@ class C { >C : Symbol(C, Decl(parserSymbolProperty5.ts, 0, 0)) [Symbol.toPrimitive]: string; ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) } diff --git a/tests/baselines/reference/parserSymbolProperty6.symbols b/tests/baselines/reference/parserSymbolProperty6.symbols index d8a2b9bf1cc..7fb83ea9ffa 100644 --- a/tests/baselines/reference/parserSymbolProperty6.symbols +++ b/tests/baselines/reference/parserSymbolProperty6.symbols @@ -3,7 +3,7 @@ class C { >C : Symbol(C, Decl(parserSymbolProperty6.ts, 0, 0)) [Symbol.toStringTag]: string = ""; ->Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, --, --)) +>Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) } diff --git a/tests/baselines/reference/parserSymbolProperty7.symbols b/tests/baselines/reference/parserSymbolProperty7.symbols index 9319dfe87bb..8d71cbb1a0d 100644 --- a/tests/baselines/reference/parserSymbolProperty7.symbols +++ b/tests/baselines/reference/parserSymbolProperty7.symbols @@ -3,7 +3,7 @@ class C { >C : Symbol(C, Decl(parserSymbolProperty7.ts, 0, 0)) [Symbol.toStringTag](): void { } ->Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, --, --)) +>Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) } diff --git a/tests/baselines/reference/parserSymbolProperty8.symbols b/tests/baselines/reference/parserSymbolProperty8.symbols index 2a58473973e..e20dd2dbba4 100644 --- a/tests/baselines/reference/parserSymbolProperty8.symbols +++ b/tests/baselines/reference/parserSymbolProperty8.symbols @@ -3,7 +3,7 @@ var x: { >x : Symbol(x, Decl(parserSymbolProperty8.ts, 0, 3)) [Symbol.toPrimitive](): string ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) } diff --git a/tests/baselines/reference/parserSymbolProperty9.symbols b/tests/baselines/reference/parserSymbolProperty9.symbols index 85c66b21d5e..c70643c254a 100644 --- a/tests/baselines/reference/parserSymbolProperty9.symbols +++ b/tests/baselines/reference/parserSymbolProperty9.symbols @@ -3,7 +3,7 @@ var x: { >x : Symbol(x, Decl(parserSymbolProperty9.ts, 0, 3)) [Symbol.toPrimitive]: string ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) } diff --git a/tests/baselines/reference/parser_duplicateLabel1.errors.txt b/tests/baselines/reference/parser_duplicateLabel1.errors.txt index a4319aaa7b9..c98ede21ecf 100644 --- a/tests/baselines/reference/parser_duplicateLabel1.errors.txt +++ b/tests/baselines/reference/parser_duplicateLabel1.errors.txt @@ -1,13 +1,16 @@ tests/cases/conformance/parser/ecmascript5/Statements/LabeledStatements/parser_duplicateLabel1.ts(1,1): error TS7028: Unused label. tests/cases/conformance/parser/ecmascript5/Statements/LabeledStatements/parser_duplicateLabel1.ts(2,1): error TS1114: Duplicate label 'target' +tests/cases/conformance/parser/ecmascript5/Statements/LabeledStatements/parser_duplicateLabel1.ts(2,1): error TS7028: Unused label. -==== tests/cases/conformance/parser/ecmascript5/Statements/LabeledStatements/parser_duplicateLabel1.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/Statements/LabeledStatements/parser_duplicateLabel1.ts (3 errors) ==== target: ~~~~~~ !!! error TS7028: Unused label. target: ~~~~~~ !!! error TS1114: Duplicate label 'target' + ~~~~~~ +!!! error TS7028: Unused label. while (true) { } \ No newline at end of file diff --git a/tests/baselines/reference/parser_duplicateLabel2.errors.txt b/tests/baselines/reference/parser_duplicateLabel2.errors.txt index 123949fa5aa..cbad8b73a21 100644 --- a/tests/baselines/reference/parser_duplicateLabel2.errors.txt +++ b/tests/baselines/reference/parser_duplicateLabel2.errors.txt @@ -1,8 +1,9 @@ tests/cases/conformance/parser/ecmascript5/Statements/LabeledStatements/parser_duplicateLabel2.ts(1,1): error TS7028: Unused label. tests/cases/conformance/parser/ecmascript5/Statements/LabeledStatements/parser_duplicateLabel2.ts(3,3): error TS1114: Duplicate label 'target' +tests/cases/conformance/parser/ecmascript5/Statements/LabeledStatements/parser_duplicateLabel2.ts(3,3): error TS7028: Unused label. -==== tests/cases/conformance/parser/ecmascript5/Statements/LabeledStatements/parser_duplicateLabel2.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/Statements/LabeledStatements/parser_duplicateLabel2.ts (3 errors) ==== target: ~~~~~~ !!! error TS7028: Unused label. @@ -10,6 +11,8 @@ tests/cases/conformance/parser/ecmascript5/Statements/LabeledStatements/parser_d target: ~~~~~~ !!! error TS1114: Duplicate label 'target' + ~~~~~~ +!!! error TS7028: Unused label. while (true) { } } \ No newline at end of file diff --git a/tests/baselines/reference/parser_duplicateLabel3.types b/tests/baselines/reference/parser_duplicateLabel3.types index 88ea435bf3e..cc420085ef0 100644 --- a/tests/baselines/reference/parser_duplicateLabel3.types +++ b/tests/baselines/reference/parser_duplicateLabel3.types @@ -7,7 +7,7 @@ while (true) { >true : boolean function f() { ->f : () => void +>f : () => never target: >target : any diff --git a/tests/baselines/reference/parserharness.errors.txt b/tests/baselines/reference/parserharness.errors.txt index 66afa3d010f..963ce12ddf1 100644 --- a/tests/baselines/reference/parserharness.errors.txt +++ b/tests/baselines/reference/parserharness.errors.txt @@ -7,11 +7,11 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(25,17): er tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(41,12): error TS2304: Cannot find name 'ActiveXObject'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(43,19): error TS2304: Cannot find name 'require'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(44,14): error TS2304: Cannot find name 'require'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(341,13): error TS2304: Cannot find name 'errorHandlerStack'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(347,13): error TS2304: Cannot find name 'errorHandlerStack'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(351,17): error TS2304: Cannot find name 'errorHandlerStack'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(354,17): error TS2304: Cannot find name 'errorHandlerStack'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(354,35): error TS2304: Cannot find name 'errorHandlerStack'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(341,13): error TS2662: Cannot find name 'errorHandlerStack'. Did you mean the static member 'Runnable.errorHandlerStack'? +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(347,13): error TS2662: Cannot find name 'errorHandlerStack'. Did you mean the static member 'Runnable.errorHandlerStack'? +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(351,17): error TS2662: Cannot find name 'errorHandlerStack'. Did you mean the static member 'Runnable.errorHandlerStack'? +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(354,17): error TS2662: Cannot find name 'errorHandlerStack'. Did you mean the static member 'Runnable.errorHandlerStack'? +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(354,35): error TS2662: Cannot find name 'errorHandlerStack'. Did you mean the static member 'Runnable.errorHandlerStack'? tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(691,50): error TS2304: Cannot find name 'ITextWriter'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(716,47): error TS2503: Cannot find namespace 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(721,62): error TS2304: Cannot find name 'ITextWriter'. @@ -471,7 +471,7 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(2030,32): static pushGlobalErrorHandler(done: IDone) { errorHandlerStack.push(function (e) { ~~~~~~~~~~~~~~~~~ -!!! error TS2304: Cannot find name 'errorHandlerStack'. +!!! error TS2662: Cannot find name 'errorHandlerStack'. Did you mean the static member 'Runnable.errorHandlerStack'? done(e); }); } @@ -479,20 +479,20 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(2030,32): static popGlobalErrorHandler() { errorHandlerStack.pop(); ~~~~~~~~~~~~~~~~~ -!!! error TS2304: Cannot find name 'errorHandlerStack'. +!!! error TS2662: Cannot find name 'errorHandlerStack'. Did you mean the static member 'Runnable.errorHandlerStack'? } static handleError(e: Error) { if (errorHandlerStack.length === 0) { ~~~~~~~~~~~~~~~~~ -!!! error TS2304: Cannot find name 'errorHandlerStack'. +!!! error TS2662: Cannot find name 'errorHandlerStack'. Did you mean the static member 'Runnable.errorHandlerStack'? IO.printLine('Global error: ' + e); } else { errorHandlerStack[errorHandlerStack.length - 1](e); ~~~~~~~~~~~~~~~~~ -!!! error TS2304: Cannot find name 'errorHandlerStack'. +!!! error TS2662: Cannot find name 'errorHandlerStack'. Did you mean the static member 'Runnable.errorHandlerStack'? ~~~~~~~~~~~~~~~~~ -!!! error TS2304: Cannot find name 'errorHandlerStack'. +!!! error TS2662: Cannot find name 'errorHandlerStack'. Did you mean the static member 'Runnable.errorHandlerStack'? } } } diff --git a/tests/baselines/reference/parserindenter.errors.txt b/tests/baselines/reference/parserindenter.errors.txt index a332abab7bb..8ccc9220710 100644 --- a/tests/baselines/reference/parserindenter.errors.txt +++ b/tests/baselines/reference/parserindenter.errors.txt @@ -28,7 +28,7 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(152,63): tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(153,30): error TS2304: Cannot find name 'List_TextEditInfo'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(155,32): error TS2304: Cannot find name 'AuthorTokenKind'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(182,79): error TS2503: Cannot find namespace 'Services'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(183,20): error TS2304: Cannot find name 'GetIndentSizeFromText'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(183,20): error TS2662: Cannot find name 'GetIndentSizeFromText'. Did you mean the static member 'Indenter.GetIndentSizeFromText'? tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(186,67): error TS2503: Cannot find namespace 'Services'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(207,50): error TS2304: Cannot find name 'TokenSpan'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(207,67): error TS2304: Cannot find name 'ParseNode'. @@ -373,7 +373,7 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(736,38): !!! error TS2503: Cannot find namespace 'Services'. return GetIndentSizeFromText(indentText, editorOptions, /*includeNonIndentChars:*/ false); ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2304: Cannot find name 'GetIndentSizeFromText'. +!!! error TS2662: Cannot find name 'GetIndentSizeFromText'. Did you mean the static member 'Indenter.GetIndentSizeFromText'? } static GetIndentSizeFromText(text: string, editorOptions: Services.EditorOptions, includeNonIndentChars: boolean): number { diff --git a/tests/baselines/reference/parsingClassRecoversWhenHittingUnexpectedSemicolon.symbols b/tests/baselines/reference/parsingClassRecoversWhenHittingUnexpectedSemicolon.symbols index 36d09277a3e..2f0087416b9 100644 --- a/tests/baselines/reference/parsingClassRecoversWhenHittingUnexpectedSemicolon.symbols +++ b/tests/baselines/reference/parsingClassRecoversWhenHittingUnexpectedSemicolon.symbols @@ -3,9 +3,9 @@ class C { >C : Symbol(C, Decl(parsingClassRecoversWhenHittingUnexpectedSemicolon.ts, 0, 0)) public f() { }; ->f : Symbol(f, Decl(parsingClassRecoversWhenHittingUnexpectedSemicolon.ts, 0, 9)) +>f : Symbol(C.f, Decl(parsingClassRecoversWhenHittingUnexpectedSemicolon.ts, 0, 9)) private m; ->m : Symbol(m, Decl(parsingClassRecoversWhenHittingUnexpectedSemicolon.ts, 1, 19)) +>m : Symbol(C.m, Decl(parsingClassRecoversWhenHittingUnexpectedSemicolon.ts, 1, 19)) } diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution1_classic.errors.txt b/tests/baselines/reference/pathMappingBasedModuleResolution1_classic.errors.txt new file mode 100644 index 00000000000..85e25ec99fb --- /dev/null +++ b/tests/baselines/reference/pathMappingBasedModuleResolution1_classic.errors.txt @@ -0,0 +1,7 @@ +error TS5060: Option 'paths' cannot be used without specifying '--baseUrl' option. + + +!!! error TS5060: Option 'paths' cannot be used without specifying '--baseUrl' option. +==== c:/root/f1.ts (0 errors) ==== + export var x = 1; + \ No newline at end of file diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution1_classic.js b/tests/baselines/reference/pathMappingBasedModuleResolution1_classic.js new file mode 100644 index 00000000000..1a1bd387dce --- /dev/null +++ b/tests/baselines/reference/pathMappingBasedModuleResolution1_classic.js @@ -0,0 +1,9 @@ +//// [f1.ts] +export var x = 1; + + +//// [f1.js] +define(["require", "exports"], function (require, exports) { + "use strict"; + exports.x = 1; +}); diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution1_classic.trace.json b/tests/baselines/reference/pathMappingBasedModuleResolution1_classic.trace.json new file mode 100644 index 00000000000..0637a088a01 --- /dev/null +++ b/tests/baselines/reference/pathMappingBasedModuleResolution1_classic.trace.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution1_node.errors.txt b/tests/baselines/reference/pathMappingBasedModuleResolution1_node.errors.txt new file mode 100644 index 00000000000..85e25ec99fb --- /dev/null +++ b/tests/baselines/reference/pathMappingBasedModuleResolution1_node.errors.txt @@ -0,0 +1,7 @@ +error TS5060: Option 'paths' cannot be used without specifying '--baseUrl' option. + + +!!! error TS5060: Option 'paths' cannot be used without specifying '--baseUrl' option. +==== c:/root/f1.ts (0 errors) ==== + export var x = 1; + \ No newline at end of file diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution1_node.js b/tests/baselines/reference/pathMappingBasedModuleResolution1_node.js new file mode 100644 index 00000000000..5fcaa23b976 --- /dev/null +++ b/tests/baselines/reference/pathMappingBasedModuleResolution1_node.js @@ -0,0 +1,7 @@ +//// [f1.ts] +export var x = 1; + + +//// [f1.js] +"use strict"; +exports.x = 1; diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution1_node.trace.json b/tests/baselines/reference/pathMappingBasedModuleResolution1_node.trace.json new file mode 100644 index 00000000000..0637a088a01 --- /dev/null +++ b/tests/baselines/reference/pathMappingBasedModuleResolution1_node.trace.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution2_classic.errors.txt b/tests/baselines/reference/pathMappingBasedModuleResolution2_classic.errors.txt new file mode 100644 index 00000000000..ad954bd142b --- /dev/null +++ b/tests/baselines/reference/pathMappingBasedModuleResolution2_classic.errors.txt @@ -0,0 +1,8 @@ +error TS5061: Pattern '*1*' can have at most one '*' character +error TS5062: Substitution '*2*' in pattern '*1*' in can have at most one '*' character + + +!!! error TS5061: Pattern '*1*' can have at most one '*' character +!!! error TS5062: Substitution '*2*' in pattern '*1*' in can have at most one '*' character +==== tests/cases/compiler/root/src/folder1/file1.ts (0 errors) ==== + export var x = 1; \ No newline at end of file diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution2_classic.js b/tests/baselines/reference/pathMappingBasedModuleResolution2_classic.js new file mode 100644 index 00000000000..52dab845bb2 --- /dev/null +++ b/tests/baselines/reference/pathMappingBasedModuleResolution2_classic.js @@ -0,0 +1,8 @@ +//// [file1.ts] +export var x = 1; + +//// [file1.js] +define(["require", "exports"], function (require, exports) { + "use strict"; + exports.x = 1; +}); diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution2_classic.trace.json b/tests/baselines/reference/pathMappingBasedModuleResolution2_classic.trace.json new file mode 100644 index 00000000000..0637a088a01 --- /dev/null +++ b/tests/baselines/reference/pathMappingBasedModuleResolution2_classic.trace.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution2_node.errors.txt b/tests/baselines/reference/pathMappingBasedModuleResolution2_node.errors.txt new file mode 100644 index 00000000000..ad954bd142b --- /dev/null +++ b/tests/baselines/reference/pathMappingBasedModuleResolution2_node.errors.txt @@ -0,0 +1,8 @@ +error TS5061: Pattern '*1*' can have at most one '*' character +error TS5062: Substitution '*2*' in pattern '*1*' in can have at most one '*' character + + +!!! error TS5061: Pattern '*1*' can have at most one '*' character +!!! error TS5062: Substitution '*2*' in pattern '*1*' in can have at most one '*' character +==== tests/cases/compiler/root/src/folder1/file1.ts (0 errors) ==== + export var x = 1; \ No newline at end of file diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution2_node.js b/tests/baselines/reference/pathMappingBasedModuleResolution2_node.js new file mode 100644 index 00000000000..8c8b5c9a926 --- /dev/null +++ b/tests/baselines/reference/pathMappingBasedModuleResolution2_node.js @@ -0,0 +1,6 @@ +//// [file1.ts] +export var x = 1; + +//// [file1.js] +"use strict"; +exports.x = 1; diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution2_node.trace.json b/tests/baselines/reference/pathMappingBasedModuleResolution2_node.trace.json new file mode 100644 index 00000000000..0637a088a01 --- /dev/null +++ b/tests/baselines/reference/pathMappingBasedModuleResolution2_node.trace.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution3_classic.js b/tests/baselines/reference/pathMappingBasedModuleResolution3_classic.js new file mode 100644 index 00000000000..15867b085ea --- /dev/null +++ b/tests/baselines/reference/pathMappingBasedModuleResolution3_classic.js @@ -0,0 +1,42 @@ +//// [tests/cases/compiler/pathMappingBasedModuleResolution3_classic.ts] //// + +//// [file1.ts] + +// baseUrl set via command line + +import {x} from "folder2/file2" +declare function use(a: any): void; +use(x.toExponential()); + +//// [file2.ts] +import {x as a} from "./file3" // found with baseurl +import {y as b} from "file4" // found with fallback +export var x = a + b; + +//// [file3.ts] +export var x = 1; + +//// [file4.ts] +export var y = 100; + +//// [file3.js] +define(["require", "exports"], function (require, exports) { + "use strict"; + exports.x = 1; +}); +//// [file4.js] +define(["require", "exports"], function (require, exports) { + "use strict"; + exports.y = 100; +}); +//// [file2.js] +define(["require", "exports", "./file3", "file4"], function (require, exports, file3_1, file4_1) { + "use strict"; + exports.x = file3_1.x + file4_1.y; +}); +//// [file1.js] +// baseUrl set via command line +define(["require", "exports", "folder2/file2"], function (require, exports, file2_1) { + "use strict"; + use(file2_1.x.toExponential()); +}); diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution3_classic.symbols b/tests/baselines/reference/pathMappingBasedModuleResolution3_classic.symbols new file mode 100644 index 00000000000..97ec40d4cb4 --- /dev/null +++ b/tests/baselines/reference/pathMappingBasedModuleResolution3_classic.symbols @@ -0,0 +1,39 @@ +=== c:/root/folder1/file1.ts === + +// baseUrl set via command line + +import {x} from "folder2/file2" +>x : Symbol(x, Decl(file1.ts, 3, 8)) + +declare function use(a: any): void; +>use : Symbol(use, Decl(file1.ts, 3, 31)) +>a : Symbol(a, Decl(file1.ts, 4, 21)) + +use(x.toExponential()); +>use : Symbol(use, Decl(file1.ts, 3, 31)) +>x.toExponential : Symbol(Number.toExponential, Decl(lib.d.ts, --, --)) +>x : Symbol(x, Decl(file1.ts, 3, 8)) +>toExponential : Symbol(Number.toExponential, Decl(lib.d.ts, --, --)) + +=== c:/root/folder2/file2.ts === +import {x as a} from "./file3" // found with baseurl +>x : Symbol(a, Decl(file2.ts, 0, 8)) +>a : Symbol(a, Decl(file2.ts, 0, 8)) + +import {y as b} from "file4" // found with fallback +>y : Symbol(b, Decl(file2.ts, 1, 8)) +>b : Symbol(b, Decl(file2.ts, 1, 8)) + +export var x = a + b; +>x : Symbol(x, Decl(file2.ts, 2, 10)) +>a : Symbol(a, Decl(file2.ts, 0, 8)) +>b : Symbol(b, Decl(file2.ts, 1, 8)) + +=== c:/root/folder2/file3.ts === +export var x = 1; +>x : Symbol(x, Decl(file3.ts, 0, 10)) + +=== c:/file4.ts === +export var y = 100; +>y : Symbol(y, Decl(file4.ts, 0, 10)) + diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution3_classic.trace.json b/tests/baselines/reference/pathMappingBasedModuleResolution3_classic.trace.json new file mode 100644 index 00000000000..8b003e05e8f --- /dev/null +++ b/tests/baselines/reference/pathMappingBasedModuleResolution3_classic.trace.json @@ -0,0 +1,24 @@ +[ + "======== Resolving module 'folder2/file2' from 'c:/root/folder1/file1.ts'. ========", + "Explicitly specified module resolution kind: 'Classic'.", + "'baseUrl' option is set to 'c:/root', using this value to resolve non-relative module name 'folder2/file2'", + "Resolving module name 'folder2/file2' relative to base url 'c:/root' - 'c:/root/folder2/file2'.", + "File 'c:/root/folder2/file2.ts' exist - use it as a name resolution result.", + "======== Module name 'folder2/file2' was successfully resolved to 'c:/root/folder2/file2.ts'. ========", + "======== Resolving module './file3' from 'c:/root/folder2/file2.ts'. ========", + "Explicitly specified module resolution kind: 'Classic'.", + "File 'c:/root/folder2/file3.ts' exist - use it as a name resolution result.", + "======== Module name './file3' was successfully resolved to 'c:/root/folder2/file3.ts'. ========", + "======== Resolving module 'file4' from 'c:/root/folder2/file2.ts'. ========", + "Explicitly specified module resolution kind: 'Classic'.", + "'baseUrl' option is set to 'c:/root', using this value to resolve non-relative module name 'file4'", + "Resolving module name 'file4' relative to base url 'c:/root' - 'c:/root/file4'.", + "File 'c:/root/file4.ts' does not exist.", + "File 'c:/root/file4.d.ts' does not exist.", + "File 'c:/root/folder2/file4.ts' does not exist.", + "File 'c:/root/folder2/file4.d.ts' does not exist.", + "File 'c:/root/file4.ts' does not exist.", + "File 'c:/root/file4.d.ts' does not exist.", + "File 'c:/file4.ts' exist - use it as a name resolution result.", + "======== Module name 'file4' was successfully resolved to 'c:/file4.ts'. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution3_classic.types b/tests/baselines/reference/pathMappingBasedModuleResolution3_classic.types new file mode 100644 index 00000000000..359811ff3b2 --- /dev/null +++ b/tests/baselines/reference/pathMappingBasedModuleResolution3_classic.types @@ -0,0 +1,44 @@ +=== c:/root/folder1/file1.ts === + +// baseUrl set via command line + +import {x} from "folder2/file2" +>x : number + +declare function use(a: any): void; +>use : (a: any) => void +>a : any + +use(x.toExponential()); +>use(x.toExponential()) : void +>use : (a: any) => void +>x.toExponential() : string +>x.toExponential : (fractionDigits?: number) => string +>x : number +>toExponential : (fractionDigits?: number) => string + +=== c:/root/folder2/file2.ts === +import {x as a} from "./file3" // found with baseurl +>x : number +>a : number + +import {y as b} from "file4" // found with fallback +>y : number +>b : number + +export var x = a + b; +>x : number +>a + b : number +>a : number +>b : number + +=== c:/root/folder2/file3.ts === +export var x = 1; +>x : number +>1 : number + +=== c:/file4.ts === +export var y = 100; +>y : number +>100 : number + diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution3_node.js b/tests/baselines/reference/pathMappingBasedModuleResolution3_node.js new file mode 100644 index 00000000000..cbff6087530 --- /dev/null +++ b/tests/baselines/reference/pathMappingBasedModuleResolution3_node.js @@ -0,0 +1,34 @@ +//// [tests/cases/compiler/pathMappingBasedModuleResolution3_node.ts] //// + +//// [file1.ts] + +// baseUrl set via command line + +import {x} from "folder2/file2" +declare function use(a: any): void; +use(x.toExponential()); + +//// [file2.ts] +import {x as a} from "./file3" // found with baseurl +import {y as b} from "file4" // found with fallback +export var x = a + b; + +//// [file3.ts] +export var x = 1; + +//// [index.d.ts] +export var y: number; + +//// [file3.js] +"use strict"; +exports.x = 1; +//// [file2.js] +"use strict"; +var file3_1 = require("./file3"); // found with baseurl +var file4_1 = require("file4"); // found with fallback +exports.x = file3_1.x + file4_1.y; +//// [file1.js] +// baseUrl set via command line +"use strict"; +var file2_1 = require("folder2/file2"); +use(file2_1.x.toExponential()); diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution3_node.symbols b/tests/baselines/reference/pathMappingBasedModuleResolution3_node.symbols new file mode 100644 index 00000000000..487dea2fb89 --- /dev/null +++ b/tests/baselines/reference/pathMappingBasedModuleResolution3_node.symbols @@ -0,0 +1,39 @@ +=== c:/root/folder1/file1.ts === + +// baseUrl set via command line + +import {x} from "folder2/file2" +>x : Symbol(x, Decl(file1.ts, 3, 8)) + +declare function use(a: any): void; +>use : Symbol(use, Decl(file1.ts, 3, 31)) +>a : Symbol(a, Decl(file1.ts, 4, 21)) + +use(x.toExponential()); +>use : Symbol(use, Decl(file1.ts, 3, 31)) +>x.toExponential : Symbol(Number.toExponential, Decl(lib.d.ts, --, --)) +>x : Symbol(x, Decl(file1.ts, 3, 8)) +>toExponential : Symbol(Number.toExponential, Decl(lib.d.ts, --, --)) + +=== c:/root/folder2/file2.ts === +import {x as a} from "./file3" // found with baseurl +>x : Symbol(a, Decl(file2.ts, 0, 8)) +>a : Symbol(a, Decl(file2.ts, 0, 8)) + +import {y as b} from "file4" // found with fallback +>y : Symbol(b, Decl(file2.ts, 1, 8)) +>b : Symbol(b, Decl(file2.ts, 1, 8)) + +export var x = a + b; +>x : Symbol(x, Decl(file2.ts, 2, 10)) +>a : Symbol(a, Decl(file2.ts, 0, 8)) +>b : Symbol(b, Decl(file2.ts, 1, 8)) + +=== c:/root/folder2/file3.ts === +export var x = 1; +>x : Symbol(x, Decl(file3.ts, 0, 10)) + +=== c:/node_modules/file4/index.d.ts === +export var y: number; +>y : Symbol(y, Decl(index.d.ts, 0, 10)) + diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution3_node.trace.json b/tests/baselines/reference/pathMappingBasedModuleResolution3_node.trace.json new file mode 100644 index 00000000000..af5e20a3cc3 --- /dev/null +++ b/tests/baselines/reference/pathMappingBasedModuleResolution3_node.trace.json @@ -0,0 +1,63 @@ +[ + "======== Resolving module 'folder2/file2' from 'c:/root/folder1/file1.ts'. ========", + "Explicitly specified module resolution kind: 'NodeJs'.", + "'baseUrl' option is set to 'c:/root', using this value to resolve non-relative module name 'folder2/file2'", + "Resolving module name 'folder2/file2' relative to base url 'c:/root' - 'c:/root/folder2/file2'.", + "Loading module as file / folder, candidate module location 'c:/root/folder2/file2'.", + "File 'c:/root/folder2/file2.ts' exist - use it as a name resolution result.", + "======== Module name 'folder2/file2' was successfully resolved to 'c:/root/folder2/file2.ts'. ========", + "======== Resolving module './file3' from 'c:/root/folder2/file2.ts'. ========", + "Explicitly specified module resolution kind: 'NodeJs'.", + "Loading module as file / folder, candidate module location 'c:/root/folder2/file3'.", + "File 'c:/root/folder2/file3.ts' exist - use it as a name resolution result.", + "======== Module name './file3' was successfully resolved to 'c:/root/folder2/file3.ts'. ========", + "======== Resolving module 'file4' from 'c:/root/folder2/file2.ts'. ========", + "Explicitly specified module resolution kind: 'NodeJs'.", + "'baseUrl' option is set to 'c:/root', using this value to resolve non-relative module name 'file4'", + "Resolving module name 'file4' relative to base url 'c:/root' - 'c:/root/file4'.", + "Loading module as file / folder, candidate module location 'c:/root/file4'.", + "File 'c:/root/file4.ts' does not exist.", + "File 'c:/root/file4.tsx' does not exist.", + "File 'c:/root/file4.d.ts' does not exist.", + "File 'c:/root/file4/package.json' does not exist.", + "File 'c:/root/file4/index.ts' does not exist.", + "File 'c:/root/file4/index.tsx' does not exist.", + "File 'c:/root/file4/index.d.ts' does not exist.", + "Loading module 'file4' from 'node_modules' folder.", + "File 'c:/root/folder2/node_modules/file4.ts' does not exist.", + "File 'c:/root/folder2/node_modules/file4.tsx' does not exist.", + "File 'c:/root/folder2/node_modules/file4.d.ts' does not exist.", + "File 'c:/root/folder2/node_modules/file4/package.json' does not exist.", + "File 'c:/root/folder2/node_modules/file4/index.ts' does not exist.", + "File 'c:/root/folder2/node_modules/file4/index.tsx' does not exist.", + "File 'c:/root/folder2/node_modules/file4/index.d.ts' does not exist.", + "File 'c:/root/folder2/node_modules/@types/file4.ts' does not exist.", + "File 'c:/root/folder2/node_modules/@types/file4.tsx' does not exist.", + "File 'c:/root/folder2/node_modules/@types/file4.d.ts' does not exist.", + "File 'c:/root/folder2/node_modules/@types/file4/package.json' does not exist.", + "File 'c:/root/folder2/node_modules/@types/file4/index.ts' does not exist.", + "File 'c:/root/folder2/node_modules/@types/file4/index.tsx' does not exist.", + "File 'c:/root/folder2/node_modules/@types/file4/index.d.ts' does not exist.", + "File 'c:/root/node_modules/file4.ts' does not exist.", + "File 'c:/root/node_modules/file4.tsx' does not exist.", + "File 'c:/root/node_modules/file4.d.ts' does not exist.", + "File 'c:/root/node_modules/file4/package.json' does not exist.", + "File 'c:/root/node_modules/file4/index.ts' does not exist.", + "File 'c:/root/node_modules/file4/index.tsx' does not exist.", + "File 'c:/root/node_modules/file4/index.d.ts' does not exist.", + "File 'c:/root/node_modules/@types/file4.ts' does not exist.", + "File 'c:/root/node_modules/@types/file4.tsx' does not exist.", + "File 'c:/root/node_modules/@types/file4.d.ts' does not exist.", + "File 'c:/root/node_modules/@types/file4/package.json' does not exist.", + "File 'c:/root/node_modules/@types/file4/index.ts' does not exist.", + "File 'c:/root/node_modules/@types/file4/index.tsx' does not exist.", + "File 'c:/root/node_modules/@types/file4/index.d.ts' does not exist.", + "File 'c:/node_modules/file4.ts' does not exist.", + "File 'c:/node_modules/file4.tsx' does not exist.", + "File 'c:/node_modules/file4.d.ts' does not exist.", + "File 'c:/node_modules/file4/package.json' does not exist.", + "File 'c:/node_modules/file4/index.ts' does not exist.", + "File 'c:/node_modules/file4/index.tsx' does not exist.", + "File 'c:/node_modules/file4/index.d.ts' exist - use it as a name resolution result.", + "======== Module name 'file4' was successfully resolved to 'c:/node_modules/file4/index.d.ts'. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution3_node.types b/tests/baselines/reference/pathMappingBasedModuleResolution3_node.types new file mode 100644 index 00000000000..78597cf50ef --- /dev/null +++ b/tests/baselines/reference/pathMappingBasedModuleResolution3_node.types @@ -0,0 +1,43 @@ +=== c:/root/folder1/file1.ts === + +// baseUrl set via command line + +import {x} from "folder2/file2" +>x : number + +declare function use(a: any): void; +>use : (a: any) => void +>a : any + +use(x.toExponential()); +>use(x.toExponential()) : void +>use : (a: any) => void +>x.toExponential() : string +>x.toExponential : (fractionDigits?: number) => string +>x : number +>toExponential : (fractionDigits?: number) => string + +=== c:/root/folder2/file2.ts === +import {x as a} from "./file3" // found with baseurl +>x : number +>a : number + +import {y as b} from "file4" // found with fallback +>y : number +>b : number + +export var x = a + b; +>x : number +>a + b : number +>a : number +>b : number + +=== c:/root/folder2/file3.ts === +export var x = 1; +>x : number +>1 : number + +=== c:/node_modules/file4/index.d.ts === +export var y: number; +>y : number + diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution4_classic.js b/tests/baselines/reference/pathMappingBasedModuleResolution4_classic.js new file mode 100644 index 00000000000..c1de8cea6c9 --- /dev/null +++ b/tests/baselines/reference/pathMappingBasedModuleResolution4_classic.js @@ -0,0 +1,38 @@ +//// [tests/cases/compiler/pathMappingBasedModuleResolution4_classic.ts] //// + +//// [file1.ts] +import {x} from "folder2/file2" +declare function use(a: any): void; +use(x.toExponential()); + +//// [file2.ts] +import {x as a} from "./file3" // found with baseurl +import {y as b} from "file4" // found with fallback +export var x = a + b; + +//// [file3.ts] +export var x = 1; + +//// [file4.ts] +export var y = 100; + +//// [file3.js] +define(["require", "exports"], function (require, exports) { + "use strict"; + exports.x = 1; +}); +//// [file4.js] +define(["require", "exports"], function (require, exports) { + "use strict"; + exports.y = 100; +}); +//// [file2.js] +define(["require", "exports", "./file3", "file4"], function (require, exports, file3_1, file4_1) { + "use strict"; + exports.x = file3_1.x + file4_1.y; +}); +//// [file1.js] +define(["require", "exports", "folder2/file2"], function (require, exports, file2_1) { + "use strict"; + use(file2_1.x.toExponential()); +}); diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution4_classic.symbols b/tests/baselines/reference/pathMappingBasedModuleResolution4_classic.symbols new file mode 100644 index 00000000000..7c1943dae46 --- /dev/null +++ b/tests/baselines/reference/pathMappingBasedModuleResolution4_classic.symbols @@ -0,0 +1,36 @@ +=== c:/root/folder1/file1.ts === +import {x} from "folder2/file2" +>x : Symbol(x, Decl(file1.ts, 0, 8)) + +declare function use(a: any): void; +>use : Symbol(use, Decl(file1.ts, 0, 31)) +>a : Symbol(a, Decl(file1.ts, 1, 21)) + +use(x.toExponential()); +>use : Symbol(use, Decl(file1.ts, 0, 31)) +>x.toExponential : Symbol(Number.toExponential, Decl(lib.d.ts, --, --)) +>x : Symbol(x, Decl(file1.ts, 0, 8)) +>toExponential : Symbol(Number.toExponential, Decl(lib.d.ts, --, --)) + +=== c:/root/folder2/file2.ts === +import {x as a} from "./file3" // found with baseurl +>x : Symbol(a, Decl(file2.ts, 0, 8)) +>a : Symbol(a, Decl(file2.ts, 0, 8)) + +import {y as b} from "file4" // found with fallback +>y : Symbol(b, Decl(file2.ts, 1, 8)) +>b : Symbol(b, Decl(file2.ts, 1, 8)) + +export var x = a + b; +>x : Symbol(x, Decl(file2.ts, 2, 10)) +>a : Symbol(a, Decl(file2.ts, 0, 8)) +>b : Symbol(b, Decl(file2.ts, 1, 8)) + +=== c:/root/folder2/file3.ts === +export var x = 1; +>x : Symbol(x, Decl(file3.ts, 0, 10)) + +=== c:/file4.ts === +export var y = 100; +>y : Symbol(y, Decl(file4.ts, 0, 10)) + diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution4_classic.trace.json b/tests/baselines/reference/pathMappingBasedModuleResolution4_classic.trace.json new file mode 100644 index 00000000000..8b003e05e8f --- /dev/null +++ b/tests/baselines/reference/pathMappingBasedModuleResolution4_classic.trace.json @@ -0,0 +1,24 @@ +[ + "======== Resolving module 'folder2/file2' from 'c:/root/folder1/file1.ts'. ========", + "Explicitly specified module resolution kind: 'Classic'.", + "'baseUrl' option is set to 'c:/root', using this value to resolve non-relative module name 'folder2/file2'", + "Resolving module name 'folder2/file2' relative to base url 'c:/root' - 'c:/root/folder2/file2'.", + "File 'c:/root/folder2/file2.ts' exist - use it as a name resolution result.", + "======== Module name 'folder2/file2' was successfully resolved to 'c:/root/folder2/file2.ts'. ========", + "======== Resolving module './file3' from 'c:/root/folder2/file2.ts'. ========", + "Explicitly specified module resolution kind: 'Classic'.", + "File 'c:/root/folder2/file3.ts' exist - use it as a name resolution result.", + "======== Module name './file3' was successfully resolved to 'c:/root/folder2/file3.ts'. ========", + "======== Resolving module 'file4' from 'c:/root/folder2/file2.ts'. ========", + "Explicitly specified module resolution kind: 'Classic'.", + "'baseUrl' option is set to 'c:/root', using this value to resolve non-relative module name 'file4'", + "Resolving module name 'file4' relative to base url 'c:/root' - 'c:/root/file4'.", + "File 'c:/root/file4.ts' does not exist.", + "File 'c:/root/file4.d.ts' does not exist.", + "File 'c:/root/folder2/file4.ts' does not exist.", + "File 'c:/root/folder2/file4.d.ts' does not exist.", + "File 'c:/root/file4.ts' does not exist.", + "File 'c:/root/file4.d.ts' does not exist.", + "File 'c:/file4.ts' exist - use it as a name resolution result.", + "======== Module name 'file4' was successfully resolved to 'c:/file4.ts'. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution4_classic.types b/tests/baselines/reference/pathMappingBasedModuleResolution4_classic.types new file mode 100644 index 00000000000..d225246e2f9 --- /dev/null +++ b/tests/baselines/reference/pathMappingBasedModuleResolution4_classic.types @@ -0,0 +1,41 @@ +=== c:/root/folder1/file1.ts === +import {x} from "folder2/file2" +>x : number + +declare function use(a: any): void; +>use : (a: any) => void +>a : any + +use(x.toExponential()); +>use(x.toExponential()) : void +>use : (a: any) => void +>x.toExponential() : string +>x.toExponential : (fractionDigits?: number) => string +>x : number +>toExponential : (fractionDigits?: number) => string + +=== c:/root/folder2/file2.ts === +import {x as a} from "./file3" // found with baseurl +>x : number +>a : number + +import {y as b} from "file4" // found with fallback +>y : number +>b : number + +export var x = a + b; +>x : number +>a + b : number +>a : number +>b : number + +=== c:/root/folder2/file3.ts === +export var x = 1; +>x : number +>1 : number + +=== c:/file4.ts === +export var y = 100; +>y : number +>100 : number + diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution4_node.js b/tests/baselines/reference/pathMappingBasedModuleResolution4_node.js new file mode 100644 index 00000000000..c5a08d55d8b --- /dev/null +++ b/tests/baselines/reference/pathMappingBasedModuleResolution4_node.js @@ -0,0 +1,30 @@ +//// [tests/cases/compiler/pathMappingBasedModuleResolution4_node.ts] //// + +//// [file1.ts] +import {x} from "folder2/file2" +declare function use(a: any): void; +use(x.toExponential()); + +//// [file2.ts] +import {x as a} from "./file3" // found with baseurl +import {y as b} from "file4" // found with fallback +export var x = a + b; + +//// [file3.ts] +export var x = 1; + +//// [index.d.ts] +export var y: number; + +//// [file3.js] +"use strict"; +exports.x = 1; +//// [file2.js] +"use strict"; +var file3_1 = require("./file3"); // found with baseurl +var file4_1 = require("file4"); // found with fallback +exports.x = file3_1.x + file4_1.y; +//// [file1.js] +"use strict"; +var file2_1 = require("folder2/file2"); +use(file2_1.x.toExponential()); diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution4_node.symbols b/tests/baselines/reference/pathMappingBasedModuleResolution4_node.symbols new file mode 100644 index 00000000000..fb1c5be9de6 --- /dev/null +++ b/tests/baselines/reference/pathMappingBasedModuleResolution4_node.symbols @@ -0,0 +1,36 @@ +=== c:/root/folder1/file1.ts === +import {x} from "folder2/file2" +>x : Symbol(x, Decl(file1.ts, 0, 8)) + +declare function use(a: any): void; +>use : Symbol(use, Decl(file1.ts, 0, 31)) +>a : Symbol(a, Decl(file1.ts, 1, 21)) + +use(x.toExponential()); +>use : Symbol(use, Decl(file1.ts, 0, 31)) +>x.toExponential : Symbol(Number.toExponential, Decl(lib.d.ts, --, --)) +>x : Symbol(x, Decl(file1.ts, 0, 8)) +>toExponential : Symbol(Number.toExponential, Decl(lib.d.ts, --, --)) + +=== c:/root/folder2/file2.ts === +import {x as a} from "./file3" // found with baseurl +>x : Symbol(a, Decl(file2.ts, 0, 8)) +>a : Symbol(a, Decl(file2.ts, 0, 8)) + +import {y as b} from "file4" // found with fallback +>y : Symbol(b, Decl(file2.ts, 1, 8)) +>b : Symbol(b, Decl(file2.ts, 1, 8)) + +export var x = a + b; +>x : Symbol(x, Decl(file2.ts, 2, 10)) +>a : Symbol(a, Decl(file2.ts, 0, 8)) +>b : Symbol(b, Decl(file2.ts, 1, 8)) + +=== c:/root/folder2/file3.ts === +export var x = 1; +>x : Symbol(x, Decl(file3.ts, 0, 10)) + +=== c:/node_modules/file4/index.d.ts === +export var y: number; +>y : Symbol(y, Decl(index.d.ts, 0, 10)) + diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution4_node.trace.json b/tests/baselines/reference/pathMappingBasedModuleResolution4_node.trace.json new file mode 100644 index 00000000000..af5e20a3cc3 --- /dev/null +++ b/tests/baselines/reference/pathMappingBasedModuleResolution4_node.trace.json @@ -0,0 +1,63 @@ +[ + "======== Resolving module 'folder2/file2' from 'c:/root/folder1/file1.ts'. ========", + "Explicitly specified module resolution kind: 'NodeJs'.", + "'baseUrl' option is set to 'c:/root', using this value to resolve non-relative module name 'folder2/file2'", + "Resolving module name 'folder2/file2' relative to base url 'c:/root' - 'c:/root/folder2/file2'.", + "Loading module as file / folder, candidate module location 'c:/root/folder2/file2'.", + "File 'c:/root/folder2/file2.ts' exist - use it as a name resolution result.", + "======== Module name 'folder2/file2' was successfully resolved to 'c:/root/folder2/file2.ts'. ========", + "======== Resolving module './file3' from 'c:/root/folder2/file2.ts'. ========", + "Explicitly specified module resolution kind: 'NodeJs'.", + "Loading module as file / folder, candidate module location 'c:/root/folder2/file3'.", + "File 'c:/root/folder2/file3.ts' exist - use it as a name resolution result.", + "======== Module name './file3' was successfully resolved to 'c:/root/folder2/file3.ts'. ========", + "======== Resolving module 'file4' from 'c:/root/folder2/file2.ts'. ========", + "Explicitly specified module resolution kind: 'NodeJs'.", + "'baseUrl' option is set to 'c:/root', using this value to resolve non-relative module name 'file4'", + "Resolving module name 'file4' relative to base url 'c:/root' - 'c:/root/file4'.", + "Loading module as file / folder, candidate module location 'c:/root/file4'.", + "File 'c:/root/file4.ts' does not exist.", + "File 'c:/root/file4.tsx' does not exist.", + "File 'c:/root/file4.d.ts' does not exist.", + "File 'c:/root/file4/package.json' does not exist.", + "File 'c:/root/file4/index.ts' does not exist.", + "File 'c:/root/file4/index.tsx' does not exist.", + "File 'c:/root/file4/index.d.ts' does not exist.", + "Loading module 'file4' from 'node_modules' folder.", + "File 'c:/root/folder2/node_modules/file4.ts' does not exist.", + "File 'c:/root/folder2/node_modules/file4.tsx' does not exist.", + "File 'c:/root/folder2/node_modules/file4.d.ts' does not exist.", + "File 'c:/root/folder2/node_modules/file4/package.json' does not exist.", + "File 'c:/root/folder2/node_modules/file4/index.ts' does not exist.", + "File 'c:/root/folder2/node_modules/file4/index.tsx' does not exist.", + "File 'c:/root/folder2/node_modules/file4/index.d.ts' does not exist.", + "File 'c:/root/folder2/node_modules/@types/file4.ts' does not exist.", + "File 'c:/root/folder2/node_modules/@types/file4.tsx' does not exist.", + "File 'c:/root/folder2/node_modules/@types/file4.d.ts' does not exist.", + "File 'c:/root/folder2/node_modules/@types/file4/package.json' does not exist.", + "File 'c:/root/folder2/node_modules/@types/file4/index.ts' does not exist.", + "File 'c:/root/folder2/node_modules/@types/file4/index.tsx' does not exist.", + "File 'c:/root/folder2/node_modules/@types/file4/index.d.ts' does not exist.", + "File 'c:/root/node_modules/file4.ts' does not exist.", + "File 'c:/root/node_modules/file4.tsx' does not exist.", + "File 'c:/root/node_modules/file4.d.ts' does not exist.", + "File 'c:/root/node_modules/file4/package.json' does not exist.", + "File 'c:/root/node_modules/file4/index.ts' does not exist.", + "File 'c:/root/node_modules/file4/index.tsx' does not exist.", + "File 'c:/root/node_modules/file4/index.d.ts' does not exist.", + "File 'c:/root/node_modules/@types/file4.ts' does not exist.", + "File 'c:/root/node_modules/@types/file4.tsx' does not exist.", + "File 'c:/root/node_modules/@types/file4.d.ts' does not exist.", + "File 'c:/root/node_modules/@types/file4/package.json' does not exist.", + "File 'c:/root/node_modules/@types/file4/index.ts' does not exist.", + "File 'c:/root/node_modules/@types/file4/index.tsx' does not exist.", + "File 'c:/root/node_modules/@types/file4/index.d.ts' does not exist.", + "File 'c:/node_modules/file4.ts' does not exist.", + "File 'c:/node_modules/file4.tsx' does not exist.", + "File 'c:/node_modules/file4.d.ts' does not exist.", + "File 'c:/node_modules/file4/package.json' does not exist.", + "File 'c:/node_modules/file4/index.ts' does not exist.", + "File 'c:/node_modules/file4/index.tsx' does not exist.", + "File 'c:/node_modules/file4/index.d.ts' exist - use it as a name resolution result.", + "======== Module name 'file4' was successfully resolved to 'c:/node_modules/file4/index.d.ts'. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution4_node.types b/tests/baselines/reference/pathMappingBasedModuleResolution4_node.types new file mode 100644 index 00000000000..5478a601f02 --- /dev/null +++ b/tests/baselines/reference/pathMappingBasedModuleResolution4_node.types @@ -0,0 +1,40 @@ +=== c:/root/folder1/file1.ts === +import {x} from "folder2/file2" +>x : number + +declare function use(a: any): void; +>use : (a: any) => void +>a : any + +use(x.toExponential()); +>use(x.toExponential()) : void +>use : (a: any) => void +>x.toExponential() : string +>x.toExponential : (fractionDigits?: number) => string +>x : number +>toExponential : (fractionDigits?: number) => string + +=== c:/root/folder2/file2.ts === +import {x as a} from "./file3" // found with baseurl +>x : number +>a : number + +import {y as b} from "file4" // found with fallback +>y : number +>b : number + +export var x = a + b; +>x : number +>a + b : number +>a : number +>b : number + +=== c:/root/folder2/file3.ts === +export var x = 1; +>x : number +>1 : number + +=== c:/node_modules/file4/index.d.ts === +export var y: number; +>y : number + diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution5_classic.js b/tests/baselines/reference/pathMappingBasedModuleResolution5_classic.js new file mode 100644 index 00000000000..24297f85e35 --- /dev/null +++ b/tests/baselines/reference/pathMappingBasedModuleResolution5_classic.js @@ -0,0 +1,55 @@ +//// [tests/cases/compiler/pathMappingBasedModuleResolution5_classic.ts] //// + +//// [file1.ts] +import {x} from "folder2/file1" +import {y} from "folder3/file2" +import {z} from "components/file3" +import {z1} from "file4" + +declare function use(a: any): void; + +use(x.toExponential()); +use(y.toExponential()); +use(z.toExponential()); +use(z1.toExponential()); + +//// [file1.ts] +export var x = 1; + +//// [file2.ts] +export var y = 1; + +//// [file3.ts] +export var z = 1; + +//// [file4.ts] +export var z1 = 1; + +//// [file1.js] +define(["require", "exports"], function (require, exports) { + "use strict"; + exports.x = 1; +}); +//// [file2.js] +define(["require", "exports"], function (require, exports) { + "use strict"; + exports.y = 1; +}); +//// [file3.js] +define(["require", "exports"], function (require, exports) { + "use strict"; + exports.z = 1; +}); +//// [file4.js] +define(["require", "exports"], function (require, exports) { + "use strict"; + exports.z1 = 1; +}); +//// [file1.js] +define(["require", "exports", "folder2/file1", "folder3/file2", "components/file3", "file4"], function (require, exports, file1_1, file2_1, file3_1, file4_1) { + "use strict"; + use(file1_1.x.toExponential()); + use(file2_1.y.toExponential()); + use(file3_1.z.toExponential()); + use(file4_1.z1.toExponential()); +}); diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution5_classic.symbols b/tests/baselines/reference/pathMappingBasedModuleResolution5_classic.symbols new file mode 100644 index 00000000000..057b5a622a1 --- /dev/null +++ b/tests/baselines/reference/pathMappingBasedModuleResolution5_classic.symbols @@ -0,0 +1,57 @@ +=== c:/root/folder1/file1.ts === +import {x} from "folder2/file1" +>x : Symbol(x, Decl(file1.ts, 0, 8)) + +import {y} from "folder3/file2" +>y : Symbol(y, Decl(file1.ts, 1, 8)) + +import {z} from "components/file3" +>z : Symbol(z, Decl(file1.ts, 2, 8)) + +import {z1} from "file4" +>z1 : Symbol(z1, Decl(file1.ts, 3, 8)) + +declare function use(a: any): void; +>use : Symbol(use, Decl(file1.ts, 3, 24)) +>a : Symbol(a, Decl(file1.ts, 5, 21)) + +use(x.toExponential()); +>use : Symbol(use, Decl(file1.ts, 3, 24)) +>x.toExponential : Symbol(Number.toExponential, Decl(lib.d.ts, --, --)) +>x : Symbol(x, Decl(file1.ts, 0, 8)) +>toExponential : Symbol(Number.toExponential, Decl(lib.d.ts, --, --)) + +use(y.toExponential()); +>use : Symbol(use, Decl(file1.ts, 3, 24)) +>y.toExponential : Symbol(Number.toExponential, Decl(lib.d.ts, --, --)) +>y : Symbol(y, Decl(file1.ts, 1, 8)) +>toExponential : Symbol(Number.toExponential, Decl(lib.d.ts, --, --)) + +use(z.toExponential()); +>use : Symbol(use, Decl(file1.ts, 3, 24)) +>z.toExponential : Symbol(Number.toExponential, Decl(lib.d.ts, --, --)) +>z : Symbol(z, Decl(file1.ts, 2, 8)) +>toExponential : Symbol(Number.toExponential, Decl(lib.d.ts, --, --)) + +use(z1.toExponential()); +>use : Symbol(use, Decl(file1.ts, 3, 24)) +>z1.toExponential : Symbol(Number.toExponential, Decl(lib.d.ts, --, --)) +>z1 : Symbol(z1, Decl(file1.ts, 3, 8)) +>toExponential : Symbol(Number.toExponential, Decl(lib.d.ts, --, --)) + +=== c:/root/folder2/file1.ts === +export var x = 1; +>x : Symbol(x, Decl(file1.ts, 0, 10)) + +=== c:/root/generated/folder3/file2.ts === +export var y = 1; +>y : Symbol(y, Decl(file2.ts, 0, 10)) + +=== c:/root/shared/components/file3.ts === +export var z = 1; +>z : Symbol(z, Decl(file3.ts, 0, 10)) + +=== c:/file4.ts === +export var z1 = 1; +>z1 : Symbol(z1, Decl(file4.ts, 0, 10)) + diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution5_classic.trace.json b/tests/baselines/reference/pathMappingBasedModuleResolution5_classic.trace.json new file mode 100644 index 00000000000..d1709c82dc6 --- /dev/null +++ b/tests/baselines/reference/pathMappingBasedModuleResolution5_classic.trace.json @@ -0,0 +1,46 @@ +[ + "======== Resolving module 'folder2/file1' from 'c:/root/folder1/file1.ts'. ========", + "Module resolution kind is not specified, using 'Classic'.", + "'baseUrl' option is set to 'c:/root', using this value to resolve non-relative module name 'folder2/file1'", + "'paths' option is specified, looking for a pattern to match module name 'folder2/file1'.", + "Module name 'folder2/file1', matched pattern '*'.", + "Trying substitution '*', candidate module location: 'folder2/file1'.", + "File 'c:/root/folder2/file1.ts' exist - use it as a name resolution result.", + "======== Module name 'folder2/file1' was successfully resolved to 'c:/root/folder2/file1.ts'. ========", + "======== Resolving module 'folder3/file2' from 'c:/root/folder1/file1.ts'. ========", + "Module resolution kind is not specified, using 'Classic'.", + "'baseUrl' option is set to 'c:/root', using this value to resolve non-relative module name 'folder3/file2'", + "'paths' option is specified, looking for a pattern to match module name 'folder3/file2'.", + "Module name 'folder3/file2', matched pattern '*'.", + "Trying substitution '*', candidate module location: 'folder3/file2'.", + "File 'c:/root/folder3/file2.ts' does not exist.", + "File 'c:/root/folder3/file2.d.ts' does not exist.", + "Trying substitution 'generated/*', candidate module location: 'generated/folder3/file2'.", + "File 'c:/root/generated/folder3/file2.ts' exist - use it as a name resolution result.", + "======== Module name 'folder3/file2' was successfully resolved to 'c:/root/generated/folder3/file2.ts'. ========", + "======== Resolving module 'components/file3' from 'c:/root/folder1/file1.ts'. ========", + "Module resolution kind is not specified, using 'Classic'.", + "'baseUrl' option is set to 'c:/root', using this value to resolve non-relative module name 'components/file3'", + "'paths' option is specified, looking for a pattern to match module name 'components/file3'.", + "Module name 'components/file3', matched pattern 'components/*'.", + "Trying substitution 'shared/components/*', candidate module location: 'shared/components/file3'.", + "File 'c:/root/shared/components/file3.ts' exist - use it as a name resolution result.", + "======== Module name 'components/file3' was successfully resolved to 'c:/root/shared/components/file3.ts'. ========", + "======== Resolving module 'file4' from 'c:/root/folder1/file1.ts'. ========", + "Module resolution kind is not specified, using 'Classic'.", + "'baseUrl' option is set to 'c:/root', using this value to resolve non-relative module name 'file4'", + "'paths' option is specified, looking for a pattern to match module name 'file4'.", + "Module name 'file4', matched pattern '*'.", + "Trying substitution '*', candidate module location: 'file4'.", + "File 'c:/root/file4.ts' does not exist.", + "File 'c:/root/file4.d.ts' does not exist.", + "Trying substitution 'generated/*', candidate module location: 'generated/file4'.", + "File 'c:/root/generated/file4.ts' does not exist.", + "File 'c:/root/generated/file4.d.ts' does not exist.", + "File 'c:/root/folder1/file4.ts' does not exist.", + "File 'c:/root/folder1/file4.d.ts' does not exist.", + "File 'c:/root/file4.ts' does not exist.", + "File 'c:/root/file4.d.ts' does not exist.", + "File 'c:/file4.ts' exist - use it as a name resolution result.", + "======== Module name 'file4' was successfully resolved to 'c:/file4.ts'. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution5_classic.types b/tests/baselines/reference/pathMappingBasedModuleResolution5_classic.types new file mode 100644 index 00000000000..32a1f42bc0f --- /dev/null +++ b/tests/baselines/reference/pathMappingBasedModuleResolution5_classic.types @@ -0,0 +1,69 @@ +=== c:/root/folder1/file1.ts === +import {x} from "folder2/file1" +>x : number + +import {y} from "folder3/file2" +>y : number + +import {z} from "components/file3" +>z : number + +import {z1} from "file4" +>z1 : number + +declare function use(a: any): void; +>use : (a: any) => void +>a : any + +use(x.toExponential()); +>use(x.toExponential()) : void +>use : (a: any) => void +>x.toExponential() : string +>x.toExponential : (fractionDigits?: number) => string +>x : number +>toExponential : (fractionDigits?: number) => string + +use(y.toExponential()); +>use(y.toExponential()) : void +>use : (a: any) => void +>y.toExponential() : string +>y.toExponential : (fractionDigits?: number) => string +>y : number +>toExponential : (fractionDigits?: number) => string + +use(z.toExponential()); +>use(z.toExponential()) : void +>use : (a: any) => void +>z.toExponential() : string +>z.toExponential : (fractionDigits?: number) => string +>z : number +>toExponential : (fractionDigits?: number) => string + +use(z1.toExponential()); +>use(z1.toExponential()) : void +>use : (a: any) => void +>z1.toExponential() : string +>z1.toExponential : (fractionDigits?: number) => string +>z1 : number +>toExponential : (fractionDigits?: number) => string + +=== c:/root/folder2/file1.ts === +export var x = 1; +>x : number +>1 : number + +=== c:/root/generated/folder3/file2.ts === +export var y = 1; +>y : number +>1 : number + +=== c:/root/shared/components/file3.ts === +export var z = 1; +>z : number +>1 : number + +=== c:/file4.ts === +export var z1 = 1; +>z1 : number +>1 : number + diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution5_node.js b/tests/baselines/reference/pathMappingBasedModuleResolution5_node.js new file mode 100644 index 00000000000..1958800f918 --- /dev/null +++ b/tests/baselines/reference/pathMappingBasedModuleResolution5_node.js @@ -0,0 +1,46 @@ +//// [tests/cases/compiler/pathMappingBasedModuleResolution5_node.ts] //// + +//// [file1.ts] +import {x} from "folder2/file1" +import {y} from "folder3/file2" +import {z} from "components/file3" +import {z1} from "file4" + +declare function use(a: any): void; + +use(x.toExponential()); +use(y.toExponential()); +use(z.toExponential()); +use(z1.toExponential()); + +//// [file1.ts] +export var x = 1; + +//// [file2.ts] +export var y = 1; + +//// [index.d.ts] +export var z: number; + +//// [file4.ts] +export var z1 = 1; + +//// [file1.js] +"use strict"; +exports.x = 1; +//// [file2.js] +"use strict"; +exports.y = 1; +//// [file4.js] +"use strict"; +exports.z1 = 1; +//// [file1.js] +"use strict"; +var file1_1 = require("folder2/file1"); +var file2_1 = require("folder3/file2"); +var file3_1 = require("components/file3"); +var file4_1 = require("file4"); +use(file1_1.x.toExponential()); +use(file2_1.y.toExponential()); +use(file3_1.z.toExponential()); +use(file4_1.z1.toExponential()); diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution5_node.symbols b/tests/baselines/reference/pathMappingBasedModuleResolution5_node.symbols new file mode 100644 index 00000000000..67bf14607dd --- /dev/null +++ b/tests/baselines/reference/pathMappingBasedModuleResolution5_node.symbols @@ -0,0 +1,57 @@ +=== c:/root/folder1/file1.ts === +import {x} from "folder2/file1" +>x : Symbol(x, Decl(file1.ts, 0, 8)) + +import {y} from "folder3/file2" +>y : Symbol(y, Decl(file1.ts, 1, 8)) + +import {z} from "components/file3" +>z : Symbol(z, Decl(file1.ts, 2, 8)) + +import {z1} from "file4" +>z1 : Symbol(z1, Decl(file1.ts, 3, 8)) + +declare function use(a: any): void; +>use : Symbol(use, Decl(file1.ts, 3, 24)) +>a : Symbol(a, Decl(file1.ts, 5, 21)) + +use(x.toExponential()); +>use : Symbol(use, Decl(file1.ts, 3, 24)) +>x.toExponential : Symbol(Number.toExponential, Decl(lib.d.ts, --, --)) +>x : Symbol(x, Decl(file1.ts, 0, 8)) +>toExponential : Symbol(Number.toExponential, Decl(lib.d.ts, --, --)) + +use(y.toExponential()); +>use : Symbol(use, Decl(file1.ts, 3, 24)) +>y.toExponential : Symbol(Number.toExponential, Decl(lib.d.ts, --, --)) +>y : Symbol(y, Decl(file1.ts, 1, 8)) +>toExponential : Symbol(Number.toExponential, Decl(lib.d.ts, --, --)) + +use(z.toExponential()); +>use : Symbol(use, Decl(file1.ts, 3, 24)) +>z.toExponential : Symbol(Number.toExponential, Decl(lib.d.ts, --, --)) +>z : Symbol(z, Decl(file1.ts, 2, 8)) +>toExponential : Symbol(Number.toExponential, Decl(lib.d.ts, --, --)) + +use(z1.toExponential()); +>use : Symbol(use, Decl(file1.ts, 3, 24)) +>z1.toExponential : Symbol(Number.toExponential, Decl(lib.d.ts, --, --)) +>z1 : Symbol(z1, Decl(file1.ts, 3, 8)) +>toExponential : Symbol(Number.toExponential, Decl(lib.d.ts, --, --)) + +=== c:/root/folder2/file1.ts === +export var x = 1; +>x : Symbol(x, Decl(file1.ts, 0, 10)) + +=== c:/root/generated/folder3/file2.ts === +export var y = 1; +>y : Symbol(y, Decl(file2.ts, 0, 10)) + +=== c:/root/shared/components/file3/index.d.ts === +export var z: number; +>z : Symbol(z, Decl(index.d.ts, 0, 10)) + +=== c:/node_modules/file4.ts === +export var z1 = 1; +>z1 : Symbol(z1, Decl(file4.ts, 0, 10)) + diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution5_node.trace.json b/tests/baselines/reference/pathMappingBasedModuleResolution5_node.trace.json new file mode 100644 index 00000000000..cebd59f01b4 --- /dev/null +++ b/tests/baselines/reference/pathMappingBasedModuleResolution5_node.trace.json @@ -0,0 +1,98 @@ +[ + "======== Resolving module 'folder2/file1' from 'c:/root/folder1/file1.ts'. ========", + "Module resolution kind is not specified, using 'NodeJs'.", + "'baseUrl' option is set to 'c:/root', using this value to resolve non-relative module name 'folder2/file1'", + "'paths' option is specified, looking for a pattern to match module name 'folder2/file1'.", + "Module name 'folder2/file1', matched pattern '*'.", + "Trying substitution '*', candidate module location: 'folder2/file1'.", + "Loading module as file / folder, candidate module location 'c:/root/folder2/file1'.", + "File 'c:/root/folder2/file1.ts' exist - use it as a name resolution result.", + "======== Module name 'folder2/file1' was successfully resolved to 'c:/root/folder2/file1.ts'. ========", + "======== Resolving module 'folder3/file2' from 'c:/root/folder1/file1.ts'. ========", + "Module resolution kind is not specified, using 'NodeJs'.", + "'baseUrl' option is set to 'c:/root', using this value to resolve non-relative module name 'folder3/file2'", + "'paths' option is specified, looking for a pattern to match module name 'folder3/file2'.", + "Module name 'folder3/file2', matched pattern '*'.", + "Trying substitution '*', candidate module location: 'folder3/file2'.", + "Loading module as file / folder, candidate module location 'c:/root/folder3/file2'.", + "File 'c:/root/folder3/file2.ts' does not exist.", + "File 'c:/root/folder3/file2.tsx' does not exist.", + "File 'c:/root/folder3/file2.d.ts' does not exist.", + "File 'c:/root/folder3/file2/package.json' does not exist.", + "File 'c:/root/folder3/file2/index.ts' does not exist.", + "File 'c:/root/folder3/file2/index.tsx' does not exist.", + "File 'c:/root/folder3/file2/index.d.ts' does not exist.", + "Trying substitution 'generated/*', candidate module location: 'generated/folder3/file2'.", + "Loading module as file / folder, candidate module location 'c:/root/generated/folder3/file2'.", + "File 'c:/root/generated/folder3/file2.ts' exist - use it as a name resolution result.", + "======== Module name 'folder3/file2' was successfully resolved to 'c:/root/generated/folder3/file2.ts'. ========", + "======== Resolving module 'components/file3' from 'c:/root/folder1/file1.ts'. ========", + "Module resolution kind is not specified, using 'NodeJs'.", + "'baseUrl' option is set to 'c:/root', using this value to resolve non-relative module name 'components/file3'", + "'paths' option is specified, looking for a pattern to match module name 'components/file3'.", + "Module name 'components/file3', matched pattern 'components/*'.", + "Trying substitution 'shared/components/*', candidate module location: 'shared/components/file3'.", + "Loading module as file / folder, candidate module location 'c:/root/shared/components/file3'.", + "File 'c:/root/shared/components/file3.ts' does not exist.", + "File 'c:/root/shared/components/file3.tsx' does not exist.", + "File 'c:/root/shared/components/file3.d.ts' does not exist.", + "File 'c:/root/shared/components/file3/package.json' does not exist.", + "File 'c:/root/shared/components/file3/index.ts' does not exist.", + "File 'c:/root/shared/components/file3/index.tsx' does not exist.", + "File 'c:/root/shared/components/file3/index.d.ts' exist - use it as a name resolution result.", + "======== Module name 'components/file3' was successfully resolved to 'c:/root/shared/components/file3/index.d.ts'. ========", + "======== Resolving module 'file4' from 'c:/root/folder1/file1.ts'. ========", + "Module resolution kind is not specified, using 'NodeJs'.", + "'baseUrl' option is set to 'c:/root', using this value to resolve non-relative module name 'file4'", + "'paths' option is specified, looking for a pattern to match module name 'file4'.", + "Module name 'file4', matched pattern '*'.", + "Trying substitution '*', candidate module location: 'file4'.", + "Loading module as file / folder, candidate module location 'c:/root/file4'.", + "File 'c:/root/file4.ts' does not exist.", + "File 'c:/root/file4.tsx' does not exist.", + "File 'c:/root/file4.d.ts' does not exist.", + "File 'c:/root/file4/package.json' does not exist.", + "File 'c:/root/file4/index.ts' does not exist.", + "File 'c:/root/file4/index.tsx' does not exist.", + "File 'c:/root/file4/index.d.ts' does not exist.", + "Trying substitution 'generated/*', candidate module location: 'generated/file4'.", + "Loading module as file / folder, candidate module location 'c:/root/generated/file4'.", + "File 'c:/root/generated/file4.ts' does not exist.", + "File 'c:/root/generated/file4.tsx' does not exist.", + "File 'c:/root/generated/file4.d.ts' does not exist.", + "File 'c:/root/generated/file4/package.json' does not exist.", + "File 'c:/root/generated/file4/index.ts' does not exist.", + "File 'c:/root/generated/file4/index.tsx' does not exist.", + "File 'c:/root/generated/file4/index.d.ts' does not exist.", + "Loading module 'file4' from 'node_modules' folder.", + "File 'c:/root/folder1/node_modules/file4.ts' does not exist.", + "File 'c:/root/folder1/node_modules/file4.tsx' does not exist.", + "File 'c:/root/folder1/node_modules/file4.d.ts' does not exist.", + "File 'c:/root/folder1/node_modules/file4/package.json' does not exist.", + "File 'c:/root/folder1/node_modules/file4/index.ts' does not exist.", + "File 'c:/root/folder1/node_modules/file4/index.tsx' does not exist.", + "File 'c:/root/folder1/node_modules/file4/index.d.ts' does not exist.", + "File 'c:/root/folder1/node_modules/@types/file4.ts' does not exist.", + "File 'c:/root/folder1/node_modules/@types/file4.tsx' does not exist.", + "File 'c:/root/folder1/node_modules/@types/file4.d.ts' does not exist.", + "File 'c:/root/folder1/node_modules/@types/file4/package.json' does not exist.", + "File 'c:/root/folder1/node_modules/@types/file4/index.ts' does not exist.", + "File 'c:/root/folder1/node_modules/@types/file4/index.tsx' does not exist.", + "File 'c:/root/folder1/node_modules/@types/file4/index.d.ts' does not exist.", + "File 'c:/root/node_modules/file4.ts' does not exist.", + "File 'c:/root/node_modules/file4.tsx' does not exist.", + "File 'c:/root/node_modules/file4.d.ts' does not exist.", + "File 'c:/root/node_modules/file4/package.json' does not exist.", + "File 'c:/root/node_modules/file4/index.ts' does not exist.", + "File 'c:/root/node_modules/file4/index.tsx' does not exist.", + "File 'c:/root/node_modules/file4/index.d.ts' does not exist.", + "File 'c:/root/node_modules/@types/file4.ts' does not exist.", + "File 'c:/root/node_modules/@types/file4.tsx' does not exist.", + "File 'c:/root/node_modules/@types/file4.d.ts' does not exist.", + "File 'c:/root/node_modules/@types/file4/package.json' does not exist.", + "File 'c:/root/node_modules/@types/file4/index.ts' does not exist.", + "File 'c:/root/node_modules/@types/file4/index.tsx' does not exist.", + "File 'c:/root/node_modules/@types/file4/index.d.ts' does not exist.", + "File 'c:/node_modules/file4.ts' exist - use it as a name resolution result.", + "======== Module name 'file4' was successfully resolved to 'c:/node_modules/file4.ts'. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution5_node.types b/tests/baselines/reference/pathMappingBasedModuleResolution5_node.types new file mode 100644 index 00000000000..1b96e3f4f22 --- /dev/null +++ b/tests/baselines/reference/pathMappingBasedModuleResolution5_node.types @@ -0,0 +1,68 @@ +=== c:/root/folder1/file1.ts === +import {x} from "folder2/file1" +>x : number + +import {y} from "folder3/file2" +>y : number + +import {z} from "components/file3" +>z : number + +import {z1} from "file4" +>z1 : number + +declare function use(a: any): void; +>use : (a: any) => void +>a : any + +use(x.toExponential()); +>use(x.toExponential()) : void +>use : (a: any) => void +>x.toExponential() : string +>x.toExponential : (fractionDigits?: number) => string +>x : number +>toExponential : (fractionDigits?: number) => string + +use(y.toExponential()); +>use(y.toExponential()) : void +>use : (a: any) => void +>y.toExponential() : string +>y.toExponential : (fractionDigits?: number) => string +>y : number +>toExponential : (fractionDigits?: number) => string + +use(z.toExponential()); +>use(z.toExponential()) : void +>use : (a: any) => void +>z.toExponential() : string +>z.toExponential : (fractionDigits?: number) => string +>z : number +>toExponential : (fractionDigits?: number) => string + +use(z1.toExponential()); +>use(z1.toExponential()) : void +>use : (a: any) => void +>z1.toExponential() : string +>z1.toExponential : (fractionDigits?: number) => string +>z1 : number +>toExponential : (fractionDigits?: number) => string + +=== c:/root/folder2/file1.ts === +export var x = 1; +>x : number +>1 : number + +=== c:/root/generated/folder3/file2.ts === +export var y = 1; +>y : number +>1 : number + +=== c:/root/shared/components/file3/index.d.ts === +export var z: number; +>z : number + +=== c:/node_modules/file4.ts === +export var z1 = 1; +>z1 : number +>1 : number + diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution6_classic.js b/tests/baselines/reference/pathMappingBasedModuleResolution6_classic.js new file mode 100644 index 00000000000..1e8f8807e2c --- /dev/null +++ b/tests/baselines/reference/pathMappingBasedModuleResolution6_classic.js @@ -0,0 +1,23 @@ +//// [tests/cases/compiler/pathMappingBasedModuleResolution6_classic.ts] //// + +//// [file1.ts] +import {x} from "./project/file3"; +declare function use(x: string); +use(x.toExponential()); + +//// [file2.d.ts] +export let x: number; + +//// [file3.ts] +export {x} from "../file2"; + +//// [file3.js] +define(["require", "exports", "../file2"], function (require, exports, file2_1) { + "use strict"; + exports.x = file2_1.x; +}); +//// [file1.js] +define(["require", "exports", "./project/file3"], function (require, exports, file3_1) { + "use strict"; + use(file3_1.x.toExponential()); +}); diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution6_classic.symbols b/tests/baselines/reference/pathMappingBasedModuleResolution6_classic.symbols new file mode 100644 index 00000000000..a451ffb2584 --- /dev/null +++ b/tests/baselines/reference/pathMappingBasedModuleResolution6_classic.symbols @@ -0,0 +1,22 @@ +=== c:/root/src/file1.ts === +import {x} from "./project/file3"; +>x : Symbol(x, Decl(file1.ts, 0, 8)) + +declare function use(x: string); +>use : Symbol(use, Decl(file1.ts, 0, 34)) +>x : Symbol(x, Decl(file1.ts, 1, 21)) + +use(x.toExponential()); +>use : Symbol(use, Decl(file1.ts, 0, 34)) +>x.toExponential : Symbol(Number.toExponential, Decl(lib.d.ts, --, --)) +>x : Symbol(x, Decl(file1.ts, 0, 8)) +>toExponential : Symbol(Number.toExponential, Decl(lib.d.ts, --, --)) + +=== c:/root/src/file2.d.ts === +export let x: number; +>x : Symbol(x, Decl(file2.d.ts, 0, 10)) + +=== c:/root/generated/src/project/file3.ts === +export {x} from "../file2"; +>x : Symbol(x, Decl(file3.ts, 0, 8)) + diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution6_classic.trace.json b/tests/baselines/reference/pathMappingBasedModuleResolution6_classic.trace.json new file mode 100644 index 00000000000..20fc416ccd4 --- /dev/null +++ b/tests/baselines/reference/pathMappingBasedModuleResolution6_classic.trace.json @@ -0,0 +1,29 @@ +[ + "======== Resolving module './project/file3' from 'c:/root/src/file1.ts'. ========", + "Module resolution kind is not specified, using 'Classic'.", + "'rootDirs' option is set, using it to resolve relative module name './project/file3'", + "Checking if 'c:/root/src/' is the longest matching prefix for 'c:/root/src/project/file3' - 'true'.", + "Checking if 'c:/root/generated/src/' is the longest matching prefix for 'c:/root/src/project/file3' - 'false'.", + "Longest matching prefix for 'c:/root/src/project/file3' is 'c:/root/src/'", + "Loading 'project/file3' from the root dir 'c:/root/src/', candidate location 'c:/root/src/project/file3'", + "File 'c:/root/src/project/file3.ts' does not exist.", + "File 'c:/root/src/project/file3.d.ts' does not exist.", + "Trying other entries in 'rootDirs'", + "Loading 'project/file3' from the root dir 'c:/root/generated/src', candidate location 'c:/root/generated/src/project/file3'", + "File 'c:/root/generated/src/project/file3.ts' exist - use it as a name resolution result.", + "======== Module name './project/file3' was successfully resolved to 'c:/root/generated/src/project/file3.ts'. ========", + "======== Resolving module '../file2' from 'c:/root/generated/src/project/file3.ts'. ========", + "Module resolution kind is not specified, using 'Classic'.", + "'rootDirs' option is set, using it to resolve relative module name '../file2'", + "Checking if 'c:/root/src/' is the longest matching prefix for 'c:/root/generated/src/file2' - 'false'.", + "Checking if 'c:/root/generated/src/' is the longest matching prefix for 'c:/root/generated/src/file2' - 'true'.", + "Longest matching prefix for 'c:/root/generated/src/file2' is 'c:/root/generated/src/'", + "Loading 'file2' from the root dir 'c:/root/generated/src/', candidate location 'c:/root/generated/src/file2'", + "File 'c:/root/generated/src/file2.ts' does not exist.", + "File 'c:/root/generated/src/file2.d.ts' does not exist.", + "Trying other entries in 'rootDirs'", + "Loading 'file2' from the root dir 'c:/root/src', candidate location 'c:/root/src/file2'", + "File 'c:/root/src/file2.ts' does not exist.", + "File 'c:/root/src/file2.d.ts' exist - use it as a name resolution result.", + "======== Module name '../file2' was successfully resolved to 'c:/root/src/file2.d.ts'. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution6_classic.types b/tests/baselines/reference/pathMappingBasedModuleResolution6_classic.types new file mode 100644 index 00000000000..06d2cbdce34 --- /dev/null +++ b/tests/baselines/reference/pathMappingBasedModuleResolution6_classic.types @@ -0,0 +1,24 @@ +=== c:/root/src/file1.ts === +import {x} from "./project/file3"; +>x : number + +declare function use(x: string); +>use : (x: string) => any +>x : string + +use(x.toExponential()); +>use(x.toExponential()) : any +>use : (x: string) => any +>x.toExponential() : string +>x.toExponential : (fractionDigits?: number) => string +>x : number +>toExponential : (fractionDigits?: number) => string + +=== c:/root/src/file2.d.ts === +export let x: number; +>x : number + +=== c:/root/generated/src/project/file3.ts === +export {x} from "../file2"; +>x : number + diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution6_node.js b/tests/baselines/reference/pathMappingBasedModuleResolution6_node.js new file mode 100644 index 00000000000..6db3fecf83f --- /dev/null +++ b/tests/baselines/reference/pathMappingBasedModuleResolution6_node.js @@ -0,0 +1,21 @@ +//// [tests/cases/compiler/pathMappingBasedModuleResolution6_node.ts] //// + +//// [file1.ts] +import {x} from "./project/file3"; +declare function use(x: string); +use(x.toFixed()); + +//// [index.d.ts] +export let x: number; + +//// [file3.ts] +export {x} from "../file2"; + +//// [file3.js] +"use strict"; +var file2_1 = require("../file2"); +exports.x = file2_1.x; +//// [file1.js] +"use strict"; +var file3_1 = require("./project/file3"); +use(file3_1.x.toFixed()); diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution6_node.symbols b/tests/baselines/reference/pathMappingBasedModuleResolution6_node.symbols new file mode 100644 index 00000000000..06554bae039 --- /dev/null +++ b/tests/baselines/reference/pathMappingBasedModuleResolution6_node.symbols @@ -0,0 +1,22 @@ +=== c:/root/src/file1.ts === +import {x} from "./project/file3"; +>x : Symbol(x, Decl(file1.ts, 0, 8)) + +declare function use(x: string); +>use : Symbol(use, Decl(file1.ts, 0, 34)) +>x : Symbol(x, Decl(file1.ts, 1, 21)) + +use(x.toFixed()); +>use : Symbol(use, Decl(file1.ts, 0, 34)) +>x.toFixed : Symbol(Number.toFixed, Decl(lib.d.ts, --, --)) +>x : Symbol(x, Decl(file1.ts, 0, 8)) +>toFixed : Symbol(Number.toFixed, Decl(lib.d.ts, --, --)) + +=== c:/root/src/file2/index.d.ts === +export let x: number; +>x : Symbol(x, Decl(index.d.ts, 0, 10)) + +=== c:/root/generated/src/project/file3.ts === +export {x} from "../file2"; +>x : Symbol(x, Decl(file3.ts, 0, 8)) + diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution6_node.trace.json b/tests/baselines/reference/pathMappingBasedModuleResolution6_node.trace.json new file mode 100644 index 00000000000..7c5e76a2847 --- /dev/null +++ b/tests/baselines/reference/pathMappingBasedModuleResolution6_node.trace.json @@ -0,0 +1,48 @@ +[ + "======== Resolving module './project/file3' from 'c:/root/src/file1.ts'. ========", + "Module resolution kind is not specified, using 'NodeJs'.", + "'rootDirs' option is set, using it to resolve relative module name './project/file3'", + "Checking if 'c:/root/src/' is the longest matching prefix for 'c:/root/src/project/file3' - 'true'.", + "Checking if 'c:/root/generated/src/' is the longest matching prefix for 'c:/root/src/project/file3' - 'false'.", + "Longest matching prefix for 'c:/root/src/project/file3' is 'c:/root/src/'", + "Loading 'project/file3' from the root dir 'c:/root/src/', candidate location 'c:/root/src/project/file3'", + "Loading module as file / folder, candidate module location 'c:/root/src/project/file3'.", + "File 'c:/root/src/project/file3.ts' does not exist.", + "File 'c:/root/src/project/file3.tsx' does not exist.", + "File 'c:/root/src/project/file3.d.ts' does not exist.", + "File 'c:/root/src/project/file3/package.json' does not exist.", + "File 'c:/root/src/project/file3/index.ts' does not exist.", + "File 'c:/root/src/project/file3/index.tsx' does not exist.", + "File 'c:/root/src/project/file3/index.d.ts' does not exist.", + "Trying other entries in 'rootDirs'", + "Loading 'project/file3' from the root dir 'c:/root/generated/src', candidate location 'c:/root/generated/src/project/file3'", + "Loading module as file / folder, candidate module location 'c:/root/generated/src/project/file3'.", + "File 'c:/root/generated/src/project/file3.ts' exist - use it as a name resolution result.", + "======== Module name './project/file3' was successfully resolved to 'c:/root/generated/src/project/file3.ts'. ========", + "======== Resolving module '../file2' from 'c:/root/generated/src/project/file3.ts'. ========", + "Module resolution kind is not specified, using 'NodeJs'.", + "'rootDirs' option is set, using it to resolve relative module name '../file2'", + "Checking if 'c:/root/src/' is the longest matching prefix for 'c:/root/generated/src/file2' - 'false'.", + "Checking if 'c:/root/generated/src/' is the longest matching prefix for 'c:/root/generated/src/file2' - 'true'.", + "Longest matching prefix for 'c:/root/generated/src/file2' is 'c:/root/generated/src/'", + "Loading 'file2' from the root dir 'c:/root/generated/src/', candidate location 'c:/root/generated/src/file2'", + "Loading module as file / folder, candidate module location 'c:/root/generated/src/file2'.", + "File 'c:/root/generated/src/file2.ts' does not exist.", + "File 'c:/root/generated/src/file2.tsx' does not exist.", + "File 'c:/root/generated/src/file2.d.ts' does not exist.", + "File 'c:/root/generated/src/file2/package.json' does not exist.", + "File 'c:/root/generated/src/file2/index.ts' does not exist.", + "File 'c:/root/generated/src/file2/index.tsx' does not exist.", + "File 'c:/root/generated/src/file2/index.d.ts' does not exist.", + "Trying other entries in 'rootDirs'", + "Loading 'file2' from the root dir 'c:/root/src', candidate location 'c:/root/src/file2'", + "Loading module as file / folder, candidate module location 'c:/root/src/file2'.", + "File 'c:/root/src/file2.ts' does not exist.", + "File 'c:/root/src/file2.tsx' does not exist.", + "File 'c:/root/src/file2.d.ts' does not exist.", + "File 'c:/root/src/file2/package.json' does not exist.", + "File 'c:/root/src/file2/index.ts' does not exist.", + "File 'c:/root/src/file2/index.tsx' does not exist.", + "File 'c:/root/src/file2/index.d.ts' exist - use it as a name resolution result.", + "======== Module name '../file2' was successfully resolved to 'c:/root/src/file2/index.d.ts'. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution6_node.types b/tests/baselines/reference/pathMappingBasedModuleResolution6_node.types new file mode 100644 index 00000000000..2fd10e8e133 --- /dev/null +++ b/tests/baselines/reference/pathMappingBasedModuleResolution6_node.types @@ -0,0 +1,24 @@ +=== c:/root/src/file1.ts === +import {x} from "./project/file3"; +>x : number + +declare function use(x: string); +>use : (x: string) => any +>x : string + +use(x.toFixed()); +>use(x.toFixed()) : any +>use : (x: string) => any +>x.toFixed() : string +>x.toFixed : (fractionDigits?: number) => string +>x : number +>toFixed : (fractionDigits?: number) => string + +=== c:/root/src/file2/index.d.ts === +export let x: number; +>x : number + +=== c:/root/generated/src/project/file3.ts === +export {x} from "../file2"; +>x : number + diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution7_classic.js b/tests/baselines/reference/pathMappingBasedModuleResolution7_classic.js new file mode 100644 index 00000000000..5670f41be0f --- /dev/null +++ b/tests/baselines/reference/pathMappingBasedModuleResolution7_classic.js @@ -0,0 +1,45 @@ +//// [tests/cases/compiler/pathMappingBasedModuleResolution7_classic.ts] //// + +//// [file1.ts] +import {x} from "./project/file2"; +import {y} from "module3"; + +declare function use(x: string); +use(x.toFixed()); +use(y.toFixed()); + +//// [file2.ts] +import {a} from "module1"; +import {b} from "templates/module2"; +import {x as c} from "../file3"; +export let x = a + b + c; + +//// [module1.d.ts] +export let a: number + +//// [module2.ts] +export let b: number; + +//// [file3.d.ts] +export let x: number; + +//// [module3.d.ts] +export let y: number; + + + +//// [module2.js] +define(["require", "exports"], function (require, exports) { + "use strict"; +}); +//// [file2.js] +define(["require", "exports", "module1", "templates/module2", "../file3"], function (require, exports, module1_1, module2_1, file3_1) { + "use strict"; + exports.x = module1_1.a + module2_1.b + file3_1.x; +}); +//// [file1.js] +define(["require", "exports", "./project/file2", "module3"], function (require, exports, file2_1, module3_1) { + "use strict"; + use(file2_1.x.toFixed()); + use(module3_1.y.toFixed()); +}); diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution7_classic.symbols b/tests/baselines/reference/pathMappingBasedModuleResolution7_classic.symbols new file mode 100644 index 00000000000..b1e4751c495 --- /dev/null +++ b/tests/baselines/reference/pathMappingBasedModuleResolution7_classic.symbols @@ -0,0 +1,57 @@ +=== c:/root/src/file1.ts === +import {x} from "./project/file2"; +>x : Symbol(x, Decl(file1.ts, 0, 8)) + +import {y} from "module3"; +>y : Symbol(y, Decl(file1.ts, 1, 8)) + +declare function use(x: string); +>use : Symbol(use, Decl(file1.ts, 1, 26)) +>x : Symbol(x, Decl(file1.ts, 3, 21)) + +use(x.toFixed()); +>use : Symbol(use, Decl(file1.ts, 1, 26)) +>x.toFixed : Symbol(Number.toFixed, Decl(lib.d.ts, --, --)) +>x : Symbol(x, Decl(file1.ts, 0, 8)) +>toFixed : Symbol(Number.toFixed, Decl(lib.d.ts, --, --)) + +use(y.toFixed()); +>use : Symbol(use, Decl(file1.ts, 1, 26)) +>y.toFixed : Symbol(Number.toFixed, Decl(lib.d.ts, --, --)) +>y : Symbol(y, Decl(file1.ts, 1, 8)) +>toFixed : Symbol(Number.toFixed, Decl(lib.d.ts, --, --)) + +=== c:/root/generated/src/project/file2.ts === +import {a} from "module1"; +>a : Symbol(a, Decl(file2.ts, 0, 8)) + +import {b} from "templates/module2"; +>b : Symbol(b, Decl(file2.ts, 1, 8)) + +import {x as c} from "../file3"; +>x : Symbol(c, Decl(file2.ts, 2, 8)) +>c : Symbol(c, Decl(file2.ts, 2, 8)) + +export let x = a + b + c; +>x : Symbol(x, Decl(file2.ts, 3, 10)) +>a : Symbol(a, Decl(file2.ts, 0, 8)) +>b : Symbol(b, Decl(file2.ts, 1, 8)) +>c : Symbol(c, Decl(file2.ts, 2, 8)) + +=== c:/shared/module1.d.ts === +export let a: number +>a : Symbol(a, Decl(module1.d.ts, 0, 10)) + +=== c:/root/generated/src/templates/module2.ts === +export let b: number; +>b : Symbol(b, Decl(module2.ts, 0, 10)) + +=== c:/root/src/file3.d.ts === +export let x: number; +>x : Symbol(x, Decl(file3.d.ts, 0, 10)) + +=== c:/module3.d.ts === +export let y: number; +>y : Symbol(y, Decl(module3.d.ts, 0, 10)) + + diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution7_classic.trace.json b/tests/baselines/reference/pathMappingBasedModuleResolution7_classic.trace.json new file mode 100644 index 00000000000..2d72108210e --- /dev/null +++ b/tests/baselines/reference/pathMappingBasedModuleResolution7_classic.trace.json @@ -0,0 +1,67 @@ +[ + "======== Resolving module './project/file2' from 'c:/root/src/file1.ts'. ========", + "Module resolution kind is not specified, using 'Classic'.", + "'rootDirs' option is set, using it to resolve relative module name './project/file2'", + "Checking if 'c:/root/src/' is the longest matching prefix for 'c:/root/src/project/file2' - 'true'.", + "Checking if 'c:/root/generated/src/' is the longest matching prefix for 'c:/root/src/project/file2' - 'false'.", + "Longest matching prefix for 'c:/root/src/project/file2' is 'c:/root/src/'", + "Loading 'project/file2' from the root dir 'c:/root/src/', candidate location 'c:/root/src/project/file2'", + "File 'c:/root/src/project/file2.ts' does not exist.", + "File 'c:/root/src/project/file2.d.ts' does not exist.", + "Trying other entries in 'rootDirs'", + "Loading 'project/file2' from the root dir 'c:/root/generated/src', candidate location 'c:/root/generated/src/project/file2'", + "File 'c:/root/generated/src/project/file2.ts' exist - use it as a name resolution result.", + "======== Module name './project/file2' was successfully resolved to 'c:/root/generated/src/project/file2.ts'. ========", + "======== Resolving module 'module3' from 'c:/root/src/file1.ts'. ========", + "Module resolution kind is not specified, using 'Classic'.", + "'baseUrl' option is set to 'c:/root', using this value to resolve non-relative module name 'module3'", + "'paths' option is specified, looking for a pattern to match module name 'module3'.", + "Module name 'module3', matched pattern '*'.", + "Trying substitution '*', candidate module location: 'module3'.", + "File 'c:/root/module3.ts' does not exist.", + "File 'c:/root/module3.d.ts' does not exist.", + "Trying substitution 'c:/shared/*', candidate module location: 'c:/shared/module3'.", + "File 'c:/shared/module3.ts' does not exist.", + "File 'c:/shared/module3.d.ts' does not exist.", + "File 'c:/root/src/module3.ts' does not exist.", + "File 'c:/root/src/module3.d.ts' does not exist.", + "File 'c:/root/module3.ts' does not exist.", + "File 'c:/root/module3.d.ts' does not exist.", + "File 'c:/module3.ts' does not exist.", + "File 'c:/module3.d.ts' exist - use it as a name resolution result.", + "======== Module name 'module3' was successfully resolved to 'c:/module3.d.ts'. ========", + "======== Resolving module 'module1' from 'c:/root/generated/src/project/file2.ts'. ========", + "Module resolution kind is not specified, using 'Classic'.", + "'baseUrl' option is set to 'c:/root', using this value to resolve non-relative module name 'module1'", + "'paths' option is specified, looking for a pattern to match module name 'module1'.", + "Module name 'module1', matched pattern '*'.", + "Trying substitution '*', candidate module location: 'module1'.", + "File 'c:/root/module1.ts' does not exist.", + "File 'c:/root/module1.d.ts' does not exist.", + "Trying substitution 'c:/shared/*', candidate module location: 'c:/shared/module1'.", + "File 'c:/shared/module1.ts' does not exist.", + "File 'c:/shared/module1.d.ts' exist - use it as a name resolution result.", + "======== Module name 'module1' was successfully resolved to 'c:/shared/module1.d.ts'. ========", + "======== Resolving module 'templates/module2' from 'c:/root/generated/src/project/file2.ts'. ========", + "Module resolution kind is not specified, using 'Classic'.", + "'baseUrl' option is set to 'c:/root', using this value to resolve non-relative module name 'templates/module2'", + "'paths' option is specified, looking for a pattern to match module name 'templates/module2'.", + "Module name 'templates/module2', matched pattern 'templates/*'.", + "Trying substitution 'generated/src/templates/*', candidate module location: 'generated/src/templates/module2'.", + "File 'c:/root/generated/src/templates/module2.ts' exist - use it as a name resolution result.", + "======== Module name 'templates/module2' was successfully resolved to 'c:/root/generated/src/templates/module2.ts'. ========", + "======== Resolving module '../file3' from 'c:/root/generated/src/project/file2.ts'. ========", + "Module resolution kind is not specified, using 'Classic'.", + "'rootDirs' option is set, using it to resolve relative module name '../file3'", + "Checking if 'c:/root/src/' is the longest matching prefix for 'c:/root/generated/src/file3' - 'false'.", + "Checking if 'c:/root/generated/src/' is the longest matching prefix for 'c:/root/generated/src/file3' - 'true'.", + "Longest matching prefix for 'c:/root/generated/src/file3' is 'c:/root/generated/src/'", + "Loading 'file3' from the root dir 'c:/root/generated/src/', candidate location 'c:/root/generated/src/file3'", + "File 'c:/root/generated/src/file3.ts' does not exist.", + "File 'c:/root/generated/src/file3.d.ts' does not exist.", + "Trying other entries in 'rootDirs'", + "Loading 'file3' from the root dir 'c:/root/src', candidate location 'c:/root/src/file3'", + "File 'c:/root/src/file3.ts' does not exist.", + "File 'c:/root/src/file3.d.ts' exist - use it as a name resolution result.", + "======== Module name '../file3' was successfully resolved to 'c:/root/src/file3.d.ts'. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution7_classic.types b/tests/baselines/reference/pathMappingBasedModuleResolution7_classic.types new file mode 100644 index 00000000000..26c4b425c88 --- /dev/null +++ b/tests/baselines/reference/pathMappingBasedModuleResolution7_classic.types @@ -0,0 +1,63 @@ +=== c:/root/src/file1.ts === +import {x} from "./project/file2"; +>x : number + +import {y} from "module3"; +>y : number + +declare function use(x: string); +>use : (x: string) => any +>x : string + +use(x.toFixed()); +>use(x.toFixed()) : any +>use : (x: string) => any +>x.toFixed() : string +>x.toFixed : (fractionDigits?: number) => string +>x : number +>toFixed : (fractionDigits?: number) => string + +use(y.toFixed()); +>use(y.toFixed()) : any +>use : (x: string) => any +>y.toFixed() : string +>y.toFixed : (fractionDigits?: number) => string +>y : number +>toFixed : (fractionDigits?: number) => string + +=== c:/root/generated/src/project/file2.ts === +import {a} from "module1"; +>a : number + +import {b} from "templates/module2"; +>b : number + +import {x as c} from "../file3"; +>x : number +>c : number + +export let x = a + b + c; +>x : number +>a + b + c : number +>a + b : number +>a : number +>b : number +>c : number + +=== c:/shared/module1.d.ts === +export let a: number +>a : number + +=== c:/root/generated/src/templates/module2.ts === +export let b: number; +>b : number + +=== c:/root/src/file3.d.ts === +export let x: number; +>x : number + +=== c:/module3.d.ts === +export let y: number; +>y : number + + diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution7_node.js b/tests/baselines/reference/pathMappingBasedModuleResolution7_node.js new file mode 100644 index 00000000000..3be48cfc85c --- /dev/null +++ b/tests/baselines/reference/pathMappingBasedModuleResolution7_node.js @@ -0,0 +1,44 @@ +//// [tests/cases/compiler/pathMappingBasedModuleResolution7_node.ts] //// + +//// [file1.ts] +import {x} from "./project/file2"; +import {y} from "module3"; + +declare function use(x: string); +use(x.toFixed()); +use(y.toFixed()); + +//// [file2.ts] +import {a} from "module1"; +import {b} from "templates/module2"; +import {x as c} from "../file3"; +export let x = a + b + c; + +//// [index.d.ts] +export let a: number + +//// [module2.ts] +export let b: number; + +//// [index.d.ts] +export let x: number; + +//// [module3.d.ts] +export let y: number; + + + +//// [module2.js] +"use strict"; +//// [file2.js] +"use strict"; +var module1_1 = require("module1"); +var module2_1 = require("templates/module2"); +var file3_1 = require("../file3"); +exports.x = module1_1.a + module2_1.b + file3_1.x; +//// [file1.js] +"use strict"; +var file2_1 = require("./project/file2"); +var module3_1 = require("module3"); +use(file2_1.x.toFixed()); +use(module3_1.y.toFixed()); diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution7_node.symbols b/tests/baselines/reference/pathMappingBasedModuleResolution7_node.symbols new file mode 100644 index 00000000000..9cda76790ea --- /dev/null +++ b/tests/baselines/reference/pathMappingBasedModuleResolution7_node.symbols @@ -0,0 +1,57 @@ +=== c:/root/src/file1.ts === +import {x} from "./project/file2"; +>x : Symbol(x, Decl(file1.ts, 0, 8)) + +import {y} from "module3"; +>y : Symbol(y, Decl(file1.ts, 1, 8)) + +declare function use(x: string); +>use : Symbol(use, Decl(file1.ts, 1, 26)) +>x : Symbol(x, Decl(file1.ts, 3, 21)) + +use(x.toFixed()); +>use : Symbol(use, Decl(file1.ts, 1, 26)) +>x.toFixed : Symbol(Number.toFixed, Decl(lib.d.ts, --, --)) +>x : Symbol(x, Decl(file1.ts, 0, 8)) +>toFixed : Symbol(Number.toFixed, Decl(lib.d.ts, --, --)) + +use(y.toFixed()); +>use : Symbol(use, Decl(file1.ts, 1, 26)) +>y.toFixed : Symbol(Number.toFixed, Decl(lib.d.ts, --, --)) +>y : Symbol(y, Decl(file1.ts, 1, 8)) +>toFixed : Symbol(Number.toFixed, Decl(lib.d.ts, --, --)) + +=== c:/root/generated/src/project/file2.ts === +import {a} from "module1"; +>a : Symbol(a, Decl(file2.ts, 0, 8)) + +import {b} from "templates/module2"; +>b : Symbol(b, Decl(file2.ts, 1, 8)) + +import {x as c} from "../file3"; +>x : Symbol(c, Decl(file2.ts, 2, 8)) +>c : Symbol(c, Decl(file2.ts, 2, 8)) + +export let x = a + b + c; +>x : Symbol(x, Decl(file2.ts, 3, 10)) +>a : Symbol(a, Decl(file2.ts, 0, 8)) +>b : Symbol(b, Decl(file2.ts, 1, 8)) +>c : Symbol(c, Decl(file2.ts, 2, 8)) + +=== c:/shared/module1/index.d.ts === +export let a: number +>a : Symbol(a, Decl(index.d.ts, 0, 10)) + +=== c:/root/generated/src/templates/module2.ts === +export let b: number; +>b : Symbol(b, Decl(module2.ts, 0, 10)) + +=== c:/root/src/file3/index.d.ts === +export let x: number; +>x : Symbol(x, Decl(index.d.ts, 0, 10)) + +=== c:/node_modules/module3.d.ts === +export let y: number; +>y : Symbol(y, Decl(module3.d.ts, 0, 10)) + + diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution7_node.trace.json b/tests/baselines/reference/pathMappingBasedModuleResolution7_node.trace.json new file mode 100644 index 00000000000..99d4bf244db --- /dev/null +++ b/tests/baselines/reference/pathMappingBasedModuleResolution7_node.trace.json @@ -0,0 +1,137 @@ +[ + "======== Resolving module './project/file2' from 'c:/root/src/file1.ts'. ========", + "Module resolution kind is not specified, using 'NodeJs'.", + "'rootDirs' option is set, using it to resolve relative module name './project/file2'", + "Checking if 'c:/root/src/' is the longest matching prefix for 'c:/root/src/project/file2' - 'true'.", + "Checking if 'c:/root/generated/src/' is the longest matching prefix for 'c:/root/src/project/file2' - 'false'.", + "Longest matching prefix for 'c:/root/src/project/file2' is 'c:/root/src/'", + "Loading 'project/file2' from the root dir 'c:/root/src/', candidate location 'c:/root/src/project/file2'", + "Loading module as file / folder, candidate module location 'c:/root/src/project/file2'.", + "File 'c:/root/src/project/file2.ts' does not exist.", + "File 'c:/root/src/project/file2.tsx' does not exist.", + "File 'c:/root/src/project/file2.d.ts' does not exist.", + "File 'c:/root/src/project/file2/package.json' does not exist.", + "File 'c:/root/src/project/file2/index.ts' does not exist.", + "File 'c:/root/src/project/file2/index.tsx' does not exist.", + "File 'c:/root/src/project/file2/index.d.ts' does not exist.", + "Trying other entries in 'rootDirs'", + "Loading 'project/file2' from the root dir 'c:/root/generated/src', candidate location 'c:/root/generated/src/project/file2'", + "Loading module as file / folder, candidate module location 'c:/root/generated/src/project/file2'.", + "File 'c:/root/generated/src/project/file2.ts' exist - use it as a name resolution result.", + "======== Module name './project/file2' was successfully resolved to 'c:/root/generated/src/project/file2.ts'. ========", + "======== Resolving module 'module3' from 'c:/root/src/file1.ts'. ========", + "Module resolution kind is not specified, using 'NodeJs'.", + "'baseUrl' option is set to 'c:/root', using this value to resolve non-relative module name 'module3'", + "'paths' option is specified, looking for a pattern to match module name 'module3'.", + "Module name 'module3', matched pattern '*'.", + "Trying substitution '*', candidate module location: 'module3'.", + "Loading module as file / folder, candidate module location 'c:/root/module3'.", + "File 'c:/root/module3.ts' does not exist.", + "File 'c:/root/module3.tsx' does not exist.", + "File 'c:/root/module3.d.ts' does not exist.", + "File 'c:/root/module3/package.json' does not exist.", + "File 'c:/root/module3/index.ts' does not exist.", + "File 'c:/root/module3/index.tsx' does not exist.", + "File 'c:/root/module3/index.d.ts' does not exist.", + "Trying substitution 'c:/shared/*', candidate module location: 'c:/shared/module3'.", + "Loading module as file / folder, candidate module location 'c:/shared/module3'.", + "File 'c:/shared/module3.ts' does not exist.", + "File 'c:/shared/module3.tsx' does not exist.", + "File 'c:/shared/module3.d.ts' does not exist.", + "File 'c:/shared/module3/package.json' does not exist.", + "File 'c:/shared/module3/index.ts' does not exist.", + "File 'c:/shared/module3/index.tsx' does not exist.", + "File 'c:/shared/module3/index.d.ts' does not exist.", + "Loading module 'module3' from 'node_modules' folder.", + "File 'c:/root/src/node_modules/module3.ts' does not exist.", + "File 'c:/root/src/node_modules/module3.tsx' does not exist.", + "File 'c:/root/src/node_modules/module3.d.ts' does not exist.", + "File 'c:/root/src/node_modules/module3/package.json' does not exist.", + "File 'c:/root/src/node_modules/module3/index.ts' does not exist.", + "File 'c:/root/src/node_modules/module3/index.tsx' does not exist.", + "File 'c:/root/src/node_modules/module3/index.d.ts' does not exist.", + "File 'c:/root/src/node_modules/@types/module3.ts' does not exist.", + "File 'c:/root/src/node_modules/@types/module3.tsx' does not exist.", + "File 'c:/root/src/node_modules/@types/module3.d.ts' does not exist.", + "File 'c:/root/src/node_modules/@types/module3/package.json' does not exist.", + "File 'c:/root/src/node_modules/@types/module3/index.ts' does not exist.", + "File 'c:/root/src/node_modules/@types/module3/index.tsx' does not exist.", + "File 'c:/root/src/node_modules/@types/module3/index.d.ts' does not exist.", + "File 'c:/root/node_modules/module3.ts' does not exist.", + "File 'c:/root/node_modules/module3.tsx' does not exist.", + "File 'c:/root/node_modules/module3.d.ts' does not exist.", + "File 'c:/root/node_modules/module3/package.json' does not exist.", + "File 'c:/root/node_modules/module3/index.ts' does not exist.", + "File 'c:/root/node_modules/module3/index.tsx' does not exist.", + "File 'c:/root/node_modules/module3/index.d.ts' does not exist.", + "File 'c:/root/node_modules/@types/module3.ts' does not exist.", + "File 'c:/root/node_modules/@types/module3.tsx' does not exist.", + "File 'c:/root/node_modules/@types/module3.d.ts' does not exist.", + "File 'c:/root/node_modules/@types/module3/package.json' does not exist.", + "File 'c:/root/node_modules/@types/module3/index.ts' does not exist.", + "File 'c:/root/node_modules/@types/module3/index.tsx' does not exist.", + "File 'c:/root/node_modules/@types/module3/index.d.ts' does not exist.", + "File 'c:/node_modules/module3.ts' does not exist.", + "File 'c:/node_modules/module3.tsx' does not exist.", + "File 'c:/node_modules/module3.d.ts' exist - use it as a name resolution result.", + "======== Module name 'module3' was successfully resolved to 'c:/node_modules/module3.d.ts'. ========", + "======== Resolving module 'module1' from 'c:/root/generated/src/project/file2.ts'. ========", + "Module resolution kind is not specified, using 'NodeJs'.", + "'baseUrl' option is set to 'c:/root', using this value to resolve non-relative module name 'module1'", + "'paths' option is specified, looking for a pattern to match module name 'module1'.", + "Module name 'module1', matched pattern '*'.", + "Trying substitution '*', candidate module location: 'module1'.", + "Loading module as file / folder, candidate module location 'c:/root/module1'.", + "File 'c:/root/module1.ts' does not exist.", + "File 'c:/root/module1.tsx' does not exist.", + "File 'c:/root/module1.d.ts' does not exist.", + "File 'c:/root/module1/package.json' does not exist.", + "File 'c:/root/module1/index.ts' does not exist.", + "File 'c:/root/module1/index.tsx' does not exist.", + "File 'c:/root/module1/index.d.ts' does not exist.", + "Trying substitution 'c:/shared/*', candidate module location: 'c:/shared/module1'.", + "Loading module as file / folder, candidate module location 'c:/shared/module1'.", + "File 'c:/shared/module1.ts' does not exist.", + "File 'c:/shared/module1.tsx' does not exist.", + "File 'c:/shared/module1.d.ts' does not exist.", + "File 'c:/shared/module1/package.json' does not exist.", + "File 'c:/shared/module1/index.ts' does not exist.", + "File 'c:/shared/module1/index.tsx' does not exist.", + "File 'c:/shared/module1/index.d.ts' exist - use it as a name resolution result.", + "======== Module name 'module1' was successfully resolved to 'c:/shared/module1/index.d.ts'. ========", + "======== Resolving module 'templates/module2' from 'c:/root/generated/src/project/file2.ts'. ========", + "Module resolution kind is not specified, using 'NodeJs'.", + "'baseUrl' option is set to 'c:/root', using this value to resolve non-relative module name 'templates/module2'", + "'paths' option is specified, looking for a pattern to match module name 'templates/module2'.", + "Module name 'templates/module2', matched pattern 'templates/*'.", + "Trying substitution 'generated/src/templates/*', candidate module location: 'generated/src/templates/module2'.", + "Loading module as file / folder, candidate module location 'c:/root/generated/src/templates/module2'.", + "File 'c:/root/generated/src/templates/module2.ts' exist - use it as a name resolution result.", + "======== Module name 'templates/module2' was successfully resolved to 'c:/root/generated/src/templates/module2.ts'. ========", + "======== Resolving module '../file3' from 'c:/root/generated/src/project/file2.ts'. ========", + "Module resolution kind is not specified, using 'NodeJs'.", + "'rootDirs' option is set, using it to resolve relative module name '../file3'", + "Checking if 'c:/root/src/' is the longest matching prefix for 'c:/root/generated/src/file3' - 'false'.", + "Checking if 'c:/root/generated/src/' is the longest matching prefix for 'c:/root/generated/src/file3' - 'true'.", + "Longest matching prefix for 'c:/root/generated/src/file3' is 'c:/root/generated/src/'", + "Loading 'file3' from the root dir 'c:/root/generated/src/', candidate location 'c:/root/generated/src/file3'", + "Loading module as file / folder, candidate module location 'c:/root/generated/src/file3'.", + "File 'c:/root/generated/src/file3.ts' does not exist.", + "File 'c:/root/generated/src/file3.tsx' does not exist.", + "File 'c:/root/generated/src/file3.d.ts' does not exist.", + "File 'c:/root/generated/src/file3/package.json' does not exist.", + "File 'c:/root/generated/src/file3/index.ts' does not exist.", + "File 'c:/root/generated/src/file3/index.tsx' does not exist.", + "File 'c:/root/generated/src/file3/index.d.ts' does not exist.", + "Trying other entries in 'rootDirs'", + "Loading 'file3' from the root dir 'c:/root/src', candidate location 'c:/root/src/file3'", + "Loading module as file / folder, candidate module location 'c:/root/src/file3'.", + "File 'c:/root/src/file3.ts' does not exist.", + "File 'c:/root/src/file3.tsx' does not exist.", + "File 'c:/root/src/file3.d.ts' does not exist.", + "File 'c:/root/src/file3/package.json' does not exist.", + "File 'c:/root/src/file3/index.ts' does not exist.", + "File 'c:/root/src/file3/index.tsx' does not exist.", + "File 'c:/root/src/file3/index.d.ts' exist - use it as a name resolution result.", + "======== Module name '../file3' was successfully resolved to 'c:/root/src/file3/index.d.ts'. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution7_node.types b/tests/baselines/reference/pathMappingBasedModuleResolution7_node.types new file mode 100644 index 00000000000..974f710b4c2 --- /dev/null +++ b/tests/baselines/reference/pathMappingBasedModuleResolution7_node.types @@ -0,0 +1,63 @@ +=== c:/root/src/file1.ts === +import {x} from "./project/file2"; +>x : number + +import {y} from "module3"; +>y : number + +declare function use(x: string); +>use : (x: string) => any +>x : string + +use(x.toFixed()); +>use(x.toFixed()) : any +>use : (x: string) => any +>x.toFixed() : string +>x.toFixed : (fractionDigits?: number) => string +>x : number +>toFixed : (fractionDigits?: number) => string + +use(y.toFixed()); +>use(y.toFixed()) : any +>use : (x: string) => any +>y.toFixed() : string +>y.toFixed : (fractionDigits?: number) => string +>y : number +>toFixed : (fractionDigits?: number) => string + +=== c:/root/generated/src/project/file2.ts === +import {a} from "module1"; +>a : number + +import {b} from "templates/module2"; +>b : number + +import {x as c} from "../file3"; +>x : number +>c : number + +export let x = a + b + c; +>x : number +>a + b + c : number +>a + b : number +>a : number +>b : number +>c : number + +=== c:/shared/module1/index.d.ts === +export let a: number +>a : number + +=== c:/root/generated/src/templates/module2.ts === +export let b: number; +>b : number + +=== c:/root/src/file3/index.d.ts === +export let x: number; +>x : number + +=== c:/node_modules/module3.d.ts === +export let y: number; +>y : number + + diff --git a/tests/baselines/reference/pathsValidation1.errors.txt b/tests/baselines/reference/pathsValidation1.errors.txt new file mode 100644 index 00000000000..c6193be67ac --- /dev/null +++ b/tests/baselines/reference/pathsValidation1.errors.txt @@ -0,0 +1,6 @@ +error TS5063: Substututions for pattern '*' should be an array. + + +!!! error TS5063: Substututions for pattern '*' should be an array. +==== tests/cases/compiler/a.ts (0 errors) ==== + let x = 1; \ No newline at end of file diff --git a/tests/baselines/reference/pathsValidation1.js b/tests/baselines/reference/pathsValidation1.js new file mode 100644 index 00000000000..bfffc647f63 --- /dev/null +++ b/tests/baselines/reference/pathsValidation1.js @@ -0,0 +1,5 @@ +//// [a.ts] +let x = 1; + +//// [a.js] +var x = 1; diff --git a/tests/baselines/reference/pathsValidation2.errors.txt b/tests/baselines/reference/pathsValidation2.errors.txt new file mode 100644 index 00000000000..8956b2fc159 --- /dev/null +++ b/tests/baselines/reference/pathsValidation2.errors.txt @@ -0,0 +1,6 @@ +error TS5064: Substitution '1' for pattern '*' has incorrect type, expected 'string', got 'number'. + + +!!! error TS5064: Substitution '1' for pattern '*' has incorrect type, expected 'string', got 'number'. +==== tests/cases/compiler/a.ts (0 errors) ==== + let x = 1; \ No newline at end of file diff --git a/tests/baselines/reference/pathsValidation2.js b/tests/baselines/reference/pathsValidation2.js new file mode 100644 index 00000000000..bfffc647f63 --- /dev/null +++ b/tests/baselines/reference/pathsValidation2.js @@ -0,0 +1,5 @@ +//// [a.ts] +let x = 1; + +//// [a.js] +var x = 1; diff --git a/tests/baselines/reference/plusOperatorWithBooleanType.symbols b/tests/baselines/reference/plusOperatorWithBooleanType.symbols index d8c6beda3bc..29ee32c9f54 100644 --- a/tests/baselines/reference/plusOperatorWithBooleanType.symbols +++ b/tests/baselines/reference/plusOperatorWithBooleanType.symbols @@ -10,7 +10,7 @@ class A { >A : Symbol(A, Decl(plusOperatorWithBooleanType.ts, 3, 40)) public a: boolean; ->a : Symbol(a, Decl(plusOperatorWithBooleanType.ts, 5, 9)) +>a : Symbol(A.a, Decl(plusOperatorWithBooleanType.ts, 5, 9)) static foo() { return false; } >foo : Symbol(A.foo, Decl(plusOperatorWithBooleanType.ts, 6, 22)) diff --git a/tests/baselines/reference/plusOperatorWithNumberType.symbols b/tests/baselines/reference/plusOperatorWithNumberType.symbols index fd62582515e..c8f4b9652d0 100644 --- a/tests/baselines/reference/plusOperatorWithNumberType.symbols +++ b/tests/baselines/reference/plusOperatorWithNumberType.symbols @@ -13,7 +13,7 @@ class A { >A : Symbol(A, Decl(plusOperatorWithNumberType.ts, 4, 36)) public a: number; ->a : Symbol(a, Decl(plusOperatorWithNumberType.ts, 6, 9)) +>a : Symbol(A.a, Decl(plusOperatorWithNumberType.ts, 6, 9)) static foo() { return 1; } >foo : Symbol(A.foo, Decl(plusOperatorWithNumberType.ts, 7, 21)) diff --git a/tests/baselines/reference/plusOperatorWithStringType.symbols b/tests/baselines/reference/plusOperatorWithStringType.symbols index fd3e10c172f..eb2e2625a1c 100644 --- a/tests/baselines/reference/plusOperatorWithStringType.symbols +++ b/tests/baselines/reference/plusOperatorWithStringType.symbols @@ -13,7 +13,7 @@ class A { >A : Symbol(A, Decl(plusOperatorWithStringType.ts, 4, 40)) public a: string; ->a : Symbol(a, Decl(plusOperatorWithStringType.ts, 6, 9)) +>a : Symbol(A.a, Decl(plusOperatorWithStringType.ts, 6, 9)) static foo() { return ""; } >foo : Symbol(A.foo, Decl(plusOperatorWithStringType.ts, 7, 21)) diff --git a/tests/baselines/reference/prefixUnaryOperatorsOnExportedVariables.js b/tests/baselines/reference/prefixUnaryOperatorsOnExportedVariables.js index a3b70bde6d5..cf88f4e9ba6 100644 --- a/tests/baselines/reference/prefixUnaryOperatorsOnExportedVariables.js +++ b/tests/baselines/reference/prefixUnaryOperatorsOnExportedVariables.js @@ -31,8 +31,9 @@ if (++y) { } //// [prefixUnaryOperatorsOnExportedVariables.js] -System.register([], function(exports_1, __moduleName) { +System.register([], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; var x, y; return { setters:[], diff --git a/tests/baselines/reference/privacyCheckAnonymousFunctionParameter2.symbols b/tests/baselines/reference/privacyCheckAnonymousFunctionParameter2.symbols index d0f8179dfea..14d223f2c01 100644 --- a/tests/baselines/reference/privacyCheckAnonymousFunctionParameter2.symbols +++ b/tests/baselines/reference/privacyCheckAnonymousFunctionParameter2.symbols @@ -5,7 +5,7 @@ export var x = 1; // Makes this an external module interface Iterator { x: T } >Iterator : Symbol(Iterator, Decl(privacyCheckAnonymousFunctionParameter2.ts, 0, 17)) >T : Symbol(T, Decl(privacyCheckAnonymousFunctionParameter2.ts, 1, 19)) ->x : Symbol(x, Decl(privacyCheckAnonymousFunctionParameter2.ts, 1, 23)) +>x : Symbol(Iterator.x, Decl(privacyCheckAnonymousFunctionParameter2.ts, 1, 23)) >T : Symbol(T, Decl(privacyCheckAnonymousFunctionParameter2.ts, 1, 19)) module Q { diff --git a/tests/baselines/reference/privacyCheckCallbackOfInterfaceMethodWithTypeParameter.symbols b/tests/baselines/reference/privacyCheckCallbackOfInterfaceMethodWithTypeParameter.symbols index 61e8d09798b..9234971375c 100644 --- a/tests/baselines/reference/privacyCheckCallbackOfInterfaceMethodWithTypeParameter.symbols +++ b/tests/baselines/reference/privacyCheckCallbackOfInterfaceMethodWithTypeParameter.symbols @@ -4,7 +4,7 @@ export interface A { >T : Symbol(T, Decl(privacyCheckCallbackOfInterfaceMethodWithTypeParameter.ts, 0, 19)) f1(callback: (p: T) => any); ->f1 : Symbol(f1, Decl(privacyCheckCallbackOfInterfaceMethodWithTypeParameter.ts, 0, 23)) +>f1 : Symbol(A.f1, Decl(privacyCheckCallbackOfInterfaceMethodWithTypeParameter.ts, 0, 23)) >callback : Symbol(callback, Decl(privacyCheckCallbackOfInterfaceMethodWithTypeParameter.ts, 1, 7)) >p : Symbol(p, Decl(privacyCheckCallbackOfInterfaceMethodWithTypeParameter.ts, 1, 18)) >T : Symbol(T, Decl(privacyCheckCallbackOfInterfaceMethodWithTypeParameter.ts, 0, 19)) diff --git a/tests/baselines/reference/privacyCheckExternalModuleExportAssignmentOfGenericClass.symbols b/tests/baselines/reference/privacyCheckExternalModuleExportAssignmentOfGenericClass.symbols index 75ebd0bff0a..50402be8633 100644 --- a/tests/baselines/reference/privacyCheckExternalModuleExportAssignmentOfGenericClass.symbols +++ b/tests/baselines/reference/privacyCheckExternalModuleExportAssignmentOfGenericClass.symbols @@ -9,7 +9,7 @@ interface Bar { >Bar : Symbol(Bar, Decl(privacyCheckExternalModuleExportAssignmentOfGenericClass_1.ts, 1, 13)) foo: Foo; ->foo : Symbol(foo, Decl(privacyCheckExternalModuleExportAssignmentOfGenericClass_1.ts, 2, 15)) +>foo : Symbol(Bar.foo, Decl(privacyCheckExternalModuleExportAssignmentOfGenericClass_1.ts, 2, 15)) >Foo : Symbol(Foo, Decl(privacyCheckExternalModuleExportAssignmentOfGenericClass_1.ts, 0, 0)) } === tests/cases/compiler/privacyCheckExternalModuleExportAssignmentOfGenericClass_0.ts === @@ -21,7 +21,7 @@ class Foo { >A : Symbol(A, Decl(privacyCheckExternalModuleExportAssignmentOfGenericClass_0.ts, 1, 10)) constructor(public a: A) { } ->a : Symbol(a, Decl(privacyCheckExternalModuleExportAssignmentOfGenericClass_0.ts, 2, 16)) +>a : Symbol(Foo.a, Decl(privacyCheckExternalModuleExportAssignmentOfGenericClass_0.ts, 2, 16)) >A : Symbol(A, Decl(privacyCheckExternalModuleExportAssignmentOfGenericClass_0.ts, 1, 10)) } diff --git a/tests/baselines/reference/privacyClass.symbols b/tests/baselines/reference/privacyClass.symbols index 791193a54ab..b0d949c0444 100644 --- a/tests/baselines/reference/privacyClass.symbols +++ b/tests/baselines/reference/privacyClass.symbols @@ -14,7 +14,7 @@ export module m1 { >m1_c_public : Symbol(m1_c_public, Decl(privacyClass.ts, 5, 5)) private f1() { ->f1 : Symbol(f1, Decl(privacyClass.ts, 7, 30)) +>f1 : Symbol(m1_c_public.f1, Decl(privacyClass.ts, 7, 30)) } } @@ -98,7 +98,7 @@ module m2 { >m2_c_public : Symbol(m2_c_public, Decl(privacyClass.ts, 49, 5)) private f1() { ->f1 : Symbol(f1, Decl(privacyClass.ts, 51, 30)) +>f1 : Symbol(m2_c_public.f1, Decl(privacyClass.ts, 51, 30)) } } @@ -178,7 +178,7 @@ export class glo_c_public { >glo_c_public : Symbol(glo_c_public, Decl(privacyClass.ts, 91, 1)) private f1() { ->f1 : Symbol(f1, Decl(privacyClass.ts, 93, 27)) +>f1 : Symbol(glo_c_public.f1, Decl(privacyClass.ts, 93, 27)) } } diff --git a/tests/baselines/reference/privacyFunc.symbols b/tests/baselines/reference/privacyFunc.symbols index 2d156da870d..0eb77cf8606 100644 --- a/tests/baselines/reference/privacyFunc.symbols +++ b/tests/baselines/reference/privacyFunc.symbols @@ -6,7 +6,7 @@ module m1 { >C1_public : Symbol(C1_public, Decl(privacyFunc.ts, 0, 11)) private f1() { ->f1 : Symbol(f1, Decl(privacyFunc.ts, 1, 28)) +>f1 : Symbol(C1_public.f1, Decl(privacyFunc.ts, 1, 28)) } } @@ -30,59 +30,59 @@ module m1 { } private f1_private(m1_c3_f1_arg: C1_public) { ->f1_private : Symbol(f1_private, Decl(privacyFunc.ts, 13, 9)) +>f1_private : Symbol(C3_public.f1_private, Decl(privacyFunc.ts, 13, 9)) >m1_c3_f1_arg : Symbol(m1_c3_f1_arg, Decl(privacyFunc.ts, 15, 27)) >C1_public : Symbol(C1_public, Decl(privacyFunc.ts, 0, 11)) } public f2_public(m1_c3_f2_arg: C1_public) { ->f2_public : Symbol(f2_public, Decl(privacyFunc.ts, 16, 9)) +>f2_public : Symbol(C3_public.f2_public, Decl(privacyFunc.ts, 16, 9)) >m1_c3_f2_arg : Symbol(m1_c3_f2_arg, Decl(privacyFunc.ts, 18, 25)) >C1_public : Symbol(C1_public, Decl(privacyFunc.ts, 0, 11)) } private f3_private(m1_c3_f3_arg: C2_private) { ->f3_private : Symbol(f3_private, Decl(privacyFunc.ts, 19, 9)) +>f3_private : Symbol(C3_public.f3_private, Decl(privacyFunc.ts, 19, 9)) >m1_c3_f3_arg : Symbol(m1_c3_f3_arg, Decl(privacyFunc.ts, 21, 27)) >C2_private : Symbol(C2_private, Decl(privacyFunc.ts, 4, 5)) } public f4_public(m1_c3_f4_arg: C2_private) { // error ->f4_public : Symbol(f4_public, Decl(privacyFunc.ts, 22, 9)) +>f4_public : Symbol(C3_public.f4_public, Decl(privacyFunc.ts, 22, 9)) >m1_c3_f4_arg : Symbol(m1_c3_f4_arg, Decl(privacyFunc.ts, 24, 25)) >C2_private : Symbol(C2_private, Decl(privacyFunc.ts, 4, 5)) } private f5_private() { ->f5_private : Symbol(f5_private, Decl(privacyFunc.ts, 25, 9)) +>f5_private : Symbol(C3_public.f5_private, Decl(privacyFunc.ts, 25, 9)) return new C1_public(); >C1_public : Symbol(C1_public, Decl(privacyFunc.ts, 0, 11)) } public f6_public() { ->f6_public : Symbol(f6_public, Decl(privacyFunc.ts, 29, 9)) +>f6_public : Symbol(C3_public.f6_public, Decl(privacyFunc.ts, 29, 9)) return new C1_public(); >C1_public : Symbol(C1_public, Decl(privacyFunc.ts, 0, 11)) } private f7_private() { ->f7_private : Symbol(f7_private, Decl(privacyFunc.ts, 33, 9)) +>f7_private : Symbol(C3_public.f7_private, Decl(privacyFunc.ts, 33, 9)) return new C2_private(); >C2_private : Symbol(C2_private, Decl(privacyFunc.ts, 4, 5)) } public f8_public() { ->f8_public : Symbol(f8_public, Decl(privacyFunc.ts, 37, 9)) +>f8_public : Symbol(C3_public.f8_public, Decl(privacyFunc.ts, 37, 9)) return new C2_private(); // error >C2_private : Symbol(C2_private, Decl(privacyFunc.ts, 4, 5)) } private f9_private(): C1_public { ->f9_private : Symbol(f9_private, Decl(privacyFunc.ts, 41, 9)) +>f9_private : Symbol(C3_public.f9_private, Decl(privacyFunc.ts, 41, 9)) >C1_public : Symbol(C1_public, Decl(privacyFunc.ts, 0, 11)) return new C1_public(); @@ -90,7 +90,7 @@ module m1 { } public f10_public(): C1_public { ->f10_public : Symbol(f10_public, Decl(privacyFunc.ts, 45, 9)) +>f10_public : Symbol(C3_public.f10_public, Decl(privacyFunc.ts, 45, 9)) >C1_public : Symbol(C1_public, Decl(privacyFunc.ts, 0, 11)) return new C1_public(); @@ -98,7 +98,7 @@ module m1 { } private f11_private(): C2_private { ->f11_private : Symbol(f11_private, Decl(privacyFunc.ts, 49, 9)) +>f11_private : Symbol(C3_public.f11_private, Decl(privacyFunc.ts, 49, 9)) >C2_private : Symbol(C2_private, Decl(privacyFunc.ts, 4, 5)) return new C2_private(); @@ -106,7 +106,7 @@ module m1 { } public f12_public(): C2_private { // error ->f12_public : Symbol(f12_public, Decl(privacyFunc.ts, 53, 9)) +>f12_public : Symbol(C3_public.f12_public, Decl(privacyFunc.ts, 53, 9)) >C2_private : Symbol(C2_private, Decl(privacyFunc.ts, 4, 5)) return new C2_private(); //error @@ -129,53 +129,53 @@ module m1 { >m1_c4_c1_2 : Symbol(m1_c4_c1_2, Decl(privacyFunc.ts, 63, 21)) } private f1_private(m1_c4_f1_arg: C1_public) { ->f1_private : Symbol(f1_private, Decl(privacyFunc.ts, 64, 9)) +>f1_private : Symbol(C4_private.f1_private, Decl(privacyFunc.ts, 64, 9)) >m1_c4_f1_arg : Symbol(m1_c4_f1_arg, Decl(privacyFunc.ts, 65, 27)) >C1_public : Symbol(C1_public, Decl(privacyFunc.ts, 0, 11)) } public f2_public(m1_c4_f2_arg: C1_public) { ->f2_public : Symbol(f2_public, Decl(privacyFunc.ts, 66, 9)) +>f2_public : Symbol(C4_private.f2_public, Decl(privacyFunc.ts, 66, 9)) >m1_c4_f2_arg : Symbol(m1_c4_f2_arg, Decl(privacyFunc.ts, 68, 25)) >C1_public : Symbol(C1_public, Decl(privacyFunc.ts, 0, 11)) } private f3_private(m1_c4_f3_arg: C2_private) { ->f3_private : Symbol(f3_private, Decl(privacyFunc.ts, 69, 9)) +>f3_private : Symbol(C4_private.f3_private, Decl(privacyFunc.ts, 69, 9)) >m1_c4_f3_arg : Symbol(m1_c4_f3_arg, Decl(privacyFunc.ts, 71, 27)) >C2_private : Symbol(C2_private, Decl(privacyFunc.ts, 4, 5)) } public f4_public(m1_c4_f4_arg: C2_private) { ->f4_public : Symbol(f4_public, Decl(privacyFunc.ts, 72, 9)) +>f4_public : Symbol(C4_private.f4_public, Decl(privacyFunc.ts, 72, 9)) >m1_c4_f4_arg : Symbol(m1_c4_f4_arg, Decl(privacyFunc.ts, 74, 25)) >C2_private : Symbol(C2_private, Decl(privacyFunc.ts, 4, 5)) } private f5_private() { ->f5_private : Symbol(f5_private, Decl(privacyFunc.ts, 75, 9)) +>f5_private : Symbol(C4_private.f5_private, Decl(privacyFunc.ts, 75, 9)) return new C1_public(); >C1_public : Symbol(C1_public, Decl(privacyFunc.ts, 0, 11)) } public f6_public() { ->f6_public : Symbol(f6_public, Decl(privacyFunc.ts, 80, 9)) +>f6_public : Symbol(C4_private.f6_public, Decl(privacyFunc.ts, 80, 9)) return new C1_public(); >C1_public : Symbol(C1_public, Decl(privacyFunc.ts, 0, 11)) } private f7_private() { ->f7_private : Symbol(f7_private, Decl(privacyFunc.ts, 84, 9)) +>f7_private : Symbol(C4_private.f7_private, Decl(privacyFunc.ts, 84, 9)) return new C2_private(); >C2_private : Symbol(C2_private, Decl(privacyFunc.ts, 4, 5)) } public f8_public() { ->f8_public : Symbol(f8_public, Decl(privacyFunc.ts, 88, 9)) +>f8_public : Symbol(C4_private.f8_public, Decl(privacyFunc.ts, 88, 9)) return new C2_private(); >C2_private : Symbol(C2_private, Decl(privacyFunc.ts, 4, 5)) @@ -183,7 +183,7 @@ module m1 { private f9_private(): C1_public { ->f9_private : Symbol(f9_private, Decl(privacyFunc.ts, 92, 9)) +>f9_private : Symbol(C4_private.f9_private, Decl(privacyFunc.ts, 92, 9)) >C1_public : Symbol(C1_public, Decl(privacyFunc.ts, 0, 11)) return new C1_public(); @@ -191,7 +191,7 @@ module m1 { } public f10_public(): C1_public { ->f10_public : Symbol(f10_public, Decl(privacyFunc.ts, 97, 9)) +>f10_public : Symbol(C4_private.f10_public, Decl(privacyFunc.ts, 97, 9)) >C1_public : Symbol(C1_public, Decl(privacyFunc.ts, 0, 11)) return new C1_public(); @@ -199,7 +199,7 @@ module m1 { } private f11_private(): C2_private { ->f11_private : Symbol(f11_private, Decl(privacyFunc.ts, 101, 9)) +>f11_private : Symbol(C4_private.f11_private, Decl(privacyFunc.ts, 101, 9)) >C2_private : Symbol(C2_private, Decl(privacyFunc.ts, 4, 5)) return new C2_private(); @@ -207,7 +207,7 @@ module m1 { } public f12_public(): C2_private { ->f12_public : Symbol(f12_public, Decl(privacyFunc.ts, 105, 9)) +>f12_public : Symbol(C4_private.f12_public, Decl(privacyFunc.ts, 105, 9)) >C2_private : Symbol(C2_private, Decl(privacyFunc.ts, 4, 5)) return new C2_private(); @@ -352,33 +352,33 @@ class C7_public { >c7_c1_2 : Symbol(c7_c1_2, Decl(privacyFunc.ts, 183, 17)) } private f1_private(c7_f1_arg: C6_public) { ->f1_private : Symbol(f1_private, Decl(privacyFunc.ts, 184, 5)) +>f1_private : Symbol(C7_public.f1_private, Decl(privacyFunc.ts, 184, 5)) >c7_f1_arg : Symbol(c7_f1_arg, Decl(privacyFunc.ts, 185, 23)) >C6_public : Symbol(C6_public, Decl(privacyFunc.ts, 176, 1)) } public f2_public(c7_f2_arg: C6_public) { ->f2_public : Symbol(f2_public, Decl(privacyFunc.ts, 186, 5)) +>f2_public : Symbol(C7_public.f2_public, Decl(privacyFunc.ts, 186, 5)) >c7_f2_arg : Symbol(c7_f2_arg, Decl(privacyFunc.ts, 188, 21)) >C6_public : Symbol(C6_public, Decl(privacyFunc.ts, 176, 1)) } private f5_private() { ->f5_private : Symbol(f5_private, Decl(privacyFunc.ts, 189, 5)) +>f5_private : Symbol(C7_public.f5_private, Decl(privacyFunc.ts, 189, 5)) return new C6_public(); >C6_public : Symbol(C6_public, Decl(privacyFunc.ts, 176, 1)) } public f6_public() { ->f6_public : Symbol(f6_public, Decl(privacyFunc.ts, 193, 5)) +>f6_public : Symbol(C7_public.f6_public, Decl(privacyFunc.ts, 193, 5)) return new C6_public(); >C6_public : Symbol(C6_public, Decl(privacyFunc.ts, 176, 1)) } private f9_private(): C6_public { ->f9_private : Symbol(f9_private, Decl(privacyFunc.ts, 197, 5)) +>f9_private : Symbol(C7_public.f9_private, Decl(privacyFunc.ts, 197, 5)) >C6_public : Symbol(C6_public, Decl(privacyFunc.ts, 176, 1)) return new C6_public(); @@ -386,7 +386,7 @@ class C7_public { } public f10_public(): C6_public { ->f10_public : Symbol(f10_public, Decl(privacyFunc.ts, 201, 5)) +>f10_public : Symbol(C7_public.f10_public, Decl(privacyFunc.ts, 201, 5)) >C6_public : Symbol(C6_public, Decl(privacyFunc.ts, 176, 1)) return new C6_public(); diff --git a/tests/baselines/reference/privacyGetter.symbols b/tests/baselines/reference/privacyGetter.symbols index eff33e0061b..19a78e7ce8a 100644 --- a/tests/baselines/reference/privacyGetter.symbols +++ b/tests/baselines/reference/privacyGetter.symbols @@ -6,7 +6,7 @@ export module m1 { >C1_public : Symbol(C1_public, Decl(privacyGetter.ts, 0, 18)) private f1() { ->f1 : Symbol(f1, Decl(privacyGetter.ts, 1, 28)) +>f1 : Symbol(C1_public.f1, Decl(privacyGetter.ts, 1, 28)) } } @@ -18,46 +18,46 @@ export module m1 { >C3_public : Symbol(C3_public, Decl(privacyGetter.ts, 7, 5)) private get p1_private() { ->p1_private : Symbol(p1_private, Decl(privacyGetter.ts, 9, 28), Decl(privacyGetter.ts, 12, 9)) +>p1_private : Symbol(C3_public.p1_private, Decl(privacyGetter.ts, 9, 28), Decl(privacyGetter.ts, 12, 9)) return new C1_public(); >C1_public : Symbol(C1_public, Decl(privacyGetter.ts, 0, 18)) } private set p1_private(m1_c3_p1_arg: C1_public) { ->p1_private : Symbol(p1_private, Decl(privacyGetter.ts, 9, 28), Decl(privacyGetter.ts, 12, 9)) +>p1_private : Symbol(C3_public.p1_private, Decl(privacyGetter.ts, 9, 28), Decl(privacyGetter.ts, 12, 9)) >m1_c3_p1_arg : Symbol(m1_c3_p1_arg, Decl(privacyGetter.ts, 14, 31)) >C1_public : Symbol(C1_public, Decl(privacyGetter.ts, 0, 18)) } private get p2_private() { ->p2_private : Symbol(p2_private, Decl(privacyGetter.ts, 15, 9), Decl(privacyGetter.ts, 19, 9)) +>p2_private : Symbol(C3_public.p2_private, Decl(privacyGetter.ts, 15, 9), Decl(privacyGetter.ts, 19, 9)) return new C1_public(); >C1_public : Symbol(C1_public, Decl(privacyGetter.ts, 0, 18)) } private set p2_private(m1_c3_p2_arg: C1_public) { ->p2_private : Symbol(p2_private, Decl(privacyGetter.ts, 15, 9), Decl(privacyGetter.ts, 19, 9)) +>p2_private : Symbol(C3_public.p2_private, Decl(privacyGetter.ts, 15, 9), Decl(privacyGetter.ts, 19, 9)) >m1_c3_p2_arg : Symbol(m1_c3_p2_arg, Decl(privacyGetter.ts, 21, 31)) >C1_public : Symbol(C1_public, Decl(privacyGetter.ts, 0, 18)) } private get p3_private() { ->p3_private : Symbol(p3_private, Decl(privacyGetter.ts, 22, 9), Decl(privacyGetter.ts, 26, 9)) +>p3_private : Symbol(C3_public.p3_private, Decl(privacyGetter.ts, 22, 9), Decl(privacyGetter.ts, 26, 9)) return new C2_private(); >C2_private : Symbol(C2_private, Decl(privacyGetter.ts, 4, 5)) } private set p3_private(m1_c3_p3_arg: C2_private) { ->p3_private : Symbol(p3_private, Decl(privacyGetter.ts, 22, 9), Decl(privacyGetter.ts, 26, 9)) +>p3_private : Symbol(C3_public.p3_private, Decl(privacyGetter.ts, 22, 9), Decl(privacyGetter.ts, 26, 9)) >m1_c3_p3_arg : Symbol(m1_c3_p3_arg, Decl(privacyGetter.ts, 28, 31)) >C2_private : Symbol(C2_private, Decl(privacyGetter.ts, 4, 5)) } public get p4_public(): C2_private { // error ->p4_public : Symbol(p4_public, Decl(privacyGetter.ts, 29, 9), Decl(privacyGetter.ts, 33, 9)) +>p4_public : Symbol(C3_public.p4_public, Decl(privacyGetter.ts, 29, 9), Decl(privacyGetter.ts, 33, 9)) >C2_private : Symbol(C2_private, Decl(privacyGetter.ts, 4, 5)) return new C2_private(); //error @@ -65,7 +65,7 @@ export module m1 { } public set p4_public(m1_c3_p4_arg: C2_private) { // error ->p4_public : Symbol(p4_public, Decl(privacyGetter.ts, 29, 9), Decl(privacyGetter.ts, 33, 9)) +>p4_public : Symbol(C3_public.p4_public, Decl(privacyGetter.ts, 29, 9), Decl(privacyGetter.ts, 33, 9)) >m1_c3_p4_arg : Symbol(m1_c3_p4_arg, Decl(privacyGetter.ts, 35, 29)) >C2_private : Symbol(C2_private, Decl(privacyGetter.ts, 4, 5)) } @@ -75,46 +75,46 @@ export module m1 { >C4_private : Symbol(C4_private, Decl(privacyGetter.ts, 37, 5)) private get p1_private() { ->p1_private : Symbol(p1_private, Decl(privacyGetter.ts, 39, 22), Decl(privacyGetter.ts, 42, 9)) +>p1_private : Symbol(C4_private.p1_private, Decl(privacyGetter.ts, 39, 22), Decl(privacyGetter.ts, 42, 9)) return new C1_public(); >C1_public : Symbol(C1_public, Decl(privacyGetter.ts, 0, 18)) } private set p1_private(m1_c3_p1_arg: C1_public) { ->p1_private : Symbol(p1_private, Decl(privacyGetter.ts, 39, 22), Decl(privacyGetter.ts, 42, 9)) +>p1_private : Symbol(C4_private.p1_private, Decl(privacyGetter.ts, 39, 22), Decl(privacyGetter.ts, 42, 9)) >m1_c3_p1_arg : Symbol(m1_c3_p1_arg, Decl(privacyGetter.ts, 44, 31)) >C1_public : Symbol(C1_public, Decl(privacyGetter.ts, 0, 18)) } private get p2_private() { ->p2_private : Symbol(p2_private, Decl(privacyGetter.ts, 45, 9), Decl(privacyGetter.ts, 49, 9)) +>p2_private : Symbol(C4_private.p2_private, Decl(privacyGetter.ts, 45, 9), Decl(privacyGetter.ts, 49, 9)) return new C1_public(); >C1_public : Symbol(C1_public, Decl(privacyGetter.ts, 0, 18)) } private set p2_private(m1_c3_p2_arg: C1_public) { ->p2_private : Symbol(p2_private, Decl(privacyGetter.ts, 45, 9), Decl(privacyGetter.ts, 49, 9)) +>p2_private : Symbol(C4_private.p2_private, Decl(privacyGetter.ts, 45, 9), Decl(privacyGetter.ts, 49, 9)) >m1_c3_p2_arg : Symbol(m1_c3_p2_arg, Decl(privacyGetter.ts, 51, 31)) >C1_public : Symbol(C1_public, Decl(privacyGetter.ts, 0, 18)) } private get p3_private() { ->p3_private : Symbol(p3_private, Decl(privacyGetter.ts, 52, 9), Decl(privacyGetter.ts, 56, 9)) +>p3_private : Symbol(C4_private.p3_private, Decl(privacyGetter.ts, 52, 9), Decl(privacyGetter.ts, 56, 9)) return new C2_private(); >C2_private : Symbol(C2_private, Decl(privacyGetter.ts, 4, 5)) } private set p3_private(m1_c3_p3_arg: C2_private) { ->p3_private : Symbol(p3_private, Decl(privacyGetter.ts, 52, 9), Decl(privacyGetter.ts, 56, 9)) +>p3_private : Symbol(C4_private.p3_private, Decl(privacyGetter.ts, 52, 9), Decl(privacyGetter.ts, 56, 9)) >m1_c3_p3_arg : Symbol(m1_c3_p3_arg, Decl(privacyGetter.ts, 58, 31)) >C2_private : Symbol(C2_private, Decl(privacyGetter.ts, 4, 5)) } public get p4_public(): C2_private { ->p4_public : Symbol(p4_public, Decl(privacyGetter.ts, 59, 9), Decl(privacyGetter.ts, 63, 9)) +>p4_public : Symbol(C4_private.p4_public, Decl(privacyGetter.ts, 59, 9), Decl(privacyGetter.ts, 63, 9)) >C2_private : Symbol(C2_private, Decl(privacyGetter.ts, 4, 5)) return new C2_private(); @@ -122,7 +122,7 @@ export module m1 { } public set p4_public(m1_c3_p4_arg: C2_private) { ->p4_public : Symbol(p4_public, Decl(privacyGetter.ts, 59, 9), Decl(privacyGetter.ts, 63, 9)) +>p4_public : Symbol(C4_private.p4_public, Decl(privacyGetter.ts, 59, 9), Decl(privacyGetter.ts, 63, 9)) >m1_c3_p4_arg : Symbol(m1_c3_p4_arg, Decl(privacyGetter.ts, 65, 29)) >C2_private : Symbol(C2_private, Decl(privacyGetter.ts, 4, 5)) } @@ -136,7 +136,7 @@ module m2 { >m2_C1_public : Symbol(m2_C1_public, Decl(privacyGetter.ts, 70, 11)) private f1() { ->f1 : Symbol(f1, Decl(privacyGetter.ts, 71, 31)) +>f1 : Symbol(m2_C1_public.f1, Decl(privacyGetter.ts, 71, 31)) } } @@ -148,46 +148,46 @@ module m2 { >m2_C3_public : Symbol(m2_C3_public, Decl(privacyGetter.ts, 77, 5)) private get p1_private() { ->p1_private : Symbol(p1_private, Decl(privacyGetter.ts, 79, 31), Decl(privacyGetter.ts, 82, 9)) +>p1_private : Symbol(m2_C3_public.p1_private, Decl(privacyGetter.ts, 79, 31), Decl(privacyGetter.ts, 82, 9)) return new m2_C1_public(); >m2_C1_public : Symbol(m2_C1_public, Decl(privacyGetter.ts, 70, 11)) } private set p1_private(m2_c3_p1_arg: m2_C1_public) { ->p1_private : Symbol(p1_private, Decl(privacyGetter.ts, 79, 31), Decl(privacyGetter.ts, 82, 9)) +>p1_private : Symbol(m2_C3_public.p1_private, Decl(privacyGetter.ts, 79, 31), Decl(privacyGetter.ts, 82, 9)) >m2_c3_p1_arg : Symbol(m2_c3_p1_arg, Decl(privacyGetter.ts, 84, 31)) >m2_C1_public : Symbol(m2_C1_public, Decl(privacyGetter.ts, 70, 11)) } private get p2_private() { ->p2_private : Symbol(p2_private, Decl(privacyGetter.ts, 85, 9), Decl(privacyGetter.ts, 89, 9)) +>p2_private : Symbol(m2_C3_public.p2_private, Decl(privacyGetter.ts, 85, 9), Decl(privacyGetter.ts, 89, 9)) return new m2_C1_public(); >m2_C1_public : Symbol(m2_C1_public, Decl(privacyGetter.ts, 70, 11)) } private set p2_private(m2_c3_p2_arg: m2_C1_public) { ->p2_private : Symbol(p2_private, Decl(privacyGetter.ts, 85, 9), Decl(privacyGetter.ts, 89, 9)) +>p2_private : Symbol(m2_C3_public.p2_private, Decl(privacyGetter.ts, 85, 9), Decl(privacyGetter.ts, 89, 9)) >m2_c3_p2_arg : Symbol(m2_c3_p2_arg, Decl(privacyGetter.ts, 91, 31)) >m2_C1_public : Symbol(m2_C1_public, Decl(privacyGetter.ts, 70, 11)) } private get p3_private() { ->p3_private : Symbol(p3_private, Decl(privacyGetter.ts, 92, 9), Decl(privacyGetter.ts, 96, 9)) +>p3_private : Symbol(m2_C3_public.p3_private, Decl(privacyGetter.ts, 92, 9), Decl(privacyGetter.ts, 96, 9)) return new m2_C2_private(); >m2_C2_private : Symbol(m2_C2_private, Decl(privacyGetter.ts, 74, 5)) } private set p3_private(m2_c3_p3_arg: m2_C2_private) { ->p3_private : Symbol(p3_private, Decl(privacyGetter.ts, 92, 9), Decl(privacyGetter.ts, 96, 9)) +>p3_private : Symbol(m2_C3_public.p3_private, Decl(privacyGetter.ts, 92, 9), Decl(privacyGetter.ts, 96, 9)) >m2_c3_p3_arg : Symbol(m2_c3_p3_arg, Decl(privacyGetter.ts, 98, 31)) >m2_C2_private : Symbol(m2_C2_private, Decl(privacyGetter.ts, 74, 5)) } public get p4_public(): m2_C2_private { ->p4_public : Symbol(p4_public, Decl(privacyGetter.ts, 99, 9), Decl(privacyGetter.ts, 103, 9)) +>p4_public : Symbol(m2_C3_public.p4_public, Decl(privacyGetter.ts, 99, 9), Decl(privacyGetter.ts, 103, 9)) >m2_C2_private : Symbol(m2_C2_private, Decl(privacyGetter.ts, 74, 5)) return new m2_C2_private(); @@ -195,7 +195,7 @@ module m2 { } public set p4_public(m2_c3_p4_arg: m2_C2_private) { ->p4_public : Symbol(p4_public, Decl(privacyGetter.ts, 99, 9), Decl(privacyGetter.ts, 103, 9)) +>p4_public : Symbol(m2_C3_public.p4_public, Decl(privacyGetter.ts, 99, 9), Decl(privacyGetter.ts, 103, 9)) >m2_c3_p4_arg : Symbol(m2_c3_p4_arg, Decl(privacyGetter.ts, 105, 29)) >m2_C2_private : Symbol(m2_C2_private, Decl(privacyGetter.ts, 74, 5)) } @@ -205,46 +205,46 @@ module m2 { >m2_C4_private : Symbol(m2_C4_private, Decl(privacyGetter.ts, 107, 5)) private get p1_private() { ->p1_private : Symbol(p1_private, Decl(privacyGetter.ts, 109, 25), Decl(privacyGetter.ts, 112, 9)) +>p1_private : Symbol(m2_C4_private.p1_private, Decl(privacyGetter.ts, 109, 25), Decl(privacyGetter.ts, 112, 9)) return new m2_C1_public(); >m2_C1_public : Symbol(m2_C1_public, Decl(privacyGetter.ts, 70, 11)) } private set p1_private(m2_c3_p1_arg: m2_C1_public) { ->p1_private : Symbol(p1_private, Decl(privacyGetter.ts, 109, 25), Decl(privacyGetter.ts, 112, 9)) +>p1_private : Symbol(m2_C4_private.p1_private, Decl(privacyGetter.ts, 109, 25), Decl(privacyGetter.ts, 112, 9)) >m2_c3_p1_arg : Symbol(m2_c3_p1_arg, Decl(privacyGetter.ts, 114, 31)) >m2_C1_public : Symbol(m2_C1_public, Decl(privacyGetter.ts, 70, 11)) } private get p2_private() { ->p2_private : Symbol(p2_private, Decl(privacyGetter.ts, 115, 9), Decl(privacyGetter.ts, 119, 9)) +>p2_private : Symbol(m2_C4_private.p2_private, Decl(privacyGetter.ts, 115, 9), Decl(privacyGetter.ts, 119, 9)) return new m2_C1_public(); >m2_C1_public : Symbol(m2_C1_public, Decl(privacyGetter.ts, 70, 11)) } private set p2_private(m2_c3_p2_arg: m2_C1_public) { ->p2_private : Symbol(p2_private, Decl(privacyGetter.ts, 115, 9), Decl(privacyGetter.ts, 119, 9)) +>p2_private : Symbol(m2_C4_private.p2_private, Decl(privacyGetter.ts, 115, 9), Decl(privacyGetter.ts, 119, 9)) >m2_c3_p2_arg : Symbol(m2_c3_p2_arg, Decl(privacyGetter.ts, 121, 31)) >m2_C1_public : Symbol(m2_C1_public, Decl(privacyGetter.ts, 70, 11)) } private get p3_private() { ->p3_private : Symbol(p3_private, Decl(privacyGetter.ts, 122, 9), Decl(privacyGetter.ts, 126, 9)) +>p3_private : Symbol(m2_C4_private.p3_private, Decl(privacyGetter.ts, 122, 9), Decl(privacyGetter.ts, 126, 9)) return new m2_C2_private(); >m2_C2_private : Symbol(m2_C2_private, Decl(privacyGetter.ts, 74, 5)) } private set p3_private(m2_c3_p3_arg: m2_C2_private) { ->p3_private : Symbol(p3_private, Decl(privacyGetter.ts, 122, 9), Decl(privacyGetter.ts, 126, 9)) +>p3_private : Symbol(m2_C4_private.p3_private, Decl(privacyGetter.ts, 122, 9), Decl(privacyGetter.ts, 126, 9)) >m2_c3_p3_arg : Symbol(m2_c3_p3_arg, Decl(privacyGetter.ts, 128, 31)) >m2_C2_private : Symbol(m2_C2_private, Decl(privacyGetter.ts, 74, 5)) } public get p4_public(): m2_C2_private { ->p4_public : Symbol(p4_public, Decl(privacyGetter.ts, 129, 9), Decl(privacyGetter.ts, 133, 9)) +>p4_public : Symbol(m2_C4_private.p4_public, Decl(privacyGetter.ts, 129, 9), Decl(privacyGetter.ts, 133, 9)) >m2_C2_private : Symbol(m2_C2_private, Decl(privacyGetter.ts, 74, 5)) return new m2_C2_private(); @@ -252,7 +252,7 @@ module m2 { } public set p4_public(m2_c3_p4_arg: m2_C2_private) { ->p4_public : Symbol(p4_public, Decl(privacyGetter.ts, 129, 9), Decl(privacyGetter.ts, 133, 9)) +>p4_public : Symbol(m2_C4_private.p4_public, Decl(privacyGetter.ts, 129, 9), Decl(privacyGetter.ts, 133, 9)) >m2_c3_p4_arg : Symbol(m2_c3_p4_arg, Decl(privacyGetter.ts, 135, 29)) >m2_C2_private : Symbol(m2_C2_private, Decl(privacyGetter.ts, 74, 5)) } @@ -263,7 +263,7 @@ class C5_private { >C5_private : Symbol(C5_private, Decl(privacyGetter.ts, 138, 1)) private f() { ->f : Symbol(f, Decl(privacyGetter.ts, 140, 18)) +>f : Symbol(C5_private.f, Decl(privacyGetter.ts, 140, 18)) } } @@ -275,46 +275,46 @@ export class C7_public { >C7_public : Symbol(C7_public, Decl(privacyGetter.ts, 146, 1)) private get p1_private() { ->p1_private : Symbol(p1_private, Decl(privacyGetter.ts, 148, 24), Decl(privacyGetter.ts, 151, 5)) +>p1_private : Symbol(C7_public.p1_private, Decl(privacyGetter.ts, 148, 24), Decl(privacyGetter.ts, 151, 5)) return new C6_public(); >C6_public : Symbol(C6_public, Decl(privacyGetter.ts, 143, 1)) } private set p1_private(m1_c3_p1_arg: C6_public) { ->p1_private : Symbol(p1_private, Decl(privacyGetter.ts, 148, 24), Decl(privacyGetter.ts, 151, 5)) +>p1_private : Symbol(C7_public.p1_private, Decl(privacyGetter.ts, 148, 24), Decl(privacyGetter.ts, 151, 5)) >m1_c3_p1_arg : Symbol(m1_c3_p1_arg, Decl(privacyGetter.ts, 153, 27)) >C6_public : Symbol(C6_public, Decl(privacyGetter.ts, 143, 1)) } private get p2_private() { ->p2_private : Symbol(p2_private, Decl(privacyGetter.ts, 154, 5), Decl(privacyGetter.ts, 158, 5)) +>p2_private : Symbol(C7_public.p2_private, Decl(privacyGetter.ts, 154, 5), Decl(privacyGetter.ts, 158, 5)) return new C6_public(); >C6_public : Symbol(C6_public, Decl(privacyGetter.ts, 143, 1)) } private set p2_private(m1_c3_p2_arg: C6_public) { ->p2_private : Symbol(p2_private, Decl(privacyGetter.ts, 154, 5), Decl(privacyGetter.ts, 158, 5)) +>p2_private : Symbol(C7_public.p2_private, Decl(privacyGetter.ts, 154, 5), Decl(privacyGetter.ts, 158, 5)) >m1_c3_p2_arg : Symbol(m1_c3_p2_arg, Decl(privacyGetter.ts, 160, 27)) >C6_public : Symbol(C6_public, Decl(privacyGetter.ts, 143, 1)) } private get p3_private() { ->p3_private : Symbol(p3_private, Decl(privacyGetter.ts, 161, 5), Decl(privacyGetter.ts, 165, 5)) +>p3_private : Symbol(C7_public.p3_private, Decl(privacyGetter.ts, 161, 5), Decl(privacyGetter.ts, 165, 5)) return new C5_private(); >C5_private : Symbol(C5_private, Decl(privacyGetter.ts, 138, 1)) } private set p3_private(m1_c3_p3_arg: C5_private) { ->p3_private : Symbol(p3_private, Decl(privacyGetter.ts, 161, 5), Decl(privacyGetter.ts, 165, 5)) +>p3_private : Symbol(C7_public.p3_private, Decl(privacyGetter.ts, 161, 5), Decl(privacyGetter.ts, 165, 5)) >m1_c3_p3_arg : Symbol(m1_c3_p3_arg, Decl(privacyGetter.ts, 167, 27)) >C5_private : Symbol(C5_private, Decl(privacyGetter.ts, 138, 1)) } public get p4_public(): C5_private { // error ->p4_public : Symbol(p4_public, Decl(privacyGetter.ts, 168, 5), Decl(privacyGetter.ts, 172, 5)) +>p4_public : Symbol(C7_public.p4_public, Decl(privacyGetter.ts, 168, 5), Decl(privacyGetter.ts, 172, 5)) >C5_private : Symbol(C5_private, Decl(privacyGetter.ts, 138, 1)) return new C5_private(); //error @@ -322,7 +322,7 @@ export class C7_public { } public set p4_public(m1_c3_p4_arg: C5_private) { // error ->p4_public : Symbol(p4_public, Decl(privacyGetter.ts, 168, 5), Decl(privacyGetter.ts, 172, 5)) +>p4_public : Symbol(C7_public.p4_public, Decl(privacyGetter.ts, 168, 5), Decl(privacyGetter.ts, 172, 5)) >m1_c3_p4_arg : Symbol(m1_c3_p4_arg, Decl(privacyGetter.ts, 174, 25)) >C5_private : Symbol(C5_private, Decl(privacyGetter.ts, 138, 1)) } @@ -332,46 +332,46 @@ class C8_private { >C8_private : Symbol(C8_private, Decl(privacyGetter.ts, 176, 1)) private get p1_private() { ->p1_private : Symbol(p1_private, Decl(privacyGetter.ts, 178, 18), Decl(privacyGetter.ts, 181, 5)) +>p1_private : Symbol(C8_private.p1_private, Decl(privacyGetter.ts, 178, 18), Decl(privacyGetter.ts, 181, 5)) return new C6_public(); >C6_public : Symbol(C6_public, Decl(privacyGetter.ts, 143, 1)) } private set p1_private(m1_c3_p1_arg: C6_public) { ->p1_private : Symbol(p1_private, Decl(privacyGetter.ts, 178, 18), Decl(privacyGetter.ts, 181, 5)) +>p1_private : Symbol(C8_private.p1_private, Decl(privacyGetter.ts, 178, 18), Decl(privacyGetter.ts, 181, 5)) >m1_c3_p1_arg : Symbol(m1_c3_p1_arg, Decl(privacyGetter.ts, 183, 27)) >C6_public : Symbol(C6_public, Decl(privacyGetter.ts, 143, 1)) } private get p2_private() { ->p2_private : Symbol(p2_private, Decl(privacyGetter.ts, 184, 5), Decl(privacyGetter.ts, 188, 5)) +>p2_private : Symbol(C8_private.p2_private, Decl(privacyGetter.ts, 184, 5), Decl(privacyGetter.ts, 188, 5)) return new C6_public(); >C6_public : Symbol(C6_public, Decl(privacyGetter.ts, 143, 1)) } private set p2_private(m1_c3_p2_arg: C6_public) { ->p2_private : Symbol(p2_private, Decl(privacyGetter.ts, 184, 5), Decl(privacyGetter.ts, 188, 5)) +>p2_private : Symbol(C8_private.p2_private, Decl(privacyGetter.ts, 184, 5), Decl(privacyGetter.ts, 188, 5)) >m1_c3_p2_arg : Symbol(m1_c3_p2_arg, Decl(privacyGetter.ts, 190, 27)) >C6_public : Symbol(C6_public, Decl(privacyGetter.ts, 143, 1)) } private get p3_private() { ->p3_private : Symbol(p3_private, Decl(privacyGetter.ts, 191, 5), Decl(privacyGetter.ts, 195, 5)) +>p3_private : Symbol(C8_private.p3_private, Decl(privacyGetter.ts, 191, 5), Decl(privacyGetter.ts, 195, 5)) return new C5_private(); >C5_private : Symbol(C5_private, Decl(privacyGetter.ts, 138, 1)) } private set p3_private(m1_c3_p3_arg: C5_private) { ->p3_private : Symbol(p3_private, Decl(privacyGetter.ts, 191, 5), Decl(privacyGetter.ts, 195, 5)) +>p3_private : Symbol(C8_private.p3_private, Decl(privacyGetter.ts, 191, 5), Decl(privacyGetter.ts, 195, 5)) >m1_c3_p3_arg : Symbol(m1_c3_p3_arg, Decl(privacyGetter.ts, 197, 27)) >C5_private : Symbol(C5_private, Decl(privacyGetter.ts, 138, 1)) } public get p4_public(): C5_private { ->p4_public : Symbol(p4_public, Decl(privacyGetter.ts, 198, 5), Decl(privacyGetter.ts, 202, 5)) +>p4_public : Symbol(C8_private.p4_public, Decl(privacyGetter.ts, 198, 5), Decl(privacyGetter.ts, 202, 5)) >C5_private : Symbol(C5_private, Decl(privacyGetter.ts, 138, 1)) return new C5_private(); @@ -379,7 +379,7 @@ class C8_private { } public set p4_public(m1_c3_p4_arg: C5_private) { ->p4_public : Symbol(p4_public, Decl(privacyGetter.ts, 198, 5), Decl(privacyGetter.ts, 202, 5)) +>p4_public : Symbol(C8_private.p4_public, Decl(privacyGetter.ts, 198, 5), Decl(privacyGetter.ts, 202, 5)) >m1_c3_p4_arg : Symbol(m1_c3_p4_arg, Decl(privacyGetter.ts, 204, 25)) >C5_private : Symbol(C5_private, Decl(privacyGetter.ts, 138, 1)) } diff --git a/tests/baselines/reference/privacyGloClass.symbols b/tests/baselines/reference/privacyGloClass.symbols index 76b160f81e9..af548294fed 100644 --- a/tests/baselines/reference/privacyGloClass.symbols +++ b/tests/baselines/reference/privacyGloClass.symbols @@ -14,7 +14,7 @@ module m1 { >m1_c_public : Symbol(m1_c_public, Decl(privacyGloClass.ts, 5, 5)) private f1() { ->f1 : Symbol(f1, Decl(privacyGloClass.ts, 7, 30)) +>f1 : Symbol(m1_c_public.f1, Decl(privacyGloClass.ts, 7, 30)) } } @@ -90,7 +90,7 @@ class glo_c_public { >glo_c_public : Symbol(glo_c_public, Decl(privacyGloClass.ts, 44, 1)) private f1() { ->f1 : Symbol(f1, Decl(privacyGloClass.ts, 46, 20)) +>f1 : Symbol(glo_c_public.f1, Decl(privacyGloClass.ts, 46, 20)) } } diff --git a/tests/baselines/reference/privacyGloFunc.symbols b/tests/baselines/reference/privacyGloFunc.symbols index dd76e2e627f..f3d753aacba 100644 --- a/tests/baselines/reference/privacyGloFunc.symbols +++ b/tests/baselines/reference/privacyGloFunc.symbols @@ -6,7 +6,7 @@ export module m1 { >C1_public : Symbol(C1_public, Decl(privacyGloFunc.ts, 0, 18)) private f1() { ->f1 : Symbol(f1, Decl(privacyGloFunc.ts, 1, 28)) +>f1 : Symbol(C1_public.f1, Decl(privacyGloFunc.ts, 1, 28)) } } @@ -30,59 +30,59 @@ export module m1 { } private f1_private(m1_c3_f1_arg: C1_public) { ->f1_private : Symbol(f1_private, Decl(privacyGloFunc.ts, 13, 9)) +>f1_private : Symbol(C3_public.f1_private, Decl(privacyGloFunc.ts, 13, 9)) >m1_c3_f1_arg : Symbol(m1_c3_f1_arg, Decl(privacyGloFunc.ts, 15, 27)) >C1_public : Symbol(C1_public, Decl(privacyGloFunc.ts, 0, 18)) } public f2_public(m1_c3_f2_arg: C1_public) { ->f2_public : Symbol(f2_public, Decl(privacyGloFunc.ts, 16, 9)) +>f2_public : Symbol(C3_public.f2_public, Decl(privacyGloFunc.ts, 16, 9)) >m1_c3_f2_arg : Symbol(m1_c3_f2_arg, Decl(privacyGloFunc.ts, 18, 25)) >C1_public : Symbol(C1_public, Decl(privacyGloFunc.ts, 0, 18)) } private f3_private(m1_c3_f3_arg: C2_private) { ->f3_private : Symbol(f3_private, Decl(privacyGloFunc.ts, 19, 9)) +>f3_private : Symbol(C3_public.f3_private, Decl(privacyGloFunc.ts, 19, 9)) >m1_c3_f3_arg : Symbol(m1_c3_f3_arg, Decl(privacyGloFunc.ts, 21, 27)) >C2_private : Symbol(C2_private, Decl(privacyGloFunc.ts, 4, 5)) } public f4_public(m1_c3_f4_arg: C2_private) { // error ->f4_public : Symbol(f4_public, Decl(privacyGloFunc.ts, 22, 9)) +>f4_public : Symbol(C3_public.f4_public, Decl(privacyGloFunc.ts, 22, 9)) >m1_c3_f4_arg : Symbol(m1_c3_f4_arg, Decl(privacyGloFunc.ts, 24, 25)) >C2_private : Symbol(C2_private, Decl(privacyGloFunc.ts, 4, 5)) } private f5_private() { ->f5_private : Symbol(f5_private, Decl(privacyGloFunc.ts, 25, 9)) +>f5_private : Symbol(C3_public.f5_private, Decl(privacyGloFunc.ts, 25, 9)) return new C1_public(); >C1_public : Symbol(C1_public, Decl(privacyGloFunc.ts, 0, 18)) } public f6_public() { ->f6_public : Symbol(f6_public, Decl(privacyGloFunc.ts, 29, 9)) +>f6_public : Symbol(C3_public.f6_public, Decl(privacyGloFunc.ts, 29, 9)) return new C1_public(); >C1_public : Symbol(C1_public, Decl(privacyGloFunc.ts, 0, 18)) } private f7_private() { ->f7_private : Symbol(f7_private, Decl(privacyGloFunc.ts, 33, 9)) +>f7_private : Symbol(C3_public.f7_private, Decl(privacyGloFunc.ts, 33, 9)) return new C2_private(); >C2_private : Symbol(C2_private, Decl(privacyGloFunc.ts, 4, 5)) } public f8_public() { ->f8_public : Symbol(f8_public, Decl(privacyGloFunc.ts, 37, 9)) +>f8_public : Symbol(C3_public.f8_public, Decl(privacyGloFunc.ts, 37, 9)) return new C2_private(); // error >C2_private : Symbol(C2_private, Decl(privacyGloFunc.ts, 4, 5)) } private f9_private(): C1_public { ->f9_private : Symbol(f9_private, Decl(privacyGloFunc.ts, 41, 9)) +>f9_private : Symbol(C3_public.f9_private, Decl(privacyGloFunc.ts, 41, 9)) >C1_public : Symbol(C1_public, Decl(privacyGloFunc.ts, 0, 18)) return new C1_public(); @@ -90,7 +90,7 @@ export module m1 { } public f10_public(): C1_public { ->f10_public : Symbol(f10_public, Decl(privacyGloFunc.ts, 45, 9)) +>f10_public : Symbol(C3_public.f10_public, Decl(privacyGloFunc.ts, 45, 9)) >C1_public : Symbol(C1_public, Decl(privacyGloFunc.ts, 0, 18)) return new C1_public(); @@ -98,7 +98,7 @@ export module m1 { } private f11_private(): C2_private { ->f11_private : Symbol(f11_private, Decl(privacyGloFunc.ts, 49, 9)) +>f11_private : Symbol(C3_public.f11_private, Decl(privacyGloFunc.ts, 49, 9)) >C2_private : Symbol(C2_private, Decl(privacyGloFunc.ts, 4, 5)) return new C2_private(); @@ -106,7 +106,7 @@ export module m1 { } public f12_public(): C2_private { // error ->f12_public : Symbol(f12_public, Decl(privacyGloFunc.ts, 53, 9)) +>f12_public : Symbol(C3_public.f12_public, Decl(privacyGloFunc.ts, 53, 9)) >C2_private : Symbol(C2_private, Decl(privacyGloFunc.ts, 4, 5)) return new C2_private(); //error @@ -129,53 +129,53 @@ export module m1 { >m1_c4_c1_2 : Symbol(m1_c4_c1_2, Decl(privacyGloFunc.ts, 63, 21)) } private f1_private(m1_c4_f1_arg: C1_public) { ->f1_private : Symbol(f1_private, Decl(privacyGloFunc.ts, 64, 9)) +>f1_private : Symbol(C4_private.f1_private, Decl(privacyGloFunc.ts, 64, 9)) >m1_c4_f1_arg : Symbol(m1_c4_f1_arg, Decl(privacyGloFunc.ts, 65, 27)) >C1_public : Symbol(C1_public, Decl(privacyGloFunc.ts, 0, 18)) } public f2_public(m1_c4_f2_arg: C1_public) { ->f2_public : Symbol(f2_public, Decl(privacyGloFunc.ts, 66, 9)) +>f2_public : Symbol(C4_private.f2_public, Decl(privacyGloFunc.ts, 66, 9)) >m1_c4_f2_arg : Symbol(m1_c4_f2_arg, Decl(privacyGloFunc.ts, 68, 25)) >C1_public : Symbol(C1_public, Decl(privacyGloFunc.ts, 0, 18)) } private f3_private(m1_c4_f3_arg: C2_private) { ->f3_private : Symbol(f3_private, Decl(privacyGloFunc.ts, 69, 9)) +>f3_private : Symbol(C4_private.f3_private, Decl(privacyGloFunc.ts, 69, 9)) >m1_c4_f3_arg : Symbol(m1_c4_f3_arg, Decl(privacyGloFunc.ts, 71, 27)) >C2_private : Symbol(C2_private, Decl(privacyGloFunc.ts, 4, 5)) } public f4_public(m1_c4_f4_arg: C2_private) { ->f4_public : Symbol(f4_public, Decl(privacyGloFunc.ts, 72, 9)) +>f4_public : Symbol(C4_private.f4_public, Decl(privacyGloFunc.ts, 72, 9)) >m1_c4_f4_arg : Symbol(m1_c4_f4_arg, Decl(privacyGloFunc.ts, 74, 25)) >C2_private : Symbol(C2_private, Decl(privacyGloFunc.ts, 4, 5)) } private f5_private() { ->f5_private : Symbol(f5_private, Decl(privacyGloFunc.ts, 75, 9)) +>f5_private : Symbol(C4_private.f5_private, Decl(privacyGloFunc.ts, 75, 9)) return new C1_public(); >C1_public : Symbol(C1_public, Decl(privacyGloFunc.ts, 0, 18)) } public f6_public() { ->f6_public : Symbol(f6_public, Decl(privacyGloFunc.ts, 80, 9)) +>f6_public : Symbol(C4_private.f6_public, Decl(privacyGloFunc.ts, 80, 9)) return new C1_public(); >C1_public : Symbol(C1_public, Decl(privacyGloFunc.ts, 0, 18)) } private f7_private() { ->f7_private : Symbol(f7_private, Decl(privacyGloFunc.ts, 84, 9)) +>f7_private : Symbol(C4_private.f7_private, Decl(privacyGloFunc.ts, 84, 9)) return new C2_private(); >C2_private : Symbol(C2_private, Decl(privacyGloFunc.ts, 4, 5)) } public f8_public() { ->f8_public : Symbol(f8_public, Decl(privacyGloFunc.ts, 88, 9)) +>f8_public : Symbol(C4_private.f8_public, Decl(privacyGloFunc.ts, 88, 9)) return new C2_private(); >C2_private : Symbol(C2_private, Decl(privacyGloFunc.ts, 4, 5)) @@ -183,7 +183,7 @@ export module m1 { private f9_private(): C1_public { ->f9_private : Symbol(f9_private, Decl(privacyGloFunc.ts, 92, 9)) +>f9_private : Symbol(C4_private.f9_private, Decl(privacyGloFunc.ts, 92, 9)) >C1_public : Symbol(C1_public, Decl(privacyGloFunc.ts, 0, 18)) return new C1_public(); @@ -191,7 +191,7 @@ export module m1 { } public f10_public(): C1_public { ->f10_public : Symbol(f10_public, Decl(privacyGloFunc.ts, 97, 9)) +>f10_public : Symbol(C4_private.f10_public, Decl(privacyGloFunc.ts, 97, 9)) >C1_public : Symbol(C1_public, Decl(privacyGloFunc.ts, 0, 18)) return new C1_public(); @@ -199,7 +199,7 @@ export module m1 { } private f11_private(): C2_private { ->f11_private : Symbol(f11_private, Decl(privacyGloFunc.ts, 101, 9)) +>f11_private : Symbol(C4_private.f11_private, Decl(privacyGloFunc.ts, 101, 9)) >C2_private : Symbol(C2_private, Decl(privacyGloFunc.ts, 4, 5)) return new C2_private(); @@ -207,7 +207,7 @@ export module m1 { } public f12_public(): C2_private { ->f12_public : Symbol(f12_public, Decl(privacyGloFunc.ts, 105, 9)) +>f12_public : Symbol(C4_private.f12_public, Decl(privacyGloFunc.ts, 105, 9)) >C2_private : Symbol(C2_private, Decl(privacyGloFunc.ts, 4, 5)) return new C2_private(); @@ -344,7 +344,7 @@ module m2 { >m2_C1_public : Symbol(m2_C1_public, Decl(privacyGloFunc.ts, 178, 11)) private f() { ->f : Symbol(f, Decl(privacyGloFunc.ts, 179, 31)) +>f : Symbol(m2_C1_public.f, Decl(privacyGloFunc.ts, 179, 31)) } } @@ -368,59 +368,59 @@ module m2 { } private f1_private(m2_c3_f1_arg: m2_C1_public) { ->f1_private : Symbol(f1_private, Decl(privacyGloFunc.ts, 191, 9)) +>f1_private : Symbol(m2_C3_public.f1_private, Decl(privacyGloFunc.ts, 191, 9)) >m2_c3_f1_arg : Symbol(m2_c3_f1_arg, Decl(privacyGloFunc.ts, 193, 27)) >m2_C1_public : Symbol(m2_C1_public, Decl(privacyGloFunc.ts, 178, 11)) } public f2_public(m2_c3_f2_arg: m2_C1_public) { ->f2_public : Symbol(f2_public, Decl(privacyGloFunc.ts, 194, 9)) +>f2_public : Symbol(m2_C3_public.f2_public, Decl(privacyGloFunc.ts, 194, 9)) >m2_c3_f2_arg : Symbol(m2_c3_f2_arg, Decl(privacyGloFunc.ts, 196, 25)) >m2_C1_public : Symbol(m2_C1_public, Decl(privacyGloFunc.ts, 178, 11)) } private f3_private(m2_c3_f3_arg: m2_C2_private) { ->f3_private : Symbol(f3_private, Decl(privacyGloFunc.ts, 197, 9)) +>f3_private : Symbol(m2_C3_public.f3_private, Decl(privacyGloFunc.ts, 197, 9)) >m2_c3_f3_arg : Symbol(m2_c3_f3_arg, Decl(privacyGloFunc.ts, 199, 27)) >m2_C2_private : Symbol(m2_C2_private, Decl(privacyGloFunc.ts, 182, 5)) } public f4_public(m2_c3_f4_arg: m2_C2_private) { ->f4_public : Symbol(f4_public, Decl(privacyGloFunc.ts, 200, 9)) +>f4_public : Symbol(m2_C3_public.f4_public, Decl(privacyGloFunc.ts, 200, 9)) >m2_c3_f4_arg : Symbol(m2_c3_f4_arg, Decl(privacyGloFunc.ts, 202, 25)) >m2_C2_private : Symbol(m2_C2_private, Decl(privacyGloFunc.ts, 182, 5)) } private f5_private() { ->f5_private : Symbol(f5_private, Decl(privacyGloFunc.ts, 203, 9)) +>f5_private : Symbol(m2_C3_public.f5_private, Decl(privacyGloFunc.ts, 203, 9)) return new m2_C1_public(); >m2_C1_public : Symbol(m2_C1_public, Decl(privacyGloFunc.ts, 178, 11)) } public f6_public() { ->f6_public : Symbol(f6_public, Decl(privacyGloFunc.ts, 207, 9)) +>f6_public : Symbol(m2_C3_public.f6_public, Decl(privacyGloFunc.ts, 207, 9)) return new m2_C1_public(); >m2_C1_public : Symbol(m2_C1_public, Decl(privacyGloFunc.ts, 178, 11)) } private f7_private() { ->f7_private : Symbol(f7_private, Decl(privacyGloFunc.ts, 211, 9)) +>f7_private : Symbol(m2_C3_public.f7_private, Decl(privacyGloFunc.ts, 211, 9)) return new m2_C2_private(); >m2_C2_private : Symbol(m2_C2_private, Decl(privacyGloFunc.ts, 182, 5)) } public f8_public() { ->f8_public : Symbol(f8_public, Decl(privacyGloFunc.ts, 215, 9)) +>f8_public : Symbol(m2_C3_public.f8_public, Decl(privacyGloFunc.ts, 215, 9)) return new m2_C2_private(); >m2_C2_private : Symbol(m2_C2_private, Decl(privacyGloFunc.ts, 182, 5)) } private f9_private(): m2_C1_public { ->f9_private : Symbol(f9_private, Decl(privacyGloFunc.ts, 219, 9)) +>f9_private : Symbol(m2_C3_public.f9_private, Decl(privacyGloFunc.ts, 219, 9)) >m2_C1_public : Symbol(m2_C1_public, Decl(privacyGloFunc.ts, 178, 11)) return new m2_C1_public(); @@ -428,7 +428,7 @@ module m2 { } public f10_public(): m2_C1_public { ->f10_public : Symbol(f10_public, Decl(privacyGloFunc.ts, 223, 9)) +>f10_public : Symbol(m2_C3_public.f10_public, Decl(privacyGloFunc.ts, 223, 9)) >m2_C1_public : Symbol(m2_C1_public, Decl(privacyGloFunc.ts, 178, 11)) return new m2_C1_public(); @@ -436,7 +436,7 @@ module m2 { } private f11_private(): m2_C2_private { ->f11_private : Symbol(f11_private, Decl(privacyGloFunc.ts, 227, 9)) +>f11_private : Symbol(m2_C3_public.f11_private, Decl(privacyGloFunc.ts, 227, 9)) >m2_C2_private : Symbol(m2_C2_private, Decl(privacyGloFunc.ts, 182, 5)) return new m2_C2_private(); @@ -444,7 +444,7 @@ module m2 { } public f12_public(): m2_C2_private { ->f12_public : Symbol(f12_public, Decl(privacyGloFunc.ts, 231, 9)) +>f12_public : Symbol(m2_C3_public.f12_public, Decl(privacyGloFunc.ts, 231, 9)) >m2_C2_private : Symbol(m2_C2_private, Decl(privacyGloFunc.ts, 182, 5)) return new m2_C2_private(); @@ -468,53 +468,53 @@ module m2 { } private f1_private(m2_c4_f1_arg: m2_C1_public) { ->f1_private : Symbol(f1_private, Decl(privacyGloFunc.ts, 242, 9)) +>f1_private : Symbol(m2_C4_private.f1_private, Decl(privacyGloFunc.ts, 242, 9)) >m2_c4_f1_arg : Symbol(m2_c4_f1_arg, Decl(privacyGloFunc.ts, 244, 27)) >m2_C1_public : Symbol(m2_C1_public, Decl(privacyGloFunc.ts, 178, 11)) } public f2_public(m2_c4_f2_arg: m2_C1_public) { ->f2_public : Symbol(f2_public, Decl(privacyGloFunc.ts, 245, 9)) +>f2_public : Symbol(m2_C4_private.f2_public, Decl(privacyGloFunc.ts, 245, 9)) >m2_c4_f2_arg : Symbol(m2_c4_f2_arg, Decl(privacyGloFunc.ts, 247, 25)) >m2_C1_public : Symbol(m2_C1_public, Decl(privacyGloFunc.ts, 178, 11)) } private f3_private(m2_c4_f3_arg: m2_C2_private) { ->f3_private : Symbol(f3_private, Decl(privacyGloFunc.ts, 248, 9)) +>f3_private : Symbol(m2_C4_private.f3_private, Decl(privacyGloFunc.ts, 248, 9)) >m2_c4_f3_arg : Symbol(m2_c4_f3_arg, Decl(privacyGloFunc.ts, 250, 27)) >m2_C2_private : Symbol(m2_C2_private, Decl(privacyGloFunc.ts, 182, 5)) } public f4_public(m2_c4_f4_arg: m2_C2_private) { ->f4_public : Symbol(f4_public, Decl(privacyGloFunc.ts, 251, 9)) +>f4_public : Symbol(m2_C4_private.f4_public, Decl(privacyGloFunc.ts, 251, 9)) >m2_c4_f4_arg : Symbol(m2_c4_f4_arg, Decl(privacyGloFunc.ts, 253, 25)) >m2_C2_private : Symbol(m2_C2_private, Decl(privacyGloFunc.ts, 182, 5)) } private f5_private() { ->f5_private : Symbol(f5_private, Decl(privacyGloFunc.ts, 254, 9)) +>f5_private : Symbol(m2_C4_private.f5_private, Decl(privacyGloFunc.ts, 254, 9)) return new m2_C1_public(); >m2_C1_public : Symbol(m2_C1_public, Decl(privacyGloFunc.ts, 178, 11)) } public f6_public() { ->f6_public : Symbol(f6_public, Decl(privacyGloFunc.ts, 259, 9)) +>f6_public : Symbol(m2_C4_private.f6_public, Decl(privacyGloFunc.ts, 259, 9)) return new m2_C1_public(); >m2_C1_public : Symbol(m2_C1_public, Decl(privacyGloFunc.ts, 178, 11)) } private f7_private() { ->f7_private : Symbol(f7_private, Decl(privacyGloFunc.ts, 263, 9)) +>f7_private : Symbol(m2_C4_private.f7_private, Decl(privacyGloFunc.ts, 263, 9)) return new m2_C2_private(); >m2_C2_private : Symbol(m2_C2_private, Decl(privacyGloFunc.ts, 182, 5)) } public f8_public() { ->f8_public : Symbol(f8_public, Decl(privacyGloFunc.ts, 267, 9)) +>f8_public : Symbol(m2_C4_private.f8_public, Decl(privacyGloFunc.ts, 267, 9)) return new m2_C2_private(); >m2_C2_private : Symbol(m2_C2_private, Decl(privacyGloFunc.ts, 182, 5)) @@ -522,7 +522,7 @@ module m2 { private f9_private(): m2_C1_public { ->f9_private : Symbol(f9_private, Decl(privacyGloFunc.ts, 271, 9)) +>f9_private : Symbol(m2_C4_private.f9_private, Decl(privacyGloFunc.ts, 271, 9)) >m2_C1_public : Symbol(m2_C1_public, Decl(privacyGloFunc.ts, 178, 11)) return new m2_C1_public(); @@ -530,7 +530,7 @@ module m2 { } public f10_public(): m2_C1_public { ->f10_public : Symbol(f10_public, Decl(privacyGloFunc.ts, 276, 9)) +>f10_public : Symbol(m2_C4_private.f10_public, Decl(privacyGloFunc.ts, 276, 9)) >m2_C1_public : Symbol(m2_C1_public, Decl(privacyGloFunc.ts, 178, 11)) return new m2_C1_public(); @@ -538,7 +538,7 @@ module m2 { } private f11_private(): m2_C2_private { ->f11_private : Symbol(f11_private, Decl(privacyGloFunc.ts, 280, 9)) +>f11_private : Symbol(m2_C4_private.f11_private, Decl(privacyGloFunc.ts, 280, 9)) >m2_C2_private : Symbol(m2_C2_private, Decl(privacyGloFunc.ts, 182, 5)) return new m2_C2_private(); @@ -546,7 +546,7 @@ module m2 { } public f12_public(): m2_C2_private { ->f12_public : Symbol(f12_public, Decl(privacyGloFunc.ts, 284, 9)) +>f12_public : Symbol(m2_C4_private.f12_public, Decl(privacyGloFunc.ts, 284, 9)) >m2_C2_private : Symbol(m2_C2_private, Decl(privacyGloFunc.ts, 182, 5)) return new m2_C2_private(); @@ -680,7 +680,7 @@ class C5_private { >C5_private : Symbol(C5_private, Decl(privacyGloFunc.ts, 355, 1)) private f() { ->f : Symbol(f, Decl(privacyGloFunc.ts, 357, 18)) +>f : Symbol(C5_private.f, Decl(privacyGloFunc.ts, 357, 18)) } } @@ -703,59 +703,59 @@ export class C7_public { >c7_c1_2 : Symbol(c7_c1_2, Decl(privacyGloFunc.ts, 368, 17)) } private f1_private(c7_f1_arg: C6_public) { ->f1_private : Symbol(f1_private, Decl(privacyGloFunc.ts, 369, 5)) +>f1_private : Symbol(C7_public.f1_private, Decl(privacyGloFunc.ts, 369, 5)) >c7_f1_arg : Symbol(c7_f1_arg, Decl(privacyGloFunc.ts, 370, 23)) >C6_public : Symbol(C6_public, Decl(privacyGloFunc.ts, 360, 1)) } public f2_public(c7_f2_arg: C6_public) { ->f2_public : Symbol(f2_public, Decl(privacyGloFunc.ts, 371, 5)) +>f2_public : Symbol(C7_public.f2_public, Decl(privacyGloFunc.ts, 371, 5)) >c7_f2_arg : Symbol(c7_f2_arg, Decl(privacyGloFunc.ts, 373, 21)) >C6_public : Symbol(C6_public, Decl(privacyGloFunc.ts, 360, 1)) } private f3_private(c7_f3_arg: C5_private) { ->f3_private : Symbol(f3_private, Decl(privacyGloFunc.ts, 374, 5)) +>f3_private : Symbol(C7_public.f3_private, Decl(privacyGloFunc.ts, 374, 5)) >c7_f3_arg : Symbol(c7_f3_arg, Decl(privacyGloFunc.ts, 376, 23)) >C5_private : Symbol(C5_private, Decl(privacyGloFunc.ts, 355, 1)) } public f4_public(c7_f4_arg: C5_private) { //error ->f4_public : Symbol(f4_public, Decl(privacyGloFunc.ts, 377, 5)) +>f4_public : Symbol(C7_public.f4_public, Decl(privacyGloFunc.ts, 377, 5)) >c7_f4_arg : Symbol(c7_f4_arg, Decl(privacyGloFunc.ts, 379, 21)) >C5_private : Symbol(C5_private, Decl(privacyGloFunc.ts, 355, 1)) } private f5_private() { ->f5_private : Symbol(f5_private, Decl(privacyGloFunc.ts, 380, 5)) +>f5_private : Symbol(C7_public.f5_private, Decl(privacyGloFunc.ts, 380, 5)) return new C6_public(); >C6_public : Symbol(C6_public, Decl(privacyGloFunc.ts, 360, 1)) } public f6_public() { ->f6_public : Symbol(f6_public, Decl(privacyGloFunc.ts, 384, 5)) +>f6_public : Symbol(C7_public.f6_public, Decl(privacyGloFunc.ts, 384, 5)) return new C6_public(); >C6_public : Symbol(C6_public, Decl(privacyGloFunc.ts, 360, 1)) } private f7_private() { ->f7_private : Symbol(f7_private, Decl(privacyGloFunc.ts, 388, 5)) +>f7_private : Symbol(C7_public.f7_private, Decl(privacyGloFunc.ts, 388, 5)) return new C5_private(); >C5_private : Symbol(C5_private, Decl(privacyGloFunc.ts, 355, 1)) } public f8_public() { ->f8_public : Symbol(f8_public, Decl(privacyGloFunc.ts, 392, 5)) +>f8_public : Symbol(C7_public.f8_public, Decl(privacyGloFunc.ts, 392, 5)) return new C5_private(); //error >C5_private : Symbol(C5_private, Decl(privacyGloFunc.ts, 355, 1)) } private f9_private(): C6_public { ->f9_private : Symbol(f9_private, Decl(privacyGloFunc.ts, 396, 5)) +>f9_private : Symbol(C7_public.f9_private, Decl(privacyGloFunc.ts, 396, 5)) >C6_public : Symbol(C6_public, Decl(privacyGloFunc.ts, 360, 1)) return new C6_public(); @@ -763,7 +763,7 @@ export class C7_public { } public f10_public(): C6_public { ->f10_public : Symbol(f10_public, Decl(privacyGloFunc.ts, 400, 5)) +>f10_public : Symbol(C7_public.f10_public, Decl(privacyGloFunc.ts, 400, 5)) >C6_public : Symbol(C6_public, Decl(privacyGloFunc.ts, 360, 1)) return new C6_public(); @@ -771,7 +771,7 @@ export class C7_public { } private f11_private(): C5_private { ->f11_private : Symbol(f11_private, Decl(privacyGloFunc.ts, 404, 5)) +>f11_private : Symbol(C7_public.f11_private, Decl(privacyGloFunc.ts, 404, 5)) >C5_private : Symbol(C5_private, Decl(privacyGloFunc.ts, 355, 1)) return new C5_private(); @@ -779,7 +779,7 @@ export class C7_public { } public f12_public(): C5_private { //error ->f12_public : Symbol(f12_public, Decl(privacyGloFunc.ts, 408, 5)) +>f12_public : Symbol(C7_public.f12_public, Decl(privacyGloFunc.ts, 408, 5)) >C5_private : Symbol(C5_private, Decl(privacyGloFunc.ts, 355, 1)) return new C5_private(); //error @@ -803,59 +803,59 @@ class C8_private { } private f1_private(c8_f1_arg: C6_public) { ->f1_private : Symbol(f1_private, Decl(privacyGloFunc.ts, 419, 5)) +>f1_private : Symbol(C8_private.f1_private, Decl(privacyGloFunc.ts, 419, 5)) >c8_f1_arg : Symbol(c8_f1_arg, Decl(privacyGloFunc.ts, 421, 23)) >C6_public : Symbol(C6_public, Decl(privacyGloFunc.ts, 360, 1)) } public f2_public(c8_f2_arg: C6_public) { ->f2_public : Symbol(f2_public, Decl(privacyGloFunc.ts, 422, 5)) +>f2_public : Symbol(C8_private.f2_public, Decl(privacyGloFunc.ts, 422, 5)) >c8_f2_arg : Symbol(c8_f2_arg, Decl(privacyGloFunc.ts, 424, 21)) >C6_public : Symbol(C6_public, Decl(privacyGloFunc.ts, 360, 1)) } private f3_private(c8_f3_arg: C5_private) { ->f3_private : Symbol(f3_private, Decl(privacyGloFunc.ts, 425, 5)) +>f3_private : Symbol(C8_private.f3_private, Decl(privacyGloFunc.ts, 425, 5)) >c8_f3_arg : Symbol(c8_f3_arg, Decl(privacyGloFunc.ts, 427, 23)) >C5_private : Symbol(C5_private, Decl(privacyGloFunc.ts, 355, 1)) } public f4_public(c8_f4_arg: C5_private) { ->f4_public : Symbol(f4_public, Decl(privacyGloFunc.ts, 428, 5)) +>f4_public : Symbol(C8_private.f4_public, Decl(privacyGloFunc.ts, 428, 5)) >c8_f4_arg : Symbol(c8_f4_arg, Decl(privacyGloFunc.ts, 430, 21)) >C5_private : Symbol(C5_private, Decl(privacyGloFunc.ts, 355, 1)) } private f5_private() { ->f5_private : Symbol(f5_private, Decl(privacyGloFunc.ts, 431, 5)) +>f5_private : Symbol(C8_private.f5_private, Decl(privacyGloFunc.ts, 431, 5)) return new C6_public(); >C6_public : Symbol(C6_public, Decl(privacyGloFunc.ts, 360, 1)) } public f6_public() { ->f6_public : Symbol(f6_public, Decl(privacyGloFunc.ts, 435, 5)) +>f6_public : Symbol(C8_private.f6_public, Decl(privacyGloFunc.ts, 435, 5)) return new C6_public(); >C6_public : Symbol(C6_public, Decl(privacyGloFunc.ts, 360, 1)) } private f7_private() { ->f7_private : Symbol(f7_private, Decl(privacyGloFunc.ts, 439, 5)) +>f7_private : Symbol(C8_private.f7_private, Decl(privacyGloFunc.ts, 439, 5)) return new C5_private(); >C5_private : Symbol(C5_private, Decl(privacyGloFunc.ts, 355, 1)) } public f8_public() { ->f8_public : Symbol(f8_public, Decl(privacyGloFunc.ts, 443, 5)) +>f8_public : Symbol(C8_private.f8_public, Decl(privacyGloFunc.ts, 443, 5)) return new C5_private(); >C5_private : Symbol(C5_private, Decl(privacyGloFunc.ts, 355, 1)) } private f9_private(): C6_public { ->f9_private : Symbol(f9_private, Decl(privacyGloFunc.ts, 447, 5)) +>f9_private : Symbol(C8_private.f9_private, Decl(privacyGloFunc.ts, 447, 5)) >C6_public : Symbol(C6_public, Decl(privacyGloFunc.ts, 360, 1)) return new C6_public(); @@ -863,7 +863,7 @@ class C8_private { } public f10_public(): C6_public { ->f10_public : Symbol(f10_public, Decl(privacyGloFunc.ts, 451, 5)) +>f10_public : Symbol(C8_private.f10_public, Decl(privacyGloFunc.ts, 451, 5)) >C6_public : Symbol(C6_public, Decl(privacyGloFunc.ts, 360, 1)) return new C6_public(); @@ -871,7 +871,7 @@ class C8_private { } private f11_private(): C5_private { ->f11_private : Symbol(f11_private, Decl(privacyGloFunc.ts, 455, 5)) +>f11_private : Symbol(C8_private.f11_private, Decl(privacyGloFunc.ts, 455, 5)) >C5_private : Symbol(C5_private, Decl(privacyGloFunc.ts, 355, 1)) return new C5_private(); @@ -879,7 +879,7 @@ class C8_private { } public f12_public(): C5_private { ->f12_public : Symbol(f12_public, Decl(privacyGloFunc.ts, 459, 5)) +>f12_public : Symbol(C8_private.f12_public, Decl(privacyGloFunc.ts, 459, 5)) >C5_private : Symbol(C5_private, Decl(privacyGloFunc.ts, 355, 1)) return new C5_private(); diff --git a/tests/baselines/reference/privacyGloGetter.symbols b/tests/baselines/reference/privacyGloGetter.symbols index ac6a2041f3c..5f67eec29a9 100644 --- a/tests/baselines/reference/privacyGloGetter.symbols +++ b/tests/baselines/reference/privacyGloGetter.symbols @@ -6,7 +6,7 @@ module m1 { >C1_public : Symbol(C1_public, Decl(privacyGloGetter.ts, 0, 11)) private f1() { ->f1 : Symbol(f1, Decl(privacyGloGetter.ts, 1, 28)) +>f1 : Symbol(C1_public.f1, Decl(privacyGloGetter.ts, 1, 28)) } } @@ -18,46 +18,46 @@ module m1 { >C3_public : Symbol(C3_public, Decl(privacyGloGetter.ts, 7, 5)) private get p1_private() { ->p1_private : Symbol(p1_private, Decl(privacyGloGetter.ts, 9, 28), Decl(privacyGloGetter.ts, 12, 9)) +>p1_private : Symbol(C3_public.p1_private, Decl(privacyGloGetter.ts, 9, 28), Decl(privacyGloGetter.ts, 12, 9)) return new C1_public(); >C1_public : Symbol(C1_public, Decl(privacyGloGetter.ts, 0, 11)) } private set p1_private(m1_c3_p1_arg: C1_public) { ->p1_private : Symbol(p1_private, Decl(privacyGloGetter.ts, 9, 28), Decl(privacyGloGetter.ts, 12, 9)) +>p1_private : Symbol(C3_public.p1_private, Decl(privacyGloGetter.ts, 9, 28), Decl(privacyGloGetter.ts, 12, 9)) >m1_c3_p1_arg : Symbol(m1_c3_p1_arg, Decl(privacyGloGetter.ts, 14, 31)) >C1_public : Symbol(C1_public, Decl(privacyGloGetter.ts, 0, 11)) } private get p2_private() { ->p2_private : Symbol(p2_private, Decl(privacyGloGetter.ts, 15, 9), Decl(privacyGloGetter.ts, 19, 9)) +>p2_private : Symbol(C3_public.p2_private, Decl(privacyGloGetter.ts, 15, 9), Decl(privacyGloGetter.ts, 19, 9)) return new C1_public(); >C1_public : Symbol(C1_public, Decl(privacyGloGetter.ts, 0, 11)) } private set p2_private(m1_c3_p2_arg: C1_public) { ->p2_private : Symbol(p2_private, Decl(privacyGloGetter.ts, 15, 9), Decl(privacyGloGetter.ts, 19, 9)) +>p2_private : Symbol(C3_public.p2_private, Decl(privacyGloGetter.ts, 15, 9), Decl(privacyGloGetter.ts, 19, 9)) >m1_c3_p2_arg : Symbol(m1_c3_p2_arg, Decl(privacyGloGetter.ts, 21, 31)) >C1_public : Symbol(C1_public, Decl(privacyGloGetter.ts, 0, 11)) } private get p3_private() { ->p3_private : Symbol(p3_private, Decl(privacyGloGetter.ts, 22, 9), Decl(privacyGloGetter.ts, 26, 9)) +>p3_private : Symbol(C3_public.p3_private, Decl(privacyGloGetter.ts, 22, 9), Decl(privacyGloGetter.ts, 26, 9)) return new C2_private(); >C2_private : Symbol(C2_private, Decl(privacyGloGetter.ts, 4, 5)) } private set p3_private(m1_c3_p3_arg: C2_private) { ->p3_private : Symbol(p3_private, Decl(privacyGloGetter.ts, 22, 9), Decl(privacyGloGetter.ts, 26, 9)) +>p3_private : Symbol(C3_public.p3_private, Decl(privacyGloGetter.ts, 22, 9), Decl(privacyGloGetter.ts, 26, 9)) >m1_c3_p3_arg : Symbol(m1_c3_p3_arg, Decl(privacyGloGetter.ts, 28, 31)) >C2_private : Symbol(C2_private, Decl(privacyGloGetter.ts, 4, 5)) } public get p4_public(): C2_private { // error ->p4_public : Symbol(p4_public, Decl(privacyGloGetter.ts, 29, 9), Decl(privacyGloGetter.ts, 33, 9)) +>p4_public : Symbol(C3_public.p4_public, Decl(privacyGloGetter.ts, 29, 9), Decl(privacyGloGetter.ts, 33, 9)) >C2_private : Symbol(C2_private, Decl(privacyGloGetter.ts, 4, 5)) return new C2_private(); //error @@ -65,7 +65,7 @@ module m1 { } public set p4_public(m1_c3_p4_arg: C2_private) { // error ->p4_public : Symbol(p4_public, Decl(privacyGloGetter.ts, 29, 9), Decl(privacyGloGetter.ts, 33, 9)) +>p4_public : Symbol(C3_public.p4_public, Decl(privacyGloGetter.ts, 29, 9), Decl(privacyGloGetter.ts, 33, 9)) >m1_c3_p4_arg : Symbol(m1_c3_p4_arg, Decl(privacyGloGetter.ts, 35, 29)) >C2_private : Symbol(C2_private, Decl(privacyGloGetter.ts, 4, 5)) } @@ -75,46 +75,46 @@ module m1 { >C4_private : Symbol(C4_private, Decl(privacyGloGetter.ts, 37, 5)) private get p1_private() { ->p1_private : Symbol(p1_private, Decl(privacyGloGetter.ts, 39, 22), Decl(privacyGloGetter.ts, 42, 9)) +>p1_private : Symbol(C4_private.p1_private, Decl(privacyGloGetter.ts, 39, 22), Decl(privacyGloGetter.ts, 42, 9)) return new C1_public(); >C1_public : Symbol(C1_public, Decl(privacyGloGetter.ts, 0, 11)) } private set p1_private(m1_c3_p1_arg: C1_public) { ->p1_private : Symbol(p1_private, Decl(privacyGloGetter.ts, 39, 22), Decl(privacyGloGetter.ts, 42, 9)) +>p1_private : Symbol(C4_private.p1_private, Decl(privacyGloGetter.ts, 39, 22), Decl(privacyGloGetter.ts, 42, 9)) >m1_c3_p1_arg : Symbol(m1_c3_p1_arg, Decl(privacyGloGetter.ts, 44, 31)) >C1_public : Symbol(C1_public, Decl(privacyGloGetter.ts, 0, 11)) } private get p2_private() { ->p2_private : Symbol(p2_private, Decl(privacyGloGetter.ts, 45, 9), Decl(privacyGloGetter.ts, 49, 9)) +>p2_private : Symbol(C4_private.p2_private, Decl(privacyGloGetter.ts, 45, 9), Decl(privacyGloGetter.ts, 49, 9)) return new C1_public(); >C1_public : Symbol(C1_public, Decl(privacyGloGetter.ts, 0, 11)) } private set p2_private(m1_c3_p2_arg: C1_public) { ->p2_private : Symbol(p2_private, Decl(privacyGloGetter.ts, 45, 9), Decl(privacyGloGetter.ts, 49, 9)) +>p2_private : Symbol(C4_private.p2_private, Decl(privacyGloGetter.ts, 45, 9), Decl(privacyGloGetter.ts, 49, 9)) >m1_c3_p2_arg : Symbol(m1_c3_p2_arg, Decl(privacyGloGetter.ts, 51, 31)) >C1_public : Symbol(C1_public, Decl(privacyGloGetter.ts, 0, 11)) } private get p3_private() { ->p3_private : Symbol(p3_private, Decl(privacyGloGetter.ts, 52, 9), Decl(privacyGloGetter.ts, 56, 9)) +>p3_private : Symbol(C4_private.p3_private, Decl(privacyGloGetter.ts, 52, 9), Decl(privacyGloGetter.ts, 56, 9)) return new C2_private(); >C2_private : Symbol(C2_private, Decl(privacyGloGetter.ts, 4, 5)) } private set p3_private(m1_c3_p3_arg: C2_private) { ->p3_private : Symbol(p3_private, Decl(privacyGloGetter.ts, 52, 9), Decl(privacyGloGetter.ts, 56, 9)) +>p3_private : Symbol(C4_private.p3_private, Decl(privacyGloGetter.ts, 52, 9), Decl(privacyGloGetter.ts, 56, 9)) >m1_c3_p3_arg : Symbol(m1_c3_p3_arg, Decl(privacyGloGetter.ts, 58, 31)) >C2_private : Symbol(C2_private, Decl(privacyGloGetter.ts, 4, 5)) } public get p4_public(): C2_private { ->p4_public : Symbol(p4_public, Decl(privacyGloGetter.ts, 59, 9), Decl(privacyGloGetter.ts, 63, 9)) +>p4_public : Symbol(C4_private.p4_public, Decl(privacyGloGetter.ts, 59, 9), Decl(privacyGloGetter.ts, 63, 9)) >C2_private : Symbol(C2_private, Decl(privacyGloGetter.ts, 4, 5)) return new C2_private(); @@ -122,7 +122,7 @@ module m1 { } public set p4_public(m1_c3_p4_arg: C2_private) { ->p4_public : Symbol(p4_public, Decl(privacyGloGetter.ts, 59, 9), Decl(privacyGloGetter.ts, 63, 9)) +>p4_public : Symbol(C4_private.p4_public, Decl(privacyGloGetter.ts, 59, 9), Decl(privacyGloGetter.ts, 63, 9)) >m1_c3_p4_arg : Symbol(m1_c3_p4_arg, Decl(privacyGloGetter.ts, 65, 29)) >C2_private : Symbol(C2_private, Decl(privacyGloGetter.ts, 4, 5)) } @@ -137,27 +137,27 @@ class C7_public { >C7_public : Symbol(C7_public, Decl(privacyGloGetter.ts, 71, 1)) private get p1_private() { ->p1_private : Symbol(p1_private, Decl(privacyGloGetter.ts, 73, 17), Decl(privacyGloGetter.ts, 76, 5)) +>p1_private : Symbol(C7_public.p1_private, Decl(privacyGloGetter.ts, 73, 17), Decl(privacyGloGetter.ts, 76, 5)) return new C6_public(); >C6_public : Symbol(C6_public, Decl(privacyGloGetter.ts, 68, 1)) } private set p1_private(m1_c3_p1_arg: C6_public) { ->p1_private : Symbol(p1_private, Decl(privacyGloGetter.ts, 73, 17), Decl(privacyGloGetter.ts, 76, 5)) +>p1_private : Symbol(C7_public.p1_private, Decl(privacyGloGetter.ts, 73, 17), Decl(privacyGloGetter.ts, 76, 5)) >m1_c3_p1_arg : Symbol(m1_c3_p1_arg, Decl(privacyGloGetter.ts, 78, 27)) >C6_public : Symbol(C6_public, Decl(privacyGloGetter.ts, 68, 1)) } private get p2_private() { ->p2_private : Symbol(p2_private, Decl(privacyGloGetter.ts, 79, 5), Decl(privacyGloGetter.ts, 83, 5)) +>p2_private : Symbol(C7_public.p2_private, Decl(privacyGloGetter.ts, 79, 5), Decl(privacyGloGetter.ts, 83, 5)) return new C6_public(); >C6_public : Symbol(C6_public, Decl(privacyGloGetter.ts, 68, 1)) } private set p2_private(m1_c3_p2_arg: C6_public) { ->p2_private : Symbol(p2_private, Decl(privacyGloGetter.ts, 79, 5), Decl(privacyGloGetter.ts, 83, 5)) +>p2_private : Symbol(C7_public.p2_private, Decl(privacyGloGetter.ts, 79, 5), Decl(privacyGloGetter.ts, 83, 5)) >m1_c3_p2_arg : Symbol(m1_c3_p2_arg, Decl(privacyGloGetter.ts, 85, 27)) >C6_public : Symbol(C6_public, Decl(privacyGloGetter.ts, 68, 1)) } diff --git a/tests/baselines/reference/privacyGloImportParseErrors.errors.txt b/tests/baselines/reference/privacyGloImportParseErrors.errors.txt index 236418a10ae..6f6c2e5f865 100644 --- a/tests/baselines/reference/privacyGloImportParseErrors.errors.txt +++ b/tests/baselines/reference/privacyGloImportParseErrors.errors.txt @@ -1,3 +1,4 @@ +tests/cases/compiler/privacyGloImportParseErrors.ts(22,5): error TS2668: 'export' modifier cannot be applied to ambient modules and module augmentations since they are always visible. tests/cases/compiler/privacyGloImportParseErrors.ts(22,27): error TS2435: Ambient modules cannot be nested in other modules or namespaces. tests/cases/compiler/privacyGloImportParseErrors.ts(30,20): error TS2435: Ambient modules cannot be nested in other modules or namespaces. tests/cases/compiler/privacyGloImportParseErrors.ts(49,29): error TS4000: Import declaration 'm1_im2_private' is using private name 'm1_M2_private'. @@ -13,7 +14,6 @@ tests/cases/compiler/privacyGloImportParseErrors.ts(125,45): error TS1147: Impor tests/cases/compiler/privacyGloImportParseErrors.ts(133,9): error TS1038: A 'declare' modifier cannot be used in an already ambient context. tests/cases/compiler/privacyGloImportParseErrors.ts(133,24): error TS2435: Ambient modules cannot be nested in other modules or namespaces. tests/cases/compiler/privacyGloImportParseErrors.ts(138,16): error TS2435: Ambient modules cannot be nested in other modules or namespaces. -tests/cases/compiler/privacyGloImportParseErrors.ts(141,12): error TS2435: Ambient modules cannot be nested in other modules or namespaces. tests/cases/compiler/privacyGloImportParseErrors.ts(146,25): error TS1147: Import declarations in a namespace cannot reference a module. tests/cases/compiler/privacyGloImportParseErrors.ts(149,29): error TS1147: Import declarations in a namespace cannot reference a module. @@ -41,6 +41,8 @@ tests/cases/compiler/privacyGloImportParseErrors.ts(149,29): error TS1147: Impor } export declare module "m1_M3_public" { + ~~~~~~ +!!! error TS2668: 'export' modifier cannot be applied to ambient modules and module augmentations since they are always visible. ~~~~~~~~~~~~~~ !!! error TS2435: Ambient modules cannot be nested in other modules or namespaces. export function f1(); @@ -190,8 +192,6 @@ tests/cases/compiler/privacyGloImportParseErrors.ts(149,29): error TS1147: Impor } } module "abc3" { - ~~~~~~ -!!! error TS2435: Ambient modules cannot be nested in other modules or namespaces. } } diff --git a/tests/baselines/reference/privacyGloInterface.symbols b/tests/baselines/reference/privacyGloInterface.symbols index 561025ee6dc..da8db47856a 100644 --- a/tests/baselines/reference/privacyGloInterface.symbols +++ b/tests/baselines/reference/privacyGloInterface.symbols @@ -6,7 +6,7 @@ module m1 { >C1_public : Symbol(C1_public, Decl(privacyGloInterface.ts, 0, 11)) private f1() { ->f1 : Symbol(f1, Decl(privacyGloInterface.ts, 1, 28)) +>f1 : Symbol(C1_public.f1, Decl(privacyGloInterface.ts, 1, 28)) } } @@ -57,37 +57,37 @@ module m1 { >C2_private : Symbol(C2_private, Decl(privacyGloInterface.ts, 4, 5)) x: C1_public; ->x : Symbol(x, Decl(privacyGloInterface.ts, 22, 32)) +>x : Symbol(C3_public.x, Decl(privacyGloInterface.ts, 22, 32)) >C1_public : Symbol(C1_public, Decl(privacyGloInterface.ts, 0, 11)) y: C2_private; ->y : Symbol(y, Decl(privacyGloInterface.ts, 24, 21)) +>y : Symbol(C3_public.y, Decl(privacyGloInterface.ts, 24, 21)) >C2_private : Symbol(C2_private, Decl(privacyGloInterface.ts, 4, 5)) a?: C1_public; ->a : Symbol(a, Decl(privacyGloInterface.ts, 25, 22)) +>a : Symbol(C3_public.a, Decl(privacyGloInterface.ts, 25, 22)) >C1_public : Symbol(C1_public, Decl(privacyGloInterface.ts, 0, 11)) b?: C2_private; ->b : Symbol(b, Decl(privacyGloInterface.ts, 27, 22)) +>b : Symbol(C3_public.b, Decl(privacyGloInterface.ts, 27, 22)) >C2_private : Symbol(C2_private, Decl(privacyGloInterface.ts, 4, 5)) f1(a1: C1_public); ->f1 : Symbol(f1, Decl(privacyGloInterface.ts, 28, 23)) +>f1 : Symbol(C3_public.f1, Decl(privacyGloInterface.ts, 28, 23)) >a1 : Symbol(a1, Decl(privacyGloInterface.ts, 30, 11)) >C1_public : Symbol(C1_public, Decl(privacyGloInterface.ts, 0, 11)) f2(a1: C2_private); ->f2 : Symbol(f2, Decl(privacyGloInterface.ts, 30, 26)) +>f2 : Symbol(C3_public.f2, Decl(privacyGloInterface.ts, 30, 26)) >a1 : Symbol(a1, Decl(privacyGloInterface.ts, 31, 11)) >C2_private : Symbol(C2_private, Decl(privacyGloInterface.ts, 4, 5)) f3(): C1_public; ->f3 : Symbol(f3, Decl(privacyGloInterface.ts, 31, 27)) +>f3 : Symbol(C3_public.f3, Decl(privacyGloInterface.ts, 31, 27)) >C1_public : Symbol(C1_public, Decl(privacyGloInterface.ts, 0, 11)) f4(): C2_private; ->f4 : Symbol(f4, Decl(privacyGloInterface.ts, 32, 24)) +>f4 : Symbol(C3_public.f4, Decl(privacyGloInterface.ts, 32, 24)) >C2_private : Symbol(C2_private, Decl(privacyGloInterface.ts, 4, 5)) } @@ -134,37 +134,37 @@ module m1 { >C2_private : Symbol(C2_private, Decl(privacyGloInterface.ts, 4, 5)) x: C1_public; ->x : Symbol(x, Decl(privacyGloInterface.ts, 49, 32)) +>x : Symbol(C4_private.x, Decl(privacyGloInterface.ts, 49, 32)) >C1_public : Symbol(C1_public, Decl(privacyGloInterface.ts, 0, 11)) y: C2_private; ->y : Symbol(y, Decl(privacyGloInterface.ts, 51, 21)) +>y : Symbol(C4_private.y, Decl(privacyGloInterface.ts, 51, 21)) >C2_private : Symbol(C2_private, Decl(privacyGloInterface.ts, 4, 5)) a?: C1_public; ->a : Symbol(a, Decl(privacyGloInterface.ts, 52, 22)) +>a : Symbol(C4_private.a, Decl(privacyGloInterface.ts, 52, 22)) >C1_public : Symbol(C1_public, Decl(privacyGloInterface.ts, 0, 11)) b?: C2_private; ->b : Symbol(b, Decl(privacyGloInterface.ts, 54, 22)) +>b : Symbol(C4_private.b, Decl(privacyGloInterface.ts, 54, 22)) >C2_private : Symbol(C2_private, Decl(privacyGloInterface.ts, 4, 5)) f1(a1: C1_public); ->f1 : Symbol(f1, Decl(privacyGloInterface.ts, 55, 23)) +>f1 : Symbol(C4_private.f1, Decl(privacyGloInterface.ts, 55, 23)) >a1 : Symbol(a1, Decl(privacyGloInterface.ts, 57, 11)) >C1_public : Symbol(C1_public, Decl(privacyGloInterface.ts, 0, 11)) f2(a1: C2_private); ->f2 : Symbol(f2, Decl(privacyGloInterface.ts, 57, 26)) +>f2 : Symbol(C4_private.f2, Decl(privacyGloInterface.ts, 57, 26)) >a1 : Symbol(a1, Decl(privacyGloInterface.ts, 58, 11)) >C2_private : Symbol(C2_private, Decl(privacyGloInterface.ts, 4, 5)) f3(): C1_public; ->f3 : Symbol(f3, Decl(privacyGloInterface.ts, 58, 27)) +>f3 : Symbol(C4_private.f3, Decl(privacyGloInterface.ts, 58, 27)) >C1_public : Symbol(C1_public, Decl(privacyGloInterface.ts, 0, 11)) f4(): C2_private; ->f4 : Symbol(f4, Decl(privacyGloInterface.ts, 59, 24)) +>f4 : Symbol(C4_private.f4, Decl(privacyGloInterface.ts, 59, 24)) >C2_private : Symbol(C2_private, Decl(privacyGloInterface.ts, 4, 5)) } @@ -174,7 +174,7 @@ class C5_public { >C5_public : Symbol(C5_public, Decl(privacyGloInterface.ts, 63, 1)) private f1() { ->f1 : Symbol(f1, Decl(privacyGloInterface.ts, 65, 17)) +>f1 : Symbol(C5_public.f1, Decl(privacyGloInterface.ts, 65, 17)) } } @@ -201,20 +201,20 @@ interface C7_public { >C5_public : Symbol(C5_public, Decl(privacyGloInterface.ts, 63, 1)) x: C5_public; ->x : Symbol(x, Decl(privacyGloInterface.ts, 78, 27)) +>x : Symbol(C7_public.x, Decl(privacyGloInterface.ts, 78, 27)) >C5_public : Symbol(C5_public, Decl(privacyGloInterface.ts, 63, 1)) a?: C5_public; ->a : Symbol(a, Decl(privacyGloInterface.ts, 80, 17)) +>a : Symbol(C7_public.a, Decl(privacyGloInterface.ts, 80, 17)) >C5_public : Symbol(C5_public, Decl(privacyGloInterface.ts, 63, 1)) f1(a1: C5_public); ->f1 : Symbol(f1, Decl(privacyGloInterface.ts, 82, 18)) +>f1 : Symbol(C7_public.f1, Decl(privacyGloInterface.ts, 82, 18)) >a1 : Symbol(a1, Decl(privacyGloInterface.ts, 84, 7)) >C5_public : Symbol(C5_public, Decl(privacyGloInterface.ts, 63, 1)) f3(): C5_public; ->f3 : Symbol(f3, Decl(privacyGloInterface.ts, 84, 22)) +>f3 : Symbol(C7_public.f3, Decl(privacyGloInterface.ts, 84, 22)) >C5_public : Symbol(C5_public, Decl(privacyGloInterface.ts, 63, 1)) } @@ -225,14 +225,14 @@ module m3 { >m3_i_public : Symbol(m3_i_public, Decl(privacyGloInterface.ts, 88, 11)) f1(): number; ->f1 : Symbol(f1, Decl(privacyGloInterface.ts, 89, 34)) +>f1 : Symbol(m3_i_public.f1, Decl(privacyGloInterface.ts, 89, 34)) } interface m3_i_private { >m3_i_private : Symbol(m3_i_private, Decl(privacyGloInterface.ts, 91, 5)) f2(): string; ->f2 : Symbol(f2, Decl(privacyGloInterface.ts, 93, 28)) +>f2 : Symbol(m3_i_private.f2, Decl(privacyGloInterface.ts, 93, 28)) } interface m3_C1_private extends m3_i_public { @@ -268,7 +268,7 @@ interface glo_i_public { >glo_i_public : Symbol(glo_i_public, Decl(privacyGloInterface.ts, 110, 1)) f1(): number; ->f1 : Symbol(f1, Decl(privacyGloInterface.ts, 112, 24)) +>f1 : Symbol(glo_i_public.f1, Decl(privacyGloInterface.ts, 112, 24)) } interface glo_C3_public extends glo_i_public { diff --git a/tests/baselines/reference/privacyGloVar.symbols b/tests/baselines/reference/privacyGloVar.symbols index 5f08438817e..9c8a01fc9a4 100644 --- a/tests/baselines/reference/privacyGloVar.symbols +++ b/tests/baselines/reference/privacyGloVar.symbols @@ -6,7 +6,7 @@ module m1 { >C1_public : Symbol(C1_public, Decl(privacyGloVar.ts, 0, 11)) private f1() { ->f1 : Symbol(f1, Decl(privacyGloVar.ts, 1, 28)) +>f1 : Symbol(C1_public.f1, Decl(privacyGloVar.ts, 1, 28)) } } @@ -18,54 +18,54 @@ module m1 { >C3_public : Symbol(C3_public, Decl(privacyGloVar.ts, 7, 5)) private C3_v1_private: C1_public; ->C3_v1_private : Symbol(C3_v1_private, Decl(privacyGloVar.ts, 9, 28)) +>C3_v1_private : Symbol(C3_public.C3_v1_private, Decl(privacyGloVar.ts, 9, 28)) >C1_public : Symbol(C1_public, Decl(privacyGloVar.ts, 0, 11)) public C3_v2_public: C1_public; ->C3_v2_public : Symbol(C3_v2_public, Decl(privacyGloVar.ts, 10, 41)) +>C3_v2_public : Symbol(C3_public.C3_v2_public, Decl(privacyGloVar.ts, 10, 41)) >C1_public : Symbol(C1_public, Decl(privacyGloVar.ts, 0, 11)) private C3_v3_private: C2_private; ->C3_v3_private : Symbol(C3_v3_private, Decl(privacyGloVar.ts, 11, 39)) +>C3_v3_private : Symbol(C3_public.C3_v3_private, Decl(privacyGloVar.ts, 11, 39)) >C2_private : Symbol(C2_private, Decl(privacyGloVar.ts, 4, 5)) public C3_v4_public: C2_private; // error ->C3_v4_public : Symbol(C3_v4_public, Decl(privacyGloVar.ts, 12, 42)) +>C3_v4_public : Symbol(C3_public.C3_v4_public, Decl(privacyGloVar.ts, 12, 42)) >C2_private : Symbol(C2_private, Decl(privacyGloVar.ts, 4, 5)) private C3_v11_private = new C1_public(); ->C3_v11_private : Symbol(C3_v11_private, Decl(privacyGloVar.ts, 13, 40)) +>C3_v11_private : Symbol(C3_public.C3_v11_private, Decl(privacyGloVar.ts, 13, 40)) >C1_public : Symbol(C1_public, Decl(privacyGloVar.ts, 0, 11)) public C3_v12_public = new C1_public(); ->C3_v12_public : Symbol(C3_v12_public, Decl(privacyGloVar.ts, 15, 49)) +>C3_v12_public : Symbol(C3_public.C3_v12_public, Decl(privacyGloVar.ts, 15, 49)) >C1_public : Symbol(C1_public, Decl(privacyGloVar.ts, 0, 11)) private C3_v13_private = new C2_private(); ->C3_v13_private : Symbol(C3_v13_private, Decl(privacyGloVar.ts, 16, 47)) +>C3_v13_private : Symbol(C3_public.C3_v13_private, Decl(privacyGloVar.ts, 16, 47)) >C2_private : Symbol(C2_private, Decl(privacyGloVar.ts, 4, 5)) public C3_v14_public = new C2_private(); // error ->C3_v14_public : Symbol(C3_v14_public, Decl(privacyGloVar.ts, 17, 50)) +>C3_v14_public : Symbol(C3_public.C3_v14_public, Decl(privacyGloVar.ts, 17, 50)) >C2_private : Symbol(C2_private, Decl(privacyGloVar.ts, 4, 5)) private C3_v21_private: C1_public = new C1_public(); ->C3_v21_private : Symbol(C3_v21_private, Decl(privacyGloVar.ts, 18, 48)) +>C3_v21_private : Symbol(C3_public.C3_v21_private, Decl(privacyGloVar.ts, 18, 48)) >C1_public : Symbol(C1_public, Decl(privacyGloVar.ts, 0, 11)) >C1_public : Symbol(C1_public, Decl(privacyGloVar.ts, 0, 11)) public C3_v22_public: C1_public = new C1_public(); ->C3_v22_public : Symbol(C3_v22_public, Decl(privacyGloVar.ts, 20, 60)) +>C3_v22_public : Symbol(C3_public.C3_v22_public, Decl(privacyGloVar.ts, 20, 60)) >C1_public : Symbol(C1_public, Decl(privacyGloVar.ts, 0, 11)) >C1_public : Symbol(C1_public, Decl(privacyGloVar.ts, 0, 11)) private C3_v23_private: C2_private = new C2_private(); ->C3_v23_private : Symbol(C3_v23_private, Decl(privacyGloVar.ts, 21, 58)) +>C3_v23_private : Symbol(C3_public.C3_v23_private, Decl(privacyGloVar.ts, 21, 58)) >C2_private : Symbol(C2_private, Decl(privacyGloVar.ts, 4, 5)) >C2_private : Symbol(C2_private, Decl(privacyGloVar.ts, 4, 5)) public C3_v24_public: C2_private = new C2_private(); // error ->C3_v24_public : Symbol(C3_v24_public, Decl(privacyGloVar.ts, 22, 62)) +>C3_v24_public : Symbol(C3_public.C3_v24_public, Decl(privacyGloVar.ts, 22, 62)) >C2_private : Symbol(C2_private, Decl(privacyGloVar.ts, 4, 5)) >C2_private : Symbol(C2_private, Decl(privacyGloVar.ts, 4, 5)) } @@ -74,54 +74,54 @@ module m1 { >C4_public : Symbol(C4_public, Decl(privacyGloVar.ts, 24, 5)) private C4_v1_private: C1_public; ->C4_v1_private : Symbol(C4_v1_private, Decl(privacyGloVar.ts, 26, 21)) +>C4_v1_private : Symbol(C4_public.C4_v1_private, Decl(privacyGloVar.ts, 26, 21)) >C1_public : Symbol(C1_public, Decl(privacyGloVar.ts, 0, 11)) public C4_v2_public: C1_public; ->C4_v2_public : Symbol(C4_v2_public, Decl(privacyGloVar.ts, 27, 41)) +>C4_v2_public : Symbol(C4_public.C4_v2_public, Decl(privacyGloVar.ts, 27, 41)) >C1_public : Symbol(C1_public, Decl(privacyGloVar.ts, 0, 11)) private C4_v3_private: C2_private; ->C4_v3_private : Symbol(C4_v3_private, Decl(privacyGloVar.ts, 28, 39)) +>C4_v3_private : Symbol(C4_public.C4_v3_private, Decl(privacyGloVar.ts, 28, 39)) >C2_private : Symbol(C2_private, Decl(privacyGloVar.ts, 4, 5)) public C4_v4_public: C2_private; ->C4_v4_public : Symbol(C4_v4_public, Decl(privacyGloVar.ts, 29, 42)) +>C4_v4_public : Symbol(C4_public.C4_v4_public, Decl(privacyGloVar.ts, 29, 42)) >C2_private : Symbol(C2_private, Decl(privacyGloVar.ts, 4, 5)) private C4_v11_private = new C1_public(); ->C4_v11_private : Symbol(C4_v11_private, Decl(privacyGloVar.ts, 30, 40)) +>C4_v11_private : Symbol(C4_public.C4_v11_private, Decl(privacyGloVar.ts, 30, 40)) >C1_public : Symbol(C1_public, Decl(privacyGloVar.ts, 0, 11)) public C4_v12_public = new C1_public(); ->C4_v12_public : Symbol(C4_v12_public, Decl(privacyGloVar.ts, 32, 49)) +>C4_v12_public : Symbol(C4_public.C4_v12_public, Decl(privacyGloVar.ts, 32, 49)) >C1_public : Symbol(C1_public, Decl(privacyGloVar.ts, 0, 11)) private C4_v13_private = new C2_private(); ->C4_v13_private : Symbol(C4_v13_private, Decl(privacyGloVar.ts, 33, 47)) +>C4_v13_private : Symbol(C4_public.C4_v13_private, Decl(privacyGloVar.ts, 33, 47)) >C2_private : Symbol(C2_private, Decl(privacyGloVar.ts, 4, 5)) public C4_v14_public = new C2_private(); ->C4_v14_public : Symbol(C4_v14_public, Decl(privacyGloVar.ts, 34, 50)) +>C4_v14_public : Symbol(C4_public.C4_v14_public, Decl(privacyGloVar.ts, 34, 50)) >C2_private : Symbol(C2_private, Decl(privacyGloVar.ts, 4, 5)) private C4_v21_private: C1_public = new C1_public(); ->C4_v21_private : Symbol(C4_v21_private, Decl(privacyGloVar.ts, 35, 48)) +>C4_v21_private : Symbol(C4_public.C4_v21_private, Decl(privacyGloVar.ts, 35, 48)) >C1_public : Symbol(C1_public, Decl(privacyGloVar.ts, 0, 11)) >C1_public : Symbol(C1_public, Decl(privacyGloVar.ts, 0, 11)) public C4_v22_public: C1_public = new C1_public(); ->C4_v22_public : Symbol(C4_v22_public, Decl(privacyGloVar.ts, 37, 60)) +>C4_v22_public : Symbol(C4_public.C4_v22_public, Decl(privacyGloVar.ts, 37, 60)) >C1_public : Symbol(C1_public, Decl(privacyGloVar.ts, 0, 11)) >C1_public : Symbol(C1_public, Decl(privacyGloVar.ts, 0, 11)) private C4_v23_private: C2_private = new C2_private(); ->C4_v23_private : Symbol(C4_v23_private, Decl(privacyGloVar.ts, 38, 58)) +>C4_v23_private : Symbol(C4_public.C4_v23_private, Decl(privacyGloVar.ts, 38, 58)) >C2_private : Symbol(C2_private, Decl(privacyGloVar.ts, 4, 5)) >C2_private : Symbol(C2_private, Decl(privacyGloVar.ts, 4, 5)) public C4_v24_public: C2_private = new C2_private(); ->C4_v24_public : Symbol(C4_v24_public, Decl(privacyGloVar.ts, 39, 62)) +>C4_v24_public : Symbol(C4_public.C4_v24_public, Decl(privacyGloVar.ts, 39, 62)) >C2_private : Symbol(C2_private, Decl(privacyGloVar.ts, 4, 5)) >C2_private : Symbol(C2_private, Decl(privacyGloVar.ts, 4, 5)) } @@ -183,7 +183,7 @@ class glo_C1_public { >glo_C1_public : Symbol(glo_C1_public, Decl(privacyGloVar.ts, 57, 1)) private f1() { ->f1 : Symbol(f1, Decl(privacyGloVar.ts, 59, 21)) +>f1 : Symbol(glo_C1_public.f1, Decl(privacyGloVar.ts, 59, 21)) } } @@ -191,28 +191,28 @@ class glo_C3_public { >glo_C3_public : Symbol(glo_C3_public, Decl(privacyGloVar.ts, 62, 1)) private glo_C3_v1_private: glo_C1_public; ->glo_C3_v1_private : Symbol(glo_C3_v1_private, Decl(privacyGloVar.ts, 64, 21)) +>glo_C3_v1_private : Symbol(glo_C3_public.glo_C3_v1_private, Decl(privacyGloVar.ts, 64, 21)) >glo_C1_public : Symbol(glo_C1_public, Decl(privacyGloVar.ts, 57, 1)) public glo_C3_v2_public: glo_C1_public; ->glo_C3_v2_public : Symbol(glo_C3_v2_public, Decl(privacyGloVar.ts, 65, 45)) +>glo_C3_v2_public : Symbol(glo_C3_public.glo_C3_v2_public, Decl(privacyGloVar.ts, 65, 45)) >glo_C1_public : Symbol(glo_C1_public, Decl(privacyGloVar.ts, 57, 1)) private glo_C3_v11_private = new glo_C1_public(); ->glo_C3_v11_private : Symbol(glo_C3_v11_private, Decl(privacyGloVar.ts, 66, 43)) +>glo_C3_v11_private : Symbol(glo_C3_public.glo_C3_v11_private, Decl(privacyGloVar.ts, 66, 43)) >glo_C1_public : Symbol(glo_C1_public, Decl(privacyGloVar.ts, 57, 1)) public glo_C3_v12_public = new glo_C1_public(); ->glo_C3_v12_public : Symbol(glo_C3_v12_public, Decl(privacyGloVar.ts, 68, 53)) +>glo_C3_v12_public : Symbol(glo_C3_public.glo_C3_v12_public, Decl(privacyGloVar.ts, 68, 53)) >glo_C1_public : Symbol(glo_C1_public, Decl(privacyGloVar.ts, 57, 1)) private glo_C3_v21_private: glo_C1_public = new glo_C1_public(); ->glo_C3_v21_private : Symbol(glo_C3_v21_private, Decl(privacyGloVar.ts, 69, 51)) +>glo_C3_v21_private : Symbol(glo_C3_public.glo_C3_v21_private, Decl(privacyGloVar.ts, 69, 51)) >glo_C1_public : Symbol(glo_C1_public, Decl(privacyGloVar.ts, 57, 1)) >glo_C1_public : Symbol(glo_C1_public, Decl(privacyGloVar.ts, 57, 1)) public glo_C3_v22_public: glo_C1_public = new glo_C1_public(); ->glo_C3_v22_public : Symbol(glo_C3_v22_public, Decl(privacyGloVar.ts, 71, 68)) +>glo_C3_v22_public : Symbol(glo_C3_public.glo_C3_v22_public, Decl(privacyGloVar.ts, 71, 68)) >glo_C1_public : Symbol(glo_C1_public, Decl(privacyGloVar.ts, 57, 1)) >glo_C1_public : Symbol(glo_C1_public, Decl(privacyGloVar.ts, 57, 1)) } diff --git a/tests/baselines/reference/privacyImportParseErrors.errors.txt b/tests/baselines/reference/privacyImportParseErrors.errors.txt index 5bae45f405c..1826ac7226a 100644 --- a/tests/baselines/reference/privacyImportParseErrors.errors.txt +++ b/tests/baselines/reference/privacyImportParseErrors.errors.txt @@ -1,3 +1,4 @@ +tests/cases/compiler/privacyImportParseErrors.ts(22,5): error TS2668: 'export' modifier cannot be applied to ambient modules and module augmentations since they are always visible. tests/cases/compiler/privacyImportParseErrors.ts(22,27): error TS2435: Ambient modules cannot be nested in other modules or namespaces. tests/cases/compiler/privacyImportParseErrors.ts(30,20): error TS2435: Ambient modules cannot be nested in other modules or namespaces. tests/cases/compiler/privacyImportParseErrors.ts(59,37): error TS1147: Import declarations in a namespace cannot reference a module. @@ -6,6 +7,7 @@ tests/cases/compiler/privacyImportParseErrors.ts(69,37): error TS1147: Import de tests/cases/compiler/privacyImportParseErrors.ts(69,37): error TS2307: Cannot find module 'm1_M4_private'. tests/cases/compiler/privacyImportParseErrors.ts(81,43): error TS1147: Import declarations in a namespace cannot reference a module. tests/cases/compiler/privacyImportParseErrors.ts(82,43): error TS1147: Import declarations in a namespace cannot reference a module. +tests/cases/compiler/privacyImportParseErrors.ts(106,5): error TS2668: 'export' modifier cannot be applied to ambient modules and module augmentations since they are always visible. tests/cases/compiler/privacyImportParseErrors.ts(106,27): error TS2435: Ambient modules cannot be nested in other modules or namespaces. tests/cases/compiler/privacyImportParseErrors.ts(114,20): error TS2435: Ambient modules cannot be nested in other modules or namespaces. tests/cases/compiler/privacyImportParseErrors.ts(143,37): error TS1147: Import declarations in a namespace cannot reference a module. @@ -14,31 +16,35 @@ tests/cases/compiler/privacyImportParseErrors.ts(153,37): error TS1147: Import d tests/cases/compiler/privacyImportParseErrors.ts(153,37): error TS2307: Cannot find module 'm2_M4_private'. tests/cases/compiler/privacyImportParseErrors.ts(166,43): error TS1147: Import declarations in a namespace cannot reference a module. tests/cases/compiler/privacyImportParseErrors.ts(167,43): error TS1147: Import declarations in a namespace cannot reference a module. -tests/cases/compiler/privacyImportParseErrors.ts(180,23): error TS2435: Ambient modules cannot be nested in other modules or namespaces. -tests/cases/compiler/privacyImportParseErrors.ts(198,23): error TS2435: Ambient modules cannot be nested in other modules or namespaces. +tests/cases/compiler/privacyImportParseErrors.ts(180,1): error TS2668: 'export' modifier cannot be applied to ambient modules and module augmentations since they are always visible. +tests/cases/compiler/privacyImportParseErrors.ts(180,23): error TS2664: Invalid module name in augmentation, module 'glo_M2_public' cannot be found. +tests/cases/compiler/privacyImportParseErrors.ts(198,1): error TS2668: 'export' modifier cannot be applied to ambient modules and module augmentations since they are always visible. +tests/cases/compiler/privacyImportParseErrors.ts(198,23): error TS2664: Invalid module name in augmentation, module 'glo_M4_private' cannot be found. tests/cases/compiler/privacyImportParseErrors.ts(218,34): error TS2307: Cannot find module 'glo_M2_public'. tests/cases/compiler/privacyImportParseErrors.ts(238,34): error TS2307: Cannot find module 'glo_M4_private'. tests/cases/compiler/privacyImportParseErrors.ts(251,40): error TS2307: Cannot find module 'glo_M2_public'. tests/cases/compiler/privacyImportParseErrors.ts(252,40): error TS2307: Cannot find module 'glo_M4_private'. -tests/cases/compiler/privacyImportParseErrors.ts(255,23): error TS2435: Ambient modules cannot be nested in other modules or namespaces. +tests/cases/compiler/privacyImportParseErrors.ts(255,1): error TS2668: 'export' modifier cannot be applied to ambient modules and module augmentations since they are always visible. +tests/cases/compiler/privacyImportParseErrors.ts(255,23): error TS2664: Invalid module name in augmentation, module 'use_glo_M1_public' cannot be found. tests/cases/compiler/privacyImportParseErrors.ts(258,45): error TS2304: Cannot find name 'use_glo_M1_public'. tests/cases/compiler/privacyImportParseErrors.ts(261,39): error TS2304: Cannot find name 'use_glo_M1_public'. tests/cases/compiler/privacyImportParseErrors.ts(264,40): error TS2307: Cannot find module 'glo_M2_public'. tests/cases/compiler/privacyImportParseErrors.ts(273,38): error TS1147: Import declarations in a namespace cannot reference a module. tests/cases/compiler/privacyImportParseErrors.ts(277,45): error TS1147: Import declarations in a namespace cannot reference a module. -tests/cases/compiler/privacyImportParseErrors.ts(284,16): error TS2435: Ambient modules cannot be nested in other modules or namespaces. +tests/cases/compiler/privacyImportParseErrors.ts(284,16): error TS2664: Invalid module name in augmentation, module 'use_glo_M3_private' cannot be found. tests/cases/compiler/privacyImportParseErrors.ts(287,46): error TS2304: Cannot find name 'use_glo_M3_private'. tests/cases/compiler/privacyImportParseErrors.ts(290,40): error TS2304: Cannot find name 'use_glo_M3_private'. tests/cases/compiler/privacyImportParseErrors.ts(293,41): error TS2307: Cannot find module 'glo_M4_private'. tests/cases/compiler/privacyImportParseErrors.ts(302,38): error TS1147: Import declarations in a namespace cannot reference a module. tests/cases/compiler/privacyImportParseErrors.ts(306,45): error TS1147: Import declarations in a namespace cannot reference a module. -tests/cases/compiler/privacyImportParseErrors.ts(312,16): error TS2435: Ambient modules cannot be nested in other modules or namespaces. +tests/cases/compiler/privacyImportParseErrors.ts(312,16): error TS2664: Invalid module name in augmentation, module 'anotherParseError' cannot be found. tests/cases/compiler/privacyImportParseErrors.ts(314,9): error TS1038: A 'declare' modifier cannot be used in an already ambient context. tests/cases/compiler/privacyImportParseErrors.ts(314,24): error TS2435: Ambient modules cannot be nested in other modules or namespaces. tests/cases/compiler/privacyImportParseErrors.ts(319,16): error TS2435: Ambient modules cannot be nested in other modules or namespaces. tests/cases/compiler/privacyImportParseErrors.ts(322,12): error TS2435: Ambient modules cannot be nested in other modules or namespaces. +tests/cases/compiler/privacyImportParseErrors.ts(326,1): error TS2668: 'export' modifier cannot be applied to ambient modules and module augmentations since they are always visible. tests/cases/compiler/privacyImportParseErrors.ts(326,9): error TS1029: 'export' modifier must precede 'declare' modifier. -tests/cases/compiler/privacyImportParseErrors.ts(326,23): error TS2435: Ambient modules cannot be nested in other modules or namespaces. +tests/cases/compiler/privacyImportParseErrors.ts(326,23): error TS2664: Invalid module name in augmentation, module 'anotherParseError2' cannot be found. tests/cases/compiler/privacyImportParseErrors.ts(328,9): error TS1038: A 'declare' modifier cannot be used in an already ambient context. tests/cases/compiler/privacyImportParseErrors.ts(328,24): error TS2435: Ambient modules cannot be nested in other modules or namespaces. tests/cases/compiler/privacyImportParseErrors.ts(333,16): error TS2435: Ambient modules cannot be nested in other modules or namespaces. @@ -49,7 +55,7 @@ tests/cases/compiler/privacyImportParseErrors.ts(350,25): error TS1147: Import d tests/cases/compiler/privacyImportParseErrors.ts(353,29): error TS1147: Import declarations in a namespace cannot reference a module. -==== tests/cases/compiler/privacyImportParseErrors.ts (49 errors) ==== +==== tests/cases/compiler/privacyImportParseErrors.ts (55 errors) ==== export module m1 { export module m1_M1_public { export class c1 { @@ -72,6 +78,8 @@ tests/cases/compiler/privacyImportParseErrors.ts(353,29): error TS1147: Import d } export declare module "m1_M3_public" { + ~~~~~~ +!!! error TS2668: 'export' modifier cannot be applied to ambient modules and module augmentations since they are always visible. ~~~~~~~~~~~~~~ !!! error TS2435: Ambient modules cannot be nested in other modules or namespaces. export function f1(); @@ -172,6 +180,8 @@ tests/cases/compiler/privacyImportParseErrors.ts(353,29): error TS1147: Import d } export declare module "m2_M3_public" { + ~~~~~~ +!!! error TS2668: 'export' modifier cannot be applied to ambient modules and module augmentations since they are always visible. ~~~~~~~~~~~~~~ !!! error TS2435: Ambient modules cannot be nested in other modules or namespaces. export function f1(); @@ -262,8 +272,10 @@ tests/cases/compiler/privacyImportParseErrors.ts(353,29): error TS1147: Import d } export declare module "glo_M2_public" { + ~~~~~~ +!!! error TS2668: 'export' modifier cannot be applied to ambient modules and module augmentations since they are always visible. ~~~~~~~~~~~~~~~ -!!! error TS2435: Ambient modules cannot be nested in other modules or namespaces. +!!! error TS2664: Invalid module name in augmentation, module 'glo_M2_public' cannot be found. export function f1(); export class c1 { } @@ -282,8 +294,10 @@ tests/cases/compiler/privacyImportParseErrors.ts(353,29): error TS1147: Import d } export declare module "glo_M4_private" { + ~~~~~~ +!!! error TS2668: 'export' modifier cannot be applied to ambient modules and module augmentations since they are always visible. ~~~~~~~~~~~~~~~~ -!!! error TS2435: Ambient modules cannot be nested in other modules or namespaces. +!!! error TS2664: Invalid module name in augmentation, module 'glo_M4_private' cannot be found. export function f1(); export class c1 { } @@ -349,8 +363,10 @@ tests/cases/compiler/privacyImportParseErrors.ts(353,29): error TS1147: Import d export declare module "use_glo_M1_public" { + ~~~~~~ +!!! error TS2668: 'export' modifier cannot be applied to ambient modules and module augmentations since they are always visible. ~~~~~~~~~~~~~~~~~~~ -!!! error TS2435: Ambient modules cannot be nested in other modules or namespaces. +!!! error TS2664: Invalid module name in augmentation, module 'use_glo_M1_public' cannot be found. import use_glo_M1_public = glo_M1_public; export var use_glo_M1_public_v1_public: { new (): use_glo_M1_public.c1; }; export var use_glo_M1_public_v2_public: use_glo_M1_public; @@ -391,7 +407,7 @@ tests/cases/compiler/privacyImportParseErrors.ts(353,29): error TS1147: Import d declare module "use_glo_M3_private" { ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2435: Ambient modules cannot be nested in other modules or namespaces. +!!! error TS2664: Invalid module name in augmentation, module 'use_glo_M3_private' cannot be found. import use_glo_M3_private = glo_M3_private; export var use_glo_M3_private_v1_public: { new (): use_glo_M3_private.c1; }; export var use_glo_M3_private_v2_public: use_glo_M3_private; @@ -431,7 +447,7 @@ tests/cases/compiler/privacyImportParseErrors.ts(353,29): error TS1147: Import d declare module "anotherParseError" { ~~~~~~~~~~~~~~~~~~~ -!!! error TS2435: Ambient modules cannot be nested in other modules or namespaces. +!!! error TS2664: Invalid module name in augmentation, module 'anotherParseError' cannot be found. module m2 { declare module "abc" { ~~~~~~~ @@ -454,10 +470,12 @@ tests/cases/compiler/privacyImportParseErrors.ts(353,29): error TS1147: Import d } declare export module "anotherParseError2" { + ~~~~~~~ +!!! error TS2668: 'export' modifier cannot be applied to ambient modules and module augmentations since they are always visible. ~~~~~~ !!! error TS1029: 'export' modifier must precede 'declare' modifier. ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2435: Ambient modules cannot be nested in other modules or namespaces. +!!! error TS2664: Invalid module name in augmentation, module 'anotherParseError2' cannot be found. module m2 { declare module "abc" { ~~~~~~~ diff --git a/tests/baselines/reference/privacyImportParseErrors.js b/tests/baselines/reference/privacyImportParseErrors.js index 25d96b6156e..369f9f109af 100644 --- a/tests/baselines/reference/privacyImportParseErrors.js +++ b/tests/baselines/reference/privacyImportParseErrors.js @@ -560,6 +560,8 @@ var glo_im4_private_v4_private = glo_im4_private.f1(); // Parse error to export module exports.glo_im1_public = glo_M1_public; exports.glo_im2_public = glo_M3_private; +exports.glo_im3_public = require("glo_M2_public"); +exports.glo_im4_public = require("glo_M4_private"); var m2; (function (m2_1) { var m4; diff --git a/tests/baselines/reference/privacyInterface.symbols b/tests/baselines/reference/privacyInterface.symbols index f7556aceae2..d5dbe3c1b62 100644 --- a/tests/baselines/reference/privacyInterface.symbols +++ b/tests/baselines/reference/privacyInterface.symbols @@ -6,7 +6,7 @@ export module m1 { >C1_public : Symbol(C1_public, Decl(privacyInterface.ts, 0, 18)) private f1() { ->f1 : Symbol(f1, Decl(privacyInterface.ts, 1, 28)) +>f1 : Symbol(C1_public.f1, Decl(privacyInterface.ts, 1, 28)) } } @@ -57,37 +57,37 @@ export module m1 { >C2_private : Symbol(C2_private, Decl(privacyInterface.ts, 4, 5)) x: C1_public; ->x : Symbol(x, Decl(privacyInterface.ts, 22, 32)) +>x : Symbol(C3_public.x, Decl(privacyInterface.ts, 22, 32)) >C1_public : Symbol(C1_public, Decl(privacyInterface.ts, 0, 18)) y: C2_private; ->y : Symbol(y, Decl(privacyInterface.ts, 24, 21)) +>y : Symbol(C3_public.y, Decl(privacyInterface.ts, 24, 21)) >C2_private : Symbol(C2_private, Decl(privacyInterface.ts, 4, 5)) a?: C1_public; ->a : Symbol(a, Decl(privacyInterface.ts, 25, 22)) +>a : Symbol(C3_public.a, Decl(privacyInterface.ts, 25, 22)) >C1_public : Symbol(C1_public, Decl(privacyInterface.ts, 0, 18)) b?: C2_private; ->b : Symbol(b, Decl(privacyInterface.ts, 27, 22)) +>b : Symbol(C3_public.b, Decl(privacyInterface.ts, 27, 22)) >C2_private : Symbol(C2_private, Decl(privacyInterface.ts, 4, 5)) f1(a1: C1_public); ->f1 : Symbol(f1, Decl(privacyInterface.ts, 28, 23)) +>f1 : Symbol(C3_public.f1, Decl(privacyInterface.ts, 28, 23)) >a1 : Symbol(a1, Decl(privacyInterface.ts, 30, 11)) >C1_public : Symbol(C1_public, Decl(privacyInterface.ts, 0, 18)) f2(a1: C2_private); ->f2 : Symbol(f2, Decl(privacyInterface.ts, 30, 26)) +>f2 : Symbol(C3_public.f2, Decl(privacyInterface.ts, 30, 26)) >a1 : Symbol(a1, Decl(privacyInterface.ts, 31, 11)) >C2_private : Symbol(C2_private, Decl(privacyInterface.ts, 4, 5)) f3(): C1_public; ->f3 : Symbol(f3, Decl(privacyInterface.ts, 31, 27)) +>f3 : Symbol(C3_public.f3, Decl(privacyInterface.ts, 31, 27)) >C1_public : Symbol(C1_public, Decl(privacyInterface.ts, 0, 18)) f4(): C2_private; ->f4 : Symbol(f4, Decl(privacyInterface.ts, 32, 24)) +>f4 : Symbol(C3_public.f4, Decl(privacyInterface.ts, 32, 24)) >C2_private : Symbol(C2_private, Decl(privacyInterface.ts, 4, 5)) } @@ -134,37 +134,37 @@ export module m1 { >C2_private : Symbol(C2_private, Decl(privacyInterface.ts, 4, 5)) x: C1_public; ->x : Symbol(x, Decl(privacyInterface.ts, 49, 32)) +>x : Symbol(C4_private.x, Decl(privacyInterface.ts, 49, 32)) >C1_public : Symbol(C1_public, Decl(privacyInterface.ts, 0, 18)) y: C2_private; ->y : Symbol(y, Decl(privacyInterface.ts, 51, 21)) +>y : Symbol(C4_private.y, Decl(privacyInterface.ts, 51, 21)) >C2_private : Symbol(C2_private, Decl(privacyInterface.ts, 4, 5)) a?: C1_public; ->a : Symbol(a, Decl(privacyInterface.ts, 52, 22)) +>a : Symbol(C4_private.a, Decl(privacyInterface.ts, 52, 22)) >C1_public : Symbol(C1_public, Decl(privacyInterface.ts, 0, 18)) b?: C2_private; ->b : Symbol(b, Decl(privacyInterface.ts, 54, 22)) +>b : Symbol(C4_private.b, Decl(privacyInterface.ts, 54, 22)) >C2_private : Symbol(C2_private, Decl(privacyInterface.ts, 4, 5)) f1(a1: C1_public); ->f1 : Symbol(f1, Decl(privacyInterface.ts, 55, 23)) +>f1 : Symbol(C4_private.f1, Decl(privacyInterface.ts, 55, 23)) >a1 : Symbol(a1, Decl(privacyInterface.ts, 57, 11)) >C1_public : Symbol(C1_public, Decl(privacyInterface.ts, 0, 18)) f2(a1: C2_private); ->f2 : Symbol(f2, Decl(privacyInterface.ts, 57, 26)) +>f2 : Symbol(C4_private.f2, Decl(privacyInterface.ts, 57, 26)) >a1 : Symbol(a1, Decl(privacyInterface.ts, 58, 11)) >C2_private : Symbol(C2_private, Decl(privacyInterface.ts, 4, 5)) f3(): C1_public; ->f3 : Symbol(f3, Decl(privacyInterface.ts, 58, 27)) +>f3 : Symbol(C4_private.f3, Decl(privacyInterface.ts, 58, 27)) >C1_public : Symbol(C1_public, Decl(privacyInterface.ts, 0, 18)) f4(): C2_private; ->f4 : Symbol(f4, Decl(privacyInterface.ts, 59, 24)) +>f4 : Symbol(C4_private.f4, Decl(privacyInterface.ts, 59, 24)) >C2_private : Symbol(C2_private, Decl(privacyInterface.ts, 4, 5)) } @@ -178,7 +178,7 @@ module m2 { >C1_public : Symbol(C1_public, Decl(privacyInterface.ts, 66, 11)) private f1() { ->f1 : Symbol(f1, Decl(privacyInterface.ts, 67, 28)) +>f1 : Symbol(C1_public.f1, Decl(privacyInterface.ts, 67, 28)) } } @@ -229,37 +229,37 @@ module m2 { >C2_private : Symbol(C2_private, Decl(privacyInterface.ts, 70, 5)) x: C1_public; ->x : Symbol(x, Decl(privacyInterface.ts, 88, 32)) +>x : Symbol(C3_public.x, Decl(privacyInterface.ts, 88, 32)) >C1_public : Symbol(C1_public, Decl(privacyInterface.ts, 66, 11)) y: C2_private; ->y : Symbol(y, Decl(privacyInterface.ts, 90, 21)) +>y : Symbol(C3_public.y, Decl(privacyInterface.ts, 90, 21)) >C2_private : Symbol(C2_private, Decl(privacyInterface.ts, 70, 5)) a?: C1_public; ->a : Symbol(a, Decl(privacyInterface.ts, 91, 22)) +>a : Symbol(C3_public.a, Decl(privacyInterface.ts, 91, 22)) >C1_public : Symbol(C1_public, Decl(privacyInterface.ts, 66, 11)) b?: C2_private; ->b : Symbol(b, Decl(privacyInterface.ts, 93, 22)) +>b : Symbol(C3_public.b, Decl(privacyInterface.ts, 93, 22)) >C2_private : Symbol(C2_private, Decl(privacyInterface.ts, 70, 5)) f1(a1: C1_public); ->f1 : Symbol(f1, Decl(privacyInterface.ts, 94, 23)) +>f1 : Symbol(C3_public.f1, Decl(privacyInterface.ts, 94, 23)) >a1 : Symbol(a1, Decl(privacyInterface.ts, 96, 11)) >C1_public : Symbol(C1_public, Decl(privacyInterface.ts, 66, 11)) f2(a1: C2_private); ->f2 : Symbol(f2, Decl(privacyInterface.ts, 96, 26)) +>f2 : Symbol(C3_public.f2, Decl(privacyInterface.ts, 96, 26)) >a1 : Symbol(a1, Decl(privacyInterface.ts, 97, 11)) >C2_private : Symbol(C2_private, Decl(privacyInterface.ts, 70, 5)) f3(): C1_public; ->f3 : Symbol(f3, Decl(privacyInterface.ts, 97, 27)) +>f3 : Symbol(C3_public.f3, Decl(privacyInterface.ts, 97, 27)) >C1_public : Symbol(C1_public, Decl(privacyInterface.ts, 66, 11)) f4(): C2_private; ->f4 : Symbol(f4, Decl(privacyInterface.ts, 98, 24)) +>f4 : Symbol(C3_public.f4, Decl(privacyInterface.ts, 98, 24)) >C2_private : Symbol(C2_private, Decl(privacyInterface.ts, 70, 5)) } @@ -306,37 +306,37 @@ module m2 { >C2_private : Symbol(C2_private, Decl(privacyInterface.ts, 70, 5)) x: C1_public; ->x : Symbol(x, Decl(privacyInterface.ts, 115, 32)) +>x : Symbol(C4_private.x, Decl(privacyInterface.ts, 115, 32)) >C1_public : Symbol(C1_public, Decl(privacyInterface.ts, 66, 11)) y: C2_private; ->y : Symbol(y, Decl(privacyInterface.ts, 117, 21)) +>y : Symbol(C4_private.y, Decl(privacyInterface.ts, 117, 21)) >C2_private : Symbol(C2_private, Decl(privacyInterface.ts, 70, 5)) a?: C1_public; ->a : Symbol(a, Decl(privacyInterface.ts, 118, 22)) +>a : Symbol(C4_private.a, Decl(privacyInterface.ts, 118, 22)) >C1_public : Symbol(C1_public, Decl(privacyInterface.ts, 66, 11)) b?: C2_private; ->b : Symbol(b, Decl(privacyInterface.ts, 120, 22)) +>b : Symbol(C4_private.b, Decl(privacyInterface.ts, 120, 22)) >C2_private : Symbol(C2_private, Decl(privacyInterface.ts, 70, 5)) f1(a1: C1_public); ->f1 : Symbol(f1, Decl(privacyInterface.ts, 121, 23)) +>f1 : Symbol(C4_private.f1, Decl(privacyInterface.ts, 121, 23)) >a1 : Symbol(a1, Decl(privacyInterface.ts, 123, 11)) >C1_public : Symbol(C1_public, Decl(privacyInterface.ts, 66, 11)) f2(a1: C2_private); ->f2 : Symbol(f2, Decl(privacyInterface.ts, 123, 26)) +>f2 : Symbol(C4_private.f2, Decl(privacyInterface.ts, 123, 26)) >a1 : Symbol(a1, Decl(privacyInterface.ts, 124, 11)) >C2_private : Symbol(C2_private, Decl(privacyInterface.ts, 70, 5)) f3(): C1_public; ->f3 : Symbol(f3, Decl(privacyInterface.ts, 124, 27)) +>f3 : Symbol(C4_private.f3, Decl(privacyInterface.ts, 124, 27)) >C1_public : Symbol(C1_public, Decl(privacyInterface.ts, 66, 11)) f4(): C2_private; ->f4 : Symbol(f4, Decl(privacyInterface.ts, 125, 24)) +>f4 : Symbol(C4_private.f4, Decl(privacyInterface.ts, 125, 24)) >C2_private : Symbol(C2_private, Decl(privacyInterface.ts, 70, 5)) } @@ -346,7 +346,7 @@ export class C5_public { >C5_public : Symbol(C5_public, Decl(privacyInterface.ts, 129, 1)) private f1() { ->f1 : Symbol(f1, Decl(privacyInterface.ts, 131, 24)) +>f1 : Symbol(C5_public.f1, Decl(privacyInterface.ts, 131, 24)) } } @@ -397,37 +397,37 @@ export interface C7_public { >C6_private : Symbol(C6_private, Decl(privacyInterface.ts, 134, 1)) x: C5_public; ->x : Symbol(x, Decl(privacyInterface.ts, 152, 28)) +>x : Symbol(C7_public.x, Decl(privacyInterface.ts, 152, 28)) >C5_public : Symbol(C5_public, Decl(privacyInterface.ts, 129, 1)) y: C6_private; ->y : Symbol(y, Decl(privacyInterface.ts, 154, 17)) +>y : Symbol(C7_public.y, Decl(privacyInterface.ts, 154, 17)) >C6_private : Symbol(C6_private, Decl(privacyInterface.ts, 134, 1)) a?: C5_public; ->a : Symbol(a, Decl(privacyInterface.ts, 155, 18)) +>a : Symbol(C7_public.a, Decl(privacyInterface.ts, 155, 18)) >C5_public : Symbol(C5_public, Decl(privacyInterface.ts, 129, 1)) b?: C6_private; ->b : Symbol(b, Decl(privacyInterface.ts, 157, 18)) +>b : Symbol(C7_public.b, Decl(privacyInterface.ts, 157, 18)) >C6_private : Symbol(C6_private, Decl(privacyInterface.ts, 134, 1)) f1(a1: C5_public); ->f1 : Symbol(f1, Decl(privacyInterface.ts, 158, 19)) +>f1 : Symbol(C7_public.f1, Decl(privacyInterface.ts, 158, 19)) >a1 : Symbol(a1, Decl(privacyInterface.ts, 160, 7)) >C5_public : Symbol(C5_public, Decl(privacyInterface.ts, 129, 1)) f2(a1: C6_private); ->f2 : Symbol(f2, Decl(privacyInterface.ts, 160, 22)) +>f2 : Symbol(C7_public.f2, Decl(privacyInterface.ts, 160, 22)) >a1 : Symbol(a1, Decl(privacyInterface.ts, 161, 7)) >C6_private : Symbol(C6_private, Decl(privacyInterface.ts, 134, 1)) f3(): C5_public; ->f3 : Symbol(f3, Decl(privacyInterface.ts, 161, 23)) +>f3 : Symbol(C7_public.f3, Decl(privacyInterface.ts, 161, 23)) >C5_public : Symbol(C5_public, Decl(privacyInterface.ts, 129, 1)) f4(): C6_private; ->f4 : Symbol(f4, Decl(privacyInterface.ts, 162, 20)) +>f4 : Symbol(C7_public.f4, Decl(privacyInterface.ts, 162, 20)) >C6_private : Symbol(C6_private, Decl(privacyInterface.ts, 134, 1)) } @@ -474,37 +474,37 @@ interface C8_private { >C6_private : Symbol(C6_private, Decl(privacyInterface.ts, 134, 1)) x: C5_public; ->x : Symbol(x, Decl(privacyInterface.ts, 179, 28)) +>x : Symbol(C8_private.x, Decl(privacyInterface.ts, 179, 28)) >C5_public : Symbol(C5_public, Decl(privacyInterface.ts, 129, 1)) y: C6_private; ->y : Symbol(y, Decl(privacyInterface.ts, 181, 17)) +>y : Symbol(C8_private.y, Decl(privacyInterface.ts, 181, 17)) >C6_private : Symbol(C6_private, Decl(privacyInterface.ts, 134, 1)) a?: C5_public; ->a : Symbol(a, Decl(privacyInterface.ts, 182, 18)) +>a : Symbol(C8_private.a, Decl(privacyInterface.ts, 182, 18)) >C5_public : Symbol(C5_public, Decl(privacyInterface.ts, 129, 1)) b?: C6_private; ->b : Symbol(b, Decl(privacyInterface.ts, 184, 18)) +>b : Symbol(C8_private.b, Decl(privacyInterface.ts, 184, 18)) >C6_private : Symbol(C6_private, Decl(privacyInterface.ts, 134, 1)) f1(a1: C5_public); ->f1 : Symbol(f1, Decl(privacyInterface.ts, 185, 19)) +>f1 : Symbol(C8_private.f1, Decl(privacyInterface.ts, 185, 19)) >a1 : Symbol(a1, Decl(privacyInterface.ts, 187, 7)) >C5_public : Symbol(C5_public, Decl(privacyInterface.ts, 129, 1)) f2(a1: C6_private); ->f2 : Symbol(f2, Decl(privacyInterface.ts, 187, 22)) +>f2 : Symbol(C8_private.f2, Decl(privacyInterface.ts, 187, 22)) >a1 : Symbol(a1, Decl(privacyInterface.ts, 188, 7)) >C6_private : Symbol(C6_private, Decl(privacyInterface.ts, 134, 1)) f3(): C5_public; ->f3 : Symbol(f3, Decl(privacyInterface.ts, 188, 23)) +>f3 : Symbol(C8_private.f3, Decl(privacyInterface.ts, 188, 23)) >C5_public : Symbol(C5_public, Decl(privacyInterface.ts, 129, 1)) f4(): C6_private; ->f4 : Symbol(f4, Decl(privacyInterface.ts, 189, 20)) +>f4 : Symbol(C8_private.f4, Decl(privacyInterface.ts, 189, 20)) >C6_private : Symbol(C6_private, Decl(privacyInterface.ts, 134, 1)) } @@ -516,14 +516,14 @@ export module m3 { >m3_i_public : Symbol(m3_i_public, Decl(privacyInterface.ts, 194, 18)) f1(): number; ->f1 : Symbol(f1, Decl(privacyInterface.ts, 195, 34)) +>f1 : Symbol(m3_i_public.f1, Decl(privacyInterface.ts, 195, 34)) } interface m3_i_private { >m3_i_private : Symbol(m3_i_private, Decl(privacyInterface.ts, 197, 5)) f2(): string; ->f2 : Symbol(f2, Decl(privacyInterface.ts, 199, 28)) +>f2 : Symbol(m3_i_private.f2, Decl(privacyInterface.ts, 199, 28)) } interface m3_C1_private extends m3_i_public { @@ -563,14 +563,14 @@ module m4 { >m4_i_public : Symbol(m4_i_public, Decl(privacyInterface.ts, 219, 11)) f1(): number; ->f1 : Symbol(f1, Decl(privacyInterface.ts, 220, 34)) +>f1 : Symbol(m4_i_public.f1, Decl(privacyInterface.ts, 220, 34)) } interface m4_i_private { >m4_i_private : Symbol(m4_i_private, Decl(privacyInterface.ts, 222, 5)) f2(): string; ->f2 : Symbol(f2, Decl(privacyInterface.ts, 224, 28)) +>f2 : Symbol(m4_i_private.f2, Decl(privacyInterface.ts, 224, 28)) } interface m4_C1_private extends m4_i_public { @@ -606,14 +606,14 @@ export interface glo_i_public { >glo_i_public : Symbol(glo_i_public, Decl(privacyInterface.ts, 241, 1)) f1(): number; ->f1 : Symbol(f1, Decl(privacyInterface.ts, 243, 31)) +>f1 : Symbol(glo_i_public.f1, Decl(privacyInterface.ts, 243, 31)) } interface glo_i_private { >glo_i_private : Symbol(glo_i_private, Decl(privacyInterface.ts, 245, 1)) f2(): string; ->f2 : Symbol(f2, Decl(privacyInterface.ts, 247, 25)) +>f2 : Symbol(glo_i_private.f2, Decl(privacyInterface.ts, 247, 25)) } interface glo_C1_private extends glo_i_public { diff --git a/tests/baselines/reference/privacyTypeParameterOfFunction.symbols b/tests/baselines/reference/privacyTypeParameterOfFunction.symbols index dbdb0617aab..db50f1e61a4 100644 --- a/tests/baselines/reference/privacyTypeParameterOfFunction.symbols +++ b/tests/baselines/reference/privacyTypeParameterOfFunction.symbols @@ -24,7 +24,7 @@ export interface publicInterfaceWithPrivateTypeParameters { // TypeParameter_0_of_method_from_exported_interface_has_or_is_using_private_type_1 myMethod(): privateClass; ->myMethod : Symbol(myMethod, Decl(privacyTypeParameterOfFunction.ts, 11, 45)) +>myMethod : Symbol(publicInterfaceWithPrivateTypeParameters.myMethod, Decl(privacyTypeParameterOfFunction.ts, 11, 45)) >T : Symbol(T, Decl(privacyTypeParameterOfFunction.ts, 14, 13)) >privateClass : Symbol(privateClass, Decl(privacyTypeParameterOfFunction.ts, 0, 0)) >privateClass : Symbol(privateClass, Decl(privacyTypeParameterOfFunction.ts, 0, 0)) @@ -44,7 +44,7 @@ export interface publicInterfaceWithPublicTypeParameters { >publicClass : Symbol(publicClass, Decl(privacyTypeParameterOfFunction.ts, 1, 1)) myMethod(): publicClass; ->myMethod : Symbol(myMethod, Decl(privacyTypeParameterOfFunction.ts, 19, 43)) +>myMethod : Symbol(publicInterfaceWithPublicTypeParameters.myMethod, Decl(privacyTypeParameterOfFunction.ts, 19, 43)) >T : Symbol(T, Decl(privacyTypeParameterOfFunction.ts, 20, 13)) >publicClass : Symbol(publicClass, Decl(privacyTypeParameterOfFunction.ts, 1, 1)) >publicClass : Symbol(publicClass, Decl(privacyTypeParameterOfFunction.ts, 1, 1)) @@ -64,7 +64,7 @@ interface privateInterfaceWithPrivateTypeParameters { >privateClass : Symbol(privateClass, Decl(privacyTypeParameterOfFunction.ts, 0, 0)) myMethod(): privateClass; ->myMethod : Symbol(myMethod, Decl(privacyTypeParameterOfFunction.ts, 25, 45)) +>myMethod : Symbol(privateInterfaceWithPrivateTypeParameters.myMethod, Decl(privacyTypeParameterOfFunction.ts, 25, 45)) >T : Symbol(T, Decl(privacyTypeParameterOfFunction.ts, 26, 13)) >privateClass : Symbol(privateClass, Decl(privacyTypeParameterOfFunction.ts, 0, 0)) >privateClass : Symbol(privateClass, Decl(privacyTypeParameterOfFunction.ts, 0, 0)) @@ -84,7 +84,7 @@ interface privateInterfaceWithPublicTypeParameters { >publicClass : Symbol(publicClass, Decl(privacyTypeParameterOfFunction.ts, 1, 1)) myMethod(): publicClass; ->myMethod : Symbol(myMethod, Decl(privacyTypeParameterOfFunction.ts, 31, 43)) +>myMethod : Symbol(privateInterfaceWithPublicTypeParameters.myMethod, Decl(privacyTypeParameterOfFunction.ts, 31, 43)) >T : Symbol(T, Decl(privacyTypeParameterOfFunction.ts, 32, 13)) >publicClass : Symbol(publicClass, Decl(privacyTypeParameterOfFunction.ts, 1, 1)) >publicClass : Symbol(publicClass, Decl(privacyTypeParameterOfFunction.ts, 1, 1)) @@ -106,12 +106,12 @@ export class publicClassWithWithPrivateTypeParameters { } // TypeParameter_0_of_public_method_from_exported_class_has_or_is_using_private_type_1 myPublicMethod() { ->myPublicMethod : Symbol(myPublicMethod, Decl(privacyTypeParameterOfFunction.ts, 40, 5)) +>myPublicMethod : Symbol(publicClassWithWithPrivateTypeParameters.myPublicMethod, Decl(privacyTypeParameterOfFunction.ts, 40, 5)) >T : Symbol(T, Decl(privacyTypeParameterOfFunction.ts, 42, 19)) >privateClass : Symbol(privateClass, Decl(privacyTypeParameterOfFunction.ts, 0, 0)) } private myPrivateMethod() { // No error ->myPrivateMethod : Symbol(myPrivateMethod, Decl(privacyTypeParameterOfFunction.ts, 43, 5)) +>myPrivateMethod : Symbol(publicClassWithWithPrivateTypeParameters.myPrivateMethod, Decl(privacyTypeParameterOfFunction.ts, 43, 5)) >T : Symbol(T, Decl(privacyTypeParameterOfFunction.ts, 44, 28)) >privateClass : Symbol(privateClass, Decl(privacyTypeParameterOfFunction.ts, 0, 0)) } @@ -131,12 +131,12 @@ export class publicClassWithWithPublicTypeParameters { >publicClass : Symbol(publicClass, Decl(privacyTypeParameterOfFunction.ts, 1, 1)) } myPublicMethod() { ->myPublicMethod : Symbol(myPublicMethod, Decl(privacyTypeParameterOfFunction.ts, 52, 5)) +>myPublicMethod : Symbol(publicClassWithWithPublicTypeParameters.myPublicMethod, Decl(privacyTypeParameterOfFunction.ts, 52, 5)) >T : Symbol(T, Decl(privacyTypeParameterOfFunction.ts, 53, 19)) >publicClass : Symbol(publicClass, Decl(privacyTypeParameterOfFunction.ts, 1, 1)) } private myPrivateMethod() { ->myPrivateMethod : Symbol(myPrivateMethod, Decl(privacyTypeParameterOfFunction.ts, 54, 5)) +>myPrivateMethod : Symbol(publicClassWithWithPublicTypeParameters.myPrivateMethod, Decl(privacyTypeParameterOfFunction.ts, 54, 5)) >T : Symbol(T, Decl(privacyTypeParameterOfFunction.ts, 55, 28)) >publicClass : Symbol(publicClass, Decl(privacyTypeParameterOfFunction.ts, 1, 1)) } @@ -156,12 +156,12 @@ class privateClassWithWithPrivateTypeParameters { >privateClass : Symbol(privateClass, Decl(privacyTypeParameterOfFunction.ts, 0, 0)) } myPublicMethod() { ->myPublicMethod : Symbol(myPublicMethod, Decl(privacyTypeParameterOfFunction.ts, 63, 5)) +>myPublicMethod : Symbol(privateClassWithWithPrivateTypeParameters.myPublicMethod, Decl(privacyTypeParameterOfFunction.ts, 63, 5)) >T : Symbol(T, Decl(privacyTypeParameterOfFunction.ts, 64, 19)) >privateClass : Symbol(privateClass, Decl(privacyTypeParameterOfFunction.ts, 0, 0)) } private myPrivateMethod() { // No error ->myPrivateMethod : Symbol(myPrivateMethod, Decl(privacyTypeParameterOfFunction.ts, 65, 5)) +>myPrivateMethod : Symbol(privateClassWithWithPrivateTypeParameters.myPrivateMethod, Decl(privacyTypeParameterOfFunction.ts, 65, 5)) >T : Symbol(T, Decl(privacyTypeParameterOfFunction.ts, 66, 28)) >privateClass : Symbol(privateClass, Decl(privacyTypeParameterOfFunction.ts, 0, 0)) } @@ -181,12 +181,12 @@ class privateClassWithWithPublicTypeParameters { >publicClass : Symbol(publicClass, Decl(privacyTypeParameterOfFunction.ts, 1, 1)) } myPublicMethod() { ->myPublicMethod : Symbol(myPublicMethod, Decl(privacyTypeParameterOfFunction.ts, 74, 5)) +>myPublicMethod : Symbol(privateClassWithWithPublicTypeParameters.myPublicMethod, Decl(privacyTypeParameterOfFunction.ts, 74, 5)) >T : Symbol(T, Decl(privacyTypeParameterOfFunction.ts, 75, 19)) >publicClass : Symbol(publicClass, Decl(privacyTypeParameterOfFunction.ts, 1, 1)) } private myPrivateMethod() { ->myPrivateMethod : Symbol(myPrivateMethod, Decl(privacyTypeParameterOfFunction.ts, 76, 5)) +>myPrivateMethod : Symbol(privateClassWithWithPublicTypeParameters.myPrivateMethod, Decl(privacyTypeParameterOfFunction.ts, 76, 5)) >T : Symbol(T, Decl(privacyTypeParameterOfFunction.ts, 77, 28)) >publicClass : Symbol(publicClass, Decl(privacyTypeParameterOfFunction.ts, 1, 1)) } @@ -229,7 +229,7 @@ export interface publicInterfaceWithPublicTypeParametersWithoutExtends { >publicClass : Symbol(publicClass, Decl(privacyTypeParameterOfFunction.ts, 1, 1)) myMethod(): publicClass; ->myMethod : Symbol(myMethod, Decl(privacyTypeParameterOfFunction.ts, 96, 23)) +>myMethod : Symbol(publicInterfaceWithPublicTypeParametersWithoutExtends.myMethod, Decl(privacyTypeParameterOfFunction.ts, 96, 23)) >T : Symbol(T, Decl(privacyTypeParameterOfFunction.ts, 97, 13)) >publicClass : Symbol(publicClass, Decl(privacyTypeParameterOfFunction.ts, 1, 1)) } @@ -246,7 +246,7 @@ interface privateInterfaceWithPublicTypeParametersWithoutExtends { >publicClass : Symbol(publicClass, Decl(privacyTypeParameterOfFunction.ts, 1, 1)) myMethod(): publicClass; ->myMethod : Symbol(myMethod, Decl(privacyTypeParameterOfFunction.ts, 102, 23)) +>myMethod : Symbol(privateInterfaceWithPublicTypeParametersWithoutExtends.myMethod, Decl(privacyTypeParameterOfFunction.ts, 102, 23)) >T : Symbol(T, Decl(privacyTypeParameterOfFunction.ts, 103, 13)) >publicClass : Symbol(publicClass, Decl(privacyTypeParameterOfFunction.ts, 1, 1)) } @@ -263,11 +263,11 @@ export class publicClassWithWithPublicTypeParametersWithoutExtends { >T : Symbol(T, Decl(privacyTypeParameterOfFunction.ts, 109, 41)) } myPublicMethod() { ->myPublicMethod : Symbol(myPublicMethod, Decl(privacyTypeParameterOfFunction.ts, 110, 5)) +>myPublicMethod : Symbol(publicClassWithWithPublicTypeParametersWithoutExtends.myPublicMethod, Decl(privacyTypeParameterOfFunction.ts, 110, 5)) >T : Symbol(T, Decl(privacyTypeParameterOfFunction.ts, 111, 19)) } private myPrivateMethod() { ->myPrivateMethod : Symbol(myPrivateMethod, Decl(privacyTypeParameterOfFunction.ts, 112, 5)) +>myPrivateMethod : Symbol(publicClassWithWithPublicTypeParametersWithoutExtends.myPrivateMethod, Decl(privacyTypeParameterOfFunction.ts, 112, 5)) >T : Symbol(T, Decl(privacyTypeParameterOfFunction.ts, 113, 28)) } } @@ -283,11 +283,11 @@ class privateClassWithWithPublicTypeParametersWithoutExtends { >T : Symbol(T, Decl(privacyTypeParameterOfFunction.ts, 119, 41)) } myPublicMethod() { ->myPublicMethod : Symbol(myPublicMethod, Decl(privacyTypeParameterOfFunction.ts, 120, 5)) +>myPublicMethod : Symbol(privateClassWithWithPublicTypeParametersWithoutExtends.myPublicMethod, Decl(privacyTypeParameterOfFunction.ts, 120, 5)) >T : Symbol(T, Decl(privacyTypeParameterOfFunction.ts, 121, 19)) } private myPrivateMethod() { ->myPrivateMethod : Symbol(myPrivateMethod, Decl(privacyTypeParameterOfFunction.ts, 122, 5)) +>myPrivateMethod : Symbol(privateClassWithWithPublicTypeParametersWithoutExtends.myPrivateMethod, Decl(privacyTypeParameterOfFunction.ts, 122, 5)) >T : Symbol(T, Decl(privacyTypeParameterOfFunction.ts, 123, 28)) } } diff --git a/tests/baselines/reference/privacyTypeParametersOfClass.symbols b/tests/baselines/reference/privacyTypeParametersOfClass.symbols index cdb0e6044cf..6f52f1bd391 100644 --- a/tests/baselines/reference/privacyTypeParametersOfClass.symbols +++ b/tests/baselines/reference/privacyTypeParametersOfClass.symbols @@ -14,7 +14,7 @@ export class publicClassWithPrivateTypeParameters { >privateClass : Symbol(privateClass, Decl(privacyTypeParametersOfClass.ts, 0, 0)) myMethod(val: T): T { // Error ->myMethod : Symbol(myMethod, Decl(privacyTypeParametersOfClass.ts, 7, 75)) +>myMethod : Symbol(publicClassWithPrivateTypeParameters.myMethod, Decl(privacyTypeParametersOfClass.ts, 7, 75)) >val : Symbol(val, Decl(privacyTypeParametersOfClass.ts, 8, 13)) >T : Symbol(T, Decl(privacyTypeParametersOfClass.ts, 7, 50)) >T : Symbol(T, Decl(privacyTypeParametersOfClass.ts, 7, 50)) @@ -30,7 +30,7 @@ export class publicClassWithPublicTypeParameters { >publicClass : Symbol(publicClass, Decl(privacyTypeParametersOfClass.ts, 1, 1)) myMethod(val: T): T { // No Error ->myMethod : Symbol(myMethod, Decl(privacyTypeParametersOfClass.ts, 13, 73)) +>myMethod : Symbol(publicClassWithPublicTypeParameters.myMethod, Decl(privacyTypeParametersOfClass.ts, 13, 73)) >val : Symbol(val, Decl(privacyTypeParametersOfClass.ts, 14, 13)) >T : Symbol(T, Decl(privacyTypeParametersOfClass.ts, 13, 49)) >T : Symbol(T, Decl(privacyTypeParametersOfClass.ts, 13, 49)) @@ -46,7 +46,7 @@ class privateClassWithPrivateTypeParameters { >privateClass : Symbol(privateClass, Decl(privacyTypeParametersOfClass.ts, 0, 0)) myMethod(val: T): T { // No Error ->myMethod : Symbol(myMethod, Decl(privacyTypeParametersOfClass.ts, 19, 69)) +>myMethod : Symbol(privateClassWithPrivateTypeParameters.myMethod, Decl(privacyTypeParametersOfClass.ts, 19, 69)) >val : Symbol(val, Decl(privacyTypeParametersOfClass.ts, 20, 13)) >T : Symbol(T, Decl(privacyTypeParametersOfClass.ts, 19, 44)) >T : Symbol(T, Decl(privacyTypeParametersOfClass.ts, 19, 44)) @@ -62,7 +62,7 @@ class privateClassWithPublicTypeParameters { >publicClass : Symbol(publicClass, Decl(privacyTypeParametersOfClass.ts, 1, 1)) myMethod(val: T): T { // No Error ->myMethod : Symbol(myMethod, Decl(privacyTypeParametersOfClass.ts, 25, 67)) +>myMethod : Symbol(privateClassWithPublicTypeParameters.myMethod, Decl(privacyTypeParametersOfClass.ts, 25, 67)) >val : Symbol(val, Decl(privacyTypeParametersOfClass.ts, 26, 13)) >T : Symbol(T, Decl(privacyTypeParametersOfClass.ts, 25, 43)) >T : Symbol(T, Decl(privacyTypeParametersOfClass.ts, 25, 43)) @@ -77,7 +77,7 @@ export class publicClassWithPublicTypeParametersWithoutExtends { >T : Symbol(T, Decl(privacyTypeParametersOfClass.ts, 31, 63)) myMethod(val: T): T { // No Error ->myMethod : Symbol(myMethod, Decl(privacyTypeParametersOfClass.ts, 31, 67)) +>myMethod : Symbol(publicClassWithPublicTypeParametersWithoutExtends.myMethod, Decl(privacyTypeParametersOfClass.ts, 31, 67)) >val : Symbol(val, Decl(privacyTypeParametersOfClass.ts, 32, 13)) >T : Symbol(T, Decl(privacyTypeParametersOfClass.ts, 31, 63)) >T : Symbol(T, Decl(privacyTypeParametersOfClass.ts, 31, 63)) @@ -92,7 +92,7 @@ class privateClassWithPublicTypeParametersWithoutExtends { >T : Symbol(T, Decl(privacyTypeParametersOfClass.ts, 37, 57)) myMethod(val: T): T { // No Error ->myMethod : Symbol(myMethod, Decl(privacyTypeParametersOfClass.ts, 37, 61)) +>myMethod : Symbol(privateClassWithPublicTypeParametersWithoutExtends.myMethod, Decl(privacyTypeParametersOfClass.ts, 37, 61)) >val : Symbol(val, Decl(privacyTypeParametersOfClass.ts, 38, 13)) >T : Symbol(T, Decl(privacyTypeParametersOfClass.ts, 37, 57)) >T : Symbol(T, Decl(privacyTypeParametersOfClass.ts, 37, 57)) diff --git a/tests/baselines/reference/privacyTypeParametersOfInterface.symbols b/tests/baselines/reference/privacyTypeParametersOfInterface.symbols index 8d6e2070444..2ee927a9eec 100644 --- a/tests/baselines/reference/privacyTypeParametersOfInterface.symbols +++ b/tests/baselines/reference/privacyTypeParametersOfInterface.symbols @@ -24,33 +24,33 @@ export interface publicInterfaceWithPrivateTypeParametersprivateClass : Symbol(privateClass, Decl(privacyTypeParametersOfInterface.ts, 0, 0)) myMethod(val: T): T; // Error ->myMethod : Symbol(myMethod, Decl(privacyTypeParametersOfInterface.ts, 13, 83)) +>myMethod : Symbol(publicInterfaceWithPrivateTypeParameters.myMethod, Decl(privacyTypeParametersOfInterface.ts, 13, 83)) >val : Symbol(val, Decl(privacyTypeParametersOfInterface.ts, 14, 13)) >T : Symbol(T, Decl(privacyTypeParametersOfInterface.ts, 13, 58)) >T : Symbol(T, Decl(privacyTypeParametersOfInterface.ts, 13, 58)) myMethod0(): publicClassT; // error ->myMethod0 : Symbol(myMethod0, Decl(privacyTypeParametersOfInterface.ts, 14, 24)) +>myMethod0 : Symbol(publicInterfaceWithPrivateTypeParameters.myMethod0, Decl(privacyTypeParametersOfInterface.ts, 14, 24)) >publicClassT : Symbol(publicClassT, Decl(privacyTypeParametersOfInterface.ts, 7, 1)) >T : Symbol(T, Decl(privacyTypeParametersOfInterface.ts, 13, 58)) myMethod1(): privateClassT; // error ->myMethod1 : Symbol(myMethod1, Decl(privacyTypeParametersOfInterface.ts, 15, 33)) +>myMethod1 : Symbol(publicInterfaceWithPrivateTypeParameters.myMethod1, Decl(privacyTypeParametersOfInterface.ts, 15, 33)) >privateClassT : Symbol(privateClassT, Decl(privacyTypeParametersOfInterface.ts, 4, 1)) >privateClass : Symbol(privateClass, Decl(privacyTypeParametersOfInterface.ts, 0, 0)) myMethod2(): privateClassT; // error ->myMethod2 : Symbol(myMethod2, Decl(privacyTypeParametersOfInterface.ts, 16, 45)) +>myMethod2 : Symbol(publicInterfaceWithPrivateTypeParameters.myMethod2, Decl(privacyTypeParametersOfInterface.ts, 16, 45)) >privateClassT : Symbol(privateClassT, Decl(privacyTypeParametersOfInterface.ts, 4, 1)) >publicClass : Symbol(publicClass, Decl(privacyTypeParametersOfInterface.ts, 1, 1)) myMethod3(): publicClassT; //error ->myMethod3 : Symbol(myMethod3, Decl(privacyTypeParametersOfInterface.ts, 17, 44)) +>myMethod3 : Symbol(publicInterfaceWithPrivateTypeParameters.myMethod3, Decl(privacyTypeParametersOfInterface.ts, 17, 44)) >publicClassT : Symbol(publicClassT, Decl(privacyTypeParametersOfInterface.ts, 7, 1)) >privateClass : Symbol(privateClass, Decl(privacyTypeParametersOfInterface.ts, 0, 0)) myMethod4(): publicClassT; // no error ->myMethod4 : Symbol(myMethod4, Decl(privacyTypeParametersOfInterface.ts, 18, 44)) +>myMethod4 : Symbol(publicInterfaceWithPrivateTypeParameters.myMethod4, Decl(privacyTypeParametersOfInterface.ts, 18, 44)) >publicClassT : Symbol(publicClassT, Decl(privacyTypeParametersOfInterface.ts, 7, 1)) >publicClass : Symbol(publicClass, Decl(privacyTypeParametersOfInterface.ts, 1, 1)) } @@ -61,33 +61,33 @@ export interface publicInterfaceWithPublicTypeParameters >publicClass : Symbol(publicClass, Decl(privacyTypeParametersOfInterface.ts, 1, 1)) myMethod(val: T): T; // No Error ->myMethod : Symbol(myMethod, Decl(privacyTypeParametersOfInterface.ts, 22, 81)) +>myMethod : Symbol(publicInterfaceWithPublicTypeParameters.myMethod, Decl(privacyTypeParametersOfInterface.ts, 22, 81)) >val : Symbol(val, Decl(privacyTypeParametersOfInterface.ts, 23, 13)) >T : Symbol(T, Decl(privacyTypeParametersOfInterface.ts, 22, 57)) >T : Symbol(T, Decl(privacyTypeParametersOfInterface.ts, 22, 57)) myMethod0(): publicClassT; // No error ->myMethod0 : Symbol(myMethod0, Decl(privacyTypeParametersOfInterface.ts, 23, 24)) +>myMethod0 : Symbol(publicInterfaceWithPublicTypeParameters.myMethod0, Decl(privacyTypeParametersOfInterface.ts, 23, 24)) >publicClassT : Symbol(publicClassT, Decl(privacyTypeParametersOfInterface.ts, 7, 1)) >T : Symbol(T, Decl(privacyTypeParametersOfInterface.ts, 22, 57)) myMethod1(): privateClassT; // error ->myMethod1 : Symbol(myMethod1, Decl(privacyTypeParametersOfInterface.ts, 24, 33)) +>myMethod1 : Symbol(publicInterfaceWithPublicTypeParameters.myMethod1, Decl(privacyTypeParametersOfInterface.ts, 24, 33)) >privateClassT : Symbol(privateClassT, Decl(privacyTypeParametersOfInterface.ts, 4, 1)) >privateClass : Symbol(privateClass, Decl(privacyTypeParametersOfInterface.ts, 0, 0)) myMethod2(): privateClassT; // error ->myMethod2 : Symbol(myMethod2, Decl(privacyTypeParametersOfInterface.ts, 25, 45)) +>myMethod2 : Symbol(publicInterfaceWithPublicTypeParameters.myMethod2, Decl(privacyTypeParametersOfInterface.ts, 25, 45)) >privateClassT : Symbol(privateClassT, Decl(privacyTypeParametersOfInterface.ts, 4, 1)) >publicClass : Symbol(publicClass, Decl(privacyTypeParametersOfInterface.ts, 1, 1)) myMethod3(): publicClassT; //error ->myMethod3 : Symbol(myMethod3, Decl(privacyTypeParametersOfInterface.ts, 26, 44)) +>myMethod3 : Symbol(publicInterfaceWithPublicTypeParameters.myMethod3, Decl(privacyTypeParametersOfInterface.ts, 26, 44)) >publicClassT : Symbol(publicClassT, Decl(privacyTypeParametersOfInterface.ts, 7, 1)) >privateClass : Symbol(privateClass, Decl(privacyTypeParametersOfInterface.ts, 0, 0)) myMethod4(): publicClassT; // no error ->myMethod4 : Symbol(myMethod4, Decl(privacyTypeParametersOfInterface.ts, 27, 44)) +>myMethod4 : Symbol(publicInterfaceWithPublicTypeParameters.myMethod4, Decl(privacyTypeParametersOfInterface.ts, 27, 44)) >publicClassT : Symbol(publicClassT, Decl(privacyTypeParametersOfInterface.ts, 7, 1)) >publicClass : Symbol(publicClass, Decl(privacyTypeParametersOfInterface.ts, 1, 1)) } @@ -98,33 +98,33 @@ interface privateInterfaceWithPrivateTypeParameters { >privateClass : Symbol(privateClass, Decl(privacyTypeParametersOfInterface.ts, 0, 0)) myMethod(val: T): T; // No Error ->myMethod : Symbol(myMethod, Decl(privacyTypeParametersOfInterface.ts, 31, 77)) +>myMethod : Symbol(privateInterfaceWithPrivateTypeParameters.myMethod, Decl(privacyTypeParametersOfInterface.ts, 31, 77)) >val : Symbol(val, Decl(privacyTypeParametersOfInterface.ts, 32, 13)) >T : Symbol(T, Decl(privacyTypeParametersOfInterface.ts, 31, 52)) >T : Symbol(T, Decl(privacyTypeParametersOfInterface.ts, 31, 52)) myMethod0(): publicClassT; // No error ->myMethod0 : Symbol(myMethod0, Decl(privacyTypeParametersOfInterface.ts, 32, 24)) +>myMethod0 : Symbol(privateInterfaceWithPrivateTypeParameters.myMethod0, Decl(privacyTypeParametersOfInterface.ts, 32, 24)) >publicClassT : Symbol(publicClassT, Decl(privacyTypeParametersOfInterface.ts, 7, 1)) >T : Symbol(T, Decl(privacyTypeParametersOfInterface.ts, 31, 52)) myMethod1(): privateClassT; // No error ->myMethod1 : Symbol(myMethod1, Decl(privacyTypeParametersOfInterface.ts, 33, 33)) +>myMethod1 : Symbol(privateInterfaceWithPrivateTypeParameters.myMethod1, Decl(privacyTypeParametersOfInterface.ts, 33, 33)) >privateClassT : Symbol(privateClassT, Decl(privacyTypeParametersOfInterface.ts, 4, 1)) >privateClass : Symbol(privateClass, Decl(privacyTypeParametersOfInterface.ts, 0, 0)) myMethod2(): privateClassT; // No error ->myMethod2 : Symbol(myMethod2, Decl(privacyTypeParametersOfInterface.ts, 34, 45)) +>myMethod2 : Symbol(privateInterfaceWithPrivateTypeParameters.myMethod2, Decl(privacyTypeParametersOfInterface.ts, 34, 45)) >privateClassT : Symbol(privateClassT, Decl(privacyTypeParametersOfInterface.ts, 4, 1)) >publicClass : Symbol(publicClass, Decl(privacyTypeParametersOfInterface.ts, 1, 1)) myMethod3(): publicClassT; //No error ->myMethod3 : Symbol(myMethod3, Decl(privacyTypeParametersOfInterface.ts, 35, 44)) +>myMethod3 : Symbol(privateInterfaceWithPrivateTypeParameters.myMethod3, Decl(privacyTypeParametersOfInterface.ts, 35, 44)) >publicClassT : Symbol(publicClassT, Decl(privacyTypeParametersOfInterface.ts, 7, 1)) >privateClass : Symbol(privateClass, Decl(privacyTypeParametersOfInterface.ts, 0, 0)) myMethod4(): publicClassT; // no error ->myMethod4 : Symbol(myMethod4, Decl(privacyTypeParametersOfInterface.ts, 36, 44)) +>myMethod4 : Symbol(privateInterfaceWithPrivateTypeParameters.myMethod4, Decl(privacyTypeParametersOfInterface.ts, 36, 44)) >publicClassT : Symbol(publicClassT, Decl(privacyTypeParametersOfInterface.ts, 7, 1)) >publicClass : Symbol(publicClass, Decl(privacyTypeParametersOfInterface.ts, 1, 1)) } @@ -135,33 +135,33 @@ interface privateInterfaceWithPublicTypeParameters { >publicClass : Symbol(publicClass, Decl(privacyTypeParametersOfInterface.ts, 1, 1)) myMethod(val: T): T; // No Error ->myMethod : Symbol(myMethod, Decl(privacyTypeParametersOfInterface.ts, 40, 75)) +>myMethod : Symbol(privateInterfaceWithPublicTypeParameters.myMethod, Decl(privacyTypeParametersOfInterface.ts, 40, 75)) >val : Symbol(val, Decl(privacyTypeParametersOfInterface.ts, 41, 13)) >T : Symbol(T, Decl(privacyTypeParametersOfInterface.ts, 40, 51)) >T : Symbol(T, Decl(privacyTypeParametersOfInterface.ts, 40, 51)) myMethod0(): publicClassT; // No error ->myMethod0 : Symbol(myMethod0, Decl(privacyTypeParametersOfInterface.ts, 41, 24)) +>myMethod0 : Symbol(privateInterfaceWithPublicTypeParameters.myMethod0, Decl(privacyTypeParametersOfInterface.ts, 41, 24)) >publicClassT : Symbol(publicClassT, Decl(privacyTypeParametersOfInterface.ts, 7, 1)) >T : Symbol(T, Decl(privacyTypeParametersOfInterface.ts, 40, 51)) myMethod1(): privateClassT; // No error ->myMethod1 : Symbol(myMethod1, Decl(privacyTypeParametersOfInterface.ts, 42, 33)) +>myMethod1 : Symbol(privateInterfaceWithPublicTypeParameters.myMethod1, Decl(privacyTypeParametersOfInterface.ts, 42, 33)) >privateClassT : Symbol(privateClassT, Decl(privacyTypeParametersOfInterface.ts, 4, 1)) >privateClass : Symbol(privateClass, Decl(privacyTypeParametersOfInterface.ts, 0, 0)) myMethod2(): privateClassT; // No error ->myMethod2 : Symbol(myMethod2, Decl(privacyTypeParametersOfInterface.ts, 43, 45)) +>myMethod2 : Symbol(privateInterfaceWithPublicTypeParameters.myMethod2, Decl(privacyTypeParametersOfInterface.ts, 43, 45)) >privateClassT : Symbol(privateClassT, Decl(privacyTypeParametersOfInterface.ts, 4, 1)) >publicClass : Symbol(publicClass, Decl(privacyTypeParametersOfInterface.ts, 1, 1)) myMethod3(): publicClassT; //No error ->myMethod3 : Symbol(myMethod3, Decl(privacyTypeParametersOfInterface.ts, 44, 44)) +>myMethod3 : Symbol(privateInterfaceWithPublicTypeParameters.myMethod3, Decl(privacyTypeParametersOfInterface.ts, 44, 44)) >publicClassT : Symbol(publicClassT, Decl(privacyTypeParametersOfInterface.ts, 7, 1)) >privateClass : Symbol(privateClass, Decl(privacyTypeParametersOfInterface.ts, 0, 0)) myMethod4(): publicClassT; // no error ->myMethod4 : Symbol(myMethod4, Decl(privacyTypeParametersOfInterface.ts, 45, 44)) +>myMethod4 : Symbol(privateInterfaceWithPublicTypeParameters.myMethod4, Decl(privacyTypeParametersOfInterface.ts, 45, 44)) >publicClassT : Symbol(publicClassT, Decl(privacyTypeParametersOfInterface.ts, 7, 1)) >publicClass : Symbol(publicClass, Decl(privacyTypeParametersOfInterface.ts, 1, 1)) } @@ -171,13 +171,13 @@ export interface publicInterfaceWithPublicTypeParametersWithoutExtends { >T : Symbol(T, Decl(privacyTypeParametersOfInterface.ts, 49, 71)) myMethod(val: T): T; // No Error ->myMethod : Symbol(myMethod, Decl(privacyTypeParametersOfInterface.ts, 49, 75)) +>myMethod : Symbol(publicInterfaceWithPublicTypeParametersWithoutExtends.myMethod, Decl(privacyTypeParametersOfInterface.ts, 49, 75)) >val : Symbol(val, Decl(privacyTypeParametersOfInterface.ts, 50, 13)) >T : Symbol(T, Decl(privacyTypeParametersOfInterface.ts, 49, 71)) >T : Symbol(T, Decl(privacyTypeParametersOfInterface.ts, 49, 71)) myMethod0(): publicClassT; // No error ->myMethod0 : Symbol(myMethod0, Decl(privacyTypeParametersOfInterface.ts, 50, 24)) +>myMethod0 : Symbol(publicInterfaceWithPublicTypeParametersWithoutExtends.myMethod0, Decl(privacyTypeParametersOfInterface.ts, 50, 24)) >publicClassT : Symbol(publicClassT, Decl(privacyTypeParametersOfInterface.ts, 7, 1)) >T : Symbol(T, Decl(privacyTypeParametersOfInterface.ts, 49, 71)) } @@ -187,13 +187,13 @@ interface privateInterfaceWithPublicTypeParametersWithoutExtends { >T : Symbol(T, Decl(privacyTypeParametersOfInterface.ts, 54, 65)) myMethod(val: T): T; // No Error ->myMethod : Symbol(myMethod, Decl(privacyTypeParametersOfInterface.ts, 54, 69)) +>myMethod : Symbol(privateInterfaceWithPublicTypeParametersWithoutExtends.myMethod, Decl(privacyTypeParametersOfInterface.ts, 54, 69)) >val : Symbol(val, Decl(privacyTypeParametersOfInterface.ts, 55, 13)) >T : Symbol(T, Decl(privacyTypeParametersOfInterface.ts, 54, 65)) >T : Symbol(T, Decl(privacyTypeParametersOfInterface.ts, 54, 65)) myMethod0(): publicClassT; // No error ->myMethod0 : Symbol(myMethod0, Decl(privacyTypeParametersOfInterface.ts, 55, 24)) +>myMethod0 : Symbol(privateInterfaceWithPublicTypeParametersWithoutExtends.myMethod0, Decl(privacyTypeParametersOfInterface.ts, 55, 24)) >publicClassT : Symbol(publicClassT, Decl(privacyTypeParametersOfInterface.ts, 7, 1)) >T : Symbol(T, Decl(privacyTypeParametersOfInterface.ts, 54, 65)) } diff --git a/tests/baselines/reference/privacyVar.symbols b/tests/baselines/reference/privacyVar.symbols index 098a48d6499..a08e2421080 100644 --- a/tests/baselines/reference/privacyVar.symbols +++ b/tests/baselines/reference/privacyVar.symbols @@ -6,7 +6,7 @@ export module m1 { >C1_public : Symbol(C1_public, Decl(privacyVar.ts, 0, 18)) private f1() { ->f1 : Symbol(f1, Decl(privacyVar.ts, 1, 28)) +>f1 : Symbol(C1_public.f1, Decl(privacyVar.ts, 1, 28)) } } @@ -18,54 +18,54 @@ export module m1 { >C3_public : Symbol(C3_public, Decl(privacyVar.ts, 7, 5)) private C3_v1_private: C1_public; ->C3_v1_private : Symbol(C3_v1_private, Decl(privacyVar.ts, 9, 28)) +>C3_v1_private : Symbol(C3_public.C3_v1_private, Decl(privacyVar.ts, 9, 28)) >C1_public : Symbol(C1_public, Decl(privacyVar.ts, 0, 18)) public C3_v2_public: C1_public; ->C3_v2_public : Symbol(C3_v2_public, Decl(privacyVar.ts, 10, 41)) +>C3_v2_public : Symbol(C3_public.C3_v2_public, Decl(privacyVar.ts, 10, 41)) >C1_public : Symbol(C1_public, Decl(privacyVar.ts, 0, 18)) private C3_v3_private: C2_private; ->C3_v3_private : Symbol(C3_v3_private, Decl(privacyVar.ts, 11, 39)) +>C3_v3_private : Symbol(C3_public.C3_v3_private, Decl(privacyVar.ts, 11, 39)) >C2_private : Symbol(C2_private, Decl(privacyVar.ts, 4, 5)) public C3_v4_public: C2_private; // error ->C3_v4_public : Symbol(C3_v4_public, Decl(privacyVar.ts, 12, 42)) +>C3_v4_public : Symbol(C3_public.C3_v4_public, Decl(privacyVar.ts, 12, 42)) >C2_private : Symbol(C2_private, Decl(privacyVar.ts, 4, 5)) private C3_v11_private = new C1_public(); ->C3_v11_private : Symbol(C3_v11_private, Decl(privacyVar.ts, 13, 40)) +>C3_v11_private : Symbol(C3_public.C3_v11_private, Decl(privacyVar.ts, 13, 40)) >C1_public : Symbol(C1_public, Decl(privacyVar.ts, 0, 18)) public C3_v12_public = new C1_public(); ->C3_v12_public : Symbol(C3_v12_public, Decl(privacyVar.ts, 15, 49)) +>C3_v12_public : Symbol(C3_public.C3_v12_public, Decl(privacyVar.ts, 15, 49)) >C1_public : Symbol(C1_public, Decl(privacyVar.ts, 0, 18)) private C3_v13_private = new C2_private(); ->C3_v13_private : Symbol(C3_v13_private, Decl(privacyVar.ts, 16, 47)) +>C3_v13_private : Symbol(C3_public.C3_v13_private, Decl(privacyVar.ts, 16, 47)) >C2_private : Symbol(C2_private, Decl(privacyVar.ts, 4, 5)) public C3_v14_public = new C2_private(); // error ->C3_v14_public : Symbol(C3_v14_public, Decl(privacyVar.ts, 17, 50)) +>C3_v14_public : Symbol(C3_public.C3_v14_public, Decl(privacyVar.ts, 17, 50)) >C2_private : Symbol(C2_private, Decl(privacyVar.ts, 4, 5)) private C3_v21_private: C1_public = new C1_public(); ->C3_v21_private : Symbol(C3_v21_private, Decl(privacyVar.ts, 18, 48)) +>C3_v21_private : Symbol(C3_public.C3_v21_private, Decl(privacyVar.ts, 18, 48)) >C1_public : Symbol(C1_public, Decl(privacyVar.ts, 0, 18)) >C1_public : Symbol(C1_public, Decl(privacyVar.ts, 0, 18)) public C3_v22_public: C1_public = new C1_public(); ->C3_v22_public : Symbol(C3_v22_public, Decl(privacyVar.ts, 20, 60)) +>C3_v22_public : Symbol(C3_public.C3_v22_public, Decl(privacyVar.ts, 20, 60)) >C1_public : Symbol(C1_public, Decl(privacyVar.ts, 0, 18)) >C1_public : Symbol(C1_public, Decl(privacyVar.ts, 0, 18)) private C3_v23_private: C2_private = new C2_private(); ->C3_v23_private : Symbol(C3_v23_private, Decl(privacyVar.ts, 21, 58)) +>C3_v23_private : Symbol(C3_public.C3_v23_private, Decl(privacyVar.ts, 21, 58)) >C2_private : Symbol(C2_private, Decl(privacyVar.ts, 4, 5)) >C2_private : Symbol(C2_private, Decl(privacyVar.ts, 4, 5)) public C3_v24_public: C2_private = new C2_private(); // error ->C3_v24_public : Symbol(C3_v24_public, Decl(privacyVar.ts, 22, 62)) +>C3_v24_public : Symbol(C3_public.C3_v24_public, Decl(privacyVar.ts, 22, 62)) >C2_private : Symbol(C2_private, Decl(privacyVar.ts, 4, 5)) >C2_private : Symbol(C2_private, Decl(privacyVar.ts, 4, 5)) } @@ -74,54 +74,54 @@ export module m1 { >C4_public : Symbol(C4_public, Decl(privacyVar.ts, 24, 5)) private C4_v1_private: C1_public; ->C4_v1_private : Symbol(C4_v1_private, Decl(privacyVar.ts, 26, 21)) +>C4_v1_private : Symbol(C4_public.C4_v1_private, Decl(privacyVar.ts, 26, 21)) >C1_public : Symbol(C1_public, Decl(privacyVar.ts, 0, 18)) public C4_v2_public: C1_public; ->C4_v2_public : Symbol(C4_v2_public, Decl(privacyVar.ts, 27, 41)) +>C4_v2_public : Symbol(C4_public.C4_v2_public, Decl(privacyVar.ts, 27, 41)) >C1_public : Symbol(C1_public, Decl(privacyVar.ts, 0, 18)) private C4_v3_private: C2_private; ->C4_v3_private : Symbol(C4_v3_private, Decl(privacyVar.ts, 28, 39)) +>C4_v3_private : Symbol(C4_public.C4_v3_private, Decl(privacyVar.ts, 28, 39)) >C2_private : Symbol(C2_private, Decl(privacyVar.ts, 4, 5)) public C4_v4_public: C2_private; ->C4_v4_public : Symbol(C4_v4_public, Decl(privacyVar.ts, 29, 42)) +>C4_v4_public : Symbol(C4_public.C4_v4_public, Decl(privacyVar.ts, 29, 42)) >C2_private : Symbol(C2_private, Decl(privacyVar.ts, 4, 5)) private C4_v11_private = new C1_public(); ->C4_v11_private : Symbol(C4_v11_private, Decl(privacyVar.ts, 30, 40)) +>C4_v11_private : Symbol(C4_public.C4_v11_private, Decl(privacyVar.ts, 30, 40)) >C1_public : Symbol(C1_public, Decl(privacyVar.ts, 0, 18)) public C4_v12_public = new C1_public(); ->C4_v12_public : Symbol(C4_v12_public, Decl(privacyVar.ts, 32, 49)) +>C4_v12_public : Symbol(C4_public.C4_v12_public, Decl(privacyVar.ts, 32, 49)) >C1_public : Symbol(C1_public, Decl(privacyVar.ts, 0, 18)) private C4_v13_private = new C2_private(); ->C4_v13_private : Symbol(C4_v13_private, Decl(privacyVar.ts, 33, 47)) +>C4_v13_private : Symbol(C4_public.C4_v13_private, Decl(privacyVar.ts, 33, 47)) >C2_private : Symbol(C2_private, Decl(privacyVar.ts, 4, 5)) public C4_v14_public = new C2_private(); ->C4_v14_public : Symbol(C4_v14_public, Decl(privacyVar.ts, 34, 50)) +>C4_v14_public : Symbol(C4_public.C4_v14_public, Decl(privacyVar.ts, 34, 50)) >C2_private : Symbol(C2_private, Decl(privacyVar.ts, 4, 5)) private C4_v21_private: C1_public = new C1_public(); ->C4_v21_private : Symbol(C4_v21_private, Decl(privacyVar.ts, 35, 48)) +>C4_v21_private : Symbol(C4_public.C4_v21_private, Decl(privacyVar.ts, 35, 48)) >C1_public : Symbol(C1_public, Decl(privacyVar.ts, 0, 18)) >C1_public : Symbol(C1_public, Decl(privacyVar.ts, 0, 18)) public C4_v22_public: C1_public = new C1_public(); ->C4_v22_public : Symbol(C4_v22_public, Decl(privacyVar.ts, 37, 60)) +>C4_v22_public : Symbol(C4_public.C4_v22_public, Decl(privacyVar.ts, 37, 60)) >C1_public : Symbol(C1_public, Decl(privacyVar.ts, 0, 18)) >C1_public : Symbol(C1_public, Decl(privacyVar.ts, 0, 18)) private C4_v23_private: C2_private = new C2_private(); ->C4_v23_private : Symbol(C4_v23_private, Decl(privacyVar.ts, 38, 58)) +>C4_v23_private : Symbol(C4_public.C4_v23_private, Decl(privacyVar.ts, 38, 58)) >C2_private : Symbol(C2_private, Decl(privacyVar.ts, 4, 5)) >C2_private : Symbol(C2_private, Decl(privacyVar.ts, 4, 5)) public C4_v24_public: C2_private = new C2_private(); ->C4_v24_public : Symbol(C4_v24_public, Decl(privacyVar.ts, 39, 62)) +>C4_v24_public : Symbol(C4_public.C4_v24_public, Decl(privacyVar.ts, 39, 62)) >C2_private : Symbol(C2_private, Decl(privacyVar.ts, 4, 5)) >C2_private : Symbol(C2_private, Decl(privacyVar.ts, 4, 5)) } @@ -186,7 +186,7 @@ module m2 { >m2_C1_public : Symbol(m2_C1_public, Decl(privacyVar.ts, 59, 11)) private f1() { ->f1 : Symbol(f1, Decl(privacyVar.ts, 60, 31)) +>f1 : Symbol(m2_C1_public.f1, Decl(privacyVar.ts, 60, 31)) } } @@ -198,54 +198,54 @@ module m2 { >m2_C3_public : Symbol(m2_C3_public, Decl(privacyVar.ts, 66, 5)) private m2_C3_v1_private: m2_C1_public; ->m2_C3_v1_private : Symbol(m2_C3_v1_private, Decl(privacyVar.ts, 68, 31)) +>m2_C3_v1_private : Symbol(m2_C3_public.m2_C3_v1_private, Decl(privacyVar.ts, 68, 31)) >m2_C1_public : Symbol(m2_C1_public, Decl(privacyVar.ts, 59, 11)) public m2_C3_v2_public: m2_C1_public; ->m2_C3_v2_public : Symbol(m2_C3_v2_public, Decl(privacyVar.ts, 69, 47)) +>m2_C3_v2_public : Symbol(m2_C3_public.m2_C3_v2_public, Decl(privacyVar.ts, 69, 47)) >m2_C1_public : Symbol(m2_C1_public, Decl(privacyVar.ts, 59, 11)) private m2_C3_v3_private: m2_C2_private; ->m2_C3_v3_private : Symbol(m2_C3_v3_private, Decl(privacyVar.ts, 70, 45)) +>m2_C3_v3_private : Symbol(m2_C3_public.m2_C3_v3_private, Decl(privacyVar.ts, 70, 45)) >m2_C2_private : Symbol(m2_C2_private, Decl(privacyVar.ts, 63, 5)) public m2_C3_v4_public: m2_C2_private; ->m2_C3_v4_public : Symbol(m2_C3_v4_public, Decl(privacyVar.ts, 71, 48)) +>m2_C3_v4_public : Symbol(m2_C3_public.m2_C3_v4_public, Decl(privacyVar.ts, 71, 48)) >m2_C2_private : Symbol(m2_C2_private, Decl(privacyVar.ts, 63, 5)) private m2_C3_v11_private = new m2_C1_public(); ->m2_C3_v11_private : Symbol(m2_C3_v11_private, Decl(privacyVar.ts, 72, 46)) +>m2_C3_v11_private : Symbol(m2_C3_public.m2_C3_v11_private, Decl(privacyVar.ts, 72, 46)) >m2_C1_public : Symbol(m2_C1_public, Decl(privacyVar.ts, 59, 11)) public m2_C3_v12_public = new m2_C1_public(); ->m2_C3_v12_public : Symbol(m2_C3_v12_public, Decl(privacyVar.ts, 74, 55)) +>m2_C3_v12_public : Symbol(m2_C3_public.m2_C3_v12_public, Decl(privacyVar.ts, 74, 55)) >m2_C1_public : Symbol(m2_C1_public, Decl(privacyVar.ts, 59, 11)) private m2_C3_v13_private = new m2_C2_private(); ->m2_C3_v13_private : Symbol(m2_C3_v13_private, Decl(privacyVar.ts, 75, 53)) +>m2_C3_v13_private : Symbol(m2_C3_public.m2_C3_v13_private, Decl(privacyVar.ts, 75, 53)) >m2_C2_private : Symbol(m2_C2_private, Decl(privacyVar.ts, 63, 5)) public m2_C3_v14_public = new m2_C2_private(); ->m2_C3_v14_public : Symbol(m2_C3_v14_public, Decl(privacyVar.ts, 76, 56)) +>m2_C3_v14_public : Symbol(m2_C3_public.m2_C3_v14_public, Decl(privacyVar.ts, 76, 56)) >m2_C2_private : Symbol(m2_C2_private, Decl(privacyVar.ts, 63, 5)) private m2_C3_v21_private: m2_C1_public = new m2_C1_public(); ->m2_C3_v21_private : Symbol(m2_C3_v21_private, Decl(privacyVar.ts, 77, 54)) +>m2_C3_v21_private : Symbol(m2_C3_public.m2_C3_v21_private, Decl(privacyVar.ts, 77, 54)) >m2_C1_public : Symbol(m2_C1_public, Decl(privacyVar.ts, 59, 11)) >m2_C1_public : Symbol(m2_C1_public, Decl(privacyVar.ts, 59, 11)) public m2_C3_v22_public: m2_C1_public = new m2_C1_public(); ->m2_C3_v22_public : Symbol(m2_C3_v22_public, Decl(privacyVar.ts, 79, 69)) +>m2_C3_v22_public : Symbol(m2_C3_public.m2_C3_v22_public, Decl(privacyVar.ts, 79, 69)) >m2_C1_public : Symbol(m2_C1_public, Decl(privacyVar.ts, 59, 11)) >m2_C1_public : Symbol(m2_C1_public, Decl(privacyVar.ts, 59, 11)) private m2_C3_v23_private: m2_C2_private = new m2_C2_private(); ->m2_C3_v23_private : Symbol(m2_C3_v23_private, Decl(privacyVar.ts, 80, 67)) +>m2_C3_v23_private : Symbol(m2_C3_public.m2_C3_v23_private, Decl(privacyVar.ts, 80, 67)) >m2_C2_private : Symbol(m2_C2_private, Decl(privacyVar.ts, 63, 5)) >m2_C2_private : Symbol(m2_C2_private, Decl(privacyVar.ts, 63, 5)) public m2_C3_v24_public: m2_C2_private = new m2_C2_private(); ->m2_C3_v24_public : Symbol(m2_C3_v24_public, Decl(privacyVar.ts, 81, 71)) +>m2_C3_v24_public : Symbol(m2_C3_public.m2_C3_v24_public, Decl(privacyVar.ts, 81, 71)) >m2_C2_private : Symbol(m2_C2_private, Decl(privacyVar.ts, 63, 5)) >m2_C2_private : Symbol(m2_C2_private, Decl(privacyVar.ts, 63, 5)) } @@ -254,54 +254,54 @@ module m2 { >m2_C4_public : Symbol(m2_C4_public, Decl(privacyVar.ts, 83, 5)) private m2_C4_v1_private: m2_C1_public; ->m2_C4_v1_private : Symbol(m2_C4_v1_private, Decl(privacyVar.ts, 85, 24)) +>m2_C4_v1_private : Symbol(m2_C4_public.m2_C4_v1_private, Decl(privacyVar.ts, 85, 24)) >m2_C1_public : Symbol(m2_C1_public, Decl(privacyVar.ts, 59, 11)) public m2_C4_v2_public: m2_C1_public; ->m2_C4_v2_public : Symbol(m2_C4_v2_public, Decl(privacyVar.ts, 86, 47)) +>m2_C4_v2_public : Symbol(m2_C4_public.m2_C4_v2_public, Decl(privacyVar.ts, 86, 47)) >m2_C1_public : Symbol(m2_C1_public, Decl(privacyVar.ts, 59, 11)) private m2_C4_v3_private: m2_C2_private; ->m2_C4_v3_private : Symbol(m2_C4_v3_private, Decl(privacyVar.ts, 87, 45)) +>m2_C4_v3_private : Symbol(m2_C4_public.m2_C4_v3_private, Decl(privacyVar.ts, 87, 45)) >m2_C2_private : Symbol(m2_C2_private, Decl(privacyVar.ts, 63, 5)) public m2_C4_v4_public: m2_C2_private; ->m2_C4_v4_public : Symbol(m2_C4_v4_public, Decl(privacyVar.ts, 88, 48)) +>m2_C4_v4_public : Symbol(m2_C4_public.m2_C4_v4_public, Decl(privacyVar.ts, 88, 48)) >m2_C2_private : Symbol(m2_C2_private, Decl(privacyVar.ts, 63, 5)) private m2_C4_v11_private = new m2_C1_public(); ->m2_C4_v11_private : Symbol(m2_C4_v11_private, Decl(privacyVar.ts, 89, 46)) +>m2_C4_v11_private : Symbol(m2_C4_public.m2_C4_v11_private, Decl(privacyVar.ts, 89, 46)) >m2_C1_public : Symbol(m2_C1_public, Decl(privacyVar.ts, 59, 11)) public m2_C4_v12_public = new m2_C1_public(); ->m2_C4_v12_public : Symbol(m2_C4_v12_public, Decl(privacyVar.ts, 91, 55)) +>m2_C4_v12_public : Symbol(m2_C4_public.m2_C4_v12_public, Decl(privacyVar.ts, 91, 55)) >m2_C1_public : Symbol(m2_C1_public, Decl(privacyVar.ts, 59, 11)) private m2_C4_v13_private = new m2_C2_private(); ->m2_C4_v13_private : Symbol(m2_C4_v13_private, Decl(privacyVar.ts, 92, 53)) +>m2_C4_v13_private : Symbol(m2_C4_public.m2_C4_v13_private, Decl(privacyVar.ts, 92, 53)) >m2_C2_private : Symbol(m2_C2_private, Decl(privacyVar.ts, 63, 5)) public m2_C4_v14_public = new m2_C2_private(); ->m2_C4_v14_public : Symbol(m2_C4_v14_public, Decl(privacyVar.ts, 93, 56)) +>m2_C4_v14_public : Symbol(m2_C4_public.m2_C4_v14_public, Decl(privacyVar.ts, 93, 56)) >m2_C2_private : Symbol(m2_C2_private, Decl(privacyVar.ts, 63, 5)) private m2_C4_v21_private: m2_C1_public = new m2_C1_public(); ->m2_C4_v21_private : Symbol(m2_C4_v21_private, Decl(privacyVar.ts, 94, 54)) +>m2_C4_v21_private : Symbol(m2_C4_public.m2_C4_v21_private, Decl(privacyVar.ts, 94, 54)) >m2_C1_public : Symbol(m2_C1_public, Decl(privacyVar.ts, 59, 11)) >m2_C1_public : Symbol(m2_C1_public, Decl(privacyVar.ts, 59, 11)) public m2_C4_v22_public: m2_C1_public = new m2_C1_public(); ->m2_C4_v22_public : Symbol(m2_C4_v22_public, Decl(privacyVar.ts, 96, 69)) +>m2_C4_v22_public : Symbol(m2_C4_public.m2_C4_v22_public, Decl(privacyVar.ts, 96, 69)) >m2_C1_public : Symbol(m2_C1_public, Decl(privacyVar.ts, 59, 11)) >m2_C1_public : Symbol(m2_C1_public, Decl(privacyVar.ts, 59, 11)) private m2_C4_v23_private: m2_C2_private = new m2_C2_private(); ->m2_C4_v23_private : Symbol(m2_C4_v23_private, Decl(privacyVar.ts, 97, 67)) +>m2_C4_v23_private : Symbol(m2_C4_public.m2_C4_v23_private, Decl(privacyVar.ts, 97, 67)) >m2_C2_private : Symbol(m2_C2_private, Decl(privacyVar.ts, 63, 5)) >m2_C2_private : Symbol(m2_C2_private, Decl(privacyVar.ts, 63, 5)) public m2_C4_v24_public: m2_C2_private = new m2_C2_private(); ->m2_C4_v24_public : Symbol(m2_C4_v24_public, Decl(privacyVar.ts, 98, 71)) +>m2_C4_v24_public : Symbol(m2_C4_public.m2_C4_v24_public, Decl(privacyVar.ts, 98, 71)) >m2_C2_private : Symbol(m2_C2_private, Decl(privacyVar.ts, 63, 5)) >m2_C2_private : Symbol(m2_C2_private, Decl(privacyVar.ts, 63, 5)) } @@ -363,7 +363,7 @@ export class glo_C1_public { >glo_C1_public : Symbol(glo_C1_public, Decl(privacyVar.ts, 116, 1)) private f1() { ->f1 : Symbol(f1, Decl(privacyVar.ts, 118, 28)) +>f1 : Symbol(glo_C1_public.f1, Decl(privacyVar.ts, 118, 28)) } } @@ -375,54 +375,54 @@ export class glo_C3_public { >glo_C3_public : Symbol(glo_C3_public, Decl(privacyVar.ts, 124, 1)) private glo_C3_v1_private: glo_C1_public; ->glo_C3_v1_private : Symbol(glo_C3_v1_private, Decl(privacyVar.ts, 126, 28)) +>glo_C3_v1_private : Symbol(glo_C3_public.glo_C3_v1_private, Decl(privacyVar.ts, 126, 28)) >glo_C1_public : Symbol(glo_C1_public, Decl(privacyVar.ts, 116, 1)) public glo_C3_v2_public: glo_C1_public; ->glo_C3_v2_public : Symbol(glo_C3_v2_public, Decl(privacyVar.ts, 127, 45)) +>glo_C3_v2_public : Symbol(glo_C3_public.glo_C3_v2_public, Decl(privacyVar.ts, 127, 45)) >glo_C1_public : Symbol(glo_C1_public, Decl(privacyVar.ts, 116, 1)) private glo_C3_v3_private: glo_C2_private; ->glo_C3_v3_private : Symbol(glo_C3_v3_private, Decl(privacyVar.ts, 128, 43)) +>glo_C3_v3_private : Symbol(glo_C3_public.glo_C3_v3_private, Decl(privacyVar.ts, 128, 43)) >glo_C2_private : Symbol(glo_C2_private, Decl(privacyVar.ts, 121, 1)) public glo_C3_v4_public: glo_C2_private; //error ->glo_C3_v4_public : Symbol(glo_C3_v4_public, Decl(privacyVar.ts, 129, 46)) +>glo_C3_v4_public : Symbol(glo_C3_public.glo_C3_v4_public, Decl(privacyVar.ts, 129, 46)) >glo_C2_private : Symbol(glo_C2_private, Decl(privacyVar.ts, 121, 1)) private glo_C3_v11_private = new glo_C1_public(); ->glo_C3_v11_private : Symbol(glo_C3_v11_private, Decl(privacyVar.ts, 130, 44)) +>glo_C3_v11_private : Symbol(glo_C3_public.glo_C3_v11_private, Decl(privacyVar.ts, 130, 44)) >glo_C1_public : Symbol(glo_C1_public, Decl(privacyVar.ts, 116, 1)) public glo_C3_v12_public = new glo_C1_public(); ->glo_C3_v12_public : Symbol(glo_C3_v12_public, Decl(privacyVar.ts, 132, 53)) +>glo_C3_v12_public : Symbol(glo_C3_public.glo_C3_v12_public, Decl(privacyVar.ts, 132, 53)) >glo_C1_public : Symbol(glo_C1_public, Decl(privacyVar.ts, 116, 1)) private glo_C3_v13_private = new glo_C2_private(); ->glo_C3_v13_private : Symbol(glo_C3_v13_private, Decl(privacyVar.ts, 133, 51)) +>glo_C3_v13_private : Symbol(glo_C3_public.glo_C3_v13_private, Decl(privacyVar.ts, 133, 51)) >glo_C2_private : Symbol(glo_C2_private, Decl(privacyVar.ts, 121, 1)) public glo_C3_v14_public = new glo_C2_private(); // error ->glo_C3_v14_public : Symbol(glo_C3_v14_public, Decl(privacyVar.ts, 134, 54)) +>glo_C3_v14_public : Symbol(glo_C3_public.glo_C3_v14_public, Decl(privacyVar.ts, 134, 54)) >glo_C2_private : Symbol(glo_C2_private, Decl(privacyVar.ts, 121, 1)) private glo_C3_v21_private: glo_C1_public = new glo_C1_public(); ->glo_C3_v21_private : Symbol(glo_C3_v21_private, Decl(privacyVar.ts, 135, 52)) +>glo_C3_v21_private : Symbol(glo_C3_public.glo_C3_v21_private, Decl(privacyVar.ts, 135, 52)) >glo_C1_public : Symbol(glo_C1_public, Decl(privacyVar.ts, 116, 1)) >glo_C1_public : Symbol(glo_C1_public, Decl(privacyVar.ts, 116, 1)) public glo_C3_v22_public: glo_C1_public = new glo_C1_public(); ->glo_C3_v22_public : Symbol(glo_C3_v22_public, Decl(privacyVar.ts, 137, 68)) +>glo_C3_v22_public : Symbol(glo_C3_public.glo_C3_v22_public, Decl(privacyVar.ts, 137, 68)) >glo_C1_public : Symbol(glo_C1_public, Decl(privacyVar.ts, 116, 1)) >glo_C1_public : Symbol(glo_C1_public, Decl(privacyVar.ts, 116, 1)) private glo_C3_v23_private: glo_C2_private = new glo_C2_private(); ->glo_C3_v23_private : Symbol(glo_C3_v23_private, Decl(privacyVar.ts, 138, 66)) +>glo_C3_v23_private : Symbol(glo_C3_public.glo_C3_v23_private, Decl(privacyVar.ts, 138, 66)) >glo_C2_private : Symbol(glo_C2_private, Decl(privacyVar.ts, 121, 1)) >glo_C2_private : Symbol(glo_C2_private, Decl(privacyVar.ts, 121, 1)) public glo_C3_v24_public: glo_C2_private = new glo_C2_private(); //error ->glo_C3_v24_public : Symbol(glo_C3_v24_public, Decl(privacyVar.ts, 139, 70)) +>glo_C3_v24_public : Symbol(glo_C3_public.glo_C3_v24_public, Decl(privacyVar.ts, 139, 70)) >glo_C2_private : Symbol(glo_C2_private, Decl(privacyVar.ts, 121, 1)) >glo_C2_private : Symbol(glo_C2_private, Decl(privacyVar.ts, 121, 1)) } @@ -431,54 +431,54 @@ class glo_C4_public { >glo_C4_public : Symbol(glo_C4_public, Decl(privacyVar.ts, 141, 1)) private glo_C4_v1_private: glo_C1_public; ->glo_C4_v1_private : Symbol(glo_C4_v1_private, Decl(privacyVar.ts, 143, 21)) +>glo_C4_v1_private : Symbol(glo_C4_public.glo_C4_v1_private, Decl(privacyVar.ts, 143, 21)) >glo_C1_public : Symbol(glo_C1_public, Decl(privacyVar.ts, 116, 1)) public glo_C4_v2_public: glo_C1_public; ->glo_C4_v2_public : Symbol(glo_C4_v2_public, Decl(privacyVar.ts, 144, 45)) +>glo_C4_v2_public : Symbol(glo_C4_public.glo_C4_v2_public, Decl(privacyVar.ts, 144, 45)) >glo_C1_public : Symbol(glo_C1_public, Decl(privacyVar.ts, 116, 1)) private glo_C4_v3_private: glo_C2_private; ->glo_C4_v3_private : Symbol(glo_C4_v3_private, Decl(privacyVar.ts, 145, 43)) +>glo_C4_v3_private : Symbol(glo_C4_public.glo_C4_v3_private, Decl(privacyVar.ts, 145, 43)) >glo_C2_private : Symbol(glo_C2_private, Decl(privacyVar.ts, 121, 1)) public glo_C4_v4_public: glo_C2_private; ->glo_C4_v4_public : Symbol(glo_C4_v4_public, Decl(privacyVar.ts, 146, 46)) +>glo_C4_v4_public : Symbol(glo_C4_public.glo_C4_v4_public, Decl(privacyVar.ts, 146, 46)) >glo_C2_private : Symbol(glo_C2_private, Decl(privacyVar.ts, 121, 1)) private glo_C4_v11_private = new glo_C1_public(); ->glo_C4_v11_private : Symbol(glo_C4_v11_private, Decl(privacyVar.ts, 147, 44)) +>glo_C4_v11_private : Symbol(glo_C4_public.glo_C4_v11_private, Decl(privacyVar.ts, 147, 44)) >glo_C1_public : Symbol(glo_C1_public, Decl(privacyVar.ts, 116, 1)) public glo_C4_v12_public = new glo_C1_public(); ->glo_C4_v12_public : Symbol(glo_C4_v12_public, Decl(privacyVar.ts, 149, 53)) +>glo_C4_v12_public : Symbol(glo_C4_public.glo_C4_v12_public, Decl(privacyVar.ts, 149, 53)) >glo_C1_public : Symbol(glo_C1_public, Decl(privacyVar.ts, 116, 1)) private glo_C4_v13_private = new glo_C2_private(); ->glo_C4_v13_private : Symbol(glo_C4_v13_private, Decl(privacyVar.ts, 150, 51)) +>glo_C4_v13_private : Symbol(glo_C4_public.glo_C4_v13_private, Decl(privacyVar.ts, 150, 51)) >glo_C2_private : Symbol(glo_C2_private, Decl(privacyVar.ts, 121, 1)) public glo_C4_v14_public = new glo_C2_private(); ->glo_C4_v14_public : Symbol(glo_C4_v14_public, Decl(privacyVar.ts, 151, 54)) +>glo_C4_v14_public : Symbol(glo_C4_public.glo_C4_v14_public, Decl(privacyVar.ts, 151, 54)) >glo_C2_private : Symbol(glo_C2_private, Decl(privacyVar.ts, 121, 1)) private glo_C4_v21_private: glo_C1_public = new glo_C1_public(); ->glo_C4_v21_private : Symbol(glo_C4_v21_private, Decl(privacyVar.ts, 152, 52)) +>glo_C4_v21_private : Symbol(glo_C4_public.glo_C4_v21_private, Decl(privacyVar.ts, 152, 52)) >glo_C1_public : Symbol(glo_C1_public, Decl(privacyVar.ts, 116, 1)) >glo_C1_public : Symbol(glo_C1_public, Decl(privacyVar.ts, 116, 1)) public glo_C4_v22_public: glo_C1_public = new glo_C1_public(); ->glo_C4_v22_public : Symbol(glo_C4_v22_public, Decl(privacyVar.ts, 154, 68)) +>glo_C4_v22_public : Symbol(glo_C4_public.glo_C4_v22_public, Decl(privacyVar.ts, 154, 68)) >glo_C1_public : Symbol(glo_C1_public, Decl(privacyVar.ts, 116, 1)) >glo_C1_public : Symbol(glo_C1_public, Decl(privacyVar.ts, 116, 1)) private glo_C4_v23_private: glo_C2_private = new glo_C2_private(); ->glo_C4_v23_private : Symbol(glo_C4_v23_private, Decl(privacyVar.ts, 155, 66)) +>glo_C4_v23_private : Symbol(glo_C4_public.glo_C4_v23_private, Decl(privacyVar.ts, 155, 66)) >glo_C2_private : Symbol(glo_C2_private, Decl(privacyVar.ts, 121, 1)) >glo_C2_private : Symbol(glo_C2_private, Decl(privacyVar.ts, 121, 1)) public glo_C4_v24_public: glo_C2_private = new glo_C2_private(); ->glo_C4_v24_public : Symbol(glo_C4_v24_public, Decl(privacyVar.ts, 156, 70)) +>glo_C4_v24_public : Symbol(glo_C4_public.glo_C4_v24_public, Decl(privacyVar.ts, 156, 70)) >glo_C2_private : Symbol(glo_C2_private, Decl(privacyVar.ts, 121, 1)) >glo_C2_private : Symbol(glo_C2_private, Decl(privacyVar.ts, 121, 1)) } diff --git a/tests/baselines/reference/privateAccessInSubclass1.errors.txt b/tests/baselines/reference/privateAccessInSubclass1.errors.txt index 5ffb876a728..6464a2f6d78 100644 --- a/tests/baselines/reference/privateAccessInSubclass1.errors.txt +++ b/tests/baselines/reference/privateAccessInSubclass1.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/privateAccessInSubclass1.ts(7,5): error TS2341: Property 'options' is private and only accessible within class 'Base'. +tests/cases/compiler/privateAccessInSubclass1.ts(7,10): error TS2341: Property 'options' is private and only accessible within class 'Base'. ==== tests/cases/compiler/privateAccessInSubclass1.ts (1 errors) ==== @@ -9,7 +9,7 @@ tests/cases/compiler/privateAccessInSubclass1.ts(7,5): error TS2341: Property 'o class D extends Base { myMethod() { this.options; - ~~~~~~~~~~~~ + ~~~~~~~ !!! error TS2341: Property 'options' is private and only accessible within class 'Base'. } } \ No newline at end of file diff --git a/tests/baselines/reference/privateClassPropertyAccessibleWithinNestedClass.js b/tests/baselines/reference/privateClassPropertyAccessibleWithinNestedClass.js new file mode 100644 index 00000000000..3bb0a7da3ea --- /dev/null +++ b/tests/baselines/reference/privateClassPropertyAccessibleWithinNestedClass.js @@ -0,0 +1,84 @@ +//// [privateClassPropertyAccessibleWithinNestedClass.ts] +// no errors + +class C { + private x: string; + private get y() { return this.x; } + private set y(x) { this.y = this.x; } + private foo() { return this.foo; } + + private static x: string; + private static get y() { return this.x; } + private static set y(x) { this.y = this.x; } + private static foo() { return this.foo; } + private static bar() { this.foo(); } + + private bar() { + class C2 { + private foo() { + let x: C; + var x1 = x.foo; + var x2 = x.bar; + var x3 = x.x; + var x4 = x.y; + + var sx1 = C.x; + var sx2 = C.y; + var sx3 = C.bar; + var sx4 = C.foo; + + let y = new C(); + var y1 = y.foo; + var y2 = y.bar; + var y3 = y.x; + var y4 = y.y; + } + } + } +} + +//// [privateClassPropertyAccessibleWithinNestedClass.js] +// no errors +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, "y", { + get: function () { return this.x; }, + set: function (x) { this.y = this.x; }, + enumerable: true, + configurable: true + }); + C.prototype.foo = function () { return this.foo; }; + Object.defineProperty(C, "y", { + get: function () { return this.x; }, + set: function (x) { this.y = this.x; }, + enumerable: true, + configurable: true + }); + C.foo = function () { return this.foo; }; + C.bar = function () { this.foo(); }; + C.prototype.bar = function () { + var C2 = (function () { + function C2() { + } + C2.prototype.foo = function () { + var x; + var x1 = x.foo; + var x2 = x.bar; + var x3 = x.x; + var x4 = x.y; + var sx1 = C.x; + var sx2 = C.y; + var sx3 = C.bar; + var sx4 = C.foo; + var y = new C(); + var y1 = y.foo; + var y2 = y.bar; + var y3 = y.x; + var y4 = y.y; + }; + return C2; + }()); + }; + return C; +}()); diff --git a/tests/baselines/reference/privateClassPropertyAccessibleWithinNestedClass.symbols b/tests/baselines/reference/privateClassPropertyAccessibleWithinNestedClass.symbols new file mode 100644 index 00000000000..4aa6e6df5d9 --- /dev/null +++ b/tests/baselines/reference/privateClassPropertyAccessibleWithinNestedClass.symbols @@ -0,0 +1,154 @@ +=== tests/cases/conformance/classes/members/accessibility/privateClassPropertyAccessibleWithinNestedClass.ts === +// no errors + +class C { +>C : Symbol(C, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 0, 0)) + + private x: string; +>x : Symbol(C.x, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 2, 9)) + + private get y() { return this.x; } +>y : Symbol(C.y, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 3, 22), Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 4, 38)) +>this.x : Symbol(C.x, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 2, 9)) +>this : Symbol(C, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 0, 0)) +>x : Symbol(C.x, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 2, 9)) + + private set y(x) { this.y = this.x; } +>y : Symbol(C.y, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 3, 22), Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 4, 38)) +>x : Symbol(x, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 5, 18)) +>this.y : Symbol(C.y, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 3, 22), Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 4, 38)) +>this : Symbol(C, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 0, 0)) +>y : Symbol(C.y, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 3, 22), Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 4, 38)) +>this.x : Symbol(C.x, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 2, 9)) +>this : Symbol(C, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 0, 0)) +>x : Symbol(C.x, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 2, 9)) + + private foo() { return this.foo; } +>foo : Symbol(C.foo, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 5, 41)) +>this.foo : Symbol(C.foo, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 5, 41)) +>this : Symbol(C, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 0, 0)) +>foo : Symbol(C.foo, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 5, 41)) + + private static x: string; +>x : Symbol(C.x, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 6, 38)) + + private static get y() { return this.x; } +>y : Symbol(C.y, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 8, 29), Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 9, 45)) +>this.x : Symbol(C.x, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 6, 38)) +>this : Symbol(C, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 0, 0)) +>x : Symbol(C.x, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 6, 38)) + + private static set y(x) { this.y = this.x; } +>y : Symbol(C.y, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 8, 29), Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 9, 45)) +>x : Symbol(x, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 10, 25)) +>this.y : Symbol(C.y, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 8, 29), Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 9, 45)) +>this : Symbol(C, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 0, 0)) +>y : Symbol(C.y, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 8, 29), Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 9, 45)) +>this.x : Symbol(C.x, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 6, 38)) +>this : Symbol(C, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 0, 0)) +>x : Symbol(C.x, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 6, 38)) + + private static foo() { return this.foo; } +>foo : Symbol(C.foo, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 10, 48)) +>this.foo : Symbol(C.foo, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 10, 48)) +>this : Symbol(C, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 0, 0)) +>foo : Symbol(C.foo, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 10, 48)) + + private static bar() { this.foo(); } +>bar : Symbol(C.bar, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 11, 45)) +>this.foo : Symbol(C.foo, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 10, 48)) +>this : Symbol(C, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 0, 0)) +>foo : Symbol(C.foo, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 10, 48)) + + private bar() { +>bar : Symbol(C.bar, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 12, 40)) + + class C2 { +>C2 : Symbol(C2, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 14, 19)) + + private foo() { +>foo : Symbol(C2.foo, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 15, 18)) + + let x: C; +>x : Symbol(x, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 17, 19)) +>C : Symbol(C, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 0, 0)) + + var x1 = x.foo; +>x1 : Symbol(x1, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 18, 19)) +>x.foo : Symbol(C.foo, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 5, 41)) +>x : Symbol(x, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 17, 19)) +>foo : Symbol(C.foo, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 5, 41)) + + var x2 = x.bar; +>x2 : Symbol(x2, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 19, 19)) +>x.bar : Symbol(C.bar, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 12, 40)) +>x : Symbol(x, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 17, 19)) +>bar : Symbol(C.bar, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 12, 40)) + + var x3 = x.x; +>x3 : Symbol(x3, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 20, 19)) +>x.x : Symbol(C.x, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 2, 9)) +>x : Symbol(x, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 17, 19)) +>x : Symbol(C.x, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 2, 9)) + + var x4 = x.y; +>x4 : Symbol(x4, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 21, 19)) +>x.y : Symbol(C.y, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 3, 22), Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 4, 38)) +>x : Symbol(x, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 17, 19)) +>y : Symbol(C.y, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 3, 22), Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 4, 38)) + + var sx1 = C.x; +>sx1 : Symbol(sx1, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 23, 19)) +>C.x : Symbol(C.x, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 6, 38)) +>C : Symbol(C, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 0, 0)) +>x : Symbol(C.x, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 6, 38)) + + var sx2 = C.y; +>sx2 : Symbol(sx2, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 24, 19)) +>C.y : Symbol(C.y, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 8, 29), Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 9, 45)) +>C : Symbol(C, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 0, 0)) +>y : Symbol(C.y, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 8, 29), Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 9, 45)) + + var sx3 = C.bar; +>sx3 : Symbol(sx3, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 25, 19)) +>C.bar : Symbol(C.bar, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 11, 45)) +>C : Symbol(C, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 0, 0)) +>bar : Symbol(C.bar, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 11, 45)) + + var sx4 = C.foo; +>sx4 : Symbol(sx4, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 26, 19)) +>C.foo : Symbol(C.foo, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 10, 48)) +>C : Symbol(C, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 0, 0)) +>foo : Symbol(C.foo, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 10, 48)) + + let y = new C(); +>y : Symbol(y, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 28, 19)) +>C : Symbol(C, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 0, 0)) + + var y1 = y.foo; +>y1 : Symbol(y1, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 29, 19)) +>y.foo : Symbol(C.foo, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 5, 41)) +>y : Symbol(y, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 28, 19)) +>foo : Symbol(C.foo, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 5, 41)) + + var y2 = y.bar; +>y2 : Symbol(y2, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 30, 19)) +>y.bar : Symbol(C.bar, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 12, 40)) +>y : Symbol(y, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 28, 19)) +>bar : Symbol(C.bar, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 12, 40)) + + var y3 = y.x; +>y3 : Symbol(y3, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 31, 19)) +>y.x : Symbol(C.x, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 2, 9)) +>y : Symbol(y, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 28, 19)) +>x : Symbol(C.x, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 2, 9)) + + var y4 = y.y; +>y4 : Symbol(y4, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 32, 19)) +>y.y : Symbol(C.y, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 3, 22), Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 4, 38)) +>y : Symbol(y, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 28, 19)) +>y : Symbol(C.y, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 3, 22), Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 4, 38)) + } + } + } +} diff --git a/tests/baselines/reference/privateClassPropertyAccessibleWithinNestedClass.types b/tests/baselines/reference/privateClassPropertyAccessibleWithinNestedClass.types new file mode 100644 index 00000000000..ee8eb82b940 --- /dev/null +++ b/tests/baselines/reference/privateClassPropertyAccessibleWithinNestedClass.types @@ -0,0 +1,158 @@ +=== tests/cases/conformance/classes/members/accessibility/privateClassPropertyAccessibleWithinNestedClass.ts === +// no errors + +class C { +>C : C + + private x: string; +>x : string + + private get y() { return this.x; } +>y : string +>this.x : string +>this : this +>x : string + + private set y(x) { this.y = this.x; } +>y : string +>x : string +>this.y = this.x : string +>this.y : string +>this : this +>y : string +>this.x : string +>this : this +>x : string + + private foo() { return this.foo; } +>foo : () => any +>this.foo : () => any +>this : this +>foo : () => any + + private static x: string; +>x : string + + private static get y() { return this.x; } +>y : string +>this.x : string +>this : typeof C +>x : string + + private static set y(x) { this.y = this.x; } +>y : string +>x : string +>this.y = this.x : string +>this.y : string +>this : typeof C +>y : string +>this.x : string +>this : typeof C +>x : string + + private static foo() { return this.foo; } +>foo : () => typeof C.foo +>this.foo : () => typeof C.foo +>this : typeof C +>foo : () => typeof C.foo + + private static bar() { this.foo(); } +>bar : () => void +>this.foo() : () => typeof C.foo +>this.foo : () => typeof C.foo +>this : typeof C +>foo : () => typeof C.foo + + private bar() { +>bar : () => void + + class C2 { +>C2 : C2 + + private foo() { +>foo : () => void + + let x: C; +>x : C +>C : C + + var x1 = x.foo; +>x1 : () => any +>x.foo : () => any +>x : C +>foo : () => any + + var x2 = x.bar; +>x2 : () => void +>x.bar : () => void +>x : C +>bar : () => void + + var x3 = x.x; +>x3 : string +>x.x : string +>x : C +>x : string + + var x4 = x.y; +>x4 : string +>x.y : string +>x : C +>y : string + + var sx1 = C.x; +>sx1 : string +>C.x : string +>C : typeof C +>x : string + + var sx2 = C.y; +>sx2 : string +>C.y : string +>C : typeof C +>y : string + + var sx3 = C.bar; +>sx3 : () => void +>C.bar : () => void +>C : typeof C +>bar : () => void + + var sx4 = C.foo; +>sx4 : () => typeof C.foo +>C.foo : () => typeof C.foo +>C : typeof C +>foo : () => typeof C.foo + + let y = new C(); +>y : C +>new C() : C +>C : typeof C + + var y1 = y.foo; +>y1 : () => any +>y.foo : () => any +>y : C +>foo : () => any + + var y2 = y.bar; +>y2 : () => void +>y.bar : () => void +>y : C +>bar : () => void + + var y3 = y.x; +>y3 : string +>y.x : string +>y : C +>x : string + + var y4 = y.y; +>y4 : string +>y.y : string +>y : C +>y : string + } + } + } +} diff --git a/tests/baselines/reference/privateIndexer.errors.txt b/tests/baselines/reference/privateIndexer.errors.txt index 5d8ae7c9351..5ee21d8e4e3 100644 --- a/tests/baselines/reference/privateIndexer.errors.txt +++ b/tests/baselines/reference/privateIndexer.errors.txt @@ -1,6 +1,6 @@ -tests/cases/conformance/classes/indexMemberDeclarations/privateIndexer.ts(4,5): error TS1145: Modifiers not permitted on index signature members. -tests/cases/conformance/classes/indexMemberDeclarations/privateIndexer.ts(8,5): error TS1145: Modifiers not permitted on index signature members. -tests/cases/conformance/classes/indexMemberDeclarations/privateIndexer.ts(12,5): error TS1145: Modifiers not permitted on index signature members. +tests/cases/conformance/classes/indexMemberDeclarations/privateIndexer.ts(4,5): error TS1071: 'private' modifier cannot appear on an index signature. +tests/cases/conformance/classes/indexMemberDeclarations/privateIndexer.ts(8,5): error TS1071: 'private' modifier cannot appear on an index signature. +tests/cases/conformance/classes/indexMemberDeclarations/privateIndexer.ts(12,5): error TS1071: 'private' modifier cannot appear on an index signature. ==== tests/cases/conformance/classes/indexMemberDeclarations/privateIndexer.ts (3 errors) ==== @@ -9,17 +9,17 @@ tests/cases/conformance/classes/indexMemberDeclarations/privateIndexer.ts(12,5): class C { private [x: string]: string; ~~~~~~~ -!!! error TS1145: Modifiers not permitted on index signature members. +!!! error TS1071: 'private' modifier cannot appear on an index signature. } class D { private [x: number]: string; ~~~~~~~ -!!! error TS1145: Modifiers not permitted on index signature members. +!!! error TS1071: 'private' modifier cannot appear on an index signature. } class E { private [x: string]: T; ~~~~~~~ -!!! error TS1145: Modifiers not permitted on index signature members. +!!! error TS1071: 'private' modifier cannot appear on an index signature. } \ No newline at end of file diff --git a/tests/baselines/reference/privateInstanceVisibility.symbols b/tests/baselines/reference/privateInstanceVisibility.symbols index d537c05c798..3304e4b31f3 100644 --- a/tests/baselines/reference/privateInstanceVisibility.symbols +++ b/tests/baselines/reference/privateInstanceVisibility.symbols @@ -6,12 +6,12 @@ module Test { >Example : Symbol(Example, Decl(privateInstanceVisibility.ts, 0, 13)) private someNumber: number; ->someNumber : Symbol(someNumber, Decl(privateInstanceVisibility.ts, 2, 26)) +>someNumber : Symbol(Example.someNumber, Decl(privateInstanceVisibility.ts, 2, 26)) public doSomething() { ->doSomething : Symbol(doSomething, Decl(privateInstanceVisibility.ts, 4, 35)) +>doSomething : Symbol(Example.doSomething, Decl(privateInstanceVisibility.ts, 4, 35)) var that = this; >that : Symbol(that, Decl(privateInstanceVisibility.ts, 10, 15)) @@ -22,9 +22,9 @@ module Test { var num = that.someNumber; >num : Symbol(num, Decl(privateInstanceVisibility.ts, 14, 19)) ->that.someNumber : Symbol(someNumber, Decl(privateInstanceVisibility.ts, 2, 26)) +>that.someNumber : Symbol(Example.someNumber, Decl(privateInstanceVisibility.ts, 2, 26)) >that : Symbol(that, Decl(privateInstanceVisibility.ts, 10, 15)) ->someNumber : Symbol(someNumber, Decl(privateInstanceVisibility.ts, 2, 26)) +>someNumber : Symbol(Example.someNumber, Decl(privateInstanceVisibility.ts, 2, 26)) } @@ -40,26 +40,26 @@ class C { >C : Symbol(C, Decl(privateInstanceVisibility.ts, 22, 1)) private x: number; ->x : Symbol(x, Decl(privateInstanceVisibility.ts, 26, 9)) +>x : Symbol(C.x, Decl(privateInstanceVisibility.ts, 26, 9)) getX() { return this.x; } ->getX : Symbol(getX, Decl(privateInstanceVisibility.ts, 28, 22)) ->this.x : Symbol(x, Decl(privateInstanceVisibility.ts, 26, 9)) +>getX : Symbol(C.getX, Decl(privateInstanceVisibility.ts, 28, 22)) +>this.x : Symbol(C.x, Decl(privateInstanceVisibility.ts, 26, 9)) >this : Symbol(C, Decl(privateInstanceVisibility.ts, 22, 1)) ->x : Symbol(x, Decl(privateInstanceVisibility.ts, 26, 9)) +>x : Symbol(C.x, Decl(privateInstanceVisibility.ts, 26, 9)) clone(other: C) { ->clone : Symbol(clone, Decl(privateInstanceVisibility.ts, 30, 29)) +>clone : Symbol(C.clone, Decl(privateInstanceVisibility.ts, 30, 29)) >other : Symbol(other, Decl(privateInstanceVisibility.ts, 32, 10)) >C : Symbol(C, Decl(privateInstanceVisibility.ts, 22, 1)) this.x = other.x; ->this.x : Symbol(x, Decl(privateInstanceVisibility.ts, 26, 9)) +>this.x : Symbol(C.x, Decl(privateInstanceVisibility.ts, 26, 9)) >this : Symbol(C, Decl(privateInstanceVisibility.ts, 22, 1)) ->x : Symbol(x, Decl(privateInstanceVisibility.ts, 26, 9)) ->other.x : Symbol(x, Decl(privateInstanceVisibility.ts, 26, 9)) +>x : Symbol(C.x, Decl(privateInstanceVisibility.ts, 26, 9)) +>other.x : Symbol(C.x, Decl(privateInstanceVisibility.ts, 26, 9)) >other : Symbol(other, Decl(privateInstanceVisibility.ts, 32, 10)) ->x : Symbol(x, Decl(privateInstanceVisibility.ts, 26, 9)) +>x : Symbol(C.x, Decl(privateInstanceVisibility.ts, 26, 9)) } } diff --git a/tests/baselines/reference/privatePropertyUsingObjectType.symbols b/tests/baselines/reference/privatePropertyUsingObjectType.symbols index 094294b6dc0..ac968385afa 100644 --- a/tests/baselines/reference/privatePropertyUsingObjectType.symbols +++ b/tests/baselines/reference/privatePropertyUsingObjectType.symbols @@ -3,22 +3,22 @@ export class FilterManager { >FilterManager : Symbol(FilterManager, Decl(privatePropertyUsingObjectType.ts, 0, 0)) private _filterProviders: { index: IFilterProvider; }; ->_filterProviders : Symbol(_filterProviders, Decl(privatePropertyUsingObjectType.ts, 0, 28)) +>_filterProviders : Symbol(FilterManager._filterProviders, Decl(privatePropertyUsingObjectType.ts, 0, 28)) >index : Symbol(index, Decl(privatePropertyUsingObjectType.ts, 1, 31)) >IFilterProvider : Symbol(IFilterProvider, Decl(privatePropertyUsingObjectType.ts, 5, 1)) private _filterProviders2: { [index: number]: IFilterProvider; }; ->_filterProviders2 : Symbol(_filterProviders2, Decl(privatePropertyUsingObjectType.ts, 1, 58)) +>_filterProviders2 : Symbol(FilterManager._filterProviders2, Decl(privatePropertyUsingObjectType.ts, 1, 58)) >index : Symbol(index, Decl(privatePropertyUsingObjectType.ts, 2, 34)) >IFilterProvider : Symbol(IFilterProvider, Decl(privatePropertyUsingObjectType.ts, 5, 1)) private _filterProviders3: { (index: number): IFilterProvider; }; ->_filterProviders3 : Symbol(_filterProviders3, Decl(privatePropertyUsingObjectType.ts, 2, 69)) +>_filterProviders3 : Symbol(FilterManager._filterProviders3, Decl(privatePropertyUsingObjectType.ts, 2, 69)) >index : Symbol(index, Decl(privatePropertyUsingObjectType.ts, 3, 34)) >IFilterProvider : Symbol(IFilterProvider, Decl(privatePropertyUsingObjectType.ts, 5, 1)) private _filterProviders4: (index: number) => IFilterProvider; ->_filterProviders4 : Symbol(_filterProviders4, Decl(privatePropertyUsingObjectType.ts, 3, 69)) +>_filterProviders4 : Symbol(FilterManager._filterProviders4, Decl(privatePropertyUsingObjectType.ts, 3, 69)) >index : Symbol(index, Decl(privatePropertyUsingObjectType.ts, 4, 32)) >IFilterProvider : Symbol(IFilterProvider, Decl(privatePropertyUsingObjectType.ts, 5, 1)) } diff --git a/tests/baselines/reference/privateProtectedMembersAreNotAccessibleDestructuring.errors.txt b/tests/baselines/reference/privateProtectedMembersAreNotAccessibleDestructuring.errors.txt new file mode 100644 index 00000000000..40568c4fb85 --- /dev/null +++ b/tests/baselines/reference/privateProtectedMembersAreNotAccessibleDestructuring.errors.txt @@ -0,0 +1,45 @@ +tests/cases/conformance/classes/members/accessibility/privateProtectedMembersAreNotAccessibleDestructuring.ts(12,13): error TS2341: Property 'priv' is private and only accessible within class 'K'. +tests/cases/conformance/classes/members/accessibility/privateProtectedMembersAreNotAccessibleDestructuring.ts(17,5): error TS2341: Property 'priv' is private and only accessible within class 'K'. +tests/cases/conformance/classes/members/accessibility/privateProtectedMembersAreNotAccessibleDestructuring.ts(18,5): error TS2445: Property 'prot' is protected and only accessible within class 'K' and its subclasses. +tests/cases/conformance/classes/members/accessibility/privateProtectedMembersAreNotAccessibleDestructuring.ts(19,5): error TS2341: Property 'privateMethod' is private and only accessible within class 'K'. +tests/cases/conformance/classes/members/accessibility/privateProtectedMembersAreNotAccessibleDestructuring.ts(20,5): error TS2341: Property 'priv' is private and only accessible within class 'K'. +tests/cases/conformance/classes/members/accessibility/privateProtectedMembersAreNotAccessibleDestructuring.ts(20,5): error TS2341: Property 'privateMethod' is private and only accessible within class 'K'. +tests/cases/conformance/classes/members/accessibility/privateProtectedMembersAreNotAccessibleDestructuring.ts(20,5): error TS2445: Property 'prot' is protected and only accessible within class 'K' and its subclasses. + + +==== tests/cases/conformance/classes/members/accessibility/privateProtectedMembersAreNotAccessibleDestructuring.ts (7 errors) ==== + class K { + private priv; + protected prot; + private privateMethod() { } + m() { + let { priv: a, prot: b } = this; // ok + let { priv, prot } = new K(); // ok + } + } + class C extends K { + m2() { + let { priv: a } = this; // error + ~~~~~~~~~~~ +!!! error TS2341: Property 'priv' is private and only accessible within class 'K'. + let { prot: b } = this; // ok + } + } + let k = new K(); + let { priv } = k; // error + ~~~~~~~~ +!!! error TS2341: Property 'priv' is private and only accessible within class 'K'. + let { prot } = k; // error + ~~~~~~~~ +!!! error TS2445: Property 'prot' is protected and only accessible within class 'K' and its subclasses. + let { privateMethod } = k; // error + ~~~~~~~~~~~~~~~~~ +!!! error TS2341: Property 'privateMethod' is private and only accessible within class 'K'. + let { priv: a, prot: b, privateMethod: f } = k; // error + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2341: Property 'priv' is private and only accessible within class 'K'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2341: Property 'privateMethod' is private and only accessible within class 'K'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2445: Property 'prot' is protected and only accessible within class 'K' and its subclasses. + \ No newline at end of file diff --git a/tests/baselines/reference/privateProtectedMembersAreNotAccessibleDestructuring.js b/tests/baselines/reference/privateProtectedMembersAreNotAccessibleDestructuring.js new file mode 100644 index 00000000000..058a6ba1b65 --- /dev/null +++ b/tests/baselines/reference/privateProtectedMembersAreNotAccessibleDestructuring.js @@ -0,0 +1,55 @@ +//// [privateProtectedMembersAreNotAccessibleDestructuring.ts] +class K { + private priv; + protected prot; + private privateMethod() { } + m() { + let { priv: a, prot: b } = this; // ok + let { priv, prot } = new K(); // ok + } +} +class C extends K { + m2() { + let { priv: a } = this; // error + let { prot: b } = this; // ok + } +} +let k = new K(); +let { priv } = k; // error +let { prot } = k; // error +let { privateMethod } = k; // error +let { priv: a, prot: b, privateMethod: f } = k; // error + + +//// [privateProtectedMembersAreNotAccessibleDestructuring.js] +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var K = (function () { + function K() { + } + K.prototype.privateMethod = function () { }; + K.prototype.m = function () { + var _a = this, a = _a.priv, b = _a.prot; // ok + var _b = new K(), priv = _b.priv, prot = _b.prot; // ok + }; + return K; +}()); +var C = (function (_super) { + __extends(C, _super); + function C() { + _super.apply(this, arguments); + } + C.prototype.m2 = function () { + var a = this.priv; // error + var b = this.prot; // ok + }; + return C; +}(K)); +var k = new K(); +var priv = k.priv; // error +var prot = k.prot; // error +var privateMethod = k.privateMethod; // error +var a = k.priv, b = k.prot, f = k.privateMethod; // error diff --git a/tests/baselines/reference/privateStaticMemberAccessibility.errors.txt b/tests/baselines/reference/privateStaticMemberAccessibility.errors.txt index 4ec16f02045..4c6b8328f75 100644 --- a/tests/baselines/reference/privateStaticMemberAccessibility.errors.txt +++ b/tests/baselines/reference/privateStaticMemberAccessibility.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/classes/members/accessibility/privateStaticMemberAccessibility.ts(6,18): error TS2341: Property 'foo' is private and only accessible within class 'Base'. -tests/cases/conformance/classes/members/accessibility/privateStaticMemberAccessibility.ts(7,18): error TS2341: Property 'foo' is private and only accessible within class 'Base'. +tests/cases/conformance/classes/members/accessibility/privateStaticMemberAccessibility.ts(6,23): error TS2341: Property 'foo' is private and only accessible within class 'Base'. +tests/cases/conformance/classes/members/accessibility/privateStaticMemberAccessibility.ts(7,23): error TS2341: Property 'foo' is private and only accessible within class 'Base'. ==== tests/cases/conformance/classes/members/accessibility/privateStaticMemberAccessibility.ts (2 errors) ==== @@ -9,9 +9,9 @@ tests/cases/conformance/classes/members/accessibility/privateStaticMemberAccessi class Derived extends Base { static bar = Base.foo; // error - ~~~~~~~~ + ~~~ !!! error TS2341: Property 'foo' is private and only accessible within class 'Base'. bing = () => Base.foo; // error - ~~~~~~~~ + ~~~ !!! error TS2341: Property 'foo' is private and only accessible within class 'Base'. } \ No newline at end of file diff --git a/tests/baselines/reference/privateStaticNotAccessibleInClodule.errors.txt b/tests/baselines/reference/privateStaticNotAccessibleInClodule.errors.txt index a5834b6cd0f..a5fd1d76400 100644 --- a/tests/baselines/reference/privateStaticNotAccessibleInClodule.errors.txt +++ b/tests/baselines/reference/privateStaticNotAccessibleInClodule.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/classes/members/accessibility/privateStaticNotAccessibleInClodule.ts(9,20): error TS2341: Property 'bar' is private and only accessible within class 'C'. +tests/cases/conformance/classes/members/accessibility/privateStaticNotAccessibleInClodule.ts(9,22): error TS2341: Property 'bar' is private and only accessible within class 'C'. ==== tests/cases/conformance/classes/members/accessibility/privateStaticNotAccessibleInClodule.ts (1 errors) ==== @@ -11,6 +11,6 @@ tests/cases/conformance/classes/members/accessibility/privateStaticNotAccessible module C { export var y = C.bar; // error - ~~~~~ + ~~~ !!! error TS2341: Property 'bar' is private and only accessible within class 'C'. } \ No newline at end of file diff --git a/tests/baselines/reference/privateStaticNotAccessibleInClodule2.errors.txt b/tests/baselines/reference/privateStaticNotAccessibleInClodule2.errors.txt index 950649ee4b2..2d0534b02c7 100644 --- a/tests/baselines/reference/privateStaticNotAccessibleInClodule2.errors.txt +++ b/tests/baselines/reference/privateStaticNotAccessibleInClodule2.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/classes/members/accessibility/privateStaticNotAccessibleInClodule2.ts(13,20): error TS2341: Property 'bar' is private and only accessible within class 'C'. +tests/cases/conformance/classes/members/accessibility/privateStaticNotAccessibleInClodule2.ts(13,22): error TS2341: Property 'bar' is private and only accessible within class 'C'. ==== tests/cases/conformance/classes/members/accessibility/privateStaticNotAccessibleInClodule2.ts (1 errors) ==== @@ -15,6 +15,6 @@ tests/cases/conformance/classes/members/accessibility/privateStaticNotAccessible module D { export var y = D.bar; // error - ~~~~~ + ~~~ !!! error TS2341: Property 'bar' is private and only accessible within class 'C'. } \ No newline at end of file diff --git a/tests/baselines/reference/privateVisibility.errors.txt b/tests/baselines/reference/privateVisibility.errors.txt index 88784706f43..fc4889f82a9 100644 --- a/tests/baselines/reference/privateVisibility.errors.txt +++ b/tests/baselines/reference/privateVisibility.errors.txt @@ -1,6 +1,6 @@ -tests/cases/compiler/privateVisibility.ts(9,1): error TS2341: Property 'privMeth' is private and only accessible within class 'Foo'. -tests/cases/compiler/privateVisibility.ts(10,1): error TS2341: Property 'privProp' is private and only accessible within class 'Foo'. -tests/cases/compiler/privateVisibility.ts(24,1): error TS2341: Property 'priv' is private and only accessible within class 'C'. +tests/cases/compiler/privateVisibility.ts(9,3): error TS2341: Property 'privMeth' is private and only accessible within class 'Foo'. +tests/cases/compiler/privateVisibility.ts(10,3): error TS2341: Property 'privProp' is private and only accessible within class 'Foo'. +tests/cases/compiler/privateVisibility.ts(24,3): error TS2341: Property 'priv' is private and only accessible within class 'C'. ==== tests/cases/compiler/privateVisibility.ts (3 errors) ==== @@ -13,10 +13,10 @@ tests/cases/compiler/privateVisibility.ts(24,1): error TS2341: Property 'priv' i var f = new Foo(); f.privMeth(); // should not work - ~~~~~~~~~~ + ~~~~~~~~ !!! error TS2341: Property 'privMeth' is private and only accessible within class 'Foo'. f.privProp; // should not work - ~~~~~~~~~~ + ~~~~~~~~ !!! error TS2341: Property 'privProp' is private and only accessible within class 'Foo'. f.pubMeth(); // should work @@ -32,7 +32,7 @@ tests/cases/compiler/privateVisibility.ts(24,1): error TS2341: Property 'priv' i c.pub; // should work c.priv; // should not work - ~~~~~~ + ~~~~ !!! error TS2341: Property 'priv' is private and only accessible within class 'C'. \ No newline at end of file diff --git a/tests/baselines/reference/privateVisibles.symbols b/tests/baselines/reference/privateVisibles.symbols index 5dda2315add..0d5d0105737 100644 --- a/tests/baselines/reference/privateVisibles.symbols +++ b/tests/baselines/reference/privateVisibles.symbols @@ -3,21 +3,21 @@ class Foo { >Foo : Symbol(Foo, Decl(privateVisibles.ts, 0, 0)) private pvar = 0; ->pvar : Symbol(pvar, Decl(privateVisibles.ts, 0, 11)) +>pvar : Symbol(Foo.pvar, Decl(privateVisibles.ts, 0, 11)) constructor() { var n = this.pvar; >n : Symbol(n, Decl(privateVisibles.ts, 3, 8)) ->this.pvar : Symbol(pvar, Decl(privateVisibles.ts, 0, 11)) +>this.pvar : Symbol(Foo.pvar, Decl(privateVisibles.ts, 0, 11)) >this : Symbol(Foo, Decl(privateVisibles.ts, 0, 0)) ->pvar : Symbol(pvar, Decl(privateVisibles.ts, 0, 11)) +>pvar : Symbol(Foo.pvar, Decl(privateVisibles.ts, 0, 11)) } public meth() { var q = this.pvar;} ->meth : Symbol(meth, Decl(privateVisibles.ts, 4, 2)) +>meth : Symbol(Foo.meth, Decl(privateVisibles.ts, 4, 2)) >q : Symbol(q, Decl(privateVisibles.ts, 6, 20)) ->this.pvar : Symbol(pvar, Decl(privateVisibles.ts, 0, 11)) +>this.pvar : Symbol(Foo.pvar, Decl(privateVisibles.ts, 0, 11)) >this : Symbol(Foo, Decl(privateVisibles.ts, 0, 0)) ->pvar : Symbol(pvar, Decl(privateVisibles.ts, 0, 11)) +>pvar : Symbol(Foo.pvar, Decl(privateVisibles.ts, 0, 11)) } diff --git a/tests/baselines/reference/project/declarationDir/amd/a.js b/tests/baselines/reference/project/declarationDir/amd/a.js new file mode 100644 index 00000000000..331c004bd67 --- /dev/null +++ b/tests/baselines/reference/project/declarationDir/amd/a.js @@ -0,0 +1,9 @@ +define(["require", "exports"], function (require, exports) { + "use strict"; + var A = (function () { + function A() { + } + return A; + }()); + exports.A = A; +}); diff --git a/tests/baselines/reference/project/declarationDir/amd/declarationDir.json b/tests/baselines/reference/project/declarationDir/amd/declarationDir.json new file mode 100644 index 00000000000..83e17dc949c --- /dev/null +++ b/tests/baselines/reference/project/declarationDir/amd/declarationDir.json @@ -0,0 +1,26 @@ +{ + "scenario": "declarationDir: specify declarationDir only", + "projectRoot": "tests/cases/projects/declarationDir", + "inputFiles": [ + "a.ts", + "subfolder/b.ts", + "subfolder/c.ts" + ], + "declaration": true, + "declarationDir": "declarations", + "baselineCheck": true, + "resolvedInputFiles": [ + "lib.d.ts", + "subfolder/b.ts", + "a.ts", + "subfolder/c.ts" + ], + "emittedFiles": [ + "subfolder/b.js", + "declarations/subfolder/b.d.ts", + "a.js", + "declarations/a.d.ts", + "subfolder/c.js", + "declarations/subfolder/c.d.ts" + ] +} \ No newline at end of file diff --git a/tests/baselines/reference/project/declarationDir/amd/declarations/a.d.ts b/tests/baselines/reference/project/declarationDir/amd/declarations/a.d.ts new file mode 100644 index 00000000000..d8c7642c262 --- /dev/null +++ b/tests/baselines/reference/project/declarationDir/amd/declarations/a.d.ts @@ -0,0 +1,4 @@ +import { B } from './subfolder/b'; +export declare class A { + b: B; +} diff --git a/tests/baselines/reference/project/declarationDir/amd/declarations/subfolder/b.d.ts b/tests/baselines/reference/project/declarationDir/amd/declarations/subfolder/b.d.ts new file mode 100644 index 00000000000..a03032c2d62 --- /dev/null +++ b/tests/baselines/reference/project/declarationDir/amd/declarations/subfolder/b.d.ts @@ -0,0 +1,2 @@ +export declare class B { +} diff --git a/tests/baselines/reference/project/declarationDir/amd/declarations/subfolder/c.d.ts b/tests/baselines/reference/project/declarationDir/amd/declarations/subfolder/c.d.ts new file mode 100644 index 00000000000..c45525d0c5f --- /dev/null +++ b/tests/baselines/reference/project/declarationDir/amd/declarations/subfolder/c.d.ts @@ -0,0 +1,4 @@ +import { A } from '../a'; +export declare class C { + a: A; +} diff --git a/tests/baselines/reference/project/declarationDir/amd/subfolder/b.js b/tests/baselines/reference/project/declarationDir/amd/subfolder/b.js new file mode 100644 index 00000000000..e2cdda8530b --- /dev/null +++ b/tests/baselines/reference/project/declarationDir/amd/subfolder/b.js @@ -0,0 +1,9 @@ +define(["require", "exports"], function (require, exports) { + "use strict"; + var B = (function () { + function B() { + } + return B; + }()); + exports.B = B; +}); diff --git a/tests/baselines/reference/project/declarationDir/amd/subfolder/c.js b/tests/baselines/reference/project/declarationDir/amd/subfolder/c.js new file mode 100644 index 00000000000..212511f2bf5 --- /dev/null +++ b/tests/baselines/reference/project/declarationDir/amd/subfolder/c.js @@ -0,0 +1,9 @@ +define(["require", "exports"], function (require, exports) { + "use strict"; + var C = (function () { + function C() { + } + return C; + }()); + exports.C = C; +}); diff --git a/tests/baselines/reference/project/declarationDir/node/a.js b/tests/baselines/reference/project/declarationDir/node/a.js new file mode 100644 index 00000000000..35f5adf27f0 --- /dev/null +++ b/tests/baselines/reference/project/declarationDir/node/a.js @@ -0,0 +1,7 @@ +"use strict"; +var A = (function () { + function A() { + } + return A; +}()); +exports.A = A; diff --git a/tests/baselines/reference/project/declarationDir/node/declarationDir.json b/tests/baselines/reference/project/declarationDir/node/declarationDir.json new file mode 100644 index 00000000000..83e17dc949c --- /dev/null +++ b/tests/baselines/reference/project/declarationDir/node/declarationDir.json @@ -0,0 +1,26 @@ +{ + "scenario": "declarationDir: specify declarationDir only", + "projectRoot": "tests/cases/projects/declarationDir", + "inputFiles": [ + "a.ts", + "subfolder/b.ts", + "subfolder/c.ts" + ], + "declaration": true, + "declarationDir": "declarations", + "baselineCheck": true, + "resolvedInputFiles": [ + "lib.d.ts", + "subfolder/b.ts", + "a.ts", + "subfolder/c.ts" + ], + "emittedFiles": [ + "subfolder/b.js", + "declarations/subfolder/b.d.ts", + "a.js", + "declarations/a.d.ts", + "subfolder/c.js", + "declarations/subfolder/c.d.ts" + ] +} \ No newline at end of file diff --git a/tests/baselines/reference/project/declarationDir/node/declarations/a.d.ts b/tests/baselines/reference/project/declarationDir/node/declarations/a.d.ts new file mode 100644 index 00000000000..d8c7642c262 --- /dev/null +++ b/tests/baselines/reference/project/declarationDir/node/declarations/a.d.ts @@ -0,0 +1,4 @@ +import { B } from './subfolder/b'; +export declare class A { + b: B; +} diff --git a/tests/baselines/reference/project/declarationDir/node/declarations/subfolder/b.d.ts b/tests/baselines/reference/project/declarationDir/node/declarations/subfolder/b.d.ts new file mode 100644 index 00000000000..a03032c2d62 --- /dev/null +++ b/tests/baselines/reference/project/declarationDir/node/declarations/subfolder/b.d.ts @@ -0,0 +1,2 @@ +export declare class B { +} diff --git a/tests/baselines/reference/project/declarationDir/node/declarations/subfolder/c.d.ts b/tests/baselines/reference/project/declarationDir/node/declarations/subfolder/c.d.ts new file mode 100644 index 00000000000..c45525d0c5f --- /dev/null +++ b/tests/baselines/reference/project/declarationDir/node/declarations/subfolder/c.d.ts @@ -0,0 +1,4 @@ +import { A } from '../a'; +export declare class C { + a: A; +} diff --git a/tests/baselines/reference/project/declarationDir/node/subfolder/b.js b/tests/baselines/reference/project/declarationDir/node/subfolder/b.js new file mode 100644 index 00000000000..7b46df97ac3 --- /dev/null +++ b/tests/baselines/reference/project/declarationDir/node/subfolder/b.js @@ -0,0 +1,7 @@ +"use strict"; +var B = (function () { + function B() { + } + return B; +}()); +exports.B = B; diff --git a/tests/baselines/reference/project/declarationDir/node/subfolder/c.js b/tests/baselines/reference/project/declarationDir/node/subfolder/c.js new file mode 100644 index 00000000000..65238579edc --- /dev/null +++ b/tests/baselines/reference/project/declarationDir/node/subfolder/c.js @@ -0,0 +1,7 @@ +"use strict"; +var C = (function () { + function C() { + } + return C; +}()); +exports.C = C; diff --git a/tests/baselines/reference/project/declarationDir2/amd/declarationDir2.json b/tests/baselines/reference/project/declarationDir2/amd/declarationDir2.json new file mode 100644 index 00000000000..a746ea58a7c --- /dev/null +++ b/tests/baselines/reference/project/declarationDir2/amd/declarationDir2.json @@ -0,0 +1,27 @@ +{ + "scenario": "declarationDir: specify declarationDir with outDir", + "projectRoot": "tests/cases/projects/declarationDir", + "inputFiles": [ + "a.ts", + "subfolder/b.ts", + "subfolder/c.ts" + ], + "outDir": "out", + "declaration": true, + "declarationDir": "declarations", + "baselineCheck": true, + "resolvedInputFiles": [ + "lib.d.ts", + "subfolder/b.ts", + "a.ts", + "subfolder/c.ts" + ], + "emittedFiles": [ + "out/subfolder/b.js", + "declarations/subfolder/b.d.ts", + "out/a.js", + "declarations/a.d.ts", + "out/subfolder/c.js", + "declarations/subfolder/c.d.ts" + ] +} \ No newline at end of file diff --git a/tests/baselines/reference/project/declarationDir2/amd/declarations/a.d.ts b/tests/baselines/reference/project/declarationDir2/amd/declarations/a.d.ts new file mode 100644 index 00000000000..d8c7642c262 --- /dev/null +++ b/tests/baselines/reference/project/declarationDir2/amd/declarations/a.d.ts @@ -0,0 +1,4 @@ +import { B } from './subfolder/b'; +export declare class A { + b: B; +} diff --git a/tests/baselines/reference/project/declarationDir2/amd/declarations/subfolder/b.d.ts b/tests/baselines/reference/project/declarationDir2/amd/declarations/subfolder/b.d.ts new file mode 100644 index 00000000000..a03032c2d62 --- /dev/null +++ b/tests/baselines/reference/project/declarationDir2/amd/declarations/subfolder/b.d.ts @@ -0,0 +1,2 @@ +export declare class B { +} diff --git a/tests/baselines/reference/project/declarationDir2/amd/declarations/subfolder/c.d.ts b/tests/baselines/reference/project/declarationDir2/amd/declarations/subfolder/c.d.ts new file mode 100644 index 00000000000..c45525d0c5f --- /dev/null +++ b/tests/baselines/reference/project/declarationDir2/amd/declarations/subfolder/c.d.ts @@ -0,0 +1,4 @@ +import { A } from '../a'; +export declare class C { + a: A; +} diff --git a/tests/baselines/reference/project/declarationDir2/amd/out/a.js b/tests/baselines/reference/project/declarationDir2/amd/out/a.js new file mode 100644 index 00000000000..331c004bd67 --- /dev/null +++ b/tests/baselines/reference/project/declarationDir2/amd/out/a.js @@ -0,0 +1,9 @@ +define(["require", "exports"], function (require, exports) { + "use strict"; + var A = (function () { + function A() { + } + return A; + }()); + exports.A = A; +}); diff --git a/tests/baselines/reference/project/declarationDir2/amd/out/subfolder/b.js b/tests/baselines/reference/project/declarationDir2/amd/out/subfolder/b.js new file mode 100644 index 00000000000..e2cdda8530b --- /dev/null +++ b/tests/baselines/reference/project/declarationDir2/amd/out/subfolder/b.js @@ -0,0 +1,9 @@ +define(["require", "exports"], function (require, exports) { + "use strict"; + var B = (function () { + function B() { + } + return B; + }()); + exports.B = B; +}); diff --git a/tests/baselines/reference/project/declarationDir2/amd/out/subfolder/c.js b/tests/baselines/reference/project/declarationDir2/amd/out/subfolder/c.js new file mode 100644 index 00000000000..212511f2bf5 --- /dev/null +++ b/tests/baselines/reference/project/declarationDir2/amd/out/subfolder/c.js @@ -0,0 +1,9 @@ +define(["require", "exports"], function (require, exports) { + "use strict"; + var C = (function () { + function C() { + } + return C; + }()); + exports.C = C; +}); diff --git a/tests/baselines/reference/project/declarationDir2/node/declarationDir2.json b/tests/baselines/reference/project/declarationDir2/node/declarationDir2.json new file mode 100644 index 00000000000..a746ea58a7c --- /dev/null +++ b/tests/baselines/reference/project/declarationDir2/node/declarationDir2.json @@ -0,0 +1,27 @@ +{ + "scenario": "declarationDir: specify declarationDir with outDir", + "projectRoot": "tests/cases/projects/declarationDir", + "inputFiles": [ + "a.ts", + "subfolder/b.ts", + "subfolder/c.ts" + ], + "outDir": "out", + "declaration": true, + "declarationDir": "declarations", + "baselineCheck": true, + "resolvedInputFiles": [ + "lib.d.ts", + "subfolder/b.ts", + "a.ts", + "subfolder/c.ts" + ], + "emittedFiles": [ + "out/subfolder/b.js", + "declarations/subfolder/b.d.ts", + "out/a.js", + "declarations/a.d.ts", + "out/subfolder/c.js", + "declarations/subfolder/c.d.ts" + ] +} \ No newline at end of file diff --git a/tests/baselines/reference/project/declarationDir2/node/declarations/a.d.ts b/tests/baselines/reference/project/declarationDir2/node/declarations/a.d.ts new file mode 100644 index 00000000000..d8c7642c262 --- /dev/null +++ b/tests/baselines/reference/project/declarationDir2/node/declarations/a.d.ts @@ -0,0 +1,4 @@ +import { B } from './subfolder/b'; +export declare class A { + b: B; +} diff --git a/tests/baselines/reference/project/declarationDir2/node/declarations/subfolder/b.d.ts b/tests/baselines/reference/project/declarationDir2/node/declarations/subfolder/b.d.ts new file mode 100644 index 00000000000..a03032c2d62 --- /dev/null +++ b/tests/baselines/reference/project/declarationDir2/node/declarations/subfolder/b.d.ts @@ -0,0 +1,2 @@ +export declare class B { +} diff --git a/tests/baselines/reference/project/declarationDir2/node/declarations/subfolder/c.d.ts b/tests/baselines/reference/project/declarationDir2/node/declarations/subfolder/c.d.ts new file mode 100644 index 00000000000..c45525d0c5f --- /dev/null +++ b/tests/baselines/reference/project/declarationDir2/node/declarations/subfolder/c.d.ts @@ -0,0 +1,4 @@ +import { A } from '../a'; +export declare class C { + a: A; +} diff --git a/tests/baselines/reference/project/declarationDir2/node/out/a.js b/tests/baselines/reference/project/declarationDir2/node/out/a.js new file mode 100644 index 00000000000..35f5adf27f0 --- /dev/null +++ b/tests/baselines/reference/project/declarationDir2/node/out/a.js @@ -0,0 +1,7 @@ +"use strict"; +var A = (function () { + function A() { + } + return A; +}()); +exports.A = A; diff --git a/tests/baselines/reference/project/declarationDir2/node/out/subfolder/b.js b/tests/baselines/reference/project/declarationDir2/node/out/subfolder/b.js new file mode 100644 index 00000000000..7b46df97ac3 --- /dev/null +++ b/tests/baselines/reference/project/declarationDir2/node/out/subfolder/b.js @@ -0,0 +1,7 @@ +"use strict"; +var B = (function () { + function B() { + } + return B; +}()); +exports.B = B; diff --git a/tests/baselines/reference/project/declarationDir2/node/out/subfolder/c.js b/tests/baselines/reference/project/declarationDir2/node/out/subfolder/c.js new file mode 100644 index 00000000000..65238579edc --- /dev/null +++ b/tests/baselines/reference/project/declarationDir2/node/out/subfolder/c.js @@ -0,0 +1,7 @@ +"use strict"; +var C = (function () { + function C() { + } + return C; +}()); +exports.C = C; diff --git a/tests/baselines/reference/project/declarationDir3/amd/declarationDir3.errors.txt b/tests/baselines/reference/project/declarationDir3/amd/declarationDir3.errors.txt new file mode 100644 index 00000000000..a152ace6f11 --- /dev/null +++ b/tests/baselines/reference/project/declarationDir3/amd/declarationDir3.errors.txt @@ -0,0 +1,19 @@ +error TS5053: Option 'declarationDir' cannot be specified with option 'out'. + + +!!! error TS5053: Option 'declarationDir' cannot be specified with option 'out'. +==== b.ts (0 errors) ==== + export class B { + + } +==== a.ts (0 errors) ==== + import {B} from './subfolder/b'; + export class A { + b: B; + } +==== subfolder/c.ts (0 errors) ==== + import {A} from '../a'; + + export class C { + a: A; + } \ No newline at end of file diff --git a/tests/baselines/reference/project/declarationDir3/amd/declarationDir3.json b/tests/baselines/reference/project/declarationDir3/amd/declarationDir3.json new file mode 100644 index 00000000000..7c26154e17b --- /dev/null +++ b/tests/baselines/reference/project/declarationDir3/amd/declarationDir3.json @@ -0,0 +1,23 @@ +{ + "scenario": "declarationDir: specify declarationDir with bundled output file", + "projectRoot": "tests/cases/projects/declarationDir", + "inputFiles": [ + "a.ts", + "subfolder/b.ts", + "subfolder/c.ts" + ], + "out": "out.js", + "declaration": true, + "declarationDir": "declarations", + "baselineCheck": true, + "resolvedInputFiles": [ + "lib.d.ts", + "subfolder/b.ts", + "a.ts", + "subfolder/c.ts" + ], + "emittedFiles": [ + "out.js", + "out.d.ts" + ] +} \ No newline at end of file diff --git a/tests/baselines/reference/project/declarationDir3/amd/out.d.ts b/tests/baselines/reference/project/declarationDir3/amd/out.d.ts new file mode 100644 index 00000000000..60950f066bc --- /dev/null +++ b/tests/baselines/reference/project/declarationDir3/amd/out.d.ts @@ -0,0 +1,16 @@ +declare module "subfolder/b" { + export class B { + } +} +declare module "a" { + import { B } from "subfolder/b"; + export class A { + b: B; + } +} +declare module "subfolder/c" { + import { A } from "a"; + export class C { + a: A; + } +} diff --git a/tests/baselines/reference/project/declarationDir3/amd/out.js b/tests/baselines/reference/project/declarationDir3/amd/out.js new file mode 100644 index 00000000000..6c49867c908 --- /dev/null +++ b/tests/baselines/reference/project/declarationDir3/amd/out.js @@ -0,0 +1,27 @@ +define("subfolder/b", ["require", "exports"], function (require, exports) { + "use strict"; + var B = (function () { + function B() { + } + return B; + }()); + exports.B = B; +}); +define("a", ["require", "exports"], function (require, exports) { + "use strict"; + var A = (function () { + function A() { + } + return A; + }()); + exports.A = A; +}); +define("subfolder/c", ["require", "exports"], function (require, exports) { + "use strict"; + var C = (function () { + function C() { + } + return C; + }()); + exports.C = C; +}); diff --git a/tests/baselines/reference/project/declarationDir3/node/declarationDir3.errors.txt b/tests/baselines/reference/project/declarationDir3/node/declarationDir3.errors.txt new file mode 100644 index 00000000000..19e15ce8fef --- /dev/null +++ b/tests/baselines/reference/project/declarationDir3/node/declarationDir3.errors.txt @@ -0,0 +1,21 @@ +error TS5053: Option 'declarationDir' cannot be specified with option 'out'. +error TS6082: Only 'amd' and 'system' modules are supported alongside --out. + + +!!! error TS5053: Option 'declarationDir' cannot be specified with option 'out'. +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --out. +==== b.ts (0 errors) ==== + export class B { + + } +==== a.ts (0 errors) ==== + import {B} from './subfolder/b'; + export class A { + b: B; + } +==== subfolder/c.ts (0 errors) ==== + import {A} from '../a'; + + export class C { + a: A; + } \ No newline at end of file diff --git a/tests/baselines/reference/project/declarationDir3/node/declarationDir3.json b/tests/baselines/reference/project/declarationDir3/node/declarationDir3.json new file mode 100644 index 00000000000..7c26154e17b --- /dev/null +++ b/tests/baselines/reference/project/declarationDir3/node/declarationDir3.json @@ -0,0 +1,23 @@ +{ + "scenario": "declarationDir: specify declarationDir with bundled output file", + "projectRoot": "tests/cases/projects/declarationDir", + "inputFiles": [ + "a.ts", + "subfolder/b.ts", + "subfolder/c.ts" + ], + "out": "out.js", + "declaration": true, + "declarationDir": "declarations", + "baselineCheck": true, + "resolvedInputFiles": [ + "lib.d.ts", + "subfolder/b.ts", + "a.ts", + "subfolder/c.ts" + ], + "emittedFiles": [ + "out.js", + "out.d.ts" + ] +} \ No newline at end of file diff --git a/tests/baselines/reference/project/declarationDir3/node/out.d.ts b/tests/baselines/reference/project/declarationDir3/node/out.d.ts new file mode 100644 index 00000000000..60950f066bc --- /dev/null +++ b/tests/baselines/reference/project/declarationDir3/node/out.d.ts @@ -0,0 +1,16 @@ +declare module "subfolder/b" { + export class B { + } +} +declare module "a" { + import { B } from "subfolder/b"; + export class A { + b: B; + } +} +declare module "subfolder/c" { + import { A } from "a"; + export class C { + a: A; + } +} diff --git a/tests/baselines/reference/project/declarationDir3/node/out.js b/tests/baselines/reference/project/declarationDir3/node/out.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/baselines/reference/promiseChaining.symbols b/tests/baselines/reference/promiseChaining.symbols index f13323742ce..73f0eafd5b4 100644 --- a/tests/baselines/reference/promiseChaining.symbols +++ b/tests/baselines/reference/promiseChaining.symbols @@ -4,11 +4,11 @@ class Chain { >T : Symbol(T, Decl(promiseChaining.ts, 0, 12)) constructor(public value: T) { } ->value : Symbol(value, Decl(promiseChaining.ts, 1, 16)) +>value : Symbol(Chain.value, Decl(promiseChaining.ts, 1, 16)) >T : Symbol(T, Decl(promiseChaining.ts, 0, 12)) then(cb: (x: T) => S): Chain { ->then : Symbol(then, Decl(promiseChaining.ts, 1, 36)) +>then : Symbol(Chain.then, Decl(promiseChaining.ts, 1, 36)) >S : Symbol(S, Decl(promiseChaining.ts, 2, 9)) >cb : Symbol(cb, Decl(promiseChaining.ts, 2, 12)) >x : Symbol(x, Decl(promiseChaining.ts, 2, 17)) @@ -20,18 +20,18 @@ class Chain { var result = cb(this.value); >result : Symbol(result, Decl(promiseChaining.ts, 3, 11)) >cb : Symbol(cb, Decl(promiseChaining.ts, 2, 12)) ->this.value : Symbol(value, Decl(promiseChaining.ts, 1, 16)) +>this.value : Symbol(Chain.value, Decl(promiseChaining.ts, 1, 16)) >this : Symbol(Chain, Decl(promiseChaining.ts, 0, 0)) ->value : Symbol(value, Decl(promiseChaining.ts, 1, 16)) +>value : Symbol(Chain.value, Decl(promiseChaining.ts, 1, 16)) // should get a fresh type parameter which each then call var z = this.then(x => result)/*S*/.then(x => "abc")/*string*/.then(x => x.length)/*number*/; // No error >z : Symbol(z, Decl(promiseChaining.ts, 5, 11)) >this.then(x => result)/*S*/.then(x => "abc")/*string*/.then : Symbol(Chain.then, Decl(promiseChaining.ts, 1, 36)) >this.then(x => result)/*S*/.then : Symbol(Chain.then, Decl(promiseChaining.ts, 1, 36)) ->this.then : Symbol(then, Decl(promiseChaining.ts, 1, 36)) +>this.then : Symbol(Chain.then, Decl(promiseChaining.ts, 1, 36)) >this : Symbol(Chain, Decl(promiseChaining.ts, 0, 0)) ->then : Symbol(then, Decl(promiseChaining.ts, 1, 36)) +>then : Symbol(Chain.then, Decl(promiseChaining.ts, 1, 36)) >x : Symbol(x, Decl(promiseChaining.ts, 5, 26)) >result : Symbol(result, Decl(promiseChaining.ts, 3, 11)) >then : Symbol(Chain.then, Decl(promiseChaining.ts, 1, 36)) diff --git a/tests/baselines/reference/promiseChaining1.errors.txt b/tests/baselines/reference/promiseChaining1.errors.txt index bd3e52fcc1c..7396d03059a 100644 --- a/tests/baselines/reference/promiseChaining1.errors.txt +++ b/tests/baselines/reference/promiseChaining1.errors.txt @@ -1,6 +1,5 @@ tests/cases/compiler/promiseChaining1.ts(7,50): error TS2345: Argument of type '(x: S) => string' is not assignable to parameter of type '(x: S) => Function'. Type 'string' is not assignable to type 'Function'. - Property 'apply' is missing in type 'String'. ==== tests/cases/compiler/promiseChaining1.ts (1 errors) ==== @@ -14,7 +13,6 @@ tests/cases/compiler/promiseChaining1.ts(7,50): error TS2345: Argument of type ' ~~~~~~~~~~ !!! error TS2345: Argument of type '(x: S) => string' is not assignable to parameter of type '(x: S) => Function'. !!! error TS2345: Type 'string' is not assignable to type 'Function'. -!!! error TS2345: Property 'apply' is missing in type 'String'. return new Chain2(result); } } \ No newline at end of file diff --git a/tests/baselines/reference/promiseChaining2.errors.txt b/tests/baselines/reference/promiseChaining2.errors.txt index f12baebd4dc..a31c4335da7 100644 --- a/tests/baselines/reference/promiseChaining2.errors.txt +++ b/tests/baselines/reference/promiseChaining2.errors.txt @@ -1,6 +1,5 @@ tests/cases/compiler/promiseChaining2.ts(7,45): error TS2345: Argument of type '(x: S) => string' is not assignable to parameter of type '(x: S) => Function'. Type 'string' is not assignable to type 'Function'. - Property 'apply' is missing in type 'String'. ==== tests/cases/compiler/promiseChaining2.ts (1 errors) ==== @@ -14,7 +13,6 @@ tests/cases/compiler/promiseChaining2.ts(7,45): error TS2345: Argument of type ' ~~~~~~~~~~ !!! error TS2345: Argument of type '(x: S) => string' is not assignable to parameter of type '(x: S) => Function'. !!! error TS2345: Type 'string' is not assignable to type 'Function'. -!!! error TS2345: Property 'apply' is missing in type 'String'. return new Chain2(result); } } \ No newline at end of file diff --git a/tests/baselines/reference/promiseIdentity.symbols b/tests/baselines/reference/promiseIdentity.symbols index 6987154b07f..f1404eaf7b1 100644 --- a/tests/baselines/reference/promiseIdentity.symbols +++ b/tests/baselines/reference/promiseIdentity.symbols @@ -4,7 +4,7 @@ interface IPromise { >T : Symbol(T, Decl(promiseIdentity.ts, 0, 19)) then(callback: (x: T) => IPromise): IPromise; ->then : Symbol(then, Decl(promiseIdentity.ts, 0, 23)) +>then : Symbol(IPromise.then, Decl(promiseIdentity.ts, 0, 23)) >U : Symbol(U, Decl(promiseIdentity.ts, 1, 9)) >callback : Symbol(callback, Decl(promiseIdentity.ts, 1, 12)) >x : Symbol(x, Decl(promiseIdentity.ts, 1, 23)) @@ -19,7 +19,7 @@ interface Promise { >T : Symbol(T, Decl(promiseIdentity.ts, 3, 18)) then(callback: (x: T) => Promise): Promise; ->then : Symbol(then, Decl(promiseIdentity.ts, 3, 22)) +>then : Symbol(Promise.then, Decl(promiseIdentity.ts, 3, 22)) >U : Symbol(U, Decl(promiseIdentity.ts, 4, 9)) >callback : Symbol(callback, Decl(promiseIdentity.ts, 4, 12)) >x : Symbol(x, Decl(promiseIdentity.ts, 4, 23)) @@ -44,7 +44,7 @@ interface IPromise2 { >V : Symbol(V, Decl(promiseIdentity.ts, 10, 22)) then(callback: (x: T) => IPromise2): IPromise2; ->then : Symbol(then, Decl(promiseIdentity.ts, 10, 27)) +>then : Symbol(IPromise2.then, Decl(promiseIdentity.ts, 10, 27)) >U : Symbol(U, Decl(promiseIdentity.ts, 11, 9)) >W : Symbol(W, Decl(promiseIdentity.ts, 11, 11)) >callback : Symbol(callback, Decl(promiseIdentity.ts, 11, 15)) @@ -63,7 +63,7 @@ interface Promise2 { >V : Symbol(V, Decl(promiseIdentity.ts, 13, 21)) then(callback: (x: V) => Promise2): Promise2; // Uses V instead of T in callback's parameter ->then : Symbol(then, Decl(promiseIdentity.ts, 13, 26)) +>then : Symbol(Promise2.then, Decl(promiseIdentity.ts, 13, 26)) >U : Symbol(U, Decl(promiseIdentity.ts, 14, 9)) >W : Symbol(W, Decl(promiseIdentity.ts, 14, 11)) >callback : Symbol(callback, Decl(promiseIdentity.ts, 14, 15)) diff --git a/tests/baselines/reference/promiseIdentityWithAny.symbols b/tests/baselines/reference/promiseIdentityWithAny.symbols index fedac33e280..8bcf096a0a3 100644 --- a/tests/baselines/reference/promiseIdentityWithAny.symbols +++ b/tests/baselines/reference/promiseIdentityWithAny.symbols @@ -5,7 +5,7 @@ interface IPromise { >V : Symbol(V, Decl(promiseIdentityWithAny.ts, 0, 21)) then(callback: (x: T) => IPromise): IPromise; ->then : Symbol(then, Decl(promiseIdentityWithAny.ts, 0, 26)) +>then : Symbol(IPromise.then, Decl(promiseIdentityWithAny.ts, 0, 26)) >U : Symbol(U, Decl(promiseIdentityWithAny.ts, 1, 9)) >W : Symbol(W, Decl(promiseIdentityWithAny.ts, 1, 11)) >callback : Symbol(callback, Decl(promiseIdentityWithAny.ts, 1, 15)) @@ -24,7 +24,7 @@ interface Promise { >V : Symbol(V, Decl(promiseIdentityWithAny.ts, 3, 20)) then(callback: (x: T) => Promise): Promise; ->then : Symbol(then, Decl(promiseIdentityWithAny.ts, 3, 25)) +>then : Symbol(Promise.then, Decl(promiseIdentityWithAny.ts, 3, 25)) >U : Symbol(U, Decl(promiseIdentityWithAny.ts, 4, 9)) >W : Symbol(W, Decl(promiseIdentityWithAny.ts, 4, 11)) >callback : Symbol(callback, Decl(promiseIdentityWithAny.ts, 4, 15)) diff --git a/tests/baselines/reference/promiseIdentityWithConstraints.symbols b/tests/baselines/reference/promiseIdentityWithConstraints.symbols index b3f481c9e7c..00308362b18 100644 --- a/tests/baselines/reference/promiseIdentityWithConstraints.symbols +++ b/tests/baselines/reference/promiseIdentityWithConstraints.symbols @@ -5,7 +5,7 @@ interface IPromise { >V : Symbol(V, Decl(promiseIdentityWithConstraints.ts, 0, 21)) then(callback: (x: T) => IPromise): IPromise; ->then : Symbol(then, Decl(promiseIdentityWithConstraints.ts, 0, 26)) +>then : Symbol(IPromise.then, Decl(promiseIdentityWithConstraints.ts, 0, 26)) >U : Symbol(U, Decl(promiseIdentityWithConstraints.ts, 1, 9)) >T : Symbol(T, Decl(promiseIdentityWithConstraints.ts, 0, 19)) >W : Symbol(W, Decl(promiseIdentityWithConstraints.ts, 1, 21)) @@ -26,7 +26,7 @@ interface Promise { >V : Symbol(V, Decl(promiseIdentityWithConstraints.ts, 3, 20)) then(callback: (x: T) => Promise): Promise; ->then : Symbol(then, Decl(promiseIdentityWithConstraints.ts, 3, 25)) +>then : Symbol(Promise.then, Decl(promiseIdentityWithConstraints.ts, 3, 25)) >U : Symbol(U, Decl(promiseIdentityWithConstraints.ts, 4, 9)) >T : Symbol(T, Decl(promiseIdentityWithConstraints.ts, 3, 18)) >W : Symbol(W, Decl(promiseIdentityWithConstraints.ts, 4, 21)) diff --git a/tests/baselines/reference/promisePermutations.errors.txt b/tests/baselines/reference/promisePermutations.errors.txt index a74938f5dd9..65fa0981643 100644 --- a/tests/baselines/reference/promisePermutations.errors.txt +++ b/tests/baselines/reference/promisePermutations.errors.txt @@ -1,19 +1,18 @@ tests/cases/compiler/promisePermutations.ts(74,70): error TS2345: Argument of type '(x: number) => IPromise' is not assignable to parameter of type '(value: IPromise) => IPromise'. Types of parameters 'x' and 'value' are incompatible. - Type 'number' is not assignable to type 'IPromise'. - Property 'then' is missing in type 'Number'. + Type 'IPromise' is not assignable to type 'number'. tests/cases/compiler/promisePermutations.ts(79,19): error TS2345: Argument of type '(x: number, y?: string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. Types of parameters 'x' and 'value' are incompatible. - Type 'number' is not assignable to type 'string'. + Type 'string' is not assignable to type 'number'. tests/cases/compiler/promisePermutations.ts(82,19): error TS2345: Argument of type '(x: number, y?: string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. Types of parameters 'x' and 'value' are incompatible. - Type 'number' is not assignable to type 'string'. + Type 'string' is not assignable to type 'number'. tests/cases/compiler/promisePermutations.ts(83,19): error TS2345: Argument of type '(x: number, y?: string) => Promise' is not assignable to parameter of type '(value: string) => Promise'. Types of parameters 'x' and 'value' are incompatible. - Type 'number' is not assignable to type 'string'. + Type 'string' is not assignable to type 'number'. tests/cases/compiler/promisePermutations.ts(84,19): error TS2345: Argument of type '(x: number, y?: string) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. Types of parameters 'x' and 'value' are incompatible. - Type 'number' is not assignable to type 'string'. + Type 'string' is not assignable to type 'number'. tests/cases/compiler/promisePermutations.ts(88,19): error TS2345: Argument of type '(x: number, cb: (a: string) => string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. tests/cases/compiler/promisePermutations.ts(91,19): error TS2345: Argument of type '(x: number, cb: (a: string) => string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. tests/cases/compiler/promisePermutations.ts(92,19): error TS2345: Argument of type '(x: number, cb: (a: string) => string) => Promise' is not assignable to parameter of type '(value: string) => Promise'. @@ -24,16 +23,16 @@ tests/cases/compiler/promisePermutations.ts(101,19): error TS2345: Argument of t tests/cases/compiler/promisePermutations.ts(102,19): error TS2345: Argument of type '(x: number, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. tests/cases/compiler/promisePermutations.ts(106,19): error TS2345: Argument of type '(cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. Types of parameters 'cb' and 'value' are incompatible. - Type '(a: T) => T' is not assignable to type 'string'. + Type 'string' is not assignable to type '(a: T) => T'. tests/cases/compiler/promisePermutations.ts(109,19): error TS2345: Argument of type '(cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. Types of parameters 'cb' and 'value' are incompatible. - Type '(a: T) => T' is not assignable to type 'string'. + Type 'string' is not assignable to type '(a: T) => T'. tests/cases/compiler/promisePermutations.ts(110,19): error TS2345: Argument of type '(cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => Promise'. Types of parameters 'cb' and 'value' are incompatible. - Type '(a: T) => T' is not assignable to type 'string'. + Type 'string' is not assignable to type '(a: T) => T'. tests/cases/compiler/promisePermutations.ts(111,19): error TS2345: Argument of type '(cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. Types of parameters 'cb' and 'value' are incompatible. - Type '(a: T) => T' is not assignable to type 'string'. + Type 'string' is not assignable to type '(a: T) => T'. tests/cases/compiler/promisePermutations.ts(117,19): error TS2345: Argument of type '(x: T, cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: number) => IPromise'. tests/cases/compiler/promisePermutations.ts(120,19): error TS2345: Argument of type '(x: T, cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: number) => IPromise'. tests/cases/compiler/promisePermutations.ts(121,19): error TS2345: Argument of type '(x: T, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: number) => Promise'. @@ -56,7 +55,7 @@ tests/cases/compiler/promisePermutations.ts(152,12): error TS2453: The type argu Types of property 'then' are incompatible. Type '{ (success?: (value: string) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: string) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: string) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; }' is not assignable to type '{ (success?: (value: number) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: number) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: number) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: number) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; }'. Types of parameters 'success' and 'success' are incompatible. - Type '(value: string) => IPromise' is not assignable to type '(value: number) => Promise'. + Type '(value: number) => Promise' is not assignable to type '(value: string) => IPromise'. Types of parameters 'value' and 'value' are incompatible. Type 'string' is not assignable to type 'number'. tests/cases/compiler/promisePermutations.ts(156,21): error TS2345: Argument of type '{ (x: number): IPromise; (x: string): IPromise; }' is not assignable to parameter of type '(value: number) => IPromise'. @@ -73,7 +72,7 @@ tests/cases/compiler/promisePermutations.ts(160,21): error TS2345: Argument of t Types of property 'then' are incompatible. Type '{ (success?: (value: number) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: number) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: number) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: number) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; }' is not assignable to type '{ (success?: (value: string) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: string) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: string) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; }'. Types of parameters 'success' and 'success' are incompatible. - Type '(value: number) => Promise' is not assignable to type '(value: string) => IPromise'. + Type '(value: string) => IPromise' is not assignable to type '(value: number) => Promise'. Types of parameters 'value' and 'value' are incompatible. Type 'number' is not assignable to type 'string'. @@ -156,8 +155,7 @@ tests/cases/compiler/promisePermutations.ts(160,21): error TS2345: Argument of t ~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: number) => IPromise' is not assignable to parameter of type '(value: IPromise) => IPromise'. !!! error TS2345: Types of parameters 'x' and 'value' are incompatible. -!!! error TS2345: Type 'number' is not assignable to type 'IPromise'. -!!! error TS2345: Property 'then' is missing in type 'Number'. +!!! error TS2345: Type 'IPromise' is not assignable to type 'number'. var r4: IPromise; var sIPromise: (x: any) => IPromise; @@ -166,24 +164,24 @@ tests/cases/compiler/promisePermutations.ts(160,21): error TS2345: Argument of t ~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: number, y?: string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. !!! error TS2345: Types of parameters 'x' and 'value' are incompatible. -!!! error TS2345: Type 'number' is not assignable to type 'string'. +!!! error TS2345: Type 'string' is not assignable to type 'number'. var r4b = r4.then(sIPromise, testFunction4, testFunction4).then(sIPromise, testFunction4, testFunction4); // ok var s4: Promise; var s4a = s4.then(testFunction4, testFunction4, testFunction4); // error ~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: number, y?: string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. !!! error TS2345: Types of parameters 'x' and 'value' are incompatible. -!!! error TS2345: Type 'number' is not assignable to type 'string'. +!!! error TS2345: Type 'string' is not assignable to type 'number'. var s4b = s4.then(testFunction4P, testFunction4P, testFunction4P); // error ~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: number, y?: string) => Promise' is not assignable to parameter of type '(value: string) => Promise'. !!! error TS2345: Types of parameters 'x' and 'value' are incompatible. -!!! error TS2345: Type 'number' is not assignable to type 'string'. +!!! error TS2345: Type 'string' is not assignable to type 'number'. var s4c = s4.then(testFunction4P, testFunction4, testFunction4); // error ~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: number, y?: string) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. !!! error TS2345: Types of parameters 'x' and 'value' are incompatible. -!!! error TS2345: Type 'number' is not assignable to type 'string'. +!!! error TS2345: Type 'string' is not assignable to type 'number'. var s4d = s4.then(sIPromise, testFunction4P, testFunction4).then(sIPromise, testFunction4P, testFunction4); var r5: IPromise; @@ -225,24 +223,24 @@ tests/cases/compiler/promisePermutations.ts(160,21): error TS2345: Argument of t ~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. !!! error TS2345: Types of parameters 'cb' and 'value' are incompatible. -!!! error TS2345: Type '(a: T) => T' is not assignable to type 'string'. +!!! error TS2345: Type 'string' is not assignable to type '(a: T) => T'. var r7b = r7.then(sIPromise, sIPromise, sIPromise).then(sIPromise, sIPromise, sIPromise); // ok var s7: Promise; var s7a = r7.then(testFunction7, testFunction7, testFunction7); // error ~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. !!! error TS2345: Types of parameters 'cb' and 'value' are incompatible. -!!! error TS2345: Type '(a: T) => T' is not assignable to type 'string'. +!!! error TS2345: Type 'string' is not assignable to type '(a: T) => T'. var s7b = r7.then(testFunction7P, testFunction7P, testFunction7P); // error ~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => Promise'. !!! error TS2345: Types of parameters 'cb' and 'value' are incompatible. -!!! error TS2345: Type '(a: T) => T' is not assignable to type 'string'. +!!! error TS2345: Type 'string' is not assignable to type '(a: T) => T'. var s7c = r7.then(testFunction7P, testFunction7, testFunction7); // error ~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. !!! error TS2345: Types of parameters 'cb' and 'value' are incompatible. -!!! error TS2345: Type '(a: T) => T' is not assignable to type 'string'. +!!! error TS2345: Type 'string' is not assignable to type '(a: T) => T'. var s7d = r7.then(sPromise, sPromise, sPromise).then(sPromise, sPromise, sPromise); // ok? var r8: IPromise; @@ -318,7 +316,7 @@ tests/cases/compiler/promisePermutations.ts(160,21): error TS2345: Argument of t !!! error TS2453: Types of property 'then' are incompatible. !!! error TS2453: Type '{ (success?: (value: string) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: string) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: string) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; }' is not assignable to type '{ (success?: (value: number) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: number) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: number) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: number) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; }'. !!! error TS2453: Types of parameters 'success' and 'success' are incompatible. -!!! error TS2453: Type '(value: string) => IPromise' is not assignable to type '(value: number) => Promise'. +!!! error TS2453: Type '(value: number) => Promise' is not assignable to type '(value: string) => IPromise'. !!! error TS2453: Types of parameters 'value' and 'value' are incompatible. !!! error TS2453: Type 'string' is not assignable to type 'number'. var s10g = s10.then(testFunctionP, nIPromise, sIPromise).then(sPromise, sIPromise, sIPromise); // ok @@ -347,7 +345,7 @@ tests/cases/compiler/promisePermutations.ts(160,21): error TS2345: Argument of t !!! error TS2345: Types of property 'then' are incompatible. !!! error TS2345: Type '{ (success?: (value: number) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: number) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: number) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: number) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; }' is not assignable to type '{ (success?: (value: string) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: string) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: string) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; }'. !!! error TS2345: Types of parameters 'success' and 'success' are incompatible. -!!! error TS2345: Type '(value: number) => Promise' is not assignable to type '(value: string) => IPromise'. +!!! error TS2345: Type '(value: string) => IPromise' is not assignable to type '(value: number) => Promise'. !!! error TS2345: Types of parameters 'value' and 'value' are incompatible. !!! error TS2345: Type 'number' is not assignable to type 'string'. diff --git a/tests/baselines/reference/promisePermutations2.errors.txt b/tests/baselines/reference/promisePermutations2.errors.txt index 8afceeae0fd..0fc6f04911a 100644 --- a/tests/baselines/reference/promisePermutations2.errors.txt +++ b/tests/baselines/reference/promisePermutations2.errors.txt @@ -1,19 +1,18 @@ tests/cases/compiler/promisePermutations2.ts(73,70): error TS2345: Argument of type '(x: number) => IPromise' is not assignable to parameter of type '(value: IPromise) => IPromise'. Types of parameters 'x' and 'value' are incompatible. - Type 'number' is not assignable to type 'IPromise'. - Property 'then' is missing in type 'Number'. + Type 'IPromise' is not assignable to type 'number'. tests/cases/compiler/promisePermutations2.ts(78,19): error TS2345: Argument of type '(x: number, y?: string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. Types of parameters 'x' and 'value' are incompatible. - Type 'number' is not assignable to type 'string'. + Type 'string' is not assignable to type 'number'. tests/cases/compiler/promisePermutations2.ts(81,19): error TS2345: Argument of type '(x: number, y?: string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. Types of parameters 'x' and 'value' are incompatible. - Type 'number' is not assignable to type 'string'. + Type 'string' is not assignable to type 'number'. tests/cases/compiler/promisePermutations2.ts(82,19): error TS2345: Argument of type '(x: number, y?: string) => Promise' is not assignable to parameter of type '(value: string) => Promise'. Types of parameters 'x' and 'value' are incompatible. - Type 'number' is not assignable to type 'string'. + Type 'string' is not assignable to type 'number'. tests/cases/compiler/promisePermutations2.ts(83,19): error TS2345: Argument of type '(x: number, y?: string) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. Types of parameters 'x' and 'value' are incompatible. - Type 'number' is not assignable to type 'string'. + Type 'string' is not assignable to type 'number'. tests/cases/compiler/promisePermutations2.ts(87,19): error TS2345: Argument of type '(x: number, cb: (a: string) => string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. tests/cases/compiler/promisePermutations2.ts(90,19): error TS2345: Argument of type '(x: number, cb: (a: string) => string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. tests/cases/compiler/promisePermutations2.ts(91,19): error TS2345: Argument of type '(x: number, cb: (a: string) => string) => Promise' is not assignable to parameter of type '(value: string) => Promise'. @@ -24,16 +23,16 @@ tests/cases/compiler/promisePermutations2.ts(100,19): error TS2345: Argument of tests/cases/compiler/promisePermutations2.ts(101,19): error TS2345: Argument of type '(x: number, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. tests/cases/compiler/promisePermutations2.ts(105,19): error TS2345: Argument of type '(cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. Types of parameters 'cb' and 'value' are incompatible. - Type '(a: T) => T' is not assignable to type 'string'. + Type 'string' is not assignable to type '(a: T) => T'. tests/cases/compiler/promisePermutations2.ts(108,19): error TS2345: Argument of type '(cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. Types of parameters 'cb' and 'value' are incompatible. - Type '(a: T) => T' is not assignable to type 'string'. + Type 'string' is not assignable to type '(a: T) => T'. tests/cases/compiler/promisePermutations2.ts(109,19): error TS2345: Argument of type '(cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => Promise'. Types of parameters 'cb' and 'value' are incompatible. - Type '(a: T) => T' is not assignable to type 'string'. + Type 'string' is not assignable to type '(a: T) => T'. tests/cases/compiler/promisePermutations2.ts(110,19): error TS2345: Argument of type '(cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. Types of parameters 'cb' and 'value' are incompatible. - Type '(a: T) => T' is not assignable to type 'string'. + Type 'string' is not assignable to type '(a: T) => T'. tests/cases/compiler/promisePermutations2.ts(116,19): error TS2345: Argument of type '(x: T, cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: number) => IPromise'. tests/cases/compiler/promisePermutations2.ts(119,19): error TS2345: Argument of type '(x: T, cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: number) => IPromise'. tests/cases/compiler/promisePermutations2.ts(120,19): error TS2345: Argument of type '(x: T, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: number) => Promise'. @@ -56,7 +55,7 @@ tests/cases/compiler/promisePermutations2.ts(151,12): error TS2453: The type arg Types of property 'then' are incompatible. Type '{ (success?: (value: string) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: string) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: string) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; }' is not assignable to type '(success?: (value: number) => U, error?: (error: any) => U, progress?: (progress: any) => void) => Promise'. Types of parameters 'success' and 'success' are incompatible. - Type '(value: string) => IPromise' is not assignable to type '(value: number) => any'. + Type '(value: number) => any' is not assignable to type '(value: string) => IPromise'. Types of parameters 'value' and 'value' are incompatible. Type 'string' is not assignable to type 'number'. tests/cases/compiler/promisePermutations2.ts(155,21): error TS2345: Argument of type '{ (x: number): IPromise; (x: string): IPromise; }' is not assignable to parameter of type '(value: number) => IPromise'. @@ -73,7 +72,7 @@ tests/cases/compiler/promisePermutations2.ts(159,21): error TS2345: Argument of Types of property 'then' are incompatible. Type '(success?: (value: number) => U, error?: (error: any) => U, progress?: (progress: any) => void) => Promise' is not assignable to type '{ (success?: (value: string) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: string) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: string) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; }'. Types of parameters 'success' and 'success' are incompatible. - Type '(value: number) => any' is not assignable to type '(value: string) => IPromise'. + Type '(value: string) => IPromise' is not assignable to type '(value: number) => any'. Types of parameters 'value' and 'value' are incompatible. Type 'number' is not assignable to type 'string'. @@ -155,8 +154,7 @@ tests/cases/compiler/promisePermutations2.ts(159,21): error TS2345: Argument of ~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: number) => IPromise' is not assignable to parameter of type '(value: IPromise) => IPromise'. !!! error TS2345: Types of parameters 'x' and 'value' are incompatible. -!!! error TS2345: Type 'number' is not assignable to type 'IPromise'. -!!! error TS2345: Property 'then' is missing in type 'Number'. +!!! error TS2345: Type 'IPromise' is not assignable to type 'number'. var r4: IPromise; var sIPromise: (x: any) => IPromise; @@ -165,24 +163,24 @@ tests/cases/compiler/promisePermutations2.ts(159,21): error TS2345: Argument of ~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: number, y?: string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. !!! error TS2345: Types of parameters 'x' and 'value' are incompatible. -!!! error TS2345: Type 'number' is not assignable to type 'string'. +!!! error TS2345: Type 'string' is not assignable to type 'number'. var r4b = r4.then(sIPromise, testFunction4, testFunction4).then(sIPromise, testFunction4, testFunction4); // ok var s4: Promise; var s4a = s4.then(testFunction4, testFunction4, testFunction4); // error ~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: number, y?: string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. !!! error TS2345: Types of parameters 'x' and 'value' are incompatible. -!!! error TS2345: Type 'number' is not assignable to type 'string'. +!!! error TS2345: Type 'string' is not assignable to type 'number'. var s4b = s4.then(testFunction4P, testFunction4P, testFunction4P); // error ~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: number, y?: string) => Promise' is not assignable to parameter of type '(value: string) => Promise'. !!! error TS2345: Types of parameters 'x' and 'value' are incompatible. -!!! error TS2345: Type 'number' is not assignable to type 'string'. +!!! error TS2345: Type 'string' is not assignable to type 'number'. var s4c = s4.then(testFunction4P, testFunction4, testFunction4); // error ~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: number, y?: string) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. !!! error TS2345: Types of parameters 'x' and 'value' are incompatible. -!!! error TS2345: Type 'number' is not assignable to type 'string'. +!!! error TS2345: Type 'string' is not assignable to type 'number'. var s4d = s4.then(sIPromise, testFunction4P, testFunction4).then(sIPromise, testFunction4P, testFunction4); var r5: IPromise; @@ -224,24 +222,24 @@ tests/cases/compiler/promisePermutations2.ts(159,21): error TS2345: Argument of ~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. !!! error TS2345: Types of parameters 'cb' and 'value' are incompatible. -!!! error TS2345: Type '(a: T) => T' is not assignable to type 'string'. +!!! error TS2345: Type 'string' is not assignable to type '(a: T) => T'. var r7b = r7.then(sIPromise, sIPromise, sIPromise).then(sIPromise, sIPromise, sIPromise); // ok var s7: Promise; var s7a = r7.then(testFunction7, testFunction7, testFunction7); // error ~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. !!! error TS2345: Types of parameters 'cb' and 'value' are incompatible. -!!! error TS2345: Type '(a: T) => T' is not assignable to type 'string'. +!!! error TS2345: Type 'string' is not assignable to type '(a: T) => T'. var s7b = r7.then(testFunction7P, testFunction7P, testFunction7P); // error ~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => Promise'. !!! error TS2345: Types of parameters 'cb' and 'value' are incompatible. -!!! error TS2345: Type '(a: T) => T' is not assignable to type 'string'. +!!! error TS2345: Type 'string' is not assignable to type '(a: T) => T'. var s7c = r7.then(testFunction7P, testFunction7, testFunction7); // error ~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. !!! error TS2345: Types of parameters 'cb' and 'value' are incompatible. -!!! error TS2345: Type '(a: T) => T' is not assignable to type 'string'. +!!! error TS2345: Type 'string' is not assignable to type '(a: T) => T'. var s7d = r7.then(sPromise, sPromise, sPromise).then(sPromise, sPromise, sPromise); // ok? var r8: IPromise; @@ -317,7 +315,7 @@ tests/cases/compiler/promisePermutations2.ts(159,21): error TS2345: Argument of !!! error TS2453: Types of property 'then' are incompatible. !!! error TS2453: Type '{ (success?: (value: string) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: string) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: string) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; }' is not assignable to type '(success?: (value: number) => U, error?: (error: any) => U, progress?: (progress: any) => void) => Promise'. !!! error TS2453: Types of parameters 'success' and 'success' are incompatible. -!!! error TS2453: Type '(value: string) => IPromise' is not assignable to type '(value: number) => any'. +!!! error TS2453: Type '(value: number) => any' is not assignable to type '(value: string) => IPromise'. !!! error TS2453: Types of parameters 'value' and 'value' are incompatible. !!! error TS2453: Type 'string' is not assignable to type 'number'. var s10g = s10.then(testFunctionP, nIPromise, sIPromise).then(sPromise, sIPromise, sIPromise); // ok @@ -346,7 +344,7 @@ tests/cases/compiler/promisePermutations2.ts(159,21): error TS2345: Argument of !!! error TS2345: Types of property 'then' are incompatible. !!! error TS2345: Type '(success?: (value: number) => U, error?: (error: any) => U, progress?: (progress: any) => void) => Promise' is not assignable to type '{ (success?: (value: string) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: string) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: string) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; }'. !!! error TS2345: Types of parameters 'success' and 'success' are incompatible. -!!! error TS2345: Type '(value: number) => any' is not assignable to type '(value: string) => IPromise'. +!!! error TS2345: Type '(value: string) => IPromise' is not assignable to type '(value: number) => any'. !!! error TS2345: Types of parameters 'value' and 'value' are incompatible. !!! error TS2345: Type 'number' is not assignable to type 'string'. diff --git a/tests/baselines/reference/promisePermutations3.errors.txt b/tests/baselines/reference/promisePermutations3.errors.txt index b17021a02b9..a1a1b3f493f 100644 --- a/tests/baselines/reference/promisePermutations3.errors.txt +++ b/tests/baselines/reference/promisePermutations3.errors.txt @@ -1,22 +1,21 @@ tests/cases/compiler/promisePermutations3.ts(68,69): error TS2345: Argument of type '(x: number) => IPromise' is not assignable to parameter of type '(value: IPromise) => IPromise'. Types of parameters 'x' and 'value' are incompatible. - Type 'number' is not assignable to type 'IPromise'. - Property 'then' is missing in type 'Number'. + Type 'IPromise' is not assignable to type 'number'. tests/cases/compiler/promisePermutations3.ts(73,70): error TS2345: Argument of type '(x: number) => IPromise' is not assignable to parameter of type '(value: IPromise) => IPromise'. Types of parameters 'x' and 'value' are incompatible. - Type 'number' is not assignable to type 'IPromise'. + Type 'IPromise' is not assignable to type 'number'. tests/cases/compiler/promisePermutations3.ts(78,19): error TS2345: Argument of type '(x: number, y?: string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. Types of parameters 'x' and 'value' are incompatible. - Type 'number' is not assignable to type 'string'. + Type 'string' is not assignable to type 'number'. tests/cases/compiler/promisePermutations3.ts(81,19): error TS2345: Argument of type '(x: number, y?: string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. Types of parameters 'x' and 'value' are incompatible. - Type 'number' is not assignable to type 'string'. + Type 'string' is not assignable to type 'number'. tests/cases/compiler/promisePermutations3.ts(82,19): error TS2345: Argument of type '(x: number, y?: string) => Promise' is not assignable to parameter of type '(value: string) => Promise'. Types of parameters 'x' and 'value' are incompatible. - Type 'number' is not assignable to type 'string'. + Type 'string' is not assignable to type 'number'. tests/cases/compiler/promisePermutations3.ts(83,19): error TS2345: Argument of type '(x: number, y?: string) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. Types of parameters 'x' and 'value' are incompatible. - Type 'number' is not assignable to type 'string'. + Type 'string' is not assignable to type 'number'. tests/cases/compiler/promisePermutations3.ts(87,19): error TS2345: Argument of type '(x: number, cb: (a: string) => string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. tests/cases/compiler/promisePermutations3.ts(90,19): error TS2345: Argument of type '(x: number, cb: (a: string) => string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. tests/cases/compiler/promisePermutations3.ts(91,19): error TS2345: Argument of type '(x: number, cb: (a: string) => string) => Promise' is not assignable to parameter of type '(value: string) => Promise'. @@ -27,16 +26,16 @@ tests/cases/compiler/promisePermutations3.ts(100,19): error TS2345: Argument of tests/cases/compiler/promisePermutations3.ts(101,19): error TS2345: Argument of type '(x: number, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. tests/cases/compiler/promisePermutations3.ts(105,19): error TS2345: Argument of type '(cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. Types of parameters 'cb' and 'value' are incompatible. - Type '(a: T) => T' is not assignable to type 'string'. + Type 'string' is not assignable to type '(a: T) => T'. tests/cases/compiler/promisePermutations3.ts(108,19): error TS2345: Argument of type '(cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. Types of parameters 'cb' and 'value' are incompatible. - Type '(a: T) => T' is not assignable to type 'string'. + Type 'string' is not assignable to type '(a: T) => T'. tests/cases/compiler/promisePermutations3.ts(109,19): error TS2345: Argument of type '(cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => Promise'. Types of parameters 'cb' and 'value' are incompatible. - Type '(a: T) => T' is not assignable to type 'string'. + Type 'string' is not assignable to type '(a: T) => T'. tests/cases/compiler/promisePermutations3.ts(110,19): error TS2345: Argument of type '(cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. Types of parameters 'cb' and 'value' are incompatible. - Type '(a: T) => T' is not assignable to type 'string'. + Type 'string' is not assignable to type '(a: T) => T'. tests/cases/compiler/promisePermutations3.ts(116,19): error TS2345: Argument of type '(x: T, cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: number) => IPromise'. tests/cases/compiler/promisePermutations3.ts(119,19): error TS2345: Argument of type '(x: T, cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: number) => IPromise'. tests/cases/compiler/promisePermutations3.ts(120,19): error TS2345: Argument of type '(x: T, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: number) => Promise'. @@ -59,7 +58,7 @@ tests/cases/compiler/promisePermutations3.ts(151,12): error TS2453: The type arg Types of property 'then' are incompatible. Type '(success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void) => IPromise' is not assignable to type '{ (success?: (value: number) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: number) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: number) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: number) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; }'. Types of parameters 'success' and 'success' are incompatible. - Type '(value: string) => any' is not assignable to type '(value: number) => Promise'. + Type '(value: number) => Promise' is not assignable to type '(value: string) => any'. Types of parameters 'value' and 'value' are incompatible. Type 'string' is not assignable to type 'number'. tests/cases/compiler/promisePermutations3.ts(155,21): error TS2345: Argument of type '{ (x: number): IPromise; (x: string): IPromise; }' is not assignable to parameter of type '(value: number) => IPromise'. @@ -76,7 +75,7 @@ tests/cases/compiler/promisePermutations3.ts(159,21): error TS2345: Argument of Types of property 'then' are incompatible. Type '{ (success?: (value: number) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: number) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: number) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: number) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; }' is not assignable to type '(success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void) => IPromise'. Types of parameters 'success' and 'success' are incompatible. - Type '(value: number) => Promise' is not assignable to type '(value: string) => any'. + Type '(value: string) => any' is not assignable to type '(value: number) => Promise'. Types of parameters 'value' and 'value' are incompatible. Type 'number' is not assignable to type 'string'. tests/cases/compiler/promisePermutations3.ts(165,21): error TS2345: Argument of type '{ (x: T): IPromise; (x: T, y: T): Promise; }' is not assignable to parameter of type '(value: (x: any) => any) => Promise'. @@ -158,8 +157,7 @@ tests/cases/compiler/promisePermutations3.ts(165,21): error TS2345: Argument of ~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: number) => IPromise' is not assignable to parameter of type '(value: IPromise) => IPromise'. !!! error TS2345: Types of parameters 'x' and 'value' are incompatible. -!!! error TS2345: Type 'number' is not assignable to type 'IPromise'. -!!! error TS2345: Property 'then' is missing in type 'Number'. +!!! error TS2345: Type 'IPromise' is not assignable to type 'number'. var s3: Promise; var s3a = s3.then(testFunction3, testFunction3, testFunction3); var s3b = s3.then(testFunction3P, testFunction3P, testFunction3P); @@ -168,7 +166,7 @@ tests/cases/compiler/promisePermutations3.ts(165,21): error TS2345: Argument of ~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: number) => IPromise' is not assignable to parameter of type '(value: IPromise) => IPromise'. !!! error TS2345: Types of parameters 'x' and 'value' are incompatible. -!!! error TS2345: Type 'number' is not assignable to type 'IPromise'. +!!! error TS2345: Type 'IPromise' is not assignable to type 'number'. var r4: IPromise; var sIPromise: (x: any) => IPromise; @@ -177,24 +175,24 @@ tests/cases/compiler/promisePermutations3.ts(165,21): error TS2345: Argument of ~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: number, y?: string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. !!! error TS2345: Types of parameters 'x' and 'value' are incompatible. -!!! error TS2345: Type 'number' is not assignable to type 'string'. +!!! error TS2345: Type 'string' is not assignable to type 'number'. var r4b = r4.then(sIPromise, testFunction4, testFunction4).then(sIPromise, testFunction4, testFunction4); // ok var s4: Promise; var s4a = s4.then(testFunction4, testFunction4, testFunction4); // error ~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: number, y?: string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. !!! error TS2345: Types of parameters 'x' and 'value' are incompatible. -!!! error TS2345: Type 'number' is not assignable to type 'string'. +!!! error TS2345: Type 'string' is not assignable to type 'number'. var s4b = s4.then(testFunction4P, testFunction4P, testFunction4P); // error ~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: number, y?: string) => Promise' is not assignable to parameter of type '(value: string) => Promise'. !!! error TS2345: Types of parameters 'x' and 'value' are incompatible. -!!! error TS2345: Type 'number' is not assignable to type 'string'. +!!! error TS2345: Type 'string' is not assignable to type 'number'. var s4c = s4.then(testFunction4P, testFunction4, testFunction4); // error ~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: number, y?: string) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. !!! error TS2345: Types of parameters 'x' and 'value' are incompatible. -!!! error TS2345: Type 'number' is not assignable to type 'string'. +!!! error TS2345: Type 'string' is not assignable to type 'number'. var s4d = s4.then(sIPromise, testFunction4P, testFunction4).then(sIPromise, testFunction4P, testFunction4); var r5: IPromise; @@ -236,24 +234,24 @@ tests/cases/compiler/promisePermutations3.ts(165,21): error TS2345: Argument of ~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. !!! error TS2345: Types of parameters 'cb' and 'value' are incompatible. -!!! error TS2345: Type '(a: T) => T' is not assignable to type 'string'. +!!! error TS2345: Type 'string' is not assignable to type '(a: T) => T'. var r7b = r7.then(sIPromise, sIPromise, sIPromise).then(sIPromise, sIPromise, sIPromise); // ok var s7: Promise; var s7a = r7.then(testFunction7, testFunction7, testFunction7); // error ~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. !!! error TS2345: Types of parameters 'cb' and 'value' are incompatible. -!!! error TS2345: Type '(a: T) => T' is not assignable to type 'string'. +!!! error TS2345: Type 'string' is not assignable to type '(a: T) => T'. var s7b = r7.then(testFunction7P, testFunction7P, testFunction7P); // error ~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => Promise'. !!! error TS2345: Types of parameters 'cb' and 'value' are incompatible. -!!! error TS2345: Type '(a: T) => T' is not assignable to type 'string'. +!!! error TS2345: Type 'string' is not assignable to type '(a: T) => T'. var s7c = r7.then(testFunction7P, testFunction7, testFunction7); // error ~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. !!! error TS2345: Types of parameters 'cb' and 'value' are incompatible. -!!! error TS2345: Type '(a: T) => T' is not assignable to type 'string'. +!!! error TS2345: Type 'string' is not assignable to type '(a: T) => T'. var s7d = r7.then(sPromise, sPromise, sPromise).then(sPromise, sPromise, sPromise); // ok? var r8: IPromise; @@ -329,7 +327,7 @@ tests/cases/compiler/promisePermutations3.ts(165,21): error TS2345: Argument of !!! error TS2453: Types of property 'then' are incompatible. !!! error TS2453: Type '(success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void) => IPromise' is not assignable to type '{ (success?: (value: number) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: number) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: number) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: number) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; }'. !!! error TS2453: Types of parameters 'success' and 'success' are incompatible. -!!! error TS2453: Type '(value: string) => any' is not assignable to type '(value: number) => Promise'. +!!! error TS2453: Type '(value: number) => Promise' is not assignable to type '(value: string) => any'. !!! error TS2453: Types of parameters 'value' and 'value' are incompatible. !!! error TS2453: Type 'string' is not assignable to type 'number'. var s10g = s10.then(testFunctionP, nIPromise, sIPromise).then(sPromise, sIPromise, sIPromise); // ok @@ -358,7 +356,7 @@ tests/cases/compiler/promisePermutations3.ts(165,21): error TS2345: Argument of !!! error TS2345: Types of property 'then' are incompatible. !!! error TS2345: Type '{ (success?: (value: number) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: number) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: number) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: number) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; }' is not assignable to type '(success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void) => IPromise'. !!! error TS2345: Types of parameters 'success' and 'success' are incompatible. -!!! error TS2345: Type '(value: number) => Promise' is not assignable to type '(value: string) => any'. +!!! error TS2345: Type '(value: string) => any' is not assignable to type '(value: number) => Promise'. !!! error TS2345: Types of parameters 'value' and 'value' are incompatible. !!! error TS2345: Type 'number' is not assignable to type 'string'. diff --git a/tests/baselines/reference/promiseTest.symbols b/tests/baselines/reference/promiseTest.symbols index 229d3e089d0..6cf4ff98d8f 100644 --- a/tests/baselines/reference/promiseTest.symbols +++ b/tests/baselines/reference/promiseTest.symbols @@ -5,7 +5,7 @@ interface Promise { >T : Symbol(T, Decl(promiseTest.ts, 1, 18)) then(success?: (value: T) => Promise): Promise; ->then : Symbol(then, Decl(promiseTest.ts, 1, 22), Decl(promiseTest.ts, 2, 60)) +>then : Symbol(Promise.then, Decl(promiseTest.ts, 1, 22), Decl(promiseTest.ts, 2, 60)) >A : Symbol(A, Decl(promiseTest.ts, 2, 9)) >success : Symbol(success, Decl(promiseTest.ts, 2, 12)) >value : Symbol(value, Decl(promiseTest.ts, 2, 23)) @@ -16,7 +16,7 @@ interface Promise { >A : Symbol(A, Decl(promiseTest.ts, 2, 9)) then(success?: (value: T) => B): Promise; ->then : Symbol(then, Decl(promiseTest.ts, 1, 22), Decl(promiseTest.ts, 2, 60)) +>then : Symbol(Promise.then, Decl(promiseTest.ts, 1, 22), Decl(promiseTest.ts, 2, 60)) >B : Symbol(B, Decl(promiseTest.ts, 3, 9)) >success : Symbol(success, Decl(promiseTest.ts, 3, 12)) >value : Symbol(value, Decl(promiseTest.ts, 3, 23)) @@ -26,7 +26,7 @@ interface Promise { >B : Symbol(B, Decl(promiseTest.ts, 3, 9)) data: T; ->data : Symbol(data, Decl(promiseTest.ts, 3, 51)) +>data : Symbol(Promise.data, Decl(promiseTest.ts, 3, 51)) >T : Symbol(T, Decl(promiseTest.ts, 1, 18)) } diff --git a/tests/baselines/reference/promiseTypeInference.symbols b/tests/baselines/reference/promiseTypeInference.symbols index 14a77b9cdf2..1dcf037b8b3 100644 --- a/tests/baselines/reference/promiseTypeInference.symbols +++ b/tests/baselines/reference/promiseTypeInference.symbols @@ -4,7 +4,7 @@ declare class Promise { >T : Symbol(T, Decl(promiseTypeInference.ts, 0, 22)) then(success?: (value: T) => Promise): Promise; ->then : Symbol(then, Decl(promiseTypeInference.ts, 0, 26)) +>then : Symbol(Promise.then, Decl(promiseTypeInference.ts, 0, 26)) >U : Symbol(U, Decl(promiseTypeInference.ts, 1, 9)) >success : Symbol(success, Decl(promiseTypeInference.ts, 1, 12)) >value : Symbol(value, Decl(promiseTypeInference.ts, 1, 23)) @@ -19,7 +19,7 @@ interface IPromise { >T : Symbol(T, Decl(promiseTypeInference.ts, 3, 19)) then(success?: (value: T) => IPromise): IPromise; ->then : Symbol(then, Decl(promiseTypeInference.ts, 3, 23)) +>then : Symbol(IPromise.then, Decl(promiseTypeInference.ts, 3, 23)) >U : Symbol(U, Decl(promiseTypeInference.ts, 4, 9)) >success : Symbol(success, Decl(promiseTypeInference.ts, 4, 12)) >value : Symbol(value, Decl(promiseTypeInference.ts, 4, 23)) diff --git a/tests/baselines/reference/promiseVoidErrorCallback.symbols b/tests/baselines/reference/promiseVoidErrorCallback.symbols index 93e86b9ec2e..b2959f139ea 100644 --- a/tests/baselines/reference/promiseVoidErrorCallback.symbols +++ b/tests/baselines/reference/promiseVoidErrorCallback.symbols @@ -3,32 +3,32 @@ interface T1 { >T1 : Symbol(T1, Decl(promiseVoidErrorCallback.ts, 0, 0)) __t1: string; ->__t1 : Symbol(__t1, Decl(promiseVoidErrorCallback.ts, 0, 14)) +>__t1 : Symbol(T1.__t1, Decl(promiseVoidErrorCallback.ts, 0, 14)) } interface T2 { >T2 : Symbol(T2, Decl(promiseVoidErrorCallback.ts, 2, 1)) __t2: string; ->__t2 : Symbol(__t2, Decl(promiseVoidErrorCallback.ts, 4, 14)) +>__t2 : Symbol(T2.__t2, Decl(promiseVoidErrorCallback.ts, 4, 14)) } interface T3 { >T3 : Symbol(T3, Decl(promiseVoidErrorCallback.ts, 6, 1)) __t3: string; ->__t3 : Symbol(__t3, Decl(promiseVoidErrorCallback.ts, 8, 14)) +>__t3 : Symbol(T3.__t3, Decl(promiseVoidErrorCallback.ts, 8, 14)) } function f1(): Promise { >f1 : Symbol(f1, Decl(promiseVoidErrorCallback.ts, 10, 1)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >T1 : Symbol(T1, Decl(promiseVoidErrorCallback.ts, 0, 0)) return Promise.resolve({ __t1: "foo_t1" }); ->Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->resolve : Symbol(PromiseConstructor.resolve, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >__t1 : Symbol(__t1, Decl(promiseVoidErrorCallback.ts, 13, 28)) } @@ -47,22 +47,22 @@ function f2(x: T1): T2 { var x3 = f1() >x3 : Symbol(x3, Decl(promiseVoidErrorCallback.ts, 20, 3)) ->f1() .then(f2, (e: Error) => { throw e;}) .then : Symbol(Promise.then, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->f1() .then : Symbol(Promise.then, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>f1() .then(f2, (e: Error) => { throw e;}) .then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>f1() .then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >f1 : Symbol(f1, Decl(promiseVoidErrorCallback.ts, 10, 1)) .then(f2, (e: Error) => { ->then : Symbol(Promise.then, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >f2 : Symbol(f2, Decl(promiseVoidErrorCallback.ts, 14, 1)) >e : Symbol(e, Decl(promiseVoidErrorCallback.ts, 21, 15)) ->Error : Symbol(Error, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) throw e; >e : Symbol(e, Decl(promiseVoidErrorCallback.ts, 21, 15)) }) .then((x: T2) => { ->then : Symbol(Promise.then, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >x : Symbol(x, Decl(promiseVoidErrorCallback.ts, 24, 11)) >T2 : Symbol(T2, Decl(promiseVoidErrorCallback.ts, 2, 1)) diff --git a/tests/baselines/reference/promiseVoidErrorCallback.types b/tests/baselines/reference/promiseVoidErrorCallback.types index 82b248f64bd..b536ab089bd 100644 --- a/tests/baselines/reference/promiseVoidErrorCallback.types +++ b/tests/baselines/reference/promiseVoidErrorCallback.types @@ -63,7 +63,7 @@ var x3 = f1() .then(f2, (e: Error) => { >then : { (onfulfilled?: (value: T1) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled?: (value: T1) => TResult | PromiseLike, onrejected?: (reason: any) => void): Promise; } >f2 : (x: T1) => T2 ->(e: Error) => { throw e;} : (e: Error) => void +>(e: Error) => { throw e;} : (e: Error) => never >e : Error >Error : Error diff --git a/tests/baselines/reference/promises.symbols b/tests/baselines/reference/promises.symbols index 9c25dc8ad28..623a9cfb20a 100644 --- a/tests/baselines/reference/promises.symbols +++ b/tests/baselines/reference/promises.symbols @@ -4,7 +4,7 @@ interface Promise { >T : Symbol(T, Decl(promises.ts, 0, 18)) then(success?: (value: T) => U): Promise; ->then : Symbol(then, Decl(promises.ts, 0, 22), Decl(promises.ts, 1, 51)) +>then : Symbol(Promise.then, Decl(promises.ts, 0, 22), Decl(promises.ts, 1, 51)) >U : Symbol(U, Decl(promises.ts, 1, 9)) >success : Symbol(success, Decl(promises.ts, 1, 12)) >value : Symbol(value, Decl(promises.ts, 1, 23)) @@ -14,7 +14,7 @@ interface Promise { >U : Symbol(U, Decl(promises.ts, 1, 9)) then(success?: (value: T) => Promise): Promise; ->then : Symbol(then, Decl(promises.ts, 0, 22), Decl(promises.ts, 1, 51)) +>then : Symbol(Promise.then, Decl(promises.ts, 0, 22), Decl(promises.ts, 1, 51)) >U : Symbol(U, Decl(promises.ts, 2, 9)) >success : Symbol(success, Decl(promises.ts, 2, 12)) >value : Symbol(value, Decl(promises.ts, 2, 23)) @@ -25,7 +25,7 @@ interface Promise { >U : Symbol(U, Decl(promises.ts, 2, 9)) value: T; ->value : Symbol(value, Decl(promises.ts, 2, 60)) +>value : Symbol(Promise.value, Decl(promises.ts, 2, 60)) >T : Symbol(T, Decl(promises.ts, 0, 18)) } diff --git a/tests/baselines/reference/promisesWithConstraints.symbols b/tests/baselines/reference/promisesWithConstraints.symbols index 055f67cadc1..a180a26135c 100644 --- a/tests/baselines/reference/promisesWithConstraints.symbols +++ b/tests/baselines/reference/promisesWithConstraints.symbols @@ -4,7 +4,7 @@ interface Promise { >T : Symbol(T, Decl(promisesWithConstraints.ts, 0, 18)) then(cb: (x: T) => Promise): Promise; ->then : Symbol(then, Decl(promisesWithConstraints.ts, 0, 22)) +>then : Symbol(Promise.then, Decl(promisesWithConstraints.ts, 0, 22)) >U : Symbol(U, Decl(promisesWithConstraints.ts, 1, 9)) >cb : Symbol(cb, Decl(promisesWithConstraints.ts, 1, 12)) >x : Symbol(x, Decl(promisesWithConstraints.ts, 1, 17)) @@ -21,7 +21,7 @@ interface CPromise { >x : Symbol(x, Decl(promisesWithConstraints.ts, 4, 30)) then(cb: (x: T) => Promise): Promise; ->then : Symbol(then, Decl(promisesWithConstraints.ts, 4, 43)) +>then : Symbol(CPromise.then, Decl(promisesWithConstraints.ts, 4, 43)) >U : Symbol(U, Decl(promisesWithConstraints.ts, 5, 9)) >x : Symbol(x, Decl(promisesWithConstraints.ts, 5, 20)) >cb : Symbol(cb, Decl(promisesWithConstraints.ts, 5, 32)) @@ -35,12 +35,12 @@ interface CPromise { interface Foo { x; } >Foo : Symbol(Foo, Decl(promisesWithConstraints.ts, 6, 1)) ->x : Symbol(x, Decl(promisesWithConstraints.ts, 8, 15)) +>x : Symbol(Foo.x, Decl(promisesWithConstraints.ts, 8, 15)) interface Bar { x; y; } >Bar : Symbol(Bar, Decl(promisesWithConstraints.ts, 8, 20)) ->x : Symbol(x, Decl(promisesWithConstraints.ts, 9, 15)) ->y : Symbol(y, Decl(promisesWithConstraints.ts, 9, 18)) +>x : Symbol(Bar.x, Decl(promisesWithConstraints.ts, 9, 15)) +>y : Symbol(Bar.y, Decl(promisesWithConstraints.ts, 9, 18)) var a: Promise; >a : Symbol(a, Decl(promisesWithConstraints.ts, 11, 3)) diff --git a/tests/baselines/reference/propagationOfPromiseInitialization.symbols b/tests/baselines/reference/propagationOfPromiseInitialization.symbols index 25527f05809..ce60dd5818d 100644 --- a/tests/baselines/reference/propagationOfPromiseInitialization.symbols +++ b/tests/baselines/reference/propagationOfPromiseInitialization.symbols @@ -4,7 +4,7 @@ interface IPromise { >T : Symbol(T, Decl(propagationOfPromiseInitialization.ts, 0, 19)) then(successCallback: (promiseValue: T) => TResult, errorCallback?: (reason: any) => TResult): IPromise; ->then : Symbol(then, Decl(propagationOfPromiseInitialization.ts, 0, 23)) +>then : Symbol(IPromise.then, Decl(propagationOfPromiseInitialization.ts, 0, 23)) >TResult : Symbol(TResult, Decl(propagationOfPromiseInitialization.ts, 1, 9)) >successCallback : Symbol(successCallback, Decl(propagationOfPromiseInitialization.ts, 1, 18)) >promiseValue : Symbol(promiseValue, Decl(propagationOfPromiseInitialization.ts, 1, 36)) diff --git a/tests/baselines/reference/properties.symbols b/tests/baselines/reference/properties.symbols index 6e344f03934..c322e5ecfb2 100644 --- a/tests/baselines/reference/properties.symbols +++ b/tests/baselines/reference/properties.symbols @@ -4,13 +4,13 @@ class MyClass >MyClass : Symbol(MyClass, Decl(properties.ts, 0, 0)) { public get Count(): number ->Count : Symbol(Count, Decl(properties.ts, 2, 1), Decl(properties.ts, 6, 5)) +>Count : Symbol(MyClass.Count, Decl(properties.ts, 2, 1), Decl(properties.ts, 6, 5)) { return 42; } public set Count(value: number) ->Count : Symbol(Count, Decl(properties.ts, 2, 1), Decl(properties.ts, 6, 5)) +>Count : Symbol(MyClass.Count, Decl(properties.ts, 2, 1), Decl(properties.ts, 6, 5)) >value : Symbol(value, Decl(properties.ts, 8, 21)) { // diff --git a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints.symbols b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints.symbols index bf5cb72a708..6fbb89f00de 100644 --- a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints.symbols +++ b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints.symbols @@ -5,10 +5,10 @@ class C { >C : Symbol(C, Decl(propertyAccessOnTypeParameterWithConstraints.ts, 0, 0)) >T : Symbol(T, Decl(propertyAccessOnTypeParameterWithConstraints.ts, 3, 8)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) f() { ->f : Symbol(f, Decl(propertyAccessOnTypeParameterWithConstraints.ts, 3, 25)) +>f : Symbol(C.f, Decl(propertyAccessOnTypeParameterWithConstraints.ts, 3, 25)) var x: T; >x : Symbol(x, Decl(propertyAccessOnTypeParameterWithConstraints.ts, 5, 11)) @@ -31,22 +31,22 @@ var r = (new C()).f(); >r : Symbol(r, Decl(propertyAccessOnTypeParameterWithConstraints.ts, 11, 3)) >(new C()).f : Symbol(C.f, Decl(propertyAccessOnTypeParameterWithConstraints.ts, 3, 25)) >C : Symbol(C, Decl(propertyAccessOnTypeParameterWithConstraints.ts, 0, 0)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >f : Symbol(C.f, Decl(propertyAccessOnTypeParameterWithConstraints.ts, 3, 25)) interface I { >I : Symbol(I, Decl(propertyAccessOnTypeParameterWithConstraints.ts, 11, 28)) >T : Symbol(T, Decl(propertyAccessOnTypeParameterWithConstraints.ts, 13, 12)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) foo: T; ->foo : Symbol(foo, Decl(propertyAccessOnTypeParameterWithConstraints.ts, 13, 29)) +>foo : Symbol(I.foo, Decl(propertyAccessOnTypeParameterWithConstraints.ts, 13, 29)) >T : Symbol(T, Decl(propertyAccessOnTypeParameterWithConstraints.ts, 13, 12)) } var i: I; >i : Symbol(i, Decl(propertyAccessOnTypeParameterWithConstraints.ts, 16, 3)) >I : Symbol(I, Decl(propertyAccessOnTypeParameterWithConstraints.ts, 11, 28)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) var r2 = i.foo.getDate(); >r2 : Symbol(r2, Decl(propertyAccessOnTypeParameterWithConstraints.ts, 17, 3)) @@ -68,14 +68,14 @@ var a: { (): T; >T : Symbol(T, Decl(propertyAccessOnTypeParameterWithConstraints.ts, 21, 5)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >T : Symbol(T, Decl(propertyAccessOnTypeParameterWithConstraints.ts, 21, 5)) } var r3 = a().getDate(); >r3 : Symbol(r3, Decl(propertyAccessOnTypeParameterWithConstraints.ts, 23, 3)) >a().getDate : Symbol(Date.getDate, Decl(lib.d.ts, --, --)) >a : Symbol(a, Decl(propertyAccessOnTypeParameterWithConstraints.ts, 20, 3)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >getDate : Symbol(Date.getDate, Decl(lib.d.ts, --, --)) var r3b = a()['getDate'](); @@ -89,7 +89,7 @@ var b = { foo: (x: T) => { >foo : Symbol(foo, Decl(propertyAccessOnTypeParameterWithConstraints.ts, 26, 9)) >T : Symbol(T, Decl(propertyAccessOnTypeParameterWithConstraints.ts, 27, 10)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(propertyAccessOnTypeParameterWithConstraints.ts, 27, 26)) >T : Symbol(T, Decl(propertyAccessOnTypeParameterWithConstraints.ts, 27, 10)) @@ -111,5 +111,5 @@ var r4 = b.foo(new Date()); >b.foo : Symbol(foo, Decl(propertyAccessOnTypeParameterWithConstraints.ts, 26, 9)) >b : Symbol(b, Decl(propertyAccessOnTypeParameterWithConstraints.ts, 26, 3)) >foo : Symbol(foo, Decl(propertyAccessOnTypeParameterWithConstraints.ts, 26, 9)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) diff --git a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints2.symbols b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints2.symbols index 29a3b30d450..e535e3e7e71 100644 --- a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints2.symbols +++ b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints2.symbols @@ -5,7 +5,7 @@ class A { >A : Symbol(A, Decl(propertyAccessOnTypeParameterWithConstraints2.ts, 0, 0)) foo(): string { return ''; } ->foo : Symbol(foo, Decl(propertyAccessOnTypeParameterWithConstraints2.ts, 2, 9)) +>foo : Symbol(A.foo, Decl(propertyAccessOnTypeParameterWithConstraints2.ts, 2, 9)) } class B extends A { @@ -13,7 +13,7 @@ class B extends A { >A : Symbol(A, Decl(propertyAccessOnTypeParameterWithConstraints2.ts, 0, 0)) bar(): string { ->bar : Symbol(bar, Decl(propertyAccessOnTypeParameterWithConstraints2.ts, 6, 19)) +>bar : Symbol(B.bar, Decl(propertyAccessOnTypeParameterWithConstraints2.ts, 6, 19)) return ''; } @@ -27,7 +27,7 @@ class C { >A : Symbol(A, Decl(propertyAccessOnTypeParameterWithConstraints2.ts, 0, 0)) f() { ->f : Symbol(f, Decl(propertyAccessOnTypeParameterWithConstraints2.ts, 12, 35)) +>f : Symbol(C.f, Decl(propertyAccessOnTypeParameterWithConstraints2.ts, 12, 35)) var x: U; >x : Symbol(x, Decl(propertyAccessOnTypeParameterWithConstraints2.ts, 14, 11)) @@ -46,7 +46,7 @@ class C { } g(x: U) { ->g : Symbol(g, Decl(propertyAccessOnTypeParameterWithConstraints2.ts, 17, 5)) +>g : Symbol(C.g, Decl(propertyAccessOnTypeParameterWithConstraints2.ts, 17, 5)) >x : Symbol(x, Decl(propertyAccessOnTypeParameterWithConstraints2.ts, 19, 6)) >U : Symbol(U, Decl(propertyAccessOnTypeParameterWithConstraints2.ts, 12, 8)) @@ -100,7 +100,7 @@ interface I { >A : Symbol(A, Decl(propertyAccessOnTypeParameterWithConstraints2.ts, 0, 0)) foo: U; ->foo : Symbol(foo, Decl(propertyAccessOnTypeParameterWithConstraints2.ts, 40, 39)) +>foo : Symbol(I.foo, Decl(propertyAccessOnTypeParameterWithConstraints2.ts, 40, 39)) >U : Symbol(U, Decl(propertyAccessOnTypeParameterWithConstraints2.ts, 40, 12)) } //interface I { diff --git a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints3.symbols b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints3.symbols index 6d1074b14f6..c651871a7e3 100644 --- a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints3.symbols +++ b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints3.symbols @@ -5,7 +5,7 @@ class A { >A : Symbol(A, Decl(propertyAccessOnTypeParameterWithConstraints3.ts, 0, 0)) foo(): string { return ''; } ->foo : Symbol(foo, Decl(propertyAccessOnTypeParameterWithConstraints3.ts, 2, 9)) +>foo : Symbol(A.foo, Decl(propertyAccessOnTypeParameterWithConstraints3.ts, 2, 9)) } class B extends A { @@ -13,7 +13,7 @@ class B extends A { >A : Symbol(A, Decl(propertyAccessOnTypeParameterWithConstraints3.ts, 0, 0)) bar(): string { ->bar : Symbol(bar, Decl(propertyAccessOnTypeParameterWithConstraints3.ts, 6, 19)) +>bar : Symbol(B.bar, Decl(propertyAccessOnTypeParameterWithConstraints3.ts, 6, 19)) return ''; } @@ -27,7 +27,7 @@ class C { >U : Symbol(U, Decl(propertyAccessOnTypeParameterWithConstraints3.ts, 12, 8)) f() { ->f : Symbol(f, Decl(propertyAccessOnTypeParameterWithConstraints3.ts, 12, 35)) +>f : Symbol(C.f, Decl(propertyAccessOnTypeParameterWithConstraints3.ts, 12, 35)) var x: T; >x : Symbol(x, Decl(propertyAccessOnTypeParameterWithConstraints3.ts, 14, 11)) @@ -47,7 +47,7 @@ class C { } g(x: U) { ->g : Symbol(g, Decl(propertyAccessOnTypeParameterWithConstraints3.ts, 18, 5)) +>g : Symbol(C.g, Decl(propertyAccessOnTypeParameterWithConstraints3.ts, 18, 5)) >x : Symbol(x, Decl(propertyAccessOnTypeParameterWithConstraints3.ts, 20, 6)) >U : Symbol(U, Decl(propertyAccessOnTypeParameterWithConstraints3.ts, 12, 8)) @@ -90,7 +90,7 @@ interface I { >U : Symbol(U, Decl(propertyAccessOnTypeParameterWithConstraints3.ts, 30, 12)) foo: T; ->foo : Symbol(foo, Decl(propertyAccessOnTypeParameterWithConstraints3.ts, 30, 39)) +>foo : Symbol(I.foo, Decl(propertyAccessOnTypeParameterWithConstraints3.ts, 30, 39)) >T : Symbol(T, Decl(propertyAccessOnTypeParameterWithConstraints3.ts, 30, 24)) } var i: I; diff --git a/tests/baselines/reference/propertyAccessOnTypeParameterWithoutConstraints.symbols b/tests/baselines/reference/propertyAccessOnTypeParameterWithoutConstraints.symbols index 7417346a791..4ae9957f41e 100644 --- a/tests/baselines/reference/propertyAccessOnTypeParameterWithoutConstraints.symbols +++ b/tests/baselines/reference/propertyAccessOnTypeParameterWithoutConstraints.symbols @@ -4,7 +4,7 @@ class C { >T : Symbol(T, Decl(propertyAccessOnTypeParameterWithoutConstraints.ts, 0, 8)) f() { ->f : Symbol(f, Decl(propertyAccessOnTypeParameterWithoutConstraints.ts, 0, 12)) +>f : Symbol(C.f, Decl(propertyAccessOnTypeParameterWithoutConstraints.ts, 0, 12)) var x: T; >x : Symbol(x, Decl(propertyAccessOnTypeParameterWithoutConstraints.ts, 2, 11)) @@ -34,7 +34,7 @@ interface I { >T : Symbol(T, Decl(propertyAccessOnTypeParameterWithoutConstraints.ts, 10, 12)) foo: T; ->foo : Symbol(foo, Decl(propertyAccessOnTypeParameterWithoutConstraints.ts, 10, 16)) +>foo : Symbol(I.foo, Decl(propertyAccessOnTypeParameterWithoutConstraints.ts, 10, 16)) >T : Symbol(T, Decl(propertyAccessOnTypeParameterWithoutConstraints.ts, 10, 12)) } var i: I; diff --git a/tests/baselines/reference/propertyAccessibility1.errors.txt b/tests/baselines/reference/propertyAccessibility1.errors.txt index 2caf251b2a5..fb1b0bbf0f6 100644 --- a/tests/baselines/reference/propertyAccessibility1.errors.txt +++ b/tests/baselines/reference/propertyAccessibility1.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/propertyAccessibility1.ts(5,1): error TS2341: Property 'privProp' is private and only accessible within class 'Foo'. +tests/cases/compiler/propertyAccessibility1.ts(5,3): error TS2341: Property 'privProp' is private and only accessible within class 'Foo'. ==== tests/cases/compiler/propertyAccessibility1.ts (1 errors) ==== @@ -7,6 +7,6 @@ tests/cases/compiler/propertyAccessibility1.ts(5,1): error TS2341: Property 'pri } var f = new Foo(); f.privProp; - ~~~~~~~~~~ + ~~~~~~~~ !!! error TS2341: Property 'privProp' is private and only accessible within class 'Foo'. \ No newline at end of file diff --git a/tests/baselines/reference/propertyAccessibility2.errors.txt b/tests/baselines/reference/propertyAccessibility2.errors.txt index 7eb81d45ed4..4e958b8d72b 100644 --- a/tests/baselines/reference/propertyAccessibility2.errors.txt +++ b/tests/baselines/reference/propertyAccessibility2.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/propertyAccessibility2.ts(4,9): error TS2341: Property 'x' is private and only accessible within class 'C'. +tests/cases/compiler/propertyAccessibility2.ts(4,11): error TS2341: Property 'x' is private and only accessible within class 'C'. ==== tests/cases/compiler/propertyAccessibility2.ts (1 errors) ==== @@ -6,6 +6,6 @@ tests/cases/compiler/propertyAccessibility2.ts(4,9): error TS2341: Property 'x' private static x = 1; } var c = C.x; - ~~~ + ~ !!! error TS2341: Property 'x' is private and only accessible within class 'C'. \ No newline at end of file diff --git a/tests/baselines/reference/propertyNameWithoutTypeAnnotation.symbols b/tests/baselines/reference/propertyNameWithoutTypeAnnotation.symbols index 45840561fa7..3c430005fca 100644 --- a/tests/baselines/reference/propertyNameWithoutTypeAnnotation.symbols +++ b/tests/baselines/reference/propertyNameWithoutTypeAnnotation.symbols @@ -3,14 +3,14 @@ class C { >C : Symbol(C, Decl(propertyNameWithoutTypeAnnotation.ts, 0, 0)) foo; ->foo : Symbol(foo, Decl(propertyNameWithoutTypeAnnotation.ts, 0, 9)) +>foo : Symbol(C.foo, Decl(propertyNameWithoutTypeAnnotation.ts, 0, 9)) } interface I { >I : Symbol(I, Decl(propertyNameWithoutTypeAnnotation.ts, 2, 1)) foo; ->foo : Symbol(foo, Decl(propertyNameWithoutTypeAnnotation.ts, 4, 13)) +>foo : Symbol(I.foo, Decl(propertyNameWithoutTypeAnnotation.ts, 4, 13)) } var a: { diff --git a/tests/baselines/reference/propertyNamesOfReservedWords.symbols b/tests/baselines/reference/propertyNamesOfReservedWords.symbols index 591fae05bd5..1ee7ee58595 100644 --- a/tests/baselines/reference/propertyNamesOfReservedWords.symbols +++ b/tests/baselines/reference/propertyNamesOfReservedWords.symbols @@ -3,193 +3,193 @@ class C { >C : Symbol(C, Decl(propertyNamesOfReservedWords.ts, 0, 0)) abstract; ->abstract : Symbol(abstract, Decl(propertyNamesOfReservedWords.ts, 0, 9)) +>abstract : Symbol(C.abstract, Decl(propertyNamesOfReservedWords.ts, 0, 9)) as; ->as : Symbol(as, Decl(propertyNamesOfReservedWords.ts, 1, 13)) +>as : Symbol(C.as, Decl(propertyNamesOfReservedWords.ts, 1, 13)) boolean; ->boolean : Symbol(boolean, Decl(propertyNamesOfReservedWords.ts, 2, 7)) +>boolean : Symbol(C.boolean, Decl(propertyNamesOfReservedWords.ts, 2, 7)) break; ->break : Symbol(break, Decl(propertyNamesOfReservedWords.ts, 3, 12)) +>break : Symbol(C.break, Decl(propertyNamesOfReservedWords.ts, 3, 12)) byte; ->byte : Symbol(byte, Decl(propertyNamesOfReservedWords.ts, 4, 10)) +>byte : Symbol(C.byte, Decl(propertyNamesOfReservedWords.ts, 4, 10)) case; ->case : Symbol(case, Decl(propertyNamesOfReservedWords.ts, 5, 9)) +>case : Symbol(C.case, Decl(propertyNamesOfReservedWords.ts, 5, 9)) catch; ->catch : Symbol(catch, Decl(propertyNamesOfReservedWords.ts, 6, 9)) +>catch : Symbol(C.catch, Decl(propertyNamesOfReservedWords.ts, 6, 9)) char; ->char : Symbol(char, Decl(propertyNamesOfReservedWords.ts, 7, 10)) +>char : Symbol(C.char, Decl(propertyNamesOfReservedWords.ts, 7, 10)) class; ->class : Symbol(class, Decl(propertyNamesOfReservedWords.ts, 8, 9)) +>class : Symbol(C.class, Decl(propertyNamesOfReservedWords.ts, 8, 9)) continue; ->continue : Symbol(continue, Decl(propertyNamesOfReservedWords.ts, 9, 10)) +>continue : Symbol(C.continue, Decl(propertyNamesOfReservedWords.ts, 9, 10)) const; ->const : Symbol(const, Decl(propertyNamesOfReservedWords.ts, 10, 13)) +>const : Symbol(C.const, Decl(propertyNamesOfReservedWords.ts, 10, 13)) debugger; ->debugger : Symbol(debugger, Decl(propertyNamesOfReservedWords.ts, 11, 10)) +>debugger : Symbol(C.debugger, Decl(propertyNamesOfReservedWords.ts, 11, 10)) default; ->default : Symbol(default, Decl(propertyNamesOfReservedWords.ts, 12, 13)) +>default : Symbol(C.default, Decl(propertyNamesOfReservedWords.ts, 12, 13)) delete; ->delete : Symbol(delete, Decl(propertyNamesOfReservedWords.ts, 13, 12)) +>delete : Symbol(C.delete, Decl(propertyNamesOfReservedWords.ts, 13, 12)) do; ->do : Symbol(do, Decl(propertyNamesOfReservedWords.ts, 14, 11)) +>do : Symbol(C.do, Decl(propertyNamesOfReservedWords.ts, 14, 11)) double; ->double : Symbol(double, Decl(propertyNamesOfReservedWords.ts, 15, 7)) +>double : Symbol(C.double, Decl(propertyNamesOfReservedWords.ts, 15, 7)) else; ->else : Symbol(else, Decl(propertyNamesOfReservedWords.ts, 16, 11)) +>else : Symbol(C.else, Decl(propertyNamesOfReservedWords.ts, 16, 11)) enum; ->enum : Symbol(enum, Decl(propertyNamesOfReservedWords.ts, 17, 9)) +>enum : Symbol(C.enum, Decl(propertyNamesOfReservedWords.ts, 17, 9)) export; ->export : Symbol(export, Decl(propertyNamesOfReservedWords.ts, 18, 9)) +>export : Symbol(C.export, Decl(propertyNamesOfReservedWords.ts, 18, 9)) extends; ->extends : Symbol(extends, Decl(propertyNamesOfReservedWords.ts, 19, 11)) +>extends : Symbol(C.extends, Decl(propertyNamesOfReservedWords.ts, 19, 11)) false; ->false : Symbol(false, Decl(propertyNamesOfReservedWords.ts, 20, 12)) +>false : Symbol(C.false, Decl(propertyNamesOfReservedWords.ts, 20, 12)) final; ->final : Symbol(final, Decl(propertyNamesOfReservedWords.ts, 21, 10)) +>final : Symbol(C.final, Decl(propertyNamesOfReservedWords.ts, 21, 10)) finally; ->finally : Symbol(finally, Decl(propertyNamesOfReservedWords.ts, 22, 10)) +>finally : Symbol(C.finally, Decl(propertyNamesOfReservedWords.ts, 22, 10)) float; ->float : Symbol(float, Decl(propertyNamesOfReservedWords.ts, 23, 12)) +>float : Symbol(C.float, Decl(propertyNamesOfReservedWords.ts, 23, 12)) for; ->for : Symbol(for, Decl(propertyNamesOfReservedWords.ts, 24, 10)) +>for : Symbol(C.for, Decl(propertyNamesOfReservedWords.ts, 24, 10)) function; ->function : Symbol(function, Decl(propertyNamesOfReservedWords.ts, 25, 8)) +>function : Symbol(C.function, Decl(propertyNamesOfReservedWords.ts, 25, 8)) goto; ->goto : Symbol(goto, Decl(propertyNamesOfReservedWords.ts, 26, 13)) +>goto : Symbol(C.goto, Decl(propertyNamesOfReservedWords.ts, 26, 13)) if; ->if : Symbol(if, Decl(propertyNamesOfReservedWords.ts, 27, 9)) +>if : Symbol(C.if, Decl(propertyNamesOfReservedWords.ts, 27, 9)) implements; ->implements : Symbol(implements, Decl(propertyNamesOfReservedWords.ts, 28, 7)) +>implements : Symbol(C.implements, Decl(propertyNamesOfReservedWords.ts, 28, 7)) import; ->import : Symbol(import, Decl(propertyNamesOfReservedWords.ts, 29, 15)) +>import : Symbol(C.import, Decl(propertyNamesOfReservedWords.ts, 29, 15)) in; ->in : Symbol(in, Decl(propertyNamesOfReservedWords.ts, 30, 11)) +>in : Symbol(C.in, Decl(propertyNamesOfReservedWords.ts, 30, 11)) instanceof; ->instanceof : Symbol(instanceof, Decl(propertyNamesOfReservedWords.ts, 31, 7)) +>instanceof : Symbol(C.instanceof, Decl(propertyNamesOfReservedWords.ts, 31, 7)) int; ->int : Symbol(int, Decl(propertyNamesOfReservedWords.ts, 32, 15)) +>int : Symbol(C.int, Decl(propertyNamesOfReservedWords.ts, 32, 15)) interface; ->interface : Symbol(interface, Decl(propertyNamesOfReservedWords.ts, 33, 8)) +>interface : Symbol(C.interface, Decl(propertyNamesOfReservedWords.ts, 33, 8)) is; ->is : Symbol(is, Decl(propertyNamesOfReservedWords.ts, 34, 14)) +>is : Symbol(C.is, Decl(propertyNamesOfReservedWords.ts, 34, 14)) long; ->long : Symbol(long, Decl(propertyNamesOfReservedWords.ts, 35, 7)) +>long : Symbol(C.long, Decl(propertyNamesOfReservedWords.ts, 35, 7)) namespace; ->namespace : Symbol(namespace, Decl(propertyNamesOfReservedWords.ts, 36, 9)) +>namespace : Symbol(C.namespace, Decl(propertyNamesOfReservedWords.ts, 36, 9)) native; ->native : Symbol(native, Decl(propertyNamesOfReservedWords.ts, 37, 14)) +>native : Symbol(C.native, Decl(propertyNamesOfReservedWords.ts, 37, 14)) new; ->new : Symbol(new, Decl(propertyNamesOfReservedWords.ts, 38, 11)) +>new : Symbol(C.new, Decl(propertyNamesOfReservedWords.ts, 38, 11)) null; ->null : Symbol(null, Decl(propertyNamesOfReservedWords.ts, 39, 8)) +>null : Symbol(C.null, Decl(propertyNamesOfReservedWords.ts, 39, 8)) package; ->package : Symbol(package, Decl(propertyNamesOfReservedWords.ts, 40, 9)) +>package : Symbol(C.package, Decl(propertyNamesOfReservedWords.ts, 40, 9)) private; ->private : Symbol(private, Decl(propertyNamesOfReservedWords.ts, 41, 12)) +>private : Symbol(C.private, Decl(propertyNamesOfReservedWords.ts, 41, 12)) protected; ->protected : Symbol(protected, Decl(propertyNamesOfReservedWords.ts, 42, 12)) +>protected : Symbol(C.protected, Decl(propertyNamesOfReservedWords.ts, 42, 12)) public; ->public : Symbol(public, Decl(propertyNamesOfReservedWords.ts, 43, 14)) +>public : Symbol(C.public, Decl(propertyNamesOfReservedWords.ts, 43, 14)) return; ->return : Symbol(return, Decl(propertyNamesOfReservedWords.ts, 44, 11)) +>return : Symbol(C.return, Decl(propertyNamesOfReservedWords.ts, 44, 11)) short; ->short : Symbol(short, Decl(propertyNamesOfReservedWords.ts, 45, 11)) +>short : Symbol(C.short, Decl(propertyNamesOfReservedWords.ts, 45, 11)) static; ->static : Symbol(static, Decl(propertyNamesOfReservedWords.ts, 46, 10)) +>static : Symbol(C.static, Decl(propertyNamesOfReservedWords.ts, 46, 10)) super; ->super : Symbol(super, Decl(propertyNamesOfReservedWords.ts, 47, 11)) +>super : Symbol(C.super, Decl(propertyNamesOfReservedWords.ts, 47, 11)) switch; ->switch : Symbol(switch, Decl(propertyNamesOfReservedWords.ts, 48, 10)) +>switch : Symbol(C.switch, Decl(propertyNamesOfReservedWords.ts, 48, 10)) synchronized; ->synchronized : Symbol(synchronized, Decl(propertyNamesOfReservedWords.ts, 49, 11)) +>synchronized : Symbol(C.synchronized, Decl(propertyNamesOfReservedWords.ts, 49, 11)) this; ->this : Symbol(this, Decl(propertyNamesOfReservedWords.ts, 50, 17)) +>this : Symbol(C.this, Decl(propertyNamesOfReservedWords.ts, 50, 17)) throw; ->throw : Symbol(throw, Decl(propertyNamesOfReservedWords.ts, 51, 9)) +>throw : Symbol(C.throw, Decl(propertyNamesOfReservedWords.ts, 51, 9)) throws; ->throws : Symbol(throws, Decl(propertyNamesOfReservedWords.ts, 52, 10)) +>throws : Symbol(C.throws, Decl(propertyNamesOfReservedWords.ts, 52, 10)) transient; ->transient : Symbol(transient, Decl(propertyNamesOfReservedWords.ts, 53, 11)) +>transient : Symbol(C.transient, Decl(propertyNamesOfReservedWords.ts, 53, 11)) true; ->true : Symbol(true, Decl(propertyNamesOfReservedWords.ts, 54, 14)) +>true : Symbol(C.true, Decl(propertyNamesOfReservedWords.ts, 54, 14)) try; ->try : Symbol(try, Decl(propertyNamesOfReservedWords.ts, 55, 9)) +>try : Symbol(C.try, Decl(propertyNamesOfReservedWords.ts, 55, 9)) typeof; ->typeof : Symbol(typeof, Decl(propertyNamesOfReservedWords.ts, 56, 8)) +>typeof : Symbol(C.typeof, Decl(propertyNamesOfReservedWords.ts, 56, 8)) use; ->use : Symbol(use, Decl(propertyNamesOfReservedWords.ts, 57, 11)) +>use : Symbol(C.use, Decl(propertyNamesOfReservedWords.ts, 57, 11)) var; ->var : Symbol(var, Decl(propertyNamesOfReservedWords.ts, 58, 8)) +>var : Symbol(C.var, Decl(propertyNamesOfReservedWords.ts, 58, 8)) void; ->void : Symbol(void, Decl(propertyNamesOfReservedWords.ts, 59, 8)) +>void : Symbol(C.void, Decl(propertyNamesOfReservedWords.ts, 59, 8)) volatile; ->volatile : Symbol(volatile, Decl(propertyNamesOfReservedWords.ts, 60, 9)) +>volatile : Symbol(C.volatile, Decl(propertyNamesOfReservedWords.ts, 60, 9)) while; ->while : Symbol(while, Decl(propertyNamesOfReservedWords.ts, 61, 13)) +>while : Symbol(C.while, Decl(propertyNamesOfReservedWords.ts, 61, 13)) with; ->with : Symbol(with, Decl(propertyNamesOfReservedWords.ts, 62, 10)) +>with : Symbol(C.with, Decl(propertyNamesOfReservedWords.ts, 62, 10)) } var c: C; >c : Symbol(c, Decl(propertyNamesOfReservedWords.ts, 65, 3)) @@ -211,193 +211,193 @@ interface I { >I : Symbol(I, Decl(propertyNamesOfReservedWords.ts, 67, 14)) abstract; ->abstract : Symbol(abstract, Decl(propertyNamesOfReservedWords.ts, 69, 13)) +>abstract : Symbol(I.abstract, Decl(propertyNamesOfReservedWords.ts, 69, 13)) as; ->as : Symbol(as, Decl(propertyNamesOfReservedWords.ts, 70, 13)) +>as : Symbol(I.as, Decl(propertyNamesOfReservedWords.ts, 70, 13)) boolean; ->boolean : Symbol(boolean, Decl(propertyNamesOfReservedWords.ts, 71, 7)) +>boolean : Symbol(I.boolean, Decl(propertyNamesOfReservedWords.ts, 71, 7)) break; ->break : Symbol(break, Decl(propertyNamesOfReservedWords.ts, 72, 12)) +>break : Symbol(I.break, Decl(propertyNamesOfReservedWords.ts, 72, 12)) byte; ->byte : Symbol(byte, Decl(propertyNamesOfReservedWords.ts, 73, 10)) +>byte : Symbol(I.byte, Decl(propertyNamesOfReservedWords.ts, 73, 10)) case; ->case : Symbol(case, Decl(propertyNamesOfReservedWords.ts, 74, 9)) +>case : Symbol(I.case, Decl(propertyNamesOfReservedWords.ts, 74, 9)) catch; ->catch : Symbol(catch, Decl(propertyNamesOfReservedWords.ts, 75, 9)) +>catch : Symbol(I.catch, Decl(propertyNamesOfReservedWords.ts, 75, 9)) char; ->char : Symbol(char, Decl(propertyNamesOfReservedWords.ts, 76, 10)) +>char : Symbol(I.char, Decl(propertyNamesOfReservedWords.ts, 76, 10)) class; ->class : Symbol(class, Decl(propertyNamesOfReservedWords.ts, 77, 9)) +>class : Symbol(I.class, Decl(propertyNamesOfReservedWords.ts, 77, 9)) continue; ->continue : Symbol(continue, Decl(propertyNamesOfReservedWords.ts, 78, 10)) +>continue : Symbol(I.continue, Decl(propertyNamesOfReservedWords.ts, 78, 10)) const; ->const : Symbol(const, Decl(propertyNamesOfReservedWords.ts, 79, 13)) +>const : Symbol(I.const, Decl(propertyNamesOfReservedWords.ts, 79, 13)) debugger; ->debugger : Symbol(debugger, Decl(propertyNamesOfReservedWords.ts, 80, 10)) +>debugger : Symbol(I.debugger, Decl(propertyNamesOfReservedWords.ts, 80, 10)) default; ->default : Symbol(default, Decl(propertyNamesOfReservedWords.ts, 81, 13)) +>default : Symbol(I.default, Decl(propertyNamesOfReservedWords.ts, 81, 13)) delete; ->delete : Symbol(delete, Decl(propertyNamesOfReservedWords.ts, 82, 12)) +>delete : Symbol(I.delete, Decl(propertyNamesOfReservedWords.ts, 82, 12)) do; ->do : Symbol(do, Decl(propertyNamesOfReservedWords.ts, 83, 11)) +>do : Symbol(I.do, Decl(propertyNamesOfReservedWords.ts, 83, 11)) double; ->double : Symbol(double, Decl(propertyNamesOfReservedWords.ts, 84, 7)) +>double : Symbol(I.double, Decl(propertyNamesOfReservedWords.ts, 84, 7)) else; ->else : Symbol(else, Decl(propertyNamesOfReservedWords.ts, 85, 11)) +>else : Symbol(I.else, Decl(propertyNamesOfReservedWords.ts, 85, 11)) enum; ->enum : Symbol(enum, Decl(propertyNamesOfReservedWords.ts, 86, 9)) +>enum : Symbol(I.enum, Decl(propertyNamesOfReservedWords.ts, 86, 9)) export; ->export : Symbol(export, Decl(propertyNamesOfReservedWords.ts, 87, 9)) +>export : Symbol(I.export, Decl(propertyNamesOfReservedWords.ts, 87, 9)) extends; ->extends : Symbol(extends, Decl(propertyNamesOfReservedWords.ts, 88, 11)) +>extends : Symbol(I.extends, Decl(propertyNamesOfReservedWords.ts, 88, 11)) false; ->false : Symbol(false, Decl(propertyNamesOfReservedWords.ts, 89, 12)) +>false : Symbol(I.false, Decl(propertyNamesOfReservedWords.ts, 89, 12)) final; ->final : Symbol(final, Decl(propertyNamesOfReservedWords.ts, 90, 10)) +>final : Symbol(I.final, Decl(propertyNamesOfReservedWords.ts, 90, 10)) finally; ->finally : Symbol(finally, Decl(propertyNamesOfReservedWords.ts, 91, 10)) +>finally : Symbol(I.finally, Decl(propertyNamesOfReservedWords.ts, 91, 10)) float; ->float : Symbol(float, Decl(propertyNamesOfReservedWords.ts, 92, 12)) +>float : Symbol(I.float, Decl(propertyNamesOfReservedWords.ts, 92, 12)) for; ->for : Symbol(for, Decl(propertyNamesOfReservedWords.ts, 93, 10)) +>for : Symbol(I.for, Decl(propertyNamesOfReservedWords.ts, 93, 10)) function; ->function : Symbol(function, Decl(propertyNamesOfReservedWords.ts, 94, 8)) +>function : Symbol(I.function, Decl(propertyNamesOfReservedWords.ts, 94, 8)) goto; ->goto : Symbol(goto, Decl(propertyNamesOfReservedWords.ts, 95, 13)) +>goto : Symbol(I.goto, Decl(propertyNamesOfReservedWords.ts, 95, 13)) if; ->if : Symbol(if, Decl(propertyNamesOfReservedWords.ts, 96, 9)) +>if : Symbol(I.if, Decl(propertyNamesOfReservedWords.ts, 96, 9)) implements; ->implements : Symbol(implements, Decl(propertyNamesOfReservedWords.ts, 97, 7)) +>implements : Symbol(I.implements, Decl(propertyNamesOfReservedWords.ts, 97, 7)) import; ->import : Symbol(import, Decl(propertyNamesOfReservedWords.ts, 98, 15)) +>import : Symbol(I.import, Decl(propertyNamesOfReservedWords.ts, 98, 15)) in; ->in : Symbol(in, Decl(propertyNamesOfReservedWords.ts, 99, 11)) +>in : Symbol(I.in, Decl(propertyNamesOfReservedWords.ts, 99, 11)) instanceof; ->instanceof : Symbol(instanceof, Decl(propertyNamesOfReservedWords.ts, 100, 7)) +>instanceof : Symbol(I.instanceof, Decl(propertyNamesOfReservedWords.ts, 100, 7)) int; ->int : Symbol(int, Decl(propertyNamesOfReservedWords.ts, 101, 15)) +>int : Symbol(I.int, Decl(propertyNamesOfReservedWords.ts, 101, 15)) interface; ->interface : Symbol(interface, Decl(propertyNamesOfReservedWords.ts, 102, 8)) +>interface : Symbol(I.interface, Decl(propertyNamesOfReservedWords.ts, 102, 8)) is; ->is : Symbol(is, Decl(propertyNamesOfReservedWords.ts, 103, 14)) +>is : Symbol(I.is, Decl(propertyNamesOfReservedWords.ts, 103, 14)) long; ->long : Symbol(long, Decl(propertyNamesOfReservedWords.ts, 104, 7)) +>long : Symbol(I.long, Decl(propertyNamesOfReservedWords.ts, 104, 7)) namespace; ->namespace : Symbol(namespace, Decl(propertyNamesOfReservedWords.ts, 105, 9)) +>namespace : Symbol(I.namespace, Decl(propertyNamesOfReservedWords.ts, 105, 9)) native; ->native : Symbol(native, Decl(propertyNamesOfReservedWords.ts, 106, 14)) +>native : Symbol(I.native, Decl(propertyNamesOfReservedWords.ts, 106, 14)) new; ->new : Symbol(new, Decl(propertyNamesOfReservedWords.ts, 107, 11)) +>new : Symbol(I.new, Decl(propertyNamesOfReservedWords.ts, 107, 11)) null; ->null : Symbol(null, Decl(propertyNamesOfReservedWords.ts, 108, 8)) +>null : Symbol(I.null, Decl(propertyNamesOfReservedWords.ts, 108, 8)) package; ->package : Symbol(package, Decl(propertyNamesOfReservedWords.ts, 109, 9)) +>package : Symbol(I.package, Decl(propertyNamesOfReservedWords.ts, 109, 9)) private; ->private : Symbol(private, Decl(propertyNamesOfReservedWords.ts, 110, 12)) +>private : Symbol(I.private, Decl(propertyNamesOfReservedWords.ts, 110, 12)) protected; ->protected : Symbol(protected, Decl(propertyNamesOfReservedWords.ts, 111, 12)) +>protected : Symbol(I.protected, Decl(propertyNamesOfReservedWords.ts, 111, 12)) public; ->public : Symbol(public, Decl(propertyNamesOfReservedWords.ts, 112, 14)) +>public : Symbol(I.public, Decl(propertyNamesOfReservedWords.ts, 112, 14)) return; ->return : Symbol(return, Decl(propertyNamesOfReservedWords.ts, 113, 11)) +>return : Symbol(I.return, Decl(propertyNamesOfReservedWords.ts, 113, 11)) short; ->short : Symbol(short, Decl(propertyNamesOfReservedWords.ts, 114, 11)) +>short : Symbol(I.short, Decl(propertyNamesOfReservedWords.ts, 114, 11)) static; ->static : Symbol(static, Decl(propertyNamesOfReservedWords.ts, 115, 10)) +>static : Symbol(I.static, Decl(propertyNamesOfReservedWords.ts, 115, 10)) super; ->super : Symbol(super, Decl(propertyNamesOfReservedWords.ts, 116, 11)) +>super : Symbol(I.super, Decl(propertyNamesOfReservedWords.ts, 116, 11)) switch; ->switch : Symbol(switch, Decl(propertyNamesOfReservedWords.ts, 117, 10)) +>switch : Symbol(I.switch, Decl(propertyNamesOfReservedWords.ts, 117, 10)) synchronized; ->synchronized : Symbol(synchronized, Decl(propertyNamesOfReservedWords.ts, 118, 11)) +>synchronized : Symbol(I.synchronized, Decl(propertyNamesOfReservedWords.ts, 118, 11)) this; ->this : Symbol(this, Decl(propertyNamesOfReservedWords.ts, 119, 17)) +>this : Symbol(I.this, Decl(propertyNamesOfReservedWords.ts, 119, 17)) throw; ->throw : Symbol(throw, Decl(propertyNamesOfReservedWords.ts, 120, 9)) +>throw : Symbol(I.throw, Decl(propertyNamesOfReservedWords.ts, 120, 9)) throws; ->throws : Symbol(throws, Decl(propertyNamesOfReservedWords.ts, 121, 10)) +>throws : Symbol(I.throws, Decl(propertyNamesOfReservedWords.ts, 121, 10)) transient; ->transient : Symbol(transient, Decl(propertyNamesOfReservedWords.ts, 122, 11)) +>transient : Symbol(I.transient, Decl(propertyNamesOfReservedWords.ts, 122, 11)) true; ->true : Symbol(true, Decl(propertyNamesOfReservedWords.ts, 123, 14)) +>true : Symbol(I.true, Decl(propertyNamesOfReservedWords.ts, 123, 14)) try; ->try : Symbol(try, Decl(propertyNamesOfReservedWords.ts, 124, 9)) +>try : Symbol(I.try, Decl(propertyNamesOfReservedWords.ts, 124, 9)) typeof; ->typeof : Symbol(typeof, Decl(propertyNamesOfReservedWords.ts, 125, 8)) +>typeof : Symbol(I.typeof, Decl(propertyNamesOfReservedWords.ts, 125, 8)) use; ->use : Symbol(use, Decl(propertyNamesOfReservedWords.ts, 126, 11)) +>use : Symbol(I.use, Decl(propertyNamesOfReservedWords.ts, 126, 11)) var; ->var : Symbol(var, Decl(propertyNamesOfReservedWords.ts, 127, 8)) +>var : Symbol(I.var, Decl(propertyNamesOfReservedWords.ts, 127, 8)) void; ->void : Symbol(void, Decl(propertyNamesOfReservedWords.ts, 128, 8)) +>void : Symbol(I.void, Decl(propertyNamesOfReservedWords.ts, 128, 8)) volatile; ->volatile : Symbol(volatile, Decl(propertyNamesOfReservedWords.ts, 129, 9)) +>volatile : Symbol(I.volatile, Decl(propertyNamesOfReservedWords.ts, 129, 9)) while; ->while : Symbol(while, Decl(propertyNamesOfReservedWords.ts, 130, 13)) +>while : Symbol(I.while, Decl(propertyNamesOfReservedWords.ts, 130, 13)) with; ->with : Symbol(with, Decl(propertyNamesOfReservedWords.ts, 131, 10)) +>with : Symbol(I.with, Decl(propertyNamesOfReservedWords.ts, 131, 10)) } var i: I; diff --git a/tests/baselines/reference/propertyNamesWithStringLiteral.symbols b/tests/baselines/reference/propertyNamesWithStringLiteral.symbols index d81f39b5325..1851629c134 100644 --- a/tests/baselines/reference/propertyNamesWithStringLiteral.symbols +++ b/tests/baselines/reference/propertyNamesWithStringLiteral.symbols @@ -3,17 +3,17 @@ class _Color { >_Color : Symbol(_Color, Decl(propertyNamesWithStringLiteral.ts, 0, 0)) a: number; r: number; g: number; b: number; ->a : Symbol(a, Decl(propertyNamesWithStringLiteral.ts, 0, 14)) ->r : Symbol(r, Decl(propertyNamesWithStringLiteral.ts, 1, 14)) ->g : Symbol(g, Decl(propertyNamesWithStringLiteral.ts, 1, 25)) ->b : Symbol(b, Decl(propertyNamesWithStringLiteral.ts, 1, 36)) +>a : Symbol(_Color.a, Decl(propertyNamesWithStringLiteral.ts, 0, 14)) +>r : Symbol(_Color.r, Decl(propertyNamesWithStringLiteral.ts, 1, 14)) +>g : Symbol(_Color.g, Decl(propertyNamesWithStringLiteral.ts, 1, 25)) +>b : Symbol(_Color.b, Decl(propertyNamesWithStringLiteral.ts, 1, 36)) } interface NamedColors { >NamedColors : Symbol(NamedColors, Decl(propertyNamesWithStringLiteral.ts, 2, 1)) azure: _Color; ->azure : Symbol(azure, Decl(propertyNamesWithStringLiteral.ts, 4, 23)) +>azure : Symbol(NamedColors.azure, Decl(propertyNamesWithStringLiteral.ts, 4, 23)) >_Color : Symbol(_Color, Decl(propertyNamesWithStringLiteral.ts, 0, 0)) "blue": _Color; @@ -38,16 +38,16 @@ var a = Color.namedColors["azure"]; var a = Color.namedColors.blue; // Should not error >a : Symbol(a, Decl(propertyNamesWithStringLiteral.ts, 12, 3), Decl(propertyNamesWithStringLiteral.ts, 13, 3), Decl(propertyNamesWithStringLiteral.ts, 14, 3)) ->Color.namedColors.blue : Symbol(NamedColors."blue", Decl(propertyNamesWithStringLiteral.ts, 5, 18)) +>Color.namedColors.blue : Symbol(NamedColors["blue"], Decl(propertyNamesWithStringLiteral.ts, 5, 18)) >Color.namedColors : Symbol(Color.namedColors, Decl(propertyNamesWithStringLiteral.ts, 10, 14)) >Color : Symbol(Color, Decl(propertyNamesWithStringLiteral.ts, 8, 1)) >namedColors : Symbol(Color.namedColors, Decl(propertyNamesWithStringLiteral.ts, 10, 14)) ->blue : Symbol(NamedColors."blue", Decl(propertyNamesWithStringLiteral.ts, 5, 18)) +>blue : Symbol(NamedColors["blue"], Decl(propertyNamesWithStringLiteral.ts, 5, 18)) var a = Color.namedColors["pale blue"]; // should not error >a : Symbol(a, Decl(propertyNamesWithStringLiteral.ts, 12, 3), Decl(propertyNamesWithStringLiteral.ts, 13, 3), Decl(propertyNamesWithStringLiteral.ts, 14, 3)) >Color.namedColors : Symbol(Color.namedColors, Decl(propertyNamesWithStringLiteral.ts, 10, 14)) >Color : Symbol(Color, Decl(propertyNamesWithStringLiteral.ts, 8, 1)) >namedColors : Symbol(Color.namedColors, Decl(propertyNamesWithStringLiteral.ts, 10, 14)) ->"pale blue" : Symbol(NamedColors."pale blue", Decl(propertyNamesWithStringLiteral.ts, 6, 19)) +>"pale blue" : Symbol(NamedColors["pale blue"], Decl(propertyNamesWithStringLiteral.ts, 6, 19)) diff --git a/tests/baselines/reference/protectedClassPropertyAccessibleWithinClass.symbols b/tests/baselines/reference/protectedClassPropertyAccessibleWithinClass.symbols index ccca7ab7501..ec9464ef1ee 100644 --- a/tests/baselines/reference/protectedClassPropertyAccessibleWithinClass.symbols +++ b/tests/baselines/reference/protectedClassPropertyAccessibleWithinClass.symbols @@ -5,29 +5,29 @@ class C { >C : Symbol(C, Decl(protectedClassPropertyAccessibleWithinClass.ts, 0, 0)) protected x: string; ->x : Symbol(x, Decl(protectedClassPropertyAccessibleWithinClass.ts, 2, 9)) +>x : Symbol(C.x, Decl(protectedClassPropertyAccessibleWithinClass.ts, 2, 9)) protected get y() { return this.x; } ->y : Symbol(y, Decl(protectedClassPropertyAccessibleWithinClass.ts, 3, 24), Decl(protectedClassPropertyAccessibleWithinClass.ts, 4, 40)) ->this.x : Symbol(x, Decl(protectedClassPropertyAccessibleWithinClass.ts, 2, 9)) +>y : Symbol(C.y, Decl(protectedClassPropertyAccessibleWithinClass.ts, 3, 24), Decl(protectedClassPropertyAccessibleWithinClass.ts, 4, 40)) +>this.x : Symbol(C.x, Decl(protectedClassPropertyAccessibleWithinClass.ts, 2, 9)) >this : Symbol(C, Decl(protectedClassPropertyAccessibleWithinClass.ts, 0, 0)) ->x : Symbol(x, Decl(protectedClassPropertyAccessibleWithinClass.ts, 2, 9)) +>x : Symbol(C.x, Decl(protectedClassPropertyAccessibleWithinClass.ts, 2, 9)) protected set y(x) { this.y = this.x; } ->y : Symbol(y, Decl(protectedClassPropertyAccessibleWithinClass.ts, 3, 24), Decl(protectedClassPropertyAccessibleWithinClass.ts, 4, 40)) +>y : Symbol(C.y, Decl(protectedClassPropertyAccessibleWithinClass.ts, 3, 24), Decl(protectedClassPropertyAccessibleWithinClass.ts, 4, 40)) >x : Symbol(x, Decl(protectedClassPropertyAccessibleWithinClass.ts, 5, 20)) ->this.y : Symbol(y, Decl(protectedClassPropertyAccessibleWithinClass.ts, 3, 24), Decl(protectedClassPropertyAccessibleWithinClass.ts, 4, 40)) +>this.y : Symbol(C.y, Decl(protectedClassPropertyAccessibleWithinClass.ts, 3, 24), Decl(protectedClassPropertyAccessibleWithinClass.ts, 4, 40)) >this : Symbol(C, Decl(protectedClassPropertyAccessibleWithinClass.ts, 0, 0)) ->y : Symbol(y, Decl(protectedClassPropertyAccessibleWithinClass.ts, 3, 24), Decl(protectedClassPropertyAccessibleWithinClass.ts, 4, 40)) ->this.x : Symbol(x, Decl(protectedClassPropertyAccessibleWithinClass.ts, 2, 9)) +>y : Symbol(C.y, Decl(protectedClassPropertyAccessibleWithinClass.ts, 3, 24), Decl(protectedClassPropertyAccessibleWithinClass.ts, 4, 40)) +>this.x : Symbol(C.x, Decl(protectedClassPropertyAccessibleWithinClass.ts, 2, 9)) >this : Symbol(C, Decl(protectedClassPropertyAccessibleWithinClass.ts, 0, 0)) ->x : Symbol(x, Decl(protectedClassPropertyAccessibleWithinClass.ts, 2, 9)) +>x : Symbol(C.x, Decl(protectedClassPropertyAccessibleWithinClass.ts, 2, 9)) protected foo() { return this.foo; } ->foo : Symbol(foo, Decl(protectedClassPropertyAccessibleWithinClass.ts, 5, 43)) ->this.foo : Symbol(foo, Decl(protectedClassPropertyAccessibleWithinClass.ts, 5, 43)) +>foo : Symbol(C.foo, Decl(protectedClassPropertyAccessibleWithinClass.ts, 5, 43)) +>this.foo : Symbol(C.foo, Decl(protectedClassPropertyAccessibleWithinClass.ts, 5, 43)) >this : Symbol(C, Decl(protectedClassPropertyAccessibleWithinClass.ts, 0, 0)) ->foo : Symbol(foo, Decl(protectedClassPropertyAccessibleWithinClass.ts, 5, 43)) +>foo : Symbol(C.foo, Decl(protectedClassPropertyAccessibleWithinClass.ts, 5, 43)) protected static x: string; >x : Symbol(C.x, Decl(protectedClassPropertyAccessibleWithinClass.ts, 6, 40)) @@ -66,29 +66,29 @@ class C2 { >C2 : Symbol(C2, Decl(protectedClassPropertyAccessibleWithinClass.ts, 13, 1)) protected x: string; ->x : Symbol(x, Decl(protectedClassPropertyAccessibleWithinClass.ts, 16, 10)) +>x : Symbol(C2.x, Decl(protectedClassPropertyAccessibleWithinClass.ts, 16, 10)) protected get y() { () => this.x; return null; } ->y : Symbol(y, Decl(protectedClassPropertyAccessibleWithinClass.ts, 17, 24), Decl(protectedClassPropertyAccessibleWithinClass.ts, 18, 52)) ->this.x : Symbol(x, Decl(protectedClassPropertyAccessibleWithinClass.ts, 16, 10)) +>y : Symbol(C2.y, Decl(protectedClassPropertyAccessibleWithinClass.ts, 17, 24), Decl(protectedClassPropertyAccessibleWithinClass.ts, 18, 52)) +>this.x : Symbol(C2.x, Decl(protectedClassPropertyAccessibleWithinClass.ts, 16, 10)) >this : Symbol(C2, Decl(protectedClassPropertyAccessibleWithinClass.ts, 13, 1)) ->x : Symbol(x, Decl(protectedClassPropertyAccessibleWithinClass.ts, 16, 10)) +>x : Symbol(C2.x, Decl(protectedClassPropertyAccessibleWithinClass.ts, 16, 10)) protected set y(x) { () => { this.y = this.x; } } ->y : Symbol(y, Decl(protectedClassPropertyAccessibleWithinClass.ts, 17, 24), Decl(protectedClassPropertyAccessibleWithinClass.ts, 18, 52)) +>y : Symbol(C2.y, Decl(protectedClassPropertyAccessibleWithinClass.ts, 17, 24), Decl(protectedClassPropertyAccessibleWithinClass.ts, 18, 52)) >x : Symbol(x, Decl(protectedClassPropertyAccessibleWithinClass.ts, 19, 20)) ->this.y : Symbol(y, Decl(protectedClassPropertyAccessibleWithinClass.ts, 17, 24), Decl(protectedClassPropertyAccessibleWithinClass.ts, 18, 52)) +>this.y : Symbol(C2.y, Decl(protectedClassPropertyAccessibleWithinClass.ts, 17, 24), Decl(protectedClassPropertyAccessibleWithinClass.ts, 18, 52)) >this : Symbol(C2, Decl(protectedClassPropertyAccessibleWithinClass.ts, 13, 1)) ->y : Symbol(y, Decl(protectedClassPropertyAccessibleWithinClass.ts, 17, 24), Decl(protectedClassPropertyAccessibleWithinClass.ts, 18, 52)) ->this.x : Symbol(x, Decl(protectedClassPropertyAccessibleWithinClass.ts, 16, 10)) +>y : Symbol(C2.y, Decl(protectedClassPropertyAccessibleWithinClass.ts, 17, 24), Decl(protectedClassPropertyAccessibleWithinClass.ts, 18, 52)) +>this.x : Symbol(C2.x, Decl(protectedClassPropertyAccessibleWithinClass.ts, 16, 10)) >this : Symbol(C2, Decl(protectedClassPropertyAccessibleWithinClass.ts, 13, 1)) ->x : Symbol(x, Decl(protectedClassPropertyAccessibleWithinClass.ts, 16, 10)) +>x : Symbol(C2.x, Decl(protectedClassPropertyAccessibleWithinClass.ts, 16, 10)) protected foo() { () => this.foo; } ->foo : Symbol(foo, Decl(protectedClassPropertyAccessibleWithinClass.ts, 19, 53)) ->this.foo : Symbol(foo, Decl(protectedClassPropertyAccessibleWithinClass.ts, 19, 53)) +>foo : Symbol(C2.foo, Decl(protectedClassPropertyAccessibleWithinClass.ts, 19, 53)) +>this.foo : Symbol(C2.foo, Decl(protectedClassPropertyAccessibleWithinClass.ts, 19, 53)) >this : Symbol(C2, Decl(protectedClassPropertyAccessibleWithinClass.ts, 13, 1)) ->foo : Symbol(foo, Decl(protectedClassPropertyAccessibleWithinClass.ts, 19, 53)) +>foo : Symbol(C2.foo, Decl(protectedClassPropertyAccessibleWithinClass.ts, 19, 53)) protected static x: string; >x : Symbol(C2.x, Decl(protectedClassPropertyAccessibleWithinClass.ts, 20, 39)) diff --git a/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedClass.js b/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedClass.js new file mode 100644 index 00000000000..2bc544e046e --- /dev/null +++ b/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedClass.js @@ -0,0 +1,84 @@ +//// [protectedClassPropertyAccessibleWithinNestedClass.ts] +// no errors + +class C { + protected x: string; + protected get y() { return this.x; } + protected set y(x) { this.y = this.x; } + protected foo() { return this.foo; } + + protected static x: string; + protected static get y() { return this.x; } + protected static set y(x) { this.y = this.x; } + protected static foo() { return this.foo; } + protected static bar() { this.foo(); } + + protected bar() { + class C2 { + protected foo() { + let x: C; + var x1 = x.foo; + var x2 = x.bar; + var x3 = x.x; + var x4 = x.y; + + var sx1 = C.x; + var sx2 = C.y; + var sx3 = C.bar; + var sx4 = C.foo; + + let y = new C(); + var y1 = y.foo; + var y2 = y.bar; + var y3 = y.x; + var y4 = y.y; + } + } + } +} + +//// [protectedClassPropertyAccessibleWithinNestedClass.js] +// no errors +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, "y", { + get: function () { return this.x; }, + set: function (x) { this.y = this.x; }, + enumerable: true, + configurable: true + }); + C.prototype.foo = function () { return this.foo; }; + Object.defineProperty(C, "y", { + get: function () { return this.x; }, + set: function (x) { this.y = this.x; }, + enumerable: true, + configurable: true + }); + C.foo = function () { return this.foo; }; + C.bar = function () { this.foo(); }; + C.prototype.bar = function () { + var C2 = (function () { + function C2() { + } + C2.prototype.foo = function () { + var x; + var x1 = x.foo; + var x2 = x.bar; + var x3 = x.x; + var x4 = x.y; + var sx1 = C.x; + var sx2 = C.y; + var sx3 = C.bar; + var sx4 = C.foo; + var y = new C(); + var y1 = y.foo; + var y2 = y.bar; + var y3 = y.x; + var y4 = y.y; + }; + return C2; + }()); + }; + return C; +}()); diff --git a/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedClass.symbols b/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedClass.symbols new file mode 100644 index 00000000000..8b05cc017c8 --- /dev/null +++ b/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedClass.symbols @@ -0,0 +1,154 @@ +=== tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinNestedClass.ts === +// no errors + +class C { +>C : Symbol(C, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 0, 0)) + + protected x: string; +>x : Symbol(C.x, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 2, 9)) + + protected get y() { return this.x; } +>y : Symbol(C.y, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 3, 24), Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 4, 40)) +>this.x : Symbol(C.x, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 2, 9)) +>this : Symbol(C, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 0, 0)) +>x : Symbol(C.x, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 2, 9)) + + protected set y(x) { this.y = this.x; } +>y : Symbol(C.y, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 3, 24), Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 4, 40)) +>x : Symbol(x, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 5, 20)) +>this.y : Symbol(C.y, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 3, 24), Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 4, 40)) +>this : Symbol(C, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 0, 0)) +>y : Symbol(C.y, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 3, 24), Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 4, 40)) +>this.x : Symbol(C.x, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 2, 9)) +>this : Symbol(C, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 0, 0)) +>x : Symbol(C.x, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 2, 9)) + + protected foo() { return this.foo; } +>foo : Symbol(C.foo, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 5, 43)) +>this.foo : Symbol(C.foo, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 5, 43)) +>this : Symbol(C, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 0, 0)) +>foo : Symbol(C.foo, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 5, 43)) + + protected static x: string; +>x : Symbol(C.x, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 6, 40)) + + protected static get y() { return this.x; } +>y : Symbol(C.y, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 8, 31), Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 9, 47)) +>this.x : Symbol(C.x, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 6, 40)) +>this : Symbol(C, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 0, 0)) +>x : Symbol(C.x, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 6, 40)) + + protected static set y(x) { this.y = this.x; } +>y : Symbol(C.y, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 8, 31), Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 9, 47)) +>x : Symbol(x, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 10, 27)) +>this.y : Symbol(C.y, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 8, 31), Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 9, 47)) +>this : Symbol(C, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 0, 0)) +>y : Symbol(C.y, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 8, 31), Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 9, 47)) +>this.x : Symbol(C.x, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 6, 40)) +>this : Symbol(C, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 0, 0)) +>x : Symbol(C.x, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 6, 40)) + + protected static foo() { return this.foo; } +>foo : Symbol(C.foo, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 10, 50)) +>this.foo : Symbol(C.foo, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 10, 50)) +>this : Symbol(C, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 0, 0)) +>foo : Symbol(C.foo, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 10, 50)) + + protected static bar() { this.foo(); } +>bar : Symbol(C.bar, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 11, 47)) +>this.foo : Symbol(C.foo, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 10, 50)) +>this : Symbol(C, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 0, 0)) +>foo : Symbol(C.foo, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 10, 50)) + + protected bar() { +>bar : Symbol(C.bar, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 12, 42)) + + class C2 { +>C2 : Symbol(C2, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 14, 21)) + + protected foo() { +>foo : Symbol(C2.foo, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 15, 18)) + + let x: C; +>x : Symbol(x, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 17, 19)) +>C : Symbol(C, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 0, 0)) + + var x1 = x.foo; +>x1 : Symbol(x1, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 18, 19)) +>x.foo : Symbol(C.foo, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 5, 43)) +>x : Symbol(x, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 17, 19)) +>foo : Symbol(C.foo, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 5, 43)) + + var x2 = x.bar; +>x2 : Symbol(x2, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 19, 19)) +>x.bar : Symbol(C.bar, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 12, 42)) +>x : Symbol(x, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 17, 19)) +>bar : Symbol(C.bar, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 12, 42)) + + var x3 = x.x; +>x3 : Symbol(x3, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 20, 19)) +>x.x : Symbol(C.x, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 2, 9)) +>x : Symbol(x, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 17, 19)) +>x : Symbol(C.x, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 2, 9)) + + var x4 = x.y; +>x4 : Symbol(x4, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 21, 19)) +>x.y : Symbol(C.y, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 3, 24), Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 4, 40)) +>x : Symbol(x, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 17, 19)) +>y : Symbol(C.y, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 3, 24), Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 4, 40)) + + var sx1 = C.x; +>sx1 : Symbol(sx1, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 23, 19)) +>C.x : Symbol(C.x, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 6, 40)) +>C : Symbol(C, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 0, 0)) +>x : Symbol(C.x, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 6, 40)) + + var sx2 = C.y; +>sx2 : Symbol(sx2, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 24, 19)) +>C.y : Symbol(C.y, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 8, 31), Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 9, 47)) +>C : Symbol(C, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 0, 0)) +>y : Symbol(C.y, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 8, 31), Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 9, 47)) + + var sx3 = C.bar; +>sx3 : Symbol(sx3, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 25, 19)) +>C.bar : Symbol(C.bar, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 11, 47)) +>C : Symbol(C, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 0, 0)) +>bar : Symbol(C.bar, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 11, 47)) + + var sx4 = C.foo; +>sx4 : Symbol(sx4, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 26, 19)) +>C.foo : Symbol(C.foo, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 10, 50)) +>C : Symbol(C, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 0, 0)) +>foo : Symbol(C.foo, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 10, 50)) + + let y = new C(); +>y : Symbol(y, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 28, 19)) +>C : Symbol(C, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 0, 0)) + + var y1 = y.foo; +>y1 : Symbol(y1, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 29, 19)) +>y.foo : Symbol(C.foo, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 5, 43)) +>y : Symbol(y, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 28, 19)) +>foo : Symbol(C.foo, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 5, 43)) + + var y2 = y.bar; +>y2 : Symbol(y2, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 30, 19)) +>y.bar : Symbol(C.bar, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 12, 42)) +>y : Symbol(y, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 28, 19)) +>bar : Symbol(C.bar, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 12, 42)) + + var y3 = y.x; +>y3 : Symbol(y3, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 31, 19)) +>y.x : Symbol(C.x, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 2, 9)) +>y : Symbol(y, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 28, 19)) +>x : Symbol(C.x, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 2, 9)) + + var y4 = y.y; +>y4 : Symbol(y4, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 32, 19)) +>y.y : Symbol(C.y, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 3, 24), Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 4, 40)) +>y : Symbol(y, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 28, 19)) +>y : Symbol(C.y, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 3, 24), Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 4, 40)) + } + } + } +} diff --git a/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedClass.types b/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedClass.types new file mode 100644 index 00000000000..f7cff2e6719 --- /dev/null +++ b/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedClass.types @@ -0,0 +1,158 @@ +=== tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinNestedClass.ts === +// no errors + +class C { +>C : C + + protected x: string; +>x : string + + protected get y() { return this.x; } +>y : string +>this.x : string +>this : this +>x : string + + protected set y(x) { this.y = this.x; } +>y : string +>x : string +>this.y = this.x : string +>this.y : string +>this : this +>y : string +>this.x : string +>this : this +>x : string + + protected foo() { return this.foo; } +>foo : () => any +>this.foo : () => any +>this : this +>foo : () => any + + protected static x: string; +>x : string + + protected static get y() { return this.x; } +>y : string +>this.x : string +>this : typeof C +>x : string + + protected static set y(x) { this.y = this.x; } +>y : string +>x : string +>this.y = this.x : string +>this.y : string +>this : typeof C +>y : string +>this.x : string +>this : typeof C +>x : string + + protected static foo() { return this.foo; } +>foo : () => typeof C.foo +>this.foo : () => typeof C.foo +>this : typeof C +>foo : () => typeof C.foo + + protected static bar() { this.foo(); } +>bar : () => void +>this.foo() : () => typeof C.foo +>this.foo : () => typeof C.foo +>this : typeof C +>foo : () => typeof C.foo + + protected bar() { +>bar : () => void + + class C2 { +>C2 : C2 + + protected foo() { +>foo : () => void + + let x: C; +>x : C +>C : C + + var x1 = x.foo; +>x1 : () => any +>x.foo : () => any +>x : C +>foo : () => any + + var x2 = x.bar; +>x2 : () => void +>x.bar : () => void +>x : C +>bar : () => void + + var x3 = x.x; +>x3 : string +>x.x : string +>x : C +>x : string + + var x4 = x.y; +>x4 : string +>x.y : string +>x : C +>y : string + + var sx1 = C.x; +>sx1 : string +>C.x : string +>C : typeof C +>x : string + + var sx2 = C.y; +>sx2 : string +>C.y : string +>C : typeof C +>y : string + + var sx3 = C.bar; +>sx3 : () => void +>C.bar : () => void +>C : typeof C +>bar : () => void + + var sx4 = C.foo; +>sx4 : () => typeof C.foo +>C.foo : () => typeof C.foo +>C : typeof C +>foo : () => typeof C.foo + + let y = new C(); +>y : C +>new C() : C +>C : typeof C + + var y1 = y.foo; +>y1 : () => any +>y.foo : () => any +>y : C +>foo : () => any + + var y2 = y.bar; +>y2 : () => void +>y.bar : () => void +>y : C +>bar : () => void + + var y3 = y.x; +>y3 : string +>y.x : string +>y : C +>x : string + + var y4 = y.y; +>y4 : string +>y.y : string +>y : C +>y : string + } + } + } +} diff --git a/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedSubclass.errors.txt b/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedSubclass.errors.txt new file mode 100644 index 00000000000..0bf38477f70 --- /dev/null +++ b/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedSubclass.errors.txt @@ -0,0 +1,44 @@ +tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinNestedSubclass.ts(25,28): error TS2339: Property 'z' does not exist on type 'C'. + + +==== tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinNestedSubclass.ts (1 errors) ==== + + class B { + protected x: string; + protected static x: string; + } + + class C extends B { + protected get y() { return this.x; } + protected set y(x) { this.y = this.x; } + protected foo() { return this.x; } + + protected static get y() { return this.x; } + protected static set y(x) { this.y = this.x; } + protected static foo() { return this.x; } + protected static bar() { this.foo(); } + + protected bar() { + class D { + protected foo() { + var c = new C(); + var c1 = c.y; + var c2 = c.x; + var c3 = c.foo; + var c4 = c.bar; + var c5 = c.z; // error + ~ +!!! error TS2339: Property 'z' does not exist on type 'C'. + + var sc1 = C.x; + var sc2 = C.y; + var sc3 = C.foo; + var sc4 = C.bar; + } + } + } + } + + class E extends C { + protected z: string; + } \ No newline at end of file diff --git a/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedSubclass.js b/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedSubclass.js new file mode 100644 index 00000000000..255c05ac3ac --- /dev/null +++ b/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedSubclass.js @@ -0,0 +1,99 @@ +//// [protectedClassPropertyAccessibleWithinNestedSubclass.ts] + +class B { + protected x: string; + protected static x: string; +} + +class C extends B { + protected get y() { return this.x; } + protected set y(x) { this.y = this.x; } + protected foo() { return this.x; } + + protected static get y() { return this.x; } + protected static set y(x) { this.y = this.x; } + protected static foo() { return this.x; } + protected static bar() { this.foo(); } + + protected bar() { + class D { + protected foo() { + var c = new C(); + var c1 = c.y; + var c2 = c.x; + var c3 = c.foo; + var c4 = c.bar; + var c5 = c.z; // error + + var sc1 = C.x; + var sc2 = C.y; + var sc3 = C.foo; + var sc4 = C.bar; + } + } + } +} + +class E extends C { + protected z: string; +} + +//// [protectedClassPropertyAccessibleWithinNestedSubclass.js] +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var B = (function () { + function B() { + } + return B; +}()); +var C = (function (_super) { + __extends(C, _super); + function C() { + _super.apply(this, arguments); + } + Object.defineProperty(C.prototype, "y", { + get: function () { return this.x; }, + set: function (x) { this.y = this.x; }, + enumerable: true, + configurable: true + }); + C.prototype.foo = function () { return this.x; }; + Object.defineProperty(C, "y", { + get: function () { return this.x; }, + set: function (x) { this.y = this.x; }, + enumerable: true, + configurable: true + }); + C.foo = function () { return this.x; }; + C.bar = function () { this.foo(); }; + C.prototype.bar = function () { + var D = (function () { + function D() { + } + D.prototype.foo = function () { + var c = new C(); + var c1 = c.y; + var c2 = c.x; + var c3 = c.foo; + var c4 = c.bar; + var c5 = c.z; // error + var sc1 = C.x; + var sc2 = C.y; + var sc3 = C.foo; + var sc4 = C.bar; + }; + return D; + }()); + }; + return C; +}(B)); +var E = (function (_super) { + __extends(E, _super); + function E() { + _super.apply(this, arguments); + } + return E; +}(C)); diff --git a/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedSubclass1.errors.txt b/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedSubclass1.errors.txt new file mode 100644 index 00000000000..2d882681d72 --- /dev/null +++ b/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedSubclass1.errors.txt @@ -0,0 +1,180 @@ +tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinNestedSubclass1.ts(15,20): error TS2445: Property 'x' is protected and only accessible within class 'Derived3' and its subclasses. +tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinNestedSubclass1.ts(32,19): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived1'. +tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinNestedSubclass1.ts(34,20): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived1'. +tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinNestedSubclass1.ts(35,20): error TS2445: Property 'x' is protected and only accessible within class 'Derived3' and its subclasses. +tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinNestedSubclass1.ts(36,20): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived1'. +tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinNestedSubclass1.ts(52,19): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived2'. +tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinNestedSubclass1.ts(53,20): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived2'. +tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinNestedSubclass1.ts(55,20): error TS2445: Property 'x' is protected and only accessible within class 'Derived3' and its subclasses. +tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinNestedSubclass1.ts(73,19): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived3'. +tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinNestedSubclass1.ts(74,20): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived3'. +tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinNestedSubclass1.ts(75,20): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived3'. +tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinNestedSubclass1.ts(77,20): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived3'. +tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinNestedSubclass1.ts(93,19): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived4'. +tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinNestedSubclass1.ts(94,20): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived4'. +tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinNestedSubclass1.ts(95,20): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived4'. +tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinNestedSubclass1.ts(96,20): error TS2445: Property 'x' is protected and only accessible within class 'Derived3' and its subclasses. +tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinNestedSubclass1.ts(110,3): error TS2445: Property 'x' is protected and only accessible within class 'Base' and its subclasses. +tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinNestedSubclass1.ts(111,4): error TS2445: Property 'x' is protected and only accessible within class 'Base' and its subclasses. +tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinNestedSubclass1.ts(112,4): error TS2445: Property 'x' is protected and only accessible within class 'Base' and its subclasses. +tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinNestedSubclass1.ts(113,4): error TS2445: Property 'x' is protected and only accessible within class 'Derived3' and its subclasses. +tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinNestedSubclass1.ts(114,4): error TS2445: Property 'x' is protected and only accessible within class 'Base' and its subclasses. + + +==== tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinNestedSubclass1.ts (21 errors) ==== + class Base { + protected x: string; + method() { + class A { + methoda() { + var b: Base; + var d1: Derived1; + var d2: Derived2; + var d3: Derived3; + var d4: Derived4; + + b.x; // OK, accessed within their declaring class + d1.x; // OK, accessed within their declaring class + d2.x; // OK, accessed within their declaring class + d3.x; // Error, redefined in a subclass, can only be accessed in the declaring class or one of its subclasses + ~ +!!! error TS2445: Property 'x' is protected and only accessible within class 'Derived3' and its subclasses. + d4.x; // OK, accessed within their declaring class + } + } + } + } + + class Derived1 extends Base { + method1() { + class B { + method1b() { + var b: Base; + var d1: Derived1; + var d2: Derived2; + var d3: Derived3; + var d4: Derived4; + + b.x; // Error, isn't accessed through an instance of the enclosing class + ~ +!!! error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived1'. + d1.x; // OK, accessed within a class derived from their declaring class, and through an instance of the enclosing class + d2.x; // Error, isn't accessed through an instance of the enclosing class + ~ +!!! error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived1'. + d3.x; // Error, redefined in a subclass, can only be accessed in the declaring class or one of its subclasses + ~ +!!! error TS2445: Property 'x' is protected and only accessible within class 'Derived3' and its subclasses. + d4.x; // Error, isn't accessed through an instance of the enclosing class + ~ +!!! error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived1'. + } + } + } + } + + class Derived2 extends Base { + method2() { + class C { + method2c() { + var b: Base; + var d1: Derived1; + var d2: Derived2; + var d3: Derived3; + var d4: Derived4; + + b.x; // Error, isn't accessed through an instance of the enclosing class + ~ +!!! error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived2'. + d1.x; // Error, isn't accessed through an instance of the enclosing class + ~ +!!! error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived2'. + d2.x; // OK, accessed within a class derived from their declaring class, and through an instance of the enclosing class + d3.x; // Error, redefined in a subclass, can only be accessed in the declaring class or one of its subclasses + ~ +!!! error TS2445: Property 'x' is protected and only accessible within class 'Derived3' and its subclasses. + d4.x; // OK, accessed within a class derived from their declaring class, and through an instance of the enclosing class or one of its subclasses + } + } + } + } + + class Derived3 extends Derived1 { + protected x: string; + method3() { + class D { + method3d() { + var b: Base; + var d1: Derived1; + var d2: Derived2; + var d3: Derived3; + var d4: Derived4; + + b.x; // Error, isn't accessed through an instance of the enclosing class + ~ +!!! error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived3'. + d1.x; // Error, isn't accessed through an instance of the enclosing class + ~ +!!! error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived3'. + d2.x; // Error, isn't accessed through an instance of the enclosing class + ~ +!!! error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived3'. + d3.x; // OK, accessed within their declaring class + d4.x; // Error, isn't accessed through an instance of the enclosing class + ~ +!!! error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived3'. + } + } + } + } + + class Derived4 extends Derived2 { + method4() { + class E { + method4e() { + var b: Base; + var d1: Derived1; + var d2: Derived2; + var d3: Derived3; + var d4: Derived4; + + b.x; // Error, isn't accessed through an instance of the enclosing class + ~ +!!! error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived4'. + d1.x; // Error, isn't accessed through an instance of the enclosing class + ~ +!!! error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived4'. + d2.x; // Error, isn't accessed through an instance of the enclosing class + ~ +!!! error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived4'. + d3.x; // Error, redefined in a subclass, can only be accessed in the declaring class or one of its subclasses + ~ +!!! error TS2445: Property 'x' is protected and only accessible within class 'Derived3' and its subclasses. + d4.x; // OK, accessed within a class derived from their declaring class, and through an instance of the enclosing class + } + } + } + } + + + var b: Base; + var d1: Derived1; + var d2: Derived2; + var d3: Derived3; + var d4: Derived4; + + b.x; // Error, neither within their declaring class nor classes derived from their declaring class + ~ +!!! error TS2445: Property 'x' is protected and only accessible within class 'Base' and its subclasses. + d1.x; // Error, neither within their declaring class nor classes derived from their declaring class + ~ +!!! error TS2445: Property 'x' is protected and only accessible within class 'Base' and its subclasses. + d2.x; // Error, neither within their declaring class nor classes derived from their declaring class + ~ +!!! error TS2445: Property 'x' is protected and only accessible within class 'Base' and its subclasses. + d3.x; // Error, neither within their declaring class nor classes derived from their declaring class + ~ +!!! error TS2445: Property 'x' is protected and only accessible within class 'Derived3' and its subclasses. + d4.x; // Error, neither within their declaring class nor classes derived from their declaring class + ~ +!!! error TS2445: Property 'x' is protected and only accessible within class 'Base' and its subclasses. \ No newline at end of file diff --git a/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedSubclass1.js b/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedSubclass1.js new file mode 100644 index 00000000000..02ad29bd312 --- /dev/null +++ b/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedSubclass1.js @@ -0,0 +1,260 @@ +//// [protectedClassPropertyAccessibleWithinNestedSubclass1.ts] +class Base { + protected x: string; + method() { + class A { + methoda() { + var b: Base; + var d1: Derived1; + var d2: Derived2; + var d3: Derived3; + var d4: Derived4; + + b.x; // OK, accessed within their declaring class + d1.x; // OK, accessed within their declaring class + d2.x; // OK, accessed within their declaring class + d3.x; // Error, redefined in a subclass, can only be accessed in the declaring class or one of its subclasses + d4.x; // OK, accessed within their declaring class + } + } + } +} + +class Derived1 extends Base { + method1() { + class B { + method1b() { + var b: Base; + var d1: Derived1; + var d2: Derived2; + var d3: Derived3; + var d4: Derived4; + + b.x; // Error, isn't accessed through an instance of the enclosing class + d1.x; // OK, accessed within a class derived from their declaring class, and through an instance of the enclosing class + d2.x; // Error, isn't accessed through an instance of the enclosing class + d3.x; // Error, redefined in a subclass, can only be accessed in the declaring class or one of its subclasses + d4.x; // Error, isn't accessed through an instance of the enclosing class + } + } + } +} + +class Derived2 extends Base { + method2() { + class C { + method2c() { + var b: Base; + var d1: Derived1; + var d2: Derived2; + var d3: Derived3; + var d4: Derived4; + + b.x; // Error, isn't accessed through an instance of the enclosing class + d1.x; // Error, isn't accessed through an instance of the enclosing class + d2.x; // OK, accessed within a class derived from their declaring class, and through an instance of the enclosing class + d3.x; // Error, redefined in a subclass, can only be accessed in the declaring class or one of its subclasses + d4.x; // OK, accessed within a class derived from their declaring class, and through an instance of the enclosing class or one of its subclasses + } + } + } +} + +class Derived3 extends Derived1 { + protected x: string; + method3() { + class D { + method3d() { + var b: Base; + var d1: Derived1; + var d2: Derived2; + var d3: Derived3; + var d4: Derived4; + + b.x; // Error, isn't accessed through an instance of the enclosing class + d1.x; // Error, isn't accessed through an instance of the enclosing class + d2.x; // Error, isn't accessed through an instance of the enclosing class + d3.x; // OK, accessed within their declaring class + d4.x; // Error, isn't accessed through an instance of the enclosing class + } + } + } +} + +class Derived4 extends Derived2 { + method4() { + class E { + method4e() { + var b: Base; + var d1: Derived1; + var d2: Derived2; + var d3: Derived3; + var d4: Derived4; + + b.x; // Error, isn't accessed through an instance of the enclosing class + d1.x; // Error, isn't accessed through an instance of the enclosing class + d2.x; // Error, isn't accessed through an instance of the enclosing class + d3.x; // Error, redefined in a subclass, can only be accessed in the declaring class or one of its subclasses + d4.x; // OK, accessed within a class derived from their declaring class, and through an instance of the enclosing class + } + } + } +} + + +var b: Base; +var d1: Derived1; +var d2: Derived2; +var d3: Derived3; +var d4: Derived4; + +b.x; // Error, neither within their declaring class nor classes derived from their declaring class +d1.x; // Error, neither within their declaring class nor classes derived from their declaring class +d2.x; // Error, neither within their declaring class nor classes derived from their declaring class +d3.x; // Error, neither within their declaring class nor classes derived from their declaring class +d4.x; // Error, neither within their declaring class nor classes derived from their declaring class + +//// [protectedClassPropertyAccessibleWithinNestedSubclass1.js] +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var Base = (function () { + function Base() { + } + Base.prototype.method = function () { + var A = (function () { + function A() { + } + A.prototype.methoda = function () { + var b; + var d1; + var d2; + var d3; + var d4; + b.x; // OK, accessed within their declaring class + d1.x; // OK, accessed within their declaring class + d2.x; // OK, accessed within their declaring class + d3.x; // Error, redefined in a subclass, can only be accessed in the declaring class or one of its subclasses + d4.x; // OK, accessed within their declaring class + }; + return A; + }()); + }; + return Base; +}()); +var Derived1 = (function (_super) { + __extends(Derived1, _super); + function Derived1() { + _super.apply(this, arguments); + } + Derived1.prototype.method1 = function () { + var B = (function () { + function B() { + } + B.prototype.method1b = function () { + var b; + var d1; + var d2; + var d3; + var d4; + b.x; // Error, isn't accessed through an instance of the enclosing class + d1.x; // OK, accessed within a class derived from their declaring class, and through an instance of the enclosing class + d2.x; // Error, isn't accessed through an instance of the enclosing class + d3.x; // Error, redefined in a subclass, can only be accessed in the declaring class or one of its subclasses + d4.x; // Error, isn't accessed through an instance of the enclosing class + }; + return B; + }()); + }; + return Derived1; +}(Base)); +var Derived2 = (function (_super) { + __extends(Derived2, _super); + function Derived2() { + _super.apply(this, arguments); + } + Derived2.prototype.method2 = function () { + var C = (function () { + function C() { + } + C.prototype.method2c = function () { + var b; + var d1; + var d2; + var d3; + var d4; + b.x; // Error, isn't accessed through an instance of the enclosing class + d1.x; // Error, isn't accessed through an instance of the enclosing class + d2.x; // OK, accessed within a class derived from their declaring class, and through an instance of the enclosing class + d3.x; // Error, redefined in a subclass, can only be accessed in the declaring class or one of its subclasses + d4.x; // OK, accessed within a class derived from their declaring class, and through an instance of the enclosing class or one of its subclasses + }; + return C; + }()); + }; + return Derived2; +}(Base)); +var Derived3 = (function (_super) { + __extends(Derived3, _super); + function Derived3() { + _super.apply(this, arguments); + } + Derived3.prototype.method3 = function () { + var D = (function () { + function D() { + } + D.prototype.method3d = function () { + var b; + var d1; + var d2; + var d3; + var d4; + b.x; // Error, isn't accessed through an instance of the enclosing class + d1.x; // Error, isn't accessed through an instance of the enclosing class + d2.x; // Error, isn't accessed through an instance of the enclosing class + d3.x; // OK, accessed within their declaring class + d4.x; // Error, isn't accessed through an instance of the enclosing class + }; + return D; + }()); + }; + return Derived3; +}(Derived1)); +var Derived4 = (function (_super) { + __extends(Derived4, _super); + function Derived4() { + _super.apply(this, arguments); + } + Derived4.prototype.method4 = function () { + var E = (function () { + function E() { + } + E.prototype.method4e = function () { + var b; + var d1; + var d2; + var d3; + var d4; + b.x; // Error, isn't accessed through an instance of the enclosing class + d1.x; // Error, isn't accessed through an instance of the enclosing class + d2.x; // Error, isn't accessed through an instance of the enclosing class + d3.x; // Error, redefined in a subclass, can only be accessed in the declaring class or one of its subclasses + d4.x; // OK, accessed within a class derived from their declaring class, and through an instance of the enclosing class + }; + return E; + }()); + }; + return Derived4; +}(Derived2)); +var b; +var d1; +var d2; +var d3; +var d4; +b.x; // Error, neither within their declaring class nor classes derived from their declaring class +d1.x; // Error, neither within their declaring class nor classes derived from their declaring class +d2.x; // Error, neither within their declaring class nor classes derived from their declaring class +d3.x; // Error, neither within their declaring class nor classes derived from their declaring class +d4.x; // Error, neither within their declaring class nor classes derived from their declaring class diff --git a/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass.symbols b/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass.symbols index 5bd7dfad392..17a91458085 100644 --- a/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass.symbols +++ b/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass.symbols @@ -5,7 +5,7 @@ class B { >B : Symbol(B, Decl(protectedClassPropertyAccessibleWithinSubclass.ts, 0, 0)) protected x: string; ->x : Symbol(x, Decl(protectedClassPropertyAccessibleWithinSubclass.ts, 2, 9)) +>x : Symbol(B.x, Decl(protectedClassPropertyAccessibleWithinSubclass.ts, 2, 9)) protected static x: string; >x : Symbol(B.x, Decl(protectedClassPropertyAccessibleWithinSubclass.ts, 3, 24)) @@ -16,32 +16,32 @@ class C extends B { >B : Symbol(B, Decl(protectedClassPropertyAccessibleWithinSubclass.ts, 0, 0)) protected get y() { return this.x; } ->y : Symbol(y, Decl(protectedClassPropertyAccessibleWithinSubclass.ts, 7, 19), Decl(protectedClassPropertyAccessibleWithinSubclass.ts, 8, 40)) +>y : Symbol(C.y, Decl(protectedClassPropertyAccessibleWithinSubclass.ts, 7, 19), Decl(protectedClassPropertyAccessibleWithinSubclass.ts, 8, 40)) >this.x : Symbol(B.x, Decl(protectedClassPropertyAccessibleWithinSubclass.ts, 2, 9)) >this : Symbol(C, Decl(protectedClassPropertyAccessibleWithinSubclass.ts, 5, 1)) >x : Symbol(B.x, Decl(protectedClassPropertyAccessibleWithinSubclass.ts, 2, 9)) protected set y(x) { this.y = this.x; } ->y : Symbol(y, Decl(protectedClassPropertyAccessibleWithinSubclass.ts, 7, 19), Decl(protectedClassPropertyAccessibleWithinSubclass.ts, 8, 40)) +>y : Symbol(C.y, Decl(protectedClassPropertyAccessibleWithinSubclass.ts, 7, 19), Decl(protectedClassPropertyAccessibleWithinSubclass.ts, 8, 40)) >x : Symbol(x, Decl(protectedClassPropertyAccessibleWithinSubclass.ts, 9, 20)) ->this.y : Symbol(y, Decl(protectedClassPropertyAccessibleWithinSubclass.ts, 7, 19), Decl(protectedClassPropertyAccessibleWithinSubclass.ts, 8, 40)) +>this.y : Symbol(C.y, Decl(protectedClassPropertyAccessibleWithinSubclass.ts, 7, 19), Decl(protectedClassPropertyAccessibleWithinSubclass.ts, 8, 40)) >this : Symbol(C, Decl(protectedClassPropertyAccessibleWithinSubclass.ts, 5, 1)) ->y : Symbol(y, Decl(protectedClassPropertyAccessibleWithinSubclass.ts, 7, 19), Decl(protectedClassPropertyAccessibleWithinSubclass.ts, 8, 40)) +>y : Symbol(C.y, Decl(protectedClassPropertyAccessibleWithinSubclass.ts, 7, 19), Decl(protectedClassPropertyAccessibleWithinSubclass.ts, 8, 40)) >this.x : Symbol(B.x, Decl(protectedClassPropertyAccessibleWithinSubclass.ts, 2, 9)) >this : Symbol(C, Decl(protectedClassPropertyAccessibleWithinSubclass.ts, 5, 1)) >x : Symbol(B.x, Decl(protectedClassPropertyAccessibleWithinSubclass.ts, 2, 9)) protected foo() { return this.x; } ->foo : Symbol(foo, Decl(protectedClassPropertyAccessibleWithinSubclass.ts, 9, 43)) +>foo : Symbol(C.foo, Decl(protectedClassPropertyAccessibleWithinSubclass.ts, 9, 43)) >this.x : Symbol(B.x, Decl(protectedClassPropertyAccessibleWithinSubclass.ts, 2, 9)) >this : Symbol(C, Decl(protectedClassPropertyAccessibleWithinSubclass.ts, 5, 1)) >x : Symbol(B.x, Decl(protectedClassPropertyAccessibleWithinSubclass.ts, 2, 9)) protected bar() { return this.foo(); } ->bar : Symbol(bar, Decl(protectedClassPropertyAccessibleWithinSubclass.ts, 10, 38)) ->this.foo : Symbol(foo, Decl(protectedClassPropertyAccessibleWithinSubclass.ts, 9, 43)) +>bar : Symbol(C.bar, Decl(protectedClassPropertyAccessibleWithinSubclass.ts, 10, 38)) +>this.foo : Symbol(C.foo, Decl(protectedClassPropertyAccessibleWithinSubclass.ts, 9, 43)) >this : Symbol(C, Decl(protectedClassPropertyAccessibleWithinSubclass.ts, 5, 1)) ->foo : Symbol(foo, Decl(protectedClassPropertyAccessibleWithinSubclass.ts, 9, 43)) +>foo : Symbol(C.foo, Decl(protectedClassPropertyAccessibleWithinSubclass.ts, 9, 43)) protected static get y() { return this.x; } >y : Symbol(C.y, Decl(protectedClassPropertyAccessibleWithinSubclass.ts, 11, 42), Decl(protectedClassPropertyAccessibleWithinSubclass.ts, 13, 47)) diff --git a/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass2.errors.txt b/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass2.errors.txt index 289ecdcb9fe..996d62c1652 100644 --- a/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass2.errors.txt +++ b/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass2.errors.txt @@ -1,24 +1,24 @@ -tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(13,9): error TS2445: Property 'x' is protected and only accessible within class 'Derived3' and its subclasses. -tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(26,9): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived1'. -tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(28,9): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived1'. -tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(29,9): error TS2445: Property 'x' is protected and only accessible within class 'Derived3' and its subclasses. -tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(30,9): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived1'. -tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(42,9): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived2'. -tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(43,9): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived2'. -tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(45,9): error TS2445: Property 'x' is protected and only accessible within class 'Derived3' and its subclasses. -tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(59,9): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived3'. -tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(60,9): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived3'. -tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(61,9): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived3'. -tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(63,9): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived3'. -tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(75,9): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived4'. -tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(76,9): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived4'. -tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(77,9): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived4'. -tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(78,9): error TS2445: Property 'x' is protected and only accessible within class 'Derived3' and its subclasses. -tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(90,1): error TS2445: Property 'x' is protected and only accessible within class 'Base' and its subclasses. -tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(91,1): error TS2445: Property 'x' is protected and only accessible within class 'Base' and its subclasses. -tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(92,1): error TS2445: Property 'x' is protected and only accessible within class 'Base' and its subclasses. -tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(93,1): error TS2445: Property 'x' is protected and only accessible within class 'Derived3' and its subclasses. -tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(94,1): error TS2445: Property 'x' is protected and only accessible within class 'Base' and its subclasses. +tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(13,12): error TS2445: Property 'x' is protected and only accessible within class 'Derived3' and its subclasses. +tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(26,11): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived1'. +tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(28,12): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived1'. +tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(29,12): error TS2445: Property 'x' is protected and only accessible within class 'Derived3' and its subclasses. +tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(30,12): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived1'. +tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(42,11): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived2'. +tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(43,12): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived2'. +tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(45,12): error TS2445: Property 'x' is protected and only accessible within class 'Derived3' and its subclasses. +tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(59,11): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived3'. +tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(60,12): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived3'. +tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(61,12): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived3'. +tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(63,12): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived3'. +tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(75,11): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived4'. +tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(76,12): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived4'. +tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(77,12): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived4'. +tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(78,12): error TS2445: Property 'x' is protected and only accessible within class 'Derived3' and its subclasses. +tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(90,3): error TS2445: Property 'x' is protected and only accessible within class 'Base' and its subclasses. +tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(91,4): error TS2445: Property 'x' is protected and only accessible within class 'Base' and its subclasses. +tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(92,4): error TS2445: Property 'x' is protected and only accessible within class 'Base' and its subclasses. +tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(93,4): error TS2445: Property 'x' is protected and only accessible within class 'Derived3' and its subclasses. +tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(94,4): error TS2445: Property 'x' is protected and only accessible within class 'Base' and its subclasses. ==== tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts (21 errors) ==== @@ -35,7 +35,7 @@ tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAcce d1.x; // OK, accessed within their declaring class d2.x; // OK, accessed within their declaring class d3.x; // Error, redefined in a subclass, can only be accessed in the declaring class or one of its subclasses - ~~~~ + ~ !!! error TS2445: Property 'x' is protected and only accessible within class 'Derived3' and its subclasses. d4.x; // OK, accessed within their declaring class } @@ -50,17 +50,17 @@ tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAcce var d4: Derived4; b.x; // Error, isn't accessed through an instance of the enclosing class - ~~~ + ~ !!! error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived1'. d1.x; // OK, accessed within a class derived from their declaring class, and through an instance of the enclosing class d2.x; // Error, isn't accessed through an instance of the enclosing class - ~~~~ + ~ !!! error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived1'. d3.x; // Error, redefined in a subclass, can only be accessed in the declaring class or one of its subclasses - ~~~~ + ~ !!! error TS2445: Property 'x' is protected and only accessible within class 'Derived3' and its subclasses. d4.x; // Error, isn't accessed through an instance of the enclosing class - ~~~~ + ~ !!! error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived1'. } } @@ -74,14 +74,14 @@ tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAcce var d4: Derived4; b.x; // Error, isn't accessed through an instance of the enclosing class - ~~~ + ~ !!! error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived2'. d1.x; // Error, isn't accessed through an instance of the enclosing class - ~~~~ + ~ !!! error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived2'. d2.x; // OK, accessed within a class derived from their declaring class, and through an instance of the enclosing class d3.x; // Error, redefined in a subclass, can only be accessed in the declaring class or one of its subclasses - ~~~~ + ~ !!! error TS2445: Property 'x' is protected and only accessible within class 'Derived3' and its subclasses. d4.x; // OK, accessed within a class derived from their declaring class, and through an instance of the enclosing class or one of its subclasses } @@ -97,17 +97,17 @@ tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAcce var d4: Derived4; b.x; // Error, isn't accessed through an instance of the enclosing class - ~~~ + ~ !!! error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived3'. d1.x; // Error, isn't accessed through an instance of the enclosing class - ~~~~ + ~ !!! error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived3'. d2.x; // Error, isn't accessed through an instance of the enclosing class - ~~~~ + ~ !!! error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived3'. d3.x; // OK, accessed within their declaring class d4.x; // Error, isn't accessed through an instance of the enclosing class - ~~~~ + ~ !!! error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived3'. } } @@ -121,16 +121,16 @@ tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAcce var d4: Derived4; b.x; // Error, isn't accessed through an instance of the enclosing class - ~~~ + ~ !!! error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived4'. d1.x; // Error, isn't accessed through an instance of the enclosing class - ~~~~ + ~ !!! error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived4'. d2.x; // Error, isn't accessed through an instance of the enclosing class - ~~~~ + ~ !!! error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived4'. d3.x; // Error, redefined in a subclass, can only be accessed in the declaring class or one of its subclasses - ~~~~ + ~ !!! error TS2445: Property 'x' is protected and only accessible within class 'Derived3' and its subclasses. d4.x; // OK, accessed within a class derived from their declaring class, and through an instance of the enclosing class } @@ -144,17 +144,17 @@ tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAcce var d4: Derived4; b.x; // Error, neither within their declaring class nor classes derived from their declaring class - ~~~ + ~ !!! error TS2445: Property 'x' is protected and only accessible within class 'Base' and its subclasses. d1.x; // Error, neither within their declaring class nor classes derived from their declaring class - ~~~~ + ~ !!! error TS2445: Property 'x' is protected and only accessible within class 'Base' and its subclasses. d2.x; // Error, neither within their declaring class nor classes derived from their declaring class - ~~~~ + ~ !!! error TS2445: Property 'x' is protected and only accessible within class 'Base' and its subclasses. d3.x; // Error, neither within their declaring class nor classes derived from their declaring class - ~~~~ + ~ !!! error TS2445: Property 'x' is protected and only accessible within class 'Derived3' and its subclasses. d4.x; // Error, neither within their declaring class nor classes derived from their declaring class - ~~~~ + ~ !!! error TS2445: Property 'x' is protected and only accessible within class 'Base' and its subclasses. \ No newline at end of file diff --git a/tests/baselines/reference/protectedInstanceMemberAccessibility.errors.txt b/tests/baselines/reference/protectedInstanceMemberAccessibility.errors.txt index 4b950c70019..fc2ee300c9a 100644 --- a/tests/baselines/reference/protectedInstanceMemberAccessibility.errors.txt +++ b/tests/baselines/reference/protectedInstanceMemberAccessibility.errors.txt @@ -2,15 +2,15 @@ tests/cases/conformance/classes/members/accessibility/protectedInstanceMemberAcc tests/cases/conformance/classes/members/accessibility/protectedInstanceMemberAccessibility.ts(16,24): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword. tests/cases/conformance/classes/members/accessibility/protectedInstanceMemberAccessibility.ts(18,24): error TS2339: Property 'y' does not exist on type 'A'. tests/cases/conformance/classes/members/accessibility/protectedInstanceMemberAccessibility.ts(19,24): error TS2339: Property 'z' does not exist on type 'A'. -tests/cases/conformance/classes/members/accessibility/protectedInstanceMemberAccessibility.ts(22,18): error TS2446: Property 'x' is protected and only accessible through an instance of class 'B'. -tests/cases/conformance/classes/members/accessibility/protectedInstanceMemberAccessibility.ts(23,18): error TS2446: Property 'f' is protected and only accessible through an instance of class 'B'. +tests/cases/conformance/classes/members/accessibility/protectedInstanceMemberAccessibility.ts(22,20): error TS2446: Property 'x' is protected and only accessible through an instance of class 'B'. +tests/cases/conformance/classes/members/accessibility/protectedInstanceMemberAccessibility.ts(23,20): error TS2446: Property 'f' is protected and only accessible through an instance of class 'B'. tests/cases/conformance/classes/members/accessibility/protectedInstanceMemberAccessibility.ts(24,20): error TS2339: Property 'y' does not exist on type 'A'. tests/cases/conformance/classes/members/accessibility/protectedInstanceMemberAccessibility.ts(25,20): error TS2339: Property 'z' does not exist on type 'A'. tests/cases/conformance/classes/members/accessibility/protectedInstanceMemberAccessibility.ts(31,20): error TS2339: Property 'z' does not exist on type 'B'. -tests/cases/conformance/classes/members/accessibility/protectedInstanceMemberAccessibility.ts(34,18): error TS2446: Property 'x' is protected and only accessible through an instance of class 'B'. -tests/cases/conformance/classes/members/accessibility/protectedInstanceMemberAccessibility.ts(35,18): error TS2446: Property 'f' is protected and only accessible through an instance of class 'B'. +tests/cases/conformance/classes/members/accessibility/protectedInstanceMemberAccessibility.ts(34,20): error TS2446: Property 'x' is protected and only accessible through an instance of class 'B'. +tests/cases/conformance/classes/members/accessibility/protectedInstanceMemberAccessibility.ts(35,20): error TS2446: Property 'f' is protected and only accessible through an instance of class 'B'. tests/cases/conformance/classes/members/accessibility/protectedInstanceMemberAccessibility.ts(36,20): error TS2339: Property 'y' does not exist on type 'C'. -tests/cases/conformance/classes/members/accessibility/protectedInstanceMemberAccessibility.ts(37,18): error TS2445: Property 'z' is protected and only accessible within class 'C' and its subclasses. +tests/cases/conformance/classes/members/accessibility/protectedInstanceMemberAccessibility.ts(37,20): error TS2445: Property 'z' is protected and only accessible within class 'C' and its subclasses. ==== tests/cases/conformance/classes/members/accessibility/protectedInstanceMemberAccessibility.ts (13 errors) ==== @@ -44,10 +44,10 @@ tests/cases/conformance/classes/members/accessibility/protectedInstanceMemberAcc var a: A; var a1 = a.x; // error - ~~~ + ~ !!! error TS2446: Property 'x' is protected and only accessible through an instance of class 'B'. var a2 = a.f(); // error - ~~~ + ~ !!! error TS2446: Property 'f' is protected and only accessible through an instance of class 'B'. var a3 = a.y; // error ~ @@ -66,16 +66,16 @@ tests/cases/conformance/classes/members/accessibility/protectedInstanceMemberAcc var c: C; var c1 = c.x; // error - ~~~ + ~ !!! error TS2446: Property 'x' is protected and only accessible through an instance of class 'B'. var c2 = c.f(); // error - ~~~ + ~ !!! error TS2446: Property 'f' is protected and only accessible through an instance of class 'B'. var c3 = c.y; // error ~ !!! error TS2339: Property 'y' does not exist on type 'C'. var c4 = c.z; // error - ~~~ + ~ !!! error TS2445: Property 'z' is protected and only accessible within class 'C' and its subclasses. } } diff --git a/tests/baselines/reference/protectedMembers.errors.txt b/tests/baselines/reference/protectedMembers.errors.txt index c35bc25fe71..9171df2a485 100644 --- a/tests/baselines/reference/protectedMembers.errors.txt +++ b/tests/baselines/reference/protectedMembers.errors.txt @@ -1,23 +1,22 @@ -tests/cases/compiler/protectedMembers.ts(40,1): error TS2445: Property 'x' is protected and only accessible within class 'C1' and its subclasses. -tests/cases/compiler/protectedMembers.ts(41,1): error TS2445: Property 'f' is protected and only accessible within class 'C1' and its subclasses. -tests/cases/compiler/protectedMembers.ts(42,1): error TS2445: Property 'sx' is protected and only accessible within class 'C1' and its subclasses. -tests/cases/compiler/protectedMembers.ts(43,1): error TS2445: Property 'sf' is protected and only accessible within class 'C1' and its subclasses. -tests/cases/compiler/protectedMembers.ts(46,1): error TS2445: Property 'x' is protected and only accessible within class 'C1' and its subclasses. -tests/cases/compiler/protectedMembers.ts(47,1): error TS2445: Property 'f' is protected and only accessible within class 'C2' and its subclasses. -tests/cases/compiler/protectedMembers.ts(48,1): error TS2445: Property 'sx' is protected and only accessible within class 'C1' and its subclasses. -tests/cases/compiler/protectedMembers.ts(49,1): error TS2445: Property 'sf' is protected and only accessible within class 'C2' and its subclasses. -tests/cases/compiler/protectedMembers.ts(68,9): error TS2446: Property 'x' is protected and only accessible through an instance of class 'C'. -tests/cases/compiler/protectedMembers.ts(69,9): error TS2446: Property 'x' is protected and only accessible through an instance of class 'C'. -tests/cases/compiler/protectedMembers.ts(86,5): error TS1089: 'protected' modifier cannot appear on a constructor declaration. -tests/cases/compiler/protectedMembers.ts(98,1): error TS2322: Type 'B1' is not assignable to type 'A1'. +tests/cases/compiler/protectedMembers.ts(40,4): error TS2445: Property 'x' is protected and only accessible within class 'C1' and its subclasses. +tests/cases/compiler/protectedMembers.ts(41,4): error TS2445: Property 'f' is protected and only accessible within class 'C1' and its subclasses. +tests/cases/compiler/protectedMembers.ts(42,4): error TS2445: Property 'sx' is protected and only accessible within class 'C1' and its subclasses. +tests/cases/compiler/protectedMembers.ts(43,4): error TS2445: Property 'sf' is protected and only accessible within class 'C1' and its subclasses. +tests/cases/compiler/protectedMembers.ts(46,4): error TS2445: Property 'x' is protected and only accessible within class 'C1' and its subclasses. +tests/cases/compiler/protectedMembers.ts(47,4): error TS2445: Property 'f' is protected and only accessible within class 'C2' and its subclasses. +tests/cases/compiler/protectedMembers.ts(48,4): error TS2445: Property 'sx' is protected and only accessible within class 'C1' and its subclasses. +tests/cases/compiler/protectedMembers.ts(49,4): error TS2445: Property 'sf' is protected and only accessible within class 'C2' and its subclasses. +tests/cases/compiler/protectedMembers.ts(68,11): error TS2446: Property 'x' is protected and only accessible through an instance of class 'C'. +tests/cases/compiler/protectedMembers.ts(69,11): error TS2446: Property 'x' is protected and only accessible through an instance of class 'C'. +tests/cases/compiler/protectedMembers.ts(97,1): error TS2322: Type 'B1' is not assignable to type 'A1'. Property 'x' is protected but type 'B1' is not a class derived from 'A1'. -tests/cases/compiler/protectedMembers.ts(99,1): error TS2322: Type 'A1' is not assignable to type 'B1'. +tests/cases/compiler/protectedMembers.ts(98,1): error TS2322: Type 'A1' is not assignable to type 'B1'. Property 'x' is protected in type 'A1' but public in type 'B1'. -tests/cases/compiler/protectedMembers.ts(112,7): error TS2415: Class 'B3' incorrectly extends base class 'A3'. +tests/cases/compiler/protectedMembers.ts(111,7): error TS2415: Class 'B3' incorrectly extends base class 'A3'. Property 'x' is protected in type 'B3' but public in type 'A3'. -==== tests/cases/compiler/protectedMembers.ts (14 errors) ==== +==== tests/cases/compiler/protectedMembers.ts (13 errors) ==== // Class with protected members class C1 { protected x: number; @@ -58,30 +57,30 @@ tests/cases/compiler/protectedMembers.ts(112,7): error TS2415: Class 'B3' incorr // All of these should be errors c1.x; - ~~~~ + ~ !!! error TS2445: Property 'x' is protected and only accessible within class 'C1' and its subclasses. c1.f(); - ~~~~ + ~ !!! error TS2445: Property 'f' is protected and only accessible within class 'C1' and its subclasses. C1.sx; - ~~~~~ + ~~ !!! error TS2445: Property 'sx' is protected and only accessible within class 'C1' and its subclasses. C1.sf(); - ~~~~~ + ~~ !!! error TS2445: Property 'sf' is protected and only accessible within class 'C1' and its subclasses. // All of these should be errors c2.x; - ~~~~ + ~ !!! error TS2445: Property 'x' is protected and only accessible within class 'C1' and its subclasses. c2.f(); - ~~~~ + ~ !!! error TS2445: Property 'f' is protected and only accessible within class 'C2' and its subclasses. C2.sx; - ~~~~~ + ~~ !!! error TS2445: Property 'sx' is protected and only accessible within class 'C1' and its subclasses. C2.sf(); - ~~~~~ + ~~ !!! error TS2445: Property 'sf' is protected and only accessible within class 'C2' and its subclasses. // All of these should be ok @@ -102,10 +101,10 @@ tests/cases/compiler/protectedMembers.ts(112,7): error TS2415: Class 'B3' incorr z; static foo(a: A, b: B, c: C, d: D, e: E) { a.x = 1; // Error, access must be through C or type derived from C - ~~~ + ~ !!! error TS2446: Property 'x' is protected and only accessible through an instance of class 'C'. b.x = 1; // Error, access must be through C or type derived from C - ~~~ + ~ !!! error TS2446: Property 'x' is protected and only accessible through an instance of class 'C'. c.x = 1; d.x = 1; @@ -122,10 +121,7 @@ tests/cases/compiler/protectedMembers.ts(112,7): error TS2415: Class 'B3' incorr } class CC { - // Error, constructor cannot be protected protected constructor() { - ~~~~~~~~~ -!!! error TS1089: 'protected' modifier cannot appear on a constructor declaration. } } diff --git a/tests/baselines/reference/protectedMembers.js b/tests/baselines/reference/protectedMembers.js index e541f697f44..dcc68e0c946 100644 --- a/tests/baselines/reference/protectedMembers.js +++ b/tests/baselines/reference/protectedMembers.js @@ -83,7 +83,6 @@ interface E extends C { } class CC { - // Error, constructor cannot be protected protected constructor() { } } @@ -214,7 +213,6 @@ var D = (function (_super) { return D; }(C)); var CC = (function () { - // Error, constructor cannot be protected function CC() { } return CC; diff --git a/tests/baselines/reference/protectedStaticClassPropertyAccessibleWithinSubclass.errors.txt b/tests/baselines/reference/protectedStaticClassPropertyAccessibleWithinSubclass.errors.txt index 911633cb98f..361cf557ee5 100644 --- a/tests/baselines/reference/protectedStaticClassPropertyAccessibleWithinSubclass.errors.txt +++ b/tests/baselines/reference/protectedStaticClassPropertyAccessibleWithinSubclass.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/classes/members/accessibility/protectedStaticClassPropertyAccessibleWithinSubclass.ts(7,9): error TS2445: Property 'x' is protected and only accessible within class 'Derived3' and its subclasses. -tests/cases/conformance/classes/members/accessibility/protectedStaticClassPropertyAccessibleWithinSubclass.ts(16,9): error TS2445: Property 'x' is protected and only accessible within class 'Derived3' and its subclasses. -tests/cases/conformance/classes/members/accessibility/protectedStaticClassPropertyAccessibleWithinSubclass.ts(25,9): error TS2445: Property 'x' is protected and only accessible within class 'Derived3' and its subclasses. -tests/cases/conformance/classes/members/accessibility/protectedStaticClassPropertyAccessibleWithinSubclass.ts(40,1): error TS2445: Property 'x' is protected and only accessible within class 'Base' and its subclasses. -tests/cases/conformance/classes/members/accessibility/protectedStaticClassPropertyAccessibleWithinSubclass.ts(41,1): error TS2445: Property 'x' is protected and only accessible within class 'Base' and its subclasses. -tests/cases/conformance/classes/members/accessibility/protectedStaticClassPropertyAccessibleWithinSubclass.ts(42,1): error TS2445: Property 'x' is protected and only accessible within class 'Base' and its subclasses. -tests/cases/conformance/classes/members/accessibility/protectedStaticClassPropertyAccessibleWithinSubclass.ts(43,1): error TS2445: Property 'x' is protected and only accessible within class 'Derived3' and its subclasses. +tests/cases/conformance/classes/members/accessibility/protectedStaticClassPropertyAccessibleWithinSubclass.ts(7,18): error TS2445: Property 'x' is protected and only accessible within class 'Derived3' and its subclasses. +tests/cases/conformance/classes/members/accessibility/protectedStaticClassPropertyAccessibleWithinSubclass.ts(16,18): error TS2445: Property 'x' is protected and only accessible within class 'Derived3' and its subclasses. +tests/cases/conformance/classes/members/accessibility/protectedStaticClassPropertyAccessibleWithinSubclass.ts(25,18): error TS2445: Property 'x' is protected and only accessible within class 'Derived3' and its subclasses. +tests/cases/conformance/classes/members/accessibility/protectedStaticClassPropertyAccessibleWithinSubclass.ts(40,6): error TS2445: Property 'x' is protected and only accessible within class 'Base' and its subclasses. +tests/cases/conformance/classes/members/accessibility/protectedStaticClassPropertyAccessibleWithinSubclass.ts(41,10): error TS2445: Property 'x' is protected and only accessible within class 'Base' and its subclasses. +tests/cases/conformance/classes/members/accessibility/protectedStaticClassPropertyAccessibleWithinSubclass.ts(42,10): error TS2445: Property 'x' is protected and only accessible within class 'Base' and its subclasses. +tests/cases/conformance/classes/members/accessibility/protectedStaticClassPropertyAccessibleWithinSubclass.ts(43,10): error TS2445: Property 'x' is protected and only accessible within class 'Derived3' and its subclasses. ==== tests/cases/conformance/classes/members/accessibility/protectedStaticClassPropertyAccessibleWithinSubclass.ts (7 errors) ==== @@ -15,7 +15,7 @@ tests/cases/conformance/classes/members/accessibility/protectedStaticClassProper Derived1.x; // OK, accessed within their declaring class Derived2.x; // OK, accessed within their declaring class Derived3.x; // Error, redefined in a subclass, can only be accessed in the declaring class or one of its subclasses - ~~~~~~~~~~ + ~ !!! error TS2445: Property 'x' is protected and only accessible within class 'Derived3' and its subclasses. } } @@ -26,7 +26,7 @@ tests/cases/conformance/classes/members/accessibility/protectedStaticClassProper Derived1.x; // OK, accessed within a class derived from their declaring class Derived2.x; // OK, accessed within a class derived from their declaring class Derived3.x; // Error, redefined in a subclass, can only be accessed in the declaring class or one of its subclasses - ~~~~~~~~~~ + ~ !!! error TS2445: Property 'x' is protected and only accessible within class 'Derived3' and its subclasses. } } @@ -37,7 +37,7 @@ tests/cases/conformance/classes/members/accessibility/protectedStaticClassProper Derived1.x; // OK, accessed within a class derived from their declaring class Derived2.x; // OK, accessed within a class derived from their declaring class Derived3.x; // Error, redefined in a subclass, can only be accessed in the declaring class or one of its subclasses - ~~~~~~~~~~ + ~ !!! error TS2445: Property 'x' is protected and only accessible within class 'Derived3' and its subclasses. } } @@ -54,14 +54,14 @@ tests/cases/conformance/classes/members/accessibility/protectedStaticClassProper Base.x; // Error, neither within their declaring class nor classes derived from their declaring class - ~~~~~~ + ~ !!! error TS2445: Property 'x' is protected and only accessible within class 'Base' and its subclasses. Derived1.x; // Error, neither within their declaring class nor classes derived from their declaring class - ~~~~~~~~~~ + ~ !!! error TS2445: Property 'x' is protected and only accessible within class 'Base' and its subclasses. Derived2.x; // Error, neither within their declaring class nor classes derived from their declaring class - ~~~~~~~~~~ + ~ !!! error TS2445: Property 'x' is protected and only accessible within class 'Base' and its subclasses. Derived3.x; // Error, neither within their declaring class nor classes derived from their declaring class - ~~~~~~~~~~ + ~ !!! error TS2445: Property 'x' is protected and only accessible within class 'Derived3' and its subclasses. \ No newline at end of file diff --git a/tests/baselines/reference/protectedStaticNotAccessibleInClodule.errors.txt b/tests/baselines/reference/protectedStaticNotAccessibleInClodule.errors.txt index 059e5d6cb12..955884b90d9 100644 --- a/tests/baselines/reference/protectedStaticNotAccessibleInClodule.errors.txt +++ b/tests/baselines/reference/protectedStaticNotAccessibleInClodule.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/classes/members/accessibility/protectedStaticNotAccessibleInClodule.ts(10,20): error TS2445: Property 'bar' is protected and only accessible within class 'C' and its subclasses. +tests/cases/conformance/classes/members/accessibility/protectedStaticNotAccessibleInClodule.ts(10,22): error TS2445: Property 'bar' is protected and only accessible within class 'C' and its subclasses. ==== tests/cases/conformance/classes/members/accessibility/protectedStaticNotAccessibleInClodule.ts (1 errors) ==== @@ -12,6 +12,6 @@ tests/cases/conformance/classes/members/accessibility/protectedStaticNotAccessib module C { export var f = C.foo; // OK export var b = C.bar; // error - ~~~~~ + ~~~ !!! error TS2445: Property 'bar' is protected and only accessible within class 'C' and its subclasses. } \ No newline at end of file diff --git a/tests/baselines/reference/prototypeInstantiatedWithBaseConstraint.symbols b/tests/baselines/reference/prototypeInstantiatedWithBaseConstraint.symbols index bbb95de0910..2dc9a0b6704 100644 --- a/tests/baselines/reference/prototypeInstantiatedWithBaseConstraint.symbols +++ b/tests/baselines/reference/prototypeInstantiatedWithBaseConstraint.symbols @@ -4,7 +4,7 @@ class C { >T : Symbol(T, Decl(prototypeInstantiatedWithBaseConstraint.ts, 0, 8)) x: T; ->x : Symbol(x, Decl(prototypeInstantiatedWithBaseConstraint.ts, 0, 12)) +>x : Symbol(C.x, Decl(prototypeInstantiatedWithBaseConstraint.ts, 0, 12)) >T : Symbol(T, Decl(prototypeInstantiatedWithBaseConstraint.ts, 0, 8)) } diff --git a/tests/baselines/reference/prototypeOnConstructorFunctions.symbols b/tests/baselines/reference/prototypeOnConstructorFunctions.symbols index d3644ad89b2..56764468350 100644 --- a/tests/baselines/reference/prototypeOnConstructorFunctions.symbols +++ b/tests/baselines/reference/prototypeOnConstructorFunctions.symbols @@ -3,7 +3,7 @@ interface I1 { >I1 : Symbol(I1, Decl(prototypeOnConstructorFunctions.ts, 0, 0)) const: new (options?, element?) => any; ->const : Symbol(const, Decl(prototypeOnConstructorFunctions.ts, 0, 14)) +>const : Symbol(I1.const, Decl(prototypeOnConstructorFunctions.ts, 0, 14)) >options : Symbol(options, Decl(prototypeOnConstructorFunctions.ts, 1, 16)) >element : Symbol(element, Decl(prototypeOnConstructorFunctions.ts, 1, 25)) } diff --git a/tests/baselines/reference/publicIndexer.errors.txt b/tests/baselines/reference/publicIndexer.errors.txt index 860290ea25b..29454f2a208 100644 --- a/tests/baselines/reference/publicIndexer.errors.txt +++ b/tests/baselines/reference/publicIndexer.errors.txt @@ -1,6 +1,6 @@ -tests/cases/conformance/classes/indexMemberDeclarations/publicIndexer.ts(4,5): error TS1145: Modifiers not permitted on index signature members. -tests/cases/conformance/classes/indexMemberDeclarations/publicIndexer.ts(8,5): error TS1145: Modifiers not permitted on index signature members. -tests/cases/conformance/classes/indexMemberDeclarations/publicIndexer.ts(12,5): error TS1145: Modifiers not permitted on index signature members. +tests/cases/conformance/classes/indexMemberDeclarations/publicIndexer.ts(4,5): error TS1071: 'public' modifier cannot appear on an index signature. +tests/cases/conformance/classes/indexMemberDeclarations/publicIndexer.ts(8,5): error TS1071: 'public' modifier cannot appear on an index signature. +tests/cases/conformance/classes/indexMemberDeclarations/publicIndexer.ts(12,5): error TS1071: 'public' modifier cannot appear on an index signature. ==== tests/cases/conformance/classes/indexMemberDeclarations/publicIndexer.ts (3 errors) ==== @@ -9,17 +9,17 @@ tests/cases/conformance/classes/indexMemberDeclarations/publicIndexer.ts(12,5): class C { public [x: string]: string; ~~~~~~ -!!! error TS1145: Modifiers not permitted on index signature members. +!!! error TS1071: 'public' modifier cannot appear on an index signature. } class D { public [x: number]: string; ~~~~~~ -!!! error TS1145: Modifiers not permitted on index signature members. +!!! error TS1071: 'public' modifier cannot appear on an index signature. } class E { public [x: string]: T; ~~~~~~ -!!! error TS1145: Modifiers not permitted on index signature members. +!!! error TS1071: 'public' modifier cannot appear on an index signature. } \ No newline at end of file diff --git a/tests/baselines/reference/qualify.errors.txt b/tests/baselines/reference/qualify.errors.txt index f38fc93ccde..c3447664c96 100644 --- a/tests/baselines/reference/qualify.errors.txt +++ b/tests/baselines/reference/qualify.errors.txt @@ -1,7 +1,5 @@ tests/cases/compiler/qualify.ts(21,13): error TS2322: Type 'number' is not assignable to type 'I'. - Property 'p' is missing in type 'Number'. tests/cases/compiler/qualify.ts(30,13): error TS2322: Type 'number' is not assignable to type 'I2'. - Property 'q' is missing in type 'Number'. tests/cases/compiler/qualify.ts(45,13): error TS2322: Type 'I4' is not assignable to type 'I3'. Property 'zeep' is missing in type 'I4'. tests/cases/compiler/qualify.ts(46,13): error TS2322: Type 'I4' is not assignable to type 'I3[]'. @@ -40,7 +38,6 @@ tests/cases/compiler/qualify.ts(58,5): error TS2322: Type 'I' is not assignable var z:I=3; ~ !!! error TS2322: Type 'number' is not assignable to type 'I'. -!!! error TS2322: Property 'p' is missing in type 'Number'. export interface I2 { q; } @@ -52,7 +49,6 @@ tests/cases/compiler/qualify.ts(58,5): error TS2322: Type 'I' is not assignable var z:T.U.I2=3; ~ !!! error TS2322: Type 'number' is not assignable to type 'I2'. -!!! error TS2322: Property 'q' is missing in type 'Number'. } } diff --git a/tests/baselines/reference/quotedPropertyName3.symbols b/tests/baselines/reference/quotedPropertyName3.symbols index 1a843022425..813cf23e336 100644 --- a/tests/baselines/reference/quotedPropertyName3.symbols +++ b/tests/baselines/reference/quotedPropertyName3.symbols @@ -4,12 +4,12 @@ class Test { "prop1": number; foo() { ->foo : Symbol(foo, Decl(quotedPropertyName3.ts, 1, 20)) +>foo : Symbol(Test.foo, Decl(quotedPropertyName3.ts, 1, 20)) var x = () => this["prop1"]; >x : Symbol(x, Decl(quotedPropertyName3.ts, 3, 11)) >this : Symbol(Test, Decl(quotedPropertyName3.ts, 0, 0)) ->"prop1" : Symbol("prop1", Decl(quotedPropertyName3.ts, 0, 12)) +>"prop1" : Symbol(Test["prop1"], Decl(quotedPropertyName3.ts, 0, 12)) var y: number = x(); >y : Symbol(y, Decl(quotedPropertyName3.ts, 4, 11)) diff --git a/tests/baselines/reference/reExportGlobalDeclaration1.errors.txt b/tests/baselines/reference/reExportGlobalDeclaration1.errors.txt new file mode 100644 index 00000000000..0d83d8b94ee --- /dev/null +++ b/tests/baselines/reference/reExportGlobalDeclaration1.errors.txt @@ -0,0 +1,57 @@ +tests/cases/compiler/file2.ts(1,9): error TS2661: Cannot export 'x'. Only local declarations can be exported from a module. +tests/cases/compiler/file2.ts(1,12): error TS2661: Cannot export 'x'. Only local declarations can be exported from a module. +tests/cases/compiler/file2.ts(2,9): error TS2661: Cannot export 'x1'. Only local declarations can be exported from a module. +tests/cases/compiler/file2.ts(2,13): error TS2661: Cannot export 'x1'. Only local declarations can be exported from a module. +tests/cases/compiler/file2.ts(4,9): error TS2661: Cannot export 'a'. Only local declarations can be exported from a module. +tests/cases/compiler/file2.ts(4,12): error TS2661: Cannot export 'a'. Only local declarations can be exported from a module. +tests/cases/compiler/file2.ts(5,9): error TS2661: Cannot export 'b'. Only local declarations can be exported from a module. +tests/cases/compiler/file2.ts(5,12): error TS2661: Cannot export 'b'. Only local declarations can be exported from a module. +tests/cases/compiler/file2.ts(8,9): error TS2661: Cannot export 'x'. Only local declarations can be exported from a module. +tests/cases/compiler/file2.ts(9,9): error TS2661: Cannot export 'x1'. Only local declarations can be exported from a module. +tests/cases/compiler/file2.ts(10,9): error TS2661: Cannot export 'a'. Only local declarations can be exported from a module. +tests/cases/compiler/file2.ts(11,9): error TS2661: Cannot export 'b'. Only local declarations can be exported from a module. + + +==== tests/cases/compiler/file1.d.ts (0 errors) ==== + + declare var x: number; + declare var x1: number; + declare let {a, b}: {a: number, b: number}; + +==== tests/cases/compiler/file2.ts (12 errors) ==== + export {x, x as y}; + ~ +!!! error TS2661: Cannot export 'x'. Only local declarations can be exported from a module. + ~ +!!! error TS2661: Cannot export 'x'. Only local declarations can be exported from a module. + export {x1, x1 as y1}; + ~~ +!!! error TS2661: Cannot export 'x1'. Only local declarations can be exported from a module. + ~~ +!!! error TS2661: Cannot export 'x1'. Only local declarations can be exported from a module. + + export {a, a as a1}; + ~ +!!! error TS2661: Cannot export 'a'. Only local declarations can be exported from a module. + ~ +!!! error TS2661: Cannot export 'a'. Only local declarations can be exported from a module. + export {b, b as b1}; + ~ +!!! error TS2661: Cannot export 'b'. Only local declarations can be exported from a module. + ~ +!!! error TS2661: Cannot export 'b'. Only local declarations can be exported from a module. + + + export {x as z}; + ~ +!!! error TS2661: Cannot export 'x'. Only local declarations can be exported from a module. + export {x1 as z1}; + ~~ +!!! error TS2661: Cannot export 'x1'. Only local declarations can be exported from a module. + export {a as a2}; + ~ +!!! error TS2661: Cannot export 'a'. Only local declarations can be exported from a module. + export {b as b2}; + ~ +!!! error TS2661: Cannot export 'b'. Only local declarations can be exported from a module. + \ No newline at end of file diff --git a/tests/baselines/reference/reExportGlobalDeclaration1.js b/tests/baselines/reference/reExportGlobalDeclaration1.js new file mode 100644 index 00000000000..c0db9a0eaf3 --- /dev/null +++ b/tests/baselines/reference/reExportGlobalDeclaration1.js @@ -0,0 +1,24 @@ +//// [tests/cases/compiler/reExportGlobalDeclaration1.ts] //// + +//// [file1.d.ts] + +declare var x: number; +declare var x1: number; +declare let {a, b}: {a: number, b: number}; + +//// [file2.ts] +export {x, x as y}; +export {x1, x1 as y1}; + +export {a, a as a1}; +export {b, b as b1}; + + +export {x as z}; +export {x1 as z1}; +export {a as a2}; +export {b as b2}; + + +//// [file2.js] +"use strict"; diff --git a/tests/baselines/reference/reExportGlobalDeclaration2.errors.txt b/tests/baselines/reference/reExportGlobalDeclaration2.errors.txt new file mode 100644 index 00000000000..b24a52aff49 --- /dev/null +++ b/tests/baselines/reference/reExportGlobalDeclaration2.errors.txt @@ -0,0 +1,35 @@ +tests/cases/compiler/file2.ts(1,9): error TS2661: Cannot export 'I1'. Only local declarations can be exported from a module. +tests/cases/compiler/file2.ts(1,13): error TS2661: Cannot export 'I1'. Only local declarations can be exported from a module. +tests/cases/compiler/file2.ts(2,9): error TS2661: Cannot export 'I2'. Only local declarations can be exported from a module. +tests/cases/compiler/file2.ts(2,13): error TS2661: Cannot export 'I2'. Only local declarations can be exported from a module. +tests/cases/compiler/file2.ts(3,9): error TS2661: Cannot export 'I1'. Only local declarations can be exported from a module. +tests/cases/compiler/file2.ts(4,9): error TS2661: Cannot export 'I2'. Only local declarations can be exported from a module. + + +==== tests/cases/compiler/file1.d.ts (0 errors) ==== + + declare interface I1 { + x: number + } + + declare interface I2 { + x: number + } + +==== tests/cases/compiler/file2.ts (6 errors) ==== + export {I1, I1 as II1}; + ~~ +!!! error TS2661: Cannot export 'I1'. Only local declarations can be exported from a module. + ~~ +!!! error TS2661: Cannot export 'I1'. Only local declarations can be exported from a module. + export {I2, I2 as II2}; + ~~ +!!! error TS2661: Cannot export 'I2'. Only local declarations can be exported from a module. + ~~ +!!! error TS2661: Cannot export 'I2'. Only local declarations can be exported from a module. + export {I1 as III1}; + ~~ +!!! error TS2661: Cannot export 'I1'. Only local declarations can be exported from a module. + export {I2 as III2}; + ~~ +!!! error TS2661: Cannot export 'I2'. Only local declarations can be exported from a module. \ No newline at end of file diff --git a/tests/baselines/reference/reExportGlobalDeclaration2.js b/tests/baselines/reference/reExportGlobalDeclaration2.js new file mode 100644 index 00000000000..160a9b28f54 --- /dev/null +++ b/tests/baselines/reference/reExportGlobalDeclaration2.js @@ -0,0 +1,20 @@ +//// [tests/cases/compiler/reExportGlobalDeclaration2.ts] //// + +//// [file1.d.ts] + +declare interface I1 { + x: number +} + +declare interface I2 { + x: number +} + +//// [file2.ts] +export {I1, I1 as II1}; +export {I2, I2 as II2}; +export {I1 as III1}; +export {I2 as III2}; + +//// [file2.js] +"use strict"; diff --git a/tests/baselines/reference/reExportGlobalDeclaration3.errors.txt b/tests/baselines/reference/reExportGlobalDeclaration3.errors.txt new file mode 100644 index 00000000000..2f469e80491 --- /dev/null +++ b/tests/baselines/reference/reExportGlobalDeclaration3.errors.txt @@ -0,0 +1,35 @@ +tests/cases/compiler/file2.ts(1,9): error TS2661: Cannot export 'NS1'. Only local declarations can be exported from a module. +tests/cases/compiler/file2.ts(1,14): error TS2661: Cannot export 'NS1'. Only local declarations can be exported from a module. +tests/cases/compiler/file2.ts(2,9): error TS2661: Cannot export 'NS2'. Only local declarations can be exported from a module. +tests/cases/compiler/file2.ts(2,14): error TS2661: Cannot export 'NS2'. Only local declarations can be exported from a module. +tests/cases/compiler/file2.ts(3,9): error TS2661: Cannot export 'NS1'. Only local declarations can be exported from a module. +tests/cases/compiler/file2.ts(4,9): error TS2661: Cannot export 'NS2'. Only local declarations can be exported from a module. + + +==== tests/cases/compiler/file1.d.ts (0 errors) ==== + + declare namespace NS1 { + export var foo: number; + } + + declare namespace NS2 { + export var foo: number; + } + +==== tests/cases/compiler/file2.ts (6 errors) ==== + export {NS1, NS1 as NNS1}; + ~~~ +!!! error TS2661: Cannot export 'NS1'. Only local declarations can be exported from a module. + ~~~ +!!! error TS2661: Cannot export 'NS1'. Only local declarations can be exported from a module. + export {NS2, NS2 as NNS2}; + ~~~ +!!! error TS2661: Cannot export 'NS2'. Only local declarations can be exported from a module. + ~~~ +!!! error TS2661: Cannot export 'NS2'. Only local declarations can be exported from a module. + export {NS1 as NNNS1}; + ~~~ +!!! error TS2661: Cannot export 'NS1'. Only local declarations can be exported from a module. + export {NS2 as NNNS2}; + ~~~ +!!! error TS2661: Cannot export 'NS2'. Only local declarations can be exported from a module. \ No newline at end of file diff --git a/tests/baselines/reference/reExportGlobalDeclaration3.js b/tests/baselines/reference/reExportGlobalDeclaration3.js new file mode 100644 index 00000000000..e1b85b6b8d5 --- /dev/null +++ b/tests/baselines/reference/reExportGlobalDeclaration3.js @@ -0,0 +1,20 @@ +//// [tests/cases/compiler/reExportGlobalDeclaration3.ts] //// + +//// [file1.d.ts] + +declare namespace NS1 { + export var foo: number; +} + +declare namespace NS2 { + export var foo: number; +} + +//// [file2.ts] +export {NS1, NS1 as NNS1}; +export {NS2, NS2 as NNS2}; +export {NS1 as NNNS1}; +export {NS2 as NNNS2}; + +//// [file2.js] +"use strict"; diff --git a/tests/baselines/reference/reExportGlobalDeclaration4.errors.txt b/tests/baselines/reference/reExportGlobalDeclaration4.errors.txt new file mode 100644 index 00000000000..a3b58a276ae --- /dev/null +++ b/tests/baselines/reference/reExportGlobalDeclaration4.errors.txt @@ -0,0 +1,35 @@ +tests/cases/compiler/file2.ts(1,9): error TS2661: Cannot export 'Cls1'. Only local declarations can be exported from a module. +tests/cases/compiler/file2.ts(1,15): error TS2661: Cannot export 'Cls1'. Only local declarations can be exported from a module. +tests/cases/compiler/file2.ts(2,9): error TS2661: Cannot export 'Cls2'. Only local declarations can be exported from a module. +tests/cases/compiler/file2.ts(2,15): error TS2661: Cannot export 'Cls2'. Only local declarations can be exported from a module. +tests/cases/compiler/file2.ts(3,9): error TS2661: Cannot export 'Cls1'. Only local declarations can be exported from a module. +tests/cases/compiler/file2.ts(4,9): error TS2661: Cannot export 'Cls2'. Only local declarations can be exported from a module. + + +==== tests/cases/compiler/file1.d.ts (0 errors) ==== + + declare class Cls1 { + x: number + } + declare class Cls2 { + x: number + } + + +==== tests/cases/compiler/file2.ts (6 errors) ==== + export {Cls1, Cls1 as CCls1}; + ~~~~ +!!! error TS2661: Cannot export 'Cls1'. Only local declarations can be exported from a module. + ~~~~ +!!! error TS2661: Cannot export 'Cls1'. Only local declarations can be exported from a module. + export {Cls2, Cls2 as CCls2}; + ~~~~ +!!! error TS2661: Cannot export 'Cls2'. Only local declarations can be exported from a module. + ~~~~ +!!! error TS2661: Cannot export 'Cls2'. Only local declarations can be exported from a module. + export {Cls1 as CCCls1}; + ~~~~ +!!! error TS2661: Cannot export 'Cls1'. Only local declarations can be exported from a module. + export {Cls2 as CCCls2}; + ~~~~ +!!! error TS2661: Cannot export 'Cls2'. Only local declarations can be exported from a module. \ No newline at end of file diff --git a/tests/baselines/reference/reExportGlobalDeclaration4.js b/tests/baselines/reference/reExportGlobalDeclaration4.js new file mode 100644 index 00000000000..09d6b760790 --- /dev/null +++ b/tests/baselines/reference/reExportGlobalDeclaration4.js @@ -0,0 +1,20 @@ +//// [tests/cases/compiler/reExportGlobalDeclaration4.ts] //// + +//// [file1.d.ts] + +declare class Cls1 { + x: number +} +declare class Cls2 { + x: number +} + + +//// [file2.ts] +export {Cls1, Cls1 as CCls1}; +export {Cls2, Cls2 as CCls2}; +export {Cls1 as CCCls1}; +export {Cls2 as CCCls2}; + +//// [file2.js] +"use strict"; diff --git a/tests/baselines/reference/reExportUndefined1.errors.txt b/tests/baselines/reference/reExportUndefined1.errors.txt new file mode 100644 index 00000000000..5042b4c4c0c --- /dev/null +++ b/tests/baselines/reference/reExportUndefined1.errors.txt @@ -0,0 +1,8 @@ +tests/cases/compiler/a.ts(2,10): error TS2661: Cannot export 'undefined'. Only local declarations can be exported from a module. + + +==== tests/cases/compiler/a.ts (1 errors) ==== + + export { undefined }; + ~~~~~~~~~ +!!! error TS2661: Cannot export 'undefined'. Only local declarations can be exported from a module. \ No newline at end of file diff --git a/tests/baselines/reference/reExportUndefined1.js b/tests/baselines/reference/reExportUndefined1.js new file mode 100644 index 00000000000..94729e4f544 --- /dev/null +++ b/tests/baselines/reference/reExportUndefined1.js @@ -0,0 +1,6 @@ +//// [a.ts] + +export { undefined }; + +//// [a.js] +"use strict"; diff --git a/tests/baselines/reference/reExportUndefined2.js b/tests/baselines/reference/reExportUndefined2.js new file mode 100644 index 00000000000..53b78599cbe --- /dev/null +++ b/tests/baselines/reference/reExportUndefined2.js @@ -0,0 +1,20 @@ +//// [tests/cases/compiler/reExportUndefined2.ts] //// + +//// [a.ts] + +var undefined; +export { undefined }; + +//// [b.ts] +import { undefined } from "./a"; +declare function use(a: number); +use(undefined); + +//// [a.js] +"use strict"; +var undefined; +exports.undefined = undefined; +//// [b.js] +"use strict"; +var a_1 = require("./a"); +use(a_1.undefined); diff --git a/tests/baselines/reference/reExportUndefined2.symbols b/tests/baselines/reference/reExportUndefined2.symbols new file mode 100644 index 00000000000..c4f532ed6dc --- /dev/null +++ b/tests/baselines/reference/reExportUndefined2.symbols @@ -0,0 +1,20 @@ +=== tests/cases/compiler/a.ts === + +var undefined; +>undefined : Symbol(undefined, Decl(a.ts, 1, 3)) + +export { undefined }; +>undefined : Symbol(undefined, Decl(a.ts, 2, 8)) + +=== tests/cases/compiler/b.ts === +import { undefined } from "./a"; +>undefined : Symbol(undefined, Decl(b.ts, 0, 8)) + +declare function use(a: number); +>use : Symbol(use, Decl(b.ts, 0, 32)) +>a : Symbol(a, Decl(b.ts, 1, 21)) + +use(undefined); +>use : Symbol(use, Decl(b.ts, 0, 32)) +>undefined : Symbol(undefined, Decl(b.ts, 0, 8)) + diff --git a/tests/baselines/reference/reExportUndefined2.types b/tests/baselines/reference/reExportUndefined2.types new file mode 100644 index 00000000000..d3f3dc9d726 --- /dev/null +++ b/tests/baselines/reference/reExportUndefined2.types @@ -0,0 +1,21 @@ +=== tests/cases/compiler/a.ts === + +var undefined; +>undefined : any + +export { undefined }; +>undefined : any + +=== tests/cases/compiler/b.ts === +import { undefined } from "./a"; +>undefined : any + +declare function use(a: number); +>use : (a: number) => any +>a : number + +use(undefined); +>use(undefined) : any +>use : (a: number) => any +>undefined : any + diff --git a/tests/baselines/reference/reachabilityChecks5.errors.txt b/tests/baselines/reference/reachabilityChecks5.errors.txt index 147dbe264a3..4a894261a3d 100644 --- a/tests/baselines/reference/reachabilityChecks5.errors.txt +++ b/tests/baselines/reference/reachabilityChecks5.errors.txt @@ -6,11 +6,12 @@ tests/cases/compiler/reachabilityChecks5.ts(52,17): error TS7030: Not all code p tests/cases/compiler/reachabilityChecks5.ts(80,17): error TS7030: Not all code paths return a value. tests/cases/compiler/reachabilityChecks5.ts(86,13): error TS7027: Unreachable code detected. tests/cases/compiler/reachabilityChecks5.ts(94,17): error TS7030: Not all code paths return a value. +tests/cases/compiler/reachabilityChecks5.ts(97,13): error TS7027: Unreachable code detected. tests/cases/compiler/reachabilityChecks5.ts(116,18): error TS7030: Not all code paths return a value. tests/cases/compiler/reachabilityChecks5.ts(123,13): error TS7027: Unreachable code detected. -==== tests/cases/compiler/reachabilityChecks5.ts (10 errors) ==== +==== tests/cases/compiler/reachabilityChecks5.ts (11 errors) ==== function f0(x): number { while (true); @@ -124,6 +125,8 @@ tests/cases/compiler/reachabilityChecks5.ts(123,13): error TS7027: Unreachable c try { while (false) { return 1; + ~~~~~~ +!!! error TS7027: Unreachable code detected. } } catch (e) { diff --git a/tests/baselines/reference/reachabilityChecks6.errors.txt b/tests/baselines/reference/reachabilityChecks6.errors.txt index 38e72def8c6..24832d9ab38 100644 --- a/tests/baselines/reference/reachabilityChecks6.errors.txt +++ b/tests/baselines/reference/reachabilityChecks6.errors.txt @@ -5,11 +5,12 @@ tests/cases/compiler/reachabilityChecks6.ts(52,10): error TS7030: Not all code p tests/cases/compiler/reachabilityChecks6.ts(80,10): error TS7030: Not all code paths return a value. tests/cases/compiler/reachabilityChecks6.ts(86,13): error TS7027: Unreachable code detected. tests/cases/compiler/reachabilityChecks6.ts(94,10): error TS7030: Not all code paths return a value. +tests/cases/compiler/reachabilityChecks6.ts(97,13): error TS7027: Unreachable code detected. tests/cases/compiler/reachabilityChecks6.ts(116,10): error TS7030: Not all code paths return a value. tests/cases/compiler/reachabilityChecks6.ts(123,13): error TS7027: Unreachable code detected. -==== tests/cases/compiler/reachabilityChecks6.ts (9 errors) ==== +==== tests/cases/compiler/reachabilityChecks6.ts (10 errors) ==== function f0(x) { while (true); @@ -121,6 +122,8 @@ tests/cases/compiler/reachabilityChecks6.ts(123,13): error TS7027: Unreachable c try { while (false) { return 1; + ~~~~~~ +!!! error TS7027: Unreachable code detected. } } catch (e) { diff --git a/tests/baselines/reference/reachabilityChecks7.js b/tests/baselines/reference/reachabilityChecks7.js index c78f99953e9..0a6b5b0dac7 100644 --- a/tests/baselines/reference/reachabilityChecks7.js +++ b/tests/baselines/reference/reachabilityChecks7.js @@ -31,41 +31,36 @@ declare function use(s: string): void; let x1 = () => { use("Test"); } //// [reachabilityChecks7.js] -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promise, generator) { - return new Promise(function (resolve, reject) { - generator = generator.call(thisArg, _arguments); - function cast(value) { return value instanceof Promise && value.constructor === Promise ? value : new Promise(function (resolve) { resolve(value); }); } - function onfulfill(value) { try { step("next", value); } catch (e) { reject(e); } } - function onreject(value) { try { step("throw", value); } catch (e) { reject(e); } } - function step(verb, value) { - var result = generator[verb](value); - result.done ? resolve(result.value) : cast(result.value).then(onfulfill, onreject); - } - step("next", void 0); +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator.throw(value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments)).next()); }); }; // async function without return type annotation - error function f1() { - return __awaiter(this, void 0, Promise, function* () { + return __awaiter(this, void 0, void 0, function* () { }); } let x = function () { - return __awaiter(this, void 0, Promise, function* () { + return __awaiter(this, void 0, void 0, function* () { }); }; // async function with which promised type is void - return can be omitted function f2() { - return __awaiter(this, void 0, Promise, function* () { + return __awaiter(this, void 0, void 0, function* () { }); } function f3(x) { - return __awaiter(this, void 0, Promise, function* () { + return __awaiter(this, void 0, void 0, function* () { if (x) return 10; }); } function f4() { - return __awaiter(this, void 0, Promise, function* () { + return __awaiter(this, void 0, void 0, function* () { }); } function voidFunc() { diff --git a/tests/baselines/reference/reactNamespaceImportPresevation.js b/tests/baselines/reference/reactNamespaceImportPresevation.js new file mode 100644 index 00000000000..5c44674d031 --- /dev/null +++ b/tests/baselines/reference/reactNamespaceImportPresevation.js @@ -0,0 +1,20 @@ +//// [tests/cases/compiler/reactNamespaceImportPresevation.tsx] //// + +//// [modules.d.ts] + +declare module "my-React-Lib" { + var a: any; + export = a; +} + +//// [test.tsx] +import * as myReactLib from "my-React-Lib"; // should not be elided +declare var foo: any; + +; + + +//// [test.jsx] +"use strict"; +var myReactLib = require("my-React-Lib"); // should not be elided +; diff --git a/tests/baselines/reference/reactNamespaceImportPresevation.symbols b/tests/baselines/reference/reactNamespaceImportPresevation.symbols new file mode 100644 index 00000000000..e2f530d31ba --- /dev/null +++ b/tests/baselines/reference/reactNamespaceImportPresevation.symbols @@ -0,0 +1,21 @@ +=== tests/cases/compiler/modules.d.ts === + +declare module "my-React-Lib" { + var a: any; +>a : Symbol(a, Decl(modules.d.ts, 2, 7)) + + export = a; +>a : Symbol(a, Decl(modules.d.ts, 2, 7)) +} + +=== tests/cases/compiler/test.tsx === +import * as myReactLib from "my-React-Lib"; // should not be elided +>myReactLib : Symbol(myReactLib, Decl(test.tsx, 0, 6)) + +declare var foo: any; +>foo : Symbol(foo, Decl(test.tsx, 1, 11)) + +; +>foo : Symbol(unknown) +>data : Symbol(unknown) + diff --git a/tests/baselines/reference/reactNamespaceImportPresevation.types b/tests/baselines/reference/reactNamespaceImportPresevation.types new file mode 100644 index 00000000000..adb1d60d2d5 --- /dev/null +++ b/tests/baselines/reference/reactNamespaceImportPresevation.types @@ -0,0 +1,22 @@ +=== tests/cases/compiler/modules.d.ts === + +declare module "my-React-Lib" { + var a: any; +>a : any + + export = a; +>a : any +} + +=== tests/cases/compiler/test.tsx === +import * as myReactLib from "my-React-Lib"; // should not be elided +>myReactLib : any + +declare var foo: any; +>foo : any + +; +> : any +>foo : any +>data : any + diff --git a/tests/baselines/reference/reactNamespaceInvalidInput.errors.txt b/tests/baselines/reference/reactNamespaceInvalidInput.errors.txt new file mode 100644 index 00000000000..2e72775fe9c --- /dev/null +++ b/tests/baselines/reference/reactNamespaceInvalidInput.errors.txt @@ -0,0 +1,11 @@ +error TS5059: Invalid value for '--reactNamespace'. 'my-React-Lib' is not a valid identifier. +tests/cases/compiler/reactNamespaceInvalidInput.tsx(2,2): error TS2304: Cannot find name 'my-React-Lib'. + + +!!! error TS5059: Invalid value for '--reactNamespace'. 'my-React-Lib' is not a valid identifier. +==== tests/cases/compiler/reactNamespaceInvalidInput.tsx (1 errors) ==== + + ; + ~~~ +!!! error TS2304: Cannot find name 'my-React-Lib'. + \ No newline at end of file diff --git a/tests/baselines/reference/reactNamespaceInvalidInput.js b/tests/baselines/reference/reactNamespaceInvalidInput.js new file mode 100644 index 00000000000..bf079d6b9a8 --- /dev/null +++ b/tests/baselines/reference/reactNamespaceInvalidInput.js @@ -0,0 +1,7 @@ +//// [reactNamespaceInvalidInput.tsx] + +; + + +//// [reactNamespaceInvalidInput.js] +my-React-Lib.createElement("foo", {data: true}); diff --git a/tests/baselines/reference/reactNamespaceJSXEmit.js b/tests/baselines/reference/reactNamespaceJSXEmit.js new file mode 100644 index 00000000000..ced18ebc031 --- /dev/null +++ b/tests/baselines/reference/reactNamespaceJSXEmit.js @@ -0,0 +1,28 @@ +//// [reactNamespaceJSXEmit.tsx] + +declare var myReactLib: any; +declare var foo: any; +declare var Bar: any; +declare var x: any; + +; +; +; +; +; + + +//// [reactNamespaceJSXEmit.js] +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; +}; +myReactLib.createElement("foo", {data: true}); +myReactLib.createElement(Bar, {x: x}); +myReactLib.createElement("x-component", null); +myReactLib.createElement(Bar, __assign({}, x)); +myReactLib.createElement(Bar, __assign({}, x, {y: 2})); diff --git a/tests/baselines/reference/reactNamespaceJSXEmit.symbols b/tests/baselines/reference/reactNamespaceJSXEmit.symbols new file mode 100644 index 00000000000..3ca5b91e538 --- /dev/null +++ b/tests/baselines/reference/reactNamespaceJSXEmit.symbols @@ -0,0 +1,35 @@ +=== tests/cases/compiler/reactNamespaceJSXEmit.tsx === + +declare var myReactLib: any; +>myReactLib : Symbol(myReactLib, Decl(reactNamespaceJSXEmit.tsx, 1, 11)) + +declare var foo: any; +>foo : Symbol(foo, Decl(reactNamespaceJSXEmit.tsx, 2, 11)) + +declare var Bar: any; +>Bar : Symbol(Bar, Decl(reactNamespaceJSXEmit.tsx, 3, 11)) + +declare var x: any; +>x : Symbol(x, Decl(reactNamespaceJSXEmit.tsx, 4, 11)) + +; +>foo : Symbol(unknown) +>data : Symbol(unknown) + +; +>Bar : Symbol(Bar, Decl(reactNamespaceJSXEmit.tsx, 3, 11)) +>x : Symbol(unknown) +>x : Symbol(x, Decl(reactNamespaceJSXEmit.tsx, 4, 11)) + +; +>x-component : Symbol(unknown) + +; +>Bar : Symbol(Bar, Decl(reactNamespaceJSXEmit.tsx, 3, 11)) +>x : Symbol(x, Decl(reactNamespaceJSXEmit.tsx, 4, 11)) + +; +>Bar : Symbol(Bar, Decl(reactNamespaceJSXEmit.tsx, 3, 11)) +>x : Symbol(x, Decl(reactNamespaceJSXEmit.tsx, 4, 11)) +>y : Symbol(unknown) + diff --git a/tests/baselines/reference/reactNamespaceJSXEmit.types b/tests/baselines/reference/reactNamespaceJSXEmit.types new file mode 100644 index 00000000000..06c803ef7fd --- /dev/null +++ b/tests/baselines/reference/reactNamespaceJSXEmit.types @@ -0,0 +1,41 @@ +=== tests/cases/compiler/reactNamespaceJSXEmit.tsx === + +declare var myReactLib: any; +>myReactLib : any + +declare var foo: any; +>foo : any + +declare var Bar: any; +>Bar : any + +declare var x: any; +>x : any + +; +> : any +>foo : any +>data : any + +; +> : any +>Bar : any +>x : any +>x : any + +; +> : any +>x-component : any + +; +> : any +>Bar : any +>x : any + +; +> : any +>Bar : any +>x : any +>y : any +>2 : number + diff --git a/tests/baselines/reference/reactNamespaceMissingDeclaration.errors.txt b/tests/baselines/reference/reactNamespaceMissingDeclaration.errors.txt new file mode 100644 index 00000000000..f87d223f824 --- /dev/null +++ b/tests/baselines/reference/reactNamespaceMissingDeclaration.errors.txt @@ -0,0 +1,9 @@ +tests/cases/compiler/reactNamespaceMissingDeclaration.tsx(3,2): error TS2304: Cannot find name 'myReactLib'. + + +==== tests/cases/compiler/reactNamespaceMissingDeclaration.tsx (1 errors) ==== + + // Error myReactLib not declared + + ~~~ +!!! error TS2304: Cannot find name 'myReactLib'. \ No newline at end of file diff --git a/tests/baselines/reference/reactNamespaceMissingDeclaration.js b/tests/baselines/reference/reactNamespaceMissingDeclaration.js new file mode 100644 index 00000000000..d972f319f8f --- /dev/null +++ b/tests/baselines/reference/reactNamespaceMissingDeclaration.js @@ -0,0 +1,8 @@ +//// [reactNamespaceMissingDeclaration.tsx] + +// Error myReactLib not declared + + +//// [reactNamespaceMissingDeclaration.js] +// Error myReactLib not declared +myReactLib.createElement("foo", {data: true}); diff --git a/tests/baselines/reference/readonlyInAmbientClass.errors.txt b/tests/baselines/reference/readonlyInAmbientClass.errors.txt new file mode 100644 index 00000000000..844e8b58ef8 --- /dev/null +++ b/tests/baselines/reference/readonlyInAmbientClass.errors.txt @@ -0,0 +1,13 @@ +tests/cases/conformance/classes/constructorDeclarations/constructorParameters/readonlyInAmbientClass.ts(2,14): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/conformance/classes/constructorDeclarations/constructorParameters/readonlyInAmbientClass.ts(3,9): error TS2369: A parameter property is only allowed in a constructor implementation. + + +==== tests/cases/conformance/classes/constructorDeclarations/constructorParameters/readonlyInAmbientClass.ts (2 errors) ==== + declare class C{ + constructor(readonly x: number); + ~~~~~~~~~~~~~~~~~~ +!!! error TS2369: A parameter property is only allowed in a constructor implementation. + method(readonly x: number); + ~~~~~~~~~~~~~~~~~~ +!!! error TS2369: A parameter property is only allowed in a constructor implementation. + } \ No newline at end of file diff --git a/tests/baselines/reference/readonlyInAmbientClass.js b/tests/baselines/reference/readonlyInAmbientClass.js new file mode 100644 index 00000000000..0e199b5ca4f --- /dev/null +++ b/tests/baselines/reference/readonlyInAmbientClass.js @@ -0,0 +1,7 @@ +//// [readonlyInAmbientClass.ts] +declare class C{ + constructor(readonly x: number); + method(readonly x: number); +} + +//// [readonlyInAmbientClass.js] diff --git a/tests/baselines/reference/readonlyInConstructorParameters.errors.txt b/tests/baselines/reference/readonlyInConstructorParameters.errors.txt new file mode 100644 index 00000000000..6e4b549ce74 --- /dev/null +++ b/tests/baselines/reference/readonlyInConstructorParameters.errors.txt @@ -0,0 +1,25 @@ +tests/cases/conformance/classes/constructorDeclarations/constructorParameters/readonlyInConstructorParameters.ts(4,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. +tests/cases/conformance/classes/constructorDeclarations/constructorParameters/readonlyInConstructorParameters.ts(7,26): error TS1029: 'public' modifier must precede 'readonly' modifier. +tests/cases/conformance/classes/constructorDeclarations/constructorParameters/readonlyInConstructorParameters.ts(13,10): error TS2341: Property 'x' is private and only accessible within class 'F'. + + +==== tests/cases/conformance/classes/constructorDeclarations/constructorParameters/readonlyInConstructorParameters.ts (3 errors) ==== + class C { + constructor(readonly x: number) {} + } + new C(1).x = 2; + ~~~~~~~~~~ +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. + + class E { + constructor(readonly public x: number) {} + ~~~~~~ +!!! error TS1029: 'public' modifier must precede 'readonly' modifier. + } + + class F { + constructor(private readonly x: number) {} + } + new F(1).x; + ~ +!!! error TS2341: Property 'x' is private and only accessible within class 'F'. \ No newline at end of file diff --git a/tests/baselines/reference/readonlyInConstructorParameters.js b/tests/baselines/reference/readonlyInConstructorParameters.js new file mode 100644 index 00000000000..41e9c57cd72 --- /dev/null +++ b/tests/baselines/reference/readonlyInConstructorParameters.js @@ -0,0 +1,36 @@ +//// [readonlyInConstructorParameters.ts] +class C { + constructor(readonly x: number) {} +} +new C(1).x = 2; + +class E { + constructor(readonly public x: number) {} +} + +class F { + constructor(private readonly x: number) {} +} +new F(1).x; + +//// [readonlyInConstructorParameters.js] +var C = (function () { + function C(x) { + this.x = x; + } + return C; +}()); +new C(1).x = 2; +var E = (function () { + function E(x) { + this.x = x; + } + return E; +}()); +var F = (function () { + function F(x) { + this.x = x; + } + return F; +}()); +new F(1).x; diff --git a/tests/baselines/reference/readonlyInDeclarationFile.js b/tests/baselines/reference/readonlyInDeclarationFile.js new file mode 100644 index 00000000000..71e48272ecc --- /dev/null +++ b/tests/baselines/reference/readonlyInDeclarationFile.js @@ -0,0 +1,180 @@ +//// [readonlyInDeclarationFile.ts] + +interface Foo { + readonly x: number; + readonly [x: string]: Object; +} + +class C { + readonly [x: string]: Object; + private readonly a1: number; + protected readonly a2: number; + public readonly a3: number; + private get b1() { return 1 } + protected get b2() { return 1 } + public get b3() { return 1 } + private get c1() { return 1 } + private set c1(value) { } + protected get c2() { return 1 } + protected set c2(value) { } + public get c3() { return 1 } + public set c3(value) { } + private static readonly s1: number; + protected static readonly s2: number; + public static readonly s3: number; + private static get t1() { return 1 } + protected static get t2() { return 1 } + public static get t3() { return 1 } + private static get u1() { return 1 } + private static set u1(value) { } + protected static get u2() { return 1 } + protected static set u2(value) { } + public static get u3() { return 1 } + public static set u3(value) { } +} + +var z: { + readonly a: string; + readonly [x: string]: Object; +} + +function f() { + return { + get x() { return 1; }, + get y() { return 1; }, + set y(value) { } + } +} + +function g() { + var x: { + readonly a: string; + readonly [x: string]: Object; + } + return x; +} + +//// [readonlyInDeclarationFile.js] +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, "b1", { + get: function () { return 1; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, "b2", { + get: function () { return 1; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, "b3", { + get: function () { return 1; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, "c1", { + get: function () { return 1; }, + set: function (value) { }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, "c2", { + get: function () { return 1; }, + set: function (value) { }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, "c3", { + get: function () { return 1; }, + set: function (value) { }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C, "t1", { + get: function () { return 1; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C, "t2", { + get: function () { return 1; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C, "t3", { + get: function () { return 1; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C, "u1", { + get: function () { return 1; }, + set: function (value) { }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C, "u2", { + get: function () { return 1; }, + set: function (value) { }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C, "u3", { + get: function () { return 1; }, + set: function (value) { }, + enumerable: true, + configurable: true + }); + return C; +}()); +var z; +function f() { + return { + get x() { return 1; }, + get y() { return 1; }, + set y(value) { } + }; +} +function g() { + var x; + return x; +} + + +//// [readonlyInDeclarationFile.d.ts] +interface Foo { + readonly x: number; + readonly [x: string]: Object; +} +declare class C { + readonly [x: string]: Object; + private readonly a1; + protected readonly a2: number; + readonly a3: number; + private readonly b1; + protected readonly b2: number; + readonly b3: number; + private c1; + protected c2: number; + c3: number; + private static readonly s1; + protected static readonly s2: number; + static readonly s3: number; + private static readonly t1; + protected static readonly t2: number; + static readonly t3: number; + private static u1; + protected static u2: number; + static u3: number; +} +declare var z: { + readonly a: string; + readonly [x: string]: Object; +}; +declare function f(): { + readonly x: number; + y: number; +}; +declare function g(): { + readonly [x: string]: Object; + readonly a: string; +}; diff --git a/tests/baselines/reference/readonlyInDeclarationFile.symbols b/tests/baselines/reference/readonlyInDeclarationFile.symbols new file mode 100644 index 00000000000..c5f3b066a5d --- /dev/null +++ b/tests/baselines/reference/readonlyInDeclarationFile.symbols @@ -0,0 +1,142 @@ +=== tests/cases/compiler/readonlyInDeclarationFile.ts === + +interface Foo { +>Foo : Symbol(Foo, Decl(readonlyInDeclarationFile.ts, 0, 0)) + + readonly x: number; +>x : Symbol(Foo.x, Decl(readonlyInDeclarationFile.ts, 1, 15)) + + readonly [x: string]: Object; +>x : Symbol(x, Decl(readonlyInDeclarationFile.ts, 3, 14)) +>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +} + +class C { +>C : Symbol(C, Decl(readonlyInDeclarationFile.ts, 4, 1)) + + readonly [x: string]: Object; +>x : Symbol(x, Decl(readonlyInDeclarationFile.ts, 7, 14)) +>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) + + private readonly a1: number; +>a1 : Symbol(C.a1, Decl(readonlyInDeclarationFile.ts, 7, 33)) + + protected readonly a2: number; +>a2 : Symbol(C.a2, Decl(readonlyInDeclarationFile.ts, 8, 32)) + + public readonly a3: number; +>a3 : Symbol(C.a3, Decl(readonlyInDeclarationFile.ts, 9, 34)) + + private get b1() { return 1 } +>b1 : Symbol(C.b1, Decl(readonlyInDeclarationFile.ts, 10, 31)) + + protected get b2() { return 1 } +>b2 : Symbol(C.b2, Decl(readonlyInDeclarationFile.ts, 11, 33)) + + public get b3() { return 1 } +>b3 : Symbol(C.b3, Decl(readonlyInDeclarationFile.ts, 12, 35)) + + private get c1() { return 1 } +>c1 : Symbol(C.c1, Decl(readonlyInDeclarationFile.ts, 13, 32), Decl(readonlyInDeclarationFile.ts, 14, 33)) + + private set c1(value) { } +>c1 : Symbol(C.c1, Decl(readonlyInDeclarationFile.ts, 13, 32), Decl(readonlyInDeclarationFile.ts, 14, 33)) +>value : Symbol(value, Decl(readonlyInDeclarationFile.ts, 15, 19)) + + protected get c2() { return 1 } +>c2 : Symbol(C.c2, Decl(readonlyInDeclarationFile.ts, 15, 29), Decl(readonlyInDeclarationFile.ts, 16, 35)) + + protected set c2(value) { } +>c2 : Symbol(C.c2, Decl(readonlyInDeclarationFile.ts, 15, 29), Decl(readonlyInDeclarationFile.ts, 16, 35)) +>value : Symbol(value, Decl(readonlyInDeclarationFile.ts, 17, 21)) + + public get c3() { return 1 } +>c3 : Symbol(C.c3, Decl(readonlyInDeclarationFile.ts, 17, 31), Decl(readonlyInDeclarationFile.ts, 18, 32)) + + public set c3(value) { } +>c3 : Symbol(C.c3, Decl(readonlyInDeclarationFile.ts, 17, 31), Decl(readonlyInDeclarationFile.ts, 18, 32)) +>value : Symbol(value, Decl(readonlyInDeclarationFile.ts, 19, 18)) + + private static readonly s1: number; +>s1 : Symbol(C.s1, Decl(readonlyInDeclarationFile.ts, 19, 28)) + + protected static readonly s2: number; +>s2 : Symbol(C.s2, Decl(readonlyInDeclarationFile.ts, 20, 39)) + + public static readonly s3: number; +>s3 : Symbol(C.s3, Decl(readonlyInDeclarationFile.ts, 21, 41)) + + private static get t1() { return 1 } +>t1 : Symbol(C.t1, Decl(readonlyInDeclarationFile.ts, 22, 38)) + + protected static get t2() { return 1 } +>t2 : Symbol(C.t2, Decl(readonlyInDeclarationFile.ts, 23, 40)) + + public static get t3() { return 1 } +>t3 : Symbol(C.t3, Decl(readonlyInDeclarationFile.ts, 24, 42)) + + private static get u1() { return 1 } +>u1 : Symbol(C.u1, Decl(readonlyInDeclarationFile.ts, 25, 39), Decl(readonlyInDeclarationFile.ts, 26, 40)) + + private static set u1(value) { } +>u1 : Symbol(C.u1, Decl(readonlyInDeclarationFile.ts, 25, 39), Decl(readonlyInDeclarationFile.ts, 26, 40)) +>value : Symbol(value, Decl(readonlyInDeclarationFile.ts, 27, 26)) + + protected static get u2() { return 1 } +>u2 : Symbol(C.u2, Decl(readonlyInDeclarationFile.ts, 27, 36), Decl(readonlyInDeclarationFile.ts, 28, 42)) + + protected static set u2(value) { } +>u2 : Symbol(C.u2, Decl(readonlyInDeclarationFile.ts, 27, 36), Decl(readonlyInDeclarationFile.ts, 28, 42)) +>value : Symbol(value, Decl(readonlyInDeclarationFile.ts, 29, 28)) + + public static get u3() { return 1 } +>u3 : Symbol(C.u3, Decl(readonlyInDeclarationFile.ts, 29, 38), Decl(readonlyInDeclarationFile.ts, 30, 39)) + + public static set u3(value) { } +>u3 : Symbol(C.u3, Decl(readonlyInDeclarationFile.ts, 29, 38), Decl(readonlyInDeclarationFile.ts, 30, 39)) +>value : Symbol(value, Decl(readonlyInDeclarationFile.ts, 31, 25)) +} + +var z: { +>z : Symbol(z, Decl(readonlyInDeclarationFile.ts, 34, 3)) + + readonly a: string; +>a : Symbol(a, Decl(readonlyInDeclarationFile.ts, 34, 8)) + + readonly [x: string]: Object; +>x : Symbol(x, Decl(readonlyInDeclarationFile.ts, 36, 14)) +>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +} + +function f() { +>f : Symbol(f, Decl(readonlyInDeclarationFile.ts, 37, 1)) + + return { + get x() { return 1; }, +>x : Symbol(x, Decl(readonlyInDeclarationFile.ts, 40, 12)) + + get y() { return 1; }, +>y : Symbol(y, Decl(readonlyInDeclarationFile.ts, 41, 30), Decl(readonlyInDeclarationFile.ts, 42, 30)) + + set y(value) { } +>y : Symbol(y, Decl(readonlyInDeclarationFile.ts, 41, 30), Decl(readonlyInDeclarationFile.ts, 42, 30)) +>value : Symbol(value, Decl(readonlyInDeclarationFile.ts, 43, 14)) + } +} + +function g() { +>g : Symbol(g, Decl(readonlyInDeclarationFile.ts, 45, 1)) + + var x: { +>x : Symbol(x, Decl(readonlyInDeclarationFile.ts, 48, 7)) + + readonly a: string; +>a : Symbol(a, Decl(readonlyInDeclarationFile.ts, 48, 12)) + + readonly [x: string]: Object; +>x : Symbol(x, Decl(readonlyInDeclarationFile.ts, 50, 18)) +>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) + } + return x; +>x : Symbol(x, Decl(readonlyInDeclarationFile.ts, 48, 7)) +} diff --git a/tests/baselines/reference/readonlyInDeclarationFile.types b/tests/baselines/reference/readonlyInDeclarationFile.types new file mode 100644 index 00000000000..7a3e11577c8 --- /dev/null +++ b/tests/baselines/reference/readonlyInDeclarationFile.types @@ -0,0 +1,158 @@ +=== tests/cases/compiler/readonlyInDeclarationFile.ts === + +interface Foo { +>Foo : Foo + + readonly x: number; +>x : number + + readonly [x: string]: Object; +>x : string +>Object : Object +} + +class C { +>C : C + + readonly [x: string]: Object; +>x : string +>Object : Object + + private readonly a1: number; +>a1 : number + + protected readonly a2: number; +>a2 : number + + public readonly a3: number; +>a3 : number + + private get b1() { return 1 } +>b1 : number +>1 : number + + protected get b2() { return 1 } +>b2 : number +>1 : number + + public get b3() { return 1 } +>b3 : number +>1 : number + + private get c1() { return 1 } +>c1 : number +>1 : number + + private set c1(value) { } +>c1 : number +>value : number + + protected get c2() { return 1 } +>c2 : number +>1 : number + + protected set c2(value) { } +>c2 : number +>value : number + + public get c3() { return 1 } +>c3 : number +>1 : number + + public set c3(value) { } +>c3 : number +>value : number + + private static readonly s1: number; +>s1 : number + + protected static readonly s2: number; +>s2 : number + + public static readonly s3: number; +>s3 : number + + private static get t1() { return 1 } +>t1 : number +>1 : number + + protected static get t2() { return 1 } +>t2 : number +>1 : number + + public static get t3() { return 1 } +>t3 : number +>1 : number + + private static get u1() { return 1 } +>u1 : number +>1 : number + + private static set u1(value) { } +>u1 : number +>value : number + + protected static get u2() { return 1 } +>u2 : number +>1 : number + + protected static set u2(value) { } +>u2 : number +>value : number + + public static get u3() { return 1 } +>u3 : number +>1 : number + + public static set u3(value) { } +>u3 : number +>value : number +} + +var z: { +>z : { readonly [x: string]: Object; readonly a: string; } + + readonly a: string; +>a : string + + readonly [x: string]: Object; +>x : string +>Object : Object +} + +function f() { +>f : () => { readonly x: number; y: number; } + + return { +>{ get x() { return 1; }, get y() { return 1; }, set y(value) { } } : { readonly x: number; y: number; } + + get x() { return 1; }, +>x : number +>1 : number + + get y() { return 1; }, +>y : number +>1 : number + + set y(value) { } +>y : number +>value : number + } +} + +function g() { +>g : () => { readonly [x: string]: Object; readonly a: string; } + + var x: { +>x : { readonly [x: string]: Object; readonly a: string; } + + readonly a: string; +>a : string + + readonly [x: string]: Object; +>x : string +>Object : Object + } + return x; +>x : { readonly [x: string]: Object; readonly a: string; } +} diff --git a/tests/baselines/reference/readonlyInNonPropertyParameters.errors.txt b/tests/baselines/reference/readonlyInNonPropertyParameters.errors.txt new file mode 100644 index 00000000000..9e759cb8343 --- /dev/null +++ b/tests/baselines/reference/readonlyInNonPropertyParameters.errors.txt @@ -0,0 +1,21 @@ +tests/cases/compiler/readonlyInNonPropertyParameters.ts(4,9): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/compiler/readonlyInNonPropertyParameters.ts(5,8): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/compiler/readonlyInNonPropertyParameters.ts(7,2): error TS2369: A parameter property is only allowed in a constructor implementation. + + +==== tests/cases/compiler/readonlyInNonPropertyParameters.ts (3 errors) ==== + + // `readonly` won't work outside of property parameters + class X { + method(readonly x: number) {} + ~~~~~~~~~~~~~~~~~~ +!!! error TS2369: A parameter property is only allowed in a constructor implementation. + set x(readonly value: number) {} + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2369: A parameter property is only allowed in a constructor implementation. + } + (readonly x) => 0; + ~~~~~~~~~~ +!!! error TS2369: A parameter property is only allowed in a constructor implementation. + // OK to use `readonly` as a name + (readonly) => 0; \ No newline at end of file diff --git a/tests/baselines/reference/readonlyInNonPropertyParameters.js b/tests/baselines/reference/readonlyInNonPropertyParameters.js new file mode 100644 index 00000000000..db58f73d2ff --- /dev/null +++ b/tests/baselines/reference/readonlyInNonPropertyParameters.js @@ -0,0 +1,27 @@ +//// [readonlyInNonPropertyParameters.ts] + +// `readonly` won't work outside of property parameters +class X { + method(readonly x: number) {} + set x(readonly value: number) {} +} +(readonly x) => 0; +// OK to use `readonly` as a name +(readonly) => 0; + +//// [readonlyInNonPropertyParameters.js] +// `readonly` won't work outside of property parameters +var X = (function () { + function X() { + } + X.prototype.method = function (x) { }; + Object.defineProperty(X.prototype, "x", { + set: function (value) { }, + enumerable: true, + configurable: true + }); + return X; +}()); +(function (x) { return 0; }); +// OK to use `readonly` as a name +(function (readonly) { return 0; }); diff --git a/tests/baselines/reference/readonlyMembers.errors.txt b/tests/baselines/reference/readonlyMembers.errors.txt new file mode 100644 index 00000000000..7bc10aa3746 --- /dev/null +++ b/tests/baselines/reference/readonlyMembers.errors.txt @@ -0,0 +1,114 @@ +tests/cases/compiler/readonlyMembers.ts(7,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. +tests/cases/compiler/readonlyMembers.ts(8,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. +tests/cases/compiler/readonlyMembers.ts(17,9): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. +tests/cases/compiler/readonlyMembers.ts(19,13): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. +tests/cases/compiler/readonlyMembers.ts(20,13): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. +tests/cases/compiler/readonlyMembers.ts(21,13): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. +tests/cases/compiler/readonlyMembers.ts(25,9): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. +tests/cases/compiler/readonlyMembers.ts(26,9): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. +tests/cases/compiler/readonlyMembers.ts(27,9): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. +tests/cases/compiler/readonlyMembers.ts(36,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. +tests/cases/compiler/readonlyMembers.ts(40,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. +tests/cases/compiler/readonlyMembers.ts(49,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. +tests/cases/compiler/readonlyMembers.ts(56,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. +tests/cases/compiler/readonlyMembers.ts(62,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. +tests/cases/compiler/readonlyMembers.ts(65,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. + + +==== tests/cases/compiler/readonlyMembers.ts (15 errors) ==== + + interface X { + readonly a: number; + readonly b?: number; + } + var x: X = { a: 0 }; + x.a = 1; // Error + ~~~ +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. + x.b = 1; // Error + ~~~ +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. + + class C { + readonly a: number; + readonly b = 1; + get c() { return 1 } + constructor() { + this.a = 1; // Ok + this.b = 1; // Ok + this.c = 1; // Error + ~~~~~~ +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. + const f = () => { + this.a = 1; // Error + ~~~~~~ +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. + this.b = 1; // Error + ~~~~~~ +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. + this.c = 1; // Error + ~~~~~~ +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. + } + } + foo() { + this.a = 1; // Error + ~~~~~~ +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. + this.b = 1; // Error + ~~~~~~ +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. + this.c = 1; // Error + ~~~~~~ +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. + } + } + + var o = { + get a() { return 1 }, + get b() { return 1 }, + set b(value) { } + }; + o.a = 1; // Error + ~~~ +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. + o.b = 1; + + var p: { readonly a: number, b: number } = { a: 1, b: 1 }; + p.a = 1; // Error + ~~~ +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. + p.b = 1; + var q: { a: number, b: number } = p; + q.a = 1; + q.b = 1; + + enum E { + A, B, C + } + E.A = 1; // Error + ~~~ +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. + + namespace N { + export const a = 1; + export let b = 1; + export var c = 1; + } + N.a = 1; // Error + ~~~ +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. + N.b = 1; + N.c = 1; + + let xx: { readonly [x: string]: string }; + let s = xx["foo"]; + xx["foo"] = "abc"; // Error + ~~~~~~~~~ +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. + + let yy: { readonly [x: number]: string, [x: string]: string }; + yy[1] = "abc"; // Error + ~~~~~ +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. + yy["foo"] = "abc"; \ No newline at end of file diff --git a/tests/baselines/reference/readonlyMembers.js b/tests/baselines/reference/readonlyMembers.js new file mode 100644 index 00000000000..899c52d8626 --- /dev/null +++ b/tests/baselines/reference/readonlyMembers.js @@ -0,0 +1,132 @@ +//// [readonlyMembers.ts] + +interface X { + readonly a: number; + readonly b?: number; +} +var x: X = { a: 0 }; +x.a = 1; // Error +x.b = 1; // Error + +class C { + readonly a: number; + readonly b = 1; + get c() { return 1 } + constructor() { + this.a = 1; // Ok + this.b = 1; // Ok + this.c = 1; // Error + const f = () => { + this.a = 1; // Error + this.b = 1; // Error + this.c = 1; // Error + } + } + foo() { + this.a = 1; // Error + this.b = 1; // Error + this.c = 1; // Error + } +} + +var o = { + get a() { return 1 }, + get b() { return 1 }, + set b(value) { } +}; +o.a = 1; // Error +o.b = 1; + +var p: { readonly a: number, b: number } = { a: 1, b: 1 }; +p.a = 1; // Error +p.b = 1; +var q: { a: number, b: number } = p; +q.a = 1; +q.b = 1; + +enum E { + A, B, C +} +E.A = 1; // Error + +namespace N { + export const a = 1; + export let b = 1; + export var c = 1; +} +N.a = 1; // Error +N.b = 1; +N.c = 1; + +let xx: { readonly [x: string]: string }; +let s = xx["foo"]; +xx["foo"] = "abc"; // Error + +let yy: { readonly [x: number]: string, [x: string]: string }; +yy[1] = "abc"; // Error +yy["foo"] = "abc"; + +//// [readonlyMembers.js] +var x = { a: 0 }; +x.a = 1; // Error +x.b = 1; // Error +var C = (function () { + function C() { + var _this = this; + this.b = 1; + this.a = 1; // Ok + this.b = 1; // Ok + this.c = 1; // Error + var f = function () { + _this.a = 1; // Error + _this.b = 1; // Error + _this.c = 1; // Error + }; + } + Object.defineProperty(C.prototype, "c", { + get: function () { return 1; }, + enumerable: true, + configurable: true + }); + C.prototype.foo = function () { + this.a = 1; // Error + this.b = 1; // Error + this.c = 1; // Error + }; + return C; +}()); +var o = { + get a() { return 1; }, + get b() { return 1; }, + set b(value) { } +}; +o.a = 1; // Error +o.b = 1; +var p = { a: 1, b: 1 }; +p.a = 1; // Error +p.b = 1; +var q = p; +q.a = 1; +q.b = 1; +var E; +(function (E) { + E[E["A"] = 0] = "A"; + E[E["B"] = 1] = "B"; + E[E["C"] = 2] = "C"; +})(E || (E = {})); +E.A = 1; // Error +var N; +(function (N) { + N.a = 1; + N.b = 1; + N.c = 1; +})(N || (N = {})); +N.a = 1; // Error +N.b = 1; +N.c = 1; +var xx; +var s = xx["foo"]; +xx["foo"] = "abc"; // Error +var yy; +yy[1] = "abc"; // Error +yy["foo"] = "abc"; diff --git a/tests/baselines/reference/readonlyReadonly.errors.txt b/tests/baselines/reference/readonlyReadonly.errors.txt new file mode 100644 index 00000000000..b1ea129303a --- /dev/null +++ b/tests/baselines/reference/readonlyReadonly.errors.txt @@ -0,0 +1,13 @@ +tests/cases/conformance/classes/constructorDeclarations/constructorParameters/readonlyReadonly.ts(2,14): error TS1030: 'readonly' modifier already seen. +tests/cases/conformance/classes/constructorDeclarations/constructorParameters/readonlyReadonly.ts(3,26): error TS1030: 'readonly' modifier already seen. + + +==== tests/cases/conformance/classes/constructorDeclarations/constructorParameters/readonlyReadonly.ts (2 errors) ==== + class C { + readonly readonly x: number; + ~~~~~~~~ +!!! error TS1030: 'readonly' modifier already seen. + constructor(readonly readonly y: number) {} + ~~~~~~~~ +!!! error TS1030: 'readonly' modifier already seen. + } \ No newline at end of file diff --git a/tests/baselines/reference/readonlyReadonly.js b/tests/baselines/reference/readonlyReadonly.js new file mode 100644 index 00000000000..0b804e147b6 --- /dev/null +++ b/tests/baselines/reference/readonlyReadonly.js @@ -0,0 +1,13 @@ +//// [readonlyReadonly.ts] +class C { + readonly readonly x: number; + constructor(readonly readonly y: number) {} +} + +//// [readonlyReadonly.js] +var C = (function () { + function C(y) { + this.y = y; + } + return C; +}()); diff --git a/tests/baselines/reference/reboundBaseClassSymbol.symbols b/tests/baselines/reference/reboundBaseClassSymbol.symbols index 788d7d95c9e..79cc00a6459 100644 --- a/tests/baselines/reference/reboundBaseClassSymbol.symbols +++ b/tests/baselines/reference/reboundBaseClassSymbol.symbols @@ -1,7 +1,7 @@ === tests/cases/compiler/reboundBaseClassSymbol.ts === interface A { a: number; } >A : Symbol(A, Decl(reboundBaseClassSymbol.ts, 0, 0)) ->a : Symbol(a, Decl(reboundBaseClassSymbol.ts, 0, 13)) +>a : Symbol(A.a, Decl(reboundBaseClassSymbol.ts, 0, 13)) module Foo { >Foo : Symbol(Foo, Decl(reboundBaseClassSymbol.ts, 0, 26)) @@ -12,5 +12,5 @@ module Foo { interface B extends A { b: string; } >B : Symbol(B, Decl(reboundBaseClassSymbol.ts, 2, 14)) >A : Symbol(A, Decl(reboundBaseClassSymbol.ts, 0, 0)) ->b : Symbol(b, Decl(reboundBaseClassSymbol.ts, 3, 27)) +>b : Symbol(B.b, Decl(reboundBaseClassSymbol.ts, 3, 27)) } diff --git a/tests/baselines/reference/recurringTypeParamForContainerOfBase01.js b/tests/baselines/reference/recurringTypeParamForContainerOfBase01.js new file mode 100644 index 00000000000..b3ef0cba312 --- /dev/null +++ b/tests/baselines/reference/recurringTypeParamForContainerOfBase01.js @@ -0,0 +1,27 @@ +//// [recurringTypeParamForContainerOfBase01.ts] + +interface BoxOfFoo> { + item: T +} + +interface Foo> { + self: T; +} + +interface Bar> extends Foo { + other: BoxOfFoo; +} + +//// [recurringTypeParamForContainerOfBase01.js] + + +//// [recurringTypeParamForContainerOfBase01.d.ts] +interface BoxOfFoo> { + item: T; +} +interface Foo> { + self: T; +} +interface Bar> extends Foo { + other: BoxOfFoo; +} diff --git a/tests/baselines/reference/recurringTypeParamForContainerOfBase01.symbols b/tests/baselines/reference/recurringTypeParamForContainerOfBase01.symbols new file mode 100644 index 00000000000..48ea1ffa0cf --- /dev/null +++ b/tests/baselines/reference/recurringTypeParamForContainerOfBase01.symbols @@ -0,0 +1,37 @@ +=== tests/cases/conformance/types/typeParameters/recurringTypeParamForContainerOfBase01.ts === + +interface BoxOfFoo> { +>BoxOfFoo : Symbol(BoxOfFoo, Decl(recurringTypeParamForContainerOfBase01.ts, 0, 0)) +>T : Symbol(T, Decl(recurringTypeParamForContainerOfBase01.ts, 1, 19)) +>Foo : Symbol(Foo, Decl(recurringTypeParamForContainerOfBase01.ts, 3, 1)) +>T : Symbol(T, Decl(recurringTypeParamForContainerOfBase01.ts, 1, 19)) + + item: T +>item : Symbol(BoxOfFoo.item, Decl(recurringTypeParamForContainerOfBase01.ts, 1, 38)) +>T : Symbol(T, Decl(recurringTypeParamForContainerOfBase01.ts, 1, 19)) +} + +interface Foo> { +>Foo : Symbol(Foo, Decl(recurringTypeParamForContainerOfBase01.ts, 3, 1)) +>T : Symbol(T, Decl(recurringTypeParamForContainerOfBase01.ts, 5, 14)) +>Foo : Symbol(Foo, Decl(recurringTypeParamForContainerOfBase01.ts, 3, 1)) +>T : Symbol(T, Decl(recurringTypeParamForContainerOfBase01.ts, 5, 14)) + + self: T; +>self : Symbol(Foo.self, Decl(recurringTypeParamForContainerOfBase01.ts, 5, 33)) +>T : Symbol(T, Decl(recurringTypeParamForContainerOfBase01.ts, 5, 14)) +} + +interface Bar> extends Foo { +>Bar : Symbol(Bar, Decl(recurringTypeParamForContainerOfBase01.ts, 7, 1)) +>T : Symbol(T, Decl(recurringTypeParamForContainerOfBase01.ts, 9, 14)) +>Bar : Symbol(Bar, Decl(recurringTypeParamForContainerOfBase01.ts, 7, 1)) +>T : Symbol(T, Decl(recurringTypeParamForContainerOfBase01.ts, 9, 14)) +>Foo : Symbol(Foo, Decl(recurringTypeParamForContainerOfBase01.ts, 3, 1)) +>T : Symbol(T, Decl(recurringTypeParamForContainerOfBase01.ts, 9, 14)) + + other: BoxOfFoo; +>other : Symbol(Bar.other, Decl(recurringTypeParamForContainerOfBase01.ts, 9, 48)) +>BoxOfFoo : Symbol(BoxOfFoo, Decl(recurringTypeParamForContainerOfBase01.ts, 0, 0)) +>T : Symbol(T, Decl(recurringTypeParamForContainerOfBase01.ts, 9, 14)) +} diff --git a/tests/baselines/reference/recurringTypeParamForContainerOfBase01.types b/tests/baselines/reference/recurringTypeParamForContainerOfBase01.types new file mode 100644 index 00000000000..38b23263f01 --- /dev/null +++ b/tests/baselines/reference/recurringTypeParamForContainerOfBase01.types @@ -0,0 +1,37 @@ +=== tests/cases/conformance/types/typeParameters/recurringTypeParamForContainerOfBase01.ts === + +interface BoxOfFoo> { +>BoxOfFoo : BoxOfFoo +>T : T +>Foo : Foo +>T : T + + item: T +>item : T +>T : T +} + +interface Foo> { +>Foo : Foo +>T : T +>Foo : Foo +>T : T + + self: T; +>self : T +>T : T +} + +interface Bar> extends Foo { +>Bar : Bar +>T : T +>Bar : Bar +>T : T +>Foo : Foo +>T : T + + other: BoxOfFoo; +>other : BoxOfFoo +>BoxOfFoo : BoxOfFoo +>T : T +} diff --git a/tests/baselines/reference/recursiveBaseConstructorCreation1.symbols b/tests/baselines/reference/recursiveBaseConstructorCreation1.symbols index 5cef41185e8..9185ecbfec0 100644 --- a/tests/baselines/reference/recursiveBaseConstructorCreation1.symbols +++ b/tests/baselines/reference/recursiveBaseConstructorCreation1.symbols @@ -3,7 +3,7 @@ class C1 { >C1 : Symbol(C1, Decl(recursiveBaseConstructorCreation1.ts, 0, 0)) public func(param: C2): any { } ->func : Symbol(func, Decl(recursiveBaseConstructorCreation1.ts, 0, 10)) +>func : Symbol(C1.func, Decl(recursiveBaseConstructorCreation1.ts, 0, 10)) >param : Symbol(param, Decl(recursiveBaseConstructorCreation1.ts, 1, 12)) >C2 : Symbol(C2, Decl(recursiveBaseConstructorCreation1.ts, 2, 1)) } diff --git a/tests/baselines/reference/recursiveBaseConstructorCreation2.symbols b/tests/baselines/reference/recursiveBaseConstructorCreation2.symbols index 794c8a38dc4..e2e0642f5aa 100644 --- a/tests/baselines/reference/recursiveBaseConstructorCreation2.symbols +++ b/tests/baselines/reference/recursiveBaseConstructorCreation2.symbols @@ -8,7 +8,7 @@ declare class abc extends base >base : Symbol(base, Decl(recursiveBaseConstructorCreation2.ts, 0, 0)) { foo: xyz; ->foo : Symbol(foo, Decl(recursiveBaseConstructorCreation2.ts, 4, 1)) +>foo : Symbol(abc.foo, Decl(recursiveBaseConstructorCreation2.ts, 4, 1)) >xyz : Symbol(xyz, Decl(recursiveBaseConstructorCreation2.ts, 6, 1)) } declare class xyz extends abc diff --git a/tests/baselines/reference/recursiveClassInstantiationsWithDefaultConstructors.symbols b/tests/baselines/reference/recursiveClassInstantiationsWithDefaultConstructors.symbols index 35fa0bf5ab0..c722d8ef8f7 100644 --- a/tests/baselines/reference/recursiveClassInstantiationsWithDefaultConstructors.symbols +++ b/tests/baselines/reference/recursiveClassInstantiationsWithDefaultConstructors.symbols @@ -12,7 +12,7 @@ export class MemberName { >MemberName : Symbol(MemberName, Decl(recursiveClassInstantiationsWithDefaultConstructors.ts, 1, 20)) public prefix: string = ""; ->prefix : Symbol(prefix, Decl(recursiveClassInstantiationsWithDefaultConstructors.ts, 2, 25)) +>prefix : Symbol(MemberName.prefix, Decl(recursiveClassInstantiationsWithDefaultConstructors.ts, 2, 25)) } export class MemberNameArray extends MemberName { >MemberNameArray : Symbol(MemberNameArray, Decl(recursiveClassInstantiationsWithDefaultConstructors.ts, 4, 1)) diff --git a/tests/baselines/reference/recursiveClassReferenceTest.errors.txt b/tests/baselines/reference/recursiveClassReferenceTest.errors.txt index 088d7222f48..4a1a6f1782c 100644 --- a/tests/baselines/reference/recursiveClassReferenceTest.errors.txt +++ b/tests/baselines/reference/recursiveClassReferenceTest.errors.txt @@ -1,6 +1,6 @@ tests/cases/compiler/recursiveClassReferenceTest.ts(16,19): error TS2304: Cannot find name 'Element'. -tests/cases/compiler/recursiveClassReferenceTest.ts(56,11): error TS2304: Cannot find name 'domNode'. -tests/cases/compiler/recursiveClassReferenceTest.ts(88,36): error TS2304: Cannot find name 'mode'. +tests/cases/compiler/recursiveClassReferenceTest.ts(56,11): error TS2663: Cannot find name 'domNode'. Did you mean the instance member 'this.domNode'? +tests/cases/compiler/recursiveClassReferenceTest.ts(88,36): error TS2663: Cannot find name 'mode'. Did you mean the instance member 'this.mode'? tests/cases/compiler/recursiveClassReferenceTest.ts(95,21): error TS2345: Argument of type 'Window' is not assignable to parameter of type 'IMode'. Property 'getInitialState' is missing in type 'Window'. @@ -65,7 +65,7 @@ tests/cases/compiler/recursiveClassReferenceTest.ts(95,21): error TS2345: Argume public getDomNode() { return domNode; ~~~~~~~ -!!! error TS2304: Cannot find name 'domNode'. +!!! error TS2663: Cannot find name 'domNode'. Did you mean the instance member 'this.domNode'? } public destroy() { @@ -99,7 +99,7 @@ tests/cases/compiler/recursiveClassReferenceTest.ts(95,21): error TS2345: Argume public getMode(): IMode { return mode; } ~~~~ -!!! error TS2304: Cannot find name 'mode'. +!!! error TS2663: Cannot find name 'mode'. Did you mean the instance member 'this.mode'? } export class Mode extends AbstractMode { diff --git a/tests/baselines/reference/recursiveComplicatedClasses.symbols b/tests/baselines/reference/recursiveComplicatedClasses.symbols index 93d0378793d..4fb614ae798 100644 --- a/tests/baselines/reference/recursiveComplicatedClasses.symbols +++ b/tests/baselines/reference/recursiveComplicatedClasses.symbols @@ -3,7 +3,7 @@ class Signature { >Signature : Symbol(Signature, Decl(recursiveComplicatedClasses.ts, 0, 0)) public parameters: ParameterSymbol[] = null; ->parameters : Symbol(parameters, Decl(recursiveComplicatedClasses.ts, 0, 17)) +>parameters : Symbol(Signature.parameters, Decl(recursiveComplicatedClasses.ts, 0, 17)) >ParameterSymbol : Symbol(ParameterSymbol, Decl(recursiveComplicatedClasses.ts, 17, 1)) } @@ -19,10 +19,10 @@ class Symbol { >Symbol : Symbol(Symbol, Decl(recursiveComplicatedClasses.ts, 6, 1)) public bound: boolean; ->bound : Symbol(bound, Decl(recursiveComplicatedClasses.ts, 8, 14)) +>bound : Symbol(Symbol.bound, Decl(recursiveComplicatedClasses.ts, 8, 14)) public visible() { ->visible : Symbol(visible, Decl(recursiveComplicatedClasses.ts, 9, 26)) +>visible : Symbol(Symbol.visible, Decl(recursiveComplicatedClasses.ts, 9, 26)) var b: TypeSymbol; >b : Symbol(b, Decl(recursiveComplicatedClasses.ts, 11, 11)) diff --git a/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType4.js b/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType4.js index 55f89491bf8..8ccd6ecf560 100644 --- a/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType4.js +++ b/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType4.js @@ -14,8 +14,9 @@ import ClassB = require("recursiveExportAssignmentAndFindAliasedType4_moduleB"); export var b: ClassB; // This should result in type ClassB //// [recursiveExportAssignmentAndFindAliasedType4_moduleC.js] -define(["require", "exports"], function (require, exports) { +define(["require", "exports", "recursiveExportAssignmentAndFindAliasedType4_moduleC"], function (require, exports, self) { "use strict"; + return self; }); //// [recursiveExportAssignmentAndFindAliasedType4_moduleB.js] define(["require", "exports"], function (require, exports) { diff --git a/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType5.js b/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType5.js index 44464fd300e..4602ed554e5 100644 --- a/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType5.js +++ b/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType5.js @@ -18,12 +18,14 @@ import ClassB = require("recursiveExportAssignmentAndFindAliasedType5_moduleB"); export var b: ClassB; // This should result in type ClassB //// [recursiveExportAssignmentAndFindAliasedType5_moduleD.js] -define(["require", "exports"], function (require, exports) { +define(["require", "exports", "recursiveExportAssignmentAndFindAliasedType5_moduleC"], function (require, exports, self) { "use strict"; + return self; }); //// [recursiveExportAssignmentAndFindAliasedType5_moduleC.js] -define(["require", "exports"], function (require, exports) { +define(["require", "exports", "recursiveExportAssignmentAndFindAliasedType5_moduleD"], function (require, exports, self) { "use strict"; + return self; }); //// [recursiveExportAssignmentAndFindAliasedType5_moduleB.js] define(["require", "exports"], function (require, exports) { diff --git a/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType6.js b/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType6.js index a457802041b..d3487519218 100644 --- a/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType6.js +++ b/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType6.js @@ -22,16 +22,19 @@ import ClassB = require("recursiveExportAssignmentAndFindAliasedType6_moduleB"); export var b: ClassB; // This should result in type ClassB //// [recursiveExportAssignmentAndFindAliasedType6_moduleE.js] -define(["require", "exports"], function (require, exports) { +define(["require", "exports", "recursiveExportAssignmentAndFindAliasedType6_moduleC"], function (require, exports, self) { "use strict"; + return self; }); //// [recursiveExportAssignmentAndFindAliasedType6_moduleD.js] -define(["require", "exports"], function (require, exports) { +define(["require", "exports", "recursiveExportAssignmentAndFindAliasedType6_moduleE"], function (require, exports, self) { "use strict"; + return self; }); //// [recursiveExportAssignmentAndFindAliasedType6_moduleC.js] -define(["require", "exports"], function (require, exports) { +define(["require", "exports", "recursiveExportAssignmentAndFindAliasedType6_moduleD"], function (require, exports, self) { "use strict"; + return self; }); //// [recursiveExportAssignmentAndFindAliasedType6_moduleB.js] define(["require", "exports"], function (require, exports) { diff --git a/tests/baselines/reference/recursiveIdenticalAssignment.symbols b/tests/baselines/reference/recursiveIdenticalAssignment.symbols index b82fe1d9d17..54a871c5141 100644 --- a/tests/baselines/reference/recursiveIdenticalAssignment.symbols +++ b/tests/baselines/reference/recursiveIdenticalAssignment.symbols @@ -4,7 +4,7 @@ interface A { >T : Symbol(T, Decl(recursiveIdenticalAssignment.ts, 0, 12)) x: A ->x : Symbol(x, Decl(recursiveIdenticalAssignment.ts, 0, 16)) +>x : Symbol(A.x, Decl(recursiveIdenticalAssignment.ts, 0, 16)) >A : Symbol(A, Decl(recursiveIdenticalAssignment.ts, 0, 0)) >T : Symbol(T, Decl(recursiveIdenticalAssignment.ts, 0, 12)) } @@ -17,7 +17,7 @@ interface B>> { // error, constraint referencing itself >T : Symbol(T, Decl(recursiveIdenticalAssignment.ts, 4, 12)) x: B ->x : Symbol(x, Decl(recursiveIdenticalAssignment.ts, 4, 32)) +>x : Symbol(B.x, Decl(recursiveIdenticalAssignment.ts, 4, 32)) >B : Symbol(B, Decl(recursiveIdenticalAssignment.ts, 2, 1)) >T : Symbol(T, Decl(recursiveIdenticalAssignment.ts, 4, 12)) } diff --git a/tests/baselines/reference/recursiveIntersectionTypes.errors.txt b/tests/baselines/reference/recursiveIntersectionTypes.errors.txt index bac97470e55..34a25c19712 100644 --- a/tests/baselines/reference/recursiveIntersectionTypes.errors.txt +++ b/tests/baselines/reference/recursiveIntersectionTypes.errors.txt @@ -1,7 +1,6 @@ tests/cases/conformance/types/intersection/recursiveIntersectionTypes.ts(19,1): error TS2322: Type 'Entity & { next: Entity & any; }' is not assignable to type 'Product & { next: Product & any; }'. Type 'Entity & { next: Entity & any; }' is not assignable to type 'Product'. - Type '{ next: Entity & any; }' is not assignable to type 'Product'. - Property 'price' is missing in type '{ next: Entity & any; }'. + Property 'price' is missing in type 'Entity & { next: Entity & any; }'. ==== tests/cases/conformance/types/intersection/recursiveIntersectionTypes.ts (1 errors) ==== @@ -27,6 +26,5 @@ tests/cases/conformance/types/intersection/recursiveIntersectionTypes.ts(19,1): ~~~~~~~~~~~ !!! error TS2322: Type 'Entity & { next: Entity & any; }' is not assignable to type 'Product & { next: Product & any; }'. !!! error TS2322: Type 'Entity & { next: Entity & any; }' is not assignable to type 'Product'. -!!! error TS2322: Type '{ next: Entity & any; }' is not assignable to type 'Product'. -!!! error TS2322: Property 'price' is missing in type '{ next: Entity & any; }'. +!!! error TS2322: Property 'price' is missing in type 'Entity & { next: Entity & any; }'. \ No newline at end of file diff --git a/tests/baselines/reference/recursiveLetConst.errors.txt b/tests/baselines/reference/recursiveLetConst.errors.txt index 88ecb379e5e..6d3f15880bb 100644 --- a/tests/baselines/reference/recursiveLetConst.errors.txt +++ b/tests/baselines/reference/recursiveLetConst.errors.txt @@ -5,13 +5,14 @@ tests/cases/compiler/recursiveLetConst.ts(5,14): error TS2448: Block-scoped vari tests/cases/compiler/recursiveLetConst.ts(6,14): error TS2448: Block-scoped variable 'v' used before its declaration. tests/cases/compiler/recursiveLetConst.ts(7,1): error TS7027: Unreachable code detected. tests/cases/compiler/recursiveLetConst.ts(7,16): error TS2448: Block-scoped variable 'v' used before its declaration. +tests/cases/compiler/recursiveLetConst.ts(8,15): error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. tests/cases/compiler/recursiveLetConst.ts(8,15): error TS2448: Block-scoped variable 'v' used before its declaration. tests/cases/compiler/recursiveLetConst.ts(9,15): error TS2448: Block-scoped variable 'v' used before its declaration. tests/cases/compiler/recursiveLetConst.ts(10,17): error TS2448: Block-scoped variable 'v' used before its declaration. tests/cases/compiler/recursiveLetConst.ts(11,11): error TS2448: Block-scoped variable 'x2' used before its declaration. -==== tests/cases/compiler/recursiveLetConst.ts (11 errors) ==== +==== tests/cases/compiler/recursiveLetConst.ts (12 errors) ==== 'use strict' let x = x + 1; ~ @@ -35,6 +36,8 @@ tests/cases/compiler/recursiveLetConst.ts(11,11): error TS2448: Block-scoped var !!! error TS2448: Block-scoped variable 'v' used before its declaration. for (let v in v) { } ~ +!!! error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. + ~ !!! error TS2448: Block-scoped variable 'v' used before its declaration. for (let v of v) { } ~ diff --git a/tests/baselines/reference/recursiveProperties.symbols b/tests/baselines/reference/recursiveProperties.symbols index 11ecc0a4f90..73df9163d2e 100644 --- a/tests/baselines/reference/recursiveProperties.symbols +++ b/tests/baselines/reference/recursiveProperties.symbols @@ -3,20 +3,20 @@ class A { >A : Symbol(A, Decl(recursiveProperties.ts, 0, 0)) get testProp() { return this.testProp; } ->testProp : Symbol(testProp, Decl(recursiveProperties.ts, 0, 9)) ->this.testProp : Symbol(testProp, Decl(recursiveProperties.ts, 0, 9)) +>testProp : Symbol(A.testProp, Decl(recursiveProperties.ts, 0, 9)) +>this.testProp : Symbol(A.testProp, Decl(recursiveProperties.ts, 0, 9)) >this : Symbol(A, Decl(recursiveProperties.ts, 0, 0)) ->testProp : Symbol(testProp, Decl(recursiveProperties.ts, 0, 9)) +>testProp : Symbol(A.testProp, Decl(recursiveProperties.ts, 0, 9)) } class B { >B : Symbol(B, Decl(recursiveProperties.ts, 2, 1)) set testProp(value:string) { this.testProp = value; } ->testProp : Symbol(testProp, Decl(recursiveProperties.ts, 4, 9)) +>testProp : Symbol(B.testProp, Decl(recursiveProperties.ts, 4, 9)) >value : Symbol(value, Decl(recursiveProperties.ts, 5, 17)) ->this.testProp : Symbol(testProp, Decl(recursiveProperties.ts, 4, 9)) +>this.testProp : Symbol(B.testProp, Decl(recursiveProperties.ts, 4, 9)) >this : Symbol(B, Decl(recursiveProperties.ts, 2, 1)) ->testProp : Symbol(testProp, Decl(recursiveProperties.ts, 4, 9)) +>testProp : Symbol(B.testProp, Decl(recursiveProperties.ts, 4, 9)) >value : Symbol(value, Decl(recursiveProperties.ts, 5, 17)) } diff --git a/tests/baselines/reference/recursiveSpecializationOfExtendedTypeWithError.symbols b/tests/baselines/reference/recursiveSpecializationOfExtendedTypeWithError.symbols index d7bb467ac94..88b0cad70f1 100644 --- a/tests/baselines/reference/recursiveSpecializationOfExtendedTypeWithError.symbols +++ b/tests/baselines/reference/recursiveSpecializationOfExtendedTypeWithError.symbols @@ -3,7 +3,7 @@ interface HTMLSelectElement { >HTMLSelectElement : Symbol(HTMLSelectElement, Decl(recursiveSpecializationOfExtendedTypeWithError.ts, 0, 0)) options: HTMLSelectElement; ->options : Symbol(options, Decl(recursiveSpecializationOfExtendedTypeWithError.ts, 0, 29)) +>options : Symbol(HTMLSelectElement.options, Decl(recursiveSpecializationOfExtendedTypeWithError.ts, 0, 29)) >HTMLSelectElement : Symbol(HTMLSelectElement, Decl(recursiveSpecializationOfExtendedTypeWithError.ts, 0, 0)) (name: A): any; diff --git a/tests/baselines/reference/recursiveTupleTypes1.symbols b/tests/baselines/reference/recursiveTupleTypes1.symbols index 8bd0797f3f6..94802dd5135 100644 --- a/tests/baselines/reference/recursiveTupleTypes1.symbols +++ b/tests/baselines/reference/recursiveTupleTypes1.symbols @@ -3,7 +3,7 @@ interface Tree1 { >Tree1 : Symbol(Tree1, Decl(recursiveTupleTypes1.ts, 0, 0)) children: [Tree1, Tree2]; ->children : Symbol(children, Decl(recursiveTupleTypes1.ts, 0, 17)) +>children : Symbol(Tree1.children, Decl(recursiveTupleTypes1.ts, 0, 17)) >Tree1 : Symbol(Tree1, Decl(recursiveTupleTypes1.ts, 0, 0)) >Tree2 : Symbol(Tree2, Decl(recursiveTupleTypes1.ts, 2, 1)) } @@ -12,7 +12,7 @@ interface Tree2 { >Tree2 : Symbol(Tree2, Decl(recursiveTupleTypes1.ts, 2, 1)) children: [Tree2, Tree1]; ->children : Symbol(children, Decl(recursiveTupleTypes1.ts, 4, 17)) +>children : Symbol(Tree2.children, Decl(recursiveTupleTypes1.ts, 4, 17)) >Tree2 : Symbol(Tree2, Decl(recursiveTupleTypes1.ts, 2, 1)) >Tree1 : Symbol(Tree1, Decl(recursiveTupleTypes1.ts, 0, 0)) } diff --git a/tests/baselines/reference/recursiveTupleTypes2.symbols b/tests/baselines/reference/recursiveTupleTypes2.symbols index 2895f1b5669..8212239f89e 100644 --- a/tests/baselines/reference/recursiveTupleTypes2.symbols +++ b/tests/baselines/reference/recursiveTupleTypes2.symbols @@ -3,7 +3,7 @@ interface Tree1 { >Tree1 : Symbol(Tree1, Decl(recursiveTupleTypes2.ts, 0, 0)) children: [Tree1, Tree2]; ->children : Symbol(children, Decl(recursiveTupleTypes2.ts, 0, 17)) +>children : Symbol(Tree1.children, Decl(recursiveTupleTypes2.ts, 0, 17)) >Tree1 : Symbol(Tree1, Decl(recursiveTupleTypes2.ts, 0, 0)) >Tree2 : Symbol(Tree2, Decl(recursiveTupleTypes2.ts, 2, 1)) } @@ -12,7 +12,7 @@ interface Tree2 { >Tree2 : Symbol(Tree2, Decl(recursiveTupleTypes2.ts, 2, 1)) children: [Tree2, Tree2]; ->children : Symbol(children, Decl(recursiveTupleTypes2.ts, 4, 17)) +>children : Symbol(Tree2.children, Decl(recursiveTupleTypes2.ts, 4, 17)) >Tree2 : Symbol(Tree2, Decl(recursiveTupleTypes2.ts, 2, 1)) >Tree2 : Symbol(Tree2, Decl(recursiveTupleTypes2.ts, 2, 1)) } diff --git a/tests/baselines/reference/recursiveTypeComparison.symbols b/tests/baselines/reference/recursiveTypeComparison.symbols index 7aa566971e8..baca46bce71 100644 --- a/tests/baselines/reference/recursiveTypeComparison.symbols +++ b/tests/baselines/reference/recursiveTypeComparison.symbols @@ -7,23 +7,23 @@ interface Observable { // This member can't be of type T, Property, or Observable needThisOne: Observable; ->needThisOne : Symbol(needThisOne, Decl(recursiveTypeComparison.ts, 2, 25)) +>needThisOne : Symbol(Observable.needThisOne, Decl(recursiveTypeComparison.ts, 2, 25)) >Observable : Symbol(Observable, Decl(recursiveTypeComparison.ts, 0, 0)) >T : Symbol(T, Decl(recursiveTypeComparison.ts, 2, 21)) // Add more to make it slower expo1: Property; // 0.31 seconds in check ->expo1 : Symbol(expo1, Decl(recursiveTypeComparison.ts, 4, 31)) +>expo1 : Symbol(Observable.expo1, Decl(recursiveTypeComparison.ts, 4, 31)) >Property : Symbol(Property, Decl(recursiveTypeComparison.ts, 9, 1)) >T : Symbol(T, Decl(recursiveTypeComparison.ts, 2, 21)) expo2: Property; // 3.11 seconds ->expo2 : Symbol(expo2, Decl(recursiveTypeComparison.ts, 6, 25)) +>expo2 : Symbol(Observable.expo2, Decl(recursiveTypeComparison.ts, 6, 25)) >Property : Symbol(Property, Decl(recursiveTypeComparison.ts, 9, 1)) >T : Symbol(T, Decl(recursiveTypeComparison.ts, 2, 21)) expo3: Property; // 82.28 seconds ->expo3 : Symbol(expo3, Decl(recursiveTypeComparison.ts, 7, 25)) +>expo3 : Symbol(Observable.expo3, Decl(recursiveTypeComparison.ts, 7, 25)) >Property : Symbol(Property, Decl(recursiveTypeComparison.ts, 9, 1)) >T : Symbol(T, Decl(recursiveTypeComparison.ts, 2, 21)) } diff --git a/tests/baselines/reference/recursiveTypeInGenericConstraint.symbols b/tests/baselines/reference/recursiveTypeInGenericConstraint.symbols index d23245e2187..aaace0cd0c4 100644 --- a/tests/baselines/reference/recursiveTypeInGenericConstraint.symbols +++ b/tests/baselines/reference/recursiveTypeInGenericConstraint.symbols @@ -4,7 +4,7 @@ class G { >T : Symbol(T, Decl(recursiveTypeInGenericConstraint.ts, 0, 8)) x: G>; // infinitely expanding type reference ->x : Symbol(x, Decl(recursiveTypeInGenericConstraint.ts, 0, 12)) +>x : Symbol(G.x, Decl(recursiveTypeInGenericConstraint.ts, 0, 12)) >G : Symbol(G, Decl(recursiveTypeInGenericConstraint.ts, 0, 0)) >G : Symbol(G, Decl(recursiveTypeInGenericConstraint.ts, 0, 0)) >T : Symbol(T, Decl(recursiveTypeInGenericConstraint.ts, 0, 8)) @@ -17,7 +17,7 @@ class Foo> { // error, constraint referencing itself >T : Symbol(T, Decl(recursiveTypeInGenericConstraint.ts, 4, 10)) bar: T; ->bar : Symbol(bar, Decl(recursiveTypeInGenericConstraint.ts, 4, 27)) +>bar : Symbol(Foo.bar, Decl(recursiveTypeInGenericConstraint.ts, 4, 27)) >T : Symbol(T, Decl(recursiveTypeInGenericConstraint.ts, 4, 10)) } @@ -26,7 +26,7 @@ class D { >T : Symbol(T, Decl(recursiveTypeInGenericConstraint.ts, 8, 8)) x: G>; ->x : Symbol(x, Decl(recursiveTypeInGenericConstraint.ts, 8, 12)) +>x : Symbol(D.x, Decl(recursiveTypeInGenericConstraint.ts, 8, 12)) >G : Symbol(G, Decl(recursiveTypeInGenericConstraint.ts, 0, 0)) >G : Symbol(G, Decl(recursiveTypeInGenericConstraint.ts, 0, 0)) >T : Symbol(T, Decl(recursiveTypeInGenericConstraint.ts, 8, 8)) diff --git a/tests/baselines/reference/recursiveTypeParameterReferenceError1.symbols b/tests/baselines/reference/recursiveTypeParameterReferenceError1.symbols index e9bb848c0e3..c1695bd2130 100644 --- a/tests/baselines/reference/recursiveTypeParameterReferenceError1.symbols +++ b/tests/baselines/reference/recursiveTypeParameterReferenceError1.symbols @@ -8,7 +8,7 @@ interface Foo { >T : Symbol(T, Decl(recursiveTypeParameterReferenceError1.ts, 1, 14)) z: Foo>; // error ->z : Symbol(z, Decl(recursiveTypeParameterReferenceError1.ts, 1, 18)) +>z : Symbol(Foo.z, Decl(recursiveTypeParameterReferenceError1.ts, 1, 18)) >Foo : Symbol(Foo, Decl(recursiveTypeParameterReferenceError1.ts, 0, 14)) >X : Symbol(X, Decl(recursiveTypeParameterReferenceError1.ts, 0, 0)) >T : Symbol(T, Decl(recursiveTypeParameterReferenceError1.ts, 1, 14)) @@ -29,7 +29,7 @@ class C2 { >T : Symbol(T, Decl(recursiveTypeParameterReferenceError1.ts, 8, 9)) x: T; ->x : Symbol(x, Decl(recursiveTypeParameterReferenceError1.ts, 8, 13)) +>x : Symbol(C2.x, Decl(recursiveTypeParameterReferenceError1.ts, 8, 13)) >T : Symbol(T, Decl(recursiveTypeParameterReferenceError1.ts, 8, 9)) } interface Foo2 { @@ -37,7 +37,7 @@ interface Foo2 { >T : Symbol(T, Decl(recursiveTypeParameterReferenceError1.ts, 11, 15)) ofC4: C2<{ x: T }> // ok ->ofC4 : Symbol(ofC4, Decl(recursiveTypeParameterReferenceError1.ts, 11, 19)) +>ofC4 : Symbol(Foo2.ofC4, Decl(recursiveTypeParameterReferenceError1.ts, 11, 19)) >C2 : Symbol(C2, Decl(recursiveTypeParameterReferenceError1.ts, 5, 12)) >x : Symbol(x, Decl(recursiveTypeParameterReferenceError1.ts, 12, 14)) >T : Symbol(T, Decl(recursiveTypeParameterReferenceError1.ts, 11, 15)) diff --git a/tests/baselines/reference/recursiveTypeParameterReferenceError2.symbols b/tests/baselines/reference/recursiveTypeParameterReferenceError2.symbols index 423c2ba71d8..61234f7de2e 100644 --- a/tests/baselines/reference/recursiveTypeParameterReferenceError2.symbols +++ b/tests/baselines/reference/recursiveTypeParameterReferenceError2.symbols @@ -4,16 +4,16 @@ interface List { >T : Symbol(T, Decl(recursiveTypeParameterReferenceError2.ts, 0, 15)) data: T; ->data : Symbol(data, Decl(recursiveTypeParameterReferenceError2.ts, 0, 19)) +>data : Symbol(List.data, Decl(recursiveTypeParameterReferenceError2.ts, 0, 19)) >T : Symbol(T, Decl(recursiveTypeParameterReferenceError2.ts, 0, 15)) next: List; ->next : Symbol(next, Decl(recursiveTypeParameterReferenceError2.ts, 1, 12)) +>next : Symbol(List.next, Decl(recursiveTypeParameterReferenceError2.ts, 1, 12)) >List : Symbol(List, Decl(recursiveTypeParameterReferenceError2.ts, 0, 0)) >T : Symbol(T, Decl(recursiveTypeParameterReferenceError2.ts, 0, 15)) owner: List>; // Error, recursive reference with wrapped T ->owner : Symbol(owner, Decl(recursiveTypeParameterReferenceError2.ts, 2, 18)) +>owner : Symbol(List.owner, Decl(recursiveTypeParameterReferenceError2.ts, 2, 18)) >List : Symbol(List, Decl(recursiveTypeParameterReferenceError2.ts, 0, 0)) >List : Symbol(List, Decl(recursiveTypeParameterReferenceError2.ts, 0, 0)) >T : Symbol(T, Decl(recursiveTypeParameterReferenceError2.ts, 0, 15)) @@ -24,16 +24,16 @@ interface List2 { >T : Symbol(T, Decl(recursiveTypeParameterReferenceError2.ts, 6, 16)) data: T; ->data : Symbol(data, Decl(recursiveTypeParameterReferenceError2.ts, 6, 20)) +>data : Symbol(List2.data, Decl(recursiveTypeParameterReferenceError2.ts, 6, 20)) >T : Symbol(T, Decl(recursiveTypeParameterReferenceError2.ts, 6, 16)) next: List2; ->next : Symbol(next, Decl(recursiveTypeParameterReferenceError2.ts, 7, 12)) +>next : Symbol(List2.next, Decl(recursiveTypeParameterReferenceError2.ts, 7, 12)) >List2 : Symbol(List2, Decl(recursiveTypeParameterReferenceError2.ts, 4, 1)) >T : Symbol(T, Decl(recursiveTypeParameterReferenceError2.ts, 6, 16)) owner: List2>; // Ok ->owner : Symbol(owner, Decl(recursiveTypeParameterReferenceError2.ts, 8, 19)) +>owner : Symbol(List2.owner, Decl(recursiveTypeParameterReferenceError2.ts, 8, 19)) >List2 : Symbol(List2, Decl(recursiveTypeParameterReferenceError2.ts, 4, 1)) >List2 : Symbol(List2, Decl(recursiveTypeParameterReferenceError2.ts, 4, 1)) } diff --git a/tests/baselines/reference/recursiveTypes1.symbols b/tests/baselines/reference/recursiveTypes1.symbols index 8ced51db0dc..7efaa78e109 100644 --- a/tests/baselines/reference/recursiveTypes1.symbols +++ b/tests/baselines/reference/recursiveTypes1.symbols @@ -6,11 +6,11 @@ interface Entity> { >T : Symbol(T, Decl(recursiveTypes1.ts, 0, 17)) X: T; ->X : Symbol(X, Decl(recursiveTypes1.ts, 0, 39)) +>X : Symbol(Entity.X, Decl(recursiveTypes1.ts, 0, 39)) >T : Symbol(T, Decl(recursiveTypes1.ts, 0, 17)) Y: T; ->Y : Symbol(Y, Decl(recursiveTypes1.ts, 1, 8)) +>Y : Symbol(Entity.Y, Decl(recursiveTypes1.ts, 1, 8)) >T : Symbol(T, Decl(recursiveTypes1.ts, 0, 17)) } @@ -23,7 +23,7 @@ interface Person> extends Entity { >U : Symbol(U, Decl(recursiveTypes1.ts, 5, 17)) n: number; ->n : Symbol(n, Decl(recursiveTypes1.ts, 5, 57)) +>n : Symbol(Person.n, Decl(recursiveTypes1.ts, 5, 57)) } interface Customer extends Person { @@ -32,6 +32,6 @@ interface Customer extends Person { >Customer : Symbol(Customer, Decl(recursiveTypes1.ts, 7, 1)) s: string; ->s : Symbol(s, Decl(recursiveTypes1.ts, 9, 45)) +>s : Symbol(Customer.s, Decl(recursiveTypes1.ts, 9, 45)) } diff --git a/tests/baselines/reference/recursiveTypesUsedAsFunctionParameters.symbols b/tests/baselines/reference/recursiveTypesUsedAsFunctionParameters.symbols index 9894c6acd45..af1119fe495 100644 --- a/tests/baselines/reference/recursiveTypesUsedAsFunctionParameters.symbols +++ b/tests/baselines/reference/recursiveTypesUsedAsFunctionParameters.symbols @@ -4,11 +4,11 @@ class List { >T : Symbol(T, Decl(recursiveTypesUsedAsFunctionParameters.ts, 0, 11)) data: T; ->data : Symbol(data, Decl(recursiveTypesUsedAsFunctionParameters.ts, 0, 15)) +>data : Symbol(List.data, Decl(recursiveTypesUsedAsFunctionParameters.ts, 0, 15)) >T : Symbol(T, Decl(recursiveTypesUsedAsFunctionParameters.ts, 0, 11)) next: List>; ->next : Symbol(next, Decl(recursiveTypesUsedAsFunctionParameters.ts, 1, 12)) +>next : Symbol(List.next, Decl(recursiveTypesUsedAsFunctionParameters.ts, 1, 12)) >List : Symbol(List, Decl(recursiveTypesUsedAsFunctionParameters.ts, 0, 0)) >List : Symbol(List, Decl(recursiveTypesUsedAsFunctionParameters.ts, 0, 0)) >T : Symbol(T, Decl(recursiveTypesUsedAsFunctionParameters.ts, 0, 11)) @@ -19,11 +19,11 @@ class MyList { >T : Symbol(T, Decl(recursiveTypesUsedAsFunctionParameters.ts, 5, 13)) data: T; ->data : Symbol(data, Decl(recursiveTypesUsedAsFunctionParameters.ts, 5, 17)) +>data : Symbol(MyList.data, Decl(recursiveTypesUsedAsFunctionParameters.ts, 5, 17)) >T : Symbol(T, Decl(recursiveTypesUsedAsFunctionParameters.ts, 5, 13)) next: MyList>; ->next : Symbol(next, Decl(recursiveTypesUsedAsFunctionParameters.ts, 6, 12)) +>next : Symbol(MyList.next, Decl(recursiveTypesUsedAsFunctionParameters.ts, 6, 12)) >MyList : Symbol(MyList, Decl(recursiveTypesUsedAsFunctionParameters.ts, 3, 1)) >MyList : Symbol(MyList, Decl(recursiveTypesUsedAsFunctionParameters.ts, 3, 1)) >T : Symbol(T, Decl(recursiveTypesUsedAsFunctionParameters.ts, 5, 13)) diff --git a/tests/baselines/reference/recursiveUnionTypeInference.symbols b/tests/baselines/reference/recursiveUnionTypeInference.symbols index 88233573941..7025e6af455 100644 --- a/tests/baselines/reference/recursiveUnionTypeInference.symbols +++ b/tests/baselines/reference/recursiveUnionTypeInference.symbols @@ -4,7 +4,7 @@ interface Foo { >T : Symbol(T, Decl(recursiveUnionTypeInference.ts, 0, 14)) x: T; ->x : Symbol(x, Decl(recursiveUnionTypeInference.ts, 0, 18)) +>x : Symbol(Foo.x, Decl(recursiveUnionTypeInference.ts, 0, 18)) >T : Symbol(T, Decl(recursiveUnionTypeInference.ts, 0, 14)) } diff --git a/tests/baselines/reference/recursivelySpecializedConstructorDeclaration.symbols b/tests/baselines/reference/recursivelySpecializedConstructorDeclaration.symbols index aa2a1bfc713..a14fc677b17 100644 --- a/tests/baselines/reference/recursivelySpecializedConstructorDeclaration.symbols +++ b/tests/baselines/reference/recursivelySpecializedConstructorDeclaration.symbols @@ -11,7 +11,7 @@ module MsPortal.Controls.Base.ItemList { // Removing this line fixes the constructor of ItemValue options: ViewModel; ->options : Symbol(options, Decl(recursivelySpecializedConstructorDeclaration.ts, 2, 40)) +>options : Symbol(Interface.options, Decl(recursivelySpecializedConstructorDeclaration.ts, 2, 40)) >ViewModel : Symbol(ViewModel, Decl(recursivelySpecializedConstructorDeclaration.ts, 10, 5)) >TValue : Symbol(TValue, Decl(recursivelySpecializedConstructorDeclaration.ts, 2, 31)) } diff --git a/tests/baselines/reference/redefineArray.errors.txt b/tests/baselines/reference/redefineArray.errors.txt index b0062abff88..82ef91807c2 100644 --- a/tests/baselines/reference/redefineArray.errors.txt +++ b/tests/baselines/reference/redefineArray.errors.txt @@ -1,9 +1,7 @@ -tests/cases/compiler/redefineArray.ts(1,1): error TS2322: Type '(n: number, s: string) => number' is not assignable to type 'ArrayConstructor'. - Property 'isArray' is missing in type '(n: number, s: string) => number'. +tests/cases/compiler/redefineArray.ts(1,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. ==== tests/cases/compiler/redefineArray.ts (1 errors) ==== Array = function (n:number, s:string) {return n;}; ~~~~~ -!!! error TS2322: Type '(n: number, s: string) => number' is not assignable to type 'ArrayConstructor'. -!!! error TS2322: Property 'isArray' is missing in type '(n: number, s: string) => number'. \ No newline at end of file +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. \ No newline at end of file diff --git a/tests/baselines/reference/relativeNamesInClassicResolution.errors.txt b/tests/baselines/reference/relativeNamesInClassicResolution.errors.txt new file mode 100644 index 00000000000..65a42775331 --- /dev/null +++ b/tests/baselines/reference/relativeNamesInClassicResolution.errors.txt @@ -0,0 +1,11 @@ +tests/cases/compiler/somefolder/a.ts(2,17): error TS2307: Cannot find module './b'. + + +==== tests/cases/compiler/somefolder/a.ts (1 errors) ==== + + import {x} from "./b" + ~~~~~ +!!! error TS2307: Cannot find module './b'. + +==== tests/cases/compiler/b.ts (0 errors) ==== + export let x = 1; \ No newline at end of file diff --git a/tests/baselines/reference/relativeNamesInClassicResolution.js b/tests/baselines/reference/relativeNamesInClassicResolution.js new file mode 100644 index 00000000000..a6c5a06ea3d --- /dev/null +++ b/tests/baselines/reference/relativeNamesInClassicResolution.js @@ -0,0 +1,18 @@ +//// [tests/cases/compiler/relativeNamesInClassicResolution.ts] //// + +//// [a.ts] + +import {x} from "./b" + +//// [b.ts] +export let x = 1; + +//// [a.js] +define(["require", "exports"], function (require, exports) { + "use strict"; +}); +//// [b.js] +define(["require", "exports"], function (require, exports) { + "use strict"; + exports.x = 1; +}); diff --git a/tests/baselines/reference/relativePathToDeclarationFile.errors.txt b/tests/baselines/reference/relativePathToDeclarationFile.errors.txt deleted file mode 100644 index 0431c3a5bfa..00000000000 --- a/tests/baselines/reference/relativePathToDeclarationFile.errors.txt +++ /dev/null @@ -1,30 +0,0 @@ -tests/cases/conformance/externalModules/test/foo.d.ts(1,23): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. - - -==== tests/cases/conformance/externalModules/test/file1.ts (0 errors) ==== - import foo = require('foo'); - import other = require('./other'); - import relMod = require('./sub/relMod'); - - if(foo.M2.x){ - var x = new relMod(other.M2.x.charCodeAt(0)); - } - -==== tests/cases/conformance/externalModules/test/foo.d.ts (1 errors) ==== - export declare module M2 { - ~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. - export var x: boolean; - } - -==== tests/cases/conformance/externalModules/test/other.d.ts (0 errors) ==== - export declare module M2 { - export var x: string; - } - -==== tests/cases/conformance/externalModules/test/sub/relMod.d.ts (0 errors) ==== - declare class Test { - constructor(x: number); - } - export = Test; - \ No newline at end of file diff --git a/tests/baselines/reference/relativePathToDeclarationFile.symbols b/tests/baselines/reference/relativePathToDeclarationFile.symbols new file mode 100644 index 00000000000..5aa953178d5 --- /dev/null +++ b/tests/baselines/reference/relativePathToDeclarationFile.symbols @@ -0,0 +1,55 @@ +=== tests/cases/conformance/externalModules/test/file1.ts === +import foo = require('foo'); +>foo : Symbol(foo, Decl(file1.ts, 0, 0)) + +import other = require('./other'); +>other : Symbol(other, Decl(file1.ts, 0, 28)) + +import relMod = require('./sub/relMod'); +>relMod : Symbol(relMod, Decl(file1.ts, 1, 34)) + +if(foo.M2.x){ +>foo.M2.x : Symbol(foo.M2.x, Decl(foo.d.ts, 1, 11)) +>foo.M2 : Symbol(foo.M2, Decl(foo.d.ts, 0, 0)) +>foo : Symbol(foo, Decl(file1.ts, 0, 0)) +>M2 : Symbol(foo.M2, Decl(foo.d.ts, 0, 0)) +>x : Symbol(foo.M2.x, Decl(foo.d.ts, 1, 11)) + + var x = new relMod(other.M2.x.charCodeAt(0)); +>x : Symbol(x, Decl(file1.ts, 5, 4)) +>relMod : Symbol(relMod, Decl(file1.ts, 1, 34)) +>other.M2.x.charCodeAt : Symbol(String.charCodeAt, Decl(lib.d.ts, --, --)) +>other.M2.x : Symbol(other.M2.x, Decl(other.d.ts, 1, 11)) +>other.M2 : Symbol(other.M2, Decl(other.d.ts, 0, 0)) +>other : Symbol(other, Decl(file1.ts, 0, 28)) +>M2 : Symbol(other.M2, Decl(other.d.ts, 0, 0)) +>x : Symbol(other.M2.x, Decl(other.d.ts, 1, 11)) +>charCodeAt : Symbol(String.charCodeAt, Decl(lib.d.ts, --, --)) +} + +=== tests/cases/conformance/externalModules/test/foo.d.ts === +export declare module M2 { +>M2 : Symbol(M2, Decl(foo.d.ts, 0, 0)) + + export var x: boolean; +>x : Symbol(x, Decl(foo.d.ts, 1, 11)) +} + +=== tests/cases/conformance/externalModules/test/other.d.ts === +export declare module M2 { +>M2 : Symbol(M2, Decl(other.d.ts, 0, 0)) + + export var x: string; +>x : Symbol(x, Decl(other.d.ts, 1, 11)) +} + +=== tests/cases/conformance/externalModules/test/sub/relMod.d.ts === +declare class Test { +>Test : Symbol(Test, Decl(relMod.d.ts, 0, 0)) + + constructor(x: number); +>x : Symbol(x, Decl(relMod.d.ts, 1, 13)) +} +export = Test; +>Test : Symbol(Test, Decl(relMod.d.ts, 0, 0)) + diff --git a/tests/baselines/reference/relativePathToDeclarationFile.types b/tests/baselines/reference/relativePathToDeclarationFile.types new file mode 100644 index 00000000000..ef77acc85b4 --- /dev/null +++ b/tests/baselines/reference/relativePathToDeclarationFile.types @@ -0,0 +1,58 @@ +=== tests/cases/conformance/externalModules/test/file1.ts === +import foo = require('foo'); +>foo : typeof foo + +import other = require('./other'); +>other : typeof other + +import relMod = require('./sub/relMod'); +>relMod : typeof relMod + +if(foo.M2.x){ +>foo.M2.x : boolean +>foo.M2 : typeof foo.M2 +>foo : typeof foo +>M2 : typeof foo.M2 +>x : boolean + + var x = new relMod(other.M2.x.charCodeAt(0)); +>x : relMod +>new relMod(other.M2.x.charCodeAt(0)) : relMod +>relMod : typeof relMod +>other.M2.x.charCodeAt(0) : number +>other.M2.x.charCodeAt : (index: number) => number +>other.M2.x : string +>other.M2 : typeof other.M2 +>other : typeof other +>M2 : typeof other.M2 +>x : string +>charCodeAt : (index: number) => number +>0 : number +} + +=== tests/cases/conformance/externalModules/test/foo.d.ts === +export declare module M2 { +>M2 : typeof M2 + + export var x: boolean; +>x : boolean +} + +=== tests/cases/conformance/externalModules/test/other.d.ts === +export declare module M2 { +>M2 : typeof M2 + + export var x: string; +>x : string +} + +=== tests/cases/conformance/externalModules/test/sub/relMod.d.ts === +declare class Test { +>Test : Test + + constructor(x: number); +>x : number +} +export = Test; +>Test : Test + diff --git a/tests/baselines/reference/reorderProperties.symbols b/tests/baselines/reference/reorderProperties.symbols index 6308131398c..7874e90456c 100644 --- a/tests/baselines/reference/reorderProperties.symbols +++ b/tests/baselines/reference/reorderProperties.symbols @@ -4,7 +4,7 @@ interface A { >T : Symbol(T, Decl(reorderProperties.ts, 0, 12)) x: T ->x : Symbol(x, Decl(reorderProperties.ts, 0, 16)) +>x : Symbol(A.x, Decl(reorderProperties.ts, 0, 16)) >T : Symbol(T, Decl(reorderProperties.ts, 0, 12)) } @@ -13,7 +13,7 @@ interface B { >T : Symbol(T, Decl(reorderProperties.ts, 4, 12)) x: T ->x : Symbol(x, Decl(reorderProperties.ts, 4, 16)) +>x : Symbol(B.x, Decl(reorderProperties.ts, 4, 16)) >T : Symbol(T, Decl(reorderProperties.ts, 4, 12)) } @@ -25,7 +25,7 @@ interface C extends A> { >S : Symbol(S, Decl(reorderProperties.ts, 8, 12)) y: S ->y : Symbol(y, Decl(reorderProperties.ts, 8, 32)) +>y : Symbol(C.y, Decl(reorderProperties.ts, 8, 32)) >S : Symbol(S, Decl(reorderProperties.ts, 8, 12)) } @@ -37,7 +37,7 @@ interface D extends B> { >S : Symbol(S, Decl(reorderProperties.ts, 12, 12)) y: S ->y : Symbol(y, Decl(reorderProperties.ts, 12, 32)) +>y : Symbol(D.y, Decl(reorderProperties.ts, 12, 32)) >S : Symbol(S, Decl(reorderProperties.ts, 12, 12)) } diff --git a/tests/baselines/reference/requireEmitSemicolon.symbols b/tests/baselines/reference/requireEmitSemicolon.symbols index 938dcdef8ca..a1a9ce51e4e 100644 --- a/tests/baselines/reference/requireEmitSemicolon.symbols +++ b/tests/baselines/reference/requireEmitSemicolon.symbols @@ -10,7 +10,7 @@ export module Database { >DB : Symbol(DB, Decl(requireEmitSemicolon_1.ts, 3, 24)) public findPerson(id: number): P.Models.Person { ->findPerson : Symbol(findPerson, Decl(requireEmitSemicolon_1.ts, 4, 18)) +>findPerson : Symbol(DB.findPerson, Decl(requireEmitSemicolon_1.ts, 4, 18)) >id : Symbol(id, Decl(requireEmitSemicolon_1.ts, 5, 23)) >P : Symbol(P, Decl(requireEmitSemicolon_1.ts, 0, 0)) >Models : Symbol(P.Models, Decl(requireEmitSemicolon_0.ts, 0, 0)) diff --git a/tests/baselines/reference/requiredInitializedParameter3.symbols b/tests/baselines/reference/requiredInitializedParameter3.symbols index e9f35b21bcf..8f7649b449d 100644 --- a/tests/baselines/reference/requiredInitializedParameter3.symbols +++ b/tests/baselines/reference/requiredInitializedParameter3.symbols @@ -3,7 +3,7 @@ interface I1 { >I1 : Symbol(I1, Decl(requiredInitializedParameter3.ts, 0, 0)) method(); ->method : Symbol(method, Decl(requiredInitializedParameter3.ts, 0, 14)) +>method : Symbol(I1.method, Decl(requiredInitializedParameter3.ts, 0, 14)) } class C1 implements I1 { @@ -11,7 +11,7 @@ class C1 implements I1 { >I1 : Symbol(I1, Decl(requiredInitializedParameter3.ts, 0, 0)) method(a = 0, b?) { } ->method : Symbol(method, Decl(requiredInitializedParameter3.ts, 4, 24)) +>method : Symbol(C1.method, Decl(requiredInitializedParameter3.ts, 4, 24)) >a : Symbol(a, Decl(requiredInitializedParameter3.ts, 5, 11)) >b : Symbol(b, Decl(requiredInitializedParameter3.ts, 5, 17)) } diff --git a/tests/baselines/reference/requiredInitializedParameter4.symbols b/tests/baselines/reference/requiredInitializedParameter4.symbols index 2790b33698c..5136bfc1bc0 100644 --- a/tests/baselines/reference/requiredInitializedParameter4.symbols +++ b/tests/baselines/reference/requiredInitializedParameter4.symbols @@ -3,7 +3,7 @@ class C1 { >C1 : Symbol(C1, Decl(requiredInitializedParameter4.ts, 0, 0)) method(a = 0, b) { } ->method : Symbol(method, Decl(requiredInitializedParameter4.ts, 0, 10)) +>method : Symbol(C1.method, Decl(requiredInitializedParameter4.ts, 0, 10)) >a : Symbol(a, Decl(requiredInitializedParameter4.ts, 1, 11)) >b : Symbol(b, Decl(requiredInitializedParameter4.ts, 1, 17)) } diff --git a/tests/baselines/reference/reservedWords2.errors.txt b/tests/baselines/reference/reservedWords2.errors.txt index fa89df3af7a..5aa1df63a96 100644 --- a/tests/baselines/reference/reservedWords2.errors.txt +++ b/tests/baselines/reference/reservedWords2.errors.txt @@ -1,4 +1,3 @@ -tests/cases/compiler/reservedWords2.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/compiler/reservedWords2.ts(1,8): error TS1109: Expression expected. tests/cases/compiler/reservedWords2.ts(1,14): error TS1005: '(' expected. tests/cases/compiler/reservedWords2.ts(1,16): error TS2304: Cannot find name 'require'. @@ -32,10 +31,8 @@ tests/cases/compiler/reservedWords2.ts(10,5): error TS2300: Duplicate identifier tests/cases/compiler/reservedWords2.ts(10,6): error TS1003: Identifier expected. -==== tests/cases/compiler/reservedWords2.ts (32 errors) ==== +==== tests/cases/compiler/reservedWords2.ts (31 errors) ==== import while = require("dfdf"); - ~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ~~~~~ !!! error TS1109: Expression expected. ~ diff --git a/tests/baselines/reference/resolveModuleNameWithSameLetDeclarationName2.symbols b/tests/baselines/reference/resolveModuleNameWithSameLetDeclarationName2.symbols index e98437abb9a..7ddb3d5b9e1 100644 --- a/tests/baselines/reference/resolveModuleNameWithSameLetDeclarationName2.symbols +++ b/tests/baselines/reference/resolveModuleNameWithSameLetDeclarationName2.symbols @@ -4,11 +4,11 @@ declare module "punycode" { >ucs2 : Symbol(ucs2, Decl(resolveModuleNameWithSameLetDeclarationName2.ts, 0, 27), Decl(resolveModuleNameWithSameLetDeclarationName2.ts, 6, 14)) decode(string: string): string; ->decode : Symbol(decode, Decl(resolveModuleNameWithSameLetDeclarationName2.ts, 1, 20)) +>decode : Symbol(ucs2.decode, Decl(resolveModuleNameWithSameLetDeclarationName2.ts, 1, 20)) >string : Symbol(string, Decl(resolveModuleNameWithSameLetDeclarationName2.ts, 2, 15)) encode(codePoints: number[]): string; ->encode : Symbol(encode, Decl(resolveModuleNameWithSameLetDeclarationName2.ts, 2, 39)) +>encode : Symbol(ucs2.encode, Decl(resolveModuleNameWithSameLetDeclarationName2.ts, 2, 39)) >codePoints : Symbol(codePoints, Decl(resolveModuleNameWithSameLetDeclarationName2.ts, 3, 15)) } diff --git a/tests/baselines/reference/resolvingClassDeclarationWhenInBaseTypeResolution.symbols b/tests/baselines/reference/resolvingClassDeclarationWhenInBaseTypeResolution.symbols index 39ca7f38840..a4761973db1 100644 --- a/tests/baselines/reference/resolvingClassDeclarationWhenInBaseTypeResolution.symbols +++ b/tests/baselines/reference/resolvingClassDeclarationWhenInBaseTypeResolution.symbols @@ -13,7 +13,7 @@ module rionegrensis { >sumatrana : Symbol(julianae.sumatrana, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 58, 3)) salomonseni() : caniventer { var x : caniventer; () => { var y = this; }; return x; } ->salomonseni : Symbol(salomonseni, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1, 96)) +>salomonseni : Symbol(caniventer.salomonseni, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1, 96)) >caniventer : Symbol(caniventer, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 0, 21)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 2, 36)) >caniventer : Symbol(caniventer, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 0, 21)) @@ -22,7 +22,7 @@ module rionegrensis { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 2, 36)) uchidai() : lavali.xanthognathus { var x : lavali.xanthognathus; () => { var y = this; }; return x; } ->uchidai : Symbol(uchidai, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 2, 89)) +>uchidai : Symbol(caniventer.uchidai, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 2, 89)) >lavali : Symbol(lavali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 252, 1)) >xanthognathus : Symbol(lavali.xanthognathus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 285, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 3, 42)) @@ -33,7 +33,7 @@ module rionegrensis { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 3, 42)) raffrayana() : lavali.otion { var x : lavali.otion; () => { var y = this; }; return x; } ->raffrayana : Symbol(raffrayana, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 3, 105)) +>raffrayana : Symbol(caniventer.raffrayana, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 3, 105)) >lavali : Symbol(lavali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 252, 1)) >otion : Symbol(lavali.otion, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 270, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 4, 37)) @@ -44,7 +44,7 @@ module rionegrensis { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 4, 37)) Uranium() : minutus.inez, trivirgatus.falconeri> { var x : minutus.inez, trivirgatus.falconeri>; () => { var y = this; }; return x; } ->Uranium : Symbol(Uranium, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 4, 92)) +>Uranium : Symbol(caniventer.Uranium, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 4, 92)) >minutus : Symbol(minutus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 433, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 492, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 848, 1)) >inez : Symbol(minutus.inez, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 493, 16)) >minutus : Symbol(minutus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 433, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 492, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 848, 1)) @@ -71,7 +71,7 @@ module rionegrensis { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 5, 112)) nayaur() : gabriellae.amicus { var x : gabriellae.amicus; () => { var y = this; }; return x; } ->nayaur : Symbol(nayaur, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 5, 245)) +>nayaur : Symbol(caniventer.nayaur, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 5, 245)) >gabriellae : Symbol(gabriellae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 766, 1)) >amicus : Symbol(gabriellae.amicus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 769, 5)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 6, 38)) @@ -94,7 +94,7 @@ module rionegrensis { >punicus : Symbol(lutreolus.punicus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 720, 18)) naso() : panamensis.setulosus> { var x : panamensis.setulosus>; () => { var y = this; }; return x; } ->naso : Symbol(naso, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 8, 101)) +>naso : Symbol(veraecrucis.naso, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 8, 101)) >panamensis : Symbol(panamensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 501, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 986, 1)) >setulosus : Symbol(panamensis.setulosus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 987, 19)) >lutreolus : Symbol(lutreolus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 355, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 719, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 855, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 872, 1)) @@ -121,7 +121,7 @@ module rionegrensis { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 9, 115)) vancouverensis() : imperfecta.ciliolabrum { var x : imperfecta.ciliolabrum; () => { var y = this; }; return x; } ->vancouverensis : Symbol(vancouverensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 9, 254)) +>vancouverensis : Symbol(veraecrucis.vancouverensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 9, 254)) >imperfecta : Symbol(imperfecta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 785, 1)) >ciliolabrum : Symbol(imperfecta.ciliolabrum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 807, 5)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) @@ -140,7 +140,7 @@ module rionegrensis { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 10, 86)) africana() : argurus.gilbertii, sagitta.cinereus> { var x : argurus.gilbertii, sagitta.cinereus>; () => { var y = this; }; return x; } ->africana : Symbol(africana, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 10, 186)) +>africana : Symbol(veraecrucis.africana, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 10, 186)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) >gilbertii : Symbol(argurus.gilbertii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 700, 16)) >panamensis : Symbol(panamensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 501, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 986, 1)) @@ -175,7 +175,7 @@ module rionegrensis { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 11, 147)) palliolata() : Lanthanum.jugularis { var x : Lanthanum.jugularis; () => { var y = this; }; return x; } ->palliolata : Symbol(palliolata, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 11, 314)) +>palliolata : Symbol(veraecrucis.palliolata, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 11, 314)) >Lanthanum : Symbol(Lanthanum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 106, 1)) >jugularis : Symbol(Lanthanum.jugularis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 134, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 12, 44)) @@ -186,7 +186,7 @@ module rionegrensis { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 12, 44)) nivicola() : samarensis.pallidus { var x : samarensis.pallidus; () => { var y = this; }; return x; } ->nivicola : Symbol(nivicola, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 12, 106)) +>nivicola : Symbol(veraecrucis.nivicola, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 12, 106)) >samarensis : Symbol(samarensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 531, 1)) >pallidus : Symbol(samarensis.pallidus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 563, 5)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 13, 42)) @@ -207,7 +207,7 @@ module julianae { >nudicaudus : Symbol(nudicaudus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 18, 3)) brandtii() : argurus.germaini { var x : argurus.germaini; () => { var y = this; }; return x; } ->brandtii : Symbol(brandtii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 19, 27)) +>brandtii : Symbol(nudicaudus.brandtii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 19, 27)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) >germaini : Symbol(argurus.germaini, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 893, 16)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 20, 39)) @@ -218,7 +218,7 @@ module julianae { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 20, 39)) maxwellii() : ruatanica.Praseodymium { var x : ruatanica.Praseodymium; () => { var y = this; }; return x; } ->maxwellii : Symbol(maxwellii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 20, 98)) +>maxwellii : Symbol(nudicaudus.maxwellii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 20, 98)) >ruatanica : Symbol(ruatanica, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 100, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 244, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 959, 1)) >Praseodymium : Symbol(ruatanica.Praseodymium, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 960, 18)) >Lanthanum : Symbol(Lanthanum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 106, 1)) @@ -237,7 +237,7 @@ module julianae { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 21, 88)) endoi() : panglima.abidi { var x : panglima.abidi; () => { var y = this; }; return x; } ->endoi : Symbol(endoi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 21, 195)) +>endoi : Symbol(nudicaudus.endoi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 21, 195)) >panglima : Symbol(panglima, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 400, 1)) >abidi : Symbol(panglima.abidi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 414, 5)) >dogramacii : Symbol(dogramacii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 314, 1)) @@ -256,7 +256,7 @@ module julianae { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 22, 70)) venezuelae() : howi.marcanoi { var x : howi.marcanoi; () => { var y = this; }; return x; } ->venezuelae : Symbol(venezuelae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 22, 163)) +>venezuelae : Symbol(nudicaudus.venezuelae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 22, 163)) >howi : Symbol(howi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 466, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 681, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 886, 1)) >marcanoi : Symbol(howi.marcanoi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 682, 13)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 23, 38)) @@ -267,7 +267,7 @@ module julianae { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 23, 38)) zamicrus() : rionegrensis.caniventer { var x : rionegrensis.caniventer; () => { var y = this; }; return x; } ->zamicrus : Symbol(zamicrus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 23, 94)) +>zamicrus : Symbol(nudicaudus.zamicrus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 23, 94)) >rionegrensis : Symbol(rionegrensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 0, 0)) >caniventer : Symbol(rionegrensis.caniventer, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 0, 21)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 24, 46)) @@ -281,7 +281,7 @@ module julianae { >galapagoensis : Symbol(galapagoensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 25, 3)) isabellae() : panglima.amphibius { var x : panglima.amphibius; () => { var y = this; }; return x; } ->isabellae : Symbol(isabellae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 26, 30)) +>isabellae : Symbol(galapagoensis.isabellae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 26, 30)) >panglima : Symbol(panglima, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 400, 1)) >amphibius : Symbol(panglima.amphibius, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 401, 17)) >macrorhinos : Symbol(macrorhinos, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 461, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 497, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 736, 1)) @@ -300,7 +300,7 @@ module julianae { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 27, 84)) rueppellii() : ruatanica.americanus { var x : ruatanica.americanus; () => { var y = this; }; return x; } ->rueppellii : Symbol(rueppellii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 27, 187)) +>rueppellii : Symbol(galapagoensis.rueppellii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 27, 187)) >ruatanica : Symbol(ruatanica, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 100, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 244, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 959, 1)) >americanus : Symbol(ruatanica.americanus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 245, 18)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 28, 45)) @@ -311,7 +311,7 @@ module julianae { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 28, 45)) peregusna() : dogramacii.kaiseri { var x : dogramacii.kaiseri; () => { var y = this; }; return x; } ->peregusna : Symbol(peregusna, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 28, 108)) +>peregusna : Symbol(galapagoensis.peregusna, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 28, 108)) >dogramacii : Symbol(dogramacii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 314, 1)) >kaiseri : Symbol(dogramacii.kaiseri, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 329, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 29, 42)) @@ -322,7 +322,7 @@ module julianae { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 29, 42)) gliroides() : howi.coludo { var x : howi.coludo; () => { var y = this; }; return x; } ->gliroides : Symbol(gliroides, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 29, 103)) +>gliroides : Symbol(galapagoensis.gliroides, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 29, 103)) >howi : Symbol(howi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 466, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 681, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 886, 1)) >coludo : Symbol(howi.coludo, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 887, 13)) >howi : Symbol(howi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 466, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 681, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 886, 1)) @@ -341,7 +341,7 @@ module julianae { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 30, 66)) banakrisi() : macrorhinos.daphaenodon { var x : macrorhinos.daphaenodon; () => { var y = this; }; return x; } ->banakrisi : Symbol(banakrisi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 30, 151)) +>banakrisi : Symbol(galapagoensis.banakrisi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 30, 151)) >macrorhinos : Symbol(macrorhinos, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 461, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 497, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 736, 1)) >daphaenodon : Symbol(macrorhinos.daphaenodon, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 737, 20)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 31, 47)) @@ -352,7 +352,7 @@ module julianae { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 31, 47)) rozendaali() : lutreolus.foina { var x : lutreolus.foina; () => { var y = this; }; return x; } ->rozendaali : Symbol(rozendaali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 31, 113)) +>rozendaali : Symbol(galapagoensis.rozendaali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 31, 113)) >lutreolus : Symbol(lutreolus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 355, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 719, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 855, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 872, 1)) >foina : Symbol(lutreolus.foina, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 856, 18)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 32, 40)) @@ -363,7 +363,7 @@ module julianae { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 32, 40)) stuhlmanni() : panamensis.linulus { var x : panamensis.linulus; () => { var y = this; }; return x; } ->stuhlmanni : Symbol(stuhlmanni, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 32, 98)) +>stuhlmanni : Symbol(galapagoensis.stuhlmanni, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 32, 98)) >panamensis : Symbol(panamensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 501, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 986, 1)) >linulus : Symbol(panamensis.linulus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 502, 19)) >caurinus : Symbol(caurinus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 449, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 836, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 976, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1007, 1)) @@ -387,7 +387,7 @@ module julianae { >T1 : Symbol(T1, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 35, 27)) mattheyi() : samarensis.fuscus> { var x : samarensis.fuscus>; () => { var y = this; }; return x; } ->mattheyi : Symbol(mattheyi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 35, 33)) +>mattheyi : Symbol(albidens.mattheyi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 35, 33)) >samarensis : Symbol(samarensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 531, 1)) >fuscus : Symbol(samarensis.fuscus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 547, 5)) >lavali : Symbol(lavali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 252, 1)) @@ -414,7 +414,7 @@ module julianae { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 36, 126)) Astatine() : steerii { var x : steerii; () => { var y = this; }; return x; } ->Astatine : Symbol(Astatine, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 36, 272)) +>Astatine : Symbol(albidens.Astatine, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 36, 272)) >steerii : Symbol(steerii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 16, 17)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 37, 30)) >steerii : Symbol(steerii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 16, 17)) @@ -423,7 +423,7 @@ module julianae { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 37, 30)) vincenti() : argurus.dauricus { var x : argurus.dauricus; () => { var y = this; }; return x; } ->vincenti : Symbol(vincenti, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 37, 80)) +>vincenti : Symbol(albidens.vincenti, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 37, 80)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) >dauricus : Symbol(argurus.dauricus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 374, 16)) >macrorhinos : Symbol(macrorhinos, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 461, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 497, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 736, 1)) @@ -442,7 +442,7 @@ module julianae { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 38, 81)) hirta() : Lanthanum.jugularis { var x : Lanthanum.jugularis; () => { var y = this; }; return x; } ->hirta : Symbol(hirta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 38, 182)) +>hirta : Symbol(albidens.hirta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 38, 182)) >Lanthanum : Symbol(Lanthanum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 106, 1)) >jugularis : Symbol(Lanthanum.jugularis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 134, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 39, 39)) @@ -453,7 +453,7 @@ module julianae { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 39, 39)) virginianus() : durangae { var x : durangae; () => { var y = this; }; return x; } ->virginianus : Symbol(virginianus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 39, 101)) +>virginianus : Symbol(albidens.virginianus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 39, 101)) >durangae : Symbol(durangae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 94, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 40, 34)) >durangae : Symbol(durangae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 94, 3)) @@ -462,7 +462,7 @@ module julianae { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 40, 34)) macrophyllum() : howi.marcanoi { var x : howi.marcanoi; () => { var y = this; }; return x; } ->macrophyllum : Symbol(macrophyllum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 40, 85)) +>macrophyllum : Symbol(albidens.macrophyllum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 40, 85)) >howi : Symbol(howi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 466, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 681, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 886, 1)) >marcanoi : Symbol(howi.marcanoi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 682, 13)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 41, 40)) @@ -473,7 +473,7 @@ module julianae { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 41, 40)) porcellus() : ruatanica.americanus { var x : ruatanica.americanus; () => { var y = this; }; return x; } ->porcellus : Symbol(porcellus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 41, 96)) +>porcellus : Symbol(albidens.porcellus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 41, 96)) >ruatanica : Symbol(ruatanica, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 100, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 244, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 959, 1)) >americanus : Symbol(ruatanica.americanus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 245, 18)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 42, 44)) @@ -492,7 +492,7 @@ module julianae { >psilurus : Symbol(caurinus.psilurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1008, 17)) cepapi() : caurinus.psilurus { var x : caurinus.psilurus; () => { var y = this; }; return x; } ->cepapi : Symbol(cepapi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 44, 57)) +>cepapi : Symbol(oralis.cepapi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 44, 57)) >caurinus : Symbol(caurinus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 449, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 836, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 976, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1007, 1)) >psilurus : Symbol(caurinus.psilurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1008, 17)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 45, 38)) @@ -503,7 +503,7 @@ module julianae { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 45, 38)) porteri() : lavali.thaeleri { var x : lavali.thaeleri; () => { var y = this; }; return x; } ->porteri : Symbol(porteri, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 45, 98)) +>porteri : Symbol(oralis.porteri, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 45, 98)) >lavali : Symbol(lavali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 252, 1)) >thaeleri : Symbol(lavali.thaeleri, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 299, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 46, 37)) @@ -514,7 +514,7 @@ module julianae { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 46, 37)) bindi() : caurinus.mahaganus> { var x : caurinus.mahaganus>; () => { var y = this; }; return x; } ->bindi : Symbol(bindi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 46, 95)) +>bindi : Symbol(oralis.bindi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 46, 95)) >caurinus : Symbol(caurinus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 449, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 836, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 976, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1007, 1)) >mahaganus : Symbol(caurinus.mahaganus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 450, 17)) >gabriellae : Symbol(gabriellae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 766, 1)) @@ -541,7 +541,7 @@ module julianae { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 47, 119)) puda() : sagitta.stolzmanni { var x : sagitta.stolzmanni; () => { var y = this; }; return x; } ->puda : Symbol(puda, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 47, 261)) +>puda : Symbol(oralis.puda, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 47, 261)) >sagitta : Symbol(sagitta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 487, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 577, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 675, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 746, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 898, 1)) >stolzmanni : Symbol(sagitta.stolzmanni, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 899, 16)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 48, 37)) @@ -552,7 +552,7 @@ module julianae { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 48, 37)) mindorensis() : trivirgatus.falconeri { var x : trivirgatus.falconeri; () => { var y = this; }; return x; } ->mindorensis : Symbol(mindorensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 48, 98)) +>mindorensis : Symbol(oralis.mindorensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 48, 98)) >trivirgatus : Symbol(trivirgatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 186, 1)) >falconeri : Symbol(trivirgatus.falconeri, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 210, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 49, 47)) @@ -563,7 +563,7 @@ module julianae { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 49, 47)) ignitus() : petrophilus.rosalia, lavali.wilsoni> { var x : petrophilus.rosalia, lavali.wilsoni>; () => { var y = this; }; return x; } ->ignitus : Symbol(ignitus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 49, 111)) +>ignitus : Symbol(oralis.ignitus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 49, 111)) >petrophilus : Symbol(petrophilus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 715, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 823, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 998, 1)) >rosalia : Symbol(petrophilus.rosalia, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 999, 20)) >panamensis : Symbol(panamensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 501, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 986, 1)) @@ -588,7 +588,7 @@ module julianae { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 50, 110)) rufus() : nudicaudus { var x : nudicaudus; () => { var y = this; }; return x; } ->rufus : Symbol(rufus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 50, 241)) +>rufus : Symbol(oralis.rufus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 50, 241)) >nudicaudus : Symbol(nudicaudus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 18, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 51, 30)) >nudicaudus : Symbol(nudicaudus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 18, 3)) @@ -597,7 +597,7 @@ module julianae { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 51, 30)) monax() : imperfecta.subspinosus { var x : imperfecta.subspinosus; () => { var y = this; }; return x; } ->monax : Symbol(monax, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 51, 83)) +>monax : Symbol(oralis.monax, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 51, 83)) >imperfecta : Symbol(imperfecta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 785, 1)) >subspinosus : Symbol(imperfecta.subspinosus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 794, 5)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 52, 42)) @@ -608,7 +608,7 @@ module julianae { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 52, 42)) unalascensis() : minutus.inez, gabriellae.echinatus>, dogramacii.aurata> { var x : minutus.inez, gabriellae.echinatus>, dogramacii.aurata>; () => { var y = this; }; return x; } ->unalascensis : Symbol(unalascensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 52, 107)) +>unalascensis : Symbol(oralis.unalascensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 52, 107)) >minutus : Symbol(minutus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 433, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 492, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 848, 1)) >inez : Symbol(minutus.inez, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 493, 16)) >rendalli : Symbol(rendalli, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 151, 1)) @@ -643,7 +643,7 @@ module julianae { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 53, 160)) wuchihensis() : howi.angulatus, petrophilus.minutilla> { var x : howi.angulatus, petrophilus.minutilla>; () => { var y = this; }; return x; } ->wuchihensis : Symbol(wuchihensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 53, 336)) +>wuchihensis : Symbol(oralis.wuchihensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 53, 336)) >howi : Symbol(howi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 466, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 681, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 886, 1)) >angulatus : Symbol(howi.angulatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 467, 13)) >howi : Symbol(howi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 466, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 681, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 886, 1)) @@ -670,7 +670,7 @@ module julianae { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 54, 123)) leucippe() : lavali.otion { var x : lavali.otion; () => { var y = this; }; return x; } ->leucippe : Symbol(leucippe, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 54, 263)) +>leucippe : Symbol(oralis.leucippe, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 54, 263)) >lavali : Symbol(lavali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 252, 1)) >otion : Symbol(lavali.otion, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 270, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 55, 35)) @@ -681,7 +681,7 @@ module julianae { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 55, 35)) ordii() : daubentonii.arboreus { var x : daubentonii.arboreus; () => { var y = this; }; return x; } ->ordii : Symbol(ordii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 55, 90)) +>ordii : Symbol(oralis.ordii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 55, 90)) >daubentonii : Symbol(daubentonii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 471, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 586, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 636, 1)) >arboreus : Symbol(daubentonii.arboreus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 637, 20)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) @@ -700,7 +700,7 @@ module julianae { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 56, 78)) eisentrauti() : rendalli.zuluensis { var x : rendalli.zuluensis; () => { var y = this; }; return x; } ->eisentrauti : Symbol(eisentrauti, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 56, 179)) +>eisentrauti : Symbol(oralis.eisentrauti, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 56, 179)) >rendalli : Symbol(rendalli, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 151, 1)) >zuluensis : Symbol(rendalli.zuluensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 152, 17)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 57, 44)) @@ -717,7 +717,7 @@ module julianae { >jugularis : Symbol(Lanthanum.jugularis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 134, 3)) wolffsohni() : Lanthanum.suillus { var x : Lanthanum.suillus; () => { var y = this; }; return x; } ->wolffsohni : Symbol(wolffsohni, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 59, 54)) +>wolffsohni : Symbol(sumatrana.wolffsohni, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 59, 54)) >Lanthanum : Symbol(Lanthanum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 106, 1)) >suillus : Symbol(Lanthanum.suillus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 107, 18)) >dammermani : Symbol(dammermani, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 591, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 913, 1)) @@ -736,7 +736,7 @@ module julianae { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 60, 87)) geata() : ruatanica.hector { var x : ruatanica.hector; () => { var y = this; }; return x; } ->geata : Symbol(geata, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 60, 192)) +>geata : Symbol(sumatrana.geata, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 60, 192)) >ruatanica : Symbol(ruatanica, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 100, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 244, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 959, 1)) >hector : Symbol(ruatanica.hector, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 101, 18)) >sumatrana : Symbol(sumatrana, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 58, 3)) @@ -753,7 +753,7 @@ module julianae { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 61, 69)) awashensis() : petrophilus.minutilla { var x : petrophilus.minutilla; () => { var y = this; }; return x; } ->awashensis : Symbol(awashensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 61, 161)) +>awashensis : Symbol(sumatrana.awashensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 61, 161)) >petrophilus : Symbol(petrophilus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 715, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 823, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 998, 1)) >minutilla : Symbol(petrophilus.minutilla, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 716, 20)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 62, 46)) @@ -764,7 +764,7 @@ module julianae { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 62, 46)) sturdeei() : lutreolus.cor { var x : lutreolus.cor; () => { var y = this; }; return x; } ->sturdeei : Symbol(sturdeei, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 62, 110)) +>sturdeei : Symbol(sumatrana.sturdeei, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 62, 110)) >lutreolus : Symbol(lutreolus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 355, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 719, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 855, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 872, 1)) >cor : Symbol(lutreolus.cor, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 873, 18)) >Lanthanum : Symbol(Lanthanum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 106, 1)) @@ -781,7 +781,7 @@ module julianae { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 63, 72)) pachyurus() : howi.angulatus> { var x : howi.angulatus>; () => { var y = this; }; return x; } ->pachyurus : Symbol(pachyurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 63, 164)) +>pachyurus : Symbol(sumatrana.pachyurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 63, 164)) >howi : Symbol(howi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 466, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 681, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 886, 1)) >angulatus : Symbol(howi.angulatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 467, 13)) >dogramacii : Symbol(dogramacii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 314, 1)) @@ -806,7 +806,7 @@ module julianae { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 64, 109)) lyelli() : provocax.melanoleuca { var x : provocax.melanoleuca; () => { var y = this; }; return x; } ->lyelli : Symbol(lyelli, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 64, 237)) +>lyelli : Symbol(sumatrana.lyelli, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 64, 237)) >provocax : Symbol(provocax, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 669, 1)) >melanoleuca : Symbol(provocax.melanoleuca, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 670, 17)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 65, 41)) @@ -817,7 +817,7 @@ module julianae { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 65, 41)) neohibernicus() : dammermani.siberu { var x : dammermani.siberu; () => { var y = this; }; return x; } ->neohibernicus : Symbol(neohibernicus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 65, 104)) +>neohibernicus : Symbol(sumatrana.neohibernicus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 65, 104)) >dammermani : Symbol(dammermani, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 591, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 913, 1)) >siberu : Symbol(dammermani.siberu, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 592, 19)) >lutreolus : Symbol(lutreolus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 355, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 719, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 855, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 872, 1)) @@ -841,7 +841,7 @@ module julianae { >T1 : Symbol(T1, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 68, 28)) pundti() : sagitta.sicarius { var x : sagitta.sicarius; () => { var y = this; }; return x; } ->pundti : Symbol(pundti, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 68, 34)) +>pundti : Symbol(gerbillus.pundti, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 68, 34)) >sagitta : Symbol(sagitta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 487, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 577, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 675, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 746, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 898, 1)) >sicarius : Symbol(sagitta.sicarius, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 676, 16)) >dogramacii : Symbol(dogramacii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 314, 1)) @@ -860,7 +860,7 @@ module julianae { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 69, 78)) tristrami() : petrophilus.minutilla { var x : petrophilus.minutilla; () => { var y = this; }; return x; } ->tristrami : Symbol(tristrami, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 69, 178)) +>tristrami : Symbol(gerbillus.tristrami, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 69, 178)) >petrophilus : Symbol(petrophilus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 715, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 823, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 998, 1)) >minutilla : Symbol(petrophilus.minutilla, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 716, 20)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 70, 45)) @@ -871,7 +871,7 @@ module julianae { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 70, 45)) swarthi() : lutreolus.foina { var x : lutreolus.foina; () => { var y = this; }; return x; } ->swarthi : Symbol(swarthi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 70, 109)) +>swarthi : Symbol(gerbillus.swarthi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 70, 109)) >lutreolus : Symbol(lutreolus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 355, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 719, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 855, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 872, 1)) >foina : Symbol(lutreolus.foina, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 856, 18)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 71, 37)) @@ -882,7 +882,7 @@ module julianae { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 71, 37)) horsfieldii() : trivirgatus.falconeri { var x : trivirgatus.falconeri; () => { var y = this; }; return x; } ->horsfieldii : Symbol(horsfieldii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 71, 95)) +>horsfieldii : Symbol(gerbillus.horsfieldii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 71, 95)) >trivirgatus : Symbol(trivirgatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 186, 1)) >falconeri : Symbol(trivirgatus.falconeri, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 210, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 72, 47)) @@ -893,7 +893,7 @@ module julianae { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 72, 47)) diazi() : imperfecta.lasiurus { var x : imperfecta.lasiurus; () => { var y = this; }; return x; } ->diazi : Symbol(diazi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 72, 111)) +>diazi : Symbol(gerbillus.diazi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 72, 111)) >imperfecta : Symbol(imperfecta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 785, 1)) >lasiurus : Symbol(imperfecta.lasiurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 786, 19)) >lutreolus : Symbol(lutreolus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 355, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 719, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 855, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 872, 1)) @@ -912,7 +912,7 @@ module julianae { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 73, 77)) rennelli() : argurus.luctuosa { var x : argurus.luctuosa; () => { var y = this; }; return x; } ->rennelli : Symbol(rennelli, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 73, 177)) +>rennelli : Symbol(gerbillus.rennelli, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 73, 177)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) >luctuosa : Symbol(argurus.luctuosa, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 982, 16)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 74, 39)) @@ -923,7 +923,7 @@ module julianae { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 74, 39)) maulinus() : lavali.lepturus { var x : lavali.lepturus; () => { var y = this; }; return x; } ->maulinus : Symbol(maulinus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 74, 98)) +>maulinus : Symbol(gerbillus.maulinus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 74, 98)) >lavali : Symbol(lavali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 252, 1)) >lepturus : Symbol(lavali.lepturus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 309, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 75, 38)) @@ -934,7 +934,7 @@ module julianae { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 75, 38)) muscina() : daubentonii.arboreus { var x : daubentonii.arboreus; () => { var y = this; }; return x; } ->muscina : Symbol(muscina, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 75, 96)) +>muscina : Symbol(gerbillus.muscina, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 75, 96)) >daubentonii : Symbol(daubentonii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 471, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 586, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 636, 1)) >arboreus : Symbol(daubentonii.arboreus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 637, 20)) >petrophilus : Symbol(petrophilus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 715, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 823, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 998, 1)) @@ -953,7 +953,7 @@ module julianae { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 76, 85)) pelengensis() : sagitta.leptoceros { var x : sagitta.leptoceros; () => { var y = this; }; return x; } ->pelengensis : Symbol(pelengensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 76, 191)) +>pelengensis : Symbol(gerbillus.pelengensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 76, 191)) >sagitta : Symbol(sagitta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 487, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 577, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 675, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 746, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 898, 1)) >leptoceros : Symbol(sagitta.leptoceros, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 578, 16)) >caurinus : Symbol(caurinus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 449, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 836, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 976, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1007, 1)) @@ -972,7 +972,7 @@ module julianae { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 77, 85)) abramus() : lavali.thaeleri { var x : lavali.thaeleri; () => { var y = this; }; return x; } ->abramus : Symbol(abramus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 77, 187)) +>abramus : Symbol(gerbillus.abramus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 77, 187)) >lavali : Symbol(lavali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 252, 1)) >thaeleri : Symbol(lavali.thaeleri, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 299, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 78, 37)) @@ -983,7 +983,7 @@ module julianae { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 78, 37)) reevesi() : provocax.melanoleuca { var x : provocax.melanoleuca; () => { var y = this; }; return x; } ->reevesi : Symbol(reevesi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 78, 95)) +>reevesi : Symbol(gerbillus.reevesi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 78, 95)) >provocax : Symbol(provocax, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 669, 1)) >melanoleuca : Symbol(provocax.melanoleuca, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 670, 17)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 79, 42)) @@ -997,7 +997,7 @@ module julianae { >acariensis : Symbol(acariensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 80, 3)) levicula() : lavali.lepturus { var x : lavali.lepturus; () => { var y = this; }; return x; } ->levicula : Symbol(levicula, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 81, 27)) +>levicula : Symbol(acariensis.levicula, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 81, 27)) >lavali : Symbol(lavali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 252, 1)) >lepturus : Symbol(lavali.lepturus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 309, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 82, 38)) @@ -1008,7 +1008,7 @@ module julianae { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 82, 38)) minous() : argurus.dauricus { var x : argurus.dauricus; () => { var y = this; }; return x; } ->minous : Symbol(minous, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 82, 96)) +>minous : Symbol(acariensis.minous, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 82, 96)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) >dauricus : Symbol(argurus.dauricus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 374, 16)) >quasiater : Symbol(quasiater, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 236, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 422, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 813, 1)) @@ -1027,7 +1027,7 @@ module julianae { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 83, 75)) cinereiventer() : panamensis.setulosus { var x : panamensis.setulosus; () => { var y = this; }; return x; } ->cinereiventer : Symbol(cinereiventer, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 83, 172)) +>cinereiventer : Symbol(acariensis.cinereiventer, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 83, 172)) >panamensis : Symbol(panamensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 501, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 986, 1)) >setulosus : Symbol(panamensis.setulosus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 987, 19)) >sagitta : Symbol(sagitta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 487, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 577, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 675, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 746, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 898, 1)) @@ -1046,7 +1046,7 @@ module julianae { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 84, 79)) longicaudatus() : macrorhinos.marmosurus> { var x : macrorhinos.marmosurus>; () => { var y = this; }; return x; } ->longicaudatus : Symbol(longicaudatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 84, 173)) +>longicaudatus : Symbol(acariensis.longicaudatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 84, 173)) >macrorhinos : Symbol(macrorhinos, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 461, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 497, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 736, 1)) >marmosurus : Symbol(macrorhinos.marmosurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 462, 20)) >dammermani : Symbol(dammermani, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 591, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 913, 1)) @@ -1071,7 +1071,7 @@ module julianae { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 85, 117)) baeodon() : argurus.netscheri, argurus.luctuosa> { var x : argurus.netscheri, argurus.luctuosa>; () => { var y = this; }; return x; } ->baeodon : Symbol(baeodon, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 85, 249)) +>baeodon : Symbol(acariensis.baeodon, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 85, 249)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) >netscheri : Symbol(argurus.netscheri, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 943, 16)) >dammermani : Symbol(dammermani, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 591, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 913, 1)) @@ -1098,7 +1098,7 @@ module julianae { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 86, 114)) soricoides() : argurus.luctuosa { var x : argurus.luctuosa; () => { var y = this; }; return x; } ->soricoides : Symbol(soricoides, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 86, 249)) +>soricoides : Symbol(acariensis.soricoides, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 86, 249)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) >luctuosa : Symbol(argurus.luctuosa, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 982, 16)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 87, 41)) @@ -1109,7 +1109,7 @@ module julianae { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 87, 41)) datae() : daubentonii.arboreus> { var x : daubentonii.arboreus>; () => { var y = this; }; return x; } ->datae : Symbol(datae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 87, 100)) +>datae : Symbol(acariensis.datae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 87, 100)) >daubentonii : Symbol(daubentonii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 471, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 586, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 636, 1)) >arboreus : Symbol(daubentonii.arboreus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 637, 20)) >provocax : Symbol(provocax, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 669, 1)) @@ -1136,7 +1136,7 @@ module julianae { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 88, 124)) spixii() : imperfecta.subspinosus { var x : imperfecta.subspinosus; () => { var y = this; }; return x; } ->spixii : Symbol(spixii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 88, 271)) +>spixii : Symbol(acariensis.spixii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 88, 271)) >imperfecta : Symbol(imperfecta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 785, 1)) >subspinosus : Symbol(imperfecta.subspinosus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 794, 5)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 89, 43)) @@ -1147,7 +1147,7 @@ module julianae { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 89, 43)) anakuma() : lavali.wilsoni { var x : lavali.wilsoni; () => { var y = this; }; return x; } ->anakuma : Symbol(anakuma, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 89, 108)) +>anakuma : Symbol(acariensis.anakuma, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 89, 108)) >lavali : Symbol(lavali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 252, 1)) >wilsoni : Symbol(lavali.wilsoni, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 253, 15)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 90, 36)) @@ -1158,7 +1158,7 @@ module julianae { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 90, 36)) kihaulei() : panglima.amphibius { var x : panglima.amphibius; () => { var y = this; }; return x; } ->kihaulei : Symbol(kihaulei, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 90, 93)) +>kihaulei : Symbol(acariensis.kihaulei, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 90, 93)) >panglima : Symbol(panglima, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 400, 1)) >amphibius : Symbol(panglima.amphibius, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 401, 17)) >trivirgatus : Symbol(trivirgatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 186, 1)) @@ -1177,7 +1177,7 @@ module julianae { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 91, 89)) gymnura() : quasiater.carolinensis { var x : quasiater.carolinensis; () => { var y = this; }; return x; } ->gymnura : Symbol(gymnura, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 91, 198)) +>gymnura : Symbol(acariensis.gymnura, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 91, 198)) >quasiater : Symbol(quasiater, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 236, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 422, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 813, 1)) >carolinensis : Symbol(quasiater.carolinensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 423, 18)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 92, 44)) @@ -1188,7 +1188,7 @@ module julianae { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 92, 44)) olchonensis() : rendalli.crenulata { var x : rendalli.crenulata; () => { var y = this; }; return x; } ->olchonensis : Symbol(olchonensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 92, 109)) +>olchonensis : Symbol(acariensis.olchonensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 92, 109)) >rendalli : Symbol(rendalli, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 151, 1)) >crenulata : Symbol(rendalli.crenulata, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 180, 3)) >trivirgatus : Symbol(trivirgatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 186, 1)) @@ -1213,7 +1213,7 @@ module julianae { >aurata : Symbol(dogramacii.aurata, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 344, 3)) Californium() : panamensis.setulosus { var x : panamensis.setulosus; () => { var y = this; }; return x; } ->Californium : Symbol(Californium, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 95, 51)) +>Californium : Symbol(durangae.Californium, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 95, 51)) >panamensis : Symbol(panamensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 501, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 986, 1)) >setulosus : Symbol(panamensis.setulosus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 987, 19)) >lutreolus : Symbol(lutreolus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 355, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 719, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 855, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 872, 1)) @@ -1232,7 +1232,7 @@ module julianae { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 96, 86)) Flerovium() : howi.angulatus { var x : howi.angulatus; () => { var y = this; }; return x; } ->Flerovium : Symbol(Flerovium, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 96, 189)) +>Flerovium : Symbol(durangae.Flerovium, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 96, 189)) >howi : Symbol(howi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 466, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 681, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 886, 1)) >angulatus : Symbol(howi.angulatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 467, 13)) >petrophilus : Symbol(petrophilus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 715, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 823, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 998, 1)) @@ -1251,7 +1251,7 @@ module julianae { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 97, 83)) phrudus() : sagitta.stolzmanni { var x : sagitta.stolzmanni; () => { var y = this; }; return x; } ->phrudus : Symbol(phrudus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 97, 185)) +>phrudus : Symbol(durangae.phrudus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 97, 185)) >sagitta : Symbol(sagitta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 487, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 577, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 675, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 746, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 898, 1)) >stolzmanni : Symbol(sagitta.stolzmanni, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 899, 16)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 98, 40)) @@ -1271,7 +1271,7 @@ module ruatanica { >T1 : Symbol(T1, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 102, 25)) humulis() : julianae.steerii { var x : julianae.steerii; () => { var y = this; }; return x; } ->humulis : Symbol(humulis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 102, 31)) +>humulis : Symbol(hector.humulis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 102, 31)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) >steerii : Symbol(julianae.steerii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 16, 17)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 103, 38)) @@ -1282,7 +1282,7 @@ module ruatanica { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 103, 38)) eurycerus() : panamensis.linulus, lavali.wilsoni> { var x : panamensis.linulus, lavali.wilsoni>; () => { var y = this; }; return x; } ->eurycerus : Symbol(eurycerus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 103, 97)) +>eurycerus : Symbol(hector.eurycerus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 103, 97)) >panamensis : Symbol(panamensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 501, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 986, 1)) >linulus : Symbol(panamensis.linulus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 502, 19)) >ruatanica : Symbol(ruatanica, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 100, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 244, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 959, 1)) @@ -1318,7 +1318,7 @@ module Lanthanum { >T1 : Symbol(T1, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 108, 26)) spilosoma() : quasiater.carolinensis { var x : quasiater.carolinensis; () => { var y = this; }; return x; } ->spilosoma : Symbol(spilosoma, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 108, 32)) +>spilosoma : Symbol(suillus.spilosoma, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 108, 32)) >quasiater : Symbol(quasiater, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 236, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 422, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 813, 1)) >carolinensis : Symbol(quasiater.carolinensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 423, 18)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 109, 46)) @@ -1329,7 +1329,7 @@ module Lanthanum { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 109, 46)) tumbalensis() : caurinus.megaphyllus { var x : caurinus.megaphyllus; () => { var y = this; }; return x; } ->tumbalensis : Symbol(tumbalensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 109, 111)) +>tumbalensis : Symbol(suillus.tumbalensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 109, 111)) >caurinus : Symbol(caurinus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 449, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 836, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 976, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1007, 1)) >megaphyllus : Symbol(caurinus.megaphyllus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 837, 17)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 110, 46)) @@ -1340,7 +1340,7 @@ module Lanthanum { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 110, 46)) anatolicus() : julianae.steerii { var x : julianae.steerii; () => { var y = this; }; return x; } ->anatolicus : Symbol(anatolicus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 110, 109)) +>anatolicus : Symbol(suillus.anatolicus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 110, 109)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) >steerii : Symbol(julianae.steerii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 16, 17)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 111, 41)) @@ -1363,7 +1363,7 @@ module Lanthanum { >punicus : Symbol(lutreolus.punicus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 720, 18)) granatensis() : quasiater.bobrinskoi { var x : quasiater.bobrinskoi; () => { var y = this; }; return x; } ->granatensis : Symbol(granatensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 113, 94)) +>granatensis : Symbol(nitidus.granatensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 113, 94)) >quasiater : Symbol(quasiater, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 236, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 422, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 813, 1)) >bobrinskoi : Symbol(quasiater.bobrinskoi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 237, 18)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 114, 46)) @@ -1374,7 +1374,7 @@ module Lanthanum { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 114, 46)) negligens() : minutus.inez { var x : minutus.inez; () => { var y = this; }; return x; } ->negligens : Symbol(negligens, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 114, 109)) +>negligens : Symbol(nitidus.negligens, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 114, 109)) >minutus : Symbol(minutus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 433, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 492, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 848, 1)) >inez : Symbol(minutus.inez, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 493, 16)) >lavali : Symbol(lavali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 252, 1)) @@ -1393,7 +1393,7 @@ module Lanthanum { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 115, 68)) lewisi() : julianae.oralis { var x : julianae.oralis; () => { var y = this; }; return x; } ->lewisi : Symbol(lewisi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 115, 155)) +>lewisi : Symbol(nitidus.lewisi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 115, 155)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) >oralis : Symbol(julianae.oralis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 43, 3)) >lavali : Symbol(lavali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 252, 1)) @@ -1412,7 +1412,7 @@ module Lanthanum { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 116, 73)) arge() : chrysaeolus.sarasinorum { var x : chrysaeolus.sarasinorum; () => { var y = this; }; return x; } ->arge : Symbol(arge, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 116, 168)) +>arge : Symbol(nitidus.arge, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 116, 168)) >chrysaeolus : Symbol(chrysaeolus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 602, 1)) >sarasinorum : Symbol(chrysaeolus.sarasinorum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 603, 20)) >caurinus : Symbol(caurinus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 449, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 836, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 976, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1007, 1)) @@ -1431,7 +1431,7 @@ module Lanthanum { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 117, 86)) dominicensis() : dammermani.melanops { var x : dammermani.melanops; () => { var y = this; }; return x; } ->dominicensis : Symbol(dominicensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 117, 196)) +>dominicensis : Symbol(nitidus.dominicensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 117, 196)) >dammermani : Symbol(dammermani, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 591, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 913, 1)) >melanops : Symbol(dammermani.melanops, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 914, 19)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 118, 46)) @@ -1442,7 +1442,7 @@ module Lanthanum { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 118, 46)) taurus() : macrorhinos.konganensis { var x : macrorhinos.konganensis; () => { var y = this; }; return x; } ->taurus : Symbol(taurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 118, 108)) +>taurus : Symbol(nitidus.taurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 118, 108)) >macrorhinos : Symbol(macrorhinos, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 461, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 497, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 736, 1)) >konganensis : Symbol(macrorhinos.konganensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 498, 20)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 119, 44)) @@ -1453,7 +1453,7 @@ module Lanthanum { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 119, 44)) tonganus() : argurus.netscheri { var x : argurus.netscheri; () => { var y = this; }; return x; } ->tonganus : Symbol(tonganus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 119, 110)) +>tonganus : Symbol(nitidus.tonganus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 119, 110)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) >netscheri : Symbol(argurus.netscheri, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 943, 16)) >dogramacii : Symbol(dogramacii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 314, 1)) @@ -1472,7 +1472,7 @@ module Lanthanum { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 120, 78)) silvatica() : rendalli.moojeni { var x : rendalli.moojeni; () => { var y = this; }; return x; } ->silvatica : Symbol(silvatica, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 120, 176)) +>silvatica : Symbol(nitidus.silvatica, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 120, 176)) >rendalli : Symbol(rendalli, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 151, 1)) >moojeni : Symbol(rendalli.moojeni, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 168, 3)) >dogramacii : Symbol(dogramacii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 314, 1)) @@ -1491,7 +1491,7 @@ module Lanthanum { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 121, 73)) midas() : lavali.xanthognathus { var x : lavali.xanthognathus; () => { var y = this; }; return x; } ->midas : Symbol(midas, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 121, 165)) +>midas : Symbol(nitidus.midas, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 121, 165)) >lavali : Symbol(lavali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 252, 1)) >xanthognathus : Symbol(lavali.xanthognathus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 285, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 122, 40)) @@ -1502,7 +1502,7 @@ module Lanthanum { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 122, 40)) bicornis() : dogramacii.kaiseri { var x : dogramacii.kaiseri; () => { var y = this; }; return x; } ->bicornis : Symbol(bicornis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 122, 103)) +>bicornis : Symbol(nitidus.bicornis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 122, 103)) >dogramacii : Symbol(dogramacii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 314, 1)) >kaiseri : Symbol(dogramacii.kaiseri, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 329, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 123, 41)) @@ -1523,7 +1523,7 @@ module Lanthanum { >steerii : Symbol(julianae.steerii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 16, 17)) phillipsii() : macrorhinos.konganensis { var x : macrorhinos.konganensis; () => { var y = this; }; return x; } ->phillipsii : Symbol(phillipsii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 125, 94)) +>phillipsii : Symbol(megalonyx.phillipsii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 125, 94)) >macrorhinos : Symbol(macrorhinos, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 461, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 497, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 736, 1)) >konganensis : Symbol(macrorhinos.konganensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 498, 20)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 126, 48)) @@ -1534,7 +1534,7 @@ module Lanthanum { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 126, 48)) melanogaster() : rionegrensis.veraecrucis { var x : rionegrensis.veraecrucis; () => { var y = this; }; return x; } ->melanogaster : Symbol(melanogaster, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 126, 114)) +>melanogaster : Symbol(megalonyx.melanogaster, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 126, 114)) >rionegrensis : Symbol(rionegrensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 0, 0)) >veraecrucis : Symbol(rionegrensis.veraecrucis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 7, 3)) >trivirgatus : Symbol(trivirgatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 186, 1)) @@ -1553,7 +1553,7 @@ module Lanthanum { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 127, 98)) elaphus() : nitidus { var x : nitidus; () => { var y = this; }; return x; } ->elaphus : Symbol(elaphus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 127, 212)) +>elaphus : Symbol(megalonyx.elaphus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 127, 212)) >nitidus : Symbol(nitidus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 112, 3)) >petrophilus : Symbol(petrophilus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 715, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 823, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 998, 1)) >minutilla : Symbol(petrophilus.minutilla, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 716, 20)) @@ -1570,7 +1570,7 @@ module Lanthanum { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 128, 72)) elater() : lavali.lepturus { var x : lavali.lepturus; () => { var y = this; }; return x; } ->elater : Symbol(elater, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 128, 165)) +>elater : Symbol(megalonyx.elater, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 128, 165)) >lavali : Symbol(lavali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 252, 1)) >lepturus : Symbol(lavali.lepturus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 309, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 129, 36)) @@ -1581,7 +1581,7 @@ module Lanthanum { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 129, 36)) ourebi() : provocax.melanoleuca { var x : provocax.melanoleuca; () => { var y = this; }; return x; } ->ourebi : Symbol(ourebi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 129, 94)) +>ourebi : Symbol(megalonyx.ourebi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 129, 94)) >provocax : Symbol(provocax, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 669, 1)) >melanoleuca : Symbol(provocax.melanoleuca, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 670, 17)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 130, 41)) @@ -1592,7 +1592,7 @@ module Lanthanum { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 130, 41)) caraccioli() : imperfecta.ciliolabrum> { var x : imperfecta.ciliolabrum>; () => { var y = this; }; return x; } ->caraccioli : Symbol(caraccioli, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 130, 104)) +>caraccioli : Symbol(megalonyx.caraccioli, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 130, 104)) >imperfecta : Symbol(imperfecta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 785, 1)) >ciliolabrum : Symbol(imperfecta.ciliolabrum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 807, 5)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) @@ -1619,7 +1619,7 @@ module Lanthanum { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 131, 130)) parva() : gabriellae.echinatus { var x : gabriellae.echinatus; () => { var y = this; }; return x; } ->parva : Symbol(parva, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 131, 278)) +>parva : Symbol(megalonyx.parva, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 131, 278)) >gabriellae : Symbol(gabriellae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 766, 1)) >echinatus : Symbol(gabriellae.echinatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 781, 5)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 132, 40)) @@ -1630,7 +1630,7 @@ module Lanthanum { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 132, 40)) albipes() : quasiater.wattsi { var x : quasiater.wattsi; () => { var y = this; }; return x; } ->albipes : Symbol(albipes, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 132, 103)) +>albipes : Symbol(megalonyx.albipes, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 132, 103)) >quasiater : Symbol(quasiater, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 236, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 422, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 813, 1)) >wattsi : Symbol(quasiater.wattsi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 814, 18)) >dammermani : Symbol(dammermani, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 591, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 913, 1)) @@ -1650,7 +1650,7 @@ module Lanthanum { >jugularis : Symbol(jugularis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 134, 3)) torrei() : petrophilus.sodyi { var x : petrophilus.sodyi; () => { var y = this; }; return x; } ->torrei : Symbol(torrei, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 135, 26)) +>torrei : Symbol(jugularis.torrei, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 135, 26)) >petrophilus : Symbol(petrophilus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 715, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 823, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 998, 1)) >sodyi : Symbol(petrophilus.sodyi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 824, 20)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) @@ -1669,7 +1669,7 @@ module Lanthanum { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 136, 78)) revoili() : lavali.wilsoni { var x : lavali.wilsoni; () => { var y = this; }; return x; } ->revoili : Symbol(revoili, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 136, 178)) +>revoili : Symbol(jugularis.revoili, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 136, 178)) >lavali : Symbol(lavali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 252, 1)) >wilsoni : Symbol(lavali.wilsoni, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 253, 15)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 137, 36)) @@ -1680,7 +1680,7 @@ module Lanthanum { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 137, 36)) macrobullatus() : macrorhinos.daphaenodon { var x : macrorhinos.daphaenodon; () => { var y = this; }; return x; } ->macrobullatus : Symbol(macrobullatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 137, 93)) +>macrobullatus : Symbol(jugularis.macrobullatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 137, 93)) >macrorhinos : Symbol(macrorhinos, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 461, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 497, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 736, 1)) >daphaenodon : Symbol(macrorhinos.daphaenodon, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 737, 20)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 138, 51)) @@ -1691,7 +1691,7 @@ module Lanthanum { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 138, 51)) compactus() : sagitta.stolzmanni { var x : sagitta.stolzmanni; () => { var y = this; }; return x; } ->compactus : Symbol(compactus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 138, 117)) +>compactus : Symbol(jugularis.compactus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 138, 117)) >sagitta : Symbol(sagitta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 487, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 577, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 675, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 746, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 898, 1)) >stolzmanni : Symbol(sagitta.stolzmanni, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 899, 16)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 139, 42)) @@ -1702,7 +1702,7 @@ module Lanthanum { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 139, 42)) talpinus() : nitidus { var x : nitidus; () => { var y = this; }; return x; } ->talpinus : Symbol(talpinus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 139, 103)) +>talpinus : Symbol(jugularis.talpinus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 139, 103)) >nitidus : Symbol(nitidus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 112, 3)) >ruatanica : Symbol(ruatanica, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 100, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 244, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 959, 1)) >americanus : Symbol(ruatanica.americanus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 245, 18)) @@ -1719,7 +1719,7 @@ module Lanthanum { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 140, 72)) stramineus() : gabriellae.amicus { var x : gabriellae.amicus; () => { var y = this; }; return x; } ->stramineus : Symbol(stramineus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 140, 164)) +>stramineus : Symbol(jugularis.stramineus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 140, 164)) >gabriellae : Symbol(gabriellae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 766, 1)) >amicus : Symbol(gabriellae.amicus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 769, 5)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 141, 42)) @@ -1730,7 +1730,7 @@ module Lanthanum { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 141, 42)) dartmouthi() : trivirgatus.mixtus { var x : trivirgatus.mixtus; () => { var y = this; }; return x; } ->dartmouthi : Symbol(dartmouthi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 141, 102)) +>dartmouthi : Symbol(jugularis.dartmouthi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 141, 102)) >trivirgatus : Symbol(trivirgatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 186, 1)) >mixtus : Symbol(trivirgatus.mixtus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 197, 3)) >macrorhinos : Symbol(macrorhinos, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 461, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 497, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 736, 1)) @@ -1749,7 +1749,7 @@ module Lanthanum { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 142, 86)) ogilbyi() : argurus.dauricus { var x : argurus.dauricus; () => { var y = this; }; return x; } ->ogilbyi : Symbol(ogilbyi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 142, 190)) +>ogilbyi : Symbol(jugularis.ogilbyi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 142, 190)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) >dauricus : Symbol(argurus.dauricus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 374, 16)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) @@ -1768,7 +1768,7 @@ module Lanthanum { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 143, 77)) incomtus() : daubentonii.nesiotes { var x : daubentonii.nesiotes; () => { var y = this; }; return x; } ->incomtus : Symbol(incomtus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 143, 175)) +>incomtus : Symbol(jugularis.incomtus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 143, 175)) >daubentonii : Symbol(daubentonii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 471, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 586, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 636, 1)) >nesiotes : Symbol(daubentonii.nesiotes, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 472, 20)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) @@ -1787,7 +1787,7 @@ module Lanthanum { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 144, 87)) surdaster() : ruatanica.Praseodymium { var x : ruatanica.Praseodymium; () => { var y = this; }; return x; } ->surdaster : Symbol(surdaster, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 144, 194)) +>surdaster : Symbol(jugularis.surdaster, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 144, 194)) >ruatanica : Symbol(ruatanica, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 100, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 244, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 959, 1)) >Praseodymium : Symbol(ruatanica.Praseodymium, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 960, 18)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) @@ -1806,7 +1806,7 @@ module Lanthanum { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 145, 86)) melanorhinus() : samarensis.pelurus { var x : samarensis.pelurus; () => { var y = this; }; return x; } ->melanorhinus : Symbol(melanorhinus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 145, 191)) +>melanorhinus : Symbol(jugularis.melanorhinus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 145, 191)) >samarensis : Symbol(samarensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 531, 1)) >pelurus : Symbol(samarensis.pelurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 532, 19)) >dammermani : Symbol(dammermani, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 591, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 913, 1)) @@ -1825,7 +1825,7 @@ module Lanthanum { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 146, 86)) picticaudata() : minutus.inez, dogramacii.kaiseri> { var x : minutus.inez, dogramacii.kaiseri>; () => { var y = this; }; return x; } ->picticaudata : Symbol(picticaudata, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 146, 188)) +>picticaudata : Symbol(jugularis.picticaudata, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 146, 188)) >minutus : Symbol(minutus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 433, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 492, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 848, 1)) >inez : Symbol(minutus.inez, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 493, 16)) >quasiater : Symbol(quasiater, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 236, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 422, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 813, 1)) @@ -1852,7 +1852,7 @@ module Lanthanum { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 147, 118)) pomona() : julianae.steerii { var x : julianae.steerii; () => { var y = this; }; return x; } ->pomona : Symbol(pomona, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 147, 252)) +>pomona : Symbol(jugularis.pomona, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 147, 252)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) >steerii : Symbol(julianae.steerii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 16, 17)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 148, 37)) @@ -1863,7 +1863,7 @@ module Lanthanum { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 148, 37)) ileile() : quasiater.carolinensis { var x : quasiater.carolinensis; () => { var y = this; }; return x; } ->ileile : Symbol(ileile, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 148, 96)) +>ileile : Symbol(jugularis.ileile, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 148, 96)) >quasiater : Symbol(quasiater, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 236, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 422, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 813, 1)) >carolinensis : Symbol(quasiater.carolinensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 423, 18)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 149, 43)) @@ -1884,7 +1884,7 @@ module rendalli { >steerii : Symbol(julianae.steerii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 16, 17)) telfairi() : argurus.wetmorei { var x : argurus.wetmorei; () => { var y = this; }; return x; } ->telfairi : Symbol(telfairi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 153, 51)) +>telfairi : Symbol(zuluensis.telfairi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 153, 51)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) >wetmorei : Symbol(argurus.wetmorei, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 614, 16)) >Lanthanum : Symbol(Lanthanum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 106, 1)) @@ -1903,7 +1903,7 @@ module rendalli { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 154, 82)) keyensis() : quasiater.wattsi { var x : quasiater.wattsi; () => { var y = this; }; return x; } ->keyensis : Symbol(keyensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 154, 184)) +>keyensis : Symbol(zuluensis.keyensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 154, 184)) >quasiater : Symbol(quasiater, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 236, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 422, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 813, 1)) >wattsi : Symbol(quasiater.wattsi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 814, 18)) >quasiater : Symbol(quasiater, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 236, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 422, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 813, 1)) @@ -1922,7 +1922,7 @@ module rendalli { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 155, 80)) occasius() : argurus.gilbertii { var x : argurus.gilbertii; () => { var y = this; }; return x; } ->occasius : Symbol(occasius, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 155, 180)) +>occasius : Symbol(zuluensis.occasius, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 155, 180)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) >gilbertii : Symbol(argurus.gilbertii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 700, 16)) >caurinus : Symbol(caurinus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 449, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 836, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 976, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1007, 1)) @@ -1941,7 +1941,7 @@ module rendalli { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 156, 81)) damarensis() : julianae.galapagoensis { var x : julianae.galapagoensis; () => { var y = this; }; return x; } ->damarensis : Symbol(damarensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 156, 182)) +>damarensis : Symbol(zuluensis.damarensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 156, 182)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) >galapagoensis : Symbol(julianae.galapagoensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 25, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 157, 47)) @@ -1952,7 +1952,7 @@ module rendalli { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 157, 47)) Neptunium() : panglima.abidi { var x : panglima.abidi; () => { var y = this; }; return x; } ->Neptunium : Symbol(Neptunium, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 157, 112)) +>Neptunium : Symbol(zuluensis.Neptunium, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 157, 112)) >panglima : Symbol(panglima, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 400, 1)) >abidi : Symbol(panglima.abidi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 414, 5)) >dogramacii : Symbol(dogramacii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 314, 1)) @@ -1971,7 +1971,7 @@ module rendalli { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 158, 78)) griseoflavus() : ruatanica.americanus { var x : ruatanica.americanus; () => { var y = this; }; return x; } ->griseoflavus : Symbol(griseoflavus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 158, 175)) +>griseoflavus : Symbol(zuluensis.griseoflavus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 158, 175)) >ruatanica : Symbol(ruatanica, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 100, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 244, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 959, 1)) >americanus : Symbol(ruatanica.americanus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 245, 18)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 159, 47)) @@ -1982,7 +1982,7 @@ module rendalli { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 159, 47)) thar() : argurus.oreas { var x : argurus.oreas; () => { var y = this; }; return x; } ->thar : Symbol(thar, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 159, 110)) +>thar : Symbol(zuluensis.thar, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 159, 110)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) >oreas : Symbol(argurus.oreas, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 625, 16)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 160, 32)) @@ -1993,7 +1993,7 @@ module rendalli { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 160, 32)) alborufus() : panamensis.linulus { var x : panamensis.linulus; () => { var y = this; }; return x; } ->alborufus : Symbol(alborufus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 160, 88)) +>alborufus : Symbol(zuluensis.alborufus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 160, 88)) >panamensis : Symbol(panamensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 501, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 986, 1)) >linulus : Symbol(panamensis.linulus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 502, 19)) >lavali : Symbol(lavali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 252, 1)) @@ -2012,7 +2012,7 @@ module rendalli { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 161, 74)) fusicaudus() : sagitta.stolzmanni { var x : sagitta.stolzmanni; () => { var y = this; }; return x; } ->fusicaudus : Symbol(fusicaudus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 161, 167)) +>fusicaudus : Symbol(zuluensis.fusicaudus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 161, 167)) >sagitta : Symbol(sagitta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 487, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 577, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 675, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 746, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 898, 1)) >stolzmanni : Symbol(sagitta.stolzmanni, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 899, 16)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 162, 43)) @@ -2023,7 +2023,7 @@ module rendalli { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 162, 43)) gordonorum() : howi.angulatus { var x : howi.angulatus; () => { var y = this; }; return x; } ->gordonorum : Symbol(gordonorum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 162, 104)) +>gordonorum : Symbol(zuluensis.gordonorum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 162, 104)) >howi : Symbol(howi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 466, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 681, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 886, 1)) >angulatus : Symbol(howi.angulatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 467, 13)) >ruatanica : Symbol(ruatanica, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 100, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 244, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 959, 1)) @@ -2042,7 +2042,7 @@ module rendalli { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 163, 79)) ruber() : dammermani.siberu { var x : dammermani.siberu; () => { var y = this; }; return x; } ->ruber : Symbol(ruber, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 163, 176)) +>ruber : Symbol(zuluensis.ruber, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 163, 176)) >dammermani : Symbol(dammermani, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 591, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 913, 1)) >siberu : Symbol(dammermani.siberu, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 592, 19)) >lutreolus : Symbol(lutreolus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 355, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 719, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 855, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 872, 1)) @@ -2061,7 +2061,7 @@ module rendalli { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 164, 77)) desmarestianus() : julianae.steerii { var x : julianae.steerii; () => { var y = this; }; return x; } ->desmarestianus : Symbol(desmarestianus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 164, 177)) +>desmarestianus : Symbol(zuluensis.desmarestianus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 164, 177)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) >steerii : Symbol(julianae.steerii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 16, 17)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 165, 45)) @@ -2072,7 +2072,7 @@ module rendalli { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 165, 45)) lutillus() : nigra.dolichurus { var x : nigra.dolichurus; () => { var y = this; }; return x; } ->lutillus : Symbol(lutillus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 165, 104)) +>lutillus : Symbol(zuluensis.lutillus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 165, 104)) >nigra : Symbol(nigra, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 388, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 475, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 514, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 762, 1)) >dolichurus : Symbol(nigra.dolichurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 389, 14)) >howi : Symbol(howi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 466, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 681, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 886, 1)) @@ -2091,7 +2091,7 @@ module rendalli { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 166, 70)) salocco() : argurus.peninsulae { var x : argurus.peninsulae; () => { var y = this; }; return x; } ->salocco : Symbol(salocco, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 166, 160)) +>salocco : Symbol(zuluensis.salocco, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 166, 160)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) >peninsulae : Symbol(argurus.peninsulae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 931, 16)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 167, 40)) @@ -2107,7 +2107,7 @@ module rendalli { >T1 : Symbol(T1, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 169, 26)) floweri() : lavali.otion { var x : lavali.otion; () => { var y = this; }; return x; } ->floweri : Symbol(floweri, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 169, 32)) +>floweri : Symbol(moojeni.floweri, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 169, 32)) >lavali : Symbol(lavali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 252, 1)) >otion : Symbol(lavali.otion, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 270, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 170, 34)) @@ -2118,7 +2118,7 @@ module rendalli { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 170, 34)) montosa() : imperfecta.ciliolabrum { var x : imperfecta.ciliolabrum; () => { var y = this; }; return x; } ->montosa : Symbol(montosa, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 170, 89)) +>montosa : Symbol(moojeni.montosa, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 170, 89)) >imperfecta : Symbol(imperfecta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 785, 1)) >ciliolabrum : Symbol(imperfecta.ciliolabrum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 807, 5)) >Lanthanum : Symbol(Lanthanum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 106, 1)) @@ -2137,7 +2137,7 @@ module rendalli { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 171, 88)) miletus() : julianae.sumatrana { var x : julianae.sumatrana; () => { var y = this; }; return x; } ->miletus : Symbol(miletus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 171, 197)) +>miletus : Symbol(moojeni.miletus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 171, 197)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) >sumatrana : Symbol(julianae.sumatrana, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 58, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 172, 40)) @@ -2148,7 +2148,7 @@ module rendalli { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 172, 40)) heaneyi() : zuluensis { var x : zuluensis; () => { var y = this; }; return x; } ->heaneyi : Symbol(heaneyi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 172, 101)) +>heaneyi : Symbol(moojeni.heaneyi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 172, 101)) >zuluensis : Symbol(zuluensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 152, 17)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 173, 31)) >zuluensis : Symbol(zuluensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 152, 17)) @@ -2157,7 +2157,7 @@ module rendalli { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 173, 31)) marchei() : panglima.amphibius> { var x : panglima.amphibius>; () => { var y = this; }; return x; } ->marchei : Symbol(marchei, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 173, 83)) +>marchei : Symbol(moojeni.marchei, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 173, 83)) >panglima : Symbol(panglima, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 400, 1)) >amphibius : Symbol(panglima.amphibius, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 401, 17)) >patas : Symbol(patas, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 652, 1)) @@ -2184,7 +2184,7 @@ module rendalli { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 174, 117)) budini() : julianae.durangae { var x : julianae.durangae; () => { var y = this; }; return x; } ->budini : Symbol(budini, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 174, 255)) +>budini : Symbol(moojeni.budini, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 174, 255)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) >durangae : Symbol(julianae.durangae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 94, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 175, 38)) @@ -2195,7 +2195,7 @@ module rendalli { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 175, 38)) maggietaylorae() : trivirgatus.mixtus, imperfecta.subspinosus>, sagitta.stolzmanni> { var x : trivirgatus.mixtus, imperfecta.subspinosus>, sagitta.stolzmanni>; () => { var y = this; }; return x; } ->maggietaylorae : Symbol(maggietaylorae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 175, 98)) +>maggietaylorae : Symbol(moojeni.maggietaylorae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 175, 98)) >trivirgatus : Symbol(trivirgatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 186, 1)) >mixtus : Symbol(trivirgatus.mixtus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 197, 3)) >panglima : Symbol(panglima, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 400, 1)) @@ -2230,7 +2230,7 @@ module rendalli { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 176, 173)) poliocephalus() : julianae.gerbillus { var x : julianae.gerbillus; () => { var y = this; }; return x; } ->poliocephalus : Symbol(poliocephalus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 176, 360)) +>poliocephalus : Symbol(moojeni.poliocephalus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 176, 360)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) >gerbillus : Symbol(julianae.gerbillus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 67, 3)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) @@ -2249,7 +2249,7 @@ module rendalli { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 177, 86)) zibethicus() : minutus.inez { var x : minutus.inez; () => { var y = this; }; return x; } ->zibethicus : Symbol(zibethicus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 177, 187)) +>zibethicus : Symbol(moojeni.zibethicus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 177, 187)) >minutus : Symbol(minutus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 433, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 492, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 848, 1)) >inez : Symbol(minutus.inez, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 493, 16)) >sagitta : Symbol(sagitta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 487, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 577, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 675, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 746, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 898, 1)) @@ -2268,7 +2268,7 @@ module rendalli { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 178, 78)) biacensis() : howi.coludo { var x : howi.coludo; () => { var y = this; }; return x; } ->biacensis : Symbol(biacensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 178, 174)) +>biacensis : Symbol(moojeni.biacensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 178, 174)) >howi : Symbol(howi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 466, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 681, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 886, 1)) >coludo : Symbol(howi.coludo, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 887, 13)) >quasiater : Symbol(quasiater, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 236, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 422, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 813, 1)) @@ -2295,7 +2295,7 @@ module rendalli { >falconeri : Symbol(trivirgatus.falconeri, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 210, 3)) salvanius() : howi.coludo { var x : howi.coludo; () => { var y = this; }; return x; } ->salvanius : Symbol(salvanius, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 181, 64)) +>salvanius : Symbol(crenulata.salvanius, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 181, 64)) >howi : Symbol(howi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 466, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 681, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 886, 1)) >coludo : Symbol(howi.coludo, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 887, 13)) >howi : Symbol(howi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 466, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 681, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 886, 1)) @@ -2314,7 +2314,7 @@ module rendalli { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 182, 75)) maritimus() : ruatanica.americanus { var x : ruatanica.americanus; () => { var y = this; }; return x; } ->maritimus : Symbol(maritimus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 182, 169)) +>maritimus : Symbol(crenulata.maritimus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 182, 169)) >ruatanica : Symbol(ruatanica, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 100, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 244, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 959, 1)) >americanus : Symbol(ruatanica.americanus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 245, 18)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 183, 44)) @@ -2325,7 +2325,7 @@ module rendalli { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 183, 44)) edax() : lutreolus.cor>, rionegrensis.caniventer> { var x : lutreolus.cor>, rionegrensis.caniventer>; () => { var y = this; }; return x; } ->edax : Symbol(edax, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 183, 107)) +>edax : Symbol(crenulata.edax, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 183, 107)) >lutreolus : Symbol(lutreolus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 355, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 719, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 855, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 872, 1)) >cor : Symbol(lutreolus.cor, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 873, 18)) >imperfecta : Symbol(imperfecta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 785, 1)) @@ -2369,7 +2369,7 @@ module trivirgatus { >T1 : Symbol(T1, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 188, 30)) nivalis() : dogramacii.kaiseri { var x : dogramacii.kaiseri; () => { var y = this; }; return x; } ->nivalis : Symbol(nivalis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 188, 36)) +>nivalis : Symbol(tumidifrons.nivalis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 188, 36)) >dogramacii : Symbol(dogramacii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 314, 1)) >kaiseri : Symbol(dogramacii.kaiseri, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 329, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 189, 40)) @@ -2380,7 +2380,7 @@ module trivirgatus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 189, 40)) vestitus() : lavali.xanthognathus { var x : lavali.xanthognathus; () => { var y = this; }; return x; } ->vestitus : Symbol(vestitus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 189, 101)) +>vestitus : Symbol(tumidifrons.vestitus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 189, 101)) >lavali : Symbol(lavali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 252, 1)) >xanthognathus : Symbol(lavali.xanthognathus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 285, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 190, 43)) @@ -2391,7 +2391,7 @@ module trivirgatus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 190, 43)) aequatorius() : rionegrensis.caniventer { var x : rionegrensis.caniventer; () => { var y = this; }; return x; } ->aequatorius : Symbol(aequatorius, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 190, 106)) +>aequatorius : Symbol(tumidifrons.aequatorius, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 190, 106)) >rionegrensis : Symbol(rionegrensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 0, 0)) >caniventer : Symbol(rionegrensis.caniventer, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 0, 21)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 191, 49)) @@ -2402,7 +2402,7 @@ module trivirgatus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 191, 49)) scherman() : oconnelli { var x : oconnelli; () => { var y = this; }; return x; } ->scherman : Symbol(scherman, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 191, 115)) +>scherman : Symbol(tumidifrons.scherman, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 191, 115)) >oconnelli : Symbol(oconnelli, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 219, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 192, 32)) >oconnelli : Symbol(oconnelli, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 219, 3)) @@ -2411,7 +2411,7 @@ module trivirgatus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 192, 32)) improvisum() : argurus.peninsulae { var x : argurus.peninsulae; () => { var y = this; }; return x; } ->improvisum : Symbol(improvisum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 192, 84)) +>improvisum : Symbol(tumidifrons.improvisum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 192, 84)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) >peninsulae : Symbol(argurus.peninsulae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 931, 16)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 193, 43)) @@ -2422,7 +2422,7 @@ module trivirgatus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 193, 43)) cervinipes() : panglima.abidi { var x : panglima.abidi; () => { var y = this; }; return x; } ->cervinipes : Symbol(cervinipes, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 193, 104)) +>cervinipes : Symbol(tumidifrons.cervinipes, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 193, 104)) >panglima : Symbol(panglima, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 400, 1)) >abidi : Symbol(panglima.abidi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 414, 5)) >lavali : Symbol(lavali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 252, 1)) @@ -2441,7 +2441,7 @@ module trivirgatus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 194, 75)) audax() : dogramacii.robustulus { var x : dogramacii.robustulus; () => { var y = this; }; return x; } ->audax : Symbol(audax, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 194, 168)) +>audax : Symbol(tumidifrons.audax, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 194, 168)) >dogramacii : Symbol(dogramacii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 314, 1)) >robustulus : Symbol(dogramacii.robustulus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 315, 19)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 195, 41)) @@ -2452,7 +2452,7 @@ module trivirgatus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 195, 41)) vallinus() : sagitta.sicarius { var x : sagitta.sicarius; () => { var y = this; }; return x; } ->vallinus : Symbol(vallinus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 195, 105)) +>vallinus : Symbol(tumidifrons.vallinus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 195, 105)) >sagitta : Symbol(sagitta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 487, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 577, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 675, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 746, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 898, 1)) >sicarius : Symbol(sagitta.sicarius, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 676, 16)) >lavali : Symbol(lavali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 252, 1)) @@ -2487,7 +2487,7 @@ module trivirgatus { >daphaenodon : Symbol(macrorhinos.daphaenodon, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 737, 20)) ochrogaster() : dogramacii.aurata { var x : dogramacii.aurata; () => { var y = this; }; return x; } ->ochrogaster : Symbol(ochrogaster, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 198, 138)) +>ochrogaster : Symbol(mixtus.ochrogaster, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 198, 138)) >dogramacii : Symbol(dogramacii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 314, 1)) >aurata : Symbol(dogramacii.aurata, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 344, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 199, 43)) @@ -2498,7 +2498,7 @@ module trivirgatus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 199, 43)) bryophilus() : macrorhinos.marmosurus>> { var x : macrorhinos.marmosurus>>; () => { var y = this; }; return x; } ->bryophilus : Symbol(bryophilus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 199, 103)) +>bryophilus : Symbol(mixtus.bryophilus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 199, 103)) >macrorhinos : Symbol(macrorhinos, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 461, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 497, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 736, 1)) >marmosurus : Symbol(macrorhinos.marmosurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 462, 20)) >dogramacii : Symbol(dogramacii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 314, 1)) @@ -2533,7 +2533,7 @@ module trivirgatus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 200, 173)) liechtensteini() : rendalli.zuluensis { var x : rendalli.zuluensis; () => { var y = this; }; return x; } ->liechtensteini : Symbol(liechtensteini, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 200, 364)) +>liechtensteini : Symbol(mixtus.liechtensteini, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 200, 364)) >rendalli : Symbol(rendalli, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 151, 1)) >zuluensis : Symbol(rendalli.zuluensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 152, 17)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 201, 47)) @@ -2544,7 +2544,7 @@ module trivirgatus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 201, 47)) crawfordi() : howi.coludo> { var x : howi.coludo>; () => { var y = this; }; return x; } ->crawfordi : Symbol(crawfordi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 201, 108)) +>crawfordi : Symbol(mixtus.crawfordi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 201, 108)) >howi : Symbol(howi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 466, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 681, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 886, 1)) >coludo : Symbol(howi.coludo, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 887, 13)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) @@ -2571,7 +2571,7 @@ module trivirgatus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 202, 114)) hypsibia() : lavali.thaeleri { var x : lavali.thaeleri; () => { var y = this; }; return x; } ->hypsibia : Symbol(hypsibia, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 202, 247)) +>hypsibia : Symbol(mixtus.hypsibia, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 202, 247)) >lavali : Symbol(lavali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 252, 1)) >thaeleri : Symbol(lavali.thaeleri, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 299, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 203, 38)) @@ -2582,7 +2582,7 @@ module trivirgatus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 203, 38)) matacus() : panglima.fundatus, lavali.beisa>, dammermani.melanops> { var x : panglima.fundatus, lavali.beisa>, dammermani.melanops>; () => { var y = this; }; return x; } ->matacus : Symbol(matacus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 203, 96)) +>matacus : Symbol(mixtus.matacus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 203, 96)) >panglima : Symbol(panglima, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 400, 1)) >fundatus : Symbol(panglima.fundatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 409, 5)) >panamensis : Symbol(panamensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 501, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 986, 1)) @@ -2615,7 +2615,7 @@ module trivirgatus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 204, 135)) demidoff() : caurinus.johorensis { var x : caurinus.johorensis; () => { var y = this; }; return x; } ->demidoff : Symbol(demidoff, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 204, 291)) +>demidoff : Symbol(mixtus.demidoff, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 204, 291)) >caurinus : Symbol(caurinus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 449, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 836, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 976, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1007, 1)) >johorensis : Symbol(caurinus.johorensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 977, 17)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) @@ -2639,7 +2639,7 @@ module trivirgatus { >T1 : Symbol(T1, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 207, 24)) balensis() : samarensis.pallidus { var x : samarensis.pallidus; () => { var y = this; }; return x; } ->balensis : Symbol(balensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 207, 30)) +>balensis : Symbol(lotor.balensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 207, 30)) >samarensis : Symbol(samarensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 531, 1)) >pallidus : Symbol(samarensis.pallidus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 563, 5)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 208, 42)) @@ -2650,7 +2650,7 @@ module trivirgatus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 208, 42)) pullata() : rionegrensis.veraecrucis { var x : rionegrensis.veraecrucis; () => { var y = this; }; return x; } ->pullata : Symbol(pullata, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 208, 104)) +>pullata : Symbol(lotor.pullata, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 208, 104)) >rionegrensis : Symbol(rionegrensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 0, 0)) >veraecrucis : Symbol(rionegrensis.veraecrucis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 7, 3)) >quasiater : Symbol(quasiater, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 236, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 422, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 813, 1)) @@ -2672,7 +2672,7 @@ module trivirgatus { >falconeri : Symbol(falconeri, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 210, 3)) cabrali() : rendalli.moojeni>, daubentonii.arboreus> { var x : rendalli.moojeni>, daubentonii.arboreus>; () => { var y = this; }; return x; } ->cabrali : Symbol(cabrali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 211, 26)) +>cabrali : Symbol(falconeri.cabrali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 211, 26)) >rendalli : Symbol(rendalli, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 151, 1)) >moojeni : Symbol(rendalli.moojeni, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 168, 3)) >imperfecta : Symbol(imperfecta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 785, 1)) @@ -2715,7 +2715,7 @@ module trivirgatus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 212, 203)) gouldi() : nigra.dolichurus>, patas.uralensis> { var x : nigra.dolichurus>, patas.uralensis>; () => { var y = this; }; return x; } ->gouldi : Symbol(gouldi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 212, 427)) +>gouldi : Symbol(falconeri.gouldi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 212, 427)) >nigra : Symbol(nigra, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 388, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 475, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 514, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 762, 1)) >dolichurus : Symbol(nigra.dolichurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 389, 14)) >imperfecta : Symbol(imperfecta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 785, 1)) @@ -2750,7 +2750,7 @@ module trivirgatus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 213, 139)) fuscicollis() : samarensis.pelurus> { var x : samarensis.pelurus>; () => { var y = this; }; return x; } ->fuscicollis : Symbol(fuscicollis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 213, 300)) +>fuscicollis : Symbol(falconeri.fuscicollis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 213, 300)) >samarensis : Symbol(samarensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 531, 1)) >pelurus : Symbol(samarensis.pelurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 532, 19)) >dammermani : Symbol(dammermani, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 591, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 913, 1)) @@ -2777,7 +2777,7 @@ module trivirgatus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 214, 126)) martiensseni() : sagitta.cinereus>, dogramacii.koepckeae> { var x : sagitta.cinereus>, dogramacii.koepckeae>; () => { var y = this; }; return x; } ->martiensseni : Symbol(martiensseni, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 214, 269)) +>martiensseni : Symbol(falconeri.martiensseni, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 214, 269)) >sagitta : Symbol(sagitta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 487, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 577, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 675, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 746, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 898, 1)) >cinereus : Symbol(sagitta.cinereus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 747, 16)) >imperfecta : Symbol(imperfecta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 785, 1)) @@ -2812,7 +2812,7 @@ module trivirgatus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 215, 166)) gaoligongensis() : dogramacii.koepckeae { var x : dogramacii.koepckeae; () => { var y = this; }; return x; } ->gaoligongensis : Symbol(gaoligongensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 215, 348)) +>gaoligongensis : Symbol(falconeri.gaoligongensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 215, 348)) >dogramacii : Symbol(dogramacii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 314, 1)) >koepckeae : Symbol(dogramacii.koepckeae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 326, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 216, 49)) @@ -2823,7 +2823,7 @@ module trivirgatus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 216, 49)) shawi() : minutus.inez> { var x : minutus.inez>; () => { var y = this; }; return x; } ->shawi : Symbol(shawi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 216, 112)) +>shawi : Symbol(falconeri.shawi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 216, 112)) >minutus : Symbol(minutus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 433, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 492, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 848, 1)) >inez : Symbol(minutus.inez, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 493, 16)) >sagitta : Symbol(sagitta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 487, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 577, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 675, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 746, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 898, 1)) @@ -2850,7 +2850,7 @@ module trivirgatus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 217, 122)) gmelini() : rionegrensis.caniventer { var x : rionegrensis.caniventer; () => { var y = this; }; return x; } ->gmelini : Symbol(gmelini, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 217, 267)) +>gmelini : Symbol(falconeri.gmelini, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 217, 267)) >rionegrensis : Symbol(rionegrensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 0, 0)) >caniventer : Symbol(rionegrensis.caniventer, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 0, 21)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 218, 45)) @@ -2864,7 +2864,7 @@ module trivirgatus { >oconnelli : Symbol(oconnelli, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 219, 3)) youngsoni() : nigra.thalia { var x : nigra.thalia; () => { var y = this; }; return x; } ->youngsoni : Symbol(youngsoni, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 220, 26)) +>youngsoni : Symbol(oconnelli.youngsoni, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 220, 26)) >nigra : Symbol(nigra, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 388, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 475, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 514, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 762, 1)) >thalia : Symbol(nigra.thalia, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 476, 14)) >patas : Symbol(patas, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 652, 1)) @@ -2883,7 +2883,7 @@ module trivirgatus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 221, 77)) terrestris() : macrorhinos.konganensis { var x : macrorhinos.konganensis; () => { var y = this; }; return x; } ->terrestris : Symbol(terrestris, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 221, 173)) +>terrestris : Symbol(oconnelli.terrestris, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 221, 173)) >macrorhinos : Symbol(macrorhinos, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 461, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 497, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 736, 1)) >konganensis : Symbol(macrorhinos.konganensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 498, 20)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 222, 48)) @@ -2894,7 +2894,7 @@ module trivirgatus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 222, 48)) chrysopus() : sagitta.sicarius> { var x : sagitta.sicarius>; () => { var y = this; }; return x; } ->chrysopus : Symbol(chrysopus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 222, 114)) +>chrysopus : Symbol(oconnelli.chrysopus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 222, 114)) >sagitta : Symbol(sagitta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 487, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 577, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 675, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 746, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 898, 1)) >sicarius : Symbol(sagitta.sicarius, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 676, 16)) >dogramacii : Symbol(dogramacii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 314, 1)) @@ -2921,7 +2921,7 @@ module trivirgatus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 223, 121)) fuscomurina() : argurus.peninsulae { var x : argurus.peninsulae; () => { var y = this; }; return x; } ->fuscomurina : Symbol(fuscomurina, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 223, 261)) +>fuscomurina : Symbol(oconnelli.fuscomurina, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 223, 261)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) >peninsulae : Symbol(argurus.peninsulae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 931, 16)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 224, 44)) @@ -2932,7 +2932,7 @@ module trivirgatus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 224, 44)) hellwaldii() : nigra.gracilis, petrophilus.sodyi> { var x : nigra.gracilis, petrophilus.sodyi>; () => { var y = this; }; return x; } ->hellwaldii : Symbol(hellwaldii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 224, 105)) +>hellwaldii : Symbol(oconnelli.hellwaldii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 224, 105)) >nigra : Symbol(nigra, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 388, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 475, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 514, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 762, 1)) >gracilis : Symbol(nigra.gracilis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 515, 14)) >panamensis : Symbol(panamensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 501, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 986, 1)) @@ -2967,7 +2967,7 @@ module trivirgatus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 225, 160)) aenea() : argurus.luctuosa { var x : argurus.luctuosa; () => { var y = this; }; return x; } ->aenea : Symbol(aenea, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 225, 338)) +>aenea : Symbol(oconnelli.aenea, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 225, 338)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) >luctuosa : Symbol(argurus.luctuosa, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 982, 16)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 226, 36)) @@ -2978,7 +2978,7 @@ module trivirgatus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 226, 36)) perrini() : quasiater.bobrinskoi { var x : quasiater.bobrinskoi; () => { var y = this; }; return x; } ->perrini : Symbol(perrini, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 226, 95)) +>perrini : Symbol(oconnelli.perrini, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 226, 95)) >quasiater : Symbol(quasiater, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 236, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 422, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 813, 1)) >bobrinskoi : Symbol(quasiater.bobrinskoi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 237, 18)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 227, 42)) @@ -2989,7 +2989,7 @@ module trivirgatus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 227, 42)) entellus() : dammermani.melanops { var x : dammermani.melanops; () => { var y = this; }; return x; } ->entellus : Symbol(entellus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 227, 105)) +>entellus : Symbol(oconnelli.entellus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 227, 105)) >dammermani : Symbol(dammermani, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 591, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 913, 1)) >melanops : Symbol(dammermani.melanops, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 914, 19)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 228, 42)) @@ -3000,7 +3000,7 @@ module trivirgatus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 228, 42)) krebsii() : rionegrensis.veraecrucis { var x : rionegrensis.veraecrucis; () => { var y = this; }; return x; } ->krebsii : Symbol(krebsii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 228, 104)) +>krebsii : Symbol(oconnelli.krebsii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 228, 104)) >rionegrensis : Symbol(rionegrensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 0, 0)) >veraecrucis : Symbol(rionegrensis.veraecrucis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 7, 3)) >rionegrensis : Symbol(rionegrensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 0, 0)) @@ -3019,7 +3019,7 @@ module trivirgatus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 229, 90)) cephalotes() : lutreolus.schlegeli { var x : lutreolus.schlegeli; () => { var y = this; }; return x; } ->cephalotes : Symbol(cephalotes, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 229, 201)) +>cephalotes : Symbol(oconnelli.cephalotes, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 229, 201)) >lutreolus : Symbol(lutreolus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 355, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 719, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 855, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 872, 1)) >schlegeli : Symbol(lutreolus.schlegeli, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 356, 18)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 230, 44)) @@ -3030,7 +3030,7 @@ module trivirgatus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 230, 44)) molossinus() : daubentonii.nigricans> { var x : daubentonii.nigricans>; () => { var y = this; }; return x; } ->molossinus : Symbol(molossinus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 230, 106)) +>molossinus : Symbol(oconnelli.molossinus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 230, 106)) >daubentonii : Symbol(daubentonii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 471, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 586, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 636, 1)) >nigricans : Symbol(daubentonii.nigricans, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 587, 20)) >quasiater : Symbol(quasiater, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 236, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 422, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 813, 1)) @@ -3057,7 +3057,7 @@ module trivirgatus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 231, 136)) luisi() : dogramacii.robustulus { var x : dogramacii.robustulus; () => { var y = this; }; return x; } ->luisi : Symbol(luisi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 231, 290)) +>luisi : Symbol(oconnelli.luisi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 231, 290)) >dogramacii : Symbol(dogramacii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 314, 1)) >robustulus : Symbol(dogramacii.robustulus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 315, 19)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 232, 41)) @@ -3068,7 +3068,7 @@ module trivirgatus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 232, 41)) ceylonicus() : rionegrensis.caniventer { var x : rionegrensis.caniventer; () => { var y = this; }; return x; } ->ceylonicus : Symbol(ceylonicus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 232, 105)) +>ceylonicus : Symbol(oconnelli.ceylonicus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 232, 105)) >rionegrensis : Symbol(rionegrensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 0, 0)) >caniventer : Symbol(rionegrensis.caniventer, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 0, 21)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 233, 48)) @@ -3079,7 +3079,7 @@ module trivirgatus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 233, 48)) ralli() : lavali.xanthognathus { var x : lavali.xanthognathus; () => { var y = this; }; return x; } ->ralli : Symbol(ralli, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 233, 114)) +>ralli : Symbol(oconnelli.ralli, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 233, 114)) >lavali : Symbol(lavali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 252, 1)) >xanthognathus : Symbol(lavali.xanthognathus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 285, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 234, 40)) @@ -3097,7 +3097,7 @@ module quasiater { >bobrinskoi : Symbol(bobrinskoi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 237, 18)) crassicaudatus() : samarensis.cahirinus { var x : samarensis.cahirinus; () => { var y = this; }; return x; } ->crassicaudatus : Symbol(crassicaudatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 238, 27)) +>crassicaudatus : Symbol(bobrinskoi.crassicaudatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 238, 27)) >samarensis : Symbol(samarensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 531, 1)) >cahirinus : Symbol(samarensis.cahirinus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 569, 5)) >macrorhinos : Symbol(macrorhinos, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 461, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 497, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 736, 1)) @@ -3116,7 +3116,7 @@ module quasiater { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 239, 92)) mulatta() : argurus.oreas { var x : argurus.oreas; () => { var y = this; }; return x; } ->mulatta : Symbol(mulatta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 239, 198)) +>mulatta : Symbol(bobrinskoi.mulatta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 239, 198)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) >oreas : Symbol(argurus.oreas, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 625, 16)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 240, 35)) @@ -3127,7 +3127,7 @@ module quasiater { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 240, 35)) ansorgei() : rendalli.moojeni, gabriellae.echinatus> { var x : rendalli.moojeni, gabriellae.echinatus>; () => { var y = this; }; return x; } ->ansorgei : Symbol(ansorgei, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 240, 91)) +>ansorgei : Symbol(bobrinskoi.ansorgei, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 240, 91)) >rendalli : Symbol(rendalli, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 151, 1)) >moojeni : Symbol(rendalli.moojeni, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 168, 3)) >panglima : Symbol(panglima, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 400, 1)) @@ -3154,7 +3154,7 @@ module quasiater { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 241, 123)) Copper() : argurus.netscheri { var x : argurus.netscheri; () => { var y = this; }; return x; } ->Copper : Symbol(Copper, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 241, 266)) +>Copper : Symbol(bobrinskoi.Copper, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 241, 266)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) >netscheri : Symbol(argurus.netscheri, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 943, 16)) >quasiater : Symbol(quasiater, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 236, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 422, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 813, 1)) @@ -3187,7 +3187,7 @@ module ruatanica { >foina : Symbol(lutreolus.foina, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 856, 18)) nasoloi() : macrorhinos.konganensis { var x : macrorhinos.konganensis; () => { var y = this; }; return x; } ->nasoloi : Symbol(nasoloi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 246, 93)) +>nasoloi : Symbol(americanus.nasoloi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 246, 93)) >macrorhinos : Symbol(macrorhinos, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 461, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 497, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 736, 1)) >konganensis : Symbol(macrorhinos.konganensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 498, 20)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 247, 45)) @@ -3198,7 +3198,7 @@ module ruatanica { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 247, 45)) mystacalis() : howi.angulatus { var x : howi.angulatus; () => { var y = this; }; return x; } ->mystacalis : Symbol(mystacalis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 247, 111)) +>mystacalis : Symbol(americanus.mystacalis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 247, 111)) >howi : Symbol(howi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 466, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 681, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 886, 1)) >angulatus : Symbol(howi.angulatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 467, 13)) >quasiater : Symbol(quasiater, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 236, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 422, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 813, 1)) @@ -3217,7 +3217,7 @@ module ruatanica { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 248, 83)) fardoulisi() : trivirgatus.oconnelli { var x : trivirgatus.oconnelli; () => { var y = this; }; return x; } ->fardoulisi : Symbol(fardoulisi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 248, 184)) +>fardoulisi : Symbol(americanus.fardoulisi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 248, 184)) >trivirgatus : Symbol(trivirgatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 186, 1)) >oconnelli : Symbol(trivirgatus.oconnelli, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 219, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 249, 46)) @@ -3228,7 +3228,7 @@ module ruatanica { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 249, 46)) tumidus() : gabriellae.amicus { var x : gabriellae.amicus; () => { var y = this; }; return x; } ->tumidus : Symbol(tumidus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 249, 110)) +>tumidus : Symbol(americanus.tumidus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 249, 110)) >gabriellae : Symbol(gabriellae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 766, 1)) >amicus : Symbol(gabriellae.amicus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 769, 5)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 250, 39)) @@ -3253,7 +3253,7 @@ module lavali { >jugularis : Symbol(Lanthanum.jugularis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 134, 3)) setiger() : nigra.thalia { var x : nigra.thalia; () => { var y = this; }; return x; } ->setiger : Symbol(setiger, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 254, 96)) +>setiger : Symbol(wilsoni.setiger, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 254, 96)) >nigra : Symbol(nigra, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 388, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 475, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 514, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 762, 1)) >thalia : Symbol(nigra.thalia, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 476, 14)) >patas : Symbol(patas, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 652, 1)) @@ -3270,7 +3270,7 @@ module lavali { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 255, 60)) lorentzii() : imperfecta.subspinosus { var x : imperfecta.subspinosus; () => { var y = this; }; return x; } ->lorentzii : Symbol(lorentzii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 255, 141)) +>lorentzii : Symbol(wilsoni.lorentzii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 255, 141)) >imperfecta : Symbol(imperfecta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 785, 1)) >subspinosus : Symbol(imperfecta.subspinosus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 794, 5)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 256, 46)) @@ -3281,7 +3281,7 @@ module lavali { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 256, 46)) antisensis() : lutreolus.foina { var x : lutreolus.foina; () => { var y = this; }; return x; } ->antisensis : Symbol(antisensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 256, 111)) +>antisensis : Symbol(wilsoni.antisensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 256, 111)) >lutreolus : Symbol(lutreolus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 355, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 719, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 855, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 872, 1)) >foina : Symbol(lutreolus.foina, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 856, 18)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 257, 40)) @@ -3292,7 +3292,7 @@ module lavali { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 257, 40)) blossevillii() : dammermani.siberu { var x : dammermani.siberu; () => { var y = this; }; return x; } ->blossevillii : Symbol(blossevillii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 257, 98)) +>blossevillii : Symbol(wilsoni.blossevillii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 257, 98)) >dammermani : Symbol(dammermani, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 591, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 913, 1)) >siberu : Symbol(dammermani.siberu, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 592, 19)) >Lanthanum : Symbol(Lanthanum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 106, 1)) @@ -3311,7 +3311,7 @@ module lavali { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 258, 85)) bontanus() : rionegrensis.caniventer { var x : rionegrensis.caniventer; () => { var y = this; }; return x; } ->bontanus : Symbol(bontanus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 258, 186)) +>bontanus : Symbol(wilsoni.bontanus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 258, 186)) >rionegrensis : Symbol(rionegrensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 0, 0)) >caniventer : Symbol(rionegrensis.caniventer, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 0, 21)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 259, 46)) @@ -3322,7 +3322,7 @@ module lavali { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 259, 46)) caligata() : argurus.oreas { var x : argurus.oreas; () => { var y = this; }; return x; } ->caligata : Symbol(caligata, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 259, 112)) +>caligata : Symbol(wilsoni.caligata, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 259, 112)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) >oreas : Symbol(argurus.oreas, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 625, 16)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 260, 36)) @@ -3333,7 +3333,7 @@ module lavali { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 260, 36)) franqueti() : panglima.amphibius, imperfecta.subspinosus> { var x : panglima.amphibius, imperfecta.subspinosus>; () => { var y = this; }; return x; } ->franqueti : Symbol(franqueti, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 260, 92)) +>franqueti : Symbol(wilsoni.franqueti, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 260, 92)) >panglima : Symbol(panglima, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 400, 1)) >amphibius : Symbol(panglima.amphibius, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 401, 17)) >gabriellae : Symbol(gabriellae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 766, 1)) @@ -3360,7 +3360,7 @@ module lavali { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 261, 128)) roberti() : julianae.acariensis { var x : julianae.acariensis; () => { var y = this; }; return x; } ->roberti : Symbol(roberti, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 261, 275)) +>roberti : Symbol(wilsoni.roberti, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 261, 275)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) >acariensis : Symbol(julianae.acariensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 80, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 262, 41)) @@ -3371,7 +3371,7 @@ module lavali { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 262, 41)) degelidus() : chrysaeolus.sarasinorum { var x : chrysaeolus.sarasinorum; () => { var y = this; }; return x; } ->degelidus : Symbol(degelidus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 262, 103)) +>degelidus : Symbol(wilsoni.degelidus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 262, 103)) >chrysaeolus : Symbol(chrysaeolus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 602, 1)) >sarasinorum : Symbol(chrysaeolus.sarasinorum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 603, 20)) >Lanthanum : Symbol(Lanthanum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 106, 1)) @@ -3390,7 +3390,7 @@ module lavali { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 263, 92)) amoenus() : quasiater.carolinensis { var x : quasiater.carolinensis; () => { var y = this; }; return x; } ->amoenus : Symbol(amoenus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 263, 203)) +>amoenus : Symbol(wilsoni.amoenus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 263, 203)) >quasiater : Symbol(quasiater, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 236, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 422, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 813, 1)) >carolinensis : Symbol(quasiater.carolinensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 423, 18)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 264, 44)) @@ -3401,7 +3401,7 @@ module lavali { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 264, 44)) kob() : trivirgatus.lotor { var x : trivirgatus.lotor; () => { var y = this; }; return x; } ->kob : Symbol(kob, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 264, 109)) +>kob : Symbol(wilsoni.kob, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 264, 109)) >trivirgatus : Symbol(trivirgatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 186, 1)) >lotor : Symbol(trivirgatus.lotor, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 206, 3)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) @@ -3418,7 +3418,7 @@ module lavali { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 265, 57)) csorbai() : caurinus.johorensis { var x : caurinus.johorensis; () => { var y = this; }; return x; } ->csorbai : Symbol(csorbai, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 265, 139)) +>csorbai : Symbol(wilsoni.csorbai, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 265, 139)) >caurinus : Symbol(caurinus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 449, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 836, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 976, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1007, 1)) >johorensis : Symbol(caurinus.johorensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 977, 17)) >caurinus : Symbol(caurinus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 449, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 836, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 976, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1007, 1)) @@ -3437,7 +3437,7 @@ module lavali { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 266, 81)) dorsata() : gabriellae.echinatus { var x : gabriellae.echinatus; () => { var y = this; }; return x; } ->dorsata : Symbol(dorsata, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 266, 183)) +>dorsata : Symbol(wilsoni.dorsata, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 266, 183)) >gabriellae : Symbol(gabriellae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 766, 1)) >echinatus : Symbol(gabriellae.echinatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 781, 5)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 267, 42)) @@ -3461,7 +3461,7 @@ module lavali { >marcanoi : Symbol(howi.marcanoi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 682, 13)) bonaerensis() : provocax.melanoleuca { var x : provocax.melanoleuca; () => { var y = this; }; return x; } ->bonaerensis : Symbol(bonaerensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 271, 72)) +>bonaerensis : Symbol(otion.bonaerensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 271, 72)) >provocax : Symbol(provocax, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 669, 1)) >melanoleuca : Symbol(provocax.melanoleuca, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 670, 17)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 272, 46)) @@ -3472,7 +3472,7 @@ module lavali { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 272, 46)) dussumieri() : nigra.gracilis { var x : nigra.gracilis; () => { var y = this; }; return x; } ->dussumieri : Symbol(dussumieri, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 272, 109)) +>dussumieri : Symbol(otion.dussumieri, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 272, 109)) >nigra : Symbol(nigra, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 388, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 475, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 514, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 762, 1)) >gracilis : Symbol(nigra.gracilis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 515, 14)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) @@ -3491,7 +3491,7 @@ module lavali { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 273, 77)) osvaldoreigi() : julianae.albidens { var x : julianae.albidens; () => { var y = this; }; return x; } ->osvaldoreigi : Symbol(osvaldoreigi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 273, 172)) +>osvaldoreigi : Symbol(otion.osvaldoreigi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 273, 172)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) >albidens : Symbol(julianae.albidens, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 34, 3)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) @@ -3510,7 +3510,7 @@ module lavali { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 274, 86)) grevyi() : samarensis.pallidus { var x : samarensis.pallidus; () => { var y = this; }; return x; } ->grevyi : Symbol(grevyi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 274, 188)) +>grevyi : Symbol(otion.grevyi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 274, 188)) >samarensis : Symbol(samarensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 531, 1)) >pallidus : Symbol(samarensis.pallidus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 563, 5)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 275, 40)) @@ -3521,7 +3521,7 @@ module lavali { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 275, 40)) hirtula() : lepturus { var x : lepturus; () => { var y = this; }; return x; } ->hirtula : Symbol(hirtula, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 275, 102)) +>hirtula : Symbol(otion.hirtula, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 275, 102)) >lepturus : Symbol(lepturus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 309, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 276, 30)) >lepturus : Symbol(lepturus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 309, 3)) @@ -3530,7 +3530,7 @@ module lavali { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 276, 30)) cristatus() : argurus.luctuosa { var x : argurus.luctuosa; () => { var y = this; }; return x; } ->cristatus : Symbol(cristatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 276, 81)) +>cristatus : Symbol(otion.cristatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 276, 81)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) >luctuosa : Symbol(argurus.luctuosa, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 982, 16)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 277, 40)) @@ -3541,7 +3541,7 @@ module lavali { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 277, 40)) darlingtoni() : sagitta.leptoceros { var x : sagitta.leptoceros; () => { var y = this; }; return x; } ->darlingtoni : Symbol(darlingtoni, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 277, 99)) +>darlingtoni : Symbol(otion.darlingtoni, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 277, 99)) >sagitta : Symbol(sagitta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 487, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 577, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 675, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 746, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 898, 1)) >leptoceros : Symbol(sagitta.leptoceros, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 578, 16)) >wilsoni : Symbol(wilsoni, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 253, 15)) @@ -3558,7 +3558,7 @@ module lavali { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 278, 76)) fontanierii() : panamensis.setulosus>, lutreolus.foina> { var x : panamensis.setulosus>, lutreolus.foina>; () => { var y = this; }; return x; } ->fontanierii : Symbol(fontanierii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 278, 169)) +>fontanierii : Symbol(otion.fontanierii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 278, 169)) >panamensis : Symbol(panamensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 501, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 986, 1)) >setulosus : Symbol(panamensis.setulosus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 987, 19)) >samarensis : Symbol(samarensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 531, 1)) @@ -3591,7 +3591,7 @@ module lavali { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 279, 161)) umbrosus() : howi.marcanoi { var x : howi.marcanoi; () => { var y = this; }; return x; } ->umbrosus : Symbol(umbrosus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 279, 339)) +>umbrosus : Symbol(otion.umbrosus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 279, 339)) >howi : Symbol(howi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 466, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 681, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 886, 1)) >marcanoi : Symbol(howi.marcanoi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 682, 13)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 280, 36)) @@ -3602,7 +3602,7 @@ module lavali { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 280, 36)) chiriquinus() : imperfecta.lasiurus { var x : imperfecta.lasiurus; () => { var y = this; }; return x; } ->chiriquinus : Symbol(chiriquinus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 280, 92)) +>chiriquinus : Symbol(otion.chiriquinus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 280, 92)) >imperfecta : Symbol(imperfecta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 785, 1)) >lasiurus : Symbol(imperfecta.lasiurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 786, 19)) >caurinus : Symbol(caurinus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 449, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 836, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 976, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1007, 1)) @@ -3621,7 +3621,7 @@ module lavali { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 281, 83)) orarius() : lutreolus.schlegeli { var x : lutreolus.schlegeli; () => { var y = this; }; return x; } ->orarius : Symbol(orarius, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 281, 183)) +>orarius : Symbol(otion.orarius, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 281, 183)) >lutreolus : Symbol(lutreolus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 355, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 719, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 855, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 872, 1)) >schlegeli : Symbol(lutreolus.schlegeli, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 356, 18)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 282, 41)) @@ -3632,7 +3632,7 @@ module lavali { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 282, 41)) ilaeus() : caurinus.mahaganus { var x : caurinus.mahaganus; () => { var y = this; }; return x; } ->ilaeus : Symbol(ilaeus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 282, 103)) +>ilaeus : Symbol(otion.ilaeus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 282, 103)) >caurinus : Symbol(caurinus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 449, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 836, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 976, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1007, 1)) >mahaganus : Symbol(caurinus.mahaganus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 450, 17)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) @@ -3651,7 +3651,7 @@ module lavali { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 283, 80)) musschenbroekii() : trivirgatus.falconeri { var x : trivirgatus.falconeri; () => { var y = this; }; return x; } ->musschenbroekii : Symbol(musschenbroekii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 283, 182)) +>musschenbroekii : Symbol(otion.musschenbroekii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 283, 182)) >trivirgatus : Symbol(trivirgatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 186, 1)) >falconeri : Symbol(trivirgatus.falconeri, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 210, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 284, 51)) @@ -3665,7 +3665,7 @@ module lavali { >xanthognathus : Symbol(xanthognathus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 285, 3)) nanulus() : daubentonii.nigricans { var x : daubentonii.nigricans; () => { var y = this; }; return x; } ->nanulus : Symbol(nanulus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 286, 30)) +>nanulus : Symbol(xanthognathus.nanulus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 286, 30)) >daubentonii : Symbol(daubentonii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 471, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 586, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 636, 1)) >nigricans : Symbol(daubentonii.nigricans, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 587, 20)) >imperfecta : Symbol(imperfecta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 785, 1)) @@ -3684,7 +3684,7 @@ module lavali { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 287, 88)) albigena() : chrysaeolus.sarasinorum { var x : chrysaeolus.sarasinorum; () => { var y = this; }; return x; } ->albigena : Symbol(albigena, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 287, 197)) +>albigena : Symbol(xanthognathus.albigena, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 287, 197)) >chrysaeolus : Symbol(chrysaeolus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 602, 1)) >sarasinorum : Symbol(chrysaeolus.sarasinorum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 603, 20)) >caurinus : Symbol(caurinus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 449, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 836, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 976, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1007, 1)) @@ -3703,7 +3703,7 @@ module lavali { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 288, 87)) onca() : sagitta.stolzmanni { var x : sagitta.stolzmanni; () => { var y = this; }; return x; } ->onca : Symbol(onca, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 288, 194)) +>onca : Symbol(xanthognathus.onca, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 288, 194)) >sagitta : Symbol(sagitta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 487, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 577, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 675, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 746, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 898, 1)) >stolzmanni : Symbol(sagitta.stolzmanni, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 899, 16)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 289, 37)) @@ -3714,7 +3714,7 @@ module lavali { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 289, 37)) gunnii() : minutus.himalayana, nigra.thalia> { var x : minutus.himalayana, nigra.thalia>; () => { var y = this; }; return x; } ->gunnii : Symbol(gunnii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 289, 98)) +>gunnii : Symbol(xanthognathus.gunnii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 289, 98)) >minutus : Symbol(minutus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 433, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 492, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 848, 1)) >himalayana : Symbol(minutus.himalayana, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 434, 16)) >howi : Symbol(howi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 466, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 681, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 886, 1)) @@ -3747,7 +3747,7 @@ module lavali { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 290, 135)) apeco() : lutreolus.foina { var x : lutreolus.foina; () => { var y = this; }; return x; } ->apeco : Symbol(apeco, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 290, 292)) +>apeco : Symbol(xanthognathus.apeco, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 290, 292)) >lutreolus : Symbol(lutreolus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 355, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 719, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 855, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 872, 1)) >foina : Symbol(lutreolus.foina, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 856, 18)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 291, 35)) @@ -3758,7 +3758,7 @@ module lavali { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 291, 35)) variegates() : gabriellae.klossii { var x : gabriellae.klossii; () => { var y = this; }; return x; } ->variegates : Symbol(variegates, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 291, 93)) +>variegates : Symbol(xanthognathus.variegates, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 291, 93)) >gabriellae : Symbol(gabriellae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 766, 1)) >klossii : Symbol(gabriellae.klossii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 767, 19)) >wilsoni : Symbol(wilsoni, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 253, 15)) @@ -3775,7 +3775,7 @@ module lavali { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 292, 73)) goudotii() : trivirgatus.falconeri { var x : trivirgatus.falconeri; () => { var y = this; }; return x; } ->goudotii : Symbol(goudotii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 292, 164)) +>goudotii : Symbol(xanthognathus.goudotii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 292, 164)) >trivirgatus : Symbol(trivirgatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 186, 1)) >falconeri : Symbol(trivirgatus.falconeri, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 210, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 293, 44)) @@ -3786,7 +3786,7 @@ module lavali { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 293, 44)) pohlei() : Lanthanum.megalonyx { var x : Lanthanum.megalonyx; () => { var y = this; }; return x; } ->pohlei : Symbol(pohlei, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 293, 108)) +>pohlei : Symbol(xanthognathus.pohlei, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 293, 108)) >Lanthanum : Symbol(Lanthanum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 106, 1)) >megalonyx : Symbol(Lanthanum.megalonyx, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 124, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 294, 40)) @@ -3797,7 +3797,7 @@ module lavali { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 294, 40)) ineptus() : panamensis.setulosus { var x : panamensis.setulosus; () => { var y = this; }; return x; } ->ineptus : Symbol(ineptus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 294, 102)) +>ineptus : Symbol(xanthognathus.ineptus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 294, 102)) >panamensis : Symbol(panamensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 501, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 986, 1)) >setulosus : Symbol(panamensis.setulosus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 987, 19)) >xanthognathus : Symbol(xanthognathus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 285, 3)) @@ -3812,7 +3812,7 @@ module lavali { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 295, 64)) euryotis() : rendalli.moojeni> { var x : rendalli.moojeni>; () => { var y = this; }; return x; } ->euryotis : Symbol(euryotis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 295, 149)) +>euryotis : Symbol(xanthognathus.euryotis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 295, 149)) >rendalli : Symbol(rendalli, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 151, 1)) >moojeni : Symbol(rendalli.moojeni, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 168, 3)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) @@ -3839,7 +3839,7 @@ module lavali { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 296, 120)) maurisca() : Lanthanum.suillus { var x : Lanthanum.suillus; () => { var y = this; }; return x; } ->maurisca : Symbol(maurisca, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 296, 260)) +>maurisca : Symbol(xanthognathus.maurisca, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 296, 260)) >Lanthanum : Symbol(Lanthanum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 106, 1)) >suillus : Symbol(Lanthanum.suillus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 107, 18)) >rionegrensis : Symbol(rionegrensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 0, 0)) @@ -3858,7 +3858,7 @@ module lavali { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 297, 89)) coyhaiquensis() : caurinus.mahaganus, panglima.abidi>, lutreolus.punicus> { var x : caurinus.mahaganus, panglima.abidi>, lutreolus.punicus>; () => { var y = this; }; return x; } ->coyhaiquensis : Symbol(coyhaiquensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 297, 198)) +>coyhaiquensis : Symbol(xanthognathus.coyhaiquensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 297, 198)) >caurinus : Symbol(caurinus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 449, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 836, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 976, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1007, 1)) >mahaganus : Symbol(caurinus.mahaganus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 450, 17)) >dammermani : Symbol(dammermani, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 591, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 913, 1)) @@ -3907,7 +3907,7 @@ module lavali { >oreas : Symbol(argurus.oreas, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 625, 16)) coromandra() : julianae.galapagoensis { var x : julianae.galapagoensis; () => { var y = this; }; return x; } ->coromandra : Symbol(coromandra, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 300, 47)) +>coromandra : Symbol(thaeleri.coromandra, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 300, 47)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) >galapagoensis : Symbol(julianae.galapagoensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 25, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 301, 47)) @@ -3918,7 +3918,7 @@ module lavali { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 301, 47)) parvipes() : nigra.dolichurus { var x : nigra.dolichurus; () => { var y = this; }; return x; } ->parvipes : Symbol(parvipes, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 301, 112)) +>parvipes : Symbol(thaeleri.parvipes, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 301, 112)) >nigra : Symbol(nigra, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 388, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 475, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 514, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 762, 1)) >dolichurus : Symbol(nigra.dolichurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 389, 14)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) @@ -3937,7 +3937,7 @@ module lavali { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 302, 78)) sponsorius() : rionegrensis.veraecrucis, julianae.steerii> { var x : rionegrensis.veraecrucis, julianae.steerii>; () => { var y = this; }; return x; } ->sponsorius : Symbol(sponsorius, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 302, 176)) +>sponsorius : Symbol(thaeleri.sponsorius, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 302, 176)) >rionegrensis : Symbol(rionegrensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 0, 0)) >veraecrucis : Symbol(rionegrensis.veraecrucis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 7, 3)) >chrysaeolus : Symbol(chrysaeolus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 602, 1)) @@ -3964,7 +3964,7 @@ module lavali { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 303, 133)) vates() : dogramacii.robustulus { var x : dogramacii.robustulus; () => { var y = this; }; return x; } ->vates : Symbol(vates, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 303, 284)) +>vates : Symbol(thaeleri.vates, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 303, 284)) >dogramacii : Symbol(dogramacii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 314, 1)) >robustulus : Symbol(dogramacii.robustulus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 315, 19)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 304, 41)) @@ -3975,7 +3975,7 @@ module lavali { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 304, 41)) roosmalenorum() : dogramacii.koepckeae { var x : dogramacii.koepckeae; () => { var y = this; }; return x; } ->roosmalenorum : Symbol(roosmalenorum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 304, 105)) +>roosmalenorum : Symbol(thaeleri.roosmalenorum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 304, 105)) >dogramacii : Symbol(dogramacii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 314, 1)) >koepckeae : Symbol(dogramacii.koepckeae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 326, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 305, 48)) @@ -3986,7 +3986,7 @@ module lavali { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 305, 48)) rubicola() : rendalli.moojeni, gabriellae.echinatus>> { var x : rendalli.moojeni, gabriellae.echinatus>>; () => { var y = this; }; return x; } ->rubicola : Symbol(rubicola, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 305, 111)) +>rubicola : Symbol(thaeleri.rubicola, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 305, 111)) >rendalli : Symbol(rendalli, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 151, 1)) >moojeni : Symbol(rendalli.moojeni, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 168, 3)) >rionegrensis : Symbol(rionegrensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 0, 0)) @@ -4021,7 +4021,7 @@ module lavali { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 306, 166)) ikonnikovi() : argurus.luctuosa { var x : argurus.luctuosa; () => { var y = this; }; return x; } ->ikonnikovi : Symbol(ikonnikovi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 306, 352)) +>ikonnikovi : Symbol(thaeleri.ikonnikovi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 306, 352)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) >luctuosa : Symbol(argurus.luctuosa, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 982, 16)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 307, 41)) @@ -4032,7 +4032,7 @@ module lavali { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 307, 41)) paramicrus() : imperfecta.ciliolabrum> { var x : imperfecta.ciliolabrum>; () => { var y = this; }; return x; } ->paramicrus : Symbol(paramicrus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 307, 100)) +>paramicrus : Symbol(thaeleri.paramicrus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 307, 100)) >imperfecta : Symbol(imperfecta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 785, 1)) >ciliolabrum : Symbol(imperfecta.ciliolabrum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 807, 5)) >otion : Symbol(otion, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 270, 3)) @@ -4067,7 +4067,7 @@ module lavali { >carolinensis : Symbol(quasiater.carolinensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 423, 18)) ferrumequinum() : argurus.netscheri { var x : argurus.netscheri; () => { var y = this; }; return x; } ->ferrumequinum : Symbol(ferrumequinum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 310, 96)) +>ferrumequinum : Symbol(lepturus.ferrumequinum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 310, 96)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) >netscheri : Symbol(argurus.netscheri, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 943, 16)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) @@ -4086,7 +4086,7 @@ module lavali { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 311, 84)) aequalis() : sagitta.cinereus>, petrophilus.minutilla>, Lanthanum.jugularis> { var x : sagitta.cinereus>, petrophilus.minutilla>, Lanthanum.jugularis>; () => { var y = this; }; return x; } ->aequalis : Symbol(aequalis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 311, 183)) +>aequalis : Symbol(lepturus.aequalis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 311, 183)) >sagitta : Symbol(sagitta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 487, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 577, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 675, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 746, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 898, 1)) >cinereus : Symbol(sagitta.cinereus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 747, 16)) >petrophilus : Symbol(petrophilus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 715, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 823, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 998, 1)) @@ -4137,7 +4137,7 @@ module dogramacii { >wilsoni : Symbol(lavali.wilsoni, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 253, 15)) fossor() : minutus.inez { var x : minutus.inez; () => { var y = this; }; return x; } ->fossor : Symbol(fossor, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 316, 50)) +>fossor : Symbol(robustulus.fossor, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 316, 50)) >minutus : Symbol(minutus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 433, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 492, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 848, 1)) >inez : Symbol(minutus.inez, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 493, 16)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) @@ -4156,7 +4156,7 @@ module dogramacii { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 317, 74)) humboldti() : sagitta.cinereus { var x : sagitta.cinereus; () => { var y = this; }; return x; } ->humboldti : Symbol(humboldti, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 317, 170)) +>humboldti : Symbol(robustulus.humboldti, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 317, 170)) >sagitta : Symbol(sagitta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 487, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 577, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 675, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 746, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 898, 1)) >cinereus : Symbol(sagitta.cinereus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 747, 16)) >lavali : Symbol(lavali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 252, 1)) @@ -4175,7 +4175,7 @@ module dogramacii { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 318, 77)) mexicana() : macrorhinos.konganensis { var x : macrorhinos.konganensis; () => { var y = this; }; return x; } ->mexicana : Symbol(mexicana, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 318, 173)) +>mexicana : Symbol(robustulus.mexicana, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 318, 173)) >macrorhinos : Symbol(macrorhinos, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 461, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 497, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 736, 1)) >konganensis : Symbol(macrorhinos.konganensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 498, 20)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 319, 46)) @@ -4186,7 +4186,7 @@ module dogramacii { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 319, 46)) martini() : julianae.oralis { var x : julianae.oralis; () => { var y = this; }; return x; } ->martini : Symbol(martini, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 319, 112)) +>martini : Symbol(robustulus.martini, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 319, 112)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) >oralis : Symbol(julianae.oralis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 43, 3)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) @@ -4205,7 +4205,7 @@ module dogramacii { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 320, 72)) beatus() : Lanthanum.jugularis { var x : Lanthanum.jugularis; () => { var y = this; }; return x; } ->beatus : Symbol(beatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 320, 165)) +>beatus : Symbol(robustulus.beatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 320, 165)) >Lanthanum : Symbol(Lanthanum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 106, 1)) >jugularis : Symbol(Lanthanum.jugularis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 134, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 321, 40)) @@ -4216,7 +4216,7 @@ module dogramacii { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 321, 40)) leporina() : trivirgatus.falconeri { var x : trivirgatus.falconeri; () => { var y = this; }; return x; } ->leporina : Symbol(leporina, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 321, 102)) +>leporina : Symbol(robustulus.leporina, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 321, 102)) >trivirgatus : Symbol(trivirgatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 186, 1)) >falconeri : Symbol(trivirgatus.falconeri, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 210, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 322, 44)) @@ -4227,7 +4227,7 @@ module dogramacii { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 322, 44)) pearsonii() : dammermani.melanops { var x : dammermani.melanops; () => { var y = this; }; return x; } ->pearsonii : Symbol(pearsonii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 322, 108)) +>pearsonii : Symbol(robustulus.pearsonii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 322, 108)) >dammermani : Symbol(dammermani, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 591, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 913, 1)) >melanops : Symbol(dammermani.melanops, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 914, 19)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 323, 43)) @@ -4238,7 +4238,7 @@ module dogramacii { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 323, 43)) keaysi() : howi.angulatus { var x : howi.angulatus; () => { var y = this; }; return x; } ->keaysi : Symbol(keaysi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 323, 105)) +>keaysi : Symbol(robustulus.keaysi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 323, 105)) >howi : Symbol(howi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 466, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 681, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 886, 1)) >angulatus : Symbol(howi.angulatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 467, 13)) >lavali : Symbol(lavali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 252, 1)) @@ -4257,7 +4257,7 @@ module dogramacii { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 324, 69)) hindei() : imperfecta.lasiurus { var x : imperfecta.lasiurus; () => { var y = this; }; return x; } ->hindei : Symbol(hindei, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 324, 160)) +>hindei : Symbol(robustulus.hindei, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 324, 160)) >imperfecta : Symbol(imperfecta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 785, 1)) >lasiurus : Symbol(imperfecta.lasiurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 786, 19)) >macrorhinos : Symbol(macrorhinos, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 461, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 497, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 736, 1)) @@ -4279,7 +4279,7 @@ module dogramacii { >koepckeae : Symbol(koepckeae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 326, 3)) culturatus() : samarensis.pelurus, julianae.sumatrana> { var x : samarensis.pelurus, julianae.sumatrana>; () => { var y = this; }; return x; } ->culturatus : Symbol(culturatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 327, 26)) +>culturatus : Symbol(koepckeae.culturatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 327, 26)) >samarensis : Symbol(samarensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 531, 1)) >pelurus : Symbol(samarensis.pelurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 532, 19)) >daubentonii : Symbol(daubentonii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 471, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 586, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 636, 1)) @@ -4307,7 +4307,7 @@ module dogramacii { >kaiseri : Symbol(kaiseri, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 329, 3)) bedfordiae() : quasiater.carolinensis { var x : quasiater.carolinensis; () => { var y = this; }; return x; } ->bedfordiae : Symbol(bedfordiae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 330, 24)) +>bedfordiae : Symbol(kaiseri.bedfordiae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 330, 24)) >quasiater : Symbol(quasiater, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 236, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 422, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 813, 1)) >carolinensis : Symbol(quasiater.carolinensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 423, 18)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 331, 47)) @@ -4318,7 +4318,7 @@ module dogramacii { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 331, 47)) paramorum() : Lanthanum.megalonyx { var x : Lanthanum.megalonyx; () => { var y = this; }; return x; } ->paramorum : Symbol(paramorum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 331, 112)) +>paramorum : Symbol(kaiseri.paramorum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 331, 112)) >Lanthanum : Symbol(Lanthanum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 106, 1)) >megalonyx : Symbol(Lanthanum.megalonyx, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 124, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 332, 43)) @@ -4329,7 +4329,7 @@ module dogramacii { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 332, 43)) rubidus() : trivirgatus.lotor { var x : trivirgatus.lotor; () => { var y = this; }; return x; } ->rubidus : Symbol(rubidus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 332, 105)) +>rubidus : Symbol(kaiseri.rubidus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 332, 105)) >trivirgatus : Symbol(trivirgatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 186, 1)) >lotor : Symbol(trivirgatus.lotor, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 206, 3)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) @@ -4348,7 +4348,7 @@ module dogramacii { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 333, 78)) juninensis() : quasiater.bobrinskoi { var x : quasiater.bobrinskoi; () => { var y = this; }; return x; } ->juninensis : Symbol(juninensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 333, 177)) +>juninensis : Symbol(kaiseri.juninensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 333, 177)) >quasiater : Symbol(quasiater, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 236, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 422, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 813, 1)) >bobrinskoi : Symbol(quasiater.bobrinskoi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 237, 18)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 334, 45)) @@ -4359,7 +4359,7 @@ module dogramacii { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 334, 45)) marginata() : argurus.wetmorei>> { var x : argurus.wetmorei>>; () => { var y = this; }; return x; } ->marginata : Symbol(marginata, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 334, 108)) +>marginata : Symbol(kaiseri.marginata, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 334, 108)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) >wetmorei : Symbol(argurus.wetmorei, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 614, 16)) >rionegrensis : Symbol(rionegrensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 0, 0)) @@ -4394,7 +4394,7 @@ module dogramacii { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 335, 175)) Meitnerium() : ruatanica.Praseodymium> { var x : ruatanica.Praseodymium>; () => { var y = this; }; return x; } ->Meitnerium : Symbol(Meitnerium, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 335, 369)) +>Meitnerium : Symbol(kaiseri.Meitnerium, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 335, 369)) >ruatanica : Symbol(ruatanica, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 100, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 244, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 959, 1)) >Praseodymium : Symbol(ruatanica.Praseodymium, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 960, 18)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) @@ -4421,7 +4421,7 @@ module dogramacii { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 336, 127)) pinetorum() : rionegrensis.caniventer { var x : rionegrensis.caniventer; () => { var y = this; }; return x; } ->pinetorum : Symbol(pinetorum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 336, 272)) +>pinetorum : Symbol(kaiseri.pinetorum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 336, 272)) >rionegrensis : Symbol(rionegrensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 0, 0)) >caniventer : Symbol(rionegrensis.caniventer, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 0, 21)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 337, 47)) @@ -4432,7 +4432,7 @@ module dogramacii { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 337, 47)) hoolock() : samarensis.pelurus { var x : samarensis.pelurus; () => { var y = this; }; return x; } ->hoolock : Symbol(hoolock, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 337, 113)) +>hoolock : Symbol(kaiseri.hoolock, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 337, 113)) >samarensis : Symbol(samarensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 531, 1)) >pelurus : Symbol(samarensis.pelurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 532, 19)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) @@ -4451,7 +4451,7 @@ module dogramacii { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 338, 73)) poeyi() : gabriellae.echinatus { var x : gabriellae.echinatus; () => { var y = this; }; return x; } ->poeyi : Symbol(poeyi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 338, 167)) +>poeyi : Symbol(kaiseri.poeyi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 338, 167)) >gabriellae : Symbol(gabriellae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 766, 1)) >echinatus : Symbol(gabriellae.echinatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 781, 5)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 339, 40)) @@ -4462,7 +4462,7 @@ module dogramacii { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 339, 40)) Thulium() : julianae.durangae { var x : julianae.durangae; () => { var y = this; }; return x; } ->Thulium : Symbol(Thulium, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 339, 103)) +>Thulium : Symbol(kaiseri.Thulium, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 339, 103)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) >durangae : Symbol(julianae.durangae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 94, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 340, 39)) @@ -4473,7 +4473,7 @@ module dogramacii { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 340, 39)) patrius() : Lanthanum.jugularis { var x : Lanthanum.jugularis; () => { var y = this; }; return x; } ->patrius : Symbol(patrius, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 340, 99)) +>patrius : Symbol(kaiseri.patrius, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 340, 99)) >Lanthanum : Symbol(Lanthanum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 106, 1)) >jugularis : Symbol(Lanthanum.jugularis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 134, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 341, 41)) @@ -4484,7 +4484,7 @@ module dogramacii { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 341, 41)) quadraticauda() : julianae.nudicaudus { var x : julianae.nudicaudus; () => { var y = this; }; return x; } ->quadraticauda : Symbol(quadraticauda, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 341, 103)) +>quadraticauda : Symbol(kaiseri.quadraticauda, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 341, 103)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) >nudicaudus : Symbol(julianae.nudicaudus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 18, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 342, 47)) @@ -4495,7 +4495,7 @@ module dogramacii { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 342, 47)) ater() : ruatanica.americanus { var x : ruatanica.americanus; () => { var y = this; }; return x; } ->ater : Symbol(ater, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 342, 109)) +>ater : Symbol(kaiseri.ater, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 342, 109)) >ruatanica : Symbol(ruatanica, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 100, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 244, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 959, 1)) >americanus : Symbol(ruatanica.americanus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 245, 18)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 343, 39)) @@ -4509,7 +4509,7 @@ module dogramacii { >aurata : Symbol(aurata, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 344, 3)) grunniens() : nigra.gracilis, julianae.sumatrana>, ruatanica.americanus> { var x : nigra.gracilis, julianae.sumatrana>, ruatanica.americanus>; () => { var y = this; }; return x; } ->grunniens : Symbol(grunniens, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 345, 23)) +>grunniens : Symbol(aurata.grunniens, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 345, 23)) >nigra : Symbol(nigra, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 388, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 475, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 514, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 762, 1)) >gracilis : Symbol(nigra.gracilis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 515, 14)) >samarensis : Symbol(samarensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 531, 1)) @@ -4542,7 +4542,7 @@ module dogramacii { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 346, 150)) howensis() : ruatanica.americanus { var x : ruatanica.americanus; () => { var y = this; }; return x; } ->howensis : Symbol(howensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 346, 319)) +>howensis : Symbol(aurata.howensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 346, 319)) >ruatanica : Symbol(ruatanica, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 100, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 244, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 959, 1)) >americanus : Symbol(ruatanica.americanus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 245, 18)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 347, 43)) @@ -4553,7 +4553,7 @@ module dogramacii { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 347, 43)) karlkoopmani() : caurinus.psilurus { var x : caurinus.psilurus; () => { var y = this; }; return x; } ->karlkoopmani : Symbol(karlkoopmani, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 347, 106)) +>karlkoopmani : Symbol(aurata.karlkoopmani, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 347, 106)) >caurinus : Symbol(caurinus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 449, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 836, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 976, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1007, 1)) >psilurus : Symbol(caurinus.psilurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1008, 17)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 348, 44)) @@ -4564,7 +4564,7 @@ module dogramacii { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 348, 44)) mirapitanga() : julianae.albidens { var x : julianae.albidens; () => { var y = this; }; return x; } ->mirapitanga : Symbol(mirapitanga, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 348, 104)) +>mirapitanga : Symbol(aurata.mirapitanga, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 348, 104)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) >albidens : Symbol(julianae.albidens, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 34, 3)) >gabriellae : Symbol(gabriellae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 766, 1)) @@ -4583,7 +4583,7 @@ module dogramacii { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 349, 87)) ophiodon() : aurata { var x : aurata; () => { var y = this; }; return x; } ->ophiodon : Symbol(ophiodon, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 349, 191)) +>ophiodon : Symbol(aurata.ophiodon, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 349, 191)) >aurata : Symbol(aurata, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 344, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 350, 29)) >aurata : Symbol(aurata, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 344, 3)) @@ -4592,7 +4592,7 @@ module dogramacii { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 350, 29)) landeri() : samarensis.pelurus { var x : samarensis.pelurus; () => { var y = this; }; return x; } ->landeri : Symbol(landeri, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 350, 78)) +>landeri : Symbol(aurata.landeri, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 350, 78)) >samarensis : Symbol(samarensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 531, 1)) >pelurus : Symbol(samarensis.pelurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 532, 19)) >Lanthanum : Symbol(Lanthanum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 106, 1)) @@ -4611,7 +4611,7 @@ module dogramacii { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 351, 83)) sonomae() : trivirgatus.lotor, koepckeae> { var x : trivirgatus.lotor, koepckeae>; () => { var y = this; }; return x; } ->sonomae : Symbol(sonomae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 351, 187)) +>sonomae : Symbol(aurata.sonomae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 351, 187)) >trivirgatus : Symbol(trivirgatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 186, 1)) >lotor : Symbol(trivirgatus.lotor, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 206, 3)) >panglima : Symbol(panglima, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 400, 1)) @@ -4636,7 +4636,7 @@ module dogramacii { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 352, 102)) erythromos() : caurinus.johorensis, nigra.dolichurus> { var x : caurinus.johorensis, nigra.dolichurus>; () => { var y = this; }; return x; } ->erythromos : Symbol(erythromos, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 352, 225)) +>erythromos : Symbol(aurata.erythromos, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 352, 225)) >caurinus : Symbol(caurinus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 449, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 836, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 976, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1007, 1)) >johorensis : Symbol(caurinus.johorensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 977, 17)) >panglima : Symbol(panglima, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 400, 1)) @@ -4681,7 +4681,7 @@ module lutreolus { >beisa : Symbol(lavali.beisa, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 268, 3)) mittendorfi() : rionegrensis.caniventer { var x : rionegrensis.caniventer; () => { var y = this; }; return x; } ->mittendorfi : Symbol(mittendorfi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 357, 47)) +>mittendorfi : Symbol(schlegeli.mittendorfi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 357, 47)) >rionegrensis : Symbol(rionegrensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 0, 0)) >caniventer : Symbol(rionegrensis.caniventer, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 0, 21)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 358, 49)) @@ -4692,7 +4692,7 @@ module lutreolus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 358, 49)) blicki() : dogramacii.robustulus { var x : dogramacii.robustulus; () => { var y = this; }; return x; } ->blicki : Symbol(blicki, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 358, 115)) +>blicki : Symbol(schlegeli.blicki, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 358, 115)) >dogramacii : Symbol(dogramacii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 314, 1)) >robustulus : Symbol(dogramacii.robustulus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 315, 19)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 359, 42)) @@ -4703,7 +4703,7 @@ module lutreolus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 359, 42)) culionensis() : argurus.dauricus { var x : argurus.dauricus; () => { var y = this; }; return x; } ->culionensis : Symbol(culionensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 359, 106)) +>culionensis : Symbol(schlegeli.culionensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 359, 106)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) >dauricus : Symbol(argurus.dauricus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 374, 16)) >ruatanica : Symbol(ruatanica, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 100, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 244, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 959, 1)) @@ -4722,7 +4722,7 @@ module lutreolus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 360, 89)) scrofa() : petrophilus.sodyi { var x : petrophilus.sodyi; () => { var y = this; }; return x; } ->scrofa : Symbol(scrofa, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 360, 195)) +>scrofa : Symbol(schlegeli.scrofa, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 360, 195)) >petrophilus : Symbol(petrophilus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 715, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 823, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 998, 1)) >sodyi : Symbol(petrophilus.sodyi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 824, 20)) >gabriellae : Symbol(gabriellae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 766, 1)) @@ -4741,7 +4741,7 @@ module lutreolus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 361, 77)) fernandoni() : quasiater.carolinensis { var x : quasiater.carolinensis; () => { var y = this; }; return x; } ->fernandoni : Symbol(fernandoni, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 361, 176)) +>fernandoni : Symbol(schlegeli.fernandoni, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 361, 176)) >quasiater : Symbol(quasiater, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 236, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 422, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 813, 1)) >carolinensis : Symbol(quasiater.carolinensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 423, 18)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 362, 47)) @@ -4752,7 +4752,7 @@ module lutreolus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 362, 47)) Tin() : sagitta.leptoceros> { var x : sagitta.leptoceros>; () => { var y = this; }; return x; } ->Tin : Symbol(Tin, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 362, 112)) +>Tin : Symbol(schlegeli.Tin, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 362, 112)) >sagitta : Symbol(sagitta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 487, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 577, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 675, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 746, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 898, 1)) >leptoceros : Symbol(sagitta.leptoceros, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 578, 16)) >lutreolus : Symbol(lutreolus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 355, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 719, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 855, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 872, 1)) @@ -4779,7 +4779,7 @@ module lutreolus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 363, 126)) marmorata() : panamensis.setulosus> { var x : panamensis.setulosus>; () => { var y = this; }; return x; } ->marmorata : Symbol(marmorata, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 363, 277)) +>marmorata : Symbol(schlegeli.marmorata, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 363, 277)) >panamensis : Symbol(panamensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 501, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 986, 1)) >setulosus : Symbol(panamensis.setulosus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 987, 19)) >quasiater : Symbol(quasiater, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 236, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 422, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 813, 1)) @@ -4806,7 +4806,7 @@ module lutreolus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 364, 129)) tavaratra() : Lanthanum.nitidus { var x : Lanthanum.nitidus; () => { var y = this; }; return x; } ->tavaratra : Symbol(tavaratra, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 364, 277)) +>tavaratra : Symbol(schlegeli.tavaratra, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 364, 277)) >Lanthanum : Symbol(Lanthanum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 106, 1)) >nitidus : Symbol(Lanthanum.nitidus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 112, 3)) >howi : Symbol(howi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 466, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 681, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 886, 1)) @@ -4825,7 +4825,7 @@ module lutreolus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 365, 81)) peregrina() : daubentonii.nesiotes { var x : daubentonii.nesiotes; () => { var y = this; }; return x; } ->peregrina : Symbol(peregrina, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 365, 181)) +>peregrina : Symbol(schlegeli.peregrina, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 365, 181)) >daubentonii : Symbol(daubentonii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 471, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 586, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 636, 1)) >nesiotes : Symbol(daubentonii.nesiotes, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 472, 20)) >macrorhinos : Symbol(macrorhinos, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 461, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 497, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 736, 1)) @@ -4844,7 +4844,7 @@ module lutreolus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 366, 88)) frontalis() : macrorhinos.marmosurus>, samarensis.pallidus> { var x : macrorhinos.marmosurus>, samarensis.pallidus>; () => { var y = this; }; return x; } ->frontalis : Symbol(frontalis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 366, 195)) +>frontalis : Symbol(schlegeli.frontalis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 366, 195)) >macrorhinos : Symbol(macrorhinos, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 461, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 497, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 736, 1)) >marmosurus : Symbol(macrorhinos.marmosurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 462, 20)) >ruatanica : Symbol(ruatanica, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 100, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 244, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 959, 1)) @@ -4879,7 +4879,7 @@ module lutreolus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 367, 163)) cuniculus() : patas.uralensis { var x : patas.uralensis; () => { var y = this; }; return x; } ->cuniculus : Symbol(cuniculus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 367, 345)) +>cuniculus : Symbol(schlegeli.cuniculus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 367, 345)) >patas : Symbol(patas, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 652, 1)) >uralensis : Symbol(patas.uralensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 653, 14)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 368, 39)) @@ -4890,7 +4890,7 @@ module lutreolus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 368, 39)) magdalenae() : julianae.gerbillus> { var x : julianae.gerbillus>; () => { var y = this; }; return x; } ->magdalenae : Symbol(magdalenae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 368, 97)) +>magdalenae : Symbol(schlegeli.magdalenae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 368, 97)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) >gerbillus : Symbol(julianae.gerbillus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 67, 3)) >rionegrensis : Symbol(rionegrensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 0, 0)) @@ -4917,7 +4917,7 @@ module lutreolus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 369, 131)) andamanensis() : julianae.oralis { var x : julianae.oralis; () => { var y = this; }; return x; } ->andamanensis : Symbol(andamanensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 369, 280)) +>andamanensis : Symbol(schlegeli.andamanensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 369, 280)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) >oralis : Symbol(julianae.oralis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 43, 3)) >ruatanica : Symbol(ruatanica, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 100, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 244, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 959, 1)) @@ -4936,7 +4936,7 @@ module lutreolus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 370, 84)) dispar() : panamensis.linulus { var x : panamensis.linulus; () => { var y = this; }; return x; } ->dispar : Symbol(dispar, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 370, 184)) +>dispar : Symbol(schlegeli.dispar, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 370, 184)) >panamensis : Symbol(panamensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 501, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 986, 1)) >linulus : Symbol(panamensis.linulus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 502, 19)) >dogramacii : Symbol(dogramacii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 314, 1)) @@ -4964,7 +4964,7 @@ module argurus { >T1 : Symbol(T1, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 375, 27)) chinensis() : Lanthanum.jugularis { var x : Lanthanum.jugularis; () => { var y = this; }; return x; } ->chinensis : Symbol(chinensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 375, 33)) +>chinensis : Symbol(dauricus.chinensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 375, 33)) >Lanthanum : Symbol(Lanthanum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 106, 1)) >jugularis : Symbol(Lanthanum.jugularis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 134, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 376, 43)) @@ -4975,7 +4975,7 @@ module argurus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 376, 43)) duodecimcostatus() : lavali.xanthognathus { var x : lavali.xanthognathus; () => { var y = this; }; return x; } ->duodecimcostatus : Symbol(duodecimcostatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 376, 105)) +>duodecimcostatus : Symbol(dauricus.duodecimcostatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 376, 105)) >lavali : Symbol(lavali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 252, 1)) >xanthognathus : Symbol(lavali.xanthognathus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 285, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 377, 51)) @@ -4986,7 +4986,7 @@ module argurus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 377, 51)) foxi() : daubentonii.nesiotes { var x : daubentonii.nesiotes; () => { var y = this; }; return x; } ->foxi : Symbol(foxi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 377, 114)) +>foxi : Symbol(dauricus.foxi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 377, 114)) >daubentonii : Symbol(daubentonii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 471, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 586, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 636, 1)) >nesiotes : Symbol(daubentonii.nesiotes, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 472, 20)) >lavali : Symbol(lavali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 252, 1)) @@ -5005,7 +5005,7 @@ module argurus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 378, 70)) macleayii() : petrophilus.sodyi>, petrophilus.minutilla> { var x : petrophilus.sodyi>, petrophilus.minutilla>; () => { var y = this; }; return x; } ->macleayii : Symbol(macleayii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 378, 164)) +>macleayii : Symbol(dauricus.macleayii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 378, 164)) >petrophilus : Symbol(petrophilus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 715, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 823, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 998, 1)) >sodyi : Symbol(petrophilus.sodyi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 824, 20)) >quasiater : Symbol(quasiater, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 236, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 422, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 813, 1)) @@ -5040,7 +5040,7 @@ module argurus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 379, 173)) darienensis() : trivirgatus.oconnelli { var x : trivirgatus.oconnelli; () => { var y = this; }; return x; } ->darienensis : Symbol(darienensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 379, 365)) +>darienensis : Symbol(dauricus.darienensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 379, 365)) >trivirgatus : Symbol(trivirgatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 186, 1)) >oconnelli : Symbol(trivirgatus.oconnelli, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 219, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 380, 47)) @@ -5051,7 +5051,7 @@ module argurus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 380, 47)) hardwickii() : macrorhinos.daphaenodon { var x : macrorhinos.daphaenodon; () => { var y = this; }; return x; } ->hardwickii : Symbol(hardwickii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 380, 111)) +>hardwickii : Symbol(dauricus.hardwickii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 380, 111)) >macrorhinos : Symbol(macrorhinos, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 461, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 497, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 736, 1)) >daphaenodon : Symbol(macrorhinos.daphaenodon, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 737, 20)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 381, 48)) @@ -5062,7 +5062,7 @@ module argurus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 381, 48)) albifrons() : rionegrensis.veraecrucis { var x : rionegrensis.veraecrucis; () => { var y = this; }; return x; } ->albifrons : Symbol(albifrons, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 381, 114)) +>albifrons : Symbol(dauricus.albifrons, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 381, 114)) >rionegrensis : Symbol(rionegrensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 0, 0)) >veraecrucis : Symbol(rionegrensis.veraecrucis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 7, 3)) >lavali : Symbol(lavali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 252, 1)) @@ -5081,7 +5081,7 @@ module argurus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 382, 84)) jacobitus() : caurinus.johorensis>> { var x : caurinus.johorensis>>; () => { var y = this; }; return x; } ->jacobitus : Symbol(jacobitus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 382, 187)) +>jacobitus : Symbol(dauricus.jacobitus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 382, 187)) >caurinus : Symbol(caurinus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 449, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 836, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 976, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1007, 1)) >johorensis : Symbol(caurinus.johorensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 977, 17)) >macrorhinos : Symbol(macrorhinos, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 461, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 497, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 736, 1)) @@ -5116,7 +5116,7 @@ module argurus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 383, 169)) guentheri() : rendalli.moojeni { var x : rendalli.moojeni; () => { var y = this; }; return x; } ->guentheri : Symbol(guentheri, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 383, 357)) +>guentheri : Symbol(dauricus.guentheri, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 383, 357)) >rendalli : Symbol(rendalli, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 151, 1)) >moojeni : Symbol(rendalli.moojeni, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 168, 3)) >lutreolus : Symbol(lutreolus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 355, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 719, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 855, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 872, 1)) @@ -5135,7 +5135,7 @@ module argurus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 384, 72)) mahomet() : imperfecta.ciliolabrum { var x : imperfecta.ciliolabrum; () => { var y = this; }; return x; } ->mahomet : Symbol(mahomet, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 384, 163)) +>mahomet : Symbol(dauricus.mahomet, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 384, 163)) >imperfecta : Symbol(imperfecta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 785, 1)) >ciliolabrum : Symbol(imperfecta.ciliolabrum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 807, 5)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) @@ -5154,7 +5154,7 @@ module argurus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 385, 79)) misionensis() : macrorhinos.marmosurus, gabriellae.echinatus> { var x : macrorhinos.marmosurus, gabriellae.echinatus>; () => { var y = this; }; return x; } ->misionensis : Symbol(misionensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 385, 179)) +>misionensis : Symbol(dauricus.misionensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 385, 179)) >macrorhinos : Symbol(macrorhinos, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 461, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 497, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 736, 1)) >marmosurus : Symbol(macrorhinos.marmosurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 462, 20)) >daubentonii : Symbol(daubentonii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 471, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 586, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 636, 1)) @@ -5190,7 +5190,7 @@ module nigra { >T1 : Symbol(T1, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 390, 29)) solomonis() : panglima.abidi, argurus.netscheri, julianae.oralis>>> { var x : panglima.abidi, argurus.netscheri, julianae.oralis>>>; () => { var y = this; }; return x; } ->solomonis : Symbol(solomonis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 390, 35)) +>solomonis : Symbol(dolichurus.solomonis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 390, 35)) >panglima : Symbol(panglima, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 400, 1)) >abidi : Symbol(panglima.abidi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 414, 5)) >quasiater : Symbol(quasiater, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 236, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 422, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 813, 1)) @@ -5249,7 +5249,7 @@ module nigra { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 391, 270)) alfredi() : caurinus.psilurus { var x : caurinus.psilurus; () => { var y = this; }; return x; } ->alfredi : Symbol(alfredi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 391, 559)) +>alfredi : Symbol(dolichurus.alfredi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 391, 559)) >caurinus : Symbol(caurinus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 449, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 836, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 976, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1007, 1)) >psilurus : Symbol(caurinus.psilurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1008, 17)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 392, 39)) @@ -5260,7 +5260,7 @@ module nigra { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 392, 39)) morrisi() : ruatanica.hector, quasiater.wattsi>>> { var x : ruatanica.hector, quasiater.wattsi>>>; () => { var y = this; }; return x; } ->morrisi : Symbol(morrisi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 392, 99)) +>morrisi : Symbol(dolichurus.morrisi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 392, 99)) >ruatanica : Symbol(ruatanica, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 100, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 244, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 959, 1)) >hector : Symbol(ruatanica.hector, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 101, 18)) >trivirgatus : Symbol(trivirgatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 186, 1)) @@ -5311,7 +5311,7 @@ module nigra { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 393, 248)) lekaguli() : Lanthanum.nitidus { var x : Lanthanum.nitidus; () => { var y = this; }; return x; } ->lekaguli : Symbol(lekaguli, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 393, 517)) +>lekaguli : Symbol(dolichurus.lekaguli, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 393, 517)) >Lanthanum : Symbol(Lanthanum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 106, 1)) >nitidus : Symbol(Lanthanum.nitidus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 112, 3)) >dammermani : Symbol(dammermani, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 591, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 913, 1)) @@ -5330,7 +5330,7 @@ module nigra { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 394, 78)) dimissus() : imperfecta.subspinosus { var x : imperfecta.subspinosus; () => { var y = this; }; return x; } ->dimissus : Symbol(dimissus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 394, 176)) +>dimissus : Symbol(dolichurus.dimissus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 394, 176)) >imperfecta : Symbol(imperfecta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 785, 1)) >subspinosus : Symbol(imperfecta.subspinosus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 794, 5)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 395, 45)) @@ -5341,7 +5341,7 @@ module nigra { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 395, 45)) phaeotis() : julianae.sumatrana { var x : julianae.sumatrana; () => { var y = this; }; return x; } ->phaeotis : Symbol(phaeotis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 395, 110)) +>phaeotis : Symbol(dolichurus.phaeotis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 395, 110)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) >sumatrana : Symbol(julianae.sumatrana, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 58, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 396, 41)) @@ -5352,7 +5352,7 @@ module nigra { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 396, 41)) ustus() : julianae.acariensis { var x : julianae.acariensis; () => { var y = this; }; return x; } ->ustus : Symbol(ustus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 396, 102)) +>ustus : Symbol(dolichurus.ustus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 396, 102)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) >acariensis : Symbol(julianae.acariensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 80, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 397, 39)) @@ -5363,7 +5363,7 @@ module nigra { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 397, 39)) sagei() : howi.marcanoi { var x : howi.marcanoi; () => { var y = this; }; return x; } ->sagei : Symbol(sagei, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 397, 101)) +>sagei : Symbol(dolichurus.sagei, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 397, 101)) >howi : Symbol(howi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 466, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 681, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 886, 1)) >marcanoi : Symbol(howi.marcanoi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 682, 13)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 398, 33)) @@ -5394,7 +5394,7 @@ module panglima { >jugularis : Symbol(Lanthanum.jugularis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 134, 3)) bottegi(): macrorhinos.marmosurus, gabriellae.echinatus>, sagitta.stolzmanni> { var x: macrorhinos.marmosurus, gabriellae.echinatus>, sagitta.stolzmanni>; () => { var y = this; }; return x; } ->bottegi : Symbol(bottegi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 402, 147)) +>bottegi : Symbol(amphibius.bottegi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 402, 147)) >macrorhinos : Symbol(macrorhinos, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 461, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 497, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 736, 1)) >marmosurus : Symbol(macrorhinos.marmosurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 462, 20)) >rendalli : Symbol(rendalli, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 151, 1)) @@ -5427,7 +5427,7 @@ module panglima { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 403, 160)) jerdoni(): macrorhinos.daphaenodon { var x: macrorhinos.daphaenodon; () => { var y = this; }; return x; } ->jerdoni : Symbol(jerdoni, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 403, 337)) +>jerdoni : Symbol(amphibius.jerdoni, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 403, 337)) >macrorhinos : Symbol(macrorhinos, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 461, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 497, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 736, 1)) >daphaenodon : Symbol(macrorhinos.daphaenodon, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 737, 20)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 404, 48)) @@ -5438,7 +5438,7 @@ module panglima { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 404, 48)) camtschatica(): samarensis.pallidus { var x: samarensis.pallidus; () => { var y = this; }; return x; } ->camtschatica : Symbol(camtschatica, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 404, 113)) +>camtschatica : Symbol(amphibius.camtschatica, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 404, 113)) >samarensis : Symbol(samarensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 531, 1)) >pallidus : Symbol(samarensis.pallidus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 563, 5)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 405, 49)) @@ -5449,7 +5449,7 @@ module panglima { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 405, 49)) spadix(): petrophilus.sodyi { var x: petrophilus.sodyi; () => { var y = this; }; return x; } ->spadix : Symbol(spadix, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 405, 110)) +>spadix : Symbol(amphibius.spadix, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 405, 110)) >petrophilus : Symbol(petrophilus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 715, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 823, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 998, 1)) >sodyi : Symbol(petrophilus.sodyi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 824, 20)) >macrorhinos : Symbol(macrorhinos, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 461, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 497, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 736, 1)) @@ -5468,7 +5468,7 @@ module panglima { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 406, 85)) luismanueli(): rendalli.moojeni { var x: rendalli.moojeni; () => { var y = this; }; return x; } ->luismanueli : Symbol(luismanueli, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 406, 188)) +>luismanueli : Symbol(amphibius.luismanueli, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 406, 188)) >rendalli : Symbol(rendalli, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 151, 1)) >moojeni : Symbol(rendalli.moojeni, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 168, 3)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) @@ -5487,7 +5487,7 @@ module panglima { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 407, 88)) aceramarcae(): daubentonii.arboreus { var x: daubentonii.arboreus; () => { var y = this; }; return x; } ->aceramarcae : Symbol(aceramarcae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 407, 189)) +>aceramarcae : Symbol(amphibius.aceramarcae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 407, 189)) >daubentonii : Symbol(daubentonii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 471, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 586, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 636, 1)) >arboreus : Symbol(daubentonii.arboreus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 637, 20)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) @@ -5514,7 +5514,7 @@ module panglima { >schlegeli : Symbol(lutreolus.schlegeli, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 356, 18)) crassulus(): nigra.gracilis { var x: nigra.gracilis; () => { var y = this; }; return x; } ->crassulus : Symbol(crassulus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 410, 63)) +>crassulus : Symbol(fundatus.crassulus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 410, 63)) >nigra : Symbol(nigra, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 388, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 475, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 514, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 762, 1)) >gracilis : Symbol(nigra.gracilis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 515, 14)) >provocax : Symbol(provocax, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 669, 1)) @@ -5533,7 +5533,7 @@ module panglima { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 411, 85)) flamarioni(): imperfecta.lasiurus>, sagitta.leptoceros>> { var x: imperfecta.lasiurus>, sagitta.leptoceros>>; () => { var y = this; }; return x; } ->flamarioni : Symbol(flamarioni, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 411, 185)) +>flamarioni : Symbol(fundatus.flamarioni, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 411, 185)) >imperfecta : Symbol(imperfecta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 785, 1)) >lasiurus : Symbol(imperfecta.lasiurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 786, 19)) >amphibius : Symbol(amphibius, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 401, 17)) @@ -5582,7 +5582,7 @@ module panglima { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 412, 245)) mirabilis(): macrorhinos.marmosurus, lavali.lepturus> { var x: macrorhinos.marmosurus, lavali.lepturus>; () => { var y = this; }; return x; } ->mirabilis : Symbol(mirabilis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 412, 504)) +>mirabilis : Symbol(fundatus.mirabilis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 412, 504)) >macrorhinos : Symbol(macrorhinos, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 461, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 497, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 736, 1)) >marmosurus : Symbol(macrorhinos.marmosurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 462, 20)) >petrophilus : Symbol(petrophilus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 715, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 823, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 998, 1)) @@ -5621,7 +5621,7 @@ module panglima { >durangae : Symbol(julianae.durangae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 94, 3)) greyii(): trivirgatus.oconnelli { var x: trivirgatus.oconnelli; () => { var y = this; }; return x; } ->greyii : Symbol(greyii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 415, 94)) +>greyii : Symbol(abidi.greyii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 415, 94)) >trivirgatus : Symbol(trivirgatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 186, 1)) >oconnelli : Symbol(trivirgatus.oconnelli, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 219, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 416, 45)) @@ -5632,7 +5632,7 @@ module panglima { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 416, 45)) macedonicus(): petrophilus.minutilla { var x: petrophilus.minutilla; () => { var y = this; }; return x; } ->macedonicus : Symbol(macedonicus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 416, 108)) +>macedonicus : Symbol(abidi.macedonicus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 416, 108)) >petrophilus : Symbol(petrophilus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 715, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 823, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 998, 1)) >minutilla : Symbol(petrophilus.minutilla, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 716, 20)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 417, 50)) @@ -5643,7 +5643,7 @@ module panglima { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 417, 50)) galili(): samarensis.cahirinus { var x: samarensis.cahirinus; () => { var y = this; }; return x; } ->galili : Symbol(galili, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 417, 113)) +>galili : Symbol(abidi.galili, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 417, 113)) >samarensis : Symbol(samarensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 531, 1)) >cahirinus : Symbol(samarensis.cahirinus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 569, 5)) >dammermani : Symbol(dammermani, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 591, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 913, 1)) @@ -5662,7 +5662,7 @@ module panglima { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 418, 86)) thierryi(): dogramacii.robustulus { var x: dogramacii.robustulus; () => { var y = this; }; return x; } ->thierryi : Symbol(thierryi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 418, 190)) +>thierryi : Symbol(abidi.thierryi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 418, 190)) >dogramacii : Symbol(dogramacii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 314, 1)) >robustulus : Symbol(dogramacii.robustulus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 315, 19)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 419, 47)) @@ -5673,7 +5673,7 @@ module panglima { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 419, 47)) ega(): imperfecta.lasiurus> { var x: imperfecta.lasiurus>; () => { var y = this; }; return x; } ->ega : Symbol(ega, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 419, 110)) +>ega : Symbol(abidi.ega, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 419, 110)) >imperfecta : Symbol(imperfecta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 785, 1)) >lasiurus : Symbol(imperfecta.lasiurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 786, 19)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) @@ -5707,7 +5707,7 @@ module quasiater { >carolinensis : Symbol(carolinensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 423, 18)) concinna(): rendalli.zuluensis { var x: rendalli.zuluensis; () => { var y = this; }; return x; } ->concinna : Symbol(concinna, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 424, 31)) +>concinna : Symbol(carolinensis.concinna, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 424, 31)) >rendalli : Symbol(rendalli, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 151, 1)) >zuluensis : Symbol(rendalli.zuluensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 152, 17)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 425, 44)) @@ -5718,7 +5718,7 @@ module quasiater { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 425, 44)) aeneus(): howi.marcanoi { var x: howi.marcanoi; () => { var y = this; }; return x; } ->aeneus : Symbol(aeneus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 425, 104)) +>aeneus : Symbol(carolinensis.aeneus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 425, 104)) >howi : Symbol(howi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 466, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 681, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 886, 1)) >marcanoi : Symbol(howi.marcanoi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 682, 13)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 426, 37)) @@ -5729,7 +5729,7 @@ module quasiater { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 426, 37)) aloysiisabaudiae(): argurus.netscheri, lavali.lepturus> { var x: argurus.netscheri, lavali.lepturus>; () => { var y = this; }; return x; } ->aloysiisabaudiae : Symbol(aloysiisabaudiae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 426, 92)) +>aloysiisabaudiae : Symbol(carolinensis.aloysiisabaudiae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 426, 92)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) >netscheri : Symbol(argurus.netscheri, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 943, 16)) >trivirgatus : Symbol(trivirgatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 186, 1)) @@ -5756,7 +5756,7 @@ module quasiater { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 427, 116)) tenellus(): julianae.nudicaudus { var x: julianae.nudicaudus; () => { var y = this; }; return x; } ->tenellus : Symbol(tenellus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 427, 240)) +>tenellus : Symbol(carolinensis.tenellus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 427, 240)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) >nudicaudus : Symbol(julianae.nudicaudus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 18, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 428, 45)) @@ -5767,7 +5767,7 @@ module quasiater { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 428, 45)) andium(): lavali.beisa { var x: lavali.beisa; () => { var y = this; }; return x; } ->andium : Symbol(andium, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 428, 106)) +>andium : Symbol(carolinensis.andium, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 428, 106)) >lavali : Symbol(lavali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 252, 1)) >beisa : Symbol(lavali.beisa, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 268, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 429, 36)) @@ -5778,7 +5778,7 @@ module quasiater { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 429, 36)) persephone(): panglima.fundatus { var x: panglima.fundatus; () => { var y = this; }; return x; } ->persephone : Symbol(persephone, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 429, 90)) +>persephone : Symbol(carolinensis.persephone, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 429, 90)) >panglima : Symbol(panglima, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 400, 1)) >fundatus : Symbol(panglima.fundatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 409, 5)) >samarensis : Symbol(samarensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 531, 1)) @@ -5797,7 +5797,7 @@ module quasiater { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 430, 86)) patrizii(): Lanthanum.megalonyx { var x: Lanthanum.megalonyx; () => { var y = this; }; return x; } ->patrizii : Symbol(patrizii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 430, 186)) +>patrizii : Symbol(carolinensis.patrizii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 430, 186)) >Lanthanum : Symbol(Lanthanum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 106, 1)) >megalonyx : Symbol(Lanthanum.megalonyx, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 124, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 431, 45)) @@ -5820,7 +5820,7 @@ module minutus { >punicus : Symbol(lutreolus.punicus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 720, 18)) simoni(): argurus.netscheri> { var x: argurus.netscheri>; () => { var y = this; }; return x; } ->simoni : Symbol(simoni, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 435, 63)) +>simoni : Symbol(himalayana.simoni, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 435, 63)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) >netscheri : Symbol(argurus.netscheri, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 943, 16)) >lavali : Symbol(lavali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 252, 1)) @@ -5847,7 +5847,7 @@ module minutus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 436, 115)) lobata(): samarensis.pallidus { var x: samarensis.pallidus; () => { var y = this; }; return x; } ->lobata : Symbol(lobata, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 436, 248)) +>lobata : Symbol(himalayana.lobata, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 436, 248)) >samarensis : Symbol(samarensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 531, 1)) >pallidus : Symbol(samarensis.pallidus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 563, 5)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 437, 43)) @@ -5858,7 +5858,7 @@ module minutus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 437, 43)) rusticus(): dogramacii.aurata { var x: dogramacii.aurata; () => { var y = this; }; return x; } ->rusticus : Symbol(rusticus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 437, 104)) +>rusticus : Symbol(himalayana.rusticus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 437, 104)) >dogramacii : Symbol(dogramacii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 314, 1)) >aurata : Symbol(dogramacii.aurata, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 344, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 438, 43)) @@ -5869,7 +5869,7 @@ module minutus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 438, 43)) latona(): daubentonii.nesiotes { var x: daubentonii.nesiotes; () => { var y = this; }; return x; } ->latona : Symbol(latona, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 438, 102)) +>latona : Symbol(himalayana.latona, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 438, 102)) >daubentonii : Symbol(daubentonii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 471, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 586, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 636, 1)) >nesiotes : Symbol(daubentonii.nesiotes, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 472, 20)) >dammermani : Symbol(dammermani, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 591, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 913, 1)) @@ -5888,7 +5888,7 @@ module minutus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 439, 86)) famulus(): patas.uralensis { var x: patas.uralensis; () => { var y = this; }; return x; } ->famulus : Symbol(famulus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 439, 190)) +>famulus : Symbol(himalayana.famulus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 439, 190)) >patas : Symbol(patas, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 652, 1)) >uralensis : Symbol(patas.uralensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 653, 14)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 440, 40)) @@ -5899,7 +5899,7 @@ module minutus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 440, 40)) flaviceps(): minutus.inez> { var x: minutus.inez>; () => { var y = this; }; return x; } ->flaviceps : Symbol(flaviceps, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 440, 97)) +>flaviceps : Symbol(himalayana.flaviceps, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 440, 97)) >minutus : Symbol(minutus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 433, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 492, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 848, 1)) >inez : Symbol(inez, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 493, 16)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) @@ -5926,7 +5926,7 @@ module minutus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 441, 109)) paradoxolophus(): nigra.dolichurus> { var x: nigra.dolichurus>; () => { var y = this; }; return x; } ->paradoxolophus : Symbol(paradoxolophus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 441, 233)) +>paradoxolophus : Symbol(himalayana.paradoxolophus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 441, 233)) >nigra : Symbol(nigra, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 388, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 475, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 514, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 762, 1)) >dolichurus : Symbol(nigra.dolichurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 389, 14)) >lutreolus : Symbol(lutreolus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 355, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 719, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 855, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 872, 1)) @@ -5953,7 +5953,7 @@ module minutus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 442, 139)) Osmium(): lavali.wilsoni { var x: lavali.wilsoni; () => { var y = this; }; return x; } ->Osmium : Symbol(Osmium, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 442, 288)) +>Osmium : Symbol(himalayana.Osmium, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 442, 288)) >lavali : Symbol(lavali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 252, 1)) >wilsoni : Symbol(lavali.wilsoni, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 253, 15)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 443, 38)) @@ -5964,7 +5964,7 @@ module minutus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 443, 38)) vulgaris(): Lanthanum.nitidus { var x: Lanthanum.nitidus; () => { var y = this; }; return x; } ->vulgaris : Symbol(vulgaris, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 443, 94)) +>vulgaris : Symbol(himalayana.vulgaris, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 443, 94)) >Lanthanum : Symbol(Lanthanum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 106, 1)) >nitidus : Symbol(Lanthanum.nitidus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 112, 3)) >lavali : Symbol(lavali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 252, 1)) @@ -5983,7 +5983,7 @@ module minutus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 444, 81)) betsileoensis(): panglima.amphibius { var x: panglima.amphibius; () => { var y = this; }; return x; } ->betsileoensis : Symbol(betsileoensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 444, 178)) +>betsileoensis : Symbol(himalayana.betsileoensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 444, 178)) >panglima : Symbol(panglima, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 400, 1)) >amphibius : Symbol(panglima.amphibius, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 401, 17)) >caurinus : Symbol(caurinus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 449, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 836, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 976, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1007, 1)) @@ -6002,7 +6002,7 @@ module minutus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 445, 88)) vespuccii(): argurus.gilbertii, provocax.melanoleuca> { var x: argurus.gilbertii, provocax.melanoleuca>; () => { var y = this; }; return x; } ->vespuccii : Symbol(vespuccii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 445, 187)) +>vespuccii : Symbol(himalayana.vespuccii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 445, 187)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) >gilbertii : Symbol(argurus.gilbertii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 700, 16)) >gabriellae : Symbol(gabriellae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 766, 1)) @@ -6029,7 +6029,7 @@ module minutus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 446, 135)) olympus(): Lanthanum.megalonyx { var x: Lanthanum.megalonyx; () => { var y = this; }; return x; } ->olympus : Symbol(olympus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 446, 285)) +>olympus : Symbol(himalayana.olympus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 446, 285)) >Lanthanum : Symbol(Lanthanum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 106, 1)) >megalonyx : Symbol(Lanthanum.megalonyx, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 124, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 447, 44)) @@ -6056,7 +6056,7 @@ module caurinus { >daphaenodon : Symbol(macrorhinos.daphaenodon, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 737, 20)) martiniquensis(): ruatanica.hector>> { var x: ruatanica.hector>>; () => { var y = this; }; return x; } ->martiniquensis : Symbol(martiniquensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 451, 111)) +>martiniquensis : Symbol(mahaganus.martiniquensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 451, 111)) >ruatanica : Symbol(ruatanica, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 100, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 244, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 959, 1)) >hector : Symbol(ruatanica.hector, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 101, 18)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) @@ -6091,7 +6091,7 @@ module caurinus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 452, 168)) devius(): samarensis.pelurus, trivirgatus.falconeri>> { var x: samarensis.pelurus, trivirgatus.falconeri>>; () => { var y = this; }; return x; } ->devius : Symbol(devius, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 452, 346)) +>devius : Symbol(mahaganus.devius, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 452, 346)) >samarensis : Symbol(samarensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 531, 1)) >pelurus : Symbol(samarensis.pelurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 532, 19)) >dogramacii : Symbol(dogramacii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 314, 1)) @@ -6126,7 +6126,7 @@ module caurinus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 453, 153)) masalai(): argurus.oreas { var x: argurus.oreas; () => { var y = this; }; return x; } ->masalai : Symbol(masalai, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 453, 324)) +>masalai : Symbol(mahaganus.masalai, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 453, 324)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) >oreas : Symbol(argurus.oreas, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 625, 16)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 454, 38)) @@ -6137,7 +6137,7 @@ module caurinus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 454, 38)) kathleenae(): nigra.dolichurus { var x: nigra.dolichurus; () => { var y = this; }; return x; } ->kathleenae : Symbol(kathleenae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 454, 93)) +>kathleenae : Symbol(mahaganus.kathleenae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 454, 93)) >nigra : Symbol(nigra, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 388, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 475, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 514, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 762, 1)) >dolichurus : Symbol(nigra.dolichurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 389, 14)) >patas : Symbol(patas, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 652, 1)) @@ -6156,7 +6156,7 @@ module caurinus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 455, 80)) simulus(): gabriellae.echinatus { var x: gabriellae.echinatus; () => { var y = this; }; return x; } ->simulus : Symbol(simulus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 455, 174)) +>simulus : Symbol(mahaganus.simulus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 455, 174)) >gabriellae : Symbol(gabriellae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 766, 1)) >echinatus : Symbol(gabriellae.echinatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 781, 5)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 456, 45)) @@ -6167,7 +6167,7 @@ module caurinus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 456, 45)) nigrovittatus(): caurinus.mahaganus>> { var x: caurinus.mahaganus>>; () => { var y = this; }; return x; } ->nigrovittatus : Symbol(nigrovittatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 456, 107)) +>nigrovittatus : Symbol(mahaganus.nigrovittatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 456, 107)) >caurinus : Symbol(caurinus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 449, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 836, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 976, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1007, 1)) >mahaganus : Symbol(mahaganus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 450, 17)) >gabriellae : Symbol(gabriellae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 766, 1)) @@ -6202,7 +6202,7 @@ module caurinus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 457, 165)) senegalensis(): gabriellae.klossii, dammermani.melanops> { var x: gabriellae.klossii, dammermani.melanops>; () => { var y = this; }; return x; } ->senegalensis : Symbol(senegalensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 457, 341)) +>senegalensis : Symbol(mahaganus.senegalensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 457, 341)) >gabriellae : Symbol(gabriellae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 766, 1)) >klossii : Symbol(gabriellae.klossii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 767, 19)) >howi : Symbol(howi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 466, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 681, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 886, 1)) @@ -6229,7 +6229,7 @@ module caurinus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 458, 118)) acticola(): argurus.luctuosa { var x: argurus.luctuosa; () => { var y = this; }; return x; } ->acticola : Symbol(acticola, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 458, 248)) +>acticola : Symbol(mahaganus.acticola, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 458, 248)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) >luctuosa : Symbol(argurus.luctuosa, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 982, 16)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 459, 42)) @@ -6249,7 +6249,7 @@ module macrorhinos { >T1 : Symbol(T1, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 463, 31)) tansaniana(): lutreolus.punicus { var x: lutreolus.punicus; () => { var y = this; }; return x; } ->tansaniana : Symbol(tansaniana, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 463, 37)) +>tansaniana : Symbol(marmosurus.tansaniana, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 463, 37)) >lutreolus : Symbol(lutreolus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 355, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 719, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 855, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 872, 1)) >punicus : Symbol(lutreolus.punicus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 720, 18)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 464, 45)) @@ -6272,7 +6272,7 @@ module howi { >stolzmanni : Symbol(sagitta.stolzmanni, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 899, 16)) pennatus(): howi.marcanoi { var x: howi.marcanoi; () => { var y = this; }; return x; } ->pennatus : Symbol(pennatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 468, 63)) +>pennatus : Symbol(angulatus.pennatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 468, 63)) >howi : Symbol(howi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 466, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 681, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 886, 1)) >marcanoi : Symbol(marcanoi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 682, 13)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 469, 39)) @@ -6301,7 +6301,7 @@ module nigra { >T1 : Symbol(T1, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 477, 27)) dichotomus(): quasiater.carolinensis { var x: quasiater.carolinensis; () => { var y = this; }; return x; } ->dichotomus : Symbol(dichotomus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 477, 33)) +>dichotomus : Symbol(thalia.dichotomus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 477, 33)) >quasiater : Symbol(quasiater, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 236, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 422, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 813, 1)) >carolinensis : Symbol(quasiater.carolinensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 423, 18)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 478, 50)) @@ -6312,7 +6312,7 @@ module nigra { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 478, 50)) arnuxii(): panamensis.linulus, lavali.beisa> { var x: panamensis.linulus, lavali.beisa>; () => { var y = this; }; return x; } ->arnuxii : Symbol(arnuxii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 478, 114)) +>arnuxii : Symbol(thalia.arnuxii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 478, 114)) >panamensis : Symbol(panamensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 501, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 986, 1)) >linulus : Symbol(panamensis.linulus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 502, 19)) >trivirgatus : Symbol(trivirgatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 186, 1)) @@ -6339,7 +6339,7 @@ module nigra { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 479, 110)) verheyeni(): lavali.xanthognathus { var x: lavali.xanthognathus; () => { var y = this; }; return x; } ->verheyeni : Symbol(verheyeni, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 479, 237)) +>verheyeni : Symbol(thalia.verheyeni, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 479, 237)) >lavali : Symbol(lavali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 252, 1)) >xanthognathus : Symbol(lavali.xanthognathus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 285, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 480, 47)) @@ -6350,7 +6350,7 @@ module nigra { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 480, 47)) dauuricus(): gabriellae.amicus { var x: gabriellae.amicus; () => { var y = this; }; return x; } ->dauuricus : Symbol(dauuricus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 480, 109)) +>dauuricus : Symbol(thalia.dauuricus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 480, 109)) >gabriellae : Symbol(gabriellae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 766, 1)) >amicus : Symbol(gabriellae.amicus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 769, 5)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 481, 44)) @@ -6361,7 +6361,7 @@ module nigra { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 481, 44)) tristriatus(): rionegrensis.veraecrucis> { var x: rionegrensis.veraecrucis>; () => { var y = this; }; return x; } ->tristriatus : Symbol(tristriatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 481, 103)) +>tristriatus : Symbol(thalia.tristriatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 481, 103)) >rionegrensis : Symbol(rionegrensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 0, 0)) >veraecrucis : Symbol(rionegrensis.veraecrucis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 7, 3)) >howi : Symbol(howi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 466, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 681, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 886, 1)) @@ -6388,7 +6388,7 @@ module nigra { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 482, 124)) lasiura(): panglima.abidi>, Lanthanum.nitidus> { var x: panglima.abidi>, Lanthanum.nitidus>; () => { var y = this; }; return x; } ->lasiura : Symbol(lasiura, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 482, 261)) +>lasiura : Symbol(thalia.lasiura, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 482, 261)) >panglima : Symbol(panglima, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 400, 1)) >abidi : Symbol(panglima.abidi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 414, 5)) >samarensis : Symbol(samarensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 531, 1)) @@ -6431,7 +6431,7 @@ module nigra { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 483, 201)) gangetica(): argurus.luctuosa { var x: argurus.luctuosa; () => { var y = this; }; return x; } ->gangetica : Symbol(gangetica, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 483, 419)) +>gangetica : Symbol(thalia.gangetica, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 483, 419)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) >luctuosa : Symbol(argurus.luctuosa, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 982, 16)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 484, 43)) @@ -6442,7 +6442,7 @@ module nigra { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 484, 43)) brucei(): chrysaeolus.sarasinorum { var x: chrysaeolus.sarasinorum; () => { var y = this; }; return x; } ->brucei : Symbol(brucei, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 484, 101)) +>brucei : Symbol(thalia.brucei, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 484, 101)) >chrysaeolus : Symbol(chrysaeolus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 602, 1)) >sarasinorum : Symbol(chrysaeolus.sarasinorum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 603, 20)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) @@ -6471,7 +6471,7 @@ module sagitta { >portoricensis : Symbol(minutus.portoricensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 849, 16)) maracajuensis(): samarensis.cahirinus { var x: samarensis.cahirinus; () => { var y = this; }; return x; } ->maracajuensis : Symbol(maracajuensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 489, 56)) +>maracajuensis : Symbol(walkeri.maracajuensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 489, 56)) >samarensis : Symbol(samarensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 531, 1)) >cahirinus : Symbol(samarensis.cahirinus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 569, 5)) >Lanthanum : Symbol(Lanthanum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 106, 1)) @@ -6506,7 +6506,7 @@ module minutus { >durangae : Symbol(julianae.durangae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 94, 3)) vexillaris(): samarensis.cahirinus { var x: samarensis.cahirinus; () => { var y = this; }; return x; } ->vexillaris : Symbol(vexillaris, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 494, 95)) +>vexillaris : Symbol(inez.vexillaris, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 494, 95)) >samarensis : Symbol(samarensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 531, 1)) >cahirinus : Symbol(samarensis.cahirinus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 569, 5)) >lavali : Symbol(lavali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 252, 1)) @@ -6559,7 +6559,7 @@ module panamensis { >walkeri : Symbol(sagitta.walkeri, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 488, 16)) goslingi(): daubentonii.arboreus { var x: daubentonii.arboreus; () => { var y = this; }; return x; } ->goslingi : Symbol(goslingi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 503, 137)) +>goslingi : Symbol(linulus.goslingi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 503, 137)) >daubentonii : Symbol(daubentonii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 471, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 586, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 636, 1)) >arboreus : Symbol(daubentonii.arboreus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 637, 20)) >gabriellae : Symbol(gabriellae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 766, 1)) @@ -6578,7 +6578,7 @@ module panamensis { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 504, 85)) taki(): patas.uralensis { var x: patas.uralensis; () => { var y = this; }; return x; } ->taki : Symbol(taki, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 504, 186)) +>taki : Symbol(linulus.taki, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 504, 186)) >patas : Symbol(patas, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 652, 1)) >uralensis : Symbol(patas.uralensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 653, 14)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 505, 37)) @@ -6589,7 +6589,7 @@ module panamensis { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 505, 37)) fumosus(): rendalli.moojeni, lavali.beisa> { var x: rendalli.moojeni, lavali.beisa>; () => { var y = this; }; return x; } ->fumosus : Symbol(fumosus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 505, 94)) +>fumosus : Symbol(linulus.fumosus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 505, 94)) >rendalli : Symbol(rendalli, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 151, 1)) >moojeni : Symbol(rendalli.moojeni, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 168, 3)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) @@ -6616,7 +6616,7 @@ module panamensis { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 506, 112)) rufinus(): macrorhinos.konganensis { var x: macrorhinos.konganensis; () => { var y = this; }; return x; } ->rufinus : Symbol(rufinus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 506, 241)) +>rufinus : Symbol(linulus.rufinus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 506, 241)) >macrorhinos : Symbol(macrorhinos, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 461, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 497, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 736, 1)) >konganensis : Symbol(macrorhinos.konganensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 498, 20)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 507, 48)) @@ -6627,7 +6627,7 @@ module panamensis { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 507, 48)) lami(): nigra.thalia { var x: nigra.thalia; () => { var y = this; }; return x; } ->lami : Symbol(lami, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 507, 113)) +>lami : Symbol(linulus.lami, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 507, 113)) >nigra : Symbol(nigra, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 388, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 475, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 514, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 762, 1)) >thalia : Symbol(nigra.thalia, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 476, 14)) >patas : Symbol(patas, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 652, 1)) @@ -6646,7 +6646,7 @@ module panamensis { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 508, 74)) regina(): trivirgatus.oconnelli { var x: trivirgatus.oconnelli; () => { var y = this; }; return x; } ->regina : Symbol(regina, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 508, 168)) +>regina : Symbol(linulus.regina, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 508, 168)) >trivirgatus : Symbol(trivirgatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 186, 1)) >oconnelli : Symbol(trivirgatus.oconnelli, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 219, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 509, 45)) @@ -6657,7 +6657,7 @@ module panamensis { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 509, 45)) nanilla(): dammermani.siberu { var x: dammermani.siberu; () => { var y = this; }; return x; } ->nanilla : Symbol(nanilla, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 509, 108)) +>nanilla : Symbol(linulus.nanilla, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 509, 108)) >dammermani : Symbol(dammermani, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 591, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 913, 1)) >siberu : Symbol(dammermani.siberu, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 592, 19)) >lavali : Symbol(lavali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 252, 1)) @@ -6676,7 +6676,7 @@ module panamensis { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 510, 87)) enganus(): petrophilus.sodyi { var x: petrophilus.sodyi; () => { var y = this; }; return x; } ->enganus : Symbol(enganus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 510, 191)) +>enganus : Symbol(linulus.enganus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 510, 191)) >petrophilus : Symbol(petrophilus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 715, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 823, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 998, 1)) >sodyi : Symbol(petrophilus.sodyi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 824, 20)) >dogramacii : Symbol(dogramacii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 314, 1)) @@ -6695,7 +6695,7 @@ module panamensis { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 511, 76)) gomantongensis(): rionegrensis.veraecrucis> { var x: rionegrensis.veraecrucis>; () => { var y = this; }; return x; } ->gomantongensis : Symbol(gomantongensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 511, 169)) +>gomantongensis : Symbol(linulus.gomantongensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 511, 169)) >rionegrensis : Symbol(rionegrensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 0, 0)) >veraecrucis : Symbol(rionegrensis.veraecrucis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 7, 3)) >caurinus : Symbol(caurinus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 449, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 836, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 976, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1007, 1)) @@ -6731,7 +6731,7 @@ module nigra { >T1 : Symbol(T1, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 516, 29)) weddellii(): nigra.dolichurus { var x: nigra.dolichurus; () => { var y = this; }; return x; } ->weddellii : Symbol(weddellii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 516, 35)) +>weddellii : Symbol(gracilis.weddellii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 516, 35)) >nigra : Symbol(nigra, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 388, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 475, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 514, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 762, 1)) >dolichurus : Symbol(dolichurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 389, 14)) >dogramacii : Symbol(dogramacii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 314, 1)) @@ -6750,7 +6750,7 @@ module nigra { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 517, 80)) echinothrix(): Lanthanum.nitidus, argurus.oreas> { var x: Lanthanum.nitidus, argurus.oreas>; () => { var y = this; }; return x; } ->echinothrix : Symbol(echinothrix, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 517, 175)) +>echinothrix : Symbol(gracilis.echinothrix, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 517, 175)) >Lanthanum : Symbol(Lanthanum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 106, 1)) >nitidus : Symbol(Lanthanum.nitidus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 112, 3)) >panglima : Symbol(panglima, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 400, 1)) @@ -6777,7 +6777,7 @@ module nigra { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 518, 120)) garridoi(): dogramacii.koepckeae { var x: dogramacii.koepckeae; () => { var y = this; }; return x; } ->garridoi : Symbol(garridoi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 518, 253)) +>garridoi : Symbol(gracilis.garridoi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 518, 253)) >dogramacii : Symbol(dogramacii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 314, 1)) >koepckeae : Symbol(dogramacii.koepckeae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 326, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 519, 46)) @@ -6788,7 +6788,7 @@ module nigra { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 519, 46)) rouxii(): nigra.gracilis, nigra.thalia> { var x: nigra.gracilis, nigra.thalia>; () => { var y = this; }; return x; } ->rouxii : Symbol(rouxii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 519, 108)) +>rouxii : Symbol(gracilis.rouxii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 519, 108)) >nigra : Symbol(nigra, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 388, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 475, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 514, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 762, 1)) >gracilis : Symbol(gracilis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 515, 14)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) @@ -6823,7 +6823,7 @@ module nigra { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 520, 153)) aurita(): sagitta.stolzmanni { var x: sagitta.stolzmanni; () => { var y = this; }; return x; } ->aurita : Symbol(aurita, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 520, 324)) +>aurita : Symbol(gracilis.aurita, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 520, 324)) >sagitta : Symbol(sagitta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 487, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 577, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 675, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 746, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 898, 1)) >stolzmanni : Symbol(sagitta.stolzmanni, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 899, 16)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 521, 42)) @@ -6834,7 +6834,7 @@ module nigra { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 521, 42)) geoffrensis(): rionegrensis.caniventer { var x: rionegrensis.caniventer; () => { var y = this; }; return x; } ->geoffrensis : Symbol(geoffrensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 521, 102)) +>geoffrensis : Symbol(gracilis.geoffrensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 521, 102)) >rionegrensis : Symbol(rionegrensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 0, 0)) >caniventer : Symbol(rionegrensis.caniventer, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 0, 21)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 522, 52)) @@ -6845,7 +6845,7 @@ module nigra { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 522, 52)) theresa(): macrorhinos.marmosurus, argurus.luctuosa>, nigra.dolichurus> { var x: macrorhinos.marmosurus, argurus.luctuosa>, nigra.dolichurus>; () => { var y = this; }; return x; } ->theresa : Symbol(theresa, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 522, 117)) +>theresa : Symbol(gracilis.theresa, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 522, 117)) >macrorhinos : Symbol(macrorhinos, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 461, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 497, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 736, 1)) >marmosurus : Symbol(macrorhinos.marmosurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 462, 20)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) @@ -6888,7 +6888,7 @@ module nigra { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 523, 197)) melanocarpus(): julianae.albidens, julianae.sumatrana> { var x: julianae.albidens, julianae.sumatrana>; () => { var y = this; }; return x; } ->melanocarpus : Symbol(melanocarpus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 523, 411)) +>melanocarpus : Symbol(gracilis.melanocarpus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 523, 411)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) >albidens : Symbol(julianae.albidens, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 34, 3)) >dammermani : Symbol(dammermani, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 591, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 913, 1)) @@ -6915,7 +6915,7 @@ module nigra { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 524, 124)) dubiaquercus(): dogramacii.robustulus { var x: dogramacii.robustulus; () => { var y = this; }; return x; } ->dubiaquercus : Symbol(dubiaquercus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 524, 260)) +>dubiaquercus : Symbol(gracilis.dubiaquercus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 524, 260)) >dogramacii : Symbol(dogramacii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 314, 1)) >robustulus : Symbol(dogramacii.robustulus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 315, 19)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 525, 51)) @@ -6926,7 +6926,7 @@ module nigra { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 525, 51)) pectoralis(): julianae.sumatrana { var x: julianae.sumatrana; () => { var y = this; }; return x; } ->pectoralis : Symbol(pectoralis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 525, 114)) +>pectoralis : Symbol(gracilis.pectoralis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 525, 114)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) >sumatrana : Symbol(julianae.sumatrana, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 58, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 526, 46)) @@ -6937,7 +6937,7 @@ module nigra { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 526, 46)) apoensis(): caurinus.megaphyllus { var x: caurinus.megaphyllus; () => { var y = this; }; return x; } ->apoensis : Symbol(apoensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 526, 106)) +>apoensis : Symbol(gracilis.apoensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 526, 106)) >caurinus : Symbol(caurinus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 449, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 836, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 976, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1007, 1)) >megaphyllus : Symbol(caurinus.megaphyllus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 837, 17)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 527, 46)) @@ -6948,7 +6948,7 @@ module nigra { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 527, 46)) grisescens(): Lanthanum.jugularis { var x: Lanthanum.jugularis; () => { var y = this; }; return x; } ->grisescens : Symbol(grisescens, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 527, 108)) +>grisescens : Symbol(gracilis.grisescens, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 527, 108)) >Lanthanum : Symbol(Lanthanum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 106, 1)) >jugularis : Symbol(Lanthanum.jugularis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 134, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 528, 47)) @@ -6959,7 +6959,7 @@ module nigra { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 528, 47)) ramirohitra(): panglima.amphibius { var x: panglima.amphibius; () => { var y = this; }; return x; } ->ramirohitra : Symbol(ramirohitra, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 528, 108)) +>ramirohitra : Symbol(gracilis.ramirohitra, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 528, 108)) >panglima : Symbol(panglima, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 400, 1)) >amphibius : Symbol(panglima.amphibius, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 401, 17)) >trivirgatus : Symbol(trivirgatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 186, 1)) @@ -6990,7 +6990,7 @@ module samarensis { >stolzmanni : Symbol(sagitta.stolzmanni, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 899, 16)) Palladium(): panamensis.linulus { var x: panamensis.linulus; () => { var y = this; }; return x; } ->Palladium : Symbol(Palladium, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 533, 61)) +>Palladium : Symbol(pelurus.Palladium, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 533, 61)) >panamensis : Symbol(panamensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 501, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 986, 1)) >linulus : Symbol(panamensis.linulus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 502, 19)) >macrorhinos : Symbol(macrorhinos, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 461, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 497, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 736, 1)) @@ -7009,7 +7009,7 @@ module samarensis { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 534, 95)) castanea(): argurus.netscheri, julianae.oralis> { var x: argurus.netscheri, julianae.oralis>; () => { var y = this; }; return x; } ->castanea : Symbol(castanea, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 534, 205)) +>castanea : Symbol(pelurus.castanea, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 534, 205)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) >netscheri : Symbol(argurus.netscheri, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 943, 16)) >minutus : Symbol(minutus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 433, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 492, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 848, 1)) @@ -7044,7 +7044,7 @@ module samarensis { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 535, 152)) chamek(): argurus.pygmaea { var x: argurus.pygmaea; () => { var y = this; }; return x; } ->chamek : Symbol(chamek, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 535, 320)) +>chamek : Symbol(pelurus.chamek, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 535, 320)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) >pygmaea : Symbol(argurus.pygmaea, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 596, 16)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) @@ -7063,7 +7063,7 @@ module samarensis { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 536, 85)) nigriceps(): lutreolus.punicus { var x: lutreolus.punicus; () => { var y = this; }; return x; } ->nigriceps : Symbol(nigriceps, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 536, 188)) +>nigriceps : Symbol(pelurus.nigriceps, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 536, 188)) >lutreolus : Symbol(lutreolus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 355, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 719, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 855, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 872, 1)) >punicus : Symbol(lutreolus.punicus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 720, 18)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 537, 44)) @@ -7074,7 +7074,7 @@ module samarensis { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 537, 44)) lunatus(): pelurus { var x: pelurus; () => { var y = this; }; return x; } ->lunatus : Symbol(lunatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 537, 103)) +>lunatus : Symbol(pelurus.lunatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 537, 103)) >pelurus : Symbol(pelurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 532, 19)) >Lanthanum : Symbol(Lanthanum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 106, 1)) >jugularis : Symbol(Lanthanum.jugularis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 134, 3)) @@ -7091,7 +7091,7 @@ module samarensis { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 538, 70)) madurae(): rionegrensis.caniventer { var x: rionegrensis.caniventer; () => { var y = this; }; return x; } ->madurae : Symbol(madurae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 538, 157)) +>madurae : Symbol(pelurus.madurae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 538, 157)) >rionegrensis : Symbol(rionegrensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 0, 0)) >caniventer : Symbol(rionegrensis.caniventer, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 0, 21)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 539, 48)) @@ -7102,7 +7102,7 @@ module samarensis { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 539, 48)) chinchilla(): macrorhinos.daphaenodon { var x: macrorhinos.daphaenodon; () => { var y = this; }; return x; } ->chinchilla : Symbol(chinchilla, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 539, 113)) +>chinchilla : Symbol(pelurus.chinchilla, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 539, 113)) >macrorhinos : Symbol(macrorhinos, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 461, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 497, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 736, 1)) >daphaenodon : Symbol(macrorhinos.daphaenodon, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 737, 20)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 540, 51)) @@ -7113,7 +7113,7 @@ module samarensis { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 540, 51)) eliasi(): petrophilus.rosalia { var x: petrophilus.rosalia; () => { var y = this; }; return x; } ->eliasi : Symbol(eliasi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 540, 116)) +>eliasi : Symbol(pelurus.eliasi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 540, 116)) >petrophilus : Symbol(petrophilus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 715, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 823, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 998, 1)) >rosalia : Symbol(petrophilus.rosalia, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 999, 20)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) @@ -7132,7 +7132,7 @@ module samarensis { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 541, 75)) proditor(): panamensis.setulosus { var x: panamensis.setulosus; () => { var y = this; }; return x; } ->proditor : Symbol(proditor, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 541, 168)) +>proditor : Symbol(pelurus.proditor, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 541, 168)) >panamensis : Symbol(panamensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 501, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 986, 1)) >setulosus : Symbol(panamensis.setulosus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 987, 19)) >gabriellae : Symbol(gabriellae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 766, 1)) @@ -7151,7 +7151,7 @@ module samarensis { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 542, 86)) gambianus(): quasiater.wattsi> { var x: quasiater.wattsi>; () => { var y = this; }; return x; } ->gambianus : Symbol(gambianus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 542, 188)) +>gambianus : Symbol(pelurus.gambianus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 542, 188)) >quasiater : Symbol(quasiater, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 236, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 422, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 813, 1)) >wattsi : Symbol(quasiater.wattsi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 814, 18)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) @@ -7178,7 +7178,7 @@ module samarensis { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 543, 134)) petteri(): dogramacii.kaiseri { var x: dogramacii.kaiseri; () => { var y = this; }; return x; } ->petteri : Symbol(petteri, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 543, 283)) +>petteri : Symbol(pelurus.petteri, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 543, 283)) >dogramacii : Symbol(dogramacii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 314, 1)) >kaiseri : Symbol(dogramacii.kaiseri, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 329, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 544, 43)) @@ -7189,7 +7189,7 @@ module samarensis { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 544, 43)) nusatenggara(): panglima.amphibius { var x: panglima.amphibius; () => { var y = this; }; return x; } ->nusatenggara : Symbol(nusatenggara, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 544, 103)) +>nusatenggara : Symbol(pelurus.nusatenggara, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 544, 103)) >panglima : Symbol(panglima, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 400, 1)) >amphibius : Symbol(panglima.amphibius, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 401, 17)) >lavali : Symbol(lavali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 252, 1)) @@ -7208,7 +7208,7 @@ module samarensis { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 545, 89)) olitor(): rionegrensis.veraecrucis { var x: rionegrensis.veraecrucis; () => { var y = this; }; return x; } ->olitor : Symbol(olitor, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 545, 190)) +>olitor : Symbol(pelurus.olitor, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 545, 190)) >rionegrensis : Symbol(rionegrensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 0, 0)) >veraecrucis : Symbol(rionegrensis.veraecrucis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 7, 3)) >lavali : Symbol(lavali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 252, 1)) @@ -7235,7 +7235,7 @@ module samarensis { >daphaenodon : Symbol(macrorhinos.daphaenodon, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 737, 20)) planifrons(): nigra.gracilis { var x: nigra.gracilis; () => { var y = this; }; return x; } ->planifrons : Symbol(planifrons, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 548, 65)) +>planifrons : Symbol(fuscus.planifrons, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 548, 65)) >nigra : Symbol(nigra, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 388, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 475, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 514, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 762, 1)) >gracilis : Symbol(nigra.gracilis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 515, 14)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) @@ -7254,7 +7254,7 @@ module samarensis { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 549, 82)) badia(): julianae.sumatrana { var x: julianae.sumatrana; () => { var y = this; }; return x; } ->badia : Symbol(badia, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 549, 178)) +>badia : Symbol(fuscus.badia, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 549, 178)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) >sumatrana : Symbol(julianae.sumatrana, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 58, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 550, 41)) @@ -7265,7 +7265,7 @@ module samarensis { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 550, 41)) prymnolopha(): sagitta.walkeri { var x: sagitta.walkeri; () => { var y = this; }; return x; } ->prymnolopha : Symbol(prymnolopha, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 550, 101)) +>prymnolopha : Symbol(fuscus.prymnolopha, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 550, 101)) >sagitta : Symbol(sagitta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 487, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 577, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 675, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 746, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 898, 1)) >walkeri : Symbol(sagitta.walkeri, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 488, 16)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 551, 44)) @@ -7276,7 +7276,7 @@ module samarensis { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 551, 44)) natalensis(): trivirgatus.falconeri { var x: trivirgatus.falconeri; () => { var y = this; }; return x; } ->natalensis : Symbol(natalensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 551, 101)) +>natalensis : Symbol(fuscus.natalensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 551, 101)) >trivirgatus : Symbol(trivirgatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 186, 1)) >falconeri : Symbol(trivirgatus.falconeri, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 210, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 552, 49)) @@ -7287,7 +7287,7 @@ module samarensis { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 552, 49)) hunteri(): julianae.durangae { var x: julianae.durangae; () => { var y = this; }; return x; } ->hunteri : Symbol(hunteri, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 552, 112)) +>hunteri : Symbol(fuscus.hunteri, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 552, 112)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) >durangae : Symbol(julianae.durangae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 94, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 553, 42)) @@ -7298,7 +7298,7 @@ module samarensis { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 553, 42)) sapiens(): pallidus { var x: pallidus; () => { var y = this; }; return x; } ->sapiens : Symbol(sapiens, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 553, 101)) +>sapiens : Symbol(fuscus.sapiens, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 553, 101)) >pallidus : Symbol(pallidus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 563, 5)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 554, 33)) >pallidus : Symbol(pallidus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 563, 5)) @@ -7307,7 +7307,7 @@ module samarensis { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 554, 33)) macrocercus(): panamensis.setulosus { var x: panamensis.setulosus; () => { var y = this; }; return x; } ->macrocercus : Symbol(macrocercus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 554, 83)) +>macrocercus : Symbol(fuscus.macrocercus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 554, 83)) >panamensis : Symbol(panamensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 501, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 986, 1)) >setulosus : Symbol(panamensis.setulosus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 987, 19)) >dogramacii : Symbol(dogramacii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 314, 1)) @@ -7326,7 +7326,7 @@ module samarensis { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 555, 91)) nimbae(): lutreolus.punicus { var x: lutreolus.punicus; () => { var y = this; }; return x; } ->nimbae : Symbol(nimbae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 555, 195)) +>nimbae : Symbol(fuscus.nimbae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 555, 195)) >lutreolus : Symbol(lutreolus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 355, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 719, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 855, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 872, 1)) >punicus : Symbol(lutreolus.punicus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 720, 18)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 556, 41)) @@ -7337,7 +7337,7 @@ module samarensis { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 556, 41)) suricatta(): daubentonii.nigricans { var x: daubentonii.nigricans; () => { var y = this; }; return x; } ->suricatta : Symbol(suricatta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 556, 100)) +>suricatta : Symbol(fuscus.suricatta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 556, 100)) >daubentonii : Symbol(daubentonii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 471, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 586, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 636, 1)) >nigricans : Symbol(daubentonii.nigricans, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 587, 20)) >dammermani : Symbol(dammermani, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 591, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 913, 1)) @@ -7356,7 +7356,7 @@ module samarensis { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 557, 93)) jagorii(): julianae.galapagoensis { var x: julianae.galapagoensis; () => { var y = this; }; return x; } ->jagorii : Symbol(jagorii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 557, 201)) +>jagorii : Symbol(fuscus.jagorii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 557, 201)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) >galapagoensis : Symbol(julianae.galapagoensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 25, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 558, 47)) @@ -7367,7 +7367,7 @@ module samarensis { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 558, 47)) beecrofti(): sagitta.stolzmanni { var x: sagitta.stolzmanni; () => { var y = this; }; return x; } ->beecrofti : Symbol(beecrofti, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 558, 111)) +>beecrofti : Symbol(fuscus.beecrofti, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 558, 111)) >sagitta : Symbol(sagitta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 487, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 577, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 675, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 746, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 898, 1)) >stolzmanni : Symbol(sagitta.stolzmanni, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 899, 16)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 559, 45)) @@ -7378,7 +7378,7 @@ module samarensis { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 559, 45)) imaizumii(): minutus.inez, gabriellae.echinatus>, dogramacii.aurata>, lavali.otion>, macrorhinos.konganensis> { var x: minutus.inez, gabriellae.echinatus>, dogramacii.aurata>, lavali.otion>, macrorhinos.konganensis>; () => { var y = this; }; return x; } ->imaizumii : Symbol(imaizumii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 559, 105)) +>imaizumii : Symbol(fuscus.imaizumii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 559, 105)) >minutus : Symbol(minutus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 433, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 492, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 848, 1)) >inez : Symbol(minutus.inez, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 493, 16)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) @@ -7429,7 +7429,7 @@ module samarensis { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 560, 233)) colocolo(): quasiater.bobrinskoi { var x: quasiater.bobrinskoi; () => { var y = this; }; return x; } ->colocolo : Symbol(colocolo, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 560, 481)) +>colocolo : Symbol(fuscus.colocolo, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 560, 481)) >quasiater : Symbol(quasiater, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 236, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 422, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 813, 1)) >bobrinskoi : Symbol(quasiater.bobrinskoi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 237, 18)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 561, 46)) @@ -7440,7 +7440,7 @@ module samarensis { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 561, 46)) wolfi(): petrophilus.rosalia> { var x: petrophilus.rosalia>; () => { var y = this; }; return x; } ->wolfi : Symbol(wolfi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 561, 108)) +>wolfi : Symbol(fuscus.wolfi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 561, 108)) >petrophilus : Symbol(petrophilus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 715, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 823, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 998, 1)) >rosalia : Symbol(petrophilus.rosalia, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 999, 20)) >Lanthanum : Symbol(Lanthanum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 106, 1)) @@ -7470,7 +7470,7 @@ module samarensis { >pallidus : Symbol(pallidus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 563, 5)) oblativa(): trivirgatus.falconeri { var x: trivirgatus.falconeri; () => { var y = this; }; return x; } ->oblativa : Symbol(oblativa, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 564, 27)) +>oblativa : Symbol(pallidus.oblativa, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 564, 27)) >trivirgatus : Symbol(trivirgatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 186, 1)) >falconeri : Symbol(trivirgatus.falconeri, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 210, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 565, 47)) @@ -7481,7 +7481,7 @@ module samarensis { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 565, 47)) watersi(): lavali.wilsoni { var x: lavali.wilsoni; () => { var y = this; }; return x; } ->watersi : Symbol(watersi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 565, 110)) +>watersi : Symbol(pallidus.watersi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 565, 110)) >lavali : Symbol(lavali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 252, 1)) >wilsoni : Symbol(lavali.wilsoni, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 253, 15)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 566, 39)) @@ -7492,7 +7492,7 @@ module samarensis { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 566, 39)) glacialis(): sagitta.cinereus, quasiater.wattsi>> { var x: sagitta.cinereus, quasiater.wattsi>>; () => { var y = this; }; return x; } ->glacialis : Symbol(glacialis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 566, 95)) +>glacialis : Symbol(pallidus.glacialis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 566, 95)) >sagitta : Symbol(sagitta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 487, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 577, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 675, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 746, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 898, 1)) >cinereus : Symbol(sagitta.cinereus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 747, 16)) >nigra : Symbol(nigra, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 388, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 475, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 514, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 762, 1)) @@ -7535,7 +7535,7 @@ module samarensis { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 567, 212)) viaria(): chrysaeolus.sarasinorum { var x: chrysaeolus.sarasinorum; () => { var y = this; }; return x; } ->viaria : Symbol(viaria, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 567, 439)) +>viaria : Symbol(pallidus.viaria, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 567, 439)) >chrysaeolus : Symbol(chrysaeolus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 602, 1)) >sarasinorum : Symbol(chrysaeolus.sarasinorum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 603, 20)) >lavali : Symbol(lavali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 252, 1)) @@ -7559,7 +7559,7 @@ module samarensis { >T1 : Symbol(T1, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 570, 30)) alashanicus(): nigra.caucasica { var x: nigra.caucasica; () => { var y = this; }; return x; } ->alashanicus : Symbol(alashanicus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 570, 36)) +>alashanicus : Symbol(cahirinus.alashanicus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 570, 36)) >nigra : Symbol(nigra, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 388, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 475, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 514, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 762, 1)) >caucasica : Symbol(nigra.caucasica, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 763, 14)) >ruatanica : Symbol(ruatanica, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 100, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 244, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 959, 1)) @@ -7578,7 +7578,7 @@ module samarensis { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 571, 86)) flaviventer(): trivirgatus.tumidifrons> { var x: trivirgatus.tumidifrons>; () => { var y = this; }; return x; } ->flaviventer : Symbol(flaviventer, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 571, 185)) +>flaviventer : Symbol(cahirinus.flaviventer, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 571, 185)) >trivirgatus : Symbol(trivirgatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 186, 1)) >tumidifrons : Symbol(trivirgatus.tumidifrons, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 187, 20)) >lavali : Symbol(lavali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 252, 1)) @@ -7605,7 +7605,7 @@ module samarensis { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 572, 134)) bottai(): lutreolus.schlegeli { var x: lutreolus.schlegeli; () => { var y = this; }; return x; } ->bottai : Symbol(bottai, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 572, 281)) +>bottai : Symbol(cahirinus.bottai, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 572, 281)) >lutreolus : Symbol(lutreolus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 355, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 719, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 855, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 872, 1)) >schlegeli : Symbol(lutreolus.schlegeli, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 356, 18)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 573, 43)) @@ -7616,7 +7616,7 @@ module samarensis { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 573, 43)) pinetis(): argurus.oreas { var x: argurus.oreas; () => { var y = this; }; return x; } ->pinetis : Symbol(pinetis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 573, 104)) +>pinetis : Symbol(cahirinus.pinetis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 573, 104)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) >oreas : Symbol(argurus.oreas, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 625, 16)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 574, 38)) @@ -7627,7 +7627,7 @@ module samarensis { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 574, 38)) saussurei(): rendalli.crenulata, argurus.netscheri, julianae.oralis>> { var x: rendalli.crenulata, argurus.netscheri, julianae.oralis>>; () => { var y = this; }; return x; } ->saussurei : Symbol(saussurei, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 574, 93)) +>saussurei : Symbol(cahirinus.saussurei, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 574, 93)) >rendalli : Symbol(rendalli, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 151, 1)) >crenulata : Symbol(rendalli.crenulata, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 180, 3)) >gabriellae : Symbol(gabriellae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 766, 1)) @@ -7698,7 +7698,7 @@ module sagitta { >stolzmanni : Symbol(stolzmanni, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 899, 16)) victus(): rionegrensis.caniventer { var x: rionegrensis.caniventer; () => { var y = this; }; return x; } ->victus : Symbol(victus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 579, 145)) +>victus : Symbol(leptoceros.victus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 579, 145)) >rionegrensis : Symbol(rionegrensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 0, 0)) >caniventer : Symbol(rionegrensis.caniventer, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 0, 21)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 580, 47)) @@ -7709,7 +7709,7 @@ module sagitta { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 580, 47)) hoplomyoides(): panglima.fundatus, nigra.gracilis> { var x: panglima.fundatus, nigra.gracilis>; () => { var y = this; }; return x; } ->hoplomyoides : Symbol(hoplomyoides, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 580, 112)) +>hoplomyoides : Symbol(leptoceros.hoplomyoides, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 580, 112)) >panglima : Symbol(panglima, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 400, 1)) >fundatus : Symbol(panglima.fundatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 409, 5)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) @@ -7744,7 +7744,7 @@ module sagitta { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 581, 168)) gratiosus(): lavali.lepturus { var x: lavali.lepturus; () => { var y = this; }; return x; } ->gratiosus : Symbol(gratiosus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 581, 348)) +>gratiosus : Symbol(leptoceros.gratiosus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 581, 348)) >lavali : Symbol(lavali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 252, 1)) >lepturus : Symbol(lavali.lepturus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 309, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 582, 42)) @@ -7755,7 +7755,7 @@ module sagitta { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 582, 42)) rex(): lavali.wilsoni { var x: lavali.wilsoni; () => { var y = this; }; return x; } ->rex : Symbol(rex, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 582, 99)) +>rex : Symbol(leptoceros.rex, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 582, 99)) >lavali : Symbol(lavali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 252, 1)) >wilsoni : Symbol(lavali.wilsoni, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 253, 15)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 583, 35)) @@ -7766,7 +7766,7 @@ module sagitta { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 583, 35)) bolami(): trivirgatus.tumidifrons { var x: trivirgatus.tumidifrons; () => { var y = this; }; return x; } ->bolami : Symbol(bolami, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 583, 91)) +>bolami : Symbol(leptoceros.bolami, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 583, 91)) >trivirgatus : Symbol(trivirgatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 186, 1)) >tumidifrons : Symbol(trivirgatus.tumidifrons, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 187, 20)) >lutreolus : Symbol(lutreolus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 355, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 719, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 855, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 872, 1)) @@ -7797,7 +7797,7 @@ module daubentonii { >stolzmanni : Symbol(sagitta.stolzmanni, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 899, 16)) woosnami(): dogramacii.robustulus { var x: dogramacii.robustulus; () => { var y = this; }; return x; } ->woosnami : Symbol(woosnami, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 588, 63)) +>woosnami : Symbol(nigricans.woosnami, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 588, 63)) >dogramacii : Symbol(dogramacii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 314, 1)) >robustulus : Symbol(dogramacii.robustulus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 315, 19)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 589, 47)) @@ -7833,7 +7833,7 @@ module argurus { >echinatus : Symbol(gabriellae.echinatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 781, 5)) pajeros(): gabriellae.echinatus { var x: gabriellae.echinatus; () => { var y = this; }; return x; } ->pajeros : Symbol(pajeros, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 597, 106)) +>pajeros : Symbol(pygmaea.pajeros, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 597, 106)) >gabriellae : Symbol(gabriellae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 766, 1)) >echinatus : Symbol(gabriellae.echinatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 781, 5)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 598, 45)) @@ -7844,7 +7844,7 @@ module argurus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 598, 45)) capucinus(): rendalli.zuluensis { var x: rendalli.zuluensis; () => { var y = this; }; return x; } ->capucinus : Symbol(capucinus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 598, 107)) +>capucinus : Symbol(pygmaea.capucinus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 598, 107)) >rendalli : Symbol(rendalli, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 151, 1)) >zuluensis : Symbol(rendalli.zuluensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 152, 17)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 599, 45)) @@ -7855,7 +7855,7 @@ module argurus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 599, 45)) cuvieri(): rionegrensis.caniventer { var x: rionegrensis.caniventer; () => { var y = this; }; return x; } ->cuvieri : Symbol(cuvieri, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 599, 105)) +>cuvieri : Symbol(pygmaea.cuvieri, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 599, 105)) >rionegrensis : Symbol(rionegrensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 0, 0)) >caniventer : Symbol(rionegrensis.caniventer, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 0, 21)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 600, 48)) @@ -7878,7 +7878,7 @@ module chrysaeolus { >psilurus : Symbol(caurinus.psilurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1008, 17)) belzebul(): samarensis.pallidus { var x: samarensis.pallidus; () => { var y = this; }; return x; } ->belzebul : Symbol(belzebul, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 604, 64)) +>belzebul : Symbol(sarasinorum.belzebul, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 604, 64)) >samarensis : Symbol(samarensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 531, 1)) >pallidus : Symbol(samarensis.pallidus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 563, 5)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 605, 45)) @@ -7889,7 +7889,7 @@ module chrysaeolus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 605, 45)) hinpoon(): nigra.caucasica { var x: nigra.caucasica; () => { var y = this; }; return x; } ->hinpoon : Symbol(hinpoon, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 605, 106)) +>hinpoon : Symbol(sarasinorum.hinpoon, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 605, 106)) >nigra : Symbol(nigra, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 388, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 475, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 514, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 762, 1)) >caucasica : Symbol(nigra.caucasica, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 763, 14)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) @@ -7908,7 +7908,7 @@ module chrysaeolus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 606, 83)) kandti(): quasiater.wattsi { var x: quasiater.wattsi; () => { var y = this; }; return x; } ->kandti : Symbol(kandti, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 606, 183)) +>kandti : Symbol(sarasinorum.kandti, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 606, 183)) >quasiater : Symbol(quasiater, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 236, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 422, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 813, 1)) >wattsi : Symbol(quasiater.wattsi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 814, 18)) >Lanthanum : Symbol(Lanthanum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 106, 1)) @@ -7927,7 +7927,7 @@ module chrysaeolus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 607, 81)) cynosuros(): dammermani.melanops { var x: dammermani.melanops; () => { var y = this; }; return x; } ->cynosuros : Symbol(cynosuros, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 607, 180)) +>cynosuros : Symbol(sarasinorum.cynosuros, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 607, 180)) >dammermani : Symbol(dammermani, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 591, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 913, 1)) >melanops : Symbol(dammermani.melanops, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 914, 19)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 608, 46)) @@ -7938,7 +7938,7 @@ module chrysaeolus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 608, 46)) Germanium(): lavali.beisa { var x: lavali.beisa; () => { var y = this; }; return x; } ->Germanium : Symbol(Germanium, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 608, 107)) +>Germanium : Symbol(sarasinorum.Germanium, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 608, 107)) >lavali : Symbol(lavali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 252, 1)) >beisa : Symbol(lavali.beisa, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 268, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 609, 39)) @@ -7949,7 +7949,7 @@ module chrysaeolus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 609, 39)) Ununoctium(): nigra.gracilis { var x: nigra.gracilis; () => { var y = this; }; return x; } ->Ununoctium : Symbol(Ununoctium, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 609, 93)) +>Ununoctium : Symbol(sarasinorum.Ununoctium, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 609, 93)) >nigra : Symbol(nigra, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 388, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 475, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 514, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 762, 1)) >gracilis : Symbol(nigra.gracilis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 515, 14)) >lavali : Symbol(lavali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 252, 1)) @@ -7968,7 +7968,7 @@ module chrysaeolus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 610, 86)) princeps(): minutus.portoricensis { var x: minutus.portoricensis; () => { var y = this; }; return x; } ->princeps : Symbol(princeps, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 610, 186)) +>princeps : Symbol(sarasinorum.princeps, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 610, 186)) >minutus : Symbol(minutus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 433, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 492, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 848, 1)) >portoricensis : Symbol(minutus.portoricensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 849, 16)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 611, 47)) @@ -7988,7 +7988,7 @@ module argurus { >T1 : Symbol(T1, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 615, 29)) leucoptera(): petrophilus.rosalia { var x: petrophilus.rosalia; () => { var y = this; }; return x; } ->leucoptera : Symbol(leucoptera, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 615, 35)) +>leucoptera : Symbol(wetmorei.leucoptera, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 615, 35)) >petrophilus : Symbol(petrophilus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 715, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 823, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 998, 1)) >rosalia : Symbol(petrophilus.rosalia, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 999, 20)) >dogramacii : Symbol(dogramacii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 314, 1)) @@ -8007,7 +8007,7 @@ module argurus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 616, 86)) ochraventer(): sagitta.walkeri { var x: sagitta.walkeri; () => { var y = this; }; return x; } ->ochraventer : Symbol(ochraventer, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 616, 186)) +>ochraventer : Symbol(wetmorei.ochraventer, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 616, 186)) >sagitta : Symbol(sagitta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 487, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 577, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 675, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 746, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 898, 1)) >walkeri : Symbol(sagitta.walkeri, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 488, 16)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 617, 44)) @@ -8018,7 +8018,7 @@ module argurus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 617, 44)) tephromelas(): Lanthanum.jugularis { var x: Lanthanum.jugularis; () => { var y = this; }; return x; } ->tephromelas : Symbol(tephromelas, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 617, 101)) +>tephromelas : Symbol(wetmorei.tephromelas, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 617, 101)) >Lanthanum : Symbol(Lanthanum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 106, 1)) >jugularis : Symbol(Lanthanum.jugularis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 134, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 618, 48)) @@ -8029,7 +8029,7 @@ module argurus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 618, 48)) cracens(): argurus.gilbertii { var x: argurus.gilbertii; () => { var y = this; }; return x; } ->cracens : Symbol(cracens, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 618, 109)) +>cracens : Symbol(wetmorei.cracens, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 618, 109)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) >gilbertii : Symbol(gilbertii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 700, 16)) >lavali : Symbol(lavali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 252, 1)) @@ -8048,7 +8048,7 @@ module argurus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 619, 78)) jamaicensis(): nigra.thalia> { var x: nigra.thalia>; () => { var y = this; }; return x; } ->jamaicensis : Symbol(jamaicensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 619, 173)) +>jamaicensis : Symbol(wetmorei.jamaicensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 619, 173)) >nigra : Symbol(nigra, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 388, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 475, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 514, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 762, 1)) >thalia : Symbol(nigra.thalia, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 476, 14)) >howi : Symbol(howi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 466, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 681, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 886, 1)) @@ -8075,7 +8075,7 @@ module argurus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 620, 129)) gymnocaudus(): dogramacii.aurata { var x: dogramacii.aurata; () => { var y = this; }; return x; } ->gymnocaudus : Symbol(gymnocaudus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 620, 271)) +>gymnocaudus : Symbol(wetmorei.gymnocaudus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 620, 271)) >dogramacii : Symbol(dogramacii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 314, 1)) >aurata : Symbol(dogramacii.aurata, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 344, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 621, 46)) @@ -8086,7 +8086,7 @@ module argurus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 621, 46)) mayori(): sagitta.stolzmanni { var x: sagitta.stolzmanni; () => { var y = this; }; return x; } ->mayori : Symbol(mayori, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 621, 105)) +>mayori : Symbol(wetmorei.mayori, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 621, 105)) >sagitta : Symbol(sagitta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 487, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 577, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 675, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 746, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 898, 1)) >stolzmanni : Symbol(sagitta.stolzmanni, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 899, 16)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 622, 42)) @@ -8107,7 +8107,7 @@ module argurus { >wilsoni : Symbol(lavali.wilsoni, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 253, 15)) salamonis(): lavali.xanthognathus { var x: lavali.xanthognathus; () => { var y = this; }; return x; } ->salamonis : Symbol(salamonis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 626, 47)) +>salamonis : Symbol(oreas.salamonis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 626, 47)) >lavali : Symbol(lavali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 252, 1)) >xanthognathus : Symbol(lavali.xanthognathus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 285, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 627, 47)) @@ -8118,7 +8118,7 @@ module argurus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 627, 47)) paniscus(): ruatanica.Praseodymium { var x: ruatanica.Praseodymium; () => { var y = this; }; return x; } ->paniscus : Symbol(paniscus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 627, 109)) +>paniscus : Symbol(oreas.paniscus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 627, 109)) >ruatanica : Symbol(ruatanica, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 100, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 244, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 959, 1)) >Praseodymium : Symbol(ruatanica.Praseodymium, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 960, 18)) >caurinus : Symbol(caurinus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 449, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 836, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 976, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1007, 1)) @@ -8137,7 +8137,7 @@ module argurus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 628, 89)) fagani(): trivirgatus.oconnelli { var x: trivirgatus.oconnelli; () => { var y = this; }; return x; } ->fagani : Symbol(fagani, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 628, 194)) +>fagani : Symbol(oreas.fagani, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 628, 194)) >trivirgatus : Symbol(trivirgatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 186, 1)) >oconnelli : Symbol(trivirgatus.oconnelli, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 219, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 629, 45)) @@ -8148,7 +8148,7 @@ module argurus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 629, 45)) papuanus(): panglima.fundatus { var x: panglima.fundatus; () => { var y = this; }; return x; } ->papuanus : Symbol(papuanus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 629, 108)) +>papuanus : Symbol(oreas.papuanus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 629, 108)) >panglima : Symbol(panglima, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 400, 1)) >fundatus : Symbol(panglima.fundatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 409, 5)) >quasiater : Symbol(quasiater, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 236, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 422, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 813, 1)) @@ -8167,7 +8167,7 @@ module argurus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 630, 92)) timidus(): dammermani.melanops { var x: dammermani.melanops; () => { var y = this; }; return x; } ->timidus : Symbol(timidus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 630, 200)) +>timidus : Symbol(oreas.timidus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 630, 200)) >dammermani : Symbol(dammermani, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 591, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 913, 1)) >melanops : Symbol(dammermani.melanops, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 914, 19)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 631, 44)) @@ -8178,7 +8178,7 @@ module argurus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 631, 44)) nghetinhensis(): gabriellae.klossii { var x: gabriellae.klossii; () => { var y = this; }; return x; } ->nghetinhensis : Symbol(nghetinhensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 631, 105)) +>nghetinhensis : Symbol(oreas.nghetinhensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 631, 105)) >gabriellae : Symbol(gabriellae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 766, 1)) >klossii : Symbol(gabriellae.klossii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 767, 19)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) @@ -8197,7 +8197,7 @@ module argurus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 632, 85)) barbei(): samarensis.cahirinus { var x: samarensis.cahirinus; () => { var y = this; }; return x; } ->barbei : Symbol(barbei, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 632, 181)) +>barbei : Symbol(oreas.barbei, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 632, 181)) >samarensis : Symbol(samarensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 531, 1)) >cahirinus : Symbol(samarensis.cahirinus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 569, 5)) >lavali : Symbol(lavali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 252, 1)) @@ -8216,7 +8216,7 @@ module argurus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 633, 85)) univittatus(): argurus.peninsulae { var x: argurus.peninsulae; () => { var y = this; }; return x; } ->univittatus : Symbol(univittatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 633, 188)) +>univittatus : Symbol(oreas.univittatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 633, 188)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) >peninsulae : Symbol(peninsulae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 931, 16)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 634, 47)) @@ -8236,7 +8236,7 @@ module daubentonii { >T1 : Symbol(T1, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 638, 29)) capreolus(): rendalli.crenulata, lavali.wilsoni> { var x: rendalli.crenulata, lavali.wilsoni>; () => { var y = this; }; return x; } ->capreolus : Symbol(capreolus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 638, 35)) +>capreolus : Symbol(arboreus.capreolus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 638, 35)) >rendalli : Symbol(rendalli, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 151, 1)) >crenulata : Symbol(rendalli.crenulata, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 180, 3)) >samarensis : Symbol(samarensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 531, 1)) @@ -8263,7 +8263,7 @@ module daubentonii { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 639, 124)) moreni(): panglima.abidi { var x: panglima.abidi; () => { var y = this; }; return x; } ->moreni : Symbol(moreni, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 639, 263)) +>moreni : Symbol(arboreus.moreni, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 639, 263)) >panglima : Symbol(panglima, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 400, 1)) >abidi : Symbol(panglima.abidi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 414, 5)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) @@ -8282,7 +8282,7 @@ module daubentonii { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 640, 84)) hypoleucos(): nigra.gracilis { var x: nigra.gracilis; () => { var y = this; }; return x; } ->hypoleucos : Symbol(hypoleucos, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 640, 186)) +>hypoleucos : Symbol(arboreus.hypoleucos, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 640, 186)) >nigra : Symbol(nigra, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 388, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 475, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 514, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 762, 1)) >gracilis : Symbol(nigra.gracilis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 515, 14)) >trivirgatus : Symbol(trivirgatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 186, 1)) @@ -8301,7 +8301,7 @@ module daubentonii { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 641, 83)) paedulcus(): minutus.portoricensis { var x: minutus.portoricensis; () => { var y = this; }; return x; } ->paedulcus : Symbol(paedulcus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 641, 180)) +>paedulcus : Symbol(arboreus.paedulcus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 641, 180)) >minutus : Symbol(minutus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 433, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 492, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 848, 1)) >portoricensis : Symbol(minutus.portoricensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 849, 16)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 642, 48)) @@ -8312,7 +8312,7 @@ module daubentonii { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 642, 48)) pucheranii(): samarensis.fuscus { var x: samarensis.fuscus; () => { var y = this; }; return x; } ->pucheranii : Symbol(pucheranii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 642, 111)) +>pucheranii : Symbol(arboreus.pucheranii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 642, 111)) >samarensis : Symbol(samarensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 531, 1)) >fuscus : Symbol(samarensis.fuscus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 547, 5)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) @@ -8331,7 +8331,7 @@ module daubentonii { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 643, 86)) stella(): julianae.oralis { var x: julianae.oralis; () => { var y = this; }; return x; } ->stella : Symbol(stella, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 643, 186)) +>stella : Symbol(arboreus.stella, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 643, 186)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) >oralis : Symbol(julianae.oralis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 43, 3)) >lutreolus : Symbol(lutreolus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 355, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 719, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 855, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 872, 1)) @@ -8350,7 +8350,7 @@ module daubentonii { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 644, 80)) brasiliensis(): imperfecta.subspinosus { var x: imperfecta.subspinosus; () => { var y = this; }; return x; } ->brasiliensis : Symbol(brasiliensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 644, 178)) +>brasiliensis : Symbol(arboreus.brasiliensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 644, 178)) >imperfecta : Symbol(imperfecta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 785, 1)) >subspinosus : Symbol(imperfecta.subspinosus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 794, 5)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 645, 52)) @@ -8361,7 +8361,7 @@ module daubentonii { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 645, 52)) brevicaudata(): trivirgatus.oconnelli { var x: trivirgatus.oconnelli; () => { var y = this; }; return x; } ->brevicaudata : Symbol(brevicaudata, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 645, 116)) +>brevicaudata : Symbol(arboreus.brevicaudata, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 645, 116)) >trivirgatus : Symbol(trivirgatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 186, 1)) >oconnelli : Symbol(trivirgatus.oconnelli, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 219, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 646, 51)) @@ -8372,7 +8372,7 @@ module daubentonii { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 646, 51)) vitticollis(): dogramacii.koepckeae { var x: dogramacii.koepckeae; () => { var y = this; }; return x; } ->vitticollis : Symbol(vitticollis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 646, 114)) +>vitticollis : Symbol(arboreus.vitticollis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 646, 114)) >dogramacii : Symbol(dogramacii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 314, 1)) >koepckeae : Symbol(dogramacii.koepckeae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 326, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 647, 49)) @@ -8383,7 +8383,7 @@ module daubentonii { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 647, 49)) huangensis(): caurinus.psilurus { var x: caurinus.psilurus; () => { var y = this; }; return x; } ->huangensis : Symbol(huangensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 647, 111)) +>huangensis : Symbol(arboreus.huangensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 647, 111)) >caurinus : Symbol(caurinus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 449, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 836, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 976, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1007, 1)) >psilurus : Symbol(caurinus.psilurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1008, 17)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 648, 45)) @@ -8394,7 +8394,7 @@ module daubentonii { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 648, 45)) cameroni(): petrophilus.rosalia, imperfecta.ciliolabrum>, caurinus.psilurus> { var x: petrophilus.rosalia, imperfecta.ciliolabrum>, caurinus.psilurus>; () => { var y = this; }; return x; } ->cameroni : Symbol(cameroni, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 648, 104)) +>cameroni : Symbol(arboreus.cameroni, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 648, 104)) >petrophilus : Symbol(petrophilus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 715, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 823, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 998, 1)) >rosalia : Symbol(petrophilus.rosalia, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 999, 20)) >dammermani : Symbol(dammermani, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 591, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 913, 1)) @@ -8437,7 +8437,7 @@ module daubentonii { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 649, 210)) tianshanica(): howi.marcanoi { var x: howi.marcanoi; () => { var y = this; }; return x; } ->tianshanica : Symbol(tianshanica, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 649, 436)) +>tianshanica : Symbol(arboreus.tianshanica, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 649, 436)) >howi : Symbol(howi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 466, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 681, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 886, 1)) >marcanoi : Symbol(howi.marcanoi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 682, 13)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 650, 42)) @@ -8455,7 +8455,7 @@ module patas { >uralensis : Symbol(uralensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 653, 14)) cartilagonodus(): Lanthanum.nitidus { var x: Lanthanum.nitidus; () => { var y = this; }; return x; } ->cartilagonodus : Symbol(cartilagonodus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 654, 28)) +>cartilagonodus : Symbol(uralensis.cartilagonodus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 654, 28)) >Lanthanum : Symbol(Lanthanum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 106, 1)) >nitidus : Symbol(Lanthanum.nitidus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 112, 3)) >rionegrensis : Symbol(rionegrensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 0, 0)) @@ -8474,7 +8474,7 @@ module patas { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 655, 95)) pyrrhinus(): lavali.beisa { var x: lavali.beisa; () => { var y = this; }; return x; } ->pyrrhinus : Symbol(pyrrhinus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 655, 200)) +>pyrrhinus : Symbol(uralensis.pyrrhinus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 655, 200)) >lavali : Symbol(lavali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 252, 1)) >beisa : Symbol(lavali.beisa, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 268, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 656, 39)) @@ -8485,7 +8485,7 @@ module patas { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 656, 39)) insulans(): Lanthanum.jugularis { var x: Lanthanum.jugularis; () => { var y = this; }; return x; } ->insulans : Symbol(insulans, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 656, 93)) +>insulans : Symbol(uralensis.insulans, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 656, 93)) >Lanthanum : Symbol(Lanthanum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 106, 1)) >jugularis : Symbol(Lanthanum.jugularis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 134, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 657, 45)) @@ -8496,7 +8496,7 @@ module patas { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 657, 45)) nigricauda(): caurinus.johorensis, Lanthanum.jugularis> { var x: caurinus.johorensis, Lanthanum.jugularis>; () => { var y = this; }; return x; } ->nigricauda : Symbol(nigricauda, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 657, 106)) +>nigricauda : Symbol(uralensis.nigricauda, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 657, 106)) >caurinus : Symbol(caurinus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 449, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 836, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 976, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1007, 1)) >johorensis : Symbol(caurinus.johorensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 977, 17)) >Lanthanum : Symbol(Lanthanum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 106, 1)) @@ -8523,7 +8523,7 @@ module patas { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 658, 130)) muricauda(): panglima.fundatus> { var x: panglima.fundatus>; () => { var y = this; }; return x; } ->muricauda : Symbol(muricauda, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 658, 274)) +>muricauda : Symbol(uralensis.muricauda, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 658, 274)) >panglima : Symbol(panglima, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 400, 1)) >fundatus : Symbol(panglima.fundatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 409, 5)) >lutreolus : Symbol(lutreolus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 355, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 719, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 855, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 872, 1)) @@ -8550,7 +8550,7 @@ module patas { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 659, 120)) albicaudus(): sagitta.stolzmanni { var x: sagitta.stolzmanni; () => { var y = this; }; return x; } ->albicaudus : Symbol(albicaudus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 659, 255)) +>albicaudus : Symbol(uralensis.albicaudus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 659, 255)) >sagitta : Symbol(sagitta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 487, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 577, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 675, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 746, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 898, 1)) >stolzmanni : Symbol(sagitta.stolzmanni, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 899, 16)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 660, 46)) @@ -8561,7 +8561,7 @@ module patas { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 660, 46)) fallax(): ruatanica.hector { var x: ruatanica.hector; () => { var y = this; }; return x; } ->fallax : Symbol(fallax, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 660, 106)) +>fallax : Symbol(uralensis.fallax, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 660, 106)) >ruatanica : Symbol(ruatanica, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 100, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 244, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 959, 1)) >hector : Symbol(ruatanica.hector, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 101, 18)) >lutreolus : Symbol(lutreolus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 355, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 719, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 855, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 872, 1)) @@ -8580,7 +8580,7 @@ module patas { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 661, 78)) attenuata(): macrorhinos.marmosurus> { var x: macrorhinos.marmosurus>; () => { var y = this; }; return x; } ->attenuata : Symbol(attenuata, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 661, 174)) +>attenuata : Symbol(uralensis.attenuata, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 661, 174)) >macrorhinos : Symbol(macrorhinos, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 461, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 497, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 736, 1)) >marmosurus : Symbol(macrorhinos.marmosurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 462, 20)) >ruatanica : Symbol(ruatanica, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 100, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 244, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 959, 1)) @@ -8607,7 +8607,7 @@ module patas { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 662, 134)) megalura(): howi.marcanoi { var x: howi.marcanoi; () => { var y = this; }; return x; } ->megalura : Symbol(megalura, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 662, 283)) +>megalura : Symbol(uralensis.megalura, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 662, 283)) >howi : Symbol(howi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 466, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 681, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 886, 1)) >marcanoi : Symbol(howi.marcanoi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 682, 13)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 663, 39)) @@ -8618,7 +8618,7 @@ module patas { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 663, 39)) neblina(): samarensis.pelurus { var x: samarensis.pelurus; () => { var y = this; }; return x; } ->neblina : Symbol(neblina, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 663, 94)) +>neblina : Symbol(uralensis.neblina, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 663, 94)) >samarensis : Symbol(samarensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 531, 1)) >pelurus : Symbol(samarensis.pelurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 532, 19)) >macrorhinos : Symbol(macrorhinos, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 461, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 497, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 736, 1)) @@ -8637,7 +8637,7 @@ module patas { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 664, 93)) citellus(): daubentonii.arboreus { var x: daubentonii.arboreus; () => { var y = this; }; return x; } ->citellus : Symbol(citellus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 664, 203)) +>citellus : Symbol(uralensis.citellus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 664, 203)) >daubentonii : Symbol(daubentonii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 471, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 586, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 636, 1)) >arboreus : Symbol(daubentonii.arboreus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 637, 20)) >quasiater : Symbol(quasiater, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 236, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 422, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 813, 1)) @@ -8656,7 +8656,7 @@ module patas { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 665, 95)) tanezumi(): imperfecta.lasiurus { var x: imperfecta.lasiurus; () => { var y = this; }; return x; } ->tanezumi : Symbol(tanezumi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 665, 206)) +>tanezumi : Symbol(uralensis.tanezumi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 665, 206)) >imperfecta : Symbol(imperfecta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 785, 1)) >lasiurus : Symbol(imperfecta.lasiurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 786, 19)) >dogramacii : Symbol(dogramacii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 314, 1)) @@ -8675,7 +8675,7 @@ module patas { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 666, 87)) albiventer(): rendalli.crenulata { var x: rendalli.crenulata; () => { var y = this; }; return x; } ->albiventer : Symbol(albiventer, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 666, 190)) +>albiventer : Symbol(uralensis.albiventer, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 666, 190)) >rendalli : Symbol(rendalli, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 151, 1)) >crenulata : Symbol(rendalli.crenulata, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 180, 3)) >rendalli : Symbol(rendalli, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 151, 1)) @@ -8704,7 +8704,7 @@ module provocax { >wilsoni : Symbol(lavali.wilsoni, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 253, 15)) Neodymium(): macrorhinos.marmosurus, lutreolus.foina> { var x: macrorhinos.marmosurus, lutreolus.foina>; () => { var y = this; }; return x; } ->Neodymium : Symbol(Neodymium, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 671, 53)) +>Neodymium : Symbol(melanoleuca.Neodymium, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 671, 53)) >macrorhinos : Symbol(macrorhinos, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 461, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 497, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 736, 1)) >marmosurus : Symbol(macrorhinos.marmosurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 462, 20)) >petrophilus : Symbol(petrophilus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 715, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 823, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 998, 1)) @@ -8731,7 +8731,7 @@ module provocax { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 672, 130)) baeri(): imperfecta.lasiurus { var x: imperfecta.lasiurus; () => { var y = this; }; return x; } ->baeri : Symbol(baeri, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 672, 275)) +>baeri : Symbol(melanoleuca.baeri, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 672, 275)) >imperfecta : Symbol(imperfecta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 785, 1)) >lasiurus : Symbol(imperfecta.lasiurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 786, 19)) >lavali : Symbol(lavali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 252, 1)) @@ -8759,7 +8759,7 @@ module sagitta { >T1 : Symbol(T1, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 677, 29)) Chlorine(): samarensis.cahirinus, dogramacii.robustulus> { var x: samarensis.cahirinus, dogramacii.robustulus>; () => { var y = this; }; return x; } ->Chlorine : Symbol(Chlorine, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 677, 35)) +>Chlorine : Symbol(sicarius.Chlorine, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 677, 35)) >samarensis : Symbol(samarensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 531, 1)) >cahirinus : Symbol(samarensis.cahirinus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 569, 5)) >nigra : Symbol(nigra, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 388, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 475, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 514, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 762, 1)) @@ -8786,7 +8786,7 @@ module sagitta { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 678, 127)) simulator(): macrorhinos.marmosurus, macrorhinos.marmosurus, gabriellae.echinatus>, sagitta.stolzmanni>> { var x: macrorhinos.marmosurus, macrorhinos.marmosurus, gabriellae.echinatus>, sagitta.stolzmanni>>; () => { var y = this; }; return x; } ->simulator : Symbol(simulator, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 678, 270)) +>simulator : Symbol(sicarius.simulator, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 678, 270)) >macrorhinos : Symbol(macrorhinos, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 461, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 497, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 736, 1)) >marmosurus : Symbol(macrorhinos.marmosurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 462, 20)) >Lanthanum : Symbol(Lanthanum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 106, 1)) @@ -8847,7 +8847,7 @@ module howi { >megalonyx : Symbol(Lanthanum.megalonyx, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 124, 3)) formosae(): Lanthanum.megalonyx { var x: Lanthanum.megalonyx; () => { var y = this; }; return x; } ->formosae : Symbol(formosae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 683, 55)) +>formosae : Symbol(marcanoi.formosae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 683, 55)) >Lanthanum : Symbol(Lanthanum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 106, 1)) >megalonyx : Symbol(Lanthanum.megalonyx, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 124, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 684, 45)) @@ -8858,7 +8858,7 @@ module howi { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 684, 45)) dudui(): lutreolus.punicus { var x: lutreolus.punicus; () => { var y = this; }; return x; } ->dudui : Symbol(dudui, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 684, 106)) +>dudui : Symbol(marcanoi.dudui, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 684, 106)) >lutreolus : Symbol(lutreolus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 355, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 719, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 855, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 872, 1)) >punicus : Symbol(lutreolus.punicus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 720, 18)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 685, 40)) @@ -8869,7 +8869,7 @@ module howi { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 685, 40)) leander(): daubentonii.nesiotes { var x: daubentonii.nesiotes; () => { var y = this; }; return x; } ->leander : Symbol(leander, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 685, 99)) +>leander : Symbol(marcanoi.leander, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 685, 99)) >daubentonii : Symbol(daubentonii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 471, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 586, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 636, 1)) >nesiotes : Symbol(daubentonii.nesiotes, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 472, 20)) >Lanthanum : Symbol(Lanthanum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 106, 1)) @@ -8888,7 +8888,7 @@ module howi { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 686, 89)) martinsi(): dogramacii.aurata { var x: dogramacii.aurata; () => { var y = this; }; return x; } ->martinsi : Symbol(martinsi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 686, 195)) +>martinsi : Symbol(marcanoi.martinsi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 686, 195)) >dogramacii : Symbol(dogramacii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 314, 1)) >aurata : Symbol(dogramacii.aurata, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 344, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 687, 43)) @@ -8899,7 +8899,7 @@ module howi { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 687, 43)) beatrix(): imperfecta.ciliolabrum, gabriellae.echinatus>, dogramacii.aurata>, imperfecta.ciliolabrum>> { var x: imperfecta.ciliolabrum, gabriellae.echinatus>, dogramacii.aurata>, imperfecta.ciliolabrum>>; () => { var y = this; }; return x; } ->beatrix : Symbol(beatrix, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 687, 102)) +>beatrix : Symbol(marcanoi.beatrix, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 687, 102)) >imperfecta : Symbol(imperfecta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 785, 1)) >ciliolabrum : Symbol(imperfecta.ciliolabrum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 807, 5)) >provocax : Symbol(provocax, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 669, 1)) @@ -8958,7 +8958,7 @@ module howi { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 688, 286)) griseoventer(): argurus.oreas { var x: argurus.oreas; () => { var y = this; }; return x; } ->griseoventer : Symbol(griseoventer, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 688, 589)) +>griseoventer : Symbol(marcanoi.griseoventer, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 688, 589)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) >oreas : Symbol(argurus.oreas, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 625, 16)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 689, 43)) @@ -8969,7 +8969,7 @@ module howi { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 689, 43)) zerda(): quasiater.wattsi, howi.coludo>> { var x: quasiater.wattsi, howi.coludo>>; () => { var y = this; }; return x; } ->zerda : Symbol(zerda, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 689, 98)) +>zerda : Symbol(marcanoi.zerda, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 689, 98)) >quasiater : Symbol(quasiater, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 236, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 422, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 813, 1)) >wattsi : Symbol(quasiater.wattsi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 814, 18)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) @@ -9012,7 +9012,7 @@ module howi { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 690, 183)) yucatanicus(): julianae.nudicaudus { var x: julianae.nudicaudus; () => { var y = this; }; return x; } ->yucatanicus : Symbol(yucatanicus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 690, 385)) +>yucatanicus : Symbol(marcanoi.yucatanicus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 690, 385)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) >nudicaudus : Symbol(julianae.nudicaudus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 18, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 691, 48)) @@ -9023,7 +9023,7 @@ module howi { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 691, 48)) nigrita(): argurus.peninsulae { var x: argurus.peninsulae; () => { var y = this; }; return x; } ->nigrita : Symbol(nigrita, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 691, 109)) +>nigrita : Symbol(marcanoi.nigrita, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 691, 109)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) >peninsulae : Symbol(argurus.peninsulae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 931, 16)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 692, 43)) @@ -9034,7 +9034,7 @@ module howi { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 692, 43)) jouvenetae(): argurus.dauricus { var x: argurus.dauricus; () => { var y = this; }; return x; } ->jouvenetae : Symbol(jouvenetae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 692, 103)) +>jouvenetae : Symbol(marcanoi.jouvenetae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 692, 103)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) >dauricus : Symbol(argurus.dauricus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 374, 16)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) @@ -9053,7 +9053,7 @@ module howi { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 693, 81)) indefessus(): sagitta.walkeri { var x: sagitta.walkeri; () => { var y = this; }; return x; } ->indefessus : Symbol(indefessus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 693, 176)) +>indefessus : Symbol(marcanoi.indefessus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 693, 176)) >sagitta : Symbol(sagitta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 487, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 577, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 675, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 746, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 898, 1)) >walkeri : Symbol(sagitta.walkeri, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 488, 16)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 694, 43)) @@ -9064,7 +9064,7 @@ module howi { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 694, 43)) vuquangensis(): macrorhinos.daphaenodon { var x: macrorhinos.daphaenodon; () => { var y = this; }; return x; } ->vuquangensis : Symbol(vuquangensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 694, 100)) +>vuquangensis : Symbol(marcanoi.vuquangensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 694, 100)) >macrorhinos : Symbol(macrorhinos, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 461, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 497, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 736, 1)) >daphaenodon : Symbol(macrorhinos.daphaenodon, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 737, 20)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 695, 53)) @@ -9075,7 +9075,7 @@ module howi { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 695, 53)) Zirconium(): lavali.thaeleri { var x: lavali.thaeleri; () => { var y = this; }; return x; } ->Zirconium : Symbol(Zirconium, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 695, 118)) +>Zirconium : Symbol(marcanoi.Zirconium, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 695, 118)) >lavali : Symbol(lavali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 252, 1)) >thaeleri : Symbol(lavali.thaeleri, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 299, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 696, 42)) @@ -9086,7 +9086,7 @@ module howi { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 696, 42)) hyaena(): julianae.oralis { var x: julianae.oralis; () => { var y = this; }; return x; } ->hyaena : Symbol(hyaena, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 696, 99)) +>hyaena : Symbol(marcanoi.hyaena, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 696, 99)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) >oralis : Symbol(julianae.oralis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 43, 3)) >lavali : Symbol(lavali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 252, 1)) @@ -9114,7 +9114,7 @@ module argurus { >T1 : Symbol(T1, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 701, 30)) nasutus(): lavali.lepturus { var x: lavali.lepturus; () => { var y = this; }; return x; } ->nasutus : Symbol(nasutus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 701, 36)) +>nasutus : Symbol(gilbertii.nasutus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 701, 36)) >lavali : Symbol(lavali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 252, 1)) >lepturus : Symbol(lavali.lepturus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 309, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 702, 40)) @@ -9125,7 +9125,7 @@ module argurus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 702, 40)) poecilops(): julianae.steerii { var x: julianae.steerii; () => { var y = this; }; return x; } ->poecilops : Symbol(poecilops, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 702, 97)) +>poecilops : Symbol(gilbertii.poecilops, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 702, 97)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) >steerii : Symbol(julianae.steerii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 16, 17)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 703, 43)) @@ -9136,7 +9136,7 @@ module argurus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 703, 43)) sondaicus(): samarensis.fuscus { var x: samarensis.fuscus; () => { var y = this; }; return x; } ->sondaicus : Symbol(sondaicus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 703, 101)) +>sondaicus : Symbol(gilbertii.sondaicus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 703, 101)) >samarensis : Symbol(samarensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 531, 1)) >fuscus : Symbol(samarensis.fuscus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 547, 5)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) @@ -9155,7 +9155,7 @@ module argurus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 704, 81)) auriventer(): petrophilus.rosalia { var x: petrophilus.rosalia; () => { var y = this; }; return x; } ->auriventer : Symbol(auriventer, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 704, 177)) +>auriventer : Symbol(gilbertii.auriventer, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 704, 177)) >petrophilus : Symbol(petrophilus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 715, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 823, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 998, 1)) >rosalia : Symbol(petrophilus.rosalia, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 999, 20)) >lavali : Symbol(lavali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 252, 1)) @@ -9174,7 +9174,7 @@ module argurus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 705, 92)) cherriei(): ruatanica.Praseodymium { var x: ruatanica.Praseodymium; () => { var y = this; }; return x; } ->cherriei : Symbol(cherriei, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 705, 198)) +>cherriei : Symbol(gilbertii.cherriei, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 705, 198)) >ruatanica : Symbol(ruatanica, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 100, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 244, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 959, 1)) >Praseodymium : Symbol(ruatanica.Praseodymium, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 960, 18)) >Lanthanum : Symbol(Lanthanum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 106, 1)) @@ -9193,7 +9193,7 @@ module argurus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 706, 84)) lindberghi(): minutus.inez { var x: minutus.inez; () => { var y = this; }; return x; } ->lindberghi : Symbol(lindberghi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 706, 184)) +>lindberghi : Symbol(gilbertii.lindberghi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 706, 184)) >minutus : Symbol(minutus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 433, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 492, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 848, 1)) >inez : Symbol(minutus.inez, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 493, 16)) >rendalli : Symbol(rendalli, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 151, 1)) @@ -9212,7 +9212,7 @@ module argurus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 707, 85)) pipistrellus(): quasiater.carolinensis { var x: quasiater.carolinensis; () => { var y = this; }; return x; } ->pipistrellus : Symbol(pipistrellus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 707, 184)) +>pipistrellus : Symbol(gilbertii.pipistrellus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 707, 184)) >quasiater : Symbol(quasiater, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 236, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 422, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 813, 1)) >carolinensis : Symbol(quasiater.carolinensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 423, 18)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 708, 52)) @@ -9223,7 +9223,7 @@ module argurus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 708, 52)) paranus(): lutreolus.punicus { var x: lutreolus.punicus; () => { var y = this; }; return x; } ->paranus : Symbol(paranus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 708, 116)) +>paranus : Symbol(gilbertii.paranus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 708, 116)) >lutreolus : Symbol(lutreolus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 355, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 719, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 855, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 872, 1)) >punicus : Symbol(lutreolus.punicus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 720, 18)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 709, 42)) @@ -9234,7 +9234,7 @@ module argurus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 709, 42)) dubosti(): nigra.thalia { var x: nigra.thalia; () => { var y = this; }; return x; } ->dubosti : Symbol(dubosti, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 709, 101)) +>dubosti : Symbol(gilbertii.dubosti, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 709, 101)) >nigra : Symbol(nigra, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 388, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 475, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 514, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 762, 1)) >thalia : Symbol(nigra.thalia, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 476, 14)) >lutreolus : Symbol(lutreolus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 355, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 719, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 855, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 872, 1)) @@ -9253,7 +9253,7 @@ module argurus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 710, 78)) opossum(): nigra.dolichurus { var x: nigra.dolichurus; () => { var y = this; }; return x; } ->opossum : Symbol(opossum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 710, 173)) +>opossum : Symbol(gilbertii.opossum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 710, 173)) >nigra : Symbol(nigra, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 388, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 475, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 514, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 762, 1)) >dolichurus : Symbol(nigra.dolichurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 389, 14)) >lavali : Symbol(lavali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 252, 1)) @@ -9272,7 +9272,7 @@ module argurus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 711, 79)) oreopolus(): minutus.portoricensis { var x: minutus.portoricensis; () => { var y = this; }; return x; } ->oreopolus : Symbol(oreopolus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 711, 175)) +>oreopolus : Symbol(gilbertii.oreopolus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 711, 175)) >minutus : Symbol(minutus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 433, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 492, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 848, 1)) >portoricensis : Symbol(minutus.portoricensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 849, 16)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 712, 48)) @@ -9283,7 +9283,7 @@ module argurus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 712, 48)) amurensis(): daubentonii.arboreus { var x: daubentonii.arboreus; () => { var y = this; }; return x; } ->amurensis : Symbol(amurensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 712, 111)) +>amurensis : Symbol(gilbertii.amurensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 712, 111)) >daubentonii : Symbol(daubentonii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 471, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 586, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 636, 1)) >arboreus : Symbol(daubentonii.arboreus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 637, 20)) >lavali : Symbol(lavali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 252, 1)) @@ -9316,7 +9316,7 @@ module lutreolus { >punicus : Symbol(punicus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 720, 18)) strandi(): gabriellae.klossii { var x: gabriellae.klossii; () => { var y = this; }; return x; } ->strandi : Symbol(strandi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 721, 26)) +>strandi : Symbol(punicus.strandi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 721, 26)) >gabriellae : Symbol(gabriellae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 766, 1)) >klossii : Symbol(gabriellae.klossii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 767, 19)) >Lanthanum : Symbol(Lanthanum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 106, 1)) @@ -9335,7 +9335,7 @@ module lutreolus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 722, 85)) lar(): caurinus.mahaganus { var x: caurinus.mahaganus; () => { var y = this; }; return x; } ->lar : Symbol(lar, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 722, 187)) +>lar : Symbol(punicus.lar, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 722, 187)) >caurinus : Symbol(caurinus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 449, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 836, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 976, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1007, 1)) >mahaganus : Symbol(caurinus.mahaganus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 450, 17)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) @@ -9354,7 +9354,7 @@ module lutreolus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 723, 74)) erica(): dogramacii.koepckeae { var x: dogramacii.koepckeae; () => { var y = this; }; return x; } ->erica : Symbol(erica, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 723, 169)) +>erica : Symbol(punicus.erica, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 723, 169)) >dogramacii : Symbol(dogramacii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 314, 1)) >koepckeae : Symbol(dogramacii.koepckeae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 326, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 724, 43)) @@ -9365,7 +9365,7 @@ module lutreolus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 724, 43)) trichura(): macrorhinos.konganensis { var x: macrorhinos.konganensis; () => { var y = this; }; return x; } ->trichura : Symbol(trichura, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 724, 105)) +>trichura : Symbol(punicus.trichura, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 724, 105)) >macrorhinos : Symbol(macrorhinos, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 461, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 497, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 736, 1)) >konganensis : Symbol(macrorhinos.konganensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 498, 20)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 725, 49)) @@ -9376,7 +9376,7 @@ module lutreolus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 725, 49)) lemniscatus(): panglima.fundatus { var x: panglima.fundatus; () => { var y = this; }; return x; } ->lemniscatus : Symbol(lemniscatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 725, 114)) +>lemniscatus : Symbol(punicus.lemniscatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 725, 114)) >panglima : Symbol(panglima, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 400, 1)) >fundatus : Symbol(panglima.fundatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 409, 5)) >gabriellae : Symbol(gabriellae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 766, 1)) @@ -9395,7 +9395,7 @@ module lutreolus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 726, 82)) aspalax(): panamensis.linulus { var x: panamensis.linulus; () => { var y = this; }; return x; } ->aspalax : Symbol(aspalax, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 726, 177)) +>aspalax : Symbol(punicus.aspalax, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 726, 177)) >panamensis : Symbol(panamensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 501, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 986, 1)) >linulus : Symbol(panamensis.linulus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 502, 19)) >lavali : Symbol(lavali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 252, 1)) @@ -9414,7 +9414,7 @@ module lutreolus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 727, 90)) marshalli(): julianae.nudicaudus { var x: julianae.nudicaudus; () => { var y = this; }; return x; } ->marshalli : Symbol(marshalli, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 727, 197)) +>marshalli : Symbol(punicus.marshalli, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 727, 197)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) >nudicaudus : Symbol(julianae.nudicaudus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 18, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 728, 46)) @@ -9425,7 +9425,7 @@ module lutreolus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 728, 46)) Zinc(): julianae.galapagoensis { var x: julianae.galapagoensis; () => { var y = this; }; return x; } ->Zinc : Symbol(Zinc, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 728, 107)) +>Zinc : Symbol(punicus.Zinc, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 728, 107)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) >galapagoensis : Symbol(julianae.galapagoensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 25, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 729, 44)) @@ -9436,7 +9436,7 @@ module lutreolus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 729, 44)) monochromos(): howi.coludo { var x: howi.coludo; () => { var y = this; }; return x; } ->monochromos : Symbol(monochromos, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 729, 108)) +>monochromos : Symbol(punicus.monochromos, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 729, 108)) >howi : Symbol(howi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 466, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 681, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 886, 1)) >coludo : Symbol(howi.coludo, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 887, 13)) >lavali : Symbol(lavali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 252, 1)) @@ -9455,7 +9455,7 @@ module lutreolus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 730, 76)) purinus(): ruatanica.hector { var x: ruatanica.hector; () => { var y = this; }; return x; } ->purinus : Symbol(purinus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 730, 165)) +>purinus : Symbol(punicus.purinus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 730, 165)) >ruatanica : Symbol(ruatanica, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 100, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 244, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 959, 1)) >hector : Symbol(ruatanica.hector, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 101, 18)) >lutreolus : Symbol(lutreolus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 355, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 719, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 855, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 872, 1)) @@ -9474,7 +9474,7 @@ module lutreolus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 731, 84)) ischyrus(): lavali.lepturus { var x: lavali.lepturus; () => { var y = this; }; return x; } ->ischyrus : Symbol(ischyrus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 731, 185)) +>ischyrus : Symbol(punicus.ischyrus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 731, 185)) >lavali : Symbol(lavali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 252, 1)) >lepturus : Symbol(lavali.lepturus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 309, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 732, 41)) @@ -9485,7 +9485,7 @@ module lutreolus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 732, 41)) tenuis(): macrorhinos.daphaenodon { var x: macrorhinos.daphaenodon; () => { var y = this; }; return x; } ->tenuis : Symbol(tenuis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 732, 98)) +>tenuis : Symbol(punicus.tenuis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 732, 98)) >macrorhinos : Symbol(macrorhinos, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 461, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 497, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 736, 1)) >daphaenodon : Symbol(macrorhinos.daphaenodon, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 737, 20)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 733, 47)) @@ -9496,7 +9496,7 @@ module lutreolus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 733, 47)) Helium(): julianae.acariensis { var x: julianae.acariensis; () => { var y = this; }; return x; } ->Helium : Symbol(Helium, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 733, 112)) +>Helium : Symbol(punicus.Helium, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 733, 112)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) >acariensis : Symbol(julianae.acariensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 80, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 734, 43)) @@ -9514,7 +9514,7 @@ module macrorhinos { >daphaenodon : Symbol(daphaenodon, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 737, 20)) bredanensis(): julianae.sumatrana { var x: julianae.sumatrana; () => { var y = this; }; return x; } ->bredanensis : Symbol(bredanensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 738, 30)) +>bredanensis : Symbol(daphaenodon.bredanensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 738, 30)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) >sumatrana : Symbol(julianae.sumatrana, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 58, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 739, 47)) @@ -9525,7 +9525,7 @@ module macrorhinos { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 739, 47)) othus(): howi.coludo { var x: howi.coludo; () => { var y = this; }; return x; } ->othus : Symbol(othus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 739, 107)) +>othus : Symbol(daphaenodon.othus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 739, 107)) >howi : Symbol(howi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 466, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 681, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 886, 1)) >coludo : Symbol(howi.coludo, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 887, 13)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) @@ -9544,7 +9544,7 @@ module macrorhinos { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 740, 64)) hammondi(): julianae.gerbillus, gabriellae.echinatus>, dogramacii.aurata>, lavali.otion> { var x: julianae.gerbillus, gabriellae.echinatus>, dogramacii.aurata>, lavali.otion>; () => { var y = this; }; return x; } ->hammondi : Symbol(hammondi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 740, 147)) +>hammondi : Symbol(daphaenodon.hammondi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 740, 147)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) >gerbillus : Symbol(julianae.gerbillus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 67, 3)) >minutus : Symbol(minutus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 433, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 492, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 848, 1)) @@ -9587,7 +9587,7 @@ module macrorhinos { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 741, 193)) aureocollaris(): quasiater.carolinensis { var x: quasiater.carolinensis; () => { var y = this; }; return x; } ->aureocollaris : Symbol(aureocollaris, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 741, 402)) +>aureocollaris : Symbol(daphaenodon.aureocollaris, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 741, 402)) >quasiater : Symbol(quasiater, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 236, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 422, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 813, 1)) >carolinensis : Symbol(quasiater.carolinensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 423, 18)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 742, 53)) @@ -9598,7 +9598,7 @@ module macrorhinos { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 742, 53)) flavipes(): petrophilus.minutilla { var x: petrophilus.minutilla; () => { var y = this; }; return x; } ->flavipes : Symbol(flavipes, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 742, 117)) +>flavipes : Symbol(daphaenodon.flavipes, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 742, 117)) >petrophilus : Symbol(petrophilus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 715, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 823, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 998, 1)) >minutilla : Symbol(petrophilus.minutilla, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 716, 20)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 743, 47)) @@ -9609,7 +9609,7 @@ module macrorhinos { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 743, 47)) callosus(): trivirgatus.lotor { var x: trivirgatus.lotor; () => { var y = this; }; return x; } ->callosus : Symbol(callosus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 743, 110)) +>callosus : Symbol(daphaenodon.callosus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 743, 110)) >trivirgatus : Symbol(trivirgatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 186, 1)) >lotor : Symbol(trivirgatus.lotor, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 206, 3)) >lutreolus : Symbol(lutreolus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 355, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 719, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 855, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 872, 1)) @@ -9637,7 +9637,7 @@ module sagitta { >T1 : Symbol(T1, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 748, 29)) zunigae(): rendalli.crenulata> { var x: rendalli.crenulata>; () => { var y = this; }; return x; } ->zunigae : Symbol(zunigae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 748, 35)) +>zunigae : Symbol(cinereus.zunigae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 748, 35)) >rendalli : Symbol(rendalli, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 151, 1)) >crenulata : Symbol(rendalli.crenulata, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 180, 3)) >macrorhinos : Symbol(macrorhinos, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 461, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 497, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 736, 1)) @@ -9664,7 +9664,7 @@ module sagitta { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 749, 124)) microps(): daubentonii.nigricans> { var x: daubentonii.nigricans>; () => { var y = this; }; return x; } ->microps : Symbol(microps, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 749, 265)) +>microps : Symbol(cinereus.microps, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 749, 265)) >daubentonii : Symbol(daubentonii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 471, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 586, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 636, 1)) >nigricans : Symbol(daubentonii.nigricans, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 587, 20)) >caurinus : Symbol(caurinus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 449, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 836, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 976, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1007, 1)) @@ -9691,7 +9691,7 @@ module sagitta { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 750, 127)) guaporensis(): daubentonii.arboreus { var x: daubentonii.arboreus; () => { var y = this; }; return x; } ->guaporensis : Symbol(guaporensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 750, 271)) +>guaporensis : Symbol(cinereus.guaporensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 750, 271)) >daubentonii : Symbol(daubentonii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 471, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 586, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 636, 1)) >arboreus : Symbol(daubentonii.arboreus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 637, 20)) >gabriellae : Symbol(gabriellae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 766, 1)) @@ -9710,7 +9710,7 @@ module sagitta { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 751, 86)) tonkeana(): panglima.fundatus { var x: panglima.fundatus; () => { var y = this; }; return x; } ->tonkeana : Symbol(tonkeana, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 751, 185)) +>tonkeana : Symbol(cinereus.tonkeana, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 751, 185)) >panglima : Symbol(panglima, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 400, 1)) >fundatus : Symbol(panglima.fundatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 409, 5)) >petrophilus : Symbol(petrophilus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 715, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 823, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 998, 1)) @@ -9729,7 +9729,7 @@ module sagitta { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 752, 87)) montensis(): dammermani.siberu { var x: dammermani.siberu; () => { var y = this; }; return x; } ->montensis : Symbol(montensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 752, 190)) +>montensis : Symbol(cinereus.montensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 752, 190)) >dammermani : Symbol(dammermani, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 591, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 913, 1)) >siberu : Symbol(dammermani.siberu, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 592, 19)) >dogramacii : Symbol(dogramacii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 314, 1)) @@ -9748,7 +9748,7 @@ module sagitta { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 753, 86)) sphinx(): minutus.portoricensis { var x: minutus.portoricensis; () => { var y = this; }; return x; } ->sphinx : Symbol(sphinx, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 753, 187)) +>sphinx : Symbol(cinereus.sphinx, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 753, 187)) >minutus : Symbol(minutus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 433, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 492, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 848, 1)) >portoricensis : Symbol(minutus.portoricensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 849, 16)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 754, 45)) @@ -9759,7 +9759,7 @@ module sagitta { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 754, 45)) glis(): argurus.wetmorei { var x: argurus.wetmorei; () => { var y = this; }; return x; } ->glis : Symbol(glis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 754, 108)) +>glis : Symbol(cinereus.glis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 754, 108)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) >wetmorei : Symbol(argurus.wetmorei, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 614, 16)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) @@ -9778,7 +9778,7 @@ module sagitta { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 755, 68)) dorsalis(): petrophilus.sodyi { var x: petrophilus.sodyi; () => { var y = this; }; return x; } ->dorsalis : Symbol(dorsalis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 755, 156)) +>dorsalis : Symbol(cinereus.dorsalis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 755, 156)) >petrophilus : Symbol(petrophilus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 715, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 823, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 998, 1)) >sodyi : Symbol(petrophilus.sodyi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 824, 20)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) @@ -9797,7 +9797,7 @@ module sagitta { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 756, 81)) fimbriatus(): provocax.melanoleuca { var x: provocax.melanoleuca; () => { var y = this; }; return x; } ->fimbriatus : Symbol(fimbriatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 756, 178)) +>fimbriatus : Symbol(cinereus.fimbriatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 756, 178)) >provocax : Symbol(provocax, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 669, 1)) >melanoleuca : Symbol(provocax.melanoleuca, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 670, 17)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 757, 48)) @@ -9808,7 +9808,7 @@ module sagitta { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 757, 48)) sara(): nigra.gracilis { var x: nigra.gracilis; () => { var y = this; }; return x; } ->sara : Symbol(sara, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 757, 110)) +>sara : Symbol(cinereus.sara, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 757, 110)) >nigra : Symbol(nigra, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 388, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 475, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 514, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 762, 1)) >gracilis : Symbol(nigra.gracilis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 515, 14)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) @@ -9827,7 +9827,7 @@ module sagitta { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 758, 78)) epimelas(): sagitta.stolzmanni { var x: sagitta.stolzmanni; () => { var y = this; }; return x; } ->epimelas : Symbol(epimelas, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 758, 176)) +>epimelas : Symbol(cinereus.epimelas, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 758, 176)) >sagitta : Symbol(sagitta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 487, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 577, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 675, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 746, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 898, 1)) >stolzmanni : Symbol(stolzmanni, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 899, 16)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 759, 44)) @@ -9838,7 +9838,7 @@ module sagitta { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 759, 44)) pittieri(): samarensis.fuscus { var x: samarensis.fuscus; () => { var y = this; }; return x; } ->pittieri : Symbol(pittieri, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 759, 104)) +>pittieri : Symbol(cinereus.pittieri, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 759, 104)) >samarensis : Symbol(samarensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 531, 1)) >fuscus : Symbol(samarensis.fuscus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 547, 5)) >quasiater : Symbol(quasiater, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 236, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 422, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 813, 1)) @@ -9885,7 +9885,7 @@ module gabriellae { >amicus : Symbol(amicus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 769, 5)) pirrensis(): argurus.luctuosa { var x: argurus.luctuosa; () => { var y = this; }; return x; } ->pirrensis : Symbol(pirrensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 770, 25)) +>pirrensis : Symbol(amicus.pirrensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 770, 25)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) >luctuosa : Symbol(argurus.luctuosa, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 982, 16)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 771, 43)) @@ -9896,7 +9896,7 @@ module gabriellae { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 771, 43)) phaeura(): panglima.abidi { var x: panglima.abidi; () => { var y = this; }; return x; } ->phaeura : Symbol(phaeura, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 771, 101)) +>phaeura : Symbol(amicus.phaeura, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 771, 101)) >panglima : Symbol(panglima, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 400, 1)) >abidi : Symbol(panglima.abidi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 414, 5)) >lutreolus : Symbol(lutreolus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 355, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 719, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 855, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 872, 1)) @@ -9915,7 +9915,7 @@ module gabriellae { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 772, 76)) voratus(): lavali.thaeleri { var x: lavali.thaeleri; () => { var y = this; }; return x; } ->voratus : Symbol(voratus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 772, 169)) +>voratus : Symbol(amicus.voratus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 772, 169)) >lavali : Symbol(lavali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 252, 1)) >thaeleri : Symbol(lavali.thaeleri, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 299, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 773, 40)) @@ -9926,7 +9926,7 @@ module gabriellae { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 773, 40)) satarae(): trivirgatus.lotor { var x: trivirgatus.lotor; () => { var y = this; }; return x; } ->satarae : Symbol(satarae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 773, 97)) +>satarae : Symbol(amicus.satarae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 773, 97)) >trivirgatus : Symbol(trivirgatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 186, 1)) >lotor : Symbol(trivirgatus.lotor, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 206, 3)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) @@ -9945,7 +9945,7 @@ module gabriellae { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 774, 76)) hooperi(): caurinus.psilurus { var x: caurinus.psilurus; () => { var y = this; }; return x; } ->hooperi : Symbol(hooperi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 774, 169)) +>hooperi : Symbol(amicus.hooperi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 774, 169)) >caurinus : Symbol(caurinus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 449, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 836, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 976, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1007, 1)) >psilurus : Symbol(caurinus.psilurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1008, 17)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 775, 42)) @@ -9956,7 +9956,7 @@ module gabriellae { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 775, 42)) perrensi(): rendalli.crenulata { var x: rendalli.crenulata; () => { var y = this; }; return x; } ->perrensi : Symbol(perrensi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 775, 101)) +>perrensi : Symbol(amicus.perrensi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 775, 101)) >rendalli : Symbol(rendalli, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 151, 1)) >crenulata : Symbol(rendalli.crenulata, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 180, 3)) >trivirgatus : Symbol(trivirgatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 186, 1)) @@ -9975,7 +9975,7 @@ module gabriellae { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 776, 82)) ridei(): ruatanica.hector> { var x: ruatanica.hector>; () => { var y = this; }; return x; } ->ridei : Symbol(ridei, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 776, 180)) +>ridei : Symbol(amicus.ridei, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 776, 180)) >ruatanica : Symbol(ruatanica, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 100, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 244, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 959, 1)) >hector : Symbol(ruatanica.hector, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 101, 18)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) @@ -10002,7 +10002,7 @@ module gabriellae { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 777, 117)) audeberti(): daubentonii.arboreus { var x: daubentonii.arboreus; () => { var y = this; }; return x; } ->audeberti : Symbol(audeberti, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 777, 253)) +>audeberti : Symbol(amicus.audeberti, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 777, 253)) >daubentonii : Symbol(daubentonii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 471, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 586, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 636, 1)) >arboreus : Symbol(daubentonii.arboreus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 637, 20)) >dogramacii : Symbol(dogramacii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 314, 1)) @@ -10021,7 +10021,7 @@ module gabriellae { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 778, 86)) Lutetium(): macrorhinos.marmosurus { var x: macrorhinos.marmosurus; () => { var y = this; }; return x; } ->Lutetium : Symbol(Lutetium, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 778, 187)) +>Lutetium : Symbol(amicus.Lutetium, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 778, 187)) >macrorhinos : Symbol(macrorhinos, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 461, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 497, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 736, 1)) >marmosurus : Symbol(macrorhinos.marmosurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 462, 20)) >sagitta : Symbol(sagitta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 487, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 577, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 675, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 746, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 898, 1)) @@ -10040,7 +10040,7 @@ module gabriellae { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 779, 85)) atrox(): samarensis.fuscus, dogramacii.koepckeae> { var x: samarensis.fuscus, dogramacii.koepckeae>; () => { var y = this; }; return x; } ->atrox : Symbol(atrox, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 779, 186)) +>atrox : Symbol(amicus.atrox, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 779, 186)) >samarensis : Symbol(samarensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 531, 1)) >fuscus : Symbol(samarensis.fuscus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 547, 5)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) @@ -10070,7 +10070,7 @@ module gabriellae { >echinatus : Symbol(echinatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 781, 5)) tenuipes(): howi.coludo> { var x: howi.coludo>; () => { var y = this; }; return x; } ->tenuipes : Symbol(tenuipes, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 782, 28)) +>tenuipes : Symbol(echinatus.tenuipes, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 782, 28)) >howi : Symbol(howi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 466, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 681, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 886, 1)) >coludo : Symbol(howi.coludo, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 887, 13)) >macrorhinos : Symbol(macrorhinos, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 461, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 497, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 736, 1)) @@ -10106,7 +10106,7 @@ module imperfecta { >T1 : Symbol(T1, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 787, 29)) marisae(): lavali.thaeleri { var x: lavali.thaeleri; () => { var y = this; }; return x; } ->marisae : Symbol(marisae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 787, 35)) +>marisae : Symbol(lasiurus.marisae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 787, 35)) >lavali : Symbol(lavali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 252, 1)) >thaeleri : Symbol(lavali.thaeleri, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 299, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 788, 40)) @@ -10117,7 +10117,7 @@ module imperfecta { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 788, 40)) fulvus(): argurus.germaini { var x: argurus.germaini; () => { var y = this; }; return x; } ->fulvus : Symbol(fulvus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 788, 97)) +>fulvus : Symbol(lasiurus.fulvus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 788, 97)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) >germaini : Symbol(argurus.germaini, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 893, 16)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 789, 40)) @@ -10128,7 +10128,7 @@ module imperfecta { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 789, 40)) paranaensis(): dogramacii.koepckeae { var x: dogramacii.koepckeae; () => { var y = this; }; return x; } ->paranaensis : Symbol(paranaensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 789, 98)) +>paranaensis : Symbol(lasiurus.paranaensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 789, 98)) >dogramacii : Symbol(dogramacii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 314, 1)) >koepckeae : Symbol(dogramacii.koepckeae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 326, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 790, 49)) @@ -10139,7 +10139,7 @@ module imperfecta { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 790, 49)) didactylus(): panglima.abidi> { var x: panglima.abidi>; () => { var y = this; }; return x; } ->didactylus : Symbol(didactylus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 790, 111)) +>didactylus : Symbol(lasiurus.didactylus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 790, 111)) >panglima : Symbol(panglima, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 400, 1)) >abidi : Symbol(panglima.abidi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 414, 5)) >dogramacii : Symbol(dogramacii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 314, 1)) @@ -10166,7 +10166,7 @@ module imperfecta { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 791, 130)) schreibersii(): nigra.gracilis { var x: nigra.gracilis; () => { var y = this; }; return x; } ->schreibersii : Symbol(schreibersii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 791, 274)) +>schreibersii : Symbol(lasiurus.schreibersii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 791, 274)) >nigra : Symbol(nigra, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 388, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 475, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 514, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 762, 1)) >gracilis : Symbol(nigra.gracilis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 515, 14)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) @@ -10185,7 +10185,7 @@ module imperfecta { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 792, 84)) orii(): dogramacii.kaiseri { var x: dogramacii.kaiseri; () => { var y = this; }; return x; } ->orii : Symbol(orii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 792, 180)) +>orii : Symbol(lasiurus.orii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 792, 180)) >dogramacii : Symbol(dogramacii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 314, 1)) >kaiseri : Symbol(dogramacii.kaiseri, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 329, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 793, 40)) @@ -10199,7 +10199,7 @@ module imperfecta { >subspinosus : Symbol(subspinosus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 794, 5)) monticularis(): macrorhinos.konganensis { var x: macrorhinos.konganensis; () => { var y = this; }; return x; } ->monticularis : Symbol(monticularis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 795, 30)) +>monticularis : Symbol(subspinosus.monticularis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 795, 30)) >macrorhinos : Symbol(macrorhinos, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 461, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 497, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 736, 1)) >konganensis : Symbol(macrorhinos.konganensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 498, 20)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 796, 53)) @@ -10210,7 +10210,7 @@ module imperfecta { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 796, 53)) Gadolinium(): nigra.caucasica { var x: nigra.caucasica; () => { var y = this; }; return x; } ->Gadolinium : Symbol(Gadolinium, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 796, 118)) +>Gadolinium : Symbol(subspinosus.Gadolinium, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 796, 118)) >nigra : Symbol(nigra, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 388, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 475, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 514, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 762, 1)) >caucasica : Symbol(nigra.caucasica, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 763, 14)) >sagitta : Symbol(sagitta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 487, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 577, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 675, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 746, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 898, 1)) @@ -10229,7 +10229,7 @@ module imperfecta { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 797, 80)) oasicus(): caurinus.johorensis> { var x: caurinus.johorensis>; () => { var y = this; }; return x; } ->oasicus : Symbol(oasicus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 797, 174)) +>oasicus : Symbol(subspinosus.oasicus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 797, 174)) >caurinus : Symbol(caurinus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 449, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 836, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 976, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1007, 1)) >johorensis : Symbol(caurinus.johorensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 977, 17)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) @@ -10256,7 +10256,7 @@ module imperfecta { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 798, 124)) paterculus(): lutreolus.punicus { var x: lutreolus.punicus; () => { var y = this; }; return x; } ->paterculus : Symbol(paterculus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 798, 265)) +>paterculus : Symbol(subspinosus.paterculus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 798, 265)) >lutreolus : Symbol(lutreolus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 355, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 719, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 855, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 872, 1)) >punicus : Symbol(lutreolus.punicus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 720, 18)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 799, 45)) @@ -10267,7 +10267,7 @@ module imperfecta { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 799, 45)) punctata(): lavali.thaeleri { var x: lavali.thaeleri; () => { var y = this; }; return x; } ->punctata : Symbol(punctata, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 799, 104)) +>punctata : Symbol(subspinosus.punctata, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 799, 104)) >lavali : Symbol(lavali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 252, 1)) >thaeleri : Symbol(lavali.thaeleri, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 299, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 800, 41)) @@ -10278,7 +10278,7 @@ module imperfecta { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 800, 41)) invictus(): sagitta.stolzmanni { var x: sagitta.stolzmanni; () => { var y = this; }; return x; } ->invictus : Symbol(invictus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 800, 98)) +>invictus : Symbol(subspinosus.invictus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 800, 98)) >sagitta : Symbol(sagitta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 487, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 577, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 675, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 746, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 898, 1)) >stolzmanni : Symbol(sagitta.stolzmanni, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 899, 16)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 801, 44)) @@ -10289,7 +10289,7 @@ module imperfecta { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 801, 44)) stangeri(): petrophilus.minutilla { var x: petrophilus.minutilla; () => { var y = this; }; return x; } ->stangeri : Symbol(stangeri, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 801, 104)) +>stangeri : Symbol(subspinosus.stangeri, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 801, 104)) >petrophilus : Symbol(petrophilus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 715, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 823, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 998, 1)) >minutilla : Symbol(petrophilus.minutilla, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 716, 20)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 802, 47)) @@ -10300,7 +10300,7 @@ module imperfecta { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 802, 47)) siskiyou(): minutus.inez { var x: minutus.inez; () => { var y = this; }; return x; } ->siskiyou : Symbol(siskiyou, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 802, 110)) +>siskiyou : Symbol(subspinosus.siskiyou, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 802, 110)) >minutus : Symbol(minutus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 433, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 492, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 848, 1)) >inez : Symbol(minutus.inez, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 493, 16)) >macrorhinos : Symbol(macrorhinos, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 461, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 497, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 736, 1)) @@ -10319,7 +10319,7 @@ module imperfecta { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 803, 84)) welwitschii(): rionegrensis.caniventer { var x: rionegrensis.caniventer; () => { var y = this; }; return x; } ->welwitschii : Symbol(welwitschii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 803, 184)) +>welwitschii : Symbol(subspinosus.welwitschii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 803, 184)) >rionegrensis : Symbol(rionegrensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 0, 0)) >caniventer : Symbol(rionegrensis.caniventer, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 0, 21)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 804, 52)) @@ -10330,7 +10330,7 @@ module imperfecta { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 804, 52)) Polonium(): lavali.wilsoni { var x: lavali.wilsoni; () => { var y = this; }; return x; } ->Polonium : Symbol(Polonium, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 804, 117)) +>Polonium : Symbol(subspinosus.Polonium, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 804, 117)) >lavali : Symbol(lavali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 252, 1)) >wilsoni : Symbol(lavali.wilsoni, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 253, 15)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 805, 40)) @@ -10341,7 +10341,7 @@ module imperfecta { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 805, 40)) harpia(): argurus.luctuosa { var x: argurus.luctuosa; () => { var y = this; }; return x; } ->harpia : Symbol(harpia, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 805, 96)) +>harpia : Symbol(subspinosus.harpia, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 805, 96)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) >luctuosa : Symbol(argurus.luctuosa, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 982, 16)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 806, 40)) @@ -10360,7 +10360,7 @@ module imperfecta { >robustulus : Symbol(dogramacii.robustulus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 315, 19)) leschenaultii(): argurus.dauricus> { var x: argurus.dauricus>; () => { var y = this; }; return x; } ->leschenaultii : Symbol(leschenaultii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 808, 68)) +>leschenaultii : Symbol(ciliolabrum.leschenaultii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 808, 68)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) >dauricus : Symbol(argurus.dauricus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 374, 16)) >Lanthanum : Symbol(Lanthanum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 106, 1)) @@ -10387,7 +10387,7 @@ module imperfecta { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 809, 132)) ludia(): caurinus.johorensis { var x: caurinus.johorensis; () => { var y = this; }; return x; } ->ludia : Symbol(ludia, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 809, 275)) +>ludia : Symbol(ciliolabrum.ludia, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 809, 275)) >caurinus : Symbol(caurinus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 449, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 836, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 976, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1007, 1)) >johorensis : Symbol(caurinus.johorensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 977, 17)) >rionegrensis : Symbol(rionegrensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 0, 0)) @@ -10406,7 +10406,7 @@ module imperfecta { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 810, 86)) sinicus(): macrorhinos.marmosurus { var x: macrorhinos.marmosurus; () => { var y = this; }; return x; } ->sinicus : Symbol(sinicus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 810, 191)) +>sinicus : Symbol(ciliolabrum.sinicus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 810, 191)) >macrorhinos : Symbol(macrorhinos, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 461, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 497, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 736, 1)) >marmosurus : Symbol(macrorhinos.marmosurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 462, 20)) >macrorhinos : Symbol(macrorhinos, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 461, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 497, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 736, 1)) @@ -10434,7 +10434,7 @@ module quasiater { >T1 : Symbol(T1, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 815, 27)) lagotis(): lavali.xanthognathus { var x: lavali.xanthognathus; () => { var y = this; }; return x; } ->lagotis : Symbol(lagotis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 815, 33)) +>lagotis : Symbol(wattsi.lagotis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 815, 33)) >lavali : Symbol(lavali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 252, 1)) >xanthognathus : Symbol(lavali.xanthognathus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 285, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 816, 45)) @@ -10445,7 +10445,7 @@ module quasiater { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 816, 45)) hussoni(): lavali.wilsoni { var x: lavali.wilsoni; () => { var y = this; }; return x; } ->hussoni : Symbol(hussoni, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 816, 107)) +>hussoni : Symbol(wattsi.hussoni, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 816, 107)) >lavali : Symbol(lavali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 252, 1)) >wilsoni : Symbol(lavali.wilsoni, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 253, 15)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 817, 39)) @@ -10456,7 +10456,7 @@ module quasiater { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 817, 39)) bilarni(): samarensis.cahirinus>, dogramacii.koepckeae> { var x: samarensis.cahirinus>, dogramacii.koepckeae>; () => { var y = this; }; return x; } ->bilarni : Symbol(bilarni, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 817, 95)) +>bilarni : Symbol(wattsi.bilarni, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 817, 95)) >samarensis : Symbol(samarensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 531, 1)) >cahirinus : Symbol(samarensis.cahirinus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 569, 5)) >rendalli : Symbol(rendalli, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 151, 1)) @@ -10491,7 +10491,7 @@ module quasiater { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 818, 158)) cabrerae(): lavali.lepturus { var x: lavali.lepturus; () => { var y = this; }; return x; } ->cabrerae : Symbol(cabrerae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 818, 333)) +>cabrerae : Symbol(wattsi.cabrerae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 818, 333)) >lavali : Symbol(lavali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 252, 1)) >lepturus : Symbol(lavali.lepturus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 309, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 819, 41)) @@ -10517,7 +10517,7 @@ module petrophilus { >bobrinskoi : Symbol(quasiater.bobrinskoi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 237, 18)) saundersiae(): samarensis.pallidus { var x: samarensis.pallidus; () => { var y = this; }; return x; } ->saundersiae : Symbol(saundersiae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 825, 61)) +>saundersiae : Symbol(sodyi.saundersiae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 825, 61)) >samarensis : Symbol(samarensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 531, 1)) >pallidus : Symbol(samarensis.pallidus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 563, 5)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 826, 48)) @@ -10528,7 +10528,7 @@ module petrophilus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 826, 48)) imberbis(): quasiater.carolinensis { var x: quasiater.carolinensis; () => { var y = this; }; return x; } ->imberbis : Symbol(imberbis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 826, 109)) +>imberbis : Symbol(sodyi.imberbis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 826, 109)) >quasiater : Symbol(quasiater, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 236, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 422, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 813, 1)) >carolinensis : Symbol(quasiater.carolinensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 423, 18)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 827, 48)) @@ -10539,7 +10539,7 @@ module petrophilus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 827, 48)) cansdalei(): dammermani.melanops { var x: dammermani.melanops; () => { var y = this; }; return x; } ->cansdalei : Symbol(cansdalei, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 827, 112)) +>cansdalei : Symbol(sodyi.cansdalei, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 827, 112)) >dammermani : Symbol(dammermani, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 591, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 913, 1)) >melanops : Symbol(dammermani.melanops, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 914, 19)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 828, 46)) @@ -10550,7 +10550,7 @@ module petrophilus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 828, 46)) Lawrencium(): nigra.dolichurus { var x: nigra.dolichurus; () => { var y = this; }; return x; } ->Lawrencium : Symbol(Lawrencium, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 828, 107)) +>Lawrencium : Symbol(sodyi.Lawrencium, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 828, 107)) >nigra : Symbol(nigra, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 388, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 475, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 514, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 762, 1)) >dolichurus : Symbol(nigra.dolichurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 389, 14)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) @@ -10569,7 +10569,7 @@ module petrophilus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 829, 88)) catta(): argurus.oreas { var x: argurus.oreas; () => { var y = this; }; return x; } ->catta : Symbol(catta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 829, 190)) +>catta : Symbol(sodyi.catta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 829, 190)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) >oreas : Symbol(argurus.oreas, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 625, 16)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 830, 36)) @@ -10580,7 +10580,7 @@ module petrophilus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 830, 36)) breviceps(): argurus.dauricus { var x: argurus.dauricus; () => { var y = this; }; return x; } ->breviceps : Symbol(breviceps, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 830, 91)) +>breviceps : Symbol(sodyi.breviceps, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 830, 91)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) >dauricus : Symbol(argurus.dauricus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 374, 16)) >dogramacii : Symbol(dogramacii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 314, 1)) @@ -10599,7 +10599,7 @@ module petrophilus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 831, 83)) transitionalis(): rendalli.zuluensis { var x: rendalli.zuluensis; () => { var y = this; }; return x; } ->transitionalis : Symbol(transitionalis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 831, 181)) +>transitionalis : Symbol(sodyi.transitionalis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 831, 181)) >rendalli : Symbol(rendalli, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 151, 1)) >zuluensis : Symbol(rendalli.zuluensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 152, 17)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 832, 50)) @@ -10610,7 +10610,7 @@ module petrophilus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 832, 50)) heptneri(): argurus.germaini { var x: argurus.germaini; () => { var y = this; }; return x; } ->heptneri : Symbol(heptneri, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 832, 110)) +>heptneri : Symbol(sodyi.heptneri, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 832, 110)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) >germaini : Symbol(argurus.germaini, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 893, 16)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 833, 42)) @@ -10621,7 +10621,7 @@ module petrophilus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 833, 42)) bairdii(): lavali.beisa { var x: lavali.beisa; () => { var y = this; }; return x; } ->bairdii : Symbol(bairdii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 833, 100)) +>bairdii : Symbol(sodyi.bairdii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 833, 100)) >lavali : Symbol(lavali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 252, 1)) >beisa : Symbol(lavali.beisa, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 268, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 834, 37)) @@ -10650,7 +10650,7 @@ module caurinus { >marcanoi : Symbol(howi.marcanoi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 682, 13)) montana(): argurus.oreas { var x: argurus.oreas; () => { var y = this; }; return x; } ->montana : Symbol(montana, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 838, 122)) +>montana : Symbol(megaphyllus.montana, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 838, 122)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) >oreas : Symbol(argurus.oreas, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 625, 16)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 839, 38)) @@ -10661,7 +10661,7 @@ module caurinus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 839, 38)) amatus(): lutreolus.schlegeli { var x: lutreolus.schlegeli; () => { var y = this; }; return x; } ->amatus : Symbol(amatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 839, 93)) +>amatus : Symbol(megaphyllus.amatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 839, 93)) >lutreolus : Symbol(lutreolus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 355, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 719, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 855, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 872, 1)) >schlegeli : Symbol(lutreolus.schlegeli, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 356, 18)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 840, 43)) @@ -10672,7 +10672,7 @@ module caurinus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 840, 43)) bucculentus(): gabriellae.echinatus { var x: gabriellae.echinatus; () => { var y = this; }; return x; } ->bucculentus : Symbol(bucculentus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 840, 104)) +>bucculentus : Symbol(megaphyllus.bucculentus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 840, 104)) >gabriellae : Symbol(gabriellae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 766, 1)) >echinatus : Symbol(gabriellae.echinatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 781, 5)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 841, 49)) @@ -10683,7 +10683,7 @@ module caurinus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 841, 49)) lepida(): rendalli.crenulata> { var x: rendalli.crenulata>; () => { var y = this; }; return x; } ->lepida : Symbol(lepida, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 841, 111)) +>lepida : Symbol(megaphyllus.lepida, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 841, 111)) >rendalli : Symbol(rendalli, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 151, 1)) >crenulata : Symbol(rendalli.crenulata, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 180, 3)) >lavali : Symbol(lavali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 252, 1)) @@ -10710,7 +10710,7 @@ module caurinus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 842, 113)) graecus(): dogramacii.kaiseri { var x: dogramacii.kaiseri; () => { var y = this; }; return x; } ->graecus : Symbol(graecus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 842, 244)) +>graecus : Symbol(megaphyllus.graecus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 842, 244)) >dogramacii : Symbol(dogramacii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 314, 1)) >kaiseri : Symbol(dogramacii.kaiseri, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 329, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 843, 43)) @@ -10721,7 +10721,7 @@ module caurinus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 843, 43)) forsteri(): petrophilus.minutilla { var x: petrophilus.minutilla; () => { var y = this; }; return x; } ->forsteri : Symbol(forsteri, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 843, 103)) +>forsteri : Symbol(megaphyllus.forsteri, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 843, 103)) >petrophilus : Symbol(petrophilus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 715, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 823, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 998, 1)) >minutilla : Symbol(petrophilus.minutilla, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 716, 20)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 844, 47)) @@ -10732,7 +10732,7 @@ module caurinus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 844, 47)) perotensis(): samarensis.cahirinus { var x: samarensis.cahirinus; () => { var y = this; }; return x; } ->perotensis : Symbol(perotensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 844, 110)) +>perotensis : Symbol(megaphyllus.perotensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 844, 110)) >samarensis : Symbol(samarensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 531, 1)) >cahirinus : Symbol(samarensis.cahirinus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 569, 5)) >minutus : Symbol(minutus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 433, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 492, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 848, 1)) @@ -10751,7 +10751,7 @@ module caurinus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 845, 88)) cirrhosus(): quasiater.carolinensis { var x: quasiater.carolinensis; () => { var y = this; }; return x; } ->cirrhosus : Symbol(cirrhosus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 845, 190)) +>cirrhosus : Symbol(megaphyllus.cirrhosus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 845, 190)) >quasiater : Symbol(quasiater, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 236, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 422, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 813, 1)) >carolinensis : Symbol(quasiater.carolinensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 423, 18)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 846, 49)) @@ -10769,7 +10769,7 @@ module minutus { >portoricensis : Symbol(portoricensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 849, 16)) relictus(): quasiater.carolinensis { var x: quasiater.carolinensis; () => { var y = this; }; return x; } ->relictus : Symbol(relictus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 850, 32)) +>relictus : Symbol(portoricensis.relictus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 850, 32)) >quasiater : Symbol(quasiater, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 236, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 422, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 813, 1)) >carolinensis : Symbol(quasiater.carolinensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 423, 18)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 851, 48)) @@ -10780,7 +10780,7 @@ module minutus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 851, 48)) aequatorianus(): gabriellae.klossii { var x: gabriellae.klossii; () => { var y = this; }; return x; } ->aequatorianus : Symbol(aequatorianus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 851, 112)) +>aequatorianus : Symbol(portoricensis.aequatorianus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 851, 112)) >gabriellae : Symbol(gabriellae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 766, 1)) >klossii : Symbol(gabriellae.klossii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 767, 19)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) @@ -10799,7 +10799,7 @@ module minutus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 852, 89)) rhinogradoides(): samarensis.cahirinus { var x: samarensis.cahirinus; () => { var y = this; }; return x; } ->rhinogradoides : Symbol(rhinogradoides, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 852, 189)) +>rhinogradoides : Symbol(portoricensis.rhinogradoides, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 852, 189)) >samarensis : Symbol(samarensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 531, 1)) >cahirinus : Symbol(samarensis.cahirinus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 569, 5)) >quasiater : Symbol(quasiater, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 236, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 422, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 813, 1)) @@ -10825,7 +10825,7 @@ module lutreolus { >foina : Symbol(foina, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 856, 18)) tarfayensis(): lutreolus.punicus { var x: lutreolus.punicus; () => { var y = this; }; return x; } ->tarfayensis : Symbol(tarfayensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 857, 24)) +>tarfayensis : Symbol(foina.tarfayensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 857, 24)) >lutreolus : Symbol(lutreolus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 355, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 719, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 855, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 872, 1)) >punicus : Symbol(punicus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 720, 18)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 858, 46)) @@ -10836,7 +10836,7 @@ module lutreolus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 858, 46)) Promethium(): samarensis.pelurus { var x: samarensis.pelurus; () => { var y = this; }; return x; } ->Promethium : Symbol(Promethium, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 858, 105)) +>Promethium : Symbol(foina.Promethium, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 858, 105)) >samarensis : Symbol(samarensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 531, 1)) >pelurus : Symbol(samarensis.pelurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 532, 19)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) @@ -10855,7 +10855,7 @@ module lutreolus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 859, 83)) salinae(): gabriellae.klossii { var x: gabriellae.klossii; () => { var y = this; }; return x; } ->salinae : Symbol(salinae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 859, 180)) +>salinae : Symbol(foina.salinae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 859, 180)) >gabriellae : Symbol(gabriellae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 766, 1)) >klossii : Symbol(gabriellae.klossii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 767, 19)) >macrorhinos : Symbol(macrorhinos, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 461, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 497, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 736, 1)) @@ -10874,7 +10874,7 @@ module lutreolus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 860, 92)) kerri(): howi.coludo { var x: howi.coludo; () => { var y = this; }; return x; } ->kerri : Symbol(kerri, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 860, 201)) +>kerri : Symbol(foina.kerri, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 860, 201)) >howi : Symbol(howi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 466, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 681, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 886, 1)) >coludo : Symbol(howi.coludo, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 887, 13)) >quasiater : Symbol(quasiater, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 236, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 422, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 813, 1)) @@ -10893,7 +10893,7 @@ module lutreolus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 861, 81)) scotti(): quasiater.wattsi { var x: quasiater.wattsi; () => { var y = this; }; return x; } ->scotti : Symbol(scotti, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 861, 181)) +>scotti : Symbol(foina.scotti, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 861, 181)) >quasiater : Symbol(quasiater, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 236, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 422, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 813, 1)) >wattsi : Symbol(quasiater.wattsi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 814, 18)) >macrorhinos : Symbol(macrorhinos, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 461, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 497, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 736, 1)) @@ -10912,7 +10912,7 @@ module lutreolus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 862, 88)) camerunensis(): julianae.gerbillus { var x: julianae.gerbillus; () => { var y = this; }; return x; } ->camerunensis : Symbol(camerunensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 862, 194)) +>camerunensis : Symbol(foina.camerunensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 862, 194)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) >gerbillus : Symbol(julianae.gerbillus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 67, 3)) >imperfecta : Symbol(imperfecta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 785, 1)) @@ -10931,7 +10931,7 @@ module lutreolus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 863, 91)) affinis(): argurus.germaini { var x: argurus.germaini; () => { var y = this; }; return x; } ->affinis : Symbol(affinis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 863, 194)) +>affinis : Symbol(foina.affinis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 863, 194)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) >germaini : Symbol(argurus.germaini, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 893, 16)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 864, 41)) @@ -10942,7 +10942,7 @@ module lutreolus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 864, 41)) siebersi(): trivirgatus.lotor> { var x: trivirgatus.lotor>; () => { var y = this; }; return x; } ->siebersi : Symbol(siebersi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 864, 99)) +>siebersi : Symbol(foina.siebersi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 864, 99)) >trivirgatus : Symbol(trivirgatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 186, 1)) >lotor : Symbol(trivirgatus.lotor, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 206, 3)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) @@ -10969,7 +10969,7 @@ module lutreolus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 865, 105)) maquassiensis(): trivirgatus.oconnelli { var x: trivirgatus.oconnelli; () => { var y = this; }; return x; } ->maquassiensis : Symbol(maquassiensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 865, 226)) +>maquassiensis : Symbol(foina.maquassiensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 865, 226)) >trivirgatus : Symbol(trivirgatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 186, 1)) >oconnelli : Symbol(trivirgatus.oconnelli, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 219, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 866, 52)) @@ -10980,7 +10980,7 @@ module lutreolus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 866, 52)) layardi(): julianae.albidens { var x: julianae.albidens; () => { var y = this; }; return x; } ->layardi : Symbol(layardi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 866, 115)) +>layardi : Symbol(foina.layardi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 866, 115)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) >albidens : Symbol(julianae.albidens, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 34, 3)) >howi : Symbol(howi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 466, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 681, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 886, 1)) @@ -10999,7 +10999,7 @@ module lutreolus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 867, 79)) bishopi(): dogramacii.aurata { var x: dogramacii.aurata; () => { var y = this; }; return x; } ->bishopi : Symbol(bishopi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 867, 175)) +>bishopi : Symbol(foina.bishopi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 867, 175)) >dogramacii : Symbol(dogramacii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 314, 1)) >aurata : Symbol(dogramacii.aurata, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 344, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 868, 42)) @@ -11010,7 +11010,7 @@ module lutreolus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 868, 42)) apodemoides(): caurinus.psilurus { var x: caurinus.psilurus; () => { var y = this; }; return x; } ->apodemoides : Symbol(apodemoides, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 868, 101)) +>apodemoides : Symbol(foina.apodemoides, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 868, 101)) >caurinus : Symbol(caurinus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 449, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 836, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 976, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1007, 1)) >psilurus : Symbol(caurinus.psilurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1008, 17)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 869, 46)) @@ -11021,7 +11021,7 @@ module lutreolus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 869, 46)) argentiventer(): trivirgatus.mixtus { var x: trivirgatus.mixtus; () => { var y = this; }; return x; } ->argentiventer : Symbol(argentiventer, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 869, 105)) +>argentiventer : Symbol(foina.argentiventer, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 869, 105)) >trivirgatus : Symbol(trivirgatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 186, 1)) >mixtus : Symbol(trivirgatus.mixtus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 197, 3)) >gabriellae : Symbol(gabriellae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 766, 1)) @@ -11064,7 +11064,7 @@ module lutreolus { >melanops : Symbol(dammermani.melanops, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 914, 19)) antinorii(): petrophilus.sodyi { var x: petrophilus.sodyi; () => { var y = this; }; return x; } ->antinorii : Symbol(antinorii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 874, 164)) +>antinorii : Symbol(cor.antinorii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 874, 164)) >petrophilus : Symbol(petrophilus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 715, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 823, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 998, 1)) >sodyi : Symbol(petrophilus.sodyi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 824, 20)) >quasiater : Symbol(quasiater, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 236, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 422, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 813, 1)) @@ -11083,7 +11083,7 @@ module lutreolus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 875, 86)) voi(): caurinus.johorensis { var x: caurinus.johorensis; () => { var y = this; }; return x; } ->voi : Symbol(voi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 875, 187)) +>voi : Symbol(cor.voi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 875, 187)) >caurinus : Symbol(caurinus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 449, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 836, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 976, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1007, 1)) >johorensis : Symbol(caurinus.johorensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 977, 17)) >dammermani : Symbol(dammermani, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 591, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 913, 1)) @@ -11102,7 +11102,7 @@ module lutreolus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 876, 86)) mussoi(): quasiater.carolinensis { var x: quasiater.carolinensis; () => { var y = this; }; return x; } ->mussoi : Symbol(mussoi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 876, 193)) +>mussoi : Symbol(cor.mussoi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 876, 193)) >quasiater : Symbol(quasiater, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 236, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 422, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 813, 1)) >carolinensis : Symbol(quasiater.carolinensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 423, 18)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 877, 46)) @@ -11113,7 +11113,7 @@ module lutreolus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 877, 46)) truncatus(): trivirgatus.lotor { var x: trivirgatus.lotor; () => { var y = this; }; return x; } ->truncatus : Symbol(truncatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 877, 110)) +>truncatus : Symbol(cor.truncatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 877, 110)) >trivirgatus : Symbol(trivirgatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 186, 1)) >lotor : Symbol(trivirgatus.lotor, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 206, 3)) >sagitta : Symbol(sagitta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 487, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 577, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 675, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 746, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 898, 1)) @@ -11132,7 +11132,7 @@ module lutreolus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 878, 81)) achates(): provocax.melanoleuca { var x: provocax.melanoleuca; () => { var y = this; }; return x; } ->achates : Symbol(achates, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 878, 177)) +>achates : Symbol(cor.achates, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 878, 177)) >provocax : Symbol(provocax, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 669, 1)) >melanoleuca : Symbol(provocax.melanoleuca, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 670, 17)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 879, 45)) @@ -11143,7 +11143,7 @@ module lutreolus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 879, 45)) praedatrix(): howi.angulatus { var x: howi.angulatus; () => { var y = this; }; return x; } ->praedatrix : Symbol(praedatrix, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 879, 107)) +>praedatrix : Symbol(cor.praedatrix, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 879, 107)) >howi : Symbol(howi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 466, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 681, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 886, 1)) >angulatus : Symbol(howi.angulatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 467, 13)) >dogramacii : Symbol(dogramacii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 314, 1)) @@ -11162,7 +11162,7 @@ module lutreolus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 880, 80)) mzabi(): quasiater.wattsi, minutus.inez> { var x: quasiater.wattsi, minutus.inez>; () => { var y = this; }; return x; } ->mzabi : Symbol(mzabi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 880, 174)) +>mzabi : Symbol(cor.mzabi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 880, 174)) >quasiater : Symbol(quasiater, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 236, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 422, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 813, 1)) >wattsi : Symbol(quasiater.wattsi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 814, 18)) >trivirgatus : Symbol(trivirgatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 186, 1)) @@ -11197,7 +11197,7 @@ module lutreolus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 881, 155)) xanthinus(): nigra.gracilis, howi.marcanoi> { var x: nigra.gracilis, howi.marcanoi>; () => { var y = this; }; return x; } ->xanthinus : Symbol(xanthinus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 881, 329)) +>xanthinus : Symbol(cor.xanthinus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 881, 329)) >nigra : Symbol(nigra, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 388, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 475, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 514, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 762, 1)) >gracilis : Symbol(nigra.gracilis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 515, 14)) >panamensis : Symbol(panamensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 501, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 986, 1)) @@ -11224,7 +11224,7 @@ module lutreolus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 882, 119)) tapoatafa(): caurinus.megaphyllus { var x: caurinus.megaphyllus; () => { var y = this; }; return x; } ->tapoatafa : Symbol(tapoatafa, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 882, 253)) +>tapoatafa : Symbol(cor.tapoatafa, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 882, 253)) >caurinus : Symbol(caurinus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 449, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 836, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 976, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1007, 1)) >megaphyllus : Symbol(caurinus.megaphyllus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 837, 17)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 883, 47)) @@ -11235,7 +11235,7 @@ module lutreolus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 883, 47)) castroviejoi(): Lanthanum.jugularis { var x: Lanthanum.jugularis; () => { var y = this; }; return x; } ->castroviejoi : Symbol(castroviejoi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 883, 109)) +>castroviejoi : Symbol(cor.castroviejoi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 883, 109)) >Lanthanum : Symbol(Lanthanum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 106, 1)) >jugularis : Symbol(Lanthanum.jugularis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 134, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 884, 49)) @@ -11255,7 +11255,7 @@ module howi { >T1 : Symbol(T1, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 888, 27)) bernhardi(): lutreolus.punicus { var x: lutreolus.punicus; () => { var y = this; }; return x; } ->bernhardi : Symbol(bernhardi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 888, 33)) +>bernhardi : Symbol(coludo.bernhardi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 888, 33)) >lutreolus : Symbol(lutreolus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 355, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 719, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 855, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 872, 1)) >punicus : Symbol(lutreolus.punicus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 720, 18)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 889, 44)) @@ -11266,7 +11266,7 @@ module howi { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 889, 44)) isseli(): argurus.germaini { var x: argurus.germaini; () => { var y = this; }; return x; } ->isseli : Symbol(isseli, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 889, 103)) +>isseli : Symbol(coludo.isseli, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 889, 103)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) >germaini : Symbol(argurus.germaini, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 893, 16)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 890, 40)) @@ -11287,7 +11287,7 @@ module argurus { >amicus : Symbol(gabriellae.amicus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 769, 5)) sharpei(): lavali.wilsoni { var x: lavali.wilsoni; () => { var y = this; }; return x; } ->sharpei : Symbol(sharpei, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 894, 53)) +>sharpei : Symbol(germaini.sharpei, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 894, 53)) >lavali : Symbol(lavali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 252, 1)) >wilsoni : Symbol(lavali.wilsoni, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 253, 15)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 895, 39)) @@ -11298,7 +11298,7 @@ module argurus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 895, 39)) palmarum(): macrorhinos.marmosurus { var x: macrorhinos.marmosurus; () => { var y = this; }; return x; } ->palmarum : Symbol(palmarum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 895, 95)) +>palmarum : Symbol(germaini.palmarum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 895, 95)) >macrorhinos : Symbol(macrorhinos, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 461, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 497, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 736, 1)) >marmosurus : Symbol(macrorhinos.marmosurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 462, 20)) >Lanthanum : Symbol(Lanthanum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 106, 1)) @@ -11324,7 +11324,7 @@ module sagitta { >stolzmanni : Symbol(stolzmanni, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 899, 16)) riparius(): nigra.dolichurus { var x: nigra.dolichurus; () => { var y = this; }; return x; } ->riparius : Symbol(riparius, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 900, 29)) +>riparius : Symbol(stolzmanni.riparius, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 900, 29)) >nigra : Symbol(nigra, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 388, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 475, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 514, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 762, 1)) >dolichurus : Symbol(nigra.dolichurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 389, 14)) >dogramacii : Symbol(dogramacii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 314, 1)) @@ -11343,7 +11343,7 @@ module sagitta { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 901, 83)) dhofarensis(): lutreolus.foina { var x: lutreolus.foina; () => { var y = this; }; return x; } ->dhofarensis : Symbol(dhofarensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 901, 182)) +>dhofarensis : Symbol(stolzmanni.dhofarensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 901, 182)) >lutreolus : Symbol(lutreolus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 355, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 719, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 855, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 872, 1)) >foina : Symbol(lutreolus.foina, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 856, 18)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 902, 44)) @@ -11354,7 +11354,7 @@ module sagitta { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 902, 44)) tricolor(): argurus.germaini { var x: argurus.germaini; () => { var y = this; }; return x; } ->tricolor : Symbol(tricolor, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 902, 101)) +>tricolor : Symbol(stolzmanni.tricolor, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 902, 101)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) >germaini : Symbol(argurus.germaini, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 893, 16)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 903, 42)) @@ -11365,7 +11365,7 @@ module sagitta { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 903, 42)) gardneri(): lavali.xanthognathus { var x: lavali.xanthognathus; () => { var y = this; }; return x; } ->gardneri : Symbol(gardneri, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 903, 100)) +>gardneri : Symbol(stolzmanni.gardneri, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 903, 100)) >lavali : Symbol(lavali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 252, 1)) >xanthognathus : Symbol(lavali.xanthognathus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 285, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 904, 46)) @@ -11376,7 +11376,7 @@ module sagitta { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 904, 46)) walleri(): rendalli.moojeni, gabriellae.echinatus> { var x: rendalli.moojeni, gabriellae.echinatus>; () => { var y = this; }; return x; } ->walleri : Symbol(walleri, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 904, 108)) +>walleri : Symbol(stolzmanni.walleri, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 904, 108)) >rendalli : Symbol(rendalli, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 151, 1)) >moojeni : Symbol(rendalli.moojeni, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 168, 3)) >chrysaeolus : Symbol(chrysaeolus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 602, 1)) @@ -11403,7 +11403,7 @@ module sagitta { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 905, 132)) talpoides(): gabriellae.echinatus { var x: gabriellae.echinatus; () => { var y = this; }; return x; } ->talpoides : Symbol(talpoides, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 905, 281)) +>talpoides : Symbol(stolzmanni.talpoides, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 905, 281)) >gabriellae : Symbol(gabriellae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 766, 1)) >echinatus : Symbol(gabriellae.echinatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 781, 5)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 906, 47)) @@ -11414,7 +11414,7 @@ module sagitta { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 906, 47)) pallipes(): dammermani.melanops { var x: dammermani.melanops; () => { var y = this; }; return x; } ->pallipes : Symbol(pallipes, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 906, 109)) +>pallipes : Symbol(stolzmanni.pallipes, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 906, 109)) >dammermani : Symbol(dammermani, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 591, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 913, 1)) >melanops : Symbol(dammermani.melanops, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 914, 19)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 907, 45)) @@ -11425,7 +11425,7 @@ module sagitta { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 907, 45)) lagurus(): lavali.beisa { var x: lavali.beisa; () => { var y = this; }; return x; } ->lagurus : Symbol(lagurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 907, 106)) +>lagurus : Symbol(stolzmanni.lagurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 907, 106)) >lavali : Symbol(lavali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 252, 1)) >beisa : Symbol(lavali.beisa, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 268, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 908, 37)) @@ -11436,7 +11436,7 @@ module sagitta { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 908, 37)) hipposideros(): julianae.albidens { var x: julianae.albidens; () => { var y = this; }; return x; } ->hipposideros : Symbol(hipposideros, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 908, 91)) +>hipposideros : Symbol(stolzmanni.hipposideros, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 908, 91)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) >albidens : Symbol(julianae.albidens, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 34, 3)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) @@ -11455,7 +11455,7 @@ module sagitta { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 909, 87)) griselda(): caurinus.psilurus { var x: caurinus.psilurus; () => { var y = this; }; return x; } ->griselda : Symbol(griselda, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 909, 186)) +>griselda : Symbol(stolzmanni.griselda, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 909, 186)) >caurinus : Symbol(caurinus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 449, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 836, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 976, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1007, 1)) >psilurus : Symbol(caurinus.psilurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1008, 17)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 910, 43)) @@ -11466,7 +11466,7 @@ module sagitta { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 910, 43)) florium(): rendalli.zuluensis { var x: rendalli.zuluensis; () => { var y = this; }; return x; } ->florium : Symbol(florium, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 910, 102)) +>florium : Symbol(stolzmanni.florium, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 910, 102)) >rendalli : Symbol(rendalli, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 151, 1)) >zuluensis : Symbol(rendalli.zuluensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 152, 17)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 911, 43)) @@ -11491,7 +11491,7 @@ module dammermani { >melanops : Symbol(melanops, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 914, 19)) blarina(): dammermani.melanops { var x: dammermani.melanops; () => { var y = this; }; return x; } ->blarina : Symbol(blarina, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 915, 89)) +>blarina : Symbol(melanops.blarina, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 915, 89)) >dammermani : Symbol(dammermani, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 591, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 913, 1)) >melanops : Symbol(melanops, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 914, 19)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 916, 44)) @@ -11502,7 +11502,7 @@ module dammermani { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 916, 44)) harwoodi(): rionegrensis.veraecrucis, lavali.wilsoni> { var x: rionegrensis.veraecrucis, lavali.wilsoni>; () => { var y = this; }; return x; } ->harwoodi : Symbol(harwoodi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 916, 105)) +>harwoodi : Symbol(melanops.harwoodi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 916, 105)) >rionegrensis : Symbol(rionegrensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 0, 0)) >veraecrucis : Symbol(rionegrensis.veraecrucis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 7, 3)) >nigra : Symbol(nigra, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 388, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 475, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 514, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 762, 1)) @@ -11529,7 +11529,7 @@ module dammermani { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 917, 122)) ashaninka(): julianae.nudicaudus { var x: julianae.nudicaudus; () => { var y = this; }; return x; } ->ashaninka : Symbol(ashaninka, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 917, 260)) +>ashaninka : Symbol(melanops.ashaninka, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 917, 260)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) >nudicaudus : Symbol(julianae.nudicaudus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 18, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 918, 46)) @@ -11540,7 +11540,7 @@ module dammermani { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 918, 46)) wiedii(): julianae.steerii { var x: julianae.steerii; () => { var y = this; }; return x; } ->wiedii : Symbol(wiedii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 918, 107)) +>wiedii : Symbol(melanops.wiedii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 918, 107)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) >steerii : Symbol(julianae.steerii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 16, 17)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 919, 40)) @@ -11551,7 +11551,7 @@ module dammermani { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 919, 40)) godmani(): imperfecta.subspinosus { var x: imperfecta.subspinosus; () => { var y = this; }; return x; } ->godmani : Symbol(godmani, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 919, 98)) +>godmani : Symbol(melanops.godmani, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 919, 98)) >imperfecta : Symbol(imperfecta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 785, 1)) >subspinosus : Symbol(imperfecta.subspinosus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 794, 5)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 920, 47)) @@ -11562,7 +11562,7 @@ module dammermani { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 920, 47)) condorensis(): imperfecta.ciliolabrum { var x: imperfecta.ciliolabrum; () => { var y = this; }; return x; } ->condorensis : Symbol(condorensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 920, 111)) +>condorensis : Symbol(melanops.condorensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 920, 111)) >imperfecta : Symbol(imperfecta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 785, 1)) >ciliolabrum : Symbol(imperfecta.ciliolabrum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 807, 5)) >samarensis : Symbol(samarensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 531, 1)) @@ -11581,7 +11581,7 @@ module dammermani { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 921, 91)) xerophila(): panglima.abidi { var x: panglima.abidi; () => { var y = this; }; return x; } ->xerophila : Symbol(xerophila, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 921, 195)) +>xerophila : Symbol(melanops.xerophila, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 921, 195)) >panglima : Symbol(panglima, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 400, 1)) >abidi : Symbol(panglima.abidi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 414, 5)) >minutus : Symbol(minutus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 433, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 492, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 848, 1)) @@ -11600,7 +11600,7 @@ module dammermani { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 922, 81)) laminatus(): panglima.fundatus>> { var x: panglima.fundatus>>; () => { var y = this; }; return x; } ->laminatus : Symbol(laminatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 922, 177)) +>laminatus : Symbol(melanops.laminatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 922, 177)) >panglima : Symbol(panglima, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 400, 1)) >fundatus : Symbol(panglima.fundatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 409, 5)) >howi : Symbol(howi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 466, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 681, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 886, 1)) @@ -11635,7 +11635,7 @@ module dammermani { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 923, 164)) archeri(): howi.marcanoi { var x: howi.marcanoi; () => { var y = this; }; return x; } ->archeri : Symbol(archeri, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 923, 343)) +>archeri : Symbol(melanops.archeri, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 923, 343)) >howi : Symbol(howi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 466, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 681, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 886, 1)) >marcanoi : Symbol(howi.marcanoi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 682, 13)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 924, 38)) @@ -11646,7 +11646,7 @@ module dammermani { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 924, 38)) hidalgo(): minutus.inez { var x: minutus.inez; () => { var y = this; }; return x; } ->hidalgo : Symbol(hidalgo, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 924, 93)) +>hidalgo : Symbol(melanops.hidalgo, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 924, 93)) >minutus : Symbol(minutus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 433, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 492, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 848, 1)) >inez : Symbol(minutus.inez, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 493, 16)) >trivirgatus : Symbol(trivirgatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 186, 1)) @@ -11665,7 +11665,7 @@ module dammermani { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 925, 81)) unicolor(): lutreolus.schlegeli { var x: lutreolus.schlegeli; () => { var y = this; }; return x; } ->unicolor : Symbol(unicolor, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 925, 179)) +>unicolor : Symbol(melanops.unicolor, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 925, 179)) >lutreolus : Symbol(lutreolus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 355, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 719, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 855, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 872, 1)) >schlegeli : Symbol(lutreolus.schlegeli, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 356, 18)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 926, 45)) @@ -11676,7 +11676,7 @@ module dammermani { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 926, 45)) philippii(): nigra.gracilis { var x: nigra.gracilis; () => { var y = this; }; return x; } ->philippii : Symbol(philippii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 926, 106)) +>philippii : Symbol(melanops.philippii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 926, 106)) >nigra : Symbol(nigra, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 388, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 475, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 514, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 762, 1)) >gracilis : Symbol(nigra.gracilis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 515, 14)) >sagitta : Symbol(sagitta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 487, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 577, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 675, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 746, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 898, 1)) @@ -11695,7 +11695,7 @@ module dammermani { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 927, 78)) bocagei(): julianae.albidens { var x: julianae.albidens; () => { var y = this; }; return x; } ->bocagei : Symbol(bocagei, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 927, 171)) +>bocagei : Symbol(melanops.bocagei, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 927, 171)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) >albidens : Symbol(julianae.albidens, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 34, 3)) >lavali : Symbol(lavali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 252, 1)) @@ -11724,7 +11724,7 @@ module argurus { >uralensis : Symbol(patas.uralensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 653, 14)) aitkeni(): trivirgatus.mixtus, panglima.amphibius> { var x: trivirgatus.mixtus, panglima.amphibius>; () => { var y = this; }; return x; } ->aitkeni : Symbol(aitkeni, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 932, 53)) +>aitkeni : Symbol(peninsulae.aitkeni, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 932, 53)) >trivirgatus : Symbol(trivirgatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 186, 1)) >mixtus : Symbol(trivirgatus.mixtus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 197, 3)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) @@ -11759,7 +11759,7 @@ module argurus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 933, 162)) novaeangliae(): lavali.xanthognathus { var x: lavali.xanthognathus; () => { var y = this; }; return x; } ->novaeangliae : Symbol(novaeangliae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 933, 341)) +>novaeangliae : Symbol(peninsulae.novaeangliae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 933, 341)) >lavali : Symbol(lavali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 252, 1)) >xanthognathus : Symbol(lavali.xanthognathus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 285, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 934, 50)) @@ -11770,7 +11770,7 @@ module argurus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 934, 50)) olallae(): julianae.sumatrana { var x: julianae.sumatrana; () => { var y = this; }; return x; } ->olallae : Symbol(olallae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 934, 112)) +>olallae : Symbol(peninsulae.olallae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 934, 112)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) >sumatrana : Symbol(julianae.sumatrana, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 58, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 935, 43)) @@ -11781,7 +11781,7 @@ module argurus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 935, 43)) anselli(): dogramacii.aurata { var x: dogramacii.aurata; () => { var y = this; }; return x; } ->anselli : Symbol(anselli, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 935, 103)) +>anselli : Symbol(peninsulae.anselli, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 935, 103)) >dogramacii : Symbol(dogramacii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 314, 1)) >aurata : Symbol(dogramacii.aurata, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 344, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 936, 42)) @@ -11792,7 +11792,7 @@ module argurus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 936, 42)) timminsi(): macrorhinos.konganensis { var x: macrorhinos.konganensis; () => { var y = this; }; return x; } ->timminsi : Symbol(timminsi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 936, 101)) +>timminsi : Symbol(peninsulae.timminsi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 936, 101)) >macrorhinos : Symbol(macrorhinos, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 461, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 497, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 736, 1)) >konganensis : Symbol(macrorhinos.konganensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 498, 20)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 937, 49)) @@ -11803,7 +11803,7 @@ module argurus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 937, 49)) sordidus(): rendalli.moojeni { var x: rendalli.moojeni; () => { var y = this; }; return x; } ->sordidus : Symbol(sordidus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 937, 114)) +>sordidus : Symbol(peninsulae.sordidus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 937, 114)) >rendalli : Symbol(rendalli, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 151, 1)) >moojeni : Symbol(rendalli.moojeni, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 168, 3)) >macrorhinos : Symbol(macrorhinos, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 461, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 497, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 736, 1)) @@ -11822,7 +11822,7 @@ module argurus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 938, 89)) telfordi(): trivirgatus.oconnelli { var x: trivirgatus.oconnelli; () => { var y = this; }; return x; } ->telfordi : Symbol(telfordi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 938, 194)) +>telfordi : Symbol(peninsulae.telfordi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 938, 194)) >trivirgatus : Symbol(trivirgatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 186, 1)) >oconnelli : Symbol(trivirgatus.oconnelli, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 219, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 939, 47)) @@ -11833,7 +11833,7 @@ module argurus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 939, 47)) cavernarum(): minutus.inez { var x: minutus.inez; () => { var y = this; }; return x; } ->cavernarum : Symbol(cavernarum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 939, 110)) +>cavernarum : Symbol(peninsulae.cavernarum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 939, 110)) >minutus : Symbol(minutus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 433, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 492, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 848, 1)) >inez : Symbol(minutus.inez, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 493, 16)) >gabriellae : Symbol(gabriellae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 766, 1)) @@ -11861,7 +11861,7 @@ module argurus { >T1 : Symbol(T1, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 944, 30)) gravis(): nigra.caucasica, dogramacii.kaiseri> { var x: nigra.caucasica, dogramacii.kaiseri>; () => { var y = this; }; return x; } ->gravis : Symbol(gravis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 944, 36)) +>gravis : Symbol(netscheri.gravis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 944, 36)) >nigra : Symbol(nigra, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 388, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 475, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 514, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 762, 1)) >caucasica : Symbol(nigra.caucasica, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 763, 14)) >rendalli : Symbol(rendalli, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 151, 1)) @@ -11888,7 +11888,7 @@ module argurus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 945, 117)) ruschii(): imperfecta.lasiurus> { var x: imperfecta.lasiurus>; () => { var y = this; }; return x; } ->ruschii : Symbol(ruschii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 945, 252)) +>ruschii : Symbol(netscheri.ruschii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 945, 252)) >imperfecta : Symbol(imperfecta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 785, 1)) >lasiurus : Symbol(imperfecta.lasiurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 786, 19)) >howi : Symbol(howi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 466, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 681, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 886, 1)) @@ -11915,7 +11915,7 @@ module argurus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 946, 127)) tricuspidatus(): lavali.wilsoni { var x: lavali.wilsoni; () => { var y = this; }; return x; } ->tricuspidatus : Symbol(tricuspidatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 946, 271)) +>tricuspidatus : Symbol(netscheri.tricuspidatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 946, 271)) >lavali : Symbol(lavali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 252, 1)) >wilsoni : Symbol(lavali.wilsoni, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 253, 15)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 947, 45)) @@ -11926,7 +11926,7 @@ module argurus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 947, 45)) fernandezi(): dammermani.siberu, panglima.abidi> { var x: dammermani.siberu, panglima.abidi>; () => { var y = this; }; return x; } ->fernandezi : Symbol(fernandezi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 947, 101)) +>fernandezi : Symbol(netscheri.fernandezi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 947, 101)) >dammermani : Symbol(dammermani, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 591, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 913, 1)) >siberu : Symbol(dammermani.siberu, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 592, 19)) >nigra : Symbol(nigra, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 388, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 475, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 514, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 762, 1)) @@ -11961,7 +11961,7 @@ module argurus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 948, 153)) colletti(): samarensis.pallidus { var x: samarensis.pallidus; () => { var y = this; }; return x; } ->colletti : Symbol(colletti, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 948, 320)) +>colletti : Symbol(netscheri.colletti, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 948, 320)) >samarensis : Symbol(samarensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 531, 1)) >pallidus : Symbol(samarensis.pallidus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 563, 5)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 949, 45)) @@ -11972,7 +11972,7 @@ module argurus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 949, 45)) microbullatus(): lutreolus.schlegeli { var x: lutreolus.schlegeli; () => { var y = this; }; return x; } ->microbullatus : Symbol(microbullatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 949, 106)) +>microbullatus : Symbol(netscheri.microbullatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 949, 106)) >lutreolus : Symbol(lutreolus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 355, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 719, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 855, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 872, 1)) >schlegeli : Symbol(lutreolus.schlegeli, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 356, 18)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 950, 50)) @@ -11983,7 +11983,7 @@ module argurus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 950, 50)) eburneae(): chrysaeolus.sarasinorum { var x: chrysaeolus.sarasinorum; () => { var y = this; }; return x; } ->eburneae : Symbol(eburneae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 950, 111)) +>eburneae : Symbol(netscheri.eburneae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 950, 111)) >chrysaeolus : Symbol(chrysaeolus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 602, 1)) >sarasinorum : Symbol(chrysaeolus.sarasinorum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 603, 20)) >macrorhinos : Symbol(macrorhinos, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 461, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 497, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 736, 1)) @@ -12002,7 +12002,7 @@ module argurus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 951, 95)) tatei(): argurus.pygmaea> { var x: argurus.pygmaea>; () => { var y = this; }; return x; } ->tatei : Symbol(tatei, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 951, 206)) +>tatei : Symbol(netscheri.tatei, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 951, 206)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) >pygmaea : Symbol(pygmaea, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 596, 16)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) @@ -12029,7 +12029,7 @@ module argurus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 952, 121)) millardi(): sagitta.walkeri { var x: sagitta.walkeri; () => { var y = this; }; return x; } ->millardi : Symbol(millardi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 952, 261)) +>millardi : Symbol(netscheri.millardi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 952, 261)) >sagitta : Symbol(sagitta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 487, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 577, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 675, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 746, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 898, 1)) >walkeri : Symbol(sagitta.walkeri, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 488, 16)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 953, 41)) @@ -12040,7 +12040,7 @@ module argurus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 953, 41)) pruinosus(): trivirgatus.falconeri { var x: trivirgatus.falconeri; () => { var y = this; }; return x; } ->pruinosus : Symbol(pruinosus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 953, 98)) +>pruinosus : Symbol(netscheri.pruinosus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 953, 98)) >trivirgatus : Symbol(trivirgatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 186, 1)) >falconeri : Symbol(trivirgatus.falconeri, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 210, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 954, 48)) @@ -12051,7 +12051,7 @@ module argurus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 954, 48)) delator(): argurus.netscheri { var x: argurus.netscheri; () => { var y = this; }; return x; } ->delator : Symbol(delator, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 954, 111)) +>delator : Symbol(netscheri.delator, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 954, 111)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) >netscheri : Symbol(netscheri, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 943, 16)) >dogramacii : Symbol(dogramacii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 314, 1)) @@ -12070,7 +12070,7 @@ module argurus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 955, 79)) nyikae(): trivirgatus.tumidifrons, petrophilus.minutilla>, julianae.acariensis> { var x: trivirgatus.tumidifrons, petrophilus.minutilla>, julianae.acariensis>; () => { var y = this; }; return x; } ->nyikae : Symbol(nyikae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 955, 175)) +>nyikae : Symbol(netscheri.nyikae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 955, 175)) >trivirgatus : Symbol(trivirgatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 186, 1)) >tumidifrons : Symbol(trivirgatus.tumidifrons, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 187, 20)) >howi : Symbol(howi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 466, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 681, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 886, 1)) @@ -12105,7 +12105,7 @@ module argurus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 956, 167)) ruemmleri(): panglima.amphibius, gabriellae.echinatus>, dogramacii.aurata>, imperfecta.ciliolabrum> { var x: panglima.amphibius, gabriellae.echinatus>, dogramacii.aurata>, imperfecta.ciliolabrum>; () => { var y = this; }; return x; } ->ruemmleri : Symbol(ruemmleri, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 956, 352)) +>ruemmleri : Symbol(netscheri.ruemmleri, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 956, 352)) >panglima : Symbol(panglima, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 400, 1)) >amphibius : Symbol(panglima.amphibius, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 401, 17)) >minutus : Symbol(minutus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 433, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 492, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 848, 1)) @@ -12172,7 +12172,7 @@ module ruatanica { >amicus : Symbol(gabriellae.amicus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 769, 5)) clara(): panglima.amphibius, argurus.dauricus> { var x: panglima.amphibius, argurus.dauricus>; () => { var y = this; }; return x; } ->clara : Symbol(clara, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 961, 102)) +>clara : Symbol(Praseodymium.clara, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 961, 102)) >panglima : Symbol(panglima, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 400, 1)) >amphibius : Symbol(panglima.amphibius, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 401, 17)) >imperfecta : Symbol(imperfecta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 785, 1)) @@ -12207,7 +12207,7 @@ module ruatanica { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 962, 168)) spectabilis(): petrophilus.sodyi { var x: petrophilus.sodyi; () => { var y = this; }; return x; } ->spectabilis : Symbol(spectabilis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 962, 355)) +>spectabilis : Symbol(Praseodymium.spectabilis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 962, 355)) >petrophilus : Symbol(petrophilus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 715, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 823, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 998, 1)) >sodyi : Symbol(petrophilus.sodyi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 824, 20)) >rionegrensis : Symbol(rionegrensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 0, 0)) @@ -12226,7 +12226,7 @@ module ruatanica { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 963, 95)) kamensis(): trivirgatus.lotor, lavali.lepturus> { var x: trivirgatus.lotor, lavali.lepturus>; () => { var y = this; }; return x; } ->kamensis : Symbol(kamensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 963, 203)) +>kamensis : Symbol(Praseodymium.kamensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 963, 203)) >trivirgatus : Symbol(trivirgatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 186, 1)) >lotor : Symbol(trivirgatus.lotor, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 206, 3)) >panamensis : Symbol(panamensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 501, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 986, 1)) @@ -12253,7 +12253,7 @@ module ruatanica { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 964, 123)) ruddi(): lutreolus.foina { var x: lutreolus.foina; () => { var y = this; }; return x; } ->ruddi : Symbol(ruddi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 964, 262)) +>ruddi : Symbol(Praseodymium.ruddi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 964, 262)) >lutreolus : Symbol(lutreolus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 355, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 719, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 855, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 872, 1)) >foina : Symbol(lutreolus.foina, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 856, 18)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 965, 38)) @@ -12264,7 +12264,7 @@ module ruatanica { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 965, 38)) bartelsii(): julianae.sumatrana { var x: julianae.sumatrana; () => { var y = this; }; return x; } ->bartelsii : Symbol(bartelsii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 965, 95)) +>bartelsii : Symbol(Praseodymium.bartelsii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 965, 95)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) >sumatrana : Symbol(julianae.sumatrana, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 58, 3)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 966, 45)) @@ -12275,7 +12275,7 @@ module ruatanica { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 966, 45)) yerbabuenae(): dammermani.siberu, imperfecta.ciliolabrum> { var x: dammermani.siberu, imperfecta.ciliolabrum>; () => { var y = this; }; return x; } ->yerbabuenae : Symbol(yerbabuenae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 966, 105)) +>yerbabuenae : Symbol(Praseodymium.yerbabuenae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 966, 105)) >dammermani : Symbol(dammermani, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 591, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 913, 1)) >siberu : Symbol(dammermani.siberu, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 592, 19)) >imperfecta : Symbol(imperfecta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 785, 1)) @@ -12310,7 +12310,7 @@ module ruatanica { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 967, 173)) davidi(): trivirgatus.mixtus { var x: trivirgatus.mixtus; () => { var y = this; }; return x; } ->davidi : Symbol(davidi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 967, 359)) +>davidi : Symbol(Praseodymium.davidi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 967, 359)) >trivirgatus : Symbol(trivirgatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 186, 1)) >mixtus : Symbol(trivirgatus.mixtus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 197, 3)) >provocax : Symbol(provocax, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 669, 1)) @@ -12329,7 +12329,7 @@ module ruatanica { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 968, 84)) pilirostris(): argurus.wetmorei>, sagitta.leptoceros>>, macrorhinos.konganensis> { var x: argurus.wetmorei>, sagitta.leptoceros>>, macrorhinos.konganensis>; () => { var y = this; }; return x; } ->pilirostris : Symbol(pilirostris, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 968, 186)) +>pilirostris : Symbol(Praseodymium.pilirostris, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 968, 186)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) >wetmorei : Symbol(argurus.wetmorei, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 614, 16)) >imperfecta : Symbol(imperfecta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 785, 1)) @@ -12388,7 +12388,7 @@ module ruatanica { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 969, 298)) catherinae(): imperfecta.lasiurus, petrophilus.sodyi> { var x: imperfecta.lasiurus, petrophilus.sodyi>; () => { var y = this; }; return x; } ->catherinae : Symbol(catherinae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 969, 609)) +>catherinae : Symbol(Praseodymium.catherinae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 969, 609)) >imperfecta : Symbol(imperfecta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 785, 1)) >lasiurus : Symbol(imperfecta.lasiurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 786, 19)) >Lanthanum : Symbol(Lanthanum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 106, 1)) @@ -12423,7 +12423,7 @@ module ruatanica { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 970, 169)) frontata(): argurus.oreas { var x: argurus.oreas; () => { var y = this; }; return x; } ->frontata : Symbol(frontata, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 970, 352)) +>frontata : Symbol(Praseodymium.frontata, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 970, 352)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) >oreas : Symbol(argurus.oreas, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 625, 16)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 971, 39)) @@ -12434,7 +12434,7 @@ module ruatanica { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 971, 39)) Terbium(): caurinus.mahaganus { var x: caurinus.mahaganus; () => { var y = this; }; return x; } ->Terbium : Symbol(Terbium, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 971, 94)) +>Terbium : Symbol(Praseodymium.Terbium, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 971, 94)) >caurinus : Symbol(caurinus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 449, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 836, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 976, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1007, 1)) >mahaganus : Symbol(caurinus.mahaganus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 450, 17)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) @@ -12453,7 +12453,7 @@ module ruatanica { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 972, 85)) thomensis(): minutus.inez> { var x: minutus.inez>; () => { var y = this; }; return x; } ->thomensis : Symbol(thomensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 972, 187)) +>thomensis : Symbol(Praseodymium.thomensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 972, 187)) >minutus : Symbol(minutus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 433, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 492, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 848, 1)) >inez : Symbol(minutus.inez, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 493, 16)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) @@ -12480,7 +12480,7 @@ module ruatanica { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 973, 113)) soricinus(): quasiater.carolinensis { var x: quasiater.carolinensis; () => { var y = this; }; return x; } ->soricinus : Symbol(soricinus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 973, 241)) +>soricinus : Symbol(Praseodymium.soricinus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 973, 241)) >quasiater : Symbol(quasiater, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 236, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 422, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 813, 1)) >carolinensis : Symbol(quasiater.carolinensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 423, 18)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 974, 49)) @@ -12503,7 +12503,7 @@ module caurinus { >punicus : Symbol(lutreolus.punicus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 720, 18)) maini(): ruatanica.Praseodymium { var x: ruatanica.Praseodymium; () => { var y = this; }; return x; } ->maini : Symbol(maini, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 978, 63)) +>maini : Symbol(johorensis.maini, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 978, 63)) >ruatanica : Symbol(ruatanica, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 100, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 244, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 959, 1)) >Praseodymium : Symbol(ruatanica.Praseodymium, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 960, 18)) >lavali : Symbol(lavali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 252, 1)) @@ -12529,7 +12529,7 @@ module argurus { >luctuosa : Symbol(luctuosa, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 982, 16)) loriae(): rendalli.moojeni, gabriellae.echinatus>, sagitta.stolzmanni>, lutreolus.punicus> { var x: rendalli.moojeni, gabriellae.echinatus>, sagitta.stolzmanni>, lutreolus.punicus>; () => { var y = this; }; return x; } ->loriae : Symbol(loriae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 983, 27)) +>loriae : Symbol(luctuosa.loriae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 983, 27)) >rendalli : Symbol(rendalli, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 151, 1)) >moojeni : Symbol(rendalli.moojeni, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 168, 3)) >macrorhinos : Symbol(macrorhinos, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 461, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 497, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 736, 1)) @@ -12581,7 +12581,7 @@ module panamensis { >T1 : Symbol(T1, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 988, 30)) duthieae(): caurinus.mahaganus, dogramacii.aurata> { var x: caurinus.mahaganus, dogramacii.aurata>; () => { var y = this; }; return x; } ->duthieae : Symbol(duthieae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 988, 36)) +>duthieae : Symbol(setulosus.duthieae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 988, 36)) >caurinus : Symbol(caurinus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 449, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 836, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 976, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1007, 1)) >mahaganus : Symbol(caurinus.mahaganus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 450, 17)) >howi : Symbol(howi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 466, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 681, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 886, 1)) @@ -12608,7 +12608,7 @@ module panamensis { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 989, 106)) guereza(): howi.coludo { var x: howi.coludo; () => { var y = this; }; return x; } ->guereza : Symbol(guereza, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 989, 228)) +>guereza : Symbol(setulosus.guereza, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 989, 228)) >howi : Symbol(howi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 466, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 681, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 886, 1)) >coludo : Symbol(howi.coludo, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 887, 13)) >sagitta : Symbol(sagitta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 487, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 577, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 675, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 746, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 898, 1)) @@ -12627,7 +12627,7 @@ module panamensis { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 990, 80)) buselaphus(): daubentonii.nesiotes, dogramacii.koepckeae>, trivirgatus.mixtus> { var x: daubentonii.nesiotes, dogramacii.koepckeae>, trivirgatus.mixtus>; () => { var y = this; }; return x; } ->buselaphus : Symbol(buselaphus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 990, 177)) +>buselaphus : Symbol(setulosus.buselaphus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 990, 177)) >daubentonii : Symbol(daubentonii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 471, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 586, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 636, 1)) >nesiotes : Symbol(daubentonii.nesiotes, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 472, 20)) >trivirgatus : Symbol(trivirgatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 186, 1)) @@ -12670,7 +12670,7 @@ module panamensis { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 991, 199)) nuttalli(): sagitta.cinereus, chrysaeolus.sarasinorum> { var x: sagitta.cinereus, chrysaeolus.sarasinorum>; () => { var y = this; }; return x; } ->nuttalli : Symbol(nuttalli, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 991, 412)) +>nuttalli : Symbol(setulosus.nuttalli, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 991, 412)) >sagitta : Symbol(sagitta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 487, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 577, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 675, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 746, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 898, 1)) >cinereus : Symbol(sagitta.cinereus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 747, 16)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) @@ -12705,7 +12705,7 @@ module panamensis { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 992, 169)) pelii(): rendalli.crenulata, julianae.steerii> { var x: rendalli.crenulata, julianae.steerii>; () => { var y = this; }; return x; } ->pelii : Symbol(pelii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 992, 354)) +>pelii : Symbol(setulosus.pelii, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 992, 354)) >rendalli : Symbol(rendalli, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 151, 1)) >crenulata : Symbol(rendalli.crenulata, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 180, 3)) >Lanthanum : Symbol(Lanthanum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 106, 1)) @@ -12732,7 +12732,7 @@ module panamensis { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 993, 124)) tunneyi(): sagitta.stolzmanni { var x: sagitta.stolzmanni; () => { var y = this; }; return x; } ->tunneyi : Symbol(tunneyi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 993, 267)) +>tunneyi : Symbol(setulosus.tunneyi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 993, 267)) >sagitta : Symbol(sagitta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 487, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 577, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 675, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 746, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 898, 1)) >stolzmanni : Symbol(sagitta.stolzmanni, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 899, 16)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 994, 43)) @@ -12743,7 +12743,7 @@ module panamensis { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 994, 43)) lamula(): patas.uralensis { var x: patas.uralensis; () => { var y = this; }; return x; } ->lamula : Symbol(lamula, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 994, 103)) +>lamula : Symbol(setulosus.lamula, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 994, 103)) >patas : Symbol(patas, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 652, 1)) >uralensis : Symbol(patas.uralensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 653, 14)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 995, 39)) @@ -12754,7 +12754,7 @@ module panamensis { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 995, 39)) vampyrus(): julianae.oralis { var x: julianae.oralis; () => { var y = this; }; return x; } ->vampyrus : Symbol(vampyrus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 995, 96)) +>vampyrus : Symbol(setulosus.vampyrus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 995, 96)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) >oralis : Symbol(julianae.oralis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 43, 3)) >lutreolus : Symbol(lutreolus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 355, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 719, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 855, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 872, 1)) @@ -12782,7 +12782,7 @@ module petrophilus { >T1 : Symbol(T1, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1000, 28)) palmeri(): panglima.amphibius>, trivirgatus.mixtus, panglima.amphibius>> { var x: panglima.amphibius>, trivirgatus.mixtus, panglima.amphibius>>; () => { var y = this; }; return x; } ->palmeri : Symbol(palmeri, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1000, 34)) +>palmeri : Symbol(rosalia.palmeri, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1000, 34)) >panglima : Symbol(panglima, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 400, 1)) >amphibius : Symbol(panglima.amphibius, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 401, 17)) >howi : Symbol(howi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 466, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 681, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 886, 1)) @@ -12841,7 +12841,7 @@ module petrophilus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1001, 282)) baeops(): Lanthanum.nitidus { var x: Lanthanum.nitidus; () => { var y = this; }; return x; } ->baeops : Symbol(baeops, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1001, 581)) +>baeops : Symbol(rosalia.baeops, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1001, 581)) >Lanthanum : Symbol(Lanthanum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 106, 1)) >nitidus : Symbol(Lanthanum.nitidus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 112, 3)) >lavali : Symbol(lavali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 252, 1)) @@ -12860,7 +12860,7 @@ module petrophilus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1002, 75)) ozensis(): imperfecta.lasiurus, lutreolus.foina> { var x: imperfecta.lasiurus, lutreolus.foina>; () => { var y = this; }; return x; } ->ozensis : Symbol(ozensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1002, 168)) +>ozensis : Symbol(rosalia.ozensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1002, 168)) >imperfecta : Symbol(imperfecta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 785, 1)) >lasiurus : Symbol(imperfecta.lasiurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 786, 19)) >panglima : Symbol(panglima, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 400, 1)) @@ -12887,7 +12887,7 @@ module petrophilus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1003, 116)) creaghi(): argurus.luctuosa { var x: argurus.luctuosa; () => { var y = this; }; return x; } ->creaghi : Symbol(creaghi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1003, 249)) +>creaghi : Symbol(rosalia.creaghi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1003, 249)) >argurus : Symbol(argurus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 373, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 595, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 613, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 624, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 699, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 892, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 930, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 942, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 981, 1)) >luctuosa : Symbol(argurus.luctuosa, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 982, 16)) >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1004, 41)) @@ -12898,7 +12898,7 @@ module petrophilus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1004, 41)) montivaga(): panamensis.setulosus> { var x: panamensis.setulosus>; () => { var y = this; }; return x; } ->montivaga : Symbol(montivaga, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1004, 99)) +>montivaga : Symbol(rosalia.montivaga, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1004, 99)) >panamensis : Symbol(panamensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 501, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 986, 1)) >setulosus : Symbol(panamensis.setulosus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 987, 19)) >lavali : Symbol(lavali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 252, 1)) @@ -12935,7 +12935,7 @@ module caurinus { >punicus : Symbol(lutreolus.punicus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 720, 18)) socialis(): panglima.amphibius { var x: panglima.amphibius; () => { var y = this; }; return x; } ->socialis : Symbol(socialis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1009, 53)) +>socialis : Symbol(psilurus.socialis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1009, 53)) >panglima : Symbol(panglima, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 400, 1)) >amphibius : Symbol(panglima.amphibius, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 401, 17)) >trivirgatus : Symbol(trivirgatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 186, 1)) @@ -12954,7 +12954,7 @@ module caurinus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1010, 86)) lundi(): petrophilus.sodyi { var x: petrophilus.sodyi; () => { var y = this; }; return x; } ->lundi : Symbol(lundi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1010, 188)) +>lundi : Symbol(psilurus.lundi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1010, 188)) >petrophilus : Symbol(petrophilus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 715, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 823, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 998, 1)) >sodyi : Symbol(petrophilus.sodyi, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 824, 20)) >trivirgatus : Symbol(trivirgatus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 186, 1)) @@ -12973,7 +12973,7 @@ module caurinus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1011, 85)) araeum(): imperfecta.ciliolabrum { var x: imperfecta.ciliolabrum; () => { var y = this; }; return x; } ->araeum : Symbol(araeum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1011, 189)) +>araeum : Symbol(psilurus.araeum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1011, 189)) >imperfecta : Symbol(imperfecta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 785, 1)) >ciliolabrum : Symbol(imperfecta.ciliolabrum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 807, 5)) >quasiater : Symbol(quasiater, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 236, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 422, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 813, 1)) @@ -12992,7 +12992,7 @@ module caurinus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1012, 84)) calamianensis(): julianae.gerbillus { var x: julianae.gerbillus; () => { var y = this; }; return x; } ->calamianensis : Symbol(calamianensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1012, 186)) +>calamianensis : Symbol(psilurus.calamianensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1012, 186)) >julianae : Symbol(julianae, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 15, 1)) >gerbillus : Symbol(julianae.gerbillus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 67, 3)) >lavali : Symbol(lavali, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 252, 1)) @@ -13011,7 +13011,7 @@ module caurinus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1013, 90)) petersoni(): panamensis.setulosus { var x: panamensis.setulosus; () => { var y = this; }; return x; } ->petersoni : Symbol(petersoni, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1013, 191)) +>petersoni : Symbol(psilurus.petersoni, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1013, 191)) >panamensis : Symbol(panamensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 501, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 986, 1)) >setulosus : Symbol(panamensis.setulosus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 987, 19)) >sagitta : Symbol(sagitta, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 487, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 577, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 675, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 746, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 898, 1)) @@ -13030,7 +13030,7 @@ module caurinus { >x : Symbol(x, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1014, 87)) nitela(): panamensis.linulus { var x: panamensis.linulus; () => { var y = this; }; return x; } ->nitela : Symbol(nitela, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1014, 189)) +>nitela : Symbol(psilurus.nitela, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 1014, 189)) >panamensis : Symbol(panamensis, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 501, 1), Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 986, 1)) >linulus : Symbol(panamensis.linulus, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 502, 19)) >Lanthanum : Symbol(Lanthanum, Decl(resolvingClassDeclarationWhenInBaseTypeResolution.ts, 106, 1)) diff --git a/tests/baselines/reference/restArgAssignmentCompat.errors.txt b/tests/baselines/reference/restArgAssignmentCompat.errors.txt index 2ea07395099..5be7e3f8d67 100644 --- a/tests/baselines/reference/restArgAssignmentCompat.errors.txt +++ b/tests/baselines/reference/restArgAssignmentCompat.errors.txt @@ -1,7 +1,6 @@ tests/cases/compiler/restArgAssignmentCompat.ts(7,1): error TS2322: Type '(...x: number[]) => void' is not assignable to type '(x: number[], y: string) => void'. Types of parameters 'x' and 'x' are incompatible. - Type 'number' is not assignable to type 'number[]'. - Property 'length' is missing in type 'Number'. + Type 'number[]' is not assignable to type 'number'. ==== tests/cases/compiler/restArgAssignmentCompat.ts (1 errors) ==== @@ -15,7 +14,6 @@ tests/cases/compiler/restArgAssignmentCompat.ts(7,1): error TS2322: Type '(...x: ~ !!! error TS2322: Type '(...x: number[]) => void' is not assignable to type '(x: number[], y: string) => void'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2322: Type 'number' is not assignable to type 'number[]'. -!!! error TS2322: Property 'length' is missing in type 'Number'. +!!! error TS2322: Type 'number[]' is not assignable to type 'number'. n([4], 'foo'); \ No newline at end of file diff --git a/tests/baselines/reference/restElementWithAssignmentPattern5.types b/tests/baselines/reference/restElementWithAssignmentPattern5.types index e3934c31197..c5cbc9ad206 100644 --- a/tests/baselines/reference/restElementWithAssignmentPattern5.types +++ b/tests/baselines/reference/restElementWithAssignmentPattern5.types @@ -7,7 +7,7 @@ var s: string, s2: string; >[...[s, s2]] = ["", ""] : string[] >[...[s, s2]] : string[] >...[s, s2] : string ->[s, s2] : string[] +>[s, s2] : [string, string] >s : string >s2 : string >["", ""] : string[] diff --git a/tests/baselines/reference/restElementWithNullInitializer.errors.txt b/tests/baselines/reference/restElementWithNullInitializer.errors.txt index 7beb7b9a642..4658acc5ff4 100644 --- a/tests/baselines/reference/restElementWithNullInitializer.errors.txt +++ b/tests/baselines/reference/restElementWithNullInitializer.errors.txt @@ -1,6 +1,6 @@ tests/cases/conformance/es6/destructuring/restElementWithNullInitializer.ts(1,15): error TS2461: Type 'null' is not an array type. tests/cases/conformance/es6/destructuring/restElementWithNullInitializer.ts(4,15): error TS2461: Type 'undefined' is not an array type. -tests/cases/conformance/es6/destructuring/restElementWithNullInitializer.ts(7,15): error TS2461: Type '{ [x: number]: undefined; }' is not an array type. +tests/cases/conformance/es6/destructuring/restElementWithNullInitializer.ts(7,15): error TS2461: Type '{}' is not an array type. ==== tests/cases/conformance/es6/destructuring/restElementWithNullInitializer.ts (3 errors) ==== @@ -16,7 +16,7 @@ tests/cases/conformance/es6/destructuring/restElementWithNullInitializer.ts(7,15 function foo3([...r] = {}) { ~~~~~~ -!!! error TS2461: Type '{ [x: number]: undefined; }' is not an array type. +!!! error TS2461: Type '{}' is not an array type. } function foo4([...r] = []) { diff --git a/tests/baselines/reference/restParameterAssignmentCompatibility.symbols b/tests/baselines/reference/restParameterAssignmentCompatibility.symbols index dd5e7a8fa81..03209d8b1a4 100644 --- a/tests/baselines/reference/restParameterAssignmentCompatibility.symbols +++ b/tests/baselines/reference/restParameterAssignmentCompatibility.symbols @@ -3,7 +3,7 @@ class T { >T : Symbol(T, Decl(restParameterAssignmentCompatibility.ts, 0, 0)) m(...p3) { ->m : Symbol(m, Decl(restParameterAssignmentCompatibility.ts, 0, 9)) +>m : Symbol(T.m, Decl(restParameterAssignmentCompatibility.ts, 0, 9)) >p3 : Symbol(p3, Decl(restParameterAssignmentCompatibility.ts, 1, 6)) } @@ -13,7 +13,7 @@ class S { >S : Symbol(S, Decl(restParameterAssignmentCompatibility.ts, 4, 1)) m(p1, p2) { ->m : Symbol(m, Decl(restParameterAssignmentCompatibility.ts, 6, 9)) +>m : Symbol(S.m, Decl(restParameterAssignmentCompatibility.ts, 6, 9)) >p1 : Symbol(p1, Decl(restParameterAssignmentCompatibility.ts, 7, 6)) >p2 : Symbol(p2, Decl(restParameterAssignmentCompatibility.ts, 7, 9)) @@ -38,7 +38,7 @@ class T1 { >T1 : Symbol(T1, Decl(restParameterAssignmentCompatibility.ts, 16, 6)) m(p1?, p2?) { ->m : Symbol(m, Decl(restParameterAssignmentCompatibility.ts, 18, 10)) +>m : Symbol(T1.m, Decl(restParameterAssignmentCompatibility.ts, 18, 10)) >p1 : Symbol(p1, Decl(restParameterAssignmentCompatibility.ts, 19, 6)) >p2 : Symbol(p2, Decl(restParameterAssignmentCompatibility.ts, 19, 10)) diff --git a/tests/baselines/reference/returnInConstructor1.errors.txt b/tests/baselines/reference/returnInConstructor1.errors.txt index dbe3b9e5ee8..30f629f9f8a 100644 --- a/tests/baselines/reference/returnInConstructor1.errors.txt +++ b/tests/baselines/reference/returnInConstructor1.errors.txt @@ -1,8 +1,6 @@ tests/cases/compiler/returnInConstructor1.ts(11,16): error TS2322: Type 'number' is not assignable to type 'B'. - Property 'foo' is missing in type 'Number'. tests/cases/compiler/returnInConstructor1.ts(11,16): error TS2409: Return type of constructor signature must be assignable to the instance type of the class tests/cases/compiler/returnInConstructor1.ts(25,16): error TS2322: Type 'string' is not assignable to type 'D'. - Property 'foo' is missing in type 'String'. tests/cases/compiler/returnInConstructor1.ts(25,16): error TS2409: Return type of constructor signature must be assignable to the instance type of the class tests/cases/compiler/returnInConstructor1.ts(39,16): error TS2322: Type '{ foo: number; }' is not assignable to type 'F'. Types of property 'foo' are incompatible. @@ -28,7 +26,6 @@ tests/cases/compiler/returnInConstructor1.ts(55,16): error TS2409: Return type o return 1; // error ~ !!! error TS2322: Type 'number' is not assignable to type 'B'. -!!! error TS2322: Property 'foo' is missing in type 'Number'. ~ !!! error TS2409: Return type of constructor signature must be assignable to the instance type of the class } @@ -47,7 +44,6 @@ tests/cases/compiler/returnInConstructor1.ts(55,16): error TS2409: Return type o return "test"; // error ~~~~~~ !!! error TS2322: Type 'string' is not assignable to type 'D'. -!!! error TS2322: Property 'foo' is missing in type 'String'. ~~~~~~ !!! error TS2409: Return type of constructor signature must be assignable to the instance type of the class } diff --git a/tests/baselines/reference/returnStatements.symbols b/tests/baselines/reference/returnStatements.symbols index 7d8b6d69d82..af8aa2af7df 100644 --- a/tests/baselines/reference/returnStatements.symbols +++ b/tests/baselines/reference/returnStatements.symbols @@ -18,8 +18,8 @@ function fn5(): boolean { return true; } function fn6(): Date { return new Date(12); } >fn6 : Symbol(fn6, Decl(returnStatements.ts, 5, 40)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function fn7(): any { return null; } >fn7 : Symbol(fn7, Decl(returnStatements.ts, 6, 45)) @@ -29,24 +29,24 @@ function fn8(): any { return; } // OK, eq. to 'return undefined' interface I { id: number } >I : Symbol(I, Decl(returnStatements.ts, 8, 31)) ->id : Symbol(id, Decl(returnStatements.ts, 10, 13)) +>id : Symbol(I.id, Decl(returnStatements.ts, 10, 13)) class C implements I { >C : Symbol(C, Decl(returnStatements.ts, 10, 26)) >I : Symbol(I, Decl(returnStatements.ts, 8, 31)) id: number; ->id : Symbol(id, Decl(returnStatements.ts, 11, 22)) +>id : Symbol(C.id, Decl(returnStatements.ts, 11, 22)) dispose() {} ->dispose : Symbol(dispose, Decl(returnStatements.ts, 12, 15)) +>dispose : Symbol(C.dispose, Decl(returnStatements.ts, 12, 15)) } class D extends C { >D : Symbol(D, Decl(returnStatements.ts, 14, 1)) >C : Symbol(C, Decl(returnStatements.ts, 10, 26)) name: string; ->name : Symbol(name, Decl(returnStatements.ts, 15, 19)) +>name : Symbol(D.name, Decl(returnStatements.ts, 15, 19)) } function fn10(): I { return { id: 12 }; } >fn10 : Symbol(fn10, Decl(returnStatements.ts, 17, 1)) diff --git a/tests/baselines/reference/returnTypeParameterWithModules.types b/tests/baselines/reference/returnTypeParameterWithModules.types index be09b8f46b0..584c962a170 100644 --- a/tests/baselines/reference/returnTypeParameterWithModules.types +++ b/tests/baselines/reference/returnTypeParameterWithModules.types @@ -13,13 +13,13 @@ module M1 { return Array.prototype.reduce.apply(ar, e ? [f, e] : [f]); >Array.prototype.reduce.apply(ar, e ? [f, e] : [f]) : any ->Array.prototype.reduce.apply : (thisArg: any, argArray?: any) => any +>Array.prototype.reduce.apply : (this: Function, thisArg: any, argArray?: any) => any >Array.prototype.reduce : { (callbackfn: (previousValue: any, currentValue: any, currentIndex: number, array: any[]) => any, initialValue?: any): any; (callbackfn: (previousValue: U, currentValue: any, currentIndex: number, array: any[]) => U, initialValue: U): U; } >Array.prototype : any[] >Array : ArrayConstructor >prototype : any[] >reduce : { (callbackfn: (previousValue: any, currentValue: any, currentIndex: number, array: any[]) => any, initialValue?: any): any; (callbackfn: (previousValue: U, currentValue: any, currentIndex: number, array: any[]) => U, initialValue: U): U; } ->apply : (thisArg: any, argArray?: any) => any +>apply : (this: Function, thisArg: any, argArray?: any) => any >ar : any >e ? [f, e] : [f] : any[] >e : any diff --git a/tests/baselines/reference/reversedRecusiveTypeInstantiation.symbols b/tests/baselines/reference/reversedRecusiveTypeInstantiation.symbols index ccb8b01ee78..2078d6c963d 100644 --- a/tests/baselines/reference/reversedRecusiveTypeInstantiation.symbols +++ b/tests/baselines/reference/reversedRecusiveTypeInstantiation.symbols @@ -5,15 +5,15 @@ interface A { >NumberArgPos2 : Symbol(NumberArgPos2, Decl(reversedRecusiveTypeInstantiation.ts, 0, 26)) xPos1 : StringArgPos1 ->xPos1 : Symbol(xPos1, Decl(reversedRecusiveTypeInstantiation.ts, 0, 43)) +>xPos1 : Symbol(A.xPos1, Decl(reversedRecusiveTypeInstantiation.ts, 0, 43)) >StringArgPos1 : Symbol(StringArgPos1, Decl(reversedRecusiveTypeInstantiation.ts, 0, 12)) yPos2 : NumberArgPos2 ->yPos2 : Symbol(yPos2, Decl(reversedRecusiveTypeInstantiation.ts, 1, 24)) +>yPos2 : Symbol(A.yPos2, Decl(reversedRecusiveTypeInstantiation.ts, 1, 24)) >NumberArgPos2 : Symbol(NumberArgPos2, Decl(reversedRecusiveTypeInstantiation.ts, 0, 26)) zPos2Pos1 : A ->zPos2Pos1 : Symbol(zPos2Pos1, Decl(reversedRecusiveTypeInstantiation.ts, 2, 24)) +>zPos2Pos1 : Symbol(A.zPos2Pos1, Decl(reversedRecusiveTypeInstantiation.ts, 2, 24)) >A : Symbol(A, Decl(reversedRecusiveTypeInstantiation.ts, 0, 0)) >NumberArgPos2 : Symbol(NumberArgPos2, Decl(reversedRecusiveTypeInstantiation.ts, 0, 26)) >StringArgPos1 : Symbol(StringArgPos1, Decl(reversedRecusiveTypeInstantiation.ts, 0, 12)) diff --git a/tests/baselines/reference/scannerClass2.errors.txt b/tests/baselines/reference/scannerClass2.errors.txt index d808f6fdd59..e7a1765a766 100644 --- a/tests/baselines/reference/scannerClass2.errors.txt +++ b/tests/baselines/reference/scannerClass2.errors.txt @@ -1,15 +1,12 @@ -tests/cases/conformance/scanner/ecmascript5/scannerClass2.ts(3,18): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/conformance/scanner/ecmascript5/scannerClass2.ts(3,43): error TS2304: Cannot find name 'ILogger'. tests/cases/conformance/scanner/ecmascript5/scannerClass2.ts(4,37): error TS2304: Cannot find name 'ILogger'. tests/cases/conformance/scanner/ecmascript5/scannerClass2.ts(5,18): error TS2339: Property '_information' does not exist on type 'LoggerAdapter'. -==== tests/cases/conformance/scanner/ecmascript5/scannerClass2.ts (4 errors) ==== +==== tests/cases/conformance/scanner/ecmascript5/scannerClass2.ts (3 errors) ==== export class LoggerAdapter implements ILogger { - ~~~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ~~~~~~~ !!! error TS2304: Cannot find name 'ILogger'. constructor (public logger: ILogger) { diff --git a/tests/baselines/reference/scannerEnum1.errors.txt b/tests/baselines/reference/scannerEnum1.errors.txt deleted file mode 100644 index d0bbf16743c..00000000000 --- a/tests/baselines/reference/scannerEnum1.errors.txt +++ /dev/null @@ -1,10 +0,0 @@ -tests/cases/conformance/scanner/ecmascript5/scannerEnum1.ts(1,17): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. - - -==== tests/cases/conformance/scanner/ecmascript5/scannerEnum1.ts (1 errors) ==== - export enum CodeGenTarget { - ~~~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. - ES3 = 0, - ES5 = 1, - } \ No newline at end of file diff --git a/tests/baselines/reference/scannerEnum1.symbols b/tests/baselines/reference/scannerEnum1.symbols new file mode 100644 index 00000000000..cd40e63770f --- /dev/null +++ b/tests/baselines/reference/scannerEnum1.symbols @@ -0,0 +1,10 @@ +=== tests/cases/conformance/scanner/ecmascript5/scannerEnum1.ts === + export enum CodeGenTarget { +>CodeGenTarget : Symbol(CodeGenTarget, Decl(scannerEnum1.ts, 0, 0)) + + ES3 = 0, +>ES3 : Symbol(CodeGenTarget.ES3, Decl(scannerEnum1.ts, 0, 31)) + + ES5 = 1, +>ES5 : Symbol(CodeGenTarget.ES5, Decl(scannerEnum1.ts, 1, 16)) + } diff --git a/tests/baselines/reference/scannerEnum1.types b/tests/baselines/reference/scannerEnum1.types new file mode 100644 index 00000000000..d75899a75f1 --- /dev/null +++ b/tests/baselines/reference/scannerEnum1.types @@ -0,0 +1,12 @@ +=== tests/cases/conformance/scanner/ecmascript5/scannerEnum1.ts === + export enum CodeGenTarget { +>CodeGenTarget : CodeGenTarget + + ES3 = 0, +>ES3 : CodeGenTarget +>0 : number + + ES5 = 1, +>ES5 : CodeGenTarget +>1 : number + } diff --git a/tests/baselines/reference/scannerImportDeclaration1.js b/tests/baselines/reference/scannerImportDeclaration1.js index 87f33f9d2c6..d3a7a86f6a4 100644 --- a/tests/baselines/reference/scannerImportDeclaration1.js +++ b/tests/baselines/reference/scannerImportDeclaration1.js @@ -2,3 +2,4 @@ import TypeScript = TypeScriptServices.TypeScript; //// [scannerImportDeclaration1.js] +var TypeScript = TypeScriptServices.TypeScript; diff --git a/tests/baselines/reference/scannertest1.errors.txt b/tests/baselines/reference/scannertest1.errors.txt index 14a19b28851..3831dbe398e 100644 --- a/tests/baselines/reference/scannertest1.errors.txt +++ b/tests/baselines/reference/scannertest1.errors.txt @@ -1,14 +1,14 @@ tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(1,1): error TS6053: File 'tests/cases/conformance/scanner/ecmascript5/References.ts' not found. tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(5,21): error TS2304: Cannot find name 'CharacterCodes'. tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(5,47): error TS2304: Cannot find name 'CharacterCodes'. -tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(9,16): error TS2304: Cannot find name 'isDecimalDigit'. +tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(9,16): error TS2662: Cannot find name 'isDecimalDigit'. Did you mean the static member 'CharacterInfo.isDecimalDigit'? tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(10,22): error TS2304: Cannot find name 'CharacterCodes'. tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(10,47): error TS2304: Cannot find name 'CharacterCodes'. tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(11,22): error TS2304: Cannot find name 'CharacterCodes'. tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(11,47): error TS2304: Cannot find name 'CharacterCodes'. tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(15,9): error TS2304: Cannot find name 'Debug'. -tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(15,22): error TS2304: Cannot find name 'isHexDigit'. -tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(16,16): error TS2304: Cannot find name 'isDecimalDigit'. +tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(15,22): error TS2662: Cannot find name 'isHexDigit'. Did you mean the static member 'CharacterInfo.isHexDigit'? +tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(16,16): error TS2662: Cannot find name 'isDecimalDigit'. Did you mean the static member 'CharacterInfo.isDecimalDigit'? tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(17,20): error TS2304: Cannot find name 'CharacterCodes'. tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(18,21): error TS2304: Cannot find name 'CharacterCodes'. tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(18,46): error TS2304: Cannot find name 'CharacterCodes'. @@ -33,7 +33,7 @@ tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(20,23): error TS2304 public static isHexDigit(c: number): boolean { return isDecimalDigit(c) || ~~~~~~~~~~~~~~ -!!! error TS2304: Cannot find name 'isDecimalDigit'. +!!! error TS2662: Cannot find name 'isDecimalDigit'. Did you mean the static member 'CharacterInfo.isDecimalDigit'? (c >= CharacterCodes.A && c <= CharacterCodes.F) || ~~~~~~~~~~~~~~ !!! error TS2304: Cannot find name 'CharacterCodes'. @@ -51,10 +51,10 @@ tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(20,23): error TS2304 ~~~~~ !!! error TS2304: Cannot find name 'Debug'. ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'isHexDigit'. +!!! error TS2662: Cannot find name 'isHexDigit'. Did you mean the static member 'CharacterInfo.isHexDigit'? return isDecimalDigit(c) ~~~~~~~~~~~~~~ -!!! error TS2304: Cannot find name 'isDecimalDigit'. +!!! error TS2662: Cannot find name 'isDecimalDigit'. Did you mean the static member 'CharacterInfo.isDecimalDigit'? ? (c - CharacterCodes._0) ~~~~~~~~~~~~~~ !!! error TS2304: Cannot find name 'CharacterCodes'. diff --git a/tests/baselines/reference/scopeCheckExtendedClassInsidePublicMethod2.errors.txt b/tests/baselines/reference/scopeCheckExtendedClassInsidePublicMethod2.errors.txt index c59171bdf0e..378e20f19b8 100644 --- a/tests/baselines/reference/scopeCheckExtendedClassInsidePublicMethod2.errors.txt +++ b/tests/baselines/reference/scopeCheckExtendedClassInsidePublicMethod2.errors.txt @@ -1,5 +1,5 @@ -tests/cases/compiler/scopeCheckExtendedClassInsidePublicMethod2.ts(4,7): error TS2304: Cannot find name 'v'. -tests/cases/compiler/scopeCheckExtendedClassInsidePublicMethod2.ts(6,7): error TS2304: Cannot find name 's'. +tests/cases/compiler/scopeCheckExtendedClassInsidePublicMethod2.ts(4,7): error TS2663: Cannot find name 'v'. Did you mean the instance member 'this.v'? +tests/cases/compiler/scopeCheckExtendedClassInsidePublicMethod2.ts(6,7): error TS2662: Cannot find name 's'. Did you mean the static member 'D.s'? ==== tests/cases/compiler/scopeCheckExtendedClassInsidePublicMethod2.ts (2 errors) ==== @@ -8,10 +8,10 @@ tests/cases/compiler/scopeCheckExtendedClassInsidePublicMethod2.ts(6,7): error T public c() { v = 1; ~ -!!! error TS2304: Cannot find name 'v'. +!!! error TS2663: Cannot find name 'v'. Did you mean the instance member 'this.v'? this.p = 1; s = 1; ~ -!!! error TS2304: Cannot find name 's'. +!!! error TS2662: Cannot find name 's'. Did you mean the static member 'D.s'? } } \ No newline at end of file diff --git a/tests/baselines/reference/scopeCheckExtendedClassInsideStaticMethod1.errors.txt b/tests/baselines/reference/scopeCheckExtendedClassInsideStaticMethod1.errors.txt index a6ecd488278..dd3e5ef446b 100644 --- a/tests/baselines/reference/scopeCheckExtendedClassInsideStaticMethod1.errors.txt +++ b/tests/baselines/reference/scopeCheckExtendedClassInsideStaticMethod1.errors.txt @@ -1,6 +1,6 @@ tests/cases/compiler/scopeCheckExtendedClassInsideStaticMethod1.ts(4,7): error TS2304: Cannot find name 'v'. tests/cases/compiler/scopeCheckExtendedClassInsideStaticMethod1.ts(5,12): error TS2339: Property 'p' does not exist on type 'typeof D'. -tests/cases/compiler/scopeCheckExtendedClassInsideStaticMethod1.ts(6,7): error TS2304: Cannot find name 's'. +tests/cases/compiler/scopeCheckExtendedClassInsideStaticMethod1.ts(6,7): error TS2662: Cannot find name 's'. Did you mean the static member 'D.s'? ==== tests/cases/compiler/scopeCheckExtendedClassInsideStaticMethod1.ts (3 errors) ==== @@ -15,6 +15,6 @@ tests/cases/compiler/scopeCheckExtendedClassInsideStaticMethod1.ts(6,7): error T !!! error TS2339: Property 'p' does not exist on type 'typeof D'. s = 1; ~ -!!! error TS2304: Cannot find name 's'. +!!! error TS2662: Cannot find name 's'. Did you mean the static member 'D.s'? } } \ No newline at end of file diff --git a/tests/baselines/reference/scopeCheckInsidePublicMethod1.errors.txt b/tests/baselines/reference/scopeCheckInsidePublicMethod1.errors.txt index 5c9473a7875..ec93fea7369 100644 --- a/tests/baselines/reference/scopeCheckInsidePublicMethod1.errors.txt +++ b/tests/baselines/reference/scopeCheckInsidePublicMethod1.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/scopeCheckInsidePublicMethod1.ts(4,7): error TS2304: Cannot find name 's'. +tests/cases/compiler/scopeCheckInsidePublicMethod1.ts(4,7): error TS2662: Cannot find name 's'. Did you mean the static member 'C.s'? ==== tests/cases/compiler/scopeCheckInsidePublicMethod1.ts (1 errors) ==== @@ -7,6 +7,6 @@ tests/cases/compiler/scopeCheckInsidePublicMethod1.ts(4,7): error TS2304: Cannot public a() { s = 1; // ERR ~ -!!! error TS2304: Cannot find name 's'. +!!! error TS2662: Cannot find name 's'. Did you mean the static member 'C.s'? } } \ No newline at end of file diff --git a/tests/baselines/reference/scopeResolutionIdentifiers.symbols b/tests/baselines/reference/scopeResolutionIdentifiers.symbols index 3ba780b8290..ecabe30534e 100644 --- a/tests/baselines/reference/scopeResolutionIdentifiers.symbols +++ b/tests/baselines/reference/scopeResolutionIdentifiers.symbols @@ -50,27 +50,27 @@ class C { >C : Symbol(C, Decl(scopeResolutionIdentifiers.ts, 19, 1)) s: Date; ->s : Symbol(s, Decl(scopeResolutionIdentifiers.ts, 21, 9)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>s : Symbol(C.s, Decl(scopeResolutionIdentifiers.ts, 21, 9)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) n = this.s; ->n : Symbol(n, Decl(scopeResolutionIdentifiers.ts, 22, 12)) ->this.s : Symbol(s, Decl(scopeResolutionIdentifiers.ts, 21, 9)) +>n : Symbol(C.n, Decl(scopeResolutionIdentifiers.ts, 22, 12)) +>this.s : Symbol(C.s, Decl(scopeResolutionIdentifiers.ts, 21, 9)) >this : Symbol(C, Decl(scopeResolutionIdentifiers.ts, 19, 1)) ->s : Symbol(s, Decl(scopeResolutionIdentifiers.ts, 21, 9)) +>s : Symbol(C.s, Decl(scopeResolutionIdentifiers.ts, 21, 9)) x() { ->x : Symbol(x, Decl(scopeResolutionIdentifiers.ts, 23, 15)) +>x : Symbol(C.x, Decl(scopeResolutionIdentifiers.ts, 23, 15)) var p = this.n; >p : Symbol(p, Decl(scopeResolutionIdentifiers.ts, 25, 11), Decl(scopeResolutionIdentifiers.ts, 26, 11)) ->this.n : Symbol(n, Decl(scopeResolutionIdentifiers.ts, 22, 12)) +>this.n : Symbol(C.n, Decl(scopeResolutionIdentifiers.ts, 22, 12)) >this : Symbol(C, Decl(scopeResolutionIdentifiers.ts, 19, 1)) ->n : Symbol(n, Decl(scopeResolutionIdentifiers.ts, 22, 12)) +>n : Symbol(C.n, Decl(scopeResolutionIdentifiers.ts, 22, 12)) var p: Date; >p : Symbol(p, Decl(scopeResolutionIdentifiers.ts, 25, 11), Decl(scopeResolutionIdentifiers.ts, 26, 11)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) } } diff --git a/tests/baselines/reference/selfInCallback.symbols b/tests/baselines/reference/selfInCallback.symbols index 805b7714012..97aabd3165f 100644 --- a/tests/baselines/reference/selfInCallback.symbols +++ b/tests/baselines/reference/selfInCallback.symbols @@ -3,22 +3,22 @@ class C { >C : Symbol(C, Decl(selfInCallback.ts, 0, 0)) public p1 = 0; ->p1 : Symbol(p1, Decl(selfInCallback.ts, 0, 9)) +>p1 : Symbol(C.p1, Decl(selfInCallback.ts, 0, 9)) public callback(cb:()=>void) {cb();} ->callback : Symbol(callback, Decl(selfInCallback.ts, 1, 15)) +>callback : Symbol(C.callback, Decl(selfInCallback.ts, 1, 15)) >cb : Symbol(cb, Decl(selfInCallback.ts, 2, 17)) >cb : Symbol(cb, Decl(selfInCallback.ts, 2, 17)) public doit() { ->doit : Symbol(doit, Decl(selfInCallback.ts, 2, 37)) +>doit : Symbol(C.doit, Decl(selfInCallback.ts, 2, 37)) this.callback(()=>{this.p1+1}); ->this.callback : Symbol(callback, Decl(selfInCallback.ts, 1, 15)) +>this.callback : Symbol(C.callback, Decl(selfInCallback.ts, 1, 15)) >this : Symbol(C, Decl(selfInCallback.ts, 0, 0)) ->callback : Symbol(callback, Decl(selfInCallback.ts, 1, 15)) ->this.p1 : Symbol(p1, Decl(selfInCallback.ts, 0, 9)) +>callback : Symbol(C.callback, Decl(selfInCallback.ts, 1, 15)) +>this.p1 : Symbol(C.p1, Decl(selfInCallback.ts, 0, 9)) >this : Symbol(C, Decl(selfInCallback.ts, 0, 0)) ->p1 : Symbol(p1, Decl(selfInCallback.ts, 0, 9)) +>p1 : Symbol(C.p1, Decl(selfInCallback.ts, 0, 9)) } } diff --git a/tests/baselines/reference/selfInLambdas.symbols b/tests/baselines/reference/selfInLambdas.symbols index 032de5e7767..edcc03b6bf6 100644 --- a/tests/baselines/reference/selfInLambdas.symbols +++ b/tests/baselines/reference/selfInLambdas.symbols @@ -3,10 +3,10 @@ interface MouseEvent { >MouseEvent : Symbol(MouseEvent, Decl(selfInLambdas.ts, 0, 0)) x: number; ->x : Symbol(x, Decl(selfInLambdas.ts, 0, 22)) +>x : Symbol(MouseEvent.x, Decl(selfInLambdas.ts, 0, 22)) y: number; ->y : Symbol(y, Decl(selfInLambdas.ts, 1, 14)) +>y : Symbol(MouseEvent.y, Decl(selfInLambdas.ts, 1, 14)) } declare var window: Window; @@ -17,7 +17,7 @@ interface Window { >Window : Symbol(Window, Decl(selfInLambdas.ts, 5, 27)) onmousemove: (ev: MouseEvent) => any; ->onmousemove : Symbol(onmousemove, Decl(selfInLambdas.ts, 6, 18)) +>onmousemove : Symbol(Window.onmousemove, Decl(selfInLambdas.ts, 6, 18)) >ev : Symbol(ev, Decl(selfInLambdas.ts, 7, 18)) >MouseEvent : Symbol(MouseEvent, Decl(selfInLambdas.ts, 0, 0)) @@ -52,28 +52,28 @@ class X { >X : Symbol(X, Decl(selfInLambdas.ts, 24, 1)) private value = "value"; ->value : Symbol(value, Decl(selfInLambdas.ts, 28, 9)) +>value : Symbol(X.value, Decl(selfInLambdas.ts, 28, 9)) public foo() { ->foo : Symbol(foo, Decl(selfInLambdas.ts, 29, 25)) +>foo : Symbol(X.foo, Decl(selfInLambdas.ts, 29, 25)) var outer= () => { >outer : Symbol(outer, Decl(selfInLambdas.ts, 32, 5)) var x = this.value; >x : Symbol(x, Decl(selfInLambdas.ts, 33, 15)) ->this.value : Symbol(value, Decl(selfInLambdas.ts, 28, 9)) +>this.value : Symbol(X.value, Decl(selfInLambdas.ts, 28, 9)) >this : Symbol(X, Decl(selfInLambdas.ts, 24, 1)) ->value : Symbol(value, Decl(selfInLambdas.ts, 28, 9)) +>value : Symbol(X.value, Decl(selfInLambdas.ts, 28, 9)) var inner = () => { >inner : Symbol(inner, Decl(selfInLambdas.ts, 34, 15)) var y = this.value; >y : Symbol(y, Decl(selfInLambdas.ts, 35, 19)) ->this.value : Symbol(value, Decl(selfInLambdas.ts, 28, 9)) +>this.value : Symbol(X.value, Decl(selfInLambdas.ts, 28, 9)) >this : Symbol(X, Decl(selfInLambdas.ts, 24, 1)) ->value : Symbol(value, Decl(selfInLambdas.ts, 28, 9)) +>value : Symbol(X.value, Decl(selfInLambdas.ts, 28, 9)) } inner(); diff --git a/tests/baselines/reference/shorthand-property-es5-es6.errors.txt b/tests/baselines/reference/shorthand-property-es5-es6.errors.txt new file mode 100644 index 00000000000..f491dfbaabe --- /dev/null +++ b/tests/baselines/reference/shorthand-property-es5-es6.errors.txt @@ -0,0 +1,13 @@ +error TS1204: Cannot compile modules into 'es2015' when targeting 'ES5' or lower. +tests/cases/compiler/test.ts(2,19): error TS2307: Cannot find module './foo'. + + +!!! error TS1204: Cannot compile modules into 'es2015' when targeting 'ES5' or lower. +==== tests/cases/compiler/test.ts (1 errors) ==== + + import {foo} from './foo'; + ~~~~~~~ +!!! error TS2307: Cannot find module './foo'. + const baz = 42; + const bar = { foo, baz }; + \ No newline at end of file diff --git a/tests/baselines/reference/shorthand-property-es5-es6.js b/tests/baselines/reference/shorthand-property-es5-es6.js new file mode 100644 index 00000000000..cbca92adb0c --- /dev/null +++ b/tests/baselines/reference/shorthand-property-es5-es6.js @@ -0,0 +1,14 @@ +//// [test.ts] + +import {foo} from './foo'; +const baz = 42; +const bar = { foo, baz }; + + +//// [test.js] +import { foo } from './foo'; +var baz = 42; +var bar = { foo: foo, baz: baz }; + + +//// [test.d.ts] diff --git a/tests/baselines/reference/shorthand-property-es6-amd.errors.txt b/tests/baselines/reference/shorthand-property-es6-amd.errors.txt new file mode 100644 index 00000000000..e54f73a4e61 --- /dev/null +++ b/tests/baselines/reference/shorthand-property-es6-amd.errors.txt @@ -0,0 +1,11 @@ +tests/cases/compiler/test.ts(2,19): error TS2307: Cannot find module './foo'. + + +==== tests/cases/compiler/test.ts (1 errors) ==== + + import {foo} from './foo'; + ~~~~~~~ +!!! error TS2307: Cannot find module './foo'. + const baz = 42; + const bar = { foo, baz }; + \ No newline at end of file diff --git a/tests/baselines/reference/shorthand-property-es6-amd.js b/tests/baselines/reference/shorthand-property-es6-amd.js new file mode 100644 index 00000000000..3cecc18b661 --- /dev/null +++ b/tests/baselines/reference/shorthand-property-es6-amd.js @@ -0,0 +1,16 @@ +//// [test.ts] + +import {foo} from './foo'; +const baz = 42; +const bar = { foo, baz }; + + +//// [test.js] +define(["require", "exports", './foo'], function (require, exports, foo_1) { + "use strict"; + const baz = 42; + const bar = { foo: foo_1.foo, baz }; +}); + + +//// [test.d.ts] diff --git a/tests/baselines/reference/shorthand-property-es6-es6.errors.txt b/tests/baselines/reference/shorthand-property-es6-es6.errors.txt new file mode 100644 index 00000000000..e54f73a4e61 --- /dev/null +++ b/tests/baselines/reference/shorthand-property-es6-es6.errors.txt @@ -0,0 +1,11 @@ +tests/cases/compiler/test.ts(2,19): error TS2307: Cannot find module './foo'. + + +==== tests/cases/compiler/test.ts (1 errors) ==== + + import {foo} from './foo'; + ~~~~~~~ +!!! error TS2307: Cannot find module './foo'. + const baz = 42; + const bar = { foo, baz }; + \ No newline at end of file diff --git a/tests/baselines/reference/shorthand-property-es6-es6.js b/tests/baselines/reference/shorthand-property-es6-es6.js new file mode 100644 index 00000000000..eff67c879cc --- /dev/null +++ b/tests/baselines/reference/shorthand-property-es6-es6.js @@ -0,0 +1,14 @@ +//// [test.ts] + +import {foo} from './foo'; +const baz = 42; +const bar = { foo, baz }; + + +//// [test.js] +import { foo } from './foo'; +const baz = 42; +const bar = { foo, baz }; + + +//// [test.d.ts] diff --git a/tests/baselines/reference/shorthandPropertyAssignmentInES6Module.js b/tests/baselines/reference/shorthandPropertyAssignmentInES6Module.js index cab16b96bc3..d52622dffc7 100644 --- a/tests/baselines/reference/shorthandPropertyAssignmentInES6Module.js +++ b/tests/baselines/reference/shorthandPropertyAssignmentInES6Module.js @@ -20,8 +20,8 @@ use(foo); exports.x = 1; //// [test.js] "use strict"; -var existingModule_1 = require('./existingModule'); -var missingModule_1 = require('./missingModule'); +const existingModule_1 = require('./existingModule'); +const missingModule_1 = require('./missingModule'); const test = { x: existingModule_1.x, foo: missingModule_1.foo }; use(existingModule_1.x); use(missingModule_1.foo); diff --git a/tests/baselines/reference/sigantureIsSubTypeIfTheyAreIdentical.symbols b/tests/baselines/reference/sigantureIsSubTypeIfTheyAreIdentical.symbols index e99f0076d39..9f8d22c1f6f 100644 --- a/tests/baselines/reference/sigantureIsSubTypeIfTheyAreIdentical.symbols +++ b/tests/baselines/reference/sigantureIsSubTypeIfTheyAreIdentical.symbols @@ -3,7 +3,7 @@ interface ICache { >ICache : Symbol(ICache, Decl(sigantureIsSubTypeIfTheyAreIdentical.ts, 0, 0)) get(key: string): T; ->get : Symbol(get, Decl(sigantureIsSubTypeIfTheyAreIdentical.ts, 0, 18)) +>get : Symbol(ICache.get, Decl(sigantureIsSubTypeIfTheyAreIdentical.ts, 0, 18)) >T : Symbol(T, Decl(sigantureIsSubTypeIfTheyAreIdentical.ts, 1, 8)) >key : Symbol(key, Decl(sigantureIsSubTypeIfTheyAreIdentical.ts, 1, 11)) >T : Symbol(T, Decl(sigantureIsSubTypeIfTheyAreIdentical.ts, 1, 8)) @@ -13,7 +13,7 @@ class CacheService implements ICache { // Should not error that property type of >ICache : Symbol(ICache, Decl(sigantureIsSubTypeIfTheyAreIdentical.ts, 0, 0)) get(key: string): T { ->get : Symbol(get, Decl(sigantureIsSubTypeIfTheyAreIdentical.ts, 3, 38)) +>get : Symbol(CacheService.get, Decl(sigantureIsSubTypeIfTheyAreIdentical.ts, 3, 38)) >T : Symbol(T, Decl(sigantureIsSubTypeIfTheyAreIdentical.ts, 4, 8)) >key : Symbol(key, Decl(sigantureIsSubTypeIfTheyAreIdentical.ts, 4, 11)) >T : Symbol(T, Decl(sigantureIsSubTypeIfTheyAreIdentical.ts, 4, 8)) diff --git a/tests/baselines/reference/singleLineCommentInConciseArrowFunctionES3.js b/tests/baselines/reference/singleLineCommentInConciseArrowFunctionES3.js new file mode 100644 index 00000000000..db4ab7950eb --- /dev/null +++ b/tests/baselines/reference/singleLineCommentInConciseArrowFunctionES3.js @@ -0,0 +1,14 @@ +//// [singleLineCommentInConciseArrowFunctionES3.ts] +function test() { + return () => + // some comments here; + 123; +} + +//// [singleLineCommentInConciseArrowFunctionES3.js] +function test() { + return function () { + // some comments here; + return 123; + }; +} diff --git a/tests/baselines/reference/singleLineCommentInConciseArrowFunctionES3.symbols b/tests/baselines/reference/singleLineCommentInConciseArrowFunctionES3.symbols new file mode 100644 index 00000000000..cb53d292885 --- /dev/null +++ b/tests/baselines/reference/singleLineCommentInConciseArrowFunctionES3.symbols @@ -0,0 +1,8 @@ +=== tests/cases/compiler/singleLineCommentInConciseArrowFunctionES3.ts === +function test() { +>test : Symbol(test, Decl(singleLineCommentInConciseArrowFunctionES3.ts, 0, 0)) + + return () => + // some comments here; + 123; +} diff --git a/tests/baselines/reference/singleLineCommentInConciseArrowFunctionES3.types b/tests/baselines/reference/singleLineCommentInConciseArrowFunctionES3.types new file mode 100644 index 00000000000..e8c449e7bb8 --- /dev/null +++ b/tests/baselines/reference/singleLineCommentInConciseArrowFunctionES3.types @@ -0,0 +1,11 @@ +=== tests/cases/compiler/singleLineCommentInConciseArrowFunctionES3.ts === +function test() { +>test : () => () => number + + return () => +>() => // some comments here; 123 : () => number + + // some comments here; + 123; +>123 : number +} diff --git a/tests/baselines/reference/sourceMap-Comments.symbols b/tests/baselines/reference/sourceMap-Comments.symbols index d7c1adabbb0..490042b4c89 100644 --- a/tests/baselines/reference/sourceMap-Comments.symbols +++ b/tests/baselines/reference/sourceMap-Comments.symbols @@ -7,7 +7,7 @@ module sas.tools { >Test : Symbol(Test, Decl(sourceMap-Comments.ts, 0, 18)) public doX(): void { ->doX : Symbol(doX, Decl(sourceMap-Comments.ts, 1, 23)) +>doX : Symbol(Test.doX, Decl(sourceMap-Comments.ts, 1, 23)) let f: number = 2; >f : Symbol(f, Decl(sourceMap-Comments.ts, 3, 15)) diff --git a/tests/baselines/reference/sourceMap-FileWithComments.symbols b/tests/baselines/reference/sourceMap-FileWithComments.symbols index 50993547428..e7b8c1c4b7c 100644 --- a/tests/baselines/reference/sourceMap-FileWithComments.symbols +++ b/tests/baselines/reference/sourceMap-FileWithComments.symbols @@ -5,7 +5,7 @@ interface IPoint { >IPoint : Symbol(IPoint, Decl(sourceMap-FileWithComments.ts, 0, 0)) getDist(): number; ->getDist : Symbol(getDist, Decl(sourceMap-FileWithComments.ts, 2, 18)) +>getDist : Symbol(IPoint.getDist, Decl(sourceMap-FileWithComments.ts, 2, 18)) } // Module @@ -19,27 +19,27 @@ module Shapes { // Constructor constructor(public x: number, public y: number) { } ->x : Symbol(x, Decl(sourceMap-FileWithComments.ts, 12, 20)) ->y : Symbol(y, Decl(sourceMap-FileWithComments.ts, 12, 37)) +>x : Symbol(Point.x, Decl(sourceMap-FileWithComments.ts, 12, 20)) +>y : Symbol(Point.y, Decl(sourceMap-FileWithComments.ts, 12, 37)) // Instance member getDist() { return Math.sqrt(this.x * this.x + this.y * this.y); } ->getDist : Symbol(getDist, Decl(sourceMap-FileWithComments.ts, 12, 59)) +>getDist : Symbol(Point.getDist, Decl(sourceMap-FileWithComments.ts, 12, 59)) >Math.sqrt : Symbol(Math.sqrt, Decl(lib.d.ts, --, --)) >Math : Symbol(Math, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >sqrt : Symbol(Math.sqrt, Decl(lib.d.ts, --, --)) ->this.x : Symbol(x, Decl(sourceMap-FileWithComments.ts, 12, 20)) +>this.x : Symbol(Point.x, Decl(sourceMap-FileWithComments.ts, 12, 20)) >this : Symbol(Point, Decl(sourceMap-FileWithComments.ts, 7, 15)) ->x : Symbol(x, Decl(sourceMap-FileWithComments.ts, 12, 20)) ->this.x : Symbol(x, Decl(sourceMap-FileWithComments.ts, 12, 20)) +>x : Symbol(Point.x, Decl(sourceMap-FileWithComments.ts, 12, 20)) +>this.x : Symbol(Point.x, Decl(sourceMap-FileWithComments.ts, 12, 20)) >this : Symbol(Point, Decl(sourceMap-FileWithComments.ts, 7, 15)) ->x : Symbol(x, Decl(sourceMap-FileWithComments.ts, 12, 20)) ->this.y : Symbol(y, Decl(sourceMap-FileWithComments.ts, 12, 37)) +>x : Symbol(Point.x, Decl(sourceMap-FileWithComments.ts, 12, 20)) +>this.y : Symbol(Point.y, Decl(sourceMap-FileWithComments.ts, 12, 37)) >this : Symbol(Point, Decl(sourceMap-FileWithComments.ts, 7, 15)) ->y : Symbol(y, Decl(sourceMap-FileWithComments.ts, 12, 37)) ->this.y : Symbol(y, Decl(sourceMap-FileWithComments.ts, 12, 37)) +>y : Symbol(Point.y, Decl(sourceMap-FileWithComments.ts, 12, 37)) +>this.y : Symbol(Point.y, Decl(sourceMap-FileWithComments.ts, 12, 37)) >this : Symbol(Point, Decl(sourceMap-FileWithComments.ts, 7, 15)) ->y : Symbol(y, Decl(sourceMap-FileWithComments.ts, 12, 37)) +>y : Symbol(Point.y, Decl(sourceMap-FileWithComments.ts, 12, 37)) // Static member static origin = new Point(0, 0); diff --git a/tests/baselines/reference/sourceMap-StringLiteralWithNewLine.symbols b/tests/baselines/reference/sourceMap-StringLiteralWithNewLine.symbols index 96d39301090..3b1d95afc00 100644 --- a/tests/baselines/reference/sourceMap-StringLiteralWithNewLine.symbols +++ b/tests/baselines/reference/sourceMap-StringLiteralWithNewLine.symbols @@ -7,7 +7,7 @@ interface Window { >Window : Symbol(Window, Decl(sourceMap-StringLiteralWithNewLine.ts, 2, 1)) document: Document; ->document : Symbol(document, Decl(sourceMap-StringLiteralWithNewLine.ts, 3, 18)) +>document : Symbol(Window.document, Decl(sourceMap-StringLiteralWithNewLine.ts, 3, 18)) >Document : Symbol(Document, Decl(sourceMap-StringLiteralWithNewLine.ts, 0, 0)) } declare var window: Window; diff --git a/tests/baselines/reference/sourceMapSample.js.map b/tests/baselines/reference/sourceMapSample.js.map index 2429a04c88b..0617ba4c1ba 100644 --- a/tests/baselines/reference/sourceMapSample.js.map +++ b/tests/baselines/reference/sourceMapSample.js.map @@ -1,2 +1,2 @@ //// [sourceMapSample.js.map] -{"version":3,"file":"sourceMapSample.js","sourceRoot":"","sources":["sourceMapSample.ts"],"names":[],"mappings":"AAAA,IAAO,GAAG,CAkCT;AAlCD,WAAO,GAAG;IAAC,IAAA,GAAG,CAkCb;IAlCU,WAAA,GAAG,EAAC,CAAC;QACZ,YAAY,CAAC;QAEb;YACI,iBAAmB,QAAgB;gBAAhB,aAAQ,GAAR,QAAQ,CAAQ;YACnC,CAAC;YAED,uBAAK,GAAL;gBACI,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;YAC5C,CAAC;YACL,cAAC;QAAD,CAAC,AAPD,IAOC;QAGD,aAAa,QAAgB;YACzB,MAAM,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,CAAC;QACjC,CAAC;QAED,IAAI,OAAO,GAAG,IAAI,OAAO,CAAC,eAAe,CAAC,CAAC;QAC3C,IAAI,GAAG,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;QAE1B,cAAc,QAAgB;YAAE,uBAA0B;iBAA1B,WAA0B,CAA1B,sBAA0B,CAA1B,IAA0B;gBAA1B,sCAA0B;;YACtD,IAAI,QAAQ,GAAc,EAAE,CAAC;YAC7B,QAAQ,CAAC,CAAC,CAAC,GAAG,IAAI,OAAO,CAAC,QAAQ,CAAC,CAAC;YACpC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,aAAa,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;gBAC5C,QAAQ,CAAC,IAAI,CAAC,IAAI,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YACjD,CAAC;YAED,MAAM,CAAC,QAAQ,CAAC;QACpB,CAAC;QAED,IAAI,CAAC,GAAG,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;QACpC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAChC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC;QACjB,CAAC;IACL,CAAC,EAlCU,GAAG,GAAH,OAAG,KAAH,OAAG,QAkCb;AAAD,CAAC,EAlCM,GAAG,KAAH,GAAG,QAkCT"} \ No newline at end of file +{"version":3,"file":"sourceMapSample.js","sourceRoot":"","sources":["sourceMapSample.ts"],"names":[],"mappings":"AAAA,IAAO,GAAG,CAkCT;AAlCD,WAAO,GAAG;IAAC,IAAA,GAAG,CAkCb;IAlCU,WAAA,GAAG,EAAC,CAAC;QACZ,YAAY,CAAC;QAEb;YACI,iBAAmB,QAAgB;gBAAhB,aAAQ,GAAR,QAAQ,CAAQ;YACnC,CAAC;YAED,uBAAK,GAAL;gBACI,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;YAC5C,CAAC;YACL,cAAC;QAAD,CAAC,AAPD,IAOC;QAGD,aAAa,QAAgB;YACzB,MAAM,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,CAAC;QACjC,CAAC;QAED,IAAI,OAAO,GAAG,IAAI,OAAO,CAAC,eAAe,CAAC,CAAC;QAC3C,IAAI,GAAG,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;QAE1B,cAAc,QAAgB;YAAE,uBAA0B;iBAA1B,WAA0B,CAA1B,sBAA0B,CAA1B,IAA0B;gBAA1B,sCAA0B;;YACtD,IAAI,QAAQ,GAAc,EAAE,CAAC;YAC7B,QAAQ,CAAC,CAAC,CAAC,GAAG,IAAI,OAAO,CAAC,QAAQ,CAAC,CAAC;YACpC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,aAAa,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;gBAC5C,QAAQ,CAAC,IAAI,CAAC,IAAI,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YACjD,CAAC;YAED,MAAM,CAAC,QAAQ,CAAC;QACpB,CAAC;QAED,IAAI,CAAC,GAAG,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;QACpC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAChC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC;QACjB,CAAC;IACL,CAAC,EAlCU,GAAG,GAAH,OAAG,KAAH,OAAG,QAkCb;AAAD,CAAC,EAlCM,GAAG,KAAH,GAAG,QAkCT"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapSample.sourcemap.txt b/tests/baselines/reference/sourceMapSample.sourcemap.txt index 0fb03dacf48..5b3251226b9 100644 --- a/tests/baselines/reference/sourceMapSample.sourcemap.txt +++ b/tests/baselines/reference/sourceMapSample.sourcemap.txt @@ -525,64 +525,61 @@ sourceFile:sourceMapSample.ts 2 > ^^^ 3 > ^ 4 > ^ -5 > ^^^ -6 > ^ -7 > ^ -8 > ^^^ -9 > ^ -10> ^^ -11> ^ -12> ^^^ -13> ^^^^^^^^^^^^^ -14> ^ -15> ^^^^^^ -16> ^^ -17> ^ -18> ^^ -19> ^^ -20> ^ -21> ^^-> +5 > ^^^^ +6 > ^ +7 > ^^^ +8 > ^ +9 > ^^ +10> ^ +11> ^^^ +12> ^^^^^^^^^^^^^ +13> ^ +14> ^^^^^^ +15> ^^ +16> ^ +17> ^^ +18> ^^ +19> ^ +20> ^^-> 1-> > 2 > for 3 > 4 > ( -5 > var -6 > -7 > i -8 > = -9 > 0 -10> ; -11> i -12> < -13> restGreetings -14> . -15> length -16> ; -17> i -18> ++ -19> ) -20> { +5 > var +6 > i +7 > = +8 > 0 +9 > ; +10> i +11> < +12> restGreetings +13> . +14> length +15> ; +16> i +17> ++ +18> ) +19> { 1->Emitted(27, 13) Source(24, 9) + SourceIndex(0) 2 >Emitted(27, 16) Source(24, 12) + SourceIndex(0) 3 >Emitted(27, 17) Source(24, 13) + SourceIndex(0) 4 >Emitted(27, 18) Source(24, 14) + SourceIndex(0) -5 >Emitted(27, 21) Source(24, 17) + SourceIndex(0) -6 >Emitted(27, 22) Source(24, 18) + SourceIndex(0) -7 >Emitted(27, 23) Source(24, 19) + SourceIndex(0) -8 >Emitted(27, 26) Source(24, 22) + SourceIndex(0) -9 >Emitted(27, 27) Source(24, 23) + SourceIndex(0) -10>Emitted(27, 29) Source(24, 25) + SourceIndex(0) -11>Emitted(27, 30) Source(24, 26) + SourceIndex(0) -12>Emitted(27, 33) Source(24, 29) + SourceIndex(0) -13>Emitted(27, 46) Source(24, 42) + SourceIndex(0) -14>Emitted(27, 47) Source(24, 43) + SourceIndex(0) -15>Emitted(27, 53) Source(24, 49) + SourceIndex(0) -16>Emitted(27, 55) Source(24, 51) + SourceIndex(0) -17>Emitted(27, 56) Source(24, 52) + SourceIndex(0) -18>Emitted(27, 58) Source(24, 54) + SourceIndex(0) -19>Emitted(27, 60) Source(24, 56) + SourceIndex(0) -20>Emitted(27, 61) Source(24, 57) + SourceIndex(0) +5 >Emitted(27, 22) Source(24, 18) + SourceIndex(0) +6 >Emitted(27, 23) Source(24, 19) + SourceIndex(0) +7 >Emitted(27, 26) Source(24, 22) + SourceIndex(0) +8 >Emitted(27, 27) Source(24, 23) + SourceIndex(0) +9 >Emitted(27, 29) Source(24, 25) + SourceIndex(0) +10>Emitted(27, 30) Source(24, 26) + SourceIndex(0) +11>Emitted(27, 33) Source(24, 29) + SourceIndex(0) +12>Emitted(27, 46) Source(24, 42) + SourceIndex(0) +13>Emitted(27, 47) Source(24, 43) + SourceIndex(0) +14>Emitted(27, 53) Source(24, 49) + SourceIndex(0) +15>Emitted(27, 55) Source(24, 51) + SourceIndex(0) +16>Emitted(27, 56) Source(24, 52) + SourceIndex(0) +17>Emitted(27, 58) Source(24, 54) + SourceIndex(0) +18>Emitted(27, 60) Source(24, 56) + SourceIndex(0) +19>Emitted(27, 61) Source(24, 57) + SourceIndex(0) --- >>> greeters.push(new Greeter(restGreetings[i])); 1->^^^^^^^^^^^^^^^^ @@ -720,63 +717,60 @@ sourceFile:sourceMapSample.ts 2 > ^^^ 3 > ^ 4 > ^ -5 > ^^^ -6 > ^ -7 > ^ -8 > ^^^ -9 > ^ -10> ^^ -11> ^ -12> ^^^ -13> ^ -14> ^ -15> ^^^^^^ -16> ^^ -17> ^ -18> ^^ -19> ^^ -20> ^ +5 > ^^^^ +6 > ^ +7 > ^^^ +8 > ^ +9 > ^^ +10> ^ +11> ^^^ +12> ^ +13> ^ +14> ^^^^^^ +15> ^^ +16> ^ +17> ^^ +18> ^^ +19> ^ 1-> > 2 > for 3 > 4 > ( -5 > var -6 > -7 > j -8 > = -9 > 0 -10> ; -11> j -12> < -13> b -14> . -15> length -16> ; -17> j -18> ++ -19> ) -20> { +5 > var +6 > j +7 > = +8 > 0 +9 > ; +10> j +11> < +12> b +13> . +14> length +15> ; +16> j +17> ++ +18> ) +19> { 1->Emitted(33, 9) Source(32, 5) + SourceIndex(0) 2 >Emitted(33, 12) Source(32, 8) + SourceIndex(0) 3 >Emitted(33, 13) Source(32, 9) + SourceIndex(0) 4 >Emitted(33, 14) Source(32, 10) + SourceIndex(0) -5 >Emitted(33, 17) Source(32, 13) + SourceIndex(0) -6 >Emitted(33, 18) Source(32, 14) + SourceIndex(0) -7 >Emitted(33, 19) Source(32, 15) + SourceIndex(0) -8 >Emitted(33, 22) Source(32, 18) + SourceIndex(0) -9 >Emitted(33, 23) Source(32, 19) + SourceIndex(0) -10>Emitted(33, 25) Source(32, 21) + SourceIndex(0) -11>Emitted(33, 26) Source(32, 22) + SourceIndex(0) -12>Emitted(33, 29) Source(32, 25) + SourceIndex(0) -13>Emitted(33, 30) Source(32, 26) + SourceIndex(0) -14>Emitted(33, 31) Source(32, 27) + SourceIndex(0) -15>Emitted(33, 37) Source(32, 33) + SourceIndex(0) -16>Emitted(33, 39) Source(32, 35) + SourceIndex(0) -17>Emitted(33, 40) Source(32, 36) + SourceIndex(0) -18>Emitted(33, 42) Source(32, 38) + SourceIndex(0) -19>Emitted(33, 44) Source(32, 40) + SourceIndex(0) -20>Emitted(33, 45) Source(32, 41) + SourceIndex(0) +5 >Emitted(33, 18) Source(32, 14) + SourceIndex(0) +6 >Emitted(33, 19) Source(32, 15) + SourceIndex(0) +7 >Emitted(33, 22) Source(32, 18) + SourceIndex(0) +8 >Emitted(33, 23) Source(32, 19) + SourceIndex(0) +9 >Emitted(33, 25) Source(32, 21) + SourceIndex(0) +10>Emitted(33, 26) Source(32, 22) + SourceIndex(0) +11>Emitted(33, 29) Source(32, 25) + SourceIndex(0) +12>Emitted(33, 30) Source(32, 26) + SourceIndex(0) +13>Emitted(33, 31) Source(32, 27) + SourceIndex(0) +14>Emitted(33, 37) Source(32, 33) + SourceIndex(0) +15>Emitted(33, 39) Source(32, 35) + SourceIndex(0) +16>Emitted(33, 40) Source(32, 36) + SourceIndex(0) +17>Emitted(33, 42) Source(32, 38) + SourceIndex(0) +18>Emitted(33, 44) Source(32, 40) + SourceIndex(0) +19>Emitted(33, 45) Source(32, 41) + SourceIndex(0) --- >>> b[j].greet(); 1 >^^^^^^^^^^^^ diff --git a/tests/baselines/reference/sourceMapValidationClass.symbols b/tests/baselines/reference/sourceMapValidationClass.symbols index 28c2e1efe1a..1a5e244586f 100644 --- a/tests/baselines/reference/sourceMapValidationClass.symbols +++ b/tests/baselines/reference/sourceMapValidationClass.symbols @@ -3,47 +3,47 @@ class Greeter { >Greeter : Symbol(Greeter, Decl(sourceMapValidationClass.ts, 0, 0)) constructor(public greeting: string, ...b: string[]) { ->greeting : Symbol(greeting, Decl(sourceMapValidationClass.ts, 1, 16)) +>greeting : Symbol(Greeter.greeting, Decl(sourceMapValidationClass.ts, 1, 16)) >b : Symbol(b, Decl(sourceMapValidationClass.ts, 1, 40)) } greet() { ->greet : Symbol(greet, Decl(sourceMapValidationClass.ts, 2, 5)) +>greet : Symbol(Greeter.greet, Decl(sourceMapValidationClass.ts, 2, 5)) return "

" + this.greeting + "

"; ->this.greeting : Symbol(greeting, Decl(sourceMapValidationClass.ts, 1, 16)) +>this.greeting : Symbol(Greeter.greeting, Decl(sourceMapValidationClass.ts, 1, 16)) >this : Symbol(Greeter, Decl(sourceMapValidationClass.ts, 0, 0)) ->greeting : Symbol(greeting, Decl(sourceMapValidationClass.ts, 1, 16)) +>greeting : Symbol(Greeter.greeting, Decl(sourceMapValidationClass.ts, 1, 16)) } private x: string; ->x : Symbol(x, Decl(sourceMapValidationClass.ts, 5, 5)) +>x : Symbol(Greeter.x, Decl(sourceMapValidationClass.ts, 5, 5)) private x1: number = 10; ->x1 : Symbol(x1, Decl(sourceMapValidationClass.ts, 6, 22)) +>x1 : Symbol(Greeter.x1, Decl(sourceMapValidationClass.ts, 6, 22)) private fn() { ->fn : Symbol(fn, Decl(sourceMapValidationClass.ts, 7, 28)) +>fn : Symbol(Greeter.fn, Decl(sourceMapValidationClass.ts, 7, 28)) return this.greeting; ->this.greeting : Symbol(greeting, Decl(sourceMapValidationClass.ts, 1, 16)) +>this.greeting : Symbol(Greeter.greeting, Decl(sourceMapValidationClass.ts, 1, 16)) >this : Symbol(Greeter, Decl(sourceMapValidationClass.ts, 0, 0)) ->greeting : Symbol(greeting, Decl(sourceMapValidationClass.ts, 1, 16)) +>greeting : Symbol(Greeter.greeting, Decl(sourceMapValidationClass.ts, 1, 16)) } get greetings() { ->greetings : Symbol(greetings, Decl(sourceMapValidationClass.ts, 10, 5), Decl(sourceMapValidationClass.ts, 13, 5)) +>greetings : Symbol(Greeter.greetings, Decl(sourceMapValidationClass.ts, 10, 5), Decl(sourceMapValidationClass.ts, 13, 5)) return this.greeting; ->this.greeting : Symbol(greeting, Decl(sourceMapValidationClass.ts, 1, 16)) +>this.greeting : Symbol(Greeter.greeting, Decl(sourceMapValidationClass.ts, 1, 16)) >this : Symbol(Greeter, Decl(sourceMapValidationClass.ts, 0, 0)) ->greeting : Symbol(greeting, Decl(sourceMapValidationClass.ts, 1, 16)) +>greeting : Symbol(Greeter.greeting, Decl(sourceMapValidationClass.ts, 1, 16)) } set greetings(greetings: string) { ->greetings : Symbol(greetings, Decl(sourceMapValidationClass.ts, 10, 5), Decl(sourceMapValidationClass.ts, 13, 5)) +>greetings : Symbol(Greeter.greetings, Decl(sourceMapValidationClass.ts, 10, 5), Decl(sourceMapValidationClass.ts, 13, 5)) >greetings : Symbol(greetings, Decl(sourceMapValidationClass.ts, 14, 18)) this.greeting = greetings; ->this.greeting : Symbol(greeting, Decl(sourceMapValidationClass.ts, 1, 16)) +>this.greeting : Symbol(Greeter.greeting, Decl(sourceMapValidationClass.ts, 1, 16)) >this : Symbol(Greeter, Decl(sourceMapValidationClass.ts, 0, 0)) ->greeting : Symbol(greeting, Decl(sourceMapValidationClass.ts, 1, 16)) +>greeting : Symbol(Greeter.greeting, Decl(sourceMapValidationClass.ts, 1, 16)) >greetings : Symbol(greetings, Decl(sourceMapValidationClass.ts, 14, 18)) } } diff --git a/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructor.symbols b/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructor.symbols index 416e02b3990..dfa9a7bc045 100644 --- a/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructor.symbols +++ b/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructor.symbols @@ -3,8 +3,8 @@ class Greeter { >Greeter : Symbol(Greeter, Decl(sourceMapValidationClassWithDefaultConstructor.ts, 0, 0)) public a = 10; ->a : Symbol(a, Decl(sourceMapValidationClassWithDefaultConstructor.ts, 0, 15)) +>a : Symbol(Greeter.a, Decl(sourceMapValidationClassWithDefaultConstructor.ts, 0, 15)) public nameA = "Ten"; ->nameA : Symbol(nameA, Decl(sourceMapValidationClassWithDefaultConstructor.ts, 1, 18)) +>nameA : Symbol(Greeter.nameA, Decl(sourceMapValidationClassWithDefaultConstructor.ts, 1, 18)) } diff --git a/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndCapturedThisStatement.symbols b/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndCapturedThisStatement.symbols index 44612abacbb..cb7f70706ec 100644 --- a/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndCapturedThisStatement.symbols +++ b/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndCapturedThisStatement.symbols @@ -3,11 +3,11 @@ class Greeter { >Greeter : Symbol(Greeter, Decl(sourceMapValidationClassWithDefaultConstructorAndCapturedThisStatement.ts, 0, 0)) public a = 10; ->a : Symbol(a, Decl(sourceMapValidationClassWithDefaultConstructorAndCapturedThisStatement.ts, 0, 15)) +>a : Symbol(Greeter.a, Decl(sourceMapValidationClassWithDefaultConstructorAndCapturedThisStatement.ts, 0, 15)) public returnA = () => this.a; ->returnA : Symbol(returnA, Decl(sourceMapValidationClassWithDefaultConstructorAndCapturedThisStatement.ts, 1, 18)) ->this.a : Symbol(a, Decl(sourceMapValidationClassWithDefaultConstructorAndCapturedThisStatement.ts, 0, 15)) +>returnA : Symbol(Greeter.returnA, Decl(sourceMapValidationClassWithDefaultConstructorAndCapturedThisStatement.ts, 1, 18)) +>this.a : Symbol(Greeter.a, Decl(sourceMapValidationClassWithDefaultConstructorAndCapturedThisStatement.ts, 0, 15)) >this : Symbol(Greeter, Decl(sourceMapValidationClassWithDefaultConstructorAndCapturedThisStatement.ts, 0, 0)) ->a : Symbol(a, Decl(sourceMapValidationClassWithDefaultConstructorAndCapturedThisStatement.ts, 0, 15)) +>a : Symbol(Greeter.a, Decl(sourceMapValidationClassWithDefaultConstructorAndCapturedThisStatement.ts, 0, 15)) } diff --git a/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.symbols b/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.symbols index 0fafe3ecdc0..7ff0c061a26 100644 --- a/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.symbols +++ b/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.symbols @@ -8,8 +8,8 @@ class Greeter extends AbstractGreeter { >AbstractGreeter : Symbol(AbstractGreeter, Decl(sourceMapValidationClassWithDefaultConstructorAndExtendsClause.ts, 0, 0)) public a = 10; ->a : Symbol(a, Decl(sourceMapValidationClassWithDefaultConstructorAndExtendsClause.ts, 3, 39)) +>a : Symbol(Greeter.a, Decl(sourceMapValidationClassWithDefaultConstructorAndExtendsClause.ts, 3, 39)) public nameA = "Ten"; ->nameA : Symbol(nameA, Decl(sourceMapValidationClassWithDefaultConstructorAndExtendsClause.ts, 4, 18)) +>nameA : Symbol(Greeter.nameA, Decl(sourceMapValidationClassWithDefaultConstructorAndExtendsClause.ts, 4, 18)) } diff --git a/tests/baselines/reference/sourceMapValidationClasses.js.map b/tests/baselines/reference/sourceMapValidationClasses.js.map index 08ed68ebca7..bddc7694f10 100644 --- a/tests/baselines/reference/sourceMapValidationClasses.js.map +++ b/tests/baselines/reference/sourceMapValidationClasses.js.map @@ -1,2 +1,2 @@ //// [sourceMapValidationClasses.js.map] -{"version":3,"file":"sourceMapValidationClasses.js","sourceRoot":"","sources":["sourceMapValidationClasses.ts"],"names":[],"mappings":"AAAA,IAAO,GAAG,CAmCT;AAnCD,WAAO,GAAG;IAAC,IAAA,GAAG,CAmCb;IAnCU,WAAA,GAAG,EAAC,CAAC;QACZ,YAAY,CAAC;QAEb;YACI,iBAAmB,QAAgB;gBAAhB,aAAQ,GAAR,QAAQ,CAAQ;YACnC,CAAC;YAED,uBAAK,GAAL;gBACI,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;YAC5C,CAAC;YACL,cAAC;QAAD,CAAC,AAPD,IAOC;QAGD,aAAa,QAAgB;YACzB,MAAM,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,CAAC;QACjC,CAAC;QAED,IAAI,OAAO,GAAG,IAAI,OAAO,CAAC,eAAe,CAAC,CAAC;QAC3C,IAAI,GAAG,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;QAE1B,cAAc,QAAgB;YAAE,kBAAiB,mBAAmB,MAAU;iBAA9C,WAA8C,CAA9C,sBAA8C,CAA9C,IAA8C;gBAA9C,cAAiB,mBAAmB,yBAAU;;YAC1E,IAAI,QAAQ,GAAc,EAAE,CAAC,CAAC,0BAA0B;YACxD,QAAQ,CAAC,CAAC,CAAC,GAAG,IAAI,OAAO,CAAC,QAAQ,CAAC,CAAC;YACpC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,aAAa,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;gBAC5C,QAAQ,CAAC,IAAI,CAAC,IAAI,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YACjD,CAAC;YAED,MAAM,CAAC,QAAQ,CAAC;QACpB,CAAC;QAED,IAAI,CAAC,GAAG,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;QACpC,qCAAqC;QACrC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAChC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC;QACjB,CAAC;IACL,CAAC,EAnCU,GAAG,GAAH,OAAG,KAAH,OAAG,QAmCb;AAAD,CAAC,EAnCM,GAAG,KAAH,GAAG,QAmCT"} \ No newline at end of file +{"version":3,"file":"sourceMapValidationClasses.js","sourceRoot":"","sources":["sourceMapValidationClasses.ts"],"names":[],"mappings":"AAAA,IAAO,GAAG,CAmCT;AAnCD,WAAO,GAAG;IAAC,IAAA,GAAG,CAmCb;IAnCU,WAAA,GAAG,EAAC,CAAC;QACZ,YAAY,CAAC;QAEb;YACI,iBAAmB,QAAgB;gBAAhB,aAAQ,GAAR,QAAQ,CAAQ;YACnC,CAAC;YAED,uBAAK,GAAL;gBACI,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;YAC5C,CAAC;YACL,cAAC;QAAD,CAAC,AAPD,IAOC;QAGD,aAAa,QAAgB;YACzB,MAAM,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,CAAC;QACjC,CAAC;QAED,IAAI,OAAO,GAAG,IAAI,OAAO,CAAC,eAAe,CAAC,CAAC;QAC3C,IAAI,GAAG,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;QAE1B,cAAc,QAAgB;YAAE,kBAAiB,mBAAmB,MAAU;iBAA9C,WAA8C,CAA9C,sBAA8C,CAA9C,IAA8C;gBAA9C,cAAiB,mBAAmB,yBAAU;;YAC1E,IAAI,QAAQ,GAAc,EAAE,CAAC,CAAC,0BAA0B;YACxD,QAAQ,CAAC,CAAC,CAAC,GAAG,IAAI,OAAO,CAAC,QAAQ,CAAC,CAAC;YACpC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,aAAa,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;gBAC5C,QAAQ,CAAC,IAAI,CAAC,IAAI,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YACjD,CAAC;YAED,MAAM,CAAC,QAAQ,CAAC;QACpB,CAAC;QAED,IAAI,CAAC,GAAG,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;QACpC,qCAAqC;QACrC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAChC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC;QACjB,CAAC;IACL,CAAC,EAnCU,GAAG,GAAH,OAAG,KAAH,OAAG,QAmCb;AAAD,CAAC,EAnCM,GAAG,KAAH,GAAG,QAmCT"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationClasses.sourcemap.txt b/tests/baselines/reference/sourceMapValidationClasses.sourcemap.txt index 4501ec5d872..29ad93cf74d 100644 --- a/tests/baselines/reference/sourceMapValidationClasses.sourcemap.txt +++ b/tests/baselines/reference/sourceMapValidationClasses.sourcemap.txt @@ -545,64 +545,61 @@ sourceFile:sourceMapValidationClasses.ts 2 > ^^^ 3 > ^ 4 > ^ -5 > ^^^ -6 > ^ -7 > ^ -8 > ^^^ -9 > ^ -10> ^^ -11> ^ -12> ^^^ -13> ^^^^^^^^^^^^^ -14> ^ -15> ^^^^^^ -16> ^^ -17> ^ -18> ^^ -19> ^^ -20> ^ -21> ^^-> +5 > ^^^^ +6 > ^ +7 > ^^^ +8 > ^ +9 > ^^ +10> ^ +11> ^^^ +12> ^^^^^^^^^^^^^ +13> ^ +14> ^^^^^^ +15> ^^ +16> ^ +17> ^^ +18> ^^ +19> ^ +20> ^^-> 1-> > 2 > for 3 > 4 > ( -5 > var -6 > -7 > i -8 > = -9 > 0 -10> ; -11> i -12> < -13> restGreetings -14> . -15> length -16> ; -17> i -18> ++ -19> ) -20> { +5 > var +6 > i +7 > = +8 > 0 +9 > ; +10> i +11> < +12> restGreetings +13> . +14> length +15> ; +16> i +17> ++ +18> ) +19> { 1->Emitted(27, 13) Source(24, 9) + SourceIndex(0) 2 >Emitted(27, 16) Source(24, 12) + SourceIndex(0) 3 >Emitted(27, 17) Source(24, 13) + SourceIndex(0) 4 >Emitted(27, 18) Source(24, 14) + SourceIndex(0) -5 >Emitted(27, 21) Source(24, 17) + SourceIndex(0) -6 >Emitted(27, 22) Source(24, 18) + SourceIndex(0) -7 >Emitted(27, 23) Source(24, 19) + SourceIndex(0) -8 >Emitted(27, 26) Source(24, 22) + SourceIndex(0) -9 >Emitted(27, 27) Source(24, 23) + SourceIndex(0) -10>Emitted(27, 29) Source(24, 25) + SourceIndex(0) -11>Emitted(27, 30) Source(24, 26) + SourceIndex(0) -12>Emitted(27, 33) Source(24, 29) + SourceIndex(0) -13>Emitted(27, 46) Source(24, 42) + SourceIndex(0) -14>Emitted(27, 47) Source(24, 43) + SourceIndex(0) -15>Emitted(27, 53) Source(24, 49) + SourceIndex(0) -16>Emitted(27, 55) Source(24, 51) + SourceIndex(0) -17>Emitted(27, 56) Source(24, 52) + SourceIndex(0) -18>Emitted(27, 58) Source(24, 54) + SourceIndex(0) -19>Emitted(27, 60) Source(24, 56) + SourceIndex(0) -20>Emitted(27, 61) Source(24, 57) + SourceIndex(0) +5 >Emitted(27, 22) Source(24, 18) + SourceIndex(0) +6 >Emitted(27, 23) Source(24, 19) + SourceIndex(0) +7 >Emitted(27, 26) Source(24, 22) + SourceIndex(0) +8 >Emitted(27, 27) Source(24, 23) + SourceIndex(0) +9 >Emitted(27, 29) Source(24, 25) + SourceIndex(0) +10>Emitted(27, 30) Source(24, 26) + SourceIndex(0) +11>Emitted(27, 33) Source(24, 29) + SourceIndex(0) +12>Emitted(27, 46) Source(24, 42) + SourceIndex(0) +13>Emitted(27, 47) Source(24, 43) + SourceIndex(0) +14>Emitted(27, 53) Source(24, 49) + SourceIndex(0) +15>Emitted(27, 55) Source(24, 51) + SourceIndex(0) +16>Emitted(27, 56) Source(24, 52) + SourceIndex(0) +17>Emitted(27, 58) Source(24, 54) + SourceIndex(0) +18>Emitted(27, 60) Source(24, 56) + SourceIndex(0) +19>Emitted(27, 61) Source(24, 57) + SourceIndex(0) --- >>> greeters.push(new Greeter(restGreetings[i])); 1->^^^^^^^^^^^^^^^^ @@ -749,63 +746,60 @@ sourceFile:sourceMapValidationClasses.ts 2 > ^^^ 3 > ^ 4 > ^ -5 > ^^^ -6 > ^ -7 > ^ -8 > ^^^ -9 > ^ -10> ^^ -11> ^ -12> ^^^ -13> ^ -14> ^ -15> ^^^^^^ -16> ^^ -17> ^ -18> ^^ -19> ^^ -20> ^ +5 > ^^^^ +6 > ^ +7 > ^^^ +8 > ^ +9 > ^^ +10> ^ +11> ^^^ +12> ^ +13> ^ +14> ^^^^^^ +15> ^^ +16> ^ +17> ^^ +18> ^^ +19> ^ 1 > > 2 > for 3 > 4 > ( -5 > var -6 > -7 > j -8 > = -9 > 0 -10> ; -11> j -12> < -13> b -14> . -15> length -16> ; -17> j -18> ++ -19> ) -20> { +5 > var +6 > j +7 > = +8 > 0 +9 > ; +10> j +11> < +12> b +13> . +14> length +15> ; +16> j +17> ++ +18> ) +19> { 1 >Emitted(34, 9) Source(33, 5) + SourceIndex(0) 2 >Emitted(34, 12) Source(33, 8) + SourceIndex(0) 3 >Emitted(34, 13) Source(33, 9) + SourceIndex(0) 4 >Emitted(34, 14) Source(33, 10) + SourceIndex(0) -5 >Emitted(34, 17) Source(33, 13) + SourceIndex(0) -6 >Emitted(34, 18) Source(33, 14) + SourceIndex(0) -7 >Emitted(34, 19) Source(33, 15) + SourceIndex(0) -8 >Emitted(34, 22) Source(33, 18) + SourceIndex(0) -9 >Emitted(34, 23) Source(33, 19) + SourceIndex(0) -10>Emitted(34, 25) Source(33, 21) + SourceIndex(0) -11>Emitted(34, 26) Source(33, 22) + SourceIndex(0) -12>Emitted(34, 29) Source(33, 25) + SourceIndex(0) -13>Emitted(34, 30) Source(33, 26) + SourceIndex(0) -14>Emitted(34, 31) Source(33, 27) + SourceIndex(0) -15>Emitted(34, 37) Source(33, 33) + SourceIndex(0) -16>Emitted(34, 39) Source(33, 35) + SourceIndex(0) -17>Emitted(34, 40) Source(33, 36) + SourceIndex(0) -18>Emitted(34, 42) Source(33, 38) + SourceIndex(0) -19>Emitted(34, 44) Source(33, 40) + SourceIndex(0) -20>Emitted(34, 45) Source(33, 41) + SourceIndex(0) +5 >Emitted(34, 18) Source(33, 14) + SourceIndex(0) +6 >Emitted(34, 19) Source(33, 15) + SourceIndex(0) +7 >Emitted(34, 22) Source(33, 18) + SourceIndex(0) +8 >Emitted(34, 23) Source(33, 19) + SourceIndex(0) +9 >Emitted(34, 25) Source(33, 21) + SourceIndex(0) +10>Emitted(34, 26) Source(33, 22) + SourceIndex(0) +11>Emitted(34, 29) Source(33, 25) + SourceIndex(0) +12>Emitted(34, 30) Source(33, 26) + SourceIndex(0) +13>Emitted(34, 31) Source(33, 27) + SourceIndex(0) +14>Emitted(34, 37) Source(33, 33) + SourceIndex(0) +15>Emitted(34, 39) Source(33, 35) + SourceIndex(0) +16>Emitted(34, 40) Source(33, 36) + SourceIndex(0) +17>Emitted(34, 42) Source(33, 38) + SourceIndex(0) +18>Emitted(34, 44) Source(33, 40) + SourceIndex(0) +19>Emitted(34, 45) Source(33, 41) + SourceIndex(0) --- >>> b[j].greet(); 1 >^^^^^^^^^^^^ diff --git a/tests/baselines/reference/sourceMapValidationClasses.symbols b/tests/baselines/reference/sourceMapValidationClasses.symbols index 8608cd4ed21..3386730e4f9 100644 --- a/tests/baselines/reference/sourceMapValidationClasses.symbols +++ b/tests/baselines/reference/sourceMapValidationClasses.symbols @@ -9,16 +9,16 @@ module Foo.Bar { >Greeter : Symbol(Greeter, Decl(sourceMapValidationClasses.ts, 1, 17)) constructor(public greeting: string) { ->greeting : Symbol(greeting, Decl(sourceMapValidationClasses.ts, 4, 20)) +>greeting : Symbol(Greeter.greeting, Decl(sourceMapValidationClasses.ts, 4, 20)) } greet() { ->greet : Symbol(greet, Decl(sourceMapValidationClasses.ts, 5, 9)) +>greet : Symbol(Greeter.greet, Decl(sourceMapValidationClasses.ts, 5, 9)) return "

" + this.greeting + "

"; ->this.greeting : Symbol(greeting, Decl(sourceMapValidationClasses.ts, 4, 20)) +>this.greeting : Symbol(Greeter.greeting, Decl(sourceMapValidationClasses.ts, 4, 20)) >this : Symbol(Greeter, Decl(sourceMapValidationClasses.ts, 1, 17)) ->greeting : Symbol(greeting, Decl(sourceMapValidationClasses.ts, 4, 20)) +>greeting : Symbol(Greeter.greeting, Decl(sourceMapValidationClasses.ts, 4, 20)) } } diff --git a/tests/baselines/reference/sourceMapValidationDecorators.symbols b/tests/baselines/reference/sourceMapValidationDecorators.symbols index 90204d0b71f..72e47dabe0b 100644 --- a/tests/baselines/reference/sourceMapValidationDecorators.symbols +++ b/tests/baselines/reference/sourceMapValidationDecorators.symbols @@ -59,7 +59,7 @@ class Greeter { >ParameterDecorator2 : Symbol(ParameterDecorator2, Decl(sourceMapValidationDecorators.ts, 4, 101)) public greeting: string, ->greeting : Symbol(greeting, Decl(sourceMapValidationDecorators.ts, 10, 16)) +>greeting : Symbol(Greeter.greeting, Decl(sourceMapValidationDecorators.ts, 10, 16)) @ParameterDecorator1 >ParameterDecorator1 : Symbol(ParameterDecorator1, Decl(sourceMapValidationDecorators.ts, 3, 128)) @@ -78,12 +78,12 @@ class Greeter { >PropertyDecorator2 : Symbol(PropertyDecorator2, Decl(sourceMapValidationDecorators.ts, 2, 113)) greet() { ->greet : Symbol(greet, Decl(sourceMapValidationDecorators.ts, 18, 5)) +>greet : Symbol(Greeter.greet, Decl(sourceMapValidationDecorators.ts, 18, 5)) return "

" + this.greeting + "

"; ->this.greeting : Symbol(greeting, Decl(sourceMapValidationDecorators.ts, 10, 16)) +>this.greeting : Symbol(Greeter.greeting, Decl(sourceMapValidationDecorators.ts, 10, 16)) >this : Symbol(Greeter, Decl(sourceMapValidationDecorators.ts, 5, 116)) ->greeting : Symbol(greeting, Decl(sourceMapValidationDecorators.ts, 10, 16)) +>greeting : Symbol(Greeter.greeting, Decl(sourceMapValidationDecorators.ts, 10, 16)) } @PropertyDecorator1 @@ -93,7 +93,7 @@ class Greeter { >PropertyDecorator2 : Symbol(PropertyDecorator2, Decl(sourceMapValidationDecorators.ts, 2, 113)) private x: string; ->x : Symbol(x, Decl(sourceMapValidationDecorators.ts, 24, 5)) +>x : Symbol(Greeter.x, Decl(sourceMapValidationDecorators.ts, 24, 5)) @PropertyDecorator1 >PropertyDecorator1 : Symbol(PropertyDecorator1, Decl(sourceMapValidationDecorators.ts, 1, 72)) @@ -105,7 +105,7 @@ class Greeter { >x1 : Symbol(Greeter.x1, Decl(sourceMapValidationDecorators.ts, 28, 22)) private fn( ->fn : Symbol(fn, Decl(sourceMapValidationDecorators.ts, 32, 35)) +>fn : Symbol(Greeter.fn, Decl(sourceMapValidationDecorators.ts, 32, 35)) @ParameterDecorator1 >ParameterDecorator1 : Symbol(ParameterDecorator1, Decl(sourceMapValidationDecorators.ts, 3, 128)) @@ -117,9 +117,9 @@ class Greeter { >x : Symbol(x, Decl(sourceMapValidationDecorators.ts, 34, 15)) return this.greeting; ->this.greeting : Symbol(greeting, Decl(sourceMapValidationDecorators.ts, 10, 16)) +>this.greeting : Symbol(Greeter.greeting, Decl(sourceMapValidationDecorators.ts, 10, 16)) >this : Symbol(Greeter, Decl(sourceMapValidationDecorators.ts, 5, 116)) ->greeting : Symbol(greeting, Decl(sourceMapValidationDecorators.ts, 10, 16)) +>greeting : Symbol(Greeter.greeting, Decl(sourceMapValidationDecorators.ts, 10, 16)) } @PropertyDecorator1 @@ -129,16 +129,16 @@ class Greeter { >PropertyDecorator2 : Symbol(PropertyDecorator2, Decl(sourceMapValidationDecorators.ts, 2, 113)) get greetings() { ->greetings : Symbol(greetings, Decl(sourceMapValidationDecorators.ts, 39, 5), Decl(sourceMapValidationDecorators.ts, 45, 5)) +>greetings : Symbol(Greeter.greetings, Decl(sourceMapValidationDecorators.ts, 39, 5), Decl(sourceMapValidationDecorators.ts, 45, 5)) return this.greeting; ->this.greeting : Symbol(greeting, Decl(sourceMapValidationDecorators.ts, 10, 16)) +>this.greeting : Symbol(Greeter.greeting, Decl(sourceMapValidationDecorators.ts, 10, 16)) >this : Symbol(Greeter, Decl(sourceMapValidationDecorators.ts, 5, 116)) ->greeting : Symbol(greeting, Decl(sourceMapValidationDecorators.ts, 10, 16)) +>greeting : Symbol(Greeter.greeting, Decl(sourceMapValidationDecorators.ts, 10, 16)) } set greetings( ->greetings : Symbol(greetings, Decl(sourceMapValidationDecorators.ts, 39, 5), Decl(sourceMapValidationDecorators.ts, 45, 5)) +>greetings : Symbol(Greeter.greetings, Decl(sourceMapValidationDecorators.ts, 39, 5), Decl(sourceMapValidationDecorators.ts, 45, 5)) @ParameterDecorator1 >ParameterDecorator1 : Symbol(ParameterDecorator1, Decl(sourceMapValidationDecorators.ts, 3, 128)) @@ -150,9 +150,9 @@ class Greeter { >greetings : Symbol(greetings, Decl(sourceMapValidationDecorators.ts, 47, 18)) this.greeting = greetings; ->this.greeting : Symbol(greeting, Decl(sourceMapValidationDecorators.ts, 10, 16)) +>this.greeting : Symbol(Greeter.greeting, Decl(sourceMapValidationDecorators.ts, 10, 16)) >this : Symbol(Greeter, Decl(sourceMapValidationDecorators.ts, 5, 116)) ->greeting : Symbol(greeting, Decl(sourceMapValidationDecorators.ts, 10, 16)) +>greeting : Symbol(Greeter.greeting, Decl(sourceMapValidationDecorators.ts, 10, 16)) >greetings : Symbol(greetings, Decl(sourceMapValidationDecorators.ts, 47, 18)) } } diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPattern.js b/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPattern.js new file mode 100644 index 00000000000..407af9c08a0 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPattern.js @@ -0,0 +1,177 @@ +//// [sourceMapValidationDestructuringForArrayBindingPattern.ts] +declare var console: { + log(msg: any): void; +} +type Robot = [number, string, string]; +type MultiSkilledRobot = [string, [string, string]]; + +let robotA: Robot = [1, "mower", "mowing"]; +function getRobot() { + return robotA; +} + +let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; +let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; +function getMultiRobot() { + return multiRobotA; +} + +for (let [, nameA] = robotA, i = 0; i < 1; i++) { + console.log(nameA); +} +for (let [, nameA] = getRobot(), i = 0; i < 1; i++) { + console.log(nameA); +} +for (let [, nameA] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + console.log(nameA); +} +for (let [, [primarySkillA, secondarySkillA]] = multiRobotA, i = 0; i < 1; i++) { + console.log(primarySkillA); +} +for (let [, [primarySkillA, secondarySkillA]] = getMultiRobot(), i = 0; i < 1; i++) { + console.log(primarySkillA); +} +for (let [, [primarySkillA, secondarySkillA]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + console.log(primarySkillA); +} + +for (let [numberB] = robotA, i = 0; i < 1; i++) { + console.log(numberB); +} +for (let [numberB] = getRobot(), i = 0; i < 1; i++) { + console.log(numberB); +} +for (let [numberB] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + console.log(numberB); +} +for (let [nameB] = multiRobotA, i = 0; i < 1; i++) { + console.log(nameB); +} +for (let [nameB] = getMultiRobot(), i = 0; i < 1; i++) { + console.log(nameB); +} +for (let [nameB] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + console.log(nameB); +} + +for (let [numberA2, nameA2, skillA2] = robotA, i = 0; i < 1; i++) { + console.log(nameA2); +} +for (let [numberA2, nameA2, skillA2] = getRobot(), i = 0; i < 1; i++) { + console.log(nameA2); +} +for (let [numberA2, nameA2, skillA2] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + console.log(nameA2); +} +for (let [nameMA, [primarySkillA, secondarySkillA]] = multiRobotA, i = 0; i < 1; i++) { + console.log(nameMA); +} +for (let [nameMA, [primarySkillA, secondarySkillA]] = getMultiRobot(), i = 0; i < 1; i++) { + console.log(nameMA); +} +for (let [nameMA, [primarySkillA, secondarySkillA]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + console.log(nameMA); +} + +for (let [numberA3, ...robotAInfo] = robotA, i = 0; i < 1; i++) { + console.log(numberA3); +} +for (let [numberA3, ...robotAInfo] = getRobot(), i = 0; i < 1; i++) { + console.log(numberA3); +} +for (let [numberA3, ...robotAInfo] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + console.log(numberA3); +} +for (let [...multiRobotAInfo] = multiRobotA, i = 0; i < 1; i++) { + console.log(multiRobotAInfo); +} +for (let [...multiRobotAInfo] = getMultiRobot(), i = 0; i < 1; i++) { + console.log(multiRobotAInfo); +} +for (let [...multiRobotAInfo] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + console.log(multiRobotAInfo); +} + +//// [sourceMapValidationDestructuringForArrayBindingPattern.js] +var robotA = [1, "mower", "mowing"]; +function getRobot() { + return robotA; +} +var multiRobotA = ["mower", ["mowing", ""]]; +var multiRobotB = ["trimmer", ["trimming", "edging"]]; +function getMultiRobot() { + return multiRobotA; +} +for (var nameA = robotA[1], i = 0; i < 1; i++) { + console.log(nameA); +} +for (var _a = getRobot(), nameA = _a[1], i = 0; i < 1; i++) { + console.log(nameA); +} +for (var _b = [2, "trimmer", "trimming"], nameA = _b[1], i = 0; i < 1; i++) { + console.log(nameA); +} +for (var _c = multiRobotA[1], primarySkillA = _c[0], secondarySkillA = _c[1], i = 0; i < 1; i++) { + console.log(primarySkillA); +} +for (var _d = getMultiRobot(), _e = _d[1], primarySkillA = _e[0], secondarySkillA = _e[1], i = 0; i < 1; i++) { + console.log(primarySkillA); +} +for (var _f = ["trimmer", ["trimming", "edging"]], _g = _f[1], primarySkillA = _g[0], secondarySkillA = _g[1], i = 0; i < 1; i++) { + console.log(primarySkillA); +} +for (var numberB = robotA[0], i = 0; i < 1; i++) { + console.log(numberB); +} +for (var numberB = getRobot()[0], i = 0; i < 1; i++) { + console.log(numberB); +} +for (var numberB = [2, "trimmer", "trimming"][0], i = 0; i < 1; i++) { + console.log(numberB); +} +for (var nameB = multiRobotA[0], i = 0; i < 1; i++) { + console.log(nameB); +} +for (var nameB = getMultiRobot()[0], i = 0; i < 1; i++) { + console.log(nameB); +} +for (var nameB = ["trimmer", ["trimming", "edging"]][0], i = 0; i < 1; i++) { + console.log(nameB); +} +for (var numberA2 = robotA[0], nameA2 = robotA[1], skillA2 = robotA[2], i = 0; i < 1; i++) { + console.log(nameA2); +} +for (var _h = getRobot(), numberA2 = _h[0], nameA2 = _h[1], skillA2 = _h[2], i = 0; i < 1; i++) { + console.log(nameA2); +} +for (var _j = [2, "trimmer", "trimming"], numberA2 = _j[0], nameA2 = _j[1], skillA2 = _j[2], i = 0; i < 1; i++) { + console.log(nameA2); +} +for (var nameMA = multiRobotA[0], _k = multiRobotA[1], primarySkillA = _k[0], secondarySkillA = _k[1], i = 0; i < 1; i++) { + console.log(nameMA); +} +for (var _l = getMultiRobot(), nameMA = _l[0], _m = _l[1], primarySkillA = _m[0], secondarySkillA = _m[1], i = 0; i < 1; i++) { + console.log(nameMA); +} +for (var _o = ["trimmer", ["trimming", "edging"]], nameMA = _o[0], _p = _o[1], primarySkillA = _p[0], secondarySkillA = _p[1], i = 0; i < 1; i++) { + console.log(nameMA); +} +for (var numberA3 = robotA[0], robotAInfo = robotA.slice(1), i = 0; i < 1; i++) { + console.log(numberA3); +} +for (var _q = getRobot(), numberA3 = _q[0], robotAInfo = _q.slice(1), i = 0; i < 1; i++) { + console.log(numberA3); +} +for (var _r = [2, "trimmer", "trimming"], numberA3 = _r[0], robotAInfo = _r.slice(1), i = 0; i < 1; i++) { + console.log(numberA3); +} +for (var multiRobotAInfo = multiRobotA.slice(0), i = 0; i < 1; i++) { + console.log(multiRobotAInfo); +} +for (var multiRobotAInfo = getMultiRobot().slice(0), i = 0; i < 1; i++) { + console.log(multiRobotAInfo); +} +for (var multiRobotAInfo = ["trimmer", ["trimming", "edging"]].slice(0), i = 0; i < 1; i++) { + console.log(multiRobotAInfo); +} +//# sourceMappingURL=sourceMapValidationDestructuringForArrayBindingPattern.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPattern.js.map b/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPattern.js.map new file mode 100644 index 00000000000..0ee4a2092e7 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPattern.js.map @@ -0,0 +1,2 @@ +//// [sourceMapValidationDestructuringForArrayBindingPattern.js.map] +{"version":3,"file":"sourceMapValidationDestructuringForArrayBindingPattern.js","sourceRoot":"","sources":["sourceMapValidationDestructuringForArrayBindingPattern.ts"],"names":[],"mappings":"AAMA,IAAI,MAAM,GAAU,CAAC,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;AAC3C;IACI,MAAM,CAAC,MAAM,CAAC;AAClB,CAAC;AAED,IAAI,WAAW,GAAsB,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC;AAC/D,IAAI,WAAW,GAAsB,CAAC,SAAS,EAAE,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC,CAAC;AACzE;IACI,MAAM,CAAC,WAAW,CAAC;AACvB,CAAC;AAED,GAAG,CAAC,CAAQ,qBAAK,EAAY,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IAC7C,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AACD,GAAG,CAAC,CAAC,IAAA,eAA0B,EAAnB,aAAK,EAAgB,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACjD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AACD,GAAG,CAAC,CAAC,IAAA,+BAA0C,EAAnC,aAAK,EAAgC,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACjE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AACD,GAAG,CAAC,CAAQ,uBAAgC,EAA/B,qBAAa,EAAE,uBAAe,EAAkB,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IAC7E,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;AAC/B,CAAC;AACD,GAAG,CAAC,CAAC,IAAA,oBAA0D,EAAnD,UAAgC,EAA/B,qBAAa,EAAE,uBAAe,EAAsB,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACjF,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;AAC/B,CAAC;AACD,GAAG,CAAC,CAAC,IAAA,wCAA8E,EAAvE,UAAgC,EAA/B,qBAAa,EAAE,uBAAe,EAA0C,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACrG,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;AAC/B,CAAC;AAED,GAAG,CAAC,CAAM,uBAAO,EAAY,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IAC7C,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AACzB,CAAC;AACD,GAAG,CAAC,CAAM,2BAAO,EAAgB,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACjD,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AACzB,CAAC;AACD,GAAG,CAAC,CAAM,2CAAO,EAAgC,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACjE,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AACzB,CAAC;AACD,GAAG,CAAC,CAAM,0BAAK,EAAiB,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IAChD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AACD,GAAG,CAAC,CAAM,8BAAK,EAAqB,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACpD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AACD,GAAG,CAAC,CAAM,kDAAK,EAAyC,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACxE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AAED,GAAG,CAAC,CAAM,wBAAQ,EAAE,kBAAM,EAAE,mBAAO,EAAY,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IAC/D,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACxB,CAAC;AACD,GAAG,CAAC,CAAC,IAAA,eAA4C,EAAvC,gBAAQ,EAAE,cAAM,EAAE,eAAO,EAAgB,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACnE,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACxB,CAAC;AACD,GAAG,CAAC,CAAC,IAAA,+BAA4D,EAAvD,gBAAQ,EAAE,cAAM,EAAE,eAAO,EAAgC,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACnF,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACxB,CAAC;AACD,GAAG,CAAC,CAAM,2BAAM,EAAE,mBAAgC,EAA/B,qBAAa,EAAE,uBAAe,EAAkB,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACnF,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACxB,CAAC;AACD,GAAG,CAAC,CAAC,IAAA,oBAAgE,EAA3D,cAAM,EAAE,UAAgC,EAA/B,qBAAa,EAAE,uBAAe,EAAsB,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACvF,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACxB,CAAC;AACD,GAAG,CAAC,CAAC,IAAA,wCAAoF,EAA/E,cAAM,EAAE,UAAgC,EAA/B,qBAAa,EAAE,uBAAe,EAA0C,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IAC3G,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACxB,CAAC;AAED,GAAG,CAAC,CAAM,wBAAQ,EAAE,4BAAa,EAAY,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IAC7D,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAC1B,CAAC;AACD,GAAG,CAAC,CAAC,IAAA,eAA0C,EAArC,gBAAQ,EAAE,wBAAa,EAAgB,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACjE,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAC1B,CAAC;AACD,GAAG,CAAC,CAAC,IAAA,+BAA0D,EAArD,gBAAQ,EAAE,wBAAa,EAAgC,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACjF,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAC1B,CAAC;AACD,GAAG,CAAC,CAAM,0CAAkB,EAAiB,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IAC7D,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;AACjC,CAAC;AACD,GAAG,CAAC,CAAM,8CAAkB,EAAqB,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACjE,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;AACjC,CAAC;AACD,GAAG,CAAC,CAAM,kEAAkB,EAAyC,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACrF,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;AACjC,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPattern.sourcemap.txt b/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPattern.sourcemap.txt new file mode 100644 index 00000000000..e7ee5c01f2c --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPattern.sourcemap.txt @@ -0,0 +1,2711 @@ +=================================================================== +JsFile: sourceMapValidationDestructuringForArrayBindingPattern.js +mapUrl: sourceMapValidationDestructuringForArrayBindingPattern.js.map +sourceRoot: +sources: sourceMapValidationDestructuringForArrayBindingPattern.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/sourceMapValidationDestructuringForArrayBindingPattern.js +sourceFile:sourceMapValidationDestructuringForArrayBindingPattern.ts +------------------------------------------------------------------- +>>>var robotA = [1, "mower", "mowing"]; +1 > +2 >^^^^ +3 > ^^^^^^ +4 > ^^^ +5 > ^ +6 > ^ +7 > ^^ +8 > ^^^^^^^ +9 > ^^ +10> ^^^^^^^^ +11> ^ +12> ^ +1 >declare var console: { + > log(msg: any): void; + >} + >type Robot = [number, string, string]; + >type MultiSkilledRobot = [string, [string, string]]; + > + > +2 >let +3 > robotA +4 > : Robot = +5 > [ +6 > 1 +7 > , +8 > "mower" +9 > , +10> "mowing" +11> ] +12> ; +1 >Emitted(1, 1) Source(7, 1) + SourceIndex(0) +2 >Emitted(1, 5) Source(7, 5) + SourceIndex(0) +3 >Emitted(1, 11) Source(7, 11) + SourceIndex(0) +4 >Emitted(1, 14) Source(7, 21) + SourceIndex(0) +5 >Emitted(1, 15) Source(7, 22) + SourceIndex(0) +6 >Emitted(1, 16) Source(7, 23) + SourceIndex(0) +7 >Emitted(1, 18) Source(7, 25) + SourceIndex(0) +8 >Emitted(1, 25) Source(7, 32) + SourceIndex(0) +9 >Emitted(1, 27) Source(7, 34) + SourceIndex(0) +10>Emitted(1, 35) Source(7, 42) + SourceIndex(0) +11>Emitted(1, 36) Source(7, 43) + SourceIndex(0) +12>Emitted(1, 37) Source(7, 44) + SourceIndex(0) +--- +>>>function getRobot() { +1 > +2 >^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(2, 1) Source(8, 1) + SourceIndex(0) +--- +>>> return robotA; +1->^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^ +5 > ^ +1->function getRobot() { + > +2 > return +3 > +4 > robotA +5 > ; +1->Emitted(3, 5) Source(9, 5) + SourceIndex(0) +2 >Emitted(3, 11) Source(9, 11) + SourceIndex(0) +3 >Emitted(3, 12) Source(9, 12) + SourceIndex(0) +4 >Emitted(3, 18) Source(9, 18) + SourceIndex(0) +5 >Emitted(3, 19) Source(9, 19) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(4, 1) Source(10, 1) + SourceIndex(0) +2 >Emitted(4, 2) Source(10, 2) + SourceIndex(0) +--- +>>>var multiRobotA = ["mower", ["mowing", ""]]; +1-> +2 >^^^^ +3 > ^^^^^^^^^^^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^ +7 > ^^ +8 > ^ +9 > ^^^^^^^^ +10> ^^ +11> ^^ +12> ^ +13> ^ +14> ^ +15> ^^^^^^^^^^^-> +1-> + > + > +2 >let +3 > multiRobotA +4 > : MultiSkilledRobot = +5 > [ +6 > "mower" +7 > , +8 > [ +9 > "mowing" +10> , +11> "" +12> ] +13> ] +14> ; +1->Emitted(5, 1) Source(12, 1) + SourceIndex(0) +2 >Emitted(5, 5) Source(12, 5) + SourceIndex(0) +3 >Emitted(5, 16) Source(12, 16) + SourceIndex(0) +4 >Emitted(5, 19) Source(12, 38) + SourceIndex(0) +5 >Emitted(5, 20) Source(12, 39) + SourceIndex(0) +6 >Emitted(5, 27) Source(12, 46) + SourceIndex(0) +7 >Emitted(5, 29) Source(12, 48) + SourceIndex(0) +8 >Emitted(5, 30) Source(12, 49) + SourceIndex(0) +9 >Emitted(5, 38) Source(12, 57) + SourceIndex(0) +10>Emitted(5, 40) Source(12, 59) + SourceIndex(0) +11>Emitted(5, 42) Source(12, 61) + SourceIndex(0) +12>Emitted(5, 43) Source(12, 62) + SourceIndex(0) +13>Emitted(5, 44) Source(12, 63) + SourceIndex(0) +14>Emitted(5, 45) Source(12, 64) + SourceIndex(0) +--- +>>>var multiRobotB = ["trimmer", ["trimming", "edging"]]; +1-> +2 >^^^^ +3 > ^^^^^^^^^^^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^^ +7 > ^^ +8 > ^ +9 > ^^^^^^^^^^ +10> ^^ +11> ^^^^^^^^ +12> ^ +13> ^ +14> ^ +1-> + > +2 >let +3 > multiRobotB +4 > : MultiSkilledRobot = +5 > [ +6 > "trimmer" +7 > , +8 > [ +9 > "trimming" +10> , +11> "edging" +12> ] +13> ] +14> ; +1->Emitted(6, 1) Source(13, 1) + SourceIndex(0) +2 >Emitted(6, 5) Source(13, 5) + SourceIndex(0) +3 >Emitted(6, 16) Source(13, 16) + SourceIndex(0) +4 >Emitted(6, 19) Source(13, 38) + SourceIndex(0) +5 >Emitted(6, 20) Source(13, 39) + SourceIndex(0) +6 >Emitted(6, 29) Source(13, 48) + SourceIndex(0) +7 >Emitted(6, 31) Source(13, 50) + SourceIndex(0) +8 >Emitted(6, 32) Source(13, 51) + SourceIndex(0) +9 >Emitted(6, 42) Source(13, 61) + SourceIndex(0) +10>Emitted(6, 44) Source(13, 63) + SourceIndex(0) +11>Emitted(6, 52) Source(13, 71) + SourceIndex(0) +12>Emitted(6, 53) Source(13, 72) + SourceIndex(0) +13>Emitted(6, 54) Source(13, 73) + SourceIndex(0) +14>Emitted(6, 55) Source(13, 74) + SourceIndex(0) +--- +>>>function getMultiRobot() { +1 > +2 >^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(7, 1) Source(14, 1) + SourceIndex(0) +--- +>>> return multiRobotA; +1->^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^ +5 > ^ +1->function getMultiRobot() { + > +2 > return +3 > +4 > multiRobotA +5 > ; +1->Emitted(8, 5) Source(15, 5) + SourceIndex(0) +2 >Emitted(8, 11) Source(15, 11) + SourceIndex(0) +3 >Emitted(8, 12) Source(15, 12) + SourceIndex(0) +4 >Emitted(8, 23) Source(15, 23) + SourceIndex(0) +5 >Emitted(8, 24) Source(15, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(9, 1) Source(16, 1) + SourceIndex(0) +2 >Emitted(9, 2) Source(16, 2) + SourceIndex(0) +--- +>>>for (var nameA = robotA[1], i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^^^^^^^^^^^ +6 > ^^ +7 > ^ +8 > ^^^ +9 > ^ +10> ^^ +11> ^ +12> ^^^ +13> ^ +14> ^^ +15> ^ +16> ^^ +17> ^^ +18> ^ +1-> + > + > +2 >for +3 > +4 > (let [, +5 > nameA +6 > ] = robotA, +7 > i +8 > = +9 > 0 +10> ; +11> i +12> < +13> 1 +14> ; +15> i +16> ++ +17> ) +18> { +1->Emitted(10, 1) Source(18, 1) + SourceIndex(0) +2 >Emitted(10, 4) Source(18, 4) + SourceIndex(0) +3 >Emitted(10, 5) Source(18, 5) + SourceIndex(0) +4 >Emitted(10, 6) Source(18, 13) + SourceIndex(0) +5 >Emitted(10, 27) Source(18, 18) + SourceIndex(0) +6 >Emitted(10, 29) Source(18, 30) + SourceIndex(0) +7 >Emitted(10, 30) Source(18, 31) + SourceIndex(0) +8 >Emitted(10, 33) Source(18, 34) + SourceIndex(0) +9 >Emitted(10, 34) Source(18, 35) + SourceIndex(0) +10>Emitted(10, 36) Source(18, 37) + SourceIndex(0) +11>Emitted(10, 37) Source(18, 38) + SourceIndex(0) +12>Emitted(10, 40) Source(18, 41) + SourceIndex(0) +13>Emitted(10, 41) Source(18, 42) + SourceIndex(0) +14>Emitted(10, 43) Source(18, 44) + SourceIndex(0) +15>Emitted(10, 44) Source(18, 45) + SourceIndex(0) +16>Emitted(10, 46) Source(18, 47) + SourceIndex(0) +17>Emitted(10, 48) Source(18, 49) + SourceIndex(0) +18>Emitted(10, 49) Source(18, 50) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(11, 5) Source(19, 5) + SourceIndex(0) +2 >Emitted(11, 12) Source(19, 12) + SourceIndex(0) +3 >Emitted(11, 13) Source(19, 13) + SourceIndex(0) +4 >Emitted(11, 16) Source(19, 16) + SourceIndex(0) +5 >Emitted(11, 17) Source(19, 17) + SourceIndex(0) +6 >Emitted(11, 22) Source(19, 22) + SourceIndex(0) +7 >Emitted(11, 23) Source(19, 23) + SourceIndex(0) +8 >Emitted(11, 24) Source(19, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(12, 1) Source(20, 1) + SourceIndex(0) +2 >Emitted(12, 2) Source(20, 2) + SourceIndex(0) +--- +>>>for (var _a = getRobot(), nameA = _a[1], i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^ +6 > ^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^ +9 > ^^ +10> ^ +11> ^^^ +12> ^ +13> ^^ +14> ^ +15> ^^^ +16> ^ +17> ^^ +18> ^ +19> ^^ +20> ^^ +21> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > let [, nameA] = getRobot() +7 > +8 > nameA +9 > ] = getRobot(), +10> i +11> = +12> 0 +13> ; +14> i +15> < +16> 1 +17> ; +18> i +19> ++ +20> ) +21> { +1->Emitted(13, 1) Source(21, 1) + SourceIndex(0) +2 >Emitted(13, 4) Source(21, 4) + SourceIndex(0) +3 >Emitted(13, 5) Source(21, 5) + SourceIndex(0) +4 >Emitted(13, 6) Source(21, 6) + SourceIndex(0) +5 >Emitted(13, 10) Source(21, 6) + SourceIndex(0) +6 >Emitted(13, 25) Source(21, 32) + SourceIndex(0) +7 >Emitted(13, 27) Source(21, 13) + SourceIndex(0) +8 >Emitted(13, 40) Source(21, 18) + SourceIndex(0) +9 >Emitted(13, 42) Source(21, 34) + SourceIndex(0) +10>Emitted(13, 43) Source(21, 35) + SourceIndex(0) +11>Emitted(13, 46) Source(21, 38) + SourceIndex(0) +12>Emitted(13, 47) Source(21, 39) + SourceIndex(0) +13>Emitted(13, 49) Source(21, 41) + SourceIndex(0) +14>Emitted(13, 50) Source(21, 42) + SourceIndex(0) +15>Emitted(13, 53) Source(21, 45) + SourceIndex(0) +16>Emitted(13, 54) Source(21, 46) + SourceIndex(0) +17>Emitted(13, 56) Source(21, 48) + SourceIndex(0) +18>Emitted(13, 57) Source(21, 49) + SourceIndex(0) +19>Emitted(13, 59) Source(21, 51) + SourceIndex(0) +20>Emitted(13, 61) Source(21, 53) + SourceIndex(0) +21>Emitted(13, 62) Source(21, 54) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(14, 5) Source(22, 5) + SourceIndex(0) +2 >Emitted(14, 12) Source(22, 12) + SourceIndex(0) +3 >Emitted(14, 13) Source(22, 13) + SourceIndex(0) +4 >Emitted(14, 16) Source(22, 16) + SourceIndex(0) +5 >Emitted(14, 17) Source(22, 17) + SourceIndex(0) +6 >Emitted(14, 22) Source(22, 22) + SourceIndex(0) +7 >Emitted(14, 23) Source(22, 23) + SourceIndex(0) +8 >Emitted(14, 24) Source(22, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(15, 1) Source(23, 1) + SourceIndex(0) +2 >Emitted(15, 2) Source(23, 2) + SourceIndex(0) +--- +>>>for (var _b = [2, "trimmer", "trimming"], nameA = _b[1], i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^ +9 > ^^ +10> ^ +11> ^^^ +12> ^ +13> ^^ +14> ^ +15> ^^^ +16> ^ +17> ^^ +18> ^ +19> ^^ +20> ^^ +21> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > let [, nameA] = [2, "trimmer", "trimming"] +7 > +8 > nameA +9 > ] = [2, "trimmer", "trimming"], +10> i +11> = +12> 0 +13> ; +14> i +15> < +16> 1 +17> ; +18> i +19> ++ +20> ) +21> { +1->Emitted(16, 1) Source(24, 1) + SourceIndex(0) +2 >Emitted(16, 4) Source(24, 4) + SourceIndex(0) +3 >Emitted(16, 5) Source(24, 5) + SourceIndex(0) +4 >Emitted(16, 6) Source(24, 6) + SourceIndex(0) +5 >Emitted(16, 10) Source(24, 6) + SourceIndex(0) +6 >Emitted(16, 41) Source(24, 48) + SourceIndex(0) +7 >Emitted(16, 43) Source(24, 13) + SourceIndex(0) +8 >Emitted(16, 56) Source(24, 18) + SourceIndex(0) +9 >Emitted(16, 58) Source(24, 50) + SourceIndex(0) +10>Emitted(16, 59) Source(24, 51) + SourceIndex(0) +11>Emitted(16, 62) Source(24, 54) + SourceIndex(0) +12>Emitted(16, 63) Source(24, 55) + SourceIndex(0) +13>Emitted(16, 65) Source(24, 57) + SourceIndex(0) +14>Emitted(16, 66) Source(24, 58) + SourceIndex(0) +15>Emitted(16, 69) Source(24, 61) + SourceIndex(0) +16>Emitted(16, 70) Source(24, 62) + SourceIndex(0) +17>Emitted(16, 72) Source(24, 64) + SourceIndex(0) +18>Emitted(16, 73) Source(24, 65) + SourceIndex(0) +19>Emitted(16, 75) Source(24, 67) + SourceIndex(0) +20>Emitted(16, 77) Source(24, 69) + SourceIndex(0) +21>Emitted(16, 78) Source(24, 70) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(17, 5) Source(25, 5) + SourceIndex(0) +2 >Emitted(17, 12) Source(25, 12) + SourceIndex(0) +3 >Emitted(17, 13) Source(25, 13) + SourceIndex(0) +4 >Emitted(17, 16) Source(25, 16) + SourceIndex(0) +5 >Emitted(17, 17) Source(25, 17) + SourceIndex(0) +6 >Emitted(17, 22) Source(25, 22) + SourceIndex(0) +7 >Emitted(17, 23) Source(25, 23) + SourceIndex(0) +8 >Emitted(17, 24) Source(25, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(18, 1) Source(26, 1) + SourceIndex(0) +2 >Emitted(18, 2) Source(26, 2) + SourceIndex(0) +--- +>>>for (var _c = multiRobotA[1], primarySkillA = _c[0], secondarySkillA = _c[1], i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^^^^^^^^^ +10> ^^ +11> ^ +12> ^^^ +13> ^ +14> ^^ +15> ^ +16> ^^^ +17> ^ +18> ^^ +19> ^ +20> ^^ +21> ^^ +22> ^ +1-> + > +2 >for +3 > +4 > (let [, +5 > [primarySkillA, secondarySkillA] +6 > +7 > primarySkillA +8 > , +9 > secondarySkillA +10> ]] = multiRobotA, +11> i +12> = +13> 0 +14> ; +15> i +16> < +17> 1 +18> ; +19> i +20> ++ +21> ) +22> { +1->Emitted(19, 1) Source(27, 1) + SourceIndex(0) +2 >Emitted(19, 4) Source(27, 4) + SourceIndex(0) +3 >Emitted(19, 5) Source(27, 5) + SourceIndex(0) +4 >Emitted(19, 6) Source(27, 13) + SourceIndex(0) +5 >Emitted(19, 29) Source(27, 45) + SourceIndex(0) +6 >Emitted(19, 31) Source(27, 14) + SourceIndex(0) +7 >Emitted(19, 52) Source(27, 27) + SourceIndex(0) +8 >Emitted(19, 54) Source(27, 29) + SourceIndex(0) +9 >Emitted(19, 77) Source(27, 44) + SourceIndex(0) +10>Emitted(19, 79) Source(27, 62) + SourceIndex(0) +11>Emitted(19, 80) Source(27, 63) + SourceIndex(0) +12>Emitted(19, 83) Source(27, 66) + SourceIndex(0) +13>Emitted(19, 84) Source(27, 67) + SourceIndex(0) +14>Emitted(19, 86) Source(27, 69) + SourceIndex(0) +15>Emitted(19, 87) Source(27, 70) + SourceIndex(0) +16>Emitted(19, 90) Source(27, 73) + SourceIndex(0) +17>Emitted(19, 91) Source(27, 74) + SourceIndex(0) +18>Emitted(19, 93) Source(27, 76) + SourceIndex(0) +19>Emitted(19, 94) Source(27, 77) + SourceIndex(0) +20>Emitted(19, 96) Source(27, 79) + SourceIndex(0) +21>Emitted(19, 98) Source(27, 81) + SourceIndex(0) +22>Emitted(19, 99) Source(27, 82) + SourceIndex(0) +--- +>>> console.log(primarySkillA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > primarySkillA +7 > ) +8 > ; +1 >Emitted(20, 5) Source(28, 5) + SourceIndex(0) +2 >Emitted(20, 12) Source(28, 12) + SourceIndex(0) +3 >Emitted(20, 13) Source(28, 13) + SourceIndex(0) +4 >Emitted(20, 16) Source(28, 16) + SourceIndex(0) +5 >Emitted(20, 17) Source(28, 17) + SourceIndex(0) +6 >Emitted(20, 30) Source(28, 30) + SourceIndex(0) +7 >Emitted(20, 31) Source(28, 31) + SourceIndex(0) +8 >Emitted(20, 32) Source(28, 32) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(21, 1) Source(29, 1) + SourceIndex(0) +2 >Emitted(21, 2) Source(29, 2) + SourceIndex(0) +--- +>>>for (var _d = getMultiRobot(), _e = _d[1], primarySkillA = _e[0], secondarySkillA = _e[1], i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^ +6 > ^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^^^^^^^^^ +13> ^^ +14> ^ +15> ^^^ +16> ^ +17> ^^ +18> ^ +19> ^^^ +20> ^ +21> ^^ +22> ^ +23> ^^ +24> ^^ +25> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > let [, [primarySkillA, secondarySkillA]] = getMultiRobot() +7 > +8 > [primarySkillA, secondarySkillA] +9 > +10> primarySkillA +11> , +12> secondarySkillA +13> ]] = getMultiRobot(), +14> i +15> = +16> 0 +17> ; +18> i +19> < +20> 1 +21> ; +22> i +23> ++ +24> ) +25> { +1->Emitted(22, 1) Source(30, 1) + SourceIndex(0) +2 >Emitted(22, 4) Source(30, 4) + SourceIndex(0) +3 >Emitted(22, 5) Source(30, 5) + SourceIndex(0) +4 >Emitted(22, 6) Source(30, 6) + SourceIndex(0) +5 >Emitted(22, 10) Source(30, 6) + SourceIndex(0) +6 >Emitted(22, 30) Source(30, 64) + SourceIndex(0) +7 >Emitted(22, 32) Source(30, 13) + SourceIndex(0) +8 >Emitted(22, 42) Source(30, 45) + SourceIndex(0) +9 >Emitted(22, 44) Source(30, 14) + SourceIndex(0) +10>Emitted(22, 65) Source(30, 27) + SourceIndex(0) +11>Emitted(22, 67) Source(30, 29) + SourceIndex(0) +12>Emitted(22, 90) Source(30, 44) + SourceIndex(0) +13>Emitted(22, 92) Source(30, 66) + SourceIndex(0) +14>Emitted(22, 93) Source(30, 67) + SourceIndex(0) +15>Emitted(22, 96) Source(30, 70) + SourceIndex(0) +16>Emitted(22, 97) Source(30, 71) + SourceIndex(0) +17>Emitted(22, 99) Source(30, 73) + SourceIndex(0) +18>Emitted(22, 100) Source(30, 74) + SourceIndex(0) +19>Emitted(22, 103) Source(30, 77) + SourceIndex(0) +20>Emitted(22, 104) Source(30, 78) + SourceIndex(0) +21>Emitted(22, 106) Source(30, 80) + SourceIndex(0) +22>Emitted(22, 107) Source(30, 81) + SourceIndex(0) +23>Emitted(22, 109) Source(30, 83) + SourceIndex(0) +24>Emitted(22, 111) Source(30, 85) + SourceIndex(0) +25>Emitted(22, 112) Source(30, 86) + SourceIndex(0) +--- +>>> console.log(primarySkillA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > primarySkillA +7 > ) +8 > ; +1 >Emitted(23, 5) Source(31, 5) + SourceIndex(0) +2 >Emitted(23, 12) Source(31, 12) + SourceIndex(0) +3 >Emitted(23, 13) Source(31, 13) + SourceIndex(0) +4 >Emitted(23, 16) Source(31, 16) + SourceIndex(0) +5 >Emitted(23, 17) Source(31, 17) + SourceIndex(0) +6 >Emitted(23, 30) Source(31, 30) + SourceIndex(0) +7 >Emitted(23, 31) Source(31, 31) + SourceIndex(0) +8 >Emitted(23, 32) Source(31, 32) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(24, 1) Source(32, 1) + SourceIndex(0) +2 >Emitted(24, 2) Source(32, 2) + SourceIndex(0) +--- +>>>for (var _f = ["trimmer", ["trimming", "edging"]], _g = _f[1], primarySkillA = _g[0], secondarySkillA = _g[1], i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^^^^^^^^^ +13> ^^ +14> ^ +15> ^^^ +16> ^ +17> ^^ +18> ^ +19> ^^^ +20> ^ +21> ^^ +22> ^ +23> ^^ +24> ^^ +25> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > let [, [primarySkillA, secondarySkillA]] = ["trimmer", ["trimming", "edging"]] +7 > +8 > [primarySkillA, secondarySkillA] +9 > +10> primarySkillA +11> , +12> secondarySkillA +13> ]] = ["trimmer", ["trimming", "edging"]], +14> i +15> = +16> 0 +17> ; +18> i +19> < +20> 1 +21> ; +22> i +23> ++ +24> ) +25> { +1->Emitted(25, 1) Source(33, 1) + SourceIndex(0) +2 >Emitted(25, 4) Source(33, 4) + SourceIndex(0) +3 >Emitted(25, 5) Source(33, 5) + SourceIndex(0) +4 >Emitted(25, 6) Source(33, 6) + SourceIndex(0) +5 >Emitted(25, 10) Source(33, 6) + SourceIndex(0) +6 >Emitted(25, 50) Source(33, 84) + SourceIndex(0) +7 >Emitted(25, 52) Source(33, 13) + SourceIndex(0) +8 >Emitted(25, 62) Source(33, 45) + SourceIndex(0) +9 >Emitted(25, 64) Source(33, 14) + SourceIndex(0) +10>Emitted(25, 85) Source(33, 27) + SourceIndex(0) +11>Emitted(25, 87) Source(33, 29) + SourceIndex(0) +12>Emitted(25, 110) Source(33, 44) + SourceIndex(0) +13>Emitted(25, 112) Source(33, 86) + SourceIndex(0) +14>Emitted(25, 113) Source(33, 87) + SourceIndex(0) +15>Emitted(25, 116) Source(33, 90) + SourceIndex(0) +16>Emitted(25, 117) Source(33, 91) + SourceIndex(0) +17>Emitted(25, 119) Source(33, 93) + SourceIndex(0) +18>Emitted(25, 120) Source(33, 94) + SourceIndex(0) +19>Emitted(25, 123) Source(33, 97) + SourceIndex(0) +20>Emitted(25, 124) Source(33, 98) + SourceIndex(0) +21>Emitted(25, 126) Source(33, 100) + SourceIndex(0) +22>Emitted(25, 127) Source(33, 101) + SourceIndex(0) +23>Emitted(25, 129) Source(33, 103) + SourceIndex(0) +24>Emitted(25, 131) Source(33, 105) + SourceIndex(0) +25>Emitted(25, 132) Source(33, 106) + SourceIndex(0) +--- +>>> console.log(primarySkillA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > primarySkillA +7 > ) +8 > ; +1 >Emitted(26, 5) Source(34, 5) + SourceIndex(0) +2 >Emitted(26, 12) Source(34, 12) + SourceIndex(0) +3 >Emitted(26, 13) Source(34, 13) + SourceIndex(0) +4 >Emitted(26, 16) Source(34, 16) + SourceIndex(0) +5 >Emitted(26, 17) Source(34, 17) + SourceIndex(0) +6 >Emitted(26, 30) Source(34, 30) + SourceIndex(0) +7 >Emitted(26, 31) Source(34, 31) + SourceIndex(0) +8 >Emitted(26, 32) Source(34, 32) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(27, 1) Source(35, 1) + SourceIndex(0) +2 >Emitted(27, 2) Source(35, 2) + SourceIndex(0) +--- +>>>for (var numberB = robotA[0], i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^ +6 > ^^ +7 > ^ +8 > ^^^ +9 > ^ +10> ^^ +11> ^ +12> ^^^ +13> ^ +14> ^^ +15> ^ +16> ^^ +17> ^^ +18> ^ +1-> + > + > +2 >for +3 > +4 > (let [ +5 > numberB +6 > ] = robotA, +7 > i +8 > = +9 > 0 +10> ; +11> i +12> < +13> 1 +14> ; +15> i +16> ++ +17> ) +18> { +1->Emitted(28, 1) Source(37, 1) + SourceIndex(0) +2 >Emitted(28, 4) Source(37, 4) + SourceIndex(0) +3 >Emitted(28, 5) Source(37, 5) + SourceIndex(0) +4 >Emitted(28, 6) Source(37, 11) + SourceIndex(0) +5 >Emitted(28, 29) Source(37, 18) + SourceIndex(0) +6 >Emitted(28, 31) Source(37, 30) + SourceIndex(0) +7 >Emitted(28, 32) Source(37, 31) + SourceIndex(0) +8 >Emitted(28, 35) Source(37, 34) + SourceIndex(0) +9 >Emitted(28, 36) Source(37, 35) + SourceIndex(0) +10>Emitted(28, 38) Source(37, 37) + SourceIndex(0) +11>Emitted(28, 39) Source(37, 38) + SourceIndex(0) +12>Emitted(28, 42) Source(37, 41) + SourceIndex(0) +13>Emitted(28, 43) Source(37, 42) + SourceIndex(0) +14>Emitted(28, 45) Source(37, 44) + SourceIndex(0) +15>Emitted(28, 46) Source(37, 45) + SourceIndex(0) +16>Emitted(28, 48) Source(37, 47) + SourceIndex(0) +17>Emitted(28, 50) Source(37, 49) + SourceIndex(0) +18>Emitted(28, 51) Source(37, 50) + SourceIndex(0) +--- +>>> console.log(numberB); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > numberB +7 > ) +8 > ; +1 >Emitted(29, 5) Source(38, 5) + SourceIndex(0) +2 >Emitted(29, 12) Source(38, 12) + SourceIndex(0) +3 >Emitted(29, 13) Source(38, 13) + SourceIndex(0) +4 >Emitted(29, 16) Source(38, 16) + SourceIndex(0) +5 >Emitted(29, 17) Source(38, 17) + SourceIndex(0) +6 >Emitted(29, 24) Source(38, 24) + SourceIndex(0) +7 >Emitted(29, 25) Source(38, 25) + SourceIndex(0) +8 >Emitted(29, 26) Source(38, 26) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(30, 1) Source(39, 1) + SourceIndex(0) +2 >Emitted(30, 2) Source(39, 2) + SourceIndex(0) +--- +>>>for (var numberB = getRobot()[0], i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +6 > ^^ +7 > ^ +8 > ^^^ +9 > ^ +10> ^^ +11> ^ +12> ^^^ +13> ^ +14> ^^ +15> ^ +16> ^^ +17> ^^ +18> ^ +1-> + > +2 >for +3 > +4 > (let [ +5 > numberB +6 > ] = getRobot(), +7 > i +8 > = +9 > 0 +10> ; +11> i +12> < +13> 1 +14> ; +15> i +16> ++ +17> ) +18> { +1->Emitted(31, 1) Source(40, 1) + SourceIndex(0) +2 >Emitted(31, 4) Source(40, 4) + SourceIndex(0) +3 >Emitted(31, 5) Source(40, 5) + SourceIndex(0) +4 >Emitted(31, 6) Source(40, 11) + SourceIndex(0) +5 >Emitted(31, 33) Source(40, 18) + SourceIndex(0) +6 >Emitted(31, 35) Source(40, 34) + SourceIndex(0) +7 >Emitted(31, 36) Source(40, 35) + SourceIndex(0) +8 >Emitted(31, 39) Source(40, 38) + SourceIndex(0) +9 >Emitted(31, 40) Source(40, 39) + SourceIndex(0) +10>Emitted(31, 42) Source(40, 41) + SourceIndex(0) +11>Emitted(31, 43) Source(40, 42) + SourceIndex(0) +12>Emitted(31, 46) Source(40, 45) + SourceIndex(0) +13>Emitted(31, 47) Source(40, 46) + SourceIndex(0) +14>Emitted(31, 49) Source(40, 48) + SourceIndex(0) +15>Emitted(31, 50) Source(40, 49) + SourceIndex(0) +16>Emitted(31, 52) Source(40, 51) + SourceIndex(0) +17>Emitted(31, 54) Source(40, 53) + SourceIndex(0) +18>Emitted(31, 55) Source(40, 54) + SourceIndex(0) +--- +>>> console.log(numberB); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > numberB +7 > ) +8 > ; +1 >Emitted(32, 5) Source(41, 5) + SourceIndex(0) +2 >Emitted(32, 12) Source(41, 12) + SourceIndex(0) +3 >Emitted(32, 13) Source(41, 13) + SourceIndex(0) +4 >Emitted(32, 16) Source(41, 16) + SourceIndex(0) +5 >Emitted(32, 17) Source(41, 17) + SourceIndex(0) +6 >Emitted(32, 24) Source(41, 24) + SourceIndex(0) +7 >Emitted(32, 25) Source(41, 25) + SourceIndex(0) +8 >Emitted(32, 26) Source(41, 26) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(33, 1) Source(42, 1) + SourceIndex(0) +2 >Emitted(33, 2) Source(42, 2) + SourceIndex(0) +--- +>>>for (var numberB = [2, "trimmer", "trimming"][0], i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +6 > ^^ +7 > ^ +8 > ^^^ +9 > ^ +10> ^^ +11> ^ +12> ^^^ +13> ^ +14> ^^ +15> ^ +16> ^^ +17> ^^ +18> ^ +1-> + > +2 >for +3 > +4 > (let [ +5 > numberB +6 > ] = [2, "trimmer", "trimming"], +7 > i +8 > = +9 > 0 +10> ; +11> i +12> < +13> 1 +14> ; +15> i +16> ++ +17> ) +18> { +1->Emitted(34, 1) Source(43, 1) + SourceIndex(0) +2 >Emitted(34, 4) Source(43, 4) + SourceIndex(0) +3 >Emitted(34, 5) Source(43, 5) + SourceIndex(0) +4 >Emitted(34, 6) Source(43, 11) + SourceIndex(0) +5 >Emitted(34, 49) Source(43, 18) + SourceIndex(0) +6 >Emitted(34, 51) Source(43, 50) + SourceIndex(0) +7 >Emitted(34, 52) Source(43, 51) + SourceIndex(0) +8 >Emitted(34, 55) Source(43, 54) + SourceIndex(0) +9 >Emitted(34, 56) Source(43, 55) + SourceIndex(0) +10>Emitted(34, 58) Source(43, 57) + SourceIndex(0) +11>Emitted(34, 59) Source(43, 58) + SourceIndex(0) +12>Emitted(34, 62) Source(43, 61) + SourceIndex(0) +13>Emitted(34, 63) Source(43, 62) + SourceIndex(0) +14>Emitted(34, 65) Source(43, 64) + SourceIndex(0) +15>Emitted(34, 66) Source(43, 65) + SourceIndex(0) +16>Emitted(34, 68) Source(43, 67) + SourceIndex(0) +17>Emitted(34, 70) Source(43, 69) + SourceIndex(0) +18>Emitted(34, 71) Source(43, 70) + SourceIndex(0) +--- +>>> console.log(numberB); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > numberB +7 > ) +8 > ; +1 >Emitted(35, 5) Source(44, 5) + SourceIndex(0) +2 >Emitted(35, 12) Source(44, 12) + SourceIndex(0) +3 >Emitted(35, 13) Source(44, 13) + SourceIndex(0) +4 >Emitted(35, 16) Source(44, 16) + SourceIndex(0) +5 >Emitted(35, 17) Source(44, 17) + SourceIndex(0) +6 >Emitted(35, 24) Source(44, 24) + SourceIndex(0) +7 >Emitted(35, 25) Source(44, 25) + SourceIndex(0) +8 >Emitted(35, 26) Source(44, 26) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(36, 1) Source(45, 1) + SourceIndex(0) +2 >Emitted(36, 2) Source(45, 2) + SourceIndex(0) +--- +>>>for (var nameB = multiRobotA[0], i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^ +6 > ^^ +7 > ^ +8 > ^^^ +9 > ^ +10> ^^ +11> ^ +12> ^^^ +13> ^ +14> ^^ +15> ^ +16> ^^ +17> ^^ +18> ^ +1-> + > +2 >for +3 > +4 > (let [ +5 > nameB +6 > ] = multiRobotA, +7 > i +8 > = +9 > 0 +10> ; +11> i +12> < +13> 1 +14> ; +15> i +16> ++ +17> ) +18> { +1->Emitted(37, 1) Source(46, 1) + SourceIndex(0) +2 >Emitted(37, 4) Source(46, 4) + SourceIndex(0) +3 >Emitted(37, 5) Source(46, 5) + SourceIndex(0) +4 >Emitted(37, 6) Source(46, 11) + SourceIndex(0) +5 >Emitted(37, 32) Source(46, 16) + SourceIndex(0) +6 >Emitted(37, 34) Source(46, 33) + SourceIndex(0) +7 >Emitted(37, 35) Source(46, 34) + SourceIndex(0) +8 >Emitted(37, 38) Source(46, 37) + SourceIndex(0) +9 >Emitted(37, 39) Source(46, 38) + SourceIndex(0) +10>Emitted(37, 41) Source(46, 40) + SourceIndex(0) +11>Emitted(37, 42) Source(46, 41) + SourceIndex(0) +12>Emitted(37, 45) Source(46, 44) + SourceIndex(0) +13>Emitted(37, 46) Source(46, 45) + SourceIndex(0) +14>Emitted(37, 48) Source(46, 47) + SourceIndex(0) +15>Emitted(37, 49) Source(46, 48) + SourceIndex(0) +16>Emitted(37, 51) Source(46, 50) + SourceIndex(0) +17>Emitted(37, 53) Source(46, 52) + SourceIndex(0) +18>Emitted(37, 54) Source(46, 53) + SourceIndex(0) +--- +>>> console.log(nameB); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameB +7 > ) +8 > ; +1 >Emitted(38, 5) Source(47, 5) + SourceIndex(0) +2 >Emitted(38, 12) Source(47, 12) + SourceIndex(0) +3 >Emitted(38, 13) Source(47, 13) + SourceIndex(0) +4 >Emitted(38, 16) Source(47, 16) + SourceIndex(0) +5 >Emitted(38, 17) Source(47, 17) + SourceIndex(0) +6 >Emitted(38, 22) Source(47, 22) + SourceIndex(0) +7 >Emitted(38, 23) Source(47, 23) + SourceIndex(0) +8 >Emitted(38, 24) Source(47, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(39, 1) Source(48, 1) + SourceIndex(0) +2 >Emitted(39, 2) Source(48, 2) + SourceIndex(0) +--- +>>>for (var nameB = getMultiRobot()[0], i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +6 > ^^ +7 > ^ +8 > ^^^ +9 > ^ +10> ^^ +11> ^ +12> ^^^ +13> ^ +14> ^^ +15> ^ +16> ^^ +17> ^^ +18> ^ +1-> + > +2 >for +3 > +4 > (let [ +5 > nameB +6 > ] = getMultiRobot(), +7 > i +8 > = +9 > 0 +10> ; +11> i +12> < +13> 1 +14> ; +15> i +16> ++ +17> ) +18> { +1->Emitted(40, 1) Source(49, 1) + SourceIndex(0) +2 >Emitted(40, 4) Source(49, 4) + SourceIndex(0) +3 >Emitted(40, 5) Source(49, 5) + SourceIndex(0) +4 >Emitted(40, 6) Source(49, 11) + SourceIndex(0) +5 >Emitted(40, 36) Source(49, 16) + SourceIndex(0) +6 >Emitted(40, 38) Source(49, 37) + SourceIndex(0) +7 >Emitted(40, 39) Source(49, 38) + SourceIndex(0) +8 >Emitted(40, 42) Source(49, 41) + SourceIndex(0) +9 >Emitted(40, 43) Source(49, 42) + SourceIndex(0) +10>Emitted(40, 45) Source(49, 44) + SourceIndex(0) +11>Emitted(40, 46) Source(49, 45) + SourceIndex(0) +12>Emitted(40, 49) Source(49, 48) + SourceIndex(0) +13>Emitted(40, 50) Source(49, 49) + SourceIndex(0) +14>Emitted(40, 52) Source(49, 51) + SourceIndex(0) +15>Emitted(40, 53) Source(49, 52) + SourceIndex(0) +16>Emitted(40, 55) Source(49, 54) + SourceIndex(0) +17>Emitted(40, 57) Source(49, 56) + SourceIndex(0) +18>Emitted(40, 58) Source(49, 57) + SourceIndex(0) +--- +>>> console.log(nameB); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameB +7 > ) +8 > ; +1 >Emitted(41, 5) Source(50, 5) + SourceIndex(0) +2 >Emitted(41, 12) Source(50, 12) + SourceIndex(0) +3 >Emitted(41, 13) Source(50, 13) + SourceIndex(0) +4 >Emitted(41, 16) Source(50, 16) + SourceIndex(0) +5 >Emitted(41, 17) Source(50, 17) + SourceIndex(0) +6 >Emitted(41, 22) Source(50, 22) + SourceIndex(0) +7 >Emitted(41, 23) Source(50, 23) + SourceIndex(0) +8 >Emitted(41, 24) Source(50, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(42, 1) Source(51, 1) + SourceIndex(0) +2 >Emitted(42, 2) Source(51, 2) + SourceIndex(0) +--- +>>>for (var nameB = ["trimmer", ["trimming", "edging"]][0], i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +6 > ^^ +7 > ^ +8 > ^^^ +9 > ^ +10> ^^ +11> ^ +12> ^^^ +13> ^ +14> ^^ +15> ^ +16> ^^ +17> ^^ +18> ^ +1-> + > +2 >for +3 > +4 > (let [ +5 > nameB +6 > ] = ["trimmer", ["trimming", "edging"]], +7 > i +8 > = +9 > 0 +10> ; +11> i +12> < +13> 1 +14> ; +15> i +16> ++ +17> ) +18> { +1->Emitted(43, 1) Source(52, 1) + SourceIndex(0) +2 >Emitted(43, 4) Source(52, 4) + SourceIndex(0) +3 >Emitted(43, 5) Source(52, 5) + SourceIndex(0) +4 >Emitted(43, 6) Source(52, 11) + SourceIndex(0) +5 >Emitted(43, 56) Source(52, 16) + SourceIndex(0) +6 >Emitted(43, 58) Source(52, 57) + SourceIndex(0) +7 >Emitted(43, 59) Source(52, 58) + SourceIndex(0) +8 >Emitted(43, 62) Source(52, 61) + SourceIndex(0) +9 >Emitted(43, 63) Source(52, 62) + SourceIndex(0) +10>Emitted(43, 65) Source(52, 64) + SourceIndex(0) +11>Emitted(43, 66) Source(52, 65) + SourceIndex(0) +12>Emitted(43, 69) Source(52, 68) + SourceIndex(0) +13>Emitted(43, 70) Source(52, 69) + SourceIndex(0) +14>Emitted(43, 72) Source(52, 71) + SourceIndex(0) +15>Emitted(43, 73) Source(52, 72) + SourceIndex(0) +16>Emitted(43, 75) Source(52, 74) + SourceIndex(0) +17>Emitted(43, 77) Source(52, 76) + SourceIndex(0) +18>Emitted(43, 78) Source(52, 77) + SourceIndex(0) +--- +>>> console.log(nameB); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameB +7 > ) +8 > ; +1 >Emitted(44, 5) Source(53, 5) + SourceIndex(0) +2 >Emitted(44, 12) Source(53, 12) + SourceIndex(0) +3 >Emitted(44, 13) Source(53, 13) + SourceIndex(0) +4 >Emitted(44, 16) Source(53, 16) + SourceIndex(0) +5 >Emitted(44, 17) Source(53, 17) + SourceIndex(0) +6 >Emitted(44, 22) Source(53, 22) + SourceIndex(0) +7 >Emitted(44, 23) Source(53, 23) + SourceIndex(0) +8 >Emitted(44, 24) Source(53, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(45, 1) Source(54, 1) + SourceIndex(0) +2 >Emitted(45, 2) Source(54, 2) + SourceIndex(0) +--- +>>>for (var numberA2 = robotA[0], nameA2 = robotA[1], skillA2 = robotA[2], i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^^^^^ +10> ^^ +11> ^ +12> ^^^ +13> ^ +14> ^^ +15> ^ +16> ^^^ +17> ^ +18> ^^ +19> ^ +20> ^^ +21> ^^ +22> ^ +1-> + > + > +2 >for +3 > +4 > (let [ +5 > numberA2 +6 > , +7 > nameA2 +8 > , +9 > skillA2 +10> ] = robotA, +11> i +12> = +13> 0 +14> ; +15> i +16> < +17> 1 +18> ; +19> i +20> ++ +21> ) +22> { +1->Emitted(46, 1) Source(56, 1) + SourceIndex(0) +2 >Emitted(46, 4) Source(56, 4) + SourceIndex(0) +3 >Emitted(46, 5) Source(56, 5) + SourceIndex(0) +4 >Emitted(46, 6) Source(56, 11) + SourceIndex(0) +5 >Emitted(46, 30) Source(56, 19) + SourceIndex(0) +6 >Emitted(46, 32) Source(56, 21) + SourceIndex(0) +7 >Emitted(46, 50) Source(56, 27) + SourceIndex(0) +8 >Emitted(46, 52) Source(56, 29) + SourceIndex(0) +9 >Emitted(46, 71) Source(56, 36) + SourceIndex(0) +10>Emitted(46, 73) Source(56, 48) + SourceIndex(0) +11>Emitted(46, 74) Source(56, 49) + SourceIndex(0) +12>Emitted(46, 77) Source(56, 52) + SourceIndex(0) +13>Emitted(46, 78) Source(56, 53) + SourceIndex(0) +14>Emitted(46, 80) Source(56, 55) + SourceIndex(0) +15>Emitted(46, 81) Source(56, 56) + SourceIndex(0) +16>Emitted(46, 84) Source(56, 59) + SourceIndex(0) +17>Emitted(46, 85) Source(56, 60) + SourceIndex(0) +18>Emitted(46, 87) Source(56, 62) + SourceIndex(0) +19>Emitted(46, 88) Source(56, 63) + SourceIndex(0) +20>Emitted(46, 90) Source(56, 65) + SourceIndex(0) +21>Emitted(46, 92) Source(56, 67) + SourceIndex(0) +22>Emitted(46, 93) Source(56, 68) + SourceIndex(0) +--- +>>> console.log(nameA2); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA2 +7 > ) +8 > ; +1 >Emitted(47, 5) Source(57, 5) + SourceIndex(0) +2 >Emitted(47, 12) Source(57, 12) + SourceIndex(0) +3 >Emitted(47, 13) Source(57, 13) + SourceIndex(0) +4 >Emitted(47, 16) Source(57, 16) + SourceIndex(0) +5 >Emitted(47, 17) Source(57, 17) + SourceIndex(0) +6 >Emitted(47, 23) Source(57, 23) + SourceIndex(0) +7 >Emitted(47, 24) Source(57, 24) + SourceIndex(0) +8 >Emitted(47, 25) Source(57, 25) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(48, 1) Source(58, 1) + SourceIndex(0) +2 >Emitted(48, 2) Source(58, 2) + SourceIndex(0) +--- +>>>for (var _h = getRobot(), numberA2 = _h[0], nameA2 = _h[1], skillA2 = _h[2], i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^ +6 > ^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^ +13> ^^ +14> ^ +15> ^^^ +16> ^ +17> ^^ +18> ^ +19> ^^^ +20> ^ +21> ^^ +22> ^ +23> ^^ +24> ^^ +25> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > let [numberA2, nameA2, skillA2] = getRobot() +7 > +8 > numberA2 +9 > , +10> nameA2 +11> , +12> skillA2 +13> ] = getRobot(), +14> i +15> = +16> 0 +17> ; +18> i +19> < +20> 1 +21> ; +22> i +23> ++ +24> ) +25> { +1->Emitted(49, 1) Source(59, 1) + SourceIndex(0) +2 >Emitted(49, 4) Source(59, 4) + SourceIndex(0) +3 >Emitted(49, 5) Source(59, 5) + SourceIndex(0) +4 >Emitted(49, 6) Source(59, 6) + SourceIndex(0) +5 >Emitted(49, 10) Source(59, 6) + SourceIndex(0) +6 >Emitted(49, 25) Source(59, 50) + SourceIndex(0) +7 >Emitted(49, 27) Source(59, 11) + SourceIndex(0) +8 >Emitted(49, 43) Source(59, 19) + SourceIndex(0) +9 >Emitted(49, 45) Source(59, 21) + SourceIndex(0) +10>Emitted(49, 59) Source(59, 27) + SourceIndex(0) +11>Emitted(49, 61) Source(59, 29) + SourceIndex(0) +12>Emitted(49, 76) Source(59, 36) + SourceIndex(0) +13>Emitted(49, 78) Source(59, 52) + SourceIndex(0) +14>Emitted(49, 79) Source(59, 53) + SourceIndex(0) +15>Emitted(49, 82) Source(59, 56) + SourceIndex(0) +16>Emitted(49, 83) Source(59, 57) + SourceIndex(0) +17>Emitted(49, 85) Source(59, 59) + SourceIndex(0) +18>Emitted(49, 86) Source(59, 60) + SourceIndex(0) +19>Emitted(49, 89) Source(59, 63) + SourceIndex(0) +20>Emitted(49, 90) Source(59, 64) + SourceIndex(0) +21>Emitted(49, 92) Source(59, 66) + SourceIndex(0) +22>Emitted(49, 93) Source(59, 67) + SourceIndex(0) +23>Emitted(49, 95) Source(59, 69) + SourceIndex(0) +24>Emitted(49, 97) Source(59, 71) + SourceIndex(0) +25>Emitted(49, 98) Source(59, 72) + SourceIndex(0) +--- +>>> console.log(nameA2); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA2 +7 > ) +8 > ; +1 >Emitted(50, 5) Source(60, 5) + SourceIndex(0) +2 >Emitted(50, 12) Source(60, 12) + SourceIndex(0) +3 >Emitted(50, 13) Source(60, 13) + SourceIndex(0) +4 >Emitted(50, 16) Source(60, 16) + SourceIndex(0) +5 >Emitted(50, 17) Source(60, 17) + SourceIndex(0) +6 >Emitted(50, 23) Source(60, 23) + SourceIndex(0) +7 >Emitted(50, 24) Source(60, 24) + SourceIndex(0) +8 >Emitted(50, 25) Source(60, 25) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(51, 1) Source(61, 1) + SourceIndex(0) +2 >Emitted(51, 2) Source(61, 2) + SourceIndex(0) +--- +>>>for (var _j = [2, "trimmer", "trimming"], numberA2 = _j[0], nameA2 = _j[1], skillA2 = _j[2], i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^ +13> ^^ +14> ^ +15> ^^^ +16> ^ +17> ^^ +18> ^ +19> ^^^ +20> ^ +21> ^^ +22> ^ +23> ^^ +24> ^^ +25> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > let [numberA2, nameA2, skillA2] = [2, "trimmer", "trimming"] +7 > +8 > numberA2 +9 > , +10> nameA2 +11> , +12> skillA2 +13> ] = [2, "trimmer", "trimming"], +14> i +15> = +16> 0 +17> ; +18> i +19> < +20> 1 +21> ; +22> i +23> ++ +24> ) +25> { +1->Emitted(52, 1) Source(62, 1) + SourceIndex(0) +2 >Emitted(52, 4) Source(62, 4) + SourceIndex(0) +3 >Emitted(52, 5) Source(62, 5) + SourceIndex(0) +4 >Emitted(52, 6) Source(62, 6) + SourceIndex(0) +5 >Emitted(52, 10) Source(62, 6) + SourceIndex(0) +6 >Emitted(52, 41) Source(62, 66) + SourceIndex(0) +7 >Emitted(52, 43) Source(62, 11) + SourceIndex(0) +8 >Emitted(52, 59) Source(62, 19) + SourceIndex(0) +9 >Emitted(52, 61) Source(62, 21) + SourceIndex(0) +10>Emitted(52, 75) Source(62, 27) + SourceIndex(0) +11>Emitted(52, 77) Source(62, 29) + SourceIndex(0) +12>Emitted(52, 92) Source(62, 36) + SourceIndex(0) +13>Emitted(52, 94) Source(62, 68) + SourceIndex(0) +14>Emitted(52, 95) Source(62, 69) + SourceIndex(0) +15>Emitted(52, 98) Source(62, 72) + SourceIndex(0) +16>Emitted(52, 99) Source(62, 73) + SourceIndex(0) +17>Emitted(52, 101) Source(62, 75) + SourceIndex(0) +18>Emitted(52, 102) Source(62, 76) + SourceIndex(0) +19>Emitted(52, 105) Source(62, 79) + SourceIndex(0) +20>Emitted(52, 106) Source(62, 80) + SourceIndex(0) +21>Emitted(52, 108) Source(62, 82) + SourceIndex(0) +22>Emitted(52, 109) Source(62, 83) + SourceIndex(0) +23>Emitted(52, 111) Source(62, 85) + SourceIndex(0) +24>Emitted(52, 113) Source(62, 87) + SourceIndex(0) +25>Emitted(52, 114) Source(62, 88) + SourceIndex(0) +--- +>>> console.log(nameA2); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA2 +7 > ) +8 > ; +1 >Emitted(53, 5) Source(63, 5) + SourceIndex(0) +2 >Emitted(53, 12) Source(63, 12) + SourceIndex(0) +3 >Emitted(53, 13) Source(63, 13) + SourceIndex(0) +4 >Emitted(53, 16) Source(63, 16) + SourceIndex(0) +5 >Emitted(53, 17) Source(63, 17) + SourceIndex(0) +6 >Emitted(53, 23) Source(63, 23) + SourceIndex(0) +7 >Emitted(53, 24) Source(63, 24) + SourceIndex(0) +8 >Emitted(53, 25) Source(63, 25) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(54, 1) Source(64, 1) + SourceIndex(0) +2 >Emitted(54, 2) Source(64, 2) + SourceIndex(0) +--- +>>>for (var nameMA = multiRobotA[0], _k = multiRobotA[1], primarySkillA = _k[0], secondarySkillA = _k[1], i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^^^^^^^ +10> ^^ +11> ^^^^^^^^^^^^^^^^^^^^^^^ +12> ^^ +13> ^ +14> ^^^ +15> ^ +16> ^^ +17> ^ +18> ^^^ +19> ^ +20> ^^ +21> ^ +22> ^^ +23> ^^ +24> ^ +1-> + > +2 >for +3 > +4 > (let [ +5 > nameMA +6 > , +7 > [primarySkillA, secondarySkillA] +8 > +9 > primarySkillA +10> , +11> secondarySkillA +12> ]] = multiRobotA, +13> i +14> = +15> 0 +16> ; +17> i +18> < +19> 1 +20> ; +21> i +22> ++ +23> ) +24> { +1->Emitted(55, 1) Source(65, 1) + SourceIndex(0) +2 >Emitted(55, 4) Source(65, 4) + SourceIndex(0) +3 >Emitted(55, 5) Source(65, 5) + SourceIndex(0) +4 >Emitted(55, 6) Source(65, 11) + SourceIndex(0) +5 >Emitted(55, 33) Source(65, 17) + SourceIndex(0) +6 >Emitted(55, 35) Source(65, 19) + SourceIndex(0) +7 >Emitted(55, 54) Source(65, 51) + SourceIndex(0) +8 >Emitted(55, 56) Source(65, 20) + SourceIndex(0) +9 >Emitted(55, 77) Source(65, 33) + SourceIndex(0) +10>Emitted(55, 79) Source(65, 35) + SourceIndex(0) +11>Emitted(55, 102) Source(65, 50) + SourceIndex(0) +12>Emitted(55, 104) Source(65, 68) + SourceIndex(0) +13>Emitted(55, 105) Source(65, 69) + SourceIndex(0) +14>Emitted(55, 108) Source(65, 72) + SourceIndex(0) +15>Emitted(55, 109) Source(65, 73) + SourceIndex(0) +16>Emitted(55, 111) Source(65, 75) + SourceIndex(0) +17>Emitted(55, 112) Source(65, 76) + SourceIndex(0) +18>Emitted(55, 115) Source(65, 79) + SourceIndex(0) +19>Emitted(55, 116) Source(65, 80) + SourceIndex(0) +20>Emitted(55, 118) Source(65, 82) + SourceIndex(0) +21>Emitted(55, 119) Source(65, 83) + SourceIndex(0) +22>Emitted(55, 121) Source(65, 85) + SourceIndex(0) +23>Emitted(55, 123) Source(65, 87) + SourceIndex(0) +24>Emitted(55, 124) Source(65, 88) + SourceIndex(0) +--- +>>> console.log(nameMA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameMA +7 > ) +8 > ; +1 >Emitted(56, 5) Source(66, 5) + SourceIndex(0) +2 >Emitted(56, 12) Source(66, 12) + SourceIndex(0) +3 >Emitted(56, 13) Source(66, 13) + SourceIndex(0) +4 >Emitted(56, 16) Source(66, 16) + SourceIndex(0) +5 >Emitted(56, 17) Source(66, 17) + SourceIndex(0) +6 >Emitted(56, 23) Source(66, 23) + SourceIndex(0) +7 >Emitted(56, 24) Source(66, 24) + SourceIndex(0) +8 >Emitted(56, 25) Source(66, 25) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(57, 1) Source(67, 1) + SourceIndex(0) +2 >Emitted(57, 2) Source(67, 2) + SourceIndex(0) +--- +>>>for (var _l = getMultiRobot(), nameMA = _l[0], _m = _l[1], primarySkillA = _m[0], secondarySkillA = _m[1], i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^ +6 > ^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^^^^^^^^^^ +15> ^^ +16> ^ +17> ^^^ +18> ^ +19> ^^ +20> ^ +21> ^^^ +22> ^ +23> ^^ +24> ^ +25> ^^ +26> ^^ +27> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > let [nameMA, [primarySkillA, secondarySkillA]] = getMultiRobot() +7 > +8 > nameMA +9 > , +10> [primarySkillA, secondarySkillA] +11> +12> primarySkillA +13> , +14> secondarySkillA +15> ]] = getMultiRobot(), +16> i +17> = +18> 0 +19> ; +20> i +21> < +22> 1 +23> ; +24> i +25> ++ +26> ) +27> { +1->Emitted(58, 1) Source(68, 1) + SourceIndex(0) +2 >Emitted(58, 4) Source(68, 4) + SourceIndex(0) +3 >Emitted(58, 5) Source(68, 5) + SourceIndex(0) +4 >Emitted(58, 6) Source(68, 6) + SourceIndex(0) +5 >Emitted(58, 10) Source(68, 6) + SourceIndex(0) +6 >Emitted(58, 30) Source(68, 70) + SourceIndex(0) +7 >Emitted(58, 32) Source(68, 11) + SourceIndex(0) +8 >Emitted(58, 46) Source(68, 17) + SourceIndex(0) +9 >Emitted(58, 48) Source(68, 19) + SourceIndex(0) +10>Emitted(58, 58) Source(68, 51) + SourceIndex(0) +11>Emitted(58, 60) Source(68, 20) + SourceIndex(0) +12>Emitted(58, 81) Source(68, 33) + SourceIndex(0) +13>Emitted(58, 83) Source(68, 35) + SourceIndex(0) +14>Emitted(58, 106) Source(68, 50) + SourceIndex(0) +15>Emitted(58, 108) Source(68, 72) + SourceIndex(0) +16>Emitted(58, 109) Source(68, 73) + SourceIndex(0) +17>Emitted(58, 112) Source(68, 76) + SourceIndex(0) +18>Emitted(58, 113) Source(68, 77) + SourceIndex(0) +19>Emitted(58, 115) Source(68, 79) + SourceIndex(0) +20>Emitted(58, 116) Source(68, 80) + SourceIndex(0) +21>Emitted(58, 119) Source(68, 83) + SourceIndex(0) +22>Emitted(58, 120) Source(68, 84) + SourceIndex(0) +23>Emitted(58, 122) Source(68, 86) + SourceIndex(0) +24>Emitted(58, 123) Source(68, 87) + SourceIndex(0) +25>Emitted(58, 125) Source(68, 89) + SourceIndex(0) +26>Emitted(58, 127) Source(68, 91) + SourceIndex(0) +27>Emitted(58, 128) Source(68, 92) + SourceIndex(0) +--- +>>> console.log(nameMA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameMA +7 > ) +8 > ; +1 >Emitted(59, 5) Source(69, 5) + SourceIndex(0) +2 >Emitted(59, 12) Source(69, 12) + SourceIndex(0) +3 >Emitted(59, 13) Source(69, 13) + SourceIndex(0) +4 >Emitted(59, 16) Source(69, 16) + SourceIndex(0) +5 >Emitted(59, 17) Source(69, 17) + SourceIndex(0) +6 >Emitted(59, 23) Source(69, 23) + SourceIndex(0) +7 >Emitted(59, 24) Source(69, 24) + SourceIndex(0) +8 >Emitted(59, 25) Source(69, 25) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(60, 1) Source(70, 1) + SourceIndex(0) +2 >Emitted(60, 2) Source(70, 2) + SourceIndex(0) +--- +>>>for (var _o = ["trimmer", ["trimming", "edging"]], nameMA = _o[0], _p = _o[1], primarySkillA = _p[0], secondarySkillA = _p[1], i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^^^^^^^^^^ +15> ^^ +16> ^ +17> ^^^ +18> ^ +19> ^^ +20> ^ +21> ^^^ +22> ^ +23> ^^ +24> ^ +25> ^^ +26> ^^ +27> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > let [nameMA, [primarySkillA, secondarySkillA]] = ["trimmer", ["trimming", "edging"]] +7 > +8 > nameMA +9 > , +10> [primarySkillA, secondarySkillA] +11> +12> primarySkillA +13> , +14> secondarySkillA +15> ]] = ["trimmer", ["trimming", "edging"]], +16> i +17> = +18> 0 +19> ; +20> i +21> < +22> 1 +23> ; +24> i +25> ++ +26> ) +27> { +1->Emitted(61, 1) Source(71, 1) + SourceIndex(0) +2 >Emitted(61, 4) Source(71, 4) + SourceIndex(0) +3 >Emitted(61, 5) Source(71, 5) + SourceIndex(0) +4 >Emitted(61, 6) Source(71, 6) + SourceIndex(0) +5 >Emitted(61, 10) Source(71, 6) + SourceIndex(0) +6 >Emitted(61, 50) Source(71, 90) + SourceIndex(0) +7 >Emitted(61, 52) Source(71, 11) + SourceIndex(0) +8 >Emitted(61, 66) Source(71, 17) + SourceIndex(0) +9 >Emitted(61, 68) Source(71, 19) + SourceIndex(0) +10>Emitted(61, 78) Source(71, 51) + SourceIndex(0) +11>Emitted(61, 80) Source(71, 20) + SourceIndex(0) +12>Emitted(61, 101) Source(71, 33) + SourceIndex(0) +13>Emitted(61, 103) Source(71, 35) + SourceIndex(0) +14>Emitted(61, 126) Source(71, 50) + SourceIndex(0) +15>Emitted(61, 128) Source(71, 92) + SourceIndex(0) +16>Emitted(61, 129) Source(71, 93) + SourceIndex(0) +17>Emitted(61, 132) Source(71, 96) + SourceIndex(0) +18>Emitted(61, 133) Source(71, 97) + SourceIndex(0) +19>Emitted(61, 135) Source(71, 99) + SourceIndex(0) +20>Emitted(61, 136) Source(71, 100) + SourceIndex(0) +21>Emitted(61, 139) Source(71, 103) + SourceIndex(0) +22>Emitted(61, 140) Source(71, 104) + SourceIndex(0) +23>Emitted(61, 142) Source(71, 106) + SourceIndex(0) +24>Emitted(61, 143) Source(71, 107) + SourceIndex(0) +25>Emitted(61, 145) Source(71, 109) + SourceIndex(0) +26>Emitted(61, 147) Source(71, 111) + SourceIndex(0) +27>Emitted(61, 148) Source(71, 112) + SourceIndex(0) +--- +>>> console.log(nameMA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameMA +7 > ) +8 > ; +1 >Emitted(62, 5) Source(72, 5) + SourceIndex(0) +2 >Emitted(62, 12) Source(72, 12) + SourceIndex(0) +3 >Emitted(62, 13) Source(72, 13) + SourceIndex(0) +4 >Emitted(62, 16) Source(72, 16) + SourceIndex(0) +5 >Emitted(62, 17) Source(72, 17) + SourceIndex(0) +6 >Emitted(62, 23) Source(72, 23) + SourceIndex(0) +7 >Emitted(62, 24) Source(72, 24) + SourceIndex(0) +8 >Emitted(62, 25) Source(72, 25) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(63, 1) Source(73, 1) + SourceIndex(0) +2 >Emitted(63, 2) Source(73, 2) + SourceIndex(0) +--- +>>>for (var numberA3 = robotA[0], robotAInfo = robotA.slice(1), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^ +10> ^^^ +11> ^ +12> ^^ +13> ^ +14> ^^^ +15> ^ +16> ^^ +17> ^ +18> ^^ +19> ^^ +20> ^ +1-> + > + > +2 >for +3 > +4 > (let [ +5 > numberA3 +6 > , +7 > ...robotAInfo +8 > ] = robotA, +9 > i +10> = +11> 0 +12> ; +13> i +14> < +15> 1 +16> ; +17> i +18> ++ +19> ) +20> { +1->Emitted(64, 1) Source(75, 1) + SourceIndex(0) +2 >Emitted(64, 4) Source(75, 4) + SourceIndex(0) +3 >Emitted(64, 5) Source(75, 5) + SourceIndex(0) +4 >Emitted(64, 6) Source(75, 11) + SourceIndex(0) +5 >Emitted(64, 30) Source(75, 19) + SourceIndex(0) +6 >Emitted(64, 32) Source(75, 21) + SourceIndex(0) +7 >Emitted(64, 60) Source(75, 34) + SourceIndex(0) +8 >Emitted(64, 62) Source(75, 46) + SourceIndex(0) +9 >Emitted(64, 63) Source(75, 47) + SourceIndex(0) +10>Emitted(64, 66) Source(75, 50) + SourceIndex(0) +11>Emitted(64, 67) Source(75, 51) + SourceIndex(0) +12>Emitted(64, 69) Source(75, 53) + SourceIndex(0) +13>Emitted(64, 70) Source(75, 54) + SourceIndex(0) +14>Emitted(64, 73) Source(75, 57) + SourceIndex(0) +15>Emitted(64, 74) Source(75, 58) + SourceIndex(0) +16>Emitted(64, 76) Source(75, 60) + SourceIndex(0) +17>Emitted(64, 77) Source(75, 61) + SourceIndex(0) +18>Emitted(64, 79) Source(75, 63) + SourceIndex(0) +19>Emitted(64, 81) Source(75, 65) + SourceIndex(0) +20>Emitted(64, 82) Source(75, 66) + SourceIndex(0) +--- +>>> console.log(numberA3); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > numberA3 +7 > ) +8 > ; +1 >Emitted(65, 5) Source(76, 5) + SourceIndex(0) +2 >Emitted(65, 12) Source(76, 12) + SourceIndex(0) +3 >Emitted(65, 13) Source(76, 13) + SourceIndex(0) +4 >Emitted(65, 16) Source(76, 16) + SourceIndex(0) +5 >Emitted(65, 17) Source(76, 17) + SourceIndex(0) +6 >Emitted(65, 25) Source(76, 25) + SourceIndex(0) +7 >Emitted(65, 26) Source(76, 26) + SourceIndex(0) +8 >Emitted(65, 27) Source(76, 27) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(66, 1) Source(77, 1) + SourceIndex(0) +2 >Emitted(66, 2) Source(77, 2) + SourceIndex(0) +--- +>>>for (var _q = getRobot(), numberA3 = _q[0], robotAInfo = _q.slice(1), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^ +6 > ^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^ +13> ^^^ +14> ^ +15> ^^ +16> ^ +17> ^^^ +18> ^ +19> ^^ +20> ^ +21> ^^ +22> ^^ +23> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > let [numberA3, ...robotAInfo] = getRobot() +7 > +8 > numberA3 +9 > , +10> ...robotAInfo +11> ] = getRobot(), +12> i +13> = +14> 0 +15> ; +16> i +17> < +18> 1 +19> ; +20> i +21> ++ +22> ) +23> { +1->Emitted(67, 1) Source(78, 1) + SourceIndex(0) +2 >Emitted(67, 4) Source(78, 4) + SourceIndex(0) +3 >Emitted(67, 5) Source(78, 5) + SourceIndex(0) +4 >Emitted(67, 6) Source(78, 6) + SourceIndex(0) +5 >Emitted(67, 10) Source(78, 6) + SourceIndex(0) +6 >Emitted(67, 25) Source(78, 48) + SourceIndex(0) +7 >Emitted(67, 27) Source(78, 11) + SourceIndex(0) +8 >Emitted(67, 43) Source(78, 19) + SourceIndex(0) +9 >Emitted(67, 45) Source(78, 21) + SourceIndex(0) +10>Emitted(67, 69) Source(78, 34) + SourceIndex(0) +11>Emitted(67, 71) Source(78, 50) + SourceIndex(0) +12>Emitted(67, 72) Source(78, 51) + SourceIndex(0) +13>Emitted(67, 75) Source(78, 54) + SourceIndex(0) +14>Emitted(67, 76) Source(78, 55) + SourceIndex(0) +15>Emitted(67, 78) Source(78, 57) + SourceIndex(0) +16>Emitted(67, 79) Source(78, 58) + SourceIndex(0) +17>Emitted(67, 82) Source(78, 61) + SourceIndex(0) +18>Emitted(67, 83) Source(78, 62) + SourceIndex(0) +19>Emitted(67, 85) Source(78, 64) + SourceIndex(0) +20>Emitted(67, 86) Source(78, 65) + SourceIndex(0) +21>Emitted(67, 88) Source(78, 67) + SourceIndex(0) +22>Emitted(67, 90) Source(78, 69) + SourceIndex(0) +23>Emitted(67, 91) Source(78, 70) + SourceIndex(0) +--- +>>> console.log(numberA3); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > numberA3 +7 > ) +8 > ; +1 >Emitted(68, 5) Source(79, 5) + SourceIndex(0) +2 >Emitted(68, 12) Source(79, 12) + SourceIndex(0) +3 >Emitted(68, 13) Source(79, 13) + SourceIndex(0) +4 >Emitted(68, 16) Source(79, 16) + SourceIndex(0) +5 >Emitted(68, 17) Source(79, 17) + SourceIndex(0) +6 >Emitted(68, 25) Source(79, 25) + SourceIndex(0) +7 >Emitted(68, 26) Source(79, 26) + SourceIndex(0) +8 >Emitted(68, 27) Source(79, 27) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(69, 1) Source(80, 1) + SourceIndex(0) +2 >Emitted(69, 2) Source(80, 2) + SourceIndex(0) +--- +>>>for (var _r = [2, "trimmer", "trimming"], numberA3 = _r[0], robotAInfo = _r.slice(1), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^ +13> ^^^ +14> ^ +15> ^^ +16> ^ +17> ^^^ +18> ^ +19> ^^ +20> ^ +21> ^^ +22> ^^ +23> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > let [numberA3, ...robotAInfo] = [2, "trimmer", "trimming"] +7 > +8 > numberA3 +9 > , +10> ...robotAInfo +11> ] = [2, "trimmer", "trimming"], +12> i +13> = +14> 0 +15> ; +16> i +17> < +18> 1 +19> ; +20> i +21> ++ +22> ) +23> { +1->Emitted(70, 1) Source(81, 1) + SourceIndex(0) +2 >Emitted(70, 4) Source(81, 4) + SourceIndex(0) +3 >Emitted(70, 5) Source(81, 5) + SourceIndex(0) +4 >Emitted(70, 6) Source(81, 6) + SourceIndex(0) +5 >Emitted(70, 10) Source(81, 6) + SourceIndex(0) +6 >Emitted(70, 41) Source(81, 64) + SourceIndex(0) +7 >Emitted(70, 43) Source(81, 11) + SourceIndex(0) +8 >Emitted(70, 59) Source(81, 19) + SourceIndex(0) +9 >Emitted(70, 61) Source(81, 21) + SourceIndex(0) +10>Emitted(70, 85) Source(81, 34) + SourceIndex(0) +11>Emitted(70, 87) Source(81, 66) + SourceIndex(0) +12>Emitted(70, 88) Source(81, 67) + SourceIndex(0) +13>Emitted(70, 91) Source(81, 70) + SourceIndex(0) +14>Emitted(70, 92) Source(81, 71) + SourceIndex(0) +15>Emitted(70, 94) Source(81, 73) + SourceIndex(0) +16>Emitted(70, 95) Source(81, 74) + SourceIndex(0) +17>Emitted(70, 98) Source(81, 77) + SourceIndex(0) +18>Emitted(70, 99) Source(81, 78) + SourceIndex(0) +19>Emitted(70, 101) Source(81, 80) + SourceIndex(0) +20>Emitted(70, 102) Source(81, 81) + SourceIndex(0) +21>Emitted(70, 104) Source(81, 83) + SourceIndex(0) +22>Emitted(70, 106) Source(81, 85) + SourceIndex(0) +23>Emitted(70, 107) Source(81, 86) + SourceIndex(0) +--- +>>> console.log(numberA3); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > numberA3 +7 > ) +8 > ; +1 >Emitted(71, 5) Source(82, 5) + SourceIndex(0) +2 >Emitted(71, 12) Source(82, 12) + SourceIndex(0) +3 >Emitted(71, 13) Source(82, 13) + SourceIndex(0) +4 >Emitted(71, 16) Source(82, 16) + SourceIndex(0) +5 >Emitted(71, 17) Source(82, 17) + SourceIndex(0) +6 >Emitted(71, 25) Source(82, 25) + SourceIndex(0) +7 >Emitted(71, 26) Source(82, 26) + SourceIndex(0) +8 >Emitted(71, 27) Source(82, 27) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(72, 1) Source(83, 1) + SourceIndex(0) +2 >Emitted(72, 2) Source(83, 2) + SourceIndex(0) +--- +>>>for (var multiRobotAInfo = multiRobotA.slice(0), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +6 > ^^ +7 > ^ +8 > ^^^ +9 > ^ +10> ^^ +11> ^ +12> ^^^ +13> ^ +14> ^^ +15> ^ +16> ^^ +17> ^^ +18> ^ +1-> + > +2 >for +3 > +4 > (let [ +5 > ...multiRobotAInfo +6 > ] = multiRobotA, +7 > i +8 > = +9 > 0 +10> ; +11> i +12> < +13> 1 +14> ; +15> i +16> ++ +17> ) +18> { +1->Emitted(73, 1) Source(84, 1) + SourceIndex(0) +2 >Emitted(73, 4) Source(84, 4) + SourceIndex(0) +3 >Emitted(73, 5) Source(84, 5) + SourceIndex(0) +4 >Emitted(73, 6) Source(84, 11) + SourceIndex(0) +5 >Emitted(73, 48) Source(84, 29) + SourceIndex(0) +6 >Emitted(73, 50) Source(84, 46) + SourceIndex(0) +7 >Emitted(73, 51) Source(84, 47) + SourceIndex(0) +8 >Emitted(73, 54) Source(84, 50) + SourceIndex(0) +9 >Emitted(73, 55) Source(84, 51) + SourceIndex(0) +10>Emitted(73, 57) Source(84, 53) + SourceIndex(0) +11>Emitted(73, 58) Source(84, 54) + SourceIndex(0) +12>Emitted(73, 61) Source(84, 57) + SourceIndex(0) +13>Emitted(73, 62) Source(84, 58) + SourceIndex(0) +14>Emitted(73, 64) Source(84, 60) + SourceIndex(0) +15>Emitted(73, 65) Source(84, 61) + SourceIndex(0) +16>Emitted(73, 67) Source(84, 63) + SourceIndex(0) +17>Emitted(73, 69) Source(84, 65) + SourceIndex(0) +18>Emitted(73, 70) Source(84, 66) + SourceIndex(0) +--- +>>> console.log(multiRobotAInfo); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^^^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > multiRobotAInfo +7 > ) +8 > ; +1 >Emitted(74, 5) Source(85, 5) + SourceIndex(0) +2 >Emitted(74, 12) Source(85, 12) + SourceIndex(0) +3 >Emitted(74, 13) Source(85, 13) + SourceIndex(0) +4 >Emitted(74, 16) Source(85, 16) + SourceIndex(0) +5 >Emitted(74, 17) Source(85, 17) + SourceIndex(0) +6 >Emitted(74, 32) Source(85, 32) + SourceIndex(0) +7 >Emitted(74, 33) Source(85, 33) + SourceIndex(0) +8 >Emitted(74, 34) Source(85, 34) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(75, 1) Source(86, 1) + SourceIndex(0) +2 >Emitted(75, 2) Source(86, 2) + SourceIndex(0) +--- +>>>for (var multiRobotAInfo = getMultiRobot().slice(0), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +6 > ^^ +7 > ^ +8 > ^^^ +9 > ^ +10> ^^ +11> ^ +12> ^^^ +13> ^ +14> ^^ +15> ^ +16> ^^ +17> ^^ +18> ^ +1-> + > +2 >for +3 > +4 > (let [ +5 > ...multiRobotAInfo +6 > ] = getMultiRobot(), +7 > i +8 > = +9 > 0 +10> ; +11> i +12> < +13> 1 +14> ; +15> i +16> ++ +17> ) +18> { +1->Emitted(76, 1) Source(87, 1) + SourceIndex(0) +2 >Emitted(76, 4) Source(87, 4) + SourceIndex(0) +3 >Emitted(76, 5) Source(87, 5) + SourceIndex(0) +4 >Emitted(76, 6) Source(87, 11) + SourceIndex(0) +5 >Emitted(76, 52) Source(87, 29) + SourceIndex(0) +6 >Emitted(76, 54) Source(87, 50) + SourceIndex(0) +7 >Emitted(76, 55) Source(87, 51) + SourceIndex(0) +8 >Emitted(76, 58) Source(87, 54) + SourceIndex(0) +9 >Emitted(76, 59) Source(87, 55) + SourceIndex(0) +10>Emitted(76, 61) Source(87, 57) + SourceIndex(0) +11>Emitted(76, 62) Source(87, 58) + SourceIndex(0) +12>Emitted(76, 65) Source(87, 61) + SourceIndex(0) +13>Emitted(76, 66) Source(87, 62) + SourceIndex(0) +14>Emitted(76, 68) Source(87, 64) + SourceIndex(0) +15>Emitted(76, 69) Source(87, 65) + SourceIndex(0) +16>Emitted(76, 71) Source(87, 67) + SourceIndex(0) +17>Emitted(76, 73) Source(87, 69) + SourceIndex(0) +18>Emitted(76, 74) Source(87, 70) + SourceIndex(0) +--- +>>> console.log(multiRobotAInfo); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^^^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > multiRobotAInfo +7 > ) +8 > ; +1 >Emitted(77, 5) Source(88, 5) + SourceIndex(0) +2 >Emitted(77, 12) Source(88, 12) + SourceIndex(0) +3 >Emitted(77, 13) Source(88, 13) + SourceIndex(0) +4 >Emitted(77, 16) Source(88, 16) + SourceIndex(0) +5 >Emitted(77, 17) Source(88, 17) + SourceIndex(0) +6 >Emitted(77, 32) Source(88, 32) + SourceIndex(0) +7 >Emitted(77, 33) Source(88, 33) + SourceIndex(0) +8 >Emitted(77, 34) Source(88, 34) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(78, 1) Source(89, 1) + SourceIndex(0) +2 >Emitted(78, 2) Source(89, 2) + SourceIndex(0) +--- +>>>for (var multiRobotAInfo = ["trimmer", ["trimming", "edging"]].slice(0), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +6 > ^^ +7 > ^ +8 > ^^^ +9 > ^ +10> ^^ +11> ^ +12> ^^^ +13> ^ +14> ^^ +15> ^ +16> ^^ +17> ^^ +18> ^ +1-> + > +2 >for +3 > +4 > (let [ +5 > ...multiRobotAInfo +6 > ] = ["trimmer", ["trimming", "edging"]], +7 > i +8 > = +9 > 0 +10> ; +11> i +12> < +13> 1 +14> ; +15> i +16> ++ +17> ) +18> { +1->Emitted(79, 1) Source(90, 1) + SourceIndex(0) +2 >Emitted(79, 4) Source(90, 4) + SourceIndex(0) +3 >Emitted(79, 5) Source(90, 5) + SourceIndex(0) +4 >Emitted(79, 6) Source(90, 11) + SourceIndex(0) +5 >Emitted(79, 72) Source(90, 29) + SourceIndex(0) +6 >Emitted(79, 74) Source(90, 70) + SourceIndex(0) +7 >Emitted(79, 75) Source(90, 71) + SourceIndex(0) +8 >Emitted(79, 78) Source(90, 74) + SourceIndex(0) +9 >Emitted(79, 79) Source(90, 75) + SourceIndex(0) +10>Emitted(79, 81) Source(90, 77) + SourceIndex(0) +11>Emitted(79, 82) Source(90, 78) + SourceIndex(0) +12>Emitted(79, 85) Source(90, 81) + SourceIndex(0) +13>Emitted(79, 86) Source(90, 82) + SourceIndex(0) +14>Emitted(79, 88) Source(90, 84) + SourceIndex(0) +15>Emitted(79, 89) Source(90, 85) + SourceIndex(0) +16>Emitted(79, 91) Source(90, 87) + SourceIndex(0) +17>Emitted(79, 93) Source(90, 89) + SourceIndex(0) +18>Emitted(79, 94) Source(90, 90) + SourceIndex(0) +--- +>>> console.log(multiRobotAInfo); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^^^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > multiRobotAInfo +7 > ) +8 > ; +1 >Emitted(80, 5) Source(91, 5) + SourceIndex(0) +2 >Emitted(80, 12) Source(91, 12) + SourceIndex(0) +3 >Emitted(80, 13) Source(91, 13) + SourceIndex(0) +4 >Emitted(80, 16) Source(91, 16) + SourceIndex(0) +5 >Emitted(80, 17) Source(91, 17) + SourceIndex(0) +6 >Emitted(80, 32) Source(91, 32) + SourceIndex(0) +7 >Emitted(80, 33) Source(91, 33) + SourceIndex(0) +8 >Emitted(80, 34) Source(91, 34) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(81, 1) Source(92, 1) + SourceIndex(0) +2 >Emitted(81, 2) Source(92, 2) + SourceIndex(0) +--- +>>>//# sourceMappingURL=sourceMapValidationDestructuringForArrayBindingPattern.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPattern.symbols b/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPattern.symbols new file mode 100644 index 00000000000..4e2131ff295 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPattern.symbols @@ -0,0 +1,365 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringForArrayBindingPattern.ts === +declare var console: { +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 0, 11)) + + log(msg: any): void; +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 0, 22)) +>msg : Symbol(msg, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 1, 8)) +} +type Robot = [number, string, string]; +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 2, 1)) + +type MultiSkilledRobot = [string, [string, string]]; +>MultiSkilledRobot : Symbol(MultiSkilledRobot, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 3, 38)) + +let robotA: Robot = [1, "mower", "mowing"]; +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 6, 3)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 2, 1)) + +function getRobot() { +>getRobot : Symbol(getRobot, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 6, 43)) + + return robotA; +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 6, 3)) +} + +let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; +>multiRobotA : Symbol(multiRobotA, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 11, 3)) +>MultiSkilledRobot : Symbol(MultiSkilledRobot, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 3, 38)) + +let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; +>multiRobotB : Symbol(multiRobotB, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 12, 3)) +>MultiSkilledRobot : Symbol(MultiSkilledRobot, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 3, 38)) + +function getMultiRobot() { +>getMultiRobot : Symbol(getMultiRobot, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 12, 73)) + + return multiRobotA; +>multiRobotA : Symbol(multiRobotA, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 11, 3)) +} + +for (let [, nameA] = robotA, i = 0; i < 1; i++) { +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 17, 11)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 6, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 17, 28)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 17, 28)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 17, 28)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 17, 11)) +} +for (let [, nameA] = getRobot(), i = 0; i < 1; i++) { +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 20, 11)) +>getRobot : Symbol(getRobot, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 6, 43)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 20, 32)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 20, 32)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 20, 32)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 20, 11)) +} +for (let [, nameA] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 23, 11)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 23, 48)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 23, 48)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 23, 48)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 23, 11)) +} +for (let [, [primarySkillA, secondarySkillA]] = multiRobotA, i = 0; i < 1; i++) { +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 26, 13)) +>secondarySkillA : Symbol(secondarySkillA, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 26, 27)) +>multiRobotA : Symbol(multiRobotA, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 11, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 26, 60)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 26, 60)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 26, 60)) + + console.log(primarySkillA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 0, 22)) +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 26, 13)) +} +for (let [, [primarySkillA, secondarySkillA]] = getMultiRobot(), i = 0; i < 1; i++) { +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 29, 13)) +>secondarySkillA : Symbol(secondarySkillA, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 29, 27)) +>getMultiRobot : Symbol(getMultiRobot, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 12, 73)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 29, 64)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 29, 64)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 29, 64)) + + console.log(primarySkillA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 0, 22)) +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 29, 13)) +} +for (let [, [primarySkillA, secondarySkillA]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 32, 13)) +>secondarySkillA : Symbol(secondarySkillA, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 32, 27)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 32, 84)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 32, 84)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 32, 84)) + + console.log(primarySkillA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 0, 22)) +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 32, 13)) +} + +for (let [numberB] = robotA, i = 0; i < 1; i++) { +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 36, 10)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 6, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 36, 28)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 36, 28)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 36, 28)) + + console.log(numberB); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 0, 22)) +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 36, 10)) +} +for (let [numberB] = getRobot(), i = 0; i < 1; i++) { +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 39, 10)) +>getRobot : Symbol(getRobot, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 6, 43)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 39, 32)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 39, 32)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 39, 32)) + + console.log(numberB); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 0, 22)) +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 39, 10)) +} +for (let [numberB] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 42, 10)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 42, 48)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 42, 48)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 42, 48)) + + console.log(numberB); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 0, 22)) +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 42, 10)) +} +for (let [nameB] = multiRobotA, i = 0; i < 1; i++) { +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 45, 10)) +>multiRobotA : Symbol(multiRobotA, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 11, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 45, 31)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 45, 31)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 45, 31)) + + console.log(nameB); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 0, 22)) +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 45, 10)) +} +for (let [nameB] = getMultiRobot(), i = 0; i < 1; i++) { +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 48, 10)) +>getMultiRobot : Symbol(getMultiRobot, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 12, 73)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 48, 35)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 48, 35)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 48, 35)) + + console.log(nameB); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 0, 22)) +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 48, 10)) +} +for (let [nameB] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 51, 10)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 51, 55)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 51, 55)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 51, 55)) + + console.log(nameB); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 0, 22)) +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 51, 10)) +} + +for (let [numberA2, nameA2, skillA2] = robotA, i = 0; i < 1; i++) { +>numberA2 : Symbol(numberA2, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 55, 10)) +>nameA2 : Symbol(nameA2, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 55, 19)) +>skillA2 : Symbol(skillA2, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 55, 27)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 6, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 55, 46)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 55, 46)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 55, 46)) + + console.log(nameA2); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 0, 22)) +>nameA2 : Symbol(nameA2, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 55, 19)) +} +for (let [numberA2, nameA2, skillA2] = getRobot(), i = 0; i < 1; i++) { +>numberA2 : Symbol(numberA2, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 58, 10)) +>nameA2 : Symbol(nameA2, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 58, 19)) +>skillA2 : Symbol(skillA2, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 58, 27)) +>getRobot : Symbol(getRobot, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 6, 43)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 58, 50)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 58, 50)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 58, 50)) + + console.log(nameA2); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 0, 22)) +>nameA2 : Symbol(nameA2, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 58, 19)) +} +for (let [numberA2, nameA2, skillA2] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { +>numberA2 : Symbol(numberA2, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 61, 10)) +>nameA2 : Symbol(nameA2, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 61, 19)) +>skillA2 : Symbol(skillA2, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 61, 27)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 61, 66)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 61, 66)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 61, 66)) + + console.log(nameA2); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 0, 22)) +>nameA2 : Symbol(nameA2, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 61, 19)) +} +for (let [nameMA, [primarySkillA, secondarySkillA]] = multiRobotA, i = 0; i < 1; i++) { +>nameMA : Symbol(nameMA, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 64, 10)) +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 64, 19)) +>secondarySkillA : Symbol(secondarySkillA, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 64, 33)) +>multiRobotA : Symbol(multiRobotA, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 11, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 64, 66)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 64, 66)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 64, 66)) + + console.log(nameMA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 0, 22)) +>nameMA : Symbol(nameMA, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 64, 10)) +} +for (let [nameMA, [primarySkillA, secondarySkillA]] = getMultiRobot(), i = 0; i < 1; i++) { +>nameMA : Symbol(nameMA, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 67, 10)) +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 67, 19)) +>secondarySkillA : Symbol(secondarySkillA, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 67, 33)) +>getMultiRobot : Symbol(getMultiRobot, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 12, 73)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 67, 70)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 67, 70)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 67, 70)) + + console.log(nameMA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 0, 22)) +>nameMA : Symbol(nameMA, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 67, 10)) +} +for (let [nameMA, [primarySkillA, secondarySkillA]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { +>nameMA : Symbol(nameMA, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 70, 10)) +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 70, 19)) +>secondarySkillA : Symbol(secondarySkillA, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 70, 33)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 70, 90)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 70, 90)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 70, 90)) + + console.log(nameMA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 0, 22)) +>nameMA : Symbol(nameMA, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 70, 10)) +} + +for (let [numberA3, ...robotAInfo] = robotA, i = 0; i < 1; i++) { +>numberA3 : Symbol(numberA3, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 74, 10)) +>robotAInfo : Symbol(robotAInfo, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 74, 19)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 6, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 74, 44)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 74, 44)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 74, 44)) + + console.log(numberA3); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 0, 22)) +>numberA3 : Symbol(numberA3, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 74, 10)) +} +for (let [numberA3, ...robotAInfo] = getRobot(), i = 0; i < 1; i++) { +>numberA3 : Symbol(numberA3, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 77, 10)) +>robotAInfo : Symbol(robotAInfo, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 77, 19)) +>getRobot : Symbol(getRobot, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 6, 43)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 77, 48)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 77, 48)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 77, 48)) + + console.log(numberA3); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 0, 22)) +>numberA3 : Symbol(numberA3, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 77, 10)) +} +for (let [numberA3, ...robotAInfo] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { +>numberA3 : Symbol(numberA3, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 80, 10)) +>robotAInfo : Symbol(robotAInfo, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 80, 19)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 80, 64)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 80, 64)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 80, 64)) + + console.log(numberA3); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 0, 22)) +>numberA3 : Symbol(numberA3, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 80, 10)) +} +for (let [...multiRobotAInfo] = multiRobotA, i = 0; i < 1; i++) { +>multiRobotAInfo : Symbol(multiRobotAInfo, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 83, 10)) +>multiRobotA : Symbol(multiRobotA, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 11, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 83, 44)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 83, 44)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 83, 44)) + + console.log(multiRobotAInfo); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 0, 22)) +>multiRobotAInfo : Symbol(multiRobotAInfo, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 83, 10)) +} +for (let [...multiRobotAInfo] = getMultiRobot(), i = 0; i < 1; i++) { +>multiRobotAInfo : Symbol(multiRobotAInfo, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 86, 10)) +>getMultiRobot : Symbol(getMultiRobot, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 12, 73)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 86, 48)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 86, 48)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 86, 48)) + + console.log(multiRobotAInfo); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 0, 22)) +>multiRobotAInfo : Symbol(multiRobotAInfo, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 86, 10)) +} +for (let [...multiRobotAInfo] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { +>multiRobotAInfo : Symbol(multiRobotAInfo, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 89, 10)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 89, 68)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 89, 68)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 89, 68)) + + console.log(multiRobotAInfo); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 0, 22)) +>multiRobotAInfo : Symbol(multiRobotAInfo, Decl(sourceMapValidationDestructuringForArrayBindingPattern.ts, 89, 10)) +} diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPattern.types b/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPattern.types new file mode 100644 index 00000000000..fbe264eeeae --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPattern.types @@ -0,0 +1,549 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringForArrayBindingPattern.ts === +declare var console: { +>console : { log(msg: any): void; } + + log(msg: any): void; +>log : (msg: any) => void +>msg : any +} +type Robot = [number, string, string]; +>Robot : [number, string, string] + +type MultiSkilledRobot = [string, [string, string]]; +>MultiSkilledRobot : [string, [string, string]] + +let robotA: Robot = [1, "mower", "mowing"]; +>robotA : [number, string, string] +>Robot : [number, string, string] +>[1, "mower", "mowing"] : [number, string, string] +>1 : number +>"mower" : string +>"mowing" : string + +function getRobot() { +>getRobot : () => [number, string, string] + + return robotA; +>robotA : [number, string, string] +} + +let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; +>multiRobotA : [string, [string, string]] +>MultiSkilledRobot : [string, [string, string]] +>["mower", ["mowing", ""]] : [string, [string, string]] +>"mower" : string +>["mowing", ""] : [string, string] +>"mowing" : string +>"" : string + +let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; +>multiRobotB : [string, [string, string]] +>MultiSkilledRobot : [string, [string, string]] +>["trimmer", ["trimming", "edging"]] : [string, [string, string]] +>"trimmer" : string +>["trimming", "edging"] : [string, string] +>"trimming" : string +>"edging" : string + +function getMultiRobot() { +>getMultiRobot : () => [string, [string, string]] + + return multiRobotA; +>multiRobotA : [string, [string, string]] +} + +for (let [, nameA] = robotA, i = 0; i < 1; i++) { +> : undefined +>nameA : string +>robotA : [number, string, string] +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for (let [, nameA] = getRobot(), i = 0; i < 1; i++) { +> : undefined +>nameA : string +>getRobot() : [number, string, string] +>getRobot : () => [number, string, string] +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for (let [, nameA] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { +> : undefined +>nameA : string +>[2, "trimmer", "trimming"] : [number, string, string] +>2 : number +>"trimmer" : string +>"trimming" : string +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for (let [, [primarySkillA, secondarySkillA]] = multiRobotA, i = 0; i < 1; i++) { +> : undefined +>primarySkillA : string +>secondarySkillA : string +>multiRobotA : [string, [string, string]] +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(primarySkillA); +>console.log(primarySkillA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primarySkillA : string +} +for (let [, [primarySkillA, secondarySkillA]] = getMultiRobot(), i = 0; i < 1; i++) { +> : undefined +>primarySkillA : string +>secondarySkillA : string +>getMultiRobot() : [string, [string, string]] +>getMultiRobot : () => [string, [string, string]] +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(primarySkillA); +>console.log(primarySkillA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primarySkillA : string +} +for (let [, [primarySkillA, secondarySkillA]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { +> : undefined +>primarySkillA : string +>secondarySkillA : string +>["trimmer", ["trimming", "edging"]] : [string, [string, string]] +>"trimmer" : string +>["trimming", "edging"] : [string, string] +>"trimming" : string +>"edging" : string +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(primarySkillA); +>console.log(primarySkillA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primarySkillA : string +} + +for (let [numberB] = robotA, i = 0; i < 1; i++) { +>numberB : number +>robotA : [number, string, string] +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(numberB); +>console.log(numberB) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>numberB : number +} +for (let [numberB] = getRobot(), i = 0; i < 1; i++) { +>numberB : number +>getRobot() : [number, string, string] +>getRobot : () => [number, string, string] +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(numberB); +>console.log(numberB) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>numberB : number +} +for (let [numberB] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { +>numberB : number +>[2, "trimmer", "trimming"] : [number, string, string] +>2 : number +>"trimmer" : string +>"trimming" : string +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(numberB); +>console.log(numberB) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>numberB : number +} +for (let [nameB] = multiRobotA, i = 0; i < 1; i++) { +>nameB : string +>multiRobotA : [string, [string, string]] +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameB); +>console.log(nameB) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameB : string +} +for (let [nameB] = getMultiRobot(), i = 0; i < 1; i++) { +>nameB : string +>getMultiRobot() : [string, [string, string]] +>getMultiRobot : () => [string, [string, string]] +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameB); +>console.log(nameB) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameB : string +} +for (let [nameB] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { +>nameB : string +>["trimmer", ["trimming", "edging"]] : [string, string[]] +>"trimmer" : string +>["trimming", "edging"] : string[] +>"trimming" : string +>"edging" : string +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameB); +>console.log(nameB) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameB : string +} + +for (let [numberA2, nameA2, skillA2] = robotA, i = 0; i < 1; i++) { +>numberA2 : number +>nameA2 : string +>skillA2 : string +>robotA : [number, string, string] +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameA2); +>console.log(nameA2) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA2 : string +} +for (let [numberA2, nameA2, skillA2] = getRobot(), i = 0; i < 1; i++) { +>numberA2 : number +>nameA2 : string +>skillA2 : string +>getRobot() : [number, string, string] +>getRobot : () => [number, string, string] +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameA2); +>console.log(nameA2) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA2 : string +} +for (let [numberA2, nameA2, skillA2] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { +>numberA2 : number +>nameA2 : string +>skillA2 : string +>[2, "trimmer", "trimming"] : [number, string, string] +>2 : number +>"trimmer" : string +>"trimming" : string +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameA2); +>console.log(nameA2) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA2 : string +} +for (let [nameMA, [primarySkillA, secondarySkillA]] = multiRobotA, i = 0; i < 1; i++) { +>nameMA : string +>primarySkillA : string +>secondarySkillA : string +>multiRobotA : [string, [string, string]] +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameMA); +>console.log(nameMA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameMA : string +} +for (let [nameMA, [primarySkillA, secondarySkillA]] = getMultiRobot(), i = 0; i < 1; i++) { +>nameMA : string +>primarySkillA : string +>secondarySkillA : string +>getMultiRobot() : [string, [string, string]] +>getMultiRobot : () => [string, [string, string]] +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameMA); +>console.log(nameMA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameMA : string +} +for (let [nameMA, [primarySkillA, secondarySkillA]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { +>nameMA : string +>primarySkillA : string +>secondarySkillA : string +>["trimmer", ["trimming", "edging"]] : [string, [string, string]] +>"trimmer" : string +>["trimming", "edging"] : [string, string] +>"trimming" : string +>"edging" : string +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameMA); +>console.log(nameMA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameMA : string +} + +for (let [numberA3, ...robotAInfo] = robotA, i = 0; i < 1; i++) { +>numberA3 : number +>robotAInfo : (number | string)[] +>robotA : [number, string, string] +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(numberA3); +>console.log(numberA3) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>numberA3 : number +} +for (let [numberA3, ...robotAInfo] = getRobot(), i = 0; i < 1; i++) { +>numberA3 : number +>robotAInfo : (number | string)[] +>getRobot() : [number, string, string] +>getRobot : () => [number, string, string] +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(numberA3); +>console.log(numberA3) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>numberA3 : number +} +for (let [numberA3, ...robotAInfo] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { +>numberA3 : number | string +>robotAInfo : (number | string)[] +>[2, "trimmer", "trimming"] : (number | string)[] +>2 : number +>"trimmer" : string +>"trimming" : string +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(numberA3); +>console.log(numberA3) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>numberA3 : number | string +} +for (let [...multiRobotAInfo] = multiRobotA, i = 0; i < 1; i++) { +>multiRobotAInfo : (string | [string, string])[] +>multiRobotA : [string, [string, string]] +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(multiRobotAInfo); +>console.log(multiRobotAInfo) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>multiRobotAInfo : (string | [string, string])[] +} +for (let [...multiRobotAInfo] = getMultiRobot(), i = 0; i < 1; i++) { +>multiRobotAInfo : (string | [string, string])[] +>getMultiRobot() : [string, [string, string]] +>getMultiRobot : () => [string, [string, string]] +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(multiRobotAInfo); +>console.log(multiRobotAInfo) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>multiRobotAInfo : (string | [string, string])[] +} +for (let [...multiRobotAInfo] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { +>multiRobotAInfo : (string | string[])[] +>["trimmer", ["trimming", "edging"]] : (string | string[])[] +>"trimmer" : string +>["trimming", "edging"] : string[] +>"trimming" : string +>"edging" : string +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(multiRobotAInfo); +>console.log(multiRobotAInfo) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>multiRobotAInfo : (string | string[])[] +} diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPattern2.js b/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPattern2.js new file mode 100644 index 00000000000..aad4d79ddd1 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPattern2.js @@ -0,0 +1,189 @@ +//// [sourceMapValidationDestructuringForArrayBindingPattern2.ts] +declare var console: { + log(msg: any): void; +} +type Robot = [number, string, string]; +type MultiSkilledRobot = [string, [string, string]]; + +let robotA: Robot = [1, "mower", "mowing"]; +function getRobot() { + return robotA; +} + +let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; +let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; +function getMultiRobot() { + return multiRobotA; +} + +let nameA: string, primarySkillA: string, secondarySkillA: string; +let numberB: number, nameB: string; +let numberA2: number, nameA2: string, skillA2: string, nameMA: string; +let numberA3: number, robotAInfo: (number | string)[], multiRobotAInfo: (string | [string, string])[]; +let i: number; + +for ([, nameA] = robotA, i = 0; i < 1; i++) { + console.log(nameA); +} +for ([, nameA] = getRobot(), i = 0; i < 1; i++) { + console.log(nameA); +} +for ([, nameA] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + console.log(nameA); +} +for ([, [primarySkillA, secondarySkillA]] = multiRobotA, i = 0; i < 1; i++) { + console.log(primarySkillA); +} +for ([, [primarySkillA, secondarySkillA]] = getMultiRobot(), i = 0; i < 1; i++) { + console.log(primarySkillA); +} +for ([, [primarySkillA, secondarySkillA]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + console.log(primarySkillA); +} + +for ([numberB] = robotA, i = 0; i < 1; i++) { + console.log(numberB); +} +for ([numberB] = getRobot(), i = 0; i < 1; i++) { + console.log(numberB); +} +for ([numberB] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + console.log(numberB); +} +for ([nameB] = multiRobotA, i = 0; i < 1; i++) { + console.log(nameB); +} +for ([nameB] = getMultiRobot(), i = 0; i < 1; i++) { + console.log(nameB); +} +for ([nameB] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + console.log(nameB); +} + +for ([numberA2, nameA2, skillA2] = robotA, i = 0; i < 1; i++) { + console.log(nameA2); +} +for ([numberA2, nameA2, skillA2] = getRobot(), i = 0; i < 1; i++) { + console.log(nameA2); +} +for ([numberA2, nameA2, skillA2] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + console.log(nameA2); +} +for ([nameMA, [primarySkillA, secondarySkillA]] = multiRobotA, i = 0; i < 1; i++) { + console.log(nameMA); +} +for ([nameMA, [primarySkillA, secondarySkillA]] = getMultiRobot(), i = 0; i < 1; i++) { + console.log(nameMA); +} +for ([nameMA, [primarySkillA, secondarySkillA]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + console.log(nameMA); +} + +for ([numberA3, ...robotAInfo] = robotA, i = 0; i < 1; i++) { + console.log(numberA3); +} +for ([numberA3, ...robotAInfo] = getRobot(), i = 0; i < 1; i++) { + console.log(numberA3); +} +for ([numberA3, ...robotAInfo] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + console.log(numberA3); +} +for ([...multiRobotAInfo] = multiRobotA, i = 0; i < 1; i++) { + console.log(multiRobotAInfo); +} +for ([...multiRobotAInfo] = getMultiRobot(), i = 0; i < 1; i++) { + console.log(multiRobotAInfo); +} +for ([...multiRobotAInfo] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + console.log(multiRobotAInfo); +} + +//// [sourceMapValidationDestructuringForArrayBindingPattern2.js] +var robotA = [1, "mower", "mowing"]; +function getRobot() { + return robotA; +} +var multiRobotA = ["mower", ["mowing", ""]]; +var multiRobotB = ["trimmer", ["trimming", "edging"]]; +function getMultiRobot() { + return multiRobotA; +} +var nameA, primarySkillA, secondarySkillA; +var numberB, nameB; +var numberA2, nameA2, skillA2, nameMA; +var numberA3, robotAInfo, multiRobotAInfo; +var i; +for ((nameA = robotA[1], robotA), i = 0; i < 1; i++) { + console.log(nameA); +} +for ((_a = getRobot(), nameA = _a[1], _a), i = 0; i < 1; i++) { + console.log(nameA); +} +for ((_b = [2, "trimmer", "trimming"], nameA = _b[1], _b), i = 0; i < 1; i++) { + console.log(nameA); +} +for ((_c = multiRobotA[1], primarySkillA = _c[0], secondarySkillA = _c[1], multiRobotA), i = 0; i < 1; i++) { + console.log(primarySkillA); +} +for ((_d = getMultiRobot(), _e = _d[1], primarySkillA = _e[0], secondarySkillA = _e[1], _d), i = 0; i < 1; i++) { + console.log(primarySkillA); +} +for ((_f = ["trimmer", ["trimming", "edging"]], _g = _f[1], primarySkillA = _g[0], secondarySkillA = _g[1], _f), i = 0; i < 1; i++) { + console.log(primarySkillA); +} +for ((numberB = robotA[0], robotA), i = 0; i < 1; i++) { + console.log(numberB); +} +for ((_h = getRobot(), numberB = _h[0], _h), i = 0; i < 1; i++) { + console.log(numberB); +} +for ((_j = [2, "trimmer", "trimming"], numberB = _j[0], _j), i = 0; i < 1; i++) { + console.log(numberB); +} +for ((nameB = multiRobotA[0], multiRobotA), i = 0; i < 1; i++) { + console.log(nameB); +} +for ((_k = getMultiRobot(), nameB = _k[0], _k), i = 0; i < 1; i++) { + console.log(nameB); +} +for ((_l = ["trimmer", ["trimming", "edging"]], nameB = _l[0], _l), i = 0; i < 1; i++) { + console.log(nameB); +} +for ((numberA2 = robotA[0], nameA2 = robotA[1], skillA2 = robotA[2], robotA), i = 0; i < 1; i++) { + console.log(nameA2); +} +for ((_m = getRobot(), numberA2 = _m[0], nameA2 = _m[1], skillA2 = _m[2], _m), i = 0; i < 1; i++) { + console.log(nameA2); +} +for ((_o = [2, "trimmer", "trimming"], numberA2 = _o[0], nameA2 = _o[1], skillA2 = _o[2], _o), i = 0; i < 1; i++) { + console.log(nameA2); +} +for ((nameMA = multiRobotA[0], _p = multiRobotA[1], primarySkillA = _p[0], secondarySkillA = _p[1], multiRobotA), i = 0; i < 1; i++) { + console.log(nameMA); +} +for ((_q = getMultiRobot(), nameMA = _q[0], _r = _q[1], primarySkillA = _r[0], secondarySkillA = _r[1], _q), i = 0; i < 1; i++) { + console.log(nameMA); +} +for ((_s = ["trimmer", ["trimming", "edging"]], nameMA = _s[0], _t = _s[1], primarySkillA = _t[0], secondarySkillA = _t[1], _s), i = 0; i < 1; i++) { + console.log(nameMA); +} +for ((numberA3 = robotA[0], robotAInfo = robotA.slice(1), robotA), i = 0; i < 1; i++) { + console.log(numberA3); +} +for ((_u = getRobot(), numberA3 = _u[0], robotAInfo = _u.slice(1), _u), i = 0; i < 1; i++) { + console.log(numberA3); +} +for ((_v = [2, "trimmer", "trimming"], numberA3 = _v[0], robotAInfo = _v.slice(1), _v), i = 0; i < 1; i++) { + console.log(numberA3); +} +for ((multiRobotAInfo = multiRobotA.slice(0), multiRobotA), i = 0; i < 1; i++) { + console.log(multiRobotAInfo); +} +for ((_w = getMultiRobot(), multiRobotAInfo = _w.slice(0), _w), i = 0; i < 1; i++) { + console.log(multiRobotAInfo); +} +for ((_x = ["trimmer", ["trimming", "edging"]], multiRobotAInfo = _x.slice(0), _x), i = 0; i < 1; i++) { + console.log(multiRobotAInfo); +} +var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x; +//# sourceMappingURL=sourceMapValidationDestructuringForArrayBindingPattern2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPattern2.js.map b/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPattern2.js.map new file mode 100644 index 00000000000..046cd61ad40 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPattern2.js.map @@ -0,0 +1,2 @@ +//// [sourceMapValidationDestructuringForArrayBindingPattern2.js.map] +{"version":3,"file":"sourceMapValidationDestructuringForArrayBindingPattern2.js","sourceRoot":"","sources":["sourceMapValidationDestructuringForArrayBindingPattern2.ts"],"names":[],"mappings":"AAMA,IAAI,MAAM,GAAU,CAAC,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;AAC3C;IACI,MAAM,CAAC,MAAM,CAAC;AAClB,CAAC;AAED,IAAI,WAAW,GAAsB,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC;AAC/D,IAAI,WAAW,GAAsB,CAAC,SAAS,EAAE,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC,CAAC;AACzE;IACI,MAAM,CAAC,WAAW,CAAC;AACvB,CAAC;AAED,IAAI,KAAa,EAAE,aAAqB,EAAE,eAAuB,CAAC;AAClE,IAAI,OAAe,EAAE,KAAa,CAAC;AACnC,IAAI,QAAgB,EAAE,MAAc,EAAE,OAAe,EAAE,MAAc,CAAC;AACtE,IAAI,QAAgB,EAAE,UAA+B,EAAE,eAA8C,CAAC;AACtG,IAAI,CAAS,CAAC;AAEd,GAAG,CAAC,CAAC,CAAG,iBAAK,EAAI,MAAM,CAAA,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACzC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AACD,GAAG,CAAC,CAAC,CAAA,eAAsB,EAAnB,aAAK,KAAc,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IAC7C,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AACD,GAAG,CAAC,CAAC,CAAA,+BAAsC,EAAnC,aAAK,KAA8B,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IAC7D,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AACD,GAAG,CAAC,CAAC,CAAG,mBAAgC,EAA/B,qBAAa,EAAE,uBAAe,EAAK,WAAW,CAAA,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACzE,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;AAC/B,CAAC;AACD,GAAG,CAAC,CAAC,CAAA,oBAAsD,EAAnD,UAAgC,EAA/B,qBAAa,EAAE,uBAAe,KAAoB,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IAC7E,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;AAC/B,CAAC;AACD,GAAG,CAAC,CAAC,CAAA,wCAA0E,EAAvE,UAAgC,EAA/B,qBAAa,EAAE,uBAAe,KAAwC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACjG,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;AAC/B,CAAC;AAED,GAAG,CAAC,CAAC,CAAC,mBAAO,EAAI,MAAM,CAAA,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACzC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AACzB,CAAC;AACD,GAAG,CAAC,CAAC,CAAA,eAAsB,EAArB,eAAO,KAAc,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IAC7C,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AACzB,CAAC;AACD,GAAG,CAAC,CAAC,CAAA,+BAAsC,EAArC,eAAO,KAA8B,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IAC7D,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AACzB,CAAC;AACD,GAAG,CAAC,CAAC,CAAC,sBAAK,EAAI,WAAW,CAAA,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IAC5C,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AACD,GAAG,CAAC,CAAC,CAAA,oBAAyB,EAAxB,aAAK,KAAmB,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IAChD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AACD,GAAG,CAAC,CAAC,CAAA,wCAA6C,EAA5C,aAAK,KAAuC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACpE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AAED,GAAG,CAAC,CAAC,CAAC,oBAAQ,EAAE,kBAAM,EAAE,mBAAO,EAAI,MAAM,CAAA,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IAC3D,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACxB,CAAC;AACD,GAAG,CAAC,CAAC,CAAA,eAAwC,EAAvC,gBAAQ,EAAE,cAAM,EAAE,eAAO,KAAc,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IAC/D,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACxB,CAAC;AACD,GAAG,CAAC,CAAC,CAAA,+BAAwD,EAAvD,gBAAQ,EAAE,cAAM,EAAE,eAAO,KAA8B,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IAC/E,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACxB,CAAC;AACD,GAAG,CAAC,CAAC,CAAC,uBAAM,EAAE,mBAAgC,EAA/B,qBAAa,EAAE,uBAAe,EAAK,WAAW,CAAA,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IAC/E,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACxB,CAAC;AACD,GAAG,CAAC,CAAC,CAAA,oBAA4D,EAA3D,cAAM,EAAE,UAAgC,EAA/B,qBAAa,EAAE,uBAAe,KAAoB,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACnF,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACxB,CAAC;AACD,GAAG,CAAC,CAAC,CAAA,wCAAgF,EAA/E,cAAM,EAAE,UAAgC,EAA/B,qBAAa,EAAE,uBAAe,KAAwC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACvG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACxB,CAAC;AAED,GAAG,CAAC,CAAC,CAAC,oBAAQ,EAAE,4BAAa,EAAI,MAAM,CAAA,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACzD,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAC1B,CAAC;AACD,GAAG,CAAC,CAAC,CAAA,eAAsC,EAArC,gBAAQ,EAAE,wBAAa,KAAc,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IAC7D,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAC1B,CAAC;AACD,GAAG,CAAC,CAAC,CAAA,+BAA6D,EAA5D,gBAAQ,EAAE,wBAAa,KAAqC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACpF,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAC1B,CAAC;AACD,GAAG,CAAC,CAAC,CAAC,sCAAkB,EAAI,WAAW,CAAA,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACzD,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;AACjC,CAAC;AACD,GAAG,CAAC,CAAC,CAAA,oBAAsC,EAArC,6BAAkB,KAAmB,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IAC7D,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;AACjC,CAAC;AACD,GAAG,CAAC,CAAC,CAAA,wCAA6E,EAA5E,6BAAkB,KAA0D,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACpG,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;AACjC,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPattern2.sourcemap.txt b/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPattern2.sourcemap.txt new file mode 100644 index 00000000000..186dc717e61 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPattern2.sourcemap.txt @@ -0,0 +1,3037 @@ +=================================================================== +JsFile: sourceMapValidationDestructuringForArrayBindingPattern2.js +mapUrl: sourceMapValidationDestructuringForArrayBindingPattern2.js.map +sourceRoot: +sources: sourceMapValidationDestructuringForArrayBindingPattern2.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/sourceMapValidationDestructuringForArrayBindingPattern2.js +sourceFile:sourceMapValidationDestructuringForArrayBindingPattern2.ts +------------------------------------------------------------------- +>>>var robotA = [1, "mower", "mowing"]; +1 > +2 >^^^^ +3 > ^^^^^^ +4 > ^^^ +5 > ^ +6 > ^ +7 > ^^ +8 > ^^^^^^^ +9 > ^^ +10> ^^^^^^^^ +11> ^ +12> ^ +1 >declare var console: { + > log(msg: any): void; + >} + >type Robot = [number, string, string]; + >type MultiSkilledRobot = [string, [string, string]]; + > + > +2 >let +3 > robotA +4 > : Robot = +5 > [ +6 > 1 +7 > , +8 > "mower" +9 > , +10> "mowing" +11> ] +12> ; +1 >Emitted(1, 1) Source(7, 1) + SourceIndex(0) +2 >Emitted(1, 5) Source(7, 5) + SourceIndex(0) +3 >Emitted(1, 11) Source(7, 11) + SourceIndex(0) +4 >Emitted(1, 14) Source(7, 21) + SourceIndex(0) +5 >Emitted(1, 15) Source(7, 22) + SourceIndex(0) +6 >Emitted(1, 16) Source(7, 23) + SourceIndex(0) +7 >Emitted(1, 18) Source(7, 25) + SourceIndex(0) +8 >Emitted(1, 25) Source(7, 32) + SourceIndex(0) +9 >Emitted(1, 27) Source(7, 34) + SourceIndex(0) +10>Emitted(1, 35) Source(7, 42) + SourceIndex(0) +11>Emitted(1, 36) Source(7, 43) + SourceIndex(0) +12>Emitted(1, 37) Source(7, 44) + SourceIndex(0) +--- +>>>function getRobot() { +1 > +2 >^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(2, 1) Source(8, 1) + SourceIndex(0) +--- +>>> return robotA; +1->^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^ +5 > ^ +1->function getRobot() { + > +2 > return +3 > +4 > robotA +5 > ; +1->Emitted(3, 5) Source(9, 5) + SourceIndex(0) +2 >Emitted(3, 11) Source(9, 11) + SourceIndex(0) +3 >Emitted(3, 12) Source(9, 12) + SourceIndex(0) +4 >Emitted(3, 18) Source(9, 18) + SourceIndex(0) +5 >Emitted(3, 19) Source(9, 19) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(4, 1) Source(10, 1) + SourceIndex(0) +2 >Emitted(4, 2) Source(10, 2) + SourceIndex(0) +--- +>>>var multiRobotA = ["mower", ["mowing", ""]]; +1-> +2 >^^^^ +3 > ^^^^^^^^^^^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^ +7 > ^^ +8 > ^ +9 > ^^^^^^^^ +10> ^^ +11> ^^ +12> ^ +13> ^ +14> ^ +15> ^^^^^^^^^^^-> +1-> + > + > +2 >let +3 > multiRobotA +4 > : MultiSkilledRobot = +5 > [ +6 > "mower" +7 > , +8 > [ +9 > "mowing" +10> , +11> "" +12> ] +13> ] +14> ; +1->Emitted(5, 1) Source(12, 1) + SourceIndex(0) +2 >Emitted(5, 5) Source(12, 5) + SourceIndex(0) +3 >Emitted(5, 16) Source(12, 16) + SourceIndex(0) +4 >Emitted(5, 19) Source(12, 38) + SourceIndex(0) +5 >Emitted(5, 20) Source(12, 39) + SourceIndex(0) +6 >Emitted(5, 27) Source(12, 46) + SourceIndex(0) +7 >Emitted(5, 29) Source(12, 48) + SourceIndex(0) +8 >Emitted(5, 30) Source(12, 49) + SourceIndex(0) +9 >Emitted(5, 38) Source(12, 57) + SourceIndex(0) +10>Emitted(5, 40) Source(12, 59) + SourceIndex(0) +11>Emitted(5, 42) Source(12, 61) + SourceIndex(0) +12>Emitted(5, 43) Source(12, 62) + SourceIndex(0) +13>Emitted(5, 44) Source(12, 63) + SourceIndex(0) +14>Emitted(5, 45) Source(12, 64) + SourceIndex(0) +--- +>>>var multiRobotB = ["trimmer", ["trimming", "edging"]]; +1-> +2 >^^^^ +3 > ^^^^^^^^^^^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^^ +7 > ^^ +8 > ^ +9 > ^^^^^^^^^^ +10> ^^ +11> ^^^^^^^^ +12> ^ +13> ^ +14> ^ +1-> + > +2 >let +3 > multiRobotB +4 > : MultiSkilledRobot = +5 > [ +6 > "trimmer" +7 > , +8 > [ +9 > "trimming" +10> , +11> "edging" +12> ] +13> ] +14> ; +1->Emitted(6, 1) Source(13, 1) + SourceIndex(0) +2 >Emitted(6, 5) Source(13, 5) + SourceIndex(0) +3 >Emitted(6, 16) Source(13, 16) + SourceIndex(0) +4 >Emitted(6, 19) Source(13, 38) + SourceIndex(0) +5 >Emitted(6, 20) Source(13, 39) + SourceIndex(0) +6 >Emitted(6, 29) Source(13, 48) + SourceIndex(0) +7 >Emitted(6, 31) Source(13, 50) + SourceIndex(0) +8 >Emitted(6, 32) Source(13, 51) + SourceIndex(0) +9 >Emitted(6, 42) Source(13, 61) + SourceIndex(0) +10>Emitted(6, 44) Source(13, 63) + SourceIndex(0) +11>Emitted(6, 52) Source(13, 71) + SourceIndex(0) +12>Emitted(6, 53) Source(13, 72) + SourceIndex(0) +13>Emitted(6, 54) Source(13, 73) + SourceIndex(0) +14>Emitted(6, 55) Source(13, 74) + SourceIndex(0) +--- +>>>function getMultiRobot() { +1 > +2 >^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(7, 1) Source(14, 1) + SourceIndex(0) +--- +>>> return multiRobotA; +1->^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^ +5 > ^ +1->function getMultiRobot() { + > +2 > return +3 > +4 > multiRobotA +5 > ; +1->Emitted(8, 5) Source(15, 5) + SourceIndex(0) +2 >Emitted(8, 11) Source(15, 11) + SourceIndex(0) +3 >Emitted(8, 12) Source(15, 12) + SourceIndex(0) +4 >Emitted(8, 23) Source(15, 23) + SourceIndex(0) +5 >Emitted(8, 24) Source(15, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(9, 1) Source(16, 1) + SourceIndex(0) +2 >Emitted(9, 2) Source(16, 2) + SourceIndex(0) +--- +>>>var nameA, primarySkillA, secondarySkillA; +1-> +2 >^^^^ +3 > ^^^^^ +4 > ^^ +5 > ^^^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^ +8 > ^ +1-> + > + > +2 >let +3 > nameA: string +4 > , +5 > primarySkillA: string +6 > , +7 > secondarySkillA: string +8 > ; +1->Emitted(10, 1) Source(18, 1) + SourceIndex(0) +2 >Emitted(10, 5) Source(18, 5) + SourceIndex(0) +3 >Emitted(10, 10) Source(18, 18) + SourceIndex(0) +4 >Emitted(10, 12) Source(18, 20) + SourceIndex(0) +5 >Emitted(10, 25) Source(18, 41) + SourceIndex(0) +6 >Emitted(10, 27) Source(18, 43) + SourceIndex(0) +7 >Emitted(10, 42) Source(18, 66) + SourceIndex(0) +8 >Emitted(10, 43) Source(18, 67) + SourceIndex(0) +--- +>>>var numberB, nameB; +1 > +2 >^^^^ +3 > ^^^^^^^ +4 > ^^ +5 > ^^^^^ +6 > ^ +7 > ^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >let +3 > numberB: number +4 > , +5 > nameB: string +6 > ; +1 >Emitted(11, 1) Source(19, 1) + SourceIndex(0) +2 >Emitted(11, 5) Source(19, 5) + SourceIndex(0) +3 >Emitted(11, 12) Source(19, 20) + SourceIndex(0) +4 >Emitted(11, 14) Source(19, 22) + SourceIndex(0) +5 >Emitted(11, 19) Source(19, 35) + SourceIndex(0) +6 >Emitted(11, 20) Source(19, 36) + SourceIndex(0) +--- +>>>var numberA2, nameA2, skillA2, nameMA; +1-> +2 >^^^^ +3 > ^^^^^^^^ +4 > ^^ +5 > ^^^^^^ +6 > ^^ +7 > ^^^^^^^ +8 > ^^ +9 > ^^^^^^ +10> ^ +11> ^^^^^-> +1-> + > +2 >let +3 > numberA2: number +4 > , +5 > nameA2: string +6 > , +7 > skillA2: string +8 > , +9 > nameMA: string +10> ; +1->Emitted(12, 1) Source(20, 1) + SourceIndex(0) +2 >Emitted(12, 5) Source(20, 5) + SourceIndex(0) +3 >Emitted(12, 13) Source(20, 21) + SourceIndex(0) +4 >Emitted(12, 15) Source(20, 23) + SourceIndex(0) +5 >Emitted(12, 21) Source(20, 37) + SourceIndex(0) +6 >Emitted(12, 23) Source(20, 39) + SourceIndex(0) +7 >Emitted(12, 30) Source(20, 54) + SourceIndex(0) +8 >Emitted(12, 32) Source(20, 56) + SourceIndex(0) +9 >Emitted(12, 38) Source(20, 70) + SourceIndex(0) +10>Emitted(12, 39) Source(20, 71) + SourceIndex(0) +--- +>>>var numberA3, robotAInfo, multiRobotAInfo; +1-> +2 >^^^^ +3 > ^^^^^^^^ +4 > ^^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^ +8 > ^ +1-> + > +2 >let +3 > numberA3: number +4 > , +5 > robotAInfo: (number | string)[] +6 > , +7 > multiRobotAInfo: (string | [string, string])[] +8 > ; +1->Emitted(13, 1) Source(21, 1) + SourceIndex(0) +2 >Emitted(13, 5) Source(21, 5) + SourceIndex(0) +3 >Emitted(13, 13) Source(21, 21) + SourceIndex(0) +4 >Emitted(13, 15) Source(21, 23) + SourceIndex(0) +5 >Emitted(13, 25) Source(21, 54) + SourceIndex(0) +6 >Emitted(13, 27) Source(21, 56) + SourceIndex(0) +7 >Emitted(13, 42) Source(21, 102) + SourceIndex(0) +8 >Emitted(13, 43) Source(21, 103) + SourceIndex(0) +--- +>>>var i; +1 > +2 >^^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >let +3 > i: number +4 > ; +1 >Emitted(14, 1) Source(22, 1) + SourceIndex(0) +2 >Emitted(14, 5) Source(22, 5) + SourceIndex(0) +3 >Emitted(14, 6) Source(22, 14) + SourceIndex(0) +4 >Emitted(14, 7) Source(22, 15) + SourceIndex(0) +--- +>>>for ((nameA = robotA[1], robotA), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^ +9 > ^ +10> ^^ +11> ^ +12> ^^^ +13> ^ +14> ^^ +15> ^ +16> ^^^ +17> ^ +18> ^^ +19> ^ +20> ^^ +21> ^^ +22> ^ +1-> + > + > +2 >for +3 > +4 > ( +5 > [, +6 > nameA +7 > ] = +8 > robotA +9 > +10> , +11> i +12> = +13> 0 +14> ; +15> i +16> < +17> 1 +18> ; +19> i +20> ++ +21> ) +22> { +1->Emitted(15, 1) Source(24, 1) + SourceIndex(0) +2 >Emitted(15, 4) Source(24, 4) + SourceIndex(0) +3 >Emitted(15, 5) Source(24, 5) + SourceIndex(0) +4 >Emitted(15, 6) Source(24, 6) + SourceIndex(0) +5 >Emitted(15, 7) Source(24, 9) + SourceIndex(0) +6 >Emitted(15, 24) Source(24, 14) + SourceIndex(0) +7 >Emitted(15, 26) Source(24, 18) + SourceIndex(0) +8 >Emitted(15, 32) Source(24, 24) + SourceIndex(0) +9 >Emitted(15, 33) Source(24, 24) + SourceIndex(0) +10>Emitted(15, 35) Source(24, 26) + SourceIndex(0) +11>Emitted(15, 36) Source(24, 27) + SourceIndex(0) +12>Emitted(15, 39) Source(24, 30) + SourceIndex(0) +13>Emitted(15, 40) Source(24, 31) + SourceIndex(0) +14>Emitted(15, 42) Source(24, 33) + SourceIndex(0) +15>Emitted(15, 43) Source(24, 34) + SourceIndex(0) +16>Emitted(15, 46) Source(24, 37) + SourceIndex(0) +17>Emitted(15, 47) Source(24, 38) + SourceIndex(0) +18>Emitted(15, 49) Source(24, 40) + SourceIndex(0) +19>Emitted(15, 50) Source(24, 41) + SourceIndex(0) +20>Emitted(15, 52) Source(24, 43) + SourceIndex(0) +21>Emitted(15, 54) Source(24, 45) + SourceIndex(0) +22>Emitted(15, 55) Source(24, 46) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(16, 5) Source(25, 5) + SourceIndex(0) +2 >Emitted(16, 12) Source(25, 12) + SourceIndex(0) +3 >Emitted(16, 13) Source(25, 13) + SourceIndex(0) +4 >Emitted(16, 16) Source(25, 16) + SourceIndex(0) +5 >Emitted(16, 17) Source(25, 17) + SourceIndex(0) +6 >Emitted(16, 22) Source(25, 22) + SourceIndex(0) +7 >Emitted(16, 23) Source(25, 23) + SourceIndex(0) +8 >Emitted(16, 24) Source(25, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(17, 1) Source(26, 1) + SourceIndex(0) +2 >Emitted(17, 2) Source(26, 2) + SourceIndex(0) +--- +>>>for ((_a = getRobot(), nameA = _a[1], _a), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^ +9 > ^^^^^ +10> ^^ +11> ^ +12> ^^^ +13> ^ +14> ^^ +15> ^ +16> ^^^ +17> ^ +18> ^^ +19> ^ +20> ^^ +21> ^^ +22> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > [, nameA] = getRobot() +7 > +8 > nameA +9 > ] = getRobot() +10> , +11> i +12> = +13> 0 +14> ; +15> i +16> < +17> 1 +18> ; +19> i +20> ++ +21> ) +22> { +1->Emitted(18, 1) Source(27, 1) + SourceIndex(0) +2 >Emitted(18, 4) Source(27, 4) + SourceIndex(0) +3 >Emitted(18, 5) Source(27, 5) + SourceIndex(0) +4 >Emitted(18, 6) Source(27, 6) + SourceIndex(0) +5 >Emitted(18, 7) Source(27, 6) + SourceIndex(0) +6 >Emitted(18, 22) Source(27, 28) + SourceIndex(0) +7 >Emitted(18, 24) Source(27, 9) + SourceIndex(0) +8 >Emitted(18, 37) Source(27, 14) + SourceIndex(0) +9 >Emitted(18, 42) Source(27, 28) + SourceIndex(0) +10>Emitted(18, 44) Source(27, 30) + SourceIndex(0) +11>Emitted(18, 45) Source(27, 31) + SourceIndex(0) +12>Emitted(18, 48) Source(27, 34) + SourceIndex(0) +13>Emitted(18, 49) Source(27, 35) + SourceIndex(0) +14>Emitted(18, 51) Source(27, 37) + SourceIndex(0) +15>Emitted(18, 52) Source(27, 38) + SourceIndex(0) +16>Emitted(18, 55) Source(27, 41) + SourceIndex(0) +17>Emitted(18, 56) Source(27, 42) + SourceIndex(0) +18>Emitted(18, 58) Source(27, 44) + SourceIndex(0) +19>Emitted(18, 59) Source(27, 45) + SourceIndex(0) +20>Emitted(18, 61) Source(27, 47) + SourceIndex(0) +21>Emitted(18, 63) Source(27, 49) + SourceIndex(0) +22>Emitted(18, 64) Source(27, 50) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(19, 5) Source(28, 5) + SourceIndex(0) +2 >Emitted(19, 12) Source(28, 12) + SourceIndex(0) +3 >Emitted(19, 13) Source(28, 13) + SourceIndex(0) +4 >Emitted(19, 16) Source(28, 16) + SourceIndex(0) +5 >Emitted(19, 17) Source(28, 17) + SourceIndex(0) +6 >Emitted(19, 22) Source(28, 22) + SourceIndex(0) +7 >Emitted(19, 23) Source(28, 23) + SourceIndex(0) +8 >Emitted(19, 24) Source(28, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(20, 1) Source(29, 1) + SourceIndex(0) +2 >Emitted(20, 2) Source(29, 2) + SourceIndex(0) +--- +>>>for ((_b = [2, "trimmer", "trimming"], nameA = _b[1], _b), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^ +9 > ^^^^^ +10> ^^ +11> ^ +12> ^^^ +13> ^ +14> ^^ +15> ^ +16> ^^^ +17> ^ +18> ^^ +19> ^ +20> ^^ +21> ^^ +22> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > [, nameA] = [2, "trimmer", "trimming"] +7 > +8 > nameA +9 > ] = [2, "trimmer", "trimming"] +10> , +11> i +12> = +13> 0 +14> ; +15> i +16> < +17> 1 +18> ; +19> i +20> ++ +21> ) +22> { +1->Emitted(21, 1) Source(30, 1) + SourceIndex(0) +2 >Emitted(21, 4) Source(30, 4) + SourceIndex(0) +3 >Emitted(21, 5) Source(30, 5) + SourceIndex(0) +4 >Emitted(21, 6) Source(30, 6) + SourceIndex(0) +5 >Emitted(21, 7) Source(30, 6) + SourceIndex(0) +6 >Emitted(21, 38) Source(30, 44) + SourceIndex(0) +7 >Emitted(21, 40) Source(30, 9) + SourceIndex(0) +8 >Emitted(21, 53) Source(30, 14) + SourceIndex(0) +9 >Emitted(21, 58) Source(30, 44) + SourceIndex(0) +10>Emitted(21, 60) Source(30, 46) + SourceIndex(0) +11>Emitted(21, 61) Source(30, 47) + SourceIndex(0) +12>Emitted(21, 64) Source(30, 50) + SourceIndex(0) +13>Emitted(21, 65) Source(30, 51) + SourceIndex(0) +14>Emitted(21, 67) Source(30, 53) + SourceIndex(0) +15>Emitted(21, 68) Source(30, 54) + SourceIndex(0) +16>Emitted(21, 71) Source(30, 57) + SourceIndex(0) +17>Emitted(21, 72) Source(30, 58) + SourceIndex(0) +18>Emitted(21, 74) Source(30, 60) + SourceIndex(0) +19>Emitted(21, 75) Source(30, 61) + SourceIndex(0) +20>Emitted(21, 77) Source(30, 63) + SourceIndex(0) +21>Emitted(21, 79) Source(30, 65) + SourceIndex(0) +22>Emitted(21, 80) Source(30, 66) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(22, 5) Source(31, 5) + SourceIndex(0) +2 >Emitted(22, 12) Source(31, 12) + SourceIndex(0) +3 >Emitted(22, 13) Source(31, 13) + SourceIndex(0) +4 >Emitted(22, 16) Source(31, 16) + SourceIndex(0) +5 >Emitted(22, 17) Source(31, 17) + SourceIndex(0) +6 >Emitted(22, 22) Source(31, 22) + SourceIndex(0) +7 >Emitted(22, 23) Source(31, 23) + SourceIndex(0) +8 >Emitted(22, 24) Source(31, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(23, 1) Source(32, 1) + SourceIndex(0) +2 >Emitted(23, 2) Source(32, 2) + SourceIndex(0) +--- +>>>for ((_c = multiRobotA[1], primarySkillA = _c[0], secondarySkillA = _c[1], multiRobotA), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^ +13> ^ +14> ^^ +15> ^ +16> ^^^ +17> ^ +18> ^^ +19> ^ +20> ^^^ +21> ^ +22> ^^ +23> ^ +24> ^^ +25> ^^ +26> ^ +1-> + > +2 >for +3 > +4 > ( +5 > [, +6 > [primarySkillA, secondarySkillA] +7 > +8 > primarySkillA +9 > , +10> secondarySkillA +11> ]] = +12> multiRobotA +13> +14> , +15> i +16> = +17> 0 +18> ; +19> i +20> < +21> 1 +22> ; +23> i +24> ++ +25> ) +26> { +1->Emitted(24, 1) Source(33, 1) + SourceIndex(0) +2 >Emitted(24, 4) Source(33, 4) + SourceIndex(0) +3 >Emitted(24, 5) Source(33, 5) + SourceIndex(0) +4 >Emitted(24, 6) Source(33, 6) + SourceIndex(0) +5 >Emitted(24, 7) Source(33, 9) + SourceIndex(0) +6 >Emitted(24, 26) Source(33, 41) + SourceIndex(0) +7 >Emitted(24, 28) Source(33, 10) + SourceIndex(0) +8 >Emitted(24, 49) Source(33, 23) + SourceIndex(0) +9 >Emitted(24, 51) Source(33, 25) + SourceIndex(0) +10>Emitted(24, 74) Source(33, 40) + SourceIndex(0) +11>Emitted(24, 76) Source(33, 45) + SourceIndex(0) +12>Emitted(24, 87) Source(33, 56) + SourceIndex(0) +13>Emitted(24, 88) Source(33, 56) + SourceIndex(0) +14>Emitted(24, 90) Source(33, 58) + SourceIndex(0) +15>Emitted(24, 91) Source(33, 59) + SourceIndex(0) +16>Emitted(24, 94) Source(33, 62) + SourceIndex(0) +17>Emitted(24, 95) Source(33, 63) + SourceIndex(0) +18>Emitted(24, 97) Source(33, 65) + SourceIndex(0) +19>Emitted(24, 98) Source(33, 66) + SourceIndex(0) +20>Emitted(24, 101) Source(33, 69) + SourceIndex(0) +21>Emitted(24, 102) Source(33, 70) + SourceIndex(0) +22>Emitted(24, 104) Source(33, 72) + SourceIndex(0) +23>Emitted(24, 105) Source(33, 73) + SourceIndex(0) +24>Emitted(24, 107) Source(33, 75) + SourceIndex(0) +25>Emitted(24, 109) Source(33, 77) + SourceIndex(0) +26>Emitted(24, 110) Source(33, 78) + SourceIndex(0) +--- +>>> console.log(primarySkillA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > primarySkillA +7 > ) +8 > ; +1 >Emitted(25, 5) Source(34, 5) + SourceIndex(0) +2 >Emitted(25, 12) Source(34, 12) + SourceIndex(0) +3 >Emitted(25, 13) Source(34, 13) + SourceIndex(0) +4 >Emitted(25, 16) Source(34, 16) + SourceIndex(0) +5 >Emitted(25, 17) Source(34, 17) + SourceIndex(0) +6 >Emitted(25, 30) Source(34, 30) + SourceIndex(0) +7 >Emitted(25, 31) Source(34, 31) + SourceIndex(0) +8 >Emitted(25, 32) Source(34, 32) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(26, 1) Source(35, 1) + SourceIndex(0) +2 >Emitted(26, 2) Source(35, 2) + SourceIndex(0) +--- +>>>for ((_d = getMultiRobot(), _e = _d[1], primarySkillA = _e[0], secondarySkillA = _e[1], _d), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^^^^^^^^^ +13> ^^^^^ +14> ^^ +15> ^ +16> ^^^ +17> ^ +18> ^^ +19> ^ +20> ^^^ +21> ^ +22> ^^ +23> ^ +24> ^^ +25> ^^ +26> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > [, [primarySkillA, secondarySkillA]] = getMultiRobot() +7 > +8 > [primarySkillA, secondarySkillA] +9 > +10> primarySkillA +11> , +12> secondarySkillA +13> ]] = getMultiRobot() +14> , +15> i +16> = +17> 0 +18> ; +19> i +20> < +21> 1 +22> ; +23> i +24> ++ +25> ) +26> { +1->Emitted(27, 1) Source(36, 1) + SourceIndex(0) +2 >Emitted(27, 4) Source(36, 4) + SourceIndex(0) +3 >Emitted(27, 5) Source(36, 5) + SourceIndex(0) +4 >Emitted(27, 6) Source(36, 6) + SourceIndex(0) +5 >Emitted(27, 7) Source(36, 6) + SourceIndex(0) +6 >Emitted(27, 27) Source(36, 60) + SourceIndex(0) +7 >Emitted(27, 29) Source(36, 9) + SourceIndex(0) +8 >Emitted(27, 39) Source(36, 41) + SourceIndex(0) +9 >Emitted(27, 41) Source(36, 10) + SourceIndex(0) +10>Emitted(27, 62) Source(36, 23) + SourceIndex(0) +11>Emitted(27, 64) Source(36, 25) + SourceIndex(0) +12>Emitted(27, 87) Source(36, 40) + SourceIndex(0) +13>Emitted(27, 92) Source(36, 60) + SourceIndex(0) +14>Emitted(27, 94) Source(36, 62) + SourceIndex(0) +15>Emitted(27, 95) Source(36, 63) + SourceIndex(0) +16>Emitted(27, 98) Source(36, 66) + SourceIndex(0) +17>Emitted(27, 99) Source(36, 67) + SourceIndex(0) +18>Emitted(27, 101) Source(36, 69) + SourceIndex(0) +19>Emitted(27, 102) Source(36, 70) + SourceIndex(0) +20>Emitted(27, 105) Source(36, 73) + SourceIndex(0) +21>Emitted(27, 106) Source(36, 74) + SourceIndex(0) +22>Emitted(27, 108) Source(36, 76) + SourceIndex(0) +23>Emitted(27, 109) Source(36, 77) + SourceIndex(0) +24>Emitted(27, 111) Source(36, 79) + SourceIndex(0) +25>Emitted(27, 113) Source(36, 81) + SourceIndex(0) +26>Emitted(27, 114) Source(36, 82) + SourceIndex(0) +--- +>>> console.log(primarySkillA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > primarySkillA +7 > ) +8 > ; +1 >Emitted(28, 5) Source(37, 5) + SourceIndex(0) +2 >Emitted(28, 12) Source(37, 12) + SourceIndex(0) +3 >Emitted(28, 13) Source(37, 13) + SourceIndex(0) +4 >Emitted(28, 16) Source(37, 16) + SourceIndex(0) +5 >Emitted(28, 17) Source(37, 17) + SourceIndex(0) +6 >Emitted(28, 30) Source(37, 30) + SourceIndex(0) +7 >Emitted(28, 31) Source(37, 31) + SourceIndex(0) +8 >Emitted(28, 32) Source(37, 32) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(29, 1) Source(38, 1) + SourceIndex(0) +2 >Emitted(29, 2) Source(38, 2) + SourceIndex(0) +--- +>>>for ((_f = ["trimmer", ["trimming", "edging"]], _g = _f[1], primarySkillA = _g[0], secondarySkillA = _g[1], _f), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^^^^^^^^^ +13> ^^^^^ +14> ^^ +15> ^ +16> ^^^ +17> ^ +18> ^^ +19> ^ +20> ^^^ +21> ^ +22> ^^ +23> ^ +24> ^^ +25> ^^ +26> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > [, [primarySkillA, secondarySkillA]] = ["trimmer", ["trimming", "edging"]] +7 > +8 > [primarySkillA, secondarySkillA] +9 > +10> primarySkillA +11> , +12> secondarySkillA +13> ]] = ["trimmer", ["trimming", "edging"]] +14> , +15> i +16> = +17> 0 +18> ; +19> i +20> < +21> 1 +22> ; +23> i +24> ++ +25> ) +26> { +1->Emitted(30, 1) Source(39, 1) + SourceIndex(0) +2 >Emitted(30, 4) Source(39, 4) + SourceIndex(0) +3 >Emitted(30, 5) Source(39, 5) + SourceIndex(0) +4 >Emitted(30, 6) Source(39, 6) + SourceIndex(0) +5 >Emitted(30, 7) Source(39, 6) + SourceIndex(0) +6 >Emitted(30, 47) Source(39, 80) + SourceIndex(0) +7 >Emitted(30, 49) Source(39, 9) + SourceIndex(0) +8 >Emitted(30, 59) Source(39, 41) + SourceIndex(0) +9 >Emitted(30, 61) Source(39, 10) + SourceIndex(0) +10>Emitted(30, 82) Source(39, 23) + SourceIndex(0) +11>Emitted(30, 84) Source(39, 25) + SourceIndex(0) +12>Emitted(30, 107) Source(39, 40) + SourceIndex(0) +13>Emitted(30, 112) Source(39, 80) + SourceIndex(0) +14>Emitted(30, 114) Source(39, 82) + SourceIndex(0) +15>Emitted(30, 115) Source(39, 83) + SourceIndex(0) +16>Emitted(30, 118) Source(39, 86) + SourceIndex(0) +17>Emitted(30, 119) Source(39, 87) + SourceIndex(0) +18>Emitted(30, 121) Source(39, 89) + SourceIndex(0) +19>Emitted(30, 122) Source(39, 90) + SourceIndex(0) +20>Emitted(30, 125) Source(39, 93) + SourceIndex(0) +21>Emitted(30, 126) Source(39, 94) + SourceIndex(0) +22>Emitted(30, 128) Source(39, 96) + SourceIndex(0) +23>Emitted(30, 129) Source(39, 97) + SourceIndex(0) +24>Emitted(30, 131) Source(39, 99) + SourceIndex(0) +25>Emitted(30, 133) Source(39, 101) + SourceIndex(0) +26>Emitted(30, 134) Source(39, 102) + SourceIndex(0) +--- +>>> console.log(primarySkillA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > primarySkillA +7 > ) +8 > ; +1 >Emitted(31, 5) Source(40, 5) + SourceIndex(0) +2 >Emitted(31, 12) Source(40, 12) + SourceIndex(0) +3 >Emitted(31, 13) Source(40, 13) + SourceIndex(0) +4 >Emitted(31, 16) Source(40, 16) + SourceIndex(0) +5 >Emitted(31, 17) Source(40, 17) + SourceIndex(0) +6 >Emitted(31, 30) Source(40, 30) + SourceIndex(0) +7 >Emitted(31, 31) Source(40, 31) + SourceIndex(0) +8 >Emitted(31, 32) Source(40, 32) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(32, 1) Source(41, 1) + SourceIndex(0) +2 >Emitted(32, 2) Source(41, 2) + SourceIndex(0) +--- +>>>for ((numberB = robotA[0], robotA), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^ +9 > ^ +10> ^^ +11> ^ +12> ^^^ +13> ^ +14> ^^ +15> ^ +16> ^^^ +17> ^ +18> ^^ +19> ^ +20> ^^ +21> ^^ +22> ^ +1-> + > + > +2 >for +3 > +4 > ( +5 > [ +6 > numberB +7 > ] = +8 > robotA +9 > +10> , +11> i +12> = +13> 0 +14> ; +15> i +16> < +17> 1 +18> ; +19> i +20> ++ +21> ) +22> { +1->Emitted(33, 1) Source(43, 1) + SourceIndex(0) +2 >Emitted(33, 4) Source(43, 4) + SourceIndex(0) +3 >Emitted(33, 5) Source(43, 5) + SourceIndex(0) +4 >Emitted(33, 6) Source(43, 6) + SourceIndex(0) +5 >Emitted(33, 7) Source(43, 7) + SourceIndex(0) +6 >Emitted(33, 26) Source(43, 14) + SourceIndex(0) +7 >Emitted(33, 28) Source(43, 18) + SourceIndex(0) +8 >Emitted(33, 34) Source(43, 24) + SourceIndex(0) +9 >Emitted(33, 35) Source(43, 24) + SourceIndex(0) +10>Emitted(33, 37) Source(43, 26) + SourceIndex(0) +11>Emitted(33, 38) Source(43, 27) + SourceIndex(0) +12>Emitted(33, 41) Source(43, 30) + SourceIndex(0) +13>Emitted(33, 42) Source(43, 31) + SourceIndex(0) +14>Emitted(33, 44) Source(43, 33) + SourceIndex(0) +15>Emitted(33, 45) Source(43, 34) + SourceIndex(0) +16>Emitted(33, 48) Source(43, 37) + SourceIndex(0) +17>Emitted(33, 49) Source(43, 38) + SourceIndex(0) +18>Emitted(33, 51) Source(43, 40) + SourceIndex(0) +19>Emitted(33, 52) Source(43, 41) + SourceIndex(0) +20>Emitted(33, 54) Source(43, 43) + SourceIndex(0) +21>Emitted(33, 56) Source(43, 45) + SourceIndex(0) +22>Emitted(33, 57) Source(43, 46) + SourceIndex(0) +--- +>>> console.log(numberB); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > numberB +7 > ) +8 > ; +1 >Emitted(34, 5) Source(44, 5) + SourceIndex(0) +2 >Emitted(34, 12) Source(44, 12) + SourceIndex(0) +3 >Emitted(34, 13) Source(44, 13) + SourceIndex(0) +4 >Emitted(34, 16) Source(44, 16) + SourceIndex(0) +5 >Emitted(34, 17) Source(44, 17) + SourceIndex(0) +6 >Emitted(34, 24) Source(44, 24) + SourceIndex(0) +7 >Emitted(34, 25) Source(44, 25) + SourceIndex(0) +8 >Emitted(34, 26) Source(44, 26) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(35, 1) Source(45, 1) + SourceIndex(0) +2 >Emitted(35, 2) Source(45, 2) + SourceIndex(0) +--- +>>>for ((_h = getRobot(), numberB = _h[0], _h), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^ +9 > ^^^^^ +10> ^^ +11> ^ +12> ^^^ +13> ^ +14> ^^ +15> ^ +16> ^^^ +17> ^ +18> ^^ +19> ^ +20> ^^ +21> ^^ +22> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > [numberB] = getRobot() +7 > +8 > numberB +9 > ] = getRobot() +10> , +11> i +12> = +13> 0 +14> ; +15> i +16> < +17> 1 +18> ; +19> i +20> ++ +21> ) +22> { +1->Emitted(36, 1) Source(46, 1) + SourceIndex(0) +2 >Emitted(36, 4) Source(46, 4) + SourceIndex(0) +3 >Emitted(36, 5) Source(46, 5) + SourceIndex(0) +4 >Emitted(36, 6) Source(46, 6) + SourceIndex(0) +5 >Emitted(36, 7) Source(46, 6) + SourceIndex(0) +6 >Emitted(36, 22) Source(46, 28) + SourceIndex(0) +7 >Emitted(36, 24) Source(46, 7) + SourceIndex(0) +8 >Emitted(36, 39) Source(46, 14) + SourceIndex(0) +9 >Emitted(36, 44) Source(46, 28) + SourceIndex(0) +10>Emitted(36, 46) Source(46, 30) + SourceIndex(0) +11>Emitted(36, 47) Source(46, 31) + SourceIndex(0) +12>Emitted(36, 50) Source(46, 34) + SourceIndex(0) +13>Emitted(36, 51) Source(46, 35) + SourceIndex(0) +14>Emitted(36, 53) Source(46, 37) + SourceIndex(0) +15>Emitted(36, 54) Source(46, 38) + SourceIndex(0) +16>Emitted(36, 57) Source(46, 41) + SourceIndex(0) +17>Emitted(36, 58) Source(46, 42) + SourceIndex(0) +18>Emitted(36, 60) Source(46, 44) + SourceIndex(0) +19>Emitted(36, 61) Source(46, 45) + SourceIndex(0) +20>Emitted(36, 63) Source(46, 47) + SourceIndex(0) +21>Emitted(36, 65) Source(46, 49) + SourceIndex(0) +22>Emitted(36, 66) Source(46, 50) + SourceIndex(0) +--- +>>> console.log(numberB); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > numberB +7 > ) +8 > ; +1 >Emitted(37, 5) Source(47, 5) + SourceIndex(0) +2 >Emitted(37, 12) Source(47, 12) + SourceIndex(0) +3 >Emitted(37, 13) Source(47, 13) + SourceIndex(0) +4 >Emitted(37, 16) Source(47, 16) + SourceIndex(0) +5 >Emitted(37, 17) Source(47, 17) + SourceIndex(0) +6 >Emitted(37, 24) Source(47, 24) + SourceIndex(0) +7 >Emitted(37, 25) Source(47, 25) + SourceIndex(0) +8 >Emitted(37, 26) Source(47, 26) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(38, 1) Source(48, 1) + SourceIndex(0) +2 >Emitted(38, 2) Source(48, 2) + SourceIndex(0) +--- +>>>for ((_j = [2, "trimmer", "trimming"], numberB = _j[0], _j), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^ +9 > ^^^^^ +10> ^^ +11> ^ +12> ^^^ +13> ^ +14> ^^ +15> ^ +16> ^^^ +17> ^ +18> ^^ +19> ^ +20> ^^ +21> ^^ +22> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > [numberB] = [2, "trimmer", "trimming"] +7 > +8 > numberB +9 > ] = [2, "trimmer", "trimming"] +10> , +11> i +12> = +13> 0 +14> ; +15> i +16> < +17> 1 +18> ; +19> i +20> ++ +21> ) +22> { +1->Emitted(39, 1) Source(49, 1) + SourceIndex(0) +2 >Emitted(39, 4) Source(49, 4) + SourceIndex(0) +3 >Emitted(39, 5) Source(49, 5) + SourceIndex(0) +4 >Emitted(39, 6) Source(49, 6) + SourceIndex(0) +5 >Emitted(39, 7) Source(49, 6) + SourceIndex(0) +6 >Emitted(39, 38) Source(49, 44) + SourceIndex(0) +7 >Emitted(39, 40) Source(49, 7) + SourceIndex(0) +8 >Emitted(39, 55) Source(49, 14) + SourceIndex(0) +9 >Emitted(39, 60) Source(49, 44) + SourceIndex(0) +10>Emitted(39, 62) Source(49, 46) + SourceIndex(0) +11>Emitted(39, 63) Source(49, 47) + SourceIndex(0) +12>Emitted(39, 66) Source(49, 50) + SourceIndex(0) +13>Emitted(39, 67) Source(49, 51) + SourceIndex(0) +14>Emitted(39, 69) Source(49, 53) + SourceIndex(0) +15>Emitted(39, 70) Source(49, 54) + SourceIndex(0) +16>Emitted(39, 73) Source(49, 57) + SourceIndex(0) +17>Emitted(39, 74) Source(49, 58) + SourceIndex(0) +18>Emitted(39, 76) Source(49, 60) + SourceIndex(0) +19>Emitted(39, 77) Source(49, 61) + SourceIndex(0) +20>Emitted(39, 79) Source(49, 63) + SourceIndex(0) +21>Emitted(39, 81) Source(49, 65) + SourceIndex(0) +22>Emitted(39, 82) Source(49, 66) + SourceIndex(0) +--- +>>> console.log(numberB); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > numberB +7 > ) +8 > ; +1 >Emitted(40, 5) Source(50, 5) + SourceIndex(0) +2 >Emitted(40, 12) Source(50, 12) + SourceIndex(0) +3 >Emitted(40, 13) Source(50, 13) + SourceIndex(0) +4 >Emitted(40, 16) Source(50, 16) + SourceIndex(0) +5 >Emitted(40, 17) Source(50, 17) + SourceIndex(0) +6 >Emitted(40, 24) Source(50, 24) + SourceIndex(0) +7 >Emitted(40, 25) Source(50, 25) + SourceIndex(0) +8 >Emitted(40, 26) Source(50, 26) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(41, 1) Source(51, 1) + SourceIndex(0) +2 >Emitted(41, 2) Source(51, 2) + SourceIndex(0) +--- +>>>for ((nameB = multiRobotA[0], multiRobotA), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^ +9 > ^ +10> ^^ +11> ^ +12> ^^^ +13> ^ +14> ^^ +15> ^ +16> ^^^ +17> ^ +18> ^^ +19> ^ +20> ^^ +21> ^^ +22> ^ +1-> + > +2 >for +3 > +4 > ( +5 > [ +6 > nameB +7 > ] = +8 > multiRobotA +9 > +10> , +11> i +12> = +13> 0 +14> ; +15> i +16> < +17> 1 +18> ; +19> i +20> ++ +21> ) +22> { +1->Emitted(42, 1) Source(52, 1) + SourceIndex(0) +2 >Emitted(42, 4) Source(52, 4) + SourceIndex(0) +3 >Emitted(42, 5) Source(52, 5) + SourceIndex(0) +4 >Emitted(42, 6) Source(52, 6) + SourceIndex(0) +5 >Emitted(42, 7) Source(52, 7) + SourceIndex(0) +6 >Emitted(42, 29) Source(52, 12) + SourceIndex(0) +7 >Emitted(42, 31) Source(52, 16) + SourceIndex(0) +8 >Emitted(42, 42) Source(52, 27) + SourceIndex(0) +9 >Emitted(42, 43) Source(52, 27) + SourceIndex(0) +10>Emitted(42, 45) Source(52, 29) + SourceIndex(0) +11>Emitted(42, 46) Source(52, 30) + SourceIndex(0) +12>Emitted(42, 49) Source(52, 33) + SourceIndex(0) +13>Emitted(42, 50) Source(52, 34) + SourceIndex(0) +14>Emitted(42, 52) Source(52, 36) + SourceIndex(0) +15>Emitted(42, 53) Source(52, 37) + SourceIndex(0) +16>Emitted(42, 56) Source(52, 40) + SourceIndex(0) +17>Emitted(42, 57) Source(52, 41) + SourceIndex(0) +18>Emitted(42, 59) Source(52, 43) + SourceIndex(0) +19>Emitted(42, 60) Source(52, 44) + SourceIndex(0) +20>Emitted(42, 62) Source(52, 46) + SourceIndex(0) +21>Emitted(42, 64) Source(52, 48) + SourceIndex(0) +22>Emitted(42, 65) Source(52, 49) + SourceIndex(0) +--- +>>> console.log(nameB); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameB +7 > ) +8 > ; +1 >Emitted(43, 5) Source(53, 5) + SourceIndex(0) +2 >Emitted(43, 12) Source(53, 12) + SourceIndex(0) +3 >Emitted(43, 13) Source(53, 13) + SourceIndex(0) +4 >Emitted(43, 16) Source(53, 16) + SourceIndex(0) +5 >Emitted(43, 17) Source(53, 17) + SourceIndex(0) +6 >Emitted(43, 22) Source(53, 22) + SourceIndex(0) +7 >Emitted(43, 23) Source(53, 23) + SourceIndex(0) +8 >Emitted(43, 24) Source(53, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(44, 1) Source(54, 1) + SourceIndex(0) +2 >Emitted(44, 2) Source(54, 2) + SourceIndex(0) +--- +>>>for ((_k = getMultiRobot(), nameB = _k[0], _k), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^ +9 > ^^^^^ +10> ^^ +11> ^ +12> ^^^ +13> ^ +14> ^^ +15> ^ +16> ^^^ +17> ^ +18> ^^ +19> ^ +20> ^^ +21> ^^ +22> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > [nameB] = getMultiRobot() +7 > +8 > nameB +9 > ] = getMultiRobot() +10> , +11> i +12> = +13> 0 +14> ; +15> i +16> < +17> 1 +18> ; +19> i +20> ++ +21> ) +22> { +1->Emitted(45, 1) Source(55, 1) + SourceIndex(0) +2 >Emitted(45, 4) Source(55, 4) + SourceIndex(0) +3 >Emitted(45, 5) Source(55, 5) + SourceIndex(0) +4 >Emitted(45, 6) Source(55, 6) + SourceIndex(0) +5 >Emitted(45, 7) Source(55, 6) + SourceIndex(0) +6 >Emitted(45, 27) Source(55, 31) + SourceIndex(0) +7 >Emitted(45, 29) Source(55, 7) + SourceIndex(0) +8 >Emitted(45, 42) Source(55, 12) + SourceIndex(0) +9 >Emitted(45, 47) Source(55, 31) + SourceIndex(0) +10>Emitted(45, 49) Source(55, 33) + SourceIndex(0) +11>Emitted(45, 50) Source(55, 34) + SourceIndex(0) +12>Emitted(45, 53) Source(55, 37) + SourceIndex(0) +13>Emitted(45, 54) Source(55, 38) + SourceIndex(0) +14>Emitted(45, 56) Source(55, 40) + SourceIndex(0) +15>Emitted(45, 57) Source(55, 41) + SourceIndex(0) +16>Emitted(45, 60) Source(55, 44) + SourceIndex(0) +17>Emitted(45, 61) Source(55, 45) + SourceIndex(0) +18>Emitted(45, 63) Source(55, 47) + SourceIndex(0) +19>Emitted(45, 64) Source(55, 48) + SourceIndex(0) +20>Emitted(45, 66) Source(55, 50) + SourceIndex(0) +21>Emitted(45, 68) Source(55, 52) + SourceIndex(0) +22>Emitted(45, 69) Source(55, 53) + SourceIndex(0) +--- +>>> console.log(nameB); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameB +7 > ) +8 > ; +1 >Emitted(46, 5) Source(56, 5) + SourceIndex(0) +2 >Emitted(46, 12) Source(56, 12) + SourceIndex(0) +3 >Emitted(46, 13) Source(56, 13) + SourceIndex(0) +4 >Emitted(46, 16) Source(56, 16) + SourceIndex(0) +5 >Emitted(46, 17) Source(56, 17) + SourceIndex(0) +6 >Emitted(46, 22) Source(56, 22) + SourceIndex(0) +7 >Emitted(46, 23) Source(56, 23) + SourceIndex(0) +8 >Emitted(46, 24) Source(56, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(47, 1) Source(57, 1) + SourceIndex(0) +2 >Emitted(47, 2) Source(57, 2) + SourceIndex(0) +--- +>>>for ((_l = ["trimmer", ["trimming", "edging"]], nameB = _l[0], _l), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^ +9 > ^^^^^ +10> ^^ +11> ^ +12> ^^^ +13> ^ +14> ^^ +15> ^ +16> ^^^ +17> ^ +18> ^^ +19> ^ +20> ^^ +21> ^^ +22> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > [nameB] = ["trimmer", ["trimming", "edging"]] +7 > +8 > nameB +9 > ] = ["trimmer", ["trimming", "edging"]] +10> , +11> i +12> = +13> 0 +14> ; +15> i +16> < +17> 1 +18> ; +19> i +20> ++ +21> ) +22> { +1->Emitted(48, 1) Source(58, 1) + SourceIndex(0) +2 >Emitted(48, 4) Source(58, 4) + SourceIndex(0) +3 >Emitted(48, 5) Source(58, 5) + SourceIndex(0) +4 >Emitted(48, 6) Source(58, 6) + SourceIndex(0) +5 >Emitted(48, 7) Source(58, 6) + SourceIndex(0) +6 >Emitted(48, 47) Source(58, 51) + SourceIndex(0) +7 >Emitted(48, 49) Source(58, 7) + SourceIndex(0) +8 >Emitted(48, 62) Source(58, 12) + SourceIndex(0) +9 >Emitted(48, 67) Source(58, 51) + SourceIndex(0) +10>Emitted(48, 69) Source(58, 53) + SourceIndex(0) +11>Emitted(48, 70) Source(58, 54) + SourceIndex(0) +12>Emitted(48, 73) Source(58, 57) + SourceIndex(0) +13>Emitted(48, 74) Source(58, 58) + SourceIndex(0) +14>Emitted(48, 76) Source(58, 60) + SourceIndex(0) +15>Emitted(48, 77) Source(58, 61) + SourceIndex(0) +16>Emitted(48, 80) Source(58, 64) + SourceIndex(0) +17>Emitted(48, 81) Source(58, 65) + SourceIndex(0) +18>Emitted(48, 83) Source(58, 67) + SourceIndex(0) +19>Emitted(48, 84) Source(58, 68) + SourceIndex(0) +20>Emitted(48, 86) Source(58, 70) + SourceIndex(0) +21>Emitted(48, 88) Source(58, 72) + SourceIndex(0) +22>Emitted(48, 89) Source(58, 73) + SourceIndex(0) +--- +>>> console.log(nameB); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameB +7 > ) +8 > ; +1 >Emitted(49, 5) Source(59, 5) + SourceIndex(0) +2 >Emitted(49, 12) Source(59, 12) + SourceIndex(0) +3 >Emitted(49, 13) Source(59, 13) + SourceIndex(0) +4 >Emitted(49, 16) Source(59, 16) + SourceIndex(0) +5 >Emitted(49, 17) Source(59, 17) + SourceIndex(0) +6 >Emitted(49, 22) Source(59, 22) + SourceIndex(0) +7 >Emitted(49, 23) Source(59, 23) + SourceIndex(0) +8 >Emitted(49, 24) Source(59, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(50, 1) Source(60, 1) + SourceIndex(0) +2 >Emitted(50, 2) Source(60, 2) + SourceIndex(0) +--- +>>>for ((numberA2 = robotA[0], nameA2 = robotA[1], skillA2 = robotA[2], robotA), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^ +13> ^ +14> ^^ +15> ^ +16> ^^^ +17> ^ +18> ^^ +19> ^ +20> ^^^ +21> ^ +22> ^^ +23> ^ +24> ^^ +25> ^^ +26> ^ +1-> + > + > +2 >for +3 > +4 > ( +5 > [ +6 > numberA2 +7 > , +8 > nameA2 +9 > , +10> skillA2 +11> ] = +12> robotA +13> +14> , +15> i +16> = +17> 0 +18> ; +19> i +20> < +21> 1 +22> ; +23> i +24> ++ +25> ) +26> { +1->Emitted(51, 1) Source(62, 1) + SourceIndex(0) +2 >Emitted(51, 4) Source(62, 4) + SourceIndex(0) +3 >Emitted(51, 5) Source(62, 5) + SourceIndex(0) +4 >Emitted(51, 6) Source(62, 6) + SourceIndex(0) +5 >Emitted(51, 7) Source(62, 7) + SourceIndex(0) +6 >Emitted(51, 27) Source(62, 15) + SourceIndex(0) +7 >Emitted(51, 29) Source(62, 17) + SourceIndex(0) +8 >Emitted(51, 47) Source(62, 23) + SourceIndex(0) +9 >Emitted(51, 49) Source(62, 25) + SourceIndex(0) +10>Emitted(51, 68) Source(62, 32) + SourceIndex(0) +11>Emitted(51, 70) Source(62, 36) + SourceIndex(0) +12>Emitted(51, 76) Source(62, 42) + SourceIndex(0) +13>Emitted(51, 77) Source(62, 42) + SourceIndex(0) +14>Emitted(51, 79) Source(62, 44) + SourceIndex(0) +15>Emitted(51, 80) Source(62, 45) + SourceIndex(0) +16>Emitted(51, 83) Source(62, 48) + SourceIndex(0) +17>Emitted(51, 84) Source(62, 49) + SourceIndex(0) +18>Emitted(51, 86) Source(62, 51) + SourceIndex(0) +19>Emitted(51, 87) Source(62, 52) + SourceIndex(0) +20>Emitted(51, 90) Source(62, 55) + SourceIndex(0) +21>Emitted(51, 91) Source(62, 56) + SourceIndex(0) +22>Emitted(51, 93) Source(62, 58) + SourceIndex(0) +23>Emitted(51, 94) Source(62, 59) + SourceIndex(0) +24>Emitted(51, 96) Source(62, 61) + SourceIndex(0) +25>Emitted(51, 98) Source(62, 63) + SourceIndex(0) +26>Emitted(51, 99) Source(62, 64) + SourceIndex(0) +--- +>>> console.log(nameA2); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA2 +7 > ) +8 > ; +1 >Emitted(52, 5) Source(63, 5) + SourceIndex(0) +2 >Emitted(52, 12) Source(63, 12) + SourceIndex(0) +3 >Emitted(52, 13) Source(63, 13) + SourceIndex(0) +4 >Emitted(52, 16) Source(63, 16) + SourceIndex(0) +5 >Emitted(52, 17) Source(63, 17) + SourceIndex(0) +6 >Emitted(52, 23) Source(63, 23) + SourceIndex(0) +7 >Emitted(52, 24) Source(63, 24) + SourceIndex(0) +8 >Emitted(52, 25) Source(63, 25) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(53, 1) Source(64, 1) + SourceIndex(0) +2 >Emitted(53, 2) Source(64, 2) + SourceIndex(0) +--- +>>>for ((_m = getRobot(), numberA2 = _m[0], nameA2 = _m[1], skillA2 = _m[2], _m), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^ +13> ^^^^^ +14> ^^ +15> ^ +16> ^^^ +17> ^ +18> ^^ +19> ^ +20> ^^^ +21> ^ +22> ^^ +23> ^ +24> ^^ +25> ^^ +26> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > [numberA2, nameA2, skillA2] = getRobot() +7 > +8 > numberA2 +9 > , +10> nameA2 +11> , +12> skillA2 +13> ] = getRobot() +14> , +15> i +16> = +17> 0 +18> ; +19> i +20> < +21> 1 +22> ; +23> i +24> ++ +25> ) +26> { +1->Emitted(54, 1) Source(65, 1) + SourceIndex(0) +2 >Emitted(54, 4) Source(65, 4) + SourceIndex(0) +3 >Emitted(54, 5) Source(65, 5) + SourceIndex(0) +4 >Emitted(54, 6) Source(65, 6) + SourceIndex(0) +5 >Emitted(54, 7) Source(65, 6) + SourceIndex(0) +6 >Emitted(54, 22) Source(65, 46) + SourceIndex(0) +7 >Emitted(54, 24) Source(65, 7) + SourceIndex(0) +8 >Emitted(54, 40) Source(65, 15) + SourceIndex(0) +9 >Emitted(54, 42) Source(65, 17) + SourceIndex(0) +10>Emitted(54, 56) Source(65, 23) + SourceIndex(0) +11>Emitted(54, 58) Source(65, 25) + SourceIndex(0) +12>Emitted(54, 73) Source(65, 32) + SourceIndex(0) +13>Emitted(54, 78) Source(65, 46) + SourceIndex(0) +14>Emitted(54, 80) Source(65, 48) + SourceIndex(0) +15>Emitted(54, 81) Source(65, 49) + SourceIndex(0) +16>Emitted(54, 84) Source(65, 52) + SourceIndex(0) +17>Emitted(54, 85) Source(65, 53) + SourceIndex(0) +18>Emitted(54, 87) Source(65, 55) + SourceIndex(0) +19>Emitted(54, 88) Source(65, 56) + SourceIndex(0) +20>Emitted(54, 91) Source(65, 59) + SourceIndex(0) +21>Emitted(54, 92) Source(65, 60) + SourceIndex(0) +22>Emitted(54, 94) Source(65, 62) + SourceIndex(0) +23>Emitted(54, 95) Source(65, 63) + SourceIndex(0) +24>Emitted(54, 97) Source(65, 65) + SourceIndex(0) +25>Emitted(54, 99) Source(65, 67) + SourceIndex(0) +26>Emitted(54, 100) Source(65, 68) + SourceIndex(0) +--- +>>> console.log(nameA2); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA2 +7 > ) +8 > ; +1 >Emitted(55, 5) Source(66, 5) + SourceIndex(0) +2 >Emitted(55, 12) Source(66, 12) + SourceIndex(0) +3 >Emitted(55, 13) Source(66, 13) + SourceIndex(0) +4 >Emitted(55, 16) Source(66, 16) + SourceIndex(0) +5 >Emitted(55, 17) Source(66, 17) + SourceIndex(0) +6 >Emitted(55, 23) Source(66, 23) + SourceIndex(0) +7 >Emitted(55, 24) Source(66, 24) + SourceIndex(0) +8 >Emitted(55, 25) Source(66, 25) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(56, 1) Source(67, 1) + SourceIndex(0) +2 >Emitted(56, 2) Source(67, 2) + SourceIndex(0) +--- +>>>for ((_o = [2, "trimmer", "trimming"], numberA2 = _o[0], nameA2 = _o[1], skillA2 = _o[2], _o), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^ +13> ^^^^^ +14> ^^ +15> ^ +16> ^^^ +17> ^ +18> ^^ +19> ^ +20> ^^^ +21> ^ +22> ^^ +23> ^ +24> ^^ +25> ^^ +26> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > [numberA2, nameA2, skillA2] = [2, "trimmer", "trimming"] +7 > +8 > numberA2 +9 > , +10> nameA2 +11> , +12> skillA2 +13> ] = [2, "trimmer", "trimming"] +14> , +15> i +16> = +17> 0 +18> ; +19> i +20> < +21> 1 +22> ; +23> i +24> ++ +25> ) +26> { +1->Emitted(57, 1) Source(68, 1) + SourceIndex(0) +2 >Emitted(57, 4) Source(68, 4) + SourceIndex(0) +3 >Emitted(57, 5) Source(68, 5) + SourceIndex(0) +4 >Emitted(57, 6) Source(68, 6) + SourceIndex(0) +5 >Emitted(57, 7) Source(68, 6) + SourceIndex(0) +6 >Emitted(57, 38) Source(68, 62) + SourceIndex(0) +7 >Emitted(57, 40) Source(68, 7) + SourceIndex(0) +8 >Emitted(57, 56) Source(68, 15) + SourceIndex(0) +9 >Emitted(57, 58) Source(68, 17) + SourceIndex(0) +10>Emitted(57, 72) Source(68, 23) + SourceIndex(0) +11>Emitted(57, 74) Source(68, 25) + SourceIndex(0) +12>Emitted(57, 89) Source(68, 32) + SourceIndex(0) +13>Emitted(57, 94) Source(68, 62) + SourceIndex(0) +14>Emitted(57, 96) Source(68, 64) + SourceIndex(0) +15>Emitted(57, 97) Source(68, 65) + SourceIndex(0) +16>Emitted(57, 100) Source(68, 68) + SourceIndex(0) +17>Emitted(57, 101) Source(68, 69) + SourceIndex(0) +18>Emitted(57, 103) Source(68, 71) + SourceIndex(0) +19>Emitted(57, 104) Source(68, 72) + SourceIndex(0) +20>Emitted(57, 107) Source(68, 75) + SourceIndex(0) +21>Emitted(57, 108) Source(68, 76) + SourceIndex(0) +22>Emitted(57, 110) Source(68, 78) + SourceIndex(0) +23>Emitted(57, 111) Source(68, 79) + SourceIndex(0) +24>Emitted(57, 113) Source(68, 81) + SourceIndex(0) +25>Emitted(57, 115) Source(68, 83) + SourceIndex(0) +26>Emitted(57, 116) Source(68, 84) + SourceIndex(0) +--- +>>> console.log(nameA2); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA2 +7 > ) +8 > ; +1 >Emitted(58, 5) Source(69, 5) + SourceIndex(0) +2 >Emitted(58, 12) Source(69, 12) + SourceIndex(0) +3 >Emitted(58, 13) Source(69, 13) + SourceIndex(0) +4 >Emitted(58, 16) Source(69, 16) + SourceIndex(0) +5 >Emitted(58, 17) Source(69, 17) + SourceIndex(0) +6 >Emitted(58, 23) Source(69, 23) + SourceIndex(0) +7 >Emitted(58, 24) Source(69, 24) + SourceIndex(0) +8 >Emitted(58, 25) Source(69, 25) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(59, 1) Source(70, 1) + SourceIndex(0) +2 >Emitted(59, 2) Source(70, 2) + SourceIndex(0) +--- +>>>for ((nameMA = multiRobotA[0], _p = multiRobotA[1], primarySkillA = _p[0], secondarySkillA = _p[1], multiRobotA), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^ +15> ^ +16> ^^ +17> ^ +18> ^^^ +19> ^ +20> ^^ +21> ^ +22> ^^^ +23> ^ +24> ^^ +25> ^ +26> ^^ +27> ^^ +28> ^ +1-> + > +2 >for +3 > +4 > ( +5 > [ +6 > nameMA +7 > , +8 > [primarySkillA, secondarySkillA] +9 > +10> primarySkillA +11> , +12> secondarySkillA +13> ]] = +14> multiRobotA +15> +16> , +17> i +18> = +19> 0 +20> ; +21> i +22> < +23> 1 +24> ; +25> i +26> ++ +27> ) +28> { +1->Emitted(60, 1) Source(71, 1) + SourceIndex(0) +2 >Emitted(60, 4) Source(71, 4) + SourceIndex(0) +3 >Emitted(60, 5) Source(71, 5) + SourceIndex(0) +4 >Emitted(60, 6) Source(71, 6) + SourceIndex(0) +5 >Emitted(60, 7) Source(71, 7) + SourceIndex(0) +6 >Emitted(60, 30) Source(71, 13) + SourceIndex(0) +7 >Emitted(60, 32) Source(71, 15) + SourceIndex(0) +8 >Emitted(60, 51) Source(71, 47) + SourceIndex(0) +9 >Emitted(60, 53) Source(71, 16) + SourceIndex(0) +10>Emitted(60, 74) Source(71, 29) + SourceIndex(0) +11>Emitted(60, 76) Source(71, 31) + SourceIndex(0) +12>Emitted(60, 99) Source(71, 46) + SourceIndex(0) +13>Emitted(60, 101) Source(71, 51) + SourceIndex(0) +14>Emitted(60, 112) Source(71, 62) + SourceIndex(0) +15>Emitted(60, 113) Source(71, 62) + SourceIndex(0) +16>Emitted(60, 115) Source(71, 64) + SourceIndex(0) +17>Emitted(60, 116) Source(71, 65) + SourceIndex(0) +18>Emitted(60, 119) Source(71, 68) + SourceIndex(0) +19>Emitted(60, 120) Source(71, 69) + SourceIndex(0) +20>Emitted(60, 122) Source(71, 71) + SourceIndex(0) +21>Emitted(60, 123) Source(71, 72) + SourceIndex(0) +22>Emitted(60, 126) Source(71, 75) + SourceIndex(0) +23>Emitted(60, 127) Source(71, 76) + SourceIndex(0) +24>Emitted(60, 129) Source(71, 78) + SourceIndex(0) +25>Emitted(60, 130) Source(71, 79) + SourceIndex(0) +26>Emitted(60, 132) Source(71, 81) + SourceIndex(0) +27>Emitted(60, 134) Source(71, 83) + SourceIndex(0) +28>Emitted(60, 135) Source(71, 84) + SourceIndex(0) +--- +>>> console.log(nameMA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameMA +7 > ) +8 > ; +1 >Emitted(61, 5) Source(72, 5) + SourceIndex(0) +2 >Emitted(61, 12) Source(72, 12) + SourceIndex(0) +3 >Emitted(61, 13) Source(72, 13) + SourceIndex(0) +4 >Emitted(61, 16) Source(72, 16) + SourceIndex(0) +5 >Emitted(61, 17) Source(72, 17) + SourceIndex(0) +6 >Emitted(61, 23) Source(72, 23) + SourceIndex(0) +7 >Emitted(61, 24) Source(72, 24) + SourceIndex(0) +8 >Emitted(61, 25) Source(72, 25) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(62, 1) Source(73, 1) + SourceIndex(0) +2 >Emitted(62, 2) Source(73, 2) + SourceIndex(0) +--- +>>>for ((_q = getMultiRobot(), nameMA = _q[0], _r = _q[1], primarySkillA = _r[0], secondarySkillA = _r[1], _q), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^^^^^^^^^^ +15> ^^^^^ +16> ^^ +17> ^ +18> ^^^ +19> ^ +20> ^^ +21> ^ +22> ^^^ +23> ^ +24> ^^ +25> ^ +26> ^^ +27> ^^ +28> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > [nameMA, [primarySkillA, secondarySkillA]] = getMultiRobot() +7 > +8 > nameMA +9 > , +10> [primarySkillA, secondarySkillA] +11> +12> primarySkillA +13> , +14> secondarySkillA +15> ]] = getMultiRobot() +16> , +17> i +18> = +19> 0 +20> ; +21> i +22> < +23> 1 +24> ; +25> i +26> ++ +27> ) +28> { +1->Emitted(63, 1) Source(74, 1) + SourceIndex(0) +2 >Emitted(63, 4) Source(74, 4) + SourceIndex(0) +3 >Emitted(63, 5) Source(74, 5) + SourceIndex(0) +4 >Emitted(63, 6) Source(74, 6) + SourceIndex(0) +5 >Emitted(63, 7) Source(74, 6) + SourceIndex(0) +6 >Emitted(63, 27) Source(74, 66) + SourceIndex(0) +7 >Emitted(63, 29) Source(74, 7) + SourceIndex(0) +8 >Emitted(63, 43) Source(74, 13) + SourceIndex(0) +9 >Emitted(63, 45) Source(74, 15) + SourceIndex(0) +10>Emitted(63, 55) Source(74, 47) + SourceIndex(0) +11>Emitted(63, 57) Source(74, 16) + SourceIndex(0) +12>Emitted(63, 78) Source(74, 29) + SourceIndex(0) +13>Emitted(63, 80) Source(74, 31) + SourceIndex(0) +14>Emitted(63, 103) Source(74, 46) + SourceIndex(0) +15>Emitted(63, 108) Source(74, 66) + SourceIndex(0) +16>Emitted(63, 110) Source(74, 68) + SourceIndex(0) +17>Emitted(63, 111) Source(74, 69) + SourceIndex(0) +18>Emitted(63, 114) Source(74, 72) + SourceIndex(0) +19>Emitted(63, 115) Source(74, 73) + SourceIndex(0) +20>Emitted(63, 117) Source(74, 75) + SourceIndex(0) +21>Emitted(63, 118) Source(74, 76) + SourceIndex(0) +22>Emitted(63, 121) Source(74, 79) + SourceIndex(0) +23>Emitted(63, 122) Source(74, 80) + SourceIndex(0) +24>Emitted(63, 124) Source(74, 82) + SourceIndex(0) +25>Emitted(63, 125) Source(74, 83) + SourceIndex(0) +26>Emitted(63, 127) Source(74, 85) + SourceIndex(0) +27>Emitted(63, 129) Source(74, 87) + SourceIndex(0) +28>Emitted(63, 130) Source(74, 88) + SourceIndex(0) +--- +>>> console.log(nameMA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameMA +7 > ) +8 > ; +1 >Emitted(64, 5) Source(75, 5) + SourceIndex(0) +2 >Emitted(64, 12) Source(75, 12) + SourceIndex(0) +3 >Emitted(64, 13) Source(75, 13) + SourceIndex(0) +4 >Emitted(64, 16) Source(75, 16) + SourceIndex(0) +5 >Emitted(64, 17) Source(75, 17) + SourceIndex(0) +6 >Emitted(64, 23) Source(75, 23) + SourceIndex(0) +7 >Emitted(64, 24) Source(75, 24) + SourceIndex(0) +8 >Emitted(64, 25) Source(75, 25) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(65, 1) Source(76, 1) + SourceIndex(0) +2 >Emitted(65, 2) Source(76, 2) + SourceIndex(0) +--- +>>>for ((_s = ["trimmer", ["trimming", "edging"]], nameMA = _s[0], _t = _s[1], primarySkillA = _t[0], secondarySkillA = _t[1], _s), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^^^^^^^^^^ +15> ^^^^^ +16> ^^ +17> ^ +18> ^^^ +19> ^ +20> ^^ +21> ^ +22> ^^^ +23> ^ +24> ^^ +25> ^ +26> ^^ +27> ^^ +28> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > [nameMA, [primarySkillA, secondarySkillA]] = ["trimmer", ["trimming", "edging"]] +7 > +8 > nameMA +9 > , +10> [primarySkillA, secondarySkillA] +11> +12> primarySkillA +13> , +14> secondarySkillA +15> ]] = ["trimmer", ["trimming", "edging"]] +16> , +17> i +18> = +19> 0 +20> ; +21> i +22> < +23> 1 +24> ; +25> i +26> ++ +27> ) +28> { +1->Emitted(66, 1) Source(77, 1) + SourceIndex(0) +2 >Emitted(66, 4) Source(77, 4) + SourceIndex(0) +3 >Emitted(66, 5) Source(77, 5) + SourceIndex(0) +4 >Emitted(66, 6) Source(77, 6) + SourceIndex(0) +5 >Emitted(66, 7) Source(77, 6) + SourceIndex(0) +6 >Emitted(66, 47) Source(77, 86) + SourceIndex(0) +7 >Emitted(66, 49) Source(77, 7) + SourceIndex(0) +8 >Emitted(66, 63) Source(77, 13) + SourceIndex(0) +9 >Emitted(66, 65) Source(77, 15) + SourceIndex(0) +10>Emitted(66, 75) Source(77, 47) + SourceIndex(0) +11>Emitted(66, 77) Source(77, 16) + SourceIndex(0) +12>Emitted(66, 98) Source(77, 29) + SourceIndex(0) +13>Emitted(66, 100) Source(77, 31) + SourceIndex(0) +14>Emitted(66, 123) Source(77, 46) + SourceIndex(0) +15>Emitted(66, 128) Source(77, 86) + SourceIndex(0) +16>Emitted(66, 130) Source(77, 88) + SourceIndex(0) +17>Emitted(66, 131) Source(77, 89) + SourceIndex(0) +18>Emitted(66, 134) Source(77, 92) + SourceIndex(0) +19>Emitted(66, 135) Source(77, 93) + SourceIndex(0) +20>Emitted(66, 137) Source(77, 95) + SourceIndex(0) +21>Emitted(66, 138) Source(77, 96) + SourceIndex(0) +22>Emitted(66, 141) Source(77, 99) + SourceIndex(0) +23>Emitted(66, 142) Source(77, 100) + SourceIndex(0) +24>Emitted(66, 144) Source(77, 102) + SourceIndex(0) +25>Emitted(66, 145) Source(77, 103) + SourceIndex(0) +26>Emitted(66, 147) Source(77, 105) + SourceIndex(0) +27>Emitted(66, 149) Source(77, 107) + SourceIndex(0) +28>Emitted(66, 150) Source(77, 108) + SourceIndex(0) +--- +>>> console.log(nameMA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameMA +7 > ) +8 > ; +1 >Emitted(67, 5) Source(78, 5) + SourceIndex(0) +2 >Emitted(67, 12) Source(78, 12) + SourceIndex(0) +3 >Emitted(67, 13) Source(78, 13) + SourceIndex(0) +4 >Emitted(67, 16) Source(78, 16) + SourceIndex(0) +5 >Emitted(67, 17) Source(78, 17) + SourceIndex(0) +6 >Emitted(67, 23) Source(78, 23) + SourceIndex(0) +7 >Emitted(67, 24) Source(78, 24) + SourceIndex(0) +8 >Emitted(67, 25) Source(78, 25) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(68, 1) Source(79, 1) + SourceIndex(0) +2 >Emitted(68, 2) Source(79, 2) + SourceIndex(0) +--- +>>>for ((numberA3 = robotA[0], robotAInfo = robotA.slice(1), robotA), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^ +11> ^ +12> ^^ +13> ^ +14> ^^^ +15> ^ +16> ^^ +17> ^ +18> ^^^ +19> ^ +20> ^^ +21> ^ +22> ^^ +23> ^^ +24> ^ +1-> + > + > +2 >for +3 > +4 > ( +5 > [ +6 > numberA3 +7 > , +8 > ...robotAInfo +9 > ] = +10> robotA +11> +12> , +13> i +14> = +15> 0 +16> ; +17> i +18> < +19> 1 +20> ; +21> i +22> ++ +23> ) +24> { +1->Emitted(69, 1) Source(81, 1) + SourceIndex(0) +2 >Emitted(69, 4) Source(81, 4) + SourceIndex(0) +3 >Emitted(69, 5) Source(81, 5) + SourceIndex(0) +4 >Emitted(69, 6) Source(81, 6) + SourceIndex(0) +5 >Emitted(69, 7) Source(81, 7) + SourceIndex(0) +6 >Emitted(69, 27) Source(81, 15) + SourceIndex(0) +7 >Emitted(69, 29) Source(81, 17) + SourceIndex(0) +8 >Emitted(69, 57) Source(81, 30) + SourceIndex(0) +9 >Emitted(69, 59) Source(81, 34) + SourceIndex(0) +10>Emitted(69, 65) Source(81, 40) + SourceIndex(0) +11>Emitted(69, 66) Source(81, 40) + SourceIndex(0) +12>Emitted(69, 68) Source(81, 42) + SourceIndex(0) +13>Emitted(69, 69) Source(81, 43) + SourceIndex(0) +14>Emitted(69, 72) Source(81, 46) + SourceIndex(0) +15>Emitted(69, 73) Source(81, 47) + SourceIndex(0) +16>Emitted(69, 75) Source(81, 49) + SourceIndex(0) +17>Emitted(69, 76) Source(81, 50) + SourceIndex(0) +18>Emitted(69, 79) Source(81, 53) + SourceIndex(0) +19>Emitted(69, 80) Source(81, 54) + SourceIndex(0) +20>Emitted(69, 82) Source(81, 56) + SourceIndex(0) +21>Emitted(69, 83) Source(81, 57) + SourceIndex(0) +22>Emitted(69, 85) Source(81, 59) + SourceIndex(0) +23>Emitted(69, 87) Source(81, 61) + SourceIndex(0) +24>Emitted(69, 88) Source(81, 62) + SourceIndex(0) +--- +>>> console.log(numberA3); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > numberA3 +7 > ) +8 > ; +1 >Emitted(70, 5) Source(82, 5) + SourceIndex(0) +2 >Emitted(70, 12) Source(82, 12) + SourceIndex(0) +3 >Emitted(70, 13) Source(82, 13) + SourceIndex(0) +4 >Emitted(70, 16) Source(82, 16) + SourceIndex(0) +5 >Emitted(70, 17) Source(82, 17) + SourceIndex(0) +6 >Emitted(70, 25) Source(82, 25) + SourceIndex(0) +7 >Emitted(70, 26) Source(82, 26) + SourceIndex(0) +8 >Emitted(70, 27) Source(82, 27) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(71, 1) Source(83, 1) + SourceIndex(0) +2 >Emitted(71, 2) Source(83, 2) + SourceIndex(0) +--- +>>>for ((_u = getRobot(), numberA3 = _u[0], robotAInfo = _u.slice(1), _u), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^^^^ +12> ^^ +13> ^ +14> ^^^ +15> ^ +16> ^^ +17> ^ +18> ^^^ +19> ^ +20> ^^ +21> ^ +22> ^^ +23> ^^ +24> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > [numberA3, ...robotAInfo] = getRobot() +7 > +8 > numberA3 +9 > , +10> ...robotAInfo +11> ] = getRobot() +12> , +13> i +14> = +15> 0 +16> ; +17> i +18> < +19> 1 +20> ; +21> i +22> ++ +23> ) +24> { +1->Emitted(72, 1) Source(84, 1) + SourceIndex(0) +2 >Emitted(72, 4) Source(84, 4) + SourceIndex(0) +3 >Emitted(72, 5) Source(84, 5) + SourceIndex(0) +4 >Emitted(72, 6) Source(84, 6) + SourceIndex(0) +5 >Emitted(72, 7) Source(84, 6) + SourceIndex(0) +6 >Emitted(72, 22) Source(84, 44) + SourceIndex(0) +7 >Emitted(72, 24) Source(84, 7) + SourceIndex(0) +8 >Emitted(72, 40) Source(84, 15) + SourceIndex(0) +9 >Emitted(72, 42) Source(84, 17) + SourceIndex(0) +10>Emitted(72, 66) Source(84, 30) + SourceIndex(0) +11>Emitted(72, 71) Source(84, 44) + SourceIndex(0) +12>Emitted(72, 73) Source(84, 46) + SourceIndex(0) +13>Emitted(72, 74) Source(84, 47) + SourceIndex(0) +14>Emitted(72, 77) Source(84, 50) + SourceIndex(0) +15>Emitted(72, 78) Source(84, 51) + SourceIndex(0) +16>Emitted(72, 80) Source(84, 53) + SourceIndex(0) +17>Emitted(72, 81) Source(84, 54) + SourceIndex(0) +18>Emitted(72, 84) Source(84, 57) + SourceIndex(0) +19>Emitted(72, 85) Source(84, 58) + SourceIndex(0) +20>Emitted(72, 87) Source(84, 60) + SourceIndex(0) +21>Emitted(72, 88) Source(84, 61) + SourceIndex(0) +22>Emitted(72, 90) Source(84, 63) + SourceIndex(0) +23>Emitted(72, 92) Source(84, 65) + SourceIndex(0) +24>Emitted(72, 93) Source(84, 66) + SourceIndex(0) +--- +>>> console.log(numberA3); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > numberA3 +7 > ) +8 > ; +1 >Emitted(73, 5) Source(85, 5) + SourceIndex(0) +2 >Emitted(73, 12) Source(85, 12) + SourceIndex(0) +3 >Emitted(73, 13) Source(85, 13) + SourceIndex(0) +4 >Emitted(73, 16) Source(85, 16) + SourceIndex(0) +5 >Emitted(73, 17) Source(85, 17) + SourceIndex(0) +6 >Emitted(73, 25) Source(85, 25) + SourceIndex(0) +7 >Emitted(73, 26) Source(85, 26) + SourceIndex(0) +8 >Emitted(73, 27) Source(85, 27) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(74, 1) Source(86, 1) + SourceIndex(0) +2 >Emitted(74, 2) Source(86, 2) + SourceIndex(0) +--- +>>>for ((_v = [2, "trimmer", "trimming"], numberA3 = _v[0], robotAInfo = _v.slice(1), _v), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^^^^ +12> ^^ +13> ^ +14> ^^^ +15> ^ +16> ^^ +17> ^ +18> ^^^ +19> ^ +20> ^^ +21> ^ +22> ^^ +23> ^^ +24> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > [numberA3, ...robotAInfo] = [2, "trimmer", "trimming"] +7 > +8 > numberA3 +9 > , +10> ...robotAInfo +11> ] = [2, "trimmer", "trimming"] +12> , +13> i +14> = +15> 0 +16> ; +17> i +18> < +19> 1 +20> ; +21> i +22> ++ +23> ) +24> { +1->Emitted(75, 1) Source(87, 1) + SourceIndex(0) +2 >Emitted(75, 4) Source(87, 4) + SourceIndex(0) +3 >Emitted(75, 5) Source(87, 5) + SourceIndex(0) +4 >Emitted(75, 6) Source(87, 6) + SourceIndex(0) +5 >Emitted(75, 7) Source(87, 6) + SourceIndex(0) +6 >Emitted(75, 38) Source(87, 67) + SourceIndex(0) +7 >Emitted(75, 40) Source(87, 7) + SourceIndex(0) +8 >Emitted(75, 56) Source(87, 15) + SourceIndex(0) +9 >Emitted(75, 58) Source(87, 17) + SourceIndex(0) +10>Emitted(75, 82) Source(87, 30) + SourceIndex(0) +11>Emitted(75, 87) Source(87, 67) + SourceIndex(0) +12>Emitted(75, 89) Source(87, 69) + SourceIndex(0) +13>Emitted(75, 90) Source(87, 70) + SourceIndex(0) +14>Emitted(75, 93) Source(87, 73) + SourceIndex(0) +15>Emitted(75, 94) Source(87, 74) + SourceIndex(0) +16>Emitted(75, 96) Source(87, 76) + SourceIndex(0) +17>Emitted(75, 97) Source(87, 77) + SourceIndex(0) +18>Emitted(75, 100) Source(87, 80) + SourceIndex(0) +19>Emitted(75, 101) Source(87, 81) + SourceIndex(0) +20>Emitted(75, 103) Source(87, 83) + SourceIndex(0) +21>Emitted(75, 104) Source(87, 84) + SourceIndex(0) +22>Emitted(75, 106) Source(87, 86) + SourceIndex(0) +23>Emitted(75, 108) Source(87, 88) + SourceIndex(0) +24>Emitted(75, 109) Source(87, 89) + SourceIndex(0) +--- +>>> console.log(numberA3); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > numberA3 +7 > ) +8 > ; +1 >Emitted(76, 5) Source(88, 5) + SourceIndex(0) +2 >Emitted(76, 12) Source(88, 12) + SourceIndex(0) +3 >Emitted(76, 13) Source(88, 13) + SourceIndex(0) +4 >Emitted(76, 16) Source(88, 16) + SourceIndex(0) +5 >Emitted(76, 17) Source(88, 17) + SourceIndex(0) +6 >Emitted(76, 25) Source(88, 25) + SourceIndex(0) +7 >Emitted(76, 26) Source(88, 26) + SourceIndex(0) +8 >Emitted(76, 27) Source(88, 27) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(77, 1) Source(89, 1) + SourceIndex(0) +2 >Emitted(77, 2) Source(89, 2) + SourceIndex(0) +--- +>>>for ((multiRobotAInfo = multiRobotA.slice(0), multiRobotA), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^ +9 > ^ +10> ^^ +11> ^ +12> ^^^ +13> ^ +14> ^^ +15> ^ +16> ^^^ +17> ^ +18> ^^ +19> ^ +20> ^^ +21> ^^ +22> ^ +1-> + > +2 >for +3 > +4 > ( +5 > [ +6 > ...multiRobotAInfo +7 > ] = +8 > multiRobotA +9 > +10> , +11> i +12> = +13> 0 +14> ; +15> i +16> < +17> 1 +18> ; +19> i +20> ++ +21> ) +22> { +1->Emitted(78, 1) Source(90, 1) + SourceIndex(0) +2 >Emitted(78, 4) Source(90, 4) + SourceIndex(0) +3 >Emitted(78, 5) Source(90, 5) + SourceIndex(0) +4 >Emitted(78, 6) Source(90, 6) + SourceIndex(0) +5 >Emitted(78, 7) Source(90, 7) + SourceIndex(0) +6 >Emitted(78, 45) Source(90, 25) + SourceIndex(0) +7 >Emitted(78, 47) Source(90, 29) + SourceIndex(0) +8 >Emitted(78, 58) Source(90, 40) + SourceIndex(0) +9 >Emitted(78, 59) Source(90, 40) + SourceIndex(0) +10>Emitted(78, 61) Source(90, 42) + SourceIndex(0) +11>Emitted(78, 62) Source(90, 43) + SourceIndex(0) +12>Emitted(78, 65) Source(90, 46) + SourceIndex(0) +13>Emitted(78, 66) Source(90, 47) + SourceIndex(0) +14>Emitted(78, 68) Source(90, 49) + SourceIndex(0) +15>Emitted(78, 69) Source(90, 50) + SourceIndex(0) +16>Emitted(78, 72) Source(90, 53) + SourceIndex(0) +17>Emitted(78, 73) Source(90, 54) + SourceIndex(0) +18>Emitted(78, 75) Source(90, 56) + SourceIndex(0) +19>Emitted(78, 76) Source(90, 57) + SourceIndex(0) +20>Emitted(78, 78) Source(90, 59) + SourceIndex(0) +21>Emitted(78, 80) Source(90, 61) + SourceIndex(0) +22>Emitted(78, 81) Source(90, 62) + SourceIndex(0) +--- +>>> console.log(multiRobotAInfo); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^^^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > multiRobotAInfo +7 > ) +8 > ; +1 >Emitted(79, 5) Source(91, 5) + SourceIndex(0) +2 >Emitted(79, 12) Source(91, 12) + SourceIndex(0) +3 >Emitted(79, 13) Source(91, 13) + SourceIndex(0) +4 >Emitted(79, 16) Source(91, 16) + SourceIndex(0) +5 >Emitted(79, 17) Source(91, 17) + SourceIndex(0) +6 >Emitted(79, 32) Source(91, 32) + SourceIndex(0) +7 >Emitted(79, 33) Source(91, 33) + SourceIndex(0) +8 >Emitted(79, 34) Source(91, 34) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(80, 1) Source(92, 1) + SourceIndex(0) +2 >Emitted(80, 2) Source(92, 2) + SourceIndex(0) +--- +>>>for ((_w = getMultiRobot(), multiRobotAInfo = _w.slice(0), _w), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +9 > ^^^^^ +10> ^^ +11> ^ +12> ^^^ +13> ^ +14> ^^ +15> ^ +16> ^^^ +17> ^ +18> ^^ +19> ^ +20> ^^ +21> ^^ +22> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > [...multiRobotAInfo] = getMultiRobot() +7 > +8 > ...multiRobotAInfo +9 > ] = getMultiRobot() +10> , +11> i +12> = +13> 0 +14> ; +15> i +16> < +17> 1 +18> ; +19> i +20> ++ +21> ) +22> { +1->Emitted(81, 1) Source(93, 1) + SourceIndex(0) +2 >Emitted(81, 4) Source(93, 4) + SourceIndex(0) +3 >Emitted(81, 5) Source(93, 5) + SourceIndex(0) +4 >Emitted(81, 6) Source(93, 6) + SourceIndex(0) +5 >Emitted(81, 7) Source(93, 6) + SourceIndex(0) +6 >Emitted(81, 27) Source(93, 44) + SourceIndex(0) +7 >Emitted(81, 29) Source(93, 7) + SourceIndex(0) +8 >Emitted(81, 58) Source(93, 25) + SourceIndex(0) +9 >Emitted(81, 63) Source(93, 44) + SourceIndex(0) +10>Emitted(81, 65) Source(93, 46) + SourceIndex(0) +11>Emitted(81, 66) Source(93, 47) + SourceIndex(0) +12>Emitted(81, 69) Source(93, 50) + SourceIndex(0) +13>Emitted(81, 70) Source(93, 51) + SourceIndex(0) +14>Emitted(81, 72) Source(93, 53) + SourceIndex(0) +15>Emitted(81, 73) Source(93, 54) + SourceIndex(0) +16>Emitted(81, 76) Source(93, 57) + SourceIndex(0) +17>Emitted(81, 77) Source(93, 58) + SourceIndex(0) +18>Emitted(81, 79) Source(93, 60) + SourceIndex(0) +19>Emitted(81, 80) Source(93, 61) + SourceIndex(0) +20>Emitted(81, 82) Source(93, 63) + SourceIndex(0) +21>Emitted(81, 84) Source(93, 65) + SourceIndex(0) +22>Emitted(81, 85) Source(93, 66) + SourceIndex(0) +--- +>>> console.log(multiRobotAInfo); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^^^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > multiRobotAInfo +7 > ) +8 > ; +1 >Emitted(82, 5) Source(94, 5) + SourceIndex(0) +2 >Emitted(82, 12) Source(94, 12) + SourceIndex(0) +3 >Emitted(82, 13) Source(94, 13) + SourceIndex(0) +4 >Emitted(82, 16) Source(94, 16) + SourceIndex(0) +5 >Emitted(82, 17) Source(94, 17) + SourceIndex(0) +6 >Emitted(82, 32) Source(94, 32) + SourceIndex(0) +7 >Emitted(82, 33) Source(94, 33) + SourceIndex(0) +8 >Emitted(82, 34) Source(94, 34) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(83, 1) Source(95, 1) + SourceIndex(0) +2 >Emitted(83, 2) Source(95, 2) + SourceIndex(0) +--- +>>>for ((_x = ["trimmer", ["trimming", "edging"]], multiRobotAInfo = _x.slice(0), _x), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +9 > ^^^^^ +10> ^^ +11> ^ +12> ^^^ +13> ^ +14> ^^ +15> ^ +16> ^^^ +17> ^ +18> ^^ +19> ^ +20> ^^ +21> ^^ +22> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > [...multiRobotAInfo] = ["trimmer", ["trimming", "edging"]] +7 > +8 > ...multiRobotAInfo +9 > ] = ["trimmer", ["trimming", "edging"]] +10> , +11> i +12> = +13> 0 +14> ; +15> i +16> < +17> 1 +18> ; +19> i +20> ++ +21> ) +22> { +1->Emitted(84, 1) Source(96, 1) + SourceIndex(0) +2 >Emitted(84, 4) Source(96, 4) + SourceIndex(0) +3 >Emitted(84, 5) Source(96, 5) + SourceIndex(0) +4 >Emitted(84, 6) Source(96, 6) + SourceIndex(0) +5 >Emitted(84, 7) Source(96, 6) + SourceIndex(0) +6 >Emitted(84, 47) Source(96, 83) + SourceIndex(0) +7 >Emitted(84, 49) Source(96, 7) + SourceIndex(0) +8 >Emitted(84, 78) Source(96, 25) + SourceIndex(0) +9 >Emitted(84, 83) Source(96, 83) + SourceIndex(0) +10>Emitted(84, 85) Source(96, 85) + SourceIndex(0) +11>Emitted(84, 86) Source(96, 86) + SourceIndex(0) +12>Emitted(84, 89) Source(96, 89) + SourceIndex(0) +13>Emitted(84, 90) Source(96, 90) + SourceIndex(0) +14>Emitted(84, 92) Source(96, 92) + SourceIndex(0) +15>Emitted(84, 93) Source(96, 93) + SourceIndex(0) +16>Emitted(84, 96) Source(96, 96) + SourceIndex(0) +17>Emitted(84, 97) Source(96, 97) + SourceIndex(0) +18>Emitted(84, 99) Source(96, 99) + SourceIndex(0) +19>Emitted(84, 100) Source(96, 100) + SourceIndex(0) +20>Emitted(84, 102) Source(96, 102) + SourceIndex(0) +21>Emitted(84, 104) Source(96, 104) + SourceIndex(0) +22>Emitted(84, 105) Source(96, 105) + SourceIndex(0) +--- +>>> console.log(multiRobotAInfo); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^^^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > multiRobotAInfo +7 > ) +8 > ; +1 >Emitted(85, 5) Source(97, 5) + SourceIndex(0) +2 >Emitted(85, 12) Source(97, 12) + SourceIndex(0) +3 >Emitted(85, 13) Source(97, 13) + SourceIndex(0) +4 >Emitted(85, 16) Source(97, 16) + SourceIndex(0) +5 >Emitted(85, 17) Source(97, 17) + SourceIndex(0) +6 >Emitted(85, 32) Source(97, 32) + SourceIndex(0) +7 >Emitted(85, 33) Source(97, 33) + SourceIndex(0) +8 >Emitted(85, 34) Source(97, 34) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(86, 1) Source(98, 1) + SourceIndex(0) +2 >Emitted(86, 2) Source(98, 2) + SourceIndex(0) +--- +>>>var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x; +>>>//# sourceMappingURL=sourceMapValidationDestructuringForArrayBindingPattern2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPattern2.symbols b/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPattern2.symbols new file mode 100644 index 00000000000..5c269a42043 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPattern2.symbols @@ -0,0 +1,390 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringForArrayBindingPattern2.ts === +declare var console: { +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 0, 11)) + + log(msg: any): void; +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 0, 22)) +>msg : Symbol(msg, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 1, 8)) +} +type Robot = [number, string, string]; +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 2, 1)) + +type MultiSkilledRobot = [string, [string, string]]; +>MultiSkilledRobot : Symbol(MultiSkilledRobot, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 3, 38)) + +let robotA: Robot = [1, "mower", "mowing"]; +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 6, 3)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 2, 1)) + +function getRobot() { +>getRobot : Symbol(getRobot, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 6, 43)) + + return robotA; +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 6, 3)) +} + +let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; +>multiRobotA : Symbol(multiRobotA, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 11, 3)) +>MultiSkilledRobot : Symbol(MultiSkilledRobot, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 3, 38)) + +let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; +>multiRobotB : Symbol(multiRobotB, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 12, 3)) +>MultiSkilledRobot : Symbol(MultiSkilledRobot, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 3, 38)) + +function getMultiRobot() { +>getMultiRobot : Symbol(getMultiRobot, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 12, 73)) + + return multiRobotA; +>multiRobotA : Symbol(multiRobotA, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 11, 3)) +} + +let nameA: string, primarySkillA: string, secondarySkillA: string; +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 17, 3)) +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 17, 18)) +>secondarySkillA : Symbol(secondarySkillA, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 17, 41)) + +let numberB: number, nameB: string; +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 18, 3)) +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 18, 20)) + +let numberA2: number, nameA2: string, skillA2: string, nameMA: string; +>numberA2 : Symbol(numberA2, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 19, 3)) +>nameA2 : Symbol(nameA2, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 19, 21)) +>skillA2 : Symbol(skillA2, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 19, 37)) +>nameMA : Symbol(nameMA, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 19, 54)) + +let numberA3: number, robotAInfo: (number | string)[], multiRobotAInfo: (string | [string, string])[]; +>numberA3 : Symbol(numberA3, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 20, 3)) +>robotAInfo : Symbol(robotAInfo, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 20, 21)) +>multiRobotAInfo : Symbol(multiRobotAInfo, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 20, 54)) + +let i: number; +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 21, 3)) + +for ([, nameA] = robotA, i = 0; i < 1; i++) { +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 17, 3)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 6, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 21, 3)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 17, 3)) +} +for ([, nameA] = getRobot(), i = 0; i < 1; i++) { +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 17, 3)) +>getRobot : Symbol(getRobot, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 6, 43)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 21, 3)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 17, 3)) +} +for ([, nameA] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 17, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 21, 3)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 17, 3)) +} +for ([, [primarySkillA, secondarySkillA]] = multiRobotA, i = 0; i < 1; i++) { +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 17, 18)) +>secondarySkillA : Symbol(secondarySkillA, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 17, 41)) +>multiRobotA : Symbol(multiRobotA, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 11, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 21, 3)) + + console.log(primarySkillA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 0, 22)) +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 17, 18)) +} +for ([, [primarySkillA, secondarySkillA]] = getMultiRobot(), i = 0; i < 1; i++) { +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 17, 18)) +>secondarySkillA : Symbol(secondarySkillA, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 17, 41)) +>getMultiRobot : Symbol(getMultiRobot, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 12, 73)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 21, 3)) + + console.log(primarySkillA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 0, 22)) +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 17, 18)) +} +for ([, [primarySkillA, secondarySkillA]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 17, 18)) +>secondarySkillA : Symbol(secondarySkillA, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 17, 41)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 21, 3)) + + console.log(primarySkillA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 0, 22)) +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 17, 18)) +} + +for ([numberB] = robotA, i = 0; i < 1; i++) { +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 18, 3)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 6, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 21, 3)) + + console.log(numberB); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 0, 22)) +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 18, 3)) +} +for ([numberB] = getRobot(), i = 0; i < 1; i++) { +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 18, 3)) +>getRobot : Symbol(getRobot, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 6, 43)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 21, 3)) + + console.log(numberB); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 0, 22)) +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 18, 3)) +} +for ([numberB] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 18, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 21, 3)) + + console.log(numberB); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 0, 22)) +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 18, 3)) +} +for ([nameB] = multiRobotA, i = 0; i < 1; i++) { +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 18, 20)) +>multiRobotA : Symbol(multiRobotA, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 11, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 21, 3)) + + console.log(nameB); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 0, 22)) +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 18, 20)) +} +for ([nameB] = getMultiRobot(), i = 0; i < 1; i++) { +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 18, 20)) +>getMultiRobot : Symbol(getMultiRobot, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 12, 73)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 21, 3)) + + console.log(nameB); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 0, 22)) +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 18, 20)) +} +for ([nameB] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 18, 20)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 21, 3)) + + console.log(nameB); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 0, 22)) +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 18, 20)) +} + +for ([numberA2, nameA2, skillA2] = robotA, i = 0; i < 1; i++) { +>numberA2 : Symbol(numberA2, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 19, 3)) +>nameA2 : Symbol(nameA2, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 19, 21)) +>skillA2 : Symbol(skillA2, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 19, 37)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 6, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 21, 3)) + + console.log(nameA2); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 0, 22)) +>nameA2 : Symbol(nameA2, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 19, 21)) +} +for ([numberA2, nameA2, skillA2] = getRobot(), i = 0; i < 1; i++) { +>numberA2 : Symbol(numberA2, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 19, 3)) +>nameA2 : Symbol(nameA2, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 19, 21)) +>skillA2 : Symbol(skillA2, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 19, 37)) +>getRobot : Symbol(getRobot, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 6, 43)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 21, 3)) + + console.log(nameA2); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 0, 22)) +>nameA2 : Symbol(nameA2, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 19, 21)) +} +for ([numberA2, nameA2, skillA2] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { +>numberA2 : Symbol(numberA2, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 19, 3)) +>nameA2 : Symbol(nameA2, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 19, 21)) +>skillA2 : Symbol(skillA2, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 19, 37)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 21, 3)) + + console.log(nameA2); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 0, 22)) +>nameA2 : Symbol(nameA2, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 19, 21)) +} +for ([nameMA, [primarySkillA, secondarySkillA]] = multiRobotA, i = 0; i < 1; i++) { +>nameMA : Symbol(nameMA, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 19, 54)) +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 17, 18)) +>secondarySkillA : Symbol(secondarySkillA, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 17, 41)) +>multiRobotA : Symbol(multiRobotA, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 11, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 21, 3)) + + console.log(nameMA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 0, 22)) +>nameMA : Symbol(nameMA, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 19, 54)) +} +for ([nameMA, [primarySkillA, secondarySkillA]] = getMultiRobot(), i = 0; i < 1; i++) { +>nameMA : Symbol(nameMA, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 19, 54)) +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 17, 18)) +>secondarySkillA : Symbol(secondarySkillA, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 17, 41)) +>getMultiRobot : Symbol(getMultiRobot, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 12, 73)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 21, 3)) + + console.log(nameMA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 0, 22)) +>nameMA : Symbol(nameMA, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 19, 54)) +} +for ([nameMA, [primarySkillA, secondarySkillA]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { +>nameMA : Symbol(nameMA, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 19, 54)) +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 17, 18)) +>secondarySkillA : Symbol(secondarySkillA, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 17, 41)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 21, 3)) + + console.log(nameMA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 0, 22)) +>nameMA : Symbol(nameMA, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 19, 54)) +} + +for ([numberA3, ...robotAInfo] = robotA, i = 0; i < 1; i++) { +>numberA3 : Symbol(numberA3, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 20, 3)) +>robotAInfo : Symbol(robotAInfo, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 20, 21)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 6, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 21, 3)) + + console.log(numberA3); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 0, 22)) +>numberA3 : Symbol(numberA3, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 20, 3)) +} +for ([numberA3, ...robotAInfo] = getRobot(), i = 0; i < 1; i++) { +>numberA3 : Symbol(numberA3, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 20, 3)) +>robotAInfo : Symbol(robotAInfo, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 20, 21)) +>getRobot : Symbol(getRobot, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 6, 43)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 21, 3)) + + console.log(numberA3); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 0, 22)) +>numberA3 : Symbol(numberA3, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 20, 3)) +} +for ([numberA3, ...robotAInfo] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { +>numberA3 : Symbol(numberA3, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 20, 3)) +>robotAInfo : Symbol(robotAInfo, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 20, 21)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 2, 1)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 21, 3)) + + console.log(numberA3); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 0, 22)) +>numberA3 : Symbol(numberA3, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 20, 3)) +} +for ([...multiRobotAInfo] = multiRobotA, i = 0; i < 1; i++) { +>multiRobotAInfo : Symbol(multiRobotAInfo, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 20, 54)) +>multiRobotA : Symbol(multiRobotA, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 11, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 21, 3)) + + console.log(multiRobotAInfo); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 0, 22)) +>multiRobotAInfo : Symbol(multiRobotAInfo, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 20, 54)) +} +for ([...multiRobotAInfo] = getMultiRobot(), i = 0; i < 1; i++) { +>multiRobotAInfo : Symbol(multiRobotAInfo, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 20, 54)) +>getMultiRobot : Symbol(getMultiRobot, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 12, 73)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 21, 3)) + + console.log(multiRobotAInfo); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 0, 22)) +>multiRobotAInfo : Symbol(multiRobotAInfo, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 20, 54)) +} +for ([...multiRobotAInfo] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { +>multiRobotAInfo : Symbol(multiRobotAInfo, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 20, 54)) +>MultiSkilledRobot : Symbol(MultiSkilledRobot, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 3, 38)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 21, 3)) + + console.log(multiRobotAInfo); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 0, 22)) +>multiRobotAInfo : Symbol(multiRobotAInfo, Decl(sourceMapValidationDestructuringForArrayBindingPattern2.ts, 20, 54)) +} diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPattern2.types b/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPattern2.types new file mode 100644 index 00000000000..a50f506262d --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPattern2.types @@ -0,0 +1,684 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringForArrayBindingPattern2.ts === +declare var console: { +>console : { log(msg: any): void; } + + log(msg: any): void; +>log : (msg: any) => void +>msg : any +} +type Robot = [number, string, string]; +>Robot : [number, string, string] + +type MultiSkilledRobot = [string, [string, string]]; +>MultiSkilledRobot : [string, [string, string]] + +let robotA: Robot = [1, "mower", "mowing"]; +>robotA : [number, string, string] +>Robot : [number, string, string] +>[1, "mower", "mowing"] : [number, string, string] +>1 : number +>"mower" : string +>"mowing" : string + +function getRobot() { +>getRobot : () => [number, string, string] + + return robotA; +>robotA : [number, string, string] +} + +let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; +>multiRobotA : [string, [string, string]] +>MultiSkilledRobot : [string, [string, string]] +>["mower", ["mowing", ""]] : [string, [string, string]] +>"mower" : string +>["mowing", ""] : [string, string] +>"mowing" : string +>"" : string + +let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; +>multiRobotB : [string, [string, string]] +>MultiSkilledRobot : [string, [string, string]] +>["trimmer", ["trimming", "edging"]] : [string, [string, string]] +>"trimmer" : string +>["trimming", "edging"] : [string, string] +>"trimming" : string +>"edging" : string + +function getMultiRobot() { +>getMultiRobot : () => [string, [string, string]] + + return multiRobotA; +>multiRobotA : [string, [string, string]] +} + +let nameA: string, primarySkillA: string, secondarySkillA: string; +>nameA : string +>primarySkillA : string +>secondarySkillA : string + +let numberB: number, nameB: string; +>numberB : number +>nameB : string + +let numberA2: number, nameA2: string, skillA2: string, nameMA: string; +>numberA2 : number +>nameA2 : string +>skillA2 : string +>nameMA : string + +let numberA3: number, robotAInfo: (number | string)[], multiRobotAInfo: (string | [string, string])[]; +>numberA3 : number +>robotAInfo : (number | string)[] +>multiRobotAInfo : (string | [string, string])[] + +let i: number; +>i : number + +for ([, nameA] = robotA, i = 0; i < 1; i++) { +>[, nameA] = robotA, i = 0 : number +>[, nameA] = robotA : [number, string, string] +>[, nameA] : [undefined, string] +> : undefined +>nameA : string +>robotA : [number, string, string] +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for ([, nameA] = getRobot(), i = 0; i < 1; i++) { +>[, nameA] = getRobot(), i = 0 : number +>[, nameA] = getRobot() : [number, string, string] +>[, nameA] : [undefined, string] +> : undefined +>nameA : string +>getRobot() : [number, string, string] +>getRobot : () => [number, string, string] +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for ([, nameA] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { +>[, nameA] = [2, "trimmer", "trimming"], i = 0 : number +>[, nameA] = [2, "trimmer", "trimming"] : [number, string, string] +>[, nameA] : [undefined, string] +> : undefined +>nameA : string +>[2, "trimmer", "trimming"] : [number, string, string] +>2 : number +>"trimmer" : string +>"trimming" : string +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for ([, [primarySkillA, secondarySkillA]] = multiRobotA, i = 0; i < 1; i++) { +>[, [primarySkillA, secondarySkillA]] = multiRobotA, i = 0 : number +>[, [primarySkillA, secondarySkillA]] = multiRobotA : [string, [string, string]] +>[, [primarySkillA, secondarySkillA]] : [undefined, [string, string]] +> : undefined +>[primarySkillA, secondarySkillA] : [string, string] +>primarySkillA : string +>secondarySkillA : string +>multiRobotA : [string, [string, string]] +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(primarySkillA); +>console.log(primarySkillA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primarySkillA : string +} +for ([, [primarySkillA, secondarySkillA]] = getMultiRobot(), i = 0; i < 1; i++) { +>[, [primarySkillA, secondarySkillA]] = getMultiRobot(), i = 0 : number +>[, [primarySkillA, secondarySkillA]] = getMultiRobot() : [string, [string, string]] +>[, [primarySkillA, secondarySkillA]] : [undefined, [string, string]] +> : undefined +>[primarySkillA, secondarySkillA] : [string, string] +>primarySkillA : string +>secondarySkillA : string +>getMultiRobot() : [string, [string, string]] +>getMultiRobot : () => [string, [string, string]] +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(primarySkillA); +>console.log(primarySkillA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primarySkillA : string +} +for ([, [primarySkillA, secondarySkillA]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { +>[, [primarySkillA, secondarySkillA]] = ["trimmer", ["trimming", "edging"]], i = 0 : number +>[, [primarySkillA, secondarySkillA]] = ["trimmer", ["trimming", "edging"]] : [string, [string, string]] +>[, [primarySkillA, secondarySkillA]] : [undefined, [string, string]] +> : undefined +>[primarySkillA, secondarySkillA] : [string, string] +>primarySkillA : string +>secondarySkillA : string +>["trimmer", ["trimming", "edging"]] : [string, [string, string]] +>"trimmer" : string +>["trimming", "edging"] : [string, string] +>"trimming" : string +>"edging" : string +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(primarySkillA); +>console.log(primarySkillA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primarySkillA : string +} + +for ([numberB] = robotA, i = 0; i < 1; i++) { +>[numberB] = robotA, i = 0 : number +>[numberB] = robotA : [number, string, string] +>[numberB] : [number] +>numberB : number +>robotA : [number, string, string] +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(numberB); +>console.log(numberB) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>numberB : number +} +for ([numberB] = getRobot(), i = 0; i < 1; i++) { +>[numberB] = getRobot(), i = 0 : number +>[numberB] = getRobot() : [number, string, string] +>[numberB] : [number] +>numberB : number +>getRobot() : [number, string, string] +>getRobot : () => [number, string, string] +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(numberB); +>console.log(numberB) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>numberB : number +} +for ([numberB] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { +>[numberB] = [2, "trimmer", "trimming"], i = 0 : number +>[numberB] = [2, "trimmer", "trimming"] : [number, string, string] +>[numberB] : [number] +>numberB : number +>[2, "trimmer", "trimming"] : [number, string, string] +>2 : number +>"trimmer" : string +>"trimming" : string +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(numberB); +>console.log(numberB) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>numberB : number +} +for ([nameB] = multiRobotA, i = 0; i < 1; i++) { +>[nameB] = multiRobotA, i = 0 : number +>[nameB] = multiRobotA : [string, [string, string]] +>[nameB] : [string] +>nameB : string +>multiRobotA : [string, [string, string]] +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameB); +>console.log(nameB) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameB : string +} +for ([nameB] = getMultiRobot(), i = 0; i < 1; i++) { +>[nameB] = getMultiRobot(), i = 0 : number +>[nameB] = getMultiRobot() : [string, [string, string]] +>[nameB] : [string] +>nameB : string +>getMultiRobot() : [string, [string, string]] +>getMultiRobot : () => [string, [string, string]] +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameB); +>console.log(nameB) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameB : string +} +for ([nameB] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { +>[nameB] = ["trimmer", ["trimming", "edging"]], i = 0 : number +>[nameB] = ["trimmer", ["trimming", "edging"]] : [string, string[]] +>[nameB] : [string] +>nameB : string +>["trimmer", ["trimming", "edging"]] : [string, string[]] +>"trimmer" : string +>["trimming", "edging"] : string[] +>"trimming" : string +>"edging" : string +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameB); +>console.log(nameB) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameB : string +} + +for ([numberA2, nameA2, skillA2] = robotA, i = 0; i < 1; i++) { +>[numberA2, nameA2, skillA2] = robotA, i = 0 : number +>[numberA2, nameA2, skillA2] = robotA : [number, string, string] +>[numberA2, nameA2, skillA2] : [number, string, string] +>numberA2 : number +>nameA2 : string +>skillA2 : string +>robotA : [number, string, string] +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameA2); +>console.log(nameA2) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA2 : string +} +for ([numberA2, nameA2, skillA2] = getRobot(), i = 0; i < 1; i++) { +>[numberA2, nameA2, skillA2] = getRobot(), i = 0 : number +>[numberA2, nameA2, skillA2] = getRobot() : [number, string, string] +>[numberA2, nameA2, skillA2] : [number, string, string] +>numberA2 : number +>nameA2 : string +>skillA2 : string +>getRobot() : [number, string, string] +>getRobot : () => [number, string, string] +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameA2); +>console.log(nameA2) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA2 : string +} +for ([numberA2, nameA2, skillA2] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { +>[numberA2, nameA2, skillA2] = [2, "trimmer", "trimming"], i = 0 : number +>[numberA2, nameA2, skillA2] = [2, "trimmer", "trimming"] : [number, string, string] +>[numberA2, nameA2, skillA2] : [number, string, string] +>numberA2 : number +>nameA2 : string +>skillA2 : string +>[2, "trimmer", "trimming"] : [number, string, string] +>2 : number +>"trimmer" : string +>"trimming" : string +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameA2); +>console.log(nameA2) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA2 : string +} +for ([nameMA, [primarySkillA, secondarySkillA]] = multiRobotA, i = 0; i < 1; i++) { +>[nameMA, [primarySkillA, secondarySkillA]] = multiRobotA, i = 0 : number +>[nameMA, [primarySkillA, secondarySkillA]] = multiRobotA : [string, [string, string]] +>[nameMA, [primarySkillA, secondarySkillA]] : [string, [string, string]] +>nameMA : string +>[primarySkillA, secondarySkillA] : [string, string] +>primarySkillA : string +>secondarySkillA : string +>multiRobotA : [string, [string, string]] +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameMA); +>console.log(nameMA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameMA : string +} +for ([nameMA, [primarySkillA, secondarySkillA]] = getMultiRobot(), i = 0; i < 1; i++) { +>[nameMA, [primarySkillA, secondarySkillA]] = getMultiRobot(), i = 0 : number +>[nameMA, [primarySkillA, secondarySkillA]] = getMultiRobot() : [string, [string, string]] +>[nameMA, [primarySkillA, secondarySkillA]] : [string, [string, string]] +>nameMA : string +>[primarySkillA, secondarySkillA] : [string, string] +>primarySkillA : string +>secondarySkillA : string +>getMultiRobot() : [string, [string, string]] +>getMultiRobot : () => [string, [string, string]] +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameMA); +>console.log(nameMA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameMA : string +} +for ([nameMA, [primarySkillA, secondarySkillA]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { +>[nameMA, [primarySkillA, secondarySkillA]] = ["trimmer", ["trimming", "edging"]], i = 0 : number +>[nameMA, [primarySkillA, secondarySkillA]] = ["trimmer", ["trimming", "edging"]] : [string, [string, string]] +>[nameMA, [primarySkillA, secondarySkillA]] : [string, [string, string]] +>nameMA : string +>[primarySkillA, secondarySkillA] : [string, string] +>primarySkillA : string +>secondarySkillA : string +>["trimmer", ["trimming", "edging"]] : [string, [string, string]] +>"trimmer" : string +>["trimming", "edging"] : [string, string] +>"trimming" : string +>"edging" : string +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameMA); +>console.log(nameMA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameMA : string +} + +for ([numberA3, ...robotAInfo] = robotA, i = 0; i < 1; i++) { +>[numberA3, ...robotAInfo] = robotA, i = 0 : number +>[numberA3, ...robotAInfo] = robotA : [number, string, string] +>[numberA3, ...robotAInfo] : (number | string)[] +>numberA3 : number +>...robotAInfo : number | string +>robotAInfo : (number | string)[] +>robotA : [number, string, string] +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(numberA3); +>console.log(numberA3) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>numberA3 : number +} +for ([numberA3, ...robotAInfo] = getRobot(), i = 0; i < 1; i++) { +>[numberA3, ...robotAInfo] = getRobot(), i = 0 : number +>[numberA3, ...robotAInfo] = getRobot() : [number, string, string] +>[numberA3, ...robotAInfo] : (number | string)[] +>numberA3 : number +>...robotAInfo : number | string +>robotAInfo : (number | string)[] +>getRobot() : [number, string, string] +>getRobot : () => [number, string, string] +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(numberA3); +>console.log(numberA3) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>numberA3 : number +} +for ([numberA3, ...robotAInfo] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { +>[numberA3, ...robotAInfo] = [2, "trimmer", "trimming"], i = 0 : number +>[numberA3, ...robotAInfo] = [2, "trimmer", "trimming"] : [number, string, string] +>[numberA3, ...robotAInfo] : (number | string)[] +>numberA3 : number +>...robotAInfo : number | string +>robotAInfo : (number | string)[] +>[2, "trimmer", "trimming"] : [number, string, string] +>Robot : [number, string, string] +>[2, "trimmer", "trimming"] : [number, string, string] +>2 : number +>"trimmer" : string +>"trimming" : string +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(numberA3); +>console.log(numberA3) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>numberA3 : number +} +for ([...multiRobotAInfo] = multiRobotA, i = 0; i < 1; i++) { +>[...multiRobotAInfo] = multiRobotA, i = 0 : number +>[...multiRobotAInfo] = multiRobotA : [string, [string, string]] +>[...multiRobotAInfo] : (string | [string, string])[] +>...multiRobotAInfo : string | [string, string] +>multiRobotAInfo : (string | [string, string])[] +>multiRobotA : [string, [string, string]] +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(multiRobotAInfo); +>console.log(multiRobotAInfo) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>multiRobotAInfo : (string | [string, string])[] +} +for ([...multiRobotAInfo] = getMultiRobot(), i = 0; i < 1; i++) { +>[...multiRobotAInfo] = getMultiRobot(), i = 0 : number +>[...multiRobotAInfo] = getMultiRobot() : [string, [string, string]] +>[...multiRobotAInfo] : (string | [string, string])[] +>...multiRobotAInfo : string | [string, string] +>multiRobotAInfo : (string | [string, string])[] +>getMultiRobot() : [string, [string, string]] +>getMultiRobot : () => [string, [string, string]] +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(multiRobotAInfo); +>console.log(multiRobotAInfo) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>multiRobotAInfo : (string | [string, string])[] +} +for ([...multiRobotAInfo] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { +>[...multiRobotAInfo] = ["trimmer", ["trimming", "edging"]], i = 0 : number +>[...multiRobotAInfo] = ["trimmer", ["trimming", "edging"]] : [string, [string, string]] +>[...multiRobotAInfo] : (string | [string, string])[] +>...multiRobotAInfo : string | [string, string] +>multiRobotAInfo : (string | [string, string])[] +>["trimmer", ["trimming", "edging"]] : [string, [string, string]] +>MultiSkilledRobot : [string, [string, string]] +>["trimmer", ["trimming", "edging"]] : [string, [string, string]] +>"trimmer" : string +>["trimming", "edging"] : [string, string] +>"trimming" : string +>"edging" : string +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(multiRobotAInfo); +>console.log(multiRobotAInfo) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>multiRobotAInfo : (string | [string, string])[] +} diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.js b/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.js new file mode 100644 index 00000000000..24701d01b08 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.js @@ -0,0 +1,184 @@ +//// [sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts] +declare var console: { + log(msg: any): void; +} +type Robot = [number, string, string]; +type MultiSkilledRobot = [string, string[]]; + +let robotA: Robot = [1, "mower", "mowing"]; +function getRobot() { + return robotA; +} + +let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; +let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; +function getMultiRobot() { + return multiRobotA; +} + +for (let [, nameA ="name"] = robotA, i = 0; i < 1; i++) { + console.log(nameA); +} +for (let [, nameA = "name"] = getRobot(), i = 0; i < 1; i++) { + console.log(nameA); +} +for (let [, nameA = "name"] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + console.log(nameA); +} +for (let [, [ + primarySkillA = "primary", + secondarySkillA = "secondary" +] = ["none", "none"]] = multiRobotA, i = 0; i < 1; i++) { + console.log(primarySkillA); +} +for (let [, [ + primarySkillA = "primary", + secondarySkillA = "secondary" +] = ["none", "none"]] = getMultiRobot(), i = 0; i < 1; i++) { + console.log(primarySkillA); +} +for (let [, [ + primarySkillA = "primary", + secondarySkillA = "secondary" +] = ["none", "none"]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + console.log(primarySkillA); +} + +for (let [numberB = -1] = robotA, i = 0; i < 1; i++) { + console.log(numberB); +} +for (let [numberB = -1] = getRobot(), i = 0; i < 1; i++) { + console.log(numberB); +} +for (let [numberB = -1] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + console.log(numberB); +} +for (let [nameB = "name"] = multiRobotA, i = 0; i < 1; i++) { + console.log(nameB); +} +for (let [nameB = "name"] = getMultiRobot(), i = 0; i < 1; i++) { + console.log(nameB); +} +for (let [nameB = "name"] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + console.log(nameB); +} + +for (let [numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = robotA, i = 0; i < 1; i++) { + console.log(nameA2); +} +for (let [numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = getRobot(), i = 0; i < 1; i++) { + console.log(nameA2); +} +for (let [numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + console.log(nameA2); +} +for (let + [nameMA = "noName", + [ + primarySkillA = "primary", + secondarySkillA = "secondary" + ] = ["none", "none"] + ] = multiRobotA, i = 0; i < 1; i++) { + console.log(nameMA); +} +for (let [nameMA = "noName", + [ + primarySkillA = "primary", + secondarySkillA = "secondary" + ] = ["none", "none"] +] = getMultiRobot(), i = 0; i < 1; i++) { + console.log(nameMA); +} +for (let [nameMA = "noName", + [ + primarySkillA = "primary", + secondarySkillA = "secondary" + ] = ["none", "none"] +] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + console.log(nameMA); +} + +for (let [numberA3 = -1, ...robotAInfo] = robotA, i = 0; i < 1; i++) { + console.log(numberA3); +} +for (let [numberA3 = -1, ...robotAInfo] = getRobot(), i = 0; i < 1; i++) { + console.log(numberA3); +} +for (let [numberA3 = -1, ...robotAInfo] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + console.log(numberA3); +} + +//// [sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.js] +var robotA = [1, "mower", "mowing"]; +function getRobot() { + return robotA; +} +var multiRobotA = ["mower", ["mowing", ""]]; +var multiRobotB = ["trimmer", ["trimming", "edging"]]; +function getMultiRobot() { + return multiRobotA; +} +for (var _a = robotA[1], nameA = _a === void 0 ? "name" : _a, i = 0; i < 1; i++) { + console.log(nameA); +} +for (var _b = getRobot(), _c = _b[1], nameA = _c === void 0 ? "name" : _c, i = 0; i < 1; i++) { + console.log(nameA); +} +for (var _d = [2, "trimmer", "trimming"], _e = _d[1], nameA = _e === void 0 ? "name" : _e, i = 0; i < 1; i++) { + console.log(nameA); +} +for (var _f = multiRobotA[1], _g = _f === void 0 ? ["none", "none"] : _f, _h = _g[0], primarySkillA = _h === void 0 ? "primary" : _h, _j = _g[1], secondarySkillA = _j === void 0 ? "secondary" : _j, i = 0; i < 1; i++) { + console.log(primarySkillA); +} +for (var _k = getMultiRobot(), _l = _k[1], _m = _l === void 0 ? ["none", "none"] : _l, _o = _m[0], primarySkillA = _o === void 0 ? "primary" : _o, _p = _m[1], secondarySkillA = _p === void 0 ? "secondary" : _p, i = 0; i < 1; i++) { + console.log(primarySkillA); +} +for (var _q = ["trimmer", ["trimming", "edging"]], _r = _q[1], _s = _r === void 0 ? ["none", "none"] : _r, _t = _s[0], primarySkillA = _t === void 0 ? "primary" : _t, _u = _s[1], secondarySkillA = _u === void 0 ? "secondary" : _u, i = 0; i < 1; i++) { + console.log(primarySkillA); +} +for (var _v = robotA[0], numberB = _v === void 0 ? -1 : _v, i = 0; i < 1; i++) { + console.log(numberB); +} +for (var _w = getRobot()[0], numberB = _w === void 0 ? -1 : _w, i = 0; i < 1; i++) { + console.log(numberB); +} +for (var _x = [2, "trimmer", "trimming"][0], numberB = _x === void 0 ? -1 : _x, i = 0; i < 1; i++) { + console.log(numberB); +} +for (var _y = multiRobotA[0], nameB = _y === void 0 ? "name" : _y, i = 0; i < 1; i++) { + console.log(nameB); +} +for (var _z = getMultiRobot()[0], nameB = _z === void 0 ? "name" : _z, i = 0; i < 1; i++) { + console.log(nameB); +} +for (var _0 = ["trimmer", ["trimming", "edging"]][0], nameB = _0 === void 0 ? "name" : _0, i = 0; i < 1; i++) { + console.log(nameB); +} +for (var _1 = robotA[0], numberA2 = _1 === void 0 ? -1 : _1, _2 = robotA[1], nameA2 = _2 === void 0 ? "name" : _2, _3 = robotA[2], skillA2 = _3 === void 0 ? "skill" : _3, i = 0; i < 1; i++) { + console.log(nameA2); +} +for (var _4 = getRobot(), _5 = _4[0], numberA2 = _5 === void 0 ? -1 : _5, _6 = _4[1], nameA2 = _6 === void 0 ? "name" : _6, _7 = _4[2], skillA2 = _7 === void 0 ? "skill" : _7, i = 0; i < 1; i++) { + console.log(nameA2); +} +for (var _8 = [2, "trimmer", "trimming"], _9 = _8[0], numberA2 = _9 === void 0 ? -1 : _9, _10 = _8[1], nameA2 = _10 === void 0 ? "name" : _10, _11 = _8[2], skillA2 = _11 === void 0 ? "skill" : _11, i = 0; i < 1; i++) { + console.log(nameA2); +} +for (var _12 = multiRobotA[0], nameMA = _12 === void 0 ? "noName" : _12, _13 = multiRobotA[1], _14 = _13 === void 0 ? ["none", "none"] : _13, _15 = _14[0], primarySkillA = _15 === void 0 ? "primary" : _15, _16 = _14[1], secondarySkillA = _16 === void 0 ? "secondary" : _16, i = 0; i < 1; i++) { + console.log(nameMA); +} +for (var _17 = getMultiRobot(), _18 = _17[0], nameMA = _18 === void 0 ? "noName" : _18, _19 = _17[1], _20 = _19 === void 0 ? ["none", "none"] : _19, _21 = _20[0], primarySkillA = _21 === void 0 ? "primary" : _21, _22 = _20[1], secondarySkillA = _22 === void 0 ? "secondary" : _22, i = 0; i < 1; i++) { + console.log(nameMA); +} +for (var _23 = ["trimmer", ["trimming", "edging"]], _24 = _23[0], nameMA = _24 === void 0 ? "noName" : _24, _25 = _23[1], _26 = _25 === void 0 ? ["none", "none"] : _25, _27 = _26[0], primarySkillA = _27 === void 0 ? "primary" : _27, _28 = _26[1], secondarySkillA = _28 === void 0 ? "secondary" : _28, i = 0; i < 1; i++) { + console.log(nameMA); +} +for (var _29 = robotA[0], numberA3 = _29 === void 0 ? -1 : _29, robotAInfo = robotA.slice(1), i = 0; i < 1; i++) { + console.log(numberA3); +} +for (var _30 = getRobot(), _31 = _30[0], numberA3 = _31 === void 0 ? -1 : _31, robotAInfo = _30.slice(1), i = 0; i < 1; i++) { + console.log(numberA3); +} +for (var _32 = [2, "trimmer", "trimming"], _33 = _32[0], numberA3 = _33 === void 0 ? -1 : _33, robotAInfo = _32.slice(1), i = 0; i < 1; i++) { + console.log(numberA3); +} +//# sourceMappingURL=sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.js.map b/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.js.map new file mode 100644 index 00000000000..28053eaf603 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.js.map @@ -0,0 +1,2 @@ +//// [sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.js.map] +{"version":3,"file":"sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.js","sourceRoot":"","sources":["sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts"],"names":[],"mappings":"AAMA,IAAI,MAAM,GAAU,CAAC,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;AAC3C;IACI,MAAM,CAAC,MAAM,CAAC;AAClB,CAAC;AAED,IAAI,WAAW,GAAsB,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC;AAC/D,IAAI,WAAW,GAAsB,CAAC,SAAS,EAAE,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC,CAAC;AACzE;IACI,MAAM,CAAC,WAAW,CAAC;AACvB,CAAC;AAED,GAAG,CAAC,CAAQ,kBAAa,EAAb,mCAAa,EAAY,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACrD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AACD,GAAG,CAAC,CAAC,IAAA,eAAmC,EAA5B,UAAc,EAAd,mCAAc,EAAgB,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IAC1D,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AACD,GAAG,CAAC,CAAC,IAAA,+BAAmD,EAA5C,UAAc,EAAd,mCAAc,EAAgC,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IAC1E,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AACD,GAAG,CAAC,CAAQ,uBAGQ,EAHR,0CAGQ,EAFhB,UAAyB,EAAzB,8CAAyB,EACzB,UAA6B,EAA7B,kDAA6B,EACI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACrD,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;AAC/B,CAAC;AACD,GAAG,CAAC,CAAC,IAAA,oBAGkC,EAH3B,UAGQ,EAHR,0CAGQ,EAFhB,UAAyB,EAAzB,8CAAyB,EACzB,UAA6B,EAA7B,kDAA6B,EACQ,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACzD,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;AAC/B,CAAC;AACD,GAAG,CAAC,CAAC,IAAA,wCAGsD,EAH/C,UAGQ,EAHR,0CAGQ,EAFhB,UAAyB,EAAzB,8CAAyB,EACzB,UAA6B,EAA7B,kDAA6B,EAC4B,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IAC7E,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;AAC/B,CAAC;AAED,GAAG,CAAC,CAAM,kBAAY,EAAZ,iCAAY,EAAY,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IAClD,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AACzB,CAAC;AACD,GAAG,CAAC,CAAM,sBAAY,EAAZ,iCAAY,EAAgB,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACtD,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AACzB,CAAC;AACD,GAAG,CAAC,CAAM,sCAAY,EAAZ,iCAAY,EAAgC,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACtE,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AACzB,CAAC;AACD,GAAG,CAAC,CAAM,uBAAc,EAAd,mCAAc,EAAiB,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACzD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AACD,GAAG,CAAC,CAAM,2BAAc,EAAd,mCAAc,EAAqB,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IAC7D,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AACD,GAAG,CAAC,CAAM,+CAAc,EAAd,mCAAc,EAAyC,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACjF,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AAED,GAAG,CAAC,CAAM,kBAAa,EAAb,kCAAa,EAAE,cAAe,EAAf,oCAAe,EAAE,cAAiB,EAAjB,sCAAiB,EAAY,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACvF,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACxB,CAAC;AACD,GAAG,CAAC,CAAC,IAAA,eAAoE,EAA/D,UAAa,EAAb,kCAAa,EAAE,UAAe,EAAf,oCAAe,EAAE,UAAiB,EAAjB,sCAAiB,EAAgB,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IAC3F,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACxB,CAAC;AACD,GAAG,CAAC,CAAC,IAAA,+BAAoF,EAA/E,UAAa,EAAb,kCAAa,EAAE,WAAe,EAAf,sCAAe,EAAE,WAAiB,EAAjB,wCAAiB,EAAgC,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IAC3G,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACxB,CAAC;AACD,GAAG,CAAC,CACC,wBAAiB,EAAjB,wCAAiB,EACd,oBAGoB,EAHpB,6CAGoB,EAFhB,YAAyB,EAAzB,gDAAyB,EACzB,YAA6B,EAA7B,oDAA6B,EAEpB,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACrC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACxB,CAAC;AACD,GAAG,CAAC,CAAC,IAAA,qBAKe,EALV,YAAiB,EAAjB,wCAAiB,EACvB,YAGoB,EAHpB,6CAGoB,EAFhB,YAAyB,EAAzB,gDAAyB,EACzB,YAA6B,EAA7B,oDAA6B,EAEf,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACtC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACxB,CAAC;AACD,GAAG,CAAC,CAAC,IAAA,yCAKmC,EAL9B,YAAiB,EAAjB,wCAAiB,EACvB,YAGoB,EAHpB,6CAGoB,EAFhB,YAAyB,EAAzB,gDAAyB,EACzB,YAA6B,EAA7B,oDAA6B,EAEK,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IAC1D,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACxB,CAAC;AAED,GAAG,CAAC,CAAM,mBAAa,EAAb,oCAAa,EAAE,4BAAa,EAAY,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IAClE,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAC1B,CAAC;AACD,GAAG,CAAC,CAAC,IAAA,gBAA+C,EAA1C,YAAa,EAAb,oCAAa,EAAE,yBAAa,EAAgB,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACtE,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAC1B,CAAC;AACD,GAAG,CAAC,CAAC,IAAA,gCAA+D,EAA1D,YAAa,EAAb,oCAAa,EAAE,yBAAa,EAAgC,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACtF,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAC1B,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.sourcemap.txt b/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.sourcemap.txt new file mode 100644 index 00000000000..764825e68a2 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.sourcemap.txt @@ -0,0 +1,2752 @@ +=================================================================== +JsFile: sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.js +mapUrl: sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.js.map +sourceRoot: +sources: sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.js +sourceFile:sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts +------------------------------------------------------------------- +>>>var robotA = [1, "mower", "mowing"]; +1 > +2 >^^^^ +3 > ^^^^^^ +4 > ^^^ +5 > ^ +6 > ^ +7 > ^^ +8 > ^^^^^^^ +9 > ^^ +10> ^^^^^^^^ +11> ^ +12> ^ +1 >declare var console: { + > log(msg: any): void; + >} + >type Robot = [number, string, string]; + >type MultiSkilledRobot = [string, string[]]; + > + > +2 >let +3 > robotA +4 > : Robot = +5 > [ +6 > 1 +7 > , +8 > "mower" +9 > , +10> "mowing" +11> ] +12> ; +1 >Emitted(1, 1) Source(7, 1) + SourceIndex(0) +2 >Emitted(1, 5) Source(7, 5) + SourceIndex(0) +3 >Emitted(1, 11) Source(7, 11) + SourceIndex(0) +4 >Emitted(1, 14) Source(7, 21) + SourceIndex(0) +5 >Emitted(1, 15) Source(7, 22) + SourceIndex(0) +6 >Emitted(1, 16) Source(7, 23) + SourceIndex(0) +7 >Emitted(1, 18) Source(7, 25) + SourceIndex(0) +8 >Emitted(1, 25) Source(7, 32) + SourceIndex(0) +9 >Emitted(1, 27) Source(7, 34) + SourceIndex(0) +10>Emitted(1, 35) Source(7, 42) + SourceIndex(0) +11>Emitted(1, 36) Source(7, 43) + SourceIndex(0) +12>Emitted(1, 37) Source(7, 44) + SourceIndex(0) +--- +>>>function getRobot() { +1 > +2 >^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(2, 1) Source(8, 1) + SourceIndex(0) +--- +>>> return robotA; +1->^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^ +5 > ^ +1->function getRobot() { + > +2 > return +3 > +4 > robotA +5 > ; +1->Emitted(3, 5) Source(9, 5) + SourceIndex(0) +2 >Emitted(3, 11) Source(9, 11) + SourceIndex(0) +3 >Emitted(3, 12) Source(9, 12) + SourceIndex(0) +4 >Emitted(3, 18) Source(9, 18) + SourceIndex(0) +5 >Emitted(3, 19) Source(9, 19) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(4, 1) Source(10, 1) + SourceIndex(0) +2 >Emitted(4, 2) Source(10, 2) + SourceIndex(0) +--- +>>>var multiRobotA = ["mower", ["mowing", ""]]; +1-> +2 >^^^^ +3 > ^^^^^^^^^^^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^ +7 > ^^ +8 > ^ +9 > ^^^^^^^^ +10> ^^ +11> ^^ +12> ^ +13> ^ +14> ^ +15> ^^^^^^^^^^^-> +1-> + > + > +2 >let +3 > multiRobotA +4 > : MultiSkilledRobot = +5 > [ +6 > "mower" +7 > , +8 > [ +9 > "mowing" +10> , +11> "" +12> ] +13> ] +14> ; +1->Emitted(5, 1) Source(12, 1) + SourceIndex(0) +2 >Emitted(5, 5) Source(12, 5) + SourceIndex(0) +3 >Emitted(5, 16) Source(12, 16) + SourceIndex(0) +4 >Emitted(5, 19) Source(12, 38) + SourceIndex(0) +5 >Emitted(5, 20) Source(12, 39) + SourceIndex(0) +6 >Emitted(5, 27) Source(12, 46) + SourceIndex(0) +7 >Emitted(5, 29) Source(12, 48) + SourceIndex(0) +8 >Emitted(5, 30) Source(12, 49) + SourceIndex(0) +9 >Emitted(5, 38) Source(12, 57) + SourceIndex(0) +10>Emitted(5, 40) Source(12, 59) + SourceIndex(0) +11>Emitted(5, 42) Source(12, 61) + SourceIndex(0) +12>Emitted(5, 43) Source(12, 62) + SourceIndex(0) +13>Emitted(5, 44) Source(12, 63) + SourceIndex(0) +14>Emitted(5, 45) Source(12, 64) + SourceIndex(0) +--- +>>>var multiRobotB = ["trimmer", ["trimming", "edging"]]; +1-> +2 >^^^^ +3 > ^^^^^^^^^^^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^^ +7 > ^^ +8 > ^ +9 > ^^^^^^^^^^ +10> ^^ +11> ^^^^^^^^ +12> ^ +13> ^ +14> ^ +1-> + > +2 >let +3 > multiRobotB +4 > : MultiSkilledRobot = +5 > [ +6 > "trimmer" +7 > , +8 > [ +9 > "trimming" +10> , +11> "edging" +12> ] +13> ] +14> ; +1->Emitted(6, 1) Source(13, 1) + SourceIndex(0) +2 >Emitted(6, 5) Source(13, 5) + SourceIndex(0) +3 >Emitted(6, 16) Source(13, 16) + SourceIndex(0) +4 >Emitted(6, 19) Source(13, 38) + SourceIndex(0) +5 >Emitted(6, 20) Source(13, 39) + SourceIndex(0) +6 >Emitted(6, 29) Source(13, 48) + SourceIndex(0) +7 >Emitted(6, 31) Source(13, 50) + SourceIndex(0) +8 >Emitted(6, 32) Source(13, 51) + SourceIndex(0) +9 >Emitted(6, 42) Source(13, 61) + SourceIndex(0) +10>Emitted(6, 44) Source(13, 63) + SourceIndex(0) +11>Emitted(6, 52) Source(13, 71) + SourceIndex(0) +12>Emitted(6, 53) Source(13, 72) + SourceIndex(0) +13>Emitted(6, 54) Source(13, 73) + SourceIndex(0) +14>Emitted(6, 55) Source(13, 74) + SourceIndex(0) +--- +>>>function getMultiRobot() { +1 > +2 >^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(7, 1) Source(14, 1) + SourceIndex(0) +--- +>>> return multiRobotA; +1->^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^ +5 > ^ +1->function getMultiRobot() { + > +2 > return +3 > +4 > multiRobotA +5 > ; +1->Emitted(8, 5) Source(15, 5) + SourceIndex(0) +2 >Emitted(8, 11) Source(15, 11) + SourceIndex(0) +3 >Emitted(8, 12) Source(15, 12) + SourceIndex(0) +4 >Emitted(8, 23) Source(15, 23) + SourceIndex(0) +5 >Emitted(8, 24) Source(15, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(9, 1) Source(16, 1) + SourceIndex(0) +2 >Emitted(9, 2) Source(16, 2) + SourceIndex(0) +--- +>>>for (var _a = robotA[1], nameA = _a === void 0 ? "name" : _a, i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^ +10> ^^^ +11> ^ +12> ^^ +13> ^ +14> ^^^ +15> ^ +16> ^^ +17> ^ +18> ^^ +19> ^^ +20> ^ +1-> + > + > +2 >for +3 > +4 > (let [, +5 > nameA ="name" +6 > +7 > nameA ="name" +8 > ] = robotA, +9 > i +10> = +11> 0 +12> ; +13> i +14> < +15> 1 +16> ; +17> i +18> ++ +19> ) +20> { +1->Emitted(10, 1) Source(18, 1) + SourceIndex(0) +2 >Emitted(10, 4) Source(18, 4) + SourceIndex(0) +3 >Emitted(10, 5) Source(18, 5) + SourceIndex(0) +4 >Emitted(10, 6) Source(18, 13) + SourceIndex(0) +5 >Emitted(10, 24) Source(18, 26) + SourceIndex(0) +6 >Emitted(10, 26) Source(18, 13) + SourceIndex(0) +7 >Emitted(10, 61) Source(18, 26) + SourceIndex(0) +8 >Emitted(10, 63) Source(18, 38) + SourceIndex(0) +9 >Emitted(10, 64) Source(18, 39) + SourceIndex(0) +10>Emitted(10, 67) Source(18, 42) + SourceIndex(0) +11>Emitted(10, 68) Source(18, 43) + SourceIndex(0) +12>Emitted(10, 70) Source(18, 45) + SourceIndex(0) +13>Emitted(10, 71) Source(18, 46) + SourceIndex(0) +14>Emitted(10, 74) Source(18, 49) + SourceIndex(0) +15>Emitted(10, 75) Source(18, 50) + SourceIndex(0) +16>Emitted(10, 77) Source(18, 52) + SourceIndex(0) +17>Emitted(10, 78) Source(18, 53) + SourceIndex(0) +18>Emitted(10, 80) Source(18, 55) + SourceIndex(0) +19>Emitted(10, 82) Source(18, 57) + SourceIndex(0) +20>Emitted(10, 83) Source(18, 58) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(11, 5) Source(19, 5) + SourceIndex(0) +2 >Emitted(11, 12) Source(19, 12) + SourceIndex(0) +3 >Emitted(11, 13) Source(19, 13) + SourceIndex(0) +4 >Emitted(11, 16) Source(19, 16) + SourceIndex(0) +5 >Emitted(11, 17) Source(19, 17) + SourceIndex(0) +6 >Emitted(11, 22) Source(19, 22) + SourceIndex(0) +7 >Emitted(11, 23) Source(19, 23) + SourceIndex(0) +8 >Emitted(11, 24) Source(19, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(12, 1) Source(20, 1) + SourceIndex(0) +2 >Emitted(12, 2) Source(20, 2) + SourceIndex(0) +--- +>>>for (var _b = getRobot(), _c = _b[1], nameA = _c === void 0 ? "name" : _c, i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^ +6 > ^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^ +13> ^^^ +14> ^ +15> ^^ +16> ^ +17> ^^^ +18> ^ +19> ^^ +20> ^ +21> ^^ +22> ^^ +23> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > let [, nameA = "name"] = getRobot() +7 > +8 > nameA = "name" +9 > +10> nameA = "name" +11> ] = getRobot(), +12> i +13> = +14> 0 +15> ; +16> i +17> < +18> 1 +19> ; +20> i +21> ++ +22> ) +23> { +1->Emitted(13, 1) Source(21, 1) + SourceIndex(0) +2 >Emitted(13, 4) Source(21, 4) + SourceIndex(0) +3 >Emitted(13, 5) Source(21, 5) + SourceIndex(0) +4 >Emitted(13, 6) Source(21, 6) + SourceIndex(0) +5 >Emitted(13, 10) Source(21, 6) + SourceIndex(0) +6 >Emitted(13, 25) Source(21, 41) + SourceIndex(0) +7 >Emitted(13, 27) Source(21, 13) + SourceIndex(0) +8 >Emitted(13, 37) Source(21, 27) + SourceIndex(0) +9 >Emitted(13, 39) Source(21, 13) + SourceIndex(0) +10>Emitted(13, 74) Source(21, 27) + SourceIndex(0) +11>Emitted(13, 76) Source(21, 43) + SourceIndex(0) +12>Emitted(13, 77) Source(21, 44) + SourceIndex(0) +13>Emitted(13, 80) Source(21, 47) + SourceIndex(0) +14>Emitted(13, 81) Source(21, 48) + SourceIndex(0) +15>Emitted(13, 83) Source(21, 50) + SourceIndex(0) +16>Emitted(13, 84) Source(21, 51) + SourceIndex(0) +17>Emitted(13, 87) Source(21, 54) + SourceIndex(0) +18>Emitted(13, 88) Source(21, 55) + SourceIndex(0) +19>Emitted(13, 90) Source(21, 57) + SourceIndex(0) +20>Emitted(13, 91) Source(21, 58) + SourceIndex(0) +21>Emitted(13, 93) Source(21, 60) + SourceIndex(0) +22>Emitted(13, 95) Source(21, 62) + SourceIndex(0) +23>Emitted(13, 96) Source(21, 63) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(14, 5) Source(22, 5) + SourceIndex(0) +2 >Emitted(14, 12) Source(22, 12) + SourceIndex(0) +3 >Emitted(14, 13) Source(22, 13) + SourceIndex(0) +4 >Emitted(14, 16) Source(22, 16) + SourceIndex(0) +5 >Emitted(14, 17) Source(22, 17) + SourceIndex(0) +6 >Emitted(14, 22) Source(22, 22) + SourceIndex(0) +7 >Emitted(14, 23) Source(22, 23) + SourceIndex(0) +8 >Emitted(14, 24) Source(22, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(15, 1) Source(23, 1) + SourceIndex(0) +2 >Emitted(15, 2) Source(23, 2) + SourceIndex(0) +--- +>>>for (var _d = [2, "trimmer", "trimming"], _e = _d[1], nameA = _e === void 0 ? "name" : _e, i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^ +13> ^^^ +14> ^ +15> ^^ +16> ^ +17> ^^^ +18> ^ +19> ^^ +20> ^ +21> ^^ +22> ^^ +23> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > let [, nameA = "name"] = [2, "trimmer", "trimming"] +7 > +8 > nameA = "name" +9 > +10> nameA = "name" +11> ] = [2, "trimmer", "trimming"], +12> i +13> = +14> 0 +15> ; +16> i +17> < +18> 1 +19> ; +20> i +21> ++ +22> ) +23> { +1->Emitted(16, 1) Source(24, 1) + SourceIndex(0) +2 >Emitted(16, 4) Source(24, 4) + SourceIndex(0) +3 >Emitted(16, 5) Source(24, 5) + SourceIndex(0) +4 >Emitted(16, 6) Source(24, 6) + SourceIndex(0) +5 >Emitted(16, 10) Source(24, 6) + SourceIndex(0) +6 >Emitted(16, 41) Source(24, 57) + SourceIndex(0) +7 >Emitted(16, 43) Source(24, 13) + SourceIndex(0) +8 >Emitted(16, 53) Source(24, 27) + SourceIndex(0) +9 >Emitted(16, 55) Source(24, 13) + SourceIndex(0) +10>Emitted(16, 90) Source(24, 27) + SourceIndex(0) +11>Emitted(16, 92) Source(24, 59) + SourceIndex(0) +12>Emitted(16, 93) Source(24, 60) + SourceIndex(0) +13>Emitted(16, 96) Source(24, 63) + SourceIndex(0) +14>Emitted(16, 97) Source(24, 64) + SourceIndex(0) +15>Emitted(16, 99) Source(24, 66) + SourceIndex(0) +16>Emitted(16, 100) Source(24, 67) + SourceIndex(0) +17>Emitted(16, 103) Source(24, 70) + SourceIndex(0) +18>Emitted(16, 104) Source(24, 71) + SourceIndex(0) +19>Emitted(16, 106) Source(24, 73) + SourceIndex(0) +20>Emitted(16, 107) Source(24, 74) + SourceIndex(0) +21>Emitted(16, 109) Source(24, 76) + SourceIndex(0) +22>Emitted(16, 111) Source(24, 78) + SourceIndex(0) +23>Emitted(16, 112) Source(24, 79) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(17, 5) Source(25, 5) + SourceIndex(0) +2 >Emitted(17, 12) Source(25, 12) + SourceIndex(0) +3 >Emitted(17, 13) Source(25, 13) + SourceIndex(0) +4 >Emitted(17, 16) Source(25, 16) + SourceIndex(0) +5 >Emitted(17, 17) Source(25, 17) + SourceIndex(0) +6 >Emitted(17, 22) Source(25, 22) + SourceIndex(0) +7 >Emitted(17, 23) Source(25, 23) + SourceIndex(0) +8 >Emitted(17, 24) Source(25, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(18, 1) Source(26, 1) + SourceIndex(0) +2 >Emitted(18, 2) Source(26, 2) + SourceIndex(0) +--- +>>>for (var _f = multiRobotA[1], _g = _f === void 0 ? ["none", "none"] : _f, _h = _g[0], primarySkillA = _h === void 0 ? "primary" : _h, _j = _g[1], secondarySkillA = _j === void 0 ? "secondary" : _j, i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^ +10> ^^ +11> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +12> ^^ +13> ^^^^^^^^^^ +14> ^^ +15> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +16> ^^ +17> ^ +18> ^^^ +19> ^ +20> ^^ +21> ^ +22> ^^^ +23> ^ +24> ^^ +25> ^ +26> ^^ +27> ^^ +28> ^ +1-> + > +2 >for +3 > +4 > (let [, +5 > [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["none", "none"] +6 > +7 > [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["none", "none"] +8 > +9 > primarySkillA = "primary" +10> +11> primarySkillA = "primary" +12> , + > +13> secondarySkillA = "secondary" +14> +15> secondarySkillA = "secondary" +16> + > ] = ["none", "none"]] = multiRobotA, +17> i +18> = +19> 0 +20> ; +21> i +22> < +23> 1 +24> ; +25> i +26> ++ +27> ) +28> { +1->Emitted(19, 1) Source(27, 1) + SourceIndex(0) +2 >Emitted(19, 4) Source(27, 4) + SourceIndex(0) +3 >Emitted(19, 5) Source(27, 5) + SourceIndex(0) +4 >Emitted(19, 6) Source(27, 13) + SourceIndex(0) +5 >Emitted(19, 29) Source(30, 21) + SourceIndex(0) +6 >Emitted(19, 31) Source(27, 13) + SourceIndex(0) +7 >Emitted(19, 73) Source(30, 21) + SourceIndex(0) +8 >Emitted(19, 75) Source(28, 5) + SourceIndex(0) +9 >Emitted(19, 85) Source(28, 30) + SourceIndex(0) +10>Emitted(19, 87) Source(28, 5) + SourceIndex(0) +11>Emitted(19, 133) Source(28, 30) + SourceIndex(0) +12>Emitted(19, 135) Source(29, 5) + SourceIndex(0) +13>Emitted(19, 145) Source(29, 34) + SourceIndex(0) +14>Emitted(19, 147) Source(29, 5) + SourceIndex(0) +15>Emitted(19, 197) Source(29, 34) + SourceIndex(0) +16>Emitted(19, 199) Source(30, 38) + SourceIndex(0) +17>Emitted(19, 200) Source(30, 39) + SourceIndex(0) +18>Emitted(19, 203) Source(30, 42) + SourceIndex(0) +19>Emitted(19, 204) Source(30, 43) + SourceIndex(0) +20>Emitted(19, 206) Source(30, 45) + SourceIndex(0) +21>Emitted(19, 207) Source(30, 46) + SourceIndex(0) +22>Emitted(19, 210) Source(30, 49) + SourceIndex(0) +23>Emitted(19, 211) Source(30, 50) + SourceIndex(0) +24>Emitted(19, 213) Source(30, 52) + SourceIndex(0) +25>Emitted(19, 214) Source(30, 53) + SourceIndex(0) +26>Emitted(19, 216) Source(30, 55) + SourceIndex(0) +27>Emitted(19, 218) Source(30, 57) + SourceIndex(0) +28>Emitted(19, 219) Source(30, 58) + SourceIndex(0) +--- +>>> console.log(primarySkillA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > primarySkillA +7 > ) +8 > ; +1 >Emitted(20, 5) Source(31, 5) + SourceIndex(0) +2 >Emitted(20, 12) Source(31, 12) + SourceIndex(0) +3 >Emitted(20, 13) Source(31, 13) + SourceIndex(0) +4 >Emitted(20, 16) Source(31, 16) + SourceIndex(0) +5 >Emitted(20, 17) Source(31, 17) + SourceIndex(0) +6 >Emitted(20, 30) Source(31, 30) + SourceIndex(0) +7 >Emitted(20, 31) Source(31, 31) + SourceIndex(0) +8 >Emitted(20, 32) Source(31, 32) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(21, 1) Source(32, 1) + SourceIndex(0) +2 >Emitted(21, 2) Source(32, 2) + SourceIndex(0) +--- +>>>for (var _k = getMultiRobot(), _l = _k[1], _m = _l === void 0 ? ["none", "none"] : _l, _o = _m[0], primarySkillA = _o === void 0 ? "primary" : _o, _p = _m[1], secondarySkillA = _p === void 0 ? "secondary" : _p, i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^ +6 > ^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +15> ^^ +16> ^^^^^^^^^^ +17> ^^ +18> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +19> ^^ +20> ^ +21> ^^^ +22> ^ +23> ^^ +24> ^ +25> ^^^ +26> ^ +27> ^^ +28> ^ +29> ^^ +30> ^^ +31> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > let [, [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["none", "none"]] = getMultiRobot() +7 > +8 > [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["none", "none"] +9 > +10> [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["none", "none"] +11> +12> primarySkillA = "primary" +13> +14> primarySkillA = "primary" +15> , + > +16> secondarySkillA = "secondary" +17> +18> secondarySkillA = "secondary" +19> + > ] = ["none", "none"]] = getMultiRobot(), +20> i +21> = +22> 0 +23> ; +24> i +25> < +26> 1 +27> ; +28> i +29> ++ +30> ) +31> { +1->Emitted(22, 1) Source(33, 1) + SourceIndex(0) +2 >Emitted(22, 4) Source(33, 4) + SourceIndex(0) +3 >Emitted(22, 5) Source(33, 5) + SourceIndex(0) +4 >Emitted(22, 6) Source(33, 6) + SourceIndex(0) +5 >Emitted(22, 10) Source(33, 6) + SourceIndex(0) +6 >Emitted(22, 30) Source(36, 40) + SourceIndex(0) +7 >Emitted(22, 32) Source(33, 13) + SourceIndex(0) +8 >Emitted(22, 42) Source(36, 21) + SourceIndex(0) +9 >Emitted(22, 44) Source(33, 13) + SourceIndex(0) +10>Emitted(22, 86) Source(36, 21) + SourceIndex(0) +11>Emitted(22, 88) Source(34, 5) + SourceIndex(0) +12>Emitted(22, 98) Source(34, 30) + SourceIndex(0) +13>Emitted(22, 100) Source(34, 5) + SourceIndex(0) +14>Emitted(22, 146) Source(34, 30) + SourceIndex(0) +15>Emitted(22, 148) Source(35, 5) + SourceIndex(0) +16>Emitted(22, 158) Source(35, 34) + SourceIndex(0) +17>Emitted(22, 160) Source(35, 5) + SourceIndex(0) +18>Emitted(22, 210) Source(35, 34) + SourceIndex(0) +19>Emitted(22, 212) Source(36, 42) + SourceIndex(0) +20>Emitted(22, 213) Source(36, 43) + SourceIndex(0) +21>Emitted(22, 216) Source(36, 46) + SourceIndex(0) +22>Emitted(22, 217) Source(36, 47) + SourceIndex(0) +23>Emitted(22, 219) Source(36, 49) + SourceIndex(0) +24>Emitted(22, 220) Source(36, 50) + SourceIndex(0) +25>Emitted(22, 223) Source(36, 53) + SourceIndex(0) +26>Emitted(22, 224) Source(36, 54) + SourceIndex(0) +27>Emitted(22, 226) Source(36, 56) + SourceIndex(0) +28>Emitted(22, 227) Source(36, 57) + SourceIndex(0) +29>Emitted(22, 229) Source(36, 59) + SourceIndex(0) +30>Emitted(22, 231) Source(36, 61) + SourceIndex(0) +31>Emitted(22, 232) Source(36, 62) + SourceIndex(0) +--- +>>> console.log(primarySkillA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > primarySkillA +7 > ) +8 > ; +1 >Emitted(23, 5) Source(37, 5) + SourceIndex(0) +2 >Emitted(23, 12) Source(37, 12) + SourceIndex(0) +3 >Emitted(23, 13) Source(37, 13) + SourceIndex(0) +4 >Emitted(23, 16) Source(37, 16) + SourceIndex(0) +5 >Emitted(23, 17) Source(37, 17) + SourceIndex(0) +6 >Emitted(23, 30) Source(37, 30) + SourceIndex(0) +7 >Emitted(23, 31) Source(37, 31) + SourceIndex(0) +8 >Emitted(23, 32) Source(37, 32) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(24, 1) Source(38, 1) + SourceIndex(0) +2 >Emitted(24, 2) Source(38, 2) + SourceIndex(0) +--- +>>>for (var _q = ["trimmer", ["trimming", "edging"]], _r = _q[1], _s = _r === void 0 ? ["none", "none"] : _r, _t = _s[0], primarySkillA = _t === void 0 ? "primary" : _t, _u = _s[1], secondarySkillA = _u === void 0 ? "secondary" : _u, i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +15> ^^ +16> ^^^^^^^^^^ +17> ^^ +18> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +19> ^^ +20> ^ +21> ^^^ +22> ^ +23> ^^ +24> ^ +25> ^^^ +26> ^ +27> ^^ +28> ^ +29> ^^ +30> ^^ +31> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > let [, [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["none", "none"]] = ["trimmer", ["trimming", "edging"]] +7 > +8 > [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["none", "none"] +9 > +10> [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["none", "none"] +11> +12> primarySkillA = "primary" +13> +14> primarySkillA = "primary" +15> , + > +16> secondarySkillA = "secondary" +17> +18> secondarySkillA = "secondary" +19> + > ] = ["none", "none"]] = ["trimmer", ["trimming", "edging"]], +20> i +21> = +22> 0 +23> ; +24> i +25> < +26> 1 +27> ; +28> i +29> ++ +30> ) +31> { +1->Emitted(25, 1) Source(39, 1) + SourceIndex(0) +2 >Emitted(25, 4) Source(39, 4) + SourceIndex(0) +3 >Emitted(25, 5) Source(39, 5) + SourceIndex(0) +4 >Emitted(25, 6) Source(39, 6) + SourceIndex(0) +5 >Emitted(25, 10) Source(39, 6) + SourceIndex(0) +6 >Emitted(25, 50) Source(42, 60) + SourceIndex(0) +7 >Emitted(25, 52) Source(39, 13) + SourceIndex(0) +8 >Emitted(25, 62) Source(42, 21) + SourceIndex(0) +9 >Emitted(25, 64) Source(39, 13) + SourceIndex(0) +10>Emitted(25, 106) Source(42, 21) + SourceIndex(0) +11>Emitted(25, 108) Source(40, 5) + SourceIndex(0) +12>Emitted(25, 118) Source(40, 30) + SourceIndex(0) +13>Emitted(25, 120) Source(40, 5) + SourceIndex(0) +14>Emitted(25, 166) Source(40, 30) + SourceIndex(0) +15>Emitted(25, 168) Source(41, 5) + SourceIndex(0) +16>Emitted(25, 178) Source(41, 34) + SourceIndex(0) +17>Emitted(25, 180) Source(41, 5) + SourceIndex(0) +18>Emitted(25, 230) Source(41, 34) + SourceIndex(0) +19>Emitted(25, 232) Source(42, 62) + SourceIndex(0) +20>Emitted(25, 233) Source(42, 63) + SourceIndex(0) +21>Emitted(25, 236) Source(42, 66) + SourceIndex(0) +22>Emitted(25, 237) Source(42, 67) + SourceIndex(0) +23>Emitted(25, 239) Source(42, 69) + SourceIndex(0) +24>Emitted(25, 240) Source(42, 70) + SourceIndex(0) +25>Emitted(25, 243) Source(42, 73) + SourceIndex(0) +26>Emitted(25, 244) Source(42, 74) + SourceIndex(0) +27>Emitted(25, 246) Source(42, 76) + SourceIndex(0) +28>Emitted(25, 247) Source(42, 77) + SourceIndex(0) +29>Emitted(25, 249) Source(42, 79) + SourceIndex(0) +30>Emitted(25, 251) Source(42, 81) + SourceIndex(0) +31>Emitted(25, 252) Source(42, 82) + SourceIndex(0) +--- +>>> console.log(primarySkillA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > primarySkillA +7 > ) +8 > ; +1 >Emitted(26, 5) Source(43, 5) + SourceIndex(0) +2 >Emitted(26, 12) Source(43, 12) + SourceIndex(0) +3 >Emitted(26, 13) Source(43, 13) + SourceIndex(0) +4 >Emitted(26, 16) Source(43, 16) + SourceIndex(0) +5 >Emitted(26, 17) Source(43, 17) + SourceIndex(0) +6 >Emitted(26, 30) Source(43, 30) + SourceIndex(0) +7 >Emitted(26, 31) Source(43, 31) + SourceIndex(0) +8 >Emitted(26, 32) Source(43, 32) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(27, 1) Source(44, 1) + SourceIndex(0) +2 >Emitted(27, 2) Source(44, 2) + SourceIndex(0) +--- +>>>for (var _v = robotA[0], numberB = _v === void 0 ? -1 : _v, i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^ +10> ^^^ +11> ^ +12> ^^ +13> ^ +14> ^^^ +15> ^ +16> ^^ +17> ^ +18> ^^ +19> ^^ +20> ^ +1-> + > + > +2 >for +3 > +4 > (let [ +5 > numberB = -1 +6 > +7 > numberB = -1 +8 > ] = robotA, +9 > i +10> = +11> 0 +12> ; +13> i +14> < +15> 1 +16> ; +17> i +18> ++ +19> ) +20> { +1->Emitted(28, 1) Source(46, 1) + SourceIndex(0) +2 >Emitted(28, 4) Source(46, 4) + SourceIndex(0) +3 >Emitted(28, 5) Source(46, 5) + SourceIndex(0) +4 >Emitted(28, 6) Source(46, 11) + SourceIndex(0) +5 >Emitted(28, 24) Source(46, 23) + SourceIndex(0) +6 >Emitted(28, 26) Source(46, 11) + SourceIndex(0) +7 >Emitted(28, 59) Source(46, 23) + SourceIndex(0) +8 >Emitted(28, 61) Source(46, 35) + SourceIndex(0) +9 >Emitted(28, 62) Source(46, 36) + SourceIndex(0) +10>Emitted(28, 65) Source(46, 39) + SourceIndex(0) +11>Emitted(28, 66) Source(46, 40) + SourceIndex(0) +12>Emitted(28, 68) Source(46, 42) + SourceIndex(0) +13>Emitted(28, 69) Source(46, 43) + SourceIndex(0) +14>Emitted(28, 72) Source(46, 46) + SourceIndex(0) +15>Emitted(28, 73) Source(46, 47) + SourceIndex(0) +16>Emitted(28, 75) Source(46, 49) + SourceIndex(0) +17>Emitted(28, 76) Source(46, 50) + SourceIndex(0) +18>Emitted(28, 78) Source(46, 52) + SourceIndex(0) +19>Emitted(28, 80) Source(46, 54) + SourceIndex(0) +20>Emitted(28, 81) Source(46, 55) + SourceIndex(0) +--- +>>> console.log(numberB); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > numberB +7 > ) +8 > ; +1 >Emitted(29, 5) Source(47, 5) + SourceIndex(0) +2 >Emitted(29, 12) Source(47, 12) + SourceIndex(0) +3 >Emitted(29, 13) Source(47, 13) + SourceIndex(0) +4 >Emitted(29, 16) Source(47, 16) + SourceIndex(0) +5 >Emitted(29, 17) Source(47, 17) + SourceIndex(0) +6 >Emitted(29, 24) Source(47, 24) + SourceIndex(0) +7 >Emitted(29, 25) Source(47, 25) + SourceIndex(0) +8 >Emitted(29, 26) Source(47, 26) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(30, 1) Source(48, 1) + SourceIndex(0) +2 >Emitted(30, 2) Source(48, 2) + SourceIndex(0) +--- +>>>for (var _w = getRobot()[0], numberB = _w === void 0 ? -1 : _w, i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^ +10> ^^^ +11> ^ +12> ^^ +13> ^ +14> ^^^ +15> ^ +16> ^^ +17> ^ +18> ^^ +19> ^^ +20> ^ +1-> + > +2 >for +3 > +4 > (let [ +5 > numberB = -1 +6 > +7 > numberB = -1 +8 > ] = getRobot(), +9 > i +10> = +11> 0 +12> ; +13> i +14> < +15> 1 +16> ; +17> i +18> ++ +19> ) +20> { +1->Emitted(31, 1) Source(49, 1) + SourceIndex(0) +2 >Emitted(31, 4) Source(49, 4) + SourceIndex(0) +3 >Emitted(31, 5) Source(49, 5) + SourceIndex(0) +4 >Emitted(31, 6) Source(49, 11) + SourceIndex(0) +5 >Emitted(31, 28) Source(49, 23) + SourceIndex(0) +6 >Emitted(31, 30) Source(49, 11) + SourceIndex(0) +7 >Emitted(31, 63) Source(49, 23) + SourceIndex(0) +8 >Emitted(31, 65) Source(49, 39) + SourceIndex(0) +9 >Emitted(31, 66) Source(49, 40) + SourceIndex(0) +10>Emitted(31, 69) Source(49, 43) + SourceIndex(0) +11>Emitted(31, 70) Source(49, 44) + SourceIndex(0) +12>Emitted(31, 72) Source(49, 46) + SourceIndex(0) +13>Emitted(31, 73) Source(49, 47) + SourceIndex(0) +14>Emitted(31, 76) Source(49, 50) + SourceIndex(0) +15>Emitted(31, 77) Source(49, 51) + SourceIndex(0) +16>Emitted(31, 79) Source(49, 53) + SourceIndex(0) +17>Emitted(31, 80) Source(49, 54) + SourceIndex(0) +18>Emitted(31, 82) Source(49, 56) + SourceIndex(0) +19>Emitted(31, 84) Source(49, 58) + SourceIndex(0) +20>Emitted(31, 85) Source(49, 59) + SourceIndex(0) +--- +>>> console.log(numberB); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > numberB +7 > ) +8 > ; +1 >Emitted(32, 5) Source(50, 5) + SourceIndex(0) +2 >Emitted(32, 12) Source(50, 12) + SourceIndex(0) +3 >Emitted(32, 13) Source(50, 13) + SourceIndex(0) +4 >Emitted(32, 16) Source(50, 16) + SourceIndex(0) +5 >Emitted(32, 17) Source(50, 17) + SourceIndex(0) +6 >Emitted(32, 24) Source(50, 24) + SourceIndex(0) +7 >Emitted(32, 25) Source(50, 25) + SourceIndex(0) +8 >Emitted(32, 26) Source(50, 26) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(33, 1) Source(51, 1) + SourceIndex(0) +2 >Emitted(33, 2) Source(51, 2) + SourceIndex(0) +--- +>>>for (var _x = [2, "trimmer", "trimming"][0], numberB = _x === void 0 ? -1 : _x, i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^ +10> ^^^ +11> ^ +12> ^^ +13> ^ +14> ^^^ +15> ^ +16> ^^ +17> ^ +18> ^^ +19> ^^ +20> ^ +1-> + > +2 >for +3 > +4 > (let [ +5 > numberB = -1 +6 > +7 > numberB = -1 +8 > ] = [2, "trimmer", "trimming"], +9 > i +10> = +11> 0 +12> ; +13> i +14> < +15> 1 +16> ; +17> i +18> ++ +19> ) +20> { +1->Emitted(34, 1) Source(52, 1) + SourceIndex(0) +2 >Emitted(34, 4) Source(52, 4) + SourceIndex(0) +3 >Emitted(34, 5) Source(52, 5) + SourceIndex(0) +4 >Emitted(34, 6) Source(52, 11) + SourceIndex(0) +5 >Emitted(34, 44) Source(52, 23) + SourceIndex(0) +6 >Emitted(34, 46) Source(52, 11) + SourceIndex(0) +7 >Emitted(34, 79) Source(52, 23) + SourceIndex(0) +8 >Emitted(34, 81) Source(52, 55) + SourceIndex(0) +9 >Emitted(34, 82) Source(52, 56) + SourceIndex(0) +10>Emitted(34, 85) Source(52, 59) + SourceIndex(0) +11>Emitted(34, 86) Source(52, 60) + SourceIndex(0) +12>Emitted(34, 88) Source(52, 62) + SourceIndex(0) +13>Emitted(34, 89) Source(52, 63) + SourceIndex(0) +14>Emitted(34, 92) Source(52, 66) + SourceIndex(0) +15>Emitted(34, 93) Source(52, 67) + SourceIndex(0) +16>Emitted(34, 95) Source(52, 69) + SourceIndex(0) +17>Emitted(34, 96) Source(52, 70) + SourceIndex(0) +18>Emitted(34, 98) Source(52, 72) + SourceIndex(0) +19>Emitted(34, 100) Source(52, 74) + SourceIndex(0) +20>Emitted(34, 101) Source(52, 75) + SourceIndex(0) +--- +>>> console.log(numberB); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > numberB +7 > ) +8 > ; +1 >Emitted(35, 5) Source(53, 5) + SourceIndex(0) +2 >Emitted(35, 12) Source(53, 12) + SourceIndex(0) +3 >Emitted(35, 13) Source(53, 13) + SourceIndex(0) +4 >Emitted(35, 16) Source(53, 16) + SourceIndex(0) +5 >Emitted(35, 17) Source(53, 17) + SourceIndex(0) +6 >Emitted(35, 24) Source(53, 24) + SourceIndex(0) +7 >Emitted(35, 25) Source(53, 25) + SourceIndex(0) +8 >Emitted(35, 26) Source(53, 26) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(36, 1) Source(54, 1) + SourceIndex(0) +2 >Emitted(36, 2) Source(54, 2) + SourceIndex(0) +--- +>>>for (var _y = multiRobotA[0], nameB = _y === void 0 ? "name" : _y, i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^ +10> ^^^ +11> ^ +12> ^^ +13> ^ +14> ^^^ +15> ^ +16> ^^ +17> ^ +18> ^^ +19> ^^ +20> ^ +1-> + > +2 >for +3 > +4 > (let [ +5 > nameB = "name" +6 > +7 > nameB = "name" +8 > ] = multiRobotA, +9 > i +10> = +11> 0 +12> ; +13> i +14> < +15> 1 +16> ; +17> i +18> ++ +19> ) +20> { +1->Emitted(37, 1) Source(55, 1) + SourceIndex(0) +2 >Emitted(37, 4) Source(55, 4) + SourceIndex(0) +3 >Emitted(37, 5) Source(55, 5) + SourceIndex(0) +4 >Emitted(37, 6) Source(55, 11) + SourceIndex(0) +5 >Emitted(37, 29) Source(55, 25) + SourceIndex(0) +6 >Emitted(37, 31) Source(55, 11) + SourceIndex(0) +7 >Emitted(37, 66) Source(55, 25) + SourceIndex(0) +8 >Emitted(37, 68) Source(55, 42) + SourceIndex(0) +9 >Emitted(37, 69) Source(55, 43) + SourceIndex(0) +10>Emitted(37, 72) Source(55, 46) + SourceIndex(0) +11>Emitted(37, 73) Source(55, 47) + SourceIndex(0) +12>Emitted(37, 75) Source(55, 49) + SourceIndex(0) +13>Emitted(37, 76) Source(55, 50) + SourceIndex(0) +14>Emitted(37, 79) Source(55, 53) + SourceIndex(0) +15>Emitted(37, 80) Source(55, 54) + SourceIndex(0) +16>Emitted(37, 82) Source(55, 56) + SourceIndex(0) +17>Emitted(37, 83) Source(55, 57) + SourceIndex(0) +18>Emitted(37, 85) Source(55, 59) + SourceIndex(0) +19>Emitted(37, 87) Source(55, 61) + SourceIndex(0) +20>Emitted(37, 88) Source(55, 62) + SourceIndex(0) +--- +>>> console.log(nameB); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameB +7 > ) +8 > ; +1 >Emitted(38, 5) Source(56, 5) + SourceIndex(0) +2 >Emitted(38, 12) Source(56, 12) + SourceIndex(0) +3 >Emitted(38, 13) Source(56, 13) + SourceIndex(0) +4 >Emitted(38, 16) Source(56, 16) + SourceIndex(0) +5 >Emitted(38, 17) Source(56, 17) + SourceIndex(0) +6 >Emitted(38, 22) Source(56, 22) + SourceIndex(0) +7 >Emitted(38, 23) Source(56, 23) + SourceIndex(0) +8 >Emitted(38, 24) Source(56, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(39, 1) Source(57, 1) + SourceIndex(0) +2 >Emitted(39, 2) Source(57, 2) + SourceIndex(0) +--- +>>>for (var _z = getMultiRobot()[0], nameB = _z === void 0 ? "name" : _z, i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^ +10> ^^^ +11> ^ +12> ^^ +13> ^ +14> ^^^ +15> ^ +16> ^^ +17> ^ +18> ^^ +19> ^^ +20> ^ +1-> + > +2 >for +3 > +4 > (let [ +5 > nameB = "name" +6 > +7 > nameB = "name" +8 > ] = getMultiRobot(), +9 > i +10> = +11> 0 +12> ; +13> i +14> < +15> 1 +16> ; +17> i +18> ++ +19> ) +20> { +1->Emitted(40, 1) Source(58, 1) + SourceIndex(0) +2 >Emitted(40, 4) Source(58, 4) + SourceIndex(0) +3 >Emitted(40, 5) Source(58, 5) + SourceIndex(0) +4 >Emitted(40, 6) Source(58, 11) + SourceIndex(0) +5 >Emitted(40, 33) Source(58, 25) + SourceIndex(0) +6 >Emitted(40, 35) Source(58, 11) + SourceIndex(0) +7 >Emitted(40, 70) Source(58, 25) + SourceIndex(0) +8 >Emitted(40, 72) Source(58, 46) + SourceIndex(0) +9 >Emitted(40, 73) Source(58, 47) + SourceIndex(0) +10>Emitted(40, 76) Source(58, 50) + SourceIndex(0) +11>Emitted(40, 77) Source(58, 51) + SourceIndex(0) +12>Emitted(40, 79) Source(58, 53) + SourceIndex(0) +13>Emitted(40, 80) Source(58, 54) + SourceIndex(0) +14>Emitted(40, 83) Source(58, 57) + SourceIndex(0) +15>Emitted(40, 84) Source(58, 58) + SourceIndex(0) +16>Emitted(40, 86) Source(58, 60) + SourceIndex(0) +17>Emitted(40, 87) Source(58, 61) + SourceIndex(0) +18>Emitted(40, 89) Source(58, 63) + SourceIndex(0) +19>Emitted(40, 91) Source(58, 65) + SourceIndex(0) +20>Emitted(40, 92) Source(58, 66) + SourceIndex(0) +--- +>>> console.log(nameB); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameB +7 > ) +8 > ; +1 >Emitted(41, 5) Source(59, 5) + SourceIndex(0) +2 >Emitted(41, 12) Source(59, 12) + SourceIndex(0) +3 >Emitted(41, 13) Source(59, 13) + SourceIndex(0) +4 >Emitted(41, 16) Source(59, 16) + SourceIndex(0) +5 >Emitted(41, 17) Source(59, 17) + SourceIndex(0) +6 >Emitted(41, 22) Source(59, 22) + SourceIndex(0) +7 >Emitted(41, 23) Source(59, 23) + SourceIndex(0) +8 >Emitted(41, 24) Source(59, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(42, 1) Source(60, 1) + SourceIndex(0) +2 >Emitted(42, 2) Source(60, 2) + SourceIndex(0) +--- +>>>for (var _0 = ["trimmer", ["trimming", "edging"]][0], nameB = _0 === void 0 ? "name" : _0, i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^ +10> ^^^ +11> ^ +12> ^^ +13> ^ +14> ^^^ +15> ^ +16> ^^ +17> ^ +18> ^^ +19> ^^ +20> ^ +1-> + > +2 >for +3 > +4 > (let [ +5 > nameB = "name" +6 > +7 > nameB = "name" +8 > ] = ["trimmer", ["trimming", "edging"]], +9 > i +10> = +11> 0 +12> ; +13> i +14> < +15> 1 +16> ; +17> i +18> ++ +19> ) +20> { +1->Emitted(43, 1) Source(61, 1) + SourceIndex(0) +2 >Emitted(43, 4) Source(61, 4) + SourceIndex(0) +3 >Emitted(43, 5) Source(61, 5) + SourceIndex(0) +4 >Emitted(43, 6) Source(61, 11) + SourceIndex(0) +5 >Emitted(43, 53) Source(61, 25) + SourceIndex(0) +6 >Emitted(43, 55) Source(61, 11) + SourceIndex(0) +7 >Emitted(43, 90) Source(61, 25) + SourceIndex(0) +8 >Emitted(43, 92) Source(61, 66) + SourceIndex(0) +9 >Emitted(43, 93) Source(61, 67) + SourceIndex(0) +10>Emitted(43, 96) Source(61, 70) + SourceIndex(0) +11>Emitted(43, 97) Source(61, 71) + SourceIndex(0) +12>Emitted(43, 99) Source(61, 73) + SourceIndex(0) +13>Emitted(43, 100) Source(61, 74) + SourceIndex(0) +14>Emitted(43, 103) Source(61, 77) + SourceIndex(0) +15>Emitted(43, 104) Source(61, 78) + SourceIndex(0) +16>Emitted(43, 106) Source(61, 80) + SourceIndex(0) +17>Emitted(43, 107) Source(61, 81) + SourceIndex(0) +18>Emitted(43, 109) Source(61, 83) + SourceIndex(0) +19>Emitted(43, 111) Source(61, 85) + SourceIndex(0) +20>Emitted(43, 112) Source(61, 86) + SourceIndex(0) +--- +>>> console.log(nameB); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameB +7 > ) +8 > ; +1 >Emitted(44, 5) Source(62, 5) + SourceIndex(0) +2 >Emitted(44, 12) Source(62, 12) + SourceIndex(0) +3 >Emitted(44, 13) Source(62, 13) + SourceIndex(0) +4 >Emitted(44, 16) Source(62, 16) + SourceIndex(0) +5 >Emitted(44, 17) Source(62, 17) + SourceIndex(0) +6 >Emitted(44, 22) Source(62, 22) + SourceIndex(0) +7 >Emitted(44, 23) Source(62, 23) + SourceIndex(0) +8 >Emitted(44, 24) Source(62, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(45, 1) Source(63, 1) + SourceIndex(0) +2 >Emitted(45, 2) Source(63, 2) + SourceIndex(0) +--- +>>>for (var _1 = robotA[0], numberA2 = _1 === void 0 ? -1 : _1, _2 = robotA[1], nameA2 = _2 === void 0 ? "name" : _2, _3 = robotA[2], skillA2 = _3 === void 0 ? "skill" : _3, i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^ +10> ^^ +11> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +12> ^^ +13> ^^^^^^^^^^^^^^ +14> ^^ +15> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +16> ^^ +17> ^ +18> ^^^ +19> ^ +20> ^^ +21> ^ +22> ^^^ +23> ^ +24> ^^ +25> ^ +26> ^^ +27> ^^ +28> ^ +1-> + > + > +2 >for +3 > +4 > (let [ +5 > numberA2 = -1 +6 > +7 > numberA2 = -1 +8 > , +9 > nameA2 = "name" +10> +11> nameA2 = "name" +12> , +13> skillA2 = "skill" +14> +15> skillA2 = "skill" +16> ] = robotA, +17> i +18> = +19> 0 +20> ; +21> i +22> < +23> 1 +24> ; +25> i +26> ++ +27> ) +28> { +1->Emitted(46, 1) Source(65, 1) + SourceIndex(0) +2 >Emitted(46, 4) Source(65, 4) + SourceIndex(0) +3 >Emitted(46, 5) Source(65, 5) + SourceIndex(0) +4 >Emitted(46, 6) Source(65, 11) + SourceIndex(0) +5 >Emitted(46, 24) Source(65, 24) + SourceIndex(0) +6 >Emitted(46, 26) Source(65, 11) + SourceIndex(0) +7 >Emitted(46, 60) Source(65, 24) + SourceIndex(0) +8 >Emitted(46, 62) Source(65, 26) + SourceIndex(0) +9 >Emitted(46, 76) Source(65, 41) + SourceIndex(0) +10>Emitted(46, 78) Source(65, 26) + SourceIndex(0) +11>Emitted(46, 114) Source(65, 41) + SourceIndex(0) +12>Emitted(46, 116) Source(65, 43) + SourceIndex(0) +13>Emitted(46, 130) Source(65, 60) + SourceIndex(0) +14>Emitted(46, 132) Source(65, 43) + SourceIndex(0) +15>Emitted(46, 170) Source(65, 60) + SourceIndex(0) +16>Emitted(46, 172) Source(65, 72) + SourceIndex(0) +17>Emitted(46, 173) Source(65, 73) + SourceIndex(0) +18>Emitted(46, 176) Source(65, 76) + SourceIndex(0) +19>Emitted(46, 177) Source(65, 77) + SourceIndex(0) +20>Emitted(46, 179) Source(65, 79) + SourceIndex(0) +21>Emitted(46, 180) Source(65, 80) + SourceIndex(0) +22>Emitted(46, 183) Source(65, 83) + SourceIndex(0) +23>Emitted(46, 184) Source(65, 84) + SourceIndex(0) +24>Emitted(46, 186) Source(65, 86) + SourceIndex(0) +25>Emitted(46, 187) Source(65, 87) + SourceIndex(0) +26>Emitted(46, 189) Source(65, 89) + SourceIndex(0) +27>Emitted(46, 191) Source(65, 91) + SourceIndex(0) +28>Emitted(46, 192) Source(65, 92) + SourceIndex(0) +--- +>>> console.log(nameA2); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA2 +7 > ) +8 > ; +1 >Emitted(47, 5) Source(66, 5) + SourceIndex(0) +2 >Emitted(47, 12) Source(66, 12) + SourceIndex(0) +3 >Emitted(47, 13) Source(66, 13) + SourceIndex(0) +4 >Emitted(47, 16) Source(66, 16) + SourceIndex(0) +5 >Emitted(47, 17) Source(66, 17) + SourceIndex(0) +6 >Emitted(47, 23) Source(66, 23) + SourceIndex(0) +7 >Emitted(47, 24) Source(66, 24) + SourceIndex(0) +8 >Emitted(47, 25) Source(66, 25) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(48, 1) Source(67, 1) + SourceIndex(0) +2 >Emitted(48, 2) Source(67, 2) + SourceIndex(0) +--- +>>>for (var _4 = getRobot(), _5 = _4[0], numberA2 = _5 === void 0 ? -1 : _5, _6 = _4[1], nameA2 = _6 === void 0 ? "name" : _6, _7 = _4[2], skillA2 = _7 === void 0 ? "skill" : _7, i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^ +6 > ^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +15> ^^ +16> ^^^^^^^^^^ +17> ^^ +18> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +19> ^^ +20> ^ +21> ^^^ +22> ^ +23> ^^ +24> ^ +25> ^^^ +26> ^ +27> ^^ +28> ^ +29> ^^ +30> ^^ +31> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > let [numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = getRobot() +7 > +8 > numberA2 = -1 +9 > +10> numberA2 = -1 +11> , +12> nameA2 = "name" +13> +14> nameA2 = "name" +15> , +16> skillA2 = "skill" +17> +18> skillA2 = "skill" +19> ] = getRobot(), +20> i +21> = +22> 0 +23> ; +24> i +25> < +26> 1 +27> ; +28> i +29> ++ +30> ) +31> { +1->Emitted(49, 1) Source(68, 1) + SourceIndex(0) +2 >Emitted(49, 4) Source(68, 4) + SourceIndex(0) +3 >Emitted(49, 5) Source(68, 5) + SourceIndex(0) +4 >Emitted(49, 6) Source(68, 6) + SourceIndex(0) +5 >Emitted(49, 10) Source(68, 6) + SourceIndex(0) +6 >Emitted(49, 25) Source(68, 74) + SourceIndex(0) +7 >Emitted(49, 27) Source(68, 11) + SourceIndex(0) +8 >Emitted(49, 37) Source(68, 24) + SourceIndex(0) +9 >Emitted(49, 39) Source(68, 11) + SourceIndex(0) +10>Emitted(49, 73) Source(68, 24) + SourceIndex(0) +11>Emitted(49, 75) Source(68, 26) + SourceIndex(0) +12>Emitted(49, 85) Source(68, 41) + SourceIndex(0) +13>Emitted(49, 87) Source(68, 26) + SourceIndex(0) +14>Emitted(49, 123) Source(68, 41) + SourceIndex(0) +15>Emitted(49, 125) Source(68, 43) + SourceIndex(0) +16>Emitted(49, 135) Source(68, 60) + SourceIndex(0) +17>Emitted(49, 137) Source(68, 43) + SourceIndex(0) +18>Emitted(49, 175) Source(68, 60) + SourceIndex(0) +19>Emitted(49, 177) Source(68, 76) + SourceIndex(0) +20>Emitted(49, 178) Source(68, 77) + SourceIndex(0) +21>Emitted(49, 181) Source(68, 80) + SourceIndex(0) +22>Emitted(49, 182) Source(68, 81) + SourceIndex(0) +23>Emitted(49, 184) Source(68, 83) + SourceIndex(0) +24>Emitted(49, 185) Source(68, 84) + SourceIndex(0) +25>Emitted(49, 188) Source(68, 87) + SourceIndex(0) +26>Emitted(49, 189) Source(68, 88) + SourceIndex(0) +27>Emitted(49, 191) Source(68, 90) + SourceIndex(0) +28>Emitted(49, 192) Source(68, 91) + SourceIndex(0) +29>Emitted(49, 194) Source(68, 93) + SourceIndex(0) +30>Emitted(49, 196) Source(68, 95) + SourceIndex(0) +31>Emitted(49, 197) Source(68, 96) + SourceIndex(0) +--- +>>> console.log(nameA2); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA2 +7 > ) +8 > ; +1 >Emitted(50, 5) Source(69, 5) + SourceIndex(0) +2 >Emitted(50, 12) Source(69, 12) + SourceIndex(0) +3 >Emitted(50, 13) Source(69, 13) + SourceIndex(0) +4 >Emitted(50, 16) Source(69, 16) + SourceIndex(0) +5 >Emitted(50, 17) Source(69, 17) + SourceIndex(0) +6 >Emitted(50, 23) Source(69, 23) + SourceIndex(0) +7 >Emitted(50, 24) Source(69, 24) + SourceIndex(0) +8 >Emitted(50, 25) Source(69, 25) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(51, 1) Source(70, 1) + SourceIndex(0) +2 >Emitted(51, 2) Source(70, 2) + SourceIndex(0) +--- +>>>for (var _8 = [2, "trimmer", "trimming"], _9 = _8[0], numberA2 = _9 === void 0 ? -1 : _9, _10 = _8[1], nameA2 = _10 === void 0 ? "name" : _10, _11 = _8[2], skillA2 = _11 === void 0 ? "skill" : _11, i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +15> ^^ +16> ^^^^^^^^^^^ +17> ^^ +18> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +19> ^^ +20> ^ +21> ^^^ +22> ^ +23> ^^ +24> ^ +25> ^^^ +26> ^ +27> ^^ +28> ^ +29> ^^ +30> ^^ +31> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > let [numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = [2, "trimmer", "trimming"] +7 > +8 > numberA2 = -1 +9 > +10> numberA2 = -1 +11> , +12> nameA2 = "name" +13> +14> nameA2 = "name" +15> , +16> skillA2 = "skill" +17> +18> skillA2 = "skill" +19> ] = [2, "trimmer", "trimming"], +20> i +21> = +22> 0 +23> ; +24> i +25> < +26> 1 +27> ; +28> i +29> ++ +30> ) +31> { +1->Emitted(52, 1) Source(71, 1) + SourceIndex(0) +2 >Emitted(52, 4) Source(71, 4) + SourceIndex(0) +3 >Emitted(52, 5) Source(71, 5) + SourceIndex(0) +4 >Emitted(52, 6) Source(71, 6) + SourceIndex(0) +5 >Emitted(52, 10) Source(71, 6) + SourceIndex(0) +6 >Emitted(52, 41) Source(71, 90) + SourceIndex(0) +7 >Emitted(52, 43) Source(71, 11) + SourceIndex(0) +8 >Emitted(52, 53) Source(71, 24) + SourceIndex(0) +9 >Emitted(52, 55) Source(71, 11) + SourceIndex(0) +10>Emitted(52, 89) Source(71, 24) + SourceIndex(0) +11>Emitted(52, 91) Source(71, 26) + SourceIndex(0) +12>Emitted(52, 102) Source(71, 41) + SourceIndex(0) +13>Emitted(52, 104) Source(71, 26) + SourceIndex(0) +14>Emitted(52, 142) Source(71, 41) + SourceIndex(0) +15>Emitted(52, 144) Source(71, 43) + SourceIndex(0) +16>Emitted(52, 155) Source(71, 60) + SourceIndex(0) +17>Emitted(52, 157) Source(71, 43) + SourceIndex(0) +18>Emitted(52, 197) Source(71, 60) + SourceIndex(0) +19>Emitted(52, 199) Source(71, 92) + SourceIndex(0) +20>Emitted(52, 200) Source(71, 93) + SourceIndex(0) +21>Emitted(52, 203) Source(71, 96) + SourceIndex(0) +22>Emitted(52, 204) Source(71, 97) + SourceIndex(0) +23>Emitted(52, 206) Source(71, 99) + SourceIndex(0) +24>Emitted(52, 207) Source(71, 100) + SourceIndex(0) +25>Emitted(52, 210) Source(71, 103) + SourceIndex(0) +26>Emitted(52, 211) Source(71, 104) + SourceIndex(0) +27>Emitted(52, 213) Source(71, 106) + SourceIndex(0) +28>Emitted(52, 214) Source(71, 107) + SourceIndex(0) +29>Emitted(52, 216) Source(71, 109) + SourceIndex(0) +30>Emitted(52, 218) Source(71, 111) + SourceIndex(0) +31>Emitted(52, 219) Source(71, 112) + SourceIndex(0) +--- +>>> console.log(nameA2); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA2 +7 > ) +8 > ; +1 >Emitted(53, 5) Source(72, 5) + SourceIndex(0) +2 >Emitted(53, 12) Source(72, 12) + SourceIndex(0) +3 >Emitted(53, 13) Source(72, 13) + SourceIndex(0) +4 >Emitted(53, 16) Source(72, 16) + SourceIndex(0) +5 >Emitted(53, 17) Source(72, 17) + SourceIndex(0) +6 >Emitted(53, 23) Source(72, 23) + SourceIndex(0) +7 >Emitted(53, 24) Source(72, 24) + SourceIndex(0) +8 >Emitted(53, 25) Source(72, 25) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(54, 1) Source(73, 1) + SourceIndex(0) +2 >Emitted(54, 2) Source(73, 2) + SourceIndex(0) +--- +>>>for (var _12 = multiRobotA[0], nameMA = _12 === void 0 ? "noName" : _12, _13 = multiRobotA[1], _14 = _13 === void 0 ? ["none", "none"] : _13, _15 = _14[0], primarySkillA = _15 === void 0 ? "primary" : _15, _16 = _14[1], secondarySkillA = _16 === void 0 ? "secondary" : _16, i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^^^^^^ +10> ^^ +11> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +12> ^^ +13> ^^^^^^^^^^^^ +14> ^^ +15> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +16> ^^ +17> ^^^^^^^^^^^^ +18> ^^ +19> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +20> ^^ +21> ^ +22> ^^^ +23> ^ +24> ^^ +25> ^ +26> ^^^ +27> ^ +28> ^^ +29> ^ +30> ^^ +31> ^^ +32> ^ +1-> + > +2 >for +3 > +4 > (let + > [ +5 > nameMA = "noName" +6 > +7 > nameMA = "noName" +8 > , + > +9 > [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["none", "none"] +10> +11> [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["none", "none"] +12> +13> primarySkillA = "primary" +14> +15> primarySkillA = "primary" +16> , + > +17> secondarySkillA = "secondary" +18> +19> secondarySkillA = "secondary" +20> + > ] = ["none", "none"] + > ] = multiRobotA, +21> i +22> = +23> 0 +24> ; +25> i +26> < +27> 1 +28> ; +29> i +30> ++ +31> ) +32> { +1->Emitted(55, 1) Source(74, 1) + SourceIndex(0) +2 >Emitted(55, 4) Source(74, 4) + SourceIndex(0) +3 >Emitted(55, 5) Source(74, 5) + SourceIndex(0) +4 >Emitted(55, 6) Source(75, 6) + SourceIndex(0) +5 >Emitted(55, 30) Source(75, 23) + SourceIndex(0) +6 >Emitted(55, 32) Source(75, 6) + SourceIndex(0) +7 >Emitted(55, 72) Source(75, 23) + SourceIndex(0) +8 >Emitted(55, 74) Source(76, 9) + SourceIndex(0) +9 >Emitted(55, 94) Source(79, 29) + SourceIndex(0) +10>Emitted(55, 96) Source(76, 9) + SourceIndex(0) +11>Emitted(55, 141) Source(79, 29) + SourceIndex(0) +12>Emitted(55, 143) Source(77, 13) + SourceIndex(0) +13>Emitted(55, 155) Source(77, 38) + SourceIndex(0) +14>Emitted(55, 157) Source(77, 13) + SourceIndex(0) +15>Emitted(55, 205) Source(77, 38) + SourceIndex(0) +16>Emitted(55, 207) Source(78, 13) + SourceIndex(0) +17>Emitted(55, 219) Source(78, 42) + SourceIndex(0) +18>Emitted(55, 221) Source(78, 13) + SourceIndex(0) +19>Emitted(55, 273) Source(78, 42) + SourceIndex(0) +20>Emitted(55, 275) Source(80, 22) + SourceIndex(0) +21>Emitted(55, 276) Source(80, 23) + SourceIndex(0) +22>Emitted(55, 279) Source(80, 26) + SourceIndex(0) +23>Emitted(55, 280) Source(80, 27) + SourceIndex(0) +24>Emitted(55, 282) Source(80, 29) + SourceIndex(0) +25>Emitted(55, 283) Source(80, 30) + SourceIndex(0) +26>Emitted(55, 286) Source(80, 33) + SourceIndex(0) +27>Emitted(55, 287) Source(80, 34) + SourceIndex(0) +28>Emitted(55, 289) Source(80, 36) + SourceIndex(0) +29>Emitted(55, 290) Source(80, 37) + SourceIndex(0) +30>Emitted(55, 292) Source(80, 39) + SourceIndex(0) +31>Emitted(55, 294) Source(80, 41) + SourceIndex(0) +32>Emitted(55, 295) Source(80, 42) + SourceIndex(0) +--- +>>> console.log(nameMA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameMA +7 > ) +8 > ; +1 >Emitted(56, 5) Source(81, 5) + SourceIndex(0) +2 >Emitted(56, 12) Source(81, 12) + SourceIndex(0) +3 >Emitted(56, 13) Source(81, 13) + SourceIndex(0) +4 >Emitted(56, 16) Source(81, 16) + SourceIndex(0) +5 >Emitted(56, 17) Source(81, 17) + SourceIndex(0) +6 >Emitted(56, 23) Source(81, 23) + SourceIndex(0) +7 >Emitted(56, 24) Source(81, 24) + SourceIndex(0) +8 >Emitted(56, 25) Source(81, 25) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(57, 1) Source(82, 1) + SourceIndex(0) +2 >Emitted(57, 2) Source(82, 2) + SourceIndex(0) +--- +>>>for (var _17 = getMultiRobot(), _18 = _17[0], nameMA = _18 === void 0 ? "noName" : _18, _19 = _17[1], _20 = _19 === void 0 ? ["none", "none"] : _19, _21 = _20[0], primarySkillA = _21 === void 0 ? "primary" : _21, _22 = _20[1], secondarySkillA = _22 === void 0 ? "secondary" : _22, i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^ +6 > ^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +15> ^^ +16> ^^^^^^^^^^^^ +17> ^^ +18> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +19> ^^ +20> ^^^^^^^^^^^^ +21> ^^ +22> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +23> ^^ +24> ^ +25> ^^^ +26> ^ +27> ^^ +28> ^ +29> ^^^ +30> ^ +31> ^^ +32> ^ +33> ^^ +34> ^^ +35> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > let [nameMA = "noName", + > [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["none", "none"] + > ] = getMultiRobot() +7 > +8 > nameMA = "noName" +9 > +10> nameMA = "noName" +11> , + > +12> [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["none", "none"] +13> +14> [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["none", "none"] +15> +16> primarySkillA = "primary" +17> +18> primarySkillA = "primary" +19> , + > +20> secondarySkillA = "secondary" +21> +22> secondarySkillA = "secondary" +23> + > ] = ["none", "none"] + > ] = getMultiRobot(), +24> i +25> = +26> 0 +27> ; +28> i +29> < +30> 1 +31> ; +32> i +33> ++ +34> ) +35> { +1->Emitted(58, 1) Source(83, 1) + SourceIndex(0) +2 >Emitted(58, 4) Source(83, 4) + SourceIndex(0) +3 >Emitted(58, 5) Source(83, 5) + SourceIndex(0) +4 >Emitted(58, 6) Source(83, 6) + SourceIndex(0) +5 >Emitted(58, 10) Source(83, 6) + SourceIndex(0) +6 >Emitted(58, 31) Source(88, 21) + SourceIndex(0) +7 >Emitted(58, 33) Source(83, 11) + SourceIndex(0) +8 >Emitted(58, 45) Source(83, 28) + SourceIndex(0) +9 >Emitted(58, 47) Source(83, 11) + SourceIndex(0) +10>Emitted(58, 87) Source(83, 28) + SourceIndex(0) +11>Emitted(58, 89) Source(84, 5) + SourceIndex(0) +12>Emitted(58, 101) Source(87, 25) + SourceIndex(0) +13>Emitted(58, 103) Source(84, 5) + SourceIndex(0) +14>Emitted(58, 148) Source(87, 25) + SourceIndex(0) +15>Emitted(58, 150) Source(85, 9) + SourceIndex(0) +16>Emitted(58, 162) Source(85, 34) + SourceIndex(0) +17>Emitted(58, 164) Source(85, 9) + SourceIndex(0) +18>Emitted(58, 212) Source(85, 34) + SourceIndex(0) +19>Emitted(58, 214) Source(86, 9) + SourceIndex(0) +20>Emitted(58, 226) Source(86, 38) + SourceIndex(0) +21>Emitted(58, 228) Source(86, 9) + SourceIndex(0) +22>Emitted(58, 280) Source(86, 38) + SourceIndex(0) +23>Emitted(58, 282) Source(88, 23) + SourceIndex(0) +24>Emitted(58, 283) Source(88, 24) + SourceIndex(0) +25>Emitted(58, 286) Source(88, 27) + SourceIndex(0) +26>Emitted(58, 287) Source(88, 28) + SourceIndex(0) +27>Emitted(58, 289) Source(88, 30) + SourceIndex(0) +28>Emitted(58, 290) Source(88, 31) + SourceIndex(0) +29>Emitted(58, 293) Source(88, 34) + SourceIndex(0) +30>Emitted(58, 294) Source(88, 35) + SourceIndex(0) +31>Emitted(58, 296) Source(88, 37) + SourceIndex(0) +32>Emitted(58, 297) Source(88, 38) + SourceIndex(0) +33>Emitted(58, 299) Source(88, 40) + SourceIndex(0) +34>Emitted(58, 301) Source(88, 42) + SourceIndex(0) +35>Emitted(58, 302) Source(88, 43) + SourceIndex(0) +--- +>>> console.log(nameMA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameMA +7 > ) +8 > ; +1 >Emitted(59, 5) Source(89, 5) + SourceIndex(0) +2 >Emitted(59, 12) Source(89, 12) + SourceIndex(0) +3 >Emitted(59, 13) Source(89, 13) + SourceIndex(0) +4 >Emitted(59, 16) Source(89, 16) + SourceIndex(0) +5 >Emitted(59, 17) Source(89, 17) + SourceIndex(0) +6 >Emitted(59, 23) Source(89, 23) + SourceIndex(0) +7 >Emitted(59, 24) Source(89, 24) + SourceIndex(0) +8 >Emitted(59, 25) Source(89, 25) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(60, 1) Source(90, 1) + SourceIndex(0) +2 >Emitted(60, 2) Source(90, 2) + SourceIndex(0) +--- +>>>for (var _23 = ["trimmer", ["trimming", "edging"]], _24 = _23[0], nameMA = _24 === void 0 ? "noName" : _24, _25 = _23[1], _26 = _25 === void 0 ? ["none", "none"] : _25, _27 = _26[0], primarySkillA = _27 === void 0 ? "primary" : _27, _28 = _26[1], secondarySkillA = _28 === void 0 ? "secondary" : _28, i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +15> ^^ +16> ^^^^^^^^^^^^ +17> ^^ +18> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +19> ^^ +20> ^^^^^^^^^^^^ +21> ^^ +22> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +23> ^^ +24> ^ +25> ^^^ +26> ^ +27> ^^ +28> ^ +29> ^^^ +30> ^ +31> ^^ +32> ^ +33> ^^ +34> ^^ +35> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > let [nameMA = "noName", + > [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["none", "none"] + > ] = ["trimmer", ["trimming", "edging"]] +7 > +8 > nameMA = "noName" +9 > +10> nameMA = "noName" +11> , + > +12> [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["none", "none"] +13> +14> [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["none", "none"] +15> +16> primarySkillA = "primary" +17> +18> primarySkillA = "primary" +19> , + > +20> secondarySkillA = "secondary" +21> +22> secondarySkillA = "secondary" +23> + > ] = ["none", "none"] + > ] = ["trimmer", ["trimming", "edging"]], +24> i +25> = +26> 0 +27> ; +28> i +29> < +30> 1 +31> ; +32> i +33> ++ +34> ) +35> { +1->Emitted(61, 1) Source(91, 1) + SourceIndex(0) +2 >Emitted(61, 4) Source(91, 4) + SourceIndex(0) +3 >Emitted(61, 5) Source(91, 5) + SourceIndex(0) +4 >Emitted(61, 6) Source(91, 6) + SourceIndex(0) +5 >Emitted(61, 10) Source(91, 6) + SourceIndex(0) +6 >Emitted(61, 51) Source(96, 41) + SourceIndex(0) +7 >Emitted(61, 53) Source(91, 11) + SourceIndex(0) +8 >Emitted(61, 65) Source(91, 28) + SourceIndex(0) +9 >Emitted(61, 67) Source(91, 11) + SourceIndex(0) +10>Emitted(61, 107) Source(91, 28) + SourceIndex(0) +11>Emitted(61, 109) Source(92, 5) + SourceIndex(0) +12>Emitted(61, 121) Source(95, 25) + SourceIndex(0) +13>Emitted(61, 123) Source(92, 5) + SourceIndex(0) +14>Emitted(61, 168) Source(95, 25) + SourceIndex(0) +15>Emitted(61, 170) Source(93, 9) + SourceIndex(0) +16>Emitted(61, 182) Source(93, 34) + SourceIndex(0) +17>Emitted(61, 184) Source(93, 9) + SourceIndex(0) +18>Emitted(61, 232) Source(93, 34) + SourceIndex(0) +19>Emitted(61, 234) Source(94, 9) + SourceIndex(0) +20>Emitted(61, 246) Source(94, 38) + SourceIndex(0) +21>Emitted(61, 248) Source(94, 9) + SourceIndex(0) +22>Emitted(61, 300) Source(94, 38) + SourceIndex(0) +23>Emitted(61, 302) Source(96, 43) + SourceIndex(0) +24>Emitted(61, 303) Source(96, 44) + SourceIndex(0) +25>Emitted(61, 306) Source(96, 47) + SourceIndex(0) +26>Emitted(61, 307) Source(96, 48) + SourceIndex(0) +27>Emitted(61, 309) Source(96, 50) + SourceIndex(0) +28>Emitted(61, 310) Source(96, 51) + SourceIndex(0) +29>Emitted(61, 313) Source(96, 54) + SourceIndex(0) +30>Emitted(61, 314) Source(96, 55) + SourceIndex(0) +31>Emitted(61, 316) Source(96, 57) + SourceIndex(0) +32>Emitted(61, 317) Source(96, 58) + SourceIndex(0) +33>Emitted(61, 319) Source(96, 60) + SourceIndex(0) +34>Emitted(61, 321) Source(96, 62) + SourceIndex(0) +35>Emitted(61, 322) Source(96, 63) + SourceIndex(0) +--- +>>> console.log(nameMA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameMA +7 > ) +8 > ; +1 >Emitted(62, 5) Source(97, 5) + SourceIndex(0) +2 >Emitted(62, 12) Source(97, 12) + SourceIndex(0) +3 >Emitted(62, 13) Source(97, 13) + SourceIndex(0) +4 >Emitted(62, 16) Source(97, 16) + SourceIndex(0) +5 >Emitted(62, 17) Source(97, 17) + SourceIndex(0) +6 >Emitted(62, 23) Source(97, 23) + SourceIndex(0) +7 >Emitted(62, 24) Source(97, 24) + SourceIndex(0) +8 >Emitted(62, 25) Source(97, 25) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(63, 1) Source(98, 1) + SourceIndex(0) +2 >Emitted(63, 2) Source(98, 2) + SourceIndex(0) +--- +>>>for (var _29 = robotA[0], numberA3 = _29 === void 0 ? -1 : _29, robotAInfo = robotA.slice(1), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +10> ^^ +11> ^ +12> ^^^ +13> ^ +14> ^^ +15> ^ +16> ^^^ +17> ^ +18> ^^ +19> ^ +20> ^^ +21> ^^ +22> ^ +1-> + > + > +2 >for +3 > +4 > (let [ +5 > numberA3 = -1 +6 > +7 > numberA3 = -1 +8 > , +9 > ...robotAInfo +10> ] = robotA, +11> i +12> = +13> 0 +14> ; +15> i +16> < +17> 1 +18> ; +19> i +20> ++ +21> ) +22> { +1->Emitted(64, 1) Source(100, 1) + SourceIndex(0) +2 >Emitted(64, 4) Source(100, 4) + SourceIndex(0) +3 >Emitted(64, 5) Source(100, 5) + SourceIndex(0) +4 >Emitted(64, 6) Source(100, 11) + SourceIndex(0) +5 >Emitted(64, 25) Source(100, 24) + SourceIndex(0) +6 >Emitted(64, 27) Source(100, 11) + SourceIndex(0) +7 >Emitted(64, 63) Source(100, 24) + SourceIndex(0) +8 >Emitted(64, 65) Source(100, 26) + SourceIndex(0) +9 >Emitted(64, 93) Source(100, 39) + SourceIndex(0) +10>Emitted(64, 95) Source(100, 51) + SourceIndex(0) +11>Emitted(64, 96) Source(100, 52) + SourceIndex(0) +12>Emitted(64, 99) Source(100, 55) + SourceIndex(0) +13>Emitted(64, 100) Source(100, 56) + SourceIndex(0) +14>Emitted(64, 102) Source(100, 58) + SourceIndex(0) +15>Emitted(64, 103) Source(100, 59) + SourceIndex(0) +16>Emitted(64, 106) Source(100, 62) + SourceIndex(0) +17>Emitted(64, 107) Source(100, 63) + SourceIndex(0) +18>Emitted(64, 109) Source(100, 65) + SourceIndex(0) +19>Emitted(64, 110) Source(100, 66) + SourceIndex(0) +20>Emitted(64, 112) Source(100, 68) + SourceIndex(0) +21>Emitted(64, 114) Source(100, 70) + SourceIndex(0) +22>Emitted(64, 115) Source(100, 71) + SourceIndex(0) +--- +>>> console.log(numberA3); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > numberA3 +7 > ) +8 > ; +1 >Emitted(65, 5) Source(101, 5) + SourceIndex(0) +2 >Emitted(65, 12) Source(101, 12) + SourceIndex(0) +3 >Emitted(65, 13) Source(101, 13) + SourceIndex(0) +4 >Emitted(65, 16) Source(101, 16) + SourceIndex(0) +5 >Emitted(65, 17) Source(101, 17) + SourceIndex(0) +6 >Emitted(65, 25) Source(101, 25) + SourceIndex(0) +7 >Emitted(65, 26) Source(101, 26) + SourceIndex(0) +8 >Emitted(65, 27) Source(101, 27) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(66, 1) Source(102, 1) + SourceIndex(0) +2 >Emitted(66, 2) Source(102, 2) + SourceIndex(0) +--- +>>>for (var _30 = getRobot(), _31 = _30[0], numberA3 = _31 === void 0 ? -1 : _31, robotAInfo = _30.slice(1), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^ +6 > ^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^^^^^^^^^^^ +13> ^^ +14> ^ +15> ^^^ +16> ^ +17> ^^ +18> ^ +19> ^^^ +20> ^ +21> ^^ +22> ^ +23> ^^ +24> ^^ +25> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > let [numberA3 = -1, ...robotAInfo] = getRobot() +7 > +8 > numberA3 = -1 +9 > +10> numberA3 = -1 +11> , +12> ...robotAInfo +13> ] = getRobot(), +14> i +15> = +16> 0 +17> ; +18> i +19> < +20> 1 +21> ; +22> i +23> ++ +24> ) +25> { +1->Emitted(67, 1) Source(103, 1) + SourceIndex(0) +2 >Emitted(67, 4) Source(103, 4) + SourceIndex(0) +3 >Emitted(67, 5) Source(103, 5) + SourceIndex(0) +4 >Emitted(67, 6) Source(103, 6) + SourceIndex(0) +5 >Emitted(67, 10) Source(103, 6) + SourceIndex(0) +6 >Emitted(67, 26) Source(103, 53) + SourceIndex(0) +7 >Emitted(67, 28) Source(103, 11) + SourceIndex(0) +8 >Emitted(67, 40) Source(103, 24) + SourceIndex(0) +9 >Emitted(67, 42) Source(103, 11) + SourceIndex(0) +10>Emitted(67, 78) Source(103, 24) + SourceIndex(0) +11>Emitted(67, 80) Source(103, 26) + SourceIndex(0) +12>Emitted(67, 105) Source(103, 39) + SourceIndex(0) +13>Emitted(67, 107) Source(103, 55) + SourceIndex(0) +14>Emitted(67, 108) Source(103, 56) + SourceIndex(0) +15>Emitted(67, 111) Source(103, 59) + SourceIndex(0) +16>Emitted(67, 112) Source(103, 60) + SourceIndex(0) +17>Emitted(67, 114) Source(103, 62) + SourceIndex(0) +18>Emitted(67, 115) Source(103, 63) + SourceIndex(0) +19>Emitted(67, 118) Source(103, 66) + SourceIndex(0) +20>Emitted(67, 119) Source(103, 67) + SourceIndex(0) +21>Emitted(67, 121) Source(103, 69) + SourceIndex(0) +22>Emitted(67, 122) Source(103, 70) + SourceIndex(0) +23>Emitted(67, 124) Source(103, 72) + SourceIndex(0) +24>Emitted(67, 126) Source(103, 74) + SourceIndex(0) +25>Emitted(67, 127) Source(103, 75) + SourceIndex(0) +--- +>>> console.log(numberA3); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > numberA3 +7 > ) +8 > ; +1 >Emitted(68, 5) Source(104, 5) + SourceIndex(0) +2 >Emitted(68, 12) Source(104, 12) + SourceIndex(0) +3 >Emitted(68, 13) Source(104, 13) + SourceIndex(0) +4 >Emitted(68, 16) Source(104, 16) + SourceIndex(0) +5 >Emitted(68, 17) Source(104, 17) + SourceIndex(0) +6 >Emitted(68, 25) Source(104, 25) + SourceIndex(0) +7 >Emitted(68, 26) Source(104, 26) + SourceIndex(0) +8 >Emitted(68, 27) Source(104, 27) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(69, 1) Source(105, 1) + SourceIndex(0) +2 >Emitted(69, 2) Source(105, 2) + SourceIndex(0) +--- +>>>for (var _32 = [2, "trimmer", "trimming"], _33 = _32[0], numberA3 = _33 === void 0 ? -1 : _33, robotAInfo = _32.slice(1), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^^^^^^^^^^^ +13> ^^ +14> ^ +15> ^^^ +16> ^ +17> ^^ +18> ^ +19> ^^^ +20> ^ +21> ^^ +22> ^ +23> ^^ +24> ^^ +25> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > let [numberA3 = -1, ...robotAInfo] = [2, "trimmer", "trimming"] +7 > +8 > numberA3 = -1 +9 > +10> numberA3 = -1 +11> , +12> ...robotAInfo +13> ] = [2, "trimmer", "trimming"], +14> i +15> = +16> 0 +17> ; +18> i +19> < +20> 1 +21> ; +22> i +23> ++ +24> ) +25> { +1->Emitted(70, 1) Source(106, 1) + SourceIndex(0) +2 >Emitted(70, 4) Source(106, 4) + SourceIndex(0) +3 >Emitted(70, 5) Source(106, 5) + SourceIndex(0) +4 >Emitted(70, 6) Source(106, 6) + SourceIndex(0) +5 >Emitted(70, 10) Source(106, 6) + SourceIndex(0) +6 >Emitted(70, 42) Source(106, 69) + SourceIndex(0) +7 >Emitted(70, 44) Source(106, 11) + SourceIndex(0) +8 >Emitted(70, 56) Source(106, 24) + SourceIndex(0) +9 >Emitted(70, 58) Source(106, 11) + SourceIndex(0) +10>Emitted(70, 94) Source(106, 24) + SourceIndex(0) +11>Emitted(70, 96) Source(106, 26) + SourceIndex(0) +12>Emitted(70, 121) Source(106, 39) + SourceIndex(0) +13>Emitted(70, 123) Source(106, 71) + SourceIndex(0) +14>Emitted(70, 124) Source(106, 72) + SourceIndex(0) +15>Emitted(70, 127) Source(106, 75) + SourceIndex(0) +16>Emitted(70, 128) Source(106, 76) + SourceIndex(0) +17>Emitted(70, 130) Source(106, 78) + SourceIndex(0) +18>Emitted(70, 131) Source(106, 79) + SourceIndex(0) +19>Emitted(70, 134) Source(106, 82) + SourceIndex(0) +20>Emitted(70, 135) Source(106, 83) + SourceIndex(0) +21>Emitted(70, 137) Source(106, 85) + SourceIndex(0) +22>Emitted(70, 138) Source(106, 86) + SourceIndex(0) +23>Emitted(70, 140) Source(106, 88) + SourceIndex(0) +24>Emitted(70, 142) Source(106, 90) + SourceIndex(0) +25>Emitted(70, 143) Source(106, 91) + SourceIndex(0) +--- +>>> console.log(numberA3); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > numberA3 +7 > ) +8 > ; +1 >Emitted(71, 5) Source(107, 5) + SourceIndex(0) +2 >Emitted(71, 12) Source(107, 12) + SourceIndex(0) +3 >Emitted(71, 13) Source(107, 13) + SourceIndex(0) +4 >Emitted(71, 16) Source(107, 16) + SourceIndex(0) +5 >Emitted(71, 17) Source(107, 17) + SourceIndex(0) +6 >Emitted(71, 25) Source(107, 25) + SourceIndex(0) +7 >Emitted(71, 26) Source(107, 26) + SourceIndex(0) +8 >Emitted(71, 27) Source(107, 27) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(72, 1) Source(108, 1) + SourceIndex(0) +2 >Emitted(72, 2) Source(108, 2) + SourceIndex(0) +--- +>>>//# sourceMappingURL=sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.symbols b/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.symbols new file mode 100644 index 00000000000..523cde331fc --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.symbols @@ -0,0 +1,367 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts === +declare var console: { +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 0, 11)) + + log(msg: any): void; +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 0, 22)) +>msg : Symbol(msg, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 1, 8)) +} +type Robot = [number, string, string]; +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 2, 1)) + +type MultiSkilledRobot = [string, string[]]; +>MultiSkilledRobot : Symbol(MultiSkilledRobot, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 3, 38)) + +let robotA: Robot = [1, "mower", "mowing"]; +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 6, 3)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 2, 1)) + +function getRobot() { +>getRobot : Symbol(getRobot, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 6, 43)) + + return robotA; +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 6, 3)) +} + +let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; +>multiRobotA : Symbol(multiRobotA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 11, 3)) +>MultiSkilledRobot : Symbol(MultiSkilledRobot, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 3, 38)) + +let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; +>multiRobotB : Symbol(multiRobotB, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 12, 3)) +>MultiSkilledRobot : Symbol(MultiSkilledRobot, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 3, 38)) + +function getMultiRobot() { +>getMultiRobot : Symbol(getMultiRobot, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 12, 73)) + + return multiRobotA; +>multiRobotA : Symbol(multiRobotA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 11, 3)) +} + +for (let [, nameA ="name"] = robotA, i = 0; i < 1; i++) { +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 17, 11)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 6, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 17, 36)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 17, 36)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 17, 36)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 17, 11)) +} +for (let [, nameA = "name"] = getRobot(), i = 0; i < 1; i++) { +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 20, 11)) +>getRobot : Symbol(getRobot, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 6, 43)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 20, 41)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 20, 41)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 20, 41)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 20, 11)) +} +for (let [, nameA = "name"] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 23, 11)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 23, 57)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 23, 57)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 23, 57)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 23, 11)) +} +for (let [, [ + primarySkillA = "primary", +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 26, 13)) + + secondarySkillA = "secondary" +>secondarySkillA : Symbol(secondarySkillA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 27, 30)) + +] = ["none", "none"]] = multiRobotA, i = 0; i < 1; i++) { +>multiRobotA : Symbol(multiRobotA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 11, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 29, 36)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 29, 36)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 29, 36)) + + console.log(primarySkillA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 0, 22)) +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 26, 13)) +} +for (let [, [ + primarySkillA = "primary", +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 32, 13)) + + secondarySkillA = "secondary" +>secondarySkillA : Symbol(secondarySkillA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 33, 30)) + +] = ["none", "none"]] = getMultiRobot(), i = 0; i < 1; i++) { +>getMultiRobot : Symbol(getMultiRobot, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 12, 73)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 35, 40)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 35, 40)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 35, 40)) + + console.log(primarySkillA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 0, 22)) +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 32, 13)) +} +for (let [, [ + primarySkillA = "primary", +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 38, 13)) + + secondarySkillA = "secondary" +>secondarySkillA : Symbol(secondarySkillA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 39, 30)) + +] = ["none", "none"]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 41, 60)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 41, 60)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 41, 60)) + + console.log(primarySkillA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 0, 22)) +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 38, 13)) +} + +for (let [numberB = -1] = robotA, i = 0; i < 1; i++) { +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 45, 10)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 6, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 45, 33)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 45, 33)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 45, 33)) + + console.log(numberB); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 0, 22)) +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 45, 10)) +} +for (let [numberB = -1] = getRobot(), i = 0; i < 1; i++) { +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 48, 10)) +>getRobot : Symbol(getRobot, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 6, 43)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 48, 37)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 48, 37)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 48, 37)) + + console.log(numberB); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 0, 22)) +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 48, 10)) +} +for (let [numberB = -1] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 51, 10)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 51, 53)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 51, 53)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 51, 53)) + + console.log(numberB); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 0, 22)) +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 51, 10)) +} +for (let [nameB = "name"] = multiRobotA, i = 0; i < 1; i++) { +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 54, 10)) +>multiRobotA : Symbol(multiRobotA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 11, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 54, 40)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 54, 40)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 54, 40)) + + console.log(nameB); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 0, 22)) +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 54, 10)) +} +for (let [nameB = "name"] = getMultiRobot(), i = 0; i < 1; i++) { +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 57, 10)) +>getMultiRobot : Symbol(getMultiRobot, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 12, 73)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 57, 44)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 57, 44)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 57, 44)) + + console.log(nameB); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 0, 22)) +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 57, 10)) +} +for (let [nameB = "name"] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 60, 10)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 60, 64)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 60, 64)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 60, 64)) + + console.log(nameB); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 0, 22)) +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 60, 10)) +} + +for (let [numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = robotA, i = 0; i < 1; i++) { +>numberA2 : Symbol(numberA2, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 64, 10)) +>nameA2 : Symbol(nameA2, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 64, 24)) +>skillA2 : Symbol(skillA2, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 64, 41)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 6, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 64, 70)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 64, 70)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 64, 70)) + + console.log(nameA2); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 0, 22)) +>nameA2 : Symbol(nameA2, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 64, 24)) +} +for (let [numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = getRobot(), i = 0; i < 1; i++) { +>numberA2 : Symbol(numberA2, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 67, 10)) +>nameA2 : Symbol(nameA2, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 67, 24)) +>skillA2 : Symbol(skillA2, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 67, 41)) +>getRobot : Symbol(getRobot, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 6, 43)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 67, 74)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 67, 74)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 67, 74)) + + console.log(nameA2); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 0, 22)) +>nameA2 : Symbol(nameA2, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 67, 24)) +} +for (let [numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { +>numberA2 : Symbol(numberA2, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 70, 10)) +>nameA2 : Symbol(nameA2, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 70, 24)) +>skillA2 : Symbol(skillA2, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 70, 41)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 70, 90)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 70, 90)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 70, 90)) + + console.log(nameA2); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 0, 22)) +>nameA2 : Symbol(nameA2, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 70, 24)) +} +for (let + [nameMA = "noName", +>nameMA : Symbol(nameMA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 74, 5)) + + [ + primarySkillA = "primary", +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 75, 9)) + + secondarySkillA = "secondary" +>secondarySkillA : Symbol(secondarySkillA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 76, 38)) + + ] = ["none", "none"] + ] = multiRobotA, i = 0; i < 1; i++) { +>multiRobotA : Symbol(multiRobotA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 11, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 79, 20)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 79, 20)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 79, 20)) + + console.log(nameMA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 0, 22)) +>nameMA : Symbol(nameMA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 74, 5)) +} +for (let [nameMA = "noName", +>nameMA : Symbol(nameMA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 82, 10)) + + [ + primarySkillA = "primary", +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 83, 5)) + + secondarySkillA = "secondary" +>secondarySkillA : Symbol(secondarySkillA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 84, 34)) + + ] = ["none", "none"] +] = getMultiRobot(), i = 0; i < 1; i++) { +>getMultiRobot : Symbol(getMultiRobot, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 12, 73)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 87, 21)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 87, 21)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 87, 21)) + + console.log(nameMA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 0, 22)) +>nameMA : Symbol(nameMA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 82, 10)) +} +for (let [nameMA = "noName", +>nameMA : Symbol(nameMA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 90, 10)) + + [ + primarySkillA = "primary", +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 91, 5)) + + secondarySkillA = "secondary" +>secondarySkillA : Symbol(secondarySkillA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 92, 34)) + + ] = ["none", "none"] +] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 95, 41)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 95, 41)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 95, 41)) + + console.log(nameMA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 0, 22)) +>nameMA : Symbol(nameMA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 90, 10)) +} + +for (let [numberA3 = -1, ...robotAInfo] = robotA, i = 0; i < 1; i++) { +>numberA3 : Symbol(numberA3, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 99, 10)) +>robotAInfo : Symbol(robotAInfo, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 99, 24)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 6, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 99, 49)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 99, 49)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 99, 49)) + + console.log(numberA3); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 0, 22)) +>numberA3 : Symbol(numberA3, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 99, 10)) +} +for (let [numberA3 = -1, ...robotAInfo] = getRobot(), i = 0; i < 1; i++) { +>numberA3 : Symbol(numberA3, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 102, 10)) +>robotAInfo : Symbol(robotAInfo, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 102, 24)) +>getRobot : Symbol(getRobot, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 6, 43)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 102, 53)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 102, 53)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 102, 53)) + + console.log(numberA3); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 0, 22)) +>numberA3 : Symbol(numberA3, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 102, 10)) +} +for (let [numberA3 = -1, ...robotAInfo] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { +>numberA3 : Symbol(numberA3, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 105, 10)) +>robotAInfo : Symbol(robotAInfo, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 105, 24)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 105, 69)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 105, 69)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 105, 69)) + + console.log(numberA3); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 0, 22)) +>numberA3 : Symbol(numberA3, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts, 105, 10)) +} diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.types b/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.types new file mode 100644 index 00000000000..245328296eb --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.types @@ -0,0 +1,599 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts === +declare var console: { +>console : { log(msg: any): void; } + + log(msg: any): void; +>log : (msg: any) => void +>msg : any +} +type Robot = [number, string, string]; +>Robot : [number, string, string] + +type MultiSkilledRobot = [string, string[]]; +>MultiSkilledRobot : [string, string[]] + +let robotA: Robot = [1, "mower", "mowing"]; +>robotA : [number, string, string] +>Robot : [number, string, string] +>[1, "mower", "mowing"] : [number, string, string] +>1 : number +>"mower" : string +>"mowing" : string + +function getRobot() { +>getRobot : () => [number, string, string] + + return robotA; +>robotA : [number, string, string] +} + +let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; +>multiRobotA : [string, string[]] +>MultiSkilledRobot : [string, string[]] +>["mower", ["mowing", ""]] : [string, string[]] +>"mower" : string +>["mowing", ""] : string[] +>"mowing" : string +>"" : string + +let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; +>multiRobotB : [string, string[]] +>MultiSkilledRobot : [string, string[]] +>["trimmer", ["trimming", "edging"]] : [string, string[]] +>"trimmer" : string +>["trimming", "edging"] : string[] +>"trimming" : string +>"edging" : string + +function getMultiRobot() { +>getMultiRobot : () => [string, string[]] + + return multiRobotA; +>multiRobotA : [string, string[]] +} + +for (let [, nameA ="name"] = robotA, i = 0; i < 1; i++) { +> : undefined +>nameA : string +>"name" : string +>robotA : [number, string, string] +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for (let [, nameA = "name"] = getRobot(), i = 0; i < 1; i++) { +> : undefined +>nameA : string +>"name" : string +>getRobot() : [number, string, string] +>getRobot : () => [number, string, string] +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for (let [, nameA = "name"] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { +> : undefined +>nameA : string +>"name" : string +>[2, "trimmer", "trimming"] : [number, string, string] +>2 : number +>"trimmer" : string +>"trimming" : string +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for (let [, [ +> : undefined + + primarySkillA = "primary", +>primarySkillA : string +>"primary" : string + + secondarySkillA = "secondary" +>secondarySkillA : string +>"secondary" : string + +] = ["none", "none"]] = multiRobotA, i = 0; i < 1; i++) { +>["none", "none"] : [string, string] +>"none" : string +>"none" : string +>multiRobotA : [string, string[]] +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(primarySkillA); +>console.log(primarySkillA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primarySkillA : string +} +for (let [, [ +> : undefined + + primarySkillA = "primary", +>primarySkillA : string +>"primary" : string + + secondarySkillA = "secondary" +>secondarySkillA : string +>"secondary" : string + +] = ["none", "none"]] = getMultiRobot(), i = 0; i < 1; i++) { +>["none", "none"] : [string, string] +>"none" : string +>"none" : string +>getMultiRobot() : [string, string[]] +>getMultiRobot : () => [string, string[]] +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(primarySkillA); +>console.log(primarySkillA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primarySkillA : string +} +for (let [, [ +> : undefined + + primarySkillA = "primary", +>primarySkillA : string +>"primary" : string + + secondarySkillA = "secondary" +>secondarySkillA : string +>"secondary" : string + +] = ["none", "none"]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { +>["none", "none"] : [string, string] +>"none" : string +>"none" : string +>["trimmer", ["trimming", "edging"]] : [string, [string, string]] +>"trimmer" : string +>["trimming", "edging"] : [string, string] +>"trimming" : string +>"edging" : string +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(primarySkillA); +>console.log(primarySkillA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primarySkillA : string +} + +for (let [numberB = -1] = robotA, i = 0; i < 1; i++) { +>numberB : number +>-1 : number +>1 : number +>robotA : [number, string, string] +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(numberB); +>console.log(numberB) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>numberB : number +} +for (let [numberB = -1] = getRobot(), i = 0; i < 1; i++) { +>numberB : number +>-1 : number +>1 : number +>getRobot() : [number, string, string] +>getRobot : () => [number, string, string] +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(numberB); +>console.log(numberB) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>numberB : number +} +for (let [numberB = -1] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { +>numberB : number +>-1 : number +>1 : number +>[2, "trimmer", "trimming"] : [number, string, string] +>2 : number +>"trimmer" : string +>"trimming" : string +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(numberB); +>console.log(numberB) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>numberB : number +} +for (let [nameB = "name"] = multiRobotA, i = 0; i < 1; i++) { +>nameB : string +>"name" : string +>multiRobotA : [string, string[]] +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameB); +>console.log(nameB) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameB : string +} +for (let [nameB = "name"] = getMultiRobot(), i = 0; i < 1; i++) { +>nameB : string +>"name" : string +>getMultiRobot() : [string, string[]] +>getMultiRobot : () => [string, string[]] +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameB); +>console.log(nameB) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameB : string +} +for (let [nameB = "name"] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { +>nameB : string +>"name" : string +>["trimmer", ["trimming", "edging"]] : [string, string[]] +>"trimmer" : string +>["trimming", "edging"] : string[] +>"trimming" : string +>"edging" : string +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameB); +>console.log(nameB) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameB : string +} + +for (let [numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = robotA, i = 0; i < 1; i++) { +>numberA2 : number +>-1 : number +>1 : number +>nameA2 : string +>"name" : string +>skillA2 : string +>"skill" : string +>robotA : [number, string, string] +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameA2); +>console.log(nameA2) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA2 : string +} +for (let [numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = getRobot(), i = 0; i < 1; i++) { +>numberA2 : number +>-1 : number +>1 : number +>nameA2 : string +>"name" : string +>skillA2 : string +>"skill" : string +>getRobot() : [number, string, string] +>getRobot : () => [number, string, string] +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameA2); +>console.log(nameA2) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA2 : string +} +for (let [numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { +>numberA2 : number +>-1 : number +>1 : number +>nameA2 : string +>"name" : string +>skillA2 : string +>"skill" : string +>[2, "trimmer", "trimming"] : [number, string, string] +>2 : number +>"trimmer" : string +>"trimming" : string +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameA2); +>console.log(nameA2) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA2 : string +} +for (let + [nameMA = "noName", +>nameMA : string +>"noName" : string + + [ + primarySkillA = "primary", +>primarySkillA : string +>"primary" : string + + secondarySkillA = "secondary" +>secondarySkillA : string +>"secondary" : string + + ] = ["none", "none"] +>["none", "none"] : [string, string] +>"none" : string +>"none" : string + + ] = multiRobotA, i = 0; i < 1; i++) { +>multiRobotA : [string, string[]] +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameMA); +>console.log(nameMA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameMA : string +} +for (let [nameMA = "noName", +>nameMA : string +>"noName" : string + + [ + primarySkillA = "primary", +>primarySkillA : string +>"primary" : string + + secondarySkillA = "secondary" +>secondarySkillA : string +>"secondary" : string + + ] = ["none", "none"] +>["none", "none"] : [string, string] +>"none" : string +>"none" : string + +] = getMultiRobot(), i = 0; i < 1; i++) { +>getMultiRobot() : [string, string[]] +>getMultiRobot : () => [string, string[]] +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameMA); +>console.log(nameMA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameMA : string +} +for (let [nameMA = "noName", +>nameMA : string +>"noName" : string + + [ + primarySkillA = "primary", +>primarySkillA : string +>"primary" : string + + secondarySkillA = "secondary" +>secondarySkillA : string +>"secondary" : string + + ] = ["none", "none"] +>["none", "none"] : [string, string] +>"none" : string +>"none" : string + +] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { +>["trimmer", ["trimming", "edging"]] : [string, [string, string]] +>"trimmer" : string +>["trimming", "edging"] : [string, string] +>"trimming" : string +>"edging" : string +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameMA); +>console.log(nameMA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameMA : string +} + +for (let [numberA3 = -1, ...robotAInfo] = robotA, i = 0; i < 1; i++) { +>numberA3 : number +>-1 : number +>1 : number +>robotAInfo : (number | string)[] +>robotA : [number, string, string] +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(numberA3); +>console.log(numberA3) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>numberA3 : number +} +for (let [numberA3 = -1, ...robotAInfo] = getRobot(), i = 0; i < 1; i++) { +>numberA3 : number +>-1 : number +>1 : number +>robotAInfo : (number | string)[] +>getRobot() : [number, string, string] +>getRobot : () => [number, string, string] +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(numberA3); +>console.log(numberA3) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>numberA3 : number +} +for (let [numberA3 = -1, ...robotAInfo] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { +>numberA3 : number | string +>-1 : number +>1 : number +>robotAInfo : (number | string)[] +>[2, "trimmer", "trimming"] : (number | string)[] +>2 : number +>"trimmer" : string +>"trimming" : string +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(numberA3); +>console.log(numberA3) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>numberA3 : number | string +} diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.js b/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.js new file mode 100644 index 00000000000..fb2fa4f81f8 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.js @@ -0,0 +1,196 @@ +//// [sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts] +declare var console: { + log(msg: any): void; +} +type Robot = [number, string, string]; +type MultiSkilledRobot = [string, [string, string]]; + +let robotA: Robot = [1, "mower", "mowing"]; +function getRobot() { + return robotA; +} + +let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; +let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; +function getMultiRobot() { + return multiRobotA; +} + +let nameA: string, primarySkillA: string, secondarySkillA: string; +let numberB: number, nameB: string; +let numberA2: number, nameA2: string, skillA2: string, nameMA: string; +let numberA3: number, robotAInfo: (number | string)[], multiRobotAInfo: (string | [string, string])[]; +let i: number; + +for ([, nameA = "name"] = robotA, i = 0; i < 1; i++) { + console.log(nameA); +} +for ([, nameA = "name"] = getRobot(), i = 0; i < 1; i++) { + console.log(nameA); +} +for ([, nameA = "name"] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + console.log(nameA); +} +for ([, [ + primarySkillA = "primary", + secondarySkillA = "secondary" +] = ["none", "none"]] = multiRobotA, i = 0; i < 1; i++) { + console.log(primarySkillA); +} +for ([, [ + primarySkillA = "primary", + secondarySkillA = "secondary" +] = ["none", "none"]] = getMultiRobot(), i = 0; i < 1; i++) { + console.log(primarySkillA); +} +for ([, [ + primarySkillA = "primary", + secondarySkillA = "secondary" +] = ["none", "none"]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + console.log(primarySkillA); +} + +for ([numberB = -1] = robotA, i = 0; i < 1; i++) { + console.log(numberB); +} +for ([numberB = -1] = getRobot(), i = 0; i < 1; i++) { + console.log(numberB); +} +for ([numberB = -1] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + console.log(numberB); +} +for ([nameB = "name"] = multiRobotA, i = 0; i < 1; i++) { + console.log(nameB); +} +for ([nameB = "name"] = getMultiRobot(), i = 0; i < 1; i++) { + console.log(nameB); +} +for ([nameB = "name"] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + console.log(nameB); +} + +for ([numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = robotA, i = 0; i < 1; i++) { + console.log(nameA2); +} +for ([numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = getRobot(), i = 0; i < 1; i++) { + console.log(nameA2); +} +for ([numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + console.log(nameA2); +} +for (let + [nameMA = "noName", + [ + primarySkillA = "primary", + secondarySkillA = "secondary" + ] = ["none", "none"] + ] = multiRobotA, i = 0; i < 1; i++) { + console.log(nameMA); +} +for ([nameMA = "noName", + [ + primarySkillA = "primary", + secondarySkillA = "secondary" + ] = ["none", "none"] +] = getMultiRobot(), i = 0; i < 1; i++) { + console.log(nameMA); +} +for ([nameMA = "noName", + [ + primarySkillA = "primary", + secondarySkillA = "secondary" + ] = ["none", "none"] +] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + console.log(nameMA); +} + +for ([numberA3 = -1, ...robotAInfo] = robotA, i = 0; i < 1; i++) { + console.log(numberA3); +} +for ([numberA3 = -1, ...robotAInfo] = getRobot(), i = 0; i < 1; i++) { + console.log(numberA3); +} +for ([numberA3 = -1, ...robotAInfo] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + console.log(numberA3); +} + +//// [sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.js] +var robotA = [1, "mower", "mowing"]; +function getRobot() { + return robotA; +} +var multiRobotA = ["mower", ["mowing", ""]]; +var multiRobotB = ["trimmer", ["trimming", "edging"]]; +function getMultiRobot() { + return multiRobotA; +} +var nameA, primarySkillA, secondarySkillA; +var numberB, nameB; +var numberA2, nameA2, skillA2, nameMA; +var numberA3, robotAInfo, multiRobotAInfo; +var i; +for ((_a = robotA[1], nameA = _a === void 0 ? "name" : _a, robotA), i = 0; i < 1; i++) { + console.log(nameA); +} +for ((_b = getRobot(), _c = _b[1], nameA = _c === void 0 ? "name" : _c, _b), i = 0; i < 1; i++) { + console.log(nameA); +} +for ((_d = [2, "trimmer", "trimming"], _e = _d[1], nameA = _e === void 0 ? "name" : _e, _d), i = 0; i < 1; i++) { + console.log(nameA); +} +for ((_f = multiRobotA[1], _g = _f === void 0 ? ["none", "none"] : _f, _h = _g[0], primarySkillA = _h === void 0 ? "primary" : _h, _j = _g[1], secondarySkillA = _j === void 0 ? "secondary" : _j, multiRobotA), i = 0; i < 1; i++) { + console.log(primarySkillA); +} +for ((_k = getMultiRobot(), _l = _k[1], _m = _l === void 0 ? ["none", "none"] : _l, _o = _m[0], primarySkillA = _o === void 0 ? "primary" : _o, _p = _m[1], secondarySkillA = _p === void 0 ? "secondary" : _p, _k), i = 0; i < 1; i++) { + console.log(primarySkillA); +} +for ((_q = ["trimmer", ["trimming", "edging"]], _r = _q[1], _s = _r === void 0 ? ["none", "none"] : _r, _t = _s[0], primarySkillA = _t === void 0 ? "primary" : _t, _u = _s[1], secondarySkillA = _u === void 0 ? "secondary" : _u, _q), i = 0; i < 1; i++) { + console.log(primarySkillA); +} +for ((_v = robotA[0], numberB = _v === void 0 ? -1 : _v, robotA), i = 0; i < 1; i++) { + console.log(numberB); +} +for ((_w = getRobot(), _x = _w[0], numberB = _x === void 0 ? -1 : _x, _w), i = 0; i < 1; i++) { + console.log(numberB); +} +for ((_y = [2, "trimmer", "trimming"], _z = _y[0], numberB = _z === void 0 ? -1 : _z, _y), i = 0; i < 1; i++) { + console.log(numberB); +} +for ((_0 = multiRobotA[0], nameB = _0 === void 0 ? "name" : _0, multiRobotA), i = 0; i < 1; i++) { + console.log(nameB); +} +for ((_1 = getMultiRobot(), _2 = _1[0], nameB = _2 === void 0 ? "name" : _2, _1), i = 0; i < 1; i++) { + console.log(nameB); +} +for ((_3 = ["trimmer", ["trimming", "edging"]], _4 = _3[0], nameB = _4 === void 0 ? "name" : _4, _3), i = 0; i < 1; i++) { + console.log(nameB); +} +for ((_5 = robotA[0], numberA2 = _5 === void 0 ? -1 : _5, _6 = robotA[1], nameA2 = _6 === void 0 ? "name" : _6, _7 = robotA[2], skillA2 = _7 === void 0 ? "skill" : _7, robotA), i = 0; i < 1; i++) { + console.log(nameA2); +} +for ((_8 = getRobot(), _9 = _8[0], numberA2 = _9 === void 0 ? -1 : _9, _10 = _8[1], nameA2 = _10 === void 0 ? "name" : _10, _11 = _8[2], skillA2 = _11 === void 0 ? "skill" : _11, _8), i = 0; i < 1; i++) { + console.log(nameA2); +} +for ((_12 = [2, "trimmer", "trimming"], _13 = _12[0], numberA2 = _13 === void 0 ? -1 : _13, _14 = _12[1], nameA2 = _14 === void 0 ? "name" : _14, _15 = _12[2], skillA2 = _15 === void 0 ? "skill" : _15, _12), i = 0; i < 1; i++) { + console.log(nameA2); +} +for (var _16 = multiRobotA[0], nameMA_1 = _16 === void 0 ? "noName" : _16, _17 = multiRobotA[1], _18 = _17 === void 0 ? ["none", "none"] : _17, _19 = _18[0], primarySkillA_1 = _19 === void 0 ? "primary" : _19, _20 = _18[1], secondarySkillA_1 = _20 === void 0 ? "secondary" : _20, i_1 = 0; i_1 < 1; i_1++) { + console.log(nameMA_1); +} +for ((_21 = getMultiRobot(), _22 = _21[0], nameMA = _22 === void 0 ? "noName" : _22, _23 = _21[1], _24 = _23 === void 0 ? ["none", "none"] : _23, _25 = _24[0], primarySkillA = _25 === void 0 ? "primary" : _25, _26 = _24[1], secondarySkillA = _26 === void 0 ? "secondary" : _26, _21), i = 0; i < 1; i++) { + console.log(nameMA); +} +for ((_27 = ["trimmer", ["trimming", "edging"]], _28 = _27[0], nameMA = _28 === void 0 ? "noName" : _28, _29 = _27[1], _30 = _29 === void 0 ? ["none", "none"] : _29, _31 = _30[0], primarySkillA = _31 === void 0 ? "primary" : _31, _32 = _30[1], secondarySkillA = _32 === void 0 ? "secondary" : _32, _27), i = 0; i < 1; i++) { + console.log(nameMA); +} +for ((_33 = robotA[0], numberA3 = _33 === void 0 ? -1 : _33, robotAInfo = robotA.slice(1), robotA), i = 0; i < 1; i++) { + console.log(numberA3); +} +for ((_34 = getRobot(), _35 = _34[0], numberA3 = _35 === void 0 ? -1 : _35, robotAInfo = _34.slice(1), _34), i = 0; i < 1; i++) { + console.log(numberA3); +} +for ((_36 = [2, "trimmer", "trimming"], _37 = _36[0], numberA3 = _37 === void 0 ? -1 : _37, robotAInfo = _36.slice(1), _36), i = 0; i < 1; i++) { + console.log(numberA3); +} +var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37; +//# sourceMappingURL=sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.js.map b/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.js.map new file mode 100644 index 00000000000..6446d14319e --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.js.map @@ -0,0 +1,2 @@ +//// [sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.js.map] +{"version":3,"file":"sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.js","sourceRoot":"","sources":["sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts"],"names":[],"mappings":"AAMA,IAAI,MAAM,GAAU,CAAC,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;AAC3C;IACI,MAAM,CAAC,MAAM,CAAC;AAClB,CAAC;AAED,IAAI,WAAW,GAAsB,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC;AAC/D,IAAI,WAAW,GAAsB,CAAC,SAAS,EAAE,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC,CAAC;AACzE;IACI,MAAM,CAAC,WAAW,CAAC;AACvB,CAAC;AAED,IAAI,KAAa,EAAE,aAAqB,EAAE,eAAuB,CAAC;AAClE,IAAI,OAAe,EAAE,KAAa,CAAC;AACnC,IAAI,QAAgB,EAAE,MAAc,EAAE,OAAe,EAAE,MAAc,CAAC;AACtE,IAAI,QAAgB,EAAE,UAA+B,EAAE,eAA8C,CAAC;AACtG,IAAI,CAAS,CAAC;AAEd,GAAG,CAAC,CAAC,CAAG,cAAc,EAAd,mCAAc,EAAI,MAAM,CAAA,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IAClD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AACD,GAAG,CAAC,CAAC,CAAA,eAA+B,EAA5B,UAAc,EAAd,mCAAc,KAAc,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACtD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AACD,GAAG,CAAC,CAAC,CAAA,+BAA+C,EAA5C,UAAc,EAAd,mCAAc,KAA8B,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACtE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AACD,GAAG,CAAC,CAAC,CAAG,mBAGY,EAHZ,0CAGY,EAFhB,UAAyB,EAAzB,8CAAyB,EACzB,UAA6B,EAA7B,kDAA6B,EACT,WAAW,CAAA,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACrD,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;AAC/B,CAAC;AACD,GAAG,CAAC,CAAC,CAAA,oBAGkC,EAH/B,UAGY,EAHZ,0CAGY,EAFhB,UAAyB,EAAzB,8CAAyB,EACzB,UAA6B,EAA7B,kDAA6B,KACM,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACzD,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;AAC/B,CAAC;AACD,GAAG,CAAC,CAAC,CAAA,wCAGsD,EAHnD,UAGY,EAHZ,0CAGY,EAFhB,UAAyB,EAAzB,8CAAyB,EACzB,UAA6B,EAA7B,kDAA6B,KAC0B,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IAC7E,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;AAC/B,CAAC;AAED,GAAG,CAAC,CAAC,CAAC,cAAY,EAAZ,iCAAY,EAAI,MAAM,CAAA,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IAC9C,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AACzB,CAAC;AACD,GAAG,CAAC,CAAC,CAAA,eAA2B,EAA1B,UAAY,EAAZ,iCAAY,KAAc,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IAClD,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AACzB,CAAC;AACD,GAAG,CAAC,CAAC,CAAA,+BAA2C,EAA1C,UAAY,EAAZ,iCAAY,KAA8B,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IAClE,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AACzB,CAAC;AACD,GAAG,CAAC,CAAC,CAAC,mBAAc,EAAd,mCAAc,EAAI,WAAW,CAAA,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACrD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AACD,GAAG,CAAC,CAAC,CAAA,oBAAkC,EAAjC,UAAc,EAAd,mCAAc,KAAmB,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACzD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AACD,GAAG,CAAC,CAAC,CAAA,wCAAsD,EAArD,UAAc,EAAd,mCAAc,KAAuC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IAC7E,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AAED,GAAG,CAAC,CAAC,CAAC,cAAa,EAAb,kCAAa,EAAE,cAAe,EAAf,oCAAe,EAAE,cAAiB,EAAjB,sCAAiB,EAAI,MAAM,CAAA,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACnF,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACxB,CAAC;AACD,GAAG,CAAC,CAAC,CAAA,eAAgE,EAA/D,UAAa,EAAb,kCAAa,EAAE,WAAe,EAAf,sCAAe,EAAE,WAAiB,EAAjB,wCAAiB,KAAc,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACvF,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACxB,CAAC;AACD,GAAG,CAAC,CAAC,CAAA,gCAAgF,EAA/E,YAAa,EAAb,oCAAa,EAAE,YAAe,EAAf,sCAAe,EAAE,YAAiB,EAAjB,wCAAiB,MAA8B,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACvG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACxB,CAAC;AACD,GAAG,CAAC,CACC,wBAAiB,EAAjB,0CAAiB,EACd,oBAGoB,EAHpB,6CAGoB,EAFhB,YAAyB,EAAzB,kDAAyB,EACzB,YAA6B,EAA7B,sDAA6B,EAEpB,GAAC,GAAG,CAAC,EAAE,GAAC,GAAG,CAAC,EAAE,GAAC,EAAE,EAAE,CAAC;IACrC,OAAO,CAAC,GAAG,CAAC,QAAM,CAAC,CAAC;AACxB,CAAC;AACD,GAAG,CAAC,CAAC,CAAA,qBAKc,EALb,YAAiB,EAAjB,wCAAiB,EACnB,YAGoB,EAHpB,6CAGoB,EAFhB,YAAyB,EAAzB,gDAAyB,EACzB,YAA6B,EAA7B,oDAA6B,MAElB,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACrC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACxB,CAAC;AACD,GAAG,CAAC,CAAC,CAAA,yCAKkC,EALjC,YAAiB,EAAjB,wCAAiB,EACnB,YAGoB,EAHpB,6CAGoB,EAFhB,YAAyB,EAAzB,gDAAyB,EACzB,YAA6B,EAA7B,oDAA6B,MAEE,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACzD,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACxB,CAAC;AAED,GAAG,CAAC,CAAC,CAAC,eAAa,EAAb,oCAAa,EAAE,4BAAa,EAAI,MAAM,CAAA,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IAC9D,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAC1B,CAAC;AACD,GAAG,CAAC,CAAC,CAAA,gBAA2C,EAA1C,YAAa,EAAb,oCAAa,EAAE,yBAAa,MAAc,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IAClE,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAC1B,CAAC;AACD,GAAG,CAAC,CAAC,CAAA,gCAAkE,EAAjE,YAAa,EAAb,oCAAa,EAAE,yBAAa,MAAqC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACzF,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAC1B,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.sourcemap.txt b/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.sourcemap.txt new file mode 100644 index 00000000000..bab5f369194 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.sourcemap.txt @@ -0,0 +1,3030 @@ +=================================================================== +JsFile: sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.js +mapUrl: sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.js.map +sourceRoot: +sources: sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.js +sourceFile:sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts +------------------------------------------------------------------- +>>>var robotA = [1, "mower", "mowing"]; +1 > +2 >^^^^ +3 > ^^^^^^ +4 > ^^^ +5 > ^ +6 > ^ +7 > ^^ +8 > ^^^^^^^ +9 > ^^ +10> ^^^^^^^^ +11> ^ +12> ^ +1 >declare var console: { + > log(msg: any): void; + >} + >type Robot = [number, string, string]; + >type MultiSkilledRobot = [string, [string, string]]; + > + > +2 >let +3 > robotA +4 > : Robot = +5 > [ +6 > 1 +7 > , +8 > "mower" +9 > , +10> "mowing" +11> ] +12> ; +1 >Emitted(1, 1) Source(7, 1) + SourceIndex(0) +2 >Emitted(1, 5) Source(7, 5) + SourceIndex(0) +3 >Emitted(1, 11) Source(7, 11) + SourceIndex(0) +4 >Emitted(1, 14) Source(7, 21) + SourceIndex(0) +5 >Emitted(1, 15) Source(7, 22) + SourceIndex(0) +6 >Emitted(1, 16) Source(7, 23) + SourceIndex(0) +7 >Emitted(1, 18) Source(7, 25) + SourceIndex(0) +8 >Emitted(1, 25) Source(7, 32) + SourceIndex(0) +9 >Emitted(1, 27) Source(7, 34) + SourceIndex(0) +10>Emitted(1, 35) Source(7, 42) + SourceIndex(0) +11>Emitted(1, 36) Source(7, 43) + SourceIndex(0) +12>Emitted(1, 37) Source(7, 44) + SourceIndex(0) +--- +>>>function getRobot() { +1 > +2 >^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(2, 1) Source(8, 1) + SourceIndex(0) +--- +>>> return robotA; +1->^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^ +5 > ^ +1->function getRobot() { + > +2 > return +3 > +4 > robotA +5 > ; +1->Emitted(3, 5) Source(9, 5) + SourceIndex(0) +2 >Emitted(3, 11) Source(9, 11) + SourceIndex(0) +3 >Emitted(3, 12) Source(9, 12) + SourceIndex(0) +4 >Emitted(3, 18) Source(9, 18) + SourceIndex(0) +5 >Emitted(3, 19) Source(9, 19) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(4, 1) Source(10, 1) + SourceIndex(0) +2 >Emitted(4, 2) Source(10, 2) + SourceIndex(0) +--- +>>>var multiRobotA = ["mower", ["mowing", ""]]; +1-> +2 >^^^^ +3 > ^^^^^^^^^^^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^ +7 > ^^ +8 > ^ +9 > ^^^^^^^^ +10> ^^ +11> ^^ +12> ^ +13> ^ +14> ^ +15> ^^^^^^^^^^^-> +1-> + > + > +2 >let +3 > multiRobotA +4 > : MultiSkilledRobot = +5 > [ +6 > "mower" +7 > , +8 > [ +9 > "mowing" +10> , +11> "" +12> ] +13> ] +14> ; +1->Emitted(5, 1) Source(12, 1) + SourceIndex(0) +2 >Emitted(5, 5) Source(12, 5) + SourceIndex(0) +3 >Emitted(5, 16) Source(12, 16) + SourceIndex(0) +4 >Emitted(5, 19) Source(12, 38) + SourceIndex(0) +5 >Emitted(5, 20) Source(12, 39) + SourceIndex(0) +6 >Emitted(5, 27) Source(12, 46) + SourceIndex(0) +7 >Emitted(5, 29) Source(12, 48) + SourceIndex(0) +8 >Emitted(5, 30) Source(12, 49) + SourceIndex(0) +9 >Emitted(5, 38) Source(12, 57) + SourceIndex(0) +10>Emitted(5, 40) Source(12, 59) + SourceIndex(0) +11>Emitted(5, 42) Source(12, 61) + SourceIndex(0) +12>Emitted(5, 43) Source(12, 62) + SourceIndex(0) +13>Emitted(5, 44) Source(12, 63) + SourceIndex(0) +14>Emitted(5, 45) Source(12, 64) + SourceIndex(0) +--- +>>>var multiRobotB = ["trimmer", ["trimming", "edging"]]; +1-> +2 >^^^^ +3 > ^^^^^^^^^^^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^^ +7 > ^^ +8 > ^ +9 > ^^^^^^^^^^ +10> ^^ +11> ^^^^^^^^ +12> ^ +13> ^ +14> ^ +1-> + > +2 >let +3 > multiRobotB +4 > : MultiSkilledRobot = +5 > [ +6 > "trimmer" +7 > , +8 > [ +9 > "trimming" +10> , +11> "edging" +12> ] +13> ] +14> ; +1->Emitted(6, 1) Source(13, 1) + SourceIndex(0) +2 >Emitted(6, 5) Source(13, 5) + SourceIndex(0) +3 >Emitted(6, 16) Source(13, 16) + SourceIndex(0) +4 >Emitted(6, 19) Source(13, 38) + SourceIndex(0) +5 >Emitted(6, 20) Source(13, 39) + SourceIndex(0) +6 >Emitted(6, 29) Source(13, 48) + SourceIndex(0) +7 >Emitted(6, 31) Source(13, 50) + SourceIndex(0) +8 >Emitted(6, 32) Source(13, 51) + SourceIndex(0) +9 >Emitted(6, 42) Source(13, 61) + SourceIndex(0) +10>Emitted(6, 44) Source(13, 63) + SourceIndex(0) +11>Emitted(6, 52) Source(13, 71) + SourceIndex(0) +12>Emitted(6, 53) Source(13, 72) + SourceIndex(0) +13>Emitted(6, 54) Source(13, 73) + SourceIndex(0) +14>Emitted(6, 55) Source(13, 74) + SourceIndex(0) +--- +>>>function getMultiRobot() { +1 > +2 >^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(7, 1) Source(14, 1) + SourceIndex(0) +--- +>>> return multiRobotA; +1->^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^ +5 > ^ +1->function getMultiRobot() { + > +2 > return +3 > +4 > multiRobotA +5 > ; +1->Emitted(8, 5) Source(15, 5) + SourceIndex(0) +2 >Emitted(8, 11) Source(15, 11) + SourceIndex(0) +3 >Emitted(8, 12) Source(15, 12) + SourceIndex(0) +4 >Emitted(8, 23) Source(15, 23) + SourceIndex(0) +5 >Emitted(8, 24) Source(15, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(9, 1) Source(16, 1) + SourceIndex(0) +2 >Emitted(9, 2) Source(16, 2) + SourceIndex(0) +--- +>>>var nameA, primarySkillA, secondarySkillA; +1-> +2 >^^^^ +3 > ^^^^^ +4 > ^^ +5 > ^^^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^ +8 > ^ +1-> + > + > +2 >let +3 > nameA: string +4 > , +5 > primarySkillA: string +6 > , +7 > secondarySkillA: string +8 > ; +1->Emitted(10, 1) Source(18, 1) + SourceIndex(0) +2 >Emitted(10, 5) Source(18, 5) + SourceIndex(0) +3 >Emitted(10, 10) Source(18, 18) + SourceIndex(0) +4 >Emitted(10, 12) Source(18, 20) + SourceIndex(0) +5 >Emitted(10, 25) Source(18, 41) + SourceIndex(0) +6 >Emitted(10, 27) Source(18, 43) + SourceIndex(0) +7 >Emitted(10, 42) Source(18, 66) + SourceIndex(0) +8 >Emitted(10, 43) Source(18, 67) + SourceIndex(0) +--- +>>>var numberB, nameB; +1 > +2 >^^^^ +3 > ^^^^^^^ +4 > ^^ +5 > ^^^^^ +6 > ^ +7 > ^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >let +3 > numberB: number +4 > , +5 > nameB: string +6 > ; +1 >Emitted(11, 1) Source(19, 1) + SourceIndex(0) +2 >Emitted(11, 5) Source(19, 5) + SourceIndex(0) +3 >Emitted(11, 12) Source(19, 20) + SourceIndex(0) +4 >Emitted(11, 14) Source(19, 22) + SourceIndex(0) +5 >Emitted(11, 19) Source(19, 35) + SourceIndex(0) +6 >Emitted(11, 20) Source(19, 36) + SourceIndex(0) +--- +>>>var numberA2, nameA2, skillA2, nameMA; +1-> +2 >^^^^ +3 > ^^^^^^^^ +4 > ^^ +5 > ^^^^^^ +6 > ^^ +7 > ^^^^^^^ +8 > ^^ +9 > ^^^^^^ +10> ^ +11> ^^^^^-> +1-> + > +2 >let +3 > numberA2: number +4 > , +5 > nameA2: string +6 > , +7 > skillA2: string +8 > , +9 > nameMA: string +10> ; +1->Emitted(12, 1) Source(20, 1) + SourceIndex(0) +2 >Emitted(12, 5) Source(20, 5) + SourceIndex(0) +3 >Emitted(12, 13) Source(20, 21) + SourceIndex(0) +4 >Emitted(12, 15) Source(20, 23) + SourceIndex(0) +5 >Emitted(12, 21) Source(20, 37) + SourceIndex(0) +6 >Emitted(12, 23) Source(20, 39) + SourceIndex(0) +7 >Emitted(12, 30) Source(20, 54) + SourceIndex(0) +8 >Emitted(12, 32) Source(20, 56) + SourceIndex(0) +9 >Emitted(12, 38) Source(20, 70) + SourceIndex(0) +10>Emitted(12, 39) Source(20, 71) + SourceIndex(0) +--- +>>>var numberA3, robotAInfo, multiRobotAInfo; +1-> +2 >^^^^ +3 > ^^^^^^^^ +4 > ^^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^ +8 > ^ +1-> + > +2 >let +3 > numberA3: number +4 > , +5 > robotAInfo: (number | string)[] +6 > , +7 > multiRobotAInfo: (string | [string, string])[] +8 > ; +1->Emitted(13, 1) Source(21, 1) + SourceIndex(0) +2 >Emitted(13, 5) Source(21, 5) + SourceIndex(0) +3 >Emitted(13, 13) Source(21, 21) + SourceIndex(0) +4 >Emitted(13, 15) Source(21, 23) + SourceIndex(0) +5 >Emitted(13, 25) Source(21, 54) + SourceIndex(0) +6 >Emitted(13, 27) Source(21, 56) + SourceIndex(0) +7 >Emitted(13, 42) Source(21, 102) + SourceIndex(0) +8 >Emitted(13, 43) Source(21, 103) + SourceIndex(0) +--- +>>>var i; +1 > +2 >^^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >let +3 > i: number +4 > ; +1 >Emitted(14, 1) Source(22, 1) + SourceIndex(0) +2 >Emitted(14, 5) Source(22, 5) + SourceIndex(0) +3 >Emitted(14, 6) Source(22, 14) + SourceIndex(0) +4 >Emitted(14, 7) Source(22, 15) + SourceIndex(0) +--- +>>>for ((_a = robotA[1], nameA = _a === void 0 ? "name" : _a, robotA), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^ +11> ^ +12> ^^ +13> ^ +14> ^^^ +15> ^ +16> ^^ +17> ^ +18> ^^^ +19> ^ +20> ^^ +21> ^ +22> ^^ +23> ^^ +24> ^ +1-> + > + > +2 >for +3 > +4 > ( +5 > [, +6 > nameA = "name" +7 > +8 > nameA = "name" +9 > ] = +10> robotA +11> +12> , +13> i +14> = +15> 0 +16> ; +17> i +18> < +19> 1 +20> ; +21> i +22> ++ +23> ) +24> { +1->Emitted(15, 1) Source(24, 1) + SourceIndex(0) +2 >Emitted(15, 4) Source(24, 4) + SourceIndex(0) +3 >Emitted(15, 5) Source(24, 5) + SourceIndex(0) +4 >Emitted(15, 6) Source(24, 6) + SourceIndex(0) +5 >Emitted(15, 7) Source(24, 9) + SourceIndex(0) +6 >Emitted(15, 21) Source(24, 23) + SourceIndex(0) +7 >Emitted(15, 23) Source(24, 9) + SourceIndex(0) +8 >Emitted(15, 58) Source(24, 23) + SourceIndex(0) +9 >Emitted(15, 60) Source(24, 27) + SourceIndex(0) +10>Emitted(15, 66) Source(24, 33) + SourceIndex(0) +11>Emitted(15, 67) Source(24, 33) + SourceIndex(0) +12>Emitted(15, 69) Source(24, 35) + SourceIndex(0) +13>Emitted(15, 70) Source(24, 36) + SourceIndex(0) +14>Emitted(15, 73) Source(24, 39) + SourceIndex(0) +15>Emitted(15, 74) Source(24, 40) + SourceIndex(0) +16>Emitted(15, 76) Source(24, 42) + SourceIndex(0) +17>Emitted(15, 77) Source(24, 43) + SourceIndex(0) +18>Emitted(15, 80) Source(24, 46) + SourceIndex(0) +19>Emitted(15, 81) Source(24, 47) + SourceIndex(0) +20>Emitted(15, 83) Source(24, 49) + SourceIndex(0) +21>Emitted(15, 84) Source(24, 50) + SourceIndex(0) +22>Emitted(15, 86) Source(24, 52) + SourceIndex(0) +23>Emitted(15, 88) Source(24, 54) + SourceIndex(0) +24>Emitted(15, 89) Source(24, 55) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(16, 5) Source(25, 5) + SourceIndex(0) +2 >Emitted(16, 12) Source(25, 12) + SourceIndex(0) +3 >Emitted(16, 13) Source(25, 13) + SourceIndex(0) +4 >Emitted(16, 16) Source(25, 16) + SourceIndex(0) +5 >Emitted(16, 17) Source(25, 17) + SourceIndex(0) +6 >Emitted(16, 22) Source(25, 22) + SourceIndex(0) +7 >Emitted(16, 23) Source(25, 23) + SourceIndex(0) +8 >Emitted(16, 24) Source(25, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(17, 1) Source(26, 1) + SourceIndex(0) +2 >Emitted(17, 2) Source(26, 2) + SourceIndex(0) +--- +>>>for ((_b = getRobot(), _c = _b[1], nameA = _c === void 0 ? "name" : _c, _b), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^^^^ +12> ^^ +13> ^ +14> ^^^ +15> ^ +16> ^^ +17> ^ +18> ^^^ +19> ^ +20> ^^ +21> ^ +22> ^^ +23> ^^ +24> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > [, nameA = "name"] = getRobot() +7 > +8 > nameA = "name" +9 > +10> nameA = "name" +11> ] = getRobot() +12> , +13> i +14> = +15> 0 +16> ; +17> i +18> < +19> 1 +20> ; +21> i +22> ++ +23> ) +24> { +1->Emitted(18, 1) Source(27, 1) + SourceIndex(0) +2 >Emitted(18, 4) Source(27, 4) + SourceIndex(0) +3 >Emitted(18, 5) Source(27, 5) + SourceIndex(0) +4 >Emitted(18, 6) Source(27, 6) + SourceIndex(0) +5 >Emitted(18, 7) Source(27, 6) + SourceIndex(0) +6 >Emitted(18, 22) Source(27, 37) + SourceIndex(0) +7 >Emitted(18, 24) Source(27, 9) + SourceIndex(0) +8 >Emitted(18, 34) Source(27, 23) + SourceIndex(0) +9 >Emitted(18, 36) Source(27, 9) + SourceIndex(0) +10>Emitted(18, 71) Source(27, 23) + SourceIndex(0) +11>Emitted(18, 76) Source(27, 37) + SourceIndex(0) +12>Emitted(18, 78) Source(27, 39) + SourceIndex(0) +13>Emitted(18, 79) Source(27, 40) + SourceIndex(0) +14>Emitted(18, 82) Source(27, 43) + SourceIndex(0) +15>Emitted(18, 83) Source(27, 44) + SourceIndex(0) +16>Emitted(18, 85) Source(27, 46) + SourceIndex(0) +17>Emitted(18, 86) Source(27, 47) + SourceIndex(0) +18>Emitted(18, 89) Source(27, 50) + SourceIndex(0) +19>Emitted(18, 90) Source(27, 51) + SourceIndex(0) +20>Emitted(18, 92) Source(27, 53) + SourceIndex(0) +21>Emitted(18, 93) Source(27, 54) + SourceIndex(0) +22>Emitted(18, 95) Source(27, 56) + SourceIndex(0) +23>Emitted(18, 97) Source(27, 58) + SourceIndex(0) +24>Emitted(18, 98) Source(27, 59) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(19, 5) Source(28, 5) + SourceIndex(0) +2 >Emitted(19, 12) Source(28, 12) + SourceIndex(0) +3 >Emitted(19, 13) Source(28, 13) + SourceIndex(0) +4 >Emitted(19, 16) Source(28, 16) + SourceIndex(0) +5 >Emitted(19, 17) Source(28, 17) + SourceIndex(0) +6 >Emitted(19, 22) Source(28, 22) + SourceIndex(0) +7 >Emitted(19, 23) Source(28, 23) + SourceIndex(0) +8 >Emitted(19, 24) Source(28, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(20, 1) Source(29, 1) + SourceIndex(0) +2 >Emitted(20, 2) Source(29, 2) + SourceIndex(0) +--- +>>>for ((_d = [2, "trimmer", "trimming"], _e = _d[1], nameA = _e === void 0 ? "name" : _e, _d), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^^^^ +12> ^^ +13> ^ +14> ^^^ +15> ^ +16> ^^ +17> ^ +18> ^^^ +19> ^ +20> ^^ +21> ^ +22> ^^ +23> ^^ +24> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > [, nameA = "name"] = [2, "trimmer", "trimming"] +7 > +8 > nameA = "name" +9 > +10> nameA = "name" +11> ] = [2, "trimmer", "trimming"] +12> , +13> i +14> = +15> 0 +16> ; +17> i +18> < +19> 1 +20> ; +21> i +22> ++ +23> ) +24> { +1->Emitted(21, 1) Source(30, 1) + SourceIndex(0) +2 >Emitted(21, 4) Source(30, 4) + SourceIndex(0) +3 >Emitted(21, 5) Source(30, 5) + SourceIndex(0) +4 >Emitted(21, 6) Source(30, 6) + SourceIndex(0) +5 >Emitted(21, 7) Source(30, 6) + SourceIndex(0) +6 >Emitted(21, 38) Source(30, 53) + SourceIndex(0) +7 >Emitted(21, 40) Source(30, 9) + SourceIndex(0) +8 >Emitted(21, 50) Source(30, 23) + SourceIndex(0) +9 >Emitted(21, 52) Source(30, 9) + SourceIndex(0) +10>Emitted(21, 87) Source(30, 23) + SourceIndex(0) +11>Emitted(21, 92) Source(30, 53) + SourceIndex(0) +12>Emitted(21, 94) Source(30, 55) + SourceIndex(0) +13>Emitted(21, 95) Source(30, 56) + SourceIndex(0) +14>Emitted(21, 98) Source(30, 59) + SourceIndex(0) +15>Emitted(21, 99) Source(30, 60) + SourceIndex(0) +16>Emitted(21, 101) Source(30, 62) + SourceIndex(0) +17>Emitted(21, 102) Source(30, 63) + SourceIndex(0) +18>Emitted(21, 105) Source(30, 66) + SourceIndex(0) +19>Emitted(21, 106) Source(30, 67) + SourceIndex(0) +20>Emitted(21, 108) Source(30, 69) + SourceIndex(0) +21>Emitted(21, 109) Source(30, 70) + SourceIndex(0) +22>Emitted(21, 111) Source(30, 72) + SourceIndex(0) +23>Emitted(21, 113) Source(30, 74) + SourceIndex(0) +24>Emitted(21, 114) Source(30, 75) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(22, 5) Source(31, 5) + SourceIndex(0) +2 >Emitted(22, 12) Source(31, 12) + SourceIndex(0) +3 >Emitted(22, 13) Source(31, 13) + SourceIndex(0) +4 >Emitted(22, 16) Source(31, 16) + SourceIndex(0) +5 >Emitted(22, 17) Source(31, 17) + SourceIndex(0) +6 >Emitted(22, 22) Source(31, 22) + SourceIndex(0) +7 >Emitted(22, 23) Source(31, 23) + SourceIndex(0) +8 >Emitted(22, 24) Source(31, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(23, 1) Source(32, 1) + SourceIndex(0) +2 >Emitted(23, 2) Source(32, 2) + SourceIndex(0) +--- +>>>for ((_f = multiRobotA[1], _g = _f === void 0 ? ["none", "none"] : _f, _h = _g[0], primarySkillA = _h === void 0 ? "primary" : _h, _j = _g[1], secondarySkillA = _j === void 0 ? "secondary" : _j, multiRobotA), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^ +15> ^^ +16> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +17> ^^ +18> ^^^^^^^^^^^ +19> ^ +20> ^^ +21> ^ +22> ^^^ +23> ^ +24> ^^ +25> ^ +26> ^^^ +27> ^ +28> ^^ +29> ^ +30> ^^ +31> ^^ +32> ^ +1-> + > +2 >for +3 > +4 > ( +5 > [, +6 > [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["none", "none"] +7 > +8 > [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["none", "none"] +9 > +10> primarySkillA = "primary" +11> +12> primarySkillA = "primary" +13> , + > +14> secondarySkillA = "secondary" +15> +16> secondarySkillA = "secondary" +17> + > ] = ["none", "none"]] = +18> multiRobotA +19> +20> , +21> i +22> = +23> 0 +24> ; +25> i +26> < +27> 1 +28> ; +29> i +30> ++ +31> ) +32> { +1->Emitted(24, 1) Source(33, 1) + SourceIndex(0) +2 >Emitted(24, 4) Source(33, 4) + SourceIndex(0) +3 >Emitted(24, 5) Source(33, 5) + SourceIndex(0) +4 >Emitted(24, 6) Source(33, 6) + SourceIndex(0) +5 >Emitted(24, 7) Source(33, 9) + SourceIndex(0) +6 >Emitted(24, 26) Source(36, 21) + SourceIndex(0) +7 >Emitted(24, 28) Source(33, 9) + SourceIndex(0) +8 >Emitted(24, 70) Source(36, 21) + SourceIndex(0) +9 >Emitted(24, 72) Source(34, 5) + SourceIndex(0) +10>Emitted(24, 82) Source(34, 30) + SourceIndex(0) +11>Emitted(24, 84) Source(34, 5) + SourceIndex(0) +12>Emitted(24, 130) Source(34, 30) + SourceIndex(0) +13>Emitted(24, 132) Source(35, 5) + SourceIndex(0) +14>Emitted(24, 142) Source(35, 34) + SourceIndex(0) +15>Emitted(24, 144) Source(35, 5) + SourceIndex(0) +16>Emitted(24, 194) Source(35, 34) + SourceIndex(0) +17>Emitted(24, 196) Source(36, 25) + SourceIndex(0) +18>Emitted(24, 207) Source(36, 36) + SourceIndex(0) +19>Emitted(24, 208) Source(36, 36) + SourceIndex(0) +20>Emitted(24, 210) Source(36, 38) + SourceIndex(0) +21>Emitted(24, 211) Source(36, 39) + SourceIndex(0) +22>Emitted(24, 214) Source(36, 42) + SourceIndex(0) +23>Emitted(24, 215) Source(36, 43) + SourceIndex(0) +24>Emitted(24, 217) Source(36, 45) + SourceIndex(0) +25>Emitted(24, 218) Source(36, 46) + SourceIndex(0) +26>Emitted(24, 221) Source(36, 49) + SourceIndex(0) +27>Emitted(24, 222) Source(36, 50) + SourceIndex(0) +28>Emitted(24, 224) Source(36, 52) + SourceIndex(0) +29>Emitted(24, 225) Source(36, 53) + SourceIndex(0) +30>Emitted(24, 227) Source(36, 55) + SourceIndex(0) +31>Emitted(24, 229) Source(36, 57) + SourceIndex(0) +32>Emitted(24, 230) Source(36, 58) + SourceIndex(0) +--- +>>> console.log(primarySkillA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > primarySkillA +7 > ) +8 > ; +1 >Emitted(25, 5) Source(37, 5) + SourceIndex(0) +2 >Emitted(25, 12) Source(37, 12) + SourceIndex(0) +3 >Emitted(25, 13) Source(37, 13) + SourceIndex(0) +4 >Emitted(25, 16) Source(37, 16) + SourceIndex(0) +5 >Emitted(25, 17) Source(37, 17) + SourceIndex(0) +6 >Emitted(25, 30) Source(37, 30) + SourceIndex(0) +7 >Emitted(25, 31) Source(37, 31) + SourceIndex(0) +8 >Emitted(25, 32) Source(37, 32) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(26, 1) Source(38, 1) + SourceIndex(0) +2 >Emitted(26, 2) Source(38, 2) + SourceIndex(0) +--- +>>>for ((_k = getMultiRobot(), _l = _k[1], _m = _l === void 0 ? ["none", "none"] : _l, _o = _m[0], primarySkillA = _o === void 0 ? "primary" : _o, _p = _m[1], secondarySkillA = _p === void 0 ? "secondary" : _p, _k), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +15> ^^ +16> ^^^^^^^^^^ +17> ^^ +18> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +19> ^^^^^ +20> ^^ +21> ^ +22> ^^^ +23> ^ +24> ^^ +25> ^ +26> ^^^ +27> ^ +28> ^^ +29> ^ +30> ^^ +31> ^^ +32> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > [, [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["none", "none"]] = getMultiRobot() +7 > +8 > [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["none", "none"] +9 > +10> [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["none", "none"] +11> +12> primarySkillA = "primary" +13> +14> primarySkillA = "primary" +15> , + > +16> secondarySkillA = "secondary" +17> +18> secondarySkillA = "secondary" +19> + > ] = ["none", "none"]] = getMultiRobot() +20> , +21> i +22> = +23> 0 +24> ; +25> i +26> < +27> 1 +28> ; +29> i +30> ++ +31> ) +32> { +1->Emitted(27, 1) Source(39, 1) + SourceIndex(0) +2 >Emitted(27, 4) Source(39, 4) + SourceIndex(0) +3 >Emitted(27, 5) Source(39, 5) + SourceIndex(0) +4 >Emitted(27, 6) Source(39, 6) + SourceIndex(0) +5 >Emitted(27, 7) Source(39, 6) + SourceIndex(0) +6 >Emitted(27, 27) Source(42, 40) + SourceIndex(0) +7 >Emitted(27, 29) Source(39, 9) + SourceIndex(0) +8 >Emitted(27, 39) Source(42, 21) + SourceIndex(0) +9 >Emitted(27, 41) Source(39, 9) + SourceIndex(0) +10>Emitted(27, 83) Source(42, 21) + SourceIndex(0) +11>Emitted(27, 85) Source(40, 5) + SourceIndex(0) +12>Emitted(27, 95) Source(40, 30) + SourceIndex(0) +13>Emitted(27, 97) Source(40, 5) + SourceIndex(0) +14>Emitted(27, 143) Source(40, 30) + SourceIndex(0) +15>Emitted(27, 145) Source(41, 5) + SourceIndex(0) +16>Emitted(27, 155) Source(41, 34) + SourceIndex(0) +17>Emitted(27, 157) Source(41, 5) + SourceIndex(0) +18>Emitted(27, 207) Source(41, 34) + SourceIndex(0) +19>Emitted(27, 212) Source(42, 40) + SourceIndex(0) +20>Emitted(27, 214) Source(42, 42) + SourceIndex(0) +21>Emitted(27, 215) Source(42, 43) + SourceIndex(0) +22>Emitted(27, 218) Source(42, 46) + SourceIndex(0) +23>Emitted(27, 219) Source(42, 47) + SourceIndex(0) +24>Emitted(27, 221) Source(42, 49) + SourceIndex(0) +25>Emitted(27, 222) Source(42, 50) + SourceIndex(0) +26>Emitted(27, 225) Source(42, 53) + SourceIndex(0) +27>Emitted(27, 226) Source(42, 54) + SourceIndex(0) +28>Emitted(27, 228) Source(42, 56) + SourceIndex(0) +29>Emitted(27, 229) Source(42, 57) + SourceIndex(0) +30>Emitted(27, 231) Source(42, 59) + SourceIndex(0) +31>Emitted(27, 233) Source(42, 61) + SourceIndex(0) +32>Emitted(27, 234) Source(42, 62) + SourceIndex(0) +--- +>>> console.log(primarySkillA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > primarySkillA +7 > ) +8 > ; +1 >Emitted(28, 5) Source(43, 5) + SourceIndex(0) +2 >Emitted(28, 12) Source(43, 12) + SourceIndex(0) +3 >Emitted(28, 13) Source(43, 13) + SourceIndex(0) +4 >Emitted(28, 16) Source(43, 16) + SourceIndex(0) +5 >Emitted(28, 17) Source(43, 17) + SourceIndex(0) +6 >Emitted(28, 30) Source(43, 30) + SourceIndex(0) +7 >Emitted(28, 31) Source(43, 31) + SourceIndex(0) +8 >Emitted(28, 32) Source(43, 32) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(29, 1) Source(44, 1) + SourceIndex(0) +2 >Emitted(29, 2) Source(44, 2) + SourceIndex(0) +--- +>>>for ((_q = ["trimmer", ["trimming", "edging"]], _r = _q[1], _s = _r === void 0 ? ["none", "none"] : _r, _t = _s[0], primarySkillA = _t === void 0 ? "primary" : _t, _u = _s[1], secondarySkillA = _u === void 0 ? "secondary" : _u, _q), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +15> ^^ +16> ^^^^^^^^^^ +17> ^^ +18> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +19> ^^^^^ +20> ^^ +21> ^ +22> ^^^ +23> ^ +24> ^^ +25> ^ +26> ^^^ +27> ^ +28> ^^ +29> ^ +30> ^^ +31> ^^ +32> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > [, [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["none", "none"]] = ["trimmer", ["trimming", "edging"]] +7 > +8 > [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["none", "none"] +9 > +10> [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["none", "none"] +11> +12> primarySkillA = "primary" +13> +14> primarySkillA = "primary" +15> , + > +16> secondarySkillA = "secondary" +17> +18> secondarySkillA = "secondary" +19> + > ] = ["none", "none"]] = ["trimmer", ["trimming", "edging"]] +20> , +21> i +22> = +23> 0 +24> ; +25> i +26> < +27> 1 +28> ; +29> i +30> ++ +31> ) +32> { +1->Emitted(30, 1) Source(45, 1) + SourceIndex(0) +2 >Emitted(30, 4) Source(45, 4) + SourceIndex(0) +3 >Emitted(30, 5) Source(45, 5) + SourceIndex(0) +4 >Emitted(30, 6) Source(45, 6) + SourceIndex(0) +5 >Emitted(30, 7) Source(45, 6) + SourceIndex(0) +6 >Emitted(30, 47) Source(48, 60) + SourceIndex(0) +7 >Emitted(30, 49) Source(45, 9) + SourceIndex(0) +8 >Emitted(30, 59) Source(48, 21) + SourceIndex(0) +9 >Emitted(30, 61) Source(45, 9) + SourceIndex(0) +10>Emitted(30, 103) Source(48, 21) + SourceIndex(0) +11>Emitted(30, 105) Source(46, 5) + SourceIndex(0) +12>Emitted(30, 115) Source(46, 30) + SourceIndex(0) +13>Emitted(30, 117) Source(46, 5) + SourceIndex(0) +14>Emitted(30, 163) Source(46, 30) + SourceIndex(0) +15>Emitted(30, 165) Source(47, 5) + SourceIndex(0) +16>Emitted(30, 175) Source(47, 34) + SourceIndex(0) +17>Emitted(30, 177) Source(47, 5) + SourceIndex(0) +18>Emitted(30, 227) Source(47, 34) + SourceIndex(0) +19>Emitted(30, 232) Source(48, 60) + SourceIndex(0) +20>Emitted(30, 234) Source(48, 62) + SourceIndex(0) +21>Emitted(30, 235) Source(48, 63) + SourceIndex(0) +22>Emitted(30, 238) Source(48, 66) + SourceIndex(0) +23>Emitted(30, 239) Source(48, 67) + SourceIndex(0) +24>Emitted(30, 241) Source(48, 69) + SourceIndex(0) +25>Emitted(30, 242) Source(48, 70) + SourceIndex(0) +26>Emitted(30, 245) Source(48, 73) + SourceIndex(0) +27>Emitted(30, 246) Source(48, 74) + SourceIndex(0) +28>Emitted(30, 248) Source(48, 76) + SourceIndex(0) +29>Emitted(30, 249) Source(48, 77) + SourceIndex(0) +30>Emitted(30, 251) Source(48, 79) + SourceIndex(0) +31>Emitted(30, 253) Source(48, 81) + SourceIndex(0) +32>Emitted(30, 254) Source(48, 82) + SourceIndex(0) +--- +>>> console.log(primarySkillA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > primarySkillA +7 > ) +8 > ; +1 >Emitted(31, 5) Source(49, 5) + SourceIndex(0) +2 >Emitted(31, 12) Source(49, 12) + SourceIndex(0) +3 >Emitted(31, 13) Source(49, 13) + SourceIndex(0) +4 >Emitted(31, 16) Source(49, 16) + SourceIndex(0) +5 >Emitted(31, 17) Source(49, 17) + SourceIndex(0) +6 >Emitted(31, 30) Source(49, 30) + SourceIndex(0) +7 >Emitted(31, 31) Source(49, 31) + SourceIndex(0) +8 >Emitted(31, 32) Source(49, 32) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(32, 1) Source(50, 1) + SourceIndex(0) +2 >Emitted(32, 2) Source(50, 2) + SourceIndex(0) +--- +>>>for ((_v = robotA[0], numberB = _v === void 0 ? -1 : _v, robotA), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^ +11> ^ +12> ^^ +13> ^ +14> ^^^ +15> ^ +16> ^^ +17> ^ +18> ^^^ +19> ^ +20> ^^ +21> ^ +22> ^^ +23> ^^ +24> ^ +1-> + > + > +2 >for +3 > +4 > ( +5 > [ +6 > numberB = -1 +7 > +8 > numberB = -1 +9 > ] = +10> robotA +11> +12> , +13> i +14> = +15> 0 +16> ; +17> i +18> < +19> 1 +20> ; +21> i +22> ++ +23> ) +24> { +1->Emitted(33, 1) Source(52, 1) + SourceIndex(0) +2 >Emitted(33, 4) Source(52, 4) + SourceIndex(0) +3 >Emitted(33, 5) Source(52, 5) + SourceIndex(0) +4 >Emitted(33, 6) Source(52, 6) + SourceIndex(0) +5 >Emitted(33, 7) Source(52, 7) + SourceIndex(0) +6 >Emitted(33, 21) Source(52, 19) + SourceIndex(0) +7 >Emitted(33, 23) Source(52, 7) + SourceIndex(0) +8 >Emitted(33, 56) Source(52, 19) + SourceIndex(0) +9 >Emitted(33, 58) Source(52, 23) + SourceIndex(0) +10>Emitted(33, 64) Source(52, 29) + SourceIndex(0) +11>Emitted(33, 65) Source(52, 29) + SourceIndex(0) +12>Emitted(33, 67) Source(52, 31) + SourceIndex(0) +13>Emitted(33, 68) Source(52, 32) + SourceIndex(0) +14>Emitted(33, 71) Source(52, 35) + SourceIndex(0) +15>Emitted(33, 72) Source(52, 36) + SourceIndex(0) +16>Emitted(33, 74) Source(52, 38) + SourceIndex(0) +17>Emitted(33, 75) Source(52, 39) + SourceIndex(0) +18>Emitted(33, 78) Source(52, 42) + SourceIndex(0) +19>Emitted(33, 79) Source(52, 43) + SourceIndex(0) +20>Emitted(33, 81) Source(52, 45) + SourceIndex(0) +21>Emitted(33, 82) Source(52, 46) + SourceIndex(0) +22>Emitted(33, 84) Source(52, 48) + SourceIndex(0) +23>Emitted(33, 86) Source(52, 50) + SourceIndex(0) +24>Emitted(33, 87) Source(52, 51) + SourceIndex(0) +--- +>>> console.log(numberB); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > numberB +7 > ) +8 > ; +1 >Emitted(34, 5) Source(53, 5) + SourceIndex(0) +2 >Emitted(34, 12) Source(53, 12) + SourceIndex(0) +3 >Emitted(34, 13) Source(53, 13) + SourceIndex(0) +4 >Emitted(34, 16) Source(53, 16) + SourceIndex(0) +5 >Emitted(34, 17) Source(53, 17) + SourceIndex(0) +6 >Emitted(34, 24) Source(53, 24) + SourceIndex(0) +7 >Emitted(34, 25) Source(53, 25) + SourceIndex(0) +8 >Emitted(34, 26) Source(53, 26) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(35, 1) Source(54, 1) + SourceIndex(0) +2 >Emitted(35, 2) Source(54, 2) + SourceIndex(0) +--- +>>>for ((_w = getRobot(), _x = _w[0], numberB = _x === void 0 ? -1 : _x, _w), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^^^^ +12> ^^ +13> ^ +14> ^^^ +15> ^ +16> ^^ +17> ^ +18> ^^^ +19> ^ +20> ^^ +21> ^ +22> ^^ +23> ^^ +24> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > [numberB = -1] = getRobot() +7 > +8 > numberB = -1 +9 > +10> numberB = -1 +11> ] = getRobot() +12> , +13> i +14> = +15> 0 +16> ; +17> i +18> < +19> 1 +20> ; +21> i +22> ++ +23> ) +24> { +1->Emitted(36, 1) Source(55, 1) + SourceIndex(0) +2 >Emitted(36, 4) Source(55, 4) + SourceIndex(0) +3 >Emitted(36, 5) Source(55, 5) + SourceIndex(0) +4 >Emitted(36, 6) Source(55, 6) + SourceIndex(0) +5 >Emitted(36, 7) Source(55, 6) + SourceIndex(0) +6 >Emitted(36, 22) Source(55, 33) + SourceIndex(0) +7 >Emitted(36, 24) Source(55, 7) + SourceIndex(0) +8 >Emitted(36, 34) Source(55, 19) + SourceIndex(0) +9 >Emitted(36, 36) Source(55, 7) + SourceIndex(0) +10>Emitted(36, 69) Source(55, 19) + SourceIndex(0) +11>Emitted(36, 74) Source(55, 33) + SourceIndex(0) +12>Emitted(36, 76) Source(55, 35) + SourceIndex(0) +13>Emitted(36, 77) Source(55, 36) + SourceIndex(0) +14>Emitted(36, 80) Source(55, 39) + SourceIndex(0) +15>Emitted(36, 81) Source(55, 40) + SourceIndex(0) +16>Emitted(36, 83) Source(55, 42) + SourceIndex(0) +17>Emitted(36, 84) Source(55, 43) + SourceIndex(0) +18>Emitted(36, 87) Source(55, 46) + SourceIndex(0) +19>Emitted(36, 88) Source(55, 47) + SourceIndex(0) +20>Emitted(36, 90) Source(55, 49) + SourceIndex(0) +21>Emitted(36, 91) Source(55, 50) + SourceIndex(0) +22>Emitted(36, 93) Source(55, 52) + SourceIndex(0) +23>Emitted(36, 95) Source(55, 54) + SourceIndex(0) +24>Emitted(36, 96) Source(55, 55) + SourceIndex(0) +--- +>>> console.log(numberB); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > numberB +7 > ) +8 > ; +1 >Emitted(37, 5) Source(56, 5) + SourceIndex(0) +2 >Emitted(37, 12) Source(56, 12) + SourceIndex(0) +3 >Emitted(37, 13) Source(56, 13) + SourceIndex(0) +4 >Emitted(37, 16) Source(56, 16) + SourceIndex(0) +5 >Emitted(37, 17) Source(56, 17) + SourceIndex(0) +6 >Emitted(37, 24) Source(56, 24) + SourceIndex(0) +7 >Emitted(37, 25) Source(56, 25) + SourceIndex(0) +8 >Emitted(37, 26) Source(56, 26) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(38, 1) Source(57, 1) + SourceIndex(0) +2 >Emitted(38, 2) Source(57, 2) + SourceIndex(0) +--- +>>>for ((_y = [2, "trimmer", "trimming"], _z = _y[0], numberB = _z === void 0 ? -1 : _z, _y), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^^^^ +12> ^^ +13> ^ +14> ^^^ +15> ^ +16> ^^ +17> ^ +18> ^^^ +19> ^ +20> ^^ +21> ^ +22> ^^ +23> ^^ +24> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > [numberB = -1] = [2, "trimmer", "trimming"] +7 > +8 > numberB = -1 +9 > +10> numberB = -1 +11> ] = [2, "trimmer", "trimming"] +12> , +13> i +14> = +15> 0 +16> ; +17> i +18> < +19> 1 +20> ; +21> i +22> ++ +23> ) +24> { +1->Emitted(39, 1) Source(58, 1) + SourceIndex(0) +2 >Emitted(39, 4) Source(58, 4) + SourceIndex(0) +3 >Emitted(39, 5) Source(58, 5) + SourceIndex(0) +4 >Emitted(39, 6) Source(58, 6) + SourceIndex(0) +5 >Emitted(39, 7) Source(58, 6) + SourceIndex(0) +6 >Emitted(39, 38) Source(58, 49) + SourceIndex(0) +7 >Emitted(39, 40) Source(58, 7) + SourceIndex(0) +8 >Emitted(39, 50) Source(58, 19) + SourceIndex(0) +9 >Emitted(39, 52) Source(58, 7) + SourceIndex(0) +10>Emitted(39, 85) Source(58, 19) + SourceIndex(0) +11>Emitted(39, 90) Source(58, 49) + SourceIndex(0) +12>Emitted(39, 92) Source(58, 51) + SourceIndex(0) +13>Emitted(39, 93) Source(58, 52) + SourceIndex(0) +14>Emitted(39, 96) Source(58, 55) + SourceIndex(0) +15>Emitted(39, 97) Source(58, 56) + SourceIndex(0) +16>Emitted(39, 99) Source(58, 58) + SourceIndex(0) +17>Emitted(39, 100) Source(58, 59) + SourceIndex(0) +18>Emitted(39, 103) Source(58, 62) + SourceIndex(0) +19>Emitted(39, 104) Source(58, 63) + SourceIndex(0) +20>Emitted(39, 106) Source(58, 65) + SourceIndex(0) +21>Emitted(39, 107) Source(58, 66) + SourceIndex(0) +22>Emitted(39, 109) Source(58, 68) + SourceIndex(0) +23>Emitted(39, 111) Source(58, 70) + SourceIndex(0) +24>Emitted(39, 112) Source(58, 71) + SourceIndex(0) +--- +>>> console.log(numberB); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > numberB +7 > ) +8 > ; +1 >Emitted(40, 5) Source(59, 5) + SourceIndex(0) +2 >Emitted(40, 12) Source(59, 12) + SourceIndex(0) +3 >Emitted(40, 13) Source(59, 13) + SourceIndex(0) +4 >Emitted(40, 16) Source(59, 16) + SourceIndex(0) +5 >Emitted(40, 17) Source(59, 17) + SourceIndex(0) +6 >Emitted(40, 24) Source(59, 24) + SourceIndex(0) +7 >Emitted(40, 25) Source(59, 25) + SourceIndex(0) +8 >Emitted(40, 26) Source(59, 26) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(41, 1) Source(60, 1) + SourceIndex(0) +2 >Emitted(41, 2) Source(60, 2) + SourceIndex(0) +--- +>>>for ((_0 = multiRobotA[0], nameB = _0 === void 0 ? "name" : _0, multiRobotA), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^ +11> ^ +12> ^^ +13> ^ +14> ^^^ +15> ^ +16> ^^ +17> ^ +18> ^^^ +19> ^ +20> ^^ +21> ^ +22> ^^ +23> ^^ +24> ^ +1-> + > +2 >for +3 > +4 > ( +5 > [ +6 > nameB = "name" +7 > +8 > nameB = "name" +9 > ] = +10> multiRobotA +11> +12> , +13> i +14> = +15> 0 +16> ; +17> i +18> < +19> 1 +20> ; +21> i +22> ++ +23> ) +24> { +1->Emitted(42, 1) Source(61, 1) + SourceIndex(0) +2 >Emitted(42, 4) Source(61, 4) + SourceIndex(0) +3 >Emitted(42, 5) Source(61, 5) + SourceIndex(0) +4 >Emitted(42, 6) Source(61, 6) + SourceIndex(0) +5 >Emitted(42, 7) Source(61, 7) + SourceIndex(0) +6 >Emitted(42, 26) Source(61, 21) + SourceIndex(0) +7 >Emitted(42, 28) Source(61, 7) + SourceIndex(0) +8 >Emitted(42, 63) Source(61, 21) + SourceIndex(0) +9 >Emitted(42, 65) Source(61, 25) + SourceIndex(0) +10>Emitted(42, 76) Source(61, 36) + SourceIndex(0) +11>Emitted(42, 77) Source(61, 36) + SourceIndex(0) +12>Emitted(42, 79) Source(61, 38) + SourceIndex(0) +13>Emitted(42, 80) Source(61, 39) + SourceIndex(0) +14>Emitted(42, 83) Source(61, 42) + SourceIndex(0) +15>Emitted(42, 84) Source(61, 43) + SourceIndex(0) +16>Emitted(42, 86) Source(61, 45) + SourceIndex(0) +17>Emitted(42, 87) Source(61, 46) + SourceIndex(0) +18>Emitted(42, 90) Source(61, 49) + SourceIndex(0) +19>Emitted(42, 91) Source(61, 50) + SourceIndex(0) +20>Emitted(42, 93) Source(61, 52) + SourceIndex(0) +21>Emitted(42, 94) Source(61, 53) + SourceIndex(0) +22>Emitted(42, 96) Source(61, 55) + SourceIndex(0) +23>Emitted(42, 98) Source(61, 57) + SourceIndex(0) +24>Emitted(42, 99) Source(61, 58) + SourceIndex(0) +--- +>>> console.log(nameB); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameB +7 > ) +8 > ; +1 >Emitted(43, 5) Source(62, 5) + SourceIndex(0) +2 >Emitted(43, 12) Source(62, 12) + SourceIndex(0) +3 >Emitted(43, 13) Source(62, 13) + SourceIndex(0) +4 >Emitted(43, 16) Source(62, 16) + SourceIndex(0) +5 >Emitted(43, 17) Source(62, 17) + SourceIndex(0) +6 >Emitted(43, 22) Source(62, 22) + SourceIndex(0) +7 >Emitted(43, 23) Source(62, 23) + SourceIndex(0) +8 >Emitted(43, 24) Source(62, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(44, 1) Source(63, 1) + SourceIndex(0) +2 >Emitted(44, 2) Source(63, 2) + SourceIndex(0) +--- +>>>for ((_1 = getMultiRobot(), _2 = _1[0], nameB = _2 === void 0 ? "name" : _2, _1), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^^^^ +12> ^^ +13> ^ +14> ^^^ +15> ^ +16> ^^ +17> ^ +18> ^^^ +19> ^ +20> ^^ +21> ^ +22> ^^ +23> ^^ +24> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > [nameB = "name"] = getMultiRobot() +7 > +8 > nameB = "name" +9 > +10> nameB = "name" +11> ] = getMultiRobot() +12> , +13> i +14> = +15> 0 +16> ; +17> i +18> < +19> 1 +20> ; +21> i +22> ++ +23> ) +24> { +1->Emitted(45, 1) Source(64, 1) + SourceIndex(0) +2 >Emitted(45, 4) Source(64, 4) + SourceIndex(0) +3 >Emitted(45, 5) Source(64, 5) + SourceIndex(0) +4 >Emitted(45, 6) Source(64, 6) + SourceIndex(0) +5 >Emitted(45, 7) Source(64, 6) + SourceIndex(0) +6 >Emitted(45, 27) Source(64, 40) + SourceIndex(0) +7 >Emitted(45, 29) Source(64, 7) + SourceIndex(0) +8 >Emitted(45, 39) Source(64, 21) + SourceIndex(0) +9 >Emitted(45, 41) Source(64, 7) + SourceIndex(0) +10>Emitted(45, 76) Source(64, 21) + SourceIndex(0) +11>Emitted(45, 81) Source(64, 40) + SourceIndex(0) +12>Emitted(45, 83) Source(64, 42) + SourceIndex(0) +13>Emitted(45, 84) Source(64, 43) + SourceIndex(0) +14>Emitted(45, 87) Source(64, 46) + SourceIndex(0) +15>Emitted(45, 88) Source(64, 47) + SourceIndex(0) +16>Emitted(45, 90) Source(64, 49) + SourceIndex(0) +17>Emitted(45, 91) Source(64, 50) + SourceIndex(0) +18>Emitted(45, 94) Source(64, 53) + SourceIndex(0) +19>Emitted(45, 95) Source(64, 54) + SourceIndex(0) +20>Emitted(45, 97) Source(64, 56) + SourceIndex(0) +21>Emitted(45, 98) Source(64, 57) + SourceIndex(0) +22>Emitted(45, 100) Source(64, 59) + SourceIndex(0) +23>Emitted(45, 102) Source(64, 61) + SourceIndex(0) +24>Emitted(45, 103) Source(64, 62) + SourceIndex(0) +--- +>>> console.log(nameB); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameB +7 > ) +8 > ; +1 >Emitted(46, 5) Source(65, 5) + SourceIndex(0) +2 >Emitted(46, 12) Source(65, 12) + SourceIndex(0) +3 >Emitted(46, 13) Source(65, 13) + SourceIndex(0) +4 >Emitted(46, 16) Source(65, 16) + SourceIndex(0) +5 >Emitted(46, 17) Source(65, 17) + SourceIndex(0) +6 >Emitted(46, 22) Source(65, 22) + SourceIndex(0) +7 >Emitted(46, 23) Source(65, 23) + SourceIndex(0) +8 >Emitted(46, 24) Source(65, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(47, 1) Source(66, 1) + SourceIndex(0) +2 >Emitted(47, 2) Source(66, 2) + SourceIndex(0) +--- +>>>for ((_3 = ["trimmer", ["trimming", "edging"]], _4 = _3[0], nameB = _4 === void 0 ? "name" : _4, _3), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^^^^ +12> ^^ +13> ^ +14> ^^^ +15> ^ +16> ^^ +17> ^ +18> ^^^ +19> ^ +20> ^^ +21> ^ +22> ^^ +23> ^^ +24> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > [nameB = "name"] = ["trimmer", ["trimming", "edging"]] +7 > +8 > nameB = "name" +9 > +10> nameB = "name" +11> ] = ["trimmer", ["trimming", "edging"]] +12> , +13> i +14> = +15> 0 +16> ; +17> i +18> < +19> 1 +20> ; +21> i +22> ++ +23> ) +24> { +1->Emitted(48, 1) Source(67, 1) + SourceIndex(0) +2 >Emitted(48, 4) Source(67, 4) + SourceIndex(0) +3 >Emitted(48, 5) Source(67, 5) + SourceIndex(0) +4 >Emitted(48, 6) Source(67, 6) + SourceIndex(0) +5 >Emitted(48, 7) Source(67, 6) + SourceIndex(0) +6 >Emitted(48, 47) Source(67, 60) + SourceIndex(0) +7 >Emitted(48, 49) Source(67, 7) + SourceIndex(0) +8 >Emitted(48, 59) Source(67, 21) + SourceIndex(0) +9 >Emitted(48, 61) Source(67, 7) + SourceIndex(0) +10>Emitted(48, 96) Source(67, 21) + SourceIndex(0) +11>Emitted(48, 101) Source(67, 60) + SourceIndex(0) +12>Emitted(48, 103) Source(67, 62) + SourceIndex(0) +13>Emitted(48, 104) Source(67, 63) + SourceIndex(0) +14>Emitted(48, 107) Source(67, 66) + SourceIndex(0) +15>Emitted(48, 108) Source(67, 67) + SourceIndex(0) +16>Emitted(48, 110) Source(67, 69) + SourceIndex(0) +17>Emitted(48, 111) Source(67, 70) + SourceIndex(0) +18>Emitted(48, 114) Source(67, 73) + SourceIndex(0) +19>Emitted(48, 115) Source(67, 74) + SourceIndex(0) +20>Emitted(48, 117) Source(67, 76) + SourceIndex(0) +21>Emitted(48, 118) Source(67, 77) + SourceIndex(0) +22>Emitted(48, 120) Source(67, 79) + SourceIndex(0) +23>Emitted(48, 122) Source(67, 81) + SourceIndex(0) +24>Emitted(48, 123) Source(67, 82) + SourceIndex(0) +--- +>>> console.log(nameB); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameB +7 > ) +8 > ; +1 >Emitted(49, 5) Source(68, 5) + SourceIndex(0) +2 >Emitted(49, 12) Source(68, 12) + SourceIndex(0) +3 >Emitted(49, 13) Source(68, 13) + SourceIndex(0) +4 >Emitted(49, 16) Source(68, 16) + SourceIndex(0) +5 >Emitted(49, 17) Source(68, 17) + SourceIndex(0) +6 >Emitted(49, 22) Source(68, 22) + SourceIndex(0) +7 >Emitted(49, 23) Source(68, 23) + SourceIndex(0) +8 >Emitted(49, 24) Source(68, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(50, 1) Source(69, 1) + SourceIndex(0) +2 >Emitted(50, 2) Source(69, 2) + SourceIndex(0) +--- +>>>for ((_5 = robotA[0], numberA2 = _5 === void 0 ? -1 : _5, _6 = robotA[1], nameA2 = _6 === void 0 ? "name" : _6, _7 = robotA[2], skillA2 = _7 === void 0 ? "skill" : _7, robotA), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^ +15> ^^ +16> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +17> ^^ +18> ^^^^^^ +19> ^ +20> ^^ +21> ^ +22> ^^^ +23> ^ +24> ^^ +25> ^ +26> ^^^ +27> ^ +28> ^^ +29> ^ +30> ^^ +31> ^^ +32> ^ +1-> + > + > +2 >for +3 > +4 > ( +5 > [ +6 > numberA2 = -1 +7 > +8 > numberA2 = -1 +9 > , +10> nameA2 = "name" +11> +12> nameA2 = "name" +13> , +14> skillA2 = "skill" +15> +16> skillA2 = "skill" +17> ] = +18> robotA +19> +20> , +21> i +22> = +23> 0 +24> ; +25> i +26> < +27> 1 +28> ; +29> i +30> ++ +31> ) +32> { +1->Emitted(51, 1) Source(71, 1) + SourceIndex(0) +2 >Emitted(51, 4) Source(71, 4) + SourceIndex(0) +3 >Emitted(51, 5) Source(71, 5) + SourceIndex(0) +4 >Emitted(51, 6) Source(71, 6) + SourceIndex(0) +5 >Emitted(51, 7) Source(71, 7) + SourceIndex(0) +6 >Emitted(51, 21) Source(71, 20) + SourceIndex(0) +7 >Emitted(51, 23) Source(71, 7) + SourceIndex(0) +8 >Emitted(51, 57) Source(71, 20) + SourceIndex(0) +9 >Emitted(51, 59) Source(71, 22) + SourceIndex(0) +10>Emitted(51, 73) Source(71, 37) + SourceIndex(0) +11>Emitted(51, 75) Source(71, 22) + SourceIndex(0) +12>Emitted(51, 111) Source(71, 37) + SourceIndex(0) +13>Emitted(51, 113) Source(71, 39) + SourceIndex(0) +14>Emitted(51, 127) Source(71, 56) + SourceIndex(0) +15>Emitted(51, 129) Source(71, 39) + SourceIndex(0) +16>Emitted(51, 167) Source(71, 56) + SourceIndex(0) +17>Emitted(51, 169) Source(71, 60) + SourceIndex(0) +18>Emitted(51, 175) Source(71, 66) + SourceIndex(0) +19>Emitted(51, 176) Source(71, 66) + SourceIndex(0) +20>Emitted(51, 178) Source(71, 68) + SourceIndex(0) +21>Emitted(51, 179) Source(71, 69) + SourceIndex(0) +22>Emitted(51, 182) Source(71, 72) + SourceIndex(0) +23>Emitted(51, 183) Source(71, 73) + SourceIndex(0) +24>Emitted(51, 185) Source(71, 75) + SourceIndex(0) +25>Emitted(51, 186) Source(71, 76) + SourceIndex(0) +26>Emitted(51, 189) Source(71, 79) + SourceIndex(0) +27>Emitted(51, 190) Source(71, 80) + SourceIndex(0) +28>Emitted(51, 192) Source(71, 82) + SourceIndex(0) +29>Emitted(51, 193) Source(71, 83) + SourceIndex(0) +30>Emitted(51, 195) Source(71, 85) + SourceIndex(0) +31>Emitted(51, 197) Source(71, 87) + SourceIndex(0) +32>Emitted(51, 198) Source(71, 88) + SourceIndex(0) +--- +>>> console.log(nameA2); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA2 +7 > ) +8 > ; +1 >Emitted(52, 5) Source(72, 5) + SourceIndex(0) +2 >Emitted(52, 12) Source(72, 12) + SourceIndex(0) +3 >Emitted(52, 13) Source(72, 13) + SourceIndex(0) +4 >Emitted(52, 16) Source(72, 16) + SourceIndex(0) +5 >Emitted(52, 17) Source(72, 17) + SourceIndex(0) +6 >Emitted(52, 23) Source(72, 23) + SourceIndex(0) +7 >Emitted(52, 24) Source(72, 24) + SourceIndex(0) +8 >Emitted(52, 25) Source(72, 25) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(53, 1) Source(73, 1) + SourceIndex(0) +2 >Emitted(53, 2) Source(73, 2) + SourceIndex(0) +--- +>>>for ((_8 = getRobot(), _9 = _8[0], numberA2 = _9 === void 0 ? -1 : _9, _10 = _8[1], nameA2 = _10 === void 0 ? "name" : _10, _11 = _8[2], skillA2 = _11 === void 0 ? "skill" : _11, _8), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +15> ^^ +16> ^^^^^^^^^^^ +17> ^^ +18> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +19> ^^^^^ +20> ^^ +21> ^ +22> ^^^ +23> ^ +24> ^^ +25> ^ +26> ^^^ +27> ^ +28> ^^ +29> ^ +30> ^^ +31> ^^ +32> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > [numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = getRobot() +7 > +8 > numberA2 = -1 +9 > +10> numberA2 = -1 +11> , +12> nameA2 = "name" +13> +14> nameA2 = "name" +15> , +16> skillA2 = "skill" +17> +18> skillA2 = "skill" +19> ] = getRobot() +20> , +21> i +22> = +23> 0 +24> ; +25> i +26> < +27> 1 +28> ; +29> i +30> ++ +31> ) +32> { +1->Emitted(54, 1) Source(74, 1) + SourceIndex(0) +2 >Emitted(54, 4) Source(74, 4) + SourceIndex(0) +3 >Emitted(54, 5) Source(74, 5) + SourceIndex(0) +4 >Emitted(54, 6) Source(74, 6) + SourceIndex(0) +5 >Emitted(54, 7) Source(74, 6) + SourceIndex(0) +6 >Emitted(54, 22) Source(74, 70) + SourceIndex(0) +7 >Emitted(54, 24) Source(74, 7) + SourceIndex(0) +8 >Emitted(54, 34) Source(74, 20) + SourceIndex(0) +9 >Emitted(54, 36) Source(74, 7) + SourceIndex(0) +10>Emitted(54, 70) Source(74, 20) + SourceIndex(0) +11>Emitted(54, 72) Source(74, 22) + SourceIndex(0) +12>Emitted(54, 83) Source(74, 37) + SourceIndex(0) +13>Emitted(54, 85) Source(74, 22) + SourceIndex(0) +14>Emitted(54, 123) Source(74, 37) + SourceIndex(0) +15>Emitted(54, 125) Source(74, 39) + SourceIndex(0) +16>Emitted(54, 136) Source(74, 56) + SourceIndex(0) +17>Emitted(54, 138) Source(74, 39) + SourceIndex(0) +18>Emitted(54, 178) Source(74, 56) + SourceIndex(0) +19>Emitted(54, 183) Source(74, 70) + SourceIndex(0) +20>Emitted(54, 185) Source(74, 72) + SourceIndex(0) +21>Emitted(54, 186) Source(74, 73) + SourceIndex(0) +22>Emitted(54, 189) Source(74, 76) + SourceIndex(0) +23>Emitted(54, 190) Source(74, 77) + SourceIndex(0) +24>Emitted(54, 192) Source(74, 79) + SourceIndex(0) +25>Emitted(54, 193) Source(74, 80) + SourceIndex(0) +26>Emitted(54, 196) Source(74, 83) + SourceIndex(0) +27>Emitted(54, 197) Source(74, 84) + SourceIndex(0) +28>Emitted(54, 199) Source(74, 86) + SourceIndex(0) +29>Emitted(54, 200) Source(74, 87) + SourceIndex(0) +30>Emitted(54, 202) Source(74, 89) + SourceIndex(0) +31>Emitted(54, 204) Source(74, 91) + SourceIndex(0) +32>Emitted(54, 205) Source(74, 92) + SourceIndex(0) +--- +>>> console.log(nameA2); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA2 +7 > ) +8 > ; +1 >Emitted(55, 5) Source(75, 5) + SourceIndex(0) +2 >Emitted(55, 12) Source(75, 12) + SourceIndex(0) +3 >Emitted(55, 13) Source(75, 13) + SourceIndex(0) +4 >Emitted(55, 16) Source(75, 16) + SourceIndex(0) +5 >Emitted(55, 17) Source(75, 17) + SourceIndex(0) +6 >Emitted(55, 23) Source(75, 23) + SourceIndex(0) +7 >Emitted(55, 24) Source(75, 24) + SourceIndex(0) +8 >Emitted(55, 25) Source(75, 25) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(56, 1) Source(76, 1) + SourceIndex(0) +2 >Emitted(56, 2) Source(76, 2) + SourceIndex(0) +--- +>>>for ((_12 = [2, "trimmer", "trimming"], _13 = _12[0], numberA2 = _13 === void 0 ? -1 : _13, _14 = _12[1], nameA2 = _14 === void 0 ? "name" : _14, _15 = _12[2], skillA2 = _15 === void 0 ? "skill" : _15, _12), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +15> ^^ +16> ^^^^^^^^^^^^ +17> ^^ +18> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +19> ^^^^^^ +20> ^^ +21> ^ +22> ^^^ +23> ^ +24> ^^ +25> ^ +26> ^^^ +27> ^ +28> ^^ +29> ^ +30> ^^ +31> ^^ +32> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > [numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = [2, "trimmer", "trimming"] +7 > +8 > numberA2 = -1 +9 > +10> numberA2 = -1 +11> , +12> nameA2 = "name" +13> +14> nameA2 = "name" +15> , +16> skillA2 = "skill" +17> +18> skillA2 = "skill" +19> ] = [2, "trimmer", "trimming"] +20> , +21> i +22> = +23> 0 +24> ; +25> i +26> < +27> 1 +28> ; +29> i +30> ++ +31> ) +32> { +1->Emitted(57, 1) Source(77, 1) + SourceIndex(0) +2 >Emitted(57, 4) Source(77, 4) + SourceIndex(0) +3 >Emitted(57, 5) Source(77, 5) + SourceIndex(0) +4 >Emitted(57, 6) Source(77, 6) + SourceIndex(0) +5 >Emitted(57, 7) Source(77, 6) + SourceIndex(0) +6 >Emitted(57, 39) Source(77, 86) + SourceIndex(0) +7 >Emitted(57, 41) Source(77, 7) + SourceIndex(0) +8 >Emitted(57, 53) Source(77, 20) + SourceIndex(0) +9 >Emitted(57, 55) Source(77, 7) + SourceIndex(0) +10>Emitted(57, 91) Source(77, 20) + SourceIndex(0) +11>Emitted(57, 93) Source(77, 22) + SourceIndex(0) +12>Emitted(57, 105) Source(77, 37) + SourceIndex(0) +13>Emitted(57, 107) Source(77, 22) + SourceIndex(0) +14>Emitted(57, 145) Source(77, 37) + SourceIndex(0) +15>Emitted(57, 147) Source(77, 39) + SourceIndex(0) +16>Emitted(57, 159) Source(77, 56) + SourceIndex(0) +17>Emitted(57, 161) Source(77, 39) + SourceIndex(0) +18>Emitted(57, 201) Source(77, 56) + SourceIndex(0) +19>Emitted(57, 207) Source(77, 86) + SourceIndex(0) +20>Emitted(57, 209) Source(77, 88) + SourceIndex(0) +21>Emitted(57, 210) Source(77, 89) + SourceIndex(0) +22>Emitted(57, 213) Source(77, 92) + SourceIndex(0) +23>Emitted(57, 214) Source(77, 93) + SourceIndex(0) +24>Emitted(57, 216) Source(77, 95) + SourceIndex(0) +25>Emitted(57, 217) Source(77, 96) + SourceIndex(0) +26>Emitted(57, 220) Source(77, 99) + SourceIndex(0) +27>Emitted(57, 221) Source(77, 100) + SourceIndex(0) +28>Emitted(57, 223) Source(77, 102) + SourceIndex(0) +29>Emitted(57, 224) Source(77, 103) + SourceIndex(0) +30>Emitted(57, 226) Source(77, 105) + SourceIndex(0) +31>Emitted(57, 228) Source(77, 107) + SourceIndex(0) +32>Emitted(57, 229) Source(77, 108) + SourceIndex(0) +--- +>>> console.log(nameA2); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA2 +7 > ) +8 > ; +1 >Emitted(58, 5) Source(78, 5) + SourceIndex(0) +2 >Emitted(58, 12) Source(78, 12) + SourceIndex(0) +3 >Emitted(58, 13) Source(78, 13) + SourceIndex(0) +4 >Emitted(58, 16) Source(78, 16) + SourceIndex(0) +5 >Emitted(58, 17) Source(78, 17) + SourceIndex(0) +6 >Emitted(58, 23) Source(78, 23) + SourceIndex(0) +7 >Emitted(58, 24) Source(78, 24) + SourceIndex(0) +8 >Emitted(58, 25) Source(78, 25) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(59, 1) Source(79, 1) + SourceIndex(0) +2 >Emitted(59, 2) Source(79, 2) + SourceIndex(0) +--- +>>>for (var _16 = multiRobotA[0], nameMA_1 = _16 === void 0 ? "noName" : _16, _17 = multiRobotA[1], _18 = _17 === void 0 ? ["none", "none"] : _17, _19 = _18[0], primarySkillA_1 = _19 === void 0 ? "primary" : _19, _20 = _18[1], secondarySkillA_1 = _20 === void 0 ? "secondary" : _20, i_1 = 0; i_1 < 1; i_1++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^^^^^^ +10> ^^ +11> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +12> ^^ +13> ^^^^^^^^^^^^ +14> ^^ +15> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +16> ^^ +17> ^^^^^^^^^^^^ +18> ^^ +19> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +20> ^^ +21> ^^^ +22> ^^^ +23> ^ +24> ^^ +25> ^^^ +26> ^^^ +27> ^ +28> ^^ +29> ^^^ +30> ^^ +31> ^^ +32> ^ +1-> + > +2 >for +3 > +4 > (let + > [ +5 > nameMA = "noName" +6 > +7 > nameMA = "noName" +8 > , + > +9 > [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["none", "none"] +10> +11> [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["none", "none"] +12> +13> primarySkillA = "primary" +14> +15> primarySkillA = "primary" +16> , + > +17> secondarySkillA = "secondary" +18> +19> secondarySkillA = "secondary" +20> + > ] = ["none", "none"] + > ] = multiRobotA, +21> i +22> = +23> 0 +24> ; +25> i +26> < +27> 1 +28> ; +29> i +30> ++ +31> ) +32> { +1->Emitted(60, 1) Source(80, 1) + SourceIndex(0) +2 >Emitted(60, 4) Source(80, 4) + SourceIndex(0) +3 >Emitted(60, 5) Source(80, 5) + SourceIndex(0) +4 >Emitted(60, 6) Source(81, 6) + SourceIndex(0) +5 >Emitted(60, 30) Source(81, 23) + SourceIndex(0) +6 >Emitted(60, 32) Source(81, 6) + SourceIndex(0) +7 >Emitted(60, 74) Source(81, 23) + SourceIndex(0) +8 >Emitted(60, 76) Source(82, 9) + SourceIndex(0) +9 >Emitted(60, 96) Source(85, 29) + SourceIndex(0) +10>Emitted(60, 98) Source(82, 9) + SourceIndex(0) +11>Emitted(60, 143) Source(85, 29) + SourceIndex(0) +12>Emitted(60, 145) Source(83, 13) + SourceIndex(0) +13>Emitted(60, 157) Source(83, 38) + SourceIndex(0) +14>Emitted(60, 159) Source(83, 13) + SourceIndex(0) +15>Emitted(60, 209) Source(83, 38) + SourceIndex(0) +16>Emitted(60, 211) Source(84, 13) + SourceIndex(0) +17>Emitted(60, 223) Source(84, 42) + SourceIndex(0) +18>Emitted(60, 225) Source(84, 13) + SourceIndex(0) +19>Emitted(60, 279) Source(84, 42) + SourceIndex(0) +20>Emitted(60, 281) Source(86, 22) + SourceIndex(0) +21>Emitted(60, 284) Source(86, 23) + SourceIndex(0) +22>Emitted(60, 287) Source(86, 26) + SourceIndex(0) +23>Emitted(60, 288) Source(86, 27) + SourceIndex(0) +24>Emitted(60, 290) Source(86, 29) + SourceIndex(0) +25>Emitted(60, 293) Source(86, 30) + SourceIndex(0) +26>Emitted(60, 296) Source(86, 33) + SourceIndex(0) +27>Emitted(60, 297) Source(86, 34) + SourceIndex(0) +28>Emitted(60, 299) Source(86, 36) + SourceIndex(0) +29>Emitted(60, 302) Source(86, 37) + SourceIndex(0) +30>Emitted(60, 304) Source(86, 39) + SourceIndex(0) +31>Emitted(60, 306) Source(86, 41) + SourceIndex(0) +32>Emitted(60, 307) Source(86, 42) + SourceIndex(0) +--- +>>> console.log(nameMA_1); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameMA +7 > ) +8 > ; +1 >Emitted(61, 5) Source(87, 5) + SourceIndex(0) +2 >Emitted(61, 12) Source(87, 12) + SourceIndex(0) +3 >Emitted(61, 13) Source(87, 13) + SourceIndex(0) +4 >Emitted(61, 16) Source(87, 16) + SourceIndex(0) +5 >Emitted(61, 17) Source(87, 17) + SourceIndex(0) +6 >Emitted(61, 25) Source(87, 23) + SourceIndex(0) +7 >Emitted(61, 26) Source(87, 24) + SourceIndex(0) +8 >Emitted(61, 27) Source(87, 25) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(62, 1) Source(88, 1) + SourceIndex(0) +2 >Emitted(62, 2) Source(88, 2) + SourceIndex(0) +--- +>>>for ((_21 = getMultiRobot(), _22 = _21[0], nameMA = _22 === void 0 ? "noName" : _22, _23 = _21[1], _24 = _23 === void 0 ? ["none", "none"] : _23, _25 = _24[0], primarySkillA = _25 === void 0 ? "primary" : _25, _26 = _24[1], secondarySkillA = _26 === void 0 ? "secondary" : _26, _21), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +15> ^^ +16> ^^^^^^^^^^^^ +17> ^^ +18> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +19> ^^ +20> ^^^^^^^^^^^^ +21> ^^ +22> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +23> ^^^^^^ +24> ^^ +25> ^ +26> ^^^ +27> ^ +28> ^^ +29> ^ +30> ^^^ +31> ^ +32> ^^ +33> ^ +34> ^^ +35> ^^ +36> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > [nameMA = "noName", + > [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["none", "none"] + > ] = getMultiRobot() +7 > +8 > nameMA = "noName" +9 > +10> nameMA = "noName" +11> , + > +12> [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["none", "none"] +13> +14> [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["none", "none"] +15> +16> primarySkillA = "primary" +17> +18> primarySkillA = "primary" +19> , + > +20> secondarySkillA = "secondary" +21> +22> secondarySkillA = "secondary" +23> + > ] = ["none", "none"] + > ] = getMultiRobot() +24> , +25> i +26> = +27> 0 +28> ; +29> i +30> < +31> 1 +32> ; +33> i +34> ++ +35> ) +36> { +1->Emitted(63, 1) Source(89, 1) + SourceIndex(0) +2 >Emitted(63, 4) Source(89, 4) + SourceIndex(0) +3 >Emitted(63, 5) Source(89, 5) + SourceIndex(0) +4 >Emitted(63, 6) Source(89, 6) + SourceIndex(0) +5 >Emitted(63, 7) Source(89, 6) + SourceIndex(0) +6 >Emitted(63, 28) Source(94, 20) + SourceIndex(0) +7 >Emitted(63, 30) Source(89, 7) + SourceIndex(0) +8 >Emitted(63, 42) Source(89, 24) + SourceIndex(0) +9 >Emitted(63, 44) Source(89, 7) + SourceIndex(0) +10>Emitted(63, 84) Source(89, 24) + SourceIndex(0) +11>Emitted(63, 86) Source(90, 5) + SourceIndex(0) +12>Emitted(63, 98) Source(93, 25) + SourceIndex(0) +13>Emitted(63, 100) Source(90, 5) + SourceIndex(0) +14>Emitted(63, 145) Source(93, 25) + SourceIndex(0) +15>Emitted(63, 147) Source(91, 9) + SourceIndex(0) +16>Emitted(63, 159) Source(91, 34) + SourceIndex(0) +17>Emitted(63, 161) Source(91, 9) + SourceIndex(0) +18>Emitted(63, 209) Source(91, 34) + SourceIndex(0) +19>Emitted(63, 211) Source(92, 9) + SourceIndex(0) +20>Emitted(63, 223) Source(92, 38) + SourceIndex(0) +21>Emitted(63, 225) Source(92, 9) + SourceIndex(0) +22>Emitted(63, 277) Source(92, 38) + SourceIndex(0) +23>Emitted(63, 283) Source(94, 20) + SourceIndex(0) +24>Emitted(63, 285) Source(94, 22) + SourceIndex(0) +25>Emitted(63, 286) Source(94, 23) + SourceIndex(0) +26>Emitted(63, 289) Source(94, 26) + SourceIndex(0) +27>Emitted(63, 290) Source(94, 27) + SourceIndex(0) +28>Emitted(63, 292) Source(94, 29) + SourceIndex(0) +29>Emitted(63, 293) Source(94, 30) + SourceIndex(0) +30>Emitted(63, 296) Source(94, 33) + SourceIndex(0) +31>Emitted(63, 297) Source(94, 34) + SourceIndex(0) +32>Emitted(63, 299) Source(94, 36) + SourceIndex(0) +33>Emitted(63, 300) Source(94, 37) + SourceIndex(0) +34>Emitted(63, 302) Source(94, 39) + SourceIndex(0) +35>Emitted(63, 304) Source(94, 41) + SourceIndex(0) +36>Emitted(63, 305) Source(94, 42) + SourceIndex(0) +--- +>>> console.log(nameMA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameMA +7 > ) +8 > ; +1 >Emitted(64, 5) Source(95, 5) + SourceIndex(0) +2 >Emitted(64, 12) Source(95, 12) + SourceIndex(0) +3 >Emitted(64, 13) Source(95, 13) + SourceIndex(0) +4 >Emitted(64, 16) Source(95, 16) + SourceIndex(0) +5 >Emitted(64, 17) Source(95, 17) + SourceIndex(0) +6 >Emitted(64, 23) Source(95, 23) + SourceIndex(0) +7 >Emitted(64, 24) Source(95, 24) + SourceIndex(0) +8 >Emitted(64, 25) Source(95, 25) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(65, 1) Source(96, 1) + SourceIndex(0) +2 >Emitted(65, 2) Source(96, 2) + SourceIndex(0) +--- +>>>for ((_27 = ["trimmer", ["trimming", "edging"]], _28 = _27[0], nameMA = _28 === void 0 ? "noName" : _28, _29 = _27[1], _30 = _29 === void 0 ? ["none", "none"] : _29, _31 = _30[0], primarySkillA = _31 === void 0 ? "primary" : _31, _32 = _30[1], secondarySkillA = _32 === void 0 ? "secondary" : _32, _27), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +15> ^^ +16> ^^^^^^^^^^^^ +17> ^^ +18> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +19> ^^ +20> ^^^^^^^^^^^^ +21> ^^ +22> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +23> ^^^^^^ +24> ^^ +25> ^ +26> ^^^ +27> ^ +28> ^^ +29> ^ +30> ^^^ +31> ^ +32> ^^ +33> ^ +34> ^^ +35> ^^ +36> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > [nameMA = "noName", + > [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["none", "none"] + > ] = ["trimmer", ["trimming", "edging"]] +7 > +8 > nameMA = "noName" +9 > +10> nameMA = "noName" +11> , + > +12> [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["none", "none"] +13> +14> [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["none", "none"] +15> +16> primarySkillA = "primary" +17> +18> primarySkillA = "primary" +19> , + > +20> secondarySkillA = "secondary" +21> +22> secondarySkillA = "secondary" +23> + > ] = ["none", "none"] + > ] = ["trimmer", ["trimming", "edging"]] +24> , +25> i +26> = +27> 0 +28> ; +29> i +30> < +31> 1 +32> ; +33> i +34> ++ +35> ) +36> { +1->Emitted(66, 1) Source(97, 1) + SourceIndex(0) +2 >Emitted(66, 4) Source(97, 4) + SourceIndex(0) +3 >Emitted(66, 5) Source(97, 5) + SourceIndex(0) +4 >Emitted(66, 6) Source(97, 6) + SourceIndex(0) +5 >Emitted(66, 7) Source(97, 6) + SourceIndex(0) +6 >Emitted(66, 48) Source(102, 40) + SourceIndex(0) +7 >Emitted(66, 50) Source(97, 7) + SourceIndex(0) +8 >Emitted(66, 62) Source(97, 24) + SourceIndex(0) +9 >Emitted(66, 64) Source(97, 7) + SourceIndex(0) +10>Emitted(66, 104) Source(97, 24) + SourceIndex(0) +11>Emitted(66, 106) Source(98, 5) + SourceIndex(0) +12>Emitted(66, 118) Source(101, 25) + SourceIndex(0) +13>Emitted(66, 120) Source(98, 5) + SourceIndex(0) +14>Emitted(66, 165) Source(101, 25) + SourceIndex(0) +15>Emitted(66, 167) Source(99, 9) + SourceIndex(0) +16>Emitted(66, 179) Source(99, 34) + SourceIndex(0) +17>Emitted(66, 181) Source(99, 9) + SourceIndex(0) +18>Emitted(66, 229) Source(99, 34) + SourceIndex(0) +19>Emitted(66, 231) Source(100, 9) + SourceIndex(0) +20>Emitted(66, 243) Source(100, 38) + SourceIndex(0) +21>Emitted(66, 245) Source(100, 9) + SourceIndex(0) +22>Emitted(66, 297) Source(100, 38) + SourceIndex(0) +23>Emitted(66, 303) Source(102, 40) + SourceIndex(0) +24>Emitted(66, 305) Source(102, 42) + SourceIndex(0) +25>Emitted(66, 306) Source(102, 43) + SourceIndex(0) +26>Emitted(66, 309) Source(102, 46) + SourceIndex(0) +27>Emitted(66, 310) Source(102, 47) + SourceIndex(0) +28>Emitted(66, 312) Source(102, 49) + SourceIndex(0) +29>Emitted(66, 313) Source(102, 50) + SourceIndex(0) +30>Emitted(66, 316) Source(102, 53) + SourceIndex(0) +31>Emitted(66, 317) Source(102, 54) + SourceIndex(0) +32>Emitted(66, 319) Source(102, 56) + SourceIndex(0) +33>Emitted(66, 320) Source(102, 57) + SourceIndex(0) +34>Emitted(66, 322) Source(102, 59) + SourceIndex(0) +35>Emitted(66, 324) Source(102, 61) + SourceIndex(0) +36>Emitted(66, 325) Source(102, 62) + SourceIndex(0) +--- +>>> console.log(nameMA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameMA +7 > ) +8 > ; +1 >Emitted(67, 5) Source(103, 5) + SourceIndex(0) +2 >Emitted(67, 12) Source(103, 12) + SourceIndex(0) +3 >Emitted(67, 13) Source(103, 13) + SourceIndex(0) +4 >Emitted(67, 16) Source(103, 16) + SourceIndex(0) +5 >Emitted(67, 17) Source(103, 17) + SourceIndex(0) +6 >Emitted(67, 23) Source(103, 23) + SourceIndex(0) +7 >Emitted(67, 24) Source(103, 24) + SourceIndex(0) +8 >Emitted(67, 25) Source(103, 25) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(68, 1) Source(104, 1) + SourceIndex(0) +2 >Emitted(68, 2) Source(104, 2) + SourceIndex(0) +--- +>>>for ((_33 = robotA[0], numberA3 = _33 === void 0 ? -1 : _33, robotAInfo = robotA.slice(1), robotA), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^ +13> ^ +14> ^^ +15> ^ +16> ^^^ +17> ^ +18> ^^ +19> ^ +20> ^^^ +21> ^ +22> ^^ +23> ^ +24> ^^ +25> ^^ +26> ^ +1-> + > + > +2 >for +3 > +4 > ( +5 > [ +6 > numberA3 = -1 +7 > +8 > numberA3 = -1 +9 > , +10> ...robotAInfo +11> ] = +12> robotA +13> +14> , +15> i +16> = +17> 0 +18> ; +19> i +20> < +21> 1 +22> ; +23> i +24> ++ +25> ) +26> { +1->Emitted(69, 1) Source(106, 1) + SourceIndex(0) +2 >Emitted(69, 4) Source(106, 4) + SourceIndex(0) +3 >Emitted(69, 5) Source(106, 5) + SourceIndex(0) +4 >Emitted(69, 6) Source(106, 6) + SourceIndex(0) +5 >Emitted(69, 7) Source(106, 7) + SourceIndex(0) +6 >Emitted(69, 22) Source(106, 20) + SourceIndex(0) +7 >Emitted(69, 24) Source(106, 7) + SourceIndex(0) +8 >Emitted(69, 60) Source(106, 20) + SourceIndex(0) +9 >Emitted(69, 62) Source(106, 22) + SourceIndex(0) +10>Emitted(69, 90) Source(106, 35) + SourceIndex(0) +11>Emitted(69, 92) Source(106, 39) + SourceIndex(0) +12>Emitted(69, 98) Source(106, 45) + SourceIndex(0) +13>Emitted(69, 99) Source(106, 45) + SourceIndex(0) +14>Emitted(69, 101) Source(106, 47) + SourceIndex(0) +15>Emitted(69, 102) Source(106, 48) + SourceIndex(0) +16>Emitted(69, 105) Source(106, 51) + SourceIndex(0) +17>Emitted(69, 106) Source(106, 52) + SourceIndex(0) +18>Emitted(69, 108) Source(106, 54) + SourceIndex(0) +19>Emitted(69, 109) Source(106, 55) + SourceIndex(0) +20>Emitted(69, 112) Source(106, 58) + SourceIndex(0) +21>Emitted(69, 113) Source(106, 59) + SourceIndex(0) +22>Emitted(69, 115) Source(106, 61) + SourceIndex(0) +23>Emitted(69, 116) Source(106, 62) + SourceIndex(0) +24>Emitted(69, 118) Source(106, 64) + SourceIndex(0) +25>Emitted(69, 120) Source(106, 66) + SourceIndex(0) +26>Emitted(69, 121) Source(106, 67) + SourceIndex(0) +--- +>>> console.log(numberA3); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > numberA3 +7 > ) +8 > ; +1 >Emitted(70, 5) Source(107, 5) + SourceIndex(0) +2 >Emitted(70, 12) Source(107, 12) + SourceIndex(0) +3 >Emitted(70, 13) Source(107, 13) + SourceIndex(0) +4 >Emitted(70, 16) Source(107, 16) + SourceIndex(0) +5 >Emitted(70, 17) Source(107, 17) + SourceIndex(0) +6 >Emitted(70, 25) Source(107, 25) + SourceIndex(0) +7 >Emitted(70, 26) Source(107, 26) + SourceIndex(0) +8 >Emitted(70, 27) Source(107, 27) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(71, 1) Source(108, 1) + SourceIndex(0) +2 >Emitted(71, 2) Source(108, 2) + SourceIndex(0) +--- +>>>for ((_34 = getRobot(), _35 = _34[0], numberA3 = _35 === void 0 ? -1 : _35, robotAInfo = _34.slice(1), _34), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^^^^^^^^^^^ +13> ^^^^^^ +14> ^^ +15> ^ +16> ^^^ +17> ^ +18> ^^ +19> ^ +20> ^^^ +21> ^ +22> ^^ +23> ^ +24> ^^ +25> ^^ +26> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > [numberA3 = -1, ...robotAInfo] = getRobot() +7 > +8 > numberA3 = -1 +9 > +10> numberA3 = -1 +11> , +12> ...robotAInfo +13> ] = getRobot() +14> , +15> i +16> = +17> 0 +18> ; +19> i +20> < +21> 1 +22> ; +23> i +24> ++ +25> ) +26> { +1->Emitted(72, 1) Source(109, 1) + SourceIndex(0) +2 >Emitted(72, 4) Source(109, 4) + SourceIndex(0) +3 >Emitted(72, 5) Source(109, 5) + SourceIndex(0) +4 >Emitted(72, 6) Source(109, 6) + SourceIndex(0) +5 >Emitted(72, 7) Source(109, 6) + SourceIndex(0) +6 >Emitted(72, 23) Source(109, 49) + SourceIndex(0) +7 >Emitted(72, 25) Source(109, 7) + SourceIndex(0) +8 >Emitted(72, 37) Source(109, 20) + SourceIndex(0) +9 >Emitted(72, 39) Source(109, 7) + SourceIndex(0) +10>Emitted(72, 75) Source(109, 20) + SourceIndex(0) +11>Emitted(72, 77) Source(109, 22) + SourceIndex(0) +12>Emitted(72, 102) Source(109, 35) + SourceIndex(0) +13>Emitted(72, 108) Source(109, 49) + SourceIndex(0) +14>Emitted(72, 110) Source(109, 51) + SourceIndex(0) +15>Emitted(72, 111) Source(109, 52) + SourceIndex(0) +16>Emitted(72, 114) Source(109, 55) + SourceIndex(0) +17>Emitted(72, 115) Source(109, 56) + SourceIndex(0) +18>Emitted(72, 117) Source(109, 58) + SourceIndex(0) +19>Emitted(72, 118) Source(109, 59) + SourceIndex(0) +20>Emitted(72, 121) Source(109, 62) + SourceIndex(0) +21>Emitted(72, 122) Source(109, 63) + SourceIndex(0) +22>Emitted(72, 124) Source(109, 65) + SourceIndex(0) +23>Emitted(72, 125) Source(109, 66) + SourceIndex(0) +24>Emitted(72, 127) Source(109, 68) + SourceIndex(0) +25>Emitted(72, 129) Source(109, 70) + SourceIndex(0) +26>Emitted(72, 130) Source(109, 71) + SourceIndex(0) +--- +>>> console.log(numberA3); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > numberA3 +7 > ) +8 > ; +1 >Emitted(73, 5) Source(110, 5) + SourceIndex(0) +2 >Emitted(73, 12) Source(110, 12) + SourceIndex(0) +3 >Emitted(73, 13) Source(110, 13) + SourceIndex(0) +4 >Emitted(73, 16) Source(110, 16) + SourceIndex(0) +5 >Emitted(73, 17) Source(110, 17) + SourceIndex(0) +6 >Emitted(73, 25) Source(110, 25) + SourceIndex(0) +7 >Emitted(73, 26) Source(110, 26) + SourceIndex(0) +8 >Emitted(73, 27) Source(110, 27) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(74, 1) Source(111, 1) + SourceIndex(0) +2 >Emitted(74, 2) Source(111, 2) + SourceIndex(0) +--- +>>>for ((_36 = [2, "trimmer", "trimming"], _37 = _36[0], numberA3 = _37 === void 0 ? -1 : _37, robotAInfo = _36.slice(1), _36), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^^^^^^^^^^^ +13> ^^^^^^ +14> ^^ +15> ^ +16> ^^^ +17> ^ +18> ^^ +19> ^ +20> ^^^ +21> ^ +22> ^^ +23> ^ +24> ^^ +25> ^^ +26> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > [numberA3 = -1, ...robotAInfo] = [2, "trimmer", "trimming"] +7 > +8 > numberA3 = -1 +9 > +10> numberA3 = -1 +11> , +12> ...robotAInfo +13> ] = [2, "trimmer", "trimming"] +14> , +15> i +16> = +17> 0 +18> ; +19> i +20> < +21> 1 +22> ; +23> i +24> ++ +25> ) +26> { +1->Emitted(75, 1) Source(112, 1) + SourceIndex(0) +2 >Emitted(75, 4) Source(112, 4) + SourceIndex(0) +3 >Emitted(75, 5) Source(112, 5) + SourceIndex(0) +4 >Emitted(75, 6) Source(112, 6) + SourceIndex(0) +5 >Emitted(75, 7) Source(112, 6) + SourceIndex(0) +6 >Emitted(75, 39) Source(112, 72) + SourceIndex(0) +7 >Emitted(75, 41) Source(112, 7) + SourceIndex(0) +8 >Emitted(75, 53) Source(112, 20) + SourceIndex(0) +9 >Emitted(75, 55) Source(112, 7) + SourceIndex(0) +10>Emitted(75, 91) Source(112, 20) + SourceIndex(0) +11>Emitted(75, 93) Source(112, 22) + SourceIndex(0) +12>Emitted(75, 118) Source(112, 35) + SourceIndex(0) +13>Emitted(75, 124) Source(112, 72) + SourceIndex(0) +14>Emitted(75, 126) Source(112, 74) + SourceIndex(0) +15>Emitted(75, 127) Source(112, 75) + SourceIndex(0) +16>Emitted(75, 130) Source(112, 78) + SourceIndex(0) +17>Emitted(75, 131) Source(112, 79) + SourceIndex(0) +18>Emitted(75, 133) Source(112, 81) + SourceIndex(0) +19>Emitted(75, 134) Source(112, 82) + SourceIndex(0) +20>Emitted(75, 137) Source(112, 85) + SourceIndex(0) +21>Emitted(75, 138) Source(112, 86) + SourceIndex(0) +22>Emitted(75, 140) Source(112, 88) + SourceIndex(0) +23>Emitted(75, 141) Source(112, 89) + SourceIndex(0) +24>Emitted(75, 143) Source(112, 91) + SourceIndex(0) +25>Emitted(75, 145) Source(112, 93) + SourceIndex(0) +26>Emitted(75, 146) Source(112, 94) + SourceIndex(0) +--- +>>> console.log(numberA3); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > numberA3 +7 > ) +8 > ; +1 >Emitted(76, 5) Source(113, 5) + SourceIndex(0) +2 >Emitted(76, 12) Source(113, 12) + SourceIndex(0) +3 >Emitted(76, 13) Source(113, 13) + SourceIndex(0) +4 >Emitted(76, 16) Source(113, 16) + SourceIndex(0) +5 >Emitted(76, 17) Source(113, 17) + SourceIndex(0) +6 >Emitted(76, 25) Source(113, 25) + SourceIndex(0) +7 >Emitted(76, 26) Source(113, 26) + SourceIndex(0) +8 >Emitted(76, 27) Source(113, 27) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(77, 1) Source(114, 1) + SourceIndex(0) +2 >Emitted(77, 2) Source(114, 2) + SourceIndex(0) +--- +>>>var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37; +>>>//# sourceMappingURL=sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.symbols b/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.symbols new file mode 100644 index 00000000000..3acec61f78b --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.symbols @@ -0,0 +1,391 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts === +declare var console: { +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 0, 11)) + + log(msg: any): void; +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 0, 22)) +>msg : Symbol(msg, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 1, 8)) +} +type Robot = [number, string, string]; +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 2, 1)) + +type MultiSkilledRobot = [string, [string, string]]; +>MultiSkilledRobot : Symbol(MultiSkilledRobot, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 3, 38)) + +let robotA: Robot = [1, "mower", "mowing"]; +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 6, 3)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 2, 1)) + +function getRobot() { +>getRobot : Symbol(getRobot, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 6, 43)) + + return robotA; +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 6, 3)) +} + +let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; +>multiRobotA : Symbol(multiRobotA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 11, 3)) +>MultiSkilledRobot : Symbol(MultiSkilledRobot, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 3, 38)) + +let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; +>multiRobotB : Symbol(multiRobotB, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 12, 3)) +>MultiSkilledRobot : Symbol(MultiSkilledRobot, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 3, 38)) + +function getMultiRobot() { +>getMultiRobot : Symbol(getMultiRobot, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 12, 73)) + + return multiRobotA; +>multiRobotA : Symbol(multiRobotA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 11, 3)) +} + +let nameA: string, primarySkillA: string, secondarySkillA: string; +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 17, 3)) +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 17, 18)) +>secondarySkillA : Symbol(secondarySkillA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 17, 41)) + +let numberB: number, nameB: string; +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 18, 3)) +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 18, 20)) + +let numberA2: number, nameA2: string, skillA2: string, nameMA: string; +>numberA2 : Symbol(numberA2, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 19, 3)) +>nameA2 : Symbol(nameA2, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 19, 21)) +>skillA2 : Symbol(skillA2, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 19, 37)) +>nameMA : Symbol(nameMA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 19, 54)) + +let numberA3: number, robotAInfo: (number | string)[], multiRobotAInfo: (string | [string, string])[]; +>numberA3 : Symbol(numberA3, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 20, 3)) +>robotAInfo : Symbol(robotAInfo, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 20, 21)) +>multiRobotAInfo : Symbol(multiRobotAInfo, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 20, 54)) + +let i: number; +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 21, 3)) + +for ([, nameA = "name"] = robotA, i = 0; i < 1; i++) { +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 17, 3)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 6, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 21, 3)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 17, 3)) +} +for ([, nameA = "name"] = getRobot(), i = 0; i < 1; i++) { +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 17, 3)) +>getRobot : Symbol(getRobot, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 6, 43)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 21, 3)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 17, 3)) +} +for ([, nameA = "name"] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 17, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 21, 3)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 17, 3)) +} +for ([, [ + primarySkillA = "primary", +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 17, 18)) + + secondarySkillA = "secondary" +>secondarySkillA : Symbol(secondarySkillA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 17, 41)) + +] = ["none", "none"]] = multiRobotA, i = 0; i < 1; i++) { +>multiRobotA : Symbol(multiRobotA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 11, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 21, 3)) + + console.log(primarySkillA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 0, 22)) +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 17, 18)) +} +for ([, [ + primarySkillA = "primary", +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 17, 18)) + + secondarySkillA = "secondary" +>secondarySkillA : Symbol(secondarySkillA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 17, 41)) + +] = ["none", "none"]] = getMultiRobot(), i = 0; i < 1; i++) { +>getMultiRobot : Symbol(getMultiRobot, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 12, 73)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 21, 3)) + + console.log(primarySkillA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 0, 22)) +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 17, 18)) +} +for ([, [ + primarySkillA = "primary", +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 17, 18)) + + secondarySkillA = "secondary" +>secondarySkillA : Symbol(secondarySkillA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 17, 41)) + +] = ["none", "none"]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 21, 3)) + + console.log(primarySkillA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 0, 22)) +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 17, 18)) +} + +for ([numberB = -1] = robotA, i = 0; i < 1; i++) { +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 18, 3)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 6, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 21, 3)) + + console.log(numberB); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 0, 22)) +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 18, 3)) +} +for ([numberB = -1] = getRobot(), i = 0; i < 1; i++) { +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 18, 3)) +>getRobot : Symbol(getRobot, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 6, 43)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 21, 3)) + + console.log(numberB); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 0, 22)) +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 18, 3)) +} +for ([numberB = -1] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 18, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 21, 3)) + + console.log(numberB); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 0, 22)) +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 18, 3)) +} +for ([nameB = "name"] = multiRobotA, i = 0; i < 1; i++) { +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 18, 20)) +>multiRobotA : Symbol(multiRobotA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 11, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 21, 3)) + + console.log(nameB); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 0, 22)) +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 18, 20)) +} +for ([nameB = "name"] = getMultiRobot(), i = 0; i < 1; i++) { +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 18, 20)) +>getMultiRobot : Symbol(getMultiRobot, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 12, 73)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 21, 3)) + + console.log(nameB); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 0, 22)) +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 18, 20)) +} +for ([nameB = "name"] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 18, 20)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 21, 3)) + + console.log(nameB); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 0, 22)) +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 18, 20)) +} + +for ([numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = robotA, i = 0; i < 1; i++) { +>numberA2 : Symbol(numberA2, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 19, 3)) +>nameA2 : Symbol(nameA2, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 19, 21)) +>skillA2 : Symbol(skillA2, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 19, 37)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 6, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 21, 3)) + + console.log(nameA2); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 0, 22)) +>nameA2 : Symbol(nameA2, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 19, 21)) +} +for ([numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = getRobot(), i = 0; i < 1; i++) { +>numberA2 : Symbol(numberA2, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 19, 3)) +>nameA2 : Symbol(nameA2, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 19, 21)) +>skillA2 : Symbol(skillA2, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 19, 37)) +>getRobot : Symbol(getRobot, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 6, 43)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 21, 3)) + + console.log(nameA2); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 0, 22)) +>nameA2 : Symbol(nameA2, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 19, 21)) +} +for ([numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { +>numberA2 : Symbol(numberA2, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 19, 3)) +>nameA2 : Symbol(nameA2, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 19, 21)) +>skillA2 : Symbol(skillA2, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 19, 37)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 21, 3)) + + console.log(nameA2); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 0, 22)) +>nameA2 : Symbol(nameA2, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 19, 21)) +} +for (let + [nameMA = "noName", +>nameMA : Symbol(nameMA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 80, 5)) + + [ + primarySkillA = "primary", +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 81, 9)) + + secondarySkillA = "secondary" +>secondarySkillA : Symbol(secondarySkillA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 82, 38)) + + ] = ["none", "none"] + ] = multiRobotA, i = 0; i < 1; i++) { +>multiRobotA : Symbol(multiRobotA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 11, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 85, 20)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 85, 20)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 85, 20)) + + console.log(nameMA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 0, 22)) +>nameMA : Symbol(nameMA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 80, 5)) +} +for ([nameMA = "noName", +>nameMA : Symbol(nameMA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 19, 54)) + + [ + primarySkillA = "primary", +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 17, 18)) + + secondarySkillA = "secondary" +>secondarySkillA : Symbol(secondarySkillA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 17, 41)) + + ] = ["none", "none"] +] = getMultiRobot(), i = 0; i < 1; i++) { +>getMultiRobot : Symbol(getMultiRobot, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 12, 73)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 21, 3)) + + console.log(nameMA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 0, 22)) +>nameMA : Symbol(nameMA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 19, 54)) +} +for ([nameMA = "noName", +>nameMA : Symbol(nameMA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 19, 54)) + + [ + primarySkillA = "primary", +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 17, 18)) + + secondarySkillA = "secondary" +>secondarySkillA : Symbol(secondarySkillA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 17, 41)) + + ] = ["none", "none"] +] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 21, 3)) + + console.log(nameMA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 0, 22)) +>nameMA : Symbol(nameMA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 19, 54)) +} + +for ([numberA3 = -1, ...robotAInfo] = robotA, i = 0; i < 1; i++) { +>numberA3 : Symbol(numberA3, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 20, 3)) +>robotAInfo : Symbol(robotAInfo, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 20, 21)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 6, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 21, 3)) + + console.log(numberA3); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 0, 22)) +>numberA3 : Symbol(numberA3, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 20, 3)) +} +for ([numberA3 = -1, ...robotAInfo] = getRobot(), i = 0; i < 1; i++) { +>numberA3 : Symbol(numberA3, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 20, 3)) +>robotAInfo : Symbol(robotAInfo, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 20, 21)) +>getRobot : Symbol(getRobot, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 6, 43)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 21, 3)) + + console.log(numberA3); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 0, 22)) +>numberA3 : Symbol(numberA3, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 20, 3)) +} +for ([numberA3 = -1, ...robotAInfo] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { +>numberA3 : Symbol(numberA3, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 20, 3)) +>robotAInfo : Symbol(robotAInfo, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 20, 21)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 2, 1)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 21, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 21, 3)) + + console.log(numberA3); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 0, 22)) +>numberA3 : Symbol(numberA3, Decl(sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts, 20, 3)) +} diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.types b/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.types new file mode 100644 index 00000000000..3bef86dcf80 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.types @@ -0,0 +1,752 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts === +declare var console: { +>console : { log(msg: any): void; } + + log(msg: any): void; +>log : (msg: any) => void +>msg : any +} +type Robot = [number, string, string]; +>Robot : [number, string, string] + +type MultiSkilledRobot = [string, [string, string]]; +>MultiSkilledRobot : [string, [string, string]] + +let robotA: Robot = [1, "mower", "mowing"]; +>robotA : [number, string, string] +>Robot : [number, string, string] +>[1, "mower", "mowing"] : [number, string, string] +>1 : number +>"mower" : string +>"mowing" : string + +function getRobot() { +>getRobot : () => [number, string, string] + + return robotA; +>robotA : [number, string, string] +} + +let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; +>multiRobotA : [string, [string, string]] +>MultiSkilledRobot : [string, [string, string]] +>["mower", ["mowing", ""]] : [string, [string, string]] +>"mower" : string +>["mowing", ""] : [string, string] +>"mowing" : string +>"" : string + +let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; +>multiRobotB : [string, [string, string]] +>MultiSkilledRobot : [string, [string, string]] +>["trimmer", ["trimming", "edging"]] : [string, [string, string]] +>"trimmer" : string +>["trimming", "edging"] : [string, string] +>"trimming" : string +>"edging" : string + +function getMultiRobot() { +>getMultiRobot : () => [string, [string, string]] + + return multiRobotA; +>multiRobotA : [string, [string, string]] +} + +let nameA: string, primarySkillA: string, secondarySkillA: string; +>nameA : string +>primarySkillA : string +>secondarySkillA : string + +let numberB: number, nameB: string; +>numberB : number +>nameB : string + +let numberA2: number, nameA2: string, skillA2: string, nameMA: string; +>numberA2 : number +>nameA2 : string +>skillA2 : string +>nameMA : string + +let numberA3: number, robotAInfo: (number | string)[], multiRobotAInfo: (string | [string, string])[]; +>numberA3 : number +>robotAInfo : (number | string)[] +>multiRobotAInfo : (string | [string, string])[] + +let i: number; +>i : number + +for ([, nameA = "name"] = robotA, i = 0; i < 1; i++) { +>[, nameA = "name"] = robotA, i = 0 : number +>[, nameA = "name"] = robotA : [number, string, string] +>[, nameA = "name"] : [undefined, string] +> : undefined +>nameA = "name" : string +>nameA : string +>"name" : string +>robotA : [number, string, string] +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for ([, nameA = "name"] = getRobot(), i = 0; i < 1; i++) { +>[, nameA = "name"] = getRobot(), i = 0 : number +>[, nameA = "name"] = getRobot() : [number, string, string] +>[, nameA = "name"] : [undefined, string] +> : undefined +>nameA = "name" : string +>nameA : string +>"name" : string +>getRobot() : [number, string, string] +>getRobot : () => [number, string, string] +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for ([, nameA = "name"] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { +>[, nameA = "name"] = [2, "trimmer", "trimming"], i = 0 : number +>[, nameA = "name"] = [2, "trimmer", "trimming"] : [number, string, string] +>[, nameA = "name"] : [undefined, string] +> : undefined +>nameA = "name" : string +>nameA : string +>"name" : string +>[2, "trimmer", "trimming"] : [number, string, string] +>2 : number +>"trimmer" : string +>"trimming" : string +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for ([, [ +>[, [ primarySkillA = "primary", secondarySkillA = "secondary"] = ["none", "none"]] = multiRobotA, i = 0 : number +>[, [ primarySkillA = "primary", secondarySkillA = "secondary"] = ["none", "none"]] = multiRobotA : [string, [string, string]] +>[, [ primarySkillA = "primary", secondarySkillA = "secondary"] = ["none", "none"]] : [undefined, [string, string]] +> : undefined +>[ primarySkillA = "primary", secondarySkillA = "secondary"] = ["none", "none"] : [string, string] +>[ primarySkillA = "primary", secondarySkillA = "secondary"] : [string, string] + + primarySkillA = "primary", +>primarySkillA = "primary" : string +>primarySkillA : string +>"primary" : string + + secondarySkillA = "secondary" +>secondarySkillA = "secondary" : string +>secondarySkillA : string +>"secondary" : string + +] = ["none", "none"]] = multiRobotA, i = 0; i < 1; i++) { +>["none", "none"] : [string, string] +>"none" : string +>"none" : string +>multiRobotA : [string, [string, string]] +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(primarySkillA); +>console.log(primarySkillA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primarySkillA : string +} +for ([, [ +>[, [ primarySkillA = "primary", secondarySkillA = "secondary"] = ["none", "none"]] = getMultiRobot(), i = 0 : number +>[, [ primarySkillA = "primary", secondarySkillA = "secondary"] = ["none", "none"]] = getMultiRobot() : [string, [string, string]] +>[, [ primarySkillA = "primary", secondarySkillA = "secondary"] = ["none", "none"]] : [undefined, [string, string]] +> : undefined +>[ primarySkillA = "primary", secondarySkillA = "secondary"] = ["none", "none"] : [string, string] +>[ primarySkillA = "primary", secondarySkillA = "secondary"] : [string, string] + + primarySkillA = "primary", +>primarySkillA = "primary" : string +>primarySkillA : string +>"primary" : string + + secondarySkillA = "secondary" +>secondarySkillA = "secondary" : string +>secondarySkillA : string +>"secondary" : string + +] = ["none", "none"]] = getMultiRobot(), i = 0; i < 1; i++) { +>["none", "none"] : [string, string] +>"none" : string +>"none" : string +>getMultiRobot() : [string, [string, string]] +>getMultiRobot : () => [string, [string, string]] +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(primarySkillA); +>console.log(primarySkillA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primarySkillA : string +} +for ([, [ +>[, [ primarySkillA = "primary", secondarySkillA = "secondary"] = ["none", "none"]] = ["trimmer", ["trimming", "edging"]], i = 0 : number +>[, [ primarySkillA = "primary", secondarySkillA = "secondary"] = ["none", "none"]] = ["trimmer", ["trimming", "edging"]] : [string, [string, string]] +>[, [ primarySkillA = "primary", secondarySkillA = "secondary"] = ["none", "none"]] : [undefined, [string, string]] +> : undefined +>[ primarySkillA = "primary", secondarySkillA = "secondary"] = ["none", "none"] : [string, string] +>[ primarySkillA = "primary", secondarySkillA = "secondary"] : [string, string] + + primarySkillA = "primary", +>primarySkillA = "primary" : string +>primarySkillA : string +>"primary" : string + + secondarySkillA = "secondary" +>secondarySkillA = "secondary" : string +>secondarySkillA : string +>"secondary" : string + +] = ["none", "none"]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { +>["none", "none"] : [string, string] +>"none" : string +>"none" : string +>["trimmer", ["trimming", "edging"]] : [string, [string, string]] +>"trimmer" : string +>["trimming", "edging"] : [string, string] +>"trimming" : string +>"edging" : string +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(primarySkillA); +>console.log(primarySkillA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primarySkillA : string +} + +for ([numberB = -1] = robotA, i = 0; i < 1; i++) { +>[numberB = -1] = robotA, i = 0 : number +>[numberB = -1] = robotA : [number, string, string] +>[numberB = -1] : [number] +>numberB = -1 : number +>numberB : number +>-1 : number +>1 : number +>robotA : [number, string, string] +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(numberB); +>console.log(numberB) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>numberB : number +} +for ([numberB = -1] = getRobot(), i = 0; i < 1; i++) { +>[numberB = -1] = getRobot(), i = 0 : number +>[numberB = -1] = getRobot() : [number, string, string] +>[numberB = -1] : [number] +>numberB = -1 : number +>numberB : number +>-1 : number +>1 : number +>getRobot() : [number, string, string] +>getRobot : () => [number, string, string] +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(numberB); +>console.log(numberB) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>numberB : number +} +for ([numberB = -1] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { +>[numberB = -1] = [2, "trimmer", "trimming"], i = 0 : number +>[numberB = -1] = [2, "trimmer", "trimming"] : [number, string, string] +>[numberB = -1] : [number] +>numberB = -1 : number +>numberB : number +>-1 : number +>1 : number +>[2, "trimmer", "trimming"] : [number, string, string] +>2 : number +>"trimmer" : string +>"trimming" : string +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(numberB); +>console.log(numberB) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>numberB : number +} +for ([nameB = "name"] = multiRobotA, i = 0; i < 1; i++) { +>[nameB = "name"] = multiRobotA, i = 0 : number +>[nameB = "name"] = multiRobotA : [string, [string, string]] +>[nameB = "name"] : [string] +>nameB = "name" : string +>nameB : string +>"name" : string +>multiRobotA : [string, [string, string]] +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameB); +>console.log(nameB) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameB : string +} +for ([nameB = "name"] = getMultiRobot(), i = 0; i < 1; i++) { +>[nameB = "name"] = getMultiRobot(), i = 0 : number +>[nameB = "name"] = getMultiRobot() : [string, [string, string]] +>[nameB = "name"] : [string] +>nameB = "name" : string +>nameB : string +>"name" : string +>getMultiRobot() : [string, [string, string]] +>getMultiRobot : () => [string, [string, string]] +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameB); +>console.log(nameB) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameB : string +} +for ([nameB = "name"] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { +>[nameB = "name"] = ["trimmer", ["trimming", "edging"]], i = 0 : number +>[nameB = "name"] = ["trimmer", ["trimming", "edging"]] : [string, string[]] +>[nameB = "name"] : [string] +>nameB = "name" : string +>nameB : string +>"name" : string +>["trimmer", ["trimming", "edging"]] : [string, string[]] +>"trimmer" : string +>["trimming", "edging"] : string[] +>"trimming" : string +>"edging" : string +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameB); +>console.log(nameB) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameB : string +} + +for ([numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = robotA, i = 0; i < 1; i++) { +>[numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = robotA, i = 0 : number +>[numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = robotA : [number, string, string] +>[numberA2 = -1, nameA2 = "name", skillA2 = "skill"] : [number, string, string] +>numberA2 = -1 : number +>numberA2 : number +>-1 : number +>1 : number +>nameA2 = "name" : string +>nameA2 : string +>"name" : string +>skillA2 = "skill" : string +>skillA2 : string +>"skill" : string +>robotA : [number, string, string] +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameA2); +>console.log(nameA2) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA2 : string +} +for ([numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = getRobot(), i = 0; i < 1; i++) { +>[numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = getRobot(), i = 0 : number +>[numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = getRobot() : [number, string, string] +>[numberA2 = -1, nameA2 = "name", skillA2 = "skill"] : [number, string, string] +>numberA2 = -1 : number +>numberA2 : number +>-1 : number +>1 : number +>nameA2 = "name" : string +>nameA2 : string +>"name" : string +>skillA2 = "skill" : string +>skillA2 : string +>"skill" : string +>getRobot() : [number, string, string] +>getRobot : () => [number, string, string] +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameA2); +>console.log(nameA2) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA2 : string +} +for ([numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { +>[numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = [2, "trimmer", "trimming"], i = 0 : number +>[numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = [2, "trimmer", "trimming"] : [number, string, string] +>[numberA2 = -1, nameA2 = "name", skillA2 = "skill"] : [number, string, string] +>numberA2 = -1 : number +>numberA2 : number +>-1 : number +>1 : number +>nameA2 = "name" : string +>nameA2 : string +>"name" : string +>skillA2 = "skill" : string +>skillA2 : string +>"skill" : string +>[2, "trimmer", "trimming"] : [number, string, string] +>2 : number +>"trimmer" : string +>"trimming" : string +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameA2); +>console.log(nameA2) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA2 : string +} +for (let + [nameMA = "noName", +>nameMA : string +>"noName" : string + + [ + primarySkillA = "primary", +>primarySkillA : string +>"primary" : string + + secondarySkillA = "secondary" +>secondarySkillA : string +>"secondary" : string + + ] = ["none", "none"] +>["none", "none"] : [string, string] +>"none" : string +>"none" : string + + ] = multiRobotA, i = 0; i < 1; i++) { +>multiRobotA : [string, [string, string]] +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameMA); +>console.log(nameMA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameMA : string +} +for ([nameMA = "noName", +>[nameMA = "noName", [ primarySkillA = "primary", secondarySkillA = "secondary" ] = ["none", "none"]] = getMultiRobot(), i = 0 : number +>[nameMA = "noName", [ primarySkillA = "primary", secondarySkillA = "secondary" ] = ["none", "none"]] = getMultiRobot() : [string, [string, string]] +>[nameMA = "noName", [ primarySkillA = "primary", secondarySkillA = "secondary" ] = ["none", "none"]] : [string, [string, string]] +>nameMA = "noName" : string +>nameMA : string +>"noName" : string + + [ +>[ primarySkillA = "primary", secondarySkillA = "secondary" ] = ["none", "none"] : [string, string] +>[ primarySkillA = "primary", secondarySkillA = "secondary" ] : [string, string] + + primarySkillA = "primary", +>primarySkillA = "primary" : string +>primarySkillA : string +>"primary" : string + + secondarySkillA = "secondary" +>secondarySkillA = "secondary" : string +>secondarySkillA : string +>"secondary" : string + + ] = ["none", "none"] +>["none", "none"] : [string, string] +>"none" : string +>"none" : string + +] = getMultiRobot(), i = 0; i < 1; i++) { +>getMultiRobot() : [string, [string, string]] +>getMultiRobot : () => [string, [string, string]] +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameMA); +>console.log(nameMA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameMA : string +} +for ([nameMA = "noName", +>[nameMA = "noName", [ primarySkillA = "primary", secondarySkillA = "secondary" ] = ["none", "none"]] = ["trimmer", ["trimming", "edging"]], i = 0 : number +>[nameMA = "noName", [ primarySkillA = "primary", secondarySkillA = "secondary" ] = ["none", "none"]] = ["trimmer", ["trimming", "edging"]] : [string, [string, string]] +>[nameMA = "noName", [ primarySkillA = "primary", secondarySkillA = "secondary" ] = ["none", "none"]] : [string, [string, string]] +>nameMA = "noName" : string +>nameMA : string +>"noName" : string + + [ +>[ primarySkillA = "primary", secondarySkillA = "secondary" ] = ["none", "none"] : [string, string] +>[ primarySkillA = "primary", secondarySkillA = "secondary" ] : [string, string] + + primarySkillA = "primary", +>primarySkillA = "primary" : string +>primarySkillA : string +>"primary" : string + + secondarySkillA = "secondary" +>secondarySkillA = "secondary" : string +>secondarySkillA : string +>"secondary" : string + + ] = ["none", "none"] +>["none", "none"] : [string, string] +>"none" : string +>"none" : string + +] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { +>["trimmer", ["trimming", "edging"]] : [string, [string, string]] +>"trimmer" : string +>["trimming", "edging"] : [string, string] +>"trimming" : string +>"edging" : string +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameMA); +>console.log(nameMA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameMA : string +} + +for ([numberA3 = -1, ...robotAInfo] = robotA, i = 0; i < 1; i++) { +>[numberA3 = -1, ...robotAInfo] = robotA, i = 0 : number +>[numberA3 = -1, ...robotAInfo] = robotA : [number, string, string] +>[numberA3 = -1, ...robotAInfo] : (number | string)[] +>numberA3 = -1 : number +>numberA3 : number +>-1 : number +>1 : number +>...robotAInfo : number | string +>robotAInfo : (number | string)[] +>robotA : [number, string, string] +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(numberA3); +>console.log(numberA3) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>numberA3 : number +} +for ([numberA3 = -1, ...robotAInfo] = getRobot(), i = 0; i < 1; i++) { +>[numberA3 = -1, ...robotAInfo] = getRobot(), i = 0 : number +>[numberA3 = -1, ...robotAInfo] = getRobot() : [number, string, string] +>[numberA3 = -1, ...robotAInfo] : (number | string)[] +>numberA3 = -1 : number +>numberA3 : number +>-1 : number +>1 : number +>...robotAInfo : number | string +>robotAInfo : (number | string)[] +>getRobot() : [number, string, string] +>getRobot : () => [number, string, string] +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(numberA3); +>console.log(numberA3) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>numberA3 : number +} +for ([numberA3 = -1, ...robotAInfo] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { +>[numberA3 = -1, ...robotAInfo] = [2, "trimmer", "trimming"], i = 0 : number +>[numberA3 = -1, ...robotAInfo] = [2, "trimmer", "trimming"] : [number, string, string] +>[numberA3 = -1, ...robotAInfo] : (number | string)[] +>numberA3 = -1 : number +>numberA3 : number +>-1 : number +>1 : number +>...robotAInfo : number | string +>robotAInfo : (number | string)[] +>[2, "trimmer", "trimming"] : [number, string, string] +>Robot : [number, string, string] +>[2, "trimmer", "trimming"] : [number, string, string] +>2 : number +>"trimmer" : string +>"trimming" : string +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(numberA3); +>console.log(numberA3) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>numberA3 : number +} diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForObjectBindingPattern.js b/tests/baselines/reference/sourceMapValidationDestructuringForObjectBindingPattern.js new file mode 100644 index 00000000000..ca29b2eabd8 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForObjectBindingPattern.js @@ -0,0 +1,114 @@ +//// [sourceMapValidationDestructuringForObjectBindingPattern.ts] +declare var console: { + log(msg: any): void; +} +interface Robot { + name: string; + skill: string; +} + +interface MultiRobot { + name: string; + skills: { + primary: string; + secondary: string; + }; +} + +let robot: Robot = { name: "mower", skill: "mowing" }; +let multiRobot: MultiRobot = { name: "mower", skills: { primary: "mowing", secondary: "none" } }; +function getRobot() { + return robot; +} +function getMultiRobot() { + return multiRobot; +} + +for (let {name: nameA } = robot, i = 0; i < 1; i++) { + console.log(nameA); +} +for (let {name: nameA } = getRobot(), i = 0; i < 1; i++) { + console.log(nameA); +} +for (let {name: nameA } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + console.log(nameA); +} +for (let { skills: { primary: primaryA, secondary: secondaryA } } = multiRobot, i = 0; i < 1; i++) { + console.log(primaryA); +} +for (let { skills: { primary: primaryA, secondary: secondaryA } } = getMultiRobot(), i = 0; i < 1; i++) { + console.log(primaryA); +} +for (let { skills: { primary: primaryA, secondary: secondaryA } } = + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, + i = 0; i < 1; i++) { + console.log(primaryA); +} + +for (let {name: nameA, skill: skillA } = robot, i = 0; i < 1; i++) { + console.log(nameA); +} +for (let {name: nameA, skill: skillA } = getRobot(), i = 0; i < 1; i++) { + console.log(nameA); +} +for (let {name: nameA, skill: skillA } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + console.log(nameA); +} +for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = multiRobot, i = 0; i < 1; i++) { + console.log(primaryA); +} +for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = getMultiRobot(), i = 0; i < 1; i++) { + console.log(primaryA); +} +for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, + i = 0; i < 1; i++) { + console.log(primaryA); +} + +//// [sourceMapValidationDestructuringForObjectBindingPattern.js] +var robot = { name: "mower", skill: "mowing" }; +var multiRobot = { name: "mower", skills: { primary: "mowing", secondary: "none" } }; +function getRobot() { + return robot; +} +function getMultiRobot() { + return multiRobot; +} +for (var nameA = robot.name, i = 0; i < 1; i++) { + console.log(nameA); +} +for (var nameA = getRobot().name, i = 0; i < 1; i++) { + console.log(nameA); +} +for (var nameA = { name: "trimmer", skill: "trimming" }.name, i = 0; i < 1; i++) { + console.log(nameA); +} +for (var _a = multiRobot.skills, primaryA = _a.primary, secondaryA = _a.secondary, i = 0; i < 1; i++) { + console.log(primaryA); +} +for (var _b = getMultiRobot().skills, primaryA = _b.primary, secondaryA = _b.secondary, i = 0; i < 1; i++) { + console.log(primaryA); +} +for (var _c = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }.skills, primaryA = _c.primary, secondaryA = _c.secondary, i = 0; i < 1; i++) { + console.log(primaryA); +} +for (var nameA = robot.name, skillA = robot.skill, i = 0; i < 1; i++) { + console.log(nameA); +} +for (var _d = getRobot(), nameA = _d.name, skillA = _d.skill, i = 0; i < 1; i++) { + console.log(nameA); +} +for (var _e = { name: "trimmer", skill: "trimming" }, nameA = _e.name, skillA = _e.skill, i = 0; i < 1; i++) { + console.log(nameA); +} +for (var nameA = multiRobot.name, _f = multiRobot.skills, primaryA = _f.primary, secondaryA = _f.secondary, i = 0; i < 1; i++) { + console.log(primaryA); +} +for (var _g = getMultiRobot(), nameA = _g.name, _h = _g.skills, primaryA = _h.primary, secondaryA = _h.secondary, i = 0; i < 1; i++) { + console.log(primaryA); +} +for (var _j = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, nameA = _j.name, _k = _j.skills, primaryA = _k.primary, secondaryA = _k.secondary, i = 0; i < 1; i++) { + console.log(primaryA); +} +//# sourceMappingURL=sourceMapValidationDestructuringForObjectBindingPattern.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForObjectBindingPattern.js.map b/tests/baselines/reference/sourceMapValidationDestructuringForObjectBindingPattern.js.map new file mode 100644 index 00000000000..d9f2e446f04 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForObjectBindingPattern.js.map @@ -0,0 +1,2 @@ +//// [sourceMapValidationDestructuringForObjectBindingPattern.js.map] +{"version":3,"file":"sourceMapValidationDestructuringForObjectBindingPattern.js","sourceRoot":"","sources":["sourceMapValidationDestructuringForObjectBindingPattern.ts"],"names":[],"mappings":"AAgBA,IAAI,KAAK,GAAU,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;AACtD,IAAI,UAAU,GAAe,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,CAAC;AACjG;IACI,MAAM,CAAC,KAAK,CAAC;AACjB,CAAC;AACD;IACI,MAAM,CAAC,UAAU,CAAC;AACtB,CAAC;AAED,GAAG,CAAC,CAAM,sBAAW,EAAY,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACjD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AACD,GAAG,CAAC,CAAM,2BAAW,EAAiB,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACtD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AACD,GAAG,CAAC,CAAM,uDAAW,EAAoD,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACzF,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AACD,GAAG,CAAC,CAAO,0BAAoD,EAA1C,qBAAiB,EAAE,yBAAqB,EAAmB,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IAChG,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAC1B,CAAC;AACD,GAAG,CAAC,CAAO,+BAAoD,EAA1C,qBAAiB,EAAE,yBAAqB,EAAwB,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACrG,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAC1B,CAAC;AACD,GAAG,CAAC,CAAO,yFAAoD,EAA1C,qBAAiB,EAAE,yBAAqB,EAEzD,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACpB,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAC1B,CAAC;AAED,GAAG,CAAC,CAAM,sBAAW,EAAE,oBAAa,EAAY,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IAChE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AACD,GAAG,CAAC,CAAC,IAAA,eAA8C,EAAzC,eAAW,EAAE,iBAAa,EAAiB,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACrE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AACD,GAAG,CAAC,CAAC,IAAA,2CAAiF,EAA5E,eAAW,EAAE,iBAAa,EAAoD,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACxG,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AACD,GAAG,CAAC,CAAM,2BAAW,EAAE,sBAAoD,EAA1C,qBAAiB,EAAE,yBAAqB,EAAmB,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IAC5G,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAC1B,CAAC;AACD,GAAG,CAAC,CAAC,IAAA,oBAA0F,EAArF,eAAW,EAAE,cAAoD,EAA1C,qBAAiB,EAAE,yBAAqB,EAAwB,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACjH,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAC1B,CAAC;AACD,GAAG,CAAC,CAAC,IAAA,8EACoF,EAD/E,eAAW,EAAE,cAAoD,EAA1C,qBAAiB,EAAE,yBAAqB,EAErE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACpB,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAC1B,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForObjectBindingPattern.sourcemap.txt b/tests/baselines/reference/sourceMapValidationDestructuringForObjectBindingPattern.sourcemap.txt new file mode 100644 index 00000000000..61689b46799 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForObjectBindingPattern.sourcemap.txt @@ -0,0 +1,1490 @@ +=================================================================== +JsFile: sourceMapValidationDestructuringForObjectBindingPattern.js +mapUrl: sourceMapValidationDestructuringForObjectBindingPattern.js.map +sourceRoot: +sources: sourceMapValidationDestructuringForObjectBindingPattern.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/sourceMapValidationDestructuringForObjectBindingPattern.js +sourceFile:sourceMapValidationDestructuringForObjectBindingPattern.ts +------------------------------------------------------------------- +>>>var robot = { name: "mower", skill: "mowing" }; +1 > +2 >^^^^ +3 > ^^^^^ +4 > ^^^ +5 > ^^ +6 > ^^^^ +7 > ^^ +8 > ^^^^^^^ +9 > ^^ +10> ^^^^^ +11> ^^ +12> ^^^^^^^^ +13> ^^ +14> ^ +15> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 >declare var console: { + > log(msg: any): void; + >} + >interface Robot { + > name: string; + > skill: string; + >} + > + >interface MultiRobot { + > name: string; + > skills: { + > primary: string; + > secondary: string; + > }; + >} + > + > +2 >let +3 > robot +4 > : Robot = +5 > { +6 > name +7 > : +8 > "mower" +9 > , +10> skill +11> : +12> "mowing" +13> } +14> ; +1 >Emitted(1, 1) Source(17, 1) + SourceIndex(0) +2 >Emitted(1, 5) Source(17, 5) + SourceIndex(0) +3 >Emitted(1, 10) Source(17, 10) + SourceIndex(0) +4 >Emitted(1, 13) Source(17, 20) + SourceIndex(0) +5 >Emitted(1, 15) Source(17, 22) + SourceIndex(0) +6 >Emitted(1, 19) Source(17, 26) + SourceIndex(0) +7 >Emitted(1, 21) Source(17, 28) + SourceIndex(0) +8 >Emitted(1, 28) Source(17, 35) + SourceIndex(0) +9 >Emitted(1, 30) Source(17, 37) + SourceIndex(0) +10>Emitted(1, 35) Source(17, 42) + SourceIndex(0) +11>Emitted(1, 37) Source(17, 44) + SourceIndex(0) +12>Emitted(1, 45) Source(17, 52) + SourceIndex(0) +13>Emitted(1, 47) Source(17, 54) + SourceIndex(0) +14>Emitted(1, 48) Source(17, 55) + SourceIndex(0) +--- +>>>var multiRobot = { name: "mower", skills: { primary: "mowing", secondary: "none" } }; +1-> +2 >^^^^ +3 > ^^^^^^^^^^ +4 > ^^^ +5 > ^^ +6 > ^^^^ +7 > ^^ +8 > ^^^^^^^ +9 > ^^ +10> ^^^^^^ +11> ^^ +12> ^^ +13> ^^^^^^^ +14> ^^ +15> ^^^^^^^^ +16> ^^ +17> ^^^^^^^^^ +18> ^^ +19> ^^^^^^ +20> ^^ +21> ^^ +22> ^ +1-> + > +2 >let +3 > multiRobot +4 > : MultiRobot = +5 > { +6 > name +7 > : +8 > "mower" +9 > , +10> skills +11> : +12> { +13> primary +14> : +15> "mowing" +16> , +17> secondary +18> : +19> "none" +20> } +21> } +22> ; +1->Emitted(2, 1) Source(18, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(18, 5) + SourceIndex(0) +3 >Emitted(2, 15) Source(18, 15) + SourceIndex(0) +4 >Emitted(2, 18) Source(18, 30) + SourceIndex(0) +5 >Emitted(2, 20) Source(18, 32) + SourceIndex(0) +6 >Emitted(2, 24) Source(18, 36) + SourceIndex(0) +7 >Emitted(2, 26) Source(18, 38) + SourceIndex(0) +8 >Emitted(2, 33) Source(18, 45) + SourceIndex(0) +9 >Emitted(2, 35) Source(18, 47) + SourceIndex(0) +10>Emitted(2, 41) Source(18, 53) + SourceIndex(0) +11>Emitted(2, 43) Source(18, 55) + SourceIndex(0) +12>Emitted(2, 45) Source(18, 57) + SourceIndex(0) +13>Emitted(2, 52) Source(18, 64) + SourceIndex(0) +14>Emitted(2, 54) Source(18, 66) + SourceIndex(0) +15>Emitted(2, 62) Source(18, 74) + SourceIndex(0) +16>Emitted(2, 64) Source(18, 76) + SourceIndex(0) +17>Emitted(2, 73) Source(18, 85) + SourceIndex(0) +18>Emitted(2, 75) Source(18, 87) + SourceIndex(0) +19>Emitted(2, 81) Source(18, 93) + SourceIndex(0) +20>Emitted(2, 83) Source(18, 95) + SourceIndex(0) +21>Emitted(2, 85) Source(18, 97) + SourceIndex(0) +22>Emitted(2, 86) Source(18, 98) + SourceIndex(0) +--- +>>>function getRobot() { +1 > +2 >^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(3, 1) Source(19, 1) + SourceIndex(0) +--- +>>> return robot; +1->^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^ +5 > ^ +1->function getRobot() { + > +2 > return +3 > +4 > robot +5 > ; +1->Emitted(4, 5) Source(20, 5) + SourceIndex(0) +2 >Emitted(4, 11) Source(20, 11) + SourceIndex(0) +3 >Emitted(4, 12) Source(20, 12) + SourceIndex(0) +4 >Emitted(4, 17) Source(20, 17) + SourceIndex(0) +5 >Emitted(4, 18) Source(20, 18) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(5, 1) Source(21, 1) + SourceIndex(0) +2 >Emitted(5, 2) Source(21, 2) + SourceIndex(0) +--- +>>>function getMultiRobot() { +1-> +2 >^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(6, 1) Source(22, 1) + SourceIndex(0) +--- +>>> return multiRobot; +1->^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^ +5 > ^ +1->function getMultiRobot() { + > +2 > return +3 > +4 > multiRobot +5 > ; +1->Emitted(7, 5) Source(23, 5) + SourceIndex(0) +2 >Emitted(7, 11) Source(23, 11) + SourceIndex(0) +3 >Emitted(7, 12) Source(23, 12) + SourceIndex(0) +4 >Emitted(7, 22) Source(23, 22) + SourceIndex(0) +5 >Emitted(7, 23) Source(23, 23) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(8, 1) Source(24, 1) + SourceIndex(0) +2 >Emitted(8, 2) Source(24, 2) + SourceIndex(0) +--- +>>>for (var nameA = robot.name, i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^^^^^^^^^^^^ +6 > ^^ +7 > ^ +8 > ^^^ +9 > ^ +10> ^^ +11> ^ +12> ^^^ +13> ^ +14> ^^ +15> ^ +16> ^^ +17> ^^ +18> ^ +1-> + > + > +2 >for +3 > +4 > (let { +5 > name: nameA +6 > } = robot, +7 > i +8 > = +9 > 0 +10> ; +11> i +12> < +13> 1 +14> ; +15> i +16> ++ +17> ) +18> { +1->Emitted(9, 1) Source(26, 1) + SourceIndex(0) +2 >Emitted(9, 4) Source(26, 4) + SourceIndex(0) +3 >Emitted(9, 5) Source(26, 5) + SourceIndex(0) +4 >Emitted(9, 6) Source(26, 11) + SourceIndex(0) +5 >Emitted(9, 28) Source(26, 22) + SourceIndex(0) +6 >Emitted(9, 30) Source(26, 34) + SourceIndex(0) +7 >Emitted(9, 31) Source(26, 35) + SourceIndex(0) +8 >Emitted(9, 34) Source(26, 38) + SourceIndex(0) +9 >Emitted(9, 35) Source(26, 39) + SourceIndex(0) +10>Emitted(9, 37) Source(26, 41) + SourceIndex(0) +11>Emitted(9, 38) Source(26, 42) + SourceIndex(0) +12>Emitted(9, 41) Source(26, 45) + SourceIndex(0) +13>Emitted(9, 42) Source(26, 46) + SourceIndex(0) +14>Emitted(9, 44) Source(26, 48) + SourceIndex(0) +15>Emitted(9, 45) Source(26, 49) + SourceIndex(0) +16>Emitted(9, 47) Source(26, 51) + SourceIndex(0) +17>Emitted(9, 49) Source(26, 53) + SourceIndex(0) +18>Emitted(9, 50) Source(26, 54) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(10, 5) Source(27, 5) + SourceIndex(0) +2 >Emitted(10, 12) Source(27, 12) + SourceIndex(0) +3 >Emitted(10, 13) Source(27, 13) + SourceIndex(0) +4 >Emitted(10, 16) Source(27, 16) + SourceIndex(0) +5 >Emitted(10, 17) Source(27, 17) + SourceIndex(0) +6 >Emitted(10, 22) Source(27, 22) + SourceIndex(0) +7 >Emitted(10, 23) Source(27, 23) + SourceIndex(0) +8 >Emitted(10, 24) Source(27, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(11, 1) Source(28, 1) + SourceIndex(0) +2 >Emitted(11, 2) Source(28, 2) + SourceIndex(0) +--- +>>>for (var nameA = getRobot().name, i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +6 > ^^ +7 > ^ +8 > ^^^ +9 > ^ +10> ^^ +11> ^ +12> ^^^ +13> ^ +14> ^^ +15> ^ +16> ^^ +17> ^^ +18> ^ +1-> + > +2 >for +3 > +4 > (let { +5 > name: nameA +6 > } = getRobot(), +7 > i +8 > = +9 > 0 +10> ; +11> i +12> < +13> 1 +14> ; +15> i +16> ++ +17> ) +18> { +1->Emitted(12, 1) Source(29, 1) + SourceIndex(0) +2 >Emitted(12, 4) Source(29, 4) + SourceIndex(0) +3 >Emitted(12, 5) Source(29, 5) + SourceIndex(0) +4 >Emitted(12, 6) Source(29, 11) + SourceIndex(0) +5 >Emitted(12, 33) Source(29, 22) + SourceIndex(0) +6 >Emitted(12, 35) Source(29, 39) + SourceIndex(0) +7 >Emitted(12, 36) Source(29, 40) + SourceIndex(0) +8 >Emitted(12, 39) Source(29, 43) + SourceIndex(0) +9 >Emitted(12, 40) Source(29, 44) + SourceIndex(0) +10>Emitted(12, 42) Source(29, 46) + SourceIndex(0) +11>Emitted(12, 43) Source(29, 47) + SourceIndex(0) +12>Emitted(12, 46) Source(29, 50) + SourceIndex(0) +13>Emitted(12, 47) Source(29, 51) + SourceIndex(0) +14>Emitted(12, 49) Source(29, 53) + SourceIndex(0) +15>Emitted(12, 50) Source(29, 54) + SourceIndex(0) +16>Emitted(12, 52) Source(29, 56) + SourceIndex(0) +17>Emitted(12, 54) Source(29, 58) + SourceIndex(0) +18>Emitted(12, 55) Source(29, 59) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(13, 5) Source(30, 5) + SourceIndex(0) +2 >Emitted(13, 12) Source(30, 12) + SourceIndex(0) +3 >Emitted(13, 13) Source(30, 13) + SourceIndex(0) +4 >Emitted(13, 16) Source(30, 16) + SourceIndex(0) +5 >Emitted(13, 17) Source(30, 17) + SourceIndex(0) +6 >Emitted(13, 22) Source(30, 22) + SourceIndex(0) +7 >Emitted(13, 23) Source(30, 23) + SourceIndex(0) +8 >Emitted(13, 24) Source(30, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(14, 1) Source(31, 1) + SourceIndex(0) +2 >Emitted(14, 2) Source(31, 2) + SourceIndex(0) +--- +>>>for (var nameA = { name: "trimmer", skill: "trimming" }.name, i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +6 > ^^ +7 > ^ +8 > ^^^ +9 > ^ +10> ^^ +11> ^ +12> ^^^ +13> ^ +14> ^^ +15> ^ +16> ^^ +17> ^^ +18> ^ +1-> + > +2 >for +3 > +4 > (let { +5 > name: nameA +6 > } = { name: "trimmer", skill: "trimming" }, +7 > i +8 > = +9 > 0 +10> ; +11> i +12> < +13> 1 +14> ; +15> i +16> ++ +17> ) +18> { +1->Emitted(15, 1) Source(32, 1) + SourceIndex(0) +2 >Emitted(15, 4) Source(32, 4) + SourceIndex(0) +3 >Emitted(15, 5) Source(32, 5) + SourceIndex(0) +4 >Emitted(15, 6) Source(32, 11) + SourceIndex(0) +5 >Emitted(15, 61) Source(32, 22) + SourceIndex(0) +6 >Emitted(15, 63) Source(32, 74) + SourceIndex(0) +7 >Emitted(15, 64) Source(32, 75) + SourceIndex(0) +8 >Emitted(15, 67) Source(32, 78) + SourceIndex(0) +9 >Emitted(15, 68) Source(32, 79) + SourceIndex(0) +10>Emitted(15, 70) Source(32, 81) + SourceIndex(0) +11>Emitted(15, 71) Source(32, 82) + SourceIndex(0) +12>Emitted(15, 74) Source(32, 85) + SourceIndex(0) +13>Emitted(15, 75) Source(32, 86) + SourceIndex(0) +14>Emitted(15, 77) Source(32, 88) + SourceIndex(0) +15>Emitted(15, 78) Source(32, 89) + SourceIndex(0) +16>Emitted(15, 80) Source(32, 91) + SourceIndex(0) +17>Emitted(15, 82) Source(32, 93) + SourceIndex(0) +18>Emitted(15, 83) Source(32, 94) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(16, 5) Source(33, 5) + SourceIndex(0) +2 >Emitted(16, 12) Source(33, 12) + SourceIndex(0) +3 >Emitted(16, 13) Source(33, 13) + SourceIndex(0) +4 >Emitted(16, 16) Source(33, 16) + SourceIndex(0) +5 >Emitted(16, 17) Source(33, 17) + SourceIndex(0) +6 >Emitted(16, 22) Source(33, 22) + SourceIndex(0) +7 >Emitted(16, 23) Source(33, 23) + SourceIndex(0) +8 >Emitted(16, 24) Source(33, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(17, 1) Source(34, 1) + SourceIndex(0) +2 >Emitted(17, 2) Source(34, 2) + SourceIndex(0) +--- +>>>for (var _a = multiRobot.skills, primaryA = _a.primary, secondaryA = _a.secondary, i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^^^^^^^^^^^ +10> ^^ +11> ^ +12> ^^^ +13> ^ +14> ^^ +15> ^ +16> ^^^ +17> ^ +18> ^^ +19> ^ +20> ^^ +21> ^^ +22> ^ +1-> + > +2 >for +3 > +4 > (let { +5 > skills: { primary: primaryA, secondary: secondaryA } +6 > +7 > primary: primaryA +8 > , +9 > secondary: secondaryA +10> } } = multiRobot, +11> i +12> = +13> 0 +14> ; +15> i +16> < +17> 1 +18> ; +19> i +20> ++ +21> ) +22> { +1->Emitted(18, 1) Source(35, 1) + SourceIndex(0) +2 >Emitted(18, 4) Source(35, 4) + SourceIndex(0) +3 >Emitted(18, 5) Source(35, 5) + SourceIndex(0) +4 >Emitted(18, 6) Source(35, 12) + SourceIndex(0) +5 >Emitted(18, 32) Source(35, 64) + SourceIndex(0) +6 >Emitted(18, 34) Source(35, 22) + SourceIndex(0) +7 >Emitted(18, 55) Source(35, 39) + SourceIndex(0) +8 >Emitted(18, 57) Source(35, 41) + SourceIndex(0) +9 >Emitted(18, 82) Source(35, 62) + SourceIndex(0) +10>Emitted(18, 84) Source(35, 81) + SourceIndex(0) +11>Emitted(18, 85) Source(35, 82) + SourceIndex(0) +12>Emitted(18, 88) Source(35, 85) + SourceIndex(0) +13>Emitted(18, 89) Source(35, 86) + SourceIndex(0) +14>Emitted(18, 91) Source(35, 88) + SourceIndex(0) +15>Emitted(18, 92) Source(35, 89) + SourceIndex(0) +16>Emitted(18, 95) Source(35, 92) + SourceIndex(0) +17>Emitted(18, 96) Source(35, 93) + SourceIndex(0) +18>Emitted(18, 98) Source(35, 95) + SourceIndex(0) +19>Emitted(18, 99) Source(35, 96) + SourceIndex(0) +20>Emitted(18, 101) Source(35, 98) + SourceIndex(0) +21>Emitted(18, 103) Source(35, 100) + SourceIndex(0) +22>Emitted(18, 104) Source(35, 101) + SourceIndex(0) +--- +>>> console.log(primaryA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > primaryA +7 > ) +8 > ; +1 >Emitted(19, 5) Source(36, 5) + SourceIndex(0) +2 >Emitted(19, 12) Source(36, 12) + SourceIndex(0) +3 >Emitted(19, 13) Source(36, 13) + SourceIndex(0) +4 >Emitted(19, 16) Source(36, 16) + SourceIndex(0) +5 >Emitted(19, 17) Source(36, 17) + SourceIndex(0) +6 >Emitted(19, 25) Source(36, 25) + SourceIndex(0) +7 >Emitted(19, 26) Source(36, 26) + SourceIndex(0) +8 >Emitted(19, 27) Source(36, 27) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(20, 1) Source(37, 1) + SourceIndex(0) +2 >Emitted(20, 2) Source(37, 2) + SourceIndex(0) +--- +>>>for (var _b = getMultiRobot().skills, primaryA = _b.primary, secondaryA = _b.secondary, i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^^^^^^^^^^^ +10> ^^ +11> ^ +12> ^^^ +13> ^ +14> ^^ +15> ^ +16> ^^^ +17> ^ +18> ^^ +19> ^ +20> ^^ +21> ^^ +22> ^ +1-> + > +2 >for +3 > +4 > (let { +5 > skills: { primary: primaryA, secondary: secondaryA } +6 > +7 > primary: primaryA +8 > , +9 > secondary: secondaryA +10> } } = getMultiRobot(), +11> i +12> = +13> 0 +14> ; +15> i +16> < +17> 1 +18> ; +19> i +20> ++ +21> ) +22> { +1->Emitted(21, 1) Source(38, 1) + SourceIndex(0) +2 >Emitted(21, 4) Source(38, 4) + SourceIndex(0) +3 >Emitted(21, 5) Source(38, 5) + SourceIndex(0) +4 >Emitted(21, 6) Source(38, 12) + SourceIndex(0) +5 >Emitted(21, 37) Source(38, 64) + SourceIndex(0) +6 >Emitted(21, 39) Source(38, 22) + SourceIndex(0) +7 >Emitted(21, 60) Source(38, 39) + SourceIndex(0) +8 >Emitted(21, 62) Source(38, 41) + SourceIndex(0) +9 >Emitted(21, 87) Source(38, 62) + SourceIndex(0) +10>Emitted(21, 89) Source(38, 86) + SourceIndex(0) +11>Emitted(21, 90) Source(38, 87) + SourceIndex(0) +12>Emitted(21, 93) Source(38, 90) + SourceIndex(0) +13>Emitted(21, 94) Source(38, 91) + SourceIndex(0) +14>Emitted(21, 96) Source(38, 93) + SourceIndex(0) +15>Emitted(21, 97) Source(38, 94) + SourceIndex(0) +16>Emitted(21, 100) Source(38, 97) + SourceIndex(0) +17>Emitted(21, 101) Source(38, 98) + SourceIndex(0) +18>Emitted(21, 103) Source(38, 100) + SourceIndex(0) +19>Emitted(21, 104) Source(38, 101) + SourceIndex(0) +20>Emitted(21, 106) Source(38, 103) + SourceIndex(0) +21>Emitted(21, 108) Source(38, 105) + SourceIndex(0) +22>Emitted(21, 109) Source(38, 106) + SourceIndex(0) +--- +>>> console.log(primaryA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > primaryA +7 > ) +8 > ; +1 >Emitted(22, 5) Source(39, 5) + SourceIndex(0) +2 >Emitted(22, 12) Source(39, 12) + SourceIndex(0) +3 >Emitted(22, 13) Source(39, 13) + SourceIndex(0) +4 >Emitted(22, 16) Source(39, 16) + SourceIndex(0) +5 >Emitted(22, 17) Source(39, 17) + SourceIndex(0) +6 >Emitted(22, 25) Source(39, 25) + SourceIndex(0) +7 >Emitted(22, 26) Source(39, 26) + SourceIndex(0) +8 >Emitted(22, 27) Source(39, 27) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(23, 1) Source(40, 1) + SourceIndex(0) +2 >Emitted(23, 2) Source(40, 2) + SourceIndex(0) +--- +>>>for (var _c = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }.skills, primaryA = _c.primary, secondaryA = _c.secondary, i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^^^^^^^^^^^ +10> ^^ +11> ^ +12> ^^^ +13> ^ +14> ^^ +15> ^ +16> ^^^ +17> ^ +18> ^^ +19> ^ +20> ^^ +21> ^^ +22> ^ +1-> + > +2 >for +3 > +4 > (let { +5 > skills: { primary: primaryA, secondary: secondaryA } +6 > +7 > primary: primaryA +8 > , +9 > secondary: secondaryA +10> } } = + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, + > +11> i +12> = +13> 0 +14> ; +15> i +16> < +17> 1 +18> ; +19> i +20> ++ +21> ) +22> { +1->Emitted(24, 1) Source(41, 1) + SourceIndex(0) +2 >Emitted(24, 4) Source(41, 4) + SourceIndex(0) +3 >Emitted(24, 5) Source(41, 5) + SourceIndex(0) +4 >Emitted(24, 6) Source(41, 12) + SourceIndex(0) +5 >Emitted(24, 95) Source(41, 64) + SourceIndex(0) +6 >Emitted(24, 97) Source(41, 22) + SourceIndex(0) +7 >Emitted(24, 118) Source(41, 39) + SourceIndex(0) +8 >Emitted(24, 120) Source(41, 41) + SourceIndex(0) +9 >Emitted(24, 145) Source(41, 62) + SourceIndex(0) +10>Emitted(24, 147) Source(43, 5) + SourceIndex(0) +11>Emitted(24, 148) Source(43, 6) + SourceIndex(0) +12>Emitted(24, 151) Source(43, 9) + SourceIndex(0) +13>Emitted(24, 152) Source(43, 10) + SourceIndex(0) +14>Emitted(24, 154) Source(43, 12) + SourceIndex(0) +15>Emitted(24, 155) Source(43, 13) + SourceIndex(0) +16>Emitted(24, 158) Source(43, 16) + SourceIndex(0) +17>Emitted(24, 159) Source(43, 17) + SourceIndex(0) +18>Emitted(24, 161) Source(43, 19) + SourceIndex(0) +19>Emitted(24, 162) Source(43, 20) + SourceIndex(0) +20>Emitted(24, 164) Source(43, 22) + SourceIndex(0) +21>Emitted(24, 166) Source(43, 24) + SourceIndex(0) +22>Emitted(24, 167) Source(43, 25) + SourceIndex(0) +--- +>>> console.log(primaryA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > primaryA +7 > ) +8 > ; +1 >Emitted(25, 5) Source(44, 5) + SourceIndex(0) +2 >Emitted(25, 12) Source(44, 12) + SourceIndex(0) +3 >Emitted(25, 13) Source(44, 13) + SourceIndex(0) +4 >Emitted(25, 16) Source(44, 16) + SourceIndex(0) +5 >Emitted(25, 17) Source(44, 17) + SourceIndex(0) +6 >Emitted(25, 25) Source(44, 25) + SourceIndex(0) +7 >Emitted(25, 26) Source(44, 26) + SourceIndex(0) +8 >Emitted(25, 27) Source(44, 27) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(26, 1) Source(45, 1) + SourceIndex(0) +2 >Emitted(26, 2) Source(45, 2) + SourceIndex(0) +--- +>>>for (var nameA = robot.name, skillA = robot.skill, i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^ +10> ^^^ +11> ^ +12> ^^ +13> ^ +14> ^^^ +15> ^ +16> ^^ +17> ^ +18> ^^ +19> ^^ +20> ^ +1-> + > + > +2 >for +3 > +4 > (let { +5 > name: nameA +6 > , +7 > skill: skillA +8 > } = robot, +9 > i +10> = +11> 0 +12> ; +13> i +14> < +15> 1 +16> ; +17> i +18> ++ +19> ) +20> { +1->Emitted(27, 1) Source(47, 1) + SourceIndex(0) +2 >Emitted(27, 4) Source(47, 4) + SourceIndex(0) +3 >Emitted(27, 5) Source(47, 5) + SourceIndex(0) +4 >Emitted(27, 6) Source(47, 11) + SourceIndex(0) +5 >Emitted(27, 28) Source(47, 22) + SourceIndex(0) +6 >Emitted(27, 30) Source(47, 24) + SourceIndex(0) +7 >Emitted(27, 50) Source(47, 37) + SourceIndex(0) +8 >Emitted(27, 52) Source(47, 49) + SourceIndex(0) +9 >Emitted(27, 53) Source(47, 50) + SourceIndex(0) +10>Emitted(27, 56) Source(47, 53) + SourceIndex(0) +11>Emitted(27, 57) Source(47, 54) + SourceIndex(0) +12>Emitted(27, 59) Source(47, 56) + SourceIndex(0) +13>Emitted(27, 60) Source(47, 57) + SourceIndex(0) +14>Emitted(27, 63) Source(47, 60) + SourceIndex(0) +15>Emitted(27, 64) Source(47, 61) + SourceIndex(0) +16>Emitted(27, 66) Source(47, 63) + SourceIndex(0) +17>Emitted(27, 67) Source(47, 64) + SourceIndex(0) +18>Emitted(27, 69) Source(47, 66) + SourceIndex(0) +19>Emitted(27, 71) Source(47, 68) + SourceIndex(0) +20>Emitted(27, 72) Source(47, 69) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(28, 5) Source(48, 5) + SourceIndex(0) +2 >Emitted(28, 12) Source(48, 12) + SourceIndex(0) +3 >Emitted(28, 13) Source(48, 13) + SourceIndex(0) +4 >Emitted(28, 16) Source(48, 16) + SourceIndex(0) +5 >Emitted(28, 17) Source(48, 17) + SourceIndex(0) +6 >Emitted(28, 22) Source(48, 22) + SourceIndex(0) +7 >Emitted(28, 23) Source(48, 23) + SourceIndex(0) +8 >Emitted(28, 24) Source(48, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(29, 1) Source(49, 1) + SourceIndex(0) +2 >Emitted(29, 2) Source(49, 2) + SourceIndex(0) +--- +>>>for (var _d = getRobot(), nameA = _d.name, skillA = _d.skill, i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^ +6 > ^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^ +13> ^^^ +14> ^ +15> ^^ +16> ^ +17> ^^^ +18> ^ +19> ^^ +20> ^ +21> ^^ +22> ^^ +23> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > let {name: nameA, skill: skillA } = getRobot() +7 > +8 > name: nameA +9 > , +10> skill: skillA +11> } = getRobot(), +12> i +13> = +14> 0 +15> ; +16> i +17> < +18> 1 +19> ; +20> i +21> ++ +22> ) +23> { +1->Emitted(30, 1) Source(50, 1) + SourceIndex(0) +2 >Emitted(30, 4) Source(50, 4) + SourceIndex(0) +3 >Emitted(30, 5) Source(50, 5) + SourceIndex(0) +4 >Emitted(30, 6) Source(50, 6) + SourceIndex(0) +5 >Emitted(30, 10) Source(50, 6) + SourceIndex(0) +6 >Emitted(30, 25) Source(50, 52) + SourceIndex(0) +7 >Emitted(30, 27) Source(50, 11) + SourceIndex(0) +8 >Emitted(30, 42) Source(50, 22) + SourceIndex(0) +9 >Emitted(30, 44) Source(50, 24) + SourceIndex(0) +10>Emitted(30, 61) Source(50, 37) + SourceIndex(0) +11>Emitted(30, 63) Source(50, 54) + SourceIndex(0) +12>Emitted(30, 64) Source(50, 55) + SourceIndex(0) +13>Emitted(30, 67) Source(50, 58) + SourceIndex(0) +14>Emitted(30, 68) Source(50, 59) + SourceIndex(0) +15>Emitted(30, 70) Source(50, 61) + SourceIndex(0) +16>Emitted(30, 71) Source(50, 62) + SourceIndex(0) +17>Emitted(30, 74) Source(50, 65) + SourceIndex(0) +18>Emitted(30, 75) Source(50, 66) + SourceIndex(0) +19>Emitted(30, 77) Source(50, 68) + SourceIndex(0) +20>Emitted(30, 78) Source(50, 69) + SourceIndex(0) +21>Emitted(30, 80) Source(50, 71) + SourceIndex(0) +22>Emitted(30, 82) Source(50, 73) + SourceIndex(0) +23>Emitted(30, 83) Source(50, 74) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(31, 5) Source(51, 5) + SourceIndex(0) +2 >Emitted(31, 12) Source(51, 12) + SourceIndex(0) +3 >Emitted(31, 13) Source(51, 13) + SourceIndex(0) +4 >Emitted(31, 16) Source(51, 16) + SourceIndex(0) +5 >Emitted(31, 17) Source(51, 17) + SourceIndex(0) +6 >Emitted(31, 22) Source(51, 22) + SourceIndex(0) +7 >Emitted(31, 23) Source(51, 23) + SourceIndex(0) +8 >Emitted(31, 24) Source(51, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(32, 1) Source(52, 1) + SourceIndex(0) +2 >Emitted(32, 2) Source(52, 2) + SourceIndex(0) +--- +>>>for (var _e = { name: "trimmer", skill: "trimming" }, nameA = _e.name, skillA = _e.skill, i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^ +13> ^^^ +14> ^ +15> ^^ +16> ^ +17> ^^^ +18> ^ +19> ^^ +20> ^ +21> ^^ +22> ^^ +23> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > let {name: nameA, skill: skillA } = { name: "trimmer", skill: "trimming" } +7 > +8 > name: nameA +9 > , +10> skill: skillA +11> } = { name: "trimmer", skill: "trimming" }, +12> i +13> = +14> 0 +15> ; +16> i +17> < +18> 1 +19> ; +20> i +21> ++ +22> ) +23> { +1->Emitted(33, 1) Source(53, 1) + SourceIndex(0) +2 >Emitted(33, 4) Source(53, 4) + SourceIndex(0) +3 >Emitted(33, 5) Source(53, 5) + SourceIndex(0) +4 >Emitted(33, 6) Source(53, 6) + SourceIndex(0) +5 >Emitted(33, 10) Source(53, 6) + SourceIndex(0) +6 >Emitted(33, 53) Source(53, 87) + SourceIndex(0) +7 >Emitted(33, 55) Source(53, 11) + SourceIndex(0) +8 >Emitted(33, 70) Source(53, 22) + SourceIndex(0) +9 >Emitted(33, 72) Source(53, 24) + SourceIndex(0) +10>Emitted(33, 89) Source(53, 37) + SourceIndex(0) +11>Emitted(33, 91) Source(53, 89) + SourceIndex(0) +12>Emitted(33, 92) Source(53, 90) + SourceIndex(0) +13>Emitted(33, 95) Source(53, 93) + SourceIndex(0) +14>Emitted(33, 96) Source(53, 94) + SourceIndex(0) +15>Emitted(33, 98) Source(53, 96) + SourceIndex(0) +16>Emitted(33, 99) Source(53, 97) + SourceIndex(0) +17>Emitted(33, 102) Source(53, 100) + SourceIndex(0) +18>Emitted(33, 103) Source(53, 101) + SourceIndex(0) +19>Emitted(33, 105) Source(53, 103) + SourceIndex(0) +20>Emitted(33, 106) Source(53, 104) + SourceIndex(0) +21>Emitted(33, 108) Source(53, 106) + SourceIndex(0) +22>Emitted(33, 110) Source(53, 108) + SourceIndex(0) +23>Emitted(33, 111) Source(53, 109) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(34, 5) Source(54, 5) + SourceIndex(0) +2 >Emitted(34, 12) Source(54, 12) + SourceIndex(0) +3 >Emitted(34, 13) Source(54, 13) + SourceIndex(0) +4 >Emitted(34, 16) Source(54, 16) + SourceIndex(0) +5 >Emitted(34, 17) Source(54, 17) + SourceIndex(0) +6 >Emitted(34, 22) Source(54, 22) + SourceIndex(0) +7 >Emitted(34, 23) Source(54, 23) + SourceIndex(0) +8 >Emitted(34, 24) Source(54, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(35, 1) Source(55, 1) + SourceIndex(0) +2 >Emitted(35, 2) Source(55, 2) + SourceIndex(0) +--- +>>>for (var nameA = multiRobot.name, _f = multiRobot.skills, primaryA = _f.primary, secondaryA = _f.secondary, i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^^^^^^^ +10> ^^ +11> ^^^^^^^^^^^^^^^^^^^^^^^^^ +12> ^^ +13> ^ +14> ^^^ +15> ^ +16> ^^ +17> ^ +18> ^^^ +19> ^ +20> ^^ +21> ^ +22> ^^ +23> ^^ +24> ^ +1-> + > +2 >for +3 > +4 > (let { +5 > name: nameA +6 > , +7 > skills: { primary: primaryA, secondary: secondaryA } +8 > +9 > primary: primaryA +10> , +11> secondary: secondaryA +12> } } = multiRobot, +13> i +14> = +15> 0 +16> ; +17> i +18> < +19> 1 +20> ; +21> i +22> ++ +23> ) +24> { +1->Emitted(36, 1) Source(56, 1) + SourceIndex(0) +2 >Emitted(36, 4) Source(56, 4) + SourceIndex(0) +3 >Emitted(36, 5) Source(56, 5) + SourceIndex(0) +4 >Emitted(36, 6) Source(56, 11) + SourceIndex(0) +5 >Emitted(36, 33) Source(56, 22) + SourceIndex(0) +6 >Emitted(36, 35) Source(56, 24) + SourceIndex(0) +7 >Emitted(36, 57) Source(56, 76) + SourceIndex(0) +8 >Emitted(36, 59) Source(56, 34) + SourceIndex(0) +9 >Emitted(36, 80) Source(56, 51) + SourceIndex(0) +10>Emitted(36, 82) Source(56, 53) + SourceIndex(0) +11>Emitted(36, 107) Source(56, 74) + SourceIndex(0) +12>Emitted(36, 109) Source(56, 93) + SourceIndex(0) +13>Emitted(36, 110) Source(56, 94) + SourceIndex(0) +14>Emitted(36, 113) Source(56, 97) + SourceIndex(0) +15>Emitted(36, 114) Source(56, 98) + SourceIndex(0) +16>Emitted(36, 116) Source(56, 100) + SourceIndex(0) +17>Emitted(36, 117) Source(56, 101) + SourceIndex(0) +18>Emitted(36, 120) Source(56, 104) + SourceIndex(0) +19>Emitted(36, 121) Source(56, 105) + SourceIndex(0) +20>Emitted(36, 123) Source(56, 107) + SourceIndex(0) +21>Emitted(36, 124) Source(56, 108) + SourceIndex(0) +22>Emitted(36, 126) Source(56, 110) + SourceIndex(0) +23>Emitted(36, 128) Source(56, 112) + SourceIndex(0) +24>Emitted(36, 129) Source(56, 113) + SourceIndex(0) +--- +>>> console.log(primaryA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > primaryA +7 > ) +8 > ; +1 >Emitted(37, 5) Source(57, 5) + SourceIndex(0) +2 >Emitted(37, 12) Source(57, 12) + SourceIndex(0) +3 >Emitted(37, 13) Source(57, 13) + SourceIndex(0) +4 >Emitted(37, 16) Source(57, 16) + SourceIndex(0) +5 >Emitted(37, 17) Source(57, 17) + SourceIndex(0) +6 >Emitted(37, 25) Source(57, 25) + SourceIndex(0) +7 >Emitted(37, 26) Source(57, 26) + SourceIndex(0) +8 >Emitted(37, 27) Source(57, 27) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(38, 1) Source(58, 1) + SourceIndex(0) +2 >Emitted(38, 2) Source(58, 2) + SourceIndex(0) +--- +>>>for (var _g = getMultiRobot(), nameA = _g.name, _h = _g.skills, primaryA = _h.primary, secondaryA = _h.secondary, i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^ +6 > ^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^^^^^^^^^^^^ +15> ^^ +16> ^ +17> ^^^ +18> ^ +19> ^^ +20> ^ +21> ^^^ +22> ^ +23> ^^ +24> ^ +25> ^^ +26> ^^ +27> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = getMultiRobot() +7 > +8 > name: nameA +9 > , +10> skills: { primary: primaryA, secondary: secondaryA } +11> +12> primary: primaryA +13> , +14> secondary: secondaryA +15> } } = getMultiRobot(), +16> i +17> = +18> 0 +19> ; +20> i +21> < +22> 1 +23> ; +24> i +25> ++ +26> ) +27> { +1->Emitted(39, 1) Source(59, 1) + SourceIndex(0) +2 >Emitted(39, 4) Source(59, 4) + SourceIndex(0) +3 >Emitted(39, 5) Source(59, 5) + SourceIndex(0) +4 >Emitted(39, 6) Source(59, 6) + SourceIndex(0) +5 >Emitted(39, 10) Source(59, 6) + SourceIndex(0) +6 >Emitted(39, 30) Source(59, 96) + SourceIndex(0) +7 >Emitted(39, 32) Source(59, 11) + SourceIndex(0) +8 >Emitted(39, 47) Source(59, 22) + SourceIndex(0) +9 >Emitted(39, 49) Source(59, 24) + SourceIndex(0) +10>Emitted(39, 63) Source(59, 76) + SourceIndex(0) +11>Emitted(39, 65) Source(59, 34) + SourceIndex(0) +12>Emitted(39, 86) Source(59, 51) + SourceIndex(0) +13>Emitted(39, 88) Source(59, 53) + SourceIndex(0) +14>Emitted(39, 113) Source(59, 74) + SourceIndex(0) +15>Emitted(39, 115) Source(59, 98) + SourceIndex(0) +16>Emitted(39, 116) Source(59, 99) + SourceIndex(0) +17>Emitted(39, 119) Source(59, 102) + SourceIndex(0) +18>Emitted(39, 120) Source(59, 103) + SourceIndex(0) +19>Emitted(39, 122) Source(59, 105) + SourceIndex(0) +20>Emitted(39, 123) Source(59, 106) + SourceIndex(0) +21>Emitted(39, 126) Source(59, 109) + SourceIndex(0) +22>Emitted(39, 127) Source(59, 110) + SourceIndex(0) +23>Emitted(39, 129) Source(59, 112) + SourceIndex(0) +24>Emitted(39, 130) Source(59, 113) + SourceIndex(0) +25>Emitted(39, 132) Source(59, 115) + SourceIndex(0) +26>Emitted(39, 134) Source(59, 117) + SourceIndex(0) +27>Emitted(39, 135) Source(59, 118) + SourceIndex(0) +--- +>>> console.log(primaryA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > primaryA +7 > ) +8 > ; +1 >Emitted(40, 5) Source(60, 5) + SourceIndex(0) +2 >Emitted(40, 12) Source(60, 12) + SourceIndex(0) +3 >Emitted(40, 13) Source(60, 13) + SourceIndex(0) +4 >Emitted(40, 16) Source(60, 16) + SourceIndex(0) +5 >Emitted(40, 17) Source(60, 17) + SourceIndex(0) +6 >Emitted(40, 25) Source(60, 25) + SourceIndex(0) +7 >Emitted(40, 26) Source(60, 26) + SourceIndex(0) +8 >Emitted(40, 27) Source(60, 27) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(41, 1) Source(61, 1) + SourceIndex(0) +2 >Emitted(41, 2) Source(61, 2) + SourceIndex(0) +--- +>>>for (var _j = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, nameA = _j.name, _k = _j.skills, primaryA = _k.primary, secondaryA = _k.secondary, i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^^^^^^^^^^^^ +15> ^^ +16> ^ +17> ^^^ +18> ^ +19> ^^ +20> ^ +21> ^^^ +22> ^ +23> ^^ +24> ^ +25> ^^ +26> ^^ +27> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } } +7 > +8 > name: nameA +9 > , +10> skills: { primary: primaryA, secondary: secondaryA } +11> +12> primary: primaryA +13> , +14> secondary: secondaryA +15> } } = + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, + > +16> i +17> = +18> 0 +19> ; +20> i +21> < +22> 1 +23> ; +24> i +25> ++ +26> ) +27> { +1->Emitted(42, 1) Source(62, 1) + SourceIndex(0) +2 >Emitted(42, 4) Source(62, 4) + SourceIndex(0) +3 >Emitted(42, 5) Source(62, 5) + SourceIndex(0) +4 >Emitted(42, 6) Source(62, 6) + SourceIndex(0) +5 >Emitted(42, 10) Source(62, 6) + SourceIndex(0) +6 >Emitted(42, 88) Source(63, 90) + SourceIndex(0) +7 >Emitted(42, 90) Source(62, 11) + SourceIndex(0) +8 >Emitted(42, 105) Source(62, 22) + SourceIndex(0) +9 >Emitted(42, 107) Source(62, 24) + SourceIndex(0) +10>Emitted(42, 121) Source(62, 76) + SourceIndex(0) +11>Emitted(42, 123) Source(62, 34) + SourceIndex(0) +12>Emitted(42, 144) Source(62, 51) + SourceIndex(0) +13>Emitted(42, 146) Source(62, 53) + SourceIndex(0) +14>Emitted(42, 171) Source(62, 74) + SourceIndex(0) +15>Emitted(42, 173) Source(64, 5) + SourceIndex(0) +16>Emitted(42, 174) Source(64, 6) + SourceIndex(0) +17>Emitted(42, 177) Source(64, 9) + SourceIndex(0) +18>Emitted(42, 178) Source(64, 10) + SourceIndex(0) +19>Emitted(42, 180) Source(64, 12) + SourceIndex(0) +20>Emitted(42, 181) Source(64, 13) + SourceIndex(0) +21>Emitted(42, 184) Source(64, 16) + SourceIndex(0) +22>Emitted(42, 185) Source(64, 17) + SourceIndex(0) +23>Emitted(42, 187) Source(64, 19) + SourceIndex(0) +24>Emitted(42, 188) Source(64, 20) + SourceIndex(0) +25>Emitted(42, 190) Source(64, 22) + SourceIndex(0) +26>Emitted(42, 192) Source(64, 24) + SourceIndex(0) +27>Emitted(42, 193) Source(64, 25) + SourceIndex(0) +--- +>>> console.log(primaryA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > primaryA +7 > ) +8 > ; +1 >Emitted(43, 5) Source(65, 5) + SourceIndex(0) +2 >Emitted(43, 12) Source(65, 12) + SourceIndex(0) +3 >Emitted(43, 13) Source(65, 13) + SourceIndex(0) +4 >Emitted(43, 16) Source(65, 16) + SourceIndex(0) +5 >Emitted(43, 17) Source(65, 17) + SourceIndex(0) +6 >Emitted(43, 25) Source(65, 25) + SourceIndex(0) +7 >Emitted(43, 26) Source(65, 26) + SourceIndex(0) +8 >Emitted(43, 27) Source(65, 27) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(44, 1) Source(66, 1) + SourceIndex(0) +2 >Emitted(44, 2) Source(66, 2) + SourceIndex(0) +--- +>>>//# sourceMappingURL=sourceMapValidationDestructuringForObjectBindingPattern.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForObjectBindingPattern.symbols b/tests/baselines/reference/sourceMapValidationDestructuringForObjectBindingPattern.symbols new file mode 100644 index 00000000000..3cbd93783d2 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForObjectBindingPattern.symbols @@ -0,0 +1,282 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringForObjectBindingPattern.ts === +declare var console: { +>console : Symbol(console, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 0, 11)) + + log(msg: any): void; +>log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 0, 22)) +>msg : Symbol(msg, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 1, 8)) +} +interface Robot { +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 2, 1)) + + name: string; +>name : Symbol(Robot.name, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 3, 17)) + + skill: string; +>skill : Symbol(Robot.skill, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 4, 17)) +} + +interface MultiRobot { +>MultiRobot : Symbol(MultiRobot, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 6, 1)) + + name: string; +>name : Symbol(MultiRobot.name, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 8, 22)) + + skills: { +>skills : Symbol(MultiRobot.skills, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 9, 17)) + + primary: string; +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 10, 13)) + + secondary: string; +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 11, 24)) + + }; +} + +let robot: Robot = { name: "mower", skill: "mowing" }; +>robot : Symbol(robot, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 16, 3)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 2, 1)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 16, 20)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 16, 35)) + +let multiRobot: MultiRobot = { name: "mower", skills: { primary: "mowing", secondary: "none" } }; +>multiRobot : Symbol(multiRobot, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 17, 3)) +>MultiRobot : Symbol(MultiRobot, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 6, 1)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 17, 30)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 17, 45)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 17, 55)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 17, 74)) + +function getRobot() { +>getRobot : Symbol(getRobot, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 17, 97)) + + return robot; +>robot : Symbol(robot, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 16, 3)) +} +function getMultiRobot() { +>getMultiRobot : Symbol(getMultiRobot, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 20, 1)) + + return multiRobot; +>multiRobot : Symbol(multiRobot, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 17, 3)) +} + +for (let {name: nameA } = robot, i = 0; i < 1; i++) { +>name : Symbol(Robot.name, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 3, 17)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 25, 10)) +>robot : Symbol(robot, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 16, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 25, 32)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 25, 32)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 25, 32)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 25, 10)) +} +for (let {name: nameA } = getRobot(), i = 0; i < 1; i++) { +>name : Symbol(Robot.name, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 3, 17)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 28, 10)) +>getRobot : Symbol(getRobot, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 17, 97)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 28, 37)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 28, 37)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 28, 37)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 28, 10)) +} +for (let {name: nameA } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { +>name : Symbol(Robot.name, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 3, 17)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 31, 10)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 2, 1)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 31, 34)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 31, 51)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 31, 72)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 31, 72)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 31, 72)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 31, 10)) +} +for (let { skills: { primary: primaryA, secondary: secondaryA } } = multiRobot, i = 0; i < 1; i++) { +>skills : Symbol(MultiRobot.skills, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 9, 17)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 10, 13)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 34, 20)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 11, 24)) +>secondaryA : Symbol(secondaryA, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 34, 39)) +>multiRobot : Symbol(multiRobot, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 17, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 34, 79)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 34, 79)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 34, 79)) + + console.log(primaryA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 0, 22)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 34, 20)) +} +for (let { skills: { primary: primaryA, secondary: secondaryA } } = getMultiRobot(), i = 0; i < 1; i++) { +>skills : Symbol(MultiRobot.skills, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 9, 17)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 10, 13)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 37, 20)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 11, 24)) +>secondaryA : Symbol(secondaryA, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 37, 39)) +>getMultiRobot : Symbol(getMultiRobot, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 20, 1)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 37, 84)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 37, 84)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 37, 84)) + + console.log(primaryA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 0, 22)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 37, 20)) +} +for (let { skills: { primary: primaryA, secondary: secondaryA } } = +>skills : Symbol(MultiRobot.skills, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 9, 17)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 10, 13)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 40, 20)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 11, 24)) +>secondaryA : Symbol(secondaryA, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 40, 39)) + + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, +>MultiRobot : Symbol(MultiRobot, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 6, 1)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 41, 17)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 41, 34)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 41, 44)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 41, 65)) + + i = 0; i < 1; i++) { +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 41, 90)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 41, 90)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 41, 90)) + + console.log(primaryA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 0, 22)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 40, 20)) +} + +for (let {name: nameA, skill: skillA } = robot, i = 0; i < 1; i++) { +>name : Symbol(Robot.name, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 3, 17)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 46, 10)) +>skill : Symbol(Robot.skill, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 4, 17)) +>skillA : Symbol(skillA, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 46, 22)) +>robot : Symbol(robot, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 16, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 46, 47)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 46, 47)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 46, 47)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 46, 10)) +} +for (let {name: nameA, skill: skillA } = getRobot(), i = 0; i < 1; i++) { +>name : Symbol(Robot.name, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 3, 17)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 49, 10)) +>skill : Symbol(Robot.skill, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 4, 17)) +>skillA : Symbol(skillA, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 49, 22)) +>getRobot : Symbol(getRobot, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 17, 97)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 49, 52)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 49, 52)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 49, 52)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 49, 10)) +} +for (let {name: nameA, skill: skillA } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { +>name : Symbol(Robot.name, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 3, 17)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 52, 10)) +>skill : Symbol(Robot.skill, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 4, 17)) +>skillA : Symbol(skillA, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 52, 22)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 2, 1)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 52, 49)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 52, 66)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 52, 87)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 52, 87)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 52, 87)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 52, 10)) +} +for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = multiRobot, i = 0; i < 1; i++) { +>name : Symbol(MultiRobot.name, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 8, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 55, 10)) +>skills : Symbol(MultiRobot.skills, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 9, 17)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 10, 13)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 55, 32)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 11, 24)) +>secondaryA : Symbol(secondaryA, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 55, 51)) +>multiRobot : Symbol(multiRobot, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 17, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 55, 91)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 55, 91)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 55, 91)) + + console.log(primaryA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 0, 22)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 55, 32)) +} +for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = getMultiRobot(), i = 0; i < 1; i++) { +>name : Symbol(MultiRobot.name, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 8, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 58, 10)) +>skills : Symbol(MultiRobot.skills, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 9, 17)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 10, 13)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 58, 32)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 11, 24)) +>secondaryA : Symbol(secondaryA, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 58, 51)) +>getMultiRobot : Symbol(getMultiRobot, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 20, 1)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 58, 96)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 58, 96)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 58, 96)) + + console.log(primaryA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 0, 22)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 58, 32)) +} +for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = +>name : Symbol(MultiRobot.name, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 8, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 61, 10)) +>skills : Symbol(MultiRobot.skills, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 9, 17)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 10, 13)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 61, 32)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 11, 24)) +>secondaryA : Symbol(secondaryA, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 61, 51)) + + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, +>MultiRobot : Symbol(MultiRobot, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 6, 1)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 62, 17)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 62, 34)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 62, 44)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 62, 65)) + + i = 0; i < 1; i++) { +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 62, 90)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 62, 90)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 62, 90)) + + console.log(primaryA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 0, 22)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForObjectBindingPattern.ts, 61, 32)) +} diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForObjectBindingPattern.types b/tests/baselines/reference/sourceMapValidationDestructuringForObjectBindingPattern.types new file mode 100644 index 00000000000..21a7122e564 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForObjectBindingPattern.types @@ -0,0 +1,374 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringForObjectBindingPattern.ts === +declare var console: { +>console : { log(msg: any): void; } + + log(msg: any): void; +>log : (msg: any) => void +>msg : any +} +interface Robot { +>Robot : Robot + + name: string; +>name : string + + skill: string; +>skill : string +} + +interface MultiRobot { +>MultiRobot : MultiRobot + + name: string; +>name : string + + skills: { +>skills : { primary: string; secondary: string; } + + primary: string; +>primary : string + + secondary: string; +>secondary : string + + }; +} + +let robot: Robot = { name: "mower", skill: "mowing" }; +>robot : Robot +>Robot : Robot +>{ name: "mower", skill: "mowing" } : { name: string; skill: string; } +>name : string +>"mower" : string +>skill : string +>"mowing" : string + +let multiRobot: MultiRobot = { name: "mower", skills: { primary: "mowing", secondary: "none" } }; +>multiRobot : MultiRobot +>MultiRobot : MultiRobot +>{ name: "mower", skills: { primary: "mowing", secondary: "none" } } : { name: string; skills: { primary: string; secondary: string; }; } +>name : string +>"mower" : string +>skills : { primary: string; secondary: string; } +>{ primary: "mowing", secondary: "none" } : { primary: string; secondary: string; } +>primary : string +>"mowing" : string +>secondary : string +>"none" : string + +function getRobot() { +>getRobot : () => Robot + + return robot; +>robot : Robot +} +function getMultiRobot() { +>getMultiRobot : () => MultiRobot + + return multiRobot; +>multiRobot : MultiRobot +} + +for (let {name: nameA } = robot, i = 0; i < 1; i++) { +>name : any +>nameA : string +>robot : Robot +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for (let {name: nameA } = getRobot(), i = 0; i < 1; i++) { +>name : any +>nameA : string +>getRobot() : Robot +>getRobot : () => Robot +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for (let {name: nameA } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { +>name : any +>nameA : string +>{ name: "trimmer", skill: "trimming" } : Robot +>Robot : Robot +>{ name: "trimmer", skill: "trimming" } : { name: string; skill: string; } +>name : string +>"trimmer" : string +>skill : string +>"trimming" : string +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for (let { skills: { primary: primaryA, secondary: secondaryA } } = multiRobot, i = 0; i < 1; i++) { +>skills : any +>primary : any +>primaryA : string +>secondary : any +>secondaryA : string +>multiRobot : MultiRobot +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(primaryA); +>console.log(primaryA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primaryA : string +} +for (let { skills: { primary: primaryA, secondary: secondaryA } } = getMultiRobot(), i = 0; i < 1; i++) { +>skills : any +>primary : any +>primaryA : string +>secondary : any +>secondaryA : string +>getMultiRobot() : MultiRobot +>getMultiRobot : () => MultiRobot +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(primaryA); +>console.log(primaryA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primaryA : string +} +for (let { skills: { primary: primaryA, secondary: secondaryA } } = +>skills : any +>primary : any +>primaryA : string +>secondary : any +>secondaryA : string + + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, +>{ name: "trimmer", skills: { primary: "trimming", secondary: "edging" } } : MultiRobot +>MultiRobot : MultiRobot +>{ name: "trimmer", skills: { primary: "trimming", secondary: "edging" } } : { name: string; skills: { primary: string; secondary: string; }; } +>name : string +>"trimmer" : string +>skills : { primary: string; secondary: string; } +>{ primary: "trimming", secondary: "edging" } : { primary: string; secondary: string; } +>primary : string +>"trimming" : string +>secondary : string +>"edging" : string + + i = 0; i < 1; i++) { +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(primaryA); +>console.log(primaryA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primaryA : string +} + +for (let {name: nameA, skill: skillA } = robot, i = 0; i < 1; i++) { +>name : any +>nameA : string +>skill : any +>skillA : string +>robot : Robot +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for (let {name: nameA, skill: skillA } = getRobot(), i = 0; i < 1; i++) { +>name : any +>nameA : string +>skill : any +>skillA : string +>getRobot() : Robot +>getRobot : () => Robot +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for (let {name: nameA, skill: skillA } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { +>name : any +>nameA : string +>skill : any +>skillA : string +>{ name: "trimmer", skill: "trimming" } : Robot +>Robot : Robot +>{ name: "trimmer", skill: "trimming" } : { name: string; skill: string; } +>name : string +>"trimmer" : string +>skill : string +>"trimming" : string +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = multiRobot, i = 0; i < 1; i++) { +>name : any +>nameA : string +>skills : any +>primary : any +>primaryA : string +>secondary : any +>secondaryA : string +>multiRobot : MultiRobot +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(primaryA); +>console.log(primaryA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primaryA : string +} +for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = getMultiRobot(), i = 0; i < 1; i++) { +>name : any +>nameA : string +>skills : any +>primary : any +>primaryA : string +>secondary : any +>secondaryA : string +>getMultiRobot() : MultiRobot +>getMultiRobot : () => MultiRobot +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(primaryA); +>console.log(primaryA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primaryA : string +} +for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = +>name : any +>nameA : string +>skills : any +>primary : any +>primaryA : string +>secondary : any +>secondaryA : string + + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, +>{ name: "trimmer", skills: { primary: "trimming", secondary: "edging" } } : MultiRobot +>MultiRobot : MultiRobot +>{ name: "trimmer", skills: { primary: "trimming", secondary: "edging" } } : { name: string; skills: { primary: string; secondary: string; }; } +>name : string +>"trimmer" : string +>skills : { primary: string; secondary: string; } +>{ primary: "trimming", secondary: "edging" } : { primary: string; secondary: string; } +>primary : string +>"trimming" : string +>secondary : string +>"edging" : string + + i = 0; i < 1; i++) { +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(primaryA); +>console.log(primaryA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primaryA : string +} diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForObjectBindingPattern2.js b/tests/baselines/reference/sourceMapValidationDestructuringForObjectBindingPattern2.js new file mode 100644 index 00000000000..f7073765d04 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForObjectBindingPattern2.js @@ -0,0 +1,201 @@ +//// [sourceMapValidationDestructuringForObjectBindingPattern2.ts] +declare var console: { + log(msg: any): void; +} +interface Robot { + name: string; + skill: string; +} + +interface MultiRobot { + name: string; + skills: { + primary: string; + secondary: string; + }; +} + +let robot: Robot = { name: "mower", skill: "mowing" }; +let multiRobot: MultiRobot = { name: "mower", skills: { primary: "mowing", secondary: "none" } }; +function getRobot() { + return robot; +} +function getMultiRobot() { + return multiRobot; +} + +let nameA: string, primaryA: string, secondaryA: string, i: number, skillA: string; +let name: string, primary: string, secondary: string, skill: string; + +for ({ name: nameA } = robot, i = 0; i < 1; i++) { + console.log(nameA); +} +for ({ name: nameA } = getRobot(), i = 0; i < 1; i++) { + console.log(nameA); +} +for ({ name: nameA } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + console.log(nameA); +} +for ({ skills: { primary: primaryA, secondary: secondaryA } } = multiRobot, i = 0; i < 1; i++) { + console.log(primaryA); +} +for ({ skills: { primary: primaryA, secondary: secondaryA } } = getMultiRobot(), i = 0; i < 1; i++) { + console.log(primaryA); +} +for ({ skills: { primary: primaryA, secondary: secondaryA } } = + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, + i = 0; i < 1; i++) { + console.log(primaryA); +} +for ({ name } = robot, i = 0; i < 1; i++) { + console.log(nameA); +} +for ({ name } = getRobot(), i = 0; i < 1; i++) { + console.log(nameA); +} +for ({ name } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + console.log(nameA); +} +for ({ skills: { primary, secondary } } = multiRobot, i = 0; i < 1; i++) { + console.log(primaryA); +} +for ({ skills: { primary, secondary } } = getMultiRobot(), i = 0; i < 1; i++) { + console.log(primaryA); +} +for ({ skills: { primary, secondary } } = + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, + i = 0; i < 1; i++) { + console.log(primaryA); +} + + +for ({ name: nameA, skill: skillA } = robot, i = 0; i < 1; i++) { + console.log(nameA); +} +for ({ name: nameA, skill: skillA } = getRobot(), i = 0; i < 1; i++) { + console.log(nameA); +} +for ({ name: nameA, skill: skillA } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + console.log(nameA); +} +for ({ name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = multiRobot, i = 0; i < 1; i++) { + console.log(primaryA); +} +for ({ name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = getMultiRobot(), i = 0; i < 1; i++) { + console.log(primaryA); +} +for ({ name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, + i = 0; i < 1; i++) { + console.log(primaryA); +} +for ({ name, skill } = robot, i = 0; i < 1; i++) { + console.log(nameA); +} +for ({ name, skill } = getRobot(), i = 0; i < 1; i++) { + console.log(nameA); +} +for ({ name, skill } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + console.log(nameA); +} +for ({ name, skills: { primary, secondary } } = multiRobot, i = 0; i < 1; i++) { + console.log(primaryA); +} +for ({ name, skills: { primary, secondary } } = getMultiRobot(), i = 0; i < 1; i++) { + console.log(primaryA); +} +for ({ name, skills: { primary, secondary } } = + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, + i = 0; i < 1; i++) { + console.log(primaryA); +} + +//// [sourceMapValidationDestructuringForObjectBindingPattern2.js] +var robot = { name: "mower", skill: "mowing" }; +var multiRobot = { name: "mower", skills: { primary: "mowing", secondary: "none" } }; +function getRobot() { + return robot; +} +function getMultiRobot() { + return multiRobot; +} +var nameA, primaryA, secondaryA, i, skillA; +var name, primary, secondary, skill; +for ((nameA = robot.name, robot), i = 0; i < 1; i++) { + console.log(nameA); +} +for ((_a = getRobot(), nameA = _a.name, _a), i = 0; i < 1; i++) { + console.log(nameA); +} +for ((_b = { name: "trimmer", skill: "trimming" }, nameA = _b.name, _b), i = 0; i < 1; i++) { + console.log(nameA); +} +for ((_c = multiRobot.skills, primaryA = _c.primary, secondaryA = _c.secondary, multiRobot), i = 0; i < 1; i++) { + console.log(primaryA); +} +for ((_d = getMultiRobot(), _e = _d.skills, primaryA = _e.primary, secondaryA = _e.secondary, _d), i = 0; i < 1; i++) { + console.log(primaryA); +} +for ((_f = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, _g = _f.skills, primaryA = _g.primary, secondaryA = _g.secondary, _f), + i = 0; i < 1; i++) { + console.log(primaryA); +} +for ((name = robot.name, robot), i = 0; i < 1; i++) { + console.log(nameA); +} +for ((_h = getRobot(), name = _h.name, _h), i = 0; i < 1; i++) { + console.log(nameA); +} +for ((_j = { name: "trimmer", skill: "trimming" }, name = _j.name, _j), i = 0; i < 1; i++) { + console.log(nameA); +} +for ((_k = multiRobot.skills, primary = _k.primary, secondary = _k.secondary, multiRobot), i = 0; i < 1; i++) { + console.log(primaryA); +} +for ((_l = getMultiRobot(), _m = _l.skills, primary = _m.primary, secondary = _m.secondary, _l), i = 0; i < 1; i++) { + console.log(primaryA); +} +for ((_o = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, _p = _o.skills, primary = _p.primary, secondary = _p.secondary, _o), + i = 0; i < 1; i++) { + console.log(primaryA); +} +for ((nameA = robot.name, skillA = robot.skill, robot), i = 0; i < 1; i++) { + console.log(nameA); +} +for ((_q = getRobot(), nameA = _q.name, skillA = _q.skill, _q), i = 0; i < 1; i++) { + console.log(nameA); +} +for ((_r = { name: "trimmer", skill: "trimming" }, nameA = _r.name, skillA = _r.skill, _r), i = 0; i < 1; i++) { + console.log(nameA); +} +for ((nameA = multiRobot.name, _s = multiRobot.skills, primaryA = _s.primary, secondaryA = _s.secondary, multiRobot), i = 0; i < 1; i++) { + console.log(primaryA); +} +for ((_t = getMultiRobot(), nameA = _t.name, _u = _t.skills, primaryA = _u.primary, secondaryA = _u.secondary, _t), i = 0; i < 1; i++) { + console.log(primaryA); +} +for ((_v = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, nameA = _v.name, _w = _v.skills, primaryA = _w.primary, secondaryA = _w.secondary, _v), + i = 0; i < 1; i++) { + console.log(primaryA); +} +for ((name = robot.name, skill = robot.skill, robot), i = 0; i < 1; i++) { + console.log(nameA); +} +for ((_x = getRobot(), name = _x.name, skill = _x.skill, _x), i = 0; i < 1; i++) { + console.log(nameA); +} +for ((_y = { name: "trimmer", skill: "trimming" }, name = _y.name, skill = _y.skill, _y), i = 0; i < 1; i++) { + console.log(nameA); +} +for ((name = multiRobot.name, _z = multiRobot.skills, primary = _z.primary, secondary = _z.secondary, multiRobot), i = 0; i < 1; i++) { + console.log(primaryA); +} +for ((_0 = getMultiRobot(), name = _0.name, _1 = _0.skills, primary = _1.primary, secondary = _1.secondary, _0), i = 0; i < 1; i++) { + console.log(primaryA); +} +for ((_2 = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, name = _2.name, _3 = _2.skills, primary = _3.primary, secondary = _3.secondary, _2), + i = 0; i < 1; i++) { + console.log(primaryA); +} +var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3; +//# sourceMappingURL=sourceMapValidationDestructuringForObjectBindingPattern2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForObjectBindingPattern2.js.map b/tests/baselines/reference/sourceMapValidationDestructuringForObjectBindingPattern2.js.map new file mode 100644 index 00000000000..cb6d6d9fe4a --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForObjectBindingPattern2.js.map @@ -0,0 +1,2 @@ +//// [sourceMapValidationDestructuringForObjectBindingPattern2.js.map] +{"version":3,"file":"sourceMapValidationDestructuringForObjectBindingPattern2.js","sourceRoot":"","sources":["sourceMapValidationDestructuringForObjectBindingPattern2.ts"],"names":[],"mappings":"AAgBA,IAAI,KAAK,GAAU,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;AACtD,IAAI,UAAU,GAAe,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,CAAC;AACjG;IACI,MAAM,CAAC,KAAK,CAAC;AACjB,CAAC;AACD;IACI,MAAM,CAAC,UAAU,CAAC;AACtB,CAAC;AAED,IAAI,KAAa,EAAE,QAAgB,EAAE,UAAkB,EAAE,CAAS,EAAE,MAAc,CAAC;AACnF,IAAI,IAAY,EAAE,OAAe,EAAE,SAAiB,EAAE,KAAa,CAAC;AAEpE,GAAG,CAAC,CAAC,CAAE,kBAAW,EAAK,KAAK,CAAA,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IAC9C,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AACD,GAAG,CAAC,CAAC,CAAA,eAA4B,EAA1B,eAAW,KAAe,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACnD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AACD,GAAG,CAAC,CAAC,CAAA,2CAA+D,EAA7D,eAAW,KAAkD,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACtF,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AACD,GAAG,CAAC,CAAC,CAAE,sBAAoD,EAA1C,qBAAiB,EAAE,yBAAqB,EAAO,UAAU,CAAA,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IAC5F,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAC1B,CAAC;AACD,GAAG,CAAC,CAAC,CAAA,oBAA0E,EAAxE,cAAoD,EAA1C,qBAAiB,EAAE,yBAAqB,KAAsB,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACjG,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAC1B,CAAC;AACD,GAAG,CAAC,CAAC,CAAA,8EACoF,EADlF,cAAoD,EAA1C,qBAAiB,EAAE,yBAAqB,KACgC;IACrF,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACpB,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAC1B,CAAC;AACD,GAAG,CAAC,CAAC,CAAE,iBAAI,EAAK,KAAK,CAAA,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACvC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AACD,GAAG,CAAC,CAAC,CAAA,eAAqB,EAAnB,cAAI,KAAe,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IAC5C,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AACD,GAAG,CAAC,CAAC,CAAA,2CAAwD,EAAtD,cAAI,KAAkD,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IAC/E,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AACD,GAAG,CAAC,CAAC,CAAE,sBAA8B,EAApB,oBAAO,EAAE,wBAAS,EAAO,UAAU,CAAA,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACtE,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAC1B,CAAC;AACD,GAAG,CAAC,CAAC,CAAA,oBAAoD,EAAlD,cAA8B,EAApB,oBAAO,EAAE,wBAAS,KAAsB,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IAC3E,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAC1B,CAAC;AACD,GAAG,CAAC,CAAC,CAAA,8EACoF,EADlF,cAA8B,EAApB,oBAAO,EAAE,wBAAS,KACsD;IACrF,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACpB,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAC1B,CAAC;AAGD,GAAG,CAAC,CAAC,CAAE,kBAAW,EAAE,oBAAa,EAAK,KAAK,CAAA,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IAC7D,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AACD,GAAG,CAAC,CAAC,CAAA,eAA2C,EAAzC,eAAW,EAAE,iBAAa,KAAe,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IAClE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AACD,GAAG,CAAC,CAAC,CAAA,2CAA8E,EAA5E,eAAW,EAAE,iBAAa,KAAkD,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACrG,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AACD,GAAG,CAAC,CAAC,CAAE,uBAAW,EAAE,sBAAoD,EAA1C,qBAAiB,EAAE,yBAAqB,EAAO,UAAU,CAAA,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACzG,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAC1B,CAAC;AACD,GAAG,CAAC,CAAC,CAAA,oBAAuF,EAArF,eAAW,EAAE,cAAoD,EAA1C,qBAAiB,EAAE,yBAAqB,KAAsB,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IAC9G,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAC1B,CAAC;AACD,GAAG,CAAC,CAAC,CAAA,8EACoF,EADlF,eAAW,EAAE,cAAoD,EAA1C,qBAAiB,EAAE,yBAAqB,KACmB;IACrF,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACpB,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAC1B,CAAC;AACD,GAAG,CAAC,CAAC,CAAE,iBAAI,EAAE,mBAAK,EAAK,KAAK,CAAA,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IAC9C,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AACD,GAAG,CAAC,CAAC,CAAA,eAA4B,EAA1B,cAAI,EAAE,gBAAK,KAAe,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACnD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AACD,GAAG,CAAC,CAAC,CAAA,2CAA+D,EAA7D,cAAI,EAAE,gBAAK,KAAkD,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACtF,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AACD,GAAG,CAAC,CAAC,CAAE,sBAAI,EAAE,sBAA8B,EAApB,oBAAO,EAAE,wBAAS,EAAO,UAAU,CAAA,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IAC5E,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAC1B,CAAC;AACD,GAAG,CAAC,CAAC,CAAA,oBAA0D,EAAxD,cAAI,EAAE,cAA8B,EAApB,oBAAO,EAAE,wBAAS,KAAsB,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACjF,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAC1B,CAAC;AACD,GAAG,CAAC,CAAC,CAAA,8EACoF,EADlF,cAAI,EAAE,cAA8B,EAApB,oBAAO,EAAE,wBAAS,KACgD;IACrF,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACpB,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAC1B,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForObjectBindingPattern2.sourcemap.txt b/tests/baselines/reference/sourceMapValidationDestructuringForObjectBindingPattern2.sourcemap.txt new file mode 100644 index 00000000000..3744cc2e7ab --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForObjectBindingPattern2.sourcemap.txt @@ -0,0 +1,3073 @@ +=================================================================== +JsFile: sourceMapValidationDestructuringForObjectBindingPattern2.js +mapUrl: sourceMapValidationDestructuringForObjectBindingPattern2.js.map +sourceRoot: +sources: sourceMapValidationDestructuringForObjectBindingPattern2.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/sourceMapValidationDestructuringForObjectBindingPattern2.js +sourceFile:sourceMapValidationDestructuringForObjectBindingPattern2.ts +------------------------------------------------------------------- +>>>var robot = { name: "mower", skill: "mowing" }; +1 > +2 >^^^^ +3 > ^^^^^ +4 > ^^^ +5 > ^^ +6 > ^^^^ +7 > ^^ +8 > ^^^^^^^ +9 > ^^ +10> ^^^^^ +11> ^^ +12> ^^^^^^^^ +13> ^^ +14> ^ +15> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 >declare var console: { + > log(msg: any): void; + >} + >interface Robot { + > name: string; + > skill: string; + >} + > + >interface MultiRobot { + > name: string; + > skills: { + > primary: string; + > secondary: string; + > }; + >} + > + > +2 >let +3 > robot +4 > : Robot = +5 > { +6 > name +7 > : +8 > "mower" +9 > , +10> skill +11> : +12> "mowing" +13> } +14> ; +1 >Emitted(1, 1) Source(17, 1) + SourceIndex(0) +2 >Emitted(1, 5) Source(17, 5) + SourceIndex(0) +3 >Emitted(1, 10) Source(17, 10) + SourceIndex(0) +4 >Emitted(1, 13) Source(17, 20) + SourceIndex(0) +5 >Emitted(1, 15) Source(17, 22) + SourceIndex(0) +6 >Emitted(1, 19) Source(17, 26) + SourceIndex(0) +7 >Emitted(1, 21) Source(17, 28) + SourceIndex(0) +8 >Emitted(1, 28) Source(17, 35) + SourceIndex(0) +9 >Emitted(1, 30) Source(17, 37) + SourceIndex(0) +10>Emitted(1, 35) Source(17, 42) + SourceIndex(0) +11>Emitted(1, 37) Source(17, 44) + SourceIndex(0) +12>Emitted(1, 45) Source(17, 52) + SourceIndex(0) +13>Emitted(1, 47) Source(17, 54) + SourceIndex(0) +14>Emitted(1, 48) Source(17, 55) + SourceIndex(0) +--- +>>>var multiRobot = { name: "mower", skills: { primary: "mowing", secondary: "none" } }; +1-> +2 >^^^^ +3 > ^^^^^^^^^^ +4 > ^^^ +5 > ^^ +6 > ^^^^ +7 > ^^ +8 > ^^^^^^^ +9 > ^^ +10> ^^^^^^ +11> ^^ +12> ^^ +13> ^^^^^^^ +14> ^^ +15> ^^^^^^^^ +16> ^^ +17> ^^^^^^^^^ +18> ^^ +19> ^^^^^^ +20> ^^ +21> ^^ +22> ^ +1-> + > +2 >let +3 > multiRobot +4 > : MultiRobot = +5 > { +6 > name +7 > : +8 > "mower" +9 > , +10> skills +11> : +12> { +13> primary +14> : +15> "mowing" +16> , +17> secondary +18> : +19> "none" +20> } +21> } +22> ; +1->Emitted(2, 1) Source(18, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(18, 5) + SourceIndex(0) +3 >Emitted(2, 15) Source(18, 15) + SourceIndex(0) +4 >Emitted(2, 18) Source(18, 30) + SourceIndex(0) +5 >Emitted(2, 20) Source(18, 32) + SourceIndex(0) +6 >Emitted(2, 24) Source(18, 36) + SourceIndex(0) +7 >Emitted(2, 26) Source(18, 38) + SourceIndex(0) +8 >Emitted(2, 33) Source(18, 45) + SourceIndex(0) +9 >Emitted(2, 35) Source(18, 47) + SourceIndex(0) +10>Emitted(2, 41) Source(18, 53) + SourceIndex(0) +11>Emitted(2, 43) Source(18, 55) + SourceIndex(0) +12>Emitted(2, 45) Source(18, 57) + SourceIndex(0) +13>Emitted(2, 52) Source(18, 64) + SourceIndex(0) +14>Emitted(2, 54) Source(18, 66) + SourceIndex(0) +15>Emitted(2, 62) Source(18, 74) + SourceIndex(0) +16>Emitted(2, 64) Source(18, 76) + SourceIndex(0) +17>Emitted(2, 73) Source(18, 85) + SourceIndex(0) +18>Emitted(2, 75) Source(18, 87) + SourceIndex(0) +19>Emitted(2, 81) Source(18, 93) + SourceIndex(0) +20>Emitted(2, 83) Source(18, 95) + SourceIndex(0) +21>Emitted(2, 85) Source(18, 97) + SourceIndex(0) +22>Emitted(2, 86) Source(18, 98) + SourceIndex(0) +--- +>>>function getRobot() { +1 > +2 >^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(3, 1) Source(19, 1) + SourceIndex(0) +--- +>>> return robot; +1->^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^ +5 > ^ +1->function getRobot() { + > +2 > return +3 > +4 > robot +5 > ; +1->Emitted(4, 5) Source(20, 5) + SourceIndex(0) +2 >Emitted(4, 11) Source(20, 11) + SourceIndex(0) +3 >Emitted(4, 12) Source(20, 12) + SourceIndex(0) +4 >Emitted(4, 17) Source(20, 17) + SourceIndex(0) +5 >Emitted(4, 18) Source(20, 18) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(5, 1) Source(21, 1) + SourceIndex(0) +2 >Emitted(5, 2) Source(21, 2) + SourceIndex(0) +--- +>>>function getMultiRobot() { +1-> +2 >^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(6, 1) Source(22, 1) + SourceIndex(0) +--- +>>> return multiRobot; +1->^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^ +5 > ^ +1->function getMultiRobot() { + > +2 > return +3 > +4 > multiRobot +5 > ; +1->Emitted(7, 5) Source(23, 5) + SourceIndex(0) +2 >Emitted(7, 11) Source(23, 11) + SourceIndex(0) +3 >Emitted(7, 12) Source(23, 12) + SourceIndex(0) +4 >Emitted(7, 22) Source(23, 22) + SourceIndex(0) +5 >Emitted(7, 23) Source(23, 23) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(8, 1) Source(24, 1) + SourceIndex(0) +2 >Emitted(8, 2) Source(24, 2) + SourceIndex(0) +--- +>>>var nameA, primaryA, secondaryA, i, skillA; +1-> +2 >^^^^ +3 > ^^^^^ +4 > ^^ +5 > ^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^ +8 > ^^ +9 > ^ +10> ^^ +11> ^^^^^^ +12> ^ +1-> + > + > +2 >let +3 > nameA: string +4 > , +5 > primaryA: string +6 > , +7 > secondaryA: string +8 > , +9 > i: number +10> , +11> skillA: string +12> ; +1->Emitted(9, 1) Source(26, 1) + SourceIndex(0) +2 >Emitted(9, 5) Source(26, 5) + SourceIndex(0) +3 >Emitted(9, 10) Source(26, 18) + SourceIndex(0) +4 >Emitted(9, 12) Source(26, 20) + SourceIndex(0) +5 >Emitted(9, 20) Source(26, 36) + SourceIndex(0) +6 >Emitted(9, 22) Source(26, 38) + SourceIndex(0) +7 >Emitted(9, 32) Source(26, 56) + SourceIndex(0) +8 >Emitted(9, 34) Source(26, 58) + SourceIndex(0) +9 >Emitted(9, 35) Source(26, 67) + SourceIndex(0) +10>Emitted(9, 37) Source(26, 69) + SourceIndex(0) +11>Emitted(9, 43) Source(26, 83) + SourceIndex(0) +12>Emitted(9, 44) Source(26, 84) + SourceIndex(0) +--- +>>>var name, primary, secondary, skill; +1 > +2 >^^^^ +3 > ^^^^ +4 > ^^ +5 > ^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^ +8 > ^^ +9 > ^^^^^ +10> ^ +11> ^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >let +3 > name: string +4 > , +5 > primary: string +6 > , +7 > secondary: string +8 > , +9 > skill: string +10> ; +1 >Emitted(10, 1) Source(27, 1) + SourceIndex(0) +2 >Emitted(10, 5) Source(27, 5) + SourceIndex(0) +3 >Emitted(10, 9) Source(27, 17) + SourceIndex(0) +4 >Emitted(10, 11) Source(27, 19) + SourceIndex(0) +5 >Emitted(10, 18) Source(27, 34) + SourceIndex(0) +6 >Emitted(10, 20) Source(27, 36) + SourceIndex(0) +7 >Emitted(10, 29) Source(27, 53) + SourceIndex(0) +8 >Emitted(10, 31) Source(27, 55) + SourceIndex(0) +9 >Emitted(10, 36) Source(27, 68) + SourceIndex(0) +10>Emitted(10, 37) Source(27, 69) + SourceIndex(0) +--- +>>>for ((nameA = robot.name, robot), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^ +9 > ^ +10> ^^ +11> ^ +12> ^^^ +13> ^ +14> ^^ +15> ^ +16> ^^^ +17> ^ +18> ^^ +19> ^ +20> ^^ +21> ^^ +22> ^ +1-> + > + > +2 >for +3 > +4 > ( +5 > { +6 > name: nameA +7 > } = +8 > robot +9 > +10> , +11> i +12> = +13> 0 +14> ; +15> i +16> < +17> 1 +18> ; +19> i +20> ++ +21> ) +22> { +1->Emitted(11, 1) Source(29, 1) + SourceIndex(0) +2 >Emitted(11, 4) Source(29, 4) + SourceIndex(0) +3 >Emitted(11, 5) Source(29, 5) + SourceIndex(0) +4 >Emitted(11, 6) Source(29, 6) + SourceIndex(0) +5 >Emitted(11, 7) Source(29, 8) + SourceIndex(0) +6 >Emitted(11, 25) Source(29, 19) + SourceIndex(0) +7 >Emitted(11, 27) Source(29, 24) + SourceIndex(0) +8 >Emitted(11, 32) Source(29, 29) + SourceIndex(0) +9 >Emitted(11, 33) Source(29, 29) + SourceIndex(0) +10>Emitted(11, 35) Source(29, 31) + SourceIndex(0) +11>Emitted(11, 36) Source(29, 32) + SourceIndex(0) +12>Emitted(11, 39) Source(29, 35) + SourceIndex(0) +13>Emitted(11, 40) Source(29, 36) + SourceIndex(0) +14>Emitted(11, 42) Source(29, 38) + SourceIndex(0) +15>Emitted(11, 43) Source(29, 39) + SourceIndex(0) +16>Emitted(11, 46) Source(29, 42) + SourceIndex(0) +17>Emitted(11, 47) Source(29, 43) + SourceIndex(0) +18>Emitted(11, 49) Source(29, 45) + SourceIndex(0) +19>Emitted(11, 50) Source(29, 46) + SourceIndex(0) +20>Emitted(11, 52) Source(29, 48) + SourceIndex(0) +21>Emitted(11, 54) Source(29, 50) + SourceIndex(0) +22>Emitted(11, 55) Source(29, 51) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(12, 5) Source(30, 5) + SourceIndex(0) +2 >Emitted(12, 12) Source(30, 12) + SourceIndex(0) +3 >Emitted(12, 13) Source(30, 13) + SourceIndex(0) +4 >Emitted(12, 16) Source(30, 16) + SourceIndex(0) +5 >Emitted(12, 17) Source(30, 17) + SourceIndex(0) +6 >Emitted(12, 22) Source(30, 22) + SourceIndex(0) +7 >Emitted(12, 23) Source(30, 23) + SourceIndex(0) +8 >Emitted(12, 24) Source(30, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(13, 1) Source(31, 1) + SourceIndex(0) +2 >Emitted(13, 2) Source(31, 2) + SourceIndex(0) +--- +>>>for ((_a = getRobot(), nameA = _a.name, _a), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^ +9 > ^^^^^ +10> ^^ +11> ^ +12> ^^^ +13> ^ +14> ^^ +15> ^ +16> ^^^ +17> ^ +18> ^^ +19> ^ +20> ^^ +21> ^^ +22> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > { name: nameA } = getRobot() +7 > +8 > name: nameA +9 > } = getRobot() +10> , +11> i +12> = +13> 0 +14> ; +15> i +16> < +17> 1 +18> ; +19> i +20> ++ +21> ) +22> { +1->Emitted(14, 1) Source(32, 1) + SourceIndex(0) +2 >Emitted(14, 4) Source(32, 4) + SourceIndex(0) +3 >Emitted(14, 5) Source(32, 5) + SourceIndex(0) +4 >Emitted(14, 6) Source(32, 6) + SourceIndex(0) +5 >Emitted(14, 7) Source(32, 6) + SourceIndex(0) +6 >Emitted(14, 22) Source(32, 34) + SourceIndex(0) +7 >Emitted(14, 24) Source(32, 8) + SourceIndex(0) +8 >Emitted(14, 39) Source(32, 19) + SourceIndex(0) +9 >Emitted(14, 44) Source(32, 34) + SourceIndex(0) +10>Emitted(14, 46) Source(32, 36) + SourceIndex(0) +11>Emitted(14, 47) Source(32, 37) + SourceIndex(0) +12>Emitted(14, 50) Source(32, 40) + SourceIndex(0) +13>Emitted(14, 51) Source(32, 41) + SourceIndex(0) +14>Emitted(14, 53) Source(32, 43) + SourceIndex(0) +15>Emitted(14, 54) Source(32, 44) + SourceIndex(0) +16>Emitted(14, 57) Source(32, 47) + SourceIndex(0) +17>Emitted(14, 58) Source(32, 48) + SourceIndex(0) +18>Emitted(14, 60) Source(32, 50) + SourceIndex(0) +19>Emitted(14, 61) Source(32, 51) + SourceIndex(0) +20>Emitted(14, 63) Source(32, 53) + SourceIndex(0) +21>Emitted(14, 65) Source(32, 55) + SourceIndex(0) +22>Emitted(14, 66) Source(32, 56) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(15, 5) Source(33, 5) + SourceIndex(0) +2 >Emitted(15, 12) Source(33, 12) + SourceIndex(0) +3 >Emitted(15, 13) Source(33, 13) + SourceIndex(0) +4 >Emitted(15, 16) Source(33, 16) + SourceIndex(0) +5 >Emitted(15, 17) Source(33, 17) + SourceIndex(0) +6 >Emitted(15, 22) Source(33, 22) + SourceIndex(0) +7 >Emitted(15, 23) Source(33, 23) + SourceIndex(0) +8 >Emitted(15, 24) Source(33, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(16, 1) Source(34, 1) + SourceIndex(0) +2 >Emitted(16, 2) Source(34, 2) + SourceIndex(0) +--- +>>>for ((_b = { name: "trimmer", skill: "trimming" }, nameA = _b.name, _b), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^ +9 > ^^^^^ +10> ^^ +11> ^ +12> ^^^ +13> ^ +14> ^^ +15> ^ +16> ^^^ +17> ^ +18> ^^ +19> ^ +20> ^^ +21> ^^ +22> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > { name: nameA } = { name: "trimmer", skill: "trimming" } +7 > +8 > name: nameA +9 > } = { name: "trimmer", skill: "trimming" } +10> , +11> i +12> = +13> 0 +14> ; +15> i +16> < +17> 1 +18> ; +19> i +20> ++ +21> ) +22> { +1->Emitted(17, 1) Source(35, 1) + SourceIndex(0) +2 >Emitted(17, 4) Source(35, 4) + SourceIndex(0) +3 >Emitted(17, 5) Source(35, 5) + SourceIndex(0) +4 >Emitted(17, 6) Source(35, 6) + SourceIndex(0) +5 >Emitted(17, 7) Source(35, 6) + SourceIndex(0) +6 >Emitted(17, 50) Source(35, 69) + SourceIndex(0) +7 >Emitted(17, 52) Source(35, 8) + SourceIndex(0) +8 >Emitted(17, 67) Source(35, 19) + SourceIndex(0) +9 >Emitted(17, 72) Source(35, 69) + SourceIndex(0) +10>Emitted(17, 74) Source(35, 71) + SourceIndex(0) +11>Emitted(17, 75) Source(35, 72) + SourceIndex(0) +12>Emitted(17, 78) Source(35, 75) + SourceIndex(0) +13>Emitted(17, 79) Source(35, 76) + SourceIndex(0) +14>Emitted(17, 81) Source(35, 78) + SourceIndex(0) +15>Emitted(17, 82) Source(35, 79) + SourceIndex(0) +16>Emitted(17, 85) Source(35, 82) + SourceIndex(0) +17>Emitted(17, 86) Source(35, 83) + SourceIndex(0) +18>Emitted(17, 88) Source(35, 85) + SourceIndex(0) +19>Emitted(17, 89) Source(35, 86) + SourceIndex(0) +20>Emitted(17, 91) Source(35, 88) + SourceIndex(0) +21>Emitted(17, 93) Source(35, 90) + SourceIndex(0) +22>Emitted(17, 94) Source(35, 91) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(18, 5) Source(36, 5) + SourceIndex(0) +2 >Emitted(18, 12) Source(36, 12) + SourceIndex(0) +3 >Emitted(18, 13) Source(36, 13) + SourceIndex(0) +4 >Emitted(18, 16) Source(36, 16) + SourceIndex(0) +5 >Emitted(18, 17) Source(36, 17) + SourceIndex(0) +6 >Emitted(18, 22) Source(36, 22) + SourceIndex(0) +7 >Emitted(18, 23) Source(36, 23) + SourceIndex(0) +8 >Emitted(18, 24) Source(36, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(19, 1) Source(37, 1) + SourceIndex(0) +2 >Emitted(19, 2) Source(37, 2) + SourceIndex(0) +--- +>>>for ((_c = multiRobot.skills, primaryA = _c.primary, secondaryA = _c.secondary, multiRobot), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^ +13> ^ +14> ^^ +15> ^ +16> ^^^ +17> ^ +18> ^^ +19> ^ +20> ^^^ +21> ^ +22> ^^ +23> ^ +24> ^^ +25> ^^ +26> ^ +1-> + > +2 >for +3 > +4 > ( +5 > { +6 > skills: { primary: primaryA, secondary: secondaryA } +7 > +8 > primary: primaryA +9 > , +10> secondary: secondaryA +11> } } = +12> multiRobot +13> +14> , +15> i +16> = +17> 0 +18> ; +19> i +20> < +21> 1 +22> ; +23> i +24> ++ +25> ) +26> { +1->Emitted(20, 1) Source(38, 1) + SourceIndex(0) +2 >Emitted(20, 4) Source(38, 4) + SourceIndex(0) +3 >Emitted(20, 5) Source(38, 5) + SourceIndex(0) +4 >Emitted(20, 6) Source(38, 6) + SourceIndex(0) +5 >Emitted(20, 7) Source(38, 8) + SourceIndex(0) +6 >Emitted(20, 29) Source(38, 60) + SourceIndex(0) +7 >Emitted(20, 31) Source(38, 18) + SourceIndex(0) +8 >Emitted(20, 52) Source(38, 35) + SourceIndex(0) +9 >Emitted(20, 54) Source(38, 37) + SourceIndex(0) +10>Emitted(20, 79) Source(38, 58) + SourceIndex(0) +11>Emitted(20, 81) Source(38, 65) + SourceIndex(0) +12>Emitted(20, 91) Source(38, 75) + SourceIndex(0) +13>Emitted(20, 92) Source(38, 75) + SourceIndex(0) +14>Emitted(20, 94) Source(38, 77) + SourceIndex(0) +15>Emitted(20, 95) Source(38, 78) + SourceIndex(0) +16>Emitted(20, 98) Source(38, 81) + SourceIndex(0) +17>Emitted(20, 99) Source(38, 82) + SourceIndex(0) +18>Emitted(20, 101) Source(38, 84) + SourceIndex(0) +19>Emitted(20, 102) Source(38, 85) + SourceIndex(0) +20>Emitted(20, 105) Source(38, 88) + SourceIndex(0) +21>Emitted(20, 106) Source(38, 89) + SourceIndex(0) +22>Emitted(20, 108) Source(38, 91) + SourceIndex(0) +23>Emitted(20, 109) Source(38, 92) + SourceIndex(0) +24>Emitted(20, 111) Source(38, 94) + SourceIndex(0) +25>Emitted(20, 113) Source(38, 96) + SourceIndex(0) +26>Emitted(20, 114) Source(38, 97) + SourceIndex(0) +--- +>>> console.log(primaryA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > primaryA +7 > ) +8 > ; +1 >Emitted(21, 5) Source(39, 5) + SourceIndex(0) +2 >Emitted(21, 12) Source(39, 12) + SourceIndex(0) +3 >Emitted(21, 13) Source(39, 13) + SourceIndex(0) +4 >Emitted(21, 16) Source(39, 16) + SourceIndex(0) +5 >Emitted(21, 17) Source(39, 17) + SourceIndex(0) +6 >Emitted(21, 25) Source(39, 25) + SourceIndex(0) +7 >Emitted(21, 26) Source(39, 26) + SourceIndex(0) +8 >Emitted(21, 27) Source(39, 27) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(22, 1) Source(40, 1) + SourceIndex(0) +2 >Emitted(22, 2) Source(40, 2) + SourceIndex(0) +--- +>>>for ((_d = getMultiRobot(), _e = _d.skills, primaryA = _e.primary, secondaryA = _e.secondary, _d), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^^^^^^^^^^^ +13> ^^^^^ +14> ^^ +15> ^ +16> ^^^ +17> ^ +18> ^^ +19> ^ +20> ^^^ +21> ^ +22> ^^ +23> ^ +24> ^^ +25> ^^ +26> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > { skills: { primary: primaryA, secondary: secondaryA } } = getMultiRobot() +7 > +8 > skills: { primary: primaryA, secondary: secondaryA } +9 > +10> primary: primaryA +11> , +12> secondary: secondaryA +13> } } = getMultiRobot() +14> , +15> i +16> = +17> 0 +18> ; +19> i +20> < +21> 1 +22> ; +23> i +24> ++ +25> ) +26> { +1->Emitted(23, 1) Source(41, 1) + SourceIndex(0) +2 >Emitted(23, 4) Source(41, 4) + SourceIndex(0) +3 >Emitted(23, 5) Source(41, 5) + SourceIndex(0) +4 >Emitted(23, 6) Source(41, 6) + SourceIndex(0) +5 >Emitted(23, 7) Source(41, 6) + SourceIndex(0) +6 >Emitted(23, 27) Source(41, 80) + SourceIndex(0) +7 >Emitted(23, 29) Source(41, 8) + SourceIndex(0) +8 >Emitted(23, 43) Source(41, 60) + SourceIndex(0) +9 >Emitted(23, 45) Source(41, 18) + SourceIndex(0) +10>Emitted(23, 66) Source(41, 35) + SourceIndex(0) +11>Emitted(23, 68) Source(41, 37) + SourceIndex(0) +12>Emitted(23, 93) Source(41, 58) + SourceIndex(0) +13>Emitted(23, 98) Source(41, 80) + SourceIndex(0) +14>Emitted(23, 100) Source(41, 82) + SourceIndex(0) +15>Emitted(23, 101) Source(41, 83) + SourceIndex(0) +16>Emitted(23, 104) Source(41, 86) + SourceIndex(0) +17>Emitted(23, 105) Source(41, 87) + SourceIndex(0) +18>Emitted(23, 107) Source(41, 89) + SourceIndex(0) +19>Emitted(23, 108) Source(41, 90) + SourceIndex(0) +20>Emitted(23, 111) Source(41, 93) + SourceIndex(0) +21>Emitted(23, 112) Source(41, 94) + SourceIndex(0) +22>Emitted(23, 114) Source(41, 96) + SourceIndex(0) +23>Emitted(23, 115) Source(41, 97) + SourceIndex(0) +24>Emitted(23, 117) Source(41, 99) + SourceIndex(0) +25>Emitted(23, 119) Source(41, 101) + SourceIndex(0) +26>Emitted(23, 120) Source(41, 102) + SourceIndex(0) +--- +>>> console.log(primaryA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > primaryA +7 > ) +8 > ; +1 >Emitted(24, 5) Source(42, 5) + SourceIndex(0) +2 >Emitted(24, 12) Source(42, 12) + SourceIndex(0) +3 >Emitted(24, 13) Source(42, 13) + SourceIndex(0) +4 >Emitted(24, 16) Source(42, 16) + SourceIndex(0) +5 >Emitted(24, 17) Source(42, 17) + SourceIndex(0) +6 >Emitted(24, 25) Source(42, 25) + SourceIndex(0) +7 >Emitted(24, 26) Source(42, 26) + SourceIndex(0) +8 >Emitted(24, 27) Source(42, 27) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(25, 1) Source(43, 1) + SourceIndex(0) +2 >Emitted(25, 2) Source(43, 2) + SourceIndex(0) +--- +>>>for ((_f = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, _g = _f.skills, primaryA = _g.primary, secondaryA = _g.secondary, _f), +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^^^^^^^^^^^ +13> ^^^^^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > { skills: { primary: primaryA, secondary: secondaryA } } = + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } } +7 > +8 > skills: { primary: primaryA, secondary: secondaryA } +9 > +10> primary: primaryA +11> , +12> secondary: secondaryA +13> } } = + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } } +1->Emitted(26, 1) Source(44, 1) + SourceIndex(0) +2 >Emitted(26, 4) Source(44, 4) + SourceIndex(0) +3 >Emitted(26, 5) Source(44, 5) + SourceIndex(0) +4 >Emitted(26, 6) Source(44, 6) + SourceIndex(0) +5 >Emitted(26, 7) Source(44, 6) + SourceIndex(0) +6 >Emitted(26, 85) Source(45, 90) + SourceIndex(0) +7 >Emitted(26, 87) Source(44, 8) + SourceIndex(0) +8 >Emitted(26, 101) Source(44, 60) + SourceIndex(0) +9 >Emitted(26, 103) Source(44, 18) + SourceIndex(0) +10>Emitted(26, 124) Source(44, 35) + SourceIndex(0) +11>Emitted(26, 126) Source(44, 37) + SourceIndex(0) +12>Emitted(26, 151) Source(44, 58) + SourceIndex(0) +13>Emitted(26, 156) Source(45, 90) + SourceIndex(0) +--- +>>> i = 0; i < 1; i++) { +1 >^^^^ +2 > ^ +3 > ^^^ +4 > ^ +5 > ^^ +6 > ^ +7 > ^^^ +8 > ^ +9 > ^^ +10> ^ +11> ^^ +12> ^^ +13> ^ +14> ^^^-> +1 >, + > +2 > i +3 > = +4 > 0 +5 > ; +6 > i +7 > < +8 > 1 +9 > ; +10> i +11> ++ +12> ) +13> { +1 >Emitted(27, 5) Source(46, 5) + SourceIndex(0) +2 >Emitted(27, 6) Source(46, 6) + SourceIndex(0) +3 >Emitted(27, 9) Source(46, 9) + SourceIndex(0) +4 >Emitted(27, 10) Source(46, 10) + SourceIndex(0) +5 >Emitted(27, 12) Source(46, 12) + SourceIndex(0) +6 >Emitted(27, 13) Source(46, 13) + SourceIndex(0) +7 >Emitted(27, 16) Source(46, 16) + SourceIndex(0) +8 >Emitted(27, 17) Source(46, 17) + SourceIndex(0) +9 >Emitted(27, 19) Source(46, 19) + SourceIndex(0) +10>Emitted(27, 20) Source(46, 20) + SourceIndex(0) +11>Emitted(27, 22) Source(46, 22) + SourceIndex(0) +12>Emitted(27, 24) Source(46, 24) + SourceIndex(0) +13>Emitted(27, 25) Source(46, 25) + SourceIndex(0) +--- +>>> console.log(primaryA); +1->^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1-> + > +2 > console +3 > . +4 > log +5 > ( +6 > primaryA +7 > ) +8 > ; +1->Emitted(28, 5) Source(47, 5) + SourceIndex(0) +2 >Emitted(28, 12) Source(47, 12) + SourceIndex(0) +3 >Emitted(28, 13) Source(47, 13) + SourceIndex(0) +4 >Emitted(28, 16) Source(47, 16) + SourceIndex(0) +5 >Emitted(28, 17) Source(47, 17) + SourceIndex(0) +6 >Emitted(28, 25) Source(47, 25) + SourceIndex(0) +7 >Emitted(28, 26) Source(47, 26) + SourceIndex(0) +8 >Emitted(28, 27) Source(47, 27) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(29, 1) Source(48, 1) + SourceIndex(0) +2 >Emitted(29, 2) Source(48, 2) + SourceIndex(0) +--- +>>>for ((name = robot.name, robot), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^ +9 > ^ +10> ^^ +11> ^ +12> ^^^ +13> ^ +14> ^^ +15> ^ +16> ^^^ +17> ^ +18> ^^ +19> ^ +20> ^^ +21> ^^ +22> ^ +1-> + > +2 >for +3 > +4 > ( +5 > { +6 > name +7 > } = +8 > robot +9 > +10> , +11> i +12> = +13> 0 +14> ; +15> i +16> < +17> 1 +18> ; +19> i +20> ++ +21> ) +22> { +1->Emitted(30, 1) Source(49, 1) + SourceIndex(0) +2 >Emitted(30, 4) Source(49, 4) + SourceIndex(0) +3 >Emitted(30, 5) Source(49, 5) + SourceIndex(0) +4 >Emitted(30, 6) Source(49, 6) + SourceIndex(0) +5 >Emitted(30, 7) Source(49, 8) + SourceIndex(0) +6 >Emitted(30, 24) Source(49, 12) + SourceIndex(0) +7 >Emitted(30, 26) Source(49, 17) + SourceIndex(0) +8 >Emitted(30, 31) Source(49, 22) + SourceIndex(0) +9 >Emitted(30, 32) Source(49, 22) + SourceIndex(0) +10>Emitted(30, 34) Source(49, 24) + SourceIndex(0) +11>Emitted(30, 35) Source(49, 25) + SourceIndex(0) +12>Emitted(30, 38) Source(49, 28) + SourceIndex(0) +13>Emitted(30, 39) Source(49, 29) + SourceIndex(0) +14>Emitted(30, 41) Source(49, 31) + SourceIndex(0) +15>Emitted(30, 42) Source(49, 32) + SourceIndex(0) +16>Emitted(30, 45) Source(49, 35) + SourceIndex(0) +17>Emitted(30, 46) Source(49, 36) + SourceIndex(0) +18>Emitted(30, 48) Source(49, 38) + SourceIndex(0) +19>Emitted(30, 49) Source(49, 39) + SourceIndex(0) +20>Emitted(30, 51) Source(49, 41) + SourceIndex(0) +21>Emitted(30, 53) Source(49, 43) + SourceIndex(0) +22>Emitted(30, 54) Source(49, 44) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(31, 5) Source(50, 5) + SourceIndex(0) +2 >Emitted(31, 12) Source(50, 12) + SourceIndex(0) +3 >Emitted(31, 13) Source(50, 13) + SourceIndex(0) +4 >Emitted(31, 16) Source(50, 16) + SourceIndex(0) +5 >Emitted(31, 17) Source(50, 17) + SourceIndex(0) +6 >Emitted(31, 22) Source(50, 22) + SourceIndex(0) +7 >Emitted(31, 23) Source(50, 23) + SourceIndex(0) +8 >Emitted(31, 24) Source(50, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(32, 1) Source(51, 1) + SourceIndex(0) +2 >Emitted(32, 2) Source(51, 2) + SourceIndex(0) +--- +>>>for ((_h = getRobot(), name = _h.name, _h), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^ +9 > ^^^^^ +10> ^^ +11> ^ +12> ^^^ +13> ^ +14> ^^ +15> ^ +16> ^^^ +17> ^ +18> ^^ +19> ^ +20> ^^ +21> ^^ +22> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > { name } = getRobot() +7 > +8 > name +9 > } = getRobot() +10> , +11> i +12> = +13> 0 +14> ; +15> i +16> < +17> 1 +18> ; +19> i +20> ++ +21> ) +22> { +1->Emitted(33, 1) Source(52, 1) + SourceIndex(0) +2 >Emitted(33, 4) Source(52, 4) + SourceIndex(0) +3 >Emitted(33, 5) Source(52, 5) + SourceIndex(0) +4 >Emitted(33, 6) Source(52, 6) + SourceIndex(0) +5 >Emitted(33, 7) Source(52, 6) + SourceIndex(0) +6 >Emitted(33, 22) Source(52, 27) + SourceIndex(0) +7 >Emitted(33, 24) Source(52, 8) + SourceIndex(0) +8 >Emitted(33, 38) Source(52, 12) + SourceIndex(0) +9 >Emitted(33, 43) Source(52, 27) + SourceIndex(0) +10>Emitted(33, 45) Source(52, 29) + SourceIndex(0) +11>Emitted(33, 46) Source(52, 30) + SourceIndex(0) +12>Emitted(33, 49) Source(52, 33) + SourceIndex(0) +13>Emitted(33, 50) Source(52, 34) + SourceIndex(0) +14>Emitted(33, 52) Source(52, 36) + SourceIndex(0) +15>Emitted(33, 53) Source(52, 37) + SourceIndex(0) +16>Emitted(33, 56) Source(52, 40) + SourceIndex(0) +17>Emitted(33, 57) Source(52, 41) + SourceIndex(0) +18>Emitted(33, 59) Source(52, 43) + SourceIndex(0) +19>Emitted(33, 60) Source(52, 44) + SourceIndex(0) +20>Emitted(33, 62) Source(52, 46) + SourceIndex(0) +21>Emitted(33, 64) Source(52, 48) + SourceIndex(0) +22>Emitted(33, 65) Source(52, 49) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(34, 5) Source(53, 5) + SourceIndex(0) +2 >Emitted(34, 12) Source(53, 12) + SourceIndex(0) +3 >Emitted(34, 13) Source(53, 13) + SourceIndex(0) +4 >Emitted(34, 16) Source(53, 16) + SourceIndex(0) +5 >Emitted(34, 17) Source(53, 17) + SourceIndex(0) +6 >Emitted(34, 22) Source(53, 22) + SourceIndex(0) +7 >Emitted(34, 23) Source(53, 23) + SourceIndex(0) +8 >Emitted(34, 24) Source(53, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(35, 1) Source(54, 1) + SourceIndex(0) +2 >Emitted(35, 2) Source(54, 2) + SourceIndex(0) +--- +>>>for ((_j = { name: "trimmer", skill: "trimming" }, name = _j.name, _j), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^ +9 > ^^^^^ +10> ^^ +11> ^ +12> ^^^ +13> ^ +14> ^^ +15> ^ +16> ^^^ +17> ^ +18> ^^ +19> ^ +20> ^^ +21> ^^ +22> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > { name } = { name: "trimmer", skill: "trimming" } +7 > +8 > name +9 > } = { name: "trimmer", skill: "trimming" } +10> , +11> i +12> = +13> 0 +14> ; +15> i +16> < +17> 1 +18> ; +19> i +20> ++ +21> ) +22> { +1->Emitted(36, 1) Source(55, 1) + SourceIndex(0) +2 >Emitted(36, 4) Source(55, 4) + SourceIndex(0) +3 >Emitted(36, 5) Source(55, 5) + SourceIndex(0) +4 >Emitted(36, 6) Source(55, 6) + SourceIndex(0) +5 >Emitted(36, 7) Source(55, 6) + SourceIndex(0) +6 >Emitted(36, 50) Source(55, 62) + SourceIndex(0) +7 >Emitted(36, 52) Source(55, 8) + SourceIndex(0) +8 >Emitted(36, 66) Source(55, 12) + SourceIndex(0) +9 >Emitted(36, 71) Source(55, 62) + SourceIndex(0) +10>Emitted(36, 73) Source(55, 64) + SourceIndex(0) +11>Emitted(36, 74) Source(55, 65) + SourceIndex(0) +12>Emitted(36, 77) Source(55, 68) + SourceIndex(0) +13>Emitted(36, 78) Source(55, 69) + SourceIndex(0) +14>Emitted(36, 80) Source(55, 71) + SourceIndex(0) +15>Emitted(36, 81) Source(55, 72) + SourceIndex(0) +16>Emitted(36, 84) Source(55, 75) + SourceIndex(0) +17>Emitted(36, 85) Source(55, 76) + SourceIndex(0) +18>Emitted(36, 87) Source(55, 78) + SourceIndex(0) +19>Emitted(36, 88) Source(55, 79) + SourceIndex(0) +20>Emitted(36, 90) Source(55, 81) + SourceIndex(0) +21>Emitted(36, 92) Source(55, 83) + SourceIndex(0) +22>Emitted(36, 93) Source(55, 84) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(37, 5) Source(56, 5) + SourceIndex(0) +2 >Emitted(37, 12) Source(56, 12) + SourceIndex(0) +3 >Emitted(37, 13) Source(56, 13) + SourceIndex(0) +4 >Emitted(37, 16) Source(56, 16) + SourceIndex(0) +5 >Emitted(37, 17) Source(56, 17) + SourceIndex(0) +6 >Emitted(37, 22) Source(56, 22) + SourceIndex(0) +7 >Emitted(37, 23) Source(56, 23) + SourceIndex(0) +8 >Emitted(37, 24) Source(56, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(38, 1) Source(57, 1) + SourceIndex(0) +2 >Emitted(38, 2) Source(57, 2) + SourceIndex(0) +--- +>>>for ((_k = multiRobot.skills, primary = _k.primary, secondary = _k.secondary, multiRobot), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^ +13> ^ +14> ^^ +15> ^ +16> ^^^ +17> ^ +18> ^^ +19> ^ +20> ^^^ +21> ^ +22> ^^ +23> ^ +24> ^^ +25> ^^ +26> ^ +1-> + > +2 >for +3 > +4 > ( +5 > { +6 > skills: { primary, secondary } +7 > +8 > primary +9 > , +10> secondary +11> } } = +12> multiRobot +13> +14> , +15> i +16> = +17> 0 +18> ; +19> i +20> < +21> 1 +22> ; +23> i +24> ++ +25> ) +26> { +1->Emitted(39, 1) Source(58, 1) + SourceIndex(0) +2 >Emitted(39, 4) Source(58, 4) + SourceIndex(0) +3 >Emitted(39, 5) Source(58, 5) + SourceIndex(0) +4 >Emitted(39, 6) Source(58, 6) + SourceIndex(0) +5 >Emitted(39, 7) Source(58, 8) + SourceIndex(0) +6 >Emitted(39, 29) Source(58, 38) + SourceIndex(0) +7 >Emitted(39, 31) Source(58, 18) + SourceIndex(0) +8 >Emitted(39, 51) Source(58, 25) + SourceIndex(0) +9 >Emitted(39, 53) Source(58, 27) + SourceIndex(0) +10>Emitted(39, 77) Source(58, 36) + SourceIndex(0) +11>Emitted(39, 79) Source(58, 43) + SourceIndex(0) +12>Emitted(39, 89) Source(58, 53) + SourceIndex(0) +13>Emitted(39, 90) Source(58, 53) + SourceIndex(0) +14>Emitted(39, 92) Source(58, 55) + SourceIndex(0) +15>Emitted(39, 93) Source(58, 56) + SourceIndex(0) +16>Emitted(39, 96) Source(58, 59) + SourceIndex(0) +17>Emitted(39, 97) Source(58, 60) + SourceIndex(0) +18>Emitted(39, 99) Source(58, 62) + SourceIndex(0) +19>Emitted(39, 100) Source(58, 63) + SourceIndex(0) +20>Emitted(39, 103) Source(58, 66) + SourceIndex(0) +21>Emitted(39, 104) Source(58, 67) + SourceIndex(0) +22>Emitted(39, 106) Source(58, 69) + SourceIndex(0) +23>Emitted(39, 107) Source(58, 70) + SourceIndex(0) +24>Emitted(39, 109) Source(58, 72) + SourceIndex(0) +25>Emitted(39, 111) Source(58, 74) + SourceIndex(0) +26>Emitted(39, 112) Source(58, 75) + SourceIndex(0) +--- +>>> console.log(primaryA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > primaryA +7 > ) +8 > ; +1 >Emitted(40, 5) Source(59, 5) + SourceIndex(0) +2 >Emitted(40, 12) Source(59, 12) + SourceIndex(0) +3 >Emitted(40, 13) Source(59, 13) + SourceIndex(0) +4 >Emitted(40, 16) Source(59, 16) + SourceIndex(0) +5 >Emitted(40, 17) Source(59, 17) + SourceIndex(0) +6 >Emitted(40, 25) Source(59, 25) + SourceIndex(0) +7 >Emitted(40, 26) Source(59, 26) + SourceIndex(0) +8 >Emitted(40, 27) Source(59, 27) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(41, 1) Source(60, 1) + SourceIndex(0) +2 >Emitted(41, 2) Source(60, 2) + SourceIndex(0) +--- +>>>for ((_l = getMultiRobot(), _m = _l.skills, primary = _m.primary, secondary = _m.secondary, _l), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^^^^^^^^^^ +13> ^^^^^ +14> ^^ +15> ^ +16> ^^^ +17> ^ +18> ^^ +19> ^ +20> ^^^ +21> ^ +22> ^^ +23> ^ +24> ^^ +25> ^^ +26> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > { skills: { primary, secondary } } = getMultiRobot() +7 > +8 > skills: { primary, secondary } +9 > +10> primary +11> , +12> secondary +13> } } = getMultiRobot() +14> , +15> i +16> = +17> 0 +18> ; +19> i +20> < +21> 1 +22> ; +23> i +24> ++ +25> ) +26> { +1->Emitted(42, 1) Source(61, 1) + SourceIndex(0) +2 >Emitted(42, 4) Source(61, 4) + SourceIndex(0) +3 >Emitted(42, 5) Source(61, 5) + SourceIndex(0) +4 >Emitted(42, 6) Source(61, 6) + SourceIndex(0) +5 >Emitted(42, 7) Source(61, 6) + SourceIndex(0) +6 >Emitted(42, 27) Source(61, 58) + SourceIndex(0) +7 >Emitted(42, 29) Source(61, 8) + SourceIndex(0) +8 >Emitted(42, 43) Source(61, 38) + SourceIndex(0) +9 >Emitted(42, 45) Source(61, 18) + SourceIndex(0) +10>Emitted(42, 65) Source(61, 25) + SourceIndex(0) +11>Emitted(42, 67) Source(61, 27) + SourceIndex(0) +12>Emitted(42, 91) Source(61, 36) + SourceIndex(0) +13>Emitted(42, 96) Source(61, 58) + SourceIndex(0) +14>Emitted(42, 98) Source(61, 60) + SourceIndex(0) +15>Emitted(42, 99) Source(61, 61) + SourceIndex(0) +16>Emitted(42, 102) Source(61, 64) + SourceIndex(0) +17>Emitted(42, 103) Source(61, 65) + SourceIndex(0) +18>Emitted(42, 105) Source(61, 67) + SourceIndex(0) +19>Emitted(42, 106) Source(61, 68) + SourceIndex(0) +20>Emitted(42, 109) Source(61, 71) + SourceIndex(0) +21>Emitted(42, 110) Source(61, 72) + SourceIndex(0) +22>Emitted(42, 112) Source(61, 74) + SourceIndex(0) +23>Emitted(42, 113) Source(61, 75) + SourceIndex(0) +24>Emitted(42, 115) Source(61, 77) + SourceIndex(0) +25>Emitted(42, 117) Source(61, 79) + SourceIndex(0) +26>Emitted(42, 118) Source(61, 80) + SourceIndex(0) +--- +>>> console.log(primaryA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > primaryA +7 > ) +8 > ; +1 >Emitted(43, 5) Source(62, 5) + SourceIndex(0) +2 >Emitted(43, 12) Source(62, 12) + SourceIndex(0) +3 >Emitted(43, 13) Source(62, 13) + SourceIndex(0) +4 >Emitted(43, 16) Source(62, 16) + SourceIndex(0) +5 >Emitted(43, 17) Source(62, 17) + SourceIndex(0) +6 >Emitted(43, 25) Source(62, 25) + SourceIndex(0) +7 >Emitted(43, 26) Source(62, 26) + SourceIndex(0) +8 >Emitted(43, 27) Source(62, 27) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(44, 1) Source(63, 1) + SourceIndex(0) +2 >Emitted(44, 2) Source(63, 2) + SourceIndex(0) +--- +>>>for ((_o = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, _p = _o.skills, primary = _p.primary, secondary = _p.secondary, _o), +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^^^^^^^^^^ +13> ^^^^^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > { skills: { primary, secondary } } = + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } } +7 > +8 > skills: { primary, secondary } +9 > +10> primary +11> , +12> secondary +13> } } = + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } } +1->Emitted(45, 1) Source(64, 1) + SourceIndex(0) +2 >Emitted(45, 4) Source(64, 4) + SourceIndex(0) +3 >Emitted(45, 5) Source(64, 5) + SourceIndex(0) +4 >Emitted(45, 6) Source(64, 6) + SourceIndex(0) +5 >Emitted(45, 7) Source(64, 6) + SourceIndex(0) +6 >Emitted(45, 85) Source(65, 90) + SourceIndex(0) +7 >Emitted(45, 87) Source(64, 8) + SourceIndex(0) +8 >Emitted(45, 101) Source(64, 38) + SourceIndex(0) +9 >Emitted(45, 103) Source(64, 18) + SourceIndex(0) +10>Emitted(45, 123) Source(64, 25) + SourceIndex(0) +11>Emitted(45, 125) Source(64, 27) + SourceIndex(0) +12>Emitted(45, 149) Source(64, 36) + SourceIndex(0) +13>Emitted(45, 154) Source(65, 90) + SourceIndex(0) +--- +>>> i = 0; i < 1; i++) { +1 >^^^^ +2 > ^ +3 > ^^^ +4 > ^ +5 > ^^ +6 > ^ +7 > ^^^ +8 > ^ +9 > ^^ +10> ^ +11> ^^ +12> ^^ +13> ^ +14> ^^^-> +1 >, + > +2 > i +3 > = +4 > 0 +5 > ; +6 > i +7 > < +8 > 1 +9 > ; +10> i +11> ++ +12> ) +13> { +1 >Emitted(46, 5) Source(66, 5) + SourceIndex(0) +2 >Emitted(46, 6) Source(66, 6) + SourceIndex(0) +3 >Emitted(46, 9) Source(66, 9) + SourceIndex(0) +4 >Emitted(46, 10) Source(66, 10) + SourceIndex(0) +5 >Emitted(46, 12) Source(66, 12) + SourceIndex(0) +6 >Emitted(46, 13) Source(66, 13) + SourceIndex(0) +7 >Emitted(46, 16) Source(66, 16) + SourceIndex(0) +8 >Emitted(46, 17) Source(66, 17) + SourceIndex(0) +9 >Emitted(46, 19) Source(66, 19) + SourceIndex(0) +10>Emitted(46, 20) Source(66, 20) + SourceIndex(0) +11>Emitted(46, 22) Source(66, 22) + SourceIndex(0) +12>Emitted(46, 24) Source(66, 24) + SourceIndex(0) +13>Emitted(46, 25) Source(66, 25) + SourceIndex(0) +--- +>>> console.log(primaryA); +1->^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1-> + > +2 > console +3 > . +4 > log +5 > ( +6 > primaryA +7 > ) +8 > ; +1->Emitted(47, 5) Source(67, 5) + SourceIndex(0) +2 >Emitted(47, 12) Source(67, 12) + SourceIndex(0) +3 >Emitted(47, 13) Source(67, 13) + SourceIndex(0) +4 >Emitted(47, 16) Source(67, 16) + SourceIndex(0) +5 >Emitted(47, 17) Source(67, 17) + SourceIndex(0) +6 >Emitted(47, 25) Source(67, 25) + SourceIndex(0) +7 >Emitted(47, 26) Source(67, 26) + SourceIndex(0) +8 >Emitted(47, 27) Source(67, 27) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(48, 1) Source(68, 1) + SourceIndex(0) +2 >Emitted(48, 2) Source(68, 2) + SourceIndex(0) +--- +>>>for ((nameA = robot.name, skillA = robot.skill, robot), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^ +11> ^ +12> ^^ +13> ^ +14> ^^^ +15> ^ +16> ^^ +17> ^ +18> ^^^ +19> ^ +20> ^^ +21> ^ +22> ^^ +23> ^^ +24> ^ +1-> + > + > + > +2 >for +3 > +4 > ( +5 > { +6 > name: nameA +7 > , +8 > skill: skillA +9 > } = +10> robot +11> +12> , +13> i +14> = +15> 0 +16> ; +17> i +18> < +19> 1 +20> ; +21> i +22> ++ +23> ) +24> { +1->Emitted(49, 1) Source(71, 1) + SourceIndex(0) +2 >Emitted(49, 4) Source(71, 4) + SourceIndex(0) +3 >Emitted(49, 5) Source(71, 5) + SourceIndex(0) +4 >Emitted(49, 6) Source(71, 6) + SourceIndex(0) +5 >Emitted(49, 7) Source(71, 8) + SourceIndex(0) +6 >Emitted(49, 25) Source(71, 19) + SourceIndex(0) +7 >Emitted(49, 27) Source(71, 21) + SourceIndex(0) +8 >Emitted(49, 47) Source(71, 34) + SourceIndex(0) +9 >Emitted(49, 49) Source(71, 39) + SourceIndex(0) +10>Emitted(49, 54) Source(71, 44) + SourceIndex(0) +11>Emitted(49, 55) Source(71, 44) + SourceIndex(0) +12>Emitted(49, 57) Source(71, 46) + SourceIndex(0) +13>Emitted(49, 58) Source(71, 47) + SourceIndex(0) +14>Emitted(49, 61) Source(71, 50) + SourceIndex(0) +15>Emitted(49, 62) Source(71, 51) + SourceIndex(0) +16>Emitted(49, 64) Source(71, 53) + SourceIndex(0) +17>Emitted(49, 65) Source(71, 54) + SourceIndex(0) +18>Emitted(49, 68) Source(71, 57) + SourceIndex(0) +19>Emitted(49, 69) Source(71, 58) + SourceIndex(0) +20>Emitted(49, 71) Source(71, 60) + SourceIndex(0) +21>Emitted(49, 72) Source(71, 61) + SourceIndex(0) +22>Emitted(49, 74) Source(71, 63) + SourceIndex(0) +23>Emitted(49, 76) Source(71, 65) + SourceIndex(0) +24>Emitted(49, 77) Source(71, 66) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(50, 5) Source(72, 5) + SourceIndex(0) +2 >Emitted(50, 12) Source(72, 12) + SourceIndex(0) +3 >Emitted(50, 13) Source(72, 13) + SourceIndex(0) +4 >Emitted(50, 16) Source(72, 16) + SourceIndex(0) +5 >Emitted(50, 17) Source(72, 17) + SourceIndex(0) +6 >Emitted(50, 22) Source(72, 22) + SourceIndex(0) +7 >Emitted(50, 23) Source(72, 23) + SourceIndex(0) +8 >Emitted(50, 24) Source(72, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(51, 1) Source(73, 1) + SourceIndex(0) +2 >Emitted(51, 2) Source(73, 2) + SourceIndex(0) +--- +>>>for ((_q = getRobot(), nameA = _q.name, skillA = _q.skill, _q), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^ +11> ^^^^^ +12> ^^ +13> ^ +14> ^^^ +15> ^ +16> ^^ +17> ^ +18> ^^^ +19> ^ +20> ^^ +21> ^ +22> ^^ +23> ^^ +24> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > { name: nameA, skill: skillA } = getRobot() +7 > +8 > name: nameA +9 > , +10> skill: skillA +11> } = getRobot() +12> , +13> i +14> = +15> 0 +16> ; +17> i +18> < +19> 1 +20> ; +21> i +22> ++ +23> ) +24> { +1->Emitted(52, 1) Source(74, 1) + SourceIndex(0) +2 >Emitted(52, 4) Source(74, 4) + SourceIndex(0) +3 >Emitted(52, 5) Source(74, 5) + SourceIndex(0) +4 >Emitted(52, 6) Source(74, 6) + SourceIndex(0) +5 >Emitted(52, 7) Source(74, 6) + SourceIndex(0) +6 >Emitted(52, 22) Source(74, 49) + SourceIndex(0) +7 >Emitted(52, 24) Source(74, 8) + SourceIndex(0) +8 >Emitted(52, 39) Source(74, 19) + SourceIndex(0) +9 >Emitted(52, 41) Source(74, 21) + SourceIndex(0) +10>Emitted(52, 58) Source(74, 34) + SourceIndex(0) +11>Emitted(52, 63) Source(74, 49) + SourceIndex(0) +12>Emitted(52, 65) Source(74, 51) + SourceIndex(0) +13>Emitted(52, 66) Source(74, 52) + SourceIndex(0) +14>Emitted(52, 69) Source(74, 55) + SourceIndex(0) +15>Emitted(52, 70) Source(74, 56) + SourceIndex(0) +16>Emitted(52, 72) Source(74, 58) + SourceIndex(0) +17>Emitted(52, 73) Source(74, 59) + SourceIndex(0) +18>Emitted(52, 76) Source(74, 62) + SourceIndex(0) +19>Emitted(52, 77) Source(74, 63) + SourceIndex(0) +20>Emitted(52, 79) Source(74, 65) + SourceIndex(0) +21>Emitted(52, 80) Source(74, 66) + SourceIndex(0) +22>Emitted(52, 82) Source(74, 68) + SourceIndex(0) +23>Emitted(52, 84) Source(74, 70) + SourceIndex(0) +24>Emitted(52, 85) Source(74, 71) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(53, 5) Source(75, 5) + SourceIndex(0) +2 >Emitted(53, 12) Source(75, 12) + SourceIndex(0) +3 >Emitted(53, 13) Source(75, 13) + SourceIndex(0) +4 >Emitted(53, 16) Source(75, 16) + SourceIndex(0) +5 >Emitted(53, 17) Source(75, 17) + SourceIndex(0) +6 >Emitted(53, 22) Source(75, 22) + SourceIndex(0) +7 >Emitted(53, 23) Source(75, 23) + SourceIndex(0) +8 >Emitted(53, 24) Source(75, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(54, 1) Source(76, 1) + SourceIndex(0) +2 >Emitted(54, 2) Source(76, 2) + SourceIndex(0) +--- +>>>for ((_r = { name: "trimmer", skill: "trimming" }, nameA = _r.name, skillA = _r.skill, _r), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^ +11> ^^^^^ +12> ^^ +13> ^ +14> ^^^ +15> ^ +16> ^^ +17> ^ +18> ^^^ +19> ^ +20> ^^ +21> ^ +22> ^^ +23> ^^ +24> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > { name: nameA, skill: skillA } = { name: "trimmer", skill: "trimming" } +7 > +8 > name: nameA +9 > , +10> skill: skillA +11> } = { name: "trimmer", skill: "trimming" } +12> , +13> i +14> = +15> 0 +16> ; +17> i +18> < +19> 1 +20> ; +21> i +22> ++ +23> ) +24> { +1->Emitted(55, 1) Source(77, 1) + SourceIndex(0) +2 >Emitted(55, 4) Source(77, 4) + SourceIndex(0) +3 >Emitted(55, 5) Source(77, 5) + SourceIndex(0) +4 >Emitted(55, 6) Source(77, 6) + SourceIndex(0) +5 >Emitted(55, 7) Source(77, 6) + SourceIndex(0) +6 >Emitted(55, 50) Source(77, 84) + SourceIndex(0) +7 >Emitted(55, 52) Source(77, 8) + SourceIndex(0) +8 >Emitted(55, 67) Source(77, 19) + SourceIndex(0) +9 >Emitted(55, 69) Source(77, 21) + SourceIndex(0) +10>Emitted(55, 86) Source(77, 34) + SourceIndex(0) +11>Emitted(55, 91) Source(77, 84) + SourceIndex(0) +12>Emitted(55, 93) Source(77, 86) + SourceIndex(0) +13>Emitted(55, 94) Source(77, 87) + SourceIndex(0) +14>Emitted(55, 97) Source(77, 90) + SourceIndex(0) +15>Emitted(55, 98) Source(77, 91) + SourceIndex(0) +16>Emitted(55, 100) Source(77, 93) + SourceIndex(0) +17>Emitted(55, 101) Source(77, 94) + SourceIndex(0) +18>Emitted(55, 104) Source(77, 97) + SourceIndex(0) +19>Emitted(55, 105) Source(77, 98) + SourceIndex(0) +20>Emitted(55, 107) Source(77, 100) + SourceIndex(0) +21>Emitted(55, 108) Source(77, 101) + SourceIndex(0) +22>Emitted(55, 110) Source(77, 103) + SourceIndex(0) +23>Emitted(55, 112) Source(77, 105) + SourceIndex(0) +24>Emitted(55, 113) Source(77, 106) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(56, 5) Source(78, 5) + SourceIndex(0) +2 >Emitted(56, 12) Source(78, 12) + SourceIndex(0) +3 >Emitted(56, 13) Source(78, 13) + SourceIndex(0) +4 >Emitted(56, 16) Source(78, 16) + SourceIndex(0) +5 >Emitted(56, 17) Source(78, 17) + SourceIndex(0) +6 >Emitted(56, 22) Source(78, 22) + SourceIndex(0) +7 >Emitted(56, 23) Source(78, 23) + SourceIndex(0) +8 >Emitted(56, 24) Source(78, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(57, 1) Source(79, 1) + SourceIndex(0) +2 >Emitted(57, 2) Source(79, 2) + SourceIndex(0) +--- +>>>for ((nameA = multiRobot.name, _s = multiRobot.skills, primaryA = _s.primary, secondaryA = _s.secondary, multiRobot), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^ +15> ^ +16> ^^ +17> ^ +18> ^^^ +19> ^ +20> ^^ +21> ^ +22> ^^^ +23> ^ +24> ^^ +25> ^ +26> ^^ +27> ^^ +28> ^ +1-> + > +2 >for +3 > +4 > ( +5 > { +6 > name: nameA +7 > , +8 > skills: { primary: primaryA, secondary: secondaryA } +9 > +10> primary: primaryA +11> , +12> secondary: secondaryA +13> } } = +14> multiRobot +15> +16> , +17> i +18> = +19> 0 +20> ; +21> i +22> < +23> 1 +24> ; +25> i +26> ++ +27> ) +28> { +1->Emitted(58, 1) Source(80, 1) + SourceIndex(0) +2 >Emitted(58, 4) Source(80, 4) + SourceIndex(0) +3 >Emitted(58, 5) Source(80, 5) + SourceIndex(0) +4 >Emitted(58, 6) Source(80, 6) + SourceIndex(0) +5 >Emitted(58, 7) Source(80, 8) + SourceIndex(0) +6 >Emitted(58, 30) Source(80, 19) + SourceIndex(0) +7 >Emitted(58, 32) Source(80, 21) + SourceIndex(0) +8 >Emitted(58, 54) Source(80, 73) + SourceIndex(0) +9 >Emitted(58, 56) Source(80, 31) + SourceIndex(0) +10>Emitted(58, 77) Source(80, 48) + SourceIndex(0) +11>Emitted(58, 79) Source(80, 50) + SourceIndex(0) +12>Emitted(58, 104) Source(80, 71) + SourceIndex(0) +13>Emitted(58, 106) Source(80, 78) + SourceIndex(0) +14>Emitted(58, 116) Source(80, 88) + SourceIndex(0) +15>Emitted(58, 117) Source(80, 88) + SourceIndex(0) +16>Emitted(58, 119) Source(80, 90) + SourceIndex(0) +17>Emitted(58, 120) Source(80, 91) + SourceIndex(0) +18>Emitted(58, 123) Source(80, 94) + SourceIndex(0) +19>Emitted(58, 124) Source(80, 95) + SourceIndex(0) +20>Emitted(58, 126) Source(80, 97) + SourceIndex(0) +21>Emitted(58, 127) Source(80, 98) + SourceIndex(0) +22>Emitted(58, 130) Source(80, 101) + SourceIndex(0) +23>Emitted(58, 131) Source(80, 102) + SourceIndex(0) +24>Emitted(58, 133) Source(80, 104) + SourceIndex(0) +25>Emitted(58, 134) Source(80, 105) + SourceIndex(0) +26>Emitted(58, 136) Source(80, 107) + SourceIndex(0) +27>Emitted(58, 138) Source(80, 109) + SourceIndex(0) +28>Emitted(58, 139) Source(80, 110) + SourceIndex(0) +--- +>>> console.log(primaryA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > primaryA +7 > ) +8 > ; +1 >Emitted(59, 5) Source(81, 5) + SourceIndex(0) +2 >Emitted(59, 12) Source(81, 12) + SourceIndex(0) +3 >Emitted(59, 13) Source(81, 13) + SourceIndex(0) +4 >Emitted(59, 16) Source(81, 16) + SourceIndex(0) +5 >Emitted(59, 17) Source(81, 17) + SourceIndex(0) +6 >Emitted(59, 25) Source(81, 25) + SourceIndex(0) +7 >Emitted(59, 26) Source(81, 26) + SourceIndex(0) +8 >Emitted(59, 27) Source(81, 27) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(60, 1) Source(82, 1) + SourceIndex(0) +2 >Emitted(60, 2) Source(82, 2) + SourceIndex(0) +--- +>>>for ((_t = getMultiRobot(), nameA = _t.name, _u = _t.skills, primaryA = _u.primary, secondaryA = _u.secondary, _t), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^^^^^^^^^^^^ +15> ^^^^^ +16> ^^ +17> ^ +18> ^^^ +19> ^ +20> ^^ +21> ^ +22> ^^^ +23> ^ +24> ^^ +25> ^ +26> ^^ +27> ^^ +28> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > { name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = getMultiRobot() +7 > +8 > name: nameA +9 > , +10> skills: { primary: primaryA, secondary: secondaryA } +11> +12> primary: primaryA +13> , +14> secondary: secondaryA +15> } } = getMultiRobot() +16> , +17> i +18> = +19> 0 +20> ; +21> i +22> < +23> 1 +24> ; +25> i +26> ++ +27> ) +28> { +1->Emitted(61, 1) Source(83, 1) + SourceIndex(0) +2 >Emitted(61, 4) Source(83, 4) + SourceIndex(0) +3 >Emitted(61, 5) Source(83, 5) + SourceIndex(0) +4 >Emitted(61, 6) Source(83, 6) + SourceIndex(0) +5 >Emitted(61, 7) Source(83, 6) + SourceIndex(0) +6 >Emitted(61, 27) Source(83, 93) + SourceIndex(0) +7 >Emitted(61, 29) Source(83, 8) + SourceIndex(0) +8 >Emitted(61, 44) Source(83, 19) + SourceIndex(0) +9 >Emitted(61, 46) Source(83, 21) + SourceIndex(0) +10>Emitted(61, 60) Source(83, 73) + SourceIndex(0) +11>Emitted(61, 62) Source(83, 31) + SourceIndex(0) +12>Emitted(61, 83) Source(83, 48) + SourceIndex(0) +13>Emitted(61, 85) Source(83, 50) + SourceIndex(0) +14>Emitted(61, 110) Source(83, 71) + SourceIndex(0) +15>Emitted(61, 115) Source(83, 93) + SourceIndex(0) +16>Emitted(61, 117) Source(83, 95) + SourceIndex(0) +17>Emitted(61, 118) Source(83, 96) + SourceIndex(0) +18>Emitted(61, 121) Source(83, 99) + SourceIndex(0) +19>Emitted(61, 122) Source(83, 100) + SourceIndex(0) +20>Emitted(61, 124) Source(83, 102) + SourceIndex(0) +21>Emitted(61, 125) Source(83, 103) + SourceIndex(0) +22>Emitted(61, 128) Source(83, 106) + SourceIndex(0) +23>Emitted(61, 129) Source(83, 107) + SourceIndex(0) +24>Emitted(61, 131) Source(83, 109) + SourceIndex(0) +25>Emitted(61, 132) Source(83, 110) + SourceIndex(0) +26>Emitted(61, 134) Source(83, 112) + SourceIndex(0) +27>Emitted(61, 136) Source(83, 114) + SourceIndex(0) +28>Emitted(61, 137) Source(83, 115) + SourceIndex(0) +--- +>>> console.log(primaryA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > primaryA +7 > ) +8 > ; +1 >Emitted(62, 5) Source(84, 5) + SourceIndex(0) +2 >Emitted(62, 12) Source(84, 12) + SourceIndex(0) +3 >Emitted(62, 13) Source(84, 13) + SourceIndex(0) +4 >Emitted(62, 16) Source(84, 16) + SourceIndex(0) +5 >Emitted(62, 17) Source(84, 17) + SourceIndex(0) +6 >Emitted(62, 25) Source(84, 25) + SourceIndex(0) +7 >Emitted(62, 26) Source(84, 26) + SourceIndex(0) +8 >Emitted(62, 27) Source(84, 27) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(63, 1) Source(85, 1) + SourceIndex(0) +2 >Emitted(63, 2) Source(85, 2) + SourceIndex(0) +--- +>>>for ((_v = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, nameA = _v.name, _w = _v.skills, primaryA = _w.primary, secondaryA = _w.secondary, _v), +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^^^^^^^^^^^^ +15> ^^^^^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > { name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } } +7 > +8 > name: nameA +9 > , +10> skills: { primary: primaryA, secondary: secondaryA } +11> +12> primary: primaryA +13> , +14> secondary: secondaryA +15> } } = + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } } +1->Emitted(64, 1) Source(86, 1) + SourceIndex(0) +2 >Emitted(64, 4) Source(86, 4) + SourceIndex(0) +3 >Emitted(64, 5) Source(86, 5) + SourceIndex(0) +4 >Emitted(64, 6) Source(86, 6) + SourceIndex(0) +5 >Emitted(64, 7) Source(86, 6) + SourceIndex(0) +6 >Emitted(64, 85) Source(87, 90) + SourceIndex(0) +7 >Emitted(64, 87) Source(86, 8) + SourceIndex(0) +8 >Emitted(64, 102) Source(86, 19) + SourceIndex(0) +9 >Emitted(64, 104) Source(86, 21) + SourceIndex(0) +10>Emitted(64, 118) Source(86, 73) + SourceIndex(0) +11>Emitted(64, 120) Source(86, 31) + SourceIndex(0) +12>Emitted(64, 141) Source(86, 48) + SourceIndex(0) +13>Emitted(64, 143) Source(86, 50) + SourceIndex(0) +14>Emitted(64, 168) Source(86, 71) + SourceIndex(0) +15>Emitted(64, 173) Source(87, 90) + SourceIndex(0) +--- +>>> i = 0; i < 1; i++) { +1 >^^^^ +2 > ^ +3 > ^^^ +4 > ^ +5 > ^^ +6 > ^ +7 > ^^^ +8 > ^ +9 > ^^ +10> ^ +11> ^^ +12> ^^ +13> ^ +14> ^^^-> +1 >, + > +2 > i +3 > = +4 > 0 +5 > ; +6 > i +7 > < +8 > 1 +9 > ; +10> i +11> ++ +12> ) +13> { +1 >Emitted(65, 5) Source(88, 5) + SourceIndex(0) +2 >Emitted(65, 6) Source(88, 6) + SourceIndex(0) +3 >Emitted(65, 9) Source(88, 9) + SourceIndex(0) +4 >Emitted(65, 10) Source(88, 10) + SourceIndex(0) +5 >Emitted(65, 12) Source(88, 12) + SourceIndex(0) +6 >Emitted(65, 13) Source(88, 13) + SourceIndex(0) +7 >Emitted(65, 16) Source(88, 16) + SourceIndex(0) +8 >Emitted(65, 17) Source(88, 17) + SourceIndex(0) +9 >Emitted(65, 19) Source(88, 19) + SourceIndex(0) +10>Emitted(65, 20) Source(88, 20) + SourceIndex(0) +11>Emitted(65, 22) Source(88, 22) + SourceIndex(0) +12>Emitted(65, 24) Source(88, 24) + SourceIndex(0) +13>Emitted(65, 25) Source(88, 25) + SourceIndex(0) +--- +>>> console.log(primaryA); +1->^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1-> + > +2 > console +3 > . +4 > log +5 > ( +6 > primaryA +7 > ) +8 > ; +1->Emitted(66, 5) Source(89, 5) + SourceIndex(0) +2 >Emitted(66, 12) Source(89, 12) + SourceIndex(0) +3 >Emitted(66, 13) Source(89, 13) + SourceIndex(0) +4 >Emitted(66, 16) Source(89, 16) + SourceIndex(0) +5 >Emitted(66, 17) Source(89, 17) + SourceIndex(0) +6 >Emitted(66, 25) Source(89, 25) + SourceIndex(0) +7 >Emitted(66, 26) Source(89, 26) + SourceIndex(0) +8 >Emitted(66, 27) Source(89, 27) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(67, 1) Source(90, 1) + SourceIndex(0) +2 >Emitted(67, 2) Source(90, 2) + SourceIndex(0) +--- +>>>for ((name = robot.name, skill = robot.skill, robot), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^ +11> ^ +12> ^^ +13> ^ +14> ^^^ +15> ^ +16> ^^ +17> ^ +18> ^^^ +19> ^ +20> ^^ +21> ^ +22> ^^ +23> ^^ +24> ^ +1-> + > +2 >for +3 > +4 > ( +5 > { +6 > name +7 > , +8 > skill +9 > } = +10> robot +11> +12> , +13> i +14> = +15> 0 +16> ; +17> i +18> < +19> 1 +20> ; +21> i +22> ++ +23> ) +24> { +1->Emitted(68, 1) Source(91, 1) + SourceIndex(0) +2 >Emitted(68, 4) Source(91, 4) + SourceIndex(0) +3 >Emitted(68, 5) Source(91, 5) + SourceIndex(0) +4 >Emitted(68, 6) Source(91, 6) + SourceIndex(0) +5 >Emitted(68, 7) Source(91, 8) + SourceIndex(0) +6 >Emitted(68, 24) Source(91, 12) + SourceIndex(0) +7 >Emitted(68, 26) Source(91, 14) + SourceIndex(0) +8 >Emitted(68, 45) Source(91, 19) + SourceIndex(0) +9 >Emitted(68, 47) Source(91, 24) + SourceIndex(0) +10>Emitted(68, 52) Source(91, 29) + SourceIndex(0) +11>Emitted(68, 53) Source(91, 29) + SourceIndex(0) +12>Emitted(68, 55) Source(91, 31) + SourceIndex(0) +13>Emitted(68, 56) Source(91, 32) + SourceIndex(0) +14>Emitted(68, 59) Source(91, 35) + SourceIndex(0) +15>Emitted(68, 60) Source(91, 36) + SourceIndex(0) +16>Emitted(68, 62) Source(91, 38) + SourceIndex(0) +17>Emitted(68, 63) Source(91, 39) + SourceIndex(0) +18>Emitted(68, 66) Source(91, 42) + SourceIndex(0) +19>Emitted(68, 67) Source(91, 43) + SourceIndex(0) +20>Emitted(68, 69) Source(91, 45) + SourceIndex(0) +21>Emitted(68, 70) Source(91, 46) + SourceIndex(0) +22>Emitted(68, 72) Source(91, 48) + SourceIndex(0) +23>Emitted(68, 74) Source(91, 50) + SourceIndex(0) +24>Emitted(68, 75) Source(91, 51) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(69, 5) Source(92, 5) + SourceIndex(0) +2 >Emitted(69, 12) Source(92, 12) + SourceIndex(0) +3 >Emitted(69, 13) Source(92, 13) + SourceIndex(0) +4 >Emitted(69, 16) Source(92, 16) + SourceIndex(0) +5 >Emitted(69, 17) Source(92, 17) + SourceIndex(0) +6 >Emitted(69, 22) Source(92, 22) + SourceIndex(0) +7 >Emitted(69, 23) Source(92, 23) + SourceIndex(0) +8 >Emitted(69, 24) Source(92, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(70, 1) Source(93, 1) + SourceIndex(0) +2 >Emitted(70, 2) Source(93, 2) + SourceIndex(0) +--- +>>>for ((_x = getRobot(), name = _x.name, skill = _x.skill, _x), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^ +11> ^^^^^ +12> ^^ +13> ^ +14> ^^^ +15> ^ +16> ^^ +17> ^ +18> ^^^ +19> ^ +20> ^^ +21> ^ +22> ^^ +23> ^^ +24> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > { name, skill } = getRobot() +7 > +8 > name +9 > , +10> skill +11> } = getRobot() +12> , +13> i +14> = +15> 0 +16> ; +17> i +18> < +19> 1 +20> ; +21> i +22> ++ +23> ) +24> { +1->Emitted(71, 1) Source(94, 1) + SourceIndex(0) +2 >Emitted(71, 4) Source(94, 4) + SourceIndex(0) +3 >Emitted(71, 5) Source(94, 5) + SourceIndex(0) +4 >Emitted(71, 6) Source(94, 6) + SourceIndex(0) +5 >Emitted(71, 7) Source(94, 6) + SourceIndex(0) +6 >Emitted(71, 22) Source(94, 34) + SourceIndex(0) +7 >Emitted(71, 24) Source(94, 8) + SourceIndex(0) +8 >Emitted(71, 38) Source(94, 12) + SourceIndex(0) +9 >Emitted(71, 40) Source(94, 14) + SourceIndex(0) +10>Emitted(71, 56) Source(94, 19) + SourceIndex(0) +11>Emitted(71, 61) Source(94, 34) + SourceIndex(0) +12>Emitted(71, 63) Source(94, 36) + SourceIndex(0) +13>Emitted(71, 64) Source(94, 37) + SourceIndex(0) +14>Emitted(71, 67) Source(94, 40) + SourceIndex(0) +15>Emitted(71, 68) Source(94, 41) + SourceIndex(0) +16>Emitted(71, 70) Source(94, 43) + SourceIndex(0) +17>Emitted(71, 71) Source(94, 44) + SourceIndex(0) +18>Emitted(71, 74) Source(94, 47) + SourceIndex(0) +19>Emitted(71, 75) Source(94, 48) + SourceIndex(0) +20>Emitted(71, 77) Source(94, 50) + SourceIndex(0) +21>Emitted(71, 78) Source(94, 51) + SourceIndex(0) +22>Emitted(71, 80) Source(94, 53) + SourceIndex(0) +23>Emitted(71, 82) Source(94, 55) + SourceIndex(0) +24>Emitted(71, 83) Source(94, 56) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(72, 5) Source(95, 5) + SourceIndex(0) +2 >Emitted(72, 12) Source(95, 12) + SourceIndex(0) +3 >Emitted(72, 13) Source(95, 13) + SourceIndex(0) +4 >Emitted(72, 16) Source(95, 16) + SourceIndex(0) +5 >Emitted(72, 17) Source(95, 17) + SourceIndex(0) +6 >Emitted(72, 22) Source(95, 22) + SourceIndex(0) +7 >Emitted(72, 23) Source(95, 23) + SourceIndex(0) +8 >Emitted(72, 24) Source(95, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(73, 1) Source(96, 1) + SourceIndex(0) +2 >Emitted(73, 2) Source(96, 2) + SourceIndex(0) +--- +>>>for ((_y = { name: "trimmer", skill: "trimming" }, name = _y.name, skill = _y.skill, _y), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^ +11> ^^^^^ +12> ^^ +13> ^ +14> ^^^ +15> ^ +16> ^^ +17> ^ +18> ^^^ +19> ^ +20> ^^ +21> ^ +22> ^^ +23> ^^ +24> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > { name, skill } = { name: "trimmer", skill: "trimming" } +7 > +8 > name +9 > , +10> skill +11> } = { name: "trimmer", skill: "trimming" } +12> , +13> i +14> = +15> 0 +16> ; +17> i +18> < +19> 1 +20> ; +21> i +22> ++ +23> ) +24> { +1->Emitted(74, 1) Source(97, 1) + SourceIndex(0) +2 >Emitted(74, 4) Source(97, 4) + SourceIndex(0) +3 >Emitted(74, 5) Source(97, 5) + SourceIndex(0) +4 >Emitted(74, 6) Source(97, 6) + SourceIndex(0) +5 >Emitted(74, 7) Source(97, 6) + SourceIndex(0) +6 >Emitted(74, 50) Source(97, 69) + SourceIndex(0) +7 >Emitted(74, 52) Source(97, 8) + SourceIndex(0) +8 >Emitted(74, 66) Source(97, 12) + SourceIndex(0) +9 >Emitted(74, 68) Source(97, 14) + SourceIndex(0) +10>Emitted(74, 84) Source(97, 19) + SourceIndex(0) +11>Emitted(74, 89) Source(97, 69) + SourceIndex(0) +12>Emitted(74, 91) Source(97, 71) + SourceIndex(0) +13>Emitted(74, 92) Source(97, 72) + SourceIndex(0) +14>Emitted(74, 95) Source(97, 75) + SourceIndex(0) +15>Emitted(74, 96) Source(97, 76) + SourceIndex(0) +16>Emitted(74, 98) Source(97, 78) + SourceIndex(0) +17>Emitted(74, 99) Source(97, 79) + SourceIndex(0) +18>Emitted(74, 102) Source(97, 82) + SourceIndex(0) +19>Emitted(74, 103) Source(97, 83) + SourceIndex(0) +20>Emitted(74, 105) Source(97, 85) + SourceIndex(0) +21>Emitted(74, 106) Source(97, 86) + SourceIndex(0) +22>Emitted(74, 108) Source(97, 88) + SourceIndex(0) +23>Emitted(74, 110) Source(97, 90) + SourceIndex(0) +24>Emitted(74, 111) Source(97, 91) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(75, 5) Source(98, 5) + SourceIndex(0) +2 >Emitted(75, 12) Source(98, 12) + SourceIndex(0) +3 >Emitted(75, 13) Source(98, 13) + SourceIndex(0) +4 >Emitted(75, 16) Source(98, 16) + SourceIndex(0) +5 >Emitted(75, 17) Source(98, 17) + SourceIndex(0) +6 >Emitted(75, 22) Source(98, 22) + SourceIndex(0) +7 >Emitted(75, 23) Source(98, 23) + SourceIndex(0) +8 >Emitted(75, 24) Source(98, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(76, 1) Source(99, 1) + SourceIndex(0) +2 >Emitted(76, 2) Source(99, 2) + SourceIndex(0) +--- +>>>for ((name = multiRobot.name, _z = multiRobot.skills, primary = _z.primary, secondary = _z.secondary, multiRobot), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^ +15> ^ +16> ^^ +17> ^ +18> ^^^ +19> ^ +20> ^^ +21> ^ +22> ^^^ +23> ^ +24> ^^ +25> ^ +26> ^^ +27> ^^ +28> ^ +1-> + > +2 >for +3 > +4 > ( +5 > { +6 > name +7 > , +8 > skills: { primary, secondary } +9 > +10> primary +11> , +12> secondary +13> } } = +14> multiRobot +15> +16> , +17> i +18> = +19> 0 +20> ; +21> i +22> < +23> 1 +24> ; +25> i +26> ++ +27> ) +28> { +1->Emitted(77, 1) Source(100, 1) + SourceIndex(0) +2 >Emitted(77, 4) Source(100, 4) + SourceIndex(0) +3 >Emitted(77, 5) Source(100, 5) + SourceIndex(0) +4 >Emitted(77, 6) Source(100, 6) + SourceIndex(0) +5 >Emitted(77, 7) Source(100, 8) + SourceIndex(0) +6 >Emitted(77, 29) Source(100, 12) + SourceIndex(0) +7 >Emitted(77, 31) Source(100, 14) + SourceIndex(0) +8 >Emitted(77, 53) Source(100, 44) + SourceIndex(0) +9 >Emitted(77, 55) Source(100, 24) + SourceIndex(0) +10>Emitted(77, 75) Source(100, 31) + SourceIndex(0) +11>Emitted(77, 77) Source(100, 33) + SourceIndex(0) +12>Emitted(77, 101) Source(100, 42) + SourceIndex(0) +13>Emitted(77, 103) Source(100, 49) + SourceIndex(0) +14>Emitted(77, 113) Source(100, 59) + SourceIndex(0) +15>Emitted(77, 114) Source(100, 59) + SourceIndex(0) +16>Emitted(77, 116) Source(100, 61) + SourceIndex(0) +17>Emitted(77, 117) Source(100, 62) + SourceIndex(0) +18>Emitted(77, 120) Source(100, 65) + SourceIndex(0) +19>Emitted(77, 121) Source(100, 66) + SourceIndex(0) +20>Emitted(77, 123) Source(100, 68) + SourceIndex(0) +21>Emitted(77, 124) Source(100, 69) + SourceIndex(0) +22>Emitted(77, 127) Source(100, 72) + SourceIndex(0) +23>Emitted(77, 128) Source(100, 73) + SourceIndex(0) +24>Emitted(77, 130) Source(100, 75) + SourceIndex(0) +25>Emitted(77, 131) Source(100, 76) + SourceIndex(0) +26>Emitted(77, 133) Source(100, 78) + SourceIndex(0) +27>Emitted(77, 135) Source(100, 80) + SourceIndex(0) +28>Emitted(77, 136) Source(100, 81) + SourceIndex(0) +--- +>>> console.log(primaryA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > primaryA +7 > ) +8 > ; +1 >Emitted(78, 5) Source(101, 5) + SourceIndex(0) +2 >Emitted(78, 12) Source(101, 12) + SourceIndex(0) +3 >Emitted(78, 13) Source(101, 13) + SourceIndex(0) +4 >Emitted(78, 16) Source(101, 16) + SourceIndex(0) +5 >Emitted(78, 17) Source(101, 17) + SourceIndex(0) +6 >Emitted(78, 25) Source(101, 25) + SourceIndex(0) +7 >Emitted(78, 26) Source(101, 26) + SourceIndex(0) +8 >Emitted(78, 27) Source(101, 27) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(79, 1) Source(102, 1) + SourceIndex(0) +2 >Emitted(79, 2) Source(102, 2) + SourceIndex(0) +--- +>>>for ((_0 = getMultiRobot(), name = _0.name, _1 = _0.skills, primary = _1.primary, secondary = _1.secondary, _0), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^^^^^^^^^^^ +15> ^^^^^ +16> ^^ +17> ^ +18> ^^^ +19> ^ +20> ^^ +21> ^ +22> ^^^ +23> ^ +24> ^^ +25> ^ +26> ^^ +27> ^^ +28> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > { name, skills: { primary, secondary } } = getMultiRobot() +7 > +8 > name +9 > , +10> skills: { primary, secondary } +11> +12> primary +13> , +14> secondary +15> } } = getMultiRobot() +16> , +17> i +18> = +19> 0 +20> ; +21> i +22> < +23> 1 +24> ; +25> i +26> ++ +27> ) +28> { +1->Emitted(80, 1) Source(103, 1) + SourceIndex(0) +2 >Emitted(80, 4) Source(103, 4) + SourceIndex(0) +3 >Emitted(80, 5) Source(103, 5) + SourceIndex(0) +4 >Emitted(80, 6) Source(103, 6) + SourceIndex(0) +5 >Emitted(80, 7) Source(103, 6) + SourceIndex(0) +6 >Emitted(80, 27) Source(103, 64) + SourceIndex(0) +7 >Emitted(80, 29) Source(103, 8) + SourceIndex(0) +8 >Emitted(80, 43) Source(103, 12) + SourceIndex(0) +9 >Emitted(80, 45) Source(103, 14) + SourceIndex(0) +10>Emitted(80, 59) Source(103, 44) + SourceIndex(0) +11>Emitted(80, 61) Source(103, 24) + SourceIndex(0) +12>Emitted(80, 81) Source(103, 31) + SourceIndex(0) +13>Emitted(80, 83) Source(103, 33) + SourceIndex(0) +14>Emitted(80, 107) Source(103, 42) + SourceIndex(0) +15>Emitted(80, 112) Source(103, 64) + SourceIndex(0) +16>Emitted(80, 114) Source(103, 66) + SourceIndex(0) +17>Emitted(80, 115) Source(103, 67) + SourceIndex(0) +18>Emitted(80, 118) Source(103, 70) + SourceIndex(0) +19>Emitted(80, 119) Source(103, 71) + SourceIndex(0) +20>Emitted(80, 121) Source(103, 73) + SourceIndex(0) +21>Emitted(80, 122) Source(103, 74) + SourceIndex(0) +22>Emitted(80, 125) Source(103, 77) + SourceIndex(0) +23>Emitted(80, 126) Source(103, 78) + SourceIndex(0) +24>Emitted(80, 128) Source(103, 80) + SourceIndex(0) +25>Emitted(80, 129) Source(103, 81) + SourceIndex(0) +26>Emitted(80, 131) Source(103, 83) + SourceIndex(0) +27>Emitted(80, 133) Source(103, 85) + SourceIndex(0) +28>Emitted(80, 134) Source(103, 86) + SourceIndex(0) +--- +>>> console.log(primaryA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > primaryA +7 > ) +8 > ; +1 >Emitted(81, 5) Source(104, 5) + SourceIndex(0) +2 >Emitted(81, 12) Source(104, 12) + SourceIndex(0) +3 >Emitted(81, 13) Source(104, 13) + SourceIndex(0) +4 >Emitted(81, 16) Source(104, 16) + SourceIndex(0) +5 >Emitted(81, 17) Source(104, 17) + SourceIndex(0) +6 >Emitted(81, 25) Source(104, 25) + SourceIndex(0) +7 >Emitted(81, 26) Source(104, 26) + SourceIndex(0) +8 >Emitted(81, 27) Source(104, 27) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(82, 1) Source(105, 1) + SourceIndex(0) +2 >Emitted(82, 2) Source(105, 2) + SourceIndex(0) +--- +>>>for ((_2 = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, name = _2.name, _3 = _2.skills, primary = _3.primary, secondary = _3.secondary, _2), +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^^^^^^^^^^^ +15> ^^^^^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > { name, skills: { primary, secondary } } = + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } } +7 > +8 > name +9 > , +10> skills: { primary, secondary } +11> +12> primary +13> , +14> secondary +15> } } = + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } } +1->Emitted(83, 1) Source(106, 1) + SourceIndex(0) +2 >Emitted(83, 4) Source(106, 4) + SourceIndex(0) +3 >Emitted(83, 5) Source(106, 5) + SourceIndex(0) +4 >Emitted(83, 6) Source(106, 6) + SourceIndex(0) +5 >Emitted(83, 7) Source(106, 6) + SourceIndex(0) +6 >Emitted(83, 85) Source(107, 90) + SourceIndex(0) +7 >Emitted(83, 87) Source(106, 8) + SourceIndex(0) +8 >Emitted(83, 101) Source(106, 12) + SourceIndex(0) +9 >Emitted(83, 103) Source(106, 14) + SourceIndex(0) +10>Emitted(83, 117) Source(106, 44) + SourceIndex(0) +11>Emitted(83, 119) Source(106, 24) + SourceIndex(0) +12>Emitted(83, 139) Source(106, 31) + SourceIndex(0) +13>Emitted(83, 141) Source(106, 33) + SourceIndex(0) +14>Emitted(83, 165) Source(106, 42) + SourceIndex(0) +15>Emitted(83, 170) Source(107, 90) + SourceIndex(0) +--- +>>> i = 0; i < 1; i++) { +1 >^^^^ +2 > ^ +3 > ^^^ +4 > ^ +5 > ^^ +6 > ^ +7 > ^^^ +8 > ^ +9 > ^^ +10> ^ +11> ^^ +12> ^^ +13> ^ +14> ^^^-> +1 >, + > +2 > i +3 > = +4 > 0 +5 > ; +6 > i +7 > < +8 > 1 +9 > ; +10> i +11> ++ +12> ) +13> { +1 >Emitted(84, 5) Source(108, 5) + SourceIndex(0) +2 >Emitted(84, 6) Source(108, 6) + SourceIndex(0) +3 >Emitted(84, 9) Source(108, 9) + SourceIndex(0) +4 >Emitted(84, 10) Source(108, 10) + SourceIndex(0) +5 >Emitted(84, 12) Source(108, 12) + SourceIndex(0) +6 >Emitted(84, 13) Source(108, 13) + SourceIndex(0) +7 >Emitted(84, 16) Source(108, 16) + SourceIndex(0) +8 >Emitted(84, 17) Source(108, 17) + SourceIndex(0) +9 >Emitted(84, 19) Source(108, 19) + SourceIndex(0) +10>Emitted(84, 20) Source(108, 20) + SourceIndex(0) +11>Emitted(84, 22) Source(108, 22) + SourceIndex(0) +12>Emitted(84, 24) Source(108, 24) + SourceIndex(0) +13>Emitted(84, 25) Source(108, 25) + SourceIndex(0) +--- +>>> console.log(primaryA); +1->^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1-> + > +2 > console +3 > . +4 > log +5 > ( +6 > primaryA +7 > ) +8 > ; +1->Emitted(85, 5) Source(109, 5) + SourceIndex(0) +2 >Emitted(85, 12) Source(109, 12) + SourceIndex(0) +3 >Emitted(85, 13) Source(109, 13) + SourceIndex(0) +4 >Emitted(85, 16) Source(109, 16) + SourceIndex(0) +5 >Emitted(85, 17) Source(109, 17) + SourceIndex(0) +6 >Emitted(85, 25) Source(109, 25) + SourceIndex(0) +7 >Emitted(85, 26) Source(109, 26) + SourceIndex(0) +8 >Emitted(85, 27) Source(109, 27) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(86, 1) Source(110, 1) + SourceIndex(0) +2 >Emitted(86, 2) Source(110, 2) + SourceIndex(0) +--- +>>>var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3; +>>>//# sourceMappingURL=sourceMapValidationDestructuringForObjectBindingPattern2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForObjectBindingPattern2.symbols b/tests/baselines/reference/sourceMapValidationDestructuringForObjectBindingPattern2.symbols new file mode 100644 index 00000000000..1d6df1e8394 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForObjectBindingPattern2.symbols @@ -0,0 +1,490 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringForObjectBindingPattern2.ts === +declare var console: { +>console : Symbol(console, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 0, 11)) + + log(msg: any): void; +>log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 0, 22)) +>msg : Symbol(msg, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 1, 8)) +} +interface Robot { +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 2, 1)) + + name: string; +>name : Symbol(Robot.name, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 3, 17)) + + skill: string; +>skill : Symbol(Robot.skill, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 4, 17)) +} + +interface MultiRobot { +>MultiRobot : Symbol(MultiRobot, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 6, 1)) + + name: string; +>name : Symbol(MultiRobot.name, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 8, 22)) + + skills: { +>skills : Symbol(MultiRobot.skills, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 9, 17)) + + primary: string; +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 10, 13)) + + secondary: string; +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 11, 24)) + + }; +} + +let robot: Robot = { name: "mower", skill: "mowing" }; +>robot : Symbol(robot, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 16, 3)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 2, 1)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 16, 20)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 16, 35)) + +let multiRobot: MultiRobot = { name: "mower", skills: { primary: "mowing", secondary: "none" } }; +>multiRobot : Symbol(multiRobot, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 17, 3)) +>MultiRobot : Symbol(MultiRobot, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 6, 1)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 17, 30)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 17, 45)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 17, 55)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 17, 74)) + +function getRobot() { +>getRobot : Symbol(getRobot, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 17, 97)) + + return robot; +>robot : Symbol(robot, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 16, 3)) +} +function getMultiRobot() { +>getMultiRobot : Symbol(getMultiRobot, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 20, 1)) + + return multiRobot; +>multiRobot : Symbol(multiRobot, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 17, 3)) +} + +let nameA: string, primaryA: string, secondaryA: string, i: number, skillA: string; +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 3)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 18)) +>secondaryA : Symbol(secondaryA, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 36)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 56)) +>skillA : Symbol(skillA, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 67)) + +let name: string, primary: string, secondary: string, skill: string; +>name : Symbol(name, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 26, 3)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 26, 17)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 26, 34)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 26, 53)) + +for ({ name: nameA } = robot, i = 0; i < 1; i++) { +>name : Symbol(name, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 28, 6)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 3)) +>robot : Symbol(robot, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 16, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 56)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 3)) +} +for ({ name: nameA } = getRobot(), i = 0; i < 1; i++) { +>name : Symbol(name, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 31, 6)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 3)) +>getRobot : Symbol(getRobot, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 17, 97)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 56)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 3)) +} +for ({ name: nameA } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { +>name : Symbol(name, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 34, 6)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 3)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 2, 1)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 34, 31)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 34, 48)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 56)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 3)) +} +for ({ skills: { primary: primaryA, secondary: secondaryA } } = multiRobot, i = 0; i < 1; i++) { +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 37, 6)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 37, 16)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 18)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 37, 35)) +>secondaryA : Symbol(secondaryA, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 36)) +>multiRobot : Symbol(multiRobot, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 17, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 56)) + + console.log(primaryA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 0, 22)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 18)) +} +for ({ skills: { primary: primaryA, secondary: secondaryA } } = getMultiRobot(), i = 0; i < 1; i++) { +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 40, 6)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 40, 16)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 18)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 40, 35)) +>secondaryA : Symbol(secondaryA, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 36)) +>getMultiRobot : Symbol(getMultiRobot, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 20, 1)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 56)) + + console.log(primaryA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 0, 22)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 18)) +} +for ({ skills: { primary: primaryA, secondary: secondaryA } } = +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 43, 6)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 43, 16)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 18)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 43, 35)) +>secondaryA : Symbol(secondaryA, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 36)) + + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, +>MultiRobot : Symbol(MultiRobot, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 6, 1)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 44, 17)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 44, 34)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 44, 44)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 44, 65)) + + i = 0; i < 1; i++) { +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 56)) + + console.log(primaryA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 0, 22)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 18)) +} +for ({ name } = robot, i = 0; i < 1; i++) { +>name : Symbol(name, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 48, 6)) +>robot : Symbol(robot, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 16, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 56)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 3)) +} +for ({ name } = getRobot(), i = 0; i < 1; i++) { +>name : Symbol(name, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 51, 6)) +>getRobot : Symbol(getRobot, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 17, 97)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 56)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 3)) +} +for ({ name } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { +>name : Symbol(name, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 54, 6)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 2, 1)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 54, 24)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 54, 41)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 56)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 3)) +} +for ({ skills: { primary, secondary } } = multiRobot, i = 0; i < 1; i++) { +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 57, 6)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 57, 16)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 57, 25)) +>multiRobot : Symbol(multiRobot, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 17, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 56)) + + console.log(primaryA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 0, 22)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 18)) +} +for ({ skills: { primary, secondary } } = getMultiRobot(), i = 0; i < 1; i++) { +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 60, 6)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 60, 16)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 60, 25)) +>getMultiRobot : Symbol(getMultiRobot, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 20, 1)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 56)) + + console.log(primaryA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 0, 22)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 18)) +} +for ({ skills: { primary, secondary } } = +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 63, 6)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 63, 16)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 63, 25)) + + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, +>MultiRobot : Symbol(MultiRobot, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 6, 1)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 64, 17)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 64, 34)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 64, 44)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 64, 65)) + + i = 0; i < 1; i++) { +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 56)) + + console.log(primaryA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 0, 22)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 18)) +} + + +for ({ name: nameA, skill: skillA } = robot, i = 0; i < 1; i++) { +>name : Symbol(name, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 70, 6)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 3)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 70, 19)) +>skillA : Symbol(skillA, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 67)) +>robot : Symbol(robot, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 16, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 56)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 3)) +} +for ({ name: nameA, skill: skillA } = getRobot(), i = 0; i < 1; i++) { +>name : Symbol(name, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 73, 6)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 3)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 73, 19)) +>skillA : Symbol(skillA, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 67)) +>getRobot : Symbol(getRobot, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 17, 97)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 56)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 3)) +} +for ({ name: nameA, skill: skillA } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { +>name : Symbol(name, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 76, 6)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 3)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 76, 19)) +>skillA : Symbol(skillA, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 67)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 2, 1)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 76, 46)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 76, 63)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 56)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 3)) +} +for ({ name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = multiRobot, i = 0; i < 1; i++) { +>name : Symbol(name, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 79, 6)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 3)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 79, 19)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 79, 29)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 18)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 79, 48)) +>secondaryA : Symbol(secondaryA, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 36)) +>multiRobot : Symbol(multiRobot, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 17, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 56)) + + console.log(primaryA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 0, 22)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 18)) +} +for ({ name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = getMultiRobot(), i = 0; i < 1; i++) { +>name : Symbol(name, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 82, 6)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 3)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 82, 19)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 82, 29)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 18)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 82, 48)) +>secondaryA : Symbol(secondaryA, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 36)) +>getMultiRobot : Symbol(getMultiRobot, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 20, 1)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 56)) + + console.log(primaryA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 0, 22)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 18)) +} +for ({ name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = +>name : Symbol(name, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 85, 6)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 3)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 85, 19)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 85, 29)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 18)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 85, 48)) +>secondaryA : Symbol(secondaryA, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 36)) + + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, +>MultiRobot : Symbol(MultiRobot, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 6, 1)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 86, 17)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 86, 34)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 86, 44)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 86, 65)) + + i = 0; i < 1; i++) { +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 56)) + + console.log(primaryA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 0, 22)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 18)) +} +for ({ name, skill } = robot, i = 0; i < 1; i++) { +>name : Symbol(name, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 90, 6)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 90, 12)) +>robot : Symbol(robot, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 16, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 56)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 3)) +} +for ({ name, skill } = getRobot(), i = 0; i < 1; i++) { +>name : Symbol(name, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 93, 6)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 93, 12)) +>getRobot : Symbol(getRobot, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 17, 97)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 56)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 3)) +} +for ({ name, skill } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { +>name : Symbol(name, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 96, 6)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 96, 12)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 2, 1)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 96, 31)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 96, 48)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 56)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 3)) +} +for ({ name, skills: { primary, secondary } } = multiRobot, i = 0; i < 1; i++) { +>name : Symbol(name, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 99, 6)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 99, 12)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 99, 22)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 99, 31)) +>multiRobot : Symbol(multiRobot, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 17, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 56)) + + console.log(primaryA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 0, 22)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 18)) +} +for ({ name, skills: { primary, secondary } } = getMultiRobot(), i = 0; i < 1; i++) { +>name : Symbol(name, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 102, 6)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 102, 12)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 102, 22)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 102, 31)) +>getMultiRobot : Symbol(getMultiRobot, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 20, 1)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 56)) + + console.log(primaryA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 0, 22)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 18)) +} +for ({ name, skills: { primary, secondary } } = +>name : Symbol(name, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 105, 6)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 105, 12)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 105, 22)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 105, 31)) + + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, +>MultiRobot : Symbol(MultiRobot, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 6, 1)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 106, 17)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 106, 34)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 106, 44)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 106, 65)) + + i = 0; i < 1; i++) { +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 56)) + + console.log(primaryA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 0, 22)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForObjectBindingPattern2.ts, 25, 18)) +} diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForObjectBindingPattern2.types b/tests/baselines/reference/sourceMapValidationDestructuringForObjectBindingPattern2.types new file mode 100644 index 00000000000..81beb06d3d7 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForObjectBindingPattern2.types @@ -0,0 +1,774 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringForObjectBindingPattern2.ts === +declare var console: { +>console : { log(msg: any): void; } + + log(msg: any): void; +>log : (msg: any) => void +>msg : any +} +interface Robot { +>Robot : Robot + + name: string; +>name : string + + skill: string; +>skill : string +} + +interface MultiRobot { +>MultiRobot : MultiRobot + + name: string; +>name : string + + skills: { +>skills : { primary: string; secondary: string; } + + primary: string; +>primary : string + + secondary: string; +>secondary : string + + }; +} + +let robot: Robot = { name: "mower", skill: "mowing" }; +>robot : Robot +>Robot : Robot +>{ name: "mower", skill: "mowing" } : { name: string; skill: string; } +>name : string +>"mower" : string +>skill : string +>"mowing" : string + +let multiRobot: MultiRobot = { name: "mower", skills: { primary: "mowing", secondary: "none" } }; +>multiRobot : MultiRobot +>MultiRobot : MultiRobot +>{ name: "mower", skills: { primary: "mowing", secondary: "none" } } : { name: string; skills: { primary: string; secondary: string; }; } +>name : string +>"mower" : string +>skills : { primary: string; secondary: string; } +>{ primary: "mowing", secondary: "none" } : { primary: string; secondary: string; } +>primary : string +>"mowing" : string +>secondary : string +>"none" : string + +function getRobot() { +>getRobot : () => Robot + + return robot; +>robot : Robot +} +function getMultiRobot() { +>getMultiRobot : () => MultiRobot + + return multiRobot; +>multiRobot : MultiRobot +} + +let nameA: string, primaryA: string, secondaryA: string, i: number, skillA: string; +>nameA : string +>primaryA : string +>secondaryA : string +>i : number +>skillA : string + +let name: string, primary: string, secondary: string, skill: string; +>name : string +>primary : string +>secondary : string +>skill : string + +for ({ name: nameA } = robot, i = 0; i < 1; i++) { +>{ name: nameA } = robot, i = 0 : number +>{ name: nameA } = robot : Robot +>{ name: nameA } : { name: string; } +>name : string +>nameA : string +>robot : Robot +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for ({ name: nameA } = getRobot(), i = 0; i < 1; i++) { +>{ name: nameA } = getRobot(), i = 0 : number +>{ name: nameA } = getRobot() : Robot +>{ name: nameA } : { name: string; } +>name : string +>nameA : string +>getRobot() : Robot +>getRobot : () => Robot +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for ({ name: nameA } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { +>{ name: nameA } = { name: "trimmer", skill: "trimming" }, i = 0 : number +>{ name: nameA } = { name: "trimmer", skill: "trimming" } : Robot +>{ name: nameA } : { name: string; } +>name : string +>nameA : string +>{ name: "trimmer", skill: "trimming" } : Robot +>Robot : Robot +>{ name: "trimmer", skill: "trimming" } : { name: string; skill: string; } +>name : string +>"trimmer" : string +>skill : string +>"trimming" : string +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for ({ skills: { primary: primaryA, secondary: secondaryA } } = multiRobot, i = 0; i < 1; i++) { +>{ skills: { primary: primaryA, secondary: secondaryA } } = multiRobot, i = 0 : number +>{ skills: { primary: primaryA, secondary: secondaryA } } = multiRobot : MultiRobot +>{ skills: { primary: primaryA, secondary: secondaryA } } : { skills: { primary: string; secondary: string; }; } +>skills : { primary: string; secondary: string; } +>{ primary: primaryA, secondary: secondaryA } : { primary: string; secondary: string; } +>primary : string +>primaryA : string +>secondary : string +>secondaryA : string +>multiRobot : MultiRobot +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(primaryA); +>console.log(primaryA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primaryA : string +} +for ({ skills: { primary: primaryA, secondary: secondaryA } } = getMultiRobot(), i = 0; i < 1; i++) { +>{ skills: { primary: primaryA, secondary: secondaryA } } = getMultiRobot(), i = 0 : number +>{ skills: { primary: primaryA, secondary: secondaryA } } = getMultiRobot() : MultiRobot +>{ skills: { primary: primaryA, secondary: secondaryA } } : { skills: { primary: string; secondary: string; }; } +>skills : { primary: string; secondary: string; } +>{ primary: primaryA, secondary: secondaryA } : { primary: string; secondary: string; } +>primary : string +>primaryA : string +>secondary : string +>secondaryA : string +>getMultiRobot() : MultiRobot +>getMultiRobot : () => MultiRobot +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(primaryA); +>console.log(primaryA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primaryA : string +} +for ({ skills: { primary: primaryA, secondary: secondaryA } } = +>{ skills: { primary: primaryA, secondary: secondaryA } } = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, i = 0 : number +>{ skills: { primary: primaryA, secondary: secondaryA } } = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } } : MultiRobot +>{ skills: { primary: primaryA, secondary: secondaryA } } : { skills: { primary: string; secondary: string; }; } +>skills : { primary: string; secondary: string; } +>{ primary: primaryA, secondary: secondaryA } : { primary: string; secondary: string; } +>primary : string +>primaryA : string +>secondary : string +>secondaryA : string + + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, +>{ name: "trimmer", skills: { primary: "trimming", secondary: "edging" } } : MultiRobot +>MultiRobot : MultiRobot +>{ name: "trimmer", skills: { primary: "trimming", secondary: "edging" } } : { name: string; skills: { primary: string; secondary: string; }; } +>name : string +>"trimmer" : string +>skills : { primary: string; secondary: string; } +>{ primary: "trimming", secondary: "edging" } : { primary: string; secondary: string; } +>primary : string +>"trimming" : string +>secondary : string +>"edging" : string + + i = 0; i < 1; i++) { +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(primaryA); +>console.log(primaryA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primaryA : string +} +for ({ name } = robot, i = 0; i < 1; i++) { +>{ name } = robot, i = 0 : number +>{ name } = robot : Robot +>{ name } : { name: string; } +>name : string +>robot : Robot +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for ({ name } = getRobot(), i = 0; i < 1; i++) { +>{ name } = getRobot(), i = 0 : number +>{ name } = getRobot() : Robot +>{ name } : { name: string; } +>name : string +>getRobot() : Robot +>getRobot : () => Robot +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for ({ name } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { +>{ name } = { name: "trimmer", skill: "trimming" }, i = 0 : number +>{ name } = { name: "trimmer", skill: "trimming" } : Robot +>{ name } : { name: string; } +>name : string +>{ name: "trimmer", skill: "trimming" } : Robot +>Robot : Robot +>{ name: "trimmer", skill: "trimming" } : { name: string; skill: string; } +>name : string +>"trimmer" : string +>skill : string +>"trimming" : string +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for ({ skills: { primary, secondary } } = multiRobot, i = 0; i < 1; i++) { +>{ skills: { primary, secondary } } = multiRobot, i = 0 : number +>{ skills: { primary, secondary } } = multiRobot : MultiRobot +>{ skills: { primary, secondary } } : { skills: { primary: string; secondary: string; }; } +>skills : { primary: string; secondary: string; } +>{ primary, secondary } : { primary: string; secondary: string; } +>primary : string +>secondary : string +>multiRobot : MultiRobot +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(primaryA); +>console.log(primaryA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primaryA : string +} +for ({ skills: { primary, secondary } } = getMultiRobot(), i = 0; i < 1; i++) { +>{ skills: { primary, secondary } } = getMultiRobot(), i = 0 : number +>{ skills: { primary, secondary } } = getMultiRobot() : MultiRobot +>{ skills: { primary, secondary } } : { skills: { primary: string; secondary: string; }; } +>skills : { primary: string; secondary: string; } +>{ primary, secondary } : { primary: string; secondary: string; } +>primary : string +>secondary : string +>getMultiRobot() : MultiRobot +>getMultiRobot : () => MultiRobot +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(primaryA); +>console.log(primaryA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primaryA : string +} +for ({ skills: { primary, secondary } } = +>{ skills: { primary, secondary } } = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, i = 0 : number +>{ skills: { primary, secondary } } = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } } : MultiRobot +>{ skills: { primary, secondary } } : { skills: { primary: string; secondary: string; }; } +>skills : { primary: string; secondary: string; } +>{ primary, secondary } : { primary: string; secondary: string; } +>primary : string +>secondary : string + + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, +>{ name: "trimmer", skills: { primary: "trimming", secondary: "edging" } } : MultiRobot +>MultiRobot : MultiRobot +>{ name: "trimmer", skills: { primary: "trimming", secondary: "edging" } } : { name: string; skills: { primary: string; secondary: string; }; } +>name : string +>"trimmer" : string +>skills : { primary: string; secondary: string; } +>{ primary: "trimming", secondary: "edging" } : { primary: string; secondary: string; } +>primary : string +>"trimming" : string +>secondary : string +>"edging" : string + + i = 0; i < 1; i++) { +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(primaryA); +>console.log(primaryA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primaryA : string +} + + +for ({ name: nameA, skill: skillA } = robot, i = 0; i < 1; i++) { +>{ name: nameA, skill: skillA } = robot, i = 0 : number +>{ name: nameA, skill: skillA } = robot : Robot +>{ name: nameA, skill: skillA } : { name: string; skill: string; } +>name : string +>nameA : string +>skill : string +>skillA : string +>robot : Robot +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for ({ name: nameA, skill: skillA } = getRobot(), i = 0; i < 1; i++) { +>{ name: nameA, skill: skillA } = getRobot(), i = 0 : number +>{ name: nameA, skill: skillA } = getRobot() : Robot +>{ name: nameA, skill: skillA } : { name: string; skill: string; } +>name : string +>nameA : string +>skill : string +>skillA : string +>getRobot() : Robot +>getRobot : () => Robot +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for ({ name: nameA, skill: skillA } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { +>{ name: nameA, skill: skillA } = { name: "trimmer", skill: "trimming" }, i = 0 : number +>{ name: nameA, skill: skillA } = { name: "trimmer", skill: "trimming" } : Robot +>{ name: nameA, skill: skillA } : { name: string; skill: string; } +>name : string +>nameA : string +>skill : string +>skillA : string +>{ name: "trimmer", skill: "trimming" } : Robot +>Robot : Robot +>{ name: "trimmer", skill: "trimming" } : { name: string; skill: string; } +>name : string +>"trimmer" : string +>skill : string +>"trimming" : string +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for ({ name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = multiRobot, i = 0; i < 1; i++) { +>{ name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = multiRobot, i = 0 : number +>{ name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = multiRobot : MultiRobot +>{ name: nameA, skills: { primary: primaryA, secondary: secondaryA } } : { name: string; skills: { primary: string; secondary: string; }; } +>name : string +>nameA : string +>skills : { primary: string; secondary: string; } +>{ primary: primaryA, secondary: secondaryA } : { primary: string; secondary: string; } +>primary : string +>primaryA : string +>secondary : string +>secondaryA : string +>multiRobot : MultiRobot +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(primaryA); +>console.log(primaryA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primaryA : string +} +for ({ name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = getMultiRobot(), i = 0; i < 1; i++) { +>{ name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = getMultiRobot(), i = 0 : number +>{ name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = getMultiRobot() : MultiRobot +>{ name: nameA, skills: { primary: primaryA, secondary: secondaryA } } : { name: string; skills: { primary: string; secondary: string; }; } +>name : string +>nameA : string +>skills : { primary: string; secondary: string; } +>{ primary: primaryA, secondary: secondaryA } : { primary: string; secondary: string; } +>primary : string +>primaryA : string +>secondary : string +>secondaryA : string +>getMultiRobot() : MultiRobot +>getMultiRobot : () => MultiRobot +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(primaryA); +>console.log(primaryA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primaryA : string +} +for ({ name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = +>{ name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, i = 0 : number +>{ name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } } : MultiRobot +>{ name: nameA, skills: { primary: primaryA, secondary: secondaryA } } : { name: string; skills: { primary: string; secondary: string; }; } +>name : string +>nameA : string +>skills : { primary: string; secondary: string; } +>{ primary: primaryA, secondary: secondaryA } : { primary: string; secondary: string; } +>primary : string +>primaryA : string +>secondary : string +>secondaryA : string + + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, +>{ name: "trimmer", skills: { primary: "trimming", secondary: "edging" } } : MultiRobot +>MultiRobot : MultiRobot +>{ name: "trimmer", skills: { primary: "trimming", secondary: "edging" } } : { name: string; skills: { primary: string; secondary: string; }; } +>name : string +>"trimmer" : string +>skills : { primary: string; secondary: string; } +>{ primary: "trimming", secondary: "edging" } : { primary: string; secondary: string; } +>primary : string +>"trimming" : string +>secondary : string +>"edging" : string + + i = 0; i < 1; i++) { +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(primaryA); +>console.log(primaryA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primaryA : string +} +for ({ name, skill } = robot, i = 0; i < 1; i++) { +>{ name, skill } = robot, i = 0 : number +>{ name, skill } = robot : Robot +>{ name, skill } : { name: string; skill: string; } +>name : string +>skill : string +>robot : Robot +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for ({ name, skill } = getRobot(), i = 0; i < 1; i++) { +>{ name, skill } = getRobot(), i = 0 : number +>{ name, skill } = getRobot() : Robot +>{ name, skill } : { name: string; skill: string; } +>name : string +>skill : string +>getRobot() : Robot +>getRobot : () => Robot +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for ({ name, skill } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { +>{ name, skill } = { name: "trimmer", skill: "trimming" }, i = 0 : number +>{ name, skill } = { name: "trimmer", skill: "trimming" } : Robot +>{ name, skill } : { name: string; skill: string; } +>name : string +>skill : string +>{ name: "trimmer", skill: "trimming" } : Robot +>Robot : Robot +>{ name: "trimmer", skill: "trimming" } : { name: string; skill: string; } +>name : string +>"trimmer" : string +>skill : string +>"trimming" : string +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for ({ name, skills: { primary, secondary } } = multiRobot, i = 0; i < 1; i++) { +>{ name, skills: { primary, secondary } } = multiRobot, i = 0 : number +>{ name, skills: { primary, secondary } } = multiRobot : MultiRobot +>{ name, skills: { primary, secondary } } : { name: string; skills: { primary: string; secondary: string; }; } +>name : string +>skills : { primary: string; secondary: string; } +>{ primary, secondary } : { primary: string; secondary: string; } +>primary : string +>secondary : string +>multiRobot : MultiRobot +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(primaryA); +>console.log(primaryA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primaryA : string +} +for ({ name, skills: { primary, secondary } } = getMultiRobot(), i = 0; i < 1; i++) { +>{ name, skills: { primary, secondary } } = getMultiRobot(), i = 0 : number +>{ name, skills: { primary, secondary } } = getMultiRobot() : MultiRobot +>{ name, skills: { primary, secondary } } : { name: string; skills: { primary: string; secondary: string; }; } +>name : string +>skills : { primary: string; secondary: string; } +>{ primary, secondary } : { primary: string; secondary: string; } +>primary : string +>secondary : string +>getMultiRobot() : MultiRobot +>getMultiRobot : () => MultiRobot +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(primaryA); +>console.log(primaryA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primaryA : string +} +for ({ name, skills: { primary, secondary } } = +>{ name, skills: { primary, secondary } } = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, i = 0 : number +>{ name, skills: { primary, secondary } } = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } } : MultiRobot +>{ name, skills: { primary, secondary } } : { name: string; skills: { primary: string; secondary: string; }; } +>name : string +>skills : { primary: string; secondary: string; } +>{ primary, secondary } : { primary: string; secondary: string; } +>primary : string +>secondary : string + + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, +>{ name: "trimmer", skills: { primary: "trimming", secondary: "edging" } } : MultiRobot +>MultiRobot : MultiRobot +>{ name: "trimmer", skills: { primary: "trimming", secondary: "edging" } } : { name: string; skills: { primary: string; secondary: string; }; } +>name : string +>"trimmer" : string +>skills : { primary: string; secondary: string; } +>{ primary: "trimming", secondary: "edging" } : { primary: string; secondary: string; } +>primary : string +>"trimming" : string +>secondary : string +>"edging" : string + + i = 0; i < 1; i++) { +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(primaryA); +>console.log(primaryA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primaryA : string +} diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.js b/tests/baselines/reference/sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.js new file mode 100644 index 00000000000..785148ba652 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.js @@ -0,0 +1,145 @@ +//// [sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts] +declare var console: { + log(msg: any): void; +} +interface Robot { + name: string; + skill: string; +} + +interface MultiRobot { + name: string; + skills: { + primary?: string; + secondary?: string; + }; +} + +let robot: Robot = { name: "mower", skill: "mowing" }; +let multiRobot: MultiRobot = { name: "mower", skills: { primary: "mowing", secondary: "none" } }; +function getRobot() { + return robot; +} +function getMultiRobot() { + return multiRobot; +} + +for (let {name: nameA= "noName" } = robot, i = 0; i < 1; i++) { + console.log(nameA); +} +for (let {name: nameA = "noName" } = getRobot(), i = 0; i < 1; i++) { + console.log(nameA); +} +for (let {name: nameA = "noName" } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + console.log(nameA); +} +for (let { + skills: { + primary: primaryA = "primary", + secondary: secondaryA = "secondary" + } = { primary: "none", secondary: "none" } +} = multiRobot, i = 0; i < 1; i++) { + console.log(primaryA); +} +for (let { + skills: { + primary: primaryA = "primary", + secondary: secondaryA = "secondary" + } = { primary: "none", secondary: "none" } +} = getMultiRobot(), i = 0; i < 1; i++) { + console.log(primaryA); +} +for (let { + skills: { + primary: primaryA = "primary", + secondary: secondaryA = "secondary" + } = { primary: "none", secondary: "none" } +} = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, + i = 0; i < 1; i++) { + console.log(primaryA); +} + +for (let {name: nameA = "noName", skill: skillA = "skill" } = robot, i = 0; i < 1; i++) { + console.log(nameA); +} +for (let {name: nameA = "noName", skill: skillA = "skill" } = getRobot(), i = 0; i < 1; i++) { + console.log(nameA); +} +for (let {name: nameA = "noName", skill: skillA = "skill" } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + console.log(nameA); +} +for (let { + name: nameA = "noName", + skills: { + primary: primaryA = "primary", + secondary: secondaryA = "secondary" + } = { primary: "none", secondary: "none" } +} = multiRobot, i = 0; i < 1; i++) { + console.log(primaryA); +} +for (let { + name: nameA = "noName", + skills: { + primary: primaryA = "primary", + secondary: secondaryA = "secondary" + } = { primary: "none", secondary: "none" } +} = getMultiRobot(), i = 0; i < 1; i++) { + console.log(primaryA); +} +for (let { + name: nameA = "noName", + skills: { + primary: primaryA = "primary", + secondary: secondaryA = "secondary" + } = { primary: "none", secondary: "none" } +} = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, + i = 0; i < 1; i++) { + console.log(primaryA); +} + +//// [sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.js] +var robot = { name: "mower", skill: "mowing" }; +var multiRobot = { name: "mower", skills: { primary: "mowing", secondary: "none" } }; +function getRobot() { + return robot; +} +function getMultiRobot() { + return multiRobot; +} +for (var _a = robot.name, nameA = _a === void 0 ? "noName" : _a, i = 0; i < 1; i++) { + console.log(nameA); +} +for (var _b = getRobot().name, nameA = _b === void 0 ? "noName" : _b, i = 0; i < 1; i++) { + console.log(nameA); +} +for (var _c = { name: "trimmer", skill: "trimming" }.name, nameA = _c === void 0 ? "noName" : _c, i = 0; i < 1; i++) { + console.log(nameA); +} +for (var _d = multiRobot.skills, _e = _d === void 0 ? { primary: "none", secondary: "none" } : _d, _f = _e.primary, primaryA = _f === void 0 ? "primary" : _f, _g = _e.secondary, secondaryA = _g === void 0 ? "secondary" : _g, i = 0; i < 1; i++) { + console.log(primaryA); +} +for (var _h = getMultiRobot().skills, _j = _h === void 0 ? { primary: "none", secondary: "none" } : _h, _k = _j.primary, primaryA = _k === void 0 ? "primary" : _k, _l = _j.secondary, secondaryA = _l === void 0 ? "secondary" : _l, i = 0; i < 1; i++) { + console.log(primaryA); +} +for (var _m = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }.skills, _o = _m === void 0 ? { primary: "none", secondary: "none" } : _m, _p = _o.primary, primaryA = _p === void 0 ? "primary" : _p, _q = _o.secondary, secondaryA = _q === void 0 ? "secondary" : _q, i = 0; i < 1; i++) { + console.log(primaryA); +} +for (var _r = robot.name, nameA = _r === void 0 ? "noName" : _r, _s = robot.skill, skillA = _s === void 0 ? "skill" : _s, i = 0; i < 1; i++) { + console.log(nameA); +} +for (var _t = getRobot(), _u = _t.name, nameA = _u === void 0 ? "noName" : _u, _v = _t.skill, skillA = _v === void 0 ? "skill" : _v, i = 0; i < 1; i++) { + console.log(nameA); +} +for (var _w = { name: "trimmer", skill: "trimming" }, _x = _w.name, nameA = _x === void 0 ? "noName" : _x, _y = _w.skill, skillA = _y === void 0 ? "skill" : _y, i = 0; i < 1; i++) { + console.log(nameA); +} +for (var _z = multiRobot.name, nameA = _z === void 0 ? "noName" : _z, _0 = multiRobot.skills, _1 = _0 === void 0 ? { primary: "none", secondary: "none" } : _0, _2 = _1.primary, primaryA = _2 === void 0 ? "primary" : _2, _3 = _1.secondary, secondaryA = _3 === void 0 ? "secondary" : _3, i = 0; i < 1; i++) { + console.log(primaryA); +} +for (var _4 = getMultiRobot(), _5 = _4.name, nameA = _5 === void 0 ? "noName" : _5, _6 = _4.skills, _7 = _6 === void 0 ? { primary: "none", secondary: "none" } : _6, _8 = _7.primary, primaryA = _8 === void 0 ? "primary" : _8, _9 = _7.secondary, secondaryA = _9 === void 0 ? "secondary" : _9, i = 0; i < 1; i++) { + console.log(primaryA); +} +for (var _10 = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, _11 = _10.name, nameA = _11 === void 0 ? "noName" : _11, _12 = _10.skills, _13 = _12 === void 0 ? { primary: "none", secondary: "none" } : _12, _14 = _13.primary, primaryA = _14 === void 0 ? "primary" : _14, _15 = _13.secondary, secondaryA = _15 === void 0 ? "secondary" : _15, i = 0; i < 1; i++) { + console.log(primaryA); +} +//# sourceMappingURL=sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.js.map b/tests/baselines/reference/sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.js.map new file mode 100644 index 00000000000..b208c41c9a6 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.js.map @@ -0,0 +1,2 @@ +//// [sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.js.map] +{"version":3,"file":"sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.js","sourceRoot":"","sources":["sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts"],"names":[],"mappings":"AAgBA,IAAI,KAAK,GAAU,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;AACtD,IAAI,UAAU,GAAe,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,CAAC;AACjG;IACI,MAAM,CAAC,KAAK,CAAC;AACjB,CAAC;AACD;IACI,MAAM,CAAC,UAAU,CAAC;AACtB,CAAC;AAED,GAAG,CAAC,CAAM,mBAAqB,EAArB,qCAAqB,EAAY,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IAC3D,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AACD,GAAG,CAAC,CAAM,wBAAsB,EAAtB,qCAAsB,EAAiB,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACjE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AACD,GAAG,CAAC,CAAM,oDAAsB,EAAtB,qCAAsB,EAAoD,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACpG,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AACD,GAAG,CAAC,CACA,0BAG0C,EAH1C,gEAG0C,EAFtC,eAA6B,EAA7B,yCAA6B,EAC7B,iBAAmC,EAAnC,6CAAmC,EAE3B,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IAChC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAC1B,CAAC;AACD,GAAG,CAAC,CACA,+BAG0C,EAH1C,gEAG0C,EAFtC,eAA6B,EAA7B,yCAA6B,EAC7B,iBAAmC,EAAnC,6CAAmC,EAEtB,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACrC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAC1B,CAAC;AACD,GAAG,CAAC,CACA,yFAG0C,EAH1C,gEAG0C,EAFtC,eAA6B,EAA7B,yCAA6B,EAC7B,iBAAmC,EAAnC,6CAAmC,EAGvC,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACpB,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAC1B,CAAC;AAED,GAAG,CAAC,CAAM,mBAAsB,EAAtB,qCAAsB,EAAE,gBAAuB,EAAvB,qCAAuB,EAAY,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACrF,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AACD,GAAG,CAAC,CAAC,IAAA,eAAmE,EAA9D,YAAsB,EAAtB,qCAAsB,EAAE,aAAuB,EAAvB,qCAAuB,EAAiB,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IAC1F,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AACD,GAAG,CAAC,CAAC,IAAA,2CAAsG,EAAjG,YAAsB,EAAtB,qCAAsB,EAAE,aAAuB,EAAvB,qCAAuB,EAAoD,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IAC7H,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AACD,GAAG,CAAC,CACA,wBAAsB,EAAtB,qCAAsB,EACtB,sBAG0C,EAH1C,gEAG0C,EAFtC,eAA6B,EAA7B,yCAA6B,EAC7B,iBAAmC,EAAnC,6CAAmC,EAE3B,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IAChC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAC1B,CAAC;AACD,GAAG,CAAC,CAAC,IAAA,oBAMc,EALf,YAAsB,EAAtB,qCAAsB,EACtB,cAG0C,EAH1C,gEAG0C,EAFtC,eAA6B,EAA7B,yCAA6B,EAC7B,iBAAmC,EAAnC,6CAAmC,EAEtB,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACrC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAC1B,CAAC;AACD,GAAG,CAAC,CAAC,IAAA,+EAMoF,EALrF,cAAsB,EAAtB,uCAAsB,EACtB,gBAG0C,EAH1C,mEAG0C,EAFtC,iBAA6B,EAA7B,2CAA6B,EAC7B,mBAAmC,EAAnC,+CAAmC,EAGvC,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACpB,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAC1B,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.sourcemap.txt b/tests/baselines/reference/sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.sourcemap.txt new file mode 100644 index 00000000000..c8c63e66adf --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.sourcemap.txt @@ -0,0 +1,1740 @@ +=================================================================== +JsFile: sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.js +mapUrl: sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.js.map +sourceRoot: +sources: sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.js +sourceFile:sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts +------------------------------------------------------------------- +>>>var robot = { name: "mower", skill: "mowing" }; +1 > +2 >^^^^ +3 > ^^^^^ +4 > ^^^ +5 > ^^ +6 > ^^^^ +7 > ^^ +8 > ^^^^^^^ +9 > ^^ +10> ^^^^^ +11> ^^ +12> ^^^^^^^^ +13> ^^ +14> ^ +15> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 >declare var console: { + > log(msg: any): void; + >} + >interface Robot { + > name: string; + > skill: string; + >} + > + >interface MultiRobot { + > name: string; + > skills: { + > primary?: string; + > secondary?: string; + > }; + >} + > + > +2 >let +3 > robot +4 > : Robot = +5 > { +6 > name +7 > : +8 > "mower" +9 > , +10> skill +11> : +12> "mowing" +13> } +14> ; +1 >Emitted(1, 1) Source(17, 1) + SourceIndex(0) +2 >Emitted(1, 5) Source(17, 5) + SourceIndex(0) +3 >Emitted(1, 10) Source(17, 10) + SourceIndex(0) +4 >Emitted(1, 13) Source(17, 20) + SourceIndex(0) +5 >Emitted(1, 15) Source(17, 22) + SourceIndex(0) +6 >Emitted(1, 19) Source(17, 26) + SourceIndex(0) +7 >Emitted(1, 21) Source(17, 28) + SourceIndex(0) +8 >Emitted(1, 28) Source(17, 35) + SourceIndex(0) +9 >Emitted(1, 30) Source(17, 37) + SourceIndex(0) +10>Emitted(1, 35) Source(17, 42) + SourceIndex(0) +11>Emitted(1, 37) Source(17, 44) + SourceIndex(0) +12>Emitted(1, 45) Source(17, 52) + SourceIndex(0) +13>Emitted(1, 47) Source(17, 54) + SourceIndex(0) +14>Emitted(1, 48) Source(17, 55) + SourceIndex(0) +--- +>>>var multiRobot = { name: "mower", skills: { primary: "mowing", secondary: "none" } }; +1-> +2 >^^^^ +3 > ^^^^^^^^^^ +4 > ^^^ +5 > ^^ +6 > ^^^^ +7 > ^^ +8 > ^^^^^^^ +9 > ^^ +10> ^^^^^^ +11> ^^ +12> ^^ +13> ^^^^^^^ +14> ^^ +15> ^^^^^^^^ +16> ^^ +17> ^^^^^^^^^ +18> ^^ +19> ^^^^^^ +20> ^^ +21> ^^ +22> ^ +1-> + > +2 >let +3 > multiRobot +4 > : MultiRobot = +5 > { +6 > name +7 > : +8 > "mower" +9 > , +10> skills +11> : +12> { +13> primary +14> : +15> "mowing" +16> , +17> secondary +18> : +19> "none" +20> } +21> } +22> ; +1->Emitted(2, 1) Source(18, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(18, 5) + SourceIndex(0) +3 >Emitted(2, 15) Source(18, 15) + SourceIndex(0) +4 >Emitted(2, 18) Source(18, 30) + SourceIndex(0) +5 >Emitted(2, 20) Source(18, 32) + SourceIndex(0) +6 >Emitted(2, 24) Source(18, 36) + SourceIndex(0) +7 >Emitted(2, 26) Source(18, 38) + SourceIndex(0) +8 >Emitted(2, 33) Source(18, 45) + SourceIndex(0) +9 >Emitted(2, 35) Source(18, 47) + SourceIndex(0) +10>Emitted(2, 41) Source(18, 53) + SourceIndex(0) +11>Emitted(2, 43) Source(18, 55) + SourceIndex(0) +12>Emitted(2, 45) Source(18, 57) + SourceIndex(0) +13>Emitted(2, 52) Source(18, 64) + SourceIndex(0) +14>Emitted(2, 54) Source(18, 66) + SourceIndex(0) +15>Emitted(2, 62) Source(18, 74) + SourceIndex(0) +16>Emitted(2, 64) Source(18, 76) + SourceIndex(0) +17>Emitted(2, 73) Source(18, 85) + SourceIndex(0) +18>Emitted(2, 75) Source(18, 87) + SourceIndex(0) +19>Emitted(2, 81) Source(18, 93) + SourceIndex(0) +20>Emitted(2, 83) Source(18, 95) + SourceIndex(0) +21>Emitted(2, 85) Source(18, 97) + SourceIndex(0) +22>Emitted(2, 86) Source(18, 98) + SourceIndex(0) +--- +>>>function getRobot() { +1 > +2 >^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(3, 1) Source(19, 1) + SourceIndex(0) +--- +>>> return robot; +1->^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^ +5 > ^ +1->function getRobot() { + > +2 > return +3 > +4 > robot +5 > ; +1->Emitted(4, 5) Source(20, 5) + SourceIndex(0) +2 >Emitted(4, 11) Source(20, 11) + SourceIndex(0) +3 >Emitted(4, 12) Source(20, 12) + SourceIndex(0) +4 >Emitted(4, 17) Source(20, 17) + SourceIndex(0) +5 >Emitted(4, 18) Source(20, 18) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(5, 1) Source(21, 1) + SourceIndex(0) +2 >Emitted(5, 2) Source(21, 2) + SourceIndex(0) +--- +>>>function getMultiRobot() { +1-> +2 >^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(6, 1) Source(22, 1) + SourceIndex(0) +--- +>>> return multiRobot; +1->^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^ +5 > ^ +1->function getMultiRobot() { + > +2 > return +3 > +4 > multiRobot +5 > ; +1->Emitted(7, 5) Source(23, 5) + SourceIndex(0) +2 >Emitted(7, 11) Source(23, 11) + SourceIndex(0) +3 >Emitted(7, 12) Source(23, 12) + SourceIndex(0) +4 >Emitted(7, 22) Source(23, 22) + SourceIndex(0) +5 >Emitted(7, 23) Source(23, 23) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(8, 1) Source(24, 1) + SourceIndex(0) +2 >Emitted(8, 2) Source(24, 2) + SourceIndex(0) +--- +>>>for (var _a = robot.name, nameA = _a === void 0 ? "noName" : _a, i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^ +10> ^^^ +11> ^ +12> ^^ +13> ^ +14> ^^^ +15> ^ +16> ^^ +17> ^ +18> ^^ +19> ^^ +20> ^ +1-> + > + > +2 >for +3 > +4 > (let { +5 > name: nameA= "noName" +6 > +7 > name: nameA= "noName" +8 > } = robot, +9 > i +10> = +11> 0 +12> ; +13> i +14> < +15> 1 +16> ; +17> i +18> ++ +19> ) +20> { +1->Emitted(9, 1) Source(26, 1) + SourceIndex(0) +2 >Emitted(9, 4) Source(26, 4) + SourceIndex(0) +3 >Emitted(9, 5) Source(26, 5) + SourceIndex(0) +4 >Emitted(9, 6) Source(26, 11) + SourceIndex(0) +5 >Emitted(9, 25) Source(26, 32) + SourceIndex(0) +6 >Emitted(9, 27) Source(26, 11) + SourceIndex(0) +7 >Emitted(9, 64) Source(26, 32) + SourceIndex(0) +8 >Emitted(9, 66) Source(26, 44) + SourceIndex(0) +9 >Emitted(9, 67) Source(26, 45) + SourceIndex(0) +10>Emitted(9, 70) Source(26, 48) + SourceIndex(0) +11>Emitted(9, 71) Source(26, 49) + SourceIndex(0) +12>Emitted(9, 73) Source(26, 51) + SourceIndex(0) +13>Emitted(9, 74) Source(26, 52) + SourceIndex(0) +14>Emitted(9, 77) Source(26, 55) + SourceIndex(0) +15>Emitted(9, 78) Source(26, 56) + SourceIndex(0) +16>Emitted(9, 80) Source(26, 58) + SourceIndex(0) +17>Emitted(9, 81) Source(26, 59) + SourceIndex(0) +18>Emitted(9, 83) Source(26, 61) + SourceIndex(0) +19>Emitted(9, 85) Source(26, 63) + SourceIndex(0) +20>Emitted(9, 86) Source(26, 64) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(10, 5) Source(27, 5) + SourceIndex(0) +2 >Emitted(10, 12) Source(27, 12) + SourceIndex(0) +3 >Emitted(10, 13) Source(27, 13) + SourceIndex(0) +4 >Emitted(10, 16) Source(27, 16) + SourceIndex(0) +5 >Emitted(10, 17) Source(27, 17) + SourceIndex(0) +6 >Emitted(10, 22) Source(27, 22) + SourceIndex(0) +7 >Emitted(10, 23) Source(27, 23) + SourceIndex(0) +8 >Emitted(10, 24) Source(27, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(11, 1) Source(28, 1) + SourceIndex(0) +2 >Emitted(11, 2) Source(28, 2) + SourceIndex(0) +--- +>>>for (var _b = getRobot().name, nameA = _b === void 0 ? "noName" : _b, i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^ +10> ^^^ +11> ^ +12> ^^ +13> ^ +14> ^^^ +15> ^ +16> ^^ +17> ^ +18> ^^ +19> ^^ +20> ^ +1-> + > +2 >for +3 > +4 > (let { +5 > name: nameA = "noName" +6 > +7 > name: nameA = "noName" +8 > } = getRobot(), +9 > i +10> = +11> 0 +12> ; +13> i +14> < +15> 1 +16> ; +17> i +18> ++ +19> ) +20> { +1->Emitted(12, 1) Source(29, 1) + SourceIndex(0) +2 >Emitted(12, 4) Source(29, 4) + SourceIndex(0) +3 >Emitted(12, 5) Source(29, 5) + SourceIndex(0) +4 >Emitted(12, 6) Source(29, 11) + SourceIndex(0) +5 >Emitted(12, 30) Source(29, 33) + SourceIndex(0) +6 >Emitted(12, 32) Source(29, 11) + SourceIndex(0) +7 >Emitted(12, 69) Source(29, 33) + SourceIndex(0) +8 >Emitted(12, 71) Source(29, 50) + SourceIndex(0) +9 >Emitted(12, 72) Source(29, 51) + SourceIndex(0) +10>Emitted(12, 75) Source(29, 54) + SourceIndex(0) +11>Emitted(12, 76) Source(29, 55) + SourceIndex(0) +12>Emitted(12, 78) Source(29, 57) + SourceIndex(0) +13>Emitted(12, 79) Source(29, 58) + SourceIndex(0) +14>Emitted(12, 82) Source(29, 61) + SourceIndex(0) +15>Emitted(12, 83) Source(29, 62) + SourceIndex(0) +16>Emitted(12, 85) Source(29, 64) + SourceIndex(0) +17>Emitted(12, 86) Source(29, 65) + SourceIndex(0) +18>Emitted(12, 88) Source(29, 67) + SourceIndex(0) +19>Emitted(12, 90) Source(29, 69) + SourceIndex(0) +20>Emitted(12, 91) Source(29, 70) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(13, 5) Source(30, 5) + SourceIndex(0) +2 >Emitted(13, 12) Source(30, 12) + SourceIndex(0) +3 >Emitted(13, 13) Source(30, 13) + SourceIndex(0) +4 >Emitted(13, 16) Source(30, 16) + SourceIndex(0) +5 >Emitted(13, 17) Source(30, 17) + SourceIndex(0) +6 >Emitted(13, 22) Source(30, 22) + SourceIndex(0) +7 >Emitted(13, 23) Source(30, 23) + SourceIndex(0) +8 >Emitted(13, 24) Source(30, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(14, 1) Source(31, 1) + SourceIndex(0) +2 >Emitted(14, 2) Source(31, 2) + SourceIndex(0) +--- +>>>for (var _c = { name: "trimmer", skill: "trimming" }.name, nameA = _c === void 0 ? "noName" : _c, i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^ +10> ^^^ +11> ^ +12> ^^ +13> ^ +14> ^^^ +15> ^ +16> ^^ +17> ^ +18> ^^ +19> ^^ +20> ^ +1-> + > +2 >for +3 > +4 > (let { +5 > name: nameA = "noName" +6 > +7 > name: nameA = "noName" +8 > } = { name: "trimmer", skill: "trimming" }, +9 > i +10> = +11> 0 +12> ; +13> i +14> < +15> 1 +16> ; +17> i +18> ++ +19> ) +20> { +1->Emitted(15, 1) Source(32, 1) + SourceIndex(0) +2 >Emitted(15, 4) Source(32, 4) + SourceIndex(0) +3 >Emitted(15, 5) Source(32, 5) + SourceIndex(0) +4 >Emitted(15, 6) Source(32, 11) + SourceIndex(0) +5 >Emitted(15, 58) Source(32, 33) + SourceIndex(0) +6 >Emitted(15, 60) Source(32, 11) + SourceIndex(0) +7 >Emitted(15, 97) Source(32, 33) + SourceIndex(0) +8 >Emitted(15, 99) Source(32, 85) + SourceIndex(0) +9 >Emitted(15, 100) Source(32, 86) + SourceIndex(0) +10>Emitted(15, 103) Source(32, 89) + SourceIndex(0) +11>Emitted(15, 104) Source(32, 90) + SourceIndex(0) +12>Emitted(15, 106) Source(32, 92) + SourceIndex(0) +13>Emitted(15, 107) Source(32, 93) + SourceIndex(0) +14>Emitted(15, 110) Source(32, 96) + SourceIndex(0) +15>Emitted(15, 111) Source(32, 97) + SourceIndex(0) +16>Emitted(15, 113) Source(32, 99) + SourceIndex(0) +17>Emitted(15, 114) Source(32, 100) + SourceIndex(0) +18>Emitted(15, 116) Source(32, 102) + SourceIndex(0) +19>Emitted(15, 118) Source(32, 104) + SourceIndex(0) +20>Emitted(15, 119) Source(32, 105) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(16, 5) Source(33, 5) + SourceIndex(0) +2 >Emitted(16, 12) Source(33, 12) + SourceIndex(0) +3 >Emitted(16, 13) Source(33, 13) + SourceIndex(0) +4 >Emitted(16, 16) Source(33, 16) + SourceIndex(0) +5 >Emitted(16, 17) Source(33, 17) + SourceIndex(0) +6 >Emitted(16, 22) Source(33, 22) + SourceIndex(0) +7 >Emitted(16, 23) Source(33, 23) + SourceIndex(0) +8 >Emitted(16, 24) Source(33, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(17, 1) Source(34, 1) + SourceIndex(0) +2 >Emitted(17, 2) Source(34, 2) + SourceIndex(0) +--- +>>>for (var _d = multiRobot.skills, _e = _d === void 0 ? { primary: "none", secondary: "none" } : _d, _f = _e.primary, primaryA = _f === void 0 ? "primary" : _f, _g = _e.secondary, secondaryA = _g === void 0 ? "secondary" : _g, i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^ +10> ^^ +11> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +12> ^^ +13> ^^^^^^^^^^^^^^^^^ +14> ^^ +15> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +16> ^^ +17> ^ +18> ^^^ +19> ^ +20> ^^ +21> ^ +22> ^^^ +23> ^ +24> ^^ +25> ^ +26> ^^ +27> ^^ +28> ^ +1-> + > +2 >for +3 > +4 > (let { + > +5 > skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "none", secondary: "none" } +6 > +7 > skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "none", secondary: "none" } +8 > +9 > primary: primaryA = "primary" +10> +11> primary: primaryA = "primary" +12> , + > +13> secondary: secondaryA = "secondary" +14> +15> secondary: secondaryA = "secondary" +16> + > } = { primary: "none", secondary: "none" } + > } = multiRobot, +17> i +18> = +19> 0 +20> ; +21> i +22> < +23> 1 +24> ; +25> i +26> ++ +27> ) +28> { +1->Emitted(18, 1) Source(35, 1) + SourceIndex(0) +2 >Emitted(18, 4) Source(35, 4) + SourceIndex(0) +3 >Emitted(18, 5) Source(35, 5) + SourceIndex(0) +4 >Emitted(18, 6) Source(36, 5) + SourceIndex(0) +5 >Emitted(18, 32) Source(39, 47) + SourceIndex(0) +6 >Emitted(18, 34) Source(36, 5) + SourceIndex(0) +7 >Emitted(18, 98) Source(39, 47) + SourceIndex(0) +8 >Emitted(18, 100) Source(37, 9) + SourceIndex(0) +9 >Emitted(18, 115) Source(37, 38) + SourceIndex(0) +10>Emitted(18, 117) Source(37, 9) + SourceIndex(0) +11>Emitted(18, 158) Source(37, 38) + SourceIndex(0) +12>Emitted(18, 160) Source(38, 9) + SourceIndex(0) +13>Emitted(18, 177) Source(38, 44) + SourceIndex(0) +14>Emitted(18, 179) Source(38, 9) + SourceIndex(0) +15>Emitted(18, 224) Source(38, 44) + SourceIndex(0) +16>Emitted(18, 226) Source(40, 17) + SourceIndex(0) +17>Emitted(18, 227) Source(40, 18) + SourceIndex(0) +18>Emitted(18, 230) Source(40, 21) + SourceIndex(0) +19>Emitted(18, 231) Source(40, 22) + SourceIndex(0) +20>Emitted(18, 233) Source(40, 24) + SourceIndex(0) +21>Emitted(18, 234) Source(40, 25) + SourceIndex(0) +22>Emitted(18, 237) Source(40, 28) + SourceIndex(0) +23>Emitted(18, 238) Source(40, 29) + SourceIndex(0) +24>Emitted(18, 240) Source(40, 31) + SourceIndex(0) +25>Emitted(18, 241) Source(40, 32) + SourceIndex(0) +26>Emitted(18, 243) Source(40, 34) + SourceIndex(0) +27>Emitted(18, 245) Source(40, 36) + SourceIndex(0) +28>Emitted(18, 246) Source(40, 37) + SourceIndex(0) +--- +>>> console.log(primaryA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > primaryA +7 > ) +8 > ; +1 >Emitted(19, 5) Source(41, 5) + SourceIndex(0) +2 >Emitted(19, 12) Source(41, 12) + SourceIndex(0) +3 >Emitted(19, 13) Source(41, 13) + SourceIndex(0) +4 >Emitted(19, 16) Source(41, 16) + SourceIndex(0) +5 >Emitted(19, 17) Source(41, 17) + SourceIndex(0) +6 >Emitted(19, 25) Source(41, 25) + SourceIndex(0) +7 >Emitted(19, 26) Source(41, 26) + SourceIndex(0) +8 >Emitted(19, 27) Source(41, 27) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(20, 1) Source(42, 1) + SourceIndex(0) +2 >Emitted(20, 2) Source(42, 2) + SourceIndex(0) +--- +>>>for (var _h = getMultiRobot().skills, _j = _h === void 0 ? { primary: "none", secondary: "none" } : _h, _k = _j.primary, primaryA = _k === void 0 ? "primary" : _k, _l = _j.secondary, secondaryA = _l === void 0 ? "secondary" : _l, i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^ +10> ^^ +11> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +12> ^^ +13> ^^^^^^^^^^^^^^^^^ +14> ^^ +15> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +16> ^^ +17> ^ +18> ^^^ +19> ^ +20> ^^ +21> ^ +22> ^^^ +23> ^ +24> ^^ +25> ^ +26> ^^ +27> ^^ +28> ^ +1-> + > +2 >for +3 > +4 > (let { + > +5 > skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "none", secondary: "none" } +6 > +7 > skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "none", secondary: "none" } +8 > +9 > primary: primaryA = "primary" +10> +11> primary: primaryA = "primary" +12> , + > +13> secondary: secondaryA = "secondary" +14> +15> secondary: secondaryA = "secondary" +16> + > } = { primary: "none", secondary: "none" } + > } = getMultiRobot(), +17> i +18> = +19> 0 +20> ; +21> i +22> < +23> 1 +24> ; +25> i +26> ++ +27> ) +28> { +1->Emitted(21, 1) Source(43, 1) + SourceIndex(0) +2 >Emitted(21, 4) Source(43, 4) + SourceIndex(0) +3 >Emitted(21, 5) Source(43, 5) + SourceIndex(0) +4 >Emitted(21, 6) Source(44, 5) + SourceIndex(0) +5 >Emitted(21, 37) Source(47, 47) + SourceIndex(0) +6 >Emitted(21, 39) Source(44, 5) + SourceIndex(0) +7 >Emitted(21, 103) Source(47, 47) + SourceIndex(0) +8 >Emitted(21, 105) Source(45, 9) + SourceIndex(0) +9 >Emitted(21, 120) Source(45, 38) + SourceIndex(0) +10>Emitted(21, 122) Source(45, 9) + SourceIndex(0) +11>Emitted(21, 163) Source(45, 38) + SourceIndex(0) +12>Emitted(21, 165) Source(46, 9) + SourceIndex(0) +13>Emitted(21, 182) Source(46, 44) + SourceIndex(0) +14>Emitted(21, 184) Source(46, 9) + SourceIndex(0) +15>Emitted(21, 229) Source(46, 44) + SourceIndex(0) +16>Emitted(21, 231) Source(48, 22) + SourceIndex(0) +17>Emitted(21, 232) Source(48, 23) + SourceIndex(0) +18>Emitted(21, 235) Source(48, 26) + SourceIndex(0) +19>Emitted(21, 236) Source(48, 27) + SourceIndex(0) +20>Emitted(21, 238) Source(48, 29) + SourceIndex(0) +21>Emitted(21, 239) Source(48, 30) + SourceIndex(0) +22>Emitted(21, 242) Source(48, 33) + SourceIndex(0) +23>Emitted(21, 243) Source(48, 34) + SourceIndex(0) +24>Emitted(21, 245) Source(48, 36) + SourceIndex(0) +25>Emitted(21, 246) Source(48, 37) + SourceIndex(0) +26>Emitted(21, 248) Source(48, 39) + SourceIndex(0) +27>Emitted(21, 250) Source(48, 41) + SourceIndex(0) +28>Emitted(21, 251) Source(48, 42) + SourceIndex(0) +--- +>>> console.log(primaryA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > primaryA +7 > ) +8 > ; +1 >Emitted(22, 5) Source(49, 5) + SourceIndex(0) +2 >Emitted(22, 12) Source(49, 12) + SourceIndex(0) +3 >Emitted(22, 13) Source(49, 13) + SourceIndex(0) +4 >Emitted(22, 16) Source(49, 16) + SourceIndex(0) +5 >Emitted(22, 17) Source(49, 17) + SourceIndex(0) +6 >Emitted(22, 25) Source(49, 25) + SourceIndex(0) +7 >Emitted(22, 26) Source(49, 26) + SourceIndex(0) +8 >Emitted(22, 27) Source(49, 27) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(23, 1) Source(50, 1) + SourceIndex(0) +2 >Emitted(23, 2) Source(50, 2) + SourceIndex(0) +--- +>>>for (var _m = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }.skills, _o = _m === void 0 ? { primary: "none", secondary: "none" } : _m, _p = _o.primary, primaryA = _p === void 0 ? "primary" : _p, _q = _o.secondary, secondaryA = _q === void 0 ? "secondary" : _q, i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^ +10> ^^ +11> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +12> ^^ +13> ^^^^^^^^^^^^^^^^^ +14> ^^ +15> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +16> ^^ +17> ^ +18> ^^^ +19> ^ +20> ^^ +21> ^ +22> ^^^ +23> ^ +24> ^^ +25> ^ +26> ^^ +27> ^^ +28> ^ +1-> + > +2 >for +3 > +4 > (let { + > +5 > skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "none", secondary: "none" } +6 > +7 > skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "none", secondary: "none" } +8 > +9 > primary: primaryA = "primary" +10> +11> primary: primaryA = "primary" +12> , + > +13> secondary: secondaryA = "secondary" +14> +15> secondary: secondaryA = "secondary" +16> + > } = { primary: "none", secondary: "none" } + > } = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, + > +17> i +18> = +19> 0 +20> ; +21> i +22> < +23> 1 +24> ; +25> i +26> ++ +27> ) +28> { +1->Emitted(24, 1) Source(51, 1) + SourceIndex(0) +2 >Emitted(24, 4) Source(51, 4) + SourceIndex(0) +3 >Emitted(24, 5) Source(51, 5) + SourceIndex(0) +4 >Emitted(24, 6) Source(52, 5) + SourceIndex(0) +5 >Emitted(24, 95) Source(55, 47) + SourceIndex(0) +6 >Emitted(24, 97) Source(52, 5) + SourceIndex(0) +7 >Emitted(24, 161) Source(55, 47) + SourceIndex(0) +8 >Emitted(24, 163) Source(53, 9) + SourceIndex(0) +9 >Emitted(24, 178) Source(53, 38) + SourceIndex(0) +10>Emitted(24, 180) Source(53, 9) + SourceIndex(0) +11>Emitted(24, 221) Source(53, 38) + SourceIndex(0) +12>Emitted(24, 223) Source(54, 9) + SourceIndex(0) +13>Emitted(24, 240) Source(54, 44) + SourceIndex(0) +14>Emitted(24, 242) Source(54, 9) + SourceIndex(0) +15>Emitted(24, 287) Source(54, 44) + SourceIndex(0) +16>Emitted(24, 289) Source(57, 5) + SourceIndex(0) +17>Emitted(24, 290) Source(57, 6) + SourceIndex(0) +18>Emitted(24, 293) Source(57, 9) + SourceIndex(0) +19>Emitted(24, 294) Source(57, 10) + SourceIndex(0) +20>Emitted(24, 296) Source(57, 12) + SourceIndex(0) +21>Emitted(24, 297) Source(57, 13) + SourceIndex(0) +22>Emitted(24, 300) Source(57, 16) + SourceIndex(0) +23>Emitted(24, 301) Source(57, 17) + SourceIndex(0) +24>Emitted(24, 303) Source(57, 19) + SourceIndex(0) +25>Emitted(24, 304) Source(57, 20) + SourceIndex(0) +26>Emitted(24, 306) Source(57, 22) + SourceIndex(0) +27>Emitted(24, 308) Source(57, 24) + SourceIndex(0) +28>Emitted(24, 309) Source(57, 25) + SourceIndex(0) +--- +>>> console.log(primaryA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > primaryA +7 > ) +8 > ; +1 >Emitted(25, 5) Source(58, 5) + SourceIndex(0) +2 >Emitted(25, 12) Source(58, 12) + SourceIndex(0) +3 >Emitted(25, 13) Source(58, 13) + SourceIndex(0) +4 >Emitted(25, 16) Source(58, 16) + SourceIndex(0) +5 >Emitted(25, 17) Source(58, 17) + SourceIndex(0) +6 >Emitted(25, 25) Source(58, 25) + SourceIndex(0) +7 >Emitted(25, 26) Source(58, 26) + SourceIndex(0) +8 >Emitted(25, 27) Source(58, 27) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(26, 1) Source(59, 1) + SourceIndex(0) +2 >Emitted(26, 2) Source(59, 2) + SourceIndex(0) +--- +>>>for (var _r = robot.name, nameA = _r === void 0 ? "noName" : _r, _s = robot.skill, skillA = _s === void 0 ? "skill" : _s, i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^^ +10> ^^ +11> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +12> ^^ +13> ^ +14> ^^^ +15> ^ +16> ^^ +17> ^ +18> ^^^ +19> ^ +20> ^^ +21> ^ +22> ^^ +23> ^^ +24> ^ +1-> + > + > +2 >for +3 > +4 > (let { +5 > name: nameA = "noName" +6 > +7 > name: nameA = "noName" +8 > , +9 > skill: skillA = "skill" +10> +11> skill: skillA = "skill" +12> } = robot, +13> i +14> = +15> 0 +16> ; +17> i +18> < +19> 1 +20> ; +21> i +22> ++ +23> ) +24> { +1->Emitted(27, 1) Source(61, 1) + SourceIndex(0) +2 >Emitted(27, 4) Source(61, 4) + SourceIndex(0) +3 >Emitted(27, 5) Source(61, 5) + SourceIndex(0) +4 >Emitted(27, 6) Source(61, 11) + SourceIndex(0) +5 >Emitted(27, 25) Source(61, 33) + SourceIndex(0) +6 >Emitted(27, 27) Source(61, 11) + SourceIndex(0) +7 >Emitted(27, 64) Source(61, 33) + SourceIndex(0) +8 >Emitted(27, 66) Source(61, 35) + SourceIndex(0) +9 >Emitted(27, 82) Source(61, 58) + SourceIndex(0) +10>Emitted(27, 84) Source(61, 35) + SourceIndex(0) +11>Emitted(27, 121) Source(61, 58) + SourceIndex(0) +12>Emitted(27, 123) Source(61, 70) + SourceIndex(0) +13>Emitted(27, 124) Source(61, 71) + SourceIndex(0) +14>Emitted(27, 127) Source(61, 74) + SourceIndex(0) +15>Emitted(27, 128) Source(61, 75) + SourceIndex(0) +16>Emitted(27, 130) Source(61, 77) + SourceIndex(0) +17>Emitted(27, 131) Source(61, 78) + SourceIndex(0) +18>Emitted(27, 134) Source(61, 81) + SourceIndex(0) +19>Emitted(27, 135) Source(61, 82) + SourceIndex(0) +20>Emitted(27, 137) Source(61, 84) + SourceIndex(0) +21>Emitted(27, 138) Source(61, 85) + SourceIndex(0) +22>Emitted(27, 140) Source(61, 87) + SourceIndex(0) +23>Emitted(27, 142) Source(61, 89) + SourceIndex(0) +24>Emitted(27, 143) Source(61, 90) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(28, 5) Source(62, 5) + SourceIndex(0) +2 >Emitted(28, 12) Source(62, 12) + SourceIndex(0) +3 >Emitted(28, 13) Source(62, 13) + SourceIndex(0) +4 >Emitted(28, 16) Source(62, 16) + SourceIndex(0) +5 >Emitted(28, 17) Source(62, 17) + SourceIndex(0) +6 >Emitted(28, 22) Source(62, 22) + SourceIndex(0) +7 >Emitted(28, 23) Source(62, 23) + SourceIndex(0) +8 >Emitted(28, 24) Source(62, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(29, 1) Source(63, 1) + SourceIndex(0) +2 >Emitted(29, 2) Source(63, 2) + SourceIndex(0) +--- +>>>for (var _t = getRobot(), _u = _t.name, nameA = _u === void 0 ? "noName" : _u, _v = _t.skill, skillA = _v === void 0 ? "skill" : _v, i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^ +6 > ^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +15> ^^ +16> ^ +17> ^^^ +18> ^ +19> ^^ +20> ^ +21> ^^^ +22> ^ +23> ^^ +24> ^ +25> ^^ +26> ^^ +27> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > let {name: nameA = "noName", skill: skillA = "skill" } = getRobot() +7 > +8 > name: nameA = "noName" +9 > +10> name: nameA = "noName" +11> , +12> skill: skillA = "skill" +13> +14> skill: skillA = "skill" +15> } = getRobot(), +16> i +17> = +18> 0 +19> ; +20> i +21> < +22> 1 +23> ; +24> i +25> ++ +26> ) +27> { +1->Emitted(30, 1) Source(64, 1) + SourceIndex(0) +2 >Emitted(30, 4) Source(64, 4) + SourceIndex(0) +3 >Emitted(30, 5) Source(64, 5) + SourceIndex(0) +4 >Emitted(30, 6) Source(64, 6) + SourceIndex(0) +5 >Emitted(30, 10) Source(64, 6) + SourceIndex(0) +6 >Emitted(30, 25) Source(64, 73) + SourceIndex(0) +7 >Emitted(30, 27) Source(64, 11) + SourceIndex(0) +8 >Emitted(30, 39) Source(64, 33) + SourceIndex(0) +9 >Emitted(30, 41) Source(64, 11) + SourceIndex(0) +10>Emitted(30, 78) Source(64, 33) + SourceIndex(0) +11>Emitted(30, 80) Source(64, 35) + SourceIndex(0) +12>Emitted(30, 93) Source(64, 58) + SourceIndex(0) +13>Emitted(30, 95) Source(64, 35) + SourceIndex(0) +14>Emitted(30, 132) Source(64, 58) + SourceIndex(0) +15>Emitted(30, 134) Source(64, 75) + SourceIndex(0) +16>Emitted(30, 135) Source(64, 76) + SourceIndex(0) +17>Emitted(30, 138) Source(64, 79) + SourceIndex(0) +18>Emitted(30, 139) Source(64, 80) + SourceIndex(0) +19>Emitted(30, 141) Source(64, 82) + SourceIndex(0) +20>Emitted(30, 142) Source(64, 83) + SourceIndex(0) +21>Emitted(30, 145) Source(64, 86) + SourceIndex(0) +22>Emitted(30, 146) Source(64, 87) + SourceIndex(0) +23>Emitted(30, 148) Source(64, 89) + SourceIndex(0) +24>Emitted(30, 149) Source(64, 90) + SourceIndex(0) +25>Emitted(30, 151) Source(64, 92) + SourceIndex(0) +26>Emitted(30, 153) Source(64, 94) + SourceIndex(0) +27>Emitted(30, 154) Source(64, 95) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(31, 5) Source(65, 5) + SourceIndex(0) +2 >Emitted(31, 12) Source(65, 12) + SourceIndex(0) +3 >Emitted(31, 13) Source(65, 13) + SourceIndex(0) +4 >Emitted(31, 16) Source(65, 16) + SourceIndex(0) +5 >Emitted(31, 17) Source(65, 17) + SourceIndex(0) +6 >Emitted(31, 22) Source(65, 22) + SourceIndex(0) +7 >Emitted(31, 23) Source(65, 23) + SourceIndex(0) +8 >Emitted(31, 24) Source(65, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(32, 1) Source(66, 1) + SourceIndex(0) +2 >Emitted(32, 2) Source(66, 2) + SourceIndex(0) +--- +>>>for (var _w = { name: "trimmer", skill: "trimming" }, _x = _w.name, nameA = _x === void 0 ? "noName" : _x, _y = _w.skill, skillA = _y === void 0 ? "skill" : _y, i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +15> ^^ +16> ^ +17> ^^^ +18> ^ +19> ^^ +20> ^ +21> ^^^ +22> ^ +23> ^^ +24> ^ +25> ^^ +26> ^^ +27> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > let {name: nameA = "noName", skill: skillA = "skill" } = { name: "trimmer", skill: "trimming" } +7 > +8 > name: nameA = "noName" +9 > +10> name: nameA = "noName" +11> , +12> skill: skillA = "skill" +13> +14> skill: skillA = "skill" +15> } = { name: "trimmer", skill: "trimming" }, +16> i +17> = +18> 0 +19> ; +20> i +21> < +22> 1 +23> ; +24> i +25> ++ +26> ) +27> { +1->Emitted(33, 1) Source(67, 1) + SourceIndex(0) +2 >Emitted(33, 4) Source(67, 4) + SourceIndex(0) +3 >Emitted(33, 5) Source(67, 5) + SourceIndex(0) +4 >Emitted(33, 6) Source(67, 6) + SourceIndex(0) +5 >Emitted(33, 10) Source(67, 6) + SourceIndex(0) +6 >Emitted(33, 53) Source(67, 108) + SourceIndex(0) +7 >Emitted(33, 55) Source(67, 11) + SourceIndex(0) +8 >Emitted(33, 67) Source(67, 33) + SourceIndex(0) +9 >Emitted(33, 69) Source(67, 11) + SourceIndex(0) +10>Emitted(33, 106) Source(67, 33) + SourceIndex(0) +11>Emitted(33, 108) Source(67, 35) + SourceIndex(0) +12>Emitted(33, 121) Source(67, 58) + SourceIndex(0) +13>Emitted(33, 123) Source(67, 35) + SourceIndex(0) +14>Emitted(33, 160) Source(67, 58) + SourceIndex(0) +15>Emitted(33, 162) Source(67, 110) + SourceIndex(0) +16>Emitted(33, 163) Source(67, 111) + SourceIndex(0) +17>Emitted(33, 166) Source(67, 114) + SourceIndex(0) +18>Emitted(33, 167) Source(67, 115) + SourceIndex(0) +19>Emitted(33, 169) Source(67, 117) + SourceIndex(0) +20>Emitted(33, 170) Source(67, 118) + SourceIndex(0) +21>Emitted(33, 173) Source(67, 121) + SourceIndex(0) +22>Emitted(33, 174) Source(67, 122) + SourceIndex(0) +23>Emitted(33, 176) Source(67, 124) + SourceIndex(0) +24>Emitted(33, 177) Source(67, 125) + SourceIndex(0) +25>Emitted(33, 179) Source(67, 127) + SourceIndex(0) +26>Emitted(33, 181) Source(67, 129) + SourceIndex(0) +27>Emitted(33, 182) Source(67, 130) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(34, 5) Source(68, 5) + SourceIndex(0) +2 >Emitted(34, 12) Source(68, 12) + SourceIndex(0) +3 >Emitted(34, 13) Source(68, 13) + SourceIndex(0) +4 >Emitted(34, 16) Source(68, 16) + SourceIndex(0) +5 >Emitted(34, 17) Source(68, 17) + SourceIndex(0) +6 >Emitted(34, 22) Source(68, 22) + SourceIndex(0) +7 >Emitted(34, 23) Source(68, 23) + SourceIndex(0) +8 >Emitted(34, 24) Source(68, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(35, 1) Source(69, 1) + SourceIndex(0) +2 >Emitted(35, 2) Source(69, 2) + SourceIndex(0) +--- +>>>for (var _z = multiRobot.name, nameA = _z === void 0 ? "noName" : _z, _0 = multiRobot.skills, _1 = _0 === void 0 ? { primary: "none", secondary: "none" } : _0, _2 = _1.primary, primaryA = _2 === void 0 ? "primary" : _2, _3 = _1.secondary, secondaryA = _3 === void 0 ? "secondary" : _3, i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^^^^^^^^ +10> ^^ +11> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +12> ^^ +13> ^^^^^^^^^^^^^^^ +14> ^^ +15> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +16> ^^ +17> ^^^^^^^^^^^^^^^^^ +18> ^^ +19> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +20> ^^ +21> ^ +22> ^^^ +23> ^ +24> ^^ +25> ^ +26> ^^^ +27> ^ +28> ^^ +29> ^ +30> ^^ +31> ^^ +32> ^ +1-> + > +2 >for +3 > +4 > (let { + > +5 > name: nameA = "noName" +6 > +7 > name: nameA = "noName" +8 > , + > +9 > skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "none", secondary: "none" } +10> +11> skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "none", secondary: "none" } +12> +13> primary: primaryA = "primary" +14> +15> primary: primaryA = "primary" +16> , + > +17> secondary: secondaryA = "secondary" +18> +19> secondary: secondaryA = "secondary" +20> + > } = { primary: "none", secondary: "none" } + > } = multiRobot, +21> i +22> = +23> 0 +24> ; +25> i +26> < +27> 1 +28> ; +29> i +30> ++ +31> ) +32> { +1->Emitted(36, 1) Source(70, 1) + SourceIndex(0) +2 >Emitted(36, 4) Source(70, 4) + SourceIndex(0) +3 >Emitted(36, 5) Source(70, 5) + SourceIndex(0) +4 >Emitted(36, 6) Source(71, 5) + SourceIndex(0) +5 >Emitted(36, 30) Source(71, 27) + SourceIndex(0) +6 >Emitted(36, 32) Source(71, 5) + SourceIndex(0) +7 >Emitted(36, 69) Source(71, 27) + SourceIndex(0) +8 >Emitted(36, 71) Source(72, 5) + SourceIndex(0) +9 >Emitted(36, 93) Source(75, 47) + SourceIndex(0) +10>Emitted(36, 95) Source(72, 5) + SourceIndex(0) +11>Emitted(36, 159) Source(75, 47) + SourceIndex(0) +12>Emitted(36, 161) Source(73, 9) + SourceIndex(0) +13>Emitted(36, 176) Source(73, 38) + SourceIndex(0) +14>Emitted(36, 178) Source(73, 9) + SourceIndex(0) +15>Emitted(36, 219) Source(73, 38) + SourceIndex(0) +16>Emitted(36, 221) Source(74, 9) + SourceIndex(0) +17>Emitted(36, 238) Source(74, 44) + SourceIndex(0) +18>Emitted(36, 240) Source(74, 9) + SourceIndex(0) +19>Emitted(36, 285) Source(74, 44) + SourceIndex(0) +20>Emitted(36, 287) Source(76, 17) + SourceIndex(0) +21>Emitted(36, 288) Source(76, 18) + SourceIndex(0) +22>Emitted(36, 291) Source(76, 21) + SourceIndex(0) +23>Emitted(36, 292) Source(76, 22) + SourceIndex(0) +24>Emitted(36, 294) Source(76, 24) + SourceIndex(0) +25>Emitted(36, 295) Source(76, 25) + SourceIndex(0) +26>Emitted(36, 298) Source(76, 28) + SourceIndex(0) +27>Emitted(36, 299) Source(76, 29) + SourceIndex(0) +28>Emitted(36, 301) Source(76, 31) + SourceIndex(0) +29>Emitted(36, 302) Source(76, 32) + SourceIndex(0) +30>Emitted(36, 304) Source(76, 34) + SourceIndex(0) +31>Emitted(36, 306) Source(76, 36) + SourceIndex(0) +32>Emitted(36, 307) Source(76, 37) + SourceIndex(0) +--- +>>> console.log(primaryA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > primaryA +7 > ) +8 > ; +1 >Emitted(37, 5) Source(77, 5) + SourceIndex(0) +2 >Emitted(37, 12) Source(77, 12) + SourceIndex(0) +3 >Emitted(37, 13) Source(77, 13) + SourceIndex(0) +4 >Emitted(37, 16) Source(77, 16) + SourceIndex(0) +5 >Emitted(37, 17) Source(77, 17) + SourceIndex(0) +6 >Emitted(37, 25) Source(77, 25) + SourceIndex(0) +7 >Emitted(37, 26) Source(77, 26) + SourceIndex(0) +8 >Emitted(37, 27) Source(77, 27) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(38, 1) Source(78, 1) + SourceIndex(0) +2 >Emitted(38, 2) Source(78, 2) + SourceIndex(0) +--- +>>>for (var _4 = getMultiRobot(), _5 = _4.name, nameA = _5 === void 0 ? "noName" : _5, _6 = _4.skills, _7 = _6 === void 0 ? { primary: "none", secondary: "none" } : _6, _8 = _7.primary, primaryA = _8 === void 0 ? "primary" : _8, _9 = _7.secondary, secondaryA = _9 === void 0 ? "secondary" : _9, i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^ +6 > ^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +15> ^^ +16> ^^^^^^^^^^^^^^^ +17> ^^ +18> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +19> ^^ +20> ^^^^^^^^^^^^^^^^^ +21> ^^ +22> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +23> ^^ +24> ^ +25> ^^^ +26> ^ +27> ^^ +28> ^ +29> ^^^ +30> ^ +31> ^^ +32> ^ +33> ^^ +34> ^^ +35> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > let { + > name: nameA = "noName", + > skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "none", secondary: "none" } + > } = getMultiRobot() +7 > +8 > name: nameA = "noName" +9 > +10> name: nameA = "noName" +11> , + > +12> skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "none", secondary: "none" } +13> +14> skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "none", secondary: "none" } +15> +16> primary: primaryA = "primary" +17> +18> primary: primaryA = "primary" +19> , + > +20> secondary: secondaryA = "secondary" +21> +22> secondary: secondaryA = "secondary" +23> + > } = { primary: "none", secondary: "none" } + > } = getMultiRobot(), +24> i +25> = +26> 0 +27> ; +28> i +29> < +30> 1 +31> ; +32> i +33> ++ +34> ) +35> { +1->Emitted(39, 1) Source(79, 1) + SourceIndex(0) +2 >Emitted(39, 4) Source(79, 4) + SourceIndex(0) +3 >Emitted(39, 5) Source(79, 5) + SourceIndex(0) +4 >Emitted(39, 6) Source(79, 6) + SourceIndex(0) +5 >Emitted(39, 10) Source(79, 6) + SourceIndex(0) +6 >Emitted(39, 30) Source(85, 20) + SourceIndex(0) +7 >Emitted(39, 32) Source(80, 5) + SourceIndex(0) +8 >Emitted(39, 44) Source(80, 27) + SourceIndex(0) +9 >Emitted(39, 46) Source(80, 5) + SourceIndex(0) +10>Emitted(39, 83) Source(80, 27) + SourceIndex(0) +11>Emitted(39, 85) Source(81, 5) + SourceIndex(0) +12>Emitted(39, 99) Source(84, 47) + SourceIndex(0) +13>Emitted(39, 101) Source(81, 5) + SourceIndex(0) +14>Emitted(39, 165) Source(84, 47) + SourceIndex(0) +15>Emitted(39, 167) Source(82, 9) + SourceIndex(0) +16>Emitted(39, 182) Source(82, 38) + SourceIndex(0) +17>Emitted(39, 184) Source(82, 9) + SourceIndex(0) +18>Emitted(39, 225) Source(82, 38) + SourceIndex(0) +19>Emitted(39, 227) Source(83, 9) + SourceIndex(0) +20>Emitted(39, 244) Source(83, 44) + SourceIndex(0) +21>Emitted(39, 246) Source(83, 9) + SourceIndex(0) +22>Emitted(39, 291) Source(83, 44) + SourceIndex(0) +23>Emitted(39, 293) Source(85, 22) + SourceIndex(0) +24>Emitted(39, 294) Source(85, 23) + SourceIndex(0) +25>Emitted(39, 297) Source(85, 26) + SourceIndex(0) +26>Emitted(39, 298) Source(85, 27) + SourceIndex(0) +27>Emitted(39, 300) Source(85, 29) + SourceIndex(0) +28>Emitted(39, 301) Source(85, 30) + SourceIndex(0) +29>Emitted(39, 304) Source(85, 33) + SourceIndex(0) +30>Emitted(39, 305) Source(85, 34) + SourceIndex(0) +31>Emitted(39, 307) Source(85, 36) + SourceIndex(0) +32>Emitted(39, 308) Source(85, 37) + SourceIndex(0) +33>Emitted(39, 310) Source(85, 39) + SourceIndex(0) +34>Emitted(39, 312) Source(85, 41) + SourceIndex(0) +35>Emitted(39, 313) Source(85, 42) + SourceIndex(0) +--- +>>> console.log(primaryA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > primaryA +7 > ) +8 > ; +1 >Emitted(40, 5) Source(86, 5) + SourceIndex(0) +2 >Emitted(40, 12) Source(86, 12) + SourceIndex(0) +3 >Emitted(40, 13) Source(86, 13) + SourceIndex(0) +4 >Emitted(40, 16) Source(86, 16) + SourceIndex(0) +5 >Emitted(40, 17) Source(86, 17) + SourceIndex(0) +6 >Emitted(40, 25) Source(86, 25) + SourceIndex(0) +7 >Emitted(40, 26) Source(86, 26) + SourceIndex(0) +8 >Emitted(40, 27) Source(86, 27) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(41, 1) Source(87, 1) + SourceIndex(0) +2 >Emitted(41, 2) Source(87, 2) + SourceIndex(0) +--- +>>>for (var _10 = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, _11 = _10.name, nameA = _11 === void 0 ? "noName" : _11, _12 = _10.skills, _13 = _12 === void 0 ? { primary: "none", secondary: "none" } : _12, _14 = _13.primary, primaryA = _14 === void 0 ? "primary" : _14, _15 = _13.secondary, secondaryA = _15 === void 0 ? "secondary" : _15, i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +15> ^^ +16> ^^^^^^^^^^^^^^^^^ +17> ^^ +18> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +19> ^^ +20> ^^^^^^^^^^^^^^^^^^^ +21> ^^ +22> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +23> ^^ +24> ^ +25> ^^^ +26> ^ +27> ^^ +28> ^ +29> ^^^ +30> ^ +31> ^^ +32> ^ +33> ^^ +34> ^^ +35> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > let { + > name: nameA = "noName", + > skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "none", secondary: "none" } + > } = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } } +7 > +8 > name: nameA = "noName" +9 > +10> name: nameA = "noName" +11> , + > +12> skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "none", secondary: "none" } +13> +14> skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "none", secondary: "none" } +15> +16> primary: primaryA = "primary" +17> +18> primary: primaryA = "primary" +19> , + > +20> secondary: secondaryA = "secondary" +21> +22> secondary: secondaryA = "secondary" +23> + > } = { primary: "none", secondary: "none" } + > } = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, + > +24> i +25> = +26> 0 +27> ; +28> i +29> < +30> 1 +31> ; +32> i +33> ++ +34> ) +35> { +1->Emitted(42, 1) Source(88, 1) + SourceIndex(0) +2 >Emitted(42, 4) Source(88, 4) + SourceIndex(0) +3 >Emitted(42, 5) Source(88, 5) + SourceIndex(0) +4 >Emitted(42, 6) Source(88, 6) + SourceIndex(0) +5 >Emitted(42, 10) Source(88, 6) + SourceIndex(0) +6 >Emitted(42, 89) Source(94, 90) + SourceIndex(0) +7 >Emitted(42, 91) Source(89, 5) + SourceIndex(0) +8 >Emitted(42, 105) Source(89, 27) + SourceIndex(0) +9 >Emitted(42, 107) Source(89, 5) + SourceIndex(0) +10>Emitted(42, 146) Source(89, 27) + SourceIndex(0) +11>Emitted(42, 148) Source(90, 5) + SourceIndex(0) +12>Emitted(42, 164) Source(93, 47) + SourceIndex(0) +13>Emitted(42, 166) Source(90, 5) + SourceIndex(0) +14>Emitted(42, 233) Source(93, 47) + SourceIndex(0) +15>Emitted(42, 235) Source(91, 9) + SourceIndex(0) +16>Emitted(42, 252) Source(91, 38) + SourceIndex(0) +17>Emitted(42, 254) Source(91, 9) + SourceIndex(0) +18>Emitted(42, 297) Source(91, 38) + SourceIndex(0) +19>Emitted(42, 299) Source(92, 9) + SourceIndex(0) +20>Emitted(42, 318) Source(92, 44) + SourceIndex(0) +21>Emitted(42, 320) Source(92, 9) + SourceIndex(0) +22>Emitted(42, 367) Source(92, 44) + SourceIndex(0) +23>Emitted(42, 369) Source(95, 5) + SourceIndex(0) +24>Emitted(42, 370) Source(95, 6) + SourceIndex(0) +25>Emitted(42, 373) Source(95, 9) + SourceIndex(0) +26>Emitted(42, 374) Source(95, 10) + SourceIndex(0) +27>Emitted(42, 376) Source(95, 12) + SourceIndex(0) +28>Emitted(42, 377) Source(95, 13) + SourceIndex(0) +29>Emitted(42, 380) Source(95, 16) + SourceIndex(0) +30>Emitted(42, 381) Source(95, 17) + SourceIndex(0) +31>Emitted(42, 383) Source(95, 19) + SourceIndex(0) +32>Emitted(42, 384) Source(95, 20) + SourceIndex(0) +33>Emitted(42, 386) Source(95, 22) + SourceIndex(0) +34>Emitted(42, 388) Source(95, 24) + SourceIndex(0) +35>Emitted(42, 389) Source(95, 25) + SourceIndex(0) +--- +>>> console.log(primaryA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > primaryA +7 > ) +8 > ; +1 >Emitted(43, 5) Source(96, 5) + SourceIndex(0) +2 >Emitted(43, 12) Source(96, 12) + SourceIndex(0) +3 >Emitted(43, 13) Source(96, 13) + SourceIndex(0) +4 >Emitted(43, 16) Source(96, 16) + SourceIndex(0) +5 >Emitted(43, 17) Source(96, 17) + SourceIndex(0) +6 >Emitted(43, 25) Source(96, 25) + SourceIndex(0) +7 >Emitted(43, 26) Source(96, 26) + SourceIndex(0) +8 >Emitted(43, 27) Source(96, 27) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(44, 1) Source(97, 1) + SourceIndex(0) +2 >Emitted(44, 2) Source(97, 2) + SourceIndex(0) +--- +>>>//# sourceMappingURL=sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.symbols b/tests/baselines/reference/sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.symbols new file mode 100644 index 00000000000..04afb458955 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.symbols @@ -0,0 +1,350 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts === +declare var console: { +>console : Symbol(console, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 0, 11)) + + log(msg: any): void; +>log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 0, 22)) +>msg : Symbol(msg, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 1, 8)) +} +interface Robot { +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 2, 1)) + + name: string; +>name : Symbol(Robot.name, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 3, 17)) + + skill: string; +>skill : Symbol(Robot.skill, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 4, 17)) +} + +interface MultiRobot { +>MultiRobot : Symbol(MultiRobot, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 6, 1)) + + name: string; +>name : Symbol(MultiRobot.name, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 8, 22)) + + skills: { +>skills : Symbol(MultiRobot.skills, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 9, 17)) + + primary?: string; +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 10, 13)) + + secondary?: string; +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 11, 25)) + + }; +} + +let robot: Robot = { name: "mower", skill: "mowing" }; +>robot : Symbol(robot, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 16, 3)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 2, 1)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 16, 20)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 16, 35)) + +let multiRobot: MultiRobot = { name: "mower", skills: { primary: "mowing", secondary: "none" } }; +>multiRobot : Symbol(multiRobot, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 17, 3)) +>MultiRobot : Symbol(MultiRobot, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 6, 1)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 17, 30)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 17, 45)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 17, 55)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 17, 74)) + +function getRobot() { +>getRobot : Symbol(getRobot, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 17, 97)) + + return robot; +>robot : Symbol(robot, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 16, 3)) +} +function getMultiRobot() { +>getMultiRobot : Symbol(getMultiRobot, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 20, 1)) + + return multiRobot; +>multiRobot : Symbol(multiRobot, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 17, 3)) +} + +for (let {name: nameA= "noName" } = robot, i = 0; i < 1; i++) { +>name : Symbol(Robot.name, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 3, 17)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 25, 10)) +>robot : Symbol(robot, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 16, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 25, 42)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 25, 42)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 25, 42)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 25, 10)) +} +for (let {name: nameA = "noName" } = getRobot(), i = 0; i < 1; i++) { +>name : Symbol(Robot.name, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 3, 17)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 28, 10)) +>getRobot : Symbol(getRobot, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 17, 97)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 28, 48)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 28, 48)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 28, 48)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 28, 10)) +} +for (let {name: nameA = "noName" } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { +>name : Symbol(Robot.name, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 3, 17)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 31, 10)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 2, 1)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 31, 45)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 31, 62)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 31, 83)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 31, 83)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 31, 83)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 31, 10)) +} +for (let { + skills: { +>skills : Symbol(MultiRobot.skills, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 9, 17)) + + primary: primaryA = "primary", +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 10, 13)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 35, 13)) + + secondary: secondaryA = "secondary" +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 11, 25)) +>secondaryA : Symbol(secondaryA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 36, 38)) + + } = { primary: "none", secondary: "none" } +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 38, 9)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 38, 26)) + +} = multiRobot, i = 0; i < 1; i++) { +>multiRobot : Symbol(multiRobot, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 17, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 39, 15)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 39, 15)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 39, 15)) + + console.log(primaryA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 0, 22)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 35, 13)) +} +for (let { + skills: { +>skills : Symbol(MultiRobot.skills, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 9, 17)) + + primary: primaryA = "primary", +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 10, 13)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 43, 13)) + + secondary: secondaryA = "secondary" +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 11, 25)) +>secondaryA : Symbol(secondaryA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 44, 38)) + + } = { primary: "none", secondary: "none" } +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 46, 9)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 46, 26)) + +} = getMultiRobot(), i = 0; i < 1; i++) { +>getMultiRobot : Symbol(getMultiRobot, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 20, 1)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 47, 20)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 47, 20)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 47, 20)) + + console.log(primaryA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 0, 22)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 43, 13)) +} +for (let { + skills: { +>skills : Symbol(MultiRobot.skills, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 9, 17)) + + primary: primaryA = "primary", +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 10, 13)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 51, 13)) + + secondary: secondaryA = "secondary" +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 11, 25)) +>secondaryA : Symbol(secondaryA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 52, 38)) + + } = { primary: "none", secondary: "none" } +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 54, 9)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 54, 26)) + +} = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, +>MultiRobot : Symbol(MultiRobot, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 6, 1)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 55, 17)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 55, 34)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 55, 44)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 55, 65)) + + i = 0; i < 1; i++) { +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 55, 90)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 55, 90)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 55, 90)) + + console.log(primaryA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 0, 22)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 51, 13)) +} + +for (let {name: nameA = "noName", skill: skillA = "skill" } = robot, i = 0; i < 1; i++) { +>name : Symbol(Robot.name, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 3, 17)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 60, 10)) +>skill : Symbol(Robot.skill, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 4, 17)) +>skillA : Symbol(skillA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 60, 33)) +>robot : Symbol(robot, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 16, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 60, 68)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 60, 68)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 60, 68)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 60, 10)) +} +for (let {name: nameA = "noName", skill: skillA = "skill" } = getRobot(), i = 0; i < 1; i++) { +>name : Symbol(Robot.name, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 3, 17)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 63, 10)) +>skill : Symbol(Robot.skill, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 4, 17)) +>skillA : Symbol(skillA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 63, 33)) +>getRobot : Symbol(getRobot, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 17, 97)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 63, 73)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 63, 73)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 63, 73)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 63, 10)) +} +for (let {name: nameA = "noName", skill: skillA = "skill" } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { +>name : Symbol(Robot.name, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 3, 17)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 66, 10)) +>skill : Symbol(Robot.skill, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 4, 17)) +>skillA : Symbol(skillA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 66, 33)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 2, 1)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 66, 70)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 66, 87)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 66, 108)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 66, 108)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 66, 108)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 66, 10)) +} +for (let { + name: nameA = "noName", +>name : Symbol(MultiRobot.name, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 8, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 69, 10)) + + skills: { +>skills : Symbol(MultiRobot.skills, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 9, 17)) + + primary: primaryA = "primary", +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 10, 13)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 71, 13)) + + secondary: secondaryA = "secondary" +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 11, 25)) +>secondaryA : Symbol(secondaryA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 72, 38)) + + } = { primary: "none", secondary: "none" } +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 74, 9)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 74, 26)) + +} = multiRobot, i = 0; i < 1; i++) { +>multiRobot : Symbol(multiRobot, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 17, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 75, 15)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 75, 15)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 75, 15)) + + console.log(primaryA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 0, 22)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 71, 13)) +} +for (let { + name: nameA = "noName", +>name : Symbol(MultiRobot.name, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 8, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 78, 10)) + + skills: { +>skills : Symbol(MultiRobot.skills, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 9, 17)) + + primary: primaryA = "primary", +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 10, 13)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 80, 13)) + + secondary: secondaryA = "secondary" +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 11, 25)) +>secondaryA : Symbol(secondaryA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 81, 38)) + + } = { primary: "none", secondary: "none" } +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 83, 9)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 83, 26)) + +} = getMultiRobot(), i = 0; i < 1; i++) { +>getMultiRobot : Symbol(getMultiRobot, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 20, 1)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 84, 20)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 84, 20)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 84, 20)) + + console.log(primaryA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 0, 22)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 80, 13)) +} +for (let { + name: nameA = "noName", +>name : Symbol(MultiRobot.name, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 8, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 87, 10)) + + skills: { +>skills : Symbol(MultiRobot.skills, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 9, 17)) + + primary: primaryA = "primary", +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 10, 13)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 89, 13)) + + secondary: secondaryA = "secondary" +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 11, 25)) +>secondaryA : Symbol(secondaryA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 90, 38)) + + } = { primary: "none", secondary: "none" } +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 92, 9)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 92, 26)) + +} = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, +>MultiRobot : Symbol(MultiRobot, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 6, 1)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 93, 17)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 93, 34)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 93, 44)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 93, 65)) + + i = 0; i < 1; i++) { +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 93, 90)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 93, 90)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 93, 90)) + + console.log(primaryA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 0, 22)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts, 89, 13)) +} diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.types b/tests/baselines/reference/sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.types new file mode 100644 index 00000000000..c9e76f88581 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.types @@ -0,0 +1,484 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts === +declare var console: { +>console : { log(msg: any): void; } + + log(msg: any): void; +>log : (msg: any) => void +>msg : any +} +interface Robot { +>Robot : Robot + + name: string; +>name : string + + skill: string; +>skill : string +} + +interface MultiRobot { +>MultiRobot : MultiRobot + + name: string; +>name : string + + skills: { +>skills : { primary?: string; secondary?: string; } + + primary?: string; +>primary : string + + secondary?: string; +>secondary : string + + }; +} + +let robot: Robot = { name: "mower", skill: "mowing" }; +>robot : Robot +>Robot : Robot +>{ name: "mower", skill: "mowing" } : { name: string; skill: string; } +>name : string +>"mower" : string +>skill : string +>"mowing" : string + +let multiRobot: MultiRobot = { name: "mower", skills: { primary: "mowing", secondary: "none" } }; +>multiRobot : MultiRobot +>MultiRobot : MultiRobot +>{ name: "mower", skills: { primary: "mowing", secondary: "none" } } : { name: string; skills: { primary: string; secondary: string; }; } +>name : string +>"mower" : string +>skills : { primary: string; secondary: string; } +>{ primary: "mowing", secondary: "none" } : { primary: string; secondary: string; } +>primary : string +>"mowing" : string +>secondary : string +>"none" : string + +function getRobot() { +>getRobot : () => Robot + + return robot; +>robot : Robot +} +function getMultiRobot() { +>getMultiRobot : () => MultiRobot + + return multiRobot; +>multiRobot : MultiRobot +} + +for (let {name: nameA= "noName" } = robot, i = 0; i < 1; i++) { +>name : any +>nameA : string +>"noName" : string +>robot : Robot +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for (let {name: nameA = "noName" } = getRobot(), i = 0; i < 1; i++) { +>name : any +>nameA : string +>"noName" : string +>getRobot() : Robot +>getRobot : () => Robot +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for (let {name: nameA = "noName" } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { +>name : any +>nameA : string +>"noName" : string +>{ name: "trimmer", skill: "trimming" } : Robot +>Robot : Robot +>{ name: "trimmer", skill: "trimming" } : { name: string; skill: string; } +>name : string +>"trimmer" : string +>skill : string +>"trimming" : string +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for (let { + skills: { +>skills : any + + primary: primaryA = "primary", +>primary : any +>primaryA : string +>"primary" : string + + secondary: secondaryA = "secondary" +>secondary : any +>secondaryA : string +>"secondary" : string + + } = { primary: "none", secondary: "none" } +>{ primary: "none", secondary: "none" } : { primary?: string; secondary?: string; } +>primary : string +>"none" : string +>secondary : string +>"none" : string + +} = multiRobot, i = 0; i < 1; i++) { +>multiRobot : MultiRobot +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(primaryA); +>console.log(primaryA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primaryA : string +} +for (let { + skills: { +>skills : any + + primary: primaryA = "primary", +>primary : any +>primaryA : string +>"primary" : string + + secondary: secondaryA = "secondary" +>secondary : any +>secondaryA : string +>"secondary" : string + + } = { primary: "none", secondary: "none" } +>{ primary: "none", secondary: "none" } : { primary?: string; secondary?: string; } +>primary : string +>"none" : string +>secondary : string +>"none" : string + +} = getMultiRobot(), i = 0; i < 1; i++) { +>getMultiRobot() : MultiRobot +>getMultiRobot : () => MultiRobot +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(primaryA); +>console.log(primaryA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primaryA : string +} +for (let { + skills: { +>skills : any + + primary: primaryA = "primary", +>primary : any +>primaryA : string +>"primary" : string + + secondary: secondaryA = "secondary" +>secondary : any +>secondaryA : string +>"secondary" : string + + } = { primary: "none", secondary: "none" } +>{ primary: "none", secondary: "none" } : { primary?: string; secondary?: string; } +>primary : string +>"none" : string +>secondary : string +>"none" : string + +} = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, +>{ name: "trimmer", skills: { primary: "trimming", secondary: "edging" } } : MultiRobot +>MultiRobot : MultiRobot +>{ name: "trimmer", skills: { primary: "trimming", secondary: "edging" } } : { name: string; skills: { primary: string; secondary: string; }; } +>name : string +>"trimmer" : string +>skills : { primary: string; secondary: string; } +>{ primary: "trimming", secondary: "edging" } : { primary: string; secondary: string; } +>primary : string +>"trimming" : string +>secondary : string +>"edging" : string + + i = 0; i < 1; i++) { +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(primaryA); +>console.log(primaryA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primaryA : string +} + +for (let {name: nameA = "noName", skill: skillA = "skill" } = robot, i = 0; i < 1; i++) { +>name : any +>nameA : string +>"noName" : string +>skill : any +>skillA : string +>"skill" : string +>robot : Robot +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for (let {name: nameA = "noName", skill: skillA = "skill" } = getRobot(), i = 0; i < 1; i++) { +>name : any +>nameA : string +>"noName" : string +>skill : any +>skillA : string +>"skill" : string +>getRobot() : Robot +>getRobot : () => Robot +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for (let {name: nameA = "noName", skill: skillA = "skill" } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { +>name : any +>nameA : string +>"noName" : string +>skill : any +>skillA : string +>"skill" : string +>{ name: "trimmer", skill: "trimming" } : Robot +>Robot : Robot +>{ name: "trimmer", skill: "trimming" } : { name: string; skill: string; } +>name : string +>"trimmer" : string +>skill : string +>"trimming" : string +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for (let { + name: nameA = "noName", +>name : any +>nameA : string +>"noName" : string + + skills: { +>skills : any + + primary: primaryA = "primary", +>primary : any +>primaryA : string +>"primary" : string + + secondary: secondaryA = "secondary" +>secondary : any +>secondaryA : string +>"secondary" : string + + } = { primary: "none", secondary: "none" } +>{ primary: "none", secondary: "none" } : { primary?: string; secondary?: string; } +>primary : string +>"none" : string +>secondary : string +>"none" : string + +} = multiRobot, i = 0; i < 1; i++) { +>multiRobot : MultiRobot +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(primaryA); +>console.log(primaryA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primaryA : string +} +for (let { + name: nameA = "noName", +>name : any +>nameA : string +>"noName" : string + + skills: { +>skills : any + + primary: primaryA = "primary", +>primary : any +>primaryA : string +>"primary" : string + + secondary: secondaryA = "secondary" +>secondary : any +>secondaryA : string +>"secondary" : string + + } = { primary: "none", secondary: "none" } +>{ primary: "none", secondary: "none" } : { primary?: string; secondary?: string; } +>primary : string +>"none" : string +>secondary : string +>"none" : string + +} = getMultiRobot(), i = 0; i < 1; i++) { +>getMultiRobot() : MultiRobot +>getMultiRobot : () => MultiRobot +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(primaryA); +>console.log(primaryA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primaryA : string +} +for (let { + name: nameA = "noName", +>name : any +>nameA : string +>"noName" : string + + skills: { +>skills : any + + primary: primaryA = "primary", +>primary : any +>primaryA : string +>"primary" : string + + secondary: secondaryA = "secondary" +>secondary : any +>secondaryA : string +>"secondary" : string + + } = { primary: "none", secondary: "none" } +>{ primary: "none", secondary: "none" } : { primary?: string; secondary?: string; } +>primary : string +>"none" : string +>secondary : string +>"none" : string + +} = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, +>{ name: "trimmer", skills: { primary: "trimming", secondary: "edging" } } : MultiRobot +>MultiRobot : MultiRobot +>{ name: "trimmer", skills: { primary: "trimming", secondary: "edging" } } : { name: string; skills: { primary: string; secondary: string; }; } +>name : string +>"trimmer" : string +>skills : { primary: string; secondary: string; } +>{ primary: "trimming", secondary: "edging" } : { primary: string; secondary: string; } +>primary : string +>"trimming" : string +>secondary : string +>"edging" : string + + i = 0; i < 1; i++) { +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(primaryA); +>console.log(primaryA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primaryA : string +} diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.js b/tests/baselines/reference/sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.js new file mode 100644 index 00000000000..a360326c1ca --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.js @@ -0,0 +1,265 @@ +//// [sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts] +declare var console: { + log(msg: any): void; +} +interface Robot { + name: string; + skill: string; +} + +interface MultiRobot { + name: string; + skills: { + primary?: string; + secondary?: string; + }; +} + +let robot: Robot = { name: "mower", skill: "mowing" }; +let multiRobot: MultiRobot = { name: "mower", skills: { primary: "mowing", secondary: "none" } }; +function getRobot() { + return robot; +} +function getMultiRobot() { + return multiRobot; +} + +let nameA: string, primaryA: string, secondaryA: string, i: number, skillA: string; +let name: string, primary: string, secondary: string, skill: string; + +for ({name: nameA = "noName" } = robot, i = 0; i < 1; i++) { + console.log(nameA); +} +for ({name: nameA = "noName" } = getRobot(), i = 0; i < 1; i++) { + console.log(nameA); +} +for ({name: nameA = "noName" } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + console.log(nameA); +} +for ({ + skills: { + primary: primaryA = "primary", + secondary: secondaryA = "secondary" + } = { primary: "none", secondary: "none" } +} = multiRobot, i = 0; i < 1; i++) { + console.log(primaryA); +} +for ({ + skills: { + primary: primaryA = "primary", + secondary: secondaryA = "secondary" + } = { primary: "none", secondary: "none" } +} = getMultiRobot(), i = 0; i < 1; i++) { + console.log(primaryA); +} +for ({ + skills: { + primary: primaryA = "primary", + secondary: secondaryA = "secondary" + } = { primary: "none", secondary: "none" } +} = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, + i = 0; i < 1; i++) { + console.log(primaryA); +} + +for ({ name = "noName" } = robot, i = 0; i < 1; i++) { + console.log(nameA); +} +for ({ name = "noName" } = getRobot(), i = 0; i < 1; i++) { + console.log(nameA); +} +for ({ name = "noName" } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + console.log(nameA); +} +for ({ + skills: { + primary = "primary", + secondary = "secondary" + } = { primary: "none", secondary: "none" } +} = multiRobot, i = 0; i < 1; i++) { + console.log(primaryA); +} +for ({ + skills: { + primary = "primary", + secondary = "secondary" + } = { primary: "none", secondary: "none" } +} = getMultiRobot(), i = 0; i < 1; i++) { + console.log(primaryA); +} +for ({ + skills: { + primary = "primary", + secondary = "secondary" + } = { primary: "none", secondary: "none" } +} = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, + i = 0; i < 1; i++) { + console.log(primaryA); +} + + +for ({name: nameA = "noName", skill: skillA = "skill" } = robot, i = 0; i < 1; i++) { + console.log(nameA); +} +for ({name: nameA = "noName", skill: skillA = "skill" } = getRobot(), i = 0; i < 1; i++) { + console.log(nameA); +} +for ({name: nameA = "noName", skill: skillA = "skill" } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + console.log(nameA); +} +for ({ + name: nameA = "noName", + skills: { + primary: primaryA = "primary", + secondary: secondaryA = "secondary" + } = { primary: "none", secondary: "none" } +} = multiRobot, i = 0; i < 1; i++) { + console.log(primaryA); +} +for ({ + name: nameA = "noName", + skills: { + primary: primaryA = "primary", + secondary: secondaryA = "secondary" + } = { primary: "none", secondary: "none" } +} = getMultiRobot(), i = 0; i < 1; i++) { + console.log(primaryA); +} +for ({ + name: nameA = "noName", + skills: { + primary: primaryA = "primary", + secondary: secondaryA = "secondary" + } = { primary: "none", secondary: "none" } +} = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, + i = 0; i < 1; i++) { + console.log(primaryA); +} + +for ({ name = "noName", skill = "skill" } = robot, i = 0; i < 1; i++) { + console.log(nameA); +} +for ({ name = "noName", skill = "skill" } = getRobot(), i = 0; i < 1; i++) { + console.log(nameA); +} +for ({ name = "noName", skill = "skill" } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + console.log(nameA); +} +for ({ + name = "noName", + skills: { + primary = "primary", + secondary = "secondary" + } = { primary: "none", secondary: "none" } +} = multiRobot, i = 0; i < 1; i++) { + console.log(primaryA); +} +for ({ + name = "noName", + skills: { + primary = "primary", + secondary = "secondary" + } = { primary: "none", secondary: "none" } +} = getMultiRobot(), i = 0; i < 1; i++) { + console.log(primaryA); +} +for ({ + name = "noName", + skills: { + primary = "primary", + secondary = "secondary" + } = { primary: "none", secondary: "none" } +} = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, + i = 0; i < 1; i++) { + console.log(primaryA); +} + +//// [sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.js] +var robot = { name: "mower", skill: "mowing" }; +var multiRobot = { name: "mower", skills: { primary: "mowing", secondary: "none" } }; +function getRobot() { + return robot; +} +function getMultiRobot() { + return multiRobot; +} +var nameA, primaryA, secondaryA, i, skillA; +var name, primary, secondary, skill; +for ((_a = robot.name, nameA = _a === void 0 ? "noName" : _a, robot), i = 0; i < 1; i++) { + console.log(nameA); +} +for ((_b = getRobot(), _c = _b.name, nameA = _c === void 0 ? "noName" : _c, _b), i = 0; i < 1; i++) { + console.log(nameA); +} +for ((_d = { name: "trimmer", skill: "trimming" }, _e = _d.name, nameA = _e === void 0 ? "noName" : _e, _d), i = 0; i < 1; i++) { + console.log(nameA); +} +for ((_f = multiRobot.skills, _g = _f === void 0 ? { primary: "none", secondary: "none" } : _f, _h = _g.primary, primaryA = _h === void 0 ? "primary" : _h, _j = _g.secondary, secondaryA = _j === void 0 ? "secondary" : _j, multiRobot), i = 0; i < 1; i++) { + console.log(primaryA); +} +for ((_k = getMultiRobot(), _l = _k.skills, _m = _l === void 0 ? { primary: "none", secondary: "none" } : _l, _o = _m.primary, primaryA = _o === void 0 ? "primary" : _o, _p = _m.secondary, secondaryA = _p === void 0 ? "secondary" : _p, _k), i = 0; i < 1; i++) { + console.log(primaryA); +} +for ((_q = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, _r = _q.skills, _s = _r === void 0 ? { primary: "none", secondary: "none" } : _r, _t = _s.primary, primaryA = _t === void 0 ? "primary" : _t, _u = _s.secondary, secondaryA = _u === void 0 ? "secondary" : _u, _q), + i = 0; i < 1; i++) { + console.log(primaryA); +} +for ((_v = robot.name, name = _v === void 0 ? "noName" : _v, robot), i = 0; i < 1; i++) { + console.log(nameA); +} +for ((_w = getRobot(), _x = _w.name, name = _x === void 0 ? "noName" : _x, _w), i = 0; i < 1; i++) { + console.log(nameA); +} +for ((_y = { name: "trimmer", skill: "trimming" }, _z = _y.name, name = _z === void 0 ? "noName" : _z, _y), i = 0; i < 1; i++) { + console.log(nameA); +} +for ((_0 = multiRobot.skills, _1 = _0 === void 0 ? { primary: "none", secondary: "none" } : _0, _2 = _1.primary, primary = _2 === void 0 ? "primary" : _2, _3 = _1.secondary, secondary = _3 === void 0 ? "secondary" : _3, multiRobot), i = 0; i < 1; i++) { + console.log(primaryA); +} +for ((_4 = getMultiRobot(), _5 = _4.skills, _6 = _5 === void 0 ? { primary: "none", secondary: "none" } : _5, _7 = _6.primary, primary = _7 === void 0 ? "primary" : _7, _8 = _6.secondary, secondary = _8 === void 0 ? "secondary" : _8, _4), i = 0; i < 1; i++) { + console.log(primaryA); +} +for ((_9 = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, _10 = _9.skills, _11 = _10 === void 0 ? { primary: "none", secondary: "none" } : _10, _12 = _11.primary, primary = _12 === void 0 ? "primary" : _12, _13 = _11.secondary, secondary = _13 === void 0 ? "secondary" : _13, _9), + i = 0; i < 1; i++) { + console.log(primaryA); +} +for ((_14 = robot.name, nameA = _14 === void 0 ? "noName" : _14, _15 = robot.skill, skillA = _15 === void 0 ? "skill" : _15, robot), i = 0; i < 1; i++) { + console.log(nameA); +} +for ((_16 = getRobot(), _17 = _16.name, nameA = _17 === void 0 ? "noName" : _17, _18 = _16.skill, skillA = _18 === void 0 ? "skill" : _18, _16), i = 0; i < 1; i++) { + console.log(nameA); +} +for ((_19 = { name: "trimmer", skill: "trimming" }, _20 = _19.name, nameA = _20 === void 0 ? "noName" : _20, _21 = _19.skill, skillA = _21 === void 0 ? "skill" : _21, _19), i = 0; i < 1; i++) { + console.log(nameA); +} +for ((_22 = multiRobot.name, nameA = _22 === void 0 ? "noName" : _22, _23 = multiRobot.skills, _24 = _23 === void 0 ? { primary: "none", secondary: "none" } : _23, _25 = _24.primary, primaryA = _25 === void 0 ? "primary" : _25, _26 = _24.secondary, secondaryA = _26 === void 0 ? "secondary" : _26, multiRobot), i = 0; i < 1; i++) { + console.log(primaryA); +} +for ((_27 = getMultiRobot(), _28 = _27.name, nameA = _28 === void 0 ? "noName" : _28, _29 = _27.skills, _30 = _29 === void 0 ? { primary: "none", secondary: "none" } : _29, _31 = _30.primary, primaryA = _31 === void 0 ? "primary" : _31, _32 = _30.secondary, secondaryA = _32 === void 0 ? "secondary" : _32, _27), i = 0; i < 1; i++) { + console.log(primaryA); +} +for ((_33 = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, _34 = _33.name, nameA = _34 === void 0 ? "noName" : _34, _35 = _33.skills, _36 = _35 === void 0 ? { primary: "none", secondary: "none" } : _35, _37 = _36.primary, primaryA = _37 === void 0 ? "primary" : _37, _38 = _36.secondary, secondaryA = _38 === void 0 ? "secondary" : _38, _33), + i = 0; i < 1; i++) { + console.log(primaryA); +} +for ((_39 = robot.name, name = _39 === void 0 ? "noName" : _39, _40 = robot.skill, skill = _40 === void 0 ? "skill" : _40, robot), i = 0; i < 1; i++) { + console.log(nameA); +} +for ((_41 = getRobot(), _42 = _41.name, name = _42 === void 0 ? "noName" : _42, _43 = _41.skill, skill = _43 === void 0 ? "skill" : _43, _41), i = 0; i < 1; i++) { + console.log(nameA); +} +for ((_44 = { name: "trimmer", skill: "trimming" }, _45 = _44.name, name = _45 === void 0 ? "noName" : _45, _46 = _44.skill, skill = _46 === void 0 ? "skill" : _46, _44), i = 0; i < 1; i++) { + console.log(nameA); +} +for ((_47 = multiRobot.name, name = _47 === void 0 ? "noName" : _47, _48 = multiRobot.skills, _49 = _48 === void 0 ? { primary: "none", secondary: "none" } : _48, _50 = _49.primary, primary = _50 === void 0 ? "primary" : _50, _51 = _49.secondary, secondary = _51 === void 0 ? "secondary" : _51, multiRobot), i = 0; i < 1; i++) { + console.log(primaryA); +} +for ((_52 = getMultiRobot(), _53 = _52.name, name = _53 === void 0 ? "noName" : _53, _54 = _52.skills, _55 = _54 === void 0 ? { primary: "none", secondary: "none" } : _54, _56 = _55.primary, primary = _56 === void 0 ? "primary" : _56, _57 = _55.secondary, secondary = _57 === void 0 ? "secondary" : _57, _52), i = 0; i < 1; i++) { + console.log(primaryA); +} +for ((_58 = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, _59 = _58.name, name = _59 === void 0 ? "noName" : _59, _60 = _58.skills, _61 = _60 === void 0 ? { primary: "none", secondary: "none" } : _60, _62 = _61.primary, primary = _62 === void 0 ? "primary" : _62, _63 = _61.secondary, secondary = _63 === void 0 ? "secondary" : _63, _58), + i = 0; i < 1; i++) { + console.log(primaryA); +} +var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63; +//# sourceMappingURL=sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.js.map b/tests/baselines/reference/sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.js.map new file mode 100644 index 00000000000..448921b9cdc --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.js.map @@ -0,0 +1,2 @@ +//// [sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.js.map] +{"version":3,"file":"sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.js","sourceRoot":"","sources":["sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts"],"names":[],"mappings":"AAgBA,IAAI,KAAK,GAAU,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;AACtD,IAAI,UAAU,GAAe,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,CAAC;AACjG;IACI,MAAM,CAAC,KAAK,CAAC;AACjB,CAAC;AACD;IACI,MAAM,CAAC,UAAU,CAAC;AACtB,CAAC;AAED,IAAI,KAAa,EAAE,QAAgB,EAAE,UAAkB,EAAE,CAAS,EAAE,MAAc,CAAC;AACnF,IAAI,IAAY,EAAE,OAAe,EAAE,SAAiB,EAAE,KAAa,CAAC;AAEpE,GAAG,CAAC,CAAC,CAAC,eAAsB,EAAtB,qCAAsB,EAAK,KAAK,CAAA,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACxD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AACD,GAAG,CAAC,CAAC,CAAA,eAAsC,EAArC,YAAsB,EAAtB,qCAAsB,KAAe,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IAC7D,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AACD,GAAG,CAAC,CAAC,CAAA,2CAAyE,EAAxE,YAAsB,EAAtB,qCAAsB,KAAkD,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IAChG,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AACD,GAAG,CAAC,CAAC,CACD,sBAG0C,EAH1C,gEAG0C,EAFtC,eAA6B,EAA7B,yCAA6B,EAC7B,iBAAmC,EAAnC,6CAAmC,EAEvC,UAAU,CAAA,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IAChC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAC1B,CAAC;AACD,GAAG,CAAC,CAAC,CAAA,oBAKc,EAJf,cAG0C,EAH1C,gEAG0C,EAFtC,eAA6B,EAA7B,yCAA6B,EAC7B,iBAAmC,EAAnC,6CAAmC,KAExB,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACrC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAC1B,CAAC;AACD,GAAG,CAAC,CAAC,CAAA,8EAKoF,EAJrF,cAG0C,EAH1C,gEAG0C,EAFtC,eAA6B,EAA7B,yCAA6B,EAC7B,iBAAmC,EAAnC,6CAAmC,KAE8C;IACrF,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACpB,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAC1B,CAAC;AAED,GAAG,CAAC,CAAC,CAAE,eAAe,EAAf,oCAAe,EAAK,KAAK,CAAA,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IAClD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AACD,GAAG,CAAC,CAAC,CAAA,eAAgC,EAA9B,YAAe,EAAf,oCAAe,KAAe,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACvD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AACD,GAAG,CAAC,CAAC,CAAA,2CAAmE,EAAjE,YAAe,EAAf,oCAAe,KAAkD,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IAC1F,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AACD,GAAG,CAAC,CAAC,CACD,sBAG0C,EAH1C,gEAG0C,EAFtC,eAAmB,EAAnB,wCAAmB,EACnB,iBAAuB,EAAvB,4CAAuB,EAE3B,UAAU,CAAA,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IAChC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAC1B,CAAC;AACD,GAAG,CAAC,CAAC,CAAA,oBAKc,EAJf,cAG0C,EAH1C,gEAG0C,EAFtC,eAAmB,EAAnB,wCAAmB,EACnB,iBAAuB,EAAvB,4CAAuB,KAEZ,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACrC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAC1B,CAAC;AACD,GAAG,CAAC,CAAC,CAAA,8EAKoF,EAJrF,eAG0C,EAH1C,mEAG0C,EAFtC,iBAAmB,EAAnB,0CAAmB,EACnB,mBAAuB,EAAvB,8CAAuB,KAE0D;IACrF,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACpB,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAC1B,CAAC;AAGD,GAAG,CAAC,CAAC,CAAC,gBAAsB,EAAtB,uCAAsB,EAAE,iBAAuB,EAAvB,uCAAuB,EAAK,KAAK,CAAA,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACjF,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AACD,GAAG,CAAC,CAAC,CAAA,gBAA+D,EAA9D,cAAsB,EAAtB,uCAAsB,EAAE,eAAuB,EAAvB,uCAAuB,MAAe,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACtF,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AACD,GAAG,CAAC,CAAC,CAAA,4CAAkG,EAAjG,cAAsB,EAAtB,uCAAsB,EAAE,eAAuB,EAAvB,uCAAuB,MAAkD,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACzH,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AACD,GAAG,CAAC,CAAC,CACD,qBAAsB,EAAtB,uCAAsB,EACtB,uBAG0C,EAH1C,mEAG0C,EAFtC,iBAA6B,EAA7B,2CAA6B,EAC7B,mBAAmC,EAAnC,+CAAmC,EAEvC,UAAU,CAAA,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IAChC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAC1B,CAAC;AACD,GAAG,CAAC,CAAC,CAAA,qBAMc,EALf,cAAsB,EAAtB,uCAAsB,EACtB,gBAG0C,EAH1C,mEAG0C,EAFtC,iBAA6B,EAA7B,2CAA6B,EAC7B,mBAAmC,EAAnC,+CAAmC,MAExB,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACrC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAC1B,CAAC;AACD,GAAG,CAAC,CAAC,CAAA,+EAMoF,EALrF,cAAsB,EAAtB,uCAAsB,EACtB,gBAG0C,EAH1C,mEAG0C,EAFtC,iBAA6B,EAA7B,2CAA6B,EAC7B,mBAAmC,EAAnC,+CAAmC,MAE8C;IACrF,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACpB,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAC1B,CAAC;AAED,GAAG,CAAC,CAAC,CAAE,gBAAe,EAAf,sCAAe,EAAE,iBAAe,EAAf,sCAAe,EAAK,KAAK,CAAA,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACnE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AACD,GAAG,CAAC,CAAC,CAAA,gBAAiD,EAA/C,cAAe,EAAf,sCAAe,EAAE,eAAe,EAAf,sCAAe,MAAe,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACxE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AACD,GAAG,CAAC,CAAC,CAAA,4CAAoF,EAAlF,cAAe,EAAf,sCAAe,EAAE,eAAe,EAAf,sCAAe,MAAkD,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IAC3G,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AACD,GAAG,CAAC,CAAC,CACD,qBAAe,EAAf,sCAAe,EACf,uBAG0C,EAH1C,mEAG0C,EAFtC,iBAAmB,EAAnB,0CAAmB,EACnB,mBAAuB,EAAvB,8CAAuB,EAE3B,UAAU,CAAA,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IAChC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAC1B,CAAC;AACD,GAAG,CAAC,CAAC,CAAA,qBAMc,EALf,cAAe,EAAf,sCAAe,EACf,gBAG0C,EAH1C,mEAG0C,EAFtC,iBAAmB,EAAnB,0CAAmB,EACnB,mBAAuB,EAAvB,8CAAuB,MAEZ,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACrC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAC1B,CAAC;AACD,GAAG,CAAC,CAAC,CAAA,+EAMoF,EALrF,cAAe,EAAf,sCAAe,EACf,gBAG0C,EAH1C,mEAG0C,EAFtC,iBAAmB,EAAnB,0CAAmB,EACnB,mBAAuB,EAAvB,8CAAuB,MAE0D;IACrF,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACpB,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAC1B,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.sourcemap.txt b/tests/baselines/reference/sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.sourcemap.txt new file mode 100644 index 00000000000..3e4d7a87855 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.sourcemap.txt @@ -0,0 +1,3589 @@ +=================================================================== +JsFile: sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.js +mapUrl: sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.js.map +sourceRoot: +sources: sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.js +sourceFile:sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts +------------------------------------------------------------------- +>>>var robot = { name: "mower", skill: "mowing" }; +1 > +2 >^^^^ +3 > ^^^^^ +4 > ^^^ +5 > ^^ +6 > ^^^^ +7 > ^^ +8 > ^^^^^^^ +9 > ^^ +10> ^^^^^ +11> ^^ +12> ^^^^^^^^ +13> ^^ +14> ^ +15> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 >declare var console: { + > log(msg: any): void; + >} + >interface Robot { + > name: string; + > skill: string; + >} + > + >interface MultiRobot { + > name: string; + > skills: { + > primary?: string; + > secondary?: string; + > }; + >} + > + > +2 >let +3 > robot +4 > : Robot = +5 > { +6 > name +7 > : +8 > "mower" +9 > , +10> skill +11> : +12> "mowing" +13> } +14> ; +1 >Emitted(1, 1) Source(17, 1) + SourceIndex(0) +2 >Emitted(1, 5) Source(17, 5) + SourceIndex(0) +3 >Emitted(1, 10) Source(17, 10) + SourceIndex(0) +4 >Emitted(1, 13) Source(17, 20) + SourceIndex(0) +5 >Emitted(1, 15) Source(17, 22) + SourceIndex(0) +6 >Emitted(1, 19) Source(17, 26) + SourceIndex(0) +7 >Emitted(1, 21) Source(17, 28) + SourceIndex(0) +8 >Emitted(1, 28) Source(17, 35) + SourceIndex(0) +9 >Emitted(1, 30) Source(17, 37) + SourceIndex(0) +10>Emitted(1, 35) Source(17, 42) + SourceIndex(0) +11>Emitted(1, 37) Source(17, 44) + SourceIndex(0) +12>Emitted(1, 45) Source(17, 52) + SourceIndex(0) +13>Emitted(1, 47) Source(17, 54) + SourceIndex(0) +14>Emitted(1, 48) Source(17, 55) + SourceIndex(0) +--- +>>>var multiRobot = { name: "mower", skills: { primary: "mowing", secondary: "none" } }; +1-> +2 >^^^^ +3 > ^^^^^^^^^^ +4 > ^^^ +5 > ^^ +6 > ^^^^ +7 > ^^ +8 > ^^^^^^^ +9 > ^^ +10> ^^^^^^ +11> ^^ +12> ^^ +13> ^^^^^^^ +14> ^^ +15> ^^^^^^^^ +16> ^^ +17> ^^^^^^^^^ +18> ^^ +19> ^^^^^^ +20> ^^ +21> ^^ +22> ^ +1-> + > +2 >let +3 > multiRobot +4 > : MultiRobot = +5 > { +6 > name +7 > : +8 > "mower" +9 > , +10> skills +11> : +12> { +13> primary +14> : +15> "mowing" +16> , +17> secondary +18> : +19> "none" +20> } +21> } +22> ; +1->Emitted(2, 1) Source(18, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(18, 5) + SourceIndex(0) +3 >Emitted(2, 15) Source(18, 15) + SourceIndex(0) +4 >Emitted(2, 18) Source(18, 30) + SourceIndex(0) +5 >Emitted(2, 20) Source(18, 32) + SourceIndex(0) +6 >Emitted(2, 24) Source(18, 36) + SourceIndex(0) +7 >Emitted(2, 26) Source(18, 38) + SourceIndex(0) +8 >Emitted(2, 33) Source(18, 45) + SourceIndex(0) +9 >Emitted(2, 35) Source(18, 47) + SourceIndex(0) +10>Emitted(2, 41) Source(18, 53) + SourceIndex(0) +11>Emitted(2, 43) Source(18, 55) + SourceIndex(0) +12>Emitted(2, 45) Source(18, 57) + SourceIndex(0) +13>Emitted(2, 52) Source(18, 64) + SourceIndex(0) +14>Emitted(2, 54) Source(18, 66) + SourceIndex(0) +15>Emitted(2, 62) Source(18, 74) + SourceIndex(0) +16>Emitted(2, 64) Source(18, 76) + SourceIndex(0) +17>Emitted(2, 73) Source(18, 85) + SourceIndex(0) +18>Emitted(2, 75) Source(18, 87) + SourceIndex(0) +19>Emitted(2, 81) Source(18, 93) + SourceIndex(0) +20>Emitted(2, 83) Source(18, 95) + SourceIndex(0) +21>Emitted(2, 85) Source(18, 97) + SourceIndex(0) +22>Emitted(2, 86) Source(18, 98) + SourceIndex(0) +--- +>>>function getRobot() { +1 > +2 >^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(3, 1) Source(19, 1) + SourceIndex(0) +--- +>>> return robot; +1->^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^ +5 > ^ +1->function getRobot() { + > +2 > return +3 > +4 > robot +5 > ; +1->Emitted(4, 5) Source(20, 5) + SourceIndex(0) +2 >Emitted(4, 11) Source(20, 11) + SourceIndex(0) +3 >Emitted(4, 12) Source(20, 12) + SourceIndex(0) +4 >Emitted(4, 17) Source(20, 17) + SourceIndex(0) +5 >Emitted(4, 18) Source(20, 18) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(5, 1) Source(21, 1) + SourceIndex(0) +2 >Emitted(5, 2) Source(21, 2) + SourceIndex(0) +--- +>>>function getMultiRobot() { +1-> +2 >^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(6, 1) Source(22, 1) + SourceIndex(0) +--- +>>> return multiRobot; +1->^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^ +5 > ^ +1->function getMultiRobot() { + > +2 > return +3 > +4 > multiRobot +5 > ; +1->Emitted(7, 5) Source(23, 5) + SourceIndex(0) +2 >Emitted(7, 11) Source(23, 11) + SourceIndex(0) +3 >Emitted(7, 12) Source(23, 12) + SourceIndex(0) +4 >Emitted(7, 22) Source(23, 22) + SourceIndex(0) +5 >Emitted(7, 23) Source(23, 23) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(8, 1) Source(24, 1) + SourceIndex(0) +2 >Emitted(8, 2) Source(24, 2) + SourceIndex(0) +--- +>>>var nameA, primaryA, secondaryA, i, skillA; +1-> +2 >^^^^ +3 > ^^^^^ +4 > ^^ +5 > ^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^ +8 > ^^ +9 > ^ +10> ^^ +11> ^^^^^^ +12> ^ +1-> + > + > +2 >let +3 > nameA: string +4 > , +5 > primaryA: string +6 > , +7 > secondaryA: string +8 > , +9 > i: number +10> , +11> skillA: string +12> ; +1->Emitted(9, 1) Source(26, 1) + SourceIndex(0) +2 >Emitted(9, 5) Source(26, 5) + SourceIndex(0) +3 >Emitted(9, 10) Source(26, 18) + SourceIndex(0) +4 >Emitted(9, 12) Source(26, 20) + SourceIndex(0) +5 >Emitted(9, 20) Source(26, 36) + SourceIndex(0) +6 >Emitted(9, 22) Source(26, 38) + SourceIndex(0) +7 >Emitted(9, 32) Source(26, 56) + SourceIndex(0) +8 >Emitted(9, 34) Source(26, 58) + SourceIndex(0) +9 >Emitted(9, 35) Source(26, 67) + SourceIndex(0) +10>Emitted(9, 37) Source(26, 69) + SourceIndex(0) +11>Emitted(9, 43) Source(26, 83) + SourceIndex(0) +12>Emitted(9, 44) Source(26, 84) + SourceIndex(0) +--- +>>>var name, primary, secondary, skill; +1 > +2 >^^^^ +3 > ^^^^ +4 > ^^ +5 > ^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^ +8 > ^^ +9 > ^^^^^ +10> ^ +11> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >let +3 > name: string +4 > , +5 > primary: string +6 > , +7 > secondary: string +8 > , +9 > skill: string +10> ; +1 >Emitted(10, 1) Source(27, 1) + SourceIndex(0) +2 >Emitted(10, 5) Source(27, 5) + SourceIndex(0) +3 >Emitted(10, 9) Source(27, 17) + SourceIndex(0) +4 >Emitted(10, 11) Source(27, 19) + SourceIndex(0) +5 >Emitted(10, 18) Source(27, 34) + SourceIndex(0) +6 >Emitted(10, 20) Source(27, 36) + SourceIndex(0) +7 >Emitted(10, 29) Source(27, 53) + SourceIndex(0) +8 >Emitted(10, 31) Source(27, 55) + SourceIndex(0) +9 >Emitted(10, 36) Source(27, 68) + SourceIndex(0) +10>Emitted(10, 37) Source(27, 69) + SourceIndex(0) +--- +>>>for ((_a = robot.name, nameA = _a === void 0 ? "noName" : _a, robot), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^ +11> ^ +12> ^^ +13> ^ +14> ^^^ +15> ^ +16> ^^ +17> ^ +18> ^^^ +19> ^ +20> ^^ +21> ^ +22> ^^ +23> ^^ +24> ^ +1-> + > + > +2 >for +3 > +4 > ( +5 > { +6 > name: nameA = "noName" +7 > +8 > name: nameA = "noName" +9 > } = +10> robot +11> +12> , +13> i +14> = +15> 0 +16> ; +17> i +18> < +19> 1 +20> ; +21> i +22> ++ +23> ) +24> { +1->Emitted(11, 1) Source(29, 1) + SourceIndex(0) +2 >Emitted(11, 4) Source(29, 4) + SourceIndex(0) +3 >Emitted(11, 5) Source(29, 5) + SourceIndex(0) +4 >Emitted(11, 6) Source(29, 6) + SourceIndex(0) +5 >Emitted(11, 7) Source(29, 7) + SourceIndex(0) +6 >Emitted(11, 22) Source(29, 29) + SourceIndex(0) +7 >Emitted(11, 24) Source(29, 7) + SourceIndex(0) +8 >Emitted(11, 61) Source(29, 29) + SourceIndex(0) +9 >Emitted(11, 63) Source(29, 34) + SourceIndex(0) +10>Emitted(11, 68) Source(29, 39) + SourceIndex(0) +11>Emitted(11, 69) Source(29, 39) + SourceIndex(0) +12>Emitted(11, 71) Source(29, 41) + SourceIndex(0) +13>Emitted(11, 72) Source(29, 42) + SourceIndex(0) +14>Emitted(11, 75) Source(29, 45) + SourceIndex(0) +15>Emitted(11, 76) Source(29, 46) + SourceIndex(0) +16>Emitted(11, 78) Source(29, 48) + SourceIndex(0) +17>Emitted(11, 79) Source(29, 49) + SourceIndex(0) +18>Emitted(11, 82) Source(29, 52) + SourceIndex(0) +19>Emitted(11, 83) Source(29, 53) + SourceIndex(0) +20>Emitted(11, 85) Source(29, 55) + SourceIndex(0) +21>Emitted(11, 86) Source(29, 56) + SourceIndex(0) +22>Emitted(11, 88) Source(29, 58) + SourceIndex(0) +23>Emitted(11, 90) Source(29, 60) + SourceIndex(0) +24>Emitted(11, 91) Source(29, 61) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(12, 5) Source(30, 5) + SourceIndex(0) +2 >Emitted(12, 12) Source(30, 12) + SourceIndex(0) +3 >Emitted(12, 13) Source(30, 13) + SourceIndex(0) +4 >Emitted(12, 16) Source(30, 16) + SourceIndex(0) +5 >Emitted(12, 17) Source(30, 17) + SourceIndex(0) +6 >Emitted(12, 22) Source(30, 22) + SourceIndex(0) +7 >Emitted(12, 23) Source(30, 23) + SourceIndex(0) +8 >Emitted(12, 24) Source(30, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(13, 1) Source(31, 1) + SourceIndex(0) +2 >Emitted(13, 2) Source(31, 2) + SourceIndex(0) +--- +>>>for ((_b = getRobot(), _c = _b.name, nameA = _c === void 0 ? "noName" : _c, _b), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^^^^ +12> ^^ +13> ^ +14> ^^^ +15> ^ +16> ^^ +17> ^ +18> ^^^ +19> ^ +20> ^^ +21> ^ +22> ^^ +23> ^^ +24> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > {name: nameA = "noName" } = getRobot() +7 > +8 > name: nameA = "noName" +9 > +10> name: nameA = "noName" +11> } = getRobot() +12> , +13> i +14> = +15> 0 +16> ; +17> i +18> < +19> 1 +20> ; +21> i +22> ++ +23> ) +24> { +1->Emitted(14, 1) Source(32, 1) + SourceIndex(0) +2 >Emitted(14, 4) Source(32, 4) + SourceIndex(0) +3 >Emitted(14, 5) Source(32, 5) + SourceIndex(0) +4 >Emitted(14, 6) Source(32, 6) + SourceIndex(0) +5 >Emitted(14, 7) Source(32, 6) + SourceIndex(0) +6 >Emitted(14, 22) Source(32, 44) + SourceIndex(0) +7 >Emitted(14, 24) Source(32, 7) + SourceIndex(0) +8 >Emitted(14, 36) Source(32, 29) + SourceIndex(0) +9 >Emitted(14, 38) Source(32, 7) + SourceIndex(0) +10>Emitted(14, 75) Source(32, 29) + SourceIndex(0) +11>Emitted(14, 80) Source(32, 44) + SourceIndex(0) +12>Emitted(14, 82) Source(32, 46) + SourceIndex(0) +13>Emitted(14, 83) Source(32, 47) + SourceIndex(0) +14>Emitted(14, 86) Source(32, 50) + SourceIndex(0) +15>Emitted(14, 87) Source(32, 51) + SourceIndex(0) +16>Emitted(14, 89) Source(32, 53) + SourceIndex(0) +17>Emitted(14, 90) Source(32, 54) + SourceIndex(0) +18>Emitted(14, 93) Source(32, 57) + SourceIndex(0) +19>Emitted(14, 94) Source(32, 58) + SourceIndex(0) +20>Emitted(14, 96) Source(32, 60) + SourceIndex(0) +21>Emitted(14, 97) Source(32, 61) + SourceIndex(0) +22>Emitted(14, 99) Source(32, 63) + SourceIndex(0) +23>Emitted(14, 101) Source(32, 65) + SourceIndex(0) +24>Emitted(14, 102) Source(32, 66) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(15, 5) Source(33, 5) + SourceIndex(0) +2 >Emitted(15, 12) Source(33, 12) + SourceIndex(0) +3 >Emitted(15, 13) Source(33, 13) + SourceIndex(0) +4 >Emitted(15, 16) Source(33, 16) + SourceIndex(0) +5 >Emitted(15, 17) Source(33, 17) + SourceIndex(0) +6 >Emitted(15, 22) Source(33, 22) + SourceIndex(0) +7 >Emitted(15, 23) Source(33, 23) + SourceIndex(0) +8 >Emitted(15, 24) Source(33, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(16, 1) Source(34, 1) + SourceIndex(0) +2 >Emitted(16, 2) Source(34, 2) + SourceIndex(0) +--- +>>>for ((_d = { name: "trimmer", skill: "trimming" }, _e = _d.name, nameA = _e === void 0 ? "noName" : _e, _d), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^^^^ +12> ^^ +13> ^ +14> ^^^ +15> ^ +16> ^^ +17> ^ +18> ^^^ +19> ^ +20> ^^ +21> ^ +22> ^^ +23> ^^ +24> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > {name: nameA = "noName" } = { name: "trimmer", skill: "trimming" } +7 > +8 > name: nameA = "noName" +9 > +10> name: nameA = "noName" +11> } = { name: "trimmer", skill: "trimming" } +12> , +13> i +14> = +15> 0 +16> ; +17> i +18> < +19> 1 +20> ; +21> i +22> ++ +23> ) +24> { +1->Emitted(17, 1) Source(35, 1) + SourceIndex(0) +2 >Emitted(17, 4) Source(35, 4) + SourceIndex(0) +3 >Emitted(17, 5) Source(35, 5) + SourceIndex(0) +4 >Emitted(17, 6) Source(35, 6) + SourceIndex(0) +5 >Emitted(17, 7) Source(35, 6) + SourceIndex(0) +6 >Emitted(17, 50) Source(35, 79) + SourceIndex(0) +7 >Emitted(17, 52) Source(35, 7) + SourceIndex(0) +8 >Emitted(17, 64) Source(35, 29) + SourceIndex(0) +9 >Emitted(17, 66) Source(35, 7) + SourceIndex(0) +10>Emitted(17, 103) Source(35, 29) + SourceIndex(0) +11>Emitted(17, 108) Source(35, 79) + SourceIndex(0) +12>Emitted(17, 110) Source(35, 81) + SourceIndex(0) +13>Emitted(17, 111) Source(35, 82) + SourceIndex(0) +14>Emitted(17, 114) Source(35, 85) + SourceIndex(0) +15>Emitted(17, 115) Source(35, 86) + SourceIndex(0) +16>Emitted(17, 117) Source(35, 88) + SourceIndex(0) +17>Emitted(17, 118) Source(35, 89) + SourceIndex(0) +18>Emitted(17, 121) Source(35, 92) + SourceIndex(0) +19>Emitted(17, 122) Source(35, 93) + SourceIndex(0) +20>Emitted(17, 124) Source(35, 95) + SourceIndex(0) +21>Emitted(17, 125) Source(35, 96) + SourceIndex(0) +22>Emitted(17, 127) Source(35, 98) + SourceIndex(0) +23>Emitted(17, 129) Source(35, 100) + SourceIndex(0) +24>Emitted(17, 130) Source(35, 101) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(18, 5) Source(36, 5) + SourceIndex(0) +2 >Emitted(18, 12) Source(36, 12) + SourceIndex(0) +3 >Emitted(18, 13) Source(36, 13) + SourceIndex(0) +4 >Emitted(18, 16) Source(36, 16) + SourceIndex(0) +5 >Emitted(18, 17) Source(36, 17) + SourceIndex(0) +6 >Emitted(18, 22) Source(36, 22) + SourceIndex(0) +7 >Emitted(18, 23) Source(36, 23) + SourceIndex(0) +8 >Emitted(18, 24) Source(36, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(19, 1) Source(37, 1) + SourceIndex(0) +2 >Emitted(19, 2) Source(37, 2) + SourceIndex(0) +--- +>>>for ((_f = multiRobot.skills, _g = _f === void 0 ? { primary: "none", secondary: "none" } : _f, _h = _g.primary, primaryA = _h === void 0 ? "primary" : _h, _j = _g.secondary, secondaryA = _j === void 0 ? "secondary" : _j, multiRobot), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^^^^ +15> ^^ +16> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +17> ^^ +18> ^^^^^^^^^^ +19> ^ +20> ^^ +21> ^ +22> ^^^ +23> ^ +24> ^^ +25> ^ +26> ^^^ +27> ^ +28> ^^ +29> ^ +30> ^^ +31> ^^ +32> ^ +1-> + > +2 >for +3 > +4 > ( +5 > { + > +6 > skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "none", secondary: "none" } +7 > +8 > skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "none", secondary: "none" } +9 > +10> primary: primaryA = "primary" +11> +12> primary: primaryA = "primary" +13> , + > +14> secondary: secondaryA = "secondary" +15> +16> secondary: secondaryA = "secondary" +17> + > } = { primary: "none", secondary: "none" } + > } = +18> multiRobot +19> +20> , +21> i +22> = +23> 0 +24> ; +25> i +26> < +27> 1 +28> ; +29> i +30> ++ +31> ) +32> { +1->Emitted(20, 1) Source(38, 1) + SourceIndex(0) +2 >Emitted(20, 4) Source(38, 4) + SourceIndex(0) +3 >Emitted(20, 5) Source(38, 5) + SourceIndex(0) +4 >Emitted(20, 6) Source(38, 6) + SourceIndex(0) +5 >Emitted(20, 7) Source(39, 5) + SourceIndex(0) +6 >Emitted(20, 29) Source(42, 47) + SourceIndex(0) +7 >Emitted(20, 31) Source(39, 5) + SourceIndex(0) +8 >Emitted(20, 95) Source(42, 47) + SourceIndex(0) +9 >Emitted(20, 97) Source(40, 9) + SourceIndex(0) +10>Emitted(20, 112) Source(40, 38) + SourceIndex(0) +11>Emitted(20, 114) Source(40, 9) + SourceIndex(0) +12>Emitted(20, 155) Source(40, 38) + SourceIndex(0) +13>Emitted(20, 157) Source(41, 9) + SourceIndex(0) +14>Emitted(20, 174) Source(41, 44) + SourceIndex(0) +15>Emitted(20, 176) Source(41, 9) + SourceIndex(0) +16>Emitted(20, 221) Source(41, 44) + SourceIndex(0) +17>Emitted(20, 223) Source(43, 5) + SourceIndex(0) +18>Emitted(20, 233) Source(43, 15) + SourceIndex(0) +19>Emitted(20, 234) Source(43, 15) + SourceIndex(0) +20>Emitted(20, 236) Source(43, 17) + SourceIndex(0) +21>Emitted(20, 237) Source(43, 18) + SourceIndex(0) +22>Emitted(20, 240) Source(43, 21) + SourceIndex(0) +23>Emitted(20, 241) Source(43, 22) + SourceIndex(0) +24>Emitted(20, 243) Source(43, 24) + SourceIndex(0) +25>Emitted(20, 244) Source(43, 25) + SourceIndex(0) +26>Emitted(20, 247) Source(43, 28) + SourceIndex(0) +27>Emitted(20, 248) Source(43, 29) + SourceIndex(0) +28>Emitted(20, 250) Source(43, 31) + SourceIndex(0) +29>Emitted(20, 251) Source(43, 32) + SourceIndex(0) +30>Emitted(20, 253) Source(43, 34) + SourceIndex(0) +31>Emitted(20, 255) Source(43, 36) + SourceIndex(0) +32>Emitted(20, 256) Source(43, 37) + SourceIndex(0) +--- +>>> console.log(primaryA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > primaryA +7 > ) +8 > ; +1 >Emitted(21, 5) Source(44, 5) + SourceIndex(0) +2 >Emitted(21, 12) Source(44, 12) + SourceIndex(0) +3 >Emitted(21, 13) Source(44, 13) + SourceIndex(0) +4 >Emitted(21, 16) Source(44, 16) + SourceIndex(0) +5 >Emitted(21, 17) Source(44, 17) + SourceIndex(0) +6 >Emitted(21, 25) Source(44, 25) + SourceIndex(0) +7 >Emitted(21, 26) Source(44, 26) + SourceIndex(0) +8 >Emitted(21, 27) Source(44, 27) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(22, 1) Source(45, 1) + SourceIndex(0) +2 >Emitted(22, 2) Source(45, 2) + SourceIndex(0) +--- +>>>for ((_k = getMultiRobot(), _l = _k.skills, _m = _l === void 0 ? { primary: "none", secondary: "none" } : _l, _o = _m.primary, primaryA = _o === void 0 ? "primary" : _o, _p = _m.secondary, secondaryA = _p === void 0 ? "secondary" : _p, _k), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +15> ^^ +16> ^^^^^^^^^^^^^^^^^ +17> ^^ +18> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +19> ^^^^^ +20> ^^ +21> ^ +22> ^^^ +23> ^ +24> ^^ +25> ^ +26> ^^^ +27> ^ +28> ^^ +29> ^ +30> ^^ +31> ^^ +32> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > { + > skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "none", secondary: "none" } + > } = getMultiRobot() +7 > +8 > skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "none", secondary: "none" } +9 > +10> skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "none", secondary: "none" } +11> +12> primary: primaryA = "primary" +13> +14> primary: primaryA = "primary" +15> , + > +16> secondary: secondaryA = "secondary" +17> +18> secondary: secondaryA = "secondary" +19> + > } = { primary: "none", secondary: "none" } + > } = getMultiRobot() +20> , +21> i +22> = +23> 0 +24> ; +25> i +26> < +27> 1 +28> ; +29> i +30> ++ +31> ) +32> { +1->Emitted(23, 1) Source(46, 1) + SourceIndex(0) +2 >Emitted(23, 4) Source(46, 4) + SourceIndex(0) +3 >Emitted(23, 5) Source(46, 5) + SourceIndex(0) +4 >Emitted(23, 6) Source(46, 6) + SourceIndex(0) +5 >Emitted(23, 7) Source(46, 6) + SourceIndex(0) +6 >Emitted(23, 27) Source(51, 20) + SourceIndex(0) +7 >Emitted(23, 29) Source(47, 5) + SourceIndex(0) +8 >Emitted(23, 43) Source(50, 47) + SourceIndex(0) +9 >Emitted(23, 45) Source(47, 5) + SourceIndex(0) +10>Emitted(23, 109) Source(50, 47) + SourceIndex(0) +11>Emitted(23, 111) Source(48, 9) + SourceIndex(0) +12>Emitted(23, 126) Source(48, 38) + SourceIndex(0) +13>Emitted(23, 128) Source(48, 9) + SourceIndex(0) +14>Emitted(23, 169) Source(48, 38) + SourceIndex(0) +15>Emitted(23, 171) Source(49, 9) + SourceIndex(0) +16>Emitted(23, 188) Source(49, 44) + SourceIndex(0) +17>Emitted(23, 190) Source(49, 9) + SourceIndex(0) +18>Emitted(23, 235) Source(49, 44) + SourceIndex(0) +19>Emitted(23, 240) Source(51, 20) + SourceIndex(0) +20>Emitted(23, 242) Source(51, 22) + SourceIndex(0) +21>Emitted(23, 243) Source(51, 23) + SourceIndex(0) +22>Emitted(23, 246) Source(51, 26) + SourceIndex(0) +23>Emitted(23, 247) Source(51, 27) + SourceIndex(0) +24>Emitted(23, 249) Source(51, 29) + SourceIndex(0) +25>Emitted(23, 250) Source(51, 30) + SourceIndex(0) +26>Emitted(23, 253) Source(51, 33) + SourceIndex(0) +27>Emitted(23, 254) Source(51, 34) + SourceIndex(0) +28>Emitted(23, 256) Source(51, 36) + SourceIndex(0) +29>Emitted(23, 257) Source(51, 37) + SourceIndex(0) +30>Emitted(23, 259) Source(51, 39) + SourceIndex(0) +31>Emitted(23, 261) Source(51, 41) + SourceIndex(0) +32>Emitted(23, 262) Source(51, 42) + SourceIndex(0) +--- +>>> console.log(primaryA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > primaryA +7 > ) +8 > ; +1 >Emitted(24, 5) Source(52, 5) + SourceIndex(0) +2 >Emitted(24, 12) Source(52, 12) + SourceIndex(0) +3 >Emitted(24, 13) Source(52, 13) + SourceIndex(0) +4 >Emitted(24, 16) Source(52, 16) + SourceIndex(0) +5 >Emitted(24, 17) Source(52, 17) + SourceIndex(0) +6 >Emitted(24, 25) Source(52, 25) + SourceIndex(0) +7 >Emitted(24, 26) Source(52, 26) + SourceIndex(0) +8 >Emitted(24, 27) Source(52, 27) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(25, 1) Source(53, 1) + SourceIndex(0) +2 >Emitted(25, 2) Source(53, 2) + SourceIndex(0) +--- +>>>for ((_q = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, _r = _q.skills, _s = _r === void 0 ? { primary: "none", secondary: "none" } : _r, _t = _s.primary, primaryA = _t === void 0 ? "primary" : _t, _u = _s.secondary, secondaryA = _u === void 0 ? "secondary" : _u, _q), +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +15> ^^ +16> ^^^^^^^^^^^^^^^^^ +17> ^^ +18> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +19> ^^^^^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > { + > skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "none", secondary: "none" } + > } = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } } +7 > +8 > skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "none", secondary: "none" } +9 > +10> skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "none", secondary: "none" } +11> +12> primary: primaryA = "primary" +13> +14> primary: primaryA = "primary" +15> , + > +16> secondary: secondaryA = "secondary" +17> +18> secondary: secondaryA = "secondary" +19> + > } = { primary: "none", secondary: "none" } + > } = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } } +1->Emitted(26, 1) Source(54, 1) + SourceIndex(0) +2 >Emitted(26, 4) Source(54, 4) + SourceIndex(0) +3 >Emitted(26, 5) Source(54, 5) + SourceIndex(0) +4 >Emitted(26, 6) Source(54, 6) + SourceIndex(0) +5 >Emitted(26, 7) Source(54, 6) + SourceIndex(0) +6 >Emitted(26, 85) Source(59, 90) + SourceIndex(0) +7 >Emitted(26, 87) Source(55, 5) + SourceIndex(0) +8 >Emitted(26, 101) Source(58, 47) + SourceIndex(0) +9 >Emitted(26, 103) Source(55, 5) + SourceIndex(0) +10>Emitted(26, 167) Source(58, 47) + SourceIndex(0) +11>Emitted(26, 169) Source(56, 9) + SourceIndex(0) +12>Emitted(26, 184) Source(56, 38) + SourceIndex(0) +13>Emitted(26, 186) Source(56, 9) + SourceIndex(0) +14>Emitted(26, 227) Source(56, 38) + SourceIndex(0) +15>Emitted(26, 229) Source(57, 9) + SourceIndex(0) +16>Emitted(26, 246) Source(57, 44) + SourceIndex(0) +17>Emitted(26, 248) Source(57, 9) + SourceIndex(0) +18>Emitted(26, 293) Source(57, 44) + SourceIndex(0) +19>Emitted(26, 298) Source(59, 90) + SourceIndex(0) +--- +>>> i = 0; i < 1; i++) { +1 >^^^^ +2 > ^ +3 > ^^^ +4 > ^ +5 > ^^ +6 > ^ +7 > ^^^ +8 > ^ +9 > ^^ +10> ^ +11> ^^ +12> ^^ +13> ^ +14> ^^^-> +1 >, + > +2 > i +3 > = +4 > 0 +5 > ; +6 > i +7 > < +8 > 1 +9 > ; +10> i +11> ++ +12> ) +13> { +1 >Emitted(27, 5) Source(60, 5) + SourceIndex(0) +2 >Emitted(27, 6) Source(60, 6) + SourceIndex(0) +3 >Emitted(27, 9) Source(60, 9) + SourceIndex(0) +4 >Emitted(27, 10) Source(60, 10) + SourceIndex(0) +5 >Emitted(27, 12) Source(60, 12) + SourceIndex(0) +6 >Emitted(27, 13) Source(60, 13) + SourceIndex(0) +7 >Emitted(27, 16) Source(60, 16) + SourceIndex(0) +8 >Emitted(27, 17) Source(60, 17) + SourceIndex(0) +9 >Emitted(27, 19) Source(60, 19) + SourceIndex(0) +10>Emitted(27, 20) Source(60, 20) + SourceIndex(0) +11>Emitted(27, 22) Source(60, 22) + SourceIndex(0) +12>Emitted(27, 24) Source(60, 24) + SourceIndex(0) +13>Emitted(27, 25) Source(60, 25) + SourceIndex(0) +--- +>>> console.log(primaryA); +1->^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1-> + > +2 > console +3 > . +4 > log +5 > ( +6 > primaryA +7 > ) +8 > ; +1->Emitted(28, 5) Source(61, 5) + SourceIndex(0) +2 >Emitted(28, 12) Source(61, 12) + SourceIndex(0) +3 >Emitted(28, 13) Source(61, 13) + SourceIndex(0) +4 >Emitted(28, 16) Source(61, 16) + SourceIndex(0) +5 >Emitted(28, 17) Source(61, 17) + SourceIndex(0) +6 >Emitted(28, 25) Source(61, 25) + SourceIndex(0) +7 >Emitted(28, 26) Source(61, 26) + SourceIndex(0) +8 >Emitted(28, 27) Source(61, 27) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(29, 1) Source(62, 1) + SourceIndex(0) +2 >Emitted(29, 2) Source(62, 2) + SourceIndex(0) +--- +>>>for ((_v = robot.name, name = _v === void 0 ? "noName" : _v, robot), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^ +11> ^ +12> ^^ +13> ^ +14> ^^^ +15> ^ +16> ^^ +17> ^ +18> ^^^ +19> ^ +20> ^^ +21> ^ +22> ^^ +23> ^^ +24> ^ +1-> + > + > +2 >for +3 > +4 > ( +5 > { +6 > name = "noName" +7 > +8 > name = "noName" +9 > } = +10> robot +11> +12> , +13> i +14> = +15> 0 +16> ; +17> i +18> < +19> 1 +20> ; +21> i +22> ++ +23> ) +24> { +1->Emitted(30, 1) Source(64, 1) + SourceIndex(0) +2 >Emitted(30, 4) Source(64, 4) + SourceIndex(0) +3 >Emitted(30, 5) Source(64, 5) + SourceIndex(0) +4 >Emitted(30, 6) Source(64, 6) + SourceIndex(0) +5 >Emitted(30, 7) Source(64, 8) + SourceIndex(0) +6 >Emitted(30, 22) Source(64, 23) + SourceIndex(0) +7 >Emitted(30, 24) Source(64, 8) + SourceIndex(0) +8 >Emitted(30, 60) Source(64, 23) + SourceIndex(0) +9 >Emitted(30, 62) Source(64, 28) + SourceIndex(0) +10>Emitted(30, 67) Source(64, 33) + SourceIndex(0) +11>Emitted(30, 68) Source(64, 33) + SourceIndex(0) +12>Emitted(30, 70) Source(64, 35) + SourceIndex(0) +13>Emitted(30, 71) Source(64, 36) + SourceIndex(0) +14>Emitted(30, 74) Source(64, 39) + SourceIndex(0) +15>Emitted(30, 75) Source(64, 40) + SourceIndex(0) +16>Emitted(30, 77) Source(64, 42) + SourceIndex(0) +17>Emitted(30, 78) Source(64, 43) + SourceIndex(0) +18>Emitted(30, 81) Source(64, 46) + SourceIndex(0) +19>Emitted(30, 82) Source(64, 47) + SourceIndex(0) +20>Emitted(30, 84) Source(64, 49) + SourceIndex(0) +21>Emitted(30, 85) Source(64, 50) + SourceIndex(0) +22>Emitted(30, 87) Source(64, 52) + SourceIndex(0) +23>Emitted(30, 89) Source(64, 54) + SourceIndex(0) +24>Emitted(30, 90) Source(64, 55) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(31, 5) Source(65, 5) + SourceIndex(0) +2 >Emitted(31, 12) Source(65, 12) + SourceIndex(0) +3 >Emitted(31, 13) Source(65, 13) + SourceIndex(0) +4 >Emitted(31, 16) Source(65, 16) + SourceIndex(0) +5 >Emitted(31, 17) Source(65, 17) + SourceIndex(0) +6 >Emitted(31, 22) Source(65, 22) + SourceIndex(0) +7 >Emitted(31, 23) Source(65, 23) + SourceIndex(0) +8 >Emitted(31, 24) Source(65, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(32, 1) Source(66, 1) + SourceIndex(0) +2 >Emitted(32, 2) Source(66, 2) + SourceIndex(0) +--- +>>>for ((_w = getRobot(), _x = _w.name, name = _x === void 0 ? "noName" : _x, _w), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^^^^ +12> ^^ +13> ^ +14> ^^^ +15> ^ +16> ^^ +17> ^ +18> ^^^ +19> ^ +20> ^^ +21> ^ +22> ^^ +23> ^^ +24> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > { name = "noName" } = getRobot() +7 > +8 > name = "noName" +9 > +10> name = "noName" +11> } = getRobot() +12> , +13> i +14> = +15> 0 +16> ; +17> i +18> < +19> 1 +20> ; +21> i +22> ++ +23> ) +24> { +1->Emitted(33, 1) Source(67, 1) + SourceIndex(0) +2 >Emitted(33, 4) Source(67, 4) + SourceIndex(0) +3 >Emitted(33, 5) Source(67, 5) + SourceIndex(0) +4 >Emitted(33, 6) Source(67, 6) + SourceIndex(0) +5 >Emitted(33, 7) Source(67, 6) + SourceIndex(0) +6 >Emitted(33, 22) Source(67, 38) + SourceIndex(0) +7 >Emitted(33, 24) Source(67, 8) + SourceIndex(0) +8 >Emitted(33, 36) Source(67, 23) + SourceIndex(0) +9 >Emitted(33, 38) Source(67, 8) + SourceIndex(0) +10>Emitted(33, 74) Source(67, 23) + SourceIndex(0) +11>Emitted(33, 79) Source(67, 38) + SourceIndex(0) +12>Emitted(33, 81) Source(67, 40) + SourceIndex(0) +13>Emitted(33, 82) Source(67, 41) + SourceIndex(0) +14>Emitted(33, 85) Source(67, 44) + SourceIndex(0) +15>Emitted(33, 86) Source(67, 45) + SourceIndex(0) +16>Emitted(33, 88) Source(67, 47) + SourceIndex(0) +17>Emitted(33, 89) Source(67, 48) + SourceIndex(0) +18>Emitted(33, 92) Source(67, 51) + SourceIndex(0) +19>Emitted(33, 93) Source(67, 52) + SourceIndex(0) +20>Emitted(33, 95) Source(67, 54) + SourceIndex(0) +21>Emitted(33, 96) Source(67, 55) + SourceIndex(0) +22>Emitted(33, 98) Source(67, 57) + SourceIndex(0) +23>Emitted(33, 100) Source(67, 59) + SourceIndex(0) +24>Emitted(33, 101) Source(67, 60) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(34, 5) Source(68, 5) + SourceIndex(0) +2 >Emitted(34, 12) Source(68, 12) + SourceIndex(0) +3 >Emitted(34, 13) Source(68, 13) + SourceIndex(0) +4 >Emitted(34, 16) Source(68, 16) + SourceIndex(0) +5 >Emitted(34, 17) Source(68, 17) + SourceIndex(0) +6 >Emitted(34, 22) Source(68, 22) + SourceIndex(0) +7 >Emitted(34, 23) Source(68, 23) + SourceIndex(0) +8 >Emitted(34, 24) Source(68, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(35, 1) Source(69, 1) + SourceIndex(0) +2 >Emitted(35, 2) Source(69, 2) + SourceIndex(0) +--- +>>>for ((_y = { name: "trimmer", skill: "trimming" }, _z = _y.name, name = _z === void 0 ? "noName" : _z, _y), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^^^^ +12> ^^ +13> ^ +14> ^^^ +15> ^ +16> ^^ +17> ^ +18> ^^^ +19> ^ +20> ^^ +21> ^ +22> ^^ +23> ^^ +24> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > { name = "noName" } = { name: "trimmer", skill: "trimming" } +7 > +8 > name = "noName" +9 > +10> name = "noName" +11> } = { name: "trimmer", skill: "trimming" } +12> , +13> i +14> = +15> 0 +16> ; +17> i +18> < +19> 1 +20> ; +21> i +22> ++ +23> ) +24> { +1->Emitted(36, 1) Source(70, 1) + SourceIndex(0) +2 >Emitted(36, 4) Source(70, 4) + SourceIndex(0) +3 >Emitted(36, 5) Source(70, 5) + SourceIndex(0) +4 >Emitted(36, 6) Source(70, 6) + SourceIndex(0) +5 >Emitted(36, 7) Source(70, 6) + SourceIndex(0) +6 >Emitted(36, 50) Source(70, 73) + SourceIndex(0) +7 >Emitted(36, 52) Source(70, 8) + SourceIndex(0) +8 >Emitted(36, 64) Source(70, 23) + SourceIndex(0) +9 >Emitted(36, 66) Source(70, 8) + SourceIndex(0) +10>Emitted(36, 102) Source(70, 23) + SourceIndex(0) +11>Emitted(36, 107) Source(70, 73) + SourceIndex(0) +12>Emitted(36, 109) Source(70, 75) + SourceIndex(0) +13>Emitted(36, 110) Source(70, 76) + SourceIndex(0) +14>Emitted(36, 113) Source(70, 79) + SourceIndex(0) +15>Emitted(36, 114) Source(70, 80) + SourceIndex(0) +16>Emitted(36, 116) Source(70, 82) + SourceIndex(0) +17>Emitted(36, 117) Source(70, 83) + SourceIndex(0) +18>Emitted(36, 120) Source(70, 86) + SourceIndex(0) +19>Emitted(36, 121) Source(70, 87) + SourceIndex(0) +20>Emitted(36, 123) Source(70, 89) + SourceIndex(0) +21>Emitted(36, 124) Source(70, 90) + SourceIndex(0) +22>Emitted(36, 126) Source(70, 92) + SourceIndex(0) +23>Emitted(36, 128) Source(70, 94) + SourceIndex(0) +24>Emitted(36, 129) Source(70, 95) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(37, 5) Source(71, 5) + SourceIndex(0) +2 >Emitted(37, 12) Source(71, 12) + SourceIndex(0) +3 >Emitted(37, 13) Source(71, 13) + SourceIndex(0) +4 >Emitted(37, 16) Source(71, 16) + SourceIndex(0) +5 >Emitted(37, 17) Source(71, 17) + SourceIndex(0) +6 >Emitted(37, 22) Source(71, 22) + SourceIndex(0) +7 >Emitted(37, 23) Source(71, 23) + SourceIndex(0) +8 >Emitted(37, 24) Source(71, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(38, 1) Source(72, 1) + SourceIndex(0) +2 >Emitted(38, 2) Source(72, 2) + SourceIndex(0) +--- +>>>for ((_0 = multiRobot.skills, _1 = _0 === void 0 ? { primary: "none", secondary: "none" } : _0, _2 = _1.primary, primary = _2 === void 0 ? "primary" : _2, _3 = _1.secondary, secondary = _3 === void 0 ? "secondary" : _3, multiRobot), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^^^^ +15> ^^ +16> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +17> ^^ +18> ^^^^^^^^^^ +19> ^ +20> ^^ +21> ^ +22> ^^^ +23> ^ +24> ^^ +25> ^ +26> ^^^ +27> ^ +28> ^^ +29> ^ +30> ^^ +31> ^^ +32> ^ +1-> + > +2 >for +3 > +4 > ( +5 > { + > +6 > skills: { + > primary = "primary", + > secondary = "secondary" + > } = { primary: "none", secondary: "none" } +7 > +8 > skills: { + > primary = "primary", + > secondary = "secondary" + > } = { primary: "none", secondary: "none" } +9 > +10> primary = "primary" +11> +12> primary = "primary" +13> , + > +14> secondary = "secondary" +15> +16> secondary = "secondary" +17> + > } = { primary: "none", secondary: "none" } + > } = +18> multiRobot +19> +20> , +21> i +22> = +23> 0 +24> ; +25> i +26> < +27> 1 +28> ; +29> i +30> ++ +31> ) +32> { +1->Emitted(39, 1) Source(73, 1) + SourceIndex(0) +2 >Emitted(39, 4) Source(73, 4) + SourceIndex(0) +3 >Emitted(39, 5) Source(73, 5) + SourceIndex(0) +4 >Emitted(39, 6) Source(73, 6) + SourceIndex(0) +5 >Emitted(39, 7) Source(74, 5) + SourceIndex(0) +6 >Emitted(39, 29) Source(77, 47) + SourceIndex(0) +7 >Emitted(39, 31) Source(74, 5) + SourceIndex(0) +8 >Emitted(39, 95) Source(77, 47) + SourceIndex(0) +9 >Emitted(39, 97) Source(75, 9) + SourceIndex(0) +10>Emitted(39, 112) Source(75, 28) + SourceIndex(0) +11>Emitted(39, 114) Source(75, 9) + SourceIndex(0) +12>Emitted(39, 154) Source(75, 28) + SourceIndex(0) +13>Emitted(39, 156) Source(76, 9) + SourceIndex(0) +14>Emitted(39, 173) Source(76, 32) + SourceIndex(0) +15>Emitted(39, 175) Source(76, 9) + SourceIndex(0) +16>Emitted(39, 219) Source(76, 32) + SourceIndex(0) +17>Emitted(39, 221) Source(78, 5) + SourceIndex(0) +18>Emitted(39, 231) Source(78, 15) + SourceIndex(0) +19>Emitted(39, 232) Source(78, 15) + SourceIndex(0) +20>Emitted(39, 234) Source(78, 17) + SourceIndex(0) +21>Emitted(39, 235) Source(78, 18) + SourceIndex(0) +22>Emitted(39, 238) Source(78, 21) + SourceIndex(0) +23>Emitted(39, 239) Source(78, 22) + SourceIndex(0) +24>Emitted(39, 241) Source(78, 24) + SourceIndex(0) +25>Emitted(39, 242) Source(78, 25) + SourceIndex(0) +26>Emitted(39, 245) Source(78, 28) + SourceIndex(0) +27>Emitted(39, 246) Source(78, 29) + SourceIndex(0) +28>Emitted(39, 248) Source(78, 31) + SourceIndex(0) +29>Emitted(39, 249) Source(78, 32) + SourceIndex(0) +30>Emitted(39, 251) Source(78, 34) + SourceIndex(0) +31>Emitted(39, 253) Source(78, 36) + SourceIndex(0) +32>Emitted(39, 254) Source(78, 37) + SourceIndex(0) +--- +>>> console.log(primaryA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > primaryA +7 > ) +8 > ; +1 >Emitted(40, 5) Source(79, 5) + SourceIndex(0) +2 >Emitted(40, 12) Source(79, 12) + SourceIndex(0) +3 >Emitted(40, 13) Source(79, 13) + SourceIndex(0) +4 >Emitted(40, 16) Source(79, 16) + SourceIndex(0) +5 >Emitted(40, 17) Source(79, 17) + SourceIndex(0) +6 >Emitted(40, 25) Source(79, 25) + SourceIndex(0) +7 >Emitted(40, 26) Source(79, 26) + SourceIndex(0) +8 >Emitted(40, 27) Source(79, 27) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(41, 1) Source(80, 1) + SourceIndex(0) +2 >Emitted(41, 2) Source(80, 2) + SourceIndex(0) +--- +>>>for ((_4 = getMultiRobot(), _5 = _4.skills, _6 = _5 === void 0 ? { primary: "none", secondary: "none" } : _5, _7 = _6.primary, primary = _7 === void 0 ? "primary" : _7, _8 = _6.secondary, secondary = _8 === void 0 ? "secondary" : _8, _4), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +15> ^^ +16> ^^^^^^^^^^^^^^^^^ +17> ^^ +18> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +19> ^^^^^ +20> ^^ +21> ^ +22> ^^^ +23> ^ +24> ^^ +25> ^ +26> ^^^ +27> ^ +28> ^^ +29> ^ +30> ^^ +31> ^^ +32> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > { + > skills: { + > primary = "primary", + > secondary = "secondary" + > } = { primary: "none", secondary: "none" } + > } = getMultiRobot() +7 > +8 > skills: { + > primary = "primary", + > secondary = "secondary" + > } = { primary: "none", secondary: "none" } +9 > +10> skills: { + > primary = "primary", + > secondary = "secondary" + > } = { primary: "none", secondary: "none" } +11> +12> primary = "primary" +13> +14> primary = "primary" +15> , + > +16> secondary = "secondary" +17> +18> secondary = "secondary" +19> + > } = { primary: "none", secondary: "none" } + > } = getMultiRobot() +20> , +21> i +22> = +23> 0 +24> ; +25> i +26> < +27> 1 +28> ; +29> i +30> ++ +31> ) +32> { +1->Emitted(42, 1) Source(81, 1) + SourceIndex(0) +2 >Emitted(42, 4) Source(81, 4) + SourceIndex(0) +3 >Emitted(42, 5) Source(81, 5) + SourceIndex(0) +4 >Emitted(42, 6) Source(81, 6) + SourceIndex(0) +5 >Emitted(42, 7) Source(81, 6) + SourceIndex(0) +6 >Emitted(42, 27) Source(86, 20) + SourceIndex(0) +7 >Emitted(42, 29) Source(82, 5) + SourceIndex(0) +8 >Emitted(42, 43) Source(85, 47) + SourceIndex(0) +9 >Emitted(42, 45) Source(82, 5) + SourceIndex(0) +10>Emitted(42, 109) Source(85, 47) + SourceIndex(0) +11>Emitted(42, 111) Source(83, 9) + SourceIndex(0) +12>Emitted(42, 126) Source(83, 28) + SourceIndex(0) +13>Emitted(42, 128) Source(83, 9) + SourceIndex(0) +14>Emitted(42, 168) Source(83, 28) + SourceIndex(0) +15>Emitted(42, 170) Source(84, 9) + SourceIndex(0) +16>Emitted(42, 187) Source(84, 32) + SourceIndex(0) +17>Emitted(42, 189) Source(84, 9) + SourceIndex(0) +18>Emitted(42, 233) Source(84, 32) + SourceIndex(0) +19>Emitted(42, 238) Source(86, 20) + SourceIndex(0) +20>Emitted(42, 240) Source(86, 22) + SourceIndex(0) +21>Emitted(42, 241) Source(86, 23) + SourceIndex(0) +22>Emitted(42, 244) Source(86, 26) + SourceIndex(0) +23>Emitted(42, 245) Source(86, 27) + SourceIndex(0) +24>Emitted(42, 247) Source(86, 29) + SourceIndex(0) +25>Emitted(42, 248) Source(86, 30) + SourceIndex(0) +26>Emitted(42, 251) Source(86, 33) + SourceIndex(0) +27>Emitted(42, 252) Source(86, 34) + SourceIndex(0) +28>Emitted(42, 254) Source(86, 36) + SourceIndex(0) +29>Emitted(42, 255) Source(86, 37) + SourceIndex(0) +30>Emitted(42, 257) Source(86, 39) + SourceIndex(0) +31>Emitted(42, 259) Source(86, 41) + SourceIndex(0) +32>Emitted(42, 260) Source(86, 42) + SourceIndex(0) +--- +>>> console.log(primaryA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > primaryA +7 > ) +8 > ; +1 >Emitted(43, 5) Source(87, 5) + SourceIndex(0) +2 >Emitted(43, 12) Source(87, 12) + SourceIndex(0) +3 >Emitted(43, 13) Source(87, 13) + SourceIndex(0) +4 >Emitted(43, 16) Source(87, 16) + SourceIndex(0) +5 >Emitted(43, 17) Source(87, 17) + SourceIndex(0) +6 >Emitted(43, 25) Source(87, 25) + SourceIndex(0) +7 >Emitted(43, 26) Source(87, 26) + SourceIndex(0) +8 >Emitted(43, 27) Source(87, 27) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(44, 1) Source(88, 1) + SourceIndex(0) +2 >Emitted(44, 2) Source(88, 2) + SourceIndex(0) +--- +>>>for ((_9 = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, _10 = _9.skills, _11 = _10 === void 0 ? { primary: "none", secondary: "none" } : _10, _12 = _11.primary, primary = _12 === void 0 ? "primary" : _12, _13 = _11.secondary, secondary = _13 === void 0 ? "secondary" : _13, _9), +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +15> ^^ +16> ^^^^^^^^^^^^^^^^^^^ +17> ^^ +18> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +19> ^^^^^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > { + > skills: { + > primary = "primary", + > secondary = "secondary" + > } = { primary: "none", secondary: "none" } + > } = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } } +7 > +8 > skills: { + > primary = "primary", + > secondary = "secondary" + > } = { primary: "none", secondary: "none" } +9 > +10> skills: { + > primary = "primary", + > secondary = "secondary" + > } = { primary: "none", secondary: "none" } +11> +12> primary = "primary" +13> +14> primary = "primary" +15> , + > +16> secondary = "secondary" +17> +18> secondary = "secondary" +19> + > } = { primary: "none", secondary: "none" } + > } = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } } +1->Emitted(45, 1) Source(89, 1) + SourceIndex(0) +2 >Emitted(45, 4) Source(89, 4) + SourceIndex(0) +3 >Emitted(45, 5) Source(89, 5) + SourceIndex(0) +4 >Emitted(45, 6) Source(89, 6) + SourceIndex(0) +5 >Emitted(45, 7) Source(89, 6) + SourceIndex(0) +6 >Emitted(45, 85) Source(94, 90) + SourceIndex(0) +7 >Emitted(45, 87) Source(90, 5) + SourceIndex(0) +8 >Emitted(45, 102) Source(93, 47) + SourceIndex(0) +9 >Emitted(45, 104) Source(90, 5) + SourceIndex(0) +10>Emitted(45, 171) Source(93, 47) + SourceIndex(0) +11>Emitted(45, 173) Source(91, 9) + SourceIndex(0) +12>Emitted(45, 190) Source(91, 28) + SourceIndex(0) +13>Emitted(45, 192) Source(91, 9) + SourceIndex(0) +14>Emitted(45, 234) Source(91, 28) + SourceIndex(0) +15>Emitted(45, 236) Source(92, 9) + SourceIndex(0) +16>Emitted(45, 255) Source(92, 32) + SourceIndex(0) +17>Emitted(45, 257) Source(92, 9) + SourceIndex(0) +18>Emitted(45, 303) Source(92, 32) + SourceIndex(0) +19>Emitted(45, 308) Source(94, 90) + SourceIndex(0) +--- +>>> i = 0; i < 1; i++) { +1 >^^^^ +2 > ^ +3 > ^^^ +4 > ^ +5 > ^^ +6 > ^ +7 > ^^^ +8 > ^ +9 > ^^ +10> ^ +11> ^^ +12> ^^ +13> ^ +14> ^^^-> +1 >, + > +2 > i +3 > = +4 > 0 +5 > ; +6 > i +7 > < +8 > 1 +9 > ; +10> i +11> ++ +12> ) +13> { +1 >Emitted(46, 5) Source(95, 5) + SourceIndex(0) +2 >Emitted(46, 6) Source(95, 6) + SourceIndex(0) +3 >Emitted(46, 9) Source(95, 9) + SourceIndex(0) +4 >Emitted(46, 10) Source(95, 10) + SourceIndex(0) +5 >Emitted(46, 12) Source(95, 12) + SourceIndex(0) +6 >Emitted(46, 13) Source(95, 13) + SourceIndex(0) +7 >Emitted(46, 16) Source(95, 16) + SourceIndex(0) +8 >Emitted(46, 17) Source(95, 17) + SourceIndex(0) +9 >Emitted(46, 19) Source(95, 19) + SourceIndex(0) +10>Emitted(46, 20) Source(95, 20) + SourceIndex(0) +11>Emitted(46, 22) Source(95, 22) + SourceIndex(0) +12>Emitted(46, 24) Source(95, 24) + SourceIndex(0) +13>Emitted(46, 25) Source(95, 25) + SourceIndex(0) +--- +>>> console.log(primaryA); +1->^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1-> + > +2 > console +3 > . +4 > log +5 > ( +6 > primaryA +7 > ) +8 > ; +1->Emitted(47, 5) Source(96, 5) + SourceIndex(0) +2 >Emitted(47, 12) Source(96, 12) + SourceIndex(0) +3 >Emitted(47, 13) Source(96, 13) + SourceIndex(0) +4 >Emitted(47, 16) Source(96, 16) + SourceIndex(0) +5 >Emitted(47, 17) Source(96, 17) + SourceIndex(0) +6 >Emitted(47, 25) Source(96, 25) + SourceIndex(0) +7 >Emitted(47, 26) Source(96, 26) + SourceIndex(0) +8 >Emitted(47, 27) Source(96, 27) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(48, 1) Source(97, 1) + SourceIndex(0) +2 >Emitted(48, 2) Source(97, 2) + SourceIndex(0) +--- +>>>for ((_14 = robot.name, nameA = _14 === void 0 ? "noName" : _14, _15 = robot.skill, skillA = _15 === void 0 ? "skill" : _15, robot), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +13> ^^ +14> ^^^^^ +15> ^ +16> ^^ +17> ^ +18> ^^^ +19> ^ +20> ^^ +21> ^ +22> ^^^ +23> ^ +24> ^^ +25> ^ +26> ^^ +27> ^^ +28> ^ +1-> + > + > + > +2 >for +3 > +4 > ( +5 > { +6 > name: nameA = "noName" +7 > +8 > name: nameA = "noName" +9 > , +10> skill: skillA = "skill" +11> +12> skill: skillA = "skill" +13> } = +14> robot +15> +16> , +17> i +18> = +19> 0 +20> ; +21> i +22> < +23> 1 +24> ; +25> i +26> ++ +27> ) +28> { +1->Emitted(49, 1) Source(100, 1) + SourceIndex(0) +2 >Emitted(49, 4) Source(100, 4) + SourceIndex(0) +3 >Emitted(49, 5) Source(100, 5) + SourceIndex(0) +4 >Emitted(49, 6) Source(100, 6) + SourceIndex(0) +5 >Emitted(49, 7) Source(100, 7) + SourceIndex(0) +6 >Emitted(49, 23) Source(100, 29) + SourceIndex(0) +7 >Emitted(49, 25) Source(100, 7) + SourceIndex(0) +8 >Emitted(49, 64) Source(100, 29) + SourceIndex(0) +9 >Emitted(49, 66) Source(100, 31) + SourceIndex(0) +10>Emitted(49, 83) Source(100, 54) + SourceIndex(0) +11>Emitted(49, 85) Source(100, 31) + SourceIndex(0) +12>Emitted(49, 124) Source(100, 54) + SourceIndex(0) +13>Emitted(49, 126) Source(100, 59) + SourceIndex(0) +14>Emitted(49, 131) Source(100, 64) + SourceIndex(0) +15>Emitted(49, 132) Source(100, 64) + SourceIndex(0) +16>Emitted(49, 134) Source(100, 66) + SourceIndex(0) +17>Emitted(49, 135) Source(100, 67) + SourceIndex(0) +18>Emitted(49, 138) Source(100, 70) + SourceIndex(0) +19>Emitted(49, 139) Source(100, 71) + SourceIndex(0) +20>Emitted(49, 141) Source(100, 73) + SourceIndex(0) +21>Emitted(49, 142) Source(100, 74) + SourceIndex(0) +22>Emitted(49, 145) Source(100, 77) + SourceIndex(0) +23>Emitted(49, 146) Source(100, 78) + SourceIndex(0) +24>Emitted(49, 148) Source(100, 80) + SourceIndex(0) +25>Emitted(49, 149) Source(100, 81) + SourceIndex(0) +26>Emitted(49, 151) Source(100, 83) + SourceIndex(0) +27>Emitted(49, 153) Source(100, 85) + SourceIndex(0) +28>Emitted(49, 154) Source(100, 86) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(50, 5) Source(101, 5) + SourceIndex(0) +2 >Emitted(50, 12) Source(101, 12) + SourceIndex(0) +3 >Emitted(50, 13) Source(101, 13) + SourceIndex(0) +4 >Emitted(50, 16) Source(101, 16) + SourceIndex(0) +5 >Emitted(50, 17) Source(101, 17) + SourceIndex(0) +6 >Emitted(50, 22) Source(101, 22) + SourceIndex(0) +7 >Emitted(50, 23) Source(101, 23) + SourceIndex(0) +8 >Emitted(50, 24) Source(101, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(51, 1) Source(102, 1) + SourceIndex(0) +2 >Emitted(51, 2) Source(102, 2) + SourceIndex(0) +--- +>>>for ((_16 = getRobot(), _17 = _16.name, nameA = _17 === void 0 ? "noName" : _17, _18 = _16.skill, skillA = _18 === void 0 ? "skill" : _18, _16), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +15> ^^^^^^ +16> ^^ +17> ^ +18> ^^^ +19> ^ +20> ^^ +21> ^ +22> ^^^ +23> ^ +24> ^^ +25> ^ +26> ^^ +27> ^^ +28> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > {name: nameA = "noName", skill: skillA = "skill" } = getRobot() +7 > +8 > name: nameA = "noName" +9 > +10> name: nameA = "noName" +11> , +12> skill: skillA = "skill" +13> +14> skill: skillA = "skill" +15> } = getRobot() +16> , +17> i +18> = +19> 0 +20> ; +21> i +22> < +23> 1 +24> ; +25> i +26> ++ +27> ) +28> { +1->Emitted(52, 1) Source(103, 1) + SourceIndex(0) +2 >Emitted(52, 4) Source(103, 4) + SourceIndex(0) +3 >Emitted(52, 5) Source(103, 5) + SourceIndex(0) +4 >Emitted(52, 6) Source(103, 6) + SourceIndex(0) +5 >Emitted(52, 7) Source(103, 6) + SourceIndex(0) +6 >Emitted(52, 23) Source(103, 69) + SourceIndex(0) +7 >Emitted(52, 25) Source(103, 7) + SourceIndex(0) +8 >Emitted(52, 39) Source(103, 29) + SourceIndex(0) +9 >Emitted(52, 41) Source(103, 7) + SourceIndex(0) +10>Emitted(52, 80) Source(103, 29) + SourceIndex(0) +11>Emitted(52, 82) Source(103, 31) + SourceIndex(0) +12>Emitted(52, 97) Source(103, 54) + SourceIndex(0) +13>Emitted(52, 99) Source(103, 31) + SourceIndex(0) +14>Emitted(52, 138) Source(103, 54) + SourceIndex(0) +15>Emitted(52, 144) Source(103, 69) + SourceIndex(0) +16>Emitted(52, 146) Source(103, 71) + SourceIndex(0) +17>Emitted(52, 147) Source(103, 72) + SourceIndex(0) +18>Emitted(52, 150) Source(103, 75) + SourceIndex(0) +19>Emitted(52, 151) Source(103, 76) + SourceIndex(0) +20>Emitted(52, 153) Source(103, 78) + SourceIndex(0) +21>Emitted(52, 154) Source(103, 79) + SourceIndex(0) +22>Emitted(52, 157) Source(103, 82) + SourceIndex(0) +23>Emitted(52, 158) Source(103, 83) + SourceIndex(0) +24>Emitted(52, 160) Source(103, 85) + SourceIndex(0) +25>Emitted(52, 161) Source(103, 86) + SourceIndex(0) +26>Emitted(52, 163) Source(103, 88) + SourceIndex(0) +27>Emitted(52, 165) Source(103, 90) + SourceIndex(0) +28>Emitted(52, 166) Source(103, 91) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(53, 5) Source(104, 5) + SourceIndex(0) +2 >Emitted(53, 12) Source(104, 12) + SourceIndex(0) +3 >Emitted(53, 13) Source(104, 13) + SourceIndex(0) +4 >Emitted(53, 16) Source(104, 16) + SourceIndex(0) +5 >Emitted(53, 17) Source(104, 17) + SourceIndex(0) +6 >Emitted(53, 22) Source(104, 22) + SourceIndex(0) +7 >Emitted(53, 23) Source(104, 23) + SourceIndex(0) +8 >Emitted(53, 24) Source(104, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(54, 1) Source(105, 1) + SourceIndex(0) +2 >Emitted(54, 2) Source(105, 2) + SourceIndex(0) +--- +>>>for ((_19 = { name: "trimmer", skill: "trimming" }, _20 = _19.name, nameA = _20 === void 0 ? "noName" : _20, _21 = _19.skill, skillA = _21 === void 0 ? "skill" : _21, _19), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +15> ^^^^^^ +16> ^^ +17> ^ +18> ^^^ +19> ^ +20> ^^ +21> ^ +22> ^^^ +23> ^ +24> ^^ +25> ^ +26> ^^ +27> ^^ +28> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > {name: nameA = "noName", skill: skillA = "skill" } = { name: "trimmer", skill: "trimming" } +7 > +8 > name: nameA = "noName" +9 > +10> name: nameA = "noName" +11> , +12> skill: skillA = "skill" +13> +14> skill: skillA = "skill" +15> } = { name: "trimmer", skill: "trimming" } +16> , +17> i +18> = +19> 0 +20> ; +21> i +22> < +23> 1 +24> ; +25> i +26> ++ +27> ) +28> { +1->Emitted(55, 1) Source(106, 1) + SourceIndex(0) +2 >Emitted(55, 4) Source(106, 4) + SourceIndex(0) +3 >Emitted(55, 5) Source(106, 5) + SourceIndex(0) +4 >Emitted(55, 6) Source(106, 6) + SourceIndex(0) +5 >Emitted(55, 7) Source(106, 6) + SourceIndex(0) +6 >Emitted(55, 51) Source(106, 104) + SourceIndex(0) +7 >Emitted(55, 53) Source(106, 7) + SourceIndex(0) +8 >Emitted(55, 67) Source(106, 29) + SourceIndex(0) +9 >Emitted(55, 69) Source(106, 7) + SourceIndex(0) +10>Emitted(55, 108) Source(106, 29) + SourceIndex(0) +11>Emitted(55, 110) Source(106, 31) + SourceIndex(0) +12>Emitted(55, 125) Source(106, 54) + SourceIndex(0) +13>Emitted(55, 127) Source(106, 31) + SourceIndex(0) +14>Emitted(55, 166) Source(106, 54) + SourceIndex(0) +15>Emitted(55, 172) Source(106, 104) + SourceIndex(0) +16>Emitted(55, 174) Source(106, 106) + SourceIndex(0) +17>Emitted(55, 175) Source(106, 107) + SourceIndex(0) +18>Emitted(55, 178) Source(106, 110) + SourceIndex(0) +19>Emitted(55, 179) Source(106, 111) + SourceIndex(0) +20>Emitted(55, 181) Source(106, 113) + SourceIndex(0) +21>Emitted(55, 182) Source(106, 114) + SourceIndex(0) +22>Emitted(55, 185) Source(106, 117) + SourceIndex(0) +23>Emitted(55, 186) Source(106, 118) + SourceIndex(0) +24>Emitted(55, 188) Source(106, 120) + SourceIndex(0) +25>Emitted(55, 189) Source(106, 121) + SourceIndex(0) +26>Emitted(55, 191) Source(106, 123) + SourceIndex(0) +27>Emitted(55, 193) Source(106, 125) + SourceIndex(0) +28>Emitted(55, 194) Source(106, 126) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(56, 5) Source(107, 5) + SourceIndex(0) +2 >Emitted(56, 12) Source(107, 12) + SourceIndex(0) +3 >Emitted(56, 13) Source(107, 13) + SourceIndex(0) +4 >Emitted(56, 16) Source(107, 16) + SourceIndex(0) +5 >Emitted(56, 17) Source(107, 17) + SourceIndex(0) +6 >Emitted(56, 22) Source(107, 22) + SourceIndex(0) +7 >Emitted(56, 23) Source(107, 23) + SourceIndex(0) +8 >Emitted(56, 24) Source(107, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(57, 1) Source(108, 1) + SourceIndex(0) +2 >Emitted(57, 2) Source(108, 2) + SourceIndex(0) +--- +>>>for ((_22 = multiRobot.name, nameA = _22 === void 0 ? "noName" : _22, _23 = multiRobot.skills, _24 = _23 === void 0 ? { primary: "none", secondary: "none" } : _23, _25 = _24.primary, primaryA = _25 === void 0 ? "primary" : _25, _26 = _24.secondary, secondaryA = _26 === void 0 ? "secondary" : _26, multiRobot), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^^^^ +15> ^^ +16> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +17> ^^ +18> ^^^^^^^^^^^^^^^^^^^ +19> ^^ +20> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +21> ^^ +22> ^^^^^^^^^^ +23> ^ +24> ^^ +25> ^ +26> ^^^ +27> ^ +28> ^^ +29> ^ +30> ^^^ +31> ^ +32> ^^ +33> ^ +34> ^^ +35> ^^ +36> ^ +1-> + > +2 >for +3 > +4 > ( +5 > { + > +6 > name: nameA = "noName" +7 > +8 > name: nameA = "noName" +9 > , + > +10> skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "none", secondary: "none" } +11> +12> skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "none", secondary: "none" } +13> +14> primary: primaryA = "primary" +15> +16> primary: primaryA = "primary" +17> , + > +18> secondary: secondaryA = "secondary" +19> +20> secondary: secondaryA = "secondary" +21> + > } = { primary: "none", secondary: "none" } + > } = +22> multiRobot +23> +24> , +25> i +26> = +27> 0 +28> ; +29> i +30> < +31> 1 +32> ; +33> i +34> ++ +35> ) +36> { +1->Emitted(58, 1) Source(109, 1) + SourceIndex(0) +2 >Emitted(58, 4) Source(109, 4) + SourceIndex(0) +3 >Emitted(58, 5) Source(109, 5) + SourceIndex(0) +4 >Emitted(58, 6) Source(109, 6) + SourceIndex(0) +5 >Emitted(58, 7) Source(110, 5) + SourceIndex(0) +6 >Emitted(58, 28) Source(110, 27) + SourceIndex(0) +7 >Emitted(58, 30) Source(110, 5) + SourceIndex(0) +8 >Emitted(58, 69) Source(110, 27) + SourceIndex(0) +9 >Emitted(58, 71) Source(111, 5) + SourceIndex(0) +10>Emitted(58, 94) Source(114, 47) + SourceIndex(0) +11>Emitted(58, 96) Source(111, 5) + SourceIndex(0) +12>Emitted(58, 163) Source(114, 47) + SourceIndex(0) +13>Emitted(58, 165) Source(112, 9) + SourceIndex(0) +14>Emitted(58, 182) Source(112, 38) + SourceIndex(0) +15>Emitted(58, 184) Source(112, 9) + SourceIndex(0) +16>Emitted(58, 227) Source(112, 38) + SourceIndex(0) +17>Emitted(58, 229) Source(113, 9) + SourceIndex(0) +18>Emitted(58, 248) Source(113, 44) + SourceIndex(0) +19>Emitted(58, 250) Source(113, 9) + SourceIndex(0) +20>Emitted(58, 297) Source(113, 44) + SourceIndex(0) +21>Emitted(58, 299) Source(115, 5) + SourceIndex(0) +22>Emitted(58, 309) Source(115, 15) + SourceIndex(0) +23>Emitted(58, 310) Source(115, 15) + SourceIndex(0) +24>Emitted(58, 312) Source(115, 17) + SourceIndex(0) +25>Emitted(58, 313) Source(115, 18) + SourceIndex(0) +26>Emitted(58, 316) Source(115, 21) + SourceIndex(0) +27>Emitted(58, 317) Source(115, 22) + SourceIndex(0) +28>Emitted(58, 319) Source(115, 24) + SourceIndex(0) +29>Emitted(58, 320) Source(115, 25) + SourceIndex(0) +30>Emitted(58, 323) Source(115, 28) + SourceIndex(0) +31>Emitted(58, 324) Source(115, 29) + SourceIndex(0) +32>Emitted(58, 326) Source(115, 31) + SourceIndex(0) +33>Emitted(58, 327) Source(115, 32) + SourceIndex(0) +34>Emitted(58, 329) Source(115, 34) + SourceIndex(0) +35>Emitted(58, 331) Source(115, 36) + SourceIndex(0) +36>Emitted(58, 332) Source(115, 37) + SourceIndex(0) +--- +>>> console.log(primaryA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > primaryA +7 > ) +8 > ; +1 >Emitted(59, 5) Source(116, 5) + SourceIndex(0) +2 >Emitted(59, 12) Source(116, 12) + SourceIndex(0) +3 >Emitted(59, 13) Source(116, 13) + SourceIndex(0) +4 >Emitted(59, 16) Source(116, 16) + SourceIndex(0) +5 >Emitted(59, 17) Source(116, 17) + SourceIndex(0) +6 >Emitted(59, 25) Source(116, 25) + SourceIndex(0) +7 >Emitted(59, 26) Source(116, 26) + SourceIndex(0) +8 >Emitted(59, 27) Source(116, 27) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(60, 1) Source(117, 1) + SourceIndex(0) +2 >Emitted(60, 2) Source(117, 2) + SourceIndex(0) +--- +>>>for ((_27 = getMultiRobot(), _28 = _27.name, nameA = _28 === void 0 ? "noName" : _28, _29 = _27.skills, _30 = _29 === void 0 ? { primary: "none", secondary: "none" } : _29, _31 = _30.primary, primaryA = _31 === void 0 ? "primary" : _31, _32 = _30.secondary, secondaryA = _32 === void 0 ? "secondary" : _32, _27), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +15> ^^ +16> ^^^^^^^^^^^^^^^^^ +17> ^^ +18> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +19> ^^ +20> ^^^^^^^^^^^^^^^^^^^ +21> ^^ +22> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +23> ^^^^^^ +24> ^^ +25> ^ +26> ^^^ +27> ^ +28> ^^ +29> ^ +30> ^^^ +31> ^ +32> ^^ +33> ^ +34> ^^ +35> ^^ +36> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > { + > name: nameA = "noName", + > skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "none", secondary: "none" } + > } = getMultiRobot() +7 > +8 > name: nameA = "noName" +9 > +10> name: nameA = "noName" +11> , + > +12> skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "none", secondary: "none" } +13> +14> skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "none", secondary: "none" } +15> +16> primary: primaryA = "primary" +17> +18> primary: primaryA = "primary" +19> , + > +20> secondary: secondaryA = "secondary" +21> +22> secondary: secondaryA = "secondary" +23> + > } = { primary: "none", secondary: "none" } + > } = getMultiRobot() +24> , +25> i +26> = +27> 0 +28> ; +29> i +30> < +31> 1 +32> ; +33> i +34> ++ +35> ) +36> { +1->Emitted(61, 1) Source(118, 1) + SourceIndex(0) +2 >Emitted(61, 4) Source(118, 4) + SourceIndex(0) +3 >Emitted(61, 5) Source(118, 5) + SourceIndex(0) +4 >Emitted(61, 6) Source(118, 6) + SourceIndex(0) +5 >Emitted(61, 7) Source(118, 6) + SourceIndex(0) +6 >Emitted(61, 28) Source(124, 20) + SourceIndex(0) +7 >Emitted(61, 30) Source(119, 5) + SourceIndex(0) +8 >Emitted(61, 44) Source(119, 27) + SourceIndex(0) +9 >Emitted(61, 46) Source(119, 5) + SourceIndex(0) +10>Emitted(61, 85) Source(119, 27) + SourceIndex(0) +11>Emitted(61, 87) Source(120, 5) + SourceIndex(0) +12>Emitted(61, 103) Source(123, 47) + SourceIndex(0) +13>Emitted(61, 105) Source(120, 5) + SourceIndex(0) +14>Emitted(61, 172) Source(123, 47) + SourceIndex(0) +15>Emitted(61, 174) Source(121, 9) + SourceIndex(0) +16>Emitted(61, 191) Source(121, 38) + SourceIndex(0) +17>Emitted(61, 193) Source(121, 9) + SourceIndex(0) +18>Emitted(61, 236) Source(121, 38) + SourceIndex(0) +19>Emitted(61, 238) Source(122, 9) + SourceIndex(0) +20>Emitted(61, 257) Source(122, 44) + SourceIndex(0) +21>Emitted(61, 259) Source(122, 9) + SourceIndex(0) +22>Emitted(61, 306) Source(122, 44) + SourceIndex(0) +23>Emitted(61, 312) Source(124, 20) + SourceIndex(0) +24>Emitted(61, 314) Source(124, 22) + SourceIndex(0) +25>Emitted(61, 315) Source(124, 23) + SourceIndex(0) +26>Emitted(61, 318) Source(124, 26) + SourceIndex(0) +27>Emitted(61, 319) Source(124, 27) + SourceIndex(0) +28>Emitted(61, 321) Source(124, 29) + SourceIndex(0) +29>Emitted(61, 322) Source(124, 30) + SourceIndex(0) +30>Emitted(61, 325) Source(124, 33) + SourceIndex(0) +31>Emitted(61, 326) Source(124, 34) + SourceIndex(0) +32>Emitted(61, 328) Source(124, 36) + SourceIndex(0) +33>Emitted(61, 329) Source(124, 37) + SourceIndex(0) +34>Emitted(61, 331) Source(124, 39) + SourceIndex(0) +35>Emitted(61, 333) Source(124, 41) + SourceIndex(0) +36>Emitted(61, 334) Source(124, 42) + SourceIndex(0) +--- +>>> console.log(primaryA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > primaryA +7 > ) +8 > ; +1 >Emitted(62, 5) Source(125, 5) + SourceIndex(0) +2 >Emitted(62, 12) Source(125, 12) + SourceIndex(0) +3 >Emitted(62, 13) Source(125, 13) + SourceIndex(0) +4 >Emitted(62, 16) Source(125, 16) + SourceIndex(0) +5 >Emitted(62, 17) Source(125, 17) + SourceIndex(0) +6 >Emitted(62, 25) Source(125, 25) + SourceIndex(0) +7 >Emitted(62, 26) Source(125, 26) + SourceIndex(0) +8 >Emitted(62, 27) Source(125, 27) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(63, 1) Source(126, 1) + SourceIndex(0) +2 >Emitted(63, 2) Source(126, 2) + SourceIndex(0) +--- +>>>for ((_33 = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, _34 = _33.name, nameA = _34 === void 0 ? "noName" : _34, _35 = _33.skills, _36 = _35 === void 0 ? { primary: "none", secondary: "none" } : _35, _37 = _36.primary, primaryA = _37 === void 0 ? "primary" : _37, _38 = _36.secondary, secondaryA = _38 === void 0 ? "secondary" : _38, _33), +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +15> ^^ +16> ^^^^^^^^^^^^^^^^^ +17> ^^ +18> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +19> ^^ +20> ^^^^^^^^^^^^^^^^^^^ +21> ^^ +22> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +23> ^^^^^^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > { + > name: nameA = "noName", + > skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "none", secondary: "none" } + > } = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } } +7 > +8 > name: nameA = "noName" +9 > +10> name: nameA = "noName" +11> , + > +12> skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "none", secondary: "none" } +13> +14> skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "none", secondary: "none" } +15> +16> primary: primaryA = "primary" +17> +18> primary: primaryA = "primary" +19> , + > +20> secondary: secondaryA = "secondary" +21> +22> secondary: secondaryA = "secondary" +23> + > } = { primary: "none", secondary: "none" } + > } = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } } +1->Emitted(64, 1) Source(127, 1) + SourceIndex(0) +2 >Emitted(64, 4) Source(127, 4) + SourceIndex(0) +3 >Emitted(64, 5) Source(127, 5) + SourceIndex(0) +4 >Emitted(64, 6) Source(127, 6) + SourceIndex(0) +5 >Emitted(64, 7) Source(127, 6) + SourceIndex(0) +6 >Emitted(64, 86) Source(133, 90) + SourceIndex(0) +7 >Emitted(64, 88) Source(128, 5) + SourceIndex(0) +8 >Emitted(64, 102) Source(128, 27) + SourceIndex(0) +9 >Emitted(64, 104) Source(128, 5) + SourceIndex(0) +10>Emitted(64, 143) Source(128, 27) + SourceIndex(0) +11>Emitted(64, 145) Source(129, 5) + SourceIndex(0) +12>Emitted(64, 161) Source(132, 47) + SourceIndex(0) +13>Emitted(64, 163) Source(129, 5) + SourceIndex(0) +14>Emitted(64, 230) Source(132, 47) + SourceIndex(0) +15>Emitted(64, 232) Source(130, 9) + SourceIndex(0) +16>Emitted(64, 249) Source(130, 38) + SourceIndex(0) +17>Emitted(64, 251) Source(130, 9) + SourceIndex(0) +18>Emitted(64, 294) Source(130, 38) + SourceIndex(0) +19>Emitted(64, 296) Source(131, 9) + SourceIndex(0) +20>Emitted(64, 315) Source(131, 44) + SourceIndex(0) +21>Emitted(64, 317) Source(131, 9) + SourceIndex(0) +22>Emitted(64, 364) Source(131, 44) + SourceIndex(0) +23>Emitted(64, 370) Source(133, 90) + SourceIndex(0) +--- +>>> i = 0; i < 1; i++) { +1 >^^^^ +2 > ^ +3 > ^^^ +4 > ^ +5 > ^^ +6 > ^ +7 > ^^^ +8 > ^ +9 > ^^ +10> ^ +11> ^^ +12> ^^ +13> ^ +14> ^^^-> +1 >, + > +2 > i +3 > = +4 > 0 +5 > ; +6 > i +7 > < +8 > 1 +9 > ; +10> i +11> ++ +12> ) +13> { +1 >Emitted(65, 5) Source(134, 5) + SourceIndex(0) +2 >Emitted(65, 6) Source(134, 6) + SourceIndex(0) +3 >Emitted(65, 9) Source(134, 9) + SourceIndex(0) +4 >Emitted(65, 10) Source(134, 10) + SourceIndex(0) +5 >Emitted(65, 12) Source(134, 12) + SourceIndex(0) +6 >Emitted(65, 13) Source(134, 13) + SourceIndex(0) +7 >Emitted(65, 16) Source(134, 16) + SourceIndex(0) +8 >Emitted(65, 17) Source(134, 17) + SourceIndex(0) +9 >Emitted(65, 19) Source(134, 19) + SourceIndex(0) +10>Emitted(65, 20) Source(134, 20) + SourceIndex(0) +11>Emitted(65, 22) Source(134, 22) + SourceIndex(0) +12>Emitted(65, 24) Source(134, 24) + SourceIndex(0) +13>Emitted(65, 25) Source(134, 25) + SourceIndex(0) +--- +>>> console.log(primaryA); +1->^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1-> + > +2 > console +3 > . +4 > log +5 > ( +6 > primaryA +7 > ) +8 > ; +1->Emitted(66, 5) Source(135, 5) + SourceIndex(0) +2 >Emitted(66, 12) Source(135, 12) + SourceIndex(0) +3 >Emitted(66, 13) Source(135, 13) + SourceIndex(0) +4 >Emitted(66, 16) Source(135, 16) + SourceIndex(0) +5 >Emitted(66, 17) Source(135, 17) + SourceIndex(0) +6 >Emitted(66, 25) Source(135, 25) + SourceIndex(0) +7 >Emitted(66, 26) Source(135, 26) + SourceIndex(0) +8 >Emitted(66, 27) Source(135, 27) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(67, 1) Source(136, 1) + SourceIndex(0) +2 >Emitted(67, 2) Source(136, 2) + SourceIndex(0) +--- +>>>for ((_39 = robot.name, name = _39 === void 0 ? "noName" : _39, _40 = robot.skill, skill = _40 === void 0 ? "skill" : _40, robot), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +13> ^^ +14> ^^^^^ +15> ^ +16> ^^ +17> ^ +18> ^^^ +19> ^ +20> ^^ +21> ^ +22> ^^^ +23> ^ +24> ^^ +25> ^ +26> ^^ +27> ^^ +28> ^ +1-> + > + > +2 >for +3 > +4 > ( +5 > { +6 > name = "noName" +7 > +8 > name = "noName" +9 > , +10> skill = "skill" +11> +12> skill = "skill" +13> } = +14> robot +15> +16> , +17> i +18> = +19> 0 +20> ; +21> i +22> < +23> 1 +24> ; +25> i +26> ++ +27> ) +28> { +1->Emitted(68, 1) Source(138, 1) + SourceIndex(0) +2 >Emitted(68, 4) Source(138, 4) + SourceIndex(0) +3 >Emitted(68, 5) Source(138, 5) + SourceIndex(0) +4 >Emitted(68, 6) Source(138, 6) + SourceIndex(0) +5 >Emitted(68, 7) Source(138, 8) + SourceIndex(0) +6 >Emitted(68, 23) Source(138, 23) + SourceIndex(0) +7 >Emitted(68, 25) Source(138, 8) + SourceIndex(0) +8 >Emitted(68, 63) Source(138, 23) + SourceIndex(0) +9 >Emitted(68, 65) Source(138, 25) + SourceIndex(0) +10>Emitted(68, 82) Source(138, 40) + SourceIndex(0) +11>Emitted(68, 84) Source(138, 25) + SourceIndex(0) +12>Emitted(68, 122) Source(138, 40) + SourceIndex(0) +13>Emitted(68, 124) Source(138, 45) + SourceIndex(0) +14>Emitted(68, 129) Source(138, 50) + SourceIndex(0) +15>Emitted(68, 130) Source(138, 50) + SourceIndex(0) +16>Emitted(68, 132) Source(138, 52) + SourceIndex(0) +17>Emitted(68, 133) Source(138, 53) + SourceIndex(0) +18>Emitted(68, 136) Source(138, 56) + SourceIndex(0) +19>Emitted(68, 137) Source(138, 57) + SourceIndex(0) +20>Emitted(68, 139) Source(138, 59) + SourceIndex(0) +21>Emitted(68, 140) Source(138, 60) + SourceIndex(0) +22>Emitted(68, 143) Source(138, 63) + SourceIndex(0) +23>Emitted(68, 144) Source(138, 64) + SourceIndex(0) +24>Emitted(68, 146) Source(138, 66) + SourceIndex(0) +25>Emitted(68, 147) Source(138, 67) + SourceIndex(0) +26>Emitted(68, 149) Source(138, 69) + SourceIndex(0) +27>Emitted(68, 151) Source(138, 71) + SourceIndex(0) +28>Emitted(68, 152) Source(138, 72) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(69, 5) Source(139, 5) + SourceIndex(0) +2 >Emitted(69, 12) Source(139, 12) + SourceIndex(0) +3 >Emitted(69, 13) Source(139, 13) + SourceIndex(0) +4 >Emitted(69, 16) Source(139, 16) + SourceIndex(0) +5 >Emitted(69, 17) Source(139, 17) + SourceIndex(0) +6 >Emitted(69, 22) Source(139, 22) + SourceIndex(0) +7 >Emitted(69, 23) Source(139, 23) + SourceIndex(0) +8 >Emitted(69, 24) Source(139, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(70, 1) Source(140, 1) + SourceIndex(0) +2 >Emitted(70, 2) Source(140, 2) + SourceIndex(0) +--- +>>>for ((_41 = getRobot(), _42 = _41.name, name = _42 === void 0 ? "noName" : _42, _43 = _41.skill, skill = _43 === void 0 ? "skill" : _43, _41), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +15> ^^^^^^ +16> ^^ +17> ^ +18> ^^^ +19> ^ +20> ^^ +21> ^ +22> ^^^ +23> ^ +24> ^^ +25> ^ +26> ^^ +27> ^^ +28> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > { name = "noName", skill = "skill" } = getRobot() +7 > +8 > name = "noName" +9 > +10> name = "noName" +11> , +12> skill = "skill" +13> +14> skill = "skill" +15> } = getRobot() +16> , +17> i +18> = +19> 0 +20> ; +21> i +22> < +23> 1 +24> ; +25> i +26> ++ +27> ) +28> { +1->Emitted(71, 1) Source(141, 1) + SourceIndex(0) +2 >Emitted(71, 4) Source(141, 4) + SourceIndex(0) +3 >Emitted(71, 5) Source(141, 5) + SourceIndex(0) +4 >Emitted(71, 6) Source(141, 6) + SourceIndex(0) +5 >Emitted(71, 7) Source(141, 6) + SourceIndex(0) +6 >Emitted(71, 23) Source(141, 55) + SourceIndex(0) +7 >Emitted(71, 25) Source(141, 8) + SourceIndex(0) +8 >Emitted(71, 39) Source(141, 23) + SourceIndex(0) +9 >Emitted(71, 41) Source(141, 8) + SourceIndex(0) +10>Emitted(71, 79) Source(141, 23) + SourceIndex(0) +11>Emitted(71, 81) Source(141, 25) + SourceIndex(0) +12>Emitted(71, 96) Source(141, 40) + SourceIndex(0) +13>Emitted(71, 98) Source(141, 25) + SourceIndex(0) +14>Emitted(71, 136) Source(141, 40) + SourceIndex(0) +15>Emitted(71, 142) Source(141, 55) + SourceIndex(0) +16>Emitted(71, 144) Source(141, 57) + SourceIndex(0) +17>Emitted(71, 145) Source(141, 58) + SourceIndex(0) +18>Emitted(71, 148) Source(141, 61) + SourceIndex(0) +19>Emitted(71, 149) Source(141, 62) + SourceIndex(0) +20>Emitted(71, 151) Source(141, 64) + SourceIndex(0) +21>Emitted(71, 152) Source(141, 65) + SourceIndex(0) +22>Emitted(71, 155) Source(141, 68) + SourceIndex(0) +23>Emitted(71, 156) Source(141, 69) + SourceIndex(0) +24>Emitted(71, 158) Source(141, 71) + SourceIndex(0) +25>Emitted(71, 159) Source(141, 72) + SourceIndex(0) +26>Emitted(71, 161) Source(141, 74) + SourceIndex(0) +27>Emitted(71, 163) Source(141, 76) + SourceIndex(0) +28>Emitted(71, 164) Source(141, 77) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(72, 5) Source(142, 5) + SourceIndex(0) +2 >Emitted(72, 12) Source(142, 12) + SourceIndex(0) +3 >Emitted(72, 13) Source(142, 13) + SourceIndex(0) +4 >Emitted(72, 16) Source(142, 16) + SourceIndex(0) +5 >Emitted(72, 17) Source(142, 17) + SourceIndex(0) +6 >Emitted(72, 22) Source(142, 22) + SourceIndex(0) +7 >Emitted(72, 23) Source(142, 23) + SourceIndex(0) +8 >Emitted(72, 24) Source(142, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(73, 1) Source(143, 1) + SourceIndex(0) +2 >Emitted(73, 2) Source(143, 2) + SourceIndex(0) +--- +>>>for ((_44 = { name: "trimmer", skill: "trimming" }, _45 = _44.name, name = _45 === void 0 ? "noName" : _45, _46 = _44.skill, skill = _46 === void 0 ? "skill" : _46, _44), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +15> ^^^^^^ +16> ^^ +17> ^ +18> ^^^ +19> ^ +20> ^^ +21> ^ +22> ^^^ +23> ^ +24> ^^ +25> ^ +26> ^^ +27> ^^ +28> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > { name = "noName", skill = "skill" } = { name: "trimmer", skill: "trimming" } +7 > +8 > name = "noName" +9 > +10> name = "noName" +11> , +12> skill = "skill" +13> +14> skill = "skill" +15> } = { name: "trimmer", skill: "trimming" } +16> , +17> i +18> = +19> 0 +20> ; +21> i +22> < +23> 1 +24> ; +25> i +26> ++ +27> ) +28> { +1->Emitted(74, 1) Source(144, 1) + SourceIndex(0) +2 >Emitted(74, 4) Source(144, 4) + SourceIndex(0) +3 >Emitted(74, 5) Source(144, 5) + SourceIndex(0) +4 >Emitted(74, 6) Source(144, 6) + SourceIndex(0) +5 >Emitted(74, 7) Source(144, 6) + SourceIndex(0) +6 >Emitted(74, 51) Source(144, 90) + SourceIndex(0) +7 >Emitted(74, 53) Source(144, 8) + SourceIndex(0) +8 >Emitted(74, 67) Source(144, 23) + SourceIndex(0) +9 >Emitted(74, 69) Source(144, 8) + SourceIndex(0) +10>Emitted(74, 107) Source(144, 23) + SourceIndex(0) +11>Emitted(74, 109) Source(144, 25) + SourceIndex(0) +12>Emitted(74, 124) Source(144, 40) + SourceIndex(0) +13>Emitted(74, 126) Source(144, 25) + SourceIndex(0) +14>Emitted(74, 164) Source(144, 40) + SourceIndex(0) +15>Emitted(74, 170) Source(144, 90) + SourceIndex(0) +16>Emitted(74, 172) Source(144, 92) + SourceIndex(0) +17>Emitted(74, 173) Source(144, 93) + SourceIndex(0) +18>Emitted(74, 176) Source(144, 96) + SourceIndex(0) +19>Emitted(74, 177) Source(144, 97) + SourceIndex(0) +20>Emitted(74, 179) Source(144, 99) + SourceIndex(0) +21>Emitted(74, 180) Source(144, 100) + SourceIndex(0) +22>Emitted(74, 183) Source(144, 103) + SourceIndex(0) +23>Emitted(74, 184) Source(144, 104) + SourceIndex(0) +24>Emitted(74, 186) Source(144, 106) + SourceIndex(0) +25>Emitted(74, 187) Source(144, 107) + SourceIndex(0) +26>Emitted(74, 189) Source(144, 109) + SourceIndex(0) +27>Emitted(74, 191) Source(144, 111) + SourceIndex(0) +28>Emitted(74, 192) Source(144, 112) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(75, 5) Source(145, 5) + SourceIndex(0) +2 >Emitted(75, 12) Source(145, 12) + SourceIndex(0) +3 >Emitted(75, 13) Source(145, 13) + SourceIndex(0) +4 >Emitted(75, 16) Source(145, 16) + SourceIndex(0) +5 >Emitted(75, 17) Source(145, 17) + SourceIndex(0) +6 >Emitted(75, 22) Source(145, 22) + SourceIndex(0) +7 >Emitted(75, 23) Source(145, 23) + SourceIndex(0) +8 >Emitted(75, 24) Source(145, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(76, 1) Source(146, 1) + SourceIndex(0) +2 >Emitted(76, 2) Source(146, 2) + SourceIndex(0) +--- +>>>for ((_47 = multiRobot.name, name = _47 === void 0 ? "noName" : _47, _48 = multiRobot.skills, _49 = _48 === void 0 ? { primary: "none", secondary: "none" } : _48, _50 = _49.primary, primary = _50 === void 0 ? "primary" : _50, _51 = _49.secondary, secondary = _51 === void 0 ? "secondary" : _51, multiRobot), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^^^^ +15> ^^ +16> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +17> ^^ +18> ^^^^^^^^^^^^^^^^^^^ +19> ^^ +20> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +21> ^^ +22> ^^^^^^^^^^ +23> ^ +24> ^^ +25> ^ +26> ^^^ +27> ^ +28> ^^ +29> ^ +30> ^^^ +31> ^ +32> ^^ +33> ^ +34> ^^ +35> ^^ +36> ^ +1-> + > +2 >for +3 > +4 > ( +5 > { + > +6 > name = "noName" +7 > +8 > name = "noName" +9 > , + > +10> skills: { + > primary = "primary", + > secondary = "secondary" + > } = { primary: "none", secondary: "none" } +11> +12> skills: { + > primary = "primary", + > secondary = "secondary" + > } = { primary: "none", secondary: "none" } +13> +14> primary = "primary" +15> +16> primary = "primary" +17> , + > +18> secondary = "secondary" +19> +20> secondary = "secondary" +21> + > } = { primary: "none", secondary: "none" } + > } = +22> multiRobot +23> +24> , +25> i +26> = +27> 0 +28> ; +29> i +30> < +31> 1 +32> ; +33> i +34> ++ +35> ) +36> { +1->Emitted(77, 1) Source(147, 1) + SourceIndex(0) +2 >Emitted(77, 4) Source(147, 4) + SourceIndex(0) +3 >Emitted(77, 5) Source(147, 5) + SourceIndex(0) +4 >Emitted(77, 6) Source(147, 6) + SourceIndex(0) +5 >Emitted(77, 7) Source(148, 5) + SourceIndex(0) +6 >Emitted(77, 28) Source(148, 20) + SourceIndex(0) +7 >Emitted(77, 30) Source(148, 5) + SourceIndex(0) +8 >Emitted(77, 68) Source(148, 20) + SourceIndex(0) +9 >Emitted(77, 70) Source(149, 5) + SourceIndex(0) +10>Emitted(77, 93) Source(152, 47) + SourceIndex(0) +11>Emitted(77, 95) Source(149, 5) + SourceIndex(0) +12>Emitted(77, 162) Source(152, 47) + SourceIndex(0) +13>Emitted(77, 164) Source(150, 9) + SourceIndex(0) +14>Emitted(77, 181) Source(150, 28) + SourceIndex(0) +15>Emitted(77, 183) Source(150, 9) + SourceIndex(0) +16>Emitted(77, 225) Source(150, 28) + SourceIndex(0) +17>Emitted(77, 227) Source(151, 9) + SourceIndex(0) +18>Emitted(77, 246) Source(151, 32) + SourceIndex(0) +19>Emitted(77, 248) Source(151, 9) + SourceIndex(0) +20>Emitted(77, 294) Source(151, 32) + SourceIndex(0) +21>Emitted(77, 296) Source(153, 5) + SourceIndex(0) +22>Emitted(77, 306) Source(153, 15) + SourceIndex(0) +23>Emitted(77, 307) Source(153, 15) + SourceIndex(0) +24>Emitted(77, 309) Source(153, 17) + SourceIndex(0) +25>Emitted(77, 310) Source(153, 18) + SourceIndex(0) +26>Emitted(77, 313) Source(153, 21) + SourceIndex(0) +27>Emitted(77, 314) Source(153, 22) + SourceIndex(0) +28>Emitted(77, 316) Source(153, 24) + SourceIndex(0) +29>Emitted(77, 317) Source(153, 25) + SourceIndex(0) +30>Emitted(77, 320) Source(153, 28) + SourceIndex(0) +31>Emitted(77, 321) Source(153, 29) + SourceIndex(0) +32>Emitted(77, 323) Source(153, 31) + SourceIndex(0) +33>Emitted(77, 324) Source(153, 32) + SourceIndex(0) +34>Emitted(77, 326) Source(153, 34) + SourceIndex(0) +35>Emitted(77, 328) Source(153, 36) + SourceIndex(0) +36>Emitted(77, 329) Source(153, 37) + SourceIndex(0) +--- +>>> console.log(primaryA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > primaryA +7 > ) +8 > ; +1 >Emitted(78, 5) Source(154, 5) + SourceIndex(0) +2 >Emitted(78, 12) Source(154, 12) + SourceIndex(0) +3 >Emitted(78, 13) Source(154, 13) + SourceIndex(0) +4 >Emitted(78, 16) Source(154, 16) + SourceIndex(0) +5 >Emitted(78, 17) Source(154, 17) + SourceIndex(0) +6 >Emitted(78, 25) Source(154, 25) + SourceIndex(0) +7 >Emitted(78, 26) Source(154, 26) + SourceIndex(0) +8 >Emitted(78, 27) Source(154, 27) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(79, 1) Source(155, 1) + SourceIndex(0) +2 >Emitted(79, 2) Source(155, 2) + SourceIndex(0) +--- +>>>for ((_52 = getMultiRobot(), _53 = _52.name, name = _53 === void 0 ? "noName" : _53, _54 = _52.skills, _55 = _54 === void 0 ? { primary: "none", secondary: "none" } : _54, _56 = _55.primary, primary = _56 === void 0 ? "primary" : _56, _57 = _55.secondary, secondary = _57 === void 0 ? "secondary" : _57, _52), i = 0; i < 1; i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +15> ^^ +16> ^^^^^^^^^^^^^^^^^ +17> ^^ +18> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +19> ^^ +20> ^^^^^^^^^^^^^^^^^^^ +21> ^^ +22> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +23> ^^^^^^ +24> ^^ +25> ^ +26> ^^^ +27> ^ +28> ^^ +29> ^ +30> ^^^ +31> ^ +32> ^^ +33> ^ +34> ^^ +35> ^^ +36> ^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > { + > name = "noName", + > skills: { + > primary = "primary", + > secondary = "secondary" + > } = { primary: "none", secondary: "none" } + > } = getMultiRobot() +7 > +8 > name = "noName" +9 > +10> name = "noName" +11> , + > +12> skills: { + > primary = "primary", + > secondary = "secondary" + > } = { primary: "none", secondary: "none" } +13> +14> skills: { + > primary = "primary", + > secondary = "secondary" + > } = { primary: "none", secondary: "none" } +15> +16> primary = "primary" +17> +18> primary = "primary" +19> , + > +20> secondary = "secondary" +21> +22> secondary = "secondary" +23> + > } = { primary: "none", secondary: "none" } + > } = getMultiRobot() +24> , +25> i +26> = +27> 0 +28> ; +29> i +30> < +31> 1 +32> ; +33> i +34> ++ +35> ) +36> { +1->Emitted(80, 1) Source(156, 1) + SourceIndex(0) +2 >Emitted(80, 4) Source(156, 4) + SourceIndex(0) +3 >Emitted(80, 5) Source(156, 5) + SourceIndex(0) +4 >Emitted(80, 6) Source(156, 6) + SourceIndex(0) +5 >Emitted(80, 7) Source(156, 6) + SourceIndex(0) +6 >Emitted(80, 28) Source(162, 20) + SourceIndex(0) +7 >Emitted(80, 30) Source(157, 5) + SourceIndex(0) +8 >Emitted(80, 44) Source(157, 20) + SourceIndex(0) +9 >Emitted(80, 46) Source(157, 5) + SourceIndex(0) +10>Emitted(80, 84) Source(157, 20) + SourceIndex(0) +11>Emitted(80, 86) Source(158, 5) + SourceIndex(0) +12>Emitted(80, 102) Source(161, 47) + SourceIndex(0) +13>Emitted(80, 104) Source(158, 5) + SourceIndex(0) +14>Emitted(80, 171) Source(161, 47) + SourceIndex(0) +15>Emitted(80, 173) Source(159, 9) + SourceIndex(0) +16>Emitted(80, 190) Source(159, 28) + SourceIndex(0) +17>Emitted(80, 192) Source(159, 9) + SourceIndex(0) +18>Emitted(80, 234) Source(159, 28) + SourceIndex(0) +19>Emitted(80, 236) Source(160, 9) + SourceIndex(0) +20>Emitted(80, 255) Source(160, 32) + SourceIndex(0) +21>Emitted(80, 257) Source(160, 9) + SourceIndex(0) +22>Emitted(80, 303) Source(160, 32) + SourceIndex(0) +23>Emitted(80, 309) Source(162, 20) + SourceIndex(0) +24>Emitted(80, 311) Source(162, 22) + SourceIndex(0) +25>Emitted(80, 312) Source(162, 23) + SourceIndex(0) +26>Emitted(80, 315) Source(162, 26) + SourceIndex(0) +27>Emitted(80, 316) Source(162, 27) + SourceIndex(0) +28>Emitted(80, 318) Source(162, 29) + SourceIndex(0) +29>Emitted(80, 319) Source(162, 30) + SourceIndex(0) +30>Emitted(80, 322) Source(162, 33) + SourceIndex(0) +31>Emitted(80, 323) Source(162, 34) + SourceIndex(0) +32>Emitted(80, 325) Source(162, 36) + SourceIndex(0) +33>Emitted(80, 326) Source(162, 37) + SourceIndex(0) +34>Emitted(80, 328) Source(162, 39) + SourceIndex(0) +35>Emitted(80, 330) Source(162, 41) + SourceIndex(0) +36>Emitted(80, 331) Source(162, 42) + SourceIndex(0) +--- +>>> console.log(primaryA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > primaryA +7 > ) +8 > ; +1 >Emitted(81, 5) Source(163, 5) + SourceIndex(0) +2 >Emitted(81, 12) Source(163, 12) + SourceIndex(0) +3 >Emitted(81, 13) Source(163, 13) + SourceIndex(0) +4 >Emitted(81, 16) Source(163, 16) + SourceIndex(0) +5 >Emitted(81, 17) Source(163, 17) + SourceIndex(0) +6 >Emitted(81, 25) Source(163, 25) + SourceIndex(0) +7 >Emitted(81, 26) Source(163, 26) + SourceIndex(0) +8 >Emitted(81, 27) Source(163, 27) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(82, 1) Source(164, 1) + SourceIndex(0) +2 >Emitted(82, 2) Source(164, 2) + SourceIndex(0) +--- +>>>for ((_58 = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, _59 = _58.name, name = _59 === void 0 ? "noName" : _59, _60 = _58.skills, _61 = _60 === void 0 ? { primary: "none", secondary: "none" } : _60, _62 = _61.primary, primary = _62 === void 0 ? "primary" : _62, _63 = _61.secondary, secondary = _63 === void 0 ? "secondary" : _63, _58), +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +15> ^^ +16> ^^^^^^^^^^^^^^^^^ +17> ^^ +18> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +19> ^^ +20> ^^^^^^^^^^^^^^^^^^^ +21> ^^ +22> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +23> ^^^^^^ +1-> + > +2 >for +3 > +4 > ( +5 > +6 > { + > name = "noName", + > skills: { + > primary = "primary", + > secondary = "secondary" + > } = { primary: "none", secondary: "none" } + > } = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } } +7 > +8 > name = "noName" +9 > +10> name = "noName" +11> , + > +12> skills: { + > primary = "primary", + > secondary = "secondary" + > } = { primary: "none", secondary: "none" } +13> +14> skills: { + > primary = "primary", + > secondary = "secondary" + > } = { primary: "none", secondary: "none" } +15> +16> primary = "primary" +17> +18> primary = "primary" +19> , + > +20> secondary = "secondary" +21> +22> secondary = "secondary" +23> + > } = { primary: "none", secondary: "none" } + > } = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } } +1->Emitted(83, 1) Source(165, 1) + SourceIndex(0) +2 >Emitted(83, 4) Source(165, 4) + SourceIndex(0) +3 >Emitted(83, 5) Source(165, 5) + SourceIndex(0) +4 >Emitted(83, 6) Source(165, 6) + SourceIndex(0) +5 >Emitted(83, 7) Source(165, 6) + SourceIndex(0) +6 >Emitted(83, 86) Source(171, 90) + SourceIndex(0) +7 >Emitted(83, 88) Source(166, 5) + SourceIndex(0) +8 >Emitted(83, 102) Source(166, 20) + SourceIndex(0) +9 >Emitted(83, 104) Source(166, 5) + SourceIndex(0) +10>Emitted(83, 142) Source(166, 20) + SourceIndex(0) +11>Emitted(83, 144) Source(167, 5) + SourceIndex(0) +12>Emitted(83, 160) Source(170, 47) + SourceIndex(0) +13>Emitted(83, 162) Source(167, 5) + SourceIndex(0) +14>Emitted(83, 229) Source(170, 47) + SourceIndex(0) +15>Emitted(83, 231) Source(168, 9) + SourceIndex(0) +16>Emitted(83, 248) Source(168, 28) + SourceIndex(0) +17>Emitted(83, 250) Source(168, 9) + SourceIndex(0) +18>Emitted(83, 292) Source(168, 28) + SourceIndex(0) +19>Emitted(83, 294) Source(169, 9) + SourceIndex(0) +20>Emitted(83, 313) Source(169, 32) + SourceIndex(0) +21>Emitted(83, 315) Source(169, 9) + SourceIndex(0) +22>Emitted(83, 361) Source(169, 32) + SourceIndex(0) +23>Emitted(83, 367) Source(171, 90) + SourceIndex(0) +--- +>>> i = 0; i < 1; i++) { +1 >^^^^ +2 > ^ +3 > ^^^ +4 > ^ +5 > ^^ +6 > ^ +7 > ^^^ +8 > ^ +9 > ^^ +10> ^ +11> ^^ +12> ^^ +13> ^ +14> ^^^-> +1 >, + > +2 > i +3 > = +4 > 0 +5 > ; +6 > i +7 > < +8 > 1 +9 > ; +10> i +11> ++ +12> ) +13> { +1 >Emitted(84, 5) Source(172, 5) + SourceIndex(0) +2 >Emitted(84, 6) Source(172, 6) + SourceIndex(0) +3 >Emitted(84, 9) Source(172, 9) + SourceIndex(0) +4 >Emitted(84, 10) Source(172, 10) + SourceIndex(0) +5 >Emitted(84, 12) Source(172, 12) + SourceIndex(0) +6 >Emitted(84, 13) Source(172, 13) + SourceIndex(0) +7 >Emitted(84, 16) Source(172, 16) + SourceIndex(0) +8 >Emitted(84, 17) Source(172, 17) + SourceIndex(0) +9 >Emitted(84, 19) Source(172, 19) + SourceIndex(0) +10>Emitted(84, 20) Source(172, 20) + SourceIndex(0) +11>Emitted(84, 22) Source(172, 22) + SourceIndex(0) +12>Emitted(84, 24) Source(172, 24) + SourceIndex(0) +13>Emitted(84, 25) Source(172, 25) + SourceIndex(0) +--- +>>> console.log(primaryA); +1->^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1-> + > +2 > console +3 > . +4 > log +5 > ( +6 > primaryA +7 > ) +8 > ; +1->Emitted(85, 5) Source(173, 5) + SourceIndex(0) +2 >Emitted(85, 12) Source(173, 12) + SourceIndex(0) +3 >Emitted(85, 13) Source(173, 13) + SourceIndex(0) +4 >Emitted(85, 16) Source(173, 16) + SourceIndex(0) +5 >Emitted(85, 17) Source(173, 17) + SourceIndex(0) +6 >Emitted(85, 25) Source(173, 25) + SourceIndex(0) +7 >Emitted(85, 26) Source(173, 26) + SourceIndex(0) +8 >Emitted(85, 27) Source(173, 27) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(86, 1) Source(174, 1) + SourceIndex(0) +2 >Emitted(86, 2) Source(174, 2) + SourceIndex(0) +--- +>>>var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63; +>>>//# sourceMappingURL=sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.symbols b/tests/baselines/reference/sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.symbols new file mode 100644 index 00000000000..86e1e28dd0c --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.symbols @@ -0,0 +1,628 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts === +declare var console: { +>console : Symbol(console, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 0, 11)) + + log(msg: any): void; +>log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 0, 22)) +>msg : Symbol(msg, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 1, 8)) +} +interface Robot { +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 2, 1)) + + name: string; +>name : Symbol(Robot.name, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 3, 17)) + + skill: string; +>skill : Symbol(Robot.skill, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 4, 17)) +} + +interface MultiRobot { +>MultiRobot : Symbol(MultiRobot, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 6, 1)) + + name: string; +>name : Symbol(MultiRobot.name, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 8, 22)) + + skills: { +>skills : Symbol(MultiRobot.skills, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 9, 17)) + + primary?: string; +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 10, 13)) + + secondary?: string; +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 11, 25)) + + }; +} + +let robot: Robot = { name: "mower", skill: "mowing" }; +>robot : Symbol(robot, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 16, 3)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 2, 1)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 16, 20)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 16, 35)) + +let multiRobot: MultiRobot = { name: "mower", skills: { primary: "mowing", secondary: "none" } }; +>multiRobot : Symbol(multiRobot, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 17, 3)) +>MultiRobot : Symbol(MultiRobot, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 6, 1)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 17, 30)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 17, 45)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 17, 55)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 17, 74)) + +function getRobot() { +>getRobot : Symbol(getRobot, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 17, 97)) + + return robot; +>robot : Symbol(robot, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 16, 3)) +} +function getMultiRobot() { +>getMultiRobot : Symbol(getMultiRobot, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 20, 1)) + + return multiRobot; +>multiRobot : Symbol(multiRobot, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 17, 3)) +} + +let nameA: string, primaryA: string, secondaryA: string, i: number, skillA: string; +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 3)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 18)) +>secondaryA : Symbol(secondaryA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 36)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 56)) +>skillA : Symbol(skillA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 67)) + +let name: string, primary: string, secondary: string, skill: string; +>name : Symbol(name, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 26, 3)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 26, 17)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 26, 34)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 26, 53)) + +for ({name: nameA = "noName" } = robot, i = 0; i < 1; i++) { +>name : Symbol(name, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 28, 6)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 3)) +>robot : Symbol(robot, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 16, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 56)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 3)) +} +for ({name: nameA = "noName" } = getRobot(), i = 0; i < 1; i++) { +>name : Symbol(name, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 31, 6)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 3)) +>getRobot : Symbol(getRobot, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 17, 97)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 56)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 3)) +} +for ({name: nameA = "noName" } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { +>name : Symbol(name, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 34, 6)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 3)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 2, 1)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 34, 41)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 34, 58)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 56)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 3)) +} +for ({ + skills: { +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 37, 6)) + + primary: primaryA = "primary", +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 38, 13)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 18)) + + secondary: secondaryA = "secondary" +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 39, 38)) +>secondaryA : Symbol(secondaryA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 36)) + + } = { primary: "none", secondary: "none" } +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 41, 9)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 41, 26)) + +} = multiRobot, i = 0; i < 1; i++) { +>multiRobot : Symbol(multiRobot, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 17, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 56)) + + console.log(primaryA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 0, 22)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 18)) +} +for ({ + skills: { +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 45, 6)) + + primary: primaryA = "primary", +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 46, 13)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 18)) + + secondary: secondaryA = "secondary" +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 47, 38)) +>secondaryA : Symbol(secondaryA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 36)) + + } = { primary: "none", secondary: "none" } +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 49, 9)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 49, 26)) + +} = getMultiRobot(), i = 0; i < 1; i++) { +>getMultiRobot : Symbol(getMultiRobot, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 20, 1)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 56)) + + console.log(primaryA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 0, 22)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 18)) +} +for ({ + skills: { +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 53, 6)) + + primary: primaryA = "primary", +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 54, 13)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 18)) + + secondary: secondaryA = "secondary" +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 55, 38)) +>secondaryA : Symbol(secondaryA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 36)) + + } = { primary: "none", secondary: "none" } +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 57, 9)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 57, 26)) + +} = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, +>MultiRobot : Symbol(MultiRobot, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 6, 1)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 58, 17)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 58, 34)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 58, 44)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 58, 65)) + + i = 0; i < 1; i++) { +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 56)) + + console.log(primaryA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 0, 22)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 18)) +} + +for ({ name = "noName" } = robot, i = 0; i < 1; i++) { +>name : Symbol(name, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 63, 6)) +>robot : Symbol(robot, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 16, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 56)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 3)) +} +for ({ name = "noName" } = getRobot(), i = 0; i < 1; i++) { +>name : Symbol(name, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 66, 6)) +>getRobot : Symbol(getRobot, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 17, 97)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 56)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 3)) +} +for ({ name = "noName" } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { +>name : Symbol(name, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 69, 6)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 2, 1)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 69, 35)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 69, 52)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 56)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 3)) +} +for ({ + skills: { +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 72, 6)) + + primary = "primary", +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 73, 13)) + + secondary = "secondary" +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 74, 28)) + + } = { primary: "none", secondary: "none" } +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 76, 9)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 76, 26)) + +} = multiRobot, i = 0; i < 1; i++) { +>multiRobot : Symbol(multiRobot, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 17, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 56)) + + console.log(primaryA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 0, 22)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 18)) +} +for ({ + skills: { +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 80, 6)) + + primary = "primary", +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 81, 13)) + + secondary = "secondary" +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 82, 28)) + + } = { primary: "none", secondary: "none" } +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 84, 9)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 84, 26)) + +} = getMultiRobot(), i = 0; i < 1; i++) { +>getMultiRobot : Symbol(getMultiRobot, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 20, 1)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 56)) + + console.log(primaryA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 0, 22)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 18)) +} +for ({ + skills: { +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 88, 6)) + + primary = "primary", +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 89, 13)) + + secondary = "secondary" +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 90, 28)) + + } = { primary: "none", secondary: "none" } +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 92, 9)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 92, 26)) + +} = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, +>MultiRobot : Symbol(MultiRobot, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 6, 1)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 93, 17)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 93, 34)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 93, 44)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 93, 65)) + + i = 0; i < 1; i++) { +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 56)) + + console.log(primaryA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 0, 22)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 18)) +} + + +for ({name: nameA = "noName", skill: skillA = "skill" } = robot, i = 0; i < 1; i++) { +>name : Symbol(name, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 99, 6)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 3)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 99, 29)) +>skillA : Symbol(skillA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 67)) +>robot : Symbol(robot, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 16, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 56)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 3)) +} +for ({name: nameA = "noName", skill: skillA = "skill" } = getRobot(), i = 0; i < 1; i++) { +>name : Symbol(name, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 102, 6)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 3)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 102, 29)) +>skillA : Symbol(skillA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 67)) +>getRobot : Symbol(getRobot, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 17, 97)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 56)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 3)) +} +for ({name: nameA = "noName", skill: skillA = "skill" } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { +>name : Symbol(name, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 105, 6)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 3)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 105, 29)) +>skillA : Symbol(skillA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 67)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 2, 1)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 105, 66)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 105, 83)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 56)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 3)) +} +for ({ + name: nameA = "noName", +>name : Symbol(name, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 108, 6)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 3)) + + skills: { +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 109, 27)) + + primary: primaryA = "primary", +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 110, 13)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 18)) + + secondary: secondaryA = "secondary" +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 111, 38)) +>secondaryA : Symbol(secondaryA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 36)) + + } = { primary: "none", secondary: "none" } +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 113, 9)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 113, 26)) + +} = multiRobot, i = 0; i < 1; i++) { +>multiRobot : Symbol(multiRobot, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 17, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 56)) + + console.log(primaryA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 0, 22)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 18)) +} +for ({ + name: nameA = "noName", +>name : Symbol(name, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 117, 6)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 3)) + + skills: { +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 118, 27)) + + primary: primaryA = "primary", +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 119, 13)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 18)) + + secondary: secondaryA = "secondary" +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 120, 38)) +>secondaryA : Symbol(secondaryA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 36)) + + } = { primary: "none", secondary: "none" } +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 122, 9)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 122, 26)) + +} = getMultiRobot(), i = 0; i < 1; i++) { +>getMultiRobot : Symbol(getMultiRobot, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 20, 1)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 56)) + + console.log(primaryA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 0, 22)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 18)) +} +for ({ + name: nameA = "noName", +>name : Symbol(name, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 126, 6)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 3)) + + skills: { +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 127, 27)) + + primary: primaryA = "primary", +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 128, 13)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 18)) + + secondary: secondaryA = "secondary" +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 129, 38)) +>secondaryA : Symbol(secondaryA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 36)) + + } = { primary: "none", secondary: "none" } +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 131, 9)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 131, 26)) + +} = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, +>MultiRobot : Symbol(MultiRobot, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 6, 1)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 132, 17)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 132, 34)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 132, 44)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 132, 65)) + + i = 0; i < 1; i++) { +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 56)) + + console.log(primaryA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 0, 22)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 18)) +} + +for ({ name = "noName", skill = "skill" } = robot, i = 0; i < 1; i++) { +>name : Symbol(name, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 137, 6)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 137, 23)) +>robot : Symbol(robot, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 16, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 56)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 3)) +} +for ({ name = "noName", skill = "skill" } = getRobot(), i = 0; i < 1; i++) { +>name : Symbol(name, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 140, 6)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 140, 23)) +>getRobot : Symbol(getRobot, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 17, 97)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 56)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 3)) +} +for ({ name = "noName", skill = "skill" } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { +>name : Symbol(name, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 143, 6)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 143, 23)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 2, 1)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 143, 52)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 143, 69)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 56)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 3)) +} +for ({ + name = "noName", +>name : Symbol(name, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 146, 6)) + + skills: { +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 147, 20)) + + primary = "primary", +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 148, 13)) + + secondary = "secondary" +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 149, 28)) + + } = { primary: "none", secondary: "none" } +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 151, 9)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 151, 26)) + +} = multiRobot, i = 0; i < 1; i++) { +>multiRobot : Symbol(multiRobot, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 17, 3)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 56)) + + console.log(primaryA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 0, 22)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 18)) +} +for ({ + name = "noName", +>name : Symbol(name, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 155, 6)) + + skills: { +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 156, 20)) + + primary = "primary", +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 157, 13)) + + secondary = "secondary" +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 158, 28)) + + } = { primary: "none", secondary: "none" } +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 160, 9)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 160, 26)) + +} = getMultiRobot(), i = 0; i < 1; i++) { +>getMultiRobot : Symbol(getMultiRobot, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 20, 1)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 56)) + + console.log(primaryA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 0, 22)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 18)) +} +for ({ + name = "noName", +>name : Symbol(name, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 164, 6)) + + skills: { +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 165, 20)) + + primary = "primary", +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 166, 13)) + + secondary = "secondary" +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 167, 28)) + + } = { primary: "none", secondary: "none" } +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 169, 9)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 169, 26)) + +} = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, +>MultiRobot : Symbol(MultiRobot, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 6, 1)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 170, 17)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 170, 34)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 170, 44)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 170, 65)) + + i = 0; i < 1; i++) { +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 56)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 56)) + + console.log(primaryA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 0, 22)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts, 25, 18)) +} diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.types b/tests/baselines/reference/sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.types new file mode 100644 index 00000000000..aa8c95bae01 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.types @@ -0,0 +1,1020 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts === +declare var console: { +>console : { log(msg: any): void; } + + log(msg: any): void; +>log : (msg: any) => void +>msg : any +} +interface Robot { +>Robot : Robot + + name: string; +>name : string + + skill: string; +>skill : string +} + +interface MultiRobot { +>MultiRobot : MultiRobot + + name: string; +>name : string + + skills: { +>skills : { primary?: string; secondary?: string; } + + primary?: string; +>primary : string + + secondary?: string; +>secondary : string + + }; +} + +let robot: Robot = { name: "mower", skill: "mowing" }; +>robot : Robot +>Robot : Robot +>{ name: "mower", skill: "mowing" } : { name: string; skill: string; } +>name : string +>"mower" : string +>skill : string +>"mowing" : string + +let multiRobot: MultiRobot = { name: "mower", skills: { primary: "mowing", secondary: "none" } }; +>multiRobot : MultiRobot +>MultiRobot : MultiRobot +>{ name: "mower", skills: { primary: "mowing", secondary: "none" } } : { name: string; skills: { primary: string; secondary: string; }; } +>name : string +>"mower" : string +>skills : { primary: string; secondary: string; } +>{ primary: "mowing", secondary: "none" } : { primary: string; secondary: string; } +>primary : string +>"mowing" : string +>secondary : string +>"none" : string + +function getRobot() { +>getRobot : () => Robot + + return robot; +>robot : Robot +} +function getMultiRobot() { +>getMultiRobot : () => MultiRobot + + return multiRobot; +>multiRobot : MultiRobot +} + +let nameA: string, primaryA: string, secondaryA: string, i: number, skillA: string; +>nameA : string +>primaryA : string +>secondaryA : string +>i : number +>skillA : string + +let name: string, primary: string, secondary: string, skill: string; +>name : string +>primary : string +>secondary : string +>skill : string + +for ({name: nameA = "noName" } = robot, i = 0; i < 1; i++) { +>{name: nameA = "noName" } = robot, i = 0 : number +>{name: nameA = "noName" } = robot : Robot +>{name: nameA = "noName" } : { name?: string; } +>name : string +>nameA = "noName" : string +>nameA : string +>"noName" : string +>robot : Robot +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for ({name: nameA = "noName" } = getRobot(), i = 0; i < 1; i++) { +>{name: nameA = "noName" } = getRobot(), i = 0 : number +>{name: nameA = "noName" } = getRobot() : Robot +>{name: nameA = "noName" } : { name?: string; } +>name : string +>nameA = "noName" : string +>nameA : string +>"noName" : string +>getRobot() : Robot +>getRobot : () => Robot +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for ({name: nameA = "noName" } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { +>{name: nameA = "noName" } = { name: "trimmer", skill: "trimming" }, i = 0 : number +>{name: nameA = "noName" } = { name: "trimmer", skill: "trimming" } : Robot +>{name: nameA = "noName" } : { name?: string; } +>name : string +>nameA = "noName" : string +>nameA : string +>"noName" : string +>{ name: "trimmer", skill: "trimming" } : Robot +>Robot : Robot +>{ name: "trimmer", skill: "trimming" } : { name: string; skill: string; } +>name : string +>"trimmer" : string +>skill : string +>"trimming" : string +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for ({ +>{ skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = { primary: "none", secondary: "none" }} = multiRobot, i = 0 : number +>{ skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = { primary: "none", secondary: "none" }} = multiRobot : MultiRobot +>{ skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = { primary: "none", secondary: "none" }} : { skills?: { primary?: string; secondary?: string; }; } + + skills: { +>skills : { primary?: string; secondary?: string; } +>{ primary: primaryA = "primary", secondary: secondaryA = "secondary" } = { primary: "none", secondary: "none" } : { primary?: string; secondary?: string; } +>{ primary: primaryA = "primary", secondary: secondaryA = "secondary" } : { primary?: string; secondary?: string; } + + primary: primaryA = "primary", +>primary : string +>primaryA = "primary" : string +>primaryA : string +>"primary" : string + + secondary: secondaryA = "secondary" +>secondary : string +>secondaryA = "secondary" : string +>secondaryA : string +>"secondary" : string + + } = { primary: "none", secondary: "none" } +>{ primary: "none", secondary: "none" } : { primary?: string; secondary?: string; } +>primary : string +>"none" : string +>secondary : string +>"none" : string + +} = multiRobot, i = 0; i < 1; i++) { +>multiRobot : MultiRobot +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(primaryA); +>console.log(primaryA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primaryA : string +} +for ({ +>{ skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = { primary: "none", secondary: "none" }} = getMultiRobot(), i = 0 : number +>{ skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = { primary: "none", secondary: "none" }} = getMultiRobot() : MultiRobot +>{ skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = { primary: "none", secondary: "none" }} : { skills?: { primary?: string; secondary?: string; }; } + + skills: { +>skills : { primary?: string; secondary?: string; } +>{ primary: primaryA = "primary", secondary: secondaryA = "secondary" } = { primary: "none", secondary: "none" } : { primary?: string; secondary?: string; } +>{ primary: primaryA = "primary", secondary: secondaryA = "secondary" } : { primary?: string; secondary?: string; } + + primary: primaryA = "primary", +>primary : string +>primaryA = "primary" : string +>primaryA : string +>"primary" : string + + secondary: secondaryA = "secondary" +>secondary : string +>secondaryA = "secondary" : string +>secondaryA : string +>"secondary" : string + + } = { primary: "none", secondary: "none" } +>{ primary: "none", secondary: "none" } : { primary?: string; secondary?: string; } +>primary : string +>"none" : string +>secondary : string +>"none" : string + +} = getMultiRobot(), i = 0; i < 1; i++) { +>getMultiRobot() : MultiRobot +>getMultiRobot : () => MultiRobot +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(primaryA); +>console.log(primaryA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primaryA : string +} +for ({ +>{ skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = { primary: "none", secondary: "none" }} = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, i = 0 : number +>{ skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = { primary: "none", secondary: "none" }} = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } } : MultiRobot +>{ skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = { primary: "none", secondary: "none" }} : { skills?: { primary?: string; secondary?: string; }; } + + skills: { +>skills : { primary?: string; secondary?: string; } +>{ primary: primaryA = "primary", secondary: secondaryA = "secondary" } = { primary: "none", secondary: "none" } : { primary?: string; secondary?: string; } +>{ primary: primaryA = "primary", secondary: secondaryA = "secondary" } : { primary?: string; secondary?: string; } + + primary: primaryA = "primary", +>primary : string +>primaryA = "primary" : string +>primaryA : string +>"primary" : string + + secondary: secondaryA = "secondary" +>secondary : string +>secondaryA = "secondary" : string +>secondaryA : string +>"secondary" : string + + } = { primary: "none", secondary: "none" } +>{ primary: "none", secondary: "none" } : { primary?: string; secondary?: string; } +>primary : string +>"none" : string +>secondary : string +>"none" : string + +} = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, +>{ name: "trimmer", skills: { primary: "trimming", secondary: "edging" } } : MultiRobot +>MultiRobot : MultiRobot +>{ name: "trimmer", skills: { primary: "trimming", secondary: "edging" } } : { name: string; skills: { primary: string; secondary: string; }; } +>name : string +>"trimmer" : string +>skills : { primary: string; secondary: string; } +>{ primary: "trimming", secondary: "edging" } : { primary: string; secondary: string; } +>primary : string +>"trimming" : string +>secondary : string +>"edging" : string + + i = 0; i < 1; i++) { +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(primaryA); +>console.log(primaryA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primaryA : string +} + +for ({ name = "noName" } = robot, i = 0; i < 1; i++) { +>{ name = "noName" } = robot, i = 0 : number +>{ name = "noName" } = robot : Robot +>{ name = "noName" } : { name?: string; } +>name : string +>robot : Robot +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for ({ name = "noName" } = getRobot(), i = 0; i < 1; i++) { +>{ name = "noName" } = getRobot(), i = 0 : number +>{ name = "noName" } = getRobot() : Robot +>{ name = "noName" } : { name?: string; } +>name : string +>getRobot() : Robot +>getRobot : () => Robot +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for ({ name = "noName" } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { +>{ name = "noName" } = { name: "trimmer", skill: "trimming" }, i = 0 : number +>{ name = "noName" } = { name: "trimmer", skill: "trimming" } : Robot +>{ name = "noName" } : { name?: string; } +>name : string +>{ name: "trimmer", skill: "trimming" } : Robot +>Robot : Robot +>{ name: "trimmer", skill: "trimming" } : { name: string; skill: string; } +>name : string +>"trimmer" : string +>skill : string +>"trimming" : string +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for ({ +>{ skills: { primary = "primary", secondary = "secondary" } = { primary: "none", secondary: "none" }} = multiRobot, i = 0 : number +>{ skills: { primary = "primary", secondary = "secondary" } = { primary: "none", secondary: "none" }} = multiRobot : MultiRobot +>{ skills: { primary = "primary", secondary = "secondary" } = { primary: "none", secondary: "none" }} : { skills?: { primary?: string; secondary?: string; }; } + + skills: { +>skills : { primary?: string; secondary?: string; } +>{ primary = "primary", secondary = "secondary" } = { primary: "none", secondary: "none" } : { primary?: string; secondary?: string; } +>{ primary = "primary", secondary = "secondary" } : { primary?: string; secondary?: string; } + + primary = "primary", +>primary : string + + secondary = "secondary" +>secondary : string + + } = { primary: "none", secondary: "none" } +>{ primary: "none", secondary: "none" } : { primary?: string; secondary?: string; } +>primary : string +>"none" : string +>secondary : string +>"none" : string + +} = multiRobot, i = 0; i < 1; i++) { +>multiRobot : MultiRobot +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(primaryA); +>console.log(primaryA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primaryA : string +} +for ({ +>{ skills: { primary = "primary", secondary = "secondary" } = { primary: "none", secondary: "none" }} = getMultiRobot(), i = 0 : number +>{ skills: { primary = "primary", secondary = "secondary" } = { primary: "none", secondary: "none" }} = getMultiRobot() : MultiRobot +>{ skills: { primary = "primary", secondary = "secondary" } = { primary: "none", secondary: "none" }} : { skills?: { primary?: string; secondary?: string; }; } + + skills: { +>skills : { primary?: string; secondary?: string; } +>{ primary = "primary", secondary = "secondary" } = { primary: "none", secondary: "none" } : { primary?: string; secondary?: string; } +>{ primary = "primary", secondary = "secondary" } : { primary?: string; secondary?: string; } + + primary = "primary", +>primary : string + + secondary = "secondary" +>secondary : string + + } = { primary: "none", secondary: "none" } +>{ primary: "none", secondary: "none" } : { primary?: string; secondary?: string; } +>primary : string +>"none" : string +>secondary : string +>"none" : string + +} = getMultiRobot(), i = 0; i < 1; i++) { +>getMultiRobot() : MultiRobot +>getMultiRobot : () => MultiRobot +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(primaryA); +>console.log(primaryA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primaryA : string +} +for ({ +>{ skills: { primary = "primary", secondary = "secondary" } = { primary: "none", secondary: "none" }} = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, i = 0 : number +>{ skills: { primary = "primary", secondary = "secondary" } = { primary: "none", secondary: "none" }} = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } } : MultiRobot +>{ skills: { primary = "primary", secondary = "secondary" } = { primary: "none", secondary: "none" }} : { skills?: { primary?: string; secondary?: string; }; } + + skills: { +>skills : { primary?: string; secondary?: string; } +>{ primary = "primary", secondary = "secondary" } = { primary: "none", secondary: "none" } : { primary?: string; secondary?: string; } +>{ primary = "primary", secondary = "secondary" } : { primary?: string; secondary?: string; } + + primary = "primary", +>primary : string + + secondary = "secondary" +>secondary : string + + } = { primary: "none", secondary: "none" } +>{ primary: "none", secondary: "none" } : { primary?: string; secondary?: string; } +>primary : string +>"none" : string +>secondary : string +>"none" : string + +} = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, +>{ name: "trimmer", skills: { primary: "trimming", secondary: "edging" } } : MultiRobot +>MultiRobot : MultiRobot +>{ name: "trimmer", skills: { primary: "trimming", secondary: "edging" } } : { name: string; skills: { primary: string; secondary: string; }; } +>name : string +>"trimmer" : string +>skills : { primary: string; secondary: string; } +>{ primary: "trimming", secondary: "edging" } : { primary: string; secondary: string; } +>primary : string +>"trimming" : string +>secondary : string +>"edging" : string + + i = 0; i < 1; i++) { +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(primaryA); +>console.log(primaryA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primaryA : string +} + + +for ({name: nameA = "noName", skill: skillA = "skill" } = robot, i = 0; i < 1; i++) { +>{name: nameA = "noName", skill: skillA = "skill" } = robot, i = 0 : number +>{name: nameA = "noName", skill: skillA = "skill" } = robot : Robot +>{name: nameA = "noName", skill: skillA = "skill" } : { name?: string; skill?: string; } +>name : string +>nameA = "noName" : string +>nameA : string +>"noName" : string +>skill : string +>skillA = "skill" : string +>skillA : string +>"skill" : string +>robot : Robot +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for ({name: nameA = "noName", skill: skillA = "skill" } = getRobot(), i = 0; i < 1; i++) { +>{name: nameA = "noName", skill: skillA = "skill" } = getRobot(), i = 0 : number +>{name: nameA = "noName", skill: skillA = "skill" } = getRobot() : Robot +>{name: nameA = "noName", skill: skillA = "skill" } : { name?: string; skill?: string; } +>name : string +>nameA = "noName" : string +>nameA : string +>"noName" : string +>skill : string +>skillA = "skill" : string +>skillA : string +>"skill" : string +>getRobot() : Robot +>getRobot : () => Robot +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for ({name: nameA = "noName", skill: skillA = "skill" } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { +>{name: nameA = "noName", skill: skillA = "skill" } = { name: "trimmer", skill: "trimming" }, i = 0 : number +>{name: nameA = "noName", skill: skillA = "skill" } = { name: "trimmer", skill: "trimming" } : Robot +>{name: nameA = "noName", skill: skillA = "skill" } : { name?: string; skill?: string; } +>name : string +>nameA = "noName" : string +>nameA : string +>"noName" : string +>skill : string +>skillA = "skill" : string +>skillA : string +>"skill" : string +>{ name: "trimmer", skill: "trimming" } : Robot +>Robot : Robot +>{ name: "trimmer", skill: "trimming" } : { name: string; skill: string; } +>name : string +>"trimmer" : string +>skill : string +>"trimming" : string +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for ({ +>{ name: nameA = "noName", skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = { primary: "none", secondary: "none" }} = multiRobot, i = 0 : number +>{ name: nameA = "noName", skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = { primary: "none", secondary: "none" }} = multiRobot : MultiRobot +>{ name: nameA = "noName", skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = { primary: "none", secondary: "none" }} : { name?: string; skills?: { primary?: string; secondary?: string; }; } + + name: nameA = "noName", +>name : string +>nameA = "noName" : string +>nameA : string +>"noName" : string + + skills: { +>skills : { primary?: string; secondary?: string; } +>{ primary: primaryA = "primary", secondary: secondaryA = "secondary" } = { primary: "none", secondary: "none" } : { primary?: string; secondary?: string; } +>{ primary: primaryA = "primary", secondary: secondaryA = "secondary" } : { primary?: string; secondary?: string; } + + primary: primaryA = "primary", +>primary : string +>primaryA = "primary" : string +>primaryA : string +>"primary" : string + + secondary: secondaryA = "secondary" +>secondary : string +>secondaryA = "secondary" : string +>secondaryA : string +>"secondary" : string + + } = { primary: "none", secondary: "none" } +>{ primary: "none", secondary: "none" } : { primary?: string; secondary?: string; } +>primary : string +>"none" : string +>secondary : string +>"none" : string + +} = multiRobot, i = 0; i < 1; i++) { +>multiRobot : MultiRobot +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(primaryA); +>console.log(primaryA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primaryA : string +} +for ({ +>{ name: nameA = "noName", skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = { primary: "none", secondary: "none" }} = getMultiRobot(), i = 0 : number +>{ name: nameA = "noName", skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = { primary: "none", secondary: "none" }} = getMultiRobot() : MultiRobot +>{ name: nameA = "noName", skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = { primary: "none", secondary: "none" }} : { name?: string; skills?: { primary?: string; secondary?: string; }; } + + name: nameA = "noName", +>name : string +>nameA = "noName" : string +>nameA : string +>"noName" : string + + skills: { +>skills : { primary?: string; secondary?: string; } +>{ primary: primaryA = "primary", secondary: secondaryA = "secondary" } = { primary: "none", secondary: "none" } : { primary?: string; secondary?: string; } +>{ primary: primaryA = "primary", secondary: secondaryA = "secondary" } : { primary?: string; secondary?: string; } + + primary: primaryA = "primary", +>primary : string +>primaryA = "primary" : string +>primaryA : string +>"primary" : string + + secondary: secondaryA = "secondary" +>secondary : string +>secondaryA = "secondary" : string +>secondaryA : string +>"secondary" : string + + } = { primary: "none", secondary: "none" } +>{ primary: "none", secondary: "none" } : { primary?: string; secondary?: string; } +>primary : string +>"none" : string +>secondary : string +>"none" : string + +} = getMultiRobot(), i = 0; i < 1; i++) { +>getMultiRobot() : MultiRobot +>getMultiRobot : () => MultiRobot +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(primaryA); +>console.log(primaryA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primaryA : string +} +for ({ +>{ name: nameA = "noName", skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = { primary: "none", secondary: "none" }} = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, i = 0 : number +>{ name: nameA = "noName", skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = { primary: "none", secondary: "none" }} = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } } : MultiRobot +>{ name: nameA = "noName", skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = { primary: "none", secondary: "none" }} : { name?: string; skills?: { primary?: string; secondary?: string; }; } + + name: nameA = "noName", +>name : string +>nameA = "noName" : string +>nameA : string +>"noName" : string + + skills: { +>skills : { primary?: string; secondary?: string; } +>{ primary: primaryA = "primary", secondary: secondaryA = "secondary" } = { primary: "none", secondary: "none" } : { primary?: string; secondary?: string; } +>{ primary: primaryA = "primary", secondary: secondaryA = "secondary" } : { primary?: string; secondary?: string; } + + primary: primaryA = "primary", +>primary : string +>primaryA = "primary" : string +>primaryA : string +>"primary" : string + + secondary: secondaryA = "secondary" +>secondary : string +>secondaryA = "secondary" : string +>secondaryA : string +>"secondary" : string + + } = { primary: "none", secondary: "none" } +>{ primary: "none", secondary: "none" } : { primary?: string; secondary?: string; } +>primary : string +>"none" : string +>secondary : string +>"none" : string + +} = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, +>{ name: "trimmer", skills: { primary: "trimming", secondary: "edging" } } : MultiRobot +>MultiRobot : MultiRobot +>{ name: "trimmer", skills: { primary: "trimming", secondary: "edging" } } : { name: string; skills: { primary: string; secondary: string; }; } +>name : string +>"trimmer" : string +>skills : { primary: string; secondary: string; } +>{ primary: "trimming", secondary: "edging" } : { primary: string; secondary: string; } +>primary : string +>"trimming" : string +>secondary : string +>"edging" : string + + i = 0; i < 1; i++) { +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(primaryA); +>console.log(primaryA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primaryA : string +} + +for ({ name = "noName", skill = "skill" } = robot, i = 0; i < 1; i++) { +>{ name = "noName", skill = "skill" } = robot, i = 0 : number +>{ name = "noName", skill = "skill" } = robot : Robot +>{ name = "noName", skill = "skill" } : { name?: string; skill?: string; } +>name : string +>skill : string +>robot : Robot +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for ({ name = "noName", skill = "skill" } = getRobot(), i = 0; i < 1; i++) { +>{ name = "noName", skill = "skill" } = getRobot(), i = 0 : number +>{ name = "noName", skill = "skill" } = getRobot() : Robot +>{ name = "noName", skill = "skill" } : { name?: string; skill?: string; } +>name : string +>skill : string +>getRobot() : Robot +>getRobot : () => Robot +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for ({ name = "noName", skill = "skill" } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { +>{ name = "noName", skill = "skill" } = { name: "trimmer", skill: "trimming" }, i = 0 : number +>{ name = "noName", skill = "skill" } = { name: "trimmer", skill: "trimming" } : Robot +>{ name = "noName", skill = "skill" } : { name?: string; skill?: string; } +>name : string +>skill : string +>{ name: "trimmer", skill: "trimming" } : Robot +>Robot : Robot +>{ name: "trimmer", skill: "trimming" } : { name: string; skill: string; } +>name : string +>"trimmer" : string +>skill : string +>"trimming" : string +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for ({ +>{ name = "noName", skills: { primary = "primary", secondary = "secondary" } = { primary: "none", secondary: "none" }} = multiRobot, i = 0 : number +>{ name = "noName", skills: { primary = "primary", secondary = "secondary" } = { primary: "none", secondary: "none" }} = multiRobot : MultiRobot +>{ name = "noName", skills: { primary = "primary", secondary = "secondary" } = { primary: "none", secondary: "none" }} : { name?: string; skills?: { primary?: string; secondary?: string; }; } + + name = "noName", +>name : string + + skills: { +>skills : { primary?: string; secondary?: string; } +>{ primary = "primary", secondary = "secondary" } = { primary: "none", secondary: "none" } : { primary?: string; secondary?: string; } +>{ primary = "primary", secondary = "secondary" } : { primary?: string; secondary?: string; } + + primary = "primary", +>primary : string + + secondary = "secondary" +>secondary : string + + } = { primary: "none", secondary: "none" } +>{ primary: "none", secondary: "none" } : { primary?: string; secondary?: string; } +>primary : string +>"none" : string +>secondary : string +>"none" : string + +} = multiRobot, i = 0; i < 1; i++) { +>multiRobot : MultiRobot +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(primaryA); +>console.log(primaryA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primaryA : string +} +for ({ +>{ name = "noName", skills: { primary = "primary", secondary = "secondary" } = { primary: "none", secondary: "none" }} = getMultiRobot(), i = 0 : number +>{ name = "noName", skills: { primary = "primary", secondary = "secondary" } = { primary: "none", secondary: "none" }} = getMultiRobot() : MultiRobot +>{ name = "noName", skills: { primary = "primary", secondary = "secondary" } = { primary: "none", secondary: "none" }} : { name?: string; skills?: { primary?: string; secondary?: string; }; } + + name = "noName", +>name : string + + skills: { +>skills : { primary?: string; secondary?: string; } +>{ primary = "primary", secondary = "secondary" } = { primary: "none", secondary: "none" } : { primary?: string; secondary?: string; } +>{ primary = "primary", secondary = "secondary" } : { primary?: string; secondary?: string; } + + primary = "primary", +>primary : string + + secondary = "secondary" +>secondary : string + + } = { primary: "none", secondary: "none" } +>{ primary: "none", secondary: "none" } : { primary?: string; secondary?: string; } +>primary : string +>"none" : string +>secondary : string +>"none" : string + +} = getMultiRobot(), i = 0; i < 1; i++) { +>getMultiRobot() : MultiRobot +>getMultiRobot : () => MultiRobot +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(primaryA); +>console.log(primaryA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primaryA : string +} +for ({ +>{ name = "noName", skills: { primary = "primary", secondary = "secondary" } = { primary: "none", secondary: "none" }} = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, i = 0 : number +>{ name = "noName", skills: { primary = "primary", secondary = "secondary" } = { primary: "none", secondary: "none" }} = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } } : MultiRobot +>{ name = "noName", skills: { primary = "primary", secondary = "secondary" } = { primary: "none", secondary: "none" }} : { name?: string; skills?: { primary?: string; secondary?: string; }; } + + name = "noName", +>name : string + + skills: { +>skills : { primary?: string; secondary?: string; } +>{ primary = "primary", secondary = "secondary" } = { primary: "none", secondary: "none" } : { primary?: string; secondary?: string; } +>{ primary = "primary", secondary = "secondary" } : { primary?: string; secondary?: string; } + + primary = "primary", +>primary : string + + secondary = "secondary" +>secondary : string + + } = { primary: "none", secondary: "none" } +>{ primary: "none", secondary: "none" } : { primary?: string; secondary?: string; } +>primary : string +>"none" : string +>secondary : string +>"none" : string + +} = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, +>{ name: "trimmer", skills: { primary: "trimming", secondary: "edging" } } : MultiRobot +>MultiRobot : MultiRobot +>{ name: "trimmer", skills: { primary: "trimming", secondary: "edging" } } : { name: string; skills: { primary: string; secondary: string; }; } +>name : string +>"trimmer" : string +>skills : { primary: string; secondary: string; } +>{ primary: "trimming", secondary: "edging" } : { primary: string; secondary: string; } +>primary : string +>"trimming" : string +>secondary : string +>"edging" : string + + i = 0; i < 1; i++) { +>i = 0 : number +>i : number +>0 : number +>i < 1 : boolean +>i : number +>1 : number +>i++ : number +>i : number + + console.log(primaryA); +>console.log(primaryA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primaryA : string +} diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPattern.js b/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPattern.js new file mode 100644 index 00000000000..daf39ece7be --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPattern.js @@ -0,0 +1,207 @@ +//// [sourceMapValidationDestructuringForOfArrayBindingPattern.ts] +declare var console: { + log(msg: any): void; +} +type Robot = [number, string, string]; +type MultiSkilledRobot = [string, [string, string]]; + +let robotA: Robot = [1, "mower", "mowing"]; +let robotB: Robot = [2, "trimmer", "trimming"]; +let robots = [robotA, robotB]; +function getRobots() { + return robots; +} + +let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; +let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; +let multiRobots = [multiRobotA, multiRobotB]; +function getMultiRobots() { + return multiRobots; +} + +for (let [, nameA] of robots) { + console.log(nameA); +} +for (let [, nameA] of getRobots()) { + console.log(nameA); +} +for (let [, nameA] of [robotA, robotB]) { + console.log(nameA); +} +for (let [, [primarySkillA, secondarySkillA]] of multiRobots) { + console.log(primarySkillA); +} +for (let [, [primarySkillA, secondarySkillA]] of getMultiRobots()) { + console.log(primarySkillA); +} +for (let [, [primarySkillA, secondarySkillA]] of [multiRobotA, multiRobotB]) { + console.log(primarySkillA); +} + +for (let [numberB] of robots) { + console.log(numberB); +} +for (let [numberB] of getRobots()) { + console.log(numberB); +} +for (let [numberB] of [robotA, robotB]) { + console.log(numberB); +} +for (let [nameB] of multiRobots) { + console.log(nameB); +} +for (let [nameB] of getMultiRobots()) { + console.log(nameB); +} +for (let [nameB] of [multiRobotA, multiRobotB]) { + console.log(nameB); +} + +for (let [numberA2, nameA2, skillA2] of robots) { + console.log(nameA2); +} +for (let [numberA2, nameA2, skillA2] of getRobots()) { + console.log(nameA2); +} +for (let [numberA2, nameA2, skillA2] of [robotA, robotB]) { + console.log(nameA2); +} +for (let [nameMA, [primarySkillA, secondarySkillA]] of multiRobots) { + console.log(nameMA); +} +for (let [nameMA, [primarySkillA, secondarySkillA]] of getMultiRobots()) { + console.log(nameMA); +} +for (let [nameMA, [primarySkillA, secondarySkillA]] of [multiRobotA, multiRobotB]) { + console.log(nameMA); +} + +for (let [numberA3, ...robotAInfo] of robots) { + console.log(numberA3); +} +for (let [numberA3, ...robotAInfo] of getRobots()) { + console.log(numberA3); +} +for (let [numberA3, ...robotAInfo] of [robotA, robotB]) { + console.log(numberA3); +} +for (let [...multiRobotAInfo] of multiRobots) { + console.log(multiRobotAInfo); +} +for (let [...multiRobotAInfo] of getMultiRobots()) { + console.log(multiRobotAInfo); +} +for (let [...multiRobotAInfo] of [multiRobotA, multiRobotB]) { + console.log(multiRobotAInfo); +} + +//// [sourceMapValidationDestructuringForOfArrayBindingPattern.js] +var robotA = [1, "mower", "mowing"]; +var robotB = [2, "trimmer", "trimming"]; +var robots = [robotA, robotB]; +function getRobots() { + return robots; +} +var multiRobotA = ["mower", ["mowing", ""]]; +var multiRobotB = ["trimmer", ["trimming", "edging"]]; +var multiRobots = [multiRobotA, multiRobotB]; +function getMultiRobots() { + return multiRobots; +} +for (var _i = 0, robots_1 = robots; _i < robots_1.length; _i++) { + var _a = robots_1[_i], nameA = _a[1]; + console.log(nameA); +} +for (var _b = 0, _c = getRobots(); _b < _c.length; _b++) { + var _d = _c[_b], nameA = _d[1]; + console.log(nameA); +} +for (var _e = 0, _f = [robotA, robotB]; _e < _f.length; _e++) { + var _g = _f[_e], nameA = _g[1]; + console.log(nameA); +} +for (var _h = 0, multiRobots_1 = multiRobots; _h < multiRobots_1.length; _h++) { + var _j = multiRobots_1[_h], _k = _j[1], primarySkillA = _k[0], secondarySkillA = _k[1]; + console.log(primarySkillA); +} +for (var _l = 0, _m = getMultiRobots(); _l < _m.length; _l++) { + var _o = _m[_l], _p = _o[1], primarySkillA = _p[0], secondarySkillA = _p[1]; + console.log(primarySkillA); +} +for (var _q = 0, _r = [multiRobotA, multiRobotB]; _q < _r.length; _q++) { + var _s = _r[_q], _t = _s[1], primarySkillA = _t[0], secondarySkillA = _t[1]; + console.log(primarySkillA); +} +for (var _u = 0, robots_2 = robots; _u < robots_2.length; _u++) { + var numberB = robots_2[_u][0]; + console.log(numberB); +} +for (var _v = 0, _w = getRobots(); _v < _w.length; _v++) { + var numberB = _w[_v][0]; + console.log(numberB); +} +for (var _x = 0, _y = [robotA, robotB]; _x < _y.length; _x++) { + var numberB = _y[_x][0]; + console.log(numberB); +} +for (var _z = 0, multiRobots_2 = multiRobots; _z < multiRobots_2.length; _z++) { + var nameB = multiRobots_2[_z][0]; + console.log(nameB); +} +for (var _0 = 0, _1 = getMultiRobots(); _0 < _1.length; _0++) { + var nameB = _1[_0][0]; + console.log(nameB); +} +for (var _2 = 0, _3 = [multiRobotA, multiRobotB]; _2 < _3.length; _2++) { + var nameB = _3[_2][0]; + console.log(nameB); +} +for (var _4 = 0, robots_3 = robots; _4 < robots_3.length; _4++) { + var _5 = robots_3[_4], numberA2 = _5[0], nameA2 = _5[1], skillA2 = _5[2]; + console.log(nameA2); +} +for (var _6 = 0, _7 = getRobots(); _6 < _7.length; _6++) { + var _8 = _7[_6], numberA2 = _8[0], nameA2 = _8[1], skillA2 = _8[2]; + console.log(nameA2); +} +for (var _9 = 0, _10 = [robotA, robotB]; _9 < _10.length; _9++) { + var _11 = _10[_9], numberA2 = _11[0], nameA2 = _11[1], skillA2 = _11[2]; + console.log(nameA2); +} +for (var _12 = 0, multiRobots_3 = multiRobots; _12 < multiRobots_3.length; _12++) { + var _13 = multiRobots_3[_12], nameMA = _13[0], _14 = _13[1], primarySkillA = _14[0], secondarySkillA = _14[1]; + console.log(nameMA); +} +for (var _15 = 0, _16 = getMultiRobots(); _15 < _16.length; _15++) { + var _17 = _16[_15], nameMA = _17[0], _18 = _17[1], primarySkillA = _18[0], secondarySkillA = _18[1]; + console.log(nameMA); +} +for (var _19 = 0, _20 = [multiRobotA, multiRobotB]; _19 < _20.length; _19++) { + var _21 = _20[_19], nameMA = _21[0], _22 = _21[1], primarySkillA = _22[0], secondarySkillA = _22[1]; + console.log(nameMA); +} +for (var _23 = 0, robots_4 = robots; _23 < robots_4.length; _23++) { + var _24 = robots_4[_23], numberA3 = _24[0], robotAInfo = _24.slice(1); + console.log(numberA3); +} +for (var _25 = 0, _26 = getRobots(); _25 < _26.length; _25++) { + var _27 = _26[_25], numberA3 = _27[0], robotAInfo = _27.slice(1); + console.log(numberA3); +} +for (var _28 = 0, _29 = [robotA, robotB]; _28 < _29.length; _28++) { + var _30 = _29[_28], numberA3 = _30[0], robotAInfo = _30.slice(1); + console.log(numberA3); +} +for (var _31 = 0, multiRobots_4 = multiRobots; _31 < multiRobots_4.length; _31++) { + var multiRobotAInfo = multiRobots_4[_31].slice(0); + console.log(multiRobotAInfo); +} +for (var _32 = 0, _33 = getMultiRobots(); _32 < _33.length; _32++) { + var multiRobotAInfo = _33[_32].slice(0); + console.log(multiRobotAInfo); +} +for (var _34 = 0, _35 = [multiRobotA, multiRobotB]; _34 < _35.length; _34++) { + var multiRobotAInfo = _35[_34].slice(0); + console.log(multiRobotAInfo); +} +//# sourceMappingURL=sourceMapValidationDestructuringForOfArrayBindingPattern.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPattern.js.map b/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPattern.js.map new file mode 100644 index 00000000000..076b6994fa3 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPattern.js.map @@ -0,0 +1,2 @@ +//// [sourceMapValidationDestructuringForOfArrayBindingPattern.js.map] +{"version":3,"file":"sourceMapValidationDestructuringForOfArrayBindingPattern.js","sourceRoot":"","sources":["sourceMapValidationDestructuringForOfArrayBindingPattern.ts"],"names":[],"mappings":"AAMA,IAAI,MAAM,GAAU,CAAC,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;AAC3C,IAAI,MAAM,GAAU,CAAC,CAAC,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;AAC/C,IAAI,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAC9B;IACI,MAAM,CAAC,MAAM,CAAC;AAClB,CAAC;AAED,IAAI,WAAW,GAAsB,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC;AAC/D,IAAI,WAAW,GAAsB,CAAC,SAAS,EAAE,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC,CAAC;AACzE,IAAI,WAAW,GAAG,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;AAC7C;IACI,MAAM,CAAC,WAAW,CAAC;AACvB,CAAC;AAED,GAAG,CAAC,CAAkB,UAAM,EAAN,iBAAM,EAAN,oBAAM,EAAN,IAAM,CAAC;IAAxB,qBAAa,EAAN,aAAK;IACb,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB;AACD,GAAG,CAAC,CAAkB,UAAW,EAAX,KAAA,SAAS,EAAE,EAAX,cAAW,EAAX,IAAW,CAAC;IAA7B,eAAa,EAAN,aAAK;IACb,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB;AACD,GAAG,CAAC,CAAkB,UAAgB,EAAhB,MAAC,MAAM,EAAE,MAAM,CAAC,EAAhB,cAAgB,EAAhB,IAAgB,CAAC;IAAlC,eAAa,EAAN,aAAK;IACb,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB;AACD,GAAG,CAAC,CAA6C,UAAW,EAAX,2BAAW,EAAX,yBAAW,EAAX,IAAW,CAAC;IAAxD,0BAAwC,EAAjC,UAAgC,EAA/B,qBAAa,EAAE,uBAAe;IACvC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;CAC9B;AACD,GAAG,CAAC,CAA6C,UAAgB,EAAhB,KAAA,cAAc,EAAE,EAAhB,cAAgB,EAAhB,IAAgB,CAAC;IAA7D,eAAwC,EAAjC,UAAgC,EAA/B,qBAAa,EAAE,uBAAe;IACvC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;CAC9B;AACD,GAAG,CAAC,CAA6C,UAA0B,EAA1B,MAAC,WAAW,EAAE,WAAW,CAAC,EAA1B,cAA0B,EAA1B,IAA0B,CAAC;IAAvE,eAAwC,EAAjC,UAAgC,EAA/B,qBAAa,EAAE,uBAAe;IACvC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;CAC9B;AAED,GAAG,CAAC,CAAkB,UAAM,EAAN,iBAAM,EAAN,oBAAM,EAAN,IAAM,CAAC;IAAnB,6BAAO;IACb,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;CACxB;AACD,GAAG,CAAC,CAAkB,UAAW,EAAX,KAAA,SAAS,EAAE,EAAX,cAAW,EAAX,IAAW,CAAC;IAAxB,uBAAO;IACb,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;CACxB;AACD,GAAG,CAAC,CAAkB,UAAgB,EAAhB,MAAC,MAAM,EAAE,MAAM,CAAC,EAAhB,cAAgB,EAAhB,IAAgB,CAAC;IAA7B,uBAAO;IACb,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;CACxB;AACD,GAAG,CAAC,CAAgB,UAAW,EAAX,2BAAW,EAAX,yBAAW,EAAX,IAAW,CAAC;IAAtB,gCAAK;IACX,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB;AACD,GAAG,CAAC,CAAgB,UAAgB,EAAhB,KAAA,cAAc,EAAE,EAAhB,cAAgB,EAAhB,IAAgB,CAAC;IAA3B,qBAAK;IACX,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB;AACD,GAAG,CAAC,CAAgB,UAA0B,EAA1B,MAAC,WAAW,EAAE,WAAW,CAAC,EAA1B,cAA0B,EAA1B,IAA0B,CAAC;IAArC,qBAAK;IACX,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB;AAED,GAAG,CAAC,CAAoC,UAAM,EAAN,iBAAM,EAAN,oBAAM,EAAN,IAAM,CAAC;IAA1C,qBAA+B,EAA1B,gBAAQ,EAAE,cAAM,EAAE,eAAO;IAC/B,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;CACvB;AACD,GAAG,CAAC,CAAoC,UAAW,EAAX,KAAA,SAAS,EAAE,EAAX,cAAW,EAAX,IAAW,CAAC;IAA/C,eAA+B,EAA1B,gBAAQ,EAAE,cAAM,EAAE,eAAO;IAC/B,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;CACvB;AACD,GAAG,CAAC,CAAoC,UAAgB,EAAhB,OAAC,MAAM,EAAE,MAAM,CAAC,EAAhB,eAAgB,EAAhB,IAAgB,CAAC;IAApD,iBAA+B,EAA1B,iBAAQ,EAAE,eAAM,EAAE,gBAAO;IAC/B,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;CACvB;AACD,GAAG,CAAC,CAAmD,WAAW,EAAX,2BAAW,EAAX,0BAAW,EAAX,KAAW,CAAC;IAA9D,4BAA8C,EAAzC,eAAM,EAAE,YAAgC,EAA/B,sBAAa,EAAE,wBAAe;IAC7C,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;CACvB;AACD,GAAG,CAAC,CAAmD,WAAgB,EAAhB,MAAA,cAAc,EAAE,EAAhB,gBAAgB,EAAhB,KAAgB,CAAC;IAAnE,kBAA8C,EAAzC,eAAM,EAAE,YAAgC,EAA/B,sBAAa,EAAE,wBAAe;IAC7C,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;CACvB;AACD,GAAG,CAAC,CAAmD,WAA0B,EAA1B,OAAC,WAAW,EAAE,WAAW,CAAC,EAA1B,gBAA0B,EAA1B,KAA0B,CAAC;IAA7E,kBAA8C,EAAzC,eAAM,EAAE,YAAgC,EAA/B,sBAAa,EAAE,wBAAe;IAC7C,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;CACvB;AAED,GAAG,CAAC,CAAkC,WAAM,EAAN,iBAAM,EAAN,qBAAM,EAAN,KAAM,CAAC;IAAxC,uBAA6B,EAAxB,iBAAQ,EAAE,yBAAa;IAC7B,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;CACzB;AACD,GAAG,CAAC,CAAkC,WAAW,EAAX,MAAA,SAAS,EAAE,EAAX,gBAAW,EAAX,KAAW,CAAC;IAA7C,kBAA6B,EAAxB,iBAAQ,EAAE,yBAAa;IAC7B,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;CACzB;AACD,GAAG,CAAC,CAAkC,WAAgB,EAAhB,OAAC,MAAM,EAAE,MAAM,CAAC,EAAhB,gBAAgB,EAAhB,KAAgB,CAAC;IAAlD,kBAA6B,EAAxB,iBAAQ,EAAE,yBAAa;IAC7B,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;CACzB;AACD,GAAG,CAAC,CAA6B,WAAW,EAAX,2BAAW,EAAX,0BAAW,EAAX,KAAW,CAAC;IAAnC,iDAAkB;IACxB,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;CAChC;AACD,GAAG,CAAC,CAA6B,WAAgB,EAAhB,MAAA,cAAc,EAAE,EAAhB,gBAAgB,EAAhB,KAAgB,CAAC;IAAxC,uCAAkB;IACxB,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;CAChC;AACD,GAAG,CAAC,CAA6B,WAA0B,EAA1B,OAAC,WAAW,EAAE,WAAW,CAAC,EAA1B,gBAA0B,EAA1B,KAA0B,CAAC;IAAlD,uCAAkB;IACxB,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;CAChC"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPattern.sourcemap.txt b/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPattern.sourcemap.txt new file mode 100644 index 00000000000..17110072800 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPattern.sourcemap.txt @@ -0,0 +1,2661 @@ +=================================================================== +JsFile: sourceMapValidationDestructuringForOfArrayBindingPattern.js +mapUrl: sourceMapValidationDestructuringForOfArrayBindingPattern.js.map +sourceRoot: +sources: sourceMapValidationDestructuringForOfArrayBindingPattern.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/sourceMapValidationDestructuringForOfArrayBindingPattern.js +sourceFile:sourceMapValidationDestructuringForOfArrayBindingPattern.ts +------------------------------------------------------------------- +>>>var robotA = [1, "mower", "mowing"]; +1 > +2 >^^^^ +3 > ^^^^^^ +4 > ^^^ +5 > ^ +6 > ^ +7 > ^^ +8 > ^^^^^^^ +9 > ^^ +10> ^^^^^^^^ +11> ^ +12> ^ +13> ^^^^^-> +1 >declare var console: { + > log(msg: any): void; + >} + >type Robot = [number, string, string]; + >type MultiSkilledRobot = [string, [string, string]]; + > + > +2 >let +3 > robotA +4 > : Robot = +5 > [ +6 > 1 +7 > , +8 > "mower" +9 > , +10> "mowing" +11> ] +12> ; +1 >Emitted(1, 1) Source(7, 1) + SourceIndex(0) +2 >Emitted(1, 5) Source(7, 5) + SourceIndex(0) +3 >Emitted(1, 11) Source(7, 11) + SourceIndex(0) +4 >Emitted(1, 14) Source(7, 21) + SourceIndex(0) +5 >Emitted(1, 15) Source(7, 22) + SourceIndex(0) +6 >Emitted(1, 16) Source(7, 23) + SourceIndex(0) +7 >Emitted(1, 18) Source(7, 25) + SourceIndex(0) +8 >Emitted(1, 25) Source(7, 32) + SourceIndex(0) +9 >Emitted(1, 27) Source(7, 34) + SourceIndex(0) +10>Emitted(1, 35) Source(7, 42) + SourceIndex(0) +11>Emitted(1, 36) Source(7, 43) + SourceIndex(0) +12>Emitted(1, 37) Source(7, 44) + SourceIndex(0) +--- +>>>var robotB = [2, "trimmer", "trimming"]; +1-> +2 >^^^^ +3 > ^^^^^^ +4 > ^^^ +5 > ^ +6 > ^ +7 > ^^ +8 > ^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^ +11> ^ +12> ^ +1-> + > +2 >let +3 > robotB +4 > : Robot = +5 > [ +6 > 2 +7 > , +8 > "trimmer" +9 > , +10> "trimming" +11> ] +12> ; +1->Emitted(2, 1) Source(8, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(8, 5) + SourceIndex(0) +3 >Emitted(2, 11) Source(8, 11) + SourceIndex(0) +4 >Emitted(2, 14) Source(8, 21) + SourceIndex(0) +5 >Emitted(2, 15) Source(8, 22) + SourceIndex(0) +6 >Emitted(2, 16) Source(8, 23) + SourceIndex(0) +7 >Emitted(2, 18) Source(8, 25) + SourceIndex(0) +8 >Emitted(2, 27) Source(8, 34) + SourceIndex(0) +9 >Emitted(2, 29) Source(8, 36) + SourceIndex(0) +10>Emitted(2, 39) Source(8, 46) + SourceIndex(0) +11>Emitted(2, 40) Source(8, 47) + SourceIndex(0) +12>Emitted(2, 41) Source(8, 48) + SourceIndex(0) +--- +>>>var robots = [robotA, robotB]; +1 > +2 >^^^^ +3 > ^^^^^^ +4 > ^^^ +5 > ^ +6 > ^^^^^^ +7 > ^^ +8 > ^^^^^^ +9 > ^ +10> ^ +1 > + > +2 >let +3 > robots +4 > = +5 > [ +6 > robotA +7 > , +8 > robotB +9 > ] +10> ; +1 >Emitted(3, 1) Source(9, 1) + SourceIndex(0) +2 >Emitted(3, 5) Source(9, 5) + SourceIndex(0) +3 >Emitted(3, 11) Source(9, 11) + SourceIndex(0) +4 >Emitted(3, 14) Source(9, 14) + SourceIndex(0) +5 >Emitted(3, 15) Source(9, 15) + SourceIndex(0) +6 >Emitted(3, 21) Source(9, 21) + SourceIndex(0) +7 >Emitted(3, 23) Source(9, 23) + SourceIndex(0) +8 >Emitted(3, 29) Source(9, 29) + SourceIndex(0) +9 >Emitted(3, 30) Source(9, 30) + SourceIndex(0) +10>Emitted(3, 31) Source(9, 31) + SourceIndex(0) +--- +>>>function getRobots() { +1 > +2 >^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(4, 1) Source(10, 1) + SourceIndex(0) +--- +>>> return robots; +1->^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^ +5 > ^ +1->function getRobots() { + > +2 > return +3 > +4 > robots +5 > ; +1->Emitted(5, 5) Source(11, 5) + SourceIndex(0) +2 >Emitted(5, 11) Source(11, 11) + SourceIndex(0) +3 >Emitted(5, 12) Source(11, 12) + SourceIndex(0) +4 >Emitted(5, 18) Source(11, 18) + SourceIndex(0) +5 >Emitted(5, 19) Source(11, 19) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(6, 1) Source(12, 1) + SourceIndex(0) +2 >Emitted(6, 2) Source(12, 2) + SourceIndex(0) +--- +>>>var multiRobotA = ["mower", ["mowing", ""]]; +1-> +2 >^^^^ +3 > ^^^^^^^^^^^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^ +7 > ^^ +8 > ^ +9 > ^^^^^^^^ +10> ^^ +11> ^^ +12> ^ +13> ^ +14> ^ +15> ^^^^^^^^^^^-> +1-> + > + > +2 >let +3 > multiRobotA +4 > : MultiSkilledRobot = +5 > [ +6 > "mower" +7 > , +8 > [ +9 > "mowing" +10> , +11> "" +12> ] +13> ] +14> ; +1->Emitted(7, 1) Source(14, 1) + SourceIndex(0) +2 >Emitted(7, 5) Source(14, 5) + SourceIndex(0) +3 >Emitted(7, 16) Source(14, 16) + SourceIndex(0) +4 >Emitted(7, 19) Source(14, 38) + SourceIndex(0) +5 >Emitted(7, 20) Source(14, 39) + SourceIndex(0) +6 >Emitted(7, 27) Source(14, 46) + SourceIndex(0) +7 >Emitted(7, 29) Source(14, 48) + SourceIndex(0) +8 >Emitted(7, 30) Source(14, 49) + SourceIndex(0) +9 >Emitted(7, 38) Source(14, 57) + SourceIndex(0) +10>Emitted(7, 40) Source(14, 59) + SourceIndex(0) +11>Emitted(7, 42) Source(14, 61) + SourceIndex(0) +12>Emitted(7, 43) Source(14, 62) + SourceIndex(0) +13>Emitted(7, 44) Source(14, 63) + SourceIndex(0) +14>Emitted(7, 45) Source(14, 64) + SourceIndex(0) +--- +>>>var multiRobotB = ["trimmer", ["trimming", "edging"]]; +1-> +2 >^^^^ +3 > ^^^^^^^^^^^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^^ +7 > ^^ +8 > ^ +9 > ^^^^^^^^^^ +10> ^^ +11> ^^^^^^^^ +12> ^ +13> ^ +14> ^ +1-> + > +2 >let +3 > multiRobotB +4 > : MultiSkilledRobot = +5 > [ +6 > "trimmer" +7 > , +8 > [ +9 > "trimming" +10> , +11> "edging" +12> ] +13> ] +14> ; +1->Emitted(8, 1) Source(15, 1) + SourceIndex(0) +2 >Emitted(8, 5) Source(15, 5) + SourceIndex(0) +3 >Emitted(8, 16) Source(15, 16) + SourceIndex(0) +4 >Emitted(8, 19) Source(15, 38) + SourceIndex(0) +5 >Emitted(8, 20) Source(15, 39) + SourceIndex(0) +6 >Emitted(8, 29) Source(15, 48) + SourceIndex(0) +7 >Emitted(8, 31) Source(15, 50) + SourceIndex(0) +8 >Emitted(8, 32) Source(15, 51) + SourceIndex(0) +9 >Emitted(8, 42) Source(15, 61) + SourceIndex(0) +10>Emitted(8, 44) Source(15, 63) + SourceIndex(0) +11>Emitted(8, 52) Source(15, 71) + SourceIndex(0) +12>Emitted(8, 53) Source(15, 72) + SourceIndex(0) +13>Emitted(8, 54) Source(15, 73) + SourceIndex(0) +14>Emitted(8, 55) Source(15, 74) + SourceIndex(0) +--- +>>>var multiRobots = [multiRobotA, multiRobotB]; +1 > +2 >^^^^ +3 > ^^^^^^^^^^^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^ +9 > ^ +10> ^ +1 > + > +2 >let +3 > multiRobots +4 > = +5 > [ +6 > multiRobotA +7 > , +8 > multiRobotB +9 > ] +10> ; +1 >Emitted(9, 1) Source(16, 1) + SourceIndex(0) +2 >Emitted(9, 5) Source(16, 5) + SourceIndex(0) +3 >Emitted(9, 16) Source(16, 16) + SourceIndex(0) +4 >Emitted(9, 19) Source(16, 19) + SourceIndex(0) +5 >Emitted(9, 20) Source(16, 20) + SourceIndex(0) +6 >Emitted(9, 31) Source(16, 31) + SourceIndex(0) +7 >Emitted(9, 33) Source(16, 33) + SourceIndex(0) +8 >Emitted(9, 44) Source(16, 44) + SourceIndex(0) +9 >Emitted(9, 45) Source(16, 45) + SourceIndex(0) +10>Emitted(9, 46) Source(16, 46) + SourceIndex(0) +--- +>>>function getMultiRobots() { +1 > +2 >^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(10, 1) Source(17, 1) + SourceIndex(0) +--- +>>> return multiRobots; +1->^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^ +5 > ^ +1->function getMultiRobots() { + > +2 > return +3 > +4 > multiRobots +5 > ; +1->Emitted(11, 5) Source(18, 5) + SourceIndex(0) +2 >Emitted(11, 11) Source(18, 11) + SourceIndex(0) +3 >Emitted(11, 12) Source(18, 12) + SourceIndex(0) +4 >Emitted(11, 23) Source(18, 23) + SourceIndex(0) +5 >Emitted(11, 24) Source(18, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(12, 1) Source(19, 1) + SourceIndex(0) +2 >Emitted(12, 2) Source(19, 2) + SourceIndex(0) +--- +>>>for (var _i = 0, robots_1 = robots; _i < robots_1.length; _i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^^^^^^ +10> ^^ +11> ^^^^ +12> ^ +1-> + > + > +2 >for +3 > +4 > (let [, nameA] of +5 > robots +6 > +7 > robots +8 > +9 > robots +10> +11> robots +12> ) +1->Emitted(13, 1) Source(21, 1) + SourceIndex(0) +2 >Emitted(13, 4) Source(21, 4) + SourceIndex(0) +3 >Emitted(13, 5) Source(21, 5) + SourceIndex(0) +4 >Emitted(13, 6) Source(21, 23) + SourceIndex(0) +5 >Emitted(13, 16) Source(21, 29) + SourceIndex(0) +6 >Emitted(13, 18) Source(21, 23) + SourceIndex(0) +7 >Emitted(13, 35) Source(21, 29) + SourceIndex(0) +8 >Emitted(13, 37) Source(21, 23) + SourceIndex(0) +9 >Emitted(13, 57) Source(21, 29) + SourceIndex(0) +10>Emitted(13, 59) Source(21, 23) + SourceIndex(0) +11>Emitted(13, 63) Source(21, 29) + SourceIndex(0) +12>Emitted(13, 64) Source(21, 30) + SourceIndex(0) +--- +>>> var _a = robots_1[_i], nameA = _a[1]; +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^ +1 > +2 > let [, nameA] +3 > +4 > nameA +1 >Emitted(14, 5) Source(21, 6) + SourceIndex(0) +2 >Emitted(14, 26) Source(21, 19) + SourceIndex(0) +3 >Emitted(14, 28) Source(21, 13) + SourceIndex(0) +4 >Emitted(14, 41) Source(21, 18) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 >] of robots) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(15, 5) Source(22, 5) + SourceIndex(0) +2 >Emitted(15, 12) Source(22, 12) + SourceIndex(0) +3 >Emitted(15, 13) Source(22, 13) + SourceIndex(0) +4 >Emitted(15, 16) Source(22, 16) + SourceIndex(0) +5 >Emitted(15, 17) Source(22, 17) + SourceIndex(0) +6 >Emitted(15, 22) Source(22, 22) + SourceIndex(0) +7 >Emitted(15, 23) Source(22, 23) + SourceIndex(0) +8 >Emitted(15, 24) Source(22, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(16, 2) Source(23, 2) + SourceIndex(0) +--- +>>>for (var _b = 0, _c = getRobots(); _b < _c.length; _b++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^ +8 > ^^^^^^^^^ +9 > ^^ +10> ^^ +11> ^^^^^^^^^^^^^^ +12> ^^ +13> ^^^^ +14> ^ +1-> + > +2 >for +3 > +4 > (let [, nameA] of +5 > getRobots() +6 > +7 > +8 > getRobots +9 > () +10> +11> getRobots() +12> +13> getRobots() +14> ) +1->Emitted(17, 1) Source(24, 1) + SourceIndex(0) +2 >Emitted(17, 4) Source(24, 4) + SourceIndex(0) +3 >Emitted(17, 5) Source(24, 5) + SourceIndex(0) +4 >Emitted(17, 6) Source(24, 23) + SourceIndex(0) +5 >Emitted(17, 16) Source(24, 34) + SourceIndex(0) +6 >Emitted(17, 18) Source(24, 23) + SourceIndex(0) +7 >Emitted(17, 23) Source(24, 23) + SourceIndex(0) +8 >Emitted(17, 32) Source(24, 32) + SourceIndex(0) +9 >Emitted(17, 34) Source(24, 34) + SourceIndex(0) +10>Emitted(17, 36) Source(24, 23) + SourceIndex(0) +11>Emitted(17, 50) Source(24, 34) + SourceIndex(0) +12>Emitted(17, 52) Source(24, 23) + SourceIndex(0) +13>Emitted(17, 56) Source(24, 34) + SourceIndex(0) +14>Emitted(17, 57) Source(24, 35) + SourceIndex(0) +--- +>>> var _d = _c[_b], nameA = _d[1]; +1 >^^^^ +2 > ^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^ +1 > +2 > let [, nameA] +3 > +4 > nameA +1 >Emitted(18, 5) Source(24, 6) + SourceIndex(0) +2 >Emitted(18, 20) Source(24, 19) + SourceIndex(0) +3 >Emitted(18, 22) Source(24, 13) + SourceIndex(0) +4 >Emitted(18, 35) Source(24, 18) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 >] of getRobots()) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(19, 5) Source(25, 5) + SourceIndex(0) +2 >Emitted(19, 12) Source(25, 12) + SourceIndex(0) +3 >Emitted(19, 13) Source(25, 13) + SourceIndex(0) +4 >Emitted(19, 16) Source(25, 16) + SourceIndex(0) +5 >Emitted(19, 17) Source(25, 17) + SourceIndex(0) +6 >Emitted(19, 22) Source(25, 22) + SourceIndex(0) +7 >Emitted(19, 23) Source(25, 23) + SourceIndex(0) +8 >Emitted(19, 24) Source(25, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(20, 2) Source(26, 2) + SourceIndex(0) +--- +>>>for (var _e = 0, _f = [robotA, robotB]; _e < _f.length; _e++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^ +8 > ^^^^^^ +9 > ^^ +10> ^^^^^^ +11> ^ +12> ^^ +13> ^^^^^^^^^^^^^^ +14> ^^ +15> ^^^^ +16> ^ +1-> + > +2 >for +3 > +4 > (let [, nameA] of +5 > [robotA, robotB] +6 > +7 > [ +8 > robotA +9 > , +10> robotB +11> ] +12> +13> [robotA, robotB] +14> +15> [robotA, robotB] +16> ) +1->Emitted(21, 1) Source(27, 1) + SourceIndex(0) +2 >Emitted(21, 4) Source(27, 4) + SourceIndex(0) +3 >Emitted(21, 5) Source(27, 5) + SourceIndex(0) +4 >Emitted(21, 6) Source(27, 23) + SourceIndex(0) +5 >Emitted(21, 16) Source(27, 39) + SourceIndex(0) +6 >Emitted(21, 18) Source(27, 23) + SourceIndex(0) +7 >Emitted(21, 24) Source(27, 24) + SourceIndex(0) +8 >Emitted(21, 30) Source(27, 30) + SourceIndex(0) +9 >Emitted(21, 32) Source(27, 32) + SourceIndex(0) +10>Emitted(21, 38) Source(27, 38) + SourceIndex(0) +11>Emitted(21, 39) Source(27, 39) + SourceIndex(0) +12>Emitted(21, 41) Source(27, 23) + SourceIndex(0) +13>Emitted(21, 55) Source(27, 39) + SourceIndex(0) +14>Emitted(21, 57) Source(27, 23) + SourceIndex(0) +15>Emitted(21, 61) Source(27, 39) + SourceIndex(0) +16>Emitted(21, 62) Source(27, 40) + SourceIndex(0) +--- +>>> var _g = _f[_e], nameA = _g[1]; +1 >^^^^ +2 > ^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^ +1 > +2 > let [, nameA] +3 > +4 > nameA +1 >Emitted(22, 5) Source(27, 6) + SourceIndex(0) +2 >Emitted(22, 20) Source(27, 19) + SourceIndex(0) +3 >Emitted(22, 22) Source(27, 13) + SourceIndex(0) +4 >Emitted(22, 35) Source(27, 18) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 >] of [robotA, robotB]) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(23, 5) Source(28, 5) + SourceIndex(0) +2 >Emitted(23, 12) Source(28, 12) + SourceIndex(0) +3 >Emitted(23, 13) Source(28, 13) + SourceIndex(0) +4 >Emitted(23, 16) Source(28, 16) + SourceIndex(0) +5 >Emitted(23, 17) Source(28, 17) + SourceIndex(0) +6 >Emitted(23, 22) Source(28, 22) + SourceIndex(0) +7 >Emitted(23, 23) Source(28, 23) + SourceIndex(0) +8 >Emitted(23, 24) Source(28, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(24, 2) Source(29, 2) + SourceIndex(0) +--- +>>>for (var _h = 0, multiRobots_1 = multiRobots; _h < multiRobots_1.length; _h++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^^^^^^^^^^^ +10> ^^ +11> ^^^^ +12> ^ +13> ^^^^^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > (let [, [primarySkillA, secondarySkillA]] of +5 > multiRobots +6 > +7 > multiRobots +8 > +9 > multiRobots +10> +11> multiRobots +12> ) +1->Emitted(25, 1) Source(30, 1) + SourceIndex(0) +2 >Emitted(25, 4) Source(30, 4) + SourceIndex(0) +3 >Emitted(25, 5) Source(30, 5) + SourceIndex(0) +4 >Emitted(25, 6) Source(30, 50) + SourceIndex(0) +5 >Emitted(25, 16) Source(30, 61) + SourceIndex(0) +6 >Emitted(25, 18) Source(30, 50) + SourceIndex(0) +7 >Emitted(25, 45) Source(30, 61) + SourceIndex(0) +8 >Emitted(25, 47) Source(30, 50) + SourceIndex(0) +9 >Emitted(25, 72) Source(30, 61) + SourceIndex(0) +10>Emitted(25, 74) Source(30, 50) + SourceIndex(0) +11>Emitted(25, 78) Source(30, 61) + SourceIndex(0) +12>Emitted(25, 79) Source(30, 62) + SourceIndex(0) +--- +>>> var _j = multiRobots_1[_h], _k = _j[1], primarySkillA = _k[0], secondarySkillA = _k[1]; +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > let [, [primarySkillA, secondarySkillA]] +3 > +4 > [primarySkillA, secondarySkillA] +5 > +6 > primarySkillA +7 > , +8 > secondarySkillA +1->Emitted(26, 5) Source(30, 6) + SourceIndex(0) +2 >Emitted(26, 31) Source(30, 46) + SourceIndex(0) +3 >Emitted(26, 33) Source(30, 13) + SourceIndex(0) +4 >Emitted(26, 43) Source(30, 45) + SourceIndex(0) +5 >Emitted(26, 45) Source(30, 14) + SourceIndex(0) +6 >Emitted(26, 66) Source(30, 27) + SourceIndex(0) +7 >Emitted(26, 68) Source(30, 29) + SourceIndex(0) +8 >Emitted(26, 91) Source(30, 44) + SourceIndex(0) +--- +>>> console.log(primarySkillA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^^^^^^ +7 > ^ +8 > ^ +1 >]] of multiRobots) { + > +2 > console +3 > . +4 > log +5 > ( +6 > primarySkillA +7 > ) +8 > ; +1 >Emitted(27, 5) Source(31, 5) + SourceIndex(0) +2 >Emitted(27, 12) Source(31, 12) + SourceIndex(0) +3 >Emitted(27, 13) Source(31, 13) + SourceIndex(0) +4 >Emitted(27, 16) Source(31, 16) + SourceIndex(0) +5 >Emitted(27, 17) Source(31, 17) + SourceIndex(0) +6 >Emitted(27, 30) Source(31, 30) + SourceIndex(0) +7 >Emitted(27, 31) Source(31, 31) + SourceIndex(0) +8 >Emitted(27, 32) Source(31, 32) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(28, 2) Source(32, 2) + SourceIndex(0) +--- +>>>for (var _l = 0, _m = getMultiRobots(); _l < _m.length; _l++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^ +8 > ^^^^^^^^^^^^^^ +9 > ^^ +10> ^^ +11> ^^^^^^^^^^^^^^ +12> ^^ +13> ^^^^ +14> ^ +15> ^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > (let [, [primarySkillA, secondarySkillA]] of +5 > getMultiRobots() +6 > +7 > +8 > getMultiRobots +9 > () +10> +11> getMultiRobots() +12> +13> getMultiRobots() +14> ) +1->Emitted(29, 1) Source(33, 1) + SourceIndex(0) +2 >Emitted(29, 4) Source(33, 4) + SourceIndex(0) +3 >Emitted(29, 5) Source(33, 5) + SourceIndex(0) +4 >Emitted(29, 6) Source(33, 50) + SourceIndex(0) +5 >Emitted(29, 16) Source(33, 66) + SourceIndex(0) +6 >Emitted(29, 18) Source(33, 50) + SourceIndex(0) +7 >Emitted(29, 23) Source(33, 50) + SourceIndex(0) +8 >Emitted(29, 37) Source(33, 64) + SourceIndex(0) +9 >Emitted(29, 39) Source(33, 66) + SourceIndex(0) +10>Emitted(29, 41) Source(33, 50) + SourceIndex(0) +11>Emitted(29, 55) Source(33, 66) + SourceIndex(0) +12>Emitted(29, 57) Source(33, 50) + SourceIndex(0) +13>Emitted(29, 61) Source(33, 66) + SourceIndex(0) +14>Emitted(29, 62) Source(33, 67) + SourceIndex(0) +--- +>>> var _o = _m[_l], _p = _o[1], primarySkillA = _p[0], secondarySkillA = _p[1]; +1->^^^^ +2 > ^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > let [, [primarySkillA, secondarySkillA]] +3 > +4 > [primarySkillA, secondarySkillA] +5 > +6 > primarySkillA +7 > , +8 > secondarySkillA +1->Emitted(30, 5) Source(33, 6) + SourceIndex(0) +2 >Emitted(30, 20) Source(33, 46) + SourceIndex(0) +3 >Emitted(30, 22) Source(33, 13) + SourceIndex(0) +4 >Emitted(30, 32) Source(33, 45) + SourceIndex(0) +5 >Emitted(30, 34) Source(33, 14) + SourceIndex(0) +6 >Emitted(30, 55) Source(33, 27) + SourceIndex(0) +7 >Emitted(30, 57) Source(33, 29) + SourceIndex(0) +8 >Emitted(30, 80) Source(33, 44) + SourceIndex(0) +--- +>>> console.log(primarySkillA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^^^^^^ +7 > ^ +8 > ^ +1 >]] of getMultiRobots()) { + > +2 > console +3 > . +4 > log +5 > ( +6 > primarySkillA +7 > ) +8 > ; +1 >Emitted(31, 5) Source(34, 5) + SourceIndex(0) +2 >Emitted(31, 12) Source(34, 12) + SourceIndex(0) +3 >Emitted(31, 13) Source(34, 13) + SourceIndex(0) +4 >Emitted(31, 16) Source(34, 16) + SourceIndex(0) +5 >Emitted(31, 17) Source(34, 17) + SourceIndex(0) +6 >Emitted(31, 30) Source(34, 30) + SourceIndex(0) +7 >Emitted(31, 31) Source(34, 31) + SourceIndex(0) +8 >Emitted(31, 32) Source(34, 32) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(32, 2) Source(35, 2) + SourceIndex(0) +--- +>>>for (var _q = 0, _r = [multiRobotA, multiRobotB]; _q < _r.length; _q++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^ +8 > ^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^ +11> ^ +12> ^^ +13> ^^^^^^^^^^^^^^ +14> ^^ +15> ^^^^ +16> ^ +17> ^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > (let [, [primarySkillA, secondarySkillA]] of +5 > [multiRobotA, multiRobotB] +6 > +7 > [ +8 > multiRobotA +9 > , +10> multiRobotB +11> ] +12> +13> [multiRobotA, multiRobotB] +14> +15> [multiRobotA, multiRobotB] +16> ) +1->Emitted(33, 1) Source(36, 1) + SourceIndex(0) +2 >Emitted(33, 4) Source(36, 4) + SourceIndex(0) +3 >Emitted(33, 5) Source(36, 5) + SourceIndex(0) +4 >Emitted(33, 6) Source(36, 50) + SourceIndex(0) +5 >Emitted(33, 16) Source(36, 76) + SourceIndex(0) +6 >Emitted(33, 18) Source(36, 50) + SourceIndex(0) +7 >Emitted(33, 24) Source(36, 51) + SourceIndex(0) +8 >Emitted(33, 35) Source(36, 62) + SourceIndex(0) +9 >Emitted(33, 37) Source(36, 64) + SourceIndex(0) +10>Emitted(33, 48) Source(36, 75) + SourceIndex(0) +11>Emitted(33, 49) Source(36, 76) + SourceIndex(0) +12>Emitted(33, 51) Source(36, 50) + SourceIndex(0) +13>Emitted(33, 65) Source(36, 76) + SourceIndex(0) +14>Emitted(33, 67) Source(36, 50) + SourceIndex(0) +15>Emitted(33, 71) Source(36, 76) + SourceIndex(0) +16>Emitted(33, 72) Source(36, 77) + SourceIndex(0) +--- +>>> var _s = _r[_q], _t = _s[1], primarySkillA = _t[0], secondarySkillA = _t[1]; +1->^^^^ +2 > ^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > let [, [primarySkillA, secondarySkillA]] +3 > +4 > [primarySkillA, secondarySkillA] +5 > +6 > primarySkillA +7 > , +8 > secondarySkillA +1->Emitted(34, 5) Source(36, 6) + SourceIndex(0) +2 >Emitted(34, 20) Source(36, 46) + SourceIndex(0) +3 >Emitted(34, 22) Source(36, 13) + SourceIndex(0) +4 >Emitted(34, 32) Source(36, 45) + SourceIndex(0) +5 >Emitted(34, 34) Source(36, 14) + SourceIndex(0) +6 >Emitted(34, 55) Source(36, 27) + SourceIndex(0) +7 >Emitted(34, 57) Source(36, 29) + SourceIndex(0) +8 >Emitted(34, 80) Source(36, 44) + SourceIndex(0) +--- +>>> console.log(primarySkillA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^^^^^^ +7 > ^ +8 > ^ +1 >]] of [multiRobotA, multiRobotB]) { + > +2 > console +3 > . +4 > log +5 > ( +6 > primarySkillA +7 > ) +8 > ; +1 >Emitted(35, 5) Source(37, 5) + SourceIndex(0) +2 >Emitted(35, 12) Source(37, 12) + SourceIndex(0) +3 >Emitted(35, 13) Source(37, 13) + SourceIndex(0) +4 >Emitted(35, 16) Source(37, 16) + SourceIndex(0) +5 >Emitted(35, 17) Source(37, 17) + SourceIndex(0) +6 >Emitted(35, 30) Source(37, 30) + SourceIndex(0) +7 >Emitted(35, 31) Source(37, 31) + SourceIndex(0) +8 >Emitted(35, 32) Source(37, 32) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(36, 2) Source(38, 2) + SourceIndex(0) +--- +>>>for (var _u = 0, robots_2 = robots; _u < robots_2.length; _u++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^^^^^^ +10> ^^ +11> ^^^^ +12> ^ +1-> + > + > +2 >for +3 > +4 > (let [numberB] of +5 > robots +6 > +7 > robots +8 > +9 > robots +10> +11> robots +12> ) +1->Emitted(37, 1) Source(40, 1) + SourceIndex(0) +2 >Emitted(37, 4) Source(40, 4) + SourceIndex(0) +3 >Emitted(37, 5) Source(40, 5) + SourceIndex(0) +4 >Emitted(37, 6) Source(40, 23) + SourceIndex(0) +5 >Emitted(37, 16) Source(40, 29) + SourceIndex(0) +6 >Emitted(37, 18) Source(40, 23) + SourceIndex(0) +7 >Emitted(37, 35) Source(40, 29) + SourceIndex(0) +8 >Emitted(37, 37) Source(40, 23) + SourceIndex(0) +9 >Emitted(37, 57) Source(40, 29) + SourceIndex(0) +10>Emitted(37, 59) Source(40, 23) + SourceIndex(0) +11>Emitted(37, 63) Source(40, 29) + SourceIndex(0) +12>Emitted(37, 64) Source(40, 30) + SourceIndex(0) +--- +>>> var numberB = robots_2[_u][0]; +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 > numberB +1 >Emitted(38, 5) Source(40, 11) + SourceIndex(0) +2 >Emitted(38, 34) Source(40, 18) + SourceIndex(0) +--- +>>> console.log(numberB); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^ +7 > ^ +8 > ^ +1 >] of robots) { + > +2 > console +3 > . +4 > log +5 > ( +6 > numberB +7 > ) +8 > ; +1 >Emitted(39, 5) Source(41, 5) + SourceIndex(0) +2 >Emitted(39, 12) Source(41, 12) + SourceIndex(0) +3 >Emitted(39, 13) Source(41, 13) + SourceIndex(0) +4 >Emitted(39, 16) Source(41, 16) + SourceIndex(0) +5 >Emitted(39, 17) Source(41, 17) + SourceIndex(0) +6 >Emitted(39, 24) Source(41, 24) + SourceIndex(0) +7 >Emitted(39, 25) Source(41, 25) + SourceIndex(0) +8 >Emitted(39, 26) Source(41, 26) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(40, 2) Source(42, 2) + SourceIndex(0) +--- +>>>for (var _v = 0, _w = getRobots(); _v < _w.length; _v++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^ +8 > ^^^^^^^^^ +9 > ^^ +10> ^^ +11> ^^^^^^^^^^^^^^ +12> ^^ +13> ^^^^ +14> ^ +1-> + > +2 >for +3 > +4 > (let [numberB] of +5 > getRobots() +6 > +7 > +8 > getRobots +9 > () +10> +11> getRobots() +12> +13> getRobots() +14> ) +1->Emitted(41, 1) Source(43, 1) + SourceIndex(0) +2 >Emitted(41, 4) Source(43, 4) + SourceIndex(0) +3 >Emitted(41, 5) Source(43, 5) + SourceIndex(0) +4 >Emitted(41, 6) Source(43, 23) + SourceIndex(0) +5 >Emitted(41, 16) Source(43, 34) + SourceIndex(0) +6 >Emitted(41, 18) Source(43, 23) + SourceIndex(0) +7 >Emitted(41, 23) Source(43, 23) + SourceIndex(0) +8 >Emitted(41, 32) Source(43, 32) + SourceIndex(0) +9 >Emitted(41, 34) Source(43, 34) + SourceIndex(0) +10>Emitted(41, 36) Source(43, 23) + SourceIndex(0) +11>Emitted(41, 50) Source(43, 34) + SourceIndex(0) +12>Emitted(41, 52) Source(43, 23) + SourceIndex(0) +13>Emitted(41, 56) Source(43, 34) + SourceIndex(0) +14>Emitted(41, 57) Source(43, 35) + SourceIndex(0) +--- +>>> var numberB = _w[_v][0]; +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 > numberB +1 >Emitted(42, 5) Source(43, 11) + SourceIndex(0) +2 >Emitted(42, 28) Source(43, 18) + SourceIndex(0) +--- +>>> console.log(numberB); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^ +7 > ^ +8 > ^ +1 >] of getRobots()) { + > +2 > console +3 > . +4 > log +5 > ( +6 > numberB +7 > ) +8 > ; +1 >Emitted(43, 5) Source(44, 5) + SourceIndex(0) +2 >Emitted(43, 12) Source(44, 12) + SourceIndex(0) +3 >Emitted(43, 13) Source(44, 13) + SourceIndex(0) +4 >Emitted(43, 16) Source(44, 16) + SourceIndex(0) +5 >Emitted(43, 17) Source(44, 17) + SourceIndex(0) +6 >Emitted(43, 24) Source(44, 24) + SourceIndex(0) +7 >Emitted(43, 25) Source(44, 25) + SourceIndex(0) +8 >Emitted(43, 26) Source(44, 26) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(44, 2) Source(45, 2) + SourceIndex(0) +--- +>>>for (var _x = 0, _y = [robotA, robotB]; _x < _y.length; _x++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^ +8 > ^^^^^^ +9 > ^^ +10> ^^^^^^ +11> ^ +12> ^^ +13> ^^^^^^^^^^^^^^ +14> ^^ +15> ^^^^ +16> ^ +1-> + > +2 >for +3 > +4 > (let [numberB] of +5 > [robotA, robotB] +6 > +7 > [ +8 > robotA +9 > , +10> robotB +11> ] +12> +13> [robotA, robotB] +14> +15> [robotA, robotB] +16> ) +1->Emitted(45, 1) Source(46, 1) + SourceIndex(0) +2 >Emitted(45, 4) Source(46, 4) + SourceIndex(0) +3 >Emitted(45, 5) Source(46, 5) + SourceIndex(0) +4 >Emitted(45, 6) Source(46, 23) + SourceIndex(0) +5 >Emitted(45, 16) Source(46, 39) + SourceIndex(0) +6 >Emitted(45, 18) Source(46, 23) + SourceIndex(0) +7 >Emitted(45, 24) Source(46, 24) + SourceIndex(0) +8 >Emitted(45, 30) Source(46, 30) + SourceIndex(0) +9 >Emitted(45, 32) Source(46, 32) + SourceIndex(0) +10>Emitted(45, 38) Source(46, 38) + SourceIndex(0) +11>Emitted(45, 39) Source(46, 39) + SourceIndex(0) +12>Emitted(45, 41) Source(46, 23) + SourceIndex(0) +13>Emitted(45, 55) Source(46, 39) + SourceIndex(0) +14>Emitted(45, 57) Source(46, 23) + SourceIndex(0) +15>Emitted(45, 61) Source(46, 39) + SourceIndex(0) +16>Emitted(45, 62) Source(46, 40) + SourceIndex(0) +--- +>>> var numberB = _y[_x][0]; +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 > numberB +1 >Emitted(46, 5) Source(46, 11) + SourceIndex(0) +2 >Emitted(46, 28) Source(46, 18) + SourceIndex(0) +--- +>>> console.log(numberB); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^ +7 > ^ +8 > ^ +1 >] of [robotA, robotB]) { + > +2 > console +3 > . +4 > log +5 > ( +6 > numberB +7 > ) +8 > ; +1 >Emitted(47, 5) Source(47, 5) + SourceIndex(0) +2 >Emitted(47, 12) Source(47, 12) + SourceIndex(0) +3 >Emitted(47, 13) Source(47, 13) + SourceIndex(0) +4 >Emitted(47, 16) Source(47, 16) + SourceIndex(0) +5 >Emitted(47, 17) Source(47, 17) + SourceIndex(0) +6 >Emitted(47, 24) Source(47, 24) + SourceIndex(0) +7 >Emitted(47, 25) Source(47, 25) + SourceIndex(0) +8 >Emitted(47, 26) Source(47, 26) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(48, 2) Source(48, 2) + SourceIndex(0) +--- +>>>for (var _z = 0, multiRobots_2 = multiRobots; _z < multiRobots_2.length; _z++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^^^^^^^^^^^ +10> ^^ +11> ^^^^ +12> ^ +1-> + > +2 >for +3 > +4 > (let [nameB] of +5 > multiRobots +6 > +7 > multiRobots +8 > +9 > multiRobots +10> +11> multiRobots +12> ) +1->Emitted(49, 1) Source(49, 1) + SourceIndex(0) +2 >Emitted(49, 4) Source(49, 4) + SourceIndex(0) +3 >Emitted(49, 5) Source(49, 5) + SourceIndex(0) +4 >Emitted(49, 6) Source(49, 21) + SourceIndex(0) +5 >Emitted(49, 16) Source(49, 32) + SourceIndex(0) +6 >Emitted(49, 18) Source(49, 21) + SourceIndex(0) +7 >Emitted(49, 45) Source(49, 32) + SourceIndex(0) +8 >Emitted(49, 47) Source(49, 21) + SourceIndex(0) +9 >Emitted(49, 72) Source(49, 32) + SourceIndex(0) +10>Emitted(49, 74) Source(49, 21) + SourceIndex(0) +11>Emitted(49, 78) Source(49, 32) + SourceIndex(0) +12>Emitted(49, 79) Source(49, 33) + SourceIndex(0) +--- +>>> var nameB = multiRobots_2[_z][0]; +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 > nameB +1 >Emitted(50, 5) Source(49, 11) + SourceIndex(0) +2 >Emitted(50, 37) Source(49, 16) + SourceIndex(0) +--- +>>> console.log(nameB); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 >] of multiRobots) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameB +7 > ) +8 > ; +1 >Emitted(51, 5) Source(50, 5) + SourceIndex(0) +2 >Emitted(51, 12) Source(50, 12) + SourceIndex(0) +3 >Emitted(51, 13) Source(50, 13) + SourceIndex(0) +4 >Emitted(51, 16) Source(50, 16) + SourceIndex(0) +5 >Emitted(51, 17) Source(50, 17) + SourceIndex(0) +6 >Emitted(51, 22) Source(50, 22) + SourceIndex(0) +7 >Emitted(51, 23) Source(50, 23) + SourceIndex(0) +8 >Emitted(51, 24) Source(50, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(52, 2) Source(51, 2) + SourceIndex(0) +--- +>>>for (var _0 = 0, _1 = getMultiRobots(); _0 < _1.length; _0++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^ +8 > ^^^^^^^^^^^^^^ +9 > ^^ +10> ^^ +11> ^^^^^^^^^^^^^^ +12> ^^ +13> ^^^^ +14> ^ +1-> + > +2 >for +3 > +4 > (let [nameB] of +5 > getMultiRobots() +6 > +7 > +8 > getMultiRobots +9 > () +10> +11> getMultiRobots() +12> +13> getMultiRobots() +14> ) +1->Emitted(53, 1) Source(52, 1) + SourceIndex(0) +2 >Emitted(53, 4) Source(52, 4) + SourceIndex(0) +3 >Emitted(53, 5) Source(52, 5) + SourceIndex(0) +4 >Emitted(53, 6) Source(52, 21) + SourceIndex(0) +5 >Emitted(53, 16) Source(52, 37) + SourceIndex(0) +6 >Emitted(53, 18) Source(52, 21) + SourceIndex(0) +7 >Emitted(53, 23) Source(52, 21) + SourceIndex(0) +8 >Emitted(53, 37) Source(52, 35) + SourceIndex(0) +9 >Emitted(53, 39) Source(52, 37) + SourceIndex(0) +10>Emitted(53, 41) Source(52, 21) + SourceIndex(0) +11>Emitted(53, 55) Source(52, 37) + SourceIndex(0) +12>Emitted(53, 57) Source(52, 21) + SourceIndex(0) +13>Emitted(53, 61) Source(52, 37) + SourceIndex(0) +14>Emitted(53, 62) Source(52, 38) + SourceIndex(0) +--- +>>> var nameB = _1[_0][0]; +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^ +1 > +2 > nameB +1 >Emitted(54, 5) Source(52, 11) + SourceIndex(0) +2 >Emitted(54, 26) Source(52, 16) + SourceIndex(0) +--- +>>> console.log(nameB); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 >] of getMultiRobots()) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameB +7 > ) +8 > ; +1 >Emitted(55, 5) Source(53, 5) + SourceIndex(0) +2 >Emitted(55, 12) Source(53, 12) + SourceIndex(0) +3 >Emitted(55, 13) Source(53, 13) + SourceIndex(0) +4 >Emitted(55, 16) Source(53, 16) + SourceIndex(0) +5 >Emitted(55, 17) Source(53, 17) + SourceIndex(0) +6 >Emitted(55, 22) Source(53, 22) + SourceIndex(0) +7 >Emitted(55, 23) Source(53, 23) + SourceIndex(0) +8 >Emitted(55, 24) Source(53, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(56, 2) Source(54, 2) + SourceIndex(0) +--- +>>>for (var _2 = 0, _3 = [multiRobotA, multiRobotB]; _2 < _3.length; _2++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^ +8 > ^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^ +11> ^ +12> ^^ +13> ^^^^^^^^^^^^^^ +14> ^^ +15> ^^^^ +16> ^ +1-> + > +2 >for +3 > +4 > (let [nameB] of +5 > [multiRobotA, multiRobotB] +6 > +7 > [ +8 > multiRobotA +9 > , +10> multiRobotB +11> ] +12> +13> [multiRobotA, multiRobotB] +14> +15> [multiRobotA, multiRobotB] +16> ) +1->Emitted(57, 1) Source(55, 1) + SourceIndex(0) +2 >Emitted(57, 4) Source(55, 4) + SourceIndex(0) +3 >Emitted(57, 5) Source(55, 5) + SourceIndex(0) +4 >Emitted(57, 6) Source(55, 21) + SourceIndex(0) +5 >Emitted(57, 16) Source(55, 47) + SourceIndex(0) +6 >Emitted(57, 18) Source(55, 21) + SourceIndex(0) +7 >Emitted(57, 24) Source(55, 22) + SourceIndex(0) +8 >Emitted(57, 35) Source(55, 33) + SourceIndex(0) +9 >Emitted(57, 37) Source(55, 35) + SourceIndex(0) +10>Emitted(57, 48) Source(55, 46) + SourceIndex(0) +11>Emitted(57, 49) Source(55, 47) + SourceIndex(0) +12>Emitted(57, 51) Source(55, 21) + SourceIndex(0) +13>Emitted(57, 65) Source(55, 47) + SourceIndex(0) +14>Emitted(57, 67) Source(55, 21) + SourceIndex(0) +15>Emitted(57, 71) Source(55, 47) + SourceIndex(0) +16>Emitted(57, 72) Source(55, 48) + SourceIndex(0) +--- +>>> var nameB = _3[_2][0]; +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^ +1 > +2 > nameB +1 >Emitted(58, 5) Source(55, 11) + SourceIndex(0) +2 >Emitted(58, 26) Source(55, 16) + SourceIndex(0) +--- +>>> console.log(nameB); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 >] of [multiRobotA, multiRobotB]) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameB +7 > ) +8 > ; +1 >Emitted(59, 5) Source(56, 5) + SourceIndex(0) +2 >Emitted(59, 12) Source(56, 12) + SourceIndex(0) +3 >Emitted(59, 13) Source(56, 13) + SourceIndex(0) +4 >Emitted(59, 16) Source(56, 16) + SourceIndex(0) +5 >Emitted(59, 17) Source(56, 17) + SourceIndex(0) +6 >Emitted(59, 22) Source(56, 22) + SourceIndex(0) +7 >Emitted(59, 23) Source(56, 23) + SourceIndex(0) +8 >Emitted(59, 24) Source(56, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(60, 2) Source(57, 2) + SourceIndex(0) +--- +>>>for (var _4 = 0, robots_3 = robots; _4 < robots_3.length; _4++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^^^^^^ +10> ^^ +11> ^^^^ +12> ^ +13> ^^^^^^^^^^^^^^^-> +1-> + > + > +2 >for +3 > +4 > (let [numberA2, nameA2, skillA2] of +5 > robots +6 > +7 > robots +8 > +9 > robots +10> +11> robots +12> ) +1->Emitted(61, 1) Source(59, 1) + SourceIndex(0) +2 >Emitted(61, 4) Source(59, 4) + SourceIndex(0) +3 >Emitted(61, 5) Source(59, 5) + SourceIndex(0) +4 >Emitted(61, 6) Source(59, 41) + SourceIndex(0) +5 >Emitted(61, 16) Source(59, 47) + SourceIndex(0) +6 >Emitted(61, 18) Source(59, 41) + SourceIndex(0) +7 >Emitted(61, 35) Source(59, 47) + SourceIndex(0) +8 >Emitted(61, 37) Source(59, 41) + SourceIndex(0) +9 >Emitted(61, 57) Source(59, 47) + SourceIndex(0) +10>Emitted(61, 59) Source(59, 41) + SourceIndex(0) +11>Emitted(61, 63) Source(59, 47) + SourceIndex(0) +12>Emitted(61, 64) Source(59, 48) + SourceIndex(0) +--- +>>> var _5 = robots_3[_4], numberA2 = _5[0], nameA2 = _5[1], skillA2 = _5[2]; +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^ +1-> +2 > let [numberA2, nameA2, skillA2] +3 > +4 > numberA2 +5 > , +6 > nameA2 +7 > , +8 > skillA2 +1->Emitted(62, 5) Source(59, 6) + SourceIndex(0) +2 >Emitted(62, 26) Source(59, 37) + SourceIndex(0) +3 >Emitted(62, 28) Source(59, 11) + SourceIndex(0) +4 >Emitted(62, 44) Source(59, 19) + SourceIndex(0) +5 >Emitted(62, 46) Source(59, 21) + SourceIndex(0) +6 >Emitted(62, 60) Source(59, 27) + SourceIndex(0) +7 >Emitted(62, 62) Source(59, 29) + SourceIndex(0) +8 >Emitted(62, 77) Source(59, 36) + SourceIndex(0) +--- +>>> console.log(nameA2); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^ +7 > ^ +8 > ^ +1 >] of robots) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA2 +7 > ) +8 > ; +1 >Emitted(63, 5) Source(60, 5) + SourceIndex(0) +2 >Emitted(63, 12) Source(60, 12) + SourceIndex(0) +3 >Emitted(63, 13) Source(60, 13) + SourceIndex(0) +4 >Emitted(63, 16) Source(60, 16) + SourceIndex(0) +5 >Emitted(63, 17) Source(60, 17) + SourceIndex(0) +6 >Emitted(63, 23) Source(60, 23) + SourceIndex(0) +7 >Emitted(63, 24) Source(60, 24) + SourceIndex(0) +8 >Emitted(63, 25) Source(60, 25) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(64, 2) Source(61, 2) + SourceIndex(0) +--- +>>>for (var _6 = 0, _7 = getRobots(); _6 < _7.length; _6++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^ +8 > ^^^^^^^^^ +9 > ^^ +10> ^^ +11> ^^^^^^^^^^^^^^ +12> ^^ +13> ^^^^ +14> ^ +15> ^^^^^^^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > (let [numberA2, nameA2, skillA2] of +5 > getRobots() +6 > +7 > +8 > getRobots +9 > () +10> +11> getRobots() +12> +13> getRobots() +14> ) +1->Emitted(65, 1) Source(62, 1) + SourceIndex(0) +2 >Emitted(65, 4) Source(62, 4) + SourceIndex(0) +3 >Emitted(65, 5) Source(62, 5) + SourceIndex(0) +4 >Emitted(65, 6) Source(62, 41) + SourceIndex(0) +5 >Emitted(65, 16) Source(62, 52) + SourceIndex(0) +6 >Emitted(65, 18) Source(62, 41) + SourceIndex(0) +7 >Emitted(65, 23) Source(62, 41) + SourceIndex(0) +8 >Emitted(65, 32) Source(62, 50) + SourceIndex(0) +9 >Emitted(65, 34) Source(62, 52) + SourceIndex(0) +10>Emitted(65, 36) Source(62, 41) + SourceIndex(0) +11>Emitted(65, 50) Source(62, 52) + SourceIndex(0) +12>Emitted(65, 52) Source(62, 41) + SourceIndex(0) +13>Emitted(65, 56) Source(62, 52) + SourceIndex(0) +14>Emitted(65, 57) Source(62, 53) + SourceIndex(0) +--- +>>> var _8 = _7[_6], numberA2 = _8[0], nameA2 = _8[1], skillA2 = _8[2]; +1->^^^^ +2 > ^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^ +1-> +2 > let [numberA2, nameA2, skillA2] +3 > +4 > numberA2 +5 > , +6 > nameA2 +7 > , +8 > skillA2 +1->Emitted(66, 5) Source(62, 6) + SourceIndex(0) +2 >Emitted(66, 20) Source(62, 37) + SourceIndex(0) +3 >Emitted(66, 22) Source(62, 11) + SourceIndex(0) +4 >Emitted(66, 38) Source(62, 19) + SourceIndex(0) +5 >Emitted(66, 40) Source(62, 21) + SourceIndex(0) +6 >Emitted(66, 54) Source(62, 27) + SourceIndex(0) +7 >Emitted(66, 56) Source(62, 29) + SourceIndex(0) +8 >Emitted(66, 71) Source(62, 36) + SourceIndex(0) +--- +>>> console.log(nameA2); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^ +7 > ^ +8 > ^ +1 >] of getRobots()) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA2 +7 > ) +8 > ; +1 >Emitted(67, 5) Source(63, 5) + SourceIndex(0) +2 >Emitted(67, 12) Source(63, 12) + SourceIndex(0) +3 >Emitted(67, 13) Source(63, 13) + SourceIndex(0) +4 >Emitted(67, 16) Source(63, 16) + SourceIndex(0) +5 >Emitted(67, 17) Source(63, 17) + SourceIndex(0) +6 >Emitted(67, 23) Source(63, 23) + SourceIndex(0) +7 >Emitted(67, 24) Source(63, 24) + SourceIndex(0) +8 >Emitted(67, 25) Source(63, 25) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(68, 2) Source(64, 2) + SourceIndex(0) +--- +>>>for (var _9 = 0, _10 = [robotA, robotB]; _9 < _10.length; _9++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^ +8 > ^^^^^^ +9 > ^^ +10> ^^^^^^ +11> ^ +12> ^^ +13> ^^^^^^^^^^^^^^^ +14> ^^ +15> ^^^^ +16> ^ +17> ^^^^^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > (let [numberA2, nameA2, skillA2] of +5 > [robotA, robotB] +6 > +7 > [ +8 > robotA +9 > , +10> robotB +11> ] +12> +13> [robotA, robotB] +14> +15> [robotA, robotB] +16> ) +1->Emitted(69, 1) Source(65, 1) + SourceIndex(0) +2 >Emitted(69, 4) Source(65, 4) + SourceIndex(0) +3 >Emitted(69, 5) Source(65, 5) + SourceIndex(0) +4 >Emitted(69, 6) Source(65, 41) + SourceIndex(0) +5 >Emitted(69, 16) Source(65, 57) + SourceIndex(0) +6 >Emitted(69, 18) Source(65, 41) + SourceIndex(0) +7 >Emitted(69, 25) Source(65, 42) + SourceIndex(0) +8 >Emitted(69, 31) Source(65, 48) + SourceIndex(0) +9 >Emitted(69, 33) Source(65, 50) + SourceIndex(0) +10>Emitted(69, 39) Source(65, 56) + SourceIndex(0) +11>Emitted(69, 40) Source(65, 57) + SourceIndex(0) +12>Emitted(69, 42) Source(65, 41) + SourceIndex(0) +13>Emitted(69, 57) Source(65, 57) + SourceIndex(0) +14>Emitted(69, 59) Source(65, 41) + SourceIndex(0) +15>Emitted(69, 63) Source(65, 57) + SourceIndex(0) +16>Emitted(69, 64) Source(65, 58) + SourceIndex(0) +--- +>>> var _11 = _10[_9], numberA2 = _11[0], nameA2 = _11[1], skillA2 = _11[2]; +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^ +1-> +2 > let [numberA2, nameA2, skillA2] +3 > +4 > numberA2 +5 > , +6 > nameA2 +7 > , +8 > skillA2 +1->Emitted(70, 5) Source(65, 6) + SourceIndex(0) +2 >Emitted(70, 22) Source(65, 37) + SourceIndex(0) +3 >Emitted(70, 24) Source(65, 11) + SourceIndex(0) +4 >Emitted(70, 41) Source(65, 19) + SourceIndex(0) +5 >Emitted(70, 43) Source(65, 21) + SourceIndex(0) +6 >Emitted(70, 58) Source(65, 27) + SourceIndex(0) +7 >Emitted(70, 60) Source(65, 29) + SourceIndex(0) +8 >Emitted(70, 76) Source(65, 36) + SourceIndex(0) +--- +>>> console.log(nameA2); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^ +7 > ^ +8 > ^ +1 >] of [robotA, robotB]) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA2 +7 > ) +8 > ; +1 >Emitted(71, 5) Source(66, 5) + SourceIndex(0) +2 >Emitted(71, 12) Source(66, 12) + SourceIndex(0) +3 >Emitted(71, 13) Source(66, 13) + SourceIndex(0) +4 >Emitted(71, 16) Source(66, 16) + SourceIndex(0) +5 >Emitted(71, 17) Source(66, 17) + SourceIndex(0) +6 >Emitted(71, 23) Source(66, 23) + SourceIndex(0) +7 >Emitted(71, 24) Source(66, 24) + SourceIndex(0) +8 >Emitted(71, 25) Source(66, 25) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(72, 2) Source(67, 2) + SourceIndex(0) +--- +>>>for (var _12 = 0, multiRobots_3 = multiRobots; _12 < multiRobots_3.length; _12++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^^^^^^^^^^^^ +10> ^^ +11> ^^^^^ +12> ^ +13> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > (let [nameMA, [primarySkillA, secondarySkillA]] of +5 > multiRobots +6 > +7 > multiRobots +8 > +9 > multiRobots +10> +11> multiRobots +12> ) +1->Emitted(73, 1) Source(68, 1) + SourceIndex(0) +2 >Emitted(73, 4) Source(68, 4) + SourceIndex(0) +3 >Emitted(73, 5) Source(68, 5) + SourceIndex(0) +4 >Emitted(73, 6) Source(68, 56) + SourceIndex(0) +5 >Emitted(73, 17) Source(68, 67) + SourceIndex(0) +6 >Emitted(73, 19) Source(68, 56) + SourceIndex(0) +7 >Emitted(73, 46) Source(68, 67) + SourceIndex(0) +8 >Emitted(73, 48) Source(68, 56) + SourceIndex(0) +9 >Emitted(73, 74) Source(68, 67) + SourceIndex(0) +10>Emitted(73, 76) Source(68, 56) + SourceIndex(0) +11>Emitted(73, 81) Source(68, 67) + SourceIndex(0) +12>Emitted(73, 82) Source(68, 68) + SourceIndex(0) +--- +>>> var _13 = multiRobots_3[_12], nameMA = _13[0], _14 = _13[1], primarySkillA = _14[0], secondarySkillA = _14[1]; +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > let [nameMA, [primarySkillA, secondarySkillA]] +3 > +4 > nameMA +5 > , +6 > [primarySkillA, secondarySkillA] +7 > +8 > primarySkillA +9 > , +10> secondarySkillA +1->Emitted(74, 5) Source(68, 6) + SourceIndex(0) +2 >Emitted(74, 33) Source(68, 52) + SourceIndex(0) +3 >Emitted(74, 35) Source(68, 11) + SourceIndex(0) +4 >Emitted(74, 50) Source(68, 17) + SourceIndex(0) +5 >Emitted(74, 52) Source(68, 19) + SourceIndex(0) +6 >Emitted(74, 64) Source(68, 51) + SourceIndex(0) +7 >Emitted(74, 66) Source(68, 20) + SourceIndex(0) +8 >Emitted(74, 88) Source(68, 33) + SourceIndex(0) +9 >Emitted(74, 90) Source(68, 35) + SourceIndex(0) +10>Emitted(74, 114) Source(68, 50) + SourceIndex(0) +--- +>>> console.log(nameMA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^ +7 > ^ +8 > ^ +1 >]] of multiRobots) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameMA +7 > ) +8 > ; +1 >Emitted(75, 5) Source(69, 5) + SourceIndex(0) +2 >Emitted(75, 12) Source(69, 12) + SourceIndex(0) +3 >Emitted(75, 13) Source(69, 13) + SourceIndex(0) +4 >Emitted(75, 16) Source(69, 16) + SourceIndex(0) +5 >Emitted(75, 17) Source(69, 17) + SourceIndex(0) +6 >Emitted(75, 23) Source(69, 23) + SourceIndex(0) +7 >Emitted(75, 24) Source(69, 24) + SourceIndex(0) +8 >Emitted(75, 25) Source(69, 25) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(76, 2) Source(70, 2) + SourceIndex(0) +--- +>>>for (var _15 = 0, _16 = getMultiRobots(); _15 < _16.length; _15++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^ +8 > ^^^^^^^^^^^^^^ +9 > ^^ +10> ^^ +11> ^^^^^^^^^^^^^^^^ +12> ^^ +13> ^^^^^ +14> ^ +15> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > (let [nameMA, [primarySkillA, secondarySkillA]] of +5 > getMultiRobots() +6 > +7 > +8 > getMultiRobots +9 > () +10> +11> getMultiRobots() +12> +13> getMultiRobots() +14> ) +1->Emitted(77, 1) Source(71, 1) + SourceIndex(0) +2 >Emitted(77, 4) Source(71, 4) + SourceIndex(0) +3 >Emitted(77, 5) Source(71, 5) + SourceIndex(0) +4 >Emitted(77, 6) Source(71, 56) + SourceIndex(0) +5 >Emitted(77, 17) Source(71, 72) + SourceIndex(0) +6 >Emitted(77, 19) Source(71, 56) + SourceIndex(0) +7 >Emitted(77, 25) Source(71, 56) + SourceIndex(0) +8 >Emitted(77, 39) Source(71, 70) + SourceIndex(0) +9 >Emitted(77, 41) Source(71, 72) + SourceIndex(0) +10>Emitted(77, 43) Source(71, 56) + SourceIndex(0) +11>Emitted(77, 59) Source(71, 72) + SourceIndex(0) +12>Emitted(77, 61) Source(71, 56) + SourceIndex(0) +13>Emitted(77, 66) Source(71, 72) + SourceIndex(0) +14>Emitted(77, 67) Source(71, 73) + SourceIndex(0) +--- +>>> var _17 = _16[_15], nameMA = _17[0], _18 = _17[1], primarySkillA = _18[0], secondarySkillA = _18[1]; +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > let [nameMA, [primarySkillA, secondarySkillA]] +3 > +4 > nameMA +5 > , +6 > [primarySkillA, secondarySkillA] +7 > +8 > primarySkillA +9 > , +10> secondarySkillA +1->Emitted(78, 5) Source(71, 6) + SourceIndex(0) +2 >Emitted(78, 23) Source(71, 52) + SourceIndex(0) +3 >Emitted(78, 25) Source(71, 11) + SourceIndex(0) +4 >Emitted(78, 40) Source(71, 17) + SourceIndex(0) +5 >Emitted(78, 42) Source(71, 19) + SourceIndex(0) +6 >Emitted(78, 54) Source(71, 51) + SourceIndex(0) +7 >Emitted(78, 56) Source(71, 20) + SourceIndex(0) +8 >Emitted(78, 78) Source(71, 33) + SourceIndex(0) +9 >Emitted(78, 80) Source(71, 35) + SourceIndex(0) +10>Emitted(78, 104) Source(71, 50) + SourceIndex(0) +--- +>>> console.log(nameMA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^ +7 > ^ +8 > ^ +1 >]] of getMultiRobots()) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameMA +7 > ) +8 > ; +1 >Emitted(79, 5) Source(72, 5) + SourceIndex(0) +2 >Emitted(79, 12) Source(72, 12) + SourceIndex(0) +3 >Emitted(79, 13) Source(72, 13) + SourceIndex(0) +4 >Emitted(79, 16) Source(72, 16) + SourceIndex(0) +5 >Emitted(79, 17) Source(72, 17) + SourceIndex(0) +6 >Emitted(79, 23) Source(72, 23) + SourceIndex(0) +7 >Emitted(79, 24) Source(72, 24) + SourceIndex(0) +8 >Emitted(79, 25) Source(72, 25) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(80, 2) Source(73, 2) + SourceIndex(0) +--- +>>>for (var _19 = 0, _20 = [multiRobotA, multiRobotB]; _19 < _20.length; _19++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^ +8 > ^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^ +11> ^ +12> ^^ +13> ^^^^^^^^^^^^^^^^ +14> ^^ +15> ^^^^^ +16> ^ +17> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > (let [nameMA, [primarySkillA, secondarySkillA]] of +5 > [multiRobotA, multiRobotB] +6 > +7 > [ +8 > multiRobotA +9 > , +10> multiRobotB +11> ] +12> +13> [multiRobotA, multiRobotB] +14> +15> [multiRobotA, multiRobotB] +16> ) +1->Emitted(81, 1) Source(74, 1) + SourceIndex(0) +2 >Emitted(81, 4) Source(74, 4) + SourceIndex(0) +3 >Emitted(81, 5) Source(74, 5) + SourceIndex(0) +4 >Emitted(81, 6) Source(74, 56) + SourceIndex(0) +5 >Emitted(81, 17) Source(74, 82) + SourceIndex(0) +6 >Emitted(81, 19) Source(74, 56) + SourceIndex(0) +7 >Emitted(81, 26) Source(74, 57) + SourceIndex(0) +8 >Emitted(81, 37) Source(74, 68) + SourceIndex(0) +9 >Emitted(81, 39) Source(74, 70) + SourceIndex(0) +10>Emitted(81, 50) Source(74, 81) + SourceIndex(0) +11>Emitted(81, 51) Source(74, 82) + SourceIndex(0) +12>Emitted(81, 53) Source(74, 56) + SourceIndex(0) +13>Emitted(81, 69) Source(74, 82) + SourceIndex(0) +14>Emitted(81, 71) Source(74, 56) + SourceIndex(0) +15>Emitted(81, 76) Source(74, 82) + SourceIndex(0) +16>Emitted(81, 77) Source(74, 83) + SourceIndex(0) +--- +>>> var _21 = _20[_19], nameMA = _21[0], _22 = _21[1], primarySkillA = _22[0], secondarySkillA = _22[1]; +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > let [nameMA, [primarySkillA, secondarySkillA]] +3 > +4 > nameMA +5 > , +6 > [primarySkillA, secondarySkillA] +7 > +8 > primarySkillA +9 > , +10> secondarySkillA +1->Emitted(82, 5) Source(74, 6) + SourceIndex(0) +2 >Emitted(82, 23) Source(74, 52) + SourceIndex(0) +3 >Emitted(82, 25) Source(74, 11) + SourceIndex(0) +4 >Emitted(82, 40) Source(74, 17) + SourceIndex(0) +5 >Emitted(82, 42) Source(74, 19) + SourceIndex(0) +6 >Emitted(82, 54) Source(74, 51) + SourceIndex(0) +7 >Emitted(82, 56) Source(74, 20) + SourceIndex(0) +8 >Emitted(82, 78) Source(74, 33) + SourceIndex(0) +9 >Emitted(82, 80) Source(74, 35) + SourceIndex(0) +10>Emitted(82, 104) Source(74, 50) + SourceIndex(0) +--- +>>> console.log(nameMA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^ +7 > ^ +8 > ^ +1 >]] of [multiRobotA, multiRobotB]) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameMA +7 > ) +8 > ; +1 >Emitted(83, 5) Source(75, 5) + SourceIndex(0) +2 >Emitted(83, 12) Source(75, 12) + SourceIndex(0) +3 >Emitted(83, 13) Source(75, 13) + SourceIndex(0) +4 >Emitted(83, 16) Source(75, 16) + SourceIndex(0) +5 >Emitted(83, 17) Source(75, 17) + SourceIndex(0) +6 >Emitted(83, 23) Source(75, 23) + SourceIndex(0) +7 >Emitted(83, 24) Source(75, 24) + SourceIndex(0) +8 >Emitted(83, 25) Source(75, 25) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(84, 2) Source(76, 2) + SourceIndex(0) +--- +>>>for (var _23 = 0, robots_4 = robots; _23 < robots_4.length; _23++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^^^^^^^ +10> ^^ +11> ^^^^^ +12> ^ +13> ^^^^^^^^^-> +1-> + > + > +2 >for +3 > +4 > (let [numberA3, ...robotAInfo] of +5 > robots +6 > +7 > robots +8 > +9 > robots +10> +11> robots +12> ) +1->Emitted(85, 1) Source(78, 1) + SourceIndex(0) +2 >Emitted(85, 4) Source(78, 4) + SourceIndex(0) +3 >Emitted(85, 5) Source(78, 5) + SourceIndex(0) +4 >Emitted(85, 6) Source(78, 39) + SourceIndex(0) +5 >Emitted(85, 17) Source(78, 45) + SourceIndex(0) +6 >Emitted(85, 19) Source(78, 39) + SourceIndex(0) +7 >Emitted(85, 36) Source(78, 45) + SourceIndex(0) +8 >Emitted(85, 38) Source(78, 39) + SourceIndex(0) +9 >Emitted(85, 59) Source(78, 45) + SourceIndex(0) +10>Emitted(85, 61) Source(78, 39) + SourceIndex(0) +11>Emitted(85, 66) Source(78, 45) + SourceIndex(0) +12>Emitted(85, 67) Source(78, 46) + SourceIndex(0) +--- +>>> var _24 = robots_4[_23], numberA3 = _24[0], robotAInfo = _24.slice(1); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > let [numberA3, ...robotAInfo] +3 > +4 > numberA3 +5 > , +6 > ...robotAInfo +1->Emitted(86, 5) Source(78, 6) + SourceIndex(0) +2 >Emitted(86, 28) Source(78, 35) + SourceIndex(0) +3 >Emitted(86, 30) Source(78, 11) + SourceIndex(0) +4 >Emitted(86, 47) Source(78, 19) + SourceIndex(0) +5 >Emitted(86, 49) Source(78, 21) + SourceIndex(0) +6 >Emitted(86, 74) Source(78, 34) + SourceIndex(0) +--- +>>> console.log(numberA3); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1 >] of robots) { + > +2 > console +3 > . +4 > log +5 > ( +6 > numberA3 +7 > ) +8 > ; +1 >Emitted(87, 5) Source(79, 5) + SourceIndex(0) +2 >Emitted(87, 12) Source(79, 12) + SourceIndex(0) +3 >Emitted(87, 13) Source(79, 13) + SourceIndex(0) +4 >Emitted(87, 16) Source(79, 16) + SourceIndex(0) +5 >Emitted(87, 17) Source(79, 17) + SourceIndex(0) +6 >Emitted(87, 25) Source(79, 25) + SourceIndex(0) +7 >Emitted(87, 26) Source(79, 26) + SourceIndex(0) +8 >Emitted(87, 27) Source(79, 27) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(88, 2) Source(80, 2) + SourceIndex(0) +--- +>>>for (var _25 = 0, _26 = getRobots(); _25 < _26.length; _25++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^ +8 > ^^^^^^^^^ +9 > ^^ +10> ^^ +11> ^^^^^^^^^^^^^^^^ +12> ^^ +13> ^^^^^ +14> ^ +15> ^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > (let [numberA3, ...robotAInfo] of +5 > getRobots() +6 > +7 > +8 > getRobots +9 > () +10> +11> getRobots() +12> +13> getRobots() +14> ) +1->Emitted(89, 1) Source(81, 1) + SourceIndex(0) +2 >Emitted(89, 4) Source(81, 4) + SourceIndex(0) +3 >Emitted(89, 5) Source(81, 5) + SourceIndex(0) +4 >Emitted(89, 6) Source(81, 39) + SourceIndex(0) +5 >Emitted(89, 17) Source(81, 50) + SourceIndex(0) +6 >Emitted(89, 19) Source(81, 39) + SourceIndex(0) +7 >Emitted(89, 25) Source(81, 39) + SourceIndex(0) +8 >Emitted(89, 34) Source(81, 48) + SourceIndex(0) +9 >Emitted(89, 36) Source(81, 50) + SourceIndex(0) +10>Emitted(89, 38) Source(81, 39) + SourceIndex(0) +11>Emitted(89, 54) Source(81, 50) + SourceIndex(0) +12>Emitted(89, 56) Source(81, 39) + SourceIndex(0) +13>Emitted(89, 61) Source(81, 50) + SourceIndex(0) +14>Emitted(89, 62) Source(81, 51) + SourceIndex(0) +--- +>>> var _27 = _26[_25], numberA3 = _27[0], robotAInfo = _27.slice(1); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > let [numberA3, ...robotAInfo] +3 > +4 > numberA3 +5 > , +6 > ...robotAInfo +1->Emitted(90, 5) Source(81, 6) + SourceIndex(0) +2 >Emitted(90, 23) Source(81, 35) + SourceIndex(0) +3 >Emitted(90, 25) Source(81, 11) + SourceIndex(0) +4 >Emitted(90, 42) Source(81, 19) + SourceIndex(0) +5 >Emitted(90, 44) Source(81, 21) + SourceIndex(0) +6 >Emitted(90, 69) Source(81, 34) + SourceIndex(0) +--- +>>> console.log(numberA3); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1 >] of getRobots()) { + > +2 > console +3 > . +4 > log +5 > ( +6 > numberA3 +7 > ) +8 > ; +1 >Emitted(91, 5) Source(82, 5) + SourceIndex(0) +2 >Emitted(91, 12) Source(82, 12) + SourceIndex(0) +3 >Emitted(91, 13) Source(82, 13) + SourceIndex(0) +4 >Emitted(91, 16) Source(82, 16) + SourceIndex(0) +5 >Emitted(91, 17) Source(82, 17) + SourceIndex(0) +6 >Emitted(91, 25) Source(82, 25) + SourceIndex(0) +7 >Emitted(91, 26) Source(82, 26) + SourceIndex(0) +8 >Emitted(91, 27) Source(82, 27) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(92, 2) Source(83, 2) + SourceIndex(0) +--- +>>>for (var _28 = 0, _29 = [robotA, robotB]; _28 < _29.length; _28++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^ +8 > ^^^^^^ +9 > ^^ +10> ^^^^^^ +11> ^ +12> ^^ +13> ^^^^^^^^^^^^^^^^ +14> ^^ +15> ^^^^^ +16> ^ +17> ^^^^-> +1-> + > +2 >for +3 > +4 > (let [numberA3, ...robotAInfo] of +5 > [robotA, robotB] +6 > +7 > [ +8 > robotA +9 > , +10> robotB +11> ] +12> +13> [robotA, robotB] +14> +15> [robotA, robotB] +16> ) +1->Emitted(93, 1) Source(84, 1) + SourceIndex(0) +2 >Emitted(93, 4) Source(84, 4) + SourceIndex(0) +3 >Emitted(93, 5) Source(84, 5) + SourceIndex(0) +4 >Emitted(93, 6) Source(84, 39) + SourceIndex(0) +5 >Emitted(93, 17) Source(84, 55) + SourceIndex(0) +6 >Emitted(93, 19) Source(84, 39) + SourceIndex(0) +7 >Emitted(93, 26) Source(84, 40) + SourceIndex(0) +8 >Emitted(93, 32) Source(84, 46) + SourceIndex(0) +9 >Emitted(93, 34) Source(84, 48) + SourceIndex(0) +10>Emitted(93, 40) Source(84, 54) + SourceIndex(0) +11>Emitted(93, 41) Source(84, 55) + SourceIndex(0) +12>Emitted(93, 43) Source(84, 39) + SourceIndex(0) +13>Emitted(93, 59) Source(84, 55) + SourceIndex(0) +14>Emitted(93, 61) Source(84, 39) + SourceIndex(0) +15>Emitted(93, 66) Source(84, 55) + SourceIndex(0) +16>Emitted(93, 67) Source(84, 56) + SourceIndex(0) +--- +>>> var _30 = _29[_28], numberA3 = _30[0], robotAInfo = _30.slice(1); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > let [numberA3, ...robotAInfo] +3 > +4 > numberA3 +5 > , +6 > ...robotAInfo +1->Emitted(94, 5) Source(84, 6) + SourceIndex(0) +2 >Emitted(94, 23) Source(84, 35) + SourceIndex(0) +3 >Emitted(94, 25) Source(84, 11) + SourceIndex(0) +4 >Emitted(94, 42) Source(84, 19) + SourceIndex(0) +5 >Emitted(94, 44) Source(84, 21) + SourceIndex(0) +6 >Emitted(94, 69) Source(84, 34) + SourceIndex(0) +--- +>>> console.log(numberA3); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1 >] of [robotA, robotB]) { + > +2 > console +3 > . +4 > log +5 > ( +6 > numberA3 +7 > ) +8 > ; +1 >Emitted(95, 5) Source(85, 5) + SourceIndex(0) +2 >Emitted(95, 12) Source(85, 12) + SourceIndex(0) +3 >Emitted(95, 13) Source(85, 13) + SourceIndex(0) +4 >Emitted(95, 16) Source(85, 16) + SourceIndex(0) +5 >Emitted(95, 17) Source(85, 17) + SourceIndex(0) +6 >Emitted(95, 25) Source(85, 25) + SourceIndex(0) +7 >Emitted(95, 26) Source(85, 26) + SourceIndex(0) +8 >Emitted(95, 27) Source(85, 27) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(96, 2) Source(86, 2) + SourceIndex(0) +--- +>>>for (var _31 = 0, multiRobots_4 = multiRobots; _31 < multiRobots_4.length; _31++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^^^^^^^^^^^^ +10> ^^ +11> ^^^^^ +12> ^ +1-> + > +2 >for +3 > +4 > (let [...multiRobotAInfo] of +5 > multiRobots +6 > +7 > multiRobots +8 > +9 > multiRobots +10> +11> multiRobots +12> ) +1->Emitted(97, 1) Source(87, 1) + SourceIndex(0) +2 >Emitted(97, 4) Source(87, 4) + SourceIndex(0) +3 >Emitted(97, 5) Source(87, 5) + SourceIndex(0) +4 >Emitted(97, 6) Source(87, 34) + SourceIndex(0) +5 >Emitted(97, 17) Source(87, 45) + SourceIndex(0) +6 >Emitted(97, 19) Source(87, 34) + SourceIndex(0) +7 >Emitted(97, 46) Source(87, 45) + SourceIndex(0) +8 >Emitted(97, 48) Source(87, 34) + SourceIndex(0) +9 >Emitted(97, 74) Source(87, 45) + SourceIndex(0) +10>Emitted(97, 76) Source(87, 34) + SourceIndex(0) +11>Emitted(97, 81) Source(87, 45) + SourceIndex(0) +12>Emitted(97, 82) Source(87, 46) + SourceIndex(0) +--- +>>> var multiRobotAInfo = multiRobots_4[_31].slice(0); +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 > ...multiRobotAInfo +1 >Emitted(98, 5) Source(87, 11) + SourceIndex(0) +2 >Emitted(98, 54) Source(87, 29) + SourceIndex(0) +--- +>>> console.log(multiRobotAInfo); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^^^^^^^^ +7 > ^ +8 > ^ +1 >] of multiRobots) { + > +2 > console +3 > . +4 > log +5 > ( +6 > multiRobotAInfo +7 > ) +8 > ; +1 >Emitted(99, 5) Source(88, 5) + SourceIndex(0) +2 >Emitted(99, 12) Source(88, 12) + SourceIndex(0) +3 >Emitted(99, 13) Source(88, 13) + SourceIndex(0) +4 >Emitted(99, 16) Source(88, 16) + SourceIndex(0) +5 >Emitted(99, 17) Source(88, 17) + SourceIndex(0) +6 >Emitted(99, 32) Source(88, 32) + SourceIndex(0) +7 >Emitted(99, 33) Source(88, 33) + SourceIndex(0) +8 >Emitted(99, 34) Source(88, 34) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(100, 2) Source(89, 2) + SourceIndex(0) +--- +>>>for (var _32 = 0, _33 = getMultiRobots(); _32 < _33.length; _32++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^ +8 > ^^^^^^^^^^^^^^ +9 > ^^ +10> ^^ +11> ^^^^^^^^^^^^^^^^ +12> ^^ +13> ^^^^^ +14> ^ +1-> + > +2 >for +3 > +4 > (let [...multiRobotAInfo] of +5 > getMultiRobots() +6 > +7 > +8 > getMultiRobots +9 > () +10> +11> getMultiRobots() +12> +13> getMultiRobots() +14> ) +1->Emitted(101, 1) Source(90, 1) + SourceIndex(0) +2 >Emitted(101, 4) Source(90, 4) + SourceIndex(0) +3 >Emitted(101, 5) Source(90, 5) + SourceIndex(0) +4 >Emitted(101, 6) Source(90, 34) + SourceIndex(0) +5 >Emitted(101, 17) Source(90, 50) + SourceIndex(0) +6 >Emitted(101, 19) Source(90, 34) + SourceIndex(0) +7 >Emitted(101, 25) Source(90, 34) + SourceIndex(0) +8 >Emitted(101, 39) Source(90, 48) + SourceIndex(0) +9 >Emitted(101, 41) Source(90, 50) + SourceIndex(0) +10>Emitted(101, 43) Source(90, 34) + SourceIndex(0) +11>Emitted(101, 59) Source(90, 50) + SourceIndex(0) +12>Emitted(101, 61) Source(90, 34) + SourceIndex(0) +13>Emitted(101, 66) Source(90, 50) + SourceIndex(0) +14>Emitted(101, 67) Source(90, 51) + SourceIndex(0) +--- +>>> var multiRobotAInfo = _33[_32].slice(0); +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 > ...multiRobotAInfo +1 >Emitted(102, 5) Source(90, 11) + SourceIndex(0) +2 >Emitted(102, 44) Source(90, 29) + SourceIndex(0) +--- +>>> console.log(multiRobotAInfo); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^^^^^^^^ +7 > ^ +8 > ^ +1 >] of getMultiRobots()) { + > +2 > console +3 > . +4 > log +5 > ( +6 > multiRobotAInfo +7 > ) +8 > ; +1 >Emitted(103, 5) Source(91, 5) + SourceIndex(0) +2 >Emitted(103, 12) Source(91, 12) + SourceIndex(0) +3 >Emitted(103, 13) Source(91, 13) + SourceIndex(0) +4 >Emitted(103, 16) Source(91, 16) + SourceIndex(0) +5 >Emitted(103, 17) Source(91, 17) + SourceIndex(0) +6 >Emitted(103, 32) Source(91, 32) + SourceIndex(0) +7 >Emitted(103, 33) Source(91, 33) + SourceIndex(0) +8 >Emitted(103, 34) Source(91, 34) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(104, 2) Source(92, 2) + SourceIndex(0) +--- +>>>for (var _34 = 0, _35 = [multiRobotA, multiRobotB]; _34 < _35.length; _34++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^ +8 > ^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^ +11> ^ +12> ^^ +13> ^^^^^^^^^^^^^^^^ +14> ^^ +15> ^^^^^ +16> ^ +1-> + > +2 >for +3 > +4 > (let [...multiRobotAInfo] of +5 > [multiRobotA, multiRobotB] +6 > +7 > [ +8 > multiRobotA +9 > , +10> multiRobotB +11> ] +12> +13> [multiRobotA, multiRobotB] +14> +15> [multiRobotA, multiRobotB] +16> ) +1->Emitted(105, 1) Source(93, 1) + SourceIndex(0) +2 >Emitted(105, 4) Source(93, 4) + SourceIndex(0) +3 >Emitted(105, 5) Source(93, 5) + SourceIndex(0) +4 >Emitted(105, 6) Source(93, 34) + SourceIndex(0) +5 >Emitted(105, 17) Source(93, 60) + SourceIndex(0) +6 >Emitted(105, 19) Source(93, 34) + SourceIndex(0) +7 >Emitted(105, 26) Source(93, 35) + SourceIndex(0) +8 >Emitted(105, 37) Source(93, 46) + SourceIndex(0) +9 >Emitted(105, 39) Source(93, 48) + SourceIndex(0) +10>Emitted(105, 50) Source(93, 59) + SourceIndex(0) +11>Emitted(105, 51) Source(93, 60) + SourceIndex(0) +12>Emitted(105, 53) Source(93, 34) + SourceIndex(0) +13>Emitted(105, 69) Source(93, 60) + SourceIndex(0) +14>Emitted(105, 71) Source(93, 34) + SourceIndex(0) +15>Emitted(105, 76) Source(93, 60) + SourceIndex(0) +16>Emitted(105, 77) Source(93, 61) + SourceIndex(0) +--- +>>> var multiRobotAInfo = _35[_34].slice(0); +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 > ...multiRobotAInfo +1 >Emitted(106, 5) Source(93, 11) + SourceIndex(0) +2 >Emitted(106, 44) Source(93, 29) + SourceIndex(0) +--- +>>> console.log(multiRobotAInfo); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^^^^^^^^ +7 > ^ +8 > ^ +1 >] of [multiRobotA, multiRobotB]) { + > +2 > console +3 > . +4 > log +5 > ( +6 > multiRobotAInfo +7 > ) +8 > ; +1 >Emitted(107, 5) Source(94, 5) + SourceIndex(0) +2 >Emitted(107, 12) Source(94, 12) + SourceIndex(0) +3 >Emitted(107, 13) Source(94, 13) + SourceIndex(0) +4 >Emitted(107, 16) Source(94, 16) + SourceIndex(0) +5 >Emitted(107, 17) Source(94, 17) + SourceIndex(0) +6 >Emitted(107, 32) Source(94, 32) + SourceIndex(0) +7 >Emitted(107, 33) Source(94, 33) + SourceIndex(0) +8 >Emitted(107, 34) Source(94, 34) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(108, 2) Source(95, 2) + SourceIndex(0) +--- +>>>//# sourceMappingURL=sourceMapValidationDestructuringForOfArrayBindingPattern.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPattern.symbols b/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPattern.symbols new file mode 100644 index 00000000000..7d4412805e0 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPattern.symbols @@ -0,0 +1,323 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringForOfArrayBindingPattern.ts === +declare var console: { +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 0, 11)) + + log(msg: any): void; +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 0, 22)) +>msg : Symbol(msg, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 1, 8)) +} +type Robot = [number, string, string]; +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 2, 1)) + +type MultiSkilledRobot = [string, [string, string]]; +>MultiSkilledRobot : Symbol(MultiSkilledRobot, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 3, 38)) + +let robotA: Robot = [1, "mower", "mowing"]; +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 6, 3)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 2, 1)) + +let robotB: Robot = [2, "trimmer", "trimming"]; +>robotB : Symbol(robotB, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 7, 3)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 2, 1)) + +let robots = [robotA, robotB]; +>robots : Symbol(robots, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 8, 3)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 6, 3)) +>robotB : Symbol(robotB, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 7, 3)) + +function getRobots() { +>getRobots : Symbol(getRobots, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 8, 30)) + + return robots; +>robots : Symbol(robots, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 8, 3)) +} + +let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; +>multiRobotA : Symbol(multiRobotA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 13, 3)) +>MultiSkilledRobot : Symbol(MultiSkilledRobot, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 3, 38)) + +let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; +>multiRobotB : Symbol(multiRobotB, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 14, 3)) +>MultiSkilledRobot : Symbol(MultiSkilledRobot, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 3, 38)) + +let multiRobots = [multiRobotA, multiRobotB]; +>multiRobots : Symbol(multiRobots, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 15, 3)) +>multiRobotA : Symbol(multiRobotA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 13, 3)) +>multiRobotB : Symbol(multiRobotB, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 14, 3)) + +function getMultiRobots() { +>getMultiRobots : Symbol(getMultiRobots, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 15, 45)) + + return multiRobots; +>multiRobots : Symbol(multiRobots, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 15, 3)) +} + +for (let [, nameA] of robots) { +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 20, 11)) +>robots : Symbol(robots, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 8, 3)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 20, 11)) +} +for (let [, nameA] of getRobots()) { +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 23, 11)) +>getRobots : Symbol(getRobots, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 8, 30)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 23, 11)) +} +for (let [, nameA] of [robotA, robotB]) { +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 26, 11)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 6, 3)) +>robotB : Symbol(robotB, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 7, 3)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 26, 11)) +} +for (let [, [primarySkillA, secondarySkillA]] of multiRobots) { +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 29, 13)) +>secondarySkillA : Symbol(secondarySkillA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 29, 27)) +>multiRobots : Symbol(multiRobots, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 15, 3)) + + console.log(primarySkillA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 0, 22)) +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 29, 13)) +} +for (let [, [primarySkillA, secondarySkillA]] of getMultiRobots()) { +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 32, 13)) +>secondarySkillA : Symbol(secondarySkillA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 32, 27)) +>getMultiRobots : Symbol(getMultiRobots, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 15, 45)) + + console.log(primarySkillA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 0, 22)) +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 32, 13)) +} +for (let [, [primarySkillA, secondarySkillA]] of [multiRobotA, multiRobotB]) { +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 35, 13)) +>secondarySkillA : Symbol(secondarySkillA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 35, 27)) +>multiRobotA : Symbol(multiRobotA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 13, 3)) +>multiRobotB : Symbol(multiRobotB, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 14, 3)) + + console.log(primarySkillA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 0, 22)) +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 35, 13)) +} + +for (let [numberB] of robots) { +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 39, 10)) +>robots : Symbol(robots, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 8, 3)) + + console.log(numberB); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 0, 22)) +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 39, 10)) +} +for (let [numberB] of getRobots()) { +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 42, 10)) +>getRobots : Symbol(getRobots, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 8, 30)) + + console.log(numberB); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 0, 22)) +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 42, 10)) +} +for (let [numberB] of [robotA, robotB]) { +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 45, 10)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 6, 3)) +>robotB : Symbol(robotB, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 7, 3)) + + console.log(numberB); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 0, 22)) +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 45, 10)) +} +for (let [nameB] of multiRobots) { +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 48, 10)) +>multiRobots : Symbol(multiRobots, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 15, 3)) + + console.log(nameB); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 0, 22)) +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 48, 10)) +} +for (let [nameB] of getMultiRobots()) { +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 51, 10)) +>getMultiRobots : Symbol(getMultiRobots, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 15, 45)) + + console.log(nameB); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 0, 22)) +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 51, 10)) +} +for (let [nameB] of [multiRobotA, multiRobotB]) { +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 54, 10)) +>multiRobotA : Symbol(multiRobotA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 13, 3)) +>multiRobotB : Symbol(multiRobotB, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 14, 3)) + + console.log(nameB); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 0, 22)) +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 54, 10)) +} + +for (let [numberA2, nameA2, skillA2] of robots) { +>numberA2 : Symbol(numberA2, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 58, 10)) +>nameA2 : Symbol(nameA2, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 58, 19)) +>skillA2 : Symbol(skillA2, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 58, 27)) +>robots : Symbol(robots, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 8, 3)) + + console.log(nameA2); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 0, 22)) +>nameA2 : Symbol(nameA2, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 58, 19)) +} +for (let [numberA2, nameA2, skillA2] of getRobots()) { +>numberA2 : Symbol(numberA2, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 61, 10)) +>nameA2 : Symbol(nameA2, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 61, 19)) +>skillA2 : Symbol(skillA2, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 61, 27)) +>getRobots : Symbol(getRobots, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 8, 30)) + + console.log(nameA2); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 0, 22)) +>nameA2 : Symbol(nameA2, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 61, 19)) +} +for (let [numberA2, nameA2, skillA2] of [robotA, robotB]) { +>numberA2 : Symbol(numberA2, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 64, 10)) +>nameA2 : Symbol(nameA2, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 64, 19)) +>skillA2 : Symbol(skillA2, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 64, 27)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 6, 3)) +>robotB : Symbol(robotB, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 7, 3)) + + console.log(nameA2); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 0, 22)) +>nameA2 : Symbol(nameA2, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 64, 19)) +} +for (let [nameMA, [primarySkillA, secondarySkillA]] of multiRobots) { +>nameMA : Symbol(nameMA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 67, 10)) +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 67, 19)) +>secondarySkillA : Symbol(secondarySkillA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 67, 33)) +>multiRobots : Symbol(multiRobots, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 15, 3)) + + console.log(nameMA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 0, 22)) +>nameMA : Symbol(nameMA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 67, 10)) +} +for (let [nameMA, [primarySkillA, secondarySkillA]] of getMultiRobots()) { +>nameMA : Symbol(nameMA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 70, 10)) +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 70, 19)) +>secondarySkillA : Symbol(secondarySkillA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 70, 33)) +>getMultiRobots : Symbol(getMultiRobots, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 15, 45)) + + console.log(nameMA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 0, 22)) +>nameMA : Symbol(nameMA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 70, 10)) +} +for (let [nameMA, [primarySkillA, secondarySkillA]] of [multiRobotA, multiRobotB]) { +>nameMA : Symbol(nameMA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 73, 10)) +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 73, 19)) +>secondarySkillA : Symbol(secondarySkillA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 73, 33)) +>multiRobotA : Symbol(multiRobotA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 13, 3)) +>multiRobotB : Symbol(multiRobotB, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 14, 3)) + + console.log(nameMA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 0, 22)) +>nameMA : Symbol(nameMA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 73, 10)) +} + +for (let [numberA3, ...robotAInfo] of robots) { +>numberA3 : Symbol(numberA3, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 77, 10)) +>robotAInfo : Symbol(robotAInfo, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 77, 19)) +>robots : Symbol(robots, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 8, 3)) + + console.log(numberA3); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 0, 22)) +>numberA3 : Symbol(numberA3, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 77, 10)) +} +for (let [numberA3, ...robotAInfo] of getRobots()) { +>numberA3 : Symbol(numberA3, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 80, 10)) +>robotAInfo : Symbol(robotAInfo, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 80, 19)) +>getRobots : Symbol(getRobots, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 8, 30)) + + console.log(numberA3); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 0, 22)) +>numberA3 : Symbol(numberA3, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 80, 10)) +} +for (let [numberA3, ...robotAInfo] of [robotA, robotB]) { +>numberA3 : Symbol(numberA3, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 83, 10)) +>robotAInfo : Symbol(robotAInfo, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 83, 19)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 6, 3)) +>robotB : Symbol(robotB, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 7, 3)) + + console.log(numberA3); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 0, 22)) +>numberA3 : Symbol(numberA3, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 83, 10)) +} +for (let [...multiRobotAInfo] of multiRobots) { +>multiRobotAInfo : Symbol(multiRobotAInfo, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 86, 10)) +>multiRobots : Symbol(multiRobots, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 15, 3)) + + console.log(multiRobotAInfo); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 0, 22)) +>multiRobotAInfo : Symbol(multiRobotAInfo, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 86, 10)) +} +for (let [...multiRobotAInfo] of getMultiRobots()) { +>multiRobotAInfo : Symbol(multiRobotAInfo, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 89, 10)) +>getMultiRobots : Symbol(getMultiRobots, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 15, 45)) + + console.log(multiRobotAInfo); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 0, 22)) +>multiRobotAInfo : Symbol(multiRobotAInfo, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 89, 10)) +} +for (let [...multiRobotAInfo] of [multiRobotA, multiRobotB]) { +>multiRobotAInfo : Symbol(multiRobotAInfo, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 92, 10)) +>multiRobotA : Symbol(multiRobotA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 13, 3)) +>multiRobotB : Symbol(multiRobotB, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 14, 3)) + + console.log(multiRobotAInfo); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 0, 22)) +>multiRobotAInfo : Symbol(multiRobotAInfo, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern.ts, 92, 10)) +} diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPattern.types b/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPattern.types new file mode 100644 index 00000000000..95c947f8fcc --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPattern.types @@ -0,0 +1,389 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringForOfArrayBindingPattern.ts === +declare var console: { +>console : { log(msg: any): void; } + + log(msg: any): void; +>log : (msg: any) => void +>msg : any +} +type Robot = [number, string, string]; +>Robot : [number, string, string] + +type MultiSkilledRobot = [string, [string, string]]; +>MultiSkilledRobot : [string, [string, string]] + +let robotA: Robot = [1, "mower", "mowing"]; +>robotA : [number, string, string] +>Robot : [number, string, string] +>[1, "mower", "mowing"] : [number, string, string] +>1 : number +>"mower" : string +>"mowing" : string + +let robotB: Robot = [2, "trimmer", "trimming"]; +>robotB : [number, string, string] +>Robot : [number, string, string] +>[2, "trimmer", "trimming"] : [number, string, string] +>2 : number +>"trimmer" : string +>"trimming" : string + +let robots = [robotA, robotB]; +>robots : [number, string, string][] +>[robotA, robotB] : [number, string, string][] +>robotA : [number, string, string] +>robotB : [number, string, string] + +function getRobots() { +>getRobots : () => [number, string, string][] + + return robots; +>robots : [number, string, string][] +} + +let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; +>multiRobotA : [string, [string, string]] +>MultiSkilledRobot : [string, [string, string]] +>["mower", ["mowing", ""]] : [string, [string, string]] +>"mower" : string +>["mowing", ""] : [string, string] +>"mowing" : string +>"" : string + +let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; +>multiRobotB : [string, [string, string]] +>MultiSkilledRobot : [string, [string, string]] +>["trimmer", ["trimming", "edging"]] : [string, [string, string]] +>"trimmer" : string +>["trimming", "edging"] : [string, string] +>"trimming" : string +>"edging" : string + +let multiRobots = [multiRobotA, multiRobotB]; +>multiRobots : [string, [string, string]][] +>[multiRobotA, multiRobotB] : [string, [string, string]][] +>multiRobotA : [string, [string, string]] +>multiRobotB : [string, [string, string]] + +function getMultiRobots() { +>getMultiRobots : () => [string, [string, string]][] + + return multiRobots; +>multiRobots : [string, [string, string]][] +} + +for (let [, nameA] of robots) { +> : undefined +>nameA : string +>robots : [number, string, string][] + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for (let [, nameA] of getRobots()) { +> : undefined +>nameA : string +>getRobots() : [number, string, string][] +>getRobots : () => [number, string, string][] + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for (let [, nameA] of [robotA, robotB]) { +> : undefined +>nameA : string +>[robotA, robotB] : [number, string, string][] +>robotA : [number, string, string] +>robotB : [number, string, string] + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for (let [, [primarySkillA, secondarySkillA]] of multiRobots) { +> : undefined +>primarySkillA : string +>secondarySkillA : string +>multiRobots : [string, [string, string]][] + + console.log(primarySkillA); +>console.log(primarySkillA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primarySkillA : string +} +for (let [, [primarySkillA, secondarySkillA]] of getMultiRobots()) { +> : undefined +>primarySkillA : string +>secondarySkillA : string +>getMultiRobots() : [string, [string, string]][] +>getMultiRobots : () => [string, [string, string]][] + + console.log(primarySkillA); +>console.log(primarySkillA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primarySkillA : string +} +for (let [, [primarySkillA, secondarySkillA]] of [multiRobotA, multiRobotB]) { +> : undefined +>primarySkillA : string +>secondarySkillA : string +>[multiRobotA, multiRobotB] : [string, [string, string]][] +>multiRobotA : [string, [string, string]] +>multiRobotB : [string, [string, string]] + + console.log(primarySkillA); +>console.log(primarySkillA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primarySkillA : string +} + +for (let [numberB] of robots) { +>numberB : number +>robots : [number, string, string][] + + console.log(numberB); +>console.log(numberB) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>numberB : number +} +for (let [numberB] of getRobots()) { +>numberB : number +>getRobots() : [number, string, string][] +>getRobots : () => [number, string, string][] + + console.log(numberB); +>console.log(numberB) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>numberB : number +} +for (let [numberB] of [robotA, robotB]) { +>numberB : number +>[robotA, robotB] : [number, string, string][] +>robotA : [number, string, string] +>robotB : [number, string, string] + + console.log(numberB); +>console.log(numberB) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>numberB : number +} +for (let [nameB] of multiRobots) { +>nameB : string +>multiRobots : [string, [string, string]][] + + console.log(nameB); +>console.log(nameB) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameB : string +} +for (let [nameB] of getMultiRobots()) { +>nameB : string +>getMultiRobots() : [string, [string, string]][] +>getMultiRobots : () => [string, [string, string]][] + + console.log(nameB); +>console.log(nameB) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameB : string +} +for (let [nameB] of [multiRobotA, multiRobotB]) { +>nameB : string +>[multiRobotA, multiRobotB] : [string, [string, string]][] +>multiRobotA : [string, [string, string]] +>multiRobotB : [string, [string, string]] + + console.log(nameB); +>console.log(nameB) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameB : string +} + +for (let [numberA2, nameA2, skillA2] of robots) { +>numberA2 : number +>nameA2 : string +>skillA2 : string +>robots : [number, string, string][] + + console.log(nameA2); +>console.log(nameA2) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA2 : string +} +for (let [numberA2, nameA2, skillA2] of getRobots()) { +>numberA2 : number +>nameA2 : string +>skillA2 : string +>getRobots() : [number, string, string][] +>getRobots : () => [number, string, string][] + + console.log(nameA2); +>console.log(nameA2) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA2 : string +} +for (let [numberA2, nameA2, skillA2] of [robotA, robotB]) { +>numberA2 : number +>nameA2 : string +>skillA2 : string +>[robotA, robotB] : [number, string, string][] +>robotA : [number, string, string] +>robotB : [number, string, string] + + console.log(nameA2); +>console.log(nameA2) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA2 : string +} +for (let [nameMA, [primarySkillA, secondarySkillA]] of multiRobots) { +>nameMA : string +>primarySkillA : string +>secondarySkillA : string +>multiRobots : [string, [string, string]][] + + console.log(nameMA); +>console.log(nameMA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameMA : string +} +for (let [nameMA, [primarySkillA, secondarySkillA]] of getMultiRobots()) { +>nameMA : string +>primarySkillA : string +>secondarySkillA : string +>getMultiRobots() : [string, [string, string]][] +>getMultiRobots : () => [string, [string, string]][] + + console.log(nameMA); +>console.log(nameMA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameMA : string +} +for (let [nameMA, [primarySkillA, secondarySkillA]] of [multiRobotA, multiRobotB]) { +>nameMA : string +>primarySkillA : string +>secondarySkillA : string +>[multiRobotA, multiRobotB] : [string, [string, string]][] +>multiRobotA : [string, [string, string]] +>multiRobotB : [string, [string, string]] + + console.log(nameMA); +>console.log(nameMA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameMA : string +} + +for (let [numberA3, ...robotAInfo] of robots) { +>numberA3 : number +>robotAInfo : (number | string)[] +>robots : [number, string, string][] + + console.log(numberA3); +>console.log(numberA3) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>numberA3 : number +} +for (let [numberA3, ...robotAInfo] of getRobots()) { +>numberA3 : number +>robotAInfo : (number | string)[] +>getRobots() : [number, string, string][] +>getRobots : () => [number, string, string][] + + console.log(numberA3); +>console.log(numberA3) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>numberA3 : number +} +for (let [numberA3, ...robotAInfo] of [robotA, robotB]) { +>numberA3 : number +>robotAInfo : (number | string)[] +>[robotA, robotB] : [number, string, string][] +>robotA : [number, string, string] +>robotB : [number, string, string] + + console.log(numberA3); +>console.log(numberA3) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>numberA3 : number +} +for (let [...multiRobotAInfo] of multiRobots) { +>multiRobotAInfo : (string | [string, string])[] +>multiRobots : [string, [string, string]][] + + console.log(multiRobotAInfo); +>console.log(multiRobotAInfo) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>multiRobotAInfo : (string | [string, string])[] +} +for (let [...multiRobotAInfo] of getMultiRobots()) { +>multiRobotAInfo : (string | [string, string])[] +>getMultiRobots() : [string, [string, string]][] +>getMultiRobots : () => [string, [string, string]][] + + console.log(multiRobotAInfo); +>console.log(multiRobotAInfo) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>multiRobotAInfo : (string | [string, string])[] +} +for (let [...multiRobotAInfo] of [multiRobotA, multiRobotB]) { +>multiRobotAInfo : (string | [string, string])[] +>[multiRobotA, multiRobotB] : [string, [string, string]][] +>multiRobotA : [string, [string, string]] +>multiRobotB : [string, [string, string]] + + console.log(multiRobotAInfo); +>console.log(multiRobotAInfo) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>multiRobotAInfo : (string | [string, string])[] +} diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPattern2.js b/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPattern2.js new file mode 100644 index 00000000000..8b21faf3ad9 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPattern2.js @@ -0,0 +1,217 @@ +//// [sourceMapValidationDestructuringForOfArrayBindingPattern2.ts] +declare var console: { + log(msg: any): void; +} +type Robot = [number, string, string]; +type MultiSkilledRobot = [string, [string, string]]; + +let robotA: Robot = [1, "mower", "mowing"]; +let robotB: Robot = [2, "trimmer", "trimming"]; +let robots = [robotA, robotB]; +function getRobots() { + return robots; +} + +let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; +let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; +let multiRobots = [multiRobotA, multiRobotB]; +function getMultiRobots() { + return multiRobots; +} + +let nameA: string, primarySkillA: string, secondarySkillA: string; +let numberB: number, nameB: string; +let numberA2: number, nameA2: string, skillA2: string, nameMA: string; +let numberA3: number, robotAInfo: (number | string)[], multiRobotAInfo: (string | [string, string])[]; + +for ([, nameA] of robots) { + console.log(nameA); +} +for ([, nameA] of getRobots()) { + console.log(nameA); +} +for ([, nameA] of [robotA, robotB]) { + console.log(nameA); +} +for ([, [primarySkillA, secondarySkillA]] of multiRobots) { + console.log(primarySkillA); +} +for ([, [primarySkillA, secondarySkillA]] of getMultiRobots()) { + console.log(primarySkillA); +} +for ([, [primarySkillA, secondarySkillA]] of [multiRobotA, multiRobotB]) { + console.log(primarySkillA); +} + +for ([numberB] of robots) { + console.log(numberB); +} +for ([numberB] of getRobots()) { + console.log(numberB); +} +for ([numberB] of [robotA, robotB]) { + console.log(numberB); +} +for ([nameB] of multiRobots) { + console.log(nameB); +} +for ([nameB] of getMultiRobots()) { + console.log(nameB); +} +for ([nameB] of [multiRobotA, multiRobotB]) { + console.log(nameB); +} + +for ([numberA2, nameA2, skillA2] of robots) { + console.log(nameA2); +} +for ([numberA2, nameA2, skillA2] of getRobots()) { + console.log(nameA2); +} +for ([numberA2, nameA2, skillA2] of [robotA, robotB]) { + console.log(nameA2); +} +for ([nameMA, [primarySkillA, secondarySkillA]] of multiRobots) { + console.log(nameMA); +} +for ([nameMA, [primarySkillA, secondarySkillA]] of getMultiRobots()) { + console.log(nameMA); +} +for ([nameMA, [primarySkillA, secondarySkillA]] of [multiRobotA, multiRobotB]) { + console.log(nameMA); +} + +for ([numberA3, ...robotAInfo] of robots) { + console.log(numberA3); +} +for ([numberA3, ...robotAInfo] of getRobots()) { + console.log(numberA3); +} +for ([numberA3, ...robotAInfo] of [robotA, robotB]) { + console.log(numberA3); +} +for ([...multiRobotAInfo] of multiRobots) { + console.log(multiRobotAInfo); +} +for ([...multiRobotAInfo] of getMultiRobots()) { + console.log(multiRobotAInfo); +} +for ([...multiRobotAInfo] of [multiRobotA, multiRobotB]) { + console.log(multiRobotAInfo); +} + +//// [sourceMapValidationDestructuringForOfArrayBindingPattern2.js] +var robotA = [1, "mower", "mowing"]; +var robotB = [2, "trimmer", "trimming"]; +var robots = [robotA, robotB]; +function getRobots() { + return robots; +} +var multiRobotA = ["mower", ["mowing", ""]]; +var multiRobotB = ["trimmer", ["trimming", "edging"]]; +var multiRobots = [multiRobotA, multiRobotB]; +function getMultiRobots() { + return multiRobots; +} +var nameA, primarySkillA, secondarySkillA; +var numberB, nameB; +var numberA2, nameA2, skillA2, nameMA; +var numberA3, robotAInfo, multiRobotAInfo; +for (var _i = 0, robots_1 = robots; _i < robots_1.length; _i++) { + _a = robots_1[_i], nameA = _a[1]; + console.log(nameA); +} +for (var _b = 0, _c = getRobots(); _b < _c.length; _b++) { + _d = _c[_b], nameA = _d[1]; + console.log(nameA); +} +for (var _e = 0, _f = [robotA, robotB]; _e < _f.length; _e++) { + _g = _f[_e], nameA = _g[1]; + console.log(nameA); +} +for (var _h = 0, multiRobots_1 = multiRobots; _h < multiRobots_1.length; _h++) { + _j = multiRobots_1[_h], _k = _j[1], primarySkillA = _k[0], secondarySkillA = _k[1]; + console.log(primarySkillA); +} +for (var _l = 0, _m = getMultiRobots(); _l < _m.length; _l++) { + _o = _m[_l], _p = _o[1], primarySkillA = _p[0], secondarySkillA = _p[1]; + console.log(primarySkillA); +} +for (var _q = 0, _r = [multiRobotA, multiRobotB]; _q < _r.length; _q++) { + _s = _r[_q], _t = _s[1], primarySkillA = _t[0], secondarySkillA = _t[1]; + console.log(primarySkillA); +} +for (var _u = 0, robots_2 = robots; _u < robots_2.length; _u++) { + numberB = robots_2[_u][0]; + console.log(numberB); +} +for (var _v = 0, _w = getRobots(); _v < _w.length; _v++) { + numberB = _w[_v][0]; + console.log(numberB); +} +for (var _x = 0, _y = [robotA, robotB]; _x < _y.length; _x++) { + numberB = _y[_x][0]; + console.log(numberB); +} +for (var _z = 0, multiRobots_2 = multiRobots; _z < multiRobots_2.length; _z++) { + nameB = multiRobots_2[_z][0]; + console.log(nameB); +} +for (var _0 = 0, _1 = getMultiRobots(); _0 < _1.length; _0++) { + nameB = _1[_0][0]; + console.log(nameB); +} +for (var _2 = 0, _3 = [multiRobotA, multiRobotB]; _2 < _3.length; _2++) { + nameB = _3[_2][0]; + console.log(nameB); +} +for (var _4 = 0, robots_3 = robots; _4 < robots_3.length; _4++) { + _5 = robots_3[_4], numberA2 = _5[0], nameA2 = _5[1], skillA2 = _5[2]; + console.log(nameA2); +} +for (var _6 = 0, _7 = getRobots(); _6 < _7.length; _6++) { + _8 = _7[_6], numberA2 = _8[0], nameA2 = _8[1], skillA2 = _8[2]; + console.log(nameA2); +} +for (var _9 = 0, _10 = [robotA, robotB]; _9 < _10.length; _9++) { + _11 = _10[_9], numberA2 = _11[0], nameA2 = _11[1], skillA2 = _11[2]; + console.log(nameA2); +} +for (var _12 = 0, multiRobots_3 = multiRobots; _12 < multiRobots_3.length; _12++) { + _13 = multiRobots_3[_12], nameMA = _13[0], _14 = _13[1], primarySkillA = _14[0], secondarySkillA = _14[1]; + console.log(nameMA); +} +for (var _15 = 0, _16 = getMultiRobots(); _15 < _16.length; _15++) { + _17 = _16[_15], nameMA = _17[0], _18 = _17[1], primarySkillA = _18[0], secondarySkillA = _18[1]; + console.log(nameMA); +} +for (var _19 = 0, _20 = [multiRobotA, multiRobotB]; _19 < _20.length; _19++) { + _21 = _20[_19], nameMA = _21[0], _22 = _21[1], primarySkillA = _22[0], secondarySkillA = _22[1]; + console.log(nameMA); +} +for (var _23 = 0, robots_4 = robots; _23 < robots_4.length; _23++) { + _24 = robots_4[_23], numberA3 = _24[0], robotAInfo = _24.slice(1); + console.log(numberA3); +} +for (var _25 = 0, _26 = getRobots(); _25 < _26.length; _25++) { + _27 = _26[_25], numberA3 = _27[0], robotAInfo = _27.slice(1); + console.log(numberA3); +} +for (var _28 = 0, _29 = [robotA, robotB]; _28 < _29.length; _28++) { + _30 = _29[_28], numberA3 = _30[0], robotAInfo = _30.slice(1); + console.log(numberA3); +} +for (var _31 = 0, multiRobots_4 = multiRobots; _31 < multiRobots_4.length; _31++) { + multiRobotAInfo = multiRobots_4[_31].slice(0); + console.log(multiRobotAInfo); +} +for (var _32 = 0, _33 = getMultiRobots(); _32 < _33.length; _32++) { + multiRobotAInfo = _33[_32].slice(0); + console.log(multiRobotAInfo); +} +for (var _34 = 0, _35 = [multiRobotA, multiRobotB]; _34 < _35.length; _34++) { + multiRobotAInfo = _35[_34].slice(0); + console.log(multiRobotAInfo); +} +var _a, _d, _g, _j, _k, _o, _p, _s, _t, _5, _8, _11, _13, _14, _17, _18, _21, _22, _24, _27, _30; +//# sourceMappingURL=sourceMapValidationDestructuringForOfArrayBindingPattern2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPattern2.js.map b/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPattern2.js.map new file mode 100644 index 00000000000..cae221df0f2 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPattern2.js.map @@ -0,0 +1,2 @@ +//// [sourceMapValidationDestructuringForOfArrayBindingPattern2.js.map] +{"version":3,"file":"sourceMapValidationDestructuringForOfArrayBindingPattern2.js","sourceRoot":"","sources":["sourceMapValidationDestructuringForOfArrayBindingPattern2.ts"],"names":[],"mappings":"AAMA,IAAI,MAAM,GAAU,CAAC,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;AAC3C,IAAI,MAAM,GAAU,CAAC,CAAC,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;AAC/C,IAAI,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAC9B;IACI,MAAM,CAAC,MAAM,CAAC;AAClB,CAAC;AAED,IAAI,WAAW,GAAsB,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC;AAC/D,IAAI,WAAW,GAAsB,CAAC,SAAS,EAAE,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC,CAAC;AACzE,IAAI,WAAW,GAAG,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;AAC7C;IACI,MAAM,CAAC,WAAW,CAAC;AACvB,CAAC;AAED,IAAI,KAAa,EAAE,aAAqB,EAAE,eAAuB,CAAC;AAClE,IAAI,OAAe,EAAE,KAAa,CAAC;AACnC,IAAI,QAAgB,EAAE,MAAc,EAAE,OAAe,EAAE,MAAc,CAAC;AACtE,IAAI,QAAgB,EAAE,UAA+B,EAAE,eAA8C,CAAC;AAEtG,GAAG,CAAC,CAAc,UAAM,EAAN,iBAAM,EAAN,oBAAM,EAAN,IAAM,CAAC;IAApB,iBAAS,EAAN,aAAK;IACT,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB;AACD,GAAG,CAAC,CAAc,UAAW,EAAX,KAAA,SAAS,EAAE,EAAX,cAAW,EAAX,IAAW,CAAC;IAAzB,WAAS,EAAN,aAAK;IACT,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB;AACD,GAAG,CAAC,CAAc,UAAgB,EAAhB,MAAC,MAAM,EAAE,MAAM,CAAC,EAAhB,cAAgB,EAAhB,IAAgB,CAAC;IAA9B,WAAS,EAAN,aAAK;IACT,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB;AACD,GAAG,CAAC,CAAyC,UAAW,EAAX,2BAAW,EAAX,yBAAW,EAAX,IAAW,CAAC;IAApD,sBAAoC,EAAjC,UAAgC,EAA/B,qBAAa,EAAE,uBAAe;IACnC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;CAC9B;AACD,GAAG,CAAC,CAAyC,UAAgB,EAAhB,KAAA,cAAc,EAAE,EAAhB,cAAgB,EAAhB,IAAgB,CAAC;IAAzD,WAAoC,EAAjC,UAAgC,EAA/B,qBAAa,EAAE,uBAAe;IACnC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;CAC9B;AACD,GAAG,CAAC,CAAyC,UAA0B,EAA1B,MAAC,WAAW,EAAE,WAAW,CAAC,EAA1B,cAA0B,EAA1B,IAA0B,CAAC;IAAnE,WAAoC,EAAjC,UAAgC,EAA/B,qBAAa,EAAE,uBAAe;IACnC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;CAC9B;AAED,GAAG,CAAC,CAAc,UAAM,EAAN,iBAAM,EAAN,oBAAM,EAAN,IAAM,CAAC;IAAnB,yBAAO;IACT,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;CACxB;AACD,GAAG,CAAC,CAAc,UAAW,EAAX,KAAA,SAAS,EAAE,EAAX,cAAW,EAAX,IAAW,CAAC;IAAxB,mBAAO;IACT,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;CACxB;AACD,GAAG,CAAC,CAAc,UAAgB,EAAhB,MAAC,MAAM,EAAE,MAAM,CAAC,EAAhB,cAAgB,EAAhB,IAAgB,CAAC;IAA7B,mBAAO;IACT,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;CACxB;AACD,GAAG,CAAC,CAAY,UAAW,EAAX,2BAAW,EAAX,yBAAW,EAAX,IAAW,CAAC;IAAtB,4BAAK;IACP,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB;AACD,GAAG,CAAC,CAAY,UAAgB,EAAhB,KAAA,cAAc,EAAE,EAAhB,cAAgB,EAAhB,IAAgB,CAAC;IAA3B,iBAAK;IACP,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB;AACD,GAAG,CAAC,CAAY,UAA0B,EAA1B,MAAC,WAAW,EAAE,WAAW,CAAC,EAA1B,cAA0B,EAA1B,IAA0B,CAAC;IAArC,iBAAK;IACP,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB;AAED,GAAG,CAAC,CAAgC,UAAM,EAAN,iBAAM,EAAN,oBAAM,EAAN,IAAM,CAAC;IAAtC,iBAA2B,EAA1B,gBAAQ,EAAE,cAAM,EAAE,eAAO;IAC3B,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;CACvB;AACD,GAAG,CAAC,CAAgC,UAAW,EAAX,KAAA,SAAS,EAAE,EAAX,cAAW,EAAX,IAAW,CAAC;IAA3C,WAA2B,EAA1B,gBAAQ,EAAE,cAAM,EAAE,eAAO;IAC3B,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;CACvB;AACD,GAAG,CAAC,CAAgC,UAAgB,EAAhB,OAAC,MAAM,EAAE,MAAM,CAAC,EAAhB,eAAgB,EAAhB,IAAgB,CAAC;IAAhD,aAA2B,EAA1B,iBAAQ,EAAE,eAAM,EAAE,gBAAO;IAC3B,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;CACvB;AACD,GAAG,CAAC,CAA+C,WAAW,EAAX,2BAAW,EAAX,0BAAW,EAAX,KAAW,CAAC;IAA1D,wBAA0C,EAAzC,eAAM,EAAE,YAAgC,EAA/B,sBAAa,EAAE,wBAAe;IACzC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;CACvB;AACD,GAAG,CAAC,CAA+C,WAAgB,EAAhB,MAAA,cAAc,EAAE,EAAhB,gBAAgB,EAAhB,KAAgB,CAAC;IAA/D,cAA0C,EAAzC,eAAM,EAAE,YAAgC,EAA/B,sBAAa,EAAE,wBAAe;IACzC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;CACvB;AACD,GAAG,CAAC,CAA+C,WAA0B,EAA1B,OAAC,WAAW,EAAE,WAAW,CAAC,EAA1B,gBAA0B,EAA1B,KAA0B,CAAC;IAAzE,cAA0C,EAAzC,eAAM,EAAE,YAAgC,EAA/B,sBAAa,EAAE,wBAAe;IACzC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;CACvB;AAED,GAAG,CAAC,CAA8B,WAAM,EAAN,iBAAM,EAAN,qBAAM,EAAN,KAAM,CAAC;IAApC,mBAAyB,EAAxB,iBAAQ,EAAE,yBAAa;IACzB,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;CACzB;AACD,GAAG,CAAC,CAA8B,WAAW,EAAX,MAAA,SAAS,EAAE,EAAX,gBAAW,EAAX,KAAW,CAAC;IAAzC,cAAyB,EAAxB,iBAAQ,EAAE,yBAAa;IACzB,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;CACzB;AACD,GAAG,CAAC,CAA8B,WAAgB,EAAhB,OAAC,MAAM,EAAE,MAAM,CAAC,EAAhB,gBAAgB,EAAhB,KAAgB,CAAC;IAA9C,cAAyB,EAAxB,iBAAQ,EAAE,yBAAa;IACzB,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;CACzB;AACD,GAAG,CAAC,CAAyB,WAAW,EAAX,2BAAW,EAAX,0BAAW,EAAX,KAAW,CAAC;IAAnC,6CAAkB;IACpB,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;CAChC;AACD,GAAG,CAAC,CAAyB,WAAgB,EAAhB,MAAA,cAAc,EAAE,EAAhB,gBAAgB,EAAhB,KAAgB,CAAC;IAAxC,mCAAkB;IACpB,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;CAChC;AACD,GAAG,CAAC,CAAyB,WAA0B,EAA1B,OAAC,WAAW,EAAE,WAAW,CAAC,EAA1B,gBAA0B,EAA1B,KAA0B,CAAC;IAAlD,mCAAkB;IACpB,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;CAChC"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPattern2.sourcemap.txt b/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPattern2.sourcemap.txt new file mode 100644 index 00000000000..72970488233 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPattern2.sourcemap.txt @@ -0,0 +1,2777 @@ +=================================================================== +JsFile: sourceMapValidationDestructuringForOfArrayBindingPattern2.js +mapUrl: sourceMapValidationDestructuringForOfArrayBindingPattern2.js.map +sourceRoot: +sources: sourceMapValidationDestructuringForOfArrayBindingPattern2.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/sourceMapValidationDestructuringForOfArrayBindingPattern2.js +sourceFile:sourceMapValidationDestructuringForOfArrayBindingPattern2.ts +------------------------------------------------------------------- +>>>var robotA = [1, "mower", "mowing"]; +1 > +2 >^^^^ +3 > ^^^^^^ +4 > ^^^ +5 > ^ +6 > ^ +7 > ^^ +8 > ^^^^^^^ +9 > ^^ +10> ^^^^^^^^ +11> ^ +12> ^ +13> ^^^^^-> +1 >declare var console: { + > log(msg: any): void; + >} + >type Robot = [number, string, string]; + >type MultiSkilledRobot = [string, [string, string]]; + > + > +2 >let +3 > robotA +4 > : Robot = +5 > [ +6 > 1 +7 > , +8 > "mower" +9 > , +10> "mowing" +11> ] +12> ; +1 >Emitted(1, 1) Source(7, 1) + SourceIndex(0) +2 >Emitted(1, 5) Source(7, 5) + SourceIndex(0) +3 >Emitted(1, 11) Source(7, 11) + SourceIndex(0) +4 >Emitted(1, 14) Source(7, 21) + SourceIndex(0) +5 >Emitted(1, 15) Source(7, 22) + SourceIndex(0) +6 >Emitted(1, 16) Source(7, 23) + SourceIndex(0) +7 >Emitted(1, 18) Source(7, 25) + SourceIndex(0) +8 >Emitted(1, 25) Source(7, 32) + SourceIndex(0) +9 >Emitted(1, 27) Source(7, 34) + SourceIndex(0) +10>Emitted(1, 35) Source(7, 42) + SourceIndex(0) +11>Emitted(1, 36) Source(7, 43) + SourceIndex(0) +12>Emitted(1, 37) Source(7, 44) + SourceIndex(0) +--- +>>>var robotB = [2, "trimmer", "trimming"]; +1-> +2 >^^^^ +3 > ^^^^^^ +4 > ^^^ +5 > ^ +6 > ^ +7 > ^^ +8 > ^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^ +11> ^ +12> ^ +1-> + > +2 >let +3 > robotB +4 > : Robot = +5 > [ +6 > 2 +7 > , +8 > "trimmer" +9 > , +10> "trimming" +11> ] +12> ; +1->Emitted(2, 1) Source(8, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(8, 5) + SourceIndex(0) +3 >Emitted(2, 11) Source(8, 11) + SourceIndex(0) +4 >Emitted(2, 14) Source(8, 21) + SourceIndex(0) +5 >Emitted(2, 15) Source(8, 22) + SourceIndex(0) +6 >Emitted(2, 16) Source(8, 23) + SourceIndex(0) +7 >Emitted(2, 18) Source(8, 25) + SourceIndex(0) +8 >Emitted(2, 27) Source(8, 34) + SourceIndex(0) +9 >Emitted(2, 29) Source(8, 36) + SourceIndex(0) +10>Emitted(2, 39) Source(8, 46) + SourceIndex(0) +11>Emitted(2, 40) Source(8, 47) + SourceIndex(0) +12>Emitted(2, 41) Source(8, 48) + SourceIndex(0) +--- +>>>var robots = [robotA, robotB]; +1 > +2 >^^^^ +3 > ^^^^^^ +4 > ^^^ +5 > ^ +6 > ^^^^^^ +7 > ^^ +8 > ^^^^^^ +9 > ^ +10> ^ +1 > + > +2 >let +3 > robots +4 > = +5 > [ +6 > robotA +7 > , +8 > robotB +9 > ] +10> ; +1 >Emitted(3, 1) Source(9, 1) + SourceIndex(0) +2 >Emitted(3, 5) Source(9, 5) + SourceIndex(0) +3 >Emitted(3, 11) Source(9, 11) + SourceIndex(0) +4 >Emitted(3, 14) Source(9, 14) + SourceIndex(0) +5 >Emitted(3, 15) Source(9, 15) + SourceIndex(0) +6 >Emitted(3, 21) Source(9, 21) + SourceIndex(0) +7 >Emitted(3, 23) Source(9, 23) + SourceIndex(0) +8 >Emitted(3, 29) Source(9, 29) + SourceIndex(0) +9 >Emitted(3, 30) Source(9, 30) + SourceIndex(0) +10>Emitted(3, 31) Source(9, 31) + SourceIndex(0) +--- +>>>function getRobots() { +1 > +2 >^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(4, 1) Source(10, 1) + SourceIndex(0) +--- +>>> return robots; +1->^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^ +5 > ^ +1->function getRobots() { + > +2 > return +3 > +4 > robots +5 > ; +1->Emitted(5, 5) Source(11, 5) + SourceIndex(0) +2 >Emitted(5, 11) Source(11, 11) + SourceIndex(0) +3 >Emitted(5, 12) Source(11, 12) + SourceIndex(0) +4 >Emitted(5, 18) Source(11, 18) + SourceIndex(0) +5 >Emitted(5, 19) Source(11, 19) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(6, 1) Source(12, 1) + SourceIndex(0) +2 >Emitted(6, 2) Source(12, 2) + SourceIndex(0) +--- +>>>var multiRobotA = ["mower", ["mowing", ""]]; +1-> +2 >^^^^ +3 > ^^^^^^^^^^^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^ +7 > ^^ +8 > ^ +9 > ^^^^^^^^ +10> ^^ +11> ^^ +12> ^ +13> ^ +14> ^ +15> ^^^^^^^^^^^-> +1-> + > + > +2 >let +3 > multiRobotA +4 > : MultiSkilledRobot = +5 > [ +6 > "mower" +7 > , +8 > [ +9 > "mowing" +10> , +11> "" +12> ] +13> ] +14> ; +1->Emitted(7, 1) Source(14, 1) + SourceIndex(0) +2 >Emitted(7, 5) Source(14, 5) + SourceIndex(0) +3 >Emitted(7, 16) Source(14, 16) + SourceIndex(0) +4 >Emitted(7, 19) Source(14, 38) + SourceIndex(0) +5 >Emitted(7, 20) Source(14, 39) + SourceIndex(0) +6 >Emitted(7, 27) Source(14, 46) + SourceIndex(0) +7 >Emitted(7, 29) Source(14, 48) + SourceIndex(0) +8 >Emitted(7, 30) Source(14, 49) + SourceIndex(0) +9 >Emitted(7, 38) Source(14, 57) + SourceIndex(0) +10>Emitted(7, 40) Source(14, 59) + SourceIndex(0) +11>Emitted(7, 42) Source(14, 61) + SourceIndex(0) +12>Emitted(7, 43) Source(14, 62) + SourceIndex(0) +13>Emitted(7, 44) Source(14, 63) + SourceIndex(0) +14>Emitted(7, 45) Source(14, 64) + SourceIndex(0) +--- +>>>var multiRobotB = ["trimmer", ["trimming", "edging"]]; +1-> +2 >^^^^ +3 > ^^^^^^^^^^^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^^ +7 > ^^ +8 > ^ +9 > ^^^^^^^^^^ +10> ^^ +11> ^^^^^^^^ +12> ^ +13> ^ +14> ^ +1-> + > +2 >let +3 > multiRobotB +4 > : MultiSkilledRobot = +5 > [ +6 > "trimmer" +7 > , +8 > [ +9 > "trimming" +10> , +11> "edging" +12> ] +13> ] +14> ; +1->Emitted(8, 1) Source(15, 1) + SourceIndex(0) +2 >Emitted(8, 5) Source(15, 5) + SourceIndex(0) +3 >Emitted(8, 16) Source(15, 16) + SourceIndex(0) +4 >Emitted(8, 19) Source(15, 38) + SourceIndex(0) +5 >Emitted(8, 20) Source(15, 39) + SourceIndex(0) +6 >Emitted(8, 29) Source(15, 48) + SourceIndex(0) +7 >Emitted(8, 31) Source(15, 50) + SourceIndex(0) +8 >Emitted(8, 32) Source(15, 51) + SourceIndex(0) +9 >Emitted(8, 42) Source(15, 61) + SourceIndex(0) +10>Emitted(8, 44) Source(15, 63) + SourceIndex(0) +11>Emitted(8, 52) Source(15, 71) + SourceIndex(0) +12>Emitted(8, 53) Source(15, 72) + SourceIndex(0) +13>Emitted(8, 54) Source(15, 73) + SourceIndex(0) +14>Emitted(8, 55) Source(15, 74) + SourceIndex(0) +--- +>>>var multiRobots = [multiRobotA, multiRobotB]; +1 > +2 >^^^^ +3 > ^^^^^^^^^^^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^ +9 > ^ +10> ^ +1 > + > +2 >let +3 > multiRobots +4 > = +5 > [ +6 > multiRobotA +7 > , +8 > multiRobotB +9 > ] +10> ; +1 >Emitted(9, 1) Source(16, 1) + SourceIndex(0) +2 >Emitted(9, 5) Source(16, 5) + SourceIndex(0) +3 >Emitted(9, 16) Source(16, 16) + SourceIndex(0) +4 >Emitted(9, 19) Source(16, 19) + SourceIndex(0) +5 >Emitted(9, 20) Source(16, 20) + SourceIndex(0) +6 >Emitted(9, 31) Source(16, 31) + SourceIndex(0) +7 >Emitted(9, 33) Source(16, 33) + SourceIndex(0) +8 >Emitted(9, 44) Source(16, 44) + SourceIndex(0) +9 >Emitted(9, 45) Source(16, 45) + SourceIndex(0) +10>Emitted(9, 46) Source(16, 46) + SourceIndex(0) +--- +>>>function getMultiRobots() { +1 > +2 >^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(10, 1) Source(17, 1) + SourceIndex(0) +--- +>>> return multiRobots; +1->^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^ +5 > ^ +1->function getMultiRobots() { + > +2 > return +3 > +4 > multiRobots +5 > ; +1->Emitted(11, 5) Source(18, 5) + SourceIndex(0) +2 >Emitted(11, 11) Source(18, 11) + SourceIndex(0) +3 >Emitted(11, 12) Source(18, 12) + SourceIndex(0) +4 >Emitted(11, 23) Source(18, 23) + SourceIndex(0) +5 >Emitted(11, 24) Source(18, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(12, 1) Source(19, 1) + SourceIndex(0) +2 >Emitted(12, 2) Source(19, 2) + SourceIndex(0) +--- +>>>var nameA, primarySkillA, secondarySkillA; +1-> +2 >^^^^ +3 > ^^^^^ +4 > ^^ +5 > ^^^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^ +8 > ^ +1-> + > + > +2 >let +3 > nameA: string +4 > , +5 > primarySkillA: string +6 > , +7 > secondarySkillA: string +8 > ; +1->Emitted(13, 1) Source(21, 1) + SourceIndex(0) +2 >Emitted(13, 5) Source(21, 5) + SourceIndex(0) +3 >Emitted(13, 10) Source(21, 18) + SourceIndex(0) +4 >Emitted(13, 12) Source(21, 20) + SourceIndex(0) +5 >Emitted(13, 25) Source(21, 41) + SourceIndex(0) +6 >Emitted(13, 27) Source(21, 43) + SourceIndex(0) +7 >Emitted(13, 42) Source(21, 66) + SourceIndex(0) +8 >Emitted(13, 43) Source(21, 67) + SourceIndex(0) +--- +>>>var numberB, nameB; +1 > +2 >^^^^ +3 > ^^^^^^^ +4 > ^^ +5 > ^^^^^ +6 > ^ +7 > ^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >let +3 > numberB: number +4 > , +5 > nameB: string +6 > ; +1 >Emitted(14, 1) Source(22, 1) + SourceIndex(0) +2 >Emitted(14, 5) Source(22, 5) + SourceIndex(0) +3 >Emitted(14, 12) Source(22, 20) + SourceIndex(0) +4 >Emitted(14, 14) Source(22, 22) + SourceIndex(0) +5 >Emitted(14, 19) Source(22, 35) + SourceIndex(0) +6 >Emitted(14, 20) Source(22, 36) + SourceIndex(0) +--- +>>>var numberA2, nameA2, skillA2, nameMA; +1-> +2 >^^^^ +3 > ^^^^^^^^ +4 > ^^ +5 > ^^^^^^ +6 > ^^ +7 > ^^^^^^^ +8 > ^^ +9 > ^^^^^^ +10> ^ +11> ^^^^^-> +1-> + > +2 >let +3 > numberA2: number +4 > , +5 > nameA2: string +6 > , +7 > skillA2: string +8 > , +9 > nameMA: string +10> ; +1->Emitted(15, 1) Source(23, 1) + SourceIndex(0) +2 >Emitted(15, 5) Source(23, 5) + SourceIndex(0) +3 >Emitted(15, 13) Source(23, 21) + SourceIndex(0) +4 >Emitted(15, 15) Source(23, 23) + SourceIndex(0) +5 >Emitted(15, 21) Source(23, 37) + SourceIndex(0) +6 >Emitted(15, 23) Source(23, 39) + SourceIndex(0) +7 >Emitted(15, 30) Source(23, 54) + SourceIndex(0) +8 >Emitted(15, 32) Source(23, 56) + SourceIndex(0) +9 >Emitted(15, 38) Source(23, 70) + SourceIndex(0) +10>Emitted(15, 39) Source(23, 71) + SourceIndex(0) +--- +>>>var numberA3, robotAInfo, multiRobotAInfo; +1-> +2 >^^^^ +3 > ^^^^^^^^ +4 > ^^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^ +8 > ^ +9 > ^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >let +3 > numberA3: number +4 > , +5 > robotAInfo: (number | string)[] +6 > , +7 > multiRobotAInfo: (string | [string, string])[] +8 > ; +1->Emitted(16, 1) Source(24, 1) + SourceIndex(0) +2 >Emitted(16, 5) Source(24, 5) + SourceIndex(0) +3 >Emitted(16, 13) Source(24, 21) + SourceIndex(0) +4 >Emitted(16, 15) Source(24, 23) + SourceIndex(0) +5 >Emitted(16, 25) Source(24, 54) + SourceIndex(0) +6 >Emitted(16, 27) Source(24, 56) + SourceIndex(0) +7 >Emitted(16, 42) Source(24, 102) + SourceIndex(0) +8 >Emitted(16, 43) Source(24, 103) + SourceIndex(0) +--- +>>>for (var _i = 0, robots_1 = robots; _i < robots_1.length; _i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^^^^^^ +10> ^^ +11> ^^^^ +12> ^ +1-> + > + > +2 >for +3 > +4 > ([, nameA] of +5 > robots +6 > +7 > robots +8 > +9 > robots +10> +11> robots +12> ) +1->Emitted(17, 1) Source(26, 1) + SourceIndex(0) +2 >Emitted(17, 4) Source(26, 4) + SourceIndex(0) +3 >Emitted(17, 5) Source(26, 5) + SourceIndex(0) +4 >Emitted(17, 6) Source(26, 19) + SourceIndex(0) +5 >Emitted(17, 16) Source(26, 25) + SourceIndex(0) +6 >Emitted(17, 18) Source(26, 19) + SourceIndex(0) +7 >Emitted(17, 35) Source(26, 25) + SourceIndex(0) +8 >Emitted(17, 37) Source(26, 19) + SourceIndex(0) +9 >Emitted(17, 57) Source(26, 25) + SourceIndex(0) +10>Emitted(17, 59) Source(26, 19) + SourceIndex(0) +11>Emitted(17, 63) Source(26, 25) + SourceIndex(0) +12>Emitted(17, 64) Source(26, 26) + SourceIndex(0) +--- +>>> _a = robots_1[_i], nameA = _a[1]; +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^ +1 > +2 > [, nameA] +3 > +4 > nameA +1 >Emitted(18, 5) Source(26, 6) + SourceIndex(0) +2 >Emitted(18, 22) Source(26, 15) + SourceIndex(0) +3 >Emitted(18, 24) Source(26, 9) + SourceIndex(0) +4 >Emitted(18, 37) Source(26, 14) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 >] of robots) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(19, 5) Source(27, 5) + SourceIndex(0) +2 >Emitted(19, 12) Source(27, 12) + SourceIndex(0) +3 >Emitted(19, 13) Source(27, 13) + SourceIndex(0) +4 >Emitted(19, 16) Source(27, 16) + SourceIndex(0) +5 >Emitted(19, 17) Source(27, 17) + SourceIndex(0) +6 >Emitted(19, 22) Source(27, 22) + SourceIndex(0) +7 >Emitted(19, 23) Source(27, 23) + SourceIndex(0) +8 >Emitted(19, 24) Source(27, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(20, 2) Source(28, 2) + SourceIndex(0) +--- +>>>for (var _b = 0, _c = getRobots(); _b < _c.length; _b++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^ +8 > ^^^^^^^^^ +9 > ^^ +10> ^^ +11> ^^^^^^^^^^^^^^ +12> ^^ +13> ^^^^ +14> ^ +1-> + > +2 >for +3 > +4 > ([, nameA] of +5 > getRobots() +6 > +7 > +8 > getRobots +9 > () +10> +11> getRobots() +12> +13> getRobots() +14> ) +1->Emitted(21, 1) Source(29, 1) + SourceIndex(0) +2 >Emitted(21, 4) Source(29, 4) + SourceIndex(0) +3 >Emitted(21, 5) Source(29, 5) + SourceIndex(0) +4 >Emitted(21, 6) Source(29, 19) + SourceIndex(0) +5 >Emitted(21, 16) Source(29, 30) + SourceIndex(0) +6 >Emitted(21, 18) Source(29, 19) + SourceIndex(0) +7 >Emitted(21, 23) Source(29, 19) + SourceIndex(0) +8 >Emitted(21, 32) Source(29, 28) + SourceIndex(0) +9 >Emitted(21, 34) Source(29, 30) + SourceIndex(0) +10>Emitted(21, 36) Source(29, 19) + SourceIndex(0) +11>Emitted(21, 50) Source(29, 30) + SourceIndex(0) +12>Emitted(21, 52) Source(29, 19) + SourceIndex(0) +13>Emitted(21, 56) Source(29, 30) + SourceIndex(0) +14>Emitted(21, 57) Source(29, 31) + SourceIndex(0) +--- +>>> _d = _c[_b], nameA = _d[1]; +1 >^^^^ +2 > ^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^ +1 > +2 > [, nameA] +3 > +4 > nameA +1 >Emitted(22, 5) Source(29, 6) + SourceIndex(0) +2 >Emitted(22, 16) Source(29, 15) + SourceIndex(0) +3 >Emitted(22, 18) Source(29, 9) + SourceIndex(0) +4 >Emitted(22, 31) Source(29, 14) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 >] of getRobots()) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(23, 5) Source(30, 5) + SourceIndex(0) +2 >Emitted(23, 12) Source(30, 12) + SourceIndex(0) +3 >Emitted(23, 13) Source(30, 13) + SourceIndex(0) +4 >Emitted(23, 16) Source(30, 16) + SourceIndex(0) +5 >Emitted(23, 17) Source(30, 17) + SourceIndex(0) +6 >Emitted(23, 22) Source(30, 22) + SourceIndex(0) +7 >Emitted(23, 23) Source(30, 23) + SourceIndex(0) +8 >Emitted(23, 24) Source(30, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(24, 2) Source(31, 2) + SourceIndex(0) +--- +>>>for (var _e = 0, _f = [robotA, robotB]; _e < _f.length; _e++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^ +8 > ^^^^^^ +9 > ^^ +10> ^^^^^^ +11> ^ +12> ^^ +13> ^^^^^^^^^^^^^^ +14> ^^ +15> ^^^^ +16> ^ +1-> + > +2 >for +3 > +4 > ([, nameA] of +5 > [robotA, robotB] +6 > +7 > [ +8 > robotA +9 > , +10> robotB +11> ] +12> +13> [robotA, robotB] +14> +15> [robotA, robotB] +16> ) +1->Emitted(25, 1) Source(32, 1) + SourceIndex(0) +2 >Emitted(25, 4) Source(32, 4) + SourceIndex(0) +3 >Emitted(25, 5) Source(32, 5) + SourceIndex(0) +4 >Emitted(25, 6) Source(32, 19) + SourceIndex(0) +5 >Emitted(25, 16) Source(32, 35) + SourceIndex(0) +6 >Emitted(25, 18) Source(32, 19) + SourceIndex(0) +7 >Emitted(25, 24) Source(32, 20) + SourceIndex(0) +8 >Emitted(25, 30) Source(32, 26) + SourceIndex(0) +9 >Emitted(25, 32) Source(32, 28) + SourceIndex(0) +10>Emitted(25, 38) Source(32, 34) + SourceIndex(0) +11>Emitted(25, 39) Source(32, 35) + SourceIndex(0) +12>Emitted(25, 41) Source(32, 19) + SourceIndex(0) +13>Emitted(25, 55) Source(32, 35) + SourceIndex(0) +14>Emitted(25, 57) Source(32, 19) + SourceIndex(0) +15>Emitted(25, 61) Source(32, 35) + SourceIndex(0) +16>Emitted(25, 62) Source(32, 36) + SourceIndex(0) +--- +>>> _g = _f[_e], nameA = _g[1]; +1 >^^^^ +2 > ^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^ +1 > +2 > [, nameA] +3 > +4 > nameA +1 >Emitted(26, 5) Source(32, 6) + SourceIndex(0) +2 >Emitted(26, 16) Source(32, 15) + SourceIndex(0) +3 >Emitted(26, 18) Source(32, 9) + SourceIndex(0) +4 >Emitted(26, 31) Source(32, 14) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 >] of [robotA, robotB]) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(27, 5) Source(33, 5) + SourceIndex(0) +2 >Emitted(27, 12) Source(33, 12) + SourceIndex(0) +3 >Emitted(27, 13) Source(33, 13) + SourceIndex(0) +4 >Emitted(27, 16) Source(33, 16) + SourceIndex(0) +5 >Emitted(27, 17) Source(33, 17) + SourceIndex(0) +6 >Emitted(27, 22) Source(33, 22) + SourceIndex(0) +7 >Emitted(27, 23) Source(33, 23) + SourceIndex(0) +8 >Emitted(27, 24) Source(33, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(28, 2) Source(34, 2) + SourceIndex(0) +--- +>>>for (var _h = 0, multiRobots_1 = multiRobots; _h < multiRobots_1.length; _h++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^^^^^^^^^^^ +10> ^^ +11> ^^^^ +12> ^ +13> ^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > ([, [primarySkillA, secondarySkillA]] of +5 > multiRobots +6 > +7 > multiRobots +8 > +9 > multiRobots +10> +11> multiRobots +12> ) +1->Emitted(29, 1) Source(35, 1) + SourceIndex(0) +2 >Emitted(29, 4) Source(35, 4) + SourceIndex(0) +3 >Emitted(29, 5) Source(35, 5) + SourceIndex(0) +4 >Emitted(29, 6) Source(35, 46) + SourceIndex(0) +5 >Emitted(29, 16) Source(35, 57) + SourceIndex(0) +6 >Emitted(29, 18) Source(35, 46) + SourceIndex(0) +7 >Emitted(29, 45) Source(35, 57) + SourceIndex(0) +8 >Emitted(29, 47) Source(35, 46) + SourceIndex(0) +9 >Emitted(29, 72) Source(35, 57) + SourceIndex(0) +10>Emitted(29, 74) Source(35, 46) + SourceIndex(0) +11>Emitted(29, 78) Source(35, 57) + SourceIndex(0) +12>Emitted(29, 79) Source(35, 58) + SourceIndex(0) +--- +>>> _j = multiRobots_1[_h], _k = _j[1], primarySkillA = _k[0], secondarySkillA = _k[1]; +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > [, [primarySkillA, secondarySkillA]] +3 > +4 > [primarySkillA, secondarySkillA] +5 > +6 > primarySkillA +7 > , +8 > secondarySkillA +1->Emitted(30, 5) Source(35, 6) + SourceIndex(0) +2 >Emitted(30, 27) Source(35, 42) + SourceIndex(0) +3 >Emitted(30, 29) Source(35, 9) + SourceIndex(0) +4 >Emitted(30, 39) Source(35, 41) + SourceIndex(0) +5 >Emitted(30, 41) Source(35, 10) + SourceIndex(0) +6 >Emitted(30, 62) Source(35, 23) + SourceIndex(0) +7 >Emitted(30, 64) Source(35, 25) + SourceIndex(0) +8 >Emitted(30, 87) Source(35, 40) + SourceIndex(0) +--- +>>> console.log(primarySkillA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^^^^^^ +7 > ^ +8 > ^ +1 >]] of multiRobots) { + > +2 > console +3 > . +4 > log +5 > ( +6 > primarySkillA +7 > ) +8 > ; +1 >Emitted(31, 5) Source(36, 5) + SourceIndex(0) +2 >Emitted(31, 12) Source(36, 12) + SourceIndex(0) +3 >Emitted(31, 13) Source(36, 13) + SourceIndex(0) +4 >Emitted(31, 16) Source(36, 16) + SourceIndex(0) +5 >Emitted(31, 17) Source(36, 17) + SourceIndex(0) +6 >Emitted(31, 30) Source(36, 30) + SourceIndex(0) +7 >Emitted(31, 31) Source(36, 31) + SourceIndex(0) +8 >Emitted(31, 32) Source(36, 32) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(32, 2) Source(37, 2) + SourceIndex(0) +--- +>>>for (var _l = 0, _m = getMultiRobots(); _l < _m.length; _l++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^ +8 > ^^^^^^^^^^^^^^ +9 > ^^ +10> ^^ +11> ^^^^^^^^^^^^^^ +12> ^^ +13> ^^^^ +14> ^ +15> ^^^^^^^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > ([, [primarySkillA, secondarySkillA]] of +5 > getMultiRobots() +6 > +7 > +8 > getMultiRobots +9 > () +10> +11> getMultiRobots() +12> +13> getMultiRobots() +14> ) +1->Emitted(33, 1) Source(38, 1) + SourceIndex(0) +2 >Emitted(33, 4) Source(38, 4) + SourceIndex(0) +3 >Emitted(33, 5) Source(38, 5) + SourceIndex(0) +4 >Emitted(33, 6) Source(38, 46) + SourceIndex(0) +5 >Emitted(33, 16) Source(38, 62) + SourceIndex(0) +6 >Emitted(33, 18) Source(38, 46) + SourceIndex(0) +7 >Emitted(33, 23) Source(38, 46) + SourceIndex(0) +8 >Emitted(33, 37) Source(38, 60) + SourceIndex(0) +9 >Emitted(33, 39) Source(38, 62) + SourceIndex(0) +10>Emitted(33, 41) Source(38, 46) + SourceIndex(0) +11>Emitted(33, 55) Source(38, 62) + SourceIndex(0) +12>Emitted(33, 57) Source(38, 46) + SourceIndex(0) +13>Emitted(33, 61) Source(38, 62) + SourceIndex(0) +14>Emitted(33, 62) Source(38, 63) + SourceIndex(0) +--- +>>> _o = _m[_l], _p = _o[1], primarySkillA = _p[0], secondarySkillA = _p[1]; +1->^^^^ +2 > ^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > [, [primarySkillA, secondarySkillA]] +3 > +4 > [primarySkillA, secondarySkillA] +5 > +6 > primarySkillA +7 > , +8 > secondarySkillA +1->Emitted(34, 5) Source(38, 6) + SourceIndex(0) +2 >Emitted(34, 16) Source(38, 42) + SourceIndex(0) +3 >Emitted(34, 18) Source(38, 9) + SourceIndex(0) +4 >Emitted(34, 28) Source(38, 41) + SourceIndex(0) +5 >Emitted(34, 30) Source(38, 10) + SourceIndex(0) +6 >Emitted(34, 51) Source(38, 23) + SourceIndex(0) +7 >Emitted(34, 53) Source(38, 25) + SourceIndex(0) +8 >Emitted(34, 76) Source(38, 40) + SourceIndex(0) +--- +>>> console.log(primarySkillA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^^^^^^ +7 > ^ +8 > ^ +1 >]] of getMultiRobots()) { + > +2 > console +3 > . +4 > log +5 > ( +6 > primarySkillA +7 > ) +8 > ; +1 >Emitted(35, 5) Source(39, 5) + SourceIndex(0) +2 >Emitted(35, 12) Source(39, 12) + SourceIndex(0) +3 >Emitted(35, 13) Source(39, 13) + SourceIndex(0) +4 >Emitted(35, 16) Source(39, 16) + SourceIndex(0) +5 >Emitted(35, 17) Source(39, 17) + SourceIndex(0) +6 >Emitted(35, 30) Source(39, 30) + SourceIndex(0) +7 >Emitted(35, 31) Source(39, 31) + SourceIndex(0) +8 >Emitted(35, 32) Source(39, 32) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(36, 2) Source(40, 2) + SourceIndex(0) +--- +>>>for (var _q = 0, _r = [multiRobotA, multiRobotB]; _q < _r.length; _q++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^ +8 > ^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^ +11> ^ +12> ^^ +13> ^^^^^^^^^^^^^^ +14> ^^ +15> ^^^^ +16> ^ +17> ^^^^^^-> +1-> + > +2 >for +3 > +4 > ([, [primarySkillA, secondarySkillA]] of +5 > [multiRobotA, multiRobotB] +6 > +7 > [ +8 > multiRobotA +9 > , +10> multiRobotB +11> ] +12> +13> [multiRobotA, multiRobotB] +14> +15> [multiRobotA, multiRobotB] +16> ) +1->Emitted(37, 1) Source(41, 1) + SourceIndex(0) +2 >Emitted(37, 4) Source(41, 4) + SourceIndex(0) +3 >Emitted(37, 5) Source(41, 5) + SourceIndex(0) +4 >Emitted(37, 6) Source(41, 46) + SourceIndex(0) +5 >Emitted(37, 16) Source(41, 72) + SourceIndex(0) +6 >Emitted(37, 18) Source(41, 46) + SourceIndex(0) +7 >Emitted(37, 24) Source(41, 47) + SourceIndex(0) +8 >Emitted(37, 35) Source(41, 58) + SourceIndex(0) +9 >Emitted(37, 37) Source(41, 60) + SourceIndex(0) +10>Emitted(37, 48) Source(41, 71) + SourceIndex(0) +11>Emitted(37, 49) Source(41, 72) + SourceIndex(0) +12>Emitted(37, 51) Source(41, 46) + SourceIndex(0) +13>Emitted(37, 65) Source(41, 72) + SourceIndex(0) +14>Emitted(37, 67) Source(41, 46) + SourceIndex(0) +15>Emitted(37, 71) Source(41, 72) + SourceIndex(0) +16>Emitted(37, 72) Source(41, 73) + SourceIndex(0) +--- +>>> _s = _r[_q], _t = _s[1], primarySkillA = _t[0], secondarySkillA = _t[1]; +1->^^^^ +2 > ^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > [, [primarySkillA, secondarySkillA]] +3 > +4 > [primarySkillA, secondarySkillA] +5 > +6 > primarySkillA +7 > , +8 > secondarySkillA +1->Emitted(38, 5) Source(41, 6) + SourceIndex(0) +2 >Emitted(38, 16) Source(41, 42) + SourceIndex(0) +3 >Emitted(38, 18) Source(41, 9) + SourceIndex(0) +4 >Emitted(38, 28) Source(41, 41) + SourceIndex(0) +5 >Emitted(38, 30) Source(41, 10) + SourceIndex(0) +6 >Emitted(38, 51) Source(41, 23) + SourceIndex(0) +7 >Emitted(38, 53) Source(41, 25) + SourceIndex(0) +8 >Emitted(38, 76) Source(41, 40) + SourceIndex(0) +--- +>>> console.log(primarySkillA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^^^^^^ +7 > ^ +8 > ^ +1 >]] of [multiRobotA, multiRobotB]) { + > +2 > console +3 > . +4 > log +5 > ( +6 > primarySkillA +7 > ) +8 > ; +1 >Emitted(39, 5) Source(42, 5) + SourceIndex(0) +2 >Emitted(39, 12) Source(42, 12) + SourceIndex(0) +3 >Emitted(39, 13) Source(42, 13) + SourceIndex(0) +4 >Emitted(39, 16) Source(42, 16) + SourceIndex(0) +5 >Emitted(39, 17) Source(42, 17) + SourceIndex(0) +6 >Emitted(39, 30) Source(42, 30) + SourceIndex(0) +7 >Emitted(39, 31) Source(42, 31) + SourceIndex(0) +8 >Emitted(39, 32) Source(42, 32) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(40, 2) Source(43, 2) + SourceIndex(0) +--- +>>>for (var _u = 0, robots_2 = robots; _u < robots_2.length; _u++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^^^^^^ +10> ^^ +11> ^^^^ +12> ^ +1-> + > + > +2 >for +3 > +4 > ([numberB] of +5 > robots +6 > +7 > robots +8 > +9 > robots +10> +11> robots +12> ) +1->Emitted(41, 1) Source(45, 1) + SourceIndex(0) +2 >Emitted(41, 4) Source(45, 4) + SourceIndex(0) +3 >Emitted(41, 5) Source(45, 5) + SourceIndex(0) +4 >Emitted(41, 6) Source(45, 19) + SourceIndex(0) +5 >Emitted(41, 16) Source(45, 25) + SourceIndex(0) +6 >Emitted(41, 18) Source(45, 19) + SourceIndex(0) +7 >Emitted(41, 35) Source(45, 25) + SourceIndex(0) +8 >Emitted(41, 37) Source(45, 19) + SourceIndex(0) +9 >Emitted(41, 57) Source(45, 25) + SourceIndex(0) +10>Emitted(41, 59) Source(45, 19) + SourceIndex(0) +11>Emitted(41, 63) Source(45, 25) + SourceIndex(0) +12>Emitted(41, 64) Source(45, 26) + SourceIndex(0) +--- +>>> numberB = robots_2[_u][0]; +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 > numberB +1 >Emitted(42, 5) Source(45, 7) + SourceIndex(0) +2 >Emitted(42, 30) Source(45, 14) + SourceIndex(0) +--- +>>> console.log(numberB); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^ +7 > ^ +8 > ^ +1 >] of robots) { + > +2 > console +3 > . +4 > log +5 > ( +6 > numberB +7 > ) +8 > ; +1 >Emitted(43, 5) Source(46, 5) + SourceIndex(0) +2 >Emitted(43, 12) Source(46, 12) + SourceIndex(0) +3 >Emitted(43, 13) Source(46, 13) + SourceIndex(0) +4 >Emitted(43, 16) Source(46, 16) + SourceIndex(0) +5 >Emitted(43, 17) Source(46, 17) + SourceIndex(0) +6 >Emitted(43, 24) Source(46, 24) + SourceIndex(0) +7 >Emitted(43, 25) Source(46, 25) + SourceIndex(0) +8 >Emitted(43, 26) Source(46, 26) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(44, 2) Source(47, 2) + SourceIndex(0) +--- +>>>for (var _v = 0, _w = getRobots(); _v < _w.length; _v++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^ +8 > ^^^^^^^^^ +9 > ^^ +10> ^^ +11> ^^^^^^^^^^^^^^ +12> ^^ +13> ^^^^ +14> ^ +1-> + > +2 >for +3 > +4 > ([numberB] of +5 > getRobots() +6 > +7 > +8 > getRobots +9 > () +10> +11> getRobots() +12> +13> getRobots() +14> ) +1->Emitted(45, 1) Source(48, 1) + SourceIndex(0) +2 >Emitted(45, 4) Source(48, 4) + SourceIndex(0) +3 >Emitted(45, 5) Source(48, 5) + SourceIndex(0) +4 >Emitted(45, 6) Source(48, 19) + SourceIndex(0) +5 >Emitted(45, 16) Source(48, 30) + SourceIndex(0) +6 >Emitted(45, 18) Source(48, 19) + SourceIndex(0) +7 >Emitted(45, 23) Source(48, 19) + SourceIndex(0) +8 >Emitted(45, 32) Source(48, 28) + SourceIndex(0) +9 >Emitted(45, 34) Source(48, 30) + SourceIndex(0) +10>Emitted(45, 36) Source(48, 19) + SourceIndex(0) +11>Emitted(45, 50) Source(48, 30) + SourceIndex(0) +12>Emitted(45, 52) Source(48, 19) + SourceIndex(0) +13>Emitted(45, 56) Source(48, 30) + SourceIndex(0) +14>Emitted(45, 57) Source(48, 31) + SourceIndex(0) +--- +>>> numberB = _w[_v][0]; +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^ +3 > ^^^-> +1 > +2 > numberB +1 >Emitted(46, 5) Source(48, 7) + SourceIndex(0) +2 >Emitted(46, 24) Source(48, 14) + SourceIndex(0) +--- +>>> console.log(numberB); +1->^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^ +7 > ^ +8 > ^ +1->] of getRobots()) { + > +2 > console +3 > . +4 > log +5 > ( +6 > numberB +7 > ) +8 > ; +1->Emitted(47, 5) Source(49, 5) + SourceIndex(0) +2 >Emitted(47, 12) Source(49, 12) + SourceIndex(0) +3 >Emitted(47, 13) Source(49, 13) + SourceIndex(0) +4 >Emitted(47, 16) Source(49, 16) + SourceIndex(0) +5 >Emitted(47, 17) Source(49, 17) + SourceIndex(0) +6 >Emitted(47, 24) Source(49, 24) + SourceIndex(0) +7 >Emitted(47, 25) Source(49, 25) + SourceIndex(0) +8 >Emitted(47, 26) Source(49, 26) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(48, 2) Source(50, 2) + SourceIndex(0) +--- +>>>for (var _x = 0, _y = [robotA, robotB]; _x < _y.length; _x++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^ +8 > ^^^^^^ +9 > ^^ +10> ^^^^^^ +11> ^ +12> ^^ +13> ^^^^^^^^^^^^^^ +14> ^^ +15> ^^^^ +16> ^ +1-> + > +2 >for +3 > +4 > ([numberB] of +5 > [robotA, robotB] +6 > +7 > [ +8 > robotA +9 > , +10> robotB +11> ] +12> +13> [robotA, robotB] +14> +15> [robotA, robotB] +16> ) +1->Emitted(49, 1) Source(51, 1) + SourceIndex(0) +2 >Emitted(49, 4) Source(51, 4) + SourceIndex(0) +3 >Emitted(49, 5) Source(51, 5) + SourceIndex(0) +4 >Emitted(49, 6) Source(51, 19) + SourceIndex(0) +5 >Emitted(49, 16) Source(51, 35) + SourceIndex(0) +6 >Emitted(49, 18) Source(51, 19) + SourceIndex(0) +7 >Emitted(49, 24) Source(51, 20) + SourceIndex(0) +8 >Emitted(49, 30) Source(51, 26) + SourceIndex(0) +9 >Emitted(49, 32) Source(51, 28) + SourceIndex(0) +10>Emitted(49, 38) Source(51, 34) + SourceIndex(0) +11>Emitted(49, 39) Source(51, 35) + SourceIndex(0) +12>Emitted(49, 41) Source(51, 19) + SourceIndex(0) +13>Emitted(49, 55) Source(51, 35) + SourceIndex(0) +14>Emitted(49, 57) Source(51, 19) + SourceIndex(0) +15>Emitted(49, 61) Source(51, 35) + SourceIndex(0) +16>Emitted(49, 62) Source(51, 36) + SourceIndex(0) +--- +>>> numberB = _y[_x][0]; +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^ +3 > ^^^-> +1 > +2 > numberB +1 >Emitted(50, 5) Source(51, 7) + SourceIndex(0) +2 >Emitted(50, 24) Source(51, 14) + SourceIndex(0) +--- +>>> console.log(numberB); +1->^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^ +7 > ^ +8 > ^ +1->] of [robotA, robotB]) { + > +2 > console +3 > . +4 > log +5 > ( +6 > numberB +7 > ) +8 > ; +1->Emitted(51, 5) Source(52, 5) + SourceIndex(0) +2 >Emitted(51, 12) Source(52, 12) + SourceIndex(0) +3 >Emitted(51, 13) Source(52, 13) + SourceIndex(0) +4 >Emitted(51, 16) Source(52, 16) + SourceIndex(0) +5 >Emitted(51, 17) Source(52, 17) + SourceIndex(0) +6 >Emitted(51, 24) Source(52, 24) + SourceIndex(0) +7 >Emitted(51, 25) Source(52, 25) + SourceIndex(0) +8 >Emitted(51, 26) Source(52, 26) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(52, 2) Source(53, 2) + SourceIndex(0) +--- +>>>for (var _z = 0, multiRobots_2 = multiRobots; _z < multiRobots_2.length; _z++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^^^^^^^^^^^ +10> ^^ +11> ^^^^ +12> ^ +1-> + > +2 >for +3 > +4 > ([nameB] of +5 > multiRobots +6 > +7 > multiRobots +8 > +9 > multiRobots +10> +11> multiRobots +12> ) +1->Emitted(53, 1) Source(54, 1) + SourceIndex(0) +2 >Emitted(53, 4) Source(54, 4) + SourceIndex(0) +3 >Emitted(53, 5) Source(54, 5) + SourceIndex(0) +4 >Emitted(53, 6) Source(54, 17) + SourceIndex(0) +5 >Emitted(53, 16) Source(54, 28) + SourceIndex(0) +6 >Emitted(53, 18) Source(54, 17) + SourceIndex(0) +7 >Emitted(53, 45) Source(54, 28) + SourceIndex(0) +8 >Emitted(53, 47) Source(54, 17) + SourceIndex(0) +9 >Emitted(53, 72) Source(54, 28) + SourceIndex(0) +10>Emitted(53, 74) Source(54, 17) + SourceIndex(0) +11>Emitted(53, 78) Source(54, 28) + SourceIndex(0) +12>Emitted(53, 79) Source(54, 29) + SourceIndex(0) +--- +>>> nameB = multiRobots_2[_z][0]; +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 > nameB +1 >Emitted(54, 5) Source(54, 7) + SourceIndex(0) +2 >Emitted(54, 33) Source(54, 12) + SourceIndex(0) +--- +>>> console.log(nameB); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 >] of multiRobots) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameB +7 > ) +8 > ; +1 >Emitted(55, 5) Source(55, 5) + SourceIndex(0) +2 >Emitted(55, 12) Source(55, 12) + SourceIndex(0) +3 >Emitted(55, 13) Source(55, 13) + SourceIndex(0) +4 >Emitted(55, 16) Source(55, 16) + SourceIndex(0) +5 >Emitted(55, 17) Source(55, 17) + SourceIndex(0) +6 >Emitted(55, 22) Source(55, 22) + SourceIndex(0) +7 >Emitted(55, 23) Source(55, 23) + SourceIndex(0) +8 >Emitted(55, 24) Source(55, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(56, 2) Source(56, 2) + SourceIndex(0) +--- +>>>for (var _0 = 0, _1 = getMultiRobots(); _0 < _1.length; _0++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^ +8 > ^^^^^^^^^^^^^^ +9 > ^^ +10> ^^ +11> ^^^^^^^^^^^^^^ +12> ^^ +13> ^^^^ +14> ^ +1-> + > +2 >for +3 > +4 > ([nameB] of +5 > getMultiRobots() +6 > +7 > +8 > getMultiRobots +9 > () +10> +11> getMultiRobots() +12> +13> getMultiRobots() +14> ) +1->Emitted(57, 1) Source(57, 1) + SourceIndex(0) +2 >Emitted(57, 4) Source(57, 4) + SourceIndex(0) +3 >Emitted(57, 5) Source(57, 5) + SourceIndex(0) +4 >Emitted(57, 6) Source(57, 17) + SourceIndex(0) +5 >Emitted(57, 16) Source(57, 33) + SourceIndex(0) +6 >Emitted(57, 18) Source(57, 17) + SourceIndex(0) +7 >Emitted(57, 23) Source(57, 17) + SourceIndex(0) +8 >Emitted(57, 37) Source(57, 31) + SourceIndex(0) +9 >Emitted(57, 39) Source(57, 33) + SourceIndex(0) +10>Emitted(57, 41) Source(57, 17) + SourceIndex(0) +11>Emitted(57, 55) Source(57, 33) + SourceIndex(0) +12>Emitted(57, 57) Source(57, 17) + SourceIndex(0) +13>Emitted(57, 61) Source(57, 33) + SourceIndex(0) +14>Emitted(57, 62) Source(57, 34) + SourceIndex(0) +--- +>>> nameB = _1[_0][0]; +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^ +3 > ^^^-> +1 > +2 > nameB +1 >Emitted(58, 5) Source(57, 7) + SourceIndex(0) +2 >Emitted(58, 22) Source(57, 12) + SourceIndex(0) +--- +>>> console.log(nameB); +1->^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1->] of getMultiRobots()) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameB +7 > ) +8 > ; +1->Emitted(59, 5) Source(58, 5) + SourceIndex(0) +2 >Emitted(59, 12) Source(58, 12) + SourceIndex(0) +3 >Emitted(59, 13) Source(58, 13) + SourceIndex(0) +4 >Emitted(59, 16) Source(58, 16) + SourceIndex(0) +5 >Emitted(59, 17) Source(58, 17) + SourceIndex(0) +6 >Emitted(59, 22) Source(58, 22) + SourceIndex(0) +7 >Emitted(59, 23) Source(58, 23) + SourceIndex(0) +8 >Emitted(59, 24) Source(58, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(60, 2) Source(59, 2) + SourceIndex(0) +--- +>>>for (var _2 = 0, _3 = [multiRobotA, multiRobotB]; _2 < _3.length; _2++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^ +8 > ^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^ +11> ^ +12> ^^ +13> ^^^^^^^^^^^^^^ +14> ^^ +15> ^^^^ +16> ^ +1-> + > +2 >for +3 > +4 > ([nameB] of +5 > [multiRobotA, multiRobotB] +6 > +7 > [ +8 > multiRobotA +9 > , +10> multiRobotB +11> ] +12> +13> [multiRobotA, multiRobotB] +14> +15> [multiRobotA, multiRobotB] +16> ) +1->Emitted(61, 1) Source(60, 1) + SourceIndex(0) +2 >Emitted(61, 4) Source(60, 4) + SourceIndex(0) +3 >Emitted(61, 5) Source(60, 5) + SourceIndex(0) +4 >Emitted(61, 6) Source(60, 17) + SourceIndex(0) +5 >Emitted(61, 16) Source(60, 43) + SourceIndex(0) +6 >Emitted(61, 18) Source(60, 17) + SourceIndex(0) +7 >Emitted(61, 24) Source(60, 18) + SourceIndex(0) +8 >Emitted(61, 35) Source(60, 29) + SourceIndex(0) +9 >Emitted(61, 37) Source(60, 31) + SourceIndex(0) +10>Emitted(61, 48) Source(60, 42) + SourceIndex(0) +11>Emitted(61, 49) Source(60, 43) + SourceIndex(0) +12>Emitted(61, 51) Source(60, 17) + SourceIndex(0) +13>Emitted(61, 65) Source(60, 43) + SourceIndex(0) +14>Emitted(61, 67) Source(60, 17) + SourceIndex(0) +15>Emitted(61, 71) Source(60, 43) + SourceIndex(0) +16>Emitted(61, 72) Source(60, 44) + SourceIndex(0) +--- +>>> nameB = _3[_2][0]; +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^ +3 > ^^^-> +1 > +2 > nameB +1 >Emitted(62, 5) Source(60, 7) + SourceIndex(0) +2 >Emitted(62, 22) Source(60, 12) + SourceIndex(0) +--- +>>> console.log(nameB); +1->^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1->] of [multiRobotA, multiRobotB]) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameB +7 > ) +8 > ; +1->Emitted(63, 5) Source(61, 5) + SourceIndex(0) +2 >Emitted(63, 12) Source(61, 12) + SourceIndex(0) +3 >Emitted(63, 13) Source(61, 13) + SourceIndex(0) +4 >Emitted(63, 16) Source(61, 16) + SourceIndex(0) +5 >Emitted(63, 17) Source(61, 17) + SourceIndex(0) +6 >Emitted(63, 22) Source(61, 22) + SourceIndex(0) +7 >Emitted(63, 23) Source(61, 23) + SourceIndex(0) +8 >Emitted(63, 24) Source(61, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(64, 2) Source(62, 2) + SourceIndex(0) +--- +>>>for (var _4 = 0, robots_3 = robots; _4 < robots_3.length; _4++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^^^^^^ +10> ^^ +11> ^^^^ +12> ^ +13> ^^^^^^^^^^^-> +1-> + > + > +2 >for +3 > +4 > ([numberA2, nameA2, skillA2] of +5 > robots +6 > +7 > robots +8 > +9 > robots +10> +11> robots +12> ) +1->Emitted(65, 1) Source(64, 1) + SourceIndex(0) +2 >Emitted(65, 4) Source(64, 4) + SourceIndex(0) +3 >Emitted(65, 5) Source(64, 5) + SourceIndex(0) +4 >Emitted(65, 6) Source(64, 37) + SourceIndex(0) +5 >Emitted(65, 16) Source(64, 43) + SourceIndex(0) +6 >Emitted(65, 18) Source(64, 37) + SourceIndex(0) +7 >Emitted(65, 35) Source(64, 43) + SourceIndex(0) +8 >Emitted(65, 37) Source(64, 37) + SourceIndex(0) +9 >Emitted(65, 57) Source(64, 43) + SourceIndex(0) +10>Emitted(65, 59) Source(64, 37) + SourceIndex(0) +11>Emitted(65, 63) Source(64, 43) + SourceIndex(0) +12>Emitted(65, 64) Source(64, 44) + SourceIndex(0) +--- +>>> _5 = robots_3[_4], numberA2 = _5[0], nameA2 = _5[1], skillA2 = _5[2]; +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^ +1-> +2 > [numberA2, nameA2, skillA2] +3 > +4 > numberA2 +5 > , +6 > nameA2 +7 > , +8 > skillA2 +1->Emitted(66, 5) Source(64, 6) + SourceIndex(0) +2 >Emitted(66, 22) Source(64, 33) + SourceIndex(0) +3 >Emitted(66, 24) Source(64, 7) + SourceIndex(0) +4 >Emitted(66, 40) Source(64, 15) + SourceIndex(0) +5 >Emitted(66, 42) Source(64, 17) + SourceIndex(0) +6 >Emitted(66, 56) Source(64, 23) + SourceIndex(0) +7 >Emitted(66, 58) Source(64, 25) + SourceIndex(0) +8 >Emitted(66, 73) Source(64, 32) + SourceIndex(0) +--- +>>> console.log(nameA2); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^ +7 > ^ +8 > ^ +1 >] of robots) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA2 +7 > ) +8 > ; +1 >Emitted(67, 5) Source(65, 5) + SourceIndex(0) +2 >Emitted(67, 12) Source(65, 12) + SourceIndex(0) +3 >Emitted(67, 13) Source(65, 13) + SourceIndex(0) +4 >Emitted(67, 16) Source(65, 16) + SourceIndex(0) +5 >Emitted(67, 17) Source(65, 17) + SourceIndex(0) +6 >Emitted(67, 23) Source(65, 23) + SourceIndex(0) +7 >Emitted(67, 24) Source(65, 24) + SourceIndex(0) +8 >Emitted(67, 25) Source(65, 25) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(68, 2) Source(66, 2) + SourceIndex(0) +--- +>>>for (var _6 = 0, _7 = getRobots(); _6 < _7.length; _6++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^ +8 > ^^^^^^^^^ +9 > ^^ +10> ^^ +11> ^^^^^^^^^^^^^^ +12> ^^ +13> ^^^^ +14> ^ +15> ^^^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > ([numberA2, nameA2, skillA2] of +5 > getRobots() +6 > +7 > +8 > getRobots +9 > () +10> +11> getRobots() +12> +13> getRobots() +14> ) +1->Emitted(69, 1) Source(67, 1) + SourceIndex(0) +2 >Emitted(69, 4) Source(67, 4) + SourceIndex(0) +3 >Emitted(69, 5) Source(67, 5) + SourceIndex(0) +4 >Emitted(69, 6) Source(67, 37) + SourceIndex(0) +5 >Emitted(69, 16) Source(67, 48) + SourceIndex(0) +6 >Emitted(69, 18) Source(67, 37) + SourceIndex(0) +7 >Emitted(69, 23) Source(67, 37) + SourceIndex(0) +8 >Emitted(69, 32) Source(67, 46) + SourceIndex(0) +9 >Emitted(69, 34) Source(67, 48) + SourceIndex(0) +10>Emitted(69, 36) Source(67, 37) + SourceIndex(0) +11>Emitted(69, 50) Source(67, 48) + SourceIndex(0) +12>Emitted(69, 52) Source(67, 37) + SourceIndex(0) +13>Emitted(69, 56) Source(67, 48) + SourceIndex(0) +14>Emitted(69, 57) Source(67, 49) + SourceIndex(0) +--- +>>> _8 = _7[_6], numberA2 = _8[0], nameA2 = _8[1], skillA2 = _8[2]; +1->^^^^ +2 > ^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^ +1-> +2 > [numberA2, nameA2, skillA2] +3 > +4 > numberA2 +5 > , +6 > nameA2 +7 > , +8 > skillA2 +1->Emitted(70, 5) Source(67, 6) + SourceIndex(0) +2 >Emitted(70, 16) Source(67, 33) + SourceIndex(0) +3 >Emitted(70, 18) Source(67, 7) + SourceIndex(0) +4 >Emitted(70, 34) Source(67, 15) + SourceIndex(0) +5 >Emitted(70, 36) Source(67, 17) + SourceIndex(0) +6 >Emitted(70, 50) Source(67, 23) + SourceIndex(0) +7 >Emitted(70, 52) Source(67, 25) + SourceIndex(0) +8 >Emitted(70, 67) Source(67, 32) + SourceIndex(0) +--- +>>> console.log(nameA2); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^ +7 > ^ +8 > ^ +1 >] of getRobots()) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA2 +7 > ) +8 > ; +1 >Emitted(71, 5) Source(68, 5) + SourceIndex(0) +2 >Emitted(71, 12) Source(68, 12) + SourceIndex(0) +3 >Emitted(71, 13) Source(68, 13) + SourceIndex(0) +4 >Emitted(71, 16) Source(68, 16) + SourceIndex(0) +5 >Emitted(71, 17) Source(68, 17) + SourceIndex(0) +6 >Emitted(71, 23) Source(68, 23) + SourceIndex(0) +7 >Emitted(71, 24) Source(68, 24) + SourceIndex(0) +8 >Emitted(71, 25) Source(68, 25) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(72, 2) Source(69, 2) + SourceIndex(0) +--- +>>>for (var _9 = 0, _10 = [robotA, robotB]; _9 < _10.length; _9++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^ +8 > ^^^^^^ +9 > ^^ +10> ^^^^^^ +11> ^ +12> ^^ +13> ^^^^^^^^^^^^^^^ +14> ^^ +15> ^^^^ +16> ^ +17> ^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > ([numberA2, nameA2, skillA2] of +5 > [robotA, robotB] +6 > +7 > [ +8 > robotA +9 > , +10> robotB +11> ] +12> +13> [robotA, robotB] +14> +15> [robotA, robotB] +16> ) +1->Emitted(73, 1) Source(70, 1) + SourceIndex(0) +2 >Emitted(73, 4) Source(70, 4) + SourceIndex(0) +3 >Emitted(73, 5) Source(70, 5) + SourceIndex(0) +4 >Emitted(73, 6) Source(70, 37) + SourceIndex(0) +5 >Emitted(73, 16) Source(70, 53) + SourceIndex(0) +6 >Emitted(73, 18) Source(70, 37) + SourceIndex(0) +7 >Emitted(73, 25) Source(70, 38) + SourceIndex(0) +8 >Emitted(73, 31) Source(70, 44) + SourceIndex(0) +9 >Emitted(73, 33) Source(70, 46) + SourceIndex(0) +10>Emitted(73, 39) Source(70, 52) + SourceIndex(0) +11>Emitted(73, 40) Source(70, 53) + SourceIndex(0) +12>Emitted(73, 42) Source(70, 37) + SourceIndex(0) +13>Emitted(73, 57) Source(70, 53) + SourceIndex(0) +14>Emitted(73, 59) Source(70, 37) + SourceIndex(0) +15>Emitted(73, 63) Source(70, 53) + SourceIndex(0) +16>Emitted(73, 64) Source(70, 54) + SourceIndex(0) +--- +>>> _11 = _10[_9], numberA2 = _11[0], nameA2 = _11[1], skillA2 = _11[2]; +1->^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^ +1-> +2 > [numberA2, nameA2, skillA2] +3 > +4 > numberA2 +5 > , +6 > nameA2 +7 > , +8 > skillA2 +1->Emitted(74, 5) Source(70, 6) + SourceIndex(0) +2 >Emitted(74, 18) Source(70, 33) + SourceIndex(0) +3 >Emitted(74, 20) Source(70, 7) + SourceIndex(0) +4 >Emitted(74, 37) Source(70, 15) + SourceIndex(0) +5 >Emitted(74, 39) Source(70, 17) + SourceIndex(0) +6 >Emitted(74, 54) Source(70, 23) + SourceIndex(0) +7 >Emitted(74, 56) Source(70, 25) + SourceIndex(0) +8 >Emitted(74, 72) Source(70, 32) + SourceIndex(0) +--- +>>> console.log(nameA2); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^ +7 > ^ +8 > ^ +1 >] of [robotA, robotB]) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA2 +7 > ) +8 > ; +1 >Emitted(75, 5) Source(71, 5) + SourceIndex(0) +2 >Emitted(75, 12) Source(71, 12) + SourceIndex(0) +3 >Emitted(75, 13) Source(71, 13) + SourceIndex(0) +4 >Emitted(75, 16) Source(71, 16) + SourceIndex(0) +5 >Emitted(75, 17) Source(71, 17) + SourceIndex(0) +6 >Emitted(75, 23) Source(71, 23) + SourceIndex(0) +7 >Emitted(75, 24) Source(71, 24) + SourceIndex(0) +8 >Emitted(75, 25) Source(71, 25) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(76, 2) Source(72, 2) + SourceIndex(0) +--- +>>>for (var _12 = 0, multiRobots_3 = multiRobots; _12 < multiRobots_3.length; _12++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^^^^^^^^^^^^ +10> ^^ +11> ^^^^^ +12> ^ +13> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > ([nameMA, [primarySkillA, secondarySkillA]] of +5 > multiRobots +6 > +7 > multiRobots +8 > +9 > multiRobots +10> +11> multiRobots +12> ) +1->Emitted(77, 1) Source(73, 1) + SourceIndex(0) +2 >Emitted(77, 4) Source(73, 4) + SourceIndex(0) +3 >Emitted(77, 5) Source(73, 5) + SourceIndex(0) +4 >Emitted(77, 6) Source(73, 52) + SourceIndex(0) +5 >Emitted(77, 17) Source(73, 63) + SourceIndex(0) +6 >Emitted(77, 19) Source(73, 52) + SourceIndex(0) +7 >Emitted(77, 46) Source(73, 63) + SourceIndex(0) +8 >Emitted(77, 48) Source(73, 52) + SourceIndex(0) +9 >Emitted(77, 74) Source(73, 63) + SourceIndex(0) +10>Emitted(77, 76) Source(73, 52) + SourceIndex(0) +11>Emitted(77, 81) Source(73, 63) + SourceIndex(0) +12>Emitted(77, 82) Source(73, 64) + SourceIndex(0) +--- +>>> _13 = multiRobots_3[_12], nameMA = _13[0], _14 = _13[1], primarySkillA = _14[0], secondarySkillA = _14[1]; +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > [nameMA, [primarySkillA, secondarySkillA]] +3 > +4 > nameMA +5 > , +6 > [primarySkillA, secondarySkillA] +7 > +8 > primarySkillA +9 > , +10> secondarySkillA +1->Emitted(78, 5) Source(73, 6) + SourceIndex(0) +2 >Emitted(78, 29) Source(73, 48) + SourceIndex(0) +3 >Emitted(78, 31) Source(73, 7) + SourceIndex(0) +4 >Emitted(78, 46) Source(73, 13) + SourceIndex(0) +5 >Emitted(78, 48) Source(73, 15) + SourceIndex(0) +6 >Emitted(78, 60) Source(73, 47) + SourceIndex(0) +7 >Emitted(78, 62) Source(73, 16) + SourceIndex(0) +8 >Emitted(78, 84) Source(73, 29) + SourceIndex(0) +9 >Emitted(78, 86) Source(73, 31) + SourceIndex(0) +10>Emitted(78, 110) Source(73, 46) + SourceIndex(0) +--- +>>> console.log(nameMA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^ +7 > ^ +8 > ^ +1 >]] of multiRobots) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameMA +7 > ) +8 > ; +1 >Emitted(79, 5) Source(74, 5) + SourceIndex(0) +2 >Emitted(79, 12) Source(74, 12) + SourceIndex(0) +3 >Emitted(79, 13) Source(74, 13) + SourceIndex(0) +4 >Emitted(79, 16) Source(74, 16) + SourceIndex(0) +5 >Emitted(79, 17) Source(74, 17) + SourceIndex(0) +6 >Emitted(79, 23) Source(74, 23) + SourceIndex(0) +7 >Emitted(79, 24) Source(74, 24) + SourceIndex(0) +8 >Emitted(79, 25) Source(74, 25) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(80, 2) Source(75, 2) + SourceIndex(0) +--- +>>>for (var _15 = 0, _16 = getMultiRobots(); _15 < _16.length; _15++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^ +8 > ^^^^^^^^^^^^^^ +9 > ^^ +10> ^^ +11> ^^^^^^^^^^^^^^^^ +12> ^^ +13> ^^^^^ +14> ^ +15> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > ([nameMA, [primarySkillA, secondarySkillA]] of +5 > getMultiRobots() +6 > +7 > +8 > getMultiRobots +9 > () +10> +11> getMultiRobots() +12> +13> getMultiRobots() +14> ) +1->Emitted(81, 1) Source(76, 1) + SourceIndex(0) +2 >Emitted(81, 4) Source(76, 4) + SourceIndex(0) +3 >Emitted(81, 5) Source(76, 5) + SourceIndex(0) +4 >Emitted(81, 6) Source(76, 52) + SourceIndex(0) +5 >Emitted(81, 17) Source(76, 68) + SourceIndex(0) +6 >Emitted(81, 19) Source(76, 52) + SourceIndex(0) +7 >Emitted(81, 25) Source(76, 52) + SourceIndex(0) +8 >Emitted(81, 39) Source(76, 66) + SourceIndex(0) +9 >Emitted(81, 41) Source(76, 68) + SourceIndex(0) +10>Emitted(81, 43) Source(76, 52) + SourceIndex(0) +11>Emitted(81, 59) Source(76, 68) + SourceIndex(0) +12>Emitted(81, 61) Source(76, 52) + SourceIndex(0) +13>Emitted(81, 66) Source(76, 68) + SourceIndex(0) +14>Emitted(81, 67) Source(76, 69) + SourceIndex(0) +--- +>>> _17 = _16[_15], nameMA = _17[0], _18 = _17[1], primarySkillA = _18[0], secondarySkillA = _18[1]; +1->^^^^ +2 > ^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > [nameMA, [primarySkillA, secondarySkillA]] +3 > +4 > nameMA +5 > , +6 > [primarySkillA, secondarySkillA] +7 > +8 > primarySkillA +9 > , +10> secondarySkillA +1->Emitted(82, 5) Source(76, 6) + SourceIndex(0) +2 >Emitted(82, 19) Source(76, 48) + SourceIndex(0) +3 >Emitted(82, 21) Source(76, 7) + SourceIndex(0) +4 >Emitted(82, 36) Source(76, 13) + SourceIndex(0) +5 >Emitted(82, 38) Source(76, 15) + SourceIndex(0) +6 >Emitted(82, 50) Source(76, 47) + SourceIndex(0) +7 >Emitted(82, 52) Source(76, 16) + SourceIndex(0) +8 >Emitted(82, 74) Source(76, 29) + SourceIndex(0) +9 >Emitted(82, 76) Source(76, 31) + SourceIndex(0) +10>Emitted(82, 100) Source(76, 46) + SourceIndex(0) +--- +>>> console.log(nameMA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^ +7 > ^ +8 > ^ +1 >]] of getMultiRobots()) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameMA +7 > ) +8 > ; +1 >Emitted(83, 5) Source(77, 5) + SourceIndex(0) +2 >Emitted(83, 12) Source(77, 12) + SourceIndex(0) +3 >Emitted(83, 13) Source(77, 13) + SourceIndex(0) +4 >Emitted(83, 16) Source(77, 16) + SourceIndex(0) +5 >Emitted(83, 17) Source(77, 17) + SourceIndex(0) +6 >Emitted(83, 23) Source(77, 23) + SourceIndex(0) +7 >Emitted(83, 24) Source(77, 24) + SourceIndex(0) +8 >Emitted(83, 25) Source(77, 25) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(84, 2) Source(78, 2) + SourceIndex(0) +--- +>>>for (var _19 = 0, _20 = [multiRobotA, multiRobotB]; _19 < _20.length; _19++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^ +8 > ^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^ +11> ^ +12> ^^ +13> ^^^^^^^^^^^^^^^^ +14> ^^ +15> ^^^^^ +16> ^ +17> ^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > ([nameMA, [primarySkillA, secondarySkillA]] of +5 > [multiRobotA, multiRobotB] +6 > +7 > [ +8 > multiRobotA +9 > , +10> multiRobotB +11> ] +12> +13> [multiRobotA, multiRobotB] +14> +15> [multiRobotA, multiRobotB] +16> ) +1->Emitted(85, 1) Source(79, 1) + SourceIndex(0) +2 >Emitted(85, 4) Source(79, 4) + SourceIndex(0) +3 >Emitted(85, 5) Source(79, 5) + SourceIndex(0) +4 >Emitted(85, 6) Source(79, 52) + SourceIndex(0) +5 >Emitted(85, 17) Source(79, 78) + SourceIndex(0) +6 >Emitted(85, 19) Source(79, 52) + SourceIndex(0) +7 >Emitted(85, 26) Source(79, 53) + SourceIndex(0) +8 >Emitted(85, 37) Source(79, 64) + SourceIndex(0) +9 >Emitted(85, 39) Source(79, 66) + SourceIndex(0) +10>Emitted(85, 50) Source(79, 77) + SourceIndex(0) +11>Emitted(85, 51) Source(79, 78) + SourceIndex(0) +12>Emitted(85, 53) Source(79, 52) + SourceIndex(0) +13>Emitted(85, 69) Source(79, 78) + SourceIndex(0) +14>Emitted(85, 71) Source(79, 52) + SourceIndex(0) +15>Emitted(85, 76) Source(79, 78) + SourceIndex(0) +16>Emitted(85, 77) Source(79, 79) + SourceIndex(0) +--- +>>> _21 = _20[_19], nameMA = _21[0], _22 = _21[1], primarySkillA = _22[0], secondarySkillA = _22[1]; +1->^^^^ +2 > ^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > [nameMA, [primarySkillA, secondarySkillA]] +3 > +4 > nameMA +5 > , +6 > [primarySkillA, secondarySkillA] +7 > +8 > primarySkillA +9 > , +10> secondarySkillA +1->Emitted(86, 5) Source(79, 6) + SourceIndex(0) +2 >Emitted(86, 19) Source(79, 48) + SourceIndex(0) +3 >Emitted(86, 21) Source(79, 7) + SourceIndex(0) +4 >Emitted(86, 36) Source(79, 13) + SourceIndex(0) +5 >Emitted(86, 38) Source(79, 15) + SourceIndex(0) +6 >Emitted(86, 50) Source(79, 47) + SourceIndex(0) +7 >Emitted(86, 52) Source(79, 16) + SourceIndex(0) +8 >Emitted(86, 74) Source(79, 29) + SourceIndex(0) +9 >Emitted(86, 76) Source(79, 31) + SourceIndex(0) +10>Emitted(86, 100) Source(79, 46) + SourceIndex(0) +--- +>>> console.log(nameMA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^ +7 > ^ +8 > ^ +1 >]] of [multiRobotA, multiRobotB]) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameMA +7 > ) +8 > ; +1 >Emitted(87, 5) Source(80, 5) + SourceIndex(0) +2 >Emitted(87, 12) Source(80, 12) + SourceIndex(0) +3 >Emitted(87, 13) Source(80, 13) + SourceIndex(0) +4 >Emitted(87, 16) Source(80, 16) + SourceIndex(0) +5 >Emitted(87, 17) Source(80, 17) + SourceIndex(0) +6 >Emitted(87, 23) Source(80, 23) + SourceIndex(0) +7 >Emitted(87, 24) Source(80, 24) + SourceIndex(0) +8 >Emitted(87, 25) Source(80, 25) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(88, 2) Source(81, 2) + SourceIndex(0) +--- +>>>for (var _23 = 0, robots_4 = robots; _23 < robots_4.length; _23++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^^^^^^^ +10> ^^ +11> ^^^^^ +12> ^ +13> ^^^^^-> +1-> + > + > +2 >for +3 > +4 > ([numberA3, ...robotAInfo] of +5 > robots +6 > +7 > robots +8 > +9 > robots +10> +11> robots +12> ) +1->Emitted(89, 1) Source(83, 1) + SourceIndex(0) +2 >Emitted(89, 4) Source(83, 4) + SourceIndex(0) +3 >Emitted(89, 5) Source(83, 5) + SourceIndex(0) +4 >Emitted(89, 6) Source(83, 35) + SourceIndex(0) +5 >Emitted(89, 17) Source(83, 41) + SourceIndex(0) +6 >Emitted(89, 19) Source(83, 35) + SourceIndex(0) +7 >Emitted(89, 36) Source(83, 41) + SourceIndex(0) +8 >Emitted(89, 38) Source(83, 35) + SourceIndex(0) +9 >Emitted(89, 59) Source(83, 41) + SourceIndex(0) +10>Emitted(89, 61) Source(83, 35) + SourceIndex(0) +11>Emitted(89, 66) Source(83, 41) + SourceIndex(0) +12>Emitted(89, 67) Source(83, 42) + SourceIndex(0) +--- +>>> _24 = robots_4[_23], numberA3 = _24[0], robotAInfo = _24.slice(1); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > [numberA3, ...robotAInfo] +3 > +4 > numberA3 +5 > , +6 > ...robotAInfo +1->Emitted(90, 5) Source(83, 6) + SourceIndex(0) +2 >Emitted(90, 24) Source(83, 31) + SourceIndex(0) +3 >Emitted(90, 26) Source(83, 7) + SourceIndex(0) +4 >Emitted(90, 43) Source(83, 15) + SourceIndex(0) +5 >Emitted(90, 45) Source(83, 17) + SourceIndex(0) +6 >Emitted(90, 70) Source(83, 30) + SourceIndex(0) +--- +>>> console.log(numberA3); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1 >] of robots) { + > +2 > console +3 > . +4 > log +5 > ( +6 > numberA3 +7 > ) +8 > ; +1 >Emitted(91, 5) Source(84, 5) + SourceIndex(0) +2 >Emitted(91, 12) Source(84, 12) + SourceIndex(0) +3 >Emitted(91, 13) Source(84, 13) + SourceIndex(0) +4 >Emitted(91, 16) Source(84, 16) + SourceIndex(0) +5 >Emitted(91, 17) Source(84, 17) + SourceIndex(0) +6 >Emitted(91, 25) Source(84, 25) + SourceIndex(0) +7 >Emitted(91, 26) Source(84, 26) + SourceIndex(0) +8 >Emitted(91, 27) Source(84, 27) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(92, 2) Source(85, 2) + SourceIndex(0) +--- +>>>for (var _25 = 0, _26 = getRobots(); _25 < _26.length; _25++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^ +8 > ^^^^^^^^^ +9 > ^^ +10> ^^ +11> ^^^^^^^^^^^^^^^^ +12> ^^ +13> ^^^^^ +14> ^ +15> ^^^^^-> +1-> + > +2 >for +3 > +4 > ([numberA3, ...robotAInfo] of +5 > getRobots() +6 > +7 > +8 > getRobots +9 > () +10> +11> getRobots() +12> +13> getRobots() +14> ) +1->Emitted(93, 1) Source(86, 1) + SourceIndex(0) +2 >Emitted(93, 4) Source(86, 4) + SourceIndex(0) +3 >Emitted(93, 5) Source(86, 5) + SourceIndex(0) +4 >Emitted(93, 6) Source(86, 35) + SourceIndex(0) +5 >Emitted(93, 17) Source(86, 46) + SourceIndex(0) +6 >Emitted(93, 19) Source(86, 35) + SourceIndex(0) +7 >Emitted(93, 25) Source(86, 35) + SourceIndex(0) +8 >Emitted(93, 34) Source(86, 44) + SourceIndex(0) +9 >Emitted(93, 36) Source(86, 46) + SourceIndex(0) +10>Emitted(93, 38) Source(86, 35) + SourceIndex(0) +11>Emitted(93, 54) Source(86, 46) + SourceIndex(0) +12>Emitted(93, 56) Source(86, 35) + SourceIndex(0) +13>Emitted(93, 61) Source(86, 46) + SourceIndex(0) +14>Emitted(93, 62) Source(86, 47) + SourceIndex(0) +--- +>>> _27 = _26[_25], numberA3 = _27[0], robotAInfo = _27.slice(1); +1->^^^^ +2 > ^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > [numberA3, ...robotAInfo] +3 > +4 > numberA3 +5 > , +6 > ...robotAInfo +1->Emitted(94, 5) Source(86, 6) + SourceIndex(0) +2 >Emitted(94, 19) Source(86, 31) + SourceIndex(0) +3 >Emitted(94, 21) Source(86, 7) + SourceIndex(0) +4 >Emitted(94, 38) Source(86, 15) + SourceIndex(0) +5 >Emitted(94, 40) Source(86, 17) + SourceIndex(0) +6 >Emitted(94, 65) Source(86, 30) + SourceIndex(0) +--- +>>> console.log(numberA3); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1 >] of getRobots()) { + > +2 > console +3 > . +4 > log +5 > ( +6 > numberA3 +7 > ) +8 > ; +1 >Emitted(95, 5) Source(87, 5) + SourceIndex(0) +2 >Emitted(95, 12) Source(87, 12) + SourceIndex(0) +3 >Emitted(95, 13) Source(87, 13) + SourceIndex(0) +4 >Emitted(95, 16) Source(87, 16) + SourceIndex(0) +5 >Emitted(95, 17) Source(87, 17) + SourceIndex(0) +6 >Emitted(95, 25) Source(87, 25) + SourceIndex(0) +7 >Emitted(95, 26) Source(87, 26) + SourceIndex(0) +8 >Emitted(95, 27) Source(87, 27) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(96, 2) Source(88, 2) + SourceIndex(0) +--- +>>>for (var _28 = 0, _29 = [robotA, robotB]; _28 < _29.length; _28++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^ +8 > ^^^^^^ +9 > ^^ +10> ^^^^^^ +11> ^ +12> ^^ +13> ^^^^^^^^^^^^^^^^ +14> ^^ +15> ^^^^^ +16> ^ +1-> + > +2 >for +3 > +4 > ([numberA3, ...robotAInfo] of +5 > [robotA, robotB] +6 > +7 > [ +8 > robotA +9 > , +10> robotB +11> ] +12> +13> [robotA, robotB] +14> +15> [robotA, robotB] +16> ) +1->Emitted(97, 1) Source(89, 1) + SourceIndex(0) +2 >Emitted(97, 4) Source(89, 4) + SourceIndex(0) +3 >Emitted(97, 5) Source(89, 5) + SourceIndex(0) +4 >Emitted(97, 6) Source(89, 35) + SourceIndex(0) +5 >Emitted(97, 17) Source(89, 51) + SourceIndex(0) +6 >Emitted(97, 19) Source(89, 35) + SourceIndex(0) +7 >Emitted(97, 26) Source(89, 36) + SourceIndex(0) +8 >Emitted(97, 32) Source(89, 42) + SourceIndex(0) +9 >Emitted(97, 34) Source(89, 44) + SourceIndex(0) +10>Emitted(97, 40) Source(89, 50) + SourceIndex(0) +11>Emitted(97, 41) Source(89, 51) + SourceIndex(0) +12>Emitted(97, 43) Source(89, 35) + SourceIndex(0) +13>Emitted(97, 59) Source(89, 51) + SourceIndex(0) +14>Emitted(97, 61) Source(89, 35) + SourceIndex(0) +15>Emitted(97, 66) Source(89, 51) + SourceIndex(0) +16>Emitted(97, 67) Source(89, 52) + SourceIndex(0) +--- +>>> _30 = _29[_28], numberA3 = _30[0], robotAInfo = _30.slice(1); +1 >^^^^ +2 > ^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 > [numberA3, ...robotAInfo] +3 > +4 > numberA3 +5 > , +6 > ...robotAInfo +1 >Emitted(98, 5) Source(89, 6) + SourceIndex(0) +2 >Emitted(98, 19) Source(89, 31) + SourceIndex(0) +3 >Emitted(98, 21) Source(89, 7) + SourceIndex(0) +4 >Emitted(98, 38) Source(89, 15) + SourceIndex(0) +5 >Emitted(98, 40) Source(89, 17) + SourceIndex(0) +6 >Emitted(98, 65) Source(89, 30) + SourceIndex(0) +--- +>>> console.log(numberA3); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1 >] of [robotA, robotB]) { + > +2 > console +3 > . +4 > log +5 > ( +6 > numberA3 +7 > ) +8 > ; +1 >Emitted(99, 5) Source(90, 5) + SourceIndex(0) +2 >Emitted(99, 12) Source(90, 12) + SourceIndex(0) +3 >Emitted(99, 13) Source(90, 13) + SourceIndex(0) +4 >Emitted(99, 16) Source(90, 16) + SourceIndex(0) +5 >Emitted(99, 17) Source(90, 17) + SourceIndex(0) +6 >Emitted(99, 25) Source(90, 25) + SourceIndex(0) +7 >Emitted(99, 26) Source(90, 26) + SourceIndex(0) +8 >Emitted(99, 27) Source(90, 27) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(100, 2) Source(91, 2) + SourceIndex(0) +--- +>>>for (var _31 = 0, multiRobots_4 = multiRobots; _31 < multiRobots_4.length; _31++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^^^^^^^^^^^^ +10> ^^ +11> ^^^^^ +12> ^ +1-> + > +2 >for +3 > +4 > ([...multiRobotAInfo] of +5 > multiRobots +6 > +7 > multiRobots +8 > +9 > multiRobots +10> +11> multiRobots +12> ) +1->Emitted(101, 1) Source(92, 1) + SourceIndex(0) +2 >Emitted(101, 4) Source(92, 4) + SourceIndex(0) +3 >Emitted(101, 5) Source(92, 5) + SourceIndex(0) +4 >Emitted(101, 6) Source(92, 30) + SourceIndex(0) +5 >Emitted(101, 17) Source(92, 41) + SourceIndex(0) +6 >Emitted(101, 19) Source(92, 30) + SourceIndex(0) +7 >Emitted(101, 46) Source(92, 41) + SourceIndex(0) +8 >Emitted(101, 48) Source(92, 30) + SourceIndex(0) +9 >Emitted(101, 74) Source(92, 41) + SourceIndex(0) +10>Emitted(101, 76) Source(92, 30) + SourceIndex(0) +11>Emitted(101, 81) Source(92, 41) + SourceIndex(0) +12>Emitted(101, 82) Source(92, 42) + SourceIndex(0) +--- +>>> multiRobotAInfo = multiRobots_4[_31].slice(0); +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 > ...multiRobotAInfo +1 >Emitted(102, 5) Source(92, 7) + SourceIndex(0) +2 >Emitted(102, 50) Source(92, 25) + SourceIndex(0) +--- +>>> console.log(multiRobotAInfo); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^^^^^^^^ +7 > ^ +8 > ^ +1 >] of multiRobots) { + > +2 > console +3 > . +4 > log +5 > ( +6 > multiRobotAInfo +7 > ) +8 > ; +1 >Emitted(103, 5) Source(93, 5) + SourceIndex(0) +2 >Emitted(103, 12) Source(93, 12) + SourceIndex(0) +3 >Emitted(103, 13) Source(93, 13) + SourceIndex(0) +4 >Emitted(103, 16) Source(93, 16) + SourceIndex(0) +5 >Emitted(103, 17) Source(93, 17) + SourceIndex(0) +6 >Emitted(103, 32) Source(93, 32) + SourceIndex(0) +7 >Emitted(103, 33) Source(93, 33) + SourceIndex(0) +8 >Emitted(103, 34) Source(93, 34) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(104, 2) Source(94, 2) + SourceIndex(0) +--- +>>>for (var _32 = 0, _33 = getMultiRobots(); _32 < _33.length; _32++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^ +8 > ^^^^^^^^^^^^^^ +9 > ^^ +10> ^^ +11> ^^^^^^^^^^^^^^^^ +12> ^^ +13> ^^^^^ +14> ^ +1-> + > +2 >for +3 > +4 > ([...multiRobotAInfo] of +5 > getMultiRobots() +6 > +7 > +8 > getMultiRobots +9 > () +10> +11> getMultiRobots() +12> +13> getMultiRobots() +14> ) +1->Emitted(105, 1) Source(95, 1) + SourceIndex(0) +2 >Emitted(105, 4) Source(95, 4) + SourceIndex(0) +3 >Emitted(105, 5) Source(95, 5) + SourceIndex(0) +4 >Emitted(105, 6) Source(95, 30) + SourceIndex(0) +5 >Emitted(105, 17) Source(95, 46) + SourceIndex(0) +6 >Emitted(105, 19) Source(95, 30) + SourceIndex(0) +7 >Emitted(105, 25) Source(95, 30) + SourceIndex(0) +8 >Emitted(105, 39) Source(95, 44) + SourceIndex(0) +9 >Emitted(105, 41) Source(95, 46) + SourceIndex(0) +10>Emitted(105, 43) Source(95, 30) + SourceIndex(0) +11>Emitted(105, 59) Source(95, 46) + SourceIndex(0) +12>Emitted(105, 61) Source(95, 30) + SourceIndex(0) +13>Emitted(105, 66) Source(95, 46) + SourceIndex(0) +14>Emitted(105, 67) Source(95, 47) + SourceIndex(0) +--- +>>> multiRobotAInfo = _33[_32].slice(0); +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 > ...multiRobotAInfo +1 >Emitted(106, 5) Source(95, 7) + SourceIndex(0) +2 >Emitted(106, 40) Source(95, 25) + SourceIndex(0) +--- +>>> console.log(multiRobotAInfo); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^^^^^^^^ +7 > ^ +8 > ^ +1 >] of getMultiRobots()) { + > +2 > console +3 > . +4 > log +5 > ( +6 > multiRobotAInfo +7 > ) +8 > ; +1 >Emitted(107, 5) Source(96, 5) + SourceIndex(0) +2 >Emitted(107, 12) Source(96, 12) + SourceIndex(0) +3 >Emitted(107, 13) Source(96, 13) + SourceIndex(0) +4 >Emitted(107, 16) Source(96, 16) + SourceIndex(0) +5 >Emitted(107, 17) Source(96, 17) + SourceIndex(0) +6 >Emitted(107, 32) Source(96, 32) + SourceIndex(0) +7 >Emitted(107, 33) Source(96, 33) + SourceIndex(0) +8 >Emitted(107, 34) Source(96, 34) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(108, 2) Source(97, 2) + SourceIndex(0) +--- +>>>for (var _34 = 0, _35 = [multiRobotA, multiRobotB]; _34 < _35.length; _34++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^ +8 > ^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^ +11> ^ +12> ^^ +13> ^^^^^^^^^^^^^^^^ +14> ^^ +15> ^^^^^ +16> ^ +1-> + > +2 >for +3 > +4 > ([...multiRobotAInfo] of +5 > [multiRobotA, multiRobotB] +6 > +7 > [ +8 > multiRobotA +9 > , +10> multiRobotB +11> ] +12> +13> [multiRobotA, multiRobotB] +14> +15> [multiRobotA, multiRobotB] +16> ) +1->Emitted(109, 1) Source(98, 1) + SourceIndex(0) +2 >Emitted(109, 4) Source(98, 4) + SourceIndex(0) +3 >Emitted(109, 5) Source(98, 5) + SourceIndex(0) +4 >Emitted(109, 6) Source(98, 30) + SourceIndex(0) +5 >Emitted(109, 17) Source(98, 56) + SourceIndex(0) +6 >Emitted(109, 19) Source(98, 30) + SourceIndex(0) +7 >Emitted(109, 26) Source(98, 31) + SourceIndex(0) +8 >Emitted(109, 37) Source(98, 42) + SourceIndex(0) +9 >Emitted(109, 39) Source(98, 44) + SourceIndex(0) +10>Emitted(109, 50) Source(98, 55) + SourceIndex(0) +11>Emitted(109, 51) Source(98, 56) + SourceIndex(0) +12>Emitted(109, 53) Source(98, 30) + SourceIndex(0) +13>Emitted(109, 69) Source(98, 56) + SourceIndex(0) +14>Emitted(109, 71) Source(98, 30) + SourceIndex(0) +15>Emitted(109, 76) Source(98, 56) + SourceIndex(0) +16>Emitted(109, 77) Source(98, 57) + SourceIndex(0) +--- +>>> multiRobotAInfo = _35[_34].slice(0); +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 > ...multiRobotAInfo +1 >Emitted(110, 5) Source(98, 7) + SourceIndex(0) +2 >Emitted(110, 40) Source(98, 25) + SourceIndex(0) +--- +>>> console.log(multiRobotAInfo); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^^^^^^^^ +7 > ^ +8 > ^ +1 >] of [multiRobotA, multiRobotB]) { + > +2 > console +3 > . +4 > log +5 > ( +6 > multiRobotAInfo +7 > ) +8 > ; +1 >Emitted(111, 5) Source(99, 5) + SourceIndex(0) +2 >Emitted(111, 12) Source(99, 12) + SourceIndex(0) +3 >Emitted(111, 13) Source(99, 13) + SourceIndex(0) +4 >Emitted(111, 16) Source(99, 16) + SourceIndex(0) +5 >Emitted(111, 17) Source(99, 17) + SourceIndex(0) +6 >Emitted(111, 32) Source(99, 32) + SourceIndex(0) +7 >Emitted(111, 33) Source(99, 33) + SourceIndex(0) +8 >Emitted(111, 34) Source(99, 34) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(112, 2) Source(100, 2) + SourceIndex(0) +--- +>>>var _a, _d, _g, _j, _k, _o, _p, _s, _t, _5, _8, _11, _13, _14, _17, _18, _21, _22, _24, _27, _30; +>>>//# sourceMappingURL=sourceMapValidationDestructuringForOfArrayBindingPattern2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPattern2.symbols b/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPattern2.symbols new file mode 100644 index 00000000000..9f7648afccb --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPattern2.symbols @@ -0,0 +1,343 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringForOfArrayBindingPattern2.ts === +declare var console: { +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 0, 11)) + + log(msg: any): void; +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 0, 22)) +>msg : Symbol(msg, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 1, 8)) +} +type Robot = [number, string, string]; +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 2, 1)) + +type MultiSkilledRobot = [string, [string, string]]; +>MultiSkilledRobot : Symbol(MultiSkilledRobot, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 3, 38)) + +let robotA: Robot = [1, "mower", "mowing"]; +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 6, 3)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 2, 1)) + +let robotB: Robot = [2, "trimmer", "trimming"]; +>robotB : Symbol(robotB, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 7, 3)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 2, 1)) + +let robots = [robotA, robotB]; +>robots : Symbol(robots, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 8, 3)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 6, 3)) +>robotB : Symbol(robotB, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 7, 3)) + +function getRobots() { +>getRobots : Symbol(getRobots, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 8, 30)) + + return robots; +>robots : Symbol(robots, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 8, 3)) +} + +let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; +>multiRobotA : Symbol(multiRobotA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 13, 3)) +>MultiSkilledRobot : Symbol(MultiSkilledRobot, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 3, 38)) + +let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; +>multiRobotB : Symbol(multiRobotB, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 14, 3)) +>MultiSkilledRobot : Symbol(MultiSkilledRobot, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 3, 38)) + +let multiRobots = [multiRobotA, multiRobotB]; +>multiRobots : Symbol(multiRobots, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 15, 3)) +>multiRobotA : Symbol(multiRobotA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 13, 3)) +>multiRobotB : Symbol(multiRobotB, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 14, 3)) + +function getMultiRobots() { +>getMultiRobots : Symbol(getMultiRobots, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 15, 45)) + + return multiRobots; +>multiRobots : Symbol(multiRobots, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 15, 3)) +} + +let nameA: string, primarySkillA: string, secondarySkillA: string; +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 20, 3)) +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 20, 18)) +>secondarySkillA : Symbol(secondarySkillA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 20, 41)) + +let numberB: number, nameB: string; +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 21, 3)) +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 21, 20)) + +let numberA2: number, nameA2: string, skillA2: string, nameMA: string; +>numberA2 : Symbol(numberA2, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 22, 3)) +>nameA2 : Symbol(nameA2, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 22, 21)) +>skillA2 : Symbol(skillA2, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 22, 37)) +>nameMA : Symbol(nameMA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 22, 54)) + +let numberA3: number, robotAInfo: (number | string)[], multiRobotAInfo: (string | [string, string])[]; +>numberA3 : Symbol(numberA3, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 23, 3)) +>robotAInfo : Symbol(robotAInfo, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 23, 21)) +>multiRobotAInfo : Symbol(multiRobotAInfo, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 23, 54)) + +for ([, nameA] of robots) { +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 20, 3)) +>robots : Symbol(robots, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 8, 3)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 20, 3)) +} +for ([, nameA] of getRobots()) { +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 20, 3)) +>getRobots : Symbol(getRobots, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 8, 30)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 20, 3)) +} +for ([, nameA] of [robotA, robotB]) { +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 20, 3)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 6, 3)) +>robotB : Symbol(robotB, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 7, 3)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 20, 3)) +} +for ([, [primarySkillA, secondarySkillA]] of multiRobots) { +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 20, 18)) +>secondarySkillA : Symbol(secondarySkillA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 20, 41)) +>multiRobots : Symbol(multiRobots, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 15, 3)) + + console.log(primarySkillA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 0, 22)) +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 20, 18)) +} +for ([, [primarySkillA, secondarySkillA]] of getMultiRobots()) { +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 20, 18)) +>secondarySkillA : Symbol(secondarySkillA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 20, 41)) +>getMultiRobots : Symbol(getMultiRobots, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 15, 45)) + + console.log(primarySkillA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 0, 22)) +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 20, 18)) +} +for ([, [primarySkillA, secondarySkillA]] of [multiRobotA, multiRobotB]) { +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 20, 18)) +>secondarySkillA : Symbol(secondarySkillA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 20, 41)) +>multiRobotA : Symbol(multiRobotA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 13, 3)) +>multiRobotB : Symbol(multiRobotB, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 14, 3)) + + console.log(primarySkillA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 0, 22)) +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 20, 18)) +} + +for ([numberB] of robots) { +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 21, 3)) +>robots : Symbol(robots, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 8, 3)) + + console.log(numberB); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 0, 22)) +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 21, 3)) +} +for ([numberB] of getRobots()) { +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 21, 3)) +>getRobots : Symbol(getRobots, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 8, 30)) + + console.log(numberB); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 0, 22)) +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 21, 3)) +} +for ([numberB] of [robotA, robotB]) { +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 21, 3)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 6, 3)) +>robotB : Symbol(robotB, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 7, 3)) + + console.log(numberB); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 0, 22)) +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 21, 3)) +} +for ([nameB] of multiRobots) { +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 21, 20)) +>multiRobots : Symbol(multiRobots, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 15, 3)) + + console.log(nameB); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 0, 22)) +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 21, 20)) +} +for ([nameB] of getMultiRobots()) { +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 21, 20)) +>getMultiRobots : Symbol(getMultiRobots, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 15, 45)) + + console.log(nameB); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 0, 22)) +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 21, 20)) +} +for ([nameB] of [multiRobotA, multiRobotB]) { +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 21, 20)) +>multiRobotA : Symbol(multiRobotA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 13, 3)) +>multiRobotB : Symbol(multiRobotB, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 14, 3)) + + console.log(nameB); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 0, 22)) +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 21, 20)) +} + +for ([numberA2, nameA2, skillA2] of robots) { +>numberA2 : Symbol(numberA2, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 22, 3)) +>nameA2 : Symbol(nameA2, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 22, 21)) +>skillA2 : Symbol(skillA2, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 22, 37)) +>robots : Symbol(robots, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 8, 3)) + + console.log(nameA2); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 0, 22)) +>nameA2 : Symbol(nameA2, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 22, 21)) +} +for ([numberA2, nameA2, skillA2] of getRobots()) { +>numberA2 : Symbol(numberA2, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 22, 3)) +>nameA2 : Symbol(nameA2, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 22, 21)) +>skillA2 : Symbol(skillA2, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 22, 37)) +>getRobots : Symbol(getRobots, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 8, 30)) + + console.log(nameA2); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 0, 22)) +>nameA2 : Symbol(nameA2, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 22, 21)) +} +for ([numberA2, nameA2, skillA2] of [robotA, robotB]) { +>numberA2 : Symbol(numberA2, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 22, 3)) +>nameA2 : Symbol(nameA2, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 22, 21)) +>skillA2 : Symbol(skillA2, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 22, 37)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 6, 3)) +>robotB : Symbol(robotB, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 7, 3)) + + console.log(nameA2); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 0, 22)) +>nameA2 : Symbol(nameA2, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 22, 21)) +} +for ([nameMA, [primarySkillA, secondarySkillA]] of multiRobots) { +>nameMA : Symbol(nameMA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 22, 54)) +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 20, 18)) +>secondarySkillA : Symbol(secondarySkillA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 20, 41)) +>multiRobots : Symbol(multiRobots, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 15, 3)) + + console.log(nameMA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 0, 22)) +>nameMA : Symbol(nameMA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 22, 54)) +} +for ([nameMA, [primarySkillA, secondarySkillA]] of getMultiRobots()) { +>nameMA : Symbol(nameMA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 22, 54)) +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 20, 18)) +>secondarySkillA : Symbol(secondarySkillA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 20, 41)) +>getMultiRobots : Symbol(getMultiRobots, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 15, 45)) + + console.log(nameMA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 0, 22)) +>nameMA : Symbol(nameMA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 22, 54)) +} +for ([nameMA, [primarySkillA, secondarySkillA]] of [multiRobotA, multiRobotB]) { +>nameMA : Symbol(nameMA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 22, 54)) +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 20, 18)) +>secondarySkillA : Symbol(secondarySkillA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 20, 41)) +>multiRobotA : Symbol(multiRobotA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 13, 3)) +>multiRobotB : Symbol(multiRobotB, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 14, 3)) + + console.log(nameMA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 0, 22)) +>nameMA : Symbol(nameMA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 22, 54)) +} + +for ([numberA3, ...robotAInfo] of robots) { +>numberA3 : Symbol(numberA3, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 23, 3)) +>robotAInfo : Symbol(robotAInfo, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 23, 21)) +>robots : Symbol(robots, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 8, 3)) + + console.log(numberA3); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 0, 22)) +>numberA3 : Symbol(numberA3, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 23, 3)) +} +for ([numberA3, ...robotAInfo] of getRobots()) { +>numberA3 : Symbol(numberA3, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 23, 3)) +>robotAInfo : Symbol(robotAInfo, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 23, 21)) +>getRobots : Symbol(getRobots, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 8, 30)) + + console.log(numberA3); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 0, 22)) +>numberA3 : Symbol(numberA3, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 23, 3)) +} +for ([numberA3, ...robotAInfo] of [robotA, robotB]) { +>numberA3 : Symbol(numberA3, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 23, 3)) +>robotAInfo : Symbol(robotAInfo, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 23, 21)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 6, 3)) +>robotB : Symbol(robotB, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 7, 3)) + + console.log(numberA3); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 0, 22)) +>numberA3 : Symbol(numberA3, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 23, 3)) +} +for ([...multiRobotAInfo] of multiRobots) { +>multiRobotAInfo : Symbol(multiRobotAInfo, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 23, 54)) +>multiRobots : Symbol(multiRobots, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 15, 3)) + + console.log(multiRobotAInfo); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 0, 22)) +>multiRobotAInfo : Symbol(multiRobotAInfo, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 23, 54)) +} +for ([...multiRobotAInfo] of getMultiRobots()) { +>multiRobotAInfo : Symbol(multiRobotAInfo, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 23, 54)) +>getMultiRobots : Symbol(getMultiRobots, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 15, 45)) + + console.log(multiRobotAInfo); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 0, 22)) +>multiRobotAInfo : Symbol(multiRobotAInfo, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 23, 54)) +} +for ([...multiRobotAInfo] of [multiRobotA, multiRobotB]) { +>multiRobotAInfo : Symbol(multiRobotAInfo, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 23, 54)) +>multiRobotA : Symbol(multiRobotA, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 13, 3)) +>multiRobotB : Symbol(multiRobotB, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 14, 3)) + + console.log(multiRobotAInfo); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 0, 22)) +>multiRobotAInfo : Symbol(multiRobotAInfo, Decl(sourceMapValidationDestructuringForOfArrayBindingPattern2.ts, 23, 54)) +} diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPattern2.types b/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPattern2.types new file mode 100644 index 00000000000..78cb778b545 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPattern2.types @@ -0,0 +1,445 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringForOfArrayBindingPattern2.ts === +declare var console: { +>console : { log(msg: any): void; } + + log(msg: any): void; +>log : (msg: any) => void +>msg : any +} +type Robot = [number, string, string]; +>Robot : [number, string, string] + +type MultiSkilledRobot = [string, [string, string]]; +>MultiSkilledRobot : [string, [string, string]] + +let robotA: Robot = [1, "mower", "mowing"]; +>robotA : [number, string, string] +>Robot : [number, string, string] +>[1, "mower", "mowing"] : [number, string, string] +>1 : number +>"mower" : string +>"mowing" : string + +let robotB: Robot = [2, "trimmer", "trimming"]; +>robotB : [number, string, string] +>Robot : [number, string, string] +>[2, "trimmer", "trimming"] : [number, string, string] +>2 : number +>"trimmer" : string +>"trimming" : string + +let robots = [robotA, robotB]; +>robots : [number, string, string][] +>[robotA, robotB] : [number, string, string][] +>robotA : [number, string, string] +>robotB : [number, string, string] + +function getRobots() { +>getRobots : () => [number, string, string][] + + return robots; +>robots : [number, string, string][] +} + +let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; +>multiRobotA : [string, [string, string]] +>MultiSkilledRobot : [string, [string, string]] +>["mower", ["mowing", ""]] : [string, [string, string]] +>"mower" : string +>["mowing", ""] : [string, string] +>"mowing" : string +>"" : string + +let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; +>multiRobotB : [string, [string, string]] +>MultiSkilledRobot : [string, [string, string]] +>["trimmer", ["trimming", "edging"]] : [string, [string, string]] +>"trimmer" : string +>["trimming", "edging"] : [string, string] +>"trimming" : string +>"edging" : string + +let multiRobots = [multiRobotA, multiRobotB]; +>multiRobots : [string, [string, string]][] +>[multiRobotA, multiRobotB] : [string, [string, string]][] +>multiRobotA : [string, [string, string]] +>multiRobotB : [string, [string, string]] + +function getMultiRobots() { +>getMultiRobots : () => [string, [string, string]][] + + return multiRobots; +>multiRobots : [string, [string, string]][] +} + +let nameA: string, primarySkillA: string, secondarySkillA: string; +>nameA : string +>primarySkillA : string +>secondarySkillA : string + +let numberB: number, nameB: string; +>numberB : number +>nameB : string + +let numberA2: number, nameA2: string, skillA2: string, nameMA: string; +>numberA2 : number +>nameA2 : string +>skillA2 : string +>nameMA : string + +let numberA3: number, robotAInfo: (number | string)[], multiRobotAInfo: (string | [string, string])[]; +>numberA3 : number +>robotAInfo : (number | string)[] +>multiRobotAInfo : (string | [string, string])[] + +for ([, nameA] of robots) { +>[, nameA] : [undefined, string] +> : undefined +>nameA : string +>robots : [number, string, string][] + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for ([, nameA] of getRobots()) { +>[, nameA] : [undefined, string] +> : undefined +>nameA : string +>getRobots() : [number, string, string][] +>getRobots : () => [number, string, string][] + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for ([, nameA] of [robotA, robotB]) { +>[, nameA] : [undefined, string] +> : undefined +>nameA : string +>[robotA, robotB] : [number, string, string][] +>robotA : [number, string, string] +>robotB : [number, string, string] + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for ([, [primarySkillA, secondarySkillA]] of multiRobots) { +>[, [primarySkillA, secondarySkillA]] : [undefined, [string, string]] +> : undefined +>[primarySkillA, secondarySkillA] : [string, string] +>primarySkillA : string +>secondarySkillA : string +>multiRobots : [string, [string, string]][] + + console.log(primarySkillA); +>console.log(primarySkillA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primarySkillA : string +} +for ([, [primarySkillA, secondarySkillA]] of getMultiRobots()) { +>[, [primarySkillA, secondarySkillA]] : [undefined, [string, string]] +> : undefined +>[primarySkillA, secondarySkillA] : [string, string] +>primarySkillA : string +>secondarySkillA : string +>getMultiRobots() : [string, [string, string]][] +>getMultiRobots : () => [string, [string, string]][] + + console.log(primarySkillA); +>console.log(primarySkillA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primarySkillA : string +} +for ([, [primarySkillA, secondarySkillA]] of [multiRobotA, multiRobotB]) { +>[, [primarySkillA, secondarySkillA]] : [undefined, [string, string]] +> : undefined +>[primarySkillA, secondarySkillA] : [string, string] +>primarySkillA : string +>secondarySkillA : string +>[multiRobotA, multiRobotB] : [string, [string, string]][] +>multiRobotA : [string, [string, string]] +>multiRobotB : [string, [string, string]] + + console.log(primarySkillA); +>console.log(primarySkillA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primarySkillA : string +} + +for ([numberB] of robots) { +>[numberB] : [number] +>numberB : number +>robots : [number, string, string][] + + console.log(numberB); +>console.log(numberB) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>numberB : number +} +for ([numberB] of getRobots()) { +>[numberB] : [number] +>numberB : number +>getRobots() : [number, string, string][] +>getRobots : () => [number, string, string][] + + console.log(numberB); +>console.log(numberB) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>numberB : number +} +for ([numberB] of [robotA, robotB]) { +>[numberB] : [number] +>numberB : number +>[robotA, robotB] : [number, string, string][] +>robotA : [number, string, string] +>robotB : [number, string, string] + + console.log(numberB); +>console.log(numberB) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>numberB : number +} +for ([nameB] of multiRobots) { +>[nameB] : [string] +>nameB : string +>multiRobots : [string, [string, string]][] + + console.log(nameB); +>console.log(nameB) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameB : string +} +for ([nameB] of getMultiRobots()) { +>[nameB] : [string] +>nameB : string +>getMultiRobots() : [string, [string, string]][] +>getMultiRobots : () => [string, [string, string]][] + + console.log(nameB); +>console.log(nameB) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameB : string +} +for ([nameB] of [multiRobotA, multiRobotB]) { +>[nameB] : [string] +>nameB : string +>[multiRobotA, multiRobotB] : [string, [string, string]][] +>multiRobotA : [string, [string, string]] +>multiRobotB : [string, [string, string]] + + console.log(nameB); +>console.log(nameB) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameB : string +} + +for ([numberA2, nameA2, skillA2] of robots) { +>[numberA2, nameA2, skillA2] : [number, string, string] +>numberA2 : number +>nameA2 : string +>skillA2 : string +>robots : [number, string, string][] + + console.log(nameA2); +>console.log(nameA2) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA2 : string +} +for ([numberA2, nameA2, skillA2] of getRobots()) { +>[numberA2, nameA2, skillA2] : [number, string, string] +>numberA2 : number +>nameA2 : string +>skillA2 : string +>getRobots() : [number, string, string][] +>getRobots : () => [number, string, string][] + + console.log(nameA2); +>console.log(nameA2) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA2 : string +} +for ([numberA2, nameA2, skillA2] of [robotA, robotB]) { +>[numberA2, nameA2, skillA2] : [number, string, string] +>numberA2 : number +>nameA2 : string +>skillA2 : string +>[robotA, robotB] : [number, string, string][] +>robotA : [number, string, string] +>robotB : [number, string, string] + + console.log(nameA2); +>console.log(nameA2) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA2 : string +} +for ([nameMA, [primarySkillA, secondarySkillA]] of multiRobots) { +>[nameMA, [primarySkillA, secondarySkillA]] : [string, [string, string]] +>nameMA : string +>[primarySkillA, secondarySkillA] : [string, string] +>primarySkillA : string +>secondarySkillA : string +>multiRobots : [string, [string, string]][] + + console.log(nameMA); +>console.log(nameMA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameMA : string +} +for ([nameMA, [primarySkillA, secondarySkillA]] of getMultiRobots()) { +>[nameMA, [primarySkillA, secondarySkillA]] : [string, [string, string]] +>nameMA : string +>[primarySkillA, secondarySkillA] : [string, string] +>primarySkillA : string +>secondarySkillA : string +>getMultiRobots() : [string, [string, string]][] +>getMultiRobots : () => [string, [string, string]][] + + console.log(nameMA); +>console.log(nameMA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameMA : string +} +for ([nameMA, [primarySkillA, secondarySkillA]] of [multiRobotA, multiRobotB]) { +>[nameMA, [primarySkillA, secondarySkillA]] : [string, [string, string]] +>nameMA : string +>[primarySkillA, secondarySkillA] : [string, string] +>primarySkillA : string +>secondarySkillA : string +>[multiRobotA, multiRobotB] : [string, [string, string]][] +>multiRobotA : [string, [string, string]] +>multiRobotB : [string, [string, string]] + + console.log(nameMA); +>console.log(nameMA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameMA : string +} + +for ([numberA3, ...robotAInfo] of robots) { +>[numberA3, ...robotAInfo] : (number | string)[] +>numberA3 : number +>...robotAInfo : number | string +>robotAInfo : (number | string)[] +>robots : [number, string, string][] + + console.log(numberA3); +>console.log(numberA3) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>numberA3 : number +} +for ([numberA3, ...robotAInfo] of getRobots()) { +>[numberA3, ...robotAInfo] : (number | string)[] +>numberA3 : number +>...robotAInfo : number | string +>robotAInfo : (number | string)[] +>getRobots() : [number, string, string][] +>getRobots : () => [number, string, string][] + + console.log(numberA3); +>console.log(numberA3) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>numberA3 : number +} +for ([numberA3, ...robotAInfo] of [robotA, robotB]) { +>[numberA3, ...robotAInfo] : (number | string)[] +>numberA3 : number +>...robotAInfo : number | string +>robotAInfo : (number | string)[] +>[robotA, robotB] : [number, string, string][] +>robotA : [number, string, string] +>robotB : [number, string, string] + + console.log(numberA3); +>console.log(numberA3) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>numberA3 : number +} +for ([...multiRobotAInfo] of multiRobots) { +>[...multiRobotAInfo] : (string | [string, string])[] +>...multiRobotAInfo : string | [string, string] +>multiRobotAInfo : (string | [string, string])[] +>multiRobots : [string, [string, string]][] + + console.log(multiRobotAInfo); +>console.log(multiRobotAInfo) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>multiRobotAInfo : (string | [string, string])[] +} +for ([...multiRobotAInfo] of getMultiRobots()) { +>[...multiRobotAInfo] : (string | [string, string])[] +>...multiRobotAInfo : string | [string, string] +>multiRobotAInfo : (string | [string, string])[] +>getMultiRobots() : [string, [string, string]][] +>getMultiRobots : () => [string, [string, string]][] + + console.log(multiRobotAInfo); +>console.log(multiRobotAInfo) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>multiRobotAInfo : (string | [string, string])[] +} +for ([...multiRobotAInfo] of [multiRobotA, multiRobotB]) { +>[...multiRobotAInfo] : (string | [string, string])[] +>...multiRobotAInfo : string | [string, string] +>multiRobotAInfo : (string | [string, string])[] +>[multiRobotA, multiRobotB] : [string, [string, string]][] +>multiRobotA : [string, [string, string]] +>multiRobotB : [string, [string, string]] + + console.log(multiRobotAInfo); +>console.log(multiRobotAInfo) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>multiRobotAInfo : (string | [string, string])[] +} diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.js b/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.js new file mode 100644 index 00000000000..ff692af87f2 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.js @@ -0,0 +1,204 @@ +//// [sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts] +declare var console: { + log(msg: any): void; +} +type Robot = [number, string, string]; +type MultiSkilledRobot = [string, [string, string]]; + +let robotA: Robot = [1, "mower", "mowing"]; +let robotB: Robot = [2, "trimmer", "trimming"]; +let robots = [robotA, robotB]; +function getRobots() { + return robots; +} + +let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; +let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; +let multiRobots = [multiRobotA, multiRobotB]; +function getMultiRobots() { + return multiRobots; +} + +for (let [, nameA = "noName"] of robots) { + console.log(nameA); +} +for (let [, nameA = "noName"] of getRobots()) { + console.log(nameA); +} +for (let [, nameA = "noName"] of [robotA, robotB]) { + console.log(nameA); +} +for (let [, [ + primarySkillA = "primary", + secondarySkillA = "secondary" +] = ["skill1", "skill2"]] of multiRobots) { + console.log(primarySkillA); +} +for (let [, [ + primarySkillA = "primary", + secondarySkillA = "secondary" +] = ["skill1", "skill2"]] of getMultiRobots()) { + console.log(primarySkillA); +} +for (let [, [ + primarySkillA = "primary", + secondarySkillA = "secondary" +] = ["skill1", "skill2"]] of [multiRobotA, multiRobotB]) { + console.log(primarySkillA); +} + +for (let [numberB = -1] of robots) { + console.log(numberB); +} +for (let [numberB = -1] of getRobots()) { + console.log(numberB); +} +for (let [numberB = -1] of [robotA, robotB]) { + console.log(numberB); +} +for (let [nameB = "noName"] of multiRobots) { + console.log(nameB); +} +for (let [nameB = "noName"] of getMultiRobots()) { + console.log(nameB); +} +for (let [nameB = "noName"] of [multiRobotA, multiRobotB]) { + console.log(nameB); +} + +for (let [numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of robots) { + console.log(nameA2); +} +for (let [numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of getRobots()) { + console.log(nameA2); +} +for (let [numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of [robotA, robotB]) { + console.log(nameA2); +} +for (let [nameMA = "noName", [ + primarySkillA = "primary", + secondarySkillA = "secondary" +] = ["skill1", "skill2"]] of multiRobots) { + console.log(nameMA); +} +for (let [nameMA = "noName", [ + primarySkillA = "primary", + secondarySkillA = "secondary" +] = ["skill1", "skill2"]] of getMultiRobots()) { + console.log(nameMA); +} +for (let [nameMA = "noName", [ + primarySkillA = "primary", + secondarySkillA = "secondary" +] = ["skill1", "skill2"]] of [multiRobotA, multiRobotB]) { + console.log(nameMA); +} + +for (let [numberA3 = -1, ...robotAInfo] of robots) { + console.log(numberA3); +} +for (let [numberA3 = -1, ...robotAInfo] of getRobots()) { + console.log(numberA3); +} +for (let [numberA3 = -1, ...robotAInfo] of [robotA, robotB]) { + console.log(numberA3); +} + +//// [sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.js] +var robotA = [1, "mower", "mowing"]; +var robotB = [2, "trimmer", "trimming"]; +var robots = [robotA, robotB]; +function getRobots() { + return robots; +} +var multiRobotA = ["mower", ["mowing", ""]]; +var multiRobotB = ["trimmer", ["trimming", "edging"]]; +var multiRobots = [multiRobotA, multiRobotB]; +function getMultiRobots() { + return multiRobots; +} +for (var _i = 0, robots_1 = robots; _i < robots_1.length; _i++) { + var _a = robots_1[_i], _b = _a[1], nameA = _b === void 0 ? "noName" : _b; + console.log(nameA); +} +for (var _c = 0, _d = getRobots(); _c < _d.length; _c++) { + var _e = _d[_c], _f = _e[1], nameA = _f === void 0 ? "noName" : _f; + console.log(nameA); +} +for (var _g = 0, _h = [robotA, robotB]; _g < _h.length; _g++) { + var _j = _h[_g], _k = _j[1], nameA = _k === void 0 ? "noName" : _k; + console.log(nameA); +} +for (var _l = 0, multiRobots_1 = multiRobots; _l < multiRobots_1.length; _l++) { + var _m = multiRobots_1[_l], _o = _m[1], _p = _o === void 0 ? ["skill1", "skill2"] : _o, _q = _p[0], primarySkillA = _q === void 0 ? "primary" : _q, _r = _p[1], secondarySkillA = _r === void 0 ? "secondary" : _r; + console.log(primarySkillA); +} +for (var _s = 0, _t = getMultiRobots(); _s < _t.length; _s++) { + var _u = _t[_s], _v = _u[1], _w = _v === void 0 ? ["skill1", "skill2"] : _v, _x = _w[0], primarySkillA = _x === void 0 ? "primary" : _x, _y = _w[1], secondarySkillA = _y === void 0 ? "secondary" : _y; + console.log(primarySkillA); +} +for (var _z = 0, _0 = [multiRobotA, multiRobotB]; _z < _0.length; _z++) { + var _1 = _0[_z], _2 = _1[1], _3 = _2 === void 0 ? ["skill1", "skill2"] : _2, _4 = _3[0], primarySkillA = _4 === void 0 ? "primary" : _4, _5 = _3[1], secondarySkillA = _5 === void 0 ? "secondary" : _5; + console.log(primarySkillA); +} +for (var _6 = 0, robots_2 = robots; _6 < robots_2.length; _6++) { + var _7 = robots_2[_6][0], numberB = _7 === void 0 ? -1 : _7; + console.log(numberB); +} +for (var _8 = 0, _9 = getRobots(); _8 < _9.length; _8++) { + var _10 = _9[_8][0], numberB = _10 === void 0 ? -1 : _10; + console.log(numberB); +} +for (var _11 = 0, _12 = [robotA, robotB]; _11 < _12.length; _11++) { + var _13 = _12[_11][0], numberB = _13 === void 0 ? -1 : _13; + console.log(numberB); +} +for (var _14 = 0, multiRobots_2 = multiRobots; _14 < multiRobots_2.length; _14++) { + var _15 = multiRobots_2[_14][0], nameB = _15 === void 0 ? "noName" : _15; + console.log(nameB); +} +for (var _16 = 0, _17 = getMultiRobots(); _16 < _17.length; _16++) { + var _18 = _17[_16][0], nameB = _18 === void 0 ? "noName" : _18; + console.log(nameB); +} +for (var _19 = 0, _20 = [multiRobotA, multiRobotB]; _19 < _20.length; _19++) { + var _21 = _20[_19][0], nameB = _21 === void 0 ? "noName" : _21; + console.log(nameB); +} +for (var _22 = 0, robots_3 = robots; _22 < robots_3.length; _22++) { + var _23 = robots_3[_22], _24 = _23[0], numberA2 = _24 === void 0 ? -1 : _24, _25 = _23[1], nameA2 = _25 === void 0 ? "noName" : _25, _26 = _23[2], skillA2 = _26 === void 0 ? "skill" : _26; + console.log(nameA2); +} +for (var _27 = 0, _28 = getRobots(); _27 < _28.length; _27++) { + var _29 = _28[_27], _30 = _29[0], numberA2 = _30 === void 0 ? -1 : _30, _31 = _29[1], nameA2 = _31 === void 0 ? "noName" : _31, _32 = _29[2], skillA2 = _32 === void 0 ? "skill" : _32; + console.log(nameA2); +} +for (var _33 = 0, _34 = [robotA, robotB]; _33 < _34.length; _33++) { + var _35 = _34[_33], _36 = _35[0], numberA2 = _36 === void 0 ? -1 : _36, _37 = _35[1], nameA2 = _37 === void 0 ? "noName" : _37, _38 = _35[2], skillA2 = _38 === void 0 ? "skill" : _38; + console.log(nameA2); +} +for (var _39 = 0, multiRobots_3 = multiRobots; _39 < multiRobots_3.length; _39++) { + var _40 = multiRobots_3[_39], _41 = _40[0], nameMA = _41 === void 0 ? "noName" : _41, _42 = _40[1], _43 = _42 === void 0 ? ["skill1", "skill2"] : _42, _44 = _43[0], primarySkillA = _44 === void 0 ? "primary" : _44, _45 = _43[1], secondarySkillA = _45 === void 0 ? "secondary" : _45; + console.log(nameMA); +} +for (var _46 = 0, _47 = getMultiRobots(); _46 < _47.length; _46++) { + var _48 = _47[_46], _49 = _48[0], nameMA = _49 === void 0 ? "noName" : _49, _50 = _48[1], _51 = _50 === void 0 ? ["skill1", "skill2"] : _50, _52 = _51[0], primarySkillA = _52 === void 0 ? "primary" : _52, _53 = _51[1], secondarySkillA = _53 === void 0 ? "secondary" : _53; + console.log(nameMA); +} +for (var _54 = 0, _55 = [multiRobotA, multiRobotB]; _54 < _55.length; _54++) { + var _56 = _55[_54], _57 = _56[0], nameMA = _57 === void 0 ? "noName" : _57, _58 = _56[1], _59 = _58 === void 0 ? ["skill1", "skill2"] : _58, _60 = _59[0], primarySkillA = _60 === void 0 ? "primary" : _60, _61 = _59[1], secondarySkillA = _61 === void 0 ? "secondary" : _61; + console.log(nameMA); +} +for (var _62 = 0, robots_4 = robots; _62 < robots_4.length; _62++) { + var _63 = robots_4[_62], _64 = _63[0], numberA3 = _64 === void 0 ? -1 : _64, robotAInfo = _63.slice(1); + console.log(numberA3); +} +for (var _65 = 0, _66 = getRobots(); _65 < _66.length; _65++) { + var _67 = _66[_65], _68 = _67[0], numberA3 = _68 === void 0 ? -1 : _68, robotAInfo = _67.slice(1); + console.log(numberA3); +} +for (var _69 = 0, _70 = [robotA, robotB]; _69 < _70.length; _69++) { + var _71 = _70[_69], _72 = _71[0], numberA3 = _72 === void 0 ? -1 : _72, robotAInfo = _71.slice(1); + console.log(numberA3); +} +//# sourceMappingURL=sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.js.map b/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.js.map new file mode 100644 index 00000000000..4d12f811df1 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.js.map @@ -0,0 +1,2 @@ +//// [sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.js.map] +{"version":3,"file":"sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.js","sourceRoot":"","sources":["sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts"],"names":[],"mappings":"AAMA,IAAI,MAAM,GAAU,CAAC,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;AAC3C,IAAI,MAAM,GAAU,CAAC,CAAC,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;AAC/C,IAAI,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAC9B;IACI,MAAM,CAAC,MAAM,CAAC;AAClB,CAAC;AAED,IAAI,WAAW,GAAsB,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC;AAC/D,IAAI,WAAW,GAAsB,CAAC,SAAS,EAAE,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC,CAAC;AACzE,IAAI,WAAW,GAAG,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;AAC7C;IACI,MAAM,CAAC,WAAW,CAAC;AACvB,CAAC;AAED,GAAG,CAAC,CAA6B,UAAM,EAAN,iBAAM,EAAN,oBAAM,EAAN,IAAM,CAAC;IAAnC,qBAAwB,EAAjB,UAAgB,EAAhB,qCAAgB;IACxB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB;AACD,GAAG,CAAC,CAA6B,UAAW,EAAX,KAAA,SAAS,EAAE,EAAX,cAAW,EAAX,IAAW,CAAC;IAAxC,eAAwB,EAAjB,UAAgB,EAAhB,qCAAgB;IACxB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB;AACD,GAAG,CAAC,CAA6B,UAAgB,EAAhB,MAAC,MAAM,EAAE,MAAM,CAAC,EAAhB,cAAgB,EAAhB,IAAgB,CAAC;IAA7C,eAAwB,EAAjB,UAAgB,EAAhB,qCAAgB;IACxB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB;AACD,GAAG,CAAC,CAGyB,UAAW,EAAX,2BAAW,EAAX,yBAAW,EAAX,IAAW,CAAC;IAHpC,0BAGoB,EAHb,UAGY,EAHZ,8CAGY,EAFpB,UAAyB,EAAzB,8CAAyB,EACzB,UAA6B,EAA7B,kDAA6B;IAE7B,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;CAC9B;AACD,GAAG,CAAC,CAGyB,UAAgB,EAAhB,KAAA,cAAc,EAAE,EAAhB,cAAgB,EAAhB,IAAgB,CAAC;IAHzC,eAGoB,EAHb,UAGY,EAHZ,8CAGY,EAFpB,UAAyB,EAAzB,8CAAyB,EACzB,UAA6B,EAA7B,kDAA6B;IAE7B,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;CAC9B;AACD,GAAG,CAAC,CAGyB,UAA0B,EAA1B,MAAC,WAAW,EAAE,WAAW,CAAC,EAA1B,cAA0B,EAA1B,IAA0B,CAAC;IAHnD,eAGoB,EAHb,UAGY,EAHZ,8CAGY,EAFpB,UAAyB,EAAzB,8CAAyB,EACzB,UAA6B,EAA7B,kDAA6B;IAE7B,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;CAC9B;AAED,GAAG,CAAC,CAAuB,UAAM,EAAN,iBAAM,EAAN,oBAAM,EAAN,IAAM,CAAC;IAAxB,wBAAY,EAAZ,iCAAY;IAClB,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;CACxB;AACD,GAAG,CAAC,CAAuB,UAAW,EAAX,KAAA,SAAS,EAAE,EAAX,cAAW,EAAX,IAAW,CAAC;IAA7B,mBAAY,EAAZ,mCAAY;IAClB,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;CACxB;AACD,GAAG,CAAC,CAAuB,WAAgB,EAAhB,OAAC,MAAM,EAAE,MAAM,CAAC,EAAhB,gBAAgB,EAAhB,KAAgB,CAAC;IAAlC,qBAAY,EAAZ,mCAAY;IAClB,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;CACxB;AACD,GAAG,CAAC,CAA2B,WAAW,EAAX,2BAAW,EAAX,0BAAW,EAAX,KAAW,CAAC;IAAjC,+BAAgB,EAAhB,uCAAgB;IACtB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB;AACD,GAAG,CAAC,CAA2B,WAAgB,EAAhB,MAAA,cAAc,EAAE,EAAhB,gBAAgB,EAAhB,KAAgB,CAAC;IAAtC,qBAAgB,EAAhB,uCAAgB;IACtB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB;AACD,GAAG,CAAC,CAA2B,WAA0B,EAA1B,OAAC,WAAW,EAAE,WAAW,CAAC,EAA1B,gBAA0B,EAA1B,KAA0B,CAAC;IAAhD,qBAAgB,EAAhB,uCAAgB;IACtB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB;AAED,GAAG,CAAC,CAA8D,WAAM,EAAN,iBAAM,EAAN,qBAAM,EAAN,KAAM,CAAC;IAApE,uBAAyD,EAApD,YAAa,EAAb,oCAAa,EAAE,YAAiB,EAAjB,wCAAiB,EAAE,YAAiB,EAAjB,wCAAiB;IACzD,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;CACvB;AACD,GAAG,CAAC,CAA8D,WAAW,EAAX,MAAA,SAAS,EAAE,EAAX,gBAAW,EAAX,KAAW,CAAC;IAAzE,kBAAyD,EAApD,YAAa,EAAb,oCAAa,EAAE,YAAiB,EAAjB,wCAAiB,EAAE,YAAiB,EAAjB,wCAAiB;IACzD,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;CACvB;AACD,GAAG,CAAC,CAA8D,WAAgB,EAAhB,OAAC,MAAM,EAAE,MAAM,CAAC,EAAhB,gBAAgB,EAAhB,KAAgB,CAAC;IAA9E,kBAAyD,EAApD,YAAa,EAAb,oCAAa,EAAE,YAAiB,EAAjB,wCAAiB,EAAE,YAAiB,EAAjB,wCAAiB;IACzD,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;CACvB;AACD,GAAG,CAAC,CAGyB,WAAW,EAAX,2BAAW,EAAX,0BAAW,EAAX,KAAW,CAAC;IAHpC,4BAGoB,EAHf,YAAiB,EAAjB,wCAAiB,EAAE,YAGL,EAHK,iDAGL,EAFpB,YAAyB,EAAzB,gDAAyB,EACzB,YAA6B,EAA7B,oDAA6B;IAE7B,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;CACvB;AACD,GAAG,CAAC,CAGyB,WAAgB,EAAhB,MAAA,cAAc,EAAE,EAAhB,gBAAgB,EAAhB,KAAgB,CAAC;IAHzC,kBAGoB,EAHf,YAAiB,EAAjB,wCAAiB,EAAE,YAGL,EAHK,iDAGL,EAFpB,YAAyB,EAAzB,gDAAyB,EACzB,YAA6B,EAA7B,oDAA6B;IAE7B,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;CACvB;AACD,GAAG,CAAC,CAGyB,WAA0B,EAA1B,OAAC,WAAW,EAAE,WAAW,CAAC,EAA1B,gBAA0B,EAA1B,KAA0B,CAAC;IAHnD,kBAGoB,EAHf,YAAiB,EAAjB,wCAAiB,EAAE,YAGL,EAHK,iDAGL,EAFpB,YAAyB,EAAzB,gDAAyB,EACzB,YAA6B,EAA7B,oDAA6B;IAE7B,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;CACvB;AAED,GAAG,CAAC,CAAuC,WAAM,EAAN,iBAAM,EAAN,qBAAM,EAAN,KAAM,CAAC;IAA7C,uBAAkC,EAA7B,YAAa,EAAb,oCAAa,EAAE,yBAAa;IAClC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;CACzB;AACD,GAAG,CAAC,CAAuC,WAAW,EAAX,MAAA,SAAS,EAAE,EAAX,gBAAW,EAAX,KAAW,CAAC;IAAlD,kBAAkC,EAA7B,YAAa,EAAb,oCAAa,EAAE,yBAAa;IAClC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;CACzB;AACD,GAAG,CAAC,CAAuC,WAAgB,EAAhB,OAAC,MAAM,EAAE,MAAM,CAAC,EAAhB,gBAAgB,EAAhB,KAAgB,CAAC;IAAvD,kBAAkC,EAA7B,YAAa,EAAb,oCAAa,EAAE,yBAAa;IAClC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;CACzB"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.sourcemap.txt b/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.sourcemap.txt new file mode 100644 index 00000000000..de9a60de903 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.sourcemap.txt @@ -0,0 +1,2742 @@ +=================================================================== +JsFile: sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.js +mapUrl: sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.js.map +sourceRoot: +sources: sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.js +sourceFile:sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts +------------------------------------------------------------------- +>>>var robotA = [1, "mower", "mowing"]; +1 > +2 >^^^^ +3 > ^^^^^^ +4 > ^^^ +5 > ^ +6 > ^ +7 > ^^ +8 > ^^^^^^^ +9 > ^^ +10> ^^^^^^^^ +11> ^ +12> ^ +13> ^^^^^-> +1 >declare var console: { + > log(msg: any): void; + >} + >type Robot = [number, string, string]; + >type MultiSkilledRobot = [string, [string, string]]; + > + > +2 >let +3 > robotA +4 > : Robot = +5 > [ +6 > 1 +7 > , +8 > "mower" +9 > , +10> "mowing" +11> ] +12> ; +1 >Emitted(1, 1) Source(7, 1) + SourceIndex(0) +2 >Emitted(1, 5) Source(7, 5) + SourceIndex(0) +3 >Emitted(1, 11) Source(7, 11) + SourceIndex(0) +4 >Emitted(1, 14) Source(7, 21) + SourceIndex(0) +5 >Emitted(1, 15) Source(7, 22) + SourceIndex(0) +6 >Emitted(1, 16) Source(7, 23) + SourceIndex(0) +7 >Emitted(1, 18) Source(7, 25) + SourceIndex(0) +8 >Emitted(1, 25) Source(7, 32) + SourceIndex(0) +9 >Emitted(1, 27) Source(7, 34) + SourceIndex(0) +10>Emitted(1, 35) Source(7, 42) + SourceIndex(0) +11>Emitted(1, 36) Source(7, 43) + SourceIndex(0) +12>Emitted(1, 37) Source(7, 44) + SourceIndex(0) +--- +>>>var robotB = [2, "trimmer", "trimming"]; +1-> +2 >^^^^ +3 > ^^^^^^ +4 > ^^^ +5 > ^ +6 > ^ +7 > ^^ +8 > ^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^ +11> ^ +12> ^ +1-> + > +2 >let +3 > robotB +4 > : Robot = +5 > [ +6 > 2 +7 > , +8 > "trimmer" +9 > , +10> "trimming" +11> ] +12> ; +1->Emitted(2, 1) Source(8, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(8, 5) + SourceIndex(0) +3 >Emitted(2, 11) Source(8, 11) + SourceIndex(0) +4 >Emitted(2, 14) Source(8, 21) + SourceIndex(0) +5 >Emitted(2, 15) Source(8, 22) + SourceIndex(0) +6 >Emitted(2, 16) Source(8, 23) + SourceIndex(0) +7 >Emitted(2, 18) Source(8, 25) + SourceIndex(0) +8 >Emitted(2, 27) Source(8, 34) + SourceIndex(0) +9 >Emitted(2, 29) Source(8, 36) + SourceIndex(0) +10>Emitted(2, 39) Source(8, 46) + SourceIndex(0) +11>Emitted(2, 40) Source(8, 47) + SourceIndex(0) +12>Emitted(2, 41) Source(8, 48) + SourceIndex(0) +--- +>>>var robots = [robotA, robotB]; +1 > +2 >^^^^ +3 > ^^^^^^ +4 > ^^^ +5 > ^ +6 > ^^^^^^ +7 > ^^ +8 > ^^^^^^ +9 > ^ +10> ^ +1 > + > +2 >let +3 > robots +4 > = +5 > [ +6 > robotA +7 > , +8 > robotB +9 > ] +10> ; +1 >Emitted(3, 1) Source(9, 1) + SourceIndex(0) +2 >Emitted(3, 5) Source(9, 5) + SourceIndex(0) +3 >Emitted(3, 11) Source(9, 11) + SourceIndex(0) +4 >Emitted(3, 14) Source(9, 14) + SourceIndex(0) +5 >Emitted(3, 15) Source(9, 15) + SourceIndex(0) +6 >Emitted(3, 21) Source(9, 21) + SourceIndex(0) +7 >Emitted(3, 23) Source(9, 23) + SourceIndex(0) +8 >Emitted(3, 29) Source(9, 29) + SourceIndex(0) +9 >Emitted(3, 30) Source(9, 30) + SourceIndex(0) +10>Emitted(3, 31) Source(9, 31) + SourceIndex(0) +--- +>>>function getRobots() { +1 > +2 >^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(4, 1) Source(10, 1) + SourceIndex(0) +--- +>>> return robots; +1->^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^ +5 > ^ +1->function getRobots() { + > +2 > return +3 > +4 > robots +5 > ; +1->Emitted(5, 5) Source(11, 5) + SourceIndex(0) +2 >Emitted(5, 11) Source(11, 11) + SourceIndex(0) +3 >Emitted(5, 12) Source(11, 12) + SourceIndex(0) +4 >Emitted(5, 18) Source(11, 18) + SourceIndex(0) +5 >Emitted(5, 19) Source(11, 19) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(6, 1) Source(12, 1) + SourceIndex(0) +2 >Emitted(6, 2) Source(12, 2) + SourceIndex(0) +--- +>>>var multiRobotA = ["mower", ["mowing", ""]]; +1-> +2 >^^^^ +3 > ^^^^^^^^^^^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^ +7 > ^^ +8 > ^ +9 > ^^^^^^^^ +10> ^^ +11> ^^ +12> ^ +13> ^ +14> ^ +15> ^^^^^^^^^^^-> +1-> + > + > +2 >let +3 > multiRobotA +4 > : MultiSkilledRobot = +5 > [ +6 > "mower" +7 > , +8 > [ +9 > "mowing" +10> , +11> "" +12> ] +13> ] +14> ; +1->Emitted(7, 1) Source(14, 1) + SourceIndex(0) +2 >Emitted(7, 5) Source(14, 5) + SourceIndex(0) +3 >Emitted(7, 16) Source(14, 16) + SourceIndex(0) +4 >Emitted(7, 19) Source(14, 38) + SourceIndex(0) +5 >Emitted(7, 20) Source(14, 39) + SourceIndex(0) +6 >Emitted(7, 27) Source(14, 46) + SourceIndex(0) +7 >Emitted(7, 29) Source(14, 48) + SourceIndex(0) +8 >Emitted(7, 30) Source(14, 49) + SourceIndex(0) +9 >Emitted(7, 38) Source(14, 57) + SourceIndex(0) +10>Emitted(7, 40) Source(14, 59) + SourceIndex(0) +11>Emitted(7, 42) Source(14, 61) + SourceIndex(0) +12>Emitted(7, 43) Source(14, 62) + SourceIndex(0) +13>Emitted(7, 44) Source(14, 63) + SourceIndex(0) +14>Emitted(7, 45) Source(14, 64) + SourceIndex(0) +--- +>>>var multiRobotB = ["trimmer", ["trimming", "edging"]]; +1-> +2 >^^^^ +3 > ^^^^^^^^^^^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^^ +7 > ^^ +8 > ^ +9 > ^^^^^^^^^^ +10> ^^ +11> ^^^^^^^^ +12> ^ +13> ^ +14> ^ +1-> + > +2 >let +3 > multiRobotB +4 > : MultiSkilledRobot = +5 > [ +6 > "trimmer" +7 > , +8 > [ +9 > "trimming" +10> , +11> "edging" +12> ] +13> ] +14> ; +1->Emitted(8, 1) Source(15, 1) + SourceIndex(0) +2 >Emitted(8, 5) Source(15, 5) + SourceIndex(0) +3 >Emitted(8, 16) Source(15, 16) + SourceIndex(0) +4 >Emitted(8, 19) Source(15, 38) + SourceIndex(0) +5 >Emitted(8, 20) Source(15, 39) + SourceIndex(0) +6 >Emitted(8, 29) Source(15, 48) + SourceIndex(0) +7 >Emitted(8, 31) Source(15, 50) + SourceIndex(0) +8 >Emitted(8, 32) Source(15, 51) + SourceIndex(0) +9 >Emitted(8, 42) Source(15, 61) + SourceIndex(0) +10>Emitted(8, 44) Source(15, 63) + SourceIndex(0) +11>Emitted(8, 52) Source(15, 71) + SourceIndex(0) +12>Emitted(8, 53) Source(15, 72) + SourceIndex(0) +13>Emitted(8, 54) Source(15, 73) + SourceIndex(0) +14>Emitted(8, 55) Source(15, 74) + SourceIndex(0) +--- +>>>var multiRobots = [multiRobotA, multiRobotB]; +1 > +2 >^^^^ +3 > ^^^^^^^^^^^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^ +9 > ^ +10> ^ +1 > + > +2 >let +3 > multiRobots +4 > = +5 > [ +6 > multiRobotA +7 > , +8 > multiRobotB +9 > ] +10> ; +1 >Emitted(9, 1) Source(16, 1) + SourceIndex(0) +2 >Emitted(9, 5) Source(16, 5) + SourceIndex(0) +3 >Emitted(9, 16) Source(16, 16) + SourceIndex(0) +4 >Emitted(9, 19) Source(16, 19) + SourceIndex(0) +5 >Emitted(9, 20) Source(16, 20) + SourceIndex(0) +6 >Emitted(9, 31) Source(16, 31) + SourceIndex(0) +7 >Emitted(9, 33) Source(16, 33) + SourceIndex(0) +8 >Emitted(9, 44) Source(16, 44) + SourceIndex(0) +9 >Emitted(9, 45) Source(16, 45) + SourceIndex(0) +10>Emitted(9, 46) Source(16, 46) + SourceIndex(0) +--- +>>>function getMultiRobots() { +1 > +2 >^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(10, 1) Source(17, 1) + SourceIndex(0) +--- +>>> return multiRobots; +1->^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^ +5 > ^ +1->function getMultiRobots() { + > +2 > return +3 > +4 > multiRobots +5 > ; +1->Emitted(11, 5) Source(18, 5) + SourceIndex(0) +2 >Emitted(11, 11) Source(18, 11) + SourceIndex(0) +3 >Emitted(11, 12) Source(18, 12) + SourceIndex(0) +4 >Emitted(11, 23) Source(18, 23) + SourceIndex(0) +5 >Emitted(11, 24) Source(18, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(12, 1) Source(19, 1) + SourceIndex(0) +2 >Emitted(12, 2) Source(19, 2) + SourceIndex(0) +--- +>>>for (var _i = 0, robots_1 = robots; _i < robots_1.length; _i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^^^^^^ +10> ^^ +11> ^^^^ +12> ^ +13> ^^^^^^^^^^^^^^^-> +1-> + > + > +2 >for +3 > +4 > (let [, nameA = "noName"] of +5 > robots +6 > +7 > robots +8 > +9 > robots +10> +11> robots +12> ) +1->Emitted(13, 1) Source(21, 1) + SourceIndex(0) +2 >Emitted(13, 4) Source(21, 4) + SourceIndex(0) +3 >Emitted(13, 5) Source(21, 5) + SourceIndex(0) +4 >Emitted(13, 6) Source(21, 34) + SourceIndex(0) +5 >Emitted(13, 16) Source(21, 40) + SourceIndex(0) +6 >Emitted(13, 18) Source(21, 34) + SourceIndex(0) +7 >Emitted(13, 35) Source(21, 40) + SourceIndex(0) +8 >Emitted(13, 37) Source(21, 34) + SourceIndex(0) +9 >Emitted(13, 57) Source(21, 40) + SourceIndex(0) +10>Emitted(13, 59) Source(21, 34) + SourceIndex(0) +11>Emitted(13, 63) Source(21, 40) + SourceIndex(0) +12>Emitted(13, 64) Source(21, 41) + SourceIndex(0) +--- +>>> var _a = robots_1[_i], _b = _a[1], nameA = _b === void 0 ? "noName" : _b; +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > let [, nameA = "noName"] +3 > +4 > nameA = "noName" +5 > +6 > nameA = "noName" +1->Emitted(14, 5) Source(21, 6) + SourceIndex(0) +2 >Emitted(14, 26) Source(21, 30) + SourceIndex(0) +3 >Emitted(14, 28) Source(21, 13) + SourceIndex(0) +4 >Emitted(14, 38) Source(21, 29) + SourceIndex(0) +5 >Emitted(14, 40) Source(21, 13) + SourceIndex(0) +6 >Emitted(14, 77) Source(21, 29) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 >] of robots) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(15, 5) Source(22, 5) + SourceIndex(0) +2 >Emitted(15, 12) Source(22, 12) + SourceIndex(0) +3 >Emitted(15, 13) Source(22, 13) + SourceIndex(0) +4 >Emitted(15, 16) Source(22, 16) + SourceIndex(0) +5 >Emitted(15, 17) Source(22, 17) + SourceIndex(0) +6 >Emitted(15, 22) Source(22, 22) + SourceIndex(0) +7 >Emitted(15, 23) Source(22, 23) + SourceIndex(0) +8 >Emitted(15, 24) Source(22, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(16, 2) Source(23, 2) + SourceIndex(0) +--- +>>>for (var _c = 0, _d = getRobots(); _c < _d.length; _c++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^ +8 > ^^^^^^^^^ +9 > ^^ +10> ^^ +11> ^^^^^^^^^^^^^^ +12> ^^ +13> ^^^^ +14> ^ +15> ^^^^^^^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > (let [, nameA = "noName"] of +5 > getRobots() +6 > +7 > +8 > getRobots +9 > () +10> +11> getRobots() +12> +13> getRobots() +14> ) +1->Emitted(17, 1) Source(24, 1) + SourceIndex(0) +2 >Emitted(17, 4) Source(24, 4) + SourceIndex(0) +3 >Emitted(17, 5) Source(24, 5) + SourceIndex(0) +4 >Emitted(17, 6) Source(24, 34) + SourceIndex(0) +5 >Emitted(17, 16) Source(24, 45) + SourceIndex(0) +6 >Emitted(17, 18) Source(24, 34) + SourceIndex(0) +7 >Emitted(17, 23) Source(24, 34) + SourceIndex(0) +8 >Emitted(17, 32) Source(24, 43) + SourceIndex(0) +9 >Emitted(17, 34) Source(24, 45) + SourceIndex(0) +10>Emitted(17, 36) Source(24, 34) + SourceIndex(0) +11>Emitted(17, 50) Source(24, 45) + SourceIndex(0) +12>Emitted(17, 52) Source(24, 34) + SourceIndex(0) +13>Emitted(17, 56) Source(24, 45) + SourceIndex(0) +14>Emitted(17, 57) Source(24, 46) + SourceIndex(0) +--- +>>> var _e = _d[_c], _f = _e[1], nameA = _f === void 0 ? "noName" : _f; +1->^^^^ +2 > ^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > let [, nameA = "noName"] +3 > +4 > nameA = "noName" +5 > +6 > nameA = "noName" +1->Emitted(18, 5) Source(24, 6) + SourceIndex(0) +2 >Emitted(18, 20) Source(24, 30) + SourceIndex(0) +3 >Emitted(18, 22) Source(24, 13) + SourceIndex(0) +4 >Emitted(18, 32) Source(24, 29) + SourceIndex(0) +5 >Emitted(18, 34) Source(24, 13) + SourceIndex(0) +6 >Emitted(18, 71) Source(24, 29) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 >] of getRobots()) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(19, 5) Source(25, 5) + SourceIndex(0) +2 >Emitted(19, 12) Source(25, 12) + SourceIndex(0) +3 >Emitted(19, 13) Source(25, 13) + SourceIndex(0) +4 >Emitted(19, 16) Source(25, 16) + SourceIndex(0) +5 >Emitted(19, 17) Source(25, 17) + SourceIndex(0) +6 >Emitted(19, 22) Source(25, 22) + SourceIndex(0) +7 >Emitted(19, 23) Source(25, 23) + SourceIndex(0) +8 >Emitted(19, 24) Source(25, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(20, 2) Source(26, 2) + SourceIndex(0) +--- +>>>for (var _g = 0, _h = [robotA, robotB]; _g < _h.length; _g++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^ +8 > ^^^^^^ +9 > ^^ +10> ^^^^^^ +11> ^ +12> ^^ +13> ^^^^^^^^^^^^^^ +14> ^^ +15> ^^^^ +16> ^ +17> ^^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > (let [, nameA = "noName"] of +5 > [robotA, robotB] +6 > +7 > [ +8 > robotA +9 > , +10> robotB +11> ] +12> +13> [robotA, robotB] +14> +15> [robotA, robotB] +16> ) +1->Emitted(21, 1) Source(27, 1) + SourceIndex(0) +2 >Emitted(21, 4) Source(27, 4) + SourceIndex(0) +3 >Emitted(21, 5) Source(27, 5) + SourceIndex(0) +4 >Emitted(21, 6) Source(27, 34) + SourceIndex(0) +5 >Emitted(21, 16) Source(27, 50) + SourceIndex(0) +6 >Emitted(21, 18) Source(27, 34) + SourceIndex(0) +7 >Emitted(21, 24) Source(27, 35) + SourceIndex(0) +8 >Emitted(21, 30) Source(27, 41) + SourceIndex(0) +9 >Emitted(21, 32) Source(27, 43) + SourceIndex(0) +10>Emitted(21, 38) Source(27, 49) + SourceIndex(0) +11>Emitted(21, 39) Source(27, 50) + SourceIndex(0) +12>Emitted(21, 41) Source(27, 34) + SourceIndex(0) +13>Emitted(21, 55) Source(27, 50) + SourceIndex(0) +14>Emitted(21, 57) Source(27, 34) + SourceIndex(0) +15>Emitted(21, 61) Source(27, 50) + SourceIndex(0) +16>Emitted(21, 62) Source(27, 51) + SourceIndex(0) +--- +>>> var _j = _h[_g], _k = _j[1], nameA = _k === void 0 ? "noName" : _k; +1->^^^^ +2 > ^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > let [, nameA = "noName"] +3 > +4 > nameA = "noName" +5 > +6 > nameA = "noName" +1->Emitted(22, 5) Source(27, 6) + SourceIndex(0) +2 >Emitted(22, 20) Source(27, 30) + SourceIndex(0) +3 >Emitted(22, 22) Source(27, 13) + SourceIndex(0) +4 >Emitted(22, 32) Source(27, 29) + SourceIndex(0) +5 >Emitted(22, 34) Source(27, 13) + SourceIndex(0) +6 >Emitted(22, 71) Source(27, 29) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 >] of [robotA, robotB]) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(23, 5) Source(28, 5) + SourceIndex(0) +2 >Emitted(23, 12) Source(28, 12) + SourceIndex(0) +3 >Emitted(23, 13) Source(28, 13) + SourceIndex(0) +4 >Emitted(23, 16) Source(28, 16) + SourceIndex(0) +5 >Emitted(23, 17) Source(28, 17) + SourceIndex(0) +6 >Emitted(23, 22) Source(28, 22) + SourceIndex(0) +7 >Emitted(23, 23) Source(28, 23) + SourceIndex(0) +8 >Emitted(23, 24) Source(28, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(24, 2) Source(29, 2) + SourceIndex(0) +--- +>>>for (var _l = 0, multiRobots_1 = multiRobots; _l < multiRobots_1.length; _l++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^^^^^^^^^^^ +10> ^^ +11> ^^^^ +12> ^ +13> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > (let [, [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["skill1", "skill2"]] of +5 > multiRobots +6 > +7 > multiRobots +8 > +9 > multiRobots +10> +11> multiRobots +12> ) +1->Emitted(25, 1) Source(30, 1) + SourceIndex(0) +2 >Emitted(25, 4) Source(30, 4) + SourceIndex(0) +3 >Emitted(25, 5) Source(30, 5) + SourceIndex(0) +4 >Emitted(25, 6) Source(33, 30) + SourceIndex(0) +5 >Emitted(25, 16) Source(33, 41) + SourceIndex(0) +6 >Emitted(25, 18) Source(33, 30) + SourceIndex(0) +7 >Emitted(25, 45) Source(33, 41) + SourceIndex(0) +8 >Emitted(25, 47) Source(33, 30) + SourceIndex(0) +9 >Emitted(25, 72) Source(33, 41) + SourceIndex(0) +10>Emitted(25, 74) Source(33, 30) + SourceIndex(0) +11>Emitted(25, 78) Source(33, 41) + SourceIndex(0) +12>Emitted(25, 79) Source(33, 42) + SourceIndex(0) +--- +>>> var _m = multiRobots_1[_l], _o = _m[1], _p = _o === void 0 ? ["skill1", "skill2"] : _o, _q = _p[0], primarySkillA = _q === void 0 ? "primary" : _q, _r = _p[1], secondarySkillA = _r === void 0 ? "secondary" : _r; +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > let [, [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["skill1", "skill2"]] +3 > +4 > [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["skill1", "skill2"] +5 > +6 > [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["skill1", "skill2"] +7 > +8 > primarySkillA = "primary" +9 > +10> primarySkillA = "primary" +11> , + > +12> secondarySkillA = "secondary" +13> +14> secondarySkillA = "secondary" +1->Emitted(26, 5) Source(30, 6) + SourceIndex(0) +2 >Emitted(26, 31) Source(33, 26) + SourceIndex(0) +3 >Emitted(26, 33) Source(30, 13) + SourceIndex(0) +4 >Emitted(26, 43) Source(33, 25) + SourceIndex(0) +5 >Emitted(26, 45) Source(30, 13) + SourceIndex(0) +6 >Emitted(26, 91) Source(33, 25) + SourceIndex(0) +7 >Emitted(26, 93) Source(31, 5) + SourceIndex(0) +8 >Emitted(26, 103) Source(31, 30) + SourceIndex(0) +9 >Emitted(26, 105) Source(31, 5) + SourceIndex(0) +10>Emitted(26, 151) Source(31, 30) + SourceIndex(0) +11>Emitted(26, 153) Source(32, 5) + SourceIndex(0) +12>Emitted(26, 163) Source(32, 34) + SourceIndex(0) +13>Emitted(26, 165) Source(32, 5) + SourceIndex(0) +14>Emitted(26, 215) Source(32, 34) + SourceIndex(0) +--- +>>> console.log(primarySkillA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^^^^^^ +7 > ^ +8 > ^ +1 > + >] = ["skill1", "skill2"]] of multiRobots) { + > +2 > console +3 > . +4 > log +5 > ( +6 > primarySkillA +7 > ) +8 > ; +1 >Emitted(27, 5) Source(34, 5) + SourceIndex(0) +2 >Emitted(27, 12) Source(34, 12) + SourceIndex(0) +3 >Emitted(27, 13) Source(34, 13) + SourceIndex(0) +4 >Emitted(27, 16) Source(34, 16) + SourceIndex(0) +5 >Emitted(27, 17) Source(34, 17) + SourceIndex(0) +6 >Emitted(27, 30) Source(34, 30) + SourceIndex(0) +7 >Emitted(27, 31) Source(34, 31) + SourceIndex(0) +8 >Emitted(27, 32) Source(34, 32) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(28, 2) Source(35, 2) + SourceIndex(0) +--- +>>>for (var _s = 0, _t = getMultiRobots(); _s < _t.length; _s++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^ +8 > ^^^^^^^^^^^^^^ +9 > ^^ +10> ^^ +11> ^^^^^^^^^^^^^^ +12> ^^ +13> ^^^^ +14> ^ +15> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > (let [, [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["skill1", "skill2"]] of +5 > getMultiRobots() +6 > +7 > +8 > getMultiRobots +9 > () +10> +11> getMultiRobots() +12> +13> getMultiRobots() +14> ) +1->Emitted(29, 1) Source(36, 1) + SourceIndex(0) +2 >Emitted(29, 4) Source(36, 4) + SourceIndex(0) +3 >Emitted(29, 5) Source(36, 5) + SourceIndex(0) +4 >Emitted(29, 6) Source(39, 30) + SourceIndex(0) +5 >Emitted(29, 16) Source(39, 46) + SourceIndex(0) +6 >Emitted(29, 18) Source(39, 30) + SourceIndex(0) +7 >Emitted(29, 23) Source(39, 30) + SourceIndex(0) +8 >Emitted(29, 37) Source(39, 44) + SourceIndex(0) +9 >Emitted(29, 39) Source(39, 46) + SourceIndex(0) +10>Emitted(29, 41) Source(39, 30) + SourceIndex(0) +11>Emitted(29, 55) Source(39, 46) + SourceIndex(0) +12>Emitted(29, 57) Source(39, 30) + SourceIndex(0) +13>Emitted(29, 61) Source(39, 46) + SourceIndex(0) +14>Emitted(29, 62) Source(39, 47) + SourceIndex(0) +--- +>>> var _u = _t[_s], _v = _u[1], _w = _v === void 0 ? ["skill1", "skill2"] : _v, _x = _w[0], primarySkillA = _x === void 0 ? "primary" : _x, _y = _w[1], secondarySkillA = _y === void 0 ? "secondary" : _y; +1->^^^^ +2 > ^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > let [, [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["skill1", "skill2"]] +3 > +4 > [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["skill1", "skill2"] +5 > +6 > [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["skill1", "skill2"] +7 > +8 > primarySkillA = "primary" +9 > +10> primarySkillA = "primary" +11> , + > +12> secondarySkillA = "secondary" +13> +14> secondarySkillA = "secondary" +1->Emitted(30, 5) Source(36, 6) + SourceIndex(0) +2 >Emitted(30, 20) Source(39, 26) + SourceIndex(0) +3 >Emitted(30, 22) Source(36, 13) + SourceIndex(0) +4 >Emitted(30, 32) Source(39, 25) + SourceIndex(0) +5 >Emitted(30, 34) Source(36, 13) + SourceIndex(0) +6 >Emitted(30, 80) Source(39, 25) + SourceIndex(0) +7 >Emitted(30, 82) Source(37, 5) + SourceIndex(0) +8 >Emitted(30, 92) Source(37, 30) + SourceIndex(0) +9 >Emitted(30, 94) Source(37, 5) + SourceIndex(0) +10>Emitted(30, 140) Source(37, 30) + SourceIndex(0) +11>Emitted(30, 142) Source(38, 5) + SourceIndex(0) +12>Emitted(30, 152) Source(38, 34) + SourceIndex(0) +13>Emitted(30, 154) Source(38, 5) + SourceIndex(0) +14>Emitted(30, 204) Source(38, 34) + SourceIndex(0) +--- +>>> console.log(primarySkillA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^^^^^^ +7 > ^ +8 > ^ +1 > + >] = ["skill1", "skill2"]] of getMultiRobots()) { + > +2 > console +3 > . +4 > log +5 > ( +6 > primarySkillA +7 > ) +8 > ; +1 >Emitted(31, 5) Source(40, 5) + SourceIndex(0) +2 >Emitted(31, 12) Source(40, 12) + SourceIndex(0) +3 >Emitted(31, 13) Source(40, 13) + SourceIndex(0) +4 >Emitted(31, 16) Source(40, 16) + SourceIndex(0) +5 >Emitted(31, 17) Source(40, 17) + SourceIndex(0) +6 >Emitted(31, 30) Source(40, 30) + SourceIndex(0) +7 >Emitted(31, 31) Source(40, 31) + SourceIndex(0) +8 >Emitted(31, 32) Source(40, 32) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(32, 2) Source(41, 2) + SourceIndex(0) +--- +>>>for (var _z = 0, _0 = [multiRobotA, multiRobotB]; _z < _0.length; _z++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^ +8 > ^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^ +11> ^ +12> ^^ +13> ^^^^^^^^^^^^^^ +14> ^^ +15> ^^^^ +16> ^ +17> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > (let [, [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["skill1", "skill2"]] of +5 > [multiRobotA, multiRobotB] +6 > +7 > [ +8 > multiRobotA +9 > , +10> multiRobotB +11> ] +12> +13> [multiRobotA, multiRobotB] +14> +15> [multiRobotA, multiRobotB] +16> ) +1->Emitted(33, 1) Source(42, 1) + SourceIndex(0) +2 >Emitted(33, 4) Source(42, 4) + SourceIndex(0) +3 >Emitted(33, 5) Source(42, 5) + SourceIndex(0) +4 >Emitted(33, 6) Source(45, 30) + SourceIndex(0) +5 >Emitted(33, 16) Source(45, 56) + SourceIndex(0) +6 >Emitted(33, 18) Source(45, 30) + SourceIndex(0) +7 >Emitted(33, 24) Source(45, 31) + SourceIndex(0) +8 >Emitted(33, 35) Source(45, 42) + SourceIndex(0) +9 >Emitted(33, 37) Source(45, 44) + SourceIndex(0) +10>Emitted(33, 48) Source(45, 55) + SourceIndex(0) +11>Emitted(33, 49) Source(45, 56) + SourceIndex(0) +12>Emitted(33, 51) Source(45, 30) + SourceIndex(0) +13>Emitted(33, 65) Source(45, 56) + SourceIndex(0) +14>Emitted(33, 67) Source(45, 30) + SourceIndex(0) +15>Emitted(33, 71) Source(45, 56) + SourceIndex(0) +16>Emitted(33, 72) Source(45, 57) + SourceIndex(0) +--- +>>> var _1 = _0[_z], _2 = _1[1], _3 = _2 === void 0 ? ["skill1", "skill2"] : _2, _4 = _3[0], primarySkillA = _4 === void 0 ? "primary" : _4, _5 = _3[1], secondarySkillA = _5 === void 0 ? "secondary" : _5; +1->^^^^ +2 > ^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > let [, [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["skill1", "skill2"]] +3 > +4 > [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["skill1", "skill2"] +5 > +6 > [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["skill1", "skill2"] +7 > +8 > primarySkillA = "primary" +9 > +10> primarySkillA = "primary" +11> , + > +12> secondarySkillA = "secondary" +13> +14> secondarySkillA = "secondary" +1->Emitted(34, 5) Source(42, 6) + SourceIndex(0) +2 >Emitted(34, 20) Source(45, 26) + SourceIndex(0) +3 >Emitted(34, 22) Source(42, 13) + SourceIndex(0) +4 >Emitted(34, 32) Source(45, 25) + SourceIndex(0) +5 >Emitted(34, 34) Source(42, 13) + SourceIndex(0) +6 >Emitted(34, 80) Source(45, 25) + SourceIndex(0) +7 >Emitted(34, 82) Source(43, 5) + SourceIndex(0) +8 >Emitted(34, 92) Source(43, 30) + SourceIndex(0) +9 >Emitted(34, 94) Source(43, 5) + SourceIndex(0) +10>Emitted(34, 140) Source(43, 30) + SourceIndex(0) +11>Emitted(34, 142) Source(44, 5) + SourceIndex(0) +12>Emitted(34, 152) Source(44, 34) + SourceIndex(0) +13>Emitted(34, 154) Source(44, 5) + SourceIndex(0) +14>Emitted(34, 204) Source(44, 34) + SourceIndex(0) +--- +>>> console.log(primarySkillA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^^^^^^ +7 > ^ +8 > ^ +1 > + >] = ["skill1", "skill2"]] of [multiRobotA, multiRobotB]) { + > +2 > console +3 > . +4 > log +5 > ( +6 > primarySkillA +7 > ) +8 > ; +1 >Emitted(35, 5) Source(46, 5) + SourceIndex(0) +2 >Emitted(35, 12) Source(46, 12) + SourceIndex(0) +3 >Emitted(35, 13) Source(46, 13) + SourceIndex(0) +4 >Emitted(35, 16) Source(46, 16) + SourceIndex(0) +5 >Emitted(35, 17) Source(46, 17) + SourceIndex(0) +6 >Emitted(35, 30) Source(46, 30) + SourceIndex(0) +7 >Emitted(35, 31) Source(46, 31) + SourceIndex(0) +8 >Emitted(35, 32) Source(46, 32) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(36, 2) Source(47, 2) + SourceIndex(0) +--- +>>>for (var _6 = 0, robots_2 = robots; _6 < robots_2.length; _6++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^^^^^^ +10> ^^ +11> ^^^^ +12> ^ +13> ^^-> +1-> + > + > +2 >for +3 > +4 > (let [numberB = -1] of +5 > robots +6 > +7 > robots +8 > +9 > robots +10> +11> robots +12> ) +1->Emitted(37, 1) Source(49, 1) + SourceIndex(0) +2 >Emitted(37, 4) Source(49, 4) + SourceIndex(0) +3 >Emitted(37, 5) Source(49, 5) + SourceIndex(0) +4 >Emitted(37, 6) Source(49, 28) + SourceIndex(0) +5 >Emitted(37, 16) Source(49, 34) + SourceIndex(0) +6 >Emitted(37, 18) Source(49, 28) + SourceIndex(0) +7 >Emitted(37, 35) Source(49, 34) + SourceIndex(0) +8 >Emitted(37, 37) Source(49, 28) + SourceIndex(0) +9 >Emitted(37, 57) Source(49, 34) + SourceIndex(0) +10>Emitted(37, 59) Source(49, 28) + SourceIndex(0) +11>Emitted(37, 63) Source(49, 34) + SourceIndex(0) +12>Emitted(37, 64) Source(49, 35) + SourceIndex(0) +--- +>>> var _7 = robots_2[_6][0], numberB = _7 === void 0 ? -1 : _7; +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > numberB = -1 +3 > +4 > numberB = -1 +1->Emitted(38, 5) Source(49, 11) + SourceIndex(0) +2 >Emitted(38, 29) Source(49, 23) + SourceIndex(0) +3 >Emitted(38, 31) Source(49, 11) + SourceIndex(0) +4 >Emitted(38, 64) Source(49, 23) + SourceIndex(0) +--- +>>> console.log(numberB); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^ +7 > ^ +8 > ^ +1 >] of robots) { + > +2 > console +3 > . +4 > log +5 > ( +6 > numberB +7 > ) +8 > ; +1 >Emitted(39, 5) Source(50, 5) + SourceIndex(0) +2 >Emitted(39, 12) Source(50, 12) + SourceIndex(0) +3 >Emitted(39, 13) Source(50, 13) + SourceIndex(0) +4 >Emitted(39, 16) Source(50, 16) + SourceIndex(0) +5 >Emitted(39, 17) Source(50, 17) + SourceIndex(0) +6 >Emitted(39, 24) Source(50, 24) + SourceIndex(0) +7 >Emitted(39, 25) Source(50, 25) + SourceIndex(0) +8 >Emitted(39, 26) Source(50, 26) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(40, 2) Source(51, 2) + SourceIndex(0) +--- +>>>for (var _8 = 0, _9 = getRobots(); _8 < _9.length; _8++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^ +8 > ^^^^^^^^^ +9 > ^^ +10> ^^ +11> ^^^^^^^^^^^^^^ +12> ^^ +13> ^^^^ +14> ^ +15> ^^^^^^-> +1-> + > +2 >for +3 > +4 > (let [numberB = -1] of +5 > getRobots() +6 > +7 > +8 > getRobots +9 > () +10> +11> getRobots() +12> +13> getRobots() +14> ) +1->Emitted(41, 1) Source(52, 1) + SourceIndex(0) +2 >Emitted(41, 4) Source(52, 4) + SourceIndex(0) +3 >Emitted(41, 5) Source(52, 5) + SourceIndex(0) +4 >Emitted(41, 6) Source(52, 28) + SourceIndex(0) +5 >Emitted(41, 16) Source(52, 39) + SourceIndex(0) +6 >Emitted(41, 18) Source(52, 28) + SourceIndex(0) +7 >Emitted(41, 23) Source(52, 28) + SourceIndex(0) +8 >Emitted(41, 32) Source(52, 37) + SourceIndex(0) +9 >Emitted(41, 34) Source(52, 39) + SourceIndex(0) +10>Emitted(41, 36) Source(52, 28) + SourceIndex(0) +11>Emitted(41, 50) Source(52, 39) + SourceIndex(0) +12>Emitted(41, 52) Source(52, 28) + SourceIndex(0) +13>Emitted(41, 56) Source(52, 39) + SourceIndex(0) +14>Emitted(41, 57) Source(52, 40) + SourceIndex(0) +--- +>>> var _10 = _9[_8][0], numberB = _10 === void 0 ? -1 : _10; +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > numberB = -1 +3 > +4 > numberB = -1 +1->Emitted(42, 5) Source(52, 11) + SourceIndex(0) +2 >Emitted(42, 24) Source(52, 23) + SourceIndex(0) +3 >Emitted(42, 26) Source(52, 11) + SourceIndex(0) +4 >Emitted(42, 61) Source(52, 23) + SourceIndex(0) +--- +>>> console.log(numberB); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^ +7 > ^ +8 > ^ +1 >] of getRobots()) { + > +2 > console +3 > . +4 > log +5 > ( +6 > numberB +7 > ) +8 > ; +1 >Emitted(43, 5) Source(53, 5) + SourceIndex(0) +2 >Emitted(43, 12) Source(53, 12) + SourceIndex(0) +3 >Emitted(43, 13) Source(53, 13) + SourceIndex(0) +4 >Emitted(43, 16) Source(53, 16) + SourceIndex(0) +5 >Emitted(43, 17) Source(53, 17) + SourceIndex(0) +6 >Emitted(43, 24) Source(53, 24) + SourceIndex(0) +7 >Emitted(43, 25) Source(53, 25) + SourceIndex(0) +8 >Emitted(43, 26) Source(53, 26) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(44, 2) Source(54, 2) + SourceIndex(0) +--- +>>>for (var _11 = 0, _12 = [robotA, robotB]; _11 < _12.length; _11++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^ +8 > ^^^^^^ +9 > ^^ +10> ^^^^^^ +11> ^ +12> ^^ +13> ^^^^^^^^^^^^^^^^ +14> ^^ +15> ^^^^^ +16> ^ +1-> + > +2 >for +3 > +4 > (let [numberB = -1] of +5 > [robotA, robotB] +6 > +7 > [ +8 > robotA +9 > , +10> robotB +11> ] +12> +13> [robotA, robotB] +14> +15> [robotA, robotB] +16> ) +1->Emitted(45, 1) Source(55, 1) + SourceIndex(0) +2 >Emitted(45, 4) Source(55, 4) + SourceIndex(0) +3 >Emitted(45, 5) Source(55, 5) + SourceIndex(0) +4 >Emitted(45, 6) Source(55, 28) + SourceIndex(0) +5 >Emitted(45, 17) Source(55, 44) + SourceIndex(0) +6 >Emitted(45, 19) Source(55, 28) + SourceIndex(0) +7 >Emitted(45, 26) Source(55, 29) + SourceIndex(0) +8 >Emitted(45, 32) Source(55, 35) + SourceIndex(0) +9 >Emitted(45, 34) Source(55, 37) + SourceIndex(0) +10>Emitted(45, 40) Source(55, 43) + SourceIndex(0) +11>Emitted(45, 41) Source(55, 44) + SourceIndex(0) +12>Emitted(45, 43) Source(55, 28) + SourceIndex(0) +13>Emitted(45, 59) Source(55, 44) + SourceIndex(0) +14>Emitted(45, 61) Source(55, 28) + SourceIndex(0) +15>Emitted(45, 66) Source(55, 44) + SourceIndex(0) +16>Emitted(45, 67) Source(55, 45) + SourceIndex(0) +--- +>>> var _13 = _12[_11][0], numberB = _13 === void 0 ? -1 : _13; +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 > numberB = -1 +3 > +4 > numberB = -1 +1 >Emitted(46, 5) Source(55, 11) + SourceIndex(0) +2 >Emitted(46, 26) Source(55, 23) + SourceIndex(0) +3 >Emitted(46, 28) Source(55, 11) + SourceIndex(0) +4 >Emitted(46, 63) Source(55, 23) + SourceIndex(0) +--- +>>> console.log(numberB); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^ +7 > ^ +8 > ^ +1 >] of [robotA, robotB]) { + > +2 > console +3 > . +4 > log +5 > ( +6 > numberB +7 > ) +8 > ; +1 >Emitted(47, 5) Source(56, 5) + SourceIndex(0) +2 >Emitted(47, 12) Source(56, 12) + SourceIndex(0) +3 >Emitted(47, 13) Source(56, 13) + SourceIndex(0) +4 >Emitted(47, 16) Source(56, 16) + SourceIndex(0) +5 >Emitted(47, 17) Source(56, 17) + SourceIndex(0) +6 >Emitted(47, 24) Source(56, 24) + SourceIndex(0) +7 >Emitted(47, 25) Source(56, 25) + SourceIndex(0) +8 >Emitted(47, 26) Source(56, 26) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(48, 2) Source(57, 2) + SourceIndex(0) +--- +>>>for (var _14 = 0, multiRobots_2 = multiRobots; _14 < multiRobots_2.length; _14++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^^^^^^^^^^^^ +10> ^^ +11> ^^^^^ +12> ^ +1-> + > +2 >for +3 > +4 > (let [nameB = "noName"] of +5 > multiRobots +6 > +7 > multiRobots +8 > +9 > multiRobots +10> +11> multiRobots +12> ) +1->Emitted(49, 1) Source(58, 1) + SourceIndex(0) +2 >Emitted(49, 4) Source(58, 4) + SourceIndex(0) +3 >Emitted(49, 5) Source(58, 5) + SourceIndex(0) +4 >Emitted(49, 6) Source(58, 32) + SourceIndex(0) +5 >Emitted(49, 17) Source(58, 43) + SourceIndex(0) +6 >Emitted(49, 19) Source(58, 32) + SourceIndex(0) +7 >Emitted(49, 46) Source(58, 43) + SourceIndex(0) +8 >Emitted(49, 48) Source(58, 32) + SourceIndex(0) +9 >Emitted(49, 74) Source(58, 43) + SourceIndex(0) +10>Emitted(49, 76) Source(58, 32) + SourceIndex(0) +11>Emitted(49, 81) Source(58, 43) + SourceIndex(0) +12>Emitted(49, 82) Source(58, 44) + SourceIndex(0) +--- +>>> var _15 = multiRobots_2[_14][0], nameB = _15 === void 0 ? "noName" : _15; +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 > nameB = "noName" +3 > +4 > nameB = "noName" +1 >Emitted(50, 5) Source(58, 11) + SourceIndex(0) +2 >Emitted(50, 36) Source(58, 27) + SourceIndex(0) +3 >Emitted(50, 38) Source(58, 11) + SourceIndex(0) +4 >Emitted(50, 77) Source(58, 27) + SourceIndex(0) +--- +>>> console.log(nameB); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 >] of multiRobots) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameB +7 > ) +8 > ; +1 >Emitted(51, 5) Source(59, 5) + SourceIndex(0) +2 >Emitted(51, 12) Source(59, 12) + SourceIndex(0) +3 >Emitted(51, 13) Source(59, 13) + SourceIndex(0) +4 >Emitted(51, 16) Source(59, 16) + SourceIndex(0) +5 >Emitted(51, 17) Source(59, 17) + SourceIndex(0) +6 >Emitted(51, 22) Source(59, 22) + SourceIndex(0) +7 >Emitted(51, 23) Source(59, 23) + SourceIndex(0) +8 >Emitted(51, 24) Source(59, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(52, 2) Source(60, 2) + SourceIndex(0) +--- +>>>for (var _16 = 0, _17 = getMultiRobots(); _16 < _17.length; _16++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^ +8 > ^^^^^^^^^^^^^^ +9 > ^^ +10> ^^ +11> ^^^^^^^^^^^^^^^^ +12> ^^ +13> ^^^^^ +14> ^ +15> ^^-> +1-> + > +2 >for +3 > +4 > (let [nameB = "noName"] of +5 > getMultiRobots() +6 > +7 > +8 > getMultiRobots +9 > () +10> +11> getMultiRobots() +12> +13> getMultiRobots() +14> ) +1->Emitted(53, 1) Source(61, 1) + SourceIndex(0) +2 >Emitted(53, 4) Source(61, 4) + SourceIndex(0) +3 >Emitted(53, 5) Source(61, 5) + SourceIndex(0) +4 >Emitted(53, 6) Source(61, 32) + SourceIndex(0) +5 >Emitted(53, 17) Source(61, 48) + SourceIndex(0) +6 >Emitted(53, 19) Source(61, 32) + SourceIndex(0) +7 >Emitted(53, 25) Source(61, 32) + SourceIndex(0) +8 >Emitted(53, 39) Source(61, 46) + SourceIndex(0) +9 >Emitted(53, 41) Source(61, 48) + SourceIndex(0) +10>Emitted(53, 43) Source(61, 32) + SourceIndex(0) +11>Emitted(53, 59) Source(61, 48) + SourceIndex(0) +12>Emitted(53, 61) Source(61, 32) + SourceIndex(0) +13>Emitted(53, 66) Source(61, 48) + SourceIndex(0) +14>Emitted(53, 67) Source(61, 49) + SourceIndex(0) +--- +>>> var _18 = _17[_16][0], nameB = _18 === void 0 ? "noName" : _18; +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > nameB = "noName" +3 > +4 > nameB = "noName" +1->Emitted(54, 5) Source(61, 11) + SourceIndex(0) +2 >Emitted(54, 26) Source(61, 27) + SourceIndex(0) +3 >Emitted(54, 28) Source(61, 11) + SourceIndex(0) +4 >Emitted(54, 67) Source(61, 27) + SourceIndex(0) +--- +>>> console.log(nameB); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 >] of getMultiRobots()) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameB +7 > ) +8 > ; +1 >Emitted(55, 5) Source(62, 5) + SourceIndex(0) +2 >Emitted(55, 12) Source(62, 12) + SourceIndex(0) +3 >Emitted(55, 13) Source(62, 13) + SourceIndex(0) +4 >Emitted(55, 16) Source(62, 16) + SourceIndex(0) +5 >Emitted(55, 17) Source(62, 17) + SourceIndex(0) +6 >Emitted(55, 22) Source(62, 22) + SourceIndex(0) +7 >Emitted(55, 23) Source(62, 23) + SourceIndex(0) +8 >Emitted(55, 24) Source(62, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(56, 2) Source(63, 2) + SourceIndex(0) +--- +>>>for (var _19 = 0, _20 = [multiRobotA, multiRobotB]; _19 < _20.length; _19++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^ +8 > ^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^ +11> ^ +12> ^^ +13> ^^^^^^^^^^^^^^^^ +14> ^^ +15> ^^^^^ +16> ^ +1-> + > +2 >for +3 > +4 > (let [nameB = "noName"] of +5 > [multiRobotA, multiRobotB] +6 > +7 > [ +8 > multiRobotA +9 > , +10> multiRobotB +11> ] +12> +13> [multiRobotA, multiRobotB] +14> +15> [multiRobotA, multiRobotB] +16> ) +1->Emitted(57, 1) Source(64, 1) + SourceIndex(0) +2 >Emitted(57, 4) Source(64, 4) + SourceIndex(0) +3 >Emitted(57, 5) Source(64, 5) + SourceIndex(0) +4 >Emitted(57, 6) Source(64, 32) + SourceIndex(0) +5 >Emitted(57, 17) Source(64, 58) + SourceIndex(0) +6 >Emitted(57, 19) Source(64, 32) + SourceIndex(0) +7 >Emitted(57, 26) Source(64, 33) + SourceIndex(0) +8 >Emitted(57, 37) Source(64, 44) + SourceIndex(0) +9 >Emitted(57, 39) Source(64, 46) + SourceIndex(0) +10>Emitted(57, 50) Source(64, 57) + SourceIndex(0) +11>Emitted(57, 51) Source(64, 58) + SourceIndex(0) +12>Emitted(57, 53) Source(64, 32) + SourceIndex(0) +13>Emitted(57, 69) Source(64, 58) + SourceIndex(0) +14>Emitted(57, 71) Source(64, 32) + SourceIndex(0) +15>Emitted(57, 76) Source(64, 58) + SourceIndex(0) +16>Emitted(57, 77) Source(64, 59) + SourceIndex(0) +--- +>>> var _21 = _20[_19][0], nameB = _21 === void 0 ? "noName" : _21; +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 > nameB = "noName" +3 > +4 > nameB = "noName" +1 >Emitted(58, 5) Source(64, 11) + SourceIndex(0) +2 >Emitted(58, 26) Source(64, 27) + SourceIndex(0) +3 >Emitted(58, 28) Source(64, 11) + SourceIndex(0) +4 >Emitted(58, 67) Source(64, 27) + SourceIndex(0) +--- +>>> console.log(nameB); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 >] of [multiRobotA, multiRobotB]) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameB +7 > ) +8 > ; +1 >Emitted(59, 5) Source(65, 5) + SourceIndex(0) +2 >Emitted(59, 12) Source(65, 12) + SourceIndex(0) +3 >Emitted(59, 13) Source(65, 13) + SourceIndex(0) +4 >Emitted(59, 16) Source(65, 16) + SourceIndex(0) +5 >Emitted(59, 17) Source(65, 17) + SourceIndex(0) +6 >Emitted(59, 22) Source(65, 22) + SourceIndex(0) +7 >Emitted(59, 23) Source(65, 23) + SourceIndex(0) +8 >Emitted(59, 24) Source(65, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(60, 2) Source(66, 2) + SourceIndex(0) +--- +>>>for (var _22 = 0, robots_3 = robots; _22 < robots_3.length; _22++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^^^^^^^ +10> ^^ +11> ^^^^^ +12> ^ +13> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > + > +2 >for +3 > +4 > (let [numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of +5 > robots +6 > +7 > robots +8 > +9 > robots +10> +11> robots +12> ) +1->Emitted(61, 1) Source(68, 1) + SourceIndex(0) +2 >Emitted(61, 4) Source(68, 4) + SourceIndex(0) +3 >Emitted(61, 5) Source(68, 5) + SourceIndex(0) +4 >Emitted(61, 6) Source(68, 67) + SourceIndex(0) +5 >Emitted(61, 17) Source(68, 73) + SourceIndex(0) +6 >Emitted(61, 19) Source(68, 67) + SourceIndex(0) +7 >Emitted(61, 36) Source(68, 73) + SourceIndex(0) +8 >Emitted(61, 38) Source(68, 67) + SourceIndex(0) +9 >Emitted(61, 59) Source(68, 73) + SourceIndex(0) +10>Emitted(61, 61) Source(68, 67) + SourceIndex(0) +11>Emitted(61, 66) Source(68, 73) + SourceIndex(0) +12>Emitted(61, 67) Source(68, 74) + SourceIndex(0) +--- +>>> var _23 = robots_3[_22], _24 = _23[0], numberA2 = _24 === void 0 ? -1 : _24, _25 = _23[1], nameA2 = _25 === void 0 ? "noName" : _25, _26 = _23[2], skillA2 = _26 === void 0 ? "skill" : _26; +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > let [numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] +3 > +4 > numberA2 = -1 +5 > +6 > numberA2 = -1 +7 > , +8 > nameA2 = "noName" +9 > +10> nameA2 = "noName" +11> , +12> skillA2 = "skill" +13> +14> skillA2 = "skill" +1->Emitted(62, 5) Source(68, 6) + SourceIndex(0) +2 >Emitted(62, 28) Source(68, 63) + SourceIndex(0) +3 >Emitted(62, 30) Source(68, 11) + SourceIndex(0) +4 >Emitted(62, 42) Source(68, 24) + SourceIndex(0) +5 >Emitted(62, 44) Source(68, 11) + SourceIndex(0) +6 >Emitted(62, 80) Source(68, 24) + SourceIndex(0) +7 >Emitted(62, 82) Source(68, 26) + SourceIndex(0) +8 >Emitted(62, 94) Source(68, 43) + SourceIndex(0) +9 >Emitted(62, 96) Source(68, 26) + SourceIndex(0) +10>Emitted(62, 136) Source(68, 43) + SourceIndex(0) +11>Emitted(62, 138) Source(68, 45) + SourceIndex(0) +12>Emitted(62, 150) Source(68, 62) + SourceIndex(0) +13>Emitted(62, 152) Source(68, 45) + SourceIndex(0) +14>Emitted(62, 192) Source(68, 62) + SourceIndex(0) +--- +>>> console.log(nameA2); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^ +7 > ^ +8 > ^ +1 >] of robots) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA2 +7 > ) +8 > ; +1 >Emitted(63, 5) Source(69, 5) + SourceIndex(0) +2 >Emitted(63, 12) Source(69, 12) + SourceIndex(0) +3 >Emitted(63, 13) Source(69, 13) + SourceIndex(0) +4 >Emitted(63, 16) Source(69, 16) + SourceIndex(0) +5 >Emitted(63, 17) Source(69, 17) + SourceIndex(0) +6 >Emitted(63, 23) Source(69, 23) + SourceIndex(0) +7 >Emitted(63, 24) Source(69, 24) + SourceIndex(0) +8 >Emitted(63, 25) Source(69, 25) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(64, 2) Source(70, 2) + SourceIndex(0) +--- +>>>for (var _27 = 0, _28 = getRobots(); _27 < _28.length; _27++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^ +8 > ^^^^^^^^^ +9 > ^^ +10> ^^ +11> ^^^^^^^^^^^^^^^^ +12> ^^ +13> ^^^^^ +14> ^ +15> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > (let [numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of +5 > getRobots() +6 > +7 > +8 > getRobots +9 > () +10> +11> getRobots() +12> +13> getRobots() +14> ) +1->Emitted(65, 1) Source(71, 1) + SourceIndex(0) +2 >Emitted(65, 4) Source(71, 4) + SourceIndex(0) +3 >Emitted(65, 5) Source(71, 5) + SourceIndex(0) +4 >Emitted(65, 6) Source(71, 67) + SourceIndex(0) +5 >Emitted(65, 17) Source(71, 78) + SourceIndex(0) +6 >Emitted(65, 19) Source(71, 67) + SourceIndex(0) +7 >Emitted(65, 25) Source(71, 67) + SourceIndex(0) +8 >Emitted(65, 34) Source(71, 76) + SourceIndex(0) +9 >Emitted(65, 36) Source(71, 78) + SourceIndex(0) +10>Emitted(65, 38) Source(71, 67) + SourceIndex(0) +11>Emitted(65, 54) Source(71, 78) + SourceIndex(0) +12>Emitted(65, 56) Source(71, 67) + SourceIndex(0) +13>Emitted(65, 61) Source(71, 78) + SourceIndex(0) +14>Emitted(65, 62) Source(71, 79) + SourceIndex(0) +--- +>>> var _29 = _28[_27], _30 = _29[0], numberA2 = _30 === void 0 ? -1 : _30, _31 = _29[1], nameA2 = _31 === void 0 ? "noName" : _31, _32 = _29[2], skillA2 = _32 === void 0 ? "skill" : _32; +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > let [numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] +3 > +4 > numberA2 = -1 +5 > +6 > numberA2 = -1 +7 > , +8 > nameA2 = "noName" +9 > +10> nameA2 = "noName" +11> , +12> skillA2 = "skill" +13> +14> skillA2 = "skill" +1->Emitted(66, 5) Source(71, 6) + SourceIndex(0) +2 >Emitted(66, 23) Source(71, 63) + SourceIndex(0) +3 >Emitted(66, 25) Source(71, 11) + SourceIndex(0) +4 >Emitted(66, 37) Source(71, 24) + SourceIndex(0) +5 >Emitted(66, 39) Source(71, 11) + SourceIndex(0) +6 >Emitted(66, 75) Source(71, 24) + SourceIndex(0) +7 >Emitted(66, 77) Source(71, 26) + SourceIndex(0) +8 >Emitted(66, 89) Source(71, 43) + SourceIndex(0) +9 >Emitted(66, 91) Source(71, 26) + SourceIndex(0) +10>Emitted(66, 131) Source(71, 43) + SourceIndex(0) +11>Emitted(66, 133) Source(71, 45) + SourceIndex(0) +12>Emitted(66, 145) Source(71, 62) + SourceIndex(0) +13>Emitted(66, 147) Source(71, 45) + SourceIndex(0) +14>Emitted(66, 187) Source(71, 62) + SourceIndex(0) +--- +>>> console.log(nameA2); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^ +7 > ^ +8 > ^ +1 >] of getRobots()) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA2 +7 > ) +8 > ; +1 >Emitted(67, 5) Source(72, 5) + SourceIndex(0) +2 >Emitted(67, 12) Source(72, 12) + SourceIndex(0) +3 >Emitted(67, 13) Source(72, 13) + SourceIndex(0) +4 >Emitted(67, 16) Source(72, 16) + SourceIndex(0) +5 >Emitted(67, 17) Source(72, 17) + SourceIndex(0) +6 >Emitted(67, 23) Source(72, 23) + SourceIndex(0) +7 >Emitted(67, 24) Source(72, 24) + SourceIndex(0) +8 >Emitted(67, 25) Source(72, 25) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(68, 2) Source(73, 2) + SourceIndex(0) +--- +>>>for (var _33 = 0, _34 = [robotA, robotB]; _33 < _34.length; _33++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^ +8 > ^^^^^^ +9 > ^^ +10> ^^^^^^ +11> ^ +12> ^^ +13> ^^^^^^^^^^^^^^^^ +14> ^^ +15> ^^^^^ +16> ^ +17> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > (let [numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of +5 > [robotA, robotB] +6 > +7 > [ +8 > robotA +9 > , +10> robotB +11> ] +12> +13> [robotA, robotB] +14> +15> [robotA, robotB] +16> ) +1->Emitted(69, 1) Source(74, 1) + SourceIndex(0) +2 >Emitted(69, 4) Source(74, 4) + SourceIndex(0) +3 >Emitted(69, 5) Source(74, 5) + SourceIndex(0) +4 >Emitted(69, 6) Source(74, 67) + SourceIndex(0) +5 >Emitted(69, 17) Source(74, 83) + SourceIndex(0) +6 >Emitted(69, 19) Source(74, 67) + SourceIndex(0) +7 >Emitted(69, 26) Source(74, 68) + SourceIndex(0) +8 >Emitted(69, 32) Source(74, 74) + SourceIndex(0) +9 >Emitted(69, 34) Source(74, 76) + SourceIndex(0) +10>Emitted(69, 40) Source(74, 82) + SourceIndex(0) +11>Emitted(69, 41) Source(74, 83) + SourceIndex(0) +12>Emitted(69, 43) Source(74, 67) + SourceIndex(0) +13>Emitted(69, 59) Source(74, 83) + SourceIndex(0) +14>Emitted(69, 61) Source(74, 67) + SourceIndex(0) +15>Emitted(69, 66) Source(74, 83) + SourceIndex(0) +16>Emitted(69, 67) Source(74, 84) + SourceIndex(0) +--- +>>> var _35 = _34[_33], _36 = _35[0], numberA2 = _36 === void 0 ? -1 : _36, _37 = _35[1], nameA2 = _37 === void 0 ? "noName" : _37, _38 = _35[2], skillA2 = _38 === void 0 ? "skill" : _38; +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > let [numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] +3 > +4 > numberA2 = -1 +5 > +6 > numberA2 = -1 +7 > , +8 > nameA2 = "noName" +9 > +10> nameA2 = "noName" +11> , +12> skillA2 = "skill" +13> +14> skillA2 = "skill" +1->Emitted(70, 5) Source(74, 6) + SourceIndex(0) +2 >Emitted(70, 23) Source(74, 63) + SourceIndex(0) +3 >Emitted(70, 25) Source(74, 11) + SourceIndex(0) +4 >Emitted(70, 37) Source(74, 24) + SourceIndex(0) +5 >Emitted(70, 39) Source(74, 11) + SourceIndex(0) +6 >Emitted(70, 75) Source(74, 24) + SourceIndex(0) +7 >Emitted(70, 77) Source(74, 26) + SourceIndex(0) +8 >Emitted(70, 89) Source(74, 43) + SourceIndex(0) +9 >Emitted(70, 91) Source(74, 26) + SourceIndex(0) +10>Emitted(70, 131) Source(74, 43) + SourceIndex(0) +11>Emitted(70, 133) Source(74, 45) + SourceIndex(0) +12>Emitted(70, 145) Source(74, 62) + SourceIndex(0) +13>Emitted(70, 147) Source(74, 45) + SourceIndex(0) +14>Emitted(70, 187) Source(74, 62) + SourceIndex(0) +--- +>>> console.log(nameA2); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^ +7 > ^ +8 > ^ +1 >] of [robotA, robotB]) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA2 +7 > ) +8 > ; +1 >Emitted(71, 5) Source(75, 5) + SourceIndex(0) +2 >Emitted(71, 12) Source(75, 12) + SourceIndex(0) +3 >Emitted(71, 13) Source(75, 13) + SourceIndex(0) +4 >Emitted(71, 16) Source(75, 16) + SourceIndex(0) +5 >Emitted(71, 17) Source(75, 17) + SourceIndex(0) +6 >Emitted(71, 23) Source(75, 23) + SourceIndex(0) +7 >Emitted(71, 24) Source(75, 24) + SourceIndex(0) +8 >Emitted(71, 25) Source(75, 25) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(72, 2) Source(76, 2) + SourceIndex(0) +--- +>>>for (var _39 = 0, multiRobots_3 = multiRobots; _39 < multiRobots_3.length; _39++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^^^^^^^^^^^^ +10> ^^ +11> ^^^^^ +12> ^ +13> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > (let [nameMA = "noName", [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["skill1", "skill2"]] of +5 > multiRobots +6 > +7 > multiRobots +8 > +9 > multiRobots +10> +11> multiRobots +12> ) +1->Emitted(73, 1) Source(77, 1) + SourceIndex(0) +2 >Emitted(73, 4) Source(77, 4) + SourceIndex(0) +3 >Emitted(73, 5) Source(77, 5) + SourceIndex(0) +4 >Emitted(73, 6) Source(80, 30) + SourceIndex(0) +5 >Emitted(73, 17) Source(80, 41) + SourceIndex(0) +6 >Emitted(73, 19) Source(80, 30) + SourceIndex(0) +7 >Emitted(73, 46) Source(80, 41) + SourceIndex(0) +8 >Emitted(73, 48) Source(80, 30) + SourceIndex(0) +9 >Emitted(73, 74) Source(80, 41) + SourceIndex(0) +10>Emitted(73, 76) Source(80, 30) + SourceIndex(0) +11>Emitted(73, 81) Source(80, 41) + SourceIndex(0) +12>Emitted(73, 82) Source(80, 42) + SourceIndex(0) +--- +>>> var _40 = multiRobots_3[_39], _41 = _40[0], nameMA = _41 === void 0 ? "noName" : _41, _42 = _40[1], _43 = _42 === void 0 ? ["skill1", "skill2"] : _42, _44 = _43[0], primarySkillA = _44 === void 0 ? "primary" : _44, _45 = _43[1], secondarySkillA = _45 === void 0 ? "secondary" : _45; +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +15> ^^ +16> ^^^^^^^^^^^^ +17> ^^ +18> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > let [nameMA = "noName", [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["skill1", "skill2"]] +3 > +4 > nameMA = "noName" +5 > +6 > nameMA = "noName" +7 > , +8 > [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["skill1", "skill2"] +9 > +10> [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["skill1", "skill2"] +11> +12> primarySkillA = "primary" +13> +14> primarySkillA = "primary" +15> , + > +16> secondarySkillA = "secondary" +17> +18> secondarySkillA = "secondary" +1->Emitted(74, 5) Source(77, 6) + SourceIndex(0) +2 >Emitted(74, 33) Source(80, 26) + SourceIndex(0) +3 >Emitted(74, 35) Source(77, 11) + SourceIndex(0) +4 >Emitted(74, 47) Source(77, 28) + SourceIndex(0) +5 >Emitted(74, 49) Source(77, 11) + SourceIndex(0) +6 >Emitted(74, 89) Source(77, 28) + SourceIndex(0) +7 >Emitted(74, 91) Source(77, 30) + SourceIndex(0) +8 >Emitted(74, 103) Source(80, 25) + SourceIndex(0) +9 >Emitted(74, 105) Source(77, 30) + SourceIndex(0) +10>Emitted(74, 154) Source(80, 25) + SourceIndex(0) +11>Emitted(74, 156) Source(78, 5) + SourceIndex(0) +12>Emitted(74, 168) Source(78, 30) + SourceIndex(0) +13>Emitted(74, 170) Source(78, 5) + SourceIndex(0) +14>Emitted(74, 218) Source(78, 30) + SourceIndex(0) +15>Emitted(74, 220) Source(79, 5) + SourceIndex(0) +16>Emitted(74, 232) Source(79, 34) + SourceIndex(0) +17>Emitted(74, 234) Source(79, 5) + SourceIndex(0) +18>Emitted(74, 286) Source(79, 34) + SourceIndex(0) +--- +>>> console.log(nameMA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^ +7 > ^ +8 > ^ +1 > + >] = ["skill1", "skill2"]] of multiRobots) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameMA +7 > ) +8 > ; +1 >Emitted(75, 5) Source(81, 5) + SourceIndex(0) +2 >Emitted(75, 12) Source(81, 12) + SourceIndex(0) +3 >Emitted(75, 13) Source(81, 13) + SourceIndex(0) +4 >Emitted(75, 16) Source(81, 16) + SourceIndex(0) +5 >Emitted(75, 17) Source(81, 17) + SourceIndex(0) +6 >Emitted(75, 23) Source(81, 23) + SourceIndex(0) +7 >Emitted(75, 24) Source(81, 24) + SourceIndex(0) +8 >Emitted(75, 25) Source(81, 25) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(76, 2) Source(82, 2) + SourceIndex(0) +--- +>>>for (var _46 = 0, _47 = getMultiRobots(); _46 < _47.length; _46++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^ +8 > ^^^^^^^^^^^^^^ +9 > ^^ +10> ^^ +11> ^^^^^^^^^^^^^^^^ +12> ^^ +13> ^^^^^ +14> ^ +15> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > (let [nameMA = "noName", [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["skill1", "skill2"]] of +5 > getMultiRobots() +6 > +7 > +8 > getMultiRobots +9 > () +10> +11> getMultiRobots() +12> +13> getMultiRobots() +14> ) +1->Emitted(77, 1) Source(83, 1) + SourceIndex(0) +2 >Emitted(77, 4) Source(83, 4) + SourceIndex(0) +3 >Emitted(77, 5) Source(83, 5) + SourceIndex(0) +4 >Emitted(77, 6) Source(86, 30) + SourceIndex(0) +5 >Emitted(77, 17) Source(86, 46) + SourceIndex(0) +6 >Emitted(77, 19) Source(86, 30) + SourceIndex(0) +7 >Emitted(77, 25) Source(86, 30) + SourceIndex(0) +8 >Emitted(77, 39) Source(86, 44) + SourceIndex(0) +9 >Emitted(77, 41) Source(86, 46) + SourceIndex(0) +10>Emitted(77, 43) Source(86, 30) + SourceIndex(0) +11>Emitted(77, 59) Source(86, 46) + SourceIndex(0) +12>Emitted(77, 61) Source(86, 30) + SourceIndex(0) +13>Emitted(77, 66) Source(86, 46) + SourceIndex(0) +14>Emitted(77, 67) Source(86, 47) + SourceIndex(0) +--- +>>> var _48 = _47[_46], _49 = _48[0], nameMA = _49 === void 0 ? "noName" : _49, _50 = _48[1], _51 = _50 === void 0 ? ["skill1", "skill2"] : _50, _52 = _51[0], primarySkillA = _52 === void 0 ? "primary" : _52, _53 = _51[1], secondarySkillA = _53 === void 0 ? "secondary" : _53; +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +15> ^^ +16> ^^^^^^^^^^^^ +17> ^^ +18> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > let [nameMA = "noName", [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["skill1", "skill2"]] +3 > +4 > nameMA = "noName" +5 > +6 > nameMA = "noName" +7 > , +8 > [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["skill1", "skill2"] +9 > +10> [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["skill1", "skill2"] +11> +12> primarySkillA = "primary" +13> +14> primarySkillA = "primary" +15> , + > +16> secondarySkillA = "secondary" +17> +18> secondarySkillA = "secondary" +1->Emitted(78, 5) Source(83, 6) + SourceIndex(0) +2 >Emitted(78, 23) Source(86, 26) + SourceIndex(0) +3 >Emitted(78, 25) Source(83, 11) + SourceIndex(0) +4 >Emitted(78, 37) Source(83, 28) + SourceIndex(0) +5 >Emitted(78, 39) Source(83, 11) + SourceIndex(0) +6 >Emitted(78, 79) Source(83, 28) + SourceIndex(0) +7 >Emitted(78, 81) Source(83, 30) + SourceIndex(0) +8 >Emitted(78, 93) Source(86, 25) + SourceIndex(0) +9 >Emitted(78, 95) Source(83, 30) + SourceIndex(0) +10>Emitted(78, 144) Source(86, 25) + SourceIndex(0) +11>Emitted(78, 146) Source(84, 5) + SourceIndex(0) +12>Emitted(78, 158) Source(84, 30) + SourceIndex(0) +13>Emitted(78, 160) Source(84, 5) + SourceIndex(0) +14>Emitted(78, 208) Source(84, 30) + SourceIndex(0) +15>Emitted(78, 210) Source(85, 5) + SourceIndex(0) +16>Emitted(78, 222) Source(85, 34) + SourceIndex(0) +17>Emitted(78, 224) Source(85, 5) + SourceIndex(0) +18>Emitted(78, 276) Source(85, 34) + SourceIndex(0) +--- +>>> console.log(nameMA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^ +7 > ^ +8 > ^ +1 > + >] = ["skill1", "skill2"]] of getMultiRobots()) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameMA +7 > ) +8 > ; +1 >Emitted(79, 5) Source(87, 5) + SourceIndex(0) +2 >Emitted(79, 12) Source(87, 12) + SourceIndex(0) +3 >Emitted(79, 13) Source(87, 13) + SourceIndex(0) +4 >Emitted(79, 16) Source(87, 16) + SourceIndex(0) +5 >Emitted(79, 17) Source(87, 17) + SourceIndex(0) +6 >Emitted(79, 23) Source(87, 23) + SourceIndex(0) +7 >Emitted(79, 24) Source(87, 24) + SourceIndex(0) +8 >Emitted(79, 25) Source(87, 25) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(80, 2) Source(88, 2) + SourceIndex(0) +--- +>>>for (var _54 = 0, _55 = [multiRobotA, multiRobotB]; _54 < _55.length; _54++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^ +8 > ^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^ +11> ^ +12> ^^ +13> ^^^^^^^^^^^^^^^^ +14> ^^ +15> ^^^^^ +16> ^ +17> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > (let [nameMA = "noName", [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["skill1", "skill2"]] of +5 > [multiRobotA, multiRobotB] +6 > +7 > [ +8 > multiRobotA +9 > , +10> multiRobotB +11> ] +12> +13> [multiRobotA, multiRobotB] +14> +15> [multiRobotA, multiRobotB] +16> ) +1->Emitted(81, 1) Source(89, 1) + SourceIndex(0) +2 >Emitted(81, 4) Source(89, 4) + SourceIndex(0) +3 >Emitted(81, 5) Source(89, 5) + SourceIndex(0) +4 >Emitted(81, 6) Source(92, 30) + SourceIndex(0) +5 >Emitted(81, 17) Source(92, 56) + SourceIndex(0) +6 >Emitted(81, 19) Source(92, 30) + SourceIndex(0) +7 >Emitted(81, 26) Source(92, 31) + SourceIndex(0) +8 >Emitted(81, 37) Source(92, 42) + SourceIndex(0) +9 >Emitted(81, 39) Source(92, 44) + SourceIndex(0) +10>Emitted(81, 50) Source(92, 55) + SourceIndex(0) +11>Emitted(81, 51) Source(92, 56) + SourceIndex(0) +12>Emitted(81, 53) Source(92, 30) + SourceIndex(0) +13>Emitted(81, 69) Source(92, 56) + SourceIndex(0) +14>Emitted(81, 71) Source(92, 30) + SourceIndex(0) +15>Emitted(81, 76) Source(92, 56) + SourceIndex(0) +16>Emitted(81, 77) Source(92, 57) + SourceIndex(0) +--- +>>> var _56 = _55[_54], _57 = _56[0], nameMA = _57 === void 0 ? "noName" : _57, _58 = _56[1], _59 = _58 === void 0 ? ["skill1", "skill2"] : _58, _60 = _59[0], primarySkillA = _60 === void 0 ? "primary" : _60, _61 = _59[1], secondarySkillA = _61 === void 0 ? "secondary" : _61; +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +15> ^^ +16> ^^^^^^^^^^^^ +17> ^^ +18> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > let [nameMA = "noName", [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["skill1", "skill2"]] +3 > +4 > nameMA = "noName" +5 > +6 > nameMA = "noName" +7 > , +8 > [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["skill1", "skill2"] +9 > +10> [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["skill1", "skill2"] +11> +12> primarySkillA = "primary" +13> +14> primarySkillA = "primary" +15> , + > +16> secondarySkillA = "secondary" +17> +18> secondarySkillA = "secondary" +1->Emitted(82, 5) Source(89, 6) + SourceIndex(0) +2 >Emitted(82, 23) Source(92, 26) + SourceIndex(0) +3 >Emitted(82, 25) Source(89, 11) + SourceIndex(0) +4 >Emitted(82, 37) Source(89, 28) + SourceIndex(0) +5 >Emitted(82, 39) Source(89, 11) + SourceIndex(0) +6 >Emitted(82, 79) Source(89, 28) + SourceIndex(0) +7 >Emitted(82, 81) Source(89, 30) + SourceIndex(0) +8 >Emitted(82, 93) Source(92, 25) + SourceIndex(0) +9 >Emitted(82, 95) Source(89, 30) + SourceIndex(0) +10>Emitted(82, 144) Source(92, 25) + SourceIndex(0) +11>Emitted(82, 146) Source(90, 5) + SourceIndex(0) +12>Emitted(82, 158) Source(90, 30) + SourceIndex(0) +13>Emitted(82, 160) Source(90, 5) + SourceIndex(0) +14>Emitted(82, 208) Source(90, 30) + SourceIndex(0) +15>Emitted(82, 210) Source(91, 5) + SourceIndex(0) +16>Emitted(82, 222) Source(91, 34) + SourceIndex(0) +17>Emitted(82, 224) Source(91, 5) + SourceIndex(0) +18>Emitted(82, 276) Source(91, 34) + SourceIndex(0) +--- +>>> console.log(nameMA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^ +7 > ^ +8 > ^ +1 > + >] = ["skill1", "skill2"]] of [multiRobotA, multiRobotB]) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameMA +7 > ) +8 > ; +1 >Emitted(83, 5) Source(93, 5) + SourceIndex(0) +2 >Emitted(83, 12) Source(93, 12) + SourceIndex(0) +3 >Emitted(83, 13) Source(93, 13) + SourceIndex(0) +4 >Emitted(83, 16) Source(93, 16) + SourceIndex(0) +5 >Emitted(83, 17) Source(93, 17) + SourceIndex(0) +6 >Emitted(83, 23) Source(93, 23) + SourceIndex(0) +7 >Emitted(83, 24) Source(93, 24) + SourceIndex(0) +8 >Emitted(83, 25) Source(93, 25) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(84, 2) Source(94, 2) + SourceIndex(0) +--- +>>>for (var _62 = 0, robots_4 = robots; _62 < robots_4.length; _62++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^^^^^^^ +10> ^^ +11> ^^^^^ +12> ^ +13> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > + > +2 >for +3 > +4 > (let [numberA3 = -1, ...robotAInfo] of +5 > robots +6 > +7 > robots +8 > +9 > robots +10> +11> robots +12> ) +1->Emitted(85, 1) Source(96, 1) + SourceIndex(0) +2 >Emitted(85, 4) Source(96, 4) + SourceIndex(0) +3 >Emitted(85, 5) Source(96, 5) + SourceIndex(0) +4 >Emitted(85, 6) Source(96, 44) + SourceIndex(0) +5 >Emitted(85, 17) Source(96, 50) + SourceIndex(0) +6 >Emitted(85, 19) Source(96, 44) + SourceIndex(0) +7 >Emitted(85, 36) Source(96, 50) + SourceIndex(0) +8 >Emitted(85, 38) Source(96, 44) + SourceIndex(0) +9 >Emitted(85, 59) Source(96, 50) + SourceIndex(0) +10>Emitted(85, 61) Source(96, 44) + SourceIndex(0) +11>Emitted(85, 66) Source(96, 50) + SourceIndex(0) +12>Emitted(85, 67) Source(96, 51) + SourceIndex(0) +--- +>>> var _63 = robots_4[_62], _64 = _63[0], numberA3 = _64 === void 0 ? -1 : _64, robotAInfo = _63.slice(1); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > let [numberA3 = -1, ...robotAInfo] +3 > +4 > numberA3 = -1 +5 > +6 > numberA3 = -1 +7 > , +8 > ...robotAInfo +1->Emitted(86, 5) Source(96, 6) + SourceIndex(0) +2 >Emitted(86, 28) Source(96, 40) + SourceIndex(0) +3 >Emitted(86, 30) Source(96, 11) + SourceIndex(0) +4 >Emitted(86, 42) Source(96, 24) + SourceIndex(0) +5 >Emitted(86, 44) Source(96, 11) + SourceIndex(0) +6 >Emitted(86, 80) Source(96, 24) + SourceIndex(0) +7 >Emitted(86, 82) Source(96, 26) + SourceIndex(0) +8 >Emitted(86, 107) Source(96, 39) + SourceIndex(0) +--- +>>> console.log(numberA3); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1 >] of robots) { + > +2 > console +3 > . +4 > log +5 > ( +6 > numberA3 +7 > ) +8 > ; +1 >Emitted(87, 5) Source(97, 5) + SourceIndex(0) +2 >Emitted(87, 12) Source(97, 12) + SourceIndex(0) +3 >Emitted(87, 13) Source(97, 13) + SourceIndex(0) +4 >Emitted(87, 16) Source(97, 16) + SourceIndex(0) +5 >Emitted(87, 17) Source(97, 17) + SourceIndex(0) +6 >Emitted(87, 25) Source(97, 25) + SourceIndex(0) +7 >Emitted(87, 26) Source(97, 26) + SourceIndex(0) +8 >Emitted(87, 27) Source(97, 27) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(88, 2) Source(98, 2) + SourceIndex(0) +--- +>>>for (var _65 = 0, _66 = getRobots(); _65 < _66.length; _65++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^ +8 > ^^^^^^^^^ +9 > ^^ +10> ^^ +11> ^^^^^^^^^^^^^^^^ +12> ^^ +13> ^^^^^ +14> ^ +15> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > (let [numberA3 = -1, ...robotAInfo] of +5 > getRobots() +6 > +7 > +8 > getRobots +9 > () +10> +11> getRobots() +12> +13> getRobots() +14> ) +1->Emitted(89, 1) Source(99, 1) + SourceIndex(0) +2 >Emitted(89, 4) Source(99, 4) + SourceIndex(0) +3 >Emitted(89, 5) Source(99, 5) + SourceIndex(0) +4 >Emitted(89, 6) Source(99, 44) + SourceIndex(0) +5 >Emitted(89, 17) Source(99, 55) + SourceIndex(0) +6 >Emitted(89, 19) Source(99, 44) + SourceIndex(0) +7 >Emitted(89, 25) Source(99, 44) + SourceIndex(0) +8 >Emitted(89, 34) Source(99, 53) + SourceIndex(0) +9 >Emitted(89, 36) Source(99, 55) + SourceIndex(0) +10>Emitted(89, 38) Source(99, 44) + SourceIndex(0) +11>Emitted(89, 54) Source(99, 55) + SourceIndex(0) +12>Emitted(89, 56) Source(99, 44) + SourceIndex(0) +13>Emitted(89, 61) Source(99, 55) + SourceIndex(0) +14>Emitted(89, 62) Source(99, 56) + SourceIndex(0) +--- +>>> var _67 = _66[_65], _68 = _67[0], numberA3 = _68 === void 0 ? -1 : _68, robotAInfo = _67.slice(1); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > let [numberA3 = -1, ...robotAInfo] +3 > +4 > numberA3 = -1 +5 > +6 > numberA3 = -1 +7 > , +8 > ...robotAInfo +1->Emitted(90, 5) Source(99, 6) + SourceIndex(0) +2 >Emitted(90, 23) Source(99, 40) + SourceIndex(0) +3 >Emitted(90, 25) Source(99, 11) + SourceIndex(0) +4 >Emitted(90, 37) Source(99, 24) + SourceIndex(0) +5 >Emitted(90, 39) Source(99, 11) + SourceIndex(0) +6 >Emitted(90, 75) Source(99, 24) + SourceIndex(0) +7 >Emitted(90, 77) Source(99, 26) + SourceIndex(0) +8 >Emitted(90, 102) Source(99, 39) + SourceIndex(0) +--- +>>> console.log(numberA3); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1 >] of getRobots()) { + > +2 > console +3 > . +4 > log +5 > ( +6 > numberA3 +7 > ) +8 > ; +1 >Emitted(91, 5) Source(100, 5) + SourceIndex(0) +2 >Emitted(91, 12) Source(100, 12) + SourceIndex(0) +3 >Emitted(91, 13) Source(100, 13) + SourceIndex(0) +4 >Emitted(91, 16) Source(100, 16) + SourceIndex(0) +5 >Emitted(91, 17) Source(100, 17) + SourceIndex(0) +6 >Emitted(91, 25) Source(100, 25) + SourceIndex(0) +7 >Emitted(91, 26) Source(100, 26) + SourceIndex(0) +8 >Emitted(91, 27) Source(100, 27) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(92, 2) Source(101, 2) + SourceIndex(0) +--- +>>>for (var _69 = 0, _70 = [robotA, robotB]; _69 < _70.length; _69++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^ +8 > ^^^^^^ +9 > ^^ +10> ^^^^^^ +11> ^ +12> ^^ +13> ^^^^^^^^^^^^^^^^ +14> ^^ +15> ^^^^^ +16> ^ +17> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > (let [numberA3 = -1, ...robotAInfo] of +5 > [robotA, robotB] +6 > +7 > [ +8 > robotA +9 > , +10> robotB +11> ] +12> +13> [robotA, robotB] +14> +15> [robotA, robotB] +16> ) +1->Emitted(93, 1) Source(102, 1) + SourceIndex(0) +2 >Emitted(93, 4) Source(102, 4) + SourceIndex(0) +3 >Emitted(93, 5) Source(102, 5) + SourceIndex(0) +4 >Emitted(93, 6) Source(102, 44) + SourceIndex(0) +5 >Emitted(93, 17) Source(102, 60) + SourceIndex(0) +6 >Emitted(93, 19) Source(102, 44) + SourceIndex(0) +7 >Emitted(93, 26) Source(102, 45) + SourceIndex(0) +8 >Emitted(93, 32) Source(102, 51) + SourceIndex(0) +9 >Emitted(93, 34) Source(102, 53) + SourceIndex(0) +10>Emitted(93, 40) Source(102, 59) + SourceIndex(0) +11>Emitted(93, 41) Source(102, 60) + SourceIndex(0) +12>Emitted(93, 43) Source(102, 44) + SourceIndex(0) +13>Emitted(93, 59) Source(102, 60) + SourceIndex(0) +14>Emitted(93, 61) Source(102, 44) + SourceIndex(0) +15>Emitted(93, 66) Source(102, 60) + SourceIndex(0) +16>Emitted(93, 67) Source(102, 61) + SourceIndex(0) +--- +>>> var _71 = _70[_69], _72 = _71[0], numberA3 = _72 === void 0 ? -1 : _72, robotAInfo = _71.slice(1); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > let [numberA3 = -1, ...robotAInfo] +3 > +4 > numberA3 = -1 +5 > +6 > numberA3 = -1 +7 > , +8 > ...robotAInfo +1->Emitted(94, 5) Source(102, 6) + SourceIndex(0) +2 >Emitted(94, 23) Source(102, 40) + SourceIndex(0) +3 >Emitted(94, 25) Source(102, 11) + SourceIndex(0) +4 >Emitted(94, 37) Source(102, 24) + SourceIndex(0) +5 >Emitted(94, 39) Source(102, 11) + SourceIndex(0) +6 >Emitted(94, 75) Source(102, 24) + SourceIndex(0) +7 >Emitted(94, 77) Source(102, 26) + SourceIndex(0) +8 >Emitted(94, 102) Source(102, 39) + SourceIndex(0) +--- +>>> console.log(numberA3); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1 >] of [robotA, robotB]) { + > +2 > console +3 > . +4 > log +5 > ( +6 > numberA3 +7 > ) +8 > ; +1 >Emitted(95, 5) Source(103, 5) + SourceIndex(0) +2 >Emitted(95, 12) Source(103, 12) + SourceIndex(0) +3 >Emitted(95, 13) Source(103, 13) + SourceIndex(0) +4 >Emitted(95, 16) Source(103, 16) + SourceIndex(0) +5 >Emitted(95, 17) Source(103, 17) + SourceIndex(0) +6 >Emitted(95, 25) Source(103, 25) + SourceIndex(0) +7 >Emitted(95, 26) Source(103, 26) + SourceIndex(0) +8 >Emitted(95, 27) Source(103, 27) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(96, 2) Source(104, 2) + SourceIndex(0) +--- +>>>//# sourceMappingURL=sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.symbols b/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.symbols new file mode 100644 index 00000000000..b398a8e6af5 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.symbols @@ -0,0 +1,325 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts === +declare var console: { +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 0, 11)) + + log(msg: any): void; +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 0, 22)) +>msg : Symbol(msg, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 1, 8)) +} +type Robot = [number, string, string]; +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 2, 1)) + +type MultiSkilledRobot = [string, [string, string]]; +>MultiSkilledRobot : Symbol(MultiSkilledRobot, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 3, 38)) + +let robotA: Robot = [1, "mower", "mowing"]; +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 6, 3)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 2, 1)) + +let robotB: Robot = [2, "trimmer", "trimming"]; +>robotB : Symbol(robotB, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 7, 3)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 2, 1)) + +let robots = [robotA, robotB]; +>robots : Symbol(robots, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 8, 3)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 6, 3)) +>robotB : Symbol(robotB, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 7, 3)) + +function getRobots() { +>getRobots : Symbol(getRobots, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 8, 30)) + + return robots; +>robots : Symbol(robots, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 8, 3)) +} + +let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; +>multiRobotA : Symbol(multiRobotA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 13, 3)) +>MultiSkilledRobot : Symbol(MultiSkilledRobot, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 3, 38)) + +let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; +>multiRobotB : Symbol(multiRobotB, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 14, 3)) +>MultiSkilledRobot : Symbol(MultiSkilledRobot, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 3, 38)) + +let multiRobots = [multiRobotA, multiRobotB]; +>multiRobots : Symbol(multiRobots, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 15, 3)) +>multiRobotA : Symbol(multiRobotA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 13, 3)) +>multiRobotB : Symbol(multiRobotB, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 14, 3)) + +function getMultiRobots() { +>getMultiRobots : Symbol(getMultiRobots, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 15, 45)) + + return multiRobots; +>multiRobots : Symbol(multiRobots, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 15, 3)) +} + +for (let [, nameA = "noName"] of robots) { +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 20, 11)) +>robots : Symbol(robots, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 8, 3)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 20, 11)) +} +for (let [, nameA = "noName"] of getRobots()) { +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 23, 11)) +>getRobots : Symbol(getRobots, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 8, 30)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 23, 11)) +} +for (let [, nameA = "noName"] of [robotA, robotB]) { +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 26, 11)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 6, 3)) +>robotB : Symbol(robotB, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 7, 3)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 26, 11)) +} +for (let [, [ + primarySkillA = "primary", +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 29, 13)) + + secondarySkillA = "secondary" +>secondarySkillA : Symbol(secondarySkillA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 30, 30)) + +] = ["skill1", "skill2"]] of multiRobots) { +>multiRobots : Symbol(multiRobots, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 15, 3)) + + console.log(primarySkillA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 0, 22)) +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 29, 13)) +} +for (let [, [ + primarySkillA = "primary", +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 35, 13)) + + secondarySkillA = "secondary" +>secondarySkillA : Symbol(secondarySkillA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 36, 30)) + +] = ["skill1", "skill2"]] of getMultiRobots()) { +>getMultiRobots : Symbol(getMultiRobots, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 15, 45)) + + console.log(primarySkillA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 0, 22)) +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 35, 13)) +} +for (let [, [ + primarySkillA = "primary", +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 41, 13)) + + secondarySkillA = "secondary" +>secondarySkillA : Symbol(secondarySkillA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 42, 30)) + +] = ["skill1", "skill2"]] of [multiRobotA, multiRobotB]) { +>multiRobotA : Symbol(multiRobotA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 13, 3)) +>multiRobotB : Symbol(multiRobotB, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 14, 3)) + + console.log(primarySkillA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 0, 22)) +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 41, 13)) +} + +for (let [numberB = -1] of robots) { +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 48, 10)) +>robots : Symbol(robots, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 8, 3)) + + console.log(numberB); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 0, 22)) +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 48, 10)) +} +for (let [numberB = -1] of getRobots()) { +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 51, 10)) +>getRobots : Symbol(getRobots, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 8, 30)) + + console.log(numberB); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 0, 22)) +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 51, 10)) +} +for (let [numberB = -1] of [robotA, robotB]) { +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 54, 10)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 6, 3)) +>robotB : Symbol(robotB, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 7, 3)) + + console.log(numberB); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 0, 22)) +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 54, 10)) +} +for (let [nameB = "noName"] of multiRobots) { +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 57, 10)) +>multiRobots : Symbol(multiRobots, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 15, 3)) + + console.log(nameB); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 0, 22)) +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 57, 10)) +} +for (let [nameB = "noName"] of getMultiRobots()) { +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 60, 10)) +>getMultiRobots : Symbol(getMultiRobots, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 15, 45)) + + console.log(nameB); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 0, 22)) +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 60, 10)) +} +for (let [nameB = "noName"] of [multiRobotA, multiRobotB]) { +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 63, 10)) +>multiRobotA : Symbol(multiRobotA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 13, 3)) +>multiRobotB : Symbol(multiRobotB, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 14, 3)) + + console.log(nameB); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 0, 22)) +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 63, 10)) +} + +for (let [numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of robots) { +>numberA2 : Symbol(numberA2, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 67, 10)) +>nameA2 : Symbol(nameA2, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 67, 24)) +>skillA2 : Symbol(skillA2, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 67, 43)) +>robots : Symbol(robots, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 8, 3)) + + console.log(nameA2); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 0, 22)) +>nameA2 : Symbol(nameA2, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 67, 24)) +} +for (let [numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of getRobots()) { +>numberA2 : Symbol(numberA2, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 70, 10)) +>nameA2 : Symbol(nameA2, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 70, 24)) +>skillA2 : Symbol(skillA2, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 70, 43)) +>getRobots : Symbol(getRobots, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 8, 30)) + + console.log(nameA2); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 0, 22)) +>nameA2 : Symbol(nameA2, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 70, 24)) +} +for (let [numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of [robotA, robotB]) { +>numberA2 : Symbol(numberA2, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 73, 10)) +>nameA2 : Symbol(nameA2, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 73, 24)) +>skillA2 : Symbol(skillA2, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 73, 43)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 6, 3)) +>robotB : Symbol(robotB, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 7, 3)) + + console.log(nameA2); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 0, 22)) +>nameA2 : Symbol(nameA2, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 73, 24)) +} +for (let [nameMA = "noName", [ +>nameMA : Symbol(nameMA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 76, 10)) + + primarySkillA = "primary", +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 76, 30)) + + secondarySkillA = "secondary" +>secondarySkillA : Symbol(secondarySkillA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 77, 30)) + +] = ["skill1", "skill2"]] of multiRobots) { +>multiRobots : Symbol(multiRobots, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 15, 3)) + + console.log(nameMA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 0, 22)) +>nameMA : Symbol(nameMA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 76, 10)) +} +for (let [nameMA = "noName", [ +>nameMA : Symbol(nameMA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 82, 10)) + + primarySkillA = "primary", +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 82, 30)) + + secondarySkillA = "secondary" +>secondarySkillA : Symbol(secondarySkillA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 83, 30)) + +] = ["skill1", "skill2"]] of getMultiRobots()) { +>getMultiRobots : Symbol(getMultiRobots, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 15, 45)) + + console.log(nameMA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 0, 22)) +>nameMA : Symbol(nameMA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 82, 10)) +} +for (let [nameMA = "noName", [ +>nameMA : Symbol(nameMA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 88, 10)) + + primarySkillA = "primary", +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 88, 30)) + + secondarySkillA = "secondary" +>secondarySkillA : Symbol(secondarySkillA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 89, 30)) + +] = ["skill1", "skill2"]] of [multiRobotA, multiRobotB]) { +>multiRobotA : Symbol(multiRobotA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 13, 3)) +>multiRobotB : Symbol(multiRobotB, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 14, 3)) + + console.log(nameMA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 0, 22)) +>nameMA : Symbol(nameMA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 88, 10)) +} + +for (let [numberA3 = -1, ...robotAInfo] of robots) { +>numberA3 : Symbol(numberA3, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 95, 10)) +>robotAInfo : Symbol(robotAInfo, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 95, 24)) +>robots : Symbol(robots, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 8, 3)) + + console.log(numberA3); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 0, 22)) +>numberA3 : Symbol(numberA3, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 95, 10)) +} +for (let [numberA3 = -1, ...robotAInfo] of getRobots()) { +>numberA3 : Symbol(numberA3, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 98, 10)) +>robotAInfo : Symbol(robotAInfo, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 98, 24)) +>getRobots : Symbol(getRobots, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 8, 30)) + + console.log(numberA3); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 0, 22)) +>numberA3 : Symbol(numberA3, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 98, 10)) +} +for (let [numberA3 = -1, ...robotAInfo] of [robotA, robotB]) { +>numberA3 : Symbol(numberA3, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 101, 10)) +>robotAInfo : Symbol(robotAInfo, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 101, 24)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 6, 3)) +>robotB : Symbol(robotB, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 7, 3)) + + console.log(numberA3); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 0, 22)) +>numberA3 : Symbol(numberA3, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts, 101, 10)) +} diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.types b/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.types new file mode 100644 index 00000000000..488b5c46145 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.types @@ -0,0 +1,452 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts === +declare var console: { +>console : { log(msg: any): void; } + + log(msg: any): void; +>log : (msg: any) => void +>msg : any +} +type Robot = [number, string, string]; +>Robot : [number, string, string] + +type MultiSkilledRobot = [string, [string, string]]; +>MultiSkilledRobot : [string, [string, string]] + +let robotA: Robot = [1, "mower", "mowing"]; +>robotA : [number, string, string] +>Robot : [number, string, string] +>[1, "mower", "mowing"] : [number, string, string] +>1 : number +>"mower" : string +>"mowing" : string + +let robotB: Robot = [2, "trimmer", "trimming"]; +>robotB : [number, string, string] +>Robot : [number, string, string] +>[2, "trimmer", "trimming"] : [number, string, string] +>2 : number +>"trimmer" : string +>"trimming" : string + +let robots = [robotA, robotB]; +>robots : [number, string, string][] +>[robotA, robotB] : [number, string, string][] +>robotA : [number, string, string] +>robotB : [number, string, string] + +function getRobots() { +>getRobots : () => [number, string, string][] + + return robots; +>robots : [number, string, string][] +} + +let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; +>multiRobotA : [string, [string, string]] +>MultiSkilledRobot : [string, [string, string]] +>["mower", ["mowing", ""]] : [string, [string, string]] +>"mower" : string +>["mowing", ""] : [string, string] +>"mowing" : string +>"" : string + +let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; +>multiRobotB : [string, [string, string]] +>MultiSkilledRobot : [string, [string, string]] +>["trimmer", ["trimming", "edging"]] : [string, [string, string]] +>"trimmer" : string +>["trimming", "edging"] : [string, string] +>"trimming" : string +>"edging" : string + +let multiRobots = [multiRobotA, multiRobotB]; +>multiRobots : [string, [string, string]][] +>[multiRobotA, multiRobotB] : [string, [string, string]][] +>multiRobotA : [string, [string, string]] +>multiRobotB : [string, [string, string]] + +function getMultiRobots() { +>getMultiRobots : () => [string, [string, string]][] + + return multiRobots; +>multiRobots : [string, [string, string]][] +} + +for (let [, nameA = "noName"] of robots) { +> : undefined +>nameA : string +>"noName" : string +>robots : [number, string, string][] + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for (let [, nameA = "noName"] of getRobots()) { +> : undefined +>nameA : string +>"noName" : string +>getRobots() : [number, string, string][] +>getRobots : () => [number, string, string][] + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for (let [, nameA = "noName"] of [robotA, robotB]) { +> : undefined +>nameA : string +>"noName" : string +>[robotA, robotB] : [number, string, string][] +>robotA : [number, string, string] +>robotB : [number, string, string] + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for (let [, [ +> : undefined + + primarySkillA = "primary", +>primarySkillA : string +>"primary" : string + + secondarySkillA = "secondary" +>secondarySkillA : string +>"secondary" : string + +] = ["skill1", "skill2"]] of multiRobots) { +>["skill1", "skill2"] : [string, string] +>"skill1" : string +>"skill2" : string +>multiRobots : [string, [string, string]][] + + console.log(primarySkillA); +>console.log(primarySkillA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primarySkillA : string +} +for (let [, [ +> : undefined + + primarySkillA = "primary", +>primarySkillA : string +>"primary" : string + + secondarySkillA = "secondary" +>secondarySkillA : string +>"secondary" : string + +] = ["skill1", "skill2"]] of getMultiRobots()) { +>["skill1", "skill2"] : [string, string] +>"skill1" : string +>"skill2" : string +>getMultiRobots() : [string, [string, string]][] +>getMultiRobots : () => [string, [string, string]][] + + console.log(primarySkillA); +>console.log(primarySkillA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primarySkillA : string +} +for (let [, [ +> : undefined + + primarySkillA = "primary", +>primarySkillA : string +>"primary" : string + + secondarySkillA = "secondary" +>secondarySkillA : string +>"secondary" : string + +] = ["skill1", "skill2"]] of [multiRobotA, multiRobotB]) { +>["skill1", "skill2"] : [string, string] +>"skill1" : string +>"skill2" : string +>[multiRobotA, multiRobotB] : [string, [string, string]][] +>multiRobotA : [string, [string, string]] +>multiRobotB : [string, [string, string]] + + console.log(primarySkillA); +>console.log(primarySkillA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primarySkillA : string +} + +for (let [numberB = -1] of robots) { +>numberB : number +>-1 : number +>1 : number +>robots : [number, string, string][] + + console.log(numberB); +>console.log(numberB) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>numberB : number +} +for (let [numberB = -1] of getRobots()) { +>numberB : number +>-1 : number +>1 : number +>getRobots() : [number, string, string][] +>getRobots : () => [number, string, string][] + + console.log(numberB); +>console.log(numberB) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>numberB : number +} +for (let [numberB = -1] of [robotA, robotB]) { +>numberB : number +>-1 : number +>1 : number +>[robotA, robotB] : [number, string, string][] +>robotA : [number, string, string] +>robotB : [number, string, string] + + console.log(numberB); +>console.log(numberB) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>numberB : number +} +for (let [nameB = "noName"] of multiRobots) { +>nameB : string +>"noName" : string +>multiRobots : [string, [string, string]][] + + console.log(nameB); +>console.log(nameB) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameB : string +} +for (let [nameB = "noName"] of getMultiRobots()) { +>nameB : string +>"noName" : string +>getMultiRobots() : [string, [string, string]][] +>getMultiRobots : () => [string, [string, string]][] + + console.log(nameB); +>console.log(nameB) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameB : string +} +for (let [nameB = "noName"] of [multiRobotA, multiRobotB]) { +>nameB : string +>"noName" : string +>[multiRobotA, multiRobotB] : [string, [string, string]][] +>multiRobotA : [string, [string, string]] +>multiRobotB : [string, [string, string]] + + console.log(nameB); +>console.log(nameB) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameB : string +} + +for (let [numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of robots) { +>numberA2 : number +>-1 : number +>1 : number +>nameA2 : string +>"noName" : string +>skillA2 : string +>"skill" : string +>robots : [number, string, string][] + + console.log(nameA2); +>console.log(nameA2) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA2 : string +} +for (let [numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of getRobots()) { +>numberA2 : number +>-1 : number +>1 : number +>nameA2 : string +>"noName" : string +>skillA2 : string +>"skill" : string +>getRobots() : [number, string, string][] +>getRobots : () => [number, string, string][] + + console.log(nameA2); +>console.log(nameA2) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA2 : string +} +for (let [numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of [robotA, robotB]) { +>numberA2 : number +>-1 : number +>1 : number +>nameA2 : string +>"noName" : string +>skillA2 : string +>"skill" : string +>[robotA, robotB] : [number, string, string][] +>robotA : [number, string, string] +>robotB : [number, string, string] + + console.log(nameA2); +>console.log(nameA2) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA2 : string +} +for (let [nameMA = "noName", [ +>nameMA : string +>"noName" : string + + primarySkillA = "primary", +>primarySkillA : string +>"primary" : string + + secondarySkillA = "secondary" +>secondarySkillA : string +>"secondary" : string + +] = ["skill1", "skill2"]] of multiRobots) { +>["skill1", "skill2"] : [string, string] +>"skill1" : string +>"skill2" : string +>multiRobots : [string, [string, string]][] + + console.log(nameMA); +>console.log(nameMA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameMA : string +} +for (let [nameMA = "noName", [ +>nameMA : string +>"noName" : string + + primarySkillA = "primary", +>primarySkillA : string +>"primary" : string + + secondarySkillA = "secondary" +>secondarySkillA : string +>"secondary" : string + +] = ["skill1", "skill2"]] of getMultiRobots()) { +>["skill1", "skill2"] : [string, string] +>"skill1" : string +>"skill2" : string +>getMultiRobots() : [string, [string, string]][] +>getMultiRobots : () => [string, [string, string]][] + + console.log(nameMA); +>console.log(nameMA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameMA : string +} +for (let [nameMA = "noName", [ +>nameMA : string +>"noName" : string + + primarySkillA = "primary", +>primarySkillA : string +>"primary" : string + + secondarySkillA = "secondary" +>secondarySkillA : string +>"secondary" : string + +] = ["skill1", "skill2"]] of [multiRobotA, multiRobotB]) { +>["skill1", "skill2"] : [string, string] +>"skill1" : string +>"skill2" : string +>[multiRobotA, multiRobotB] : [string, [string, string]][] +>multiRobotA : [string, [string, string]] +>multiRobotB : [string, [string, string]] + + console.log(nameMA); +>console.log(nameMA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameMA : string +} + +for (let [numberA3 = -1, ...robotAInfo] of robots) { +>numberA3 : number +>-1 : number +>1 : number +>robotAInfo : (number | string)[] +>robots : [number, string, string][] + + console.log(numberA3); +>console.log(numberA3) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>numberA3 : number +} +for (let [numberA3 = -1, ...robotAInfo] of getRobots()) { +>numberA3 : number +>-1 : number +>1 : number +>robotAInfo : (number | string)[] +>getRobots() : [number, string, string][] +>getRobots : () => [number, string, string][] + + console.log(numberA3); +>console.log(numberA3) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>numberA3 : number +} +for (let [numberA3 = -1, ...robotAInfo] of [robotA, robotB]) { +>numberA3 : number +>-1 : number +>1 : number +>robotAInfo : (number | string)[] +>[robotA, robotB] : [number, string, string][] +>robotA : [number, string, string] +>robotB : [number, string, string] + + console.log(numberA3); +>console.log(numberA3) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>numberA3 : number +} diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.js b/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.js new file mode 100644 index 00000000000..9cff7412ea9 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.js @@ -0,0 +1,214 @@ +//// [sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts] +declare var console: { + log(msg: any): void; +} +type Robot = [number, string, string]; +type MultiSkilledRobot = [string, [string, string]]; + +let robotA: Robot = [1, "mower", "mowing"]; +let robotB: Robot = [2, "trimmer", "trimming"]; +let robots = [robotA, robotB]; +function getRobots() { + return robots; +} + +let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; +let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; +let multiRobots = [multiRobotA, multiRobotB]; +function getMultiRobots() { + return multiRobots; +} + +let nameA: string, primarySkillA: string, secondarySkillA: string; +let numberB: number, nameB: string; +let numberA2: number, nameA2: string, skillA2: string, nameMA: string; +let numberA3: number, robotAInfo: (number | string)[], multiRobotAInfo: (string | [string, string])[]; + +for ([, nameA = "noName"] of robots) { + console.log(nameA); +} +for ([, nameA = "noName"] of getRobots()) { + console.log(nameA); +} +for ([, nameA = "noName"] of [robotA, robotB]) { + console.log(nameA); +} +for ([, [ + primarySkillA = "primary", + secondarySkillA = "secondary" +] = ["skill1", "skill2"]] of multiRobots) { + console.log(primarySkillA); +} +for ([, [ + primarySkillA = "primary", + secondarySkillA = "secondary" +] = ["skill1", "skill2"]] of getMultiRobots()) { + console.log(primarySkillA); +} +for ([, [ + primarySkillA = "primary", + secondarySkillA = "secondary" +] = ["skill1", "skill2"]] of [multiRobotA, multiRobotB]) { + console.log(primarySkillA); +} + +for ([numberB = -1] of robots) { + console.log(numberB); +} +for ([numberB = -1] of getRobots()) { + console.log(numberB); +} +for ([numberB = -1] of [robotA, robotB]) { + console.log(numberB); +} +for ([nameB = "noName"] of multiRobots) { + console.log(nameB); +} +for ([nameB = "noName"] of getMultiRobots()) { + console.log(nameB); +} +for ([nameB = "noName"] of [multiRobotA, multiRobotB]) { + console.log(nameB); +} + +for ([numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of robots) { + console.log(nameA2); +} +for ([numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of getRobots()) { + console.log(nameA2); +} +for ([numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of [robotA, robotB]) { + console.log(nameA2); +} +for ([nameMA = "noName", [ + primarySkillA = "primary", + secondarySkillA = "secondary" +] = ["skill1", "skill2"]] of multiRobots) { + console.log(nameMA); +} +for ([nameMA = "noName", [ + primarySkillA = "primary", + secondarySkillA = "secondary" +] = ["skill1", "skill2"]] of getMultiRobots()) { + console.log(nameMA); +} +for ([nameMA = "noName", [ + primarySkillA = "primary", + secondarySkillA = "secondary" +] = ["skill1", "skill2"]] of [multiRobotA, multiRobotB]) { + console.log(nameMA); +} + +for ([numberA3 = -1, ...robotAInfo] of robots) { + console.log(numberA3); +} +for ([numberA3 = -1, ...robotAInfo] of getRobots()) { + console.log(numberA3); +} +for ([numberA3 = -1, ...robotAInfo] of [robotA, robotB]) { + console.log(numberA3); +} + +//// [sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.js] +var robotA = [1, "mower", "mowing"]; +var robotB = [2, "trimmer", "trimming"]; +var robots = [robotA, robotB]; +function getRobots() { + return robots; +} +var multiRobotA = ["mower", ["mowing", ""]]; +var multiRobotB = ["trimmer", ["trimming", "edging"]]; +var multiRobots = [multiRobotA, multiRobotB]; +function getMultiRobots() { + return multiRobots; +} +var nameA, primarySkillA, secondarySkillA; +var numberB, nameB; +var numberA2, nameA2, skillA2, nameMA; +var numberA3, robotAInfo, multiRobotAInfo; +for (var _i = 0, robots_1 = robots; _i < robots_1.length; _i++) { + _a = robots_1[_i], _b = _a[1], nameA = _b === void 0 ? "noName" : _b; + console.log(nameA); +} +for (var _c = 0, _d = getRobots(); _c < _d.length; _c++) { + _e = _d[_c], _f = _e[1], nameA = _f === void 0 ? "noName" : _f; + console.log(nameA); +} +for (var _g = 0, _h = [robotA, robotB]; _g < _h.length; _g++) { + _j = _h[_g], _k = _j[1], nameA = _k === void 0 ? "noName" : _k; + console.log(nameA); +} +for (var _l = 0, multiRobots_1 = multiRobots; _l < multiRobots_1.length; _l++) { + _m = multiRobots_1[_l], _o = _m[1], _p = _o === void 0 ? ["skill1", "skill2"] : _o, _q = _p[0], primarySkillA = _q === void 0 ? "primary" : _q, _r = _p[1], secondarySkillA = _r === void 0 ? "secondary" : _r; + console.log(primarySkillA); +} +for (var _s = 0, _t = getMultiRobots(); _s < _t.length; _s++) { + _u = _t[_s], _v = _u[1], _w = _v === void 0 ? ["skill1", "skill2"] : _v, _x = _w[0], primarySkillA = _x === void 0 ? "primary" : _x, _y = _w[1], secondarySkillA = _y === void 0 ? "secondary" : _y; + console.log(primarySkillA); +} +for (var _z = 0, _0 = [multiRobotA, multiRobotB]; _z < _0.length; _z++) { + _1 = _0[_z], _2 = _1[1], _3 = _2 === void 0 ? ["skill1", "skill2"] : _2, _4 = _3[0], primarySkillA = _4 === void 0 ? "primary" : _4, _5 = _3[1], secondarySkillA = _5 === void 0 ? "secondary" : _5; + console.log(primarySkillA); +} +for (var _6 = 0, robots_2 = robots; _6 < robots_2.length; _6++) { + _7 = robots_2[_6][0], numberB = _7 === void 0 ? -1 : _7; + console.log(numberB); +} +for (var _8 = 0, _9 = getRobots(); _8 < _9.length; _8++) { + _10 = _9[_8][0], numberB = _10 === void 0 ? -1 : _10; + console.log(numberB); +} +for (var _11 = 0, _12 = [robotA, robotB]; _11 < _12.length; _11++) { + _13 = _12[_11][0], numberB = _13 === void 0 ? -1 : _13; + console.log(numberB); +} +for (var _14 = 0, multiRobots_2 = multiRobots; _14 < multiRobots_2.length; _14++) { + _15 = multiRobots_2[_14][0], nameB = _15 === void 0 ? "noName" : _15; + console.log(nameB); +} +for (var _16 = 0, _17 = getMultiRobots(); _16 < _17.length; _16++) { + _18 = _17[_16][0], nameB = _18 === void 0 ? "noName" : _18; + console.log(nameB); +} +for (var _19 = 0, _20 = [multiRobotA, multiRobotB]; _19 < _20.length; _19++) { + _21 = _20[_19][0], nameB = _21 === void 0 ? "noName" : _21; + console.log(nameB); +} +for (var _22 = 0, robots_3 = robots; _22 < robots_3.length; _22++) { + _23 = robots_3[_22], _24 = _23[0], numberA2 = _24 === void 0 ? -1 : _24, _25 = _23[1], nameA2 = _25 === void 0 ? "noName" : _25, _26 = _23[2], skillA2 = _26 === void 0 ? "skill" : _26; + console.log(nameA2); +} +for (var _27 = 0, _28 = getRobots(); _27 < _28.length; _27++) { + _29 = _28[_27], _30 = _29[0], numberA2 = _30 === void 0 ? -1 : _30, _31 = _29[1], nameA2 = _31 === void 0 ? "noName" : _31, _32 = _29[2], skillA2 = _32 === void 0 ? "skill" : _32; + console.log(nameA2); +} +for (var _33 = 0, _34 = [robotA, robotB]; _33 < _34.length; _33++) { + _35 = _34[_33], _36 = _35[0], numberA2 = _36 === void 0 ? -1 : _36, _37 = _35[1], nameA2 = _37 === void 0 ? "noName" : _37, _38 = _35[2], skillA2 = _38 === void 0 ? "skill" : _38; + console.log(nameA2); +} +for (var _39 = 0, multiRobots_3 = multiRobots; _39 < multiRobots_3.length; _39++) { + _40 = multiRobots_3[_39], _41 = _40[0], nameMA = _41 === void 0 ? "noName" : _41, _42 = _40[1], _43 = _42 === void 0 ? ["skill1", "skill2"] : _42, _44 = _43[0], primarySkillA = _44 === void 0 ? "primary" : _44, _45 = _43[1], secondarySkillA = _45 === void 0 ? "secondary" : _45; + console.log(nameMA); +} +for (var _46 = 0, _47 = getMultiRobots(); _46 < _47.length; _46++) { + _48 = _47[_46], _49 = _48[0], nameMA = _49 === void 0 ? "noName" : _49, _50 = _48[1], _51 = _50 === void 0 ? ["skill1", "skill2"] : _50, _52 = _51[0], primarySkillA = _52 === void 0 ? "primary" : _52, _53 = _51[1], secondarySkillA = _53 === void 0 ? "secondary" : _53; + console.log(nameMA); +} +for (var _54 = 0, _55 = [multiRobotA, multiRobotB]; _54 < _55.length; _54++) { + _56 = _55[_54], _57 = _56[0], nameMA = _57 === void 0 ? "noName" : _57, _58 = _56[1], _59 = _58 === void 0 ? ["skill1", "skill2"] : _58, _60 = _59[0], primarySkillA = _60 === void 0 ? "primary" : _60, _61 = _59[1], secondarySkillA = _61 === void 0 ? "secondary" : _61; + console.log(nameMA); +} +for (var _62 = 0, robots_4 = robots; _62 < robots_4.length; _62++) { + _63 = robots_4[_62], _64 = _63[0], numberA3 = _64 === void 0 ? -1 : _64, robotAInfo = _63.slice(1); + console.log(numberA3); +} +for (var _65 = 0, _66 = getRobots(); _65 < _66.length; _65++) { + _67 = _66[_65], _68 = _67[0], numberA3 = _68 === void 0 ? -1 : _68, robotAInfo = _67.slice(1); + console.log(numberA3); +} +for (var _69 = 0, _70 = [robotA, robotB]; _69 < _70.length; _69++) { + _71 = _70[_69], _72 = _71[0], numberA3 = _72 === void 0 ? -1 : _72, robotAInfo = _71.slice(1); + console.log(numberA3); +} +var _a, _b, _e, _f, _j, _k, _m, _o, _p, _q, _r, _u, _v, _w, _x, _y, _1, _2, _3, _4, _5, _7, _10, _13, _15, _18, _21, _23, _24, _25, _26, _29, _30, _31, _32, _35, _36, _37, _38, _40, _41, _42, _43, _44, _45, _48, _49, _50, _51, _52, _53, _56, _57, _58, _59, _60, _61, _63, _64, _67, _68, _71, _72; +//# sourceMappingURL=sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.js.map b/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.js.map new file mode 100644 index 00000000000..ccee72c33bf --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.js.map @@ -0,0 +1,2 @@ +//// [sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.js.map] +{"version":3,"file":"sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.js","sourceRoot":"","sources":["sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts"],"names":[],"mappings":"AAMA,IAAI,MAAM,GAAU,CAAC,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;AAC3C,IAAI,MAAM,GAAU,CAAC,CAAC,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;AAC/C,IAAI,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAC9B;IACI,MAAM,CAAC,MAAM,CAAC;AAClB,CAAC;AAED,IAAI,WAAW,GAAsB,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC;AAC/D,IAAI,WAAW,GAAsB,CAAC,SAAS,EAAE,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC,CAAC;AACzE,IAAI,WAAW,GAAG,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;AAC7C;IACI,MAAM,CAAC,WAAW,CAAC;AACvB,CAAC;AAED,IAAI,KAAa,EAAE,aAAqB,EAAE,eAAuB,CAAC;AAClE,IAAI,OAAe,EAAE,KAAa,CAAC;AACnC,IAAI,QAAgB,EAAE,MAAc,EAAE,OAAe,EAAE,MAAc,CAAC;AACtE,IAAI,QAAgB,EAAE,UAA+B,EAAE,eAA8C,CAAC;AAEtG,GAAG,CAAC,CAAyB,UAAM,EAAN,iBAAM,EAAN,oBAAM,EAAN,IAAM,CAAC;IAA/B,iBAAoB,EAAjB,UAAgB,EAAhB,qCAAgB;IACpB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB;AACD,GAAG,CAAC,CAAyB,UAAW,EAAX,KAAA,SAAS,EAAE,EAAX,cAAW,EAAX,IAAW,CAAC;IAApC,WAAoB,EAAjB,UAAgB,EAAhB,qCAAgB;IACpB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB;AACD,GAAG,CAAC,CAAyB,UAAgB,EAAhB,MAAC,MAAM,EAAE,MAAM,CAAC,EAAhB,cAAgB,EAAhB,IAAgB,CAAC;IAAzC,WAAoB,EAAjB,UAAgB,EAAhB,qCAAgB;IACpB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB;AACD,GAAG,CAAC,CAGyB,UAAW,EAAX,2BAAW,EAAX,yBAAW,EAAX,IAAW,CAAC;IAHpC,sBAGoB,EAHjB,UAGgB,EAHhB,8CAGgB,EAFpB,UAAyB,EAAzB,8CAAyB,EACzB,UAA6B,EAA7B,kDAA6B;IAE7B,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;CAC9B;AACD,GAAG,CAAC,CAGyB,UAAgB,EAAhB,KAAA,cAAc,EAAE,EAAhB,cAAgB,EAAhB,IAAgB,CAAC;IAHzC,WAGoB,EAHjB,UAGgB,EAHhB,8CAGgB,EAFpB,UAAyB,EAAzB,8CAAyB,EACzB,UAA6B,EAA7B,kDAA6B;IAE7B,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;CAC9B;AACD,GAAG,CAAC,CAGyB,UAA0B,EAA1B,MAAC,WAAW,EAAE,WAAW,CAAC,EAA1B,cAA0B,EAA1B,IAA0B,CAAC;IAHnD,WAGoB,EAHjB,UAGgB,EAHhB,8CAGgB,EAFpB,UAAyB,EAAzB,8CAAyB,EACzB,UAA6B,EAA7B,kDAA6B;IAE7B,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;CAC9B;AAED,GAAG,CAAC,CAAmB,UAAM,EAAN,iBAAM,EAAN,oBAAM,EAAN,IAAM,CAAC;IAAxB,oBAAY,EAAZ,iCAAY;IACd,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;CACxB;AACD,GAAG,CAAC,CAAmB,UAAW,EAAX,KAAA,SAAS,EAAE,EAAX,cAAW,EAAX,IAAW,CAAC;IAA7B,eAAY,EAAZ,mCAAY;IACd,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;CACxB;AACD,GAAG,CAAC,CAAmB,WAAgB,EAAhB,OAAC,MAAM,EAAE,MAAM,CAAC,EAAhB,gBAAgB,EAAhB,KAAgB,CAAC;IAAlC,iBAAY,EAAZ,mCAAY;IACd,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;CACxB;AACD,GAAG,CAAC,CAAuB,WAAW,EAAX,2BAAW,EAAX,0BAAW,EAAX,KAAW,CAAC;IAAjC,2BAAgB,EAAhB,uCAAgB;IAClB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB;AACD,GAAG,CAAC,CAAuB,WAAgB,EAAhB,MAAA,cAAc,EAAE,EAAhB,gBAAgB,EAAhB,KAAgB,CAAC;IAAtC,iBAAgB,EAAhB,uCAAgB;IAClB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB;AACD,GAAG,CAAC,CAAuB,WAA0B,EAA1B,OAAC,WAAW,EAAE,WAAW,CAAC,EAA1B,gBAA0B,EAA1B,KAA0B,CAAC;IAAhD,iBAAgB,EAAhB,uCAAgB;IAClB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB;AAED,GAAG,CAAC,CAA0D,WAAM,EAAN,iBAAM,EAAN,qBAAM,EAAN,KAAM,CAAC;IAAhE,mBAAqD,EAApD,YAAa,EAAb,oCAAa,EAAE,YAAiB,EAAjB,wCAAiB,EAAE,YAAiB,EAAjB,wCAAiB;IACrD,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;CACvB;AACD,GAAG,CAAC,CAA0D,WAAW,EAAX,MAAA,SAAS,EAAE,EAAX,gBAAW,EAAX,KAAW,CAAC;IAArE,cAAqD,EAApD,YAAa,EAAb,oCAAa,EAAE,YAAiB,EAAjB,wCAAiB,EAAE,YAAiB,EAAjB,wCAAiB;IACrD,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;CACvB;AACD,GAAG,CAAC,CAA0D,WAAgB,EAAhB,OAAC,MAAM,EAAE,MAAM,CAAC,EAAhB,gBAAgB,EAAhB,KAAgB,CAAC;IAA1E,cAAqD,EAApD,YAAa,EAAb,oCAAa,EAAE,YAAiB,EAAjB,wCAAiB,EAAE,YAAiB,EAAjB,wCAAiB;IACrD,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;CACvB;AACD,GAAG,CAAC,CAGyB,WAAW,EAAX,2BAAW,EAAX,0BAAW,EAAX,KAAW,CAAC;IAHpC,wBAGoB,EAHnB,YAAiB,EAAjB,wCAAiB,EAAE,YAGD,EAHC,iDAGD,EAFpB,YAAyB,EAAzB,gDAAyB,EACzB,YAA6B,EAA7B,oDAA6B;IAE7B,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;CACvB;AACD,GAAG,CAAC,CAGyB,WAAgB,EAAhB,MAAA,cAAc,EAAE,EAAhB,gBAAgB,EAAhB,KAAgB,CAAC;IAHzC,cAGoB,EAHnB,YAAiB,EAAjB,wCAAiB,EAAE,YAGD,EAHC,iDAGD,EAFpB,YAAyB,EAAzB,gDAAyB,EACzB,YAA6B,EAA7B,oDAA6B;IAE7B,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;CACvB;AACD,GAAG,CAAC,CAGyB,WAA0B,EAA1B,OAAC,WAAW,EAAE,WAAW,CAAC,EAA1B,gBAA0B,EAA1B,KAA0B,CAAC;IAHnD,cAGoB,EAHnB,YAAiB,EAAjB,wCAAiB,EAAE,YAGD,EAHC,iDAGD,EAFpB,YAAyB,EAAzB,gDAAyB,EACzB,YAA6B,EAA7B,oDAA6B;IAE7B,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;CACvB;AAED,GAAG,CAAC,CAAmC,WAAM,EAAN,iBAAM,EAAN,qBAAM,EAAN,KAAM,CAAC;IAAzC,mBAA8B,EAA7B,YAAa,EAAb,oCAAa,EAAE,yBAAa;IAC9B,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;CACzB;AACD,GAAG,CAAC,CAAmC,WAAW,EAAX,MAAA,SAAS,EAAE,EAAX,gBAAW,EAAX,KAAW,CAAC;IAA9C,cAA8B,EAA7B,YAAa,EAAb,oCAAa,EAAE,yBAAa;IAC9B,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;CACzB;AACD,GAAG,CAAC,CAAmC,WAAgB,EAAhB,OAAC,MAAM,EAAE,MAAM,CAAC,EAAhB,gBAAgB,EAAhB,KAAgB,CAAC;IAAnD,cAA8B,EAA7B,YAAa,EAAb,oCAAa,EAAE,yBAAa;IAC9B,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;CACzB"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.sourcemap.txt b/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.sourcemap.txt new file mode 100644 index 00000000000..dc11eb52da9 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.sourcemap.txt @@ -0,0 +1,2853 @@ +=================================================================== +JsFile: sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.js +mapUrl: sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.js.map +sourceRoot: +sources: sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.js +sourceFile:sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts +------------------------------------------------------------------- +>>>var robotA = [1, "mower", "mowing"]; +1 > +2 >^^^^ +3 > ^^^^^^ +4 > ^^^ +5 > ^ +6 > ^ +7 > ^^ +8 > ^^^^^^^ +9 > ^^ +10> ^^^^^^^^ +11> ^ +12> ^ +13> ^^^^^-> +1 >declare var console: { + > log(msg: any): void; + >} + >type Robot = [number, string, string]; + >type MultiSkilledRobot = [string, [string, string]]; + > + > +2 >let +3 > robotA +4 > : Robot = +5 > [ +6 > 1 +7 > , +8 > "mower" +9 > , +10> "mowing" +11> ] +12> ; +1 >Emitted(1, 1) Source(7, 1) + SourceIndex(0) +2 >Emitted(1, 5) Source(7, 5) + SourceIndex(0) +3 >Emitted(1, 11) Source(7, 11) + SourceIndex(0) +4 >Emitted(1, 14) Source(7, 21) + SourceIndex(0) +5 >Emitted(1, 15) Source(7, 22) + SourceIndex(0) +6 >Emitted(1, 16) Source(7, 23) + SourceIndex(0) +7 >Emitted(1, 18) Source(7, 25) + SourceIndex(0) +8 >Emitted(1, 25) Source(7, 32) + SourceIndex(0) +9 >Emitted(1, 27) Source(7, 34) + SourceIndex(0) +10>Emitted(1, 35) Source(7, 42) + SourceIndex(0) +11>Emitted(1, 36) Source(7, 43) + SourceIndex(0) +12>Emitted(1, 37) Source(7, 44) + SourceIndex(0) +--- +>>>var robotB = [2, "trimmer", "trimming"]; +1-> +2 >^^^^ +3 > ^^^^^^ +4 > ^^^ +5 > ^ +6 > ^ +7 > ^^ +8 > ^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^ +11> ^ +12> ^ +1-> + > +2 >let +3 > robotB +4 > : Robot = +5 > [ +6 > 2 +7 > , +8 > "trimmer" +9 > , +10> "trimming" +11> ] +12> ; +1->Emitted(2, 1) Source(8, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(8, 5) + SourceIndex(0) +3 >Emitted(2, 11) Source(8, 11) + SourceIndex(0) +4 >Emitted(2, 14) Source(8, 21) + SourceIndex(0) +5 >Emitted(2, 15) Source(8, 22) + SourceIndex(0) +6 >Emitted(2, 16) Source(8, 23) + SourceIndex(0) +7 >Emitted(2, 18) Source(8, 25) + SourceIndex(0) +8 >Emitted(2, 27) Source(8, 34) + SourceIndex(0) +9 >Emitted(2, 29) Source(8, 36) + SourceIndex(0) +10>Emitted(2, 39) Source(8, 46) + SourceIndex(0) +11>Emitted(2, 40) Source(8, 47) + SourceIndex(0) +12>Emitted(2, 41) Source(8, 48) + SourceIndex(0) +--- +>>>var robots = [robotA, robotB]; +1 > +2 >^^^^ +3 > ^^^^^^ +4 > ^^^ +5 > ^ +6 > ^^^^^^ +7 > ^^ +8 > ^^^^^^ +9 > ^ +10> ^ +1 > + > +2 >let +3 > robots +4 > = +5 > [ +6 > robotA +7 > , +8 > robotB +9 > ] +10> ; +1 >Emitted(3, 1) Source(9, 1) + SourceIndex(0) +2 >Emitted(3, 5) Source(9, 5) + SourceIndex(0) +3 >Emitted(3, 11) Source(9, 11) + SourceIndex(0) +4 >Emitted(3, 14) Source(9, 14) + SourceIndex(0) +5 >Emitted(3, 15) Source(9, 15) + SourceIndex(0) +6 >Emitted(3, 21) Source(9, 21) + SourceIndex(0) +7 >Emitted(3, 23) Source(9, 23) + SourceIndex(0) +8 >Emitted(3, 29) Source(9, 29) + SourceIndex(0) +9 >Emitted(3, 30) Source(9, 30) + SourceIndex(0) +10>Emitted(3, 31) Source(9, 31) + SourceIndex(0) +--- +>>>function getRobots() { +1 > +2 >^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(4, 1) Source(10, 1) + SourceIndex(0) +--- +>>> return robots; +1->^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^ +5 > ^ +1->function getRobots() { + > +2 > return +3 > +4 > robots +5 > ; +1->Emitted(5, 5) Source(11, 5) + SourceIndex(0) +2 >Emitted(5, 11) Source(11, 11) + SourceIndex(0) +3 >Emitted(5, 12) Source(11, 12) + SourceIndex(0) +4 >Emitted(5, 18) Source(11, 18) + SourceIndex(0) +5 >Emitted(5, 19) Source(11, 19) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(6, 1) Source(12, 1) + SourceIndex(0) +2 >Emitted(6, 2) Source(12, 2) + SourceIndex(0) +--- +>>>var multiRobotA = ["mower", ["mowing", ""]]; +1-> +2 >^^^^ +3 > ^^^^^^^^^^^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^ +7 > ^^ +8 > ^ +9 > ^^^^^^^^ +10> ^^ +11> ^^ +12> ^ +13> ^ +14> ^ +15> ^^^^^^^^^^^-> +1-> + > + > +2 >let +3 > multiRobotA +4 > : MultiSkilledRobot = +5 > [ +6 > "mower" +7 > , +8 > [ +9 > "mowing" +10> , +11> "" +12> ] +13> ] +14> ; +1->Emitted(7, 1) Source(14, 1) + SourceIndex(0) +2 >Emitted(7, 5) Source(14, 5) + SourceIndex(0) +3 >Emitted(7, 16) Source(14, 16) + SourceIndex(0) +4 >Emitted(7, 19) Source(14, 38) + SourceIndex(0) +5 >Emitted(7, 20) Source(14, 39) + SourceIndex(0) +6 >Emitted(7, 27) Source(14, 46) + SourceIndex(0) +7 >Emitted(7, 29) Source(14, 48) + SourceIndex(0) +8 >Emitted(7, 30) Source(14, 49) + SourceIndex(0) +9 >Emitted(7, 38) Source(14, 57) + SourceIndex(0) +10>Emitted(7, 40) Source(14, 59) + SourceIndex(0) +11>Emitted(7, 42) Source(14, 61) + SourceIndex(0) +12>Emitted(7, 43) Source(14, 62) + SourceIndex(0) +13>Emitted(7, 44) Source(14, 63) + SourceIndex(0) +14>Emitted(7, 45) Source(14, 64) + SourceIndex(0) +--- +>>>var multiRobotB = ["trimmer", ["trimming", "edging"]]; +1-> +2 >^^^^ +3 > ^^^^^^^^^^^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^^ +7 > ^^ +8 > ^ +9 > ^^^^^^^^^^ +10> ^^ +11> ^^^^^^^^ +12> ^ +13> ^ +14> ^ +1-> + > +2 >let +3 > multiRobotB +4 > : MultiSkilledRobot = +5 > [ +6 > "trimmer" +7 > , +8 > [ +9 > "trimming" +10> , +11> "edging" +12> ] +13> ] +14> ; +1->Emitted(8, 1) Source(15, 1) + SourceIndex(0) +2 >Emitted(8, 5) Source(15, 5) + SourceIndex(0) +3 >Emitted(8, 16) Source(15, 16) + SourceIndex(0) +4 >Emitted(8, 19) Source(15, 38) + SourceIndex(0) +5 >Emitted(8, 20) Source(15, 39) + SourceIndex(0) +6 >Emitted(8, 29) Source(15, 48) + SourceIndex(0) +7 >Emitted(8, 31) Source(15, 50) + SourceIndex(0) +8 >Emitted(8, 32) Source(15, 51) + SourceIndex(0) +9 >Emitted(8, 42) Source(15, 61) + SourceIndex(0) +10>Emitted(8, 44) Source(15, 63) + SourceIndex(0) +11>Emitted(8, 52) Source(15, 71) + SourceIndex(0) +12>Emitted(8, 53) Source(15, 72) + SourceIndex(0) +13>Emitted(8, 54) Source(15, 73) + SourceIndex(0) +14>Emitted(8, 55) Source(15, 74) + SourceIndex(0) +--- +>>>var multiRobots = [multiRobotA, multiRobotB]; +1 > +2 >^^^^ +3 > ^^^^^^^^^^^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^ +9 > ^ +10> ^ +1 > + > +2 >let +3 > multiRobots +4 > = +5 > [ +6 > multiRobotA +7 > , +8 > multiRobotB +9 > ] +10> ; +1 >Emitted(9, 1) Source(16, 1) + SourceIndex(0) +2 >Emitted(9, 5) Source(16, 5) + SourceIndex(0) +3 >Emitted(9, 16) Source(16, 16) + SourceIndex(0) +4 >Emitted(9, 19) Source(16, 19) + SourceIndex(0) +5 >Emitted(9, 20) Source(16, 20) + SourceIndex(0) +6 >Emitted(9, 31) Source(16, 31) + SourceIndex(0) +7 >Emitted(9, 33) Source(16, 33) + SourceIndex(0) +8 >Emitted(9, 44) Source(16, 44) + SourceIndex(0) +9 >Emitted(9, 45) Source(16, 45) + SourceIndex(0) +10>Emitted(9, 46) Source(16, 46) + SourceIndex(0) +--- +>>>function getMultiRobots() { +1 > +2 >^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(10, 1) Source(17, 1) + SourceIndex(0) +--- +>>> return multiRobots; +1->^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^ +5 > ^ +1->function getMultiRobots() { + > +2 > return +3 > +4 > multiRobots +5 > ; +1->Emitted(11, 5) Source(18, 5) + SourceIndex(0) +2 >Emitted(11, 11) Source(18, 11) + SourceIndex(0) +3 >Emitted(11, 12) Source(18, 12) + SourceIndex(0) +4 >Emitted(11, 23) Source(18, 23) + SourceIndex(0) +5 >Emitted(11, 24) Source(18, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(12, 1) Source(19, 1) + SourceIndex(0) +2 >Emitted(12, 2) Source(19, 2) + SourceIndex(0) +--- +>>>var nameA, primarySkillA, secondarySkillA; +1-> +2 >^^^^ +3 > ^^^^^ +4 > ^^ +5 > ^^^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^ +8 > ^ +1-> + > + > +2 >let +3 > nameA: string +4 > , +5 > primarySkillA: string +6 > , +7 > secondarySkillA: string +8 > ; +1->Emitted(13, 1) Source(21, 1) + SourceIndex(0) +2 >Emitted(13, 5) Source(21, 5) + SourceIndex(0) +3 >Emitted(13, 10) Source(21, 18) + SourceIndex(0) +4 >Emitted(13, 12) Source(21, 20) + SourceIndex(0) +5 >Emitted(13, 25) Source(21, 41) + SourceIndex(0) +6 >Emitted(13, 27) Source(21, 43) + SourceIndex(0) +7 >Emitted(13, 42) Source(21, 66) + SourceIndex(0) +8 >Emitted(13, 43) Source(21, 67) + SourceIndex(0) +--- +>>>var numberB, nameB; +1 > +2 >^^^^ +3 > ^^^^^^^ +4 > ^^ +5 > ^^^^^ +6 > ^ +7 > ^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >let +3 > numberB: number +4 > , +5 > nameB: string +6 > ; +1 >Emitted(14, 1) Source(22, 1) + SourceIndex(0) +2 >Emitted(14, 5) Source(22, 5) + SourceIndex(0) +3 >Emitted(14, 12) Source(22, 20) + SourceIndex(0) +4 >Emitted(14, 14) Source(22, 22) + SourceIndex(0) +5 >Emitted(14, 19) Source(22, 35) + SourceIndex(0) +6 >Emitted(14, 20) Source(22, 36) + SourceIndex(0) +--- +>>>var numberA2, nameA2, skillA2, nameMA; +1-> +2 >^^^^ +3 > ^^^^^^^^ +4 > ^^ +5 > ^^^^^^ +6 > ^^ +7 > ^^^^^^^ +8 > ^^ +9 > ^^^^^^ +10> ^ +11> ^^^^^-> +1-> + > +2 >let +3 > numberA2: number +4 > , +5 > nameA2: string +6 > , +7 > skillA2: string +8 > , +9 > nameMA: string +10> ; +1->Emitted(15, 1) Source(23, 1) + SourceIndex(0) +2 >Emitted(15, 5) Source(23, 5) + SourceIndex(0) +3 >Emitted(15, 13) Source(23, 21) + SourceIndex(0) +4 >Emitted(15, 15) Source(23, 23) + SourceIndex(0) +5 >Emitted(15, 21) Source(23, 37) + SourceIndex(0) +6 >Emitted(15, 23) Source(23, 39) + SourceIndex(0) +7 >Emitted(15, 30) Source(23, 54) + SourceIndex(0) +8 >Emitted(15, 32) Source(23, 56) + SourceIndex(0) +9 >Emitted(15, 38) Source(23, 70) + SourceIndex(0) +10>Emitted(15, 39) Source(23, 71) + SourceIndex(0) +--- +>>>var numberA3, robotAInfo, multiRobotAInfo; +1-> +2 >^^^^ +3 > ^^^^^^^^ +4 > ^^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^ +8 > ^ +9 > ^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >let +3 > numberA3: number +4 > , +5 > robotAInfo: (number | string)[] +6 > , +7 > multiRobotAInfo: (string | [string, string])[] +8 > ; +1->Emitted(16, 1) Source(24, 1) + SourceIndex(0) +2 >Emitted(16, 5) Source(24, 5) + SourceIndex(0) +3 >Emitted(16, 13) Source(24, 21) + SourceIndex(0) +4 >Emitted(16, 15) Source(24, 23) + SourceIndex(0) +5 >Emitted(16, 25) Source(24, 54) + SourceIndex(0) +6 >Emitted(16, 27) Source(24, 56) + SourceIndex(0) +7 >Emitted(16, 42) Source(24, 102) + SourceIndex(0) +8 >Emitted(16, 43) Source(24, 103) + SourceIndex(0) +--- +>>>for (var _i = 0, robots_1 = robots; _i < robots_1.length; _i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^^^^^^ +10> ^^ +11> ^^^^ +12> ^ +13> ^^^^^^^^^^^-> +1-> + > + > +2 >for +3 > +4 > ([, nameA = "noName"] of +5 > robots +6 > +7 > robots +8 > +9 > robots +10> +11> robots +12> ) +1->Emitted(17, 1) Source(26, 1) + SourceIndex(0) +2 >Emitted(17, 4) Source(26, 4) + SourceIndex(0) +3 >Emitted(17, 5) Source(26, 5) + SourceIndex(0) +4 >Emitted(17, 6) Source(26, 30) + SourceIndex(0) +5 >Emitted(17, 16) Source(26, 36) + SourceIndex(0) +6 >Emitted(17, 18) Source(26, 30) + SourceIndex(0) +7 >Emitted(17, 35) Source(26, 36) + SourceIndex(0) +8 >Emitted(17, 37) Source(26, 30) + SourceIndex(0) +9 >Emitted(17, 57) Source(26, 36) + SourceIndex(0) +10>Emitted(17, 59) Source(26, 30) + SourceIndex(0) +11>Emitted(17, 63) Source(26, 36) + SourceIndex(0) +12>Emitted(17, 64) Source(26, 37) + SourceIndex(0) +--- +>>> _a = robots_1[_i], _b = _a[1], nameA = _b === void 0 ? "noName" : _b; +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > [, nameA = "noName"] +3 > +4 > nameA = "noName" +5 > +6 > nameA = "noName" +1->Emitted(18, 5) Source(26, 6) + SourceIndex(0) +2 >Emitted(18, 22) Source(26, 26) + SourceIndex(0) +3 >Emitted(18, 24) Source(26, 9) + SourceIndex(0) +4 >Emitted(18, 34) Source(26, 25) + SourceIndex(0) +5 >Emitted(18, 36) Source(26, 9) + SourceIndex(0) +6 >Emitted(18, 73) Source(26, 25) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 >] of robots) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(19, 5) Source(27, 5) + SourceIndex(0) +2 >Emitted(19, 12) Source(27, 12) + SourceIndex(0) +3 >Emitted(19, 13) Source(27, 13) + SourceIndex(0) +4 >Emitted(19, 16) Source(27, 16) + SourceIndex(0) +5 >Emitted(19, 17) Source(27, 17) + SourceIndex(0) +6 >Emitted(19, 22) Source(27, 22) + SourceIndex(0) +7 >Emitted(19, 23) Source(27, 23) + SourceIndex(0) +8 >Emitted(19, 24) Source(27, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(20, 2) Source(28, 2) + SourceIndex(0) +--- +>>>for (var _c = 0, _d = getRobots(); _c < _d.length; _c++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^ +8 > ^^^^^^^^^ +9 > ^^ +10> ^^ +11> ^^^^^^^^^^^^^^ +12> ^^ +13> ^^^^ +14> ^ +15> ^^^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > ([, nameA = "noName"] of +5 > getRobots() +6 > +7 > +8 > getRobots +9 > () +10> +11> getRobots() +12> +13> getRobots() +14> ) +1->Emitted(21, 1) Source(29, 1) + SourceIndex(0) +2 >Emitted(21, 4) Source(29, 4) + SourceIndex(0) +3 >Emitted(21, 5) Source(29, 5) + SourceIndex(0) +4 >Emitted(21, 6) Source(29, 30) + SourceIndex(0) +5 >Emitted(21, 16) Source(29, 41) + SourceIndex(0) +6 >Emitted(21, 18) Source(29, 30) + SourceIndex(0) +7 >Emitted(21, 23) Source(29, 30) + SourceIndex(0) +8 >Emitted(21, 32) Source(29, 39) + SourceIndex(0) +9 >Emitted(21, 34) Source(29, 41) + SourceIndex(0) +10>Emitted(21, 36) Source(29, 30) + SourceIndex(0) +11>Emitted(21, 50) Source(29, 41) + SourceIndex(0) +12>Emitted(21, 52) Source(29, 30) + SourceIndex(0) +13>Emitted(21, 56) Source(29, 41) + SourceIndex(0) +14>Emitted(21, 57) Source(29, 42) + SourceIndex(0) +--- +>>> _e = _d[_c], _f = _e[1], nameA = _f === void 0 ? "noName" : _f; +1->^^^^ +2 > ^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > [, nameA = "noName"] +3 > +4 > nameA = "noName" +5 > +6 > nameA = "noName" +1->Emitted(22, 5) Source(29, 6) + SourceIndex(0) +2 >Emitted(22, 16) Source(29, 26) + SourceIndex(0) +3 >Emitted(22, 18) Source(29, 9) + SourceIndex(0) +4 >Emitted(22, 28) Source(29, 25) + SourceIndex(0) +5 >Emitted(22, 30) Source(29, 9) + SourceIndex(0) +6 >Emitted(22, 67) Source(29, 25) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 >] of getRobots()) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(23, 5) Source(30, 5) + SourceIndex(0) +2 >Emitted(23, 12) Source(30, 12) + SourceIndex(0) +3 >Emitted(23, 13) Source(30, 13) + SourceIndex(0) +4 >Emitted(23, 16) Source(30, 16) + SourceIndex(0) +5 >Emitted(23, 17) Source(30, 17) + SourceIndex(0) +6 >Emitted(23, 22) Source(30, 22) + SourceIndex(0) +7 >Emitted(23, 23) Source(30, 23) + SourceIndex(0) +8 >Emitted(23, 24) Source(30, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(24, 2) Source(31, 2) + SourceIndex(0) +--- +>>>for (var _g = 0, _h = [robotA, robotB]; _g < _h.length; _g++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^ +8 > ^^^^^^ +9 > ^^ +10> ^^^^^^ +11> ^ +12> ^^ +13> ^^^^^^^^^^^^^^ +14> ^^ +15> ^^^^ +16> ^ +17> ^^^^^^^-> +1-> + > +2 >for +3 > +4 > ([, nameA = "noName"] of +5 > [robotA, robotB] +6 > +7 > [ +8 > robotA +9 > , +10> robotB +11> ] +12> +13> [robotA, robotB] +14> +15> [robotA, robotB] +16> ) +1->Emitted(25, 1) Source(32, 1) + SourceIndex(0) +2 >Emitted(25, 4) Source(32, 4) + SourceIndex(0) +3 >Emitted(25, 5) Source(32, 5) + SourceIndex(0) +4 >Emitted(25, 6) Source(32, 30) + SourceIndex(0) +5 >Emitted(25, 16) Source(32, 46) + SourceIndex(0) +6 >Emitted(25, 18) Source(32, 30) + SourceIndex(0) +7 >Emitted(25, 24) Source(32, 31) + SourceIndex(0) +8 >Emitted(25, 30) Source(32, 37) + SourceIndex(0) +9 >Emitted(25, 32) Source(32, 39) + SourceIndex(0) +10>Emitted(25, 38) Source(32, 45) + SourceIndex(0) +11>Emitted(25, 39) Source(32, 46) + SourceIndex(0) +12>Emitted(25, 41) Source(32, 30) + SourceIndex(0) +13>Emitted(25, 55) Source(32, 46) + SourceIndex(0) +14>Emitted(25, 57) Source(32, 30) + SourceIndex(0) +15>Emitted(25, 61) Source(32, 46) + SourceIndex(0) +16>Emitted(25, 62) Source(32, 47) + SourceIndex(0) +--- +>>> _j = _h[_g], _k = _j[1], nameA = _k === void 0 ? "noName" : _k; +1->^^^^ +2 > ^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > [, nameA = "noName"] +3 > +4 > nameA = "noName" +5 > +6 > nameA = "noName" +1->Emitted(26, 5) Source(32, 6) + SourceIndex(0) +2 >Emitted(26, 16) Source(32, 26) + SourceIndex(0) +3 >Emitted(26, 18) Source(32, 9) + SourceIndex(0) +4 >Emitted(26, 28) Source(32, 25) + SourceIndex(0) +5 >Emitted(26, 30) Source(32, 9) + SourceIndex(0) +6 >Emitted(26, 67) Source(32, 25) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 >] of [robotA, robotB]) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(27, 5) Source(33, 5) + SourceIndex(0) +2 >Emitted(27, 12) Source(33, 12) + SourceIndex(0) +3 >Emitted(27, 13) Source(33, 13) + SourceIndex(0) +4 >Emitted(27, 16) Source(33, 16) + SourceIndex(0) +5 >Emitted(27, 17) Source(33, 17) + SourceIndex(0) +6 >Emitted(27, 22) Source(33, 22) + SourceIndex(0) +7 >Emitted(27, 23) Source(33, 23) + SourceIndex(0) +8 >Emitted(27, 24) Source(33, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(28, 2) Source(34, 2) + SourceIndex(0) +--- +>>>for (var _l = 0, multiRobots_1 = multiRobots; _l < multiRobots_1.length; _l++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^^^^^^^^^^^ +10> ^^ +11> ^^^^ +12> ^ +13> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > ([, [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["skill1", "skill2"]] of +5 > multiRobots +6 > +7 > multiRobots +8 > +9 > multiRobots +10> +11> multiRobots +12> ) +1->Emitted(29, 1) Source(35, 1) + SourceIndex(0) +2 >Emitted(29, 4) Source(35, 4) + SourceIndex(0) +3 >Emitted(29, 5) Source(35, 5) + SourceIndex(0) +4 >Emitted(29, 6) Source(38, 30) + SourceIndex(0) +5 >Emitted(29, 16) Source(38, 41) + SourceIndex(0) +6 >Emitted(29, 18) Source(38, 30) + SourceIndex(0) +7 >Emitted(29, 45) Source(38, 41) + SourceIndex(0) +8 >Emitted(29, 47) Source(38, 30) + SourceIndex(0) +9 >Emitted(29, 72) Source(38, 41) + SourceIndex(0) +10>Emitted(29, 74) Source(38, 30) + SourceIndex(0) +11>Emitted(29, 78) Source(38, 41) + SourceIndex(0) +12>Emitted(29, 79) Source(38, 42) + SourceIndex(0) +--- +>>> _m = multiRobots_1[_l], _o = _m[1], _p = _o === void 0 ? ["skill1", "skill2"] : _o, _q = _p[0], primarySkillA = _q === void 0 ? "primary" : _q, _r = _p[1], secondarySkillA = _r === void 0 ? "secondary" : _r; +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > [, [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["skill1", "skill2"]] +3 > +4 > [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["skill1", "skill2"] +5 > +6 > [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["skill1", "skill2"] +7 > +8 > primarySkillA = "primary" +9 > +10> primarySkillA = "primary" +11> , + > +12> secondarySkillA = "secondary" +13> +14> secondarySkillA = "secondary" +1->Emitted(30, 5) Source(35, 6) + SourceIndex(0) +2 >Emitted(30, 27) Source(38, 26) + SourceIndex(0) +3 >Emitted(30, 29) Source(35, 9) + SourceIndex(0) +4 >Emitted(30, 39) Source(38, 25) + SourceIndex(0) +5 >Emitted(30, 41) Source(35, 9) + SourceIndex(0) +6 >Emitted(30, 87) Source(38, 25) + SourceIndex(0) +7 >Emitted(30, 89) Source(36, 5) + SourceIndex(0) +8 >Emitted(30, 99) Source(36, 30) + SourceIndex(0) +9 >Emitted(30, 101) Source(36, 5) + SourceIndex(0) +10>Emitted(30, 147) Source(36, 30) + SourceIndex(0) +11>Emitted(30, 149) Source(37, 5) + SourceIndex(0) +12>Emitted(30, 159) Source(37, 34) + SourceIndex(0) +13>Emitted(30, 161) Source(37, 5) + SourceIndex(0) +14>Emitted(30, 211) Source(37, 34) + SourceIndex(0) +--- +>>> console.log(primarySkillA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^^^^^^ +7 > ^ +8 > ^ +1 > + >] = ["skill1", "skill2"]] of multiRobots) { + > +2 > console +3 > . +4 > log +5 > ( +6 > primarySkillA +7 > ) +8 > ; +1 >Emitted(31, 5) Source(39, 5) + SourceIndex(0) +2 >Emitted(31, 12) Source(39, 12) + SourceIndex(0) +3 >Emitted(31, 13) Source(39, 13) + SourceIndex(0) +4 >Emitted(31, 16) Source(39, 16) + SourceIndex(0) +5 >Emitted(31, 17) Source(39, 17) + SourceIndex(0) +6 >Emitted(31, 30) Source(39, 30) + SourceIndex(0) +7 >Emitted(31, 31) Source(39, 31) + SourceIndex(0) +8 >Emitted(31, 32) Source(39, 32) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(32, 2) Source(40, 2) + SourceIndex(0) +--- +>>>for (var _s = 0, _t = getMultiRobots(); _s < _t.length; _s++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^ +8 > ^^^^^^^^^^^^^^ +9 > ^^ +10> ^^ +11> ^^^^^^^^^^^^^^ +12> ^^ +13> ^^^^ +14> ^ +15> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > ([, [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["skill1", "skill2"]] of +5 > getMultiRobots() +6 > +7 > +8 > getMultiRobots +9 > () +10> +11> getMultiRobots() +12> +13> getMultiRobots() +14> ) +1->Emitted(33, 1) Source(41, 1) + SourceIndex(0) +2 >Emitted(33, 4) Source(41, 4) + SourceIndex(0) +3 >Emitted(33, 5) Source(41, 5) + SourceIndex(0) +4 >Emitted(33, 6) Source(44, 30) + SourceIndex(0) +5 >Emitted(33, 16) Source(44, 46) + SourceIndex(0) +6 >Emitted(33, 18) Source(44, 30) + SourceIndex(0) +7 >Emitted(33, 23) Source(44, 30) + SourceIndex(0) +8 >Emitted(33, 37) Source(44, 44) + SourceIndex(0) +9 >Emitted(33, 39) Source(44, 46) + SourceIndex(0) +10>Emitted(33, 41) Source(44, 30) + SourceIndex(0) +11>Emitted(33, 55) Source(44, 46) + SourceIndex(0) +12>Emitted(33, 57) Source(44, 30) + SourceIndex(0) +13>Emitted(33, 61) Source(44, 46) + SourceIndex(0) +14>Emitted(33, 62) Source(44, 47) + SourceIndex(0) +--- +>>> _u = _t[_s], _v = _u[1], _w = _v === void 0 ? ["skill1", "skill2"] : _v, _x = _w[0], primarySkillA = _x === void 0 ? "primary" : _x, _y = _w[1], secondarySkillA = _y === void 0 ? "secondary" : _y; +1->^^^^ +2 > ^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > [, [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["skill1", "skill2"]] +3 > +4 > [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["skill1", "skill2"] +5 > +6 > [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["skill1", "skill2"] +7 > +8 > primarySkillA = "primary" +9 > +10> primarySkillA = "primary" +11> , + > +12> secondarySkillA = "secondary" +13> +14> secondarySkillA = "secondary" +1->Emitted(34, 5) Source(41, 6) + SourceIndex(0) +2 >Emitted(34, 16) Source(44, 26) + SourceIndex(0) +3 >Emitted(34, 18) Source(41, 9) + SourceIndex(0) +4 >Emitted(34, 28) Source(44, 25) + SourceIndex(0) +5 >Emitted(34, 30) Source(41, 9) + SourceIndex(0) +6 >Emitted(34, 76) Source(44, 25) + SourceIndex(0) +7 >Emitted(34, 78) Source(42, 5) + SourceIndex(0) +8 >Emitted(34, 88) Source(42, 30) + SourceIndex(0) +9 >Emitted(34, 90) Source(42, 5) + SourceIndex(0) +10>Emitted(34, 136) Source(42, 30) + SourceIndex(0) +11>Emitted(34, 138) Source(43, 5) + SourceIndex(0) +12>Emitted(34, 148) Source(43, 34) + SourceIndex(0) +13>Emitted(34, 150) Source(43, 5) + SourceIndex(0) +14>Emitted(34, 200) Source(43, 34) + SourceIndex(0) +--- +>>> console.log(primarySkillA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^^^^^^ +7 > ^ +8 > ^ +1 > + >] = ["skill1", "skill2"]] of getMultiRobots()) { + > +2 > console +3 > . +4 > log +5 > ( +6 > primarySkillA +7 > ) +8 > ; +1 >Emitted(35, 5) Source(45, 5) + SourceIndex(0) +2 >Emitted(35, 12) Source(45, 12) + SourceIndex(0) +3 >Emitted(35, 13) Source(45, 13) + SourceIndex(0) +4 >Emitted(35, 16) Source(45, 16) + SourceIndex(0) +5 >Emitted(35, 17) Source(45, 17) + SourceIndex(0) +6 >Emitted(35, 30) Source(45, 30) + SourceIndex(0) +7 >Emitted(35, 31) Source(45, 31) + SourceIndex(0) +8 >Emitted(35, 32) Source(45, 32) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(36, 2) Source(46, 2) + SourceIndex(0) +--- +>>>for (var _z = 0, _0 = [multiRobotA, multiRobotB]; _z < _0.length; _z++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^ +8 > ^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^ +11> ^ +12> ^^ +13> ^^^^^^^^^^^^^^ +14> ^^ +15> ^^^^ +16> ^ +17> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > ([, [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["skill1", "skill2"]] of +5 > [multiRobotA, multiRobotB] +6 > +7 > [ +8 > multiRobotA +9 > , +10> multiRobotB +11> ] +12> +13> [multiRobotA, multiRobotB] +14> +15> [multiRobotA, multiRobotB] +16> ) +1->Emitted(37, 1) Source(47, 1) + SourceIndex(0) +2 >Emitted(37, 4) Source(47, 4) + SourceIndex(0) +3 >Emitted(37, 5) Source(47, 5) + SourceIndex(0) +4 >Emitted(37, 6) Source(50, 30) + SourceIndex(0) +5 >Emitted(37, 16) Source(50, 56) + SourceIndex(0) +6 >Emitted(37, 18) Source(50, 30) + SourceIndex(0) +7 >Emitted(37, 24) Source(50, 31) + SourceIndex(0) +8 >Emitted(37, 35) Source(50, 42) + SourceIndex(0) +9 >Emitted(37, 37) Source(50, 44) + SourceIndex(0) +10>Emitted(37, 48) Source(50, 55) + SourceIndex(0) +11>Emitted(37, 49) Source(50, 56) + SourceIndex(0) +12>Emitted(37, 51) Source(50, 30) + SourceIndex(0) +13>Emitted(37, 65) Source(50, 56) + SourceIndex(0) +14>Emitted(37, 67) Source(50, 30) + SourceIndex(0) +15>Emitted(37, 71) Source(50, 56) + SourceIndex(0) +16>Emitted(37, 72) Source(50, 57) + SourceIndex(0) +--- +>>> _1 = _0[_z], _2 = _1[1], _3 = _2 === void 0 ? ["skill1", "skill2"] : _2, _4 = _3[0], primarySkillA = _4 === void 0 ? "primary" : _4, _5 = _3[1], secondarySkillA = _5 === void 0 ? "secondary" : _5; +1->^^^^ +2 > ^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > [, [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["skill1", "skill2"]] +3 > +4 > [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["skill1", "skill2"] +5 > +6 > [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["skill1", "skill2"] +7 > +8 > primarySkillA = "primary" +9 > +10> primarySkillA = "primary" +11> , + > +12> secondarySkillA = "secondary" +13> +14> secondarySkillA = "secondary" +1->Emitted(38, 5) Source(47, 6) + SourceIndex(0) +2 >Emitted(38, 16) Source(50, 26) + SourceIndex(0) +3 >Emitted(38, 18) Source(47, 9) + SourceIndex(0) +4 >Emitted(38, 28) Source(50, 25) + SourceIndex(0) +5 >Emitted(38, 30) Source(47, 9) + SourceIndex(0) +6 >Emitted(38, 76) Source(50, 25) + SourceIndex(0) +7 >Emitted(38, 78) Source(48, 5) + SourceIndex(0) +8 >Emitted(38, 88) Source(48, 30) + SourceIndex(0) +9 >Emitted(38, 90) Source(48, 5) + SourceIndex(0) +10>Emitted(38, 136) Source(48, 30) + SourceIndex(0) +11>Emitted(38, 138) Source(49, 5) + SourceIndex(0) +12>Emitted(38, 148) Source(49, 34) + SourceIndex(0) +13>Emitted(38, 150) Source(49, 5) + SourceIndex(0) +14>Emitted(38, 200) Source(49, 34) + SourceIndex(0) +--- +>>> console.log(primarySkillA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^^^^^^ +7 > ^ +8 > ^ +1 > + >] = ["skill1", "skill2"]] of [multiRobotA, multiRobotB]) { + > +2 > console +3 > . +4 > log +5 > ( +6 > primarySkillA +7 > ) +8 > ; +1 >Emitted(39, 5) Source(51, 5) + SourceIndex(0) +2 >Emitted(39, 12) Source(51, 12) + SourceIndex(0) +3 >Emitted(39, 13) Source(51, 13) + SourceIndex(0) +4 >Emitted(39, 16) Source(51, 16) + SourceIndex(0) +5 >Emitted(39, 17) Source(51, 17) + SourceIndex(0) +6 >Emitted(39, 30) Source(51, 30) + SourceIndex(0) +7 >Emitted(39, 31) Source(51, 31) + SourceIndex(0) +8 >Emitted(39, 32) Source(51, 32) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(40, 2) Source(52, 2) + SourceIndex(0) +--- +>>>for (var _6 = 0, robots_2 = robots; _6 < robots_2.length; _6++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^^^^^^ +10> ^^ +11> ^^^^ +12> ^ +1-> + > + > +2 >for +3 > +4 > ([numberB = -1] of +5 > robots +6 > +7 > robots +8 > +9 > robots +10> +11> robots +12> ) +1->Emitted(41, 1) Source(54, 1) + SourceIndex(0) +2 >Emitted(41, 4) Source(54, 4) + SourceIndex(0) +3 >Emitted(41, 5) Source(54, 5) + SourceIndex(0) +4 >Emitted(41, 6) Source(54, 24) + SourceIndex(0) +5 >Emitted(41, 16) Source(54, 30) + SourceIndex(0) +6 >Emitted(41, 18) Source(54, 24) + SourceIndex(0) +7 >Emitted(41, 35) Source(54, 30) + SourceIndex(0) +8 >Emitted(41, 37) Source(54, 24) + SourceIndex(0) +9 >Emitted(41, 57) Source(54, 30) + SourceIndex(0) +10>Emitted(41, 59) Source(54, 24) + SourceIndex(0) +11>Emitted(41, 63) Source(54, 30) + SourceIndex(0) +12>Emitted(41, 64) Source(54, 31) + SourceIndex(0) +--- +>>> _7 = robots_2[_6][0], numberB = _7 === void 0 ? -1 : _7; +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 > numberB = -1 +3 > +4 > numberB = -1 +1 >Emitted(42, 5) Source(54, 7) + SourceIndex(0) +2 >Emitted(42, 25) Source(54, 19) + SourceIndex(0) +3 >Emitted(42, 27) Source(54, 7) + SourceIndex(0) +4 >Emitted(42, 60) Source(54, 19) + SourceIndex(0) +--- +>>> console.log(numberB); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^ +7 > ^ +8 > ^ +1 >] of robots) { + > +2 > console +3 > . +4 > log +5 > ( +6 > numberB +7 > ) +8 > ; +1 >Emitted(43, 5) Source(55, 5) + SourceIndex(0) +2 >Emitted(43, 12) Source(55, 12) + SourceIndex(0) +3 >Emitted(43, 13) Source(55, 13) + SourceIndex(0) +4 >Emitted(43, 16) Source(55, 16) + SourceIndex(0) +5 >Emitted(43, 17) Source(55, 17) + SourceIndex(0) +6 >Emitted(43, 24) Source(55, 24) + SourceIndex(0) +7 >Emitted(43, 25) Source(55, 25) + SourceIndex(0) +8 >Emitted(43, 26) Source(55, 26) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(44, 2) Source(56, 2) + SourceIndex(0) +--- +>>>for (var _8 = 0, _9 = getRobots(); _8 < _9.length; _8++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^ +8 > ^^^^^^^^^ +9 > ^^ +10> ^^ +11> ^^^^^^^^^^^^^^ +12> ^^ +13> ^^^^ +14> ^ +15> ^^-> +1-> + > +2 >for +3 > +4 > ([numberB = -1] of +5 > getRobots() +6 > +7 > +8 > getRobots +9 > () +10> +11> getRobots() +12> +13> getRobots() +14> ) +1->Emitted(45, 1) Source(57, 1) + SourceIndex(0) +2 >Emitted(45, 4) Source(57, 4) + SourceIndex(0) +3 >Emitted(45, 5) Source(57, 5) + SourceIndex(0) +4 >Emitted(45, 6) Source(57, 24) + SourceIndex(0) +5 >Emitted(45, 16) Source(57, 35) + SourceIndex(0) +6 >Emitted(45, 18) Source(57, 24) + SourceIndex(0) +7 >Emitted(45, 23) Source(57, 24) + SourceIndex(0) +8 >Emitted(45, 32) Source(57, 33) + SourceIndex(0) +9 >Emitted(45, 34) Source(57, 35) + SourceIndex(0) +10>Emitted(45, 36) Source(57, 24) + SourceIndex(0) +11>Emitted(45, 50) Source(57, 35) + SourceIndex(0) +12>Emitted(45, 52) Source(57, 24) + SourceIndex(0) +13>Emitted(45, 56) Source(57, 35) + SourceIndex(0) +14>Emitted(45, 57) Source(57, 36) + SourceIndex(0) +--- +>>> _10 = _9[_8][0], numberB = _10 === void 0 ? -1 : _10; +1->^^^^ +2 > ^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > numberB = -1 +3 > +4 > numberB = -1 +1->Emitted(46, 5) Source(57, 7) + SourceIndex(0) +2 >Emitted(46, 20) Source(57, 19) + SourceIndex(0) +3 >Emitted(46, 22) Source(57, 7) + SourceIndex(0) +4 >Emitted(46, 57) Source(57, 19) + SourceIndex(0) +--- +>>> console.log(numberB); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^ +7 > ^ +8 > ^ +1 >] of getRobots()) { + > +2 > console +3 > . +4 > log +5 > ( +6 > numberB +7 > ) +8 > ; +1 >Emitted(47, 5) Source(58, 5) + SourceIndex(0) +2 >Emitted(47, 12) Source(58, 12) + SourceIndex(0) +3 >Emitted(47, 13) Source(58, 13) + SourceIndex(0) +4 >Emitted(47, 16) Source(58, 16) + SourceIndex(0) +5 >Emitted(47, 17) Source(58, 17) + SourceIndex(0) +6 >Emitted(47, 24) Source(58, 24) + SourceIndex(0) +7 >Emitted(47, 25) Source(58, 25) + SourceIndex(0) +8 >Emitted(47, 26) Source(58, 26) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(48, 2) Source(59, 2) + SourceIndex(0) +--- +>>>for (var _11 = 0, _12 = [robotA, robotB]; _11 < _12.length; _11++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^ +8 > ^^^^^^ +9 > ^^ +10> ^^^^^^ +11> ^ +12> ^^ +13> ^^^^^^^^^^^^^^^^ +14> ^^ +15> ^^^^^ +16> ^ +1-> + > +2 >for +3 > +4 > ([numberB = -1] of +5 > [robotA, robotB] +6 > +7 > [ +8 > robotA +9 > , +10> robotB +11> ] +12> +13> [robotA, robotB] +14> +15> [robotA, robotB] +16> ) +1->Emitted(49, 1) Source(60, 1) + SourceIndex(0) +2 >Emitted(49, 4) Source(60, 4) + SourceIndex(0) +3 >Emitted(49, 5) Source(60, 5) + SourceIndex(0) +4 >Emitted(49, 6) Source(60, 24) + SourceIndex(0) +5 >Emitted(49, 17) Source(60, 40) + SourceIndex(0) +6 >Emitted(49, 19) Source(60, 24) + SourceIndex(0) +7 >Emitted(49, 26) Source(60, 25) + SourceIndex(0) +8 >Emitted(49, 32) Source(60, 31) + SourceIndex(0) +9 >Emitted(49, 34) Source(60, 33) + SourceIndex(0) +10>Emitted(49, 40) Source(60, 39) + SourceIndex(0) +11>Emitted(49, 41) Source(60, 40) + SourceIndex(0) +12>Emitted(49, 43) Source(60, 24) + SourceIndex(0) +13>Emitted(49, 59) Source(60, 40) + SourceIndex(0) +14>Emitted(49, 61) Source(60, 24) + SourceIndex(0) +15>Emitted(49, 66) Source(60, 40) + SourceIndex(0) +16>Emitted(49, 67) Source(60, 41) + SourceIndex(0) +--- +>>> _13 = _12[_11][0], numberB = _13 === void 0 ? -1 : _13; +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 > numberB = -1 +3 > +4 > numberB = -1 +1 >Emitted(50, 5) Source(60, 7) + SourceIndex(0) +2 >Emitted(50, 22) Source(60, 19) + SourceIndex(0) +3 >Emitted(50, 24) Source(60, 7) + SourceIndex(0) +4 >Emitted(50, 59) Source(60, 19) + SourceIndex(0) +--- +>>> console.log(numberB); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^ +7 > ^ +8 > ^ +1 >] of [robotA, robotB]) { + > +2 > console +3 > . +4 > log +5 > ( +6 > numberB +7 > ) +8 > ; +1 >Emitted(51, 5) Source(61, 5) + SourceIndex(0) +2 >Emitted(51, 12) Source(61, 12) + SourceIndex(0) +3 >Emitted(51, 13) Source(61, 13) + SourceIndex(0) +4 >Emitted(51, 16) Source(61, 16) + SourceIndex(0) +5 >Emitted(51, 17) Source(61, 17) + SourceIndex(0) +6 >Emitted(51, 24) Source(61, 24) + SourceIndex(0) +7 >Emitted(51, 25) Source(61, 25) + SourceIndex(0) +8 >Emitted(51, 26) Source(61, 26) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(52, 2) Source(62, 2) + SourceIndex(0) +--- +>>>for (var _14 = 0, multiRobots_2 = multiRobots; _14 < multiRobots_2.length; _14++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^^^^^^^^^^^^ +10> ^^ +11> ^^^^^ +12> ^ +1-> + > +2 >for +3 > +4 > ([nameB = "noName"] of +5 > multiRobots +6 > +7 > multiRobots +8 > +9 > multiRobots +10> +11> multiRobots +12> ) +1->Emitted(53, 1) Source(63, 1) + SourceIndex(0) +2 >Emitted(53, 4) Source(63, 4) + SourceIndex(0) +3 >Emitted(53, 5) Source(63, 5) + SourceIndex(0) +4 >Emitted(53, 6) Source(63, 28) + SourceIndex(0) +5 >Emitted(53, 17) Source(63, 39) + SourceIndex(0) +6 >Emitted(53, 19) Source(63, 28) + SourceIndex(0) +7 >Emitted(53, 46) Source(63, 39) + SourceIndex(0) +8 >Emitted(53, 48) Source(63, 28) + SourceIndex(0) +9 >Emitted(53, 74) Source(63, 39) + SourceIndex(0) +10>Emitted(53, 76) Source(63, 28) + SourceIndex(0) +11>Emitted(53, 81) Source(63, 39) + SourceIndex(0) +12>Emitted(53, 82) Source(63, 40) + SourceIndex(0) +--- +>>> _15 = multiRobots_2[_14][0], nameB = _15 === void 0 ? "noName" : _15; +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 > nameB = "noName" +3 > +4 > nameB = "noName" +1 >Emitted(54, 5) Source(63, 7) + SourceIndex(0) +2 >Emitted(54, 32) Source(63, 23) + SourceIndex(0) +3 >Emitted(54, 34) Source(63, 7) + SourceIndex(0) +4 >Emitted(54, 73) Source(63, 23) + SourceIndex(0) +--- +>>> console.log(nameB); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 >] of multiRobots) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameB +7 > ) +8 > ; +1 >Emitted(55, 5) Source(64, 5) + SourceIndex(0) +2 >Emitted(55, 12) Source(64, 12) + SourceIndex(0) +3 >Emitted(55, 13) Source(64, 13) + SourceIndex(0) +4 >Emitted(55, 16) Source(64, 16) + SourceIndex(0) +5 >Emitted(55, 17) Source(64, 17) + SourceIndex(0) +6 >Emitted(55, 22) Source(64, 22) + SourceIndex(0) +7 >Emitted(55, 23) Source(64, 23) + SourceIndex(0) +8 >Emitted(55, 24) Source(64, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(56, 2) Source(65, 2) + SourceIndex(0) +--- +>>>for (var _16 = 0, _17 = getMultiRobots(); _16 < _17.length; _16++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^ +8 > ^^^^^^^^^^^^^^ +9 > ^^ +10> ^^ +11> ^^^^^^^^^^^^^^^^ +12> ^^ +13> ^^^^^ +14> ^ +1-> + > +2 >for +3 > +4 > ([nameB = "noName"] of +5 > getMultiRobots() +6 > +7 > +8 > getMultiRobots +9 > () +10> +11> getMultiRobots() +12> +13> getMultiRobots() +14> ) +1->Emitted(57, 1) Source(66, 1) + SourceIndex(0) +2 >Emitted(57, 4) Source(66, 4) + SourceIndex(0) +3 >Emitted(57, 5) Source(66, 5) + SourceIndex(0) +4 >Emitted(57, 6) Source(66, 28) + SourceIndex(0) +5 >Emitted(57, 17) Source(66, 44) + SourceIndex(0) +6 >Emitted(57, 19) Source(66, 28) + SourceIndex(0) +7 >Emitted(57, 25) Source(66, 28) + SourceIndex(0) +8 >Emitted(57, 39) Source(66, 42) + SourceIndex(0) +9 >Emitted(57, 41) Source(66, 44) + SourceIndex(0) +10>Emitted(57, 43) Source(66, 28) + SourceIndex(0) +11>Emitted(57, 59) Source(66, 44) + SourceIndex(0) +12>Emitted(57, 61) Source(66, 28) + SourceIndex(0) +13>Emitted(57, 66) Source(66, 44) + SourceIndex(0) +14>Emitted(57, 67) Source(66, 45) + SourceIndex(0) +--- +>>> _18 = _17[_16][0], nameB = _18 === void 0 ? "noName" : _18; +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 > nameB = "noName" +3 > +4 > nameB = "noName" +1 >Emitted(58, 5) Source(66, 7) + SourceIndex(0) +2 >Emitted(58, 22) Source(66, 23) + SourceIndex(0) +3 >Emitted(58, 24) Source(66, 7) + SourceIndex(0) +4 >Emitted(58, 63) Source(66, 23) + SourceIndex(0) +--- +>>> console.log(nameB); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 >] of getMultiRobots()) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameB +7 > ) +8 > ; +1 >Emitted(59, 5) Source(67, 5) + SourceIndex(0) +2 >Emitted(59, 12) Source(67, 12) + SourceIndex(0) +3 >Emitted(59, 13) Source(67, 13) + SourceIndex(0) +4 >Emitted(59, 16) Source(67, 16) + SourceIndex(0) +5 >Emitted(59, 17) Source(67, 17) + SourceIndex(0) +6 >Emitted(59, 22) Source(67, 22) + SourceIndex(0) +7 >Emitted(59, 23) Source(67, 23) + SourceIndex(0) +8 >Emitted(59, 24) Source(67, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(60, 2) Source(68, 2) + SourceIndex(0) +--- +>>>for (var _19 = 0, _20 = [multiRobotA, multiRobotB]; _19 < _20.length; _19++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^ +8 > ^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^ +11> ^ +12> ^^ +13> ^^^^^^^^^^^^^^^^ +14> ^^ +15> ^^^^^ +16> ^ +1-> + > +2 >for +3 > +4 > ([nameB = "noName"] of +5 > [multiRobotA, multiRobotB] +6 > +7 > [ +8 > multiRobotA +9 > , +10> multiRobotB +11> ] +12> +13> [multiRobotA, multiRobotB] +14> +15> [multiRobotA, multiRobotB] +16> ) +1->Emitted(61, 1) Source(69, 1) + SourceIndex(0) +2 >Emitted(61, 4) Source(69, 4) + SourceIndex(0) +3 >Emitted(61, 5) Source(69, 5) + SourceIndex(0) +4 >Emitted(61, 6) Source(69, 28) + SourceIndex(0) +5 >Emitted(61, 17) Source(69, 54) + SourceIndex(0) +6 >Emitted(61, 19) Source(69, 28) + SourceIndex(0) +7 >Emitted(61, 26) Source(69, 29) + SourceIndex(0) +8 >Emitted(61, 37) Source(69, 40) + SourceIndex(0) +9 >Emitted(61, 39) Source(69, 42) + SourceIndex(0) +10>Emitted(61, 50) Source(69, 53) + SourceIndex(0) +11>Emitted(61, 51) Source(69, 54) + SourceIndex(0) +12>Emitted(61, 53) Source(69, 28) + SourceIndex(0) +13>Emitted(61, 69) Source(69, 54) + SourceIndex(0) +14>Emitted(61, 71) Source(69, 28) + SourceIndex(0) +15>Emitted(61, 76) Source(69, 54) + SourceIndex(0) +16>Emitted(61, 77) Source(69, 55) + SourceIndex(0) +--- +>>> _21 = _20[_19][0], nameB = _21 === void 0 ? "noName" : _21; +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 > nameB = "noName" +3 > +4 > nameB = "noName" +1 >Emitted(62, 5) Source(69, 7) + SourceIndex(0) +2 >Emitted(62, 22) Source(69, 23) + SourceIndex(0) +3 >Emitted(62, 24) Source(69, 7) + SourceIndex(0) +4 >Emitted(62, 63) Source(69, 23) + SourceIndex(0) +--- +>>> console.log(nameB); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 >] of [multiRobotA, multiRobotB]) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameB +7 > ) +8 > ; +1 >Emitted(63, 5) Source(70, 5) + SourceIndex(0) +2 >Emitted(63, 12) Source(70, 12) + SourceIndex(0) +3 >Emitted(63, 13) Source(70, 13) + SourceIndex(0) +4 >Emitted(63, 16) Source(70, 16) + SourceIndex(0) +5 >Emitted(63, 17) Source(70, 17) + SourceIndex(0) +6 >Emitted(63, 22) Source(70, 22) + SourceIndex(0) +7 >Emitted(63, 23) Source(70, 23) + SourceIndex(0) +8 >Emitted(63, 24) Source(70, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(64, 2) Source(71, 2) + SourceIndex(0) +--- +>>>for (var _22 = 0, robots_3 = robots; _22 < robots_3.length; _22++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^^^^^^^ +10> ^^ +11> ^^^^^ +12> ^ +13> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > + > +2 >for +3 > +4 > ([numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of +5 > robots +6 > +7 > robots +8 > +9 > robots +10> +11> robots +12> ) +1->Emitted(65, 1) Source(73, 1) + SourceIndex(0) +2 >Emitted(65, 4) Source(73, 4) + SourceIndex(0) +3 >Emitted(65, 5) Source(73, 5) + SourceIndex(0) +4 >Emitted(65, 6) Source(73, 63) + SourceIndex(0) +5 >Emitted(65, 17) Source(73, 69) + SourceIndex(0) +6 >Emitted(65, 19) Source(73, 63) + SourceIndex(0) +7 >Emitted(65, 36) Source(73, 69) + SourceIndex(0) +8 >Emitted(65, 38) Source(73, 63) + SourceIndex(0) +9 >Emitted(65, 59) Source(73, 69) + SourceIndex(0) +10>Emitted(65, 61) Source(73, 63) + SourceIndex(0) +11>Emitted(65, 66) Source(73, 69) + SourceIndex(0) +12>Emitted(65, 67) Source(73, 70) + SourceIndex(0) +--- +>>> _23 = robots_3[_22], _24 = _23[0], numberA2 = _24 === void 0 ? -1 : _24, _25 = _23[1], nameA2 = _25 === void 0 ? "noName" : _25, _26 = _23[2], skillA2 = _26 === void 0 ? "skill" : _26; +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > [numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] +3 > +4 > numberA2 = -1 +5 > +6 > numberA2 = -1 +7 > , +8 > nameA2 = "noName" +9 > +10> nameA2 = "noName" +11> , +12> skillA2 = "skill" +13> +14> skillA2 = "skill" +1->Emitted(66, 5) Source(73, 6) + SourceIndex(0) +2 >Emitted(66, 24) Source(73, 59) + SourceIndex(0) +3 >Emitted(66, 26) Source(73, 7) + SourceIndex(0) +4 >Emitted(66, 38) Source(73, 20) + SourceIndex(0) +5 >Emitted(66, 40) Source(73, 7) + SourceIndex(0) +6 >Emitted(66, 76) Source(73, 20) + SourceIndex(0) +7 >Emitted(66, 78) Source(73, 22) + SourceIndex(0) +8 >Emitted(66, 90) Source(73, 39) + SourceIndex(0) +9 >Emitted(66, 92) Source(73, 22) + SourceIndex(0) +10>Emitted(66, 132) Source(73, 39) + SourceIndex(0) +11>Emitted(66, 134) Source(73, 41) + SourceIndex(0) +12>Emitted(66, 146) Source(73, 58) + SourceIndex(0) +13>Emitted(66, 148) Source(73, 41) + SourceIndex(0) +14>Emitted(66, 188) Source(73, 58) + SourceIndex(0) +--- +>>> console.log(nameA2); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^ +7 > ^ +8 > ^ +1 >] of robots) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA2 +7 > ) +8 > ; +1 >Emitted(67, 5) Source(74, 5) + SourceIndex(0) +2 >Emitted(67, 12) Source(74, 12) + SourceIndex(0) +3 >Emitted(67, 13) Source(74, 13) + SourceIndex(0) +4 >Emitted(67, 16) Source(74, 16) + SourceIndex(0) +5 >Emitted(67, 17) Source(74, 17) + SourceIndex(0) +6 >Emitted(67, 23) Source(74, 23) + SourceIndex(0) +7 >Emitted(67, 24) Source(74, 24) + SourceIndex(0) +8 >Emitted(67, 25) Source(74, 25) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(68, 2) Source(75, 2) + SourceIndex(0) +--- +>>>for (var _27 = 0, _28 = getRobots(); _27 < _28.length; _27++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^ +8 > ^^^^^^^^^ +9 > ^^ +10> ^^ +11> ^^^^^^^^^^^^^^^^ +12> ^^ +13> ^^^^^ +14> ^ +15> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > ([numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of +5 > getRobots() +6 > +7 > +8 > getRobots +9 > () +10> +11> getRobots() +12> +13> getRobots() +14> ) +1->Emitted(69, 1) Source(76, 1) + SourceIndex(0) +2 >Emitted(69, 4) Source(76, 4) + SourceIndex(0) +3 >Emitted(69, 5) Source(76, 5) + SourceIndex(0) +4 >Emitted(69, 6) Source(76, 63) + SourceIndex(0) +5 >Emitted(69, 17) Source(76, 74) + SourceIndex(0) +6 >Emitted(69, 19) Source(76, 63) + SourceIndex(0) +7 >Emitted(69, 25) Source(76, 63) + SourceIndex(0) +8 >Emitted(69, 34) Source(76, 72) + SourceIndex(0) +9 >Emitted(69, 36) Source(76, 74) + SourceIndex(0) +10>Emitted(69, 38) Source(76, 63) + SourceIndex(0) +11>Emitted(69, 54) Source(76, 74) + SourceIndex(0) +12>Emitted(69, 56) Source(76, 63) + SourceIndex(0) +13>Emitted(69, 61) Source(76, 74) + SourceIndex(0) +14>Emitted(69, 62) Source(76, 75) + SourceIndex(0) +--- +>>> _29 = _28[_27], _30 = _29[0], numberA2 = _30 === void 0 ? -1 : _30, _31 = _29[1], nameA2 = _31 === void 0 ? "noName" : _31, _32 = _29[2], skillA2 = _32 === void 0 ? "skill" : _32; +1->^^^^ +2 > ^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > [numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] +3 > +4 > numberA2 = -1 +5 > +6 > numberA2 = -1 +7 > , +8 > nameA2 = "noName" +9 > +10> nameA2 = "noName" +11> , +12> skillA2 = "skill" +13> +14> skillA2 = "skill" +1->Emitted(70, 5) Source(76, 6) + SourceIndex(0) +2 >Emitted(70, 19) Source(76, 59) + SourceIndex(0) +3 >Emitted(70, 21) Source(76, 7) + SourceIndex(0) +4 >Emitted(70, 33) Source(76, 20) + SourceIndex(0) +5 >Emitted(70, 35) Source(76, 7) + SourceIndex(0) +6 >Emitted(70, 71) Source(76, 20) + SourceIndex(0) +7 >Emitted(70, 73) Source(76, 22) + SourceIndex(0) +8 >Emitted(70, 85) Source(76, 39) + SourceIndex(0) +9 >Emitted(70, 87) Source(76, 22) + SourceIndex(0) +10>Emitted(70, 127) Source(76, 39) + SourceIndex(0) +11>Emitted(70, 129) Source(76, 41) + SourceIndex(0) +12>Emitted(70, 141) Source(76, 58) + SourceIndex(0) +13>Emitted(70, 143) Source(76, 41) + SourceIndex(0) +14>Emitted(70, 183) Source(76, 58) + SourceIndex(0) +--- +>>> console.log(nameA2); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^ +7 > ^ +8 > ^ +1 >] of getRobots()) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA2 +7 > ) +8 > ; +1 >Emitted(71, 5) Source(77, 5) + SourceIndex(0) +2 >Emitted(71, 12) Source(77, 12) + SourceIndex(0) +3 >Emitted(71, 13) Source(77, 13) + SourceIndex(0) +4 >Emitted(71, 16) Source(77, 16) + SourceIndex(0) +5 >Emitted(71, 17) Source(77, 17) + SourceIndex(0) +6 >Emitted(71, 23) Source(77, 23) + SourceIndex(0) +7 >Emitted(71, 24) Source(77, 24) + SourceIndex(0) +8 >Emitted(71, 25) Source(77, 25) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(72, 2) Source(78, 2) + SourceIndex(0) +--- +>>>for (var _33 = 0, _34 = [robotA, robotB]; _33 < _34.length; _33++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^ +8 > ^^^^^^ +9 > ^^ +10> ^^^^^^ +11> ^ +12> ^^ +13> ^^^^^^^^^^^^^^^^ +14> ^^ +15> ^^^^^ +16> ^ +17> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > ([numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of +5 > [robotA, robotB] +6 > +7 > [ +8 > robotA +9 > , +10> robotB +11> ] +12> +13> [robotA, robotB] +14> +15> [robotA, robotB] +16> ) +1->Emitted(73, 1) Source(79, 1) + SourceIndex(0) +2 >Emitted(73, 4) Source(79, 4) + SourceIndex(0) +3 >Emitted(73, 5) Source(79, 5) + SourceIndex(0) +4 >Emitted(73, 6) Source(79, 63) + SourceIndex(0) +5 >Emitted(73, 17) Source(79, 79) + SourceIndex(0) +6 >Emitted(73, 19) Source(79, 63) + SourceIndex(0) +7 >Emitted(73, 26) Source(79, 64) + SourceIndex(0) +8 >Emitted(73, 32) Source(79, 70) + SourceIndex(0) +9 >Emitted(73, 34) Source(79, 72) + SourceIndex(0) +10>Emitted(73, 40) Source(79, 78) + SourceIndex(0) +11>Emitted(73, 41) Source(79, 79) + SourceIndex(0) +12>Emitted(73, 43) Source(79, 63) + SourceIndex(0) +13>Emitted(73, 59) Source(79, 79) + SourceIndex(0) +14>Emitted(73, 61) Source(79, 63) + SourceIndex(0) +15>Emitted(73, 66) Source(79, 79) + SourceIndex(0) +16>Emitted(73, 67) Source(79, 80) + SourceIndex(0) +--- +>>> _35 = _34[_33], _36 = _35[0], numberA2 = _36 === void 0 ? -1 : _36, _37 = _35[1], nameA2 = _37 === void 0 ? "noName" : _37, _38 = _35[2], skillA2 = _38 === void 0 ? "skill" : _38; +1->^^^^ +2 > ^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > [numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] +3 > +4 > numberA2 = -1 +5 > +6 > numberA2 = -1 +7 > , +8 > nameA2 = "noName" +9 > +10> nameA2 = "noName" +11> , +12> skillA2 = "skill" +13> +14> skillA2 = "skill" +1->Emitted(74, 5) Source(79, 6) + SourceIndex(0) +2 >Emitted(74, 19) Source(79, 59) + SourceIndex(0) +3 >Emitted(74, 21) Source(79, 7) + SourceIndex(0) +4 >Emitted(74, 33) Source(79, 20) + SourceIndex(0) +5 >Emitted(74, 35) Source(79, 7) + SourceIndex(0) +6 >Emitted(74, 71) Source(79, 20) + SourceIndex(0) +7 >Emitted(74, 73) Source(79, 22) + SourceIndex(0) +8 >Emitted(74, 85) Source(79, 39) + SourceIndex(0) +9 >Emitted(74, 87) Source(79, 22) + SourceIndex(0) +10>Emitted(74, 127) Source(79, 39) + SourceIndex(0) +11>Emitted(74, 129) Source(79, 41) + SourceIndex(0) +12>Emitted(74, 141) Source(79, 58) + SourceIndex(0) +13>Emitted(74, 143) Source(79, 41) + SourceIndex(0) +14>Emitted(74, 183) Source(79, 58) + SourceIndex(0) +--- +>>> console.log(nameA2); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^ +7 > ^ +8 > ^ +1 >] of [robotA, robotB]) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA2 +7 > ) +8 > ; +1 >Emitted(75, 5) Source(80, 5) + SourceIndex(0) +2 >Emitted(75, 12) Source(80, 12) + SourceIndex(0) +3 >Emitted(75, 13) Source(80, 13) + SourceIndex(0) +4 >Emitted(75, 16) Source(80, 16) + SourceIndex(0) +5 >Emitted(75, 17) Source(80, 17) + SourceIndex(0) +6 >Emitted(75, 23) Source(80, 23) + SourceIndex(0) +7 >Emitted(75, 24) Source(80, 24) + SourceIndex(0) +8 >Emitted(75, 25) Source(80, 25) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(76, 2) Source(81, 2) + SourceIndex(0) +--- +>>>for (var _39 = 0, multiRobots_3 = multiRobots; _39 < multiRobots_3.length; _39++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^^^^^^^^^^^^ +10> ^^ +11> ^^^^^ +12> ^ +13> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > ([nameMA = "noName", [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["skill1", "skill2"]] of +5 > multiRobots +6 > +7 > multiRobots +8 > +9 > multiRobots +10> +11> multiRobots +12> ) +1->Emitted(77, 1) Source(82, 1) + SourceIndex(0) +2 >Emitted(77, 4) Source(82, 4) + SourceIndex(0) +3 >Emitted(77, 5) Source(82, 5) + SourceIndex(0) +4 >Emitted(77, 6) Source(85, 30) + SourceIndex(0) +5 >Emitted(77, 17) Source(85, 41) + SourceIndex(0) +6 >Emitted(77, 19) Source(85, 30) + SourceIndex(0) +7 >Emitted(77, 46) Source(85, 41) + SourceIndex(0) +8 >Emitted(77, 48) Source(85, 30) + SourceIndex(0) +9 >Emitted(77, 74) Source(85, 41) + SourceIndex(0) +10>Emitted(77, 76) Source(85, 30) + SourceIndex(0) +11>Emitted(77, 81) Source(85, 41) + SourceIndex(0) +12>Emitted(77, 82) Source(85, 42) + SourceIndex(0) +--- +>>> _40 = multiRobots_3[_39], _41 = _40[0], nameMA = _41 === void 0 ? "noName" : _41, _42 = _40[1], _43 = _42 === void 0 ? ["skill1", "skill2"] : _42, _44 = _43[0], primarySkillA = _44 === void 0 ? "primary" : _44, _45 = _43[1], secondarySkillA = _45 === void 0 ? "secondary" : _45; +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +15> ^^ +16> ^^^^^^^^^^^^ +17> ^^ +18> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > [nameMA = "noName", [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["skill1", "skill2"]] +3 > +4 > nameMA = "noName" +5 > +6 > nameMA = "noName" +7 > , +8 > [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["skill1", "skill2"] +9 > +10> [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["skill1", "skill2"] +11> +12> primarySkillA = "primary" +13> +14> primarySkillA = "primary" +15> , + > +16> secondarySkillA = "secondary" +17> +18> secondarySkillA = "secondary" +1->Emitted(78, 5) Source(82, 6) + SourceIndex(0) +2 >Emitted(78, 29) Source(85, 26) + SourceIndex(0) +3 >Emitted(78, 31) Source(82, 7) + SourceIndex(0) +4 >Emitted(78, 43) Source(82, 24) + SourceIndex(0) +5 >Emitted(78, 45) Source(82, 7) + SourceIndex(0) +6 >Emitted(78, 85) Source(82, 24) + SourceIndex(0) +7 >Emitted(78, 87) Source(82, 26) + SourceIndex(0) +8 >Emitted(78, 99) Source(85, 25) + SourceIndex(0) +9 >Emitted(78, 101) Source(82, 26) + SourceIndex(0) +10>Emitted(78, 150) Source(85, 25) + SourceIndex(0) +11>Emitted(78, 152) Source(83, 5) + SourceIndex(0) +12>Emitted(78, 164) Source(83, 30) + SourceIndex(0) +13>Emitted(78, 166) Source(83, 5) + SourceIndex(0) +14>Emitted(78, 214) Source(83, 30) + SourceIndex(0) +15>Emitted(78, 216) Source(84, 5) + SourceIndex(0) +16>Emitted(78, 228) Source(84, 34) + SourceIndex(0) +17>Emitted(78, 230) Source(84, 5) + SourceIndex(0) +18>Emitted(78, 282) Source(84, 34) + SourceIndex(0) +--- +>>> console.log(nameMA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^ +7 > ^ +8 > ^ +1 > + >] = ["skill1", "skill2"]] of multiRobots) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameMA +7 > ) +8 > ; +1 >Emitted(79, 5) Source(86, 5) + SourceIndex(0) +2 >Emitted(79, 12) Source(86, 12) + SourceIndex(0) +3 >Emitted(79, 13) Source(86, 13) + SourceIndex(0) +4 >Emitted(79, 16) Source(86, 16) + SourceIndex(0) +5 >Emitted(79, 17) Source(86, 17) + SourceIndex(0) +6 >Emitted(79, 23) Source(86, 23) + SourceIndex(0) +7 >Emitted(79, 24) Source(86, 24) + SourceIndex(0) +8 >Emitted(79, 25) Source(86, 25) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(80, 2) Source(87, 2) + SourceIndex(0) +--- +>>>for (var _46 = 0, _47 = getMultiRobots(); _46 < _47.length; _46++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^ +8 > ^^^^^^^^^^^^^^ +9 > ^^ +10> ^^ +11> ^^^^^^^^^^^^^^^^ +12> ^^ +13> ^^^^^ +14> ^ +15> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > ([nameMA = "noName", [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["skill1", "skill2"]] of +5 > getMultiRobots() +6 > +7 > +8 > getMultiRobots +9 > () +10> +11> getMultiRobots() +12> +13> getMultiRobots() +14> ) +1->Emitted(81, 1) Source(88, 1) + SourceIndex(0) +2 >Emitted(81, 4) Source(88, 4) + SourceIndex(0) +3 >Emitted(81, 5) Source(88, 5) + SourceIndex(0) +4 >Emitted(81, 6) Source(91, 30) + SourceIndex(0) +5 >Emitted(81, 17) Source(91, 46) + SourceIndex(0) +6 >Emitted(81, 19) Source(91, 30) + SourceIndex(0) +7 >Emitted(81, 25) Source(91, 30) + SourceIndex(0) +8 >Emitted(81, 39) Source(91, 44) + SourceIndex(0) +9 >Emitted(81, 41) Source(91, 46) + SourceIndex(0) +10>Emitted(81, 43) Source(91, 30) + SourceIndex(0) +11>Emitted(81, 59) Source(91, 46) + SourceIndex(0) +12>Emitted(81, 61) Source(91, 30) + SourceIndex(0) +13>Emitted(81, 66) Source(91, 46) + SourceIndex(0) +14>Emitted(81, 67) Source(91, 47) + SourceIndex(0) +--- +>>> _48 = _47[_46], _49 = _48[0], nameMA = _49 === void 0 ? "noName" : _49, _50 = _48[1], _51 = _50 === void 0 ? ["skill1", "skill2"] : _50, _52 = _51[0], primarySkillA = _52 === void 0 ? "primary" : _52, _53 = _51[1], secondarySkillA = _53 === void 0 ? "secondary" : _53; +1->^^^^ +2 > ^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +15> ^^ +16> ^^^^^^^^^^^^ +17> ^^ +18> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > [nameMA = "noName", [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["skill1", "skill2"]] +3 > +4 > nameMA = "noName" +5 > +6 > nameMA = "noName" +7 > , +8 > [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["skill1", "skill2"] +9 > +10> [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["skill1", "skill2"] +11> +12> primarySkillA = "primary" +13> +14> primarySkillA = "primary" +15> , + > +16> secondarySkillA = "secondary" +17> +18> secondarySkillA = "secondary" +1->Emitted(82, 5) Source(88, 6) + SourceIndex(0) +2 >Emitted(82, 19) Source(91, 26) + SourceIndex(0) +3 >Emitted(82, 21) Source(88, 7) + SourceIndex(0) +4 >Emitted(82, 33) Source(88, 24) + SourceIndex(0) +5 >Emitted(82, 35) Source(88, 7) + SourceIndex(0) +6 >Emitted(82, 75) Source(88, 24) + SourceIndex(0) +7 >Emitted(82, 77) Source(88, 26) + SourceIndex(0) +8 >Emitted(82, 89) Source(91, 25) + SourceIndex(0) +9 >Emitted(82, 91) Source(88, 26) + SourceIndex(0) +10>Emitted(82, 140) Source(91, 25) + SourceIndex(0) +11>Emitted(82, 142) Source(89, 5) + SourceIndex(0) +12>Emitted(82, 154) Source(89, 30) + SourceIndex(0) +13>Emitted(82, 156) Source(89, 5) + SourceIndex(0) +14>Emitted(82, 204) Source(89, 30) + SourceIndex(0) +15>Emitted(82, 206) Source(90, 5) + SourceIndex(0) +16>Emitted(82, 218) Source(90, 34) + SourceIndex(0) +17>Emitted(82, 220) Source(90, 5) + SourceIndex(0) +18>Emitted(82, 272) Source(90, 34) + SourceIndex(0) +--- +>>> console.log(nameMA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^ +7 > ^ +8 > ^ +1 > + >] = ["skill1", "skill2"]] of getMultiRobots()) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameMA +7 > ) +8 > ; +1 >Emitted(83, 5) Source(92, 5) + SourceIndex(0) +2 >Emitted(83, 12) Source(92, 12) + SourceIndex(0) +3 >Emitted(83, 13) Source(92, 13) + SourceIndex(0) +4 >Emitted(83, 16) Source(92, 16) + SourceIndex(0) +5 >Emitted(83, 17) Source(92, 17) + SourceIndex(0) +6 >Emitted(83, 23) Source(92, 23) + SourceIndex(0) +7 >Emitted(83, 24) Source(92, 24) + SourceIndex(0) +8 >Emitted(83, 25) Source(92, 25) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(84, 2) Source(93, 2) + SourceIndex(0) +--- +>>>for (var _54 = 0, _55 = [multiRobotA, multiRobotB]; _54 < _55.length; _54++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^ +8 > ^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^ +11> ^ +12> ^^ +13> ^^^^^^^^^^^^^^^^ +14> ^^ +15> ^^^^^ +16> ^ +17> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > ([nameMA = "noName", [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["skill1", "skill2"]] of +5 > [multiRobotA, multiRobotB] +6 > +7 > [ +8 > multiRobotA +9 > , +10> multiRobotB +11> ] +12> +13> [multiRobotA, multiRobotB] +14> +15> [multiRobotA, multiRobotB] +16> ) +1->Emitted(85, 1) Source(94, 1) + SourceIndex(0) +2 >Emitted(85, 4) Source(94, 4) + SourceIndex(0) +3 >Emitted(85, 5) Source(94, 5) + SourceIndex(0) +4 >Emitted(85, 6) Source(97, 30) + SourceIndex(0) +5 >Emitted(85, 17) Source(97, 56) + SourceIndex(0) +6 >Emitted(85, 19) Source(97, 30) + SourceIndex(0) +7 >Emitted(85, 26) Source(97, 31) + SourceIndex(0) +8 >Emitted(85, 37) Source(97, 42) + SourceIndex(0) +9 >Emitted(85, 39) Source(97, 44) + SourceIndex(0) +10>Emitted(85, 50) Source(97, 55) + SourceIndex(0) +11>Emitted(85, 51) Source(97, 56) + SourceIndex(0) +12>Emitted(85, 53) Source(97, 30) + SourceIndex(0) +13>Emitted(85, 69) Source(97, 56) + SourceIndex(0) +14>Emitted(85, 71) Source(97, 30) + SourceIndex(0) +15>Emitted(85, 76) Source(97, 56) + SourceIndex(0) +16>Emitted(85, 77) Source(97, 57) + SourceIndex(0) +--- +>>> _56 = _55[_54], _57 = _56[0], nameMA = _57 === void 0 ? "noName" : _57, _58 = _56[1], _59 = _58 === void 0 ? ["skill1", "skill2"] : _58, _60 = _59[0], primarySkillA = _60 === void 0 ? "primary" : _60, _61 = _59[1], secondarySkillA = _61 === void 0 ? "secondary" : _61; +1->^^^^ +2 > ^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +15> ^^ +16> ^^^^^^^^^^^^ +17> ^^ +18> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > [nameMA = "noName", [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["skill1", "skill2"]] +3 > +4 > nameMA = "noName" +5 > +6 > nameMA = "noName" +7 > , +8 > [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["skill1", "skill2"] +9 > +10> [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["skill1", "skill2"] +11> +12> primarySkillA = "primary" +13> +14> primarySkillA = "primary" +15> , + > +16> secondarySkillA = "secondary" +17> +18> secondarySkillA = "secondary" +1->Emitted(86, 5) Source(94, 6) + SourceIndex(0) +2 >Emitted(86, 19) Source(97, 26) + SourceIndex(0) +3 >Emitted(86, 21) Source(94, 7) + SourceIndex(0) +4 >Emitted(86, 33) Source(94, 24) + SourceIndex(0) +5 >Emitted(86, 35) Source(94, 7) + SourceIndex(0) +6 >Emitted(86, 75) Source(94, 24) + SourceIndex(0) +7 >Emitted(86, 77) Source(94, 26) + SourceIndex(0) +8 >Emitted(86, 89) Source(97, 25) + SourceIndex(0) +9 >Emitted(86, 91) Source(94, 26) + SourceIndex(0) +10>Emitted(86, 140) Source(97, 25) + SourceIndex(0) +11>Emitted(86, 142) Source(95, 5) + SourceIndex(0) +12>Emitted(86, 154) Source(95, 30) + SourceIndex(0) +13>Emitted(86, 156) Source(95, 5) + SourceIndex(0) +14>Emitted(86, 204) Source(95, 30) + SourceIndex(0) +15>Emitted(86, 206) Source(96, 5) + SourceIndex(0) +16>Emitted(86, 218) Source(96, 34) + SourceIndex(0) +17>Emitted(86, 220) Source(96, 5) + SourceIndex(0) +18>Emitted(86, 272) Source(96, 34) + SourceIndex(0) +--- +>>> console.log(nameMA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^ +7 > ^ +8 > ^ +1 > + >] = ["skill1", "skill2"]] of [multiRobotA, multiRobotB]) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameMA +7 > ) +8 > ; +1 >Emitted(87, 5) Source(98, 5) + SourceIndex(0) +2 >Emitted(87, 12) Source(98, 12) + SourceIndex(0) +3 >Emitted(87, 13) Source(98, 13) + SourceIndex(0) +4 >Emitted(87, 16) Source(98, 16) + SourceIndex(0) +5 >Emitted(87, 17) Source(98, 17) + SourceIndex(0) +6 >Emitted(87, 23) Source(98, 23) + SourceIndex(0) +7 >Emitted(87, 24) Source(98, 24) + SourceIndex(0) +8 >Emitted(87, 25) Source(98, 25) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(88, 2) Source(99, 2) + SourceIndex(0) +--- +>>>for (var _62 = 0, robots_4 = robots; _62 < robots_4.length; _62++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^^^^^^^ +10> ^^ +11> ^^^^^ +12> ^ +13> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > + > +2 >for +3 > +4 > ([numberA3 = -1, ...robotAInfo] of +5 > robots +6 > +7 > robots +8 > +9 > robots +10> +11> robots +12> ) +1->Emitted(89, 1) Source(101, 1) + SourceIndex(0) +2 >Emitted(89, 4) Source(101, 4) + SourceIndex(0) +3 >Emitted(89, 5) Source(101, 5) + SourceIndex(0) +4 >Emitted(89, 6) Source(101, 40) + SourceIndex(0) +5 >Emitted(89, 17) Source(101, 46) + SourceIndex(0) +6 >Emitted(89, 19) Source(101, 40) + SourceIndex(0) +7 >Emitted(89, 36) Source(101, 46) + SourceIndex(0) +8 >Emitted(89, 38) Source(101, 40) + SourceIndex(0) +9 >Emitted(89, 59) Source(101, 46) + SourceIndex(0) +10>Emitted(89, 61) Source(101, 40) + SourceIndex(0) +11>Emitted(89, 66) Source(101, 46) + SourceIndex(0) +12>Emitted(89, 67) Source(101, 47) + SourceIndex(0) +--- +>>> _63 = robots_4[_62], _64 = _63[0], numberA3 = _64 === void 0 ? -1 : _64, robotAInfo = _63.slice(1); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > [numberA3 = -1, ...robotAInfo] +3 > +4 > numberA3 = -1 +5 > +6 > numberA3 = -1 +7 > , +8 > ...robotAInfo +1->Emitted(90, 5) Source(101, 6) + SourceIndex(0) +2 >Emitted(90, 24) Source(101, 36) + SourceIndex(0) +3 >Emitted(90, 26) Source(101, 7) + SourceIndex(0) +4 >Emitted(90, 38) Source(101, 20) + SourceIndex(0) +5 >Emitted(90, 40) Source(101, 7) + SourceIndex(0) +6 >Emitted(90, 76) Source(101, 20) + SourceIndex(0) +7 >Emitted(90, 78) Source(101, 22) + SourceIndex(0) +8 >Emitted(90, 103) Source(101, 35) + SourceIndex(0) +--- +>>> console.log(numberA3); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1 >] of robots) { + > +2 > console +3 > . +4 > log +5 > ( +6 > numberA3 +7 > ) +8 > ; +1 >Emitted(91, 5) Source(102, 5) + SourceIndex(0) +2 >Emitted(91, 12) Source(102, 12) + SourceIndex(0) +3 >Emitted(91, 13) Source(102, 13) + SourceIndex(0) +4 >Emitted(91, 16) Source(102, 16) + SourceIndex(0) +5 >Emitted(91, 17) Source(102, 17) + SourceIndex(0) +6 >Emitted(91, 25) Source(102, 25) + SourceIndex(0) +7 >Emitted(91, 26) Source(102, 26) + SourceIndex(0) +8 >Emitted(91, 27) Source(102, 27) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(92, 2) Source(103, 2) + SourceIndex(0) +--- +>>>for (var _65 = 0, _66 = getRobots(); _65 < _66.length; _65++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^ +8 > ^^^^^^^^^ +9 > ^^ +10> ^^ +11> ^^^^^^^^^^^^^^^^ +12> ^^ +13> ^^^^^ +14> ^ +15> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > ([numberA3 = -1, ...robotAInfo] of +5 > getRobots() +6 > +7 > +8 > getRobots +9 > () +10> +11> getRobots() +12> +13> getRobots() +14> ) +1->Emitted(93, 1) Source(104, 1) + SourceIndex(0) +2 >Emitted(93, 4) Source(104, 4) + SourceIndex(0) +3 >Emitted(93, 5) Source(104, 5) + SourceIndex(0) +4 >Emitted(93, 6) Source(104, 40) + SourceIndex(0) +5 >Emitted(93, 17) Source(104, 51) + SourceIndex(0) +6 >Emitted(93, 19) Source(104, 40) + SourceIndex(0) +7 >Emitted(93, 25) Source(104, 40) + SourceIndex(0) +8 >Emitted(93, 34) Source(104, 49) + SourceIndex(0) +9 >Emitted(93, 36) Source(104, 51) + SourceIndex(0) +10>Emitted(93, 38) Source(104, 40) + SourceIndex(0) +11>Emitted(93, 54) Source(104, 51) + SourceIndex(0) +12>Emitted(93, 56) Source(104, 40) + SourceIndex(0) +13>Emitted(93, 61) Source(104, 51) + SourceIndex(0) +14>Emitted(93, 62) Source(104, 52) + SourceIndex(0) +--- +>>> _67 = _66[_65], _68 = _67[0], numberA3 = _68 === void 0 ? -1 : _68, robotAInfo = _67.slice(1); +1->^^^^ +2 > ^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > [numberA3 = -1, ...robotAInfo] +3 > +4 > numberA3 = -1 +5 > +6 > numberA3 = -1 +7 > , +8 > ...robotAInfo +1->Emitted(94, 5) Source(104, 6) + SourceIndex(0) +2 >Emitted(94, 19) Source(104, 36) + SourceIndex(0) +3 >Emitted(94, 21) Source(104, 7) + SourceIndex(0) +4 >Emitted(94, 33) Source(104, 20) + SourceIndex(0) +5 >Emitted(94, 35) Source(104, 7) + SourceIndex(0) +6 >Emitted(94, 71) Source(104, 20) + SourceIndex(0) +7 >Emitted(94, 73) Source(104, 22) + SourceIndex(0) +8 >Emitted(94, 98) Source(104, 35) + SourceIndex(0) +--- +>>> console.log(numberA3); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1 >] of getRobots()) { + > +2 > console +3 > . +4 > log +5 > ( +6 > numberA3 +7 > ) +8 > ; +1 >Emitted(95, 5) Source(105, 5) + SourceIndex(0) +2 >Emitted(95, 12) Source(105, 12) + SourceIndex(0) +3 >Emitted(95, 13) Source(105, 13) + SourceIndex(0) +4 >Emitted(95, 16) Source(105, 16) + SourceIndex(0) +5 >Emitted(95, 17) Source(105, 17) + SourceIndex(0) +6 >Emitted(95, 25) Source(105, 25) + SourceIndex(0) +7 >Emitted(95, 26) Source(105, 26) + SourceIndex(0) +8 >Emitted(95, 27) Source(105, 27) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(96, 2) Source(106, 2) + SourceIndex(0) +--- +>>>for (var _69 = 0, _70 = [robotA, robotB]; _69 < _70.length; _69++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^ +8 > ^^^^^^ +9 > ^^ +10> ^^^^^^ +11> ^ +12> ^^ +13> ^^^^^^^^^^^^^^^^ +14> ^^ +15> ^^^^^ +16> ^ +17> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > ([numberA3 = -1, ...robotAInfo] of +5 > [robotA, robotB] +6 > +7 > [ +8 > robotA +9 > , +10> robotB +11> ] +12> +13> [robotA, robotB] +14> +15> [robotA, robotB] +16> ) +1->Emitted(97, 1) Source(107, 1) + SourceIndex(0) +2 >Emitted(97, 4) Source(107, 4) + SourceIndex(0) +3 >Emitted(97, 5) Source(107, 5) + SourceIndex(0) +4 >Emitted(97, 6) Source(107, 40) + SourceIndex(0) +5 >Emitted(97, 17) Source(107, 56) + SourceIndex(0) +6 >Emitted(97, 19) Source(107, 40) + SourceIndex(0) +7 >Emitted(97, 26) Source(107, 41) + SourceIndex(0) +8 >Emitted(97, 32) Source(107, 47) + SourceIndex(0) +9 >Emitted(97, 34) Source(107, 49) + SourceIndex(0) +10>Emitted(97, 40) Source(107, 55) + SourceIndex(0) +11>Emitted(97, 41) Source(107, 56) + SourceIndex(0) +12>Emitted(97, 43) Source(107, 40) + SourceIndex(0) +13>Emitted(97, 59) Source(107, 56) + SourceIndex(0) +14>Emitted(97, 61) Source(107, 40) + SourceIndex(0) +15>Emitted(97, 66) Source(107, 56) + SourceIndex(0) +16>Emitted(97, 67) Source(107, 57) + SourceIndex(0) +--- +>>> _71 = _70[_69], _72 = _71[0], numberA3 = _72 === void 0 ? -1 : _72, robotAInfo = _71.slice(1); +1->^^^^ +2 > ^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > [numberA3 = -1, ...robotAInfo] +3 > +4 > numberA3 = -1 +5 > +6 > numberA3 = -1 +7 > , +8 > ...robotAInfo +1->Emitted(98, 5) Source(107, 6) + SourceIndex(0) +2 >Emitted(98, 19) Source(107, 36) + SourceIndex(0) +3 >Emitted(98, 21) Source(107, 7) + SourceIndex(0) +4 >Emitted(98, 33) Source(107, 20) + SourceIndex(0) +5 >Emitted(98, 35) Source(107, 7) + SourceIndex(0) +6 >Emitted(98, 71) Source(107, 20) + SourceIndex(0) +7 >Emitted(98, 73) Source(107, 22) + SourceIndex(0) +8 >Emitted(98, 98) Source(107, 35) + SourceIndex(0) +--- +>>> console.log(numberA3); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1 >] of [robotA, robotB]) { + > +2 > console +3 > . +4 > log +5 > ( +6 > numberA3 +7 > ) +8 > ; +1 >Emitted(99, 5) Source(108, 5) + SourceIndex(0) +2 >Emitted(99, 12) Source(108, 12) + SourceIndex(0) +3 >Emitted(99, 13) Source(108, 13) + SourceIndex(0) +4 >Emitted(99, 16) Source(108, 16) + SourceIndex(0) +5 >Emitted(99, 17) Source(108, 17) + SourceIndex(0) +6 >Emitted(99, 25) Source(108, 25) + SourceIndex(0) +7 >Emitted(99, 26) Source(108, 26) + SourceIndex(0) +8 >Emitted(99, 27) Source(108, 27) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(100, 2) Source(109, 2) + SourceIndex(0) +--- +>>>var _a, _b, _e, _f, _j, _k, _m, _o, _p, _q, _r, _u, _v, _w, _x, _y, _1, _2, _3, _4, _5, _7, _10, _13, _15, _18, _21, _23, _24, _25, _26, _29, _30, _31, _32, _35, _36, _37, _38, _40, _41, _42, _43, _44, _45, _48, _49, _50, _51, _52, _53, _56, _57, _58, _59, _60, _61, _63, _64, _67, _68, _71, _72; +>>>//# sourceMappingURL=sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.symbols b/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.symbols new file mode 100644 index 00000000000..6b16ace03ea --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.symbols @@ -0,0 +1,345 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts === +declare var console: { +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 0, 11)) + + log(msg: any): void; +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 0, 22)) +>msg : Symbol(msg, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 1, 8)) +} +type Robot = [number, string, string]; +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 2, 1)) + +type MultiSkilledRobot = [string, [string, string]]; +>MultiSkilledRobot : Symbol(MultiSkilledRobot, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 3, 38)) + +let robotA: Robot = [1, "mower", "mowing"]; +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 6, 3)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 2, 1)) + +let robotB: Robot = [2, "trimmer", "trimming"]; +>robotB : Symbol(robotB, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 7, 3)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 2, 1)) + +let robots = [robotA, robotB]; +>robots : Symbol(robots, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 8, 3)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 6, 3)) +>robotB : Symbol(robotB, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 7, 3)) + +function getRobots() { +>getRobots : Symbol(getRobots, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 8, 30)) + + return robots; +>robots : Symbol(robots, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 8, 3)) +} + +let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; +>multiRobotA : Symbol(multiRobotA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 13, 3)) +>MultiSkilledRobot : Symbol(MultiSkilledRobot, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 3, 38)) + +let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; +>multiRobotB : Symbol(multiRobotB, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 14, 3)) +>MultiSkilledRobot : Symbol(MultiSkilledRobot, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 3, 38)) + +let multiRobots = [multiRobotA, multiRobotB]; +>multiRobots : Symbol(multiRobots, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 15, 3)) +>multiRobotA : Symbol(multiRobotA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 13, 3)) +>multiRobotB : Symbol(multiRobotB, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 14, 3)) + +function getMultiRobots() { +>getMultiRobots : Symbol(getMultiRobots, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 15, 45)) + + return multiRobots; +>multiRobots : Symbol(multiRobots, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 15, 3)) +} + +let nameA: string, primarySkillA: string, secondarySkillA: string; +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 20, 3)) +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 20, 18)) +>secondarySkillA : Symbol(secondarySkillA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 20, 41)) + +let numberB: number, nameB: string; +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 21, 3)) +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 21, 20)) + +let numberA2: number, nameA2: string, skillA2: string, nameMA: string; +>numberA2 : Symbol(numberA2, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 22, 3)) +>nameA2 : Symbol(nameA2, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 22, 21)) +>skillA2 : Symbol(skillA2, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 22, 37)) +>nameMA : Symbol(nameMA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 22, 54)) + +let numberA3: number, robotAInfo: (number | string)[], multiRobotAInfo: (string | [string, string])[]; +>numberA3 : Symbol(numberA3, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 23, 3)) +>robotAInfo : Symbol(robotAInfo, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 23, 21)) +>multiRobotAInfo : Symbol(multiRobotAInfo, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 23, 54)) + +for ([, nameA = "noName"] of robots) { +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 20, 3)) +>robots : Symbol(robots, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 8, 3)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 20, 3)) +} +for ([, nameA = "noName"] of getRobots()) { +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 20, 3)) +>getRobots : Symbol(getRobots, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 8, 30)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 20, 3)) +} +for ([, nameA = "noName"] of [robotA, robotB]) { +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 20, 3)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 6, 3)) +>robotB : Symbol(robotB, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 7, 3)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 20, 3)) +} +for ([, [ + primarySkillA = "primary", +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 20, 18)) + + secondarySkillA = "secondary" +>secondarySkillA : Symbol(secondarySkillA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 20, 41)) + +] = ["skill1", "skill2"]] of multiRobots) { +>multiRobots : Symbol(multiRobots, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 15, 3)) + + console.log(primarySkillA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 0, 22)) +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 20, 18)) +} +for ([, [ + primarySkillA = "primary", +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 20, 18)) + + secondarySkillA = "secondary" +>secondarySkillA : Symbol(secondarySkillA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 20, 41)) + +] = ["skill1", "skill2"]] of getMultiRobots()) { +>getMultiRobots : Symbol(getMultiRobots, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 15, 45)) + + console.log(primarySkillA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 0, 22)) +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 20, 18)) +} +for ([, [ + primarySkillA = "primary", +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 20, 18)) + + secondarySkillA = "secondary" +>secondarySkillA : Symbol(secondarySkillA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 20, 41)) + +] = ["skill1", "skill2"]] of [multiRobotA, multiRobotB]) { +>multiRobotA : Symbol(multiRobotA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 13, 3)) +>multiRobotB : Symbol(multiRobotB, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 14, 3)) + + console.log(primarySkillA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 0, 22)) +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 20, 18)) +} + +for ([numberB = -1] of robots) { +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 21, 3)) +>robots : Symbol(robots, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 8, 3)) + + console.log(numberB); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 0, 22)) +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 21, 3)) +} +for ([numberB = -1] of getRobots()) { +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 21, 3)) +>getRobots : Symbol(getRobots, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 8, 30)) + + console.log(numberB); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 0, 22)) +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 21, 3)) +} +for ([numberB = -1] of [robotA, robotB]) { +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 21, 3)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 6, 3)) +>robotB : Symbol(robotB, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 7, 3)) + + console.log(numberB); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 0, 22)) +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 21, 3)) +} +for ([nameB = "noName"] of multiRobots) { +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 21, 20)) +>multiRobots : Symbol(multiRobots, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 15, 3)) + + console.log(nameB); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 0, 22)) +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 21, 20)) +} +for ([nameB = "noName"] of getMultiRobots()) { +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 21, 20)) +>getMultiRobots : Symbol(getMultiRobots, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 15, 45)) + + console.log(nameB); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 0, 22)) +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 21, 20)) +} +for ([nameB = "noName"] of [multiRobotA, multiRobotB]) { +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 21, 20)) +>multiRobotA : Symbol(multiRobotA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 13, 3)) +>multiRobotB : Symbol(multiRobotB, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 14, 3)) + + console.log(nameB); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 0, 22)) +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 21, 20)) +} + +for ([numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of robots) { +>numberA2 : Symbol(numberA2, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 22, 3)) +>nameA2 : Symbol(nameA2, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 22, 21)) +>skillA2 : Symbol(skillA2, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 22, 37)) +>robots : Symbol(robots, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 8, 3)) + + console.log(nameA2); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 0, 22)) +>nameA2 : Symbol(nameA2, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 22, 21)) +} +for ([numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of getRobots()) { +>numberA2 : Symbol(numberA2, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 22, 3)) +>nameA2 : Symbol(nameA2, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 22, 21)) +>skillA2 : Symbol(skillA2, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 22, 37)) +>getRobots : Symbol(getRobots, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 8, 30)) + + console.log(nameA2); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 0, 22)) +>nameA2 : Symbol(nameA2, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 22, 21)) +} +for ([numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of [robotA, robotB]) { +>numberA2 : Symbol(numberA2, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 22, 3)) +>nameA2 : Symbol(nameA2, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 22, 21)) +>skillA2 : Symbol(skillA2, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 22, 37)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 6, 3)) +>robotB : Symbol(robotB, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 7, 3)) + + console.log(nameA2); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 0, 22)) +>nameA2 : Symbol(nameA2, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 22, 21)) +} +for ([nameMA = "noName", [ +>nameMA : Symbol(nameMA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 22, 54)) + + primarySkillA = "primary", +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 20, 18)) + + secondarySkillA = "secondary" +>secondarySkillA : Symbol(secondarySkillA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 20, 41)) + +] = ["skill1", "skill2"]] of multiRobots) { +>multiRobots : Symbol(multiRobots, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 15, 3)) + + console.log(nameMA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 0, 22)) +>nameMA : Symbol(nameMA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 22, 54)) +} +for ([nameMA = "noName", [ +>nameMA : Symbol(nameMA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 22, 54)) + + primarySkillA = "primary", +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 20, 18)) + + secondarySkillA = "secondary" +>secondarySkillA : Symbol(secondarySkillA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 20, 41)) + +] = ["skill1", "skill2"]] of getMultiRobots()) { +>getMultiRobots : Symbol(getMultiRobots, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 15, 45)) + + console.log(nameMA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 0, 22)) +>nameMA : Symbol(nameMA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 22, 54)) +} +for ([nameMA = "noName", [ +>nameMA : Symbol(nameMA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 22, 54)) + + primarySkillA = "primary", +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 20, 18)) + + secondarySkillA = "secondary" +>secondarySkillA : Symbol(secondarySkillA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 20, 41)) + +] = ["skill1", "skill2"]] of [multiRobotA, multiRobotB]) { +>multiRobotA : Symbol(multiRobotA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 13, 3)) +>multiRobotB : Symbol(multiRobotB, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 14, 3)) + + console.log(nameMA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 0, 22)) +>nameMA : Symbol(nameMA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 22, 54)) +} + +for ([numberA3 = -1, ...robotAInfo] of robots) { +>numberA3 : Symbol(numberA3, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 23, 3)) +>robotAInfo : Symbol(robotAInfo, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 23, 21)) +>robots : Symbol(robots, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 8, 3)) + + console.log(numberA3); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 0, 22)) +>numberA3 : Symbol(numberA3, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 23, 3)) +} +for ([numberA3 = -1, ...robotAInfo] of getRobots()) { +>numberA3 : Symbol(numberA3, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 23, 3)) +>robotAInfo : Symbol(robotAInfo, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 23, 21)) +>getRobots : Symbol(getRobots, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 8, 30)) + + console.log(numberA3); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 0, 22)) +>numberA3 : Symbol(numberA3, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 23, 3)) +} +for ([numberA3 = -1, ...robotAInfo] of [robotA, robotB]) { +>numberA3 : Symbol(numberA3, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 23, 3)) +>robotAInfo : Symbol(robotAInfo, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 23, 21)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 6, 3)) +>robotB : Symbol(robotB, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 7, 3)) + + console.log(numberA3); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 0, 22)) +>numberA3 : Symbol(numberA3, Decl(sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts, 23, 3)) +} diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.types b/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.types new file mode 100644 index 00000000000..5f580ad38f4 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.types @@ -0,0 +1,544 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts === +declare var console: { +>console : { log(msg: any): void; } + + log(msg: any): void; +>log : (msg: any) => void +>msg : any +} +type Robot = [number, string, string]; +>Robot : [number, string, string] + +type MultiSkilledRobot = [string, [string, string]]; +>MultiSkilledRobot : [string, [string, string]] + +let robotA: Robot = [1, "mower", "mowing"]; +>robotA : [number, string, string] +>Robot : [number, string, string] +>[1, "mower", "mowing"] : [number, string, string] +>1 : number +>"mower" : string +>"mowing" : string + +let robotB: Robot = [2, "trimmer", "trimming"]; +>robotB : [number, string, string] +>Robot : [number, string, string] +>[2, "trimmer", "trimming"] : [number, string, string] +>2 : number +>"trimmer" : string +>"trimming" : string + +let robots = [robotA, robotB]; +>robots : [number, string, string][] +>[robotA, robotB] : [number, string, string][] +>robotA : [number, string, string] +>robotB : [number, string, string] + +function getRobots() { +>getRobots : () => [number, string, string][] + + return robots; +>robots : [number, string, string][] +} + +let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; +>multiRobotA : [string, [string, string]] +>MultiSkilledRobot : [string, [string, string]] +>["mower", ["mowing", ""]] : [string, [string, string]] +>"mower" : string +>["mowing", ""] : [string, string] +>"mowing" : string +>"" : string + +let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; +>multiRobotB : [string, [string, string]] +>MultiSkilledRobot : [string, [string, string]] +>["trimmer", ["trimming", "edging"]] : [string, [string, string]] +>"trimmer" : string +>["trimming", "edging"] : [string, string] +>"trimming" : string +>"edging" : string + +let multiRobots = [multiRobotA, multiRobotB]; +>multiRobots : [string, [string, string]][] +>[multiRobotA, multiRobotB] : [string, [string, string]][] +>multiRobotA : [string, [string, string]] +>multiRobotB : [string, [string, string]] + +function getMultiRobots() { +>getMultiRobots : () => [string, [string, string]][] + + return multiRobots; +>multiRobots : [string, [string, string]][] +} + +let nameA: string, primarySkillA: string, secondarySkillA: string; +>nameA : string +>primarySkillA : string +>secondarySkillA : string + +let numberB: number, nameB: string; +>numberB : number +>nameB : string + +let numberA2: number, nameA2: string, skillA2: string, nameMA: string; +>numberA2 : number +>nameA2 : string +>skillA2 : string +>nameMA : string + +let numberA3: number, robotAInfo: (number | string)[], multiRobotAInfo: (string | [string, string])[]; +>numberA3 : number +>robotAInfo : (number | string)[] +>multiRobotAInfo : (string | [string, string])[] + +for ([, nameA = "noName"] of robots) { +>[, nameA = "noName"] : [undefined, string] +> : undefined +>nameA = "noName" : string +>nameA : string +>"noName" : string +>robots : [number, string, string][] + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for ([, nameA = "noName"] of getRobots()) { +>[, nameA = "noName"] : [undefined, string] +> : undefined +>nameA = "noName" : string +>nameA : string +>"noName" : string +>getRobots() : [number, string, string][] +>getRobots : () => [number, string, string][] + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for ([, nameA = "noName"] of [robotA, robotB]) { +>[, nameA = "noName"] : [undefined, string] +> : undefined +>nameA = "noName" : string +>nameA : string +>"noName" : string +>[robotA, robotB] : [number, string, string][] +>robotA : [number, string, string] +>robotB : [number, string, string] + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for ([, [ +>[, [ primarySkillA = "primary", secondarySkillA = "secondary"] = ["skill1", "skill2"]] : [undefined, [string, string]] +> : undefined +>[ primarySkillA = "primary", secondarySkillA = "secondary"] = ["skill1", "skill2"] : [string, string] +>[ primarySkillA = "primary", secondarySkillA = "secondary"] : [string, string] + + primarySkillA = "primary", +>primarySkillA = "primary" : string +>primarySkillA : string +>"primary" : string + + secondarySkillA = "secondary" +>secondarySkillA = "secondary" : string +>secondarySkillA : string +>"secondary" : string + +] = ["skill1", "skill2"]] of multiRobots) { +>["skill1", "skill2"] : [string, string] +>"skill1" : string +>"skill2" : string +>multiRobots : [string, [string, string]][] + + console.log(primarySkillA); +>console.log(primarySkillA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primarySkillA : string +} +for ([, [ +>[, [ primarySkillA = "primary", secondarySkillA = "secondary"] = ["skill1", "skill2"]] : [undefined, [string, string]] +> : undefined +>[ primarySkillA = "primary", secondarySkillA = "secondary"] = ["skill1", "skill2"] : [string, string] +>[ primarySkillA = "primary", secondarySkillA = "secondary"] : [string, string] + + primarySkillA = "primary", +>primarySkillA = "primary" : string +>primarySkillA : string +>"primary" : string + + secondarySkillA = "secondary" +>secondarySkillA = "secondary" : string +>secondarySkillA : string +>"secondary" : string + +] = ["skill1", "skill2"]] of getMultiRobots()) { +>["skill1", "skill2"] : [string, string] +>"skill1" : string +>"skill2" : string +>getMultiRobots() : [string, [string, string]][] +>getMultiRobots : () => [string, [string, string]][] + + console.log(primarySkillA); +>console.log(primarySkillA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primarySkillA : string +} +for ([, [ +>[, [ primarySkillA = "primary", secondarySkillA = "secondary"] = ["skill1", "skill2"]] : [undefined, [string, string]] +> : undefined +>[ primarySkillA = "primary", secondarySkillA = "secondary"] = ["skill1", "skill2"] : [string, string] +>[ primarySkillA = "primary", secondarySkillA = "secondary"] : [string, string] + + primarySkillA = "primary", +>primarySkillA = "primary" : string +>primarySkillA : string +>"primary" : string + + secondarySkillA = "secondary" +>secondarySkillA = "secondary" : string +>secondarySkillA : string +>"secondary" : string + +] = ["skill1", "skill2"]] of [multiRobotA, multiRobotB]) { +>["skill1", "skill2"] : [string, string] +>"skill1" : string +>"skill2" : string +>[multiRobotA, multiRobotB] : [string, [string, string]][] +>multiRobotA : [string, [string, string]] +>multiRobotB : [string, [string, string]] + + console.log(primarySkillA); +>console.log(primarySkillA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primarySkillA : string +} + +for ([numberB = -1] of robots) { +>[numberB = -1] : [number] +>numberB = -1 : number +>numberB : number +>-1 : number +>1 : number +>robots : [number, string, string][] + + console.log(numberB); +>console.log(numberB) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>numberB : number +} +for ([numberB = -1] of getRobots()) { +>[numberB = -1] : [number] +>numberB = -1 : number +>numberB : number +>-1 : number +>1 : number +>getRobots() : [number, string, string][] +>getRobots : () => [number, string, string][] + + console.log(numberB); +>console.log(numberB) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>numberB : number +} +for ([numberB = -1] of [robotA, robotB]) { +>[numberB = -1] : [number] +>numberB = -1 : number +>numberB : number +>-1 : number +>1 : number +>[robotA, robotB] : [number, string, string][] +>robotA : [number, string, string] +>robotB : [number, string, string] + + console.log(numberB); +>console.log(numberB) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>numberB : number +} +for ([nameB = "noName"] of multiRobots) { +>[nameB = "noName"] : [string] +>nameB = "noName" : string +>nameB : string +>"noName" : string +>multiRobots : [string, [string, string]][] + + console.log(nameB); +>console.log(nameB) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameB : string +} +for ([nameB = "noName"] of getMultiRobots()) { +>[nameB = "noName"] : [string] +>nameB = "noName" : string +>nameB : string +>"noName" : string +>getMultiRobots() : [string, [string, string]][] +>getMultiRobots : () => [string, [string, string]][] + + console.log(nameB); +>console.log(nameB) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameB : string +} +for ([nameB = "noName"] of [multiRobotA, multiRobotB]) { +>[nameB = "noName"] : [string] +>nameB = "noName" : string +>nameB : string +>"noName" : string +>[multiRobotA, multiRobotB] : [string, [string, string]][] +>multiRobotA : [string, [string, string]] +>multiRobotB : [string, [string, string]] + + console.log(nameB); +>console.log(nameB) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameB : string +} + +for ([numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of robots) { +>[numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] : [number, string, string] +>numberA2 = -1 : number +>numberA2 : number +>-1 : number +>1 : number +>nameA2 = "noName" : string +>nameA2 : string +>"noName" : string +>skillA2 = "skill" : string +>skillA2 : string +>"skill" : string +>robots : [number, string, string][] + + console.log(nameA2); +>console.log(nameA2) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA2 : string +} +for ([numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of getRobots()) { +>[numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] : [number, string, string] +>numberA2 = -1 : number +>numberA2 : number +>-1 : number +>1 : number +>nameA2 = "noName" : string +>nameA2 : string +>"noName" : string +>skillA2 = "skill" : string +>skillA2 : string +>"skill" : string +>getRobots() : [number, string, string][] +>getRobots : () => [number, string, string][] + + console.log(nameA2); +>console.log(nameA2) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA2 : string +} +for ([numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of [robotA, robotB]) { +>[numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] : [number, string, string] +>numberA2 = -1 : number +>numberA2 : number +>-1 : number +>1 : number +>nameA2 = "noName" : string +>nameA2 : string +>"noName" : string +>skillA2 = "skill" : string +>skillA2 : string +>"skill" : string +>[robotA, robotB] : [number, string, string][] +>robotA : [number, string, string] +>robotB : [number, string, string] + + console.log(nameA2); +>console.log(nameA2) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA2 : string +} +for ([nameMA = "noName", [ +>[nameMA = "noName", [ primarySkillA = "primary", secondarySkillA = "secondary"] = ["skill1", "skill2"]] : [string, [string, string]] +>nameMA = "noName" : string +>nameMA : string +>"noName" : string +>[ primarySkillA = "primary", secondarySkillA = "secondary"] = ["skill1", "skill2"] : [string, string] +>[ primarySkillA = "primary", secondarySkillA = "secondary"] : [string, string] + + primarySkillA = "primary", +>primarySkillA = "primary" : string +>primarySkillA : string +>"primary" : string + + secondarySkillA = "secondary" +>secondarySkillA = "secondary" : string +>secondarySkillA : string +>"secondary" : string + +] = ["skill1", "skill2"]] of multiRobots) { +>["skill1", "skill2"] : [string, string] +>"skill1" : string +>"skill2" : string +>multiRobots : [string, [string, string]][] + + console.log(nameMA); +>console.log(nameMA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameMA : string +} +for ([nameMA = "noName", [ +>[nameMA = "noName", [ primarySkillA = "primary", secondarySkillA = "secondary"] = ["skill1", "skill2"]] : [string, [string, string]] +>nameMA = "noName" : string +>nameMA : string +>"noName" : string +>[ primarySkillA = "primary", secondarySkillA = "secondary"] = ["skill1", "skill2"] : [string, string] +>[ primarySkillA = "primary", secondarySkillA = "secondary"] : [string, string] + + primarySkillA = "primary", +>primarySkillA = "primary" : string +>primarySkillA : string +>"primary" : string + + secondarySkillA = "secondary" +>secondarySkillA = "secondary" : string +>secondarySkillA : string +>"secondary" : string + +] = ["skill1", "skill2"]] of getMultiRobots()) { +>["skill1", "skill2"] : [string, string] +>"skill1" : string +>"skill2" : string +>getMultiRobots() : [string, [string, string]][] +>getMultiRobots : () => [string, [string, string]][] + + console.log(nameMA); +>console.log(nameMA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameMA : string +} +for ([nameMA = "noName", [ +>[nameMA = "noName", [ primarySkillA = "primary", secondarySkillA = "secondary"] = ["skill1", "skill2"]] : [string, [string, string]] +>nameMA = "noName" : string +>nameMA : string +>"noName" : string +>[ primarySkillA = "primary", secondarySkillA = "secondary"] = ["skill1", "skill2"] : [string, string] +>[ primarySkillA = "primary", secondarySkillA = "secondary"] : [string, string] + + primarySkillA = "primary", +>primarySkillA = "primary" : string +>primarySkillA : string +>"primary" : string + + secondarySkillA = "secondary" +>secondarySkillA = "secondary" : string +>secondarySkillA : string +>"secondary" : string + +] = ["skill1", "skill2"]] of [multiRobotA, multiRobotB]) { +>["skill1", "skill2"] : [string, string] +>"skill1" : string +>"skill2" : string +>[multiRobotA, multiRobotB] : [string, [string, string]][] +>multiRobotA : [string, [string, string]] +>multiRobotB : [string, [string, string]] + + console.log(nameMA); +>console.log(nameMA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameMA : string +} + +for ([numberA3 = -1, ...robotAInfo] of robots) { +>[numberA3 = -1, ...robotAInfo] : (number | string)[] +>numberA3 = -1 : number +>numberA3 : number +>-1 : number +>1 : number +>...robotAInfo : number | string +>robotAInfo : (number | string)[] +>robots : [number, string, string][] + + console.log(numberA3); +>console.log(numberA3) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>numberA3 : number +} +for ([numberA3 = -1, ...robotAInfo] of getRobots()) { +>[numberA3 = -1, ...robotAInfo] : (number | string)[] +>numberA3 = -1 : number +>numberA3 : number +>-1 : number +>1 : number +>...robotAInfo : number | string +>robotAInfo : (number | string)[] +>getRobots() : [number, string, string][] +>getRobots : () => [number, string, string][] + + console.log(numberA3); +>console.log(numberA3) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>numberA3 : number +} +for ([numberA3 = -1, ...robotAInfo] of [robotA, robotB]) { +>[numberA3 = -1, ...robotAInfo] : (number | string)[] +>numberA3 = -1 : number +>numberA3 : number +>-1 : number +>1 : number +>...robotAInfo : number | string +>robotAInfo : (number | string)[] +>[robotA, robotB] : [number, string, string][] +>robotA : [number, string, string] +>robotB : [number, string, string] + + console.log(numberA3); +>console.log(numberA3) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>numberA3 : number +} diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPattern.js b/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPattern.js new file mode 100644 index 00000000000..247e23ff1f1 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPattern.js @@ -0,0 +1,130 @@ +//// [sourceMapValidationDestructuringForOfObjectBindingPattern.ts] +declare var console: { + log(msg: any): void; +} +interface Robot { + name: string; + skill: string; +} + +interface MultiRobot { + name: string; + skills: { + primary: string; + secondary: string; + }; +} + +let robots: Robot[] = [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]; +let multiRobots: MultiRobot[] = [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]; + +function getRobots() { + return robots; +} + +function getMultiRobots() { + return multiRobots; +} + +for (let {name: nameA } of robots) { + console.log(nameA); +} +for (let {name: nameA } of getRobots()) { + console.log(nameA); +} +for (let {name: nameA } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { + console.log(nameA); +} +for (let { skills: { primary: primaryA, secondary: secondaryA } } of multiRobots) { + console.log(primaryA); +} +for (let { skills: { primary: primaryA, secondary: secondaryA } } of getMultiRobots()) { + console.log(primaryA); +} +for (let { skills: { primary: primaryA, secondary: secondaryA } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { + console.log(primaryA); +} + +for (let {name: nameA, skill: skillA } of robots) { + console.log(nameA); +} +for (let {name: nameA, skill: skillA } of getRobots()) { + console.log(nameA); +} +for (let {name: nameA, skill: skillA } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { + console.log(nameA); +} +for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of multiRobots) { + console.log(nameA); +} +for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of getMultiRobots()) { + console.log(nameA); +} +for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { + console.log(nameA); +} + +//// [sourceMapValidationDestructuringForOfObjectBindingPattern.js] +var robots = [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]; +var multiRobots = [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]; +function getRobots() { + return robots; +} +function getMultiRobots() { + return multiRobots; +} +for (var _i = 0, robots_1 = robots; _i < robots_1.length; _i++) { + var nameA = robots_1[_i].name; + console.log(nameA); +} +for (var _a = 0, _b = getRobots(); _a < _b.length; _a++) { + var nameA = _b[_a].name; + console.log(nameA); +} +for (var _c = 0, _d = [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]; _c < _d.length; _c++) { + var nameA = _d[_c].name; + console.log(nameA); +} +for (var _e = 0, multiRobots_1 = multiRobots; _e < multiRobots_1.length; _e++) { + var _f = multiRobots_1[_e].skills, primaryA = _f.primary, secondaryA = _f.secondary; + console.log(primaryA); +} +for (var _g = 0, _h = getMultiRobots(); _g < _h.length; _g++) { + var _j = _h[_g].skills, primaryA = _j.primary, secondaryA = _j.secondary; + console.log(primaryA); +} +for (var _k = 0, _l = [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]; _k < _l.length; _k++) { + var _m = _l[_k].skills, primaryA = _m.primary, secondaryA = _m.secondary; + console.log(primaryA); +} +for (var _o = 0, robots_2 = robots; _o < robots_2.length; _o++) { + var _p = robots_2[_o], nameA = _p.name, skillA = _p.skill; + console.log(nameA); +} +for (var _q = 0, _r = getRobots(); _q < _r.length; _q++) { + var _s = _r[_q], nameA = _s.name, skillA = _s.skill; + console.log(nameA); +} +for (var _t = 0, _u = [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]; _t < _u.length; _t++) { + var _v = _u[_t], nameA = _v.name, skillA = _v.skill; + console.log(nameA); +} +for (var _w = 0, multiRobots_2 = multiRobots; _w < multiRobots_2.length; _w++) { + var _x = multiRobots_2[_w], nameA = _x.name, _y = _x.skills, primaryA = _y.primary, secondaryA = _y.secondary; + console.log(nameA); +} +for (var _z = 0, _0 = getMultiRobots(); _z < _0.length; _z++) { + var _1 = _0[_z], nameA = _1.name, _2 = _1.skills, primaryA = _2.primary, secondaryA = _2.secondary; + console.log(nameA); +} +for (var _3 = 0, _4 = [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]; _3 < _4.length; _3++) { + var _5 = _4[_3], nameA = _5.name, _6 = _5.skills, primaryA = _6.primary, secondaryA = _6.secondary; + console.log(nameA); +} +//# sourceMappingURL=sourceMapValidationDestructuringForOfObjectBindingPattern.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPattern.js.map b/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPattern.js.map new file mode 100644 index 00000000000..3f10e267eb9 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPattern.js.map @@ -0,0 +1,2 @@ +//// [sourceMapValidationDestructuringForOfObjectBindingPattern.js.map] +{"version":3,"file":"sourceMapValidationDestructuringForOfObjectBindingPattern.js","sourceRoot":"","sources":["sourceMapValidationDestructuringForOfObjectBindingPattern.ts"],"names":[],"mappings":"AAgBA,IAAI,MAAM,GAAY,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAC;AACnG,IAAI,WAAW,GAAiB,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE;IAChG,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAC;AAE/E;IACI,MAAM,CAAC,MAAM,CAAC;AAClB,CAAC;AAED;IACI,MAAM,CAAC,WAAW,CAAC;AACvB,CAAC;AAED,GAAG,CAAC,CAAuB,UAAM,EAAN,iBAAM,EAAN,oBAAM,EAAN,IAAM,CAAC;IAAxB,6BAAW;IACjB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB;AACD,GAAG,CAAC,CAAuB,UAAW,EAAX,KAAA,SAAS,EAAE,EAAX,cAAW,EAAX,IAAW,CAAC;IAA7B,uBAAW;IACjB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB;AACD,GAAG,CAAC,CAAuB,UAA4E,EAA5E,MAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,EAA5E,cAA4E,EAA5E,IAA4E,CAAC;IAA9F,uBAAW;IACjB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB;AACD,GAAG,CAAC,CAAiE,UAAW,EAAX,2BAAW,EAAX,yBAAW,EAAX,IAAW,CAAC;IAAtE,iCAAoD,EAA1C,qBAAiB,EAAE,yBAAqB;IACzD,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;CACzB;AACD,GAAG,CAAC,CAAiE,UAAgB,EAAhB,KAAA,cAAc,EAAE,EAAhB,cAAgB,EAAhB,IAAgB,CAAC;IAA3E,sBAAoD,EAA1C,qBAAiB,EAAE,yBAAqB;IACzD,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;CACzB;AACD,GAAG,CAAC,CAAiE,UACS,EADT,MAAC,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE;IACrI,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,CAAC,EADT,cACS,EADT,IACS,CAAC;IADpE,sBAAoD,EAA1C,qBAAiB,EAAE,yBAAqB;IAEzD,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;CACzB;AAED,GAAG,CAAC,CAAsC,UAAM,EAAN,iBAAM,EAAN,oBAAM,EAAN,IAAM,CAAC;IAA5C,qBAAiC,EAA5B,eAAW,EAAE,iBAAa;IAChC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB;AACD,GAAG,CAAC,CAAsC,UAAW,EAAX,KAAA,SAAS,EAAE,EAAX,cAAW,EAAX,IAAW,CAAC;IAAjD,eAAiC,EAA5B,eAAW,EAAE,iBAAa;IAChC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB;AACD,GAAG,CAAC,CAAsC,UAA4E,EAA5E,MAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,EAA5E,cAA4E,EAA5E,IAA4E,CAAC;IAAlH,eAAiC,EAA5B,eAAW,EAAE,iBAAa;IAChC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB;AACD,GAAG,CAAC,CAA6E,UAAW,EAAX,2BAAW,EAAX,yBAAW,EAAX,IAAW,CAAC;IAAxF,0BAAwE,EAAnE,eAAW,EAAE,cAAoD,EAA1C,qBAAiB,EAAE,yBAAqB;IACrE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB;AACD,GAAG,CAAC,CAA6E,UAAgB,EAAhB,KAAA,cAAc,EAAE,EAAhB,cAAgB,EAAhB,IAAgB,CAAC;IAA7F,eAAwE,EAAnE,eAAW,EAAE,cAAoD,EAA1C,qBAAiB,EAAE,yBAAqB;IACrE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB;AACD,GAAG,CAAC,CAA6E,UACH,EADG,MAAC,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE;IACjJ,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,CAAC,EADG,cACH,EADG,IACH,CAAC;IAD1E,eAAwE,EAAnE,eAAW,EAAE,cAAoD,EAA1C,qBAAiB,EAAE,yBAAqB;IAErE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPattern.sourcemap.txt b/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPattern.sourcemap.txt new file mode 100644 index 00000000000..5403a0863a3 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPattern.sourcemap.txt @@ -0,0 +1,1811 @@ +=================================================================== +JsFile: sourceMapValidationDestructuringForOfObjectBindingPattern.js +mapUrl: sourceMapValidationDestructuringForOfObjectBindingPattern.js.map +sourceRoot: +sources: sourceMapValidationDestructuringForOfObjectBindingPattern.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/sourceMapValidationDestructuringForOfObjectBindingPattern.js +sourceFile:sourceMapValidationDestructuringForOfObjectBindingPattern.ts +------------------------------------------------------------------- +>>>var robots = [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]; +1 > +2 >^^^^ +3 > ^^^^^^ +4 > ^^^ +5 > ^ +6 > ^^ +7 > ^^^^ +8 > ^^ +9 > ^^^^^^^ +10> ^^ +11> ^^^^^ +12> ^^ +13> ^^^^^^^^ +14> ^^ +15> ^^ +16> ^^ +17> ^^^^ +18> ^^ +19> ^^^^^^^^^ +20> ^^ +21> ^^^^^ +22> ^^ +23> ^^^^^^^^^^ +24> ^^ +25> ^ +26> ^ +1 >declare var console: { + > log(msg: any): void; + >} + >interface Robot { + > name: string; + > skill: string; + >} + > + >interface MultiRobot { + > name: string; + > skills: { + > primary: string; + > secondary: string; + > }; + >} + > + > +2 >let +3 > robots +4 > : Robot[] = +5 > [ +6 > { +7 > name +8 > : +9 > "mower" +10> , +11> skill +12> : +13> "mowing" +14> } +15> , +16> { +17> name +18> : +19> "trimmer" +20> , +21> skill +22> : +23> "trimming" +24> } +25> ] +26> ; +1 >Emitted(1, 1) Source(17, 1) + SourceIndex(0) +2 >Emitted(1, 5) Source(17, 5) + SourceIndex(0) +3 >Emitted(1, 11) Source(17, 11) + SourceIndex(0) +4 >Emitted(1, 14) Source(17, 23) + SourceIndex(0) +5 >Emitted(1, 15) Source(17, 24) + SourceIndex(0) +6 >Emitted(1, 17) Source(17, 26) + SourceIndex(0) +7 >Emitted(1, 21) Source(17, 30) + SourceIndex(0) +8 >Emitted(1, 23) Source(17, 32) + SourceIndex(0) +9 >Emitted(1, 30) Source(17, 39) + SourceIndex(0) +10>Emitted(1, 32) Source(17, 41) + SourceIndex(0) +11>Emitted(1, 37) Source(17, 46) + SourceIndex(0) +12>Emitted(1, 39) Source(17, 48) + SourceIndex(0) +13>Emitted(1, 47) Source(17, 56) + SourceIndex(0) +14>Emitted(1, 49) Source(17, 58) + SourceIndex(0) +15>Emitted(1, 51) Source(17, 60) + SourceIndex(0) +16>Emitted(1, 53) Source(17, 62) + SourceIndex(0) +17>Emitted(1, 57) Source(17, 66) + SourceIndex(0) +18>Emitted(1, 59) Source(17, 68) + SourceIndex(0) +19>Emitted(1, 68) Source(17, 77) + SourceIndex(0) +20>Emitted(1, 70) Source(17, 79) + SourceIndex(0) +21>Emitted(1, 75) Source(17, 84) + SourceIndex(0) +22>Emitted(1, 77) Source(17, 86) + SourceIndex(0) +23>Emitted(1, 87) Source(17, 96) + SourceIndex(0) +24>Emitted(1, 89) Source(17, 98) + SourceIndex(0) +25>Emitted(1, 90) Source(17, 99) + SourceIndex(0) +26>Emitted(1, 91) Source(17, 100) + SourceIndex(0) +--- +>>>var multiRobots = [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, +1 > +2 >^^^^ +3 > ^^^^^^^^^^^ +4 > ^^^ +5 > ^ +6 > ^^ +7 > ^^^^ +8 > ^^ +9 > ^^^^^^^ +10> ^^ +11> ^^^^^^ +12> ^^ +13> ^^ +14> ^^^^^^^ +15> ^^ +16> ^^^^^^^^ +17> ^^ +18> ^^^^^^^^^ +19> ^^ +20> ^^^^^^ +21> ^^ +22> ^^ +1 > + > +2 >let +3 > multiRobots +4 > : MultiRobot[] = +5 > [ +6 > { +7 > name +8 > : +9 > "mower" +10> , +11> skills +12> : +13> { +14> primary +15> : +16> "mowing" +17> , +18> secondary +19> : +20> "none" +21> } +22> } +1 >Emitted(2, 1) Source(18, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(18, 5) + SourceIndex(0) +3 >Emitted(2, 16) Source(18, 16) + SourceIndex(0) +4 >Emitted(2, 19) Source(18, 33) + SourceIndex(0) +5 >Emitted(2, 20) Source(18, 34) + SourceIndex(0) +6 >Emitted(2, 22) Source(18, 36) + SourceIndex(0) +7 >Emitted(2, 26) Source(18, 40) + SourceIndex(0) +8 >Emitted(2, 28) Source(18, 42) + SourceIndex(0) +9 >Emitted(2, 35) Source(18, 49) + SourceIndex(0) +10>Emitted(2, 37) Source(18, 51) + SourceIndex(0) +11>Emitted(2, 43) Source(18, 57) + SourceIndex(0) +12>Emitted(2, 45) Source(18, 59) + SourceIndex(0) +13>Emitted(2, 47) Source(18, 61) + SourceIndex(0) +14>Emitted(2, 54) Source(18, 68) + SourceIndex(0) +15>Emitted(2, 56) Source(18, 70) + SourceIndex(0) +16>Emitted(2, 64) Source(18, 78) + SourceIndex(0) +17>Emitted(2, 66) Source(18, 80) + SourceIndex(0) +18>Emitted(2, 75) Source(18, 89) + SourceIndex(0) +19>Emitted(2, 77) Source(18, 91) + SourceIndex(0) +20>Emitted(2, 83) Source(18, 97) + SourceIndex(0) +21>Emitted(2, 85) Source(18, 99) + SourceIndex(0) +22>Emitted(2, 87) Source(18, 101) + SourceIndex(0) +--- +>>> { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]; +1 >^^^^ +2 > ^^ +3 > ^^^^ +4 > ^^ +5 > ^^^^^^^^^ +6 > ^^ +7 > ^^^^^^ +8 > ^^ +9 > ^^ +10> ^^^^^^^ +11> ^^ +12> ^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^ +15> ^^ +16> ^^^^^^^^ +17> ^^ +18> ^^ +19> ^ +20> ^ +1 >, + > +2 > { +3 > name +4 > : +5 > "trimmer" +6 > , +7 > skills +8 > : +9 > { +10> primary +11> : +12> "trimming" +13> , +14> secondary +15> : +16> "edging" +17> } +18> } +19> ] +20> ; +1 >Emitted(3, 5) Source(19, 5) + SourceIndex(0) +2 >Emitted(3, 7) Source(19, 7) + SourceIndex(0) +3 >Emitted(3, 11) Source(19, 11) + SourceIndex(0) +4 >Emitted(3, 13) Source(19, 13) + SourceIndex(0) +5 >Emitted(3, 22) Source(19, 22) + SourceIndex(0) +6 >Emitted(3, 24) Source(19, 24) + SourceIndex(0) +7 >Emitted(3, 30) Source(19, 30) + SourceIndex(0) +8 >Emitted(3, 32) Source(19, 32) + SourceIndex(0) +9 >Emitted(3, 34) Source(19, 34) + SourceIndex(0) +10>Emitted(3, 41) Source(19, 41) + SourceIndex(0) +11>Emitted(3, 43) Source(19, 43) + SourceIndex(0) +12>Emitted(3, 53) Source(19, 53) + SourceIndex(0) +13>Emitted(3, 55) Source(19, 55) + SourceIndex(0) +14>Emitted(3, 64) Source(19, 64) + SourceIndex(0) +15>Emitted(3, 66) Source(19, 66) + SourceIndex(0) +16>Emitted(3, 74) Source(19, 74) + SourceIndex(0) +17>Emitted(3, 76) Source(19, 76) + SourceIndex(0) +18>Emitted(3, 78) Source(19, 78) + SourceIndex(0) +19>Emitted(3, 79) Source(19, 79) + SourceIndex(0) +20>Emitted(3, 80) Source(19, 80) + SourceIndex(0) +--- +>>>function getRobots() { +1 > +2 >^^^^^^^^^^^^^^^^^^^-> +1 > + > + > +1 >Emitted(4, 1) Source(21, 1) + SourceIndex(0) +--- +>>> return robots; +1->^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^ +5 > ^ +1->function getRobots() { + > +2 > return +3 > +4 > robots +5 > ; +1->Emitted(5, 5) Source(22, 5) + SourceIndex(0) +2 >Emitted(5, 11) Source(22, 11) + SourceIndex(0) +3 >Emitted(5, 12) Source(22, 12) + SourceIndex(0) +4 >Emitted(5, 18) Source(22, 18) + SourceIndex(0) +5 >Emitted(5, 19) Source(22, 19) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(6, 1) Source(23, 1) + SourceIndex(0) +2 >Emitted(6, 2) Source(23, 2) + SourceIndex(0) +--- +>>>function getMultiRobots() { +1-> +2 >^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > + > +1->Emitted(7, 1) Source(25, 1) + SourceIndex(0) +--- +>>> return multiRobots; +1->^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^ +5 > ^ +1->function getMultiRobots() { + > +2 > return +3 > +4 > multiRobots +5 > ; +1->Emitted(8, 5) Source(26, 5) + SourceIndex(0) +2 >Emitted(8, 11) Source(26, 11) + SourceIndex(0) +3 >Emitted(8, 12) Source(26, 12) + SourceIndex(0) +4 >Emitted(8, 23) Source(26, 23) + SourceIndex(0) +5 >Emitted(8, 24) Source(26, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(9, 1) Source(27, 1) + SourceIndex(0) +2 >Emitted(9, 2) Source(27, 2) + SourceIndex(0) +--- +>>>for (var _i = 0, robots_1 = robots; _i < robots_1.length; _i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^^^^^^ +10> ^^ +11> ^^^^ +12> ^ +1-> + > + > +2 >for +3 > +4 > (let {name: nameA } of +5 > robots +6 > +7 > robots +8 > +9 > robots +10> +11> robots +12> ) +1->Emitted(10, 1) Source(29, 1) + SourceIndex(0) +2 >Emitted(10, 4) Source(29, 4) + SourceIndex(0) +3 >Emitted(10, 5) Source(29, 5) + SourceIndex(0) +4 >Emitted(10, 6) Source(29, 28) + SourceIndex(0) +5 >Emitted(10, 16) Source(29, 34) + SourceIndex(0) +6 >Emitted(10, 18) Source(29, 28) + SourceIndex(0) +7 >Emitted(10, 35) Source(29, 34) + SourceIndex(0) +8 >Emitted(10, 37) Source(29, 28) + SourceIndex(0) +9 >Emitted(10, 57) Source(29, 34) + SourceIndex(0) +10>Emitted(10, 59) Source(29, 28) + SourceIndex(0) +11>Emitted(10, 63) Source(29, 34) + SourceIndex(0) +12>Emitted(10, 64) Source(29, 35) + SourceIndex(0) +--- +>>> var nameA = robots_1[_i].name; +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 > name: nameA +1 >Emitted(11, 5) Source(29, 11) + SourceIndex(0) +2 >Emitted(11, 34) Source(29, 22) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > } of robots) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(12, 5) Source(30, 5) + SourceIndex(0) +2 >Emitted(12, 12) Source(30, 12) + SourceIndex(0) +3 >Emitted(12, 13) Source(30, 13) + SourceIndex(0) +4 >Emitted(12, 16) Source(30, 16) + SourceIndex(0) +5 >Emitted(12, 17) Source(30, 17) + SourceIndex(0) +6 >Emitted(12, 22) Source(30, 22) + SourceIndex(0) +7 >Emitted(12, 23) Source(30, 23) + SourceIndex(0) +8 >Emitted(12, 24) Source(30, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(13, 2) Source(31, 2) + SourceIndex(0) +--- +>>>for (var _a = 0, _b = getRobots(); _a < _b.length; _a++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^ +8 > ^^^^^^^^^ +9 > ^^ +10> ^^ +11> ^^^^^^^^^^^^^^ +12> ^^ +13> ^^^^ +14> ^ +1-> + > +2 >for +3 > +4 > (let {name: nameA } of +5 > getRobots() +6 > +7 > +8 > getRobots +9 > () +10> +11> getRobots() +12> +13> getRobots() +14> ) +1->Emitted(14, 1) Source(32, 1) + SourceIndex(0) +2 >Emitted(14, 4) Source(32, 4) + SourceIndex(0) +3 >Emitted(14, 5) Source(32, 5) + SourceIndex(0) +4 >Emitted(14, 6) Source(32, 28) + SourceIndex(0) +5 >Emitted(14, 16) Source(32, 39) + SourceIndex(0) +6 >Emitted(14, 18) Source(32, 28) + SourceIndex(0) +7 >Emitted(14, 23) Source(32, 28) + SourceIndex(0) +8 >Emitted(14, 32) Source(32, 37) + SourceIndex(0) +9 >Emitted(14, 34) Source(32, 39) + SourceIndex(0) +10>Emitted(14, 36) Source(32, 28) + SourceIndex(0) +11>Emitted(14, 50) Source(32, 39) + SourceIndex(0) +12>Emitted(14, 52) Source(32, 28) + SourceIndex(0) +13>Emitted(14, 56) Source(32, 39) + SourceIndex(0) +14>Emitted(14, 57) Source(32, 40) + SourceIndex(0) +--- +>>> var nameA = _b[_a].name; +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 > name: nameA +1 >Emitted(15, 5) Source(32, 11) + SourceIndex(0) +2 >Emitted(15, 28) Source(32, 22) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > } of getRobots()) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(16, 5) Source(33, 5) + SourceIndex(0) +2 >Emitted(16, 12) Source(33, 12) + SourceIndex(0) +3 >Emitted(16, 13) Source(33, 13) + SourceIndex(0) +4 >Emitted(16, 16) Source(33, 16) + SourceIndex(0) +5 >Emitted(16, 17) Source(33, 17) + SourceIndex(0) +6 >Emitted(16, 22) Source(33, 22) + SourceIndex(0) +7 >Emitted(16, 23) Source(33, 23) + SourceIndex(0) +8 >Emitted(16, 24) Source(33, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(17, 2) Source(34, 2) + SourceIndex(0) +--- +>>>for (var _c = 0, _d = [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]; _c < _d.length; _c++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^ +8 > ^^ +9 > ^^^^ +10> ^^ +11> ^^^^^^^ +12> ^^ +13> ^^^^^ +14> ^^ +15> ^^^^^^^^ +16> ^^ +17> ^^ +18> ^^ +19> ^^^^ +20> ^^ +21> ^^^^^^^^^ +22> ^^ +23> ^^^^^ +24> ^^ +25> ^^^^^^^^^^ +26> ^^ +27> ^ +28> ^^ +29> ^^^^^^^^^^^^^^ +30> ^^ +31> ^^^^ +32> ^ +1-> + > +2 >for +3 > +4 > (let {name: nameA } of +5 > [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }] +6 > +7 > [ +8 > { +9 > name +10> : +11> "mower" +12> , +13> skill +14> : +15> "mowing" +16> } +17> , +18> { +19> name +20> : +21> "trimmer" +22> , +23> skill +24> : +25> "trimming" +26> } +27> ] +28> +29> [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }] +30> +31> [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }] +32> ) +1->Emitted(18, 1) Source(35, 1) + SourceIndex(0) +2 >Emitted(18, 4) Source(35, 4) + SourceIndex(0) +3 >Emitted(18, 5) Source(35, 5) + SourceIndex(0) +4 >Emitted(18, 6) Source(35, 28) + SourceIndex(0) +5 >Emitted(18, 16) Source(35, 104) + SourceIndex(0) +6 >Emitted(18, 18) Source(35, 28) + SourceIndex(0) +7 >Emitted(18, 24) Source(35, 29) + SourceIndex(0) +8 >Emitted(18, 26) Source(35, 31) + SourceIndex(0) +9 >Emitted(18, 30) Source(35, 35) + SourceIndex(0) +10>Emitted(18, 32) Source(35, 37) + SourceIndex(0) +11>Emitted(18, 39) Source(35, 44) + SourceIndex(0) +12>Emitted(18, 41) Source(35, 46) + SourceIndex(0) +13>Emitted(18, 46) Source(35, 51) + SourceIndex(0) +14>Emitted(18, 48) Source(35, 53) + SourceIndex(0) +15>Emitted(18, 56) Source(35, 61) + SourceIndex(0) +16>Emitted(18, 58) Source(35, 63) + SourceIndex(0) +17>Emitted(18, 60) Source(35, 65) + SourceIndex(0) +18>Emitted(18, 62) Source(35, 67) + SourceIndex(0) +19>Emitted(18, 66) Source(35, 71) + SourceIndex(0) +20>Emitted(18, 68) Source(35, 73) + SourceIndex(0) +21>Emitted(18, 77) Source(35, 82) + SourceIndex(0) +22>Emitted(18, 79) Source(35, 84) + SourceIndex(0) +23>Emitted(18, 84) Source(35, 89) + SourceIndex(0) +24>Emitted(18, 86) Source(35, 91) + SourceIndex(0) +25>Emitted(18, 96) Source(35, 101) + SourceIndex(0) +26>Emitted(18, 98) Source(35, 103) + SourceIndex(0) +27>Emitted(18, 99) Source(35, 104) + SourceIndex(0) +28>Emitted(18, 101) Source(35, 28) + SourceIndex(0) +29>Emitted(18, 115) Source(35, 104) + SourceIndex(0) +30>Emitted(18, 117) Source(35, 28) + SourceIndex(0) +31>Emitted(18, 121) Source(35, 104) + SourceIndex(0) +32>Emitted(18, 122) Source(35, 105) + SourceIndex(0) +--- +>>> var nameA = _d[_c].name; +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 > name: nameA +1 >Emitted(19, 5) Source(35, 11) + SourceIndex(0) +2 >Emitted(19, 28) Source(35, 22) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(20, 5) Source(36, 5) + SourceIndex(0) +2 >Emitted(20, 12) Source(36, 12) + SourceIndex(0) +3 >Emitted(20, 13) Source(36, 13) + SourceIndex(0) +4 >Emitted(20, 16) Source(36, 16) + SourceIndex(0) +5 >Emitted(20, 17) Source(36, 17) + SourceIndex(0) +6 >Emitted(20, 22) Source(36, 22) + SourceIndex(0) +7 >Emitted(20, 23) Source(36, 23) + SourceIndex(0) +8 >Emitted(20, 24) Source(36, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(21, 2) Source(37, 2) + SourceIndex(0) +--- +>>>for (var _e = 0, multiRobots_1 = multiRobots; _e < multiRobots_1.length; _e++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^^^^^^^^^^^ +10> ^^ +11> ^^^^ +12> ^ +13> ^^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > (let { skills: { primary: primaryA, secondary: secondaryA } } of +5 > multiRobots +6 > +7 > multiRobots +8 > +9 > multiRobots +10> +11> multiRobots +12> ) +1->Emitted(22, 1) Source(38, 1) + SourceIndex(0) +2 >Emitted(22, 4) Source(38, 4) + SourceIndex(0) +3 >Emitted(22, 5) Source(38, 5) + SourceIndex(0) +4 >Emitted(22, 6) Source(38, 70) + SourceIndex(0) +5 >Emitted(22, 16) Source(38, 81) + SourceIndex(0) +6 >Emitted(22, 18) Source(38, 70) + SourceIndex(0) +7 >Emitted(22, 45) Source(38, 81) + SourceIndex(0) +8 >Emitted(22, 47) Source(38, 70) + SourceIndex(0) +9 >Emitted(22, 72) Source(38, 81) + SourceIndex(0) +10>Emitted(22, 74) Source(38, 70) + SourceIndex(0) +11>Emitted(22, 78) Source(38, 81) + SourceIndex(0) +12>Emitted(22, 79) Source(38, 82) + SourceIndex(0) +--- +>>> var _f = multiRobots_1[_e].skills, primaryA = _f.primary, secondaryA = _f.secondary; +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > skills: { primary: primaryA, secondary: secondaryA } +3 > +4 > primary: primaryA +5 > , +6 > secondary: secondaryA +1->Emitted(23, 5) Source(38, 12) + SourceIndex(0) +2 >Emitted(23, 38) Source(38, 64) + SourceIndex(0) +3 >Emitted(23, 40) Source(38, 22) + SourceIndex(0) +4 >Emitted(23, 61) Source(38, 39) + SourceIndex(0) +5 >Emitted(23, 63) Source(38, 41) + SourceIndex(0) +6 >Emitted(23, 88) Source(38, 62) + SourceIndex(0) +--- +>>> console.log(primaryA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1 > } } of multiRobots) { + > +2 > console +3 > . +4 > log +5 > ( +6 > primaryA +7 > ) +8 > ; +1 >Emitted(24, 5) Source(39, 5) + SourceIndex(0) +2 >Emitted(24, 12) Source(39, 12) + SourceIndex(0) +3 >Emitted(24, 13) Source(39, 13) + SourceIndex(0) +4 >Emitted(24, 16) Source(39, 16) + SourceIndex(0) +5 >Emitted(24, 17) Source(39, 17) + SourceIndex(0) +6 >Emitted(24, 25) Source(39, 25) + SourceIndex(0) +7 >Emitted(24, 26) Source(39, 26) + SourceIndex(0) +8 >Emitted(24, 27) Source(39, 27) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(25, 2) Source(40, 2) + SourceIndex(0) +--- +>>>for (var _g = 0, _h = getMultiRobots(); _g < _h.length; _g++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^ +8 > ^^^^^^^^^^^^^^ +9 > ^^ +10> ^^ +11> ^^^^^^^^^^^^^^ +12> ^^ +13> ^^^^ +14> ^ +15> ^^^^^^^^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > (let { skills: { primary: primaryA, secondary: secondaryA } } of +5 > getMultiRobots() +6 > +7 > +8 > getMultiRobots +9 > () +10> +11> getMultiRobots() +12> +13> getMultiRobots() +14> ) +1->Emitted(26, 1) Source(41, 1) + SourceIndex(0) +2 >Emitted(26, 4) Source(41, 4) + SourceIndex(0) +3 >Emitted(26, 5) Source(41, 5) + SourceIndex(0) +4 >Emitted(26, 6) Source(41, 70) + SourceIndex(0) +5 >Emitted(26, 16) Source(41, 86) + SourceIndex(0) +6 >Emitted(26, 18) Source(41, 70) + SourceIndex(0) +7 >Emitted(26, 23) Source(41, 70) + SourceIndex(0) +8 >Emitted(26, 37) Source(41, 84) + SourceIndex(0) +9 >Emitted(26, 39) Source(41, 86) + SourceIndex(0) +10>Emitted(26, 41) Source(41, 70) + SourceIndex(0) +11>Emitted(26, 55) Source(41, 86) + SourceIndex(0) +12>Emitted(26, 57) Source(41, 70) + SourceIndex(0) +13>Emitted(26, 61) Source(41, 86) + SourceIndex(0) +14>Emitted(26, 62) Source(41, 87) + SourceIndex(0) +--- +>>> var _j = _h[_g].skills, primaryA = _j.primary, secondaryA = _j.secondary; +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > skills: { primary: primaryA, secondary: secondaryA } +3 > +4 > primary: primaryA +5 > , +6 > secondary: secondaryA +1->Emitted(27, 5) Source(41, 12) + SourceIndex(0) +2 >Emitted(27, 27) Source(41, 64) + SourceIndex(0) +3 >Emitted(27, 29) Source(41, 22) + SourceIndex(0) +4 >Emitted(27, 50) Source(41, 39) + SourceIndex(0) +5 >Emitted(27, 52) Source(41, 41) + SourceIndex(0) +6 >Emitted(27, 77) Source(41, 62) + SourceIndex(0) +--- +>>> console.log(primaryA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1 > } } of getMultiRobots()) { + > +2 > console +3 > . +4 > log +5 > ( +6 > primaryA +7 > ) +8 > ; +1 >Emitted(28, 5) Source(42, 5) + SourceIndex(0) +2 >Emitted(28, 12) Source(42, 12) + SourceIndex(0) +3 >Emitted(28, 13) Source(42, 13) + SourceIndex(0) +4 >Emitted(28, 16) Source(42, 16) + SourceIndex(0) +5 >Emitted(28, 17) Source(42, 17) + SourceIndex(0) +6 >Emitted(28, 25) Source(42, 25) + SourceIndex(0) +7 >Emitted(28, 26) Source(42, 26) + SourceIndex(0) +8 >Emitted(28, 27) Source(42, 27) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(29, 2) Source(43, 2) + SourceIndex(0) +--- +>>>for (var _k = 0, _l = [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^ +8 > ^^ +9 > ^^^^ +10> ^^ +11> ^^^^^^^ +12> ^^ +13> ^^^^^^ +14> ^^ +15> ^^ +16> ^^^^^^^ +17> ^^ +18> ^^^^^^^^ +19> ^^ +20> ^^^^^^^^^ +21> ^^ +22> ^^^^^^ +23> ^^ +24> ^^ +25> ^^^^^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > (let { skills: { primary: primaryA, secondary: secondaryA } } of +5 > [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] +6 > +7 > [ +8 > { +9 > name +10> : +11> "mower" +12> , +13> skills +14> : +15> { +16> primary +17> : +18> "mowing" +19> , +20> secondary +21> : +22> "none" +23> } +24> } +1->Emitted(30, 1) Source(44, 1) + SourceIndex(0) +2 >Emitted(30, 4) Source(44, 4) + SourceIndex(0) +3 >Emitted(30, 5) Source(44, 5) + SourceIndex(0) +4 >Emitted(30, 6) Source(44, 70) + SourceIndex(0) +5 >Emitted(30, 16) Source(45, 79) + SourceIndex(0) +6 >Emitted(30, 18) Source(44, 70) + SourceIndex(0) +7 >Emitted(30, 24) Source(44, 71) + SourceIndex(0) +8 >Emitted(30, 26) Source(44, 73) + SourceIndex(0) +9 >Emitted(30, 30) Source(44, 77) + SourceIndex(0) +10>Emitted(30, 32) Source(44, 79) + SourceIndex(0) +11>Emitted(30, 39) Source(44, 86) + SourceIndex(0) +12>Emitted(30, 41) Source(44, 88) + SourceIndex(0) +13>Emitted(30, 47) Source(44, 94) + SourceIndex(0) +14>Emitted(30, 49) Source(44, 96) + SourceIndex(0) +15>Emitted(30, 51) Source(44, 98) + SourceIndex(0) +16>Emitted(30, 58) Source(44, 105) + SourceIndex(0) +17>Emitted(30, 60) Source(44, 107) + SourceIndex(0) +18>Emitted(30, 68) Source(44, 115) + SourceIndex(0) +19>Emitted(30, 70) Source(44, 117) + SourceIndex(0) +20>Emitted(30, 79) Source(44, 126) + SourceIndex(0) +21>Emitted(30, 81) Source(44, 128) + SourceIndex(0) +22>Emitted(30, 87) Source(44, 134) + SourceIndex(0) +23>Emitted(30, 89) Source(44, 136) + SourceIndex(0) +24>Emitted(30, 91) Source(44, 138) + SourceIndex(0) +--- +>>> { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]; _k < _l.length; _k++) { +1->^^^^ +2 > ^^ +3 > ^^^^ +4 > ^^ +5 > ^^^^^^^^^ +6 > ^^ +7 > ^^^^^^ +8 > ^^ +9 > ^^ +10> ^^^^^^^ +11> ^^ +12> ^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^ +15> ^^ +16> ^^^^^^^^ +17> ^^ +18> ^^ +19> ^ +20> ^^ +21> ^^^^^^^^^^^^^^ +22> ^^ +23> ^^^^ +24> ^ +1->, + > +2 > { +3 > name +4 > : +5 > "trimmer" +6 > , +7 > skills +8 > : +9 > { +10> primary +11> : +12> "trimming" +13> , +14> secondary +15> : +16> "edging" +17> } +18> } +19> ] +20> +21> [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] +22> +23> [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] +24> ) +1->Emitted(31, 5) Source(45, 5) + SourceIndex(0) +2 >Emitted(31, 7) Source(45, 7) + SourceIndex(0) +3 >Emitted(31, 11) Source(45, 11) + SourceIndex(0) +4 >Emitted(31, 13) Source(45, 13) + SourceIndex(0) +5 >Emitted(31, 22) Source(45, 22) + SourceIndex(0) +6 >Emitted(31, 24) Source(45, 24) + SourceIndex(0) +7 >Emitted(31, 30) Source(45, 30) + SourceIndex(0) +8 >Emitted(31, 32) Source(45, 32) + SourceIndex(0) +9 >Emitted(31, 34) Source(45, 34) + SourceIndex(0) +10>Emitted(31, 41) Source(45, 41) + SourceIndex(0) +11>Emitted(31, 43) Source(45, 43) + SourceIndex(0) +12>Emitted(31, 53) Source(45, 53) + SourceIndex(0) +13>Emitted(31, 55) Source(45, 55) + SourceIndex(0) +14>Emitted(31, 64) Source(45, 64) + SourceIndex(0) +15>Emitted(31, 66) Source(45, 66) + SourceIndex(0) +16>Emitted(31, 74) Source(45, 74) + SourceIndex(0) +17>Emitted(31, 76) Source(45, 76) + SourceIndex(0) +18>Emitted(31, 78) Source(45, 78) + SourceIndex(0) +19>Emitted(31, 79) Source(45, 79) + SourceIndex(0) +20>Emitted(31, 81) Source(44, 70) + SourceIndex(0) +21>Emitted(31, 95) Source(45, 79) + SourceIndex(0) +22>Emitted(31, 97) Source(44, 70) + SourceIndex(0) +23>Emitted(31, 101) Source(45, 79) + SourceIndex(0) +24>Emitted(31, 102) Source(45, 80) + SourceIndex(0) +--- +>>> var _m = _l[_k].skills, primaryA = _m.primary, secondaryA = _m.secondary; +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 > skills: { primary: primaryA, secondary: secondaryA } +3 > +4 > primary: primaryA +5 > , +6 > secondary: secondaryA +1 >Emitted(32, 5) Source(44, 12) + SourceIndex(0) +2 >Emitted(32, 27) Source(44, 64) + SourceIndex(0) +3 >Emitted(32, 29) Source(44, 22) + SourceIndex(0) +4 >Emitted(32, 50) Source(44, 39) + SourceIndex(0) +5 >Emitted(32, 52) Source(44, 41) + SourceIndex(0) +6 >Emitted(32, 77) Source(44, 62) + SourceIndex(0) +--- +>>> console.log(primaryA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1 > } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { + > +2 > console +3 > . +4 > log +5 > ( +6 > primaryA +7 > ) +8 > ; +1 >Emitted(33, 5) Source(46, 5) + SourceIndex(0) +2 >Emitted(33, 12) Source(46, 12) + SourceIndex(0) +3 >Emitted(33, 13) Source(46, 13) + SourceIndex(0) +4 >Emitted(33, 16) Source(46, 16) + SourceIndex(0) +5 >Emitted(33, 17) Source(46, 17) + SourceIndex(0) +6 >Emitted(33, 25) Source(46, 25) + SourceIndex(0) +7 >Emitted(33, 26) Source(46, 26) + SourceIndex(0) +8 >Emitted(33, 27) Source(46, 27) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(34, 2) Source(47, 2) + SourceIndex(0) +--- +>>>for (var _o = 0, robots_2 = robots; _o < robots_2.length; _o++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^^^^^^ +10> ^^ +11> ^^^^ +12> ^ +1-> + > + > +2 >for +3 > +4 > (let {name: nameA, skill: skillA } of +5 > robots +6 > +7 > robots +8 > +9 > robots +10> +11> robots +12> ) +1->Emitted(35, 1) Source(49, 1) + SourceIndex(0) +2 >Emitted(35, 4) Source(49, 4) + SourceIndex(0) +3 >Emitted(35, 5) Source(49, 5) + SourceIndex(0) +4 >Emitted(35, 6) Source(49, 43) + SourceIndex(0) +5 >Emitted(35, 16) Source(49, 49) + SourceIndex(0) +6 >Emitted(35, 18) Source(49, 43) + SourceIndex(0) +7 >Emitted(35, 35) Source(49, 49) + SourceIndex(0) +8 >Emitted(35, 37) Source(49, 43) + SourceIndex(0) +9 >Emitted(35, 57) Source(49, 49) + SourceIndex(0) +10>Emitted(35, 59) Source(49, 43) + SourceIndex(0) +11>Emitted(35, 63) Source(49, 49) + SourceIndex(0) +12>Emitted(35, 64) Source(49, 50) + SourceIndex(0) +--- +>>> var _p = robots_2[_o], nameA = _p.name, skillA = _p.skill; +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^ +1 > +2 > let {name: nameA, skill: skillA } +3 > +4 > name: nameA +5 > , +6 > skill: skillA +1 >Emitted(36, 5) Source(49, 6) + SourceIndex(0) +2 >Emitted(36, 26) Source(49, 39) + SourceIndex(0) +3 >Emitted(36, 28) Source(49, 11) + SourceIndex(0) +4 >Emitted(36, 43) Source(49, 22) + SourceIndex(0) +5 >Emitted(36, 45) Source(49, 24) + SourceIndex(0) +6 >Emitted(36, 62) Source(49, 37) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > } of robots) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(37, 5) Source(50, 5) + SourceIndex(0) +2 >Emitted(37, 12) Source(50, 12) + SourceIndex(0) +3 >Emitted(37, 13) Source(50, 13) + SourceIndex(0) +4 >Emitted(37, 16) Source(50, 16) + SourceIndex(0) +5 >Emitted(37, 17) Source(50, 17) + SourceIndex(0) +6 >Emitted(37, 22) Source(50, 22) + SourceIndex(0) +7 >Emitted(37, 23) Source(50, 23) + SourceIndex(0) +8 >Emitted(37, 24) Source(50, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(38, 2) Source(51, 2) + SourceIndex(0) +--- +>>>for (var _q = 0, _r = getRobots(); _q < _r.length; _q++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^ +8 > ^^^^^^^^^ +9 > ^^ +10> ^^ +11> ^^^^^^^^^^^^^^ +12> ^^ +13> ^^^^ +14> ^ +15> ^-> +1-> + > +2 >for +3 > +4 > (let {name: nameA, skill: skillA } of +5 > getRobots() +6 > +7 > +8 > getRobots +9 > () +10> +11> getRobots() +12> +13> getRobots() +14> ) +1->Emitted(39, 1) Source(52, 1) + SourceIndex(0) +2 >Emitted(39, 4) Source(52, 4) + SourceIndex(0) +3 >Emitted(39, 5) Source(52, 5) + SourceIndex(0) +4 >Emitted(39, 6) Source(52, 43) + SourceIndex(0) +5 >Emitted(39, 16) Source(52, 54) + SourceIndex(0) +6 >Emitted(39, 18) Source(52, 43) + SourceIndex(0) +7 >Emitted(39, 23) Source(52, 43) + SourceIndex(0) +8 >Emitted(39, 32) Source(52, 52) + SourceIndex(0) +9 >Emitted(39, 34) Source(52, 54) + SourceIndex(0) +10>Emitted(39, 36) Source(52, 43) + SourceIndex(0) +11>Emitted(39, 50) Source(52, 54) + SourceIndex(0) +12>Emitted(39, 52) Source(52, 43) + SourceIndex(0) +13>Emitted(39, 56) Source(52, 54) + SourceIndex(0) +14>Emitted(39, 57) Source(52, 55) + SourceIndex(0) +--- +>>> var _s = _r[_q], nameA = _s.name, skillA = _s.skill; +1->^^^^ +2 > ^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^ +1-> +2 > let {name: nameA, skill: skillA } +3 > +4 > name: nameA +5 > , +6 > skill: skillA +1->Emitted(40, 5) Source(52, 6) + SourceIndex(0) +2 >Emitted(40, 20) Source(52, 39) + SourceIndex(0) +3 >Emitted(40, 22) Source(52, 11) + SourceIndex(0) +4 >Emitted(40, 37) Source(52, 22) + SourceIndex(0) +5 >Emitted(40, 39) Source(52, 24) + SourceIndex(0) +6 >Emitted(40, 56) Source(52, 37) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > } of getRobots()) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(41, 5) Source(53, 5) + SourceIndex(0) +2 >Emitted(41, 12) Source(53, 12) + SourceIndex(0) +3 >Emitted(41, 13) Source(53, 13) + SourceIndex(0) +4 >Emitted(41, 16) Source(53, 16) + SourceIndex(0) +5 >Emitted(41, 17) Source(53, 17) + SourceIndex(0) +6 >Emitted(41, 22) Source(53, 22) + SourceIndex(0) +7 >Emitted(41, 23) Source(53, 23) + SourceIndex(0) +8 >Emitted(41, 24) Source(53, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(42, 2) Source(54, 2) + SourceIndex(0) +--- +>>>for (var _t = 0, _u = [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]; _t < _u.length; _t++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^ +8 > ^^ +9 > ^^^^ +10> ^^ +11> ^^^^^^^ +12> ^^ +13> ^^^^^ +14> ^^ +15> ^^^^^^^^ +16> ^^ +17> ^^ +18> ^^ +19> ^^^^ +20> ^^ +21> ^^^^^^^^^ +22> ^^ +23> ^^^^^ +24> ^^ +25> ^^^^^^^^^^ +26> ^^ +27> ^ +28> ^^ +29> ^^^^^^^^^^^^^^ +30> ^^ +31> ^^^^ +32> ^ +1-> + > +2 >for +3 > +4 > (let {name: nameA, skill: skillA } of +5 > [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }] +6 > +7 > [ +8 > { +9 > name +10> : +11> "mower" +12> , +13> skill +14> : +15> "mowing" +16> } +17> , +18> { +19> name +20> : +21> "trimmer" +22> , +23> skill +24> : +25> "trimming" +26> } +27> ] +28> +29> [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }] +30> +31> [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }] +32> ) +1->Emitted(43, 1) Source(55, 1) + SourceIndex(0) +2 >Emitted(43, 4) Source(55, 4) + SourceIndex(0) +3 >Emitted(43, 5) Source(55, 5) + SourceIndex(0) +4 >Emitted(43, 6) Source(55, 43) + SourceIndex(0) +5 >Emitted(43, 16) Source(55, 119) + SourceIndex(0) +6 >Emitted(43, 18) Source(55, 43) + SourceIndex(0) +7 >Emitted(43, 24) Source(55, 44) + SourceIndex(0) +8 >Emitted(43, 26) Source(55, 46) + SourceIndex(0) +9 >Emitted(43, 30) Source(55, 50) + SourceIndex(0) +10>Emitted(43, 32) Source(55, 52) + SourceIndex(0) +11>Emitted(43, 39) Source(55, 59) + SourceIndex(0) +12>Emitted(43, 41) Source(55, 61) + SourceIndex(0) +13>Emitted(43, 46) Source(55, 66) + SourceIndex(0) +14>Emitted(43, 48) Source(55, 68) + SourceIndex(0) +15>Emitted(43, 56) Source(55, 76) + SourceIndex(0) +16>Emitted(43, 58) Source(55, 78) + SourceIndex(0) +17>Emitted(43, 60) Source(55, 80) + SourceIndex(0) +18>Emitted(43, 62) Source(55, 82) + SourceIndex(0) +19>Emitted(43, 66) Source(55, 86) + SourceIndex(0) +20>Emitted(43, 68) Source(55, 88) + SourceIndex(0) +21>Emitted(43, 77) Source(55, 97) + SourceIndex(0) +22>Emitted(43, 79) Source(55, 99) + SourceIndex(0) +23>Emitted(43, 84) Source(55, 104) + SourceIndex(0) +24>Emitted(43, 86) Source(55, 106) + SourceIndex(0) +25>Emitted(43, 96) Source(55, 116) + SourceIndex(0) +26>Emitted(43, 98) Source(55, 118) + SourceIndex(0) +27>Emitted(43, 99) Source(55, 119) + SourceIndex(0) +28>Emitted(43, 101) Source(55, 43) + SourceIndex(0) +29>Emitted(43, 115) Source(55, 119) + SourceIndex(0) +30>Emitted(43, 117) Source(55, 43) + SourceIndex(0) +31>Emitted(43, 121) Source(55, 119) + SourceIndex(0) +32>Emitted(43, 122) Source(55, 120) + SourceIndex(0) +--- +>>> var _v = _u[_t], nameA = _v.name, skillA = _v.skill; +1 >^^^^ +2 > ^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^ +1 > +2 > let {name: nameA, skill: skillA } +3 > +4 > name: nameA +5 > , +6 > skill: skillA +1 >Emitted(44, 5) Source(55, 6) + SourceIndex(0) +2 >Emitted(44, 20) Source(55, 39) + SourceIndex(0) +3 >Emitted(44, 22) Source(55, 11) + SourceIndex(0) +4 >Emitted(44, 37) Source(55, 22) + SourceIndex(0) +5 >Emitted(44, 39) Source(55, 24) + SourceIndex(0) +6 >Emitted(44, 56) Source(55, 37) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(45, 5) Source(56, 5) + SourceIndex(0) +2 >Emitted(45, 12) Source(56, 12) + SourceIndex(0) +3 >Emitted(45, 13) Source(56, 13) + SourceIndex(0) +4 >Emitted(45, 16) Source(56, 16) + SourceIndex(0) +5 >Emitted(45, 17) Source(56, 17) + SourceIndex(0) +6 >Emitted(45, 22) Source(56, 22) + SourceIndex(0) +7 >Emitted(45, 23) Source(56, 23) + SourceIndex(0) +8 >Emitted(45, 24) Source(56, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(46, 2) Source(57, 2) + SourceIndex(0) +--- +>>>for (var _w = 0, multiRobots_2 = multiRobots; _w < multiRobots_2.length; _w++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^^^^^^^^^^^ +10> ^^ +11> ^^^^ +12> ^ +13> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of +5 > multiRobots +6 > +7 > multiRobots +8 > +9 > multiRobots +10> +11> multiRobots +12> ) +1->Emitted(47, 1) Source(58, 1) + SourceIndex(0) +2 >Emitted(47, 4) Source(58, 4) + SourceIndex(0) +3 >Emitted(47, 5) Source(58, 5) + SourceIndex(0) +4 >Emitted(47, 6) Source(58, 82) + SourceIndex(0) +5 >Emitted(47, 16) Source(58, 93) + SourceIndex(0) +6 >Emitted(47, 18) Source(58, 82) + SourceIndex(0) +7 >Emitted(47, 45) Source(58, 93) + SourceIndex(0) +8 >Emitted(47, 47) Source(58, 82) + SourceIndex(0) +9 >Emitted(47, 72) Source(58, 93) + SourceIndex(0) +10>Emitted(47, 74) Source(58, 82) + SourceIndex(0) +11>Emitted(47, 78) Source(58, 93) + SourceIndex(0) +12>Emitted(47, 79) Source(58, 94) + SourceIndex(0) +--- +>>> var _x = multiRobots_2[_w], nameA = _x.name, _y = _x.skills, primaryA = _y.primary, secondaryA = _y.secondary; +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } +3 > +4 > name: nameA +5 > , +6 > skills: { primary: primaryA, secondary: secondaryA } +7 > +8 > primary: primaryA +9 > , +10> secondary: secondaryA +1->Emitted(48, 5) Source(58, 6) + SourceIndex(0) +2 >Emitted(48, 31) Source(58, 78) + SourceIndex(0) +3 >Emitted(48, 33) Source(58, 11) + SourceIndex(0) +4 >Emitted(48, 48) Source(58, 22) + SourceIndex(0) +5 >Emitted(48, 50) Source(58, 24) + SourceIndex(0) +6 >Emitted(48, 64) Source(58, 76) + SourceIndex(0) +7 >Emitted(48, 66) Source(58, 34) + SourceIndex(0) +8 >Emitted(48, 87) Source(58, 51) + SourceIndex(0) +9 >Emitted(48, 89) Source(58, 53) + SourceIndex(0) +10>Emitted(48, 114) Source(58, 74) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > } } of multiRobots) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(49, 5) Source(59, 5) + SourceIndex(0) +2 >Emitted(49, 12) Source(59, 12) + SourceIndex(0) +3 >Emitted(49, 13) Source(59, 13) + SourceIndex(0) +4 >Emitted(49, 16) Source(59, 16) + SourceIndex(0) +5 >Emitted(49, 17) Source(59, 17) + SourceIndex(0) +6 >Emitted(49, 22) Source(59, 22) + SourceIndex(0) +7 >Emitted(49, 23) Source(59, 23) + SourceIndex(0) +8 >Emitted(49, 24) Source(59, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(50, 2) Source(60, 2) + SourceIndex(0) +--- +>>>for (var _z = 0, _0 = getMultiRobots(); _z < _0.length; _z++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^ +8 > ^^^^^^^^^^^^^^ +9 > ^^ +10> ^^ +11> ^^^^^^^^^^^^^^ +12> ^^ +13> ^^^^ +14> ^ +15> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of +5 > getMultiRobots() +6 > +7 > +8 > getMultiRobots +9 > () +10> +11> getMultiRobots() +12> +13> getMultiRobots() +14> ) +1->Emitted(51, 1) Source(61, 1) + SourceIndex(0) +2 >Emitted(51, 4) Source(61, 4) + SourceIndex(0) +3 >Emitted(51, 5) Source(61, 5) + SourceIndex(0) +4 >Emitted(51, 6) Source(61, 82) + SourceIndex(0) +5 >Emitted(51, 16) Source(61, 98) + SourceIndex(0) +6 >Emitted(51, 18) Source(61, 82) + SourceIndex(0) +7 >Emitted(51, 23) Source(61, 82) + SourceIndex(0) +8 >Emitted(51, 37) Source(61, 96) + SourceIndex(0) +9 >Emitted(51, 39) Source(61, 98) + SourceIndex(0) +10>Emitted(51, 41) Source(61, 82) + SourceIndex(0) +11>Emitted(51, 55) Source(61, 98) + SourceIndex(0) +12>Emitted(51, 57) Source(61, 82) + SourceIndex(0) +13>Emitted(51, 61) Source(61, 98) + SourceIndex(0) +14>Emitted(51, 62) Source(61, 99) + SourceIndex(0) +--- +>>> var _1 = _0[_z], nameA = _1.name, _2 = _1.skills, primaryA = _2.primary, secondaryA = _2.secondary; +1->^^^^ +2 > ^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } +3 > +4 > name: nameA +5 > , +6 > skills: { primary: primaryA, secondary: secondaryA } +7 > +8 > primary: primaryA +9 > , +10> secondary: secondaryA +1->Emitted(52, 5) Source(61, 6) + SourceIndex(0) +2 >Emitted(52, 20) Source(61, 78) + SourceIndex(0) +3 >Emitted(52, 22) Source(61, 11) + SourceIndex(0) +4 >Emitted(52, 37) Source(61, 22) + SourceIndex(0) +5 >Emitted(52, 39) Source(61, 24) + SourceIndex(0) +6 >Emitted(52, 53) Source(61, 76) + SourceIndex(0) +7 >Emitted(52, 55) Source(61, 34) + SourceIndex(0) +8 >Emitted(52, 76) Source(61, 51) + SourceIndex(0) +9 >Emitted(52, 78) Source(61, 53) + SourceIndex(0) +10>Emitted(52, 103) Source(61, 74) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > } } of getMultiRobots()) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(53, 5) Source(62, 5) + SourceIndex(0) +2 >Emitted(53, 12) Source(62, 12) + SourceIndex(0) +3 >Emitted(53, 13) Source(62, 13) + SourceIndex(0) +4 >Emitted(53, 16) Source(62, 16) + SourceIndex(0) +5 >Emitted(53, 17) Source(62, 17) + SourceIndex(0) +6 >Emitted(53, 22) Source(62, 22) + SourceIndex(0) +7 >Emitted(53, 23) Source(62, 23) + SourceIndex(0) +8 >Emitted(53, 24) Source(62, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(54, 2) Source(63, 2) + SourceIndex(0) +--- +>>>for (var _3 = 0, _4 = [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^ +8 > ^^ +9 > ^^^^ +10> ^^ +11> ^^^^^^^ +12> ^^ +13> ^^^^^^ +14> ^^ +15> ^^ +16> ^^^^^^^ +17> ^^ +18> ^^^^^^^^ +19> ^^ +20> ^^^^^^^^^ +21> ^^ +22> ^^^^^^ +23> ^^ +24> ^^ +25> ^^^^^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of +5 > [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] +6 > +7 > [ +8 > { +9 > name +10> : +11> "mower" +12> , +13> skills +14> : +15> { +16> primary +17> : +18> "mowing" +19> , +20> secondary +21> : +22> "none" +23> } +24> } +1->Emitted(55, 1) Source(64, 1) + SourceIndex(0) +2 >Emitted(55, 4) Source(64, 4) + SourceIndex(0) +3 >Emitted(55, 5) Source(64, 5) + SourceIndex(0) +4 >Emitted(55, 6) Source(64, 82) + SourceIndex(0) +5 >Emitted(55, 16) Source(65, 79) + SourceIndex(0) +6 >Emitted(55, 18) Source(64, 82) + SourceIndex(0) +7 >Emitted(55, 24) Source(64, 83) + SourceIndex(0) +8 >Emitted(55, 26) Source(64, 85) + SourceIndex(0) +9 >Emitted(55, 30) Source(64, 89) + SourceIndex(0) +10>Emitted(55, 32) Source(64, 91) + SourceIndex(0) +11>Emitted(55, 39) Source(64, 98) + SourceIndex(0) +12>Emitted(55, 41) Source(64, 100) + SourceIndex(0) +13>Emitted(55, 47) Source(64, 106) + SourceIndex(0) +14>Emitted(55, 49) Source(64, 108) + SourceIndex(0) +15>Emitted(55, 51) Source(64, 110) + SourceIndex(0) +16>Emitted(55, 58) Source(64, 117) + SourceIndex(0) +17>Emitted(55, 60) Source(64, 119) + SourceIndex(0) +18>Emitted(55, 68) Source(64, 127) + SourceIndex(0) +19>Emitted(55, 70) Source(64, 129) + SourceIndex(0) +20>Emitted(55, 79) Source(64, 138) + SourceIndex(0) +21>Emitted(55, 81) Source(64, 140) + SourceIndex(0) +22>Emitted(55, 87) Source(64, 146) + SourceIndex(0) +23>Emitted(55, 89) Source(64, 148) + SourceIndex(0) +24>Emitted(55, 91) Source(64, 150) + SourceIndex(0) +--- +>>> { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]; _3 < _4.length; _3++) { +1->^^^^ +2 > ^^ +3 > ^^^^ +4 > ^^ +5 > ^^^^^^^^^ +6 > ^^ +7 > ^^^^^^ +8 > ^^ +9 > ^^ +10> ^^^^^^^ +11> ^^ +12> ^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^ +15> ^^ +16> ^^^^^^^^ +17> ^^ +18> ^^ +19> ^ +20> ^^ +21> ^^^^^^^^^^^^^^ +22> ^^ +23> ^^^^ +24> ^ +25> ^^^-> +1->, + > +2 > { +3 > name +4 > : +5 > "trimmer" +6 > , +7 > skills +8 > : +9 > { +10> primary +11> : +12> "trimming" +13> , +14> secondary +15> : +16> "edging" +17> } +18> } +19> ] +20> +21> [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] +22> +23> [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] +24> ) +1->Emitted(56, 5) Source(65, 5) + SourceIndex(0) +2 >Emitted(56, 7) Source(65, 7) + SourceIndex(0) +3 >Emitted(56, 11) Source(65, 11) + SourceIndex(0) +4 >Emitted(56, 13) Source(65, 13) + SourceIndex(0) +5 >Emitted(56, 22) Source(65, 22) + SourceIndex(0) +6 >Emitted(56, 24) Source(65, 24) + SourceIndex(0) +7 >Emitted(56, 30) Source(65, 30) + SourceIndex(0) +8 >Emitted(56, 32) Source(65, 32) + SourceIndex(0) +9 >Emitted(56, 34) Source(65, 34) + SourceIndex(0) +10>Emitted(56, 41) Source(65, 41) + SourceIndex(0) +11>Emitted(56, 43) Source(65, 43) + SourceIndex(0) +12>Emitted(56, 53) Source(65, 53) + SourceIndex(0) +13>Emitted(56, 55) Source(65, 55) + SourceIndex(0) +14>Emitted(56, 64) Source(65, 64) + SourceIndex(0) +15>Emitted(56, 66) Source(65, 66) + SourceIndex(0) +16>Emitted(56, 74) Source(65, 74) + SourceIndex(0) +17>Emitted(56, 76) Source(65, 76) + SourceIndex(0) +18>Emitted(56, 78) Source(65, 78) + SourceIndex(0) +19>Emitted(56, 79) Source(65, 79) + SourceIndex(0) +20>Emitted(56, 81) Source(64, 82) + SourceIndex(0) +21>Emitted(56, 95) Source(65, 79) + SourceIndex(0) +22>Emitted(56, 97) Source(64, 82) + SourceIndex(0) +23>Emitted(56, 101) Source(65, 79) + SourceIndex(0) +24>Emitted(56, 102) Source(65, 80) + SourceIndex(0) +--- +>>> var _5 = _4[_3], nameA = _5.name, _6 = _5.skills, primaryA = _6.primary, secondaryA = _6.secondary; +1->^^^^ +2 > ^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } +3 > +4 > name: nameA +5 > , +6 > skills: { primary: primaryA, secondary: secondaryA } +7 > +8 > primary: primaryA +9 > , +10> secondary: secondaryA +1->Emitted(57, 5) Source(64, 6) + SourceIndex(0) +2 >Emitted(57, 20) Source(64, 78) + SourceIndex(0) +3 >Emitted(57, 22) Source(64, 11) + SourceIndex(0) +4 >Emitted(57, 37) Source(64, 22) + SourceIndex(0) +5 >Emitted(57, 39) Source(64, 24) + SourceIndex(0) +6 >Emitted(57, 53) Source(64, 76) + SourceIndex(0) +7 >Emitted(57, 55) Source(64, 34) + SourceIndex(0) +8 >Emitted(57, 76) Source(64, 51) + SourceIndex(0) +9 >Emitted(57, 78) Source(64, 53) + SourceIndex(0) +10>Emitted(57, 103) Source(64, 74) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(58, 5) Source(66, 5) + SourceIndex(0) +2 >Emitted(58, 12) Source(66, 12) + SourceIndex(0) +3 >Emitted(58, 13) Source(66, 13) + SourceIndex(0) +4 >Emitted(58, 16) Source(66, 16) + SourceIndex(0) +5 >Emitted(58, 17) Source(66, 17) + SourceIndex(0) +6 >Emitted(58, 22) Source(66, 22) + SourceIndex(0) +7 >Emitted(58, 23) Source(66, 23) + SourceIndex(0) +8 >Emitted(58, 24) Source(66, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(59, 2) Source(67, 2) + SourceIndex(0) +--- +>>>//# sourceMappingURL=sourceMapValidationDestructuringForOfObjectBindingPattern.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPattern.symbols b/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPattern.symbols new file mode 100644 index 00000000000..51499a35e91 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPattern.symbols @@ -0,0 +1,259 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringForOfObjectBindingPattern.ts === +declare var console: { +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 0, 11)) + + log(msg: any): void; +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 0, 22)) +>msg : Symbol(msg, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 1, 8)) +} +interface Robot { +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 2, 1)) + + name: string; +>name : Symbol(Robot.name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 3, 17)) + + skill: string; +>skill : Symbol(Robot.skill, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 4, 17)) +} + +interface MultiRobot { +>MultiRobot : Symbol(MultiRobot, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 6, 1)) + + name: string; +>name : Symbol(MultiRobot.name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 8, 22)) + + skills: { +>skills : Symbol(MultiRobot.skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 9, 17)) + + primary: string; +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 10, 13)) + + secondary: string; +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 11, 24)) + + }; +} + +let robots: Robot[] = [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]; +>robots : Symbol(robots, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 16, 3)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 2, 1)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 16, 24)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 16, 39)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 16, 60)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 16, 77)) + +let multiRobots: MultiRobot[] = [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, +>multiRobots : Symbol(multiRobots, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 17, 3)) +>MultiRobot : Symbol(MultiRobot, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 6, 1)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 17, 34)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 17, 49)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 17, 59)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 17, 78)) + + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]; +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 18, 5)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 18, 22)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 18, 32)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 18, 53)) + +function getRobots() { +>getRobots : Symbol(getRobots, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 18, 79)) + + return robots; +>robots : Symbol(robots, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 16, 3)) +} + +function getMultiRobots() { +>getMultiRobots : Symbol(getMultiRobots, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 22, 1)) + + return multiRobots; +>multiRobots : Symbol(multiRobots, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 17, 3)) +} + +for (let {name: nameA } of robots) { +>name : Symbol(Robot.name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 3, 17)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 28, 10)) +>robots : Symbol(robots, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 16, 3)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 28, 10)) +} +for (let {name: nameA } of getRobots()) { +>name : Symbol(Robot.name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 3, 17)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 31, 10)) +>getRobots : Symbol(getRobots, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 18, 79)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 31, 10)) +} +for (let {name: nameA } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 34, 29)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 34, 10)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 34, 29)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 34, 44)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 34, 65)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 34, 82)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 34, 10)) +} +for (let { skills: { primary: primaryA, secondary: secondaryA } } of multiRobots) { +>skills : Symbol(MultiRobot.skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 9, 17)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 10, 13)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 37, 20)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 11, 24)) +>secondaryA : Symbol(secondaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 37, 39)) +>multiRobots : Symbol(multiRobots, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 17, 3)) + + console.log(primaryA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 0, 22)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 37, 20)) +} +for (let { skills: { primary: primaryA, secondary: secondaryA } } of getMultiRobots()) { +>skills : Symbol(MultiRobot.skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 9, 17)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 10, 13)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 40, 20)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 11, 24)) +>secondaryA : Symbol(secondaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 40, 39)) +>getMultiRobots : Symbol(getMultiRobots, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 22, 1)) + + console.log(primaryA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 0, 22)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 40, 20)) +} +for (let { skills: { primary: primaryA, secondary: secondaryA } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 43, 86)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 43, 96)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 43, 20)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 43, 115)) +>secondaryA : Symbol(secondaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 43, 39)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 43, 71)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 43, 86)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 43, 96)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 43, 115)) + + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 44, 5)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 44, 22)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 44, 32)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 44, 53)) + + console.log(primaryA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 0, 22)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 43, 20)) +} + +for (let {name: nameA, skill: skillA } of robots) { +>name : Symbol(Robot.name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 3, 17)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 48, 10)) +>skill : Symbol(Robot.skill, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 4, 17)) +>skillA : Symbol(skillA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 48, 22)) +>robots : Symbol(robots, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 16, 3)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 48, 10)) +} +for (let {name: nameA, skill: skillA } of getRobots()) { +>name : Symbol(Robot.name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 3, 17)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 51, 10)) +>skill : Symbol(Robot.skill, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 4, 17)) +>skillA : Symbol(skillA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 51, 22)) +>getRobots : Symbol(getRobots, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 18, 79)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 51, 10)) +} +for (let {name: nameA, skill: skillA } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 54, 44)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 54, 10)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 54, 59)) +>skillA : Symbol(skillA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 54, 22)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 54, 44)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 54, 59)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 54, 80)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 54, 97)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 54, 10)) +} +for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of multiRobots) { +>name : Symbol(MultiRobot.name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 8, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 57, 10)) +>skills : Symbol(MultiRobot.skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 9, 17)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 10, 13)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 57, 32)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 11, 24)) +>secondaryA : Symbol(secondaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 57, 51)) +>multiRobots : Symbol(multiRobots, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 17, 3)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 57, 10)) +} +for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of getMultiRobots()) { +>name : Symbol(MultiRobot.name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 8, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 60, 10)) +>skills : Symbol(MultiRobot.skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 9, 17)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 10, 13)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 60, 32)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 11, 24)) +>secondaryA : Symbol(secondaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 60, 51)) +>getMultiRobots : Symbol(getMultiRobots, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 22, 1)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 60, 10)) +} +for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 63, 83)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 63, 10)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 63, 98)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 63, 108)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 63, 32)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 63, 127)) +>secondaryA : Symbol(secondaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 63, 51)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 63, 83)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 63, 98)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 63, 108)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 63, 127)) + + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 64, 5)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 64, 22)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 64, 32)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 64, 53)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 63, 10)) +} diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPattern.types b/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPattern.types new file mode 100644 index 00000000000..17c060225dc --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPattern.types @@ -0,0 +1,329 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringForOfObjectBindingPattern.ts === +declare var console: { +>console : { log(msg: any): void; } + + log(msg: any): void; +>log : (msg: any) => void +>msg : any +} +interface Robot { +>Robot : Robot + + name: string; +>name : string + + skill: string; +>skill : string +} + +interface MultiRobot { +>MultiRobot : MultiRobot + + name: string; +>name : string + + skills: { +>skills : { primary: string; secondary: string; } + + primary: string; +>primary : string + + secondary: string; +>secondary : string + + }; +} + +let robots: Robot[] = [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]; +>robots : Robot[] +>Robot : Robot +>[{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }] : { name: string; skill: string; }[] +>{ name: "mower", skill: "mowing" } : { name: string; skill: string; } +>name : string +>"mower" : string +>skill : string +>"mowing" : string +>{ name: "trimmer", skill: "trimming" } : { name: string; skill: string; } +>name : string +>"trimmer" : string +>skill : string +>"trimming" : string + +let multiRobots: MultiRobot[] = [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, +>multiRobots : MultiRobot[] +>MultiRobot : MultiRobot +>[{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] : { name: string; skills: { primary: string; secondary: string; }; }[] +>{ name: "mower", skills: { primary: "mowing", secondary: "none" } } : { name: string; skills: { primary: string; secondary: string; }; } +>name : string +>"mower" : string +>skills : { primary: string; secondary: string; } +>{ primary: "mowing", secondary: "none" } : { primary: string; secondary: string; } +>primary : string +>"mowing" : string +>secondary : string +>"none" : string + + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]; +>{ name: "trimmer", skills: { primary: "trimming", secondary: "edging" } } : { name: string; skills: { primary: string; secondary: string; }; } +>name : string +>"trimmer" : string +>skills : { primary: string; secondary: string; } +>{ primary: "trimming", secondary: "edging" } : { primary: string; secondary: string; } +>primary : string +>"trimming" : string +>secondary : string +>"edging" : string + +function getRobots() { +>getRobots : () => Robot[] + + return robots; +>robots : Robot[] +} + +function getMultiRobots() { +>getMultiRobots : () => MultiRobot[] + + return multiRobots; +>multiRobots : MultiRobot[] +} + +for (let {name: nameA } of robots) { +>name : any +>nameA : string +>robots : Robot[] + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for (let {name: nameA } of getRobots()) { +>name : any +>nameA : string +>getRobots() : Robot[] +>getRobots : () => Robot[] + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for (let {name: nameA } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { +>name : any +>nameA : string +>[{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }] : { name: string; skill: string; }[] +>{ name: "mower", skill: "mowing" } : { name: string; skill: string; } +>name : string +>"mower" : string +>skill : string +>"mowing" : string +>{ name: "trimmer", skill: "trimming" } : { name: string; skill: string; } +>name : string +>"trimmer" : string +>skill : string +>"trimming" : string + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for (let { skills: { primary: primaryA, secondary: secondaryA } } of multiRobots) { +>skills : any +>primary : any +>primaryA : string +>secondary : any +>secondaryA : string +>multiRobots : MultiRobot[] + + console.log(primaryA); +>console.log(primaryA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primaryA : string +} +for (let { skills: { primary: primaryA, secondary: secondaryA } } of getMultiRobots()) { +>skills : any +>primary : any +>primaryA : string +>secondary : any +>secondaryA : string +>getMultiRobots() : MultiRobot[] +>getMultiRobots : () => MultiRobot[] + + console.log(primaryA); +>console.log(primaryA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primaryA : string +} +for (let { skills: { primary: primaryA, secondary: secondaryA } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, +>skills : any +>primary : any +>primaryA : string +>secondary : any +>secondaryA : string +>[{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] : { name: string; skills: { primary: string; secondary: string; }; }[] +>{ name: "mower", skills: { primary: "mowing", secondary: "none" } } : { name: string; skills: { primary: string; secondary: string; }; } +>name : string +>"mower" : string +>skills : { primary: string; secondary: string; } +>{ primary: "mowing", secondary: "none" } : { primary: string; secondary: string; } +>primary : string +>"mowing" : string +>secondary : string +>"none" : string + + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { +>{ name: "trimmer", skills: { primary: "trimming", secondary: "edging" } } : { name: string; skills: { primary: string; secondary: string; }; } +>name : string +>"trimmer" : string +>skills : { primary: string; secondary: string; } +>{ primary: "trimming", secondary: "edging" } : { primary: string; secondary: string; } +>primary : string +>"trimming" : string +>secondary : string +>"edging" : string + + console.log(primaryA); +>console.log(primaryA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primaryA : string +} + +for (let {name: nameA, skill: skillA } of robots) { +>name : any +>nameA : string +>skill : any +>skillA : string +>robots : Robot[] + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for (let {name: nameA, skill: skillA } of getRobots()) { +>name : any +>nameA : string +>skill : any +>skillA : string +>getRobots() : Robot[] +>getRobots : () => Robot[] + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for (let {name: nameA, skill: skillA } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { +>name : any +>nameA : string +>skill : any +>skillA : string +>[{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }] : { name: string; skill: string; }[] +>{ name: "mower", skill: "mowing" } : { name: string; skill: string; } +>name : string +>"mower" : string +>skill : string +>"mowing" : string +>{ name: "trimmer", skill: "trimming" } : { name: string; skill: string; } +>name : string +>"trimmer" : string +>skill : string +>"trimming" : string + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of multiRobots) { +>name : any +>nameA : string +>skills : any +>primary : any +>primaryA : string +>secondary : any +>secondaryA : string +>multiRobots : MultiRobot[] + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of getMultiRobots()) { +>name : any +>nameA : string +>skills : any +>primary : any +>primaryA : string +>secondary : any +>secondaryA : string +>getMultiRobots() : MultiRobot[] +>getMultiRobots : () => MultiRobot[] + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, +>name : any +>nameA : string +>skills : any +>primary : any +>primaryA : string +>secondary : any +>secondaryA : string +>[{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] : { name: string; skills: { primary: string; secondary: string; }; }[] +>{ name: "mower", skills: { primary: "mowing", secondary: "none" } } : { name: string; skills: { primary: string; secondary: string; }; } +>name : string +>"mower" : string +>skills : { primary: string; secondary: string; } +>{ primary: "mowing", secondary: "none" } : { primary: string; secondary: string; } +>primary : string +>"mowing" : string +>secondary : string +>"none" : string + + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { +>{ name: "trimmer", skills: { primary: "trimming", secondary: "edging" } } : { name: string; skills: { primary: string; secondary: string; }; } +>name : string +>"trimmer" : string +>skills : { primary: string; secondary: string; } +>{ primary: "trimming", secondary: "edging" } : { primary: string; secondary: string; } +>primary : string +>"trimming" : string +>secondary : string +>"edging" : string + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPattern2.js b/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPattern2.js new file mode 100644 index 00000000000..aebfd11b9db --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPattern2.js @@ -0,0 +1,225 @@ +//// [sourceMapValidationDestructuringForOfObjectBindingPattern2.ts] +declare var console: { + log(msg: any): void; +} +interface Robot { + name: string; + skill: string; +} + +interface MultiRobot { + name: string; + skills: { + primary: string; + secondary: string; + }; +} + +let robots: Robot[] = [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]; +let multiRobots: MultiRobot[] = [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]; + +function getRobots() { + return robots; +} + +function getMultiRobots() { + return multiRobots; +} + +let nameA: string, primaryA: string, secondaryA: string, i: number, skillA: string; +let name: string, primary: string, secondary: string, skill: string; + +for ({name: nameA } of robots) { + console.log(nameA); +} +for ({name: nameA } of getRobots()) { + console.log(nameA); +} +for ({name: nameA } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { + console.log(nameA); +} +for ({ skills: { primary: primaryA, secondary: secondaryA } } of multiRobots) { + console.log(primaryA); +} +for ({ skills: { primary: primaryA, secondary: secondaryA } } of getMultiRobots()) { + console.log(primaryA); +} +for ({ skills: { primary: primaryA, secondary: secondaryA } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { + console.log(primaryA); +} +for ({name } of robots) { + console.log(nameA); +} +for ({name } of getRobots()) { + console.log(nameA); +} +for ({name } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { + console.log(nameA); +} +for ({ skills: { primary, secondary } } of multiRobots) { + console.log(primaryA); +} +for ({ skills: { primary, secondary } } of getMultiRobots()) { + console.log(primaryA); +} +for ({ skills: { primary, secondary } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { + console.log(primaryA); +} + + +for ({name: nameA, skill: skillA } of robots) { + console.log(nameA); +} +for ({name: nameA, skill: skillA } of getRobots()) { + console.log(nameA); +} +for ({name: nameA, skill: skillA } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { + console.log(nameA); +} +for ({name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of multiRobots) { + console.log(nameA); +} +for ({name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of getMultiRobots()) { + console.log(nameA); +} +for ({name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { + console.log(nameA); +} +for ({name, skill } of robots) { + console.log(nameA); +} +for ({name, skill } of getRobots()) { + console.log(nameA); +} +for ({name, skill } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { + console.log(nameA); +} +for ({name, skills: { primary, secondary } } of multiRobots) { + console.log(nameA); +} +for ({name, skills: { primary, secondary } } of getMultiRobots()) { + console.log(nameA); +} +for ({name, skills: { primary, secondary } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { + console.log(nameA); +} + +//// [sourceMapValidationDestructuringForOfObjectBindingPattern2.js] +var robots = [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]; +var multiRobots = [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]; +function getRobots() { + return robots; +} +function getMultiRobots() { + return multiRobots; +} +var nameA, primaryA, secondaryA, i, skillA; +var name, primary, secondary, skill; +for (var _i = 0, robots_1 = robots; _i < robots_1.length; _i++) { + nameA = robots_1[_i].name; + console.log(nameA); +} +for (var _a = 0, _b = getRobots(); _a < _b.length; _a++) { + nameA = _b[_a].name; + console.log(nameA); +} +for (var _c = 0, _d = [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]; _c < _d.length; _c++) { + nameA = _d[_c].name; + console.log(nameA); +} +for (var _e = 0, multiRobots_1 = multiRobots; _e < multiRobots_1.length; _e++) { + _f = multiRobots_1[_e].skills, primaryA = _f.primary, secondaryA = _f.secondary; + console.log(primaryA); +} +for (var _g = 0, _h = getMultiRobots(); _g < _h.length; _g++) { + _j = _h[_g].skills, primaryA = _j.primary, secondaryA = _j.secondary; + console.log(primaryA); +} +for (var _k = 0, _l = [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]; _k < _l.length; _k++) { + _m = _l[_k].skills, primaryA = _m.primary, secondaryA = _m.secondary; + console.log(primaryA); +} +for (var _o = 0, robots_2 = robots; _o < robots_2.length; _o++) { + name = robots_2[_o].name; + console.log(nameA); +} +for (var _p = 0, _q = getRobots(); _p < _q.length; _p++) { + name = _q[_p].name; + console.log(nameA); +} +for (var _r = 0, _s = [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]; _r < _s.length; _r++) { + name = _s[_r].name; + console.log(nameA); +} +for (var _t = 0, multiRobots_2 = multiRobots; _t < multiRobots_2.length; _t++) { + _u = multiRobots_2[_t].skills, primary = _u.primary, secondary = _u.secondary; + console.log(primaryA); +} +for (var _v = 0, _w = getMultiRobots(); _v < _w.length; _v++) { + _x = _w[_v].skills, primary = _x.primary, secondary = _x.secondary; + console.log(primaryA); +} +for (var _y = 0, _z = [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]; _y < _z.length; _y++) { + _0 = _z[_y].skills, primary = _0.primary, secondary = _0.secondary; + console.log(primaryA); +} +for (var _1 = 0, robots_3 = robots; _1 < robots_3.length; _1++) { + _2 = robots_3[_1], nameA = _2.name, skillA = _2.skill; + console.log(nameA); +} +for (var _3 = 0, _4 = getRobots(); _3 < _4.length; _3++) { + _5 = _4[_3], nameA = _5.name, skillA = _5.skill; + console.log(nameA); +} +for (var _6 = 0, _7 = [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]; _6 < _7.length; _6++) { + _8 = _7[_6], nameA = _8.name, skillA = _8.skill; + console.log(nameA); +} +for (var _9 = 0, multiRobots_3 = multiRobots; _9 < multiRobots_3.length; _9++) { + _10 = multiRobots_3[_9], nameA = _10.name, _11 = _10.skills, primaryA = _11.primary, secondaryA = _11.secondary; + console.log(nameA); +} +for (var _12 = 0, _13 = getMultiRobots(); _12 < _13.length; _12++) { + _14 = _13[_12], nameA = _14.name, _15 = _14.skills, primaryA = _15.primary, secondaryA = _15.secondary; + console.log(nameA); +} +for (var _16 = 0, _17 = [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]; _16 < _17.length; _16++) { + _18 = _17[_16], nameA = _18.name, _19 = _18.skills, primaryA = _19.primary, secondaryA = _19.secondary; + console.log(nameA); +} +for (var _20 = 0, robots_4 = robots; _20 < robots_4.length; _20++) { + _21 = robots_4[_20], name = _21.name, skill = _21.skill; + console.log(nameA); +} +for (var _22 = 0, _23 = getRobots(); _22 < _23.length; _22++) { + _24 = _23[_22], name = _24.name, skill = _24.skill; + console.log(nameA); +} +for (var _25 = 0, _26 = [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]; _25 < _26.length; _25++) { + _27 = _26[_25], name = _27.name, skill = _27.skill; + console.log(nameA); +} +for (var _28 = 0, multiRobots_4 = multiRobots; _28 < multiRobots_4.length; _28++) { + _29 = multiRobots_4[_28], name = _29.name, _30 = _29.skills, primary = _30.primary, secondary = _30.secondary; + console.log(nameA); +} +for (var _31 = 0, _32 = getMultiRobots(); _31 < _32.length; _31++) { + _33 = _32[_31], name = _33.name, _34 = _33.skills, primary = _34.primary, secondary = _34.secondary; + console.log(nameA); +} +for (var _35 = 0, _36 = [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]; _35 < _36.length; _35++) { + _37 = _36[_35], name = _37.name, _38 = _37.skills, primary = _38.primary, secondary = _38.secondary; + console.log(nameA); +} +var _f, _j, _m, _u, _x, _0, _2, _5, _8, _10, _11, _14, _15, _18, _19, _21, _24, _27, _29, _30, _33, _34, _37, _38; +//# sourceMappingURL=sourceMapValidationDestructuringForOfObjectBindingPattern2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPattern2.js.map b/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPattern2.js.map new file mode 100644 index 00000000000..c8610cbeef8 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPattern2.js.map @@ -0,0 +1,2 @@ +//// [sourceMapValidationDestructuringForOfObjectBindingPattern2.js.map] +{"version":3,"file":"sourceMapValidationDestructuringForOfObjectBindingPattern2.js","sourceRoot":"","sources":["sourceMapValidationDestructuringForOfObjectBindingPattern2.ts"],"names":[],"mappings":"AAgBA,IAAI,MAAM,GAAY,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAC;AACnG,IAAI,WAAW,GAAiB,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE;IAChG,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAC;AAE/E;IACI,MAAM,CAAC,MAAM,CAAC;AAClB,CAAC;AAED;IACI,MAAM,CAAC,WAAW,CAAC;AACvB,CAAC;AAED,IAAI,KAAa,EAAE,QAAgB,EAAE,UAAkB,EAAE,CAAS,EAAE,MAAc,CAAC;AACnF,IAAI,IAAY,EAAE,OAAe,EAAE,SAAiB,EAAE,KAAa,CAAC;AAEpE,GAAG,CAAC,CAAmB,UAAM,EAAN,iBAAM,EAAN,oBAAM,EAAN,IAAM,CAAC;IAAxB,yBAAW;IACb,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB;AACD,GAAG,CAAC,CAAmB,UAAW,EAAX,KAAA,SAAS,EAAE,EAAX,cAAW,EAAX,IAAW,CAAC;IAA7B,mBAAW;IACb,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB;AACD,GAAG,CAAC,CAAmB,UAA4E,EAA5E,MAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,EAA5E,cAA4E,EAA5E,IAA4E,CAAC;IAA9F,mBAAW;IACb,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB;AACD,GAAG,CAAC,CAA6D,UAAW,EAAX,2BAAW,EAAX,yBAAW,EAAX,IAAW,CAAC;IAAtE,6BAAoD,EAA1C,qBAAiB,EAAE,yBAAqB;IACrD,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;CACzB;AACD,GAAG,CAAC,CAA6D,UAAgB,EAAhB,KAAA,cAAc,EAAE,EAAhB,cAAgB,EAAhB,IAAgB,CAAC;IAA3E,kBAAoD,EAA1C,qBAAiB,EAAE,yBAAqB;IACrD,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;CACzB;AACD,GAAG,CAAC,CAA6D,UACa,EADb,MAAC,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE;IACjI,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,CAAC,EADb,cACa,EADb,IACa,CAAC;IADxE,kBAAoD,EAA1C,qBAAiB,EAAE,yBAAqB;IAErD,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;CACzB;AACD,GAAG,CAAC,CAAY,UAAM,EAAN,iBAAM,EAAN,oBAAM,EAAN,IAAM,CAAC;IAAjB,wBAAI;IACN,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB;AACD,GAAG,CAAC,CAAY,UAAW,EAAX,KAAA,SAAS,EAAE,EAAX,cAAW,EAAX,IAAW,CAAC;IAAtB,kBAAI;IACN,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB;AACD,GAAG,CAAC,CAAY,UAA4E,EAA5E,MAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,EAA5E,cAA4E,EAA5E,IAA4E,CAAC;IAAvF,kBAAI;IACN,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB;AACD,GAAG,CAAC,CAAuC,UAAW,EAAX,2BAAW,EAAX,yBAAW,EAAX,IAAW,CAAC;IAAhD,6BAA8B,EAApB,oBAAO,EAAE,wBAAS;IAC/B,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;CACzB;AACD,GAAG,CAAC,CAAuC,UAAgB,EAAhB,KAAA,cAAc,EAAE,EAAhB,cAAgB,EAAhB,IAAgB,CAAC;IAArD,kBAA8B,EAApB,oBAAO,EAAE,wBAAS;IAC/B,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;CACzB;AACD,GAAG,CAAC,CAAuC,UACmC,EADnC,MAAC,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE;IAC3G,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,CAAC,EADnC,cACmC,EADnC,IACmC,CAAC;IADxE,kBAA8B,EAApB,oBAAO,EAAE,wBAAS;IAE/B,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;CACzB;AAGD,GAAG,CAAC,CAAkC,UAAM,EAAN,iBAAM,EAAN,oBAAM,EAAN,IAAM,CAAC;IAAxC,iBAA6B,EAA5B,eAAW,EAAE,iBAAa;IAC5B,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB;AACD,GAAG,CAAC,CAAkC,UAAW,EAAX,KAAA,SAAS,EAAE,EAAX,cAAW,EAAX,IAAW,CAAC;IAA7C,WAA6B,EAA5B,eAAW,EAAE,iBAAa;IAC5B,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB;AACD,GAAG,CAAC,CAAkC,UAA4E,EAA5E,MAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,EAA5E,cAA4E,EAA5E,IAA4E,CAAC;IAA9G,WAA6B,EAA5B,eAAW,EAAE,iBAAa;IAC5B,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB;AACD,GAAG,CAAC,CAAyE,UAAW,EAAX,2BAAW,EAAX,yBAAW,EAAX,IAAW,CAAC;IAApF,uBAAoE,EAAnE,gBAAW,EAAE,gBAAoD,EAA1C,sBAAiB,EAAE,0BAAqB;IACjE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB;AACD,GAAG,CAAC,CAAyE,WAAgB,EAAhB,MAAA,cAAc,EAAE,EAAhB,gBAAgB,EAAhB,KAAgB,CAAC;IAAzF,cAAoE,EAAnE,gBAAW,EAAE,gBAAoD,EAA1C,sBAAiB,EAAE,0BAAqB;IACjE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB;AACD,GAAG,CAAC,CAAyE,WACC,EADD,OAAC,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE;IAC7I,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,CAAC,EADD,gBACC,EADD,KACC,CAAC;IAD1E,cAAoE,EAAnE,gBAAW,EAAE,gBAAoD,EAA1C,sBAAiB,EAAE,0BAAqB;IAEjE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB;AACD,GAAG,CAAC,CAAmB,WAAM,EAAN,iBAAM,EAAN,qBAAM,EAAN,KAAM,CAAC;IAAzB,mBAAc,EAAb,eAAI,EAAE,iBAAK;IACb,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB;AACD,GAAG,CAAC,CAAmB,WAAW,EAAX,MAAA,SAAS,EAAE,EAAX,gBAAW,EAAX,KAAW,CAAC;IAA9B,cAAc,EAAb,eAAI,EAAE,iBAAK;IACb,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB;AACD,GAAG,CAAC,CAAmB,WAA4E,EAA5E,OAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,EAA5E,gBAA4E,EAA5E,KAA4E,CAAC;IAA/F,cAAc,EAAb,eAAI,EAAE,iBAAK;IACb,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB;AACD,GAAG,CAAC,CAA4C,WAAW,EAAX,2BAAW,EAAX,0BAAW,EAAX,KAAW,CAAC;IAAvD,wBAAuC,EAAtC,eAAI,EAAE,gBAA8B,EAApB,qBAAO,EAAE,yBAAS;IACpC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB;AACD,GAAG,CAAC,CAA4C,WAAgB,EAAhB,MAAA,cAAc,EAAE,EAAhB,gBAAgB,EAAhB,KAAgB,CAAC;IAA5D,cAAuC,EAAtC,eAAI,EAAE,gBAA8B,EAApB,qBAAO,EAAE,yBAAS;IACpC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB;AACD,GAAG,CAAC,CAA4C,WAC8B,EAD9B,OAAC,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE;IAChH,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,CAAC,EAD9B,gBAC8B,EAD9B,KAC8B,CAAC;IAD1E,cAAuC,EAAtC,eAAI,EAAE,gBAA8B,EAApB,qBAAO,EAAE,yBAAS;IAEpC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPattern2.sourcemap.txt b/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPattern2.sourcemap.txt new file mode 100644 index 00000000000..8a603317954 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPattern2.sourcemap.txt @@ -0,0 +1,3387 @@ +=================================================================== +JsFile: sourceMapValidationDestructuringForOfObjectBindingPattern2.js +mapUrl: sourceMapValidationDestructuringForOfObjectBindingPattern2.js.map +sourceRoot: +sources: sourceMapValidationDestructuringForOfObjectBindingPattern2.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/sourceMapValidationDestructuringForOfObjectBindingPattern2.js +sourceFile:sourceMapValidationDestructuringForOfObjectBindingPattern2.ts +------------------------------------------------------------------- +>>>var robots = [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]; +1 > +2 >^^^^ +3 > ^^^^^^ +4 > ^^^ +5 > ^ +6 > ^^ +7 > ^^^^ +8 > ^^ +9 > ^^^^^^^ +10> ^^ +11> ^^^^^ +12> ^^ +13> ^^^^^^^^ +14> ^^ +15> ^^ +16> ^^ +17> ^^^^ +18> ^^ +19> ^^^^^^^^^ +20> ^^ +21> ^^^^^ +22> ^^ +23> ^^^^^^^^^^ +24> ^^ +25> ^ +26> ^ +1 >declare var console: { + > log(msg: any): void; + >} + >interface Robot { + > name: string; + > skill: string; + >} + > + >interface MultiRobot { + > name: string; + > skills: { + > primary: string; + > secondary: string; + > }; + >} + > + > +2 >let +3 > robots +4 > : Robot[] = +5 > [ +6 > { +7 > name +8 > : +9 > "mower" +10> , +11> skill +12> : +13> "mowing" +14> } +15> , +16> { +17> name +18> : +19> "trimmer" +20> , +21> skill +22> : +23> "trimming" +24> } +25> ] +26> ; +1 >Emitted(1, 1) Source(17, 1) + SourceIndex(0) +2 >Emitted(1, 5) Source(17, 5) + SourceIndex(0) +3 >Emitted(1, 11) Source(17, 11) + SourceIndex(0) +4 >Emitted(1, 14) Source(17, 23) + SourceIndex(0) +5 >Emitted(1, 15) Source(17, 24) + SourceIndex(0) +6 >Emitted(1, 17) Source(17, 26) + SourceIndex(0) +7 >Emitted(1, 21) Source(17, 30) + SourceIndex(0) +8 >Emitted(1, 23) Source(17, 32) + SourceIndex(0) +9 >Emitted(1, 30) Source(17, 39) + SourceIndex(0) +10>Emitted(1, 32) Source(17, 41) + SourceIndex(0) +11>Emitted(1, 37) Source(17, 46) + SourceIndex(0) +12>Emitted(1, 39) Source(17, 48) + SourceIndex(0) +13>Emitted(1, 47) Source(17, 56) + SourceIndex(0) +14>Emitted(1, 49) Source(17, 58) + SourceIndex(0) +15>Emitted(1, 51) Source(17, 60) + SourceIndex(0) +16>Emitted(1, 53) Source(17, 62) + SourceIndex(0) +17>Emitted(1, 57) Source(17, 66) + SourceIndex(0) +18>Emitted(1, 59) Source(17, 68) + SourceIndex(0) +19>Emitted(1, 68) Source(17, 77) + SourceIndex(0) +20>Emitted(1, 70) Source(17, 79) + SourceIndex(0) +21>Emitted(1, 75) Source(17, 84) + SourceIndex(0) +22>Emitted(1, 77) Source(17, 86) + SourceIndex(0) +23>Emitted(1, 87) Source(17, 96) + SourceIndex(0) +24>Emitted(1, 89) Source(17, 98) + SourceIndex(0) +25>Emitted(1, 90) Source(17, 99) + SourceIndex(0) +26>Emitted(1, 91) Source(17, 100) + SourceIndex(0) +--- +>>>var multiRobots = [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, +1 > +2 >^^^^ +3 > ^^^^^^^^^^^ +4 > ^^^ +5 > ^ +6 > ^^ +7 > ^^^^ +8 > ^^ +9 > ^^^^^^^ +10> ^^ +11> ^^^^^^ +12> ^^ +13> ^^ +14> ^^^^^^^ +15> ^^ +16> ^^^^^^^^ +17> ^^ +18> ^^^^^^^^^ +19> ^^ +20> ^^^^^^ +21> ^^ +22> ^^ +1 > + > +2 >let +3 > multiRobots +4 > : MultiRobot[] = +5 > [ +6 > { +7 > name +8 > : +9 > "mower" +10> , +11> skills +12> : +13> { +14> primary +15> : +16> "mowing" +17> , +18> secondary +19> : +20> "none" +21> } +22> } +1 >Emitted(2, 1) Source(18, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(18, 5) + SourceIndex(0) +3 >Emitted(2, 16) Source(18, 16) + SourceIndex(0) +4 >Emitted(2, 19) Source(18, 33) + SourceIndex(0) +5 >Emitted(2, 20) Source(18, 34) + SourceIndex(0) +6 >Emitted(2, 22) Source(18, 36) + SourceIndex(0) +7 >Emitted(2, 26) Source(18, 40) + SourceIndex(0) +8 >Emitted(2, 28) Source(18, 42) + SourceIndex(0) +9 >Emitted(2, 35) Source(18, 49) + SourceIndex(0) +10>Emitted(2, 37) Source(18, 51) + SourceIndex(0) +11>Emitted(2, 43) Source(18, 57) + SourceIndex(0) +12>Emitted(2, 45) Source(18, 59) + SourceIndex(0) +13>Emitted(2, 47) Source(18, 61) + SourceIndex(0) +14>Emitted(2, 54) Source(18, 68) + SourceIndex(0) +15>Emitted(2, 56) Source(18, 70) + SourceIndex(0) +16>Emitted(2, 64) Source(18, 78) + SourceIndex(0) +17>Emitted(2, 66) Source(18, 80) + SourceIndex(0) +18>Emitted(2, 75) Source(18, 89) + SourceIndex(0) +19>Emitted(2, 77) Source(18, 91) + SourceIndex(0) +20>Emitted(2, 83) Source(18, 97) + SourceIndex(0) +21>Emitted(2, 85) Source(18, 99) + SourceIndex(0) +22>Emitted(2, 87) Source(18, 101) + SourceIndex(0) +--- +>>> { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]; +1 >^^^^ +2 > ^^ +3 > ^^^^ +4 > ^^ +5 > ^^^^^^^^^ +6 > ^^ +7 > ^^^^^^ +8 > ^^ +9 > ^^ +10> ^^^^^^^ +11> ^^ +12> ^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^ +15> ^^ +16> ^^^^^^^^ +17> ^^ +18> ^^ +19> ^ +20> ^ +1 >, + > +2 > { +3 > name +4 > : +5 > "trimmer" +6 > , +7 > skills +8 > : +9 > { +10> primary +11> : +12> "trimming" +13> , +14> secondary +15> : +16> "edging" +17> } +18> } +19> ] +20> ; +1 >Emitted(3, 5) Source(19, 5) + SourceIndex(0) +2 >Emitted(3, 7) Source(19, 7) + SourceIndex(0) +3 >Emitted(3, 11) Source(19, 11) + SourceIndex(0) +4 >Emitted(3, 13) Source(19, 13) + SourceIndex(0) +5 >Emitted(3, 22) Source(19, 22) + SourceIndex(0) +6 >Emitted(3, 24) Source(19, 24) + SourceIndex(0) +7 >Emitted(3, 30) Source(19, 30) + SourceIndex(0) +8 >Emitted(3, 32) Source(19, 32) + SourceIndex(0) +9 >Emitted(3, 34) Source(19, 34) + SourceIndex(0) +10>Emitted(3, 41) Source(19, 41) + SourceIndex(0) +11>Emitted(3, 43) Source(19, 43) + SourceIndex(0) +12>Emitted(3, 53) Source(19, 53) + SourceIndex(0) +13>Emitted(3, 55) Source(19, 55) + SourceIndex(0) +14>Emitted(3, 64) Source(19, 64) + SourceIndex(0) +15>Emitted(3, 66) Source(19, 66) + SourceIndex(0) +16>Emitted(3, 74) Source(19, 74) + SourceIndex(0) +17>Emitted(3, 76) Source(19, 76) + SourceIndex(0) +18>Emitted(3, 78) Source(19, 78) + SourceIndex(0) +19>Emitted(3, 79) Source(19, 79) + SourceIndex(0) +20>Emitted(3, 80) Source(19, 80) + SourceIndex(0) +--- +>>>function getRobots() { +1 > +2 >^^^^^^^^^^^^^^^^^^^-> +1 > + > + > +1 >Emitted(4, 1) Source(21, 1) + SourceIndex(0) +--- +>>> return robots; +1->^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^ +5 > ^ +1->function getRobots() { + > +2 > return +3 > +4 > robots +5 > ; +1->Emitted(5, 5) Source(22, 5) + SourceIndex(0) +2 >Emitted(5, 11) Source(22, 11) + SourceIndex(0) +3 >Emitted(5, 12) Source(22, 12) + SourceIndex(0) +4 >Emitted(5, 18) Source(22, 18) + SourceIndex(0) +5 >Emitted(5, 19) Source(22, 19) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(6, 1) Source(23, 1) + SourceIndex(0) +2 >Emitted(6, 2) Source(23, 2) + SourceIndex(0) +--- +>>>function getMultiRobots() { +1-> +2 >^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > + > +1->Emitted(7, 1) Source(25, 1) + SourceIndex(0) +--- +>>> return multiRobots; +1->^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^ +5 > ^ +1->function getMultiRobots() { + > +2 > return +3 > +4 > multiRobots +5 > ; +1->Emitted(8, 5) Source(26, 5) + SourceIndex(0) +2 >Emitted(8, 11) Source(26, 11) + SourceIndex(0) +3 >Emitted(8, 12) Source(26, 12) + SourceIndex(0) +4 >Emitted(8, 23) Source(26, 23) + SourceIndex(0) +5 >Emitted(8, 24) Source(26, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(9, 1) Source(27, 1) + SourceIndex(0) +2 >Emitted(9, 2) Source(27, 2) + SourceIndex(0) +--- +>>>var nameA, primaryA, secondaryA, i, skillA; +1-> +2 >^^^^ +3 > ^^^^^ +4 > ^^ +5 > ^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^ +8 > ^^ +9 > ^ +10> ^^ +11> ^^^^^^ +12> ^ +1-> + > + > +2 >let +3 > nameA: string +4 > , +5 > primaryA: string +6 > , +7 > secondaryA: string +8 > , +9 > i: number +10> , +11> skillA: string +12> ; +1->Emitted(10, 1) Source(29, 1) + SourceIndex(0) +2 >Emitted(10, 5) Source(29, 5) + SourceIndex(0) +3 >Emitted(10, 10) Source(29, 18) + SourceIndex(0) +4 >Emitted(10, 12) Source(29, 20) + SourceIndex(0) +5 >Emitted(10, 20) Source(29, 36) + SourceIndex(0) +6 >Emitted(10, 22) Source(29, 38) + SourceIndex(0) +7 >Emitted(10, 32) Source(29, 56) + SourceIndex(0) +8 >Emitted(10, 34) Source(29, 58) + SourceIndex(0) +9 >Emitted(10, 35) Source(29, 67) + SourceIndex(0) +10>Emitted(10, 37) Source(29, 69) + SourceIndex(0) +11>Emitted(10, 43) Source(29, 83) + SourceIndex(0) +12>Emitted(10, 44) Source(29, 84) + SourceIndex(0) +--- +>>>var name, primary, secondary, skill; +1 > +2 >^^^^ +3 > ^^^^ +4 > ^^ +5 > ^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^ +8 > ^^ +9 > ^^^^^ +10> ^ +11> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >let +3 > name: string +4 > , +5 > primary: string +6 > , +7 > secondary: string +8 > , +9 > skill: string +10> ; +1 >Emitted(11, 1) Source(30, 1) + SourceIndex(0) +2 >Emitted(11, 5) Source(30, 5) + SourceIndex(0) +3 >Emitted(11, 9) Source(30, 17) + SourceIndex(0) +4 >Emitted(11, 11) Source(30, 19) + SourceIndex(0) +5 >Emitted(11, 18) Source(30, 34) + SourceIndex(0) +6 >Emitted(11, 20) Source(30, 36) + SourceIndex(0) +7 >Emitted(11, 29) Source(30, 53) + SourceIndex(0) +8 >Emitted(11, 31) Source(30, 55) + SourceIndex(0) +9 >Emitted(11, 36) Source(30, 68) + SourceIndex(0) +10>Emitted(11, 37) Source(30, 69) + SourceIndex(0) +--- +>>>for (var _i = 0, robots_1 = robots; _i < robots_1.length; _i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^^^^^^ +10> ^^ +11> ^^^^ +12> ^ +1-> + > + > +2 >for +3 > +4 > ({name: nameA } of +5 > robots +6 > +7 > robots +8 > +9 > robots +10> +11> robots +12> ) +1->Emitted(12, 1) Source(32, 1) + SourceIndex(0) +2 >Emitted(12, 4) Source(32, 4) + SourceIndex(0) +3 >Emitted(12, 5) Source(32, 5) + SourceIndex(0) +4 >Emitted(12, 6) Source(32, 24) + SourceIndex(0) +5 >Emitted(12, 16) Source(32, 30) + SourceIndex(0) +6 >Emitted(12, 18) Source(32, 24) + SourceIndex(0) +7 >Emitted(12, 35) Source(32, 30) + SourceIndex(0) +8 >Emitted(12, 37) Source(32, 24) + SourceIndex(0) +9 >Emitted(12, 57) Source(32, 30) + SourceIndex(0) +10>Emitted(12, 59) Source(32, 24) + SourceIndex(0) +11>Emitted(12, 63) Source(32, 30) + SourceIndex(0) +12>Emitted(12, 64) Source(32, 31) + SourceIndex(0) +--- +>>> nameA = robots_1[_i].name; +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 > name: nameA +1 >Emitted(13, 5) Source(32, 7) + SourceIndex(0) +2 >Emitted(13, 30) Source(32, 18) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > } of robots) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(14, 5) Source(33, 5) + SourceIndex(0) +2 >Emitted(14, 12) Source(33, 12) + SourceIndex(0) +3 >Emitted(14, 13) Source(33, 13) + SourceIndex(0) +4 >Emitted(14, 16) Source(33, 16) + SourceIndex(0) +5 >Emitted(14, 17) Source(33, 17) + SourceIndex(0) +6 >Emitted(14, 22) Source(33, 22) + SourceIndex(0) +7 >Emitted(14, 23) Source(33, 23) + SourceIndex(0) +8 >Emitted(14, 24) Source(33, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(15, 2) Source(34, 2) + SourceIndex(0) +--- +>>>for (var _a = 0, _b = getRobots(); _a < _b.length; _a++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^ +8 > ^^^^^^^^^ +9 > ^^ +10> ^^ +11> ^^^^^^^^^^^^^^ +12> ^^ +13> ^^^^ +14> ^ +1-> + > +2 >for +3 > +4 > ({name: nameA } of +5 > getRobots() +6 > +7 > +8 > getRobots +9 > () +10> +11> getRobots() +12> +13> getRobots() +14> ) +1->Emitted(16, 1) Source(35, 1) + SourceIndex(0) +2 >Emitted(16, 4) Source(35, 4) + SourceIndex(0) +3 >Emitted(16, 5) Source(35, 5) + SourceIndex(0) +4 >Emitted(16, 6) Source(35, 24) + SourceIndex(0) +5 >Emitted(16, 16) Source(35, 35) + SourceIndex(0) +6 >Emitted(16, 18) Source(35, 24) + SourceIndex(0) +7 >Emitted(16, 23) Source(35, 24) + SourceIndex(0) +8 >Emitted(16, 32) Source(35, 33) + SourceIndex(0) +9 >Emitted(16, 34) Source(35, 35) + SourceIndex(0) +10>Emitted(16, 36) Source(35, 24) + SourceIndex(0) +11>Emitted(16, 50) Source(35, 35) + SourceIndex(0) +12>Emitted(16, 52) Source(35, 24) + SourceIndex(0) +13>Emitted(16, 56) Source(35, 35) + SourceIndex(0) +14>Emitted(16, 57) Source(35, 36) + SourceIndex(0) +--- +>>> nameA = _b[_a].name; +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^ +3 > ^-> +1 > +2 > name: nameA +1 >Emitted(17, 5) Source(35, 7) + SourceIndex(0) +2 >Emitted(17, 24) Source(35, 18) + SourceIndex(0) +--- +>>> console.log(nameA); +1->^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1-> } of getRobots()) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1->Emitted(18, 5) Source(36, 5) + SourceIndex(0) +2 >Emitted(18, 12) Source(36, 12) + SourceIndex(0) +3 >Emitted(18, 13) Source(36, 13) + SourceIndex(0) +4 >Emitted(18, 16) Source(36, 16) + SourceIndex(0) +5 >Emitted(18, 17) Source(36, 17) + SourceIndex(0) +6 >Emitted(18, 22) Source(36, 22) + SourceIndex(0) +7 >Emitted(18, 23) Source(36, 23) + SourceIndex(0) +8 >Emitted(18, 24) Source(36, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(19, 2) Source(37, 2) + SourceIndex(0) +--- +>>>for (var _c = 0, _d = [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]; _c < _d.length; _c++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^ +8 > ^^ +9 > ^^^^ +10> ^^ +11> ^^^^^^^ +12> ^^ +13> ^^^^^ +14> ^^ +15> ^^^^^^^^ +16> ^^ +17> ^^ +18> ^^ +19> ^^^^ +20> ^^ +21> ^^^^^^^^^ +22> ^^ +23> ^^^^^ +24> ^^ +25> ^^^^^^^^^^ +26> ^^ +27> ^ +28> ^^ +29> ^^^^^^^^^^^^^^ +30> ^^ +31> ^^^^ +32> ^ +1-> + > +2 >for +3 > +4 > ({name: nameA } of +5 > [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }] +6 > +7 > [ +8 > { +9 > name +10> : +11> "mower" +12> , +13> skill +14> : +15> "mowing" +16> } +17> , +18> { +19> name +20> : +21> "trimmer" +22> , +23> skill +24> : +25> "trimming" +26> } +27> ] +28> +29> [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }] +30> +31> [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }] +32> ) +1->Emitted(20, 1) Source(38, 1) + SourceIndex(0) +2 >Emitted(20, 4) Source(38, 4) + SourceIndex(0) +3 >Emitted(20, 5) Source(38, 5) + SourceIndex(0) +4 >Emitted(20, 6) Source(38, 24) + SourceIndex(0) +5 >Emitted(20, 16) Source(38, 100) + SourceIndex(0) +6 >Emitted(20, 18) Source(38, 24) + SourceIndex(0) +7 >Emitted(20, 24) Source(38, 25) + SourceIndex(0) +8 >Emitted(20, 26) Source(38, 27) + SourceIndex(0) +9 >Emitted(20, 30) Source(38, 31) + SourceIndex(0) +10>Emitted(20, 32) Source(38, 33) + SourceIndex(0) +11>Emitted(20, 39) Source(38, 40) + SourceIndex(0) +12>Emitted(20, 41) Source(38, 42) + SourceIndex(0) +13>Emitted(20, 46) Source(38, 47) + SourceIndex(0) +14>Emitted(20, 48) Source(38, 49) + SourceIndex(0) +15>Emitted(20, 56) Source(38, 57) + SourceIndex(0) +16>Emitted(20, 58) Source(38, 59) + SourceIndex(0) +17>Emitted(20, 60) Source(38, 61) + SourceIndex(0) +18>Emitted(20, 62) Source(38, 63) + SourceIndex(0) +19>Emitted(20, 66) Source(38, 67) + SourceIndex(0) +20>Emitted(20, 68) Source(38, 69) + SourceIndex(0) +21>Emitted(20, 77) Source(38, 78) + SourceIndex(0) +22>Emitted(20, 79) Source(38, 80) + SourceIndex(0) +23>Emitted(20, 84) Source(38, 85) + SourceIndex(0) +24>Emitted(20, 86) Source(38, 87) + SourceIndex(0) +25>Emitted(20, 96) Source(38, 97) + SourceIndex(0) +26>Emitted(20, 98) Source(38, 99) + SourceIndex(0) +27>Emitted(20, 99) Source(38, 100) + SourceIndex(0) +28>Emitted(20, 101) Source(38, 24) + SourceIndex(0) +29>Emitted(20, 115) Source(38, 100) + SourceIndex(0) +30>Emitted(20, 117) Source(38, 24) + SourceIndex(0) +31>Emitted(20, 121) Source(38, 100) + SourceIndex(0) +32>Emitted(20, 122) Source(38, 101) + SourceIndex(0) +--- +>>> nameA = _d[_c].name; +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^ +3 > ^-> +1 > +2 > name: nameA +1 >Emitted(21, 5) Source(38, 7) + SourceIndex(0) +2 >Emitted(21, 24) Source(38, 18) + SourceIndex(0) +--- +>>> console.log(nameA); +1->^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1-> } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1->Emitted(22, 5) Source(39, 5) + SourceIndex(0) +2 >Emitted(22, 12) Source(39, 12) + SourceIndex(0) +3 >Emitted(22, 13) Source(39, 13) + SourceIndex(0) +4 >Emitted(22, 16) Source(39, 16) + SourceIndex(0) +5 >Emitted(22, 17) Source(39, 17) + SourceIndex(0) +6 >Emitted(22, 22) Source(39, 22) + SourceIndex(0) +7 >Emitted(22, 23) Source(39, 23) + SourceIndex(0) +8 >Emitted(22, 24) Source(39, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(23, 2) Source(40, 2) + SourceIndex(0) +--- +>>>for (var _e = 0, multiRobots_1 = multiRobots; _e < multiRobots_1.length; _e++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^^^^^^^^^^^ +10> ^^ +11> ^^^^ +12> ^ +13> ^^^^^^^-> +1-> + > +2 >for +3 > +4 > ({ skills: { primary: primaryA, secondary: secondaryA } } of +5 > multiRobots +6 > +7 > multiRobots +8 > +9 > multiRobots +10> +11> multiRobots +12> ) +1->Emitted(24, 1) Source(41, 1) + SourceIndex(0) +2 >Emitted(24, 4) Source(41, 4) + SourceIndex(0) +3 >Emitted(24, 5) Source(41, 5) + SourceIndex(0) +4 >Emitted(24, 6) Source(41, 66) + SourceIndex(0) +5 >Emitted(24, 16) Source(41, 77) + SourceIndex(0) +6 >Emitted(24, 18) Source(41, 66) + SourceIndex(0) +7 >Emitted(24, 45) Source(41, 77) + SourceIndex(0) +8 >Emitted(24, 47) Source(41, 66) + SourceIndex(0) +9 >Emitted(24, 72) Source(41, 77) + SourceIndex(0) +10>Emitted(24, 74) Source(41, 66) + SourceIndex(0) +11>Emitted(24, 78) Source(41, 77) + SourceIndex(0) +12>Emitted(24, 79) Source(41, 78) + SourceIndex(0) +--- +>>> _f = multiRobots_1[_e].skills, primaryA = _f.primary, secondaryA = _f.secondary; +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > skills: { primary: primaryA, secondary: secondaryA } +3 > +4 > primary: primaryA +5 > , +6 > secondary: secondaryA +1->Emitted(25, 5) Source(41, 8) + SourceIndex(0) +2 >Emitted(25, 34) Source(41, 60) + SourceIndex(0) +3 >Emitted(25, 36) Source(41, 18) + SourceIndex(0) +4 >Emitted(25, 57) Source(41, 35) + SourceIndex(0) +5 >Emitted(25, 59) Source(41, 37) + SourceIndex(0) +6 >Emitted(25, 84) Source(41, 58) + SourceIndex(0) +--- +>>> console.log(primaryA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1 > } } of multiRobots) { + > +2 > console +3 > . +4 > log +5 > ( +6 > primaryA +7 > ) +8 > ; +1 >Emitted(26, 5) Source(42, 5) + SourceIndex(0) +2 >Emitted(26, 12) Source(42, 12) + SourceIndex(0) +3 >Emitted(26, 13) Source(42, 13) + SourceIndex(0) +4 >Emitted(26, 16) Source(42, 16) + SourceIndex(0) +5 >Emitted(26, 17) Source(42, 17) + SourceIndex(0) +6 >Emitted(26, 25) Source(42, 25) + SourceIndex(0) +7 >Emitted(26, 26) Source(42, 26) + SourceIndex(0) +8 >Emitted(26, 27) Source(42, 27) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(27, 2) Source(43, 2) + SourceIndex(0) +--- +>>>for (var _g = 0, _h = getMultiRobots(); _g < _h.length; _g++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^ +8 > ^^^^^^^^^^^^^^ +9 > ^^ +10> ^^ +11> ^^^^^^^^^^^^^^ +12> ^^ +13> ^^^^ +14> ^ +15> ^^^^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > ({ skills: { primary: primaryA, secondary: secondaryA } } of +5 > getMultiRobots() +6 > +7 > +8 > getMultiRobots +9 > () +10> +11> getMultiRobots() +12> +13> getMultiRobots() +14> ) +1->Emitted(28, 1) Source(44, 1) + SourceIndex(0) +2 >Emitted(28, 4) Source(44, 4) + SourceIndex(0) +3 >Emitted(28, 5) Source(44, 5) + SourceIndex(0) +4 >Emitted(28, 6) Source(44, 66) + SourceIndex(0) +5 >Emitted(28, 16) Source(44, 82) + SourceIndex(0) +6 >Emitted(28, 18) Source(44, 66) + SourceIndex(0) +7 >Emitted(28, 23) Source(44, 66) + SourceIndex(0) +8 >Emitted(28, 37) Source(44, 80) + SourceIndex(0) +9 >Emitted(28, 39) Source(44, 82) + SourceIndex(0) +10>Emitted(28, 41) Source(44, 66) + SourceIndex(0) +11>Emitted(28, 55) Source(44, 82) + SourceIndex(0) +12>Emitted(28, 57) Source(44, 66) + SourceIndex(0) +13>Emitted(28, 61) Source(44, 82) + SourceIndex(0) +14>Emitted(28, 62) Source(44, 83) + SourceIndex(0) +--- +>>> _j = _h[_g].skills, primaryA = _j.primary, secondaryA = _j.secondary; +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > skills: { primary: primaryA, secondary: secondaryA } +3 > +4 > primary: primaryA +5 > , +6 > secondary: secondaryA +1->Emitted(29, 5) Source(44, 8) + SourceIndex(0) +2 >Emitted(29, 23) Source(44, 60) + SourceIndex(0) +3 >Emitted(29, 25) Source(44, 18) + SourceIndex(0) +4 >Emitted(29, 46) Source(44, 35) + SourceIndex(0) +5 >Emitted(29, 48) Source(44, 37) + SourceIndex(0) +6 >Emitted(29, 73) Source(44, 58) + SourceIndex(0) +--- +>>> console.log(primaryA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1 > } } of getMultiRobots()) { + > +2 > console +3 > . +4 > log +5 > ( +6 > primaryA +7 > ) +8 > ; +1 >Emitted(30, 5) Source(45, 5) + SourceIndex(0) +2 >Emitted(30, 12) Source(45, 12) + SourceIndex(0) +3 >Emitted(30, 13) Source(45, 13) + SourceIndex(0) +4 >Emitted(30, 16) Source(45, 16) + SourceIndex(0) +5 >Emitted(30, 17) Source(45, 17) + SourceIndex(0) +6 >Emitted(30, 25) Source(45, 25) + SourceIndex(0) +7 >Emitted(30, 26) Source(45, 26) + SourceIndex(0) +8 >Emitted(30, 27) Source(45, 27) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(31, 2) Source(46, 2) + SourceIndex(0) +--- +>>>for (var _k = 0, _l = [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^ +8 > ^^ +9 > ^^^^ +10> ^^ +11> ^^^^^^^ +12> ^^ +13> ^^^^^^ +14> ^^ +15> ^^ +16> ^^^^^^^ +17> ^^ +18> ^^^^^^^^ +19> ^^ +20> ^^^^^^^^^ +21> ^^ +22> ^^^^^^ +23> ^^ +24> ^^ +25> ^^^^^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > ({ skills: { primary: primaryA, secondary: secondaryA } } of +5 > [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] +6 > +7 > [ +8 > { +9 > name +10> : +11> "mower" +12> , +13> skills +14> : +15> { +16> primary +17> : +18> "mowing" +19> , +20> secondary +21> : +22> "none" +23> } +24> } +1->Emitted(32, 1) Source(47, 1) + SourceIndex(0) +2 >Emitted(32, 4) Source(47, 4) + SourceIndex(0) +3 >Emitted(32, 5) Source(47, 5) + SourceIndex(0) +4 >Emitted(32, 6) Source(47, 66) + SourceIndex(0) +5 >Emitted(32, 16) Source(48, 79) + SourceIndex(0) +6 >Emitted(32, 18) Source(47, 66) + SourceIndex(0) +7 >Emitted(32, 24) Source(47, 67) + SourceIndex(0) +8 >Emitted(32, 26) Source(47, 69) + SourceIndex(0) +9 >Emitted(32, 30) Source(47, 73) + SourceIndex(0) +10>Emitted(32, 32) Source(47, 75) + SourceIndex(0) +11>Emitted(32, 39) Source(47, 82) + SourceIndex(0) +12>Emitted(32, 41) Source(47, 84) + SourceIndex(0) +13>Emitted(32, 47) Source(47, 90) + SourceIndex(0) +14>Emitted(32, 49) Source(47, 92) + SourceIndex(0) +15>Emitted(32, 51) Source(47, 94) + SourceIndex(0) +16>Emitted(32, 58) Source(47, 101) + SourceIndex(0) +17>Emitted(32, 60) Source(47, 103) + SourceIndex(0) +18>Emitted(32, 68) Source(47, 111) + SourceIndex(0) +19>Emitted(32, 70) Source(47, 113) + SourceIndex(0) +20>Emitted(32, 79) Source(47, 122) + SourceIndex(0) +21>Emitted(32, 81) Source(47, 124) + SourceIndex(0) +22>Emitted(32, 87) Source(47, 130) + SourceIndex(0) +23>Emitted(32, 89) Source(47, 132) + SourceIndex(0) +24>Emitted(32, 91) Source(47, 134) + SourceIndex(0) +--- +>>> { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]; _k < _l.length; _k++) { +1->^^^^ +2 > ^^ +3 > ^^^^ +4 > ^^ +5 > ^^^^^^^^^ +6 > ^^ +7 > ^^^^^^ +8 > ^^ +9 > ^^ +10> ^^^^^^^ +11> ^^ +12> ^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^ +15> ^^ +16> ^^^^^^^^ +17> ^^ +18> ^^ +19> ^ +20> ^^ +21> ^^^^^^^^^^^^^^ +22> ^^ +23> ^^^^ +24> ^ +1->, + > +2 > { +3 > name +4 > : +5 > "trimmer" +6 > , +7 > skills +8 > : +9 > { +10> primary +11> : +12> "trimming" +13> , +14> secondary +15> : +16> "edging" +17> } +18> } +19> ] +20> +21> [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] +22> +23> [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] +24> ) +1->Emitted(33, 5) Source(48, 5) + SourceIndex(0) +2 >Emitted(33, 7) Source(48, 7) + SourceIndex(0) +3 >Emitted(33, 11) Source(48, 11) + SourceIndex(0) +4 >Emitted(33, 13) Source(48, 13) + SourceIndex(0) +5 >Emitted(33, 22) Source(48, 22) + SourceIndex(0) +6 >Emitted(33, 24) Source(48, 24) + SourceIndex(0) +7 >Emitted(33, 30) Source(48, 30) + SourceIndex(0) +8 >Emitted(33, 32) Source(48, 32) + SourceIndex(0) +9 >Emitted(33, 34) Source(48, 34) + SourceIndex(0) +10>Emitted(33, 41) Source(48, 41) + SourceIndex(0) +11>Emitted(33, 43) Source(48, 43) + SourceIndex(0) +12>Emitted(33, 53) Source(48, 53) + SourceIndex(0) +13>Emitted(33, 55) Source(48, 55) + SourceIndex(0) +14>Emitted(33, 64) Source(48, 64) + SourceIndex(0) +15>Emitted(33, 66) Source(48, 66) + SourceIndex(0) +16>Emitted(33, 74) Source(48, 74) + SourceIndex(0) +17>Emitted(33, 76) Source(48, 76) + SourceIndex(0) +18>Emitted(33, 78) Source(48, 78) + SourceIndex(0) +19>Emitted(33, 79) Source(48, 79) + SourceIndex(0) +20>Emitted(33, 81) Source(47, 66) + SourceIndex(0) +21>Emitted(33, 95) Source(48, 79) + SourceIndex(0) +22>Emitted(33, 97) Source(47, 66) + SourceIndex(0) +23>Emitted(33, 101) Source(48, 79) + SourceIndex(0) +24>Emitted(33, 102) Source(48, 80) + SourceIndex(0) +--- +>>> _m = _l[_k].skills, primaryA = _m.primary, secondaryA = _m.secondary; +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 > skills: { primary: primaryA, secondary: secondaryA } +3 > +4 > primary: primaryA +5 > , +6 > secondary: secondaryA +1 >Emitted(34, 5) Source(47, 8) + SourceIndex(0) +2 >Emitted(34, 23) Source(47, 60) + SourceIndex(0) +3 >Emitted(34, 25) Source(47, 18) + SourceIndex(0) +4 >Emitted(34, 46) Source(47, 35) + SourceIndex(0) +5 >Emitted(34, 48) Source(47, 37) + SourceIndex(0) +6 >Emitted(34, 73) Source(47, 58) + SourceIndex(0) +--- +>>> console.log(primaryA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1 > } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { + > +2 > console +3 > . +4 > log +5 > ( +6 > primaryA +7 > ) +8 > ; +1 >Emitted(35, 5) Source(49, 5) + SourceIndex(0) +2 >Emitted(35, 12) Source(49, 12) + SourceIndex(0) +3 >Emitted(35, 13) Source(49, 13) + SourceIndex(0) +4 >Emitted(35, 16) Source(49, 16) + SourceIndex(0) +5 >Emitted(35, 17) Source(49, 17) + SourceIndex(0) +6 >Emitted(35, 25) Source(49, 25) + SourceIndex(0) +7 >Emitted(35, 26) Source(49, 26) + SourceIndex(0) +8 >Emitted(35, 27) Source(49, 27) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(36, 2) Source(50, 2) + SourceIndex(0) +--- +>>>for (var _o = 0, robots_2 = robots; _o < robots_2.length; _o++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^^^^^^ +10> ^^ +11> ^^^^ +12> ^ +1-> + > +2 >for +3 > +4 > ({name } of +5 > robots +6 > +7 > robots +8 > +9 > robots +10> +11> robots +12> ) +1->Emitted(37, 1) Source(51, 1) + SourceIndex(0) +2 >Emitted(37, 4) Source(51, 4) + SourceIndex(0) +3 >Emitted(37, 5) Source(51, 5) + SourceIndex(0) +4 >Emitted(37, 6) Source(51, 17) + SourceIndex(0) +5 >Emitted(37, 16) Source(51, 23) + SourceIndex(0) +6 >Emitted(37, 18) Source(51, 17) + SourceIndex(0) +7 >Emitted(37, 35) Source(51, 23) + SourceIndex(0) +8 >Emitted(37, 37) Source(51, 17) + SourceIndex(0) +9 >Emitted(37, 57) Source(51, 23) + SourceIndex(0) +10>Emitted(37, 59) Source(51, 17) + SourceIndex(0) +11>Emitted(37, 63) Source(51, 23) + SourceIndex(0) +12>Emitted(37, 64) Source(51, 24) + SourceIndex(0) +--- +>>> name = robots_2[_o].name; +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 > name +1 >Emitted(38, 5) Source(51, 7) + SourceIndex(0) +2 >Emitted(38, 29) Source(51, 11) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > } of robots) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(39, 5) Source(52, 5) + SourceIndex(0) +2 >Emitted(39, 12) Source(52, 12) + SourceIndex(0) +3 >Emitted(39, 13) Source(52, 13) + SourceIndex(0) +4 >Emitted(39, 16) Source(52, 16) + SourceIndex(0) +5 >Emitted(39, 17) Source(52, 17) + SourceIndex(0) +6 >Emitted(39, 22) Source(52, 22) + SourceIndex(0) +7 >Emitted(39, 23) Source(52, 23) + SourceIndex(0) +8 >Emitted(39, 24) Source(52, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(40, 2) Source(53, 2) + SourceIndex(0) +--- +>>>for (var _p = 0, _q = getRobots(); _p < _q.length; _p++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^ +8 > ^^^^^^^^^ +9 > ^^ +10> ^^ +11> ^^^^^^^^^^^^^^ +12> ^^ +13> ^^^^ +14> ^ +1-> + > +2 >for +3 > +4 > ({name } of +5 > getRobots() +6 > +7 > +8 > getRobots +9 > () +10> +11> getRobots() +12> +13> getRobots() +14> ) +1->Emitted(41, 1) Source(54, 1) + SourceIndex(0) +2 >Emitted(41, 4) Source(54, 4) + SourceIndex(0) +3 >Emitted(41, 5) Source(54, 5) + SourceIndex(0) +4 >Emitted(41, 6) Source(54, 17) + SourceIndex(0) +5 >Emitted(41, 16) Source(54, 28) + SourceIndex(0) +6 >Emitted(41, 18) Source(54, 17) + SourceIndex(0) +7 >Emitted(41, 23) Source(54, 17) + SourceIndex(0) +8 >Emitted(41, 32) Source(54, 26) + SourceIndex(0) +9 >Emitted(41, 34) Source(54, 28) + SourceIndex(0) +10>Emitted(41, 36) Source(54, 17) + SourceIndex(0) +11>Emitted(41, 50) Source(54, 28) + SourceIndex(0) +12>Emitted(41, 52) Source(54, 17) + SourceIndex(0) +13>Emitted(41, 56) Source(54, 28) + SourceIndex(0) +14>Emitted(41, 57) Source(54, 29) + SourceIndex(0) +--- +>>> name = _q[_p].name; +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^ +3 > ^^-> +1 > +2 > name +1 >Emitted(42, 5) Source(54, 7) + SourceIndex(0) +2 >Emitted(42, 23) Source(54, 11) + SourceIndex(0) +--- +>>> console.log(nameA); +1->^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1-> } of getRobots()) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1->Emitted(43, 5) Source(55, 5) + SourceIndex(0) +2 >Emitted(43, 12) Source(55, 12) + SourceIndex(0) +3 >Emitted(43, 13) Source(55, 13) + SourceIndex(0) +4 >Emitted(43, 16) Source(55, 16) + SourceIndex(0) +5 >Emitted(43, 17) Source(55, 17) + SourceIndex(0) +6 >Emitted(43, 22) Source(55, 22) + SourceIndex(0) +7 >Emitted(43, 23) Source(55, 23) + SourceIndex(0) +8 >Emitted(43, 24) Source(55, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(44, 2) Source(56, 2) + SourceIndex(0) +--- +>>>for (var _r = 0, _s = [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]; _r < _s.length; _r++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^ +8 > ^^ +9 > ^^^^ +10> ^^ +11> ^^^^^^^ +12> ^^ +13> ^^^^^ +14> ^^ +15> ^^^^^^^^ +16> ^^ +17> ^^ +18> ^^ +19> ^^^^ +20> ^^ +21> ^^^^^^^^^ +22> ^^ +23> ^^^^^ +24> ^^ +25> ^^^^^^^^^^ +26> ^^ +27> ^ +28> ^^ +29> ^^^^^^^^^^^^^^ +30> ^^ +31> ^^^^ +32> ^ +1-> + > +2 >for +3 > +4 > ({name } of +5 > [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }] +6 > +7 > [ +8 > { +9 > name +10> : +11> "mower" +12> , +13> skill +14> : +15> "mowing" +16> } +17> , +18> { +19> name +20> : +21> "trimmer" +22> , +23> skill +24> : +25> "trimming" +26> } +27> ] +28> +29> [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }] +30> +31> [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }] +32> ) +1->Emitted(45, 1) Source(57, 1) + SourceIndex(0) +2 >Emitted(45, 4) Source(57, 4) + SourceIndex(0) +3 >Emitted(45, 5) Source(57, 5) + SourceIndex(0) +4 >Emitted(45, 6) Source(57, 17) + SourceIndex(0) +5 >Emitted(45, 16) Source(57, 93) + SourceIndex(0) +6 >Emitted(45, 18) Source(57, 17) + SourceIndex(0) +7 >Emitted(45, 24) Source(57, 18) + SourceIndex(0) +8 >Emitted(45, 26) Source(57, 20) + SourceIndex(0) +9 >Emitted(45, 30) Source(57, 24) + SourceIndex(0) +10>Emitted(45, 32) Source(57, 26) + SourceIndex(0) +11>Emitted(45, 39) Source(57, 33) + SourceIndex(0) +12>Emitted(45, 41) Source(57, 35) + SourceIndex(0) +13>Emitted(45, 46) Source(57, 40) + SourceIndex(0) +14>Emitted(45, 48) Source(57, 42) + SourceIndex(0) +15>Emitted(45, 56) Source(57, 50) + SourceIndex(0) +16>Emitted(45, 58) Source(57, 52) + SourceIndex(0) +17>Emitted(45, 60) Source(57, 54) + SourceIndex(0) +18>Emitted(45, 62) Source(57, 56) + SourceIndex(0) +19>Emitted(45, 66) Source(57, 60) + SourceIndex(0) +20>Emitted(45, 68) Source(57, 62) + SourceIndex(0) +21>Emitted(45, 77) Source(57, 71) + SourceIndex(0) +22>Emitted(45, 79) Source(57, 73) + SourceIndex(0) +23>Emitted(45, 84) Source(57, 78) + SourceIndex(0) +24>Emitted(45, 86) Source(57, 80) + SourceIndex(0) +25>Emitted(45, 96) Source(57, 90) + SourceIndex(0) +26>Emitted(45, 98) Source(57, 92) + SourceIndex(0) +27>Emitted(45, 99) Source(57, 93) + SourceIndex(0) +28>Emitted(45, 101) Source(57, 17) + SourceIndex(0) +29>Emitted(45, 115) Source(57, 93) + SourceIndex(0) +30>Emitted(45, 117) Source(57, 17) + SourceIndex(0) +31>Emitted(45, 121) Source(57, 93) + SourceIndex(0) +32>Emitted(45, 122) Source(57, 94) + SourceIndex(0) +--- +>>> name = _s[_r].name; +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^ +3 > ^^-> +1 > +2 > name +1 >Emitted(46, 5) Source(57, 7) + SourceIndex(0) +2 >Emitted(46, 23) Source(57, 11) + SourceIndex(0) +--- +>>> console.log(nameA); +1->^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1-> } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1->Emitted(47, 5) Source(58, 5) + SourceIndex(0) +2 >Emitted(47, 12) Source(58, 12) + SourceIndex(0) +3 >Emitted(47, 13) Source(58, 13) + SourceIndex(0) +4 >Emitted(47, 16) Source(58, 16) + SourceIndex(0) +5 >Emitted(47, 17) Source(58, 17) + SourceIndex(0) +6 >Emitted(47, 22) Source(58, 22) + SourceIndex(0) +7 >Emitted(47, 23) Source(58, 23) + SourceIndex(0) +8 >Emitted(47, 24) Source(58, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(48, 2) Source(59, 2) + SourceIndex(0) +--- +>>>for (var _t = 0, multiRobots_2 = multiRobots; _t < multiRobots_2.length; _t++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^^^^^^^^^^^ +10> ^^ +11> ^^^^ +12> ^ +13> ^^^^^-> +1-> + > +2 >for +3 > +4 > ({ skills: { primary, secondary } } of +5 > multiRobots +6 > +7 > multiRobots +8 > +9 > multiRobots +10> +11> multiRobots +12> ) +1->Emitted(49, 1) Source(60, 1) + SourceIndex(0) +2 >Emitted(49, 4) Source(60, 4) + SourceIndex(0) +3 >Emitted(49, 5) Source(60, 5) + SourceIndex(0) +4 >Emitted(49, 6) Source(60, 44) + SourceIndex(0) +5 >Emitted(49, 16) Source(60, 55) + SourceIndex(0) +6 >Emitted(49, 18) Source(60, 44) + SourceIndex(0) +7 >Emitted(49, 45) Source(60, 55) + SourceIndex(0) +8 >Emitted(49, 47) Source(60, 44) + SourceIndex(0) +9 >Emitted(49, 72) Source(60, 55) + SourceIndex(0) +10>Emitted(49, 74) Source(60, 44) + SourceIndex(0) +11>Emitted(49, 78) Source(60, 55) + SourceIndex(0) +12>Emitted(49, 79) Source(60, 56) + SourceIndex(0) +--- +>>> _u = multiRobots_2[_t].skills, primary = _u.primary, secondary = _u.secondary; +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > skills: { primary, secondary } +3 > +4 > primary +5 > , +6 > secondary +1->Emitted(50, 5) Source(60, 8) + SourceIndex(0) +2 >Emitted(50, 34) Source(60, 38) + SourceIndex(0) +3 >Emitted(50, 36) Source(60, 18) + SourceIndex(0) +4 >Emitted(50, 56) Source(60, 25) + SourceIndex(0) +5 >Emitted(50, 58) Source(60, 27) + SourceIndex(0) +6 >Emitted(50, 82) Source(60, 36) + SourceIndex(0) +--- +>>> console.log(primaryA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1 > } } of multiRobots) { + > +2 > console +3 > . +4 > log +5 > ( +6 > primaryA +7 > ) +8 > ; +1 >Emitted(51, 5) Source(61, 5) + SourceIndex(0) +2 >Emitted(51, 12) Source(61, 12) + SourceIndex(0) +3 >Emitted(51, 13) Source(61, 13) + SourceIndex(0) +4 >Emitted(51, 16) Source(61, 16) + SourceIndex(0) +5 >Emitted(51, 17) Source(61, 17) + SourceIndex(0) +6 >Emitted(51, 25) Source(61, 25) + SourceIndex(0) +7 >Emitted(51, 26) Source(61, 26) + SourceIndex(0) +8 >Emitted(51, 27) Source(61, 27) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(52, 2) Source(62, 2) + SourceIndex(0) +--- +>>>for (var _v = 0, _w = getMultiRobots(); _v < _w.length; _v++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^ +8 > ^^^^^^^^^^^^^^ +9 > ^^ +10> ^^ +11> ^^^^^^^^^^^^^^ +12> ^^ +13> ^^^^ +14> ^ +15> ^^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > ({ skills: { primary, secondary } } of +5 > getMultiRobots() +6 > +7 > +8 > getMultiRobots +9 > () +10> +11> getMultiRobots() +12> +13> getMultiRobots() +14> ) +1->Emitted(53, 1) Source(63, 1) + SourceIndex(0) +2 >Emitted(53, 4) Source(63, 4) + SourceIndex(0) +3 >Emitted(53, 5) Source(63, 5) + SourceIndex(0) +4 >Emitted(53, 6) Source(63, 44) + SourceIndex(0) +5 >Emitted(53, 16) Source(63, 60) + SourceIndex(0) +6 >Emitted(53, 18) Source(63, 44) + SourceIndex(0) +7 >Emitted(53, 23) Source(63, 44) + SourceIndex(0) +8 >Emitted(53, 37) Source(63, 58) + SourceIndex(0) +9 >Emitted(53, 39) Source(63, 60) + SourceIndex(0) +10>Emitted(53, 41) Source(63, 44) + SourceIndex(0) +11>Emitted(53, 55) Source(63, 60) + SourceIndex(0) +12>Emitted(53, 57) Source(63, 44) + SourceIndex(0) +13>Emitted(53, 61) Source(63, 60) + SourceIndex(0) +14>Emitted(53, 62) Source(63, 61) + SourceIndex(0) +--- +>>> _x = _w[_v].skills, primary = _x.primary, secondary = _x.secondary; +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > skills: { primary, secondary } +3 > +4 > primary +5 > , +6 > secondary +1->Emitted(54, 5) Source(63, 8) + SourceIndex(0) +2 >Emitted(54, 23) Source(63, 38) + SourceIndex(0) +3 >Emitted(54, 25) Source(63, 18) + SourceIndex(0) +4 >Emitted(54, 45) Source(63, 25) + SourceIndex(0) +5 >Emitted(54, 47) Source(63, 27) + SourceIndex(0) +6 >Emitted(54, 71) Source(63, 36) + SourceIndex(0) +--- +>>> console.log(primaryA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1 > } } of getMultiRobots()) { + > +2 > console +3 > . +4 > log +5 > ( +6 > primaryA +7 > ) +8 > ; +1 >Emitted(55, 5) Source(64, 5) + SourceIndex(0) +2 >Emitted(55, 12) Source(64, 12) + SourceIndex(0) +3 >Emitted(55, 13) Source(64, 13) + SourceIndex(0) +4 >Emitted(55, 16) Source(64, 16) + SourceIndex(0) +5 >Emitted(55, 17) Source(64, 17) + SourceIndex(0) +6 >Emitted(55, 25) Source(64, 25) + SourceIndex(0) +7 >Emitted(55, 26) Source(64, 26) + SourceIndex(0) +8 >Emitted(55, 27) Source(64, 27) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(56, 2) Source(65, 2) + SourceIndex(0) +--- +>>>for (var _y = 0, _z = [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^ +8 > ^^ +9 > ^^^^ +10> ^^ +11> ^^^^^^^ +12> ^^ +13> ^^^^^^ +14> ^^ +15> ^^ +16> ^^^^^^^ +17> ^^ +18> ^^^^^^^^ +19> ^^ +20> ^^^^^^^^^ +21> ^^ +22> ^^^^^^ +23> ^^ +24> ^^ +25> ^^^^^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > ({ skills: { primary, secondary } } of +5 > [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] +6 > +7 > [ +8 > { +9 > name +10> : +11> "mower" +12> , +13> skills +14> : +15> { +16> primary +17> : +18> "mowing" +19> , +20> secondary +21> : +22> "none" +23> } +24> } +1->Emitted(57, 1) Source(66, 1) + SourceIndex(0) +2 >Emitted(57, 4) Source(66, 4) + SourceIndex(0) +3 >Emitted(57, 5) Source(66, 5) + SourceIndex(0) +4 >Emitted(57, 6) Source(66, 44) + SourceIndex(0) +5 >Emitted(57, 16) Source(67, 79) + SourceIndex(0) +6 >Emitted(57, 18) Source(66, 44) + SourceIndex(0) +7 >Emitted(57, 24) Source(66, 45) + SourceIndex(0) +8 >Emitted(57, 26) Source(66, 47) + SourceIndex(0) +9 >Emitted(57, 30) Source(66, 51) + SourceIndex(0) +10>Emitted(57, 32) Source(66, 53) + SourceIndex(0) +11>Emitted(57, 39) Source(66, 60) + SourceIndex(0) +12>Emitted(57, 41) Source(66, 62) + SourceIndex(0) +13>Emitted(57, 47) Source(66, 68) + SourceIndex(0) +14>Emitted(57, 49) Source(66, 70) + SourceIndex(0) +15>Emitted(57, 51) Source(66, 72) + SourceIndex(0) +16>Emitted(57, 58) Source(66, 79) + SourceIndex(0) +17>Emitted(57, 60) Source(66, 81) + SourceIndex(0) +18>Emitted(57, 68) Source(66, 89) + SourceIndex(0) +19>Emitted(57, 70) Source(66, 91) + SourceIndex(0) +20>Emitted(57, 79) Source(66, 100) + SourceIndex(0) +21>Emitted(57, 81) Source(66, 102) + SourceIndex(0) +22>Emitted(57, 87) Source(66, 108) + SourceIndex(0) +23>Emitted(57, 89) Source(66, 110) + SourceIndex(0) +24>Emitted(57, 91) Source(66, 112) + SourceIndex(0) +--- +>>> { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]; _y < _z.length; _y++) { +1->^^^^ +2 > ^^ +3 > ^^^^ +4 > ^^ +5 > ^^^^^^^^^ +6 > ^^ +7 > ^^^^^^ +8 > ^^ +9 > ^^ +10> ^^^^^^^ +11> ^^ +12> ^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^ +15> ^^ +16> ^^^^^^^^ +17> ^^ +18> ^^ +19> ^ +20> ^^ +21> ^^^^^^^^^^^^^^ +22> ^^ +23> ^^^^ +24> ^ +1->, + > +2 > { +3 > name +4 > : +5 > "trimmer" +6 > , +7 > skills +8 > : +9 > { +10> primary +11> : +12> "trimming" +13> , +14> secondary +15> : +16> "edging" +17> } +18> } +19> ] +20> +21> [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] +22> +23> [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] +24> ) +1->Emitted(58, 5) Source(67, 5) + SourceIndex(0) +2 >Emitted(58, 7) Source(67, 7) + SourceIndex(0) +3 >Emitted(58, 11) Source(67, 11) + SourceIndex(0) +4 >Emitted(58, 13) Source(67, 13) + SourceIndex(0) +5 >Emitted(58, 22) Source(67, 22) + SourceIndex(0) +6 >Emitted(58, 24) Source(67, 24) + SourceIndex(0) +7 >Emitted(58, 30) Source(67, 30) + SourceIndex(0) +8 >Emitted(58, 32) Source(67, 32) + SourceIndex(0) +9 >Emitted(58, 34) Source(67, 34) + SourceIndex(0) +10>Emitted(58, 41) Source(67, 41) + SourceIndex(0) +11>Emitted(58, 43) Source(67, 43) + SourceIndex(0) +12>Emitted(58, 53) Source(67, 53) + SourceIndex(0) +13>Emitted(58, 55) Source(67, 55) + SourceIndex(0) +14>Emitted(58, 64) Source(67, 64) + SourceIndex(0) +15>Emitted(58, 66) Source(67, 66) + SourceIndex(0) +16>Emitted(58, 74) Source(67, 74) + SourceIndex(0) +17>Emitted(58, 76) Source(67, 76) + SourceIndex(0) +18>Emitted(58, 78) Source(67, 78) + SourceIndex(0) +19>Emitted(58, 79) Source(67, 79) + SourceIndex(0) +20>Emitted(58, 81) Source(66, 44) + SourceIndex(0) +21>Emitted(58, 95) Source(67, 79) + SourceIndex(0) +22>Emitted(58, 97) Source(66, 44) + SourceIndex(0) +23>Emitted(58, 101) Source(67, 79) + SourceIndex(0) +24>Emitted(58, 102) Source(67, 80) + SourceIndex(0) +--- +>>> _0 = _z[_y].skills, primary = _0.primary, secondary = _0.secondary; +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 > skills: { primary, secondary } +3 > +4 > primary +5 > , +6 > secondary +1 >Emitted(59, 5) Source(66, 8) + SourceIndex(0) +2 >Emitted(59, 23) Source(66, 38) + SourceIndex(0) +3 >Emitted(59, 25) Source(66, 18) + SourceIndex(0) +4 >Emitted(59, 45) Source(66, 25) + SourceIndex(0) +5 >Emitted(59, 47) Source(66, 27) + SourceIndex(0) +6 >Emitted(59, 71) Source(66, 36) + SourceIndex(0) +--- +>>> console.log(primaryA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1 > } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { + > +2 > console +3 > . +4 > log +5 > ( +6 > primaryA +7 > ) +8 > ; +1 >Emitted(60, 5) Source(68, 5) + SourceIndex(0) +2 >Emitted(60, 12) Source(68, 12) + SourceIndex(0) +3 >Emitted(60, 13) Source(68, 13) + SourceIndex(0) +4 >Emitted(60, 16) Source(68, 16) + SourceIndex(0) +5 >Emitted(60, 17) Source(68, 17) + SourceIndex(0) +6 >Emitted(60, 25) Source(68, 25) + SourceIndex(0) +7 >Emitted(60, 26) Source(68, 26) + SourceIndex(0) +8 >Emitted(60, 27) Source(68, 27) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(61, 2) Source(69, 2) + SourceIndex(0) +--- +>>>for (var _1 = 0, robots_3 = robots; _1 < robots_3.length; _1++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^^^^^^ +10> ^^ +11> ^^^^ +12> ^ +1-> + > + > + > +2 >for +3 > +4 > ({name: nameA, skill: skillA } of +5 > robots +6 > +7 > robots +8 > +9 > robots +10> +11> robots +12> ) +1->Emitted(62, 1) Source(72, 1) + SourceIndex(0) +2 >Emitted(62, 4) Source(72, 4) + SourceIndex(0) +3 >Emitted(62, 5) Source(72, 5) + SourceIndex(0) +4 >Emitted(62, 6) Source(72, 39) + SourceIndex(0) +5 >Emitted(62, 16) Source(72, 45) + SourceIndex(0) +6 >Emitted(62, 18) Source(72, 39) + SourceIndex(0) +7 >Emitted(62, 35) Source(72, 45) + SourceIndex(0) +8 >Emitted(62, 37) Source(72, 39) + SourceIndex(0) +9 >Emitted(62, 57) Source(72, 45) + SourceIndex(0) +10>Emitted(62, 59) Source(72, 39) + SourceIndex(0) +11>Emitted(62, 63) Source(72, 45) + SourceIndex(0) +12>Emitted(62, 64) Source(72, 46) + SourceIndex(0) +--- +>>> _2 = robots_3[_1], nameA = _2.name, skillA = _2.skill; +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^ +1 > +2 > {name: nameA, skill: skillA } +3 > +4 > name: nameA +5 > , +6 > skill: skillA +1 >Emitted(63, 5) Source(72, 6) + SourceIndex(0) +2 >Emitted(63, 22) Source(72, 35) + SourceIndex(0) +3 >Emitted(63, 24) Source(72, 7) + SourceIndex(0) +4 >Emitted(63, 39) Source(72, 18) + SourceIndex(0) +5 >Emitted(63, 41) Source(72, 20) + SourceIndex(0) +6 >Emitted(63, 58) Source(72, 33) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > } of robots) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(64, 5) Source(73, 5) + SourceIndex(0) +2 >Emitted(64, 12) Source(73, 12) + SourceIndex(0) +3 >Emitted(64, 13) Source(73, 13) + SourceIndex(0) +4 >Emitted(64, 16) Source(73, 16) + SourceIndex(0) +5 >Emitted(64, 17) Source(73, 17) + SourceIndex(0) +6 >Emitted(64, 22) Source(73, 22) + SourceIndex(0) +7 >Emitted(64, 23) Source(73, 23) + SourceIndex(0) +8 >Emitted(64, 24) Source(73, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(65, 2) Source(74, 2) + SourceIndex(0) +--- +>>>for (var _3 = 0, _4 = getRobots(); _3 < _4.length; _3++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^ +8 > ^^^^^^^^^ +9 > ^^ +10> ^^ +11> ^^^^^^^^^^^^^^ +12> ^^ +13> ^^^^ +14> ^ +1-> + > +2 >for +3 > +4 > ({name: nameA, skill: skillA } of +5 > getRobots() +6 > +7 > +8 > getRobots +9 > () +10> +11> getRobots() +12> +13> getRobots() +14> ) +1->Emitted(66, 1) Source(75, 1) + SourceIndex(0) +2 >Emitted(66, 4) Source(75, 4) + SourceIndex(0) +3 >Emitted(66, 5) Source(75, 5) + SourceIndex(0) +4 >Emitted(66, 6) Source(75, 39) + SourceIndex(0) +5 >Emitted(66, 16) Source(75, 50) + SourceIndex(0) +6 >Emitted(66, 18) Source(75, 39) + SourceIndex(0) +7 >Emitted(66, 23) Source(75, 39) + SourceIndex(0) +8 >Emitted(66, 32) Source(75, 48) + SourceIndex(0) +9 >Emitted(66, 34) Source(75, 50) + SourceIndex(0) +10>Emitted(66, 36) Source(75, 39) + SourceIndex(0) +11>Emitted(66, 50) Source(75, 50) + SourceIndex(0) +12>Emitted(66, 52) Source(75, 39) + SourceIndex(0) +13>Emitted(66, 56) Source(75, 50) + SourceIndex(0) +14>Emitted(66, 57) Source(75, 51) + SourceIndex(0) +--- +>>> _5 = _4[_3], nameA = _5.name, skillA = _5.skill; +1 >^^^^ +2 > ^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^ +1 > +2 > {name: nameA, skill: skillA } +3 > +4 > name: nameA +5 > , +6 > skill: skillA +1 >Emitted(67, 5) Source(75, 6) + SourceIndex(0) +2 >Emitted(67, 16) Source(75, 35) + SourceIndex(0) +3 >Emitted(67, 18) Source(75, 7) + SourceIndex(0) +4 >Emitted(67, 33) Source(75, 18) + SourceIndex(0) +5 >Emitted(67, 35) Source(75, 20) + SourceIndex(0) +6 >Emitted(67, 52) Source(75, 33) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > } of getRobots()) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(68, 5) Source(76, 5) + SourceIndex(0) +2 >Emitted(68, 12) Source(76, 12) + SourceIndex(0) +3 >Emitted(68, 13) Source(76, 13) + SourceIndex(0) +4 >Emitted(68, 16) Source(76, 16) + SourceIndex(0) +5 >Emitted(68, 17) Source(76, 17) + SourceIndex(0) +6 >Emitted(68, 22) Source(76, 22) + SourceIndex(0) +7 >Emitted(68, 23) Source(76, 23) + SourceIndex(0) +8 >Emitted(68, 24) Source(76, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(69, 2) Source(77, 2) + SourceIndex(0) +--- +>>>for (var _6 = 0, _7 = [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]; _6 < _7.length; _6++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^ +8 > ^^ +9 > ^^^^ +10> ^^ +11> ^^^^^^^ +12> ^^ +13> ^^^^^ +14> ^^ +15> ^^^^^^^^ +16> ^^ +17> ^^ +18> ^^ +19> ^^^^ +20> ^^ +21> ^^^^^^^^^ +22> ^^ +23> ^^^^^ +24> ^^ +25> ^^^^^^^^^^ +26> ^^ +27> ^ +28> ^^ +29> ^^^^^^^^^^^^^^ +30> ^^ +31> ^^^^ +32> ^ +1-> + > +2 >for +3 > +4 > ({name: nameA, skill: skillA } of +5 > [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }] +6 > +7 > [ +8 > { +9 > name +10> : +11> "mower" +12> , +13> skill +14> : +15> "mowing" +16> } +17> , +18> { +19> name +20> : +21> "trimmer" +22> , +23> skill +24> : +25> "trimming" +26> } +27> ] +28> +29> [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }] +30> +31> [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }] +32> ) +1->Emitted(70, 1) Source(78, 1) + SourceIndex(0) +2 >Emitted(70, 4) Source(78, 4) + SourceIndex(0) +3 >Emitted(70, 5) Source(78, 5) + SourceIndex(0) +4 >Emitted(70, 6) Source(78, 39) + SourceIndex(0) +5 >Emitted(70, 16) Source(78, 115) + SourceIndex(0) +6 >Emitted(70, 18) Source(78, 39) + SourceIndex(0) +7 >Emitted(70, 24) Source(78, 40) + SourceIndex(0) +8 >Emitted(70, 26) Source(78, 42) + SourceIndex(0) +9 >Emitted(70, 30) Source(78, 46) + SourceIndex(0) +10>Emitted(70, 32) Source(78, 48) + SourceIndex(0) +11>Emitted(70, 39) Source(78, 55) + SourceIndex(0) +12>Emitted(70, 41) Source(78, 57) + SourceIndex(0) +13>Emitted(70, 46) Source(78, 62) + SourceIndex(0) +14>Emitted(70, 48) Source(78, 64) + SourceIndex(0) +15>Emitted(70, 56) Source(78, 72) + SourceIndex(0) +16>Emitted(70, 58) Source(78, 74) + SourceIndex(0) +17>Emitted(70, 60) Source(78, 76) + SourceIndex(0) +18>Emitted(70, 62) Source(78, 78) + SourceIndex(0) +19>Emitted(70, 66) Source(78, 82) + SourceIndex(0) +20>Emitted(70, 68) Source(78, 84) + SourceIndex(0) +21>Emitted(70, 77) Source(78, 93) + SourceIndex(0) +22>Emitted(70, 79) Source(78, 95) + SourceIndex(0) +23>Emitted(70, 84) Source(78, 100) + SourceIndex(0) +24>Emitted(70, 86) Source(78, 102) + SourceIndex(0) +25>Emitted(70, 96) Source(78, 112) + SourceIndex(0) +26>Emitted(70, 98) Source(78, 114) + SourceIndex(0) +27>Emitted(70, 99) Source(78, 115) + SourceIndex(0) +28>Emitted(70, 101) Source(78, 39) + SourceIndex(0) +29>Emitted(70, 115) Source(78, 115) + SourceIndex(0) +30>Emitted(70, 117) Source(78, 39) + SourceIndex(0) +31>Emitted(70, 121) Source(78, 115) + SourceIndex(0) +32>Emitted(70, 122) Source(78, 116) + SourceIndex(0) +--- +>>> _8 = _7[_6], nameA = _8.name, skillA = _8.skill; +1 >^^^^ +2 > ^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^ +1 > +2 > {name: nameA, skill: skillA } +3 > +4 > name: nameA +5 > , +6 > skill: skillA +1 >Emitted(71, 5) Source(78, 6) + SourceIndex(0) +2 >Emitted(71, 16) Source(78, 35) + SourceIndex(0) +3 >Emitted(71, 18) Source(78, 7) + SourceIndex(0) +4 >Emitted(71, 33) Source(78, 18) + SourceIndex(0) +5 >Emitted(71, 35) Source(78, 20) + SourceIndex(0) +6 >Emitted(71, 52) Source(78, 33) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(72, 5) Source(79, 5) + SourceIndex(0) +2 >Emitted(72, 12) Source(79, 12) + SourceIndex(0) +3 >Emitted(72, 13) Source(79, 13) + SourceIndex(0) +4 >Emitted(72, 16) Source(79, 16) + SourceIndex(0) +5 >Emitted(72, 17) Source(79, 17) + SourceIndex(0) +6 >Emitted(72, 22) Source(79, 22) + SourceIndex(0) +7 >Emitted(72, 23) Source(79, 23) + SourceIndex(0) +8 >Emitted(72, 24) Source(79, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(73, 2) Source(80, 2) + SourceIndex(0) +--- +>>>for (var _9 = 0, multiRobots_3 = multiRobots; _9 < multiRobots_3.length; _9++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^^^^^^^^^^^ +10> ^^ +11> ^^^^ +12> ^ +13> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > ({name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of +5 > multiRobots +6 > +7 > multiRobots +8 > +9 > multiRobots +10> +11> multiRobots +12> ) +1->Emitted(74, 1) Source(81, 1) + SourceIndex(0) +2 >Emitted(74, 4) Source(81, 4) + SourceIndex(0) +3 >Emitted(74, 5) Source(81, 5) + SourceIndex(0) +4 >Emitted(74, 6) Source(81, 78) + SourceIndex(0) +5 >Emitted(74, 16) Source(81, 89) + SourceIndex(0) +6 >Emitted(74, 18) Source(81, 78) + SourceIndex(0) +7 >Emitted(74, 45) Source(81, 89) + SourceIndex(0) +8 >Emitted(74, 47) Source(81, 78) + SourceIndex(0) +9 >Emitted(74, 72) Source(81, 89) + SourceIndex(0) +10>Emitted(74, 74) Source(81, 78) + SourceIndex(0) +11>Emitted(74, 78) Source(81, 89) + SourceIndex(0) +12>Emitted(74, 79) Source(81, 90) + SourceIndex(0) +--- +>>> _10 = multiRobots_3[_9], nameA = _10.name, _11 = _10.skills, primaryA = _11.primary, secondaryA = _11.secondary; +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } +3 > +4 > name: nameA +5 > , +6 > skills: { primary: primaryA, secondary: secondaryA } +7 > +8 > primary: primaryA +9 > , +10> secondary: secondaryA +1->Emitted(75, 5) Source(81, 6) + SourceIndex(0) +2 >Emitted(75, 28) Source(81, 74) + SourceIndex(0) +3 >Emitted(75, 30) Source(81, 7) + SourceIndex(0) +4 >Emitted(75, 46) Source(81, 18) + SourceIndex(0) +5 >Emitted(75, 48) Source(81, 20) + SourceIndex(0) +6 >Emitted(75, 64) Source(81, 72) + SourceIndex(0) +7 >Emitted(75, 66) Source(81, 30) + SourceIndex(0) +8 >Emitted(75, 88) Source(81, 47) + SourceIndex(0) +9 >Emitted(75, 90) Source(81, 49) + SourceIndex(0) +10>Emitted(75, 116) Source(81, 70) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > } } of multiRobots) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(76, 5) Source(82, 5) + SourceIndex(0) +2 >Emitted(76, 12) Source(82, 12) + SourceIndex(0) +3 >Emitted(76, 13) Source(82, 13) + SourceIndex(0) +4 >Emitted(76, 16) Source(82, 16) + SourceIndex(0) +5 >Emitted(76, 17) Source(82, 17) + SourceIndex(0) +6 >Emitted(76, 22) Source(82, 22) + SourceIndex(0) +7 >Emitted(76, 23) Source(82, 23) + SourceIndex(0) +8 >Emitted(76, 24) Source(82, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(77, 2) Source(83, 2) + SourceIndex(0) +--- +>>>for (var _12 = 0, _13 = getMultiRobots(); _12 < _13.length; _12++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^ +8 > ^^^^^^^^^^^^^^ +9 > ^^ +10> ^^ +11> ^^^^^^^^^^^^^^^^ +12> ^^ +13> ^^^^^ +14> ^ +15> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > ({name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of +5 > getMultiRobots() +6 > +7 > +8 > getMultiRobots +9 > () +10> +11> getMultiRobots() +12> +13> getMultiRobots() +14> ) +1->Emitted(78, 1) Source(84, 1) + SourceIndex(0) +2 >Emitted(78, 4) Source(84, 4) + SourceIndex(0) +3 >Emitted(78, 5) Source(84, 5) + SourceIndex(0) +4 >Emitted(78, 6) Source(84, 78) + SourceIndex(0) +5 >Emitted(78, 17) Source(84, 94) + SourceIndex(0) +6 >Emitted(78, 19) Source(84, 78) + SourceIndex(0) +7 >Emitted(78, 25) Source(84, 78) + SourceIndex(0) +8 >Emitted(78, 39) Source(84, 92) + SourceIndex(0) +9 >Emitted(78, 41) Source(84, 94) + SourceIndex(0) +10>Emitted(78, 43) Source(84, 78) + SourceIndex(0) +11>Emitted(78, 59) Source(84, 94) + SourceIndex(0) +12>Emitted(78, 61) Source(84, 78) + SourceIndex(0) +13>Emitted(78, 66) Source(84, 94) + SourceIndex(0) +14>Emitted(78, 67) Source(84, 95) + SourceIndex(0) +--- +>>> _14 = _13[_12], nameA = _14.name, _15 = _14.skills, primaryA = _15.primary, secondaryA = _15.secondary; +1->^^^^ +2 > ^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } +3 > +4 > name: nameA +5 > , +6 > skills: { primary: primaryA, secondary: secondaryA } +7 > +8 > primary: primaryA +9 > , +10> secondary: secondaryA +1->Emitted(79, 5) Source(84, 6) + SourceIndex(0) +2 >Emitted(79, 19) Source(84, 74) + SourceIndex(0) +3 >Emitted(79, 21) Source(84, 7) + SourceIndex(0) +4 >Emitted(79, 37) Source(84, 18) + SourceIndex(0) +5 >Emitted(79, 39) Source(84, 20) + SourceIndex(0) +6 >Emitted(79, 55) Source(84, 72) + SourceIndex(0) +7 >Emitted(79, 57) Source(84, 30) + SourceIndex(0) +8 >Emitted(79, 79) Source(84, 47) + SourceIndex(0) +9 >Emitted(79, 81) Source(84, 49) + SourceIndex(0) +10>Emitted(79, 107) Source(84, 70) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > } } of getMultiRobots()) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(80, 5) Source(85, 5) + SourceIndex(0) +2 >Emitted(80, 12) Source(85, 12) + SourceIndex(0) +3 >Emitted(80, 13) Source(85, 13) + SourceIndex(0) +4 >Emitted(80, 16) Source(85, 16) + SourceIndex(0) +5 >Emitted(80, 17) Source(85, 17) + SourceIndex(0) +6 >Emitted(80, 22) Source(85, 22) + SourceIndex(0) +7 >Emitted(80, 23) Source(85, 23) + SourceIndex(0) +8 >Emitted(80, 24) Source(85, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(81, 2) Source(86, 2) + SourceIndex(0) +--- +>>>for (var _16 = 0, _17 = [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^ +8 > ^^ +9 > ^^^^ +10> ^^ +11> ^^^^^^^ +12> ^^ +13> ^^^^^^ +14> ^^ +15> ^^ +16> ^^^^^^^ +17> ^^ +18> ^^^^^^^^ +19> ^^ +20> ^^^^^^^^^ +21> ^^ +22> ^^^^^^ +23> ^^ +24> ^^ +25> ^^^^^^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > ({name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of +5 > [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] +6 > +7 > [ +8 > { +9 > name +10> : +11> "mower" +12> , +13> skills +14> : +15> { +16> primary +17> : +18> "mowing" +19> , +20> secondary +21> : +22> "none" +23> } +24> } +1->Emitted(82, 1) Source(87, 1) + SourceIndex(0) +2 >Emitted(82, 4) Source(87, 4) + SourceIndex(0) +3 >Emitted(82, 5) Source(87, 5) + SourceIndex(0) +4 >Emitted(82, 6) Source(87, 78) + SourceIndex(0) +5 >Emitted(82, 17) Source(88, 79) + SourceIndex(0) +6 >Emitted(82, 19) Source(87, 78) + SourceIndex(0) +7 >Emitted(82, 26) Source(87, 79) + SourceIndex(0) +8 >Emitted(82, 28) Source(87, 81) + SourceIndex(0) +9 >Emitted(82, 32) Source(87, 85) + SourceIndex(0) +10>Emitted(82, 34) Source(87, 87) + SourceIndex(0) +11>Emitted(82, 41) Source(87, 94) + SourceIndex(0) +12>Emitted(82, 43) Source(87, 96) + SourceIndex(0) +13>Emitted(82, 49) Source(87, 102) + SourceIndex(0) +14>Emitted(82, 51) Source(87, 104) + SourceIndex(0) +15>Emitted(82, 53) Source(87, 106) + SourceIndex(0) +16>Emitted(82, 60) Source(87, 113) + SourceIndex(0) +17>Emitted(82, 62) Source(87, 115) + SourceIndex(0) +18>Emitted(82, 70) Source(87, 123) + SourceIndex(0) +19>Emitted(82, 72) Source(87, 125) + SourceIndex(0) +20>Emitted(82, 81) Source(87, 134) + SourceIndex(0) +21>Emitted(82, 83) Source(87, 136) + SourceIndex(0) +22>Emitted(82, 89) Source(87, 142) + SourceIndex(0) +23>Emitted(82, 91) Source(87, 144) + SourceIndex(0) +24>Emitted(82, 93) Source(87, 146) + SourceIndex(0) +--- +>>> { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]; _16 < _17.length; _16++) { +1->^^^^ +2 > ^^ +3 > ^^^^ +4 > ^^ +5 > ^^^^^^^^^ +6 > ^^ +7 > ^^^^^^ +8 > ^^ +9 > ^^ +10> ^^^^^^^ +11> ^^ +12> ^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^ +15> ^^ +16> ^^^^^^^^ +17> ^^ +18> ^^ +19> ^ +20> ^^ +21> ^^^^^^^^^^^^^^^^ +22> ^^ +23> ^^^^^ +24> ^ +25> ^^^^-> +1->, + > +2 > { +3 > name +4 > : +5 > "trimmer" +6 > , +7 > skills +8 > : +9 > { +10> primary +11> : +12> "trimming" +13> , +14> secondary +15> : +16> "edging" +17> } +18> } +19> ] +20> +21> [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] +22> +23> [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] +24> ) +1->Emitted(83, 5) Source(88, 5) + SourceIndex(0) +2 >Emitted(83, 7) Source(88, 7) + SourceIndex(0) +3 >Emitted(83, 11) Source(88, 11) + SourceIndex(0) +4 >Emitted(83, 13) Source(88, 13) + SourceIndex(0) +5 >Emitted(83, 22) Source(88, 22) + SourceIndex(0) +6 >Emitted(83, 24) Source(88, 24) + SourceIndex(0) +7 >Emitted(83, 30) Source(88, 30) + SourceIndex(0) +8 >Emitted(83, 32) Source(88, 32) + SourceIndex(0) +9 >Emitted(83, 34) Source(88, 34) + SourceIndex(0) +10>Emitted(83, 41) Source(88, 41) + SourceIndex(0) +11>Emitted(83, 43) Source(88, 43) + SourceIndex(0) +12>Emitted(83, 53) Source(88, 53) + SourceIndex(0) +13>Emitted(83, 55) Source(88, 55) + SourceIndex(0) +14>Emitted(83, 64) Source(88, 64) + SourceIndex(0) +15>Emitted(83, 66) Source(88, 66) + SourceIndex(0) +16>Emitted(83, 74) Source(88, 74) + SourceIndex(0) +17>Emitted(83, 76) Source(88, 76) + SourceIndex(0) +18>Emitted(83, 78) Source(88, 78) + SourceIndex(0) +19>Emitted(83, 79) Source(88, 79) + SourceIndex(0) +20>Emitted(83, 81) Source(87, 78) + SourceIndex(0) +21>Emitted(83, 97) Source(88, 79) + SourceIndex(0) +22>Emitted(83, 99) Source(87, 78) + SourceIndex(0) +23>Emitted(83, 104) Source(88, 79) + SourceIndex(0) +24>Emitted(83, 105) Source(88, 80) + SourceIndex(0) +--- +>>> _18 = _17[_16], nameA = _18.name, _19 = _18.skills, primaryA = _19.primary, secondaryA = _19.secondary; +1->^^^^ +2 > ^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } +3 > +4 > name: nameA +5 > , +6 > skills: { primary: primaryA, secondary: secondaryA } +7 > +8 > primary: primaryA +9 > , +10> secondary: secondaryA +1->Emitted(84, 5) Source(87, 6) + SourceIndex(0) +2 >Emitted(84, 19) Source(87, 74) + SourceIndex(0) +3 >Emitted(84, 21) Source(87, 7) + SourceIndex(0) +4 >Emitted(84, 37) Source(87, 18) + SourceIndex(0) +5 >Emitted(84, 39) Source(87, 20) + SourceIndex(0) +6 >Emitted(84, 55) Source(87, 72) + SourceIndex(0) +7 >Emitted(84, 57) Source(87, 30) + SourceIndex(0) +8 >Emitted(84, 79) Source(87, 47) + SourceIndex(0) +9 >Emitted(84, 81) Source(87, 49) + SourceIndex(0) +10>Emitted(84, 107) Source(87, 70) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(85, 5) Source(89, 5) + SourceIndex(0) +2 >Emitted(85, 12) Source(89, 12) + SourceIndex(0) +3 >Emitted(85, 13) Source(89, 13) + SourceIndex(0) +4 >Emitted(85, 16) Source(89, 16) + SourceIndex(0) +5 >Emitted(85, 17) Source(89, 17) + SourceIndex(0) +6 >Emitted(85, 22) Source(89, 22) + SourceIndex(0) +7 >Emitted(85, 23) Source(89, 23) + SourceIndex(0) +8 >Emitted(85, 24) Source(89, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(86, 2) Source(90, 2) + SourceIndex(0) +--- +>>>for (var _20 = 0, robots_4 = robots; _20 < robots_4.length; _20++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^^^^^^^ +10> ^^ +11> ^^^^^ +12> ^ +1-> + > +2 >for +3 > +4 > ({name, skill } of +5 > robots +6 > +7 > robots +8 > +9 > robots +10> +11> robots +12> ) +1->Emitted(87, 1) Source(91, 1) + SourceIndex(0) +2 >Emitted(87, 4) Source(91, 4) + SourceIndex(0) +3 >Emitted(87, 5) Source(91, 5) + SourceIndex(0) +4 >Emitted(87, 6) Source(91, 24) + SourceIndex(0) +5 >Emitted(87, 17) Source(91, 30) + SourceIndex(0) +6 >Emitted(87, 19) Source(91, 24) + SourceIndex(0) +7 >Emitted(87, 36) Source(91, 30) + SourceIndex(0) +8 >Emitted(87, 38) Source(91, 24) + SourceIndex(0) +9 >Emitted(87, 59) Source(91, 30) + SourceIndex(0) +10>Emitted(87, 61) Source(91, 24) + SourceIndex(0) +11>Emitted(87, 66) Source(91, 30) + SourceIndex(0) +12>Emitted(87, 67) Source(91, 31) + SourceIndex(0) +--- +>>> _21 = robots_4[_20], name = _21.name, skill = _21.skill; +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^ +1 > +2 > {name, skill } +3 > +4 > name +5 > , +6 > skill +1 >Emitted(88, 5) Source(91, 6) + SourceIndex(0) +2 >Emitted(88, 24) Source(91, 20) + SourceIndex(0) +3 >Emitted(88, 26) Source(91, 7) + SourceIndex(0) +4 >Emitted(88, 41) Source(91, 11) + SourceIndex(0) +5 >Emitted(88, 43) Source(91, 13) + SourceIndex(0) +6 >Emitted(88, 60) Source(91, 18) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > } of robots) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(89, 5) Source(92, 5) + SourceIndex(0) +2 >Emitted(89, 12) Source(92, 12) + SourceIndex(0) +3 >Emitted(89, 13) Source(92, 13) + SourceIndex(0) +4 >Emitted(89, 16) Source(92, 16) + SourceIndex(0) +5 >Emitted(89, 17) Source(92, 17) + SourceIndex(0) +6 >Emitted(89, 22) Source(92, 22) + SourceIndex(0) +7 >Emitted(89, 23) Source(92, 23) + SourceIndex(0) +8 >Emitted(89, 24) Source(92, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(90, 2) Source(93, 2) + SourceIndex(0) +--- +>>>for (var _22 = 0, _23 = getRobots(); _22 < _23.length; _22++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^ +8 > ^^^^^^^^^ +9 > ^^ +10> ^^ +11> ^^^^^^^^^^^^^^^^ +12> ^^ +13> ^^^^^ +14> ^ +1-> + > +2 >for +3 > +4 > ({name, skill } of +5 > getRobots() +6 > +7 > +8 > getRobots +9 > () +10> +11> getRobots() +12> +13> getRobots() +14> ) +1->Emitted(91, 1) Source(94, 1) + SourceIndex(0) +2 >Emitted(91, 4) Source(94, 4) + SourceIndex(0) +3 >Emitted(91, 5) Source(94, 5) + SourceIndex(0) +4 >Emitted(91, 6) Source(94, 24) + SourceIndex(0) +5 >Emitted(91, 17) Source(94, 35) + SourceIndex(0) +6 >Emitted(91, 19) Source(94, 24) + SourceIndex(0) +7 >Emitted(91, 25) Source(94, 24) + SourceIndex(0) +8 >Emitted(91, 34) Source(94, 33) + SourceIndex(0) +9 >Emitted(91, 36) Source(94, 35) + SourceIndex(0) +10>Emitted(91, 38) Source(94, 24) + SourceIndex(0) +11>Emitted(91, 54) Source(94, 35) + SourceIndex(0) +12>Emitted(91, 56) Source(94, 24) + SourceIndex(0) +13>Emitted(91, 61) Source(94, 35) + SourceIndex(0) +14>Emitted(91, 62) Source(94, 36) + SourceIndex(0) +--- +>>> _24 = _23[_22], name = _24.name, skill = _24.skill; +1 >^^^^ +2 > ^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^ +1 > +2 > {name, skill } +3 > +4 > name +5 > , +6 > skill +1 >Emitted(92, 5) Source(94, 6) + SourceIndex(0) +2 >Emitted(92, 19) Source(94, 20) + SourceIndex(0) +3 >Emitted(92, 21) Source(94, 7) + SourceIndex(0) +4 >Emitted(92, 36) Source(94, 11) + SourceIndex(0) +5 >Emitted(92, 38) Source(94, 13) + SourceIndex(0) +6 >Emitted(92, 55) Source(94, 18) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > } of getRobots()) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(93, 5) Source(95, 5) + SourceIndex(0) +2 >Emitted(93, 12) Source(95, 12) + SourceIndex(0) +3 >Emitted(93, 13) Source(95, 13) + SourceIndex(0) +4 >Emitted(93, 16) Source(95, 16) + SourceIndex(0) +5 >Emitted(93, 17) Source(95, 17) + SourceIndex(0) +6 >Emitted(93, 22) Source(95, 22) + SourceIndex(0) +7 >Emitted(93, 23) Source(95, 23) + SourceIndex(0) +8 >Emitted(93, 24) Source(95, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(94, 2) Source(96, 2) + SourceIndex(0) +--- +>>>for (var _25 = 0, _26 = [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]; _25 < _26.length; _25++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^ +8 > ^^ +9 > ^^^^ +10> ^^ +11> ^^^^^^^ +12> ^^ +13> ^^^^^ +14> ^^ +15> ^^^^^^^^ +16> ^^ +17> ^^ +18> ^^ +19> ^^^^ +20> ^^ +21> ^^^^^^^^^ +22> ^^ +23> ^^^^^ +24> ^^ +25> ^^^^^^^^^^ +26> ^^ +27> ^ +28> ^^ +29> ^^^^^^^^^^^^^^^^ +30> ^^ +31> ^^^^^ +32> ^ +1-> + > +2 >for +3 > +4 > ({name, skill } of +5 > [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }] +6 > +7 > [ +8 > { +9 > name +10> : +11> "mower" +12> , +13> skill +14> : +15> "mowing" +16> } +17> , +18> { +19> name +20> : +21> "trimmer" +22> , +23> skill +24> : +25> "trimming" +26> } +27> ] +28> +29> [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }] +30> +31> [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }] +32> ) +1->Emitted(95, 1) Source(97, 1) + SourceIndex(0) +2 >Emitted(95, 4) Source(97, 4) + SourceIndex(0) +3 >Emitted(95, 5) Source(97, 5) + SourceIndex(0) +4 >Emitted(95, 6) Source(97, 24) + SourceIndex(0) +5 >Emitted(95, 17) Source(97, 100) + SourceIndex(0) +6 >Emitted(95, 19) Source(97, 24) + SourceIndex(0) +7 >Emitted(95, 26) Source(97, 25) + SourceIndex(0) +8 >Emitted(95, 28) Source(97, 27) + SourceIndex(0) +9 >Emitted(95, 32) Source(97, 31) + SourceIndex(0) +10>Emitted(95, 34) Source(97, 33) + SourceIndex(0) +11>Emitted(95, 41) Source(97, 40) + SourceIndex(0) +12>Emitted(95, 43) Source(97, 42) + SourceIndex(0) +13>Emitted(95, 48) Source(97, 47) + SourceIndex(0) +14>Emitted(95, 50) Source(97, 49) + SourceIndex(0) +15>Emitted(95, 58) Source(97, 57) + SourceIndex(0) +16>Emitted(95, 60) Source(97, 59) + SourceIndex(0) +17>Emitted(95, 62) Source(97, 61) + SourceIndex(0) +18>Emitted(95, 64) Source(97, 63) + SourceIndex(0) +19>Emitted(95, 68) Source(97, 67) + SourceIndex(0) +20>Emitted(95, 70) Source(97, 69) + SourceIndex(0) +21>Emitted(95, 79) Source(97, 78) + SourceIndex(0) +22>Emitted(95, 81) Source(97, 80) + SourceIndex(0) +23>Emitted(95, 86) Source(97, 85) + SourceIndex(0) +24>Emitted(95, 88) Source(97, 87) + SourceIndex(0) +25>Emitted(95, 98) Source(97, 97) + SourceIndex(0) +26>Emitted(95, 100) Source(97, 99) + SourceIndex(0) +27>Emitted(95, 101) Source(97, 100) + SourceIndex(0) +28>Emitted(95, 103) Source(97, 24) + SourceIndex(0) +29>Emitted(95, 119) Source(97, 100) + SourceIndex(0) +30>Emitted(95, 121) Source(97, 24) + SourceIndex(0) +31>Emitted(95, 126) Source(97, 100) + SourceIndex(0) +32>Emitted(95, 127) Source(97, 101) + SourceIndex(0) +--- +>>> _27 = _26[_25], name = _27.name, skill = _27.skill; +1 >^^^^ +2 > ^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^ +1 > +2 > {name, skill } +3 > +4 > name +5 > , +6 > skill +1 >Emitted(96, 5) Source(97, 6) + SourceIndex(0) +2 >Emitted(96, 19) Source(97, 20) + SourceIndex(0) +3 >Emitted(96, 21) Source(97, 7) + SourceIndex(0) +4 >Emitted(96, 36) Source(97, 11) + SourceIndex(0) +5 >Emitted(96, 38) Source(97, 13) + SourceIndex(0) +6 >Emitted(96, 55) Source(97, 18) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(97, 5) Source(98, 5) + SourceIndex(0) +2 >Emitted(97, 12) Source(98, 12) + SourceIndex(0) +3 >Emitted(97, 13) Source(98, 13) + SourceIndex(0) +4 >Emitted(97, 16) Source(98, 16) + SourceIndex(0) +5 >Emitted(97, 17) Source(98, 17) + SourceIndex(0) +6 >Emitted(97, 22) Source(98, 22) + SourceIndex(0) +7 >Emitted(97, 23) Source(98, 23) + SourceIndex(0) +8 >Emitted(97, 24) Source(98, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(98, 2) Source(99, 2) + SourceIndex(0) +--- +>>>for (var _28 = 0, multiRobots_4 = multiRobots; _28 < multiRobots_4.length; _28++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^^^^^^^^^^^^ +10> ^^ +11> ^^^^^ +12> ^ +13> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > ({name, skills: { primary, secondary } } of +5 > multiRobots +6 > +7 > multiRobots +8 > +9 > multiRobots +10> +11> multiRobots +12> ) +1->Emitted(99, 1) Source(100, 1) + SourceIndex(0) +2 >Emitted(99, 4) Source(100, 4) + SourceIndex(0) +3 >Emitted(99, 5) Source(100, 5) + SourceIndex(0) +4 >Emitted(99, 6) Source(100, 49) + SourceIndex(0) +5 >Emitted(99, 17) Source(100, 60) + SourceIndex(0) +6 >Emitted(99, 19) Source(100, 49) + SourceIndex(0) +7 >Emitted(99, 46) Source(100, 60) + SourceIndex(0) +8 >Emitted(99, 48) Source(100, 49) + SourceIndex(0) +9 >Emitted(99, 74) Source(100, 60) + SourceIndex(0) +10>Emitted(99, 76) Source(100, 49) + SourceIndex(0) +11>Emitted(99, 81) Source(100, 60) + SourceIndex(0) +12>Emitted(99, 82) Source(100, 61) + SourceIndex(0) +--- +>>> _29 = multiRobots_4[_28], name = _29.name, _30 = _29.skills, primary = _30.primary, secondary = _30.secondary; +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > {name, skills: { primary, secondary } } +3 > +4 > name +5 > , +6 > skills: { primary, secondary } +7 > +8 > primary +9 > , +10> secondary +1->Emitted(100, 5) Source(100, 6) + SourceIndex(0) +2 >Emitted(100, 29) Source(100, 45) + SourceIndex(0) +3 >Emitted(100, 31) Source(100, 7) + SourceIndex(0) +4 >Emitted(100, 46) Source(100, 11) + SourceIndex(0) +5 >Emitted(100, 48) Source(100, 13) + SourceIndex(0) +6 >Emitted(100, 64) Source(100, 43) + SourceIndex(0) +7 >Emitted(100, 66) Source(100, 23) + SourceIndex(0) +8 >Emitted(100, 87) Source(100, 30) + SourceIndex(0) +9 >Emitted(100, 89) Source(100, 32) + SourceIndex(0) +10>Emitted(100, 114) Source(100, 41) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > } } of multiRobots) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(101, 5) Source(101, 5) + SourceIndex(0) +2 >Emitted(101, 12) Source(101, 12) + SourceIndex(0) +3 >Emitted(101, 13) Source(101, 13) + SourceIndex(0) +4 >Emitted(101, 16) Source(101, 16) + SourceIndex(0) +5 >Emitted(101, 17) Source(101, 17) + SourceIndex(0) +6 >Emitted(101, 22) Source(101, 22) + SourceIndex(0) +7 >Emitted(101, 23) Source(101, 23) + SourceIndex(0) +8 >Emitted(101, 24) Source(101, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(102, 2) Source(102, 2) + SourceIndex(0) +--- +>>>for (var _31 = 0, _32 = getMultiRobots(); _31 < _32.length; _31++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^ +8 > ^^^^^^^^^^^^^^ +9 > ^^ +10> ^^ +11> ^^^^^^^^^^^^^^^^ +12> ^^ +13> ^^^^^ +14> ^ +15> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > ({name, skills: { primary, secondary } } of +5 > getMultiRobots() +6 > +7 > +8 > getMultiRobots +9 > () +10> +11> getMultiRobots() +12> +13> getMultiRobots() +14> ) +1->Emitted(103, 1) Source(103, 1) + SourceIndex(0) +2 >Emitted(103, 4) Source(103, 4) + SourceIndex(0) +3 >Emitted(103, 5) Source(103, 5) + SourceIndex(0) +4 >Emitted(103, 6) Source(103, 49) + SourceIndex(0) +5 >Emitted(103, 17) Source(103, 65) + SourceIndex(0) +6 >Emitted(103, 19) Source(103, 49) + SourceIndex(0) +7 >Emitted(103, 25) Source(103, 49) + SourceIndex(0) +8 >Emitted(103, 39) Source(103, 63) + SourceIndex(0) +9 >Emitted(103, 41) Source(103, 65) + SourceIndex(0) +10>Emitted(103, 43) Source(103, 49) + SourceIndex(0) +11>Emitted(103, 59) Source(103, 65) + SourceIndex(0) +12>Emitted(103, 61) Source(103, 49) + SourceIndex(0) +13>Emitted(103, 66) Source(103, 65) + SourceIndex(0) +14>Emitted(103, 67) Source(103, 66) + SourceIndex(0) +--- +>>> _33 = _32[_31], name = _33.name, _34 = _33.skills, primary = _34.primary, secondary = _34.secondary; +1->^^^^ +2 > ^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > {name, skills: { primary, secondary } } +3 > +4 > name +5 > , +6 > skills: { primary, secondary } +7 > +8 > primary +9 > , +10> secondary +1->Emitted(104, 5) Source(103, 6) + SourceIndex(0) +2 >Emitted(104, 19) Source(103, 45) + SourceIndex(0) +3 >Emitted(104, 21) Source(103, 7) + SourceIndex(0) +4 >Emitted(104, 36) Source(103, 11) + SourceIndex(0) +5 >Emitted(104, 38) Source(103, 13) + SourceIndex(0) +6 >Emitted(104, 54) Source(103, 43) + SourceIndex(0) +7 >Emitted(104, 56) Source(103, 23) + SourceIndex(0) +8 >Emitted(104, 77) Source(103, 30) + SourceIndex(0) +9 >Emitted(104, 79) Source(103, 32) + SourceIndex(0) +10>Emitted(104, 104) Source(103, 41) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > } } of getMultiRobots()) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(105, 5) Source(104, 5) + SourceIndex(0) +2 >Emitted(105, 12) Source(104, 12) + SourceIndex(0) +3 >Emitted(105, 13) Source(104, 13) + SourceIndex(0) +4 >Emitted(105, 16) Source(104, 16) + SourceIndex(0) +5 >Emitted(105, 17) Source(104, 17) + SourceIndex(0) +6 >Emitted(105, 22) Source(104, 22) + SourceIndex(0) +7 >Emitted(105, 23) Source(104, 23) + SourceIndex(0) +8 >Emitted(105, 24) Source(104, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(106, 2) Source(105, 2) + SourceIndex(0) +--- +>>>for (var _35 = 0, _36 = [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^ +8 > ^^ +9 > ^^^^ +10> ^^ +11> ^^^^^^^ +12> ^^ +13> ^^^^^^ +14> ^^ +15> ^^ +16> ^^^^^^^ +17> ^^ +18> ^^^^^^^^ +19> ^^ +20> ^^^^^^^^^ +21> ^^ +22> ^^^^^^ +23> ^^ +24> ^^ +25> ^^^^^^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > ({name, skills: { primary, secondary } } of +5 > [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] +6 > +7 > [ +8 > { +9 > name +10> : +11> "mower" +12> , +13> skills +14> : +15> { +16> primary +17> : +18> "mowing" +19> , +20> secondary +21> : +22> "none" +23> } +24> } +1->Emitted(107, 1) Source(106, 1) + SourceIndex(0) +2 >Emitted(107, 4) Source(106, 4) + SourceIndex(0) +3 >Emitted(107, 5) Source(106, 5) + SourceIndex(0) +4 >Emitted(107, 6) Source(106, 49) + SourceIndex(0) +5 >Emitted(107, 17) Source(107, 79) + SourceIndex(0) +6 >Emitted(107, 19) Source(106, 49) + SourceIndex(0) +7 >Emitted(107, 26) Source(106, 50) + SourceIndex(0) +8 >Emitted(107, 28) Source(106, 52) + SourceIndex(0) +9 >Emitted(107, 32) Source(106, 56) + SourceIndex(0) +10>Emitted(107, 34) Source(106, 58) + SourceIndex(0) +11>Emitted(107, 41) Source(106, 65) + SourceIndex(0) +12>Emitted(107, 43) Source(106, 67) + SourceIndex(0) +13>Emitted(107, 49) Source(106, 73) + SourceIndex(0) +14>Emitted(107, 51) Source(106, 75) + SourceIndex(0) +15>Emitted(107, 53) Source(106, 77) + SourceIndex(0) +16>Emitted(107, 60) Source(106, 84) + SourceIndex(0) +17>Emitted(107, 62) Source(106, 86) + SourceIndex(0) +18>Emitted(107, 70) Source(106, 94) + SourceIndex(0) +19>Emitted(107, 72) Source(106, 96) + SourceIndex(0) +20>Emitted(107, 81) Source(106, 105) + SourceIndex(0) +21>Emitted(107, 83) Source(106, 107) + SourceIndex(0) +22>Emitted(107, 89) Source(106, 113) + SourceIndex(0) +23>Emitted(107, 91) Source(106, 115) + SourceIndex(0) +24>Emitted(107, 93) Source(106, 117) + SourceIndex(0) +--- +>>> { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]; _35 < _36.length; _35++) { +1->^^^^ +2 > ^^ +3 > ^^^^ +4 > ^^ +5 > ^^^^^^^^^ +6 > ^^ +7 > ^^^^^^ +8 > ^^ +9 > ^^ +10> ^^^^^^^ +11> ^^ +12> ^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^ +15> ^^ +16> ^^^^^^^^ +17> ^^ +18> ^^ +19> ^ +20> ^^ +21> ^^^^^^^^^^^^^^^^ +22> ^^ +23> ^^^^^ +24> ^ +25> ^-> +1->, + > +2 > { +3 > name +4 > : +5 > "trimmer" +6 > , +7 > skills +8 > : +9 > { +10> primary +11> : +12> "trimming" +13> , +14> secondary +15> : +16> "edging" +17> } +18> } +19> ] +20> +21> [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] +22> +23> [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] +24> ) +1->Emitted(108, 5) Source(107, 5) + SourceIndex(0) +2 >Emitted(108, 7) Source(107, 7) + SourceIndex(0) +3 >Emitted(108, 11) Source(107, 11) + SourceIndex(0) +4 >Emitted(108, 13) Source(107, 13) + SourceIndex(0) +5 >Emitted(108, 22) Source(107, 22) + SourceIndex(0) +6 >Emitted(108, 24) Source(107, 24) + SourceIndex(0) +7 >Emitted(108, 30) Source(107, 30) + SourceIndex(0) +8 >Emitted(108, 32) Source(107, 32) + SourceIndex(0) +9 >Emitted(108, 34) Source(107, 34) + SourceIndex(0) +10>Emitted(108, 41) Source(107, 41) + SourceIndex(0) +11>Emitted(108, 43) Source(107, 43) + SourceIndex(0) +12>Emitted(108, 53) Source(107, 53) + SourceIndex(0) +13>Emitted(108, 55) Source(107, 55) + SourceIndex(0) +14>Emitted(108, 64) Source(107, 64) + SourceIndex(0) +15>Emitted(108, 66) Source(107, 66) + SourceIndex(0) +16>Emitted(108, 74) Source(107, 74) + SourceIndex(0) +17>Emitted(108, 76) Source(107, 76) + SourceIndex(0) +18>Emitted(108, 78) Source(107, 78) + SourceIndex(0) +19>Emitted(108, 79) Source(107, 79) + SourceIndex(0) +20>Emitted(108, 81) Source(106, 49) + SourceIndex(0) +21>Emitted(108, 97) Source(107, 79) + SourceIndex(0) +22>Emitted(108, 99) Source(106, 49) + SourceIndex(0) +23>Emitted(108, 104) Source(107, 79) + SourceIndex(0) +24>Emitted(108, 105) Source(107, 80) + SourceIndex(0) +--- +>>> _37 = _36[_35], name = _37.name, _38 = _37.skills, primary = _38.primary, secondary = _38.secondary; +1->^^^^ +2 > ^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > {name, skills: { primary, secondary } } +3 > +4 > name +5 > , +6 > skills: { primary, secondary } +7 > +8 > primary +9 > , +10> secondary +1->Emitted(109, 5) Source(106, 6) + SourceIndex(0) +2 >Emitted(109, 19) Source(106, 45) + SourceIndex(0) +3 >Emitted(109, 21) Source(106, 7) + SourceIndex(0) +4 >Emitted(109, 36) Source(106, 11) + SourceIndex(0) +5 >Emitted(109, 38) Source(106, 13) + SourceIndex(0) +6 >Emitted(109, 54) Source(106, 43) + SourceIndex(0) +7 >Emitted(109, 56) Source(106, 23) + SourceIndex(0) +8 >Emitted(109, 77) Source(106, 30) + SourceIndex(0) +9 >Emitted(109, 79) Source(106, 32) + SourceIndex(0) +10>Emitted(109, 104) Source(106, 41) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(110, 5) Source(108, 5) + SourceIndex(0) +2 >Emitted(110, 12) Source(108, 12) + SourceIndex(0) +3 >Emitted(110, 13) Source(108, 13) + SourceIndex(0) +4 >Emitted(110, 16) Source(108, 16) + SourceIndex(0) +5 >Emitted(110, 17) Source(108, 17) + SourceIndex(0) +6 >Emitted(110, 22) Source(108, 22) + SourceIndex(0) +7 >Emitted(110, 23) Source(108, 23) + SourceIndex(0) +8 >Emitted(110, 24) Source(108, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(111, 2) Source(109, 2) + SourceIndex(0) +--- +>>>var _f, _j, _m, _u, _x, _0, _2, _5, _8, _10, _11, _14, _15, _18, _19, _21, _24, _27, _29, _30, _33, _34, _37, _38; +>>>//# sourceMappingURL=sourceMapValidationDestructuringForOfObjectBindingPattern2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPattern2.symbols b/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPattern2.symbols new file mode 100644 index 00000000000..532791cca68 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPattern2.symbols @@ -0,0 +1,435 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringForOfObjectBindingPattern2.ts === +declare var console: { +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 0, 11)) + + log(msg: any): void; +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 0, 22)) +>msg : Symbol(msg, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 1, 8)) +} +interface Robot { +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 2, 1)) + + name: string; +>name : Symbol(Robot.name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 3, 17)) + + skill: string; +>skill : Symbol(Robot.skill, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 4, 17)) +} + +interface MultiRobot { +>MultiRobot : Symbol(MultiRobot, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 6, 1)) + + name: string; +>name : Symbol(MultiRobot.name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 8, 22)) + + skills: { +>skills : Symbol(MultiRobot.skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 9, 17)) + + primary: string; +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 10, 13)) + + secondary: string; +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 11, 24)) + + }; +} + +let robots: Robot[] = [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]; +>robots : Symbol(robots, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 16, 3)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 2, 1)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 16, 24)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 16, 39)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 16, 60)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 16, 77)) + +let multiRobots: MultiRobot[] = [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, +>multiRobots : Symbol(multiRobots, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 17, 3)) +>MultiRobot : Symbol(MultiRobot, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 6, 1)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 17, 34)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 17, 49)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 17, 59)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 17, 78)) + + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]; +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 18, 5)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 18, 22)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 18, 32)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 18, 53)) + +function getRobots() { +>getRobots : Symbol(getRobots, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 18, 79)) + + return robots; +>robots : Symbol(robots, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 16, 3)) +} + +function getMultiRobots() { +>getMultiRobots : Symbol(getMultiRobots, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 22, 1)) + + return multiRobots; +>multiRobots : Symbol(multiRobots, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 17, 3)) +} + +let nameA: string, primaryA: string, secondaryA: string, i: number, skillA: string; +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 28, 3)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 28, 18)) +>secondaryA : Symbol(secondaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 28, 36)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 28, 56)) +>skillA : Symbol(skillA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 28, 67)) + +let name: string, primary: string, secondary: string, skill: string; +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 29, 3)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 29, 17)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 29, 34)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 29, 53)) + +for ({name: nameA } of robots) { +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 31, 6)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 28, 3)) +>robots : Symbol(robots, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 16, 3)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 28, 3)) +} +for ({name: nameA } of getRobots()) { +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 34, 6)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 28, 3)) +>getRobots : Symbol(getRobots, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 18, 79)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 28, 3)) +} +for ({name: nameA } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 37, 6)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 28, 3)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 37, 25)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 37, 40)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 37, 61)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 37, 78)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 28, 3)) +} +for ({ skills: { primary: primaryA, secondary: secondaryA } } of multiRobots) { +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 40, 6)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 40, 16)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 28, 18)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 40, 35)) +>secondaryA : Symbol(secondaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 28, 36)) +>multiRobots : Symbol(multiRobots, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 17, 3)) + + console.log(primaryA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 0, 22)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 28, 18)) +} +for ({ skills: { primary: primaryA, secondary: secondaryA } } of getMultiRobots()) { +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 43, 6)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 43, 16)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 28, 18)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 43, 35)) +>secondaryA : Symbol(secondaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 28, 36)) +>getMultiRobots : Symbol(getMultiRobots, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 22, 1)) + + console.log(primaryA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 0, 22)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 28, 18)) +} +for ({ skills: { primary: primaryA, secondary: secondaryA } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 46, 6)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 46, 16)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 28, 18)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 46, 35)) +>secondaryA : Symbol(secondaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 28, 36)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 46, 67)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 46, 82)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 46, 92)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 46, 111)) + + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 47, 5)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 47, 22)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 47, 32)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 47, 53)) + + console.log(primaryA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 0, 22)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 28, 18)) +} +for ({name } of robots) { +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 50, 6)) +>robots : Symbol(robots, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 16, 3)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 28, 3)) +} +for ({name } of getRobots()) { +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 53, 6)) +>getRobots : Symbol(getRobots, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 18, 79)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 28, 3)) +} +for ({name } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 56, 6)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 56, 18)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 56, 33)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 56, 54)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 56, 71)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 28, 3)) +} +for ({ skills: { primary, secondary } } of multiRobots) { +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 59, 6)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 59, 16)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 59, 25)) +>multiRobots : Symbol(multiRobots, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 17, 3)) + + console.log(primaryA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 0, 22)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 28, 18)) +} +for ({ skills: { primary, secondary } } of getMultiRobots()) { +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 62, 6)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 62, 16)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 62, 25)) +>getMultiRobots : Symbol(getMultiRobots, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 22, 1)) + + console.log(primaryA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 0, 22)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 28, 18)) +} +for ({ skills: { primary, secondary } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 65, 6)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 65, 16)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 65, 25)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 65, 45)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 65, 60)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 65, 70)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 65, 89)) + + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 66, 5)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 66, 22)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 66, 32)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 66, 53)) + + console.log(primaryA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 0, 22)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 28, 18)) +} + + +for ({name: nameA, skill: skillA } of robots) { +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 71, 6)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 28, 3)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 71, 18)) +>skillA : Symbol(skillA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 28, 67)) +>robots : Symbol(robots, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 16, 3)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 28, 3)) +} +for ({name: nameA, skill: skillA } of getRobots()) { +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 74, 6)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 28, 3)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 74, 18)) +>skillA : Symbol(skillA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 28, 67)) +>getRobots : Symbol(getRobots, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 18, 79)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 28, 3)) +} +for ({name: nameA, skill: skillA } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 77, 6)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 28, 3)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 77, 18)) +>skillA : Symbol(skillA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 28, 67)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 77, 40)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 77, 55)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 77, 76)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 77, 93)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 28, 3)) +} +for ({name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of multiRobots) { +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 80, 6)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 28, 3)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 80, 18)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 80, 28)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 28, 18)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 80, 47)) +>secondaryA : Symbol(secondaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 28, 36)) +>multiRobots : Symbol(multiRobots, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 17, 3)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 28, 3)) +} +for ({name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of getMultiRobots()) { +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 83, 6)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 28, 3)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 83, 18)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 83, 28)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 28, 18)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 83, 47)) +>secondaryA : Symbol(secondaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 28, 36)) +>getMultiRobots : Symbol(getMultiRobots, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 22, 1)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 28, 3)) +} +for ({name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 86, 6)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 28, 3)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 86, 18)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 86, 28)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 28, 18)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 86, 47)) +>secondaryA : Symbol(secondaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 28, 36)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 86, 79)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 86, 94)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 86, 104)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 86, 123)) + + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 87, 5)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 87, 22)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 87, 32)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 87, 53)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 28, 3)) +} +for ({name, skill } of robots) { +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 90, 6)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 90, 11)) +>robots : Symbol(robots, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 16, 3)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 28, 3)) +} +for ({name, skill } of getRobots()) { +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 93, 6)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 93, 11)) +>getRobots : Symbol(getRobots, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 18, 79)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 28, 3)) +} +for ({name, skill } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 96, 6)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 96, 11)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 96, 25)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 96, 40)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 96, 61)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 96, 78)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 28, 3)) +} +for ({name, skills: { primary, secondary } } of multiRobots) { +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 99, 6)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 99, 11)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 99, 21)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 99, 30)) +>multiRobots : Symbol(multiRobots, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 17, 3)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 28, 3)) +} +for ({name, skills: { primary, secondary } } of getMultiRobots()) { +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 102, 6)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 102, 11)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 102, 21)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 102, 30)) +>getMultiRobots : Symbol(getMultiRobots, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 22, 1)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 28, 3)) +} +for ({name, skills: { primary, secondary } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 105, 6)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 105, 11)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 105, 21)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 105, 30)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 105, 50)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 105, 65)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 105, 75)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 105, 94)) + + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 106, 5)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 106, 22)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 106, 32)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 106, 53)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern2.ts, 28, 3)) +} diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPattern2.types b/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPattern2.types new file mode 100644 index 00000000000..1f292542545 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPattern2.types @@ -0,0 +1,593 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringForOfObjectBindingPattern2.ts === +declare var console: { +>console : { log(msg: any): void; } + + log(msg: any): void; +>log : (msg: any) => void +>msg : any +} +interface Robot { +>Robot : Robot + + name: string; +>name : string + + skill: string; +>skill : string +} + +interface MultiRobot { +>MultiRobot : MultiRobot + + name: string; +>name : string + + skills: { +>skills : { primary: string; secondary: string; } + + primary: string; +>primary : string + + secondary: string; +>secondary : string + + }; +} + +let robots: Robot[] = [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]; +>robots : Robot[] +>Robot : Robot +>[{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }] : { name: string; skill: string; }[] +>{ name: "mower", skill: "mowing" } : { name: string; skill: string; } +>name : string +>"mower" : string +>skill : string +>"mowing" : string +>{ name: "trimmer", skill: "trimming" } : { name: string; skill: string; } +>name : string +>"trimmer" : string +>skill : string +>"trimming" : string + +let multiRobots: MultiRobot[] = [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, +>multiRobots : MultiRobot[] +>MultiRobot : MultiRobot +>[{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] : { name: string; skills: { primary: string; secondary: string; }; }[] +>{ name: "mower", skills: { primary: "mowing", secondary: "none" } } : { name: string; skills: { primary: string; secondary: string; }; } +>name : string +>"mower" : string +>skills : { primary: string; secondary: string; } +>{ primary: "mowing", secondary: "none" } : { primary: string; secondary: string; } +>primary : string +>"mowing" : string +>secondary : string +>"none" : string + + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]; +>{ name: "trimmer", skills: { primary: "trimming", secondary: "edging" } } : { name: string; skills: { primary: string; secondary: string; }; } +>name : string +>"trimmer" : string +>skills : { primary: string; secondary: string; } +>{ primary: "trimming", secondary: "edging" } : { primary: string; secondary: string; } +>primary : string +>"trimming" : string +>secondary : string +>"edging" : string + +function getRobots() { +>getRobots : () => Robot[] + + return robots; +>robots : Robot[] +} + +function getMultiRobots() { +>getMultiRobots : () => MultiRobot[] + + return multiRobots; +>multiRobots : MultiRobot[] +} + +let nameA: string, primaryA: string, secondaryA: string, i: number, skillA: string; +>nameA : string +>primaryA : string +>secondaryA : string +>i : number +>skillA : string + +let name: string, primary: string, secondary: string, skill: string; +>name : string +>primary : string +>secondary : string +>skill : string + +for ({name: nameA } of robots) { +>{name: nameA } : { name: string; } +>name : Robot +>nameA : string +>robots : Robot[] + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for ({name: nameA } of getRobots()) { +>{name: nameA } : { name: string; } +>name : Robot +>nameA : string +>getRobots() : Robot[] +>getRobots : () => Robot[] + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for ({name: nameA } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { +>{name: nameA } : { name: string; } +>name : { name: string; skill: string; } +>nameA : string +>[{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }] : { name: string; skill: string; }[] +>{ name: "mower", skill: "mowing" } : { name: string; skill: string; } +>name : string +>"mower" : string +>skill : string +>"mowing" : string +>{ name: "trimmer", skill: "trimming" } : { name: string; skill: string; } +>name : string +>"trimmer" : string +>skill : string +>"trimming" : string + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for ({ skills: { primary: primaryA, secondary: secondaryA } } of multiRobots) { +>{ skills: { primary: primaryA, secondary: secondaryA } } : { skills: { primary: string; secondary: string; }; } +>skills : MultiRobot +>{ primary: primaryA, secondary: secondaryA } : { primary: string; secondary: string; } +>primary : string +>primaryA : string +>secondary : string +>secondaryA : string +>multiRobots : MultiRobot[] + + console.log(primaryA); +>console.log(primaryA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primaryA : string +} +for ({ skills: { primary: primaryA, secondary: secondaryA } } of getMultiRobots()) { +>{ skills: { primary: primaryA, secondary: secondaryA } } : { skills: { primary: string; secondary: string; }; } +>skills : MultiRobot +>{ primary: primaryA, secondary: secondaryA } : { primary: string; secondary: string; } +>primary : string +>primaryA : string +>secondary : string +>secondaryA : string +>getMultiRobots() : MultiRobot[] +>getMultiRobots : () => MultiRobot[] + + console.log(primaryA); +>console.log(primaryA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primaryA : string +} +for ({ skills: { primary: primaryA, secondary: secondaryA } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, +>{ skills: { primary: primaryA, secondary: secondaryA } } : { skills: { primary: string; secondary: string; }; } +>skills : { name: string; skills: { primary: string; secondary: string; }; } +>{ primary: primaryA, secondary: secondaryA } : { primary: string; secondary: string; } +>primary : string +>primaryA : string +>secondary : string +>secondaryA : string +>[{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] : { name: string; skills: { primary: string; secondary: string; }; }[] +>{ name: "mower", skills: { primary: "mowing", secondary: "none" } } : { name: string; skills: { primary: string; secondary: string; }; } +>name : string +>"mower" : string +>skills : { primary: string; secondary: string; } +>{ primary: "mowing", secondary: "none" } : { primary: string; secondary: string; } +>primary : string +>"mowing" : string +>secondary : string +>"none" : string + + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { +>{ name: "trimmer", skills: { primary: "trimming", secondary: "edging" } } : { name: string; skills: { primary: string; secondary: string; }; } +>name : string +>"trimmer" : string +>skills : { primary: string; secondary: string; } +>{ primary: "trimming", secondary: "edging" } : { primary: string; secondary: string; } +>primary : string +>"trimming" : string +>secondary : string +>"edging" : string + + console.log(primaryA); +>console.log(primaryA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primaryA : string +} +for ({name } of robots) { +>{name } : { name: string; } +>name : Robot +>robots : Robot[] + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for ({name } of getRobots()) { +>{name } : { name: string; } +>name : Robot +>getRobots() : Robot[] +>getRobots : () => Robot[] + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for ({name } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { +>{name } : { name: string; } +>name : { name: string; skill: string; } +>[{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }] : { name: string; skill: string; }[] +>{ name: "mower", skill: "mowing" } : { name: string; skill: string; } +>name : string +>"mower" : string +>skill : string +>"mowing" : string +>{ name: "trimmer", skill: "trimming" } : { name: string; skill: string; } +>name : string +>"trimmer" : string +>skill : string +>"trimming" : string + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for ({ skills: { primary, secondary } } of multiRobots) { +>{ skills: { primary, secondary } } : { skills: { primary: string; secondary: string; }; } +>skills : MultiRobot +>{ primary, secondary } : { primary: string; secondary: string; } +>primary : string +>secondary : string +>multiRobots : MultiRobot[] + + console.log(primaryA); +>console.log(primaryA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primaryA : string +} +for ({ skills: { primary, secondary } } of getMultiRobots()) { +>{ skills: { primary, secondary } } : { skills: { primary: string; secondary: string; }; } +>skills : MultiRobot +>{ primary, secondary } : { primary: string; secondary: string; } +>primary : string +>secondary : string +>getMultiRobots() : MultiRobot[] +>getMultiRobots : () => MultiRobot[] + + console.log(primaryA); +>console.log(primaryA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primaryA : string +} +for ({ skills: { primary, secondary } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, +>{ skills: { primary, secondary } } : { skills: { primary: string; secondary: string; }; } +>skills : { name: string; skills: { primary: string; secondary: string; }; } +>{ primary, secondary } : { primary: string; secondary: string; } +>primary : string +>secondary : string +>[{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] : { name: string; skills: { primary: string; secondary: string; }; }[] +>{ name: "mower", skills: { primary: "mowing", secondary: "none" } } : { name: string; skills: { primary: string; secondary: string; }; } +>name : string +>"mower" : string +>skills : { primary: string; secondary: string; } +>{ primary: "mowing", secondary: "none" } : { primary: string; secondary: string; } +>primary : string +>"mowing" : string +>secondary : string +>"none" : string + + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { +>{ name: "trimmer", skills: { primary: "trimming", secondary: "edging" } } : { name: string; skills: { primary: string; secondary: string; }; } +>name : string +>"trimmer" : string +>skills : { primary: string; secondary: string; } +>{ primary: "trimming", secondary: "edging" } : { primary: string; secondary: string; } +>primary : string +>"trimming" : string +>secondary : string +>"edging" : string + + console.log(primaryA); +>console.log(primaryA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primaryA : string +} + + +for ({name: nameA, skill: skillA } of robots) { +>{name: nameA, skill: skillA } : { name: string; skill: string; } +>name : Robot +>nameA : string +>skill : Robot +>skillA : string +>robots : Robot[] + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for ({name: nameA, skill: skillA } of getRobots()) { +>{name: nameA, skill: skillA } : { name: string; skill: string; } +>name : Robot +>nameA : string +>skill : Robot +>skillA : string +>getRobots() : Robot[] +>getRobots : () => Robot[] + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for ({name: nameA, skill: skillA } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { +>{name: nameA, skill: skillA } : { name: string; skill: string; } +>name : { name: string; skill: string; } +>nameA : string +>skill : { name: string; skill: string; } +>skillA : string +>[{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }] : { name: string; skill: string; }[] +>{ name: "mower", skill: "mowing" } : { name: string; skill: string; } +>name : string +>"mower" : string +>skill : string +>"mowing" : string +>{ name: "trimmer", skill: "trimming" } : { name: string; skill: string; } +>name : string +>"trimmer" : string +>skill : string +>"trimming" : string + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for ({name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of multiRobots) { +>{name: nameA, skills: { primary: primaryA, secondary: secondaryA } } : { name: string; skills: { primary: string; secondary: string; }; } +>name : MultiRobot +>nameA : string +>skills : MultiRobot +>{ primary: primaryA, secondary: secondaryA } : { primary: string; secondary: string; } +>primary : string +>primaryA : string +>secondary : string +>secondaryA : string +>multiRobots : MultiRobot[] + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for ({name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of getMultiRobots()) { +>{name: nameA, skills: { primary: primaryA, secondary: secondaryA } } : { name: string; skills: { primary: string; secondary: string; }; } +>name : MultiRobot +>nameA : string +>skills : MultiRobot +>{ primary: primaryA, secondary: secondaryA } : { primary: string; secondary: string; } +>primary : string +>primaryA : string +>secondary : string +>secondaryA : string +>getMultiRobots() : MultiRobot[] +>getMultiRobots : () => MultiRobot[] + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for ({name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, +>{name: nameA, skills: { primary: primaryA, secondary: secondaryA } } : { name: string; skills: { primary: string; secondary: string; }; } +>name : { name: string; skills: { primary: string; secondary: string; }; } +>nameA : string +>skills : { name: string; skills: { primary: string; secondary: string; }; } +>{ primary: primaryA, secondary: secondaryA } : { primary: string; secondary: string; } +>primary : string +>primaryA : string +>secondary : string +>secondaryA : string +>[{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] : { name: string; skills: { primary: string; secondary: string; }; }[] +>{ name: "mower", skills: { primary: "mowing", secondary: "none" } } : { name: string; skills: { primary: string; secondary: string; }; } +>name : string +>"mower" : string +>skills : { primary: string; secondary: string; } +>{ primary: "mowing", secondary: "none" } : { primary: string; secondary: string; } +>primary : string +>"mowing" : string +>secondary : string +>"none" : string + + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { +>{ name: "trimmer", skills: { primary: "trimming", secondary: "edging" } } : { name: string; skills: { primary: string; secondary: string; }; } +>name : string +>"trimmer" : string +>skills : { primary: string; secondary: string; } +>{ primary: "trimming", secondary: "edging" } : { primary: string; secondary: string; } +>primary : string +>"trimming" : string +>secondary : string +>"edging" : string + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for ({name, skill } of robots) { +>{name, skill } : { name: string; skill: string; } +>name : Robot +>skill : Robot +>robots : Robot[] + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for ({name, skill } of getRobots()) { +>{name, skill } : { name: string; skill: string; } +>name : Robot +>skill : Robot +>getRobots() : Robot[] +>getRobots : () => Robot[] + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for ({name, skill } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { +>{name, skill } : { name: string; skill: string; } +>name : { name: string; skill: string; } +>skill : { name: string; skill: string; } +>[{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }] : { name: string; skill: string; }[] +>{ name: "mower", skill: "mowing" } : { name: string; skill: string; } +>name : string +>"mower" : string +>skill : string +>"mowing" : string +>{ name: "trimmer", skill: "trimming" } : { name: string; skill: string; } +>name : string +>"trimmer" : string +>skill : string +>"trimming" : string + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for ({name, skills: { primary, secondary } } of multiRobots) { +>{name, skills: { primary, secondary } } : { name: string; skills: { primary: string; secondary: string; }; } +>name : MultiRobot +>skills : MultiRobot +>{ primary, secondary } : { primary: string; secondary: string; } +>primary : string +>secondary : string +>multiRobots : MultiRobot[] + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for ({name, skills: { primary, secondary } } of getMultiRobots()) { +>{name, skills: { primary, secondary } } : { name: string; skills: { primary: string; secondary: string; }; } +>name : MultiRobot +>skills : MultiRobot +>{ primary, secondary } : { primary: string; secondary: string; } +>primary : string +>secondary : string +>getMultiRobots() : MultiRobot[] +>getMultiRobots : () => MultiRobot[] + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for ({name, skills: { primary, secondary } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, +>{name, skills: { primary, secondary } } : { name: string; skills: { primary: string; secondary: string; }; } +>name : { name: string; skills: { primary: string; secondary: string; }; } +>skills : { name: string; skills: { primary: string; secondary: string; }; } +>{ primary, secondary } : { primary: string; secondary: string; } +>primary : string +>secondary : string +>[{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] : { name: string; skills: { primary: string; secondary: string; }; }[] +>{ name: "mower", skills: { primary: "mowing", secondary: "none" } } : { name: string; skills: { primary: string; secondary: string; }; } +>name : string +>"mower" : string +>skills : { primary: string; secondary: string; } +>{ primary: "mowing", secondary: "none" } : { primary: string; secondary: string; } +>primary : string +>"mowing" : string +>secondary : string +>"none" : string + + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { +>{ name: "trimmer", skills: { primary: "trimming", secondary: "edging" } } : { name: string; skills: { primary: string; secondary: string; }; } +>name : string +>"trimmer" : string +>skills : { primary: string; secondary: string; } +>{ primary: "trimming", secondary: "edging" } : { primary: string; secondary: string; } +>primary : string +>"trimming" : string +>secondary : string +>"edging" : string + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.js b/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.js new file mode 100644 index 00000000000..08cf3cf5466 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.js @@ -0,0 +1,152 @@ +//// [sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts] +declare var console: { + log(msg: any): void; +} +interface Robot { + name: string; + skill: string; +} + +interface MultiRobot { + name: string; + skills: { + primary?: string; + secondary?: string; + }; +} + +let robots: Robot[] = [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]; +let multiRobots: MultiRobot[] = [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]; + +function getRobots() { + return robots; +} + +function getMultiRobots() { + return multiRobots; +} + +for (let {name: nameA = "noName" } of robots) { + console.log(nameA); +} +for (let {name: nameA = "noName" } of getRobots()) { + console.log(nameA); +} +for (let {name: nameA = "noName" } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { + console.log(nameA); +} +for (let { skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = + { primary: "nosKill", secondary: "noSkill" } } of multiRobots) { + console.log(primaryA); +} +for (let { skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = + { primary: "nosKill", secondary: "noSkill" } } of getMultiRobots()) { + console.log(primaryA); +} +for (let { skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = + { primary: "nosKill", secondary: "noSkill" } } of + [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { + console.log(primaryA); +} + +for (let {name: nameA = "noName", skill: skillA = "noSkill" } of robots) { + console.log(nameA); +} +for (let {name: nameA = "noName", skill: skillA = "noSkill" } of getRobots()) { + console.log(nameA); +} +for (let {name: nameA = "noName", skill: skillA = "noSkill" } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { + console.log(nameA); +} +for (let { + name: nameA = "noName", + skills: { + primary: primaryA = "primary", + secondary: secondaryA = "secondary" + } = { primary: "noSkill", secondary: "noSkill" } +} of multiRobots) { + console.log(nameA); +} +for (let { + name: nameA = "noName", + skills: { + primary: primaryA = "primary", + secondary: secondaryA = "secondary" + } = { primary: "noSkill", secondary: "noSkill" } +} of getMultiRobots()) { + console.log(nameA); +} +for (let { + name: nameA = "noName", + skills: { + primary: primaryA = "primary", + secondary: secondaryA = "secondary" + } = { primary: "noSkill", secondary: "noSkill" } +} of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { + console.log(nameA); +} + +//// [sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.js] +var robots = [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]; +var multiRobots = [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]; +function getRobots() { + return robots; +} +function getMultiRobots() { + return multiRobots; +} +for (var _i = 0, robots_1 = robots; _i < robots_1.length; _i++) { + var _a = robots_1[_i].name, nameA = _a === void 0 ? "noName" : _a; + console.log(nameA); +} +for (var _b = 0, _c = getRobots(); _b < _c.length; _b++) { + var _d = _c[_b].name, nameA = _d === void 0 ? "noName" : _d; + console.log(nameA); +} +for (var _e = 0, _f = [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]; _e < _f.length; _e++) { + var _g = _f[_e].name, nameA = _g === void 0 ? "noName" : _g; + console.log(nameA); +} +for (var _h = 0, multiRobots_1 = multiRobots; _h < multiRobots_1.length; _h++) { + var _j = multiRobots_1[_h].skills, _k = _j === void 0 ? { primary: "nosKill", secondary: "noSkill" } : _j, _l = _k.primary, primaryA = _l === void 0 ? "primary" : _l, _m = _k.secondary, secondaryA = _m === void 0 ? "secondary" : _m; + console.log(primaryA); +} +for (var _o = 0, _p = getMultiRobots(); _o < _p.length; _o++) { + var _q = _p[_o].skills, _r = _q === void 0 ? { primary: "nosKill", secondary: "noSkill" } : _q, _s = _r.primary, primaryA = _s === void 0 ? "primary" : _s, _t = _r.secondary, secondaryA = _t === void 0 ? "secondary" : _t; + console.log(primaryA); +} +for (var _u = 0, _v = [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]; _u < _v.length; _u++) { + var _w = _v[_u].skills, _x = _w === void 0 ? { primary: "nosKill", secondary: "noSkill" } : _w, _y = _x.primary, primaryA = _y === void 0 ? "primary" : _y, _z = _x.secondary, secondaryA = _z === void 0 ? "secondary" : _z; + console.log(primaryA); +} +for (var _0 = 0, robots_2 = robots; _0 < robots_2.length; _0++) { + var _1 = robots_2[_0], _2 = _1.name, nameA = _2 === void 0 ? "noName" : _2, _3 = _1.skill, skillA = _3 === void 0 ? "noSkill" : _3; + console.log(nameA); +} +for (var _4 = 0, _5 = getRobots(); _4 < _5.length; _4++) { + var _6 = _5[_4], _7 = _6.name, nameA = _7 === void 0 ? "noName" : _7, _8 = _6.skill, skillA = _8 === void 0 ? "noSkill" : _8; + console.log(nameA); +} +for (var _9 = 0, _10 = [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]; _9 < _10.length; _9++) { + var _11 = _10[_9], _12 = _11.name, nameA = _12 === void 0 ? "noName" : _12, _13 = _11.skill, skillA = _13 === void 0 ? "noSkill" : _13; + console.log(nameA); +} +for (var _14 = 0, multiRobots_2 = multiRobots; _14 < multiRobots_2.length; _14++) { + var _15 = multiRobots_2[_14], _16 = _15.name, nameA = _16 === void 0 ? "noName" : _16, _17 = _15.skills, _18 = _17 === void 0 ? { primary: "noSkill", secondary: "noSkill" } : _17, _19 = _18.primary, primaryA = _19 === void 0 ? "primary" : _19, _20 = _18.secondary, secondaryA = _20 === void 0 ? "secondary" : _20; + console.log(nameA); +} +for (var _21 = 0, _22 = getMultiRobots(); _21 < _22.length; _21++) { + var _23 = _22[_21], _24 = _23.name, nameA = _24 === void 0 ? "noName" : _24, _25 = _23.skills, _26 = _25 === void 0 ? { primary: "noSkill", secondary: "noSkill" } : _25, _27 = _26.primary, primaryA = _27 === void 0 ? "primary" : _27, _28 = _26.secondary, secondaryA = _28 === void 0 ? "secondary" : _28; + console.log(nameA); +} +for (var _29 = 0, _30 = [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]; _29 < _30.length; _29++) { + var _31 = _30[_29], _32 = _31.name, nameA = _32 === void 0 ? "noName" : _32, _33 = _31.skills, _34 = _33 === void 0 ? { primary: "noSkill", secondary: "noSkill" } : _33, _35 = _34.primary, primaryA = _35 === void 0 ? "primary" : _35, _36 = _34.secondary, secondaryA = _36 === void 0 ? "secondary" : _36; + console.log(nameA); +} +//# sourceMappingURL=sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.js.map b/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.js.map new file mode 100644 index 00000000000..89313ae9027 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.js.map @@ -0,0 +1,2 @@ +//// [sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.js.map] +{"version":3,"file":"sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.js","sourceRoot":"","sources":["sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts"],"names":[],"mappings":"AAgBA,IAAI,MAAM,GAAY,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAC;AACnG,IAAI,WAAW,GAAiB,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE;IAChG,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAC;AAE/E;IACI,MAAM,CAAC,MAAM,CAAC;AAClB,CAAC;AAED;IACI,MAAM,CAAC,WAAW,CAAC;AACvB,CAAC;AAED,GAAG,CAAC,CAAkC,UAAM,EAAN,iBAAM,EAAN,oBAAM,EAAN,IAAM,CAAC;IAAnC,0BAAsB,EAAtB,qCAAsB;IAC5B,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB;AACD,GAAG,CAAC,CAAkC,UAAW,EAAX,KAAA,SAAS,EAAE,EAAX,cAAW,EAAX,IAAW,CAAC;IAAxC,oBAAsB,EAAtB,qCAAsB;IAC5B,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB;AACD,GAAG,CAAC,CAAkC,UAA4E,EAA5E,MAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,EAA5E,cAA4E,EAA5E,IAA4E,CAAC;IAAzG,oBAAsB,EAAtB,qCAAsB;IAC5B,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB;AACD,GAAG,CAAC,CACkD,UAAW,EAAX,2BAAW,EAAX,yBAAW,EAAX,IAAW,CAAC;IADvD,iCACqC,EADrC,sEACqC,EAD3B,eAA6B,EAA7B,yCAA6B,EAAE,iBAAmC,EAAnC,6CAAmC;IAEnF,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;CACzB;AACD,GAAG,CAAC,CACkD,UAAgB,EAAhB,KAAA,cAAc,EAAE,EAAhB,cAAgB,EAAhB,IAAgB,CAAC;IAD5D,sBACqC,EADrC,sEACqC,EAD3B,eAA6B,EAA7B,yCAA6B,EAAE,iBAAmC,EAAnC,6CAAmC;IAEnF,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;CACzB;AACD,GAAG,CAAC,CAEA,UAC0E,EAD1E,KAAc,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE;IAClF,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,CAAC,EAD1E,cAC0E,EAD1E,IAC0E,CAAC;IAHpE,sBACqC,EADrC,sEACqC,EAD3B,eAA6B,EAA7B,yCAA6B,EAAE,iBAAmC,EAAnC,6CAAmC;IAInF,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;CACzB;AAED,GAAG,CAAC,CAA6D,UAAM,EAAN,iBAAM,EAAN,oBAAM,EAAN,IAAM,CAAC;IAAnE,qBAAwD,EAAnD,YAAsB,EAAtB,qCAAsB,EAAE,aAAyB,EAAzB,uCAAyB;IACvD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB;AACD,GAAG,CAAC,CAA8D,UAAW,EAAX,KAAA,SAAS,EAAE,EAAX,cAAW,EAAX,IAAW,CAAC;IAAzE,eAAyD,EAApD,YAAsB,EAAtB,qCAAsB,EAAE,aAAyB,EAAzB,uCAAyB;IACvD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB;AACD,GAAG,CAAC,CAA8D,UAA4E,EAA5E,OAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,EAA5E,eAA4E,EAA5E,IAA4E,CAAC;IAA1I,iBAAyD,EAApD,cAAsB,EAAtB,uCAAsB,EAAE,eAAyB,EAAzB,yCAAyB;IACvD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB;AACD,GAAG,CAAC,CAMC,WAAW,EAAX,2BAAW,EAAX,0BAAW,EAAX,KAAW,CAAC;IANZ,4BAMJ,EALG,cAAsB,EAAtB,uCAAsB,EACtB,gBAGgD,EAHhD,yEAGgD,EAF5C,iBAA6B,EAA7B,2CAA6B,EAC7B,mBAAmC,EAAnC,+CAAmC;IAGvC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB;AACD,GAAG,CAAC,CAMC,WAAgB,EAAhB,MAAA,cAAc,EAAE,EAAhB,gBAAgB,EAAhB,KAAgB,CAAC;IANjB,kBAMJ,EALG,cAAsB,EAAtB,uCAAsB,EACtB,gBAGgD,EAHhD,yEAGgD,EAF5C,iBAA6B,EAA7B,2CAA6B,EAC7B,mBAAmC,EAAnC,+CAAmC;IAGvC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB;AACD,GAAG,CAAC,CAMC,WACyE,EADzE,MAAc,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE;IACnF,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,CAAC,EADzE,gBACyE,EADzE,KACyE,CAAC;IAP1E,kBAMJ,EALG,cAAsB,EAAtB,uCAAsB,EACtB,gBAGgD,EAHhD,yEAGgD,EAF5C,iBAA6B,EAA7B,2CAA6B,EAC7B,mBAAmC,EAAnC,+CAAmC;IAIvC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.sourcemap.txt b/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.sourcemap.txt new file mode 100644 index 00000000000..e63344455ae --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.sourcemap.txt @@ -0,0 +1,2082 @@ +=================================================================== +JsFile: sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.js +mapUrl: sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.js.map +sourceRoot: +sources: sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.js +sourceFile:sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts +------------------------------------------------------------------- +>>>var robots = [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]; +1 > +2 >^^^^ +3 > ^^^^^^ +4 > ^^^ +5 > ^ +6 > ^^ +7 > ^^^^ +8 > ^^ +9 > ^^^^^^^ +10> ^^ +11> ^^^^^ +12> ^^ +13> ^^^^^^^^ +14> ^^ +15> ^^ +16> ^^ +17> ^^^^ +18> ^^ +19> ^^^^^^^^^ +20> ^^ +21> ^^^^^ +22> ^^ +23> ^^^^^^^^^^ +24> ^^ +25> ^ +26> ^ +1 >declare var console: { + > log(msg: any): void; + >} + >interface Robot { + > name: string; + > skill: string; + >} + > + >interface MultiRobot { + > name: string; + > skills: { + > primary?: string; + > secondary?: string; + > }; + >} + > + > +2 >let +3 > robots +4 > : Robot[] = +5 > [ +6 > { +7 > name +8 > : +9 > "mower" +10> , +11> skill +12> : +13> "mowing" +14> } +15> , +16> { +17> name +18> : +19> "trimmer" +20> , +21> skill +22> : +23> "trimming" +24> } +25> ] +26> ; +1 >Emitted(1, 1) Source(17, 1) + SourceIndex(0) +2 >Emitted(1, 5) Source(17, 5) + SourceIndex(0) +3 >Emitted(1, 11) Source(17, 11) + SourceIndex(0) +4 >Emitted(1, 14) Source(17, 23) + SourceIndex(0) +5 >Emitted(1, 15) Source(17, 24) + SourceIndex(0) +6 >Emitted(1, 17) Source(17, 26) + SourceIndex(0) +7 >Emitted(1, 21) Source(17, 30) + SourceIndex(0) +8 >Emitted(1, 23) Source(17, 32) + SourceIndex(0) +9 >Emitted(1, 30) Source(17, 39) + SourceIndex(0) +10>Emitted(1, 32) Source(17, 41) + SourceIndex(0) +11>Emitted(1, 37) Source(17, 46) + SourceIndex(0) +12>Emitted(1, 39) Source(17, 48) + SourceIndex(0) +13>Emitted(1, 47) Source(17, 56) + SourceIndex(0) +14>Emitted(1, 49) Source(17, 58) + SourceIndex(0) +15>Emitted(1, 51) Source(17, 60) + SourceIndex(0) +16>Emitted(1, 53) Source(17, 62) + SourceIndex(0) +17>Emitted(1, 57) Source(17, 66) + SourceIndex(0) +18>Emitted(1, 59) Source(17, 68) + SourceIndex(0) +19>Emitted(1, 68) Source(17, 77) + SourceIndex(0) +20>Emitted(1, 70) Source(17, 79) + SourceIndex(0) +21>Emitted(1, 75) Source(17, 84) + SourceIndex(0) +22>Emitted(1, 77) Source(17, 86) + SourceIndex(0) +23>Emitted(1, 87) Source(17, 96) + SourceIndex(0) +24>Emitted(1, 89) Source(17, 98) + SourceIndex(0) +25>Emitted(1, 90) Source(17, 99) + SourceIndex(0) +26>Emitted(1, 91) Source(17, 100) + SourceIndex(0) +--- +>>>var multiRobots = [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, +1 > +2 >^^^^ +3 > ^^^^^^^^^^^ +4 > ^^^ +5 > ^ +6 > ^^ +7 > ^^^^ +8 > ^^ +9 > ^^^^^^^ +10> ^^ +11> ^^^^^^ +12> ^^ +13> ^^ +14> ^^^^^^^ +15> ^^ +16> ^^^^^^^^ +17> ^^ +18> ^^^^^^^^^ +19> ^^ +20> ^^^^^^ +21> ^^ +22> ^^ +1 > + > +2 >let +3 > multiRobots +4 > : MultiRobot[] = +5 > [ +6 > { +7 > name +8 > : +9 > "mower" +10> , +11> skills +12> : +13> { +14> primary +15> : +16> "mowing" +17> , +18> secondary +19> : +20> "none" +21> } +22> } +1 >Emitted(2, 1) Source(18, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(18, 5) + SourceIndex(0) +3 >Emitted(2, 16) Source(18, 16) + SourceIndex(0) +4 >Emitted(2, 19) Source(18, 33) + SourceIndex(0) +5 >Emitted(2, 20) Source(18, 34) + SourceIndex(0) +6 >Emitted(2, 22) Source(18, 36) + SourceIndex(0) +7 >Emitted(2, 26) Source(18, 40) + SourceIndex(0) +8 >Emitted(2, 28) Source(18, 42) + SourceIndex(0) +9 >Emitted(2, 35) Source(18, 49) + SourceIndex(0) +10>Emitted(2, 37) Source(18, 51) + SourceIndex(0) +11>Emitted(2, 43) Source(18, 57) + SourceIndex(0) +12>Emitted(2, 45) Source(18, 59) + SourceIndex(0) +13>Emitted(2, 47) Source(18, 61) + SourceIndex(0) +14>Emitted(2, 54) Source(18, 68) + SourceIndex(0) +15>Emitted(2, 56) Source(18, 70) + SourceIndex(0) +16>Emitted(2, 64) Source(18, 78) + SourceIndex(0) +17>Emitted(2, 66) Source(18, 80) + SourceIndex(0) +18>Emitted(2, 75) Source(18, 89) + SourceIndex(0) +19>Emitted(2, 77) Source(18, 91) + SourceIndex(0) +20>Emitted(2, 83) Source(18, 97) + SourceIndex(0) +21>Emitted(2, 85) Source(18, 99) + SourceIndex(0) +22>Emitted(2, 87) Source(18, 101) + SourceIndex(0) +--- +>>> { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]; +1 >^^^^ +2 > ^^ +3 > ^^^^ +4 > ^^ +5 > ^^^^^^^^^ +6 > ^^ +7 > ^^^^^^ +8 > ^^ +9 > ^^ +10> ^^^^^^^ +11> ^^ +12> ^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^ +15> ^^ +16> ^^^^^^^^ +17> ^^ +18> ^^ +19> ^ +20> ^ +1 >, + > +2 > { +3 > name +4 > : +5 > "trimmer" +6 > , +7 > skills +8 > : +9 > { +10> primary +11> : +12> "trimming" +13> , +14> secondary +15> : +16> "edging" +17> } +18> } +19> ] +20> ; +1 >Emitted(3, 5) Source(19, 5) + SourceIndex(0) +2 >Emitted(3, 7) Source(19, 7) + SourceIndex(0) +3 >Emitted(3, 11) Source(19, 11) + SourceIndex(0) +4 >Emitted(3, 13) Source(19, 13) + SourceIndex(0) +5 >Emitted(3, 22) Source(19, 22) + SourceIndex(0) +6 >Emitted(3, 24) Source(19, 24) + SourceIndex(0) +7 >Emitted(3, 30) Source(19, 30) + SourceIndex(0) +8 >Emitted(3, 32) Source(19, 32) + SourceIndex(0) +9 >Emitted(3, 34) Source(19, 34) + SourceIndex(0) +10>Emitted(3, 41) Source(19, 41) + SourceIndex(0) +11>Emitted(3, 43) Source(19, 43) + SourceIndex(0) +12>Emitted(3, 53) Source(19, 53) + SourceIndex(0) +13>Emitted(3, 55) Source(19, 55) + SourceIndex(0) +14>Emitted(3, 64) Source(19, 64) + SourceIndex(0) +15>Emitted(3, 66) Source(19, 66) + SourceIndex(0) +16>Emitted(3, 74) Source(19, 74) + SourceIndex(0) +17>Emitted(3, 76) Source(19, 76) + SourceIndex(0) +18>Emitted(3, 78) Source(19, 78) + SourceIndex(0) +19>Emitted(3, 79) Source(19, 79) + SourceIndex(0) +20>Emitted(3, 80) Source(19, 80) + SourceIndex(0) +--- +>>>function getRobots() { +1 > +2 >^^^^^^^^^^^^^^^^^^^-> +1 > + > + > +1 >Emitted(4, 1) Source(21, 1) + SourceIndex(0) +--- +>>> return robots; +1->^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^ +5 > ^ +1->function getRobots() { + > +2 > return +3 > +4 > robots +5 > ; +1->Emitted(5, 5) Source(22, 5) + SourceIndex(0) +2 >Emitted(5, 11) Source(22, 11) + SourceIndex(0) +3 >Emitted(5, 12) Source(22, 12) + SourceIndex(0) +4 >Emitted(5, 18) Source(22, 18) + SourceIndex(0) +5 >Emitted(5, 19) Source(22, 19) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(6, 1) Source(23, 1) + SourceIndex(0) +2 >Emitted(6, 2) Source(23, 2) + SourceIndex(0) +--- +>>>function getMultiRobots() { +1-> +2 >^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > + > +1->Emitted(7, 1) Source(25, 1) + SourceIndex(0) +--- +>>> return multiRobots; +1->^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^ +5 > ^ +1->function getMultiRobots() { + > +2 > return +3 > +4 > multiRobots +5 > ; +1->Emitted(8, 5) Source(26, 5) + SourceIndex(0) +2 >Emitted(8, 11) Source(26, 11) + SourceIndex(0) +3 >Emitted(8, 12) Source(26, 12) + SourceIndex(0) +4 >Emitted(8, 23) Source(26, 23) + SourceIndex(0) +5 >Emitted(8, 24) Source(26, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(9, 1) Source(27, 1) + SourceIndex(0) +2 >Emitted(9, 2) Source(27, 2) + SourceIndex(0) +--- +>>>for (var _i = 0, robots_1 = robots; _i < robots_1.length; _i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^^^^^^ +10> ^^ +11> ^^^^ +12> ^ +13> ^^^^^^^^-> +1-> + > + > +2 >for +3 > +4 > (let {name: nameA = "noName" } of +5 > robots +6 > +7 > robots +8 > +9 > robots +10> +11> robots +12> ) +1->Emitted(10, 1) Source(29, 1) + SourceIndex(0) +2 >Emitted(10, 4) Source(29, 4) + SourceIndex(0) +3 >Emitted(10, 5) Source(29, 5) + SourceIndex(0) +4 >Emitted(10, 6) Source(29, 39) + SourceIndex(0) +5 >Emitted(10, 16) Source(29, 45) + SourceIndex(0) +6 >Emitted(10, 18) Source(29, 39) + SourceIndex(0) +7 >Emitted(10, 35) Source(29, 45) + SourceIndex(0) +8 >Emitted(10, 37) Source(29, 39) + SourceIndex(0) +9 >Emitted(10, 57) Source(29, 45) + SourceIndex(0) +10>Emitted(10, 59) Source(29, 39) + SourceIndex(0) +11>Emitted(10, 63) Source(29, 45) + SourceIndex(0) +12>Emitted(10, 64) Source(29, 46) + SourceIndex(0) +--- +>>> var _a = robots_1[_i].name, nameA = _a === void 0 ? "noName" : _a; +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > name: nameA = "noName" +3 > +4 > name: nameA = "noName" +1->Emitted(11, 5) Source(29, 11) + SourceIndex(0) +2 >Emitted(11, 31) Source(29, 33) + SourceIndex(0) +3 >Emitted(11, 33) Source(29, 11) + SourceIndex(0) +4 >Emitted(11, 70) Source(29, 33) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > } of robots) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(12, 5) Source(30, 5) + SourceIndex(0) +2 >Emitted(12, 12) Source(30, 12) + SourceIndex(0) +3 >Emitted(12, 13) Source(30, 13) + SourceIndex(0) +4 >Emitted(12, 16) Source(30, 16) + SourceIndex(0) +5 >Emitted(12, 17) Source(30, 17) + SourceIndex(0) +6 >Emitted(12, 22) Source(30, 22) + SourceIndex(0) +7 >Emitted(12, 23) Source(30, 23) + SourceIndex(0) +8 >Emitted(12, 24) Source(30, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(13, 2) Source(31, 2) + SourceIndex(0) +--- +>>>for (var _b = 0, _c = getRobots(); _b < _c.length; _b++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^ +8 > ^^^^^^^^^ +9 > ^^ +10> ^^ +11> ^^^^^^^^^^^^^^ +12> ^^ +13> ^^^^ +14> ^ +15> ^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > (let {name: nameA = "noName" } of +5 > getRobots() +6 > +7 > +8 > getRobots +9 > () +10> +11> getRobots() +12> +13> getRobots() +14> ) +1->Emitted(14, 1) Source(32, 1) + SourceIndex(0) +2 >Emitted(14, 4) Source(32, 4) + SourceIndex(0) +3 >Emitted(14, 5) Source(32, 5) + SourceIndex(0) +4 >Emitted(14, 6) Source(32, 39) + SourceIndex(0) +5 >Emitted(14, 16) Source(32, 50) + SourceIndex(0) +6 >Emitted(14, 18) Source(32, 39) + SourceIndex(0) +7 >Emitted(14, 23) Source(32, 39) + SourceIndex(0) +8 >Emitted(14, 32) Source(32, 48) + SourceIndex(0) +9 >Emitted(14, 34) Source(32, 50) + SourceIndex(0) +10>Emitted(14, 36) Source(32, 39) + SourceIndex(0) +11>Emitted(14, 50) Source(32, 50) + SourceIndex(0) +12>Emitted(14, 52) Source(32, 39) + SourceIndex(0) +13>Emitted(14, 56) Source(32, 50) + SourceIndex(0) +14>Emitted(14, 57) Source(32, 51) + SourceIndex(0) +--- +>>> var _d = _c[_b].name, nameA = _d === void 0 ? "noName" : _d; +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > name: nameA = "noName" +3 > +4 > name: nameA = "noName" +1->Emitted(15, 5) Source(32, 11) + SourceIndex(0) +2 >Emitted(15, 25) Source(32, 33) + SourceIndex(0) +3 >Emitted(15, 27) Source(32, 11) + SourceIndex(0) +4 >Emitted(15, 64) Source(32, 33) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > } of getRobots()) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(16, 5) Source(33, 5) + SourceIndex(0) +2 >Emitted(16, 12) Source(33, 12) + SourceIndex(0) +3 >Emitted(16, 13) Source(33, 13) + SourceIndex(0) +4 >Emitted(16, 16) Source(33, 16) + SourceIndex(0) +5 >Emitted(16, 17) Source(33, 17) + SourceIndex(0) +6 >Emitted(16, 22) Source(33, 22) + SourceIndex(0) +7 >Emitted(16, 23) Source(33, 23) + SourceIndex(0) +8 >Emitted(16, 24) Source(33, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(17, 2) Source(34, 2) + SourceIndex(0) +--- +>>>for (var _e = 0, _f = [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]; _e < _f.length; _e++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^ +8 > ^^ +9 > ^^^^ +10> ^^ +11> ^^^^^^^ +12> ^^ +13> ^^^^^ +14> ^^ +15> ^^^^^^^^ +16> ^^ +17> ^^ +18> ^^ +19> ^^^^ +20> ^^ +21> ^^^^^^^^^ +22> ^^ +23> ^^^^^ +24> ^^ +25> ^^^^^^^^^^ +26> ^^ +27> ^ +28> ^^ +29> ^^^^^^^^^^^^^^ +30> ^^ +31> ^^^^ +32> ^ +1-> + > +2 >for +3 > +4 > (let {name: nameA = "noName" } of +5 > [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }] +6 > +7 > [ +8 > { +9 > name +10> : +11> "mower" +12> , +13> skill +14> : +15> "mowing" +16> } +17> , +18> { +19> name +20> : +21> "trimmer" +22> , +23> skill +24> : +25> "trimming" +26> } +27> ] +28> +29> [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }] +30> +31> [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }] +32> ) +1->Emitted(18, 1) Source(35, 1) + SourceIndex(0) +2 >Emitted(18, 4) Source(35, 4) + SourceIndex(0) +3 >Emitted(18, 5) Source(35, 5) + SourceIndex(0) +4 >Emitted(18, 6) Source(35, 39) + SourceIndex(0) +5 >Emitted(18, 16) Source(35, 115) + SourceIndex(0) +6 >Emitted(18, 18) Source(35, 39) + SourceIndex(0) +7 >Emitted(18, 24) Source(35, 40) + SourceIndex(0) +8 >Emitted(18, 26) Source(35, 42) + SourceIndex(0) +9 >Emitted(18, 30) Source(35, 46) + SourceIndex(0) +10>Emitted(18, 32) Source(35, 48) + SourceIndex(0) +11>Emitted(18, 39) Source(35, 55) + SourceIndex(0) +12>Emitted(18, 41) Source(35, 57) + SourceIndex(0) +13>Emitted(18, 46) Source(35, 62) + SourceIndex(0) +14>Emitted(18, 48) Source(35, 64) + SourceIndex(0) +15>Emitted(18, 56) Source(35, 72) + SourceIndex(0) +16>Emitted(18, 58) Source(35, 74) + SourceIndex(0) +17>Emitted(18, 60) Source(35, 76) + SourceIndex(0) +18>Emitted(18, 62) Source(35, 78) + SourceIndex(0) +19>Emitted(18, 66) Source(35, 82) + SourceIndex(0) +20>Emitted(18, 68) Source(35, 84) + SourceIndex(0) +21>Emitted(18, 77) Source(35, 93) + SourceIndex(0) +22>Emitted(18, 79) Source(35, 95) + SourceIndex(0) +23>Emitted(18, 84) Source(35, 100) + SourceIndex(0) +24>Emitted(18, 86) Source(35, 102) + SourceIndex(0) +25>Emitted(18, 96) Source(35, 112) + SourceIndex(0) +26>Emitted(18, 98) Source(35, 114) + SourceIndex(0) +27>Emitted(18, 99) Source(35, 115) + SourceIndex(0) +28>Emitted(18, 101) Source(35, 39) + SourceIndex(0) +29>Emitted(18, 115) Source(35, 115) + SourceIndex(0) +30>Emitted(18, 117) Source(35, 39) + SourceIndex(0) +31>Emitted(18, 121) Source(35, 115) + SourceIndex(0) +32>Emitted(18, 122) Source(35, 116) + SourceIndex(0) +--- +>>> var _g = _f[_e].name, nameA = _g === void 0 ? "noName" : _g; +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 > name: nameA = "noName" +3 > +4 > name: nameA = "noName" +1 >Emitted(19, 5) Source(35, 11) + SourceIndex(0) +2 >Emitted(19, 25) Source(35, 33) + SourceIndex(0) +3 >Emitted(19, 27) Source(35, 11) + SourceIndex(0) +4 >Emitted(19, 64) Source(35, 33) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(20, 5) Source(36, 5) + SourceIndex(0) +2 >Emitted(20, 12) Source(36, 12) + SourceIndex(0) +3 >Emitted(20, 13) Source(36, 13) + SourceIndex(0) +4 >Emitted(20, 16) Source(36, 16) + SourceIndex(0) +5 >Emitted(20, 17) Source(36, 17) + SourceIndex(0) +6 >Emitted(20, 22) Source(36, 22) + SourceIndex(0) +7 >Emitted(20, 23) Source(36, 23) + SourceIndex(0) +8 >Emitted(20, 24) Source(36, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(21, 2) Source(37, 2) + SourceIndex(0) +--- +>>>for (var _h = 0, multiRobots_1 = multiRobots; _h < multiRobots_1.length; _h++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^^^^^^^^^^^ +10> ^^ +11> ^^^^ +12> ^ +13> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > (let { skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = + > { primary: "nosKill", secondary: "noSkill" } } of +5 > multiRobots +6 > +7 > multiRobots +8 > +9 > multiRobots +10> +11> multiRobots +12> ) +1->Emitted(22, 1) Source(38, 1) + SourceIndex(0) +2 >Emitted(22, 4) Source(38, 4) + SourceIndex(0) +3 >Emitted(22, 5) Source(38, 5) + SourceIndex(0) +4 >Emitted(22, 6) Source(39, 55) + SourceIndex(0) +5 >Emitted(22, 16) Source(39, 66) + SourceIndex(0) +6 >Emitted(22, 18) Source(39, 55) + SourceIndex(0) +7 >Emitted(22, 45) Source(39, 66) + SourceIndex(0) +8 >Emitted(22, 47) Source(39, 55) + SourceIndex(0) +9 >Emitted(22, 72) Source(39, 66) + SourceIndex(0) +10>Emitted(22, 74) Source(39, 55) + SourceIndex(0) +11>Emitted(22, 78) Source(39, 66) + SourceIndex(0) +12>Emitted(22, 79) Source(39, 67) + SourceIndex(0) +--- +>>> var _j = multiRobots_1[_h].skills, _k = _j === void 0 ? { primary: "nosKill", secondary: "noSkill" } : _j, _l = _k.primary, primaryA = _l === void 0 ? "primary" : _l, _m = _k.secondary, secondaryA = _m === void 0 ? "secondary" : _m; +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = + > { primary: "nosKill", secondary: "noSkill" } +3 > +4 > skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = + > { primary: "nosKill", secondary: "noSkill" } +5 > +6 > primary: primaryA = "primary" +7 > +8 > primary: primaryA = "primary" +9 > , +10> secondary: secondaryA = "secondary" +11> +12> secondary: secondaryA = "secondary" +1->Emitted(23, 5) Source(38, 12) + SourceIndex(0) +2 >Emitted(23, 38) Source(39, 49) + SourceIndex(0) +3 >Emitted(23, 40) Source(38, 12) + SourceIndex(0) +4 >Emitted(23, 110) Source(39, 49) + SourceIndex(0) +5 >Emitted(23, 112) Source(38, 22) + SourceIndex(0) +6 >Emitted(23, 127) Source(38, 51) + SourceIndex(0) +7 >Emitted(23, 129) Source(38, 22) + SourceIndex(0) +8 >Emitted(23, 170) Source(38, 51) + SourceIndex(0) +9 >Emitted(23, 172) Source(38, 53) + SourceIndex(0) +10>Emitted(23, 189) Source(38, 88) + SourceIndex(0) +11>Emitted(23, 191) Source(38, 53) + SourceIndex(0) +12>Emitted(23, 236) Source(38, 88) + SourceIndex(0) +--- +>>> console.log(primaryA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1 > } = + > { primary: "nosKill", secondary: "noSkill" } } of multiRobots) { + > +2 > console +3 > . +4 > log +5 > ( +6 > primaryA +7 > ) +8 > ; +1 >Emitted(24, 5) Source(40, 5) + SourceIndex(0) +2 >Emitted(24, 12) Source(40, 12) + SourceIndex(0) +3 >Emitted(24, 13) Source(40, 13) + SourceIndex(0) +4 >Emitted(24, 16) Source(40, 16) + SourceIndex(0) +5 >Emitted(24, 17) Source(40, 17) + SourceIndex(0) +6 >Emitted(24, 25) Source(40, 25) + SourceIndex(0) +7 >Emitted(24, 26) Source(40, 26) + SourceIndex(0) +8 >Emitted(24, 27) Source(40, 27) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(25, 2) Source(41, 2) + SourceIndex(0) +--- +>>>for (var _o = 0, _p = getMultiRobots(); _o < _p.length; _o++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^ +8 > ^^^^^^^^^^^^^^ +9 > ^^ +10> ^^ +11> ^^^^^^^^^^^^^^ +12> ^^ +13> ^^^^ +14> ^ +15> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > (let { skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = + > { primary: "nosKill", secondary: "noSkill" } } of +5 > getMultiRobots() +6 > +7 > +8 > getMultiRobots +9 > () +10> +11> getMultiRobots() +12> +13> getMultiRobots() +14> ) +1->Emitted(26, 1) Source(42, 1) + SourceIndex(0) +2 >Emitted(26, 4) Source(42, 4) + SourceIndex(0) +3 >Emitted(26, 5) Source(42, 5) + SourceIndex(0) +4 >Emitted(26, 6) Source(43, 55) + SourceIndex(0) +5 >Emitted(26, 16) Source(43, 71) + SourceIndex(0) +6 >Emitted(26, 18) Source(43, 55) + SourceIndex(0) +7 >Emitted(26, 23) Source(43, 55) + SourceIndex(0) +8 >Emitted(26, 37) Source(43, 69) + SourceIndex(0) +9 >Emitted(26, 39) Source(43, 71) + SourceIndex(0) +10>Emitted(26, 41) Source(43, 55) + SourceIndex(0) +11>Emitted(26, 55) Source(43, 71) + SourceIndex(0) +12>Emitted(26, 57) Source(43, 55) + SourceIndex(0) +13>Emitted(26, 61) Source(43, 71) + SourceIndex(0) +14>Emitted(26, 62) Source(43, 72) + SourceIndex(0) +--- +>>> var _q = _p[_o].skills, _r = _q === void 0 ? { primary: "nosKill", secondary: "noSkill" } : _q, _s = _r.primary, primaryA = _s === void 0 ? "primary" : _s, _t = _r.secondary, secondaryA = _t === void 0 ? "secondary" : _t; +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = + > { primary: "nosKill", secondary: "noSkill" } +3 > +4 > skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = + > { primary: "nosKill", secondary: "noSkill" } +5 > +6 > primary: primaryA = "primary" +7 > +8 > primary: primaryA = "primary" +9 > , +10> secondary: secondaryA = "secondary" +11> +12> secondary: secondaryA = "secondary" +1->Emitted(27, 5) Source(42, 12) + SourceIndex(0) +2 >Emitted(27, 27) Source(43, 49) + SourceIndex(0) +3 >Emitted(27, 29) Source(42, 12) + SourceIndex(0) +4 >Emitted(27, 99) Source(43, 49) + SourceIndex(0) +5 >Emitted(27, 101) Source(42, 22) + SourceIndex(0) +6 >Emitted(27, 116) Source(42, 51) + SourceIndex(0) +7 >Emitted(27, 118) Source(42, 22) + SourceIndex(0) +8 >Emitted(27, 159) Source(42, 51) + SourceIndex(0) +9 >Emitted(27, 161) Source(42, 53) + SourceIndex(0) +10>Emitted(27, 178) Source(42, 88) + SourceIndex(0) +11>Emitted(27, 180) Source(42, 53) + SourceIndex(0) +12>Emitted(27, 225) Source(42, 88) + SourceIndex(0) +--- +>>> console.log(primaryA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1 > } = + > { primary: "nosKill", secondary: "noSkill" } } of getMultiRobots()) { + > +2 > console +3 > . +4 > log +5 > ( +6 > primaryA +7 > ) +8 > ; +1 >Emitted(28, 5) Source(44, 5) + SourceIndex(0) +2 >Emitted(28, 12) Source(44, 12) + SourceIndex(0) +3 >Emitted(28, 13) Source(44, 13) + SourceIndex(0) +4 >Emitted(28, 16) Source(44, 16) + SourceIndex(0) +5 >Emitted(28, 17) Source(44, 17) + SourceIndex(0) +6 >Emitted(28, 25) Source(44, 25) + SourceIndex(0) +7 >Emitted(28, 26) Source(44, 26) + SourceIndex(0) +8 >Emitted(28, 27) Source(44, 27) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(29, 2) Source(45, 2) + SourceIndex(0) +--- +>>>for (var _u = 0, _v = [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^ +8 > ^ +9 > ^^ +10> ^^^^ +11> ^^ +12> ^^^^^^^ +13> ^^ +14> ^^^^^^ +15> ^^ +16> ^^ +17> ^^^^^^^ +18> ^^ +19> ^^^^^^^^ +20> ^^ +21> ^^^^^^^^^ +22> ^^ +23> ^^^^^^ +24> ^^ +25> ^^ +26> ^^^^^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > (let { skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = + > { primary: "nosKill", secondary: "noSkill" } } of + > +5 > [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] +6 > +7 > +8 > [ +9 > { +10> name +11> : +12> "mower" +13> , +14> skills +15> : +16> { +17> primary +18> : +19> "mowing" +20> , +21> secondary +22> : +23> "none" +24> } +25> } +1->Emitted(30, 1) Source(46, 1) + SourceIndex(0) +2 >Emitted(30, 4) Source(46, 4) + SourceIndex(0) +3 >Emitted(30, 5) Source(46, 5) + SourceIndex(0) +4 >Emitted(30, 6) Source(48, 5) + SourceIndex(0) +5 >Emitted(30, 16) Source(49, 79) + SourceIndex(0) +6 >Emitted(30, 18) Source(48, 5) + SourceIndex(0) +7 >Emitted(30, 23) Source(48, 19) + SourceIndex(0) +8 >Emitted(30, 24) Source(48, 20) + SourceIndex(0) +9 >Emitted(30, 26) Source(48, 22) + SourceIndex(0) +10>Emitted(30, 30) Source(48, 26) + SourceIndex(0) +11>Emitted(30, 32) Source(48, 28) + SourceIndex(0) +12>Emitted(30, 39) Source(48, 35) + SourceIndex(0) +13>Emitted(30, 41) Source(48, 37) + SourceIndex(0) +14>Emitted(30, 47) Source(48, 43) + SourceIndex(0) +15>Emitted(30, 49) Source(48, 45) + SourceIndex(0) +16>Emitted(30, 51) Source(48, 47) + SourceIndex(0) +17>Emitted(30, 58) Source(48, 54) + SourceIndex(0) +18>Emitted(30, 60) Source(48, 56) + SourceIndex(0) +19>Emitted(30, 68) Source(48, 64) + SourceIndex(0) +20>Emitted(30, 70) Source(48, 66) + SourceIndex(0) +21>Emitted(30, 79) Source(48, 75) + SourceIndex(0) +22>Emitted(30, 81) Source(48, 77) + SourceIndex(0) +23>Emitted(30, 87) Source(48, 83) + SourceIndex(0) +24>Emitted(30, 89) Source(48, 85) + SourceIndex(0) +25>Emitted(30, 91) Source(48, 87) + SourceIndex(0) +--- +>>> { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]; _u < _v.length; _u++) { +1->^^^^ +2 > ^^ +3 > ^^^^ +4 > ^^ +5 > ^^^^^^^^^ +6 > ^^ +7 > ^^^^^^ +8 > ^^ +9 > ^^ +10> ^^^^^^^ +11> ^^ +12> ^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^ +15> ^^ +16> ^^^^^^^^ +17> ^^ +18> ^^ +19> ^ +20> ^^ +21> ^^^^^^^^^^^^^^ +22> ^^ +23> ^^^^ +24> ^ +25> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1->, + > +2 > { +3 > name +4 > : +5 > "trimmer" +6 > , +7 > skills +8 > : +9 > { +10> primary +11> : +12> "trimming" +13> , +14> secondary +15> : +16> "edging" +17> } +18> } +19> ] +20> +21> [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] +22> +23> [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] +24> ) +1->Emitted(31, 5) Source(49, 5) + SourceIndex(0) +2 >Emitted(31, 7) Source(49, 7) + SourceIndex(0) +3 >Emitted(31, 11) Source(49, 11) + SourceIndex(0) +4 >Emitted(31, 13) Source(49, 13) + SourceIndex(0) +5 >Emitted(31, 22) Source(49, 22) + SourceIndex(0) +6 >Emitted(31, 24) Source(49, 24) + SourceIndex(0) +7 >Emitted(31, 30) Source(49, 30) + SourceIndex(0) +8 >Emitted(31, 32) Source(49, 32) + SourceIndex(0) +9 >Emitted(31, 34) Source(49, 34) + SourceIndex(0) +10>Emitted(31, 41) Source(49, 41) + SourceIndex(0) +11>Emitted(31, 43) Source(49, 43) + SourceIndex(0) +12>Emitted(31, 53) Source(49, 53) + SourceIndex(0) +13>Emitted(31, 55) Source(49, 55) + SourceIndex(0) +14>Emitted(31, 64) Source(49, 64) + SourceIndex(0) +15>Emitted(31, 66) Source(49, 66) + SourceIndex(0) +16>Emitted(31, 74) Source(49, 74) + SourceIndex(0) +17>Emitted(31, 76) Source(49, 76) + SourceIndex(0) +18>Emitted(31, 78) Source(49, 78) + SourceIndex(0) +19>Emitted(31, 79) Source(49, 79) + SourceIndex(0) +20>Emitted(31, 81) Source(48, 5) + SourceIndex(0) +21>Emitted(31, 95) Source(49, 79) + SourceIndex(0) +22>Emitted(31, 97) Source(48, 5) + SourceIndex(0) +23>Emitted(31, 101) Source(49, 79) + SourceIndex(0) +24>Emitted(31, 102) Source(49, 80) + SourceIndex(0) +--- +>>> var _w = _v[_u].skills, _x = _w === void 0 ? { primary: "nosKill", secondary: "noSkill" } : _w, _y = _x.primary, primaryA = _y === void 0 ? "primary" : _y, _z = _x.secondary, secondaryA = _z === void 0 ? "secondary" : _z; +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = + > { primary: "nosKill", secondary: "noSkill" } +3 > +4 > skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = + > { primary: "nosKill", secondary: "noSkill" } +5 > +6 > primary: primaryA = "primary" +7 > +8 > primary: primaryA = "primary" +9 > , +10> secondary: secondaryA = "secondary" +11> +12> secondary: secondaryA = "secondary" +1->Emitted(32, 5) Source(46, 12) + SourceIndex(0) +2 >Emitted(32, 27) Source(47, 49) + SourceIndex(0) +3 >Emitted(32, 29) Source(46, 12) + SourceIndex(0) +4 >Emitted(32, 99) Source(47, 49) + SourceIndex(0) +5 >Emitted(32, 101) Source(46, 22) + SourceIndex(0) +6 >Emitted(32, 116) Source(46, 51) + SourceIndex(0) +7 >Emitted(32, 118) Source(46, 22) + SourceIndex(0) +8 >Emitted(32, 159) Source(46, 51) + SourceIndex(0) +9 >Emitted(32, 161) Source(46, 53) + SourceIndex(0) +10>Emitted(32, 178) Source(46, 88) + SourceIndex(0) +11>Emitted(32, 180) Source(46, 53) + SourceIndex(0) +12>Emitted(32, 225) Source(46, 88) + SourceIndex(0) +--- +>>> console.log(primaryA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1 > } = + > { primary: "nosKill", secondary: "noSkill" } } of + > [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { + > +2 > console +3 > . +4 > log +5 > ( +6 > primaryA +7 > ) +8 > ; +1 >Emitted(33, 5) Source(50, 5) + SourceIndex(0) +2 >Emitted(33, 12) Source(50, 12) + SourceIndex(0) +3 >Emitted(33, 13) Source(50, 13) + SourceIndex(0) +4 >Emitted(33, 16) Source(50, 16) + SourceIndex(0) +5 >Emitted(33, 17) Source(50, 17) + SourceIndex(0) +6 >Emitted(33, 25) Source(50, 25) + SourceIndex(0) +7 >Emitted(33, 26) Source(50, 26) + SourceIndex(0) +8 >Emitted(33, 27) Source(50, 27) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(34, 2) Source(51, 2) + SourceIndex(0) +--- +>>>for (var _0 = 0, robots_2 = robots; _0 < robots_2.length; _0++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^^^^^^ +10> ^^ +11> ^^^^ +12> ^ +13> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > + > +2 >for +3 > +4 > (let {name: nameA = "noName", skill: skillA = "noSkill" } of +5 > robots +6 > +7 > robots +8 > +9 > robots +10> +11> robots +12> ) +1->Emitted(35, 1) Source(53, 1) + SourceIndex(0) +2 >Emitted(35, 4) Source(53, 4) + SourceIndex(0) +3 >Emitted(35, 5) Source(53, 5) + SourceIndex(0) +4 >Emitted(35, 6) Source(53, 66) + SourceIndex(0) +5 >Emitted(35, 16) Source(53, 72) + SourceIndex(0) +6 >Emitted(35, 18) Source(53, 66) + SourceIndex(0) +7 >Emitted(35, 35) Source(53, 72) + SourceIndex(0) +8 >Emitted(35, 37) Source(53, 66) + SourceIndex(0) +9 >Emitted(35, 57) Source(53, 72) + SourceIndex(0) +10>Emitted(35, 59) Source(53, 66) + SourceIndex(0) +11>Emitted(35, 63) Source(53, 72) + SourceIndex(0) +12>Emitted(35, 64) Source(53, 73) + SourceIndex(0) +--- +>>> var _1 = robots_2[_0], _2 = _1.name, nameA = _2 === void 0 ? "noName" : _2, _3 = _1.skill, skillA = _3 === void 0 ? "noSkill" : _3; +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > let {name: nameA = "noName", skill: skillA = "noSkill" } +3 > +4 > name: nameA = "noName" +5 > +6 > name: nameA = "noName" +7 > , +8 > skill: skillA = "noSkill" +9 > +10> skill: skillA = "noSkill" +1->Emitted(36, 5) Source(53, 6) + SourceIndex(0) +2 >Emitted(36, 26) Source(53, 62) + SourceIndex(0) +3 >Emitted(36, 28) Source(53, 11) + SourceIndex(0) +4 >Emitted(36, 40) Source(53, 33) + SourceIndex(0) +5 >Emitted(36, 42) Source(53, 11) + SourceIndex(0) +6 >Emitted(36, 79) Source(53, 33) + SourceIndex(0) +7 >Emitted(36, 81) Source(53, 35) + SourceIndex(0) +8 >Emitted(36, 94) Source(53, 60) + SourceIndex(0) +9 >Emitted(36, 96) Source(53, 35) + SourceIndex(0) +10>Emitted(36, 135) Source(53, 60) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > } of robots) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(37, 5) Source(54, 5) + SourceIndex(0) +2 >Emitted(37, 12) Source(54, 12) + SourceIndex(0) +3 >Emitted(37, 13) Source(54, 13) + SourceIndex(0) +4 >Emitted(37, 16) Source(54, 16) + SourceIndex(0) +5 >Emitted(37, 17) Source(54, 17) + SourceIndex(0) +6 >Emitted(37, 22) Source(54, 22) + SourceIndex(0) +7 >Emitted(37, 23) Source(54, 23) + SourceIndex(0) +8 >Emitted(37, 24) Source(54, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(38, 2) Source(55, 2) + SourceIndex(0) +--- +>>>for (var _4 = 0, _5 = getRobots(); _4 < _5.length; _4++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^ +8 > ^^^^^^^^^ +9 > ^^ +10> ^^ +11> ^^^^^^^^^^^^^^ +12> ^^ +13> ^^^^ +14> ^ +15> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > (let {name: nameA = "noName", skill: skillA = "noSkill" } of +5 > getRobots() +6 > +7 > +8 > getRobots +9 > () +10> +11> getRobots() +12> +13> getRobots() +14> ) +1->Emitted(39, 1) Source(56, 1) + SourceIndex(0) +2 >Emitted(39, 4) Source(56, 4) + SourceIndex(0) +3 >Emitted(39, 5) Source(56, 5) + SourceIndex(0) +4 >Emitted(39, 6) Source(56, 67) + SourceIndex(0) +5 >Emitted(39, 16) Source(56, 78) + SourceIndex(0) +6 >Emitted(39, 18) Source(56, 67) + SourceIndex(0) +7 >Emitted(39, 23) Source(56, 67) + SourceIndex(0) +8 >Emitted(39, 32) Source(56, 76) + SourceIndex(0) +9 >Emitted(39, 34) Source(56, 78) + SourceIndex(0) +10>Emitted(39, 36) Source(56, 67) + SourceIndex(0) +11>Emitted(39, 50) Source(56, 78) + SourceIndex(0) +12>Emitted(39, 52) Source(56, 67) + SourceIndex(0) +13>Emitted(39, 56) Source(56, 78) + SourceIndex(0) +14>Emitted(39, 57) Source(56, 79) + SourceIndex(0) +--- +>>> var _6 = _5[_4], _7 = _6.name, nameA = _7 === void 0 ? "noName" : _7, _8 = _6.skill, skillA = _8 === void 0 ? "noSkill" : _8; +1->^^^^ +2 > ^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > let {name: nameA = "noName", skill: skillA = "noSkill" } +3 > +4 > name: nameA = "noName" +5 > +6 > name: nameA = "noName" +7 > , +8 > skill: skillA = "noSkill" +9 > +10> skill: skillA = "noSkill" +1->Emitted(40, 5) Source(56, 6) + SourceIndex(0) +2 >Emitted(40, 20) Source(56, 63) + SourceIndex(0) +3 >Emitted(40, 22) Source(56, 11) + SourceIndex(0) +4 >Emitted(40, 34) Source(56, 33) + SourceIndex(0) +5 >Emitted(40, 36) Source(56, 11) + SourceIndex(0) +6 >Emitted(40, 73) Source(56, 33) + SourceIndex(0) +7 >Emitted(40, 75) Source(56, 35) + SourceIndex(0) +8 >Emitted(40, 88) Source(56, 60) + SourceIndex(0) +9 >Emitted(40, 90) Source(56, 35) + SourceIndex(0) +10>Emitted(40, 129) Source(56, 60) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > } of getRobots()) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(41, 5) Source(57, 5) + SourceIndex(0) +2 >Emitted(41, 12) Source(57, 12) + SourceIndex(0) +3 >Emitted(41, 13) Source(57, 13) + SourceIndex(0) +4 >Emitted(41, 16) Source(57, 16) + SourceIndex(0) +5 >Emitted(41, 17) Source(57, 17) + SourceIndex(0) +6 >Emitted(41, 22) Source(57, 22) + SourceIndex(0) +7 >Emitted(41, 23) Source(57, 23) + SourceIndex(0) +8 >Emitted(41, 24) Source(57, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(42, 2) Source(58, 2) + SourceIndex(0) +--- +>>>for (var _9 = 0, _10 = [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]; _9 < _10.length; _9++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^ +8 > ^^ +9 > ^^^^ +10> ^^ +11> ^^^^^^^ +12> ^^ +13> ^^^^^ +14> ^^ +15> ^^^^^^^^ +16> ^^ +17> ^^ +18> ^^ +19> ^^^^ +20> ^^ +21> ^^^^^^^^^ +22> ^^ +23> ^^^^^ +24> ^^ +25> ^^^^^^^^^^ +26> ^^ +27> ^ +28> ^^ +29> ^^^^^^^^^^^^^^^ +30> ^^ +31> ^^^^ +32> ^ +33> ^^^^^^^^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > (let {name: nameA = "noName", skill: skillA = "noSkill" } of +5 > [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }] +6 > +7 > [ +8 > { +9 > name +10> : +11> "mower" +12> , +13> skill +14> : +15> "mowing" +16> } +17> , +18> { +19> name +20> : +21> "trimmer" +22> , +23> skill +24> : +25> "trimming" +26> } +27> ] +28> +29> [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }] +30> +31> [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }] +32> ) +1->Emitted(43, 1) Source(59, 1) + SourceIndex(0) +2 >Emitted(43, 4) Source(59, 4) + SourceIndex(0) +3 >Emitted(43, 5) Source(59, 5) + SourceIndex(0) +4 >Emitted(43, 6) Source(59, 67) + SourceIndex(0) +5 >Emitted(43, 16) Source(59, 143) + SourceIndex(0) +6 >Emitted(43, 18) Source(59, 67) + SourceIndex(0) +7 >Emitted(43, 25) Source(59, 68) + SourceIndex(0) +8 >Emitted(43, 27) Source(59, 70) + SourceIndex(0) +9 >Emitted(43, 31) Source(59, 74) + SourceIndex(0) +10>Emitted(43, 33) Source(59, 76) + SourceIndex(0) +11>Emitted(43, 40) Source(59, 83) + SourceIndex(0) +12>Emitted(43, 42) Source(59, 85) + SourceIndex(0) +13>Emitted(43, 47) Source(59, 90) + SourceIndex(0) +14>Emitted(43, 49) Source(59, 92) + SourceIndex(0) +15>Emitted(43, 57) Source(59, 100) + SourceIndex(0) +16>Emitted(43, 59) Source(59, 102) + SourceIndex(0) +17>Emitted(43, 61) Source(59, 104) + SourceIndex(0) +18>Emitted(43, 63) Source(59, 106) + SourceIndex(0) +19>Emitted(43, 67) Source(59, 110) + SourceIndex(0) +20>Emitted(43, 69) Source(59, 112) + SourceIndex(0) +21>Emitted(43, 78) Source(59, 121) + SourceIndex(0) +22>Emitted(43, 80) Source(59, 123) + SourceIndex(0) +23>Emitted(43, 85) Source(59, 128) + SourceIndex(0) +24>Emitted(43, 87) Source(59, 130) + SourceIndex(0) +25>Emitted(43, 97) Source(59, 140) + SourceIndex(0) +26>Emitted(43, 99) Source(59, 142) + SourceIndex(0) +27>Emitted(43, 100) Source(59, 143) + SourceIndex(0) +28>Emitted(43, 102) Source(59, 67) + SourceIndex(0) +29>Emitted(43, 117) Source(59, 143) + SourceIndex(0) +30>Emitted(43, 119) Source(59, 67) + SourceIndex(0) +31>Emitted(43, 123) Source(59, 143) + SourceIndex(0) +32>Emitted(43, 124) Source(59, 144) + SourceIndex(0) +--- +>>> var _11 = _10[_9], _12 = _11.name, nameA = _12 === void 0 ? "noName" : _12, _13 = _11.skill, skillA = _13 === void 0 ? "noSkill" : _13; +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > let {name: nameA = "noName", skill: skillA = "noSkill" } +3 > +4 > name: nameA = "noName" +5 > +6 > name: nameA = "noName" +7 > , +8 > skill: skillA = "noSkill" +9 > +10> skill: skillA = "noSkill" +1->Emitted(44, 5) Source(59, 6) + SourceIndex(0) +2 >Emitted(44, 22) Source(59, 63) + SourceIndex(0) +3 >Emitted(44, 24) Source(59, 11) + SourceIndex(0) +4 >Emitted(44, 38) Source(59, 33) + SourceIndex(0) +5 >Emitted(44, 40) Source(59, 11) + SourceIndex(0) +6 >Emitted(44, 79) Source(59, 33) + SourceIndex(0) +7 >Emitted(44, 81) Source(59, 35) + SourceIndex(0) +8 >Emitted(44, 96) Source(59, 60) + SourceIndex(0) +9 >Emitted(44, 98) Source(59, 35) + SourceIndex(0) +10>Emitted(44, 139) Source(59, 60) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(45, 5) Source(60, 5) + SourceIndex(0) +2 >Emitted(45, 12) Source(60, 12) + SourceIndex(0) +3 >Emitted(45, 13) Source(60, 13) + SourceIndex(0) +4 >Emitted(45, 16) Source(60, 16) + SourceIndex(0) +5 >Emitted(45, 17) Source(60, 17) + SourceIndex(0) +6 >Emitted(45, 22) Source(60, 22) + SourceIndex(0) +7 >Emitted(45, 23) Source(60, 23) + SourceIndex(0) +8 >Emitted(45, 24) Source(60, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(46, 2) Source(61, 2) + SourceIndex(0) +--- +>>>for (var _14 = 0, multiRobots_2 = multiRobots; _14 < multiRobots_2.length; _14++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^^^^^^^^^^^^ +10> ^^ +11> ^^^^^ +12> ^ +13> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > (let { + > name: nameA = "noName", + > skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "noSkill", secondary: "noSkill" } + > } of +5 > multiRobots +6 > +7 > multiRobots +8 > +9 > multiRobots +10> +11> multiRobots +12> ) +1->Emitted(47, 1) Source(62, 1) + SourceIndex(0) +2 >Emitted(47, 4) Source(62, 4) + SourceIndex(0) +3 >Emitted(47, 5) Source(62, 5) + SourceIndex(0) +4 >Emitted(47, 6) Source(68, 6) + SourceIndex(0) +5 >Emitted(47, 17) Source(68, 17) + SourceIndex(0) +6 >Emitted(47, 19) Source(68, 6) + SourceIndex(0) +7 >Emitted(47, 46) Source(68, 17) + SourceIndex(0) +8 >Emitted(47, 48) Source(68, 6) + SourceIndex(0) +9 >Emitted(47, 74) Source(68, 17) + SourceIndex(0) +10>Emitted(47, 76) Source(68, 6) + SourceIndex(0) +11>Emitted(47, 81) Source(68, 17) + SourceIndex(0) +12>Emitted(47, 82) Source(68, 18) + SourceIndex(0) +--- +>>> var _15 = multiRobots_2[_14], _16 = _15.name, nameA = _16 === void 0 ? "noName" : _16, _17 = _15.skills, _18 = _17 === void 0 ? { primary: "noSkill", secondary: "noSkill" } : _17, _19 = _18.primary, primaryA = _19 === void 0 ? "primary" : _19, _20 = _18.secondary, secondaryA = _20 === void 0 ? "secondary" : _20; +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +15> ^^ +16> ^^^^^^^^^^^^^^^^^^^ +17> ^^ +18> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > let { + > name: nameA = "noName", + > skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "noSkill", secondary: "noSkill" } + > } +3 > +4 > name: nameA = "noName" +5 > +6 > name: nameA = "noName" +7 > , + > +8 > skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "noSkill", secondary: "noSkill" } +9 > +10> skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "noSkill", secondary: "noSkill" } +11> +12> primary: primaryA = "primary" +13> +14> primary: primaryA = "primary" +15> , + > +16> secondary: secondaryA = "secondary" +17> +18> secondary: secondaryA = "secondary" +1->Emitted(48, 5) Source(62, 6) + SourceIndex(0) +2 >Emitted(48, 33) Source(68, 2) + SourceIndex(0) +3 >Emitted(48, 35) Source(63, 5) + SourceIndex(0) +4 >Emitted(48, 49) Source(63, 27) + SourceIndex(0) +5 >Emitted(48, 51) Source(63, 5) + SourceIndex(0) +6 >Emitted(48, 90) Source(63, 27) + SourceIndex(0) +7 >Emitted(48, 92) Source(64, 5) + SourceIndex(0) +8 >Emitted(48, 108) Source(67, 53) + SourceIndex(0) +9 >Emitted(48, 110) Source(64, 5) + SourceIndex(0) +10>Emitted(48, 183) Source(67, 53) + SourceIndex(0) +11>Emitted(48, 185) Source(65, 9) + SourceIndex(0) +12>Emitted(48, 202) Source(65, 38) + SourceIndex(0) +13>Emitted(48, 204) Source(65, 9) + SourceIndex(0) +14>Emitted(48, 247) Source(65, 38) + SourceIndex(0) +15>Emitted(48, 249) Source(66, 9) + SourceIndex(0) +16>Emitted(48, 268) Source(66, 44) + SourceIndex(0) +17>Emitted(48, 270) Source(66, 9) + SourceIndex(0) +18>Emitted(48, 317) Source(66, 44) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > + > } = { primary: "noSkill", secondary: "noSkill" } + >} of multiRobots) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(49, 5) Source(69, 5) + SourceIndex(0) +2 >Emitted(49, 12) Source(69, 12) + SourceIndex(0) +3 >Emitted(49, 13) Source(69, 13) + SourceIndex(0) +4 >Emitted(49, 16) Source(69, 16) + SourceIndex(0) +5 >Emitted(49, 17) Source(69, 17) + SourceIndex(0) +6 >Emitted(49, 22) Source(69, 22) + SourceIndex(0) +7 >Emitted(49, 23) Source(69, 23) + SourceIndex(0) +8 >Emitted(49, 24) Source(69, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(50, 2) Source(70, 2) + SourceIndex(0) +--- +>>>for (var _21 = 0, _22 = getMultiRobots(); _21 < _22.length; _21++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^ +8 > ^^^^^^^^^^^^^^ +9 > ^^ +10> ^^ +11> ^^^^^^^^^^^^^^^^ +12> ^^ +13> ^^^^^ +14> ^ +15> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > (let { + > name: nameA = "noName", + > skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "noSkill", secondary: "noSkill" } + > } of +5 > getMultiRobots() +6 > +7 > +8 > getMultiRobots +9 > () +10> +11> getMultiRobots() +12> +13> getMultiRobots() +14> ) +1->Emitted(51, 1) Source(71, 1) + SourceIndex(0) +2 >Emitted(51, 4) Source(71, 4) + SourceIndex(0) +3 >Emitted(51, 5) Source(71, 5) + SourceIndex(0) +4 >Emitted(51, 6) Source(77, 6) + SourceIndex(0) +5 >Emitted(51, 17) Source(77, 22) + SourceIndex(0) +6 >Emitted(51, 19) Source(77, 6) + SourceIndex(0) +7 >Emitted(51, 25) Source(77, 6) + SourceIndex(0) +8 >Emitted(51, 39) Source(77, 20) + SourceIndex(0) +9 >Emitted(51, 41) Source(77, 22) + SourceIndex(0) +10>Emitted(51, 43) Source(77, 6) + SourceIndex(0) +11>Emitted(51, 59) Source(77, 22) + SourceIndex(0) +12>Emitted(51, 61) Source(77, 6) + SourceIndex(0) +13>Emitted(51, 66) Source(77, 22) + SourceIndex(0) +14>Emitted(51, 67) Source(77, 23) + SourceIndex(0) +--- +>>> var _23 = _22[_21], _24 = _23.name, nameA = _24 === void 0 ? "noName" : _24, _25 = _23.skills, _26 = _25 === void 0 ? { primary: "noSkill", secondary: "noSkill" } : _25, _27 = _26.primary, primaryA = _27 === void 0 ? "primary" : _27, _28 = _26.secondary, secondaryA = _28 === void 0 ? "secondary" : _28; +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +15> ^^ +16> ^^^^^^^^^^^^^^^^^^^ +17> ^^ +18> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > let { + > name: nameA = "noName", + > skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "noSkill", secondary: "noSkill" } + > } +3 > +4 > name: nameA = "noName" +5 > +6 > name: nameA = "noName" +7 > , + > +8 > skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "noSkill", secondary: "noSkill" } +9 > +10> skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "noSkill", secondary: "noSkill" } +11> +12> primary: primaryA = "primary" +13> +14> primary: primaryA = "primary" +15> , + > +16> secondary: secondaryA = "secondary" +17> +18> secondary: secondaryA = "secondary" +1->Emitted(52, 5) Source(71, 6) + SourceIndex(0) +2 >Emitted(52, 23) Source(77, 2) + SourceIndex(0) +3 >Emitted(52, 25) Source(72, 5) + SourceIndex(0) +4 >Emitted(52, 39) Source(72, 27) + SourceIndex(0) +5 >Emitted(52, 41) Source(72, 5) + SourceIndex(0) +6 >Emitted(52, 80) Source(72, 27) + SourceIndex(0) +7 >Emitted(52, 82) Source(73, 5) + SourceIndex(0) +8 >Emitted(52, 98) Source(76, 53) + SourceIndex(0) +9 >Emitted(52, 100) Source(73, 5) + SourceIndex(0) +10>Emitted(52, 173) Source(76, 53) + SourceIndex(0) +11>Emitted(52, 175) Source(74, 9) + SourceIndex(0) +12>Emitted(52, 192) Source(74, 38) + SourceIndex(0) +13>Emitted(52, 194) Source(74, 9) + SourceIndex(0) +14>Emitted(52, 237) Source(74, 38) + SourceIndex(0) +15>Emitted(52, 239) Source(75, 9) + SourceIndex(0) +16>Emitted(52, 258) Source(75, 44) + SourceIndex(0) +17>Emitted(52, 260) Source(75, 9) + SourceIndex(0) +18>Emitted(52, 307) Source(75, 44) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > + > } = { primary: "noSkill", secondary: "noSkill" } + >} of getMultiRobots()) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(53, 5) Source(78, 5) + SourceIndex(0) +2 >Emitted(53, 12) Source(78, 12) + SourceIndex(0) +3 >Emitted(53, 13) Source(78, 13) + SourceIndex(0) +4 >Emitted(53, 16) Source(78, 16) + SourceIndex(0) +5 >Emitted(53, 17) Source(78, 17) + SourceIndex(0) +6 >Emitted(53, 22) Source(78, 22) + SourceIndex(0) +7 >Emitted(53, 23) Source(78, 23) + SourceIndex(0) +8 >Emitted(53, 24) Source(78, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(54, 2) Source(79, 2) + SourceIndex(0) +--- +>>>for (var _29 = 0, _30 = [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^ +8 > ^ +9 > ^^ +10> ^^^^ +11> ^^ +12> ^^^^^^^ +13> ^^ +14> ^^^^^^ +15> ^^ +16> ^^ +17> ^^^^^^^ +18> ^^ +19> ^^^^^^^^ +20> ^^ +21> ^^^^^^^^^ +22> ^^ +23> ^^^^^^ +24> ^^ +25> ^^ +26> ^^^^^^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > (let { + > name: nameA = "noName", + > skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "noSkill", secondary: "noSkill" } + > } of +5 > [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] +6 > +7 > +8 > [ +9 > { +10> name +11> : +12> "mower" +13> , +14> skills +15> : +16> { +17> primary +18> : +19> "mowing" +20> , +21> secondary +22> : +23> "none" +24> } +25> } +1->Emitted(55, 1) Source(80, 1) + SourceIndex(0) +2 >Emitted(55, 4) Source(80, 4) + SourceIndex(0) +3 >Emitted(55, 5) Source(80, 5) + SourceIndex(0) +4 >Emitted(55, 6) Source(86, 6) + SourceIndex(0) +5 >Emitted(55, 17) Source(87, 79) + SourceIndex(0) +6 >Emitted(55, 19) Source(86, 6) + SourceIndex(0) +7 >Emitted(55, 25) Source(86, 20) + SourceIndex(0) +8 >Emitted(55, 26) Source(86, 21) + SourceIndex(0) +9 >Emitted(55, 28) Source(86, 23) + SourceIndex(0) +10>Emitted(55, 32) Source(86, 27) + SourceIndex(0) +11>Emitted(55, 34) Source(86, 29) + SourceIndex(0) +12>Emitted(55, 41) Source(86, 36) + SourceIndex(0) +13>Emitted(55, 43) Source(86, 38) + SourceIndex(0) +14>Emitted(55, 49) Source(86, 44) + SourceIndex(0) +15>Emitted(55, 51) Source(86, 46) + SourceIndex(0) +16>Emitted(55, 53) Source(86, 48) + SourceIndex(0) +17>Emitted(55, 60) Source(86, 55) + SourceIndex(0) +18>Emitted(55, 62) Source(86, 57) + SourceIndex(0) +19>Emitted(55, 70) Source(86, 65) + SourceIndex(0) +20>Emitted(55, 72) Source(86, 67) + SourceIndex(0) +21>Emitted(55, 81) Source(86, 76) + SourceIndex(0) +22>Emitted(55, 83) Source(86, 78) + SourceIndex(0) +23>Emitted(55, 89) Source(86, 84) + SourceIndex(0) +24>Emitted(55, 91) Source(86, 86) + SourceIndex(0) +25>Emitted(55, 93) Source(86, 88) + SourceIndex(0) +--- +>>> { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]; _29 < _30.length; _29++) { +1->^^^^ +2 > ^^ +3 > ^^^^ +4 > ^^ +5 > ^^^^^^^^^ +6 > ^^ +7 > ^^^^^^ +8 > ^^ +9 > ^^ +10> ^^^^^^^ +11> ^^ +12> ^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^ +15> ^^ +16> ^^^^^^^^ +17> ^^ +18> ^^ +19> ^ +20> ^^ +21> ^^^^^^^^^^^^^^^^ +22> ^^ +23> ^^^^^ +24> ^ +25> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1->, + > +2 > { +3 > name +4 > : +5 > "trimmer" +6 > , +7 > skills +8 > : +9 > { +10> primary +11> : +12> "trimming" +13> , +14> secondary +15> : +16> "edging" +17> } +18> } +19> ] +20> +21> [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] +22> +23> [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] +24> ) +1->Emitted(56, 5) Source(87, 5) + SourceIndex(0) +2 >Emitted(56, 7) Source(87, 7) + SourceIndex(0) +3 >Emitted(56, 11) Source(87, 11) + SourceIndex(0) +4 >Emitted(56, 13) Source(87, 13) + SourceIndex(0) +5 >Emitted(56, 22) Source(87, 22) + SourceIndex(0) +6 >Emitted(56, 24) Source(87, 24) + SourceIndex(0) +7 >Emitted(56, 30) Source(87, 30) + SourceIndex(0) +8 >Emitted(56, 32) Source(87, 32) + SourceIndex(0) +9 >Emitted(56, 34) Source(87, 34) + SourceIndex(0) +10>Emitted(56, 41) Source(87, 41) + SourceIndex(0) +11>Emitted(56, 43) Source(87, 43) + SourceIndex(0) +12>Emitted(56, 53) Source(87, 53) + SourceIndex(0) +13>Emitted(56, 55) Source(87, 55) + SourceIndex(0) +14>Emitted(56, 64) Source(87, 64) + SourceIndex(0) +15>Emitted(56, 66) Source(87, 66) + SourceIndex(0) +16>Emitted(56, 74) Source(87, 74) + SourceIndex(0) +17>Emitted(56, 76) Source(87, 76) + SourceIndex(0) +18>Emitted(56, 78) Source(87, 78) + SourceIndex(0) +19>Emitted(56, 79) Source(87, 79) + SourceIndex(0) +20>Emitted(56, 81) Source(86, 6) + SourceIndex(0) +21>Emitted(56, 97) Source(87, 79) + SourceIndex(0) +22>Emitted(56, 99) Source(86, 6) + SourceIndex(0) +23>Emitted(56, 104) Source(87, 79) + SourceIndex(0) +24>Emitted(56, 105) Source(87, 80) + SourceIndex(0) +--- +>>> var _31 = _30[_29], _32 = _31.name, nameA = _32 === void 0 ? "noName" : _32, _33 = _31.skills, _34 = _33 === void 0 ? { primary: "noSkill", secondary: "noSkill" } : _33, _35 = _34.primary, primaryA = _35 === void 0 ? "primary" : _35, _36 = _34.secondary, secondaryA = _36 === void 0 ? "secondary" : _36; +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +15> ^^ +16> ^^^^^^^^^^^^^^^^^^^ +17> ^^ +18> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > let { + > name: nameA = "noName", + > skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "noSkill", secondary: "noSkill" } + > } +3 > +4 > name: nameA = "noName" +5 > +6 > name: nameA = "noName" +7 > , + > +8 > skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "noSkill", secondary: "noSkill" } +9 > +10> skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "noSkill", secondary: "noSkill" } +11> +12> primary: primaryA = "primary" +13> +14> primary: primaryA = "primary" +15> , + > +16> secondary: secondaryA = "secondary" +17> +18> secondary: secondaryA = "secondary" +1->Emitted(57, 5) Source(80, 6) + SourceIndex(0) +2 >Emitted(57, 23) Source(86, 2) + SourceIndex(0) +3 >Emitted(57, 25) Source(81, 5) + SourceIndex(0) +4 >Emitted(57, 39) Source(81, 27) + SourceIndex(0) +5 >Emitted(57, 41) Source(81, 5) + SourceIndex(0) +6 >Emitted(57, 80) Source(81, 27) + SourceIndex(0) +7 >Emitted(57, 82) Source(82, 5) + SourceIndex(0) +8 >Emitted(57, 98) Source(85, 53) + SourceIndex(0) +9 >Emitted(57, 100) Source(82, 5) + SourceIndex(0) +10>Emitted(57, 173) Source(85, 53) + SourceIndex(0) +11>Emitted(57, 175) Source(83, 9) + SourceIndex(0) +12>Emitted(57, 192) Source(83, 38) + SourceIndex(0) +13>Emitted(57, 194) Source(83, 9) + SourceIndex(0) +14>Emitted(57, 237) Source(83, 38) + SourceIndex(0) +15>Emitted(57, 239) Source(84, 9) + SourceIndex(0) +16>Emitted(57, 258) Source(84, 44) + SourceIndex(0) +17>Emitted(57, 260) Source(84, 9) + SourceIndex(0) +18>Emitted(57, 307) Source(84, 44) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > + > } = { primary: "noSkill", secondary: "noSkill" } + >} of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(58, 5) Source(88, 5) + SourceIndex(0) +2 >Emitted(58, 12) Source(88, 12) + SourceIndex(0) +3 >Emitted(58, 13) Source(88, 13) + SourceIndex(0) +4 >Emitted(58, 16) Source(88, 16) + SourceIndex(0) +5 >Emitted(58, 17) Source(88, 17) + SourceIndex(0) +6 >Emitted(58, 22) Source(88, 22) + SourceIndex(0) +7 >Emitted(58, 23) Source(88, 23) + SourceIndex(0) +8 >Emitted(58, 24) Source(88, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(59, 2) Source(89, 2) + SourceIndex(0) +--- +>>>//# sourceMappingURL=sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.symbols b/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.symbols new file mode 100644 index 00000000000..bf3cbd59e0b --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.symbols @@ -0,0 +1,314 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts === +declare var console: { +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 0, 11)) + + log(msg: any): void; +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 0, 22)) +>msg : Symbol(msg, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 1, 8)) +} +interface Robot { +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 2, 1)) + + name: string; +>name : Symbol(Robot.name, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 3, 17)) + + skill: string; +>skill : Symbol(Robot.skill, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 4, 17)) +} + +interface MultiRobot { +>MultiRobot : Symbol(MultiRobot, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 6, 1)) + + name: string; +>name : Symbol(MultiRobot.name, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 8, 22)) + + skills: { +>skills : Symbol(MultiRobot.skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 9, 17)) + + primary?: string; +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 10, 13)) + + secondary?: string; +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 11, 25)) + + }; +} + +let robots: Robot[] = [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]; +>robots : Symbol(robots, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 16, 3)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 2, 1)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 16, 24)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 16, 39)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 16, 60)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 16, 77)) + +let multiRobots: MultiRobot[] = [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, +>multiRobots : Symbol(multiRobots, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 17, 3)) +>MultiRobot : Symbol(MultiRobot, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 6, 1)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 17, 34)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 17, 49)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 17, 59)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 17, 78)) + + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]; +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 18, 5)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 18, 22)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 18, 32)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 18, 53)) + +function getRobots() { +>getRobots : Symbol(getRobots, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 18, 79)) + + return robots; +>robots : Symbol(robots, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 16, 3)) +} + +function getMultiRobots() { +>getMultiRobots : Symbol(getMultiRobots, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 22, 1)) + + return multiRobots; +>multiRobots : Symbol(multiRobots, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 17, 3)) +} + +for (let {name: nameA = "noName" } of robots) { +>name : Symbol(Robot.name, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 3, 17)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 28, 10)) +>robots : Symbol(robots, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 16, 3)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 28, 10)) +} +for (let {name: nameA = "noName" } of getRobots()) { +>name : Symbol(Robot.name, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 3, 17)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 31, 10)) +>getRobots : Symbol(getRobots, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 18, 79)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 31, 10)) +} +for (let {name: nameA = "noName" } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 34, 40)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 34, 10)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 34, 40)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 34, 55)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 34, 76)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 34, 93)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 34, 10)) +} +for (let { skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = +>skills : Symbol(MultiRobot.skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 9, 17)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 10, 13)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 37, 20)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 11, 25)) +>secondaryA : Symbol(secondaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 37, 51)) + + { primary: "nosKill", secondary: "noSkill" } } of multiRobots) { +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 38, 5)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 38, 25)) +>multiRobots : Symbol(multiRobots, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 17, 3)) + + console.log(primaryA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 0, 22)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 37, 20)) +} +for (let { skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = +>skills : Symbol(MultiRobot.skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 9, 17)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 10, 13)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 41, 20)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 11, 25)) +>secondaryA : Symbol(secondaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 41, 51)) + + { primary: "nosKill", secondary: "noSkill" } } of getMultiRobots()) { +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 42, 5)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 42, 25)) +>getMultiRobots : Symbol(getMultiRobots, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 22, 1)) + + console.log(primaryA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 0, 22)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 41, 20)) +} +for (let { skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = +>skills : Symbol(MultiRobot.skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 9, 17)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 10, 13)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 45, 20)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 11, 25)) +>secondaryA : Symbol(secondaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 45, 51)) + + { primary: "nosKill", secondary: "noSkill" } } of +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 46, 5)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 46, 25)) + + [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, +>MultiRobot : Symbol(MultiRobot, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 6, 1)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 47, 20)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 47, 35)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 47, 45)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 47, 64)) + + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 48, 5)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 48, 22)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 48, 32)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 48, 53)) + + console.log(primaryA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 0, 22)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 45, 20)) +} + +for (let {name: nameA = "noName", skill: skillA = "noSkill" } of robots) { +>name : Symbol(Robot.name, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 3, 17)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 52, 10)) +>skill : Symbol(Robot.skill, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 4, 17)) +>skillA : Symbol(skillA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 52, 33)) +>robots : Symbol(robots, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 16, 3)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 52, 10)) +} +for (let {name: nameA = "noName", skill: skillA = "noSkill" } of getRobots()) { +>name : Symbol(Robot.name, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 3, 17)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 55, 10)) +>skill : Symbol(Robot.skill, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 4, 17)) +>skillA : Symbol(skillA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 55, 33)) +>getRobots : Symbol(getRobots, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 18, 79)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 55, 10)) +} +for (let {name: nameA = "noName", skill: skillA = "noSkill" } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 58, 68)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 58, 10)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 58, 83)) +>skillA : Symbol(skillA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 58, 33)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 58, 68)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 58, 83)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 58, 104)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 58, 121)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 58, 10)) +} +for (let { + name: nameA = "noName", +>name : Symbol(MultiRobot.name, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 8, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 61, 10)) + + skills: { +>skills : Symbol(MultiRobot.skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 9, 17)) + + primary: primaryA = "primary", +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 10, 13)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 63, 13)) + + secondary: secondaryA = "secondary" +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 11, 25)) +>secondaryA : Symbol(secondaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 64, 38)) + + } = { primary: "noSkill", secondary: "noSkill" } +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 66, 9)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 66, 29)) + +} of multiRobots) { +>multiRobots : Symbol(multiRobots, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 17, 3)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 61, 10)) +} +for (let { + name: nameA = "noName", +>name : Symbol(MultiRobot.name, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 8, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 70, 10)) + + skills: { +>skills : Symbol(MultiRobot.skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 9, 17)) + + primary: primaryA = "primary", +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 10, 13)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 72, 13)) + + secondary: secondaryA = "secondary" +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 11, 25)) +>secondaryA : Symbol(secondaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 73, 38)) + + } = { primary: "noSkill", secondary: "noSkill" } +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 75, 9)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 75, 29)) + +} of getMultiRobots()) { +>getMultiRobots : Symbol(getMultiRobots, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 22, 1)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 70, 10)) +} +for (let { + name: nameA = "noName", +>name : Symbol(MultiRobot.name, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 8, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 79, 10)) + + skills: { +>skills : Symbol(MultiRobot.skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 9, 17)) + + primary: primaryA = "primary", +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 10, 13)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 81, 13)) + + secondary: secondaryA = "secondary" +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 11, 25)) +>secondaryA : Symbol(secondaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 82, 38)) + + } = { primary: "noSkill", secondary: "noSkill" } +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 84, 9)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 84, 29)) + +} of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, +>MultiRobot : Symbol(MultiRobot, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 6, 1)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 85, 21)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 85, 36)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 85, 46)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 85, 65)) + + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 86, 5)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 86, 22)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 86, 32)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 86, 53)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 79, 10)) +} diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.types b/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.types new file mode 100644 index 00000000000..36f67f946f0 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.types @@ -0,0 +1,428 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts === +declare var console: { +>console : { log(msg: any): void; } + + log(msg: any): void; +>log : (msg: any) => void +>msg : any +} +interface Robot { +>Robot : Robot + + name: string; +>name : string + + skill: string; +>skill : string +} + +interface MultiRobot { +>MultiRobot : MultiRobot + + name: string; +>name : string + + skills: { +>skills : { primary?: string; secondary?: string; } + + primary?: string; +>primary : string + + secondary?: string; +>secondary : string + + }; +} + +let robots: Robot[] = [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]; +>robots : Robot[] +>Robot : Robot +>[{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }] : { name: string; skill: string; }[] +>{ name: "mower", skill: "mowing" } : { name: string; skill: string; } +>name : string +>"mower" : string +>skill : string +>"mowing" : string +>{ name: "trimmer", skill: "trimming" } : { name: string; skill: string; } +>name : string +>"trimmer" : string +>skill : string +>"trimming" : string + +let multiRobots: MultiRobot[] = [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, +>multiRobots : MultiRobot[] +>MultiRobot : MultiRobot +>[{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] : { name: string; skills: { primary: string; secondary: string; }; }[] +>{ name: "mower", skills: { primary: "mowing", secondary: "none" } } : { name: string; skills: { primary: string; secondary: string; }; } +>name : string +>"mower" : string +>skills : { primary: string; secondary: string; } +>{ primary: "mowing", secondary: "none" } : { primary: string; secondary: string; } +>primary : string +>"mowing" : string +>secondary : string +>"none" : string + + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]; +>{ name: "trimmer", skills: { primary: "trimming", secondary: "edging" } } : { name: string; skills: { primary: string; secondary: string; }; } +>name : string +>"trimmer" : string +>skills : { primary: string; secondary: string; } +>{ primary: "trimming", secondary: "edging" } : { primary: string; secondary: string; } +>primary : string +>"trimming" : string +>secondary : string +>"edging" : string + +function getRobots() { +>getRobots : () => Robot[] + + return robots; +>robots : Robot[] +} + +function getMultiRobots() { +>getMultiRobots : () => MultiRobot[] + + return multiRobots; +>multiRobots : MultiRobot[] +} + +for (let {name: nameA = "noName" } of robots) { +>name : any +>nameA : string +>"noName" : string +>robots : Robot[] + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for (let {name: nameA = "noName" } of getRobots()) { +>name : any +>nameA : string +>"noName" : string +>getRobots() : Robot[] +>getRobots : () => Robot[] + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for (let {name: nameA = "noName" } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { +>name : any +>nameA : string +>"noName" : string +>[{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }] : { name: string; skill: string; }[] +>{ name: "mower", skill: "mowing" } : { name: string; skill: string; } +>name : string +>"mower" : string +>skill : string +>"mowing" : string +>{ name: "trimmer", skill: "trimming" } : { name: string; skill: string; } +>name : string +>"trimmer" : string +>skill : string +>"trimming" : string + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for (let { skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = +>skills : any +>primary : any +>primaryA : string +>"primary" : string +>secondary : any +>secondaryA : string +>"secondary" : string + + { primary: "nosKill", secondary: "noSkill" } } of multiRobots) { +>{ primary: "nosKill", secondary: "noSkill" } : { primary?: string; secondary?: string; } +>primary : string +>"nosKill" : string +>secondary : string +>"noSkill" : string +>multiRobots : MultiRobot[] + + console.log(primaryA); +>console.log(primaryA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primaryA : string +} +for (let { skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = +>skills : any +>primary : any +>primaryA : string +>"primary" : string +>secondary : any +>secondaryA : string +>"secondary" : string + + { primary: "nosKill", secondary: "noSkill" } } of getMultiRobots()) { +>{ primary: "nosKill", secondary: "noSkill" } : { primary?: string; secondary?: string; } +>primary : string +>"nosKill" : string +>secondary : string +>"noSkill" : string +>getMultiRobots() : MultiRobot[] +>getMultiRobots : () => MultiRobot[] + + console.log(primaryA); +>console.log(primaryA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primaryA : string +} +for (let { skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = +>skills : any +>primary : any +>primaryA : string +>"primary" : string +>secondary : any +>secondaryA : string +>"secondary" : string + + { primary: "nosKill", secondary: "noSkill" } } of +>{ primary: "nosKill", secondary: "noSkill" } : { primary?: string; secondary?: string; } +>primary : string +>"nosKill" : string +>secondary : string +>"noSkill" : string + + [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, +>[{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] : MultiRobot[] +>MultiRobot : MultiRobot +>[{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] : { name: string; skills: { primary: string; secondary: string; }; }[] +>{ name: "mower", skills: { primary: "mowing", secondary: "none" } } : { name: string; skills: { primary: string; secondary: string; }; } +>name : string +>"mower" : string +>skills : { primary: string; secondary: string; } +>{ primary: "mowing", secondary: "none" } : { primary: string; secondary: string; } +>primary : string +>"mowing" : string +>secondary : string +>"none" : string + + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { +>{ name: "trimmer", skills: { primary: "trimming", secondary: "edging" } } : { name: string; skills: { primary: string; secondary: string; }; } +>name : string +>"trimmer" : string +>skills : { primary: string; secondary: string; } +>{ primary: "trimming", secondary: "edging" } : { primary: string; secondary: string; } +>primary : string +>"trimming" : string +>secondary : string +>"edging" : string + + console.log(primaryA); +>console.log(primaryA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primaryA : string +} + +for (let {name: nameA = "noName", skill: skillA = "noSkill" } of robots) { +>name : any +>nameA : string +>"noName" : string +>skill : any +>skillA : string +>"noSkill" : string +>robots : Robot[] + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for (let {name: nameA = "noName", skill: skillA = "noSkill" } of getRobots()) { +>name : any +>nameA : string +>"noName" : string +>skill : any +>skillA : string +>"noSkill" : string +>getRobots() : Robot[] +>getRobots : () => Robot[] + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for (let {name: nameA = "noName", skill: skillA = "noSkill" } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { +>name : any +>nameA : string +>"noName" : string +>skill : any +>skillA : string +>"noSkill" : string +>[{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }] : { name: string; skill: string; }[] +>{ name: "mower", skill: "mowing" } : { name: string; skill: string; } +>name : string +>"mower" : string +>skill : string +>"mowing" : string +>{ name: "trimmer", skill: "trimming" } : { name: string; skill: string; } +>name : string +>"trimmer" : string +>skill : string +>"trimming" : string + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for (let { + name: nameA = "noName", +>name : any +>nameA : string +>"noName" : string + + skills: { +>skills : any + + primary: primaryA = "primary", +>primary : any +>primaryA : string +>"primary" : string + + secondary: secondaryA = "secondary" +>secondary : any +>secondaryA : string +>"secondary" : string + + } = { primary: "noSkill", secondary: "noSkill" } +>{ primary: "noSkill", secondary: "noSkill" } : { primary?: string; secondary?: string; } +>primary : string +>"noSkill" : string +>secondary : string +>"noSkill" : string + +} of multiRobots) { +>multiRobots : MultiRobot[] + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for (let { + name: nameA = "noName", +>name : any +>nameA : string +>"noName" : string + + skills: { +>skills : any + + primary: primaryA = "primary", +>primary : any +>primaryA : string +>"primary" : string + + secondary: secondaryA = "secondary" +>secondary : any +>secondaryA : string +>"secondary" : string + + } = { primary: "noSkill", secondary: "noSkill" } +>{ primary: "noSkill", secondary: "noSkill" } : { primary?: string; secondary?: string; } +>primary : string +>"noSkill" : string +>secondary : string +>"noSkill" : string + +} of getMultiRobots()) { +>getMultiRobots() : MultiRobot[] +>getMultiRobots : () => MultiRobot[] + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for (let { + name: nameA = "noName", +>name : any +>nameA : string +>"noName" : string + + skills: { +>skills : any + + primary: primaryA = "primary", +>primary : any +>primaryA : string +>"primary" : string + + secondary: secondaryA = "secondary" +>secondary : any +>secondaryA : string +>"secondary" : string + + } = { primary: "noSkill", secondary: "noSkill" } +>{ primary: "noSkill", secondary: "noSkill" } : { primary?: string; secondary?: string; } +>primary : string +>"noSkill" : string +>secondary : string +>"noSkill" : string + +} of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, +>[{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] : MultiRobot[] +>MultiRobot : MultiRobot +>[{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] : { name: string; skills: { primary: string; secondary: string; }; }[] +>{ name: "mower", skills: { primary: "mowing", secondary: "none" } } : { name: string; skills: { primary: string; secondary: string; }; } +>name : string +>"mower" : string +>skills : { primary: string; secondary: string; } +>{ primary: "mowing", secondary: "none" } : { primary: string; secondary: string; } +>primary : string +>"mowing" : string +>secondary : string +>"none" : string + + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { +>{ name: "trimmer", skills: { primary: "trimming", secondary: "edging" } } : { name: string; skills: { primary: string; secondary: string; }; } +>name : string +>"trimmer" : string +>skills : { primary: string; secondary: string; } +>{ primary: "trimming", secondary: "edging" } : { primary: string; secondary: string; } +>primary : string +>"trimming" : string +>secondary : string +>"edging" : string + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.js b/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.js new file mode 100644 index 00000000000..1e18159d3d4 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.js @@ -0,0 +1,282 @@ +//// [sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts] +declare var console: { + log(msg: any): void; +} +interface Robot { + name: string; + skill: string; +} + +interface MultiRobot { + name: string; + skills: { + primary: string; + secondary: string; + }; +} + +let robots: Robot[] = [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]; +let multiRobots: MultiRobot[] = [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]; + +function getRobots() { + return robots; +} + +function getMultiRobots() { + return multiRobots; +} + +let nameA: string, primaryA: string, secondaryA: string, i: number, skillA: string; +let name: string, primary: string, secondary: string, skill: string; + +for ({name: nameA = "noName" } of robots) { + console.log(nameA); +} +for ({name: nameA = "noName" } of getRobots()) { + console.log(nameA); +} +for ({name: nameA = "noName" } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { + console.log(nameA); +} +for ({ skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = + { primary: "nosKill", secondary: "noSkill" } } of multiRobots) { + console.log(primaryA); +} +for ({ skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = + { primary: "nosKill", secondary: "noSkill" } } of getMultiRobots()) { + console.log(primaryA); +} +for ({ skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = + { primary: "nosKill", secondary: "noSkill" } } of + [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { + console.log(primaryA); +} + +for ({ name = "noName" } of robots) { + console.log(nameA); +} +for ({ name = "noName" } of getRobots()) { + console.log(nameA); +} +for ({ name = "noName" } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { + console.log(nameA); +} +for ({ + skills: { + primary = "primary", + secondary = "secondary" + } = { primary: "noSkill", secondary: "noSkill" } +} of multiRobots) { + console.log(primaryA); +} +for ({ + skills: { + primary = "primary", + secondary = "secondary" + } = { primary: "noSkill", secondary: "noSkill" } +} of getMultiRobots()) { + console.log(primaryA); +} +for ({ + skills: { + primary = "primary", + secondary = "secondary" + } = { primary: "noSkill", secondary: "noSkill" } +} of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { + console.log(primaryA); +} + + +for ({name: nameA = "noName", skill: skillA = "noSkill" } of robots) { + console.log(nameA); +} +for ({name: nameA = "noName", skill: skillA = "noSkill" } of getRobots()) { + console.log(nameA); +} +for ({name: nameA = "noName", skill: skillA = "noSkill" } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { + console.log(nameA); +} +for ({ + name: nameA = "noName", + skills: { + primary: primaryA = "primary", + secondary: secondaryA = "secondary" + } = { primary: "noSkill", secondary: "noSkill" } +} of multiRobots) { + console.log(nameA); +} +for ({ + name: nameA = "noName", + skills: { + primary: primaryA = "primary", + secondary: secondaryA = "secondary" + } = { primary: "noSkill", secondary: "noSkill" } +} of getMultiRobots()) { + console.log(nameA); +} +for ({ + name: nameA = "noName", + skills: { + primary: primaryA = "primary", + secondary: secondaryA = "secondary" + } = { primary: "noSkill", secondary: "noSkill" } +} of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { + console.log(nameA); +} + +for ({ name = "noName", skill = "noSkill" } of robots) { + console.log(nameA); +} +for ({ name = "noName", skill = "noSkill" } of getRobots()) { + console.log(nameA); +} +for ({ name = "noName", skill = "noSkill" } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { + console.log(nameA); +} +for ({ + name = "noName", + skills: { + primary = "primary", + secondary = "secondary" + } = { primary: "noSkill", secondary: "noSkill" } +} of multiRobots) { + console.log(nameA); +} +for ({ + name = "noName", + skills: { + primary = "primary", + secondary = "secondary" + } = { primary: "noSkill", secondary: "noSkill" } +} of getMultiRobots()) { + console.log(nameA); +} +for ({ + name = "noName", + skills: { + primary = "primary", + secondary = "secondary" + } = { primary: "noSkill", secondary: "noSkill" } +} of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { + console.log(nameA); +} + +//// [sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.js] +var robots = [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]; +var multiRobots = [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]; +function getRobots() { + return robots; +} +function getMultiRobots() { + return multiRobots; +} +var nameA, primaryA, secondaryA, i, skillA; +var name, primary, secondary, skill; +for (var _i = 0, robots_1 = robots; _i < robots_1.length; _i++) { + _a = robots_1[_i].name, nameA = _a === void 0 ? "noName" : _a; + console.log(nameA); +} +for (var _b = 0, _c = getRobots(); _b < _c.length; _b++) { + _d = _c[_b].name, nameA = _d === void 0 ? "noName" : _d; + console.log(nameA); +} +for (var _e = 0, _f = [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]; _e < _f.length; _e++) { + _g = _f[_e].name, nameA = _g === void 0 ? "noName" : _g; + console.log(nameA); +} +for (var _h = 0, multiRobots_1 = multiRobots; _h < multiRobots_1.length; _h++) { + _j = multiRobots_1[_h].skills, _k = _j === void 0 ? { primary: "nosKill", secondary: "noSkill" } : _j, _l = _k.primary, primaryA = _l === void 0 ? "primary" : _l, _m = _k.secondary, secondaryA = _m === void 0 ? "secondary" : _m; + console.log(primaryA); +} +for (var _o = 0, _p = getMultiRobots(); _o < _p.length; _o++) { + _q = _p[_o].skills, _r = _q === void 0 ? { primary: "nosKill", secondary: "noSkill" } : _q, _s = _r.primary, primaryA = _s === void 0 ? "primary" : _s, _t = _r.secondary, secondaryA = _t === void 0 ? "secondary" : _t; + console.log(primaryA); +} +for (var _u = 0, _v = [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]; _u < _v.length; _u++) { + _w = _v[_u].skills, _x = _w === void 0 ? { primary: "nosKill", secondary: "noSkill" } : _w, _y = _x.primary, primaryA = _y === void 0 ? "primary" : _y, _z = _x.secondary, secondaryA = _z === void 0 ? "secondary" : _z; + console.log(primaryA); +} +for (var _0 = 0, robots_2 = robots; _0 < robots_2.length; _0++) { + _1 = robots_2[_0].name, name = _1 === void 0 ? "noName" : _1; + console.log(nameA); +} +for (var _2 = 0, _3 = getRobots(); _2 < _3.length; _2++) { + _4 = _3[_2].name, name = _4 === void 0 ? "noName" : _4; + console.log(nameA); +} +for (var _5 = 0, _6 = [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]; _5 < _6.length; _5++) { + _7 = _6[_5].name, name = _7 === void 0 ? "noName" : _7; + console.log(nameA); +} +for (var _8 = 0, multiRobots_2 = multiRobots; _8 < multiRobots_2.length; _8++) { + _9 = multiRobots_2[_8].skills, _10 = _9 === void 0 ? { primary: "noSkill", secondary: "noSkill" } : _9, _11 = _10.primary, primary = _11 === void 0 ? "primary" : _11, _12 = _10.secondary, secondary = _12 === void 0 ? "secondary" : _12; + console.log(primaryA); +} +for (var _13 = 0, _14 = getMultiRobots(); _13 < _14.length; _13++) { + _15 = _14[_13].skills, _16 = _15 === void 0 ? { primary: "noSkill", secondary: "noSkill" } : _15, _17 = _16.primary, primary = _17 === void 0 ? "primary" : _17, _18 = _16.secondary, secondary = _18 === void 0 ? "secondary" : _18; + console.log(primaryA); +} +for (var _19 = 0, _20 = [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]; _19 < _20.length; _19++) { + _21 = _20[_19].skills, _22 = _21 === void 0 ? { primary: "noSkill", secondary: "noSkill" } : _21, _23 = _22.primary, primary = _23 === void 0 ? "primary" : _23, _24 = _22.secondary, secondary = _24 === void 0 ? "secondary" : _24; + console.log(primaryA); +} +for (var _25 = 0, robots_3 = robots; _25 < robots_3.length; _25++) { + _26 = robots_3[_25], _27 = _26.name, nameA = _27 === void 0 ? "noName" : _27, _28 = _26.skill, skillA = _28 === void 0 ? "noSkill" : _28; + console.log(nameA); +} +for (var _29 = 0, _30 = getRobots(); _29 < _30.length; _29++) { + _31 = _30[_29], _32 = _31.name, nameA = _32 === void 0 ? "noName" : _32, _33 = _31.skill, skillA = _33 === void 0 ? "noSkill" : _33; + console.log(nameA); +} +for (var _34 = 0, _35 = [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]; _34 < _35.length; _34++) { + _36 = _35[_34], _37 = _36.name, nameA = _37 === void 0 ? "noName" : _37, _38 = _36.skill, skillA = _38 === void 0 ? "noSkill" : _38; + console.log(nameA); +} +for (var _39 = 0, multiRobots_3 = multiRobots; _39 < multiRobots_3.length; _39++) { + _40 = multiRobots_3[_39], _41 = _40.name, nameA = _41 === void 0 ? "noName" : _41, _42 = _40.skills, _43 = _42 === void 0 ? { primary: "noSkill", secondary: "noSkill" } : _42, _44 = _43.primary, primaryA = _44 === void 0 ? "primary" : _44, _45 = _43.secondary, secondaryA = _45 === void 0 ? "secondary" : _45; + console.log(nameA); +} +for (var _46 = 0, _47 = getMultiRobots(); _46 < _47.length; _46++) { + _48 = _47[_46], _49 = _48.name, nameA = _49 === void 0 ? "noName" : _49, _50 = _48.skills, _51 = _50 === void 0 ? { primary: "noSkill", secondary: "noSkill" } : _50, _52 = _51.primary, primaryA = _52 === void 0 ? "primary" : _52, _53 = _51.secondary, secondaryA = _53 === void 0 ? "secondary" : _53; + console.log(nameA); +} +for (var _54 = 0, _55 = [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]; _54 < _55.length; _54++) { + _56 = _55[_54], _57 = _56.name, nameA = _57 === void 0 ? "noName" : _57, _58 = _56.skills, _59 = _58 === void 0 ? { primary: "noSkill", secondary: "noSkill" } : _58, _60 = _59.primary, primaryA = _60 === void 0 ? "primary" : _60, _61 = _59.secondary, secondaryA = _61 === void 0 ? "secondary" : _61; + console.log(nameA); +} +for (var _62 = 0, robots_4 = robots; _62 < robots_4.length; _62++) { + _63 = robots_4[_62], _64 = _63.name, name = _64 === void 0 ? "noName" : _64, _65 = _63.skill, skill = _65 === void 0 ? "noSkill" : _65; + console.log(nameA); +} +for (var _66 = 0, _67 = getRobots(); _66 < _67.length; _66++) { + _68 = _67[_66], _69 = _68.name, name = _69 === void 0 ? "noName" : _69, _70 = _68.skill, skill = _70 === void 0 ? "noSkill" : _70; + console.log(nameA); +} +for (var _71 = 0, _72 = [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]; _71 < _72.length; _71++) { + _73 = _72[_71], _74 = _73.name, name = _74 === void 0 ? "noName" : _74, _75 = _73.skill, skill = _75 === void 0 ? "noSkill" : _75; + console.log(nameA); +} +for (var _76 = 0, multiRobots_4 = multiRobots; _76 < multiRobots_4.length; _76++) { + _77 = multiRobots_4[_76], _78 = _77.name, name = _78 === void 0 ? "noName" : _78, _79 = _77.skills, _80 = _79 === void 0 ? { primary: "noSkill", secondary: "noSkill" } : _79, _81 = _80.primary, primary = _81 === void 0 ? "primary" : _81, _82 = _80.secondary, secondary = _82 === void 0 ? "secondary" : _82; + console.log(nameA); +} +for (var _83 = 0, _84 = getMultiRobots(); _83 < _84.length; _83++) { + _85 = _84[_83], _86 = _85.name, name = _86 === void 0 ? "noName" : _86, _87 = _85.skills, _88 = _87 === void 0 ? { primary: "noSkill", secondary: "noSkill" } : _87, _89 = _88.primary, primary = _89 === void 0 ? "primary" : _89, _90 = _88.secondary, secondary = _90 === void 0 ? "secondary" : _90; + console.log(nameA); +} +for (var _91 = 0, _92 = [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]; _91 < _92.length; _91++) { + _93 = _92[_91], _94 = _93.name, name = _94 === void 0 ? "noName" : _94, _95 = _93.skills, _96 = _95 === void 0 ? { primary: "noSkill", secondary: "noSkill" } : _95, _97 = _96.primary, primary = _97 === void 0 ? "primary" : _97, _98 = _96.secondary, secondary = _98 === void 0 ? "secondary" : _98; + console.log(nameA); +} +var _a, _d, _g, _j, _k, _l, _m, _q, _r, _s, _t, _w, _x, _y, _z, _1, _4, _7, _9, _10, _11, _12, _15, _16, _17, _18, _21, _22, _23, _24, _26, _27, _28, _31, _32, _33, _36, _37, _38, _40, _41, _42, _43, _44, _45, _48, _49, _50, _51, _52, _53, _56, _57, _58, _59, _60, _61, _63, _64, _65, _68, _69, _70, _73, _74, _75, _77, _78, _79, _80, _81, _82, _85, _86, _87, _88, _89, _90, _93, _94, _95, _96, _97, _98; +//# sourceMappingURL=sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.js.map b/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.js.map new file mode 100644 index 00000000000..0529919c803 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.js.map @@ -0,0 +1,2 @@ +//// [sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.js.map] +{"version":3,"file":"sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.js","sourceRoot":"","sources":["sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts"],"names":[],"mappings":"AAgBA,IAAI,MAAM,GAAY,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAC;AACnG,IAAI,WAAW,GAAiB,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE;IAChG,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAC;AAE/E;IACI,MAAM,CAAC,MAAM,CAAC;AAClB,CAAC;AAED;IACI,MAAM,CAAC,WAAW,CAAC;AACvB,CAAC;AAED,IAAI,KAAa,EAAE,QAAgB,EAAE,UAAkB,EAAE,CAAS,EAAE,MAAc,CAAC;AACnF,IAAI,IAAY,EAAE,OAAe,EAAE,SAAiB,EAAE,KAAa,CAAC;AAEpE,GAAG,CAAC,CAA8B,UAAM,EAAN,iBAAM,EAAN,oBAAM,EAAN,IAAM,CAAC;IAAnC,sBAAsB,EAAtB,qCAAsB;IACxB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB;AACD,GAAG,CAAC,CAA8B,UAAW,EAAX,KAAA,SAAS,EAAE,EAAX,cAAW,EAAX,IAAW,CAAC;IAAxC,gBAAsB,EAAtB,qCAAsB;IACxB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB;AACD,GAAG,CAAC,CAA8B,UAA4E,EAA5E,MAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,EAA5E,cAA4E,EAA5E,IAA4E,CAAC;IAAzG,gBAAsB,EAAtB,qCAAsB;IACxB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB;AACD,GAAG,CAAC,CACkD,UAAW,EAAX,2BAAW,EAAX,yBAAW,EAAX,IAAW,CAAC;IAD3D,6BACyC,EADzC,sEACyC,EAD/B,eAA6B,EAA7B,yCAA6B,EAAE,iBAAmC,EAAnC,6CAAmC;IAE/E,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;CACzB;AACD,GAAG,CAAC,CACkD,UAAgB,EAAhB,KAAA,cAAc,EAAE,EAAhB,cAAgB,EAAhB,IAAgB,CAAC;IADhE,kBACyC,EADzC,sEACyC,EAD/B,eAA6B,EAA7B,yCAA6B,EAAE,iBAAmC,EAAnC,6CAAmC;IAE/E,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;CACzB;AACD,GAAG,CAAC,CAEA,UAC8E,EAD9E,KAAc,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE;IAC9E,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,CAAC,EAD9E,cAC8E,EAD9E,IAC8E,CAAC;IAH5E,kBACyC,EADzC,sEACyC,EAD/B,eAA6B,EAA7B,yCAA6B,EAAE,iBAAmC,EAAnC,6CAAmC;IAI/E,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;CACzB;AAED,GAAG,CAAC,CAAwB,UAAM,EAAN,iBAAM,EAAN,oBAAM,EAAN,IAAM,CAAC;IAA5B,sBAAe,EAAf,oCAAe;IAClB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB;AACD,GAAG,CAAC,CAAwB,UAAW,EAAX,KAAA,SAAS,EAAE,EAAX,cAAW,EAAX,IAAW,CAAC;IAAjC,gBAAe,EAAf,oCAAe;IAClB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB;AACD,GAAG,CAAC,CAAwB,UAA4E,EAA5E,MAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,EAA5E,cAA4E,EAA5E,IAA4E,CAAC;IAAlG,gBAAe,EAAf,oCAAe;IAClB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB;AACD,GAAG,CAAC,CAKC,UAAW,EAAX,2BAAW,EAAX,yBAAW,EAAX,IAAW,CAAC;IAJb,6BAGgD,EAHhD,uEAGgD,EAF5C,iBAAmB,EAAnB,0CAAmB,EACnB,mBAAuB,EAAvB,8CAAuB;IAG3B,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;CACzB;AACD,GAAG,CAAC,CAKC,WAAgB,EAAhB,MAAA,cAAc,EAAE,EAAhB,gBAAgB,EAAhB,KAAgB,CAAC;IAJlB,qBAGgD,EAHhD,yEAGgD,EAF5C,iBAAmB,EAAnB,0CAAmB,EACnB,mBAAuB,EAAvB,8CAAuB;IAG3B,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;CACzB;AACD,GAAG,CAAC,CAKC,WACyE,EADzE,OAAC,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE;IACrE,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,CAAC,EADzE,gBACyE,EADzE,KACyE,CAAC;IAL3E,qBAGgD,EAHhD,yEAGgD,EAF5C,iBAAmB,EAAnB,0CAAmB,EACnB,mBAAuB,EAAvB,8CAAuB;IAI3B,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;CACzB;AAGD,GAAG,CAAC,CAAyD,WAAM,EAAN,iBAAM,EAAN,qBAAM,EAAN,KAAM,CAAC;IAA/D,mBAAoD,EAAnD,cAAsB,EAAtB,uCAAsB,EAAE,eAAyB,EAAzB,yCAAyB;IACnD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB;AACD,GAAG,CAAC,CAA0D,WAAW,EAAX,MAAA,SAAS,EAAE,EAAX,gBAAW,EAAX,KAAW,CAAC;IAArE,cAAqD,EAApD,cAAsB,EAAtB,uCAAsB,EAAE,eAAyB,EAAzB,yCAAyB;IACnD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB;AACD,GAAG,CAAC,CAA0D,WAA4E,EAA5E,OAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,EAA5E,gBAA4E,EAA5E,KAA4E,CAAC;IAAtI,cAAqD,EAApD,cAAsB,EAAtB,uCAAsB,EAAE,eAAyB,EAAzB,yCAAyB;IACnD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB;AACD,GAAG,CAAC,CAMC,WAAW,EAAX,2BAAW,EAAX,0BAAW,EAAX,KAAW,CAAC;IANZ,wBAMJ,EALG,cAAsB,EAAtB,uCAAsB,EACtB,gBAGgD,EAHhD,yEAGgD,EAF5C,iBAA6B,EAA7B,2CAA6B,EAC7B,mBAAmC,EAAnC,+CAAmC;IAGvC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB;AACD,GAAG,CAAC,CAMC,WAAgB,EAAhB,MAAA,cAAc,EAAE,EAAhB,gBAAgB,EAAhB,KAAgB,CAAC;IANjB,cAMJ,EALG,cAAsB,EAAtB,uCAAsB,EACtB,gBAGgD,EAHhD,yEAGgD,EAF5C,iBAA6B,EAA7B,2CAA6B,EAC7B,mBAAmC,EAAnC,+CAAmC;IAGvC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB;AACD,GAAG,CAAC,CAMC,WACyE,EADzE,MAAc,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE;IACnF,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,CAAC,EADzE,gBACyE,EADzE,KACyE,CAAC;IAP1E,cAMJ,EALG,cAAsB,EAAtB,uCAAsB,EACtB,gBAGgD,EAHhD,yEAGgD,EAF5C,iBAA6B,EAA7B,2CAA6B,EAC7B,mBAAmC,EAAnC,+CAAmC;IAIvC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB;AAED,GAAG,CAAC,CAA4C,WAAM,EAAN,iBAAM,EAAN,qBAAM,EAAN,KAAM,CAAC;IAAlD,mBAAuC,EAArC,cAAe,EAAf,sCAAe,EAAE,eAAkB,EAAlB,wCAAkB;IACtC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB;AACD,GAAG,CAAC,CAA4C,WAAW,EAAX,MAAA,SAAS,EAAE,EAAX,gBAAW,EAAX,KAAW,CAAC;IAAvD,cAAuC,EAArC,cAAe,EAAf,sCAAe,EAAE,eAAiB,EAAjB,wCAAiB;IACrC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB;AACD,GAAG,CAAC,CAA4C,WAA4E,EAA5E,OAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,EAA5E,gBAA4E,EAA5E,KAA4E,CAAC;IAAxH,cAAuC,EAArC,cAAe,EAAf,sCAAe,EAAE,eAAkB,EAAlB,wCAAkB;IACtC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB;AACD,GAAG,CAAC,CAMC,WAAW,EAAX,2BAAW,EAAX,0BAAW,EAAX,KAAW,CAAC;IANZ,wBAMJ,EALG,cAAe,EAAf,sCAAe,EACf,gBAGgD,EAHhD,yEAGgD,EAF5C,iBAAmB,EAAnB,0CAAmB,EACnB,mBAAuB,EAAvB,8CAAuB;IAG3B,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB;AACD,GAAG,CAAC,CAMC,WAAgB,EAAhB,MAAA,cAAc,EAAE,EAAhB,gBAAgB,EAAhB,KAAgB,CAAC;IANjB,cAMJ,EALG,cAAe,EAAf,sCAAe,EACf,gBAGgD,EAHhD,yEAGgD,EAF5C,iBAAmB,EAAnB,0CAAmB,EACnB,mBAAuB,EAAvB,8CAAuB;IAG3B,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB;AACD,GAAG,CAAC,CAMC,WACyE,EADzE,OAAC,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE;IACrE,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,CAAC,EADzE,gBACyE,EADzE,KACyE,CAAC;IAP1E,cAMJ,EALG,cAAe,EAAf,sCAAe,EACf,gBAGgD,EAHhD,yEAGgD,EAF5C,iBAAmB,EAAnB,0CAAmB,EACnB,mBAAuB,EAAvB,8CAAuB;IAI3B,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;CACtB"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.sourcemap.txt b/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.sourcemap.txt new file mode 100644 index 00000000000..f80a065e9ce --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.sourcemap.txt @@ -0,0 +1,3951 @@ +=================================================================== +JsFile: sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.js +mapUrl: sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.js.map +sourceRoot: +sources: sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.js +sourceFile:sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts +------------------------------------------------------------------- +>>>var robots = [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]; +1 > +2 >^^^^ +3 > ^^^^^^ +4 > ^^^ +5 > ^ +6 > ^^ +7 > ^^^^ +8 > ^^ +9 > ^^^^^^^ +10> ^^ +11> ^^^^^ +12> ^^ +13> ^^^^^^^^ +14> ^^ +15> ^^ +16> ^^ +17> ^^^^ +18> ^^ +19> ^^^^^^^^^ +20> ^^ +21> ^^^^^ +22> ^^ +23> ^^^^^^^^^^ +24> ^^ +25> ^ +26> ^ +1 >declare var console: { + > log(msg: any): void; + >} + >interface Robot { + > name: string; + > skill: string; + >} + > + >interface MultiRobot { + > name: string; + > skills: { + > primary: string; + > secondary: string; + > }; + >} + > + > +2 >let +3 > robots +4 > : Robot[] = +5 > [ +6 > { +7 > name +8 > : +9 > "mower" +10> , +11> skill +12> : +13> "mowing" +14> } +15> , +16> { +17> name +18> : +19> "trimmer" +20> , +21> skill +22> : +23> "trimming" +24> } +25> ] +26> ; +1 >Emitted(1, 1) Source(17, 1) + SourceIndex(0) +2 >Emitted(1, 5) Source(17, 5) + SourceIndex(0) +3 >Emitted(1, 11) Source(17, 11) + SourceIndex(0) +4 >Emitted(1, 14) Source(17, 23) + SourceIndex(0) +5 >Emitted(1, 15) Source(17, 24) + SourceIndex(0) +6 >Emitted(1, 17) Source(17, 26) + SourceIndex(0) +7 >Emitted(1, 21) Source(17, 30) + SourceIndex(0) +8 >Emitted(1, 23) Source(17, 32) + SourceIndex(0) +9 >Emitted(1, 30) Source(17, 39) + SourceIndex(0) +10>Emitted(1, 32) Source(17, 41) + SourceIndex(0) +11>Emitted(1, 37) Source(17, 46) + SourceIndex(0) +12>Emitted(1, 39) Source(17, 48) + SourceIndex(0) +13>Emitted(1, 47) Source(17, 56) + SourceIndex(0) +14>Emitted(1, 49) Source(17, 58) + SourceIndex(0) +15>Emitted(1, 51) Source(17, 60) + SourceIndex(0) +16>Emitted(1, 53) Source(17, 62) + SourceIndex(0) +17>Emitted(1, 57) Source(17, 66) + SourceIndex(0) +18>Emitted(1, 59) Source(17, 68) + SourceIndex(0) +19>Emitted(1, 68) Source(17, 77) + SourceIndex(0) +20>Emitted(1, 70) Source(17, 79) + SourceIndex(0) +21>Emitted(1, 75) Source(17, 84) + SourceIndex(0) +22>Emitted(1, 77) Source(17, 86) + SourceIndex(0) +23>Emitted(1, 87) Source(17, 96) + SourceIndex(0) +24>Emitted(1, 89) Source(17, 98) + SourceIndex(0) +25>Emitted(1, 90) Source(17, 99) + SourceIndex(0) +26>Emitted(1, 91) Source(17, 100) + SourceIndex(0) +--- +>>>var multiRobots = [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, +1 > +2 >^^^^ +3 > ^^^^^^^^^^^ +4 > ^^^ +5 > ^ +6 > ^^ +7 > ^^^^ +8 > ^^ +9 > ^^^^^^^ +10> ^^ +11> ^^^^^^ +12> ^^ +13> ^^ +14> ^^^^^^^ +15> ^^ +16> ^^^^^^^^ +17> ^^ +18> ^^^^^^^^^ +19> ^^ +20> ^^^^^^ +21> ^^ +22> ^^ +1 > + > +2 >let +3 > multiRobots +4 > : MultiRobot[] = +5 > [ +6 > { +7 > name +8 > : +9 > "mower" +10> , +11> skills +12> : +13> { +14> primary +15> : +16> "mowing" +17> , +18> secondary +19> : +20> "none" +21> } +22> } +1 >Emitted(2, 1) Source(18, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(18, 5) + SourceIndex(0) +3 >Emitted(2, 16) Source(18, 16) + SourceIndex(0) +4 >Emitted(2, 19) Source(18, 33) + SourceIndex(0) +5 >Emitted(2, 20) Source(18, 34) + SourceIndex(0) +6 >Emitted(2, 22) Source(18, 36) + SourceIndex(0) +7 >Emitted(2, 26) Source(18, 40) + SourceIndex(0) +8 >Emitted(2, 28) Source(18, 42) + SourceIndex(0) +9 >Emitted(2, 35) Source(18, 49) + SourceIndex(0) +10>Emitted(2, 37) Source(18, 51) + SourceIndex(0) +11>Emitted(2, 43) Source(18, 57) + SourceIndex(0) +12>Emitted(2, 45) Source(18, 59) + SourceIndex(0) +13>Emitted(2, 47) Source(18, 61) + SourceIndex(0) +14>Emitted(2, 54) Source(18, 68) + SourceIndex(0) +15>Emitted(2, 56) Source(18, 70) + SourceIndex(0) +16>Emitted(2, 64) Source(18, 78) + SourceIndex(0) +17>Emitted(2, 66) Source(18, 80) + SourceIndex(0) +18>Emitted(2, 75) Source(18, 89) + SourceIndex(0) +19>Emitted(2, 77) Source(18, 91) + SourceIndex(0) +20>Emitted(2, 83) Source(18, 97) + SourceIndex(0) +21>Emitted(2, 85) Source(18, 99) + SourceIndex(0) +22>Emitted(2, 87) Source(18, 101) + SourceIndex(0) +--- +>>> { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]; +1 >^^^^ +2 > ^^ +3 > ^^^^ +4 > ^^ +5 > ^^^^^^^^^ +6 > ^^ +7 > ^^^^^^ +8 > ^^ +9 > ^^ +10> ^^^^^^^ +11> ^^ +12> ^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^ +15> ^^ +16> ^^^^^^^^ +17> ^^ +18> ^^ +19> ^ +20> ^ +1 >, + > +2 > { +3 > name +4 > : +5 > "trimmer" +6 > , +7 > skills +8 > : +9 > { +10> primary +11> : +12> "trimming" +13> , +14> secondary +15> : +16> "edging" +17> } +18> } +19> ] +20> ; +1 >Emitted(3, 5) Source(19, 5) + SourceIndex(0) +2 >Emitted(3, 7) Source(19, 7) + SourceIndex(0) +3 >Emitted(3, 11) Source(19, 11) + SourceIndex(0) +4 >Emitted(3, 13) Source(19, 13) + SourceIndex(0) +5 >Emitted(3, 22) Source(19, 22) + SourceIndex(0) +6 >Emitted(3, 24) Source(19, 24) + SourceIndex(0) +7 >Emitted(3, 30) Source(19, 30) + SourceIndex(0) +8 >Emitted(3, 32) Source(19, 32) + SourceIndex(0) +9 >Emitted(3, 34) Source(19, 34) + SourceIndex(0) +10>Emitted(3, 41) Source(19, 41) + SourceIndex(0) +11>Emitted(3, 43) Source(19, 43) + SourceIndex(0) +12>Emitted(3, 53) Source(19, 53) + SourceIndex(0) +13>Emitted(3, 55) Source(19, 55) + SourceIndex(0) +14>Emitted(3, 64) Source(19, 64) + SourceIndex(0) +15>Emitted(3, 66) Source(19, 66) + SourceIndex(0) +16>Emitted(3, 74) Source(19, 74) + SourceIndex(0) +17>Emitted(3, 76) Source(19, 76) + SourceIndex(0) +18>Emitted(3, 78) Source(19, 78) + SourceIndex(0) +19>Emitted(3, 79) Source(19, 79) + SourceIndex(0) +20>Emitted(3, 80) Source(19, 80) + SourceIndex(0) +--- +>>>function getRobots() { +1 > +2 >^^^^^^^^^^^^^^^^^^^-> +1 > + > + > +1 >Emitted(4, 1) Source(21, 1) + SourceIndex(0) +--- +>>> return robots; +1->^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^ +5 > ^ +1->function getRobots() { + > +2 > return +3 > +4 > robots +5 > ; +1->Emitted(5, 5) Source(22, 5) + SourceIndex(0) +2 >Emitted(5, 11) Source(22, 11) + SourceIndex(0) +3 >Emitted(5, 12) Source(22, 12) + SourceIndex(0) +4 >Emitted(5, 18) Source(22, 18) + SourceIndex(0) +5 >Emitted(5, 19) Source(22, 19) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(6, 1) Source(23, 1) + SourceIndex(0) +2 >Emitted(6, 2) Source(23, 2) + SourceIndex(0) +--- +>>>function getMultiRobots() { +1-> +2 >^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > + > +1->Emitted(7, 1) Source(25, 1) + SourceIndex(0) +--- +>>> return multiRobots; +1->^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^ +5 > ^ +1->function getMultiRobots() { + > +2 > return +3 > +4 > multiRobots +5 > ; +1->Emitted(8, 5) Source(26, 5) + SourceIndex(0) +2 >Emitted(8, 11) Source(26, 11) + SourceIndex(0) +3 >Emitted(8, 12) Source(26, 12) + SourceIndex(0) +4 >Emitted(8, 23) Source(26, 23) + SourceIndex(0) +5 >Emitted(8, 24) Source(26, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(9, 1) Source(27, 1) + SourceIndex(0) +2 >Emitted(9, 2) Source(27, 2) + SourceIndex(0) +--- +>>>var nameA, primaryA, secondaryA, i, skillA; +1-> +2 >^^^^ +3 > ^^^^^ +4 > ^^ +5 > ^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^ +8 > ^^ +9 > ^ +10> ^^ +11> ^^^^^^ +12> ^ +1-> + > + > +2 >let +3 > nameA: string +4 > , +5 > primaryA: string +6 > , +7 > secondaryA: string +8 > , +9 > i: number +10> , +11> skillA: string +12> ; +1->Emitted(10, 1) Source(29, 1) + SourceIndex(0) +2 >Emitted(10, 5) Source(29, 5) + SourceIndex(0) +3 >Emitted(10, 10) Source(29, 18) + SourceIndex(0) +4 >Emitted(10, 12) Source(29, 20) + SourceIndex(0) +5 >Emitted(10, 20) Source(29, 36) + SourceIndex(0) +6 >Emitted(10, 22) Source(29, 38) + SourceIndex(0) +7 >Emitted(10, 32) Source(29, 56) + SourceIndex(0) +8 >Emitted(10, 34) Source(29, 58) + SourceIndex(0) +9 >Emitted(10, 35) Source(29, 67) + SourceIndex(0) +10>Emitted(10, 37) Source(29, 69) + SourceIndex(0) +11>Emitted(10, 43) Source(29, 83) + SourceIndex(0) +12>Emitted(10, 44) Source(29, 84) + SourceIndex(0) +--- +>>>var name, primary, secondary, skill; +1 > +2 >^^^^ +3 > ^^^^ +4 > ^^ +5 > ^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^ +8 > ^^ +9 > ^^^^^ +10> ^ +11> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >let +3 > name: string +4 > , +5 > primary: string +6 > , +7 > secondary: string +8 > , +9 > skill: string +10> ; +1 >Emitted(11, 1) Source(30, 1) + SourceIndex(0) +2 >Emitted(11, 5) Source(30, 5) + SourceIndex(0) +3 >Emitted(11, 9) Source(30, 17) + SourceIndex(0) +4 >Emitted(11, 11) Source(30, 19) + SourceIndex(0) +5 >Emitted(11, 18) Source(30, 34) + SourceIndex(0) +6 >Emitted(11, 20) Source(30, 36) + SourceIndex(0) +7 >Emitted(11, 29) Source(30, 53) + SourceIndex(0) +8 >Emitted(11, 31) Source(30, 55) + SourceIndex(0) +9 >Emitted(11, 36) Source(30, 68) + SourceIndex(0) +10>Emitted(11, 37) Source(30, 69) + SourceIndex(0) +--- +>>>for (var _i = 0, robots_1 = robots; _i < robots_1.length; _i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^^^^^^ +10> ^^ +11> ^^^^ +12> ^ +13> ^^^^-> +1-> + > + > +2 >for +3 > +4 > ({name: nameA = "noName" } of +5 > robots +6 > +7 > robots +8 > +9 > robots +10> +11> robots +12> ) +1->Emitted(12, 1) Source(32, 1) + SourceIndex(0) +2 >Emitted(12, 4) Source(32, 4) + SourceIndex(0) +3 >Emitted(12, 5) Source(32, 5) + SourceIndex(0) +4 >Emitted(12, 6) Source(32, 35) + SourceIndex(0) +5 >Emitted(12, 16) Source(32, 41) + SourceIndex(0) +6 >Emitted(12, 18) Source(32, 35) + SourceIndex(0) +7 >Emitted(12, 35) Source(32, 41) + SourceIndex(0) +8 >Emitted(12, 37) Source(32, 35) + SourceIndex(0) +9 >Emitted(12, 57) Source(32, 41) + SourceIndex(0) +10>Emitted(12, 59) Source(32, 35) + SourceIndex(0) +11>Emitted(12, 63) Source(32, 41) + SourceIndex(0) +12>Emitted(12, 64) Source(32, 42) + SourceIndex(0) +--- +>>> _a = robots_1[_i].name, nameA = _a === void 0 ? "noName" : _a; +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > name: nameA = "noName" +3 > +4 > name: nameA = "noName" +1->Emitted(13, 5) Source(32, 7) + SourceIndex(0) +2 >Emitted(13, 27) Source(32, 29) + SourceIndex(0) +3 >Emitted(13, 29) Source(32, 7) + SourceIndex(0) +4 >Emitted(13, 66) Source(32, 29) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > } of robots) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(14, 5) Source(33, 5) + SourceIndex(0) +2 >Emitted(14, 12) Source(33, 12) + SourceIndex(0) +3 >Emitted(14, 13) Source(33, 13) + SourceIndex(0) +4 >Emitted(14, 16) Source(33, 16) + SourceIndex(0) +5 >Emitted(14, 17) Source(33, 17) + SourceIndex(0) +6 >Emitted(14, 22) Source(33, 22) + SourceIndex(0) +7 >Emitted(14, 23) Source(33, 23) + SourceIndex(0) +8 >Emitted(14, 24) Source(33, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(15, 2) Source(34, 2) + SourceIndex(0) +--- +>>>for (var _b = 0, _c = getRobots(); _b < _c.length; _b++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^ +8 > ^^^^^^^^^ +9 > ^^ +10> ^^ +11> ^^^^^^^^^^^^^^ +12> ^^ +13> ^^^^ +14> ^ +15> ^^^^^-> +1-> + > +2 >for +3 > +4 > ({name: nameA = "noName" } of +5 > getRobots() +6 > +7 > +8 > getRobots +9 > () +10> +11> getRobots() +12> +13> getRobots() +14> ) +1->Emitted(16, 1) Source(35, 1) + SourceIndex(0) +2 >Emitted(16, 4) Source(35, 4) + SourceIndex(0) +3 >Emitted(16, 5) Source(35, 5) + SourceIndex(0) +4 >Emitted(16, 6) Source(35, 35) + SourceIndex(0) +5 >Emitted(16, 16) Source(35, 46) + SourceIndex(0) +6 >Emitted(16, 18) Source(35, 35) + SourceIndex(0) +7 >Emitted(16, 23) Source(35, 35) + SourceIndex(0) +8 >Emitted(16, 32) Source(35, 44) + SourceIndex(0) +9 >Emitted(16, 34) Source(35, 46) + SourceIndex(0) +10>Emitted(16, 36) Source(35, 35) + SourceIndex(0) +11>Emitted(16, 50) Source(35, 46) + SourceIndex(0) +12>Emitted(16, 52) Source(35, 35) + SourceIndex(0) +13>Emitted(16, 56) Source(35, 46) + SourceIndex(0) +14>Emitted(16, 57) Source(35, 47) + SourceIndex(0) +--- +>>> _d = _c[_b].name, nameA = _d === void 0 ? "noName" : _d; +1->^^^^ +2 > ^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > name: nameA = "noName" +3 > +4 > name: nameA = "noName" +1->Emitted(17, 5) Source(35, 7) + SourceIndex(0) +2 >Emitted(17, 21) Source(35, 29) + SourceIndex(0) +3 >Emitted(17, 23) Source(35, 7) + SourceIndex(0) +4 >Emitted(17, 60) Source(35, 29) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > } of getRobots()) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(18, 5) Source(36, 5) + SourceIndex(0) +2 >Emitted(18, 12) Source(36, 12) + SourceIndex(0) +3 >Emitted(18, 13) Source(36, 13) + SourceIndex(0) +4 >Emitted(18, 16) Source(36, 16) + SourceIndex(0) +5 >Emitted(18, 17) Source(36, 17) + SourceIndex(0) +6 >Emitted(18, 22) Source(36, 22) + SourceIndex(0) +7 >Emitted(18, 23) Source(36, 23) + SourceIndex(0) +8 >Emitted(18, 24) Source(36, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(19, 2) Source(37, 2) + SourceIndex(0) +--- +>>>for (var _e = 0, _f = [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]; _e < _f.length; _e++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^ +8 > ^^ +9 > ^^^^ +10> ^^ +11> ^^^^^^^ +12> ^^ +13> ^^^^^ +14> ^^ +15> ^^^^^^^^ +16> ^^ +17> ^^ +18> ^^ +19> ^^^^ +20> ^^ +21> ^^^^^^^^^ +22> ^^ +23> ^^^^^ +24> ^^ +25> ^^^^^^^^^^ +26> ^^ +27> ^ +28> ^^ +29> ^^^^^^^^^^^^^^ +30> ^^ +31> ^^^^ +32> ^ +1-> + > +2 >for +3 > +4 > ({name: nameA = "noName" } of +5 > [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }] +6 > +7 > [ +8 > { +9 > name +10> : +11> "mower" +12> , +13> skill +14> : +15> "mowing" +16> } +17> , +18> { +19> name +20> : +21> "trimmer" +22> , +23> skill +24> : +25> "trimming" +26> } +27> ] +28> +29> [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }] +30> +31> [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }] +32> ) +1->Emitted(20, 1) Source(38, 1) + SourceIndex(0) +2 >Emitted(20, 4) Source(38, 4) + SourceIndex(0) +3 >Emitted(20, 5) Source(38, 5) + SourceIndex(0) +4 >Emitted(20, 6) Source(38, 35) + SourceIndex(0) +5 >Emitted(20, 16) Source(38, 111) + SourceIndex(0) +6 >Emitted(20, 18) Source(38, 35) + SourceIndex(0) +7 >Emitted(20, 24) Source(38, 36) + SourceIndex(0) +8 >Emitted(20, 26) Source(38, 38) + SourceIndex(0) +9 >Emitted(20, 30) Source(38, 42) + SourceIndex(0) +10>Emitted(20, 32) Source(38, 44) + SourceIndex(0) +11>Emitted(20, 39) Source(38, 51) + SourceIndex(0) +12>Emitted(20, 41) Source(38, 53) + SourceIndex(0) +13>Emitted(20, 46) Source(38, 58) + SourceIndex(0) +14>Emitted(20, 48) Source(38, 60) + SourceIndex(0) +15>Emitted(20, 56) Source(38, 68) + SourceIndex(0) +16>Emitted(20, 58) Source(38, 70) + SourceIndex(0) +17>Emitted(20, 60) Source(38, 72) + SourceIndex(0) +18>Emitted(20, 62) Source(38, 74) + SourceIndex(0) +19>Emitted(20, 66) Source(38, 78) + SourceIndex(0) +20>Emitted(20, 68) Source(38, 80) + SourceIndex(0) +21>Emitted(20, 77) Source(38, 89) + SourceIndex(0) +22>Emitted(20, 79) Source(38, 91) + SourceIndex(0) +23>Emitted(20, 84) Source(38, 96) + SourceIndex(0) +24>Emitted(20, 86) Source(38, 98) + SourceIndex(0) +25>Emitted(20, 96) Source(38, 108) + SourceIndex(0) +26>Emitted(20, 98) Source(38, 110) + SourceIndex(0) +27>Emitted(20, 99) Source(38, 111) + SourceIndex(0) +28>Emitted(20, 101) Source(38, 35) + SourceIndex(0) +29>Emitted(20, 115) Source(38, 111) + SourceIndex(0) +30>Emitted(20, 117) Source(38, 35) + SourceIndex(0) +31>Emitted(20, 121) Source(38, 111) + SourceIndex(0) +32>Emitted(20, 122) Source(38, 112) + SourceIndex(0) +--- +>>> _g = _f[_e].name, nameA = _g === void 0 ? "noName" : _g; +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 > name: nameA = "noName" +3 > +4 > name: nameA = "noName" +1 >Emitted(21, 5) Source(38, 7) + SourceIndex(0) +2 >Emitted(21, 21) Source(38, 29) + SourceIndex(0) +3 >Emitted(21, 23) Source(38, 7) + SourceIndex(0) +4 >Emitted(21, 60) Source(38, 29) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(22, 5) Source(39, 5) + SourceIndex(0) +2 >Emitted(22, 12) Source(39, 12) + SourceIndex(0) +3 >Emitted(22, 13) Source(39, 13) + SourceIndex(0) +4 >Emitted(22, 16) Source(39, 16) + SourceIndex(0) +5 >Emitted(22, 17) Source(39, 17) + SourceIndex(0) +6 >Emitted(22, 22) Source(39, 22) + SourceIndex(0) +7 >Emitted(22, 23) Source(39, 23) + SourceIndex(0) +8 >Emitted(22, 24) Source(39, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(23, 2) Source(40, 2) + SourceIndex(0) +--- +>>>for (var _h = 0, multiRobots_1 = multiRobots; _h < multiRobots_1.length; _h++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^^^^^^^^^^^ +10> ^^ +11> ^^^^ +12> ^ +13> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > ({ skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = + > { primary: "nosKill", secondary: "noSkill" } } of +5 > multiRobots +6 > +7 > multiRobots +8 > +9 > multiRobots +10> +11> multiRobots +12> ) +1->Emitted(24, 1) Source(41, 1) + SourceIndex(0) +2 >Emitted(24, 4) Source(41, 4) + SourceIndex(0) +3 >Emitted(24, 5) Source(41, 5) + SourceIndex(0) +4 >Emitted(24, 6) Source(42, 55) + SourceIndex(0) +5 >Emitted(24, 16) Source(42, 66) + SourceIndex(0) +6 >Emitted(24, 18) Source(42, 55) + SourceIndex(0) +7 >Emitted(24, 45) Source(42, 66) + SourceIndex(0) +8 >Emitted(24, 47) Source(42, 55) + SourceIndex(0) +9 >Emitted(24, 72) Source(42, 66) + SourceIndex(0) +10>Emitted(24, 74) Source(42, 55) + SourceIndex(0) +11>Emitted(24, 78) Source(42, 66) + SourceIndex(0) +12>Emitted(24, 79) Source(42, 67) + SourceIndex(0) +--- +>>> _j = multiRobots_1[_h].skills, _k = _j === void 0 ? { primary: "nosKill", secondary: "noSkill" } : _j, _l = _k.primary, primaryA = _l === void 0 ? "primary" : _l, _m = _k.secondary, secondaryA = _m === void 0 ? "secondary" : _m; +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = + > { primary: "nosKill", secondary: "noSkill" } +3 > +4 > skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = + > { primary: "nosKill", secondary: "noSkill" } +5 > +6 > primary: primaryA = "primary" +7 > +8 > primary: primaryA = "primary" +9 > , +10> secondary: secondaryA = "secondary" +11> +12> secondary: secondaryA = "secondary" +1->Emitted(25, 5) Source(41, 8) + SourceIndex(0) +2 >Emitted(25, 34) Source(42, 49) + SourceIndex(0) +3 >Emitted(25, 36) Source(41, 8) + SourceIndex(0) +4 >Emitted(25, 106) Source(42, 49) + SourceIndex(0) +5 >Emitted(25, 108) Source(41, 18) + SourceIndex(0) +6 >Emitted(25, 123) Source(41, 47) + SourceIndex(0) +7 >Emitted(25, 125) Source(41, 18) + SourceIndex(0) +8 >Emitted(25, 166) Source(41, 47) + SourceIndex(0) +9 >Emitted(25, 168) Source(41, 49) + SourceIndex(0) +10>Emitted(25, 185) Source(41, 84) + SourceIndex(0) +11>Emitted(25, 187) Source(41, 49) + SourceIndex(0) +12>Emitted(25, 232) Source(41, 84) + SourceIndex(0) +--- +>>> console.log(primaryA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1 > } = + > { primary: "nosKill", secondary: "noSkill" } } of multiRobots) { + > +2 > console +3 > . +4 > log +5 > ( +6 > primaryA +7 > ) +8 > ; +1 >Emitted(26, 5) Source(43, 5) + SourceIndex(0) +2 >Emitted(26, 12) Source(43, 12) + SourceIndex(0) +3 >Emitted(26, 13) Source(43, 13) + SourceIndex(0) +4 >Emitted(26, 16) Source(43, 16) + SourceIndex(0) +5 >Emitted(26, 17) Source(43, 17) + SourceIndex(0) +6 >Emitted(26, 25) Source(43, 25) + SourceIndex(0) +7 >Emitted(26, 26) Source(43, 26) + SourceIndex(0) +8 >Emitted(26, 27) Source(43, 27) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(27, 2) Source(44, 2) + SourceIndex(0) +--- +>>>for (var _o = 0, _p = getMultiRobots(); _o < _p.length; _o++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^ +8 > ^^^^^^^^^^^^^^ +9 > ^^ +10> ^^ +11> ^^^^^^^^^^^^^^ +12> ^^ +13> ^^^^ +14> ^ +15> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > ({ skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = + > { primary: "nosKill", secondary: "noSkill" } } of +5 > getMultiRobots() +6 > +7 > +8 > getMultiRobots +9 > () +10> +11> getMultiRobots() +12> +13> getMultiRobots() +14> ) +1->Emitted(28, 1) Source(45, 1) + SourceIndex(0) +2 >Emitted(28, 4) Source(45, 4) + SourceIndex(0) +3 >Emitted(28, 5) Source(45, 5) + SourceIndex(0) +4 >Emitted(28, 6) Source(46, 55) + SourceIndex(0) +5 >Emitted(28, 16) Source(46, 71) + SourceIndex(0) +6 >Emitted(28, 18) Source(46, 55) + SourceIndex(0) +7 >Emitted(28, 23) Source(46, 55) + SourceIndex(0) +8 >Emitted(28, 37) Source(46, 69) + SourceIndex(0) +9 >Emitted(28, 39) Source(46, 71) + SourceIndex(0) +10>Emitted(28, 41) Source(46, 55) + SourceIndex(0) +11>Emitted(28, 55) Source(46, 71) + SourceIndex(0) +12>Emitted(28, 57) Source(46, 55) + SourceIndex(0) +13>Emitted(28, 61) Source(46, 71) + SourceIndex(0) +14>Emitted(28, 62) Source(46, 72) + SourceIndex(0) +--- +>>> _q = _p[_o].skills, _r = _q === void 0 ? { primary: "nosKill", secondary: "noSkill" } : _q, _s = _r.primary, primaryA = _s === void 0 ? "primary" : _s, _t = _r.secondary, secondaryA = _t === void 0 ? "secondary" : _t; +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = + > { primary: "nosKill", secondary: "noSkill" } +3 > +4 > skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = + > { primary: "nosKill", secondary: "noSkill" } +5 > +6 > primary: primaryA = "primary" +7 > +8 > primary: primaryA = "primary" +9 > , +10> secondary: secondaryA = "secondary" +11> +12> secondary: secondaryA = "secondary" +1->Emitted(29, 5) Source(45, 8) + SourceIndex(0) +2 >Emitted(29, 23) Source(46, 49) + SourceIndex(0) +3 >Emitted(29, 25) Source(45, 8) + SourceIndex(0) +4 >Emitted(29, 95) Source(46, 49) + SourceIndex(0) +5 >Emitted(29, 97) Source(45, 18) + SourceIndex(0) +6 >Emitted(29, 112) Source(45, 47) + SourceIndex(0) +7 >Emitted(29, 114) Source(45, 18) + SourceIndex(0) +8 >Emitted(29, 155) Source(45, 47) + SourceIndex(0) +9 >Emitted(29, 157) Source(45, 49) + SourceIndex(0) +10>Emitted(29, 174) Source(45, 84) + SourceIndex(0) +11>Emitted(29, 176) Source(45, 49) + SourceIndex(0) +12>Emitted(29, 221) Source(45, 84) + SourceIndex(0) +--- +>>> console.log(primaryA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1 > } = + > { primary: "nosKill", secondary: "noSkill" } } of getMultiRobots()) { + > +2 > console +3 > . +4 > log +5 > ( +6 > primaryA +7 > ) +8 > ; +1 >Emitted(30, 5) Source(47, 5) + SourceIndex(0) +2 >Emitted(30, 12) Source(47, 12) + SourceIndex(0) +3 >Emitted(30, 13) Source(47, 13) + SourceIndex(0) +4 >Emitted(30, 16) Source(47, 16) + SourceIndex(0) +5 >Emitted(30, 17) Source(47, 17) + SourceIndex(0) +6 >Emitted(30, 25) Source(47, 25) + SourceIndex(0) +7 >Emitted(30, 26) Source(47, 26) + SourceIndex(0) +8 >Emitted(30, 27) Source(47, 27) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(31, 2) Source(48, 2) + SourceIndex(0) +--- +>>>for (var _u = 0, _v = [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^ +8 > ^ +9 > ^^ +10> ^^^^ +11> ^^ +12> ^^^^^^^ +13> ^^ +14> ^^^^^^ +15> ^^ +16> ^^ +17> ^^^^^^^ +18> ^^ +19> ^^^^^^^^ +20> ^^ +21> ^^^^^^^^^ +22> ^^ +23> ^^^^^^ +24> ^^ +25> ^^ +26> ^^^^^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > ({ skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = + > { primary: "nosKill", secondary: "noSkill" } } of + > +5 > [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] +6 > +7 > +8 > [ +9 > { +10> name +11> : +12> "mower" +13> , +14> skills +15> : +16> { +17> primary +18> : +19> "mowing" +20> , +21> secondary +22> : +23> "none" +24> } +25> } +1->Emitted(32, 1) Source(49, 1) + SourceIndex(0) +2 >Emitted(32, 4) Source(49, 4) + SourceIndex(0) +3 >Emitted(32, 5) Source(49, 5) + SourceIndex(0) +4 >Emitted(32, 6) Source(51, 5) + SourceIndex(0) +5 >Emitted(32, 16) Source(52, 83) + SourceIndex(0) +6 >Emitted(32, 18) Source(51, 5) + SourceIndex(0) +7 >Emitted(32, 23) Source(51, 19) + SourceIndex(0) +8 >Emitted(32, 24) Source(51, 20) + SourceIndex(0) +9 >Emitted(32, 26) Source(51, 22) + SourceIndex(0) +10>Emitted(32, 30) Source(51, 26) + SourceIndex(0) +11>Emitted(32, 32) Source(51, 28) + SourceIndex(0) +12>Emitted(32, 39) Source(51, 35) + SourceIndex(0) +13>Emitted(32, 41) Source(51, 37) + SourceIndex(0) +14>Emitted(32, 47) Source(51, 43) + SourceIndex(0) +15>Emitted(32, 49) Source(51, 45) + SourceIndex(0) +16>Emitted(32, 51) Source(51, 47) + SourceIndex(0) +17>Emitted(32, 58) Source(51, 54) + SourceIndex(0) +18>Emitted(32, 60) Source(51, 56) + SourceIndex(0) +19>Emitted(32, 68) Source(51, 64) + SourceIndex(0) +20>Emitted(32, 70) Source(51, 66) + SourceIndex(0) +21>Emitted(32, 79) Source(51, 75) + SourceIndex(0) +22>Emitted(32, 81) Source(51, 77) + SourceIndex(0) +23>Emitted(32, 87) Source(51, 83) + SourceIndex(0) +24>Emitted(32, 89) Source(51, 85) + SourceIndex(0) +25>Emitted(32, 91) Source(51, 87) + SourceIndex(0) +--- +>>> { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]; _u < _v.length; _u++) { +1->^^^^ +2 > ^^ +3 > ^^^^ +4 > ^^ +5 > ^^^^^^^^^ +6 > ^^ +7 > ^^^^^^ +8 > ^^ +9 > ^^ +10> ^^^^^^^ +11> ^^ +12> ^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^ +15> ^^ +16> ^^^^^^^^ +17> ^^ +18> ^^ +19> ^ +20> ^^ +21> ^^^^^^^^^^^^^^ +22> ^^ +23> ^^^^ +24> ^ +25> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1->, + > +2 > { +3 > name +4 > : +5 > "trimmer" +6 > , +7 > skills +8 > : +9 > { +10> primary +11> : +12> "trimming" +13> , +14> secondary +15> : +16> "edging" +17> } +18> } +19> ] +20> +21> [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] +22> +23> [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] +24> ) +1->Emitted(33, 5) Source(52, 9) + SourceIndex(0) +2 >Emitted(33, 7) Source(52, 11) + SourceIndex(0) +3 >Emitted(33, 11) Source(52, 15) + SourceIndex(0) +4 >Emitted(33, 13) Source(52, 17) + SourceIndex(0) +5 >Emitted(33, 22) Source(52, 26) + SourceIndex(0) +6 >Emitted(33, 24) Source(52, 28) + SourceIndex(0) +7 >Emitted(33, 30) Source(52, 34) + SourceIndex(0) +8 >Emitted(33, 32) Source(52, 36) + SourceIndex(0) +9 >Emitted(33, 34) Source(52, 38) + SourceIndex(0) +10>Emitted(33, 41) Source(52, 45) + SourceIndex(0) +11>Emitted(33, 43) Source(52, 47) + SourceIndex(0) +12>Emitted(33, 53) Source(52, 57) + SourceIndex(0) +13>Emitted(33, 55) Source(52, 59) + SourceIndex(0) +14>Emitted(33, 64) Source(52, 68) + SourceIndex(0) +15>Emitted(33, 66) Source(52, 70) + SourceIndex(0) +16>Emitted(33, 74) Source(52, 78) + SourceIndex(0) +17>Emitted(33, 76) Source(52, 80) + SourceIndex(0) +18>Emitted(33, 78) Source(52, 82) + SourceIndex(0) +19>Emitted(33, 79) Source(52, 83) + SourceIndex(0) +20>Emitted(33, 81) Source(51, 5) + SourceIndex(0) +21>Emitted(33, 95) Source(52, 83) + SourceIndex(0) +22>Emitted(33, 97) Source(51, 5) + SourceIndex(0) +23>Emitted(33, 101) Source(52, 83) + SourceIndex(0) +24>Emitted(33, 102) Source(52, 84) + SourceIndex(0) +--- +>>> _w = _v[_u].skills, _x = _w === void 0 ? { primary: "nosKill", secondary: "noSkill" } : _w, _y = _x.primary, primaryA = _y === void 0 ? "primary" : _y, _z = _x.secondary, secondaryA = _z === void 0 ? "secondary" : _z; +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = + > { primary: "nosKill", secondary: "noSkill" } +3 > +4 > skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = + > { primary: "nosKill", secondary: "noSkill" } +5 > +6 > primary: primaryA = "primary" +7 > +8 > primary: primaryA = "primary" +9 > , +10> secondary: secondaryA = "secondary" +11> +12> secondary: secondaryA = "secondary" +1->Emitted(34, 5) Source(49, 8) + SourceIndex(0) +2 >Emitted(34, 23) Source(50, 49) + SourceIndex(0) +3 >Emitted(34, 25) Source(49, 8) + SourceIndex(0) +4 >Emitted(34, 95) Source(50, 49) + SourceIndex(0) +5 >Emitted(34, 97) Source(49, 18) + SourceIndex(0) +6 >Emitted(34, 112) Source(49, 47) + SourceIndex(0) +7 >Emitted(34, 114) Source(49, 18) + SourceIndex(0) +8 >Emitted(34, 155) Source(49, 47) + SourceIndex(0) +9 >Emitted(34, 157) Source(49, 49) + SourceIndex(0) +10>Emitted(34, 174) Source(49, 84) + SourceIndex(0) +11>Emitted(34, 176) Source(49, 49) + SourceIndex(0) +12>Emitted(34, 221) Source(49, 84) + SourceIndex(0) +--- +>>> console.log(primaryA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1 > } = + > { primary: "nosKill", secondary: "noSkill" } } of + > [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { + > +2 > console +3 > . +4 > log +5 > ( +6 > primaryA +7 > ) +8 > ; +1 >Emitted(35, 5) Source(53, 5) + SourceIndex(0) +2 >Emitted(35, 12) Source(53, 12) + SourceIndex(0) +3 >Emitted(35, 13) Source(53, 13) + SourceIndex(0) +4 >Emitted(35, 16) Source(53, 16) + SourceIndex(0) +5 >Emitted(35, 17) Source(53, 17) + SourceIndex(0) +6 >Emitted(35, 25) Source(53, 25) + SourceIndex(0) +7 >Emitted(35, 26) Source(53, 26) + SourceIndex(0) +8 >Emitted(35, 27) Source(53, 27) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(36, 2) Source(54, 2) + SourceIndex(0) +--- +>>>for (var _0 = 0, robots_2 = robots; _0 < robots_2.length; _0++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^^^^^^ +10> ^^ +11> ^^^^ +12> ^ +13> ^^^-> +1-> + > + > +2 >for +3 > +4 > ({ name = "noName" } of +5 > robots +6 > +7 > robots +8 > +9 > robots +10> +11> robots +12> ) +1->Emitted(37, 1) Source(56, 1) + SourceIndex(0) +2 >Emitted(37, 4) Source(56, 4) + SourceIndex(0) +3 >Emitted(37, 5) Source(56, 5) + SourceIndex(0) +4 >Emitted(37, 6) Source(56, 29) + SourceIndex(0) +5 >Emitted(37, 16) Source(56, 35) + SourceIndex(0) +6 >Emitted(37, 18) Source(56, 29) + SourceIndex(0) +7 >Emitted(37, 35) Source(56, 35) + SourceIndex(0) +8 >Emitted(37, 37) Source(56, 29) + SourceIndex(0) +9 >Emitted(37, 57) Source(56, 35) + SourceIndex(0) +10>Emitted(37, 59) Source(56, 29) + SourceIndex(0) +11>Emitted(37, 63) Source(56, 35) + SourceIndex(0) +12>Emitted(37, 64) Source(56, 36) + SourceIndex(0) +--- +>>> _1 = robots_2[_0].name, name = _1 === void 0 ? "noName" : _1; +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > name = "noName" +3 > +4 > name = "noName" +1->Emitted(38, 5) Source(56, 8) + SourceIndex(0) +2 >Emitted(38, 27) Source(56, 23) + SourceIndex(0) +3 >Emitted(38, 29) Source(56, 8) + SourceIndex(0) +4 >Emitted(38, 65) Source(56, 23) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > } of robots) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(39, 5) Source(57, 5) + SourceIndex(0) +2 >Emitted(39, 12) Source(57, 12) + SourceIndex(0) +3 >Emitted(39, 13) Source(57, 13) + SourceIndex(0) +4 >Emitted(39, 16) Source(57, 16) + SourceIndex(0) +5 >Emitted(39, 17) Source(57, 17) + SourceIndex(0) +6 >Emitted(39, 22) Source(57, 22) + SourceIndex(0) +7 >Emitted(39, 23) Source(57, 23) + SourceIndex(0) +8 >Emitted(39, 24) Source(57, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(40, 2) Source(58, 2) + SourceIndex(0) +--- +>>>for (var _2 = 0, _3 = getRobots(); _2 < _3.length; _2++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^ +8 > ^^^^^^^^^ +9 > ^^ +10> ^^ +11> ^^^^^^^^^^^^^^ +12> ^^ +13> ^^^^ +14> ^ +15> ^^^^-> +1-> + > +2 >for +3 > +4 > ({ name = "noName" } of +5 > getRobots() +6 > +7 > +8 > getRobots +9 > () +10> +11> getRobots() +12> +13> getRobots() +14> ) +1->Emitted(41, 1) Source(59, 1) + SourceIndex(0) +2 >Emitted(41, 4) Source(59, 4) + SourceIndex(0) +3 >Emitted(41, 5) Source(59, 5) + SourceIndex(0) +4 >Emitted(41, 6) Source(59, 29) + SourceIndex(0) +5 >Emitted(41, 16) Source(59, 40) + SourceIndex(0) +6 >Emitted(41, 18) Source(59, 29) + SourceIndex(0) +7 >Emitted(41, 23) Source(59, 29) + SourceIndex(0) +8 >Emitted(41, 32) Source(59, 38) + SourceIndex(0) +9 >Emitted(41, 34) Source(59, 40) + SourceIndex(0) +10>Emitted(41, 36) Source(59, 29) + SourceIndex(0) +11>Emitted(41, 50) Source(59, 40) + SourceIndex(0) +12>Emitted(41, 52) Source(59, 29) + SourceIndex(0) +13>Emitted(41, 56) Source(59, 40) + SourceIndex(0) +14>Emitted(41, 57) Source(59, 41) + SourceIndex(0) +--- +>>> _4 = _3[_2].name, name = _4 === void 0 ? "noName" : _4; +1->^^^^ +2 > ^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > name = "noName" +3 > +4 > name = "noName" +1->Emitted(42, 5) Source(59, 8) + SourceIndex(0) +2 >Emitted(42, 21) Source(59, 23) + SourceIndex(0) +3 >Emitted(42, 23) Source(59, 8) + SourceIndex(0) +4 >Emitted(42, 59) Source(59, 23) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > } of getRobots()) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(43, 5) Source(60, 5) + SourceIndex(0) +2 >Emitted(43, 12) Source(60, 12) + SourceIndex(0) +3 >Emitted(43, 13) Source(60, 13) + SourceIndex(0) +4 >Emitted(43, 16) Source(60, 16) + SourceIndex(0) +5 >Emitted(43, 17) Source(60, 17) + SourceIndex(0) +6 >Emitted(43, 22) Source(60, 22) + SourceIndex(0) +7 >Emitted(43, 23) Source(60, 23) + SourceIndex(0) +8 >Emitted(43, 24) Source(60, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(44, 2) Source(61, 2) + SourceIndex(0) +--- +>>>for (var _5 = 0, _6 = [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]; _5 < _6.length; _5++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^ +8 > ^^ +9 > ^^^^ +10> ^^ +11> ^^^^^^^ +12> ^^ +13> ^^^^^ +14> ^^ +15> ^^^^^^^^ +16> ^^ +17> ^^ +18> ^^ +19> ^^^^ +20> ^^ +21> ^^^^^^^^^ +22> ^^ +23> ^^^^^ +24> ^^ +25> ^^^^^^^^^^ +26> ^^ +27> ^ +28> ^^ +29> ^^^^^^^^^^^^^^ +30> ^^ +31> ^^^^ +32> ^ +1-> + > +2 >for +3 > +4 > ({ name = "noName" } of +5 > [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }] +6 > +7 > [ +8 > { +9 > name +10> : +11> "mower" +12> , +13> skill +14> : +15> "mowing" +16> } +17> , +18> { +19> name +20> : +21> "trimmer" +22> , +23> skill +24> : +25> "trimming" +26> } +27> ] +28> +29> [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }] +30> +31> [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }] +32> ) +1->Emitted(45, 1) Source(62, 1) + SourceIndex(0) +2 >Emitted(45, 4) Source(62, 4) + SourceIndex(0) +3 >Emitted(45, 5) Source(62, 5) + SourceIndex(0) +4 >Emitted(45, 6) Source(62, 29) + SourceIndex(0) +5 >Emitted(45, 16) Source(62, 105) + SourceIndex(0) +6 >Emitted(45, 18) Source(62, 29) + SourceIndex(0) +7 >Emitted(45, 24) Source(62, 30) + SourceIndex(0) +8 >Emitted(45, 26) Source(62, 32) + SourceIndex(0) +9 >Emitted(45, 30) Source(62, 36) + SourceIndex(0) +10>Emitted(45, 32) Source(62, 38) + SourceIndex(0) +11>Emitted(45, 39) Source(62, 45) + SourceIndex(0) +12>Emitted(45, 41) Source(62, 47) + SourceIndex(0) +13>Emitted(45, 46) Source(62, 52) + SourceIndex(0) +14>Emitted(45, 48) Source(62, 54) + SourceIndex(0) +15>Emitted(45, 56) Source(62, 62) + SourceIndex(0) +16>Emitted(45, 58) Source(62, 64) + SourceIndex(0) +17>Emitted(45, 60) Source(62, 66) + SourceIndex(0) +18>Emitted(45, 62) Source(62, 68) + SourceIndex(0) +19>Emitted(45, 66) Source(62, 72) + SourceIndex(0) +20>Emitted(45, 68) Source(62, 74) + SourceIndex(0) +21>Emitted(45, 77) Source(62, 83) + SourceIndex(0) +22>Emitted(45, 79) Source(62, 85) + SourceIndex(0) +23>Emitted(45, 84) Source(62, 90) + SourceIndex(0) +24>Emitted(45, 86) Source(62, 92) + SourceIndex(0) +25>Emitted(45, 96) Source(62, 102) + SourceIndex(0) +26>Emitted(45, 98) Source(62, 104) + SourceIndex(0) +27>Emitted(45, 99) Source(62, 105) + SourceIndex(0) +28>Emitted(45, 101) Source(62, 29) + SourceIndex(0) +29>Emitted(45, 115) Source(62, 105) + SourceIndex(0) +30>Emitted(45, 117) Source(62, 29) + SourceIndex(0) +31>Emitted(45, 121) Source(62, 105) + SourceIndex(0) +32>Emitted(45, 122) Source(62, 106) + SourceIndex(0) +--- +>>> _7 = _6[_5].name, name = _7 === void 0 ? "noName" : _7; +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 > name = "noName" +3 > +4 > name = "noName" +1 >Emitted(46, 5) Source(62, 8) + SourceIndex(0) +2 >Emitted(46, 21) Source(62, 23) + SourceIndex(0) +3 >Emitted(46, 23) Source(62, 8) + SourceIndex(0) +4 >Emitted(46, 59) Source(62, 23) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(47, 5) Source(63, 5) + SourceIndex(0) +2 >Emitted(47, 12) Source(63, 12) + SourceIndex(0) +3 >Emitted(47, 13) Source(63, 13) + SourceIndex(0) +4 >Emitted(47, 16) Source(63, 16) + SourceIndex(0) +5 >Emitted(47, 17) Source(63, 17) + SourceIndex(0) +6 >Emitted(47, 22) Source(63, 22) + SourceIndex(0) +7 >Emitted(47, 23) Source(63, 23) + SourceIndex(0) +8 >Emitted(47, 24) Source(63, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(48, 2) Source(64, 2) + SourceIndex(0) +--- +>>>for (var _8 = 0, multiRobots_2 = multiRobots; _8 < multiRobots_2.length; _8++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^^^^^^^^^^^ +10> ^^ +11> ^^^^ +12> ^ +13> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > ({ + > skills: { + > primary = "primary", + > secondary = "secondary" + > } = { primary: "noSkill", secondary: "noSkill" } + > } of +5 > multiRobots +6 > +7 > multiRobots +8 > +9 > multiRobots +10> +11> multiRobots +12> ) +1->Emitted(49, 1) Source(65, 1) + SourceIndex(0) +2 >Emitted(49, 4) Source(65, 4) + SourceIndex(0) +3 >Emitted(49, 5) Source(65, 5) + SourceIndex(0) +4 >Emitted(49, 6) Source(70, 6) + SourceIndex(0) +5 >Emitted(49, 16) Source(70, 17) + SourceIndex(0) +6 >Emitted(49, 18) Source(70, 6) + SourceIndex(0) +7 >Emitted(49, 45) Source(70, 17) + SourceIndex(0) +8 >Emitted(49, 47) Source(70, 6) + SourceIndex(0) +9 >Emitted(49, 72) Source(70, 17) + SourceIndex(0) +10>Emitted(49, 74) Source(70, 6) + SourceIndex(0) +11>Emitted(49, 78) Source(70, 17) + SourceIndex(0) +12>Emitted(49, 79) Source(70, 18) + SourceIndex(0) +--- +>>> _9 = multiRobots_2[_8].skills, _10 = _9 === void 0 ? { primary: "noSkill", secondary: "noSkill" } : _9, _11 = _10.primary, primary = _11 === void 0 ? "primary" : _11, _12 = _10.secondary, secondary = _12 === void 0 ? "secondary" : _12; +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > skills: { + > primary = "primary", + > secondary = "secondary" + > } = { primary: "noSkill", secondary: "noSkill" } +3 > +4 > skills: { + > primary = "primary", + > secondary = "secondary" + > } = { primary: "noSkill", secondary: "noSkill" } +5 > +6 > primary = "primary" +7 > +8 > primary = "primary" +9 > , + > +10> secondary = "secondary" +11> +12> secondary = "secondary" +1->Emitted(50, 5) Source(66, 5) + SourceIndex(0) +2 >Emitted(50, 34) Source(69, 53) + SourceIndex(0) +3 >Emitted(50, 36) Source(66, 5) + SourceIndex(0) +4 >Emitted(50, 107) Source(69, 53) + SourceIndex(0) +5 >Emitted(50, 109) Source(67, 9) + SourceIndex(0) +6 >Emitted(50, 126) Source(67, 28) + SourceIndex(0) +7 >Emitted(50, 128) Source(67, 9) + SourceIndex(0) +8 >Emitted(50, 170) Source(67, 28) + SourceIndex(0) +9 >Emitted(50, 172) Source(68, 9) + SourceIndex(0) +10>Emitted(50, 191) Source(68, 32) + SourceIndex(0) +11>Emitted(50, 193) Source(68, 9) + SourceIndex(0) +12>Emitted(50, 239) Source(68, 32) + SourceIndex(0) +--- +>>> console.log(primaryA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1 > + > } = { primary: "noSkill", secondary: "noSkill" } + >} of multiRobots) { + > +2 > console +3 > . +4 > log +5 > ( +6 > primaryA +7 > ) +8 > ; +1 >Emitted(51, 5) Source(71, 5) + SourceIndex(0) +2 >Emitted(51, 12) Source(71, 12) + SourceIndex(0) +3 >Emitted(51, 13) Source(71, 13) + SourceIndex(0) +4 >Emitted(51, 16) Source(71, 16) + SourceIndex(0) +5 >Emitted(51, 17) Source(71, 17) + SourceIndex(0) +6 >Emitted(51, 25) Source(71, 25) + SourceIndex(0) +7 >Emitted(51, 26) Source(71, 26) + SourceIndex(0) +8 >Emitted(51, 27) Source(71, 27) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(52, 2) Source(72, 2) + SourceIndex(0) +--- +>>>for (var _13 = 0, _14 = getMultiRobots(); _13 < _14.length; _13++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^ +8 > ^^^^^^^^^^^^^^ +9 > ^^ +10> ^^ +11> ^^^^^^^^^^^^^^^^ +12> ^^ +13> ^^^^^ +14> ^ +15> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > ({ + > skills: { + > primary = "primary", + > secondary = "secondary" + > } = { primary: "noSkill", secondary: "noSkill" } + > } of +5 > getMultiRobots() +6 > +7 > +8 > getMultiRobots +9 > () +10> +11> getMultiRobots() +12> +13> getMultiRobots() +14> ) +1->Emitted(53, 1) Source(73, 1) + SourceIndex(0) +2 >Emitted(53, 4) Source(73, 4) + SourceIndex(0) +3 >Emitted(53, 5) Source(73, 5) + SourceIndex(0) +4 >Emitted(53, 6) Source(78, 6) + SourceIndex(0) +5 >Emitted(53, 17) Source(78, 22) + SourceIndex(0) +6 >Emitted(53, 19) Source(78, 6) + SourceIndex(0) +7 >Emitted(53, 25) Source(78, 6) + SourceIndex(0) +8 >Emitted(53, 39) Source(78, 20) + SourceIndex(0) +9 >Emitted(53, 41) Source(78, 22) + SourceIndex(0) +10>Emitted(53, 43) Source(78, 6) + SourceIndex(0) +11>Emitted(53, 59) Source(78, 22) + SourceIndex(0) +12>Emitted(53, 61) Source(78, 6) + SourceIndex(0) +13>Emitted(53, 66) Source(78, 22) + SourceIndex(0) +14>Emitted(53, 67) Source(78, 23) + SourceIndex(0) +--- +>>> _15 = _14[_13].skills, _16 = _15 === void 0 ? { primary: "noSkill", secondary: "noSkill" } : _15, _17 = _16.primary, primary = _17 === void 0 ? "primary" : _17, _18 = _16.secondary, secondary = _18 === void 0 ? "secondary" : _18; +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > skills: { + > primary = "primary", + > secondary = "secondary" + > } = { primary: "noSkill", secondary: "noSkill" } +3 > +4 > skills: { + > primary = "primary", + > secondary = "secondary" + > } = { primary: "noSkill", secondary: "noSkill" } +5 > +6 > primary = "primary" +7 > +8 > primary = "primary" +9 > , + > +10> secondary = "secondary" +11> +12> secondary = "secondary" +1->Emitted(54, 5) Source(74, 5) + SourceIndex(0) +2 >Emitted(54, 26) Source(77, 53) + SourceIndex(0) +3 >Emitted(54, 28) Source(74, 5) + SourceIndex(0) +4 >Emitted(54, 101) Source(77, 53) + SourceIndex(0) +5 >Emitted(54, 103) Source(75, 9) + SourceIndex(0) +6 >Emitted(54, 120) Source(75, 28) + SourceIndex(0) +7 >Emitted(54, 122) Source(75, 9) + SourceIndex(0) +8 >Emitted(54, 164) Source(75, 28) + SourceIndex(0) +9 >Emitted(54, 166) Source(76, 9) + SourceIndex(0) +10>Emitted(54, 185) Source(76, 32) + SourceIndex(0) +11>Emitted(54, 187) Source(76, 9) + SourceIndex(0) +12>Emitted(54, 233) Source(76, 32) + SourceIndex(0) +--- +>>> console.log(primaryA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1 > + > } = { primary: "noSkill", secondary: "noSkill" } + >} of getMultiRobots()) { + > +2 > console +3 > . +4 > log +5 > ( +6 > primaryA +7 > ) +8 > ; +1 >Emitted(55, 5) Source(79, 5) + SourceIndex(0) +2 >Emitted(55, 12) Source(79, 12) + SourceIndex(0) +3 >Emitted(55, 13) Source(79, 13) + SourceIndex(0) +4 >Emitted(55, 16) Source(79, 16) + SourceIndex(0) +5 >Emitted(55, 17) Source(79, 17) + SourceIndex(0) +6 >Emitted(55, 25) Source(79, 25) + SourceIndex(0) +7 >Emitted(55, 26) Source(79, 26) + SourceIndex(0) +8 >Emitted(55, 27) Source(79, 27) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(56, 2) Source(80, 2) + SourceIndex(0) +--- +>>>for (var _19 = 0, _20 = [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^ +8 > ^^ +9 > ^^^^ +10> ^^ +11> ^^^^^^^ +12> ^^ +13> ^^^^^^ +14> ^^ +15> ^^ +16> ^^^^^^^ +17> ^^ +18> ^^^^^^^^ +19> ^^ +20> ^^^^^^^^^ +21> ^^ +22> ^^^^^^ +23> ^^ +24> ^^ +25> ^^^^^^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > ({ + > skills: { + > primary = "primary", + > secondary = "secondary" + > } = { primary: "noSkill", secondary: "noSkill" } + > } of +5 > [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] +6 > +7 > [ +8 > { +9 > name +10> : +11> "mower" +12> , +13> skills +14> : +15> { +16> primary +17> : +18> "mowing" +19> , +20> secondary +21> : +22> "none" +23> } +24> } +1->Emitted(57, 1) Source(81, 1) + SourceIndex(0) +2 >Emitted(57, 4) Source(81, 4) + SourceIndex(0) +3 >Emitted(57, 5) Source(81, 5) + SourceIndex(0) +4 >Emitted(57, 6) Source(86, 6) + SourceIndex(0) +5 >Emitted(57, 17) Source(87, 79) + SourceIndex(0) +6 >Emitted(57, 19) Source(86, 6) + SourceIndex(0) +7 >Emitted(57, 26) Source(86, 7) + SourceIndex(0) +8 >Emitted(57, 28) Source(86, 9) + SourceIndex(0) +9 >Emitted(57, 32) Source(86, 13) + SourceIndex(0) +10>Emitted(57, 34) Source(86, 15) + SourceIndex(0) +11>Emitted(57, 41) Source(86, 22) + SourceIndex(0) +12>Emitted(57, 43) Source(86, 24) + SourceIndex(0) +13>Emitted(57, 49) Source(86, 30) + SourceIndex(0) +14>Emitted(57, 51) Source(86, 32) + SourceIndex(0) +15>Emitted(57, 53) Source(86, 34) + SourceIndex(0) +16>Emitted(57, 60) Source(86, 41) + SourceIndex(0) +17>Emitted(57, 62) Source(86, 43) + SourceIndex(0) +18>Emitted(57, 70) Source(86, 51) + SourceIndex(0) +19>Emitted(57, 72) Source(86, 53) + SourceIndex(0) +20>Emitted(57, 81) Source(86, 62) + SourceIndex(0) +21>Emitted(57, 83) Source(86, 64) + SourceIndex(0) +22>Emitted(57, 89) Source(86, 70) + SourceIndex(0) +23>Emitted(57, 91) Source(86, 72) + SourceIndex(0) +24>Emitted(57, 93) Source(86, 74) + SourceIndex(0) +--- +>>> { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]; _19 < _20.length; _19++) { +1->^^^^ +2 > ^^ +3 > ^^^^ +4 > ^^ +5 > ^^^^^^^^^ +6 > ^^ +7 > ^^^^^^ +8 > ^^ +9 > ^^ +10> ^^^^^^^ +11> ^^ +12> ^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^ +15> ^^ +16> ^^^^^^^^ +17> ^^ +18> ^^ +19> ^ +20> ^^ +21> ^^^^^^^^^^^^^^^^ +22> ^^ +23> ^^^^^ +24> ^ +25> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1->, + > +2 > { +3 > name +4 > : +5 > "trimmer" +6 > , +7 > skills +8 > : +9 > { +10> primary +11> : +12> "trimming" +13> , +14> secondary +15> : +16> "edging" +17> } +18> } +19> ] +20> +21> [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] +22> +23> [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] +24> ) +1->Emitted(58, 5) Source(87, 5) + SourceIndex(0) +2 >Emitted(58, 7) Source(87, 7) + SourceIndex(0) +3 >Emitted(58, 11) Source(87, 11) + SourceIndex(0) +4 >Emitted(58, 13) Source(87, 13) + SourceIndex(0) +5 >Emitted(58, 22) Source(87, 22) + SourceIndex(0) +6 >Emitted(58, 24) Source(87, 24) + SourceIndex(0) +7 >Emitted(58, 30) Source(87, 30) + SourceIndex(0) +8 >Emitted(58, 32) Source(87, 32) + SourceIndex(0) +9 >Emitted(58, 34) Source(87, 34) + SourceIndex(0) +10>Emitted(58, 41) Source(87, 41) + SourceIndex(0) +11>Emitted(58, 43) Source(87, 43) + SourceIndex(0) +12>Emitted(58, 53) Source(87, 53) + SourceIndex(0) +13>Emitted(58, 55) Source(87, 55) + SourceIndex(0) +14>Emitted(58, 64) Source(87, 64) + SourceIndex(0) +15>Emitted(58, 66) Source(87, 66) + SourceIndex(0) +16>Emitted(58, 74) Source(87, 74) + SourceIndex(0) +17>Emitted(58, 76) Source(87, 76) + SourceIndex(0) +18>Emitted(58, 78) Source(87, 78) + SourceIndex(0) +19>Emitted(58, 79) Source(87, 79) + SourceIndex(0) +20>Emitted(58, 81) Source(86, 6) + SourceIndex(0) +21>Emitted(58, 97) Source(87, 79) + SourceIndex(0) +22>Emitted(58, 99) Source(86, 6) + SourceIndex(0) +23>Emitted(58, 104) Source(87, 79) + SourceIndex(0) +24>Emitted(58, 105) Source(87, 80) + SourceIndex(0) +--- +>>> _21 = _20[_19].skills, _22 = _21 === void 0 ? { primary: "noSkill", secondary: "noSkill" } : _21, _23 = _22.primary, primary = _23 === void 0 ? "primary" : _23, _24 = _22.secondary, secondary = _24 === void 0 ? "secondary" : _24; +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > skills: { + > primary = "primary", + > secondary = "secondary" + > } = { primary: "noSkill", secondary: "noSkill" } +3 > +4 > skills: { + > primary = "primary", + > secondary = "secondary" + > } = { primary: "noSkill", secondary: "noSkill" } +5 > +6 > primary = "primary" +7 > +8 > primary = "primary" +9 > , + > +10> secondary = "secondary" +11> +12> secondary = "secondary" +1->Emitted(59, 5) Source(82, 5) + SourceIndex(0) +2 >Emitted(59, 26) Source(85, 53) + SourceIndex(0) +3 >Emitted(59, 28) Source(82, 5) + SourceIndex(0) +4 >Emitted(59, 101) Source(85, 53) + SourceIndex(0) +5 >Emitted(59, 103) Source(83, 9) + SourceIndex(0) +6 >Emitted(59, 120) Source(83, 28) + SourceIndex(0) +7 >Emitted(59, 122) Source(83, 9) + SourceIndex(0) +8 >Emitted(59, 164) Source(83, 28) + SourceIndex(0) +9 >Emitted(59, 166) Source(84, 9) + SourceIndex(0) +10>Emitted(59, 185) Source(84, 32) + SourceIndex(0) +11>Emitted(59, 187) Source(84, 9) + SourceIndex(0) +12>Emitted(59, 233) Source(84, 32) + SourceIndex(0) +--- +>>> console.log(primaryA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1 > + > } = { primary: "noSkill", secondary: "noSkill" } + >} of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { + > +2 > console +3 > . +4 > log +5 > ( +6 > primaryA +7 > ) +8 > ; +1 >Emitted(60, 5) Source(88, 5) + SourceIndex(0) +2 >Emitted(60, 12) Source(88, 12) + SourceIndex(0) +3 >Emitted(60, 13) Source(88, 13) + SourceIndex(0) +4 >Emitted(60, 16) Source(88, 16) + SourceIndex(0) +5 >Emitted(60, 17) Source(88, 17) + SourceIndex(0) +6 >Emitted(60, 25) Source(88, 25) + SourceIndex(0) +7 >Emitted(60, 26) Source(88, 26) + SourceIndex(0) +8 >Emitted(60, 27) Source(88, 27) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(61, 2) Source(89, 2) + SourceIndex(0) +--- +>>>for (var _25 = 0, robots_3 = robots; _25 < robots_3.length; _25++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^^^^^^^ +10> ^^ +11> ^^^^^ +12> ^ +13> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > + > + > +2 >for +3 > +4 > ({name: nameA = "noName", skill: skillA = "noSkill" } of +5 > robots +6 > +7 > robots +8 > +9 > robots +10> +11> robots +12> ) +1->Emitted(62, 1) Source(92, 1) + SourceIndex(0) +2 >Emitted(62, 4) Source(92, 4) + SourceIndex(0) +3 >Emitted(62, 5) Source(92, 5) + SourceIndex(0) +4 >Emitted(62, 6) Source(92, 62) + SourceIndex(0) +5 >Emitted(62, 17) Source(92, 68) + SourceIndex(0) +6 >Emitted(62, 19) Source(92, 62) + SourceIndex(0) +7 >Emitted(62, 36) Source(92, 68) + SourceIndex(0) +8 >Emitted(62, 38) Source(92, 62) + SourceIndex(0) +9 >Emitted(62, 59) Source(92, 68) + SourceIndex(0) +10>Emitted(62, 61) Source(92, 62) + SourceIndex(0) +11>Emitted(62, 66) Source(92, 68) + SourceIndex(0) +12>Emitted(62, 67) Source(92, 69) + SourceIndex(0) +--- +>>> _26 = robots_3[_25], _27 = _26.name, nameA = _27 === void 0 ? "noName" : _27, _28 = _26.skill, skillA = _28 === void 0 ? "noSkill" : _28; +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > {name: nameA = "noName", skill: skillA = "noSkill" } +3 > +4 > name: nameA = "noName" +5 > +6 > name: nameA = "noName" +7 > , +8 > skill: skillA = "noSkill" +9 > +10> skill: skillA = "noSkill" +1->Emitted(63, 5) Source(92, 6) + SourceIndex(0) +2 >Emitted(63, 24) Source(92, 58) + SourceIndex(0) +3 >Emitted(63, 26) Source(92, 7) + SourceIndex(0) +4 >Emitted(63, 40) Source(92, 29) + SourceIndex(0) +5 >Emitted(63, 42) Source(92, 7) + SourceIndex(0) +6 >Emitted(63, 81) Source(92, 29) + SourceIndex(0) +7 >Emitted(63, 83) Source(92, 31) + SourceIndex(0) +8 >Emitted(63, 98) Source(92, 56) + SourceIndex(0) +9 >Emitted(63, 100) Source(92, 31) + SourceIndex(0) +10>Emitted(63, 141) Source(92, 56) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > } of robots) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(64, 5) Source(93, 5) + SourceIndex(0) +2 >Emitted(64, 12) Source(93, 12) + SourceIndex(0) +3 >Emitted(64, 13) Source(93, 13) + SourceIndex(0) +4 >Emitted(64, 16) Source(93, 16) + SourceIndex(0) +5 >Emitted(64, 17) Source(93, 17) + SourceIndex(0) +6 >Emitted(64, 22) Source(93, 22) + SourceIndex(0) +7 >Emitted(64, 23) Source(93, 23) + SourceIndex(0) +8 >Emitted(64, 24) Source(93, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(65, 2) Source(94, 2) + SourceIndex(0) +--- +>>>for (var _29 = 0, _30 = getRobots(); _29 < _30.length; _29++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^ +8 > ^^^^^^^^^ +9 > ^^ +10> ^^ +11> ^^^^^^^^^^^^^^^^ +12> ^^ +13> ^^^^^ +14> ^ +15> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > ({name: nameA = "noName", skill: skillA = "noSkill" } of +5 > getRobots() +6 > +7 > +8 > getRobots +9 > () +10> +11> getRobots() +12> +13> getRobots() +14> ) +1->Emitted(66, 1) Source(95, 1) + SourceIndex(0) +2 >Emitted(66, 4) Source(95, 4) + SourceIndex(0) +3 >Emitted(66, 5) Source(95, 5) + SourceIndex(0) +4 >Emitted(66, 6) Source(95, 63) + SourceIndex(0) +5 >Emitted(66, 17) Source(95, 74) + SourceIndex(0) +6 >Emitted(66, 19) Source(95, 63) + SourceIndex(0) +7 >Emitted(66, 25) Source(95, 63) + SourceIndex(0) +8 >Emitted(66, 34) Source(95, 72) + SourceIndex(0) +9 >Emitted(66, 36) Source(95, 74) + SourceIndex(0) +10>Emitted(66, 38) Source(95, 63) + SourceIndex(0) +11>Emitted(66, 54) Source(95, 74) + SourceIndex(0) +12>Emitted(66, 56) Source(95, 63) + SourceIndex(0) +13>Emitted(66, 61) Source(95, 74) + SourceIndex(0) +14>Emitted(66, 62) Source(95, 75) + SourceIndex(0) +--- +>>> _31 = _30[_29], _32 = _31.name, nameA = _32 === void 0 ? "noName" : _32, _33 = _31.skill, skillA = _33 === void 0 ? "noSkill" : _33; +1->^^^^ +2 > ^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > {name: nameA = "noName", skill: skillA = "noSkill" } +3 > +4 > name: nameA = "noName" +5 > +6 > name: nameA = "noName" +7 > , +8 > skill: skillA = "noSkill" +9 > +10> skill: skillA = "noSkill" +1->Emitted(67, 5) Source(95, 6) + SourceIndex(0) +2 >Emitted(67, 19) Source(95, 59) + SourceIndex(0) +3 >Emitted(67, 21) Source(95, 7) + SourceIndex(0) +4 >Emitted(67, 35) Source(95, 29) + SourceIndex(0) +5 >Emitted(67, 37) Source(95, 7) + SourceIndex(0) +6 >Emitted(67, 76) Source(95, 29) + SourceIndex(0) +7 >Emitted(67, 78) Source(95, 31) + SourceIndex(0) +8 >Emitted(67, 93) Source(95, 56) + SourceIndex(0) +9 >Emitted(67, 95) Source(95, 31) + SourceIndex(0) +10>Emitted(67, 136) Source(95, 56) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > } of getRobots()) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(68, 5) Source(96, 5) + SourceIndex(0) +2 >Emitted(68, 12) Source(96, 12) + SourceIndex(0) +3 >Emitted(68, 13) Source(96, 13) + SourceIndex(0) +4 >Emitted(68, 16) Source(96, 16) + SourceIndex(0) +5 >Emitted(68, 17) Source(96, 17) + SourceIndex(0) +6 >Emitted(68, 22) Source(96, 22) + SourceIndex(0) +7 >Emitted(68, 23) Source(96, 23) + SourceIndex(0) +8 >Emitted(68, 24) Source(96, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(69, 2) Source(97, 2) + SourceIndex(0) +--- +>>>for (var _34 = 0, _35 = [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]; _34 < _35.length; _34++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^ +8 > ^^ +9 > ^^^^ +10> ^^ +11> ^^^^^^^ +12> ^^ +13> ^^^^^ +14> ^^ +15> ^^^^^^^^ +16> ^^ +17> ^^ +18> ^^ +19> ^^^^ +20> ^^ +21> ^^^^^^^^^ +22> ^^ +23> ^^^^^ +24> ^^ +25> ^^^^^^^^^^ +26> ^^ +27> ^ +28> ^^ +29> ^^^^^^^^^^^^^^^^ +30> ^^ +31> ^^^^^ +32> ^ +33> ^^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > ({name: nameA = "noName", skill: skillA = "noSkill" } of +5 > [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }] +6 > +7 > [ +8 > { +9 > name +10> : +11> "mower" +12> , +13> skill +14> : +15> "mowing" +16> } +17> , +18> { +19> name +20> : +21> "trimmer" +22> , +23> skill +24> : +25> "trimming" +26> } +27> ] +28> +29> [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }] +30> +31> [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }] +32> ) +1->Emitted(70, 1) Source(98, 1) + SourceIndex(0) +2 >Emitted(70, 4) Source(98, 4) + SourceIndex(0) +3 >Emitted(70, 5) Source(98, 5) + SourceIndex(0) +4 >Emitted(70, 6) Source(98, 63) + SourceIndex(0) +5 >Emitted(70, 17) Source(98, 139) + SourceIndex(0) +6 >Emitted(70, 19) Source(98, 63) + SourceIndex(0) +7 >Emitted(70, 26) Source(98, 64) + SourceIndex(0) +8 >Emitted(70, 28) Source(98, 66) + SourceIndex(0) +9 >Emitted(70, 32) Source(98, 70) + SourceIndex(0) +10>Emitted(70, 34) Source(98, 72) + SourceIndex(0) +11>Emitted(70, 41) Source(98, 79) + SourceIndex(0) +12>Emitted(70, 43) Source(98, 81) + SourceIndex(0) +13>Emitted(70, 48) Source(98, 86) + SourceIndex(0) +14>Emitted(70, 50) Source(98, 88) + SourceIndex(0) +15>Emitted(70, 58) Source(98, 96) + SourceIndex(0) +16>Emitted(70, 60) Source(98, 98) + SourceIndex(0) +17>Emitted(70, 62) Source(98, 100) + SourceIndex(0) +18>Emitted(70, 64) Source(98, 102) + SourceIndex(0) +19>Emitted(70, 68) Source(98, 106) + SourceIndex(0) +20>Emitted(70, 70) Source(98, 108) + SourceIndex(0) +21>Emitted(70, 79) Source(98, 117) + SourceIndex(0) +22>Emitted(70, 81) Source(98, 119) + SourceIndex(0) +23>Emitted(70, 86) Source(98, 124) + SourceIndex(0) +24>Emitted(70, 88) Source(98, 126) + SourceIndex(0) +25>Emitted(70, 98) Source(98, 136) + SourceIndex(0) +26>Emitted(70, 100) Source(98, 138) + SourceIndex(0) +27>Emitted(70, 101) Source(98, 139) + SourceIndex(0) +28>Emitted(70, 103) Source(98, 63) + SourceIndex(0) +29>Emitted(70, 119) Source(98, 139) + SourceIndex(0) +30>Emitted(70, 121) Source(98, 63) + SourceIndex(0) +31>Emitted(70, 126) Source(98, 139) + SourceIndex(0) +32>Emitted(70, 127) Source(98, 140) + SourceIndex(0) +--- +>>> _36 = _35[_34], _37 = _36.name, nameA = _37 === void 0 ? "noName" : _37, _38 = _36.skill, skillA = _38 === void 0 ? "noSkill" : _38; +1->^^^^ +2 > ^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > {name: nameA = "noName", skill: skillA = "noSkill" } +3 > +4 > name: nameA = "noName" +5 > +6 > name: nameA = "noName" +7 > , +8 > skill: skillA = "noSkill" +9 > +10> skill: skillA = "noSkill" +1->Emitted(71, 5) Source(98, 6) + SourceIndex(0) +2 >Emitted(71, 19) Source(98, 59) + SourceIndex(0) +3 >Emitted(71, 21) Source(98, 7) + SourceIndex(0) +4 >Emitted(71, 35) Source(98, 29) + SourceIndex(0) +5 >Emitted(71, 37) Source(98, 7) + SourceIndex(0) +6 >Emitted(71, 76) Source(98, 29) + SourceIndex(0) +7 >Emitted(71, 78) Source(98, 31) + SourceIndex(0) +8 >Emitted(71, 93) Source(98, 56) + SourceIndex(0) +9 >Emitted(71, 95) Source(98, 31) + SourceIndex(0) +10>Emitted(71, 136) Source(98, 56) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(72, 5) Source(99, 5) + SourceIndex(0) +2 >Emitted(72, 12) Source(99, 12) + SourceIndex(0) +3 >Emitted(72, 13) Source(99, 13) + SourceIndex(0) +4 >Emitted(72, 16) Source(99, 16) + SourceIndex(0) +5 >Emitted(72, 17) Source(99, 17) + SourceIndex(0) +6 >Emitted(72, 22) Source(99, 22) + SourceIndex(0) +7 >Emitted(72, 23) Source(99, 23) + SourceIndex(0) +8 >Emitted(72, 24) Source(99, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(73, 2) Source(100, 2) + SourceIndex(0) +--- +>>>for (var _39 = 0, multiRobots_3 = multiRobots; _39 < multiRobots_3.length; _39++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^^^^^^^^^^^^ +10> ^^ +11> ^^^^^ +12> ^ +13> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > ({ + > name: nameA = "noName", + > skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "noSkill", secondary: "noSkill" } + > } of +5 > multiRobots +6 > +7 > multiRobots +8 > +9 > multiRobots +10> +11> multiRobots +12> ) +1->Emitted(74, 1) Source(101, 1) + SourceIndex(0) +2 >Emitted(74, 4) Source(101, 4) + SourceIndex(0) +3 >Emitted(74, 5) Source(101, 5) + SourceIndex(0) +4 >Emitted(74, 6) Source(107, 6) + SourceIndex(0) +5 >Emitted(74, 17) Source(107, 17) + SourceIndex(0) +6 >Emitted(74, 19) Source(107, 6) + SourceIndex(0) +7 >Emitted(74, 46) Source(107, 17) + SourceIndex(0) +8 >Emitted(74, 48) Source(107, 6) + SourceIndex(0) +9 >Emitted(74, 74) Source(107, 17) + SourceIndex(0) +10>Emitted(74, 76) Source(107, 6) + SourceIndex(0) +11>Emitted(74, 81) Source(107, 17) + SourceIndex(0) +12>Emitted(74, 82) Source(107, 18) + SourceIndex(0) +--- +>>> _40 = multiRobots_3[_39], _41 = _40.name, nameA = _41 === void 0 ? "noName" : _41, _42 = _40.skills, _43 = _42 === void 0 ? { primary: "noSkill", secondary: "noSkill" } : _42, _44 = _43.primary, primaryA = _44 === void 0 ? "primary" : _44, _45 = _43.secondary, secondaryA = _45 === void 0 ? "secondary" : _45; +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +15> ^^ +16> ^^^^^^^^^^^^^^^^^^^ +17> ^^ +18> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > { + > name: nameA = "noName", + > skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "noSkill", secondary: "noSkill" } + > } +3 > +4 > name: nameA = "noName" +5 > +6 > name: nameA = "noName" +7 > , + > +8 > skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "noSkill", secondary: "noSkill" } +9 > +10> skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "noSkill", secondary: "noSkill" } +11> +12> primary: primaryA = "primary" +13> +14> primary: primaryA = "primary" +15> , + > +16> secondary: secondaryA = "secondary" +17> +18> secondary: secondaryA = "secondary" +1->Emitted(75, 5) Source(101, 6) + SourceIndex(0) +2 >Emitted(75, 29) Source(107, 2) + SourceIndex(0) +3 >Emitted(75, 31) Source(102, 5) + SourceIndex(0) +4 >Emitted(75, 45) Source(102, 27) + SourceIndex(0) +5 >Emitted(75, 47) Source(102, 5) + SourceIndex(0) +6 >Emitted(75, 86) Source(102, 27) + SourceIndex(0) +7 >Emitted(75, 88) Source(103, 5) + SourceIndex(0) +8 >Emitted(75, 104) Source(106, 53) + SourceIndex(0) +9 >Emitted(75, 106) Source(103, 5) + SourceIndex(0) +10>Emitted(75, 179) Source(106, 53) + SourceIndex(0) +11>Emitted(75, 181) Source(104, 9) + SourceIndex(0) +12>Emitted(75, 198) Source(104, 38) + SourceIndex(0) +13>Emitted(75, 200) Source(104, 9) + SourceIndex(0) +14>Emitted(75, 243) Source(104, 38) + SourceIndex(0) +15>Emitted(75, 245) Source(105, 9) + SourceIndex(0) +16>Emitted(75, 264) Source(105, 44) + SourceIndex(0) +17>Emitted(75, 266) Source(105, 9) + SourceIndex(0) +18>Emitted(75, 313) Source(105, 44) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > + > } = { primary: "noSkill", secondary: "noSkill" } + >} of multiRobots) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(76, 5) Source(108, 5) + SourceIndex(0) +2 >Emitted(76, 12) Source(108, 12) + SourceIndex(0) +3 >Emitted(76, 13) Source(108, 13) + SourceIndex(0) +4 >Emitted(76, 16) Source(108, 16) + SourceIndex(0) +5 >Emitted(76, 17) Source(108, 17) + SourceIndex(0) +6 >Emitted(76, 22) Source(108, 22) + SourceIndex(0) +7 >Emitted(76, 23) Source(108, 23) + SourceIndex(0) +8 >Emitted(76, 24) Source(108, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(77, 2) Source(109, 2) + SourceIndex(0) +--- +>>>for (var _46 = 0, _47 = getMultiRobots(); _46 < _47.length; _46++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^ +8 > ^^^^^^^^^^^^^^ +9 > ^^ +10> ^^ +11> ^^^^^^^^^^^^^^^^ +12> ^^ +13> ^^^^^ +14> ^ +15> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > ({ + > name: nameA = "noName", + > skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "noSkill", secondary: "noSkill" } + > } of +5 > getMultiRobots() +6 > +7 > +8 > getMultiRobots +9 > () +10> +11> getMultiRobots() +12> +13> getMultiRobots() +14> ) +1->Emitted(78, 1) Source(110, 1) + SourceIndex(0) +2 >Emitted(78, 4) Source(110, 4) + SourceIndex(0) +3 >Emitted(78, 5) Source(110, 5) + SourceIndex(0) +4 >Emitted(78, 6) Source(116, 6) + SourceIndex(0) +5 >Emitted(78, 17) Source(116, 22) + SourceIndex(0) +6 >Emitted(78, 19) Source(116, 6) + SourceIndex(0) +7 >Emitted(78, 25) Source(116, 6) + SourceIndex(0) +8 >Emitted(78, 39) Source(116, 20) + SourceIndex(0) +9 >Emitted(78, 41) Source(116, 22) + SourceIndex(0) +10>Emitted(78, 43) Source(116, 6) + SourceIndex(0) +11>Emitted(78, 59) Source(116, 22) + SourceIndex(0) +12>Emitted(78, 61) Source(116, 6) + SourceIndex(0) +13>Emitted(78, 66) Source(116, 22) + SourceIndex(0) +14>Emitted(78, 67) Source(116, 23) + SourceIndex(0) +--- +>>> _48 = _47[_46], _49 = _48.name, nameA = _49 === void 0 ? "noName" : _49, _50 = _48.skills, _51 = _50 === void 0 ? { primary: "noSkill", secondary: "noSkill" } : _50, _52 = _51.primary, primaryA = _52 === void 0 ? "primary" : _52, _53 = _51.secondary, secondaryA = _53 === void 0 ? "secondary" : _53; +1->^^^^ +2 > ^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +15> ^^ +16> ^^^^^^^^^^^^^^^^^^^ +17> ^^ +18> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > { + > name: nameA = "noName", + > skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "noSkill", secondary: "noSkill" } + > } +3 > +4 > name: nameA = "noName" +5 > +6 > name: nameA = "noName" +7 > , + > +8 > skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "noSkill", secondary: "noSkill" } +9 > +10> skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "noSkill", secondary: "noSkill" } +11> +12> primary: primaryA = "primary" +13> +14> primary: primaryA = "primary" +15> , + > +16> secondary: secondaryA = "secondary" +17> +18> secondary: secondaryA = "secondary" +1->Emitted(79, 5) Source(110, 6) + SourceIndex(0) +2 >Emitted(79, 19) Source(116, 2) + SourceIndex(0) +3 >Emitted(79, 21) Source(111, 5) + SourceIndex(0) +4 >Emitted(79, 35) Source(111, 27) + SourceIndex(0) +5 >Emitted(79, 37) Source(111, 5) + SourceIndex(0) +6 >Emitted(79, 76) Source(111, 27) + SourceIndex(0) +7 >Emitted(79, 78) Source(112, 5) + SourceIndex(0) +8 >Emitted(79, 94) Source(115, 53) + SourceIndex(0) +9 >Emitted(79, 96) Source(112, 5) + SourceIndex(0) +10>Emitted(79, 169) Source(115, 53) + SourceIndex(0) +11>Emitted(79, 171) Source(113, 9) + SourceIndex(0) +12>Emitted(79, 188) Source(113, 38) + SourceIndex(0) +13>Emitted(79, 190) Source(113, 9) + SourceIndex(0) +14>Emitted(79, 233) Source(113, 38) + SourceIndex(0) +15>Emitted(79, 235) Source(114, 9) + SourceIndex(0) +16>Emitted(79, 254) Source(114, 44) + SourceIndex(0) +17>Emitted(79, 256) Source(114, 9) + SourceIndex(0) +18>Emitted(79, 303) Source(114, 44) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > + > } = { primary: "noSkill", secondary: "noSkill" } + >} of getMultiRobots()) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(80, 5) Source(117, 5) + SourceIndex(0) +2 >Emitted(80, 12) Source(117, 12) + SourceIndex(0) +3 >Emitted(80, 13) Source(117, 13) + SourceIndex(0) +4 >Emitted(80, 16) Source(117, 16) + SourceIndex(0) +5 >Emitted(80, 17) Source(117, 17) + SourceIndex(0) +6 >Emitted(80, 22) Source(117, 22) + SourceIndex(0) +7 >Emitted(80, 23) Source(117, 23) + SourceIndex(0) +8 >Emitted(80, 24) Source(117, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(81, 2) Source(118, 2) + SourceIndex(0) +--- +>>>for (var _54 = 0, _55 = [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^ +8 > ^ +9 > ^^ +10> ^^^^ +11> ^^ +12> ^^^^^^^ +13> ^^ +14> ^^^^^^ +15> ^^ +16> ^^ +17> ^^^^^^^ +18> ^^ +19> ^^^^^^^^ +20> ^^ +21> ^^^^^^^^^ +22> ^^ +23> ^^^^^^ +24> ^^ +25> ^^ +26> ^^^^^^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > ({ + > name: nameA = "noName", + > skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "noSkill", secondary: "noSkill" } + > } of +5 > [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] +6 > +7 > +8 > [ +9 > { +10> name +11> : +12> "mower" +13> , +14> skills +15> : +16> { +17> primary +18> : +19> "mowing" +20> , +21> secondary +22> : +23> "none" +24> } +25> } +1->Emitted(82, 1) Source(119, 1) + SourceIndex(0) +2 >Emitted(82, 4) Source(119, 4) + SourceIndex(0) +3 >Emitted(82, 5) Source(119, 5) + SourceIndex(0) +4 >Emitted(82, 6) Source(125, 6) + SourceIndex(0) +5 >Emitted(82, 17) Source(126, 79) + SourceIndex(0) +6 >Emitted(82, 19) Source(125, 6) + SourceIndex(0) +7 >Emitted(82, 25) Source(125, 20) + SourceIndex(0) +8 >Emitted(82, 26) Source(125, 21) + SourceIndex(0) +9 >Emitted(82, 28) Source(125, 23) + SourceIndex(0) +10>Emitted(82, 32) Source(125, 27) + SourceIndex(0) +11>Emitted(82, 34) Source(125, 29) + SourceIndex(0) +12>Emitted(82, 41) Source(125, 36) + SourceIndex(0) +13>Emitted(82, 43) Source(125, 38) + SourceIndex(0) +14>Emitted(82, 49) Source(125, 44) + SourceIndex(0) +15>Emitted(82, 51) Source(125, 46) + SourceIndex(0) +16>Emitted(82, 53) Source(125, 48) + SourceIndex(0) +17>Emitted(82, 60) Source(125, 55) + SourceIndex(0) +18>Emitted(82, 62) Source(125, 57) + SourceIndex(0) +19>Emitted(82, 70) Source(125, 65) + SourceIndex(0) +20>Emitted(82, 72) Source(125, 67) + SourceIndex(0) +21>Emitted(82, 81) Source(125, 76) + SourceIndex(0) +22>Emitted(82, 83) Source(125, 78) + SourceIndex(0) +23>Emitted(82, 89) Source(125, 84) + SourceIndex(0) +24>Emitted(82, 91) Source(125, 86) + SourceIndex(0) +25>Emitted(82, 93) Source(125, 88) + SourceIndex(0) +--- +>>> { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]; _54 < _55.length; _54++) { +1->^^^^ +2 > ^^ +3 > ^^^^ +4 > ^^ +5 > ^^^^^^^^^ +6 > ^^ +7 > ^^^^^^ +8 > ^^ +9 > ^^ +10> ^^^^^^^ +11> ^^ +12> ^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^ +15> ^^ +16> ^^^^^^^^ +17> ^^ +18> ^^ +19> ^ +20> ^^ +21> ^^^^^^^^^^^^^^^^ +22> ^^ +23> ^^^^^ +24> ^ +25> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1->, + > +2 > { +3 > name +4 > : +5 > "trimmer" +6 > , +7 > skills +8 > : +9 > { +10> primary +11> : +12> "trimming" +13> , +14> secondary +15> : +16> "edging" +17> } +18> } +19> ] +20> +21> [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] +22> +23> [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] +24> ) +1->Emitted(83, 5) Source(126, 5) + SourceIndex(0) +2 >Emitted(83, 7) Source(126, 7) + SourceIndex(0) +3 >Emitted(83, 11) Source(126, 11) + SourceIndex(0) +4 >Emitted(83, 13) Source(126, 13) + SourceIndex(0) +5 >Emitted(83, 22) Source(126, 22) + SourceIndex(0) +6 >Emitted(83, 24) Source(126, 24) + SourceIndex(0) +7 >Emitted(83, 30) Source(126, 30) + SourceIndex(0) +8 >Emitted(83, 32) Source(126, 32) + SourceIndex(0) +9 >Emitted(83, 34) Source(126, 34) + SourceIndex(0) +10>Emitted(83, 41) Source(126, 41) + SourceIndex(0) +11>Emitted(83, 43) Source(126, 43) + SourceIndex(0) +12>Emitted(83, 53) Source(126, 53) + SourceIndex(0) +13>Emitted(83, 55) Source(126, 55) + SourceIndex(0) +14>Emitted(83, 64) Source(126, 64) + SourceIndex(0) +15>Emitted(83, 66) Source(126, 66) + SourceIndex(0) +16>Emitted(83, 74) Source(126, 74) + SourceIndex(0) +17>Emitted(83, 76) Source(126, 76) + SourceIndex(0) +18>Emitted(83, 78) Source(126, 78) + SourceIndex(0) +19>Emitted(83, 79) Source(126, 79) + SourceIndex(0) +20>Emitted(83, 81) Source(125, 6) + SourceIndex(0) +21>Emitted(83, 97) Source(126, 79) + SourceIndex(0) +22>Emitted(83, 99) Source(125, 6) + SourceIndex(0) +23>Emitted(83, 104) Source(126, 79) + SourceIndex(0) +24>Emitted(83, 105) Source(126, 80) + SourceIndex(0) +--- +>>> _56 = _55[_54], _57 = _56.name, nameA = _57 === void 0 ? "noName" : _57, _58 = _56.skills, _59 = _58 === void 0 ? { primary: "noSkill", secondary: "noSkill" } : _58, _60 = _59.primary, primaryA = _60 === void 0 ? "primary" : _60, _61 = _59.secondary, secondaryA = _61 === void 0 ? "secondary" : _61; +1->^^^^ +2 > ^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +15> ^^ +16> ^^^^^^^^^^^^^^^^^^^ +17> ^^ +18> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > { + > name: nameA = "noName", + > skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "noSkill", secondary: "noSkill" } + > } +3 > +4 > name: nameA = "noName" +5 > +6 > name: nameA = "noName" +7 > , + > +8 > skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "noSkill", secondary: "noSkill" } +9 > +10> skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "noSkill", secondary: "noSkill" } +11> +12> primary: primaryA = "primary" +13> +14> primary: primaryA = "primary" +15> , + > +16> secondary: secondaryA = "secondary" +17> +18> secondary: secondaryA = "secondary" +1->Emitted(84, 5) Source(119, 6) + SourceIndex(0) +2 >Emitted(84, 19) Source(125, 2) + SourceIndex(0) +3 >Emitted(84, 21) Source(120, 5) + SourceIndex(0) +4 >Emitted(84, 35) Source(120, 27) + SourceIndex(0) +5 >Emitted(84, 37) Source(120, 5) + SourceIndex(0) +6 >Emitted(84, 76) Source(120, 27) + SourceIndex(0) +7 >Emitted(84, 78) Source(121, 5) + SourceIndex(0) +8 >Emitted(84, 94) Source(124, 53) + SourceIndex(0) +9 >Emitted(84, 96) Source(121, 5) + SourceIndex(0) +10>Emitted(84, 169) Source(124, 53) + SourceIndex(0) +11>Emitted(84, 171) Source(122, 9) + SourceIndex(0) +12>Emitted(84, 188) Source(122, 38) + SourceIndex(0) +13>Emitted(84, 190) Source(122, 9) + SourceIndex(0) +14>Emitted(84, 233) Source(122, 38) + SourceIndex(0) +15>Emitted(84, 235) Source(123, 9) + SourceIndex(0) +16>Emitted(84, 254) Source(123, 44) + SourceIndex(0) +17>Emitted(84, 256) Source(123, 9) + SourceIndex(0) +18>Emitted(84, 303) Source(123, 44) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > + > } = { primary: "noSkill", secondary: "noSkill" } + >} of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(85, 5) Source(127, 5) + SourceIndex(0) +2 >Emitted(85, 12) Source(127, 12) + SourceIndex(0) +3 >Emitted(85, 13) Source(127, 13) + SourceIndex(0) +4 >Emitted(85, 16) Source(127, 16) + SourceIndex(0) +5 >Emitted(85, 17) Source(127, 17) + SourceIndex(0) +6 >Emitted(85, 22) Source(127, 22) + SourceIndex(0) +7 >Emitted(85, 23) Source(127, 23) + SourceIndex(0) +8 >Emitted(85, 24) Source(127, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(86, 2) Source(128, 2) + SourceIndex(0) +--- +>>>for (var _62 = 0, robots_4 = robots; _62 < robots_4.length; _62++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^^^^^^^ +10> ^^ +11> ^^^^^ +12> ^ +13> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > + > +2 >for +3 > +4 > ({ name = "noName", skill = "noSkill" } of +5 > robots +6 > +7 > robots +8 > +9 > robots +10> +11> robots +12> ) +1->Emitted(87, 1) Source(130, 1) + SourceIndex(0) +2 >Emitted(87, 4) Source(130, 4) + SourceIndex(0) +3 >Emitted(87, 5) Source(130, 5) + SourceIndex(0) +4 >Emitted(87, 6) Source(130, 49) + SourceIndex(0) +5 >Emitted(87, 17) Source(130, 55) + SourceIndex(0) +6 >Emitted(87, 19) Source(130, 49) + SourceIndex(0) +7 >Emitted(87, 36) Source(130, 55) + SourceIndex(0) +8 >Emitted(87, 38) Source(130, 49) + SourceIndex(0) +9 >Emitted(87, 59) Source(130, 55) + SourceIndex(0) +10>Emitted(87, 61) Source(130, 49) + SourceIndex(0) +11>Emitted(87, 66) Source(130, 55) + SourceIndex(0) +12>Emitted(87, 67) Source(130, 56) + SourceIndex(0) +--- +>>> _63 = robots_4[_62], _64 = _63.name, name = _64 === void 0 ? "noName" : _64, _65 = _63.skill, skill = _65 === void 0 ? "noSkill" : _65; +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > { name = "noName", skill = "noSkill" } +3 > +4 > name = "noName" +5 > +6 > name = "noName" +7 > , +8 > skill = "noSkill" +9 > +10> skill = "noSkill" +1->Emitted(88, 5) Source(130, 6) + SourceIndex(0) +2 >Emitted(88, 24) Source(130, 45) + SourceIndex(0) +3 >Emitted(88, 26) Source(130, 8) + SourceIndex(0) +4 >Emitted(88, 40) Source(130, 23) + SourceIndex(0) +5 >Emitted(88, 42) Source(130, 8) + SourceIndex(0) +6 >Emitted(88, 80) Source(130, 23) + SourceIndex(0) +7 >Emitted(88, 82) Source(130, 25) + SourceIndex(0) +8 >Emitted(88, 97) Source(130, 43) + SourceIndex(0) +9 >Emitted(88, 99) Source(130, 25) + SourceIndex(0) +10>Emitted(88, 139) Source(130, 43) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > } of robots) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(89, 5) Source(131, 5) + SourceIndex(0) +2 >Emitted(89, 12) Source(131, 12) + SourceIndex(0) +3 >Emitted(89, 13) Source(131, 13) + SourceIndex(0) +4 >Emitted(89, 16) Source(131, 16) + SourceIndex(0) +5 >Emitted(89, 17) Source(131, 17) + SourceIndex(0) +6 >Emitted(89, 22) Source(131, 22) + SourceIndex(0) +7 >Emitted(89, 23) Source(131, 23) + SourceIndex(0) +8 >Emitted(89, 24) Source(131, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(90, 2) Source(132, 2) + SourceIndex(0) +--- +>>>for (var _66 = 0, _67 = getRobots(); _66 < _67.length; _66++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^ +8 > ^^^^^^^^^ +9 > ^^ +10> ^^ +11> ^^^^^^^^^^^^^^^^ +12> ^^ +13> ^^^^^ +14> ^ +15> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > ({ name = "noName", skill = "noSkill" } of +5 > getRobots() +6 > +7 > +8 > getRobots +9 > () +10> +11> getRobots() +12> +13> getRobots() +14> ) +1->Emitted(91, 1) Source(133, 1) + SourceIndex(0) +2 >Emitted(91, 4) Source(133, 4) + SourceIndex(0) +3 >Emitted(91, 5) Source(133, 5) + SourceIndex(0) +4 >Emitted(91, 6) Source(133, 49) + SourceIndex(0) +5 >Emitted(91, 17) Source(133, 60) + SourceIndex(0) +6 >Emitted(91, 19) Source(133, 49) + SourceIndex(0) +7 >Emitted(91, 25) Source(133, 49) + SourceIndex(0) +8 >Emitted(91, 34) Source(133, 58) + SourceIndex(0) +9 >Emitted(91, 36) Source(133, 60) + SourceIndex(0) +10>Emitted(91, 38) Source(133, 49) + SourceIndex(0) +11>Emitted(91, 54) Source(133, 60) + SourceIndex(0) +12>Emitted(91, 56) Source(133, 49) + SourceIndex(0) +13>Emitted(91, 61) Source(133, 60) + SourceIndex(0) +14>Emitted(91, 62) Source(133, 61) + SourceIndex(0) +--- +>>> _68 = _67[_66], _69 = _68.name, name = _69 === void 0 ? "noName" : _69, _70 = _68.skill, skill = _70 === void 0 ? "noSkill" : _70; +1->^^^^ +2 > ^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > { name = "noName", skill = "noSkill" } +3 > +4 > name = "noName" +5 > +6 > name = "noName" +7 > , +8 > skill = "noSkill" +9 > +10> skill = "noSkill" +1->Emitted(92, 5) Source(133, 6) + SourceIndex(0) +2 >Emitted(92, 19) Source(133, 45) + SourceIndex(0) +3 >Emitted(92, 21) Source(133, 8) + SourceIndex(0) +4 >Emitted(92, 35) Source(133, 23) + SourceIndex(0) +5 >Emitted(92, 37) Source(133, 8) + SourceIndex(0) +6 >Emitted(92, 75) Source(133, 23) + SourceIndex(0) +7 >Emitted(92, 77) Source(133, 25) + SourceIndex(0) +8 >Emitted(92, 92) Source(133, 42) + SourceIndex(0) +9 >Emitted(92, 94) Source(133, 25) + SourceIndex(0) +10>Emitted(92, 134) Source(133, 42) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > } of getRobots()) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(93, 5) Source(134, 5) + SourceIndex(0) +2 >Emitted(93, 12) Source(134, 12) + SourceIndex(0) +3 >Emitted(93, 13) Source(134, 13) + SourceIndex(0) +4 >Emitted(93, 16) Source(134, 16) + SourceIndex(0) +5 >Emitted(93, 17) Source(134, 17) + SourceIndex(0) +6 >Emitted(93, 22) Source(134, 22) + SourceIndex(0) +7 >Emitted(93, 23) Source(134, 23) + SourceIndex(0) +8 >Emitted(93, 24) Source(134, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(94, 2) Source(135, 2) + SourceIndex(0) +--- +>>>for (var _71 = 0, _72 = [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]; _71 < _72.length; _71++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^ +8 > ^^ +9 > ^^^^ +10> ^^ +11> ^^^^^^^ +12> ^^ +13> ^^^^^ +14> ^^ +15> ^^^^^^^^ +16> ^^ +17> ^^ +18> ^^ +19> ^^^^ +20> ^^ +21> ^^^^^^^^^ +22> ^^ +23> ^^^^^ +24> ^^ +25> ^^^^^^^^^^ +26> ^^ +27> ^ +28> ^^ +29> ^^^^^^^^^^^^^^^^ +30> ^^ +31> ^^^^^ +32> ^ +33> ^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > ({ name = "noName", skill = "noSkill" } of +5 > [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }] +6 > +7 > [ +8 > { +9 > name +10> : +11> "mower" +12> , +13> skill +14> : +15> "mowing" +16> } +17> , +18> { +19> name +20> : +21> "trimmer" +22> , +23> skill +24> : +25> "trimming" +26> } +27> ] +28> +29> [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }] +30> +31> [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }] +32> ) +1->Emitted(95, 1) Source(136, 1) + SourceIndex(0) +2 >Emitted(95, 4) Source(136, 4) + SourceIndex(0) +3 >Emitted(95, 5) Source(136, 5) + SourceIndex(0) +4 >Emitted(95, 6) Source(136, 49) + SourceIndex(0) +5 >Emitted(95, 17) Source(136, 125) + SourceIndex(0) +6 >Emitted(95, 19) Source(136, 49) + SourceIndex(0) +7 >Emitted(95, 26) Source(136, 50) + SourceIndex(0) +8 >Emitted(95, 28) Source(136, 52) + SourceIndex(0) +9 >Emitted(95, 32) Source(136, 56) + SourceIndex(0) +10>Emitted(95, 34) Source(136, 58) + SourceIndex(0) +11>Emitted(95, 41) Source(136, 65) + SourceIndex(0) +12>Emitted(95, 43) Source(136, 67) + SourceIndex(0) +13>Emitted(95, 48) Source(136, 72) + SourceIndex(0) +14>Emitted(95, 50) Source(136, 74) + SourceIndex(0) +15>Emitted(95, 58) Source(136, 82) + SourceIndex(0) +16>Emitted(95, 60) Source(136, 84) + SourceIndex(0) +17>Emitted(95, 62) Source(136, 86) + SourceIndex(0) +18>Emitted(95, 64) Source(136, 88) + SourceIndex(0) +19>Emitted(95, 68) Source(136, 92) + SourceIndex(0) +20>Emitted(95, 70) Source(136, 94) + SourceIndex(0) +21>Emitted(95, 79) Source(136, 103) + SourceIndex(0) +22>Emitted(95, 81) Source(136, 105) + SourceIndex(0) +23>Emitted(95, 86) Source(136, 110) + SourceIndex(0) +24>Emitted(95, 88) Source(136, 112) + SourceIndex(0) +25>Emitted(95, 98) Source(136, 122) + SourceIndex(0) +26>Emitted(95, 100) Source(136, 124) + SourceIndex(0) +27>Emitted(95, 101) Source(136, 125) + SourceIndex(0) +28>Emitted(95, 103) Source(136, 49) + SourceIndex(0) +29>Emitted(95, 119) Source(136, 125) + SourceIndex(0) +30>Emitted(95, 121) Source(136, 49) + SourceIndex(0) +31>Emitted(95, 126) Source(136, 125) + SourceIndex(0) +32>Emitted(95, 127) Source(136, 126) + SourceIndex(0) +--- +>>> _73 = _72[_71], _74 = _73.name, name = _74 === void 0 ? "noName" : _74, _75 = _73.skill, skill = _75 === void 0 ? "noSkill" : _75; +1->^^^^ +2 > ^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > { name = "noName", skill = "noSkill" } +3 > +4 > name = "noName" +5 > +6 > name = "noName" +7 > , +8 > skill = "noSkill" +9 > +10> skill = "noSkill" +1->Emitted(96, 5) Source(136, 6) + SourceIndex(0) +2 >Emitted(96, 19) Source(136, 45) + SourceIndex(0) +3 >Emitted(96, 21) Source(136, 8) + SourceIndex(0) +4 >Emitted(96, 35) Source(136, 23) + SourceIndex(0) +5 >Emitted(96, 37) Source(136, 8) + SourceIndex(0) +6 >Emitted(96, 75) Source(136, 23) + SourceIndex(0) +7 >Emitted(96, 77) Source(136, 25) + SourceIndex(0) +8 >Emitted(96, 92) Source(136, 43) + SourceIndex(0) +9 >Emitted(96, 94) Source(136, 25) + SourceIndex(0) +10>Emitted(96, 134) Source(136, 43) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(97, 5) Source(137, 5) + SourceIndex(0) +2 >Emitted(97, 12) Source(137, 12) + SourceIndex(0) +3 >Emitted(97, 13) Source(137, 13) + SourceIndex(0) +4 >Emitted(97, 16) Source(137, 16) + SourceIndex(0) +5 >Emitted(97, 17) Source(137, 17) + SourceIndex(0) +6 >Emitted(97, 22) Source(137, 22) + SourceIndex(0) +7 >Emitted(97, 23) Source(137, 23) + SourceIndex(0) +8 >Emitted(97, 24) Source(137, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(98, 2) Source(138, 2) + SourceIndex(0) +--- +>>>for (var _76 = 0, multiRobots_4 = multiRobots; _76 < multiRobots_4.length; _76++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^^^^^^^^^^^^ +10> ^^ +11> ^^^^^ +12> ^ +13> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > ({ + > name = "noName", + > skills: { + > primary = "primary", + > secondary = "secondary" + > } = { primary: "noSkill", secondary: "noSkill" } + > } of +5 > multiRobots +6 > +7 > multiRobots +8 > +9 > multiRobots +10> +11> multiRobots +12> ) +1->Emitted(99, 1) Source(139, 1) + SourceIndex(0) +2 >Emitted(99, 4) Source(139, 4) + SourceIndex(0) +3 >Emitted(99, 5) Source(139, 5) + SourceIndex(0) +4 >Emitted(99, 6) Source(145, 6) + SourceIndex(0) +5 >Emitted(99, 17) Source(145, 17) + SourceIndex(0) +6 >Emitted(99, 19) Source(145, 6) + SourceIndex(0) +7 >Emitted(99, 46) Source(145, 17) + SourceIndex(0) +8 >Emitted(99, 48) Source(145, 6) + SourceIndex(0) +9 >Emitted(99, 74) Source(145, 17) + SourceIndex(0) +10>Emitted(99, 76) Source(145, 6) + SourceIndex(0) +11>Emitted(99, 81) Source(145, 17) + SourceIndex(0) +12>Emitted(99, 82) Source(145, 18) + SourceIndex(0) +--- +>>> _77 = multiRobots_4[_76], _78 = _77.name, name = _78 === void 0 ? "noName" : _78, _79 = _77.skills, _80 = _79 === void 0 ? { primary: "noSkill", secondary: "noSkill" } : _79, _81 = _80.primary, primary = _81 === void 0 ? "primary" : _81, _82 = _80.secondary, secondary = _82 === void 0 ? "secondary" : _82; +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +15> ^^ +16> ^^^^^^^^^^^^^^^^^^^ +17> ^^ +18> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > { + > name = "noName", + > skills: { + > primary = "primary", + > secondary = "secondary" + > } = { primary: "noSkill", secondary: "noSkill" } + > } +3 > +4 > name = "noName" +5 > +6 > name = "noName" +7 > , + > +8 > skills: { + > primary = "primary", + > secondary = "secondary" + > } = { primary: "noSkill", secondary: "noSkill" } +9 > +10> skills: { + > primary = "primary", + > secondary = "secondary" + > } = { primary: "noSkill", secondary: "noSkill" } +11> +12> primary = "primary" +13> +14> primary = "primary" +15> , + > +16> secondary = "secondary" +17> +18> secondary = "secondary" +1->Emitted(100, 5) Source(139, 6) + SourceIndex(0) +2 >Emitted(100, 29) Source(145, 2) + SourceIndex(0) +3 >Emitted(100, 31) Source(140, 5) + SourceIndex(0) +4 >Emitted(100, 45) Source(140, 20) + SourceIndex(0) +5 >Emitted(100, 47) Source(140, 5) + SourceIndex(0) +6 >Emitted(100, 85) Source(140, 20) + SourceIndex(0) +7 >Emitted(100, 87) Source(141, 5) + SourceIndex(0) +8 >Emitted(100, 103) Source(144, 53) + SourceIndex(0) +9 >Emitted(100, 105) Source(141, 5) + SourceIndex(0) +10>Emitted(100, 178) Source(144, 53) + SourceIndex(0) +11>Emitted(100, 180) Source(142, 9) + SourceIndex(0) +12>Emitted(100, 197) Source(142, 28) + SourceIndex(0) +13>Emitted(100, 199) Source(142, 9) + SourceIndex(0) +14>Emitted(100, 241) Source(142, 28) + SourceIndex(0) +15>Emitted(100, 243) Source(143, 9) + SourceIndex(0) +16>Emitted(100, 262) Source(143, 32) + SourceIndex(0) +17>Emitted(100, 264) Source(143, 9) + SourceIndex(0) +18>Emitted(100, 310) Source(143, 32) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > + > } = { primary: "noSkill", secondary: "noSkill" } + >} of multiRobots) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(101, 5) Source(146, 5) + SourceIndex(0) +2 >Emitted(101, 12) Source(146, 12) + SourceIndex(0) +3 >Emitted(101, 13) Source(146, 13) + SourceIndex(0) +4 >Emitted(101, 16) Source(146, 16) + SourceIndex(0) +5 >Emitted(101, 17) Source(146, 17) + SourceIndex(0) +6 >Emitted(101, 22) Source(146, 22) + SourceIndex(0) +7 >Emitted(101, 23) Source(146, 23) + SourceIndex(0) +8 >Emitted(101, 24) Source(146, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(102, 2) Source(147, 2) + SourceIndex(0) +--- +>>>for (var _83 = 0, _84 = getMultiRobots(); _83 < _84.length; _83++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^ +8 > ^^^^^^^^^^^^^^ +9 > ^^ +10> ^^ +11> ^^^^^^^^^^^^^^^^ +12> ^^ +13> ^^^^^ +14> ^ +15> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > ({ + > name = "noName", + > skills: { + > primary = "primary", + > secondary = "secondary" + > } = { primary: "noSkill", secondary: "noSkill" } + > } of +5 > getMultiRobots() +6 > +7 > +8 > getMultiRobots +9 > () +10> +11> getMultiRobots() +12> +13> getMultiRobots() +14> ) +1->Emitted(103, 1) Source(148, 1) + SourceIndex(0) +2 >Emitted(103, 4) Source(148, 4) + SourceIndex(0) +3 >Emitted(103, 5) Source(148, 5) + SourceIndex(0) +4 >Emitted(103, 6) Source(154, 6) + SourceIndex(0) +5 >Emitted(103, 17) Source(154, 22) + SourceIndex(0) +6 >Emitted(103, 19) Source(154, 6) + SourceIndex(0) +7 >Emitted(103, 25) Source(154, 6) + SourceIndex(0) +8 >Emitted(103, 39) Source(154, 20) + SourceIndex(0) +9 >Emitted(103, 41) Source(154, 22) + SourceIndex(0) +10>Emitted(103, 43) Source(154, 6) + SourceIndex(0) +11>Emitted(103, 59) Source(154, 22) + SourceIndex(0) +12>Emitted(103, 61) Source(154, 6) + SourceIndex(0) +13>Emitted(103, 66) Source(154, 22) + SourceIndex(0) +14>Emitted(103, 67) Source(154, 23) + SourceIndex(0) +--- +>>> _85 = _84[_83], _86 = _85.name, name = _86 === void 0 ? "noName" : _86, _87 = _85.skills, _88 = _87 === void 0 ? { primary: "noSkill", secondary: "noSkill" } : _87, _89 = _88.primary, primary = _89 === void 0 ? "primary" : _89, _90 = _88.secondary, secondary = _90 === void 0 ? "secondary" : _90; +1->^^^^ +2 > ^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +15> ^^ +16> ^^^^^^^^^^^^^^^^^^^ +17> ^^ +18> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > { + > name = "noName", + > skills: { + > primary = "primary", + > secondary = "secondary" + > } = { primary: "noSkill", secondary: "noSkill" } + > } +3 > +4 > name = "noName" +5 > +6 > name = "noName" +7 > , + > +8 > skills: { + > primary = "primary", + > secondary = "secondary" + > } = { primary: "noSkill", secondary: "noSkill" } +9 > +10> skills: { + > primary = "primary", + > secondary = "secondary" + > } = { primary: "noSkill", secondary: "noSkill" } +11> +12> primary = "primary" +13> +14> primary = "primary" +15> , + > +16> secondary = "secondary" +17> +18> secondary = "secondary" +1->Emitted(104, 5) Source(148, 6) + SourceIndex(0) +2 >Emitted(104, 19) Source(154, 2) + SourceIndex(0) +3 >Emitted(104, 21) Source(149, 5) + SourceIndex(0) +4 >Emitted(104, 35) Source(149, 20) + SourceIndex(0) +5 >Emitted(104, 37) Source(149, 5) + SourceIndex(0) +6 >Emitted(104, 75) Source(149, 20) + SourceIndex(0) +7 >Emitted(104, 77) Source(150, 5) + SourceIndex(0) +8 >Emitted(104, 93) Source(153, 53) + SourceIndex(0) +9 >Emitted(104, 95) Source(150, 5) + SourceIndex(0) +10>Emitted(104, 168) Source(153, 53) + SourceIndex(0) +11>Emitted(104, 170) Source(151, 9) + SourceIndex(0) +12>Emitted(104, 187) Source(151, 28) + SourceIndex(0) +13>Emitted(104, 189) Source(151, 9) + SourceIndex(0) +14>Emitted(104, 231) Source(151, 28) + SourceIndex(0) +15>Emitted(104, 233) Source(152, 9) + SourceIndex(0) +16>Emitted(104, 252) Source(152, 32) + SourceIndex(0) +17>Emitted(104, 254) Source(152, 9) + SourceIndex(0) +18>Emitted(104, 300) Source(152, 32) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > + > } = { primary: "noSkill", secondary: "noSkill" } + >} of getMultiRobots()) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(105, 5) Source(155, 5) + SourceIndex(0) +2 >Emitted(105, 12) Source(155, 12) + SourceIndex(0) +3 >Emitted(105, 13) Source(155, 13) + SourceIndex(0) +4 >Emitted(105, 16) Source(155, 16) + SourceIndex(0) +5 >Emitted(105, 17) Source(155, 17) + SourceIndex(0) +6 >Emitted(105, 22) Source(155, 22) + SourceIndex(0) +7 >Emitted(105, 23) Source(155, 23) + SourceIndex(0) +8 >Emitted(105, 24) Source(155, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(106, 2) Source(156, 2) + SourceIndex(0) +--- +>>>for (var _91 = 0, _92 = [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^ +8 > ^^ +9 > ^^^^ +10> ^^ +11> ^^^^^^^ +12> ^^ +13> ^^^^^^ +14> ^^ +15> ^^ +16> ^^^^^^^ +17> ^^ +18> ^^^^^^^^ +19> ^^ +20> ^^^^^^^^^ +21> ^^ +22> ^^^^^^ +23> ^^ +24> ^^ +25> ^^^^^^^^^^^^^^^-> +1-> + > +2 >for +3 > +4 > ({ + > name = "noName", + > skills: { + > primary = "primary", + > secondary = "secondary" + > } = { primary: "noSkill", secondary: "noSkill" } + > } of +5 > [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] +6 > +7 > [ +8 > { +9 > name +10> : +11> "mower" +12> , +13> skills +14> : +15> { +16> primary +17> : +18> "mowing" +19> , +20> secondary +21> : +22> "none" +23> } +24> } +1->Emitted(107, 1) Source(157, 1) + SourceIndex(0) +2 >Emitted(107, 4) Source(157, 4) + SourceIndex(0) +3 >Emitted(107, 5) Source(157, 5) + SourceIndex(0) +4 >Emitted(107, 6) Source(163, 6) + SourceIndex(0) +5 >Emitted(107, 17) Source(164, 79) + SourceIndex(0) +6 >Emitted(107, 19) Source(163, 6) + SourceIndex(0) +7 >Emitted(107, 26) Source(163, 7) + SourceIndex(0) +8 >Emitted(107, 28) Source(163, 9) + SourceIndex(0) +9 >Emitted(107, 32) Source(163, 13) + SourceIndex(0) +10>Emitted(107, 34) Source(163, 15) + SourceIndex(0) +11>Emitted(107, 41) Source(163, 22) + SourceIndex(0) +12>Emitted(107, 43) Source(163, 24) + SourceIndex(0) +13>Emitted(107, 49) Source(163, 30) + SourceIndex(0) +14>Emitted(107, 51) Source(163, 32) + SourceIndex(0) +15>Emitted(107, 53) Source(163, 34) + SourceIndex(0) +16>Emitted(107, 60) Source(163, 41) + SourceIndex(0) +17>Emitted(107, 62) Source(163, 43) + SourceIndex(0) +18>Emitted(107, 70) Source(163, 51) + SourceIndex(0) +19>Emitted(107, 72) Source(163, 53) + SourceIndex(0) +20>Emitted(107, 81) Source(163, 62) + SourceIndex(0) +21>Emitted(107, 83) Source(163, 64) + SourceIndex(0) +22>Emitted(107, 89) Source(163, 70) + SourceIndex(0) +23>Emitted(107, 91) Source(163, 72) + SourceIndex(0) +24>Emitted(107, 93) Source(163, 74) + SourceIndex(0) +--- +>>> { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]; _91 < _92.length; _91++) { +1->^^^^ +2 > ^^ +3 > ^^^^ +4 > ^^ +5 > ^^^^^^^^^ +6 > ^^ +7 > ^^^^^^ +8 > ^^ +9 > ^^ +10> ^^^^^^^ +11> ^^ +12> ^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^ +15> ^^ +16> ^^^^^^^^ +17> ^^ +18> ^^ +19> ^ +20> ^^ +21> ^^^^^^^^^^^^^^^^ +22> ^^ +23> ^^^^^ +24> ^ +25> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1->, + > +2 > { +3 > name +4 > : +5 > "trimmer" +6 > , +7 > skills +8 > : +9 > { +10> primary +11> : +12> "trimming" +13> , +14> secondary +15> : +16> "edging" +17> } +18> } +19> ] +20> +21> [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] +22> +23> [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] +24> ) +1->Emitted(108, 5) Source(164, 5) + SourceIndex(0) +2 >Emitted(108, 7) Source(164, 7) + SourceIndex(0) +3 >Emitted(108, 11) Source(164, 11) + SourceIndex(0) +4 >Emitted(108, 13) Source(164, 13) + SourceIndex(0) +5 >Emitted(108, 22) Source(164, 22) + SourceIndex(0) +6 >Emitted(108, 24) Source(164, 24) + SourceIndex(0) +7 >Emitted(108, 30) Source(164, 30) + SourceIndex(0) +8 >Emitted(108, 32) Source(164, 32) + SourceIndex(0) +9 >Emitted(108, 34) Source(164, 34) + SourceIndex(0) +10>Emitted(108, 41) Source(164, 41) + SourceIndex(0) +11>Emitted(108, 43) Source(164, 43) + SourceIndex(0) +12>Emitted(108, 53) Source(164, 53) + SourceIndex(0) +13>Emitted(108, 55) Source(164, 55) + SourceIndex(0) +14>Emitted(108, 64) Source(164, 64) + SourceIndex(0) +15>Emitted(108, 66) Source(164, 66) + SourceIndex(0) +16>Emitted(108, 74) Source(164, 74) + SourceIndex(0) +17>Emitted(108, 76) Source(164, 76) + SourceIndex(0) +18>Emitted(108, 78) Source(164, 78) + SourceIndex(0) +19>Emitted(108, 79) Source(164, 79) + SourceIndex(0) +20>Emitted(108, 81) Source(163, 6) + SourceIndex(0) +21>Emitted(108, 97) Source(164, 79) + SourceIndex(0) +22>Emitted(108, 99) Source(163, 6) + SourceIndex(0) +23>Emitted(108, 104) Source(164, 79) + SourceIndex(0) +24>Emitted(108, 105) Source(164, 80) + SourceIndex(0) +--- +>>> _93 = _92[_91], _94 = _93.name, name = _94 === void 0 ? "noName" : _94, _95 = _93.skills, _96 = _95 === void 0 ? { primary: "noSkill", secondary: "noSkill" } : _95, _97 = _96.primary, primary = _97 === void 0 ? "primary" : _97, _98 = _96.secondary, secondary = _98 === void 0 ? "secondary" : _98; +1->^^^^ +2 > ^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +15> ^^ +16> ^^^^^^^^^^^^^^^^^^^ +17> ^^ +18> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > { + > name = "noName", + > skills: { + > primary = "primary", + > secondary = "secondary" + > } = { primary: "noSkill", secondary: "noSkill" } + > } +3 > +4 > name = "noName" +5 > +6 > name = "noName" +7 > , + > +8 > skills: { + > primary = "primary", + > secondary = "secondary" + > } = { primary: "noSkill", secondary: "noSkill" } +9 > +10> skills: { + > primary = "primary", + > secondary = "secondary" + > } = { primary: "noSkill", secondary: "noSkill" } +11> +12> primary = "primary" +13> +14> primary = "primary" +15> , + > +16> secondary = "secondary" +17> +18> secondary = "secondary" +1->Emitted(109, 5) Source(157, 6) + SourceIndex(0) +2 >Emitted(109, 19) Source(163, 2) + SourceIndex(0) +3 >Emitted(109, 21) Source(158, 5) + SourceIndex(0) +4 >Emitted(109, 35) Source(158, 20) + SourceIndex(0) +5 >Emitted(109, 37) Source(158, 5) + SourceIndex(0) +6 >Emitted(109, 75) Source(158, 20) + SourceIndex(0) +7 >Emitted(109, 77) Source(159, 5) + SourceIndex(0) +8 >Emitted(109, 93) Source(162, 53) + SourceIndex(0) +9 >Emitted(109, 95) Source(159, 5) + SourceIndex(0) +10>Emitted(109, 168) Source(162, 53) + SourceIndex(0) +11>Emitted(109, 170) Source(160, 9) + SourceIndex(0) +12>Emitted(109, 187) Source(160, 28) + SourceIndex(0) +13>Emitted(109, 189) Source(160, 9) + SourceIndex(0) +14>Emitted(109, 231) Source(160, 28) + SourceIndex(0) +15>Emitted(109, 233) Source(161, 9) + SourceIndex(0) +16>Emitted(109, 252) Source(161, 32) + SourceIndex(0) +17>Emitted(109, 254) Source(161, 9) + SourceIndex(0) +18>Emitted(109, 300) Source(161, 32) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > + > } = { primary: "noSkill", secondary: "noSkill" } + >} of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + > { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(110, 5) Source(165, 5) + SourceIndex(0) +2 >Emitted(110, 12) Source(165, 12) + SourceIndex(0) +3 >Emitted(110, 13) Source(165, 13) + SourceIndex(0) +4 >Emitted(110, 16) Source(165, 16) + SourceIndex(0) +5 >Emitted(110, 17) Source(165, 17) + SourceIndex(0) +6 >Emitted(110, 22) Source(165, 22) + SourceIndex(0) +7 >Emitted(110, 23) Source(165, 23) + SourceIndex(0) +8 >Emitted(110, 24) Source(165, 24) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(111, 2) Source(166, 2) + SourceIndex(0) +--- +>>>var _a, _d, _g, _j, _k, _l, _m, _q, _r, _s, _t, _w, _x, _y, _z, _1, _4, _7, _9, _10, _11, _12, _15, _16, _17, _18, _21, _22, _23, _24, _26, _27, _28, _31, _32, _33, _36, _37, _38, _40, _41, _42, _43, _44, _45, _48, _49, _50, _51, _52, _53, _56, _57, _58, _59, _60, _61, _63, _64, _65, _68, _69, _70, _73, _74, _75, _77, _78, _79, _80, _81, _82, _85, _86, _87, _88, _89, _90, _93, _94, _95, _96, _97, _98; +>>>//# sourceMappingURL=sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.symbols b/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.symbols new file mode 100644 index 00000000000..ebbda4d0517 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.symbols @@ -0,0 +1,564 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts === +declare var console: { +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 0, 11)) + + log(msg: any): void; +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 0, 22)) +>msg : Symbol(msg, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 1, 8)) +} +interface Robot { +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 2, 1)) + + name: string; +>name : Symbol(Robot.name, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 3, 17)) + + skill: string; +>skill : Symbol(Robot.skill, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 4, 17)) +} + +interface MultiRobot { +>MultiRobot : Symbol(MultiRobot, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 6, 1)) + + name: string; +>name : Symbol(MultiRobot.name, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 8, 22)) + + skills: { +>skills : Symbol(MultiRobot.skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 9, 17)) + + primary: string; +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 10, 13)) + + secondary: string; +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 11, 24)) + + }; +} + +let robots: Robot[] = [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]; +>robots : Symbol(robots, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 16, 3)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 2, 1)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 16, 24)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 16, 39)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 16, 60)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 16, 77)) + +let multiRobots: MultiRobot[] = [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, +>multiRobots : Symbol(multiRobots, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 17, 3)) +>MultiRobot : Symbol(MultiRobot, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 6, 1)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 17, 34)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 17, 49)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 17, 59)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 17, 78)) + + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]; +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 18, 5)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 18, 22)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 18, 32)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 18, 53)) + +function getRobots() { +>getRobots : Symbol(getRobots, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 18, 79)) + + return robots; +>robots : Symbol(robots, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 16, 3)) +} + +function getMultiRobots() { +>getMultiRobots : Symbol(getMultiRobots, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 22, 1)) + + return multiRobots; +>multiRobots : Symbol(multiRobots, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 17, 3)) +} + +let nameA: string, primaryA: string, secondaryA: string, i: number, skillA: string; +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 28, 3)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 28, 18)) +>secondaryA : Symbol(secondaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 28, 36)) +>i : Symbol(i, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 28, 56)) +>skillA : Symbol(skillA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 28, 67)) + +let name: string, primary: string, secondary: string, skill: string; +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 29, 3)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 29, 17)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 29, 34)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 29, 53)) + +for ({name: nameA = "noName" } of robots) { +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 31, 6)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 28, 3)) +>robots : Symbol(robots, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 16, 3)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 28, 3)) +} +for ({name: nameA = "noName" } of getRobots()) { +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 34, 6)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 28, 3)) +>getRobots : Symbol(getRobots, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 18, 79)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 28, 3)) +} +for ({name: nameA = "noName" } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 37, 6)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 28, 3)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 37, 36)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 37, 51)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 37, 72)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 37, 89)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 28, 3)) +} +for ({ skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 40, 6)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 40, 16)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 28, 18)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 40, 47)) +>secondaryA : Symbol(secondaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 28, 36)) + + { primary: "nosKill", secondary: "noSkill" } } of multiRobots) { +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 41, 5)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 41, 25)) +>multiRobots : Symbol(multiRobots, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 17, 3)) + + console.log(primaryA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 0, 22)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 28, 18)) +} +for ({ skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 44, 6)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 44, 16)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 28, 18)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 44, 47)) +>secondaryA : Symbol(secondaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 28, 36)) + + { primary: "nosKill", secondary: "noSkill" } } of getMultiRobots()) { +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 45, 5)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 45, 25)) +>getMultiRobots : Symbol(getMultiRobots, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 22, 1)) + + console.log(primaryA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 0, 22)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 28, 18)) +} +for ({ skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 48, 6)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 48, 16)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 28, 18)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 48, 47)) +>secondaryA : Symbol(secondaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 28, 36)) + + { primary: "nosKill", secondary: "noSkill" } } of +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 49, 5)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 49, 25)) + + [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, +>MultiRobot : Symbol(MultiRobot, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 6, 1)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 50, 20)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 50, 35)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 50, 45)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 50, 64)) + + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 51, 9)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 51, 26)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 51, 36)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 51, 57)) + + console.log(primaryA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 0, 22)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 28, 18)) +} + +for ({ name = "noName" } of robots) { +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 55, 6)) +>robots : Symbol(robots, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 16, 3)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 28, 3)) +} +for ({ name = "noName" } of getRobots()) { +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 58, 6)) +>getRobots : Symbol(getRobots, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 18, 79)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 28, 3)) +} +for ({ name = "noName" } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 61, 6)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 61, 30)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 61, 45)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 61, 66)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 61, 83)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 28, 3)) +} +for ({ + skills: { +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 64, 6)) + + primary = "primary", +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 65, 13)) + + secondary = "secondary" +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 66, 28)) + + } = { primary: "noSkill", secondary: "noSkill" } +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 68, 9)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 68, 29)) + +} of multiRobots) { +>multiRobots : Symbol(multiRobots, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 17, 3)) + + console.log(primaryA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 0, 22)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 28, 18)) +} +for ({ + skills: { +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 72, 6)) + + primary = "primary", +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 73, 13)) + + secondary = "secondary" +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 74, 28)) + + } = { primary: "noSkill", secondary: "noSkill" } +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 76, 9)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 76, 29)) + +} of getMultiRobots()) { +>getMultiRobots : Symbol(getMultiRobots, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 22, 1)) + + console.log(primaryA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 0, 22)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 28, 18)) +} +for ({ + skills: { +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 80, 6)) + + primary = "primary", +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 81, 13)) + + secondary = "secondary" +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 82, 28)) + + } = { primary: "noSkill", secondary: "noSkill" } +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 84, 9)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 84, 29)) + +} of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 85, 7)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 85, 22)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 85, 32)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 85, 51)) + + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 86, 5)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 86, 22)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 86, 32)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 86, 53)) + + console.log(primaryA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 0, 22)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 28, 18)) +} + + +for ({name: nameA = "noName", skill: skillA = "noSkill" } of robots) { +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 91, 6)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 28, 3)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 91, 29)) +>skillA : Symbol(skillA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 28, 67)) +>robots : Symbol(robots, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 16, 3)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 28, 3)) +} +for ({name: nameA = "noName", skill: skillA = "noSkill" } of getRobots()) { +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 94, 6)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 28, 3)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 94, 29)) +>skillA : Symbol(skillA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 28, 67)) +>getRobots : Symbol(getRobots, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 18, 79)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 28, 3)) +} +for ({name: nameA = "noName", skill: skillA = "noSkill" } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 97, 6)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 28, 3)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 97, 29)) +>skillA : Symbol(skillA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 28, 67)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 97, 64)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 97, 79)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 97, 100)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 97, 117)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 28, 3)) +} +for ({ + name: nameA = "noName", +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 100, 6)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 28, 3)) + + skills: { +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 101, 27)) + + primary: primaryA = "primary", +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 102, 13)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 28, 18)) + + secondary: secondaryA = "secondary" +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 103, 38)) +>secondaryA : Symbol(secondaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 28, 36)) + + } = { primary: "noSkill", secondary: "noSkill" } +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 105, 9)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 105, 29)) + +} of multiRobots) { +>multiRobots : Symbol(multiRobots, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 17, 3)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 28, 3)) +} +for ({ + name: nameA = "noName", +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 109, 6)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 28, 3)) + + skills: { +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 110, 27)) + + primary: primaryA = "primary", +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 111, 13)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 28, 18)) + + secondary: secondaryA = "secondary" +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 112, 38)) +>secondaryA : Symbol(secondaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 28, 36)) + + } = { primary: "noSkill", secondary: "noSkill" } +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 114, 9)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 114, 29)) + +} of getMultiRobots()) { +>getMultiRobots : Symbol(getMultiRobots, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 22, 1)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 28, 3)) +} +for ({ + name: nameA = "noName", +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 118, 6)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 28, 3)) + + skills: { +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 119, 27)) + + primary: primaryA = "primary", +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 120, 13)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 28, 18)) + + secondary: secondaryA = "secondary" +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 121, 38)) +>secondaryA : Symbol(secondaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 28, 36)) + + } = { primary: "noSkill", secondary: "noSkill" } +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 123, 9)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 123, 29)) + +} of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, +>MultiRobot : Symbol(MultiRobot, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 6, 1)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 124, 21)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 124, 36)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 124, 46)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 124, 65)) + + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 125, 5)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 125, 22)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 125, 32)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 125, 53)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 28, 3)) +} + +for ({ name = "noName", skill = "noSkill" } of robots) { +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 129, 6)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 129, 23)) +>robots : Symbol(robots, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 16, 3)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 28, 3)) +} +for ({ name = "noName", skill = "noSkill" } of getRobots()) { +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 132, 6)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 132, 23)) +>getRobots : Symbol(getRobots, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 18, 79)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 28, 3)) +} +for ({ name = "noName", skill = "noSkill" } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 135, 6)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 135, 23)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 135, 50)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 135, 65)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 135, 86)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 135, 103)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 28, 3)) +} +for ({ + name = "noName", +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 138, 6)) + + skills: { +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 139, 20)) + + primary = "primary", +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 140, 13)) + + secondary = "secondary" +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 141, 28)) + + } = { primary: "noSkill", secondary: "noSkill" } +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 143, 9)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 143, 29)) + +} of multiRobots) { +>multiRobots : Symbol(multiRobots, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 17, 3)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 28, 3)) +} +for ({ + name = "noName", +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 147, 6)) + + skills: { +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 148, 20)) + + primary = "primary", +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 149, 13)) + + secondary = "secondary" +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 150, 28)) + + } = { primary: "noSkill", secondary: "noSkill" } +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 152, 9)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 152, 29)) + +} of getMultiRobots()) { +>getMultiRobots : Symbol(getMultiRobots, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 22, 1)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 28, 3)) +} +for ({ + name = "noName", +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 156, 6)) + + skills: { +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 157, 20)) + + primary = "primary", +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 158, 13)) + + secondary = "secondary" +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 159, 28)) + + } = { primary: "noSkill", secondary: "noSkill" } +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 161, 9)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 161, 29)) + +} of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 162, 7)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 162, 22)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 162, 32)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 162, 51)) + + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 163, 5)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 163, 22)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 163, 32)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 163, 53)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts, 28, 3)) +} diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.types b/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.types new file mode 100644 index 00000000000..adb5d515fe4 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.types @@ -0,0 +1,829 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts === +declare var console: { +>console : { log(msg: any): void; } + + log(msg: any): void; +>log : (msg: any) => void +>msg : any +} +interface Robot { +>Robot : Robot + + name: string; +>name : string + + skill: string; +>skill : string +} + +interface MultiRobot { +>MultiRobot : MultiRobot + + name: string; +>name : string + + skills: { +>skills : { primary: string; secondary: string; } + + primary: string; +>primary : string + + secondary: string; +>secondary : string + + }; +} + +let robots: Robot[] = [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]; +>robots : Robot[] +>Robot : Robot +>[{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }] : { name: string; skill: string; }[] +>{ name: "mower", skill: "mowing" } : { name: string; skill: string; } +>name : string +>"mower" : string +>skill : string +>"mowing" : string +>{ name: "trimmer", skill: "trimming" } : { name: string; skill: string; } +>name : string +>"trimmer" : string +>skill : string +>"trimming" : string + +let multiRobots: MultiRobot[] = [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, +>multiRobots : MultiRobot[] +>MultiRobot : MultiRobot +>[{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] : { name: string; skills: { primary: string; secondary: string; }; }[] +>{ name: "mower", skills: { primary: "mowing", secondary: "none" } } : { name: string; skills: { primary: string; secondary: string; }; } +>name : string +>"mower" : string +>skills : { primary: string; secondary: string; } +>{ primary: "mowing", secondary: "none" } : { primary: string; secondary: string; } +>primary : string +>"mowing" : string +>secondary : string +>"none" : string + + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]; +>{ name: "trimmer", skills: { primary: "trimming", secondary: "edging" } } : { name: string; skills: { primary: string; secondary: string; }; } +>name : string +>"trimmer" : string +>skills : { primary: string; secondary: string; } +>{ primary: "trimming", secondary: "edging" } : { primary: string; secondary: string; } +>primary : string +>"trimming" : string +>secondary : string +>"edging" : string + +function getRobots() { +>getRobots : () => Robot[] + + return robots; +>robots : Robot[] +} + +function getMultiRobots() { +>getMultiRobots : () => MultiRobot[] + + return multiRobots; +>multiRobots : MultiRobot[] +} + +let nameA: string, primaryA: string, secondaryA: string, i: number, skillA: string; +>nameA : string +>primaryA : string +>secondaryA : string +>i : number +>skillA : string + +let name: string, primary: string, secondary: string, skill: string; +>name : string +>primary : string +>secondary : string +>skill : string + +for ({name: nameA = "noName" } of robots) { +>{name: nameA = "noName" } : { name?: string; } +>name : Robot +>nameA = "noName" : string +>nameA : string +>"noName" : string +>robots : Robot[] + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for ({name: nameA = "noName" } of getRobots()) { +>{name: nameA = "noName" } : { name?: string; } +>name : Robot +>nameA = "noName" : string +>nameA : string +>"noName" : string +>getRobots() : Robot[] +>getRobots : () => Robot[] + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for ({name: nameA = "noName" } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { +>{name: nameA = "noName" } : { name?: string; } +>name : { name: string; skill: string; } +>nameA = "noName" : string +>nameA : string +>"noName" : string +>[{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }] : { name: string; skill: string; }[] +>{ name: "mower", skill: "mowing" } : { name: string; skill: string; } +>name : string +>"mower" : string +>skill : string +>"mowing" : string +>{ name: "trimmer", skill: "trimming" } : { name: string; skill: string; } +>name : string +>"trimmer" : string +>skill : string +>"trimming" : string + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for ({ skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = +>{ skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = { primary: "nosKill", secondary: "noSkill" } } : { skills?: { primary?: string; secondary?: string; }; } +>skills : MultiRobot +>{ primary: primaryA = "primary", secondary: secondaryA = "secondary" } = { primary: "nosKill", secondary: "noSkill" } : { primary?: string; secondary?: string; } +>{ primary: primaryA = "primary", secondary: secondaryA = "secondary" } : { primary?: string; secondary?: string; } +>primary : string +>primaryA = "primary" : string +>primaryA : string +>"primary" : string +>secondary : string +>secondaryA = "secondary" : string +>secondaryA : string +>"secondary" : string + + { primary: "nosKill", secondary: "noSkill" } } of multiRobots) { +>{ primary: "nosKill", secondary: "noSkill" } : { primary?: string; secondary?: string; } +>primary : string +>"nosKill" : string +>secondary : string +>"noSkill" : string +>multiRobots : MultiRobot[] + + console.log(primaryA); +>console.log(primaryA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primaryA : string +} +for ({ skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = +>{ skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = { primary: "nosKill", secondary: "noSkill" } } : { skills?: { primary?: string; secondary?: string; }; } +>skills : MultiRobot +>{ primary: primaryA = "primary", secondary: secondaryA = "secondary" } = { primary: "nosKill", secondary: "noSkill" } : { primary?: string; secondary?: string; } +>{ primary: primaryA = "primary", secondary: secondaryA = "secondary" } : { primary?: string; secondary?: string; } +>primary : string +>primaryA = "primary" : string +>primaryA : string +>"primary" : string +>secondary : string +>secondaryA = "secondary" : string +>secondaryA : string +>"secondary" : string + + { primary: "nosKill", secondary: "noSkill" } } of getMultiRobots()) { +>{ primary: "nosKill", secondary: "noSkill" } : { primary?: string; secondary?: string; } +>primary : string +>"nosKill" : string +>secondary : string +>"noSkill" : string +>getMultiRobots() : MultiRobot[] +>getMultiRobots : () => MultiRobot[] + + console.log(primaryA); +>console.log(primaryA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primaryA : string +} +for ({ skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = +>{ skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = { primary: "nosKill", secondary: "noSkill" } } : { skills?: { primary?: string; secondary?: string; }; } +>skills : MultiRobot +>{ primary: primaryA = "primary", secondary: secondaryA = "secondary" } = { primary: "nosKill", secondary: "noSkill" } : { primary?: string; secondary?: string; } +>{ primary: primaryA = "primary", secondary: secondaryA = "secondary" } : { primary?: string; secondary?: string; } +>primary : string +>primaryA = "primary" : string +>primaryA : string +>"primary" : string +>secondary : string +>secondaryA = "secondary" : string +>secondaryA : string +>"secondary" : string + + { primary: "nosKill", secondary: "noSkill" } } of +>{ primary: "nosKill", secondary: "noSkill" } : { primary?: string; secondary?: string; } +>primary : string +>"nosKill" : string +>secondary : string +>"noSkill" : string + + [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, +>[{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] : MultiRobot[] +>MultiRobot : MultiRobot +>[{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] : { name: string; skills: { primary: string; secondary: string; }; }[] +>{ name: "mower", skills: { primary: "mowing", secondary: "none" } } : { name: string; skills: { primary: string; secondary: string; }; } +>name : string +>"mower" : string +>skills : { primary: string; secondary: string; } +>{ primary: "mowing", secondary: "none" } : { primary: string; secondary: string; } +>primary : string +>"mowing" : string +>secondary : string +>"none" : string + + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { +>{ name: "trimmer", skills: { primary: "trimming", secondary: "edging" } } : { name: string; skills: { primary: string; secondary: string; }; } +>name : string +>"trimmer" : string +>skills : { primary: string; secondary: string; } +>{ primary: "trimming", secondary: "edging" } : { primary: string; secondary: string; } +>primary : string +>"trimming" : string +>secondary : string +>"edging" : string + + console.log(primaryA); +>console.log(primaryA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primaryA : string +} + +for ({ name = "noName" } of robots) { +>{ name = "noName" } : { name?: string; } +>name : Robot +>robots : Robot[] + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for ({ name = "noName" } of getRobots()) { +>{ name = "noName" } : { name?: string; } +>name : Robot +>getRobots() : Robot[] +>getRobots : () => Robot[] + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for ({ name = "noName" } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { +>{ name = "noName" } : { name?: string; } +>name : { name: string; skill: string; } +>[{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }] : { name: string; skill: string; }[] +>{ name: "mower", skill: "mowing" } : { name: string; skill: string; } +>name : string +>"mower" : string +>skill : string +>"mowing" : string +>{ name: "trimmer", skill: "trimming" } : { name: string; skill: string; } +>name : string +>"trimmer" : string +>skill : string +>"trimming" : string + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for ({ +>{ skills: { primary = "primary", secondary = "secondary" } = { primary: "noSkill", secondary: "noSkill" }} : { skills?: { primary?: string; secondary?: string; }; } + + skills: { +>skills : MultiRobot +>{ primary = "primary", secondary = "secondary" } = { primary: "noSkill", secondary: "noSkill" } : { primary?: string; secondary?: string; } +>{ primary = "primary", secondary = "secondary" } : { primary?: string; secondary?: string; } + + primary = "primary", +>primary : string + + secondary = "secondary" +>secondary : string + + } = { primary: "noSkill", secondary: "noSkill" } +>{ primary: "noSkill", secondary: "noSkill" } : { primary?: string; secondary?: string; } +>primary : string +>"noSkill" : string +>secondary : string +>"noSkill" : string + +} of multiRobots) { +>multiRobots : MultiRobot[] + + console.log(primaryA); +>console.log(primaryA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primaryA : string +} +for ({ +>{ skills: { primary = "primary", secondary = "secondary" } = { primary: "noSkill", secondary: "noSkill" }} : { skills?: { primary?: string; secondary?: string; }; } + + skills: { +>skills : MultiRobot +>{ primary = "primary", secondary = "secondary" } = { primary: "noSkill", secondary: "noSkill" } : { primary?: string; secondary?: string; } +>{ primary = "primary", secondary = "secondary" } : { primary?: string; secondary?: string; } + + primary = "primary", +>primary : string + + secondary = "secondary" +>secondary : string + + } = { primary: "noSkill", secondary: "noSkill" } +>{ primary: "noSkill", secondary: "noSkill" } : { primary?: string; secondary?: string; } +>primary : string +>"noSkill" : string +>secondary : string +>"noSkill" : string + +} of getMultiRobots()) { +>getMultiRobots() : MultiRobot[] +>getMultiRobots : () => MultiRobot[] + + console.log(primaryA); +>console.log(primaryA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primaryA : string +} +for ({ +>{ skills: { primary = "primary", secondary = "secondary" } = { primary: "noSkill", secondary: "noSkill" }} : { skills?: { primary?: string; secondary?: string; }; } + + skills: { +>skills : { name: string; skills: { primary: string; secondary: string; }; } +>{ primary = "primary", secondary = "secondary" } = { primary: "noSkill", secondary: "noSkill" } : { primary?: string; secondary?: string; } +>{ primary = "primary", secondary = "secondary" } : { primary?: string; secondary?: string; } + + primary = "primary", +>primary : string + + secondary = "secondary" +>secondary : string + + } = { primary: "noSkill", secondary: "noSkill" } +>{ primary: "noSkill", secondary: "noSkill" } : { primary?: string; secondary?: string; } +>primary : string +>"noSkill" : string +>secondary : string +>"noSkill" : string + +} of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, +>[{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] : { name: string; skills: { primary: string; secondary: string; }; }[] +>{ name: "mower", skills: { primary: "mowing", secondary: "none" } } : { name: string; skills: { primary: string; secondary: string; }; } +>name : string +>"mower" : string +>skills : { primary: string; secondary: string; } +>{ primary: "mowing", secondary: "none" } : { primary: string; secondary: string; } +>primary : string +>"mowing" : string +>secondary : string +>"none" : string + + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { +>{ name: "trimmer", skills: { primary: "trimming", secondary: "edging" } } : { name: string; skills: { primary: string; secondary: string; }; } +>name : string +>"trimmer" : string +>skills : { primary: string; secondary: string; } +>{ primary: "trimming", secondary: "edging" } : { primary: string; secondary: string; } +>primary : string +>"trimming" : string +>secondary : string +>"edging" : string + + console.log(primaryA); +>console.log(primaryA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>primaryA : string +} + + +for ({name: nameA = "noName", skill: skillA = "noSkill" } of robots) { +>{name: nameA = "noName", skill: skillA = "noSkill" } : { name?: string; skill?: string; } +>name : Robot +>nameA = "noName" : string +>nameA : string +>"noName" : string +>skill : Robot +>skillA = "noSkill" : string +>skillA : string +>"noSkill" : string +>robots : Robot[] + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for ({name: nameA = "noName", skill: skillA = "noSkill" } of getRobots()) { +>{name: nameA = "noName", skill: skillA = "noSkill" } : { name?: string; skill?: string; } +>name : Robot +>nameA = "noName" : string +>nameA : string +>"noName" : string +>skill : Robot +>skillA = "noSkill" : string +>skillA : string +>"noSkill" : string +>getRobots() : Robot[] +>getRobots : () => Robot[] + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for ({name: nameA = "noName", skill: skillA = "noSkill" } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { +>{name: nameA = "noName", skill: skillA = "noSkill" } : { name?: string; skill?: string; } +>name : { name: string; skill: string; } +>nameA = "noName" : string +>nameA : string +>"noName" : string +>skill : { name: string; skill: string; } +>skillA = "noSkill" : string +>skillA : string +>"noSkill" : string +>[{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }] : { name: string; skill: string; }[] +>{ name: "mower", skill: "mowing" } : { name: string; skill: string; } +>name : string +>"mower" : string +>skill : string +>"mowing" : string +>{ name: "trimmer", skill: "trimming" } : { name: string; skill: string; } +>name : string +>"trimmer" : string +>skill : string +>"trimming" : string + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for ({ +>{ name: nameA = "noName", skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = { primary: "noSkill", secondary: "noSkill" }} : { name?: string; skills?: { primary?: string; secondary?: string; }; } + + name: nameA = "noName", +>name : MultiRobot +>nameA = "noName" : string +>nameA : string +>"noName" : string + + skills: { +>skills : MultiRobot +>{ primary: primaryA = "primary", secondary: secondaryA = "secondary" } = { primary: "noSkill", secondary: "noSkill" } : { primary?: string; secondary?: string; } +>{ primary: primaryA = "primary", secondary: secondaryA = "secondary" } : { primary?: string; secondary?: string; } + + primary: primaryA = "primary", +>primary : string +>primaryA = "primary" : string +>primaryA : string +>"primary" : string + + secondary: secondaryA = "secondary" +>secondary : string +>secondaryA = "secondary" : string +>secondaryA : string +>"secondary" : string + + } = { primary: "noSkill", secondary: "noSkill" } +>{ primary: "noSkill", secondary: "noSkill" } : { primary?: string; secondary?: string; } +>primary : string +>"noSkill" : string +>secondary : string +>"noSkill" : string + +} of multiRobots) { +>multiRobots : MultiRobot[] + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for ({ +>{ name: nameA = "noName", skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = { primary: "noSkill", secondary: "noSkill" }} : { name?: string; skills?: { primary?: string; secondary?: string; }; } + + name: nameA = "noName", +>name : MultiRobot +>nameA = "noName" : string +>nameA : string +>"noName" : string + + skills: { +>skills : MultiRobot +>{ primary: primaryA = "primary", secondary: secondaryA = "secondary" } = { primary: "noSkill", secondary: "noSkill" } : { primary?: string; secondary?: string; } +>{ primary: primaryA = "primary", secondary: secondaryA = "secondary" } : { primary?: string; secondary?: string; } + + primary: primaryA = "primary", +>primary : string +>primaryA = "primary" : string +>primaryA : string +>"primary" : string + + secondary: secondaryA = "secondary" +>secondary : string +>secondaryA = "secondary" : string +>secondaryA : string +>"secondary" : string + + } = { primary: "noSkill", secondary: "noSkill" } +>{ primary: "noSkill", secondary: "noSkill" } : { primary?: string; secondary?: string; } +>primary : string +>"noSkill" : string +>secondary : string +>"noSkill" : string + +} of getMultiRobots()) { +>getMultiRobots() : MultiRobot[] +>getMultiRobots : () => MultiRobot[] + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for ({ +>{ name: nameA = "noName", skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = { primary: "noSkill", secondary: "noSkill" }} : { name?: string; skills?: { primary?: string; secondary?: string; }; } + + name: nameA = "noName", +>name : MultiRobot +>nameA = "noName" : string +>nameA : string +>"noName" : string + + skills: { +>skills : MultiRobot +>{ primary: primaryA = "primary", secondary: secondaryA = "secondary" } = { primary: "noSkill", secondary: "noSkill" } : { primary?: string; secondary?: string; } +>{ primary: primaryA = "primary", secondary: secondaryA = "secondary" } : { primary?: string; secondary?: string; } + + primary: primaryA = "primary", +>primary : string +>primaryA = "primary" : string +>primaryA : string +>"primary" : string + + secondary: secondaryA = "secondary" +>secondary : string +>secondaryA = "secondary" : string +>secondaryA : string +>"secondary" : string + + } = { primary: "noSkill", secondary: "noSkill" } +>{ primary: "noSkill", secondary: "noSkill" } : { primary?: string; secondary?: string; } +>primary : string +>"noSkill" : string +>secondary : string +>"noSkill" : string + +} of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, +>[{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] : MultiRobot[] +>MultiRobot : MultiRobot +>[{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] : { name: string; skills: { primary: string; secondary: string; }; }[] +>{ name: "mower", skills: { primary: "mowing", secondary: "none" } } : { name: string; skills: { primary: string; secondary: string; }; } +>name : string +>"mower" : string +>skills : { primary: string; secondary: string; } +>{ primary: "mowing", secondary: "none" } : { primary: string; secondary: string; } +>primary : string +>"mowing" : string +>secondary : string +>"none" : string + + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { +>{ name: "trimmer", skills: { primary: "trimming", secondary: "edging" } } : { name: string; skills: { primary: string; secondary: string; }; } +>name : string +>"trimmer" : string +>skills : { primary: string; secondary: string; } +>{ primary: "trimming", secondary: "edging" } : { primary: string; secondary: string; } +>primary : string +>"trimming" : string +>secondary : string +>"edging" : string + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} + +for ({ name = "noName", skill = "noSkill" } of robots) { +>{ name = "noName", skill = "noSkill" } : { name?: string; skill?: string; } +>name : Robot +>skill : Robot +>robots : Robot[] + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for ({ name = "noName", skill = "noSkill" } of getRobots()) { +>{ name = "noName", skill = "noSkill" } : { name?: string; skill?: string; } +>name : Robot +>skill : Robot +>getRobots() : Robot[] +>getRobots : () => Robot[] + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for ({ name = "noName", skill = "noSkill" } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { +>{ name = "noName", skill = "noSkill" } : { name?: string; skill?: string; } +>name : { name: string; skill: string; } +>skill : { name: string; skill: string; } +>[{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }] : { name: string; skill: string; }[] +>{ name: "mower", skill: "mowing" } : { name: string; skill: string; } +>name : string +>"mower" : string +>skill : string +>"mowing" : string +>{ name: "trimmer", skill: "trimming" } : { name: string; skill: string; } +>name : string +>"trimmer" : string +>skill : string +>"trimming" : string + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for ({ +>{ name = "noName", skills: { primary = "primary", secondary = "secondary" } = { primary: "noSkill", secondary: "noSkill" }} : { name?: string; skills?: { primary?: string; secondary?: string; }; } + + name = "noName", +>name : MultiRobot + + skills: { +>skills : MultiRobot +>{ primary = "primary", secondary = "secondary" } = { primary: "noSkill", secondary: "noSkill" } : { primary?: string; secondary?: string; } +>{ primary = "primary", secondary = "secondary" } : { primary?: string; secondary?: string; } + + primary = "primary", +>primary : string + + secondary = "secondary" +>secondary : string + + } = { primary: "noSkill", secondary: "noSkill" } +>{ primary: "noSkill", secondary: "noSkill" } : { primary?: string; secondary?: string; } +>primary : string +>"noSkill" : string +>secondary : string +>"noSkill" : string + +} of multiRobots) { +>multiRobots : MultiRobot[] + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for ({ +>{ name = "noName", skills: { primary = "primary", secondary = "secondary" } = { primary: "noSkill", secondary: "noSkill" }} : { name?: string; skills?: { primary?: string; secondary?: string; }; } + + name = "noName", +>name : MultiRobot + + skills: { +>skills : MultiRobot +>{ primary = "primary", secondary = "secondary" } = { primary: "noSkill", secondary: "noSkill" } : { primary?: string; secondary?: string; } +>{ primary = "primary", secondary = "secondary" } : { primary?: string; secondary?: string; } + + primary = "primary", +>primary : string + + secondary = "secondary" +>secondary : string + + } = { primary: "noSkill", secondary: "noSkill" } +>{ primary: "noSkill", secondary: "noSkill" } : { primary?: string; secondary?: string; } +>primary : string +>"noSkill" : string +>secondary : string +>"noSkill" : string + +} of getMultiRobots()) { +>getMultiRobots() : MultiRobot[] +>getMultiRobots : () => MultiRobot[] + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} +for ({ +>{ name = "noName", skills: { primary = "primary", secondary = "secondary" } = { primary: "noSkill", secondary: "noSkill" }} : { name?: string; skills?: { primary?: string; secondary?: string; }; } + + name = "noName", +>name : { name: string; skills: { primary: string; secondary: string; }; } + + skills: { +>skills : { name: string; skills: { primary: string; secondary: string; }; } +>{ primary = "primary", secondary = "secondary" } = { primary: "noSkill", secondary: "noSkill" } : { primary?: string; secondary?: string; } +>{ primary = "primary", secondary = "secondary" } : { primary?: string; secondary?: string; } + + primary = "primary", +>primary : string + + secondary = "secondary" +>secondary : string + + } = { primary: "noSkill", secondary: "noSkill" } +>{ primary: "noSkill", secondary: "noSkill" } : { primary?: string; secondary?: string; } +>primary : string +>"noSkill" : string +>secondary : string +>"noSkill" : string + +} of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, +>[{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] : { name: string; skills: { primary: string; secondary: string; }; }[] +>{ name: "mower", skills: { primary: "mowing", secondary: "none" } } : { name: string; skills: { primary: string; secondary: string; }; } +>name : string +>"mower" : string +>skills : { primary: string; secondary: string; } +>{ primary: "mowing", secondary: "none" } : { primary: string; secondary: string; } +>primary : string +>"mowing" : string +>secondary : string +>"none" : string + + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { +>{ name: "trimmer", skills: { primary: "trimming", secondary: "edging" } } : { name: string; skills: { primary: string; secondary: string; }; } +>name : string +>"trimmer" : string +>skills : { primary: string; secondary: string; } +>{ primary: "trimming", secondary: "edging" } : { primary: string; secondary: string; } +>primary : string +>"trimming" : string +>secondary : string +>"edging" : string + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} diff --git a/tests/baselines/reference/sourceMapValidationDestructuringParameterNestedObjectBindingPattern.js b/tests/baselines/reference/sourceMapValidationDestructuringParameterNestedObjectBindingPattern.js new file mode 100644 index 00000000000..4c7c0d6307b --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringParameterNestedObjectBindingPattern.js @@ -0,0 +1,54 @@ +//// [sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts] +declare var console: { + log(msg: string): void; +} +interface Robot { + name: string; + skills: { + primary: string; + secondary: string; + }; +} +var robotA: Robot = { name: "mower", skills: { primary: "mowing", secondary: "none" } }; + +function foo1({ skills: { primary: primaryA, secondary: secondaryA } }: Robot) { + console.log(primaryA); +} +function foo2({ name: nameC, skills: { primary: primaryB, secondary: secondaryB } }: Robot) { + console.log(secondaryB); +} +function foo3({ skills }: Robot) { + console.log(skills.primary); +} + +foo1(robotA); +foo1({ name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }); + +foo2(robotA); +foo2({ name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }); + +foo3(robotA); +foo3({ name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }); + + +//// [sourceMapValidationDestructuringParameterNestedObjectBindingPattern.js] +var robotA = { name: "mower", skills: { primary: "mowing", secondary: "none" } }; +function foo1(_a) { + var _b = _a.skills, primaryA = _b.primary, secondaryA = _b.secondary; + console.log(primaryA); +} +function foo2(_a) { + var nameC = _a.name, _b = _a.skills, primaryB = _b.primary, secondaryB = _b.secondary; + console.log(secondaryB); +} +function foo3(_a) { + var skills = _a.skills; + console.log(skills.primary); +} +foo1(robotA); +foo1({ name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }); +foo2(robotA); +foo2({ name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }); +foo3(robotA); +foo3({ name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }); +//# sourceMappingURL=sourceMapValidationDestructuringParameterNestedObjectBindingPattern.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringParameterNestedObjectBindingPattern.js.map b/tests/baselines/reference/sourceMapValidationDestructuringParameterNestedObjectBindingPattern.js.map new file mode 100644 index 00000000000..b05ceecbc4a --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringParameterNestedObjectBindingPattern.js.map @@ -0,0 +1,2 @@ +//// [sourceMapValidationDestructuringParameterNestedObjectBindingPattern.js.map] +{"version":3,"file":"sourceMapValidationDestructuringParameterNestedObjectBindingPattern.js","sourceRoot":"","sources":["sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts"],"names":[],"mappings":"AAUA,IAAI,MAAM,GAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,CAAC;AAExF,cAAc,EAA+D;QAA7D,cAAoD,EAA1C,qBAAiB,EAAE,yBAAqB;IAC9D,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAC1B,CAAC;AACD,cAAc,EAA4E;QAA1E,eAAW,EAAE,cAAoD,EAA1C,qBAAiB,EAAE,yBAAqB;IAC3E,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;AAC5B,CAAC;AACD,cAAc,EAAiB;QAAf,kBAAM;IAClB,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AAChC,CAAC;AAED,IAAI,CAAC,MAAM,CAAC,CAAC;AACb,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,iBAAiB,EAAE,EAAE,CAAC,CAAC;AAErF,IAAI,CAAC,MAAM,CAAC,CAAC;AACb,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,iBAAiB,EAAE,EAAE,CAAC,CAAC;AAErF,IAAI,CAAC,MAAM,CAAC,CAAC;AACb,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,iBAAiB,EAAE,EAAE,CAAC,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringParameterNestedObjectBindingPattern.sourcemap.txt b/tests/baselines/reference/sourceMapValidationDestructuringParameterNestedObjectBindingPattern.sourcemap.txt new file mode 100644 index 00000000000..8e39fd676d0 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringParameterNestedObjectBindingPattern.sourcemap.txt @@ -0,0 +1,578 @@ +=================================================================== +JsFile: sourceMapValidationDestructuringParameterNestedObjectBindingPattern.js +mapUrl: sourceMapValidationDestructuringParameterNestedObjectBindingPattern.js.map +sourceRoot: +sources: sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/sourceMapValidationDestructuringParameterNestedObjectBindingPattern.js +sourceFile:sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts +------------------------------------------------------------------- +>>>var robotA = { name: "mower", skills: { primary: "mowing", secondary: "none" } }; +1 > +2 >^^^^ +3 > ^^^^^^ +4 > ^^^ +5 > ^^ +6 > ^^^^ +7 > ^^ +8 > ^^^^^^^ +9 > ^^ +10> ^^^^^^ +11> ^^ +12> ^^ +13> ^^^^^^^ +14> ^^ +15> ^^^^^^^^ +16> ^^ +17> ^^^^^^^^^ +18> ^^ +19> ^^^^^^ +20> ^^ +21> ^^ +22> ^ +1 >declare var console: { + > log(msg: string): void; + >} + >interface Robot { + > name: string; + > skills: { + > primary: string; + > secondary: string; + > }; + >} + > +2 >var +3 > robotA +4 > : Robot = +5 > { +6 > name +7 > : +8 > "mower" +9 > , +10> skills +11> : +12> { +13> primary +14> : +15> "mowing" +16> , +17> secondary +18> : +19> "none" +20> } +21> } +22> ; +1 >Emitted(1, 1) Source(11, 1) + SourceIndex(0) +2 >Emitted(1, 5) Source(11, 5) + SourceIndex(0) +3 >Emitted(1, 11) Source(11, 11) + SourceIndex(0) +4 >Emitted(1, 14) Source(11, 21) + SourceIndex(0) +5 >Emitted(1, 16) Source(11, 23) + SourceIndex(0) +6 >Emitted(1, 20) Source(11, 27) + SourceIndex(0) +7 >Emitted(1, 22) Source(11, 29) + SourceIndex(0) +8 >Emitted(1, 29) Source(11, 36) + SourceIndex(0) +9 >Emitted(1, 31) Source(11, 38) + SourceIndex(0) +10>Emitted(1, 37) Source(11, 44) + SourceIndex(0) +11>Emitted(1, 39) Source(11, 46) + SourceIndex(0) +12>Emitted(1, 41) Source(11, 48) + SourceIndex(0) +13>Emitted(1, 48) Source(11, 55) + SourceIndex(0) +14>Emitted(1, 50) Source(11, 57) + SourceIndex(0) +15>Emitted(1, 58) Source(11, 65) + SourceIndex(0) +16>Emitted(1, 60) Source(11, 67) + SourceIndex(0) +17>Emitted(1, 69) Source(11, 76) + SourceIndex(0) +18>Emitted(1, 71) Source(11, 78) + SourceIndex(0) +19>Emitted(1, 77) Source(11, 84) + SourceIndex(0) +20>Emitted(1, 79) Source(11, 86) + SourceIndex(0) +21>Emitted(1, 81) Source(11, 88) + SourceIndex(0) +22>Emitted(1, 82) Source(11, 89) + SourceIndex(0) +--- +>>>function foo1(_a) { +1 > +2 >^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > + > +2 >function foo1( +3 > { skills: { primary: primaryA, secondary: secondaryA } }: Robot +1 >Emitted(2, 1) Source(13, 1) + SourceIndex(0) +2 >Emitted(2, 15) Source(13, 15) + SourceIndex(0) +3 >Emitted(2, 17) Source(13, 78) + SourceIndex(0) +--- +>>> var _b = _a.skills, primaryA = _b.primary, secondaryA = _b.secondary; +1->^^^^^^^^ +2 > ^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > skills: { primary: primaryA, secondary: secondaryA } +3 > +4 > primary: primaryA +5 > , +6 > secondary: secondaryA +1->Emitted(3, 9) Source(13, 17) + SourceIndex(0) +2 >Emitted(3, 23) Source(13, 69) + SourceIndex(0) +3 >Emitted(3, 25) Source(13, 27) + SourceIndex(0) +4 >Emitted(3, 46) Source(13, 44) + SourceIndex(0) +5 >Emitted(3, 48) Source(13, 46) + SourceIndex(0) +6 >Emitted(3, 73) Source(13, 67) + SourceIndex(0) +--- +>>> console.log(primaryA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1 > } }: Robot) { + > +2 > console +3 > . +4 > log +5 > ( +6 > primaryA +7 > ) +8 > ; +1 >Emitted(4, 5) Source(14, 5) + SourceIndex(0) +2 >Emitted(4, 12) Source(14, 12) + SourceIndex(0) +3 >Emitted(4, 13) Source(14, 13) + SourceIndex(0) +4 >Emitted(4, 16) Source(14, 16) + SourceIndex(0) +5 >Emitted(4, 17) Source(14, 17) + SourceIndex(0) +6 >Emitted(4, 25) Source(14, 25) + SourceIndex(0) +7 >Emitted(4, 26) Source(14, 26) + SourceIndex(0) +8 >Emitted(4, 27) Source(14, 27) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(5, 1) Source(15, 1) + SourceIndex(0) +2 >Emitted(5, 2) Source(15, 2) + SourceIndex(0) +--- +>>>function foo2(_a) { +1-> +2 >^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >function foo2( +3 > { name: nameC, skills: { primary: primaryB, secondary: secondaryB } }: Robot +1->Emitted(6, 1) Source(16, 1) + SourceIndex(0) +2 >Emitted(6, 15) Source(16, 15) + SourceIndex(0) +3 >Emitted(6, 17) Source(16, 91) + SourceIndex(0) +--- +>>> var nameC = _a.name, _b = _a.skills, primaryB = _b.primary, secondaryB = _b.secondary; +1->^^^^^^^^ +2 > ^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > name: nameC +3 > , +4 > skills: { primary: primaryB, secondary: secondaryB } +5 > +6 > primary: primaryB +7 > , +8 > secondary: secondaryB +1->Emitted(7, 9) Source(16, 17) + SourceIndex(0) +2 >Emitted(7, 24) Source(16, 28) + SourceIndex(0) +3 >Emitted(7, 26) Source(16, 30) + SourceIndex(0) +4 >Emitted(7, 40) Source(16, 82) + SourceIndex(0) +5 >Emitted(7, 42) Source(16, 40) + SourceIndex(0) +6 >Emitted(7, 63) Source(16, 57) + SourceIndex(0) +7 >Emitted(7, 65) Source(16, 59) + SourceIndex(0) +8 >Emitted(7, 90) Source(16, 80) + SourceIndex(0) +--- +>>> console.log(secondaryB); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^^^ +7 > ^ +8 > ^ +1 > } }: Robot) { + > +2 > console +3 > . +4 > log +5 > ( +6 > secondaryB +7 > ) +8 > ; +1 >Emitted(8, 5) Source(17, 5) + SourceIndex(0) +2 >Emitted(8, 12) Source(17, 12) + SourceIndex(0) +3 >Emitted(8, 13) Source(17, 13) + SourceIndex(0) +4 >Emitted(8, 16) Source(17, 16) + SourceIndex(0) +5 >Emitted(8, 17) Source(17, 17) + SourceIndex(0) +6 >Emitted(8, 27) Source(17, 27) + SourceIndex(0) +7 >Emitted(8, 28) Source(17, 28) + SourceIndex(0) +8 >Emitted(8, 29) Source(17, 29) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(9, 1) Source(18, 1) + SourceIndex(0) +2 >Emitted(9, 2) Source(18, 2) + SourceIndex(0) +--- +>>>function foo3(_a) { +1-> +2 >^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^-> +1-> + > +2 >function foo3( +3 > { skills }: Robot +1->Emitted(10, 1) Source(19, 1) + SourceIndex(0) +2 >Emitted(10, 15) Source(19, 15) + SourceIndex(0) +3 >Emitted(10, 17) Source(19, 32) + SourceIndex(0) +--- +>>> var skills = _a.skills; +1->^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^-> +1-> +2 > skills +1->Emitted(11, 9) Source(19, 17) + SourceIndex(0) +2 >Emitted(11, 27) Source(19, 23) + SourceIndex(0) +--- +>>> console.log(skills.primary); +1->^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^ +7 > ^ +8 > ^^^^^^^ +9 > ^ +10> ^ +1-> }: Robot) { + > +2 > console +3 > . +4 > log +5 > ( +6 > skills +7 > . +8 > primary +9 > ) +10> ; +1->Emitted(12, 5) Source(20, 5) + SourceIndex(0) +2 >Emitted(12, 12) Source(20, 12) + SourceIndex(0) +3 >Emitted(12, 13) Source(20, 13) + SourceIndex(0) +4 >Emitted(12, 16) Source(20, 16) + SourceIndex(0) +5 >Emitted(12, 17) Source(20, 17) + SourceIndex(0) +6 >Emitted(12, 23) Source(20, 23) + SourceIndex(0) +7 >Emitted(12, 24) Source(20, 24) + SourceIndex(0) +8 >Emitted(12, 31) Source(20, 31) + SourceIndex(0) +9 >Emitted(12, 32) Source(20, 32) + SourceIndex(0) +10>Emitted(12, 33) Source(20, 33) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(13, 1) Source(21, 1) + SourceIndex(0) +2 >Emitted(13, 2) Source(21, 2) + SourceIndex(0) +--- +>>>foo1(robotA); +1-> +2 >^^^^ +3 > ^ +4 > ^^^^^^ +5 > ^ +6 > ^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > + > +2 >foo1 +3 > ( +4 > robotA +5 > ) +6 > ; +1->Emitted(14, 1) Source(23, 1) + SourceIndex(0) +2 >Emitted(14, 5) Source(23, 5) + SourceIndex(0) +3 >Emitted(14, 6) Source(23, 6) + SourceIndex(0) +4 >Emitted(14, 12) Source(23, 12) + SourceIndex(0) +5 >Emitted(14, 13) Source(23, 13) + SourceIndex(0) +6 >Emitted(14, 14) Source(23, 14) + SourceIndex(0) +--- +>>>foo1({ name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }); +1-> +2 >^^^^ +3 > ^ +4 > ^^ +5 > ^^^^ +6 > ^^ +7 > ^^^^^^^ +8 > ^^ +9 > ^^^^^^ +10> ^^ +11> ^^ +12> ^^^^^^^ +13> ^^ +14> ^^^^^^^^ +15> ^^ +16> ^^^^^^^^^ +17> ^^ +18> ^^^^^^^^^^^^^^^^^ +19> ^^ +20> ^^ +21> ^ +22> ^ +1-> + > +2 >foo1 +3 > ( +4 > { +5 > name +6 > : +7 > "Edger" +8 > , +9 > skills +10> : +11> { +12> primary +13> : +14> "edging" +15> , +16> secondary +17> : +18> "branch trimming" +19> } +20> } +21> ) +22> ; +1->Emitted(15, 1) Source(24, 1) + SourceIndex(0) +2 >Emitted(15, 5) Source(24, 5) + SourceIndex(0) +3 >Emitted(15, 6) Source(24, 6) + SourceIndex(0) +4 >Emitted(15, 8) Source(24, 8) + SourceIndex(0) +5 >Emitted(15, 12) Source(24, 12) + SourceIndex(0) +6 >Emitted(15, 14) Source(24, 14) + SourceIndex(0) +7 >Emitted(15, 21) Source(24, 21) + SourceIndex(0) +8 >Emitted(15, 23) Source(24, 23) + SourceIndex(0) +9 >Emitted(15, 29) Source(24, 29) + SourceIndex(0) +10>Emitted(15, 31) Source(24, 31) + SourceIndex(0) +11>Emitted(15, 33) Source(24, 33) + SourceIndex(0) +12>Emitted(15, 40) Source(24, 40) + SourceIndex(0) +13>Emitted(15, 42) Source(24, 42) + SourceIndex(0) +14>Emitted(15, 50) Source(24, 50) + SourceIndex(0) +15>Emitted(15, 52) Source(24, 52) + SourceIndex(0) +16>Emitted(15, 61) Source(24, 61) + SourceIndex(0) +17>Emitted(15, 63) Source(24, 63) + SourceIndex(0) +18>Emitted(15, 80) Source(24, 80) + SourceIndex(0) +19>Emitted(15, 82) Source(24, 82) + SourceIndex(0) +20>Emitted(15, 84) Source(24, 84) + SourceIndex(0) +21>Emitted(15, 85) Source(24, 85) + SourceIndex(0) +22>Emitted(15, 86) Source(24, 86) + SourceIndex(0) +--- +>>>foo2(robotA); +1 > +2 >^^^^ +3 > ^ +4 > ^^^^^^ +5 > ^ +6 > ^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > + > +2 >foo2 +3 > ( +4 > robotA +5 > ) +6 > ; +1 >Emitted(16, 1) Source(26, 1) + SourceIndex(0) +2 >Emitted(16, 5) Source(26, 5) + SourceIndex(0) +3 >Emitted(16, 6) Source(26, 6) + SourceIndex(0) +4 >Emitted(16, 12) Source(26, 12) + SourceIndex(0) +5 >Emitted(16, 13) Source(26, 13) + SourceIndex(0) +6 >Emitted(16, 14) Source(26, 14) + SourceIndex(0) +--- +>>>foo2({ name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }); +1-> +2 >^^^^ +3 > ^ +4 > ^^ +5 > ^^^^ +6 > ^^ +7 > ^^^^^^^ +8 > ^^ +9 > ^^^^^^ +10> ^^ +11> ^^ +12> ^^^^^^^ +13> ^^ +14> ^^^^^^^^ +15> ^^ +16> ^^^^^^^^^ +17> ^^ +18> ^^^^^^^^^^^^^^^^^ +19> ^^ +20> ^^ +21> ^ +22> ^ +1-> + > +2 >foo2 +3 > ( +4 > { +5 > name +6 > : +7 > "Edger" +8 > , +9 > skills +10> : +11> { +12> primary +13> : +14> "edging" +15> , +16> secondary +17> : +18> "branch trimming" +19> } +20> } +21> ) +22> ; +1->Emitted(17, 1) Source(27, 1) + SourceIndex(0) +2 >Emitted(17, 5) Source(27, 5) + SourceIndex(0) +3 >Emitted(17, 6) Source(27, 6) + SourceIndex(0) +4 >Emitted(17, 8) Source(27, 8) + SourceIndex(0) +5 >Emitted(17, 12) Source(27, 12) + SourceIndex(0) +6 >Emitted(17, 14) Source(27, 14) + SourceIndex(0) +7 >Emitted(17, 21) Source(27, 21) + SourceIndex(0) +8 >Emitted(17, 23) Source(27, 23) + SourceIndex(0) +9 >Emitted(17, 29) Source(27, 29) + SourceIndex(0) +10>Emitted(17, 31) Source(27, 31) + SourceIndex(0) +11>Emitted(17, 33) Source(27, 33) + SourceIndex(0) +12>Emitted(17, 40) Source(27, 40) + SourceIndex(0) +13>Emitted(17, 42) Source(27, 42) + SourceIndex(0) +14>Emitted(17, 50) Source(27, 50) + SourceIndex(0) +15>Emitted(17, 52) Source(27, 52) + SourceIndex(0) +16>Emitted(17, 61) Source(27, 61) + SourceIndex(0) +17>Emitted(17, 63) Source(27, 63) + SourceIndex(0) +18>Emitted(17, 80) Source(27, 80) + SourceIndex(0) +19>Emitted(17, 82) Source(27, 82) + SourceIndex(0) +20>Emitted(17, 84) Source(27, 84) + SourceIndex(0) +21>Emitted(17, 85) Source(27, 85) + SourceIndex(0) +22>Emitted(17, 86) Source(27, 86) + SourceIndex(0) +--- +>>>foo3(robotA); +1 > +2 >^^^^ +3 > ^ +4 > ^^^^^^ +5 > ^ +6 > ^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > + > +2 >foo3 +3 > ( +4 > robotA +5 > ) +6 > ; +1 >Emitted(18, 1) Source(29, 1) + SourceIndex(0) +2 >Emitted(18, 5) Source(29, 5) + SourceIndex(0) +3 >Emitted(18, 6) Source(29, 6) + SourceIndex(0) +4 >Emitted(18, 12) Source(29, 12) + SourceIndex(0) +5 >Emitted(18, 13) Source(29, 13) + SourceIndex(0) +6 >Emitted(18, 14) Source(29, 14) + SourceIndex(0) +--- +>>>foo3({ name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }); +1-> +2 >^^^^ +3 > ^ +4 > ^^ +5 > ^^^^ +6 > ^^ +7 > ^^^^^^^ +8 > ^^ +9 > ^^^^^^ +10> ^^ +11> ^^ +12> ^^^^^^^ +13> ^^ +14> ^^^^^^^^ +15> ^^ +16> ^^^^^^^^^ +17> ^^ +18> ^^^^^^^^^^^^^^^^^ +19> ^^ +20> ^^ +21> ^ +22> ^ +23> ^^^^^^^^^-> +1-> + > +2 >foo3 +3 > ( +4 > { +5 > name +6 > : +7 > "Edger" +8 > , +9 > skills +10> : +11> { +12> primary +13> : +14> "edging" +15> , +16> secondary +17> : +18> "branch trimming" +19> } +20> } +21> ) +22> ; +1->Emitted(19, 1) Source(30, 1) + SourceIndex(0) +2 >Emitted(19, 5) Source(30, 5) + SourceIndex(0) +3 >Emitted(19, 6) Source(30, 6) + SourceIndex(0) +4 >Emitted(19, 8) Source(30, 8) + SourceIndex(0) +5 >Emitted(19, 12) Source(30, 12) + SourceIndex(0) +6 >Emitted(19, 14) Source(30, 14) + SourceIndex(0) +7 >Emitted(19, 21) Source(30, 21) + SourceIndex(0) +8 >Emitted(19, 23) Source(30, 23) + SourceIndex(0) +9 >Emitted(19, 29) Source(30, 29) + SourceIndex(0) +10>Emitted(19, 31) Source(30, 31) + SourceIndex(0) +11>Emitted(19, 33) Source(30, 33) + SourceIndex(0) +12>Emitted(19, 40) Source(30, 40) + SourceIndex(0) +13>Emitted(19, 42) Source(30, 42) + SourceIndex(0) +14>Emitted(19, 50) Source(30, 50) + SourceIndex(0) +15>Emitted(19, 52) Source(30, 52) + SourceIndex(0) +16>Emitted(19, 61) Source(30, 61) + SourceIndex(0) +17>Emitted(19, 63) Source(30, 63) + SourceIndex(0) +18>Emitted(19, 80) Source(30, 80) + SourceIndex(0) +19>Emitted(19, 82) Source(30, 82) + SourceIndex(0) +20>Emitted(19, 84) Source(30, 84) + SourceIndex(0) +21>Emitted(19, 85) Source(30, 85) + SourceIndex(0) +22>Emitted(19, 86) Source(30, 86) + SourceIndex(0) +--- +>>>//# sourceMappingURL=sourceMapValidationDestructuringParameterNestedObjectBindingPattern.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringParameterNestedObjectBindingPattern.symbols b/tests/baselines/reference/sourceMapValidationDestructuringParameterNestedObjectBindingPattern.symbols new file mode 100644 index 00000000000..7c6e8135e26 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringParameterNestedObjectBindingPattern.symbols @@ -0,0 +1,112 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts === +declare var console: { +>console : Symbol(console, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts, 0, 11)) + + log(msg: string): void; +>log : Symbol(log, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts, 0, 22)) +>msg : Symbol(msg, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts, 1, 8)) +} +interface Robot { +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts, 2, 1)) + + name: string; +>name : Symbol(Robot.name, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts, 3, 17)) + + skills: { +>skills : Symbol(Robot.skills, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts, 4, 17)) + + primary: string; +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts, 5, 13)) + + secondary: string; +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts, 6, 24)) + + }; +} +var robotA: Robot = { name: "mower", skills: { primary: "mowing", secondary: "none" } }; +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts, 10, 3)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts, 2, 1)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts, 10, 21)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts, 10, 36)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts, 10, 46)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts, 10, 65)) + +function foo1({ skills: { primary: primaryA, secondary: secondaryA } }: Robot) { +>foo1 : Symbol(foo1, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts, 10, 88)) +>skills : Symbol(Robot.skills, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts, 4, 17)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts, 5, 13)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts, 12, 25)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts, 6, 24)) +>secondaryA : Symbol(secondaryA, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts, 12, 44)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts, 2, 1)) + + console.log(primaryA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts, 0, 22)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts, 12, 25)) +} +function foo2({ name: nameC, skills: { primary: primaryB, secondary: secondaryB } }: Robot) { +>foo2 : Symbol(foo2, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts, 14, 1)) +>name : Symbol(Robot.name, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts, 3, 17)) +>nameC : Symbol(nameC, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts, 15, 15)) +>skills : Symbol(Robot.skills, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts, 4, 17)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts, 5, 13)) +>primaryB : Symbol(primaryB, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts, 15, 38)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts, 6, 24)) +>secondaryB : Symbol(secondaryB, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts, 15, 57)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts, 2, 1)) + + console.log(secondaryB); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts, 0, 22)) +>secondaryB : Symbol(secondaryB, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts, 15, 57)) +} +function foo3({ skills }: Robot) { +>foo3 : Symbol(foo3, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts, 17, 1)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts, 18, 15)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts, 2, 1)) + + console.log(skills.primary); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts, 0, 22)) +>skills.primary : Symbol(primary, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts, 5, 13)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts, 18, 15)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts, 5, 13)) +} + +foo1(robotA); +>foo1 : Symbol(foo1, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts, 10, 88)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts, 10, 3)) + +foo1({ name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }); +>foo1 : Symbol(foo1, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts, 10, 88)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts, 23, 6)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts, 23, 21)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts, 23, 31)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts, 23, 50)) + +foo2(robotA); +>foo2 : Symbol(foo2, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts, 14, 1)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts, 10, 3)) + +foo2({ name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }); +>foo2 : Symbol(foo2, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts, 14, 1)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts, 26, 6)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts, 26, 21)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts, 26, 31)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts, 26, 50)) + +foo3(robotA); +>foo3 : Symbol(foo3, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts, 17, 1)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts, 10, 3)) + +foo3({ name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }); +>foo3 : Symbol(foo3, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts, 17, 1)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts, 29, 6)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts, 29, 21)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts, 29, 31)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts, 29, 50)) + diff --git a/tests/baselines/reference/sourceMapValidationDestructuringParameterNestedObjectBindingPattern.types b/tests/baselines/reference/sourceMapValidationDestructuringParameterNestedObjectBindingPattern.types new file mode 100644 index 00000000000..af27c32d15b --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringParameterNestedObjectBindingPattern.types @@ -0,0 +1,141 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts === +declare var console: { +>console : { log(msg: string): void; } + + log(msg: string): void; +>log : (msg: string) => void +>msg : string +} +interface Robot { +>Robot : Robot + + name: string; +>name : string + + skills: { +>skills : { primary: string; secondary: string; } + + primary: string; +>primary : string + + secondary: string; +>secondary : string + + }; +} +var robotA: Robot = { name: "mower", skills: { primary: "mowing", secondary: "none" } }; +>robotA : Robot +>Robot : Robot +>{ name: "mower", skills: { primary: "mowing", secondary: "none" } } : { name: string; skills: { primary: string; secondary: string; }; } +>name : string +>"mower" : string +>skills : { primary: string; secondary: string; } +>{ primary: "mowing", secondary: "none" } : { primary: string; secondary: string; } +>primary : string +>"mowing" : string +>secondary : string +>"none" : string + +function foo1({ skills: { primary: primaryA, secondary: secondaryA } }: Robot) { +>foo1 : ({skills: {primary: primaryA, secondary: secondaryA}}: Robot) => void +>skills : any +>primary : any +>primaryA : string +>secondary : any +>secondaryA : string +>Robot : Robot + + console.log(primaryA); +>console.log(primaryA) : void +>console.log : (msg: string) => void +>console : { log(msg: string): void; } +>log : (msg: string) => void +>primaryA : string +} +function foo2({ name: nameC, skills: { primary: primaryB, secondary: secondaryB } }: Robot) { +>foo2 : ({name: nameC, skills: {primary: primaryB, secondary: secondaryB}}: Robot) => void +>name : any +>nameC : string +>skills : any +>primary : any +>primaryB : string +>secondary : any +>secondaryB : string +>Robot : Robot + + console.log(secondaryB); +>console.log(secondaryB) : void +>console.log : (msg: string) => void +>console : { log(msg: string): void; } +>log : (msg: string) => void +>secondaryB : string +} +function foo3({ skills }: Robot) { +>foo3 : ({skills}: Robot) => void +>skills : { primary: string; secondary: string; } +>Robot : Robot + + console.log(skills.primary); +>console.log(skills.primary) : void +>console.log : (msg: string) => void +>console : { log(msg: string): void; } +>log : (msg: string) => void +>skills.primary : string +>skills : { primary: string; secondary: string; } +>primary : string +} + +foo1(robotA); +>foo1(robotA) : void +>foo1 : ({skills: {primary: primaryA, secondary: secondaryA}}: Robot) => void +>robotA : Robot + +foo1({ name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }); +>foo1({ name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }) : void +>foo1 : ({skills: {primary: primaryA, secondary: secondaryA}}: Robot) => void +>{ name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } } : { name: string; skills: { primary: string; secondary: string; }; } +>name : string +>"Edger" : string +>skills : { primary: string; secondary: string; } +>{ primary: "edging", secondary: "branch trimming" } : { primary: string; secondary: string; } +>primary : string +>"edging" : string +>secondary : string +>"branch trimming" : string + +foo2(robotA); +>foo2(robotA) : void +>foo2 : ({name: nameC, skills: {primary: primaryB, secondary: secondaryB}}: Robot) => void +>robotA : Robot + +foo2({ name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }); +>foo2({ name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }) : void +>foo2 : ({name: nameC, skills: {primary: primaryB, secondary: secondaryB}}: Robot) => void +>{ name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } } : { name: string; skills: { primary: string; secondary: string; }; } +>name : string +>"Edger" : string +>skills : { primary: string; secondary: string; } +>{ primary: "edging", secondary: "branch trimming" } : { primary: string; secondary: string; } +>primary : string +>"edging" : string +>secondary : string +>"branch trimming" : string + +foo3(robotA); +>foo3(robotA) : void +>foo3 : ({skills}: Robot) => void +>robotA : Robot + +foo3({ name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }); +>foo3({ name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }) : void +>foo3 : ({skills}: Robot) => void +>{ name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } } : { name: string; skills: { primary: string; secondary: string; }; } +>name : string +>"Edger" : string +>skills : { primary: string; secondary: string; } +>{ primary: "edging", secondary: "branch trimming" } : { primary: string; secondary: string; } +>primary : string +>"edging" : string +>secondary : string +>"branch trimming" : string + diff --git a/tests/baselines/reference/sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.js b/tests/baselines/reference/sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.js new file mode 100644 index 00000000000..b67f5047965 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.js @@ -0,0 +1,67 @@ +//// [sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts] +declare var console: { + log(msg: string): void; +} +interface Robot { + name: string; + skills: { + primary?: string; + secondary?: string; + }; +} +var robotA: Robot = { name: "mower", skills: { primary: "mowing", secondary: "none" } }; + +function foo1( + { + skills: { + primary: primaryA = "primary", + secondary: secondaryA = "secondary" + } = { primary: "SomeSkill", secondary: "someSkill" } + }: Robot = robotA) { + console.log(primaryA); +} +function foo2( + { + name: nameC = "name", + skills: { + primary: primaryB = "primary", + secondary: secondaryB = "secondary" + } = { primary: "SomeSkill", secondary: "someSkill" } + }: Robot = robotA) { + console.log(secondaryB); +} +function foo3({ skills = { primary: "SomeSkill", secondary: "someSkill" } }: Robot = robotA) { + console.log(skills.primary); +} + +foo1(robotA); +foo1({ name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }); + +foo2(robotA); +foo2({ name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }); + +foo3(robotA); +foo3({ name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }); + + +//// [sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.js] +var robotA = { name: "mower", skills: { primary: "mowing", secondary: "none" } }; +function foo1(_a) { + var _b = (_a === void 0 ? robotA : _a).skills, _c = _b === void 0 ? { primary: "SomeSkill", secondary: "someSkill" } : _b, _d = _c.primary, primaryA = _d === void 0 ? "primary" : _d, _e = _c.secondary, secondaryA = _e === void 0 ? "secondary" : _e; + console.log(primaryA); +} +function foo2(_a) { + var _b = _a === void 0 ? robotA : _a, _c = _b.name, nameC = _c === void 0 ? "name" : _c, _d = _b.skills, _e = _d === void 0 ? { primary: "SomeSkill", secondary: "someSkill" } : _d, _f = _e.primary, primaryB = _f === void 0 ? "primary" : _f, _g = _e.secondary, secondaryB = _g === void 0 ? "secondary" : _g; + console.log(secondaryB); +} +function foo3(_a) { + var _b = (_a === void 0 ? robotA : _a).skills, skills = _b === void 0 ? { primary: "SomeSkill", secondary: "someSkill" } : _b; + console.log(skills.primary); +} +foo1(robotA); +foo1({ name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }); +foo2(robotA); +foo2({ name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }); +foo3(robotA); +foo3({ name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }); +//# sourceMappingURL=sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.js.map b/tests/baselines/reference/sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.js.map new file mode 100644 index 00000000000..0fdd3c9bcec --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.js.map @@ -0,0 +1,2 @@ +//// [sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.js.map] +{"version":3,"file":"sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.js","sourceRoot":"","sources":["sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts"],"names":[],"mappings":"AAUA,IAAI,MAAM,GAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,CAAC;AAExF,cACI,EAKiB;QAJb,yCAGoD,EAHpD,0EAGoD,EAFhD,eAA6B,EAA7B,yCAA6B,EAC7B,iBAAmC,EAAnC,6CAAmC;IAG3C,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAC1B,CAAC;AACD,cACI,EAMiB;QANjB,gCAMiB,EALb,YAAoB,EAApB,mCAAoB,EACpB,cAGoD,EAHpD,0EAGoD,EAFhD,eAA6B,EAA7B,yCAA6B,EAC7B,iBAAmC,EAAnC,6CAAmC;IAG3C,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;AAC5B,CAAC;AACD,cAAc,EAA8E;QAA5E,yCAAyD,EAAzD,8EAAyD;IACrE,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AAChC,CAAC;AAED,IAAI,CAAC,MAAM,CAAC,CAAC;AACb,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,iBAAiB,EAAE,EAAE,CAAC,CAAC;AAErF,IAAI,CAAC,MAAM,CAAC,CAAC;AACb,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,iBAAiB,EAAE,EAAE,CAAC,CAAC;AAErF,IAAI,CAAC,MAAM,CAAC,CAAC;AACb,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,iBAAiB,EAAE,EAAE,CAAC,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.sourcemap.txt b/tests/baselines/reference/sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.sourcemap.txt new file mode 100644 index 00000000000..aca1d58bcac --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.sourcemap.txt @@ -0,0 +1,669 @@ +=================================================================== +JsFile: sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.js +mapUrl: sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.js.map +sourceRoot: +sources: sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.js +sourceFile:sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts +------------------------------------------------------------------- +>>>var robotA = { name: "mower", skills: { primary: "mowing", secondary: "none" } }; +1 > +2 >^^^^ +3 > ^^^^^^ +4 > ^^^ +5 > ^^ +6 > ^^^^ +7 > ^^ +8 > ^^^^^^^ +9 > ^^ +10> ^^^^^^ +11> ^^ +12> ^^ +13> ^^^^^^^ +14> ^^ +15> ^^^^^^^^ +16> ^^ +17> ^^^^^^^^^ +18> ^^ +19> ^^^^^^ +20> ^^ +21> ^^ +22> ^ +1 >declare var console: { + > log(msg: string): void; + >} + >interface Robot { + > name: string; + > skills: { + > primary?: string; + > secondary?: string; + > }; + >} + > +2 >var +3 > robotA +4 > : Robot = +5 > { +6 > name +7 > : +8 > "mower" +9 > , +10> skills +11> : +12> { +13> primary +14> : +15> "mowing" +16> , +17> secondary +18> : +19> "none" +20> } +21> } +22> ; +1 >Emitted(1, 1) Source(11, 1) + SourceIndex(0) +2 >Emitted(1, 5) Source(11, 5) + SourceIndex(0) +3 >Emitted(1, 11) Source(11, 11) + SourceIndex(0) +4 >Emitted(1, 14) Source(11, 21) + SourceIndex(0) +5 >Emitted(1, 16) Source(11, 23) + SourceIndex(0) +6 >Emitted(1, 20) Source(11, 27) + SourceIndex(0) +7 >Emitted(1, 22) Source(11, 29) + SourceIndex(0) +8 >Emitted(1, 29) Source(11, 36) + SourceIndex(0) +9 >Emitted(1, 31) Source(11, 38) + SourceIndex(0) +10>Emitted(1, 37) Source(11, 44) + SourceIndex(0) +11>Emitted(1, 39) Source(11, 46) + SourceIndex(0) +12>Emitted(1, 41) Source(11, 48) + SourceIndex(0) +13>Emitted(1, 48) Source(11, 55) + SourceIndex(0) +14>Emitted(1, 50) Source(11, 57) + SourceIndex(0) +15>Emitted(1, 58) Source(11, 65) + SourceIndex(0) +16>Emitted(1, 60) Source(11, 67) + SourceIndex(0) +17>Emitted(1, 69) Source(11, 76) + SourceIndex(0) +18>Emitted(1, 71) Source(11, 78) + SourceIndex(0) +19>Emitted(1, 77) Source(11, 84) + SourceIndex(0) +20>Emitted(1, 79) Source(11, 86) + SourceIndex(0) +21>Emitted(1, 81) Source(11, 88) + SourceIndex(0) +22>Emitted(1, 82) Source(11, 89) + SourceIndex(0) +--- +>>>function foo1(_a) { +1 > +2 >^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > + > +2 >function foo1( + > +3 > { + > skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "SomeSkill", secondary: "someSkill" } + > }: Robot = robotA +1 >Emitted(2, 1) Source(13, 1) + SourceIndex(0) +2 >Emitted(2, 15) Source(14, 5) + SourceIndex(0) +3 >Emitted(2, 17) Source(19, 22) + SourceIndex(0) +--- +>>> var _b = (_a === void 0 ? robotA : _a).skills, _c = _b === void 0 ? { primary: "SomeSkill", secondary: "someSkill" } : _b, _d = _c.primary, primaryA = _d === void 0 ? "primary" : _d, _e = _c.secondary, secondaryA = _e === void 0 ? "secondary" : _e; +1->^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "SomeSkill", secondary: "someSkill" } +3 > +4 > skills: { + > primary: primaryA = "primary", + > secondary: secondaryA = "secondary" + > } = { primary: "SomeSkill", secondary: "someSkill" } +5 > +6 > primary: primaryA = "primary" +7 > +8 > primary: primaryA = "primary" +9 > , + > +10> secondary: secondaryA = "secondary" +11> +12> secondary: secondaryA = "secondary" +1->Emitted(3, 9) Source(15, 9) + SourceIndex(0) +2 >Emitted(3, 50) Source(18, 61) + SourceIndex(0) +3 >Emitted(3, 52) Source(15, 9) + SourceIndex(0) +4 >Emitted(3, 126) Source(18, 61) + SourceIndex(0) +5 >Emitted(3, 128) Source(16, 13) + SourceIndex(0) +6 >Emitted(3, 143) Source(16, 42) + SourceIndex(0) +7 >Emitted(3, 145) Source(16, 13) + SourceIndex(0) +8 >Emitted(3, 186) Source(16, 42) + SourceIndex(0) +9 >Emitted(3, 188) Source(17, 13) + SourceIndex(0) +10>Emitted(3, 205) Source(17, 48) + SourceIndex(0) +11>Emitted(3, 207) Source(17, 13) + SourceIndex(0) +12>Emitted(3, 252) Source(17, 48) + SourceIndex(0) +--- +>>> console.log(primaryA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^ +7 > ^ +8 > ^ +1 > + > } = { primary: "SomeSkill", secondary: "someSkill" } + > }: Robot = robotA) { + > +2 > console +3 > . +4 > log +5 > ( +6 > primaryA +7 > ) +8 > ; +1 >Emitted(4, 5) Source(20, 5) + SourceIndex(0) +2 >Emitted(4, 12) Source(20, 12) + SourceIndex(0) +3 >Emitted(4, 13) Source(20, 13) + SourceIndex(0) +4 >Emitted(4, 16) Source(20, 16) + SourceIndex(0) +5 >Emitted(4, 17) Source(20, 17) + SourceIndex(0) +6 >Emitted(4, 25) Source(20, 25) + SourceIndex(0) +7 >Emitted(4, 26) Source(20, 26) + SourceIndex(0) +8 >Emitted(4, 27) Source(20, 27) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(5, 1) Source(21, 1) + SourceIndex(0) +2 >Emitted(5, 2) Source(21, 2) + SourceIndex(0) +--- +>>>function foo2(_a) { +1-> +2 >^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >function foo2( + > +3 > { + > name: nameC = "name", + > skills: { + > primary: primaryB = "primary", + > secondary: secondaryB = "secondary" + > } = { primary: "SomeSkill", secondary: "someSkill" } + > }: Robot = robotA +1->Emitted(6, 1) Source(22, 1) + SourceIndex(0) +2 >Emitted(6, 15) Source(23, 5) + SourceIndex(0) +3 >Emitted(6, 17) Source(29, 22) + SourceIndex(0) +--- +>>> var _b = _a === void 0 ? robotA : _a, _c = _b.name, nameC = _c === void 0 ? "name" : _c, _d = _b.skills, _e = _d === void 0 ? { primary: "SomeSkill", secondary: "someSkill" } : _d, _f = _e.primary, primaryB = _f === void 0 ? "primary" : _f, _g = _e.secondary, secondaryB = _g === void 0 ? "secondary" : _g; +1->^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +15> ^^ +16> ^^^^^^^^^^^^^^^^^ +17> ^^ +18> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > { + > name: nameC = "name", + > skills: { + > primary: primaryB = "primary", + > secondary: secondaryB = "secondary" + > } = { primary: "SomeSkill", secondary: "someSkill" } + > }: Robot = robotA +3 > +4 > name: nameC = "name" +5 > +6 > name: nameC = "name" +7 > , + > +8 > skills: { + > primary: primaryB = "primary", + > secondary: secondaryB = "secondary" + > } = { primary: "SomeSkill", secondary: "someSkill" } +9 > +10> skills: { + > primary: primaryB = "primary", + > secondary: secondaryB = "secondary" + > } = { primary: "SomeSkill", secondary: "someSkill" } +11> +12> primary: primaryB = "primary" +13> +14> primary: primaryB = "primary" +15> , + > +16> secondary: secondaryB = "secondary" +17> +18> secondary: secondaryB = "secondary" +1->Emitted(7, 9) Source(23, 5) + SourceIndex(0) +2 >Emitted(7, 41) Source(29, 22) + SourceIndex(0) +3 >Emitted(7, 43) Source(24, 9) + SourceIndex(0) +4 >Emitted(7, 55) Source(24, 29) + SourceIndex(0) +5 >Emitted(7, 57) Source(24, 9) + SourceIndex(0) +6 >Emitted(7, 92) Source(24, 29) + SourceIndex(0) +7 >Emitted(7, 94) Source(25, 9) + SourceIndex(0) +8 >Emitted(7, 108) Source(28, 61) + SourceIndex(0) +9 >Emitted(7, 110) Source(25, 9) + SourceIndex(0) +10>Emitted(7, 184) Source(28, 61) + SourceIndex(0) +11>Emitted(7, 186) Source(26, 13) + SourceIndex(0) +12>Emitted(7, 201) Source(26, 42) + SourceIndex(0) +13>Emitted(7, 203) Source(26, 13) + SourceIndex(0) +14>Emitted(7, 244) Source(26, 42) + SourceIndex(0) +15>Emitted(7, 246) Source(27, 13) + SourceIndex(0) +16>Emitted(7, 263) Source(27, 48) + SourceIndex(0) +17>Emitted(7, 265) Source(27, 13) + SourceIndex(0) +18>Emitted(7, 310) Source(27, 48) + SourceIndex(0) +--- +>>> console.log(secondaryB); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^^^ +7 > ^ +8 > ^ +1 > + > } = { primary: "SomeSkill", secondary: "someSkill" } + > }: Robot = robotA) { + > +2 > console +3 > . +4 > log +5 > ( +6 > secondaryB +7 > ) +8 > ; +1 >Emitted(8, 5) Source(30, 5) + SourceIndex(0) +2 >Emitted(8, 12) Source(30, 12) + SourceIndex(0) +3 >Emitted(8, 13) Source(30, 13) + SourceIndex(0) +4 >Emitted(8, 16) Source(30, 16) + SourceIndex(0) +5 >Emitted(8, 17) Source(30, 17) + SourceIndex(0) +6 >Emitted(8, 27) Source(30, 27) + SourceIndex(0) +7 >Emitted(8, 28) Source(30, 28) + SourceIndex(0) +8 >Emitted(8, 29) Source(30, 29) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(9, 1) Source(31, 1) + SourceIndex(0) +2 >Emitted(9, 2) Source(31, 2) + SourceIndex(0) +--- +>>>function foo3(_a) { +1-> +2 >^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >function foo3( +3 > { skills = { primary: "SomeSkill", secondary: "someSkill" } }: Robot = robotA +1->Emitted(10, 1) Source(32, 1) + SourceIndex(0) +2 >Emitted(10, 15) Source(32, 15) + SourceIndex(0) +3 >Emitted(10, 17) Source(32, 93) + SourceIndex(0) +--- +>>> var _b = (_a === void 0 ? robotA : _a).skills, skills = _b === void 0 ? { primary: "SomeSkill", secondary: "someSkill" } : _b; +1->^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > skills = { primary: "SomeSkill", secondary: "someSkill" } +3 > +4 > skills = { primary: "SomeSkill", secondary: "someSkill" } +1->Emitted(11, 9) Source(32, 17) + SourceIndex(0) +2 >Emitted(11, 50) Source(32, 74) + SourceIndex(0) +3 >Emitted(11, 52) Source(32, 17) + SourceIndex(0) +4 >Emitted(11, 130) Source(32, 74) + SourceIndex(0) +--- +>>> console.log(skills.primary); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^ +7 > ^ +8 > ^^^^^^^ +9 > ^ +10> ^ +1 > }: Robot = robotA) { + > +2 > console +3 > . +4 > log +5 > ( +6 > skills +7 > . +8 > primary +9 > ) +10> ; +1 >Emitted(12, 5) Source(33, 5) + SourceIndex(0) +2 >Emitted(12, 12) Source(33, 12) + SourceIndex(0) +3 >Emitted(12, 13) Source(33, 13) + SourceIndex(0) +4 >Emitted(12, 16) Source(33, 16) + SourceIndex(0) +5 >Emitted(12, 17) Source(33, 17) + SourceIndex(0) +6 >Emitted(12, 23) Source(33, 23) + SourceIndex(0) +7 >Emitted(12, 24) Source(33, 24) + SourceIndex(0) +8 >Emitted(12, 31) Source(33, 31) + SourceIndex(0) +9 >Emitted(12, 32) Source(33, 32) + SourceIndex(0) +10>Emitted(12, 33) Source(33, 33) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(13, 1) Source(34, 1) + SourceIndex(0) +2 >Emitted(13, 2) Source(34, 2) + SourceIndex(0) +--- +>>>foo1(robotA); +1-> +2 >^^^^ +3 > ^ +4 > ^^^^^^ +5 > ^ +6 > ^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > + > +2 >foo1 +3 > ( +4 > robotA +5 > ) +6 > ; +1->Emitted(14, 1) Source(36, 1) + SourceIndex(0) +2 >Emitted(14, 5) Source(36, 5) + SourceIndex(0) +3 >Emitted(14, 6) Source(36, 6) + SourceIndex(0) +4 >Emitted(14, 12) Source(36, 12) + SourceIndex(0) +5 >Emitted(14, 13) Source(36, 13) + SourceIndex(0) +6 >Emitted(14, 14) Source(36, 14) + SourceIndex(0) +--- +>>>foo1({ name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }); +1-> +2 >^^^^ +3 > ^ +4 > ^^ +5 > ^^^^ +6 > ^^ +7 > ^^^^^^^ +8 > ^^ +9 > ^^^^^^ +10> ^^ +11> ^^ +12> ^^^^^^^ +13> ^^ +14> ^^^^^^^^ +15> ^^ +16> ^^^^^^^^^ +17> ^^ +18> ^^^^^^^^^^^^^^^^^ +19> ^^ +20> ^^ +21> ^ +22> ^ +1-> + > +2 >foo1 +3 > ( +4 > { +5 > name +6 > : +7 > "Edger" +8 > , +9 > skills +10> : +11> { +12> primary +13> : +14> "edging" +15> , +16> secondary +17> : +18> "branch trimming" +19> } +20> } +21> ) +22> ; +1->Emitted(15, 1) Source(37, 1) + SourceIndex(0) +2 >Emitted(15, 5) Source(37, 5) + SourceIndex(0) +3 >Emitted(15, 6) Source(37, 6) + SourceIndex(0) +4 >Emitted(15, 8) Source(37, 8) + SourceIndex(0) +5 >Emitted(15, 12) Source(37, 12) + SourceIndex(0) +6 >Emitted(15, 14) Source(37, 14) + SourceIndex(0) +7 >Emitted(15, 21) Source(37, 21) + SourceIndex(0) +8 >Emitted(15, 23) Source(37, 23) + SourceIndex(0) +9 >Emitted(15, 29) Source(37, 29) + SourceIndex(0) +10>Emitted(15, 31) Source(37, 31) + SourceIndex(0) +11>Emitted(15, 33) Source(37, 33) + SourceIndex(0) +12>Emitted(15, 40) Source(37, 40) + SourceIndex(0) +13>Emitted(15, 42) Source(37, 42) + SourceIndex(0) +14>Emitted(15, 50) Source(37, 50) + SourceIndex(0) +15>Emitted(15, 52) Source(37, 52) + SourceIndex(0) +16>Emitted(15, 61) Source(37, 61) + SourceIndex(0) +17>Emitted(15, 63) Source(37, 63) + SourceIndex(0) +18>Emitted(15, 80) Source(37, 80) + SourceIndex(0) +19>Emitted(15, 82) Source(37, 82) + SourceIndex(0) +20>Emitted(15, 84) Source(37, 84) + SourceIndex(0) +21>Emitted(15, 85) Source(37, 85) + SourceIndex(0) +22>Emitted(15, 86) Source(37, 86) + SourceIndex(0) +--- +>>>foo2(robotA); +1 > +2 >^^^^ +3 > ^ +4 > ^^^^^^ +5 > ^ +6 > ^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > + > +2 >foo2 +3 > ( +4 > robotA +5 > ) +6 > ; +1 >Emitted(16, 1) Source(39, 1) + SourceIndex(0) +2 >Emitted(16, 5) Source(39, 5) + SourceIndex(0) +3 >Emitted(16, 6) Source(39, 6) + SourceIndex(0) +4 >Emitted(16, 12) Source(39, 12) + SourceIndex(0) +5 >Emitted(16, 13) Source(39, 13) + SourceIndex(0) +6 >Emitted(16, 14) Source(39, 14) + SourceIndex(0) +--- +>>>foo2({ name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }); +1-> +2 >^^^^ +3 > ^ +4 > ^^ +5 > ^^^^ +6 > ^^ +7 > ^^^^^^^ +8 > ^^ +9 > ^^^^^^ +10> ^^ +11> ^^ +12> ^^^^^^^ +13> ^^ +14> ^^^^^^^^ +15> ^^ +16> ^^^^^^^^^ +17> ^^ +18> ^^^^^^^^^^^^^^^^^ +19> ^^ +20> ^^ +21> ^ +22> ^ +1-> + > +2 >foo2 +3 > ( +4 > { +5 > name +6 > : +7 > "Edger" +8 > , +9 > skills +10> : +11> { +12> primary +13> : +14> "edging" +15> , +16> secondary +17> : +18> "branch trimming" +19> } +20> } +21> ) +22> ; +1->Emitted(17, 1) Source(40, 1) + SourceIndex(0) +2 >Emitted(17, 5) Source(40, 5) + SourceIndex(0) +3 >Emitted(17, 6) Source(40, 6) + SourceIndex(0) +4 >Emitted(17, 8) Source(40, 8) + SourceIndex(0) +5 >Emitted(17, 12) Source(40, 12) + SourceIndex(0) +6 >Emitted(17, 14) Source(40, 14) + SourceIndex(0) +7 >Emitted(17, 21) Source(40, 21) + SourceIndex(0) +8 >Emitted(17, 23) Source(40, 23) + SourceIndex(0) +9 >Emitted(17, 29) Source(40, 29) + SourceIndex(0) +10>Emitted(17, 31) Source(40, 31) + SourceIndex(0) +11>Emitted(17, 33) Source(40, 33) + SourceIndex(0) +12>Emitted(17, 40) Source(40, 40) + SourceIndex(0) +13>Emitted(17, 42) Source(40, 42) + SourceIndex(0) +14>Emitted(17, 50) Source(40, 50) + SourceIndex(0) +15>Emitted(17, 52) Source(40, 52) + SourceIndex(0) +16>Emitted(17, 61) Source(40, 61) + SourceIndex(0) +17>Emitted(17, 63) Source(40, 63) + SourceIndex(0) +18>Emitted(17, 80) Source(40, 80) + SourceIndex(0) +19>Emitted(17, 82) Source(40, 82) + SourceIndex(0) +20>Emitted(17, 84) Source(40, 84) + SourceIndex(0) +21>Emitted(17, 85) Source(40, 85) + SourceIndex(0) +22>Emitted(17, 86) Source(40, 86) + SourceIndex(0) +--- +>>>foo3(robotA); +1 > +2 >^^^^ +3 > ^ +4 > ^^^^^^ +5 > ^ +6 > ^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > + > +2 >foo3 +3 > ( +4 > robotA +5 > ) +6 > ; +1 >Emitted(18, 1) Source(42, 1) + SourceIndex(0) +2 >Emitted(18, 5) Source(42, 5) + SourceIndex(0) +3 >Emitted(18, 6) Source(42, 6) + SourceIndex(0) +4 >Emitted(18, 12) Source(42, 12) + SourceIndex(0) +5 >Emitted(18, 13) Source(42, 13) + SourceIndex(0) +6 >Emitted(18, 14) Source(42, 14) + SourceIndex(0) +--- +>>>foo3({ name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }); +1-> +2 >^^^^ +3 > ^ +4 > ^^ +5 > ^^^^ +6 > ^^ +7 > ^^^^^^^ +8 > ^^ +9 > ^^^^^^ +10> ^^ +11> ^^ +12> ^^^^^^^ +13> ^^ +14> ^^^^^^^^ +15> ^^ +16> ^^^^^^^^^ +17> ^^ +18> ^^^^^^^^^^^^^^^^^ +19> ^^ +20> ^^ +21> ^ +22> ^ +23> ^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >foo3 +3 > ( +4 > { +5 > name +6 > : +7 > "Edger" +8 > , +9 > skills +10> : +11> { +12> primary +13> : +14> "edging" +15> , +16> secondary +17> : +18> "branch trimming" +19> } +20> } +21> ) +22> ; +1->Emitted(19, 1) Source(43, 1) + SourceIndex(0) +2 >Emitted(19, 5) Source(43, 5) + SourceIndex(0) +3 >Emitted(19, 6) Source(43, 6) + SourceIndex(0) +4 >Emitted(19, 8) Source(43, 8) + SourceIndex(0) +5 >Emitted(19, 12) Source(43, 12) + SourceIndex(0) +6 >Emitted(19, 14) Source(43, 14) + SourceIndex(0) +7 >Emitted(19, 21) Source(43, 21) + SourceIndex(0) +8 >Emitted(19, 23) Source(43, 23) + SourceIndex(0) +9 >Emitted(19, 29) Source(43, 29) + SourceIndex(0) +10>Emitted(19, 31) Source(43, 31) + SourceIndex(0) +11>Emitted(19, 33) Source(43, 33) + SourceIndex(0) +12>Emitted(19, 40) Source(43, 40) + SourceIndex(0) +13>Emitted(19, 42) Source(43, 42) + SourceIndex(0) +14>Emitted(19, 50) Source(43, 50) + SourceIndex(0) +15>Emitted(19, 52) Source(43, 52) + SourceIndex(0) +16>Emitted(19, 61) Source(43, 61) + SourceIndex(0) +17>Emitted(19, 63) Source(43, 63) + SourceIndex(0) +18>Emitted(19, 80) Source(43, 80) + SourceIndex(0) +19>Emitted(19, 82) Source(43, 82) + SourceIndex(0) +20>Emitted(19, 84) Source(43, 84) + SourceIndex(0) +21>Emitted(19, 85) Source(43, 85) + SourceIndex(0) +22>Emitted(19, 86) Source(43, 86) + SourceIndex(0) +--- +>>>//# sourceMappingURL=sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.symbols b/tests/baselines/reference/sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.symbols new file mode 100644 index 00000000000..72412207cfb --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.symbols @@ -0,0 +1,143 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts === +declare var console: { +>console : Symbol(console, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 0, 11)) + + log(msg: string): void; +>log : Symbol(log, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 0, 22)) +>msg : Symbol(msg, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 1, 8)) +} +interface Robot { +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 2, 1)) + + name: string; +>name : Symbol(Robot.name, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 3, 17)) + + skills: { +>skills : Symbol(Robot.skills, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 4, 17)) + + primary?: string; +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 5, 13)) + + secondary?: string; +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 6, 25)) + + }; +} +var robotA: Robot = { name: "mower", skills: { primary: "mowing", secondary: "none" } }; +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 10, 3)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 2, 1)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 10, 21)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 10, 36)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 10, 46)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 10, 65)) + +function foo1( +>foo1 : Symbol(foo1, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 10, 88)) + { + skills: { +>skills : Symbol(Robot.skills, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 4, 17)) + + primary: primaryA = "primary", +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 5, 13)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 14, 17)) + + secondary: secondaryA = "secondary" +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 6, 25)) +>secondaryA : Symbol(secondaryA, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 15, 42)) + + } = { primary: "SomeSkill", secondary: "someSkill" } +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 17, 13)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 17, 35)) + + }: Robot = robotA) { +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 2, 1)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 10, 3)) + + console.log(primaryA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 0, 22)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 14, 17)) +} +function foo2( +>foo2 : Symbol(foo2, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 20, 1)) + { + name: nameC = "name", +>name : Symbol(Robot.name, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 3, 17)) +>nameC : Symbol(nameC, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 22, 5)) + + skills: { +>skills : Symbol(Robot.skills, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 4, 17)) + + primary: primaryB = "primary", +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 5, 13)) +>primaryB : Symbol(primaryB, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 24, 17)) + + secondary: secondaryB = "secondary" +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 6, 25)) +>secondaryB : Symbol(secondaryB, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 25, 42)) + + } = { primary: "SomeSkill", secondary: "someSkill" } +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 27, 13)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 27, 35)) + + }: Robot = robotA) { +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 2, 1)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 10, 3)) + + console.log(secondaryB); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 0, 22)) +>secondaryB : Symbol(secondaryB, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 25, 42)) +} +function foo3({ skills = { primary: "SomeSkill", secondary: "someSkill" } }: Robot = robotA) { +>foo3 : Symbol(foo3, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 30, 1)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 31, 15)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 31, 26)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 31, 48)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 2, 1)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 10, 3)) + + console.log(skills.primary); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 0, 22)) +>skills.primary : Symbol(primary, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 5, 13)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 31, 15)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 5, 13)) +} + +foo1(robotA); +>foo1 : Symbol(foo1, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 10, 88)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 10, 3)) + +foo1({ name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }); +>foo1 : Symbol(foo1, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 10, 88)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 36, 6)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 36, 21)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 36, 31)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 36, 50)) + +foo2(robotA); +>foo2 : Symbol(foo2, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 20, 1)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 10, 3)) + +foo2({ name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }); +>foo2 : Symbol(foo2, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 20, 1)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 39, 6)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 39, 21)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 39, 31)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 39, 50)) + +foo3(robotA); +>foo3 : Symbol(foo3, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 30, 1)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 10, 3)) + +foo3({ name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }); +>foo3 : Symbol(foo3, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 30, 1)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 42, 6)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 42, 21)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 42, 31)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts, 42, 50)) + diff --git a/tests/baselines/reference/sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.types b/tests/baselines/reference/sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.types new file mode 100644 index 00000000000..1115931feef --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.types @@ -0,0 +1,186 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts === +declare var console: { +>console : { log(msg: string): void; } + + log(msg: string): void; +>log : (msg: string) => void +>msg : string +} +interface Robot { +>Robot : Robot + + name: string; +>name : string + + skills: { +>skills : { primary?: string; secondary?: string; } + + primary?: string; +>primary : string + + secondary?: string; +>secondary : string + + }; +} +var robotA: Robot = { name: "mower", skills: { primary: "mowing", secondary: "none" } }; +>robotA : Robot +>Robot : Robot +>{ name: "mower", skills: { primary: "mowing", secondary: "none" } } : { name: string; skills: { primary: string; secondary: string; }; } +>name : string +>"mower" : string +>skills : { primary: string; secondary: string; } +>{ primary: "mowing", secondary: "none" } : { primary: string; secondary: string; } +>primary : string +>"mowing" : string +>secondary : string +>"none" : string + +function foo1( +>foo1 : ({skills: {primary: primaryA, secondary: secondaryA}}?: Robot) => void + { + skills: { +>skills : any + + primary: primaryA = "primary", +>primary : any +>primaryA : string +>"primary" : string + + secondary: secondaryA = "secondary" +>secondary : any +>secondaryA : string +>"secondary" : string + + } = { primary: "SomeSkill", secondary: "someSkill" } +>{ primary: "SomeSkill", secondary: "someSkill" } : { primary?: string; secondary?: string; } +>primary : string +>"SomeSkill" : string +>secondary : string +>"someSkill" : string + + }: Robot = robotA) { +>Robot : Robot +>robotA : Robot + + console.log(primaryA); +>console.log(primaryA) : void +>console.log : (msg: string) => void +>console : { log(msg: string): void; } +>log : (msg: string) => void +>primaryA : string +} +function foo2( +>foo2 : ({name: nameC, skills: {primary: primaryB, secondary: secondaryB}}?: Robot) => void + { + name: nameC = "name", +>name : any +>nameC : string +>"name" : string + + skills: { +>skills : any + + primary: primaryB = "primary", +>primary : any +>primaryB : string +>"primary" : string + + secondary: secondaryB = "secondary" +>secondary : any +>secondaryB : string +>"secondary" : string + + } = { primary: "SomeSkill", secondary: "someSkill" } +>{ primary: "SomeSkill", secondary: "someSkill" } : { primary?: string; secondary?: string; } +>primary : string +>"SomeSkill" : string +>secondary : string +>"someSkill" : string + + }: Robot = robotA) { +>Robot : Robot +>robotA : Robot + + console.log(secondaryB); +>console.log(secondaryB) : void +>console.log : (msg: string) => void +>console : { log(msg: string): void; } +>log : (msg: string) => void +>secondaryB : string +} +function foo3({ skills = { primary: "SomeSkill", secondary: "someSkill" } }: Robot = robotA) { +>foo3 : ({skills}?: Robot) => void +>skills : { primary?: string; secondary?: string; } +>{ primary: "SomeSkill", secondary: "someSkill" } : { primary: string; secondary: string; } +>primary : string +>"SomeSkill" : string +>secondary : string +>"someSkill" : string +>Robot : Robot +>robotA : Robot + + console.log(skills.primary); +>console.log(skills.primary) : void +>console.log : (msg: string) => void +>console : { log(msg: string): void; } +>log : (msg: string) => void +>skills.primary : string +>skills : { primary?: string; secondary?: string; } +>primary : string +} + +foo1(robotA); +>foo1(robotA) : void +>foo1 : ({skills: {primary: primaryA, secondary: secondaryA}}?: Robot) => void +>robotA : Robot + +foo1({ name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }); +>foo1({ name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }) : void +>foo1 : ({skills: {primary: primaryA, secondary: secondaryA}}?: Robot) => void +>{ name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } } : { name: string; skills: { primary: string; secondary: string; }; } +>name : string +>"Edger" : string +>skills : { primary: string; secondary: string; } +>{ primary: "edging", secondary: "branch trimming" } : { primary: string; secondary: string; } +>primary : string +>"edging" : string +>secondary : string +>"branch trimming" : string + +foo2(robotA); +>foo2(robotA) : void +>foo2 : ({name: nameC, skills: {primary: primaryB, secondary: secondaryB}}?: Robot) => void +>robotA : Robot + +foo2({ name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }); +>foo2({ name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }) : void +>foo2 : ({name: nameC, skills: {primary: primaryB, secondary: secondaryB}}?: Robot) => void +>{ name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } } : { name: string; skills: { primary: string; secondary: string; }; } +>name : string +>"Edger" : string +>skills : { primary: string; secondary: string; } +>{ primary: "edging", secondary: "branch trimming" } : { primary: string; secondary: string; } +>primary : string +>"edging" : string +>secondary : string +>"branch trimming" : string + +foo3(robotA); +>foo3(robotA) : void +>foo3 : ({skills}?: Robot) => void +>robotA : Robot + +foo3({ name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }); +>foo3({ name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }) : void +>foo3 : ({skills}?: Robot) => void +>{ name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } } : { name: string; skills: { primary: string; secondary: string; }; } +>name : string +>"Edger" : string +>skills : { primary: string; secondary: string; } +>{ primary: "edging", secondary: "branch trimming" } : { primary: string; secondary: string; } +>primary : string +>"edging" : string +>secondary : string +>"branch trimming" : string + diff --git a/tests/baselines/reference/sourceMapValidationDestructuringParameterObjectBindingPattern.js b/tests/baselines/reference/sourceMapValidationDestructuringParameterObjectBindingPattern.js new file mode 100644 index 00000000000..4a56f449ecc --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringParameterObjectBindingPattern.js @@ -0,0 +1,53 @@ +//// [sourceMapValidationDestructuringParameterObjectBindingPattern.ts] +interface Robot { + name: string; + skill: string; +} +declare var console: { + log(msg: string): void; +} +var hello = "hello"; +var robotA: Robot = { name: "mower", skill: "mowing" }; + +function foo1({ name: nameA }: Robot) { + console.log(nameA); +} +function foo2({ name: nameB, skill: skillB }: Robot) { + console.log(nameB); +} +function foo3({ name }: Robot) { + console.log(name); +} + +foo1(robotA); +foo1({ name: "Edger", skill: "cutting edges" }); + +foo2(robotA); +foo2({ name: "Edger", skill: "cutting edges" }); + +foo3(robotA); +foo3({ name: "Edger", skill: "cutting edges" }); + + +//// [sourceMapValidationDestructuringParameterObjectBindingPattern.js] +var hello = "hello"; +var robotA = { name: "mower", skill: "mowing" }; +function foo1(_a) { + var nameA = _a.name; + console.log(nameA); +} +function foo2(_a) { + var nameB = _a.name, skillB = _a.skill; + console.log(nameB); +} +function foo3(_a) { + var name = _a.name; + console.log(name); +} +foo1(robotA); +foo1({ name: "Edger", skill: "cutting edges" }); +foo2(robotA); +foo2({ name: "Edger", skill: "cutting edges" }); +foo3(robotA); +foo3({ name: "Edger", skill: "cutting edges" }); +//# sourceMappingURL=sourceMapValidationDestructuringParameterObjectBindingPattern.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringParameterObjectBindingPattern.js.map b/tests/baselines/reference/sourceMapValidationDestructuringParameterObjectBindingPattern.js.map new file mode 100644 index 00000000000..adc7a7dbb90 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringParameterObjectBindingPattern.js.map @@ -0,0 +1,2 @@ +//// [sourceMapValidationDestructuringParameterObjectBindingPattern.js.map] +{"version":3,"file":"sourceMapValidationDestructuringParameterObjectBindingPattern.js","sourceRoot":"","sources":["sourceMapValidationDestructuringParameterObjectBindingPattern.ts"],"names":[],"mappings":"AAOA,IAAI,KAAK,GAAG,OAAO,CAAC;AACpB,IAAI,MAAM,GAAU,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;AAEvD,cAAc,EAAsB;QAApB,eAAW;IACvB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AACD,cAAc,EAAqC;QAAnC,eAAW,EAAE,iBAAa;IACtC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AACD,cAAc,EAAe;QAAb,cAAI;IAChB,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACtB,CAAC;AAED,IAAI,CAAC,MAAM,CAAC,CAAC;AACb,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE,CAAC,CAAC;AAEhD,IAAI,CAAC,MAAM,CAAC,CAAC;AACb,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE,CAAC,CAAC;AAEhD,IAAI,CAAC,MAAM,CAAC,CAAC;AACb,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE,CAAC,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringParameterObjectBindingPattern.sourcemap.txt b/tests/baselines/reference/sourceMapValidationDestructuringParameterObjectBindingPattern.sourcemap.txt new file mode 100644 index 00000000000..ee826647f54 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringParameterObjectBindingPattern.sourcemap.txt @@ -0,0 +1,472 @@ +=================================================================== +JsFile: sourceMapValidationDestructuringParameterObjectBindingPattern.js +mapUrl: sourceMapValidationDestructuringParameterObjectBindingPattern.js.map +sourceRoot: +sources: sourceMapValidationDestructuringParameterObjectBindingPattern.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/sourceMapValidationDestructuringParameterObjectBindingPattern.js +sourceFile:sourceMapValidationDestructuringParameterObjectBindingPattern.ts +------------------------------------------------------------------- +>>>var hello = "hello"; +1 > +2 >^^^^ +3 > ^^^^^ +4 > ^^^ +5 > ^^^^^^^ +6 > ^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 >interface Robot { + > name: string; + > skill: string; + >} + >declare var console: { + > log(msg: string): void; + >} + > +2 >var +3 > hello +4 > = +5 > "hello" +6 > ; +1 >Emitted(1, 1) Source(8, 1) + SourceIndex(0) +2 >Emitted(1, 5) Source(8, 5) + SourceIndex(0) +3 >Emitted(1, 10) Source(8, 10) + SourceIndex(0) +4 >Emitted(1, 13) Source(8, 13) + SourceIndex(0) +5 >Emitted(1, 20) Source(8, 20) + SourceIndex(0) +6 >Emitted(1, 21) Source(8, 21) + SourceIndex(0) +--- +>>>var robotA = { name: "mower", skill: "mowing" }; +1-> +2 >^^^^ +3 > ^^^^^^ +4 > ^^^ +5 > ^^ +6 > ^^^^ +7 > ^^ +8 > ^^^^^^^ +9 > ^^ +10> ^^^^^ +11> ^^ +12> ^^^^^^^^ +13> ^^ +14> ^ +1-> + > +2 >var +3 > robotA +4 > : Robot = +5 > { +6 > name +7 > : +8 > "mower" +9 > , +10> skill +11> : +12> "mowing" +13> } +14> ; +1->Emitted(2, 1) Source(9, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(9, 5) + SourceIndex(0) +3 >Emitted(2, 11) Source(9, 11) + SourceIndex(0) +4 >Emitted(2, 14) Source(9, 21) + SourceIndex(0) +5 >Emitted(2, 16) Source(9, 23) + SourceIndex(0) +6 >Emitted(2, 20) Source(9, 27) + SourceIndex(0) +7 >Emitted(2, 22) Source(9, 29) + SourceIndex(0) +8 >Emitted(2, 29) Source(9, 36) + SourceIndex(0) +9 >Emitted(2, 31) Source(9, 38) + SourceIndex(0) +10>Emitted(2, 36) Source(9, 43) + SourceIndex(0) +11>Emitted(2, 38) Source(9, 45) + SourceIndex(0) +12>Emitted(2, 46) Source(9, 53) + SourceIndex(0) +13>Emitted(2, 48) Source(9, 55) + SourceIndex(0) +14>Emitted(2, 49) Source(9, 56) + SourceIndex(0) +--- +>>>function foo1(_a) { +1 > +2 >^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^-> +1 > + > + > +2 >function foo1( +3 > { name: nameA }: Robot +1 >Emitted(3, 1) Source(11, 1) + SourceIndex(0) +2 >Emitted(3, 15) Source(11, 15) + SourceIndex(0) +3 >Emitted(3, 17) Source(11, 37) + SourceIndex(0) +--- +>>> var nameA = _a.name; +1->^^^^^^^^ +2 > ^^^^^^^^^^^^^^^ +3 > ^-> +1-> +2 > name: nameA +1->Emitted(4, 9) Source(11, 17) + SourceIndex(0) +2 >Emitted(4, 24) Source(11, 28) + SourceIndex(0) +--- +>>> console.log(nameA); +1->^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1-> }: Robot) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1->Emitted(5, 5) Source(12, 5) + SourceIndex(0) +2 >Emitted(5, 12) Source(12, 12) + SourceIndex(0) +3 >Emitted(5, 13) Source(12, 13) + SourceIndex(0) +4 >Emitted(5, 16) Source(12, 16) + SourceIndex(0) +5 >Emitted(5, 17) Source(12, 17) + SourceIndex(0) +6 >Emitted(5, 22) Source(12, 22) + SourceIndex(0) +7 >Emitted(5, 23) Source(12, 23) + SourceIndex(0) +8 >Emitted(5, 24) Source(12, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(6, 1) Source(13, 1) + SourceIndex(0) +2 >Emitted(6, 2) Source(13, 2) + SourceIndex(0) +--- +>>>function foo2(_a) { +1-> +2 >^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >function foo2( +3 > { name: nameB, skill: skillB }: Robot +1->Emitted(7, 1) Source(14, 1) + SourceIndex(0) +2 >Emitted(7, 15) Source(14, 15) + SourceIndex(0) +3 >Emitted(7, 17) Source(14, 52) + SourceIndex(0) +--- +>>> var nameB = _a.name, skillB = _a.skill; +1->^^^^^^^^ +2 > ^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^ +1-> +2 > name: nameB +3 > , +4 > skill: skillB +1->Emitted(8, 9) Source(14, 17) + SourceIndex(0) +2 >Emitted(8, 24) Source(14, 28) + SourceIndex(0) +3 >Emitted(8, 26) Source(14, 30) + SourceIndex(0) +4 >Emitted(8, 43) Source(14, 43) + SourceIndex(0) +--- +>>> console.log(nameB); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > }: Robot) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameB +7 > ) +8 > ; +1 >Emitted(9, 5) Source(15, 5) + SourceIndex(0) +2 >Emitted(9, 12) Source(15, 12) + SourceIndex(0) +3 >Emitted(9, 13) Source(15, 13) + SourceIndex(0) +4 >Emitted(9, 16) Source(15, 16) + SourceIndex(0) +5 >Emitted(9, 17) Source(15, 17) + SourceIndex(0) +6 >Emitted(9, 22) Source(15, 22) + SourceIndex(0) +7 >Emitted(9, 23) Source(15, 23) + SourceIndex(0) +8 >Emitted(9, 24) Source(15, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(10, 1) Source(16, 1) + SourceIndex(0) +2 >Emitted(10, 2) Source(16, 2) + SourceIndex(0) +--- +>>>function foo3(_a) { +1-> +2 >^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^-> +1-> + > +2 >function foo3( +3 > { name }: Robot +1->Emitted(11, 1) Source(17, 1) + SourceIndex(0) +2 >Emitted(11, 15) Source(17, 15) + SourceIndex(0) +3 >Emitted(11, 17) Source(17, 30) + SourceIndex(0) +--- +>>> var name = _a.name; +1->^^^^^^^^ +2 > ^^^^^^^^^^^^^^ +3 > ^-> +1-> +2 > name +1->Emitted(12, 9) Source(17, 17) + SourceIndex(0) +2 >Emitted(12, 23) Source(17, 21) + SourceIndex(0) +--- +>>> console.log(name); +1->^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^ +7 > ^ +8 > ^ +1-> }: Robot) { + > +2 > console +3 > . +4 > log +5 > ( +6 > name +7 > ) +8 > ; +1->Emitted(13, 5) Source(18, 5) + SourceIndex(0) +2 >Emitted(13, 12) Source(18, 12) + SourceIndex(0) +3 >Emitted(13, 13) Source(18, 13) + SourceIndex(0) +4 >Emitted(13, 16) Source(18, 16) + SourceIndex(0) +5 >Emitted(13, 17) Source(18, 17) + SourceIndex(0) +6 >Emitted(13, 21) Source(18, 21) + SourceIndex(0) +7 >Emitted(13, 22) Source(18, 22) + SourceIndex(0) +8 >Emitted(13, 23) Source(18, 23) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(14, 1) Source(19, 1) + SourceIndex(0) +2 >Emitted(14, 2) Source(19, 2) + SourceIndex(0) +--- +>>>foo1(robotA); +1-> +2 >^^^^ +3 > ^ +4 > ^^^^^^ +5 > ^ +6 > ^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > + > +2 >foo1 +3 > ( +4 > robotA +5 > ) +6 > ; +1->Emitted(15, 1) Source(21, 1) + SourceIndex(0) +2 >Emitted(15, 5) Source(21, 5) + SourceIndex(0) +3 >Emitted(15, 6) Source(21, 6) + SourceIndex(0) +4 >Emitted(15, 12) Source(21, 12) + SourceIndex(0) +5 >Emitted(15, 13) Source(21, 13) + SourceIndex(0) +6 >Emitted(15, 14) Source(21, 14) + SourceIndex(0) +--- +>>>foo1({ name: "Edger", skill: "cutting edges" }); +1-> +2 >^^^^ +3 > ^ +4 > ^^ +5 > ^^^^ +6 > ^^ +7 > ^^^^^^^ +8 > ^^ +9 > ^^^^^ +10> ^^ +11> ^^^^^^^^^^^^^^^ +12> ^^ +13> ^ +14> ^ +1-> + > +2 >foo1 +3 > ( +4 > { +5 > name +6 > : +7 > "Edger" +8 > , +9 > skill +10> : +11> "cutting edges" +12> } +13> ) +14> ; +1->Emitted(16, 1) Source(22, 1) + SourceIndex(0) +2 >Emitted(16, 5) Source(22, 5) + SourceIndex(0) +3 >Emitted(16, 6) Source(22, 6) + SourceIndex(0) +4 >Emitted(16, 8) Source(22, 8) + SourceIndex(0) +5 >Emitted(16, 12) Source(22, 12) + SourceIndex(0) +6 >Emitted(16, 14) Source(22, 14) + SourceIndex(0) +7 >Emitted(16, 21) Source(22, 21) + SourceIndex(0) +8 >Emitted(16, 23) Source(22, 23) + SourceIndex(0) +9 >Emitted(16, 28) Source(22, 28) + SourceIndex(0) +10>Emitted(16, 30) Source(22, 30) + SourceIndex(0) +11>Emitted(16, 45) Source(22, 45) + SourceIndex(0) +12>Emitted(16, 47) Source(22, 47) + SourceIndex(0) +13>Emitted(16, 48) Source(22, 48) + SourceIndex(0) +14>Emitted(16, 49) Source(22, 49) + SourceIndex(0) +--- +>>>foo2(robotA); +1 > +2 >^^^^ +3 > ^ +4 > ^^^^^^ +5 > ^ +6 > ^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > + > +2 >foo2 +3 > ( +4 > robotA +5 > ) +6 > ; +1 >Emitted(17, 1) Source(24, 1) + SourceIndex(0) +2 >Emitted(17, 5) Source(24, 5) + SourceIndex(0) +3 >Emitted(17, 6) Source(24, 6) + SourceIndex(0) +4 >Emitted(17, 12) Source(24, 12) + SourceIndex(0) +5 >Emitted(17, 13) Source(24, 13) + SourceIndex(0) +6 >Emitted(17, 14) Source(24, 14) + SourceIndex(0) +--- +>>>foo2({ name: "Edger", skill: "cutting edges" }); +1-> +2 >^^^^ +3 > ^ +4 > ^^ +5 > ^^^^ +6 > ^^ +7 > ^^^^^^^ +8 > ^^ +9 > ^^^^^ +10> ^^ +11> ^^^^^^^^^^^^^^^ +12> ^^ +13> ^ +14> ^ +1-> + > +2 >foo2 +3 > ( +4 > { +5 > name +6 > : +7 > "Edger" +8 > , +9 > skill +10> : +11> "cutting edges" +12> } +13> ) +14> ; +1->Emitted(18, 1) Source(25, 1) + SourceIndex(0) +2 >Emitted(18, 5) Source(25, 5) + SourceIndex(0) +3 >Emitted(18, 6) Source(25, 6) + SourceIndex(0) +4 >Emitted(18, 8) Source(25, 8) + SourceIndex(0) +5 >Emitted(18, 12) Source(25, 12) + SourceIndex(0) +6 >Emitted(18, 14) Source(25, 14) + SourceIndex(0) +7 >Emitted(18, 21) Source(25, 21) + SourceIndex(0) +8 >Emitted(18, 23) Source(25, 23) + SourceIndex(0) +9 >Emitted(18, 28) Source(25, 28) + SourceIndex(0) +10>Emitted(18, 30) Source(25, 30) + SourceIndex(0) +11>Emitted(18, 45) Source(25, 45) + SourceIndex(0) +12>Emitted(18, 47) Source(25, 47) + SourceIndex(0) +13>Emitted(18, 48) Source(25, 48) + SourceIndex(0) +14>Emitted(18, 49) Source(25, 49) + SourceIndex(0) +--- +>>>foo3(robotA); +1 > +2 >^^^^ +3 > ^ +4 > ^^^^^^ +5 > ^ +6 > ^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > + > +2 >foo3 +3 > ( +4 > robotA +5 > ) +6 > ; +1 >Emitted(19, 1) Source(27, 1) + SourceIndex(0) +2 >Emitted(19, 5) Source(27, 5) + SourceIndex(0) +3 >Emitted(19, 6) Source(27, 6) + SourceIndex(0) +4 >Emitted(19, 12) Source(27, 12) + SourceIndex(0) +5 >Emitted(19, 13) Source(27, 13) + SourceIndex(0) +6 >Emitted(19, 14) Source(27, 14) + SourceIndex(0) +--- +>>>foo3({ name: "Edger", skill: "cutting edges" }); +1-> +2 >^^^^ +3 > ^ +4 > ^^ +5 > ^^^^ +6 > ^^ +7 > ^^^^^^^ +8 > ^^ +9 > ^^^^^ +10> ^^ +11> ^^^^^^^^^^^^^^^ +12> ^^ +13> ^ +14> ^ +15> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >foo3 +3 > ( +4 > { +5 > name +6 > : +7 > "Edger" +8 > , +9 > skill +10> : +11> "cutting edges" +12> } +13> ) +14> ; +1->Emitted(20, 1) Source(28, 1) + SourceIndex(0) +2 >Emitted(20, 5) Source(28, 5) + SourceIndex(0) +3 >Emitted(20, 6) Source(28, 6) + SourceIndex(0) +4 >Emitted(20, 8) Source(28, 8) + SourceIndex(0) +5 >Emitted(20, 12) Source(28, 12) + SourceIndex(0) +6 >Emitted(20, 14) Source(28, 14) + SourceIndex(0) +7 >Emitted(20, 21) Source(28, 21) + SourceIndex(0) +8 >Emitted(20, 23) Source(28, 23) + SourceIndex(0) +9 >Emitted(20, 28) Source(28, 28) + SourceIndex(0) +10>Emitted(20, 30) Source(28, 30) + SourceIndex(0) +11>Emitted(20, 45) Source(28, 45) + SourceIndex(0) +12>Emitted(20, 47) Source(28, 47) + SourceIndex(0) +13>Emitted(20, 48) Source(28, 48) + SourceIndex(0) +14>Emitted(20, 49) Source(28, 49) + SourceIndex(0) +--- +>>>//# sourceMappingURL=sourceMapValidationDestructuringParameterObjectBindingPattern.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringParameterObjectBindingPattern.symbols b/tests/baselines/reference/sourceMapValidationDestructuringParameterObjectBindingPattern.symbols new file mode 100644 index 00000000000..c87a10dce92 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringParameterObjectBindingPattern.symbols @@ -0,0 +1,91 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringParameterObjectBindingPattern.ts === +interface Robot { +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringParameterObjectBindingPattern.ts, 0, 0)) + + name: string; +>name : Symbol(Robot.name, Decl(sourceMapValidationDestructuringParameterObjectBindingPattern.ts, 0, 17)) + + skill: string; +>skill : Symbol(Robot.skill, Decl(sourceMapValidationDestructuringParameterObjectBindingPattern.ts, 1, 17)) +} +declare var console: { +>console : Symbol(console, Decl(sourceMapValidationDestructuringParameterObjectBindingPattern.ts, 4, 11)) + + log(msg: string): void; +>log : Symbol(log, Decl(sourceMapValidationDestructuringParameterObjectBindingPattern.ts, 4, 22)) +>msg : Symbol(msg, Decl(sourceMapValidationDestructuringParameterObjectBindingPattern.ts, 5, 8)) +} +var hello = "hello"; +>hello : Symbol(hello, Decl(sourceMapValidationDestructuringParameterObjectBindingPattern.ts, 7, 3)) + +var robotA: Robot = { name: "mower", skill: "mowing" }; +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringParameterObjectBindingPattern.ts, 8, 3)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringParameterObjectBindingPattern.ts, 0, 0)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringParameterObjectBindingPattern.ts, 8, 21)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringParameterObjectBindingPattern.ts, 8, 36)) + +function foo1({ name: nameA }: Robot) { +>foo1 : Symbol(foo1, Decl(sourceMapValidationDestructuringParameterObjectBindingPattern.ts, 8, 55)) +>name : Symbol(Robot.name, Decl(sourceMapValidationDestructuringParameterObjectBindingPattern.ts, 0, 17)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringParameterObjectBindingPattern.ts, 10, 15)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringParameterObjectBindingPattern.ts, 0, 0)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringParameterObjectBindingPattern.ts, 4, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringParameterObjectBindingPattern.ts, 4, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringParameterObjectBindingPattern.ts, 4, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringParameterObjectBindingPattern.ts, 10, 15)) +} +function foo2({ name: nameB, skill: skillB }: Robot) { +>foo2 : Symbol(foo2, Decl(sourceMapValidationDestructuringParameterObjectBindingPattern.ts, 12, 1)) +>name : Symbol(Robot.name, Decl(sourceMapValidationDestructuringParameterObjectBindingPattern.ts, 0, 17)) +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringParameterObjectBindingPattern.ts, 13, 15)) +>skill : Symbol(Robot.skill, Decl(sourceMapValidationDestructuringParameterObjectBindingPattern.ts, 1, 17)) +>skillB : Symbol(skillB, Decl(sourceMapValidationDestructuringParameterObjectBindingPattern.ts, 13, 28)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringParameterObjectBindingPattern.ts, 0, 0)) + + console.log(nameB); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringParameterObjectBindingPattern.ts, 4, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringParameterObjectBindingPattern.ts, 4, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringParameterObjectBindingPattern.ts, 4, 22)) +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringParameterObjectBindingPattern.ts, 13, 15)) +} +function foo3({ name }: Robot) { +>foo3 : Symbol(foo3, Decl(sourceMapValidationDestructuringParameterObjectBindingPattern.ts, 15, 1)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringParameterObjectBindingPattern.ts, 16, 15)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringParameterObjectBindingPattern.ts, 0, 0)) + + console.log(name); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringParameterObjectBindingPattern.ts, 4, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringParameterObjectBindingPattern.ts, 4, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringParameterObjectBindingPattern.ts, 4, 22)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringParameterObjectBindingPattern.ts, 16, 15)) +} + +foo1(robotA); +>foo1 : Symbol(foo1, Decl(sourceMapValidationDestructuringParameterObjectBindingPattern.ts, 8, 55)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringParameterObjectBindingPattern.ts, 8, 3)) + +foo1({ name: "Edger", skill: "cutting edges" }); +>foo1 : Symbol(foo1, Decl(sourceMapValidationDestructuringParameterObjectBindingPattern.ts, 8, 55)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringParameterObjectBindingPattern.ts, 21, 6)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringParameterObjectBindingPattern.ts, 21, 21)) + +foo2(robotA); +>foo2 : Symbol(foo2, Decl(sourceMapValidationDestructuringParameterObjectBindingPattern.ts, 12, 1)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringParameterObjectBindingPattern.ts, 8, 3)) + +foo2({ name: "Edger", skill: "cutting edges" }); +>foo2 : Symbol(foo2, Decl(sourceMapValidationDestructuringParameterObjectBindingPattern.ts, 12, 1)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringParameterObjectBindingPattern.ts, 24, 6)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringParameterObjectBindingPattern.ts, 24, 21)) + +foo3(robotA); +>foo3 : Symbol(foo3, Decl(sourceMapValidationDestructuringParameterObjectBindingPattern.ts, 15, 1)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringParameterObjectBindingPattern.ts, 8, 3)) + +foo3({ name: "Edger", skill: "cutting edges" }); +>foo3 : Symbol(foo3, Decl(sourceMapValidationDestructuringParameterObjectBindingPattern.ts, 15, 1)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringParameterObjectBindingPattern.ts, 27, 6)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringParameterObjectBindingPattern.ts, 27, 21)) + diff --git a/tests/baselines/reference/sourceMapValidationDestructuringParameterObjectBindingPattern.types b/tests/baselines/reference/sourceMapValidationDestructuringParameterObjectBindingPattern.types new file mode 100644 index 00000000000..6b8f26acf43 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringParameterObjectBindingPattern.types @@ -0,0 +1,113 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringParameterObjectBindingPattern.ts === +interface Robot { +>Robot : Robot + + name: string; +>name : string + + skill: string; +>skill : string +} +declare var console: { +>console : { log(msg: string): void; } + + log(msg: string): void; +>log : (msg: string) => void +>msg : string +} +var hello = "hello"; +>hello : string +>"hello" : string + +var robotA: Robot = { name: "mower", skill: "mowing" }; +>robotA : Robot +>Robot : Robot +>{ name: "mower", skill: "mowing" } : { name: string; skill: string; } +>name : string +>"mower" : string +>skill : string +>"mowing" : string + +function foo1({ name: nameA }: Robot) { +>foo1 : ({name: nameA}: Robot) => void +>name : any +>nameA : string +>Robot : Robot + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: string) => void +>console : { log(msg: string): void; } +>log : (msg: string) => void +>nameA : string +} +function foo2({ name: nameB, skill: skillB }: Robot) { +>foo2 : ({name: nameB, skill: skillB}: Robot) => void +>name : any +>nameB : string +>skill : any +>skillB : string +>Robot : Robot + + console.log(nameB); +>console.log(nameB) : void +>console.log : (msg: string) => void +>console : { log(msg: string): void; } +>log : (msg: string) => void +>nameB : string +} +function foo3({ name }: Robot) { +>foo3 : ({name}: Robot) => void +>name : string +>Robot : Robot + + console.log(name); +>console.log(name) : void +>console.log : (msg: string) => void +>console : { log(msg: string): void; } +>log : (msg: string) => void +>name : string +} + +foo1(robotA); +>foo1(robotA) : void +>foo1 : ({name: nameA}: Robot) => void +>robotA : Robot + +foo1({ name: "Edger", skill: "cutting edges" }); +>foo1({ name: "Edger", skill: "cutting edges" }) : void +>foo1 : ({name: nameA}: Robot) => void +>{ name: "Edger", skill: "cutting edges" } : { name: string; skill: string; } +>name : string +>"Edger" : string +>skill : string +>"cutting edges" : string + +foo2(robotA); +>foo2(robotA) : void +>foo2 : ({name: nameB, skill: skillB}: Robot) => void +>robotA : Robot + +foo2({ name: "Edger", skill: "cutting edges" }); +>foo2({ name: "Edger", skill: "cutting edges" }) : void +>foo2 : ({name: nameB, skill: skillB}: Robot) => void +>{ name: "Edger", skill: "cutting edges" } : { name: string; skill: string; } +>name : string +>"Edger" : string +>skill : string +>"cutting edges" : string + +foo3(robotA); +>foo3(robotA) : void +>foo3 : ({name}: Robot) => void +>robotA : Robot + +foo3({ name: "Edger", skill: "cutting edges" }); +>foo3({ name: "Edger", skill: "cutting edges" }) : void +>foo3 : ({name}: Robot) => void +>{ name: "Edger", skill: "cutting edges" } : { name: string; skill: string; } +>name : string +>"Edger" : string +>skill : string +>"cutting edges" : string + diff --git a/tests/baselines/reference/sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.js b/tests/baselines/reference/sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.js new file mode 100644 index 00000000000..9fd269c62cc --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.js @@ -0,0 +1,53 @@ +//// [sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.ts] +interface Robot { + name?: string; + skill?: string; +} +declare var console: { + log(msg: string): void; +} +var hello = "hello"; +var robotA: Robot = { name: "mower", skill: "mowing" }; + +function foo1({ name: nameA = "" }: Robot = { }) { + console.log(nameA); +} +function foo2({ name: nameB = "", skill: skillB = "noSkill" }: Robot = {}) { + console.log(nameB); +} +function foo3({ name = "" }: Robot = {}) { + console.log(name); +} + +foo1(robotA); +foo1({ name: "Edger", skill: "cutting edges" }); + +foo2(robotA); +foo2({ name: "Edger", skill: "cutting edges" }); + +foo3(robotA); +foo3({ name: "Edger", skill: "cutting edges" }); + + +//// [sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.js] +var hello = "hello"; +var robotA = { name: "mower", skill: "mowing" }; +function foo1(_a) { + var _b = (_a === void 0 ? {} : _a).name, nameA = _b === void 0 ? "" : _b; + console.log(nameA); +} +function foo2(_a) { + var _b = _a === void 0 ? {} : _a, _c = _b.name, nameB = _c === void 0 ? "" : _c, _d = _b.skill, skillB = _d === void 0 ? "noSkill" : _d; + console.log(nameB); +} +function foo3(_a) { + var _b = (_a === void 0 ? {} : _a).name, name = _b === void 0 ? "" : _b; + console.log(name); +} +foo1(robotA); +foo1({ name: "Edger", skill: "cutting edges" }); +foo2(robotA); +foo2({ name: "Edger", skill: "cutting edges" }); +foo3(robotA); +foo3({ name: "Edger", skill: "cutting edges" }); +//# sourceMappingURL=sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.js.map b/tests/baselines/reference/sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.js.map new file mode 100644 index 00000000000..ddf41d9e59f --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.js.map @@ -0,0 +1,2 @@ +//// [sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.js.map] +{"version":3,"file":"sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.js","sourceRoot":"","sources":["sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.ts"],"names":[],"mappings":"AAOA,IAAI,KAAK,GAAG,OAAO,CAAC;AACpB,IAAI,MAAM,GAAU,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;AAEvD,cAAc,EAAyC;QAAvC,mCAAwB,EAAxB,uCAAwB;IACpC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AACD,cAAc,EAAmE;QAAnE,4BAAmE,EAAjE,YAAwB,EAAxB,uCAAwB,EAAE,aAAyB,EAAzB,uCAAyB;IAC/D,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AACD,cAAc,EAAiC;QAA/B,mCAAiB,EAAjB,sCAAiB;IAC7B,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACtB,CAAC;AAED,IAAI,CAAC,MAAM,CAAC,CAAC;AACb,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE,CAAC,CAAC;AAEhD,IAAI,CAAC,MAAM,CAAC,CAAC;AACb,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE,CAAC,CAAC;AAEhD,IAAI,CAAC,MAAM,CAAC,CAAC;AACb,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE,CAAC,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.sourcemap.txt b/tests/baselines/reference/sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.sourcemap.txt new file mode 100644 index 00000000000..555bc560797 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.sourcemap.txt @@ -0,0 +1,500 @@ +=================================================================== +JsFile: sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.js +mapUrl: sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.js.map +sourceRoot: +sources: sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.js +sourceFile:sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.ts +------------------------------------------------------------------- +>>>var hello = "hello"; +1 > +2 >^^^^ +3 > ^^^^^ +4 > ^^^ +5 > ^^^^^^^ +6 > ^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 >interface Robot { + > name?: string; + > skill?: string; + >} + >declare var console: { + > log(msg: string): void; + >} + > +2 >var +3 > hello +4 > = +5 > "hello" +6 > ; +1 >Emitted(1, 1) Source(8, 1) + SourceIndex(0) +2 >Emitted(1, 5) Source(8, 5) + SourceIndex(0) +3 >Emitted(1, 10) Source(8, 10) + SourceIndex(0) +4 >Emitted(1, 13) Source(8, 13) + SourceIndex(0) +5 >Emitted(1, 20) Source(8, 20) + SourceIndex(0) +6 >Emitted(1, 21) Source(8, 21) + SourceIndex(0) +--- +>>>var robotA = { name: "mower", skill: "mowing" }; +1-> +2 >^^^^ +3 > ^^^^^^ +4 > ^^^ +5 > ^^ +6 > ^^^^ +7 > ^^ +8 > ^^^^^^^ +9 > ^^ +10> ^^^^^ +11> ^^ +12> ^^^^^^^^ +13> ^^ +14> ^ +1-> + > +2 >var +3 > robotA +4 > : Robot = +5 > { +6 > name +7 > : +8 > "mower" +9 > , +10> skill +11> : +12> "mowing" +13> } +14> ; +1->Emitted(2, 1) Source(9, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(9, 5) + SourceIndex(0) +3 >Emitted(2, 11) Source(9, 11) + SourceIndex(0) +4 >Emitted(2, 14) Source(9, 21) + SourceIndex(0) +5 >Emitted(2, 16) Source(9, 23) + SourceIndex(0) +6 >Emitted(2, 20) Source(9, 27) + SourceIndex(0) +7 >Emitted(2, 22) Source(9, 29) + SourceIndex(0) +8 >Emitted(2, 29) Source(9, 36) + SourceIndex(0) +9 >Emitted(2, 31) Source(9, 38) + SourceIndex(0) +10>Emitted(2, 36) Source(9, 43) + SourceIndex(0) +11>Emitted(2, 38) Source(9, 45) + SourceIndex(0) +12>Emitted(2, 46) Source(9, 53) + SourceIndex(0) +13>Emitted(2, 48) Source(9, 55) + SourceIndex(0) +14>Emitted(2, 49) Source(9, 56) + SourceIndex(0) +--- +>>>function foo1(_a) { +1 > +2 >^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > + > +2 >function foo1( +3 > { name: nameA = "" }: Robot = { } +1 >Emitted(3, 1) Source(11, 1) + SourceIndex(0) +2 >Emitted(3, 15) Source(11, 15) + SourceIndex(0) +3 >Emitted(3, 17) Source(11, 56) + SourceIndex(0) +--- +>>> var _b = (_a === void 0 ? {} : _a).name, nameA = _b === void 0 ? "" : _b; +1->^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > name: nameA = "" +3 > +4 > name: nameA = "" +1->Emitted(4, 9) Source(11, 17) + SourceIndex(0) +2 >Emitted(4, 44) Source(11, 41) + SourceIndex(0) +3 >Emitted(4, 46) Source(11, 17) + SourceIndex(0) +4 >Emitted(4, 85) Source(11, 41) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > }: Robot = { }) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(5, 5) Source(12, 5) + SourceIndex(0) +2 >Emitted(5, 12) Source(12, 12) + SourceIndex(0) +3 >Emitted(5, 13) Source(12, 13) + SourceIndex(0) +4 >Emitted(5, 16) Source(12, 16) + SourceIndex(0) +5 >Emitted(5, 17) Source(12, 17) + SourceIndex(0) +6 >Emitted(5, 22) Source(12, 22) + SourceIndex(0) +7 >Emitted(5, 23) Source(12, 23) + SourceIndex(0) +8 >Emitted(5, 24) Source(12, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(6, 1) Source(13, 1) + SourceIndex(0) +2 >Emitted(6, 2) Source(13, 2) + SourceIndex(0) +--- +>>>function foo2(_a) { +1-> +2 >^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >function foo2( +3 > { name: nameB = "", skill: skillB = "noSkill" }: Robot = {} +1->Emitted(7, 1) Source(14, 1) + SourceIndex(0) +2 >Emitted(7, 15) Source(14, 15) + SourceIndex(0) +3 >Emitted(7, 17) Source(14, 82) + SourceIndex(0) +--- +>>> var _b = _a === void 0 ? {} : _a, _c = _b.name, nameB = _c === void 0 ? "" : _c, _d = _b.skill, skillB = _d === void 0 ? "noSkill" : _d; +1->^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > { name: nameB = "", skill: skillB = "noSkill" }: Robot = {} +3 > +4 > name: nameB = "" +5 > +6 > name: nameB = "" +7 > , +8 > skill: skillB = "noSkill" +9 > +10> skill: skillB = "noSkill" +1->Emitted(8, 9) Source(14, 15) + SourceIndex(0) +2 >Emitted(8, 37) Source(14, 82) + SourceIndex(0) +3 >Emitted(8, 39) Source(14, 17) + SourceIndex(0) +4 >Emitted(8, 51) Source(14, 41) + SourceIndex(0) +5 >Emitted(8, 53) Source(14, 17) + SourceIndex(0) +6 >Emitted(8, 92) Source(14, 41) + SourceIndex(0) +7 >Emitted(8, 94) Source(14, 43) + SourceIndex(0) +8 >Emitted(8, 107) Source(14, 68) + SourceIndex(0) +9 >Emitted(8, 109) Source(14, 43) + SourceIndex(0) +10>Emitted(8, 148) Source(14, 68) + SourceIndex(0) +--- +>>> console.log(nameB); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 > }: Robot = {}) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameB +7 > ) +8 > ; +1 >Emitted(9, 5) Source(15, 5) + SourceIndex(0) +2 >Emitted(9, 12) Source(15, 12) + SourceIndex(0) +3 >Emitted(9, 13) Source(15, 13) + SourceIndex(0) +4 >Emitted(9, 16) Source(15, 16) + SourceIndex(0) +5 >Emitted(9, 17) Source(15, 17) + SourceIndex(0) +6 >Emitted(9, 22) Source(15, 22) + SourceIndex(0) +7 >Emitted(9, 23) Source(15, 23) + SourceIndex(0) +8 >Emitted(9, 24) Source(15, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(10, 1) Source(16, 1) + SourceIndex(0) +2 >Emitted(10, 2) Source(16, 2) + SourceIndex(0) +--- +>>>function foo3(_a) { +1-> +2 >^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >function foo3( +3 > { name = "" }: Robot = {} +1->Emitted(11, 1) Source(17, 1) + SourceIndex(0) +2 >Emitted(11, 15) Source(17, 15) + SourceIndex(0) +3 >Emitted(11, 17) Source(17, 48) + SourceIndex(0) +--- +>>> var _b = (_a === void 0 ? {} : _a).name, name = _b === void 0 ? "" : _b; +1->^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > name = "" +3 > +4 > name = "" +1->Emitted(12, 9) Source(17, 17) + SourceIndex(0) +2 >Emitted(12, 44) Source(17, 34) + SourceIndex(0) +3 >Emitted(12, 46) Source(17, 17) + SourceIndex(0) +4 >Emitted(12, 84) Source(17, 34) + SourceIndex(0) +--- +>>> console.log(name); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^ +7 > ^ +8 > ^ +1 > }: Robot = {}) { + > +2 > console +3 > . +4 > log +5 > ( +6 > name +7 > ) +8 > ; +1 >Emitted(13, 5) Source(18, 5) + SourceIndex(0) +2 >Emitted(13, 12) Source(18, 12) + SourceIndex(0) +3 >Emitted(13, 13) Source(18, 13) + SourceIndex(0) +4 >Emitted(13, 16) Source(18, 16) + SourceIndex(0) +5 >Emitted(13, 17) Source(18, 17) + SourceIndex(0) +6 >Emitted(13, 21) Source(18, 21) + SourceIndex(0) +7 >Emitted(13, 22) Source(18, 22) + SourceIndex(0) +8 >Emitted(13, 23) Source(18, 23) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(14, 1) Source(19, 1) + SourceIndex(0) +2 >Emitted(14, 2) Source(19, 2) + SourceIndex(0) +--- +>>>foo1(robotA); +1-> +2 >^^^^ +3 > ^ +4 > ^^^^^^ +5 > ^ +6 > ^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > + > +2 >foo1 +3 > ( +4 > robotA +5 > ) +6 > ; +1->Emitted(15, 1) Source(21, 1) + SourceIndex(0) +2 >Emitted(15, 5) Source(21, 5) + SourceIndex(0) +3 >Emitted(15, 6) Source(21, 6) + SourceIndex(0) +4 >Emitted(15, 12) Source(21, 12) + SourceIndex(0) +5 >Emitted(15, 13) Source(21, 13) + SourceIndex(0) +6 >Emitted(15, 14) Source(21, 14) + SourceIndex(0) +--- +>>>foo1({ name: "Edger", skill: "cutting edges" }); +1-> +2 >^^^^ +3 > ^ +4 > ^^ +5 > ^^^^ +6 > ^^ +7 > ^^^^^^^ +8 > ^^ +9 > ^^^^^ +10> ^^ +11> ^^^^^^^^^^^^^^^ +12> ^^ +13> ^ +14> ^ +1-> + > +2 >foo1 +3 > ( +4 > { +5 > name +6 > : +7 > "Edger" +8 > , +9 > skill +10> : +11> "cutting edges" +12> } +13> ) +14> ; +1->Emitted(16, 1) Source(22, 1) + SourceIndex(0) +2 >Emitted(16, 5) Source(22, 5) + SourceIndex(0) +3 >Emitted(16, 6) Source(22, 6) + SourceIndex(0) +4 >Emitted(16, 8) Source(22, 8) + SourceIndex(0) +5 >Emitted(16, 12) Source(22, 12) + SourceIndex(0) +6 >Emitted(16, 14) Source(22, 14) + SourceIndex(0) +7 >Emitted(16, 21) Source(22, 21) + SourceIndex(0) +8 >Emitted(16, 23) Source(22, 23) + SourceIndex(0) +9 >Emitted(16, 28) Source(22, 28) + SourceIndex(0) +10>Emitted(16, 30) Source(22, 30) + SourceIndex(0) +11>Emitted(16, 45) Source(22, 45) + SourceIndex(0) +12>Emitted(16, 47) Source(22, 47) + SourceIndex(0) +13>Emitted(16, 48) Source(22, 48) + SourceIndex(0) +14>Emitted(16, 49) Source(22, 49) + SourceIndex(0) +--- +>>>foo2(robotA); +1 > +2 >^^^^ +3 > ^ +4 > ^^^^^^ +5 > ^ +6 > ^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > + > +2 >foo2 +3 > ( +4 > robotA +5 > ) +6 > ; +1 >Emitted(17, 1) Source(24, 1) + SourceIndex(0) +2 >Emitted(17, 5) Source(24, 5) + SourceIndex(0) +3 >Emitted(17, 6) Source(24, 6) + SourceIndex(0) +4 >Emitted(17, 12) Source(24, 12) + SourceIndex(0) +5 >Emitted(17, 13) Source(24, 13) + SourceIndex(0) +6 >Emitted(17, 14) Source(24, 14) + SourceIndex(0) +--- +>>>foo2({ name: "Edger", skill: "cutting edges" }); +1-> +2 >^^^^ +3 > ^ +4 > ^^ +5 > ^^^^ +6 > ^^ +7 > ^^^^^^^ +8 > ^^ +9 > ^^^^^ +10> ^^ +11> ^^^^^^^^^^^^^^^ +12> ^^ +13> ^ +14> ^ +1-> + > +2 >foo2 +3 > ( +4 > { +5 > name +6 > : +7 > "Edger" +8 > , +9 > skill +10> : +11> "cutting edges" +12> } +13> ) +14> ; +1->Emitted(18, 1) Source(25, 1) + SourceIndex(0) +2 >Emitted(18, 5) Source(25, 5) + SourceIndex(0) +3 >Emitted(18, 6) Source(25, 6) + SourceIndex(0) +4 >Emitted(18, 8) Source(25, 8) + SourceIndex(0) +5 >Emitted(18, 12) Source(25, 12) + SourceIndex(0) +6 >Emitted(18, 14) Source(25, 14) + SourceIndex(0) +7 >Emitted(18, 21) Source(25, 21) + SourceIndex(0) +8 >Emitted(18, 23) Source(25, 23) + SourceIndex(0) +9 >Emitted(18, 28) Source(25, 28) + SourceIndex(0) +10>Emitted(18, 30) Source(25, 30) + SourceIndex(0) +11>Emitted(18, 45) Source(25, 45) + SourceIndex(0) +12>Emitted(18, 47) Source(25, 47) + SourceIndex(0) +13>Emitted(18, 48) Source(25, 48) + SourceIndex(0) +14>Emitted(18, 49) Source(25, 49) + SourceIndex(0) +--- +>>>foo3(robotA); +1 > +2 >^^^^ +3 > ^ +4 > ^^^^^^ +5 > ^ +6 > ^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > + > +2 >foo3 +3 > ( +4 > robotA +5 > ) +6 > ; +1 >Emitted(19, 1) Source(27, 1) + SourceIndex(0) +2 >Emitted(19, 5) Source(27, 5) + SourceIndex(0) +3 >Emitted(19, 6) Source(27, 6) + SourceIndex(0) +4 >Emitted(19, 12) Source(27, 12) + SourceIndex(0) +5 >Emitted(19, 13) Source(27, 13) + SourceIndex(0) +6 >Emitted(19, 14) Source(27, 14) + SourceIndex(0) +--- +>>>foo3({ name: "Edger", skill: "cutting edges" }); +1-> +2 >^^^^ +3 > ^ +4 > ^^ +5 > ^^^^ +6 > ^^ +7 > ^^^^^^^ +8 > ^^ +9 > ^^^^^ +10> ^^ +11> ^^^^^^^^^^^^^^^ +12> ^^ +13> ^ +14> ^ +15> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >foo3 +3 > ( +4 > { +5 > name +6 > : +7 > "Edger" +8 > , +9 > skill +10> : +11> "cutting edges" +12> } +13> ) +14> ; +1->Emitted(20, 1) Source(28, 1) + SourceIndex(0) +2 >Emitted(20, 5) Source(28, 5) + SourceIndex(0) +3 >Emitted(20, 6) Source(28, 6) + SourceIndex(0) +4 >Emitted(20, 8) Source(28, 8) + SourceIndex(0) +5 >Emitted(20, 12) Source(28, 12) + SourceIndex(0) +6 >Emitted(20, 14) Source(28, 14) + SourceIndex(0) +7 >Emitted(20, 21) Source(28, 21) + SourceIndex(0) +8 >Emitted(20, 23) Source(28, 23) + SourceIndex(0) +9 >Emitted(20, 28) Source(28, 28) + SourceIndex(0) +10>Emitted(20, 30) Source(28, 30) + SourceIndex(0) +11>Emitted(20, 45) Source(28, 45) + SourceIndex(0) +12>Emitted(20, 47) Source(28, 47) + SourceIndex(0) +13>Emitted(20, 48) Source(28, 48) + SourceIndex(0) +14>Emitted(20, 49) Source(28, 49) + SourceIndex(0) +--- +>>>//# sourceMappingURL=sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.symbols b/tests/baselines/reference/sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.symbols new file mode 100644 index 00000000000..4f33517fe00 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.symbols @@ -0,0 +1,91 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.ts === +interface Robot { +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.ts, 0, 0)) + + name?: string; +>name : Symbol(Robot.name, Decl(sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.ts, 0, 17)) + + skill?: string; +>skill : Symbol(Robot.skill, Decl(sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.ts, 1, 18)) +} +declare var console: { +>console : Symbol(console, Decl(sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.ts, 4, 11)) + + log(msg: string): void; +>log : Symbol(log, Decl(sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.ts, 4, 22)) +>msg : Symbol(msg, Decl(sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.ts, 5, 8)) +} +var hello = "hello"; +>hello : Symbol(hello, Decl(sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.ts, 7, 3)) + +var robotA: Robot = { name: "mower", skill: "mowing" }; +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.ts, 8, 3)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.ts, 0, 0)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.ts, 8, 21)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.ts, 8, 36)) + +function foo1({ name: nameA = "" }: Robot = { }) { +>foo1 : Symbol(foo1, Decl(sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.ts, 8, 55)) +>name : Symbol(Robot.name, Decl(sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.ts, 0, 17)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.ts, 10, 15)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.ts, 0, 0)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.ts, 4, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.ts, 4, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.ts, 4, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.ts, 10, 15)) +} +function foo2({ name: nameB = "", skill: skillB = "noSkill" }: Robot = {}) { +>foo2 : Symbol(foo2, Decl(sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.ts, 12, 1)) +>name : Symbol(Robot.name, Decl(sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.ts, 0, 17)) +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.ts, 13, 15)) +>skill : Symbol(Robot.skill, Decl(sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.ts, 1, 18)) +>skillB : Symbol(skillB, Decl(sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.ts, 13, 41)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.ts, 0, 0)) + + console.log(nameB); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.ts, 4, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.ts, 4, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.ts, 4, 22)) +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.ts, 13, 15)) +} +function foo3({ name = "" }: Robot = {}) { +>foo3 : Symbol(foo3, Decl(sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.ts, 15, 1)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.ts, 16, 15)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.ts, 0, 0)) + + console.log(name); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.ts, 4, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.ts, 4, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.ts, 4, 22)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.ts, 16, 15)) +} + +foo1(robotA); +>foo1 : Symbol(foo1, Decl(sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.ts, 8, 55)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.ts, 8, 3)) + +foo1({ name: "Edger", skill: "cutting edges" }); +>foo1 : Symbol(foo1, Decl(sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.ts, 8, 55)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.ts, 21, 6)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.ts, 21, 21)) + +foo2(robotA); +>foo2 : Symbol(foo2, Decl(sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.ts, 12, 1)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.ts, 8, 3)) + +foo2({ name: "Edger", skill: "cutting edges" }); +>foo2 : Symbol(foo2, Decl(sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.ts, 12, 1)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.ts, 24, 6)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.ts, 24, 21)) + +foo3(robotA); +>foo3 : Symbol(foo3, Decl(sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.ts, 15, 1)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.ts, 8, 3)) + +foo3({ name: "Edger", skill: "cutting edges" }); +>foo3 : Symbol(foo3, Decl(sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.ts, 15, 1)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.ts, 27, 6)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.ts, 27, 21)) + diff --git a/tests/baselines/reference/sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.types b/tests/baselines/reference/sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.types new file mode 100644 index 00000000000..253c5feae8f --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.types @@ -0,0 +1,120 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.ts === +interface Robot { +>Robot : Robot + + name?: string; +>name : string + + skill?: string; +>skill : string +} +declare var console: { +>console : { log(msg: string): void; } + + log(msg: string): void; +>log : (msg: string) => void +>msg : string +} +var hello = "hello"; +>hello : string +>"hello" : string + +var robotA: Robot = { name: "mower", skill: "mowing" }; +>robotA : Robot +>Robot : Robot +>{ name: "mower", skill: "mowing" } : { name: string; skill: string; } +>name : string +>"mower" : string +>skill : string +>"mowing" : string + +function foo1({ name: nameA = "" }: Robot = { }) { +>foo1 : ({name: nameA}?: Robot) => void +>name : any +>nameA : string +>"" : string +>Robot : Robot +>{ } : {} + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: string) => void +>console : { log(msg: string): void; } +>log : (msg: string) => void +>nameA : string +} +function foo2({ name: nameB = "", skill: skillB = "noSkill" }: Robot = {}) { +>foo2 : ({name: nameB, skill: skillB}?: Robot) => void +>name : any +>nameB : string +>"" : string +>skill : any +>skillB : string +>"noSkill" : string +>Robot : Robot +>{} : {} + + console.log(nameB); +>console.log(nameB) : void +>console.log : (msg: string) => void +>console : { log(msg: string): void; } +>log : (msg: string) => void +>nameB : string +} +function foo3({ name = "" }: Robot = {}) { +>foo3 : ({name}?: Robot) => void +>name : string +>"" : string +>Robot : Robot +>{} : {} + + console.log(name); +>console.log(name) : void +>console.log : (msg: string) => void +>console : { log(msg: string): void; } +>log : (msg: string) => void +>name : string +} + +foo1(robotA); +>foo1(robotA) : void +>foo1 : ({name: nameA}?: Robot) => void +>robotA : Robot + +foo1({ name: "Edger", skill: "cutting edges" }); +>foo1({ name: "Edger", skill: "cutting edges" }) : void +>foo1 : ({name: nameA}?: Robot) => void +>{ name: "Edger", skill: "cutting edges" } : { name: string; skill: string; } +>name : string +>"Edger" : string +>skill : string +>"cutting edges" : string + +foo2(robotA); +>foo2(robotA) : void +>foo2 : ({name: nameB, skill: skillB}?: Robot) => void +>robotA : Robot + +foo2({ name: "Edger", skill: "cutting edges" }); +>foo2({ name: "Edger", skill: "cutting edges" }) : void +>foo2 : ({name: nameB, skill: skillB}?: Robot) => void +>{ name: "Edger", skill: "cutting edges" } : { name: string; skill: string; } +>name : string +>"Edger" : string +>skill : string +>"cutting edges" : string + +foo3(robotA); +>foo3(robotA) : void +>foo3 : ({name}?: Robot) => void +>robotA : Robot + +foo3({ name: "Edger", skill: "cutting edges" }); +>foo3({ name: "Edger", skill: "cutting edges" }) : void +>foo3 : ({name}?: Robot) => void +>{ name: "Edger", skill: "cutting edges" } : { name: string; skill: string; } +>name : string +>"Edger" : string +>skill : string +>"cutting edges" : string + diff --git a/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPattern.js b/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPattern.js new file mode 100644 index 00000000000..faa7b8dcde9 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPattern.js @@ -0,0 +1,62 @@ +//// [sourceMapValidationDestructuringParametertArrayBindingPattern.ts] +declare var console: { + log(msg: any): void; +} +type Robot = [number, string, string]; +var robotA: Robot = [1, "mower", "mowing"]; + +function foo1([, nameA]: Robot) { + console.log(nameA); +} + +function foo2([numberB]: Robot) { + console.log(numberB); +} + +function foo3([numberA2, nameA2, skillA2]: Robot) { + console.log(nameA2); +} + +function foo4([numberA3, ...robotAInfo]: Robot) { + console.log(robotAInfo); +} + +foo1(robotA); +foo1([2, "trimmer", "trimming"]); + +foo2(robotA); +foo2([2, "trimmer", "trimming"]); + +foo3(robotA); +foo3([2, "trimmer", "trimming"]); + +foo4(robotA); +foo4([2, "trimmer", "trimming"]); + +//// [sourceMapValidationDestructuringParametertArrayBindingPattern.js] +var robotA = [1, "mower", "mowing"]; +function foo1(_a) { + var nameA = _a[1]; + console.log(nameA); +} +function foo2(_a) { + var numberB = _a[0]; + console.log(numberB); +} +function foo3(_a) { + var numberA2 = _a[0], nameA2 = _a[1], skillA2 = _a[2]; + console.log(nameA2); +} +function foo4(_a) { + var numberA3 = _a[0], robotAInfo = _a.slice(1); + console.log(robotAInfo); +} +foo1(robotA); +foo1([2, "trimmer", "trimming"]); +foo2(robotA); +foo2([2, "trimmer", "trimming"]); +foo3(robotA); +foo3([2, "trimmer", "trimming"]); +foo4(robotA); +foo4([2, "trimmer", "trimming"]); +//# sourceMappingURL=sourceMapValidationDestructuringParametertArrayBindingPattern.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPattern.js.map b/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPattern.js.map new file mode 100644 index 00000000000..246a2da30a4 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPattern.js.map @@ -0,0 +1,2 @@ +//// [sourceMapValidationDestructuringParametertArrayBindingPattern.js.map] +{"version":3,"file":"sourceMapValidationDestructuringParametertArrayBindingPattern.js","sourceRoot":"","sources":["sourceMapValidationDestructuringParametertArrayBindingPattern.ts"],"names":[],"mappings":"AAIA,IAAI,MAAM,GAAU,CAAC,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;AAE3C,cAAc,EAAgB;QAAb,aAAK;IAClB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AAED,cAAc,EAAgB;QAAf,eAAO;IAClB,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AACzB,CAAC;AAED,cAAc,EAAkC;QAAjC,gBAAQ,EAAE,cAAM,EAAE,eAAO;IACpC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACxB,CAAC;AAED,cAAc,EAAgC;QAA/B,gBAAQ,EAAE,wBAAa;IAClC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;AAC5B,CAAC;AAED,IAAI,CAAC,MAAM,CAAC,CAAC;AACb,IAAI,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC;AAEjC,IAAI,CAAC,MAAM,CAAC,CAAC;AACb,IAAI,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC;AAEjC,IAAI,CAAC,MAAM,CAAC,CAAC;AACb,IAAI,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC;AAEjC,IAAI,CAAC,MAAM,CAAC,CAAC;AACb,IAAI,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPattern.sourcemap.txt b/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPattern.sourcemap.txt new file mode 100644 index 00000000000..098cb5058a1 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPattern.sourcemap.txt @@ -0,0 +1,558 @@ +=================================================================== +JsFile: sourceMapValidationDestructuringParametertArrayBindingPattern.js +mapUrl: sourceMapValidationDestructuringParametertArrayBindingPattern.js.map +sourceRoot: +sources: sourceMapValidationDestructuringParametertArrayBindingPattern.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/sourceMapValidationDestructuringParametertArrayBindingPattern.js +sourceFile:sourceMapValidationDestructuringParametertArrayBindingPattern.ts +------------------------------------------------------------------- +>>>var robotA = [1, "mower", "mowing"]; +1 > +2 >^^^^ +3 > ^^^^^^ +4 > ^^^ +5 > ^ +6 > ^ +7 > ^^ +8 > ^^^^^^^ +9 > ^^ +10> ^^^^^^^^ +11> ^ +12> ^ +1 >declare var console: { + > log(msg: any): void; + >} + >type Robot = [number, string, string]; + > +2 >var +3 > robotA +4 > : Robot = +5 > [ +6 > 1 +7 > , +8 > "mower" +9 > , +10> "mowing" +11> ] +12> ; +1 >Emitted(1, 1) Source(5, 1) + SourceIndex(0) +2 >Emitted(1, 5) Source(5, 5) + SourceIndex(0) +3 >Emitted(1, 11) Source(5, 11) + SourceIndex(0) +4 >Emitted(1, 14) Source(5, 21) + SourceIndex(0) +5 >Emitted(1, 15) Source(5, 22) + SourceIndex(0) +6 >Emitted(1, 16) Source(5, 23) + SourceIndex(0) +7 >Emitted(1, 18) Source(5, 25) + SourceIndex(0) +8 >Emitted(1, 25) Source(5, 32) + SourceIndex(0) +9 >Emitted(1, 27) Source(5, 34) + SourceIndex(0) +10>Emitted(1, 35) Source(5, 42) + SourceIndex(0) +11>Emitted(1, 36) Source(5, 43) + SourceIndex(0) +12>Emitted(1, 37) Source(5, 44) + SourceIndex(0) +--- +>>>function foo1(_a) { +1 > +2 >^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^-> +1 > + > + > +2 >function foo1( +3 > [, nameA]: Robot +1 >Emitted(2, 1) Source(7, 1) + SourceIndex(0) +2 >Emitted(2, 15) Source(7, 15) + SourceIndex(0) +3 >Emitted(2, 17) Source(7, 31) + SourceIndex(0) +--- +>>> var nameA = _a[1]; +1->^^^^^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^^-> +1-> +2 > nameA +1->Emitted(3, 9) Source(7, 18) + SourceIndex(0) +2 >Emitted(3, 22) Source(7, 23) + SourceIndex(0) +--- +>>> console.log(nameA); +1->^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1->]: Robot) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1->Emitted(4, 5) Source(8, 5) + SourceIndex(0) +2 >Emitted(4, 12) Source(8, 12) + SourceIndex(0) +3 >Emitted(4, 13) Source(8, 13) + SourceIndex(0) +4 >Emitted(4, 16) Source(8, 16) + SourceIndex(0) +5 >Emitted(4, 17) Source(8, 17) + SourceIndex(0) +6 >Emitted(4, 22) Source(8, 22) + SourceIndex(0) +7 >Emitted(4, 23) Source(8, 23) + SourceIndex(0) +8 >Emitted(4, 24) Source(8, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(5, 1) Source(9, 1) + SourceIndex(0) +2 >Emitted(5, 2) Source(9, 2) + SourceIndex(0) +--- +>>>function foo2(_a) { +1-> +2 >^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^-> +1-> + > + > +2 >function foo2( +3 > [numberB]: Robot +1->Emitted(6, 1) Source(11, 1) + SourceIndex(0) +2 >Emitted(6, 15) Source(11, 15) + SourceIndex(0) +3 >Emitted(6, 17) Source(11, 31) + SourceIndex(0) +--- +>>> var numberB = _a[0]; +1->^^^^^^^^ +2 > ^^^^^^^^^^^^^^^ +3 > ^^^-> +1-> +2 > numberB +1->Emitted(7, 9) Source(11, 16) + SourceIndex(0) +2 >Emitted(7, 24) Source(11, 23) + SourceIndex(0) +--- +>>> console.log(numberB); +1->^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^ +7 > ^ +8 > ^ +1->]: Robot) { + > +2 > console +3 > . +4 > log +5 > ( +6 > numberB +7 > ) +8 > ; +1->Emitted(8, 5) Source(12, 5) + SourceIndex(0) +2 >Emitted(8, 12) Source(12, 12) + SourceIndex(0) +3 >Emitted(8, 13) Source(12, 13) + SourceIndex(0) +4 >Emitted(8, 16) Source(12, 16) + SourceIndex(0) +5 >Emitted(8, 17) Source(12, 17) + SourceIndex(0) +6 >Emitted(8, 24) Source(12, 24) + SourceIndex(0) +7 >Emitted(8, 25) Source(12, 25) + SourceIndex(0) +8 >Emitted(8, 26) Source(12, 26) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(9, 1) Source(13, 1) + SourceIndex(0) +2 >Emitted(9, 2) Source(13, 2) + SourceIndex(0) +--- +>>>function foo3(_a) { +1-> +2 >^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > + > +2 >function foo3( +3 > [numberA2, nameA2, skillA2]: Robot +1->Emitted(10, 1) Source(15, 1) + SourceIndex(0) +2 >Emitted(10, 15) Source(15, 15) + SourceIndex(0) +3 >Emitted(10, 17) Source(15, 49) + SourceIndex(0) +--- +>>> var numberA2 = _a[0], nameA2 = _a[1], skillA2 = _a[2]; +1->^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^ +1-> +2 > numberA2 +3 > , +4 > nameA2 +5 > , +6 > skillA2 +1->Emitted(11, 9) Source(15, 16) + SourceIndex(0) +2 >Emitted(11, 25) Source(15, 24) + SourceIndex(0) +3 >Emitted(11, 27) Source(15, 26) + SourceIndex(0) +4 >Emitted(11, 41) Source(15, 32) + SourceIndex(0) +5 >Emitted(11, 43) Source(15, 34) + SourceIndex(0) +6 >Emitted(11, 58) Source(15, 41) + SourceIndex(0) +--- +>>> console.log(nameA2); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^ +7 > ^ +8 > ^ +1 >]: Robot) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA2 +7 > ) +8 > ; +1 >Emitted(12, 5) Source(16, 5) + SourceIndex(0) +2 >Emitted(12, 12) Source(16, 12) + SourceIndex(0) +3 >Emitted(12, 13) Source(16, 13) + SourceIndex(0) +4 >Emitted(12, 16) Source(16, 16) + SourceIndex(0) +5 >Emitted(12, 17) Source(16, 17) + SourceIndex(0) +6 >Emitted(12, 23) Source(16, 23) + SourceIndex(0) +7 >Emitted(12, 24) Source(16, 24) + SourceIndex(0) +8 >Emitted(12, 25) Source(16, 25) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(13, 1) Source(17, 1) + SourceIndex(0) +2 >Emitted(13, 2) Source(17, 2) + SourceIndex(0) +--- +>>>function foo4(_a) { +1-> +2 >^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > + > +2 >function foo4( +3 > [numberA3, ...robotAInfo]: Robot +1->Emitted(14, 1) Source(19, 1) + SourceIndex(0) +2 >Emitted(14, 15) Source(19, 15) + SourceIndex(0) +3 >Emitted(14, 17) Source(19, 47) + SourceIndex(0) +--- +>>> var numberA3 = _a[0], robotAInfo = _a.slice(1); +1->^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > numberA3 +3 > , +4 > ...robotAInfo +1->Emitted(15, 9) Source(19, 16) + SourceIndex(0) +2 >Emitted(15, 25) Source(19, 24) + SourceIndex(0) +3 >Emitted(15, 27) Source(19, 26) + SourceIndex(0) +4 >Emitted(15, 51) Source(19, 39) + SourceIndex(0) +--- +>>> console.log(robotAInfo); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^^^ +7 > ^ +8 > ^ +1 >]: Robot) { + > +2 > console +3 > . +4 > log +5 > ( +6 > robotAInfo +7 > ) +8 > ; +1 >Emitted(16, 5) Source(20, 5) + SourceIndex(0) +2 >Emitted(16, 12) Source(20, 12) + SourceIndex(0) +3 >Emitted(16, 13) Source(20, 13) + SourceIndex(0) +4 >Emitted(16, 16) Source(20, 16) + SourceIndex(0) +5 >Emitted(16, 17) Source(20, 17) + SourceIndex(0) +6 >Emitted(16, 27) Source(20, 27) + SourceIndex(0) +7 >Emitted(16, 28) Source(20, 28) + SourceIndex(0) +8 >Emitted(16, 29) Source(20, 29) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(17, 1) Source(21, 1) + SourceIndex(0) +2 >Emitted(17, 2) Source(21, 2) + SourceIndex(0) +--- +>>>foo1(robotA); +1-> +2 >^^^^ +3 > ^ +4 > ^^^^^^ +5 > ^ +6 > ^ +7 > ^^^^^^^^^^^^^^^^^^^^^-> +1-> + > + > +2 >foo1 +3 > ( +4 > robotA +5 > ) +6 > ; +1->Emitted(18, 1) Source(23, 1) + SourceIndex(0) +2 >Emitted(18, 5) Source(23, 5) + SourceIndex(0) +3 >Emitted(18, 6) Source(23, 6) + SourceIndex(0) +4 >Emitted(18, 12) Source(23, 12) + SourceIndex(0) +5 >Emitted(18, 13) Source(23, 13) + SourceIndex(0) +6 >Emitted(18, 14) Source(23, 14) + SourceIndex(0) +--- +>>>foo1([2, "trimmer", "trimming"]); +1-> +2 >^^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^ +7 > ^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^ +10> ^ +11> ^ +12> ^ +1-> + > +2 >foo1 +3 > ( +4 > [ +5 > 2 +6 > , +7 > "trimmer" +8 > , +9 > "trimming" +10> ] +11> ) +12> ; +1->Emitted(19, 1) Source(24, 1) + SourceIndex(0) +2 >Emitted(19, 5) Source(24, 5) + SourceIndex(0) +3 >Emitted(19, 6) Source(24, 6) + SourceIndex(0) +4 >Emitted(19, 7) Source(24, 7) + SourceIndex(0) +5 >Emitted(19, 8) Source(24, 8) + SourceIndex(0) +6 >Emitted(19, 10) Source(24, 10) + SourceIndex(0) +7 >Emitted(19, 19) Source(24, 19) + SourceIndex(0) +8 >Emitted(19, 21) Source(24, 21) + SourceIndex(0) +9 >Emitted(19, 31) Source(24, 31) + SourceIndex(0) +10>Emitted(19, 32) Source(24, 32) + SourceIndex(0) +11>Emitted(19, 33) Source(24, 33) + SourceIndex(0) +12>Emitted(19, 34) Source(24, 34) + SourceIndex(0) +--- +>>>foo2(robotA); +1 > +2 >^^^^ +3 > ^ +4 > ^^^^^^ +5 > ^ +6 > ^ +7 > ^^^^^^^^^^^^^^^^^^^^^-> +1 > + > + > +2 >foo2 +3 > ( +4 > robotA +5 > ) +6 > ; +1 >Emitted(20, 1) Source(26, 1) + SourceIndex(0) +2 >Emitted(20, 5) Source(26, 5) + SourceIndex(0) +3 >Emitted(20, 6) Source(26, 6) + SourceIndex(0) +4 >Emitted(20, 12) Source(26, 12) + SourceIndex(0) +5 >Emitted(20, 13) Source(26, 13) + SourceIndex(0) +6 >Emitted(20, 14) Source(26, 14) + SourceIndex(0) +--- +>>>foo2([2, "trimmer", "trimming"]); +1-> +2 >^^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^ +7 > ^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^ +10> ^ +11> ^ +12> ^ +1-> + > +2 >foo2 +3 > ( +4 > [ +5 > 2 +6 > , +7 > "trimmer" +8 > , +9 > "trimming" +10> ] +11> ) +12> ; +1->Emitted(21, 1) Source(27, 1) + SourceIndex(0) +2 >Emitted(21, 5) Source(27, 5) + SourceIndex(0) +3 >Emitted(21, 6) Source(27, 6) + SourceIndex(0) +4 >Emitted(21, 7) Source(27, 7) + SourceIndex(0) +5 >Emitted(21, 8) Source(27, 8) + SourceIndex(0) +6 >Emitted(21, 10) Source(27, 10) + SourceIndex(0) +7 >Emitted(21, 19) Source(27, 19) + SourceIndex(0) +8 >Emitted(21, 21) Source(27, 21) + SourceIndex(0) +9 >Emitted(21, 31) Source(27, 31) + SourceIndex(0) +10>Emitted(21, 32) Source(27, 32) + SourceIndex(0) +11>Emitted(21, 33) Source(27, 33) + SourceIndex(0) +12>Emitted(21, 34) Source(27, 34) + SourceIndex(0) +--- +>>>foo3(robotA); +1 > +2 >^^^^ +3 > ^ +4 > ^^^^^^ +5 > ^ +6 > ^ +7 > ^^^^^^^^^^^^^^^^^^^^^-> +1 > + > + > +2 >foo3 +3 > ( +4 > robotA +5 > ) +6 > ; +1 >Emitted(22, 1) Source(29, 1) + SourceIndex(0) +2 >Emitted(22, 5) Source(29, 5) + SourceIndex(0) +3 >Emitted(22, 6) Source(29, 6) + SourceIndex(0) +4 >Emitted(22, 12) Source(29, 12) + SourceIndex(0) +5 >Emitted(22, 13) Source(29, 13) + SourceIndex(0) +6 >Emitted(22, 14) Source(29, 14) + SourceIndex(0) +--- +>>>foo3([2, "trimmer", "trimming"]); +1-> +2 >^^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^ +7 > ^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^ +10> ^ +11> ^ +12> ^ +1-> + > +2 >foo3 +3 > ( +4 > [ +5 > 2 +6 > , +7 > "trimmer" +8 > , +9 > "trimming" +10> ] +11> ) +12> ; +1->Emitted(23, 1) Source(30, 1) + SourceIndex(0) +2 >Emitted(23, 5) Source(30, 5) + SourceIndex(0) +3 >Emitted(23, 6) Source(30, 6) + SourceIndex(0) +4 >Emitted(23, 7) Source(30, 7) + SourceIndex(0) +5 >Emitted(23, 8) Source(30, 8) + SourceIndex(0) +6 >Emitted(23, 10) Source(30, 10) + SourceIndex(0) +7 >Emitted(23, 19) Source(30, 19) + SourceIndex(0) +8 >Emitted(23, 21) Source(30, 21) + SourceIndex(0) +9 >Emitted(23, 31) Source(30, 31) + SourceIndex(0) +10>Emitted(23, 32) Source(30, 32) + SourceIndex(0) +11>Emitted(23, 33) Source(30, 33) + SourceIndex(0) +12>Emitted(23, 34) Source(30, 34) + SourceIndex(0) +--- +>>>foo4(robotA); +1 > +2 >^^^^ +3 > ^ +4 > ^^^^^^ +5 > ^ +6 > ^ +7 > ^^^^^^^^^^^^^^^^^^^^^-> +1 > + > + > +2 >foo4 +3 > ( +4 > robotA +5 > ) +6 > ; +1 >Emitted(24, 1) Source(32, 1) + SourceIndex(0) +2 >Emitted(24, 5) Source(32, 5) + SourceIndex(0) +3 >Emitted(24, 6) Source(32, 6) + SourceIndex(0) +4 >Emitted(24, 12) Source(32, 12) + SourceIndex(0) +5 >Emitted(24, 13) Source(32, 13) + SourceIndex(0) +6 >Emitted(24, 14) Source(32, 14) + SourceIndex(0) +--- +>>>foo4([2, "trimmer", "trimming"]); +1-> +2 >^^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^ +7 > ^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^ +10> ^ +11> ^ +12> ^ +13> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >foo4 +3 > ( +4 > [ +5 > 2 +6 > , +7 > "trimmer" +8 > , +9 > "trimming" +10> ] +11> ) +12> ; +1->Emitted(25, 1) Source(33, 1) + SourceIndex(0) +2 >Emitted(25, 5) Source(33, 5) + SourceIndex(0) +3 >Emitted(25, 6) Source(33, 6) + SourceIndex(0) +4 >Emitted(25, 7) Source(33, 7) + SourceIndex(0) +5 >Emitted(25, 8) Source(33, 8) + SourceIndex(0) +6 >Emitted(25, 10) Source(33, 10) + SourceIndex(0) +7 >Emitted(25, 19) Source(33, 19) + SourceIndex(0) +8 >Emitted(25, 21) Source(33, 21) + SourceIndex(0) +9 >Emitted(25, 31) Source(33, 31) + SourceIndex(0) +10>Emitted(25, 32) Source(33, 32) + SourceIndex(0) +11>Emitted(25, 33) Source(33, 33) + SourceIndex(0) +12>Emitted(25, 34) Source(33, 34) + SourceIndex(0) +--- +>>>//# sourceMappingURL=sourceMapValidationDestructuringParametertArrayBindingPattern.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPattern.symbols b/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPattern.symbols new file mode 100644 index 00000000000..a1370b132c2 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPattern.symbols @@ -0,0 +1,94 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringParametertArrayBindingPattern.ts === +declare var console: { +>console : Symbol(console, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern.ts, 0, 11)) + + log(msg: any): void; +>log : Symbol(log, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern.ts, 0, 22)) +>msg : Symbol(msg, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern.ts, 1, 8)) +} +type Robot = [number, string, string]; +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern.ts, 2, 1)) + +var robotA: Robot = [1, "mower", "mowing"]; +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern.ts, 4, 3)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern.ts, 2, 1)) + +function foo1([, nameA]: Robot) { +>foo1 : Symbol(foo1, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern.ts, 4, 43)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern.ts, 6, 16)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern.ts, 2, 1)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern.ts, 6, 16)) +} + +function foo2([numberB]: Robot) { +>foo2 : Symbol(foo2, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern.ts, 8, 1)) +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern.ts, 10, 15)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern.ts, 2, 1)) + + console.log(numberB); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern.ts, 0, 22)) +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern.ts, 10, 15)) +} + +function foo3([numberA2, nameA2, skillA2]: Robot) { +>foo3 : Symbol(foo3, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern.ts, 12, 1)) +>numberA2 : Symbol(numberA2, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern.ts, 14, 15)) +>nameA2 : Symbol(nameA2, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern.ts, 14, 24)) +>skillA2 : Symbol(skillA2, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern.ts, 14, 32)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern.ts, 2, 1)) + + console.log(nameA2); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern.ts, 0, 22)) +>nameA2 : Symbol(nameA2, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern.ts, 14, 24)) +} + +function foo4([numberA3, ...robotAInfo]: Robot) { +>foo4 : Symbol(foo4, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern.ts, 16, 1)) +>numberA3 : Symbol(numberA3, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern.ts, 18, 15)) +>robotAInfo : Symbol(robotAInfo, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern.ts, 18, 24)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern.ts, 2, 1)) + + console.log(robotAInfo); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern.ts, 0, 22)) +>robotAInfo : Symbol(robotAInfo, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern.ts, 18, 24)) +} + +foo1(robotA); +>foo1 : Symbol(foo1, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern.ts, 4, 43)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern.ts, 4, 3)) + +foo1([2, "trimmer", "trimming"]); +>foo1 : Symbol(foo1, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern.ts, 4, 43)) + +foo2(robotA); +>foo2 : Symbol(foo2, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern.ts, 8, 1)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern.ts, 4, 3)) + +foo2([2, "trimmer", "trimming"]); +>foo2 : Symbol(foo2, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern.ts, 8, 1)) + +foo3(robotA); +>foo3 : Symbol(foo3, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern.ts, 12, 1)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern.ts, 4, 3)) + +foo3([2, "trimmer", "trimming"]); +>foo3 : Symbol(foo3, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern.ts, 12, 1)) + +foo4(robotA); +>foo4 : Symbol(foo4, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern.ts, 16, 1)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern.ts, 4, 3)) + +foo4([2, "trimmer", "trimming"]); +>foo4 : Symbol(foo4, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern.ts, 16, 1)) + diff --git a/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPattern.types b/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPattern.types new file mode 100644 index 00000000000..9c695f1c0dd --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPattern.types @@ -0,0 +1,127 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringParametertArrayBindingPattern.ts === +declare var console: { +>console : { log(msg: any): void; } + + log(msg: any): void; +>log : (msg: any) => void +>msg : any +} +type Robot = [number, string, string]; +>Robot : [number, string, string] + +var robotA: Robot = [1, "mower", "mowing"]; +>robotA : [number, string, string] +>Robot : [number, string, string] +>[1, "mower", "mowing"] : [number, string, string] +>1 : number +>"mower" : string +>"mowing" : string + +function foo1([, nameA]: Robot) { +>foo1 : ([, nameA]: [number, string, string]) => void +> : undefined +>nameA : string +>Robot : [number, string, string] + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} + +function foo2([numberB]: Robot) { +>foo2 : ([numberB]: [number, string, string]) => void +>numberB : number +>Robot : [number, string, string] + + console.log(numberB); +>console.log(numberB) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>numberB : number +} + +function foo3([numberA2, nameA2, skillA2]: Robot) { +>foo3 : ([numberA2, nameA2, skillA2]: [number, string, string]) => void +>numberA2 : number +>nameA2 : string +>skillA2 : string +>Robot : [number, string, string] + + console.log(nameA2); +>console.log(nameA2) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA2 : string +} + +function foo4([numberA3, ...robotAInfo]: Robot) { +>foo4 : ([numberA3, ...robotAInfo]: [number, string, string]) => void +>numberA3 : number +>robotAInfo : (number | string)[] +>Robot : [number, string, string] + + console.log(robotAInfo); +>console.log(robotAInfo) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>robotAInfo : (number | string)[] +} + +foo1(robotA); +>foo1(robotA) : void +>foo1 : ([, nameA]: [number, string, string]) => void +>robotA : [number, string, string] + +foo1([2, "trimmer", "trimming"]); +>foo1([2, "trimmer", "trimming"]) : void +>foo1 : ([, nameA]: [number, string, string]) => void +>[2, "trimmer", "trimming"] : [number, string, string] +>2 : number +>"trimmer" : string +>"trimming" : string + +foo2(robotA); +>foo2(robotA) : void +>foo2 : ([numberB]: [number, string, string]) => void +>robotA : [number, string, string] + +foo2([2, "trimmer", "trimming"]); +>foo2([2, "trimmer", "trimming"]) : void +>foo2 : ([numberB]: [number, string, string]) => void +>[2, "trimmer", "trimming"] : [number, string, string] +>2 : number +>"trimmer" : string +>"trimming" : string + +foo3(robotA); +>foo3(robotA) : void +>foo3 : ([numberA2, nameA2, skillA2]: [number, string, string]) => void +>robotA : [number, string, string] + +foo3([2, "trimmer", "trimming"]); +>foo3([2, "trimmer", "trimming"]) : void +>foo3 : ([numberA2, nameA2, skillA2]: [number, string, string]) => void +>[2, "trimmer", "trimming"] : [number, string, string] +>2 : number +>"trimmer" : string +>"trimming" : string + +foo4(robotA); +>foo4(robotA) : void +>foo4 : ([numberA3, ...robotAInfo]: [number, string, string]) => void +>robotA : [number, string, string] + +foo4([2, "trimmer", "trimming"]); +>foo4([2, "trimmer", "trimming"]) : void +>foo4 : ([numberA3, ...robotAInfo]: [number, string, string]) => void +>[2, "trimmer", "trimming"] : [number, string, string] +>2 : number +>"trimmer" : string +>"trimming" : string + diff --git a/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPattern2.js b/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPattern2.js new file mode 100644 index 00000000000..0aa302e0990 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPattern2.js @@ -0,0 +1,62 @@ +//// [sourceMapValidationDestructuringParametertArrayBindingPattern2.ts] +declare var console: { + log(msg: any): void; +} +type Robot = [string, [string, string]]; +var robotA: Robot = ["trimmer", ["trimming", "edging"]]; + +function foo1([, skillA]: Robot) { + console.log(skillA); +} + +function foo2([nameMB]: Robot) { + console.log(nameMB); +} + +function foo3([nameMA, [primarySkillA, secondarySkillA]]: Robot) { + console.log(nameMA); +} + +function foo4([...multiRobotAInfo]: Robot) { + console.log(multiRobotAInfo); +} + +foo1(robotA); +foo1(["roomba", ["vaccum", "mopping"]]); + +foo2(robotA); +foo2(["roomba", ["vaccum", "mopping"]]); + +foo3(robotA); +foo3(["roomba", ["vaccum", "mopping"]]); + +foo4(robotA); +foo4(["roomba", ["vaccum", "mopping"]]); + +//// [sourceMapValidationDestructuringParametertArrayBindingPattern2.js] +var robotA = ["trimmer", ["trimming", "edging"]]; +function foo1(_a) { + var skillA = _a[1]; + console.log(skillA); +} +function foo2(_a) { + var nameMB = _a[0]; + console.log(nameMB); +} +function foo3(_a) { + var nameMA = _a[0], _b = _a[1], primarySkillA = _b[0], secondarySkillA = _b[1]; + console.log(nameMA); +} +function foo4(_a) { + var multiRobotAInfo = _a.slice(0); + console.log(multiRobotAInfo); +} +foo1(robotA); +foo1(["roomba", ["vaccum", "mopping"]]); +foo2(robotA); +foo2(["roomba", ["vaccum", "mopping"]]); +foo3(robotA); +foo3(["roomba", ["vaccum", "mopping"]]); +foo4(robotA); +foo4(["roomba", ["vaccum", "mopping"]]); +//# sourceMappingURL=sourceMapValidationDestructuringParametertArrayBindingPattern2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPattern2.js.map b/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPattern2.js.map new file mode 100644 index 00000000000..b242ccd9114 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPattern2.js.map @@ -0,0 +1,2 @@ +//// [sourceMapValidationDestructuringParametertArrayBindingPattern2.js.map] +{"version":3,"file":"sourceMapValidationDestructuringParametertArrayBindingPattern2.js","sourceRoot":"","sources":["sourceMapValidationDestructuringParametertArrayBindingPattern2.ts"],"names":[],"mappings":"AAIA,IAAI,MAAM,GAAU,CAAC,SAAS,EAAE,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC,CAAC;AAExD,cAAc,EAAiB;QAAd,cAAM;IACnB,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACxB,CAAC;AAED,cAAc,EAAe;QAAd,cAAM;IACjB,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACxB,CAAC;AAED,cAAc,EAAiD;QAAhD,cAAM,EAAE,UAAgC,EAA/B,qBAAa,EAAE,uBAAe;IAClD,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACxB,CAAC;AAED,cAAc,EAA2B;QAA1B,6BAAkB;IAC7B,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;AACjC,CAAC;AAED,IAAI,CAAC,MAAM,CAAC,CAAC;AACb,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;AAExC,IAAI,CAAC,MAAM,CAAC,CAAC;AACb,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;AAExC,IAAI,CAAC,MAAM,CAAC,CAAC;AACb,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;AAExC,IAAI,CAAC,MAAM,CAAC,CAAC;AACb,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPattern2.sourcemap.txt b/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPattern2.sourcemap.txt new file mode 100644 index 00000000000..491e5025ecd --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPattern2.sourcemap.txt @@ -0,0 +1,588 @@ +=================================================================== +JsFile: sourceMapValidationDestructuringParametertArrayBindingPattern2.js +mapUrl: sourceMapValidationDestructuringParametertArrayBindingPattern2.js.map +sourceRoot: +sources: sourceMapValidationDestructuringParametertArrayBindingPattern2.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/sourceMapValidationDestructuringParametertArrayBindingPattern2.js +sourceFile:sourceMapValidationDestructuringParametertArrayBindingPattern2.ts +------------------------------------------------------------------- +>>>var robotA = ["trimmer", ["trimming", "edging"]]; +1 > +2 >^^^^ +3 > ^^^^^^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^^ +7 > ^^ +8 > ^ +9 > ^^^^^^^^^^ +10> ^^ +11> ^^^^^^^^ +12> ^ +13> ^ +14> ^ +1 >declare var console: { + > log(msg: any): void; + >} + >type Robot = [string, [string, string]]; + > +2 >var +3 > robotA +4 > : Robot = +5 > [ +6 > "trimmer" +7 > , +8 > [ +9 > "trimming" +10> , +11> "edging" +12> ] +13> ] +14> ; +1 >Emitted(1, 1) Source(5, 1) + SourceIndex(0) +2 >Emitted(1, 5) Source(5, 5) + SourceIndex(0) +3 >Emitted(1, 11) Source(5, 11) + SourceIndex(0) +4 >Emitted(1, 14) Source(5, 21) + SourceIndex(0) +5 >Emitted(1, 15) Source(5, 22) + SourceIndex(0) +6 >Emitted(1, 24) Source(5, 31) + SourceIndex(0) +7 >Emitted(1, 26) Source(5, 33) + SourceIndex(0) +8 >Emitted(1, 27) Source(5, 34) + SourceIndex(0) +9 >Emitted(1, 37) Source(5, 44) + SourceIndex(0) +10>Emitted(1, 39) Source(5, 46) + SourceIndex(0) +11>Emitted(1, 47) Source(5, 54) + SourceIndex(0) +12>Emitted(1, 48) Source(5, 55) + SourceIndex(0) +13>Emitted(1, 49) Source(5, 56) + SourceIndex(0) +14>Emitted(1, 50) Source(5, 57) + SourceIndex(0) +--- +>>>function foo1(_a) { +1 > +2 >^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^-> +1 > + > + > +2 >function foo1( +3 > [, skillA]: Robot +1 >Emitted(2, 1) Source(7, 1) + SourceIndex(0) +2 >Emitted(2, 15) Source(7, 15) + SourceIndex(0) +3 >Emitted(2, 17) Source(7, 32) + SourceIndex(0) +--- +>>> var skillA = _a[1]; +1->^^^^^^^^ +2 > ^^^^^^^^^^^^^^ +3 > ^^^-> +1-> +2 > skillA +1->Emitted(3, 9) Source(7, 18) + SourceIndex(0) +2 >Emitted(3, 23) Source(7, 24) + SourceIndex(0) +--- +>>> console.log(skillA); +1->^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^ +7 > ^ +8 > ^ +1->]: Robot) { + > +2 > console +3 > . +4 > log +5 > ( +6 > skillA +7 > ) +8 > ; +1->Emitted(4, 5) Source(8, 5) + SourceIndex(0) +2 >Emitted(4, 12) Source(8, 12) + SourceIndex(0) +3 >Emitted(4, 13) Source(8, 13) + SourceIndex(0) +4 >Emitted(4, 16) Source(8, 16) + SourceIndex(0) +5 >Emitted(4, 17) Source(8, 17) + SourceIndex(0) +6 >Emitted(4, 23) Source(8, 23) + SourceIndex(0) +7 >Emitted(4, 24) Source(8, 24) + SourceIndex(0) +8 >Emitted(4, 25) Source(8, 25) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(5, 1) Source(9, 1) + SourceIndex(0) +2 >Emitted(5, 2) Source(9, 2) + SourceIndex(0) +--- +>>>function foo2(_a) { +1-> +2 >^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^-> +1-> + > + > +2 >function foo2( +3 > [nameMB]: Robot +1->Emitted(6, 1) Source(11, 1) + SourceIndex(0) +2 >Emitted(6, 15) Source(11, 15) + SourceIndex(0) +3 >Emitted(6, 17) Source(11, 30) + SourceIndex(0) +--- +>>> var nameMB = _a[0]; +1->^^^^^^^^ +2 > ^^^^^^^^^^^^^^ +3 > ^^^-> +1-> +2 > nameMB +1->Emitted(7, 9) Source(11, 16) + SourceIndex(0) +2 >Emitted(7, 23) Source(11, 22) + SourceIndex(0) +--- +>>> console.log(nameMB); +1->^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^ +7 > ^ +8 > ^ +1->]: Robot) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameMB +7 > ) +8 > ; +1->Emitted(8, 5) Source(12, 5) + SourceIndex(0) +2 >Emitted(8, 12) Source(12, 12) + SourceIndex(0) +3 >Emitted(8, 13) Source(12, 13) + SourceIndex(0) +4 >Emitted(8, 16) Source(12, 16) + SourceIndex(0) +5 >Emitted(8, 17) Source(12, 17) + SourceIndex(0) +6 >Emitted(8, 23) Source(12, 23) + SourceIndex(0) +7 >Emitted(8, 24) Source(12, 24) + SourceIndex(0) +8 >Emitted(8, 25) Source(12, 25) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(9, 1) Source(13, 1) + SourceIndex(0) +2 >Emitted(9, 2) Source(13, 2) + SourceIndex(0) +--- +>>>function foo3(_a) { +1-> +2 >^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > + > +2 >function foo3( +3 > [nameMA, [primarySkillA, secondarySkillA]]: Robot +1->Emitted(10, 1) Source(15, 1) + SourceIndex(0) +2 >Emitted(10, 15) Source(15, 15) + SourceIndex(0) +3 >Emitted(10, 17) Source(15, 64) + SourceIndex(0) +--- +>>> var nameMA = _a[0], _b = _a[1], primarySkillA = _b[0], secondarySkillA = _b[1]; +1->^^^^^^^^ +2 > ^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > nameMA +3 > , +4 > [primarySkillA, secondarySkillA] +5 > +6 > primarySkillA +7 > , +8 > secondarySkillA +1->Emitted(11, 9) Source(15, 16) + SourceIndex(0) +2 >Emitted(11, 23) Source(15, 22) + SourceIndex(0) +3 >Emitted(11, 25) Source(15, 24) + SourceIndex(0) +4 >Emitted(11, 35) Source(15, 56) + SourceIndex(0) +5 >Emitted(11, 37) Source(15, 25) + SourceIndex(0) +6 >Emitted(11, 58) Source(15, 38) + SourceIndex(0) +7 >Emitted(11, 60) Source(15, 40) + SourceIndex(0) +8 >Emitted(11, 83) Source(15, 55) + SourceIndex(0) +--- +>>> console.log(nameMA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^ +7 > ^ +8 > ^ +1 >]]: Robot) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameMA +7 > ) +8 > ; +1 >Emitted(12, 5) Source(16, 5) + SourceIndex(0) +2 >Emitted(12, 12) Source(16, 12) + SourceIndex(0) +3 >Emitted(12, 13) Source(16, 13) + SourceIndex(0) +4 >Emitted(12, 16) Source(16, 16) + SourceIndex(0) +5 >Emitted(12, 17) Source(16, 17) + SourceIndex(0) +6 >Emitted(12, 23) Source(16, 23) + SourceIndex(0) +7 >Emitted(12, 24) Source(16, 24) + SourceIndex(0) +8 >Emitted(12, 25) Source(16, 25) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(13, 1) Source(17, 1) + SourceIndex(0) +2 >Emitted(13, 2) Source(17, 2) + SourceIndex(0) +--- +>>>function foo4(_a) { +1-> +2 >^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > + > +2 >function foo4( +3 > [...multiRobotAInfo]: Robot +1->Emitted(14, 1) Source(19, 1) + SourceIndex(0) +2 >Emitted(14, 15) Source(19, 15) + SourceIndex(0) +3 >Emitted(14, 17) Source(19, 42) + SourceIndex(0) +--- +>>> var multiRobotAInfo = _a.slice(0); +1->^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > ...multiRobotAInfo +1->Emitted(15, 9) Source(19, 16) + SourceIndex(0) +2 >Emitted(15, 38) Source(19, 34) + SourceIndex(0) +--- +>>> console.log(multiRobotAInfo); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^^^^^^^^ +7 > ^ +8 > ^ +1 >]: Robot) { + > +2 > console +3 > . +4 > log +5 > ( +6 > multiRobotAInfo +7 > ) +8 > ; +1 >Emitted(16, 5) Source(20, 5) + SourceIndex(0) +2 >Emitted(16, 12) Source(20, 12) + SourceIndex(0) +3 >Emitted(16, 13) Source(20, 13) + SourceIndex(0) +4 >Emitted(16, 16) Source(20, 16) + SourceIndex(0) +5 >Emitted(16, 17) Source(20, 17) + SourceIndex(0) +6 >Emitted(16, 32) Source(20, 32) + SourceIndex(0) +7 >Emitted(16, 33) Source(20, 33) + SourceIndex(0) +8 >Emitted(16, 34) Source(20, 34) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(17, 1) Source(21, 1) + SourceIndex(0) +2 >Emitted(17, 2) Source(21, 2) + SourceIndex(0) +--- +>>>foo1(robotA); +1-> +2 >^^^^ +3 > ^ +4 > ^^^^^^ +5 > ^ +6 > ^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > + > +2 >foo1 +3 > ( +4 > robotA +5 > ) +6 > ; +1->Emitted(18, 1) Source(23, 1) + SourceIndex(0) +2 >Emitted(18, 5) Source(23, 5) + SourceIndex(0) +3 >Emitted(18, 6) Source(23, 6) + SourceIndex(0) +4 >Emitted(18, 12) Source(23, 12) + SourceIndex(0) +5 >Emitted(18, 13) Source(23, 13) + SourceIndex(0) +6 >Emitted(18, 14) Source(23, 14) + SourceIndex(0) +--- +>>>foo1(["roomba", ["vaccum", "mopping"]]); +1-> +2 >^^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^ +6 > ^^ +7 > ^ +8 > ^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^ +11> ^ +12> ^ +13> ^ +14> ^ +1-> + > +2 >foo1 +3 > ( +4 > [ +5 > "roomba" +6 > , +7 > [ +8 > "vaccum" +9 > , +10> "mopping" +11> ] +12> ] +13> ) +14> ; +1->Emitted(19, 1) Source(24, 1) + SourceIndex(0) +2 >Emitted(19, 5) Source(24, 5) + SourceIndex(0) +3 >Emitted(19, 6) Source(24, 6) + SourceIndex(0) +4 >Emitted(19, 7) Source(24, 7) + SourceIndex(0) +5 >Emitted(19, 15) Source(24, 15) + SourceIndex(0) +6 >Emitted(19, 17) Source(24, 17) + SourceIndex(0) +7 >Emitted(19, 18) Source(24, 18) + SourceIndex(0) +8 >Emitted(19, 26) Source(24, 26) + SourceIndex(0) +9 >Emitted(19, 28) Source(24, 28) + SourceIndex(0) +10>Emitted(19, 37) Source(24, 37) + SourceIndex(0) +11>Emitted(19, 38) Source(24, 38) + SourceIndex(0) +12>Emitted(19, 39) Source(24, 39) + SourceIndex(0) +13>Emitted(19, 40) Source(24, 40) + SourceIndex(0) +14>Emitted(19, 41) Source(24, 41) + SourceIndex(0) +--- +>>>foo2(robotA); +1 > +2 >^^^^ +3 > ^ +4 > ^^^^^^ +5 > ^ +6 > ^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > + > +2 >foo2 +3 > ( +4 > robotA +5 > ) +6 > ; +1 >Emitted(20, 1) Source(26, 1) + SourceIndex(0) +2 >Emitted(20, 5) Source(26, 5) + SourceIndex(0) +3 >Emitted(20, 6) Source(26, 6) + SourceIndex(0) +4 >Emitted(20, 12) Source(26, 12) + SourceIndex(0) +5 >Emitted(20, 13) Source(26, 13) + SourceIndex(0) +6 >Emitted(20, 14) Source(26, 14) + SourceIndex(0) +--- +>>>foo2(["roomba", ["vaccum", "mopping"]]); +1-> +2 >^^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^ +6 > ^^ +7 > ^ +8 > ^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^ +11> ^ +12> ^ +13> ^ +14> ^ +1-> + > +2 >foo2 +3 > ( +4 > [ +5 > "roomba" +6 > , +7 > [ +8 > "vaccum" +9 > , +10> "mopping" +11> ] +12> ] +13> ) +14> ; +1->Emitted(21, 1) Source(27, 1) + SourceIndex(0) +2 >Emitted(21, 5) Source(27, 5) + SourceIndex(0) +3 >Emitted(21, 6) Source(27, 6) + SourceIndex(0) +4 >Emitted(21, 7) Source(27, 7) + SourceIndex(0) +5 >Emitted(21, 15) Source(27, 15) + SourceIndex(0) +6 >Emitted(21, 17) Source(27, 17) + SourceIndex(0) +7 >Emitted(21, 18) Source(27, 18) + SourceIndex(0) +8 >Emitted(21, 26) Source(27, 26) + SourceIndex(0) +9 >Emitted(21, 28) Source(27, 28) + SourceIndex(0) +10>Emitted(21, 37) Source(27, 37) + SourceIndex(0) +11>Emitted(21, 38) Source(27, 38) + SourceIndex(0) +12>Emitted(21, 39) Source(27, 39) + SourceIndex(0) +13>Emitted(21, 40) Source(27, 40) + SourceIndex(0) +14>Emitted(21, 41) Source(27, 41) + SourceIndex(0) +--- +>>>foo3(robotA); +1 > +2 >^^^^ +3 > ^ +4 > ^^^^^^ +5 > ^ +6 > ^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > + > +2 >foo3 +3 > ( +4 > robotA +5 > ) +6 > ; +1 >Emitted(22, 1) Source(29, 1) + SourceIndex(0) +2 >Emitted(22, 5) Source(29, 5) + SourceIndex(0) +3 >Emitted(22, 6) Source(29, 6) + SourceIndex(0) +4 >Emitted(22, 12) Source(29, 12) + SourceIndex(0) +5 >Emitted(22, 13) Source(29, 13) + SourceIndex(0) +6 >Emitted(22, 14) Source(29, 14) + SourceIndex(0) +--- +>>>foo3(["roomba", ["vaccum", "mopping"]]); +1-> +2 >^^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^ +6 > ^^ +7 > ^ +8 > ^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^ +11> ^ +12> ^ +13> ^ +14> ^ +1-> + > +2 >foo3 +3 > ( +4 > [ +5 > "roomba" +6 > , +7 > [ +8 > "vaccum" +9 > , +10> "mopping" +11> ] +12> ] +13> ) +14> ; +1->Emitted(23, 1) Source(30, 1) + SourceIndex(0) +2 >Emitted(23, 5) Source(30, 5) + SourceIndex(0) +3 >Emitted(23, 6) Source(30, 6) + SourceIndex(0) +4 >Emitted(23, 7) Source(30, 7) + SourceIndex(0) +5 >Emitted(23, 15) Source(30, 15) + SourceIndex(0) +6 >Emitted(23, 17) Source(30, 17) + SourceIndex(0) +7 >Emitted(23, 18) Source(30, 18) + SourceIndex(0) +8 >Emitted(23, 26) Source(30, 26) + SourceIndex(0) +9 >Emitted(23, 28) Source(30, 28) + SourceIndex(0) +10>Emitted(23, 37) Source(30, 37) + SourceIndex(0) +11>Emitted(23, 38) Source(30, 38) + SourceIndex(0) +12>Emitted(23, 39) Source(30, 39) + SourceIndex(0) +13>Emitted(23, 40) Source(30, 40) + SourceIndex(0) +14>Emitted(23, 41) Source(30, 41) + SourceIndex(0) +--- +>>>foo4(robotA); +1 > +2 >^^^^ +3 > ^ +4 > ^^^^^^ +5 > ^ +6 > ^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > + > +2 >foo4 +3 > ( +4 > robotA +5 > ) +6 > ; +1 >Emitted(24, 1) Source(32, 1) + SourceIndex(0) +2 >Emitted(24, 5) Source(32, 5) + SourceIndex(0) +3 >Emitted(24, 6) Source(32, 6) + SourceIndex(0) +4 >Emitted(24, 12) Source(32, 12) + SourceIndex(0) +5 >Emitted(24, 13) Source(32, 13) + SourceIndex(0) +6 >Emitted(24, 14) Source(32, 14) + SourceIndex(0) +--- +>>>foo4(["roomba", ["vaccum", "mopping"]]); +1-> +2 >^^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^ +6 > ^^ +7 > ^ +8 > ^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^ +11> ^ +12> ^ +13> ^ +14> ^ +15> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >foo4 +3 > ( +4 > [ +5 > "roomba" +6 > , +7 > [ +8 > "vaccum" +9 > , +10> "mopping" +11> ] +12> ] +13> ) +14> ; +1->Emitted(25, 1) Source(33, 1) + SourceIndex(0) +2 >Emitted(25, 5) Source(33, 5) + SourceIndex(0) +3 >Emitted(25, 6) Source(33, 6) + SourceIndex(0) +4 >Emitted(25, 7) Source(33, 7) + SourceIndex(0) +5 >Emitted(25, 15) Source(33, 15) + SourceIndex(0) +6 >Emitted(25, 17) Source(33, 17) + SourceIndex(0) +7 >Emitted(25, 18) Source(33, 18) + SourceIndex(0) +8 >Emitted(25, 26) Source(33, 26) + SourceIndex(0) +9 >Emitted(25, 28) Source(33, 28) + SourceIndex(0) +10>Emitted(25, 37) Source(33, 37) + SourceIndex(0) +11>Emitted(25, 38) Source(33, 38) + SourceIndex(0) +12>Emitted(25, 39) Source(33, 39) + SourceIndex(0) +13>Emitted(25, 40) Source(33, 40) + SourceIndex(0) +14>Emitted(25, 41) Source(33, 41) + SourceIndex(0) +--- +>>>//# sourceMappingURL=sourceMapValidationDestructuringParametertArrayBindingPattern2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPattern2.symbols b/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPattern2.symbols new file mode 100644 index 00000000000..26797210f4b --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPattern2.symbols @@ -0,0 +1,93 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringParametertArrayBindingPattern2.ts === +declare var console: { +>console : Symbol(console, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern2.ts, 0, 11)) + + log(msg: any): void; +>log : Symbol(log, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern2.ts, 0, 22)) +>msg : Symbol(msg, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern2.ts, 1, 8)) +} +type Robot = [string, [string, string]]; +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern2.ts, 2, 1)) + +var robotA: Robot = ["trimmer", ["trimming", "edging"]]; +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern2.ts, 4, 3)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern2.ts, 2, 1)) + +function foo1([, skillA]: Robot) { +>foo1 : Symbol(foo1, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern2.ts, 4, 56)) +>skillA : Symbol(skillA, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern2.ts, 6, 16)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern2.ts, 2, 1)) + + console.log(skillA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern2.ts, 0, 22)) +>skillA : Symbol(skillA, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern2.ts, 6, 16)) +} + +function foo2([nameMB]: Robot) { +>foo2 : Symbol(foo2, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern2.ts, 8, 1)) +>nameMB : Symbol(nameMB, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern2.ts, 10, 15)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern2.ts, 2, 1)) + + console.log(nameMB); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern2.ts, 0, 22)) +>nameMB : Symbol(nameMB, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern2.ts, 10, 15)) +} + +function foo3([nameMA, [primarySkillA, secondarySkillA]]: Robot) { +>foo3 : Symbol(foo3, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern2.ts, 12, 1)) +>nameMA : Symbol(nameMA, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern2.ts, 14, 15)) +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern2.ts, 14, 24)) +>secondarySkillA : Symbol(secondarySkillA, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern2.ts, 14, 38)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern2.ts, 2, 1)) + + console.log(nameMA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern2.ts, 0, 22)) +>nameMA : Symbol(nameMA, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern2.ts, 14, 15)) +} + +function foo4([...multiRobotAInfo]: Robot) { +>foo4 : Symbol(foo4, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern2.ts, 16, 1)) +>multiRobotAInfo : Symbol(multiRobotAInfo, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern2.ts, 18, 15)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern2.ts, 2, 1)) + + console.log(multiRobotAInfo); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern2.ts, 0, 22)) +>multiRobotAInfo : Symbol(multiRobotAInfo, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern2.ts, 18, 15)) +} + +foo1(robotA); +>foo1 : Symbol(foo1, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern2.ts, 4, 56)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern2.ts, 4, 3)) + +foo1(["roomba", ["vaccum", "mopping"]]); +>foo1 : Symbol(foo1, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern2.ts, 4, 56)) + +foo2(robotA); +>foo2 : Symbol(foo2, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern2.ts, 8, 1)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern2.ts, 4, 3)) + +foo2(["roomba", ["vaccum", "mopping"]]); +>foo2 : Symbol(foo2, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern2.ts, 8, 1)) + +foo3(robotA); +>foo3 : Symbol(foo3, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern2.ts, 12, 1)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern2.ts, 4, 3)) + +foo3(["roomba", ["vaccum", "mopping"]]); +>foo3 : Symbol(foo3, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern2.ts, 12, 1)) + +foo4(robotA); +>foo4 : Symbol(foo4, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern2.ts, 16, 1)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern2.ts, 4, 3)) + +foo4(["roomba", ["vaccum", "mopping"]]); +>foo4 : Symbol(foo4, Decl(sourceMapValidationDestructuringParametertArrayBindingPattern2.ts, 16, 1)) + diff --git a/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPattern2.types b/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPattern2.types new file mode 100644 index 00000000000..b3e09d962c3 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPattern2.types @@ -0,0 +1,131 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringParametertArrayBindingPattern2.ts === +declare var console: { +>console : { log(msg: any): void; } + + log(msg: any): void; +>log : (msg: any) => void +>msg : any +} +type Robot = [string, [string, string]]; +>Robot : [string, [string, string]] + +var robotA: Robot = ["trimmer", ["trimming", "edging"]]; +>robotA : [string, [string, string]] +>Robot : [string, [string, string]] +>["trimmer", ["trimming", "edging"]] : [string, [string, string]] +>"trimmer" : string +>["trimming", "edging"] : [string, string] +>"trimming" : string +>"edging" : string + +function foo1([, skillA]: Robot) { +>foo1 : ([, skillA]: [string, [string, string]]) => void +> : undefined +>skillA : [string, string] +>Robot : [string, [string, string]] + + console.log(skillA); +>console.log(skillA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>skillA : [string, string] +} + +function foo2([nameMB]: Robot) { +>foo2 : ([nameMB]: [string, [string, string]]) => void +>nameMB : string +>Robot : [string, [string, string]] + + console.log(nameMB); +>console.log(nameMB) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameMB : string +} + +function foo3([nameMA, [primarySkillA, secondarySkillA]]: Robot) { +>foo3 : ([nameMA, [primarySkillA, secondarySkillA]]: [string, [string, string]]) => void +>nameMA : string +>primarySkillA : string +>secondarySkillA : string +>Robot : [string, [string, string]] + + console.log(nameMA); +>console.log(nameMA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameMA : string +} + +function foo4([...multiRobotAInfo]: Robot) { +>foo4 : ([...multiRobotAInfo]: [string, [string, string]]) => void +>multiRobotAInfo : (string | [string, string])[] +>Robot : [string, [string, string]] + + console.log(multiRobotAInfo); +>console.log(multiRobotAInfo) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>multiRobotAInfo : (string | [string, string])[] +} + +foo1(robotA); +>foo1(robotA) : void +>foo1 : ([, skillA]: [string, [string, string]]) => void +>robotA : [string, [string, string]] + +foo1(["roomba", ["vaccum", "mopping"]]); +>foo1(["roomba", ["vaccum", "mopping"]]) : void +>foo1 : ([, skillA]: [string, [string, string]]) => void +>["roomba", ["vaccum", "mopping"]] : [string, [string, string]] +>"roomba" : string +>["vaccum", "mopping"] : [string, string] +>"vaccum" : string +>"mopping" : string + +foo2(robotA); +>foo2(robotA) : void +>foo2 : ([nameMB]: [string, [string, string]]) => void +>robotA : [string, [string, string]] + +foo2(["roomba", ["vaccum", "mopping"]]); +>foo2(["roomba", ["vaccum", "mopping"]]) : void +>foo2 : ([nameMB]: [string, [string, string]]) => void +>["roomba", ["vaccum", "mopping"]] : [string, [string, string]] +>"roomba" : string +>["vaccum", "mopping"] : [string, string] +>"vaccum" : string +>"mopping" : string + +foo3(robotA); +>foo3(robotA) : void +>foo3 : ([nameMA, [primarySkillA, secondarySkillA]]: [string, [string, string]]) => void +>robotA : [string, [string, string]] + +foo3(["roomba", ["vaccum", "mopping"]]); +>foo3(["roomba", ["vaccum", "mopping"]]) : void +>foo3 : ([nameMA, [primarySkillA, secondarySkillA]]: [string, [string, string]]) => void +>["roomba", ["vaccum", "mopping"]] : [string, [string, string]] +>"roomba" : string +>["vaccum", "mopping"] : [string, string] +>"vaccum" : string +>"mopping" : string + +foo4(robotA); +>foo4(robotA) : void +>foo4 : ([...multiRobotAInfo]: [string, [string, string]]) => void +>robotA : [string, [string, string]] + +foo4(["roomba", ["vaccum", "mopping"]]); +>foo4(["roomba", ["vaccum", "mopping"]]) : void +>foo4 : ([...multiRobotAInfo]: [string, [string, string]]) => void +>["roomba", ["vaccum", "mopping"]] : [string, [string, string]] +>"roomba" : string +>["vaccum", "mopping"] : [string, string] +>"vaccum" : string +>"mopping" : string + diff --git a/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.js b/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.js new file mode 100644 index 00000000000..327791a6416 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.js @@ -0,0 +1,62 @@ +//// [sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.ts] +declare var console: { + log(msg: any): void; +} +type Robot = [number, string, string]; +var robotA: Robot = [1, "mower", "mowing"]; + +function foo1([, nameA = "noName"]: Robot = [-1, "name", "skill"]) { + console.log(nameA); +} + +function foo2([numberB = -1]: Robot = [-1, "name", "skill"]) { + console.log(numberB); +} + +function foo3([numberA2 = -1, nameA2 = "name", skillA2 = "skill"]: Robot = [-1, "name", "skill"]) { + console.log(nameA2); +} + +function foo4([numberA3 = -1, ...robotAInfo]: Robot = [-1, "name", "skill"]) { + console.log(robotAInfo); +} + +foo1(robotA); +foo1([2, "trimmer", "trimming"]); + +foo2(robotA); +foo2([2, "trimmer", "trimming"]); + +foo3(robotA); +foo3([2, "trimmer", "trimming"]); + +foo4(robotA); +foo4([2, "trimmer", "trimming"]); + +//// [sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.js] +var robotA = [1, "mower", "mowing"]; +function foo1(_a) { + var _b = _a === void 0 ? [-1, "name", "skill"] : _a, _c = _b[1], nameA = _c === void 0 ? "noName" : _c; + console.log(nameA); +} +function foo2(_a) { + var _b = (_a === void 0 ? [-1, "name", "skill"] : _a)[0], numberB = _b === void 0 ? -1 : _b; + console.log(numberB); +} +function foo3(_a) { + var _b = _a === void 0 ? [-1, "name", "skill"] : _a, _c = _b[0], numberA2 = _c === void 0 ? -1 : _c, _d = _b[1], nameA2 = _d === void 0 ? "name" : _d, _e = _b[2], skillA2 = _e === void 0 ? "skill" : _e; + console.log(nameA2); +} +function foo4(_a) { + var _b = _a === void 0 ? [-1, "name", "skill"] : _a, _c = _b[0], numberA3 = _c === void 0 ? -1 : _c, robotAInfo = _b.slice(1); + console.log(robotAInfo); +} +foo1(robotA); +foo1([2, "trimmer", "trimming"]); +foo2(robotA); +foo2([2, "trimmer", "trimming"]); +foo3(robotA); +foo3([2, "trimmer", "trimming"]); +foo4(robotA); +foo4([2, "trimmer", "trimming"]); +//# sourceMappingURL=sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.js.map b/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.js.map new file mode 100644 index 00000000000..7fdda34358b --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.js.map @@ -0,0 +1,2 @@ +//// [sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.js.map] +{"version":3,"file":"sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.js","sourceRoot":"","sources":["sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.ts"],"names":[],"mappings":"AAIA,IAAI,MAAM,GAAU,CAAC,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;AAE3C,cAAc,EAAmD;QAAnD,+CAAmD,EAAhD,UAAgB,EAAhB,qCAAgB;IAC7B,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AAED,cAAc,EAA6C;QAA5C,oDAAY,EAAZ,iCAAY;IACvB,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AACzB,CAAC;AAED,cAAc,EAAkF;QAAlF,+CAAkF,EAAjF,UAAa,EAAb,kCAAa,EAAE,UAAe,EAAf,oCAAe,EAAE,UAAiB,EAAjB,sCAAiB;IAC5D,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACxB,CAAC;AAED,cAAc,EAA6D;QAA7D,+CAA6D,EAA5D,UAAa,EAAb,kCAAa,EAAE,wBAAa;IACvC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;AAC5B,CAAC;AAED,IAAI,CAAC,MAAM,CAAC,CAAC;AACb,IAAI,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC;AAEjC,IAAI,CAAC,MAAM,CAAC,CAAC;AACb,IAAI,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC;AAEjC,IAAI,CAAC,MAAM,CAAC,CAAC;AACb,IAAI,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC;AAEjC,IAAI,CAAC,MAAM,CAAC,CAAC;AACb,IAAI,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.sourcemap.txt b/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.sourcemap.txt new file mode 100644 index 00000000000..250d7ec2931 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.sourcemap.txt @@ -0,0 +1,610 @@ +=================================================================== +JsFile: sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.js +mapUrl: sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.js.map +sourceRoot: +sources: sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.js +sourceFile:sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.ts +------------------------------------------------------------------- +>>>var robotA = [1, "mower", "mowing"]; +1 > +2 >^^^^ +3 > ^^^^^^ +4 > ^^^ +5 > ^ +6 > ^ +7 > ^^ +8 > ^^^^^^^ +9 > ^^ +10> ^^^^^^^^ +11> ^ +12> ^ +1 >declare var console: { + > log(msg: any): void; + >} + >type Robot = [number, string, string]; + > +2 >var +3 > robotA +4 > : Robot = +5 > [ +6 > 1 +7 > , +8 > "mower" +9 > , +10> "mowing" +11> ] +12> ; +1 >Emitted(1, 1) Source(5, 1) + SourceIndex(0) +2 >Emitted(1, 5) Source(5, 5) + SourceIndex(0) +3 >Emitted(1, 11) Source(5, 11) + SourceIndex(0) +4 >Emitted(1, 14) Source(5, 21) + SourceIndex(0) +5 >Emitted(1, 15) Source(5, 22) + SourceIndex(0) +6 >Emitted(1, 16) Source(5, 23) + SourceIndex(0) +7 >Emitted(1, 18) Source(5, 25) + SourceIndex(0) +8 >Emitted(1, 25) Source(5, 32) + SourceIndex(0) +9 >Emitted(1, 27) Source(5, 34) + SourceIndex(0) +10>Emitted(1, 35) Source(5, 42) + SourceIndex(0) +11>Emitted(1, 36) Source(5, 43) + SourceIndex(0) +12>Emitted(1, 37) Source(5, 44) + SourceIndex(0) +--- +>>>function foo1(_a) { +1 > +2 >^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > + > +2 >function foo1( +3 > [, nameA = "noName"]: Robot = [-1, "name", "skill"] +1 >Emitted(2, 1) Source(7, 1) + SourceIndex(0) +2 >Emitted(2, 15) Source(7, 15) + SourceIndex(0) +3 >Emitted(2, 17) Source(7, 66) + SourceIndex(0) +--- +>>> var _b = _a === void 0 ? [-1, "name", "skill"] : _a, _c = _b[1], nameA = _c === void 0 ? "noName" : _c; +1->^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > [, nameA = "noName"]: Robot = [-1, "name", "skill"] +3 > +4 > nameA = "noName" +5 > +6 > nameA = "noName" +1->Emitted(3, 9) Source(7, 15) + SourceIndex(0) +2 >Emitted(3, 56) Source(7, 66) + SourceIndex(0) +3 >Emitted(3, 58) Source(7, 18) + SourceIndex(0) +4 >Emitted(3, 68) Source(7, 34) + SourceIndex(0) +5 >Emitted(3, 70) Source(7, 18) + SourceIndex(0) +6 >Emitted(3, 107) Source(7, 34) + SourceIndex(0) +--- +>>> console.log(nameA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1 >]: Robot = [-1, "name", "skill"]) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA +7 > ) +8 > ; +1 >Emitted(4, 5) Source(8, 5) + SourceIndex(0) +2 >Emitted(4, 12) Source(8, 12) + SourceIndex(0) +3 >Emitted(4, 13) Source(8, 13) + SourceIndex(0) +4 >Emitted(4, 16) Source(8, 16) + SourceIndex(0) +5 >Emitted(4, 17) Source(8, 17) + SourceIndex(0) +6 >Emitted(4, 22) Source(8, 22) + SourceIndex(0) +7 >Emitted(4, 23) Source(8, 23) + SourceIndex(0) +8 >Emitted(4, 24) Source(8, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(5, 1) Source(9, 1) + SourceIndex(0) +2 >Emitted(5, 2) Source(9, 2) + SourceIndex(0) +--- +>>>function foo2(_a) { +1-> +2 >^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > + > +2 >function foo2( +3 > [numberB = -1]: Robot = [-1, "name", "skill"] +1->Emitted(6, 1) Source(11, 1) + SourceIndex(0) +2 >Emitted(6, 15) Source(11, 15) + SourceIndex(0) +3 >Emitted(6, 17) Source(11, 60) + SourceIndex(0) +--- +>>> var _b = (_a === void 0 ? [-1, "name", "skill"] : _a)[0], numberB = _b === void 0 ? -1 : _b; +1->^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > numberB = -1 +3 > +4 > numberB = -1 +1->Emitted(7, 9) Source(11, 16) + SourceIndex(0) +2 >Emitted(7, 61) Source(11, 28) + SourceIndex(0) +3 >Emitted(7, 63) Source(11, 16) + SourceIndex(0) +4 >Emitted(7, 96) Source(11, 28) + SourceIndex(0) +--- +>>> console.log(numberB); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^ +7 > ^ +8 > ^ +1 >]: Robot = [-1, "name", "skill"]) { + > +2 > console +3 > . +4 > log +5 > ( +6 > numberB +7 > ) +8 > ; +1 >Emitted(8, 5) Source(12, 5) + SourceIndex(0) +2 >Emitted(8, 12) Source(12, 12) + SourceIndex(0) +3 >Emitted(8, 13) Source(12, 13) + SourceIndex(0) +4 >Emitted(8, 16) Source(12, 16) + SourceIndex(0) +5 >Emitted(8, 17) Source(12, 17) + SourceIndex(0) +6 >Emitted(8, 24) Source(12, 24) + SourceIndex(0) +7 >Emitted(8, 25) Source(12, 25) + SourceIndex(0) +8 >Emitted(8, 26) Source(12, 26) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(9, 1) Source(13, 1) + SourceIndex(0) +2 >Emitted(9, 2) Source(13, 2) + SourceIndex(0) +--- +>>>function foo3(_a) { +1-> +2 >^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > + > +2 >function foo3( +3 > [numberA2 = -1, nameA2 = "name", skillA2 = "skill"]: Robot = [-1, "name", "skill"] +1->Emitted(10, 1) Source(15, 1) + SourceIndex(0) +2 >Emitted(10, 15) Source(15, 15) + SourceIndex(0) +3 >Emitted(10, 17) Source(15, 97) + SourceIndex(0) +--- +>>> var _b = _a === void 0 ? [-1, "name", "skill"] : _a, _c = _b[0], numberA2 = _c === void 0 ? -1 : _c, _d = _b[1], nameA2 = _d === void 0 ? "name" : _d, _e = _b[2], skillA2 = _e === void 0 ? "skill" : _e; +1->^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > [numberA2 = -1, nameA2 = "name", skillA2 = "skill"]: Robot = [-1, "name", "skill"] +3 > +4 > numberA2 = -1 +5 > +6 > numberA2 = -1 +7 > , +8 > nameA2 = "name" +9 > +10> nameA2 = "name" +11> , +12> skillA2 = "skill" +13> +14> skillA2 = "skill" +1->Emitted(11, 9) Source(15, 15) + SourceIndex(0) +2 >Emitted(11, 56) Source(15, 97) + SourceIndex(0) +3 >Emitted(11, 58) Source(15, 16) + SourceIndex(0) +4 >Emitted(11, 68) Source(15, 29) + SourceIndex(0) +5 >Emitted(11, 70) Source(15, 16) + SourceIndex(0) +6 >Emitted(11, 104) Source(15, 29) + SourceIndex(0) +7 >Emitted(11, 106) Source(15, 31) + SourceIndex(0) +8 >Emitted(11, 116) Source(15, 46) + SourceIndex(0) +9 >Emitted(11, 118) Source(15, 31) + SourceIndex(0) +10>Emitted(11, 154) Source(15, 46) + SourceIndex(0) +11>Emitted(11, 156) Source(15, 48) + SourceIndex(0) +12>Emitted(11, 166) Source(15, 65) + SourceIndex(0) +13>Emitted(11, 168) Source(15, 48) + SourceIndex(0) +14>Emitted(11, 206) Source(15, 65) + SourceIndex(0) +--- +>>> console.log(nameA2); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^ +7 > ^ +8 > ^ +1 >]: Robot = [-1, "name", "skill"]) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameA2 +7 > ) +8 > ; +1 >Emitted(12, 5) Source(16, 5) + SourceIndex(0) +2 >Emitted(12, 12) Source(16, 12) + SourceIndex(0) +3 >Emitted(12, 13) Source(16, 13) + SourceIndex(0) +4 >Emitted(12, 16) Source(16, 16) + SourceIndex(0) +5 >Emitted(12, 17) Source(16, 17) + SourceIndex(0) +6 >Emitted(12, 23) Source(16, 23) + SourceIndex(0) +7 >Emitted(12, 24) Source(16, 24) + SourceIndex(0) +8 >Emitted(12, 25) Source(16, 25) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(13, 1) Source(17, 1) + SourceIndex(0) +2 >Emitted(13, 2) Source(17, 2) + SourceIndex(0) +--- +>>>function foo4(_a) { +1-> +2 >^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > + > +2 >function foo4( +3 > [numberA3 = -1, ...robotAInfo]: Robot = [-1, "name", "skill"] +1->Emitted(14, 1) Source(19, 1) + SourceIndex(0) +2 >Emitted(14, 15) Source(19, 15) + SourceIndex(0) +3 >Emitted(14, 17) Source(19, 76) + SourceIndex(0) +--- +>>> var _b = _a === void 0 ? [-1, "name", "skill"] : _a, _c = _b[0], numberA3 = _c === void 0 ? -1 : _c, robotAInfo = _b.slice(1); +1->^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > [numberA3 = -1, ...robotAInfo]: Robot = [-1, "name", "skill"] +3 > +4 > numberA3 = -1 +5 > +6 > numberA3 = -1 +7 > , +8 > ...robotAInfo +1->Emitted(15, 9) Source(19, 15) + SourceIndex(0) +2 >Emitted(15, 56) Source(19, 76) + SourceIndex(0) +3 >Emitted(15, 58) Source(19, 16) + SourceIndex(0) +4 >Emitted(15, 68) Source(19, 29) + SourceIndex(0) +5 >Emitted(15, 70) Source(19, 16) + SourceIndex(0) +6 >Emitted(15, 104) Source(19, 29) + SourceIndex(0) +7 >Emitted(15, 106) Source(19, 31) + SourceIndex(0) +8 >Emitted(15, 130) Source(19, 44) + SourceIndex(0) +--- +>>> console.log(robotAInfo); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^^^ +7 > ^ +8 > ^ +1 >]: Robot = [-1, "name", "skill"]) { + > +2 > console +3 > . +4 > log +5 > ( +6 > robotAInfo +7 > ) +8 > ; +1 >Emitted(16, 5) Source(20, 5) + SourceIndex(0) +2 >Emitted(16, 12) Source(20, 12) + SourceIndex(0) +3 >Emitted(16, 13) Source(20, 13) + SourceIndex(0) +4 >Emitted(16, 16) Source(20, 16) + SourceIndex(0) +5 >Emitted(16, 17) Source(20, 17) + SourceIndex(0) +6 >Emitted(16, 27) Source(20, 27) + SourceIndex(0) +7 >Emitted(16, 28) Source(20, 28) + SourceIndex(0) +8 >Emitted(16, 29) Source(20, 29) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(17, 1) Source(21, 1) + SourceIndex(0) +2 >Emitted(17, 2) Source(21, 2) + SourceIndex(0) +--- +>>>foo1(robotA); +1-> +2 >^^^^ +3 > ^ +4 > ^^^^^^ +5 > ^ +6 > ^ +7 > ^^^^^^^^^^^^^^^^^^^^^-> +1-> + > + > +2 >foo1 +3 > ( +4 > robotA +5 > ) +6 > ; +1->Emitted(18, 1) Source(23, 1) + SourceIndex(0) +2 >Emitted(18, 5) Source(23, 5) + SourceIndex(0) +3 >Emitted(18, 6) Source(23, 6) + SourceIndex(0) +4 >Emitted(18, 12) Source(23, 12) + SourceIndex(0) +5 >Emitted(18, 13) Source(23, 13) + SourceIndex(0) +6 >Emitted(18, 14) Source(23, 14) + SourceIndex(0) +--- +>>>foo1([2, "trimmer", "trimming"]); +1-> +2 >^^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^ +7 > ^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^ +10> ^ +11> ^ +12> ^ +1-> + > +2 >foo1 +3 > ( +4 > [ +5 > 2 +6 > , +7 > "trimmer" +8 > , +9 > "trimming" +10> ] +11> ) +12> ; +1->Emitted(19, 1) Source(24, 1) + SourceIndex(0) +2 >Emitted(19, 5) Source(24, 5) + SourceIndex(0) +3 >Emitted(19, 6) Source(24, 6) + SourceIndex(0) +4 >Emitted(19, 7) Source(24, 7) + SourceIndex(0) +5 >Emitted(19, 8) Source(24, 8) + SourceIndex(0) +6 >Emitted(19, 10) Source(24, 10) + SourceIndex(0) +7 >Emitted(19, 19) Source(24, 19) + SourceIndex(0) +8 >Emitted(19, 21) Source(24, 21) + SourceIndex(0) +9 >Emitted(19, 31) Source(24, 31) + SourceIndex(0) +10>Emitted(19, 32) Source(24, 32) + SourceIndex(0) +11>Emitted(19, 33) Source(24, 33) + SourceIndex(0) +12>Emitted(19, 34) Source(24, 34) + SourceIndex(0) +--- +>>>foo2(robotA); +1 > +2 >^^^^ +3 > ^ +4 > ^^^^^^ +5 > ^ +6 > ^ +7 > ^^^^^^^^^^^^^^^^^^^^^-> +1 > + > + > +2 >foo2 +3 > ( +4 > robotA +5 > ) +6 > ; +1 >Emitted(20, 1) Source(26, 1) + SourceIndex(0) +2 >Emitted(20, 5) Source(26, 5) + SourceIndex(0) +3 >Emitted(20, 6) Source(26, 6) + SourceIndex(0) +4 >Emitted(20, 12) Source(26, 12) + SourceIndex(0) +5 >Emitted(20, 13) Source(26, 13) + SourceIndex(0) +6 >Emitted(20, 14) Source(26, 14) + SourceIndex(0) +--- +>>>foo2([2, "trimmer", "trimming"]); +1-> +2 >^^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^ +7 > ^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^ +10> ^ +11> ^ +12> ^ +1-> + > +2 >foo2 +3 > ( +4 > [ +5 > 2 +6 > , +7 > "trimmer" +8 > , +9 > "trimming" +10> ] +11> ) +12> ; +1->Emitted(21, 1) Source(27, 1) + SourceIndex(0) +2 >Emitted(21, 5) Source(27, 5) + SourceIndex(0) +3 >Emitted(21, 6) Source(27, 6) + SourceIndex(0) +4 >Emitted(21, 7) Source(27, 7) + SourceIndex(0) +5 >Emitted(21, 8) Source(27, 8) + SourceIndex(0) +6 >Emitted(21, 10) Source(27, 10) + SourceIndex(0) +7 >Emitted(21, 19) Source(27, 19) + SourceIndex(0) +8 >Emitted(21, 21) Source(27, 21) + SourceIndex(0) +9 >Emitted(21, 31) Source(27, 31) + SourceIndex(0) +10>Emitted(21, 32) Source(27, 32) + SourceIndex(0) +11>Emitted(21, 33) Source(27, 33) + SourceIndex(0) +12>Emitted(21, 34) Source(27, 34) + SourceIndex(0) +--- +>>>foo3(robotA); +1 > +2 >^^^^ +3 > ^ +4 > ^^^^^^ +5 > ^ +6 > ^ +7 > ^^^^^^^^^^^^^^^^^^^^^-> +1 > + > + > +2 >foo3 +3 > ( +4 > robotA +5 > ) +6 > ; +1 >Emitted(22, 1) Source(29, 1) + SourceIndex(0) +2 >Emitted(22, 5) Source(29, 5) + SourceIndex(0) +3 >Emitted(22, 6) Source(29, 6) + SourceIndex(0) +4 >Emitted(22, 12) Source(29, 12) + SourceIndex(0) +5 >Emitted(22, 13) Source(29, 13) + SourceIndex(0) +6 >Emitted(22, 14) Source(29, 14) + SourceIndex(0) +--- +>>>foo3([2, "trimmer", "trimming"]); +1-> +2 >^^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^ +7 > ^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^ +10> ^ +11> ^ +12> ^ +1-> + > +2 >foo3 +3 > ( +4 > [ +5 > 2 +6 > , +7 > "trimmer" +8 > , +9 > "trimming" +10> ] +11> ) +12> ; +1->Emitted(23, 1) Source(30, 1) + SourceIndex(0) +2 >Emitted(23, 5) Source(30, 5) + SourceIndex(0) +3 >Emitted(23, 6) Source(30, 6) + SourceIndex(0) +4 >Emitted(23, 7) Source(30, 7) + SourceIndex(0) +5 >Emitted(23, 8) Source(30, 8) + SourceIndex(0) +6 >Emitted(23, 10) Source(30, 10) + SourceIndex(0) +7 >Emitted(23, 19) Source(30, 19) + SourceIndex(0) +8 >Emitted(23, 21) Source(30, 21) + SourceIndex(0) +9 >Emitted(23, 31) Source(30, 31) + SourceIndex(0) +10>Emitted(23, 32) Source(30, 32) + SourceIndex(0) +11>Emitted(23, 33) Source(30, 33) + SourceIndex(0) +12>Emitted(23, 34) Source(30, 34) + SourceIndex(0) +--- +>>>foo4(robotA); +1 > +2 >^^^^ +3 > ^ +4 > ^^^^^^ +5 > ^ +6 > ^ +7 > ^^^^^^^^^^^^^^^^^^^^^-> +1 > + > + > +2 >foo4 +3 > ( +4 > robotA +5 > ) +6 > ; +1 >Emitted(24, 1) Source(32, 1) + SourceIndex(0) +2 >Emitted(24, 5) Source(32, 5) + SourceIndex(0) +3 >Emitted(24, 6) Source(32, 6) + SourceIndex(0) +4 >Emitted(24, 12) Source(32, 12) + SourceIndex(0) +5 >Emitted(24, 13) Source(32, 13) + SourceIndex(0) +6 >Emitted(24, 14) Source(32, 14) + SourceIndex(0) +--- +>>>foo4([2, "trimmer", "trimming"]); +1-> +2 >^^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^ +7 > ^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^ +10> ^ +11> ^ +12> ^ +13> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >foo4 +3 > ( +4 > [ +5 > 2 +6 > , +7 > "trimmer" +8 > , +9 > "trimming" +10> ] +11> ) +12> ; +1->Emitted(25, 1) Source(33, 1) + SourceIndex(0) +2 >Emitted(25, 5) Source(33, 5) + SourceIndex(0) +3 >Emitted(25, 6) Source(33, 6) + SourceIndex(0) +4 >Emitted(25, 7) Source(33, 7) + SourceIndex(0) +5 >Emitted(25, 8) Source(33, 8) + SourceIndex(0) +6 >Emitted(25, 10) Source(33, 10) + SourceIndex(0) +7 >Emitted(25, 19) Source(33, 19) + SourceIndex(0) +8 >Emitted(25, 21) Source(33, 21) + SourceIndex(0) +9 >Emitted(25, 31) Source(33, 31) + SourceIndex(0) +10>Emitted(25, 32) Source(33, 32) + SourceIndex(0) +11>Emitted(25, 33) Source(33, 33) + SourceIndex(0) +12>Emitted(25, 34) Source(33, 34) + SourceIndex(0) +--- +>>>//# sourceMappingURL=sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.symbols b/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.symbols new file mode 100644 index 00000000000..e3502b769a8 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.symbols @@ -0,0 +1,94 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.ts === +declare var console: { +>console : Symbol(console, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.ts, 0, 11)) + + log(msg: any): void; +>log : Symbol(log, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.ts, 0, 22)) +>msg : Symbol(msg, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.ts, 1, 8)) +} +type Robot = [number, string, string]; +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.ts, 2, 1)) + +var robotA: Robot = [1, "mower", "mowing"]; +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.ts, 4, 3)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.ts, 2, 1)) + +function foo1([, nameA = "noName"]: Robot = [-1, "name", "skill"]) { +>foo1 : Symbol(foo1, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.ts, 4, 43)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.ts, 6, 16)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.ts, 2, 1)) + + console.log(nameA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.ts, 0, 22)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.ts, 6, 16)) +} + +function foo2([numberB = -1]: Robot = [-1, "name", "skill"]) { +>foo2 : Symbol(foo2, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.ts, 8, 1)) +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.ts, 10, 15)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.ts, 2, 1)) + + console.log(numberB); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.ts, 0, 22)) +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.ts, 10, 15)) +} + +function foo3([numberA2 = -1, nameA2 = "name", skillA2 = "skill"]: Robot = [-1, "name", "skill"]) { +>foo3 : Symbol(foo3, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.ts, 12, 1)) +>numberA2 : Symbol(numberA2, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.ts, 14, 15)) +>nameA2 : Symbol(nameA2, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.ts, 14, 29)) +>skillA2 : Symbol(skillA2, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.ts, 14, 46)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.ts, 2, 1)) + + console.log(nameA2); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.ts, 0, 22)) +>nameA2 : Symbol(nameA2, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.ts, 14, 29)) +} + +function foo4([numberA3 = -1, ...robotAInfo]: Robot = [-1, "name", "skill"]) { +>foo4 : Symbol(foo4, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.ts, 16, 1)) +>numberA3 : Symbol(numberA3, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.ts, 18, 15)) +>robotAInfo : Symbol(robotAInfo, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.ts, 18, 29)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.ts, 2, 1)) + + console.log(robotAInfo); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.ts, 0, 22)) +>robotAInfo : Symbol(robotAInfo, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.ts, 18, 29)) +} + +foo1(robotA); +>foo1 : Symbol(foo1, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.ts, 4, 43)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.ts, 4, 3)) + +foo1([2, "trimmer", "trimming"]); +>foo1 : Symbol(foo1, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.ts, 4, 43)) + +foo2(robotA); +>foo2 : Symbol(foo2, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.ts, 8, 1)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.ts, 4, 3)) + +foo2([2, "trimmer", "trimming"]); +>foo2 : Symbol(foo2, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.ts, 8, 1)) + +foo3(robotA); +>foo3 : Symbol(foo3, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.ts, 12, 1)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.ts, 4, 3)) + +foo3([2, "trimmer", "trimming"]); +>foo3 : Symbol(foo3, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.ts, 12, 1)) + +foo4(robotA); +>foo4 : Symbol(foo4, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.ts, 16, 1)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.ts, 4, 3)) + +foo4([2, "trimmer", "trimming"]); +>foo4 : Symbol(foo4, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.ts, 16, 1)) + diff --git a/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.types b/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.types new file mode 100644 index 00000000000..366c538dda7 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.types @@ -0,0 +1,156 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.ts === +declare var console: { +>console : { log(msg: any): void; } + + log(msg: any): void; +>log : (msg: any) => void +>msg : any +} +type Robot = [number, string, string]; +>Robot : [number, string, string] + +var robotA: Robot = [1, "mower", "mowing"]; +>robotA : [number, string, string] +>Robot : [number, string, string] +>[1, "mower", "mowing"] : [number, string, string] +>1 : number +>"mower" : string +>"mowing" : string + +function foo1([, nameA = "noName"]: Robot = [-1, "name", "skill"]) { +>foo1 : ([, nameA]?: [number, string, string]) => void +> : undefined +>nameA : string +>"noName" : string +>Robot : [number, string, string] +>[-1, "name", "skill"] : [number, string, string] +>-1 : number +>1 : number +>"name" : string +>"skill" : string + + console.log(nameA); +>console.log(nameA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA : string +} + +function foo2([numberB = -1]: Robot = [-1, "name", "skill"]) { +>foo2 : ([numberB]?: [number, string, string]) => void +>numberB : number +>-1 : number +>1 : number +>Robot : [number, string, string] +>[-1, "name", "skill"] : [number, string, string] +>-1 : number +>1 : number +>"name" : string +>"skill" : string + + console.log(numberB); +>console.log(numberB) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>numberB : number +} + +function foo3([numberA2 = -1, nameA2 = "name", skillA2 = "skill"]: Robot = [-1, "name", "skill"]) { +>foo3 : ([numberA2, nameA2, skillA2]?: [number, string, string]) => void +>numberA2 : number +>-1 : number +>1 : number +>nameA2 : string +>"name" : string +>skillA2 : string +>"skill" : string +>Robot : [number, string, string] +>[-1, "name", "skill"] : [number, string, string] +>-1 : number +>1 : number +>"name" : string +>"skill" : string + + console.log(nameA2); +>console.log(nameA2) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameA2 : string +} + +function foo4([numberA3 = -1, ...robotAInfo]: Robot = [-1, "name", "skill"]) { +>foo4 : ([numberA3, ...robotAInfo]?: [number, string, string]) => void +>numberA3 : number +>-1 : number +>1 : number +>robotAInfo : (number | string)[] +>Robot : [number, string, string] +>[-1, "name", "skill"] : [number, string, string] +>-1 : number +>1 : number +>"name" : string +>"skill" : string + + console.log(robotAInfo); +>console.log(robotAInfo) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>robotAInfo : (number | string)[] +} + +foo1(robotA); +>foo1(robotA) : void +>foo1 : ([, nameA]?: [number, string, string]) => void +>robotA : [number, string, string] + +foo1([2, "trimmer", "trimming"]); +>foo1([2, "trimmer", "trimming"]) : void +>foo1 : ([, nameA]?: [number, string, string]) => void +>[2, "trimmer", "trimming"] : [number, string, string] +>2 : number +>"trimmer" : string +>"trimming" : string + +foo2(robotA); +>foo2(robotA) : void +>foo2 : ([numberB]?: [number, string, string]) => void +>robotA : [number, string, string] + +foo2([2, "trimmer", "trimming"]); +>foo2([2, "trimmer", "trimming"]) : void +>foo2 : ([numberB]?: [number, string, string]) => void +>[2, "trimmer", "trimming"] : [number, string, string] +>2 : number +>"trimmer" : string +>"trimming" : string + +foo3(robotA); +>foo3(robotA) : void +>foo3 : ([numberA2, nameA2, skillA2]?: [number, string, string]) => void +>robotA : [number, string, string] + +foo3([2, "trimmer", "trimming"]); +>foo3([2, "trimmer", "trimming"]) : void +>foo3 : ([numberA2, nameA2, skillA2]?: [number, string, string]) => void +>[2, "trimmer", "trimming"] : [number, string, string] +>2 : number +>"trimmer" : string +>"trimming" : string + +foo4(robotA); +>foo4(robotA) : void +>foo4 : ([numberA3, ...robotAInfo]?: [number, string, string]) => void +>robotA : [number, string, string] + +foo4([2, "trimmer", "trimming"]); +>foo4([2, "trimmer", "trimming"]) : void +>foo4 : ([numberA3, ...robotAInfo]?: [number, string, string]) => void +>[2, "trimmer", "trimming"] : [number, string, string] +>2 : number +>"trimmer" : string +>"trimming" : string + diff --git a/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2.js b/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2.js new file mode 100644 index 00000000000..81add872b0d --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2.js @@ -0,0 +1,52 @@ +//// [sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2.ts] +declare var console: { + log(msg: any): void; +} +type Robot = [string, string[]]; +var robotA: Robot = ["trimmer", ["trimming", "edging"]]; + +function foo1([, skillA = ["noSkill", "noSkill"]]: Robot= ["name", ["skill1", "skill2"]]) { + console.log(skillA); +} + +function foo2([nameMB = "noName"]: Robot = ["name", ["skill1", "skill2"]]) { + console.log(nameMB); +} + +function foo3([nameMA = "noName", [ + primarySkillA = "primary", + secondarySkillA = "secondary" +] = ["noSkill", "noSkill"]]: Robot) { + console.log(nameMA); +} + +foo1(robotA); +foo1(["roomba", ["vaccum", "mopping"]]); + +foo2(robotA); +foo2(["roomba", ["vaccum", "mopping"]]); + +foo3(robotA); +foo3(["roomba", ["vaccum", "mopping"]]); + +//// [sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2.js] +var robotA = ["trimmer", ["trimming", "edging"]]; +function foo1(_a) { + var _b = _a === void 0 ? ["name", ["skill1", "skill2"]] : _a, _c = _b[1], skillA = _c === void 0 ? ["noSkill", "noSkill"] : _c; + console.log(skillA); +} +function foo2(_a) { + var _b = (_a === void 0 ? ["name", ["skill1", "skill2"]] : _a)[0], nameMB = _b === void 0 ? "noName" : _b; + console.log(nameMB); +} +function foo3(_a) { + var _b = _a[0], nameMA = _b === void 0 ? "noName" : _b, _c = _a[1], _d = _c === void 0 ? ["noSkill", "noSkill"] : _c, _e = _d[0], primarySkillA = _e === void 0 ? "primary" : _e, _f = _d[1], secondarySkillA = _f === void 0 ? "secondary" : _f; + console.log(nameMA); +} +foo1(robotA); +foo1(["roomba", ["vaccum", "mopping"]]); +foo2(robotA); +foo2(["roomba", ["vaccum", "mopping"]]); +foo3(robotA); +foo3(["roomba", ["vaccum", "mopping"]]); +//# sourceMappingURL=sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2.js.map b/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2.js.map new file mode 100644 index 00000000000..a489a3e41bf --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2.js.map @@ -0,0 +1,2 @@ +//// [sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2.js.map] +{"version":3,"file":"sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2.js","sourceRoot":"","sources":["sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2.ts"],"names":[],"mappings":"AAIA,IAAI,MAAM,GAAU,CAAC,SAAS,EAAE,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC,CAAC;AAExD,cAAc,EAA0E;QAA1E,wDAA0E,EAAvE,UAA+B,EAA/B,oDAA+B;IAC5C,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACxB,CAAC;AAED,cAAc,EAA2D;QAA1D,6DAAiB,EAAjB,sCAAiB;IAC5B,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACxB,CAAC;AAED,cAAc,EAGoB;QAHnB,UAAiB,EAAjB,sCAAiB,EAAE,UAGR,EAHQ,gDAGR,EAFtB,UAAyB,EAAzB,8CAAyB,EACzB,UAA6B,EAA7B,kDAA6B;IAE7B,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACxB,CAAC;AAED,IAAI,CAAC,MAAM,CAAC,CAAC;AACb,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;AAExC,IAAI,CAAC,MAAM,CAAC,CAAC;AACb,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;AAExC,IAAI,CAAC,MAAM,CAAC,CAAC;AACb,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2.sourcemap.txt b/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2.sourcemap.txt new file mode 100644 index 00000000000..28f94da65a1 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2.sourcemap.txt @@ -0,0 +1,512 @@ +=================================================================== +JsFile: sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2.js +mapUrl: sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2.js.map +sourceRoot: +sources: sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2.js +sourceFile:sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2.ts +------------------------------------------------------------------- +>>>var robotA = ["trimmer", ["trimming", "edging"]]; +1 > +2 >^^^^ +3 > ^^^^^^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^^ +7 > ^^ +8 > ^ +9 > ^^^^^^^^^^ +10> ^^ +11> ^^^^^^^^ +12> ^ +13> ^ +14> ^ +1 >declare var console: { + > log(msg: any): void; + >} + >type Robot = [string, string[]]; + > +2 >var +3 > robotA +4 > : Robot = +5 > [ +6 > "trimmer" +7 > , +8 > [ +9 > "trimming" +10> , +11> "edging" +12> ] +13> ] +14> ; +1 >Emitted(1, 1) Source(5, 1) + SourceIndex(0) +2 >Emitted(1, 5) Source(5, 5) + SourceIndex(0) +3 >Emitted(1, 11) Source(5, 11) + SourceIndex(0) +4 >Emitted(1, 14) Source(5, 21) + SourceIndex(0) +5 >Emitted(1, 15) Source(5, 22) + SourceIndex(0) +6 >Emitted(1, 24) Source(5, 31) + SourceIndex(0) +7 >Emitted(1, 26) Source(5, 33) + SourceIndex(0) +8 >Emitted(1, 27) Source(5, 34) + SourceIndex(0) +9 >Emitted(1, 37) Source(5, 44) + SourceIndex(0) +10>Emitted(1, 39) Source(5, 46) + SourceIndex(0) +11>Emitted(1, 47) Source(5, 54) + SourceIndex(0) +12>Emitted(1, 48) Source(5, 55) + SourceIndex(0) +13>Emitted(1, 49) Source(5, 56) + SourceIndex(0) +14>Emitted(1, 50) Source(5, 57) + SourceIndex(0) +--- +>>>function foo1(_a) { +1 > +2 >^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > + > +2 >function foo1( +3 > [, skillA = ["noSkill", "noSkill"]]: Robot= ["name", ["skill1", "skill2"]] +1 >Emitted(2, 1) Source(7, 1) + SourceIndex(0) +2 >Emitted(2, 15) Source(7, 15) + SourceIndex(0) +3 >Emitted(2, 17) Source(7, 89) + SourceIndex(0) +--- +>>> var _b = _a === void 0 ? ["name", ["skill1", "skill2"]] : _a, _c = _b[1], skillA = _c === void 0 ? ["noSkill", "noSkill"] : _c; +1->^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > [, skillA = ["noSkill", "noSkill"]]: Robot= ["name", ["skill1", "skill2"]] +3 > +4 > skillA = ["noSkill", "noSkill"] +5 > +6 > skillA = ["noSkill", "noSkill"] +1->Emitted(3, 9) Source(7, 15) + SourceIndex(0) +2 >Emitted(3, 65) Source(7, 89) + SourceIndex(0) +3 >Emitted(3, 67) Source(7, 18) + SourceIndex(0) +4 >Emitted(3, 77) Source(7, 49) + SourceIndex(0) +5 >Emitted(3, 79) Source(7, 18) + SourceIndex(0) +6 >Emitted(3, 131) Source(7, 49) + SourceIndex(0) +--- +>>> console.log(skillA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^ +7 > ^ +8 > ^ +1 >]: Robot= ["name", ["skill1", "skill2"]]) { + > +2 > console +3 > . +4 > log +5 > ( +6 > skillA +7 > ) +8 > ; +1 >Emitted(4, 5) Source(8, 5) + SourceIndex(0) +2 >Emitted(4, 12) Source(8, 12) + SourceIndex(0) +3 >Emitted(4, 13) Source(8, 13) + SourceIndex(0) +4 >Emitted(4, 16) Source(8, 16) + SourceIndex(0) +5 >Emitted(4, 17) Source(8, 17) + SourceIndex(0) +6 >Emitted(4, 23) Source(8, 23) + SourceIndex(0) +7 >Emitted(4, 24) Source(8, 24) + SourceIndex(0) +8 >Emitted(4, 25) Source(8, 25) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(5, 1) Source(9, 1) + SourceIndex(0) +2 >Emitted(5, 2) Source(9, 2) + SourceIndex(0) +--- +>>>function foo2(_a) { +1-> +2 >^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > + > +2 >function foo2( +3 > [nameMB = "noName"]: Robot = ["name", ["skill1", "skill2"]] +1->Emitted(6, 1) Source(11, 1) + SourceIndex(0) +2 >Emitted(6, 15) Source(11, 15) + SourceIndex(0) +3 >Emitted(6, 17) Source(11, 74) + SourceIndex(0) +--- +>>> var _b = (_a === void 0 ? ["name", ["skill1", "skill2"]] : _a)[0], nameMB = _b === void 0 ? "noName" : _b; +1->^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > nameMB = "noName" +3 > +4 > nameMB = "noName" +1->Emitted(7, 9) Source(11, 16) + SourceIndex(0) +2 >Emitted(7, 70) Source(11, 33) + SourceIndex(0) +3 >Emitted(7, 72) Source(11, 16) + SourceIndex(0) +4 >Emitted(7, 110) Source(11, 33) + SourceIndex(0) +--- +>>> console.log(nameMB); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^ +7 > ^ +8 > ^ +1 >]: Robot = ["name", ["skill1", "skill2"]]) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameMB +7 > ) +8 > ; +1 >Emitted(8, 5) Source(12, 5) + SourceIndex(0) +2 >Emitted(8, 12) Source(12, 12) + SourceIndex(0) +3 >Emitted(8, 13) Source(12, 13) + SourceIndex(0) +4 >Emitted(8, 16) Source(12, 16) + SourceIndex(0) +5 >Emitted(8, 17) Source(12, 17) + SourceIndex(0) +6 >Emitted(8, 23) Source(12, 23) + SourceIndex(0) +7 >Emitted(8, 24) Source(12, 24) + SourceIndex(0) +8 >Emitted(8, 25) Source(12, 25) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(9, 1) Source(13, 1) + SourceIndex(0) +2 >Emitted(9, 2) Source(13, 2) + SourceIndex(0) +--- +>>>function foo3(_a) { +1-> +2 >^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > + > +2 >function foo3( +3 > [nameMA = "noName", [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["noSkill", "noSkill"]]: Robot +1->Emitted(10, 1) Source(15, 1) + SourceIndex(0) +2 >Emitted(10, 15) Source(15, 15) + SourceIndex(0) +3 >Emitted(10, 17) Source(18, 35) + SourceIndex(0) +--- +>>> var _b = _a[0], nameMA = _b === void 0 ? "noName" : _b, _c = _a[1], _d = _c === void 0 ? ["noSkill", "noSkill"] : _c, _e = _d[0], primarySkillA = _e === void 0 ? "primary" : _e, _f = _d[1], secondarySkillA = _f === void 0 ? "secondary" : _f; +1->^^^^^^^^ +2 > ^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^ +15> ^^ +16> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > nameMA = "noName" +3 > +4 > nameMA = "noName" +5 > , +6 > [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["noSkill", "noSkill"] +7 > +8 > [ + > primarySkillA = "primary", + > secondarySkillA = "secondary" + > ] = ["noSkill", "noSkill"] +9 > +10> primarySkillA = "primary" +11> +12> primarySkillA = "primary" +13> , + > +14> secondarySkillA = "secondary" +15> +16> secondarySkillA = "secondary" +1->Emitted(11, 9) Source(15, 16) + SourceIndex(0) +2 >Emitted(11, 19) Source(15, 33) + SourceIndex(0) +3 >Emitted(11, 21) Source(15, 16) + SourceIndex(0) +4 >Emitted(11, 59) Source(15, 33) + SourceIndex(0) +5 >Emitted(11, 61) Source(15, 35) + SourceIndex(0) +6 >Emitted(11, 71) Source(18, 27) + SourceIndex(0) +7 >Emitted(11, 73) Source(15, 35) + SourceIndex(0) +8 >Emitted(11, 121) Source(18, 27) + SourceIndex(0) +9 >Emitted(11, 123) Source(16, 5) + SourceIndex(0) +10>Emitted(11, 133) Source(16, 30) + SourceIndex(0) +11>Emitted(11, 135) Source(16, 5) + SourceIndex(0) +12>Emitted(11, 181) Source(16, 30) + SourceIndex(0) +13>Emitted(11, 183) Source(17, 5) + SourceIndex(0) +14>Emitted(11, 193) Source(17, 34) + SourceIndex(0) +15>Emitted(11, 195) Source(17, 5) + SourceIndex(0) +16>Emitted(11, 245) Source(17, 34) + SourceIndex(0) +--- +>>> console.log(nameMA); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^ +7 > ^ +8 > ^ +1 > + >] = ["noSkill", "noSkill"]]: Robot) { + > +2 > console +3 > . +4 > log +5 > ( +6 > nameMA +7 > ) +8 > ; +1 >Emitted(12, 5) Source(19, 5) + SourceIndex(0) +2 >Emitted(12, 12) Source(19, 12) + SourceIndex(0) +3 >Emitted(12, 13) Source(19, 13) + SourceIndex(0) +4 >Emitted(12, 16) Source(19, 16) + SourceIndex(0) +5 >Emitted(12, 17) Source(19, 17) + SourceIndex(0) +6 >Emitted(12, 23) Source(19, 23) + SourceIndex(0) +7 >Emitted(12, 24) Source(19, 24) + SourceIndex(0) +8 >Emitted(12, 25) Source(19, 25) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(13, 1) Source(20, 1) + SourceIndex(0) +2 >Emitted(13, 2) Source(20, 2) + SourceIndex(0) +--- +>>>foo1(robotA); +1-> +2 >^^^^ +3 > ^ +4 > ^^^^^^ +5 > ^ +6 > ^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > + > +2 >foo1 +3 > ( +4 > robotA +5 > ) +6 > ; +1->Emitted(14, 1) Source(22, 1) + SourceIndex(0) +2 >Emitted(14, 5) Source(22, 5) + SourceIndex(0) +3 >Emitted(14, 6) Source(22, 6) + SourceIndex(0) +4 >Emitted(14, 12) Source(22, 12) + SourceIndex(0) +5 >Emitted(14, 13) Source(22, 13) + SourceIndex(0) +6 >Emitted(14, 14) Source(22, 14) + SourceIndex(0) +--- +>>>foo1(["roomba", ["vaccum", "mopping"]]); +1-> +2 >^^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^ +6 > ^^ +7 > ^ +8 > ^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^ +11> ^ +12> ^ +13> ^ +14> ^ +1-> + > +2 >foo1 +3 > ( +4 > [ +5 > "roomba" +6 > , +7 > [ +8 > "vaccum" +9 > , +10> "mopping" +11> ] +12> ] +13> ) +14> ; +1->Emitted(15, 1) Source(23, 1) + SourceIndex(0) +2 >Emitted(15, 5) Source(23, 5) + SourceIndex(0) +3 >Emitted(15, 6) Source(23, 6) + SourceIndex(0) +4 >Emitted(15, 7) Source(23, 7) + SourceIndex(0) +5 >Emitted(15, 15) Source(23, 15) + SourceIndex(0) +6 >Emitted(15, 17) Source(23, 17) + SourceIndex(0) +7 >Emitted(15, 18) Source(23, 18) + SourceIndex(0) +8 >Emitted(15, 26) Source(23, 26) + SourceIndex(0) +9 >Emitted(15, 28) Source(23, 28) + SourceIndex(0) +10>Emitted(15, 37) Source(23, 37) + SourceIndex(0) +11>Emitted(15, 38) Source(23, 38) + SourceIndex(0) +12>Emitted(15, 39) Source(23, 39) + SourceIndex(0) +13>Emitted(15, 40) Source(23, 40) + SourceIndex(0) +14>Emitted(15, 41) Source(23, 41) + SourceIndex(0) +--- +>>>foo2(robotA); +1 > +2 >^^^^ +3 > ^ +4 > ^^^^^^ +5 > ^ +6 > ^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > + > +2 >foo2 +3 > ( +4 > robotA +5 > ) +6 > ; +1 >Emitted(16, 1) Source(25, 1) + SourceIndex(0) +2 >Emitted(16, 5) Source(25, 5) + SourceIndex(0) +3 >Emitted(16, 6) Source(25, 6) + SourceIndex(0) +4 >Emitted(16, 12) Source(25, 12) + SourceIndex(0) +5 >Emitted(16, 13) Source(25, 13) + SourceIndex(0) +6 >Emitted(16, 14) Source(25, 14) + SourceIndex(0) +--- +>>>foo2(["roomba", ["vaccum", "mopping"]]); +1-> +2 >^^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^ +6 > ^^ +7 > ^ +8 > ^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^ +11> ^ +12> ^ +13> ^ +14> ^ +1-> + > +2 >foo2 +3 > ( +4 > [ +5 > "roomba" +6 > , +7 > [ +8 > "vaccum" +9 > , +10> "mopping" +11> ] +12> ] +13> ) +14> ; +1->Emitted(17, 1) Source(26, 1) + SourceIndex(0) +2 >Emitted(17, 5) Source(26, 5) + SourceIndex(0) +3 >Emitted(17, 6) Source(26, 6) + SourceIndex(0) +4 >Emitted(17, 7) Source(26, 7) + SourceIndex(0) +5 >Emitted(17, 15) Source(26, 15) + SourceIndex(0) +6 >Emitted(17, 17) Source(26, 17) + SourceIndex(0) +7 >Emitted(17, 18) Source(26, 18) + SourceIndex(0) +8 >Emitted(17, 26) Source(26, 26) + SourceIndex(0) +9 >Emitted(17, 28) Source(26, 28) + SourceIndex(0) +10>Emitted(17, 37) Source(26, 37) + SourceIndex(0) +11>Emitted(17, 38) Source(26, 38) + SourceIndex(0) +12>Emitted(17, 39) Source(26, 39) + SourceIndex(0) +13>Emitted(17, 40) Source(26, 40) + SourceIndex(0) +14>Emitted(17, 41) Source(26, 41) + SourceIndex(0) +--- +>>>foo3(robotA); +1 > +2 >^^^^ +3 > ^ +4 > ^^^^^^ +5 > ^ +6 > ^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > + > +2 >foo3 +3 > ( +4 > robotA +5 > ) +6 > ; +1 >Emitted(18, 1) Source(28, 1) + SourceIndex(0) +2 >Emitted(18, 5) Source(28, 5) + SourceIndex(0) +3 >Emitted(18, 6) Source(28, 6) + SourceIndex(0) +4 >Emitted(18, 12) Source(28, 12) + SourceIndex(0) +5 >Emitted(18, 13) Source(28, 13) + SourceIndex(0) +6 >Emitted(18, 14) Source(28, 14) + SourceIndex(0) +--- +>>>foo3(["roomba", ["vaccum", "mopping"]]); +1-> +2 >^^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^ +6 > ^^ +7 > ^ +8 > ^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^ +11> ^ +12> ^ +13> ^ +14> ^ +15> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >foo3 +3 > ( +4 > [ +5 > "roomba" +6 > , +7 > [ +8 > "vaccum" +9 > , +10> "mopping" +11> ] +12> ] +13> ) +14> ; +1->Emitted(19, 1) Source(29, 1) + SourceIndex(0) +2 >Emitted(19, 5) Source(29, 5) + SourceIndex(0) +3 >Emitted(19, 6) Source(29, 6) + SourceIndex(0) +4 >Emitted(19, 7) Source(29, 7) + SourceIndex(0) +5 >Emitted(19, 15) Source(29, 15) + SourceIndex(0) +6 >Emitted(19, 17) Source(29, 17) + SourceIndex(0) +7 >Emitted(19, 18) Source(29, 18) + SourceIndex(0) +8 >Emitted(19, 26) Source(29, 26) + SourceIndex(0) +9 >Emitted(19, 28) Source(29, 28) + SourceIndex(0) +10>Emitted(19, 37) Source(29, 37) + SourceIndex(0) +11>Emitted(19, 38) Source(29, 38) + SourceIndex(0) +12>Emitted(19, 39) Source(29, 39) + SourceIndex(0) +13>Emitted(19, 40) Source(29, 40) + SourceIndex(0) +14>Emitted(19, 41) Source(29, 41) + SourceIndex(0) +--- +>>>//# sourceMappingURL=sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2.symbols b/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2.symbols new file mode 100644 index 00000000000..923e8327e6c --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2.symbols @@ -0,0 +1,80 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2.ts === +declare var console: { +>console : Symbol(console, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2.ts, 0, 11)) + + log(msg: any): void; +>log : Symbol(log, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2.ts, 0, 22)) +>msg : Symbol(msg, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2.ts, 1, 8)) +} +type Robot = [string, string[]]; +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2.ts, 2, 1)) + +var robotA: Robot = ["trimmer", ["trimming", "edging"]]; +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2.ts, 4, 3)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2.ts, 2, 1)) + +function foo1([, skillA = ["noSkill", "noSkill"]]: Robot= ["name", ["skill1", "skill2"]]) { +>foo1 : Symbol(foo1, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2.ts, 4, 56)) +>skillA : Symbol(skillA, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2.ts, 6, 16)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2.ts, 2, 1)) + + console.log(skillA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2.ts, 0, 22)) +>skillA : Symbol(skillA, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2.ts, 6, 16)) +} + +function foo2([nameMB = "noName"]: Robot = ["name", ["skill1", "skill2"]]) { +>foo2 : Symbol(foo2, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2.ts, 8, 1)) +>nameMB : Symbol(nameMB, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2.ts, 10, 15)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2.ts, 2, 1)) + + console.log(nameMB); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2.ts, 0, 22)) +>nameMB : Symbol(nameMB, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2.ts, 10, 15)) +} + +function foo3([nameMA = "noName", [ +>foo3 : Symbol(foo3, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2.ts, 12, 1)) +>nameMA : Symbol(nameMA, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2.ts, 14, 15)) + + primarySkillA = "primary", +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2.ts, 14, 35)) + + secondarySkillA = "secondary" +>secondarySkillA : Symbol(secondarySkillA, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2.ts, 15, 30)) + +] = ["noSkill", "noSkill"]]: Robot) { +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2.ts, 2, 1)) + + console.log(nameMA); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2.ts, 0, 22)) +>nameMA : Symbol(nameMA, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2.ts, 14, 15)) +} + +foo1(robotA); +>foo1 : Symbol(foo1, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2.ts, 4, 56)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2.ts, 4, 3)) + +foo1(["roomba", ["vaccum", "mopping"]]); +>foo1 : Symbol(foo1, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2.ts, 4, 56)) + +foo2(robotA); +>foo2 : Symbol(foo2, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2.ts, 8, 1)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2.ts, 4, 3)) + +foo2(["roomba", ["vaccum", "mopping"]]); +>foo2 : Symbol(foo2, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2.ts, 8, 1)) + +foo3(robotA); +>foo3 : Symbol(foo3, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2.ts, 12, 1)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2.ts, 4, 3)) + +foo3(["roomba", ["vaccum", "mopping"]]); +>foo3 : Symbol(foo3, Decl(sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2.ts, 12, 1)) + diff --git a/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2.types b/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2.types new file mode 100644 index 00000000000..bd140d6a232 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2.types @@ -0,0 +1,130 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2.ts === +declare var console: { +>console : { log(msg: any): void; } + + log(msg: any): void; +>log : (msg: any) => void +>msg : any +} +type Robot = [string, string[]]; +>Robot : [string, string[]] + +var robotA: Robot = ["trimmer", ["trimming", "edging"]]; +>robotA : [string, string[]] +>Robot : [string, string[]] +>["trimmer", ["trimming", "edging"]] : [string, string[]] +>"trimmer" : string +>["trimming", "edging"] : string[] +>"trimming" : string +>"edging" : string + +function foo1([, skillA = ["noSkill", "noSkill"]]: Robot= ["name", ["skill1", "skill2"]]) { +>foo1 : ([, skillA]?: [string, string[]]) => void +> : undefined +>skillA : string[] +>["noSkill", "noSkill"] : string[] +>"noSkill" : string +>"noSkill" : string +>Robot : [string, string[]] +>["name", ["skill1", "skill2"]] : [string, string[]] +>"name" : string +>["skill1", "skill2"] : string[] +>"skill1" : string +>"skill2" : string + + console.log(skillA); +>console.log(skillA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>skillA : string[] +} + +function foo2([nameMB = "noName"]: Robot = ["name", ["skill1", "skill2"]]) { +>foo2 : ([nameMB]?: [string, string[]]) => void +>nameMB : string +>"noName" : string +>Robot : [string, string[]] +>["name", ["skill1", "skill2"]] : [string, string[]] +>"name" : string +>["skill1", "skill2"] : string[] +>"skill1" : string +>"skill2" : string + + console.log(nameMB); +>console.log(nameMB) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameMB : string +} + +function foo3([nameMA = "noName", [ +>foo3 : ([nameMA, [primarySkillA, secondarySkillA]]: [string, string[]]) => void +>nameMA : string +>"noName" : string + + primarySkillA = "primary", +>primarySkillA : string +>"primary" : string + + secondarySkillA = "secondary" +>secondarySkillA : string +>"secondary" : string + +] = ["noSkill", "noSkill"]]: Robot) { +>["noSkill", "noSkill"] : [string, string] +>"noSkill" : string +>"noSkill" : string +>Robot : [string, string[]] + + console.log(nameMA); +>console.log(nameMA) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>nameMA : string +} + +foo1(robotA); +>foo1(robotA) : void +>foo1 : ([, skillA]?: [string, string[]]) => void +>robotA : [string, string[]] + +foo1(["roomba", ["vaccum", "mopping"]]); +>foo1(["roomba", ["vaccum", "mopping"]]) : void +>foo1 : ([, skillA]?: [string, string[]]) => void +>["roomba", ["vaccum", "mopping"]] : [string, string[]] +>"roomba" : string +>["vaccum", "mopping"] : string[] +>"vaccum" : string +>"mopping" : string + +foo2(robotA); +>foo2(robotA) : void +>foo2 : ([nameMB]?: [string, string[]]) => void +>robotA : [string, string[]] + +foo2(["roomba", ["vaccum", "mopping"]]); +>foo2(["roomba", ["vaccum", "mopping"]]) : void +>foo2 : ([nameMB]?: [string, string[]]) => void +>["roomba", ["vaccum", "mopping"]] : [string, string[]] +>"roomba" : string +>["vaccum", "mopping"] : string[] +>"vaccum" : string +>"mopping" : string + +foo3(robotA); +>foo3(robotA) : void +>foo3 : ([nameMA, [primarySkillA, secondarySkillA]]: [string, string[]]) => void +>robotA : [string, string[]] + +foo3(["roomba", ["vaccum", "mopping"]]); +>foo3(["roomba", ["vaccum", "mopping"]]) : void +>foo3 : ([nameMA, [primarySkillA, secondarySkillA]]: [string, string[]]) => void +>["roomba", ["vaccum", "mopping"]] : [string, string[]] +>"roomba" : string +>["vaccum", "mopping"] : string[] +>"vaccum" : string +>"mopping" : string + diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatement.js b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatement.js new file mode 100644 index 00000000000..4bd4feab384 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatement.js @@ -0,0 +1,35 @@ +//// [sourceMapValidationDestructuringVariableStatement.ts] +interface Robot { + name: string; + skill: string; +} +declare var console: { + log(msg: string): void; +} +var hello = "hello"; +var robotA: Robot = { name: "mower", skill: "mowing" }; +var robotB: Robot = { name: "trimmer", skill: "trimming" }; +var { name: nameA } = robotA; +var { name: nameB, skill: skillB } = robotB; +var { name: nameC, skill: skillC } = { name: "Edger", skill: "cutting edges" }; +if (nameA == nameB) { + console.log(skillB); +} +else { + console.log(nameC); +} + +//// [sourceMapValidationDestructuringVariableStatement.js] +var hello = "hello"; +var robotA = { name: "mower", skill: "mowing" }; +var robotB = { name: "trimmer", skill: "trimming" }; +var nameA = robotA.name; +var nameB = robotB.name, skillB = robotB.skill; +var _a = { name: "Edger", skill: "cutting edges" }, nameC = _a.name, skillC = _a.skill; +if (nameA == nameB) { + console.log(skillB); +} +else { + console.log(nameC); +} +//# sourceMappingURL=sourceMapValidationDestructuringVariableStatement.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatement.js.map b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatement.js.map new file mode 100644 index 00000000000..17d9a9b0411 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatement.js.map @@ -0,0 +1,2 @@ +//// [sourceMapValidationDestructuringVariableStatement.js.map] +{"version":3,"file":"sourceMapValidationDestructuringVariableStatement.js","sourceRoot":"","sources":["sourceMapValidationDestructuringVariableStatement.ts"],"names":[],"mappings":"AAOA,IAAI,KAAK,GAAG,OAAO,CAAC;AACpB,IAAI,MAAM,GAAU,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;AACvD,IAAI,MAAM,GAAU,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC;AACrD,uBAAW,CAAY;AACvB,uBAAW,EAAE,qBAAa,CAAY;AAC5C,IAAA,8CAA8E,EAAxE,eAAW,EAAE,iBAAa,CAA+C;AAC/E,EAAE,CAAC,CAAC,KAAK,IAAI,KAAK,CAAC,CAAC,CAAC;IACjB,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACxB,CAAC;AACD,IAAI,CAAC,CAAC;IACF,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatement.sourcemap.txt b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatement.sourcemap.txt new file mode 100644 index 00000000000..f066ec465cf --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatement.sourcemap.txt @@ -0,0 +1,313 @@ +=================================================================== +JsFile: sourceMapValidationDestructuringVariableStatement.js +mapUrl: sourceMapValidationDestructuringVariableStatement.js.map +sourceRoot: +sources: sourceMapValidationDestructuringVariableStatement.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/sourceMapValidationDestructuringVariableStatement.js +sourceFile:sourceMapValidationDestructuringVariableStatement.ts +------------------------------------------------------------------- +>>>var hello = "hello"; +1 > +2 >^^^^ +3 > ^^^^^ +4 > ^^^ +5 > ^^^^^^^ +6 > ^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 >interface Robot { + > name: string; + > skill: string; + >} + >declare var console: { + > log(msg: string): void; + >} + > +2 >var +3 > hello +4 > = +5 > "hello" +6 > ; +1 >Emitted(1, 1) Source(8, 1) + SourceIndex(0) +2 >Emitted(1, 5) Source(8, 5) + SourceIndex(0) +3 >Emitted(1, 10) Source(8, 10) + SourceIndex(0) +4 >Emitted(1, 13) Source(8, 13) + SourceIndex(0) +5 >Emitted(1, 20) Source(8, 20) + SourceIndex(0) +6 >Emitted(1, 21) Source(8, 21) + SourceIndex(0) +--- +>>>var robotA = { name: "mower", skill: "mowing" }; +1-> +2 >^^^^ +3 > ^^^^^^ +4 > ^^^ +5 > ^^ +6 > ^^^^ +7 > ^^ +8 > ^^^^^^^ +9 > ^^ +10> ^^^^^ +11> ^^ +12> ^^^^^^^^ +13> ^^ +14> ^ +15> ^^^^^-> +1-> + > +2 >var +3 > robotA +4 > : Robot = +5 > { +6 > name +7 > : +8 > "mower" +9 > , +10> skill +11> : +12> "mowing" +13> } +14> ; +1->Emitted(2, 1) Source(9, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(9, 5) + SourceIndex(0) +3 >Emitted(2, 11) Source(9, 11) + SourceIndex(0) +4 >Emitted(2, 14) Source(9, 21) + SourceIndex(0) +5 >Emitted(2, 16) Source(9, 23) + SourceIndex(0) +6 >Emitted(2, 20) Source(9, 27) + SourceIndex(0) +7 >Emitted(2, 22) Source(9, 29) + SourceIndex(0) +8 >Emitted(2, 29) Source(9, 36) + SourceIndex(0) +9 >Emitted(2, 31) Source(9, 38) + SourceIndex(0) +10>Emitted(2, 36) Source(9, 43) + SourceIndex(0) +11>Emitted(2, 38) Source(9, 45) + SourceIndex(0) +12>Emitted(2, 46) Source(9, 53) + SourceIndex(0) +13>Emitted(2, 48) Source(9, 55) + SourceIndex(0) +14>Emitted(2, 49) Source(9, 56) + SourceIndex(0) +--- +>>>var robotB = { name: "trimmer", skill: "trimming" }; +1-> +2 >^^^^ +3 > ^^^^^^ +4 > ^^^ +5 > ^^ +6 > ^^^^ +7 > ^^ +8 > ^^^^^^^^^ +9 > ^^ +10> ^^^^^ +11> ^^ +12> ^^^^^^^^^^ +13> ^^ +14> ^ +1-> + > +2 >var +3 > robotB +4 > : Robot = +5 > { +6 > name +7 > : +8 > "trimmer" +9 > , +10> skill +11> : +12> "trimming" +13> } +14> ; +1->Emitted(3, 1) Source(10, 1) + SourceIndex(0) +2 >Emitted(3, 5) Source(10, 5) + SourceIndex(0) +3 >Emitted(3, 11) Source(10, 11) + SourceIndex(0) +4 >Emitted(3, 14) Source(10, 21) + SourceIndex(0) +5 >Emitted(3, 16) Source(10, 23) + SourceIndex(0) +6 >Emitted(3, 20) Source(10, 27) + SourceIndex(0) +7 >Emitted(3, 22) Source(10, 29) + SourceIndex(0) +8 >Emitted(3, 31) Source(10, 38) + SourceIndex(0) +9 >Emitted(3, 33) Source(10, 40) + SourceIndex(0) +10>Emitted(3, 38) Source(10, 45) + SourceIndex(0) +11>Emitted(3, 40) Source(10, 47) + SourceIndex(0) +12>Emitted(3, 50) Source(10, 57) + SourceIndex(0) +13>Emitted(3, 52) Source(10, 59) + SourceIndex(0) +14>Emitted(3, 53) Source(10, 60) + SourceIndex(0) +--- +>>>var nameA = robotA.name; +1 > +2 >^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >var { +2 >name: nameA +3 > } = robotA; +1 >Emitted(4, 1) Source(11, 7) + SourceIndex(0) +2 >Emitted(4, 24) Source(11, 18) + SourceIndex(0) +3 >Emitted(4, 25) Source(11, 30) + SourceIndex(0) +--- +>>>var nameB = robotB.name, skillB = robotB.skill; +1-> +2 >^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + >var { +2 >name: nameB +3 > , +4 > skill: skillB +5 > } = robotB; +1->Emitted(5, 1) Source(12, 7) + SourceIndex(0) +2 >Emitted(5, 24) Source(12, 18) + SourceIndex(0) +3 >Emitted(5, 26) Source(12, 20) + SourceIndex(0) +4 >Emitted(5, 47) Source(12, 33) + SourceIndex(0) +5 >Emitted(5, 48) Source(12, 45) + SourceIndex(0) +--- +>>>var _a = { name: "Edger", skill: "cutting edges" }, nameC = _a.name, skillC = _a.skill; +1-> +2 >^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +4 > ^^ +5 > ^^^^^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^ +8 > ^ +1-> + > +2 > +3 > var { name: nameC, skill: skillC } = { name: "Edger", skill: "cutting edges" } +4 > +5 > name: nameC +6 > , +7 > skill: skillC +8 > } = { name: "Edger", skill: "cutting edges" }; +1->Emitted(6, 1) Source(13, 1) + SourceIndex(0) +2 >Emitted(6, 5) Source(13, 1) + SourceIndex(0) +3 >Emitted(6, 51) Source(13, 79) + SourceIndex(0) +4 >Emitted(6, 53) Source(13, 7) + SourceIndex(0) +5 >Emitted(6, 68) Source(13, 18) + SourceIndex(0) +6 >Emitted(6, 70) Source(13, 20) + SourceIndex(0) +7 >Emitted(6, 87) Source(13, 33) + SourceIndex(0) +8 >Emitted(6, 88) Source(13, 80) + SourceIndex(0) +--- +>>>if (nameA == nameB) { +1 > +2 >^^ +3 > ^ +4 > ^ +5 > ^^^^^ +6 > ^^^^ +7 > ^^^^^ +8 > ^ +9 > ^ +10> ^ +11> ^^^^-> +1 > + > +2 >if +3 > +4 > ( +5 > nameA +6 > == +7 > nameB +8 > ) +9 > +10> { +1 >Emitted(7, 1) Source(14, 1) + SourceIndex(0) +2 >Emitted(7, 3) Source(14, 3) + SourceIndex(0) +3 >Emitted(7, 4) Source(14, 4) + SourceIndex(0) +4 >Emitted(7, 5) Source(14, 5) + SourceIndex(0) +5 >Emitted(7, 10) Source(14, 10) + SourceIndex(0) +6 >Emitted(7, 14) Source(14, 14) + SourceIndex(0) +7 >Emitted(7, 19) Source(14, 19) + SourceIndex(0) +8 >Emitted(7, 20) Source(14, 20) + SourceIndex(0) +9 >Emitted(7, 21) Source(14, 21) + SourceIndex(0) +10>Emitted(7, 22) Source(14, 22) + SourceIndex(0) +--- +>>> console.log(skillB); +1->^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^ +7 > ^ +8 > ^ +1-> + > +2 > console +3 > . +4 > log +5 > ( +6 > skillB +7 > ) +8 > ; +1->Emitted(8, 5) Source(15, 5) + SourceIndex(0) +2 >Emitted(8, 12) Source(15, 12) + SourceIndex(0) +3 >Emitted(8, 13) Source(15, 13) + SourceIndex(0) +4 >Emitted(8, 16) Source(15, 16) + SourceIndex(0) +5 >Emitted(8, 17) Source(15, 17) + SourceIndex(0) +6 >Emitted(8, 23) Source(15, 23) + SourceIndex(0) +7 >Emitted(8, 24) Source(15, 24) + SourceIndex(0) +8 >Emitted(8, 25) Source(15, 25) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^-> +1 > + > +2 >} +1 >Emitted(9, 1) Source(16, 1) + SourceIndex(0) +2 >Emitted(9, 2) Source(16, 2) + SourceIndex(0) +--- +>>>else { +1-> +2 >^^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >else +3 > +4 > { +1->Emitted(10, 1) Source(17, 1) + SourceIndex(0) +2 >Emitted(10, 5) Source(17, 5) + SourceIndex(0) +3 >Emitted(10, 6) Source(17, 6) + SourceIndex(0) +4 >Emitted(10, 7) Source(17, 7) + SourceIndex(0) +--- +>>> console.log(nameC); +1->^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1-> + > +2 > console +3 > . +4 > log +5 > ( +6 > nameC +7 > ) +8 > ; +1->Emitted(11, 5) Source(18, 5) + SourceIndex(0) +2 >Emitted(11, 12) Source(18, 12) + SourceIndex(0) +3 >Emitted(11, 13) Source(18, 13) + SourceIndex(0) +4 >Emitted(11, 16) Source(18, 16) + SourceIndex(0) +5 >Emitted(11, 17) Source(18, 17) + SourceIndex(0) +6 >Emitted(11, 22) Source(18, 22) + SourceIndex(0) +7 >Emitted(11, 23) Source(18, 23) + SourceIndex(0) +8 >Emitted(11, 24) Source(18, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(12, 1) Source(19, 1) + SourceIndex(0) +2 >Emitted(12, 2) Source(19, 2) + SourceIndex(0) +--- +>>>//# sourceMappingURL=sourceMapValidationDestructuringVariableStatement.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatement.symbols b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatement.symbols new file mode 100644 index 00000000000..91b73a7c220 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatement.symbols @@ -0,0 +1,69 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringVariableStatement.ts === +interface Robot { +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringVariableStatement.ts, 0, 0)) + + name: string; +>name : Symbol(Robot.name, Decl(sourceMapValidationDestructuringVariableStatement.ts, 0, 17)) + + skill: string; +>skill : Symbol(Robot.skill, Decl(sourceMapValidationDestructuringVariableStatement.ts, 1, 17)) +} +declare var console: { +>console : Symbol(console, Decl(sourceMapValidationDestructuringVariableStatement.ts, 4, 11)) + + log(msg: string): void; +>log : Symbol(log, Decl(sourceMapValidationDestructuringVariableStatement.ts, 4, 22)) +>msg : Symbol(msg, Decl(sourceMapValidationDestructuringVariableStatement.ts, 5, 8)) +} +var hello = "hello"; +>hello : Symbol(hello, Decl(sourceMapValidationDestructuringVariableStatement.ts, 7, 3)) + +var robotA: Robot = { name: "mower", skill: "mowing" }; +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringVariableStatement.ts, 8, 3)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringVariableStatement.ts, 0, 0)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringVariableStatement.ts, 8, 21)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringVariableStatement.ts, 8, 36)) + +var robotB: Robot = { name: "trimmer", skill: "trimming" }; +>robotB : Symbol(robotB, Decl(sourceMapValidationDestructuringVariableStatement.ts, 9, 3)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringVariableStatement.ts, 0, 0)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringVariableStatement.ts, 9, 21)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringVariableStatement.ts, 9, 38)) + +var { name: nameA } = robotA; +>name : Symbol(Robot.name, Decl(sourceMapValidationDestructuringVariableStatement.ts, 0, 17)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringVariableStatement.ts, 10, 5)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringVariableStatement.ts, 8, 3)) + +var { name: nameB, skill: skillB } = robotB; +>name : Symbol(Robot.name, Decl(sourceMapValidationDestructuringVariableStatement.ts, 0, 17)) +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringVariableStatement.ts, 11, 5)) +>skill : Symbol(Robot.skill, Decl(sourceMapValidationDestructuringVariableStatement.ts, 1, 17)) +>skillB : Symbol(skillB, Decl(sourceMapValidationDestructuringVariableStatement.ts, 11, 18)) +>robotB : Symbol(robotB, Decl(sourceMapValidationDestructuringVariableStatement.ts, 9, 3)) + +var { name: nameC, skill: skillC } = { name: "Edger", skill: "cutting edges" }; +>name : Symbol(name, Decl(sourceMapValidationDestructuringVariableStatement.ts, 12, 38)) +>nameC : Symbol(nameC, Decl(sourceMapValidationDestructuringVariableStatement.ts, 12, 5)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringVariableStatement.ts, 12, 53)) +>skillC : Symbol(skillC, Decl(sourceMapValidationDestructuringVariableStatement.ts, 12, 18)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringVariableStatement.ts, 12, 38)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringVariableStatement.ts, 12, 53)) + +if (nameA == nameB) { +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringVariableStatement.ts, 10, 5)) +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringVariableStatement.ts, 11, 5)) + + console.log(skillB); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringVariableStatement.ts, 4, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringVariableStatement.ts, 4, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringVariableStatement.ts, 4, 22)) +>skillB : Symbol(skillB, Decl(sourceMapValidationDestructuringVariableStatement.ts, 11, 18)) +} +else { + console.log(nameC); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringVariableStatement.ts, 4, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringVariableStatement.ts, 4, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringVariableStatement.ts, 4, 22)) +>nameC : Symbol(nameC, Decl(sourceMapValidationDestructuringVariableStatement.ts, 12, 5)) +} diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatement.types b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatement.types new file mode 100644 index 00000000000..82a2ffe88f6 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatement.types @@ -0,0 +1,82 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringVariableStatement.ts === +interface Robot { +>Robot : Robot + + name: string; +>name : string + + skill: string; +>skill : string +} +declare var console: { +>console : { log(msg: string): void; } + + log(msg: string): void; +>log : (msg: string) => void +>msg : string +} +var hello = "hello"; +>hello : string +>"hello" : string + +var robotA: Robot = { name: "mower", skill: "mowing" }; +>robotA : Robot +>Robot : Robot +>{ name: "mower", skill: "mowing" } : { name: string; skill: string; } +>name : string +>"mower" : string +>skill : string +>"mowing" : string + +var robotB: Robot = { name: "trimmer", skill: "trimming" }; +>robotB : Robot +>Robot : Robot +>{ name: "trimmer", skill: "trimming" } : { name: string; skill: string; } +>name : string +>"trimmer" : string +>skill : string +>"trimming" : string + +var { name: nameA } = robotA; +>name : any +>nameA : string +>robotA : Robot + +var { name: nameB, skill: skillB } = robotB; +>name : any +>nameB : string +>skill : any +>skillB : string +>robotB : Robot + +var { name: nameC, skill: skillC } = { name: "Edger", skill: "cutting edges" }; +>name : any +>nameC : string +>skill : any +>skillC : string +>{ name: "Edger", skill: "cutting edges" } : { name: string; skill: string; } +>name : string +>"Edger" : string +>skill : string +>"cutting edges" : string + +if (nameA == nameB) { +>nameA == nameB : boolean +>nameA : string +>nameB : string + + console.log(skillB); +>console.log(skillB) : void +>console.log : (msg: string) => void +>console : { log(msg: string): void; } +>log : (msg: string) => void +>skillB : string +} +else { + console.log(nameC); +>console.log(nameC) : void +>console.log : (msg: string) => void +>console : { log(msg: string): void; } +>log : (msg: string) => void +>nameC : string +} diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatement1.js b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatement1.js new file mode 100644 index 00000000000..cdf4451195e --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatement1.js @@ -0,0 +1,49 @@ +//// [sourceMapValidationDestructuringVariableStatement1.ts] +interface Robot { + name: string; + skill: string; +} +declare var console: { + log(msg: string): void; +} +var hello = "hello"; +var robotA: Robot = { name: "mower", skill: "mowing" }; +var robotB: Robot = { name: "trimmer", skill: "trimming" }; +var a: string, { name: nameA } = robotA; +var b: string, { name: nameB, skill: skillB } = robotB; +var c: string, { name: nameC, skill: skillC } = { name: "Edger", skill: "cutting edges" }; + +var { name: nameA } = robotA, a = hello; +var { name: nameB, skill: skillB } = robotB, b = " hello"; +var { name: nameC, skill: skillC } = { name: "Edger", skill: "cutting edges" }, c = hello; + +var a = hello, { name: nameA } = robotA, a1= "hello"; +var b = hello, { name: nameB, skill: skillB } = robotB, b1 = "hello"; +var c = hello, { name: nameC, skill: skillC } = { name: "Edger", skill: "cutting edges" }, c1 = hello; +if (nameA == nameB) { + console.log(skillB); +} +else { + console.log(nameC); +} + +//// [sourceMapValidationDestructuringVariableStatement1.js] +var hello = "hello"; +var robotA = { name: "mower", skill: "mowing" }; +var robotB = { name: "trimmer", skill: "trimming" }; +var a, nameA = robotA.name; +var b, nameB = robotB.name, skillB = robotB.skill; +var c, _a = { name: "Edger", skill: "cutting edges" }, nameC = _a.name, skillC = _a.skill; +var nameA = robotA.name, a = hello; +var nameB = robotB.name, skillB = robotB.skill, b = " hello"; +var _b = { name: "Edger", skill: "cutting edges" }, nameC = _b.name, skillC = _b.skill, c = hello; +var a = hello, nameA = robotA.name, a1 = "hello"; +var b = hello, nameB = robotB.name, skillB = robotB.skill, b1 = "hello"; +var c = hello, _c = { name: "Edger", skill: "cutting edges" }, nameC = _c.name, skillC = _c.skill, c1 = hello; +if (nameA == nameB) { + console.log(skillB); +} +else { + console.log(nameC); +} +//# sourceMappingURL=sourceMapValidationDestructuringVariableStatement1.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatement1.js.map b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatement1.js.map new file mode 100644 index 00000000000..cc2ae54143d --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatement1.js.map @@ -0,0 +1,2 @@ +//// [sourceMapValidationDestructuringVariableStatement1.js.map] +{"version":3,"file":"sourceMapValidationDestructuringVariableStatement1.js","sourceRoot":"","sources":["sourceMapValidationDestructuringVariableStatement1.ts"],"names":[],"mappings":"AAOA,IAAI,KAAK,GAAG,OAAO,CAAC;AACpB,IAAI,MAAM,GAAU,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;AACvD,IAAI,MAAM,GAAU,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC;AAC3D,IAAI,CAAS,EAAI,mBAAW,CAAY;AACxC,IAAI,CAAS,EAAI,mBAAW,EAAE,qBAAa,CAAY;AACvD,IAAI,CAAS,EAAE,8CAA0E,EAAxE,eAAW,EAAE,iBAAa,CAA+C;AAEpF,uBAAW,EAAa,CAAC,GAAG,KAAK,CAAC;AAClC,uBAAW,EAAE,qBAAa,EAAa,CAAC,GAAG,QAAQ,CAAC;AAC1D,IAAA,8CAA8E,EAAxE,eAAW,EAAE,iBAAa,EAAgD,CAAC,GAAG,KAAK,CAAC;AAE1F,IAAI,CAAC,GAAG,KAAK,EAAI,mBAAW,EAAa,EAAE,GAAE,OAAO,CAAC;AACrD,IAAI,CAAC,GAAG,KAAK,EAAI,mBAAW,EAAE,qBAAa,EAAa,EAAE,GAAG,OAAO,CAAC;AACrE,IAAI,CAAC,GAAG,KAAK,EAAE,8CAA0E,EAAxE,eAAW,EAAE,iBAAa,EAAgD,EAAE,GAAG,KAAK,CAAC;AACtG,EAAE,CAAC,CAAC,KAAK,IAAI,KAAK,CAAC,CAAC,CAAC;IACjB,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACxB,CAAC;AACD,IAAI,CAAC,CAAC;IACF,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatement1.sourcemap.txt b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatement1.sourcemap.txt new file mode 100644 index 00000000000..70407ad9f81 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatement1.sourcemap.txt @@ -0,0 +1,571 @@ +=================================================================== +JsFile: sourceMapValidationDestructuringVariableStatement1.js +mapUrl: sourceMapValidationDestructuringVariableStatement1.js.map +sourceRoot: +sources: sourceMapValidationDestructuringVariableStatement1.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/sourceMapValidationDestructuringVariableStatement1.js +sourceFile:sourceMapValidationDestructuringVariableStatement1.ts +------------------------------------------------------------------- +>>>var hello = "hello"; +1 > +2 >^^^^ +3 > ^^^^^ +4 > ^^^ +5 > ^^^^^^^ +6 > ^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 >interface Robot { + > name: string; + > skill: string; + >} + >declare var console: { + > log(msg: string): void; + >} + > +2 >var +3 > hello +4 > = +5 > "hello" +6 > ; +1 >Emitted(1, 1) Source(8, 1) + SourceIndex(0) +2 >Emitted(1, 5) Source(8, 5) + SourceIndex(0) +3 >Emitted(1, 10) Source(8, 10) + SourceIndex(0) +4 >Emitted(1, 13) Source(8, 13) + SourceIndex(0) +5 >Emitted(1, 20) Source(8, 20) + SourceIndex(0) +6 >Emitted(1, 21) Source(8, 21) + SourceIndex(0) +--- +>>>var robotA = { name: "mower", skill: "mowing" }; +1-> +2 >^^^^ +3 > ^^^^^^ +4 > ^^^ +5 > ^^ +6 > ^^^^ +7 > ^^ +8 > ^^^^^^^ +9 > ^^ +10> ^^^^^ +11> ^^ +12> ^^^^^^^^ +13> ^^ +14> ^ +15> ^^^^^-> +1-> + > +2 >var +3 > robotA +4 > : Robot = +5 > { +6 > name +7 > : +8 > "mower" +9 > , +10> skill +11> : +12> "mowing" +13> } +14> ; +1->Emitted(2, 1) Source(9, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(9, 5) + SourceIndex(0) +3 >Emitted(2, 11) Source(9, 11) + SourceIndex(0) +4 >Emitted(2, 14) Source(9, 21) + SourceIndex(0) +5 >Emitted(2, 16) Source(9, 23) + SourceIndex(0) +6 >Emitted(2, 20) Source(9, 27) + SourceIndex(0) +7 >Emitted(2, 22) Source(9, 29) + SourceIndex(0) +8 >Emitted(2, 29) Source(9, 36) + SourceIndex(0) +9 >Emitted(2, 31) Source(9, 38) + SourceIndex(0) +10>Emitted(2, 36) Source(9, 43) + SourceIndex(0) +11>Emitted(2, 38) Source(9, 45) + SourceIndex(0) +12>Emitted(2, 46) Source(9, 53) + SourceIndex(0) +13>Emitted(2, 48) Source(9, 55) + SourceIndex(0) +14>Emitted(2, 49) Source(9, 56) + SourceIndex(0) +--- +>>>var robotB = { name: "trimmer", skill: "trimming" }; +1-> +2 >^^^^ +3 > ^^^^^^ +4 > ^^^ +5 > ^^ +6 > ^^^^ +7 > ^^ +8 > ^^^^^^^^^ +9 > ^^ +10> ^^^^^ +11> ^^ +12> ^^^^^^^^^^ +13> ^^ +14> ^ +1-> + > +2 >var +3 > robotB +4 > : Robot = +5 > { +6 > name +7 > : +8 > "trimmer" +9 > , +10> skill +11> : +12> "trimming" +13> } +14> ; +1->Emitted(3, 1) Source(10, 1) + SourceIndex(0) +2 >Emitted(3, 5) Source(10, 5) + SourceIndex(0) +3 >Emitted(3, 11) Source(10, 11) + SourceIndex(0) +4 >Emitted(3, 14) Source(10, 21) + SourceIndex(0) +5 >Emitted(3, 16) Source(10, 23) + SourceIndex(0) +6 >Emitted(3, 20) Source(10, 27) + SourceIndex(0) +7 >Emitted(3, 22) Source(10, 29) + SourceIndex(0) +8 >Emitted(3, 31) Source(10, 38) + SourceIndex(0) +9 >Emitted(3, 33) Source(10, 40) + SourceIndex(0) +10>Emitted(3, 38) Source(10, 45) + SourceIndex(0) +11>Emitted(3, 40) Source(10, 47) + SourceIndex(0) +12>Emitted(3, 50) Source(10, 57) + SourceIndex(0) +13>Emitted(3, 52) Source(10, 59) + SourceIndex(0) +14>Emitted(3, 53) Source(10, 60) + SourceIndex(0) +--- +>>>var a, nameA = robotA.name; +1 > +2 >^^^^ +3 > ^ +4 > ^^ +5 > ^^^^^^^^^^^^^^^^^^^ +6 > ^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a: string +4 > , { +5 > name: nameA +6 > } = robotA; +1 >Emitted(4, 1) Source(11, 1) + SourceIndex(0) +2 >Emitted(4, 5) Source(11, 5) + SourceIndex(0) +3 >Emitted(4, 6) Source(11, 14) + SourceIndex(0) +4 >Emitted(4, 8) Source(11, 18) + SourceIndex(0) +5 >Emitted(4, 27) Source(11, 29) + SourceIndex(0) +6 >Emitted(4, 28) Source(11, 41) + SourceIndex(0) +--- +>>>var b, nameB = robotB.name, skillB = robotB.skill; +1-> +2 >^^^^ +3 > ^ +4 > ^^ +5 > ^^^^^^^^^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^^^ +8 > ^ +9 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >var +3 > b: string +4 > , { +5 > name: nameB +6 > , +7 > skill: skillB +8 > } = robotB; +1->Emitted(5, 1) Source(12, 1) + SourceIndex(0) +2 >Emitted(5, 5) Source(12, 5) + SourceIndex(0) +3 >Emitted(5, 6) Source(12, 14) + SourceIndex(0) +4 >Emitted(5, 8) Source(12, 18) + SourceIndex(0) +5 >Emitted(5, 27) Source(12, 29) + SourceIndex(0) +6 >Emitted(5, 29) Source(12, 31) + SourceIndex(0) +7 >Emitted(5, 50) Source(12, 44) + SourceIndex(0) +8 >Emitted(5, 51) Source(12, 56) + SourceIndex(0) +--- +>>>var c, _a = { name: "Edger", skill: "cutting edges" }, nameC = _a.name, skillC = _a.skill; +1-> +2 >^^^^ +3 > ^ +4 > ^^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^^^ +10> ^ +1-> + > +2 >var +3 > c: string +4 > , +5 > { name: nameC, skill: skillC } = { name: "Edger", skill: "cutting edges" } +6 > +7 > name: nameC +8 > , +9 > skill: skillC +10> } = { name: "Edger", skill: "cutting edges" }; +1->Emitted(6, 1) Source(13, 1) + SourceIndex(0) +2 >Emitted(6, 5) Source(13, 5) + SourceIndex(0) +3 >Emitted(6, 6) Source(13, 14) + SourceIndex(0) +4 >Emitted(6, 8) Source(13, 16) + SourceIndex(0) +5 >Emitted(6, 54) Source(13, 90) + SourceIndex(0) +6 >Emitted(6, 56) Source(13, 18) + SourceIndex(0) +7 >Emitted(6, 71) Source(13, 29) + SourceIndex(0) +8 >Emitted(6, 73) Source(13, 31) + SourceIndex(0) +9 >Emitted(6, 90) Source(13, 44) + SourceIndex(0) +10>Emitted(6, 91) Source(13, 91) + SourceIndex(0) +--- +>>>var nameA = robotA.name, a = hello; +1 > +2 >^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^ +5 > ^^^ +6 > ^^^^^ +7 > ^ +8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > + >var { +2 >name: nameA +3 > } = robotA, +4 > a +5 > = +6 > hello +7 > ; +1 >Emitted(7, 1) Source(15, 7) + SourceIndex(0) +2 >Emitted(7, 24) Source(15, 18) + SourceIndex(0) +3 >Emitted(7, 26) Source(15, 31) + SourceIndex(0) +4 >Emitted(7, 27) Source(15, 32) + SourceIndex(0) +5 >Emitted(7, 30) Source(15, 35) + SourceIndex(0) +6 >Emitted(7, 35) Source(15, 40) + SourceIndex(0) +7 >Emitted(7, 36) Source(15, 41) + SourceIndex(0) +--- +>>>var nameB = robotB.name, skillB = robotB.skill, b = " hello"; +1-> +2 >^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^ +7 > ^^^ +8 > ^^^^^^^^ +9 > ^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + >var { +2 >name: nameB +3 > , +4 > skill: skillB +5 > } = robotB, +6 > b +7 > = +8 > " hello" +9 > ; +1->Emitted(8, 1) Source(16, 7) + SourceIndex(0) +2 >Emitted(8, 24) Source(16, 18) + SourceIndex(0) +3 >Emitted(8, 26) Source(16, 20) + SourceIndex(0) +4 >Emitted(8, 47) Source(16, 33) + SourceIndex(0) +5 >Emitted(8, 49) Source(16, 46) + SourceIndex(0) +6 >Emitted(8, 50) Source(16, 47) + SourceIndex(0) +7 >Emitted(8, 53) Source(16, 50) + SourceIndex(0) +8 >Emitted(8, 61) Source(16, 58) + SourceIndex(0) +9 >Emitted(8, 62) Source(16, 59) + SourceIndex(0) +--- +>>>var _b = { name: "Edger", skill: "cutting edges" }, nameC = _b.name, skillC = _b.skill, c = hello; +1-> +2 >^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +4 > ^^ +5 > ^^^^^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^ +10> ^^^ +11> ^^^^^ +12> ^ +1-> + > +2 > +3 > var { name: nameC, skill: skillC } = { name: "Edger", skill: "cutting edges" } +4 > +5 > name: nameC +6 > , +7 > skill: skillC +8 > } = { name: "Edger", skill: "cutting edges" }, +9 > c +10> = +11> hello +12> ; +1->Emitted(9, 1) Source(17, 1) + SourceIndex(0) +2 >Emitted(9, 5) Source(17, 1) + SourceIndex(0) +3 >Emitted(9, 51) Source(17, 79) + SourceIndex(0) +4 >Emitted(9, 53) Source(17, 7) + SourceIndex(0) +5 >Emitted(9, 68) Source(17, 18) + SourceIndex(0) +6 >Emitted(9, 70) Source(17, 20) + SourceIndex(0) +7 >Emitted(9, 87) Source(17, 33) + SourceIndex(0) +8 >Emitted(9, 89) Source(17, 81) + SourceIndex(0) +9 >Emitted(9, 90) Source(17, 82) + SourceIndex(0) +10>Emitted(9, 93) Source(17, 85) + SourceIndex(0) +11>Emitted(9, 98) Source(17, 90) + SourceIndex(0) +12>Emitted(9, 99) Source(17, 91) + SourceIndex(0) +--- +>>>var a = hello, nameA = robotA.name, a1 = "hello"; +1 > +2 >^^^^ +3 > ^ +4 > ^^^ +5 > ^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^ +10> ^^^ +11> ^^^^^^^ +12> ^ +13> ^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > + > +2 >var +3 > a +4 > = +5 > hello +6 > , { +7 > name: nameA +8 > } = robotA, +9 > a1 +10> = +11> "hello" +12> ; +1 >Emitted(10, 1) Source(19, 1) + SourceIndex(0) +2 >Emitted(10, 5) Source(19, 5) + SourceIndex(0) +3 >Emitted(10, 6) Source(19, 6) + SourceIndex(0) +4 >Emitted(10, 9) Source(19, 9) + SourceIndex(0) +5 >Emitted(10, 14) Source(19, 14) + SourceIndex(0) +6 >Emitted(10, 16) Source(19, 18) + SourceIndex(0) +7 >Emitted(10, 35) Source(19, 29) + SourceIndex(0) +8 >Emitted(10, 37) Source(19, 42) + SourceIndex(0) +9 >Emitted(10, 39) Source(19, 44) + SourceIndex(0) +10>Emitted(10, 42) Source(19, 46) + SourceIndex(0) +11>Emitted(10, 49) Source(19, 53) + SourceIndex(0) +12>Emitted(10, 50) Source(19, 54) + SourceIndex(0) +--- +>>>var b = hello, nameB = robotB.name, skillB = robotB.skill, b1 = "hello"; +1-> +2 >^^^^ +3 > ^ +4 > ^^^ +5 > ^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^^^^^^^ +10> ^^ +11> ^^ +12> ^^^ +13> ^^^^^^^ +14> ^ +15> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >var +3 > b +4 > = +5 > hello +6 > , { +7 > name: nameB +8 > , +9 > skill: skillB +10> } = robotB, +11> b1 +12> = +13> "hello" +14> ; +1->Emitted(11, 1) Source(20, 1) + SourceIndex(0) +2 >Emitted(11, 5) Source(20, 5) + SourceIndex(0) +3 >Emitted(11, 6) Source(20, 6) + SourceIndex(0) +4 >Emitted(11, 9) Source(20, 9) + SourceIndex(0) +5 >Emitted(11, 14) Source(20, 14) + SourceIndex(0) +6 >Emitted(11, 16) Source(20, 18) + SourceIndex(0) +7 >Emitted(11, 35) Source(20, 29) + SourceIndex(0) +8 >Emitted(11, 37) Source(20, 31) + SourceIndex(0) +9 >Emitted(11, 58) Source(20, 44) + SourceIndex(0) +10>Emitted(11, 60) Source(20, 57) + SourceIndex(0) +11>Emitted(11, 62) Source(20, 59) + SourceIndex(0) +12>Emitted(11, 65) Source(20, 62) + SourceIndex(0) +13>Emitted(11, 72) Source(20, 69) + SourceIndex(0) +14>Emitted(11, 73) Source(20, 70) + SourceIndex(0) +--- +>>>var c = hello, _c = { name: "Edger", skill: "cutting edges" }, nameC = _c.name, skillC = _c.skill, c1 = hello; +1-> +2 >^^^^ +3 > ^ +4 > ^^^ +5 > ^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^ +10> ^^ +11> ^^^^^^^^^^^^^^^^^ +12> ^^ +13> ^^ +14> ^^^ +15> ^^^^^ +16> ^ +1-> + > +2 >var +3 > c +4 > = +5 > hello +6 > , +7 > { name: nameC, skill: skillC } = { name: "Edger", skill: "cutting edges" } +8 > +9 > name: nameC +10> , +11> skill: skillC +12> } = { name: "Edger", skill: "cutting edges" }, +13> c1 +14> = +15> hello +16> ; +1->Emitted(12, 1) Source(21, 1) + SourceIndex(0) +2 >Emitted(12, 5) Source(21, 5) + SourceIndex(0) +3 >Emitted(12, 6) Source(21, 6) + SourceIndex(0) +4 >Emitted(12, 9) Source(21, 9) + SourceIndex(0) +5 >Emitted(12, 14) Source(21, 14) + SourceIndex(0) +6 >Emitted(12, 16) Source(21, 16) + SourceIndex(0) +7 >Emitted(12, 62) Source(21, 90) + SourceIndex(0) +8 >Emitted(12, 64) Source(21, 18) + SourceIndex(0) +9 >Emitted(12, 79) Source(21, 29) + SourceIndex(0) +10>Emitted(12, 81) Source(21, 31) + SourceIndex(0) +11>Emitted(12, 98) Source(21, 44) + SourceIndex(0) +12>Emitted(12, 100) Source(21, 92) + SourceIndex(0) +13>Emitted(12, 102) Source(21, 94) + SourceIndex(0) +14>Emitted(12, 105) Source(21, 97) + SourceIndex(0) +15>Emitted(12, 110) Source(21, 102) + SourceIndex(0) +16>Emitted(12, 111) Source(21, 103) + SourceIndex(0) +--- +>>>if (nameA == nameB) { +1 > +2 >^^ +3 > ^ +4 > ^ +5 > ^^^^^ +6 > ^^^^ +7 > ^^^^^ +8 > ^ +9 > ^ +10> ^ +11> ^^^^-> +1 > + > +2 >if +3 > +4 > ( +5 > nameA +6 > == +7 > nameB +8 > ) +9 > +10> { +1 >Emitted(13, 1) Source(22, 1) + SourceIndex(0) +2 >Emitted(13, 3) Source(22, 3) + SourceIndex(0) +3 >Emitted(13, 4) Source(22, 4) + SourceIndex(0) +4 >Emitted(13, 5) Source(22, 5) + SourceIndex(0) +5 >Emitted(13, 10) Source(22, 10) + SourceIndex(0) +6 >Emitted(13, 14) Source(22, 14) + SourceIndex(0) +7 >Emitted(13, 19) Source(22, 19) + SourceIndex(0) +8 >Emitted(13, 20) Source(22, 20) + SourceIndex(0) +9 >Emitted(13, 21) Source(22, 21) + SourceIndex(0) +10>Emitted(13, 22) Source(22, 22) + SourceIndex(0) +--- +>>> console.log(skillB); +1->^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^ +7 > ^ +8 > ^ +1-> + > +2 > console +3 > . +4 > log +5 > ( +6 > skillB +7 > ) +8 > ; +1->Emitted(14, 5) Source(23, 5) + SourceIndex(0) +2 >Emitted(14, 12) Source(23, 12) + SourceIndex(0) +3 >Emitted(14, 13) Source(23, 13) + SourceIndex(0) +4 >Emitted(14, 16) Source(23, 16) + SourceIndex(0) +5 >Emitted(14, 17) Source(23, 17) + SourceIndex(0) +6 >Emitted(14, 23) Source(23, 23) + SourceIndex(0) +7 >Emitted(14, 24) Source(23, 24) + SourceIndex(0) +8 >Emitted(14, 25) Source(23, 25) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^-> +1 > + > +2 >} +1 >Emitted(15, 1) Source(24, 1) + SourceIndex(0) +2 >Emitted(15, 2) Source(24, 2) + SourceIndex(0) +--- +>>>else { +1-> +2 >^^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >else +3 > +4 > { +1->Emitted(16, 1) Source(25, 1) + SourceIndex(0) +2 >Emitted(16, 5) Source(25, 5) + SourceIndex(0) +3 >Emitted(16, 6) Source(25, 6) + SourceIndex(0) +4 >Emitted(16, 7) Source(25, 7) + SourceIndex(0) +--- +>>> console.log(nameC); +1->^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1-> + > +2 > console +3 > . +4 > log +5 > ( +6 > nameC +7 > ) +8 > ; +1->Emitted(17, 5) Source(26, 5) + SourceIndex(0) +2 >Emitted(17, 12) Source(26, 12) + SourceIndex(0) +3 >Emitted(17, 13) Source(26, 13) + SourceIndex(0) +4 >Emitted(17, 16) Source(26, 16) + SourceIndex(0) +5 >Emitted(17, 17) Source(26, 17) + SourceIndex(0) +6 >Emitted(17, 22) Source(26, 22) + SourceIndex(0) +7 >Emitted(17, 23) Source(26, 23) + SourceIndex(0) +8 >Emitted(17, 24) Source(26, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(18, 1) Source(27, 1) + SourceIndex(0) +2 >Emitted(18, 2) Source(27, 2) + SourceIndex(0) +--- +>>>//# sourceMappingURL=sourceMapValidationDestructuringVariableStatement1.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatement1.symbols b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatement1.symbols new file mode 100644 index 00000000000..fd8995cc3ba --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatement1.symbols @@ -0,0 +1,127 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringVariableStatement1.ts === +interface Robot { +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 0, 0)) + + name: string; +>name : Symbol(Robot.name, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 0, 17)) + + skill: string; +>skill : Symbol(Robot.skill, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 1, 17)) +} +declare var console: { +>console : Symbol(console, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 4, 11)) + + log(msg: string): void; +>log : Symbol(log, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 4, 22)) +>msg : Symbol(msg, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 5, 8)) +} +var hello = "hello"; +>hello : Symbol(hello, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 7, 3)) + +var robotA: Robot = { name: "mower", skill: "mowing" }; +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 8, 3)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 0, 0)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 8, 21)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 8, 36)) + +var robotB: Robot = { name: "trimmer", skill: "trimming" }; +>robotB : Symbol(robotB, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 9, 3)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 0, 0)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 9, 21)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 9, 38)) + +var a: string, { name: nameA } = robotA; +>a : Symbol(a, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 10, 3), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 14, 29), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 18, 3)) +>name : Symbol(Robot.name, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 0, 17)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 10, 16), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 14, 5), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 18, 16)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 8, 3)) + +var b: string, { name: nameB, skill: skillB } = robotB; +>b : Symbol(b, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 11, 3), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 15, 44), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 19, 3)) +>name : Symbol(Robot.name, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 0, 17)) +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 11, 16), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 15, 5), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 19, 16)) +>skill : Symbol(Robot.skill, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 1, 17)) +>skillB : Symbol(skillB, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 11, 29), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 15, 18), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 19, 29)) +>robotB : Symbol(robotB, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 9, 3)) + +var c: string, { name: nameC, skill: skillC } = { name: "Edger", skill: "cutting edges" }; +>c : Symbol(c, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 12, 3), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 16, 79), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 20, 3)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 12, 49)) +>nameC : Symbol(nameC, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 12, 16), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 16, 5), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 20, 16)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 12, 64)) +>skillC : Symbol(skillC, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 12, 29), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 16, 18), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 20, 29)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 12, 49)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 12, 64)) + +var { name: nameA } = robotA, a = hello; +>name : Symbol(Robot.name, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 0, 17)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 10, 16), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 14, 5), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 18, 16)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 8, 3)) +>a : Symbol(a, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 10, 3), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 14, 29), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 18, 3)) +>hello : Symbol(hello, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 7, 3)) + +var { name: nameB, skill: skillB } = robotB, b = " hello"; +>name : Symbol(Robot.name, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 0, 17)) +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 11, 16), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 15, 5), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 19, 16)) +>skill : Symbol(Robot.skill, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 1, 17)) +>skillB : Symbol(skillB, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 11, 29), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 15, 18), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 19, 29)) +>robotB : Symbol(robotB, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 9, 3)) +>b : Symbol(b, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 11, 3), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 15, 44), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 19, 3)) + +var { name: nameC, skill: skillC } = { name: "Edger", skill: "cutting edges" }, c = hello; +>name : Symbol(name, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 16, 38)) +>nameC : Symbol(nameC, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 12, 16), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 16, 5), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 20, 16)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 16, 53)) +>skillC : Symbol(skillC, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 12, 29), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 16, 18), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 20, 29)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 16, 38)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 16, 53)) +>c : Symbol(c, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 12, 3), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 16, 79), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 20, 3)) +>hello : Symbol(hello, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 7, 3)) + +var a = hello, { name: nameA } = robotA, a1= "hello"; +>a : Symbol(a, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 10, 3), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 14, 29), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 18, 3)) +>hello : Symbol(hello, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 7, 3)) +>name : Symbol(Robot.name, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 0, 17)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 10, 16), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 14, 5), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 18, 16)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 8, 3)) +>a1 : Symbol(a1, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 18, 40)) + +var b = hello, { name: nameB, skill: skillB } = robotB, b1 = "hello"; +>b : Symbol(b, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 11, 3), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 15, 44), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 19, 3)) +>hello : Symbol(hello, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 7, 3)) +>name : Symbol(Robot.name, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 0, 17)) +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 11, 16), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 15, 5), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 19, 16)) +>skill : Symbol(Robot.skill, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 1, 17)) +>skillB : Symbol(skillB, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 11, 29), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 15, 18), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 19, 29)) +>robotB : Symbol(robotB, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 9, 3)) +>b1 : Symbol(b1, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 19, 55)) + +var c = hello, { name: nameC, skill: skillC } = { name: "Edger", skill: "cutting edges" }, c1 = hello; +>c : Symbol(c, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 12, 3), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 16, 79), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 20, 3)) +>hello : Symbol(hello, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 7, 3)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 20, 49)) +>nameC : Symbol(nameC, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 12, 16), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 16, 5), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 20, 16)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 20, 64)) +>skillC : Symbol(skillC, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 12, 29), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 16, 18), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 20, 29)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 20, 49)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 20, 64)) +>c1 : Symbol(c1, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 20, 90)) +>hello : Symbol(hello, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 7, 3)) + +if (nameA == nameB) { +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 10, 16), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 14, 5), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 18, 16)) +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 11, 16), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 15, 5), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 19, 16)) + + console.log(skillB); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 4, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 4, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 4, 22)) +>skillB : Symbol(skillB, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 11, 29), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 15, 18), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 19, 29)) +} +else { + console.log(nameC); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 4, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 4, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 4, 22)) +>nameC : Symbol(nameC, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 12, 16), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 16, 5), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 20, 16)) +} diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatement1.types b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatement1.types new file mode 100644 index 00000000000..9d8023f5f74 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatement1.types @@ -0,0 +1,149 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringVariableStatement1.ts === +interface Robot { +>Robot : Robot + + name: string; +>name : string + + skill: string; +>skill : string +} +declare var console: { +>console : { log(msg: string): void; } + + log(msg: string): void; +>log : (msg: string) => void +>msg : string +} +var hello = "hello"; +>hello : string +>"hello" : string + +var robotA: Robot = { name: "mower", skill: "mowing" }; +>robotA : Robot +>Robot : Robot +>{ name: "mower", skill: "mowing" } : { name: string; skill: string; } +>name : string +>"mower" : string +>skill : string +>"mowing" : string + +var robotB: Robot = { name: "trimmer", skill: "trimming" }; +>robotB : Robot +>Robot : Robot +>{ name: "trimmer", skill: "trimming" } : { name: string; skill: string; } +>name : string +>"trimmer" : string +>skill : string +>"trimming" : string + +var a: string, { name: nameA } = robotA; +>a : string +>name : any +>nameA : string +>robotA : Robot + +var b: string, { name: nameB, skill: skillB } = robotB; +>b : string +>name : any +>nameB : string +>skill : any +>skillB : string +>robotB : Robot + +var c: string, { name: nameC, skill: skillC } = { name: "Edger", skill: "cutting edges" }; +>c : string +>name : any +>nameC : string +>skill : any +>skillC : string +>{ name: "Edger", skill: "cutting edges" } : { name: string; skill: string; } +>name : string +>"Edger" : string +>skill : string +>"cutting edges" : string + +var { name: nameA } = robotA, a = hello; +>name : any +>nameA : string +>robotA : Robot +>a : string +>hello : string + +var { name: nameB, skill: skillB } = robotB, b = " hello"; +>name : any +>nameB : string +>skill : any +>skillB : string +>robotB : Robot +>b : string +>" hello" : string + +var { name: nameC, skill: skillC } = { name: "Edger", skill: "cutting edges" }, c = hello; +>name : any +>nameC : string +>skill : any +>skillC : string +>{ name: "Edger", skill: "cutting edges" } : { name: string; skill: string; } +>name : string +>"Edger" : string +>skill : string +>"cutting edges" : string +>c : string +>hello : string + +var a = hello, { name: nameA } = robotA, a1= "hello"; +>a : string +>hello : string +>name : any +>nameA : string +>robotA : Robot +>a1 : string +>"hello" : string + +var b = hello, { name: nameB, skill: skillB } = robotB, b1 = "hello"; +>b : string +>hello : string +>name : any +>nameB : string +>skill : any +>skillB : string +>robotB : Robot +>b1 : string +>"hello" : string + +var c = hello, { name: nameC, skill: skillC } = { name: "Edger", skill: "cutting edges" }, c1 = hello; +>c : string +>hello : string +>name : any +>nameC : string +>skill : any +>skillC : string +>{ name: "Edger", skill: "cutting edges" } : { name: string; skill: string; } +>name : string +>"Edger" : string +>skill : string +>"cutting edges" : string +>c1 : string +>hello : string + +if (nameA == nameB) { +>nameA == nameB : boolean +>nameA : string +>nameB : string + + console.log(skillB); +>console.log(skillB) : void +>console.log : (msg: string) => void +>console : { log(msg: string): void; } +>log : (msg: string) => void +>skillB : string +} +else { + console.log(nameC); +>console.log(nameC) : void +>console.log : (msg: string) => void +>console : { log(msg: string): void; } +>log : (msg: string) => void +>nameC : string +} diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern.js b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern.js new file mode 100644 index 00000000000..fea40d4b900 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern.js @@ -0,0 +1,35 @@ +//// [sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts] +declare var console: { + log(msg: string): void; +} +type Robot = [number, string, string]; +var robotA: Robot = [1, "mower", "mowing"]; +var robotB: Robot = [2, "trimmer", "trimming"]; + + +let [, nameA] = robotA; +let [numberB] = robotB; +let [numberA2, nameA2, skillA2] = robotA; + +let [numberC2] = [3, "edging", "Trimming edges"]; +let [numberC, nameC, skillC] = [3, "edging", "Trimming edges"]; + +let [numberA3, ...robotAInfo] = robotA; + +if (nameA == nameA2) { + console.log(skillA2); +} + +//// [sourceMapValidationDestructuringVariableStatementArrayBindingPattern.js] +var robotA = [1, "mower", "mowing"]; +var robotB = [2, "trimmer", "trimming"]; +var nameA = robotA[1]; +var numberB = robotB[0]; +var numberA2 = robotA[0], nameA2 = robotA[1], skillA2 = robotA[2]; +var numberC2 = [3, "edging", "Trimming edges"][0]; +var _a = [3, "edging", "Trimming edges"], numberC = _a[0], nameC = _a[1], skillC = _a[2]; +var numberA3 = robotA[0], robotAInfo = robotA.slice(1); +if (nameA == nameA2) { + console.log(skillA2); +} +//# sourceMappingURL=sourceMapValidationDestructuringVariableStatementArrayBindingPattern.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern.js.map b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern.js.map new file mode 100644 index 00000000000..cf91be353da --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern.js.map @@ -0,0 +1,2 @@ +//// [sourceMapValidationDestructuringVariableStatementArrayBindingPattern.js.map] +{"version":3,"file":"sourceMapValidationDestructuringVariableStatementArrayBindingPattern.js","sourceRoot":"","sources":["sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts"],"names":[],"mappings":"AAIA,IAAI,MAAM,GAAU,CAAC,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;AAC3C,IAAI,MAAM,GAAU,CAAC,CAAC,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;AAGxC,qBAAK,CAAW;AAClB,uBAAO,CAAW;AAClB,wBAAQ,EAAE,kBAAM,EAAE,mBAAO,CAAW;AAEpC,iDAAQ,CAAoC;AACjD,IAAA,oCAA8D,EAAzD,eAAO,EAAE,aAAK,EAAE,cAAM,CAAoC;AAE1D,wBAAQ,EAAE,4BAAa,CAAW;AAEvC,EAAE,CAAC,CAAC,KAAK,IAAI,MAAM,CAAC,CAAC,CAAC;IAClB,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AACzB,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern.sourcemap.txt b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern.sourcemap.txt new file mode 100644 index 00000000000..43bcf108a9d --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern.sourcemap.txt @@ -0,0 +1,283 @@ +=================================================================== +JsFile: sourceMapValidationDestructuringVariableStatementArrayBindingPattern.js +mapUrl: sourceMapValidationDestructuringVariableStatementArrayBindingPattern.js.map +sourceRoot: +sources: sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPattern.js +sourceFile:sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts +------------------------------------------------------------------- +>>>var robotA = [1, "mower", "mowing"]; +1 > +2 >^^^^ +3 > ^^^^^^ +4 > ^^^ +5 > ^ +6 > ^ +7 > ^^ +8 > ^^^^^^^ +9 > ^^ +10> ^^^^^^^^ +11> ^ +12> ^ +13> ^^^^^-> +1 >declare var console: { + > log(msg: string): void; + >} + >type Robot = [number, string, string]; + > +2 >var +3 > robotA +4 > : Robot = +5 > [ +6 > 1 +7 > , +8 > "mower" +9 > , +10> "mowing" +11> ] +12> ; +1 >Emitted(1, 1) Source(5, 1) + SourceIndex(0) +2 >Emitted(1, 5) Source(5, 5) + SourceIndex(0) +3 >Emitted(1, 11) Source(5, 11) + SourceIndex(0) +4 >Emitted(1, 14) Source(5, 21) + SourceIndex(0) +5 >Emitted(1, 15) Source(5, 22) + SourceIndex(0) +6 >Emitted(1, 16) Source(5, 23) + SourceIndex(0) +7 >Emitted(1, 18) Source(5, 25) + SourceIndex(0) +8 >Emitted(1, 25) Source(5, 32) + SourceIndex(0) +9 >Emitted(1, 27) Source(5, 34) + SourceIndex(0) +10>Emitted(1, 35) Source(5, 42) + SourceIndex(0) +11>Emitted(1, 36) Source(5, 43) + SourceIndex(0) +12>Emitted(1, 37) Source(5, 44) + SourceIndex(0) +--- +>>>var robotB = [2, "trimmer", "trimming"]; +1-> +2 >^^^^ +3 > ^^^^^^ +4 > ^^^ +5 > ^ +6 > ^ +7 > ^^ +8 > ^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^ +11> ^ +12> ^ +1-> + > +2 >var +3 > robotB +4 > : Robot = +5 > [ +6 > 2 +7 > , +8 > "trimmer" +9 > , +10> "trimming" +11> ] +12> ; +1->Emitted(2, 1) Source(6, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(6, 5) + SourceIndex(0) +3 >Emitted(2, 11) Source(6, 11) + SourceIndex(0) +4 >Emitted(2, 14) Source(6, 21) + SourceIndex(0) +5 >Emitted(2, 15) Source(6, 22) + SourceIndex(0) +6 >Emitted(2, 16) Source(6, 23) + SourceIndex(0) +7 >Emitted(2, 18) Source(6, 25) + SourceIndex(0) +8 >Emitted(2, 27) Source(6, 34) + SourceIndex(0) +9 >Emitted(2, 29) Source(6, 36) + SourceIndex(0) +10>Emitted(2, 39) Source(6, 46) + SourceIndex(0) +11>Emitted(2, 40) Source(6, 47) + SourceIndex(0) +12>Emitted(2, 41) Source(6, 48) + SourceIndex(0) +--- +>>>var nameA = robotA[1]; +1 > +2 >^^^^^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^^^-> +1 > + > + > + >let [, +2 >nameA +3 > ] = robotA; +1 >Emitted(3, 1) Source(9, 8) + SourceIndex(0) +2 >Emitted(3, 22) Source(9, 13) + SourceIndex(0) +3 >Emitted(3, 23) Source(9, 24) + SourceIndex(0) +--- +>>>var numberB = robotB[0]; +1-> +2 >^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + >let [ +2 >numberB +3 > ] = robotB; +1->Emitted(4, 1) Source(10, 6) + SourceIndex(0) +2 >Emitted(4, 24) Source(10, 13) + SourceIndex(0) +3 >Emitted(4, 25) Source(10, 24) + SourceIndex(0) +--- +>>>var numberA2 = robotA[0], nameA2 = robotA[1], skillA2 = robotA[2]; +1-> +2 >^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^ +7 > ^ +1-> + >let [ +2 >numberA2 +3 > , +4 > nameA2 +5 > , +6 > skillA2 +7 > ] = robotA; +1->Emitted(5, 1) Source(11, 6) + SourceIndex(0) +2 >Emitted(5, 25) Source(11, 14) + SourceIndex(0) +3 >Emitted(5, 27) Source(11, 16) + SourceIndex(0) +4 >Emitted(5, 45) Source(11, 22) + SourceIndex(0) +5 >Emitted(5, 47) Source(11, 24) + SourceIndex(0) +6 >Emitted(5, 66) Source(11, 31) + SourceIndex(0) +7 >Emitted(5, 67) Source(11, 42) + SourceIndex(0) +--- +>>>var numberC2 = [3, "edging", "Trimming edges"][0]; +1 > +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > + >let [ +2 >numberC2 +3 > ] = [3, "edging", "Trimming edges"]; +1 >Emitted(6, 1) Source(13, 6) + SourceIndex(0) +2 >Emitted(6, 50) Source(13, 14) + SourceIndex(0) +3 >Emitted(6, 51) Source(13, 50) + SourceIndex(0) +--- +>>>var _a = [3, "edging", "Trimming edges"], numberC = _a[0], nameC = _a[1], skillC = _a[2]; +1-> +2 >^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +4 > ^^ +5 > ^^^^^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^ +10> ^ +1-> + > +2 > +3 > let [numberC, nameC, skillC] = [3, "edging", "Trimming edges"] +4 > +5 > numberC +6 > , +7 > nameC +8 > , +9 > skillC +10> ] = [3, "edging", "Trimming edges"]; +1->Emitted(7, 1) Source(14, 1) + SourceIndex(0) +2 >Emitted(7, 5) Source(14, 1) + SourceIndex(0) +3 >Emitted(7, 41) Source(14, 63) + SourceIndex(0) +4 >Emitted(7, 43) Source(14, 6) + SourceIndex(0) +5 >Emitted(7, 58) Source(14, 13) + SourceIndex(0) +6 >Emitted(7, 60) Source(14, 15) + SourceIndex(0) +7 >Emitted(7, 73) Source(14, 20) + SourceIndex(0) +8 >Emitted(7, 75) Source(14, 22) + SourceIndex(0) +9 >Emitted(7, 89) Source(14, 28) + SourceIndex(0) +10>Emitted(7, 90) Source(14, 64) + SourceIndex(0) +--- +>>>var numberA3 = robotA[0], robotAInfo = robotA.slice(1); +1 > +2 >^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +5 > ^ +1 > + > + >let [ +2 >numberA3 +3 > , +4 > ...robotAInfo +5 > ] = robotA; +1 >Emitted(8, 1) Source(16, 6) + SourceIndex(0) +2 >Emitted(8, 25) Source(16, 14) + SourceIndex(0) +3 >Emitted(8, 27) Source(16, 16) + SourceIndex(0) +4 >Emitted(8, 55) Source(16, 29) + SourceIndex(0) +5 >Emitted(8, 56) Source(16, 40) + SourceIndex(0) +--- +>>>if (nameA == nameA2) { +1 > +2 >^^ +3 > ^ +4 > ^ +5 > ^^^^^ +6 > ^^^^ +7 > ^^^^^^ +8 > ^ +9 > ^ +10> ^ +11> ^^^^-> +1 > + > + > +2 >if +3 > +4 > ( +5 > nameA +6 > == +7 > nameA2 +8 > ) +9 > +10> { +1 >Emitted(9, 1) Source(18, 1) + SourceIndex(0) +2 >Emitted(9, 3) Source(18, 3) + SourceIndex(0) +3 >Emitted(9, 4) Source(18, 4) + SourceIndex(0) +4 >Emitted(9, 5) Source(18, 5) + SourceIndex(0) +5 >Emitted(9, 10) Source(18, 10) + SourceIndex(0) +6 >Emitted(9, 14) Source(18, 14) + SourceIndex(0) +7 >Emitted(9, 20) Source(18, 20) + SourceIndex(0) +8 >Emitted(9, 21) Source(18, 21) + SourceIndex(0) +9 >Emitted(9, 22) Source(18, 22) + SourceIndex(0) +10>Emitted(9, 23) Source(18, 23) + SourceIndex(0) +--- +>>> console.log(skillA2); +1->^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^ +7 > ^ +8 > ^ +1-> + > +2 > console +3 > . +4 > log +5 > ( +6 > skillA2 +7 > ) +8 > ; +1->Emitted(10, 5) Source(19, 5) + SourceIndex(0) +2 >Emitted(10, 12) Source(19, 12) + SourceIndex(0) +3 >Emitted(10, 13) Source(19, 13) + SourceIndex(0) +4 >Emitted(10, 16) Source(19, 16) + SourceIndex(0) +5 >Emitted(10, 17) Source(19, 17) + SourceIndex(0) +6 >Emitted(10, 24) Source(19, 24) + SourceIndex(0) +7 >Emitted(10, 25) Source(19, 25) + SourceIndex(0) +8 >Emitted(10, 26) Source(19, 26) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(11, 1) Source(20, 1) + SourceIndex(0) +2 >Emitted(11, 2) Source(20, 2) + SourceIndex(0) +--- +>>>//# sourceMappingURL=sourceMapValidationDestructuringVariableStatementArrayBindingPattern.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern.symbols b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern.symbols new file mode 100644 index 00000000000..943f9e1c400 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern.symbols @@ -0,0 +1,57 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts === +declare var console: { +>console : Symbol(console, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts, 0, 11)) + + log(msg: string): void; +>log : Symbol(log, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts, 0, 22)) +>msg : Symbol(msg, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts, 1, 8)) +} +type Robot = [number, string, string]; +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts, 2, 1)) + +var robotA: Robot = [1, "mower", "mowing"]; +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts, 4, 3)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts, 2, 1)) + +var robotB: Robot = [2, "trimmer", "trimming"]; +>robotB : Symbol(robotB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts, 5, 3)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts, 2, 1)) + + +let [, nameA] = robotA; +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts, 8, 6)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts, 4, 3)) + +let [numberB] = robotB; +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts, 9, 5)) +>robotB : Symbol(robotB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts, 5, 3)) + +let [numberA2, nameA2, skillA2] = robotA; +>numberA2 : Symbol(numberA2, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts, 10, 5)) +>nameA2 : Symbol(nameA2, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts, 10, 14)) +>skillA2 : Symbol(skillA2, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts, 10, 22)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts, 4, 3)) + +let [numberC2] = [3, "edging", "Trimming edges"]; +>numberC2 : Symbol(numberC2, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts, 12, 5)) + +let [numberC, nameC, skillC] = [3, "edging", "Trimming edges"]; +>numberC : Symbol(numberC, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts, 13, 5)) +>nameC : Symbol(nameC, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts, 13, 13)) +>skillC : Symbol(skillC, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts, 13, 20)) + +let [numberA3, ...robotAInfo] = robotA; +>numberA3 : Symbol(numberA3, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts, 15, 5)) +>robotAInfo : Symbol(robotAInfo, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts, 15, 14)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts, 4, 3)) + +if (nameA == nameA2) { +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts, 8, 6)) +>nameA2 : Symbol(nameA2, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts, 10, 14)) + + console.log(skillA2); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts, 0, 22)) +>skillA2 : Symbol(skillA2, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts, 10, 22)) +} diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern.types b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern.types new file mode 100644 index 00000000000..73006f4ec45 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern.types @@ -0,0 +1,76 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts === +declare var console: { +>console : { log(msg: string): void; } + + log(msg: string): void; +>log : (msg: string) => void +>msg : string +} +type Robot = [number, string, string]; +>Robot : [number, string, string] + +var robotA: Robot = [1, "mower", "mowing"]; +>robotA : [number, string, string] +>Robot : [number, string, string] +>[1, "mower", "mowing"] : [number, string, string] +>1 : number +>"mower" : string +>"mowing" : string + +var robotB: Robot = [2, "trimmer", "trimming"]; +>robotB : [number, string, string] +>Robot : [number, string, string] +>[2, "trimmer", "trimming"] : [number, string, string] +>2 : number +>"trimmer" : string +>"trimming" : string + + +let [, nameA] = robotA; +> : undefined +>nameA : string +>robotA : [number, string, string] + +let [numberB] = robotB; +>numberB : number +>robotB : [number, string, string] + +let [numberA2, nameA2, skillA2] = robotA; +>numberA2 : number +>nameA2 : string +>skillA2 : string +>robotA : [number, string, string] + +let [numberC2] = [3, "edging", "Trimming edges"]; +>numberC2 : number +>[3, "edging", "Trimming edges"] : [number, string, string] +>3 : number +>"edging" : string +>"Trimming edges" : string + +let [numberC, nameC, skillC] = [3, "edging", "Trimming edges"]; +>numberC : number +>nameC : string +>skillC : string +>[3, "edging", "Trimming edges"] : [number, string, string] +>3 : number +>"edging" : string +>"Trimming edges" : string + +let [numberA3, ...robotAInfo] = robotA; +>numberA3 : number +>robotAInfo : (number | string)[] +>robotA : [number, string, string] + +if (nameA == nameA2) { +>nameA == nameA2 : boolean +>nameA : string +>nameA2 : string + + console.log(skillA2); +>console.log(skillA2) : void +>console.log : (msg: string) => void +>console : { log(msg: string): void; } +>log : (msg: string) => void +>skillA2 : string +} diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern2.js b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern2.js new file mode 100644 index 00000000000..b93acc66a10 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern2.js @@ -0,0 +1,34 @@ +//// [sourceMapValidationDestructuringVariableStatementArrayBindingPattern2.ts] +declare var console: { + log(msg: string): void; +} +type MultiSkilledRobot = [string, [string, string]]; +var multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; +var multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; + +let [, skillA] = multiRobotA; +let [nameMB] = multiRobotB; +let [nameMA, [primarySkillA, secondarySkillA]] = multiRobotA; + +let [nameMC] = ["roomba", ["vaccum", "mopping"]]; +let [nameMC2, [primarySkillC, secondarySkillC]] = ["roomba", ["vaccum", "mopping"]]; + +let [...multiRobotAInfo] = multiRobotA; + +if (nameMB == nameMA) { + console.log(skillA[0] + skillA[1]); +} + +//// [sourceMapValidationDestructuringVariableStatementArrayBindingPattern2.js] +var multiRobotA = ["mower", ["mowing", ""]]; +var multiRobotB = ["trimmer", ["trimming", "edging"]]; +var skillA = multiRobotA[1]; +var nameMB = multiRobotB[0]; +var nameMA = multiRobotA[0], _a = multiRobotA[1], primarySkillA = _a[0], secondarySkillA = _a[1]; +var nameMC = ["roomba", ["vaccum", "mopping"]][0]; +var _b = ["roomba", ["vaccum", "mopping"]], nameMC2 = _b[0], _c = _b[1], primarySkillC = _c[0], secondarySkillC = _c[1]; +var multiRobotAInfo = multiRobotA.slice(0); +if (nameMB == nameMA) { + console.log(skillA[0] + skillA[1]); +} +//# sourceMappingURL=sourceMapValidationDestructuringVariableStatementArrayBindingPattern2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern2.js.map b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern2.js.map new file mode 100644 index 00000000000..6d0bcc3b9b2 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern2.js.map @@ -0,0 +1,2 @@ +//// [sourceMapValidationDestructuringVariableStatementArrayBindingPattern2.js.map] +{"version":3,"file":"sourceMapValidationDestructuringVariableStatementArrayBindingPattern2.js","sourceRoot":"","sources":["sourceMapValidationDestructuringVariableStatementArrayBindingPattern2.ts"],"names":[],"mappings":"AAIA,IAAI,WAAW,GAAsB,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC;AAC/D,IAAI,WAAW,GAAsB,CAAC,SAAS,EAAE,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC,CAAC;AAElE,2BAAM,CAAgB;AACxB,2BAAM,CAAgB;AACtB,2BAAM,EAAE,mBAAgC,EAA/B,qBAAa,EAAE,uBAAe,CAAiB;AAExD,iDAAM,CAAsC;AACjD,IAAA,sCAAmF,EAA9E,eAAO,EAAE,UAAgC,EAA/B,qBAAa,EAAE,uBAAe,CAAuC;AAE/E,0CAAkB,CAAgB;AAEvC,EAAE,CAAC,CAAC,MAAM,IAAI,MAAM,CAAC,CAAC,CAAC;IACnB,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AACvC,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern2.sourcemap.txt b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern2.sourcemap.txt new file mode 100644 index 00000000000..64e22a28771 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern2.sourcemap.txt @@ -0,0 +1,324 @@ +=================================================================== +JsFile: sourceMapValidationDestructuringVariableStatementArrayBindingPattern2.js +mapUrl: sourceMapValidationDestructuringVariableStatementArrayBindingPattern2.js.map +sourceRoot: +sources: sourceMapValidationDestructuringVariableStatementArrayBindingPattern2.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPattern2.js +sourceFile:sourceMapValidationDestructuringVariableStatementArrayBindingPattern2.ts +------------------------------------------------------------------- +>>>var multiRobotA = ["mower", ["mowing", ""]]; +1 > +2 >^^^^ +3 > ^^^^^^^^^^^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^ +7 > ^^ +8 > ^ +9 > ^^^^^^^^ +10> ^^ +11> ^^ +12> ^ +13> ^ +14> ^ +15> ^^^^^^^^^^^-> +1 >declare var console: { + > log(msg: string): void; + >} + >type MultiSkilledRobot = [string, [string, string]]; + > +2 >var +3 > multiRobotA +4 > : MultiSkilledRobot = +5 > [ +6 > "mower" +7 > , +8 > [ +9 > "mowing" +10> , +11> "" +12> ] +13> ] +14> ; +1 >Emitted(1, 1) Source(5, 1) + SourceIndex(0) +2 >Emitted(1, 5) Source(5, 5) + SourceIndex(0) +3 >Emitted(1, 16) Source(5, 16) + SourceIndex(0) +4 >Emitted(1, 19) Source(5, 38) + SourceIndex(0) +5 >Emitted(1, 20) Source(5, 39) + SourceIndex(0) +6 >Emitted(1, 27) Source(5, 46) + SourceIndex(0) +7 >Emitted(1, 29) Source(5, 48) + SourceIndex(0) +8 >Emitted(1, 30) Source(5, 49) + SourceIndex(0) +9 >Emitted(1, 38) Source(5, 57) + SourceIndex(0) +10>Emitted(1, 40) Source(5, 59) + SourceIndex(0) +11>Emitted(1, 42) Source(5, 61) + SourceIndex(0) +12>Emitted(1, 43) Source(5, 62) + SourceIndex(0) +13>Emitted(1, 44) Source(5, 63) + SourceIndex(0) +14>Emitted(1, 45) Source(5, 64) + SourceIndex(0) +--- +>>>var multiRobotB = ["trimmer", ["trimming", "edging"]]; +1-> +2 >^^^^ +3 > ^^^^^^^^^^^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^^ +7 > ^^ +8 > ^ +9 > ^^^^^^^^^^ +10> ^^ +11> ^^^^^^^^ +12> ^ +13> ^ +14> ^ +1-> + > +2 >var +3 > multiRobotB +4 > : MultiSkilledRobot = +5 > [ +6 > "trimmer" +7 > , +8 > [ +9 > "trimming" +10> , +11> "edging" +12> ] +13> ] +14> ; +1->Emitted(2, 1) Source(6, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(6, 5) + SourceIndex(0) +3 >Emitted(2, 16) Source(6, 16) + SourceIndex(0) +4 >Emitted(2, 19) Source(6, 38) + SourceIndex(0) +5 >Emitted(2, 20) Source(6, 39) + SourceIndex(0) +6 >Emitted(2, 29) Source(6, 48) + SourceIndex(0) +7 >Emitted(2, 31) Source(6, 50) + SourceIndex(0) +8 >Emitted(2, 32) Source(6, 51) + SourceIndex(0) +9 >Emitted(2, 42) Source(6, 61) + SourceIndex(0) +10>Emitted(2, 44) Source(6, 63) + SourceIndex(0) +11>Emitted(2, 52) Source(6, 71) + SourceIndex(0) +12>Emitted(2, 53) Source(6, 72) + SourceIndex(0) +13>Emitted(2, 54) Source(6, 73) + SourceIndex(0) +14>Emitted(2, 55) Source(6, 74) + SourceIndex(0) +--- +>>>var skillA = multiRobotA[1]; +1 > +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^-> +1 > + > + >let [, +2 >skillA +3 > ] = multiRobotA; +1 >Emitted(3, 1) Source(8, 8) + SourceIndex(0) +2 >Emitted(3, 28) Source(8, 14) + SourceIndex(0) +3 >Emitted(3, 29) Source(8, 30) + SourceIndex(0) +--- +>>>var nameMB = multiRobotB[0]; +1-> +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + >let [ +2 >nameMB +3 > ] = multiRobotB; +1->Emitted(4, 1) Source(9, 6) + SourceIndex(0) +2 >Emitted(4, 28) Source(9, 12) + SourceIndex(0) +3 >Emitted(4, 29) Source(9, 28) + SourceIndex(0) +--- +>>>var nameMA = multiRobotA[0], _a = multiRobotA[1], primarySkillA = _a[0], secondarySkillA = _a[1]; +1-> +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^^^^ +9 > ^ +1-> + >let [ +2 >nameMA +3 > , +4 > [primarySkillA, secondarySkillA] +5 > +6 > primarySkillA +7 > , +8 > secondarySkillA +9 > ]] = multiRobotA; +1->Emitted(5, 1) Source(10, 6) + SourceIndex(0) +2 >Emitted(5, 28) Source(10, 12) + SourceIndex(0) +3 >Emitted(5, 30) Source(10, 14) + SourceIndex(0) +4 >Emitted(5, 49) Source(10, 46) + SourceIndex(0) +5 >Emitted(5, 51) Source(10, 15) + SourceIndex(0) +6 >Emitted(5, 72) Source(10, 28) + SourceIndex(0) +7 >Emitted(5, 74) Source(10, 30) + SourceIndex(0) +8 >Emitted(5, 97) Source(10, 45) + SourceIndex(0) +9 >Emitted(5, 98) Source(10, 62) + SourceIndex(0) +--- +>>>var nameMC = ["roomba", ["vaccum", "mopping"]][0]; +1 > +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > + >let [ +2 >nameMC +3 > ] = ["roomba", ["vaccum", "mopping"]]; +1 >Emitted(6, 1) Source(12, 6) + SourceIndex(0) +2 >Emitted(6, 50) Source(12, 12) + SourceIndex(0) +3 >Emitted(6, 51) Source(12, 50) + SourceIndex(0) +--- +>>>var _b = ["roomba", ["vaccum", "mopping"]], nameMC2 = _b[0], _c = _b[1], primarySkillC = _c[0], secondarySkillC = _c[1]; +1-> +2 >^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +4 > ^^ +5 > ^^^^^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^^^^^^^ +10> ^^ +11> ^^^^^^^^^^^^^^^^^^^^^^^ +12> ^ +1-> + > +2 > +3 > let [nameMC2, [primarySkillC, secondarySkillC]] = ["roomba", ["vaccum", "mopping"]] +4 > +5 > nameMC2 +6 > , +7 > [primarySkillC, secondarySkillC] +8 > +9 > primarySkillC +10> , +11> secondarySkillC +12> ]] = ["roomba", ["vaccum", "mopping"]]; +1->Emitted(7, 1) Source(13, 1) + SourceIndex(0) +2 >Emitted(7, 5) Source(13, 1) + SourceIndex(0) +3 >Emitted(7, 43) Source(13, 84) + SourceIndex(0) +4 >Emitted(7, 45) Source(13, 6) + SourceIndex(0) +5 >Emitted(7, 60) Source(13, 13) + SourceIndex(0) +6 >Emitted(7, 62) Source(13, 15) + SourceIndex(0) +7 >Emitted(7, 72) Source(13, 47) + SourceIndex(0) +8 >Emitted(7, 74) Source(13, 16) + SourceIndex(0) +9 >Emitted(7, 95) Source(13, 29) + SourceIndex(0) +10>Emitted(7, 97) Source(13, 31) + SourceIndex(0) +11>Emitted(7, 120) Source(13, 46) + SourceIndex(0) +12>Emitted(7, 121) Source(13, 85) + SourceIndex(0) +--- +>>>var multiRobotAInfo = multiRobotA.slice(0); +1 > +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^ +1 > + > + >let [ +2 >...multiRobotAInfo +3 > ] = multiRobotA; +1 >Emitted(8, 1) Source(15, 6) + SourceIndex(0) +2 >Emitted(8, 43) Source(15, 24) + SourceIndex(0) +3 >Emitted(8, 44) Source(15, 40) + SourceIndex(0) +--- +>>>if (nameMB == nameMA) { +1 > +2 >^^ +3 > ^ +4 > ^ +5 > ^^^^^^ +6 > ^^^^ +7 > ^^^^^^ +8 > ^ +9 > ^ +10> ^ +11> ^^^^^^^^^^^^^^^^^-> +1 > + > + > +2 >if +3 > +4 > ( +5 > nameMB +6 > == +7 > nameMA +8 > ) +9 > +10> { +1 >Emitted(9, 1) Source(17, 1) + SourceIndex(0) +2 >Emitted(9, 3) Source(17, 3) + SourceIndex(0) +3 >Emitted(9, 4) Source(17, 4) + SourceIndex(0) +4 >Emitted(9, 5) Source(17, 5) + SourceIndex(0) +5 >Emitted(9, 11) Source(17, 11) + SourceIndex(0) +6 >Emitted(9, 15) Source(17, 15) + SourceIndex(0) +7 >Emitted(9, 21) Source(17, 21) + SourceIndex(0) +8 >Emitted(9, 22) Source(17, 22) + SourceIndex(0) +9 >Emitted(9, 23) Source(17, 23) + SourceIndex(0) +10>Emitted(9, 24) Source(17, 24) + SourceIndex(0) +--- +>>> console.log(skillA[0] + skillA[1]); +1->^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^ +7 > ^ +8 > ^ +9 > ^ +10> ^^^ +11> ^^^^^^ +12> ^ +13> ^ +14> ^ +15> ^ +16> ^ +1-> + > +2 > console +3 > . +4 > log +5 > ( +6 > skillA +7 > [ +8 > 0 +9 > ] +10> + +11> skillA +12> [ +13> 1 +14> ] +15> ) +16> ; +1->Emitted(10, 5) Source(18, 5) + SourceIndex(0) +2 >Emitted(10, 12) Source(18, 12) + SourceIndex(0) +3 >Emitted(10, 13) Source(18, 13) + SourceIndex(0) +4 >Emitted(10, 16) Source(18, 16) + SourceIndex(0) +5 >Emitted(10, 17) Source(18, 17) + SourceIndex(0) +6 >Emitted(10, 23) Source(18, 23) + SourceIndex(0) +7 >Emitted(10, 24) Source(18, 24) + SourceIndex(0) +8 >Emitted(10, 25) Source(18, 25) + SourceIndex(0) +9 >Emitted(10, 26) Source(18, 26) + SourceIndex(0) +10>Emitted(10, 29) Source(18, 29) + SourceIndex(0) +11>Emitted(10, 35) Source(18, 35) + SourceIndex(0) +12>Emitted(10, 36) Source(18, 36) + SourceIndex(0) +13>Emitted(10, 37) Source(18, 37) + SourceIndex(0) +14>Emitted(10, 38) Source(18, 38) + SourceIndex(0) +15>Emitted(10, 39) Source(18, 39) + SourceIndex(0) +16>Emitted(10, 40) Source(18, 40) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(11, 1) Source(19, 1) + SourceIndex(0) +2 >Emitted(11, 2) Source(19, 2) + SourceIndex(0) +--- +>>>//# sourceMappingURL=sourceMapValidationDestructuringVariableStatementArrayBindingPattern2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern2.symbols b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern2.symbols new file mode 100644 index 00000000000..d2a61e2a5ef --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern2.symbols @@ -0,0 +1,58 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPattern2.ts === +declare var console: { +>console : Symbol(console, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern2.ts, 0, 11)) + + log(msg: string): void; +>log : Symbol(log, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern2.ts, 0, 22)) +>msg : Symbol(msg, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern2.ts, 1, 8)) +} +type MultiSkilledRobot = [string, [string, string]]; +>MultiSkilledRobot : Symbol(MultiSkilledRobot, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern2.ts, 2, 1)) + +var multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; +>multiRobotA : Symbol(multiRobotA, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern2.ts, 4, 3)) +>MultiSkilledRobot : Symbol(MultiSkilledRobot, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern2.ts, 2, 1)) + +var multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; +>multiRobotB : Symbol(multiRobotB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern2.ts, 5, 3)) +>MultiSkilledRobot : Symbol(MultiSkilledRobot, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern2.ts, 2, 1)) + +let [, skillA] = multiRobotA; +>skillA : Symbol(skillA, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern2.ts, 7, 6)) +>multiRobotA : Symbol(multiRobotA, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern2.ts, 4, 3)) + +let [nameMB] = multiRobotB; +>nameMB : Symbol(nameMB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern2.ts, 8, 5)) +>multiRobotB : Symbol(multiRobotB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern2.ts, 5, 3)) + +let [nameMA, [primarySkillA, secondarySkillA]] = multiRobotA; +>nameMA : Symbol(nameMA, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern2.ts, 9, 5)) +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern2.ts, 9, 14)) +>secondarySkillA : Symbol(secondarySkillA, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern2.ts, 9, 28)) +>multiRobotA : Symbol(multiRobotA, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern2.ts, 4, 3)) + +let [nameMC] = ["roomba", ["vaccum", "mopping"]]; +>nameMC : Symbol(nameMC, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern2.ts, 11, 5)) + +let [nameMC2, [primarySkillC, secondarySkillC]] = ["roomba", ["vaccum", "mopping"]]; +>nameMC2 : Symbol(nameMC2, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern2.ts, 12, 5)) +>primarySkillC : Symbol(primarySkillC, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern2.ts, 12, 15)) +>secondarySkillC : Symbol(secondarySkillC, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern2.ts, 12, 29)) + +let [...multiRobotAInfo] = multiRobotA; +>multiRobotAInfo : Symbol(multiRobotAInfo, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern2.ts, 14, 5)) +>multiRobotA : Symbol(multiRobotA, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern2.ts, 4, 3)) + +if (nameMB == nameMA) { +>nameMB : Symbol(nameMB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern2.ts, 8, 5)) +>nameMA : Symbol(nameMA, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern2.ts, 9, 5)) + + console.log(skillA[0] + skillA[1]); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern2.ts, 0, 22)) +>skillA : Symbol(skillA, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern2.ts, 7, 6)) +>0 : Symbol(0) +>skillA : Symbol(skillA, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern2.ts, 7, 6)) +>1 : Symbol(1) +} diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern2.types b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern2.types new file mode 100644 index 00000000000..57d4b271c2f --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern2.types @@ -0,0 +1,84 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPattern2.ts === +declare var console: { +>console : { log(msg: string): void; } + + log(msg: string): void; +>log : (msg: string) => void +>msg : string +} +type MultiSkilledRobot = [string, [string, string]]; +>MultiSkilledRobot : [string, [string, string]] + +var multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; +>multiRobotA : [string, [string, string]] +>MultiSkilledRobot : [string, [string, string]] +>["mower", ["mowing", ""]] : [string, [string, string]] +>"mower" : string +>["mowing", ""] : [string, string] +>"mowing" : string +>"" : string + +var multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; +>multiRobotB : [string, [string, string]] +>MultiSkilledRobot : [string, [string, string]] +>["trimmer", ["trimming", "edging"]] : [string, [string, string]] +>"trimmer" : string +>["trimming", "edging"] : [string, string] +>"trimming" : string +>"edging" : string + +let [, skillA] = multiRobotA; +> : undefined +>skillA : [string, string] +>multiRobotA : [string, [string, string]] + +let [nameMB] = multiRobotB; +>nameMB : string +>multiRobotB : [string, [string, string]] + +let [nameMA, [primarySkillA, secondarySkillA]] = multiRobotA; +>nameMA : string +>primarySkillA : string +>secondarySkillA : string +>multiRobotA : [string, [string, string]] + +let [nameMC] = ["roomba", ["vaccum", "mopping"]]; +>nameMC : string +>["roomba", ["vaccum", "mopping"]] : [string, string[]] +>"roomba" : string +>["vaccum", "mopping"] : string[] +>"vaccum" : string +>"mopping" : string + +let [nameMC2, [primarySkillC, secondarySkillC]] = ["roomba", ["vaccum", "mopping"]]; +>nameMC2 : string +>primarySkillC : string +>secondarySkillC : string +>["roomba", ["vaccum", "mopping"]] : [string, [string, string]] +>"roomba" : string +>["vaccum", "mopping"] : [string, string] +>"vaccum" : string +>"mopping" : string + +let [...multiRobotAInfo] = multiRobotA; +>multiRobotAInfo : (string | [string, string])[] +>multiRobotA : [string, [string, string]] + +if (nameMB == nameMA) { +>nameMB == nameMA : boolean +>nameMB : string +>nameMA : string + + console.log(skillA[0] + skillA[1]); +>console.log(skillA[0] + skillA[1]) : void +>console.log : (msg: string) => void +>console : { log(msg: string): void; } +>log : (msg: string) => void +>skillA[0] + skillA[1] : string +>skillA[0] : string +>skillA : [string, string] +>0 : number +>skillA[1] : string +>skillA : [string, string] +>1 : number +} diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.js b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.js new file mode 100644 index 00000000000..32862b978db --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.js @@ -0,0 +1,102 @@ +//// [sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts] +declare var console: { + log(msg: any): void; +} +type Robot = [number, string, string]; +type MultiSkilledRobot = [string, [string, string]]; + +var robotA: Robot = [1, "mower", "mowing"]; +var robotB: Robot = [2, "trimmer", "trimming"]; +var multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; +var multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; + +let nameA: string, numberB: number, nameB: string, skillB: string; +let robotAInfo: (number | string)[]; + +let multiSkillB: [string, string], nameMB: string, primarySkillB: string, secondarySkillB: string; +let multiRobotAInfo: (string | [string, string])[]; + +[, nameA] = robotA; +[, nameB] = getRobotB(); +[, nameB] = [2, "trimmer", "trimming"]; +[, multiSkillB] = multiRobotB; +[, multiSkillB] = getMultiRobotB(); +[, multiSkillB] = ["roomba", ["vaccum", "mopping"]]; + +[numberB] = robotB; +[numberB] = getRobotB(); +[numberB] = [2, "trimmer", "trimming"]; +[nameMB] = multiRobotB; +[nameMB] = getMultiRobotB(); +[nameMB] = ["trimmer", ["trimming", "edging"]]; + +[numberB, nameB, skillB] = robotB; +[numberB, nameB, skillB] = getRobotB(); +[numberB, nameB, skillB] = [2, "trimmer", "trimming"]; +[nameMB, [primarySkillB, secondarySkillB]] = multiRobotB; +[nameMB, [primarySkillB, secondarySkillB]] = getMultiRobotB(); +[nameMB, [primarySkillB, secondarySkillB]] = ["trimmer", ["trimming", "edging"]]; + +[numberB, ...robotAInfo] = robotB; +[numberB, ...robotAInfo] = getRobotB(); +[numberB, ...robotAInfo] = [2, "trimmer", "trimming"]; +[...multiRobotAInfo] = multiRobotA; +[...multiRobotAInfo] = getMultiRobotB(); +[...multiRobotAInfo] = ["trimmer", ["trimming", "edging"]]; + +if (nameA == nameB) { + console.log(skillB); +} + +function getRobotB() { + return robotB; +} + +function getMultiRobotB() { + return multiRobotB; +} + +//// [sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.js] +var robotA = [1, "mower", "mowing"]; +var robotB = [2, "trimmer", "trimming"]; +var multiRobotA = ["mower", ["mowing", ""]]; +var multiRobotB = ["trimmer", ["trimming", "edging"]]; +var nameA, numberB, nameB, skillB; +var robotAInfo; +var multiSkillB, nameMB, primarySkillB, secondarySkillB; +var multiRobotAInfo; +nameA = robotA[1]; +_a = getRobotB(), nameB = _a[1]; +_b = [2, "trimmer", "trimming"], nameB = _b[1]; +multiSkillB = multiRobotB[1]; +_c = getMultiRobotB(), multiSkillB = _c[1]; +_d = ["roomba", ["vaccum", "mopping"]], multiSkillB = _d[1]; +numberB = robotB[0]; +numberB = getRobotB()[0]; +numberB = [2, "trimmer", "trimming"][0]; +nameMB = multiRobotB[0]; +nameMB = getMultiRobotB()[0]; +nameMB = ["trimmer", ["trimming", "edging"]][0]; +numberB = robotB[0], nameB = robotB[1], skillB = robotB[2]; +_e = getRobotB(), numberB = _e[0], nameB = _e[1], skillB = _e[2]; +_f = [2, "trimmer", "trimming"], numberB = _f[0], nameB = _f[1], skillB = _f[2]; +nameMB = multiRobotB[0], _g = multiRobotB[1], primarySkillB = _g[0], secondarySkillB = _g[1]; +_h = getMultiRobotB(), nameMB = _h[0], _j = _h[1], primarySkillB = _j[0], secondarySkillB = _j[1]; +_k = ["trimmer", ["trimming", "edging"]], nameMB = _k[0], _l = _k[1], primarySkillB = _l[0], secondarySkillB = _l[1]; +numberB = robotB[0], robotAInfo = robotB.slice(1); +_m = getRobotB(), numberB = _m[0], robotAInfo = _m.slice(1); +_o = [2, "trimmer", "trimming"], numberB = _o[0], robotAInfo = _o.slice(1); +multiRobotAInfo = multiRobotA.slice(0); +multiRobotAInfo = getMultiRobotB().slice(0); +multiRobotAInfo = ["trimmer", ["trimming", "edging"]].slice(0); +if (nameA == nameB) { + console.log(skillB); +} +function getRobotB() { + return robotB; +} +function getMultiRobotB() { + return multiRobotB; +} +var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o; +//# sourceMappingURL=sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.js.map b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.js.map new file mode 100644 index 00000000000..1b6c788952d --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.js.map @@ -0,0 +1,2 @@ +//// [sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.js.map] +{"version":3,"file":"sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.js","sourceRoot":"","sources":["sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts"],"names":[],"mappings":"AAMA,IAAI,MAAM,GAAU,CAAC,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;AAC3C,IAAI,MAAM,GAAU,CAAC,CAAC,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;AAC/C,IAAI,WAAW,GAAsB,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC;AAC/D,IAAI,WAAW,GAAsB,CAAC,SAAS,EAAE,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC,CAAC;AAEzE,IAAI,KAAa,EAAE,OAAe,EAAE,KAAa,EAAE,MAAc,CAAC;AAClE,IAAI,UAA+B,CAAC;AAEpC,IAAI,WAA6B,EAAE,MAAc,EAAE,aAAqB,EAAE,eAAuB,CAAC;AAClG,IAAI,eAA8C,CAAC;AAEhD,iBAAK,CAAW;AACnB,gBAAuB,EAApB,aAAK,CAAgB;AACxB,+BAAsC,EAAnC,aAAK,CAA+B;AACpC,4BAAW,CAAgB;AAC9B,qBAAkC,EAA/B,mBAAW,CAAqB;AACnC,sCAAmD,EAAhD,mBAAW,CAAsC;AAEnD,mBAAO,CAAW;AAClB,wBAAO,CAAgB;AACvB,uCAAO,CAA+B;AACtC,uBAAM,CAAgB;AACtB,4BAAM,CAAqB;AAC3B,+CAAM,CAAwC;AAE9C,mBAAO,EAAE,iBAAK,EAAE,kBAAM,CAAW;AAClC,gBAAsC,EAArC,eAAO,EAAE,aAAK,EAAE,cAAM,CAAgB;AACvC,+BAAqD,EAApD,eAAO,EAAE,aAAK,EAAE,cAAM,CAA+B;AACrD,uBAAM,EAAE,mBAAgC,EAA/B,qBAAa,EAAE,uBAAe,CAAiB;AACzD,qBAA6D,EAA5D,cAAM,EAAE,UAAgC,EAA/B,qBAAa,EAAE,uBAAe,CAAsB;AAC9D,wCAAgF,EAA/E,cAAM,EAAE,UAAgC,EAA/B,qBAAa,EAAE,uBAAe,CAAyC;AAEhF,mBAAO,EAAE,4BAAa,CAAW;AAClC,gBAAsC,EAArC,eAAO,EAAE,wBAAa,CAAgB;AACvC,+BAA4D,EAA3D,eAAO,EAAE,wBAAa,CAAsC;AAC5D,sCAAkB,CAAgB;AAClC,2CAAkB,CAAqB;AACvC,8DAAkB,CAAwC;AAE3D,EAAE,CAAC,CAAC,KAAK,IAAI,KAAK,CAAC,CAAC,CAAC;IACjB,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACxB,CAAC;AAED;IACI,MAAM,CAAC,MAAM,CAAC;AAClB,CAAC;AAED;IACI,MAAM,CAAC,WAAW,CAAC;AACvB,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.sourcemap.txt b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.sourcemap.txt new file mode 100644 index 00000000000..466b36630c3 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.sourcemap.txt @@ -0,0 +1,909 @@ +=================================================================== +JsFile: sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.js +mapUrl: sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.js.map +sourceRoot: +sources: sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.js +sourceFile:sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts +------------------------------------------------------------------- +>>>var robotA = [1, "mower", "mowing"]; +1 > +2 >^^^^ +3 > ^^^^^^ +4 > ^^^ +5 > ^ +6 > ^ +7 > ^^ +8 > ^^^^^^^ +9 > ^^ +10> ^^^^^^^^ +11> ^ +12> ^ +13> ^^^^^-> +1 >declare var console: { + > log(msg: any): void; + >} + >type Robot = [number, string, string]; + >type MultiSkilledRobot = [string, [string, string]]; + > + > +2 >var +3 > robotA +4 > : Robot = +5 > [ +6 > 1 +7 > , +8 > "mower" +9 > , +10> "mowing" +11> ] +12> ; +1 >Emitted(1, 1) Source(7, 1) + SourceIndex(0) +2 >Emitted(1, 5) Source(7, 5) + SourceIndex(0) +3 >Emitted(1, 11) Source(7, 11) + SourceIndex(0) +4 >Emitted(1, 14) Source(7, 21) + SourceIndex(0) +5 >Emitted(1, 15) Source(7, 22) + SourceIndex(0) +6 >Emitted(1, 16) Source(7, 23) + SourceIndex(0) +7 >Emitted(1, 18) Source(7, 25) + SourceIndex(0) +8 >Emitted(1, 25) Source(7, 32) + SourceIndex(0) +9 >Emitted(1, 27) Source(7, 34) + SourceIndex(0) +10>Emitted(1, 35) Source(7, 42) + SourceIndex(0) +11>Emitted(1, 36) Source(7, 43) + SourceIndex(0) +12>Emitted(1, 37) Source(7, 44) + SourceIndex(0) +--- +>>>var robotB = [2, "trimmer", "trimming"]; +1-> +2 >^^^^ +3 > ^^^^^^ +4 > ^^^ +5 > ^ +6 > ^ +7 > ^^ +8 > ^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^ +11> ^ +12> ^ +13> ^^^^^-> +1-> + > +2 >var +3 > robotB +4 > : Robot = +5 > [ +6 > 2 +7 > , +8 > "trimmer" +9 > , +10> "trimming" +11> ] +12> ; +1->Emitted(2, 1) Source(8, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(8, 5) + SourceIndex(0) +3 >Emitted(2, 11) Source(8, 11) + SourceIndex(0) +4 >Emitted(2, 14) Source(8, 21) + SourceIndex(0) +5 >Emitted(2, 15) Source(8, 22) + SourceIndex(0) +6 >Emitted(2, 16) Source(8, 23) + SourceIndex(0) +7 >Emitted(2, 18) Source(8, 25) + SourceIndex(0) +8 >Emitted(2, 27) Source(8, 34) + SourceIndex(0) +9 >Emitted(2, 29) Source(8, 36) + SourceIndex(0) +10>Emitted(2, 39) Source(8, 46) + SourceIndex(0) +11>Emitted(2, 40) Source(8, 47) + SourceIndex(0) +12>Emitted(2, 41) Source(8, 48) + SourceIndex(0) +--- +>>>var multiRobotA = ["mower", ["mowing", ""]]; +1-> +2 >^^^^ +3 > ^^^^^^^^^^^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^ +7 > ^^ +8 > ^ +9 > ^^^^^^^^ +10> ^^ +11> ^^ +12> ^ +13> ^ +14> ^ +15> ^^^^^^^^^^^-> +1-> + > +2 >var +3 > multiRobotA +4 > : MultiSkilledRobot = +5 > [ +6 > "mower" +7 > , +8 > [ +9 > "mowing" +10> , +11> "" +12> ] +13> ] +14> ; +1->Emitted(3, 1) Source(9, 1) + SourceIndex(0) +2 >Emitted(3, 5) Source(9, 5) + SourceIndex(0) +3 >Emitted(3, 16) Source(9, 16) + SourceIndex(0) +4 >Emitted(3, 19) Source(9, 38) + SourceIndex(0) +5 >Emitted(3, 20) Source(9, 39) + SourceIndex(0) +6 >Emitted(3, 27) Source(9, 46) + SourceIndex(0) +7 >Emitted(3, 29) Source(9, 48) + SourceIndex(0) +8 >Emitted(3, 30) Source(9, 49) + SourceIndex(0) +9 >Emitted(3, 38) Source(9, 57) + SourceIndex(0) +10>Emitted(3, 40) Source(9, 59) + SourceIndex(0) +11>Emitted(3, 42) Source(9, 61) + SourceIndex(0) +12>Emitted(3, 43) Source(9, 62) + SourceIndex(0) +13>Emitted(3, 44) Source(9, 63) + SourceIndex(0) +14>Emitted(3, 45) Source(9, 64) + SourceIndex(0) +--- +>>>var multiRobotB = ["trimmer", ["trimming", "edging"]]; +1-> +2 >^^^^ +3 > ^^^^^^^^^^^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^^ +7 > ^^ +8 > ^ +9 > ^^^^^^^^^^ +10> ^^ +11> ^^^^^^^^ +12> ^ +13> ^ +14> ^ +1-> + > +2 >var +3 > multiRobotB +4 > : MultiSkilledRobot = +5 > [ +6 > "trimmer" +7 > , +8 > [ +9 > "trimming" +10> , +11> "edging" +12> ] +13> ] +14> ; +1->Emitted(4, 1) Source(10, 1) + SourceIndex(0) +2 >Emitted(4, 5) Source(10, 5) + SourceIndex(0) +3 >Emitted(4, 16) Source(10, 16) + SourceIndex(0) +4 >Emitted(4, 19) Source(10, 38) + SourceIndex(0) +5 >Emitted(4, 20) Source(10, 39) + SourceIndex(0) +6 >Emitted(4, 29) Source(10, 48) + SourceIndex(0) +7 >Emitted(4, 31) Source(10, 50) + SourceIndex(0) +8 >Emitted(4, 32) Source(10, 51) + SourceIndex(0) +9 >Emitted(4, 42) Source(10, 61) + SourceIndex(0) +10>Emitted(4, 44) Source(10, 63) + SourceIndex(0) +11>Emitted(4, 52) Source(10, 71) + SourceIndex(0) +12>Emitted(4, 53) Source(10, 72) + SourceIndex(0) +13>Emitted(4, 54) Source(10, 73) + SourceIndex(0) +14>Emitted(4, 55) Source(10, 74) + SourceIndex(0) +--- +>>>var nameA, numberB, nameB, skillB; +1 > +2 >^^^^ +3 > ^^^^^ +4 > ^^ +5 > ^^^^^^^ +6 > ^^ +7 > ^^^^^ +8 > ^^ +9 > ^^^^^^ +10> ^ +1 > + > + > +2 >let +3 > nameA: string +4 > , +5 > numberB: number +6 > , +7 > nameB: string +8 > , +9 > skillB: string +10> ; +1 >Emitted(5, 1) Source(12, 1) + SourceIndex(0) +2 >Emitted(5, 5) Source(12, 5) + SourceIndex(0) +3 >Emitted(5, 10) Source(12, 18) + SourceIndex(0) +4 >Emitted(5, 12) Source(12, 20) + SourceIndex(0) +5 >Emitted(5, 19) Source(12, 35) + SourceIndex(0) +6 >Emitted(5, 21) Source(12, 37) + SourceIndex(0) +7 >Emitted(5, 26) Source(12, 50) + SourceIndex(0) +8 >Emitted(5, 28) Source(12, 52) + SourceIndex(0) +9 >Emitted(5, 34) Source(12, 66) + SourceIndex(0) +10>Emitted(5, 35) Source(12, 67) + SourceIndex(0) +--- +>>>var robotAInfo; +1 > +2 >^^^^ +3 > ^^^^^^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >let +3 > robotAInfo: (number | string)[] +4 > ; +1 >Emitted(6, 1) Source(13, 1) + SourceIndex(0) +2 >Emitted(6, 5) Source(13, 5) + SourceIndex(0) +3 >Emitted(6, 15) Source(13, 36) + SourceIndex(0) +4 >Emitted(6, 16) Source(13, 37) + SourceIndex(0) +--- +>>>var multiSkillB, nameMB, primarySkillB, secondarySkillB; +1-> +2 >^^^^ +3 > ^^^^^^^^^^^ +4 > ^^ +5 > ^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^ +10> ^ +1-> + > + > +2 >let +3 > multiSkillB: [string, string] +4 > , +5 > nameMB: string +6 > , +7 > primarySkillB: string +8 > , +9 > secondarySkillB: string +10> ; +1->Emitted(7, 1) Source(15, 1) + SourceIndex(0) +2 >Emitted(7, 5) Source(15, 5) + SourceIndex(0) +3 >Emitted(7, 16) Source(15, 34) + SourceIndex(0) +4 >Emitted(7, 18) Source(15, 36) + SourceIndex(0) +5 >Emitted(7, 24) Source(15, 50) + SourceIndex(0) +6 >Emitted(7, 26) Source(15, 52) + SourceIndex(0) +7 >Emitted(7, 39) Source(15, 73) + SourceIndex(0) +8 >Emitted(7, 41) Source(15, 75) + SourceIndex(0) +9 >Emitted(7, 56) Source(15, 98) + SourceIndex(0) +10>Emitted(7, 57) Source(15, 99) + SourceIndex(0) +--- +>>>var multiRobotAInfo; +1 > +2 >^^^^ +3 > ^^^^^^^^^^^^^^^ +4 > ^ +1 > + > +2 >let +3 > multiRobotAInfo: (string | [string, string])[] +4 > ; +1 >Emitted(8, 1) Source(16, 1) + SourceIndex(0) +2 >Emitted(8, 5) Source(16, 5) + SourceIndex(0) +3 >Emitted(8, 20) Source(16, 51) + SourceIndex(0) +4 >Emitted(8, 21) Source(16, 52) + SourceIndex(0) +--- +>>>nameA = robotA[1]; +1 > +2 >^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^-> +1 > + > + >[, +2 >nameA +3 > ] = robotA; +1 >Emitted(9, 1) Source(18, 4) + SourceIndex(0) +2 >Emitted(9, 18) Source(18, 9) + SourceIndex(0) +3 >Emitted(9, 19) Source(18, 20) + SourceIndex(0) +--- +>>>_a = getRobotB(), nameB = _a[1]; +1-> +2 >^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^-> +1-> + > +2 >[, nameB] = getRobotB() +3 > +4 > nameB +5 > ] = getRobotB(); +1->Emitted(10, 1) Source(19, 1) + SourceIndex(0) +2 >Emitted(10, 17) Source(19, 24) + SourceIndex(0) +3 >Emitted(10, 19) Source(19, 4) + SourceIndex(0) +4 >Emitted(10, 32) Source(19, 9) + SourceIndex(0) +5 >Emitted(10, 33) Source(19, 25) + SourceIndex(0) +--- +>>>_b = [2, "trimmer", "trimming"], nameB = _b[1]; +1-> +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^ +5 > ^ +1-> + > +2 >[, nameB] = [2, "trimmer", "trimming"] +3 > +4 > nameB +5 > ] = [2, "trimmer", "trimming"]; +1->Emitted(11, 1) Source(20, 1) + SourceIndex(0) +2 >Emitted(11, 32) Source(20, 39) + SourceIndex(0) +3 >Emitted(11, 34) Source(20, 4) + SourceIndex(0) +4 >Emitted(11, 47) Source(20, 9) + SourceIndex(0) +5 >Emitted(11, 48) Source(20, 40) + SourceIndex(0) +--- +>>>multiSkillB = multiRobotB[1]; +1 > +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^-> +1 > + >[, +2 >multiSkillB +3 > ] = multiRobotB; +1 >Emitted(12, 1) Source(21, 4) + SourceIndex(0) +2 >Emitted(12, 29) Source(21, 15) + SourceIndex(0) +3 >Emitted(12, 30) Source(21, 31) + SourceIndex(0) +--- +>>>_c = getMultiRobotB(), multiSkillB = _c[1]; +1-> +2 >^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >[, multiSkillB] = getMultiRobotB() +3 > +4 > multiSkillB +5 > ] = getMultiRobotB(); +1->Emitted(13, 1) Source(22, 1) + SourceIndex(0) +2 >Emitted(13, 22) Source(22, 35) + SourceIndex(0) +3 >Emitted(13, 24) Source(22, 4) + SourceIndex(0) +4 >Emitted(13, 43) Source(22, 15) + SourceIndex(0) +5 >Emitted(13, 44) Source(22, 36) + SourceIndex(0) +--- +>>>_d = ["roomba", ["vaccum", "mopping"]], multiSkillB = _d[1]; +1-> +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^ +5 > ^ +1-> + > +2 >[, multiSkillB] = ["roomba", ["vaccum", "mopping"]] +3 > +4 > multiSkillB +5 > ] = ["roomba", ["vaccum", "mopping"]]; +1->Emitted(14, 1) Source(23, 1) + SourceIndex(0) +2 >Emitted(14, 39) Source(23, 52) + SourceIndex(0) +3 >Emitted(14, 41) Source(23, 4) + SourceIndex(0) +4 >Emitted(14, 60) Source(23, 15) + SourceIndex(0) +5 >Emitted(14, 61) Source(23, 53) + SourceIndex(0) +--- +>>>numberB = robotB[0]; +1 > +2 >^^^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^^^^^^-> +1 > + > + >[ +2 >numberB +3 > ] = robotB; +1 >Emitted(15, 1) Source(25, 2) + SourceIndex(0) +2 >Emitted(15, 20) Source(25, 9) + SourceIndex(0) +3 >Emitted(15, 21) Source(25, 20) + SourceIndex(0) +--- +>>>numberB = getRobotB()[0]; +1-> +2 >^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^-> +1-> + >[ +2 >numberB +3 > ] = getRobotB(); +1->Emitted(16, 1) Source(26, 2) + SourceIndex(0) +2 >Emitted(16, 25) Source(26, 9) + SourceIndex(0) +3 >Emitted(16, 26) Source(26, 25) + SourceIndex(0) +--- +>>>numberB = [2, "trimmer", "trimming"][0]; +1-> +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^ +1-> + >[ +2 >numberB +3 > ] = [2, "trimmer", "trimming"]; +1->Emitted(17, 1) Source(27, 2) + SourceIndex(0) +2 >Emitted(17, 40) Source(27, 9) + SourceIndex(0) +3 >Emitted(17, 41) Source(27, 40) + SourceIndex(0) +--- +>>>nameMB = multiRobotB[0]; +1 > +2 >^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^^^^^^-> +1 > + >[ +2 >nameMB +3 > ] = multiRobotB; +1 >Emitted(18, 1) Source(28, 2) + SourceIndex(0) +2 >Emitted(18, 24) Source(28, 8) + SourceIndex(0) +3 >Emitted(18, 25) Source(28, 24) + SourceIndex(0) +--- +>>>nameMB = getMultiRobotB()[0]; +1-> +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^-> +1-> + >[ +2 >nameMB +3 > ] = getMultiRobotB(); +1->Emitted(19, 1) Source(29, 2) + SourceIndex(0) +2 >Emitted(19, 29) Source(29, 8) + SourceIndex(0) +3 >Emitted(19, 30) Source(29, 29) + SourceIndex(0) +--- +>>>nameMB = ["trimmer", ["trimming", "edging"]][0]; +1-> +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^-> +1-> + >[ +2 >nameMB +3 > ] = ["trimmer", ["trimming", "edging"]]; +1->Emitted(20, 1) Source(30, 2) + SourceIndex(0) +2 >Emitted(20, 48) Source(30, 8) + SourceIndex(0) +3 >Emitted(20, 49) Source(30, 48) + SourceIndex(0) +--- +>>>numberB = robotB[0], nameB = robotB[1], skillB = robotB[2]; +1-> +2 >^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^ +7 > ^ +8 > ^^^^^^^-> +1-> + > + >[ +2 >numberB +3 > , +4 > nameB +5 > , +6 > skillB +7 > ] = robotB; +1->Emitted(21, 1) Source(32, 2) + SourceIndex(0) +2 >Emitted(21, 20) Source(32, 9) + SourceIndex(0) +3 >Emitted(21, 22) Source(32, 11) + SourceIndex(0) +4 >Emitted(21, 39) Source(32, 16) + SourceIndex(0) +5 >Emitted(21, 41) Source(32, 18) + SourceIndex(0) +6 >Emitted(21, 59) Source(32, 24) + SourceIndex(0) +7 >Emitted(21, 60) Source(32, 35) + SourceIndex(0) +--- +>>>_e = getRobotB(), numberB = _e[0], nameB = _e[1], skillB = _e[2]; +1-> +2 >^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^ +9 > ^ +10> ^^^^^^^^^^^^^^^^-> +1-> + > +2 >[numberB, nameB, skillB] = getRobotB() +3 > +4 > numberB +5 > , +6 > nameB +7 > , +8 > skillB +9 > ] = getRobotB(); +1->Emitted(22, 1) Source(33, 1) + SourceIndex(0) +2 >Emitted(22, 17) Source(33, 39) + SourceIndex(0) +3 >Emitted(22, 19) Source(33, 2) + SourceIndex(0) +4 >Emitted(22, 34) Source(33, 9) + SourceIndex(0) +5 >Emitted(22, 36) Source(33, 11) + SourceIndex(0) +6 >Emitted(22, 49) Source(33, 16) + SourceIndex(0) +7 >Emitted(22, 51) Source(33, 18) + SourceIndex(0) +8 >Emitted(22, 65) Source(33, 24) + SourceIndex(0) +9 >Emitted(22, 66) Source(33, 40) + SourceIndex(0) +--- +>>>_f = [2, "trimmer", "trimming"], numberB = _f[0], nameB = _f[1], skillB = _f[2]; +1-> +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^ +9 > ^ +10> ^^^^^^^^^^^^^^-> +1-> + > +2 >[numberB, nameB, skillB] = [2, "trimmer", "trimming"] +3 > +4 > numberB +5 > , +6 > nameB +7 > , +8 > skillB +9 > ] = [2, "trimmer", "trimming"]; +1->Emitted(23, 1) Source(34, 1) + SourceIndex(0) +2 >Emitted(23, 32) Source(34, 54) + SourceIndex(0) +3 >Emitted(23, 34) Source(34, 2) + SourceIndex(0) +4 >Emitted(23, 49) Source(34, 9) + SourceIndex(0) +5 >Emitted(23, 51) Source(34, 11) + SourceIndex(0) +6 >Emitted(23, 64) Source(34, 16) + SourceIndex(0) +7 >Emitted(23, 66) Source(34, 18) + SourceIndex(0) +8 >Emitted(23, 80) Source(34, 24) + SourceIndex(0) +9 >Emitted(23, 81) Source(34, 55) + SourceIndex(0) +--- +>>>nameMB = multiRobotB[0], _g = multiRobotB[1], primarySkillB = _g[0], secondarySkillB = _g[1]; +1-> +2 >^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^^^^ +9 > ^ +10> ^^^^^^-> +1-> + >[ +2 >nameMB +3 > , +4 > [primarySkillB, secondarySkillB] +5 > +6 > primarySkillB +7 > , +8 > secondarySkillB +9 > ]] = multiRobotB; +1->Emitted(24, 1) Source(35, 2) + SourceIndex(0) +2 >Emitted(24, 24) Source(35, 8) + SourceIndex(0) +3 >Emitted(24, 26) Source(35, 10) + SourceIndex(0) +4 >Emitted(24, 45) Source(35, 42) + SourceIndex(0) +5 >Emitted(24, 47) Source(35, 11) + SourceIndex(0) +6 >Emitted(24, 68) Source(35, 24) + SourceIndex(0) +7 >Emitted(24, 70) Source(35, 26) + SourceIndex(0) +8 >Emitted(24, 93) Source(35, 41) + SourceIndex(0) +9 >Emitted(24, 94) Source(35, 58) + SourceIndex(0) +--- +>>>_h = getMultiRobotB(), nameMB = _h[0], _j = _h[1], primarySkillB = _j[0], secondarySkillB = _j[1]; +1-> +2 >^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^ +11> ^ +12> ^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >[nameMB, [primarySkillB, secondarySkillB]] = getMultiRobotB() +3 > +4 > nameMB +5 > , +6 > [primarySkillB, secondarySkillB] +7 > +8 > primarySkillB +9 > , +10> secondarySkillB +11> ]] = getMultiRobotB(); +1->Emitted(25, 1) Source(36, 1) + SourceIndex(0) +2 >Emitted(25, 22) Source(36, 62) + SourceIndex(0) +3 >Emitted(25, 24) Source(36, 2) + SourceIndex(0) +4 >Emitted(25, 38) Source(36, 8) + SourceIndex(0) +5 >Emitted(25, 40) Source(36, 10) + SourceIndex(0) +6 >Emitted(25, 50) Source(36, 42) + SourceIndex(0) +7 >Emitted(25, 52) Source(36, 11) + SourceIndex(0) +8 >Emitted(25, 73) Source(36, 24) + SourceIndex(0) +9 >Emitted(25, 75) Source(36, 26) + SourceIndex(0) +10>Emitted(25, 98) Source(36, 41) + SourceIndex(0) +11>Emitted(25, 99) Source(36, 63) + SourceIndex(0) +--- +>>>_k = ["trimmer", ["trimming", "edging"]], nameMB = _k[0], _l = _k[1], primarySkillB = _l[0], secondarySkillB = _l[1]; +1-> +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^ +11> ^ +1-> + > +2 >[nameMB, [primarySkillB, secondarySkillB]] = ["trimmer", ["trimming", "edging"]] +3 > +4 > nameMB +5 > , +6 > [primarySkillB, secondarySkillB] +7 > +8 > primarySkillB +9 > , +10> secondarySkillB +11> ]] = ["trimmer", ["trimming", "edging"]]; +1->Emitted(26, 1) Source(37, 1) + SourceIndex(0) +2 >Emitted(26, 41) Source(37, 81) + SourceIndex(0) +3 >Emitted(26, 43) Source(37, 2) + SourceIndex(0) +4 >Emitted(26, 57) Source(37, 8) + SourceIndex(0) +5 >Emitted(26, 59) Source(37, 10) + SourceIndex(0) +6 >Emitted(26, 69) Source(37, 42) + SourceIndex(0) +7 >Emitted(26, 71) Source(37, 11) + SourceIndex(0) +8 >Emitted(26, 92) Source(37, 24) + SourceIndex(0) +9 >Emitted(26, 94) Source(37, 26) + SourceIndex(0) +10>Emitted(26, 117) Source(37, 41) + SourceIndex(0) +11>Emitted(26, 118) Source(37, 82) + SourceIndex(0) +--- +>>>numberB = robotB[0], robotAInfo = robotB.slice(1); +1 > +2 >^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +5 > ^ +6 > ^^^^^^^^^^^-> +1 > + > + >[ +2 >numberB +3 > , +4 > ...robotAInfo +5 > ] = robotB; +1 >Emitted(27, 1) Source(39, 2) + SourceIndex(0) +2 >Emitted(27, 20) Source(39, 9) + SourceIndex(0) +3 >Emitted(27, 22) Source(39, 11) + SourceIndex(0) +4 >Emitted(27, 50) Source(39, 24) + SourceIndex(0) +5 >Emitted(27, 51) Source(39, 35) + SourceIndex(0) +--- +>>>_m = getRobotB(), numberB = _m[0], robotAInfo = _m.slice(1); +1-> +2 >^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^ +8 > ^^^^^^^^^^^^^^^^-> +1-> + > +2 >[numberB, ...robotAInfo] = getRobotB() +3 > +4 > numberB +5 > , +6 > ...robotAInfo +7 > ] = getRobotB(); +1->Emitted(28, 1) Source(40, 1) + SourceIndex(0) +2 >Emitted(28, 17) Source(40, 39) + SourceIndex(0) +3 >Emitted(28, 19) Source(40, 2) + SourceIndex(0) +4 >Emitted(28, 34) Source(40, 9) + SourceIndex(0) +5 >Emitted(28, 36) Source(40, 11) + SourceIndex(0) +6 >Emitted(28, 60) Source(40, 24) + SourceIndex(0) +7 >Emitted(28, 61) Source(40, 40) + SourceIndex(0) +--- +>>>_o = [2, "trimmer", "trimming"], numberB = _o[0], robotAInfo = _o.slice(1); +1-> +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^ +1-> + > +2 >[numberB, ...robotAInfo] = [2, "trimmer", "trimming"] +3 > +4 > numberB +5 > , +6 > ...robotAInfo +7 > ] = [2, "trimmer", "trimming"]; +1->Emitted(29, 1) Source(41, 1) + SourceIndex(0) +2 >Emitted(29, 32) Source(41, 61) + SourceIndex(0) +3 >Emitted(29, 34) Source(41, 2) + SourceIndex(0) +4 >Emitted(29, 49) Source(41, 9) + SourceIndex(0) +5 >Emitted(29, 51) Source(41, 11) + SourceIndex(0) +6 >Emitted(29, 75) Source(41, 24) + SourceIndex(0) +7 >Emitted(29, 76) Source(41, 62) + SourceIndex(0) +--- +>>>multiRobotAInfo = multiRobotA.slice(0); +1 > +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^^^^^^-> +1 > + >[ +2 >...multiRobotAInfo +3 > ] = multiRobotA; +1 >Emitted(30, 1) Source(42, 2) + SourceIndex(0) +2 >Emitted(30, 39) Source(42, 20) + SourceIndex(0) +3 >Emitted(30, 40) Source(42, 36) + SourceIndex(0) +--- +>>>multiRobotAInfo = getMultiRobotB().slice(0); +1-> +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^-> +1-> + >[ +2 >...multiRobotAInfo +3 > ] = getMultiRobotB(); +1->Emitted(31, 1) Source(43, 2) + SourceIndex(0) +2 >Emitted(31, 44) Source(43, 20) + SourceIndex(0) +3 >Emitted(31, 45) Source(43, 41) + SourceIndex(0) +--- +>>>multiRobotAInfo = ["trimmer", ["trimming", "edging"]].slice(0); +1-> +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^ +1-> + >[ +2 >...multiRobotAInfo +3 > ] = ["trimmer", ["trimming", "edging"]]; +1->Emitted(32, 1) Source(44, 2) + SourceIndex(0) +2 >Emitted(32, 63) Source(44, 20) + SourceIndex(0) +3 >Emitted(32, 64) Source(44, 60) + SourceIndex(0) +--- +>>>if (nameA == nameB) { +1 > +2 >^^ +3 > ^ +4 > ^ +5 > ^^^^^ +6 > ^^^^ +7 > ^^^^^ +8 > ^ +9 > ^ +10> ^ +11> ^^^^-> +1 > + > + > +2 >if +3 > +4 > ( +5 > nameA +6 > == +7 > nameB +8 > ) +9 > +10> { +1 >Emitted(33, 1) Source(46, 1) + SourceIndex(0) +2 >Emitted(33, 3) Source(46, 3) + SourceIndex(0) +3 >Emitted(33, 4) Source(46, 4) + SourceIndex(0) +4 >Emitted(33, 5) Source(46, 5) + SourceIndex(0) +5 >Emitted(33, 10) Source(46, 10) + SourceIndex(0) +6 >Emitted(33, 14) Source(46, 14) + SourceIndex(0) +7 >Emitted(33, 19) Source(46, 19) + SourceIndex(0) +8 >Emitted(33, 20) Source(46, 20) + SourceIndex(0) +9 >Emitted(33, 21) Source(46, 21) + SourceIndex(0) +10>Emitted(33, 22) Source(46, 22) + SourceIndex(0) +--- +>>> console.log(skillB); +1->^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^ +7 > ^ +8 > ^ +1-> + > +2 > console +3 > . +4 > log +5 > ( +6 > skillB +7 > ) +8 > ; +1->Emitted(34, 5) Source(47, 5) + SourceIndex(0) +2 >Emitted(34, 12) Source(47, 12) + SourceIndex(0) +3 >Emitted(34, 13) Source(47, 13) + SourceIndex(0) +4 >Emitted(34, 16) Source(47, 16) + SourceIndex(0) +5 >Emitted(34, 17) Source(47, 17) + SourceIndex(0) +6 >Emitted(34, 23) Source(47, 23) + SourceIndex(0) +7 >Emitted(34, 24) Source(47, 24) + SourceIndex(0) +8 >Emitted(34, 25) Source(47, 25) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(35, 1) Source(48, 1) + SourceIndex(0) +2 >Emitted(35, 2) Source(48, 2) + SourceIndex(0) +--- +>>>function getRobotB() { +1-> +2 >^^^^^^^^^^^^^^^^^^^-> +1-> + > + > +1->Emitted(36, 1) Source(50, 1) + SourceIndex(0) +--- +>>> return robotB; +1->^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^ +5 > ^ +1->function getRobotB() { + > +2 > return +3 > +4 > robotB +5 > ; +1->Emitted(37, 5) Source(51, 5) + SourceIndex(0) +2 >Emitted(37, 11) Source(51, 11) + SourceIndex(0) +3 >Emitted(37, 12) Source(51, 12) + SourceIndex(0) +4 >Emitted(37, 18) Source(51, 18) + SourceIndex(0) +5 >Emitted(37, 19) Source(51, 19) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(38, 1) Source(52, 1) + SourceIndex(0) +2 >Emitted(38, 2) Source(52, 2) + SourceIndex(0) +--- +>>>function getMultiRobotB() { +1-> +2 >^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > + > +1->Emitted(39, 1) Source(54, 1) + SourceIndex(0) +--- +>>> return multiRobotB; +1->^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^ +5 > ^ +1->function getMultiRobotB() { + > +2 > return +3 > +4 > multiRobotB +5 > ; +1->Emitted(40, 5) Source(55, 5) + SourceIndex(0) +2 >Emitted(40, 11) Source(55, 11) + SourceIndex(0) +3 >Emitted(40, 12) Source(55, 12) + SourceIndex(0) +4 >Emitted(40, 23) Source(55, 23) + SourceIndex(0) +5 >Emitted(40, 24) Source(55, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(41, 1) Source(56, 1) + SourceIndex(0) +2 >Emitted(41, 2) Source(56, 2) + SourceIndex(0) +--- +>>>var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o; +>>>//# sourceMappingURL=sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.symbols b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.symbols new file mode 100644 index 00000000000..931523c6b26 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.symbols @@ -0,0 +1,176 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts === +declare var console: { +>console : Symbol(console, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 0, 11)) + + log(msg: any): void; +>log : Symbol(log, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 0, 22)) +>msg : Symbol(msg, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 1, 8)) +} +type Robot = [number, string, string]; +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 2, 1)) + +type MultiSkilledRobot = [string, [string, string]]; +>MultiSkilledRobot : Symbol(MultiSkilledRobot, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 3, 38)) + +var robotA: Robot = [1, "mower", "mowing"]; +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 6, 3)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 2, 1)) + +var robotB: Robot = [2, "trimmer", "trimming"]; +>robotB : Symbol(robotB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 7, 3)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 2, 1)) + +var multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; +>multiRobotA : Symbol(multiRobotA, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 8, 3)) +>MultiSkilledRobot : Symbol(MultiSkilledRobot, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 3, 38)) + +var multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; +>multiRobotB : Symbol(multiRobotB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 9, 3)) +>MultiSkilledRobot : Symbol(MultiSkilledRobot, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 3, 38)) + +let nameA: string, numberB: number, nameB: string, skillB: string; +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 11, 3)) +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 11, 18)) +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 11, 35)) +>skillB : Symbol(skillB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 11, 50)) + +let robotAInfo: (number | string)[]; +>robotAInfo : Symbol(robotAInfo, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 12, 3)) + +let multiSkillB: [string, string], nameMB: string, primarySkillB: string, secondarySkillB: string; +>multiSkillB : Symbol(multiSkillB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 14, 3)) +>nameMB : Symbol(nameMB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 14, 34)) +>primarySkillB : Symbol(primarySkillB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 14, 50)) +>secondarySkillB : Symbol(secondarySkillB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 14, 73)) + +let multiRobotAInfo: (string | [string, string])[]; +>multiRobotAInfo : Symbol(multiRobotAInfo, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 15, 3)) + +[, nameA] = robotA; +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 11, 3)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 6, 3)) + +[, nameB] = getRobotB(); +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 11, 35)) +>getRobotB : Symbol(getRobotB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 47, 1)) + +[, nameB] = [2, "trimmer", "trimming"]; +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 11, 35)) + +[, multiSkillB] = multiRobotB; +>multiSkillB : Symbol(multiSkillB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 14, 3)) +>multiRobotB : Symbol(multiRobotB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 9, 3)) + +[, multiSkillB] = getMultiRobotB(); +>multiSkillB : Symbol(multiSkillB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 14, 3)) +>getMultiRobotB : Symbol(getMultiRobotB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 51, 1)) + +[, multiSkillB] = ["roomba", ["vaccum", "mopping"]]; +>multiSkillB : Symbol(multiSkillB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 14, 3)) + +[numberB] = robotB; +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 11, 18)) +>robotB : Symbol(robotB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 7, 3)) + +[numberB] = getRobotB(); +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 11, 18)) +>getRobotB : Symbol(getRobotB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 47, 1)) + +[numberB] = [2, "trimmer", "trimming"]; +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 11, 18)) + +[nameMB] = multiRobotB; +>nameMB : Symbol(nameMB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 14, 34)) +>multiRobotB : Symbol(multiRobotB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 9, 3)) + +[nameMB] = getMultiRobotB(); +>nameMB : Symbol(nameMB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 14, 34)) +>getMultiRobotB : Symbol(getMultiRobotB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 51, 1)) + +[nameMB] = ["trimmer", ["trimming", "edging"]]; +>nameMB : Symbol(nameMB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 14, 34)) + +[numberB, nameB, skillB] = robotB; +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 11, 18)) +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 11, 35)) +>skillB : Symbol(skillB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 11, 50)) +>robotB : Symbol(robotB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 7, 3)) + +[numberB, nameB, skillB] = getRobotB(); +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 11, 18)) +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 11, 35)) +>skillB : Symbol(skillB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 11, 50)) +>getRobotB : Symbol(getRobotB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 47, 1)) + +[numberB, nameB, skillB] = [2, "trimmer", "trimming"]; +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 11, 18)) +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 11, 35)) +>skillB : Symbol(skillB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 11, 50)) + +[nameMB, [primarySkillB, secondarySkillB]] = multiRobotB; +>nameMB : Symbol(nameMB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 14, 34)) +>primarySkillB : Symbol(primarySkillB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 14, 50)) +>secondarySkillB : Symbol(secondarySkillB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 14, 73)) +>multiRobotB : Symbol(multiRobotB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 9, 3)) + +[nameMB, [primarySkillB, secondarySkillB]] = getMultiRobotB(); +>nameMB : Symbol(nameMB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 14, 34)) +>primarySkillB : Symbol(primarySkillB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 14, 50)) +>secondarySkillB : Symbol(secondarySkillB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 14, 73)) +>getMultiRobotB : Symbol(getMultiRobotB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 51, 1)) + +[nameMB, [primarySkillB, secondarySkillB]] = ["trimmer", ["trimming", "edging"]]; +>nameMB : Symbol(nameMB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 14, 34)) +>primarySkillB : Symbol(primarySkillB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 14, 50)) +>secondarySkillB : Symbol(secondarySkillB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 14, 73)) + +[numberB, ...robotAInfo] = robotB; +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 11, 18)) +>robotAInfo : Symbol(robotAInfo, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 12, 3)) +>robotB : Symbol(robotB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 7, 3)) + +[numberB, ...robotAInfo] = getRobotB(); +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 11, 18)) +>robotAInfo : Symbol(robotAInfo, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 12, 3)) +>getRobotB : Symbol(getRobotB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 47, 1)) + +[numberB, ...robotAInfo] = [2, "trimmer", "trimming"]; +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 11, 18)) +>robotAInfo : Symbol(robotAInfo, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 12, 3)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 2, 1)) + +[...multiRobotAInfo] = multiRobotA; +>multiRobotAInfo : Symbol(multiRobotAInfo, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 15, 3)) +>multiRobotA : Symbol(multiRobotA, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 8, 3)) + +[...multiRobotAInfo] = getMultiRobotB(); +>multiRobotAInfo : Symbol(multiRobotAInfo, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 15, 3)) +>getMultiRobotB : Symbol(getMultiRobotB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 51, 1)) + +[...multiRobotAInfo] = ["trimmer", ["trimming", "edging"]]; +>multiRobotAInfo : Symbol(multiRobotAInfo, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 15, 3)) + +if (nameA == nameB) { +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 11, 3)) +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 11, 35)) + + console.log(skillB); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 0, 22)) +>skillB : Symbol(skillB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 11, 50)) +} + +function getRobotB() { +>getRobotB : Symbol(getRobotB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 47, 1)) + + return robotB; +>robotB : Symbol(robotB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 7, 3)) +} + +function getMultiRobotB() { +>getMultiRobotB : Symbol(getMultiRobotB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 51, 1)) + + return multiRobotB; +>multiRobotB : Symbol(multiRobotB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts, 9, 3)) +} diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.types b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.types new file mode 100644 index 00000000000..5ca93029977 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.types @@ -0,0 +1,304 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts === +declare var console: { +>console : { log(msg: any): void; } + + log(msg: any): void; +>log : (msg: any) => void +>msg : any +} +type Robot = [number, string, string]; +>Robot : [number, string, string] + +type MultiSkilledRobot = [string, [string, string]]; +>MultiSkilledRobot : [string, [string, string]] + +var robotA: Robot = [1, "mower", "mowing"]; +>robotA : [number, string, string] +>Robot : [number, string, string] +>[1, "mower", "mowing"] : [number, string, string] +>1 : number +>"mower" : string +>"mowing" : string + +var robotB: Robot = [2, "trimmer", "trimming"]; +>robotB : [number, string, string] +>Robot : [number, string, string] +>[2, "trimmer", "trimming"] : [number, string, string] +>2 : number +>"trimmer" : string +>"trimming" : string + +var multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; +>multiRobotA : [string, [string, string]] +>MultiSkilledRobot : [string, [string, string]] +>["mower", ["mowing", ""]] : [string, [string, string]] +>"mower" : string +>["mowing", ""] : [string, string] +>"mowing" : string +>"" : string + +var multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; +>multiRobotB : [string, [string, string]] +>MultiSkilledRobot : [string, [string, string]] +>["trimmer", ["trimming", "edging"]] : [string, [string, string]] +>"trimmer" : string +>["trimming", "edging"] : [string, string] +>"trimming" : string +>"edging" : string + +let nameA: string, numberB: number, nameB: string, skillB: string; +>nameA : string +>numberB : number +>nameB : string +>skillB : string + +let robotAInfo: (number | string)[]; +>robotAInfo : (number | string)[] + +let multiSkillB: [string, string], nameMB: string, primarySkillB: string, secondarySkillB: string; +>multiSkillB : [string, string] +>nameMB : string +>primarySkillB : string +>secondarySkillB : string + +let multiRobotAInfo: (string | [string, string])[]; +>multiRobotAInfo : (string | [string, string])[] + +[, nameA] = robotA; +>[, nameA] = robotA : [number, string, string] +>[, nameA] : [undefined, string] +> : undefined +>nameA : string +>robotA : [number, string, string] + +[, nameB] = getRobotB(); +>[, nameB] = getRobotB() : [number, string, string] +>[, nameB] : [undefined, string] +> : undefined +>nameB : string +>getRobotB() : [number, string, string] +>getRobotB : () => [number, string, string] + +[, nameB] = [2, "trimmer", "trimming"]; +>[, nameB] = [2, "trimmer", "trimming"] : [number, string, string] +>[, nameB] : [undefined, string] +> : undefined +>nameB : string +>[2, "trimmer", "trimming"] : [number, string, string] +>2 : number +>"trimmer" : string +>"trimming" : string + +[, multiSkillB] = multiRobotB; +>[, multiSkillB] = multiRobotB : [string, [string, string]] +>[, multiSkillB] : [undefined, [string, string]] +> : undefined +>multiSkillB : [string, string] +>multiRobotB : [string, [string, string]] + +[, multiSkillB] = getMultiRobotB(); +>[, multiSkillB] = getMultiRobotB() : [string, [string, string]] +>[, multiSkillB] : [undefined, [string, string]] +> : undefined +>multiSkillB : [string, string] +>getMultiRobotB() : [string, [string, string]] +>getMultiRobotB : () => [string, [string, string]] + +[, multiSkillB] = ["roomba", ["vaccum", "mopping"]]; +>[, multiSkillB] = ["roomba", ["vaccum", "mopping"]] : [string, [string, string]] +>[, multiSkillB] : [undefined, [string, string]] +> : undefined +>multiSkillB : [string, string] +>["roomba", ["vaccum", "mopping"]] : [string, [string, string]] +>"roomba" : string +>["vaccum", "mopping"] : [string, string] +>"vaccum" : string +>"mopping" : string + +[numberB] = robotB; +>[numberB] = robotB : [number, string, string] +>[numberB] : [number] +>numberB : number +>robotB : [number, string, string] + +[numberB] = getRobotB(); +>[numberB] = getRobotB() : [number, string, string] +>[numberB] : [number] +>numberB : number +>getRobotB() : [number, string, string] +>getRobotB : () => [number, string, string] + +[numberB] = [2, "trimmer", "trimming"]; +>[numberB] = [2, "trimmer", "trimming"] : [number, string, string] +>[numberB] : [number] +>numberB : number +>[2, "trimmer", "trimming"] : [number, string, string] +>2 : number +>"trimmer" : string +>"trimming" : string + +[nameMB] = multiRobotB; +>[nameMB] = multiRobotB : [string, [string, string]] +>[nameMB] : [string] +>nameMB : string +>multiRobotB : [string, [string, string]] + +[nameMB] = getMultiRobotB(); +>[nameMB] = getMultiRobotB() : [string, [string, string]] +>[nameMB] : [string] +>nameMB : string +>getMultiRobotB() : [string, [string, string]] +>getMultiRobotB : () => [string, [string, string]] + +[nameMB] = ["trimmer", ["trimming", "edging"]]; +>[nameMB] = ["trimmer", ["trimming", "edging"]] : [string, string[]] +>[nameMB] : [string] +>nameMB : string +>["trimmer", ["trimming", "edging"]] : [string, string[]] +>"trimmer" : string +>["trimming", "edging"] : string[] +>"trimming" : string +>"edging" : string + +[numberB, nameB, skillB] = robotB; +>[numberB, nameB, skillB] = robotB : [number, string, string] +>[numberB, nameB, skillB] : [number, string, string] +>numberB : number +>nameB : string +>skillB : string +>robotB : [number, string, string] + +[numberB, nameB, skillB] = getRobotB(); +>[numberB, nameB, skillB] = getRobotB() : [number, string, string] +>[numberB, nameB, skillB] : [number, string, string] +>numberB : number +>nameB : string +>skillB : string +>getRobotB() : [number, string, string] +>getRobotB : () => [number, string, string] + +[numberB, nameB, skillB] = [2, "trimmer", "trimming"]; +>[numberB, nameB, skillB] = [2, "trimmer", "trimming"] : [number, string, string] +>[numberB, nameB, skillB] : [number, string, string] +>numberB : number +>nameB : string +>skillB : string +>[2, "trimmer", "trimming"] : [number, string, string] +>2 : number +>"trimmer" : string +>"trimming" : string + +[nameMB, [primarySkillB, secondarySkillB]] = multiRobotB; +>[nameMB, [primarySkillB, secondarySkillB]] = multiRobotB : [string, [string, string]] +>[nameMB, [primarySkillB, secondarySkillB]] : [string, [string, string]] +>nameMB : string +>[primarySkillB, secondarySkillB] : [string, string] +>primarySkillB : string +>secondarySkillB : string +>multiRobotB : [string, [string, string]] + +[nameMB, [primarySkillB, secondarySkillB]] = getMultiRobotB(); +>[nameMB, [primarySkillB, secondarySkillB]] = getMultiRobotB() : [string, [string, string]] +>[nameMB, [primarySkillB, secondarySkillB]] : [string, [string, string]] +>nameMB : string +>[primarySkillB, secondarySkillB] : [string, string] +>primarySkillB : string +>secondarySkillB : string +>getMultiRobotB() : [string, [string, string]] +>getMultiRobotB : () => [string, [string, string]] + +[nameMB, [primarySkillB, secondarySkillB]] = ["trimmer", ["trimming", "edging"]]; +>[nameMB, [primarySkillB, secondarySkillB]] = ["trimmer", ["trimming", "edging"]] : [string, [string, string]] +>[nameMB, [primarySkillB, secondarySkillB]] : [string, [string, string]] +>nameMB : string +>[primarySkillB, secondarySkillB] : [string, string] +>primarySkillB : string +>secondarySkillB : string +>["trimmer", ["trimming", "edging"]] : [string, [string, string]] +>"trimmer" : string +>["trimming", "edging"] : [string, string] +>"trimming" : string +>"edging" : string + +[numberB, ...robotAInfo] = robotB; +>[numberB, ...robotAInfo] = robotB : [number, string, string] +>[numberB, ...robotAInfo] : (number | string)[] +>numberB : number +>...robotAInfo : number | string +>robotAInfo : (number | string)[] +>robotB : [number, string, string] + +[numberB, ...robotAInfo] = getRobotB(); +>[numberB, ...robotAInfo] = getRobotB() : [number, string, string] +>[numberB, ...robotAInfo] : (number | string)[] +>numberB : number +>...robotAInfo : number | string +>robotAInfo : (number | string)[] +>getRobotB() : [number, string, string] +>getRobotB : () => [number, string, string] + +[numberB, ...robotAInfo] = [2, "trimmer", "trimming"]; +>[numberB, ...robotAInfo] = [2, "trimmer", "trimming"] : [number, string, string] +>[numberB, ...robotAInfo] : (number | string)[] +>numberB : number +>...robotAInfo : number | string +>robotAInfo : (number | string)[] +>[2, "trimmer", "trimming"] : [number, string, string] +>Robot : [number, string, string] +>[2, "trimmer", "trimming"] : [number, string, string] +>2 : number +>"trimmer" : string +>"trimming" : string + +[...multiRobotAInfo] = multiRobotA; +>[...multiRobotAInfo] = multiRobotA : [string, [string, string]] +>[...multiRobotAInfo] : (string | [string, string])[] +>...multiRobotAInfo : string | [string, string] +>multiRobotAInfo : (string | [string, string])[] +>multiRobotA : [string, [string, string]] + +[...multiRobotAInfo] = getMultiRobotB(); +>[...multiRobotAInfo] = getMultiRobotB() : [string, [string, string]] +>[...multiRobotAInfo] : (string | [string, string])[] +>...multiRobotAInfo : string | [string, string] +>multiRobotAInfo : (string | [string, string])[] +>getMultiRobotB() : [string, [string, string]] +>getMultiRobotB : () => [string, [string, string]] + +[...multiRobotAInfo] = ["trimmer", ["trimming", "edging"]]; +>[...multiRobotAInfo] = ["trimmer", ["trimming", "edging"]] : (string | [string, string])[] +>[...multiRobotAInfo] : (string | [string, string])[] +>...multiRobotAInfo : string | [string, string] +>multiRobotAInfo : (string | [string, string])[] +>["trimmer", ["trimming", "edging"]] : (string | [string, string])[] +>"trimmer" : string +>["trimming", "edging"] : [string, string] +>"trimming" : string +>"edging" : string + +if (nameA == nameB) { +>nameA == nameB : boolean +>nameA : string +>nameB : string + + console.log(skillB); +>console.log(skillB) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>skillB : string +} + +function getRobotB() { +>getRobotB : () => [number, string, string] + + return robotB; +>robotB : [number, string, string] +} + +function getMultiRobotB() { +>getMultiRobotB : () => [string, [string, string]] + + return multiRobotB; +>multiRobotB : [string, [string, string]] +} diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern4.js b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern4.js new file mode 100644 index 00000000000..d4c419278c7 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern4.js @@ -0,0 +1,7 @@ +//// [sourceMapValidationDestructuringVariableStatementArrayBindingPattern4.ts] + +var [x] = [1, 2]; + +//// [sourceMapValidationDestructuringVariableStatementArrayBindingPattern4.js] +var x = [1, 2][0]; +//# sourceMappingURL=sourceMapValidationDestructuringVariableStatementArrayBindingPattern4.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern4.js.map b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern4.js.map new file mode 100644 index 00000000000..96fd86faa4e --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern4.js.map @@ -0,0 +1,2 @@ +//// [sourceMapValidationDestructuringVariableStatementArrayBindingPattern4.js.map] +{"version":3,"file":"sourceMapValidationDestructuringVariableStatementArrayBindingPattern4.js","sourceRoot":"","sources":["sourceMapValidationDestructuringVariableStatementArrayBindingPattern4.ts"],"names":[],"mappings":"AACK,iBAAC,CAAW"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern4.sourcemap.txt b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern4.sourcemap.txt new file mode 100644 index 00000000000..a52c7701db2 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern4.sourcemap.txt @@ -0,0 +1,24 @@ +=================================================================== +JsFile: sourceMapValidationDestructuringVariableStatementArrayBindingPattern4.js +mapUrl: sourceMapValidationDestructuringVariableStatementArrayBindingPattern4.js.map +sourceRoot: +sources: sourceMapValidationDestructuringVariableStatementArrayBindingPattern4.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPattern4.js +sourceFile:sourceMapValidationDestructuringVariableStatementArrayBindingPattern4.ts +------------------------------------------------------------------- +>>>var x = [1, 2][0]; +1 > +2 >^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >var [ +2 >x +3 > ] = [1, 2]; +1 >Emitted(1, 1) Source(2, 6) + SourceIndex(0) +2 >Emitted(1, 18) Source(2, 7) + SourceIndex(0) +3 >Emitted(1, 19) Source(2, 18) + SourceIndex(0) +--- +>>>//# sourceMappingURL=sourceMapValidationDestructuringVariableStatementArrayBindingPattern4.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern4.symbols b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern4.symbols new file mode 100644 index 00000000000..4695a8cd598 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern4.symbols @@ -0,0 +1,5 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPattern4.ts === + +var [x] = [1, 2]; +>x : Symbol(x, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern4.ts, 1, 5)) + diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern4.types b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern4.types new file mode 100644 index 00000000000..461939a11aa --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern4.types @@ -0,0 +1,8 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPattern4.ts === + +var [x] = [1, 2]; +>x : number +>[1, 2] : [number, number] +>1 : number +>2 : number + diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern5.js b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern5.js new file mode 100644 index 00000000000..10df853c220 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern5.js @@ -0,0 +1,9 @@ +//// [sourceMapValidationDestructuringVariableStatementArrayBindingPattern5.ts] + +var [x] = [1, 2]; +var [y, z] = [1, 2]; + +//// [sourceMapValidationDestructuringVariableStatementArrayBindingPattern5.js] +var x = [1, 2][0]; +var _a = [1, 2], y = _a[0], z = _a[1]; +//# sourceMappingURL=sourceMapValidationDestructuringVariableStatementArrayBindingPattern5.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern5.js.map b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern5.js.map new file mode 100644 index 00000000000..337a73240b9 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern5.js.map @@ -0,0 +1,2 @@ +//// [sourceMapValidationDestructuringVariableStatementArrayBindingPattern5.js.map] +{"version":3,"file":"sourceMapValidationDestructuringVariableStatementArrayBindingPattern5.js","sourceRoot":"","sources":["sourceMapValidationDestructuringVariableStatementArrayBindingPattern5.ts"],"names":[],"mappings":"AACK,iBAAC,CAAW;AACjB,IAAA,WAAmB,EAAd,SAAC,EAAE,SAAC,CAAW"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern5.sourcemap.txt b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern5.sourcemap.txt new file mode 100644 index 00000000000..338b6424185 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern5.sourcemap.txt @@ -0,0 +1,52 @@ +=================================================================== +JsFile: sourceMapValidationDestructuringVariableStatementArrayBindingPattern5.js +mapUrl: sourceMapValidationDestructuringVariableStatementArrayBindingPattern5.js.map +sourceRoot: +sources: sourceMapValidationDestructuringVariableStatementArrayBindingPattern5.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPattern5.js +sourceFile:sourceMapValidationDestructuringVariableStatementArrayBindingPattern5.ts +------------------------------------------------------------------- +>>>var x = [1, 2][0]; +1 > +2 >^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^^-> +1 > + >var [ +2 >x +3 > ] = [1, 2]; +1 >Emitted(1, 1) Source(2, 6) + SourceIndex(0) +2 >Emitted(1, 18) Source(2, 7) + SourceIndex(0) +3 >Emitted(1, 19) Source(2, 18) + SourceIndex(0) +--- +>>>var _a = [1, 2], y = _a[0], z = _a[1]; +1-> +2 >^^^^ +3 > ^^^^^^^^^^^ +4 > ^^ +5 > ^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^ +8 > ^ +9 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 > +3 > var [y, z] = [1, 2] +4 > +5 > y +6 > , +7 > z +8 > ] = [1, 2]; +1->Emitted(2, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(3, 1) + SourceIndex(0) +3 >Emitted(2, 16) Source(3, 20) + SourceIndex(0) +4 >Emitted(2, 18) Source(3, 6) + SourceIndex(0) +5 >Emitted(2, 27) Source(3, 7) + SourceIndex(0) +6 >Emitted(2, 29) Source(3, 9) + SourceIndex(0) +7 >Emitted(2, 38) Source(3, 10) + SourceIndex(0) +8 >Emitted(2, 39) Source(3, 21) + SourceIndex(0) +--- +>>>//# sourceMappingURL=sourceMapValidationDestructuringVariableStatementArrayBindingPattern5.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern5.symbols b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern5.symbols new file mode 100644 index 00000000000..59543290772 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern5.symbols @@ -0,0 +1,9 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPattern5.ts === + +var [x] = [1, 2]; +>x : Symbol(x, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern5.ts, 1, 5)) + +var [y, z] = [1, 2]; +>y : Symbol(y, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern5.ts, 2, 5)) +>z : Symbol(z, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern5.ts, 2, 7)) + diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern5.types b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern5.types new file mode 100644 index 00000000000..1ef747517e4 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern5.types @@ -0,0 +1,15 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPattern5.ts === + +var [x] = [1, 2]; +>x : number +>[1, 2] : [number, number] +>1 : number +>2 : number + +var [y, z] = [1, 2]; +>y : number +>z : number +>[1, 2] : [number, number] +>1 : number +>2 : number + diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern6.js b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern6.js new file mode 100644 index 00000000000..d4baadb6562 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern6.js @@ -0,0 +1,7 @@ +//// [sourceMapValidationDestructuringVariableStatementArrayBindingPattern6.ts] + +var [x = 20] = [1, 2]; + +//// [sourceMapValidationDestructuringVariableStatementArrayBindingPattern6.js] +var _a = [1, 2][0], x = _a === void 0 ? 20 : _a; +//# sourceMappingURL=sourceMapValidationDestructuringVariableStatementArrayBindingPattern6.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern6.js.map b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern6.js.map new file mode 100644 index 00000000000..9594cc22809 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern6.js.map @@ -0,0 +1,2 @@ +//// [sourceMapValidationDestructuringVariableStatementArrayBindingPattern6.js.map] +{"version":3,"file":"sourceMapValidationDestructuringVariableStatementArrayBindingPattern6.js","sourceRoot":"","sources":["sourceMapValidationDestructuringVariableStatementArrayBindingPattern6.ts"],"names":[],"mappings":"AACK,kBAAM,EAAN,2BAAM,CAAW"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern6.sourcemap.txt b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern6.sourcemap.txt new file mode 100644 index 00000000000..90ebe4dc9ac --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern6.sourcemap.txt @@ -0,0 +1,30 @@ +=================================================================== +JsFile: sourceMapValidationDestructuringVariableStatementArrayBindingPattern6.js +mapUrl: sourceMapValidationDestructuringVariableStatementArrayBindingPattern6.js.map +sourceRoot: +sources: sourceMapValidationDestructuringVariableStatementArrayBindingPattern6.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPattern6.js +sourceFile:sourceMapValidationDestructuringVariableStatementArrayBindingPattern6.ts +------------------------------------------------------------------- +>>>var _a = [1, 2][0], x = _a === void 0 ? 20 : _a; +1 > +2 >^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >var [ +2 >x = 20 +3 > +4 > x = 20 +5 > ] = [1, 2]; +1 >Emitted(1, 1) Source(2, 6) + SourceIndex(0) +2 >Emitted(1, 19) Source(2, 12) + SourceIndex(0) +3 >Emitted(1, 21) Source(2, 6) + SourceIndex(0) +4 >Emitted(1, 48) Source(2, 12) + SourceIndex(0) +5 >Emitted(1, 49) Source(2, 23) + SourceIndex(0) +--- +>>>//# sourceMappingURL=sourceMapValidationDestructuringVariableStatementArrayBindingPattern6.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern6.symbols b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern6.symbols new file mode 100644 index 00000000000..6c368f4996e --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern6.symbols @@ -0,0 +1,5 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPattern6.ts === + +var [x = 20] = [1, 2]; +>x : Symbol(x, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern6.ts, 1, 5)) + diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern6.types b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern6.types new file mode 100644 index 00000000000..1b94874ae7c --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern6.types @@ -0,0 +1,9 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPattern6.ts === + +var [x = 20] = [1, 2]; +>x : number +>20 : number +>[1, 2] : [number, number] +>1 : number +>2 : number + diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern7.js b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern7.js new file mode 100644 index 00000000000..73d2e85e9da --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern7.js @@ -0,0 +1,7 @@ +//// [sourceMapValidationDestructuringVariableStatementArrayBindingPattern7.ts] + +var [x = 20, j] = [1, 2]; + +//// [sourceMapValidationDestructuringVariableStatementArrayBindingPattern7.js] +var _a = [1, 2], _b = _a[0], x = _b === void 0 ? 20 : _b, j = _a[1]; +//# sourceMappingURL=sourceMapValidationDestructuringVariableStatementArrayBindingPattern7.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern7.js.map b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern7.js.map new file mode 100644 index 00000000000..0def6b1a730 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern7.js.map @@ -0,0 +1,2 @@ +//// [sourceMapValidationDestructuringVariableStatementArrayBindingPattern7.js.map] +{"version":3,"file":"sourceMapValidationDestructuringVariableStatementArrayBindingPattern7.js","sourceRoot":"","sources":["sourceMapValidationDestructuringVariableStatementArrayBindingPattern7.ts"],"names":[],"mappings":"AACA,IAAA,WAAwB,EAAnB,UAAM,EAAN,2BAAM,EAAE,SAAC,CAAW"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern7.sourcemap.txt b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern7.sourcemap.txt new file mode 100644 index 00000000000..f2a95375f2a --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern7.sourcemap.txt @@ -0,0 +1,45 @@ +=================================================================== +JsFile: sourceMapValidationDestructuringVariableStatementArrayBindingPattern7.js +mapUrl: sourceMapValidationDestructuringVariableStatementArrayBindingPattern7.js.map +sourceRoot: +sources: sourceMapValidationDestructuringVariableStatementArrayBindingPattern7.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPattern7.js +sourceFile:sourceMapValidationDestructuringVariableStatementArrayBindingPattern7.ts +------------------------------------------------------------------- +>>>var _a = [1, 2], _b = _a[0], x = _b === void 0 ? 20 : _b, j = _a[1]; +1 > +2 >^^^^ +3 > ^^^^^^^^^^^ +4 > ^^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^ +10> ^ +11> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 > +3 > var [x = 20, j] = [1, 2] +4 > +5 > x = 20 +6 > +7 > x = 20 +8 > , +9 > j +10> ] = [1, 2]; +1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(1, 5) Source(2, 1) + SourceIndex(0) +3 >Emitted(1, 16) Source(2, 25) + SourceIndex(0) +4 >Emitted(1, 18) Source(2, 6) + SourceIndex(0) +5 >Emitted(1, 28) Source(2, 12) + SourceIndex(0) +6 >Emitted(1, 30) Source(2, 6) + SourceIndex(0) +7 >Emitted(1, 57) Source(2, 12) + SourceIndex(0) +8 >Emitted(1, 59) Source(2, 14) + SourceIndex(0) +9 >Emitted(1, 68) Source(2, 15) + SourceIndex(0) +10>Emitted(1, 69) Source(2, 26) + SourceIndex(0) +--- +>>>//# sourceMappingURL=sourceMapValidationDestructuringVariableStatementArrayBindingPattern7.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern7.symbols b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern7.symbols new file mode 100644 index 00000000000..4f57dffff26 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern7.symbols @@ -0,0 +1,6 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPattern7.ts === + +var [x = 20, j] = [1, 2]; +>x : Symbol(x, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern7.ts, 1, 5)) +>j : Symbol(j, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern7.ts, 1, 12)) + diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern7.types b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern7.types new file mode 100644 index 00000000000..9b369e410a4 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern7.types @@ -0,0 +1,10 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPattern7.ts === + +var [x = 20, j] = [1, 2]; +>x : number +>20 : number +>j : number +>[1, 2] : [number, number] +>1 : number +>2 : number + diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.js b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.js new file mode 100644 index 00000000000..8cc61944e76 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.js @@ -0,0 +1,34 @@ +//// [sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.ts] +declare var console: { + log(msg: string): void; +} +type Robot = [number, string, string]; +var robotA: Robot = [1, "mower", "mowing"]; +var robotB: Robot = [2, "trimmer", "trimming"]; + +let [, nameA = "noName"] = robotA; +let [numberB = -1] = robotB; +let [numberA2 = -1, nameA2 = "noName", skillA2 = "noSkill"] = robotA; + +let [numberC2 = -1] = [3, "edging", "Trimming edges"]; +let [numberC = -1, nameC = "noName", skillC = "noSkill"] = [3, "edging", "Trimming edges"]; + +let [numberA3 = -1, ...robotAInfo] = robotA; + +if (nameA == nameA2) { + console.log(skillA2); +} + +//// [sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.js] +var robotA = [1, "mower", "mowing"]; +var robotB = [2, "trimmer", "trimming"]; +var _a = robotA[1], nameA = _a === void 0 ? "noName" : _a; +var _b = robotB[0], numberB = _b === void 0 ? -1 : _b; +var _c = robotA[0], numberA2 = _c === void 0 ? -1 : _c, _d = robotA[1], nameA2 = _d === void 0 ? "noName" : _d, _e = robotA[2], skillA2 = _e === void 0 ? "noSkill" : _e; +var _f = [3, "edging", "Trimming edges"][0], numberC2 = _f === void 0 ? -1 : _f; +var _g = [3, "edging", "Trimming edges"], _h = _g[0], numberC = _h === void 0 ? -1 : _h, _j = _g[1], nameC = _j === void 0 ? "noName" : _j, _k = _g[2], skillC = _k === void 0 ? "noSkill" : _k; +var _l = robotA[0], numberA3 = _l === void 0 ? -1 : _l, robotAInfo = robotA.slice(1); +if (nameA == nameA2) { + console.log(skillA2); +} +//# sourceMappingURL=sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.js.map b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.js.map new file mode 100644 index 00000000000..ce017fbbbcd --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.js.map @@ -0,0 +1,2 @@ +//// [sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.js.map] +{"version":3,"file":"sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.js","sourceRoot":"","sources":["sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.ts"],"names":[],"mappings":"AAIA,IAAI,MAAM,GAAU,CAAC,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;AAC3C,IAAI,MAAM,GAAU,CAAC,CAAC,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;AAExC,kBAAgB,EAAhB,qCAAgB,CAAW;AAC7B,kBAAY,EAAZ,iCAAY,CAAW;AACvB,kBAAa,EAAb,kCAAa,EAAE,cAAiB,EAAjB,sCAAiB,EAAE,cAAmB,EAAnB,wCAAmB,CAAW;AAEhE,2CAAa,EAAb,kCAAa,CAAoC;AACtD,IAAA,oCAA0F,EAArF,UAAY,EAAZ,iCAAY,EAAE,UAAgB,EAAhB,qCAAgB,EAAE,UAAkB,EAAlB,uCAAkB,CAAoC;AAEtF,kBAAa,EAAb,kCAAa,EAAE,4BAAa,CAAW;AAE5C,EAAE,CAAC,CAAC,KAAK,IAAI,MAAM,CAAC,CAAC,CAAC;IAClB,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AACzB,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.sourcemap.txt b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.sourcemap.txt new file mode 100644 index 00000000000..9df44518ca1 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.sourcemap.txt @@ -0,0 +1,342 @@ +=================================================================== +JsFile: sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.js +mapUrl: sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.js.map +sourceRoot: +sources: sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.js +sourceFile:sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.ts +------------------------------------------------------------------- +>>>var robotA = [1, "mower", "mowing"]; +1 > +2 >^^^^ +3 > ^^^^^^ +4 > ^^^ +5 > ^ +6 > ^ +7 > ^^ +8 > ^^^^^^^ +9 > ^^ +10> ^^^^^^^^ +11> ^ +12> ^ +13> ^^^^^-> +1 >declare var console: { + > log(msg: string): void; + >} + >type Robot = [number, string, string]; + > +2 >var +3 > robotA +4 > : Robot = +5 > [ +6 > 1 +7 > , +8 > "mower" +9 > , +10> "mowing" +11> ] +12> ; +1 >Emitted(1, 1) Source(5, 1) + SourceIndex(0) +2 >Emitted(1, 5) Source(5, 5) + SourceIndex(0) +3 >Emitted(1, 11) Source(5, 11) + SourceIndex(0) +4 >Emitted(1, 14) Source(5, 21) + SourceIndex(0) +5 >Emitted(1, 15) Source(5, 22) + SourceIndex(0) +6 >Emitted(1, 16) Source(5, 23) + SourceIndex(0) +7 >Emitted(1, 18) Source(5, 25) + SourceIndex(0) +8 >Emitted(1, 25) Source(5, 32) + SourceIndex(0) +9 >Emitted(1, 27) Source(5, 34) + SourceIndex(0) +10>Emitted(1, 35) Source(5, 42) + SourceIndex(0) +11>Emitted(1, 36) Source(5, 43) + SourceIndex(0) +12>Emitted(1, 37) Source(5, 44) + SourceIndex(0) +--- +>>>var robotB = [2, "trimmer", "trimming"]; +1-> +2 >^^^^ +3 > ^^^^^^ +4 > ^^^ +5 > ^ +6 > ^ +7 > ^^ +8 > ^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^ +11> ^ +12> ^ +13> ^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >var +3 > robotB +4 > : Robot = +5 > [ +6 > 2 +7 > , +8 > "trimmer" +9 > , +10> "trimming" +11> ] +12> ; +1->Emitted(2, 1) Source(6, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(6, 5) + SourceIndex(0) +3 >Emitted(2, 11) Source(6, 11) + SourceIndex(0) +4 >Emitted(2, 14) Source(6, 21) + SourceIndex(0) +5 >Emitted(2, 15) Source(6, 22) + SourceIndex(0) +6 >Emitted(2, 16) Source(6, 23) + SourceIndex(0) +7 >Emitted(2, 18) Source(6, 25) + SourceIndex(0) +8 >Emitted(2, 27) Source(6, 34) + SourceIndex(0) +9 >Emitted(2, 29) Source(6, 36) + SourceIndex(0) +10>Emitted(2, 39) Source(6, 46) + SourceIndex(0) +11>Emitted(2, 40) Source(6, 47) + SourceIndex(0) +12>Emitted(2, 41) Source(6, 48) + SourceIndex(0) +--- +>>>var _a = robotA[1], nameA = _a === void 0 ? "noName" : _a; +1-> +2 >^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +5 > ^ +1-> + > + >let [, +2 >nameA = "noName" +3 > +4 > nameA = "noName" +5 > ] = robotA; +1->Emitted(3, 1) Source(8, 8) + SourceIndex(0) +2 >Emitted(3, 19) Source(8, 24) + SourceIndex(0) +3 >Emitted(3, 21) Source(8, 8) + SourceIndex(0) +4 >Emitted(3, 58) Source(8, 24) + SourceIndex(0) +5 >Emitted(3, 59) Source(8, 35) + SourceIndex(0) +--- +>>>var _b = robotB[0], numberB = _b === void 0 ? -1 : _b; +1 > +2 >^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >let [ +2 >numberB = -1 +3 > +4 > numberB = -1 +5 > ] = robotB; +1 >Emitted(4, 1) Source(9, 6) + SourceIndex(0) +2 >Emitted(4, 19) Source(9, 18) + SourceIndex(0) +3 >Emitted(4, 21) Source(9, 6) + SourceIndex(0) +4 >Emitted(4, 54) Source(9, 18) + SourceIndex(0) +5 >Emitted(4, 55) Source(9, 29) + SourceIndex(0) +--- +>>>var _c = robotA[0], numberA2 = _c === void 0 ? -1 : _c, _d = robotA[1], nameA2 = _d === void 0 ? "noName" : _d, _e = robotA[2], skillA2 = _e === void 0 ? "noSkill" : _e; +1-> +2 >^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +13> ^ +1-> + >let [ +2 >numberA2 = -1 +3 > +4 > numberA2 = -1 +5 > , +6 > nameA2 = "noName" +7 > +8 > nameA2 = "noName" +9 > , +10> skillA2 = "noSkill" +11> +12> skillA2 = "noSkill" +13> ] = robotA; +1->Emitted(5, 1) Source(10, 6) + SourceIndex(0) +2 >Emitted(5, 19) Source(10, 19) + SourceIndex(0) +3 >Emitted(5, 21) Source(10, 6) + SourceIndex(0) +4 >Emitted(5, 55) Source(10, 19) + SourceIndex(0) +5 >Emitted(5, 57) Source(10, 21) + SourceIndex(0) +6 >Emitted(5, 71) Source(10, 38) + SourceIndex(0) +7 >Emitted(5, 73) Source(10, 21) + SourceIndex(0) +8 >Emitted(5, 111) Source(10, 38) + SourceIndex(0) +9 >Emitted(5, 113) Source(10, 40) + SourceIndex(0) +10>Emitted(5, 127) Source(10, 59) + SourceIndex(0) +11>Emitted(5, 129) Source(10, 40) + SourceIndex(0) +12>Emitted(5, 169) Source(10, 59) + SourceIndex(0) +13>Emitted(5, 170) Source(10, 70) + SourceIndex(0) +--- +>>>var _f = [3, "edging", "Trimming edges"][0], numberC2 = _f === void 0 ? -1 : _f; +1 > +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > + >let [ +2 >numberC2 = -1 +3 > +4 > numberC2 = -1 +5 > ] = [3, "edging", "Trimming edges"]; +1 >Emitted(6, 1) Source(12, 6) + SourceIndex(0) +2 >Emitted(6, 44) Source(12, 19) + SourceIndex(0) +3 >Emitted(6, 46) Source(12, 6) + SourceIndex(0) +4 >Emitted(6, 80) Source(12, 19) + SourceIndex(0) +5 >Emitted(6, 81) Source(12, 55) + SourceIndex(0) +--- +>>>var _g = [3, "edging", "Trimming edges"], _h = _g[0], numberC = _h === void 0 ? -1 : _h, _j = _g[1], nameC = _j === void 0 ? "noName" : _j, _k = _g[2], skillC = _k === void 0 ? "noSkill" : _k; +1-> +2 >^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +4 > ^^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^ +10> ^^ +11> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +12> ^^ +13> ^^^^^^^^^^ +14> ^^ +15> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +16> ^ +1-> + > +2 > +3 > let [numberC = -1, nameC = "noName", skillC = "noSkill"] = [3, "edging", "Trimming edges"] +4 > +5 > numberC = -1 +6 > +7 > numberC = -1 +8 > , +9 > nameC = "noName" +10> +11> nameC = "noName" +12> , +13> skillC = "noSkill" +14> +15> skillC = "noSkill" +16> ] = [3, "edging", "Trimming edges"]; +1->Emitted(7, 1) Source(13, 1) + SourceIndex(0) +2 >Emitted(7, 5) Source(13, 1) + SourceIndex(0) +3 >Emitted(7, 41) Source(13, 91) + SourceIndex(0) +4 >Emitted(7, 43) Source(13, 6) + SourceIndex(0) +5 >Emitted(7, 53) Source(13, 18) + SourceIndex(0) +6 >Emitted(7, 55) Source(13, 6) + SourceIndex(0) +7 >Emitted(7, 88) Source(13, 18) + SourceIndex(0) +8 >Emitted(7, 90) Source(13, 20) + SourceIndex(0) +9 >Emitted(7, 100) Source(13, 36) + SourceIndex(0) +10>Emitted(7, 102) Source(13, 20) + SourceIndex(0) +11>Emitted(7, 139) Source(13, 36) + SourceIndex(0) +12>Emitted(7, 141) Source(13, 38) + SourceIndex(0) +13>Emitted(7, 151) Source(13, 56) + SourceIndex(0) +14>Emitted(7, 153) Source(13, 38) + SourceIndex(0) +15>Emitted(7, 192) Source(13, 56) + SourceIndex(0) +16>Emitted(7, 193) Source(13, 92) + SourceIndex(0) +--- +>>>var _l = robotA[0], numberA3 = _l === void 0 ? -1 : _l, robotAInfo = robotA.slice(1); +1 > +2 >^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^ +1 > + > + >let [ +2 >numberA3 = -1 +3 > +4 > numberA3 = -1 +5 > , +6 > ...robotAInfo +7 > ] = robotA; +1 >Emitted(8, 1) Source(15, 6) + SourceIndex(0) +2 >Emitted(8, 19) Source(15, 19) + SourceIndex(0) +3 >Emitted(8, 21) Source(15, 6) + SourceIndex(0) +4 >Emitted(8, 55) Source(15, 19) + SourceIndex(0) +5 >Emitted(8, 57) Source(15, 21) + SourceIndex(0) +6 >Emitted(8, 85) Source(15, 34) + SourceIndex(0) +7 >Emitted(8, 86) Source(15, 45) + SourceIndex(0) +--- +>>>if (nameA == nameA2) { +1 > +2 >^^ +3 > ^ +4 > ^ +5 > ^^^^^ +6 > ^^^^ +7 > ^^^^^^ +8 > ^ +9 > ^ +10> ^ +11> ^^^^-> +1 > + > + > +2 >if +3 > +4 > ( +5 > nameA +6 > == +7 > nameA2 +8 > ) +9 > +10> { +1 >Emitted(9, 1) Source(17, 1) + SourceIndex(0) +2 >Emitted(9, 3) Source(17, 3) + SourceIndex(0) +3 >Emitted(9, 4) Source(17, 4) + SourceIndex(0) +4 >Emitted(9, 5) Source(17, 5) + SourceIndex(0) +5 >Emitted(9, 10) Source(17, 10) + SourceIndex(0) +6 >Emitted(9, 14) Source(17, 14) + SourceIndex(0) +7 >Emitted(9, 20) Source(17, 20) + SourceIndex(0) +8 >Emitted(9, 21) Source(17, 21) + SourceIndex(0) +9 >Emitted(9, 22) Source(17, 22) + SourceIndex(0) +10>Emitted(9, 23) Source(17, 23) + SourceIndex(0) +--- +>>> console.log(skillA2); +1->^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^ +7 > ^ +8 > ^ +1-> + > +2 > console +3 > . +4 > log +5 > ( +6 > skillA2 +7 > ) +8 > ; +1->Emitted(10, 5) Source(18, 5) + SourceIndex(0) +2 >Emitted(10, 12) Source(18, 12) + SourceIndex(0) +3 >Emitted(10, 13) Source(18, 13) + SourceIndex(0) +4 >Emitted(10, 16) Source(18, 16) + SourceIndex(0) +5 >Emitted(10, 17) Source(18, 17) + SourceIndex(0) +6 >Emitted(10, 24) Source(18, 24) + SourceIndex(0) +7 >Emitted(10, 25) Source(18, 25) + SourceIndex(0) +8 >Emitted(10, 26) Source(18, 26) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(11, 1) Source(19, 1) + SourceIndex(0) +2 >Emitted(11, 2) Source(19, 2) + SourceIndex(0) +--- +>>>//# sourceMappingURL=sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.symbols b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.symbols new file mode 100644 index 00000000000..1800b3bd03c --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.symbols @@ -0,0 +1,56 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.ts === +declare var console: { +>console : Symbol(console, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.ts, 0, 11)) + + log(msg: string): void; +>log : Symbol(log, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.ts, 0, 22)) +>msg : Symbol(msg, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.ts, 1, 8)) +} +type Robot = [number, string, string]; +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.ts, 2, 1)) + +var robotA: Robot = [1, "mower", "mowing"]; +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.ts, 4, 3)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.ts, 2, 1)) + +var robotB: Robot = [2, "trimmer", "trimming"]; +>robotB : Symbol(robotB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.ts, 5, 3)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.ts, 2, 1)) + +let [, nameA = "noName"] = robotA; +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.ts, 7, 6)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.ts, 4, 3)) + +let [numberB = -1] = robotB; +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.ts, 8, 5)) +>robotB : Symbol(robotB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.ts, 5, 3)) + +let [numberA2 = -1, nameA2 = "noName", skillA2 = "noSkill"] = robotA; +>numberA2 : Symbol(numberA2, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.ts, 9, 5)) +>nameA2 : Symbol(nameA2, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.ts, 9, 19)) +>skillA2 : Symbol(skillA2, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.ts, 9, 38)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.ts, 4, 3)) + +let [numberC2 = -1] = [3, "edging", "Trimming edges"]; +>numberC2 : Symbol(numberC2, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.ts, 11, 5)) + +let [numberC = -1, nameC = "noName", skillC = "noSkill"] = [3, "edging", "Trimming edges"]; +>numberC : Symbol(numberC, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.ts, 12, 5)) +>nameC : Symbol(nameC, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.ts, 12, 18)) +>skillC : Symbol(skillC, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.ts, 12, 36)) + +let [numberA3 = -1, ...robotAInfo] = robotA; +>numberA3 : Symbol(numberA3, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.ts, 14, 5)) +>robotAInfo : Symbol(robotAInfo, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.ts, 14, 19)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.ts, 4, 3)) + +if (nameA == nameA2) { +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.ts, 7, 6)) +>nameA2 : Symbol(nameA2, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.ts, 9, 19)) + + console.log(skillA2); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.ts, 0, 22)) +>skillA2 : Symbol(skillA2, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.ts, 9, 38)) +} diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.types b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.types new file mode 100644 index 00000000000..2dad459725e --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.types @@ -0,0 +1,90 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.ts === +declare var console: { +>console : { log(msg: string): void; } + + log(msg: string): void; +>log : (msg: string) => void +>msg : string +} +type Robot = [number, string, string]; +>Robot : [number, string, string] + +var robotA: Robot = [1, "mower", "mowing"]; +>robotA : [number, string, string] +>Robot : [number, string, string] +>[1, "mower", "mowing"] : [number, string, string] +>1 : number +>"mower" : string +>"mowing" : string + +var robotB: Robot = [2, "trimmer", "trimming"]; +>robotB : [number, string, string] +>Robot : [number, string, string] +>[2, "trimmer", "trimming"] : [number, string, string] +>2 : number +>"trimmer" : string +>"trimming" : string + +let [, nameA = "noName"] = robotA; +> : undefined +>nameA : string +>"noName" : string +>robotA : [number, string, string] + +let [numberB = -1] = robotB; +>numberB : number +>-1 : number +>1 : number +>robotB : [number, string, string] + +let [numberA2 = -1, nameA2 = "noName", skillA2 = "noSkill"] = robotA; +>numberA2 : number +>-1 : number +>1 : number +>nameA2 : string +>"noName" : string +>skillA2 : string +>"noSkill" : string +>robotA : [number, string, string] + +let [numberC2 = -1] = [3, "edging", "Trimming edges"]; +>numberC2 : number +>-1 : number +>1 : number +>[3, "edging", "Trimming edges"] : [number, string, string] +>3 : number +>"edging" : string +>"Trimming edges" : string + +let [numberC = -1, nameC = "noName", skillC = "noSkill"] = [3, "edging", "Trimming edges"]; +>numberC : number +>-1 : number +>1 : number +>nameC : string +>"noName" : string +>skillC : string +>"noSkill" : string +>[3, "edging", "Trimming edges"] : [number, string, string] +>3 : number +>"edging" : string +>"Trimming edges" : string + +let [numberA3 = -1, ...robotAInfo] = robotA; +>numberA3 : number +>-1 : number +>1 : number +>robotAInfo : (number | string)[] +>robotA : [number, string, string] + +if (nameA == nameA2) { +>nameA == nameA2 : boolean +>nameA : string +>nameA2 : string + + console.log(skillA2); +>console.log(skillA2) : void +>console.log : (msg: string) => void +>console : { log(msg: string): void; } +>log : (msg: string) => void +>skillA2 : string +} diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues2.js b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues2.js new file mode 100644 index 00000000000..b20e0be4fe0 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues2.js @@ -0,0 +1,31 @@ +//// [sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues2.ts] +declare var console: { + log(msg: string): void; +} +type MultiSkilledRobot = [string, string[]]; +var multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; +var multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; + +let [, skillA = ["noSkill", "noSkill"]] = multiRobotA; +let [nameMB = "noName" ] = multiRobotB; +let [nameMA = "noName", [primarySkillA = "noSkill", secondarySkillA = "noSkill"] = ["noSkill", "noSkill"]] = multiRobotA; + +let [nameMC = "noName" ] = ["roomba", ["vaccum", "mopping"]]; +let [nameMC2 = "noName", [primarySkillC = "noSkill", secondarySkillC = "noSkill"] = ["noSkill", "noSkill"]] = ["roomba", ["vaccum", "mopping"]]; + +if (nameMB == nameMA) { + console.log(skillA[0] + skillA[1]); +} + +//// [sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues2.js] +var multiRobotA = ["mower", ["mowing", ""]]; +var multiRobotB = ["trimmer", ["trimming", "edging"]]; +var _a = multiRobotA[1], skillA = _a === void 0 ? ["noSkill", "noSkill"] : _a; +var _b = multiRobotB[0], nameMB = _b === void 0 ? "noName" : _b; +var _c = multiRobotA[0], nameMA = _c === void 0 ? "noName" : _c, _d = multiRobotA[1], _e = _d === void 0 ? ["noSkill", "noSkill"] : _d, _f = _e[0], primarySkillA = _f === void 0 ? "noSkill" : _f, _g = _e[1], secondarySkillA = _g === void 0 ? "noSkill" : _g; +var _h = ["roomba", ["vaccum", "mopping"]][0], nameMC = _h === void 0 ? "noName" : _h; +var _j = ["roomba", ["vaccum", "mopping"]], _k = _j[0], nameMC2 = _k === void 0 ? "noName" : _k, _l = _j[1], _m = _l === void 0 ? ["noSkill", "noSkill"] : _l, _o = _m[0], primarySkillC = _o === void 0 ? "noSkill" : _o, _p = _m[1], secondarySkillC = _p === void 0 ? "noSkill" : _p; +if (nameMB == nameMA) { + console.log(skillA[0] + skillA[1]); +} +//# sourceMappingURL=sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues2.js.map b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues2.js.map new file mode 100644 index 00000000000..11ca67c19ad --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues2.js.map @@ -0,0 +1,2 @@ +//// [sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues2.js.map] +{"version":3,"file":"sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues2.js","sourceRoot":"","sources":["sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues2.ts"],"names":[],"mappings":"AAIA,IAAI,WAAW,GAAsB,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC;AAC/D,IAAI,WAAW,GAAsB,CAAC,SAAS,EAAE,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC,CAAC;AAElE,uBAA+B,EAA/B,oDAA+B,CAAgB;AACjD,uBAAiB,EAAjB,sCAAiB,CAAiB;AAClC,uBAAiB,EAAjB,sCAAiB,EAAE,mBAAiF,EAAjF,gDAAiF,EAAhF,UAAyB,EAAzB,8CAAyB,EAAE,UAA2B,EAA3B,gDAA2B,CAA0C;AAEpH,6CAAiB,EAAjB,sCAAiB,CAAuC;AAC7D,IAAA,sCAA+I,EAA1I,UAAkB,EAAlB,uCAAkB,EAAE,UAAiF,EAAjF,gDAAiF,EAAhF,UAAyB,EAAzB,8CAAyB,EAAE,UAA2B,EAA3B,gDAA2B,CAAgE;AAEhJ,EAAE,CAAC,CAAC,MAAM,IAAI,MAAM,CAAC,CAAC,CAAC;IACnB,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AACvC,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues2.sourcemap.txt b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues2.sourcemap.txt new file mode 100644 index 00000000000..30f2ee65592 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues2.sourcemap.txt @@ -0,0 +1,377 @@ +=================================================================== +JsFile: sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues2.js +mapUrl: sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues2.js.map +sourceRoot: +sources: sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues2.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues2.js +sourceFile:sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues2.ts +------------------------------------------------------------------- +>>>var multiRobotA = ["mower", ["mowing", ""]]; +1 > +2 >^^^^ +3 > ^^^^^^^^^^^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^ +7 > ^^ +8 > ^ +9 > ^^^^^^^^ +10> ^^ +11> ^^ +12> ^ +13> ^ +14> ^ +15> ^^^^^^^^^^^-> +1 >declare var console: { + > log(msg: string): void; + >} + >type MultiSkilledRobot = [string, string[]]; + > +2 >var +3 > multiRobotA +4 > : MultiSkilledRobot = +5 > [ +6 > "mower" +7 > , +8 > [ +9 > "mowing" +10> , +11> "" +12> ] +13> ] +14> ; +1 >Emitted(1, 1) Source(5, 1) + SourceIndex(0) +2 >Emitted(1, 5) Source(5, 5) + SourceIndex(0) +3 >Emitted(1, 16) Source(5, 16) + SourceIndex(0) +4 >Emitted(1, 19) Source(5, 38) + SourceIndex(0) +5 >Emitted(1, 20) Source(5, 39) + SourceIndex(0) +6 >Emitted(1, 27) Source(5, 46) + SourceIndex(0) +7 >Emitted(1, 29) Source(5, 48) + SourceIndex(0) +8 >Emitted(1, 30) Source(5, 49) + SourceIndex(0) +9 >Emitted(1, 38) Source(5, 57) + SourceIndex(0) +10>Emitted(1, 40) Source(5, 59) + SourceIndex(0) +11>Emitted(1, 42) Source(5, 61) + SourceIndex(0) +12>Emitted(1, 43) Source(5, 62) + SourceIndex(0) +13>Emitted(1, 44) Source(5, 63) + SourceIndex(0) +14>Emitted(1, 45) Source(5, 64) + SourceIndex(0) +--- +>>>var multiRobotB = ["trimmer", ["trimming", "edging"]]; +1-> +2 >^^^^ +3 > ^^^^^^^^^^^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^^ +7 > ^^ +8 > ^ +9 > ^^^^^^^^^^ +10> ^^ +11> ^^^^^^^^ +12> ^ +13> ^ +14> ^ +15> ^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >var +3 > multiRobotB +4 > : MultiSkilledRobot = +5 > [ +6 > "trimmer" +7 > , +8 > [ +9 > "trimming" +10> , +11> "edging" +12> ] +13> ] +14> ; +1->Emitted(2, 1) Source(6, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(6, 5) + SourceIndex(0) +3 >Emitted(2, 16) Source(6, 16) + SourceIndex(0) +4 >Emitted(2, 19) Source(6, 38) + SourceIndex(0) +5 >Emitted(2, 20) Source(6, 39) + SourceIndex(0) +6 >Emitted(2, 29) Source(6, 48) + SourceIndex(0) +7 >Emitted(2, 31) Source(6, 50) + SourceIndex(0) +8 >Emitted(2, 32) Source(6, 51) + SourceIndex(0) +9 >Emitted(2, 42) Source(6, 61) + SourceIndex(0) +10>Emitted(2, 44) Source(6, 63) + SourceIndex(0) +11>Emitted(2, 52) Source(6, 71) + SourceIndex(0) +12>Emitted(2, 53) Source(6, 72) + SourceIndex(0) +13>Emitted(2, 54) Source(6, 73) + SourceIndex(0) +14>Emitted(2, 55) Source(6, 74) + SourceIndex(0) +--- +>>>var _a = multiRobotA[1], skillA = _a === void 0 ? ["noSkill", "noSkill"] : _a; +1-> +2 >^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +5 > ^ +1-> + > + >let [, +2 >skillA = ["noSkill", "noSkill"] +3 > +4 > skillA = ["noSkill", "noSkill"] +5 > ] = multiRobotA; +1->Emitted(3, 1) Source(8, 8) + SourceIndex(0) +2 >Emitted(3, 24) Source(8, 39) + SourceIndex(0) +3 >Emitted(3, 26) Source(8, 8) + SourceIndex(0) +4 >Emitted(3, 78) Source(8, 39) + SourceIndex(0) +5 >Emitted(3, 79) Source(8, 55) + SourceIndex(0) +--- +>>>var _b = multiRobotB[0], nameMB = _b === void 0 ? "noName" : _b; +1 > +2 >^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >let [ +2 >nameMB = "noName" +3 > +4 > nameMB = "noName" +5 > ] = multiRobotB; +1 >Emitted(4, 1) Source(9, 6) + SourceIndex(0) +2 >Emitted(4, 24) Source(9, 23) + SourceIndex(0) +3 >Emitted(4, 26) Source(9, 6) + SourceIndex(0) +4 >Emitted(4, 64) Source(9, 23) + SourceIndex(0) +5 >Emitted(4, 65) Source(9, 40) + SourceIndex(0) +--- +>>>var _c = multiRobotA[0], nameMA = _c === void 0 ? "noName" : _c, _d = multiRobotA[1], _e = _d === void 0 ? ["noSkill", "noSkill"] : _d, _f = _e[0], primarySkillA = _f === void 0 ? "noSkill" : _f, _g = _e[1], secondarySkillA = _g === void 0 ? "noSkill" : _g; +1-> +2 >^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^ +15> ^^ +16> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +17> ^ +1-> + >let [ +2 >nameMA = "noName" +3 > +4 > nameMA = "noName" +5 > , +6 > [primarySkillA = "noSkill", secondarySkillA = "noSkill"] = ["noSkill", "noSkill"] +7 > +8 > [primarySkillA = "noSkill", secondarySkillA = "noSkill"] = ["noSkill", "noSkill"] +9 > +10> primarySkillA = "noSkill" +11> +12> primarySkillA = "noSkill" +13> , +14> secondarySkillA = "noSkill" +15> +16> secondarySkillA = "noSkill" +17> ] = ["noSkill", "noSkill"]] = multiRobotA; +1->Emitted(5, 1) Source(10, 6) + SourceIndex(0) +2 >Emitted(5, 24) Source(10, 23) + SourceIndex(0) +3 >Emitted(5, 26) Source(10, 6) + SourceIndex(0) +4 >Emitted(5, 64) Source(10, 23) + SourceIndex(0) +5 >Emitted(5, 66) Source(10, 25) + SourceIndex(0) +6 >Emitted(5, 85) Source(10, 106) + SourceIndex(0) +7 >Emitted(5, 87) Source(10, 25) + SourceIndex(0) +8 >Emitted(5, 135) Source(10, 106) + SourceIndex(0) +9 >Emitted(5, 137) Source(10, 26) + SourceIndex(0) +10>Emitted(5, 147) Source(10, 51) + SourceIndex(0) +11>Emitted(5, 149) Source(10, 26) + SourceIndex(0) +12>Emitted(5, 195) Source(10, 51) + SourceIndex(0) +13>Emitted(5, 197) Source(10, 53) + SourceIndex(0) +14>Emitted(5, 207) Source(10, 80) + SourceIndex(0) +15>Emitted(5, 209) Source(10, 53) + SourceIndex(0) +16>Emitted(5, 257) Source(10, 80) + SourceIndex(0) +17>Emitted(5, 258) Source(10, 122) + SourceIndex(0) +--- +>>>var _h = ["roomba", ["vaccum", "mopping"]][0], nameMC = _h === void 0 ? "noName" : _h; +1 > +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > + >let [ +2 >nameMC = "noName" +3 > +4 > nameMC = "noName" +5 > ] = ["roomba", ["vaccum", "mopping"]]; +1 >Emitted(6, 1) Source(12, 6) + SourceIndex(0) +2 >Emitted(6, 46) Source(12, 23) + SourceIndex(0) +3 >Emitted(6, 48) Source(12, 6) + SourceIndex(0) +4 >Emitted(6, 86) Source(12, 23) + SourceIndex(0) +5 >Emitted(6, 87) Source(12, 62) + SourceIndex(0) +--- +>>>var _j = ["roomba", ["vaccum", "mopping"]], _k = _j[0], nameMC2 = _k === void 0 ? "noName" : _k, _l = _j[1], _m = _l === void 0 ? ["noSkill", "noSkill"] : _l, _o = _m[0], primarySkillC = _o === void 0 ? "noSkill" : _o, _p = _m[1], secondarySkillC = _p === void 0 ? "noSkill" : _p; +1-> +2 >^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +4 > ^^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^ +10> ^^ +11> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +12> ^^ +13> ^^^^^^^^^^ +14> ^^ +15> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +16> ^^ +17> ^^^^^^^^^^ +18> ^^ +19> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +20> ^ +1-> + > +2 > +3 > let [nameMC2 = "noName", [primarySkillC = "noSkill", secondarySkillC = "noSkill"] = ["noSkill", "noSkill"]] = ["roomba", ["vaccum", "mopping"]] +4 > +5 > nameMC2 = "noName" +6 > +7 > nameMC2 = "noName" +8 > , +9 > [primarySkillC = "noSkill", secondarySkillC = "noSkill"] = ["noSkill", "noSkill"] +10> +11> [primarySkillC = "noSkill", secondarySkillC = "noSkill"] = ["noSkill", "noSkill"] +12> +13> primarySkillC = "noSkill" +14> +15> primarySkillC = "noSkill" +16> , +17> secondarySkillC = "noSkill" +18> +19> secondarySkillC = "noSkill" +20> ] = ["noSkill", "noSkill"]] = ["roomba", ["vaccum", "mopping"]]; +1->Emitted(7, 1) Source(13, 1) + SourceIndex(0) +2 >Emitted(7, 5) Source(13, 1) + SourceIndex(0) +3 >Emitted(7, 43) Source(13, 144) + SourceIndex(0) +4 >Emitted(7, 45) Source(13, 6) + SourceIndex(0) +5 >Emitted(7, 55) Source(13, 24) + SourceIndex(0) +6 >Emitted(7, 57) Source(13, 6) + SourceIndex(0) +7 >Emitted(7, 96) Source(13, 24) + SourceIndex(0) +8 >Emitted(7, 98) Source(13, 26) + SourceIndex(0) +9 >Emitted(7, 108) Source(13, 107) + SourceIndex(0) +10>Emitted(7, 110) Source(13, 26) + SourceIndex(0) +11>Emitted(7, 158) Source(13, 107) + SourceIndex(0) +12>Emitted(7, 160) Source(13, 27) + SourceIndex(0) +13>Emitted(7, 170) Source(13, 52) + SourceIndex(0) +14>Emitted(7, 172) Source(13, 27) + SourceIndex(0) +15>Emitted(7, 218) Source(13, 52) + SourceIndex(0) +16>Emitted(7, 220) Source(13, 54) + SourceIndex(0) +17>Emitted(7, 230) Source(13, 81) + SourceIndex(0) +18>Emitted(7, 232) Source(13, 54) + SourceIndex(0) +19>Emitted(7, 280) Source(13, 81) + SourceIndex(0) +20>Emitted(7, 281) Source(13, 145) + SourceIndex(0) +--- +>>>if (nameMB == nameMA) { +1 > +2 >^^ +3 > ^ +4 > ^ +5 > ^^^^^^ +6 > ^^^^ +7 > ^^^^^^ +8 > ^ +9 > ^ +10> ^ +11> ^^^^^^^^^^^^^^^^^-> +1 > + > + > +2 >if +3 > +4 > ( +5 > nameMB +6 > == +7 > nameMA +8 > ) +9 > +10> { +1 >Emitted(8, 1) Source(15, 1) + SourceIndex(0) +2 >Emitted(8, 3) Source(15, 3) + SourceIndex(0) +3 >Emitted(8, 4) Source(15, 4) + SourceIndex(0) +4 >Emitted(8, 5) Source(15, 5) + SourceIndex(0) +5 >Emitted(8, 11) Source(15, 11) + SourceIndex(0) +6 >Emitted(8, 15) Source(15, 15) + SourceIndex(0) +7 >Emitted(8, 21) Source(15, 21) + SourceIndex(0) +8 >Emitted(8, 22) Source(15, 22) + SourceIndex(0) +9 >Emitted(8, 23) Source(15, 23) + SourceIndex(0) +10>Emitted(8, 24) Source(15, 24) + SourceIndex(0) +--- +>>> console.log(skillA[0] + skillA[1]); +1->^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^ +7 > ^ +8 > ^ +9 > ^ +10> ^^^ +11> ^^^^^^ +12> ^ +13> ^ +14> ^ +15> ^ +16> ^ +1-> + > +2 > console +3 > . +4 > log +5 > ( +6 > skillA +7 > [ +8 > 0 +9 > ] +10> + +11> skillA +12> [ +13> 1 +14> ] +15> ) +16> ; +1->Emitted(9, 5) Source(16, 5) + SourceIndex(0) +2 >Emitted(9, 12) Source(16, 12) + SourceIndex(0) +3 >Emitted(9, 13) Source(16, 13) + SourceIndex(0) +4 >Emitted(9, 16) Source(16, 16) + SourceIndex(0) +5 >Emitted(9, 17) Source(16, 17) + SourceIndex(0) +6 >Emitted(9, 23) Source(16, 23) + SourceIndex(0) +7 >Emitted(9, 24) Source(16, 24) + SourceIndex(0) +8 >Emitted(9, 25) Source(16, 25) + SourceIndex(0) +9 >Emitted(9, 26) Source(16, 26) + SourceIndex(0) +10>Emitted(9, 29) Source(16, 29) + SourceIndex(0) +11>Emitted(9, 35) Source(16, 35) + SourceIndex(0) +12>Emitted(9, 36) Source(16, 36) + SourceIndex(0) +13>Emitted(9, 37) Source(16, 37) + SourceIndex(0) +14>Emitted(9, 38) Source(16, 38) + SourceIndex(0) +15>Emitted(9, 39) Source(16, 39) + SourceIndex(0) +16>Emitted(9, 40) Source(16, 40) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(10, 1) Source(17, 1) + SourceIndex(0) +2 >Emitted(10, 2) Source(17, 2) + SourceIndex(0) +--- +>>>//# sourceMappingURL=sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues2.symbols b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues2.symbols new file mode 100644 index 00000000000..76be77a8095 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues2.symbols @@ -0,0 +1,52 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues2.ts === +declare var console: { +>console : Symbol(console, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues2.ts, 0, 11)) + + log(msg: string): void; +>log : Symbol(log, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues2.ts, 0, 22)) +>msg : Symbol(msg, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues2.ts, 1, 8)) +} +type MultiSkilledRobot = [string, string[]]; +>MultiSkilledRobot : Symbol(MultiSkilledRobot, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues2.ts, 2, 1)) + +var multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; +>multiRobotA : Symbol(multiRobotA, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues2.ts, 4, 3)) +>MultiSkilledRobot : Symbol(MultiSkilledRobot, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues2.ts, 2, 1)) + +var multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; +>multiRobotB : Symbol(multiRobotB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues2.ts, 5, 3)) +>MultiSkilledRobot : Symbol(MultiSkilledRobot, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues2.ts, 2, 1)) + +let [, skillA = ["noSkill", "noSkill"]] = multiRobotA; +>skillA : Symbol(skillA, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues2.ts, 7, 6)) +>multiRobotA : Symbol(multiRobotA, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues2.ts, 4, 3)) + +let [nameMB = "noName" ] = multiRobotB; +>nameMB : Symbol(nameMB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues2.ts, 8, 5)) +>multiRobotB : Symbol(multiRobotB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues2.ts, 5, 3)) + +let [nameMA = "noName", [primarySkillA = "noSkill", secondarySkillA = "noSkill"] = ["noSkill", "noSkill"]] = multiRobotA; +>nameMA : Symbol(nameMA, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues2.ts, 9, 5)) +>primarySkillA : Symbol(primarySkillA, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues2.ts, 9, 25)) +>secondarySkillA : Symbol(secondarySkillA, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues2.ts, 9, 51)) +>multiRobotA : Symbol(multiRobotA, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues2.ts, 4, 3)) + +let [nameMC = "noName" ] = ["roomba", ["vaccum", "mopping"]]; +>nameMC : Symbol(nameMC, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues2.ts, 11, 5)) + +let [nameMC2 = "noName", [primarySkillC = "noSkill", secondarySkillC = "noSkill"] = ["noSkill", "noSkill"]] = ["roomba", ["vaccum", "mopping"]]; +>nameMC2 : Symbol(nameMC2, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues2.ts, 12, 5)) +>primarySkillC : Symbol(primarySkillC, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues2.ts, 12, 26)) +>secondarySkillC : Symbol(secondarySkillC, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues2.ts, 12, 52)) + +if (nameMB == nameMA) { +>nameMB : Symbol(nameMB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues2.ts, 8, 5)) +>nameMA : Symbol(nameMA, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues2.ts, 9, 5)) + + console.log(skillA[0] + skillA[1]); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues2.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues2.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues2.ts, 0, 22)) +>skillA : Symbol(skillA, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues2.ts, 7, 6)) +>skillA : Symbol(skillA, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues2.ts, 7, 6)) +} diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues2.types b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues2.types new file mode 100644 index 00000000000..12215507d4a --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues2.types @@ -0,0 +1,97 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues2.ts === +declare var console: { +>console : { log(msg: string): void; } + + log(msg: string): void; +>log : (msg: string) => void +>msg : string +} +type MultiSkilledRobot = [string, string[]]; +>MultiSkilledRobot : [string, string[]] + +var multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; +>multiRobotA : [string, string[]] +>MultiSkilledRobot : [string, string[]] +>["mower", ["mowing", ""]] : [string, string[]] +>"mower" : string +>["mowing", ""] : string[] +>"mowing" : string +>"" : string + +var multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; +>multiRobotB : [string, string[]] +>MultiSkilledRobot : [string, string[]] +>["trimmer", ["trimming", "edging"]] : [string, string[]] +>"trimmer" : string +>["trimming", "edging"] : string[] +>"trimming" : string +>"edging" : string + +let [, skillA = ["noSkill", "noSkill"]] = multiRobotA; +> : undefined +>skillA : string[] +>["noSkill", "noSkill"] : string[] +>"noSkill" : string +>"noSkill" : string +>multiRobotA : [string, string[]] + +let [nameMB = "noName" ] = multiRobotB; +>nameMB : string +>"noName" : string +>multiRobotB : [string, string[]] + +let [nameMA = "noName", [primarySkillA = "noSkill", secondarySkillA = "noSkill"] = ["noSkill", "noSkill"]] = multiRobotA; +>nameMA : string +>"noName" : string +>primarySkillA : string +>"noSkill" : string +>secondarySkillA : string +>"noSkill" : string +>["noSkill", "noSkill"] : [string, string] +>"noSkill" : string +>"noSkill" : string +>multiRobotA : [string, string[]] + +let [nameMC = "noName" ] = ["roomba", ["vaccum", "mopping"]]; +>nameMC : string +>"noName" : string +>["roomba", ["vaccum", "mopping"]] : [string, string[]] +>"roomba" : string +>["vaccum", "mopping"] : string[] +>"vaccum" : string +>"mopping" : string + +let [nameMC2 = "noName", [primarySkillC = "noSkill", secondarySkillC = "noSkill"] = ["noSkill", "noSkill"]] = ["roomba", ["vaccum", "mopping"]]; +>nameMC2 : string +>"noName" : string +>primarySkillC : string +>"noSkill" : string +>secondarySkillC : string +>"noSkill" : string +>["noSkill", "noSkill"] : [string, string] +>"noSkill" : string +>"noSkill" : string +>["roomba", ["vaccum", "mopping"]] : [string, [string, string]] +>"roomba" : string +>["vaccum", "mopping"] : [string, string] +>"vaccum" : string +>"mopping" : string + +if (nameMB == nameMA) { +>nameMB == nameMA : boolean +>nameMB : string +>nameMA : string + + console.log(skillA[0] + skillA[1]); +>console.log(skillA[0] + skillA[1]) : void +>console.log : (msg: string) => void +>console : { log(msg: string): void; } +>log : (msg: string) => void +>skillA[0] + skillA[1] : string +>skillA[0] : string +>skillA : string[] +>0 : number +>skillA[1] : string +>skillA : string[] +>1 : number +} diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.js b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.js new file mode 100644 index 00000000000..deb2680000f --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.js @@ -0,0 +1,97 @@ +//// [sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts] +declare var console: { + log(msg: any): void; +} +type Robot = [number, string, string]; +type MultiSkilledRobot = [string, string[]]; + +var robotA: Robot = [1, "mower", "mowing"]; +var robotB: Robot = [2, "trimmer", "trimming"]; +var multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; +var multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; + +let nameA: string, numberB: number, nameB: string, skillB: string; +let robotAInfo: (number | string)[]; + +let multiSkillB: string[], nameMB: string, primarySkillB: string, secondarySkillB: string; +let multiRobotAInfo: (string | string[])[]; + +[, nameA = "helloNoName"] = robotA; +[, nameB = "helloNoName"] = getRobotB(); +[, nameB = "helloNoName"] = [2, "trimmer", "trimming"]; +[, multiSkillB = []] = multiRobotB; +[, multiSkillB = []] = getMultiRobotB(); +[, multiSkillB = []] = ["roomba", ["vaccum", "mopping"]]; + +[numberB = -1] = robotB; +[numberB = -1] = getRobotB(); +[numberB = -1] = [2, "trimmer", "trimming"]; +[nameMB = "helloNoName"] = multiRobotB; +[nameMB = "helloNoName"] = getMultiRobotB(); +[nameMB = "helloNoName"] = ["trimmer", ["trimming", "edging"]]; + +[numberB = -1, nameB = "helloNoName", skillB = "noSkill"] = robotB; +[numberB = -1, nameB = "helloNoName", skillB = "noSkill"] = getRobotB(); +[numberB = -1, nameB = "helloNoName", skillB = "noSkill"] = [2, "trimmer", "trimming"]; +[nameMB = "helloNoName", [primarySkillB = "noSkill", secondarySkillB = "noSkill"] = []] = multiRobotB; +[nameMB = "helloNoName", [primarySkillB = "noSkill", secondarySkillB = "noSkill"] = []] = getMultiRobotB(); +[nameMB = "helloNoName", [primarySkillB = "noSkill", secondarySkillB = "noSkill"] = []] = + ["trimmer", ["trimming", "edging"]]; + +[numberB = -1, ...robotAInfo] = robotB; +[numberB = -1, ...robotAInfo] = getRobotB(); +[numberB = -1, ...robotAInfo] = [2, "trimmer", "trimming"]; + +if (nameA == nameB) { + console.log(skillB); +} + +function getRobotB() { + return robotB; +} + +function getMultiRobotB() { + return multiRobotB; +} + +//// [sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.js] +var robotA = [1, "mower", "mowing"]; +var robotB = [2, "trimmer", "trimming"]; +var multiRobotA = ["mower", ["mowing", ""]]; +var multiRobotB = ["trimmer", ["trimming", "edging"]]; +var nameA, numberB, nameB, skillB; +var robotAInfo; +var multiSkillB, nameMB, primarySkillB, secondarySkillB; +var multiRobotAInfo; +_a = robotA[1], nameA = _a === void 0 ? "helloNoName" : _a; +_b = getRobotB(), _c = _b[1], nameB = _c === void 0 ? "helloNoName" : _c; +_d = [2, "trimmer", "trimming"], _e = _d[1], nameB = _e === void 0 ? "helloNoName" : _e; +_f = multiRobotB[1], multiSkillB = _f === void 0 ? [] : _f; +_g = getMultiRobotB(), _h = _g[1], multiSkillB = _h === void 0 ? [] : _h; +_j = ["roomba", ["vaccum", "mopping"]], _k = _j[1], multiSkillB = _k === void 0 ? [] : _k; +_l = robotB[0], numberB = _l === void 0 ? -1 : _l; +_m = getRobotB()[0], numberB = _m === void 0 ? -1 : _m; +_o = [2, "trimmer", "trimming"][0], numberB = _o === void 0 ? -1 : _o; +_p = multiRobotB[0], nameMB = _p === void 0 ? "helloNoName" : _p; +_q = getMultiRobotB()[0], nameMB = _q === void 0 ? "helloNoName" : _q; +_r = ["trimmer", ["trimming", "edging"]][0], nameMB = _r === void 0 ? "helloNoName" : _r; +_s = robotB[0], numberB = _s === void 0 ? -1 : _s, _t = robotB[1], nameB = _t === void 0 ? "helloNoName" : _t, _u = robotB[2], skillB = _u === void 0 ? "noSkill" : _u; +_v = getRobotB(), _w = _v[0], numberB = _w === void 0 ? -1 : _w, _x = _v[1], nameB = _x === void 0 ? "helloNoName" : _x, _y = _v[2], skillB = _y === void 0 ? "noSkill" : _y; +_z = [2, "trimmer", "trimming"], _0 = _z[0], numberB = _0 === void 0 ? -1 : _0, _1 = _z[1], nameB = _1 === void 0 ? "helloNoName" : _1, _2 = _z[2], skillB = _2 === void 0 ? "noSkill" : _2; +_3 = multiRobotB[0], nameMB = _3 === void 0 ? "helloNoName" : _3, _4 = multiRobotB[1], _5 = _4 === void 0 ? [] : _4, _6 = _5[0], primarySkillB = _6 === void 0 ? "noSkill" : _6, _7 = _5[1], secondarySkillB = _7 === void 0 ? "noSkill" : _7; +_8 = getMultiRobotB(), _9 = _8[0], nameMB = _9 === void 0 ? "helloNoName" : _9, _10 = _8[1], _11 = _10 === void 0 ? [] : _10, _12 = _11[0], primarySkillB = _12 === void 0 ? "noSkill" : _12, _13 = _11[1], secondarySkillB = _13 === void 0 ? "noSkill" : _13; +_14 = ["trimmer", ["trimming", "edging"]], _15 = _14[0], nameMB = _15 === void 0 ? "helloNoName" : _15, _16 = _14[1], _17 = _16 === void 0 ? [] : _16, _18 = _17[0], primarySkillB = _18 === void 0 ? "noSkill" : _18, _19 = _17[1], secondarySkillB = _19 === void 0 ? "noSkill" : _19; +_20 = robotB[0], numberB = _20 === void 0 ? -1 : _20, robotAInfo = robotB.slice(1); +_21 = getRobotB(), _22 = _21[0], numberB = _22 === void 0 ? -1 : _22, robotAInfo = _21.slice(1); +_23 = [2, "trimmer", "trimming"], _24 = _23[0], numberB = _24 === void 0 ? -1 : _24, robotAInfo = _23.slice(1); +if (nameA == nameB) { + console.log(skillB); +} +function getRobotB() { + return robotB; +} +function getMultiRobotB() { + return multiRobotB; +} +var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24; +//# sourceMappingURL=sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.js.map b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.js.map new file mode 100644 index 00000000000..1b7453826e4 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.js.map @@ -0,0 +1,2 @@ +//// [sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.js.map] +{"version":3,"file":"sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.js","sourceRoot":"","sources":["sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts"],"names":[],"mappings":"AAMA,IAAI,MAAM,GAAU,CAAC,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;AAC3C,IAAI,MAAM,GAAU,CAAC,CAAC,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;AAC/C,IAAI,WAAW,GAAsB,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC;AAC/D,IAAI,WAAW,GAAsB,CAAC,SAAS,EAAE,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC,CAAC;AAEzE,IAAI,KAAa,EAAE,OAAe,EAAE,KAAa,EAAE,MAAc,CAAC;AAClE,IAAI,UAA+B,CAAC;AAEpC,IAAI,WAAqB,EAAE,MAAc,EAAE,aAAqB,EAAE,eAAuB,CAAC;AAC1F,IAAI,eAAsC,CAAC;AAExC,cAAqB,EAArB,0CAAqB,CAAW;AACnC,gBAAuC,EAApC,UAAqB,EAArB,0CAAqB,CAAgB;AACxC,+BAAsD,EAAnD,UAAqB,EAArB,0CAAqB,CAA+B;AACpD,mBAAgB,EAAhB,qCAAgB,CAAgB;AACnC,qBAAuC,EAApC,UAAgB,EAAhB,qCAAgB,CAAqB;AACxC,sCAAwD,EAArD,UAAgB,EAAhB,qCAAgB,CAAsC;AAExD,cAAY,EAAZ,iCAAY,CAAW;AACvB,mBAAY,EAAZ,iCAAY,CAAgB;AAC5B,kCAAY,EAAZ,iCAAY,CAA+B;AAC3C,mBAAsB,EAAtB,2CAAsB,CAAgB;AACtC,wBAAsB,EAAtB,2CAAsB,CAAqB;AAC3C,2CAAsB,EAAtB,2CAAsB,CAAwC;AAE9D,cAAY,EAAZ,iCAAY,EAAE,cAAqB,EAArB,0CAAqB,EAAE,cAAkB,EAAlB,uCAAkB,CAAW;AACnE,gBAAuE,EAAtE,UAAY,EAAZ,iCAAY,EAAE,UAAqB,EAArB,0CAAqB,EAAE,UAAkB,EAAlB,uCAAkB,CAAgB;AACxE,+BAAsF,EAArF,UAAY,EAAZ,iCAAY,EAAE,UAAqB,EAArB,0CAAqB,EAAE,UAAkB,EAAlB,uCAAkB,CAA+B;AACtF,mBAAsB,EAAtB,2CAAsB,EAAE,mBAA6D,EAA7D,4BAA6D,EAA5D,UAAyB,EAAzB,8CAAyB,EAAE,UAA2B,EAA3B,gDAA2B,CAAsB;AACtG,qBAA0G,EAAzG,UAAsB,EAAtB,2CAAsB,EAAE,WAA6D,EAA7D,+BAA6D,EAA5D,YAAyB,EAAzB,gDAAyB,EAAE,YAA2B,EAA3B,kDAA2B,CAA2B;AAC3G,yCACuC,EADtC,YAAsB,EAAtB,6CAAsB,EAAE,YAA6D,EAA7D,+BAA6D,EAA5D,YAAyB,EAAzB,gDAAyB,EAAE,YAA2B,EAA3B,kDAA2B,CACxC;AAEvC,eAAY,EAAZ,mCAAY,EAAE,4BAAa,CAAW;AACvC,iBAA2C,EAA1C,YAAY,EAAZ,mCAAY,EAAE,yBAAa,CAAgB;AAC5C,gCAAiE,EAAhE,YAAY,EAAZ,mCAAY,EAAE,yBAAa,CAAsC;AAElE,EAAE,CAAC,CAAC,KAAK,IAAI,KAAK,CAAC,CAAC,CAAC;IACjB,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACxB,CAAC;AAED;IACI,MAAM,CAAC,MAAM,CAAC;AAClB,CAAC;AAED;IACI,MAAM,CAAC,WAAW,CAAC;AACvB,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.sourcemap.txt b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.sourcemap.txt new file mode 100644 index 00000000000..c9784dc30a3 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.sourcemap.txt @@ -0,0 +1,1090 @@ +=================================================================== +JsFile: sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.js +mapUrl: sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.js.map +sourceRoot: +sources: sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.js +sourceFile:sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts +------------------------------------------------------------------- +>>>var robotA = [1, "mower", "mowing"]; +1 > +2 >^^^^ +3 > ^^^^^^ +4 > ^^^ +5 > ^ +6 > ^ +7 > ^^ +8 > ^^^^^^^ +9 > ^^ +10> ^^^^^^^^ +11> ^ +12> ^ +13> ^^^^^-> +1 >declare var console: { + > log(msg: any): void; + >} + >type Robot = [number, string, string]; + >type MultiSkilledRobot = [string, string[]]; + > + > +2 >var +3 > robotA +4 > : Robot = +5 > [ +6 > 1 +7 > , +8 > "mower" +9 > , +10> "mowing" +11> ] +12> ; +1 >Emitted(1, 1) Source(7, 1) + SourceIndex(0) +2 >Emitted(1, 5) Source(7, 5) + SourceIndex(0) +3 >Emitted(1, 11) Source(7, 11) + SourceIndex(0) +4 >Emitted(1, 14) Source(7, 21) + SourceIndex(0) +5 >Emitted(1, 15) Source(7, 22) + SourceIndex(0) +6 >Emitted(1, 16) Source(7, 23) + SourceIndex(0) +7 >Emitted(1, 18) Source(7, 25) + SourceIndex(0) +8 >Emitted(1, 25) Source(7, 32) + SourceIndex(0) +9 >Emitted(1, 27) Source(7, 34) + SourceIndex(0) +10>Emitted(1, 35) Source(7, 42) + SourceIndex(0) +11>Emitted(1, 36) Source(7, 43) + SourceIndex(0) +12>Emitted(1, 37) Source(7, 44) + SourceIndex(0) +--- +>>>var robotB = [2, "trimmer", "trimming"]; +1-> +2 >^^^^ +3 > ^^^^^^ +4 > ^^^ +5 > ^ +6 > ^ +7 > ^^ +8 > ^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^ +11> ^ +12> ^ +13> ^^^^^-> +1-> + > +2 >var +3 > robotB +4 > : Robot = +5 > [ +6 > 2 +7 > , +8 > "trimmer" +9 > , +10> "trimming" +11> ] +12> ; +1->Emitted(2, 1) Source(8, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(8, 5) + SourceIndex(0) +3 >Emitted(2, 11) Source(8, 11) + SourceIndex(0) +4 >Emitted(2, 14) Source(8, 21) + SourceIndex(0) +5 >Emitted(2, 15) Source(8, 22) + SourceIndex(0) +6 >Emitted(2, 16) Source(8, 23) + SourceIndex(0) +7 >Emitted(2, 18) Source(8, 25) + SourceIndex(0) +8 >Emitted(2, 27) Source(8, 34) + SourceIndex(0) +9 >Emitted(2, 29) Source(8, 36) + SourceIndex(0) +10>Emitted(2, 39) Source(8, 46) + SourceIndex(0) +11>Emitted(2, 40) Source(8, 47) + SourceIndex(0) +12>Emitted(2, 41) Source(8, 48) + SourceIndex(0) +--- +>>>var multiRobotA = ["mower", ["mowing", ""]]; +1-> +2 >^^^^ +3 > ^^^^^^^^^^^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^ +7 > ^^ +8 > ^ +9 > ^^^^^^^^ +10> ^^ +11> ^^ +12> ^ +13> ^ +14> ^ +15> ^^^^^^^^^^^-> +1-> + > +2 >var +3 > multiRobotA +4 > : MultiSkilledRobot = +5 > [ +6 > "mower" +7 > , +8 > [ +9 > "mowing" +10> , +11> "" +12> ] +13> ] +14> ; +1->Emitted(3, 1) Source(9, 1) + SourceIndex(0) +2 >Emitted(3, 5) Source(9, 5) + SourceIndex(0) +3 >Emitted(3, 16) Source(9, 16) + SourceIndex(0) +4 >Emitted(3, 19) Source(9, 38) + SourceIndex(0) +5 >Emitted(3, 20) Source(9, 39) + SourceIndex(0) +6 >Emitted(3, 27) Source(9, 46) + SourceIndex(0) +7 >Emitted(3, 29) Source(9, 48) + SourceIndex(0) +8 >Emitted(3, 30) Source(9, 49) + SourceIndex(0) +9 >Emitted(3, 38) Source(9, 57) + SourceIndex(0) +10>Emitted(3, 40) Source(9, 59) + SourceIndex(0) +11>Emitted(3, 42) Source(9, 61) + SourceIndex(0) +12>Emitted(3, 43) Source(9, 62) + SourceIndex(0) +13>Emitted(3, 44) Source(9, 63) + SourceIndex(0) +14>Emitted(3, 45) Source(9, 64) + SourceIndex(0) +--- +>>>var multiRobotB = ["trimmer", ["trimming", "edging"]]; +1-> +2 >^^^^ +3 > ^^^^^^^^^^^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^^ +7 > ^^ +8 > ^ +9 > ^^^^^^^^^^ +10> ^^ +11> ^^^^^^^^ +12> ^ +13> ^ +14> ^ +1-> + > +2 >var +3 > multiRobotB +4 > : MultiSkilledRobot = +5 > [ +6 > "trimmer" +7 > , +8 > [ +9 > "trimming" +10> , +11> "edging" +12> ] +13> ] +14> ; +1->Emitted(4, 1) Source(10, 1) + SourceIndex(0) +2 >Emitted(4, 5) Source(10, 5) + SourceIndex(0) +3 >Emitted(4, 16) Source(10, 16) + SourceIndex(0) +4 >Emitted(4, 19) Source(10, 38) + SourceIndex(0) +5 >Emitted(4, 20) Source(10, 39) + SourceIndex(0) +6 >Emitted(4, 29) Source(10, 48) + SourceIndex(0) +7 >Emitted(4, 31) Source(10, 50) + SourceIndex(0) +8 >Emitted(4, 32) Source(10, 51) + SourceIndex(0) +9 >Emitted(4, 42) Source(10, 61) + SourceIndex(0) +10>Emitted(4, 44) Source(10, 63) + SourceIndex(0) +11>Emitted(4, 52) Source(10, 71) + SourceIndex(0) +12>Emitted(4, 53) Source(10, 72) + SourceIndex(0) +13>Emitted(4, 54) Source(10, 73) + SourceIndex(0) +14>Emitted(4, 55) Source(10, 74) + SourceIndex(0) +--- +>>>var nameA, numberB, nameB, skillB; +1 > +2 >^^^^ +3 > ^^^^^ +4 > ^^ +5 > ^^^^^^^ +6 > ^^ +7 > ^^^^^ +8 > ^^ +9 > ^^^^^^ +10> ^ +1 > + > + > +2 >let +3 > nameA: string +4 > , +5 > numberB: number +6 > , +7 > nameB: string +8 > , +9 > skillB: string +10> ; +1 >Emitted(5, 1) Source(12, 1) + SourceIndex(0) +2 >Emitted(5, 5) Source(12, 5) + SourceIndex(0) +3 >Emitted(5, 10) Source(12, 18) + SourceIndex(0) +4 >Emitted(5, 12) Source(12, 20) + SourceIndex(0) +5 >Emitted(5, 19) Source(12, 35) + SourceIndex(0) +6 >Emitted(5, 21) Source(12, 37) + SourceIndex(0) +7 >Emitted(5, 26) Source(12, 50) + SourceIndex(0) +8 >Emitted(5, 28) Source(12, 52) + SourceIndex(0) +9 >Emitted(5, 34) Source(12, 66) + SourceIndex(0) +10>Emitted(5, 35) Source(12, 67) + SourceIndex(0) +--- +>>>var robotAInfo; +1 > +2 >^^^^ +3 > ^^^^^^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >let +3 > robotAInfo: (number | string)[] +4 > ; +1 >Emitted(6, 1) Source(13, 1) + SourceIndex(0) +2 >Emitted(6, 5) Source(13, 5) + SourceIndex(0) +3 >Emitted(6, 15) Source(13, 36) + SourceIndex(0) +4 >Emitted(6, 16) Source(13, 37) + SourceIndex(0) +--- +>>>var multiSkillB, nameMB, primarySkillB, secondarySkillB; +1-> +2 >^^^^ +3 > ^^^^^^^^^^^ +4 > ^^ +5 > ^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^ +10> ^ +1-> + > + > +2 >let +3 > multiSkillB: string[] +4 > , +5 > nameMB: string +6 > , +7 > primarySkillB: string +8 > , +9 > secondarySkillB: string +10> ; +1->Emitted(7, 1) Source(15, 1) + SourceIndex(0) +2 >Emitted(7, 5) Source(15, 5) + SourceIndex(0) +3 >Emitted(7, 16) Source(15, 26) + SourceIndex(0) +4 >Emitted(7, 18) Source(15, 28) + SourceIndex(0) +5 >Emitted(7, 24) Source(15, 42) + SourceIndex(0) +6 >Emitted(7, 26) Source(15, 44) + SourceIndex(0) +7 >Emitted(7, 39) Source(15, 65) + SourceIndex(0) +8 >Emitted(7, 41) Source(15, 67) + SourceIndex(0) +9 >Emitted(7, 56) Source(15, 90) + SourceIndex(0) +10>Emitted(7, 57) Source(15, 91) + SourceIndex(0) +--- +>>>var multiRobotAInfo; +1 > +2 >^^^^ +3 > ^^^^^^^^^^^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >let +3 > multiRobotAInfo: (string | string[])[] +4 > ; +1 >Emitted(8, 1) Source(16, 1) + SourceIndex(0) +2 >Emitted(8, 5) Source(16, 5) + SourceIndex(0) +3 >Emitted(8, 20) Source(16, 43) + SourceIndex(0) +4 >Emitted(8, 21) Source(16, 44) + SourceIndex(0) +--- +>>>_a = robotA[1], nameA = _a === void 0 ? "helloNoName" : _a; +1-> +2 >^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +5 > ^ +6 > ^^^^^^^^^^^^^^^-> +1-> + > + >[, +2 >nameA = "helloNoName" +3 > +4 > nameA = "helloNoName" +5 > ] = robotA; +1->Emitted(9, 1) Source(18, 4) + SourceIndex(0) +2 >Emitted(9, 15) Source(18, 25) + SourceIndex(0) +3 >Emitted(9, 17) Source(18, 4) + SourceIndex(0) +4 >Emitted(9, 59) Source(18, 25) + SourceIndex(0) +5 >Emitted(9, 60) Source(18, 36) + SourceIndex(0) +--- +>>>_b = getRobotB(), _c = _b[1], nameB = _c === void 0 ? "helloNoName" : _c; +1-> +2 >^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^ +8 > ^^^^^^^^^^^^^^^^-> +1-> + > +2 >[, nameB = "helloNoName"] = getRobotB() +3 > +4 > nameB = "helloNoName" +5 > +6 > nameB = "helloNoName" +7 > ] = getRobotB(); +1->Emitted(10, 1) Source(19, 1) + SourceIndex(0) +2 >Emitted(10, 17) Source(19, 40) + SourceIndex(0) +3 >Emitted(10, 19) Source(19, 4) + SourceIndex(0) +4 >Emitted(10, 29) Source(19, 25) + SourceIndex(0) +5 >Emitted(10, 31) Source(19, 4) + SourceIndex(0) +6 >Emitted(10, 73) Source(19, 25) + SourceIndex(0) +7 >Emitted(10, 74) Source(19, 41) + SourceIndex(0) +--- +>>>_d = [2, "trimmer", "trimming"], _e = _d[1], nameB = _e === void 0 ? "helloNoName" : _e; +1-> +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^ +1-> + > +2 >[, nameB = "helloNoName"] = [2, "trimmer", "trimming"] +3 > +4 > nameB = "helloNoName" +5 > +6 > nameB = "helloNoName" +7 > ] = [2, "trimmer", "trimming"]; +1->Emitted(11, 1) Source(20, 1) + SourceIndex(0) +2 >Emitted(11, 32) Source(20, 55) + SourceIndex(0) +3 >Emitted(11, 34) Source(20, 4) + SourceIndex(0) +4 >Emitted(11, 44) Source(20, 25) + SourceIndex(0) +5 >Emitted(11, 46) Source(20, 4) + SourceIndex(0) +6 >Emitted(11, 88) Source(20, 25) + SourceIndex(0) +7 >Emitted(11, 89) Source(20, 56) + SourceIndex(0) +--- +>>>_f = multiRobotB[1], multiSkillB = _f === void 0 ? [] : _f; +1 > +2 >^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +5 > ^ +6 > ^^^^^^^^^^^^^^^-> +1 > + >[, +2 >multiSkillB = [] +3 > +4 > multiSkillB = [] +5 > ] = multiRobotB; +1 >Emitted(12, 1) Source(21, 4) + SourceIndex(0) +2 >Emitted(12, 20) Source(21, 20) + SourceIndex(0) +3 >Emitted(12, 22) Source(21, 4) + SourceIndex(0) +4 >Emitted(12, 59) Source(21, 20) + SourceIndex(0) +5 >Emitted(12, 60) Source(21, 36) + SourceIndex(0) +--- +>>>_g = getMultiRobotB(), _h = _g[1], multiSkillB = _h === void 0 ? [] : _h; +1-> +2 >^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^ +8 > ^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >[, multiSkillB = []] = getMultiRobotB() +3 > +4 > multiSkillB = [] +5 > +6 > multiSkillB = [] +7 > ] = getMultiRobotB(); +1->Emitted(13, 1) Source(22, 1) + SourceIndex(0) +2 >Emitted(13, 22) Source(22, 40) + SourceIndex(0) +3 >Emitted(13, 24) Source(22, 4) + SourceIndex(0) +4 >Emitted(13, 34) Source(22, 20) + SourceIndex(0) +5 >Emitted(13, 36) Source(22, 4) + SourceIndex(0) +6 >Emitted(13, 73) Source(22, 20) + SourceIndex(0) +7 >Emitted(13, 74) Source(22, 41) + SourceIndex(0) +--- +>>>_j = ["roomba", ["vaccum", "mopping"]], _k = _j[1], multiSkillB = _k === void 0 ? [] : _k; +1-> +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^ +1-> + > +2 >[, multiSkillB = []] = ["roomba", ["vaccum", "mopping"]] +3 > +4 > multiSkillB = [] +5 > +6 > multiSkillB = [] +7 > ] = ["roomba", ["vaccum", "mopping"]]; +1->Emitted(14, 1) Source(23, 1) + SourceIndex(0) +2 >Emitted(14, 39) Source(23, 57) + SourceIndex(0) +3 >Emitted(14, 41) Source(23, 4) + SourceIndex(0) +4 >Emitted(14, 51) Source(23, 20) + SourceIndex(0) +5 >Emitted(14, 53) Source(23, 4) + SourceIndex(0) +6 >Emitted(14, 90) Source(23, 20) + SourceIndex(0) +7 >Emitted(14, 91) Source(23, 58) + SourceIndex(0) +--- +>>>_l = robotB[0], numberB = _l === void 0 ? -1 : _l; +1 > +2 >^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +5 > ^ +6 > ^^^^^^-> +1 > + > + >[ +2 >numberB = -1 +3 > +4 > numberB = -1 +5 > ] = robotB; +1 >Emitted(15, 1) Source(25, 2) + SourceIndex(0) +2 >Emitted(15, 15) Source(25, 14) + SourceIndex(0) +3 >Emitted(15, 17) Source(25, 2) + SourceIndex(0) +4 >Emitted(15, 50) Source(25, 14) + SourceIndex(0) +5 >Emitted(15, 51) Source(25, 25) + SourceIndex(0) +--- +>>>_m = getRobotB()[0], numberB = _m === void 0 ? -1 : _m; +1-> +2 >^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^-> +1-> + >[ +2 >numberB = -1 +3 > +4 > numberB = -1 +5 > ] = getRobotB(); +1->Emitted(16, 1) Source(26, 2) + SourceIndex(0) +2 >Emitted(16, 20) Source(26, 14) + SourceIndex(0) +3 >Emitted(16, 22) Source(26, 2) + SourceIndex(0) +4 >Emitted(16, 55) Source(26, 14) + SourceIndex(0) +5 >Emitted(16, 56) Source(26, 30) + SourceIndex(0) +--- +>>>_o = [2, "trimmer", "trimming"][0], numberB = _o === void 0 ? -1 : _o; +1-> +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +5 > ^ +1-> + >[ +2 >numberB = -1 +3 > +4 > numberB = -1 +5 > ] = [2, "trimmer", "trimming"]; +1->Emitted(17, 1) Source(27, 2) + SourceIndex(0) +2 >Emitted(17, 35) Source(27, 14) + SourceIndex(0) +3 >Emitted(17, 37) Source(27, 2) + SourceIndex(0) +4 >Emitted(17, 70) Source(27, 14) + SourceIndex(0) +5 >Emitted(17, 71) Source(27, 45) + SourceIndex(0) +--- +>>>_p = multiRobotB[0], nameMB = _p === void 0 ? "helloNoName" : _p; +1 > +2 >^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +5 > ^ +6 > ^^^^^^-> +1 > + >[ +2 >nameMB = "helloNoName" +3 > +4 > nameMB = "helloNoName" +5 > ] = multiRobotB; +1 >Emitted(18, 1) Source(28, 2) + SourceIndex(0) +2 >Emitted(18, 20) Source(28, 24) + SourceIndex(0) +3 >Emitted(18, 22) Source(28, 2) + SourceIndex(0) +4 >Emitted(18, 65) Source(28, 24) + SourceIndex(0) +5 >Emitted(18, 66) Source(28, 40) + SourceIndex(0) +--- +>>>_q = getMultiRobotB()[0], nameMB = _q === void 0 ? "helloNoName" : _q; +1-> +2 >^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^-> +1-> + >[ +2 >nameMB = "helloNoName" +3 > +4 > nameMB = "helloNoName" +5 > ] = getMultiRobotB(); +1->Emitted(19, 1) Source(29, 2) + SourceIndex(0) +2 >Emitted(19, 25) Source(29, 24) + SourceIndex(0) +3 >Emitted(19, 27) Source(29, 2) + SourceIndex(0) +4 >Emitted(19, 70) Source(29, 24) + SourceIndex(0) +5 >Emitted(19, 71) Source(29, 45) + SourceIndex(0) +--- +>>>_r = ["trimmer", ["trimming", "edging"]][0], nameMB = _r === void 0 ? "helloNoName" : _r; +1-> +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + >[ +2 >nameMB = "helloNoName" +3 > +4 > nameMB = "helloNoName" +5 > ] = ["trimmer", ["trimming", "edging"]]; +1->Emitted(20, 1) Source(30, 2) + SourceIndex(0) +2 >Emitted(20, 44) Source(30, 24) + SourceIndex(0) +3 >Emitted(20, 46) Source(30, 2) + SourceIndex(0) +4 >Emitted(20, 89) Source(30, 24) + SourceIndex(0) +5 >Emitted(20, 90) Source(30, 64) + SourceIndex(0) +--- +>>>_s = robotB[0], numberB = _s === void 0 ? -1 : _s, _t = robotB[1], nameB = _t === void 0 ? "helloNoName" : _t, _u = robotB[2], skillB = _u === void 0 ? "noSkill" : _u; +1-> +2 >^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +13> ^ +14> ^^^^^^^-> +1-> + > + >[ +2 >numberB = -1 +3 > +4 > numberB = -1 +5 > , +6 > nameB = "helloNoName" +7 > +8 > nameB = "helloNoName" +9 > , +10> skillB = "noSkill" +11> +12> skillB = "noSkill" +13> ] = robotB; +1->Emitted(21, 1) Source(32, 2) + SourceIndex(0) +2 >Emitted(21, 15) Source(32, 14) + SourceIndex(0) +3 >Emitted(21, 17) Source(32, 2) + SourceIndex(0) +4 >Emitted(21, 50) Source(32, 14) + SourceIndex(0) +5 >Emitted(21, 52) Source(32, 16) + SourceIndex(0) +6 >Emitted(21, 66) Source(32, 37) + SourceIndex(0) +7 >Emitted(21, 68) Source(32, 16) + SourceIndex(0) +8 >Emitted(21, 110) Source(32, 37) + SourceIndex(0) +9 >Emitted(21, 112) Source(32, 39) + SourceIndex(0) +10>Emitted(21, 126) Source(32, 57) + SourceIndex(0) +11>Emitted(21, 128) Source(32, 39) + SourceIndex(0) +12>Emitted(21, 167) Source(32, 57) + SourceIndex(0) +13>Emitted(21, 168) Source(32, 68) + SourceIndex(0) +--- +>>>_v = getRobotB(), _w = _v[0], numberB = _w === void 0 ? -1 : _w, _x = _v[1], nameB = _x === void 0 ? "helloNoName" : _x, _y = _v[2], skillB = _y === void 0 ? "noSkill" : _y; +1-> +2 >^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +15> ^ +16> ^^^^^^^^^^^^^^^^-> +1-> + > +2 >[numberB = -1, nameB = "helloNoName", skillB = "noSkill"] = getRobotB() +3 > +4 > numberB = -1 +5 > +6 > numberB = -1 +7 > , +8 > nameB = "helloNoName" +9 > +10> nameB = "helloNoName" +11> , +12> skillB = "noSkill" +13> +14> skillB = "noSkill" +15> ] = getRobotB(); +1->Emitted(22, 1) Source(33, 1) + SourceIndex(0) +2 >Emitted(22, 17) Source(33, 72) + SourceIndex(0) +3 >Emitted(22, 19) Source(33, 2) + SourceIndex(0) +4 >Emitted(22, 29) Source(33, 14) + SourceIndex(0) +5 >Emitted(22, 31) Source(33, 2) + SourceIndex(0) +6 >Emitted(22, 64) Source(33, 14) + SourceIndex(0) +7 >Emitted(22, 66) Source(33, 16) + SourceIndex(0) +8 >Emitted(22, 76) Source(33, 37) + SourceIndex(0) +9 >Emitted(22, 78) Source(33, 16) + SourceIndex(0) +10>Emitted(22, 120) Source(33, 37) + SourceIndex(0) +11>Emitted(22, 122) Source(33, 39) + SourceIndex(0) +12>Emitted(22, 132) Source(33, 57) + SourceIndex(0) +13>Emitted(22, 134) Source(33, 39) + SourceIndex(0) +14>Emitted(22, 173) Source(33, 57) + SourceIndex(0) +15>Emitted(22, 174) Source(33, 73) + SourceIndex(0) +--- +>>>_z = [2, "trimmer", "trimming"], _0 = _z[0], numberB = _0 === void 0 ? -1 : _0, _1 = _z[1], nameB = _1 === void 0 ? "helloNoName" : _1, _2 = _z[2], skillB = _2 === void 0 ? "noSkill" : _2; +1-> +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +15> ^ +16> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >[numberB = -1, nameB = "helloNoName", skillB = "noSkill"] = [2, "trimmer", "trimming"] +3 > +4 > numberB = -1 +5 > +6 > numberB = -1 +7 > , +8 > nameB = "helloNoName" +9 > +10> nameB = "helloNoName" +11> , +12> skillB = "noSkill" +13> +14> skillB = "noSkill" +15> ] = [2, "trimmer", "trimming"]; +1->Emitted(23, 1) Source(34, 1) + SourceIndex(0) +2 >Emitted(23, 32) Source(34, 87) + SourceIndex(0) +3 >Emitted(23, 34) Source(34, 2) + SourceIndex(0) +4 >Emitted(23, 44) Source(34, 14) + SourceIndex(0) +5 >Emitted(23, 46) Source(34, 2) + SourceIndex(0) +6 >Emitted(23, 79) Source(34, 14) + SourceIndex(0) +7 >Emitted(23, 81) Source(34, 16) + SourceIndex(0) +8 >Emitted(23, 91) Source(34, 37) + SourceIndex(0) +9 >Emitted(23, 93) Source(34, 16) + SourceIndex(0) +10>Emitted(23, 135) Source(34, 37) + SourceIndex(0) +11>Emitted(23, 137) Source(34, 39) + SourceIndex(0) +12>Emitted(23, 147) Source(34, 57) + SourceIndex(0) +13>Emitted(23, 149) Source(34, 39) + SourceIndex(0) +14>Emitted(23, 188) Source(34, 57) + SourceIndex(0) +15>Emitted(23, 189) Source(34, 88) + SourceIndex(0) +--- +>>>_3 = multiRobotB[0], nameMB = _3 === void 0 ? "helloNoName" : _3, _4 = multiRobotB[1], _5 = _4 === void 0 ? [] : _4, _6 = _5[0], primarySkillB = _6 === void 0 ? "noSkill" : _6, _7 = _5[1], secondarySkillB = _7 === void 0 ? "noSkill" : _7; +1-> +2 >^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^ +15> ^^ +16> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +17> ^ +18> ^^^^^^^^^^^^^^^^^^-> +1-> + >[ +2 >nameMB = "helloNoName" +3 > +4 > nameMB = "helloNoName" +5 > , +6 > [primarySkillB = "noSkill", secondarySkillB = "noSkill"] = [] +7 > +8 > [primarySkillB = "noSkill", secondarySkillB = "noSkill"] = [] +9 > +10> primarySkillB = "noSkill" +11> +12> primarySkillB = "noSkill" +13> , +14> secondarySkillB = "noSkill" +15> +16> secondarySkillB = "noSkill" +17> ] = []] = multiRobotB; +1->Emitted(24, 1) Source(35, 2) + SourceIndex(0) +2 >Emitted(24, 20) Source(35, 24) + SourceIndex(0) +3 >Emitted(24, 22) Source(35, 2) + SourceIndex(0) +4 >Emitted(24, 65) Source(35, 24) + SourceIndex(0) +5 >Emitted(24, 67) Source(35, 26) + SourceIndex(0) +6 >Emitted(24, 86) Source(35, 87) + SourceIndex(0) +7 >Emitted(24, 88) Source(35, 26) + SourceIndex(0) +8 >Emitted(24, 116) Source(35, 87) + SourceIndex(0) +9 >Emitted(24, 118) Source(35, 27) + SourceIndex(0) +10>Emitted(24, 128) Source(35, 52) + SourceIndex(0) +11>Emitted(24, 130) Source(35, 27) + SourceIndex(0) +12>Emitted(24, 176) Source(35, 52) + SourceIndex(0) +13>Emitted(24, 178) Source(35, 54) + SourceIndex(0) +14>Emitted(24, 188) Source(35, 81) + SourceIndex(0) +15>Emitted(24, 190) Source(35, 54) + SourceIndex(0) +16>Emitted(24, 238) Source(35, 81) + SourceIndex(0) +17>Emitted(24, 239) Source(35, 103) + SourceIndex(0) +--- +>>>_8 = getMultiRobotB(), _9 = _8[0], nameMB = _9 === void 0 ? "helloNoName" : _9, _10 = _8[1], _11 = _10 === void 0 ? [] : _10, _12 = _11[0], primarySkillB = _12 === void 0 ? "noSkill" : _12, _13 = _11[1], secondarySkillB = _13 === void 0 ? "noSkill" : _13; +1-> +2 >^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +15> ^^ +16> ^^^^^^^^^^^^ +17> ^^ +18> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +19> ^ +20> ^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >[nameMB = "helloNoName", [primarySkillB = "noSkill", secondarySkillB = "noSkill"] = []] = getMultiRobotB() +3 > +4 > nameMB = "helloNoName" +5 > +6 > nameMB = "helloNoName" +7 > , +8 > [primarySkillB = "noSkill", secondarySkillB = "noSkill"] = [] +9 > +10> [primarySkillB = "noSkill", secondarySkillB = "noSkill"] = [] +11> +12> primarySkillB = "noSkill" +13> +14> primarySkillB = "noSkill" +15> , +16> secondarySkillB = "noSkill" +17> +18> secondarySkillB = "noSkill" +19> ] = []] = getMultiRobotB(); +1->Emitted(25, 1) Source(36, 1) + SourceIndex(0) +2 >Emitted(25, 22) Source(36, 107) + SourceIndex(0) +3 >Emitted(25, 24) Source(36, 2) + SourceIndex(0) +4 >Emitted(25, 34) Source(36, 24) + SourceIndex(0) +5 >Emitted(25, 36) Source(36, 2) + SourceIndex(0) +6 >Emitted(25, 79) Source(36, 24) + SourceIndex(0) +7 >Emitted(25, 81) Source(36, 26) + SourceIndex(0) +8 >Emitted(25, 92) Source(36, 87) + SourceIndex(0) +9 >Emitted(25, 94) Source(36, 26) + SourceIndex(0) +10>Emitted(25, 125) Source(36, 87) + SourceIndex(0) +11>Emitted(25, 127) Source(36, 27) + SourceIndex(0) +12>Emitted(25, 139) Source(36, 52) + SourceIndex(0) +13>Emitted(25, 141) Source(36, 27) + SourceIndex(0) +14>Emitted(25, 189) Source(36, 52) + SourceIndex(0) +15>Emitted(25, 191) Source(36, 54) + SourceIndex(0) +16>Emitted(25, 203) Source(36, 81) + SourceIndex(0) +17>Emitted(25, 205) Source(36, 54) + SourceIndex(0) +18>Emitted(25, 255) Source(36, 81) + SourceIndex(0) +19>Emitted(25, 256) Source(36, 108) + SourceIndex(0) +--- +>>>_14 = ["trimmer", ["trimming", "edging"]], _15 = _14[0], nameMB = _15 === void 0 ? "helloNoName" : _15, _16 = _14[1], _17 = _16 === void 0 ? [] : _16, _18 = _17[0], primarySkillB = _18 === void 0 ? "noSkill" : _18, _19 = _17[1], secondarySkillB = _19 === void 0 ? "noSkill" : _19; +1-> +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +15> ^^ +16> ^^^^^^^^^^^^ +17> ^^ +18> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +19> ^ +1-> + > +2 >[nameMB = "helloNoName", [primarySkillB = "noSkill", secondarySkillB = "noSkill"] = []] = + > ["trimmer", ["trimming", "edging"]] +3 > +4 > nameMB = "helloNoName" +5 > +6 > nameMB = "helloNoName" +7 > , +8 > [primarySkillB = "noSkill", secondarySkillB = "noSkill"] = [] +9 > +10> [primarySkillB = "noSkill", secondarySkillB = "noSkill"] = [] +11> +12> primarySkillB = "noSkill" +13> +14> primarySkillB = "noSkill" +15> , +16> secondarySkillB = "noSkill" +17> +18> secondarySkillB = "noSkill" +19> ] = []] = + > ["trimmer", ["trimming", "edging"]]; +1->Emitted(26, 1) Source(37, 1) + SourceIndex(0) +2 >Emitted(26, 42) Source(38, 40) + SourceIndex(0) +3 >Emitted(26, 44) Source(37, 2) + SourceIndex(0) +4 >Emitted(26, 56) Source(37, 24) + SourceIndex(0) +5 >Emitted(26, 58) Source(37, 2) + SourceIndex(0) +6 >Emitted(26, 103) Source(37, 24) + SourceIndex(0) +7 >Emitted(26, 105) Source(37, 26) + SourceIndex(0) +8 >Emitted(26, 117) Source(37, 87) + SourceIndex(0) +9 >Emitted(26, 119) Source(37, 26) + SourceIndex(0) +10>Emitted(26, 150) Source(37, 87) + SourceIndex(0) +11>Emitted(26, 152) Source(37, 27) + SourceIndex(0) +12>Emitted(26, 164) Source(37, 52) + SourceIndex(0) +13>Emitted(26, 166) Source(37, 27) + SourceIndex(0) +14>Emitted(26, 214) Source(37, 52) + SourceIndex(0) +15>Emitted(26, 216) Source(37, 54) + SourceIndex(0) +16>Emitted(26, 228) Source(37, 81) + SourceIndex(0) +17>Emitted(26, 230) Source(37, 54) + SourceIndex(0) +18>Emitted(26, 280) Source(37, 81) + SourceIndex(0) +19>Emitted(26, 281) Source(38, 41) + SourceIndex(0) +--- +>>>_20 = robotB[0], numberB = _20 === void 0 ? -1 : _20, robotAInfo = robotB.slice(1); +1 > +2 >^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^ +8 > ^^^^^^^^^^^^^^-> +1 > + > + >[ +2 >numberB = -1 +3 > +4 > numberB = -1 +5 > , +6 > ...robotAInfo +7 > ] = robotB; +1 >Emitted(27, 1) Source(40, 2) + SourceIndex(0) +2 >Emitted(27, 16) Source(40, 14) + SourceIndex(0) +3 >Emitted(27, 18) Source(40, 2) + SourceIndex(0) +4 >Emitted(27, 53) Source(40, 14) + SourceIndex(0) +5 >Emitted(27, 55) Source(40, 16) + SourceIndex(0) +6 >Emitted(27, 83) Source(40, 29) + SourceIndex(0) +7 >Emitted(27, 84) Source(40, 40) + SourceIndex(0) +--- +>>>_21 = getRobotB(), _22 = _21[0], numberB = _22 === void 0 ? -1 : _22, robotAInfo = _21.slice(1); +1-> +2 >^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^^^^^^ +9 > ^ +10> ^^^^^^^^^^^^^^^^-> +1-> + > +2 >[numberB = -1, ...robotAInfo] = getRobotB() +3 > +4 > numberB = -1 +5 > +6 > numberB = -1 +7 > , +8 > ...robotAInfo +9 > ] = getRobotB(); +1->Emitted(28, 1) Source(41, 1) + SourceIndex(0) +2 >Emitted(28, 18) Source(41, 44) + SourceIndex(0) +3 >Emitted(28, 20) Source(41, 2) + SourceIndex(0) +4 >Emitted(28, 32) Source(41, 14) + SourceIndex(0) +5 >Emitted(28, 34) Source(41, 2) + SourceIndex(0) +6 >Emitted(28, 69) Source(41, 14) + SourceIndex(0) +7 >Emitted(28, 71) Source(41, 16) + SourceIndex(0) +8 >Emitted(28, 96) Source(41, 29) + SourceIndex(0) +9 >Emitted(28, 97) Source(41, 45) + SourceIndex(0) +--- +>>>_23 = [2, "trimmer", "trimming"], _24 = _23[0], numberB = _24 === void 0 ? -1 : _24, robotAInfo = _23.slice(1); +1-> +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^^^^^^ +9 > ^ +1-> + > +2 >[numberB = -1, ...robotAInfo] = [2, "trimmer", "trimming"] +3 > +4 > numberB = -1 +5 > +6 > numberB = -1 +7 > , +8 > ...robotAInfo +9 > ] = [2, "trimmer", "trimming"]; +1->Emitted(29, 1) Source(42, 1) + SourceIndex(0) +2 >Emitted(29, 33) Source(42, 66) + SourceIndex(0) +3 >Emitted(29, 35) Source(42, 2) + SourceIndex(0) +4 >Emitted(29, 47) Source(42, 14) + SourceIndex(0) +5 >Emitted(29, 49) Source(42, 2) + SourceIndex(0) +6 >Emitted(29, 84) Source(42, 14) + SourceIndex(0) +7 >Emitted(29, 86) Source(42, 16) + SourceIndex(0) +8 >Emitted(29, 111) Source(42, 29) + SourceIndex(0) +9 >Emitted(29, 112) Source(42, 67) + SourceIndex(0) +--- +>>>if (nameA == nameB) { +1 > +2 >^^ +3 > ^ +4 > ^ +5 > ^^^^^ +6 > ^^^^ +7 > ^^^^^ +8 > ^ +9 > ^ +10> ^ +11> ^^^^-> +1 > + > + > +2 >if +3 > +4 > ( +5 > nameA +6 > == +7 > nameB +8 > ) +9 > +10> { +1 >Emitted(30, 1) Source(44, 1) + SourceIndex(0) +2 >Emitted(30, 3) Source(44, 3) + SourceIndex(0) +3 >Emitted(30, 4) Source(44, 4) + SourceIndex(0) +4 >Emitted(30, 5) Source(44, 5) + SourceIndex(0) +5 >Emitted(30, 10) Source(44, 10) + SourceIndex(0) +6 >Emitted(30, 14) Source(44, 14) + SourceIndex(0) +7 >Emitted(30, 19) Source(44, 19) + SourceIndex(0) +8 >Emitted(30, 20) Source(44, 20) + SourceIndex(0) +9 >Emitted(30, 21) Source(44, 21) + SourceIndex(0) +10>Emitted(30, 22) Source(44, 22) + SourceIndex(0) +--- +>>> console.log(skillB); +1->^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^ +7 > ^ +8 > ^ +1-> + > +2 > console +3 > . +4 > log +5 > ( +6 > skillB +7 > ) +8 > ; +1->Emitted(31, 5) Source(45, 5) + SourceIndex(0) +2 >Emitted(31, 12) Source(45, 12) + SourceIndex(0) +3 >Emitted(31, 13) Source(45, 13) + SourceIndex(0) +4 >Emitted(31, 16) Source(45, 16) + SourceIndex(0) +5 >Emitted(31, 17) Source(45, 17) + SourceIndex(0) +6 >Emitted(31, 23) Source(45, 23) + SourceIndex(0) +7 >Emitted(31, 24) Source(45, 24) + SourceIndex(0) +8 >Emitted(31, 25) Source(45, 25) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(32, 1) Source(46, 1) + SourceIndex(0) +2 >Emitted(32, 2) Source(46, 2) + SourceIndex(0) +--- +>>>function getRobotB() { +1-> +2 >^^^^^^^^^^^^^^^^^^^-> +1-> + > + > +1->Emitted(33, 1) Source(48, 1) + SourceIndex(0) +--- +>>> return robotB; +1->^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^ +5 > ^ +1->function getRobotB() { + > +2 > return +3 > +4 > robotB +5 > ; +1->Emitted(34, 5) Source(49, 5) + SourceIndex(0) +2 >Emitted(34, 11) Source(49, 11) + SourceIndex(0) +3 >Emitted(34, 12) Source(49, 12) + SourceIndex(0) +4 >Emitted(34, 18) Source(49, 18) + SourceIndex(0) +5 >Emitted(34, 19) Source(49, 19) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(35, 1) Source(50, 1) + SourceIndex(0) +2 >Emitted(35, 2) Source(50, 2) + SourceIndex(0) +--- +>>>function getMultiRobotB() { +1-> +2 >^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > + > +1->Emitted(36, 1) Source(52, 1) + SourceIndex(0) +--- +>>> return multiRobotB; +1->^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^ +5 > ^ +1->function getMultiRobotB() { + > +2 > return +3 > +4 > multiRobotB +5 > ; +1->Emitted(37, 5) Source(53, 5) + SourceIndex(0) +2 >Emitted(37, 11) Source(53, 11) + SourceIndex(0) +3 >Emitted(37, 12) Source(53, 12) + SourceIndex(0) +4 >Emitted(37, 23) Source(53, 23) + SourceIndex(0) +5 >Emitted(37, 24) Source(53, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(38, 1) Source(54, 1) + SourceIndex(0) +2 >Emitted(38, 2) Source(54, 2) + SourceIndex(0) +--- +>>>var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24; +>>>//# sourceMappingURL=sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.symbols b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.symbols new file mode 100644 index 00000000000..c4d6b52fc4a --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.symbols @@ -0,0 +1,167 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts === +declare var console: { +>console : Symbol(console, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 0, 11)) + + log(msg: any): void; +>log : Symbol(log, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 0, 22)) +>msg : Symbol(msg, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 1, 8)) +} +type Robot = [number, string, string]; +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 2, 1)) + +type MultiSkilledRobot = [string, string[]]; +>MultiSkilledRobot : Symbol(MultiSkilledRobot, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 3, 38)) + +var robotA: Robot = [1, "mower", "mowing"]; +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 6, 3)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 2, 1)) + +var robotB: Robot = [2, "trimmer", "trimming"]; +>robotB : Symbol(robotB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 7, 3)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 2, 1)) + +var multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; +>multiRobotA : Symbol(multiRobotA, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 8, 3)) +>MultiSkilledRobot : Symbol(MultiSkilledRobot, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 3, 38)) + +var multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; +>multiRobotB : Symbol(multiRobotB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 9, 3)) +>MultiSkilledRobot : Symbol(MultiSkilledRobot, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 3, 38)) + +let nameA: string, numberB: number, nameB: string, skillB: string; +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 11, 3)) +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 11, 18)) +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 11, 35)) +>skillB : Symbol(skillB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 11, 50)) + +let robotAInfo: (number | string)[]; +>robotAInfo : Symbol(robotAInfo, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 12, 3)) + +let multiSkillB: string[], nameMB: string, primarySkillB: string, secondarySkillB: string; +>multiSkillB : Symbol(multiSkillB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 14, 3)) +>nameMB : Symbol(nameMB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 14, 26)) +>primarySkillB : Symbol(primarySkillB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 14, 42)) +>secondarySkillB : Symbol(secondarySkillB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 14, 65)) + +let multiRobotAInfo: (string | string[])[]; +>multiRobotAInfo : Symbol(multiRobotAInfo, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 15, 3)) + +[, nameA = "helloNoName"] = robotA; +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 11, 3)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 6, 3)) + +[, nameB = "helloNoName"] = getRobotB(); +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 11, 35)) +>getRobotB : Symbol(getRobotB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 45, 1)) + +[, nameB = "helloNoName"] = [2, "trimmer", "trimming"]; +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 11, 35)) + +[, multiSkillB = []] = multiRobotB; +>multiSkillB : Symbol(multiSkillB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 14, 3)) +>multiRobotB : Symbol(multiRobotB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 9, 3)) + +[, multiSkillB = []] = getMultiRobotB(); +>multiSkillB : Symbol(multiSkillB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 14, 3)) +>getMultiRobotB : Symbol(getMultiRobotB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 49, 1)) + +[, multiSkillB = []] = ["roomba", ["vaccum", "mopping"]]; +>multiSkillB : Symbol(multiSkillB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 14, 3)) + +[numberB = -1] = robotB; +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 11, 18)) +>robotB : Symbol(robotB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 7, 3)) + +[numberB = -1] = getRobotB(); +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 11, 18)) +>getRobotB : Symbol(getRobotB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 45, 1)) + +[numberB = -1] = [2, "trimmer", "trimming"]; +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 11, 18)) + +[nameMB = "helloNoName"] = multiRobotB; +>nameMB : Symbol(nameMB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 14, 26)) +>multiRobotB : Symbol(multiRobotB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 9, 3)) + +[nameMB = "helloNoName"] = getMultiRobotB(); +>nameMB : Symbol(nameMB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 14, 26)) +>getMultiRobotB : Symbol(getMultiRobotB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 49, 1)) + +[nameMB = "helloNoName"] = ["trimmer", ["trimming", "edging"]]; +>nameMB : Symbol(nameMB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 14, 26)) + +[numberB = -1, nameB = "helloNoName", skillB = "noSkill"] = robotB; +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 11, 18)) +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 11, 35)) +>skillB : Symbol(skillB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 11, 50)) +>robotB : Symbol(robotB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 7, 3)) + +[numberB = -1, nameB = "helloNoName", skillB = "noSkill"] = getRobotB(); +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 11, 18)) +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 11, 35)) +>skillB : Symbol(skillB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 11, 50)) +>getRobotB : Symbol(getRobotB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 45, 1)) + +[numberB = -1, nameB = "helloNoName", skillB = "noSkill"] = [2, "trimmer", "trimming"]; +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 11, 18)) +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 11, 35)) +>skillB : Symbol(skillB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 11, 50)) + +[nameMB = "helloNoName", [primarySkillB = "noSkill", secondarySkillB = "noSkill"] = []] = multiRobotB; +>nameMB : Symbol(nameMB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 14, 26)) +>primarySkillB : Symbol(primarySkillB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 14, 42)) +>secondarySkillB : Symbol(secondarySkillB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 14, 65)) +>multiRobotB : Symbol(multiRobotB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 9, 3)) + +[nameMB = "helloNoName", [primarySkillB = "noSkill", secondarySkillB = "noSkill"] = []] = getMultiRobotB(); +>nameMB : Symbol(nameMB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 14, 26)) +>primarySkillB : Symbol(primarySkillB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 14, 42)) +>secondarySkillB : Symbol(secondarySkillB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 14, 65)) +>getMultiRobotB : Symbol(getMultiRobotB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 49, 1)) + +[nameMB = "helloNoName", [primarySkillB = "noSkill", secondarySkillB = "noSkill"] = []] = +>nameMB : Symbol(nameMB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 14, 26)) +>primarySkillB : Symbol(primarySkillB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 14, 42)) +>secondarySkillB : Symbol(secondarySkillB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 14, 65)) + + ["trimmer", ["trimming", "edging"]]; + +[numberB = -1, ...robotAInfo] = robotB; +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 11, 18)) +>robotAInfo : Symbol(robotAInfo, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 12, 3)) +>robotB : Symbol(robotB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 7, 3)) + +[numberB = -1, ...robotAInfo] = getRobotB(); +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 11, 18)) +>robotAInfo : Symbol(robotAInfo, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 12, 3)) +>getRobotB : Symbol(getRobotB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 45, 1)) + +[numberB = -1, ...robotAInfo] = [2, "trimmer", "trimming"]; +>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 11, 18)) +>robotAInfo : Symbol(robotAInfo, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 12, 3)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 2, 1)) + +if (nameA == nameB) { +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 11, 3)) +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 11, 35)) + + console.log(skillB); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 0, 22)) +>skillB : Symbol(skillB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 11, 50)) +} + +function getRobotB() { +>getRobotB : Symbol(getRobotB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 45, 1)) + + return robotB; +>robotB : Symbol(robotB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 7, 3)) +} + +function getMultiRobotB() { +>getMultiRobotB : Symbol(getMultiRobotB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 49, 1)) + + return multiRobotB; +>multiRobotB : Symbol(multiRobotB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts, 9, 3)) +} diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.types b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.types new file mode 100644 index 00000000000..7edf6c63e4a --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.types @@ -0,0 +1,361 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts === +declare var console: { +>console : { log(msg: any): void; } + + log(msg: any): void; +>log : (msg: any) => void +>msg : any +} +type Robot = [number, string, string]; +>Robot : [number, string, string] + +type MultiSkilledRobot = [string, string[]]; +>MultiSkilledRobot : [string, string[]] + +var robotA: Robot = [1, "mower", "mowing"]; +>robotA : [number, string, string] +>Robot : [number, string, string] +>[1, "mower", "mowing"] : [number, string, string] +>1 : number +>"mower" : string +>"mowing" : string + +var robotB: Robot = [2, "trimmer", "trimming"]; +>robotB : [number, string, string] +>Robot : [number, string, string] +>[2, "trimmer", "trimming"] : [number, string, string] +>2 : number +>"trimmer" : string +>"trimming" : string + +var multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; +>multiRobotA : [string, string[]] +>MultiSkilledRobot : [string, string[]] +>["mower", ["mowing", ""]] : [string, string[]] +>"mower" : string +>["mowing", ""] : string[] +>"mowing" : string +>"" : string + +var multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; +>multiRobotB : [string, string[]] +>MultiSkilledRobot : [string, string[]] +>["trimmer", ["trimming", "edging"]] : [string, string[]] +>"trimmer" : string +>["trimming", "edging"] : string[] +>"trimming" : string +>"edging" : string + +let nameA: string, numberB: number, nameB: string, skillB: string; +>nameA : string +>numberB : number +>nameB : string +>skillB : string + +let robotAInfo: (number | string)[]; +>robotAInfo : (number | string)[] + +let multiSkillB: string[], nameMB: string, primarySkillB: string, secondarySkillB: string; +>multiSkillB : string[] +>nameMB : string +>primarySkillB : string +>secondarySkillB : string + +let multiRobotAInfo: (string | string[])[]; +>multiRobotAInfo : (string | string[])[] + +[, nameA = "helloNoName"] = robotA; +>[, nameA = "helloNoName"] = robotA : [number, string, string] +>[, nameA = "helloNoName"] : [undefined, string] +> : undefined +>nameA = "helloNoName" : string +>nameA : string +>"helloNoName" : string +>robotA : [number, string, string] + +[, nameB = "helloNoName"] = getRobotB(); +>[, nameB = "helloNoName"] = getRobotB() : [number, string, string] +>[, nameB = "helloNoName"] : [undefined, string] +> : undefined +>nameB = "helloNoName" : string +>nameB : string +>"helloNoName" : string +>getRobotB() : [number, string, string] +>getRobotB : () => [number, string, string] + +[, nameB = "helloNoName"] = [2, "trimmer", "trimming"]; +>[, nameB = "helloNoName"] = [2, "trimmer", "trimming"] : [number, string, string] +>[, nameB = "helloNoName"] : [undefined, string] +> : undefined +>nameB = "helloNoName" : string +>nameB : string +>"helloNoName" : string +>[2, "trimmer", "trimming"] : [number, string, string] +>2 : number +>"trimmer" : string +>"trimming" : string + +[, multiSkillB = []] = multiRobotB; +>[, multiSkillB = []] = multiRobotB : [string, string[]] +>[, multiSkillB = []] : [undefined, undefined[]] +> : undefined +>multiSkillB = [] : undefined[] +>multiSkillB : string[] +>[] : undefined[] +>multiRobotB : [string, string[]] + +[, multiSkillB = []] = getMultiRobotB(); +>[, multiSkillB = []] = getMultiRobotB() : [string, string[]] +>[, multiSkillB = []] : [undefined, undefined[]] +> : undefined +>multiSkillB = [] : undefined[] +>multiSkillB : string[] +>[] : undefined[] +>getMultiRobotB() : [string, string[]] +>getMultiRobotB : () => [string, string[]] + +[, multiSkillB = []] = ["roomba", ["vaccum", "mopping"]]; +>[, multiSkillB = []] = ["roomba", ["vaccum", "mopping"]] : [string, string[]] +>[, multiSkillB = []] : [undefined, undefined[]] +> : undefined +>multiSkillB = [] : undefined[] +>multiSkillB : string[] +>[] : undefined[] +>["roomba", ["vaccum", "mopping"]] : [string, string[]] +>"roomba" : string +>["vaccum", "mopping"] : string[] +>"vaccum" : string +>"mopping" : string + +[numberB = -1] = robotB; +>[numberB = -1] = robotB : [number, string, string] +>[numberB = -1] : [number] +>numberB = -1 : number +>numberB : number +>-1 : number +>1 : number +>robotB : [number, string, string] + +[numberB = -1] = getRobotB(); +>[numberB = -1] = getRobotB() : [number, string, string] +>[numberB = -1] : [number] +>numberB = -1 : number +>numberB : number +>-1 : number +>1 : number +>getRobotB() : [number, string, string] +>getRobotB : () => [number, string, string] + +[numberB = -1] = [2, "trimmer", "trimming"]; +>[numberB = -1] = [2, "trimmer", "trimming"] : [number, string, string] +>[numberB = -1] : [number] +>numberB = -1 : number +>numberB : number +>-1 : number +>1 : number +>[2, "trimmer", "trimming"] : [number, string, string] +>2 : number +>"trimmer" : string +>"trimming" : string + +[nameMB = "helloNoName"] = multiRobotB; +>[nameMB = "helloNoName"] = multiRobotB : [string, string[]] +>[nameMB = "helloNoName"] : [string] +>nameMB = "helloNoName" : string +>nameMB : string +>"helloNoName" : string +>multiRobotB : [string, string[]] + +[nameMB = "helloNoName"] = getMultiRobotB(); +>[nameMB = "helloNoName"] = getMultiRobotB() : [string, string[]] +>[nameMB = "helloNoName"] : [string] +>nameMB = "helloNoName" : string +>nameMB : string +>"helloNoName" : string +>getMultiRobotB() : [string, string[]] +>getMultiRobotB : () => [string, string[]] + +[nameMB = "helloNoName"] = ["trimmer", ["trimming", "edging"]]; +>[nameMB = "helloNoName"] = ["trimmer", ["trimming", "edging"]] : [string, string[]] +>[nameMB = "helloNoName"] : [string] +>nameMB = "helloNoName" : string +>nameMB : string +>"helloNoName" : string +>["trimmer", ["trimming", "edging"]] : [string, string[]] +>"trimmer" : string +>["trimming", "edging"] : string[] +>"trimming" : string +>"edging" : string + +[numberB = -1, nameB = "helloNoName", skillB = "noSkill"] = robotB; +>[numberB = -1, nameB = "helloNoName", skillB = "noSkill"] = robotB : [number, string, string] +>[numberB = -1, nameB = "helloNoName", skillB = "noSkill"] : [number, string, string] +>numberB = -1 : number +>numberB : number +>-1 : number +>1 : number +>nameB = "helloNoName" : string +>nameB : string +>"helloNoName" : string +>skillB = "noSkill" : string +>skillB : string +>"noSkill" : string +>robotB : [number, string, string] + +[numberB = -1, nameB = "helloNoName", skillB = "noSkill"] = getRobotB(); +>[numberB = -1, nameB = "helloNoName", skillB = "noSkill"] = getRobotB() : [number, string, string] +>[numberB = -1, nameB = "helloNoName", skillB = "noSkill"] : [number, string, string] +>numberB = -1 : number +>numberB : number +>-1 : number +>1 : number +>nameB = "helloNoName" : string +>nameB : string +>"helloNoName" : string +>skillB = "noSkill" : string +>skillB : string +>"noSkill" : string +>getRobotB() : [number, string, string] +>getRobotB : () => [number, string, string] + +[numberB = -1, nameB = "helloNoName", skillB = "noSkill"] = [2, "trimmer", "trimming"]; +>[numberB = -1, nameB = "helloNoName", skillB = "noSkill"] = [2, "trimmer", "trimming"] : [number, string, string] +>[numberB = -1, nameB = "helloNoName", skillB = "noSkill"] : [number, string, string] +>numberB = -1 : number +>numberB : number +>-1 : number +>1 : number +>nameB = "helloNoName" : string +>nameB : string +>"helloNoName" : string +>skillB = "noSkill" : string +>skillB : string +>"noSkill" : string +>[2, "trimmer", "trimming"] : [number, string, string] +>2 : number +>"trimmer" : string +>"trimming" : string + +[nameMB = "helloNoName", [primarySkillB = "noSkill", secondarySkillB = "noSkill"] = []] = multiRobotB; +>[nameMB = "helloNoName", [primarySkillB = "noSkill", secondarySkillB = "noSkill"] = []] = multiRobotB : [string, string[]] +>[nameMB = "helloNoName", [primarySkillB = "noSkill", secondarySkillB = "noSkill"] = []] : [string, [string, string]] +>nameMB = "helloNoName" : string +>nameMB : string +>"helloNoName" : string +>[primarySkillB = "noSkill", secondarySkillB = "noSkill"] = [] : [string, string] +>[primarySkillB = "noSkill", secondarySkillB = "noSkill"] : [string, string] +>primarySkillB = "noSkill" : string +>primarySkillB : string +>"noSkill" : string +>secondarySkillB = "noSkill" : string +>secondarySkillB : string +>"noSkill" : string +>[] : [string, string] +>multiRobotB : [string, string[]] + +[nameMB = "helloNoName", [primarySkillB = "noSkill", secondarySkillB = "noSkill"] = []] = getMultiRobotB(); +>[nameMB = "helloNoName", [primarySkillB = "noSkill", secondarySkillB = "noSkill"] = []] = getMultiRobotB() : [string, string[]] +>[nameMB = "helloNoName", [primarySkillB = "noSkill", secondarySkillB = "noSkill"] = []] : [string, [string, string]] +>nameMB = "helloNoName" : string +>nameMB : string +>"helloNoName" : string +>[primarySkillB = "noSkill", secondarySkillB = "noSkill"] = [] : [string, string] +>[primarySkillB = "noSkill", secondarySkillB = "noSkill"] : [string, string] +>primarySkillB = "noSkill" : string +>primarySkillB : string +>"noSkill" : string +>secondarySkillB = "noSkill" : string +>secondarySkillB : string +>"noSkill" : string +>[] : [string, string] +>getMultiRobotB() : [string, string[]] +>getMultiRobotB : () => [string, string[]] + +[nameMB = "helloNoName", [primarySkillB = "noSkill", secondarySkillB = "noSkill"] = []] = +>[nameMB = "helloNoName", [primarySkillB = "noSkill", secondarySkillB = "noSkill"] = []] = ["trimmer", ["trimming", "edging"]] : [string, [string, string]] +>[nameMB = "helloNoName", [primarySkillB = "noSkill", secondarySkillB = "noSkill"] = []] : [string, [string, string]] +>nameMB = "helloNoName" : string +>nameMB : string +>"helloNoName" : string +>[primarySkillB = "noSkill", secondarySkillB = "noSkill"] = [] : [string, string] +>[primarySkillB = "noSkill", secondarySkillB = "noSkill"] : [string, string] +>primarySkillB = "noSkill" : string +>primarySkillB : string +>"noSkill" : string +>secondarySkillB = "noSkill" : string +>secondarySkillB : string +>"noSkill" : string +>[] : [string, string] + + ["trimmer", ["trimming", "edging"]]; +>["trimmer", ["trimming", "edging"]] : [string, [string, string]] +>"trimmer" : string +>["trimming", "edging"] : [string, string] +>"trimming" : string +>"edging" : string + +[numberB = -1, ...robotAInfo] = robotB; +>[numberB = -1, ...robotAInfo] = robotB : [number, string, string] +>[numberB = -1, ...robotAInfo] : (number | string)[] +>numberB = -1 : number +>numberB : number +>-1 : number +>1 : number +>...robotAInfo : number | string +>robotAInfo : (number | string)[] +>robotB : [number, string, string] + +[numberB = -1, ...robotAInfo] = getRobotB(); +>[numberB = -1, ...robotAInfo] = getRobotB() : [number, string, string] +>[numberB = -1, ...robotAInfo] : (number | string)[] +>numberB = -1 : number +>numberB : number +>-1 : number +>1 : number +>...robotAInfo : number | string +>robotAInfo : (number | string)[] +>getRobotB() : [number, string, string] +>getRobotB : () => [number, string, string] + +[numberB = -1, ...robotAInfo] = [2, "trimmer", "trimming"]; +>[numberB = -1, ...robotAInfo] = [2, "trimmer", "trimming"] : [number, string, string] +>[numberB = -1, ...robotAInfo] : (number | string)[] +>numberB = -1 : number +>numberB : number +>-1 : number +>1 : number +>...robotAInfo : number | string +>robotAInfo : (number | string)[] +>[2, "trimmer", "trimming"] : [number, string, string] +>Robot : [number, string, string] +>[2, "trimmer", "trimming"] : [number, string, string] +>2 : number +>"trimmer" : string +>"trimming" : string + +if (nameA == nameB) { +>nameA == nameB : boolean +>nameA : string +>nameB : string + + console.log(skillB); +>console.log(skillB) : void +>console.log : (msg: any) => void +>console : { log(msg: any): void; } +>log : (msg: any) => void +>skillB : string +} + +function getRobotB() { +>getRobotB : () => [number, string, string] + + return robotB; +>robotB : [number, string, string] +} + +function getMultiRobotB() { +>getMultiRobotB : () => [string, string[]] + + return multiRobotB; +>multiRobotB : [string, string[]] +} diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementDefaultValues.js b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementDefaultValues.js new file mode 100644 index 00000000000..64dea954ae7 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementDefaultValues.js @@ -0,0 +1,35 @@ +//// [sourceMapValidationDestructuringVariableStatementDefaultValues.ts] +interface Robot { + name: string; + skill: string; +} +declare var console: { + log(msg: string): void; +} +var hello = "hello"; +var robotA: Robot = { name: "mower", skill: "mowing" }; +var robotB: Robot = { name: "trimmer", skill: "trimming" }; +var { name: nameA = "" } = robotA; +var { name: nameB = "", skill: skillB = "" } = robotB; +var { name: nameC = "", skill: skillC = "" } = { name: "Edger", skill: "cutting edges" }; +if (nameA == nameB) { + console.log(skillB); +} +else { + console.log(nameC); +} + +//// [sourceMapValidationDestructuringVariableStatementDefaultValues.js] +var hello = "hello"; +var robotA = { name: "mower", skill: "mowing" }; +var robotB = { name: "trimmer", skill: "trimming" }; +var _a = robotA.name, nameA = _a === void 0 ? "" : _a; +var _b = robotB.name, nameB = _b === void 0 ? "" : _b, _c = robotB.skill, skillB = _c === void 0 ? "" : _c; +var _d = { name: "Edger", skill: "cutting edges" }, _e = _d.name, nameC = _e === void 0 ? "" : _e, _f = _d.skill, skillC = _f === void 0 ? "" : _f; +if (nameA == nameB) { + console.log(skillB); +} +else { + console.log(nameC); +} +//# sourceMappingURL=sourceMapValidationDestructuringVariableStatementDefaultValues.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementDefaultValues.js.map b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementDefaultValues.js.map new file mode 100644 index 00000000000..d85d9d2d669 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementDefaultValues.js.map @@ -0,0 +1,2 @@ +//// [sourceMapValidationDestructuringVariableStatementDefaultValues.js.map] +{"version":3,"file":"sourceMapValidationDestructuringVariableStatementDefaultValues.js","sourceRoot":"","sources":["sourceMapValidationDestructuringVariableStatementDefaultValues.ts"],"names":[],"mappings":"AAOA,IAAI,KAAK,GAAG,OAAO,CAAC;AACpB,IAAI,MAAM,GAAU,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;AACvD,IAAI,MAAM,GAAU,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC;AACrD,oBAAwB,EAAxB,uCAAwB,CAAY;AACpC,oBAAwB,EAAxB,uCAAwB,EAAE,iBAAoC,EAApC,kDAAoC,CAAY;AAChF,IAAA,8CAAkH,EAA5G,YAAwB,EAAxB,uCAAwB,EAAE,aAAoC,EAApC,kDAAoC,CAA+C;AACnH,EAAE,CAAC,CAAC,KAAK,IAAI,KAAK,CAAC,CAAC,CAAC;IACjB,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACxB,CAAC;AACD,IAAI,CAAC,CAAC;IACF,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementDefaultValues.sourcemap.txt b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementDefaultValues.sourcemap.txt new file mode 100644 index 00000000000..12e5526e77c --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementDefaultValues.sourcemap.txt @@ -0,0 +1,344 @@ +=================================================================== +JsFile: sourceMapValidationDestructuringVariableStatementDefaultValues.js +mapUrl: sourceMapValidationDestructuringVariableStatementDefaultValues.js.map +sourceRoot: +sources: sourceMapValidationDestructuringVariableStatementDefaultValues.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/sourceMapValidationDestructuringVariableStatementDefaultValues.js +sourceFile:sourceMapValidationDestructuringVariableStatementDefaultValues.ts +------------------------------------------------------------------- +>>>var hello = "hello"; +1 > +2 >^^^^ +3 > ^^^^^ +4 > ^^^ +5 > ^^^^^^^ +6 > ^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 >interface Robot { + > name: string; + > skill: string; + >} + >declare var console: { + > log(msg: string): void; + >} + > +2 >var +3 > hello +4 > = +5 > "hello" +6 > ; +1 >Emitted(1, 1) Source(8, 1) + SourceIndex(0) +2 >Emitted(1, 5) Source(8, 5) + SourceIndex(0) +3 >Emitted(1, 10) Source(8, 10) + SourceIndex(0) +4 >Emitted(1, 13) Source(8, 13) + SourceIndex(0) +5 >Emitted(1, 20) Source(8, 20) + SourceIndex(0) +6 >Emitted(1, 21) Source(8, 21) + SourceIndex(0) +--- +>>>var robotA = { name: "mower", skill: "mowing" }; +1-> +2 >^^^^ +3 > ^^^^^^ +4 > ^^^ +5 > ^^ +6 > ^^^^ +7 > ^^ +8 > ^^^^^^^ +9 > ^^ +10> ^^^^^ +11> ^^ +12> ^^^^^^^^ +13> ^^ +14> ^ +15> ^^^^^-> +1-> + > +2 >var +3 > robotA +4 > : Robot = +5 > { +6 > name +7 > : +8 > "mower" +9 > , +10> skill +11> : +12> "mowing" +13> } +14> ; +1->Emitted(2, 1) Source(9, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(9, 5) + SourceIndex(0) +3 >Emitted(2, 11) Source(9, 11) + SourceIndex(0) +4 >Emitted(2, 14) Source(9, 21) + SourceIndex(0) +5 >Emitted(2, 16) Source(9, 23) + SourceIndex(0) +6 >Emitted(2, 20) Source(9, 27) + SourceIndex(0) +7 >Emitted(2, 22) Source(9, 29) + SourceIndex(0) +8 >Emitted(2, 29) Source(9, 36) + SourceIndex(0) +9 >Emitted(2, 31) Source(9, 38) + SourceIndex(0) +10>Emitted(2, 36) Source(9, 43) + SourceIndex(0) +11>Emitted(2, 38) Source(9, 45) + SourceIndex(0) +12>Emitted(2, 46) Source(9, 53) + SourceIndex(0) +13>Emitted(2, 48) Source(9, 55) + SourceIndex(0) +14>Emitted(2, 49) Source(9, 56) + SourceIndex(0) +--- +>>>var robotB = { name: "trimmer", skill: "trimming" }; +1-> +2 >^^^^ +3 > ^^^^^^ +4 > ^^^ +5 > ^^ +6 > ^^^^ +7 > ^^ +8 > ^^^^^^^^^ +9 > ^^ +10> ^^^^^ +11> ^^ +12> ^^^^^^^^^^ +13> ^^ +14> ^ +15> ^^^^^^^^^^^-> +1-> + > +2 >var +3 > robotB +4 > : Robot = +5 > { +6 > name +7 > : +8 > "trimmer" +9 > , +10> skill +11> : +12> "trimming" +13> } +14> ; +1->Emitted(3, 1) Source(10, 1) + SourceIndex(0) +2 >Emitted(3, 5) Source(10, 5) + SourceIndex(0) +3 >Emitted(3, 11) Source(10, 11) + SourceIndex(0) +4 >Emitted(3, 14) Source(10, 21) + SourceIndex(0) +5 >Emitted(3, 16) Source(10, 23) + SourceIndex(0) +6 >Emitted(3, 20) Source(10, 27) + SourceIndex(0) +7 >Emitted(3, 22) Source(10, 29) + SourceIndex(0) +8 >Emitted(3, 31) Source(10, 38) + SourceIndex(0) +9 >Emitted(3, 33) Source(10, 40) + SourceIndex(0) +10>Emitted(3, 38) Source(10, 45) + SourceIndex(0) +11>Emitted(3, 40) Source(10, 47) + SourceIndex(0) +12>Emitted(3, 50) Source(10, 57) + SourceIndex(0) +13>Emitted(3, 52) Source(10, 59) + SourceIndex(0) +14>Emitted(3, 53) Source(10, 60) + SourceIndex(0) +--- +>>>var _a = robotA.name, nameA = _a === void 0 ? "" : _a; +1-> +2 >^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + >var { +2 >name: nameA = "" +3 > +4 > name: nameA = "" +5 > } = robotA; +1->Emitted(4, 1) Source(11, 7) + SourceIndex(0) +2 >Emitted(4, 21) Source(11, 31) + SourceIndex(0) +3 >Emitted(4, 23) Source(11, 7) + SourceIndex(0) +4 >Emitted(4, 62) Source(11, 31) + SourceIndex(0) +5 >Emitted(4, 63) Source(11, 43) + SourceIndex(0) +--- +>>>var _b = robotB.name, nameB = _b === void 0 ? "" : _b, _c = robotB.skill, skillB = _c === void 0 ? "" : _c; +1-> +2 >^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +9 > ^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + >var { +2 >name: nameB = "" +3 > +4 > name: nameB = "" +5 > , +6 > skill: skillB = "" +7 > +8 > skill: skillB = "" +9 > } = robotB; +1->Emitted(5, 1) Source(12, 7) + SourceIndex(0) +2 >Emitted(5, 21) Source(12, 31) + SourceIndex(0) +3 >Emitted(5, 23) Source(12, 7) + SourceIndex(0) +4 >Emitted(5, 62) Source(12, 31) + SourceIndex(0) +5 >Emitted(5, 64) Source(12, 33) + SourceIndex(0) +6 >Emitted(5, 81) Source(12, 69) + SourceIndex(0) +7 >Emitted(5, 83) Source(12, 33) + SourceIndex(0) +8 >Emitted(5, 133) Source(12, 69) + SourceIndex(0) +9 >Emitted(5, 134) Source(12, 81) + SourceIndex(0) +--- +>>>var _d = { name: "Edger", skill: "cutting edges" }, _e = _d.name, nameC = _e === void 0 ? "" : _e, _f = _d.skill, skillC = _f === void 0 ? "" : _f; +1-> +2 >^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +4 > ^^ +5 > ^^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^ +10> ^^ +11> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +12> ^ +1-> + > +2 > +3 > var { name: nameC = "", skill: skillC = "" } = { name: "Edger", skill: "cutting edges" } +4 > +5 > name: nameC = "" +6 > +7 > name: nameC = "" +8 > , +9 > skill: skillC = "" +10> +11> skill: skillC = "" +12> } = { name: "Edger", skill: "cutting edges" }; +1->Emitted(6, 1) Source(13, 1) + SourceIndex(0) +2 >Emitted(6, 5) Source(13, 1) + SourceIndex(0) +3 >Emitted(6, 51) Source(13, 115) + SourceIndex(0) +4 >Emitted(6, 53) Source(13, 7) + SourceIndex(0) +5 >Emitted(6, 65) Source(13, 31) + SourceIndex(0) +6 >Emitted(6, 67) Source(13, 7) + SourceIndex(0) +7 >Emitted(6, 106) Source(13, 31) + SourceIndex(0) +8 >Emitted(6, 108) Source(13, 33) + SourceIndex(0) +9 >Emitted(6, 121) Source(13, 69) + SourceIndex(0) +10>Emitted(6, 123) Source(13, 33) + SourceIndex(0) +11>Emitted(6, 173) Source(13, 69) + SourceIndex(0) +12>Emitted(6, 174) Source(13, 116) + SourceIndex(0) +--- +>>>if (nameA == nameB) { +1 > +2 >^^ +3 > ^ +4 > ^ +5 > ^^^^^ +6 > ^^^^ +7 > ^^^^^ +8 > ^ +9 > ^ +10> ^ +11> ^^^^-> +1 > + > +2 >if +3 > +4 > ( +5 > nameA +6 > == +7 > nameB +8 > ) +9 > +10> { +1 >Emitted(7, 1) Source(14, 1) + SourceIndex(0) +2 >Emitted(7, 3) Source(14, 3) + SourceIndex(0) +3 >Emitted(7, 4) Source(14, 4) + SourceIndex(0) +4 >Emitted(7, 5) Source(14, 5) + SourceIndex(0) +5 >Emitted(7, 10) Source(14, 10) + SourceIndex(0) +6 >Emitted(7, 14) Source(14, 14) + SourceIndex(0) +7 >Emitted(7, 19) Source(14, 19) + SourceIndex(0) +8 >Emitted(7, 20) Source(14, 20) + SourceIndex(0) +9 >Emitted(7, 21) Source(14, 21) + SourceIndex(0) +10>Emitted(7, 22) Source(14, 22) + SourceIndex(0) +--- +>>> console.log(skillB); +1->^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^ +7 > ^ +8 > ^ +1-> + > +2 > console +3 > . +4 > log +5 > ( +6 > skillB +7 > ) +8 > ; +1->Emitted(8, 5) Source(15, 5) + SourceIndex(0) +2 >Emitted(8, 12) Source(15, 12) + SourceIndex(0) +3 >Emitted(8, 13) Source(15, 13) + SourceIndex(0) +4 >Emitted(8, 16) Source(15, 16) + SourceIndex(0) +5 >Emitted(8, 17) Source(15, 17) + SourceIndex(0) +6 >Emitted(8, 23) Source(15, 23) + SourceIndex(0) +7 >Emitted(8, 24) Source(15, 24) + SourceIndex(0) +8 >Emitted(8, 25) Source(15, 25) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^-> +1 > + > +2 >} +1 >Emitted(9, 1) Source(16, 1) + SourceIndex(0) +2 >Emitted(9, 2) Source(16, 2) + SourceIndex(0) +--- +>>>else { +1-> +2 >^^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >else +3 > +4 > { +1->Emitted(10, 1) Source(17, 1) + SourceIndex(0) +2 >Emitted(10, 5) Source(17, 5) + SourceIndex(0) +3 >Emitted(10, 6) Source(17, 6) + SourceIndex(0) +4 >Emitted(10, 7) Source(17, 7) + SourceIndex(0) +--- +>>> console.log(nameC); +1->^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1-> + > +2 > console +3 > . +4 > log +5 > ( +6 > nameC +7 > ) +8 > ; +1->Emitted(11, 5) Source(18, 5) + SourceIndex(0) +2 >Emitted(11, 12) Source(18, 12) + SourceIndex(0) +3 >Emitted(11, 13) Source(18, 13) + SourceIndex(0) +4 >Emitted(11, 16) Source(18, 16) + SourceIndex(0) +5 >Emitted(11, 17) Source(18, 17) + SourceIndex(0) +6 >Emitted(11, 22) Source(18, 22) + SourceIndex(0) +7 >Emitted(11, 23) Source(18, 23) + SourceIndex(0) +8 >Emitted(11, 24) Source(18, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(12, 1) Source(19, 1) + SourceIndex(0) +2 >Emitted(12, 2) Source(19, 2) + SourceIndex(0) +--- +>>>//# sourceMappingURL=sourceMapValidationDestructuringVariableStatementDefaultValues.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementDefaultValues.symbols b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementDefaultValues.symbols new file mode 100644 index 00000000000..85801e566b5 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementDefaultValues.symbols @@ -0,0 +1,69 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringVariableStatementDefaultValues.ts === +interface Robot { +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringVariableStatementDefaultValues.ts, 0, 0)) + + name: string; +>name : Symbol(Robot.name, Decl(sourceMapValidationDestructuringVariableStatementDefaultValues.ts, 0, 17)) + + skill: string; +>skill : Symbol(Robot.skill, Decl(sourceMapValidationDestructuringVariableStatementDefaultValues.ts, 1, 17)) +} +declare var console: { +>console : Symbol(console, Decl(sourceMapValidationDestructuringVariableStatementDefaultValues.ts, 4, 11)) + + log(msg: string): void; +>log : Symbol(log, Decl(sourceMapValidationDestructuringVariableStatementDefaultValues.ts, 4, 22)) +>msg : Symbol(msg, Decl(sourceMapValidationDestructuringVariableStatementDefaultValues.ts, 5, 8)) +} +var hello = "hello"; +>hello : Symbol(hello, Decl(sourceMapValidationDestructuringVariableStatementDefaultValues.ts, 7, 3)) + +var robotA: Robot = { name: "mower", skill: "mowing" }; +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringVariableStatementDefaultValues.ts, 8, 3)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringVariableStatementDefaultValues.ts, 0, 0)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringVariableStatementDefaultValues.ts, 8, 21)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringVariableStatementDefaultValues.ts, 8, 36)) + +var robotB: Robot = { name: "trimmer", skill: "trimming" }; +>robotB : Symbol(robotB, Decl(sourceMapValidationDestructuringVariableStatementDefaultValues.ts, 9, 3)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringVariableStatementDefaultValues.ts, 0, 0)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringVariableStatementDefaultValues.ts, 9, 21)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringVariableStatementDefaultValues.ts, 9, 38)) + +var { name: nameA = "" } = robotA; +>name : Symbol(Robot.name, Decl(sourceMapValidationDestructuringVariableStatementDefaultValues.ts, 0, 17)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringVariableStatementDefaultValues.ts, 10, 5)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringVariableStatementDefaultValues.ts, 8, 3)) + +var { name: nameB = "", skill: skillB = "" } = robotB; +>name : Symbol(Robot.name, Decl(sourceMapValidationDestructuringVariableStatementDefaultValues.ts, 0, 17)) +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringVariableStatementDefaultValues.ts, 11, 5)) +>skill : Symbol(Robot.skill, Decl(sourceMapValidationDestructuringVariableStatementDefaultValues.ts, 1, 17)) +>skillB : Symbol(skillB, Decl(sourceMapValidationDestructuringVariableStatementDefaultValues.ts, 11, 31)) +>robotB : Symbol(robotB, Decl(sourceMapValidationDestructuringVariableStatementDefaultValues.ts, 9, 3)) + +var { name: nameC = "", skill: skillC = "" } = { name: "Edger", skill: "cutting edges" }; +>name : Symbol(name, Decl(sourceMapValidationDestructuringVariableStatementDefaultValues.ts, 12, 74)) +>nameC : Symbol(nameC, Decl(sourceMapValidationDestructuringVariableStatementDefaultValues.ts, 12, 5)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringVariableStatementDefaultValues.ts, 12, 89)) +>skillC : Symbol(skillC, Decl(sourceMapValidationDestructuringVariableStatementDefaultValues.ts, 12, 31)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringVariableStatementDefaultValues.ts, 12, 74)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringVariableStatementDefaultValues.ts, 12, 89)) + +if (nameA == nameB) { +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringVariableStatementDefaultValues.ts, 10, 5)) +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringVariableStatementDefaultValues.ts, 11, 5)) + + console.log(skillB); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringVariableStatementDefaultValues.ts, 4, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringVariableStatementDefaultValues.ts, 4, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringVariableStatementDefaultValues.ts, 4, 22)) +>skillB : Symbol(skillB, Decl(sourceMapValidationDestructuringVariableStatementDefaultValues.ts, 11, 31)) +} +else { + console.log(nameC); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringVariableStatementDefaultValues.ts, 4, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringVariableStatementDefaultValues.ts, 4, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringVariableStatementDefaultValues.ts, 4, 22)) +>nameC : Symbol(nameC, Decl(sourceMapValidationDestructuringVariableStatementDefaultValues.ts, 12, 5)) +} diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementDefaultValues.types b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementDefaultValues.types new file mode 100644 index 00000000000..0ad3330e867 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementDefaultValues.types @@ -0,0 +1,87 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringVariableStatementDefaultValues.ts === +interface Robot { +>Robot : Robot + + name: string; +>name : string + + skill: string; +>skill : string +} +declare var console: { +>console : { log(msg: string): void; } + + log(msg: string): void; +>log : (msg: string) => void +>msg : string +} +var hello = "hello"; +>hello : string +>"hello" : string + +var robotA: Robot = { name: "mower", skill: "mowing" }; +>robotA : Robot +>Robot : Robot +>{ name: "mower", skill: "mowing" } : { name: string; skill: string; } +>name : string +>"mower" : string +>skill : string +>"mowing" : string + +var robotB: Robot = { name: "trimmer", skill: "trimming" }; +>robotB : Robot +>Robot : Robot +>{ name: "trimmer", skill: "trimming" } : { name: string; skill: string; } +>name : string +>"trimmer" : string +>skill : string +>"trimming" : string + +var { name: nameA = "" } = robotA; +>name : any +>nameA : string +>"" : string +>robotA : Robot + +var { name: nameB = "", skill: skillB = "" } = robotB; +>name : any +>nameB : string +>"" : string +>skill : any +>skillB : string +>"" : string +>robotB : Robot + +var { name: nameC = "", skill: skillC = "" } = { name: "Edger", skill: "cutting edges" }; +>name : any +>nameC : string +>"" : string +>skill : any +>skillC : string +>"" : string +>{ name: "Edger", skill: "cutting edges" } : { name?: string; skill?: string; } +>name : string +>"Edger" : string +>skill : string +>"cutting edges" : string + +if (nameA == nameB) { +>nameA == nameB : boolean +>nameA : string +>nameB : string + + console.log(skillB); +>console.log(skillB) : void +>console.log : (msg: string) => void +>console : { log(msg: string): void; } +>log : (msg: string) => void +>skillB : string +} +else { + console.log(nameC); +>console.log(nameC) : void +>console.log : (msg: string) => void +>console : { log(msg: string): void; } +>log : (msg: string) => void +>nameC : string +} diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.js b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.js new file mode 100644 index 00000000000..4988514324b --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.js @@ -0,0 +1,38 @@ +//// [sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts] +declare var console: { + log(msg: string): void; +} +interface Robot { + name: string; + skills: { + primary: string; + secondary: string; + }; +} +var robotA: Robot = { name: "mower", skills: { primary: "mowing", secondary: "none" } }; +var robotB: Robot = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }; + +var { skills: { primary: primaryA, secondary: secondaryA } } = robotA; +var { name: nameB, skills: { primary: primaryB, secondary: secondaryB } } = robotB; +var { name: nameC, skills: { primary: primaryB, secondary: secondaryB } } = { name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }; + +if (nameB == nameB) { + console.log(nameC); +} +else { + console.log(nameC); +} + +//// [sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.js] +var robotA = { name: "mower", skills: { primary: "mowing", secondary: "none" } }; +var robotB = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }; +var _a = robotA.skills, primaryA = _a.primary, secondaryA = _a.secondary; +var nameB = robotB.name, _b = robotB.skills, primaryB = _b.primary, secondaryB = _b.secondary; +var _c = { name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }, nameC = _c.name, _d = _c.skills, primaryB = _d.primary, secondaryB = _d.secondary; +if (nameB == nameB) { + console.log(nameC); +} +else { + console.log(nameC); +} +//# sourceMappingURL=sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.js.map b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.js.map new file mode 100644 index 00000000000..cd7a9813374 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.js.map @@ -0,0 +1,2 @@ +//// [sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.js.map] +{"version":3,"file":"sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.js","sourceRoot":"","sources":["sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts"],"names":[],"mappings":"AAUA,IAAI,MAAM,GAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,CAAC;AACxF,IAAI,MAAM,GAAU,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,CAAC;AAExF,sBAAoD,EAA1C,qBAAiB,EAAE,yBAAqB,CAAc;AAChE,uBAAW,EAAE,kBAAoD,EAA1C,qBAAiB,EAAE,yBAAqB,CAAc;AACnF,IAAA,mFAA0J,EAApJ,eAAW,EAAE,cAAoD,EAA1C,qBAAiB,EAAE,yBAAqB,CAAsF;AAE3J,EAAE,CAAC,CAAC,KAAK,IAAI,KAAK,CAAC,CAAC,CAAC;IACjB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AACD,IAAI,CAAC,CAAC;IACF,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.sourcemap.txt b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.sourcemap.txt new file mode 100644 index 00000000000..4d0845e1a75 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.sourcemap.txt @@ -0,0 +1,380 @@ +=================================================================== +JsFile: sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.js +mapUrl: sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.js.map +sourceRoot: +sources: sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.js +sourceFile:sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts +------------------------------------------------------------------- +>>>var robotA = { name: "mower", skills: { primary: "mowing", secondary: "none" } }; +1 > +2 >^^^^ +3 > ^^^^^^ +4 > ^^^ +5 > ^^ +6 > ^^^^ +7 > ^^ +8 > ^^^^^^^ +9 > ^^ +10> ^^^^^^ +11> ^^ +12> ^^ +13> ^^^^^^^ +14> ^^ +15> ^^^^^^^^ +16> ^^ +17> ^^^^^^^^^ +18> ^^ +19> ^^^^^^ +20> ^^ +21> ^^ +22> ^ +23> ^^^^^^^-> +1 >declare var console: { + > log(msg: string): void; + >} + >interface Robot { + > name: string; + > skills: { + > primary: string; + > secondary: string; + > }; + >} + > +2 >var +3 > robotA +4 > : Robot = +5 > { +6 > name +7 > : +8 > "mower" +9 > , +10> skills +11> : +12> { +13> primary +14> : +15> "mowing" +16> , +17> secondary +18> : +19> "none" +20> } +21> } +22> ; +1 >Emitted(1, 1) Source(11, 1) + SourceIndex(0) +2 >Emitted(1, 5) Source(11, 5) + SourceIndex(0) +3 >Emitted(1, 11) Source(11, 11) + SourceIndex(0) +4 >Emitted(1, 14) Source(11, 21) + SourceIndex(0) +5 >Emitted(1, 16) Source(11, 23) + SourceIndex(0) +6 >Emitted(1, 20) Source(11, 27) + SourceIndex(0) +7 >Emitted(1, 22) Source(11, 29) + SourceIndex(0) +8 >Emitted(1, 29) Source(11, 36) + SourceIndex(0) +9 >Emitted(1, 31) Source(11, 38) + SourceIndex(0) +10>Emitted(1, 37) Source(11, 44) + SourceIndex(0) +11>Emitted(1, 39) Source(11, 46) + SourceIndex(0) +12>Emitted(1, 41) Source(11, 48) + SourceIndex(0) +13>Emitted(1, 48) Source(11, 55) + SourceIndex(0) +14>Emitted(1, 50) Source(11, 57) + SourceIndex(0) +15>Emitted(1, 58) Source(11, 65) + SourceIndex(0) +16>Emitted(1, 60) Source(11, 67) + SourceIndex(0) +17>Emitted(1, 69) Source(11, 76) + SourceIndex(0) +18>Emitted(1, 71) Source(11, 78) + SourceIndex(0) +19>Emitted(1, 77) Source(11, 84) + SourceIndex(0) +20>Emitted(1, 79) Source(11, 86) + SourceIndex(0) +21>Emitted(1, 81) Source(11, 88) + SourceIndex(0) +22>Emitted(1, 82) Source(11, 89) + SourceIndex(0) +--- +>>>var robotB = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }; +1-> +2 >^^^^ +3 > ^^^^^^ +4 > ^^^ +5 > ^^ +6 > ^^^^ +7 > ^^ +8 > ^^^^^^^^^ +9 > ^^ +10> ^^^^^^ +11> ^^ +12> ^^ +13> ^^^^^^^ +14> ^^ +15> ^^^^^^^^^^ +16> ^^ +17> ^^^^^^^^^ +18> ^^ +19> ^^^^^^^^ +20> ^^ +21> ^^ +22> ^ +1-> + > +2 >var +3 > robotB +4 > : Robot = +5 > { +6 > name +7 > : +8 > "trimmer" +9 > , +10> skills +11> : +12> { +13> primary +14> : +15> "trimming" +16> , +17> secondary +18> : +19> "edging" +20> } +21> } +22> ; +1->Emitted(2, 1) Source(12, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(12, 5) + SourceIndex(0) +3 >Emitted(2, 11) Source(12, 11) + SourceIndex(0) +4 >Emitted(2, 14) Source(12, 21) + SourceIndex(0) +5 >Emitted(2, 16) Source(12, 23) + SourceIndex(0) +6 >Emitted(2, 20) Source(12, 27) + SourceIndex(0) +7 >Emitted(2, 22) Source(12, 29) + SourceIndex(0) +8 >Emitted(2, 31) Source(12, 38) + SourceIndex(0) +9 >Emitted(2, 33) Source(12, 40) + SourceIndex(0) +10>Emitted(2, 39) Source(12, 46) + SourceIndex(0) +11>Emitted(2, 41) Source(12, 48) + SourceIndex(0) +12>Emitted(2, 43) Source(12, 50) + SourceIndex(0) +13>Emitted(2, 50) Source(12, 57) + SourceIndex(0) +14>Emitted(2, 52) Source(12, 59) + SourceIndex(0) +15>Emitted(2, 62) Source(12, 69) + SourceIndex(0) +16>Emitted(2, 64) Source(12, 71) + SourceIndex(0) +17>Emitted(2, 73) Source(12, 80) + SourceIndex(0) +18>Emitted(2, 75) Source(12, 82) + SourceIndex(0) +19>Emitted(2, 83) Source(12, 90) + SourceIndex(0) +20>Emitted(2, 85) Source(12, 92) + SourceIndex(0) +21>Emitted(2, 87) Source(12, 94) + SourceIndex(0) +22>Emitted(2, 88) Source(12, 95) + SourceIndex(0) +--- +>>>var _a = robotA.skills, primaryA = _a.primary, secondaryA = _a.secondary; +1 > +2 >^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^ +8 > ^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > + >var { +2 >skills: { primary: primaryA, secondary: secondaryA } +3 > +4 > primary: primaryA +5 > , +6 > secondary: secondaryA +7 > } } = robotA; +1 >Emitted(3, 1) Source(14, 7) + SourceIndex(0) +2 >Emitted(3, 23) Source(14, 59) + SourceIndex(0) +3 >Emitted(3, 25) Source(14, 17) + SourceIndex(0) +4 >Emitted(3, 46) Source(14, 34) + SourceIndex(0) +5 >Emitted(3, 48) Source(14, 36) + SourceIndex(0) +6 >Emitted(3, 73) Source(14, 57) + SourceIndex(0) +7 >Emitted(3, 74) Source(14, 71) + SourceIndex(0) +--- +>>>var nameB = robotB.name, _b = robotB.skills, primaryB = _b.primary, secondaryB = _b.secondary; +1-> +2 >^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^^^^^^ +9 > ^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + >var { +2 >name: nameB +3 > , +4 > skills: { primary: primaryB, secondary: secondaryB } +5 > +6 > primary: primaryB +7 > , +8 > secondary: secondaryB +9 > } } = robotB; +1->Emitted(4, 1) Source(15, 7) + SourceIndex(0) +2 >Emitted(4, 24) Source(15, 18) + SourceIndex(0) +3 >Emitted(4, 26) Source(15, 20) + SourceIndex(0) +4 >Emitted(4, 44) Source(15, 72) + SourceIndex(0) +5 >Emitted(4, 46) Source(15, 30) + SourceIndex(0) +6 >Emitted(4, 67) Source(15, 47) + SourceIndex(0) +7 >Emitted(4, 69) Source(15, 49) + SourceIndex(0) +8 >Emitted(4, 94) Source(15, 70) + SourceIndex(0) +9 >Emitted(4, 95) Source(15, 84) + SourceIndex(0) +--- +>>>var _c = { name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }, nameC = _c.name, _d = _c.skills, primaryB = _d.primary, secondaryB = _d.secondary; +1-> +2 >^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +4 > ^^ +5 > ^^^^^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^^^^^^^ +10> ^^ +11> ^^^^^^^^^^^^^^^^^^^^^^^^^ +12> ^ +1-> + > +2 > +3 > var { name: nameC, skills: { primary: primaryB, secondary: secondaryB } } = { name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } } +4 > +5 > name: nameC +6 > , +7 > skills: { primary: primaryB, secondary: secondaryB } +8 > +9 > primary: primaryB +10> , +11> secondary: secondaryB +12> } } = { name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }; +1->Emitted(5, 1) Source(16, 1) + SourceIndex(0) +2 >Emitted(5, 5) Source(16, 1) + SourceIndex(0) +3 >Emitted(5, 88) Source(16, 155) + SourceIndex(0) +4 >Emitted(5, 90) Source(16, 7) + SourceIndex(0) +5 >Emitted(5, 105) Source(16, 18) + SourceIndex(0) +6 >Emitted(5, 107) Source(16, 20) + SourceIndex(0) +7 >Emitted(5, 121) Source(16, 72) + SourceIndex(0) +8 >Emitted(5, 123) Source(16, 30) + SourceIndex(0) +9 >Emitted(5, 144) Source(16, 47) + SourceIndex(0) +10>Emitted(5, 146) Source(16, 49) + SourceIndex(0) +11>Emitted(5, 171) Source(16, 70) + SourceIndex(0) +12>Emitted(5, 172) Source(16, 156) + SourceIndex(0) +--- +>>>if (nameB == nameB) { +1 > +2 >^^ +3 > ^ +4 > ^ +5 > ^^^^^ +6 > ^^^^ +7 > ^^^^^ +8 > ^ +9 > ^ +10> ^ +11> ^^^-> +1 > + > + > +2 >if +3 > +4 > ( +5 > nameB +6 > == +7 > nameB +8 > ) +9 > +10> { +1 >Emitted(6, 1) Source(18, 1) + SourceIndex(0) +2 >Emitted(6, 3) Source(18, 3) + SourceIndex(0) +3 >Emitted(6, 4) Source(18, 4) + SourceIndex(0) +4 >Emitted(6, 5) Source(18, 5) + SourceIndex(0) +5 >Emitted(6, 10) Source(18, 10) + SourceIndex(0) +6 >Emitted(6, 14) Source(18, 14) + SourceIndex(0) +7 >Emitted(6, 19) Source(18, 19) + SourceIndex(0) +8 >Emitted(6, 20) Source(18, 20) + SourceIndex(0) +9 >Emitted(6, 21) Source(18, 21) + SourceIndex(0) +10>Emitted(6, 22) Source(18, 22) + SourceIndex(0) +--- +>>> console.log(nameC); +1->^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1-> + > +2 > console +3 > . +4 > log +5 > ( +6 > nameC +7 > ) +8 > ; +1->Emitted(7, 5) Source(19, 5) + SourceIndex(0) +2 >Emitted(7, 12) Source(19, 12) + SourceIndex(0) +3 >Emitted(7, 13) Source(19, 13) + SourceIndex(0) +4 >Emitted(7, 16) Source(19, 16) + SourceIndex(0) +5 >Emitted(7, 17) Source(19, 17) + SourceIndex(0) +6 >Emitted(7, 22) Source(19, 22) + SourceIndex(0) +7 >Emitted(7, 23) Source(19, 23) + SourceIndex(0) +8 >Emitted(7, 24) Source(19, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^-> +1 > + > +2 >} +1 >Emitted(8, 1) Source(20, 1) + SourceIndex(0) +2 >Emitted(8, 2) Source(20, 2) + SourceIndex(0) +--- +>>>else { +1-> +2 >^^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >else +3 > +4 > { +1->Emitted(9, 1) Source(21, 1) + SourceIndex(0) +2 >Emitted(9, 5) Source(21, 5) + SourceIndex(0) +3 >Emitted(9, 6) Source(21, 6) + SourceIndex(0) +4 >Emitted(9, 7) Source(21, 7) + SourceIndex(0) +--- +>>> console.log(nameC); +1->^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1-> + > +2 > console +3 > . +4 > log +5 > ( +6 > nameC +7 > ) +8 > ; +1->Emitted(10, 5) Source(22, 5) + SourceIndex(0) +2 >Emitted(10, 12) Source(22, 12) + SourceIndex(0) +3 >Emitted(10, 13) Source(22, 13) + SourceIndex(0) +4 >Emitted(10, 16) Source(22, 16) + SourceIndex(0) +5 >Emitted(10, 17) Source(22, 17) + SourceIndex(0) +6 >Emitted(10, 22) Source(22, 22) + SourceIndex(0) +7 >Emitted(10, 23) Source(22, 23) + SourceIndex(0) +8 >Emitted(10, 24) Source(22, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(11, 1) Source(23, 1) + SourceIndex(0) +2 >Emitted(11, 2) Source(23, 2) + SourceIndex(0) +--- +>>>//# sourceMappingURL=sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.symbols b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.symbols new file mode 100644 index 00000000000..833212c606a --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.symbols @@ -0,0 +1,89 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts === +declare var console: { +>console : Symbol(console, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 0, 11)) + + log(msg: string): void; +>log : Symbol(log, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 0, 22)) +>msg : Symbol(msg, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 1, 8)) +} +interface Robot { +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 2, 1)) + + name: string; +>name : Symbol(Robot.name, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 3, 17)) + + skills: { +>skills : Symbol(Robot.skills, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 4, 17)) + + primary: string; +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 5, 13)) + + secondary: string; +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 6, 24)) + + }; +} +var robotA: Robot = { name: "mower", skills: { primary: "mowing", secondary: "none" } }; +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 10, 3)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 2, 1)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 10, 21)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 10, 36)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 10, 46)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 10, 65)) + +var robotB: Robot = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }; +>robotB : Symbol(robotB, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 11, 3)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 2, 1)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 11, 21)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 11, 38)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 11, 48)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 11, 69)) + +var { skills: { primary: primaryA, secondary: secondaryA } } = robotA; +>skills : Symbol(Robot.skills, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 4, 17)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 5, 13)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 13, 15)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 6, 24)) +>secondaryA : Symbol(secondaryA, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 13, 34)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 10, 3)) + +var { name: nameB, skills: { primary: primaryB, secondary: secondaryB } } = robotB; +>name : Symbol(Robot.name, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 3, 17)) +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 14, 5)) +>skills : Symbol(Robot.skills, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 4, 17)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 5, 13)) +>primaryB : Symbol(primaryB, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 14, 28), Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 15, 28)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 6, 24)) +>secondaryB : Symbol(secondaryB, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 14, 47), Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 15, 47)) +>robotB : Symbol(robotB, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 11, 3)) + +var { name: nameC, skills: { primary: primaryB, secondary: secondaryB } } = { name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }; +>name : Symbol(name, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 15, 77)) +>nameC : Symbol(nameC, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 15, 5)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 15, 92)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 15, 102)) +>primaryB : Symbol(primaryB, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 14, 28), Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 15, 28)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 15, 121)) +>secondaryB : Symbol(secondaryB, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 14, 47), Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 15, 47)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 15, 77)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 15, 92)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 15, 102)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 15, 121)) + +if (nameB == nameB) { +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 14, 5)) +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 14, 5)) + + console.log(nameC); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 0, 22)) +>nameC : Symbol(nameC, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 15, 5)) +} +else { + console.log(nameC); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 0, 22)) +>nameC : Symbol(nameC, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 15, 5)) +} diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.types b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.types new file mode 100644 index 00000000000..1101b01b1a7 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.types @@ -0,0 +1,107 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts === +declare var console: { +>console : { log(msg: string): void; } + + log(msg: string): void; +>log : (msg: string) => void +>msg : string +} +interface Robot { +>Robot : Robot + + name: string; +>name : string + + skills: { +>skills : { primary: string; secondary: string; } + + primary: string; +>primary : string + + secondary: string; +>secondary : string + + }; +} +var robotA: Robot = { name: "mower", skills: { primary: "mowing", secondary: "none" } }; +>robotA : Robot +>Robot : Robot +>{ name: "mower", skills: { primary: "mowing", secondary: "none" } } : { name: string; skills: { primary: string; secondary: string; }; } +>name : string +>"mower" : string +>skills : { primary: string; secondary: string; } +>{ primary: "mowing", secondary: "none" } : { primary: string; secondary: string; } +>primary : string +>"mowing" : string +>secondary : string +>"none" : string + +var robotB: Robot = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }; +>robotB : Robot +>Robot : Robot +>{ name: "trimmer", skills: { primary: "trimming", secondary: "edging" } } : { name: string; skills: { primary: string; secondary: string; }; } +>name : string +>"trimmer" : string +>skills : { primary: string; secondary: string; } +>{ primary: "trimming", secondary: "edging" } : { primary: string; secondary: string; } +>primary : string +>"trimming" : string +>secondary : string +>"edging" : string + +var { skills: { primary: primaryA, secondary: secondaryA } } = robotA; +>skills : any +>primary : any +>primaryA : string +>secondary : any +>secondaryA : string +>robotA : Robot + +var { name: nameB, skills: { primary: primaryB, secondary: secondaryB } } = robotB; +>name : any +>nameB : string +>skills : any +>primary : any +>primaryB : string +>secondary : any +>secondaryB : string +>robotB : Robot + +var { name: nameC, skills: { primary: primaryB, secondary: secondaryB } } = { name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }; +>name : any +>nameC : string +>skills : any +>primary : any +>primaryB : string +>secondary : any +>secondaryB : string +>{ name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } } : { name: string; skills: { primary: string; secondary: string; }; } +>name : string +>"Edger" : string +>skills : { primary: string; secondary: string; } +>{ primary: "edging", secondary: "branch trimming" } : { primary: string; secondary: string; } +>primary : string +>"edging" : string +>secondary : string +>"branch trimming" : string + +if (nameB == nameB) { +>nameB == nameB : boolean +>nameB : string +>nameB : string + + console.log(nameC); +>console.log(nameC) : void +>console.log : (msg: string) => void +>console : { log(msg: string): void; } +>log : (msg: string) => void +>nameC : string +} +else { + console.log(nameC); +>console.log(nameC) : void +>console.log : (msg: string) => void +>console : { log(msg: string): void; } +>log : (msg: string) => void +>nameC : string +} diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.js b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.js new file mode 100644 index 00000000000..694f1d9d30c --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.js @@ -0,0 +1,55 @@ +//// [sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts] +declare var console: { + log(msg: string): void; +} +interface Robot { + name: string; + skills: { + primary?: string; + secondary?: string; + }; +} +var robotA: Robot = { name: "mower", skills: { primary: "mowing", secondary: "none" } }; +var robotB: Robot = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }; + +var { + skills: { + primary: primaryA = "noSkill", + secondary: secondaryA = "noSkill" + } = { primary: "noSkill", secondary: "noSkill" } +} = robotA; +var { + name: nameB = "noNameSpecified", + skills: { + primary: primaryB = "noSkill", + secondary: secondaryB = "noSkill" + } = { primary: "noSkill", secondary: "noSkill" } +} = robotB; +var { + name: nameC = "noNameSpecified", + skills: { + primary: primaryB = "noSkill", + secondary: secondaryB = "noSkill" + } = { primary: "noSkill", secondary: "noSkill" } +} = { name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }; + +if (nameB == nameB) { + console.log(nameC); +} +else { + console.log(nameC); +} + +//// [sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.js] +var robotA = { name: "mower", skills: { primary: "mowing", secondary: "none" } }; +var robotB = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }; +var _a = robotA.skills, _b = _a === void 0 ? { primary: "noSkill", secondary: "noSkill" } : _a, _c = _b.primary, primaryA = _c === void 0 ? "noSkill" : _c, _d = _b.secondary, secondaryA = _d === void 0 ? "noSkill" : _d; +var _e = robotB.name, nameB = _e === void 0 ? "noNameSpecified" : _e, _f = robotB.skills, _g = _f === void 0 ? { primary: "noSkill", secondary: "noSkill" } : _f, _h = _g.primary, primaryB = _h === void 0 ? "noSkill" : _h, _j = _g.secondary, secondaryB = _j === void 0 ? "noSkill" : _j; +var _k = { name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }, _l = _k.name, nameC = _l === void 0 ? "noNameSpecified" : _l, _m = _k.skills, _o = _m === void 0 ? { primary: "noSkill", secondary: "noSkill" } : _m, _p = _o.primary, primaryB = _p === void 0 ? "noSkill" : _p, _q = _o.secondary, secondaryB = _q === void 0 ? "noSkill" : _q; +if (nameB == nameB) { + console.log(nameC); +} +else { + console.log(nameC); +} +//# sourceMappingURL=sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.js.map b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.js.map new file mode 100644 index 00000000000..9ad442f4698 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.js.map @@ -0,0 +1,2 @@ +//// [sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.js.map] +{"version":3,"file":"sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.js","sourceRoot":"","sources":["sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts"],"names":[],"mappings":"AAUA,IAAI,MAAM,GAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,CAAC;AACxF,IAAI,MAAM,GAAU,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,CAAC;AAG1F,sBAGgD,EAHhD,sEAGgD,EAF5C,eAA6B,EAA7B,yCAA6B,EAC7B,iBAAiC,EAAjC,2CAAiC,CAE9B;AAEP,oBAA+B,EAA/B,8CAA+B,EAC/B,kBAGgD,EAHhD,sEAGgD,EAF5C,eAA6B,EAA7B,yCAA6B,EAC7B,iBAAiC,EAAjC,2CAAiC,CAE9B;AACX,IAAA,mFAMyF,EALrF,YAA+B,EAA/B,8CAA+B,EAC/B,cAGgD,EAHhD,sEAGgD,EAF5C,eAA6B,EAA7B,yCAA6B,EAC7B,iBAAiC,EAAjC,2CAAiC,CAEiD;AAE1F,EAAE,CAAC,CAAC,KAAK,IAAI,KAAK,CAAC,CAAC,CAAC;IACjB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AACD,IAAI,CAAC,CAAC;IACF,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.sourcemap.txt b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.sourcemap.txt new file mode 100644 index 00000000000..5e007440890 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.sourcemap.txt @@ -0,0 +1,484 @@ +=================================================================== +JsFile: sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.js +mapUrl: sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.js.map +sourceRoot: +sources: sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.js +sourceFile:sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts +------------------------------------------------------------------- +>>>var robotA = { name: "mower", skills: { primary: "mowing", secondary: "none" } }; +1 > +2 >^^^^ +3 > ^^^^^^ +4 > ^^^ +5 > ^^ +6 > ^^^^ +7 > ^^ +8 > ^^^^^^^ +9 > ^^ +10> ^^^^^^ +11> ^^ +12> ^^ +13> ^^^^^^^ +14> ^^ +15> ^^^^^^^^ +16> ^^ +17> ^^^^^^^^^ +18> ^^ +19> ^^^^^^ +20> ^^ +21> ^^ +22> ^ +23> ^^^^^^^-> +1 >declare var console: { + > log(msg: string): void; + >} + >interface Robot { + > name: string; + > skills: { + > primary?: string; + > secondary?: string; + > }; + >} + > +2 >var +3 > robotA +4 > : Robot = +5 > { +6 > name +7 > : +8 > "mower" +9 > , +10> skills +11> : +12> { +13> primary +14> : +15> "mowing" +16> , +17> secondary +18> : +19> "none" +20> } +21> } +22> ; +1 >Emitted(1, 1) Source(11, 1) + SourceIndex(0) +2 >Emitted(1, 5) Source(11, 5) + SourceIndex(0) +3 >Emitted(1, 11) Source(11, 11) + SourceIndex(0) +4 >Emitted(1, 14) Source(11, 21) + SourceIndex(0) +5 >Emitted(1, 16) Source(11, 23) + SourceIndex(0) +6 >Emitted(1, 20) Source(11, 27) + SourceIndex(0) +7 >Emitted(1, 22) Source(11, 29) + SourceIndex(0) +8 >Emitted(1, 29) Source(11, 36) + SourceIndex(0) +9 >Emitted(1, 31) Source(11, 38) + SourceIndex(0) +10>Emitted(1, 37) Source(11, 44) + SourceIndex(0) +11>Emitted(1, 39) Source(11, 46) + SourceIndex(0) +12>Emitted(1, 41) Source(11, 48) + SourceIndex(0) +13>Emitted(1, 48) Source(11, 55) + SourceIndex(0) +14>Emitted(1, 50) Source(11, 57) + SourceIndex(0) +15>Emitted(1, 58) Source(11, 65) + SourceIndex(0) +16>Emitted(1, 60) Source(11, 67) + SourceIndex(0) +17>Emitted(1, 69) Source(11, 76) + SourceIndex(0) +18>Emitted(1, 71) Source(11, 78) + SourceIndex(0) +19>Emitted(1, 77) Source(11, 84) + SourceIndex(0) +20>Emitted(1, 79) Source(11, 86) + SourceIndex(0) +21>Emitted(1, 81) Source(11, 88) + SourceIndex(0) +22>Emitted(1, 82) Source(11, 89) + SourceIndex(0) +--- +>>>var robotB = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }; +1-> +2 >^^^^ +3 > ^^^^^^ +4 > ^^^ +5 > ^^ +6 > ^^^^ +7 > ^^ +8 > ^^^^^^^^^ +9 > ^^ +10> ^^^^^^ +11> ^^ +12> ^^ +13> ^^^^^^^ +14> ^^ +15> ^^^^^^^^^^ +16> ^^ +17> ^^^^^^^^^ +18> ^^ +19> ^^^^^^^^ +20> ^^ +21> ^^ +22> ^ +23> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >var +3 > robotB +4 > : Robot = +5 > { +6 > name +7 > : +8 > "trimmer" +9 > , +10> skills +11> : +12> { +13> primary +14> : +15> "trimming" +16> , +17> secondary +18> : +19> "edging" +20> } +21> } +22> ; +1->Emitted(2, 1) Source(12, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(12, 5) + SourceIndex(0) +3 >Emitted(2, 11) Source(12, 11) + SourceIndex(0) +4 >Emitted(2, 14) Source(12, 21) + SourceIndex(0) +5 >Emitted(2, 16) Source(12, 23) + SourceIndex(0) +6 >Emitted(2, 20) Source(12, 27) + SourceIndex(0) +7 >Emitted(2, 22) Source(12, 29) + SourceIndex(0) +8 >Emitted(2, 31) Source(12, 38) + SourceIndex(0) +9 >Emitted(2, 33) Source(12, 40) + SourceIndex(0) +10>Emitted(2, 39) Source(12, 46) + SourceIndex(0) +11>Emitted(2, 41) Source(12, 48) + SourceIndex(0) +12>Emitted(2, 43) Source(12, 50) + SourceIndex(0) +13>Emitted(2, 50) Source(12, 57) + SourceIndex(0) +14>Emitted(2, 52) Source(12, 59) + SourceIndex(0) +15>Emitted(2, 62) Source(12, 69) + SourceIndex(0) +16>Emitted(2, 64) Source(12, 71) + SourceIndex(0) +17>Emitted(2, 73) Source(12, 80) + SourceIndex(0) +18>Emitted(2, 75) Source(12, 82) + SourceIndex(0) +19>Emitted(2, 83) Source(12, 90) + SourceIndex(0) +20>Emitted(2, 85) Source(12, 92) + SourceIndex(0) +21>Emitted(2, 87) Source(12, 94) + SourceIndex(0) +22>Emitted(2, 88) Source(12, 95) + SourceIndex(0) +--- +>>>var _a = robotA.skills, _b = _a === void 0 ? { primary: "noSkill", secondary: "noSkill" } : _a, _c = _b.primary, primaryA = _c === void 0 ? "noSkill" : _c, _d = _b.secondary, secondaryA = _d === void 0 ? "noSkill" : _d; +1-> +2 >^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +13> ^ +14> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > + >var { + > +2 >skills: { + > primary: primaryA = "noSkill", + > secondary: secondaryA = "noSkill" + > } = { primary: "noSkill", secondary: "noSkill" } +3 > +4 > skills: { + > primary: primaryA = "noSkill", + > secondary: secondaryA = "noSkill" + > } = { primary: "noSkill", secondary: "noSkill" } +5 > +6 > primary: primaryA = "noSkill" +7 > +8 > primary: primaryA = "noSkill" +9 > , + > +10> secondary: secondaryA = "noSkill" +11> +12> secondary: secondaryA = "noSkill" +13> + > } = { primary: "noSkill", secondary: "noSkill" } + > } = robotA; +1->Emitted(3, 1) Source(15, 5) + SourceIndex(0) +2 >Emitted(3, 23) Source(18, 53) + SourceIndex(0) +3 >Emitted(3, 25) Source(15, 5) + SourceIndex(0) +4 >Emitted(3, 95) Source(18, 53) + SourceIndex(0) +5 >Emitted(3, 97) Source(16, 9) + SourceIndex(0) +6 >Emitted(3, 112) Source(16, 38) + SourceIndex(0) +7 >Emitted(3, 114) Source(16, 9) + SourceIndex(0) +8 >Emitted(3, 155) Source(16, 38) + SourceIndex(0) +9 >Emitted(3, 157) Source(17, 9) + SourceIndex(0) +10>Emitted(3, 174) Source(17, 42) + SourceIndex(0) +11>Emitted(3, 176) Source(17, 9) + SourceIndex(0) +12>Emitted(3, 219) Source(17, 42) + SourceIndex(0) +13>Emitted(3, 220) Source(19, 12) + SourceIndex(0) +--- +>>>var _e = robotB.name, nameB = _e === void 0 ? "noNameSpecified" : _e, _f = robotB.skills, _g = _f === void 0 ? { primary: "noSkill", secondary: "noSkill" } : _f, _h = _g.primary, primaryB = _h === void 0 ? "noSkill" : _h, _j = _g.secondary, secondaryB = _j === void 0 ? "noSkill" : _j; +1-> +2 >^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^^^^^^^^^^^^^^^^^^ +7 > ^^ +8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +9 > ^^ +10> ^^^^^^^^^^^^^^^ +11> ^^ +12> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +13> ^^ +14> ^^^^^^^^^^^^^^^^^ +15> ^^ +16> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +17> ^ +18> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + >var { + > +2 >name: nameB = "noNameSpecified" +3 > +4 > name: nameB = "noNameSpecified" +5 > , + > +6 > skills: { + > primary: primaryB = "noSkill", + > secondary: secondaryB = "noSkill" + > } = { primary: "noSkill", secondary: "noSkill" } +7 > +8 > skills: { + > primary: primaryB = "noSkill", + > secondary: secondaryB = "noSkill" + > } = { primary: "noSkill", secondary: "noSkill" } +9 > +10> primary: primaryB = "noSkill" +11> +12> primary: primaryB = "noSkill" +13> , + > +14> secondary: secondaryB = "noSkill" +15> +16> secondary: secondaryB = "noSkill" +17> + > } = { primary: "noSkill", secondary: "noSkill" } + > } = robotB; +1->Emitted(4, 1) Source(21, 5) + SourceIndex(0) +2 >Emitted(4, 21) Source(21, 36) + SourceIndex(0) +3 >Emitted(4, 23) Source(21, 5) + SourceIndex(0) +4 >Emitted(4, 69) Source(21, 36) + SourceIndex(0) +5 >Emitted(4, 71) Source(22, 5) + SourceIndex(0) +6 >Emitted(4, 89) Source(25, 53) + SourceIndex(0) +7 >Emitted(4, 91) Source(22, 5) + SourceIndex(0) +8 >Emitted(4, 161) Source(25, 53) + SourceIndex(0) +9 >Emitted(4, 163) Source(23, 9) + SourceIndex(0) +10>Emitted(4, 178) Source(23, 38) + SourceIndex(0) +11>Emitted(4, 180) Source(23, 9) + SourceIndex(0) +12>Emitted(4, 221) Source(23, 38) + SourceIndex(0) +13>Emitted(4, 223) Source(24, 9) + SourceIndex(0) +14>Emitted(4, 240) Source(24, 42) + SourceIndex(0) +15>Emitted(4, 242) Source(24, 9) + SourceIndex(0) +16>Emitted(4, 285) Source(24, 42) + SourceIndex(0) +17>Emitted(4, 286) Source(26, 12) + SourceIndex(0) +--- +>>>var _k = { name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }, _l = _k.name, nameC = _l === void 0 ? "noNameSpecified" : _l, _m = _k.skills, _o = _m === void 0 ? { primary: "noSkill", secondary: "noSkill" } : _m, _p = _o.primary, primaryB = _p === void 0 ? "noSkill" : _p, _q = _o.secondary, secondaryB = _q === void 0 ? "noSkill" : _q; +1-> +2 >^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +4 > ^^ +5 > ^^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^ +10> ^^ +11> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +12> ^^ +13> ^^^^^^^^^^^^^^^ +14> ^^ +15> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +16> ^^ +17> ^^^^^^^^^^^^^^^^^ +18> ^^ +19> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +20> ^ +1-> + > +2 > +3 > var { + > name: nameC = "noNameSpecified", + > skills: { + > primary: primaryB = "noSkill", + > secondary: secondaryB = "noSkill" + > } = { primary: "noSkill", secondary: "noSkill" } + > } = { name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } } +4 > +5 > name: nameC = "noNameSpecified" +6 > +7 > name: nameC = "noNameSpecified" +8 > , + > +9 > skills: { + > primary: primaryB = "noSkill", + > secondary: secondaryB = "noSkill" + > } = { primary: "noSkill", secondary: "noSkill" } +10> +11> skills: { + > primary: primaryB = "noSkill", + > secondary: secondaryB = "noSkill" + > } = { primary: "noSkill", secondary: "noSkill" } +12> +13> primary: primaryB = "noSkill" +14> +15> primary: primaryB = "noSkill" +16> , + > +17> secondary: secondaryB = "noSkill" +18> +19> secondary: secondaryB = "noSkill" +20> + > } = { primary: "noSkill", secondary: "noSkill" } + > } = { name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }; +1->Emitted(5, 1) Source(27, 1) + SourceIndex(0) +2 >Emitted(5, 5) Source(27, 1) + SourceIndex(0) +3 >Emitted(5, 88) Source(33, 90) + SourceIndex(0) +4 >Emitted(5, 90) Source(28, 5) + SourceIndex(0) +5 >Emitted(5, 102) Source(28, 36) + SourceIndex(0) +6 >Emitted(5, 104) Source(28, 5) + SourceIndex(0) +7 >Emitted(5, 150) Source(28, 36) + SourceIndex(0) +8 >Emitted(5, 152) Source(29, 5) + SourceIndex(0) +9 >Emitted(5, 166) Source(32, 53) + SourceIndex(0) +10>Emitted(5, 168) Source(29, 5) + SourceIndex(0) +11>Emitted(5, 238) Source(32, 53) + SourceIndex(0) +12>Emitted(5, 240) Source(30, 9) + SourceIndex(0) +13>Emitted(5, 255) Source(30, 38) + SourceIndex(0) +14>Emitted(5, 257) Source(30, 9) + SourceIndex(0) +15>Emitted(5, 298) Source(30, 38) + SourceIndex(0) +16>Emitted(5, 300) Source(31, 9) + SourceIndex(0) +17>Emitted(5, 317) Source(31, 42) + SourceIndex(0) +18>Emitted(5, 319) Source(31, 9) + SourceIndex(0) +19>Emitted(5, 362) Source(31, 42) + SourceIndex(0) +20>Emitted(5, 363) Source(33, 91) + SourceIndex(0) +--- +>>>if (nameB == nameB) { +1 > +2 >^^ +3 > ^ +4 > ^ +5 > ^^^^^ +6 > ^^^^ +7 > ^^^^^ +8 > ^ +9 > ^ +10> ^ +11> ^^^-> +1 > + > + > +2 >if +3 > +4 > ( +5 > nameB +6 > == +7 > nameB +8 > ) +9 > +10> { +1 >Emitted(6, 1) Source(35, 1) + SourceIndex(0) +2 >Emitted(6, 3) Source(35, 3) + SourceIndex(0) +3 >Emitted(6, 4) Source(35, 4) + SourceIndex(0) +4 >Emitted(6, 5) Source(35, 5) + SourceIndex(0) +5 >Emitted(6, 10) Source(35, 10) + SourceIndex(0) +6 >Emitted(6, 14) Source(35, 14) + SourceIndex(0) +7 >Emitted(6, 19) Source(35, 19) + SourceIndex(0) +8 >Emitted(6, 20) Source(35, 20) + SourceIndex(0) +9 >Emitted(6, 21) Source(35, 21) + SourceIndex(0) +10>Emitted(6, 22) Source(35, 22) + SourceIndex(0) +--- +>>> console.log(nameC); +1->^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1-> + > +2 > console +3 > . +4 > log +5 > ( +6 > nameC +7 > ) +8 > ; +1->Emitted(7, 5) Source(36, 5) + SourceIndex(0) +2 >Emitted(7, 12) Source(36, 12) + SourceIndex(0) +3 >Emitted(7, 13) Source(36, 13) + SourceIndex(0) +4 >Emitted(7, 16) Source(36, 16) + SourceIndex(0) +5 >Emitted(7, 17) Source(36, 17) + SourceIndex(0) +6 >Emitted(7, 22) Source(36, 22) + SourceIndex(0) +7 >Emitted(7, 23) Source(36, 23) + SourceIndex(0) +8 >Emitted(7, 24) Source(36, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^-> +1 > + > +2 >} +1 >Emitted(8, 1) Source(37, 1) + SourceIndex(0) +2 >Emitted(8, 2) Source(37, 2) + SourceIndex(0) +--- +>>>else { +1-> +2 >^^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >else +3 > +4 > { +1->Emitted(9, 1) Source(38, 1) + SourceIndex(0) +2 >Emitted(9, 5) Source(38, 5) + SourceIndex(0) +3 >Emitted(9, 6) Source(38, 6) + SourceIndex(0) +4 >Emitted(9, 7) Source(38, 7) + SourceIndex(0) +--- +>>> console.log(nameC); +1->^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1-> + > +2 > console +3 > . +4 > log +5 > ( +6 > nameC +7 > ) +8 > ; +1->Emitted(10, 5) Source(39, 5) + SourceIndex(0) +2 >Emitted(10, 12) Source(39, 12) + SourceIndex(0) +3 >Emitted(10, 13) Source(39, 13) + SourceIndex(0) +4 >Emitted(10, 16) Source(39, 16) + SourceIndex(0) +5 >Emitted(10, 17) Source(39, 17) + SourceIndex(0) +6 >Emitted(10, 22) Source(39, 22) + SourceIndex(0) +7 >Emitted(10, 23) Source(39, 23) + SourceIndex(0) +8 >Emitted(10, 24) Source(39, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(11, 1) Source(40, 1) + SourceIndex(0) +2 >Emitted(11, 2) Source(40, 2) + SourceIndex(0) +--- +>>>//# sourceMappingURL=sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.symbols b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.symbols new file mode 100644 index 00000000000..d0f04399e3f --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.symbols @@ -0,0 +1,127 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts === +declare var console: { +>console : Symbol(console, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts, 0, 11)) + + log(msg: string): void; +>log : Symbol(log, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts, 0, 22)) +>msg : Symbol(msg, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts, 1, 8)) +} +interface Robot { +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts, 2, 1)) + + name: string; +>name : Symbol(Robot.name, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts, 3, 17)) + + skills: { +>skills : Symbol(Robot.skills, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts, 4, 17)) + + primary?: string; +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts, 5, 13)) + + secondary?: string; +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts, 6, 25)) + + }; +} +var robotA: Robot = { name: "mower", skills: { primary: "mowing", secondary: "none" } }; +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts, 10, 3)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts, 2, 1)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts, 10, 21)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts, 10, 36)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts, 10, 46)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts, 10, 65)) + +var robotB: Robot = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }; +>robotB : Symbol(robotB, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts, 11, 3)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts, 2, 1)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts, 11, 21)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts, 11, 38)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts, 11, 48)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts, 11, 69)) + +var { + skills: { +>skills : Symbol(Robot.skills, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts, 4, 17)) + + primary: primaryA = "noSkill", +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts, 5, 13)) +>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts, 14, 13)) + + secondary: secondaryA = "noSkill" +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts, 6, 25)) +>secondaryA : Symbol(secondaryA, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts, 15, 38)) + + } = { primary: "noSkill", secondary: "noSkill" } +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts, 17, 9)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts, 17, 29)) + +} = robotA; +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts, 10, 3)) + +var { + name: nameB = "noNameSpecified", +>name : Symbol(Robot.name, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts, 3, 17)) +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts, 19, 5)) + + skills: { +>skills : Symbol(Robot.skills, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts, 4, 17)) + + primary: primaryB = "noSkill", +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts, 5, 13)) +>primaryB : Symbol(primaryB, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts, 21, 13), Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts, 28, 13)) + + secondary: secondaryB = "noSkill" +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts, 6, 25)) +>secondaryB : Symbol(secondaryB, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts, 22, 38), Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts, 29, 38)) + + } = { primary: "noSkill", secondary: "noSkill" } +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts, 24, 9)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts, 24, 29)) + +} = robotB; +>robotB : Symbol(robotB, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts, 11, 3)) + +var { + name: nameC = "noNameSpecified", +>name : Symbol(Robot.name, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts, 3, 17)) +>nameC : Symbol(nameC, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts, 26, 5)) + + skills: { +>skills : Symbol(Robot.skills, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts, 4, 17)) + + primary: primaryB = "noSkill", +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts, 5, 13)) +>primaryB : Symbol(primaryB, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts, 21, 13), Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts, 28, 13)) + + secondary: secondaryB = "noSkill" +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts, 6, 25)) +>secondaryB : Symbol(secondaryB, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts, 22, 38), Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts, 29, 38)) + + } = { primary: "noSkill", secondary: "noSkill" } +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts, 31, 9)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts, 31, 29)) + +} = { name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }; +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts, 2, 1)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts, 32, 12)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts, 32, 27)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts, 32, 37)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts, 32, 56)) + +if (nameB == nameB) { +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts, 19, 5)) +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts, 19, 5)) + + console.log(nameC); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts, 0, 22)) +>nameC : Symbol(nameC, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts, 26, 5)) +} +else { + console.log(nameC); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts, 0, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts, 0, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts, 0, 22)) +>nameC : Symbol(nameC, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts, 26, 5)) +} diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.types b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.types new file mode 100644 index 00000000000..e3fdec19339 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.types @@ -0,0 +1,163 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts === +declare var console: { +>console : { log(msg: string): void; } + + log(msg: string): void; +>log : (msg: string) => void +>msg : string +} +interface Robot { +>Robot : Robot + + name: string; +>name : string + + skills: { +>skills : { primary?: string; secondary?: string; } + + primary?: string; +>primary : string + + secondary?: string; +>secondary : string + + }; +} +var robotA: Robot = { name: "mower", skills: { primary: "mowing", secondary: "none" } }; +>robotA : Robot +>Robot : Robot +>{ name: "mower", skills: { primary: "mowing", secondary: "none" } } : { name: string; skills: { primary: string; secondary: string; }; } +>name : string +>"mower" : string +>skills : { primary: string; secondary: string; } +>{ primary: "mowing", secondary: "none" } : { primary: string; secondary: string; } +>primary : string +>"mowing" : string +>secondary : string +>"none" : string + +var robotB: Robot = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }; +>robotB : Robot +>Robot : Robot +>{ name: "trimmer", skills: { primary: "trimming", secondary: "edging" } } : { name: string; skills: { primary: string; secondary: string; }; } +>name : string +>"trimmer" : string +>skills : { primary: string; secondary: string; } +>{ primary: "trimming", secondary: "edging" } : { primary: string; secondary: string; } +>primary : string +>"trimming" : string +>secondary : string +>"edging" : string + +var { + skills: { +>skills : any + + primary: primaryA = "noSkill", +>primary : any +>primaryA : string +>"noSkill" : string + + secondary: secondaryA = "noSkill" +>secondary : any +>secondaryA : string +>"noSkill" : string + + } = { primary: "noSkill", secondary: "noSkill" } +>{ primary: "noSkill", secondary: "noSkill" } : { primary?: string; secondary?: string; } +>primary : string +>"noSkill" : string +>secondary : string +>"noSkill" : string + +} = robotA; +>robotA : Robot + +var { + name: nameB = "noNameSpecified", +>name : any +>nameB : string +>"noNameSpecified" : string + + skills: { +>skills : any + + primary: primaryB = "noSkill", +>primary : any +>primaryB : string +>"noSkill" : string + + secondary: secondaryB = "noSkill" +>secondary : any +>secondaryB : string +>"noSkill" : string + + } = { primary: "noSkill", secondary: "noSkill" } +>{ primary: "noSkill", secondary: "noSkill" } : { primary?: string; secondary?: string; } +>primary : string +>"noSkill" : string +>secondary : string +>"noSkill" : string + +} = robotB; +>robotB : Robot + +var { + name: nameC = "noNameSpecified", +>name : any +>nameC : string +>"noNameSpecified" : string + + skills: { +>skills : any + + primary: primaryB = "noSkill", +>primary : any +>primaryB : string +>"noSkill" : string + + secondary: secondaryB = "noSkill" +>secondary : any +>secondaryB : string +>"noSkill" : string + + } = { primary: "noSkill", secondary: "noSkill" } +>{ primary: "noSkill", secondary: "noSkill" } : { primary?: string; secondary?: string; } +>primary : string +>"noSkill" : string +>secondary : string +>"noSkill" : string + +} = { name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }; +>{ name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } } : Robot +>Robot : Robot +>{ name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } } : { name: string; skills: { primary: string; secondary: string; }; } +>name : string +>"Edger" : string +>skills : { primary: string; secondary: string; } +>{ primary: "edging", secondary: "branch trimming" } : { primary: string; secondary: string; } +>primary : string +>"edging" : string +>secondary : string +>"branch trimming" : string + +if (nameB == nameB) { +>nameB == nameB : boolean +>nameB : string +>nameB : string + + console.log(nameC); +>console.log(nameC) : void +>console.log : (msg: string) => void +>console : { log(msg: string): void; } +>log : (msg: string) => void +>nameC : string +} +else { + console.log(nameC); +>console.log(nameC) : void +>console.log : (msg: string) => void +>console : { log(msg: string): void; } +>log : (msg: string) => void +>nameC : string +} diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern1.js b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern1.js new file mode 100644 index 00000000000..8259981857c --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern1.js @@ -0,0 +1,7 @@ +//// [sourceMapValidationDestructuringVariableStatementObjectBindingPattern1.ts] + +var {x} = { x: 20 }; + +//// [sourceMapValidationDestructuringVariableStatementObjectBindingPattern1.js] +var x = { x: 20 }.x; +//# sourceMappingURL=sourceMapValidationDestructuringVariableStatementObjectBindingPattern1.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern1.js.map b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern1.js.map new file mode 100644 index 00000000000..5ecd5985927 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern1.js.map @@ -0,0 +1,2 @@ +//// [sourceMapValidationDestructuringVariableStatementObjectBindingPattern1.js.map] +{"version":3,"file":"sourceMapValidationDestructuringVariableStatementObjectBindingPattern1.js","sourceRoot":"","sources":["sourceMapValidationDestructuringVariableStatementObjectBindingPattern1.ts"],"names":[],"mappings":"AACK,mBAAC,CAAc"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern1.sourcemap.txt b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern1.sourcemap.txt new file mode 100644 index 00000000000..8e5860c7a77 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern1.sourcemap.txt @@ -0,0 +1,24 @@ +=================================================================== +JsFile: sourceMapValidationDestructuringVariableStatementObjectBindingPattern1.js +mapUrl: sourceMapValidationDestructuringVariableStatementObjectBindingPattern1.js.map +sourceRoot: +sources: sourceMapValidationDestructuringVariableStatementObjectBindingPattern1.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/sourceMapValidationDestructuringVariableStatementObjectBindingPattern1.js +sourceFile:sourceMapValidationDestructuringVariableStatementObjectBindingPattern1.ts +------------------------------------------------------------------- +>>>var x = { x: 20 }.x; +1 > +2 >^^^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >var { +2 >x +3 > } = { x: 20 }; +1 >Emitted(1, 1) Source(2, 6) + SourceIndex(0) +2 >Emitted(1, 20) Source(2, 7) + SourceIndex(0) +3 >Emitted(1, 21) Source(2, 21) + SourceIndex(0) +--- +>>>//# sourceMappingURL=sourceMapValidationDestructuringVariableStatementObjectBindingPattern1.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern1.symbols b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern1.symbols new file mode 100644 index 00000000000..950fca4eb00 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern1.symbols @@ -0,0 +1,6 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringVariableStatementObjectBindingPattern1.ts === + +var {x} = { x: 20 }; +>x : Symbol(x, Decl(sourceMapValidationDestructuringVariableStatementObjectBindingPattern1.ts, 1, 5)) +>x : Symbol(x, Decl(sourceMapValidationDestructuringVariableStatementObjectBindingPattern1.ts, 1, 11)) + diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern1.types b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern1.types new file mode 100644 index 00000000000..c975a9eaae5 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern1.types @@ -0,0 +1,8 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringVariableStatementObjectBindingPattern1.ts === + +var {x} = { x: 20 }; +>x : number +>{ x: 20 } : { x: number; } +>x : number +>20 : number + diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.js b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.js new file mode 100644 index 00000000000..d4d52e5e8d9 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.js @@ -0,0 +1,9 @@ +//// [sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.ts] + +var {x} = { x: 20 }; +var { a, b } = { a: 30, b: 40 }; + +//// [sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.js] +var x = { x: 20 }.x; +var _a = { a: 30, b: 40 }, a = _a.a, b = _a.b; +//# sourceMappingURL=sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.js.map b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.js.map new file mode 100644 index 00000000000..6d3a8b40d22 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.js.map @@ -0,0 +1,2 @@ +//// [sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.js.map] +{"version":3,"file":"sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.js","sourceRoot":"","sources":["sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.ts"],"names":[],"mappings":"AACK,mBAAC,CAAc;AACpB,IAAA,qBAA+B,EAAzB,QAAC,EAAE,QAAC,CAAsB"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.sourcemap.txt b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.sourcemap.txt new file mode 100644 index 00000000000..e9454cb2bfa --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.sourcemap.txt @@ -0,0 +1,52 @@ +=================================================================== +JsFile: sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.js +mapUrl: sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.js.map +sourceRoot: +sources: sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.js +sourceFile:sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.ts +------------------------------------------------------------------- +>>>var x = { x: 20 }.x; +1 > +2 >^^^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >var { +2 >x +3 > } = { x: 20 }; +1 >Emitted(1, 1) Source(2, 6) + SourceIndex(0) +2 >Emitted(1, 20) Source(2, 7) + SourceIndex(0) +3 >Emitted(1, 21) Source(2, 21) + SourceIndex(0) +--- +>>>var _a = { a: 30, b: 40 }, a = _a.a, b = _a.b; +1-> +2 >^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^ +4 > ^^ +5 > ^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^ +8 > ^ +9 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 > +3 > var { a, b } = { a: 30, b: 40 } +4 > +5 > a +6 > , +7 > b +8 > } = { a: 30, b: 40 }; +1->Emitted(2, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(3, 1) + SourceIndex(0) +3 >Emitted(2, 26) Source(3, 32) + SourceIndex(0) +4 >Emitted(2, 28) Source(3, 7) + SourceIndex(0) +5 >Emitted(2, 36) Source(3, 8) + SourceIndex(0) +6 >Emitted(2, 38) Source(3, 10) + SourceIndex(0) +7 >Emitted(2, 46) Source(3, 11) + SourceIndex(0) +8 >Emitted(2, 47) Source(3, 33) + SourceIndex(0) +--- +>>>//# sourceMappingURL=sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.symbols b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.symbols new file mode 100644 index 00000000000..4fa80ecf05e --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.symbols @@ -0,0 +1,12 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.ts === + +var {x} = { x: 20 }; +>x : Symbol(x, Decl(sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.ts, 1, 5)) +>x : Symbol(x, Decl(sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.ts, 1, 11)) + +var { a, b } = { a: 30, b: 40 }; +>a : Symbol(a, Decl(sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.ts, 2, 5)) +>b : Symbol(b, Decl(sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.ts, 2, 8)) +>a : Symbol(a, Decl(sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.ts, 2, 16)) +>b : Symbol(b, Decl(sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.ts, 2, 23)) + diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.types b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.types new file mode 100644 index 00000000000..a694d4ecd29 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.types @@ -0,0 +1,17 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.ts === + +var {x} = { x: 20 }; +>x : number +>{ x: 20 } : { x: number; } +>x : number +>20 : number + +var { a, b } = { a: 30, b: 40 }; +>a : number +>b : number +>{ a: 30, b: 40 } : { a: number; b: number; } +>a : number +>30 : number +>b : number +>40 : number + diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern3.js b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern3.js new file mode 100644 index 00000000000..f146e4bb8a7 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern3.js @@ -0,0 +1,7 @@ +//// [sourceMapValidationDestructuringVariableStatementObjectBindingPattern3.ts] + +var {x = 500} = { x: 20 }; + +//// [sourceMapValidationDestructuringVariableStatementObjectBindingPattern3.js] +var _a = { x: 20 }.x, x = _a === void 0 ? 500 : _a; +//# sourceMappingURL=sourceMapValidationDestructuringVariableStatementObjectBindingPattern3.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern3.js.map b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern3.js.map new file mode 100644 index 00000000000..975a48aa0ee --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern3.js.map @@ -0,0 +1,2 @@ +//// [sourceMapValidationDestructuringVariableStatementObjectBindingPattern3.js.map] +{"version":3,"file":"sourceMapValidationDestructuringVariableStatementObjectBindingPattern3.js","sourceRoot":"","sources":["sourceMapValidationDestructuringVariableStatementObjectBindingPattern3.ts"],"names":[],"mappings":"AACK,oBAAO,EAAP,4BAAO,CAAc"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern3.sourcemap.txt b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern3.sourcemap.txt new file mode 100644 index 00000000000..2fa0c81199b --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern3.sourcemap.txt @@ -0,0 +1,30 @@ +=================================================================== +JsFile: sourceMapValidationDestructuringVariableStatementObjectBindingPattern3.js +mapUrl: sourceMapValidationDestructuringVariableStatementObjectBindingPattern3.js.map +sourceRoot: +sources: sourceMapValidationDestructuringVariableStatementObjectBindingPattern3.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/sourceMapValidationDestructuringVariableStatementObjectBindingPattern3.js +sourceFile:sourceMapValidationDestructuringVariableStatementObjectBindingPattern3.ts +------------------------------------------------------------------- +>>>var _a = { x: 20 }.x, x = _a === void 0 ? 500 : _a; +1 > +2 >^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >var { +2 >x = 500 +3 > +4 > x = 500 +5 > } = { x: 20 }; +1 >Emitted(1, 1) Source(2, 6) + SourceIndex(0) +2 >Emitted(1, 21) Source(2, 13) + SourceIndex(0) +3 >Emitted(1, 23) Source(2, 6) + SourceIndex(0) +4 >Emitted(1, 51) Source(2, 13) + SourceIndex(0) +5 >Emitted(1, 52) Source(2, 27) + SourceIndex(0) +--- +>>>//# sourceMappingURL=sourceMapValidationDestructuringVariableStatementObjectBindingPattern3.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern3.symbols b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern3.symbols new file mode 100644 index 00000000000..a668ab8e733 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern3.symbols @@ -0,0 +1,6 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringVariableStatementObjectBindingPattern3.ts === + +var {x = 500} = { x: 20 }; +>x : Symbol(x, Decl(sourceMapValidationDestructuringVariableStatementObjectBindingPattern3.ts, 1, 5)) +>x : Symbol(x, Decl(sourceMapValidationDestructuringVariableStatementObjectBindingPattern3.ts, 1, 17)) + diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern3.types b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern3.types new file mode 100644 index 00000000000..bec1b195c98 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern3.types @@ -0,0 +1,9 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringVariableStatementObjectBindingPattern3.ts === + +var {x = 500} = { x: 20 }; +>x : number +>500 : number +>{ x: 20 } : { x?: number; } +>x : number +>20 : number + diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.js b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.js new file mode 100644 index 00000000000..d785d2dd1fd --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.js @@ -0,0 +1,8 @@ +//// [sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.ts] + +var {x = 500, + y} = { x: 20, y: "hi" }; + +//// [sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.js] +var _a = { x: 20, y: "hi" }, _b = _a.x, x = _b === void 0 ? 500 : _b, y = _a.y; +//# sourceMappingURL=sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.js.map b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.js.map new file mode 100644 index 00000000000..e0b108863b0 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.js.map @@ -0,0 +1,2 @@ +//// [sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.js.map] +{"version":3,"file":"sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.js","sourceRoot":"","sources":["sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.ts"],"names":[],"mappings":"AACA,IAAA,uBAC4B,EADvB,SAAO,EAAP,4BAAO,EACP,QAAC,CAAuB"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.sourcemap.txt b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.sourcemap.txt new file mode 100644 index 00000000000..6ae979f8ade --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.sourcemap.txt @@ -0,0 +1,47 @@ +=================================================================== +JsFile: sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.js +mapUrl: sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.js.map +sourceRoot: +sources: sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.js +sourceFile:sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.ts +------------------------------------------------------------------- +>>>var _a = { x: 20, y: "hi" }, _b = _a.x, x = _b === void 0 ? 500 : _b, y = _a.y; +1 > +2 >^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^ +4 > ^^ +5 > ^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^ +10> ^ +11> ^^^^^^^^^^^^^^^^^^-> +1 > + > +2 > +3 > var {x = 500, + > y} = { x: 20, y: "hi" } +4 > +5 > x = 500 +6 > +7 > x = 500 +8 > , + > +9 > y +10> } = { x: 20, y: "hi" }; +1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(1, 5) Source(2, 1) + SourceIndex(0) +3 >Emitted(1, 28) Source(3, 29) + SourceIndex(0) +4 >Emitted(1, 30) Source(2, 6) + SourceIndex(0) +5 >Emitted(1, 39) Source(2, 13) + SourceIndex(0) +6 >Emitted(1, 41) Source(2, 6) + SourceIndex(0) +7 >Emitted(1, 69) Source(2, 13) + SourceIndex(0) +8 >Emitted(1, 71) Source(3, 6) + SourceIndex(0) +9 >Emitted(1, 79) Source(3, 7) + SourceIndex(0) +10>Emitted(1, 80) Source(3, 30) + SourceIndex(0) +--- +>>>//# sourceMappingURL=sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.symbols b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.symbols new file mode 100644 index 00000000000..8404c342c0b --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.symbols @@ -0,0 +1,10 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.ts === + +var {x = 500, +>x : Symbol(x, Decl(sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.ts, 1, 5)) + + y} = { x: 20, y: "hi" }; +>y : Symbol(y, Decl(sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.ts, 1, 13)) +>x : Symbol(x, Decl(sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.ts, 2, 11)) +>y : Symbol(y, Decl(sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.ts, 2, 18)) + diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.types b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.types new file mode 100644 index 00000000000..1d00ac2d56b --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.types @@ -0,0 +1,14 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.ts === + +var {x = 500, +>x : number +>500 : number + + y} = { x: 20, y: "hi" }; +>y : string +>{ x: 20, y: "hi" } : { x?: number; y: string; } +>x : number +>20 : number +>y : string +>"hi" : string + diff --git a/tests/baselines/reference/sourceMapValidationExportAssignment.symbols b/tests/baselines/reference/sourceMapValidationExportAssignment.symbols index 2506d52fb87..57d619eb998 100644 --- a/tests/baselines/reference/sourceMapValidationExportAssignment.symbols +++ b/tests/baselines/reference/sourceMapValidationExportAssignment.symbols @@ -3,7 +3,7 @@ class a { >a : Symbol(a, Decl(sourceMapValidationExportAssignment.ts, 0, 0)) public c; ->c : Symbol(c, Decl(sourceMapValidationExportAssignment.ts, 0, 9)) +>c : Symbol(a.c, Decl(sourceMapValidationExportAssignment.ts, 0, 9)) } export = a; >a : Symbol(a, Decl(sourceMapValidationExportAssignment.ts, 0, 0)) diff --git a/tests/baselines/reference/sourceMapValidationExportAssignmentCommonjs.symbols b/tests/baselines/reference/sourceMapValidationExportAssignmentCommonjs.symbols index 91e2de7a2b9..72e435af089 100644 --- a/tests/baselines/reference/sourceMapValidationExportAssignmentCommonjs.symbols +++ b/tests/baselines/reference/sourceMapValidationExportAssignmentCommonjs.symbols @@ -3,7 +3,7 @@ class a { >a : Symbol(a, Decl(sourceMapValidationExportAssignmentCommonjs.ts, 0, 0)) public c; ->c : Symbol(c, Decl(sourceMapValidationExportAssignmentCommonjs.ts, 0, 9)) +>c : Symbol(a.c, Decl(sourceMapValidationExportAssignmentCommonjs.ts, 0, 9)) } export = a; >a : Symbol(a, Decl(sourceMapValidationExportAssignmentCommonjs.ts, 0, 0)) diff --git a/tests/baselines/reference/sourceMapValidationFor.js.map b/tests/baselines/reference/sourceMapValidationFor.js.map index 15d038297c7..5d6491ae1e5 100644 --- a/tests/baselines/reference/sourceMapValidationFor.js.map +++ b/tests/baselines/reference/sourceMapValidationFor.js.map @@ -1,2 +1,2 @@ //// [sourceMapValidationFor.js.map] -{"version":3,"file":"sourceMapValidationFor.js","sourceRoot":"","sources":["sourceMapValidationFor.ts"],"names":[],"mappings":"AAAA,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC;IAC1B,OAAO,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;AAC5B,CAAC;AACD,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,EACvB,CAAC;IACG,OAAO,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;AAC5B,CAAC;AACD,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,GAAI,CAAC;IACvB,CAAC,EAAE,CAAC;IACJ,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACT,QAAQ,CAAC;IACb,CAAC;AACL,CAAC;AACD,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,GAClB,CAAC;IACG,CAAC,EAAE,CAAC;AACR,CAAC;AACD,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;AACvB,CAAC;AACD,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,EAChB,CAAC;AACD,CAAC;AACD,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC;AACrB,CAAC;AACD,GAAG,CAAC,CAAC,IAAI,CAAC;IACN,CAAC,EAAE,CAAC;AACR,CAAC;AACD,GAAG,CAAC,CAAC,IACL,CAAC;IACG,CAAC,EAAE,CAAC;AACR,CAAC;AACD,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC;AAC1C,CAAC"} \ No newline at end of file +{"version":3,"file":"sourceMapValidationFor.js","sourceRoot":"","sources":["sourceMapValidationFor.ts"],"names":[],"mappings":"AAAA,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC;IAC1B,OAAO,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;AAC5B,CAAC;AACD,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,EACvB,CAAC;IACG,OAAO,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;AAC5B,CAAC;AACD,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,GAAI,CAAC;IACvB,CAAC,EAAE,CAAC;IACJ,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACT,QAAQ,CAAC;IACb,CAAC;AACL,CAAC;AACD,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,GAClB,CAAC;IACG,CAAC,EAAE,CAAC;AACR,CAAC;AACD,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;AACvB,CAAC;AACD,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,EAChB,CAAC;AACD,CAAC;AACD,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC;AACrB,CAAC;AACD,GAAG,CAAC,CAAC,IAAI,CAAC;IACN,CAAC,EAAE,CAAC;AACR,CAAC;AACD,GAAG,CAAC,CAAC,IACL,CAAC;IACG,CAAC,EAAE,CAAC;AACR,CAAC;AACD,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC;AAC1C,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationFor.sourcemap.txt b/tests/baselines/reference/sourceMapValidationFor.sourcemap.txt index 609f9548a6b..583e60d75cf 100644 --- a/tests/baselines/reference/sourceMapValidationFor.sourcemap.txt +++ b/tests/baselines/reference/sourceMapValidationFor.sourcemap.txt @@ -13,56 +13,53 @@ sourceFile:sourceMapValidationFor.ts 2 >^^^ 3 > ^ 4 > ^ -5 > ^^^ -6 > ^ -7 > ^ -8 > ^^^ -9 > ^ -10> ^^ -11> ^ -12> ^^^ -13> ^^ -14> ^^ -15> ^ -16> ^^ -17> ^^ -18> ^ +5 > ^^^^ +6 > ^ +7 > ^^^ +8 > ^ +9 > ^^ +10> ^ +11> ^^^ +12> ^^ +13> ^^ +14> ^ +15> ^^ +16> ^^ +17> ^ 1 > 2 >for 3 > 4 > ( -5 > var -6 > -7 > i -8 > = -9 > 0 -10> ; -11> i -12> < -13> 10 -14> ; -15> i -16> ++ -17> ) -18> { +5 > var +6 > i +7 > = +8 > 0 +9 > ; +10> i +11> < +12> 10 +13> ; +14> i +15> ++ +16> ) +17> { 1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) 2 >Emitted(1, 4) Source(1, 4) + SourceIndex(0) 3 >Emitted(1, 5) Source(1, 5) + SourceIndex(0) 4 >Emitted(1, 6) Source(1, 6) + SourceIndex(0) -5 >Emitted(1, 9) Source(1, 9) + SourceIndex(0) -6 >Emitted(1, 10) Source(1, 10) + SourceIndex(0) -7 >Emitted(1, 11) Source(1, 11) + SourceIndex(0) -8 >Emitted(1, 14) Source(1, 14) + SourceIndex(0) -9 >Emitted(1, 15) Source(1, 15) + SourceIndex(0) -10>Emitted(1, 17) Source(1, 17) + SourceIndex(0) -11>Emitted(1, 18) Source(1, 18) + SourceIndex(0) -12>Emitted(1, 21) Source(1, 21) + SourceIndex(0) -13>Emitted(1, 23) Source(1, 23) + SourceIndex(0) -14>Emitted(1, 25) Source(1, 25) + SourceIndex(0) -15>Emitted(1, 26) Source(1, 26) + SourceIndex(0) -16>Emitted(1, 28) Source(1, 28) + SourceIndex(0) -17>Emitted(1, 30) Source(1, 30) + SourceIndex(0) -18>Emitted(1, 31) Source(1, 31) + SourceIndex(0) +5 >Emitted(1, 10) Source(1, 10) + SourceIndex(0) +6 >Emitted(1, 11) Source(1, 11) + SourceIndex(0) +7 >Emitted(1, 14) Source(1, 14) + SourceIndex(0) +8 >Emitted(1, 15) Source(1, 15) + SourceIndex(0) +9 >Emitted(1, 17) Source(1, 17) + SourceIndex(0) +10>Emitted(1, 18) Source(1, 18) + SourceIndex(0) +11>Emitted(1, 21) Source(1, 21) + SourceIndex(0) +12>Emitted(1, 23) Source(1, 23) + SourceIndex(0) +13>Emitted(1, 25) Source(1, 25) + SourceIndex(0) +14>Emitted(1, 26) Source(1, 26) + SourceIndex(0) +15>Emitted(1, 28) Source(1, 28) + SourceIndex(0) +16>Emitted(1, 30) Source(1, 30) + SourceIndex(0) +17>Emitted(1, 31) Source(1, 31) + SourceIndex(0) --- >>> WScript.Echo("i: " + i); 1 >^^^^ @@ -208,48 +205,45 @@ sourceFile:sourceMapValidationFor.ts 2 >^^^ 3 > ^ 4 > ^ -5 > ^^^ -6 > ^ -7 > ^ -8 > ^^^ -9 > ^ -10> ^^ -11> ^ -12> ^^^ -13> ^^ -14> ^^^ -15> ^ +5 > ^^^^ +6 > ^ +7 > ^^^ +8 > ^ +9 > ^^ +10> ^ +11> ^^^ +12> ^^ +13> ^^^ +14> ^ 1-> > 2 >for 3 > 4 > ( -5 > var -6 > -7 > j -8 > = -9 > 0 -10> ; -11> j -12> < -13> 10 -14> ; ) -15> { +5 > var +6 > j +7 > = +8 > 0 +9 > ; +10> j +11> < +12> 10 +13> ; ) +14> { 1->Emitted(7, 1) Source(8, 1) + SourceIndex(0) 2 >Emitted(7, 4) Source(8, 4) + SourceIndex(0) 3 >Emitted(7, 5) Source(8, 5) + SourceIndex(0) 4 >Emitted(7, 6) Source(8, 6) + SourceIndex(0) -5 >Emitted(7, 9) Source(8, 9) + SourceIndex(0) -6 >Emitted(7, 10) Source(8, 10) + SourceIndex(0) -7 >Emitted(7, 11) Source(8, 11) + SourceIndex(0) -8 >Emitted(7, 14) Source(8, 14) + SourceIndex(0) -9 >Emitted(7, 15) Source(8, 15) + SourceIndex(0) -10>Emitted(7, 17) Source(8, 17) + SourceIndex(0) -11>Emitted(7, 18) Source(8, 18) + SourceIndex(0) -12>Emitted(7, 21) Source(8, 21) + SourceIndex(0) -13>Emitted(7, 23) Source(8, 23) + SourceIndex(0) -14>Emitted(7, 26) Source(8, 27) + SourceIndex(0) -15>Emitted(7, 27) Source(8, 28) + SourceIndex(0) +5 >Emitted(7, 10) Source(8, 10) + SourceIndex(0) +6 >Emitted(7, 11) Source(8, 11) + SourceIndex(0) +7 >Emitted(7, 14) Source(8, 14) + SourceIndex(0) +8 >Emitted(7, 15) Source(8, 15) + SourceIndex(0) +9 >Emitted(7, 17) Source(8, 17) + SourceIndex(0) +10>Emitted(7, 18) Source(8, 18) + SourceIndex(0) +11>Emitted(7, 21) Source(8, 21) + SourceIndex(0) +12>Emitted(7, 23) Source(8, 23) + SourceIndex(0) +13>Emitted(7, 26) Source(8, 27) + SourceIndex(0) +14>Emitted(7, 27) Source(8, 28) + SourceIndex(0) --- >>> j++; 1 >^^^^ @@ -405,45 +399,42 @@ sourceFile:sourceMapValidationFor.ts 2 >^^^ 3 > ^ 4 > ^ -5 > ^^^ -6 > ^ -7 > ^ -8 > ^^^ -9 > ^ -10> ^^^ -11> ^ -12> ^^ -13> ^^ -14> ^ +5 > ^^^^ +6 > ^ +7 > ^^^ +8 > ^ +9 > ^^^ +10> ^ +11> ^^ +12> ^^ +13> ^ 1-> > 2 >for 3 > 4 > ( -5 > var -6 > -7 > k -8 > = -9 > 0 -10> ;; -11> k -12> ++ -13> ) -14> { +5 > var +6 > k +7 > = +8 > 0 +9 > ;; +10> k +11> ++ +12> ) +13> { 1->Emitted(16, 1) Source(18, 1) + SourceIndex(0) 2 >Emitted(16, 4) Source(18, 4) + SourceIndex(0) 3 >Emitted(16, 5) Source(18, 5) + SourceIndex(0) 4 >Emitted(16, 6) Source(18, 6) + SourceIndex(0) -5 >Emitted(16, 9) Source(18, 9) + SourceIndex(0) -6 >Emitted(16, 10) Source(18, 10) + SourceIndex(0) -7 >Emitted(16, 11) Source(18, 11) + SourceIndex(0) -8 >Emitted(16, 14) Source(18, 14) + SourceIndex(0) -9 >Emitted(16, 15) Source(18, 15) + SourceIndex(0) -10>Emitted(16, 18) Source(18, 18) + SourceIndex(0) -11>Emitted(16, 19) Source(18, 19) + SourceIndex(0) -12>Emitted(16, 21) Source(18, 21) + SourceIndex(0) -13>Emitted(16, 23) Source(18, 23) + SourceIndex(0) -14>Emitted(16, 24) Source(18, 24) + SourceIndex(0) +5 >Emitted(16, 10) Source(18, 10) + SourceIndex(0) +6 >Emitted(16, 11) Source(18, 11) + SourceIndex(0) +7 >Emitted(16, 14) Source(18, 14) + SourceIndex(0) +8 >Emitted(16, 15) Source(18, 15) + SourceIndex(0) +9 >Emitted(16, 18) Source(18, 18) + SourceIndex(0) +10>Emitted(16, 19) Source(18, 19) + SourceIndex(0) +11>Emitted(16, 21) Source(18, 21) + SourceIndex(0) +12>Emitted(16, 23) Source(18, 23) + SourceIndex(0) +13>Emitted(16, 24) Source(18, 24) + SourceIndex(0) --- >>>} 1 > diff --git a/tests/baselines/reference/sourceMapValidationForIn.js.map b/tests/baselines/reference/sourceMapValidationForIn.js.map index 2c12dd5cdc1..2281e36f605 100644 --- a/tests/baselines/reference/sourceMapValidationForIn.js.map +++ b/tests/baselines/reference/sourceMapValidationForIn.js.map @@ -1,2 +1,2 @@ //// [sourceMapValidationForIn.js.map] -{"version":3,"file":"sourceMapValidationForIn.js","sourceRoot":"","sources":["sourceMapValidationForIn.ts"],"names":[],"mappings":"AAAA,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC;IACnB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACpB,CAAC;AACD,GAAG,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC;IACf,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACpB,CAAC;AACD,GAAG,CAAC,CAAC,GAAG,CAAC,EAAE,IAAI,MAAM,CAAC,CACtB,CAAC;IACG,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACrB,CAAC;AACD,GAAG,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,CACjB,CAAC;IACG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACpB,CAAC"} \ No newline at end of file +{"version":3,"file":"sourceMapValidationForIn.js","sourceRoot":"","sources":["sourceMapValidationForIn.ts"],"names":[],"mappings":"AAAA,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC;IACnB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACpB,CAAC;AACD,GAAG,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC;IACf,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACpB,CAAC;AACD,GAAG,CAAC,CAAC,IAAI,EAAE,IAAI,MAAM,CAAC,CACtB,CAAC;IACG,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACrB,CAAC;AACD,GAAG,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,CACjB,CAAC;IACG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACpB,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationForIn.sourcemap.txt b/tests/baselines/reference/sourceMapValidationForIn.sourcemap.txt index ae7e34c025c..e84bb2323c4 100644 --- a/tests/baselines/reference/sourceMapValidationForIn.sourcemap.txt +++ b/tests/baselines/reference/sourceMapValidationForIn.sourcemap.txt @@ -13,38 +13,35 @@ sourceFile:sourceMapValidationForIn.ts 2 >^^^ 3 > ^ 4 > ^ -5 > ^^^ -6 > ^ -7 > ^ -8 > ^^^^ -9 > ^^^^^^ -10> ^ -11> ^ -12> ^ +5 > ^^^^ +6 > ^ +7 > ^^^^ +8 > ^^^^^^ +9 > ^ +10> ^ +11> ^ 1 > 2 >for 3 > 4 > ( -5 > var -6 > -7 > x -8 > in -9 > String -10> ) -11> -12> { +5 > var +6 > x +7 > in +8 > String +9 > ) +10> +11> { 1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) 2 >Emitted(1, 4) Source(1, 4) + SourceIndex(0) 3 >Emitted(1, 5) Source(1, 5) + SourceIndex(0) 4 >Emitted(1, 6) Source(1, 6) + SourceIndex(0) -5 >Emitted(1, 9) Source(1, 9) + SourceIndex(0) -6 >Emitted(1, 10) Source(1, 10) + SourceIndex(0) -7 >Emitted(1, 11) Source(1, 11) + SourceIndex(0) -8 >Emitted(1, 15) Source(1, 15) + SourceIndex(0) -9 >Emitted(1, 21) Source(1, 21) + SourceIndex(0) -10>Emitted(1, 22) Source(1, 22) + SourceIndex(0) -11>Emitted(1, 23) Source(1, 23) + SourceIndex(0) -12>Emitted(1, 24) Source(1, 24) + SourceIndex(0) +5 >Emitted(1, 10) Source(1, 10) + SourceIndex(0) +6 >Emitted(1, 11) Source(1, 11) + SourceIndex(0) +7 >Emitted(1, 15) Source(1, 15) + SourceIndex(0) +8 >Emitted(1, 21) Source(1, 21) + SourceIndex(0) +9 >Emitted(1, 22) Source(1, 22) + SourceIndex(0) +10>Emitted(1, 23) Source(1, 23) + SourceIndex(0) +11>Emitted(1, 24) Source(1, 24) + SourceIndex(0) --- >>> WScript.Echo(x); 1 >^^^^ @@ -159,40 +156,37 @@ sourceFile:sourceMapValidationForIn.ts 2 >^^^ 3 > ^ 4 > ^ -5 > ^^^ -6 > ^ -7 > ^^ -8 > ^^^^ -9 > ^^^^^^ -10> ^ -11> ^ -12> ^ +5 > ^^^^ +6 > ^^ +7 > ^^^^ +8 > ^^^^^^ +9 > ^ +10> ^ +11> ^ 1-> > 2 >for 3 > 4 > ( -5 > var -6 > -7 > x2 -8 > in -9 > String -10> ) -11> +5 > var +6 > x2 +7 > in +8 > String +9 > ) +10> > -12> { +11> { 1->Emitted(7, 1) Source(7, 1) + SourceIndex(0) 2 >Emitted(7, 4) Source(7, 4) + SourceIndex(0) 3 >Emitted(7, 5) Source(7, 5) + SourceIndex(0) 4 >Emitted(7, 6) Source(7, 6) + SourceIndex(0) -5 >Emitted(7, 9) Source(7, 9) + SourceIndex(0) -6 >Emitted(7, 10) Source(7, 10) + SourceIndex(0) -7 >Emitted(7, 12) Source(7, 12) + SourceIndex(0) -8 >Emitted(7, 16) Source(7, 16) + SourceIndex(0) -9 >Emitted(7, 22) Source(7, 22) + SourceIndex(0) -10>Emitted(7, 23) Source(7, 23) + SourceIndex(0) -11>Emitted(7, 24) Source(8, 1) + SourceIndex(0) -12>Emitted(7, 25) Source(8, 2) + SourceIndex(0) +5 >Emitted(7, 10) Source(7, 10) + SourceIndex(0) +6 >Emitted(7, 12) Source(7, 12) + SourceIndex(0) +7 >Emitted(7, 16) Source(7, 16) + SourceIndex(0) +8 >Emitted(7, 22) Source(7, 22) + SourceIndex(0) +9 >Emitted(7, 23) Source(7, 23) + SourceIndex(0) +10>Emitted(7, 24) Source(8, 1) + SourceIndex(0) +11>Emitted(7, 25) Source(8, 2) + SourceIndex(0) --- >>> WScript.Echo(x2); 1 >^^^^ diff --git a/tests/baselines/reference/sourceMapValidationStatements.js.map b/tests/baselines/reference/sourceMapValidationStatements.js.map index b4b5c48fc22..464ab4dc002 100644 --- a/tests/baselines/reference/sourceMapValidationStatements.js.map +++ b/tests/baselines/reference/sourceMapValidationStatements.js.map @@ -1,2 +1,2 @@ //// [sourceMapValidationStatements.js.map] -{"version":3,"file":"sourceMapValidationStatements.js","sourceRoot":"","sources":["sourceMapValidationStatements.ts"],"names":[],"mappings":"AAAA;IACI,IAAI,CAAC,CAAC;IACN,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC;QAC1B,CAAC,IAAI,CAAC,CAAC;QACP,CAAC,IAAI,CAAC,CAAC;IACX,CAAC;IACD,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;QACT,CAAC,IAAI,CAAC,CAAC;IACX,CAAC;IAAC,IAAI,CAAC,CAAC;QACJ,CAAC,IAAI,EAAE,CAAC;QACR,CAAC,EAAE,CAAC;IACR,CAAC;IACD,IAAI,CAAC,GAAG;QACJ,CAAC;QACD,CAAC;QACD,CAAC;KACJ,CAAC;IACF,IAAI,GAAG,GAAG;QACN,CAAC,EAAE,CAAC;QACJ,CAAC,EAAE,OAAO;KACb,CAAC;IACF,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACd,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QACb,IAAI,CAAC,GAAG,EAAE,CAAC;IACf,CAAC;IACD,IAAI,CAAC;QACD,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC;IACnB,CAAE;IAAA,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACT,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;YACb,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC;QACf,CAAC;QAAC,IAAI,CAAC,CAAC;YACJ,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC;QAClB,CAAC;IACL,CAAC;IACD,IAAI,CAAC;QACD,MAAM,IAAI,KAAK,EAAE,CAAC;IACtB,CAAE;IAAA,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QACV,IAAI,CAAC,GAAG,EAAE,CAAC;IACf,CAAC;YAAS,CAAC;QACP,CAAC,GAAG,EAAE,CAAC;IACX,CAAC;IACD,MAAM,GAAG,EAAE,CAAC;QACR,CAAC,GAAG,CAAC,CAAC;QACN,CAAC,GAAG,EAAE,CAAC;IACX,CAAC;IACD,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QACZ,KAAK,CAAC,EAAE,CAAC;YACL,CAAC,EAAE,CAAC;YACJ,KAAK,CAAC;QAEV,CAAC;QACD,KAAK,CAAC,EAAE,CAAC;YACL,CAAC,EAAE,CAAC;YACJ,KAAK,CAAC;QAEV,CAAC;QACD,SAAS,CAAC;YACN,CAAC,IAAI,CAAC,CAAC;YACP,CAAC,GAAG,EAAE,CAAC;YACP,KAAK,CAAC;QAEV,CAAC;IACL,CAAC;IACD,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC;QACZ,CAAC,EAAE,CAAC;IACR,CAAC;IACD,GAAG,CAAC;QACA,CAAC,EAAE,CAAC;IACR,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAC;IACf,CAAC,GAAG,CAAC,CAAC;IACN,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACjC,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACzB,CAAC,KAAK,CAAC,CAAC;IACR,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC;IACX,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,MAAM,CAAC;AACX,CAAC;AACD,IAAI,CAAC,GAAG;IACJ,IAAI,CAAC,GAAG,EAAE,CAAC;IACX,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACd,CAAC,CAAC;AACF,CAAC,EAAE,CAAC"} \ No newline at end of file +{"version":3,"file":"sourceMapValidationStatements.js","sourceRoot":"","sources":["sourceMapValidationStatements.ts"],"names":[],"mappings":"AAAA;IACI,IAAI,CAAC,CAAC;IACN,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC;QAC1B,CAAC,IAAI,CAAC,CAAC;QACP,CAAC,IAAI,CAAC,CAAC;IACX,CAAC;IACD,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;QACT,CAAC,IAAI,CAAC,CAAC;IACX,CAAC;IAAC,IAAI,CAAC,CAAC;QACJ,CAAC,IAAI,EAAE,CAAC;QACR,CAAC,EAAE,CAAC;IACR,CAAC;IACD,IAAI,CAAC,GAAG;QACJ,CAAC;QACD,CAAC;QACD,CAAC;KACJ,CAAC;IACF,IAAI,GAAG,GAAG;QACN,CAAC,EAAE,CAAC;QACJ,CAAC,EAAE,OAAO;KACb,CAAC;IACF,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACd,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QACb,IAAI,CAAC,GAAG,EAAE,CAAC;IACf,CAAC;IACD,IAAI,CAAC;QACD,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC;IACnB,CAAE;IAAA,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACT,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;YACb,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC;QACf,CAAC;QAAC,IAAI,CAAC,CAAC;YACJ,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC;QAClB,CAAC;IACL,CAAC;IACD,IAAI,CAAC;QACD,MAAM,IAAI,KAAK,EAAE,CAAC;IACtB,CAAE;IAAA,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QACV,IAAI,CAAC,GAAG,EAAE,CAAC;IACf,CAAC;YAAS,CAAC;QACP,CAAC,GAAG,EAAE,CAAC;IACX,CAAC;IACD,MAAM,GAAG,EAAE,CAAC;QACR,CAAC,GAAG,CAAC,CAAC;QACN,CAAC,GAAG,EAAE,CAAC;IACX,CAAC;IACD,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QACZ,KAAK,CAAC,EAAE,CAAC;YACL,CAAC,EAAE,CAAC;YACJ,KAAK,CAAC;QAEV,CAAC;QACD,KAAK,CAAC,EAAE,CAAC;YACL,CAAC,EAAE,CAAC;YACJ,KAAK,CAAC;QAEV,CAAC;QACD,SAAS,CAAC;YACN,CAAC,IAAI,CAAC,CAAC;YACP,CAAC,GAAG,EAAE,CAAC;YACP,KAAK,CAAC;QAEV,CAAC;IACL,CAAC;IACD,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC;QACZ,CAAC,EAAE,CAAC;IACR,CAAC;IACD,GAAG,CAAC;QACA,CAAC,EAAE,CAAC;IACR,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAC;IACf,CAAC,GAAG,CAAC,CAAC;IACN,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACjC,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACzB,CAAC,KAAK,CAAC,CAAC;IACR,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC;IACX,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,MAAM,CAAC;AACX,CAAC;AACD,IAAI,CAAC,GAAG;IACJ,IAAI,CAAC,GAAG,EAAE,CAAC;IACX,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACd,CAAC,CAAC;AACF,CAAC,EAAE,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationStatements.sourcemap.txt b/tests/baselines/reference/sourceMapValidationStatements.sourcemap.txt index 41212b9b3db..ed7c9395d2f 100644 --- a/tests/baselines/reference/sourceMapValidationStatements.sourcemap.txt +++ b/tests/baselines/reference/sourceMapValidationStatements.sourcemap.txt @@ -57,57 +57,54 @@ sourceFile:sourceMapValidationStatements.ts 2 > ^^^ 3 > ^ 4 > ^ -5 > ^^^ -6 > ^ -7 > ^ -8 > ^^^ -9 > ^ -10> ^^ -11> ^ -12> ^^^ -13> ^^ -14> ^^ -15> ^ -16> ^^ -17> ^^ -18> ^ +5 > ^^^^ +6 > ^ +7 > ^^^ +8 > ^ +9 > ^^ +10> ^ +11> ^^^ +12> ^^ +13> ^^ +14> ^ +15> ^^ +16> ^^ +17> ^ 1-> > 2 > for 3 > 4 > ( -5 > var -6 > -7 > i -8 > = -9 > 0 -10> ; -11> i -12> < -13> 10 -14> ; -15> i -16> ++ -17> ) -18> { +5 > var +6 > i +7 > = +8 > 0 +9 > ; +10> i +11> < +12> 10 +13> ; +14> i +15> ++ +16> ) +17> { 1->Emitted(4, 5) Source(4, 5) + SourceIndex(0) 2 >Emitted(4, 8) Source(4, 8) + SourceIndex(0) 3 >Emitted(4, 9) Source(4, 9) + SourceIndex(0) 4 >Emitted(4, 10) Source(4, 10) + SourceIndex(0) -5 >Emitted(4, 13) Source(4, 13) + SourceIndex(0) -6 >Emitted(4, 14) Source(4, 14) + SourceIndex(0) -7 >Emitted(4, 15) Source(4, 15) + SourceIndex(0) -8 >Emitted(4, 18) Source(4, 18) + SourceIndex(0) -9 >Emitted(4, 19) Source(4, 19) + SourceIndex(0) -10>Emitted(4, 21) Source(4, 21) + SourceIndex(0) -11>Emitted(4, 22) Source(4, 22) + SourceIndex(0) -12>Emitted(4, 25) Source(4, 25) + SourceIndex(0) -13>Emitted(4, 27) Source(4, 27) + SourceIndex(0) -14>Emitted(4, 29) Source(4, 29) + SourceIndex(0) -15>Emitted(4, 30) Source(4, 30) + SourceIndex(0) -16>Emitted(4, 32) Source(4, 32) + SourceIndex(0) -17>Emitted(4, 34) Source(4, 34) + SourceIndex(0) -18>Emitted(4, 35) Source(4, 35) + SourceIndex(0) +5 >Emitted(4, 14) Source(4, 14) + SourceIndex(0) +6 >Emitted(4, 15) Source(4, 15) + SourceIndex(0) +7 >Emitted(4, 18) Source(4, 18) + SourceIndex(0) +8 >Emitted(4, 19) Source(4, 19) + SourceIndex(0) +9 >Emitted(4, 21) Source(4, 21) + SourceIndex(0) +10>Emitted(4, 22) Source(4, 22) + SourceIndex(0) +11>Emitted(4, 25) Source(4, 25) + SourceIndex(0) +12>Emitted(4, 27) Source(4, 27) + SourceIndex(0) +13>Emitted(4, 29) Source(4, 29) + SourceIndex(0) +14>Emitted(4, 30) Source(4, 30) + SourceIndex(0) +15>Emitted(4, 32) Source(4, 32) + SourceIndex(0) +16>Emitted(4, 34) Source(4, 34) + SourceIndex(0) +17>Emitted(4, 35) Source(4, 35) + SourceIndex(0) --- >>> x += i; 1 >^^^^^^^^ @@ -390,39 +387,36 @@ sourceFile:sourceMapValidationStatements.ts 2 > ^^^ 3 > ^ 4 > ^ -5 > ^^^ -6 > ^ -7 > ^ -8 > ^^^^ -9 > ^ -10> ^ -11> ^ -12> ^ +5 > ^^^^ +6 > ^ +7 > ^^^^ +8 > ^ +9 > ^ +10> ^ +11> ^ 1-> > 2 > for 3 > 4 > ( -5 > var -6 > -7 > j -8 > in -9 > a -10> ) -11> -12> { +5 > var +6 > j +7 > in +8 > a +9 > ) +10> +11> { 1->Emitted(24, 5) Source(23, 5) + SourceIndex(0) 2 >Emitted(24, 8) Source(23, 8) + SourceIndex(0) 3 >Emitted(24, 9) Source(23, 9) + SourceIndex(0) 4 >Emitted(24, 10) Source(23, 10) + SourceIndex(0) -5 >Emitted(24, 13) Source(23, 13) + SourceIndex(0) -6 >Emitted(24, 14) Source(23, 14) + SourceIndex(0) -7 >Emitted(24, 15) Source(23, 15) + SourceIndex(0) -8 >Emitted(24, 19) Source(23, 19) + SourceIndex(0) -9 >Emitted(24, 20) Source(23, 20) + SourceIndex(0) -10>Emitted(24, 21) Source(23, 21) + SourceIndex(0) -11>Emitted(24, 22) Source(23, 22) + SourceIndex(0) -12>Emitted(24, 23) Source(23, 23) + SourceIndex(0) +5 >Emitted(24, 14) Source(23, 14) + SourceIndex(0) +6 >Emitted(24, 15) Source(23, 15) + SourceIndex(0) +7 >Emitted(24, 19) Source(23, 19) + SourceIndex(0) +8 >Emitted(24, 20) Source(23, 20) + SourceIndex(0) +9 >Emitted(24, 21) Source(23, 21) + SourceIndex(0) +10>Emitted(24, 22) Source(23, 22) + SourceIndex(0) +11>Emitted(24, 23) Source(23, 23) + SourceIndex(0) --- >>> obj.z = a[j]; 1 >^^^^^^^^ diff --git a/tests/baselines/reference/sourceMapWithMultipleFilesWithFileEndingWithInterface.symbols b/tests/baselines/reference/sourceMapWithMultipleFilesWithFileEndingWithInterface.symbols index 4f48bb97347..f262fb43781 100644 --- a/tests/baselines/reference/sourceMapWithMultipleFilesWithFileEndingWithInterface.symbols +++ b/tests/baselines/reference/sourceMapWithMultipleFilesWithFileEndingWithInterface.symbols @@ -9,19 +9,19 @@ interface Navigator { >Navigator : Symbol(Navigator, Decl(a.ts, 2, 1)) getGamepads(func?: any): any; ->getGamepads : Symbol(getGamepads, Decl(a.ts, 3, 21)) +>getGamepads : Symbol(Navigator.getGamepads, Decl(a.ts, 3, 21)) >func : Symbol(func, Decl(a.ts, 4, 16)) webkitGetGamepads(func?: any): any ->webkitGetGamepads : Symbol(webkitGetGamepads, Decl(a.ts, 4, 33)) +>webkitGetGamepads : Symbol(Navigator.webkitGetGamepads, Decl(a.ts, 4, 33)) >func : Symbol(func, Decl(a.ts, 5, 22)) msGetGamepads(func?: any): any; ->msGetGamepads : Symbol(msGetGamepads, Decl(a.ts, 5, 38)) +>msGetGamepads : Symbol(Navigator.msGetGamepads, Decl(a.ts, 5, 38)) >func : Symbol(func, Decl(a.ts, 6, 18)) webkitGamepads(func?: any): any; ->webkitGamepads : Symbol(webkitGamepads, Decl(a.ts, 6, 35)) +>webkitGamepads : Symbol(Navigator.webkitGamepads, Decl(a.ts, 6, 35)) >func : Symbol(func, Decl(a.ts, 7, 19)) } diff --git a/tests/baselines/reference/specializationError.symbols b/tests/baselines/reference/specializationError.symbols index 906cfee1e65..b866a7034df 100644 --- a/tests/baselines/reference/specializationError.symbols +++ b/tests/baselines/reference/specializationError.symbols @@ -4,7 +4,7 @@ interface Promise { >T : Symbol(T, Decl(specializationError.ts, 0, 18)) then(value: T): void; ->then : Symbol(then, Decl(specializationError.ts, 0, 22)) +>then : Symbol(Promise.then, Decl(specializationError.ts, 0, 22)) >U : Symbol(U, Decl(specializationError.ts, 1, 9)) >value : Symbol(value, Decl(specializationError.ts, 1, 12)) >T : Symbol(T, Decl(specializationError.ts, 0, 18)) @@ -14,12 +14,12 @@ interface Bar { >Bar : Symbol(Bar, Decl(specializationError.ts, 2, 1)) bar(value: "Menu"): Promise; ->bar : Symbol(bar, Decl(specializationError.ts, 4, 15), Decl(specializationError.ts, 5, 40), Decl(specializationError.ts, 6, 55)) +>bar : Symbol(Bar.bar, Decl(specializationError.ts, 4, 15), Decl(specializationError.ts, 5, 40), Decl(specializationError.ts, 6, 55)) >value : Symbol(value, Decl(specializationError.ts, 5, 8)) >Promise : Symbol(Promise, Decl(specializationError.ts, 0, 0)) bar(value: string, element: string): Promise; ->bar : Symbol(bar, Decl(specializationError.ts, 4, 15), Decl(specializationError.ts, 5, 40), Decl(specializationError.ts, 6, 55)) +>bar : Symbol(Bar.bar, Decl(specializationError.ts, 4, 15), Decl(specializationError.ts, 5, 40), Decl(specializationError.ts, 6, 55)) >T : Symbol(T, Decl(specializationError.ts, 6, 8)) >value : Symbol(value, Decl(specializationError.ts, 6, 11)) >element : Symbol(element, Decl(specializationError.ts, 6, 25)) @@ -27,7 +27,7 @@ interface Bar { >T : Symbol(T, Decl(specializationError.ts, 6, 8)) bar(value: string): Promise; ->bar : Symbol(bar, Decl(specializationError.ts, 4, 15), Decl(specializationError.ts, 5, 40), Decl(specializationError.ts, 6, 55)) +>bar : Symbol(Bar.bar, Decl(specializationError.ts, 4, 15), Decl(specializationError.ts, 5, 40), Decl(specializationError.ts, 6, 55)) >T : Symbol(T, Decl(specializationError.ts, 7, 8)) >value : Symbol(value, Decl(specializationError.ts, 7, 11)) >Promise : Symbol(Promise, Decl(specializationError.ts, 0, 0)) diff --git a/tests/baselines/reference/specializationsShouldNotAffectEachOther.symbols b/tests/baselines/reference/specializationsShouldNotAffectEachOther.symbols index 9114afccdf4..5c93a74fe51 100644 --- a/tests/baselines/reference/specializationsShouldNotAffectEachOther.symbols +++ b/tests/baselines/reference/specializationsShouldNotAffectEachOther.symbols @@ -4,7 +4,7 @@ interface Series { >Series : Symbol(Series, Decl(specializationsShouldNotAffectEachOther.ts, 0, 0)) data: string[]; ->data : Symbol(data, Decl(specializationsShouldNotAffectEachOther.ts, 1, 19)) +>data : Symbol(Series.data, Decl(specializationsShouldNotAffectEachOther.ts, 1, 19)) } var series: Series; diff --git a/tests/baselines/reference/specializeVarArgs1.symbols b/tests/baselines/reference/specializeVarArgs1.symbols index 836e3613f07..8ac5369ce91 100644 --- a/tests/baselines/reference/specializeVarArgs1.symbols +++ b/tests/baselines/reference/specializeVarArgs1.symbols @@ -14,7 +14,7 @@ interface ObservableArray extends Observable { push(...values: T[]); ->push : Symbol(push, Decl(specializeVarArgs1.ts, 6, 1)) +>push : Symbol(ObservableArray.push, Decl(specializeVarArgs1.ts, 6, 1)) >values : Symbol(values, Decl(specializeVarArgs1.ts, 8, 9)) >T : Symbol(T, Decl(specializeVarArgs1.ts, 4, 26)) diff --git a/tests/baselines/reference/specializedInheritedConstructors1.symbols b/tests/baselines/reference/specializedInheritedConstructors1.symbols index 97285e073cc..69ea33898ad 100644 --- a/tests/baselines/reference/specializedInheritedConstructors1.symbols +++ b/tests/baselines/reference/specializedInheritedConstructors1.symbols @@ -4,7 +4,7 @@ interface ViewOptions { >TModel : Symbol(TModel, Decl(specializedInheritedConstructors1.ts, 0, 22)) model: TModel; ->model : Symbol(model, Decl(specializedInheritedConstructors1.ts, 0, 31)) +>model : Symbol(ViewOptions.model, Decl(specializedInheritedConstructors1.ts, 0, 31)) >TModel : Symbol(TModel, Decl(specializedInheritedConstructors1.ts, 0, 22)) } @@ -18,7 +18,7 @@ class View { >TModel : Symbol(TModel, Decl(specializedInheritedConstructors1.ts, 4, 11)) model: TModel; ->model : Symbol(model, Decl(specializedInheritedConstructors1.ts, 5, 49)) +>model : Symbol(View.model, Decl(specializedInheritedConstructors1.ts, 5, 49)) >TModel : Symbol(TModel, Decl(specializedInheritedConstructors1.ts, 4, 11)) } diff --git a/tests/baselines/reference/specializedLambdaTypeArguments.symbols b/tests/baselines/reference/specializedLambdaTypeArguments.symbols index 44083d6c7c8..9799199a1d7 100644 --- a/tests/baselines/reference/specializedLambdaTypeArguments.symbols +++ b/tests/baselines/reference/specializedLambdaTypeArguments.symbols @@ -4,7 +4,7 @@ class X
{ >A : Symbol(A, Decl(specializedLambdaTypeArguments.ts, 0, 8)) prop: X< () => Tany >; ->prop : Symbol(prop, Decl(specializedLambdaTypeArguments.ts, 0, 12)) +>prop : Symbol(X.prop, Decl(specializedLambdaTypeArguments.ts, 0, 12)) >X : Symbol(X, Decl(specializedLambdaTypeArguments.ts, 0, 0)) >Tany : Symbol(Tany, Decl(specializedLambdaTypeArguments.ts, 1, 11)) >Tany : Symbol(Tany, Decl(specializedLambdaTypeArguments.ts, 1, 11)) diff --git a/tests/baselines/reference/specializedLambdaTypeArguments.types b/tests/baselines/reference/specializedLambdaTypeArguments.types index 3eb2fbc959e..b10da421044 100644 --- a/tests/baselines/reference/specializedLambdaTypeArguments.types +++ b/tests/baselines/reference/specializedLambdaTypeArguments.types @@ -4,7 +4,7 @@ class X { >A : A prop: X< () => Tany >; ->prop : X<() => Tany> +>prop : X<(() => Tany)> >X : X >Tany : Tany >Tany : Tany diff --git a/tests/baselines/reference/specializedOverloadWithRestParameters.errors.txt b/tests/baselines/reference/specializedOverloadWithRestParameters.errors.txt deleted file mode 100644 index 0e67cc37f32..00000000000 --- a/tests/baselines/reference/specializedOverloadWithRestParameters.errors.txt +++ /dev/null @@ -1,21 +0,0 @@ -tests/cases/compiler/specializedOverloadWithRestParameters.ts(3,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/compiler/specializedOverloadWithRestParameters.ts(8,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. - - -==== tests/cases/compiler/specializedOverloadWithRestParameters.ts (2 errors) ==== - class Base { foo() { } } - class Derived1 extends Base { bar() { } } - function f(tagName: 'span', ...args): Derived1; // error - ~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. - function f(tagName: number, ...args): Base; - function f(tagName: any): Base { - return null; - } - function g(tagName: 'span', arg): Derived1; // error - ~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. - function g(tagName: number, arg): Base; - function g(tagName: any): Base { - return null; - } \ No newline at end of file diff --git a/tests/baselines/reference/specializedOverloadWithRestParameters.symbols b/tests/baselines/reference/specializedOverloadWithRestParameters.symbols new file mode 100644 index 00000000000..0f5832ab53d --- /dev/null +++ b/tests/baselines/reference/specializedOverloadWithRestParameters.symbols @@ -0,0 +1,48 @@ +=== tests/cases/compiler/specializedOverloadWithRestParameters.ts === +class Base { foo() { } } +>Base : Symbol(Base, Decl(specializedOverloadWithRestParameters.ts, 0, 0)) +>foo : Symbol(Base.foo, Decl(specializedOverloadWithRestParameters.ts, 0, 12)) + +class Derived1 extends Base { bar() { } } +>Derived1 : Symbol(Derived1, Decl(specializedOverloadWithRestParameters.ts, 0, 24)) +>Base : Symbol(Base, Decl(specializedOverloadWithRestParameters.ts, 0, 0)) +>bar : Symbol(Derived1.bar, Decl(specializedOverloadWithRestParameters.ts, 1, 29)) + +function f(tagName: 'span', ...args): Derived1; // error +>f : Symbol(f, Decl(specializedOverloadWithRestParameters.ts, 1, 41), Decl(specializedOverloadWithRestParameters.ts, 2, 47), Decl(specializedOverloadWithRestParameters.ts, 3, 43)) +>tagName : Symbol(tagName, Decl(specializedOverloadWithRestParameters.ts, 2, 11)) +>args : Symbol(args, Decl(specializedOverloadWithRestParameters.ts, 2, 27)) +>Derived1 : Symbol(Derived1, Decl(specializedOverloadWithRestParameters.ts, 0, 24)) + +function f(tagName: number, ...args): Base; +>f : Symbol(f, Decl(specializedOverloadWithRestParameters.ts, 1, 41), Decl(specializedOverloadWithRestParameters.ts, 2, 47), Decl(specializedOverloadWithRestParameters.ts, 3, 43)) +>tagName : Symbol(tagName, Decl(specializedOverloadWithRestParameters.ts, 3, 11)) +>args : Symbol(args, Decl(specializedOverloadWithRestParameters.ts, 3, 27)) +>Base : Symbol(Base, Decl(specializedOverloadWithRestParameters.ts, 0, 0)) + +function f(tagName: any): Base { +>f : Symbol(f, Decl(specializedOverloadWithRestParameters.ts, 1, 41), Decl(specializedOverloadWithRestParameters.ts, 2, 47), Decl(specializedOverloadWithRestParameters.ts, 3, 43)) +>tagName : Symbol(tagName, Decl(specializedOverloadWithRestParameters.ts, 4, 11)) +>Base : Symbol(Base, Decl(specializedOverloadWithRestParameters.ts, 0, 0)) + + return null; +} +function g(tagName: 'span', arg): Derived1; // error +>g : Symbol(g, Decl(specializedOverloadWithRestParameters.ts, 6, 1), Decl(specializedOverloadWithRestParameters.ts, 7, 43), Decl(specializedOverloadWithRestParameters.ts, 8, 39)) +>tagName : Symbol(tagName, Decl(specializedOverloadWithRestParameters.ts, 7, 11)) +>arg : Symbol(arg, Decl(specializedOverloadWithRestParameters.ts, 7, 27)) +>Derived1 : Symbol(Derived1, Decl(specializedOverloadWithRestParameters.ts, 0, 24)) + +function g(tagName: number, arg): Base; +>g : Symbol(g, Decl(specializedOverloadWithRestParameters.ts, 6, 1), Decl(specializedOverloadWithRestParameters.ts, 7, 43), Decl(specializedOverloadWithRestParameters.ts, 8, 39)) +>tagName : Symbol(tagName, Decl(specializedOverloadWithRestParameters.ts, 8, 11)) +>arg : Symbol(arg, Decl(specializedOverloadWithRestParameters.ts, 8, 27)) +>Base : Symbol(Base, Decl(specializedOverloadWithRestParameters.ts, 0, 0)) + +function g(tagName: any): Base { +>g : Symbol(g, Decl(specializedOverloadWithRestParameters.ts, 6, 1), Decl(specializedOverloadWithRestParameters.ts, 7, 43), Decl(specializedOverloadWithRestParameters.ts, 8, 39)) +>tagName : Symbol(tagName, Decl(specializedOverloadWithRestParameters.ts, 9, 11)) +>Base : Symbol(Base, Decl(specializedOverloadWithRestParameters.ts, 0, 0)) + + return null; +} diff --git a/tests/baselines/reference/specializedOverloadWithRestParameters.types b/tests/baselines/reference/specializedOverloadWithRestParameters.types new file mode 100644 index 00000000000..1f7fd391ec7 --- /dev/null +++ b/tests/baselines/reference/specializedOverloadWithRestParameters.types @@ -0,0 +1,50 @@ +=== tests/cases/compiler/specializedOverloadWithRestParameters.ts === +class Base { foo() { } } +>Base : Base +>foo : () => void + +class Derived1 extends Base { bar() { } } +>Derived1 : Derived1 +>Base : Base +>bar : () => void + +function f(tagName: 'span', ...args): Derived1; // error +>f : { (tagName: "span", ...args: any[]): Derived1; (tagName: number, ...args: any[]): Base; } +>tagName : "span" +>args : any[] +>Derived1 : Derived1 + +function f(tagName: number, ...args): Base; +>f : { (tagName: "span", ...args: any[]): Derived1; (tagName: number, ...args: any[]): Base; } +>tagName : number +>args : any[] +>Base : Base + +function f(tagName: any): Base { +>f : { (tagName: "span", ...args: any[]): Derived1; (tagName: number, ...args: any[]): Base; } +>tagName : any +>Base : Base + + return null; +>null : null +} +function g(tagName: 'span', arg): Derived1; // error +>g : { (tagName: "span", arg: any): Derived1; (tagName: number, arg: any): Base; } +>tagName : "span" +>arg : any +>Derived1 : Derived1 + +function g(tagName: number, arg): Base; +>g : { (tagName: "span", arg: any): Derived1; (tagName: number, arg: any): Base; } +>tagName : number +>arg : any +>Base : Base + +function g(tagName: any): Base { +>g : { (tagName: "span", arg: any): Derived1; (tagName: number, arg: any): Base; } +>tagName : any +>Base : Base + + return null; +>null : null +} diff --git a/tests/baselines/reference/specializedSignatureAsCallbackParameter1.errors.txt b/tests/baselines/reference/specializedSignatureAsCallbackParameter1.errors.txt index 1fb3082622a..61b499e0aee 100644 --- a/tests/baselines/reference/specializedSignatureAsCallbackParameter1.errors.txt +++ b/tests/baselines/reference/specializedSignatureAsCallbackParameter1.errors.txt @@ -1,9 +1,8 @@ tests/cases/compiler/specializedSignatureAsCallbackParameter1.ts(7,4): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. tests/cases/compiler/specializedSignatureAsCallbackParameter1.ts(8,4): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. -tests/cases/compiler/specializedSignatureAsCallbackParameter1.ts(8,7): error TS2381: A signature with an implementation cannot use a string literal type. -==== tests/cases/compiler/specializedSignatureAsCallbackParameter1.ts (3 errors) ==== +==== tests/cases/compiler/specializedSignatureAsCallbackParameter1.ts (2 errors) ==== function x3(a: number, cb: (x: number) => number); function x3(a: string, cb: (x: number) => number); function x3(a: any, cb: (x: number) => number) { @@ -15,6 +14,4 @@ tests/cases/compiler/specializedSignatureAsCallbackParameter1.ts(8,7): error TS2 !!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. x3(1, (x: 'hm') => 1); ~ -!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. - ~~~~~~~~~~~~~~ -!!! error TS2381: A signature with an implementation cannot use a string literal type. \ No newline at end of file +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.errors.txt b/tests/baselines/reference/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.errors.txt index a9293a83a13..73318e782a3 100644 --- a/tests/baselines/reference/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.errors.txt +++ b/tests/baselines/reference/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.errors.txt @@ -1,91 +1,56 @@ -tests/cases/conformance/types/objectTypeLiteral/callSignatures/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.ts(4,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/conformance/types/objectTypeLiteral/callSignatures/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.ts(8,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/conformance/types/objectTypeLiteral/callSignatures/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.ts(14,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/conformance/types/objectTypeLiteral/callSignatures/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.ts(20,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/conformance/types/objectTypeLiteral/callSignatures/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.ts(26,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/conformance/types/objectTypeLiteral/callSignatures/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.ts(28,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/conformance/types/objectTypeLiteral/callSignatures/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.ts(33,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/conformance/types/objectTypeLiteral/callSignatures/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.ts(35,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/conformance/types/objectTypeLiteral/callSignatures/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.ts(40,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/conformance/types/objectTypeLiteral/callSignatures/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.ts(42,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/conformance/types/objectTypeLiteral/callSignatures/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.ts(47,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/conformance/types/objectTypeLiteral/callSignatures/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.ts(49,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.ts(2,10): error TS2394: Overload signature is not compatible with function implementation. -==== tests/cases/conformance/types/objectTypeLiteral/callSignatures/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.ts (12 errors) ==== - // Specialized signatures must be a subtype of a non-specialized signature - // All the below should be errors +==== tests/cases/conformance/types/objectTypeLiteral/callSignatures/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.ts (1 errors) ==== function foo(x: 'a'); ~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +!!! error TS2394: Overload signature is not compatible with function implementation. function foo(x: number) { } class C { foo(x: 'a'); - ~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. foo(x: number); foo(x: any) { } } class C2 { foo(x: 'a'); - ~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. foo(x: T); foo(x: any) { } } class C3 { foo(x: 'a'); - ~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. foo(x: T); foo(x: any) { } } interface I { (x: 'a'); - ~~~~~~~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. (x: number); foo(x: 'a'); - ~~~~~~~~~~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. foo(x: number); } interface I2 { (x: 'a'); - ~~~~~~~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. (x: T); foo(x: 'a'); - ~~~~~~~~~~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. foo(x: T); } interface I3 { (x: 'a'); - ~~~~~~~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. (x: T); foo(x: 'a'); - ~~~~~~~~~~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. foo(x: T); } var a: { (x: 'a'); - ~~~~~~~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. (x: number); foo(x: 'a'); - ~~~~~~~~~~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. foo(x: number); } diff --git a/tests/baselines/reference/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.js b/tests/baselines/reference/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.js index f2946cbeab8..bb2dab55957 100644 --- a/tests/baselines/reference/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.js +++ b/tests/baselines/reference/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.js @@ -1,6 +1,4 @@ //// [specializedSignatureIsNotSubtypeOfNonSpecializedSignature.ts] -// Specialized signatures must be a subtype of a non-specialized signature -// All the below should be errors function foo(x: 'a'); function foo(x: number) { } @@ -67,8 +65,6 @@ var a3: { //// [specializedSignatureIsNotSubtypeOfNonSpecializedSignature.js] -// Specialized signatures must be a subtype of a non-specialized signature -// All the below should be errors function foo(x) { } var C = (function () { function C() { @@ -91,3 +87,55 @@ var C3 = (function () { var a; var a2; var a3; + + +//// [specializedSignatureIsNotSubtypeOfNonSpecializedSignature.d.ts] +declare function foo(x: 'a'): any; +declare class C { + foo(x: 'a'): any; + foo(x: number): any; +} +declare class C2 { + foo(x: 'a'): any; + foo(x: T): any; +} +declare class C3 { + foo(x: 'a'): any; + foo(x: T): any; +} +interface I { + (x: 'a'): any; + (x: number): any; + foo(x: 'a'): any; + foo(x: number): any; +} +interface I2 { + (x: 'a'): any; + (x: T): any; + foo(x: 'a'): any; + foo(x: T): any; +} +interface I3 { + (x: 'a'): any; + (x: T): any; + foo(x: 'a'): any; + foo(x: T): any; +} +declare var a: { + (x: 'a'); + (x: number); + foo(x: 'a'); + foo(x: number); +}; +declare var a2: { + (x: 'a'); + (x: T); + foo(x: 'a'); + foo(x: T); +}; +declare var a3: { + (x: 'a'); + (x: T); + foo(x: 'a'); + foo(x: T); +}; diff --git a/tests/baselines/reference/specializedSignatureIsSubtypeOfNonSpecializedSignature.symbols b/tests/baselines/reference/specializedSignatureIsSubtypeOfNonSpecializedSignature.symbols index 8b1bbfb6aab..164361c14ac 100644 --- a/tests/baselines/reference/specializedSignatureIsSubtypeOfNonSpecializedSignature.symbols +++ b/tests/baselines/reference/specializedSignatureIsSubtypeOfNonSpecializedSignature.symbols @@ -18,15 +18,15 @@ class C { >C : Symbol(C, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 5, 24)) foo(x: 'a'); ->foo : Symbol(foo, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 7, 9), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 8, 16), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 9, 19)) +>foo : Symbol(C.foo, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 7, 9), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 8, 16), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 9, 19)) >x : Symbol(x, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 8, 8)) foo(x: string); ->foo : Symbol(foo, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 7, 9), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 8, 16), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 9, 19)) +>foo : Symbol(C.foo, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 7, 9), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 8, 16), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 9, 19)) >x : Symbol(x, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 9, 8)) foo(x: any) { } ->foo : Symbol(foo, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 7, 9), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 8, 16), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 9, 19)) +>foo : Symbol(C.foo, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 7, 9), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 8, 16), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 9, 19)) >x : Symbol(x, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 10, 8)) } @@ -35,43 +35,43 @@ class C2 { >T : Symbol(T, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 13, 9)) foo(x: 'a'); ->foo : Symbol(foo, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 13, 13), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 14, 16), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 15, 19), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 16, 14)) +>foo : Symbol(C2.foo, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 13, 13), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 14, 16), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 15, 19), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 16, 14)) >x : Symbol(x, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 14, 8)) foo(x: string); ->foo : Symbol(foo, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 13, 13), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 14, 16), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 15, 19), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 16, 14)) +>foo : Symbol(C2.foo, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 13, 13), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 14, 16), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 15, 19), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 16, 14)) >x : Symbol(x, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 15, 8)) foo(x: T); ->foo : Symbol(foo, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 13, 13), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 14, 16), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 15, 19), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 16, 14)) +>foo : Symbol(C2.foo, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 13, 13), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 14, 16), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 15, 19), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 16, 14)) >x : Symbol(x, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 16, 8)) >T : Symbol(T, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 13, 9)) foo(x: any) { } ->foo : Symbol(foo, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 13, 13), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 14, 16), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 15, 19), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 16, 14)) +>foo : Symbol(C2.foo, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 13, 13), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 14, 16), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 15, 19), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 16, 14)) >x : Symbol(x, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 17, 8)) } class C3 { >C3 : Symbol(C3, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 18, 1)) >T : Symbol(T, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 20, 9)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) foo(x: 'a'); ->foo : Symbol(foo, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 20, 28), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 21, 16), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 22, 19), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 23, 14)) +>foo : Symbol(C3.foo, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 20, 28), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 21, 16), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 22, 19), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 23, 14)) >x : Symbol(x, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 21, 8)) foo(x: string); ->foo : Symbol(foo, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 20, 28), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 21, 16), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 22, 19), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 23, 14)) +>foo : Symbol(C3.foo, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 20, 28), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 21, 16), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 22, 19), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 23, 14)) >x : Symbol(x, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 22, 8)) foo(x: T); ->foo : Symbol(foo, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 20, 28), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 21, 16), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 22, 19), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 23, 14)) +>foo : Symbol(C3.foo, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 20, 28), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 21, 16), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 22, 19), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 23, 14)) >x : Symbol(x, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 23, 8)) >T : Symbol(T, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 20, 9)) foo(x: any) { } ->foo : Symbol(foo, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 20, 28), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 21, 16), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 22, 19), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 23, 14)) +>foo : Symbol(C3.foo, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 20, 28), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 21, 16), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 22, 19), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 23, 14)) >x : Symbol(x, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 24, 8)) } @@ -88,15 +88,15 @@ interface I { >x : Symbol(x, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 30, 5)) foo(x: 'a'); ->foo : Symbol(foo, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 30, 16), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 31, 16), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 32, 19)) +>foo : Symbol(I.foo, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 30, 16), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 31, 16), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 32, 19)) >x : Symbol(x, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 31, 8)) foo(x: string); ->foo : Symbol(foo, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 30, 16), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 31, 16), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 32, 19)) +>foo : Symbol(I.foo, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 30, 16), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 31, 16), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 32, 19)) >x : Symbol(x, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 32, 8)) foo(x: number); ->foo : Symbol(foo, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 30, 16), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 31, 16), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 32, 19)) +>foo : Symbol(I.foo, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 30, 16), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 31, 16), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 32, 19)) >x : Symbol(x, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 33, 8)) } @@ -115,15 +115,15 @@ interface I2 { >x : Symbol(x, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 39, 5)) foo(x: 'a'); ->foo : Symbol(foo, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 39, 16), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 40, 16), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 41, 19)) +>foo : Symbol(I2.foo, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 39, 16), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 40, 16), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 41, 19)) >x : Symbol(x, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 40, 8)) foo(x: string); ->foo : Symbol(foo, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 39, 16), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 40, 16), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 41, 19)) +>foo : Symbol(I2.foo, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 39, 16), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 40, 16), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 41, 19)) >x : Symbol(x, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 41, 8)) foo(x: T); ->foo : Symbol(foo, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 39, 16), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 40, 16), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 41, 19)) +>foo : Symbol(I2.foo, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 39, 16), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 40, 16), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 41, 19)) >x : Symbol(x, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 42, 8)) >T : Symbol(T, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 36, 13)) } @@ -131,7 +131,7 @@ interface I2 { interface I3 { >I3 : Symbol(I3, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 43, 1)) >T : Symbol(T, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 45, 13)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) (x: 'a'); >x : Symbol(x, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 46, 5)) @@ -144,15 +144,15 @@ interface I3 { >T : Symbol(T, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 45, 13)) foo(x: 'a'); ->foo : Symbol(foo, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 48, 11), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 49, 16), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 50, 19)) +>foo : Symbol(I3.foo, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 48, 11), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 49, 16), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 50, 19)) >x : Symbol(x, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 49, 8)) foo(x: string); ->foo : Symbol(foo, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 48, 11), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 49, 16), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 50, 19)) +>foo : Symbol(I3.foo, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 48, 11), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 49, 16), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 50, 19)) >x : Symbol(x, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 50, 8)) foo(x: T); ->foo : Symbol(foo, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 48, 11), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 49, 16), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 50, 19)) +>foo : Symbol(I3.foo, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 48, 11), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 49, 16), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 50, 19)) >x : Symbol(x, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 51, 8)) >T : Symbol(T, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 45, 13)) } @@ -236,7 +236,7 @@ var a3: { foo(x: T); >foo : Symbol(foo, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 75, 16), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 76, 19), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 77, 16)) >T : Symbol(T, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 78, 8)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 78, 26)) >T : Symbol(T, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 78, 8)) } diff --git a/tests/baselines/reference/specializedSignatureOverloadReturnTypeWithIndexers.errors.txt b/tests/baselines/reference/specializedSignatureOverloadReturnTypeWithIndexers.errors.txt deleted file mode 100644 index 788a8092ec7..00000000000 --- a/tests/baselines/reference/specializedSignatureOverloadReturnTypeWithIndexers.errors.txt +++ /dev/null @@ -1,22 +0,0 @@ -tests/cases/compiler/specializedSignatureOverloadReturnTypeWithIndexers.ts(15,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. - - -==== tests/cases/compiler/specializedSignatureOverloadReturnTypeWithIndexers.ts (1 errors) ==== - interface A { - f(p: string): { [p: string]: string; }; - f(p: "spec"): { [p: string]: any; } // Should be ok - } - interface B { - f(p: string): { [p: number]: string; }; - f(p: "spec"): { [p: string]: any; } // Should be ok - } - interface C { - f(p: string): { [p: number]: string; }; - f(p: "spec"): { [p: number]: any; } // Should be ok - } - interface D { - f(p: string): { [p: string]: string; }; - f(p: "spec"): { [p: number]: any; } // Should be error - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. - } \ No newline at end of file diff --git a/tests/baselines/reference/specializedSignatureOverloadReturnTypeWithIndexers.symbols b/tests/baselines/reference/specializedSignatureOverloadReturnTypeWithIndexers.symbols new file mode 100644 index 00000000000..2aec70cdc98 --- /dev/null +++ b/tests/baselines/reference/specializedSignatureOverloadReturnTypeWithIndexers.symbols @@ -0,0 +1,53 @@ +=== tests/cases/compiler/specializedSignatureOverloadReturnTypeWithIndexers.ts === +interface A { +>A : Symbol(A, Decl(specializedSignatureOverloadReturnTypeWithIndexers.ts, 0, 0)) + + f(p: string): { [p: string]: string; }; +>f : Symbol(A.f, Decl(specializedSignatureOverloadReturnTypeWithIndexers.ts, 0, 13), Decl(specializedSignatureOverloadReturnTypeWithIndexers.ts, 1, 43)) +>p : Symbol(p, Decl(specializedSignatureOverloadReturnTypeWithIndexers.ts, 1, 6)) +>p : Symbol(p, Decl(specializedSignatureOverloadReturnTypeWithIndexers.ts, 1, 21)) + + f(p: "spec"): { [p: string]: any; } // Should be ok +>f : Symbol(A.f, Decl(specializedSignatureOverloadReturnTypeWithIndexers.ts, 0, 13), Decl(specializedSignatureOverloadReturnTypeWithIndexers.ts, 1, 43)) +>p : Symbol(p, Decl(specializedSignatureOverloadReturnTypeWithIndexers.ts, 2, 6)) +>p : Symbol(p, Decl(specializedSignatureOverloadReturnTypeWithIndexers.ts, 2, 21)) +} +interface B { +>B : Symbol(B, Decl(specializedSignatureOverloadReturnTypeWithIndexers.ts, 3, 1)) + + f(p: string): { [p: number]: string; }; +>f : Symbol(B.f, Decl(specializedSignatureOverloadReturnTypeWithIndexers.ts, 4, 13), Decl(specializedSignatureOverloadReturnTypeWithIndexers.ts, 5, 43)) +>p : Symbol(p, Decl(specializedSignatureOverloadReturnTypeWithIndexers.ts, 5, 6)) +>p : Symbol(p, Decl(specializedSignatureOverloadReturnTypeWithIndexers.ts, 5, 21)) + + f(p: "spec"): { [p: string]: any; } // Should be ok +>f : Symbol(B.f, Decl(specializedSignatureOverloadReturnTypeWithIndexers.ts, 4, 13), Decl(specializedSignatureOverloadReturnTypeWithIndexers.ts, 5, 43)) +>p : Symbol(p, Decl(specializedSignatureOverloadReturnTypeWithIndexers.ts, 6, 6)) +>p : Symbol(p, Decl(specializedSignatureOverloadReturnTypeWithIndexers.ts, 6, 21)) +} +interface C { +>C : Symbol(C, Decl(specializedSignatureOverloadReturnTypeWithIndexers.ts, 7, 1)) + + f(p: string): { [p: number]: string; }; +>f : Symbol(C.f, Decl(specializedSignatureOverloadReturnTypeWithIndexers.ts, 8, 13), Decl(specializedSignatureOverloadReturnTypeWithIndexers.ts, 9, 43)) +>p : Symbol(p, Decl(specializedSignatureOverloadReturnTypeWithIndexers.ts, 9, 6)) +>p : Symbol(p, Decl(specializedSignatureOverloadReturnTypeWithIndexers.ts, 9, 21)) + + f(p: "spec"): { [p: number]: any; } // Should be ok +>f : Symbol(C.f, Decl(specializedSignatureOverloadReturnTypeWithIndexers.ts, 8, 13), Decl(specializedSignatureOverloadReturnTypeWithIndexers.ts, 9, 43)) +>p : Symbol(p, Decl(specializedSignatureOverloadReturnTypeWithIndexers.ts, 10, 6)) +>p : Symbol(p, Decl(specializedSignatureOverloadReturnTypeWithIndexers.ts, 10, 21)) +} +interface D { +>D : Symbol(D, Decl(specializedSignatureOverloadReturnTypeWithIndexers.ts, 11, 1)) + + f(p: string): { [p: string]: string; }; +>f : Symbol(D.f, Decl(specializedSignatureOverloadReturnTypeWithIndexers.ts, 12, 13), Decl(specializedSignatureOverloadReturnTypeWithIndexers.ts, 13, 43)) +>p : Symbol(p, Decl(specializedSignatureOverloadReturnTypeWithIndexers.ts, 13, 6)) +>p : Symbol(p, Decl(specializedSignatureOverloadReturnTypeWithIndexers.ts, 13, 21)) + + f(p: "spec"): { [p: number]: any; } // Should be error +>f : Symbol(D.f, Decl(specializedSignatureOverloadReturnTypeWithIndexers.ts, 12, 13), Decl(specializedSignatureOverloadReturnTypeWithIndexers.ts, 13, 43)) +>p : Symbol(p, Decl(specializedSignatureOverloadReturnTypeWithIndexers.ts, 14, 6)) +>p : Symbol(p, Decl(specializedSignatureOverloadReturnTypeWithIndexers.ts, 14, 21)) +} diff --git a/tests/baselines/reference/specializedSignatureOverloadReturnTypeWithIndexers.types b/tests/baselines/reference/specializedSignatureOverloadReturnTypeWithIndexers.types new file mode 100644 index 00000000000..1a7e9549327 --- /dev/null +++ b/tests/baselines/reference/specializedSignatureOverloadReturnTypeWithIndexers.types @@ -0,0 +1,53 @@ +=== tests/cases/compiler/specializedSignatureOverloadReturnTypeWithIndexers.ts === +interface A { +>A : A + + f(p: string): { [p: string]: string; }; +>f : { (p: string): { [p: string]: string; }; (p: "spec"): { [p: string]: any; }; } +>p : string +>p : string + + f(p: "spec"): { [p: string]: any; } // Should be ok +>f : { (p: string): { [p: string]: string; }; (p: "spec"): { [p: string]: any; }; } +>p : "spec" +>p : string +} +interface B { +>B : B + + f(p: string): { [p: number]: string; }; +>f : { (p: string): { [p: number]: string; }; (p: "spec"): { [p: string]: any; }; } +>p : string +>p : number + + f(p: "spec"): { [p: string]: any; } // Should be ok +>f : { (p: string): { [p: number]: string; }; (p: "spec"): { [p: string]: any; }; } +>p : "spec" +>p : string +} +interface C { +>C : C + + f(p: string): { [p: number]: string; }; +>f : { (p: string): { [p: number]: string; }; (p: "spec"): { [p: number]: any; }; } +>p : string +>p : number + + f(p: "spec"): { [p: number]: any; } // Should be ok +>f : { (p: string): { [p: number]: string; }; (p: "spec"): { [p: number]: any; }; } +>p : "spec" +>p : number +} +interface D { +>D : D + + f(p: string): { [p: string]: string; }; +>f : { (p: string): { [p: string]: string; }; (p: "spec"): { [p: number]: any; }; } +>p : string +>p : string + + f(p: "spec"): { [p: number]: any; } // Should be error +>f : { (p: string): { [p: string]: string; }; (p: "spec"): { [p: number]: any; }; } +>p : "spec" +>p : number +} diff --git a/tests/baselines/reference/staticAndMemberFunctions.symbols b/tests/baselines/reference/staticAndMemberFunctions.symbols index 8df6cb52f3c..3c4e6380801 100644 --- a/tests/baselines/reference/staticAndMemberFunctions.symbols +++ b/tests/baselines/reference/staticAndMemberFunctions.symbols @@ -6,5 +6,5 @@ class T { >x : Symbol(T.x, Decl(staticAndMemberFunctions.ts, 0, 9)) public y() { } ->y : Symbol(y, Decl(staticAndMemberFunctions.ts, 1, 18)) +>y : Symbol(T.y, Decl(staticAndMemberFunctions.ts, 1, 18)) } diff --git a/tests/baselines/reference/staticAndNonStaticPropertiesSameName.symbols b/tests/baselines/reference/staticAndNonStaticPropertiesSameName.symbols index 99cc732465d..c0d6667087a 100644 --- a/tests/baselines/reference/staticAndNonStaticPropertiesSameName.symbols +++ b/tests/baselines/reference/staticAndNonStaticPropertiesSameName.symbols @@ -3,13 +3,13 @@ class C { >C : Symbol(C, Decl(staticAndNonStaticPropertiesSameName.ts, 0, 0)) x: number; ->x : Symbol(x, Decl(staticAndNonStaticPropertiesSameName.ts, 0, 9)) +>x : Symbol(C.x, Decl(staticAndNonStaticPropertiesSameName.ts, 0, 9)) static x: number; >x : Symbol(C.x, Decl(staticAndNonStaticPropertiesSameName.ts, 1, 14)) f() { } ->f : Symbol(f, Decl(staticAndNonStaticPropertiesSameName.ts, 2, 21)) +>f : Symbol(C.f, Decl(staticAndNonStaticPropertiesSameName.ts, 2, 21)) static f() { } >f : Symbol(C.f, Decl(staticAndNonStaticPropertiesSameName.ts, 4, 11)) diff --git a/tests/baselines/reference/staticAnonymousTypeNotReferencingTypeParameter.js b/tests/baselines/reference/staticAnonymousTypeNotReferencingTypeParameter.js new file mode 100644 index 00000000000..62a23d538c4 --- /dev/null +++ b/tests/baselines/reference/staticAnonymousTypeNotReferencingTypeParameter.js @@ -0,0 +1,295 @@ +//// [staticAnonymousTypeNotReferencingTypeParameter.ts] +// This test case is a condensed version of Angular 2's ListWrapper. Prior to #7448 +// this would cause the compiler to run out of memory. + +function outer(x: T) { + class Inner { + static y: T = x; + } + return Inner; +} +let y: number = outer(5).y; + +class ListWrapper2 { + static clone(dit: typeof ListWrapper2, array: T[]): T[] { return array.slice(0); } + static reversed(dit: typeof ListWrapper2, array: T[]): T[] { + var a = ListWrapper2.clone(dit, array); + return a; + } +} +namespace tessst { + /** + * 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. + */ + export function funkyFor(array: T[], callback: (element: T, index: number) => U): U { + if (array) { + for (let i = 0, len = array.length; i < len; i++) { + const result = callback(array[i], i); + if (result) { + return result; + } + } + } + return undefined; + } +} +interface Scanner { + scanRange(start: number, length: number, callback: () => T): T; +} +class ListWrapper { + // JS has no way to express a statically fixed size list, but dart does so we + // keep both methods. + static createFixedSize(dit: typeof ListWrapper, size: number): any[] { return new Array(size); } + static createGrowableSize(dit: typeof ListWrapper, size: number): any[] { return new Array(size); } + static clone(dit: typeof ListWrapper, array: T[]): T[] { return array.slice(0); } + static forEachWithIndex(dit: typeof ListWrapper, array: T[], fn: (t: T, n: number) => void) { + for (var i = 0; i < array.length; i++) { + fn(array[i], i); + } + } + static first(dit: typeof ListWrapper, array: T[]): T { + if (!array) return null; + return array[0]; + } + static last(dit: typeof ListWrapper, array: T[]): T { + if (!array || array.length == 0) return null; + return array[array.length - 1]; + } + static indexOf(dit: typeof ListWrapper, array: T[], value: T, startIndex: number = 0): number { + return array.indexOf(value, startIndex); + } + static contains(dit: typeof ListWrapper, list: T[], el: T): boolean { return list.indexOf(el) !== -1; } + static reversed(dit: typeof ListWrapper, array: T[]): T[] { + var a = ListWrapper.clone(dit, array); + let scanner: Scanner; + scanner.scanRange(3, 5, () => { }); + return tessst.funkyFor(array, t => t.toString()) ? a.reverse() : a; + } + static concat(dit: typeof ListWrapper, a: any[], b: any[]): any[] { return a.concat(b); } + static insert(dit: typeof ListWrapper, list: T[], index: number, value: T) { list.splice(index, 0, value); } + static removeAt(dit: typeof ListWrapper, list: T[], index: number): T { + var res = list[index]; + list.splice(index, 1); + return res; + } + static removeAll(dit: typeof ListWrapper, list: T[], items: T[]) { + for (var i = 0; i < items.length; ++i) { + var index = list.indexOf(items[i]); + list.splice(index, 1); + } + } + static remove(dit: typeof ListWrapper, list: T[], el: T): boolean { + var index = list.indexOf(el); + if (index > -1) { + list.splice(index, 1); + return true; + } + return false; + } + static clear(dit: typeof ListWrapper, list: any[]) { list.length = 0; } + static isEmpty(dit: typeof ListWrapper, list: any[]): boolean { return list.length == 0; } + static fill(dit: typeof ListWrapper, list: any[], value: any, start: number = 0, end: number = null) { + list.fill(value, start, end === null ? list.length : end); + } + static equals(dit: typeof ListWrapper, a: any[], b: any[]): boolean { + if (a.length != b.length) return false; + for (var i = 0; i < a.length; ++i) { + if (a[i] !== b[i]) return false; + } + return true; + } + static slice(dit: typeof ListWrapper, l: T[], from: number = 0, to: number = null): T[] { + return l.slice(from, to === null ? undefined : to); + } + static splice(dit: typeof ListWrapper, l: T[], from: number, length: number): T[] { return l.splice(from, length); } + static sort(dit: typeof ListWrapper, l: T[], compareFn?: (a: T, b: T) => number) { + if (isPresent(compareFn)) { + l.sort(compareFn); + } else { + l.sort(); + } + } + static toString(dit: typeof ListWrapper, l: T[]): string { return l.toString(); } + static toJSON(dit: typeof ListWrapper, l: T[]): string { return JSON.stringify(l); } + + static maximum(dit: typeof ListWrapper, list: T[], predicate: (t: T) => number): T { + if (list.length == 0) { + return null; + } + var solution: T = null; + var maxValue = -Infinity; + for (var index = 0; index < list.length; index++) { + var candidate = list[index]; + if (isBlank(candidate)) { + continue; + } + var candidateValue = predicate(candidate); + if (candidateValue > maxValue) { + solution = candidate; + maxValue = candidateValue; + } + } + return solution; + } +} +let cloned = ListWrapper.clone(ListWrapper, [1,2,3,4]); +declare function isBlank(x: any): boolean; +declare function isPresent(compareFn?: (a: T, b: T) => number): boolean; +interface Array { + fill(value: any, start: number, end: number): void; +} + +//// [staticAnonymousTypeNotReferencingTypeParameter.js] +// This test case is a condensed version of Angular 2's ListWrapper. Prior to #7448 +// this would cause the compiler to run out of memory. +function outer(x) { + var Inner = (function () { + function Inner() { + } + Inner.y = x; + return Inner; + }()); + return Inner; +} +var y = outer(5).y; +var ListWrapper2 = (function () { + function ListWrapper2() { + } + ListWrapper2.clone = function (dit, array) { return array.slice(0); }; + ListWrapper2.reversed = function (dit, array) { + var a = ListWrapper2.clone(dit, array); + return a; + }; + return ListWrapper2; +}()); +var tessst; +(function (tessst) { + /** + * 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 funkyFor(array, callback) { + if (array) { + for (var i = 0, len = array.length; i < len; i++) { + var result = callback(array[i], i); + if (result) { + return result; + } + } + } + return undefined; + } + tessst.funkyFor = funkyFor; +})(tessst || (tessst = {})); +var ListWrapper = (function () { + function ListWrapper() { + } + // JS has no way to express a statically fixed size list, but dart does so we + // keep both methods. + ListWrapper.createFixedSize = function (dit, size) { return new Array(size); }; + ListWrapper.createGrowableSize = function (dit, size) { return new Array(size); }; + ListWrapper.clone = function (dit, array) { return array.slice(0); }; + ListWrapper.forEachWithIndex = function (dit, array, fn) { + for (var i = 0; i < array.length; i++) { + fn(array[i], i); + } + }; + ListWrapper.first = function (dit, array) { + if (!array) + return null; + return array[0]; + }; + ListWrapper.last = function (dit, array) { + if (!array || array.length == 0) + return null; + return array[array.length - 1]; + }; + ListWrapper.indexOf = function (dit, array, value, startIndex) { + if (startIndex === void 0) { startIndex = 0; } + return array.indexOf(value, startIndex); + }; + ListWrapper.contains = function (dit, list, el) { return list.indexOf(el) !== -1; }; + ListWrapper.reversed = function (dit, array) { + var a = ListWrapper.clone(dit, array); + var scanner; + scanner.scanRange(3, 5, function () { }); + return tessst.funkyFor(array, function (t) { return t.toString(); }) ? a.reverse() : a; + }; + ListWrapper.concat = function (dit, a, b) { return a.concat(b); }; + ListWrapper.insert = function (dit, list, index, value) { list.splice(index, 0, value); }; + ListWrapper.removeAt = function (dit, list, index) { + var res = list[index]; + list.splice(index, 1); + return res; + }; + ListWrapper.removeAll = function (dit, list, items) { + for (var i = 0; i < items.length; ++i) { + var index = list.indexOf(items[i]); + list.splice(index, 1); + } + }; + ListWrapper.remove = function (dit, list, el) { + var index = list.indexOf(el); + if (index > -1) { + list.splice(index, 1); + return true; + } + return false; + }; + ListWrapper.clear = function (dit, list) { list.length = 0; }; + ListWrapper.isEmpty = function (dit, list) { return list.length == 0; }; + ListWrapper.fill = function (dit, list, value, start, end) { + if (start === void 0) { start = 0; } + if (end === void 0) { end = null; } + list.fill(value, start, end === null ? list.length : end); + }; + ListWrapper.equals = function (dit, a, b) { + if (a.length != b.length) + return false; + for (var i = 0; i < a.length; ++i) { + if (a[i] !== b[i]) + return false; + } + return true; + }; + ListWrapper.slice = function (dit, l, from, to) { + if (from === void 0) { from = 0; } + if (to === void 0) { to = null; } + return l.slice(from, to === null ? undefined : to); + }; + ListWrapper.splice = function (dit, l, from, length) { return l.splice(from, length); }; + ListWrapper.sort = function (dit, l, compareFn) { + if (isPresent(compareFn)) { + l.sort(compareFn); + } + else { + l.sort(); + } + }; + ListWrapper.toString = function (dit, l) { return l.toString(); }; + ListWrapper.toJSON = function (dit, l) { return JSON.stringify(l); }; + ListWrapper.maximum = function (dit, list, predicate) { + if (list.length == 0) { + return null; + } + var solution = null; + var maxValue = -Infinity; + for (var index = 0; index < list.length; index++) { + var candidate = list[index]; + if (isBlank(candidate)) { + continue; + } + var candidateValue = predicate(candidate); + if (candidateValue > maxValue) { + solution = candidate; + maxValue = candidateValue; + } + } + return solution; + }; + return ListWrapper; +}()); +var cloned = ListWrapper.clone(ListWrapper, [1, 2, 3, 4]); diff --git a/tests/baselines/reference/staticAnonymousTypeNotReferencingTypeParameter.symbols b/tests/baselines/reference/staticAnonymousTypeNotReferencingTypeParameter.symbols new file mode 100644 index 00000000000..a6aa91e3a56 --- /dev/null +++ b/tests/baselines/reference/staticAnonymousTypeNotReferencingTypeParameter.symbols @@ -0,0 +1,667 @@ +=== tests/cases/compiler/staticAnonymousTypeNotReferencingTypeParameter.ts === +// This test case is a condensed version of Angular 2's ListWrapper. Prior to #7448 +// this would cause the compiler to run out of memory. + +function outer(x: T) { +>outer : Symbol(outer, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 0, 0)) +>T : Symbol(T, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 3, 15)) +>x : Symbol(x, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 3, 18)) +>T : Symbol(T, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 3, 15)) + + class Inner { +>Inner : Symbol(Inner, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 3, 25)) + + static y: T = x; +>y : Symbol(Inner.y, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 4, 15)) +>T : Symbol(T, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 3, 15)) +>x : Symbol(x, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 3, 18)) + } + return Inner; +>Inner : Symbol(Inner, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 3, 25)) +} +let y: number = outer(5).y; +>y : Symbol(y, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 9, 3)) +>outer(5).y : Symbol(Inner.y, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 4, 15)) +>outer : Symbol(outer, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 0, 0)) +>y : Symbol(Inner.y, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 4, 15)) + +class ListWrapper2 { +>ListWrapper2 : Symbol(ListWrapper2, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 9, 27)) + + static clone(dit: typeof ListWrapper2, array: T[]): T[] { return array.slice(0); } +>clone : Symbol(ListWrapper2.clone, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 11, 20)) +>T : Symbol(T, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 12, 15)) +>dit : Symbol(dit, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 12, 18)) +>ListWrapper2 : Symbol(ListWrapper2, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 9, 27)) +>array : Symbol(array, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 12, 43)) +>T : Symbol(T, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 12, 15)) +>T : Symbol(T, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 12, 15)) +>array.slice : Symbol(Array.slice, Decl(lib.d.ts, --, --)) +>array : Symbol(array, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 12, 43)) +>slice : Symbol(Array.slice, Decl(lib.d.ts, --, --)) + + static reversed(dit: typeof ListWrapper2, array: T[]): T[] { +>reversed : Symbol(ListWrapper2.reversed, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 12, 87)) +>T : Symbol(T, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 13, 18)) +>dit : Symbol(dit, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 13, 21)) +>ListWrapper2 : Symbol(ListWrapper2, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 9, 27)) +>array : Symbol(array, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 13, 46)) +>T : Symbol(T, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 13, 18)) +>T : Symbol(T, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 13, 18)) + + var a = ListWrapper2.clone(dit, array); +>a : Symbol(a, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 14, 7)) +>ListWrapper2.clone : Symbol(ListWrapper2.clone, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 11, 20)) +>ListWrapper2 : Symbol(ListWrapper2, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 9, 27)) +>clone : Symbol(ListWrapper2.clone, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 11, 20)) +>dit : Symbol(dit, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 13, 21)) +>array : Symbol(array, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 13, 46)) + + return a; +>a : Symbol(a, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 14, 7)) + } +} +namespace tessst { +>tessst : Symbol(tessst, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 17, 1)) + + /** + * 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. + */ + export function funkyFor(array: T[], callback: (element: T, index: number) => U): U { +>funkyFor : Symbol(funkyFor, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 18, 18)) +>T : Symbol(T, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 24, 29)) +>U : Symbol(U, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 24, 31)) +>array : Symbol(array, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 24, 35)) +>T : Symbol(T, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 24, 29)) +>callback : Symbol(callback, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 24, 46)) +>element : Symbol(element, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 24, 58)) +>T : Symbol(T, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 24, 29)) +>index : Symbol(index, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 24, 69)) +>U : Symbol(U, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 24, 31)) +>U : Symbol(U, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 24, 31)) + + if (array) { +>array : Symbol(array, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 24, 35)) + + for (let i = 0, len = array.length; i < len; i++) { +>i : Symbol(i, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 26, 20)) +>len : Symbol(len, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 26, 27)) +>array.length : Symbol(Array.length, Decl(lib.d.ts, --, --)) +>array : Symbol(array, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 24, 35)) +>length : Symbol(Array.length, Decl(lib.d.ts, --, --)) +>i : Symbol(i, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 26, 20)) +>len : Symbol(len, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 26, 27)) +>i : Symbol(i, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 26, 20)) + + const result = callback(array[i], i); +>result : Symbol(result, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 27, 21)) +>callback : Symbol(callback, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 24, 46)) +>array : Symbol(array, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 24, 35)) +>i : Symbol(i, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 26, 20)) +>i : Symbol(i, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 26, 20)) + + if (result) { +>result : Symbol(result, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 27, 21)) + + return result; +>result : Symbol(result, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 27, 21)) + } + } + } + return undefined; +>undefined : Symbol(undefined) + } +} +interface Scanner { +>Scanner : Symbol(Scanner, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 35, 1)) + + scanRange(start: number, length: number, callback: () => T): T; +>scanRange : Symbol(Scanner.scanRange, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 36, 19)) +>T : Symbol(T, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 37, 12)) +>start : Symbol(start, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 37, 15)) +>length : Symbol(length, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 37, 29)) +>callback : Symbol(callback, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 37, 45)) +>T : Symbol(T, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 37, 12)) +>T : Symbol(T, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 37, 12)) +} +class ListWrapper { +>ListWrapper : Symbol(ListWrapper, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 38, 1)) + + // JS has no way to express a statically fixed size list, but dart does so we + // keep both methods. + static createFixedSize(dit: typeof ListWrapper, size: number): any[] { return new Array(size); } +>createFixedSize : Symbol(ListWrapper.createFixedSize, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 39, 19)) +>dit : Symbol(dit, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 42, 25)) +>ListWrapper : Symbol(ListWrapper, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 38, 1)) +>size : Symbol(size, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 42, 49)) +>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 137, 75)) +>size : Symbol(size, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 42, 49)) + + static createGrowableSize(dit: typeof ListWrapper, size: number): any[] { return new Array(size); } +>createGrowableSize : Symbol(ListWrapper.createGrowableSize, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 42, 98)) +>dit : Symbol(dit, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 43, 28)) +>ListWrapper : Symbol(ListWrapper, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 38, 1)) +>size : Symbol(size, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 43, 52)) +>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 137, 75)) +>size : Symbol(size, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 43, 52)) + + static clone(dit: typeof ListWrapper, array: T[]): T[] { return array.slice(0); } +>clone : Symbol(ListWrapper.clone, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 43, 101)) +>T : Symbol(T, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 44, 15)) +>dit : Symbol(dit, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 44, 18)) +>ListWrapper : Symbol(ListWrapper, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 38, 1)) +>array : Symbol(array, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 44, 42)) +>T : Symbol(T, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 44, 15)) +>T : Symbol(T, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 44, 15)) +>array.slice : Symbol(Array.slice, Decl(lib.d.ts, --, --)) +>array : Symbol(array, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 44, 42)) +>slice : Symbol(Array.slice, Decl(lib.d.ts, --, --)) + + static forEachWithIndex(dit: typeof ListWrapper, array: T[], fn: (t: T, n: number) => void) { +>forEachWithIndex : Symbol(ListWrapper.forEachWithIndex, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 44, 86)) +>T : Symbol(T, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 45, 26)) +>dit : Symbol(dit, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 45, 29)) +>ListWrapper : Symbol(ListWrapper, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 38, 1)) +>array : Symbol(array, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 45, 53)) +>T : Symbol(T, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 45, 26)) +>fn : Symbol(fn, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 45, 65)) +>t : Symbol(t, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 45, 71)) +>T : Symbol(T, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 45, 26)) +>n : Symbol(n, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 45, 76)) + + for (var i = 0; i < array.length; i++) { +>i : Symbol(i, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 46, 12)) +>i : Symbol(i, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 46, 12)) +>array.length : Symbol(Array.length, Decl(lib.d.ts, --, --)) +>array : Symbol(array, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 45, 53)) +>length : Symbol(Array.length, Decl(lib.d.ts, --, --)) +>i : Symbol(i, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 46, 12)) + + fn(array[i], i); +>fn : Symbol(fn, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 45, 65)) +>array : Symbol(array, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 45, 53)) +>i : Symbol(i, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 46, 12)) +>i : Symbol(i, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 46, 12)) + } + } + static first(dit: typeof ListWrapper, array: T[]): T { +>first : Symbol(ListWrapper.first, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 49, 3)) +>T : Symbol(T, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 50, 15)) +>dit : Symbol(dit, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 50, 18)) +>ListWrapper : Symbol(ListWrapper, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 38, 1)) +>array : Symbol(array, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 50, 42)) +>T : Symbol(T, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 50, 15)) +>T : Symbol(T, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 50, 15)) + + if (!array) return null; +>array : Symbol(array, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 50, 42)) + + return array[0]; +>array : Symbol(array, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 50, 42)) + } + static last(dit: typeof ListWrapper, array: T[]): T { +>last : Symbol(ListWrapper.last, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 53, 3)) +>T : Symbol(T, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 54, 14)) +>dit : Symbol(dit, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 54, 17)) +>ListWrapper : Symbol(ListWrapper, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 38, 1)) +>array : Symbol(array, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 54, 41)) +>T : Symbol(T, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 54, 14)) +>T : Symbol(T, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 54, 14)) + + if (!array || array.length == 0) return null; +>array : Symbol(array, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 54, 41)) +>array.length : Symbol(Array.length, Decl(lib.d.ts, --, --)) +>array : Symbol(array, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 54, 41)) +>length : Symbol(Array.length, Decl(lib.d.ts, --, --)) + + return array[array.length - 1]; +>array : Symbol(array, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 54, 41)) +>array.length : Symbol(Array.length, Decl(lib.d.ts, --, --)) +>array : Symbol(array, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 54, 41)) +>length : Symbol(Array.length, Decl(lib.d.ts, --, --)) + } + static indexOf(dit: typeof ListWrapper, array: T[], value: T, startIndex: number = 0): number { +>indexOf : Symbol(ListWrapper.indexOf, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 57, 3)) +>T : Symbol(T, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 58, 17)) +>dit : Symbol(dit, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 58, 20)) +>ListWrapper : Symbol(ListWrapper, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 38, 1)) +>array : Symbol(array, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 58, 44)) +>T : Symbol(T, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 58, 17)) +>value : Symbol(value, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 58, 56)) +>T : Symbol(T, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 58, 17)) +>startIndex : Symbol(startIndex, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 58, 66)) + + return array.indexOf(value, startIndex); +>array.indexOf : Symbol(Array.indexOf, Decl(lib.d.ts, --, --)) +>array : Symbol(array, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 58, 44)) +>indexOf : Symbol(Array.indexOf, Decl(lib.d.ts, --, --)) +>value : Symbol(value, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 58, 56)) +>startIndex : Symbol(startIndex, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 58, 66)) + } + static contains(dit: typeof ListWrapper, list: T[], el: T): boolean { return list.indexOf(el) !== -1; } +>contains : Symbol(ListWrapper.contains, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 60, 3)) +>T : Symbol(T, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 61, 18)) +>dit : Symbol(dit, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 61, 21)) +>ListWrapper : Symbol(ListWrapper, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 38, 1)) +>list : Symbol(list, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 61, 45)) +>T : Symbol(T, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 61, 18)) +>el : Symbol(el, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 61, 56)) +>T : Symbol(T, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 61, 18)) +>list.indexOf : Symbol(Array.indexOf, Decl(lib.d.ts, --, --)) +>list : Symbol(list, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 61, 45)) +>indexOf : Symbol(Array.indexOf, Decl(lib.d.ts, --, --)) +>el : Symbol(el, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 61, 56)) + + static reversed(dit: typeof ListWrapper, array: T[]): T[] { +>reversed : Symbol(ListWrapper.reversed, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 61, 108)) +>T : Symbol(T, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 62, 18)) +>dit : Symbol(dit, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 62, 21)) +>ListWrapper : Symbol(ListWrapper, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 38, 1)) +>array : Symbol(array, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 62, 45)) +>T : Symbol(T, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 62, 18)) +>T : Symbol(T, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 62, 18)) + + var a = ListWrapper.clone(dit, array); +>a : Symbol(a, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 63, 7)) +>ListWrapper.clone : Symbol(ListWrapper.clone, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 43, 101)) +>ListWrapper : Symbol(ListWrapper, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 38, 1)) +>clone : Symbol(ListWrapper.clone, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 43, 101)) +>dit : Symbol(dit, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 62, 21)) +>array : Symbol(array, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 62, 45)) + + let scanner: Scanner; +>scanner : Symbol(scanner, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 64, 7)) +>Scanner : Symbol(Scanner, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 35, 1)) + + scanner.scanRange(3, 5, () => { }); +>scanner.scanRange : Symbol(Scanner.scanRange, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 36, 19)) +>scanner : Symbol(scanner, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 64, 7)) +>scanRange : Symbol(Scanner.scanRange, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 36, 19)) + + return tessst.funkyFor(array, t => t.toString()) ? a.reverse() : a; +>tessst.funkyFor : Symbol(tessst.funkyFor, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 18, 18)) +>tessst : Symbol(tessst, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 17, 1)) +>funkyFor : Symbol(tessst.funkyFor, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 18, 18)) +>array : Symbol(array, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 62, 45)) +>t : Symbol(t, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 66, 33)) +>t.toString : Symbol(Object.toString, Decl(lib.d.ts, --, --)) +>t : Symbol(t, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 66, 33)) +>toString : Symbol(Object.toString, Decl(lib.d.ts, --, --)) +>a.reverse : Symbol(Array.reverse, Decl(lib.d.ts, --, --)) +>a : Symbol(a, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 63, 7)) +>reverse : Symbol(Array.reverse, Decl(lib.d.ts, --, --)) +>a : Symbol(a, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 63, 7)) + } + static concat(dit: typeof ListWrapper, a: any[], b: any[]): any[] { return a.concat(b); } +>concat : Symbol(ListWrapper.concat, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 67, 3)) +>dit : Symbol(dit, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 68, 16)) +>ListWrapper : Symbol(ListWrapper, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 38, 1)) +>a : Symbol(a, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 68, 40)) +>b : Symbol(b, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 68, 50)) +>a.concat : Symbol(Array.concat, Decl(lib.d.ts, --, --)) +>a : Symbol(a, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 68, 40)) +>concat : Symbol(Array.concat, Decl(lib.d.ts, --, --)) +>b : Symbol(b, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 68, 50)) + + static insert(dit: typeof ListWrapper, list: T[], index: number, value: T) { list.splice(index, 0, value); } +>insert : Symbol(ListWrapper.insert, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 68, 91)) +>T : Symbol(T, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 69, 16)) +>dit : Symbol(dit, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 69, 19)) +>ListWrapper : Symbol(ListWrapper, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 38, 1)) +>list : Symbol(list, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 69, 43)) +>T : Symbol(T, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 69, 16)) +>index : Symbol(index, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 69, 54)) +>value : Symbol(value, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 69, 69)) +>T : Symbol(T, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 69, 16)) +>list.splice : Symbol(Array.splice, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>list : Symbol(list, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 69, 43)) +>splice : Symbol(Array.splice, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>index : Symbol(index, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 69, 54)) +>value : Symbol(value, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 69, 69)) + + static removeAt(dit: typeof ListWrapper, list: T[], index: number): T { +>removeAt : Symbol(ListWrapper.removeAt, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 69, 113)) +>T : Symbol(T, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 70, 18)) +>dit : Symbol(dit, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 70, 21)) +>ListWrapper : Symbol(ListWrapper, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 38, 1)) +>list : Symbol(list, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 70, 45)) +>T : Symbol(T, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 70, 18)) +>index : Symbol(index, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 70, 56)) +>T : Symbol(T, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 70, 18)) + + var res = list[index]; +>res : Symbol(res, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 71, 7)) +>list : Symbol(list, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 70, 45)) +>index : Symbol(index, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 70, 56)) + + list.splice(index, 1); +>list.splice : Symbol(Array.splice, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>list : Symbol(list, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 70, 45)) +>splice : Symbol(Array.splice, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>index : Symbol(index, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 70, 56)) + + return res; +>res : Symbol(res, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 71, 7)) + } + static removeAll(dit: typeof ListWrapper, list: T[], items: T[]) { +>removeAll : Symbol(ListWrapper.removeAll, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 74, 3)) +>T : Symbol(T, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 75, 19)) +>dit : Symbol(dit, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 75, 22)) +>ListWrapper : Symbol(ListWrapper, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 38, 1)) +>list : Symbol(list, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 75, 46)) +>T : Symbol(T, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 75, 19)) +>items : Symbol(items, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 75, 57)) +>T : Symbol(T, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 75, 19)) + + for (var i = 0; i < items.length; ++i) { +>i : Symbol(i, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 76, 12)) +>i : Symbol(i, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 76, 12)) +>items.length : Symbol(Array.length, Decl(lib.d.ts, --, --)) +>items : Symbol(items, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 75, 57)) +>length : Symbol(Array.length, Decl(lib.d.ts, --, --)) +>i : Symbol(i, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 76, 12)) + + var index = list.indexOf(items[i]); +>index : Symbol(index, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 77, 9)) +>list.indexOf : Symbol(Array.indexOf, Decl(lib.d.ts, --, --)) +>list : Symbol(list, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 75, 46)) +>indexOf : Symbol(Array.indexOf, Decl(lib.d.ts, --, --)) +>items : Symbol(items, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 75, 57)) +>i : Symbol(i, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 76, 12)) + + list.splice(index, 1); +>list.splice : Symbol(Array.splice, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>list : Symbol(list, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 75, 46)) +>splice : Symbol(Array.splice, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>index : Symbol(index, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 77, 9)) + } + } + static remove(dit: typeof ListWrapper, list: T[], el: T): boolean { +>remove : Symbol(ListWrapper.remove, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 80, 3)) +>T : Symbol(T, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 81, 16)) +>dit : Symbol(dit, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 81, 19)) +>ListWrapper : Symbol(ListWrapper, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 38, 1)) +>list : Symbol(list, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 81, 43)) +>T : Symbol(T, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 81, 16)) +>el : Symbol(el, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 81, 54)) +>T : Symbol(T, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 81, 16)) + + var index = list.indexOf(el); +>index : Symbol(index, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 82, 7)) +>list.indexOf : Symbol(Array.indexOf, Decl(lib.d.ts, --, --)) +>list : Symbol(list, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 81, 43)) +>indexOf : Symbol(Array.indexOf, Decl(lib.d.ts, --, --)) +>el : Symbol(el, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 81, 54)) + + if (index > -1) { +>index : Symbol(index, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 82, 7)) + + list.splice(index, 1); +>list.splice : Symbol(Array.splice, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>list : Symbol(list, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 81, 43)) +>splice : Symbol(Array.splice, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>index : Symbol(index, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 82, 7)) + + return true; + } + return false; + } + static clear(dit: typeof ListWrapper, list: any[]) { list.length = 0; } +>clear : Symbol(ListWrapper.clear, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 88, 3)) +>dit : Symbol(dit, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 89, 15)) +>ListWrapper : Symbol(ListWrapper, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 38, 1)) +>list : Symbol(list, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 89, 39)) +>list.length : Symbol(Array.length, Decl(lib.d.ts, --, --)) +>list : Symbol(list, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 89, 39)) +>length : Symbol(Array.length, Decl(lib.d.ts, --, --)) + + static isEmpty(dit: typeof ListWrapper, list: any[]): boolean { return list.length == 0; } +>isEmpty : Symbol(ListWrapper.isEmpty, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 89, 73)) +>dit : Symbol(dit, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 90, 17)) +>ListWrapper : Symbol(ListWrapper, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 38, 1)) +>list : Symbol(list, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 90, 41)) +>list.length : Symbol(Array.length, Decl(lib.d.ts, --, --)) +>list : Symbol(list, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 90, 41)) +>length : Symbol(Array.length, Decl(lib.d.ts, --, --)) + + static fill(dit: typeof ListWrapper, list: any[], value: any, start: number = 0, end: number = null) { +>fill : Symbol(ListWrapper.fill, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 90, 92)) +>dit : Symbol(dit, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 91, 14)) +>ListWrapper : Symbol(ListWrapper, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 38, 1)) +>list : Symbol(list, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 91, 38)) +>value : Symbol(value, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 91, 51)) +>start : Symbol(start, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 91, 63)) +>end : Symbol(end, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 91, 82)) + + list.fill(value, start, end === null ? list.length : end); +>list.fill : Symbol(Array.fill, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 138, 20)) +>list : Symbol(list, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 91, 38)) +>fill : Symbol(Array.fill, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 138, 20)) +>value : Symbol(value, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 91, 51)) +>start : Symbol(start, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 91, 63)) +>end : Symbol(end, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 91, 82)) +>list.length : Symbol(Array.length, Decl(lib.d.ts, --, --)) +>list : Symbol(list, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 91, 38)) +>length : Symbol(Array.length, Decl(lib.d.ts, --, --)) +>end : Symbol(end, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 91, 82)) + } + static equals(dit: typeof ListWrapper, a: any[], b: any[]): boolean { +>equals : Symbol(ListWrapper.equals, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 93, 3)) +>dit : Symbol(dit, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 94, 16)) +>ListWrapper : Symbol(ListWrapper, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 38, 1)) +>a : Symbol(a, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 94, 40)) +>b : Symbol(b, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 94, 50)) + + if (a.length != b.length) return false; +>a.length : Symbol(Array.length, Decl(lib.d.ts, --, --)) +>a : Symbol(a, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 94, 40)) +>length : Symbol(Array.length, Decl(lib.d.ts, --, --)) +>b.length : Symbol(Array.length, Decl(lib.d.ts, --, --)) +>b : Symbol(b, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 94, 50)) +>length : Symbol(Array.length, Decl(lib.d.ts, --, --)) + + for (var i = 0; i < a.length; ++i) { +>i : Symbol(i, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 96, 12)) +>i : Symbol(i, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 96, 12)) +>a.length : Symbol(Array.length, Decl(lib.d.ts, --, --)) +>a : Symbol(a, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 94, 40)) +>length : Symbol(Array.length, Decl(lib.d.ts, --, --)) +>i : Symbol(i, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 96, 12)) + + if (a[i] !== b[i]) return false; +>a : Symbol(a, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 94, 40)) +>i : Symbol(i, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 96, 12)) +>b : Symbol(b, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 94, 50)) +>i : Symbol(i, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 96, 12)) + } + return true; + } + static slice(dit: typeof ListWrapper, l: T[], from: number = 0, to: number = null): T[] { +>slice : Symbol(ListWrapper.slice, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 100, 3)) +>T : Symbol(T, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 101, 15)) +>dit : Symbol(dit, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 101, 18)) +>ListWrapper : Symbol(ListWrapper, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 38, 1)) +>l : Symbol(l, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 101, 42)) +>T : Symbol(T, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 101, 15)) +>from : Symbol(from, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 101, 50)) +>to : Symbol(to, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 101, 68)) +>T : Symbol(T, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 101, 15)) + + return l.slice(from, to === null ? undefined : to); +>l.slice : Symbol(Array.slice, Decl(lib.d.ts, --, --)) +>l : Symbol(l, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 101, 42)) +>slice : Symbol(Array.slice, Decl(lib.d.ts, --, --)) +>from : Symbol(from, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 101, 50)) +>to : Symbol(to, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 101, 68)) +>undefined : Symbol(undefined) +>to : Symbol(to, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 101, 68)) + } + static splice(dit: typeof ListWrapper, l: T[], from: number, length: number): T[] { return l.splice(from, length); } +>splice : Symbol(ListWrapper.splice, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 103, 3)) +>T : Symbol(T, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 104, 16)) +>dit : Symbol(dit, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 104, 19)) +>ListWrapper : Symbol(ListWrapper, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 38, 1)) +>l : Symbol(l, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 104, 43)) +>T : Symbol(T, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 104, 16)) +>from : Symbol(from, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 104, 51)) +>length : Symbol(length, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 104, 65)) +>T : Symbol(T, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 104, 16)) +>l.splice : Symbol(Array.splice, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>l : Symbol(l, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 104, 43)) +>splice : Symbol(Array.splice, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>from : Symbol(from, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 104, 51)) +>length : Symbol(length, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 104, 65)) + + static sort(dit: typeof ListWrapper, l: T[], compareFn?: (a: T, b: T) => number) { +>sort : Symbol(ListWrapper.sort, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 104, 121)) +>T : Symbol(T, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 105, 14)) +>dit : Symbol(dit, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 105, 17)) +>ListWrapper : Symbol(ListWrapper, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 38, 1)) +>l : Symbol(l, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 105, 41)) +>T : Symbol(T, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 105, 14)) +>compareFn : Symbol(compareFn, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 105, 49)) +>a : Symbol(a, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 105, 63)) +>T : Symbol(T, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 105, 14)) +>b : Symbol(b, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 105, 68)) +>T : Symbol(T, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 105, 14)) + + if (isPresent(compareFn)) { +>isPresent : Symbol(isPresent, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 136, 42)) +>compareFn : Symbol(compareFn, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 105, 49)) + + l.sort(compareFn); +>l.sort : Symbol(Array.sort, Decl(lib.d.ts, --, --)) +>l : Symbol(l, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 105, 41)) +>sort : Symbol(Array.sort, Decl(lib.d.ts, --, --)) +>compareFn : Symbol(compareFn, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 105, 49)) + + } else { + l.sort(); +>l.sort : Symbol(Array.sort, Decl(lib.d.ts, --, --)) +>l : Symbol(l, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 105, 41)) +>sort : Symbol(Array.sort, Decl(lib.d.ts, --, --)) + } + } + static toString(dit: typeof ListWrapper, l: T[]): string { return l.toString(); } +>toString : Symbol(ListWrapper.toString, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 111, 3)) +>T : Symbol(T, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 112, 18)) +>dit : Symbol(dit, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 112, 21)) +>ListWrapper : Symbol(ListWrapper, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 38, 1)) +>l : Symbol(l, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 112, 45)) +>T : Symbol(T, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 112, 18)) +>l.toString : Symbol(Array.toString, Decl(lib.d.ts, --, --)) +>l : Symbol(l, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 112, 45)) +>toString : Symbol(Array.toString, Decl(lib.d.ts, --, --)) + + static toJSON(dit: typeof ListWrapper, l: T[]): string { return JSON.stringify(l); } +>toJSON : Symbol(ListWrapper.toJSON, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 112, 86)) +>T : Symbol(T, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 113, 16)) +>dit : Symbol(dit, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 113, 19)) +>ListWrapper : Symbol(ListWrapper, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 38, 1)) +>l : Symbol(l, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 113, 43)) +>T : Symbol(T, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 113, 16)) +>JSON.stringify : Symbol(JSON.stringify, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>JSON : Symbol(JSON, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>stringify : Symbol(JSON.stringify, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>l : Symbol(l, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 113, 43)) + + static maximum(dit: typeof ListWrapper, list: T[], predicate: (t: T) => number): T { +>maximum : Symbol(ListWrapper.maximum, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 113, 89)) +>T : Symbol(T, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 115, 17)) +>dit : Symbol(dit, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 115, 20)) +>ListWrapper : Symbol(ListWrapper, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 38, 1)) +>list : Symbol(list, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 115, 44)) +>T : Symbol(T, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 115, 17)) +>predicate : Symbol(predicate, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 115, 55)) +>t : Symbol(t, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 115, 68)) +>T : Symbol(T, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 115, 17)) +>T : Symbol(T, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 115, 17)) + + if (list.length == 0) { +>list.length : Symbol(Array.length, Decl(lib.d.ts, --, --)) +>list : Symbol(list, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 115, 44)) +>length : Symbol(Array.length, Decl(lib.d.ts, --, --)) + + return null; + } + var solution: T = null; +>solution : Symbol(solution, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 119, 7)) +>T : Symbol(T, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 115, 17)) + + var maxValue = -Infinity; +>maxValue : Symbol(maxValue, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 120, 7)) +>Infinity : Symbol(Infinity, Decl(lib.d.ts, --, --)) + + for (var index = 0; index < list.length; index++) { +>index : Symbol(index, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 121, 12)) +>index : Symbol(index, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 121, 12)) +>list.length : Symbol(Array.length, Decl(lib.d.ts, --, --)) +>list : Symbol(list, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 115, 44)) +>length : Symbol(Array.length, Decl(lib.d.ts, --, --)) +>index : Symbol(index, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 121, 12)) + + var candidate = list[index]; +>candidate : Symbol(candidate, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 122, 9)) +>list : Symbol(list, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 115, 44)) +>index : Symbol(index, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 121, 12)) + + if (isBlank(candidate)) { +>isBlank : Symbol(isBlank, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 135, 55)) +>candidate : Symbol(candidate, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 122, 9)) + + continue; + } + var candidateValue = predicate(candidate); +>candidateValue : Symbol(candidateValue, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 126, 9)) +>predicate : Symbol(predicate, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 115, 55)) +>candidate : Symbol(candidate, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 122, 9)) + + if (candidateValue > maxValue) { +>candidateValue : Symbol(candidateValue, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 126, 9)) +>maxValue : Symbol(maxValue, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 120, 7)) + + solution = candidate; +>solution : Symbol(solution, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 119, 7)) +>candidate : Symbol(candidate, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 122, 9)) + + maxValue = candidateValue; +>maxValue : Symbol(maxValue, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 120, 7)) +>candidateValue : Symbol(candidateValue, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 126, 9)) + } + } + return solution; +>solution : Symbol(solution, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 119, 7)) + } +} +let cloned = ListWrapper.clone(ListWrapper, [1,2,3,4]); +>cloned : Symbol(cloned, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 135, 3)) +>ListWrapper.clone : Symbol(ListWrapper.clone, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 43, 101)) +>ListWrapper : Symbol(ListWrapper, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 38, 1)) +>clone : Symbol(ListWrapper.clone, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 43, 101)) +>ListWrapper : Symbol(ListWrapper, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 38, 1)) + +declare function isBlank(x: any): boolean; +>isBlank : Symbol(isBlank, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 135, 55)) +>x : Symbol(x, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 136, 25)) + +declare function isPresent(compareFn?: (a: T, b: T) => number): boolean; +>isPresent : Symbol(isPresent, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 136, 42)) +>T : Symbol(T, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 137, 27)) +>compareFn : Symbol(compareFn, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 137, 30)) +>a : Symbol(a, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 137, 43)) +>T : Symbol(T, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 137, 27)) +>b : Symbol(b, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 137, 48)) +>T : Symbol(T, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 137, 27)) + +interface Array { +>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 137, 75)) +>T : Symbol(T, Decl(lib.d.ts, --, --), Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 138, 16)) + + fill(value: any, start: number, end: number): void; +>fill : Symbol(Array.fill, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 138, 20)) +>value : Symbol(value, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 139, 6)) +>start : Symbol(start, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 139, 17)) +>end : Symbol(end, Decl(staticAnonymousTypeNotReferencingTypeParameter.ts, 139, 32)) +} diff --git a/tests/baselines/reference/staticAnonymousTypeNotReferencingTypeParameter.types b/tests/baselines/reference/staticAnonymousTypeNotReferencingTypeParameter.types new file mode 100644 index 00000000000..90148bdbb19 --- /dev/null +++ b/tests/baselines/reference/staticAnonymousTypeNotReferencingTypeParameter.types @@ -0,0 +1,787 @@ +=== tests/cases/compiler/staticAnonymousTypeNotReferencingTypeParameter.ts === +// This test case is a condensed version of Angular 2's ListWrapper. Prior to #7448 +// this would cause the compiler to run out of memory. + +function outer(x: T) { +>outer : (x: T) => typeof Inner +>T : T +>x : T +>T : T + + class Inner { +>Inner : Inner + + static y: T = x; +>y : T +>T : T +>x : T + } + return Inner; +>Inner : typeof Inner +} +let y: number = outer(5).y; +>y : number +>outer(5).y : number +>outer(5) : typeof Inner +>outer : (x: T) => typeof Inner +>5 : number +>y : number + +class ListWrapper2 { +>ListWrapper2 : ListWrapper2 + + static clone(dit: typeof ListWrapper2, array: T[]): T[] { return array.slice(0); } +>clone : (dit: typeof ListWrapper2, array: T[]) => T[] +>T : T +>dit : typeof ListWrapper2 +>ListWrapper2 : typeof ListWrapper2 +>array : T[] +>T : T +>T : T +>array.slice(0) : T[] +>array.slice : (start?: number, end?: number) => T[] +>array : T[] +>slice : (start?: number, end?: number) => T[] +>0 : number + + static reversed(dit: typeof ListWrapper2, array: T[]): T[] { +>reversed : (dit: typeof ListWrapper2, array: T[]) => T[] +>T : T +>dit : typeof ListWrapper2 +>ListWrapper2 : typeof ListWrapper2 +>array : T[] +>T : T +>T : T + + var a = ListWrapper2.clone(dit, array); +>a : T[] +>ListWrapper2.clone(dit, array) : T[] +>ListWrapper2.clone : (dit: typeof ListWrapper2, array: T[]) => T[] +>ListWrapper2 : typeof ListWrapper2 +>clone : (dit: typeof ListWrapper2, array: T[]) => T[] +>dit : typeof ListWrapper2 +>array : T[] + + return a; +>a : T[] + } +} +namespace tessst { +>tessst : typeof tessst + + /** + * 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. + */ + export function funkyFor(array: T[], callback: (element: T, index: number) => U): U { +>funkyFor : (array: T[], callback: (element: T, index: number) => U) => U +>T : T +>U : U +>array : T[] +>T : T +>callback : (element: T, index: number) => U +>element : T +>T : T +>index : number +>U : U +>U : U + + if (array) { +>array : T[] + + for (let i = 0, len = array.length; i < len; i++) { +>i : number +>0 : number +>len : number +>array.length : number +>array : T[] +>length : number +>i < len : boolean +>i : number +>len : number +>i++ : number +>i : number + + const result = callback(array[i], i); +>result : U +>callback(array[i], i) : U +>callback : (element: T, index: number) => U +>array[i] : T +>array : T[] +>i : number +>i : number + + if (result) { +>result : U + + return result; +>result : U + } + } + } + return undefined; +>undefined : undefined + } +} +interface Scanner { +>Scanner : Scanner + + scanRange(start: number, length: number, callback: () => T): T; +>scanRange : (start: number, length: number, callback: () => T) => T +>T : T +>start : number +>length : number +>callback : () => T +>T : T +>T : T +} +class ListWrapper { +>ListWrapper : ListWrapper + + // JS has no way to express a statically fixed size list, but dart does so we + // keep both methods. + static createFixedSize(dit: typeof ListWrapper, size: number): any[] { return new Array(size); } +>createFixedSize : (dit: typeof ListWrapper, size: number) => any[] +>dit : typeof ListWrapper +>ListWrapper : typeof ListWrapper +>size : number +>new Array(size) : any[] +>Array : ArrayConstructor +>size : number + + static createGrowableSize(dit: typeof ListWrapper, size: number): any[] { return new Array(size); } +>createGrowableSize : (dit: typeof ListWrapper, size: number) => any[] +>dit : typeof ListWrapper +>ListWrapper : typeof ListWrapper +>size : number +>new Array(size) : any[] +>Array : ArrayConstructor +>size : number + + static clone(dit: typeof ListWrapper, array: T[]): T[] { return array.slice(0); } +>clone : (dit: typeof ListWrapper, array: T[]) => T[] +>T : T +>dit : typeof ListWrapper +>ListWrapper : typeof ListWrapper +>array : T[] +>T : T +>T : T +>array.slice(0) : T[] +>array.slice : (start?: number, end?: number) => T[] +>array : T[] +>slice : (start?: number, end?: number) => T[] +>0 : number + + static forEachWithIndex(dit: typeof ListWrapper, array: T[], fn: (t: T, n: number) => void) { +>forEachWithIndex : (dit: typeof ListWrapper, array: T[], fn: (t: T, n: number) => void) => void +>T : T +>dit : typeof ListWrapper +>ListWrapper : typeof ListWrapper +>array : T[] +>T : T +>fn : (t: T, n: number) => void +>t : T +>T : T +>n : number + + for (var i = 0; i < array.length; i++) { +>i : number +>0 : number +>i < array.length : boolean +>i : number +>array.length : number +>array : T[] +>length : number +>i++ : number +>i : number + + fn(array[i], i); +>fn(array[i], i) : void +>fn : (t: T, n: number) => void +>array[i] : T +>array : T[] +>i : number +>i : number + } + } + static first(dit: typeof ListWrapper, array: T[]): T { +>first : (dit: typeof ListWrapper, array: T[]) => T +>T : T +>dit : typeof ListWrapper +>ListWrapper : typeof ListWrapper +>array : T[] +>T : T +>T : T + + if (!array) return null; +>!array : boolean +>array : T[] +>null : null + + return array[0]; +>array[0] : T +>array : T[] +>0 : number + } + static last(dit: typeof ListWrapper, array: T[]): T { +>last : (dit: typeof ListWrapper, array: T[]) => T +>T : T +>dit : typeof ListWrapper +>ListWrapper : typeof ListWrapper +>array : T[] +>T : T +>T : T + + if (!array || array.length == 0) return null; +>!array || array.length == 0 : boolean +>!array : boolean +>array : T[] +>array.length == 0 : boolean +>array.length : number +>array : T[] +>length : number +>0 : number +>null : null + + return array[array.length - 1]; +>array[array.length - 1] : T +>array : T[] +>array.length - 1 : number +>array.length : number +>array : T[] +>length : number +>1 : number + } + static indexOf(dit: typeof ListWrapper, array: T[], value: T, startIndex: number = 0): number { +>indexOf : (dit: typeof ListWrapper, array: T[], value: T, startIndex?: number) => number +>T : T +>dit : typeof ListWrapper +>ListWrapper : typeof ListWrapper +>array : T[] +>T : T +>value : T +>T : T +>startIndex : number +>0 : number + + return array.indexOf(value, startIndex); +>array.indexOf(value, startIndex) : number +>array.indexOf : (searchElement: T, fromIndex?: number) => number +>array : T[] +>indexOf : (searchElement: T, fromIndex?: number) => number +>value : T +>startIndex : number + } + static contains(dit: typeof ListWrapper, list: T[], el: T): boolean { return list.indexOf(el) !== -1; } +>contains : (dit: typeof ListWrapper, list: T[], el: T) => boolean +>T : T +>dit : typeof ListWrapper +>ListWrapper : typeof ListWrapper +>list : T[] +>T : T +>el : T +>T : T +>list.indexOf(el) !== -1 : boolean +>list.indexOf(el) : number +>list.indexOf : (searchElement: T, fromIndex?: number) => number +>list : T[] +>indexOf : (searchElement: T, fromIndex?: number) => number +>el : T +>-1 : number +>1 : number + + static reversed(dit: typeof ListWrapper, array: T[]): T[] { +>reversed : (dit: typeof ListWrapper, array: T[]) => T[] +>T : T +>dit : typeof ListWrapper +>ListWrapper : typeof ListWrapper +>array : T[] +>T : T +>T : T + + var a = ListWrapper.clone(dit, array); +>a : T[] +>ListWrapper.clone(dit, array) : T[] +>ListWrapper.clone : (dit: typeof ListWrapper, array: T[]) => T[] +>ListWrapper : typeof ListWrapper +>clone : (dit: typeof ListWrapper, array: T[]) => T[] +>dit : typeof ListWrapper +>array : T[] + + let scanner: Scanner; +>scanner : Scanner +>Scanner : Scanner + + scanner.scanRange(3, 5, () => { }); +>scanner.scanRange(3, 5, () => { }) : void +>scanner.scanRange : (start: number, length: number, callback: () => T) => T +>scanner : Scanner +>scanRange : (start: number, length: number, callback: () => T) => T +>3 : number +>5 : number +>() => { } : () => void + + return tessst.funkyFor(array, t => t.toString()) ? a.reverse() : a; +>tessst.funkyFor(array, t => t.toString()) ? a.reverse() : a : T[] +>tessst.funkyFor(array, t => t.toString()) : string +>tessst.funkyFor : (array: T[], callback: (element: T, index: number) => U) => U +>tessst : typeof tessst +>funkyFor : (array: T[], callback: (element: T, index: number) => U) => U +>array : T[] +>t => t.toString() : (t: T) => string +>t : T +>t.toString() : string +>t.toString : () => string +>t : T +>toString : () => string +>a.reverse() : T[] +>a.reverse : () => T[] +>a : T[] +>reverse : () => T[] +>a : T[] + } + static concat(dit: typeof ListWrapper, a: any[], b: any[]): any[] { return a.concat(b); } +>concat : (dit: typeof ListWrapper, a: any[], b: any[]) => any[] +>dit : typeof ListWrapper +>ListWrapper : typeof ListWrapper +>a : any[] +>b : any[] +>a.concat(b) : any[] +>a.concat : (...items: any[]) => any[] +>a : any[] +>concat : (...items: any[]) => any[] +>b : any[] + + static insert(dit: typeof ListWrapper, list: T[], index: number, value: T) { list.splice(index, 0, value); } +>insert : (dit: typeof ListWrapper, list: T[], index: number, value: T) => void +>T : T +>dit : typeof ListWrapper +>ListWrapper : typeof ListWrapper +>list : T[] +>T : T +>index : number +>value : T +>T : T +>list.splice(index, 0, value) : T[] +>list.splice : { (start: number): T[]; (start: number, deleteCount: number, ...items: T[]): T[]; } +>list : T[] +>splice : { (start: number): T[]; (start: number, deleteCount: number, ...items: T[]): T[]; } +>index : number +>0 : number +>value : T + + static removeAt(dit: typeof ListWrapper, list: T[], index: number): T { +>removeAt : (dit: typeof ListWrapper, list: T[], index: number) => T +>T : T +>dit : typeof ListWrapper +>ListWrapper : typeof ListWrapper +>list : T[] +>T : T +>index : number +>T : T + + var res = list[index]; +>res : T +>list[index] : T +>list : T[] +>index : number + + list.splice(index, 1); +>list.splice(index, 1) : T[] +>list.splice : { (start: number): T[]; (start: number, deleteCount: number, ...items: T[]): T[]; } +>list : T[] +>splice : { (start: number): T[]; (start: number, deleteCount: number, ...items: T[]): T[]; } +>index : number +>1 : number + + return res; +>res : T + } + static removeAll(dit: typeof ListWrapper, list: T[], items: T[]) { +>removeAll : (dit: typeof ListWrapper, list: T[], items: T[]) => void +>T : T +>dit : typeof ListWrapper +>ListWrapper : typeof ListWrapper +>list : T[] +>T : T +>items : T[] +>T : T + + for (var i = 0; i < items.length; ++i) { +>i : number +>0 : number +>i < items.length : boolean +>i : number +>items.length : number +>items : T[] +>length : number +>++i : number +>i : number + + var index = list.indexOf(items[i]); +>index : number +>list.indexOf(items[i]) : number +>list.indexOf : (searchElement: T, fromIndex?: number) => number +>list : T[] +>indexOf : (searchElement: T, fromIndex?: number) => number +>items[i] : T +>items : T[] +>i : number + + list.splice(index, 1); +>list.splice(index, 1) : T[] +>list.splice : { (start: number): T[]; (start: number, deleteCount: number, ...items: T[]): T[]; } +>list : T[] +>splice : { (start: number): T[]; (start: number, deleteCount: number, ...items: T[]): T[]; } +>index : number +>1 : number + } + } + static remove(dit: typeof ListWrapper, list: T[], el: T): boolean { +>remove : (dit: typeof ListWrapper, list: T[], el: T) => boolean +>T : T +>dit : typeof ListWrapper +>ListWrapper : typeof ListWrapper +>list : T[] +>T : T +>el : T +>T : T + + var index = list.indexOf(el); +>index : number +>list.indexOf(el) : number +>list.indexOf : (searchElement: T, fromIndex?: number) => number +>list : T[] +>indexOf : (searchElement: T, fromIndex?: number) => number +>el : T + + if (index > -1) { +>index > -1 : boolean +>index : number +>-1 : number +>1 : number + + list.splice(index, 1); +>list.splice(index, 1) : T[] +>list.splice : { (start: number): T[]; (start: number, deleteCount: number, ...items: T[]): T[]; } +>list : T[] +>splice : { (start: number): T[]; (start: number, deleteCount: number, ...items: T[]): T[]; } +>index : number +>1 : number + + return true; +>true : boolean + } + return false; +>false : boolean + } + static clear(dit: typeof ListWrapper, list: any[]) { list.length = 0; } +>clear : (dit: typeof ListWrapper, list: any[]) => void +>dit : typeof ListWrapper +>ListWrapper : typeof ListWrapper +>list : any[] +>list.length = 0 : number +>list.length : number +>list : any[] +>length : number +>0 : number + + static isEmpty(dit: typeof ListWrapper, list: any[]): boolean { return list.length == 0; } +>isEmpty : (dit: typeof ListWrapper, list: any[]) => boolean +>dit : typeof ListWrapper +>ListWrapper : typeof ListWrapper +>list : any[] +>list.length == 0 : boolean +>list.length : number +>list : any[] +>length : number +>0 : number + + static fill(dit: typeof ListWrapper, list: any[], value: any, start: number = 0, end: number = null) { +>fill : (dit: typeof ListWrapper, list: any[], value: any, start?: number, end?: number) => void +>dit : typeof ListWrapper +>ListWrapper : typeof ListWrapper +>list : any[] +>value : any +>start : number +>0 : number +>end : number +>null : null + + list.fill(value, start, end === null ? list.length : end); +>list.fill(value, start, end === null ? list.length : end) : void +>list.fill : (value: any, start: number, end: number) => void +>list : any[] +>fill : (value: any, start: number, end: number) => void +>value : any +>start : number +>end === null ? list.length : end : number +>end === null : boolean +>end : number +>null : null +>list.length : number +>list : any[] +>length : number +>end : number + } + static equals(dit: typeof ListWrapper, a: any[], b: any[]): boolean { +>equals : (dit: typeof ListWrapper, a: any[], b: any[]) => boolean +>dit : typeof ListWrapper +>ListWrapper : typeof ListWrapper +>a : any[] +>b : any[] + + if (a.length != b.length) return false; +>a.length != b.length : boolean +>a.length : number +>a : any[] +>length : number +>b.length : number +>b : any[] +>length : number +>false : boolean + + for (var i = 0; i < a.length; ++i) { +>i : number +>0 : number +>i < a.length : boolean +>i : number +>a.length : number +>a : any[] +>length : number +>++i : number +>i : number + + if (a[i] !== b[i]) return false; +>a[i] !== b[i] : boolean +>a[i] : any +>a : any[] +>i : number +>b[i] : any +>b : any[] +>i : number +>false : boolean + } + return true; +>true : boolean + } + static slice(dit: typeof ListWrapper, l: T[], from: number = 0, to: number = null): T[] { +>slice : (dit: typeof ListWrapper, l: T[], from?: number, to?: number) => T[] +>T : T +>dit : typeof ListWrapper +>ListWrapper : typeof ListWrapper +>l : T[] +>T : T +>from : number +>0 : number +>to : number +>null : null +>T : T + + return l.slice(from, to === null ? undefined : to); +>l.slice(from, to === null ? undefined : to) : T[] +>l.slice : (start?: number, end?: number) => T[] +>l : T[] +>slice : (start?: number, end?: number) => T[] +>from : number +>to === null ? undefined : to : number +>to === null : boolean +>to : number +>null : null +>undefined : undefined +>to : number + } + static splice(dit: typeof ListWrapper, l: T[], from: number, length: number): T[] { return l.splice(from, length); } +>splice : (dit: typeof ListWrapper, l: T[], from: number, length: number) => T[] +>T : T +>dit : typeof ListWrapper +>ListWrapper : typeof ListWrapper +>l : T[] +>T : T +>from : number +>length : number +>T : T +>l.splice(from, length) : T[] +>l.splice : { (start: number): T[]; (start: number, deleteCount: number, ...items: T[]): T[]; } +>l : T[] +>splice : { (start: number): T[]; (start: number, deleteCount: number, ...items: T[]): T[]; } +>from : number +>length : number + + static sort(dit: typeof ListWrapper, l: T[], compareFn?: (a: T, b: T) => number) { +>sort : (dit: typeof ListWrapper, l: T[], compareFn?: (a: T, b: T) => number) => void +>T : T +>dit : typeof ListWrapper +>ListWrapper : typeof ListWrapper +>l : T[] +>T : T +>compareFn : (a: T, b: T) => number +>a : T +>T : T +>b : T +>T : T + + if (isPresent(compareFn)) { +>isPresent(compareFn) : boolean +>isPresent : (compareFn?: (a: T, b: T) => number) => boolean +>compareFn : (a: T, b: T) => number + + l.sort(compareFn); +>l.sort(compareFn) : T[] +>l.sort : (compareFn?: (a: T, b: T) => number) => T[] +>l : T[] +>sort : (compareFn?: (a: T, b: T) => number) => T[] +>compareFn : (a: T, b: T) => number + + } else { + l.sort(); +>l.sort() : T[] +>l.sort : (compareFn?: (a: T, b: T) => number) => T[] +>l : T[] +>sort : (compareFn?: (a: T, b: T) => number) => T[] + } + } + static toString(dit: typeof ListWrapper, l: T[]): string { return l.toString(); } +>toString : (dit: typeof ListWrapper, l: T[]) => string +>T : T +>dit : typeof ListWrapper +>ListWrapper : typeof ListWrapper +>l : T[] +>T : T +>l.toString() : string +>l.toString : () => string +>l : T[] +>toString : () => string + + static toJSON(dit: typeof ListWrapper, l: T[]): string { return JSON.stringify(l); } +>toJSON : (dit: typeof ListWrapper, l: T[]) => string +>T : T +>dit : typeof ListWrapper +>ListWrapper : typeof ListWrapper +>l : T[] +>T : T +>JSON.stringify(l) : string +>JSON.stringify : { (value: any): string; (value: any, replacer: (key: string, value: any) => any): string; (value: any, replacer: any[]): string; (value: any, replacer: (key: string, value: any) => any, space: string | number): string; (value: any, replacer: any[], space: string | number): string; } +>JSON : JSON +>stringify : { (value: any): string; (value: any, replacer: (key: string, value: any) => any): string; (value: any, replacer: any[]): string; (value: any, replacer: (key: string, value: any) => any, space: string | number): string; (value: any, replacer: any[], space: string | number): string; } +>l : T[] + + static maximum(dit: typeof ListWrapper, list: T[], predicate: (t: T) => number): T { +>maximum : (dit: typeof ListWrapper, list: T[], predicate: (t: T) => number) => T +>T : T +>dit : typeof ListWrapper +>ListWrapper : typeof ListWrapper +>list : T[] +>T : T +>predicate : (t: T) => number +>t : T +>T : T +>T : T + + if (list.length == 0) { +>list.length == 0 : boolean +>list.length : number +>list : T[] +>length : number +>0 : number + + return null; +>null : null + } + var solution: T = null; +>solution : T +>T : T +>null : null + + var maxValue = -Infinity; +>maxValue : number +>-Infinity : number +>Infinity : number + + for (var index = 0; index < list.length; index++) { +>index : number +>0 : number +>index < list.length : boolean +>index : number +>list.length : number +>list : T[] +>length : number +>index++ : number +>index : number + + var candidate = list[index]; +>candidate : T +>list[index] : T +>list : T[] +>index : number + + if (isBlank(candidate)) { +>isBlank(candidate) : boolean +>isBlank : (x: any) => boolean +>candidate : T + + continue; + } + var candidateValue = predicate(candidate); +>candidateValue : number +>predicate(candidate) : number +>predicate : (t: T) => number +>candidate : T + + if (candidateValue > maxValue) { +>candidateValue > maxValue : boolean +>candidateValue : number +>maxValue : number + + solution = candidate; +>solution = candidate : T +>solution : T +>candidate : T + + maxValue = candidateValue; +>maxValue = candidateValue : number +>maxValue : number +>candidateValue : number + } + } + return solution; +>solution : T + } +} +let cloned = ListWrapper.clone(ListWrapper, [1,2,3,4]); +>cloned : number[] +>ListWrapper.clone(ListWrapper, [1,2,3,4]) : number[] +>ListWrapper.clone : (dit: typeof ListWrapper, array: T[]) => T[] +>ListWrapper : typeof ListWrapper +>clone : (dit: typeof ListWrapper, array: T[]) => T[] +>ListWrapper : typeof ListWrapper +>[1,2,3,4] : number[] +>1 : number +>2 : number +>3 : number +>4 : number + +declare function isBlank(x: any): boolean; +>isBlank : (x: any) => boolean +>x : any + +declare function isPresent(compareFn?: (a: T, b: T) => number): boolean; +>isPresent : (compareFn?: (a: T, b: T) => number) => boolean +>T : T +>compareFn : (a: T, b: T) => number +>a : T +>T : T +>b : T +>T : T + +interface Array { +>Array : T[] +>T : T + + fill(value: any, start: number, end: number): void; +>fill : (value: any, start: number, end: number) => void +>value : any +>start : number +>end : number +} diff --git a/tests/baselines/reference/staticAsIdentifier.errors.txt b/tests/baselines/reference/staticAsIdentifier.errors.txt index 52108a5a221..4173b0b14c5 100644 --- a/tests/baselines/reference/staticAsIdentifier.errors.txt +++ b/tests/baselines/reference/staticAsIdentifier.errors.txt @@ -1,10 +1,10 @@ -tests/cases/compiler/staticAsIdentifier.ts(2,12): error TS1030: 'static' modifier already seen. +tests/cases/compiler/staticAsIdentifier.ts(2,5): error TS1071: 'static' modifier cannot appear on an index signature. ==== tests/cases/compiler/staticAsIdentifier.ts (1 errors) ==== class C { static static - ~~~~~~ -!!! error TS1030: 'static' modifier already seen. + ~~~~~~ +!!! error TS1071: 'static' modifier cannot appear on an index signature. [x: string]: string; } \ No newline at end of file diff --git a/tests/baselines/reference/staticClassMemberError.errors.txt b/tests/baselines/reference/staticClassMemberError.errors.txt index 9483e3387b7..43a2cd6934d 100644 --- a/tests/baselines/reference/staticClassMemberError.errors.txt +++ b/tests/baselines/reference/staticClassMemberError.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/staticClassMemberError.ts(4,3): error TS2304: Cannot find name 's'. +tests/cases/compiler/staticClassMemberError.ts(4,3): error TS2662: Cannot find name 's'. Did you mean the static member 'C.s'? tests/cases/compiler/staticClassMemberError.ts(9,10): error TS2300: Duplicate identifier 'Foo'. tests/cases/compiler/staticClassMemberError.ts(9,10): error TS2391: Function implementation is missing or not immediately following the declaration. tests/cases/compiler/staticClassMemberError.ts(10,7): error TS2300: Duplicate identifier 'Foo'. @@ -10,7 +10,7 @@ tests/cases/compiler/staticClassMemberError.ts(10,7): error TS2300: Duplicate id public a() { s = 1; ~ -!!! error TS2304: Cannot find name 's'. +!!! error TS2662: Cannot find name 's'. Did you mean the static member 'C.s'? } } diff --git a/tests/baselines/reference/staticFactory1.symbols b/tests/baselines/reference/staticFactory1.symbols index 1e3d1855813..d213ed20765 100644 --- a/tests/baselines/reference/staticFactory1.symbols +++ b/tests/baselines/reference/staticFactory1.symbols @@ -3,7 +3,7 @@ class Base { >Base : Symbol(Base, Decl(staticFactory1.ts, 0, 0)) foo() { return 1; } ->foo : Symbol(foo, Decl(staticFactory1.ts, 0, 12)) +>foo : Symbol(Base.foo, Decl(staticFactory1.ts, 0, 12)) static create() { >create : Symbol(Base.create, Decl(staticFactory1.ts, 1, 23)) @@ -18,7 +18,7 @@ class Derived extends Base { >Base : Symbol(Base, Decl(staticFactory1.ts, 0, 0)) foo() { return 2; } ->foo : Symbol(foo, Decl(staticFactory1.ts, 7, 28)) +>foo : Symbol(Derived.foo, Decl(staticFactory1.ts, 7, 28)) } var d = Derived.create(); >d : Symbol(d, Decl(staticFactory1.ts, 10, 3)) diff --git a/tests/baselines/reference/staticIndexer.errors.txt b/tests/baselines/reference/staticIndexer.errors.txt index 3e910121051..19ed61df658 100644 --- a/tests/baselines/reference/staticIndexer.errors.txt +++ b/tests/baselines/reference/staticIndexer.errors.txt @@ -1,9 +1,9 @@ -tests/cases/compiler/staticIndexer.ts(2,5): error TS1145: Modifiers not permitted on index signature members. +tests/cases/compiler/staticIndexer.ts(2,5): error TS1071: 'static' modifier cannot appear on an index signature. ==== tests/cases/compiler/staticIndexer.ts (1 errors) ==== class C { static [s: string]: number; ~~~~~~ -!!! error TS1145: Modifiers not permitted on index signature members. +!!! error TS1071: 'static' modifier cannot appear on an index signature. } \ No newline at end of file diff --git a/tests/baselines/reference/staticIndexers.errors.txt b/tests/baselines/reference/staticIndexers.errors.txt index 29c46d0ce8c..8223a38a9ae 100644 --- a/tests/baselines/reference/staticIndexers.errors.txt +++ b/tests/baselines/reference/staticIndexers.errors.txt @@ -1,6 +1,6 @@ -tests/cases/conformance/classes/indexMemberDeclarations/staticIndexers.ts(4,5): error TS1145: Modifiers not permitted on index signature members. -tests/cases/conformance/classes/indexMemberDeclarations/staticIndexers.ts(8,5): error TS1145: Modifiers not permitted on index signature members. -tests/cases/conformance/classes/indexMemberDeclarations/staticIndexers.ts(12,5): error TS1145: Modifiers not permitted on index signature members. +tests/cases/conformance/classes/indexMemberDeclarations/staticIndexers.ts(4,5): error TS1071: 'static' modifier cannot appear on an index signature. +tests/cases/conformance/classes/indexMemberDeclarations/staticIndexers.ts(8,5): error TS1071: 'static' modifier cannot appear on an index signature. +tests/cases/conformance/classes/indexMemberDeclarations/staticIndexers.ts(12,5): error TS1071: 'static' modifier cannot appear on an index signature. tests/cases/conformance/classes/indexMemberDeclarations/staticIndexers.ts(12,25): error TS2302: Static members cannot reference class type parameters. @@ -10,19 +10,19 @@ tests/cases/conformance/classes/indexMemberDeclarations/staticIndexers.ts(12,25) class C { static [x: string]: string; ~~~~~~ -!!! error TS1145: Modifiers not permitted on index signature members. +!!! error TS1071: 'static' modifier cannot appear on an index signature. } class D { static [x: number]: string; ~~~~~~ -!!! error TS1145: Modifiers not permitted on index signature members. +!!! error TS1071: 'static' modifier cannot appear on an index signature. } class E { static [x: string]: T; ~~~~~~ -!!! error TS1145: Modifiers not permitted on index signature members. +!!! error TS1071: 'static' modifier cannot appear on an index signature. ~ !!! error TS2302: Static members cannot reference class type parameters. } \ No newline at end of file diff --git a/tests/baselines/reference/staticInheritance.symbols b/tests/baselines/reference/staticInheritance.symbols index 5ef080f96ac..35656ee75e3 100644 --- a/tests/baselines/reference/staticInheritance.symbols +++ b/tests/baselines/reference/staticInheritance.symbols @@ -11,7 +11,7 @@ class A { >n : Symbol(A.n, Decl(staticInheritance.ts, 1, 9)) p = doThing(A); // OK ->p : Symbol(p, Decl(staticInheritance.ts, 2, 21)) +>p : Symbol(A.p, Decl(staticInheritance.ts, 2, 21)) >doThing : Symbol(doThing, Decl(staticInheritance.ts, 0, 0)) >A : Symbol(A, Decl(staticInheritance.ts, 0, 38)) } @@ -20,12 +20,12 @@ class B extends A { >A : Symbol(A, Decl(staticInheritance.ts, 0, 38)) p1 = doThing(A); // OK ->p1 : Symbol(p1, Decl(staticInheritance.ts, 5, 19)) +>p1 : Symbol(B.p1, Decl(staticInheritance.ts, 5, 19)) >doThing : Symbol(doThing, Decl(staticInheritance.ts, 0, 0)) >A : Symbol(A, Decl(staticInheritance.ts, 0, 38)) p2 = doThing(B); // OK ->p2 : Symbol(p2, Decl(staticInheritance.ts, 6, 20)) +>p2 : Symbol(B.p2, Decl(staticInheritance.ts, 6, 20)) >doThing : Symbol(doThing, Decl(staticInheritance.ts, 0, 0)) >B : Symbol(B, Decl(staticInheritance.ts, 4, 1)) } diff --git a/tests/baselines/reference/staticInstanceResolution.symbols b/tests/baselines/reference/staticInstanceResolution.symbols index 1b58989347d..c7a3f935b3d 100644 --- a/tests/baselines/reference/staticInstanceResolution.symbols +++ b/tests/baselines/reference/staticInstanceResolution.symbols @@ -3,7 +3,7 @@ class Comment { >Comment : Symbol(Comment, Decl(staticInstanceResolution.ts, 0, 0)) public getDocCommentText() ->getDocCommentText : Symbol(getDocCommentText, Decl(staticInstanceResolution.ts, 0, 15)) +>getDocCommentText : Symbol(Comment.getDocCommentText, Decl(staticInstanceResolution.ts, 0, 15)) { } diff --git a/tests/baselines/reference/staticInstanceResolution5.errors.txt b/tests/baselines/reference/staticInstanceResolution5.errors.txt index 3c1cee93fd5..da6f0fde143 100644 --- a/tests/baselines/reference/staticInstanceResolution5.errors.txt +++ b/tests/baselines/reference/staticInstanceResolution5.errors.txt @@ -1,15 +1,21 @@ -tests/cases/compiler/staticInstanceResolution5_1.ts(1,24): error TS2307: Cannot find module 'staticInstanceResolution5_0.ts'. +tests/cases/compiler/staticInstanceResolution5_1.ts(4,14): error TS2304: Cannot find name 'WinJS'. +tests/cases/compiler/staticInstanceResolution5_1.ts(5,23): error TS2304: Cannot find name 'WinJS'. +tests/cases/compiler/staticInstanceResolution5_1.ts(6,16): error TS2304: Cannot find name 'WinJS'. -==== tests/cases/compiler/staticInstanceResolution5_1.ts (1 errors) ==== +==== tests/cases/compiler/staticInstanceResolution5_1.ts (3 errors) ==== import WinJS = require('staticInstanceResolution5_0.ts'); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'staticInstanceResolution5_0.ts'. // these 3 should be errors var x = (w1: WinJS) => { }; + ~~~~~ +!!! error TS2304: Cannot find name 'WinJS'. var y = function (w2: WinJS) { } + ~~~~~ +!!! error TS2304: Cannot find name 'WinJS'. function z(w3: WinJS) { } + ~~~~~ +!!! error TS2304: Cannot find name 'WinJS'. ==== tests/cases/compiler/staticInstanceResolution5_0.ts (0 errors) ==== export class Promise { diff --git a/tests/baselines/reference/staticInstanceResolution5.js b/tests/baselines/reference/staticInstanceResolution5.js index 58def522978..0809d1af5f0 100644 --- a/tests/baselines/reference/staticInstanceResolution5.js +++ b/tests/baselines/reference/staticInstanceResolution5.js @@ -16,6 +16,19 @@ var y = function (w2: WinJS) { } function z(w3: WinJS) { } +//// [staticInstanceResolution5_0.js] +define(["require", "exports"], function (require, exports) { + "use strict"; + var Promise = (function () { + function Promise() { + } + Promise.timeout = function (delay) { + return null; + }; + return Promise; + }()); + exports.Promise = Promise; +}); //// [staticInstanceResolution5_1.js] define(["require", "exports"], function (require, exports) { "use strict"; diff --git a/tests/baselines/reference/staticInterfaceAssignmentCompat.symbols b/tests/baselines/reference/staticInterfaceAssignmentCompat.symbols index d1c87faad74..4872a0c62fe 100644 --- a/tests/baselines/reference/staticInterfaceAssignmentCompat.symbols +++ b/tests/baselines/reference/staticInterfaceAssignmentCompat.symbols @@ -15,7 +15,7 @@ interface ShapeFactory { >ShapeFactory : Symbol(ShapeFactory, Decl(staticInterfaceAssignmentCompat.ts, 4, 1)) create(): Shape; ->create : Symbol(create, Decl(staticInterfaceAssignmentCompat.ts, 6, 24)) +>create : Symbol(ShapeFactory.create, Decl(staticInterfaceAssignmentCompat.ts, 6, 24)) >Shape : Symbol(Shape, Decl(staticInterfaceAssignmentCompat.ts, 0, 0)) } diff --git a/tests/baselines/reference/staticMemberWithStringAndNumberNames.symbols b/tests/baselines/reference/staticMemberWithStringAndNumberNames.symbols index 1ce1a12dd80..277a88ce38f 100644 --- a/tests/baselines/reference/staticMemberWithStringAndNumberNames.symbols +++ b/tests/baselines/reference/staticMemberWithStringAndNumberNames.symbols @@ -6,32 +6,32 @@ class C { static 0 = 1; x = C['foo']; ->x : Symbol(x, Decl(staticMemberWithStringAndNumberNames.ts, 2, 17)) +>x : Symbol(C.x, Decl(staticMemberWithStringAndNumberNames.ts, 2, 17)) >C : Symbol(C, Decl(staticMemberWithStringAndNumberNames.ts, 0, 0)) ->'foo' : Symbol(C."foo", Decl(staticMemberWithStringAndNumberNames.ts, 0, 9)) +>'foo' : Symbol(C["foo"], Decl(staticMemberWithStringAndNumberNames.ts, 0, 9)) x2 = C['0']; ->x2 : Symbol(x2, Decl(staticMemberWithStringAndNumberNames.ts, 4, 17)) +>x2 : Symbol(C.x2, Decl(staticMemberWithStringAndNumberNames.ts, 4, 17)) >C : Symbol(C, Decl(staticMemberWithStringAndNumberNames.ts, 0, 0)) ->'0' : Symbol(C.0, Decl(staticMemberWithStringAndNumberNames.ts, 1, 21)) +>'0' : Symbol(C[0], Decl(staticMemberWithStringAndNumberNames.ts, 1, 21)) x3 = C[0]; ->x3 : Symbol(x3, Decl(staticMemberWithStringAndNumberNames.ts, 5, 16)) +>x3 : Symbol(C.x3, Decl(staticMemberWithStringAndNumberNames.ts, 5, 16)) >C : Symbol(C, Decl(staticMemberWithStringAndNumberNames.ts, 0, 0)) ->0 : Symbol(C.0, Decl(staticMemberWithStringAndNumberNames.ts, 1, 21)) +>0 : Symbol(C[0], Decl(staticMemberWithStringAndNumberNames.ts, 1, 21)) static s = C['foo']; >s : Symbol(C.s, Decl(staticMemberWithStringAndNumberNames.ts, 6, 14)) >C : Symbol(C, Decl(staticMemberWithStringAndNumberNames.ts, 0, 0)) ->'foo' : Symbol(C."foo", Decl(staticMemberWithStringAndNumberNames.ts, 0, 9)) +>'foo' : Symbol(C["foo"], Decl(staticMemberWithStringAndNumberNames.ts, 0, 9)) static s2 = C['0']; >s2 : Symbol(C.s2, Decl(staticMemberWithStringAndNumberNames.ts, 8, 24)) >C : Symbol(C, Decl(staticMemberWithStringAndNumberNames.ts, 0, 0)) ->'0' : Symbol(C.0, Decl(staticMemberWithStringAndNumberNames.ts, 1, 21)) +>'0' : Symbol(C[0], Decl(staticMemberWithStringAndNumberNames.ts, 1, 21)) static s3 = C[0]; >s3 : Symbol(C.s3, Decl(staticMemberWithStringAndNumberNames.ts, 9, 23)) >C : Symbol(C, Decl(staticMemberWithStringAndNumberNames.ts, 0, 0)) ->0 : Symbol(C.0, Decl(staticMemberWithStringAndNumberNames.ts, 1, 21)) +>0 : Symbol(C[0], Decl(staticMemberWithStringAndNumberNames.ts, 1, 21)) } diff --git a/tests/baselines/reference/staticMethodWithTypeParameterExtendsClauseDeclFile.symbols b/tests/baselines/reference/staticMethodWithTypeParameterExtendsClauseDeclFile.symbols index b3658ceadcf..84fa0464051 100644 --- a/tests/baselines/reference/staticMethodWithTypeParameterExtendsClauseDeclFile.symbols +++ b/tests/baselines/reference/staticMethodWithTypeParameterExtendsClauseDeclFile.symbols @@ -16,7 +16,7 @@ export class publicClassWithWithPrivateTypeParameters { >privateClass : Symbol(privateClass, Decl(staticMethodWithTypeParameterExtendsClauseDeclFile.ts, 0, 0)) } private myPrivateMethod1() { // do not emit extends clause ->myPrivateMethod1 : Symbol(myPrivateMethod1, Decl(staticMethodWithTypeParameterExtendsClauseDeclFile.ts, 8, 5)) +>myPrivateMethod1 : Symbol(publicClassWithWithPrivateTypeParameters.myPrivateMethod1, Decl(staticMethodWithTypeParameterExtendsClauseDeclFile.ts, 8, 5)) >T : Symbol(T, Decl(staticMethodWithTypeParameterExtendsClauseDeclFile.ts, 9, 29)) >privateClass : Symbol(privateClass, Decl(staticMethodWithTypeParameterExtendsClauseDeclFile.ts, 0, 0)) } @@ -26,7 +26,7 @@ export class publicClassWithWithPrivateTypeParameters { >publicClass : Symbol(publicClass, Decl(staticMethodWithTypeParameterExtendsClauseDeclFile.ts, 1, 1)) } private myPrivateMethod2() { // do not emit extends clause ->myPrivateMethod2 : Symbol(myPrivateMethod2, Decl(staticMethodWithTypeParameterExtendsClauseDeclFile.ts, 12, 5)) +>myPrivateMethod2 : Symbol(publicClassWithWithPrivateTypeParameters.myPrivateMethod2, Decl(staticMethodWithTypeParameterExtendsClauseDeclFile.ts, 12, 5)) >T : Symbol(T, Decl(staticMethodWithTypeParameterExtendsClauseDeclFile.ts, 13, 29)) >publicClass : Symbol(publicClass, Decl(staticMethodWithTypeParameterExtendsClauseDeclFile.ts, 1, 1)) } @@ -36,7 +36,7 @@ export class publicClassWithWithPrivateTypeParameters { >publicClass : Symbol(publicClass, Decl(staticMethodWithTypeParameterExtendsClauseDeclFile.ts, 1, 1)) } public myPublicMethod() { ->myPublicMethod : Symbol(myPublicMethod, Decl(staticMethodWithTypeParameterExtendsClauseDeclFile.ts, 16, 5)) +>myPublicMethod : Symbol(publicClassWithWithPrivateTypeParameters.myPublicMethod, Decl(staticMethodWithTypeParameterExtendsClauseDeclFile.ts, 16, 5)) >T : Symbol(T, Decl(staticMethodWithTypeParameterExtendsClauseDeclFile.ts, 17, 26)) >publicClass : Symbol(publicClass, Decl(staticMethodWithTypeParameterExtendsClauseDeclFile.ts, 1, 1)) } diff --git a/tests/baselines/reference/staticPropertyAndFunctionWithSameName.symbols b/tests/baselines/reference/staticPropertyAndFunctionWithSameName.symbols index 02d7b5690e2..bde100cec76 100644 --- a/tests/baselines/reference/staticPropertyAndFunctionWithSameName.symbols +++ b/tests/baselines/reference/staticPropertyAndFunctionWithSameName.symbols @@ -6,7 +6,7 @@ class C { >f : Symbol(C.f, Decl(staticPropertyAndFunctionWithSameName.ts, 0, 9)) f: number; ->f : Symbol(f, Decl(staticPropertyAndFunctionWithSameName.ts, 1, 21)) +>f : Symbol(C.f, Decl(staticPropertyAndFunctionWithSameName.ts, 1, 21)) } class D { @@ -16,5 +16,5 @@ class D { >f : Symbol(D.f, Decl(staticPropertyAndFunctionWithSameName.ts, 5, 9)) f() { } ->f : Symbol(f, Decl(staticPropertyAndFunctionWithSameName.ts, 6, 21)) +>f : Symbol(D.f, Decl(staticPropertyAndFunctionWithSameName.ts, 6, 21)) } diff --git a/tests/baselines/reference/staticVisibility.errors.txt b/tests/baselines/reference/staticVisibility.errors.txt index dccad4a2e2b..a92cb7f88cd 100644 --- a/tests/baselines/reference/staticVisibility.errors.txt +++ b/tests/baselines/reference/staticVisibility.errors.txt @@ -1,5 +1,5 @@ -tests/cases/compiler/staticVisibility.ts(10,9): error TS2304: Cannot find name 's'. -tests/cases/compiler/staticVisibility.ts(13,9): error TS2304: Cannot find name 'b'. +tests/cases/compiler/staticVisibility.ts(10,9): error TS2662: Cannot find name 's'. Did you mean the static member 'C1.s'? +tests/cases/compiler/staticVisibility.ts(13,9): error TS2662: Cannot find name 'b'. Did you mean the static member 'C1.b'? tests/cases/compiler/staticVisibility.ts(18,9): error TS2304: Cannot find name 'v'. tests/cases/compiler/staticVisibility.ts(19,14): error TS2339: Property 'p' does not exist on type 'typeof C1'. tests/cases/compiler/staticVisibility.ts(31,12): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. @@ -19,12 +19,12 @@ tests/cases/compiler/staticVisibility.ts(33,29): error TS2304: Cannot find name s = 1; // should be error ~ -!!! error TS2304: Cannot find name 's'. +!!! error TS2662: Cannot find name 's'. Did you mean the static member 'C1.s'? C1.s = 1; // should be ok b(); // should be error ~ -!!! error TS2304: Cannot find name 'b'. +!!! error TS2662: Cannot find name 'b'. Did you mean the static member 'C1.b'? C1.b(); // should be ok } diff --git a/tests/baselines/reference/strictModeInConstructor.js b/tests/baselines/reference/strictModeInConstructor.js index 3b315861548..bcfbdf22414 100644 --- a/tests/baselines/reference/strictModeInConstructor.js +++ b/tests/baselines/reference/strictModeInConstructor.js @@ -75,8 +75,8 @@ var B = (function (_super) { __extends(B, _super); function B() { "use strict"; // No error - this.s = 9; _super.call(this); + this.s = 9; } return B; }(A)); diff --git a/tests/baselines/reference/strictModeUseContextualKeyword.symbols b/tests/baselines/reference/strictModeUseContextualKeyword.symbols index a0a3182b9c6..a27477bfa99 100644 --- a/tests/baselines/reference/strictModeUseContextualKeyword.symbols +++ b/tests/baselines/reference/strictModeUseContextualKeyword.symbols @@ -11,7 +11,7 @@ class C { >C : Symbol(C, Decl(strictModeUseContextualKeyword.ts, 2, 28)) public as() { } ->as : Symbol(as, Decl(strictModeUseContextualKeyword.ts, 3, 9)) +>as : Symbol(C.as, Decl(strictModeUseContextualKeyword.ts, 3, 9)) } function F() { >F : Symbol(F, Decl(strictModeUseContextualKeyword.ts, 5, 1)) diff --git a/tests/baselines/reference/stringIncludes.symbols b/tests/baselines/reference/stringIncludes.symbols index 1f1b2e55ccf..5b2bf4b7afa 100644 --- a/tests/baselines/reference/stringIncludes.symbols +++ b/tests/baselines/reference/stringIncludes.symbols @@ -5,11 +5,11 @@ var includes: boolean; includes = "abcde".includes("cd"); >includes : Symbol(includes, Decl(stringIncludes.ts, 1, 3)) ->"abcde".includes : Symbol(String.includes, Decl(lib.d.ts, --, --)) ->includes : Symbol(String.includes, Decl(lib.d.ts, --, --)) +>"abcde".includes : Symbol(String.includes, Decl(lib.es2015.core.d.ts, --, --)) +>includes : Symbol(String.includes, Decl(lib.es2015.core.d.ts, --, --)) includes = "abcde".includes("cd", 2); >includes : Symbol(includes, Decl(stringIncludes.ts, 1, 3)) ->"abcde".includes : Symbol(String.includes, Decl(lib.d.ts, --, --)) ->includes : Symbol(String.includes, Decl(lib.d.ts, --, --)) +>"abcde".includes : Symbol(String.includes, Decl(lib.es2015.core.d.ts, --, --)) +>includes : Symbol(String.includes, Decl(lib.es2015.core.d.ts, --, --)) diff --git a/tests/baselines/reference/stringIndexerAssignments1.errors.txt b/tests/baselines/reference/stringIndexerAssignments1.errors.txt index 908371bc7dd..ac99b239779 100644 --- a/tests/baselines/reference/stringIndexerAssignments1.errors.txt +++ b/tests/baselines/reference/stringIndexerAssignments1.errors.txt @@ -1,18 +1,13 @@ -tests/cases/compiler/stringIndexerAssignments1.ts(4,1): error TS2322: Type '{ one: string; }' is not assignable to type '{ [index: string]: string; one: string; }'. - Index signature is missing in type '{ one: string; }'. tests/cases/compiler/stringIndexerAssignments1.ts(5,1): error TS2322: Type '{ one: number; two: string; }' is not assignable to type '{ [index: string]: string; one: string; }'. Types of property 'one' are incompatible. Type 'number' is not assignable to type 'string'. -==== tests/cases/compiler/stringIndexerAssignments1.ts (2 errors) ==== +==== tests/cases/compiler/stringIndexerAssignments1.ts (1 errors) ==== var x: { [index: string]: string; one: string; }; var a: { one: string; }; var b: { one: number; two: string; }; x = a; - ~ -!!! error TS2322: Type '{ one: string; }' is not assignable to type '{ [index: string]: string; one: string; }'. -!!! error TS2322: Index signature is missing in type '{ one: string; }'. x = b; // error ~ !!! error TS2322: Type '{ one: number; two: string; }' is not assignable to type '{ [index: string]: string; one: string; }'. diff --git a/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations.errors.txt b/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations.errors.txt index 08881be2a86..8f4bbe2025a 100644 --- a/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations.errors.txt +++ b/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations.errors.txt @@ -22,10 +22,9 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerCon tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(71,5): error TS2411: Property 'foo' of type '() => string' is not assignable to string index type 'string'. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(73,5): error TS2411: Property '"4.0"' of type 'number' is not assignable to string index type 'string'. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(74,5): error TS2411: Property 'f' of type 'MyString' is not assignable to string index type 'string'. -tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(78,5): error TS2322: Type '{ [x: string]: string | number | (() => void) | MyString; 1.0: string; 2.0: number; a: string; b: number; c: () => void; "d": string; "e": number; "3.0": string; "4.0": number; f: MyString; X: string; foo(): string; }' is not assignable to type '{ [x: string]: string; }'. - Index signatures are incompatible. - Type 'string | number | (() => void) | MyString' is not assignable to type 'string'. - Type 'number' is not assignable to type 'string'. +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(78,5): error TS2322: Type '{ 1.0: string; 2.0: number; a: string; b: number; c: () => void; "d": string; "e": number; "3.0": string; "4.0": number; f: MyString; X: string; foo(): string; }' is not assignable to type '{ [x: string]: string; }'. + Property '2.0' is incompatible with index signature. + Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(90,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(93,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. @@ -158,10 +157,9 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerCon // error var b: { [x: string]: string; } = { ~ -!!! error TS2322: Type '{ [x: string]: string | number | (() => void) | MyString; 1.0: string; 2.0: number; a: string; b: number; c: () => void; "d": string; "e": number; "3.0": string; "4.0": number; f: MyString; X: string; foo(): string; }' is not assignable to type '{ [x: string]: string; }'. -!!! error TS2322: Index signatures are incompatible. -!!! error TS2322: Type 'string | number | (() => void) | MyString' is not assignable to type 'string'. -!!! error TS2322: Type 'number' is not assignable to type 'string'. +!!! error TS2322: Type '{ 1.0: string; 2.0: number; a: string; b: number; c: () => void; "d": string; "e": number; "3.0": string; "4.0": number; f: MyString; X: string; foo(): string; }' is not assignable to type '{ [x: string]: string; }'. +!!! error TS2322: Property '2.0' is incompatible with index signature. +!!! error TS2322: Type 'number' is not assignable to type 'string'. a: '', b: 1, c: () => { }, diff --git a/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations2.errors.txt b/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations2.errors.txt index faef7905453..dacfb1a522d 100644 --- a/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations2.errors.txt +++ b/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations2.errors.txt @@ -4,8 +4,8 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerCon tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations2.ts(24,5): error TS2411: Property 'd' of type 'string' is not assignable to string index type 'A'. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations2.ts(31,5): error TS2411: Property 'c' of type 'number' is not assignable to string index type 'A'. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations2.ts(32,5): error TS2411: Property 'd' of type 'string' is not assignable to string index type 'A'. -tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations2.ts(36,5): error TS2322: Type '{ [x: string]: typeof A; a: typeof A; b: typeof B; }' is not assignable to type '{ [x: string]: A; }'. - Index signatures are incompatible. +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations2.ts(36,5): error TS2322: Type '{ a: typeof A; b: typeof B; }' is not assignable to type '{ [x: string]: A; }'. + Property 'a' is incompatible with index signature. Type 'typeof A' is not assignable to type 'A'. Property 'foo' is missing in type 'typeof A'. @@ -60,8 +60,8 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerCon // error var b: { [x: string]: A } = { ~ -!!! error TS2322: Type '{ [x: string]: typeof A; a: typeof A; b: typeof B; }' is not assignable to type '{ [x: string]: A; }'. -!!! error TS2322: Index signatures are incompatible. +!!! error TS2322: Type '{ a: typeof A; b: typeof B; }' is not assignable to type '{ [x: string]: A; }'. +!!! error TS2322: Property 'a' is incompatible with index signature. !!! error TS2322: Type 'typeof A' is not assignable to type 'A'. !!! error TS2322: Property 'foo' is missing in type 'typeof A'. a: A, diff --git a/tests/baselines/reference/stringIndexingResults.symbols b/tests/baselines/reference/stringIndexingResults.symbols index 4890b44bce6..34771ab49ab 100644 --- a/tests/baselines/reference/stringIndexingResults.symbols +++ b/tests/baselines/reference/stringIndexingResults.symbols @@ -6,7 +6,7 @@ class C { >x : Symbol(x, Decl(stringIndexingResults.ts, 1, 5)) y = ''; ->y : Symbol(y, Decl(stringIndexingResults.ts, 1, 24)) +>y : Symbol(C.y, Decl(stringIndexingResults.ts, 1, 24)) } var c: C; @@ -33,7 +33,7 @@ interface I { >x : Symbol(x, Decl(stringIndexingResults.ts, 11, 5)) y: string; ->y : Symbol(y, Decl(stringIndexingResults.ts, 11, 24)) +>y : Symbol(I.y, Decl(stringIndexingResults.ts, 11, 24)) } var i: I diff --git a/tests/baselines/reference/stringIndexingResults.types b/tests/baselines/reference/stringIndexingResults.types index 9f613312e5a..1fdc580b1a2 100644 --- a/tests/baselines/reference/stringIndexingResults.types +++ b/tests/baselines/reference/stringIndexingResults.types @@ -95,7 +95,7 @@ var r9 = a[1]; var b: { [x: string]: string } = { y: '' } >b : { [x: string]: string; } >x : string ->{ y: '' } : { [x: string]: string; y: string; } +>{ y: '' } : { y: string; } >y : string >'' : string diff --git a/tests/baselines/reference/stringLiteralCheckedInIf02.types b/tests/baselines/reference/stringLiteralCheckedInIf02.types index f91eea03097..79f4c6a223a 100644 --- a/tests/baselines/reference/stringLiteralCheckedInIf02.types +++ b/tests/baselines/reference/stringLiteralCheckedInIf02.types @@ -31,7 +31,7 @@ function f(foo: T) { >T : ("a" | "b")[] | "a" | "b" if (isS(foo)) { ->isS(foo) : t is "a" | "b" +>isS(foo) : boolean >isS : (t: ("a" | "b")[] | "a" | "b") => t is "a" | "b" >foo : ("a" | "b")[] | "a" | "b" diff --git a/tests/baselines/reference/stringLiteralTypeIsSubtypeOfString.errors.txt b/tests/baselines/reference/stringLiteralTypeIsSubtypeOfString.errors.txt deleted file mode 100644 index af75273ade3..00000000000 --- a/tests/baselines/reference/stringLiteralTypeIsSubtypeOfString.errors.txt +++ /dev/null @@ -1,124 +0,0 @@ -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString.ts(22,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString.ts(26,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString.ts(30,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString.ts(34,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString.ts(38,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString.ts(77,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString.ts(90,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. - - -==== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString.ts (7 errors) ==== - // string literal types are subtypes of string, any - - // ok - function f1(x: 'a'); - function f1(x: string); - function f1(x: string) { } - - // ok - function f2(x: 'a'); - function f2(x: any); - function f2(x: any) { } - - // errors - function f3(x: 'a'); - function f3(x: Object); - function f3(x: any) { } - - function f4(x: 'a'); - function f4(x: {}); - function f4(x: any) { } - - function f5(x: 'a'); - ~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. - function f5(x: number); - function f5(x: any) { } - - function f6(x: 'a'); - ~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. - function f6(x: boolean); - function f6(x: any) { } - - function f7(x: 'a'); - ~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. - function f7(x: Date); - function f7(x: any) { } - - function f8(x: 'a'); - ~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. - function f8(x: RegExp); - function f8(x: any) { } - - function f9(x: 'a'); - ~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. - function f9(x: () => {}); - function f9(x: any) { } - - class C implements String { - toString(): string { return null; } - charAt(pos: number): string { return null; } - charCodeAt(index: number): number { return null; } - concat(...strings: string[]): string { return null; } - indexOf(searchString: string, position?: number): number { return null; } - lastIndexOf(searchString: string, position?: number): number { return null; } - localeCompare(that: string): number { return null; } - match(regexp: any): string[] { return null; } - replace(searchValue: any, replaceValue: any): string { return null; } - search(regexp: any): number { return null; } - slice(start?: number, end?: number): string { return null; } - split(separator: any, limit?: number): string[] { return null; } - substring(start: number, end?: number): string { return null; } - toLowerCase(): string { return null; } - toLocaleLowerCase(): string { return null; } - toUpperCase(): string { return null; } - toLocaleUpperCase(): string { return null; } - trim(): string { return null; } - length: number; - substr(from: number, length?: number): string { return null; } - valueOf(): string { return null; } - [index: number]: string; - } - - // BUG 831846 - function f10(x: 'a'); - function f10(x: C); - function f10(x: any) { } - - interface I extends String { - foo: string; - } - - // BUG 831846 - function f11(x: 'a'); - ~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. - function f11(x: I); - function f11(x: any) { } - - function f12(x: 'a'); - function f12(x: T); - function f12(x: any) { } - - function f13(x: 'a'); - function f13(x: T); - function f13(x: any) { } - - enum E { A } - function f14(x: 'a'); - ~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. - function f14(x: E); - function f14(x: any) { } - - function f15(x: 'a'); - function f15(x: U); - function f15(x: any) { } - - function f16(x: 'a'); - function f16(x: U); - function f16(x: any) { } \ No newline at end of file diff --git a/tests/baselines/reference/stringLiteralTypeIsSubtypeOfString.symbols b/tests/baselines/reference/stringLiteralTypeIsSubtypeOfString.symbols new file mode 100644 index 00000000000..e97b2a59118 --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypeIsSubtypeOfString.symbols @@ -0,0 +1,343 @@ +=== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString.ts === +// string literal types are subtypes of string, any + +// ok +function f1(x: 'a'); +>f1 : Symbol(f1, Decl(stringLiteralTypeIsSubtypeOfString.ts, 0, 0), Decl(stringLiteralTypeIsSubtypeOfString.ts, 3, 20), Decl(stringLiteralTypeIsSubtypeOfString.ts, 4, 23)) +>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 3, 12)) + +function f1(x: string); +>f1 : Symbol(f1, Decl(stringLiteralTypeIsSubtypeOfString.ts, 0, 0), Decl(stringLiteralTypeIsSubtypeOfString.ts, 3, 20), Decl(stringLiteralTypeIsSubtypeOfString.ts, 4, 23)) +>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 4, 12)) + +function f1(x: string) { } +>f1 : Symbol(f1, Decl(stringLiteralTypeIsSubtypeOfString.ts, 0, 0), Decl(stringLiteralTypeIsSubtypeOfString.ts, 3, 20), Decl(stringLiteralTypeIsSubtypeOfString.ts, 4, 23)) +>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 5, 12)) + +// ok +function f2(x: 'a'); +>f2 : Symbol(f2, Decl(stringLiteralTypeIsSubtypeOfString.ts, 5, 26), Decl(stringLiteralTypeIsSubtypeOfString.ts, 8, 20), Decl(stringLiteralTypeIsSubtypeOfString.ts, 9, 20)) +>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 8, 12)) + +function f2(x: any); +>f2 : Symbol(f2, Decl(stringLiteralTypeIsSubtypeOfString.ts, 5, 26), Decl(stringLiteralTypeIsSubtypeOfString.ts, 8, 20), Decl(stringLiteralTypeIsSubtypeOfString.ts, 9, 20)) +>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 9, 12)) + +function f2(x: any) { } +>f2 : Symbol(f2, Decl(stringLiteralTypeIsSubtypeOfString.ts, 5, 26), Decl(stringLiteralTypeIsSubtypeOfString.ts, 8, 20), Decl(stringLiteralTypeIsSubtypeOfString.ts, 9, 20)) +>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 10, 12)) + +// errors +function f3(x: 'a'); +>f3 : Symbol(f3, Decl(stringLiteralTypeIsSubtypeOfString.ts, 10, 23), Decl(stringLiteralTypeIsSubtypeOfString.ts, 13, 20), Decl(stringLiteralTypeIsSubtypeOfString.ts, 14, 23)) +>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 13, 12)) + +function f3(x: Object); +>f3 : Symbol(f3, Decl(stringLiteralTypeIsSubtypeOfString.ts, 10, 23), Decl(stringLiteralTypeIsSubtypeOfString.ts, 13, 20), Decl(stringLiteralTypeIsSubtypeOfString.ts, 14, 23)) +>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 14, 12)) +>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) + +function f3(x: any) { } +>f3 : Symbol(f3, Decl(stringLiteralTypeIsSubtypeOfString.ts, 10, 23), Decl(stringLiteralTypeIsSubtypeOfString.ts, 13, 20), Decl(stringLiteralTypeIsSubtypeOfString.ts, 14, 23)) +>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 15, 12)) + +function f4(x: 'a'); +>f4 : Symbol(f4, Decl(stringLiteralTypeIsSubtypeOfString.ts, 15, 23), Decl(stringLiteralTypeIsSubtypeOfString.ts, 17, 20), Decl(stringLiteralTypeIsSubtypeOfString.ts, 18, 19)) +>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 17, 12)) + +function f4(x: {}); +>f4 : Symbol(f4, Decl(stringLiteralTypeIsSubtypeOfString.ts, 15, 23), Decl(stringLiteralTypeIsSubtypeOfString.ts, 17, 20), Decl(stringLiteralTypeIsSubtypeOfString.ts, 18, 19)) +>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 18, 12)) + +function f4(x: any) { } +>f4 : Symbol(f4, Decl(stringLiteralTypeIsSubtypeOfString.ts, 15, 23), Decl(stringLiteralTypeIsSubtypeOfString.ts, 17, 20), Decl(stringLiteralTypeIsSubtypeOfString.ts, 18, 19)) +>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 19, 12)) + +function f5(x: 'a'); +>f5 : Symbol(f5, Decl(stringLiteralTypeIsSubtypeOfString.ts, 19, 23), Decl(stringLiteralTypeIsSubtypeOfString.ts, 21, 20), Decl(stringLiteralTypeIsSubtypeOfString.ts, 22, 23)) +>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 21, 12)) + +function f5(x: number); +>f5 : Symbol(f5, Decl(stringLiteralTypeIsSubtypeOfString.ts, 19, 23), Decl(stringLiteralTypeIsSubtypeOfString.ts, 21, 20), Decl(stringLiteralTypeIsSubtypeOfString.ts, 22, 23)) +>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 22, 12)) + +function f5(x: any) { } +>f5 : Symbol(f5, Decl(stringLiteralTypeIsSubtypeOfString.ts, 19, 23), Decl(stringLiteralTypeIsSubtypeOfString.ts, 21, 20), Decl(stringLiteralTypeIsSubtypeOfString.ts, 22, 23)) +>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 23, 12)) + +function f6(x: 'a'); +>f6 : Symbol(f6, Decl(stringLiteralTypeIsSubtypeOfString.ts, 23, 23), Decl(stringLiteralTypeIsSubtypeOfString.ts, 25, 20), Decl(stringLiteralTypeIsSubtypeOfString.ts, 26, 24)) +>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 25, 12)) + +function f6(x: boolean); +>f6 : Symbol(f6, Decl(stringLiteralTypeIsSubtypeOfString.ts, 23, 23), Decl(stringLiteralTypeIsSubtypeOfString.ts, 25, 20), Decl(stringLiteralTypeIsSubtypeOfString.ts, 26, 24)) +>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 26, 12)) + +function f6(x: any) { } +>f6 : Symbol(f6, Decl(stringLiteralTypeIsSubtypeOfString.ts, 23, 23), Decl(stringLiteralTypeIsSubtypeOfString.ts, 25, 20), Decl(stringLiteralTypeIsSubtypeOfString.ts, 26, 24)) +>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 27, 12)) + +function f7(x: 'a'); +>f7 : Symbol(f7, Decl(stringLiteralTypeIsSubtypeOfString.ts, 27, 23), Decl(stringLiteralTypeIsSubtypeOfString.ts, 29, 20), Decl(stringLiteralTypeIsSubtypeOfString.ts, 30, 21)) +>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 29, 12)) + +function f7(x: Date); +>f7 : Symbol(f7, Decl(stringLiteralTypeIsSubtypeOfString.ts, 27, 23), Decl(stringLiteralTypeIsSubtypeOfString.ts, 29, 20), Decl(stringLiteralTypeIsSubtypeOfString.ts, 30, 21)) +>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 30, 12)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) + +function f7(x: any) { } +>f7 : Symbol(f7, Decl(stringLiteralTypeIsSubtypeOfString.ts, 27, 23), Decl(stringLiteralTypeIsSubtypeOfString.ts, 29, 20), Decl(stringLiteralTypeIsSubtypeOfString.ts, 30, 21)) +>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 31, 12)) + +function f8(x: 'a'); +>f8 : Symbol(f8, Decl(stringLiteralTypeIsSubtypeOfString.ts, 31, 23), Decl(stringLiteralTypeIsSubtypeOfString.ts, 33, 20), Decl(stringLiteralTypeIsSubtypeOfString.ts, 34, 23)) +>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 33, 12)) + +function f8(x: RegExp); +>f8 : Symbol(f8, Decl(stringLiteralTypeIsSubtypeOfString.ts, 31, 23), Decl(stringLiteralTypeIsSubtypeOfString.ts, 33, 20), Decl(stringLiteralTypeIsSubtypeOfString.ts, 34, 23)) +>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 34, 12)) +>RegExp : Symbol(RegExp, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) + +function f8(x: any) { } +>f8 : Symbol(f8, Decl(stringLiteralTypeIsSubtypeOfString.ts, 31, 23), Decl(stringLiteralTypeIsSubtypeOfString.ts, 33, 20), Decl(stringLiteralTypeIsSubtypeOfString.ts, 34, 23)) +>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 35, 12)) + +function f9(x: 'a'); +>f9 : Symbol(f9, Decl(stringLiteralTypeIsSubtypeOfString.ts, 35, 23), Decl(stringLiteralTypeIsSubtypeOfString.ts, 37, 20), Decl(stringLiteralTypeIsSubtypeOfString.ts, 38, 25)) +>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 37, 12)) + +function f9(x: () => {}); +>f9 : Symbol(f9, Decl(stringLiteralTypeIsSubtypeOfString.ts, 35, 23), Decl(stringLiteralTypeIsSubtypeOfString.ts, 37, 20), Decl(stringLiteralTypeIsSubtypeOfString.ts, 38, 25)) +>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 38, 12)) + +function f9(x: any) { } +>f9 : Symbol(f9, Decl(stringLiteralTypeIsSubtypeOfString.ts, 35, 23), Decl(stringLiteralTypeIsSubtypeOfString.ts, 37, 20), Decl(stringLiteralTypeIsSubtypeOfString.ts, 38, 25)) +>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 39, 12)) + +class C implements String { +>C : Symbol(C, Decl(stringLiteralTypeIsSubtypeOfString.ts, 39, 23)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) + + toString(): string { return null; } +>toString : Symbol(C.toString, Decl(stringLiteralTypeIsSubtypeOfString.ts, 41, 27)) + + charAt(pos: number): string { return null; } +>charAt : Symbol(C.charAt, Decl(stringLiteralTypeIsSubtypeOfString.ts, 42, 39)) +>pos : Symbol(pos, Decl(stringLiteralTypeIsSubtypeOfString.ts, 43, 11)) + + charCodeAt(index: number): number { return null; } +>charCodeAt : Symbol(C.charCodeAt, Decl(stringLiteralTypeIsSubtypeOfString.ts, 43, 48)) +>index : Symbol(index, Decl(stringLiteralTypeIsSubtypeOfString.ts, 44, 15)) + + concat(...strings: string[]): string { return null; } +>concat : Symbol(C.concat, Decl(stringLiteralTypeIsSubtypeOfString.ts, 44, 54)) +>strings : Symbol(strings, Decl(stringLiteralTypeIsSubtypeOfString.ts, 45, 11)) + + indexOf(searchString: string, position?: number): number { return null; } +>indexOf : Symbol(C.indexOf, Decl(stringLiteralTypeIsSubtypeOfString.ts, 45, 57)) +>searchString : Symbol(searchString, Decl(stringLiteralTypeIsSubtypeOfString.ts, 46, 12)) +>position : Symbol(position, Decl(stringLiteralTypeIsSubtypeOfString.ts, 46, 33)) + + lastIndexOf(searchString: string, position?: number): number { return null; } +>lastIndexOf : Symbol(C.lastIndexOf, Decl(stringLiteralTypeIsSubtypeOfString.ts, 46, 77)) +>searchString : Symbol(searchString, Decl(stringLiteralTypeIsSubtypeOfString.ts, 47, 16)) +>position : Symbol(position, Decl(stringLiteralTypeIsSubtypeOfString.ts, 47, 37)) + + localeCompare(that: string): number { return null; } +>localeCompare : Symbol(C.localeCompare, Decl(stringLiteralTypeIsSubtypeOfString.ts, 47, 81)) +>that : Symbol(that, Decl(stringLiteralTypeIsSubtypeOfString.ts, 48, 18)) + + match(regexp: any): string[] { return null; } +>match : Symbol(C.match, Decl(stringLiteralTypeIsSubtypeOfString.ts, 48, 56)) +>regexp : Symbol(regexp, Decl(stringLiteralTypeIsSubtypeOfString.ts, 49, 10)) + + replace(searchValue: any, replaceValue: any): string { return null; } +>replace : Symbol(C.replace, Decl(stringLiteralTypeIsSubtypeOfString.ts, 49, 49)) +>searchValue : Symbol(searchValue, Decl(stringLiteralTypeIsSubtypeOfString.ts, 50, 12)) +>replaceValue : Symbol(replaceValue, Decl(stringLiteralTypeIsSubtypeOfString.ts, 50, 29)) + + search(regexp: any): number { return null; } +>search : Symbol(C.search, Decl(stringLiteralTypeIsSubtypeOfString.ts, 50, 73)) +>regexp : Symbol(regexp, Decl(stringLiteralTypeIsSubtypeOfString.ts, 51, 11)) + + slice(start?: number, end?: number): string { return null; } +>slice : Symbol(C.slice, Decl(stringLiteralTypeIsSubtypeOfString.ts, 51, 48)) +>start : Symbol(start, Decl(stringLiteralTypeIsSubtypeOfString.ts, 52, 10)) +>end : Symbol(end, Decl(stringLiteralTypeIsSubtypeOfString.ts, 52, 25)) + + split(separator: any, limit?: number): string[] { return null; } +>split : Symbol(C.split, Decl(stringLiteralTypeIsSubtypeOfString.ts, 52, 64)) +>separator : Symbol(separator, Decl(stringLiteralTypeIsSubtypeOfString.ts, 53, 10)) +>limit : Symbol(limit, Decl(stringLiteralTypeIsSubtypeOfString.ts, 53, 25)) + + substring(start: number, end?: number): string { return null; } +>substring : Symbol(C.substring, Decl(stringLiteralTypeIsSubtypeOfString.ts, 53, 68)) +>start : Symbol(start, Decl(stringLiteralTypeIsSubtypeOfString.ts, 54, 14)) +>end : Symbol(end, Decl(stringLiteralTypeIsSubtypeOfString.ts, 54, 28)) + + toLowerCase(): string { return null; } +>toLowerCase : Symbol(C.toLowerCase, Decl(stringLiteralTypeIsSubtypeOfString.ts, 54, 67)) + + toLocaleLowerCase(): string { return null; } +>toLocaleLowerCase : Symbol(C.toLocaleLowerCase, Decl(stringLiteralTypeIsSubtypeOfString.ts, 55, 42)) + + toUpperCase(): string { return null; } +>toUpperCase : Symbol(C.toUpperCase, Decl(stringLiteralTypeIsSubtypeOfString.ts, 56, 48)) + + toLocaleUpperCase(): string { return null; } +>toLocaleUpperCase : Symbol(C.toLocaleUpperCase, Decl(stringLiteralTypeIsSubtypeOfString.ts, 57, 42)) + + trim(): string { return null; } +>trim : Symbol(C.trim, Decl(stringLiteralTypeIsSubtypeOfString.ts, 58, 48)) + + length: number; +>length : Symbol(C.length, Decl(stringLiteralTypeIsSubtypeOfString.ts, 59, 35)) + + substr(from: number, length?: number): string { return null; } +>substr : Symbol(C.substr, Decl(stringLiteralTypeIsSubtypeOfString.ts, 60, 19)) +>from : Symbol(from, Decl(stringLiteralTypeIsSubtypeOfString.ts, 61, 11)) +>length : Symbol(length, Decl(stringLiteralTypeIsSubtypeOfString.ts, 61, 24)) + + valueOf(): string { return null; } +>valueOf : Symbol(C.valueOf, Decl(stringLiteralTypeIsSubtypeOfString.ts, 61, 66)) + + [index: number]: string; +>index : Symbol(index, Decl(stringLiteralTypeIsSubtypeOfString.ts, 63, 5)) +} + +// BUG 831846 +function f10(x: 'a'); +>f10 : Symbol(f10, Decl(stringLiteralTypeIsSubtypeOfString.ts, 64, 1), Decl(stringLiteralTypeIsSubtypeOfString.ts, 67, 21), Decl(stringLiteralTypeIsSubtypeOfString.ts, 68, 19)) +>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 67, 13)) + +function f10(x: C); +>f10 : Symbol(f10, Decl(stringLiteralTypeIsSubtypeOfString.ts, 64, 1), Decl(stringLiteralTypeIsSubtypeOfString.ts, 67, 21), Decl(stringLiteralTypeIsSubtypeOfString.ts, 68, 19)) +>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 68, 13)) +>C : Symbol(C, Decl(stringLiteralTypeIsSubtypeOfString.ts, 39, 23)) + +function f10(x: any) { } +>f10 : Symbol(f10, Decl(stringLiteralTypeIsSubtypeOfString.ts, 64, 1), Decl(stringLiteralTypeIsSubtypeOfString.ts, 67, 21), Decl(stringLiteralTypeIsSubtypeOfString.ts, 68, 19)) +>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 69, 13)) + +interface I extends String { +>I : Symbol(I, Decl(stringLiteralTypeIsSubtypeOfString.ts, 69, 24)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) + + foo: string; +>foo : Symbol(I.foo, Decl(stringLiteralTypeIsSubtypeOfString.ts, 71, 28)) +} + +// BUG 831846 +function f11(x: 'a'); +>f11 : Symbol(f11, Decl(stringLiteralTypeIsSubtypeOfString.ts, 73, 1), Decl(stringLiteralTypeIsSubtypeOfString.ts, 76, 21), Decl(stringLiteralTypeIsSubtypeOfString.ts, 77, 19)) +>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 76, 13)) + +function f11(x: I); +>f11 : Symbol(f11, Decl(stringLiteralTypeIsSubtypeOfString.ts, 73, 1), Decl(stringLiteralTypeIsSubtypeOfString.ts, 76, 21), Decl(stringLiteralTypeIsSubtypeOfString.ts, 77, 19)) +>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 77, 13)) +>I : Symbol(I, Decl(stringLiteralTypeIsSubtypeOfString.ts, 69, 24)) + +function f11(x: any) { } +>f11 : Symbol(f11, Decl(stringLiteralTypeIsSubtypeOfString.ts, 73, 1), Decl(stringLiteralTypeIsSubtypeOfString.ts, 76, 21), Decl(stringLiteralTypeIsSubtypeOfString.ts, 77, 19)) +>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 78, 13)) + +function f12(x: 'a'); +>f12 : Symbol(f12, Decl(stringLiteralTypeIsSubtypeOfString.ts, 78, 24), Decl(stringLiteralTypeIsSubtypeOfString.ts, 80, 24), Decl(stringLiteralTypeIsSubtypeOfString.ts, 81, 22)) +>T : Symbol(T, Decl(stringLiteralTypeIsSubtypeOfString.ts, 80, 13)) +>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 80, 16)) + +function f12(x: T); +>f12 : Symbol(f12, Decl(stringLiteralTypeIsSubtypeOfString.ts, 78, 24), Decl(stringLiteralTypeIsSubtypeOfString.ts, 80, 24), Decl(stringLiteralTypeIsSubtypeOfString.ts, 81, 22)) +>T : Symbol(T, Decl(stringLiteralTypeIsSubtypeOfString.ts, 81, 13)) +>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 81, 16)) +>T : Symbol(T, Decl(stringLiteralTypeIsSubtypeOfString.ts, 81, 13)) + +function f12(x: any) { } +>f12 : Symbol(f12, Decl(stringLiteralTypeIsSubtypeOfString.ts, 78, 24), Decl(stringLiteralTypeIsSubtypeOfString.ts, 80, 24), Decl(stringLiteralTypeIsSubtypeOfString.ts, 81, 22)) +>T : Symbol(T, Decl(stringLiteralTypeIsSubtypeOfString.ts, 82, 13)) +>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 82, 16)) + +function f13(x: 'a'); +>f13 : Symbol(f13, Decl(stringLiteralTypeIsSubtypeOfString.ts, 82, 27), Decl(stringLiteralTypeIsSubtypeOfString.ts, 84, 39), Decl(stringLiteralTypeIsSubtypeOfString.ts, 85, 37)) +>T : Symbol(T, Decl(stringLiteralTypeIsSubtypeOfString.ts, 84, 13)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 84, 31)) + +function f13(x: T); +>f13 : Symbol(f13, Decl(stringLiteralTypeIsSubtypeOfString.ts, 82, 27), Decl(stringLiteralTypeIsSubtypeOfString.ts, 84, 39), Decl(stringLiteralTypeIsSubtypeOfString.ts, 85, 37)) +>T : Symbol(T, Decl(stringLiteralTypeIsSubtypeOfString.ts, 85, 13)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 85, 31)) +>T : Symbol(T, Decl(stringLiteralTypeIsSubtypeOfString.ts, 85, 13)) + +function f13(x: any) { } +>f13 : Symbol(f13, Decl(stringLiteralTypeIsSubtypeOfString.ts, 82, 27), Decl(stringLiteralTypeIsSubtypeOfString.ts, 84, 39), Decl(stringLiteralTypeIsSubtypeOfString.ts, 85, 37)) +>T : Symbol(T, Decl(stringLiteralTypeIsSubtypeOfString.ts, 86, 13)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 86, 31)) + +enum E { A } +>E : Symbol(E, Decl(stringLiteralTypeIsSubtypeOfString.ts, 86, 42)) +>A : Symbol(E.A, Decl(stringLiteralTypeIsSubtypeOfString.ts, 88, 8)) + +function f14(x: 'a'); +>f14 : Symbol(f14, Decl(stringLiteralTypeIsSubtypeOfString.ts, 88, 12), Decl(stringLiteralTypeIsSubtypeOfString.ts, 89, 21), Decl(stringLiteralTypeIsSubtypeOfString.ts, 90, 19)) +>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 89, 13)) + +function f14(x: E); +>f14 : Symbol(f14, Decl(stringLiteralTypeIsSubtypeOfString.ts, 88, 12), Decl(stringLiteralTypeIsSubtypeOfString.ts, 89, 21), Decl(stringLiteralTypeIsSubtypeOfString.ts, 90, 19)) +>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 90, 13)) +>E : Symbol(E, Decl(stringLiteralTypeIsSubtypeOfString.ts, 86, 42)) + +function f14(x: any) { } +>f14 : Symbol(f14, Decl(stringLiteralTypeIsSubtypeOfString.ts, 88, 12), Decl(stringLiteralTypeIsSubtypeOfString.ts, 89, 21), Decl(stringLiteralTypeIsSubtypeOfString.ts, 90, 19)) +>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 91, 13)) + +function f15(x: 'a'); +>f15 : Symbol(f15, Decl(stringLiteralTypeIsSubtypeOfString.ts, 91, 24), Decl(stringLiteralTypeIsSubtypeOfString.ts, 93, 37), Decl(stringLiteralTypeIsSubtypeOfString.ts, 94, 35)) +>T : Symbol(T, Decl(stringLiteralTypeIsSubtypeOfString.ts, 93, 13)) +>U : Symbol(U, Decl(stringLiteralTypeIsSubtypeOfString.ts, 93, 15)) +>T : Symbol(T, Decl(stringLiteralTypeIsSubtypeOfString.ts, 93, 13)) +>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 93, 29)) + +function f15(x: U); +>f15 : Symbol(f15, Decl(stringLiteralTypeIsSubtypeOfString.ts, 91, 24), Decl(stringLiteralTypeIsSubtypeOfString.ts, 93, 37), Decl(stringLiteralTypeIsSubtypeOfString.ts, 94, 35)) +>T : Symbol(T, Decl(stringLiteralTypeIsSubtypeOfString.ts, 94, 13)) +>U : Symbol(U, Decl(stringLiteralTypeIsSubtypeOfString.ts, 94, 15)) +>T : Symbol(T, Decl(stringLiteralTypeIsSubtypeOfString.ts, 94, 13)) +>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 94, 29)) +>U : Symbol(U, Decl(stringLiteralTypeIsSubtypeOfString.ts, 94, 15)) + +function f15(x: any) { } +>f15 : Symbol(f15, Decl(stringLiteralTypeIsSubtypeOfString.ts, 91, 24), Decl(stringLiteralTypeIsSubtypeOfString.ts, 93, 37), Decl(stringLiteralTypeIsSubtypeOfString.ts, 94, 35)) +>T : Symbol(T, Decl(stringLiteralTypeIsSubtypeOfString.ts, 95, 13)) +>U : Symbol(U, Decl(stringLiteralTypeIsSubtypeOfString.ts, 95, 15)) +>T : Symbol(T, Decl(stringLiteralTypeIsSubtypeOfString.ts, 95, 13)) +>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 95, 29)) + +function f16(x: 'a'); +>f16 : Symbol(f16, Decl(stringLiteralTypeIsSubtypeOfString.ts, 95, 40), Decl(stringLiteralTypeIsSubtypeOfString.ts, 97, 52), Decl(stringLiteralTypeIsSubtypeOfString.ts, 98, 50)) +>T : Symbol(T, Decl(stringLiteralTypeIsSubtypeOfString.ts, 97, 13)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>U : Symbol(U, Decl(stringLiteralTypeIsSubtypeOfString.ts, 97, 30)) +>T : Symbol(T, Decl(stringLiteralTypeIsSubtypeOfString.ts, 97, 13)) +>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 97, 44)) + +function f16(x: U); +>f16 : Symbol(f16, Decl(stringLiteralTypeIsSubtypeOfString.ts, 95, 40), Decl(stringLiteralTypeIsSubtypeOfString.ts, 97, 52), Decl(stringLiteralTypeIsSubtypeOfString.ts, 98, 50)) +>T : Symbol(T, Decl(stringLiteralTypeIsSubtypeOfString.ts, 98, 13)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>U : Symbol(U, Decl(stringLiteralTypeIsSubtypeOfString.ts, 98, 30)) +>T : Symbol(T, Decl(stringLiteralTypeIsSubtypeOfString.ts, 98, 13)) +>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 98, 44)) +>U : Symbol(U, Decl(stringLiteralTypeIsSubtypeOfString.ts, 98, 30)) + +function f16(x: any) { } +>f16 : Symbol(f16, Decl(stringLiteralTypeIsSubtypeOfString.ts, 95, 40), Decl(stringLiteralTypeIsSubtypeOfString.ts, 97, 52), Decl(stringLiteralTypeIsSubtypeOfString.ts, 98, 50)) +>T : Symbol(T, Decl(stringLiteralTypeIsSubtypeOfString.ts, 99, 13)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>U : Symbol(U, Decl(stringLiteralTypeIsSubtypeOfString.ts, 99, 30)) +>T : Symbol(T, Decl(stringLiteralTypeIsSubtypeOfString.ts, 99, 13)) +>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 99, 44)) + diff --git a/tests/baselines/reference/stringLiteralTypeIsSubtypeOfString.types b/tests/baselines/reference/stringLiteralTypeIsSubtypeOfString.types new file mode 100644 index 00000000000..e5185476173 --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypeIsSubtypeOfString.types @@ -0,0 +1,363 @@ +=== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString.ts === +// string literal types are subtypes of string, any + +// ok +function f1(x: 'a'); +>f1 : { (x: "a"): any; (x: string): any; } +>x : "a" + +function f1(x: string); +>f1 : { (x: "a"): any; (x: string): any; } +>x : string + +function f1(x: string) { } +>f1 : { (x: "a"): any; (x: string): any; } +>x : string + +// ok +function f2(x: 'a'); +>f2 : { (x: "a"): any; (x: any): any; } +>x : "a" + +function f2(x: any); +>f2 : { (x: "a"): any; (x: any): any; } +>x : any + +function f2(x: any) { } +>f2 : { (x: "a"): any; (x: any): any; } +>x : any + +// errors +function f3(x: 'a'); +>f3 : { (x: "a"): any; (x: Object): any; } +>x : "a" + +function f3(x: Object); +>f3 : { (x: "a"): any; (x: Object): any; } +>x : Object +>Object : Object + +function f3(x: any) { } +>f3 : { (x: "a"): any; (x: Object): any; } +>x : any + +function f4(x: 'a'); +>f4 : { (x: "a"): any; (x: {}): any; } +>x : "a" + +function f4(x: {}); +>f4 : { (x: "a"): any; (x: {}): any; } +>x : {} + +function f4(x: any) { } +>f4 : { (x: "a"): any; (x: {}): any; } +>x : any + +function f5(x: 'a'); +>f5 : { (x: "a"): any; (x: number): any; } +>x : "a" + +function f5(x: number); +>f5 : { (x: "a"): any; (x: number): any; } +>x : number + +function f5(x: any) { } +>f5 : { (x: "a"): any; (x: number): any; } +>x : any + +function f6(x: 'a'); +>f6 : { (x: "a"): any; (x: boolean): any; } +>x : "a" + +function f6(x: boolean); +>f6 : { (x: "a"): any; (x: boolean): any; } +>x : boolean + +function f6(x: any) { } +>f6 : { (x: "a"): any; (x: boolean): any; } +>x : any + +function f7(x: 'a'); +>f7 : { (x: "a"): any; (x: Date): any; } +>x : "a" + +function f7(x: Date); +>f7 : { (x: "a"): any; (x: Date): any; } +>x : Date +>Date : Date + +function f7(x: any) { } +>f7 : { (x: "a"): any; (x: Date): any; } +>x : any + +function f8(x: 'a'); +>f8 : { (x: "a"): any; (x: RegExp): any; } +>x : "a" + +function f8(x: RegExp); +>f8 : { (x: "a"): any; (x: RegExp): any; } +>x : RegExp +>RegExp : RegExp + +function f8(x: any) { } +>f8 : { (x: "a"): any; (x: RegExp): any; } +>x : any + +function f9(x: 'a'); +>f9 : { (x: "a"): any; (x: () => {}): any; } +>x : "a" + +function f9(x: () => {}); +>f9 : { (x: "a"): any; (x: () => {}): any; } +>x : () => {} + +function f9(x: any) { } +>f9 : { (x: "a"): any; (x: () => {}): any; } +>x : any + +class C implements String { +>C : C +>String : String + + toString(): string { return null; } +>toString : () => string +>null : null + + charAt(pos: number): string { return null; } +>charAt : (pos: number) => string +>pos : number +>null : null + + charCodeAt(index: number): number { return null; } +>charCodeAt : (index: number) => number +>index : number +>null : null + + concat(...strings: string[]): string { return null; } +>concat : (...strings: string[]) => string +>strings : string[] +>null : null + + indexOf(searchString: string, position?: number): number { return null; } +>indexOf : (searchString: string, position?: number) => number +>searchString : string +>position : number +>null : null + + lastIndexOf(searchString: string, position?: number): number { return null; } +>lastIndexOf : (searchString: string, position?: number) => number +>searchString : string +>position : number +>null : null + + localeCompare(that: string): number { return null; } +>localeCompare : (that: string) => number +>that : string +>null : null + + match(regexp: any): string[] { return null; } +>match : (regexp: any) => string[] +>regexp : any +>null : null + + replace(searchValue: any, replaceValue: any): string { return null; } +>replace : (searchValue: any, replaceValue: any) => string +>searchValue : any +>replaceValue : any +>null : null + + search(regexp: any): number { return null; } +>search : (regexp: any) => number +>regexp : any +>null : null + + slice(start?: number, end?: number): string { return null; } +>slice : (start?: number, end?: number) => string +>start : number +>end : number +>null : null + + split(separator: any, limit?: number): string[] { return null; } +>split : (separator: any, limit?: number) => string[] +>separator : any +>limit : number +>null : null + + substring(start: number, end?: number): string { return null; } +>substring : (start: number, end?: number) => string +>start : number +>end : number +>null : null + + toLowerCase(): string { return null; } +>toLowerCase : () => string +>null : null + + toLocaleLowerCase(): string { return null; } +>toLocaleLowerCase : () => string +>null : null + + toUpperCase(): string { return null; } +>toUpperCase : () => string +>null : null + + toLocaleUpperCase(): string { return null; } +>toLocaleUpperCase : () => string +>null : null + + trim(): string { return null; } +>trim : () => string +>null : null + + length: number; +>length : number + + substr(from: number, length?: number): string { return null; } +>substr : (from: number, length?: number) => string +>from : number +>length : number +>null : null + + valueOf(): string { return null; } +>valueOf : () => string +>null : null + + [index: number]: string; +>index : number +} + +// BUG 831846 +function f10(x: 'a'); +>f10 : { (x: "a"): any; (x: C): any; } +>x : "a" + +function f10(x: C); +>f10 : { (x: "a"): any; (x: C): any; } +>x : C +>C : C + +function f10(x: any) { } +>f10 : { (x: "a"): any; (x: C): any; } +>x : any + +interface I extends String { +>I : I +>String : String + + foo: string; +>foo : string +} + +// BUG 831846 +function f11(x: 'a'); +>f11 : { (x: "a"): any; (x: I): any; } +>x : "a" + +function f11(x: I); +>f11 : { (x: "a"): any; (x: I): any; } +>x : I +>I : I + +function f11(x: any) { } +>f11 : { (x: "a"): any; (x: I): any; } +>x : any + +function f12(x: 'a'); +>f12 : { (x: "a"): any; (x: T): any; } +>T : T +>x : "a" + +function f12(x: T); +>f12 : { (x: "a"): any; (x: T): any; } +>T : T +>x : T +>T : T + +function f12(x: any) { } +>f12 : { (x: "a"): any; (x: T): any; } +>T : T +>x : any + +function f13(x: 'a'); +>f13 : { (x: "a"): any; (x: T): any; } +>T : T +>String : String +>x : "a" + +function f13(x: T); +>f13 : { (x: "a"): any; (x: T): any; } +>T : T +>String : String +>x : T +>T : T + +function f13(x: any) { } +>f13 : { (x: "a"): any; (x: T): any; } +>T : T +>String : String +>x : any + +enum E { A } +>E : E +>A : E + +function f14(x: 'a'); +>f14 : { (x: "a"): any; (x: E): any; } +>x : "a" + +function f14(x: E); +>f14 : { (x: "a"): any; (x: E): any; } +>x : E +>E : E + +function f14(x: any) { } +>f14 : { (x: "a"): any; (x: E): any; } +>x : any + +function f15(x: 'a'); +>f15 : { (x: "a"): any; (x: U): any; } +>T : T +>U : U +>T : T +>x : "a" + +function f15(x: U); +>f15 : { (x: "a"): any; (x: U): any; } +>T : T +>U : U +>T : T +>x : U +>U : U + +function f15(x: any) { } +>f15 : { (x: "a"): any; (x: U): any; } +>T : T +>U : U +>T : T +>x : any + +function f16(x: 'a'); +>f16 : { (x: "a"): any; (x: U): any; } +>T : T +>String : String +>U : U +>T : T +>x : "a" + +function f16(x: U); +>f16 : { (x: "a"): any; (x: U): any; } +>T : T +>String : String +>U : U +>T : T +>x : U +>U : U + +function f16(x: any) { } +>f16 : { (x: "a"): any; (x: U): any; } +>T : T +>String : String +>U : U +>T : T +>x : any + diff --git a/tests/baselines/reference/stringLiteralTypesAndTuples01.types b/tests/baselines/reference/stringLiteralTypesAndTuples01.types index c874973e3e5..e8b5b37a2dd 100644 --- a/tests/baselines/reference/stringLiteralTypesAndTuples01.types +++ b/tests/baselines/reference/stringLiteralTypesAndTuples01.types @@ -28,7 +28,7 @@ let [im, a, dinosaur]: ["I'm", "a", RexOrRaptor] = ['I\'m', 'a', 't-rex']; rawr(dinosaur); >rawr(dinosaur) : string >rawr : (dino: "t-rex" | "raptor") => string ->dinosaur : "t-rex" | "raptor" +>dinosaur : "t-rex" function rawr(dino: RexOrRaptor) { >rawr : (dino: "t-rex" | "raptor") => string diff --git a/tests/baselines/reference/stringLiteralTypesAsTags01.symbols b/tests/baselines/reference/stringLiteralTypesAsTags01.symbols index afdeeff71a6..f092e1f7a50 100644 --- a/tests/baselines/reference/stringLiteralTypesAsTags01.symbols +++ b/tests/baselines/reference/stringLiteralTypesAsTags01.symbols @@ -7,7 +7,7 @@ interface Entity { >Entity : Symbol(Entity, Decl(stringLiteralTypesAsTags01.ts, 1, 21)) kind: Kind; ->kind : Symbol(kind, Decl(stringLiteralTypesAsTags01.ts, 3, 18)) +>kind : Symbol(Entity.kind, Decl(stringLiteralTypesAsTags01.ts, 3, 18)) >Kind : Symbol(Kind, Decl(stringLiteralTypesAsTags01.ts, 0, 0)) } @@ -16,10 +16,10 @@ interface A extends Entity { >Entity : Symbol(Entity, Decl(stringLiteralTypesAsTags01.ts, 1, 21)) kind: "A"; ->kind : Symbol(kind, Decl(stringLiteralTypesAsTags01.ts, 7, 28)) +>kind : Symbol(A.kind, Decl(stringLiteralTypesAsTags01.ts, 7, 28)) a: number; ->a : Symbol(a, Decl(stringLiteralTypesAsTags01.ts, 8, 14)) +>a : Symbol(A.a, Decl(stringLiteralTypesAsTags01.ts, 8, 14)) } interface B extends Entity { @@ -27,10 +27,10 @@ interface B extends Entity { >Entity : Symbol(Entity, Decl(stringLiteralTypesAsTags01.ts, 1, 21)) kind: "B"; ->kind : Symbol(kind, Decl(stringLiteralTypesAsTags01.ts, 12, 28)) +>kind : Symbol(B.kind, Decl(stringLiteralTypesAsTags01.ts, 12, 28)) b: string; ->b : Symbol(b, Decl(stringLiteralTypesAsTags01.ts, 13, 14)) +>b : Symbol(B.b, Decl(stringLiteralTypesAsTags01.ts, 13, 14)) } function hasKind(entity: Entity, kind: "A"): entity is A; diff --git a/tests/baselines/reference/stringLiteralTypesAsTags01.types b/tests/baselines/reference/stringLiteralTypesAsTags01.types index 6966ede5482..7b8ac0a8c02 100644 --- a/tests/baselines/reference/stringLiteralTypesAsTags01.types +++ b/tests/baselines/reference/stringLiteralTypesAsTags01.types @@ -88,7 +88,7 @@ let x: A = { } if (hasKind(x, "A")) { ->hasKind(x, "A") : entity is A +>hasKind(x, "A") : boolean >hasKind : { (entity: Entity, kind: "A"): entity is A; (entity: Entity, kind: "B"): entity is B; (entity: Entity, kind: "A" | "B"): entity is Entity; } >x : A >"A" : "A" @@ -105,7 +105,7 @@ else { if (!hasKind(x, "B")) { >!hasKind(x, "B") : boolean ->hasKind(x, "B") : entity is B +>hasKind(x, "B") : boolean >hasKind : { (entity: Entity, kind: "A"): entity is A; (entity: Entity, kind: "B"): entity is B; (entity: Entity, kind: "A" | "B"): entity is Entity; } >x : A >"B" : "B" @@ -116,6 +116,6 @@ if (!hasKind(x, "B")) { } else { let d = x; ->d : A ->x : A +>d : never +>x : never } diff --git a/tests/baselines/reference/stringLiteralTypesAsTags02.errors.txt b/tests/baselines/reference/stringLiteralTypesAsTags02.errors.txt deleted file mode 100644 index 077113632d0..00000000000 --- a/tests/baselines/reference/stringLiteralTypesAsTags02.errors.txt +++ /dev/null @@ -1,50 +0,0 @@ -tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTags02.ts(18,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTags02.ts(19,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. - - -==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTags02.ts (2 errors) ==== - - type Kind = "A" | "B" - - interface Entity { - kind: Kind; - } - - interface A extends Entity { - kind: "A"; - a: number; - } - - interface B extends Entity { - kind: "B"; - b: string; - } - - function hasKind(entity: Entity, kind: "A"): entity is A; - ~~~~~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. - function hasKind(entity: Entity, kind: "B"): entity is B; - ~~~~~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. - function hasKind(entity: Entity, kind: Kind): entity is (A | B) { - return entity.kind === kind; - } - - let x: A = { - kind: "A", - a: 100, - } - - if (hasKind(x, "A")) { - let a = x; - } - else { - let b = x; - } - - if (!hasKind(x, "B")) { - let c = x; - } - else { - let d = x; - } \ No newline at end of file diff --git a/tests/baselines/reference/stringLiteralTypesAsTags02.symbols b/tests/baselines/reference/stringLiteralTypesAsTags02.symbols new file mode 100644 index 00000000000..1cf73015ea7 --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesAsTags02.symbols @@ -0,0 +1,106 @@ +=== tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTags02.ts === + +type Kind = "A" | "B" +>Kind : Symbol(Kind, Decl(stringLiteralTypesAsTags02.ts, 0, 0)) + +interface Entity { +>Entity : Symbol(Entity, Decl(stringLiteralTypesAsTags02.ts, 1, 21)) + + kind: Kind; +>kind : Symbol(Entity.kind, Decl(stringLiteralTypesAsTags02.ts, 3, 18)) +>Kind : Symbol(Kind, Decl(stringLiteralTypesAsTags02.ts, 0, 0)) +} + +interface A extends Entity { +>A : Symbol(A, Decl(stringLiteralTypesAsTags02.ts, 5, 1)) +>Entity : Symbol(Entity, Decl(stringLiteralTypesAsTags02.ts, 1, 21)) + + kind: "A"; +>kind : Symbol(A.kind, Decl(stringLiteralTypesAsTags02.ts, 7, 28)) + + a: number; +>a : Symbol(A.a, Decl(stringLiteralTypesAsTags02.ts, 8, 14)) +} + +interface B extends Entity { +>B : Symbol(B, Decl(stringLiteralTypesAsTags02.ts, 10, 1)) +>Entity : Symbol(Entity, Decl(stringLiteralTypesAsTags02.ts, 1, 21)) + + kind: "B"; +>kind : Symbol(B.kind, Decl(stringLiteralTypesAsTags02.ts, 12, 28)) + + b: string; +>b : Symbol(B.b, Decl(stringLiteralTypesAsTags02.ts, 13, 14)) +} + +function hasKind(entity: Entity, kind: "A"): entity is A; +>hasKind : Symbol(hasKind, Decl(stringLiteralTypesAsTags02.ts, 15, 1), Decl(stringLiteralTypesAsTags02.ts, 17, 57), Decl(stringLiteralTypesAsTags02.ts, 18, 57)) +>entity : Symbol(entity, Decl(stringLiteralTypesAsTags02.ts, 17, 17)) +>Entity : Symbol(Entity, Decl(stringLiteralTypesAsTags02.ts, 1, 21)) +>kind : Symbol(kind, Decl(stringLiteralTypesAsTags02.ts, 17, 32)) +>entity : Symbol(entity, Decl(stringLiteralTypesAsTags02.ts, 17, 17)) +>A : Symbol(A, Decl(stringLiteralTypesAsTags02.ts, 5, 1)) + +function hasKind(entity: Entity, kind: "B"): entity is B; +>hasKind : Symbol(hasKind, Decl(stringLiteralTypesAsTags02.ts, 15, 1), Decl(stringLiteralTypesAsTags02.ts, 17, 57), Decl(stringLiteralTypesAsTags02.ts, 18, 57)) +>entity : Symbol(entity, Decl(stringLiteralTypesAsTags02.ts, 18, 17)) +>Entity : Symbol(Entity, Decl(stringLiteralTypesAsTags02.ts, 1, 21)) +>kind : Symbol(kind, Decl(stringLiteralTypesAsTags02.ts, 18, 32)) +>entity : Symbol(entity, Decl(stringLiteralTypesAsTags02.ts, 18, 17)) +>B : Symbol(B, Decl(stringLiteralTypesAsTags02.ts, 10, 1)) + +function hasKind(entity: Entity, kind: Kind): entity is (A | B) { +>hasKind : Symbol(hasKind, Decl(stringLiteralTypesAsTags02.ts, 15, 1), Decl(stringLiteralTypesAsTags02.ts, 17, 57), Decl(stringLiteralTypesAsTags02.ts, 18, 57)) +>entity : Symbol(entity, Decl(stringLiteralTypesAsTags02.ts, 19, 17)) +>Entity : Symbol(Entity, Decl(stringLiteralTypesAsTags02.ts, 1, 21)) +>kind : Symbol(kind, Decl(stringLiteralTypesAsTags02.ts, 19, 32)) +>Kind : Symbol(Kind, Decl(stringLiteralTypesAsTags02.ts, 0, 0)) +>entity : Symbol(entity, Decl(stringLiteralTypesAsTags02.ts, 19, 17)) +>A : Symbol(A, Decl(stringLiteralTypesAsTags02.ts, 5, 1)) +>B : Symbol(B, Decl(stringLiteralTypesAsTags02.ts, 10, 1)) + + return entity.kind === kind; +>entity.kind : Symbol(Entity.kind, Decl(stringLiteralTypesAsTags02.ts, 3, 18)) +>entity : Symbol(entity, Decl(stringLiteralTypesAsTags02.ts, 19, 17)) +>kind : Symbol(Entity.kind, Decl(stringLiteralTypesAsTags02.ts, 3, 18)) +>kind : Symbol(kind, Decl(stringLiteralTypesAsTags02.ts, 19, 32)) +} + +let x: A = { +>x : Symbol(x, Decl(stringLiteralTypesAsTags02.ts, 23, 3)) +>A : Symbol(A, Decl(stringLiteralTypesAsTags02.ts, 5, 1)) + + kind: "A", +>kind : Symbol(kind, Decl(stringLiteralTypesAsTags02.ts, 23, 12)) + + a: 100, +>a : Symbol(a, Decl(stringLiteralTypesAsTags02.ts, 24, 14)) +} + +if (hasKind(x, "A")) { +>hasKind : Symbol(hasKind, Decl(stringLiteralTypesAsTags02.ts, 15, 1), Decl(stringLiteralTypesAsTags02.ts, 17, 57), Decl(stringLiteralTypesAsTags02.ts, 18, 57)) +>x : Symbol(x, Decl(stringLiteralTypesAsTags02.ts, 23, 3)) + + let a = x; +>a : Symbol(a, Decl(stringLiteralTypesAsTags02.ts, 29, 7)) +>x : Symbol(x, Decl(stringLiteralTypesAsTags02.ts, 23, 3)) +} +else { + let b = x; +>b : Symbol(b, Decl(stringLiteralTypesAsTags02.ts, 32, 7)) +>x : Symbol(x, Decl(stringLiteralTypesAsTags02.ts, 23, 3)) +} + +if (!hasKind(x, "B")) { +>hasKind : Symbol(hasKind, Decl(stringLiteralTypesAsTags02.ts, 15, 1), Decl(stringLiteralTypesAsTags02.ts, 17, 57), Decl(stringLiteralTypesAsTags02.ts, 18, 57)) +>x : Symbol(x, Decl(stringLiteralTypesAsTags02.ts, 23, 3)) + + let c = x; +>c : Symbol(c, Decl(stringLiteralTypesAsTags02.ts, 36, 7)) +>x : Symbol(x, Decl(stringLiteralTypesAsTags02.ts, 23, 3)) +} +else { + let d = x; +>d : Symbol(d, Decl(stringLiteralTypesAsTags02.ts, 39, 7)) +>x : Symbol(x, Decl(stringLiteralTypesAsTags02.ts, 23, 3)) +} diff --git a/tests/baselines/reference/stringLiteralTypesAsTags02.types b/tests/baselines/reference/stringLiteralTypesAsTags02.types new file mode 100644 index 00000000000..290402cd299 --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesAsTags02.types @@ -0,0 +1,115 @@ +=== tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTags02.ts === + +type Kind = "A" | "B" +>Kind : "A" | "B" + +interface Entity { +>Entity : Entity + + kind: Kind; +>kind : "A" | "B" +>Kind : "A" | "B" +} + +interface A extends Entity { +>A : A +>Entity : Entity + + kind: "A"; +>kind : "A" + + a: number; +>a : number +} + +interface B extends Entity { +>B : B +>Entity : Entity + + kind: "B"; +>kind : "B" + + b: string; +>b : string +} + +function hasKind(entity: Entity, kind: "A"): entity is A; +>hasKind : { (entity: Entity, kind: "A"): entity is A; (entity: Entity, kind: "B"): entity is B; } +>entity : Entity +>Entity : Entity +>kind : "A" +>entity : any +>A : A + +function hasKind(entity: Entity, kind: "B"): entity is B; +>hasKind : { (entity: Entity, kind: "A"): entity is A; (entity: Entity, kind: "B"): entity is B; } +>entity : Entity +>Entity : Entity +>kind : "B" +>entity : any +>B : B + +function hasKind(entity: Entity, kind: Kind): entity is (A | B) { +>hasKind : { (entity: Entity, kind: "A"): entity is A; (entity: Entity, kind: "B"): entity is B; } +>entity : Entity +>Entity : Entity +>kind : "A" | "B" +>Kind : "A" | "B" +>entity : any +>A : A +>B : B + + return entity.kind === kind; +>entity.kind === kind : boolean +>entity.kind : "A" | "B" +>entity : Entity +>kind : "A" | "B" +>kind : "A" | "B" +} + +let x: A = { +>x : A +>A : A +>{ kind: "A", a: 100,} : { kind: "A"; a: number; } + + kind: "A", +>kind : "A" +>"A" : "A" + + a: 100, +>a : number +>100 : number +} + +if (hasKind(x, "A")) { +>hasKind(x, "A") : boolean +>hasKind : { (entity: Entity, kind: "A"): entity is A; (entity: Entity, kind: "B"): entity is B; } +>x : A +>"A" : "A" + + let a = x; +>a : A +>x : A +} +else { + let b = x; +>b : A +>x : A +} + +if (!hasKind(x, "B")) { +>!hasKind(x, "B") : boolean +>hasKind(x, "B") : boolean +>hasKind : { (entity: Entity, kind: "A"): entity is A; (entity: Entity, kind: "B"): entity is B; } +>x : A +>"B" : "B" + + let c = x; +>c : A +>x : A +} +else { + let d = x; +>d : never +>x : never +} diff --git a/tests/baselines/reference/stringLiteralTypesAsTags03.symbols b/tests/baselines/reference/stringLiteralTypesAsTags03.symbols index 3694daf8e00..6f7e522d55b 100644 --- a/tests/baselines/reference/stringLiteralTypesAsTags03.symbols +++ b/tests/baselines/reference/stringLiteralTypesAsTags03.symbols @@ -7,7 +7,7 @@ interface Entity { >Entity : Symbol(Entity, Decl(stringLiteralTypesAsTags03.ts, 1, 21)) kind: Kind; ->kind : Symbol(kind, Decl(stringLiteralTypesAsTags03.ts, 3, 18)) +>kind : Symbol(Entity.kind, Decl(stringLiteralTypesAsTags03.ts, 3, 18)) >Kind : Symbol(Kind, Decl(stringLiteralTypesAsTags03.ts, 0, 0)) } @@ -16,10 +16,10 @@ interface A extends Entity { >Entity : Symbol(Entity, Decl(stringLiteralTypesAsTags03.ts, 1, 21)) kind: "A"; ->kind : Symbol(kind, Decl(stringLiteralTypesAsTags03.ts, 7, 28)) +>kind : Symbol(A.kind, Decl(stringLiteralTypesAsTags03.ts, 7, 28)) a: number; ->a : Symbol(a, Decl(stringLiteralTypesAsTags03.ts, 8, 14)) +>a : Symbol(A.a, Decl(stringLiteralTypesAsTags03.ts, 8, 14)) } interface B extends Entity { @@ -27,10 +27,10 @@ interface B extends Entity { >Entity : Symbol(Entity, Decl(stringLiteralTypesAsTags03.ts, 1, 21)) kind: "B"; ->kind : Symbol(kind, Decl(stringLiteralTypesAsTags03.ts, 12, 28)) +>kind : Symbol(B.kind, Decl(stringLiteralTypesAsTags03.ts, 12, 28)) b: string; ->b : Symbol(b, Decl(stringLiteralTypesAsTags03.ts, 13, 14)) +>b : Symbol(B.b, Decl(stringLiteralTypesAsTags03.ts, 13, 14)) } // Currently (2015-12-14), we write '"A" | "A"' and '"B" | "B"' to avoid diff --git a/tests/baselines/reference/stringLiteralTypesAsTags03.types b/tests/baselines/reference/stringLiteralTypesAsTags03.types index a1d83a1c058..9d004982dda 100644 --- a/tests/baselines/reference/stringLiteralTypesAsTags03.types +++ b/tests/baselines/reference/stringLiteralTypesAsTags03.types @@ -85,7 +85,7 @@ let x: A = { } if (hasKind(x, "A")) { ->hasKind(x, "A") : entity is A +>hasKind(x, "A") : boolean >hasKind : { (entity: Entity, kind: "A"): entity is A; (entity: Entity, kind: "B"): entity is B; } >x : A >"A" : "A" @@ -102,7 +102,7 @@ else { if (!hasKind(x, "B")) { >!hasKind(x, "B") : boolean ->hasKind(x, "B") : entity is B +>hasKind(x, "B") : boolean >hasKind : { (entity: Entity, kind: "A"): entity is A; (entity: Entity, kind: "B"): entity is B; } >x : A >"B" : "B" @@ -113,6 +113,6 @@ if (!hasKind(x, "B")) { } else { let d = x; ->d : A ->x : A +>d : never +>x : never } diff --git a/tests/baselines/reference/stringLiteralTypesAsTypeParameterConstraint01.js b/tests/baselines/reference/stringLiteralTypesAsTypeParameterConstraint01.js index 558f6bdf4c2..4f49d326ec0 100644 --- a/tests/baselines/reference/stringLiteralTypesAsTypeParameterConstraint01.js +++ b/tests/baselines/reference/stringLiteralTypesAsTypeParameterConstraint01.js @@ -43,26 +43,3 @@ declare let g: (x: "foo") => "foo"; declare let gResult: "foo"; declare let h: (x: "foo" | "bar") => "foo" | "bar"; declare let hResult: "foo" | "bar"; - - -//// [DtsFileErrors] - - -tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTypeParameterConstraint01.d.ts(3,16): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTypeParameterConstraint01.d.ts(5,16): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. - - -==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTypeParameterConstraint01.d.ts (2 errors) ==== - declare function foo(f: (x: T) => T): (x: T) => T; - declare function bar(f: (x: T) => T): (x: T) => T; - declare let f: (x: "foo") => "foo"; - ~~~~~~~~~~~~~~~~~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. - declare let fResult: "foo"; - declare let g: (x: "foo") => "foo"; - ~~~~~~~~~~~~~~~~~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. - declare let gResult: "foo"; - declare let h: (x: "foo" | "bar") => "foo" | "bar"; - declare let hResult: "foo" | "bar"; - \ No newline at end of file diff --git a/tests/baselines/reference/stringLiteralTypesInImplementationSignatures.errors.txt b/tests/baselines/reference/stringLiteralTypesInImplementationSignatures.errors.txt deleted file mode 100644 index 2bff320197a..00000000000 --- a/tests/baselines/reference/stringLiteralTypesInImplementationSignatures.errors.txt +++ /dev/null @@ -1,62 +0,0 @@ -tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures.ts(3,10): error TS2381: A signature with an implementation cannot use a string literal type. -tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures.ts(4,18): error TS2381: A signature with an implementation cannot use a string literal type. -tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures.ts(5,10): error TS2381: A signature with an implementation cannot use a string literal type. -tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures.ts(8,5): error TS2381: A signature with an implementation cannot use a string literal type. -tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures.ts(12,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures.ts(13,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures.ts(17,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures.ts(18,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures.ts(22,5): error TS2381: A signature with an implementation cannot use a string literal type. -tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures.ts(23,17): error TS2381: A signature with an implementation cannot use a string literal type. -tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures.ts(24,8): error TS2381: A signature with an implementation cannot use a string literal type. - - -==== tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures.ts (11 errors) ==== - // String literal types are only valid in overload signatures - - function foo(x: 'hi') { } - ~~~ -!!! error TS2381: A signature with an implementation cannot use a string literal type. - var f = function foo(x: 'hi') { } - ~~~ -!!! error TS2381: A signature with an implementation cannot use a string literal type. - var f2 = (x: 'hi', y: 'hi') => { } - ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2381: A signature with an implementation cannot use a string literal type. - - class C { - foo(x: 'hi') { } - ~~~ -!!! error TS2381: A signature with an implementation cannot use a string literal type. - } - - interface I { - (x: 'hi'); - ~~~~~~~~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. - foo(x: 'hi', y: 'hi'); - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. - } - - var a: { - (x: 'hi'); - ~~~~~~~~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. - foo(x: 'hi'); - ~~~~~~~~~~~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. - } - - var b = { - foo(x: 'hi') { }, - ~~~ -!!! error TS2381: A signature with an implementation cannot use a string literal type. - a: function foo(x: 'hi', y: 'hi') { }, - ~~~ -!!! error TS2381: A signature with an implementation cannot use a string literal type. - b: (x: 'hi') => { } - ~~~~~~~~~~~~~~~~ -!!! error TS2381: A signature with an implementation cannot use a string literal type. - } - \ No newline at end of file diff --git a/tests/baselines/reference/stringLiteralTypesInImplementationSignatures.symbols b/tests/baselines/reference/stringLiteralTypesInImplementationSignatures.symbols new file mode 100644 index 00000000000..769ba4715f8 --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesInImplementationSignatures.symbols @@ -0,0 +1,66 @@ +=== tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures.ts === +// String literal types are only valid in overload signatures + +function foo(x: 'hi') { } +>foo : Symbol(foo, Decl(stringLiteralTypesInImplementationSignatures.ts, 0, 0)) +>x : Symbol(x, Decl(stringLiteralTypesInImplementationSignatures.ts, 2, 13)) + +var f = function foo(x: 'hi') { } +>f : Symbol(f, Decl(stringLiteralTypesInImplementationSignatures.ts, 3, 3)) +>foo : Symbol(foo, Decl(stringLiteralTypesInImplementationSignatures.ts, 3, 7)) +>x : Symbol(x, Decl(stringLiteralTypesInImplementationSignatures.ts, 3, 21)) + +var f2 = (x: 'hi', y: 'hi') => { } +>f2 : Symbol(f2, Decl(stringLiteralTypesInImplementationSignatures.ts, 4, 3)) +>x : Symbol(x, Decl(stringLiteralTypesInImplementationSignatures.ts, 4, 10)) +>y : Symbol(y, Decl(stringLiteralTypesInImplementationSignatures.ts, 4, 18)) + +class C { +>C : Symbol(C, Decl(stringLiteralTypesInImplementationSignatures.ts, 4, 34)) + + foo(x: 'hi') { } +>foo : Symbol(C.foo, Decl(stringLiteralTypesInImplementationSignatures.ts, 6, 9)) +>x : Symbol(x, Decl(stringLiteralTypesInImplementationSignatures.ts, 7, 8)) +} + +interface I { +>I : Symbol(I, Decl(stringLiteralTypesInImplementationSignatures.ts, 8, 1)) + + (x: 'hi'); +>x : Symbol(x, Decl(stringLiteralTypesInImplementationSignatures.ts, 11, 5)) + + foo(x: 'hi', y: 'hi'); +>foo : Symbol(I.foo, Decl(stringLiteralTypesInImplementationSignatures.ts, 11, 14)) +>x : Symbol(x, Decl(stringLiteralTypesInImplementationSignatures.ts, 12, 8)) +>y : Symbol(y, Decl(stringLiteralTypesInImplementationSignatures.ts, 12, 16)) +} + +var a: { +>a : Symbol(a, Decl(stringLiteralTypesInImplementationSignatures.ts, 15, 3)) + + (x: 'hi'); +>x : Symbol(x, Decl(stringLiteralTypesInImplementationSignatures.ts, 16, 5)) + + foo(x: 'hi'); +>foo : Symbol(foo, Decl(stringLiteralTypesInImplementationSignatures.ts, 16, 14)) +>x : Symbol(x, Decl(stringLiteralTypesInImplementationSignatures.ts, 17, 8)) +} + +var b = { +>b : Symbol(b, Decl(stringLiteralTypesInImplementationSignatures.ts, 20, 3)) + + foo(x: 'hi') { }, +>foo : Symbol(foo, Decl(stringLiteralTypesInImplementationSignatures.ts, 20, 9)) +>x : Symbol(x, Decl(stringLiteralTypesInImplementationSignatures.ts, 21, 8)) + + a: function foo(x: 'hi', y: 'hi') { }, +>a : Symbol(a, Decl(stringLiteralTypesInImplementationSignatures.ts, 21, 21)) +>foo : Symbol(foo, Decl(stringLiteralTypesInImplementationSignatures.ts, 22, 6)) +>x : Symbol(x, Decl(stringLiteralTypesInImplementationSignatures.ts, 22, 20)) +>y : Symbol(y, Decl(stringLiteralTypesInImplementationSignatures.ts, 22, 28)) + + b: (x: 'hi') => { } +>b : Symbol(b, Decl(stringLiteralTypesInImplementationSignatures.ts, 22, 42)) +>x : Symbol(x, Decl(stringLiteralTypesInImplementationSignatures.ts, 23, 8)) +} + diff --git a/tests/baselines/reference/stringLiteralTypesInImplementationSignatures.types b/tests/baselines/reference/stringLiteralTypesInImplementationSignatures.types new file mode 100644 index 00000000000..356d19fce3a --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesInImplementationSignatures.types @@ -0,0 +1,71 @@ +=== tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures.ts === +// String literal types are only valid in overload signatures + +function foo(x: 'hi') { } +>foo : (x: "hi") => void +>x : "hi" + +var f = function foo(x: 'hi') { } +>f : (x: "hi") => void +>function foo(x: 'hi') { } : (x: "hi") => void +>foo : (x: "hi") => void +>x : "hi" + +var f2 = (x: 'hi', y: 'hi') => { } +>f2 : (x: "hi", y: "hi") => void +>(x: 'hi', y: 'hi') => { } : (x: "hi", y: "hi") => void +>x : "hi" +>y : "hi" + +class C { +>C : C + + foo(x: 'hi') { } +>foo : (x: "hi") => void +>x : "hi" +} + +interface I { +>I : I + + (x: 'hi'); +>x : "hi" + + foo(x: 'hi', y: 'hi'); +>foo : (x: "hi", y: "hi") => any +>x : "hi" +>y : "hi" +} + +var a: { +>a : { (x: "hi"): any; foo(x: "hi"): any; } + + (x: 'hi'); +>x : "hi" + + foo(x: 'hi'); +>foo : (x: "hi") => any +>x : "hi" +} + +var b = { +>b : { foo(x: "hi"): void; a: (x: "hi", y: "hi") => void; b: (x: "hi") => void; } +>{ foo(x: 'hi') { }, a: function foo(x: 'hi', y: 'hi') { }, b: (x: 'hi') => { }} : { foo(x: "hi"): void; a: (x: "hi", y: "hi") => void; b: (x: "hi") => void; } + + foo(x: 'hi') { }, +>foo : (x: "hi") => void +>x : "hi" + + a: function foo(x: 'hi', y: 'hi') { }, +>a : (x: "hi", y: "hi") => void +>function foo(x: 'hi', y: 'hi') { } : (x: "hi", y: "hi") => void +>foo : (x: "hi", y: "hi") => void +>x : "hi" +>y : "hi" + + b: (x: 'hi') => { } +>b : (x: "hi") => void +>(x: 'hi') => { } : (x: "hi") => void +>x : "hi" +} + diff --git a/tests/baselines/reference/stringLiteralTypesInImplementationSignatures2.errors.txt b/tests/baselines/reference/stringLiteralTypesInImplementationSignatures2.errors.txt index 4f94bad7441..b0ab5010ea5 100644 --- a/tests/baselines/reference/stringLiteralTypesInImplementationSignatures2.errors.txt +++ b/tests/baselines/reference/stringLiteralTypesInImplementationSignatures2.errors.txt @@ -1,74 +1,38 @@ -tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures2.ts(4,10): error TS2381: A signature with an implementation cannot use a string literal type. -tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures2.ts(8,5): error TS2381: A signature with an implementation cannot use a string literal type. -tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures2.ts(12,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures2.ts(13,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures2.ts(14,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures2.ts(15,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures2.ts(19,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures2.ts(20,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures2.ts(21,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures2.ts(22,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures2.ts(26,5): error TS2300: Duplicate identifier 'foo'. -tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures2.ts(26,5): error TS2381: A signature with an implementation cannot use a string literal type. tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures2.ts(27,5): error TS2300: Duplicate identifier 'foo'. -tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures2.ts(27,5): error TS2381: A signature with an implementation cannot use a string literal type. -==== tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures2.ts (14 errors) ==== +==== tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures2.ts (2 errors) ==== // String literal types are only valid in overload signatures function foo(x: any); function foo(x: 'hi') { } - ~~~ -!!! error TS2381: A signature with an implementation cannot use a string literal type. class C { foo(x: string); foo(x: 'hi') { } - ~~~ -!!! error TS2381: A signature with an implementation cannot use a string literal type. } interface I { (x: 'a'); - ~~~~~~~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. (x: 'hi'); - ~~~~~~~~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. foo(x: 'a', y: 'a'); - ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. foo(x: 'hi', y: 'hi'); - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. } var a: { (x: 'hi'); - ~~~~~~~~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. (x: 'a'); - ~~~~~~~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. foo(x: 'hi'); - ~~~~~~~~~~~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. foo(x: 'a'); - ~~~~~~~~~~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. } var b = { foo(x: 'hi') { }, ~~~ !!! error TS2300: Duplicate identifier 'foo'. - ~~~ -!!! error TS2381: A signature with an implementation cannot use a string literal type. foo(x: 'a') { }, ~~~ !!! error TS2300: Duplicate identifier 'foo'. - ~~~ -!!! error TS2381: A signature with an implementation cannot use a string literal type. } \ No newline at end of file diff --git a/tests/baselines/reference/stringLiteralTypesInUnionTypes01.js b/tests/baselines/reference/stringLiteralTypesInUnionTypes01.js index d970310d68e..bdf06d393aa 100644 --- a/tests/baselines/reference/stringLiteralTypesInUnionTypes01.js +++ b/tests/baselines/reference/stringLiteralTypesInUnionTypes01.js @@ -2,8 +2,8 @@ type T = "foo" | "bar" | "baz"; -var x: "foo" | "bar" | "baz" = "foo"; -var y: T = "bar"; +var x: "foo" | "bar" | "baz" = undefined; +var y: T = undefined; if (x === "foo") { let a = x; @@ -21,8 +21,8 @@ x = y; y = x; //// [stringLiteralTypesInUnionTypes01.js] -var x = "foo"; -var y = "bar"; +var x = undefined; +var y = undefined; if (x === "foo") { var a = x; } diff --git a/tests/baselines/reference/stringLiteralTypesInUnionTypes01.symbols b/tests/baselines/reference/stringLiteralTypesInUnionTypes01.symbols index c608929383e..15a8db13cd0 100644 --- a/tests/baselines/reference/stringLiteralTypesInUnionTypes01.symbols +++ b/tests/baselines/reference/stringLiteralTypesInUnionTypes01.symbols @@ -3,12 +3,14 @@ type T = "foo" | "bar" | "baz"; >T : Symbol(T, Decl(stringLiteralTypesInUnionTypes01.ts, 0, 0)) -var x: "foo" | "bar" | "baz" = "foo"; +var x: "foo" | "bar" | "baz" = undefined; >x : Symbol(x, Decl(stringLiteralTypesInUnionTypes01.ts, 3, 3)) +>undefined : Symbol(undefined) -var y: T = "bar"; +var y: T = undefined; >y : Symbol(y, Decl(stringLiteralTypesInUnionTypes01.ts, 4, 3)) >T : Symbol(T, Decl(stringLiteralTypesInUnionTypes01.ts, 0, 0)) +>undefined : Symbol(undefined) if (x === "foo") { >x : Symbol(x, Decl(stringLiteralTypesInUnionTypes01.ts, 3, 3)) diff --git a/tests/baselines/reference/stringLiteralTypesInUnionTypes01.types b/tests/baselines/reference/stringLiteralTypesInUnionTypes01.types index e5ff509822b..7201aaa91ca 100644 --- a/tests/baselines/reference/stringLiteralTypesInUnionTypes01.types +++ b/tests/baselines/reference/stringLiteralTypesInUnionTypes01.types @@ -3,14 +3,14 @@ type T = "foo" | "bar" | "baz"; >T : "foo" | "bar" | "baz" -var x: "foo" | "bar" | "baz" = "foo"; +var x: "foo" | "bar" | "baz" = undefined; >x : "foo" | "bar" | "baz" ->"foo" : "foo" +>undefined : undefined -var y: T = "bar"; +var y: T = undefined; >y : "foo" | "bar" | "baz" >T : "foo" | "bar" | "baz" ->"bar" : "bar" +>undefined : undefined if (x === "foo") { >x === "foo" : boolean diff --git a/tests/baselines/reference/stringLiteralTypesInUnionTypes02.js b/tests/baselines/reference/stringLiteralTypesInUnionTypes02.js index 19b9c837c9d..bca25e744c9 100644 --- a/tests/baselines/reference/stringLiteralTypesInUnionTypes02.js +++ b/tests/baselines/reference/stringLiteralTypesInUnionTypes02.js @@ -2,8 +2,8 @@ type T = string | "foo" | "bar" | "baz"; -var x: "foo" | "bar" | "baz" | string = "foo"; -var y: T = "bar"; +var x: "foo" | "bar" | "baz" | string = undefined; +var y: T = undefined; if (x === "foo") { let a = x; @@ -21,8 +21,8 @@ x = y; y = x; //// [stringLiteralTypesInUnionTypes02.js] -var x = "foo"; -var y = "bar"; +var x = undefined; +var y = undefined; if (x === "foo") { var a = x; } diff --git a/tests/baselines/reference/stringLiteralTypesInUnionTypes02.symbols b/tests/baselines/reference/stringLiteralTypesInUnionTypes02.symbols index c9b31dc710a..c35b7a0691b 100644 --- a/tests/baselines/reference/stringLiteralTypesInUnionTypes02.symbols +++ b/tests/baselines/reference/stringLiteralTypesInUnionTypes02.symbols @@ -3,12 +3,14 @@ type T = string | "foo" | "bar" | "baz"; >T : Symbol(T, Decl(stringLiteralTypesInUnionTypes02.ts, 0, 0)) -var x: "foo" | "bar" | "baz" | string = "foo"; +var x: "foo" | "bar" | "baz" | string = undefined; >x : Symbol(x, Decl(stringLiteralTypesInUnionTypes02.ts, 3, 3)) +>undefined : Symbol(undefined) -var y: T = "bar"; +var y: T = undefined; >y : Symbol(y, Decl(stringLiteralTypesInUnionTypes02.ts, 4, 3)) >T : Symbol(T, Decl(stringLiteralTypesInUnionTypes02.ts, 0, 0)) +>undefined : Symbol(undefined) if (x === "foo") { >x : Symbol(x, Decl(stringLiteralTypesInUnionTypes02.ts, 3, 3)) diff --git a/tests/baselines/reference/stringLiteralTypesInUnionTypes02.types b/tests/baselines/reference/stringLiteralTypesInUnionTypes02.types index b468c620376..242248617e0 100644 --- a/tests/baselines/reference/stringLiteralTypesInUnionTypes02.types +++ b/tests/baselines/reference/stringLiteralTypesInUnionTypes02.types @@ -3,60 +3,60 @@ type T = string | "foo" | "bar" | "baz"; >T : string | "foo" | "bar" | "baz" -var x: "foo" | "bar" | "baz" | string = "foo"; +var x: "foo" | "bar" | "baz" | string = undefined; >x : "foo" | "bar" | "baz" | string ->"foo" : "foo" +>undefined : undefined -var y: T = "bar"; +var y: T = undefined; >y : string | "foo" | "bar" | "baz" >T : string | "foo" | "bar" | "baz" ->"bar" : "bar" +>undefined : undefined if (x === "foo") { >x === "foo" : boolean ->x : "foo" | "bar" | "baz" | string +>x : string >"foo" : string let a = x; ->a : "foo" | "bar" | "baz" | string ->x : "foo" | "bar" | "baz" | string +>a : string +>x : string } else if (x !== "bar") { >x !== "bar" : boolean ->x : "foo" | "bar" | "baz" | string +>x : string >"bar" : string let b = x || y; >b : string >x || y : string ->x : "foo" | "bar" | "baz" | string ->y : string | "foo" | "bar" | "baz" +>x : string +>y : string } else { let c = x; ->c : "foo" | "bar" | "baz" | string ->x : "foo" | "bar" | "baz" | string +>c : string +>x : string let d = y; ->d : string | "foo" | "bar" | "baz" ->y : string | "foo" | "bar" | "baz" +>d : string +>y : string let e: (typeof x) | (typeof y) = c || d; ->e : "foo" | "bar" | "baz" | string ->x : "foo" | "bar" | "baz" | string ->y : string | "foo" | "bar" | "baz" +>e : string +>x : string +>y : string >c || d : string ->c : "foo" | "bar" | "baz" | string ->d : string | "foo" | "bar" | "baz" +>c : string +>d : string } x = y; ->x = y : string | "foo" | "bar" | "baz" +>x = y : string >x : "foo" | "bar" | "baz" | string ->y : string | "foo" | "bar" | "baz" +>y : string y = x; ->y = x : "foo" | "bar" | "baz" | string +>y = x : string >y : string | "foo" | "bar" | "baz" ->x : "foo" | "bar" | "baz" | string +>x : string diff --git a/tests/baselines/reference/stringLiteralTypesInUnionTypes03.js b/tests/baselines/reference/stringLiteralTypesInUnionTypes03.js index f6728e0b2fb..6264c99c13d 100644 --- a/tests/baselines/reference/stringLiteralTypesInUnionTypes03.js +++ b/tests/baselines/reference/stringLiteralTypesInUnionTypes03.js @@ -3,7 +3,7 @@ type T = number | "foo" | "bar"; var x: "foo" | "bar" | number; -var y: T = "bar"; +var y: T = undefined; if (x === "foo") { let a = x; @@ -22,7 +22,7 @@ y = x; //// [stringLiteralTypesInUnionTypes03.js] var x; -var y = "bar"; +var y = undefined; if (x === "foo") { var a = x; } diff --git a/tests/baselines/reference/stringLiteralTypesInUnionTypes03.symbols b/tests/baselines/reference/stringLiteralTypesInUnionTypes03.symbols index df5498d9a59..6d519e24225 100644 --- a/tests/baselines/reference/stringLiteralTypesInUnionTypes03.symbols +++ b/tests/baselines/reference/stringLiteralTypesInUnionTypes03.symbols @@ -6,9 +6,10 @@ type T = number | "foo" | "bar"; var x: "foo" | "bar" | number; >x : Symbol(x, Decl(stringLiteralTypesInUnionTypes03.ts, 3, 3)) -var y: T = "bar"; +var y: T = undefined; >y : Symbol(y, Decl(stringLiteralTypesInUnionTypes03.ts, 4, 3)) >T : Symbol(T, Decl(stringLiteralTypesInUnionTypes03.ts, 0, 0)) +>undefined : Symbol(undefined) if (x === "foo") { >x : Symbol(x, Decl(stringLiteralTypesInUnionTypes03.ts, 3, 3)) diff --git a/tests/baselines/reference/stringLiteralTypesInUnionTypes03.types b/tests/baselines/reference/stringLiteralTypesInUnionTypes03.types index 5fca6e69be9..920f7e1a71c 100644 --- a/tests/baselines/reference/stringLiteralTypesInUnionTypes03.types +++ b/tests/baselines/reference/stringLiteralTypesInUnionTypes03.types @@ -6,10 +6,10 @@ type T = number | "foo" | "bar"; var x: "foo" | "bar" | number; >x : "foo" | "bar" | number -var y: T = "bar"; +var y: T = undefined; >y : number | "foo" | "bar" >T : number | "foo" | "bar" ->"bar" : "bar" +>undefined : undefined if (x === "foo") { >x === "foo" : boolean diff --git a/tests/baselines/reference/stringLiteralTypesInUnionTypes04.js b/tests/baselines/reference/stringLiteralTypesInUnionTypes04.js index dc6cf51ad1e..85c9a30c49d 100644 --- a/tests/baselines/reference/stringLiteralTypesInUnionTypes04.js +++ b/tests/baselines/reference/stringLiteralTypesInUnionTypes04.js @@ -2,8 +2,8 @@ type T = "" | "foo"; -let x: T = ""; -let y: T = "foo"; +let x: T = undefined; +let y: T = undefined; if (x === "") { let a = x; @@ -38,8 +38,8 @@ if (!!!x) { } //// [stringLiteralTypesInUnionTypes04.js] -var x = ""; -var y = "foo"; +var x = undefined; +var y = undefined; if (x === "") { var a = x; } diff --git a/tests/baselines/reference/stringLiteralTypesInUnionTypes04.symbols b/tests/baselines/reference/stringLiteralTypesInUnionTypes04.symbols index ced93fcefc9..9904fa8613f 100644 --- a/tests/baselines/reference/stringLiteralTypesInUnionTypes04.symbols +++ b/tests/baselines/reference/stringLiteralTypesInUnionTypes04.symbols @@ -3,13 +3,15 @@ type T = "" | "foo"; >T : Symbol(T, Decl(stringLiteralTypesInUnionTypes04.ts, 0, 0)) -let x: T = ""; +let x: T = undefined; >x : Symbol(x, Decl(stringLiteralTypesInUnionTypes04.ts, 3, 3)) >T : Symbol(T, Decl(stringLiteralTypesInUnionTypes04.ts, 0, 0)) +>undefined : Symbol(undefined) -let y: T = "foo"; +let y: T = undefined; >y : Symbol(y, Decl(stringLiteralTypesInUnionTypes04.ts, 4, 3)) >T : Symbol(T, Decl(stringLiteralTypesInUnionTypes04.ts, 0, 0)) +>undefined : Symbol(undefined) if (x === "") { >x : Symbol(x, Decl(stringLiteralTypesInUnionTypes04.ts, 3, 3)) diff --git a/tests/baselines/reference/stringLiteralTypesInUnionTypes04.types b/tests/baselines/reference/stringLiteralTypesInUnionTypes04.types index ad92dc360d0..fdaaa21b6cb 100644 --- a/tests/baselines/reference/stringLiteralTypesInUnionTypes04.types +++ b/tests/baselines/reference/stringLiteralTypesInUnionTypes04.types @@ -3,15 +3,15 @@ type T = "" | "foo"; >T : "" | "foo" -let x: T = ""; +let x: T = undefined; >x : "" | "foo" >T : "" | "foo" ->"" : "" +>undefined : undefined -let y: T = "foo"; +let y: T = undefined; >y : "" | "foo" >T : "" | "foo" ->"foo" : "foo" +>undefined : undefined if (x === "") { >x === "" : boolean diff --git a/tests/baselines/reference/stringLiteralTypesOverloadAssignability01.errors.txt b/tests/baselines/reference/stringLiteralTypesOverloadAssignability01.errors.txt new file mode 100644 index 00000000000..8010b31a9d0 --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesOverloadAssignability01.errors.txt @@ -0,0 +1,33 @@ +tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloadAssignability01.ts(15,1): error TS2322: Type '(x: "bar") => number' is not assignable to type '(x: "foo") => number'. + Types of parameters 'x' and 'x' are incompatible. + Type '"foo"' is not assignable to type '"bar"'. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloadAssignability01.ts(16,1): error TS2322: Type '(x: "foo") => number' is not assignable to type '(x: "bar") => number'. + Types of parameters 'x' and 'x' are incompatible. + Type '"bar"' is not assignable to type '"foo"'. + + +==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloadAssignability01.ts (2 errors) ==== + + function f(x: "foo"): number; + function f(x: string): number { + return 0; + } + + function g(x: "bar"): number; + function g(x: string): number { + return 0; + } + + let a = f; + let b = g; + + a = b; + ~ +!!! error TS2322: Type '(x: "bar") => number' is not assignable to type '(x: "foo") => number'. +!!! error TS2322: Types of parameters 'x' and 'x' are incompatible. +!!! error TS2322: Type '"foo"' is not assignable to type '"bar"'. + b = a; + ~ +!!! error TS2322: Type '(x: "foo") => number' is not assignable to type '(x: "bar") => number'. +!!! error TS2322: Types of parameters 'x' and 'x' are incompatible. +!!! error TS2322: Type '"bar"' is not assignable to type '"foo"'. \ No newline at end of file diff --git a/tests/baselines/reference/stringLiteralTypesOverloadAssignability01.js b/tests/baselines/reference/stringLiteralTypesOverloadAssignability01.js new file mode 100644 index 00000000000..7b7c84165f3 --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesOverloadAssignability01.js @@ -0,0 +1,36 @@ +//// [stringLiteralTypesOverloadAssignability01.ts] + +function f(x: "foo"): number; +function f(x: string): number { + return 0; +} + +function g(x: "bar"): number; +function g(x: string): number { + return 0; +} + +let a = f; +let b = g; + +a = b; +b = a; + +//// [stringLiteralTypesOverloadAssignability01.js] +function f(x) { + return 0; +} +function g(x) { + return 0; +} +var a = f; +var b = g; +a = b; +b = a; + + +//// [stringLiteralTypesOverloadAssignability01.d.ts] +declare function f(x: "foo"): number; +declare function g(x: "bar"): number; +declare let a: typeof f; +declare let b: typeof g; diff --git a/tests/baselines/reference/stringLiteralTypesOverloadAssignability02.errors.txt b/tests/baselines/reference/stringLiteralTypesOverloadAssignability02.errors.txt new file mode 100644 index 00000000000..8fe5a676aab --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesOverloadAssignability02.errors.txt @@ -0,0 +1,33 @@ +tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloadAssignability02.ts(15,1): error TS2322: Type '(x: "bar") => number' is not assignable to type '(x: "foo") => number'. + Types of parameters 'x' and 'x' are incompatible. + Type '"foo"' is not assignable to type '"bar"'. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloadAssignability02.ts(16,1): error TS2322: Type '(x: "foo") => number' is not assignable to type '(x: "bar") => number'. + Types of parameters 'x' and 'x' are incompatible. + Type '"bar"' is not assignable to type '"foo"'. + + +==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloadAssignability02.ts (2 errors) ==== + + function f(x: "foo"): number; + function f(x: "foo"): number { + return 0; + } + + function g(x: "bar"): number; + function g(x: "bar"): number { + return 0; + } + + let a = f; + let b = g; + + a = b; + ~ +!!! error TS2322: Type '(x: "bar") => number' is not assignable to type '(x: "foo") => number'. +!!! error TS2322: Types of parameters 'x' and 'x' are incompatible. +!!! error TS2322: Type '"foo"' is not assignable to type '"bar"'. + b = a; + ~ +!!! error TS2322: Type '(x: "foo") => number' is not assignable to type '(x: "bar") => number'. +!!! error TS2322: Types of parameters 'x' and 'x' are incompatible. +!!! error TS2322: Type '"bar"' is not assignable to type '"foo"'. \ No newline at end of file diff --git a/tests/baselines/reference/stringLiteralTypesOverloadAssignability02.js b/tests/baselines/reference/stringLiteralTypesOverloadAssignability02.js new file mode 100644 index 00000000000..7a8db4722a6 --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesOverloadAssignability02.js @@ -0,0 +1,36 @@ +//// [stringLiteralTypesOverloadAssignability02.ts] + +function f(x: "foo"): number; +function f(x: "foo"): number { + return 0; +} + +function g(x: "bar"): number; +function g(x: "bar"): number { + return 0; +} + +let a = f; +let b = g; + +a = b; +b = a; + +//// [stringLiteralTypesOverloadAssignability02.js] +function f(x) { + return 0; +} +function g(x) { + return 0; +} +var a = f; +var b = g; +a = b; +b = a; + + +//// [stringLiteralTypesOverloadAssignability02.d.ts] +declare function f(x: "foo"): number; +declare function g(x: "bar"): number; +declare let a: typeof f; +declare let b: typeof g; diff --git a/tests/baselines/reference/stringLiteralTypesOverloadAssignability03.js b/tests/baselines/reference/stringLiteralTypesOverloadAssignability03.js new file mode 100644 index 00000000000..1d9452a9c65 --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesOverloadAssignability03.js @@ -0,0 +1,36 @@ +//// [stringLiteralTypesOverloadAssignability03.ts] + +function f(x: "foo"): number; +function f(x: string): number { + return 0; +} + +function g(x: "foo"): number; +function g(x: string): number { + return 0; +} + +let a = f; +let b = g; + +a = b; +b = a; + +//// [stringLiteralTypesOverloadAssignability03.js] +function f(x) { + return 0; +} +function g(x) { + return 0; +} +var a = f; +var b = g; +a = b; +b = a; + + +//// [stringLiteralTypesOverloadAssignability03.d.ts] +declare function f(x: "foo"): number; +declare function g(x: "foo"): number; +declare let a: typeof f; +declare let b: typeof g; diff --git a/tests/baselines/reference/stringLiteralTypesOverloadAssignability03.symbols b/tests/baselines/reference/stringLiteralTypesOverloadAssignability03.symbols new file mode 100644 index 00000000000..361f9e9db4d --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesOverloadAssignability03.symbols @@ -0,0 +1,40 @@ +=== tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloadAssignability03.ts === + +function f(x: "foo"): number; +>f : Symbol(f, Decl(stringLiteralTypesOverloadAssignability03.ts, 0, 0), Decl(stringLiteralTypesOverloadAssignability03.ts, 1, 29)) +>x : Symbol(x, Decl(stringLiteralTypesOverloadAssignability03.ts, 1, 11)) + +function f(x: string): number { +>f : Symbol(f, Decl(stringLiteralTypesOverloadAssignability03.ts, 0, 0), Decl(stringLiteralTypesOverloadAssignability03.ts, 1, 29)) +>x : Symbol(x, Decl(stringLiteralTypesOverloadAssignability03.ts, 2, 11)) + + return 0; +} + +function g(x: "foo"): number; +>g : Symbol(g, Decl(stringLiteralTypesOverloadAssignability03.ts, 4, 1), Decl(stringLiteralTypesOverloadAssignability03.ts, 6, 29)) +>x : Symbol(x, Decl(stringLiteralTypesOverloadAssignability03.ts, 6, 11)) + +function g(x: string): number { +>g : Symbol(g, Decl(stringLiteralTypesOverloadAssignability03.ts, 4, 1), Decl(stringLiteralTypesOverloadAssignability03.ts, 6, 29)) +>x : Symbol(x, Decl(stringLiteralTypesOverloadAssignability03.ts, 7, 11)) + + return 0; +} + +let a = f; +>a : Symbol(a, Decl(stringLiteralTypesOverloadAssignability03.ts, 11, 3)) +>f : Symbol(f, Decl(stringLiteralTypesOverloadAssignability03.ts, 0, 0), Decl(stringLiteralTypesOverloadAssignability03.ts, 1, 29)) + +let b = g; +>b : Symbol(b, Decl(stringLiteralTypesOverloadAssignability03.ts, 12, 3)) +>g : Symbol(g, Decl(stringLiteralTypesOverloadAssignability03.ts, 4, 1), Decl(stringLiteralTypesOverloadAssignability03.ts, 6, 29)) + +a = b; +>a : Symbol(a, Decl(stringLiteralTypesOverloadAssignability03.ts, 11, 3)) +>b : Symbol(b, Decl(stringLiteralTypesOverloadAssignability03.ts, 12, 3)) + +b = a; +>b : Symbol(b, Decl(stringLiteralTypesOverloadAssignability03.ts, 12, 3)) +>a : Symbol(a, Decl(stringLiteralTypesOverloadAssignability03.ts, 11, 3)) + diff --git a/tests/baselines/reference/stringLiteralTypesOverloadAssignability03.types b/tests/baselines/reference/stringLiteralTypesOverloadAssignability03.types new file mode 100644 index 00000000000..8150eedd7b8 --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesOverloadAssignability03.types @@ -0,0 +1,44 @@ +=== tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloadAssignability03.ts === + +function f(x: "foo"): number; +>f : (x: "foo") => number +>x : "foo" + +function f(x: string): number { +>f : (x: "foo") => number +>x : string + + return 0; +>0 : number +} + +function g(x: "foo"): number; +>g : (x: "foo") => number +>x : "foo" + +function g(x: string): number { +>g : (x: "foo") => number +>x : string + + return 0; +>0 : number +} + +let a = f; +>a : (x: "foo") => number +>f : (x: "foo") => number + +let b = g; +>b : (x: "foo") => number +>g : (x: "foo") => number + +a = b; +>a = b : (x: "foo") => number +>a : (x: "foo") => number +>b : (x: "foo") => number + +b = a; +>b = a : (x: "foo") => number +>b : (x: "foo") => number +>a : (x: "foo") => number + diff --git a/tests/baselines/reference/stringLiteralTypesOverloadAssignability04.js b/tests/baselines/reference/stringLiteralTypesOverloadAssignability04.js new file mode 100644 index 00000000000..975c7d80cb5 --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesOverloadAssignability04.js @@ -0,0 +1,36 @@ +//// [stringLiteralTypesOverloadAssignability04.ts] + +function f(x: "foo"): number; +function f(x: "foo"): number { + return 0; +} + +function g(x: "foo"): number; +function g(x: "foo"): number { + return 0; +} + +let a = f; +let b = g; + +a = b; +b = a; + +//// [stringLiteralTypesOverloadAssignability04.js] +function f(x) { + return 0; +} +function g(x) { + return 0; +} +var a = f; +var b = g; +a = b; +b = a; + + +//// [stringLiteralTypesOverloadAssignability04.d.ts] +declare function f(x: "foo"): number; +declare function g(x: "foo"): number; +declare let a: typeof f; +declare let b: typeof g; diff --git a/tests/baselines/reference/stringLiteralTypesOverloadAssignability04.symbols b/tests/baselines/reference/stringLiteralTypesOverloadAssignability04.symbols new file mode 100644 index 00000000000..75f7d12c25f --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesOverloadAssignability04.symbols @@ -0,0 +1,40 @@ +=== tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloadAssignability04.ts === + +function f(x: "foo"): number; +>f : Symbol(f, Decl(stringLiteralTypesOverloadAssignability04.ts, 0, 0), Decl(stringLiteralTypesOverloadAssignability04.ts, 1, 29)) +>x : Symbol(x, Decl(stringLiteralTypesOverloadAssignability04.ts, 1, 11)) + +function f(x: "foo"): number { +>f : Symbol(f, Decl(stringLiteralTypesOverloadAssignability04.ts, 0, 0), Decl(stringLiteralTypesOverloadAssignability04.ts, 1, 29)) +>x : Symbol(x, Decl(stringLiteralTypesOverloadAssignability04.ts, 2, 11)) + + return 0; +} + +function g(x: "foo"): number; +>g : Symbol(g, Decl(stringLiteralTypesOverloadAssignability04.ts, 4, 1), Decl(stringLiteralTypesOverloadAssignability04.ts, 6, 29)) +>x : Symbol(x, Decl(stringLiteralTypesOverloadAssignability04.ts, 6, 11)) + +function g(x: "foo"): number { +>g : Symbol(g, Decl(stringLiteralTypesOverloadAssignability04.ts, 4, 1), Decl(stringLiteralTypesOverloadAssignability04.ts, 6, 29)) +>x : Symbol(x, Decl(stringLiteralTypesOverloadAssignability04.ts, 7, 11)) + + return 0; +} + +let a = f; +>a : Symbol(a, Decl(stringLiteralTypesOverloadAssignability04.ts, 11, 3)) +>f : Symbol(f, Decl(stringLiteralTypesOverloadAssignability04.ts, 0, 0), Decl(stringLiteralTypesOverloadAssignability04.ts, 1, 29)) + +let b = g; +>b : Symbol(b, Decl(stringLiteralTypesOverloadAssignability04.ts, 12, 3)) +>g : Symbol(g, Decl(stringLiteralTypesOverloadAssignability04.ts, 4, 1), Decl(stringLiteralTypesOverloadAssignability04.ts, 6, 29)) + +a = b; +>a : Symbol(a, Decl(stringLiteralTypesOverloadAssignability04.ts, 11, 3)) +>b : Symbol(b, Decl(stringLiteralTypesOverloadAssignability04.ts, 12, 3)) + +b = a; +>b : Symbol(b, Decl(stringLiteralTypesOverloadAssignability04.ts, 12, 3)) +>a : Symbol(a, Decl(stringLiteralTypesOverloadAssignability04.ts, 11, 3)) + diff --git a/tests/baselines/reference/stringLiteralTypesOverloadAssignability04.types b/tests/baselines/reference/stringLiteralTypesOverloadAssignability04.types new file mode 100644 index 00000000000..7187e276fe4 --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesOverloadAssignability04.types @@ -0,0 +1,44 @@ +=== tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloadAssignability04.ts === + +function f(x: "foo"): number; +>f : (x: "foo") => number +>x : "foo" + +function f(x: "foo"): number { +>f : (x: "foo") => number +>x : "foo" + + return 0; +>0 : number +} + +function g(x: "foo"): number; +>g : (x: "foo") => number +>x : "foo" + +function g(x: "foo"): number { +>g : (x: "foo") => number +>x : "foo" + + return 0; +>0 : number +} + +let a = f; +>a : (x: "foo") => number +>f : (x: "foo") => number + +let b = g; +>b : (x: "foo") => number +>g : (x: "foo") => number + +a = b; +>a = b : (x: "foo") => number +>a : (x: "foo") => number +>b : (x: "foo") => number + +b = a; +>b = a : (x: "foo") => number +>b : (x: "foo") => number +>a : (x: "foo") => number + diff --git a/tests/baselines/reference/stringLiteralTypesOverloadAssignability05.js b/tests/baselines/reference/stringLiteralTypesOverloadAssignability05.js new file mode 100644 index 00000000000..b08dbc04082 --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesOverloadAssignability05.js @@ -0,0 +1,38 @@ +//// [stringLiteralTypesOverloadAssignability05.ts] + +function f(x: "foo"): number; +function f(x: string): number; +function f(x: string): number { + return 0; +} + +function g(x: "foo"): number; +function g(x: string): number { + return 0; +} + +let a = f; +let b = g; + +a = b; +b = a; + +//// [stringLiteralTypesOverloadAssignability05.js] +function f(x) { + return 0; +} +function g(x) { + return 0; +} +var a = f; +var b = g; +a = b; +b = a; + + +//// [stringLiteralTypesOverloadAssignability05.d.ts] +declare function f(x: "foo"): number; +declare function f(x: string): number; +declare function g(x: "foo"): number; +declare let a: typeof f; +declare let b: typeof g; diff --git a/tests/baselines/reference/stringLiteralTypesOverloadAssignability05.symbols b/tests/baselines/reference/stringLiteralTypesOverloadAssignability05.symbols new file mode 100644 index 00000000000..9a59a7c929a --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesOverloadAssignability05.symbols @@ -0,0 +1,44 @@ +=== tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloadAssignability05.ts === + +function f(x: "foo"): number; +>f : Symbol(f, Decl(stringLiteralTypesOverloadAssignability05.ts, 0, 0), Decl(stringLiteralTypesOverloadAssignability05.ts, 1, 29), Decl(stringLiteralTypesOverloadAssignability05.ts, 2, 30)) +>x : Symbol(x, Decl(stringLiteralTypesOverloadAssignability05.ts, 1, 11)) + +function f(x: string): number; +>f : Symbol(f, Decl(stringLiteralTypesOverloadAssignability05.ts, 0, 0), Decl(stringLiteralTypesOverloadAssignability05.ts, 1, 29), Decl(stringLiteralTypesOverloadAssignability05.ts, 2, 30)) +>x : Symbol(x, Decl(stringLiteralTypesOverloadAssignability05.ts, 2, 11)) + +function f(x: string): number { +>f : Symbol(f, Decl(stringLiteralTypesOverloadAssignability05.ts, 0, 0), Decl(stringLiteralTypesOverloadAssignability05.ts, 1, 29), Decl(stringLiteralTypesOverloadAssignability05.ts, 2, 30)) +>x : Symbol(x, Decl(stringLiteralTypesOverloadAssignability05.ts, 3, 11)) + + return 0; +} + +function g(x: "foo"): number; +>g : Symbol(g, Decl(stringLiteralTypesOverloadAssignability05.ts, 5, 1), Decl(stringLiteralTypesOverloadAssignability05.ts, 7, 29)) +>x : Symbol(x, Decl(stringLiteralTypesOverloadAssignability05.ts, 7, 11)) + +function g(x: string): number { +>g : Symbol(g, Decl(stringLiteralTypesOverloadAssignability05.ts, 5, 1), Decl(stringLiteralTypesOverloadAssignability05.ts, 7, 29)) +>x : Symbol(x, Decl(stringLiteralTypesOverloadAssignability05.ts, 8, 11)) + + return 0; +} + +let a = f; +>a : Symbol(a, Decl(stringLiteralTypesOverloadAssignability05.ts, 12, 3)) +>f : Symbol(f, Decl(stringLiteralTypesOverloadAssignability05.ts, 0, 0), Decl(stringLiteralTypesOverloadAssignability05.ts, 1, 29), Decl(stringLiteralTypesOverloadAssignability05.ts, 2, 30)) + +let b = g; +>b : Symbol(b, Decl(stringLiteralTypesOverloadAssignability05.ts, 13, 3)) +>g : Symbol(g, Decl(stringLiteralTypesOverloadAssignability05.ts, 5, 1), Decl(stringLiteralTypesOverloadAssignability05.ts, 7, 29)) + +a = b; +>a : Symbol(a, Decl(stringLiteralTypesOverloadAssignability05.ts, 12, 3)) +>b : Symbol(b, Decl(stringLiteralTypesOverloadAssignability05.ts, 13, 3)) + +b = a; +>b : Symbol(b, Decl(stringLiteralTypesOverloadAssignability05.ts, 13, 3)) +>a : Symbol(a, Decl(stringLiteralTypesOverloadAssignability05.ts, 12, 3)) + diff --git a/tests/baselines/reference/stringLiteralTypesOverloadAssignability05.types b/tests/baselines/reference/stringLiteralTypesOverloadAssignability05.types new file mode 100644 index 00000000000..b7dd9262a67 --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesOverloadAssignability05.types @@ -0,0 +1,48 @@ +=== tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloadAssignability05.ts === + +function f(x: "foo"): number; +>f : { (x: "foo"): number; (x: string): number; } +>x : "foo" + +function f(x: string): number; +>f : { (x: "foo"): number; (x: string): number; } +>x : string + +function f(x: string): number { +>f : { (x: "foo"): number; (x: string): number; } +>x : string + + return 0; +>0 : number +} + +function g(x: "foo"): number; +>g : (x: "foo") => number +>x : "foo" + +function g(x: string): number { +>g : (x: "foo") => number +>x : string + + return 0; +>0 : number +} + +let a = f; +>a : { (x: "foo"): number; (x: string): number; } +>f : { (x: "foo"): number; (x: string): number; } + +let b = g; +>b : (x: "foo") => number +>g : (x: "foo") => number + +a = b; +>a = b : (x: "foo") => number +>a : { (x: "foo"): number; (x: string): number; } +>b : (x: "foo") => number + +b = a; +>b = a : { (x: "foo"): number; (x: string): number; } +>b : (x: "foo") => number +>a : { (x: "foo"): number; (x: string): number; } + diff --git a/tests/baselines/reference/stringLiteralTypesOverloads03.symbols b/tests/baselines/reference/stringLiteralTypesOverloads03.symbols index a0a48de790f..277cc7e84e3 100644 --- a/tests/baselines/reference/stringLiteralTypesOverloads03.symbols +++ b/tests/baselines/reference/stringLiteralTypesOverloads03.symbols @@ -4,10 +4,10 @@ interface Base { >Base : Symbol(Base, Decl(stringLiteralTypesOverloads03.ts, 0, 0)) x: string; ->x : Symbol(x, Decl(stringLiteralTypesOverloads03.ts, 1, 16)) +>x : Symbol(Base.x, Decl(stringLiteralTypesOverloads03.ts, 1, 16)) y: number; ->y : Symbol(y, Decl(stringLiteralTypesOverloads03.ts, 2, 14)) +>y : Symbol(Base.y, Decl(stringLiteralTypesOverloads03.ts, 2, 14)) } interface HelloOrWorld extends Base { @@ -15,7 +15,7 @@ interface HelloOrWorld extends Base { >Base : Symbol(Base, Decl(stringLiteralTypesOverloads03.ts, 0, 0)) p1: boolean; ->p1 : Symbol(p1, Decl(stringLiteralTypesOverloads03.ts, 6, 37)) +>p1 : Symbol(HelloOrWorld.p1, Decl(stringLiteralTypesOverloads03.ts, 6, 37)) } interface JustHello extends Base { @@ -23,7 +23,7 @@ interface JustHello extends Base { >Base : Symbol(Base, Decl(stringLiteralTypesOverloads03.ts, 0, 0)) p2: boolean; ->p2 : Symbol(p2, Decl(stringLiteralTypesOverloads03.ts, 10, 34)) +>p2 : Symbol(JustHello.p2, Decl(stringLiteralTypesOverloads03.ts, 10, 34)) } interface JustWorld extends Base { @@ -31,7 +31,7 @@ interface JustWorld extends Base { >Base : Symbol(Base, Decl(stringLiteralTypesOverloads03.ts, 0, 0)) p3: boolean; ->p3 : Symbol(p3, Decl(stringLiteralTypesOverloads03.ts, 14, 34)) +>p3 : Symbol(JustWorld.p3, Decl(stringLiteralTypesOverloads03.ts, 14, 34)) } let hello: "hello"; diff --git a/tests/baselines/reference/stringLiteralTypesOverloads05.errors.txt b/tests/baselines/reference/stringLiteralTypesOverloads05.errors.txt new file mode 100644 index 00000000000..e57327ab0e0 --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesOverloads05.errors.txt @@ -0,0 +1,18 @@ +tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads05.ts(7,10): error TS2394: Overload signature is not compatible with function implementation. + + +==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads05.ts (1 errors) ==== + + interface Animal { animal: {} }; + interface Dog extends Animal { dog: {} } + interface Cat extends Animal { cat: {} } + interface Moose extends Animal { moose: {} } + + function doThing(x: "dog"): Dog; + ~~~~~~~ +!!! error TS2394: Overload signature is not compatible with function implementation. + function doThing(x: "cat"): Cat; + function doThing(x: string): Animal; + function doThing(x: string, y?: string): Moose { + return undefined; + } \ No newline at end of file diff --git a/tests/baselines/reference/stringLiteralTypesOverloads05.js b/tests/baselines/reference/stringLiteralTypesOverloads05.js new file mode 100644 index 00000000000..23be3dac1e1 --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesOverloads05.js @@ -0,0 +1,37 @@ +//// [stringLiteralTypesOverloads05.ts] + +interface Animal { animal: {} }; +interface Dog extends Animal { dog: {} } +interface Cat extends Animal { cat: {} } +interface Moose extends Animal { moose: {} } + +function doThing(x: "dog"): Dog; +function doThing(x: "cat"): Cat; +function doThing(x: string): Animal; +function doThing(x: string, y?: string): Moose { + return undefined; +} + +//// [stringLiteralTypesOverloads05.js] +; +function doThing(x, y) { + return undefined; +} + + +//// [stringLiteralTypesOverloads05.d.ts] +interface Animal { + animal: {}; +} +interface Dog extends Animal { + dog: {}; +} +interface Cat extends Animal { + cat: {}; +} +interface Moose extends Animal { + moose: {}; +} +declare function doThing(x: "dog"): Dog; +declare function doThing(x: "cat"): Cat; +declare function doThing(x: string): Animal; diff --git a/tests/baselines/reference/stringLiteralTypesTypePredicates01.errors.txt b/tests/baselines/reference/stringLiteralTypesTypePredicates01.errors.txt deleted file mode 100644 index b888c3ca77e..00000000000 --- a/tests/baselines/reference/stringLiteralTypesTypePredicates01.errors.txt +++ /dev/null @@ -1,33 +0,0 @@ -tests/cases/conformance/types/stringLiteral/stringLiteralTypesTypePredicates01.ts(4,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesTypePredicates01.ts(5,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. - - -==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesTypePredicates01.ts (2 errors) ==== - - type Kind = "A" | "B" - - function kindIs(kind: Kind, is: "A"): kind is "A"; - ~~~~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. - function kindIs(kind: Kind, is: "B"): kind is "B"; - ~~~~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. - function kindIs(kind: Kind, is: Kind): boolean { - return kind === is; - } - - var x: Kind = "A"; - - if (kindIs(x, "A")) { - let a = x; - } - else { - let b = x; - } - - if (!kindIs(x, "B")) { - let c = x; - } - else { - let d = x; - } \ No newline at end of file diff --git a/tests/baselines/reference/stringLiteralTypesTypePredicates01.js b/tests/baselines/reference/stringLiteralTypesTypePredicates01.js index fd4129d272d..fdd03c83aa5 100644 --- a/tests/baselines/reference/stringLiteralTypesTypePredicates01.js +++ b/tests/baselines/reference/stringLiteralTypesTypePredicates01.js @@ -8,7 +8,7 @@ function kindIs(kind: Kind, is: Kind): boolean { return kind === is; } -var x: Kind = "A"; +var x: Kind = undefined; if (kindIs(x, "A")) { let a = x; @@ -28,7 +28,7 @@ else { function kindIs(kind, is) { return kind === is; } -var x = "A"; +var x = undefined; if (kindIs(x, "A")) { var a = x; } diff --git a/tests/baselines/reference/stringLiteralTypesTypePredicates01.symbols b/tests/baselines/reference/stringLiteralTypesTypePredicates01.symbols new file mode 100644 index 00000000000..aea8c6ac262 --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesTypePredicates01.symbols @@ -0,0 +1,63 @@ +=== tests/cases/conformance/types/stringLiteral/stringLiteralTypesTypePredicates01.ts === + +type Kind = "A" | "B" +>Kind : Symbol(Kind, Decl(stringLiteralTypesTypePredicates01.ts, 0, 0)) + +function kindIs(kind: Kind, is: "A"): kind is "A"; +>kindIs : Symbol(kindIs, Decl(stringLiteralTypesTypePredicates01.ts, 1, 21), Decl(stringLiteralTypesTypePredicates01.ts, 3, 50), Decl(stringLiteralTypesTypePredicates01.ts, 4, 50)) +>kind : Symbol(kind, Decl(stringLiteralTypesTypePredicates01.ts, 3, 16)) +>Kind : Symbol(Kind, Decl(stringLiteralTypesTypePredicates01.ts, 0, 0)) +>is : Symbol(is, Decl(stringLiteralTypesTypePredicates01.ts, 3, 27)) +>kind : Symbol(kind, Decl(stringLiteralTypesTypePredicates01.ts, 3, 16)) + +function kindIs(kind: Kind, is: "B"): kind is "B"; +>kindIs : Symbol(kindIs, Decl(stringLiteralTypesTypePredicates01.ts, 1, 21), Decl(stringLiteralTypesTypePredicates01.ts, 3, 50), Decl(stringLiteralTypesTypePredicates01.ts, 4, 50)) +>kind : Symbol(kind, Decl(stringLiteralTypesTypePredicates01.ts, 4, 16)) +>Kind : Symbol(Kind, Decl(stringLiteralTypesTypePredicates01.ts, 0, 0)) +>is : Symbol(is, Decl(stringLiteralTypesTypePredicates01.ts, 4, 27)) +>kind : Symbol(kind, Decl(stringLiteralTypesTypePredicates01.ts, 4, 16)) + +function kindIs(kind: Kind, is: Kind): boolean { +>kindIs : Symbol(kindIs, Decl(stringLiteralTypesTypePredicates01.ts, 1, 21), Decl(stringLiteralTypesTypePredicates01.ts, 3, 50), Decl(stringLiteralTypesTypePredicates01.ts, 4, 50)) +>kind : Symbol(kind, Decl(stringLiteralTypesTypePredicates01.ts, 5, 16)) +>Kind : Symbol(Kind, Decl(stringLiteralTypesTypePredicates01.ts, 0, 0)) +>is : Symbol(is, Decl(stringLiteralTypesTypePredicates01.ts, 5, 27)) +>Kind : Symbol(Kind, Decl(stringLiteralTypesTypePredicates01.ts, 0, 0)) + + return kind === is; +>kind : Symbol(kind, Decl(stringLiteralTypesTypePredicates01.ts, 5, 16)) +>is : Symbol(is, Decl(stringLiteralTypesTypePredicates01.ts, 5, 27)) +} + +var x: Kind = undefined; +>x : Symbol(x, Decl(stringLiteralTypesTypePredicates01.ts, 9, 3)) +>Kind : Symbol(Kind, Decl(stringLiteralTypesTypePredicates01.ts, 0, 0)) +>undefined : Symbol(undefined) + +if (kindIs(x, "A")) { +>kindIs : Symbol(kindIs, Decl(stringLiteralTypesTypePredicates01.ts, 1, 21), Decl(stringLiteralTypesTypePredicates01.ts, 3, 50), Decl(stringLiteralTypesTypePredicates01.ts, 4, 50)) +>x : Symbol(x, Decl(stringLiteralTypesTypePredicates01.ts, 9, 3)) + + let a = x; +>a : Symbol(a, Decl(stringLiteralTypesTypePredicates01.ts, 12, 7)) +>x : Symbol(x, Decl(stringLiteralTypesTypePredicates01.ts, 9, 3)) +} +else { + let b = x; +>b : Symbol(b, Decl(stringLiteralTypesTypePredicates01.ts, 15, 7)) +>x : Symbol(x, Decl(stringLiteralTypesTypePredicates01.ts, 9, 3)) +} + +if (!kindIs(x, "B")) { +>kindIs : Symbol(kindIs, Decl(stringLiteralTypesTypePredicates01.ts, 1, 21), Decl(stringLiteralTypesTypePredicates01.ts, 3, 50), Decl(stringLiteralTypesTypePredicates01.ts, 4, 50)) +>x : Symbol(x, Decl(stringLiteralTypesTypePredicates01.ts, 9, 3)) + + let c = x; +>c : Symbol(c, Decl(stringLiteralTypesTypePredicates01.ts, 19, 7)) +>x : Symbol(x, Decl(stringLiteralTypesTypePredicates01.ts, 9, 3)) +} +else { + let d = x; +>d : Symbol(d, Decl(stringLiteralTypesTypePredicates01.ts, 22, 7)) +>x : Symbol(x, Decl(stringLiteralTypesTypePredicates01.ts, 9, 3)) +} diff --git a/tests/baselines/reference/stringLiteralTypesTypePredicates01.types b/tests/baselines/reference/stringLiteralTypesTypePredicates01.types new file mode 100644 index 00000000000..4a765ea5312 --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesTypePredicates01.types @@ -0,0 +1,69 @@ +=== tests/cases/conformance/types/stringLiteral/stringLiteralTypesTypePredicates01.ts === + +type Kind = "A" | "B" +>Kind : "A" | "B" + +function kindIs(kind: Kind, is: "A"): kind is "A"; +>kindIs : { (kind: "A" | "B", is: "A"): kind is "A"; (kind: "A" | "B", is: "B"): kind is "B"; } +>kind : "A" | "B" +>Kind : "A" | "B" +>is : "A" +>kind : any + +function kindIs(kind: Kind, is: "B"): kind is "B"; +>kindIs : { (kind: "A" | "B", is: "A"): kind is "A"; (kind: "A" | "B", is: "B"): kind is "B"; } +>kind : "A" | "B" +>Kind : "A" | "B" +>is : "B" +>kind : any + +function kindIs(kind: Kind, is: Kind): boolean { +>kindIs : { (kind: "A" | "B", is: "A"): kind is "A"; (kind: "A" | "B", is: "B"): kind is "B"; } +>kind : "A" | "B" +>Kind : "A" | "B" +>is : "A" | "B" +>Kind : "A" | "B" + + return kind === is; +>kind === is : boolean +>kind : "A" | "B" +>is : "A" | "B" +} + +var x: Kind = undefined; +>x : "A" | "B" +>Kind : "A" | "B" +>undefined : undefined + +if (kindIs(x, "A")) { +>kindIs(x, "A") : boolean +>kindIs : { (kind: "A" | "B", is: "A"): kind is "A"; (kind: "A" | "B", is: "B"): kind is "B"; } +>x : "A" | "B" +>"A" : "A" + + let a = x; +>a : "A" +>x : "A" +} +else { + let b = x; +>b : "B" +>x : "B" +} + +if (!kindIs(x, "B")) { +>!kindIs(x, "B") : boolean +>kindIs(x, "B") : boolean +>kindIs : { (kind: "A" | "B", is: "A"): kind is "A"; (kind: "A" | "B", is: "B"): kind is "B"; } +>x : "A" | "B" +>"B" : "B" + + let c = x; +>c : "A" +>x : "A" +} +else { + let d = x; +>d : "B" +>x : "B" +} diff --git a/tests/baselines/reference/stringLiteralTypesWithVariousOperators02.errors.txt b/tests/baselines/reference/stringLiteralTypesWithVariousOperators02.errors.txt index 69dd6c2f6a9..92afe67df0c 100644 --- a/tests/baselines/reference/stringLiteralTypesWithVariousOperators02.errors.txt +++ b/tests/baselines/reference/stringLiteralTypesWithVariousOperators02.errors.txt @@ -7,9 +7,12 @@ tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperato tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(13,11): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(14,9): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(15,9): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(16,9): error TS2365: Operator '<' cannot be applied to types '"ABC"' and '"XYZ"'. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(17,9): error TS2365: Operator '===' cannot be applied to types '"ABC"' and '"XYZ"'. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(18,9): error TS2365: Operator '!=' cannot be applied to types '"ABC"' and '"XYZ"'. -==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts (9 errors) ==== +==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts (12 errors) ==== let abc: "ABC" = "ABC"; let xyz: "XYZ" = "XYZ"; @@ -44,5 +47,11 @@ tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperato ~~~~~~~~~~~~~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. let j = abc < xyz; + ~~~~~~~~~ +!!! error TS2365: Operator '<' cannot be applied to types '"ABC"' and '"XYZ"'. let k = abc === xyz; - let l = abc != xyz; \ No newline at end of file + ~~~~~~~~~~~ +!!! error TS2365: Operator '===' cannot be applied to types '"ABC"' and '"XYZ"'. + let l = abc != xyz; + ~~~~~~~~~~ +!!! error TS2365: Operator '!=' cannot be applied to types '"ABC"' and '"XYZ"'. \ No newline at end of file diff --git a/tests/baselines/reference/stringNamedPropertyAccess.symbols b/tests/baselines/reference/stringNamedPropertyAccess.symbols index 583e5da06ed..961b03f6e04 100644 --- a/tests/baselines/reference/stringNamedPropertyAccess.symbols +++ b/tests/baselines/reference/stringNamedPropertyAccess.symbols @@ -12,12 +12,12 @@ var c: C; var r1 = c["a b"]; >r1 : Symbol(r1, Decl(stringNamedPropertyAccess.ts, 5, 3)) >c : Symbol(c, Decl(stringNamedPropertyAccess.ts, 4, 3)) ->"a b" : Symbol(C."a b", Decl(stringNamedPropertyAccess.ts, 0, 9)) +>"a b" : Symbol(C["a b"], Decl(stringNamedPropertyAccess.ts, 0, 9)) var r1b = C['c d']; >r1b : Symbol(r1b, Decl(stringNamedPropertyAccess.ts, 6, 3)) >C : Symbol(C, Decl(stringNamedPropertyAccess.ts, 0, 0)) ->'c d' : Symbol(C."c d", Decl(stringNamedPropertyAccess.ts, 1, 18)) +>'c d' : Symbol(C["c d"], Decl(stringNamedPropertyAccess.ts, 1, 18)) interface I { >I : Symbol(I, Decl(stringNamedPropertyAccess.ts, 6, 19)) @@ -31,7 +31,7 @@ var i: I; var r2 = i["a b"]; >r2 : Symbol(r2, Decl(stringNamedPropertyAccess.ts, 12, 3)) >i : Symbol(i, Decl(stringNamedPropertyAccess.ts, 11, 3)) ->"a b" : Symbol(I."a b", Decl(stringNamedPropertyAccess.ts, 8, 13)) +>"a b" : Symbol(I["a b"], Decl(stringNamedPropertyAccess.ts, 8, 13)) var a: { >a : Symbol(a, Decl(stringNamedPropertyAccess.ts, 14, 3)) diff --git a/tests/baselines/reference/stripInternal1.symbols b/tests/baselines/reference/stripInternal1.symbols index 2a71c1d9dbd..dd53f671bc9 100644 --- a/tests/baselines/reference/stripInternal1.symbols +++ b/tests/baselines/reference/stripInternal1.symbols @@ -4,9 +4,9 @@ class C { >C : Symbol(C, Decl(stripInternal1.ts, 0, 0)) foo(): void { } ->foo : Symbol(foo, Decl(stripInternal1.ts, 1, 9)) +>foo : Symbol(C.foo, Decl(stripInternal1.ts, 1, 9)) // @internal bar(): void { } ->bar : Symbol(bar, Decl(stripInternal1.ts, 2, 17)) +>bar : Symbol(C.bar, Decl(stripInternal1.ts, 2, 17)) } diff --git a/tests/baselines/reference/structural1.symbols b/tests/baselines/reference/structural1.symbols index 78330978cd4..c04668c992d 100644 --- a/tests/baselines/reference/structural1.symbols +++ b/tests/baselines/reference/structural1.symbols @@ -6,10 +6,10 @@ module M { >I : Symbol(I, Decl(structural1.ts, 0, 10)) salt:number; ->salt : Symbol(salt, Decl(structural1.ts, 1, 24)) +>salt : Symbol(I.salt, Decl(structural1.ts, 1, 24)) pepper:number; ->pepper : Symbol(pepper, Decl(structural1.ts, 2, 20)) +>pepper : Symbol(I.pepper, Decl(structural1.ts, 2, 20)) } export function f(i:I) { diff --git a/tests/baselines/reference/subtypesOfAny.symbols b/tests/baselines/reference/subtypesOfAny.symbols index 85f5186f705..5e5353e8c9d 100644 --- a/tests/baselines/reference/subtypesOfAny.symbols +++ b/tests/baselines/reference/subtypesOfAny.symbols @@ -8,7 +8,7 @@ interface I { >x : Symbol(x, Decl(subtypesOfAny.ts, 3, 5)) foo: any; ->foo : Symbol(foo, Decl(subtypesOfAny.ts, 3, 21)) +>foo : Symbol(I.foo, Decl(subtypesOfAny.ts, 3, 21)) } @@ -19,7 +19,7 @@ interface I2 { >x : Symbol(x, Decl(subtypesOfAny.ts, 9, 5)) foo: number; ->foo : Symbol(foo, Decl(subtypesOfAny.ts, 9, 21)) +>foo : Symbol(I2.foo, Decl(subtypesOfAny.ts, 9, 21)) } @@ -30,7 +30,7 @@ interface I3 { >x : Symbol(x, Decl(subtypesOfAny.ts, 15, 5)) foo: string; ->foo : Symbol(foo, Decl(subtypesOfAny.ts, 15, 21)) +>foo : Symbol(I3.foo, Decl(subtypesOfAny.ts, 15, 21)) } @@ -41,7 +41,7 @@ interface I4 { >x : Symbol(x, Decl(subtypesOfAny.ts, 21, 5)) foo: boolean; ->foo : Symbol(foo, Decl(subtypesOfAny.ts, 21, 21)) +>foo : Symbol(I4.foo, Decl(subtypesOfAny.ts, 21, 21)) } @@ -52,8 +52,8 @@ interface I5 { >x : Symbol(x, Decl(subtypesOfAny.ts, 27, 5)) foo: Date; ->foo : Symbol(foo, Decl(subtypesOfAny.ts, 27, 21)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>foo : Symbol(I5.foo, Decl(subtypesOfAny.ts, 27, 21)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) } @@ -64,7 +64,7 @@ interface I6 { >x : Symbol(x, Decl(subtypesOfAny.ts, 33, 5)) foo: RegExp; ->foo : Symbol(foo, Decl(subtypesOfAny.ts, 33, 21)) +>foo : Symbol(I6.foo, Decl(subtypesOfAny.ts, 33, 21)) >RegExp : Symbol(RegExp, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) } @@ -76,7 +76,7 @@ interface I7 { >x : Symbol(x, Decl(subtypesOfAny.ts, 39, 5)) foo: { bar: number }; ->foo : Symbol(foo, Decl(subtypesOfAny.ts, 39, 21)) +>foo : Symbol(I7.foo, Decl(subtypesOfAny.ts, 39, 21)) >bar : Symbol(bar, Decl(subtypesOfAny.ts, 40, 10)) } @@ -88,7 +88,7 @@ interface I8 { >x : Symbol(x, Decl(subtypesOfAny.ts, 45, 5)) foo: number[]; ->foo : Symbol(foo, Decl(subtypesOfAny.ts, 45, 21)) +>foo : Symbol(I8.foo, Decl(subtypesOfAny.ts, 45, 21)) } @@ -99,13 +99,13 @@ interface I9 { >x : Symbol(x, Decl(subtypesOfAny.ts, 51, 5)) foo: I8; ->foo : Symbol(foo, Decl(subtypesOfAny.ts, 51, 21)) +>foo : Symbol(I9.foo, Decl(subtypesOfAny.ts, 51, 21)) >I8 : Symbol(I8, Decl(subtypesOfAny.ts, 41, 1)) } class A { foo: number; } >A : Symbol(A, Decl(subtypesOfAny.ts, 53, 1)) ->foo : Symbol(foo, Decl(subtypesOfAny.ts, 55, 9)) +>foo : Symbol(A.foo, Decl(subtypesOfAny.ts, 55, 9)) interface I10 { >I10 : Symbol(I10, Decl(subtypesOfAny.ts, 55, 24)) @@ -114,14 +114,14 @@ interface I10 { >x : Symbol(x, Decl(subtypesOfAny.ts, 57, 5)) foo: A; ->foo : Symbol(foo, Decl(subtypesOfAny.ts, 57, 21)) +>foo : Symbol(I10.foo, Decl(subtypesOfAny.ts, 57, 21)) >A : Symbol(A, Decl(subtypesOfAny.ts, 53, 1)) } class A2 { foo: T; } >A2 : Symbol(A2, Decl(subtypesOfAny.ts, 59, 1)) >T : Symbol(T, Decl(subtypesOfAny.ts, 61, 9)) ->foo : Symbol(foo, Decl(subtypesOfAny.ts, 61, 13)) +>foo : Symbol(A2.foo, Decl(subtypesOfAny.ts, 61, 13)) >T : Symbol(T, Decl(subtypesOfAny.ts, 61, 9)) interface I11 { @@ -131,7 +131,7 @@ interface I11 { >x : Symbol(x, Decl(subtypesOfAny.ts, 63, 5)) foo: A2; ->foo : Symbol(foo, Decl(subtypesOfAny.ts, 63, 21)) +>foo : Symbol(I11.foo, Decl(subtypesOfAny.ts, 63, 21)) >A2 : Symbol(A2, Decl(subtypesOfAny.ts, 59, 1)) } @@ -143,7 +143,7 @@ interface I12 { >x : Symbol(x, Decl(subtypesOfAny.ts, 69, 5)) foo: (x) => number; ->foo : Symbol(foo, Decl(subtypesOfAny.ts, 69, 21)) +>foo : Symbol(I12.foo, Decl(subtypesOfAny.ts, 69, 21)) >x : Symbol(x, Decl(subtypesOfAny.ts, 70, 10)) } @@ -155,7 +155,7 @@ interface I13 { >x : Symbol(x, Decl(subtypesOfAny.ts, 75, 5)) foo: (x:T) => T; ->foo : Symbol(foo, Decl(subtypesOfAny.ts, 75, 21)) +>foo : Symbol(I13.foo, Decl(subtypesOfAny.ts, 75, 21)) >T : Symbol(T, Decl(subtypesOfAny.ts, 76, 10)) >x : Symbol(x, Decl(subtypesOfAny.ts, 76, 13)) >T : Symbol(T, Decl(subtypesOfAny.ts, 76, 10)) @@ -174,7 +174,7 @@ interface I14 { >x : Symbol(x, Decl(subtypesOfAny.ts, 82, 5)) foo: E; ->foo : Symbol(foo, Decl(subtypesOfAny.ts, 82, 21)) +>foo : Symbol(I14.foo, Decl(subtypesOfAny.ts, 82, 21)) >E : Symbol(E, Decl(subtypesOfAny.ts, 77, 1)) } @@ -195,14 +195,14 @@ interface I15 { >x : Symbol(x, Decl(subtypesOfAny.ts, 92, 5)) foo: typeof f; ->foo : Symbol(foo, Decl(subtypesOfAny.ts, 92, 21)) +>foo : Symbol(I15.foo, Decl(subtypesOfAny.ts, 92, 21)) >f : Symbol(f, Decl(subtypesOfAny.ts, 84, 1), Decl(subtypesOfAny.ts, 87, 16)) } class c { baz: string } >c : Symbol(c, Decl(subtypesOfAny.ts, 94, 1), Decl(subtypesOfAny.ts, 97, 23)) ->baz : Symbol(baz, Decl(subtypesOfAny.ts, 97, 9)) +>baz : Symbol(c.baz, Decl(subtypesOfAny.ts, 97, 9)) module c { >c : Symbol(c, Decl(subtypesOfAny.ts, 94, 1), Decl(subtypesOfAny.ts, 97, 23)) @@ -217,7 +217,7 @@ interface I16 { >x : Symbol(x, Decl(subtypesOfAny.ts, 102, 5)) foo: typeof c; ->foo : Symbol(foo, Decl(subtypesOfAny.ts, 102, 21)) +>foo : Symbol(I16.foo, Decl(subtypesOfAny.ts, 102, 21)) >c : Symbol(c, Decl(subtypesOfAny.ts, 94, 1), Decl(subtypesOfAny.ts, 97, 23)) } @@ -230,7 +230,7 @@ interface I17 { >x : Symbol(x, Decl(subtypesOfAny.ts, 108, 5)) foo: T; ->foo : Symbol(foo, Decl(subtypesOfAny.ts, 108, 21)) +>foo : Symbol(I17.foo, Decl(subtypesOfAny.ts, 108, 21)) >T : Symbol(T, Decl(subtypesOfAny.ts, 107, 14)) } @@ -244,7 +244,7 @@ interface I18 { >x : Symbol(x, Decl(subtypesOfAny.ts, 114, 5)) foo: U; ->foo : Symbol(foo, Decl(subtypesOfAny.ts, 114, 21)) +>foo : Symbol(I18.foo, Decl(subtypesOfAny.ts, 114, 21)) >U : Symbol(U, Decl(subtypesOfAny.ts, 113, 16)) } //interface I18 { @@ -260,7 +260,7 @@ interface I19 { >x : Symbol(x, Decl(subtypesOfAny.ts, 124, 5)) foo: Object; ->foo : Symbol(foo, Decl(subtypesOfAny.ts, 124, 21)) +>foo : Symbol(I19.foo, Decl(subtypesOfAny.ts, 124, 21)) >Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) } @@ -272,5 +272,5 @@ interface I20 { >x : Symbol(x, Decl(subtypesOfAny.ts, 130, 5)) foo: {}; ->foo : Symbol(foo, Decl(subtypesOfAny.ts, 130, 21)) +>foo : Symbol(I20.foo, Decl(subtypesOfAny.ts, 130, 21)) } diff --git a/tests/baselines/reference/subtypesOfTypeParameterWithConstraints2.symbols b/tests/baselines/reference/subtypesOfTypeParameterWithConstraints2.symbols index 05276362cbe..b33b9d212f2 100644 --- a/tests/baselines/reference/subtypesOfTypeParameterWithConstraints2.symbols +++ b/tests/baselines/reference/subtypesOfTypeParameterWithConstraints2.symbols @@ -76,7 +76,7 @@ function f3(x: T, y: U) { >T : Symbol(T, Decl(subtypesOfTypeParameterWithConstraints2.ts, 22, 12)) >U : Symbol(U, Decl(subtypesOfTypeParameterWithConstraints2.ts, 22, 24)) >U : Symbol(U, Decl(subtypesOfTypeParameterWithConstraints2.ts, 22, 24)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(subtypesOfTypeParameterWithConstraints2.ts, 22, 41)) >T : Symbol(T, Decl(subtypesOfTypeParameterWithConstraints2.ts, 22, 12)) >y : Symbol(y, Decl(subtypesOfTypeParameterWithConstraints2.ts, 22, 46)) @@ -96,38 +96,38 @@ function f3(x: T, y: U) { var r2 = true ? x : new Date(); >r2 : Symbol(r2, Decl(subtypesOfTypeParameterWithConstraints2.ts, 27, 7), Decl(subtypesOfTypeParameterWithConstraints2.ts, 28, 7)) >x : Symbol(x, Decl(subtypesOfTypeParameterWithConstraints2.ts, 22, 41)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) var r2 = true ? new Date() : x; >r2 : Symbol(r2, Decl(subtypesOfTypeParameterWithConstraints2.ts, 27, 7), Decl(subtypesOfTypeParameterWithConstraints2.ts, 28, 7)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(subtypesOfTypeParameterWithConstraints2.ts, 22, 41)) // ok var r3 = true ? y : new Date(); >r3 : Symbol(r3, Decl(subtypesOfTypeParameterWithConstraints2.ts, 31, 7), Decl(subtypesOfTypeParameterWithConstraints2.ts, 32, 7)) >y : Symbol(y, Decl(subtypesOfTypeParameterWithConstraints2.ts, 22, 46)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) var r3 = true ? new Date() : y; >r3 : Symbol(r3, Decl(subtypesOfTypeParameterWithConstraints2.ts, 31, 7), Decl(subtypesOfTypeParameterWithConstraints2.ts, 32, 7)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >y : Symbol(y, Decl(subtypesOfTypeParameterWithConstraints2.ts, 22, 46)) } interface I1 { foo: number; } >I1 : Symbol(I1, Decl(subtypesOfTypeParameterWithConstraints2.ts, 33, 1)) ->foo : Symbol(foo, Decl(subtypesOfTypeParameterWithConstraints2.ts, 36, 14)) +>foo : Symbol(I1.foo, Decl(subtypesOfTypeParameterWithConstraints2.ts, 36, 14)) class C1 { foo: number; } >C1 : Symbol(C1, Decl(subtypesOfTypeParameterWithConstraints2.ts, 36, 29)) ->foo : Symbol(foo, Decl(subtypesOfTypeParameterWithConstraints2.ts, 37, 10)) +>foo : Symbol(C1.foo, Decl(subtypesOfTypeParameterWithConstraints2.ts, 37, 10)) class C2 { foo: T; } >C2 : Symbol(C2, Decl(subtypesOfTypeParameterWithConstraints2.ts, 37, 25)) >T : Symbol(T, Decl(subtypesOfTypeParameterWithConstraints2.ts, 38, 9)) ->foo : Symbol(foo, Decl(subtypesOfTypeParameterWithConstraints2.ts, 38, 13)) +>foo : Symbol(C2.foo, Decl(subtypesOfTypeParameterWithConstraints2.ts, 38, 13)) >T : Symbol(T, Decl(subtypesOfTypeParameterWithConstraints2.ts, 38, 9)) enum E { A } @@ -145,7 +145,7 @@ module f { } class c { baz: string } >c : Symbol(c, Decl(subtypesOfTypeParameterWithConstraints2.ts, 43, 1), Decl(subtypesOfTypeParameterWithConstraints2.ts, 44, 23)) ->baz : Symbol(baz, Decl(subtypesOfTypeParameterWithConstraints2.ts, 44, 9)) +>baz : Symbol(c.baz, Decl(subtypesOfTypeParameterWithConstraints2.ts, 44, 9)) module c { >c : Symbol(c, Decl(subtypesOfTypeParameterWithConstraints2.ts, 43, 1), Decl(subtypesOfTypeParameterWithConstraints2.ts, 44, 23)) @@ -157,7 +157,7 @@ module c { function f4(x: T) { >f4 : Symbol(f4, Decl(subtypesOfTypeParameterWithConstraints2.ts, 47, 1)) >T : Symbol(T, Decl(subtypesOfTypeParameterWithConstraints2.ts, 49, 12)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(subtypesOfTypeParameterWithConstraints2.ts, 49, 30)) >T : Symbol(T, Decl(subtypesOfTypeParameterWithConstraints2.ts, 49, 12)) @@ -187,7 +187,7 @@ function f4(x: T) { function f5(x: T) { >f5 : Symbol(f5, Decl(subtypesOfTypeParameterWithConstraints2.ts, 56, 1)) >T : Symbol(T, Decl(subtypesOfTypeParameterWithConstraints2.ts, 58, 12)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(subtypesOfTypeParameterWithConstraints2.ts, 58, 30)) >T : Symbol(T, Decl(subtypesOfTypeParameterWithConstraints2.ts, 58, 12)) @@ -203,7 +203,7 @@ function f5(x: T) { function f6(x: T) { >f6 : Symbol(f6, Decl(subtypesOfTypeParameterWithConstraints2.ts, 61, 1)) >T : Symbol(T, Decl(subtypesOfTypeParameterWithConstraints2.ts, 63, 12)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(subtypesOfTypeParameterWithConstraints2.ts, 63, 30)) >T : Symbol(T, Decl(subtypesOfTypeParameterWithConstraints2.ts, 63, 12)) @@ -235,19 +235,19 @@ function f7(x: T) { function f8(x: T) { >f8 : Symbol(f8, Decl(subtypesOfTypeParameterWithConstraints2.ts, 71, 1)) >T : Symbol(T, Decl(subtypesOfTypeParameterWithConstraints2.ts, 73, 12)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(subtypesOfTypeParameterWithConstraints2.ts, 73, 28)) >T : Symbol(T, Decl(subtypesOfTypeParameterWithConstraints2.ts, 73, 12)) var r4 = true ? new Date() : x; // ok >r4 : Symbol(r4, Decl(subtypesOfTypeParameterWithConstraints2.ts, 74, 7), Decl(subtypesOfTypeParameterWithConstraints2.ts, 75, 7)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(subtypesOfTypeParameterWithConstraints2.ts, 73, 28)) var r4 = true ? x : new Date(); // ok >r4 : Symbol(r4, Decl(subtypesOfTypeParameterWithConstraints2.ts, 74, 7), Decl(subtypesOfTypeParameterWithConstraints2.ts, 75, 7)) >x : Symbol(x, Decl(subtypesOfTypeParameterWithConstraints2.ts, 73, 28)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) } function f9(x: T) { @@ -516,7 +516,7 @@ function f19(x: T) { function f20(x: T) { >f20 : Symbol(f20, Decl(subtypesOfTypeParameterWithConstraints2.ts, 146, 1)) >T : Symbol(T, Decl(subtypesOfTypeParameterWithConstraints2.ts, 148, 13)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(subtypesOfTypeParameterWithConstraints2.ts, 148, 31)) >T : Symbol(T, Decl(subtypesOfTypeParameterWithConstraints2.ts, 148, 13)) @@ -534,7 +534,7 @@ function f20(x: T) { function f21(x: T) { >f21 : Symbol(f21, Decl(subtypesOfTypeParameterWithConstraints2.ts, 151, 1)) >T : Symbol(T, Decl(subtypesOfTypeParameterWithConstraints2.ts, 153, 13)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(subtypesOfTypeParameterWithConstraints2.ts, 153, 31)) >T : Symbol(T, Decl(subtypesOfTypeParameterWithConstraints2.ts, 153, 13)) diff --git a/tests/baselines/reference/subtypingTransitivity.symbols b/tests/baselines/reference/subtypingTransitivity.symbols index 7a1ee279bb3..2a2f10af524 100644 --- a/tests/baselines/reference/subtypingTransitivity.symbols +++ b/tests/baselines/reference/subtypingTransitivity.symbols @@ -3,7 +3,7 @@ class B { >B : Symbol(B, Decl(subtypingTransitivity.ts, 0, 0)) x: Object; ->x : Symbol(x, Decl(subtypingTransitivity.ts, 0, 9)) +>x : Symbol(B.x, Decl(subtypingTransitivity.ts, 0, 9)) >Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) } @@ -12,14 +12,14 @@ class D extends B { >B : Symbol(B, Decl(subtypingTransitivity.ts, 0, 0)) public x: string; ->x : Symbol(x, Decl(subtypingTransitivity.ts, 4, 19)) +>x : Symbol(D.x, Decl(subtypingTransitivity.ts, 4, 19)) } class D2 extends B { >D2 : Symbol(D2, Decl(subtypingTransitivity.ts, 6, 1)) >B : Symbol(B, Decl(subtypingTransitivity.ts, 0, 0)) public x: number; ->x : Symbol(x, Decl(subtypingTransitivity.ts, 7, 20)) +>x : Symbol(D2.x, Decl(subtypingTransitivity.ts, 7, 20)) } var b: B; diff --git a/tests/baselines/reference/subtypingWithCallSignatures2.symbols b/tests/baselines/reference/subtypingWithCallSignatures2.symbols index 02f08016b31..95158bb25d9 100644 --- a/tests/baselines/reference/subtypingWithCallSignatures2.symbols +++ b/tests/baselines/reference/subtypingWithCallSignatures2.symbols @@ -3,22 +3,22 @@ class Base { foo: string; } >Base : Symbol(Base, Decl(subtypingWithCallSignatures2.ts, 0, 0)) ->foo : Symbol(foo, Decl(subtypingWithCallSignatures2.ts, 2, 12)) +>foo : Symbol(Base.foo, Decl(subtypingWithCallSignatures2.ts, 2, 12)) class Derived extends Base { bar: string; } >Derived : Symbol(Derived, Decl(subtypingWithCallSignatures2.ts, 2, 27)) >Base : Symbol(Base, Decl(subtypingWithCallSignatures2.ts, 0, 0)) ->bar : Symbol(bar, Decl(subtypingWithCallSignatures2.ts, 3, 28)) +>bar : Symbol(Derived.bar, Decl(subtypingWithCallSignatures2.ts, 3, 28)) class Derived2 extends Derived { baz: string; } >Derived2 : Symbol(Derived2, Decl(subtypingWithCallSignatures2.ts, 3, 43)) >Derived : Symbol(Derived, Decl(subtypingWithCallSignatures2.ts, 2, 27)) ->baz : Symbol(baz, Decl(subtypingWithCallSignatures2.ts, 4, 32)) +>baz : Symbol(Derived2.baz, Decl(subtypingWithCallSignatures2.ts, 4, 32)) class OtherDerived extends Base { bing: string; } >OtherDerived : Symbol(OtherDerived, Decl(subtypingWithCallSignatures2.ts, 4, 47)) >Base : Symbol(Base, Decl(subtypingWithCallSignatures2.ts, 0, 0)) ->bing : Symbol(bing, Decl(subtypingWithCallSignatures2.ts, 5, 33)) +>bing : Symbol(OtherDerived.bing, Decl(subtypingWithCallSignatures2.ts, 5, 33)) declare function foo1(a: (x: number) => number[]): typeof a; >foo1 : Symbol(foo1, Decl(subtypingWithCallSignatures2.ts, 5, 49), Decl(subtypingWithCallSignatures2.ts, 7, 60)) @@ -297,8 +297,8 @@ declare function foo18(a: { (a: Date): Date; >a : Symbol(a, Decl(subtypingWithCallSignatures2.ts, 74, 9)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) }): any[]; }): typeof a; diff --git a/tests/baselines/reference/subtypingWithCallSignatures3.symbols b/tests/baselines/reference/subtypingWithCallSignatures3.symbols index 37e1c0423c4..5b41bc78e38 100644 --- a/tests/baselines/reference/subtypingWithCallSignatures3.symbols +++ b/tests/baselines/reference/subtypingWithCallSignatures3.symbols @@ -7,22 +7,22 @@ module Errors { class Base { foo: string; } >Base : Symbol(Base, Decl(subtypingWithCallSignatures3.ts, 3, 15)) ->foo : Symbol(foo, Decl(subtypingWithCallSignatures3.ts, 4, 16)) +>foo : Symbol(Base.foo, Decl(subtypingWithCallSignatures3.ts, 4, 16)) class Derived extends Base { bar: string; } >Derived : Symbol(Derived, Decl(subtypingWithCallSignatures3.ts, 4, 31)) >Base : Symbol(Base, Decl(subtypingWithCallSignatures3.ts, 3, 15)) ->bar : Symbol(bar, Decl(subtypingWithCallSignatures3.ts, 5, 32)) +>bar : Symbol(Derived.bar, Decl(subtypingWithCallSignatures3.ts, 5, 32)) class Derived2 extends Derived { baz: string; } >Derived2 : Symbol(Derived2, Decl(subtypingWithCallSignatures3.ts, 5, 47)) >Derived : Symbol(Derived, Decl(subtypingWithCallSignatures3.ts, 4, 31)) ->baz : Symbol(baz, Decl(subtypingWithCallSignatures3.ts, 6, 36)) +>baz : Symbol(Derived2.baz, Decl(subtypingWithCallSignatures3.ts, 6, 36)) class OtherDerived extends Base { bing: string; } >OtherDerived : Symbol(OtherDerived, Decl(subtypingWithCallSignatures3.ts, 6, 51)) >Base : Symbol(Base, Decl(subtypingWithCallSignatures3.ts, 3, 15)) ->bing : Symbol(bing, Decl(subtypingWithCallSignatures3.ts, 7, 37)) +>bing : Symbol(OtherDerived.bing, Decl(subtypingWithCallSignatures3.ts, 7, 37)) declare function foo2(a2: (x: number) => string[]): typeof a2; >foo2 : Symbol(foo2, Decl(subtypingWithCallSignatures3.ts, 7, 53), Decl(subtypingWithCallSignatures3.ts, 9, 66)) diff --git a/tests/baselines/reference/subtypingWithCallSignatures4.symbols b/tests/baselines/reference/subtypingWithCallSignatures4.symbols index 382abb58a0d..d5cb92bace8 100644 --- a/tests/baselines/reference/subtypingWithCallSignatures4.symbols +++ b/tests/baselines/reference/subtypingWithCallSignatures4.symbols @@ -3,22 +3,22 @@ class Base { foo: string; } >Base : Symbol(Base, Decl(subtypingWithCallSignatures4.ts, 0, 0)) ->foo : Symbol(foo, Decl(subtypingWithCallSignatures4.ts, 2, 12)) +>foo : Symbol(Base.foo, Decl(subtypingWithCallSignatures4.ts, 2, 12)) class Derived extends Base { bar: string; } >Derived : Symbol(Derived, Decl(subtypingWithCallSignatures4.ts, 2, 27)) >Base : Symbol(Base, Decl(subtypingWithCallSignatures4.ts, 0, 0)) ->bar : Symbol(bar, Decl(subtypingWithCallSignatures4.ts, 3, 28)) +>bar : Symbol(Derived.bar, Decl(subtypingWithCallSignatures4.ts, 3, 28)) class Derived2 extends Derived { baz: string; } >Derived2 : Symbol(Derived2, Decl(subtypingWithCallSignatures4.ts, 3, 43)) >Derived : Symbol(Derived, Decl(subtypingWithCallSignatures4.ts, 2, 27)) ->baz : Symbol(baz, Decl(subtypingWithCallSignatures4.ts, 4, 32)) +>baz : Symbol(Derived2.baz, Decl(subtypingWithCallSignatures4.ts, 4, 32)) class OtherDerived extends Base { bing: string; } >OtherDerived : Symbol(OtherDerived, Decl(subtypingWithCallSignatures4.ts, 4, 47)) >Base : Symbol(Base, Decl(subtypingWithCallSignatures4.ts, 0, 0)) ->bing : Symbol(bing, Decl(subtypingWithCallSignatures4.ts, 5, 33)) +>bing : Symbol(OtherDerived.bing, Decl(subtypingWithCallSignatures4.ts, 5, 33)) declare function foo1(a: (x: T) => T[]); >foo1 : Symbol(foo1, Decl(subtypingWithCallSignatures4.ts, 5, 49), Decl(subtypingWithCallSignatures4.ts, 7, 43)) diff --git a/tests/baselines/reference/subtypingWithCallSignaturesWithRestParameters.errors.txt b/tests/baselines/reference/subtypingWithCallSignaturesWithRestParameters.errors.txt index f4a141ff390..3d0e04bbfa7 100644 --- a/tests/baselines/reference/subtypingWithCallSignaturesWithRestParameters.errors.txt +++ b/tests/baselines/reference/subtypingWithCallSignaturesWithRestParameters.errors.txt @@ -2,57 +2,57 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW Types of property 'a' are incompatible. Type '(...args: string[]) => number' is not assignable to type '(...args: number[]) => number'. Types of parameters 'args' and 'args' are incompatible. - Type 'string' is not assignable to type 'number'. + Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignaturesWithRestParameters.ts(34,11): error TS2430: Interface 'I3B' incorrectly extends interface 'Base'. Types of property 'a' are incompatible. Type '(x?: string) => number' is not assignable to type '(...args: number[]) => number'. Types of parameters 'x' and 'args' are incompatible. - Type 'string' is not assignable to type 'number'. + Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignaturesWithRestParameters.ts(60,11): error TS2430: Interface 'I6C' incorrectly extends interface 'Base'. Types of property 'a2' are incompatible. Type '(x: number, ...args: string[]) => number' is not assignable to type '(x: number, ...z: number[]) => number'. Types of parameters 'args' and 'z' are incompatible. - Type 'string' is not assignable to type 'number'. + Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignaturesWithRestParameters.ts(90,11): error TS2430: Interface 'I10B' incorrectly extends interface 'Base'. Types of property 'a3' are incompatible. Type '(x: number, y?: number, z?: number) => number' is not assignable to type '(x: number, y?: string, ...z: number[]) => number'. Types of parameters 'y' and 'y' are incompatible. - Type 'number' is not assignable to type 'string'. + Type 'string' is not assignable to type 'number'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignaturesWithRestParameters.ts(94,11): error TS2430: Interface 'I10C' incorrectly extends interface 'Base'. Types of property 'a3' are incompatible. Type '(x: number, ...z: number[]) => number' is not assignable to type '(x: number, y?: string, ...z: number[]) => number'. Types of parameters 'z' and 'y' are incompatible. - Type 'number' is not assignable to type 'string'. + Type 'string' is not assignable to type 'number'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignaturesWithRestParameters.ts(98,11): error TS2430: Interface 'I10D' incorrectly extends interface 'Base'. Types of property 'a3' are incompatible. Type '(x: string, y?: string, z?: string) => number' is not assignable to type '(x: number, y?: string, ...z: number[]) => number'. Types of parameters 'x' and 'x' are incompatible. - Type 'string' is not assignable to type 'number'. + Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignaturesWithRestParameters.ts(102,11): error TS2430: Interface 'I10E' incorrectly extends interface 'Base'. Types of property 'a3' are incompatible. Type '(x: number, ...z: string[]) => number' is not assignable to type '(x: number, y?: string, ...z: number[]) => number'. Types of parameters 'z' and 'z' are incompatible. - Type 'string' is not assignable to type 'number'. + Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignaturesWithRestParameters.ts(110,11): error TS2430: Interface 'I12' incorrectly extends interface 'Base'. Types of property 'a4' are incompatible. Type '(x?: number, y?: number) => number' is not assignable to type '(x?: number, y?: string, ...z: number[]) => number'. Types of parameters 'y' and 'y' are incompatible. - Type 'number' is not assignable to type 'string'. + Type 'string' is not assignable to type 'number'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignaturesWithRestParameters.ts(118,11): error TS2430: Interface 'I14' incorrectly extends interface 'Base'. Types of property 'a4' are incompatible. Type '(x: number, y?: number) => number' is not assignable to type '(x?: number, y?: string, ...z: number[]) => number'. Types of parameters 'y' and 'y' are incompatible. - Type 'number' is not assignable to type 'string'. + Type 'string' is not assignable to type 'number'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignaturesWithRestParameters.ts(126,11): error TS2430: Interface 'I16' incorrectly extends interface 'Base'. Types of property 'a4' are incompatible. Type '(x: number, ...args: string[]) => number' is not assignable to type '(x?: number, y?: string, ...z: number[]) => number'. Types of parameters 'args' and 'z' are incompatible. - Type 'string' is not assignable to type 'number'. + Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignaturesWithRestParameters.ts(130,11): error TS2430: Interface 'I17' incorrectly extends interface 'Base'. Types of property 'a4' are incompatible. Type '(...args: number[]) => number' is not assignable to type '(x?: number, y?: string, ...z: number[]) => number'. Types of parameters 'args' and 'y' are incompatible. - Type 'number' is not assignable to type 'string'. + Type 'string' is not assignable to type 'number'. ==== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignaturesWithRestParameters.ts (11 errors) ==== @@ -79,7 +79,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Types of property 'a' are incompatible. !!! error TS2430: Type '(...args: string[]) => number' is not assignable to type '(...args: number[]) => number'. !!! error TS2430: Types of parameters 'args' and 'args' are incompatible. -!!! error TS2430: Type 'string' is not assignable to type 'number'. +!!! error TS2430: Type 'number' is not assignable to type 'string'. a: (...args: string[]) => number; // error, type mismatch } @@ -101,7 +101,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Types of property 'a' are incompatible. !!! error TS2430: Type '(x?: string) => number' is not assignable to type '(...args: number[]) => number'. !!! error TS2430: Types of parameters 'x' and 'args' are incompatible. -!!! error TS2430: Type 'string' is not assignable to type 'number'. +!!! error TS2430: Type 'number' is not assignable to type 'string'. a: (x?: string) => number; // error, incompatible type } @@ -133,7 +133,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Types of property 'a2' are incompatible. !!! error TS2430: Type '(x: number, ...args: string[]) => number' is not assignable to type '(x: number, ...z: number[]) => number'. !!! error TS2430: Types of parameters 'args' and 'z' are incompatible. -!!! error TS2430: Type 'string' is not assignable to type 'number'. +!!! error TS2430: Type 'number' is not assignable to type 'string'. a2: (x: number, ...args: string[]) => number; // error } @@ -169,7 +169,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Types of property 'a3' are incompatible. !!! error TS2430: Type '(x: number, y?: number, z?: number) => number' is not assignable to type '(x: number, y?: string, ...z: number[]) => number'. !!! error TS2430: Types of parameters 'y' and 'y' are incompatible. -!!! error TS2430: Type 'number' is not assignable to type 'string'. +!!! error TS2430: Type 'string' is not assignable to type 'number'. a3: (x: number, y?: number, z?: number) => number; // error } @@ -179,7 +179,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Types of property 'a3' are incompatible. !!! error TS2430: Type '(x: number, ...z: number[]) => number' is not assignable to type '(x: number, y?: string, ...z: number[]) => number'. !!! error TS2430: Types of parameters 'z' and 'y' are incompatible. -!!! error TS2430: Type 'number' is not assignable to type 'string'. +!!! error TS2430: Type 'string' is not assignable to type 'number'. a3: (x: number, ...z: number[]) => number; // error } @@ -189,7 +189,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Types of property 'a3' are incompatible. !!! error TS2430: Type '(x: string, y?: string, z?: string) => number' is not assignable to type '(x: number, y?: string, ...z: number[]) => number'. !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2430: Type 'string' is not assignable to type 'number'. +!!! error TS2430: Type 'number' is not assignable to type 'string'. a3: (x: string, y?: string, z?: string) => number; // error, incompatible types } @@ -199,7 +199,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Types of property 'a3' are incompatible. !!! error TS2430: Type '(x: number, ...z: string[]) => number' is not assignable to type '(x: number, y?: string, ...z: number[]) => number'. !!! error TS2430: Types of parameters 'z' and 'z' are incompatible. -!!! error TS2430: Type 'string' is not assignable to type 'number'. +!!! error TS2430: Type 'number' is not assignable to type 'string'. a3: (x: number, ...z: string[]) => number; // error } @@ -213,7 +213,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Types of property 'a4' are incompatible. !!! error TS2430: Type '(x?: number, y?: number) => number' is not assignable to type '(x?: number, y?: string, ...z: number[]) => number'. !!! error TS2430: Types of parameters 'y' and 'y' are incompatible. -!!! error TS2430: Type 'number' is not assignable to type 'string'. +!!! error TS2430: Type 'string' is not assignable to type 'number'. a4: (x?: number, y?: number) => number; // error, type mismatch } @@ -227,7 +227,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Types of property 'a4' are incompatible. !!! error TS2430: Type '(x: number, y?: number) => number' is not assignable to type '(x?: number, y?: string, ...z: number[]) => number'. !!! error TS2430: Types of parameters 'y' and 'y' are incompatible. -!!! error TS2430: Type 'number' is not assignable to type 'string'. +!!! error TS2430: Type 'string' is not assignable to type 'number'. a4: (x: number, y?: number) => number; // error, second param has type mismatch } @@ -241,7 +241,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Types of property 'a4' are incompatible. !!! error TS2430: Type '(x: number, ...args: string[]) => number' is not assignable to type '(x?: number, y?: string, ...z: number[]) => number'. !!! error TS2430: Types of parameters 'args' and 'z' are incompatible. -!!! error TS2430: Type 'string' is not assignable to type 'number'. +!!! error TS2430: Type 'number' is not assignable to type 'string'. a4: (x: number, ...args: string[]) => number; // error, rest param has type mismatch } @@ -251,7 +251,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Types of property 'a4' are incompatible. !!! error TS2430: Type '(...args: number[]) => number' is not assignable to type '(x?: number, y?: string, ...z: number[]) => number'. !!! error TS2430: Types of parameters 'args' and 'y' are incompatible. -!!! error TS2430: Type 'number' is not assignable to type 'string'. +!!! error TS2430: Type 'string' is not assignable to type 'number'. a4: (...args: number[]) => number; // error } \ No newline at end of file diff --git a/tests/baselines/reference/subtypingWithConstructSignatures2.symbols b/tests/baselines/reference/subtypingWithConstructSignatures2.symbols index 2173aaa1392..cbb72b9f396 100644 --- a/tests/baselines/reference/subtypingWithConstructSignatures2.symbols +++ b/tests/baselines/reference/subtypingWithConstructSignatures2.symbols @@ -3,22 +3,22 @@ class Base { foo: string; } >Base : Symbol(Base, Decl(subtypingWithConstructSignatures2.ts, 0, 0)) ->foo : Symbol(foo, Decl(subtypingWithConstructSignatures2.ts, 2, 12)) +>foo : Symbol(Base.foo, Decl(subtypingWithConstructSignatures2.ts, 2, 12)) class Derived extends Base { bar: string; } >Derived : Symbol(Derived, Decl(subtypingWithConstructSignatures2.ts, 2, 27)) >Base : Symbol(Base, Decl(subtypingWithConstructSignatures2.ts, 0, 0)) ->bar : Symbol(bar, Decl(subtypingWithConstructSignatures2.ts, 3, 28)) +>bar : Symbol(Derived.bar, Decl(subtypingWithConstructSignatures2.ts, 3, 28)) class Derived2 extends Derived { baz: string; } >Derived2 : Symbol(Derived2, Decl(subtypingWithConstructSignatures2.ts, 3, 43)) >Derived : Symbol(Derived, Decl(subtypingWithConstructSignatures2.ts, 2, 27)) ->baz : Symbol(baz, Decl(subtypingWithConstructSignatures2.ts, 4, 32)) +>baz : Symbol(Derived2.baz, Decl(subtypingWithConstructSignatures2.ts, 4, 32)) class OtherDerived extends Base { bing: string; } >OtherDerived : Symbol(OtherDerived, Decl(subtypingWithConstructSignatures2.ts, 4, 47)) >Base : Symbol(Base, Decl(subtypingWithConstructSignatures2.ts, 0, 0)) ->bing : Symbol(bing, Decl(subtypingWithConstructSignatures2.ts, 5, 33)) +>bing : Symbol(OtherDerived.bing, Decl(subtypingWithConstructSignatures2.ts, 5, 33)) declare function foo1(a: new (x: number) => number[]): typeof a; >foo1 : Symbol(foo1, Decl(subtypingWithConstructSignatures2.ts, 5, 49), Decl(subtypingWithConstructSignatures2.ts, 7, 64)) @@ -297,8 +297,8 @@ declare function foo18(a: { new (a: Date): Date; >a : Symbol(a, Decl(subtypingWithConstructSignatures2.ts, 74, 13)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) }): any[]; }): typeof a; diff --git a/tests/baselines/reference/subtypingWithConstructSignatures3.symbols b/tests/baselines/reference/subtypingWithConstructSignatures3.symbols index 3adce566f95..b161a0f92c2 100644 --- a/tests/baselines/reference/subtypingWithConstructSignatures3.symbols +++ b/tests/baselines/reference/subtypingWithConstructSignatures3.symbols @@ -7,22 +7,22 @@ module Errors { class Base { foo: string; } >Base : Symbol(Base, Decl(subtypingWithConstructSignatures3.ts, 3, 15)) ->foo : Symbol(foo, Decl(subtypingWithConstructSignatures3.ts, 4, 16)) +>foo : Symbol(Base.foo, Decl(subtypingWithConstructSignatures3.ts, 4, 16)) class Derived extends Base { bar: string; } >Derived : Symbol(Derived, Decl(subtypingWithConstructSignatures3.ts, 4, 31)) >Base : Symbol(Base, Decl(subtypingWithConstructSignatures3.ts, 3, 15)) ->bar : Symbol(bar, Decl(subtypingWithConstructSignatures3.ts, 5, 32)) +>bar : Symbol(Derived.bar, Decl(subtypingWithConstructSignatures3.ts, 5, 32)) class Derived2 extends Derived { baz: string; } >Derived2 : Symbol(Derived2, Decl(subtypingWithConstructSignatures3.ts, 5, 47)) >Derived : Symbol(Derived, Decl(subtypingWithConstructSignatures3.ts, 4, 31)) ->baz : Symbol(baz, Decl(subtypingWithConstructSignatures3.ts, 6, 36)) +>baz : Symbol(Derived2.baz, Decl(subtypingWithConstructSignatures3.ts, 6, 36)) class OtherDerived extends Base { bing: string; } >OtherDerived : Symbol(OtherDerived, Decl(subtypingWithConstructSignatures3.ts, 6, 51)) >Base : Symbol(Base, Decl(subtypingWithConstructSignatures3.ts, 3, 15)) ->bing : Symbol(bing, Decl(subtypingWithConstructSignatures3.ts, 7, 37)) +>bing : Symbol(OtherDerived.bing, Decl(subtypingWithConstructSignatures3.ts, 7, 37)) declare function foo2(a2: new (x: number) => string[]): typeof a2; >foo2 : Symbol(foo2, Decl(subtypingWithConstructSignatures3.ts, 7, 53), Decl(subtypingWithConstructSignatures3.ts, 9, 70)) diff --git a/tests/baselines/reference/subtypingWithConstructSignatures4.symbols b/tests/baselines/reference/subtypingWithConstructSignatures4.symbols index b337c6642f4..4ab22b5a482 100644 --- a/tests/baselines/reference/subtypingWithConstructSignatures4.symbols +++ b/tests/baselines/reference/subtypingWithConstructSignatures4.symbols @@ -3,22 +3,22 @@ class Base { foo: string; } >Base : Symbol(Base, Decl(subtypingWithConstructSignatures4.ts, 0, 0)) ->foo : Symbol(foo, Decl(subtypingWithConstructSignatures4.ts, 2, 12)) +>foo : Symbol(Base.foo, Decl(subtypingWithConstructSignatures4.ts, 2, 12)) class Derived extends Base { bar: string; } >Derived : Symbol(Derived, Decl(subtypingWithConstructSignatures4.ts, 2, 27)) >Base : Symbol(Base, Decl(subtypingWithConstructSignatures4.ts, 0, 0)) ->bar : Symbol(bar, Decl(subtypingWithConstructSignatures4.ts, 3, 28)) +>bar : Symbol(Derived.bar, Decl(subtypingWithConstructSignatures4.ts, 3, 28)) class Derived2 extends Derived { baz: string; } >Derived2 : Symbol(Derived2, Decl(subtypingWithConstructSignatures4.ts, 3, 43)) >Derived : Symbol(Derived, Decl(subtypingWithConstructSignatures4.ts, 2, 27)) ->baz : Symbol(baz, Decl(subtypingWithConstructSignatures4.ts, 4, 32)) +>baz : Symbol(Derived2.baz, Decl(subtypingWithConstructSignatures4.ts, 4, 32)) class OtherDerived extends Base { bing: string; } >OtherDerived : Symbol(OtherDerived, Decl(subtypingWithConstructSignatures4.ts, 4, 47)) >Base : Symbol(Base, Decl(subtypingWithConstructSignatures4.ts, 0, 0)) ->bing : Symbol(bing, Decl(subtypingWithConstructSignatures4.ts, 5, 33)) +>bing : Symbol(OtherDerived.bing, Decl(subtypingWithConstructSignatures4.ts, 5, 33)) declare function foo1(a: new (x: T) => T[]); >foo1 : Symbol(foo1, Decl(subtypingWithConstructSignatures4.ts, 5, 49), Decl(subtypingWithConstructSignatures4.ts, 7, 47)) diff --git a/tests/baselines/reference/subtypingWithConstructSignatures5.symbols b/tests/baselines/reference/subtypingWithConstructSignatures5.symbols index 634f31ff783..1adbdb82b49 100644 --- a/tests/baselines/reference/subtypingWithConstructSignatures5.symbols +++ b/tests/baselines/reference/subtypingWithConstructSignatures5.symbols @@ -4,51 +4,51 @@ class Base { foo: string; } >Base : Symbol(Base, Decl(subtypingWithConstructSignatures5.ts, 0, 0)) ->foo : Symbol(foo, Decl(subtypingWithConstructSignatures5.ts, 3, 12)) +>foo : Symbol(Base.foo, Decl(subtypingWithConstructSignatures5.ts, 3, 12)) class Derived extends Base { bar: string; } >Derived : Symbol(Derived, Decl(subtypingWithConstructSignatures5.ts, 3, 27)) >Base : Symbol(Base, Decl(subtypingWithConstructSignatures5.ts, 0, 0)) ->bar : Symbol(bar, Decl(subtypingWithConstructSignatures5.ts, 4, 28)) +>bar : Symbol(Derived.bar, Decl(subtypingWithConstructSignatures5.ts, 4, 28)) class Derived2 extends Derived { baz: string; } >Derived2 : Symbol(Derived2, Decl(subtypingWithConstructSignatures5.ts, 4, 43)) >Derived : Symbol(Derived, Decl(subtypingWithConstructSignatures5.ts, 3, 27)) ->baz : Symbol(baz, Decl(subtypingWithConstructSignatures5.ts, 5, 32)) +>baz : Symbol(Derived2.baz, Decl(subtypingWithConstructSignatures5.ts, 5, 32)) class OtherDerived extends Base { bing: string; } >OtherDerived : Symbol(OtherDerived, Decl(subtypingWithConstructSignatures5.ts, 5, 47)) >Base : Symbol(Base, Decl(subtypingWithConstructSignatures5.ts, 0, 0)) ->bing : Symbol(bing, Decl(subtypingWithConstructSignatures5.ts, 6, 33)) +>bing : Symbol(OtherDerived.bing, Decl(subtypingWithConstructSignatures5.ts, 6, 33)) interface A { // T >A : Symbol(A, Decl(subtypingWithConstructSignatures5.ts, 6, 49)) // M's a: new (x: number) => number[]; ->a : Symbol(a, Decl(subtypingWithConstructSignatures5.ts, 8, 13)) +>a : Symbol(A.a, Decl(subtypingWithConstructSignatures5.ts, 8, 13)) >x : Symbol(x, Decl(subtypingWithConstructSignatures5.ts, 10, 12)) a2: new (x: number) => string[]; ->a2 : Symbol(a2, Decl(subtypingWithConstructSignatures5.ts, 10, 35)) +>a2 : Symbol(A.a2, Decl(subtypingWithConstructSignatures5.ts, 10, 35)) >x : Symbol(x, Decl(subtypingWithConstructSignatures5.ts, 11, 13)) a3: new (x: number) => void; ->a3 : Symbol(a3, Decl(subtypingWithConstructSignatures5.ts, 11, 36)) +>a3 : Symbol(A.a3, Decl(subtypingWithConstructSignatures5.ts, 11, 36)) >x : Symbol(x, Decl(subtypingWithConstructSignatures5.ts, 12, 13)) a4: new (x: string, y: number) => string; ->a4 : Symbol(a4, Decl(subtypingWithConstructSignatures5.ts, 12, 32)) +>a4 : Symbol(A.a4, Decl(subtypingWithConstructSignatures5.ts, 12, 32)) >x : Symbol(x, Decl(subtypingWithConstructSignatures5.ts, 13, 13)) >y : Symbol(y, Decl(subtypingWithConstructSignatures5.ts, 13, 23)) a5: new (x: (arg: string) => number) => string; ->a5 : Symbol(a5, Decl(subtypingWithConstructSignatures5.ts, 13, 45)) +>a5 : Symbol(A.a5, Decl(subtypingWithConstructSignatures5.ts, 13, 45)) >x : Symbol(x, Decl(subtypingWithConstructSignatures5.ts, 14, 13)) >arg : Symbol(arg, Decl(subtypingWithConstructSignatures5.ts, 14, 17)) a6: new (x: (arg: Base) => Derived) => Base; ->a6 : Symbol(a6, Decl(subtypingWithConstructSignatures5.ts, 14, 51)) +>a6 : Symbol(A.a6, Decl(subtypingWithConstructSignatures5.ts, 14, 51)) >x : Symbol(x, Decl(subtypingWithConstructSignatures5.ts, 15, 13)) >arg : Symbol(arg, Decl(subtypingWithConstructSignatures5.ts, 15, 17)) >Base : Symbol(Base, Decl(subtypingWithConstructSignatures5.ts, 0, 0)) @@ -56,7 +56,7 @@ interface A { // T >Base : Symbol(Base, Decl(subtypingWithConstructSignatures5.ts, 0, 0)) a7: new (x: (arg: Base) => Derived) => (r: Base) => Derived; ->a7 : Symbol(a7, Decl(subtypingWithConstructSignatures5.ts, 15, 48)) +>a7 : Symbol(A.a7, Decl(subtypingWithConstructSignatures5.ts, 15, 48)) >x : Symbol(x, Decl(subtypingWithConstructSignatures5.ts, 16, 13)) >arg : Symbol(arg, Decl(subtypingWithConstructSignatures5.ts, 16, 17)) >Base : Symbol(Base, Decl(subtypingWithConstructSignatures5.ts, 0, 0)) @@ -66,7 +66,7 @@ interface A { // T >Derived : Symbol(Derived, Decl(subtypingWithConstructSignatures5.ts, 3, 27)) a8: new (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived; ->a8 : Symbol(a8, Decl(subtypingWithConstructSignatures5.ts, 16, 64)) +>a8 : Symbol(A.a8, Decl(subtypingWithConstructSignatures5.ts, 16, 64)) >x : Symbol(x, Decl(subtypingWithConstructSignatures5.ts, 17, 13)) >arg : Symbol(arg, Decl(subtypingWithConstructSignatures5.ts, 17, 17)) >Base : Symbol(Base, Decl(subtypingWithConstructSignatures5.ts, 0, 0)) @@ -80,7 +80,7 @@ interface A { // T >Derived : Symbol(Derived, Decl(subtypingWithConstructSignatures5.ts, 3, 27)) a9: new (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived; ->a9 : Symbol(a9, Decl(subtypingWithConstructSignatures5.ts, 17, 92)) +>a9 : Symbol(A.a9, Decl(subtypingWithConstructSignatures5.ts, 17, 92)) >x : Symbol(x, Decl(subtypingWithConstructSignatures5.ts, 18, 13)) >arg : Symbol(arg, Decl(subtypingWithConstructSignatures5.ts, 18, 17)) >Base : Symbol(Base, Decl(subtypingWithConstructSignatures5.ts, 0, 0)) @@ -94,13 +94,13 @@ interface A { // T >Derived : Symbol(Derived, Decl(subtypingWithConstructSignatures5.ts, 3, 27)) a10: new (...x: Derived[]) => Derived; ->a10 : Symbol(a10, Decl(subtypingWithConstructSignatures5.ts, 18, 92)) +>a10 : Symbol(A.a10, Decl(subtypingWithConstructSignatures5.ts, 18, 92)) >x : Symbol(x, Decl(subtypingWithConstructSignatures5.ts, 19, 14)) >Derived : Symbol(Derived, Decl(subtypingWithConstructSignatures5.ts, 3, 27)) >Derived : Symbol(Derived, Decl(subtypingWithConstructSignatures5.ts, 3, 27)) a11: new (x: { foo: string }, y: { foo: string; bar: string }) => Base; ->a11 : Symbol(a11, Decl(subtypingWithConstructSignatures5.ts, 19, 42)) +>a11 : Symbol(A.a11, Decl(subtypingWithConstructSignatures5.ts, 19, 42)) >x : Symbol(x, Decl(subtypingWithConstructSignatures5.ts, 20, 14)) >foo : Symbol(foo, Decl(subtypingWithConstructSignatures5.ts, 20, 18)) >y : Symbol(y, Decl(subtypingWithConstructSignatures5.ts, 20, 33)) @@ -109,7 +109,7 @@ interface A { // T >Base : Symbol(Base, Decl(subtypingWithConstructSignatures5.ts, 0, 0)) a12: new (x: Array, y: Array) => Array; ->a12 : Symbol(a12, Decl(subtypingWithConstructSignatures5.ts, 20, 75)) +>a12 : Symbol(A.a12, Decl(subtypingWithConstructSignatures5.ts, 20, 75)) >x : Symbol(x, Decl(subtypingWithConstructSignatures5.ts, 21, 14)) >Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >Base : Symbol(Base, Decl(subtypingWithConstructSignatures5.ts, 0, 0)) @@ -120,7 +120,7 @@ interface A { // T >Derived : Symbol(Derived, Decl(subtypingWithConstructSignatures5.ts, 3, 27)) a13: new (x: Array, y: Array) => Array; ->a13 : Symbol(a13, Decl(subtypingWithConstructSignatures5.ts, 21, 68)) +>a13 : Symbol(A.a13, Decl(subtypingWithConstructSignatures5.ts, 21, 68)) >x : Symbol(x, Decl(subtypingWithConstructSignatures5.ts, 22, 14)) >Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >Base : Symbol(Base, Decl(subtypingWithConstructSignatures5.ts, 0, 0)) @@ -131,7 +131,7 @@ interface A { // T >Derived : Symbol(Derived, Decl(subtypingWithConstructSignatures5.ts, 3, 27)) a14: new (x: { a: string; b: number }) => Object; ->a14 : Symbol(a14, Decl(subtypingWithConstructSignatures5.ts, 22, 67)) +>a14 : Symbol(A.a14, Decl(subtypingWithConstructSignatures5.ts, 22, 67)) >x : Symbol(x, Decl(subtypingWithConstructSignatures5.ts, 23, 14)) >a : Symbol(a, Decl(subtypingWithConstructSignatures5.ts, 23, 18)) >b : Symbol(b, Decl(subtypingWithConstructSignatures5.ts, 23, 29)) @@ -143,7 +143,7 @@ interface B extends A { >A : Symbol(A, Decl(subtypingWithConstructSignatures5.ts, 6, 49)) a: new (x: T) => T[]; ->a : Symbol(a, Decl(subtypingWithConstructSignatures5.ts, 26, 23)) +>a : Symbol(B.a, Decl(subtypingWithConstructSignatures5.ts, 26, 23)) >T : Symbol(T, Decl(subtypingWithConstructSignatures5.ts, 27, 12)) >x : Symbol(x, Decl(subtypingWithConstructSignatures5.ts, 27, 15)) >T : Symbol(T, Decl(subtypingWithConstructSignatures5.ts, 27, 12)) @@ -157,27 +157,27 @@ interface I extends B { // N's a: new (x: T) => T[]; // ok, instantiation of N is a subtype of M, T is number ->a : Symbol(a, Decl(subtypingWithConstructSignatures5.ts, 31, 23)) +>a : Symbol(I.a, Decl(subtypingWithConstructSignatures5.ts, 31, 23)) >T : Symbol(T, Decl(subtypingWithConstructSignatures5.ts, 33, 12)) >x : Symbol(x, Decl(subtypingWithConstructSignatures5.ts, 33, 15)) >T : Symbol(T, Decl(subtypingWithConstructSignatures5.ts, 33, 12)) >T : Symbol(T, Decl(subtypingWithConstructSignatures5.ts, 33, 12)) a2: new (x: T) => string[]; // ok ->a2 : Symbol(a2, Decl(subtypingWithConstructSignatures5.ts, 33, 28)) +>a2 : Symbol(I.a2, Decl(subtypingWithConstructSignatures5.ts, 33, 28)) >T : Symbol(T, Decl(subtypingWithConstructSignatures5.ts, 34, 13)) >x : Symbol(x, Decl(subtypingWithConstructSignatures5.ts, 34, 16)) >T : Symbol(T, Decl(subtypingWithConstructSignatures5.ts, 34, 13)) a3: new (x: T) => T; // ok since Base returns void ->a3 : Symbol(a3, Decl(subtypingWithConstructSignatures5.ts, 34, 34)) +>a3 : Symbol(I.a3, Decl(subtypingWithConstructSignatures5.ts, 34, 34)) >T : Symbol(T, Decl(subtypingWithConstructSignatures5.ts, 35, 13)) >x : Symbol(x, Decl(subtypingWithConstructSignatures5.ts, 35, 16)) >T : Symbol(T, Decl(subtypingWithConstructSignatures5.ts, 35, 13)) >T : Symbol(T, Decl(subtypingWithConstructSignatures5.ts, 35, 13)) a4: new (x: T, y: U) => T; // ok, instantiation of N is a subtype of M, T is string, U is number ->a4 : Symbol(a4, Decl(subtypingWithConstructSignatures5.ts, 35, 27)) +>a4 : Symbol(I.a4, Decl(subtypingWithConstructSignatures5.ts, 35, 27)) >T : Symbol(T, Decl(subtypingWithConstructSignatures5.ts, 36, 13)) >U : Symbol(U, Decl(subtypingWithConstructSignatures5.ts, 36, 15)) >x : Symbol(x, Decl(subtypingWithConstructSignatures5.ts, 36, 19)) @@ -187,7 +187,7 @@ interface I extends B { >T : Symbol(T, Decl(subtypingWithConstructSignatures5.ts, 36, 13)) a5: new (x: (arg: T) => U) => T; // ok, U is in a parameter position so inferences can be made ->a5 : Symbol(a5, Decl(subtypingWithConstructSignatures5.ts, 36, 36)) +>a5 : Symbol(I.a5, Decl(subtypingWithConstructSignatures5.ts, 36, 36)) >T : Symbol(T, Decl(subtypingWithConstructSignatures5.ts, 37, 13)) >U : Symbol(U, Decl(subtypingWithConstructSignatures5.ts, 37, 15)) >x : Symbol(x, Decl(subtypingWithConstructSignatures5.ts, 37, 19)) @@ -197,7 +197,7 @@ interface I extends B { >T : Symbol(T, Decl(subtypingWithConstructSignatures5.ts, 37, 13)) a6: new (x: (arg: T) => U) => T; // ok, same as a5 but with object type hierarchy ->a6 : Symbol(a6, Decl(subtypingWithConstructSignatures5.ts, 37, 42)) +>a6 : Symbol(I.a6, Decl(subtypingWithConstructSignatures5.ts, 37, 42)) >T : Symbol(T, Decl(subtypingWithConstructSignatures5.ts, 38, 13)) >Base : Symbol(Base, Decl(subtypingWithConstructSignatures5.ts, 0, 0)) >U : Symbol(U, Decl(subtypingWithConstructSignatures5.ts, 38, 28)) @@ -209,7 +209,7 @@ interface I extends B { >T : Symbol(T, Decl(subtypingWithConstructSignatures5.ts, 38, 13)) a7: new (x: (arg: T) => U) => (r: T) => U; // ok ->a7 : Symbol(a7, Decl(subtypingWithConstructSignatures5.ts, 38, 71)) +>a7 : Symbol(I.a7, Decl(subtypingWithConstructSignatures5.ts, 38, 71)) >T : Symbol(T, Decl(subtypingWithConstructSignatures5.ts, 39, 13)) >Base : Symbol(Base, Decl(subtypingWithConstructSignatures5.ts, 0, 0)) >U : Symbol(U, Decl(subtypingWithConstructSignatures5.ts, 39, 28)) @@ -223,7 +223,7 @@ interface I extends B { >U : Symbol(U, Decl(subtypingWithConstructSignatures5.ts, 39, 28)) a8: new (x: (arg: T) => U, y: (arg2: T) => U) => (r: T) => U; // ok ->a8 : Symbol(a8, Decl(subtypingWithConstructSignatures5.ts, 39, 81)) +>a8 : Symbol(I.a8, Decl(subtypingWithConstructSignatures5.ts, 39, 81)) >T : Symbol(T, Decl(subtypingWithConstructSignatures5.ts, 40, 13)) >Base : Symbol(Base, Decl(subtypingWithConstructSignatures5.ts, 0, 0)) >U : Symbol(U, Decl(subtypingWithConstructSignatures5.ts, 40, 28)) @@ -241,7 +241,7 @@ interface I extends B { >U : Symbol(U, Decl(subtypingWithConstructSignatures5.ts, 40, 28)) a9: new (x: (arg: T) => U, y: (arg2: { foo: string; bing: number }) => U) => (r: T) => U; // ok, same as a8 with compatible object literal ->a9 : Symbol(a9, Decl(subtypingWithConstructSignatures5.ts, 40, 100)) +>a9 : Symbol(I.a9, Decl(subtypingWithConstructSignatures5.ts, 40, 100)) >T : Symbol(T, Decl(subtypingWithConstructSignatures5.ts, 41, 13)) >Base : Symbol(Base, Decl(subtypingWithConstructSignatures5.ts, 0, 0)) >U : Symbol(U, Decl(subtypingWithConstructSignatures5.ts, 41, 28)) @@ -260,7 +260,7 @@ interface I extends B { >U : Symbol(U, Decl(subtypingWithConstructSignatures5.ts, 41, 28)) a10: new (...x: T[]) => T; // ok ->a10 : Symbol(a10, Decl(subtypingWithConstructSignatures5.ts, 41, 128)) +>a10 : Symbol(I.a10, Decl(subtypingWithConstructSignatures5.ts, 41, 128)) >T : Symbol(T, Decl(subtypingWithConstructSignatures5.ts, 42, 14)) >Derived : Symbol(Derived, Decl(subtypingWithConstructSignatures5.ts, 3, 27)) >x : Symbol(x, Decl(subtypingWithConstructSignatures5.ts, 42, 33)) @@ -268,7 +268,7 @@ interface I extends B { >T : Symbol(T, Decl(subtypingWithConstructSignatures5.ts, 42, 14)) a11: new (x: T, y: T) => T; // ok ->a11 : Symbol(a11, Decl(subtypingWithConstructSignatures5.ts, 42, 49)) +>a11 : Symbol(I.a11, Decl(subtypingWithConstructSignatures5.ts, 42, 49)) >T : Symbol(T, Decl(subtypingWithConstructSignatures5.ts, 43, 14)) >Base : Symbol(Base, Decl(subtypingWithConstructSignatures5.ts, 0, 0)) >x : Symbol(x, Decl(subtypingWithConstructSignatures5.ts, 43, 30)) @@ -278,7 +278,7 @@ interface I extends B { >T : Symbol(T, Decl(subtypingWithConstructSignatures5.ts, 43, 14)) a12: new >(x: Array, y: T) => Array; // ok, less specific parameter type ->a12 : Symbol(a12, Decl(subtypingWithConstructSignatures5.ts, 43, 47)) +>a12 : Symbol(I.a12, Decl(subtypingWithConstructSignatures5.ts, 43, 47)) >T : Symbol(T, Decl(subtypingWithConstructSignatures5.ts, 44, 14)) >Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >Base : Symbol(Base, Decl(subtypingWithConstructSignatures5.ts, 0, 0)) @@ -291,7 +291,7 @@ interface I extends B { >Derived : Symbol(Derived, Decl(subtypingWithConstructSignatures5.ts, 3, 27)) a13: new >(x: Array, y: T) => T; // ok, T = Array, satisfies constraint, contextual signature instantiation succeeds ->a13 : Symbol(a13, Decl(subtypingWithConstructSignatures5.ts, 44, 77)) +>a13 : Symbol(I.a13, Decl(subtypingWithConstructSignatures5.ts, 44, 77)) >T : Symbol(T, Decl(subtypingWithConstructSignatures5.ts, 45, 14)) >Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >Derived : Symbol(Derived, Decl(subtypingWithConstructSignatures5.ts, 3, 27)) @@ -303,7 +303,7 @@ interface I extends B { >T : Symbol(T, Decl(subtypingWithConstructSignatures5.ts, 45, 14)) a14: new (x: { a: T; b: T }) => T; // ok, best common type yields T = {} but that's satisfactory for this signature ->a14 : Symbol(a14, Decl(subtypingWithConstructSignatures5.ts, 45, 67)) +>a14 : Symbol(I.a14, Decl(subtypingWithConstructSignatures5.ts, 45, 67)) >T : Symbol(T, Decl(subtypingWithConstructSignatures5.ts, 46, 14)) >x : Symbol(x, Decl(subtypingWithConstructSignatures5.ts, 46, 17)) >a : Symbol(a, Decl(subtypingWithConstructSignatures5.ts, 46, 21)) diff --git a/tests/baselines/reference/subtypingWithConstructSignatures6.symbols b/tests/baselines/reference/subtypingWithConstructSignatures6.symbols index 08b9350da88..c8fb0301127 100644 --- a/tests/baselines/reference/subtypingWithConstructSignatures6.symbols +++ b/tests/baselines/reference/subtypingWithConstructSignatures6.symbols @@ -5,48 +5,48 @@ class Base { foo: string; } >Base : Symbol(Base, Decl(subtypingWithConstructSignatures6.ts, 0, 0)) ->foo : Symbol(foo, Decl(subtypingWithConstructSignatures6.ts, 4, 12)) +>foo : Symbol(Base.foo, Decl(subtypingWithConstructSignatures6.ts, 4, 12)) class Derived extends Base { bar: string; } >Derived : Symbol(Derived, Decl(subtypingWithConstructSignatures6.ts, 4, 27)) >Base : Symbol(Base, Decl(subtypingWithConstructSignatures6.ts, 0, 0)) ->bar : Symbol(bar, Decl(subtypingWithConstructSignatures6.ts, 5, 28)) +>bar : Symbol(Derived.bar, Decl(subtypingWithConstructSignatures6.ts, 5, 28)) class Derived2 extends Derived { baz: string; } >Derived2 : Symbol(Derived2, Decl(subtypingWithConstructSignatures6.ts, 5, 43)) >Derived : Symbol(Derived, Decl(subtypingWithConstructSignatures6.ts, 4, 27)) ->baz : Symbol(baz, Decl(subtypingWithConstructSignatures6.ts, 6, 32)) +>baz : Symbol(Derived2.baz, Decl(subtypingWithConstructSignatures6.ts, 6, 32)) class OtherDerived extends Base { bing: string; } >OtherDerived : Symbol(OtherDerived, Decl(subtypingWithConstructSignatures6.ts, 6, 47)) >Base : Symbol(Base, Decl(subtypingWithConstructSignatures6.ts, 0, 0)) ->bing : Symbol(bing, Decl(subtypingWithConstructSignatures6.ts, 7, 33)) +>bing : Symbol(OtherDerived.bing, Decl(subtypingWithConstructSignatures6.ts, 7, 33)) interface A { // T >A : Symbol(A, Decl(subtypingWithConstructSignatures6.ts, 7, 49)) // M's a: new (x: T) => T[]; ->a : Symbol(a, Decl(subtypingWithConstructSignatures6.ts, 9, 13)) +>a : Symbol(A.a, Decl(subtypingWithConstructSignatures6.ts, 9, 13)) >T : Symbol(T, Decl(subtypingWithConstructSignatures6.ts, 11, 12)) >x : Symbol(x, Decl(subtypingWithConstructSignatures6.ts, 11, 15)) >T : Symbol(T, Decl(subtypingWithConstructSignatures6.ts, 11, 12)) >T : Symbol(T, Decl(subtypingWithConstructSignatures6.ts, 11, 12)) a2: new (x: T) => string[]; ->a2 : Symbol(a2, Decl(subtypingWithConstructSignatures6.ts, 11, 28)) +>a2 : Symbol(A.a2, Decl(subtypingWithConstructSignatures6.ts, 11, 28)) >T : Symbol(T, Decl(subtypingWithConstructSignatures6.ts, 12, 13)) >x : Symbol(x, Decl(subtypingWithConstructSignatures6.ts, 12, 16)) >T : Symbol(T, Decl(subtypingWithConstructSignatures6.ts, 12, 13)) a3: new (x: T) => void; ->a3 : Symbol(a3, Decl(subtypingWithConstructSignatures6.ts, 12, 34)) +>a3 : Symbol(A.a3, Decl(subtypingWithConstructSignatures6.ts, 12, 34)) >T : Symbol(T, Decl(subtypingWithConstructSignatures6.ts, 13, 13)) >x : Symbol(x, Decl(subtypingWithConstructSignatures6.ts, 13, 16)) >T : Symbol(T, Decl(subtypingWithConstructSignatures6.ts, 13, 13)) a4: new (x: T, y: U) => string; ->a4 : Symbol(a4, Decl(subtypingWithConstructSignatures6.ts, 13, 30)) +>a4 : Symbol(A.a4, Decl(subtypingWithConstructSignatures6.ts, 13, 30)) >T : Symbol(T, Decl(subtypingWithConstructSignatures6.ts, 14, 13)) >U : Symbol(U, Decl(subtypingWithConstructSignatures6.ts, 14, 15)) >x : Symbol(x, Decl(subtypingWithConstructSignatures6.ts, 14, 19)) @@ -55,7 +55,7 @@ interface A { // T >U : Symbol(U, Decl(subtypingWithConstructSignatures6.ts, 14, 15)) a5: new (x: (arg: T) => U) => T; ->a5 : Symbol(a5, Decl(subtypingWithConstructSignatures6.ts, 14, 41)) +>a5 : Symbol(A.a5, Decl(subtypingWithConstructSignatures6.ts, 14, 41)) >T : Symbol(T, Decl(subtypingWithConstructSignatures6.ts, 15, 13)) >U : Symbol(U, Decl(subtypingWithConstructSignatures6.ts, 15, 15)) >x : Symbol(x, Decl(subtypingWithConstructSignatures6.ts, 15, 19)) @@ -65,7 +65,7 @@ interface A { // T >T : Symbol(T, Decl(subtypingWithConstructSignatures6.ts, 15, 13)) a6: new (x: (arg: T) => Derived) => T; ->a6 : Symbol(a6, Decl(subtypingWithConstructSignatures6.ts, 15, 42)) +>a6 : Symbol(A.a6, Decl(subtypingWithConstructSignatures6.ts, 15, 42)) >T : Symbol(T, Decl(subtypingWithConstructSignatures6.ts, 16, 13)) >Base : Symbol(Base, Decl(subtypingWithConstructSignatures6.ts, 0, 0)) >x : Symbol(x, Decl(subtypingWithConstructSignatures6.ts, 16, 29)) @@ -75,7 +75,7 @@ interface A { // T >T : Symbol(T, Decl(subtypingWithConstructSignatures6.ts, 16, 13)) a11: new (x: { foo: T }, y: { foo: T; bar: T }) => Base; ->a11 : Symbol(a11, Decl(subtypingWithConstructSignatures6.ts, 16, 58)) +>a11 : Symbol(A.a11, Decl(subtypingWithConstructSignatures6.ts, 16, 58)) >T : Symbol(T, Decl(subtypingWithConstructSignatures6.ts, 17, 14)) >x : Symbol(x, Decl(subtypingWithConstructSignatures6.ts, 17, 17)) >foo : Symbol(foo, Decl(subtypingWithConstructSignatures6.ts, 17, 21)) @@ -88,7 +88,7 @@ interface A { // T >Base : Symbol(Base, Decl(subtypingWithConstructSignatures6.ts, 0, 0)) a15: new (x: { a: T; b: T }) => T[]; ->a15 : Symbol(a15, Decl(subtypingWithConstructSignatures6.ts, 17, 63)) +>a15 : Symbol(A.a15, Decl(subtypingWithConstructSignatures6.ts, 17, 63)) >T : Symbol(T, Decl(subtypingWithConstructSignatures6.ts, 18, 14)) >x : Symbol(x, Decl(subtypingWithConstructSignatures6.ts, 18, 17)) >a : Symbol(a, Decl(subtypingWithConstructSignatures6.ts, 18, 21)) @@ -98,7 +98,7 @@ interface A { // T >T : Symbol(T, Decl(subtypingWithConstructSignatures6.ts, 18, 14)) a16: new (x: { a: T; b: T }) => T[]; ->a16 : Symbol(a16, Decl(subtypingWithConstructSignatures6.ts, 18, 43)) +>a16 : Symbol(A.a16, Decl(subtypingWithConstructSignatures6.ts, 18, 43)) >T : Symbol(T, Decl(subtypingWithConstructSignatures6.ts, 19, 14)) >Base : Symbol(Base, Decl(subtypingWithConstructSignatures6.ts, 0, 0)) >x : Symbol(x, Decl(subtypingWithConstructSignatures6.ts, 19, 30)) @@ -116,7 +116,7 @@ interface I extends A { >A : Symbol(A, Decl(subtypingWithConstructSignatures6.ts, 7, 49)) a: new (x: T) => T[]; ->a : Symbol(a, Decl(subtypingWithConstructSignatures6.ts, 23, 26)) +>a : Symbol(I.a, Decl(subtypingWithConstructSignatures6.ts, 23, 26)) >x : Symbol(x, Decl(subtypingWithConstructSignatures6.ts, 24, 12)) >T : Symbol(T, Decl(subtypingWithConstructSignatures6.ts, 23, 12)) >T : Symbol(T, Decl(subtypingWithConstructSignatures6.ts, 23, 12)) @@ -128,7 +128,7 @@ interface I2 extends A { >A : Symbol(A, Decl(subtypingWithConstructSignatures6.ts, 7, 49)) a2: new (x: T) => string[]; ->a2 : Symbol(a2, Decl(subtypingWithConstructSignatures6.ts, 27, 27)) +>a2 : Symbol(I2.a2, Decl(subtypingWithConstructSignatures6.ts, 27, 27)) >x : Symbol(x, Decl(subtypingWithConstructSignatures6.ts, 28, 13)) >T : Symbol(T, Decl(subtypingWithConstructSignatures6.ts, 27, 13)) } @@ -139,7 +139,7 @@ interface I3 extends A { >A : Symbol(A, Decl(subtypingWithConstructSignatures6.ts, 7, 49)) a3: new (x: T) => T; ->a3 : Symbol(a3, Decl(subtypingWithConstructSignatures6.ts, 31, 27)) +>a3 : Symbol(I3.a3, Decl(subtypingWithConstructSignatures6.ts, 31, 27)) >x : Symbol(x, Decl(subtypingWithConstructSignatures6.ts, 32, 13)) >T : Symbol(T, Decl(subtypingWithConstructSignatures6.ts, 31, 13)) >T : Symbol(T, Decl(subtypingWithConstructSignatures6.ts, 31, 13)) @@ -151,7 +151,7 @@ interface I4 extends A { >A : Symbol(A, Decl(subtypingWithConstructSignatures6.ts, 7, 49)) a4: new (x: T, y: U) => string; ->a4 : Symbol(a4, Decl(subtypingWithConstructSignatures6.ts, 35, 27)) +>a4 : Symbol(I4.a4, Decl(subtypingWithConstructSignatures6.ts, 35, 27)) >U : Symbol(U, Decl(subtypingWithConstructSignatures6.ts, 36, 13)) >x : Symbol(x, Decl(subtypingWithConstructSignatures6.ts, 36, 16)) >T : Symbol(T, Decl(subtypingWithConstructSignatures6.ts, 35, 13)) @@ -165,7 +165,7 @@ interface I5 extends A { >A : Symbol(A, Decl(subtypingWithConstructSignatures6.ts, 7, 49)) a5: new (x: (arg: T) => U) => T; ->a5 : Symbol(a5, Decl(subtypingWithConstructSignatures6.ts, 39, 27)) +>a5 : Symbol(I5.a5, Decl(subtypingWithConstructSignatures6.ts, 39, 27)) >U : Symbol(U, Decl(subtypingWithConstructSignatures6.ts, 40, 13)) >x : Symbol(x, Decl(subtypingWithConstructSignatures6.ts, 40, 16)) >arg : Symbol(arg, Decl(subtypingWithConstructSignatures6.ts, 40, 20)) @@ -180,7 +180,7 @@ interface I7 extends A { >A : Symbol(A, Decl(subtypingWithConstructSignatures6.ts, 7, 49)) a11: new (x: { foo: T }, y: { foo: U; bar: U }) => Base; ->a11 : Symbol(a11, Decl(subtypingWithConstructSignatures6.ts, 43, 27)) +>a11 : Symbol(I7.a11, Decl(subtypingWithConstructSignatures6.ts, 43, 27)) >U : Symbol(U, Decl(subtypingWithConstructSignatures6.ts, 44, 14)) >x : Symbol(x, Decl(subtypingWithConstructSignatures6.ts, 44, 17)) >foo : Symbol(foo, Decl(subtypingWithConstructSignatures6.ts, 44, 21)) @@ -199,7 +199,7 @@ interface I9 extends A { >A : Symbol(A, Decl(subtypingWithConstructSignatures6.ts, 7, 49)) a16: new (x: { a: T; b: T }) => T[]; ->a16 : Symbol(a16, Decl(subtypingWithConstructSignatures6.ts, 47, 27)) +>a16 : Symbol(I9.a16, Decl(subtypingWithConstructSignatures6.ts, 47, 27)) >x : Symbol(x, Decl(subtypingWithConstructSignatures6.ts, 48, 14)) >a : Symbol(a, Decl(subtypingWithConstructSignatures6.ts, 48, 18)) >T : Symbol(T, Decl(subtypingWithConstructSignatures6.ts, 47, 13)) diff --git a/tests/baselines/reference/subtypingWithNumericIndexer4.errors.txt b/tests/baselines/reference/subtypingWithNumericIndexer4.errors.txt index 5dd39e0ad63..3f6de942d25 100644 --- a/tests/baselines/reference/subtypingWithNumericIndexer4.errors.txt +++ b/tests/baselines/reference/subtypingWithNumericIndexer4.errors.txt @@ -1,11 +1,9 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithNumericIndexer4.ts(11,7): error TS2415: Class 'B' incorrectly extends base class 'A'. Index signatures are incompatible. Type 'string' is not assignable to type 'Derived'. - Property 'bar' is missing in type 'String'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithNumericIndexer4.ts(20,11): error TS2415: Class 'B' incorrectly extends base class 'A'. Index signatures are incompatible. Type 'string' is not assignable to type 'Base'. - Property 'foo' is missing in type 'String'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithNumericIndexer4.ts(20,23): error TS2344: Type 'Base' does not satisfy the constraint 'Derived'. Property 'bar' is missing in type 'Base'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithNumericIndexer4.ts(24,11): error TS2415: Class 'B3' incorrectly extends base class 'A'. @@ -29,7 +27,6 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2415: Class 'B' incorrectly extends base class 'A'. !!! error TS2415: Index signatures are incompatible. !!! error TS2415: Type 'string' is not assignable to type 'Derived'. -!!! error TS2415: Property 'bar' is missing in type 'String'. [x: number]: string; // error } @@ -43,7 +40,6 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2415: Class 'B' incorrectly extends base class 'A'. !!! error TS2415: Index signatures are incompatible. !!! error TS2415: Type 'string' is not assignable to type 'Base'. -!!! error TS2415: Property 'foo' is missing in type 'String'. ~~~~ !!! error TS2344: Type 'Base' does not satisfy the constraint 'Derived'. !!! error TS2344: Property 'bar' is missing in type 'Base'. diff --git a/tests/baselines/reference/subtypingWithObjectMembers.errors.txt b/tests/baselines/reference/subtypingWithObjectMembers.errors.txt index e292c0867a7..a5d4152b451 100644 --- a/tests/baselines/reference/subtypingWithObjectMembers.errors.txt +++ b/tests/baselines/reference/subtypingWithObjectMembers.errors.txt @@ -1,7 +1,6 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithObjectMembers.ts(12,7): error TS2415: Class 'B' incorrectly extends base class 'A'. Types of property 'bar' are incompatible. Type 'string' is not assignable to type 'Base'. - Property 'foo' is missing in type 'String'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithObjectMembers.ts(22,7): error TS2415: Class 'B2' incorrectly extends base class 'A2'. Types of property '2.0' are incompatible. Type 'string' is not assignable to type 'Base'. @@ -36,7 +35,6 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2415: Class 'B' incorrectly extends base class 'A'. !!! error TS2415: Types of property 'bar' are incompatible. !!! error TS2415: Type 'string' is not assignable to type 'Base'. -!!! error TS2415: Property 'foo' is missing in type 'String'. foo: Derived; // ok bar: string; // error } diff --git a/tests/baselines/reference/subtypingWithObjectMembers2.errors.txt b/tests/baselines/reference/subtypingWithObjectMembers2.errors.txt index 3d46a6e5dc2..cdcc54c5ee9 100644 --- a/tests/baselines/reference/subtypingWithObjectMembers2.errors.txt +++ b/tests/baselines/reference/subtypingWithObjectMembers2.errors.txt @@ -1,7 +1,6 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithObjectMembers2.ts(17,15): error TS2430: Interface 'B' incorrectly extends interface 'A'. Types of property 'bar' are incompatible. Type 'string' is not assignable to type 'Base'. - Property 'foo' is missing in type 'String'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithObjectMembers2.ts(27,15): error TS2430: Interface 'B2' incorrectly extends interface 'A2'. Types of property '2.0' are incompatible. Type 'string' is not assignable to type 'Base'. @@ -41,7 +40,6 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Interface 'B' incorrectly extends interface 'A'. !!! error TS2430: Types of property 'bar' are incompatible. !!! error TS2430: Type 'string' is not assignable to type 'Base'. -!!! error TS2430: Property 'foo' is missing in type 'String'. foo: Derived; // ok bar: string; // error } diff --git a/tests/baselines/reference/subtypingWithObjectMembers4.symbols b/tests/baselines/reference/subtypingWithObjectMembers4.symbols index e710e2a3d4a..94b38bc4c9b 100644 --- a/tests/baselines/reference/subtypingWithObjectMembers4.symbols +++ b/tests/baselines/reference/subtypingWithObjectMembers4.symbols @@ -5,7 +5,7 @@ class Base { >Base : Symbol(Base, Decl(subtypingWithObjectMembers4.ts, 0, 0)) foo: string; ->foo : Symbol(foo, Decl(subtypingWithObjectMembers4.ts, 2, 12)) +>foo : Symbol(Base.foo, Decl(subtypingWithObjectMembers4.ts, 2, 12)) } class Derived extends Base { @@ -13,14 +13,14 @@ class Derived extends Base { >Base : Symbol(Base, Decl(subtypingWithObjectMembers4.ts, 0, 0)) bar: string; ->bar : Symbol(bar, Decl(subtypingWithObjectMembers4.ts, 6, 28)) +>bar : Symbol(Derived.bar, Decl(subtypingWithObjectMembers4.ts, 6, 28)) } class A { >A : Symbol(A, Decl(subtypingWithObjectMembers4.ts, 8, 1)) foo: Base; ->foo : Symbol(foo, Decl(subtypingWithObjectMembers4.ts, 10, 9)) +>foo : Symbol(A.foo, Decl(subtypingWithObjectMembers4.ts, 10, 9)) >Base : Symbol(Base, Decl(subtypingWithObjectMembers4.ts, 0, 0)) } @@ -29,7 +29,7 @@ class B extends A { >A : Symbol(A, Decl(subtypingWithObjectMembers4.ts, 8, 1)) fooo: Derived; // ok, inherits foo ->fooo : Symbol(fooo, Decl(subtypingWithObjectMembers4.ts, 14, 19)) +>fooo : Symbol(B.fooo, Decl(subtypingWithObjectMembers4.ts, 14, 19)) >Derived : Symbol(Derived, Decl(subtypingWithObjectMembers4.ts, 4, 1)) } diff --git a/tests/baselines/reference/subtypingWithObjectMembersOptionality.symbols b/tests/baselines/reference/subtypingWithObjectMembersOptionality.symbols index 7fce581b74b..5b144baa428 100644 --- a/tests/baselines/reference/subtypingWithObjectMembersOptionality.symbols +++ b/tests/baselines/reference/subtypingWithObjectMembersOptionality.symbols @@ -3,17 +3,17 @@ interface Base { foo: string; } >Base : Symbol(Base, Decl(subtypingWithObjectMembersOptionality.ts, 0, 0)) ->foo : Symbol(foo, Decl(subtypingWithObjectMembersOptionality.ts, 2, 16)) +>foo : Symbol(Base.foo, Decl(subtypingWithObjectMembersOptionality.ts, 2, 16)) interface Derived extends Base { bar: string; } >Derived : Symbol(Derived, Decl(subtypingWithObjectMembersOptionality.ts, 2, 31)) >Base : Symbol(Base, Decl(subtypingWithObjectMembersOptionality.ts, 0, 0)) ->bar : Symbol(bar, Decl(subtypingWithObjectMembersOptionality.ts, 3, 32)) +>bar : Symbol(Derived.bar, Decl(subtypingWithObjectMembersOptionality.ts, 3, 32)) interface Derived2 extends Derived { baz: string; } >Derived2 : Symbol(Derived2, Decl(subtypingWithObjectMembersOptionality.ts, 3, 47)) >Derived : Symbol(Derived, Decl(subtypingWithObjectMembersOptionality.ts, 2, 31)) ->baz : Symbol(baz, Decl(subtypingWithObjectMembersOptionality.ts, 4, 36)) +>baz : Symbol(Derived2.baz, Decl(subtypingWithObjectMembersOptionality.ts, 4, 36)) // S is a subtype of a type T, and T is a supertype of S, if one of the following is true, where S' denotes the apparent type (section 3.8.1) of S: // - S' and T are object types and, for each member M in T, one of the following is true: @@ -27,7 +27,7 @@ interface T { >T : Symbol(T, Decl(subtypingWithObjectMembersOptionality.ts, 4, 51)) Foo?: Base; ->Foo : Symbol(Foo, Decl(subtypingWithObjectMembersOptionality.ts, 14, 13)) +>Foo : Symbol(T.Foo, Decl(subtypingWithObjectMembersOptionality.ts, 14, 13)) >Base : Symbol(Base, Decl(subtypingWithObjectMembersOptionality.ts, 0, 0)) } @@ -36,7 +36,7 @@ interface S extends T { >T : Symbol(T, Decl(subtypingWithObjectMembersOptionality.ts, 4, 51)) Foo: Derived ->Foo : Symbol(Foo, Decl(subtypingWithObjectMembersOptionality.ts, 18, 23)) +>Foo : Symbol(S.Foo, Decl(subtypingWithObjectMembersOptionality.ts, 18, 23)) >Derived : Symbol(Derived, Decl(subtypingWithObjectMembersOptionality.ts, 2, 31)) } @@ -93,7 +93,7 @@ module TwoLevels { >T : Symbol(T, Decl(subtypingWithObjectMembersOptionality.ts, 43, 18)) Foo?: Base; ->Foo : Symbol(Foo, Decl(subtypingWithObjectMembersOptionality.ts, 44, 17)) +>Foo : Symbol(T.Foo, Decl(subtypingWithObjectMembersOptionality.ts, 44, 17)) >Base : Symbol(Base, Decl(subtypingWithObjectMembersOptionality.ts, 0, 0)) } @@ -102,7 +102,7 @@ module TwoLevels { >T : Symbol(T, Decl(subtypingWithObjectMembersOptionality.ts, 43, 18)) Foo: Derived2 ->Foo : Symbol(Foo, Decl(subtypingWithObjectMembersOptionality.ts, 48, 27)) +>Foo : Symbol(S.Foo, Decl(subtypingWithObjectMembersOptionality.ts, 48, 27)) >Derived2 : Symbol(Derived2, Decl(subtypingWithObjectMembersOptionality.ts, 3, 47)) } diff --git a/tests/baselines/reference/subtypingWithObjectMembersOptionality3.symbols b/tests/baselines/reference/subtypingWithObjectMembersOptionality3.symbols index e770df28285..2a3e806f540 100644 --- a/tests/baselines/reference/subtypingWithObjectMembersOptionality3.symbols +++ b/tests/baselines/reference/subtypingWithObjectMembersOptionality3.symbols @@ -3,18 +3,18 @@ interface Base { foo: string; } >Base : Symbol(Base, Decl(subtypingWithObjectMembersOptionality3.ts, 0, 0)) ->foo : Symbol(foo, Decl(subtypingWithObjectMembersOptionality3.ts, 2, 16)) +>foo : Symbol(Base.foo, Decl(subtypingWithObjectMembersOptionality3.ts, 2, 16)) interface Derived extends Base { bar: string; } >Derived : Symbol(Derived, Decl(subtypingWithObjectMembersOptionality3.ts, 2, 31)) >Base : Symbol(Base, Decl(subtypingWithObjectMembersOptionality3.ts, 0, 0)) ->bar : Symbol(bar, Decl(subtypingWithObjectMembersOptionality3.ts, 3, 32)) +>bar : Symbol(Derived.bar, Decl(subtypingWithObjectMembersOptionality3.ts, 3, 32)) interface T { >T : Symbol(T, Decl(subtypingWithObjectMembersOptionality3.ts, 3, 47)) Foo?: Base; ->Foo : Symbol(Foo, Decl(subtypingWithObjectMembersOptionality3.ts, 5, 13)) +>Foo : Symbol(T.Foo, Decl(subtypingWithObjectMembersOptionality3.ts, 5, 13)) >Base : Symbol(Base, Decl(subtypingWithObjectMembersOptionality3.ts, 0, 0)) } @@ -23,7 +23,7 @@ interface S extends T { >T : Symbol(T, Decl(subtypingWithObjectMembersOptionality3.ts, 3, 47)) Foo2: Derived // ok ->Foo2 : Symbol(Foo2, Decl(subtypingWithObjectMembersOptionality3.ts, 9, 23)) +>Foo2 : Symbol(S.Foo2, Decl(subtypingWithObjectMembersOptionality3.ts, 9, 23)) >Derived : Symbol(Derived, Decl(subtypingWithObjectMembersOptionality3.ts, 2, 31)) } diff --git a/tests/baselines/reference/subtypingWithObjectMembersOptionality4.symbols b/tests/baselines/reference/subtypingWithObjectMembersOptionality4.symbols index e05cc3d03f8..b1124d49083 100644 --- a/tests/baselines/reference/subtypingWithObjectMembersOptionality4.symbols +++ b/tests/baselines/reference/subtypingWithObjectMembersOptionality4.symbols @@ -3,18 +3,18 @@ interface Base { foo: string; } >Base : Symbol(Base, Decl(subtypingWithObjectMembersOptionality4.ts, 0, 0)) ->foo : Symbol(foo, Decl(subtypingWithObjectMembersOptionality4.ts, 2, 16)) +>foo : Symbol(Base.foo, Decl(subtypingWithObjectMembersOptionality4.ts, 2, 16)) interface Derived extends Base { bar: string; } >Derived : Symbol(Derived, Decl(subtypingWithObjectMembersOptionality4.ts, 2, 31)) >Base : Symbol(Base, Decl(subtypingWithObjectMembersOptionality4.ts, 0, 0)) ->bar : Symbol(bar, Decl(subtypingWithObjectMembersOptionality4.ts, 3, 32)) +>bar : Symbol(Derived.bar, Decl(subtypingWithObjectMembersOptionality4.ts, 3, 32)) interface T { >T : Symbol(T, Decl(subtypingWithObjectMembersOptionality4.ts, 3, 47)) Foo: Base; ->Foo : Symbol(Foo, Decl(subtypingWithObjectMembersOptionality4.ts, 5, 13)) +>Foo : Symbol(T.Foo, Decl(subtypingWithObjectMembersOptionality4.ts, 5, 13)) >Base : Symbol(Base, Decl(subtypingWithObjectMembersOptionality4.ts, 0, 0)) } @@ -23,7 +23,7 @@ interface S extends T { >T : Symbol(T, Decl(subtypingWithObjectMembersOptionality4.ts, 3, 47)) Foo2?: Derived // ok ->Foo2 : Symbol(Foo2, Decl(subtypingWithObjectMembersOptionality4.ts, 9, 23)) +>Foo2 : Symbol(S.Foo2, Decl(subtypingWithObjectMembersOptionality4.ts, 9, 23)) >Derived : Symbol(Derived, Decl(subtypingWithObjectMembersOptionality4.ts, 2, 31)) } diff --git a/tests/baselines/reference/subtypingWithStringIndexer4.errors.txt b/tests/baselines/reference/subtypingWithStringIndexer4.errors.txt index 4aa889444e5..8d4328cdd2d 100644 --- a/tests/baselines/reference/subtypingWithStringIndexer4.errors.txt +++ b/tests/baselines/reference/subtypingWithStringIndexer4.errors.txt @@ -1,11 +1,9 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithStringIndexer4.ts(11,7): error TS2415: Class 'B' incorrectly extends base class 'A'. Index signatures are incompatible. Type 'string' is not assignable to type 'Derived'. - Property 'bar' is missing in type 'String'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithStringIndexer4.ts(20,11): error TS2415: Class 'B' incorrectly extends base class 'A'. Index signatures are incompatible. Type 'string' is not assignable to type 'Base'. - Property 'foo' is missing in type 'String'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithStringIndexer4.ts(20,23): error TS2344: Type 'Base' does not satisfy the constraint 'Derived'. Property 'bar' is missing in type 'Base'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithStringIndexer4.ts(24,11): error TS2415: Class 'B3' incorrectly extends base class 'A'. @@ -29,7 +27,6 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2415: Class 'B' incorrectly extends base class 'A'. !!! error TS2415: Index signatures are incompatible. !!! error TS2415: Type 'string' is not assignable to type 'Derived'. -!!! error TS2415: Property 'bar' is missing in type 'String'. [x: string]: string; // error } @@ -43,7 +40,6 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2415: Class 'B' incorrectly extends base class 'A'. !!! error TS2415: Index signatures are incompatible. !!! error TS2415: Type 'string' is not assignable to type 'Base'. -!!! error TS2415: Property 'foo' is missing in type 'String'. ~~~~ !!! error TS2344: Type 'Base' does not satisfy the constraint 'Derived'. !!! error TS2344: Property 'bar' is missing in type 'Base'. diff --git a/tests/baselines/reference/super2.symbols b/tests/baselines/reference/super2.symbols index 69b0254f270..8bb0c6a735c 100644 --- a/tests/baselines/reference/super2.symbols +++ b/tests/baselines/reference/super2.symbols @@ -4,13 +4,13 @@ class Base5 { >Base5 : Symbol(Base5, Decl(super2.ts, 0, 0)) public x() { ->x : Symbol(x, Decl(super2.ts, 1, 13)) +>x : Symbol(Base5.x, Decl(super2.ts, 1, 13)) return "BaseX"; } public y() { ->y : Symbol(y, Decl(super2.ts, 4, 5)) +>y : Symbol(Base5.y, Decl(super2.ts, 4, 5)) return "BaseY"; } @@ -21,7 +21,7 @@ class Sub5 extends Base5 { >Base5 : Symbol(Base5, Decl(super2.ts, 0, 0)) public x() { ->x : Symbol(x, Decl(super2.ts, 11, 26)) +>x : Symbol(Sub5.x, Decl(super2.ts, 11, 26)) return "SubX"; } @@ -32,7 +32,7 @@ class SubSub5 extends Sub5 { >Sub5 : Symbol(Sub5, Decl(super2.ts, 9, 1)) public x() { ->x : Symbol(x, Decl(super2.ts, 17, 28)) +>x : Symbol(SubSub5.x, Decl(super2.ts, 17, 28)) return super.x(); >super.x : Symbol(Sub5.x, Decl(super2.ts, 11, 26)) @@ -40,7 +40,7 @@ class SubSub5 extends Sub5 { >x : Symbol(Sub5.x, Decl(super2.ts, 11, 26)) } public y() { ->y : Symbol(y, Decl(super2.ts, 20, 5)) +>y : Symbol(SubSub5.y, Decl(super2.ts, 20, 5)) return super.y(); >super.y : Symbol(Base5.y, Decl(super2.ts, 4, 5)) @@ -54,7 +54,7 @@ class Base6 { >Base6 : Symbol(Base6, Decl(super2.ts, 24, 1)) public x() { ->x : Symbol(x, Decl(super2.ts, 27, 13)) +>x : Symbol(Base6.x, Decl(super2.ts, 27, 13)) return "BaseX"; } @@ -65,7 +65,7 @@ class Sub6 extends Base6 { >Base6 : Symbol(Base6, Decl(super2.ts, 24, 1)) public y() { ->y : Symbol(y, Decl(super2.ts, 33, 26)) +>y : Symbol(Sub6.y, Decl(super2.ts, 33, 26)) return "SubY"; } @@ -76,7 +76,7 @@ class SubSub6 extends Sub6 { >Sub6 : Symbol(Sub6, Decl(super2.ts, 31, 1)) public y() { ->y : Symbol(y, Decl(super2.ts, 39, 28)) +>y : Symbol(SubSub6.y, Decl(super2.ts, 39, 28)) return super.y(); >super.y : Symbol(Sub6.y, Decl(super2.ts, 33, 26)) diff --git a/tests/baselines/reference/superAccessInFatArrow1.symbols b/tests/baselines/reference/superAccessInFatArrow1.symbols index 9b0a0607e0a..88715df9a93 100644 --- a/tests/baselines/reference/superAccessInFatArrow1.symbols +++ b/tests/baselines/reference/superAccessInFatArrow1.symbols @@ -6,7 +6,7 @@ module test { >A : Symbol(A, Decl(superAccessInFatArrow1.ts, 0, 13)) foo() { ->foo : Symbol(foo, Decl(superAccessInFatArrow1.ts, 1, 20)) +>foo : Symbol(A.foo, Decl(superAccessInFatArrow1.ts, 1, 20)) } } export class B extends A { @@ -14,16 +14,16 @@ module test { >A : Symbol(A, Decl(superAccessInFatArrow1.ts, 0, 13)) bar(callback: () => void ) { ->bar : Symbol(bar, Decl(superAccessInFatArrow1.ts, 5, 30)) +>bar : Symbol(B.bar, Decl(superAccessInFatArrow1.ts, 5, 30)) >callback : Symbol(callback, Decl(superAccessInFatArrow1.ts, 6, 12)) } runme() { ->runme : Symbol(runme, Decl(superAccessInFatArrow1.ts, 7, 9)) +>runme : Symbol(B.runme, Decl(superAccessInFatArrow1.ts, 7, 9)) this.bar(() => { ->this.bar : Symbol(bar, Decl(superAccessInFatArrow1.ts, 5, 30)) +>this.bar : Symbol(B.bar, Decl(superAccessInFatArrow1.ts, 5, 30)) >this : Symbol(B, Decl(superAccessInFatArrow1.ts, 4, 5)) ->bar : Symbol(bar, Decl(superAccessInFatArrow1.ts, 5, 30)) +>bar : Symbol(B.bar, Decl(superAccessInFatArrow1.ts, 5, 30)) super.foo(); >super.foo : Symbol(A.foo, Decl(superAccessInFatArrow1.ts, 1, 20)) diff --git a/tests/baselines/reference/superCallBeforeThisAccessing1.js b/tests/baselines/reference/superCallBeforeThisAccessing1.js new file mode 100644 index 00000000000..1fc7ab39c91 --- /dev/null +++ b/tests/baselines/reference/superCallBeforeThisAccessing1.js @@ -0,0 +1,40 @@ +//// [superCallBeforeThisAccessing1.ts] +declare var Factory: any + +class Base { + constructor(c) { } +} +class D extends Base { + private _t; + constructor() { + super(i); + var s = { + t: this._t + } + var i = Factory.create(s); + } +} + + +//// [superCallBeforeThisAccessing1.js] +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var Base = (function () { + function Base(c) { + } + return Base; +}()); +var D = (function (_super) { + __extends(D, _super); + function D() { + _super.call(this, i); + var s = { + t: this._t + }; + var i = Factory.create(s); + } + return D; +}(Base)); diff --git a/tests/baselines/reference/superCallBeforeThisAccessing1.symbols b/tests/baselines/reference/superCallBeforeThisAccessing1.symbols new file mode 100644 index 00000000000..63795342381 --- /dev/null +++ b/tests/baselines/reference/superCallBeforeThisAccessing1.symbols @@ -0,0 +1,38 @@ +=== tests/cases/conformance/es6/classDeclaration/superCallBeforeThisAccessing1.ts === +declare var Factory: any +>Factory : Symbol(Factory, Decl(superCallBeforeThisAccessing1.ts, 0, 11)) + +class Base { +>Base : Symbol(Base, Decl(superCallBeforeThisAccessing1.ts, 0, 24)) + + constructor(c) { } +>c : Symbol(c, Decl(superCallBeforeThisAccessing1.ts, 3, 16)) +} +class D extends Base { +>D : Symbol(D, Decl(superCallBeforeThisAccessing1.ts, 4, 1)) +>Base : Symbol(Base, Decl(superCallBeforeThisAccessing1.ts, 0, 24)) + + private _t; +>_t : Symbol(D._t, Decl(superCallBeforeThisAccessing1.ts, 5, 22)) + + constructor() { + super(i); +>super : Symbol(Base, Decl(superCallBeforeThisAccessing1.ts, 0, 24)) +>i : Symbol(i, Decl(superCallBeforeThisAccessing1.ts, 12, 11)) + + var s = { +>s : Symbol(s, Decl(superCallBeforeThisAccessing1.ts, 9, 11)) + + t: this._t +>t : Symbol(t, Decl(superCallBeforeThisAccessing1.ts, 9, 17)) +>this._t : Symbol(D._t, Decl(superCallBeforeThisAccessing1.ts, 5, 22)) +>this : Symbol(D, Decl(superCallBeforeThisAccessing1.ts, 4, 1)) +>_t : Symbol(D._t, Decl(superCallBeforeThisAccessing1.ts, 5, 22)) + } + var i = Factory.create(s); +>i : Symbol(i, Decl(superCallBeforeThisAccessing1.ts, 12, 11)) +>Factory : Symbol(Factory, Decl(superCallBeforeThisAccessing1.ts, 0, 11)) +>s : Symbol(s, Decl(superCallBeforeThisAccessing1.ts, 9, 11)) + } +} + diff --git a/tests/baselines/reference/superCallBeforeThisAccessing1.types b/tests/baselines/reference/superCallBeforeThisAccessing1.types new file mode 100644 index 00000000000..e947653584a --- /dev/null +++ b/tests/baselines/reference/superCallBeforeThisAccessing1.types @@ -0,0 +1,43 @@ +=== tests/cases/conformance/es6/classDeclaration/superCallBeforeThisAccessing1.ts === +declare var Factory: any +>Factory : any + +class Base { +>Base : Base + + constructor(c) { } +>c : any +} +class D extends Base { +>D : D +>Base : Base + + private _t; +>_t : any + + constructor() { + super(i); +>super(i) : void +>super : typeof Base +>i : any + + var s = { +>s : { t: any; } +>{ t: this._t } : { t: any; } + + t: this._t +>t : any +>this._t : any +>this : this +>_t : any + } + var i = Factory.create(s); +>i : any +>Factory.create(s) : any +>Factory.create : any +>Factory : any +>create : any +>s : { t: any; } + } +} + diff --git a/tests/baselines/reference/superCallBeforeThisAccessing2.js b/tests/baselines/reference/superCallBeforeThisAccessing2.js new file mode 100644 index 00000000000..e5acf06bbfd --- /dev/null +++ b/tests/baselines/reference/superCallBeforeThisAccessing2.js @@ -0,0 +1,31 @@ +//// [superCallBeforeThisAccessing2.ts] +class Base { + constructor(c) { } +} +class D extends Base { + private _t; + constructor() { + super(() => { this._t }); // no error. only check when this is directly accessing in constructor + } +} + + +//// [superCallBeforeThisAccessing2.js] +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var Base = (function () { + function Base(c) { + } + return Base; +}()); +var D = (function (_super) { + __extends(D, _super); + function D() { + var _this = this; + _super.call(this, function () { _this._t; }); // no error. only check when this is directly accessing in constructor + } + return D; +}(Base)); diff --git a/tests/baselines/reference/superCallBeforeThisAccessing2.symbols b/tests/baselines/reference/superCallBeforeThisAccessing2.symbols new file mode 100644 index 00000000000..3684f853101 --- /dev/null +++ b/tests/baselines/reference/superCallBeforeThisAccessing2.symbols @@ -0,0 +1,23 @@ +=== tests/cases/conformance/es6/classDeclaration/superCallBeforeThisAccessing2.ts === +class Base { +>Base : Symbol(Base, Decl(superCallBeforeThisAccessing2.ts, 0, 0)) + + constructor(c) { } +>c : Symbol(c, Decl(superCallBeforeThisAccessing2.ts, 1, 16)) +} +class D extends Base { +>D : Symbol(D, Decl(superCallBeforeThisAccessing2.ts, 2, 1)) +>Base : Symbol(Base, Decl(superCallBeforeThisAccessing2.ts, 0, 0)) + + private _t; +>_t : Symbol(D._t, Decl(superCallBeforeThisAccessing2.ts, 3, 22)) + + constructor() { + super(() => { this._t }); // no error. only check when this is directly accessing in constructor +>super : Symbol(Base, Decl(superCallBeforeThisAccessing2.ts, 0, 0)) +>this._t : Symbol(D._t, Decl(superCallBeforeThisAccessing2.ts, 3, 22)) +>this : Symbol(D, Decl(superCallBeforeThisAccessing2.ts, 2, 1)) +>_t : Symbol(D._t, Decl(superCallBeforeThisAccessing2.ts, 3, 22)) + } +} + diff --git a/tests/baselines/reference/superCallBeforeThisAccessing2.types b/tests/baselines/reference/superCallBeforeThisAccessing2.types new file mode 100644 index 00000000000..cf0f54b6246 --- /dev/null +++ b/tests/baselines/reference/superCallBeforeThisAccessing2.types @@ -0,0 +1,25 @@ +=== tests/cases/conformance/es6/classDeclaration/superCallBeforeThisAccessing2.ts === +class Base { +>Base : Base + + constructor(c) { } +>c : any +} +class D extends Base { +>D : D +>Base : Base + + private _t; +>_t : any + + constructor() { + super(() => { this._t }); // no error. only check when this is directly accessing in constructor +>super(() => { this._t }) : void +>super : typeof Base +>() => { this._t } : () => void +>this._t : any +>this : this +>_t : any + } +} + diff --git a/tests/baselines/reference/superCallBeforeThisAccessing3.errors.txt b/tests/baselines/reference/superCallBeforeThisAccessing3.errors.txt new file mode 100644 index 00000000000..90b9b034263 --- /dev/null +++ b/tests/baselines/reference/superCallBeforeThisAccessing3.errors.txt @@ -0,0 +1,19 @@ +tests/cases/conformance/es6/classDeclaration/superCallBeforeThisAccessing3.ts(9,9): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. + + +==== tests/cases/conformance/es6/classDeclaration/superCallBeforeThisAccessing3.ts (1 errors) ==== + class Base { + constructor(c) { } + } + class D extends Base { + private _t; + constructor() { + let x = () => { this._t }; + x(); // no error; we only check super is called before this when the container is a constructor + this._t; // error + ~~~~ +!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. + super(undefined); + } + } + \ No newline at end of file diff --git a/tests/baselines/reference/superCallBeforeThisAccessing3.js b/tests/baselines/reference/superCallBeforeThisAccessing3.js new file mode 100644 index 00000000000..101d74e4bc7 --- /dev/null +++ b/tests/baselines/reference/superCallBeforeThisAccessing3.js @@ -0,0 +1,37 @@ +//// [superCallBeforeThisAccessing3.ts] +class Base { + constructor(c) { } +} +class D extends Base { + private _t; + constructor() { + let x = () => { this._t }; + x(); // no error; we only check super is called before this when the container is a constructor + this._t; // error + super(undefined); + } +} + + +//// [superCallBeforeThisAccessing3.js] +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var Base = (function () { + function Base(c) { + } + return Base; +}()); +var D = (function (_super) { + __extends(D, _super); + function D() { + var _this = this; + var x = function () { _this._t; }; + x(); // no error; we only check super is called before this when the container is a constructor + this._t; // error + _super.call(this, undefined); + } + return D; +}(Base)); diff --git a/tests/baselines/reference/superCallBeforeThisAccessing4.errors.txt b/tests/baselines/reference/superCallBeforeThisAccessing4.errors.txt new file mode 100644 index 00000000000..91c3e7763f6 --- /dev/null +++ b/tests/baselines/reference/superCallBeforeThisAccessing4.errors.txt @@ -0,0 +1,24 @@ +tests/cases/conformance/es6/classDeclaration/superCallBeforeThisAccessing4.ts(5,9): error TS17005: A constructor cannot contain a 'super' call when its class extends 'null' +tests/cases/conformance/es6/classDeclaration/superCallBeforeThisAccessing4.ts(12,9): error TS17005: A constructor cannot contain a 'super' call when its class extends 'null' + + +==== tests/cases/conformance/es6/classDeclaration/superCallBeforeThisAccessing4.ts (2 errors) ==== + class D extends null { + private _t; + constructor() { + this._t; + super(); + ~~~~~~~ +!!! error TS17005: A constructor cannot contain a 'super' call when its class extends 'null' + } + } + + class E extends null { + private _t; + constructor() { + super(); + ~~~~~~~ +!!! error TS17005: A constructor cannot contain a 'super' call when its class extends 'null' + this._t; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/superCallBeforeThisAccessing4.js b/tests/baselines/reference/superCallBeforeThisAccessing4.js new file mode 100644 index 00000000000..9c3c5ab60c4 --- /dev/null +++ b/tests/baselines/reference/superCallBeforeThisAccessing4.js @@ -0,0 +1,39 @@ +//// [superCallBeforeThisAccessing4.ts] +class D extends null { + private _t; + constructor() { + this._t; + super(); + } +} + +class E extends null { + private _t; + constructor() { + super(); + this._t; + } +} + +//// [superCallBeforeThisAccessing4.js] +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var D = (function (_super) { + __extends(D, _super); + function D() { + this._t; + _super.call(this); + } + return D; +}(null)); +var E = (function (_super) { + __extends(E, _super); + function E() { + _super.call(this); + this._t; + } + return E; +}(null)); diff --git a/tests/baselines/reference/superCallBeforeThisAccessing5.js b/tests/baselines/reference/superCallBeforeThisAccessing5.js new file mode 100644 index 00000000000..3281a3f8b55 --- /dev/null +++ b/tests/baselines/reference/superCallBeforeThisAccessing5.js @@ -0,0 +1,22 @@ +//// [superCallBeforeThisAccessing5.ts] +class D extends null { + private _t; + constructor() { + this._t; // No error + } +} + + +//// [superCallBeforeThisAccessing5.js] +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var D = (function (_super) { + __extends(D, _super); + function D() { + this._t; // No error + } + return D; +}(null)); diff --git a/tests/baselines/reference/superCallBeforeThisAccessing5.symbols b/tests/baselines/reference/superCallBeforeThisAccessing5.symbols new file mode 100644 index 00000000000..908f0f59add --- /dev/null +++ b/tests/baselines/reference/superCallBeforeThisAccessing5.symbols @@ -0,0 +1,15 @@ +=== tests/cases/conformance/es6/classDeclaration/superCallBeforeThisAccessing5.ts === +class D extends null { +>D : Symbol(D, Decl(superCallBeforeThisAccessing5.ts, 0, 0)) + + private _t; +>_t : Symbol(D._t, Decl(superCallBeforeThisAccessing5.ts, 0, 22)) + + constructor() { + this._t; // No error +>this._t : Symbol(D._t, Decl(superCallBeforeThisAccessing5.ts, 0, 22)) +>this : Symbol(D, Decl(superCallBeforeThisAccessing5.ts, 0, 0)) +>_t : Symbol(D._t, Decl(superCallBeforeThisAccessing5.ts, 0, 22)) + } +} + diff --git a/tests/baselines/reference/superCallBeforeThisAccessing5.types b/tests/baselines/reference/superCallBeforeThisAccessing5.types new file mode 100644 index 00000000000..2c0fc33c4dc --- /dev/null +++ b/tests/baselines/reference/superCallBeforeThisAccessing5.types @@ -0,0 +1,16 @@ +=== tests/cases/conformance/es6/classDeclaration/superCallBeforeThisAccessing5.ts === +class D extends null { +>D : D +>null : null + + private _t; +>_t : any + + constructor() { + this._t; // No error +>this._t : any +>this : this +>_t : any + } +} + diff --git a/tests/baselines/reference/superCallBeforeThisAccessing6.errors.txt b/tests/baselines/reference/superCallBeforeThisAccessing6.errors.txt new file mode 100644 index 00000000000..346b2d58bec --- /dev/null +++ b/tests/baselines/reference/superCallBeforeThisAccessing6.errors.txt @@ -0,0 +1,16 @@ +tests/cases/conformance/es6/classDeclaration/superCallBeforeThisAccessing6.ts(7,15): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. + + +==== tests/cases/conformance/es6/classDeclaration/superCallBeforeThisAccessing6.ts (1 errors) ==== + class Base { + constructor(c) { } + } + class D extends Base { + private _t; + constructor() { + super(this); + ~~~~ +!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. + } + } + \ No newline at end of file diff --git a/tests/baselines/reference/superCallBeforeThisAccessing6.js b/tests/baselines/reference/superCallBeforeThisAccessing6.js new file mode 100644 index 00000000000..746ce9f2791 --- /dev/null +++ b/tests/baselines/reference/superCallBeforeThisAccessing6.js @@ -0,0 +1,30 @@ +//// [superCallBeforeThisAccessing6.ts] +class Base { + constructor(c) { } +} +class D extends Base { + private _t; + constructor() { + super(this); + } +} + + +//// [superCallBeforeThisAccessing6.js] +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var Base = (function () { + function Base(c) { + } + return Base; +}()); +var D = (function (_super) { + __extends(D, _super); + function D() { + _super.call(this, this); + } + return D; +}(Base)); diff --git a/tests/baselines/reference/superCallBeforeThisAccessing7.errors.txt b/tests/baselines/reference/superCallBeforeThisAccessing7.errors.txt new file mode 100644 index 00000000000..4e374fd96ea --- /dev/null +++ b/tests/baselines/reference/superCallBeforeThisAccessing7.errors.txt @@ -0,0 +1,19 @@ +tests/cases/conformance/es6/classDeclaration/superCallBeforeThisAccessing7.ts(8,16): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. + + +==== tests/cases/conformance/es6/classDeclaration/superCallBeforeThisAccessing7.ts (1 errors) ==== + class Base { + constructor(c) { } + } + class D extends Base { + private _t; + constructor() { + let x = { + j: this._t, + ~~~~ +!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. + } + super(undefined); + } + } + \ No newline at end of file diff --git a/tests/baselines/reference/superCallBeforeThisAccessing7.js b/tests/baselines/reference/superCallBeforeThisAccessing7.js new file mode 100644 index 00000000000..c3aa1655cf7 --- /dev/null +++ b/tests/baselines/reference/superCallBeforeThisAccessing7.js @@ -0,0 +1,36 @@ +//// [superCallBeforeThisAccessing7.ts] +class Base { + constructor(c) { } +} +class D extends Base { + private _t; + constructor() { + let x = { + j: this._t, + } + super(undefined); + } +} + + +//// [superCallBeforeThisAccessing7.js] +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var Base = (function () { + function Base(c) { + } + return Base; +}()); +var D = (function (_super) { + __extends(D, _super); + function D() { + var x = { + j: this._t + }; + _super.call(this, undefined); + } + return D; +}(Base)); diff --git a/tests/baselines/reference/superCallBeforeThisAccessing8.js b/tests/baselines/reference/superCallBeforeThisAccessing8.js new file mode 100644 index 00000000000..0865c4305a5 --- /dev/null +++ b/tests/baselines/reference/superCallBeforeThisAccessing8.js @@ -0,0 +1,36 @@ +//// [superCallBeforeThisAccessing8.ts] +class Base { + constructor(c) { } +} +class D extends Base { + private _t; + constructor() { + let x = { + k: super(undefined), + j: this._t, // no error + } + } +} + + +//// [superCallBeforeThisAccessing8.js] +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var Base = (function () { + function Base(c) { + } + return Base; +}()); +var D = (function (_super) { + __extends(D, _super); + function D() { + var x = { + k: _super.call(this, undefined), + j: this._t + }; + } + return D; +}(Base)); diff --git a/tests/baselines/reference/superCallBeforeThisAccessing8.symbols b/tests/baselines/reference/superCallBeforeThisAccessing8.symbols new file mode 100644 index 00000000000..e60ec92e917 --- /dev/null +++ b/tests/baselines/reference/superCallBeforeThisAccessing8.symbols @@ -0,0 +1,32 @@ +=== tests/cases/conformance/es6/classDeclaration/superCallBeforeThisAccessing8.ts === +class Base { +>Base : Symbol(Base, Decl(superCallBeforeThisAccessing8.ts, 0, 0)) + + constructor(c) { } +>c : Symbol(c, Decl(superCallBeforeThisAccessing8.ts, 1, 16)) +} +class D extends Base { +>D : Symbol(D, Decl(superCallBeforeThisAccessing8.ts, 2, 1)) +>Base : Symbol(Base, Decl(superCallBeforeThisAccessing8.ts, 0, 0)) + + private _t; +>_t : Symbol(D._t, Decl(superCallBeforeThisAccessing8.ts, 3, 22)) + + constructor() { + let x = { +>x : Symbol(x, Decl(superCallBeforeThisAccessing8.ts, 6, 11)) + + k: super(undefined), +>k : Symbol(k, Decl(superCallBeforeThisAccessing8.ts, 6, 17)) +>super : Symbol(Base, Decl(superCallBeforeThisAccessing8.ts, 0, 0)) +>undefined : Symbol(undefined) + + j: this._t, // no error +>j : Symbol(j, Decl(superCallBeforeThisAccessing8.ts, 7, 32)) +>this._t : Symbol(D._t, Decl(superCallBeforeThisAccessing8.ts, 3, 22)) +>this : Symbol(D, Decl(superCallBeforeThisAccessing8.ts, 2, 1)) +>_t : Symbol(D._t, Decl(superCallBeforeThisAccessing8.ts, 3, 22)) + } + } +} + diff --git a/tests/baselines/reference/superCallBeforeThisAccessing8.types b/tests/baselines/reference/superCallBeforeThisAccessing8.types new file mode 100644 index 00000000000..dd92d924ceb --- /dev/null +++ b/tests/baselines/reference/superCallBeforeThisAccessing8.types @@ -0,0 +1,34 @@ +=== tests/cases/conformance/es6/classDeclaration/superCallBeforeThisAccessing8.ts === +class Base { +>Base : Base + + constructor(c) { } +>c : any +} +class D extends Base { +>D : D +>Base : Base + + private _t; +>_t : any + + constructor() { + let x = { +>x : { k: void; j: any; } +>{ k: super(undefined), j: this._t, // no error } : { k: void; j: any; } + + k: super(undefined), +>k : void +>super(undefined) : void +>super : typeof Base +>undefined : undefined + + j: this._t, // no error +>j : any +>this._t : any +>this : this +>_t : any + } + } +} + diff --git a/tests/baselines/reference/superCallFromClassThatDerivesFromGenericType1.symbols b/tests/baselines/reference/superCallFromClassThatDerivesFromGenericType1.symbols index 7220d65dc89..15105a27b98 100644 --- a/tests/baselines/reference/superCallFromClassThatDerivesFromGenericType1.symbols +++ b/tests/baselines/reference/superCallFromClassThatDerivesFromGenericType1.symbols @@ -4,7 +4,7 @@ declare class B { >T : Symbol(T, Decl(superCallFromClassThatDerivesFromGenericType1.ts, 0, 16)) m(): B; ->m : Symbol(m, Decl(superCallFromClassThatDerivesFromGenericType1.ts, 0, 20)) +>m : Symbol(B.m, Decl(superCallFromClassThatDerivesFromGenericType1.ts, 0, 20)) >U : Symbol(U, Decl(superCallFromClassThatDerivesFromGenericType1.ts, 1, 6)) >B : Symbol(B, Decl(superCallFromClassThatDerivesFromGenericType1.ts, 0, 0)) >U : Symbol(U, Decl(superCallFromClassThatDerivesFromGenericType1.ts, 1, 6)) diff --git a/tests/baselines/reference/superCallFromClassThatDerivesFromGenericType2.symbols b/tests/baselines/reference/superCallFromClassThatDerivesFromGenericType2.symbols index eca7cd26b03..e04a2fd286a 100644 --- a/tests/baselines/reference/superCallFromClassThatDerivesFromGenericType2.symbols +++ b/tests/baselines/reference/superCallFromClassThatDerivesFromGenericType2.symbols @@ -4,7 +4,7 @@ declare class B { >T : Symbol(T, Decl(superCallFromClassThatDerivesFromGenericType2.ts, 0, 16)) m(): B; ->m : Symbol(m, Decl(superCallFromClassThatDerivesFromGenericType2.ts, 0, 20)) +>m : Symbol(B.m, Decl(superCallFromClassThatDerivesFromGenericType2.ts, 0, 20)) >U : Symbol(U, Decl(superCallFromClassThatDerivesFromGenericType2.ts, 1, 6)) >B : Symbol(B, Decl(superCallFromClassThatDerivesFromGenericType2.ts, 0, 0)) >U : Symbol(U, Decl(superCallFromClassThatDerivesFromGenericType2.ts, 1, 6)) diff --git a/tests/baselines/reference/superCallInsideObjectLiteralExpression.symbols b/tests/baselines/reference/superCallInsideObjectLiteralExpression.symbols index d01899ecfef..9199c3e5a04 100644 --- a/tests/baselines/reference/superCallInsideObjectLiteralExpression.symbols +++ b/tests/baselines/reference/superCallInsideObjectLiteralExpression.symbols @@ -3,7 +3,7 @@ class A { >A : Symbol(A, Decl(superCallInsideObjectLiteralExpression.ts, 0, 0)) foo() { ->foo : Symbol(foo, Decl(superCallInsideObjectLiteralExpression.ts, 0, 9)) +>foo : Symbol(A.foo, Decl(superCallInsideObjectLiteralExpression.ts, 0, 9)) } } diff --git a/tests/baselines/reference/superCallParameterContextualTyping1.symbols b/tests/baselines/reference/superCallParameterContextualTyping1.symbols index ed845b7cd4e..91eff4b3c8b 100644 --- a/tests/baselines/reference/superCallParameterContextualTyping1.symbols +++ b/tests/baselines/reference/superCallParameterContextualTyping1.symbols @@ -6,7 +6,7 @@ class A { >T2 : Symbol(T2, Decl(superCallParameterContextualTyping1.ts, 1, 11)) constructor(private map: (value: T1) => T2) { ->map : Symbol(map, Decl(superCallParameterContextualTyping1.ts, 2, 16)) +>map : Symbol(A.map, Decl(superCallParameterContextualTyping1.ts, 2, 16)) >value : Symbol(value, Decl(superCallParameterContextualTyping1.ts, 2, 30)) >T1 : Symbol(T1, Decl(superCallParameterContextualTyping1.ts, 1, 8)) >T2 : Symbol(T2, Decl(superCallParameterContextualTyping1.ts, 1, 11)) @@ -22,7 +22,7 @@ class B extends A { constructor() { super(value => String(value.toExponential())); } >super : Symbol(A, Decl(superCallParameterContextualTyping1.ts, 0, 0)) >value : Symbol(value, Decl(superCallParameterContextualTyping1.ts, 9, 26)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >value.toExponential : Symbol(Number.toExponential, Decl(lib.d.ts, --, --)) >value : Symbol(value, Decl(superCallParameterContextualTyping1.ts, 9, 26)) >toExponential : Symbol(Number.toExponential, Decl(lib.d.ts, --, --)) diff --git a/tests/baselines/reference/superCallParameterContextualTyping3.symbols b/tests/baselines/reference/superCallParameterContextualTyping3.symbols index e51687b4539..55101b7f053 100644 --- a/tests/baselines/reference/superCallParameterContextualTyping3.symbols +++ b/tests/baselines/reference/superCallParameterContextualTyping3.symbols @@ -4,7 +4,7 @@ interface ContextualType { >T : Symbol(T, Decl(superCallParameterContextualTyping3.ts, 0, 25)) method(parameter: T): void; ->method : Symbol(method, Decl(superCallParameterContextualTyping3.ts, 0, 29)) +>method : Symbol(ContextualType.method, Decl(superCallParameterContextualTyping3.ts, 0, 29)) >parameter : Symbol(parameter, Decl(superCallParameterContextualTyping3.ts, 1, 11)) >T : Symbol(T, Decl(superCallParameterContextualTyping3.ts, 0, 25)) } @@ -20,7 +20,7 @@ class CBase { } foo(param: ContextualType) { ->foo : Symbol(foo, Decl(superCallParameterContextualTyping3.ts, 6, 5)) +>foo : Symbol(CBase.foo, Decl(superCallParameterContextualTyping3.ts, 6, 5)) >param : Symbol(param, Decl(superCallParameterContextualTyping3.ts, 8, 8)) >ContextualType : Symbol(ContextualType, Decl(superCallParameterContextualTyping3.ts, 0, 0)) >T : Symbol(T, Decl(superCallParameterContextualTyping3.ts, 4, 12)) diff --git a/tests/baselines/reference/superCalls.symbols b/tests/baselines/reference/superCalls.symbols index 3c91d2bace0..61835288637 100644 --- a/tests/baselines/reference/superCalls.symbols +++ b/tests/baselines/reference/superCalls.symbols @@ -3,7 +3,7 @@ class Base { >Base : Symbol(Base, Decl(superCalls.ts, 0, 0)) x = 43; ->x : Symbol(x, Decl(superCalls.ts, 0, 12)) +>x : Symbol(Base.x, Decl(superCalls.ts, 0, 12)) constructor(n: string) { >n : Symbol(n, Decl(superCalls.ts, 2, 16)) @@ -20,7 +20,7 @@ class Derived extends Base { //super call in class constructor of derived type constructor(public q: number) { ->q : Symbol(q, Decl(superCalls.ts, 11, 16)) +>q : Symbol(Derived.q, Decl(superCalls.ts, 11, 16)) super(''); >super : Symbol(Base, Decl(superCalls.ts, 0, 0)) diff --git a/tests/baselines/reference/superInCatchBlock1.symbols b/tests/baselines/reference/superInCatchBlock1.symbols index 02b931a67ff..374a736e338 100644 --- a/tests/baselines/reference/superInCatchBlock1.symbols +++ b/tests/baselines/reference/superInCatchBlock1.symbols @@ -3,14 +3,14 @@ class A { >A : Symbol(A, Decl(superInCatchBlock1.ts, 0, 0)) m(): void { } ->m : Symbol(m, Decl(superInCatchBlock1.ts, 0, 9)) +>m : Symbol(A.m, Decl(superInCatchBlock1.ts, 0, 9)) } class B extends A { >B : Symbol(B, Decl(superInCatchBlock1.ts, 2, 1)) >A : Symbol(A, Decl(superInCatchBlock1.ts, 0, 0)) m() { ->m : Symbol(m, Decl(superInCatchBlock1.ts, 3, 19)) +>m : Symbol(B.m, Decl(superInCatchBlock1.ts, 3, 19)) try { } diff --git a/tests/baselines/reference/superPropertyAccess.errors.txt b/tests/baselines/reference/superPropertyAccess.errors.txt index 41e0a0adac5..22b1a1c5346 100644 --- a/tests/baselines/reference/superPropertyAccess.errors.txt +++ b/tests/baselines/reference/superPropertyAccess.errors.txt @@ -1,7 +1,7 @@ tests/cases/compiler/superPropertyAccess.ts(8,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/superPropertyAccess.ts(9,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/superPropertyAccess.ts(22,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword. -tests/cases/compiler/superPropertyAccess.ts(24,9): error TS2341: Property 'p1' is private and only accessible within class 'MyBase'. +tests/cases/compiler/superPropertyAccess.ts(24,15): error TS2341: Property 'p1' is private and only accessible within class 'MyBase'. tests/cases/compiler/superPropertyAccess.ts(26,24): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword. tests/cases/compiler/superPropertyAccess.ts(28,24): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword. tests/cases/compiler/superPropertyAccess.ts(32,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword. @@ -39,7 +39,7 @@ tests/cases/compiler/superPropertyAccess.ts(34,23): error TS2340: Only public an !!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword. super.p1(); // Should error, private not public instance member function - ~~~~~~~~ + ~~ !!! error TS2341: Property 'p1' is private and only accessible within class 'MyBase'. var l1 = super.d1; // Should error, instance data property not a public instance member function diff --git a/tests/baselines/reference/superPropertyAccessInComputedPropertiesOfNestedType_ES5.symbols b/tests/baselines/reference/superPropertyAccessInComputedPropertiesOfNestedType_ES5.symbols index 1379d50179f..d29cfed7084 100644 --- a/tests/baselines/reference/superPropertyAccessInComputedPropertiesOfNestedType_ES5.symbols +++ b/tests/baselines/reference/superPropertyAccessInComputedPropertiesOfNestedType_ES5.symbols @@ -3,7 +3,7 @@ class A { >A : Symbol(A, Decl(superPropertyAccessInComputedPropertiesOfNestedType_ES5.ts, 0, 0)) foo() { return 1; } ->foo : Symbol(foo, Decl(superPropertyAccessInComputedPropertiesOfNestedType_ES5.ts, 0, 9)) +>foo : Symbol(A.foo, Decl(superPropertyAccessInComputedPropertiesOfNestedType_ES5.ts, 0, 9)) } class B extends A { @@ -11,10 +11,10 @@ class B extends A { >A : Symbol(A, Decl(superPropertyAccessInComputedPropertiesOfNestedType_ES5.ts, 0, 0)) foo() { return 2; } ->foo : Symbol(foo, Decl(superPropertyAccessInComputedPropertiesOfNestedType_ES5.ts, 4, 19)) +>foo : Symbol(B.foo, Decl(superPropertyAccessInComputedPropertiesOfNestedType_ES5.ts, 4, 19)) bar() { ->bar : Symbol(bar, Decl(superPropertyAccessInComputedPropertiesOfNestedType_ES5.ts, 5, 23)) +>bar : Symbol(B.bar, Decl(superPropertyAccessInComputedPropertiesOfNestedType_ES5.ts, 5, 23)) return class { [super.foo()]() { diff --git a/tests/baselines/reference/superPropertyAccessInComputedPropertiesOfNestedType_ES6.symbols b/tests/baselines/reference/superPropertyAccessInComputedPropertiesOfNestedType_ES6.symbols index 12446259f32..2eae0080f4b 100644 --- a/tests/baselines/reference/superPropertyAccessInComputedPropertiesOfNestedType_ES6.symbols +++ b/tests/baselines/reference/superPropertyAccessInComputedPropertiesOfNestedType_ES6.symbols @@ -3,7 +3,7 @@ class A { >A : Symbol(A, Decl(superPropertyAccessInComputedPropertiesOfNestedType_ES6.ts, 0, 0)) foo() { return 1; } ->foo : Symbol(foo, Decl(superPropertyAccessInComputedPropertiesOfNestedType_ES6.ts, 0, 9)) +>foo : Symbol(A.foo, Decl(superPropertyAccessInComputedPropertiesOfNestedType_ES6.ts, 0, 9)) } class B extends A { @@ -11,10 +11,10 @@ class B extends A { >A : Symbol(A, Decl(superPropertyAccessInComputedPropertiesOfNestedType_ES6.ts, 0, 0)) foo() { return 2; } ->foo : Symbol(foo, Decl(superPropertyAccessInComputedPropertiesOfNestedType_ES6.ts, 4, 19)) +>foo : Symbol(B.foo, Decl(superPropertyAccessInComputedPropertiesOfNestedType_ES6.ts, 4, 19)) bar() { ->bar : Symbol(bar, Decl(superPropertyAccessInComputedPropertiesOfNestedType_ES6.ts, 5, 23)) +>bar : Symbol(B.bar, Decl(superPropertyAccessInComputedPropertiesOfNestedType_ES6.ts, 5, 23)) return class { [super.foo()]() { diff --git a/tests/baselines/reference/superPropertyAccess_ES6.symbols b/tests/baselines/reference/superPropertyAccess_ES6.symbols index ada6c5b8057..61b8ab3dc76 100644 --- a/tests/baselines/reference/superPropertyAccess_ES6.symbols +++ b/tests/baselines/reference/superPropertyAccess_ES6.symbols @@ -4,10 +4,10 @@ class MyBase { >MyBase : Symbol(MyBase, Decl(superPropertyAccess_ES6.ts, 0, 0)) getValue(): number { return 1; } ->getValue : Symbol(getValue, Decl(superPropertyAccess_ES6.ts, 1, 14)) +>getValue : Symbol(MyBase.getValue, Decl(superPropertyAccess_ES6.ts, 1, 14)) get value(): number { return 1; } ->value : Symbol(value, Decl(superPropertyAccess_ES6.ts, 2, 34)) +>value : Symbol(MyBase.value, Decl(superPropertyAccess_ES6.ts, 2, 34)) } class MyDerived extends MyBase { @@ -46,20 +46,20 @@ class A { >A : Symbol(A, Decl(superPropertyAccess_ES6.ts, 16, 17)) private _property: string; ->_property : Symbol(_property, Decl(superPropertyAccess_ES6.ts, 18, 9)) +>_property : Symbol(A._property, Decl(superPropertyAccess_ES6.ts, 18, 9)) get property() { return this._property; } ->property : Symbol(property, Decl(superPropertyAccess_ES6.ts, 19, 30), Decl(superPropertyAccess_ES6.ts, 20, 45)) ->this._property : Symbol(_property, Decl(superPropertyAccess_ES6.ts, 18, 9)) +>property : Symbol(A.property, Decl(superPropertyAccess_ES6.ts, 19, 30), Decl(superPropertyAccess_ES6.ts, 20, 45)) +>this._property : Symbol(A._property, Decl(superPropertyAccess_ES6.ts, 18, 9)) >this : Symbol(A, Decl(superPropertyAccess_ES6.ts, 16, 17)) ->_property : Symbol(_property, Decl(superPropertyAccess_ES6.ts, 18, 9)) +>_property : Symbol(A._property, Decl(superPropertyAccess_ES6.ts, 18, 9)) set property(value: string) { this._property = value } ->property : Symbol(property, Decl(superPropertyAccess_ES6.ts, 19, 30), Decl(superPropertyAccess_ES6.ts, 20, 45)) +>property : Symbol(A.property, Decl(superPropertyAccess_ES6.ts, 19, 30), Decl(superPropertyAccess_ES6.ts, 20, 45)) >value : Symbol(value, Decl(superPropertyAccess_ES6.ts, 21, 17)) ->this._property : Symbol(_property, Decl(superPropertyAccess_ES6.ts, 18, 9)) +>this._property : Symbol(A._property, Decl(superPropertyAccess_ES6.ts, 18, 9)) >this : Symbol(A, Decl(superPropertyAccess_ES6.ts, 16, 17)) ->_property : Symbol(_property, Decl(superPropertyAccess_ES6.ts, 18, 9)) +>_property : Symbol(A._property, Decl(superPropertyAccess_ES6.ts, 18, 9)) >value : Symbol(value, Decl(superPropertyAccess_ES6.ts, 21, 17)) } @@ -68,7 +68,7 @@ class B extends A { >A : Symbol(A, Decl(superPropertyAccess_ES6.ts, 16, 17)) set property(value: string) { ->property : Symbol(property, Decl(superPropertyAccess_ES6.ts, 24, 19)) +>property : Symbol(B.property, Decl(superPropertyAccess_ES6.ts, 24, 19)) >value : Symbol(value, Decl(superPropertyAccess_ES6.ts, 25, 17)) super.property = value + " addition"; diff --git a/tests/baselines/reference/superSymbolIndexedAccess1.symbols b/tests/baselines/reference/superSymbolIndexedAccess1.symbols index 47131f231cb..9141771f0c9 100644 --- a/tests/baselines/reference/superSymbolIndexedAccess1.symbols +++ b/tests/baselines/reference/superSymbolIndexedAccess1.symbols @@ -1,9 +1,9 @@ === tests/cases/conformance/expressions/superPropertyAccess/superSymbolIndexedAccess1.ts === var symbol = Symbol.for('myThing'); >symbol : Symbol(symbol, Decl(superSymbolIndexedAccess1.ts, 0, 3)) ->Symbol.for : Symbol(SymbolConstructor.for, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->for : Symbol(SymbolConstructor.for, Decl(lib.d.ts, --, --)) +>Symbol.for : Symbol(SymbolConstructor.for, Decl(lib.es2015.symbol.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>for : Symbol(SymbolConstructor.for, Decl(lib.es2015.symbol.d.ts, --, --)) class Foo { >Foo : Symbol(Foo, Decl(superSymbolIndexedAccess1.ts, 0, 35)) diff --git a/tests/baselines/reference/superSymbolIndexedAccess2.symbols b/tests/baselines/reference/superSymbolIndexedAccess2.symbols index 9b65ce358bb..68b503778e7 100644 --- a/tests/baselines/reference/superSymbolIndexedAccess2.symbols +++ b/tests/baselines/reference/superSymbolIndexedAccess2.symbols @@ -4,9 +4,9 @@ class Foo { >Foo : Symbol(Foo, Decl(superSymbolIndexedAccess2.ts, 0, 0)) [Symbol.isConcatSpreadable]() { ->Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, --, --)) +>Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) return 0; } @@ -17,14 +17,14 @@ class Bar extends Foo { >Foo : Symbol(Foo, Decl(superSymbolIndexedAccess2.ts, 0, 0)) [Symbol.isConcatSpreadable]() { ->Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, --, --)) +>Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) return super[Symbol.isConcatSpreadable](); >super : Symbol(Foo, Decl(superSymbolIndexedAccess2.ts, 0, 0)) ->Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, --, --)) +>Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) } } diff --git a/tests/baselines/reference/superSymbolIndexedAccess5.js b/tests/baselines/reference/superSymbolIndexedAccess5.js index 5bc46dbaed5..3acd26d2974 100644 --- a/tests/baselines/reference/superSymbolIndexedAccess5.js +++ b/tests/baselines/reference/superSymbolIndexedAccess5.js @@ -34,7 +34,7 @@ var Bar = (function (_super) { _super.apply(this, arguments); } Bar.prototype[symbol] = function () { - return _super.prototype[symbol](); + return _super.prototype[symbol].call(this); }; return Bar; }(Foo)); diff --git a/tests/baselines/reference/superSymbolIndexedAccess6.js b/tests/baselines/reference/superSymbolIndexedAccess6.js index 417edd9c338..8b04075c411 100644 --- a/tests/baselines/reference/superSymbolIndexedAccess6.js +++ b/tests/baselines/reference/superSymbolIndexedAccess6.js @@ -34,7 +34,7 @@ var Bar = (function (_super) { _super.apply(this, arguments); } Bar[symbol] = function () { - return _super[symbol](); + return _super[symbol].call(this); }; return Bar; }(Foo)); diff --git a/tests/baselines/reference/superWithGenericSpecialization.symbols b/tests/baselines/reference/superWithGenericSpecialization.symbols index 7a8f93b4e28..1ead844b154 100644 --- a/tests/baselines/reference/superWithGenericSpecialization.symbols +++ b/tests/baselines/reference/superWithGenericSpecialization.symbols @@ -4,7 +4,7 @@ class C { >T : Symbol(T, Decl(superWithGenericSpecialization.ts, 0, 8)) x: T; ->x : Symbol(x, Decl(superWithGenericSpecialization.ts, 0, 12)) +>x : Symbol(C.x, Decl(superWithGenericSpecialization.ts, 0, 12)) >T : Symbol(T, Decl(superWithGenericSpecialization.ts, 0, 8)) } @@ -14,7 +14,7 @@ class D extends C { >C : Symbol(C, Decl(superWithGenericSpecialization.ts, 0, 0)) y: T; ->y : Symbol(y, Decl(superWithGenericSpecialization.ts, 4, 30)) +>y : Symbol(D.y, Decl(superWithGenericSpecialization.ts, 4, 30)) >T : Symbol(T, Decl(superWithGenericSpecialization.ts, 4, 8)) constructor() { diff --git a/tests/baselines/reference/superWithGenerics.symbols b/tests/baselines/reference/superWithGenerics.symbols index 43a7e7493b6..79bda5ab120 100644 --- a/tests/baselines/reference/superWithGenerics.symbols +++ b/tests/baselines/reference/superWithGenerics.symbols @@ -4,7 +4,7 @@ declare class B { >T : Symbol(T, Decl(superWithGenerics.ts, 0, 16)) m(): B; ->m : Symbol(m, Decl(superWithGenerics.ts, 0, 20)) +>m : Symbol(B.m, Decl(superWithGenerics.ts, 0, 20)) >U : Symbol(U, Decl(superWithGenerics.ts, 1, 6)) >B : Symbol(B, Decl(superWithGenerics.ts, 0, 0)) >U : Symbol(U, Decl(superWithGenerics.ts, 1, 6)) diff --git a/tests/baselines/reference/switchAssignmentCompat.errors.txt b/tests/baselines/reference/switchAssignmentCompat.errors.txt index 6a2755365ab..747a1035b68 100644 --- a/tests/baselines/reference/switchAssignmentCompat.errors.txt +++ b/tests/baselines/reference/switchAssignmentCompat.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/switchAssignmentCompat.ts(4,10): error TS2322: Type 'typeof Foo' is not assignable to type 'number'. +tests/cases/compiler/switchAssignmentCompat.ts(4,10): error TS2678: Type 'typeof Foo' is not comparable to type 'number'. ==== tests/cases/compiler/switchAssignmentCompat.ts (1 errors) ==== @@ -7,6 +7,6 @@ tests/cases/compiler/switchAssignmentCompat.ts(4,10): error TS2322: Type 'typeof switch (0) { case Foo: break; // Error expected ~~~ -!!! error TS2322: Type 'typeof Foo' is not assignable to type 'number'. +!!! error TS2678: Type 'typeof Foo' is not comparable to type 'number'. } \ No newline at end of file diff --git a/tests/baselines/reference/switchCaseWithIntersectionTypes01.errors.txt b/tests/baselines/reference/switchCaseWithIntersectionTypes01.errors.txt new file mode 100644 index 00000000000..d42f407a784 --- /dev/null +++ b/tests/baselines/reference/switchCaseWithIntersectionTypes01.errors.txt @@ -0,0 +1,38 @@ +tests/cases/conformance/types/typeRelationships/comparable/switchCaseWithIntersectionTypes01.ts(19,10): error TS2678: Type 'number & boolean' is not comparable to type 'string & number'. + Type 'number & boolean' is not comparable to type 'string'. +tests/cases/conformance/types/typeRelationships/comparable/switchCaseWithIntersectionTypes01.ts(23,10): error TS2678: Type 'boolean' is not comparable to type 'string & number'. + Type 'boolean' is not comparable to type 'string'. + + +==== tests/cases/conformance/types/typeRelationships/comparable/switchCaseWithIntersectionTypes01.ts (2 errors) ==== + + var strAndNum: string & number; + var numAndBool: number & boolean; + var str: string; + var num: number; + var bool: boolean; + + switch (strAndNum) { + // Identical + case strAndNum: + break; + + // Constituents + case str: + case num: + break; + + // Overlap in constituents + case numAndBool: + ~~~~~~~~~~ +!!! error TS2678: Type 'number & boolean' is not comparable to type 'string & number'. +!!! error TS2678: Type 'number & boolean' is not comparable to type 'string'. + break; + + // No relation + case bool: + ~~~~ +!!! error TS2678: Type 'boolean' is not comparable to type 'string & number'. +!!! error TS2678: Type 'boolean' is not comparable to type 'string'. + break; + } \ No newline at end of file diff --git a/tests/baselines/reference/switchCaseWithIntersectionTypes01.js b/tests/baselines/reference/switchCaseWithIntersectionTypes01.js new file mode 100644 index 00000000000..4e0ddf7ea76 --- /dev/null +++ b/tests/baselines/reference/switchCaseWithIntersectionTypes01.js @@ -0,0 +1,48 @@ +//// [switchCaseWithIntersectionTypes01.ts] + +var strAndNum: string & number; +var numAndBool: number & boolean; +var str: string; +var num: number; +var bool: boolean; + +switch (strAndNum) { + // Identical + case strAndNum: + break; + + // Constituents + case str: + case num: + break; + + // Overlap in constituents + case numAndBool: + break; + + // No relation + case bool: + break; +} + +//// [switchCaseWithIntersectionTypes01.js] +var strAndNum; +var numAndBool; +var str; +var num; +var bool; +switch (strAndNum) { + // Identical + case strAndNum: + break; + // Constituents + case str: + case num: + break; + // Overlap in constituents + case numAndBool: + break; + // No relation + case bool: + break; +} diff --git a/tests/baselines/reference/switchCaseWithUnionTypes01.errors.txt b/tests/baselines/reference/switchCaseWithUnionTypes01.errors.txt new file mode 100644 index 00000000000..5f164f57343 --- /dev/null +++ b/tests/baselines/reference/switchCaseWithUnionTypes01.errors.txt @@ -0,0 +1,31 @@ +tests/cases/conformance/types/typeRelationships/comparable/switchCaseWithUnionTypes01.ts(23,10): error TS2678: Type 'boolean' is not comparable to type 'string | number'. + + +==== tests/cases/conformance/types/typeRelationships/comparable/switchCaseWithUnionTypes01.ts (1 errors) ==== + + var strOrNum: string | number; + var numOrBool: number | boolean; + var str: string; + var num: number; + var bool: boolean; + + switch (strOrNum) { + // Identical + case strOrNum: + break; + + // Constituents + case str: + case num: + break; + + // Overlap in constituents + case numOrBool: + break; + + // No relation + case bool: + ~~~~ +!!! error TS2678: Type 'boolean' is not comparable to type 'string | number'. + break; + } \ No newline at end of file diff --git a/tests/baselines/reference/switchCaseWithUnionTypes01.js b/tests/baselines/reference/switchCaseWithUnionTypes01.js new file mode 100644 index 00000000000..5c34ea674dc --- /dev/null +++ b/tests/baselines/reference/switchCaseWithUnionTypes01.js @@ -0,0 +1,48 @@ +//// [switchCaseWithUnionTypes01.ts] + +var strOrNum: string | number; +var numOrBool: number | boolean; +var str: string; +var num: number; +var bool: boolean; + +switch (strOrNum) { + // Identical + case strOrNum: + break; + + // Constituents + case str: + case num: + break; + + // Overlap in constituents + case numOrBool: + break; + + // No relation + case bool: + break; +} + +//// [switchCaseWithUnionTypes01.js] +var strOrNum; +var numOrBool; +var str; +var num; +var bool; +switch (strOrNum) { + // Identical + case strOrNum: + break; + // Constituents + case str: + case num: + break; + // Overlap in constituents + case numOrBool: + break; + // No relation + case bool: + break; +} diff --git a/tests/baselines/reference/switchCasesExpressionTypeMismatch.errors.txt b/tests/baselines/reference/switchCasesExpressionTypeMismatch.errors.txt index de739af007d..26d39efef48 100644 --- a/tests/baselines/reference/switchCasesExpressionTypeMismatch.errors.txt +++ b/tests/baselines/reference/switchCasesExpressionTypeMismatch.errors.txt @@ -1,6 +1,6 @@ -tests/cases/compiler/switchCasesExpressionTypeMismatch.ts(4,10): error TS2322: Type 'typeof Foo' is not assignable to type 'number'. -tests/cases/compiler/switchCasesExpressionTypeMismatch.ts(5,10): error TS2322: Type 'string' is not assignable to type 'number'. -tests/cases/compiler/switchCasesExpressionTypeMismatch.ts(7,10): error TS2322: Type 'boolean' is not assignable to type 'number'. +tests/cases/compiler/switchCasesExpressionTypeMismatch.ts(4,10): error TS2678: Type 'typeof Foo' is not comparable to type 'number'. +tests/cases/compiler/switchCasesExpressionTypeMismatch.ts(5,10): error TS2678: Type 'string' is not comparable to type 'number'. +tests/cases/compiler/switchCasesExpressionTypeMismatch.ts(7,10): error TS2678: Type 'boolean' is not comparable to type 'number'. ==== tests/cases/compiler/switchCasesExpressionTypeMismatch.ts (3 errors) ==== @@ -9,14 +9,14 @@ tests/cases/compiler/switchCasesExpressionTypeMismatch.ts(7,10): error TS2322: T switch (0) { case Foo: break; // Error ~~~ -!!! error TS2322: Type 'typeof Foo' is not assignable to type 'number'. +!!! error TS2678: Type 'typeof Foo' is not comparable to type 'number'. case "sss": break; // Error ~~~~~ -!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! error TS2678: Type 'string' is not comparable to type 'number'. case 123: break; // No Error case true: break; // Error ~~~~ -!!! error TS2322: Type 'boolean' is not assignable to type 'number'. +!!! error TS2678: Type 'boolean' is not comparable to type 'number'. } var s: any = 0; diff --git a/tests/baselines/reference/switchStatements.errors.txt b/tests/baselines/reference/switchStatements.errors.txt index c99b0eba909..81e24aa69a8 100644 --- a/tests/baselines/reference/switchStatements.errors.txt +++ b/tests/baselines/reference/switchStatements.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/statements/switchStatements/switchStatements.ts(35,20): error TS2322: Type '{ id: number; name: string; }' is not assignable to type 'C'. +tests/cases/conformance/statements/switchStatements/switchStatements.ts(35,20): error TS2678: Type '{ id: number; name: string; }' is not comparable to type 'C'. Object literal may only specify known properties, and 'name' does not exist in type 'C'. @@ -39,8 +39,8 @@ tests/cases/conformance/statements/switchStatements/switchStatements.ts(35,20): case new D(): case { id: 12, name: '' }: ~~~~~~~~ -!!! error TS2322: Type '{ id: number; name: string; }' is not assignable to type 'C'. -!!! error TS2322: Object literal may only specify known properties, and 'name' does not exist in type 'C'. +!!! error TS2678: Type '{ id: number; name: string; }' is not comparable to type 'C'. +!!! error TS2678: Object literal may only specify known properties, and 'name' does not exist in type 'C'. case new C(): } diff --git a/tests/baselines/reference/symbolDeclarationEmit1.symbols b/tests/baselines/reference/symbolDeclarationEmit1.symbols index 0b1999cf606..86f57e7de92 100644 --- a/tests/baselines/reference/symbolDeclarationEmit1.symbols +++ b/tests/baselines/reference/symbolDeclarationEmit1.symbols @@ -3,7 +3,7 @@ class C { >C : Symbol(C, Decl(symbolDeclarationEmit1.ts, 0, 0)) [Symbol.toPrimitive]: number; ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) } diff --git a/tests/baselines/reference/symbolDeclarationEmit10.symbols b/tests/baselines/reference/symbolDeclarationEmit10.symbols index 7d7cbf257df..bcc562e478e 100644 --- a/tests/baselines/reference/symbolDeclarationEmit10.symbols +++ b/tests/baselines/reference/symbolDeclarationEmit10.symbols @@ -3,13 +3,13 @@ var obj = { >obj : Symbol(obj, Decl(symbolDeclarationEmit10.ts, 0, 3)) get [Symbol.isConcatSpreadable]() { return '' }, ->Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, --, --)) +>Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) set [Symbol.isConcatSpreadable](x) { } ->Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, --, --)) +>Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) >x : Symbol(x, Decl(symbolDeclarationEmit10.ts, 2, 36)) } diff --git a/tests/baselines/reference/symbolDeclarationEmit11.symbols b/tests/baselines/reference/symbolDeclarationEmit11.symbols index a8b9ab0757d..8b270daad5e 100644 --- a/tests/baselines/reference/symbolDeclarationEmit11.symbols +++ b/tests/baselines/reference/symbolDeclarationEmit11.symbols @@ -3,23 +3,23 @@ class C { >C : Symbol(C, Decl(symbolDeclarationEmit11.ts, 0, 0)) static [Symbol.iterator] = 0; ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) static [Symbol.isConcatSpreadable]() { } ->Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, --, --)) +>Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) static get [Symbol.toPrimitive]() { return ""; } ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) static set [Symbol.toPrimitive](x) { } ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) >x : Symbol(x, Decl(symbolDeclarationEmit11.ts, 4, 36)) } diff --git a/tests/baselines/reference/symbolDeclarationEmit13.js b/tests/baselines/reference/symbolDeclarationEmit13.js index 8111672866a..bbd2c15cfcd 100644 --- a/tests/baselines/reference/symbolDeclarationEmit13.js +++ b/tests/baselines/reference/symbolDeclarationEmit13.js @@ -13,6 +13,6 @@ class C { //// [symbolDeclarationEmit13.d.ts] declare class C { - [Symbol.toPrimitive]: string; + readonly [Symbol.toPrimitive]: string; [Symbol.toStringTag]: any; } diff --git a/tests/baselines/reference/symbolDeclarationEmit13.symbols b/tests/baselines/reference/symbolDeclarationEmit13.symbols index 9ac140cbcc4..b0884c44cb8 100644 --- a/tests/baselines/reference/symbolDeclarationEmit13.symbols +++ b/tests/baselines/reference/symbolDeclarationEmit13.symbols @@ -3,13 +3,13 @@ class C { >C : Symbol(C, Decl(symbolDeclarationEmit13.ts, 0, 0)) get [Symbol.toPrimitive]() { return ""; } ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) set [Symbol.toStringTag](x) { } ->Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, --, --)) +>Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) >x : Symbol(x, Decl(symbolDeclarationEmit13.ts, 2, 29)) } diff --git a/tests/baselines/reference/symbolDeclarationEmit14.js b/tests/baselines/reference/symbolDeclarationEmit14.js index b8a6b3e4092..d4ae3eeb43c 100644 --- a/tests/baselines/reference/symbolDeclarationEmit14.js +++ b/tests/baselines/reference/symbolDeclarationEmit14.js @@ -13,6 +13,6 @@ class C { //// [symbolDeclarationEmit14.d.ts] declare class C { - [Symbol.toPrimitive]: string; - [Symbol.toStringTag]: string; + readonly [Symbol.toPrimitive]: string; + readonly [Symbol.toStringTag]: string; } diff --git a/tests/baselines/reference/symbolDeclarationEmit14.symbols b/tests/baselines/reference/symbolDeclarationEmit14.symbols index 4ee1d1d2ebd..e20e3348309 100644 --- a/tests/baselines/reference/symbolDeclarationEmit14.symbols +++ b/tests/baselines/reference/symbolDeclarationEmit14.symbols @@ -3,12 +3,12 @@ class C { >C : Symbol(C, Decl(symbolDeclarationEmit14.ts, 0, 0)) get [Symbol.toPrimitive]() { return ""; } ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) get [Symbol.toStringTag]() { return ""; } ->Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, --, --)) +>Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) } diff --git a/tests/baselines/reference/symbolDeclarationEmit2.symbols b/tests/baselines/reference/symbolDeclarationEmit2.symbols index f3d7253f1af..348760f0d7d 100644 --- a/tests/baselines/reference/symbolDeclarationEmit2.symbols +++ b/tests/baselines/reference/symbolDeclarationEmit2.symbols @@ -3,7 +3,7 @@ class C { >C : Symbol(C, Decl(symbolDeclarationEmit2.ts, 0, 0)) [Symbol.toPrimitive] = ""; ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) } diff --git a/tests/baselines/reference/symbolDeclarationEmit3.symbols b/tests/baselines/reference/symbolDeclarationEmit3.symbols index 4a75ecac742..5bb8d67984e 100644 --- a/tests/baselines/reference/symbolDeclarationEmit3.symbols +++ b/tests/baselines/reference/symbolDeclarationEmit3.symbols @@ -3,20 +3,20 @@ class C { >C : Symbol(C, Decl(symbolDeclarationEmit3.ts, 0, 0)) [Symbol.toPrimitive](x: number); ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) >x : Symbol(x, Decl(symbolDeclarationEmit3.ts, 1, 25)) [Symbol.toPrimitive](x: string); ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) >x : Symbol(x, Decl(symbolDeclarationEmit3.ts, 2, 25)) [Symbol.toPrimitive](x: any) { } ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) >x : Symbol(x, Decl(symbolDeclarationEmit3.ts, 3, 25)) } diff --git a/tests/baselines/reference/symbolDeclarationEmit4.symbols b/tests/baselines/reference/symbolDeclarationEmit4.symbols index eec0912d6ee..89a4714f941 100644 --- a/tests/baselines/reference/symbolDeclarationEmit4.symbols +++ b/tests/baselines/reference/symbolDeclarationEmit4.symbols @@ -3,13 +3,13 @@ class C { >C : Symbol(C, Decl(symbolDeclarationEmit4.ts, 0, 0)) get [Symbol.toPrimitive]() { return ""; } ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) set [Symbol.toPrimitive](x) { } ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) >x : Symbol(x, Decl(symbolDeclarationEmit4.ts, 2, 29)) } diff --git a/tests/baselines/reference/symbolDeclarationEmit5.symbols b/tests/baselines/reference/symbolDeclarationEmit5.symbols index e9ee78e4a7d..bd1049b4e00 100644 --- a/tests/baselines/reference/symbolDeclarationEmit5.symbols +++ b/tests/baselines/reference/symbolDeclarationEmit5.symbols @@ -3,7 +3,7 @@ interface I { >I : Symbol(I, Decl(symbolDeclarationEmit5.ts, 0, 0)) [Symbol.isConcatSpreadable](): string; ->Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, --, --)) +>Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) } diff --git a/tests/baselines/reference/symbolDeclarationEmit6.symbols b/tests/baselines/reference/symbolDeclarationEmit6.symbols index 64da887014c..19b86ff2b66 100644 --- a/tests/baselines/reference/symbolDeclarationEmit6.symbols +++ b/tests/baselines/reference/symbolDeclarationEmit6.symbols @@ -3,7 +3,7 @@ interface I { >I : Symbol(I, Decl(symbolDeclarationEmit6.ts, 0, 0)) [Symbol.isConcatSpreadable]: string; ->Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, --, --)) +>Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) } diff --git a/tests/baselines/reference/symbolDeclarationEmit7.symbols b/tests/baselines/reference/symbolDeclarationEmit7.symbols index 3bfaee5316c..2cf42a5c5cc 100644 --- a/tests/baselines/reference/symbolDeclarationEmit7.symbols +++ b/tests/baselines/reference/symbolDeclarationEmit7.symbols @@ -3,7 +3,7 @@ var obj: { >obj : Symbol(obj, Decl(symbolDeclarationEmit7.ts, 0, 3)) [Symbol.isConcatSpreadable]: string; ->Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, --, --)) +>Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) } diff --git a/tests/baselines/reference/symbolDeclarationEmit8.symbols b/tests/baselines/reference/symbolDeclarationEmit8.symbols index 9eead633343..bb6c4728a08 100644 --- a/tests/baselines/reference/symbolDeclarationEmit8.symbols +++ b/tests/baselines/reference/symbolDeclarationEmit8.symbols @@ -3,7 +3,7 @@ var obj = { >obj : Symbol(obj, Decl(symbolDeclarationEmit8.ts, 0, 3)) [Symbol.isConcatSpreadable]: 0 ->Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, --, --)) +>Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) } diff --git a/tests/baselines/reference/symbolDeclarationEmit9.symbols b/tests/baselines/reference/symbolDeclarationEmit9.symbols index ec49c196d02..60fdbf63c95 100644 --- a/tests/baselines/reference/symbolDeclarationEmit9.symbols +++ b/tests/baselines/reference/symbolDeclarationEmit9.symbols @@ -3,7 +3,7 @@ var obj = { >obj : Symbol(obj, Decl(symbolDeclarationEmit9.ts, 0, 3)) [Symbol.isConcatSpreadable]() { } ->Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, --, --)) +>Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) } diff --git a/tests/baselines/reference/symbolProperty1.types b/tests/baselines/reference/symbolProperty1.types index f39d98853d2..667e51fda8a 100644 --- a/tests/baselines/reference/symbolProperty1.types +++ b/tests/baselines/reference/symbolProperty1.types @@ -3,8 +3,8 @@ var s: symbol; >s : symbol var x = { ->x : {} ->{ [s]: 0, [s]() { }, get [s]() { return 0; }} : {} +>x : { [x: string]: number | (() => void); } +>{ [s]: 0, [s]() { }, get [s]() { return 0; }} : { [x: string]: number | (() => void); } [s]: 0, >s : symbol diff --git a/tests/baselines/reference/symbolProperty11.symbols b/tests/baselines/reference/symbolProperty11.symbols index b064d11b9de..bd1b433ed70 100644 --- a/tests/baselines/reference/symbolProperty11.symbols +++ b/tests/baselines/reference/symbolProperty11.symbols @@ -6,9 +6,9 @@ interface I { >I : Symbol(I, Decl(symbolProperty11.ts, 0, 11)) [Symbol.iterator]?: { x }; ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) >x : Symbol(x, Decl(symbolProperty11.ts, 2, 25)) } diff --git a/tests/baselines/reference/symbolProperty13.symbols b/tests/baselines/reference/symbolProperty13.symbols index a48f02fdacf..e85e75f43d9 100644 --- a/tests/baselines/reference/symbolProperty13.symbols +++ b/tests/baselines/reference/symbolProperty13.symbols @@ -3,9 +3,9 @@ class C { >C : Symbol(C, Decl(symbolProperty13.ts, 0, 0)) [Symbol.iterator]: { x; y }; ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) >x : Symbol(x, Decl(symbolProperty13.ts, 1, 24)) >y : Symbol(y, Decl(symbolProperty13.ts, 1, 27)) } @@ -13,9 +13,9 @@ interface I { >I : Symbol(I, Decl(symbolProperty13.ts, 2, 1)) [Symbol.iterator]: { x }; ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) >x : Symbol(x, Decl(symbolProperty13.ts, 4, 24)) } diff --git a/tests/baselines/reference/symbolProperty14.symbols b/tests/baselines/reference/symbolProperty14.symbols index 459b2699e42..b13fbbc1f41 100644 --- a/tests/baselines/reference/symbolProperty14.symbols +++ b/tests/baselines/reference/symbolProperty14.symbols @@ -3,9 +3,9 @@ class C { >C : Symbol(C, Decl(symbolProperty14.ts, 0, 0)) [Symbol.iterator]: { x; y }; ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) >x : Symbol(x, Decl(symbolProperty14.ts, 1, 24)) >y : Symbol(y, Decl(symbolProperty14.ts, 1, 27)) } @@ -13,9 +13,9 @@ interface I { >I : Symbol(I, Decl(symbolProperty14.ts, 2, 1)) [Symbol.iterator]?: { x }; ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) >x : Symbol(x, Decl(symbolProperty14.ts, 4, 25)) } diff --git a/tests/baselines/reference/symbolProperty15.symbols b/tests/baselines/reference/symbolProperty15.symbols index 83a3f4630fe..c9bea5e5db2 100644 --- a/tests/baselines/reference/symbolProperty15.symbols +++ b/tests/baselines/reference/symbolProperty15.symbols @@ -6,9 +6,9 @@ interface I { >I : Symbol(I, Decl(symbolProperty15.ts, 0, 11)) [Symbol.iterator]?: { x }; ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) >x : Symbol(x, Decl(symbolProperty15.ts, 2, 25)) } diff --git a/tests/baselines/reference/symbolProperty16.symbols b/tests/baselines/reference/symbolProperty16.symbols index d54002167a1..8e13d7babdf 100644 --- a/tests/baselines/reference/symbolProperty16.symbols +++ b/tests/baselines/reference/symbolProperty16.symbols @@ -3,18 +3,18 @@ class C { >C : Symbol(C, Decl(symbolProperty16.ts, 0, 0)) private [Symbol.iterator]: { x }; ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) >x : Symbol(x, Decl(symbolProperty16.ts, 1, 32)) } interface I { >I : Symbol(I, Decl(symbolProperty16.ts, 2, 1)) [Symbol.iterator]: { x }; ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) >x : Symbol(x, Decl(symbolProperty16.ts, 4, 24)) } diff --git a/tests/baselines/reference/symbolProperty18.symbols b/tests/baselines/reference/symbolProperty18.symbols index 8f863572639..54769192d90 100644 --- a/tests/baselines/reference/symbolProperty18.symbols +++ b/tests/baselines/reference/symbolProperty18.symbols @@ -3,39 +3,39 @@ var i = { >i : Symbol(i, Decl(symbolProperty18.ts, 0, 3)) [Symbol.iterator]: 0, ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) [Symbol.toStringTag]() { return "" }, ->Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, --, --)) +>Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) set [Symbol.toPrimitive](p: boolean) { } ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) >p : Symbol(p, Decl(symbolProperty18.ts, 3, 29)) } var it = i[Symbol.iterator]; >it : Symbol(it, Decl(symbolProperty18.ts, 6, 3)) >i : Symbol(i, Decl(symbolProperty18.ts, 0, 3)) ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) var str = i[Symbol.toStringTag](); >str : Symbol(str, Decl(symbolProperty18.ts, 7, 3)) >i : Symbol(i, Decl(symbolProperty18.ts, 0, 3)) ->Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, --, --)) +>Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) i[Symbol.toPrimitive] = false; >i : Symbol(i, Decl(symbolProperty18.ts, 0, 3)) ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) diff --git a/tests/baselines/reference/symbolProperty19.symbols b/tests/baselines/reference/symbolProperty19.symbols index a2c7dd7dcfd..5e8800e07cf 100644 --- a/tests/baselines/reference/symbolProperty19.symbols +++ b/tests/baselines/reference/symbolProperty19.symbols @@ -3,15 +3,15 @@ var i = { >i : Symbol(i, Decl(symbolProperty19.ts, 0, 3)) [Symbol.iterator]: { p: null }, ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) >p : Symbol(p, Decl(symbolProperty19.ts, 1, 24)) [Symbol.toStringTag]() { return { p: undefined }; } ->Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, --, --)) +>Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) >p : Symbol(p, Decl(symbolProperty19.ts, 2, 37)) >undefined : Symbol(undefined) } @@ -19,14 +19,14 @@ var i = { var it = i[Symbol.iterator]; >it : Symbol(it, Decl(symbolProperty19.ts, 5, 3)) >i : Symbol(i, Decl(symbolProperty19.ts, 0, 3)) ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) var str = i[Symbol.toStringTag](); >str : Symbol(str, Decl(symbolProperty19.ts, 6, 3)) >i : Symbol(i, Decl(symbolProperty19.ts, 0, 3)) ->Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, --, --)) +>Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) diff --git a/tests/baselines/reference/symbolProperty2.symbols b/tests/baselines/reference/symbolProperty2.symbols index a9bc4a440e0..90cb47c0011 100644 --- a/tests/baselines/reference/symbolProperty2.symbols +++ b/tests/baselines/reference/symbolProperty2.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/Symbols/symbolProperty2.ts === var s = Symbol(); >s : Symbol(s, Decl(symbolProperty2.ts, 0, 3)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) var x = { >x : Symbol(x, Decl(symbolProperty2.ts, 1, 3)) diff --git a/tests/baselines/reference/symbolProperty2.types b/tests/baselines/reference/symbolProperty2.types index df49130520a..7584c6461e8 100644 --- a/tests/baselines/reference/symbolProperty2.types +++ b/tests/baselines/reference/symbolProperty2.types @@ -5,8 +5,8 @@ var s = Symbol(); >Symbol : SymbolConstructor var x = { ->x : {} ->{ [s]: 0, [s]() { }, get [s]() { return 0; }} : {} +>x : { [x: string]: number | (() => void); } +>{ [s]: 0, [s]() { }, get [s]() { return 0; }} : { [x: string]: number | (() => void); } [s]: 0, >s : symbol diff --git a/tests/baselines/reference/symbolProperty20.symbols b/tests/baselines/reference/symbolProperty20.symbols index 97bb4164c2f..60fc435898e 100644 --- a/tests/baselines/reference/symbolProperty20.symbols +++ b/tests/baselines/reference/symbolProperty20.symbols @@ -3,15 +3,15 @@ interface I { >I : Symbol(I, Decl(symbolProperty20.ts, 0, 0)) [Symbol.iterator]: (s: string) => string; ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) >s : Symbol(s, Decl(symbolProperty20.ts, 1, 24)) [Symbol.toStringTag](s: number): number; ->Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, --, --)) +>Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) >s : Symbol(s, Decl(symbolProperty20.ts, 2, 25)) } @@ -20,16 +20,16 @@ var i: I = { >I : Symbol(I, Decl(symbolProperty20.ts, 0, 0)) [Symbol.iterator]: s => s, ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) >s : Symbol(s, Decl(symbolProperty20.ts, 6, 22)) >s : Symbol(s, Decl(symbolProperty20.ts, 6, 22)) [Symbol.toStringTag](n) { return n; } ->Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, --, --)) +>Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) >n : Symbol(n, Decl(symbolProperty20.ts, 7, 25)) >n : Symbol(n, Decl(symbolProperty20.ts, 7, 25)) } diff --git a/tests/baselines/reference/symbolProperty22.symbols b/tests/baselines/reference/symbolProperty22.symbols index 1d7f46fa897..e4e68d81970 100644 --- a/tests/baselines/reference/symbolProperty22.symbols +++ b/tests/baselines/reference/symbolProperty22.symbols @@ -5,9 +5,9 @@ interface I { >U : Symbol(U, Decl(symbolProperty22.ts, 0, 14)) [Symbol.unscopables](x: T): U; ->Symbol.unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, --, --)) +>Symbol.unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) >x : Symbol(x, Decl(symbolProperty22.ts, 1, 25)) >T : Symbol(T, Decl(symbolProperty22.ts, 0, 12)) >U : Symbol(U, Decl(symbolProperty22.ts, 0, 14)) @@ -27,11 +27,11 @@ declare function foo(p1: T, p2: I): U; foo("", { [Symbol.unscopables]: s => s.length }); >foo : Symbol(foo, Decl(symbolProperty22.ts, 2, 1)) ->Symbol.unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, --, --)) +>Symbol.unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) >s : Symbol(s, Decl(symbolProperty22.ts, 6, 31)) ->s.length : Symbol(String.length, Decl(lib.d.ts, --, --)) +>s.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) >s : Symbol(s, Decl(symbolProperty22.ts, 6, 31)) ->length : Symbol(String.length, Decl(lib.d.ts, --, --)) +>length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) diff --git a/tests/baselines/reference/symbolProperty23.symbols b/tests/baselines/reference/symbolProperty23.symbols index 06fce65875c..714b76fa85b 100644 --- a/tests/baselines/reference/symbolProperty23.symbols +++ b/tests/baselines/reference/symbolProperty23.symbols @@ -3,9 +3,9 @@ interface I { >I : Symbol(I, Decl(symbolProperty23.ts, 0, 0)) [Symbol.toPrimitive]: () => boolean; ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) } class C implements I { @@ -13,9 +13,9 @@ class C implements I { >I : Symbol(I, Decl(symbolProperty23.ts, 0, 0)) [Symbol.toPrimitive]() { ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) return true; } diff --git a/tests/baselines/reference/symbolProperty26.symbols b/tests/baselines/reference/symbolProperty26.symbols index ae8f95d5859..785a2e395cb 100644 --- a/tests/baselines/reference/symbolProperty26.symbols +++ b/tests/baselines/reference/symbolProperty26.symbols @@ -3,9 +3,9 @@ class C1 { >C1 : Symbol(C1, Decl(symbolProperty26.ts, 0, 0)) [Symbol.toStringTag]() { ->Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, --, --)) +>Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) return ""; } @@ -16,9 +16,9 @@ class C2 extends C1 { >C1 : Symbol(C1, Decl(symbolProperty26.ts, 0, 0)) [Symbol.toStringTag]() { ->Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, --, --)) +>Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) return ""; } diff --git a/tests/baselines/reference/symbolProperty27.symbols b/tests/baselines/reference/symbolProperty27.symbols index d5fcf7ec224..1b050b617c2 100644 --- a/tests/baselines/reference/symbolProperty27.symbols +++ b/tests/baselines/reference/symbolProperty27.symbols @@ -3,9 +3,9 @@ class C1 { >C1 : Symbol(C1, Decl(symbolProperty27.ts, 0, 0)) [Symbol.toStringTag]() { ->Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, --, --)) +>Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) return {}; } @@ -16,9 +16,9 @@ class C2 extends C1 { >C1 : Symbol(C1, Decl(symbolProperty27.ts, 0, 0)) [Symbol.toStringTag]() { ->Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, --, --)) +>Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) return ""; } diff --git a/tests/baselines/reference/symbolProperty28.symbols b/tests/baselines/reference/symbolProperty28.symbols index d8c9daba0d9..c72de5fefb5 100644 --- a/tests/baselines/reference/symbolProperty28.symbols +++ b/tests/baselines/reference/symbolProperty28.symbols @@ -3,9 +3,9 @@ class C1 { >C1 : Symbol(C1, Decl(symbolProperty28.ts, 0, 0)) [Symbol.toStringTag]() { ->Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, --, --)) +>Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) return { x: "" }; >x : Symbol(x, Decl(symbolProperty28.ts, 2, 16)) @@ -24,8 +24,8 @@ var obj = c[Symbol.toStringTag]().x; >obj : Symbol(obj, Decl(symbolProperty28.ts, 9, 3)) >c[Symbol.toStringTag]().x : Symbol(x, Decl(symbolProperty28.ts, 2, 16)) >c : Symbol(c, Decl(symbolProperty28.ts, 8, 3)) ->Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, --, --)) +>Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) >x : Symbol(x, Decl(symbolProperty28.ts, 2, 16)) diff --git a/tests/baselines/reference/symbolProperty4.symbols b/tests/baselines/reference/symbolProperty4.symbols index 7817a7c6fd0..c1f7c82de7d 100644 --- a/tests/baselines/reference/symbolProperty4.symbols +++ b/tests/baselines/reference/symbolProperty4.symbols @@ -3,13 +3,13 @@ var x = { >x : Symbol(x, Decl(symbolProperty4.ts, 0, 3)) [Symbol()]: 0, ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) [Symbol()]() { }, ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) get [Symbol()]() { ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) return 0; } diff --git a/tests/baselines/reference/symbolProperty4.types b/tests/baselines/reference/symbolProperty4.types index 93b4417b8ae..7bcf3f23397 100644 --- a/tests/baselines/reference/symbolProperty4.types +++ b/tests/baselines/reference/symbolProperty4.types @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/Symbols/symbolProperty4.ts === var x = { ->x : {} ->{ [Symbol()]: 0, [Symbol()]() { }, get [Symbol()]() { return 0; }} : {} +>x : { [x: string]: number | (() => void); } +>{ [Symbol()]: 0, [Symbol()]() { }, get [Symbol()]() { return 0; }} : { [x: string]: number | (() => void); } [Symbol()]: 0, >Symbol() : symbol diff --git a/tests/baselines/reference/symbolProperty40.symbols b/tests/baselines/reference/symbolProperty40.symbols index 26a5dc36ed5..9d546e7d426 100644 --- a/tests/baselines/reference/symbolProperty40.symbols +++ b/tests/baselines/reference/symbolProperty40.symbols @@ -3,21 +3,21 @@ class C { >C : Symbol(C, Decl(symbolProperty40.ts, 0, 0)) [Symbol.iterator](x: string): string; ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) >x : Symbol(x, Decl(symbolProperty40.ts, 1, 22)) [Symbol.iterator](x: number): number; ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) >x : Symbol(x, Decl(symbolProperty40.ts, 2, 22)) [Symbol.iterator](x: any) { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) >x : Symbol(x, Decl(symbolProperty40.ts, 3, 22)) return undefined; @@ -31,13 +31,13 @@ var c = new C; c[Symbol.iterator](""); >c : Symbol(c, Decl(symbolProperty40.ts, 8, 3)) ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) c[Symbol.iterator](0); >c : Symbol(c, Decl(symbolProperty40.ts, 8, 3)) ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) diff --git a/tests/baselines/reference/symbolProperty41.symbols b/tests/baselines/reference/symbolProperty41.symbols index 7db66e5862e..f0ef0692253 100644 --- a/tests/baselines/reference/symbolProperty41.symbols +++ b/tests/baselines/reference/symbolProperty41.symbols @@ -3,24 +3,24 @@ class C { >C : Symbol(C, Decl(symbolProperty41.ts, 0, 0)) [Symbol.iterator](x: string): { x: string }; ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) >x : Symbol(x, Decl(symbolProperty41.ts, 1, 22)) >x : Symbol(x, Decl(symbolProperty41.ts, 1, 35)) [Symbol.iterator](x: "hello"): { x: string; hello: string }; ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) >x : Symbol(x, Decl(symbolProperty41.ts, 2, 22)) >x : Symbol(x, Decl(symbolProperty41.ts, 2, 36)) >hello : Symbol(hello, Decl(symbolProperty41.ts, 2, 47)) [Symbol.iterator](x: any) { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) >x : Symbol(x, Decl(symbolProperty41.ts, 3, 22)) return undefined; @@ -34,13 +34,13 @@ var c = new C; c[Symbol.iterator](""); >c : Symbol(c, Decl(symbolProperty41.ts, 8, 3)) ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) c[Symbol.iterator]("hello"); >c : Symbol(c, Decl(symbolProperty41.ts, 8, 3)) ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) diff --git a/tests/baselines/reference/symbolProperty45.symbols b/tests/baselines/reference/symbolProperty45.symbols index 46ecb0a6414..0f42e37c5cf 100644 --- a/tests/baselines/reference/symbolProperty45.symbols +++ b/tests/baselines/reference/symbolProperty45.symbols @@ -3,16 +3,16 @@ class C { >C : Symbol(C, Decl(symbolProperty45.ts, 0, 0)) get [Symbol.hasInstance]() { ->Symbol.hasInstance : Symbol(SymbolConstructor.hasInstance, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->hasInstance : Symbol(SymbolConstructor.hasInstance, Decl(lib.d.ts, --, --)) +>Symbol.hasInstance : Symbol(SymbolConstructor.hasInstance, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>hasInstance : Symbol(SymbolConstructor.hasInstance, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) return ""; } get [Symbol.toPrimitive]() { ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) return ""; } diff --git a/tests/baselines/reference/symbolProperty5.symbols b/tests/baselines/reference/symbolProperty5.symbols index 00e47c461ee..1ca9150c347 100644 --- a/tests/baselines/reference/symbolProperty5.symbols +++ b/tests/baselines/reference/symbolProperty5.symbols @@ -3,19 +3,19 @@ var x = { >x : Symbol(x, Decl(symbolProperty5.ts, 0, 3)) [Symbol.iterator]: 0, ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) [Symbol.toPrimitive]() { }, ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) get [Symbol.toStringTag]() { ->Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, --, --)) +>Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) return 0; } diff --git a/tests/baselines/reference/symbolProperty5.types b/tests/baselines/reference/symbolProperty5.types index 4af020dca1b..b338f94f6d3 100644 --- a/tests/baselines/reference/symbolProperty5.types +++ b/tests/baselines/reference/symbolProperty5.types @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/Symbols/symbolProperty5.ts === var x = { ->x : { [Symbol.iterator]: number; [Symbol.toPrimitive](): void; [Symbol.toStringTag]: number; } ->{ [Symbol.iterator]: 0, [Symbol.toPrimitive]() { }, get [Symbol.toStringTag]() { return 0; }} : { [Symbol.iterator]: number; [Symbol.toPrimitive](): void; [Symbol.toStringTag]: number; } +>x : { [Symbol.iterator]: number; [Symbol.toPrimitive](): void; readonly [Symbol.toStringTag]: number; } +>{ [Symbol.iterator]: 0, [Symbol.toPrimitive]() { }, get [Symbol.toStringTag]() { return 0; }} : { [Symbol.iterator]: number; [Symbol.toPrimitive](): void; readonly [Symbol.toStringTag]: number; } [Symbol.iterator]: 0, >Symbol.iterator : symbol diff --git a/tests/baselines/reference/symbolProperty50.symbols b/tests/baselines/reference/symbolProperty50.symbols index f5197627846..6df756a0277 100644 --- a/tests/baselines/reference/symbolProperty50.symbols +++ b/tests/baselines/reference/symbolProperty50.symbols @@ -9,8 +9,8 @@ module M { >C : Symbol(C, Decl(symbolProperty50.ts, 1, 24)) [Symbol.iterator]() { } ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) } } diff --git a/tests/baselines/reference/symbolProperty51.symbols b/tests/baselines/reference/symbolProperty51.symbols index 4be31dd0a56..71384602b23 100644 --- a/tests/baselines/reference/symbolProperty51.symbols +++ b/tests/baselines/reference/symbolProperty51.symbols @@ -9,8 +9,8 @@ module M { >C : Symbol(C, Decl(symbolProperty51.ts, 1, 21)) [Symbol.iterator]() { } ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) } } diff --git a/tests/baselines/reference/symbolProperty55.symbols b/tests/baselines/reference/symbolProperty55.symbols index e6a9c304abe..e87120986ee 100644 --- a/tests/baselines/reference/symbolProperty55.symbols +++ b/tests/baselines/reference/symbolProperty55.symbols @@ -3,9 +3,9 @@ var obj = { >obj : Symbol(obj, Decl(symbolProperty55.ts, 0, 3)) [Symbol.iterator]: 0 ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) }; @@ -14,13 +14,13 @@ module M { var Symbol: SymbolConstructor; >Symbol : Symbol(Symbol, Decl(symbolProperty55.ts, 5, 7)) ->SymbolConstructor : Symbol(SymbolConstructor, Decl(lib.d.ts, --, --)) +>SymbolConstructor : Symbol(SymbolConstructor, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) // The following should be of type 'any'. This is because even though obj has a property keyed by Symbol.iterator, // the key passed in here is the *wrong* Symbol.iterator. It is not the iterator property of the global Symbol. obj[Symbol.iterator]; >obj : Symbol(obj, Decl(symbolProperty55.ts, 0, 3)) ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) >Symbol : Symbol(Symbol, Decl(symbolProperty55.ts, 5, 7)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) } diff --git a/tests/baselines/reference/symbolProperty56.symbols b/tests/baselines/reference/symbolProperty56.symbols index 6ff465daa98..492f28bd42c 100644 --- a/tests/baselines/reference/symbolProperty56.symbols +++ b/tests/baselines/reference/symbolProperty56.symbols @@ -3,9 +3,9 @@ var obj = { >obj : Symbol(obj, Decl(symbolProperty56.ts, 0, 3)) [Symbol.iterator]: 0 ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) }; diff --git a/tests/baselines/reference/symbolProperty57.symbols b/tests/baselines/reference/symbolProperty57.symbols index b256ba651c4..05fa27816c9 100644 --- a/tests/baselines/reference/symbolProperty57.symbols +++ b/tests/baselines/reference/symbolProperty57.symbols @@ -3,14 +3,14 @@ var obj = { >obj : Symbol(obj, Decl(symbolProperty57.ts, 0, 3)) [Symbol.iterator]: 0 ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) }; // Should give type 'any'. obj[Symbol["nonsense"]]; >obj : Symbol(obj, Decl(symbolProperty57.ts, 0, 3)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) diff --git a/tests/baselines/reference/symbolProperty6.symbols b/tests/baselines/reference/symbolProperty6.symbols index d0eedccf4fa..4bf20b1de55 100644 --- a/tests/baselines/reference/symbolProperty6.symbols +++ b/tests/baselines/reference/symbolProperty6.symbols @@ -3,24 +3,24 @@ class C { >C : Symbol(C, Decl(symbolProperty6.ts, 0, 0)) [Symbol.iterator] = 0; ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) [Symbol.unscopables]: number; ->Symbol.unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, --, --)) +>Symbol.unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) [Symbol.toPrimitive]() { } ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) get [Symbol.toStringTag]() { ->Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, --, --)) +>Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) return 0; } diff --git a/tests/baselines/reference/symbolProperty8.symbols b/tests/baselines/reference/symbolProperty8.symbols index 8d26d193ef5..e46c35b47be 100644 --- a/tests/baselines/reference/symbolProperty8.symbols +++ b/tests/baselines/reference/symbolProperty8.symbols @@ -3,12 +3,12 @@ interface I { >I : Symbol(I, Decl(symbolProperty8.ts, 0, 0)) [Symbol.unscopables]: number; ->Symbol.unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, --, --)) +>Symbol.unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) [Symbol.toPrimitive](); ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) } diff --git a/tests/baselines/reference/symbolType11.symbols b/tests/baselines/reference/symbolType11.symbols index d5c19af7844..3c5fc1b61cc 100644 --- a/tests/baselines/reference/symbolType11.symbols +++ b/tests/baselines/reference/symbolType11.symbols @@ -1,9 +1,9 @@ === tests/cases/conformance/es6/Symbols/symbolType11.ts === var s = Symbol.for("logical"); >s : Symbol(s, Decl(symbolType11.ts, 0, 3)) ->Symbol.for : Symbol(SymbolConstructor.for, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->for : Symbol(SymbolConstructor.for, Decl(lib.d.ts, --, --)) +>Symbol.for : Symbol(SymbolConstructor.for, Decl(lib.es2015.symbol.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>for : Symbol(SymbolConstructor.for, Decl(lib.es2015.symbol.d.ts, --, --)) s && s; >s : Symbol(s, Decl(symbolType11.ts, 0, 3)) diff --git a/tests/baselines/reference/symbolType16.symbols b/tests/baselines/reference/symbolType16.symbols index a31a4e5c677..3e5fb6e2157 100644 --- a/tests/baselines/reference/symbolType16.symbols +++ b/tests/baselines/reference/symbolType16.symbols @@ -1,9 +1,9 @@ === tests/cases/conformance/es6/Symbols/symbolType16.ts === interface Symbol { ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(symbolType16.ts, 0, 0)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(symbolType16.ts, 0, 0)) newSymbolProp: number; ->newSymbolProp : Symbol(newSymbolProp, Decl(symbolType16.ts, 0, 18)) +>newSymbolProp : Symbol(Symbol.newSymbolProp, Decl(symbolType16.ts, 0, 18)) } var sym: symbol; diff --git a/tests/baselines/reference/symbolType17.symbols b/tests/baselines/reference/symbolType17.symbols index fe77cb8d6b3..0f1ccc0e83a 100644 --- a/tests/baselines/reference/symbolType17.symbols +++ b/tests/baselines/reference/symbolType17.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/Symbols/symbolType17.ts === interface Foo { prop } >Foo : Symbol(Foo, Decl(symbolType17.ts, 0, 0)) ->prop : Symbol(prop, Decl(symbolType17.ts, 0, 15)) +>prop : Symbol(Foo.prop, Decl(symbolType17.ts, 0, 15)) var x: symbol | Foo; >x : Symbol(x, Decl(symbolType17.ts, 1, 3)) diff --git a/tests/baselines/reference/symbolType18.symbols b/tests/baselines/reference/symbolType18.symbols index d2121672b71..9dc8c824a85 100644 --- a/tests/baselines/reference/symbolType18.symbols +++ b/tests/baselines/reference/symbolType18.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/Symbols/symbolType18.ts === interface Foo { prop } >Foo : Symbol(Foo, Decl(symbolType18.ts, 0, 0)) ->prop : Symbol(prop, Decl(symbolType18.ts, 0, 15)) +>prop : Symbol(Foo.prop, Decl(symbolType18.ts, 0, 15)) var x: symbol | Foo; >x : Symbol(x, Decl(symbolType18.ts, 1, 3)) diff --git a/tests/baselines/reference/systemExportAssignment.js b/tests/baselines/reference/systemExportAssignment.js index f8b50cb580f..1e87af1ca22 100644 --- a/tests/baselines/reference/systemExportAssignment.js +++ b/tests/baselines/reference/systemExportAssignment.js @@ -10,8 +10,9 @@ import * as a from "a"; //// [b.js] -System.register([], function(exports_1, __moduleName) { +System.register([], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; return { setters:[], execute: function() { diff --git a/tests/baselines/reference/systemExportAssignment2.js b/tests/baselines/reference/systemExportAssignment2.js index 6a5c0e8f397..177f36f23d2 100644 --- a/tests/baselines/reference/systemExportAssignment2.js +++ b/tests/baselines/reference/systemExportAssignment2.js @@ -10,8 +10,9 @@ import * as a from "a"; //// [a.js] -System.register([], function(exports_1, __moduleName) { +System.register([], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; var a; return { setters:[], @@ -21,8 +22,9 @@ System.register([], function(exports_1, __moduleName) { } }); //// [b.js] -System.register([], function(exports_1, __moduleName) { +System.register([], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; return { setters:[], execute: function() { diff --git a/tests/baselines/reference/systemExportAssignment3.js b/tests/baselines/reference/systemExportAssignment3.js index 9c6d3cdbb2f..78e330c6467 100644 --- a/tests/baselines/reference/systemExportAssignment3.js +++ b/tests/baselines/reference/systemExportAssignment3.js @@ -12,8 +12,9 @@ import * as a from "a"; //// [b.js] -System.register([], function(exports_1, __moduleName) { +System.register([], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; return { setters:[], execute: function() { diff --git a/tests/baselines/reference/systemModule1.js b/tests/baselines/reference/systemModule1.js index 749d8170dcb..2b7e3e2c4dc 100644 --- a/tests/baselines/reference/systemModule1.js +++ b/tests/baselines/reference/systemModule1.js @@ -3,8 +3,9 @@ export var x = 1; //// [systemModule1.js] -System.register([], function(exports_1, __moduleName) { +System.register([], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; var x; return { setters:[], diff --git a/tests/baselines/reference/systemModule10.js b/tests/baselines/reference/systemModule10.js index f23e7ca1d76..0c171ab6cc1 100644 --- a/tests/baselines/reference/systemModule10.js +++ b/tests/baselines/reference/systemModule10.js @@ -10,8 +10,9 @@ export {n2} export {n2 as n3} //// [systemModule10.js] -System.register(['file1', 'file2'], function(exports_1, __moduleName) { +System.register(['file1', 'file2'], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; var file1_1, n2; return { setters:[ diff --git a/tests/baselines/reference/systemModule10_ES5.js b/tests/baselines/reference/systemModule10_ES5.js index 3d63e092df4..711ca3ed7a3 100644 --- a/tests/baselines/reference/systemModule10_ES5.js +++ b/tests/baselines/reference/systemModule10_ES5.js @@ -10,8 +10,9 @@ export {n2} export {n2 as n3} //// [systemModule10_ES5.js] -System.register(['file1', 'file2'], function(exports_1, __moduleName) { +System.register(['file1', 'file2'], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; var file1_1, n2; return { setters:[ diff --git a/tests/baselines/reference/systemModule11.js b/tests/baselines/reference/systemModule11.js index 1e755a86541..f7d47db1d7f 100644 --- a/tests/baselines/reference/systemModule11.js +++ b/tests/baselines/reference/systemModule11.js @@ -42,8 +42,9 @@ export * from 'a'; //// [file1.js] // set of tests cases that checks generation of local storage for exported names -System.register(['bar'], function(exports_1, __moduleName) { +System.register(['bar'], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; var x; function foo() { } exports_1("foo", foo); @@ -68,8 +69,9 @@ System.register(['bar'], function(exports_1, __moduleName) { } }); //// [file2.js] -System.register(['bar'], function(exports_1, __moduleName) { +System.register(['bar'], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; var x, y; var exportedNames_1 = { 'x': true, @@ -94,8 +96,9 @@ System.register(['bar'], function(exports_1, __moduleName) { } }); //// [file3.js] -System.register(['a', 'bar'], function(exports_1, __moduleName) { +System.register(['a', 'bar'], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; function foo() { } exports_1("default", foo); var exportedNames_1 = { @@ -125,8 +128,9 @@ System.register(['a', 'bar'], function(exports_1, __moduleName) { } }); //// [file4.js] -System.register(['a'], function(exports_1, __moduleName) { +System.register(['a'], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; var x, z, z1; function foo() { } exports_1("foo", foo); @@ -147,8 +151,9 @@ System.register(['a'], function(exports_1, __moduleName) { } }); //// [file5.js] -System.register(['a'], function(exports_1, __moduleName) { +System.register(['a'], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; function foo() { } function exportStar_1(m) { var exports = {}; diff --git a/tests/baselines/reference/systemModule12.js b/tests/baselines/reference/systemModule12.js index 04252396926..45e7beaf218 100644 --- a/tests/baselines/reference/systemModule12.js +++ b/tests/baselines/reference/systemModule12.js @@ -5,8 +5,9 @@ import n from 'file1' //// [systemModule12.js] -System.register("NamedModule", [], function(exports_1, __moduleName) { +System.register("NamedModule", [], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; return { setters:[], execute: function() { diff --git a/tests/baselines/reference/systemModule13.js b/tests/baselines/reference/systemModule13.js index 509534ee0fe..e3ed2daf3a6 100644 --- a/tests/baselines/reference/systemModule13.js +++ b/tests/baselines/reference/systemModule13.js @@ -5,8 +5,9 @@ export const {a: z0, b: {c: z1}} = {a: true, b: {c: "123"}}; for ([x] of [[1]]) {} //// [systemModule13.js] -System.register([], function(exports_1, __moduleName) { +System.register([], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; var x, y, z, z0, z1; return { setters:[], diff --git a/tests/baselines/reference/systemModule13.types b/tests/baselines/reference/systemModule13.types index 35f22be98b8..f31b0825416 100644 --- a/tests/baselines/reference/systemModule13.types +++ b/tests/baselines/reference/systemModule13.types @@ -24,7 +24,7 @@ export const {a: z0, b: {c: z1}} = {a: true, b: {c: "123"}}; >"123" : string for ([x] of [[1]]) {} ->[x] : number[] +>[x] : [number] >x : number >[[1]] : number[][] >[1] : number[] diff --git a/tests/baselines/reference/systemModule14.js b/tests/baselines/reference/systemModule14.js index af78af7f6b1..5eaafd9ba6b 100644 --- a/tests/baselines/reference/systemModule14.js +++ b/tests/baselines/reference/systemModule14.js @@ -11,8 +11,9 @@ var x = 1; export {foo as b} //// [systemModule14.js] -System.register(["foo"], function(exports_1, __moduleName) { +System.register(["foo"], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; var foo_1; var x; function foo() { diff --git a/tests/baselines/reference/systemModule15.js b/tests/baselines/reference/systemModule15.js index f347ad59671..f2fefb344ac 100644 --- a/tests/baselines/reference/systemModule15.js +++ b/tests/baselines/reference/systemModule15.js @@ -34,8 +34,9 @@ export default value; export var value2 = "v"; //// [file3.js] -System.register([], function(exports_1, __moduleName) { +System.register([], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; var value; return { setters:[], @@ -46,8 +47,9 @@ System.register([], function(exports_1, __moduleName) { } }); //// [file4.js] -System.register([], function(exports_1, __moduleName) { +System.register([], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; var value2; return { setters:[], @@ -57,8 +59,9 @@ System.register([], function(exports_1, __moduleName) { } }); //// [file2.js] -System.register(["./file3"], function(exports_1, __moduleName) { +System.register(["./file3"], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; var moduleCStar, file3_1, file3_2; return { setters:[ @@ -75,8 +78,9 @@ System.register(["./file3"], function(exports_1, __moduleName) { } }); //// [file1.js] -System.register(["./file2"], function(exports_1, __moduleName) { +System.register(["./file2"], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; var moduleB; return { setters:[ diff --git a/tests/baselines/reference/systemModule16.js b/tests/baselines/reference/systemModule16.js index 0986218b65d..27fa77b9c76 100644 --- a/tests/baselines/reference/systemModule16.js +++ b/tests/baselines/reference/systemModule16.js @@ -13,8 +13,9 @@ x,y,a1,b1,d1; //// [systemModule16.js] -System.register(["foo", "bar"], function(exports_1, __moduleName) { +System.register(["foo", "bar"], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; var x, y, foo_1; var exportedNames_1 = { 'x': true, diff --git a/tests/baselines/reference/systemModule17.js b/tests/baselines/reference/systemModule17.js index b441004408b..6bf1ce25b84 100644 --- a/tests/baselines/reference/systemModule17.js +++ b/tests/baselines/reference/systemModule17.js @@ -42,8 +42,9 @@ export {II}; export {II as II1}; //// [f1.js] -System.register([], function(exports_1, __moduleName) { +System.register([], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; var A; return { setters:[], @@ -58,8 +59,9 @@ System.register([], function(exports_1, __moduleName) { } }); //// [f2.js] -System.register(["f1"], function(exports_1, __moduleName) { +System.register(["f1"], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; var f1_1; var x, N, IX; return { diff --git a/tests/baselines/reference/systemModule2.js b/tests/baselines/reference/systemModule2.js index 78be2c008e4..95755421eaa 100644 --- a/tests/baselines/reference/systemModule2.js +++ b/tests/baselines/reference/systemModule2.js @@ -4,8 +4,9 @@ var x = 1; export = x; //// [systemModule2.js] -System.register([], function(exports_1, __moduleName) { +System.register([], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; var x; return { setters:[], diff --git a/tests/baselines/reference/systemModule3.js b/tests/baselines/reference/systemModule3.js index 9ccc5ea7894..7800c8c220e 100644 --- a/tests/baselines/reference/systemModule3.js +++ b/tests/baselines/reference/systemModule3.js @@ -18,8 +18,9 @@ export default class C {} export default class {} //// [file1.js] -System.register([], function(exports_1, __moduleName) { +System.register([], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; function default_1() { } exports_1("default", default_1); return { @@ -29,8 +30,9 @@ System.register([], function(exports_1, __moduleName) { } }); //// [file2.js] -System.register([], function(exports_1, __moduleName) { +System.register([], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; function f() { } exports_1("default", f); return { @@ -40,8 +42,9 @@ System.register([], function(exports_1, __moduleName) { } }); //// [file3.js] -System.register([], function(exports_1, __moduleName) { +System.register([], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; var C; return { setters:[], @@ -56,8 +59,9 @@ System.register([], function(exports_1, __moduleName) { } }); //// [file4.js] -System.register([], function(exports_1, __moduleName) { +System.register([], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; var default_1; return { setters:[], diff --git a/tests/baselines/reference/systemModule4.js b/tests/baselines/reference/systemModule4.js index 526ee5d2c3a..67990c63a58 100644 --- a/tests/baselines/reference/systemModule4.js +++ b/tests/baselines/reference/systemModule4.js @@ -4,8 +4,9 @@ export var x = 1; export var y; //// [systemModule4.js] -System.register([], function(exports_1, __moduleName) { +System.register([], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; var x, y; return { setters:[], diff --git a/tests/baselines/reference/systemModule5.js b/tests/baselines/reference/systemModule5.js index 6d6a8e52823..d0b1f79b2f7 100644 --- a/tests/baselines/reference/systemModule5.js +++ b/tests/baselines/reference/systemModule5.js @@ -4,8 +4,9 @@ export function foo() {} //// [systemModule5.js] -System.register([], function(exports_1, __moduleName) { +System.register([], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; function foo() { } exports_1("foo", foo); return { diff --git a/tests/baselines/reference/systemModule6.js b/tests/baselines/reference/systemModule6.js index d93b1b861e0..4848c82f738 100644 --- a/tests/baselines/reference/systemModule6.js +++ b/tests/baselines/reference/systemModule6.js @@ -7,8 +7,9 @@ function foo() { //// [systemModule6.js] -System.register([], function(exports_1, __moduleName) { +System.register([], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; var C; function foo() { new C(); diff --git a/tests/baselines/reference/systemModule7.js b/tests/baselines/reference/systemModule7.js index 6abf76cf075..60114b54400 100644 --- a/tests/baselines/reference/systemModule7.js +++ b/tests/baselines/reference/systemModule7.js @@ -11,8 +11,9 @@ export module M { } //// [systemModule7.js] -System.register([], function(exports_1, __moduleName) { +System.register([], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; var M; return { setters:[], diff --git a/tests/baselines/reference/systemModule8.js b/tests/baselines/reference/systemModule8.js index 6d48a4a9d45..f099628facb 100644 --- a/tests/baselines/reference/systemModule8.js +++ b/tests/baselines/reference/systemModule8.js @@ -31,8 +31,9 @@ export const {a: z0, b: {c: z1}} = {a: true, b: {c: "123"}}; for ([x] of [[1]]) {} //// [systemModule8.js] -System.register([], function(exports_1, __moduleName) { +System.register([], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; var x, y, z0, z1; function foo() { exports_1("x", x = 100); diff --git a/tests/baselines/reference/systemModule8.types b/tests/baselines/reference/systemModule8.types index 2c3dd1e48bb..940067c5653 100644 --- a/tests/baselines/reference/systemModule8.types +++ b/tests/baselines/reference/systemModule8.types @@ -135,7 +135,7 @@ export const {a: z0, b: {c: z1}} = {a: true, b: {c: "123"}}; >"123" : string for ([x] of [[1]]) {} ->[x] : any[] +>[x] : [any] >x : any >[[1]] : number[][] >[1] : number[] diff --git a/tests/baselines/reference/systemModule9.js b/tests/baselines/reference/systemModule9.js index 4804a08fd39..940b9e5975b 100644 --- a/tests/baselines/reference/systemModule9.js +++ b/tests/baselines/reference/systemModule9.js @@ -22,8 +22,9 @@ export {x}; export {y as z}; //// [systemModule9.js] -System.register(['file1', 'file2', 'file3', 'file4', 'file5', 'file6', 'file7'], function(exports_1, __moduleName) { +System.register(['file1', 'file2', 'file3', 'file4', 'file5', 'file6', 'file7'], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; var ns, file2_1, file3_1, file5_1, ns3; var x, y; var exportedNames_1 = { diff --git a/tests/baselines/reference/systemModuleAmbientDeclarations.js b/tests/baselines/reference/systemModuleAmbientDeclarations.js index 35e48fe2aff..91bad620b77 100644 --- a/tests/baselines/reference/systemModuleAmbientDeclarations.js +++ b/tests/baselines/reference/systemModuleAmbientDeclarations.js @@ -29,8 +29,9 @@ export declare module M { var v: number; } //// [file1.js] -System.register([], function(exports_1, __moduleName) { +System.register([], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; var promise, foo, c, e; return { setters:[], @@ -44,8 +45,9 @@ System.register([], function(exports_1, __moduleName) { } }); //// [file2.js] -System.register([], function(exports_1, __moduleName) { +System.register([], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; return { setters:[], execute: function() { @@ -53,8 +55,9 @@ System.register([], function(exports_1, __moduleName) { } }); //// [file3.js] -System.register([], function(exports_1, __moduleName) { +System.register([], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; return { setters:[], execute: function() { @@ -62,8 +65,9 @@ System.register([], function(exports_1, __moduleName) { } }); //// [file4.js] -System.register([], function(exports_1, __moduleName) { +System.register([], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; return { setters:[], execute: function() { @@ -71,8 +75,9 @@ System.register([], function(exports_1, __moduleName) { } }); //// [file5.js] -System.register([], function(exports_1, __moduleName) { +System.register([], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; return { setters:[], execute: function() { @@ -80,8 +85,9 @@ System.register([], function(exports_1, __moduleName) { } }); //// [file6.js] -System.register([], function(exports_1, __moduleName) { +System.register([], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; return { setters:[], execute: function() { diff --git a/tests/baselines/reference/systemModuleConstEnums.js b/tests/baselines/reference/systemModuleConstEnums.js index abcd9ca5802..08df549a87b 100644 --- a/tests/baselines/reference/systemModuleConstEnums.js +++ b/tests/baselines/reference/systemModuleConstEnums.js @@ -13,8 +13,9 @@ module M { } //// [systemModuleConstEnums.js] -System.register([], function(exports_1, __moduleName) { +System.register([], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; function foo() { use(0 /* X */); use(0 /* X */); diff --git a/tests/baselines/reference/systemModuleConstEnumsSeparateCompilation.js b/tests/baselines/reference/systemModuleConstEnumsSeparateCompilation.js index 5eaa354bc2a..be2f07cc59e 100644 --- a/tests/baselines/reference/systemModuleConstEnumsSeparateCompilation.js +++ b/tests/baselines/reference/systemModuleConstEnumsSeparateCompilation.js @@ -13,8 +13,9 @@ module M { } //// [systemModuleConstEnumsSeparateCompilation.js] -System.register([], function(exports_1, __moduleName) { +System.register([], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; var TopLevelConstEnum, M; function foo() { use(TopLevelConstEnum.X); diff --git a/tests/baselines/reference/systemModuleDeclarationMerging.js b/tests/baselines/reference/systemModuleDeclarationMerging.js index 68dec6f3805..1196aa8898d 100644 --- a/tests/baselines/reference/systemModuleDeclarationMerging.js +++ b/tests/baselines/reference/systemModuleDeclarationMerging.js @@ -10,8 +10,9 @@ export enum E {} export module E { var x; } //// [systemModuleDeclarationMerging.js] -System.register([], function(exports_1, __moduleName) { +System.register([], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; var F, C, E; function F() { } exports_1("F", F); diff --git a/tests/baselines/reference/systemModuleExportDefault.js b/tests/baselines/reference/systemModuleExportDefault.js index 05e23840a51..eaa4e6ddaa7 100644 --- a/tests/baselines/reference/systemModuleExportDefault.js +++ b/tests/baselines/reference/systemModuleExportDefault.js @@ -16,8 +16,9 @@ export default class C {} //// [file1.js] -System.register([], function(exports_1, __moduleName) { +System.register([], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; function default_1() { } exports_1("default", default_1); return { @@ -27,8 +28,9 @@ System.register([], function(exports_1, __moduleName) { } }); //// [file2.js] -System.register([], function(exports_1, __moduleName) { +System.register([], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; function foo() { } exports_1("default", foo); return { @@ -38,8 +40,9 @@ System.register([], function(exports_1, __moduleName) { } }); //// [file3.js] -System.register([], function(exports_1, __moduleName) { +System.register([], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; var default_1; return { setters:[], @@ -54,8 +57,9 @@ System.register([], function(exports_1, __moduleName) { } }); //// [file4.js] -System.register([], function(exports_1, __moduleName) { +System.register([], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; var C; return { setters:[], diff --git a/tests/baselines/reference/systemModuleNonTopLevelModuleMembers.js b/tests/baselines/reference/systemModuleNonTopLevelModuleMembers.js index 3bce3b662ae..1cf993baec0 100644 --- a/tests/baselines/reference/systemModuleNonTopLevelModuleMembers.js +++ b/tests/baselines/reference/systemModuleNonTopLevelModuleMembers.js @@ -13,8 +13,9 @@ export module TopLevelModule2 { } //// [systemModuleNonTopLevelModuleMembers.js] -System.register([], function(exports_1, __moduleName) { +System.register([], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; var TopLevelClass, TopLevelModule, TopLevelEnum, TopLevelModule2; function TopLevelFunction() { } exports_1("TopLevelFunction", TopLevelFunction); diff --git a/tests/baselines/reference/systemModuleTargetES6.js b/tests/baselines/reference/systemModuleTargetES6.js new file mode 100644 index 00000000000..21bbc6a6ad8 --- /dev/null +++ b/tests/baselines/reference/systemModuleTargetES6.js @@ -0,0 +1,42 @@ +//// [systemModuleTargetES6.ts] +export class MyClass { } +export class MyClass2 { + static value = 42; + static getInstance() { return MyClass2.value; } +} + +export function myFunction() { + return new MyClass(); +} + +export function myFunction2() { + return new MyClass2(); +} + +//// [systemModuleTargetES6.js] +System.register([], function(exports_1, context_1) { + "use strict"; + var __moduleName = context_1 && context_1.id; + var MyClass, MyClass2; + function myFunction() { + return new MyClass(); + } + exports_1("myFunction", myFunction); + function myFunction2() { + return new MyClass2(); + } + exports_1("myFunction2", myFunction2); + return { + setters:[], + execute: function() { + MyClass = class MyClass { + }; + exports_1("MyClass", MyClass); + MyClass2 = class MyClass2 { + static getInstance() { return MyClass2.value; } + }; + MyClass2.value = 42; + exports_1("MyClass2", MyClass2); + } + } +}); diff --git a/tests/baselines/reference/systemModuleTargetES6.symbols b/tests/baselines/reference/systemModuleTargetES6.symbols new file mode 100644 index 00000000000..afb217c0c0a --- /dev/null +++ b/tests/baselines/reference/systemModuleTargetES6.symbols @@ -0,0 +1,30 @@ +=== tests/cases/compiler/systemModuleTargetES6.ts === +export class MyClass { } +>MyClass : Symbol(MyClass, Decl(systemModuleTargetES6.ts, 0, 0)) + +export class MyClass2 { +>MyClass2 : Symbol(MyClass2, Decl(systemModuleTargetES6.ts, 0, 24)) + + static value = 42; +>value : Symbol(MyClass2.value, Decl(systemModuleTargetES6.ts, 1, 23)) + + static getInstance() { return MyClass2.value; } +>getInstance : Symbol(MyClass2.getInstance, Decl(systemModuleTargetES6.ts, 2, 22)) +>MyClass2.value : Symbol(MyClass2.value, Decl(systemModuleTargetES6.ts, 1, 23)) +>MyClass2 : Symbol(MyClass2, Decl(systemModuleTargetES6.ts, 0, 24)) +>value : Symbol(MyClass2.value, Decl(systemModuleTargetES6.ts, 1, 23)) +} + +export function myFunction() { +>myFunction : Symbol(myFunction, Decl(systemModuleTargetES6.ts, 4, 1)) + + return new MyClass(); +>MyClass : Symbol(MyClass, Decl(systemModuleTargetES6.ts, 0, 0)) +} + +export function myFunction2() { +>myFunction2 : Symbol(myFunction2, Decl(systemModuleTargetES6.ts, 8, 1)) + + return new MyClass2(); +>MyClass2 : Symbol(MyClass2, Decl(systemModuleTargetES6.ts, 0, 24)) +} diff --git a/tests/baselines/reference/systemModuleTargetES6.types b/tests/baselines/reference/systemModuleTargetES6.types new file mode 100644 index 00000000000..5a9801a5d89 --- /dev/null +++ b/tests/baselines/reference/systemModuleTargetES6.types @@ -0,0 +1,33 @@ +=== tests/cases/compiler/systemModuleTargetES6.ts === +export class MyClass { } +>MyClass : MyClass + +export class MyClass2 { +>MyClass2 : MyClass2 + + static value = 42; +>value : number +>42 : number + + static getInstance() { return MyClass2.value; } +>getInstance : () => number +>MyClass2.value : number +>MyClass2 : typeof MyClass2 +>value : number +} + +export function myFunction() { +>myFunction : () => MyClass + + return new MyClass(); +>new MyClass() : MyClass +>MyClass : typeof MyClass +} + +export function myFunction2() { +>myFunction2 : () => MyClass2 + + return new MyClass2(); +>new MyClass2() : MyClass2 +>MyClass2 : typeof MyClass2 +} diff --git a/tests/baselines/reference/systemModuleWithSuperClass.js b/tests/baselines/reference/systemModuleWithSuperClass.js index 21b262fd217..0aab851cc57 100644 --- a/tests/baselines/reference/systemModuleWithSuperClass.js +++ b/tests/baselines/reference/systemModuleWithSuperClass.js @@ -13,8 +13,9 @@ export class Bar extends Foo { } //// [foo.js] -System.register([], function(exports_1, __moduleName) { +System.register([], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; var Foo; return { setters:[], @@ -29,8 +30,9 @@ System.register([], function(exports_1, __moduleName) { } }); //// [bar.js] -System.register(['./foo'], function(exports_1, __moduleName) { +System.register(['./foo'], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } diff --git a/tests/baselines/reference/systemModuleWithSuperClass.symbols b/tests/baselines/reference/systemModuleWithSuperClass.symbols index 46354333479..415e7d1e99f 100644 --- a/tests/baselines/reference/systemModuleWithSuperClass.symbols +++ b/tests/baselines/reference/systemModuleWithSuperClass.symbols @@ -4,7 +4,7 @@ export class Foo { >Foo : Symbol(Foo, Decl(foo.ts, 0, 0)) a: string; ->a : Symbol(a, Decl(foo.ts, 1, 18)) +>a : Symbol(Foo.a, Decl(foo.ts, 1, 18)) } === tests/cases/compiler/bar.ts === @@ -16,5 +16,5 @@ export class Bar extends Foo { >Foo : Symbol(Foo, Decl(bar.ts, 0, 8)) b: string; ->b : Symbol(b, Decl(bar.ts, 1, 30)) +>b : Symbol(Bar.b, Decl(bar.ts, 1, 30)) } diff --git a/tests/baselines/reference/taggedTemplateContextualTyping1.symbols b/tests/baselines/reference/taggedTemplateContextualTyping1.symbols index 2de45d16379..3c50a6f92e4 100644 --- a/tests/baselines/reference/taggedTemplateContextualTyping1.symbols +++ b/tests/baselines/reference/taggedTemplateContextualTyping1.symbols @@ -13,7 +13,7 @@ function tempTag1(templateStrs: TemplateStringsArray, f: FuncType, x: T): T; >tempTag1 : Symbol(tempTag1, Decl(taggedTemplateContextualTyping1.ts, 1, 48), Decl(taggedTemplateContextualTyping1.ts, 3, 79), Decl(taggedTemplateContextualTyping1.ts, 4, 92)) >T : Symbol(T, Decl(taggedTemplateContextualTyping1.ts, 3, 18)) >templateStrs : Symbol(templateStrs, Decl(taggedTemplateContextualTyping1.ts, 3, 21)) ->TemplateStringsArray : Symbol(TemplateStringsArray, Decl(lib.d.ts, --, --)) +>TemplateStringsArray : Symbol(TemplateStringsArray, Decl(lib.es5.d.ts, --, --)) >f : Symbol(f, Decl(taggedTemplateContextualTyping1.ts, 3, 56)) >FuncType : Symbol(FuncType, Decl(taggedTemplateContextualTyping1.ts, 0, 0)) >x : Symbol(x, Decl(taggedTemplateContextualTyping1.ts, 3, 69)) @@ -24,7 +24,7 @@ function tempTag1(templateStrs: TemplateStringsArray, f: FuncType, h: FuncTyp >tempTag1 : Symbol(tempTag1, Decl(taggedTemplateContextualTyping1.ts, 1, 48), Decl(taggedTemplateContextualTyping1.ts, 3, 79), Decl(taggedTemplateContextualTyping1.ts, 4, 92)) >T : Symbol(T, Decl(taggedTemplateContextualTyping1.ts, 4, 18)) >templateStrs : Symbol(templateStrs, Decl(taggedTemplateContextualTyping1.ts, 4, 21)) ->TemplateStringsArray : Symbol(TemplateStringsArray, Decl(lib.d.ts, --, --)) +>TemplateStringsArray : Symbol(TemplateStringsArray, Decl(lib.es5.d.ts, --, --)) >f : Symbol(f, Decl(taggedTemplateContextualTyping1.ts, 4, 56)) >FuncType : Symbol(FuncType, Decl(taggedTemplateContextualTyping1.ts, 0, 0)) >h : Symbol(h, Decl(taggedTemplateContextualTyping1.ts, 4, 69)) diff --git a/tests/baselines/reference/taggedTemplateContextualTyping2.symbols b/tests/baselines/reference/taggedTemplateContextualTyping2.symbols index 240cc344de7..a1ee63ef8b0 100644 --- a/tests/baselines/reference/taggedTemplateContextualTyping2.symbols +++ b/tests/baselines/reference/taggedTemplateContextualTyping2.symbols @@ -22,7 +22,7 @@ type FuncType2 = (x: (p: T) => T) => typeof x; function tempTag2(templateStrs: TemplateStringsArray, f: FuncType1, x: number): number; >tempTag2 : Symbol(tempTag2, Decl(taggedTemplateContextualTyping2.ts, 2, 52), Decl(taggedTemplateContextualTyping2.ts, 4, 87), Decl(taggedTemplateContextualTyping2.ts, 5, 101)) >templateStrs : Symbol(templateStrs, Decl(taggedTemplateContextualTyping2.ts, 4, 18)) ->TemplateStringsArray : Symbol(TemplateStringsArray, Decl(lib.d.ts, --, --)) +>TemplateStringsArray : Symbol(TemplateStringsArray, Decl(lib.es5.d.ts, --, --)) >f : Symbol(f, Decl(taggedTemplateContextualTyping2.ts, 4, 53)) >FuncType1 : Symbol(FuncType1, Decl(taggedTemplateContextualTyping2.ts, 0, 0)) >x : Symbol(x, Decl(taggedTemplateContextualTyping2.ts, 4, 67)) @@ -30,7 +30,7 @@ function tempTag2(templateStrs: TemplateStringsArray, f: FuncType1, x: number): function tempTag2(templateStrs: TemplateStringsArray, f: FuncType2, h: FuncType2, x: string): string; >tempTag2 : Symbol(tempTag2, Decl(taggedTemplateContextualTyping2.ts, 2, 52), Decl(taggedTemplateContextualTyping2.ts, 4, 87), Decl(taggedTemplateContextualTyping2.ts, 5, 101)) >templateStrs : Symbol(templateStrs, Decl(taggedTemplateContextualTyping2.ts, 5, 18)) ->TemplateStringsArray : Symbol(TemplateStringsArray, Decl(lib.d.ts, --, --)) +>TemplateStringsArray : Symbol(TemplateStringsArray, Decl(lib.es5.d.ts, --, --)) >f : Symbol(f, Decl(taggedTemplateContextualTyping2.ts, 5, 53)) >FuncType2 : Symbol(FuncType2, Decl(taggedTemplateContextualTyping2.ts, 1, 49)) >h : Symbol(h, Decl(taggedTemplateContextualTyping2.ts, 5, 67)) diff --git a/tests/baselines/reference/taggedTemplateStringsWithManyCallAndMemberExpressions.symbols b/tests/baselines/reference/taggedTemplateStringsWithManyCallAndMemberExpressions.symbols index 24f75c49178..226729907de 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithManyCallAndMemberExpressions.symbols +++ b/tests/baselines/reference/taggedTemplateStringsWithManyCallAndMemberExpressions.symbols @@ -8,7 +8,7 @@ interface I { >I : Symbol(I, Decl(taggedTemplateStringsWithManyCallAndMemberExpressions.ts, 0, 0)) member: { ->member : Symbol(member, Decl(taggedTemplateStringsWithManyCallAndMemberExpressions.ts, 1, 43)) +>member : Symbol(I.member, Decl(taggedTemplateStringsWithManyCallAndMemberExpressions.ts, 1, 43)) new (s: string): { >s : Symbol(s, Decl(taggedTemplateStringsWithManyCallAndMemberExpressions.ts, 3, 13)) diff --git a/tests/baselines/reference/taggedTemplateStringsWithManyCallAndMemberExpressionsES6.symbols b/tests/baselines/reference/taggedTemplateStringsWithManyCallAndMemberExpressionsES6.symbols index cbe21173d55..6535e998808 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithManyCallAndMemberExpressionsES6.symbols +++ b/tests/baselines/reference/taggedTemplateStringsWithManyCallAndMemberExpressionsES6.symbols @@ -8,7 +8,7 @@ interface I { >I : Symbol(I, Decl(taggedTemplateStringsWithManyCallAndMemberExpressionsES6.ts, 0, 0)) member: { ->member : Symbol(member, Decl(taggedTemplateStringsWithManyCallAndMemberExpressionsES6.ts, 1, 43)) +>member : Symbol(I.member, Decl(taggedTemplateStringsWithManyCallAndMemberExpressionsES6.ts, 1, 43)) new (s: string): { >s : Symbol(s, Decl(taggedTemplateStringsWithManyCallAndMemberExpressionsES6.ts, 3, 13)) diff --git a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution2_ES6.symbols b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution2_ES6.symbols index e96912ec3bb..cadfa135202 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution2_ES6.symbols +++ b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution2_ES6.symbols @@ -2,7 +2,7 @@ function foo1(strs: TemplateStringsArray, x: number): string; >foo1 : Symbol(foo1, Decl(taggedTemplateStringsWithOverloadResolution2_ES6.ts, 0, 0), Decl(taggedTemplateStringsWithOverloadResolution2_ES6.ts, 0, 61), Decl(taggedTemplateStringsWithOverloadResolution2_ES6.ts, 1, 49)) >strs : Symbol(strs, Decl(taggedTemplateStringsWithOverloadResolution2_ES6.ts, 0, 14)) ->TemplateStringsArray : Symbol(TemplateStringsArray, Decl(lib.d.ts, --, --)) +>TemplateStringsArray : Symbol(TemplateStringsArray, Decl(lib.es5.d.ts, --, --)) >x : Symbol(x, Decl(taggedTemplateStringsWithOverloadResolution2_ES6.ts, 0, 41)) function foo1(strs: string[], x: number): number; @@ -34,7 +34,7 @@ function foo2(strs: string[], x: number): number; function foo2(strs: TemplateStringsArray, x: number): string; >foo2 : Symbol(foo2, Decl(taggedTemplateStringsWithOverloadResolution2_ES6.ts, 7, 20), Decl(taggedTemplateStringsWithOverloadResolution2_ES6.ts, 9, 49), Decl(taggedTemplateStringsWithOverloadResolution2_ES6.ts, 10, 61)) >strs : Symbol(strs, Decl(taggedTemplateStringsWithOverloadResolution2_ES6.ts, 10, 14)) ->TemplateStringsArray : Symbol(TemplateStringsArray, Decl(lib.d.ts, --, --)) +>TemplateStringsArray : Symbol(TemplateStringsArray, Decl(lib.es5.d.ts, --, --)) >x : Symbol(x, Decl(taggedTemplateStringsWithOverloadResolution2_ES6.ts, 10, 41)) function foo2(...stuff: any[]): any { diff --git a/tests/baselines/reference/taggedTemplateStringsWithTypedTags.symbols b/tests/baselines/reference/taggedTemplateStringsWithTypedTags.symbols index 974410a7b1d..d3f85d8375a 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithTypedTags.symbols +++ b/tests/baselines/reference/taggedTemplateStringsWithTypedTags.symbols @@ -8,19 +8,19 @@ interface I { >I : Symbol(I, Decl(taggedTemplateStringsWithTypedTags.ts, 0, 0)) g: I; ->g : Symbol(g, Decl(taggedTemplateStringsWithTypedTags.ts, 1, 50)) +>g : Symbol(I.g, Decl(taggedTemplateStringsWithTypedTags.ts, 1, 50)) >I : Symbol(I, Decl(taggedTemplateStringsWithTypedTags.ts, 0, 0)) h: I; ->h : Symbol(h, Decl(taggedTemplateStringsWithTypedTags.ts, 2, 9)) +>h : Symbol(I.h, Decl(taggedTemplateStringsWithTypedTags.ts, 2, 9)) >I : Symbol(I, Decl(taggedTemplateStringsWithTypedTags.ts, 0, 0)) member: I; ->member : Symbol(member, Decl(taggedTemplateStringsWithTypedTags.ts, 3, 9)) +>member : Symbol(I.member, Decl(taggedTemplateStringsWithTypedTags.ts, 3, 9)) >I : Symbol(I, Decl(taggedTemplateStringsWithTypedTags.ts, 0, 0)) thisIsNotATag(x: string): void ->thisIsNotATag : Symbol(thisIsNotATag, Decl(taggedTemplateStringsWithTypedTags.ts, 4, 14)) +>thisIsNotATag : Symbol(I.thisIsNotATag, Decl(taggedTemplateStringsWithTypedTags.ts, 4, 14)) >x : Symbol(x, Decl(taggedTemplateStringsWithTypedTags.ts, 5, 18)) [x: number]: I; diff --git a/tests/baselines/reference/taggedTemplateStringsWithTypedTagsES6.symbols b/tests/baselines/reference/taggedTemplateStringsWithTypedTagsES6.symbols index a78e10c11e0..f0b088bd6f6 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithTypedTagsES6.symbols +++ b/tests/baselines/reference/taggedTemplateStringsWithTypedTagsES6.symbols @@ -8,19 +8,19 @@ interface I { >I : Symbol(I, Decl(taggedTemplateStringsWithTypedTagsES6.ts, 0, 0)) g: I; ->g : Symbol(g, Decl(taggedTemplateStringsWithTypedTagsES6.ts, 1, 50)) +>g : Symbol(I.g, Decl(taggedTemplateStringsWithTypedTagsES6.ts, 1, 50)) >I : Symbol(I, Decl(taggedTemplateStringsWithTypedTagsES6.ts, 0, 0)) h: I; ->h : Symbol(h, Decl(taggedTemplateStringsWithTypedTagsES6.ts, 2, 9)) +>h : Symbol(I.h, Decl(taggedTemplateStringsWithTypedTagsES6.ts, 2, 9)) >I : Symbol(I, Decl(taggedTemplateStringsWithTypedTagsES6.ts, 0, 0)) member: I; ->member : Symbol(member, Decl(taggedTemplateStringsWithTypedTagsES6.ts, 3, 9)) +>member : Symbol(I.member, Decl(taggedTemplateStringsWithTypedTagsES6.ts, 3, 9)) >I : Symbol(I, Decl(taggedTemplateStringsWithTypedTagsES6.ts, 0, 0)) thisIsNotATag(x: string): void ->thisIsNotATag : Symbol(thisIsNotATag, Decl(taggedTemplateStringsWithTypedTagsES6.ts, 4, 14)) +>thisIsNotATag : Symbol(I.thisIsNotATag, Decl(taggedTemplateStringsWithTypedTagsES6.ts, 4, 14)) >x : Symbol(x, Decl(taggedTemplateStringsWithTypedTagsES6.ts, 5, 18)) [x: number]: I; diff --git a/tests/baselines/reference/templateStringWithEmbeddedNewOperator.symbols b/tests/baselines/reference/templateStringWithEmbeddedNewOperator.symbols index ed7ef9dbc63..120bd330502 100644 --- a/tests/baselines/reference/templateStringWithEmbeddedNewOperator.symbols +++ b/tests/baselines/reference/templateStringWithEmbeddedNewOperator.symbols @@ -1,5 +1,5 @@ === tests/cases/conformance/es6/templates/templateStringWithEmbeddedNewOperator.ts === var x = `abc${ new String("Hi") }def`; >x : Symbol(x, Decl(templateStringWithEmbeddedNewOperator.ts, 0, 3)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) diff --git a/tests/baselines/reference/templateStringWithEmbeddedNewOperatorES6.symbols b/tests/baselines/reference/templateStringWithEmbeddedNewOperatorES6.symbols index a7240d4fd22..3252f47b4a1 100644 --- a/tests/baselines/reference/templateStringWithEmbeddedNewOperatorES6.symbols +++ b/tests/baselines/reference/templateStringWithEmbeddedNewOperatorES6.symbols @@ -1,5 +1,5 @@ === tests/cases/conformance/es6/templates/templateStringWithEmbeddedNewOperatorES6.ts === var x = `abc${ new String("Hi") }def`; >x : Symbol(x, Decl(templateStringWithEmbeddedNewOperatorES6.ts, 0, 3)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) diff --git a/tests/baselines/reference/templateStringWithEmbeddedUnaryPlusES6.symbols b/tests/baselines/reference/templateStringWithEmbeddedUnaryPlusES6.symbols index 5d27cedede1..df10fbfca6d 100644 --- a/tests/baselines/reference/templateStringWithEmbeddedUnaryPlusES6.symbols +++ b/tests/baselines/reference/templateStringWithEmbeddedUnaryPlusES6.symbols @@ -1,5 +1,5 @@ === tests/cases/conformance/es6/templates/templateStringWithEmbeddedUnaryPlusES6.ts === var x = `abc${ +Infinity }def`; >x : Symbol(x, Decl(templateStringWithEmbeddedUnaryPlusES6.ts, 0, 3)) ->Infinity : Symbol(Infinity, Decl(lib.d.ts, --, --)) +>Infinity : Symbol(Infinity, Decl(lib.es5.d.ts, --, --)) diff --git a/tests/baselines/reference/templateStringWithPropertyAccessES6.symbols b/tests/baselines/reference/templateStringWithPropertyAccessES6.symbols index 9259aff2a31..803705609a1 100644 --- a/tests/baselines/reference/templateStringWithPropertyAccessES6.symbols +++ b/tests/baselines/reference/templateStringWithPropertyAccessES6.symbols @@ -1,5 +1,5 @@ === tests/cases/conformance/es6/templates/templateStringWithPropertyAccessES6.ts === `abc${0}abc`.indexOf(`abc`); ->`abc${0}abc`.indexOf : Symbol(String.indexOf, Decl(lib.d.ts, --, --)) ->indexOf : Symbol(String.indexOf, Decl(lib.d.ts, --, --)) +>`abc${0}abc`.indexOf : Symbol(String.indexOf, Decl(lib.es5.d.ts, --, --)) +>indexOf : Symbol(String.indexOf, Decl(lib.es5.d.ts, --, --)) diff --git a/tests/baselines/reference/templateStringsArrayTypeDefinedInES5Mode.errors.txt b/tests/baselines/reference/templateStringsArrayTypeDefinedInES5Mode.errors.txt index e6910840d39..94ab5028647 100644 --- a/tests/baselines/reference/templateStringsArrayTypeDefinedInES5Mode.errors.txt +++ b/tests/baselines/reference/templateStringsArrayTypeDefinedInES5Mode.errors.txt @@ -1,5 +1,5 @@ -tests/cases/compiler/templateStringsArrayTypeDefinedInES5Mode.ts(8,3): error TS2345: Argument of type '{ [x: number]: undefined; }' is not assignable to parameter of type 'TemplateStringsArray'. - Property 'raw' is missing in type '{ [x: number]: undefined; }'. +tests/cases/compiler/templateStringsArrayTypeDefinedInES5Mode.ts(8,3): error TS2345: Argument of type '{}' is not assignable to parameter of type 'TemplateStringsArray'. + Property 'raw' is missing in type '{}'. ==== tests/cases/compiler/templateStringsArrayTypeDefinedInES5Mode.ts (1 errors) ==== @@ -12,7 +12,7 @@ tests/cases/compiler/templateStringsArrayTypeDefinedInES5Mode.ts(8,3): error TS2 f({}, 10, 10); ~~ -!!! error TS2345: Argument of type '{ [x: number]: undefined; }' is not assignable to parameter of type 'TemplateStringsArray'. -!!! error TS2345: Property 'raw' is missing in type '{ [x: number]: undefined; }'. +!!! error TS2345: Argument of type '{}' is not assignable to parameter of type 'TemplateStringsArray'. +!!! error TS2345: Property 'raw' is missing in type '{}'. f `abcdef${ 1234 }${ 5678 }ghijkl`; \ No newline at end of file diff --git a/tests/baselines/reference/templateStringsArrayTypeNotDefinedES5Mode.errors.txt b/tests/baselines/reference/templateStringsArrayTypeNotDefinedES5Mode.errors.txt index e8bf38c1048..1201c82f4d0 100644 --- a/tests/baselines/reference/templateStringsArrayTypeNotDefinedES5Mode.errors.txt +++ b/tests/baselines/reference/templateStringsArrayTypeNotDefinedES5Mode.errors.txt @@ -1,5 +1,5 @@ -tests/cases/compiler/templateStringsArrayTypeNotDefinedES5Mode.ts(5,3): error TS2345: Argument of type '{ [x: number]: undefined; }' is not assignable to parameter of type 'TemplateStringsArray'. - Property 'raw' is missing in type '{ [x: number]: undefined; }'. +tests/cases/compiler/templateStringsArrayTypeNotDefinedES5Mode.ts(5,3): error TS2345: Argument of type '{}' is not assignable to parameter of type 'TemplateStringsArray'. + Property 'raw' is missing in type '{}'. ==== tests/cases/compiler/templateStringsArrayTypeNotDefinedES5Mode.ts (1 errors) ==== @@ -9,7 +9,7 @@ tests/cases/compiler/templateStringsArrayTypeNotDefinedES5Mode.ts(5,3): error TS f({}, 10, 10); ~~ -!!! error TS2345: Argument of type '{ [x: number]: undefined; }' is not assignable to parameter of type 'TemplateStringsArray'. -!!! error TS2345: Property 'raw' is missing in type '{ [x: number]: undefined; }'. +!!! error TS2345: Argument of type '{}' is not assignable to parameter of type 'TemplateStringsArray'. +!!! error TS2345: Property 'raw' is missing in type '{}'. f `abcdef${ 1234 }${ 5678 }ghijkl`; \ No newline at end of file diff --git a/tests/baselines/reference/templateStringsArrayTypeRedefinedInES6Mode.errors.txt b/tests/baselines/reference/templateStringsArrayTypeRedefinedInES6Mode.errors.txt index ac30556a235..f410d408482 100644 --- a/tests/baselines/reference/templateStringsArrayTypeRedefinedInES6Mode.errors.txt +++ b/tests/baselines/reference/templateStringsArrayTypeRedefinedInES6Mode.errors.txt @@ -1,5 +1,5 @@ -tests/cases/compiler/templateStringsArrayTypeRedefinedInES6Mode.ts(8,3): error TS2345: Argument of type '{ [x: number]: undefined; }' is not assignable to parameter of type 'TemplateStringsArray'. - Property 'raw' is missing in type '{ [x: number]: undefined; }'. +tests/cases/compiler/templateStringsArrayTypeRedefinedInES6Mode.ts(8,3): error TS2345: Argument of type '{}' is not assignable to parameter of type 'TemplateStringsArray'. + Property 'raw' is missing in type '{}'. ==== tests/cases/compiler/templateStringsArrayTypeRedefinedInES6Mode.ts (1 errors) ==== @@ -12,7 +12,7 @@ tests/cases/compiler/templateStringsArrayTypeRedefinedInES6Mode.ts(8,3): error T f({}, 10, 10); ~~ -!!! error TS2345: Argument of type '{ [x: number]: undefined; }' is not assignable to parameter of type 'TemplateStringsArray'. -!!! error TS2345: Property 'raw' is missing in type '{ [x: number]: undefined; }'. +!!! error TS2345: Argument of type '{}' is not assignable to parameter of type 'TemplateStringsArray'. +!!! error TS2345: Property 'raw' is missing in type '{}'. f `abcdef${ 1234 }${ 5678 }ghijkl`; \ No newline at end of file diff --git a/tests/baselines/reference/testContainerList.symbols b/tests/baselines/reference/testContainerList.symbols index aed56643448..79c7df0c82f 100644 --- a/tests/baselines/reference/testContainerList.symbols +++ b/tests/baselines/reference/testContainerList.symbols @@ -7,7 +7,7 @@ module A { >C : Symbol(C, Decl(testContainerList.ts, 1, 10)) constructor(public d: {}) { } ->d : Symbol(d, Decl(testContainerList.ts, 3, 20)) +>d : Symbol(C.d, Decl(testContainerList.ts, 3, 20)) } } diff --git a/tests/baselines/reference/testTypings.symbols b/tests/baselines/reference/testTypings.symbols index 5e3074a9585..4d91263142a 100644 --- a/tests/baselines/reference/testTypings.symbols +++ b/tests/baselines/reference/testTypings.symbols @@ -4,7 +4,7 @@ interface IComparable { >T : Symbol(T, Decl(testTypings.ts, 0, 22)) compareTo(other: T); ->compareTo : Symbol(compareTo, Decl(testTypings.ts, 0, 26)) +>compareTo : Symbol(IComparable.compareTo, Decl(testTypings.ts, 0, 26)) >other : Symbol(other, Decl(testTypings.ts, 1, 13)) >T : Symbol(T, Decl(testTypings.ts, 0, 22)) } diff --git a/tests/baselines/reference/thisBinding2.symbols b/tests/baselines/reference/thisBinding2.symbols index 60c11c2e959..cdef9b60b3e 100644 --- a/tests/baselines/reference/thisBinding2.symbols +++ b/tests/baselines/reference/thisBinding2.symbols @@ -3,27 +3,27 @@ class C { >C : Symbol(C, Decl(thisBinding2.ts, 0, 0)) x: number; ->x : Symbol(x, Decl(thisBinding2.ts, 0, 9)) +>x : Symbol(C.x, Decl(thisBinding2.ts, 0, 9)) constructor() { this.x = (() => { ->this.x : Symbol(x, Decl(thisBinding2.ts, 0, 9)) +>this.x : Symbol(C.x, Decl(thisBinding2.ts, 0, 9)) >this : Symbol(C, Decl(thisBinding2.ts, 0, 0)) ->x : Symbol(x, Decl(thisBinding2.ts, 0, 9)) +>x : Symbol(C.x, Decl(thisBinding2.ts, 0, 9)) var x = 1; >x : Symbol(x, Decl(thisBinding2.ts, 4, 6)) return this.x; ->this.x : Symbol(x, Decl(thisBinding2.ts, 0, 9)) +>this.x : Symbol(C.x, Decl(thisBinding2.ts, 0, 9)) >this : Symbol(C, Decl(thisBinding2.ts, 0, 0)) ->x : Symbol(x, Decl(thisBinding2.ts, 0, 9)) +>x : Symbol(C.x, Decl(thisBinding2.ts, 0, 9)) })(); this.x = function() { ->this.x : Symbol(x, Decl(thisBinding2.ts, 0, 9)) +>this.x : Symbol(C.x, Decl(thisBinding2.ts, 0, 9)) >this : Symbol(C, Decl(thisBinding2.ts, 0, 0)) ->x : Symbol(x, Decl(thisBinding2.ts, 0, 9)) +>x : Symbol(C.x, Decl(thisBinding2.ts, 0, 9)) var x = 1; >x : Symbol(x, Decl(thisBinding2.ts, 8, 6)) diff --git a/tests/baselines/reference/thisCapture1.symbols b/tests/baselines/reference/thisCapture1.symbols index fade5bbeca3..7065eb0db1c 100644 --- a/tests/baselines/reference/thisCapture1.symbols +++ b/tests/baselines/reference/thisCapture1.symbols @@ -3,10 +3,10 @@ class X { >X : Symbol(X, Decl(thisCapture1.ts, 0, 0)) private y = 0; ->y : Symbol(y, Decl(thisCapture1.ts, 0, 9)) +>y : Symbol(X.y, Decl(thisCapture1.ts, 0, 9)) public getSettings(keys: string[]): any { ->getSettings : Symbol(getSettings, Decl(thisCapture1.ts, 1, 18)) +>getSettings : Symbol(X.getSettings, Decl(thisCapture1.ts, 1, 18)) >keys : Symbol(keys, Decl(thisCapture1.ts, 2, 23)) var ret: any; @@ -16,9 +16,9 @@ class X { >ret : Symbol(ret, Decl(thisCapture1.ts, 3, 11)) this.y = 0; ->this.y : Symbol(y, Decl(thisCapture1.ts, 0, 9)) +>this.y : Symbol(X.y, Decl(thisCapture1.ts, 0, 9)) >this : Symbol(X, Decl(thisCapture1.ts, 0, 0)) ->y : Symbol(y, Decl(thisCapture1.ts, 0, 9)) +>y : Symbol(X.y, Decl(thisCapture1.ts, 0, 9)) }).promise(); } diff --git a/tests/baselines/reference/thisExpressionOfGenericObject.symbols b/tests/baselines/reference/thisExpressionOfGenericObject.symbols index f923b675e5d..4f0affe548b 100644 --- a/tests/baselines/reference/thisExpressionOfGenericObject.symbols +++ b/tests/baselines/reference/thisExpressionOfGenericObject.symbols @@ -4,7 +4,7 @@ class MyClass1 { >T : Symbol(T, Decl(thisExpressionOfGenericObject.ts, 0, 15)) private obj: MyClass1; ->obj : Symbol(obj, Decl(thisExpressionOfGenericObject.ts, 0, 19)) +>obj : Symbol(MyClass1.obj, Decl(thisExpressionOfGenericObject.ts, 0, 19)) >MyClass1 : Symbol(MyClass1, Decl(thisExpressionOfGenericObject.ts, 0, 0)) constructor() { diff --git a/tests/baselines/reference/thisInInnerFunctions.symbols b/tests/baselines/reference/thisInInnerFunctions.symbols index 70c9106f9f8..c981180ec79 100644 --- a/tests/baselines/reference/thisInInnerFunctions.symbols +++ b/tests/baselines/reference/thisInInnerFunctions.symbols @@ -3,10 +3,10 @@ class Foo { >Foo : Symbol(Foo, Decl(thisInInnerFunctions.ts, 0, 0)) x = "hello"; ->x : Symbol(x, Decl(thisInInnerFunctions.ts, 0, 11)) +>x : Symbol(Foo.x, Decl(thisInInnerFunctions.ts, 0, 11)) bar() { ->bar : Symbol(bar, Decl(thisInInnerFunctions.ts, 1, 16)) +>bar : Symbol(Foo.bar, Decl(thisInInnerFunctions.ts, 1, 16)) function inner() { >inner : Symbol(inner, Decl(thisInInnerFunctions.ts, 2, 11)) diff --git a/tests/baselines/reference/thisInInstanceMemberInitializer.symbols b/tests/baselines/reference/thisInInstanceMemberInitializer.symbols index 2690bb1b73e..00a0f92e439 100644 --- a/tests/baselines/reference/thisInInstanceMemberInitializer.symbols +++ b/tests/baselines/reference/thisInInstanceMemberInitializer.symbols @@ -3,7 +3,7 @@ class C { >C : Symbol(C, Decl(thisInInstanceMemberInitializer.ts, 0, 0)) x = this; ->x : Symbol(x, Decl(thisInInstanceMemberInitializer.ts, 0, 9)) +>x : Symbol(C.x, Decl(thisInInstanceMemberInitializer.ts, 0, 9)) >this : Symbol(C, Decl(thisInInstanceMemberInitializer.ts, 0, 0)) } @@ -12,10 +12,10 @@ class D { >T : Symbol(T, Decl(thisInInstanceMemberInitializer.ts, 4, 8)) x = this; ->x : Symbol(x, Decl(thisInInstanceMemberInitializer.ts, 4, 12)) +>x : Symbol(D.x, Decl(thisInInstanceMemberInitializer.ts, 4, 12)) >this : Symbol(D, Decl(thisInInstanceMemberInitializer.ts, 2, 1)) y: T; ->y : Symbol(y, Decl(thisInInstanceMemberInitializer.ts, 5, 13)) +>y : Symbol(D.y, Decl(thisInInstanceMemberInitializer.ts, 5, 13)) >T : Symbol(T, Decl(thisInInstanceMemberInitializer.ts, 4, 8)) } diff --git a/tests/baselines/reference/thisInInvalidContexts.errors.txt b/tests/baselines/reference/thisInInvalidContexts.errors.txt index 76b90ed7c20..d33260fa108 100644 --- a/tests/baselines/reference/thisInInvalidContexts.errors.txt +++ b/tests/baselines/reference/thisInInvalidContexts.errors.txt @@ -1,5 +1,6 @@ tests/cases/conformance/expressions/thisKeyword/thisInInvalidContexts.ts(3,16): error TS2334: 'this' cannot be referenced in a static property initializer. -tests/cases/conformance/expressions/thisKeyword/thisInInvalidContexts.ts(22,15): error TS2332: 'this' cannot be referenced in current location. +tests/cases/conformance/expressions/thisKeyword/thisInInvalidContexts.ts(14,15): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. +tests/cases/conformance/expressions/thisKeyword/thisInInvalidContexts.ts(22,15): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. tests/cases/conformance/expressions/thisKeyword/thisInInvalidContexts.ts(28,13): error TS2331: 'this' cannot be referenced in a module or namespace body. tests/cases/conformance/expressions/thisKeyword/thisInInvalidContexts.ts(36,13): error TS2526: A 'this' type is available only in a non-static member of a class or interface. tests/cases/conformance/expressions/thisKeyword/thisInInvalidContexts.ts(38,25): error TS2507: Type 'any' is not a constructor function type. @@ -7,7 +8,7 @@ tests/cases/conformance/expressions/thisKeyword/thisInInvalidContexts.ts(44,9): tests/cases/conformance/expressions/thisKeyword/thisInInvalidContexts.ts(45,9): error TS2332: 'this' cannot be referenced in current location. -==== tests/cases/conformance/expressions/thisKeyword/thisInInvalidContexts.ts (7 errors) ==== +==== tests/cases/conformance/expressions/thisKeyword/thisInInvalidContexts.ts (8 errors) ==== //'this' in static member initializer class ErrClass1 { static t = this; // Error @@ -23,7 +24,9 @@ tests/cases/conformance/expressions/thisKeyword/thisInInvalidContexts.ts(45,9): t; //'this' in optional super call constructor() { - super(this); // OK + super(this); // Error + ~~~~ +!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. } } @@ -33,7 +36,7 @@ tests/cases/conformance/expressions/thisKeyword/thisInInvalidContexts.ts(45,9): constructor() { super(this); // Error ~~~~ -!!! error TS2332: 'this' cannot be referenced in current location. +!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. } } diff --git a/tests/baselines/reference/thisInInvalidContexts.js b/tests/baselines/reference/thisInInvalidContexts.js index 63a39b33b0e..75ccd12c288 100644 --- a/tests/baselines/reference/thisInInvalidContexts.js +++ b/tests/baselines/reference/thisInInvalidContexts.js @@ -12,7 +12,7 @@ class ClassWithNoInitializer extends BaseErrClass { t; //'this' in optional super call constructor() { - super(this); // OK + super(this); // Error } } @@ -70,7 +70,7 @@ var ClassWithNoInitializer = (function (_super) { __extends(ClassWithNoInitializer, _super); //'this' in optional super call function ClassWithNoInitializer() { - _super.call(this, this); // OK + _super.call(this, this); // Error } return ClassWithNoInitializer; }(BaseErrClass)); diff --git a/tests/baselines/reference/thisInInvalidContextsExternalModule.errors.txt b/tests/baselines/reference/thisInInvalidContextsExternalModule.errors.txt index a1afdea661b..8f84793a49f 100644 --- a/tests/baselines/reference/thisInInvalidContextsExternalModule.errors.txt +++ b/tests/baselines/reference/thisInInvalidContextsExternalModule.errors.txt @@ -1,11 +1,11 @@ tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts(3,16): error TS2334: 'this' cannot be referenced in a static property initializer. -tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts(22,15): error TS2332: 'this' cannot be referenced in current location. +tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts(14,15): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. +tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts(22,15): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts(28,13): error TS2331: 'this' cannot be referenced in a module or namespace body. tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts(36,13): error TS2526: A 'this' type is available only in a non-static member of a class or interface. tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts(38,25): error TS2507: Type 'any' is not a constructor function type. tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts(44,9): error TS2332: 'this' cannot be referenced in current location. tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts(45,9): error TS2332: 'this' cannot be referenced in current location. -tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts(48,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ==== tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts (8 errors) ==== @@ -24,7 +24,9 @@ tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalMod t; //'this' in optional super call constructor() { - super(this); // OK + super(this); // error: "super" has to be called before "this" accessing + ~~~~ +!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. } } @@ -34,7 +36,7 @@ tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalMod constructor() { super(this); // Error ~~~~ -!!! error TS2332: 'this' cannot be referenced in current location. +!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. } } @@ -70,6 +72,4 @@ tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalMod !!! error TS2332: 'this' cannot be referenced in current location. } - export = this; // Should be an error - ~~~~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. \ No newline at end of file + export = this; // Should be an error \ No newline at end of file diff --git a/tests/baselines/reference/thisInInvalidContextsExternalModule.js b/tests/baselines/reference/thisInInvalidContextsExternalModule.js index 3df51877d13..2e7e6d8b47c 100644 --- a/tests/baselines/reference/thisInInvalidContextsExternalModule.js +++ b/tests/baselines/reference/thisInInvalidContextsExternalModule.js @@ -12,7 +12,7 @@ class ClassWithNoInitializer extends BaseErrClass { t; //'this' in optional super call constructor() { - super(this); // OK + super(this); // error: "super" has to be called before "this" accessing } } @@ -71,7 +71,7 @@ var ClassWithNoInitializer = (function (_super) { __extends(ClassWithNoInitializer, _super); //'this' in optional super call function ClassWithNoInitializer() { - _super.call(this, this); // OK + _super.call(this, this); // error: "super" has to be called before "this" accessing } return ClassWithNoInitializer; }(BaseErrClass)); diff --git a/tests/baselines/reference/thisInLambda.symbols b/tests/baselines/reference/thisInLambda.symbols index e760c1b1c02..79a43a59037 100644 --- a/tests/baselines/reference/thisInLambda.symbols +++ b/tests/baselines/reference/thisInLambda.symbols @@ -3,21 +3,21 @@ class Foo { >Foo : Symbol(Foo, Decl(thisInLambda.ts, 0, 0)) x = "hello"; ->x : Symbol(x, Decl(thisInLambda.ts, 0, 11)) +>x : Symbol(Foo.x, Decl(thisInLambda.ts, 0, 11)) bar() { ->bar : Symbol(bar, Decl(thisInLambda.ts, 1, 16)) +>bar : Symbol(Foo.bar, Decl(thisInLambda.ts, 1, 16)) this.x; // 'this' is type 'Foo' ->this.x : Symbol(x, Decl(thisInLambda.ts, 0, 11)) +>this.x : Symbol(Foo.x, Decl(thisInLambda.ts, 0, 11)) >this : Symbol(Foo, Decl(thisInLambda.ts, 0, 0)) ->x : Symbol(x, Decl(thisInLambda.ts, 0, 11)) +>x : Symbol(Foo.x, Decl(thisInLambda.ts, 0, 11)) var f = () => this.x; // 'this' should be type 'Foo' as well >f : Symbol(f, Decl(thisInLambda.ts, 4, 11)) ->this.x : Symbol(x, Decl(thisInLambda.ts, 0, 11)) +>this.x : Symbol(Foo.x, Decl(thisInLambda.ts, 0, 11)) >this : Symbol(Foo, Decl(thisInLambda.ts, 0, 0)) ->x : Symbol(x, Decl(thisInLambda.ts, 0, 11)) +>x : Symbol(Foo.x, Decl(thisInLambda.ts, 0, 11)) } } diff --git a/tests/baselines/reference/thisInObjectLiterals.errors.txt b/tests/baselines/reference/thisInObjectLiterals.errors.txt index 73300d86d74..e89980dc244 100644 --- a/tests/baselines/reference/thisInObjectLiterals.errors.txt +++ b/tests/baselines/reference/thisInObjectLiterals.errors.txt @@ -14,7 +14,7 @@ tests/cases/conformance/expressions/thisKeyword/thisInObjectLiterals.ts(7,13): e } } - //type of 'this' in an object literal property of a function type is Any + //type of 'this' in an object literal method is the type of the object literal var obj = { f() { return this.spaaace; diff --git a/tests/baselines/reference/thisInObjectLiterals.js b/tests/baselines/reference/thisInObjectLiterals.js index 4e71347a366..6c8380060a7 100644 --- a/tests/baselines/reference/thisInObjectLiterals.js +++ b/tests/baselines/reference/thisInObjectLiterals.js @@ -9,7 +9,7 @@ class MyClass { } } -//type of 'this' in an object literal property of a function type is Any +//type of 'this' in an object literal method is the type of the object literal var obj = { f() { return this.spaaace; @@ -29,7 +29,7 @@ var MyClass = (function () { }; return MyClass; }()); -//type of 'this' in an object literal property of a function type is Any +//type of 'this' in an object literal method is the type of the object literal var obj = { f: function () { return this.spaaace; diff --git a/tests/baselines/reference/thisInPropertyBoundDeclarations.symbols b/tests/baselines/reference/thisInPropertyBoundDeclarations.symbols index 9d405b8f6f6..12d3b2db31e 100644 --- a/tests/baselines/reference/thisInPropertyBoundDeclarations.symbols +++ b/tests/baselines/reference/thisInPropertyBoundDeclarations.symbols @@ -3,7 +3,7 @@ class Bug { >Bug : Symbol(Bug, Decl(thisInPropertyBoundDeclarations.ts, 0, 0)) private name: string; ->name : Symbol(name, Decl(thisInPropertyBoundDeclarations.ts, 0, 11)) +>name : Symbol(Bug.name, Decl(thisInPropertyBoundDeclarations.ts, 0, 11)) private static func: Function[] = [ >func : Symbol(Bug.func, Decl(thisInPropertyBoundDeclarations.ts, 1, 25)) @@ -23,13 +23,13 @@ class Bug { ]; private foo(name: string) { ->foo : Symbol(foo, Decl(thisInPropertyBoundDeclarations.ts, 7, 6)) +>foo : Symbol(Bug.foo, Decl(thisInPropertyBoundDeclarations.ts, 7, 6)) >name : Symbol(name, Decl(thisInPropertyBoundDeclarations.ts, 9, 16)) this.name = name; ->this.name : Symbol(name, Decl(thisInPropertyBoundDeclarations.ts, 0, 11)) +>this.name : Symbol(Bug.name, Decl(thisInPropertyBoundDeclarations.ts, 0, 11)) >this : Symbol(Bug, Decl(thisInPropertyBoundDeclarations.ts, 0, 0)) ->name : Symbol(name, Decl(thisInPropertyBoundDeclarations.ts, 0, 11)) +>name : Symbol(Bug.name, Decl(thisInPropertyBoundDeclarations.ts, 0, 11)) >name : Symbol(name, Decl(thisInPropertyBoundDeclarations.ts, 9, 16)) } } @@ -39,13 +39,13 @@ class A { >A : Symbol(A, Decl(thisInPropertyBoundDeclarations.ts, 12, 1)) prop1 = function() { ->prop1 : Symbol(prop1, Decl(thisInPropertyBoundDeclarations.ts, 15, 9)) +>prop1 : Symbol(A.prop1, Decl(thisInPropertyBoundDeclarations.ts, 15, 9)) this; }; prop2 = function() { ->prop2 : Symbol(prop2, Decl(thisInPropertyBoundDeclarations.ts, 18, 6)) +>prop2 : Symbol(A.prop2, Decl(thisInPropertyBoundDeclarations.ts, 18, 6)) function inner() { >inner : Symbol(inner, Decl(thisInPropertyBoundDeclarations.ts, 20, 24)) @@ -56,7 +56,7 @@ class A { }; prop3 = () => { ->prop3 : Symbol(prop3, Decl(thisInPropertyBoundDeclarations.ts, 25, 6)) +>prop3 : Symbol(A.prop3, Decl(thisInPropertyBoundDeclarations.ts, 25, 6)) function inner() { >inner : Symbol(inner, Decl(thisInPropertyBoundDeclarations.ts, 27, 19)) @@ -66,7 +66,7 @@ class A { }; prop4 = { ->prop4 : Symbol(prop4, Decl(thisInPropertyBoundDeclarations.ts, 31, 6)) +>prop4 : Symbol(A.prop4, Decl(thisInPropertyBoundDeclarations.ts, 31, 6)) a: function() { return this; }, >a : Symbol(a, Decl(thisInPropertyBoundDeclarations.ts, 33, 13)) @@ -74,7 +74,7 @@ class A { }; prop5 = () => { ->prop5 : Symbol(prop5, Decl(thisInPropertyBoundDeclarations.ts, 35, 6)) +>prop5 : Symbol(A.prop5, Decl(thisInPropertyBoundDeclarations.ts, 35, 6)) return { a: function() { return this; }, @@ -88,19 +88,19 @@ class B { >B : Symbol(B, Decl(thisInPropertyBoundDeclarations.ts, 42, 1)) prop1 = this; ->prop1 : Symbol(prop1, Decl(thisInPropertyBoundDeclarations.ts, 44, 9)) +>prop1 : Symbol(B.prop1, Decl(thisInPropertyBoundDeclarations.ts, 44, 9)) >this : Symbol(B, Decl(thisInPropertyBoundDeclarations.ts, 42, 1)) prop2 = () => this; ->prop2 : Symbol(prop2, Decl(thisInPropertyBoundDeclarations.ts, 45, 17)) +>prop2 : Symbol(B.prop2, Decl(thisInPropertyBoundDeclarations.ts, 45, 17)) >this : Symbol(B, Decl(thisInPropertyBoundDeclarations.ts, 42, 1)) prop3 = () => () => () => () => this; ->prop3 : Symbol(prop3, Decl(thisInPropertyBoundDeclarations.ts, 47, 23)) +>prop3 : Symbol(B.prop3, Decl(thisInPropertyBoundDeclarations.ts, 47, 23)) >this : Symbol(B, Decl(thisInPropertyBoundDeclarations.ts, 42, 1)) prop4 = ' ' + ->prop4 : Symbol(prop4, Decl(thisInPropertyBoundDeclarations.ts, 49, 41)) +>prop4 : Symbol(B.prop4, Decl(thisInPropertyBoundDeclarations.ts, 49, 41)) function() { } + @@ -109,7 +109,7 @@ class B { >this : Symbol(B, Decl(thisInPropertyBoundDeclarations.ts, 42, 1)) prop5 = { ->prop5 : Symbol(prop5, Decl(thisInPropertyBoundDeclarations.ts, 55, 29)) +>prop5 : Symbol(B.prop5, Decl(thisInPropertyBoundDeclarations.ts, 55, 29)) a: () => { return this; } >a : Symbol(a, Decl(thisInPropertyBoundDeclarations.ts, 57, 13)) @@ -118,7 +118,7 @@ class B { }; prop6 = () => { ->prop6 : Symbol(prop6, Decl(thisInPropertyBoundDeclarations.ts, 59, 6)) +>prop6 : Symbol(B.prop6, Decl(thisInPropertyBoundDeclarations.ts, 59, 6)) return { a: () => { return this; } diff --git a/tests/baselines/reference/thisInSuperCall.errors.txt b/tests/baselines/reference/thisInSuperCall.errors.txt index 57255aa9582..d1eeb1d2b2b 100644 --- a/tests/baselines/reference/thisInSuperCall.errors.txt +++ b/tests/baselines/reference/thisInSuperCall.errors.txt @@ -1,15 +1,18 @@ -tests/cases/compiler/thisInSuperCall.ts(14,15): error TS2332: 'this' cannot be referenced in current location. -tests/cases/compiler/thisInSuperCall.ts(20,15): error TS2332: 'this' cannot be referenced in current location. +tests/cases/compiler/thisInSuperCall.ts(7,15): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. +tests/cases/compiler/thisInSuperCall.ts(14,15): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. +tests/cases/compiler/thisInSuperCall.ts(20,15): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. -==== tests/cases/compiler/thisInSuperCall.ts (2 errors) ==== +==== tests/cases/compiler/thisInSuperCall.ts (3 errors) ==== class Base { constructor(x: any) {} } class Foo extends Base { constructor() { - super(this); // no error + super(this); // error: "super" has to be called before "this" accessing + ~~~~ +!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. } } @@ -18,7 +21,7 @@ tests/cases/compiler/thisInSuperCall.ts(20,15): error TS2332: 'this' cannot be r constructor() { super(this); // error ~~~~ -!!! error TS2332: 'this' cannot be referenced in current location. +!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. } } @@ -26,6 +29,6 @@ tests/cases/compiler/thisInSuperCall.ts(20,15): error TS2332: 'this' cannot be r constructor(public p) { super(this); // error ~~~~ -!!! error TS2332: 'this' cannot be referenced in current location. +!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. } } \ No newline at end of file diff --git a/tests/baselines/reference/thisInSuperCall.js b/tests/baselines/reference/thisInSuperCall.js index a867715957f..827d101c95a 100644 --- a/tests/baselines/reference/thisInSuperCall.js +++ b/tests/baselines/reference/thisInSuperCall.js @@ -5,7 +5,7 @@ class Base { class Foo extends Base { constructor() { - super(this); // no error + super(this); // error: "super" has to be called before "this" accessing } } @@ -36,7 +36,7 @@ var Base = (function () { var Foo = (function (_super) { __extends(Foo, _super); function Foo() { - _super.call(this, this); // no error + _super.call(this, this); // error: "super" has to be called before "this" accessing } return Foo; }(Base)); diff --git a/tests/baselines/reference/thisInSuperCall1.errors.txt b/tests/baselines/reference/thisInSuperCall1.errors.txt index 7efc66d1666..20bc502ab79 100644 --- a/tests/baselines/reference/thisInSuperCall1.errors.txt +++ b/tests/baselines/reference/thisInSuperCall1.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/thisInSuperCall1.ts(7,15): error TS2332: 'this' cannot be referenced in current location. +tests/cases/compiler/thisInSuperCall1.ts(7,15): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. ==== tests/cases/compiler/thisInSuperCall1.ts (1 errors) ==== @@ -10,7 +10,7 @@ tests/cases/compiler/thisInSuperCall1.ts(7,15): error TS2332: 'this' cannot be r constructor(public x: number) { super(this); ~~~~ -!!! error TS2332: 'this' cannot be referenced in current location. +!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. } } \ No newline at end of file diff --git a/tests/baselines/reference/thisInSuperCall2.errors.txt b/tests/baselines/reference/thisInSuperCall2.errors.txt index d3a94f79487..4e4e9b50a8e 100644 --- a/tests/baselines/reference/thisInSuperCall2.errors.txt +++ b/tests/baselines/reference/thisInSuperCall2.errors.txt @@ -1,7 +1,8 @@ -tests/cases/compiler/thisInSuperCall2.ts(16,15): error TS2332: 'this' cannot be referenced in current location. +tests/cases/compiler/thisInSuperCall2.ts(8,15): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. +tests/cases/compiler/thisInSuperCall2.ts(16,15): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. -==== tests/cases/compiler/thisInSuperCall2.ts (1 errors) ==== +==== tests/cases/compiler/thisInSuperCall2.ts (2 errors) ==== class Base { constructor(a: any) {} } @@ -9,7 +10,9 @@ tests/cases/compiler/thisInSuperCall2.ts(16,15): error TS2332: 'this' cannot be class Foo extends Base { public x: number; constructor() { - super(this); // no error + super(this); // error: "super" has to be called before "this" accessing + ~~~~ +!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. } } @@ -19,7 +22,7 @@ tests/cases/compiler/thisInSuperCall2.ts(16,15): error TS2332: 'this' cannot be constructor() { super(this); // error ~~~~ -!!! error TS2332: 'this' cannot be referenced in current location. +!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. } } \ No newline at end of file diff --git a/tests/baselines/reference/thisInSuperCall2.js b/tests/baselines/reference/thisInSuperCall2.js index 82cae46b2d6..fdffdd27d6d 100644 --- a/tests/baselines/reference/thisInSuperCall2.js +++ b/tests/baselines/reference/thisInSuperCall2.js @@ -6,7 +6,7 @@ class Base { class Foo extends Base { public x: number; constructor() { - super(this); // no error + super(this); // error: "super" has to be called before "this" accessing } } @@ -33,7 +33,7 @@ var Base = (function () { var Foo = (function (_super) { __extends(Foo, _super); function Foo() { - _super.call(this, this); // no error + _super.call(this, this); // error: "super" has to be called before "this" accessing } return Foo; }(Base)); diff --git a/tests/baselines/reference/thisInSuperCall3.errors.txt b/tests/baselines/reference/thisInSuperCall3.errors.txt index df5c5f8b5a2..27a7dc8b25d 100644 --- a/tests/baselines/reference/thisInSuperCall3.errors.txt +++ b/tests/baselines/reference/thisInSuperCall3.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/thisInSuperCall3.ts(9,15): error TS2332: 'this' cannot be referenced in current location. +tests/cases/compiler/thisInSuperCall3.ts(9,15): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. ==== tests/cases/compiler/thisInSuperCall3.ts (1 errors) ==== @@ -12,7 +12,7 @@ tests/cases/compiler/thisInSuperCall3.ts(9,15): error TS2332: 'this' cannot be r constructor() { super(this); ~~~~ -!!! error TS2332: 'this' cannot be referenced in current location. +!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. } } \ No newline at end of file diff --git a/tests/baselines/reference/thisTypeAndConstraints.symbols b/tests/baselines/reference/thisTypeAndConstraints.symbols index 5f93df22c1a..777a19a95fd 100644 --- a/tests/baselines/reference/thisTypeAndConstraints.symbols +++ b/tests/baselines/reference/thisTypeAndConstraints.symbols @@ -3,7 +3,7 @@ class A { >A : Symbol(A, Decl(thisTypeAndConstraints.ts, 0, 0)) self() { ->self : Symbol(self, Decl(thisTypeAndConstraints.ts, 0, 9)) +>self : Symbol(A.self, Decl(thisTypeAndConstraints.ts, 0, 9)) return this; >this : Symbol(A, Decl(thisTypeAndConstraints.ts, 0, 0)) @@ -43,7 +43,7 @@ class B { >A : Symbol(A, Decl(thisTypeAndConstraints.ts, 0, 0)) foo(x: T) { ->foo : Symbol(foo, Decl(thisTypeAndConstraints.ts, 13, 22)) +>foo : Symbol(B.foo, Decl(thisTypeAndConstraints.ts, 13, 22)) >x : Symbol(x, Decl(thisTypeAndConstraints.ts, 14, 8)) >T : Symbol(T, Decl(thisTypeAndConstraints.ts, 13, 8)) @@ -54,7 +54,7 @@ class B { >self : Symbol(A.self, Decl(thisTypeAndConstraints.ts, 0, 9)) } bar(x: U) { ->bar : Symbol(bar, Decl(thisTypeAndConstraints.ts, 16, 5)) +>bar : Symbol(B.bar, Decl(thisTypeAndConstraints.ts, 16, 5)) >U : Symbol(U, Decl(thisTypeAndConstraints.ts, 17, 8)) >T : Symbol(T, Decl(thisTypeAndConstraints.ts, 13, 8)) >x : Symbol(x, Decl(thisTypeAndConstraints.ts, 17, 21)) diff --git a/tests/baselines/reference/thisTypeAsConstraint.js b/tests/baselines/reference/thisTypeAsConstraint.js new file mode 100644 index 00000000000..b5a7113549d --- /dev/null +++ b/tests/baselines/reference/thisTypeAsConstraint.js @@ -0,0 +1,14 @@ +//// [thisTypeAsConstraint.ts] +class C { + public m() { + } +} + +//// [thisTypeAsConstraint.js] +var C = (function () { + function C() { + } + C.prototype.m = function () { + }; + return C; +}()); diff --git a/tests/baselines/reference/thisTypeAsConstraint.symbols b/tests/baselines/reference/thisTypeAsConstraint.symbols new file mode 100644 index 00000000000..ae1407bd253 --- /dev/null +++ b/tests/baselines/reference/thisTypeAsConstraint.symbols @@ -0,0 +1,9 @@ +=== tests/cases/compiler/thisTypeAsConstraint.ts === +class C { +>C : Symbol(C, Decl(thisTypeAsConstraint.ts, 0, 0)) + + public m() { +>m : Symbol(C.m, Decl(thisTypeAsConstraint.ts, 0, 9)) +>T : Symbol(T, Decl(thisTypeAsConstraint.ts, 1, 11)) + } +} diff --git a/tests/baselines/reference/thisTypeAsConstraint.types b/tests/baselines/reference/thisTypeAsConstraint.types new file mode 100644 index 00000000000..e55fb1f0cca --- /dev/null +++ b/tests/baselines/reference/thisTypeAsConstraint.types @@ -0,0 +1,9 @@ +=== tests/cases/compiler/thisTypeAsConstraint.ts === +class C { +>C : C + + public m() { +>m : () => void +>T : T + } +} diff --git a/tests/baselines/reference/thisTypeInAccessors.js b/tests/baselines/reference/thisTypeInAccessors.js new file mode 100644 index 00000000000..ed339d0366a --- /dev/null +++ b/tests/baselines/reference/thisTypeInAccessors.js @@ -0,0 +1,83 @@ +//// [thisTypeInAccessors.ts] +interface Foo { + n: number; + x: number; +} + +const explicit = { + n: 12, + get x(this: Foo): number { return this.n; }, + set x(this: Foo, n: number) { this.n = n; } +} +const copiedFromGetter = { + n: 14, + get x(this: Foo): number { return this.n; }, + set x(n) { this.n = n; } +} +const copiedFromSetter = { + n: 15, + get x() { return this.n }, + set x(this: Foo, n: number) { this.n = n; } +} +const copiedFromGetterUnannotated = { + n: 16, + get x(this: Foo) { return this.n }, + set x(this, n) { this.n = n; } +} + +class Explicit { + n = 17; + get x(this: Foo): number { return this.n; } + set x(this: Foo, n: number) { this.n = n; } +} +class Contextual { + n = 21; + get x() { return this.n } // inside a class, so already correct +} + + +//// [thisTypeInAccessors.js] +var explicit = { + n: 12, + get x() { return this.n; }, + set x(n) { this.n = n; } +}; +var copiedFromGetter = { + n: 14, + get x() { return this.n; }, + set x(n) { this.n = n; } +}; +var copiedFromSetter = { + n: 15, + get x() { return this.n; }, + set x(n) { this.n = n; } +}; +var copiedFromGetterUnannotated = { + n: 16, + get x() { return this.n; }, + set x(n) { this.n = n; } +}; +var Explicit = (function () { + function Explicit() { + this.n = 17; + } + Object.defineProperty(Explicit.prototype, "x", { + get: function () { return this.n; }, + set: function (n) { this.n = n; }, + enumerable: true, + configurable: true + }); + return Explicit; +}()); +var Contextual = (function () { + function Contextual() { + this.n = 21; + } + Object.defineProperty(Contextual.prototype, "x", { + get: function () { return this.n; } // inside a class, so already correct + , + enumerable: true, + configurable: true + }); + return Contextual; +}()); diff --git a/tests/baselines/reference/thisTypeInAccessors.symbols b/tests/baselines/reference/thisTypeInAccessors.symbols new file mode 100644 index 00000000000..ef2201d3808 --- /dev/null +++ b/tests/baselines/reference/thisTypeInAccessors.symbols @@ -0,0 +1,140 @@ +=== tests/cases/conformance/types/thisType/thisTypeInAccessors.ts === +interface Foo { +>Foo : Symbol(Foo, Decl(thisTypeInAccessors.ts, 0, 0)) + + n: number; +>n : Symbol(Foo.n, Decl(thisTypeInAccessors.ts, 0, 15)) + + x: number; +>x : Symbol(Foo.x, Decl(thisTypeInAccessors.ts, 1, 14)) +} + +const explicit = { +>explicit : Symbol(explicit, Decl(thisTypeInAccessors.ts, 5, 5)) + + n: 12, +>n : Symbol(n, Decl(thisTypeInAccessors.ts, 5, 18)) + + get x(this: Foo): number { return this.n; }, +>x : Symbol(x, Decl(thisTypeInAccessors.ts, 6, 10), Decl(thisTypeInAccessors.ts, 7, 48)) +>this : Symbol(this, Decl(thisTypeInAccessors.ts, 7, 10)) +>Foo : Symbol(Foo, Decl(thisTypeInAccessors.ts, 0, 0)) +>this.n : Symbol(Foo.n, Decl(thisTypeInAccessors.ts, 0, 15)) +>this : Symbol(Foo, Decl(thisTypeInAccessors.ts, 0, 0)) +>n : Symbol(Foo.n, Decl(thisTypeInAccessors.ts, 0, 15)) + + set x(this: Foo, n: number) { this.n = n; } +>x : Symbol(x, Decl(thisTypeInAccessors.ts, 6, 10), Decl(thisTypeInAccessors.ts, 7, 48)) +>this : Symbol(this, Decl(thisTypeInAccessors.ts, 8, 10)) +>Foo : Symbol(Foo, Decl(thisTypeInAccessors.ts, 0, 0)) +>n : Symbol(n, Decl(thisTypeInAccessors.ts, 8, 20)) +>this.n : Symbol(Foo.n, Decl(thisTypeInAccessors.ts, 0, 15)) +>this : Symbol(Foo, Decl(thisTypeInAccessors.ts, 0, 0)) +>n : Symbol(Foo.n, Decl(thisTypeInAccessors.ts, 0, 15)) +>n : Symbol(n, Decl(thisTypeInAccessors.ts, 8, 20)) +} +const copiedFromGetter = { +>copiedFromGetter : Symbol(copiedFromGetter, Decl(thisTypeInAccessors.ts, 10, 5)) + + n: 14, +>n : Symbol(n, Decl(thisTypeInAccessors.ts, 10, 26)) + + get x(this: Foo): number { return this.n; }, +>x : Symbol(x, Decl(thisTypeInAccessors.ts, 11, 10), Decl(thisTypeInAccessors.ts, 12, 48)) +>this : Symbol(this, Decl(thisTypeInAccessors.ts, 12, 10)) +>Foo : Symbol(Foo, Decl(thisTypeInAccessors.ts, 0, 0)) +>this.n : Symbol(Foo.n, Decl(thisTypeInAccessors.ts, 0, 15)) +>this : Symbol(Foo, Decl(thisTypeInAccessors.ts, 0, 0)) +>n : Symbol(Foo.n, Decl(thisTypeInAccessors.ts, 0, 15)) + + set x(n) { this.n = n; } +>x : Symbol(x, Decl(thisTypeInAccessors.ts, 11, 10), Decl(thisTypeInAccessors.ts, 12, 48)) +>n : Symbol(n, Decl(thisTypeInAccessors.ts, 13, 10)) +>this.n : Symbol(Foo.n, Decl(thisTypeInAccessors.ts, 0, 15)) +>this : Symbol(Foo, Decl(thisTypeInAccessors.ts, 0, 0)) +>n : Symbol(Foo.n, Decl(thisTypeInAccessors.ts, 0, 15)) +>n : Symbol(n, Decl(thisTypeInAccessors.ts, 13, 10)) +} +const copiedFromSetter = { +>copiedFromSetter : Symbol(copiedFromSetter, Decl(thisTypeInAccessors.ts, 15, 5)) + + n: 15, +>n : Symbol(n, Decl(thisTypeInAccessors.ts, 15, 26)) + + get x() { return this.n }, +>x : Symbol(x, Decl(thisTypeInAccessors.ts, 16, 10), Decl(thisTypeInAccessors.ts, 17, 30)) +>this.n : Symbol(Foo.n, Decl(thisTypeInAccessors.ts, 0, 15)) +>this : Symbol(Foo, Decl(thisTypeInAccessors.ts, 0, 0)) +>n : Symbol(Foo.n, Decl(thisTypeInAccessors.ts, 0, 15)) + + set x(this: Foo, n: number) { this.n = n; } +>x : Symbol(x, Decl(thisTypeInAccessors.ts, 16, 10), Decl(thisTypeInAccessors.ts, 17, 30)) +>this : Symbol(this, Decl(thisTypeInAccessors.ts, 18, 10)) +>Foo : Symbol(Foo, Decl(thisTypeInAccessors.ts, 0, 0)) +>n : Symbol(n, Decl(thisTypeInAccessors.ts, 18, 20)) +>this.n : Symbol(Foo.n, Decl(thisTypeInAccessors.ts, 0, 15)) +>this : Symbol(Foo, Decl(thisTypeInAccessors.ts, 0, 0)) +>n : Symbol(Foo.n, Decl(thisTypeInAccessors.ts, 0, 15)) +>n : Symbol(n, Decl(thisTypeInAccessors.ts, 18, 20)) +} +const copiedFromGetterUnannotated = { +>copiedFromGetterUnannotated : Symbol(copiedFromGetterUnannotated, Decl(thisTypeInAccessors.ts, 20, 5)) + + n: 16, +>n : Symbol(n, Decl(thisTypeInAccessors.ts, 20, 37)) + + get x(this: Foo) { return this.n }, +>x : Symbol(x, Decl(thisTypeInAccessors.ts, 21, 10), Decl(thisTypeInAccessors.ts, 22, 39)) +>this : Symbol(this, Decl(thisTypeInAccessors.ts, 22, 10)) +>Foo : Symbol(Foo, Decl(thisTypeInAccessors.ts, 0, 0)) +>this.n : Symbol(Foo.n, Decl(thisTypeInAccessors.ts, 0, 15)) +>this : Symbol(Foo, Decl(thisTypeInAccessors.ts, 0, 0)) +>n : Symbol(Foo.n, Decl(thisTypeInAccessors.ts, 0, 15)) + + set x(this, n) { this.n = n; } +>x : Symbol(x, Decl(thisTypeInAccessors.ts, 21, 10), Decl(thisTypeInAccessors.ts, 22, 39)) +>this : Symbol(this, Decl(thisTypeInAccessors.ts, 23, 10)) +>n : Symbol(n, Decl(thisTypeInAccessors.ts, 23, 15)) +>this.n : Symbol(Foo.n, Decl(thisTypeInAccessors.ts, 0, 15)) +>this : Symbol(Foo, Decl(thisTypeInAccessors.ts, 0, 0)) +>n : Symbol(Foo.n, Decl(thisTypeInAccessors.ts, 0, 15)) +>n : Symbol(n, Decl(thisTypeInAccessors.ts, 23, 15)) +} + +class Explicit { +>Explicit : Symbol(Explicit, Decl(thisTypeInAccessors.ts, 24, 1)) + + n = 17; +>n : Symbol(Explicit.n, Decl(thisTypeInAccessors.ts, 26, 16)) + + get x(this: Foo): number { return this.n; } +>x : Symbol(Explicit.x, Decl(thisTypeInAccessors.ts, 27, 11), Decl(thisTypeInAccessors.ts, 28, 47)) +>this : Symbol(this, Decl(thisTypeInAccessors.ts, 28, 10)) +>Foo : Symbol(Foo, Decl(thisTypeInAccessors.ts, 0, 0)) +>this.n : Symbol(Foo.n, Decl(thisTypeInAccessors.ts, 0, 15)) +>this : Symbol(Foo, Decl(thisTypeInAccessors.ts, 0, 0)) +>n : Symbol(Foo.n, Decl(thisTypeInAccessors.ts, 0, 15)) + + set x(this: Foo, n: number) { this.n = n; } +>x : Symbol(Explicit.x, Decl(thisTypeInAccessors.ts, 27, 11), Decl(thisTypeInAccessors.ts, 28, 47)) +>this : Symbol(this, Decl(thisTypeInAccessors.ts, 29, 10)) +>Foo : Symbol(Foo, Decl(thisTypeInAccessors.ts, 0, 0)) +>n : Symbol(n, Decl(thisTypeInAccessors.ts, 29, 20)) +>this.n : Symbol(Foo.n, Decl(thisTypeInAccessors.ts, 0, 15)) +>this : Symbol(Foo, Decl(thisTypeInAccessors.ts, 0, 0)) +>n : Symbol(Foo.n, Decl(thisTypeInAccessors.ts, 0, 15)) +>n : Symbol(n, Decl(thisTypeInAccessors.ts, 29, 20)) +} +class Contextual { +>Contextual : Symbol(Contextual, Decl(thisTypeInAccessors.ts, 30, 1)) + + n = 21; +>n : Symbol(Contextual.n, Decl(thisTypeInAccessors.ts, 31, 18)) + + get x() { return this.n } // inside a class, so already correct +>x : Symbol(Contextual.x, Decl(thisTypeInAccessors.ts, 32, 11)) +>this.n : Symbol(Contextual.n, Decl(thisTypeInAccessors.ts, 31, 18)) +>this : Symbol(Contextual, Decl(thisTypeInAccessors.ts, 30, 1)) +>n : Symbol(Contextual.n, Decl(thisTypeInAccessors.ts, 31, 18)) +} + diff --git a/tests/baselines/reference/thisTypeInAccessors.types b/tests/baselines/reference/thisTypeInAccessors.types new file mode 100644 index 00000000000..998658c5d58 --- /dev/null +++ b/tests/baselines/reference/thisTypeInAccessors.types @@ -0,0 +1,155 @@ +=== tests/cases/conformance/types/thisType/thisTypeInAccessors.ts === +interface Foo { +>Foo : Foo + + n: number; +>n : number + + x: number; +>x : number +} + +const explicit = { +>explicit : { n: number; x: number; } +>{ n: 12, get x(this: Foo): number { return this.n; }, set x(this: Foo, n: number) { this.n = n; }} : { n: number; x: number; } + + n: 12, +>n : number +>12 : number + + get x(this: Foo): number { return this.n; }, +>x : number +>this : Foo +>Foo : Foo +>this.n : number +>this : Foo +>n : number + + set x(this: Foo, n: number) { this.n = n; } +>x : number +>this : Foo +>Foo : Foo +>n : number +>this.n = n : number +>this.n : number +>this : Foo +>n : number +>n : number +} +const copiedFromGetter = { +>copiedFromGetter : { n: number; x: number; } +>{ n: 14, get x(this: Foo): number { return this.n; }, set x(n) { this.n = n; }} : { n: number; x: number; } + + n: 14, +>n : number +>14 : number + + get x(this: Foo): number { return this.n; }, +>x : number +>this : Foo +>Foo : Foo +>this.n : number +>this : Foo +>n : number + + set x(n) { this.n = n; } +>x : number +>n : number +>this.n = n : number +>this.n : number +>this : Foo +>n : number +>n : number +} +const copiedFromSetter = { +>copiedFromSetter : { n: number; x: number; } +>{ n: 15, get x() { return this.n }, set x(this: Foo, n: number) { this.n = n; }} : { n: number; x: number; } + + n: 15, +>n : number +>15 : number + + get x() { return this.n }, +>x : number +>this.n : number +>this : Foo +>n : number + + set x(this: Foo, n: number) { this.n = n; } +>x : number +>this : Foo +>Foo : Foo +>n : number +>this.n = n : number +>this.n : number +>this : Foo +>n : number +>n : number +} +const copiedFromGetterUnannotated = { +>copiedFromGetterUnannotated : { n: number; x: number; } +>{ n: 16, get x(this: Foo) { return this.n }, set x(this, n) { this.n = n; }} : { n: number; x: number; } + + n: 16, +>n : number +>16 : number + + get x(this: Foo) { return this.n }, +>x : number +>this : Foo +>Foo : Foo +>this.n : number +>this : Foo +>n : number + + set x(this, n) { this.n = n; } +>x : number +>this : Foo +>n : number +>this.n = n : number +>this.n : number +>this : Foo +>n : number +>n : number +} + +class Explicit { +>Explicit : Explicit + + n = 17; +>n : number +>17 : number + + get x(this: Foo): number { return this.n; } +>x : number +>this : Foo +>Foo : Foo +>this.n : number +>this : Foo +>n : number + + set x(this: Foo, n: number) { this.n = n; } +>x : number +>this : Foo +>Foo : Foo +>n : number +>this.n = n : number +>this.n : number +>this : Foo +>n : number +>n : number +} +class Contextual { +>Contextual : Contextual + + n = 21; +>n : number +>21 : number + + get x() { return this.n } // inside a class, so already correct +>x : number +>this.n : number +>this : this +>n : number +} + diff --git a/tests/baselines/reference/thisTypeInAccessorsNegative.errors.txt b/tests/baselines/reference/thisTypeInAccessorsNegative.errors.txt new file mode 100644 index 00000000000..5396f1f4316 --- /dev/null +++ b/tests/baselines/reference/thisTypeInAccessorsNegative.errors.txt @@ -0,0 +1,30 @@ +tests/cases/conformance/types/thisType/thisTypeInAccessorsNegative.ts(10,9): error TS2682: 'get' and 'set' accessor must have the same 'this' type. +tests/cases/conformance/types/thisType/thisTypeInAccessorsNegative.ts(11,9): error TS2682: 'get' and 'set' accessor must have the same 'this' type. +tests/cases/conformance/types/thisType/thisTypeInAccessorsNegative.ts(16,22): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. + + +==== tests/cases/conformance/types/thisType/thisTypeInAccessorsNegative.ts (3 errors) ==== + interface Foo { + n: number; + x: number; + } + interface Bar { + wrong: "place" | "time" | "method" | "technique"; + } + const mismatch = { + n: 13, + get x(this: Foo) { return this.n; }, + ~ +!!! error TS2682: 'get' and 'set' accessor must have the same 'this' type. + set x(this: Bar, n) { this.wrong = "method"; } + ~ +!!! error TS2682: 'get' and 'set' accessor must have the same 'this' type. + } + const contextual: Foo = { + n: 16, + // there is no contextual this type from an Foo.x. + get x() { return this.n; } + ~~~~ +!!! error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. + } + \ No newline at end of file diff --git a/tests/baselines/reference/thisTypeInAccessorsNegative.js b/tests/baselines/reference/thisTypeInAccessorsNegative.js new file mode 100644 index 00000000000..4d0826232f4 --- /dev/null +++ b/tests/baselines/reference/thisTypeInAccessorsNegative.js @@ -0,0 +1,31 @@ +//// [thisTypeInAccessorsNegative.ts] +interface Foo { + n: number; + x: number; +} +interface Bar { + wrong: "place" | "time" | "method" | "technique"; +} +const mismatch = { + n: 13, + get x(this: Foo) { return this.n; }, + set x(this: Bar, n) { this.wrong = "method"; } +} +const contextual: Foo = { + n: 16, + // there is no contextual this type from an Foo.x. + get x() { return this.n; } +} + + +//// [thisTypeInAccessorsNegative.js] +var mismatch = { + n: 13, + get x() { return this.n; }, + set x(n) { this.wrong = "method"; } +}; +var contextual = { + n: 16, + // there is no contextual this type from an Foo.x. + get x() { return this.n; } +}; diff --git a/tests/baselines/reference/thisTypeInBasePropertyAndDerivedContainerOfBase01.js b/tests/baselines/reference/thisTypeInBasePropertyAndDerivedContainerOfBase01.js new file mode 100644 index 00000000000..51cc5a24bb6 --- /dev/null +++ b/tests/baselines/reference/thisTypeInBasePropertyAndDerivedContainerOfBase01.js @@ -0,0 +1,27 @@ +//// [thisTypeInBasePropertyAndDerivedContainerOfBase01.ts] + +interface BoxOfFoo { + item: T +} + +interface Foo { + self: this; +} + +interface Bar extends Foo { + other: BoxOfFoo; +} + +//// [thisTypeInBasePropertyAndDerivedContainerOfBase01.js] + + +//// [thisTypeInBasePropertyAndDerivedContainerOfBase01.d.ts] +interface BoxOfFoo { + item: T; +} +interface Foo { + self: this; +} +interface Bar extends Foo { + other: BoxOfFoo; +} diff --git a/tests/baselines/reference/thisTypeInBasePropertyAndDerivedContainerOfBase01.symbols b/tests/baselines/reference/thisTypeInBasePropertyAndDerivedContainerOfBase01.symbols new file mode 100644 index 00000000000..566bf3aa093 --- /dev/null +++ b/tests/baselines/reference/thisTypeInBasePropertyAndDerivedContainerOfBase01.symbols @@ -0,0 +1,27 @@ +=== tests/cases/conformance/types/thisType/thisTypeInBasePropertyAndDerivedContainerOfBase01.ts === + +interface BoxOfFoo { +>BoxOfFoo : Symbol(BoxOfFoo, Decl(thisTypeInBasePropertyAndDerivedContainerOfBase01.ts, 0, 0)) +>T : Symbol(T, Decl(thisTypeInBasePropertyAndDerivedContainerOfBase01.ts, 1, 19)) +>Foo : Symbol(Foo, Decl(thisTypeInBasePropertyAndDerivedContainerOfBase01.ts, 3, 1)) + + item: T +>item : Symbol(BoxOfFoo.item, Decl(thisTypeInBasePropertyAndDerivedContainerOfBase01.ts, 1, 35)) +>T : Symbol(T, Decl(thisTypeInBasePropertyAndDerivedContainerOfBase01.ts, 1, 19)) +} + +interface Foo { +>Foo : Symbol(Foo, Decl(thisTypeInBasePropertyAndDerivedContainerOfBase01.ts, 3, 1)) + + self: this; +>self : Symbol(Foo.self, Decl(thisTypeInBasePropertyAndDerivedContainerOfBase01.ts, 5, 15)) +} + +interface Bar extends Foo { +>Bar : Symbol(Bar, Decl(thisTypeInBasePropertyAndDerivedContainerOfBase01.ts, 7, 1)) +>Foo : Symbol(Foo, Decl(thisTypeInBasePropertyAndDerivedContainerOfBase01.ts, 3, 1)) + + other: BoxOfFoo; +>other : Symbol(Bar.other, Decl(thisTypeInBasePropertyAndDerivedContainerOfBase01.ts, 9, 27)) +>BoxOfFoo : Symbol(BoxOfFoo, Decl(thisTypeInBasePropertyAndDerivedContainerOfBase01.ts, 0, 0)) +} diff --git a/tests/baselines/reference/thisTypeInBasePropertyAndDerivedContainerOfBase01.types b/tests/baselines/reference/thisTypeInBasePropertyAndDerivedContainerOfBase01.types new file mode 100644 index 00000000000..9f6b83df057 --- /dev/null +++ b/tests/baselines/reference/thisTypeInBasePropertyAndDerivedContainerOfBase01.types @@ -0,0 +1,27 @@ +=== tests/cases/conformance/types/thisType/thisTypeInBasePropertyAndDerivedContainerOfBase01.ts === + +interface BoxOfFoo { +>BoxOfFoo : BoxOfFoo +>T : T +>Foo : Foo + + item: T +>item : T +>T : T +} + +interface Foo { +>Foo : Foo + + self: this; +>self : this +} + +interface Bar extends Foo { +>Bar : Bar +>Foo : Foo + + other: BoxOfFoo; +>other : BoxOfFoo +>BoxOfFoo : BoxOfFoo +} diff --git a/tests/baselines/reference/thisTypeInClasses.symbols b/tests/baselines/reference/thisTypeInClasses.symbols index 5ae45b923af..0f98f013b01 100644 --- a/tests/baselines/reference/thisTypeInClasses.symbols +++ b/tests/baselines/reference/thisTypeInClasses.symbols @@ -3,10 +3,10 @@ class C1 { >C1 : Symbol(C1, Decl(thisTypeInClasses.ts, 0, 0)) x: this; ->x : Symbol(x, Decl(thisTypeInClasses.ts, 0, 10)) +>x : Symbol(C1.x, Decl(thisTypeInClasses.ts, 0, 10)) f(x: this): this { return undefined; } ->f : Symbol(f, Decl(thisTypeInClasses.ts, 1, 12)) +>f : Symbol(C1.f, Decl(thisTypeInClasses.ts, 1, 12)) >x : Symbol(x, Decl(thisTypeInClasses.ts, 2, 6)) >undefined : Symbol(undefined) } @@ -23,51 +23,51 @@ interface Foo { >T : Symbol(T, Decl(thisTypeInClasses.ts, 9, 14)) x: T; ->x : Symbol(x, Decl(thisTypeInClasses.ts, 9, 18)) +>x : Symbol(Foo.x, Decl(thisTypeInClasses.ts, 9, 18)) >T : Symbol(T, Decl(thisTypeInClasses.ts, 9, 14)) y: this; ->y : Symbol(y, Decl(thisTypeInClasses.ts, 10, 9)) +>y : Symbol(Foo.y, Decl(thisTypeInClasses.ts, 10, 9)) } class C3 { >C3 : Symbol(C3, Decl(thisTypeInClasses.ts, 12, 1)) a: this[]; ->a : Symbol(a, Decl(thisTypeInClasses.ts, 14, 10)) +>a : Symbol(C3.a, Decl(thisTypeInClasses.ts, 14, 10)) b: [this, this]; ->b : Symbol(b, Decl(thisTypeInClasses.ts, 15, 14)) +>b : Symbol(C3.b, Decl(thisTypeInClasses.ts, 15, 14)) c: this | Date; ->c : Symbol(c, Decl(thisTypeInClasses.ts, 16, 20)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>c : Symbol(C3.c, Decl(thisTypeInClasses.ts, 16, 20)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) d: this & Date; ->d : Symbol(d, Decl(thisTypeInClasses.ts, 17, 19)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>d : Symbol(C3.d, Decl(thisTypeInClasses.ts, 17, 19)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) e: (((this))); ->e : Symbol(e, Decl(thisTypeInClasses.ts, 18, 19)) +>e : Symbol(C3.e, Decl(thisTypeInClasses.ts, 18, 19)) f: (x: this) => this; ->f : Symbol(f, Decl(thisTypeInClasses.ts, 19, 18)) +>f : Symbol(C3.f, Decl(thisTypeInClasses.ts, 19, 18)) >x : Symbol(x, Decl(thisTypeInClasses.ts, 20, 8)) g: new (x: this) => this; ->g : Symbol(g, Decl(thisTypeInClasses.ts, 20, 25)) +>g : Symbol(C3.g, Decl(thisTypeInClasses.ts, 20, 25)) >x : Symbol(x, Decl(thisTypeInClasses.ts, 21, 12)) h: Foo; ->h : Symbol(h, Decl(thisTypeInClasses.ts, 21, 29)) +>h : Symbol(C3.h, Decl(thisTypeInClasses.ts, 21, 29)) >Foo : Symbol(Foo, Decl(thisTypeInClasses.ts, 7, 1)) i: Foo this)>; ->i : Symbol(i, Decl(thisTypeInClasses.ts, 22, 17)) +>i : Symbol(C3.i, Decl(thisTypeInClasses.ts, 22, 17)) >Foo : Symbol(Foo, Decl(thisTypeInClasses.ts, 7, 1)) j: (x: any) => x is this; ->j : Symbol(j, Decl(thisTypeInClasses.ts, 23, 32)) +>j : Symbol(C3.j, Decl(thisTypeInClasses.ts, 23, 32)) >x : Symbol(x, Decl(thisTypeInClasses.ts, 24, 8)) >x : Symbol(x, Decl(thisTypeInClasses.ts, 24, 8)) } @@ -76,10 +76,10 @@ declare class C4 { >C4 : Symbol(C4, Decl(thisTypeInClasses.ts, 25, 1)) x: this; ->x : Symbol(x, Decl(thisTypeInClasses.ts, 27, 18)) +>x : Symbol(C4.x, Decl(thisTypeInClasses.ts, 27, 18)) f(x: this): this; ->f : Symbol(f, Decl(thisTypeInClasses.ts, 28, 12)) +>f : Symbol(C4.f, Decl(thisTypeInClasses.ts, 28, 12)) >x : Symbol(x, Decl(thisTypeInClasses.ts, 29, 6)) } @@ -87,7 +87,7 @@ class C5 { >C5 : Symbol(C5, Decl(thisTypeInClasses.ts, 30, 1)) foo() { ->foo : Symbol(foo, Decl(thisTypeInClasses.ts, 32, 10)) +>foo : Symbol(C5.foo, Decl(thisTypeInClasses.ts, 32, 10)) let f1 = (x: this): this => this; >f1 : Symbol(f1, Decl(thisTypeInClasses.ts, 34, 11)) @@ -122,7 +122,7 @@ class C5 { } } bar() { ->bar : Symbol(bar, Decl(thisTypeInClasses.ts, 43, 5)) +>bar : Symbol(C5.bar, Decl(thisTypeInClasses.ts, 43, 5)) let x1 = undefined; >x1 : Symbol(x1, Decl(thisTypeInClasses.ts, 45, 11)) diff --git a/tests/baselines/reference/thisTypeInFunctions.js b/tests/baselines/reference/thisTypeInFunctions.js new file mode 100644 index 00000000000..cfe1706ae99 --- /dev/null +++ b/tests/baselines/reference/thisTypeInFunctions.js @@ -0,0 +1,382 @@ +//// [thisTypeInFunctions.ts] +// body checking +class B { + n: number; +} +class C { + n: number; + explicitThis(this: this, m: number): number { + return this.n + m; + } + explicitC(this: C, m: number): number { + return this.n + m; + } + explicitProperty(this: {n: number}, m: number): number { + return this.n + m; + } + explicitVoid(this: void, m: number): number { + return m + 1; + } +} +class D extends C { } +interface I { + a: number; + explicitVoid1(this: void): number; + explicitVoid2(this: void): number; + explicitStructural(this: {a: number}): number; + explicitInterface(this: I): number; + explicitThis(this: this): number; +} +function explicitStructural(this: { y: number }, x: number): number { + return x + this.y; +} +function justThis(this: { y: number }): number { + return this.y; +} +function implicitThis(n: number): number { + return this.m + n + 12; +} +let impl: I = { + a: 12, + explicitVoid2: () => this.a, // ok, this: any because it refers to some outer object (window?) + explicitVoid1() { return 12; }, + explicitStructural() { + return this.a; + }, + explicitInterface() { + return this.a; + }, + explicitThis() { + return this.a; + }, +} +impl.explicitVoid1 = function () { return 12; }; +impl.explicitVoid2 = () => 12; +impl.explicitStructural = function() { return this.a; }; +impl.explicitInterface = function() { return this.a; }; +impl.explicitStructural = () => 12; +impl.explicitInterface = () => 12; +impl.explicitThis = function () { return this.a; }; +// parameter checking +let ok: {y: number, f: (this: { y: number }, x: number) => number} = { y: 12, f: explicitStructural }; +let implicitAnyOk: {notSpecified: number, f: (x: number) => number} = { notSpecified: 12, f: implicitThis }; +ok.f(13); +implicitThis(12); +implicitAnyOk.f(12); + +let c = new C(); +let d = new D(); +let ripped = c.explicitC; +c.explicitC(12); +c.explicitProperty(12); +c.explicitThis(12); +d.explicitC(12); +d.explicitProperty(12); +d.explicitThis(12); +let reconstructed: { + n: number, + explicitThis(this: C, m: number): number, // note: this: this is not allowed in an object literal type. + explicitC(this: C, m: number): number, + explicitProperty: (this: {n : number}, m: number) => number, + explicitVoid(this: void, m: number): number, +} = { + n: 12, + explicitThis: c.explicitThis, + explicitC: c.explicitC, + explicitProperty: c.explicitProperty, + explicitVoid: c.explicitVoid +}; +reconstructed.explicitThis(10); +reconstructed.explicitProperty(11); +let explicitVoid = reconstructed.explicitVoid; +explicitVoid(12); +// assignment checking +let unboundToSpecified: (this: { y: number }, x: number) => number = x => x + this.y; // ok, this:any +let specifiedToSpecified: (this: {y: number}, x: number) => number = explicitStructural; +let anyToSpecified: (this: { y: number }, x: number) => number = function(x: number): number { return x + 12; }; + +let unspecifiedLambda: (x: number) => number = x => x + 12; +let specifiedLambda: (this: void, x: number) => number = x => x + 12; +let unspecifiedLambdaToSpecified: (this: {y: number}, x: number) => number = unspecifiedLambda; +let specifiedLambdaToSpecified: (this: {y: number}, x: number) => number = specifiedLambda; + + +let explicitCFunction: (this: C, m: number) => number; +let explicitPropertyFunction: (this: {n: number}, m: number) => number; +c.explicitC = explicitCFunction; +c.explicitC = function(this: C, m: number) { return this.n + m }; +c.explicitProperty = explicitPropertyFunction; +c.explicitProperty = function(this: {n: number}, m: number) { return this.n + m }; +c.explicitProperty = reconstructed.explicitProperty; + +// lambdas are assignable to anything +c.explicitC = m => m; +c.explicitThis = m => m; +c.explicitProperty = m => m; + +// this inside lambdas refer to outer scope +// the outer-scoped lambda at top-level is still just `any` +c.explicitC = m => m + this.n; +c.explicitThis = m => m + this.n; +c.explicitProperty = m => m + this.n; + +//NOTE: this=C here, I guess? +c.explicitThis = explicitCFunction; +c.explicitThis = function(this: C, m: number) { return this.n + m }; + +// this:any compatibility +c.explicitC = function(m) { return this.n + m }; +c.explicitProperty = function(m) { return this.n + m }; +c.explicitThis = function(m) { return this.n + m }; + +// this: contextual typing +c.explicitThis = function(this, m) { return this.n + m }; + +// this: superclass compatibility +c.explicitC = function(this: B, m: number) { return this.n + m }; + +// this:void compatibility +c.explicitVoid = n => n; + +// class-based assignability +class Base1 { + x: number; + public polymorphic(this: this): number { return this.x; } + explicit(this: Base1): number { return this.x; } + static explicitStatic(this: typeof Base1): number { return this.y; } + static y: number; +} +class Derived1 extends Base1 { + y: number +} +class Base2 { + y: number + polymorphic(this: this): number { return this.y; } + explicit(this: Base1): number { return this.x; } +} +class Derived2 extends Base2 { + x: number +} +let b1 = new Base1(); +let b2 = new Base2(); +let d1 = new Derived1(); +let d2 = new Derived2(); +d2.polymorphic = d1.polymorphic // ok, 'x' and 'y' in { x, y } +d1.polymorphic = d2.polymorphic // ok, 'x' and 'y' in { x, y } + +// bivariance-allowed cases +d1.polymorphic = b2.polymorphic // ok, 'y' in D: { x, y } +d2.polymorphic = d1.explicit // ok, 'y' in { x, y } +b1.polymorphic = d2.polymorphic // ok, 'x' and 'y' not in Base1: { x } +b1.explicit = d2.polymorphic // ok, 'x' and 'y' not in Base1: { x } + +////// use this-type for construction with new //// +function InterfaceThis(this: I) { + this.a = 12; +} +function LiteralTypeThis(this: {x: string}) { + this.x = "ok"; +} +function AnyThis(this: any) { + this.x = "ok"; +} +let interfaceThis = new InterfaceThis(); +let literalTypeThis = new LiteralTypeThis(); +let anyThis = new AnyThis(); + +//// type parameter inference //// +declare var f: { + (this: void, x: number): number, + call(this: (...argArray: any[]) => U, ...argArray: any[]): U; +}; +let n: number = f.call(12); + +function missingTypeIsImplicitAny(this, a: number) { return this.anything + a; } + + +//// [thisTypeInFunctions.js] +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var _this = this; +// body checking +var B = (function () { + function B() { + } + return B; +}()); +var C = (function () { + function C() { + } + C.prototype.explicitThis = function (m) { + return this.n + m; + }; + C.prototype.explicitC = function (m) { + return this.n + m; + }; + C.prototype.explicitProperty = function (m) { + return this.n + m; + }; + C.prototype.explicitVoid = function (m) { + return m + 1; + }; + return C; +}()); +var D = (function (_super) { + __extends(D, _super); + function D() { + _super.apply(this, arguments); + } + return D; +}(C)); +function explicitStructural(x) { + return x + this.y; +} +function justThis() { + return this.y; +} +function implicitThis(n) { + return this.m + n + 12; +} +var impl = { + a: 12, + explicitVoid2: function () { return _this.a; }, + explicitVoid1: function () { return 12; }, + explicitStructural: function () { + return this.a; + }, + explicitInterface: function () { + return this.a; + }, + explicitThis: function () { + return this.a; + } +}; +impl.explicitVoid1 = function () { return 12; }; +impl.explicitVoid2 = function () { return 12; }; +impl.explicitStructural = function () { return this.a; }; +impl.explicitInterface = function () { return this.a; }; +impl.explicitStructural = function () { return 12; }; +impl.explicitInterface = function () { return 12; }; +impl.explicitThis = function () { return this.a; }; +// parameter checking +var ok = { y: 12, f: explicitStructural }; +var implicitAnyOk = { notSpecified: 12, f: implicitThis }; +ok.f(13); +implicitThis(12); +implicitAnyOk.f(12); +var c = new C(); +var d = new D(); +var ripped = c.explicitC; +c.explicitC(12); +c.explicitProperty(12); +c.explicitThis(12); +d.explicitC(12); +d.explicitProperty(12); +d.explicitThis(12); +var reconstructed = { + n: 12, + explicitThis: c.explicitThis, + explicitC: c.explicitC, + explicitProperty: c.explicitProperty, + explicitVoid: c.explicitVoid +}; +reconstructed.explicitThis(10); +reconstructed.explicitProperty(11); +var explicitVoid = reconstructed.explicitVoid; +explicitVoid(12); +// assignment checking +var unboundToSpecified = function (x) { return x + _this.y; }; // ok, this:any +var specifiedToSpecified = explicitStructural; +var anyToSpecified = function (x) { return x + 12; }; +var unspecifiedLambda = function (x) { return x + 12; }; +var specifiedLambda = function (x) { return x + 12; }; +var unspecifiedLambdaToSpecified = unspecifiedLambda; +var specifiedLambdaToSpecified = specifiedLambda; +var explicitCFunction; +var explicitPropertyFunction; +c.explicitC = explicitCFunction; +c.explicitC = function (m) { return this.n + m; }; +c.explicitProperty = explicitPropertyFunction; +c.explicitProperty = function (m) { return this.n + m; }; +c.explicitProperty = reconstructed.explicitProperty; +// lambdas are assignable to anything +c.explicitC = function (m) { return m; }; +c.explicitThis = function (m) { return m; }; +c.explicitProperty = function (m) { return m; }; +// this inside lambdas refer to outer scope +// the outer-scoped lambda at top-level is still just `any` +c.explicitC = function (m) { return m + _this.n; }; +c.explicitThis = function (m) { return m + _this.n; }; +c.explicitProperty = function (m) { return m + _this.n; }; +//NOTE: this=C here, I guess? +c.explicitThis = explicitCFunction; +c.explicitThis = function (m) { return this.n + m; }; +// this:any compatibility +c.explicitC = function (m) { return this.n + m; }; +c.explicitProperty = function (m) { return this.n + m; }; +c.explicitThis = function (m) { return this.n + m; }; +// this: contextual typing +c.explicitThis = function (m) { return this.n + m; }; +// this: superclass compatibility +c.explicitC = function (m) { return this.n + m; }; +// this:void compatibility +c.explicitVoid = function (n) { return n; }; +// class-based assignability +var Base1 = (function () { + function Base1() { + } + Base1.prototype.polymorphic = function () { return this.x; }; + Base1.prototype.explicit = function () { return this.x; }; + Base1.explicitStatic = function () { return this.y; }; + return Base1; +}()); +var Derived1 = (function (_super) { + __extends(Derived1, _super); + function Derived1() { + _super.apply(this, arguments); + } + return Derived1; +}(Base1)); +var Base2 = (function () { + function Base2() { + } + Base2.prototype.polymorphic = function () { return this.y; }; + Base2.prototype.explicit = function () { return this.x; }; + return Base2; +}()); +var Derived2 = (function (_super) { + __extends(Derived2, _super); + function Derived2() { + _super.apply(this, arguments); + } + return Derived2; +}(Base2)); +var b1 = new Base1(); +var b2 = new Base2(); +var d1 = new Derived1(); +var d2 = new Derived2(); +d2.polymorphic = d1.polymorphic; // ok, 'x' and 'y' in { x, y } +d1.polymorphic = d2.polymorphic; // ok, 'x' and 'y' in { x, y } +// bivariance-allowed cases +d1.polymorphic = b2.polymorphic; // ok, 'y' in D: { x, y } +d2.polymorphic = d1.explicit; // ok, 'y' in { x, y } +b1.polymorphic = d2.polymorphic; // ok, 'x' and 'y' not in Base1: { x } +b1.explicit = d2.polymorphic; // ok, 'x' and 'y' not in Base1: { x } +////// use this-type for construction with new //// +function InterfaceThis() { + this.a = 12; +} +function LiteralTypeThis() { + this.x = "ok"; +} +function AnyThis() { + this.x = "ok"; +} +var interfaceThis = new InterfaceThis(); +var literalTypeThis = new LiteralTypeThis(); +var anyThis = new AnyThis(); +var n = f.call(12); +function missingTypeIsImplicitAny(a) { return this.anything + a; } diff --git a/tests/baselines/reference/thisTypeInFunctions.symbols b/tests/baselines/reference/thisTypeInFunctions.symbols new file mode 100644 index 00000000000..3d4c3f6ecc7 --- /dev/null +++ b/tests/baselines/reference/thisTypeInFunctions.symbols @@ -0,0 +1,797 @@ +=== tests/cases/conformance/types/thisType/thisTypeInFunctions.ts === +// body checking +class B { +>B : Symbol(B, Decl(thisTypeInFunctions.ts, 0, 0)) + + n: number; +>n : Symbol(B.n, Decl(thisTypeInFunctions.ts, 1, 9)) +} +class C { +>C : Symbol(C, Decl(thisTypeInFunctions.ts, 3, 1)) + + n: number; +>n : Symbol(C.n, Decl(thisTypeInFunctions.ts, 4, 9)) + + explicitThis(this: this, m: number): number { +>explicitThis : Symbol(C.explicitThis, Decl(thisTypeInFunctions.ts, 5, 14)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 6, 17)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 6, 28)) + + return this.n + m; +>this.n : Symbol(C.n, Decl(thisTypeInFunctions.ts, 4, 9)) +>this : Symbol(C, Decl(thisTypeInFunctions.ts, 3, 1)) +>n : Symbol(C.n, Decl(thisTypeInFunctions.ts, 4, 9)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 6, 28)) + } + explicitC(this: C, m: number): number { +>explicitC : Symbol(C.explicitC, Decl(thisTypeInFunctions.ts, 8, 5)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 9, 14)) +>C : Symbol(C, Decl(thisTypeInFunctions.ts, 3, 1)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 9, 22)) + + return this.n + m; +>this.n : Symbol(C.n, Decl(thisTypeInFunctions.ts, 4, 9)) +>this : Symbol(C, Decl(thisTypeInFunctions.ts, 3, 1)) +>n : Symbol(C.n, Decl(thisTypeInFunctions.ts, 4, 9)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 9, 22)) + } + explicitProperty(this: {n: number}, m: number): number { +>explicitProperty : Symbol(C.explicitProperty, Decl(thisTypeInFunctions.ts, 11, 5)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 12, 21)) +>n : Symbol(n, Decl(thisTypeInFunctions.ts, 12, 28)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 12, 39)) + + return this.n + m; +>this.n : Symbol(n, Decl(thisTypeInFunctions.ts, 12, 28)) +>this : Symbol(, Decl(thisTypeInFunctions.ts, 12, 26)) +>n : Symbol(n, Decl(thisTypeInFunctions.ts, 12, 28)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 12, 39)) + } + explicitVoid(this: void, m: number): number { +>explicitVoid : Symbol(C.explicitVoid, Decl(thisTypeInFunctions.ts, 14, 5)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 15, 17)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 15, 28)) + + return m + 1; +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 15, 28)) + } +} +class D extends C { } +>D : Symbol(D, Decl(thisTypeInFunctions.ts, 18, 1)) +>C : Symbol(C, Decl(thisTypeInFunctions.ts, 3, 1)) + +interface I { +>I : Symbol(I, Decl(thisTypeInFunctions.ts, 19, 21)) + + a: number; +>a : Symbol(I.a, Decl(thisTypeInFunctions.ts, 20, 13)) + + explicitVoid1(this: void): number; +>explicitVoid1 : Symbol(I.explicitVoid1, Decl(thisTypeInFunctions.ts, 21, 14)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 22, 18)) + + explicitVoid2(this: void): number; +>explicitVoid2 : Symbol(I.explicitVoid2, Decl(thisTypeInFunctions.ts, 22, 38)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 23, 18)) + + explicitStructural(this: {a: number}): number; +>explicitStructural : Symbol(I.explicitStructural, Decl(thisTypeInFunctions.ts, 23, 38)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 24, 23)) +>a : Symbol(a, Decl(thisTypeInFunctions.ts, 24, 30)) + + explicitInterface(this: I): number; +>explicitInterface : Symbol(I.explicitInterface, Decl(thisTypeInFunctions.ts, 24, 50)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 25, 22)) +>I : Symbol(I, Decl(thisTypeInFunctions.ts, 19, 21)) + + explicitThis(this: this): number; +>explicitThis : Symbol(I.explicitThis, Decl(thisTypeInFunctions.ts, 25, 39)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 26, 17)) +} +function explicitStructural(this: { y: number }, x: number): number { +>explicitStructural : Symbol(explicitStructural, Decl(thisTypeInFunctions.ts, 27, 1)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 28, 28)) +>y : Symbol(y, Decl(thisTypeInFunctions.ts, 28, 35)) +>x : Symbol(x, Decl(thisTypeInFunctions.ts, 28, 48)) + + return x + this.y; +>x : Symbol(x, Decl(thisTypeInFunctions.ts, 28, 48)) +>this.y : Symbol(y, Decl(thisTypeInFunctions.ts, 28, 35)) +>this : Symbol(, Decl(thisTypeInFunctions.ts, 28, 33)) +>y : Symbol(y, Decl(thisTypeInFunctions.ts, 28, 35)) +} +function justThis(this: { y: number }): number { +>justThis : Symbol(justThis, Decl(thisTypeInFunctions.ts, 30, 1)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 31, 18)) +>y : Symbol(y, Decl(thisTypeInFunctions.ts, 31, 25)) + + return this.y; +>this.y : Symbol(y, Decl(thisTypeInFunctions.ts, 31, 25)) +>this : Symbol(, Decl(thisTypeInFunctions.ts, 31, 23)) +>y : Symbol(y, Decl(thisTypeInFunctions.ts, 31, 25)) +} +function implicitThis(n: number): number { +>implicitThis : Symbol(implicitThis, Decl(thisTypeInFunctions.ts, 33, 1)) +>n : Symbol(n, Decl(thisTypeInFunctions.ts, 34, 22)) + + return this.m + n + 12; +>n : Symbol(n, Decl(thisTypeInFunctions.ts, 34, 22)) +} +let impl: I = { +>impl : Symbol(impl, Decl(thisTypeInFunctions.ts, 37, 3)) +>I : Symbol(I, Decl(thisTypeInFunctions.ts, 19, 21)) + + a: 12, +>a : Symbol(a, Decl(thisTypeInFunctions.ts, 37, 15)) + + explicitVoid2: () => this.a, // ok, this: any because it refers to some outer object (window?) +>explicitVoid2 : Symbol(explicitVoid2, Decl(thisTypeInFunctions.ts, 38, 10)) + + explicitVoid1() { return 12; }, +>explicitVoid1 : Symbol(explicitVoid1, Decl(thisTypeInFunctions.ts, 39, 32)) + + explicitStructural() { +>explicitStructural : Symbol(explicitStructural, Decl(thisTypeInFunctions.ts, 40, 35)) + + return this.a; +>this.a : Symbol(a, Decl(thisTypeInFunctions.ts, 24, 30)) +>this : Symbol(, Decl(thisTypeInFunctions.ts, 24, 28)) +>a : Symbol(a, Decl(thisTypeInFunctions.ts, 24, 30)) + + }, + explicitInterface() { +>explicitInterface : Symbol(explicitInterface, Decl(thisTypeInFunctions.ts, 43, 6)) + + return this.a; +>this.a : Symbol(I.a, Decl(thisTypeInFunctions.ts, 20, 13)) +>this : Symbol(I, Decl(thisTypeInFunctions.ts, 19, 21)) +>a : Symbol(I.a, Decl(thisTypeInFunctions.ts, 20, 13)) + + }, + explicitThis() { +>explicitThis : Symbol(explicitThis, Decl(thisTypeInFunctions.ts, 46, 6)) + + return this.a; +>this.a : Symbol(I.a, Decl(thisTypeInFunctions.ts, 20, 13)) +>this : Symbol(I, Decl(thisTypeInFunctions.ts, 19, 21)) +>a : Symbol(I.a, Decl(thisTypeInFunctions.ts, 20, 13)) + + }, +} +impl.explicitVoid1 = function () { return 12; }; +>impl.explicitVoid1 : Symbol(I.explicitVoid1, Decl(thisTypeInFunctions.ts, 21, 14)) +>impl : Symbol(impl, Decl(thisTypeInFunctions.ts, 37, 3)) +>explicitVoid1 : Symbol(I.explicitVoid1, Decl(thisTypeInFunctions.ts, 21, 14)) + +impl.explicitVoid2 = () => 12; +>impl.explicitVoid2 : Symbol(I.explicitVoid2, Decl(thisTypeInFunctions.ts, 22, 38)) +>impl : Symbol(impl, Decl(thisTypeInFunctions.ts, 37, 3)) +>explicitVoid2 : Symbol(I.explicitVoid2, Decl(thisTypeInFunctions.ts, 22, 38)) + +impl.explicitStructural = function() { return this.a; }; +>impl.explicitStructural : Symbol(I.explicitStructural, Decl(thisTypeInFunctions.ts, 23, 38)) +>impl : Symbol(impl, Decl(thisTypeInFunctions.ts, 37, 3)) +>explicitStructural : Symbol(I.explicitStructural, Decl(thisTypeInFunctions.ts, 23, 38)) +>this.a : Symbol(a, Decl(thisTypeInFunctions.ts, 24, 30)) +>this : Symbol(, Decl(thisTypeInFunctions.ts, 24, 28)) +>a : Symbol(a, Decl(thisTypeInFunctions.ts, 24, 30)) + +impl.explicitInterface = function() { return this.a; }; +>impl.explicitInterface : Symbol(I.explicitInterface, Decl(thisTypeInFunctions.ts, 24, 50)) +>impl : Symbol(impl, Decl(thisTypeInFunctions.ts, 37, 3)) +>explicitInterface : Symbol(I.explicitInterface, Decl(thisTypeInFunctions.ts, 24, 50)) +>this.a : Symbol(I.a, Decl(thisTypeInFunctions.ts, 20, 13)) +>this : Symbol(I, Decl(thisTypeInFunctions.ts, 19, 21)) +>a : Symbol(I.a, Decl(thisTypeInFunctions.ts, 20, 13)) + +impl.explicitStructural = () => 12; +>impl.explicitStructural : Symbol(I.explicitStructural, Decl(thisTypeInFunctions.ts, 23, 38)) +>impl : Symbol(impl, Decl(thisTypeInFunctions.ts, 37, 3)) +>explicitStructural : Symbol(I.explicitStructural, Decl(thisTypeInFunctions.ts, 23, 38)) + +impl.explicitInterface = () => 12; +>impl.explicitInterface : Symbol(I.explicitInterface, Decl(thisTypeInFunctions.ts, 24, 50)) +>impl : Symbol(impl, Decl(thisTypeInFunctions.ts, 37, 3)) +>explicitInterface : Symbol(I.explicitInterface, Decl(thisTypeInFunctions.ts, 24, 50)) + +impl.explicitThis = function () { return this.a; }; +>impl.explicitThis : Symbol(I.explicitThis, Decl(thisTypeInFunctions.ts, 25, 39)) +>impl : Symbol(impl, Decl(thisTypeInFunctions.ts, 37, 3)) +>explicitThis : Symbol(I.explicitThis, Decl(thisTypeInFunctions.ts, 25, 39)) +>this.a : Symbol(I.a, Decl(thisTypeInFunctions.ts, 20, 13)) +>this : Symbol(I, Decl(thisTypeInFunctions.ts, 19, 21)) +>a : Symbol(I.a, Decl(thisTypeInFunctions.ts, 20, 13)) + +// parameter checking +let ok: {y: number, f: (this: { y: number }, x: number) => number} = { y: 12, f: explicitStructural }; +>ok : Symbol(ok, Decl(thisTypeInFunctions.ts, 59, 3)) +>y : Symbol(y, Decl(thisTypeInFunctions.ts, 59, 9)) +>f : Symbol(f, Decl(thisTypeInFunctions.ts, 59, 19)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 59, 24)) +>y : Symbol(y, Decl(thisTypeInFunctions.ts, 59, 31)) +>x : Symbol(x, Decl(thisTypeInFunctions.ts, 59, 44)) +>y : Symbol(y, Decl(thisTypeInFunctions.ts, 59, 70)) +>f : Symbol(f, Decl(thisTypeInFunctions.ts, 59, 77)) +>explicitStructural : Symbol(explicitStructural, Decl(thisTypeInFunctions.ts, 27, 1)) + +let implicitAnyOk: {notSpecified: number, f: (x: number) => number} = { notSpecified: 12, f: implicitThis }; +>implicitAnyOk : Symbol(implicitAnyOk, Decl(thisTypeInFunctions.ts, 60, 3)) +>notSpecified : Symbol(notSpecified, Decl(thisTypeInFunctions.ts, 60, 20)) +>f : Symbol(f, Decl(thisTypeInFunctions.ts, 60, 41)) +>x : Symbol(x, Decl(thisTypeInFunctions.ts, 60, 46)) +>notSpecified : Symbol(notSpecified, Decl(thisTypeInFunctions.ts, 60, 71)) +>f : Symbol(f, Decl(thisTypeInFunctions.ts, 60, 89)) +>implicitThis : Symbol(implicitThis, Decl(thisTypeInFunctions.ts, 33, 1)) + +ok.f(13); +>ok.f : Symbol(f, Decl(thisTypeInFunctions.ts, 59, 19)) +>ok : Symbol(ok, Decl(thisTypeInFunctions.ts, 59, 3)) +>f : Symbol(f, Decl(thisTypeInFunctions.ts, 59, 19)) + +implicitThis(12); +>implicitThis : Symbol(implicitThis, Decl(thisTypeInFunctions.ts, 33, 1)) + +implicitAnyOk.f(12); +>implicitAnyOk.f : Symbol(f, Decl(thisTypeInFunctions.ts, 60, 41)) +>implicitAnyOk : Symbol(implicitAnyOk, Decl(thisTypeInFunctions.ts, 60, 3)) +>f : Symbol(f, Decl(thisTypeInFunctions.ts, 60, 41)) + +let c = new C(); +>c : Symbol(c, Decl(thisTypeInFunctions.ts, 65, 3)) +>C : Symbol(C, Decl(thisTypeInFunctions.ts, 3, 1)) + +let d = new D(); +>d : Symbol(d, Decl(thisTypeInFunctions.ts, 66, 3)) +>D : Symbol(D, Decl(thisTypeInFunctions.ts, 18, 1)) + +let ripped = c.explicitC; +>ripped : Symbol(ripped, Decl(thisTypeInFunctions.ts, 67, 3)) +>c.explicitC : Symbol(C.explicitC, Decl(thisTypeInFunctions.ts, 8, 5)) +>c : Symbol(c, Decl(thisTypeInFunctions.ts, 65, 3)) +>explicitC : Symbol(C.explicitC, Decl(thisTypeInFunctions.ts, 8, 5)) + +c.explicitC(12); +>c.explicitC : Symbol(C.explicitC, Decl(thisTypeInFunctions.ts, 8, 5)) +>c : Symbol(c, Decl(thisTypeInFunctions.ts, 65, 3)) +>explicitC : Symbol(C.explicitC, Decl(thisTypeInFunctions.ts, 8, 5)) + +c.explicitProperty(12); +>c.explicitProperty : Symbol(C.explicitProperty, Decl(thisTypeInFunctions.ts, 11, 5)) +>c : Symbol(c, Decl(thisTypeInFunctions.ts, 65, 3)) +>explicitProperty : Symbol(C.explicitProperty, Decl(thisTypeInFunctions.ts, 11, 5)) + +c.explicitThis(12); +>c.explicitThis : Symbol(C.explicitThis, Decl(thisTypeInFunctions.ts, 5, 14)) +>c : Symbol(c, Decl(thisTypeInFunctions.ts, 65, 3)) +>explicitThis : Symbol(C.explicitThis, Decl(thisTypeInFunctions.ts, 5, 14)) + +d.explicitC(12); +>d.explicitC : Symbol(C.explicitC, Decl(thisTypeInFunctions.ts, 8, 5)) +>d : Symbol(d, Decl(thisTypeInFunctions.ts, 66, 3)) +>explicitC : Symbol(C.explicitC, Decl(thisTypeInFunctions.ts, 8, 5)) + +d.explicitProperty(12); +>d.explicitProperty : Symbol(C.explicitProperty, Decl(thisTypeInFunctions.ts, 11, 5)) +>d : Symbol(d, Decl(thisTypeInFunctions.ts, 66, 3)) +>explicitProperty : Symbol(C.explicitProperty, Decl(thisTypeInFunctions.ts, 11, 5)) + +d.explicitThis(12); +>d.explicitThis : Symbol(C.explicitThis, Decl(thisTypeInFunctions.ts, 5, 14)) +>d : Symbol(d, Decl(thisTypeInFunctions.ts, 66, 3)) +>explicitThis : Symbol(C.explicitThis, Decl(thisTypeInFunctions.ts, 5, 14)) + +let reconstructed: { +>reconstructed : Symbol(reconstructed, Decl(thisTypeInFunctions.ts, 74, 3)) + + n: number, +>n : Symbol(n, Decl(thisTypeInFunctions.ts, 74, 20)) + + explicitThis(this: C, m: number): number, // note: this: this is not allowed in an object literal type. +>explicitThis : Symbol(explicitThis, Decl(thisTypeInFunctions.ts, 75, 14)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 76, 17)) +>C : Symbol(C, Decl(thisTypeInFunctions.ts, 3, 1)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 76, 25)) + + explicitC(this: C, m: number): number, +>explicitC : Symbol(explicitC, Decl(thisTypeInFunctions.ts, 76, 45)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 77, 14)) +>C : Symbol(C, Decl(thisTypeInFunctions.ts, 3, 1)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 77, 22)) + + explicitProperty: (this: {n : number}, m: number) => number, +>explicitProperty : Symbol(explicitProperty, Decl(thisTypeInFunctions.ts, 77, 42)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 78, 23)) +>n : Symbol(n, Decl(thisTypeInFunctions.ts, 78, 30)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 78, 42)) + + explicitVoid(this: void, m: number): number, +>explicitVoid : Symbol(explicitVoid, Decl(thisTypeInFunctions.ts, 78, 64)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 79, 17)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 79, 28)) + +} = { + n: 12, +>n : Symbol(n, Decl(thisTypeInFunctions.ts, 80, 5)) + + explicitThis: c.explicitThis, +>explicitThis : Symbol(explicitThis, Decl(thisTypeInFunctions.ts, 81, 10)) +>c.explicitThis : Symbol(C.explicitThis, Decl(thisTypeInFunctions.ts, 5, 14)) +>c : Symbol(c, Decl(thisTypeInFunctions.ts, 65, 3)) +>explicitThis : Symbol(C.explicitThis, Decl(thisTypeInFunctions.ts, 5, 14)) + + explicitC: c.explicitC, +>explicitC : Symbol(explicitC, Decl(thisTypeInFunctions.ts, 82, 33)) +>c.explicitC : Symbol(C.explicitC, Decl(thisTypeInFunctions.ts, 8, 5)) +>c : Symbol(c, Decl(thisTypeInFunctions.ts, 65, 3)) +>explicitC : Symbol(C.explicitC, Decl(thisTypeInFunctions.ts, 8, 5)) + + explicitProperty: c.explicitProperty, +>explicitProperty : Symbol(explicitProperty, Decl(thisTypeInFunctions.ts, 83, 27)) +>c.explicitProperty : Symbol(C.explicitProperty, Decl(thisTypeInFunctions.ts, 11, 5)) +>c : Symbol(c, Decl(thisTypeInFunctions.ts, 65, 3)) +>explicitProperty : Symbol(C.explicitProperty, Decl(thisTypeInFunctions.ts, 11, 5)) + + explicitVoid: c.explicitVoid +>explicitVoid : Symbol(explicitVoid, Decl(thisTypeInFunctions.ts, 84, 41)) +>c.explicitVoid : Symbol(C.explicitVoid, Decl(thisTypeInFunctions.ts, 14, 5)) +>c : Symbol(c, Decl(thisTypeInFunctions.ts, 65, 3)) +>explicitVoid : Symbol(C.explicitVoid, Decl(thisTypeInFunctions.ts, 14, 5)) + +}; +reconstructed.explicitThis(10); +>reconstructed.explicitThis : Symbol(explicitThis, Decl(thisTypeInFunctions.ts, 75, 14)) +>reconstructed : Symbol(reconstructed, Decl(thisTypeInFunctions.ts, 74, 3)) +>explicitThis : Symbol(explicitThis, Decl(thisTypeInFunctions.ts, 75, 14)) + +reconstructed.explicitProperty(11); +>reconstructed.explicitProperty : Symbol(explicitProperty, Decl(thisTypeInFunctions.ts, 77, 42)) +>reconstructed : Symbol(reconstructed, Decl(thisTypeInFunctions.ts, 74, 3)) +>explicitProperty : Symbol(explicitProperty, Decl(thisTypeInFunctions.ts, 77, 42)) + +let explicitVoid = reconstructed.explicitVoid; +>explicitVoid : Symbol(explicitVoid, Decl(thisTypeInFunctions.ts, 89, 3)) +>reconstructed.explicitVoid : Symbol(explicitVoid, Decl(thisTypeInFunctions.ts, 78, 64)) +>reconstructed : Symbol(reconstructed, Decl(thisTypeInFunctions.ts, 74, 3)) +>explicitVoid : Symbol(explicitVoid, Decl(thisTypeInFunctions.ts, 78, 64)) + +explicitVoid(12); +>explicitVoid : Symbol(explicitVoid, Decl(thisTypeInFunctions.ts, 89, 3)) + +// assignment checking +let unboundToSpecified: (this: { y: number }, x: number) => number = x => x + this.y; // ok, this:any +>unboundToSpecified : Symbol(unboundToSpecified, Decl(thisTypeInFunctions.ts, 92, 3)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 92, 25)) +>y : Symbol(y, Decl(thisTypeInFunctions.ts, 92, 32)) +>x : Symbol(x, Decl(thisTypeInFunctions.ts, 92, 45)) +>x : Symbol(x, Decl(thisTypeInFunctions.ts, 92, 68)) +>x : Symbol(x, Decl(thisTypeInFunctions.ts, 92, 68)) + +let specifiedToSpecified: (this: {y: number}, x: number) => number = explicitStructural; +>specifiedToSpecified : Symbol(specifiedToSpecified, Decl(thisTypeInFunctions.ts, 93, 3)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 93, 27)) +>y : Symbol(y, Decl(thisTypeInFunctions.ts, 93, 34)) +>x : Symbol(x, Decl(thisTypeInFunctions.ts, 93, 45)) +>explicitStructural : Symbol(explicitStructural, Decl(thisTypeInFunctions.ts, 27, 1)) + +let anyToSpecified: (this: { y: number }, x: number) => number = function(x: number): number { return x + 12; }; +>anyToSpecified : Symbol(anyToSpecified, Decl(thisTypeInFunctions.ts, 94, 3)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 94, 21)) +>y : Symbol(y, Decl(thisTypeInFunctions.ts, 94, 28)) +>x : Symbol(x, Decl(thisTypeInFunctions.ts, 94, 41)) +>x : Symbol(x, Decl(thisTypeInFunctions.ts, 94, 74)) +>x : Symbol(x, Decl(thisTypeInFunctions.ts, 94, 74)) + +let unspecifiedLambda: (x: number) => number = x => x + 12; +>unspecifiedLambda : Symbol(unspecifiedLambda, Decl(thisTypeInFunctions.ts, 96, 3)) +>x : Symbol(x, Decl(thisTypeInFunctions.ts, 96, 24)) +>x : Symbol(x, Decl(thisTypeInFunctions.ts, 96, 46)) +>x : Symbol(x, Decl(thisTypeInFunctions.ts, 96, 46)) + +let specifiedLambda: (this: void, x: number) => number = x => x + 12; +>specifiedLambda : Symbol(specifiedLambda, Decl(thisTypeInFunctions.ts, 97, 3)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 97, 22)) +>x : Symbol(x, Decl(thisTypeInFunctions.ts, 97, 33)) +>x : Symbol(x, Decl(thisTypeInFunctions.ts, 97, 56)) +>x : Symbol(x, Decl(thisTypeInFunctions.ts, 97, 56)) + +let unspecifiedLambdaToSpecified: (this: {y: number}, x: number) => number = unspecifiedLambda; +>unspecifiedLambdaToSpecified : Symbol(unspecifiedLambdaToSpecified, Decl(thisTypeInFunctions.ts, 98, 3)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 98, 35)) +>y : Symbol(y, Decl(thisTypeInFunctions.ts, 98, 42)) +>x : Symbol(x, Decl(thisTypeInFunctions.ts, 98, 53)) +>unspecifiedLambda : Symbol(unspecifiedLambda, Decl(thisTypeInFunctions.ts, 96, 3)) + +let specifiedLambdaToSpecified: (this: {y: number}, x: number) => number = specifiedLambda; +>specifiedLambdaToSpecified : Symbol(specifiedLambdaToSpecified, Decl(thisTypeInFunctions.ts, 99, 3)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 99, 33)) +>y : Symbol(y, Decl(thisTypeInFunctions.ts, 99, 40)) +>x : Symbol(x, Decl(thisTypeInFunctions.ts, 99, 51)) +>specifiedLambda : Symbol(specifiedLambda, Decl(thisTypeInFunctions.ts, 97, 3)) + + +let explicitCFunction: (this: C, m: number) => number; +>explicitCFunction : Symbol(explicitCFunction, Decl(thisTypeInFunctions.ts, 102, 3)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 102, 24)) +>C : Symbol(C, Decl(thisTypeInFunctions.ts, 3, 1)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 102, 32)) + +let explicitPropertyFunction: (this: {n: number}, m: number) => number; +>explicitPropertyFunction : Symbol(explicitPropertyFunction, Decl(thisTypeInFunctions.ts, 103, 3)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 103, 31)) +>n : Symbol(n, Decl(thisTypeInFunctions.ts, 103, 38)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 103, 49)) + +c.explicitC = explicitCFunction; +>c.explicitC : Symbol(C.explicitC, Decl(thisTypeInFunctions.ts, 8, 5)) +>c : Symbol(c, Decl(thisTypeInFunctions.ts, 65, 3)) +>explicitC : Symbol(C.explicitC, Decl(thisTypeInFunctions.ts, 8, 5)) +>explicitCFunction : Symbol(explicitCFunction, Decl(thisTypeInFunctions.ts, 102, 3)) + +c.explicitC = function(this: C, m: number) { return this.n + m }; +>c.explicitC : Symbol(C.explicitC, Decl(thisTypeInFunctions.ts, 8, 5)) +>c : Symbol(c, Decl(thisTypeInFunctions.ts, 65, 3)) +>explicitC : Symbol(C.explicitC, Decl(thisTypeInFunctions.ts, 8, 5)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 105, 23)) +>C : Symbol(C, Decl(thisTypeInFunctions.ts, 3, 1)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 105, 31)) +>this.n : Symbol(C.n, Decl(thisTypeInFunctions.ts, 4, 9)) +>this : Symbol(C, Decl(thisTypeInFunctions.ts, 3, 1)) +>n : Symbol(C.n, Decl(thisTypeInFunctions.ts, 4, 9)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 105, 31)) + +c.explicitProperty = explicitPropertyFunction; +>c.explicitProperty : Symbol(C.explicitProperty, Decl(thisTypeInFunctions.ts, 11, 5)) +>c : Symbol(c, Decl(thisTypeInFunctions.ts, 65, 3)) +>explicitProperty : Symbol(C.explicitProperty, Decl(thisTypeInFunctions.ts, 11, 5)) +>explicitPropertyFunction : Symbol(explicitPropertyFunction, Decl(thisTypeInFunctions.ts, 103, 3)) + +c.explicitProperty = function(this: {n: number}, m: number) { return this.n + m }; +>c.explicitProperty : Symbol(C.explicitProperty, Decl(thisTypeInFunctions.ts, 11, 5)) +>c : Symbol(c, Decl(thisTypeInFunctions.ts, 65, 3)) +>explicitProperty : Symbol(C.explicitProperty, Decl(thisTypeInFunctions.ts, 11, 5)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 107, 30)) +>n : Symbol(n, Decl(thisTypeInFunctions.ts, 107, 37)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 107, 48)) +>this.n : Symbol(n, Decl(thisTypeInFunctions.ts, 107, 37)) +>this : Symbol(, Decl(thisTypeInFunctions.ts, 107, 35)) +>n : Symbol(n, Decl(thisTypeInFunctions.ts, 107, 37)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 107, 48)) + +c.explicitProperty = reconstructed.explicitProperty; +>c.explicitProperty : Symbol(C.explicitProperty, Decl(thisTypeInFunctions.ts, 11, 5)) +>c : Symbol(c, Decl(thisTypeInFunctions.ts, 65, 3)) +>explicitProperty : Symbol(C.explicitProperty, Decl(thisTypeInFunctions.ts, 11, 5)) +>reconstructed.explicitProperty : Symbol(explicitProperty, Decl(thisTypeInFunctions.ts, 77, 42)) +>reconstructed : Symbol(reconstructed, Decl(thisTypeInFunctions.ts, 74, 3)) +>explicitProperty : Symbol(explicitProperty, Decl(thisTypeInFunctions.ts, 77, 42)) + +// lambdas are assignable to anything +c.explicitC = m => m; +>c.explicitC : Symbol(C.explicitC, Decl(thisTypeInFunctions.ts, 8, 5)) +>c : Symbol(c, Decl(thisTypeInFunctions.ts, 65, 3)) +>explicitC : Symbol(C.explicitC, Decl(thisTypeInFunctions.ts, 8, 5)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 111, 13)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 111, 13)) + +c.explicitThis = m => m; +>c.explicitThis : Symbol(C.explicitThis, Decl(thisTypeInFunctions.ts, 5, 14)) +>c : Symbol(c, Decl(thisTypeInFunctions.ts, 65, 3)) +>explicitThis : Symbol(C.explicitThis, Decl(thisTypeInFunctions.ts, 5, 14)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 112, 16)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 112, 16)) + +c.explicitProperty = m => m; +>c.explicitProperty : Symbol(C.explicitProperty, Decl(thisTypeInFunctions.ts, 11, 5)) +>c : Symbol(c, Decl(thisTypeInFunctions.ts, 65, 3)) +>explicitProperty : Symbol(C.explicitProperty, Decl(thisTypeInFunctions.ts, 11, 5)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 113, 20)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 113, 20)) + +// this inside lambdas refer to outer scope +// the outer-scoped lambda at top-level is still just `any` +c.explicitC = m => m + this.n; +>c.explicitC : Symbol(C.explicitC, Decl(thisTypeInFunctions.ts, 8, 5)) +>c : Symbol(c, Decl(thisTypeInFunctions.ts, 65, 3)) +>explicitC : Symbol(C.explicitC, Decl(thisTypeInFunctions.ts, 8, 5)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 117, 13)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 117, 13)) + +c.explicitThis = m => m + this.n; +>c.explicitThis : Symbol(C.explicitThis, Decl(thisTypeInFunctions.ts, 5, 14)) +>c : Symbol(c, Decl(thisTypeInFunctions.ts, 65, 3)) +>explicitThis : Symbol(C.explicitThis, Decl(thisTypeInFunctions.ts, 5, 14)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 118, 16)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 118, 16)) + +c.explicitProperty = m => m + this.n; +>c.explicitProperty : Symbol(C.explicitProperty, Decl(thisTypeInFunctions.ts, 11, 5)) +>c : Symbol(c, Decl(thisTypeInFunctions.ts, 65, 3)) +>explicitProperty : Symbol(C.explicitProperty, Decl(thisTypeInFunctions.ts, 11, 5)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 119, 20)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 119, 20)) + +//NOTE: this=C here, I guess? +c.explicitThis = explicitCFunction; +>c.explicitThis : Symbol(C.explicitThis, Decl(thisTypeInFunctions.ts, 5, 14)) +>c : Symbol(c, Decl(thisTypeInFunctions.ts, 65, 3)) +>explicitThis : Symbol(C.explicitThis, Decl(thisTypeInFunctions.ts, 5, 14)) +>explicitCFunction : Symbol(explicitCFunction, Decl(thisTypeInFunctions.ts, 102, 3)) + +c.explicitThis = function(this: C, m: number) { return this.n + m }; +>c.explicitThis : Symbol(C.explicitThis, Decl(thisTypeInFunctions.ts, 5, 14)) +>c : Symbol(c, Decl(thisTypeInFunctions.ts, 65, 3)) +>explicitThis : Symbol(C.explicitThis, Decl(thisTypeInFunctions.ts, 5, 14)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 123, 26)) +>C : Symbol(C, Decl(thisTypeInFunctions.ts, 3, 1)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 123, 34)) +>this.n : Symbol(C.n, Decl(thisTypeInFunctions.ts, 4, 9)) +>this : Symbol(C, Decl(thisTypeInFunctions.ts, 3, 1)) +>n : Symbol(C.n, Decl(thisTypeInFunctions.ts, 4, 9)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 123, 34)) + +// this:any compatibility +c.explicitC = function(m) { return this.n + m }; +>c.explicitC : Symbol(C.explicitC, Decl(thisTypeInFunctions.ts, 8, 5)) +>c : Symbol(c, Decl(thisTypeInFunctions.ts, 65, 3)) +>explicitC : Symbol(C.explicitC, Decl(thisTypeInFunctions.ts, 8, 5)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 126, 23)) +>this.n : Symbol(C.n, Decl(thisTypeInFunctions.ts, 4, 9)) +>this : Symbol(C, Decl(thisTypeInFunctions.ts, 3, 1)) +>n : Symbol(C.n, Decl(thisTypeInFunctions.ts, 4, 9)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 126, 23)) + +c.explicitProperty = function(m) { return this.n + m }; +>c.explicitProperty : Symbol(C.explicitProperty, Decl(thisTypeInFunctions.ts, 11, 5)) +>c : Symbol(c, Decl(thisTypeInFunctions.ts, 65, 3)) +>explicitProperty : Symbol(C.explicitProperty, Decl(thisTypeInFunctions.ts, 11, 5)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 127, 30)) +>this.n : Symbol(n, Decl(thisTypeInFunctions.ts, 12, 28)) +>this : Symbol(, Decl(thisTypeInFunctions.ts, 12, 26)) +>n : Symbol(n, Decl(thisTypeInFunctions.ts, 12, 28)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 127, 30)) + +c.explicitThis = function(m) { return this.n + m }; +>c.explicitThis : Symbol(C.explicitThis, Decl(thisTypeInFunctions.ts, 5, 14)) +>c : Symbol(c, Decl(thisTypeInFunctions.ts, 65, 3)) +>explicitThis : Symbol(C.explicitThis, Decl(thisTypeInFunctions.ts, 5, 14)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 128, 26)) +>this.n : Symbol(C.n, Decl(thisTypeInFunctions.ts, 4, 9)) +>this : Symbol(C, Decl(thisTypeInFunctions.ts, 3, 1)) +>n : Symbol(C.n, Decl(thisTypeInFunctions.ts, 4, 9)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 128, 26)) + +// this: contextual typing +c.explicitThis = function(this, m) { return this.n + m }; +>c.explicitThis : Symbol(C.explicitThis, Decl(thisTypeInFunctions.ts, 5, 14)) +>c : Symbol(c, Decl(thisTypeInFunctions.ts, 65, 3)) +>explicitThis : Symbol(C.explicitThis, Decl(thisTypeInFunctions.ts, 5, 14)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 131, 26)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 131, 31)) +>this.n : Symbol(C.n, Decl(thisTypeInFunctions.ts, 4, 9)) +>this : Symbol(C, Decl(thisTypeInFunctions.ts, 3, 1)) +>n : Symbol(C.n, Decl(thisTypeInFunctions.ts, 4, 9)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 131, 31)) + +// this: superclass compatibility +c.explicitC = function(this: B, m: number) { return this.n + m }; +>c.explicitC : Symbol(C.explicitC, Decl(thisTypeInFunctions.ts, 8, 5)) +>c : Symbol(c, Decl(thisTypeInFunctions.ts, 65, 3)) +>explicitC : Symbol(C.explicitC, Decl(thisTypeInFunctions.ts, 8, 5)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 134, 23)) +>B : Symbol(B, Decl(thisTypeInFunctions.ts, 0, 0)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 134, 31)) +>this.n : Symbol(B.n, Decl(thisTypeInFunctions.ts, 1, 9)) +>this : Symbol(B, Decl(thisTypeInFunctions.ts, 0, 0)) +>n : Symbol(B.n, Decl(thisTypeInFunctions.ts, 1, 9)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 134, 31)) + +// this:void compatibility +c.explicitVoid = n => n; +>c.explicitVoid : Symbol(C.explicitVoid, Decl(thisTypeInFunctions.ts, 14, 5)) +>c : Symbol(c, Decl(thisTypeInFunctions.ts, 65, 3)) +>explicitVoid : Symbol(C.explicitVoid, Decl(thisTypeInFunctions.ts, 14, 5)) +>n : Symbol(n, Decl(thisTypeInFunctions.ts, 137, 16)) +>n : Symbol(n, Decl(thisTypeInFunctions.ts, 137, 16)) + +// class-based assignability +class Base1 { +>Base1 : Symbol(Base1, Decl(thisTypeInFunctions.ts, 137, 24)) + + x: number; +>x : Symbol(Base1.x, Decl(thisTypeInFunctions.ts, 140, 13)) + + public polymorphic(this: this): number { return this.x; } +>polymorphic : Symbol(Base1.polymorphic, Decl(thisTypeInFunctions.ts, 141, 14)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 142, 23)) +>this.x : Symbol(Base1.x, Decl(thisTypeInFunctions.ts, 140, 13)) +>this : Symbol(Base1, Decl(thisTypeInFunctions.ts, 137, 24)) +>x : Symbol(Base1.x, Decl(thisTypeInFunctions.ts, 140, 13)) + + explicit(this: Base1): number { return this.x; } +>explicit : Symbol(Base1.explicit, Decl(thisTypeInFunctions.ts, 142, 61)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 143, 13)) +>Base1 : Symbol(Base1, Decl(thisTypeInFunctions.ts, 137, 24)) +>this.x : Symbol(Base1.x, Decl(thisTypeInFunctions.ts, 140, 13)) +>this : Symbol(Base1, Decl(thisTypeInFunctions.ts, 137, 24)) +>x : Symbol(Base1.x, Decl(thisTypeInFunctions.ts, 140, 13)) + + static explicitStatic(this: typeof Base1): number { return this.y; } +>explicitStatic : Symbol(Base1.explicitStatic, Decl(thisTypeInFunctions.ts, 143, 52)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 144, 26)) +>Base1 : Symbol(Base1, Decl(thisTypeInFunctions.ts, 137, 24)) +>this.y : Symbol(Base1.y, Decl(thisTypeInFunctions.ts, 144, 72)) +>this : Symbol(Base1, Decl(thisTypeInFunctions.ts, 137, 24)) +>y : Symbol(Base1.y, Decl(thisTypeInFunctions.ts, 144, 72)) + + static y: number; +>y : Symbol(Base1.y, Decl(thisTypeInFunctions.ts, 144, 72)) +} +class Derived1 extends Base1 { +>Derived1 : Symbol(Derived1, Decl(thisTypeInFunctions.ts, 146, 1)) +>Base1 : Symbol(Base1, Decl(thisTypeInFunctions.ts, 137, 24)) + + y: number +>y : Symbol(Derived1.y, Decl(thisTypeInFunctions.ts, 147, 30)) +} +class Base2 { +>Base2 : Symbol(Base2, Decl(thisTypeInFunctions.ts, 149, 1)) + + y: number +>y : Symbol(Base2.y, Decl(thisTypeInFunctions.ts, 150, 13)) + + polymorphic(this: this): number { return this.y; } +>polymorphic : Symbol(Base2.polymorphic, Decl(thisTypeInFunctions.ts, 151, 13)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 152, 16)) +>this.y : Symbol(Base2.y, Decl(thisTypeInFunctions.ts, 150, 13)) +>this : Symbol(Base2, Decl(thisTypeInFunctions.ts, 149, 1)) +>y : Symbol(Base2.y, Decl(thisTypeInFunctions.ts, 150, 13)) + + explicit(this: Base1): number { return this.x; } +>explicit : Symbol(Base2.explicit, Decl(thisTypeInFunctions.ts, 152, 54)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 153, 13)) +>Base1 : Symbol(Base1, Decl(thisTypeInFunctions.ts, 137, 24)) +>this.x : Symbol(Base1.x, Decl(thisTypeInFunctions.ts, 140, 13)) +>this : Symbol(Base1, Decl(thisTypeInFunctions.ts, 137, 24)) +>x : Symbol(Base1.x, Decl(thisTypeInFunctions.ts, 140, 13)) +} +class Derived2 extends Base2 { +>Derived2 : Symbol(Derived2, Decl(thisTypeInFunctions.ts, 154, 1)) +>Base2 : Symbol(Base2, Decl(thisTypeInFunctions.ts, 149, 1)) + + x: number +>x : Symbol(Derived2.x, Decl(thisTypeInFunctions.ts, 155, 30)) +} +let b1 = new Base1(); +>b1 : Symbol(b1, Decl(thisTypeInFunctions.ts, 158, 3)) +>Base1 : Symbol(Base1, Decl(thisTypeInFunctions.ts, 137, 24)) + +let b2 = new Base2(); +>b2 : Symbol(b2, Decl(thisTypeInFunctions.ts, 159, 3)) +>Base2 : Symbol(Base2, Decl(thisTypeInFunctions.ts, 149, 1)) + +let d1 = new Derived1(); +>d1 : Symbol(d1, Decl(thisTypeInFunctions.ts, 160, 3)) +>Derived1 : Symbol(Derived1, Decl(thisTypeInFunctions.ts, 146, 1)) + +let d2 = new Derived2(); +>d2 : Symbol(d2, Decl(thisTypeInFunctions.ts, 161, 3)) +>Derived2 : Symbol(Derived2, Decl(thisTypeInFunctions.ts, 154, 1)) + +d2.polymorphic = d1.polymorphic // ok, 'x' and 'y' in { x, y } +>d2.polymorphic : Symbol(Base2.polymorphic, Decl(thisTypeInFunctions.ts, 151, 13)) +>d2 : Symbol(d2, Decl(thisTypeInFunctions.ts, 161, 3)) +>polymorphic : Symbol(Base2.polymorphic, Decl(thisTypeInFunctions.ts, 151, 13)) +>d1.polymorphic : Symbol(Base1.polymorphic, Decl(thisTypeInFunctions.ts, 141, 14)) +>d1 : Symbol(d1, Decl(thisTypeInFunctions.ts, 160, 3)) +>polymorphic : Symbol(Base1.polymorphic, Decl(thisTypeInFunctions.ts, 141, 14)) + +d1.polymorphic = d2.polymorphic // ok, 'x' and 'y' in { x, y } +>d1.polymorphic : Symbol(Base1.polymorphic, Decl(thisTypeInFunctions.ts, 141, 14)) +>d1 : Symbol(d1, Decl(thisTypeInFunctions.ts, 160, 3)) +>polymorphic : Symbol(Base1.polymorphic, Decl(thisTypeInFunctions.ts, 141, 14)) +>d2.polymorphic : Symbol(Base2.polymorphic, Decl(thisTypeInFunctions.ts, 151, 13)) +>d2 : Symbol(d2, Decl(thisTypeInFunctions.ts, 161, 3)) +>polymorphic : Symbol(Base2.polymorphic, Decl(thisTypeInFunctions.ts, 151, 13)) + +// bivariance-allowed cases +d1.polymorphic = b2.polymorphic // ok, 'y' in D: { x, y } +>d1.polymorphic : Symbol(Base1.polymorphic, Decl(thisTypeInFunctions.ts, 141, 14)) +>d1 : Symbol(d1, Decl(thisTypeInFunctions.ts, 160, 3)) +>polymorphic : Symbol(Base1.polymorphic, Decl(thisTypeInFunctions.ts, 141, 14)) +>b2.polymorphic : Symbol(Base2.polymorphic, Decl(thisTypeInFunctions.ts, 151, 13)) +>b2 : Symbol(b2, Decl(thisTypeInFunctions.ts, 159, 3)) +>polymorphic : Symbol(Base2.polymorphic, Decl(thisTypeInFunctions.ts, 151, 13)) + +d2.polymorphic = d1.explicit // ok, 'y' in { x, y } +>d2.polymorphic : Symbol(Base2.polymorphic, Decl(thisTypeInFunctions.ts, 151, 13)) +>d2 : Symbol(d2, Decl(thisTypeInFunctions.ts, 161, 3)) +>polymorphic : Symbol(Base2.polymorphic, Decl(thisTypeInFunctions.ts, 151, 13)) +>d1.explicit : Symbol(Base1.explicit, Decl(thisTypeInFunctions.ts, 142, 61)) +>d1 : Symbol(d1, Decl(thisTypeInFunctions.ts, 160, 3)) +>explicit : Symbol(Base1.explicit, Decl(thisTypeInFunctions.ts, 142, 61)) + +b1.polymorphic = d2.polymorphic // ok, 'x' and 'y' not in Base1: { x } +>b1.polymorphic : Symbol(Base1.polymorphic, Decl(thisTypeInFunctions.ts, 141, 14)) +>b1 : Symbol(b1, Decl(thisTypeInFunctions.ts, 158, 3)) +>polymorphic : Symbol(Base1.polymorphic, Decl(thisTypeInFunctions.ts, 141, 14)) +>d2.polymorphic : Symbol(Base2.polymorphic, Decl(thisTypeInFunctions.ts, 151, 13)) +>d2 : Symbol(d2, Decl(thisTypeInFunctions.ts, 161, 3)) +>polymorphic : Symbol(Base2.polymorphic, Decl(thisTypeInFunctions.ts, 151, 13)) + +b1.explicit = d2.polymorphic // ok, 'x' and 'y' not in Base1: { x } +>b1.explicit : Symbol(Base1.explicit, Decl(thisTypeInFunctions.ts, 142, 61)) +>b1 : Symbol(b1, Decl(thisTypeInFunctions.ts, 158, 3)) +>explicit : Symbol(Base1.explicit, Decl(thisTypeInFunctions.ts, 142, 61)) +>d2.polymorphic : Symbol(Base2.polymorphic, Decl(thisTypeInFunctions.ts, 151, 13)) +>d2 : Symbol(d2, Decl(thisTypeInFunctions.ts, 161, 3)) +>polymorphic : Symbol(Base2.polymorphic, Decl(thisTypeInFunctions.ts, 151, 13)) + +////// use this-type for construction with new //// +function InterfaceThis(this: I) { +>InterfaceThis : Symbol(InterfaceThis, Decl(thisTypeInFunctions.ts, 169, 28)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 172, 23)) +>I : Symbol(I, Decl(thisTypeInFunctions.ts, 19, 21)) + + this.a = 12; +>this.a : Symbol(I.a, Decl(thisTypeInFunctions.ts, 20, 13)) +>this : Symbol(I, Decl(thisTypeInFunctions.ts, 19, 21)) +>a : Symbol(I.a, Decl(thisTypeInFunctions.ts, 20, 13)) +} +function LiteralTypeThis(this: {x: string}) { +>LiteralTypeThis : Symbol(LiteralTypeThis, Decl(thisTypeInFunctions.ts, 174, 1)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 175, 25)) +>x : Symbol(x, Decl(thisTypeInFunctions.ts, 175, 32)) + + this.x = "ok"; +>this.x : Symbol(x, Decl(thisTypeInFunctions.ts, 175, 32)) +>this : Symbol(, Decl(thisTypeInFunctions.ts, 175, 30)) +>x : Symbol(x, Decl(thisTypeInFunctions.ts, 175, 32)) +} +function AnyThis(this: any) { +>AnyThis : Symbol(AnyThis, Decl(thisTypeInFunctions.ts, 177, 1)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 178, 17)) + + this.x = "ok"; +} +let interfaceThis = new InterfaceThis(); +>interfaceThis : Symbol(interfaceThis, Decl(thisTypeInFunctions.ts, 181, 3)) +>InterfaceThis : Symbol(InterfaceThis, Decl(thisTypeInFunctions.ts, 169, 28)) + +let literalTypeThis = new LiteralTypeThis(); +>literalTypeThis : Symbol(literalTypeThis, Decl(thisTypeInFunctions.ts, 182, 3)) +>LiteralTypeThis : Symbol(LiteralTypeThis, Decl(thisTypeInFunctions.ts, 174, 1)) + +let anyThis = new AnyThis(); +>anyThis : Symbol(anyThis, Decl(thisTypeInFunctions.ts, 183, 3)) +>AnyThis : Symbol(AnyThis, Decl(thisTypeInFunctions.ts, 177, 1)) + +//// type parameter inference //// +declare var f: { +>f : Symbol(f, Decl(thisTypeInFunctions.ts, 186, 11)) + + (this: void, x: number): number, +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 187, 5)) +>x : Symbol(x, Decl(thisTypeInFunctions.ts, 187, 16)) + + call(this: (...argArray: any[]) => U, ...argArray: any[]): U; +>call : Symbol(call, Decl(thisTypeInFunctions.ts, 187, 36)) +>U : Symbol(U, Decl(thisTypeInFunctions.ts, 188, 9)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 188, 12)) +>argArray : Symbol(argArray, Decl(thisTypeInFunctions.ts, 188, 19)) +>U : Symbol(U, Decl(thisTypeInFunctions.ts, 188, 9)) +>argArray : Symbol(argArray, Decl(thisTypeInFunctions.ts, 188, 44)) +>U : Symbol(U, Decl(thisTypeInFunctions.ts, 188, 9)) + +}; +let n: number = f.call(12); +>n : Symbol(n, Decl(thisTypeInFunctions.ts, 190, 3)) +>f.call : Symbol(call, Decl(thisTypeInFunctions.ts, 187, 36)) +>f : Symbol(f, Decl(thisTypeInFunctions.ts, 186, 11)) +>call : Symbol(call, Decl(thisTypeInFunctions.ts, 187, 36)) + +function missingTypeIsImplicitAny(this, a: number) { return this.anything + a; } +>missingTypeIsImplicitAny : Symbol(missingTypeIsImplicitAny, Decl(thisTypeInFunctions.ts, 190, 27)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 192, 34)) +>a : Symbol(a, Decl(thisTypeInFunctions.ts, 192, 39)) +>a : Symbol(a, Decl(thisTypeInFunctions.ts, 192, 39)) + diff --git a/tests/baselines/reference/thisTypeInFunctions.types b/tests/baselines/reference/thisTypeInFunctions.types new file mode 100644 index 00000000000..ddef8544a54 --- /dev/null +++ b/tests/baselines/reference/thisTypeInFunctions.types @@ -0,0 +1,963 @@ +=== tests/cases/conformance/types/thisType/thisTypeInFunctions.ts === +// body checking +class B { +>B : B + + n: number; +>n : number +} +class C { +>C : C + + n: number; +>n : number + + explicitThis(this: this, m: number): number { +>explicitThis : (this: this, m: number) => number +>this : this +>m : number + + return this.n + m; +>this.n + m : number +>this.n : number +>this : this +>n : number +>m : number + } + explicitC(this: C, m: number): number { +>explicitC : (this: C, m: number) => number +>this : C +>C : C +>m : number + + return this.n + m; +>this.n + m : number +>this.n : number +>this : C +>n : number +>m : number + } + explicitProperty(this: {n: number}, m: number): number { +>explicitProperty : (this: { n: number; }, m: number) => number +>this : { n: number; } +>n : number +>m : number + + return this.n + m; +>this.n + m : number +>this.n : number +>this : { n: number; } +>n : number +>m : number + } + explicitVoid(this: void, m: number): number { +>explicitVoid : (this: void, m: number) => number +>this : void +>m : number + + return m + 1; +>m + 1 : number +>m : number +>1 : number + } +} +class D extends C { } +>D : D +>C : C + +interface I { +>I : I + + a: number; +>a : number + + explicitVoid1(this: void): number; +>explicitVoid1 : (this: void) => number +>this : void + + explicitVoid2(this: void): number; +>explicitVoid2 : (this: void) => number +>this : void + + explicitStructural(this: {a: number}): number; +>explicitStructural : (this: { a: number; }) => number +>this : { a: number; } +>a : number + + explicitInterface(this: I): number; +>explicitInterface : (this: I) => number +>this : I +>I : I + + explicitThis(this: this): number; +>explicitThis : (this: this) => number +>this : this +} +function explicitStructural(this: { y: number }, x: number): number { +>explicitStructural : (this: { y: number; }, x: number) => number +>this : { y: number; } +>y : number +>x : number + + return x + this.y; +>x + this.y : number +>x : number +>this.y : number +>this : { y: number; } +>y : number +} +function justThis(this: { y: number }): number { +>justThis : (this: { y: number; }) => number +>this : { y: number; } +>y : number + + return this.y; +>this.y : number +>this : { y: number; } +>y : number +} +function implicitThis(n: number): number { +>implicitThis : (n: number) => number +>n : number + + return this.m + n + 12; +>this.m + n + 12 : any +>this.m + n : any +>this.m : any +>this : any +>m : any +>n : number +>12 : number +} +let impl: I = { +>impl : I +>I : I +>{ a: 12, explicitVoid2: () => this.a, // ok, this: any because it refers to some outer object (window?) explicitVoid1() { return 12; }, explicitStructural() { return this.a; }, explicitInterface() { return this.a; }, explicitThis() { return this.a; },} : { a: number; explicitVoid2: () => any; explicitVoid1(): number; explicitStructural(): number; explicitInterface(): number; explicitThis(): number; } + + a: 12, +>a : number +>12 : number + + explicitVoid2: () => this.a, // ok, this: any because it refers to some outer object (window?) +>explicitVoid2 : () => any +>() => this.a : () => any +>this.a : any +>this : any +>a : any + + explicitVoid1() { return 12; }, +>explicitVoid1 : () => number +>12 : number + + explicitStructural() { +>explicitStructural : () => number + + return this.a; +>this.a : number +>this : { a: number; } +>a : number + + }, + explicitInterface() { +>explicitInterface : () => number + + return this.a; +>this.a : number +>this : I +>a : number + + }, + explicitThis() { +>explicitThis : () => number + + return this.a; +>this.a : number +>this : I +>a : number + + }, +} +impl.explicitVoid1 = function () { return 12; }; +>impl.explicitVoid1 = function () { return 12; } : () => number +>impl.explicitVoid1 : (this: void) => number +>impl : I +>explicitVoid1 : (this: void) => number +>function () { return 12; } : () => number +>12 : number + +impl.explicitVoid2 = () => 12; +>impl.explicitVoid2 = () => 12 : () => number +>impl.explicitVoid2 : (this: void) => number +>impl : I +>explicitVoid2 : (this: void) => number +>() => 12 : () => number +>12 : number + +impl.explicitStructural = function() { return this.a; }; +>impl.explicitStructural = function() { return this.a; } : () => number +>impl.explicitStructural : (this: { a: number; }) => number +>impl : I +>explicitStructural : (this: { a: number; }) => number +>function() { return this.a; } : () => number +>this.a : number +>this : { a: number; } +>a : number + +impl.explicitInterface = function() { return this.a; }; +>impl.explicitInterface = function() { return this.a; } : () => number +>impl.explicitInterface : (this: I) => number +>impl : I +>explicitInterface : (this: I) => number +>function() { return this.a; } : () => number +>this.a : number +>this : I +>a : number + +impl.explicitStructural = () => 12; +>impl.explicitStructural = () => 12 : () => number +>impl.explicitStructural : (this: { a: number; }) => number +>impl : I +>explicitStructural : (this: { a: number; }) => number +>() => 12 : () => number +>12 : number + +impl.explicitInterface = () => 12; +>impl.explicitInterface = () => 12 : () => number +>impl.explicitInterface : (this: I) => number +>impl : I +>explicitInterface : (this: I) => number +>() => 12 : () => number +>12 : number + +impl.explicitThis = function () { return this.a; }; +>impl.explicitThis = function () { return this.a; } : () => number +>impl.explicitThis : (this: I) => number +>impl : I +>explicitThis : (this: I) => number +>function () { return this.a; } : () => number +>this.a : number +>this : I +>a : number + +// parameter checking +let ok: {y: number, f: (this: { y: number }, x: number) => number} = { y: 12, f: explicitStructural }; +>ok : { y: number; f: (this: { y: number; }, x: number) => number; } +>y : number +>f : (this: { y: number; }, x: number) => number +>this : { y: number; } +>y : number +>x : number +>{ y: 12, f: explicitStructural } : { y: number; f: (this: { y: number; }, x: number) => number; } +>y : number +>12 : number +>f : (this: { y: number; }, x: number) => number +>explicitStructural : (this: { y: number; }, x: number) => number + +let implicitAnyOk: {notSpecified: number, f: (x: number) => number} = { notSpecified: 12, f: implicitThis }; +>implicitAnyOk : { notSpecified: number; f: (x: number) => number; } +>notSpecified : number +>f : (x: number) => number +>x : number +>{ notSpecified: 12, f: implicitThis } : { notSpecified: number; f: (n: number) => number; } +>notSpecified : number +>12 : number +>f : (n: number) => number +>implicitThis : (n: number) => number + +ok.f(13); +>ok.f(13) : number +>ok.f : (this: { y: number; }, x: number) => number +>ok : { y: number; f: (this: { y: number; }, x: number) => number; } +>f : (this: { y: number; }, x: number) => number +>13 : number + +implicitThis(12); +>implicitThis(12) : number +>implicitThis : (n: number) => number +>12 : number + +implicitAnyOk.f(12); +>implicitAnyOk.f(12) : number +>implicitAnyOk.f : (x: number) => number +>implicitAnyOk : { notSpecified: number; f: (x: number) => number; } +>f : (x: number) => number +>12 : number + +let c = new C(); +>c : C +>new C() : C +>C : typeof C + +let d = new D(); +>d : D +>new D() : D +>D : typeof D + +let ripped = c.explicitC; +>ripped : (this: C, m: number) => number +>c.explicitC : (this: C, m: number) => number +>c : C +>explicitC : (this: C, m: number) => number + +c.explicitC(12); +>c.explicitC(12) : number +>c.explicitC : (this: C, m: number) => number +>c : C +>explicitC : (this: C, m: number) => number +>12 : number + +c.explicitProperty(12); +>c.explicitProperty(12) : number +>c.explicitProperty : (this: { n: number; }, m: number) => number +>c : C +>explicitProperty : (this: { n: number; }, m: number) => number +>12 : number + +c.explicitThis(12); +>c.explicitThis(12) : number +>c.explicitThis : (this: C, m: number) => number +>c : C +>explicitThis : (this: C, m: number) => number +>12 : number + +d.explicitC(12); +>d.explicitC(12) : number +>d.explicitC : (this: C, m: number) => number +>d : D +>explicitC : (this: C, m: number) => number +>12 : number + +d.explicitProperty(12); +>d.explicitProperty(12) : number +>d.explicitProperty : (this: { n: number; }, m: number) => number +>d : D +>explicitProperty : (this: { n: number; }, m: number) => number +>12 : number + +d.explicitThis(12); +>d.explicitThis(12) : number +>d.explicitThis : (this: D, m: number) => number +>d : D +>explicitThis : (this: D, m: number) => number +>12 : number + +let reconstructed: { +>reconstructed : { n: number; explicitThis(this: C, m: number): number; explicitC(this: C, m: number): number; explicitProperty: (this: { n: number; }, m: number) => number; explicitVoid(this: void, m: number): number; } + + n: number, +>n : number + + explicitThis(this: C, m: number): number, // note: this: this is not allowed in an object literal type. +>explicitThis : (this: C, m: number) => number +>this : C +>C : C +>m : number + + explicitC(this: C, m: number): number, +>explicitC : (this: C, m: number) => number +>this : C +>C : C +>m : number + + explicitProperty: (this: {n : number}, m: number) => number, +>explicitProperty : (this: { n: number; }, m: number) => number +>this : { n: number; } +>n : number +>m : number + + explicitVoid(this: void, m: number): number, +>explicitVoid : (this: void, m: number) => number +>this : void +>m : number + +} = { +>{ n: 12, explicitThis: c.explicitThis, explicitC: c.explicitC, explicitProperty: c.explicitProperty, explicitVoid: c.explicitVoid} : { n: number; explicitThis: (this: C, m: number) => number; explicitC: (this: C, m: number) => number; explicitProperty: (this: { n: number; }, m: number) => number; explicitVoid: (this: void, m: number) => number; } + + n: 12, +>n : number +>12 : number + + explicitThis: c.explicitThis, +>explicitThis : (this: C, m: number) => number +>c.explicitThis : (this: C, m: number) => number +>c : C +>explicitThis : (this: C, m: number) => number + + explicitC: c.explicitC, +>explicitC : (this: C, m: number) => number +>c.explicitC : (this: C, m: number) => number +>c : C +>explicitC : (this: C, m: number) => number + + explicitProperty: c.explicitProperty, +>explicitProperty : (this: { n: number; }, m: number) => number +>c.explicitProperty : (this: { n: number; }, m: number) => number +>c : C +>explicitProperty : (this: { n: number; }, m: number) => number + + explicitVoid: c.explicitVoid +>explicitVoid : (this: void, m: number) => number +>c.explicitVoid : (this: void, m: number) => number +>c : C +>explicitVoid : (this: void, m: number) => number + +}; +reconstructed.explicitThis(10); +>reconstructed.explicitThis(10) : number +>reconstructed.explicitThis : (this: C, m: number) => number +>reconstructed : { n: number; explicitThis(this: C, m: number): number; explicitC(this: C, m: number): number; explicitProperty: (this: { n: number; }, m: number) => number; explicitVoid(this: void, m: number): number; } +>explicitThis : (this: C, m: number) => number +>10 : number + +reconstructed.explicitProperty(11); +>reconstructed.explicitProperty(11) : number +>reconstructed.explicitProperty : (this: { n: number; }, m: number) => number +>reconstructed : { n: number; explicitThis(this: C, m: number): number; explicitC(this: C, m: number): number; explicitProperty: (this: { n: number; }, m: number) => number; explicitVoid(this: void, m: number): number; } +>explicitProperty : (this: { n: number; }, m: number) => number +>11 : number + +let explicitVoid = reconstructed.explicitVoid; +>explicitVoid : (this: void, m: number) => number +>reconstructed.explicitVoid : (this: void, m: number) => number +>reconstructed : { n: number; explicitThis(this: C, m: number): number; explicitC(this: C, m: number): number; explicitProperty: (this: { n: number; }, m: number) => number; explicitVoid(this: void, m: number): number; } +>explicitVoid : (this: void, m: number) => number + +explicitVoid(12); +>explicitVoid(12) : number +>explicitVoid : (this: void, m: number) => number +>12 : number + +// assignment checking +let unboundToSpecified: (this: { y: number }, x: number) => number = x => x + this.y; // ok, this:any +>unboundToSpecified : (this: { y: number; }, x: number) => number +>this : { y: number; } +>y : number +>x : number +>x => x + this.y : (x: number) => any +>x : number +>x + this.y : any +>x : number +>this.y : any +>this : any +>y : any + +let specifiedToSpecified: (this: {y: number}, x: number) => number = explicitStructural; +>specifiedToSpecified : (this: { y: number; }, x: number) => number +>this : { y: number; } +>y : number +>x : number +>explicitStructural : (this: { y: number; }, x: number) => number + +let anyToSpecified: (this: { y: number }, x: number) => number = function(x: number): number { return x + 12; }; +>anyToSpecified : (this: { y: number; }, x: number) => number +>this : { y: number; } +>y : number +>x : number +>function(x: number): number { return x + 12; } : (x: number) => number +>x : number +>x + 12 : number +>x : number +>12 : number + +let unspecifiedLambda: (x: number) => number = x => x + 12; +>unspecifiedLambda : (x: number) => number +>x : number +>x => x + 12 : (x: number) => number +>x : number +>x + 12 : number +>x : number +>12 : number + +let specifiedLambda: (this: void, x: number) => number = x => x + 12; +>specifiedLambda : (this: void, x: number) => number +>this : void +>x : number +>x => x + 12 : (x: number) => number +>x : number +>x + 12 : number +>x : number +>12 : number + +let unspecifiedLambdaToSpecified: (this: {y: number}, x: number) => number = unspecifiedLambda; +>unspecifiedLambdaToSpecified : (this: { y: number; }, x: number) => number +>this : { y: number; } +>y : number +>x : number +>unspecifiedLambda : (x: number) => number + +let specifiedLambdaToSpecified: (this: {y: number}, x: number) => number = specifiedLambda; +>specifiedLambdaToSpecified : (this: { y: number; }, x: number) => number +>this : { y: number; } +>y : number +>x : number +>specifiedLambda : (this: void, x: number) => number + + +let explicitCFunction: (this: C, m: number) => number; +>explicitCFunction : (this: C, m: number) => number +>this : C +>C : C +>m : number + +let explicitPropertyFunction: (this: {n: number}, m: number) => number; +>explicitPropertyFunction : (this: { n: number; }, m: number) => number +>this : { n: number; } +>n : number +>m : number + +c.explicitC = explicitCFunction; +>c.explicitC = explicitCFunction : (this: C, m: number) => number +>c.explicitC : (this: C, m: number) => number +>c : C +>explicitC : (this: C, m: number) => number +>explicitCFunction : (this: C, m: number) => number + +c.explicitC = function(this: C, m: number) { return this.n + m }; +>c.explicitC = function(this: C, m: number) { return this.n + m } : (this: C, m: number) => number +>c.explicitC : (this: C, m: number) => number +>c : C +>explicitC : (this: C, m: number) => number +>function(this: C, m: number) { return this.n + m } : (this: C, m: number) => number +>this : C +>C : C +>m : number +>this.n + m : number +>this.n : number +>this : C +>n : number +>m : number + +c.explicitProperty = explicitPropertyFunction; +>c.explicitProperty = explicitPropertyFunction : (this: { n: number; }, m: number) => number +>c.explicitProperty : (this: { n: number; }, m: number) => number +>c : C +>explicitProperty : (this: { n: number; }, m: number) => number +>explicitPropertyFunction : (this: { n: number; }, m: number) => number + +c.explicitProperty = function(this: {n: number}, m: number) { return this.n + m }; +>c.explicitProperty = function(this: {n: number}, m: number) { return this.n + m } : (this: { n: number; }, m: number) => number +>c.explicitProperty : (this: { n: number; }, m: number) => number +>c : C +>explicitProperty : (this: { n: number; }, m: number) => number +>function(this: {n: number}, m: number) { return this.n + m } : (this: { n: number; }, m: number) => number +>this : { n: number; } +>n : number +>m : number +>this.n + m : number +>this.n : number +>this : { n: number; } +>n : number +>m : number + +c.explicitProperty = reconstructed.explicitProperty; +>c.explicitProperty = reconstructed.explicitProperty : (this: { n: number; }, m: number) => number +>c.explicitProperty : (this: { n: number; }, m: number) => number +>c : C +>explicitProperty : (this: { n: number; }, m: number) => number +>reconstructed.explicitProperty : (this: { n: number; }, m: number) => number +>reconstructed : { n: number; explicitThis(this: C, m: number): number; explicitC(this: C, m: number): number; explicitProperty: (this: { n: number; }, m: number) => number; explicitVoid(this: void, m: number): number; } +>explicitProperty : (this: { n: number; }, m: number) => number + +// lambdas are assignable to anything +c.explicitC = m => m; +>c.explicitC = m => m : (m: number) => number +>c.explicitC : (this: C, m: number) => number +>c : C +>explicitC : (this: C, m: number) => number +>m => m : (m: number) => number +>m : number +>m : number + +c.explicitThis = m => m; +>c.explicitThis = m => m : (m: number) => number +>c.explicitThis : (this: C, m: number) => number +>c : C +>explicitThis : (this: C, m: number) => number +>m => m : (m: number) => number +>m : number +>m : number + +c.explicitProperty = m => m; +>c.explicitProperty = m => m : (m: number) => number +>c.explicitProperty : (this: { n: number; }, m: number) => number +>c : C +>explicitProperty : (this: { n: number; }, m: number) => number +>m => m : (m: number) => number +>m : number +>m : number + +// this inside lambdas refer to outer scope +// the outer-scoped lambda at top-level is still just `any` +c.explicitC = m => m + this.n; +>c.explicitC = m => m + this.n : (m: number) => any +>c.explicitC : (this: C, m: number) => number +>c : C +>explicitC : (this: C, m: number) => number +>m => m + this.n : (m: number) => any +>m : number +>m + this.n : any +>m : number +>this.n : any +>this : any +>n : any + +c.explicitThis = m => m + this.n; +>c.explicitThis = m => m + this.n : (m: number) => any +>c.explicitThis : (this: C, m: number) => number +>c : C +>explicitThis : (this: C, m: number) => number +>m => m + this.n : (m: number) => any +>m : number +>m + this.n : any +>m : number +>this.n : any +>this : any +>n : any + +c.explicitProperty = m => m + this.n; +>c.explicitProperty = m => m + this.n : (m: number) => any +>c.explicitProperty : (this: { n: number; }, m: number) => number +>c : C +>explicitProperty : (this: { n: number; }, m: number) => number +>m => m + this.n : (m: number) => any +>m : number +>m + this.n : any +>m : number +>this.n : any +>this : any +>n : any + +//NOTE: this=C here, I guess? +c.explicitThis = explicitCFunction; +>c.explicitThis = explicitCFunction : (this: C, m: number) => number +>c.explicitThis : (this: C, m: number) => number +>c : C +>explicitThis : (this: C, m: number) => number +>explicitCFunction : (this: C, m: number) => number + +c.explicitThis = function(this: C, m: number) { return this.n + m }; +>c.explicitThis = function(this: C, m: number) { return this.n + m } : (this: C, m: number) => number +>c.explicitThis : (this: C, m: number) => number +>c : C +>explicitThis : (this: C, m: number) => number +>function(this: C, m: number) { return this.n + m } : (this: C, m: number) => number +>this : C +>C : C +>m : number +>this.n + m : number +>this.n : number +>this : C +>n : number +>m : number + +// this:any compatibility +c.explicitC = function(m) { return this.n + m }; +>c.explicitC = function(m) { return this.n + m } : (m: number) => number +>c.explicitC : (this: C, m: number) => number +>c : C +>explicitC : (this: C, m: number) => number +>function(m) { return this.n + m } : (m: number) => number +>m : number +>this.n + m : number +>this.n : number +>this : C +>n : number +>m : number + +c.explicitProperty = function(m) { return this.n + m }; +>c.explicitProperty = function(m) { return this.n + m } : (m: number) => number +>c.explicitProperty : (this: { n: number; }, m: number) => number +>c : C +>explicitProperty : (this: { n: number; }, m: number) => number +>function(m) { return this.n + m } : (m: number) => number +>m : number +>this.n + m : number +>this.n : number +>this : { n: number; } +>n : number +>m : number + +c.explicitThis = function(m) { return this.n + m }; +>c.explicitThis = function(m) { return this.n + m } : (m: number) => number +>c.explicitThis : (this: C, m: number) => number +>c : C +>explicitThis : (this: C, m: number) => number +>function(m) { return this.n + m } : (m: number) => number +>m : number +>this.n + m : number +>this.n : number +>this : C +>n : number +>m : number + +// this: contextual typing +c.explicitThis = function(this, m) { return this.n + m }; +>c.explicitThis = function(this, m) { return this.n + m } : (this: any, m: number) => number +>c.explicitThis : (this: C, m: number) => number +>c : C +>explicitThis : (this: C, m: number) => number +>function(this, m) { return this.n + m } : (this: any, m: number) => number +>this : C +>m : number +>this.n + m : number +>this.n : number +>this : C +>n : number +>m : number + +// this: superclass compatibility +c.explicitC = function(this: B, m: number) { return this.n + m }; +>c.explicitC = function(this: B, m: number) { return this.n + m } : (this: B, m: number) => number +>c.explicitC : (this: C, m: number) => number +>c : C +>explicitC : (this: C, m: number) => number +>function(this: B, m: number) { return this.n + m } : (this: B, m: number) => number +>this : B +>B : B +>m : number +>this.n + m : number +>this.n : number +>this : B +>n : number +>m : number + +// this:void compatibility +c.explicitVoid = n => n; +>c.explicitVoid = n => n : (n: number) => number +>c.explicitVoid : (this: void, m: number) => number +>c : C +>explicitVoid : (this: void, m: number) => number +>n => n : (n: number) => number +>n : number +>n : number + +// class-based assignability +class Base1 { +>Base1 : Base1 + + x: number; +>x : number + + public polymorphic(this: this): number { return this.x; } +>polymorphic : (this: this) => number +>this : this +>this.x : number +>this : this +>x : number + + explicit(this: Base1): number { return this.x; } +>explicit : (this: Base1) => number +>this : Base1 +>Base1 : Base1 +>this.x : number +>this : Base1 +>x : number + + static explicitStatic(this: typeof Base1): number { return this.y; } +>explicitStatic : (this: typeof Base1) => number +>this : typeof Base1 +>Base1 : typeof Base1 +>this.y : number +>this : typeof Base1 +>y : number + + static y: number; +>y : number +} +class Derived1 extends Base1 { +>Derived1 : Derived1 +>Base1 : Base1 + + y: number +>y : number +} +class Base2 { +>Base2 : Base2 + + y: number +>y : number + + polymorphic(this: this): number { return this.y; } +>polymorphic : (this: this) => number +>this : this +>this.y : number +>this : this +>y : number + + explicit(this: Base1): number { return this.x; } +>explicit : (this: Base1) => number +>this : Base1 +>Base1 : Base1 +>this.x : number +>this : Base1 +>x : number +} +class Derived2 extends Base2 { +>Derived2 : Derived2 +>Base2 : Base2 + + x: number +>x : number +} +let b1 = new Base1(); +>b1 : Base1 +>new Base1() : Base1 +>Base1 : typeof Base1 + +let b2 = new Base2(); +>b2 : Base2 +>new Base2() : Base2 +>Base2 : typeof Base2 + +let d1 = new Derived1(); +>d1 : Derived1 +>new Derived1() : Derived1 +>Derived1 : typeof Derived1 + +let d2 = new Derived2(); +>d2 : Derived2 +>new Derived2() : Derived2 +>Derived2 : typeof Derived2 + +d2.polymorphic = d1.polymorphic // ok, 'x' and 'y' in { x, y } +>d2.polymorphic = d1.polymorphic : (this: Derived1) => number +>d2.polymorphic : (this: Derived2) => number +>d2 : Derived2 +>polymorphic : (this: Derived2) => number +>d1.polymorphic : (this: Derived1) => number +>d1 : Derived1 +>polymorphic : (this: Derived1) => number + +d1.polymorphic = d2.polymorphic // ok, 'x' and 'y' in { x, y } +>d1.polymorphic = d2.polymorphic : (this: Derived2) => number +>d1.polymorphic : (this: Derived1) => number +>d1 : Derived1 +>polymorphic : (this: Derived1) => number +>d2.polymorphic : (this: Derived2) => number +>d2 : Derived2 +>polymorphic : (this: Derived2) => number + +// bivariance-allowed cases +d1.polymorphic = b2.polymorphic // ok, 'y' in D: { x, y } +>d1.polymorphic = b2.polymorphic : (this: Base2) => number +>d1.polymorphic : (this: Derived1) => number +>d1 : Derived1 +>polymorphic : (this: Derived1) => number +>b2.polymorphic : (this: Base2) => number +>b2 : Base2 +>polymorphic : (this: Base2) => number + +d2.polymorphic = d1.explicit // ok, 'y' in { x, y } +>d2.polymorphic = d1.explicit : (this: Base1) => number +>d2.polymorphic : (this: Derived2) => number +>d2 : Derived2 +>polymorphic : (this: Derived2) => number +>d1.explicit : (this: Base1) => number +>d1 : Derived1 +>explicit : (this: Base1) => number + +b1.polymorphic = d2.polymorphic // ok, 'x' and 'y' not in Base1: { x } +>b1.polymorphic = d2.polymorphic : (this: Derived2) => number +>b1.polymorphic : (this: Base1) => number +>b1 : Base1 +>polymorphic : (this: Base1) => number +>d2.polymorphic : (this: Derived2) => number +>d2 : Derived2 +>polymorphic : (this: Derived2) => number + +b1.explicit = d2.polymorphic // ok, 'x' and 'y' not in Base1: { x } +>b1.explicit = d2.polymorphic : (this: Derived2) => number +>b1.explicit : (this: Base1) => number +>b1 : Base1 +>explicit : (this: Base1) => number +>d2.polymorphic : (this: Derived2) => number +>d2 : Derived2 +>polymorphic : (this: Derived2) => number + +////// use this-type for construction with new //// +function InterfaceThis(this: I) { +>InterfaceThis : (this: I) => void +>this : I +>I : I + + this.a = 12; +>this.a = 12 : number +>this.a : number +>this : I +>a : number +>12 : number +} +function LiteralTypeThis(this: {x: string}) { +>LiteralTypeThis : (this: { x: string; }) => void +>this : { x: string; } +>x : string + + this.x = "ok"; +>this.x = "ok" : string +>this.x : string +>this : { x: string; } +>x : string +>"ok" : string +} +function AnyThis(this: any) { +>AnyThis : (this: any) => void +>this : any + + this.x = "ok"; +>this.x = "ok" : string +>this.x : any +>this : any +>x : any +>"ok" : string +} +let interfaceThis = new InterfaceThis(); +>interfaceThis : any +>new InterfaceThis() : any +>InterfaceThis : (this: I) => void + +let literalTypeThis = new LiteralTypeThis(); +>literalTypeThis : any +>new LiteralTypeThis() : any +>LiteralTypeThis : (this: { x: string; }) => void + +let anyThis = new AnyThis(); +>anyThis : any +>new AnyThis() : any +>AnyThis : (this: any) => void + +//// type parameter inference //// +declare var f: { +>f : { (this: void, x: number): number; call(this: (...argArray: any[]) => U, ...argArray: any[]): U; } + + (this: void, x: number): number, +>this : void +>x : number + + call(this: (...argArray: any[]) => U, ...argArray: any[]): U; +>call : (this: (...argArray: any[]) => U, ...argArray: any[]) => U +>U : U +>this : (...argArray: any[]) => U +>argArray : any[] +>U : U +>argArray : any[] +>U : U + +}; +let n: number = f.call(12); +>n : number +>f.call(12) : number +>f.call : (this: (...argArray: any[]) => U, ...argArray: any[]) => U +>f : { (this: void, x: number): number; call(this: (...argArray: any[]) => U, ...argArray: any[]): U; } +>call : (this: (...argArray: any[]) => U, ...argArray: any[]) => U +>12 : number + +function missingTypeIsImplicitAny(this, a: number) { return this.anything + a; } +>missingTypeIsImplicitAny : (this: any, a: number) => any +>this : any +>a : number +>this.anything + a : any +>this.anything : any +>this : any +>anything : any +>a : number + diff --git a/tests/baselines/reference/thisTypeInFunctions2.js b/tests/baselines/reference/thisTypeInFunctions2.js new file mode 100644 index 00000000000..f52438a19ab --- /dev/null +++ b/tests/baselines/reference/thisTypeInFunctions2.js @@ -0,0 +1,91 @@ +//// [thisTypeInFunctions2.ts] +interface IndexedWithThis { + // this is a workaround for React + init?: (this: this) => void; + willDestroy?: (this: any) => void; + [propName: string]: number | string | boolean | symbol | undefined | null | {} | ((this: any, ...args:any[]) => any); +} +interface IndexedWithoutThis { + // this is what React would like to write (and what they write today) + init?: () => void; + willDestroy?: () => void; + [propName: string]: any; +} +interface SimpleInterface { + foo(n: string); + bar(): number; +} +declare function extend1(args: IndexedWithThis): void; +declare function extend2(args: IndexedWithoutThis): void; +declare function simple(arg: SimpleInterface): void; + +extend1({ + init() { + this // this: IndexedWithThis because of contextual typing. + // this.mine + this.willDestroy + }, + mine: 12, + foo() { + this.url; // this: any because 'foo' matches the string indexer + this.willDestroy; + } +}); +extend2({ + init() { + this // this: any because the contextual signature of init doesn't specify this' type + this.mine + this.willDestroy + }, + mine: 13, + foo() { + this // this: any because of the string indexer + this.mine + this.willDestroy + } +}); + +simple({ + foo(n) { + return n.length + this.bar(); + }, + bar() { + return 14; + } +}) + + +//// [thisTypeInFunctions2.js] +extend1({ + init: function () { + this; // this: IndexedWithThis because of contextual typing. + // this.mine + this.willDestroy; + }, + mine: 12, + foo: function () { + this.url; // this: any because 'foo' matches the string indexer + this.willDestroy; + } +}); +extend2({ + init: function () { + this; // this: any because the contextual signature of init doesn't specify this' type + this.mine; + this.willDestroy; + }, + mine: 13, + foo: function () { + this; // this: any because of the string indexer + this.mine; + this.willDestroy; + } +}); +simple({ + foo: function (n) { + return n.length + this.bar(); + }, + bar: function () { + return 14; + } +}); diff --git a/tests/baselines/reference/thisTypeInFunctions2.symbols b/tests/baselines/reference/thisTypeInFunctions2.symbols new file mode 100644 index 00000000000..cdc7fb321d4 --- /dev/null +++ b/tests/baselines/reference/thisTypeInFunctions2.symbols @@ -0,0 +1,124 @@ +=== tests/cases/conformance/types/thisType/thisTypeInFunctions2.ts === +interface IndexedWithThis { +>IndexedWithThis : Symbol(IndexedWithThis, Decl(thisTypeInFunctions2.ts, 0, 0)) + + // this is a workaround for React + init?: (this: this) => void; +>init : Symbol(IndexedWithThis.init, Decl(thisTypeInFunctions2.ts, 0, 27)) +>this : Symbol(this, Decl(thisTypeInFunctions2.ts, 2, 12)) + + willDestroy?: (this: any) => void; +>willDestroy : Symbol(IndexedWithThis.willDestroy, Decl(thisTypeInFunctions2.ts, 2, 32)) +>this : Symbol(this, Decl(thisTypeInFunctions2.ts, 3, 19)) + + [propName: string]: number | string | boolean | symbol | undefined | null | {} | ((this: any, ...args:any[]) => any); +>propName : Symbol(propName, Decl(thisTypeInFunctions2.ts, 4, 5)) +>this : Symbol(this, Decl(thisTypeInFunctions2.ts, 4, 87)) +>args : Symbol(args, Decl(thisTypeInFunctions2.ts, 4, 97)) +} +interface IndexedWithoutThis { +>IndexedWithoutThis : Symbol(IndexedWithoutThis, Decl(thisTypeInFunctions2.ts, 5, 1)) + + // this is what React would like to write (and what they write today) + init?: () => void; +>init : Symbol(IndexedWithoutThis.init, Decl(thisTypeInFunctions2.ts, 6, 30)) + + willDestroy?: () => void; +>willDestroy : Symbol(IndexedWithoutThis.willDestroy, Decl(thisTypeInFunctions2.ts, 8, 22)) + + [propName: string]: any; +>propName : Symbol(propName, Decl(thisTypeInFunctions2.ts, 10, 5)) +} +interface SimpleInterface { +>SimpleInterface : Symbol(SimpleInterface, Decl(thisTypeInFunctions2.ts, 11, 1)) + + foo(n: string); +>foo : Symbol(SimpleInterface.foo, Decl(thisTypeInFunctions2.ts, 12, 27)) +>n : Symbol(n, Decl(thisTypeInFunctions2.ts, 13, 8)) + + bar(): number; +>bar : Symbol(SimpleInterface.bar, Decl(thisTypeInFunctions2.ts, 13, 19)) +} +declare function extend1(args: IndexedWithThis): void; +>extend1 : Symbol(extend1, Decl(thisTypeInFunctions2.ts, 15, 1)) +>args : Symbol(args, Decl(thisTypeInFunctions2.ts, 16, 25)) +>IndexedWithThis : Symbol(IndexedWithThis, Decl(thisTypeInFunctions2.ts, 0, 0)) + +declare function extend2(args: IndexedWithoutThis): void; +>extend2 : Symbol(extend2, Decl(thisTypeInFunctions2.ts, 16, 54)) +>args : Symbol(args, Decl(thisTypeInFunctions2.ts, 17, 25)) +>IndexedWithoutThis : Symbol(IndexedWithoutThis, Decl(thisTypeInFunctions2.ts, 5, 1)) + +declare function simple(arg: SimpleInterface): void; +>simple : Symbol(simple, Decl(thisTypeInFunctions2.ts, 17, 57)) +>arg : Symbol(arg, Decl(thisTypeInFunctions2.ts, 18, 24)) +>SimpleInterface : Symbol(SimpleInterface, Decl(thisTypeInFunctions2.ts, 11, 1)) + +extend1({ +>extend1 : Symbol(extend1, Decl(thisTypeInFunctions2.ts, 15, 1)) + + init() { +>init : Symbol(init, Decl(thisTypeInFunctions2.ts, 20, 9)) + + this // this: IndexedWithThis because of contextual typing. +>this : Symbol(IndexedWithThis, Decl(thisTypeInFunctions2.ts, 0, 0)) + + // this.mine + this.willDestroy +>this.willDestroy : Symbol(IndexedWithThis.willDestroy, Decl(thisTypeInFunctions2.ts, 2, 32)) +>this : Symbol(IndexedWithThis, Decl(thisTypeInFunctions2.ts, 0, 0)) +>willDestroy : Symbol(IndexedWithThis.willDestroy, Decl(thisTypeInFunctions2.ts, 2, 32)) + + }, + mine: 12, +>mine : Symbol(mine, Decl(thisTypeInFunctions2.ts, 25, 6)) + + foo() { +>foo : Symbol(foo, Decl(thisTypeInFunctions2.ts, 26, 13)) + + this.url; // this: any because 'foo' matches the string indexer + this.willDestroy; + } +}); +extend2({ +>extend2 : Symbol(extend2, Decl(thisTypeInFunctions2.ts, 16, 54)) + + init() { +>init : Symbol(init, Decl(thisTypeInFunctions2.ts, 32, 9)) + + this // this: any because the contextual signature of init doesn't specify this' type + this.mine + this.willDestroy + }, + mine: 13, +>mine : Symbol(mine, Decl(thisTypeInFunctions2.ts, 37, 6)) + + foo() { +>foo : Symbol(foo, Decl(thisTypeInFunctions2.ts, 38, 13)) + + this // this: any because of the string indexer + this.mine + this.willDestroy + } +}); + +simple({ +>simple : Symbol(simple, Decl(thisTypeInFunctions2.ts, 17, 57)) + + foo(n) { +>foo : Symbol(foo, Decl(thisTypeInFunctions2.ts, 46, 8)) +>n : Symbol(n, Decl(thisTypeInFunctions2.ts, 47, 8)) + + return n.length + this.bar(); +>n.length : Symbol(String.length, Decl(lib.d.ts, --, --)) +>n : Symbol(n, Decl(thisTypeInFunctions2.ts, 47, 8)) +>length : Symbol(String.length, Decl(lib.d.ts, --, --)) + + }, + bar() { +>bar : Symbol(bar, Decl(thisTypeInFunctions2.ts, 49, 6)) + + return 14; + } +}) + diff --git a/tests/baselines/reference/thisTypeInFunctions2.types b/tests/baselines/reference/thisTypeInFunctions2.types new file mode 100644 index 00000000000..371b5f5cafc --- /dev/null +++ b/tests/baselines/reference/thisTypeInFunctions2.types @@ -0,0 +1,165 @@ +=== tests/cases/conformance/types/thisType/thisTypeInFunctions2.ts === +interface IndexedWithThis { +>IndexedWithThis : IndexedWithThis + + // this is a workaround for React + init?: (this: this) => void; +>init : (this: this) => void +>this : this + + willDestroy?: (this: any) => void; +>willDestroy : (this: any) => void +>this : any + + [propName: string]: number | string | boolean | symbol | undefined | null | {} | ((this: any, ...args:any[]) => any); +>propName : string +>null : null +>this : any +>args : any[] +} +interface IndexedWithoutThis { +>IndexedWithoutThis : IndexedWithoutThis + + // this is what React would like to write (and what they write today) + init?: () => void; +>init : () => void + + willDestroy?: () => void; +>willDestroy : () => void + + [propName: string]: any; +>propName : string +} +interface SimpleInterface { +>SimpleInterface : SimpleInterface + + foo(n: string); +>foo : (n: string) => any +>n : string + + bar(): number; +>bar : () => number +} +declare function extend1(args: IndexedWithThis): void; +>extend1 : (args: IndexedWithThis) => void +>args : IndexedWithThis +>IndexedWithThis : IndexedWithThis + +declare function extend2(args: IndexedWithoutThis): void; +>extend2 : (args: IndexedWithoutThis) => void +>args : IndexedWithoutThis +>IndexedWithoutThis : IndexedWithoutThis + +declare function simple(arg: SimpleInterface): void; +>simple : (arg: SimpleInterface) => void +>arg : SimpleInterface +>SimpleInterface : SimpleInterface + +extend1({ +>extend1({ init() { this // this: IndexedWithThis because of contextual typing. // this.mine this.willDestroy }, mine: 12, foo() { this.url; // this: any because 'foo' matches the string indexer this.willDestroy; }}) : void +>extend1 : (args: IndexedWithThis) => void +>{ init() { this // this: IndexedWithThis because of contextual typing. // this.mine this.willDestroy }, mine: 12, foo() { this.url; // this: any because 'foo' matches the string indexer this.willDestroy; }} : { init(): void; mine: number; foo(): void; } + + init() { +>init : () => void + + this // this: IndexedWithThis because of contextual typing. +>this : IndexedWithThis + + // this.mine + this.willDestroy +>this.willDestroy : (this: any) => void +>this : IndexedWithThis +>willDestroy : (this: any) => void + + }, + mine: 12, +>mine : number +>12 : number + + foo() { +>foo : () => void + + this.url; // this: any because 'foo' matches the string indexer +>this.url : any +>this : any +>url : any + + this.willDestroy; +>this.willDestroy : any +>this : any +>willDestroy : any + } +}); +extend2({ +>extend2({ init() { this // this: any because the contextual signature of init doesn't specify this' type this.mine this.willDestroy }, mine: 13, foo() { this // this: any because of the string indexer this.mine this.willDestroy }}) : void +>extend2 : (args: IndexedWithoutThis) => void +>{ init() { this // this: any because the contextual signature of init doesn't specify this' type this.mine this.willDestroy }, mine: 13, foo() { this // this: any because of the string indexer this.mine this.willDestroy }} : { init(): void; mine: number; foo(): void; } + + init() { +>init : () => void + + this // this: any because the contextual signature of init doesn't specify this' type +>this : any + + this.mine +>this.mine : any +>this : any +>mine : any + + this.willDestroy +>this.willDestroy : any +>this : any +>willDestroy : any + + }, + mine: 13, +>mine : number +>13 : number + + foo() { +>foo : () => void + + this // this: any because of the string indexer +>this : any + + this.mine +>this.mine : any +>this : any +>mine : any + + this.willDestroy +>this.willDestroy : any +>this : any +>willDestroy : any + } +}); + +simple({ +>simple({ foo(n) { return n.length + this.bar(); }, bar() { return 14; }}) : void +>simple : (arg: SimpleInterface) => void +>{ foo(n) { return n.length + this.bar(); }, bar() { return 14; }} : { foo(n: string): any; bar(): number; } + + foo(n) { +>foo : (n: string) => any +>n : string + + return n.length + this.bar(); +>n.length + this.bar() : any +>n.length : number +>n : string +>length : number +>this.bar() : any +>this.bar : any +>this : any +>bar : any + + }, + bar() { +>bar : () => number + + return 14; +>14 : number + } +}) + diff --git a/tests/baselines/reference/thisTypeInFunctionsNegative.errors.txt b/tests/baselines/reference/thisTypeInFunctionsNegative.errors.txt new file mode 100644 index 00000000000..564aa2ed926 --- /dev/null +++ b/tests/baselines/reference/thisTypeInFunctionsNegative.errors.txt @@ -0,0 +1,442 @@ +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(16,15): error TS2339: Property 'n' does not exist on type 'void'. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(39,21): error TS2339: Property 'a' does not exist on type 'void'. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(49,1): error TS2684: The 'this' context of type 'void' is not assignable to method's 'this' of type '{ a: number; }'. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(51,1): error TS2684: The 'this' context of type 'void' is not assignable to method's 'this' of type 'I'. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(56,21): error TS2339: Property 'notFound' does not exist on type '{ y: number; }'. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(59,21): error TS2339: Property 'notSpecified' does not exist on type 'void'. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(61,79): error TS2322: Type '{ y: number; explicitStructural: (this: { y: number; }, x: number) => number; }' is not assignable to type '{ y: number; f: (this: { y: number; }, x: number) => number; }'. + Object literal may only specify known properties, and 'explicitStructural' does not exist in type '{ y: number; f: (this: { y: number; }, x: number) => number; }'. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(62,97): error TS2322: Type '{ y: string; explicitStructural: (this: { y: number; }, x: number) => number; }' is not assignable to type '{ y: string; f: (this: { y: number; }, x: number) => number; }'. + Object literal may only specify known properties, and 'explicitStructural' does not exist in type '{ y: string; f: (this: { y: number; }, x: number) => number; }'. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(63,110): error TS2322: Type '{ wrongName: number; explicitStructural: (this: { y: number; }, x: number) => number; }' is not assignable to type '{ wrongName: number; f: (this: { y: number; }, x: number) => number; }'. + Object literal may only specify known properties, and 'explicitStructural' does not exist in type '{ wrongName: number; f: (this: { y: number; }, x: number) => number; }'. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(65,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(66,6): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(67,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(68,1): error TS2684: The 'this' context of type '{ y: string; f: (this: { y: number; }, x: number) => number; }' is not assignable to method's 'this' of type '{ y: number; }'. + Types of property 'y' are incompatible. + Type 'string' is not assignable to type 'number'. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(69,1): error TS2684: The 'this' context of type '{ wrongName: number; f: (this: { y: number; }, x: number) => number; }' is not assignable to method's 'this' of type '{ y: number; }'. + Property 'y' is missing in type '{ wrongName: number; f: (this: { y: number; }, x: number) => number; }'. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(72,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(73,13): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(74,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(75,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(76,16): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(77,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(78,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(79,16): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(80,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(81,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(82,20): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(83,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(86,5): error TS2322: Type '(this: { y: number; }, x: number) => number' is not assignable to type '(this: void, x: number) => number'. + The 'this' types of each signature are incompatible. + Type 'void' is not assignable to type '{ y: number; }'. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(107,1): error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: C, m: number) => number'. + The 'this' types of each signature are incompatible. + Type 'C' is not assignable to type 'D'. + Property 'x' is missing in type 'C'. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(108,1): error TS2322: Type '(this: { x: number; }, m: number) => number' is not assignable to type '(this: { n: number; }, m: number) => number'. + The 'this' types of each signature are incompatible. + Type '{ n: number; }' is not assignable to type '{ x: number; }'. + Property 'x' is missing in type '{ n: number; }'. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(110,1): error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: C, m: number) => number'. + The 'this' types of each signature are incompatible. + Type 'C' is not assignable to type 'D'. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(111,1): error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: C, m: number) => number'. + The 'this' types of each signature are incompatible. + Type 'C' is not assignable to type 'D'. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(112,1): error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: C, m: number) => number'. + The 'this' types of each signature are incompatible. + Type 'C' is not assignable to type 'D'. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(113,1): error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: C, m: number) => number'. + The 'this' types of each signature are incompatible. + Type 'C' is not assignable to type 'D'. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(114,1): error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: { n: number; }, m: number) => number'. + The 'this' types of each signature are incompatible. + Type '{ n: number; }' is not assignable to type 'D'. + Property 'x' is missing in type '{ n: number; }'. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(115,1): error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: C, m: number) => number'. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(116,1): error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: void, m: number) => number'. + The 'this' types of each signature are incompatible. + Type 'void' is not assignable to type 'D'. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(117,1): error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: void, m: number) => number'. + The 'this' types of each signature are incompatible. + Type 'void' is not assignable to type 'D'. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(125,69): error TS2339: Property 'x' does not exist on type 'typeof Base1'. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(145,1): error TS2322: Type '(this: Base2) => number' is not assignable to type '(this: Base1) => number'. + The 'this' types of each signature are incompatible. + Type 'Base1' is not assignable to type 'Base2'. + Property 'y' is missing in type 'Base1'. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(146,1): error TS2322: Type '(this: Base2) => number' is not assignable to type '(this: Base1) => number'. + The 'this' types of each signature are incompatible. + Type 'Base1' is not assignable to type 'Base2'. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(148,1): error TS2322: Type '(this: Base2) => number' is not assignable to type '(this: Base1) => number'. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(154,16): error TS2679: A function that is called with the 'new' keyword cannot have a 'this' type that is 'void'. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(158,17): error TS2681: A constructor cannot have a 'this' parameter. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(162,9): error TS2681: A constructor cannot have a 'this' parameter. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(164,31): error TS2681: A constructor cannot have a 'this' parameter. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(165,30): error TS2680: A 'this' parameter must be the first parameter. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(168,26): error TS1003: Identifier expected. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(168,30): error TS1005: ',' expected. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(169,20): error TS2370: A rest parameter must be of an array type. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(169,23): error TS1003: Identifier expected. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(169,27): error TS1005: ',' expected. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(170,23): error TS1005: ',' expected. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(170,24): error TS1138: Parameter declaration expected. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(171,28): error TS1003: Identifier expected. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(171,32): error TS1005: ',' expected. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(172,30): error TS1005: ',' expected. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(172,32): error TS1138: Parameter declaration expected. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(172,39): error TS1005: ';' expected. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(172,40): error TS1128: Declaration or statement expected. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(172,42): error TS2304: Cannot find name 'number'. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(172,49): error TS1005: ';' expected. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(175,1): error TS7027: Unreachable code detected. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(175,29): error TS2304: Cannot find name 'm'. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(175,32): error TS1005: ';' expected. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(175,35): error TS2304: Cannot find name 'm'. + + +==== tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts (65 errors) ==== + class C { + n: number; + explicitThis(this: this, m: number): number { + return this.n + m; + } + implicitThis(m: number): number { + return this.n + m; + } + explicitC(this: C, m: number): number { + return this.n + m; + } + explicitProperty(this: {n: number}, m: number): number { + return this.n + m; + } + explicitVoid(this: void, m: number): number { + return this.n + m; // 'n' doesn't exist on type 'void'. + ~ +!!! error TS2339: Property 'n' does not exist on type 'void'. + } + } + class D { + x: number; + explicitThis(this: this, m: number): number { + return this.x + m; + } + explicitD(this: D, m: number): number { + return this.x + m; + } + } + interface I { + a: number; + explicitVoid1(this: void): number; + explicitVoid2(this: void): number; + explicitStructural(this: {a: number}): number; + explicitInterface(this: I): number; + explicitThis(this: this): number; // TODO: Allow `this` types for interfaces + } + let impl: I = { + a: 12, + explicitVoid1() { + return this.a; // error, no 'a' in 'void' + ~ +!!! error TS2339: Property 'a' does not exist on type 'void'. + }, + explicitVoid2: () => this.a, // ok, `this:any` because it refers to an outer object + explicitStructural: () => 12, + explicitInterface: () => 12, + explicitThis() { + return this.a; + }, + } + let implExplicitStructural = impl.explicitStructural; + implExplicitStructural(); // error, no 'a' in 'void' + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2684: The 'this' context of type 'void' is not assignable to method's 'this' of type '{ a: number; }'. + let implExplicitInterface = impl.explicitInterface; + implExplicitInterface(); // error, no 'a' in 'void' + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2684: The 'this' context of type 'void' is not assignable to method's 'this' of type 'I'. + function explicitStructural(this: { y: number }, x: number): number { + return x + this.y; + } + function propertyName(this: { y: number }, x: number): number { + return x + this.notFound; + ~~~~~~~~ +!!! error TS2339: Property 'notFound' does not exist on type '{ y: number; }'. + } + function voidThisSpecified(this: void, x: number): number { + return x + this.notSpecified; + ~~~~~~~~~~~~ +!!! error TS2339: Property 'notSpecified' does not exist on type 'void'. + } + let ok: {y: number, f: (this: { y: number }, x: number) => number} = { y: 12, explicitStructural }; + ~~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type '{ y: number; explicitStructural: (this: { y: number; }, x: number) => number; }' is not assignable to type '{ y: number; f: (this: { y: number; }, x: number) => number; }'. +!!! error TS2322: Object literal may only specify known properties, and 'explicitStructural' does not exist in type '{ y: number; f: (this: { y: number; }, x: number) => number; }'. + let wrongPropertyType: {y: string, f: (this: { y: number }, x: number) => number} = { y: 'foo', explicitStructural }; + ~~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type '{ y: string; explicitStructural: (this: { y: number; }, x: number) => number; }' is not assignable to type '{ y: string; f: (this: { y: number; }, x: number) => number; }'. +!!! error TS2322: Object literal may only specify known properties, and 'explicitStructural' does not exist in type '{ y: string; f: (this: { y: number; }, x: number) => number; }'. + let wrongPropertyName: {wrongName: number, f: (this: { y: number }, x: number) => number} = { wrongName: 12, explicitStructural }; + ~~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type '{ wrongName: number; explicitStructural: (this: { y: number; }, x: number) => number; }' is not assignable to type '{ wrongName: number; f: (this: { y: number; }, x: number) => number; }'. +!!! error TS2322: Object literal may only specify known properties, and 'explicitStructural' does not exist in type '{ wrongName: number; f: (this: { y: number; }, x: number) => number; }'. + + ok.f(); // not enough arguments + ~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. + ok.f('wrong type'); + ~~~~~~~~~~~~ +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. + ok.f(13, 'too many arguments'); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. + wrongPropertyType.f(13); + ~~~~~~~~~~~~~~~~~ +!!! error TS2684: The 'this' context of type '{ y: string; f: (this: { y: number; }, x: number) => number; }' is not assignable to method's 'this' of type '{ y: number; }'. +!!! error TS2684: Types of property 'y' are incompatible. +!!! error TS2684: Type 'string' is not assignable to type 'number'. + wrongPropertyName.f(13); + ~~~~~~~~~~~~~~~~~ +!!! error TS2684: The 'this' context of type '{ wrongName: number; f: (this: { y: number; }, x: number) => number; }' is not assignable to method's 'this' of type '{ y: number; }'. +!!! error TS2684: Property 'y' is missing in type '{ wrongName: number; f: (this: { y: number; }, x: number) => number; }'. + + let c = new C(); + c.explicitC(); // not enough arguments + ~~~~~~~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. + c.explicitC('wrong type'); + ~~~~~~~~~~~~ +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. + c.explicitC(13, 'too many arguments'); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. + c.explicitThis(); // not enough arguments + ~~~~~~~~~~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. + c.explicitThis('wrong type 2'); + ~~~~~~~~~~~~~~ +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. + c.explicitThis(14, 'too many arguments 2'); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. + c.implicitThis(); // not enough arguments + ~~~~~~~~~~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. + c.implicitThis('wrong type 2'); + ~~~~~~~~~~~~~~ +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. + c.implicitThis(14, 'too many arguments 2'); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. + c.explicitProperty(); // not enough arguments + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. + c.explicitProperty('wrong type 3'); + ~~~~~~~~~~~~~~ +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. + c.explicitProperty(15, 'too many arguments 3'); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. + + // oops, this triggers contextual typing, which needs to be updated to understand that =>'s `this` is void. + let specifiedToVoid: (this: void, x: number) => number = explicitStructural; + ~~~~~~~~~~~~~~~ +!!! error TS2322: Type '(this: { y: number; }, x: number) => number' is not assignable to type '(this: void, x: number) => number'. +!!! error TS2322: The 'this' types of each signature are incompatible. +!!! error TS2322: Type 'void' is not assignable to type '{ y: number; }'. + + let reconstructed: { + n: number, + explicitThis(this: C, m: number): number, // note: this: this is not allowed in an object literal type. + explicitC(this: C, m: number): number, + explicitProperty: (this: {n : number}, m: number) => number, + explicitVoid(this: void, m: number): number, + } = { + n: 12, + explicitThis: c.explicitThis, + explicitC: c.explicitC, + explicitProperty: c.explicitProperty, + explicitVoid: c.explicitVoid + };; + + // lambdas have this: void for assignability purposes (and this unbound (free) for body checking) + let d = new D(); + let explicitXProperty: (this: { x: number }, m: number) => number; + + // from differing object types + c.explicitC = function(this: D, m: number) { return this.x + m }; + ~~~~~~~~~~~ +!!! error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: C, m: number) => number'. +!!! error TS2322: The 'this' types of each signature are incompatible. +!!! error TS2322: Type 'C' is not assignable to type 'D'. +!!! error TS2322: Property 'x' is missing in type 'C'. + c.explicitProperty = explicitXProperty; + ~~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type '(this: { x: number; }, m: number) => number' is not assignable to type '(this: { n: number; }, m: number) => number'. +!!! error TS2322: The 'this' types of each signature are incompatible. +!!! error TS2322: Type '{ n: number; }' is not assignable to type '{ x: number; }'. +!!! error TS2322: Property 'x' is missing in type '{ n: number; }'. + + c.explicitC = d.explicitD; + ~~~~~~~~~~~ +!!! error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: C, m: number) => number'. +!!! error TS2322: The 'this' types of each signature are incompatible. +!!! error TS2322: Type 'C' is not assignable to type 'D'. + c.explicitC = d.explicitThis; + ~~~~~~~~~~~ +!!! error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: C, m: number) => number'. +!!! error TS2322: The 'this' types of each signature are incompatible. +!!! error TS2322: Type 'C' is not assignable to type 'D'. + c.explicitThis = d.explicitD; + ~~~~~~~~~~~~~~ +!!! error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: C, m: number) => number'. +!!! error TS2322: The 'this' types of each signature are incompatible. +!!! error TS2322: Type 'C' is not assignable to type 'D'. + c.explicitThis = d.explicitThis; + ~~~~~~~~~~~~~~ +!!! error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: C, m: number) => number'. +!!! error TS2322: The 'this' types of each signature are incompatible. +!!! error TS2322: Type 'C' is not assignable to type 'D'. + c.explicitProperty = d.explicitD; + ~~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: { n: number; }, m: number) => number'. +!!! error TS2322: The 'this' types of each signature are incompatible. +!!! error TS2322: Type '{ n: number; }' is not assignable to type 'D'. +!!! error TS2322: Property 'x' is missing in type '{ n: number; }'. + c.explicitThis = d.explicitThis; + ~~~~~~~~~~~~~~ +!!! error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: C, m: number) => number'. + c.explicitVoid = d.explicitD; + ~~~~~~~~~~~~~~ +!!! error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: void, m: number) => number'. +!!! error TS2322: The 'this' types of each signature are incompatible. +!!! error TS2322: Type 'void' is not assignable to type 'D'. + c.explicitVoid = d.explicitThis; + ~~~~~~~~~~~~~~ +!!! error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: void, m: number) => number'. +!!! error TS2322: The 'this' types of each signature are incompatible. +!!! error TS2322: Type 'void' is not assignable to type 'D'. + + /// class-based polymorphic assignability (with inheritance!) /// + + class Base1 { + x: number + public polymorphic(this: this): number { return this.x; } + explicit(this: Base1): number { return this.x; } + static explicitStatic(this: typeof Base1): number { return this.x; } + ~ +!!! error TS2339: Property 'x' does not exist on type 'typeof Base1'. + } + class Derived1 extends Base1 { + y: number + } + class Base2 { + y: number + polymorphic(this: this): number { return this.y; } + explicit(this: Base1): number { return this.x; } + } + class Derived2 extends Base2 { + x: number + } + + + let b1 = new Base1(); + let d1 = new Derived1(); + let b2 = new Base2(); + let d2 = new Derived2(); + + b1.polymorphic = b2.polymorphic // error, 'this.y' not in Base1: { x } + ~~~~~~~~~~~~~~ +!!! error TS2322: Type '(this: Base2) => number' is not assignable to type '(this: Base1) => number'. +!!! error TS2322: The 'this' types of each signature are incompatible. +!!! error TS2322: Type 'Base1' is not assignable to type 'Base2'. +!!! error TS2322: Property 'y' is missing in type 'Base1'. + b1.explicit = b2.polymorphic // error, 'y' not in Base1: { x } + ~~~~~~~~~~~ +!!! error TS2322: Type '(this: Base2) => number' is not assignable to type '(this: Base1) => number'. +!!! error TS2322: The 'this' types of each signature are incompatible. +!!! error TS2322: Type 'Base1' is not assignable to type 'Base2'. + + d1.explicit = b2.polymorphic // error, 'y' not in Base1: { x } + ~~~~~~~~~~~ +!!! error TS2322: Type '(this: Base2) => number' is not assignable to type '(this: Base1) => number'. + + ////// use this-type for construction with new //// + function VoidThis(this: void) { + + } + let voidThis = new VoidThis(); + ~~~~~~~~~~~~~~ +!!! error TS2679: A function that is called with the 'new' keyword cannot have a 'this' type that is 'void'. + + ///// syntax-ish errors ///// + class ThisConstructor { + constructor(this: ThisConstructor, private n: number) { + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2681: A constructor cannot have a 'this' parameter. + } + } + interface ThisConstructorInterface { + new(this: ThisConstructor, n: number); + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2681: A constructor cannot have a 'this' parameter. + } + var thisConstructorType: new (this: number) => number; + ~~~~~~~~~~~~ +!!! error TS2681: A constructor cannot have a 'this' parameter. + function notFirst(a: number, this: C): number { return this.n; } + ~~~~~~~ +!!! error TS2680: A 'this' parameter must be the first parameter. + + ///// parse errors ///// + function modifiers(async this: C): number { return this.n; } + ~~~~ +!!! error TS1003: Identifier expected. + ~ +!!! error TS1005: ',' expected. + function restParam(...this: C): number { return this.n; } + ~~~~~~~ +!!! error TS2370: A rest parameter must be of an array type. + ~~~~ +!!! error TS1003: Identifier expected. + ~ +!!! error TS1005: ',' expected. + function optional(this?: C): number { return this.n; } + ~ +!!! error TS1005: ',' expected. + ~ +!!! error TS1138: Parameter declaration expected. + function decorated(@deco() this: C): number { return this.n; } + ~~~~ +!!! error TS1003: Identifier expected. + ~ +!!! error TS1005: ',' expected. + function initializer(this: C = new C()): number { return this.n; } + ~ +!!! error TS1005: ',' expected. + ~~~ +!!! error TS1138: Parameter declaration expected. + ~ +!!! error TS1005: ';' expected. + ~ +!!! error TS1128: Declaration or statement expected. + ~~~~~~ +!!! error TS2304: Cannot find name 'number'. + ~ +!!! error TS1005: ';' expected. + + // can't name parameters 'this' in a lambda. + c.explicitProperty = (this, m) => m + this.n; + ~ +!!! error TS7027: Unreachable code detected. + ~ +!!! error TS2304: Cannot find name 'm'. + ~~ +!!! error TS1005: ';' expected. + ~ +!!! error TS2304: Cannot find name 'm'. + \ No newline at end of file diff --git a/tests/baselines/reference/thisTypeInFunctionsNegative.js b/tests/baselines/reference/thisTypeInFunctionsNegative.js new file mode 100644 index 00000000000..602c6afefd7 --- /dev/null +++ b/tests/baselines/reference/thisTypeInFunctionsNegative.js @@ -0,0 +1,355 @@ +//// [thisTypeInFunctionsNegative.ts] +class C { + n: number; + explicitThis(this: this, m: number): number { + return this.n + m; + } + implicitThis(m: number): number { + return this.n + m; + } + explicitC(this: C, m: number): number { + return this.n + m; + } + explicitProperty(this: {n: number}, m: number): number { + return this.n + m; + } + explicitVoid(this: void, m: number): number { + return this.n + m; // 'n' doesn't exist on type 'void'. + } +} +class D { + x: number; + explicitThis(this: this, m: number): number { + return this.x + m; + } + explicitD(this: D, m: number): number { + return this.x + m; + } +} +interface I { + a: number; + explicitVoid1(this: void): number; + explicitVoid2(this: void): number; + explicitStructural(this: {a: number}): number; + explicitInterface(this: I): number; + explicitThis(this: this): number; // TODO: Allow `this` types for interfaces +} +let impl: I = { + a: 12, + explicitVoid1() { + return this.a; // error, no 'a' in 'void' + }, + explicitVoid2: () => this.a, // ok, `this:any` because it refers to an outer object + explicitStructural: () => 12, + explicitInterface: () => 12, + explicitThis() { + return this.a; + }, +} +let implExplicitStructural = impl.explicitStructural; +implExplicitStructural(); // error, no 'a' in 'void' +let implExplicitInterface = impl.explicitInterface; +implExplicitInterface(); // error, no 'a' in 'void' +function explicitStructural(this: { y: number }, x: number): number { + return x + this.y; +} +function propertyName(this: { y: number }, x: number): number { + return x + this.notFound; +} +function voidThisSpecified(this: void, x: number): number { + return x + this.notSpecified; +} +let ok: {y: number, f: (this: { y: number }, x: number) => number} = { y: 12, explicitStructural }; +let wrongPropertyType: {y: string, f: (this: { y: number }, x: number) => number} = { y: 'foo', explicitStructural }; +let wrongPropertyName: {wrongName: number, f: (this: { y: number }, x: number) => number} = { wrongName: 12, explicitStructural }; + +ok.f(); // not enough arguments +ok.f('wrong type'); +ok.f(13, 'too many arguments'); +wrongPropertyType.f(13); +wrongPropertyName.f(13); + +let c = new C(); +c.explicitC(); // not enough arguments +c.explicitC('wrong type'); +c.explicitC(13, 'too many arguments'); +c.explicitThis(); // not enough arguments +c.explicitThis('wrong type 2'); +c.explicitThis(14, 'too many arguments 2'); +c.implicitThis(); // not enough arguments +c.implicitThis('wrong type 2'); +c.implicitThis(14, 'too many arguments 2'); +c.explicitProperty(); // not enough arguments +c.explicitProperty('wrong type 3'); +c.explicitProperty(15, 'too many arguments 3'); + +// oops, this triggers contextual typing, which needs to be updated to understand that =>'s `this` is void. +let specifiedToVoid: (this: void, x: number) => number = explicitStructural; + +let reconstructed: { + n: number, + explicitThis(this: C, m: number): number, // note: this: this is not allowed in an object literal type. + explicitC(this: C, m: number): number, + explicitProperty: (this: {n : number}, m: number) => number, + explicitVoid(this: void, m: number): number, +} = { + n: 12, + explicitThis: c.explicitThis, + explicitC: c.explicitC, + explicitProperty: c.explicitProperty, + explicitVoid: c.explicitVoid +};; + +// lambdas have this: void for assignability purposes (and this unbound (free) for body checking) +let d = new D(); +let explicitXProperty: (this: { x: number }, m: number) => number; + +// from differing object types +c.explicitC = function(this: D, m: number) { return this.x + m }; +c.explicitProperty = explicitXProperty; + +c.explicitC = d.explicitD; +c.explicitC = d.explicitThis; +c.explicitThis = d.explicitD; +c.explicitThis = d.explicitThis; +c.explicitProperty = d.explicitD; +c.explicitThis = d.explicitThis; +c.explicitVoid = d.explicitD; +c.explicitVoid = d.explicitThis; + +/// class-based polymorphic assignability (with inheritance!) /// + +class Base1 { + x: number + public polymorphic(this: this): number { return this.x; } + explicit(this: Base1): number { return this.x; } + static explicitStatic(this: typeof Base1): number { return this.x; } +} +class Derived1 extends Base1 { + y: number +} +class Base2 { + y: number + polymorphic(this: this): number { return this.y; } + explicit(this: Base1): number { return this.x; } +} +class Derived2 extends Base2 { + x: number +} + + +let b1 = new Base1(); +let d1 = new Derived1(); +let b2 = new Base2(); +let d2 = new Derived2(); + +b1.polymorphic = b2.polymorphic // error, 'this.y' not in Base1: { x } +b1.explicit = b2.polymorphic // error, 'y' not in Base1: { x } + +d1.explicit = b2.polymorphic // error, 'y' not in Base1: { x } + +////// use this-type for construction with new //// +function VoidThis(this: void) { + +} +let voidThis = new VoidThis(); + +///// syntax-ish errors ///// +class ThisConstructor { + constructor(this: ThisConstructor, private n: number) { + } +} +interface ThisConstructorInterface { + new(this: ThisConstructor, n: number); +} +var thisConstructorType: new (this: number) => number; +function notFirst(a: number, this: C): number { return this.n; } + +///// parse errors ///// +function modifiers(async this: C): number { return this.n; } +function restParam(...this: C): number { return this.n; } +function optional(this?: C): number { return this.n; } +function decorated(@deco() this: C): number { return this.n; } +function initializer(this: C = new C()): number { return this.n; } + +// can't name parameters 'this' in a lambda. +c.explicitProperty = (this, m) => m + this.n; + + +//// [thisTypeInFunctionsNegative.js] +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var _this = this; +var C = (function () { + function C() { + } + C.prototype.explicitThis = function (m) { + return this.n + m; + }; + C.prototype.implicitThis = function (m) { + return this.n + m; + }; + C.prototype.explicitC = function (m) { + return this.n + m; + }; + C.prototype.explicitProperty = function (m) { + return this.n + m; + }; + C.prototype.explicitVoid = function (m) { + return this.n + m; // 'n' doesn't exist on type 'void'. + }; + return C; +}()); +var D = (function () { + function D() { + } + D.prototype.explicitThis = function (m) { + return this.x + m; + }; + D.prototype.explicitD = function (m) { + return this.x + m; + }; + return D; +}()); +var impl = { + a: 12, + explicitVoid1: function () { + return this.a; // error, no 'a' in 'void' + }, + explicitVoid2: function () { return _this.a; }, + explicitStructural: function () { return 12; }, + explicitInterface: function () { return 12; }, + explicitThis: function () { + return this.a; + } +}; +var implExplicitStructural = impl.explicitStructural; +implExplicitStructural(); // error, no 'a' in 'void' +var implExplicitInterface = impl.explicitInterface; +implExplicitInterface(); // error, no 'a' in 'void' +function explicitStructural(x) { + return x + this.y; +} +function propertyName(x) { + return x + this.notFound; +} +function voidThisSpecified(x) { + return x + this.notSpecified; +} +var ok = { y: 12, explicitStructural: explicitStructural }; +var wrongPropertyType = { y: 'foo', explicitStructural: explicitStructural }; +var wrongPropertyName = { wrongName: 12, explicitStructural: explicitStructural }; +ok.f(); // not enough arguments +ok.f('wrong type'); +ok.f(13, 'too many arguments'); +wrongPropertyType.f(13); +wrongPropertyName.f(13); +var c = new C(); +c.explicitC(); // not enough arguments +c.explicitC('wrong type'); +c.explicitC(13, 'too many arguments'); +c.explicitThis(); // not enough arguments +c.explicitThis('wrong type 2'); +c.explicitThis(14, 'too many arguments 2'); +c.implicitThis(); // not enough arguments +c.implicitThis('wrong type 2'); +c.implicitThis(14, 'too many arguments 2'); +c.explicitProperty(); // not enough arguments +c.explicitProperty('wrong type 3'); +c.explicitProperty(15, 'too many arguments 3'); +// oops, this triggers contextual typing, which needs to be updated to understand that =>'s `this` is void. +var specifiedToVoid = explicitStructural; +var reconstructed = { + n: 12, + explicitThis: c.explicitThis, + explicitC: c.explicitC, + explicitProperty: c.explicitProperty, + explicitVoid: c.explicitVoid +}; +; +// lambdas have this: void for assignability purposes (and this unbound (free) for body checking) +var d = new D(); +var explicitXProperty; +// from differing object types +c.explicitC = function (m) { return this.x + m; }; +c.explicitProperty = explicitXProperty; +c.explicitC = d.explicitD; +c.explicitC = d.explicitThis; +c.explicitThis = d.explicitD; +c.explicitThis = d.explicitThis; +c.explicitProperty = d.explicitD; +c.explicitThis = d.explicitThis; +c.explicitVoid = d.explicitD; +c.explicitVoid = d.explicitThis; +/// class-based polymorphic assignability (with inheritance!) /// +var Base1 = (function () { + function Base1() { + } + Base1.prototype.polymorphic = function () { return this.x; }; + Base1.prototype.explicit = function () { return this.x; }; + Base1.explicitStatic = function () { return this.x; }; + return Base1; +}()); +var Derived1 = (function (_super) { + __extends(Derived1, _super); + function Derived1() { + _super.apply(this, arguments); + } + return Derived1; +}(Base1)); +var Base2 = (function () { + function Base2() { + } + Base2.prototype.polymorphic = function () { return this.y; }; + Base2.prototype.explicit = function () { return this.x; }; + return Base2; +}()); +var Derived2 = (function (_super) { + __extends(Derived2, _super); + function Derived2() { + _super.apply(this, arguments); + } + return Derived2; +}(Base2)); +var b1 = new Base1(); +var d1 = new Derived1(); +var b2 = new Base2(); +var d2 = new Derived2(); +b1.polymorphic = b2.polymorphic; // error, 'this.y' not in Base1: { x } +b1.explicit = b2.polymorphic; // error, 'y' not in Base1: { x } +d1.explicit = b2.polymorphic; // error, 'y' not in Base1: { x } +////// use this-type for construction with new //// +function VoidThis() { +} +var voidThis = new VoidThis(); +///// syntax-ish errors ///// +var ThisConstructor = (function () { + function ThisConstructor(n) { + this.n = n; + } + return ThisConstructor; +}()); +var thisConstructorType; +function notFirst(a, this) { return this.n; } +///// parse errors ///// +function modifiers(, C) { + if ( === void 0) { = this; } + return this.n; +} +function restParam(, C) { return this.n; } +function optional(C) { return this.n; } +function decorated(, C) { + if ( === void 0) { = this; } + return this.n; +} +new C(); +number; +{ + return this.n; +} +// can't name parameters 'this' in a lambda. +c.explicitProperty = (this, m); +m + this.n; diff --git a/tests/baselines/reference/thisTypeInInterfaces.symbols b/tests/baselines/reference/thisTypeInInterfaces.symbols index 4ab896ae6f6..286447a7083 100644 --- a/tests/baselines/reference/thisTypeInInterfaces.symbols +++ b/tests/baselines/reference/thisTypeInInterfaces.symbols @@ -3,10 +3,10 @@ interface I1 { >I1 : Symbol(I1, Decl(thisTypeInInterfaces.ts, 0, 0)) x: this; ->x : Symbol(x, Decl(thisTypeInInterfaces.ts, 0, 14)) +>x : Symbol(I1.x, Decl(thisTypeInInterfaces.ts, 0, 14)) f(x: this): this; ->f : Symbol(f, Decl(thisTypeInInterfaces.ts, 1, 12)) +>f : Symbol(I1.f, Decl(thisTypeInInterfaces.ts, 1, 12)) >x : Symbol(x, Decl(thisTypeInInterfaces.ts, 2, 6)) } @@ -28,51 +28,51 @@ interface Foo { >T : Symbol(T, Decl(thisTypeInInterfaces.ts, 11, 14)) x: T; ->x : Symbol(x, Decl(thisTypeInInterfaces.ts, 11, 18)) +>x : Symbol(Foo.x, Decl(thisTypeInInterfaces.ts, 11, 18)) >T : Symbol(T, Decl(thisTypeInInterfaces.ts, 11, 14)) y: this; ->y : Symbol(y, Decl(thisTypeInInterfaces.ts, 12, 9)) +>y : Symbol(Foo.y, Decl(thisTypeInInterfaces.ts, 12, 9)) } interface I3 { >I3 : Symbol(I3, Decl(thisTypeInInterfaces.ts, 14, 1)) a: this[]; ->a : Symbol(a, Decl(thisTypeInInterfaces.ts, 16, 14)) +>a : Symbol(I3.a, Decl(thisTypeInInterfaces.ts, 16, 14)) b: [this, this]; ->b : Symbol(b, Decl(thisTypeInInterfaces.ts, 17, 14)) +>b : Symbol(I3.b, Decl(thisTypeInInterfaces.ts, 17, 14)) c: this | Date; ->c : Symbol(c, Decl(thisTypeInInterfaces.ts, 18, 20)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>c : Symbol(I3.c, Decl(thisTypeInInterfaces.ts, 18, 20)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) d: this & Date; ->d : Symbol(d, Decl(thisTypeInInterfaces.ts, 19, 19)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>d : Symbol(I3.d, Decl(thisTypeInInterfaces.ts, 19, 19)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) e: (((this))); ->e : Symbol(e, Decl(thisTypeInInterfaces.ts, 20, 19)) +>e : Symbol(I3.e, Decl(thisTypeInInterfaces.ts, 20, 19)) f: (x: this) => this; ->f : Symbol(f, Decl(thisTypeInInterfaces.ts, 21, 18)) +>f : Symbol(I3.f, Decl(thisTypeInInterfaces.ts, 21, 18)) >x : Symbol(x, Decl(thisTypeInInterfaces.ts, 22, 8)) g: new (x: this) => this; ->g : Symbol(g, Decl(thisTypeInInterfaces.ts, 22, 25)) +>g : Symbol(I3.g, Decl(thisTypeInInterfaces.ts, 22, 25)) >x : Symbol(x, Decl(thisTypeInInterfaces.ts, 23, 12)) h: Foo; ->h : Symbol(h, Decl(thisTypeInInterfaces.ts, 23, 29)) +>h : Symbol(I3.h, Decl(thisTypeInInterfaces.ts, 23, 29)) >Foo : Symbol(Foo, Decl(thisTypeInInterfaces.ts, 9, 1)) i: Foo this)>; ->i : Symbol(i, Decl(thisTypeInInterfaces.ts, 24, 17)) +>i : Symbol(I3.i, Decl(thisTypeInInterfaces.ts, 24, 17)) >Foo : Symbol(Foo, Decl(thisTypeInInterfaces.ts, 9, 1)) j: (x: any) => x is this; ->j : Symbol(j, Decl(thisTypeInInterfaces.ts, 25, 32)) +>j : Symbol(I3.j, Decl(thisTypeInInterfaces.ts, 25, 32)) >x : Symbol(x, Decl(thisTypeInInterfaces.ts, 26, 8)) >x : Symbol(x, Decl(thisTypeInInterfaces.ts, 26, 8)) } diff --git a/tests/baselines/reference/thisTypeInObjectLiterals.js b/tests/baselines/reference/thisTypeInObjectLiterals.js new file mode 100644 index 00000000000..342c9d58c84 --- /dev/null +++ b/tests/baselines/reference/thisTypeInObjectLiterals.js @@ -0,0 +1,63 @@ +//// [thisTypeInObjectLiterals.ts] +let o = { + d: "bar", + m() { + return this.d.length; + }, + f: function() { + return this.d.length; + } +} + +let mutuallyRecursive = { + a: 100, + start() { + return this.passthrough(this.a); + }, + passthrough(n: number) { + return this.sub1(n); + }, + sub1(n: number): number { + if (n > 0) { + return this.passthrough(n - 1); + } + return n; + } +} +var i: number = mutuallyRecursive.start(); +interface I { + a: number; + start(): number; + passthrough(n: number): number; + sub1(n: number): number; +} +var impl: I = mutuallyRecursive; + + +//// [thisTypeInObjectLiterals.js] +var o = { + d: "bar", + m: function () { + return this.d.length; + }, + f: function () { + return this.d.length; + } +}; +var mutuallyRecursive = { + a: 100, + start: function () { + return this.passthrough(this.a); + }, + passthrough: function (n) { + return this.sub1(n); + }, + sub1: function (n) { + if (n > 0) { + return this.passthrough(n - 1); + } + return n; + } +}; +var i = mutuallyRecursive.start(); +var impl = mutuallyRecursive; diff --git a/tests/baselines/reference/thisTypeInObjectLiterals.symbols b/tests/baselines/reference/thisTypeInObjectLiterals.symbols new file mode 100644 index 00000000000..af4badf1c0f --- /dev/null +++ b/tests/baselines/reference/thisTypeInObjectLiterals.symbols @@ -0,0 +1,80 @@ +=== tests/cases/conformance/types/thisType/thisTypeInObjectLiterals.ts === +let o = { +>o : Symbol(o, Decl(thisTypeInObjectLiterals.ts, 0, 3)) + + d: "bar", +>d : Symbol(d, Decl(thisTypeInObjectLiterals.ts, 0, 9)) + + m() { +>m : Symbol(m, Decl(thisTypeInObjectLiterals.ts, 1, 13)) + + return this.d.length; + }, + f: function() { +>f : Symbol(f, Decl(thisTypeInObjectLiterals.ts, 4, 6)) + + return this.d.length; + } +} + +let mutuallyRecursive = { +>mutuallyRecursive : Symbol(mutuallyRecursive, Decl(thisTypeInObjectLiterals.ts, 10, 3)) + + a: 100, +>a : Symbol(a, Decl(thisTypeInObjectLiterals.ts, 10, 25)) + + start() { +>start : Symbol(start, Decl(thisTypeInObjectLiterals.ts, 11, 11)) + + return this.passthrough(this.a); + }, + passthrough(n: number) { +>passthrough : Symbol(passthrough, Decl(thisTypeInObjectLiterals.ts, 14, 6)) +>n : Symbol(n, Decl(thisTypeInObjectLiterals.ts, 15, 16)) + + return this.sub1(n); +>n : Symbol(n, Decl(thisTypeInObjectLiterals.ts, 15, 16)) + + }, + sub1(n: number): number { +>sub1 : Symbol(sub1, Decl(thisTypeInObjectLiterals.ts, 17, 6)) +>n : Symbol(n, Decl(thisTypeInObjectLiterals.ts, 18, 9)) + + if (n > 0) { +>n : Symbol(n, Decl(thisTypeInObjectLiterals.ts, 18, 9)) + + return this.passthrough(n - 1); +>n : Symbol(n, Decl(thisTypeInObjectLiterals.ts, 18, 9)) + } + return n; +>n : Symbol(n, Decl(thisTypeInObjectLiterals.ts, 18, 9)) + } +} +var i: number = mutuallyRecursive.start(); +>i : Symbol(i, Decl(thisTypeInObjectLiterals.ts, 25, 3)) +>mutuallyRecursive.start : Symbol(start, Decl(thisTypeInObjectLiterals.ts, 11, 11)) +>mutuallyRecursive : Symbol(mutuallyRecursive, Decl(thisTypeInObjectLiterals.ts, 10, 3)) +>start : Symbol(start, Decl(thisTypeInObjectLiterals.ts, 11, 11)) + +interface I { +>I : Symbol(I, Decl(thisTypeInObjectLiterals.ts, 25, 42)) + + a: number; +>a : Symbol(I.a, Decl(thisTypeInObjectLiterals.ts, 26, 13)) + + start(): number; +>start : Symbol(I.start, Decl(thisTypeInObjectLiterals.ts, 27, 14)) + + passthrough(n: number): number; +>passthrough : Symbol(I.passthrough, Decl(thisTypeInObjectLiterals.ts, 28, 20)) +>n : Symbol(n, Decl(thisTypeInObjectLiterals.ts, 29, 16)) + + sub1(n: number): number; +>sub1 : Symbol(I.sub1, Decl(thisTypeInObjectLiterals.ts, 29, 35)) +>n : Symbol(n, Decl(thisTypeInObjectLiterals.ts, 30, 9)) +} +var impl: I = mutuallyRecursive; +>impl : Symbol(impl, Decl(thisTypeInObjectLiterals.ts, 32, 3)) +>I : Symbol(I, Decl(thisTypeInObjectLiterals.ts, 25, 42)) +>mutuallyRecursive : Symbol(mutuallyRecursive, Decl(thisTypeInObjectLiterals.ts, 10, 3)) + diff --git a/tests/baselines/reference/thisTypeInObjectLiterals.types b/tests/baselines/reference/thisTypeInObjectLiterals.types new file mode 100644 index 00000000000..91d95d5f0a8 --- /dev/null +++ b/tests/baselines/reference/thisTypeInObjectLiterals.types @@ -0,0 +1,117 @@ +=== tests/cases/conformance/types/thisType/thisTypeInObjectLiterals.ts === +let o = { +>o : { d: string; m(): any; f: () => any; } +>{ d: "bar", m() { return this.d.length; }, f: function() { return this.d.length; }} : { d: string; m(): any; f: () => any; } + + d: "bar", +>d : string +>"bar" : string + + m() { +>m : () => any + + return this.d.length; +>this.d.length : any +>this.d : any +>this : any +>d : any +>length : any + + }, + f: function() { +>f : () => any +>function() { return this.d.length; } : () => any + + return this.d.length; +>this.d.length : any +>this.d : any +>this : any +>d : any +>length : any + } +} + +let mutuallyRecursive = { +>mutuallyRecursive : { a: number; start(): any; passthrough(n: number): any; sub1(n: number): number; } +>{ a: 100, start() { return this.passthrough(this.a); }, passthrough(n: number) { return this.sub1(n); }, sub1(n: number): number { if (n > 0) { return this.passthrough(n - 1); } return n; }} : { a: number; start(): any; passthrough(n: number): any; sub1(n: number): number; } + + a: 100, +>a : number +>100 : number + + start() { +>start : () => any + + return this.passthrough(this.a); +>this.passthrough(this.a) : any +>this.passthrough : any +>this : any +>passthrough : any +>this.a : any +>this : any +>a : any + + }, + passthrough(n: number) { +>passthrough : (n: number) => any +>n : number + + return this.sub1(n); +>this.sub1(n) : any +>this.sub1 : any +>this : any +>sub1 : any +>n : number + + }, + sub1(n: number): number { +>sub1 : (n: number) => number +>n : number + + if (n > 0) { +>n > 0 : boolean +>n : number +>0 : number + + return this.passthrough(n - 1); +>this.passthrough(n - 1) : any +>this.passthrough : any +>this : any +>passthrough : any +>n - 1 : number +>n : number +>1 : number + } + return n; +>n : number + } +} +var i: number = mutuallyRecursive.start(); +>i : number +>mutuallyRecursive.start() : any +>mutuallyRecursive.start : () => any +>mutuallyRecursive : { a: number; start(): any; passthrough(n: number): any; sub1(n: number): number; } +>start : () => any + +interface I { +>I : I + + a: number; +>a : number + + start(): number; +>start : () => number + + passthrough(n: number): number; +>passthrough : (n: number) => number +>n : number + + sub1(n: number): number; +>sub1 : (n: number) => number +>n : number +} +var impl: I = mutuallyRecursive; +>impl : I +>I : I +>mutuallyRecursive : { a: number; start(): any; passthrough(n: number): any; sub1(n: number): number; } + diff --git a/tests/baselines/reference/thisTypeInTuples.symbols b/tests/baselines/reference/thisTypeInTuples.symbols index 256f182dd69..44f8660f691 100644 --- a/tests/baselines/reference/thisTypeInTuples.symbols +++ b/tests/baselines/reference/thisTypeInTuples.symbols @@ -4,7 +4,7 @@ interface Array { >T : Symbol(T, Decl(lib.d.ts, --, --), Decl(thisTypeInTuples.ts, 0, 16)) slice(): this; ->slice : Symbol(slice, Decl(lib.d.ts, --, --), Decl(thisTypeInTuples.ts, 0, 20)) +>slice : Symbol(Array.slice, Decl(lib.d.ts, --, --), Decl(thisTypeInTuples.ts, 0, 20)) } let t: [number, string] = [42, "hello"]; diff --git a/tests/baselines/reference/throwInEnclosingStatements.symbols b/tests/baselines/reference/throwInEnclosingStatements.symbols index 42053c60efa..63ed9dde578 100644 --- a/tests/baselines/reference/throwInEnclosingStatements.symbols +++ b/tests/baselines/reference/throwInEnclosingStatements.symbols @@ -61,16 +61,16 @@ class C { >T : Symbol(T, Decl(throwInEnclosingStatements.ts, 29, 8)) private value: T; ->value : Symbol(value, Decl(throwInEnclosingStatements.ts, 29, 12)) +>value : Symbol(C.value, Decl(throwInEnclosingStatements.ts, 29, 12)) >T : Symbol(T, Decl(throwInEnclosingStatements.ts, 29, 8)) biz() { ->biz : Symbol(biz, Decl(throwInEnclosingStatements.ts, 30, 21)) +>biz : Symbol(C.biz, Decl(throwInEnclosingStatements.ts, 30, 21)) throw this.value; ->this.value : Symbol(value, Decl(throwInEnclosingStatements.ts, 29, 12)) +>this.value : Symbol(C.value, Decl(throwInEnclosingStatements.ts, 29, 12)) >this : Symbol(C, Decl(throwInEnclosingStatements.ts, 27, 26)) ->value : Symbol(value, Decl(throwInEnclosingStatements.ts, 29, 12)) +>value : Symbol(C.value, Decl(throwInEnclosingStatements.ts, 29, 12)) } constructor() { diff --git a/tests/baselines/reference/throwInEnclosingStatements.types b/tests/baselines/reference/throwInEnclosingStatements.types index 568fd800e35..26866ebb240 100644 --- a/tests/baselines/reference/throwInEnclosingStatements.types +++ b/tests/baselines/reference/throwInEnclosingStatements.types @@ -1,7 +1,7 @@ === tests/cases/conformance/statements/throwStatements/throwInEnclosingStatements.ts === function fn(x) { ->fn : (x: any) => void +>fn : (x: any) => never >x : any throw x; @@ -9,7 +9,7 @@ function fn(x) { } (x: T) => { throw x; } ->(x: T) => { throw x; } : (x: T) => void +>(x: T) => { throw x; } : (x: T) => never >T : T >x : T >T : T @@ -51,9 +51,9 @@ for (var i = 0; ;) { throw i; } >i : number for (var idx in {}) { throw idx; } ->idx : any +>idx : string >{} : {} ->idx : any +>idx : string do { throw null; }while(true) >null : null @@ -78,7 +78,7 @@ class C { >T : T biz() { ->biz : () => void +>biz : () => never throw this.value; >this.value : T @@ -93,15 +93,15 @@ class C { } var aa = { ->aa : { id: number; biz(): void; } ->{ id:12, biz() { throw this; }} : { id: number; biz(): void; } +>aa : { id: number; biz(): never; } +>{ id:12, biz() { throw this; }} : { id: number; biz(): never; } id:12, >id : number >12 : number biz() { ->biz : () => void +>biz : () => never throw this; >this : any diff --git a/tests/baselines/reference/throwStatements.symbols b/tests/baselines/reference/throwStatements.symbols index adf9cb461cf..854fbcbe90b 100644 --- a/tests/baselines/reference/throwStatements.symbols +++ b/tests/baselines/reference/throwStatements.symbols @@ -6,7 +6,7 @@ interface I { >I : Symbol(I, Decl(throwStatements.ts, 0, 0)) id: number; ->id : Symbol(id, Decl(throwStatements.ts, 3, 13)) +>id : Symbol(I.id, Decl(throwStatements.ts, 3, 13)) } class C implements I { @@ -14,7 +14,7 @@ class C implements I { >I : Symbol(I, Decl(throwStatements.ts, 0, 0)) id: number; ->id : Symbol(id, Decl(throwStatements.ts, 7, 22)) +>id : Symbol(C.id, Decl(throwStatements.ts, 7, 22)) } class D{ @@ -22,16 +22,16 @@ class D{ >T : Symbol(T, Decl(throwStatements.ts, 11, 8)) source: T; ->source : Symbol(source, Decl(throwStatements.ts, 11, 11)) +>source : Symbol(D.source, Decl(throwStatements.ts, 11, 11)) >T : Symbol(T, Decl(throwStatements.ts, 11, 8)) recurse: D; ->recurse : Symbol(recurse, Decl(throwStatements.ts, 12, 14)) +>recurse : Symbol(D.recurse, Decl(throwStatements.ts, 12, 14)) >D : Symbol(D, Decl(throwStatements.ts, 9, 1)) >T : Symbol(T, Decl(throwStatements.ts, 11, 8)) wrapped: D> ->wrapped : Symbol(wrapped, Decl(throwStatements.ts, 13, 18)) +>wrapped : Symbol(D.wrapped, Decl(throwStatements.ts, 13, 18)) >D : Symbol(D, Decl(throwStatements.ts, 9, 1)) >D : Symbol(D, Decl(throwStatements.ts, 9, 1)) >T : Symbol(T, Decl(throwStatements.ts, 11, 8)) @@ -48,7 +48,7 @@ module M { >A : Symbol(A, Decl(throwStatements.ts, 19, 10)) name: string; ->name : Symbol(name, Decl(throwStatements.ts, 20, 20)) +>name : Symbol(A.name, Decl(throwStatements.ts, 20, 20)) } export function F2(x: number): string { return x.toString(); } @@ -73,7 +73,7 @@ throw aString; var aDate = new Date(12); >aDate : Symbol(aDate, Decl(throwStatements.ts, 31, 3)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) throw aDate; >aDate : Symbol(aDate, Decl(throwStatements.ts, 31, 3)) @@ -203,7 +203,7 @@ throw []; throw ['a', ['b']]; throw /[a-z]/; throw new Date(); ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) throw new C(); >C : Symbol(C, Decl(throwStatements.ts, 5, 1)) diff --git a/tests/baselines/reference/tooFewArgumentsInGenericFunctionTypedArgument.symbols b/tests/baselines/reference/tooFewArgumentsInGenericFunctionTypedArgument.symbols index 752e75d4901..9a6549577d2 100644 --- a/tests/baselines/reference/tooFewArgumentsInGenericFunctionTypedArgument.symbols +++ b/tests/baselines/reference/tooFewArgumentsInGenericFunctionTypedArgument.symbols @@ -5,17 +5,17 @@ interface Collection { >U : Symbol(U, Decl(tooFewArgumentsInGenericFunctionTypedArgument.ts, 0, 23)) length: number; ->length : Symbol(length, Decl(tooFewArgumentsInGenericFunctionTypedArgument.ts, 0, 28)) +>length : Symbol(Collection.length, Decl(tooFewArgumentsInGenericFunctionTypedArgument.ts, 0, 28)) add(x: T, y: U): void; ->add : Symbol(add, Decl(tooFewArgumentsInGenericFunctionTypedArgument.ts, 1, 19)) +>add : Symbol(Collection.add, Decl(tooFewArgumentsInGenericFunctionTypedArgument.ts, 1, 19)) >x : Symbol(x, Decl(tooFewArgumentsInGenericFunctionTypedArgument.ts, 2, 8)) >T : Symbol(T, Decl(tooFewArgumentsInGenericFunctionTypedArgument.ts, 0, 21)) >y : Symbol(y, Decl(tooFewArgumentsInGenericFunctionTypedArgument.ts, 2, 13)) >U : Symbol(U, Decl(tooFewArgumentsInGenericFunctionTypedArgument.ts, 0, 23)) remove(x: T, y: U): boolean; ->remove : Symbol(remove, Decl(tooFewArgumentsInGenericFunctionTypedArgument.ts, 2, 26)) +>remove : Symbol(Collection.remove, Decl(tooFewArgumentsInGenericFunctionTypedArgument.ts, 2, 26)) >x : Symbol(x, Decl(tooFewArgumentsInGenericFunctionTypedArgument.ts, 3, 11)) >T : Symbol(T, Decl(tooFewArgumentsInGenericFunctionTypedArgument.ts, 0, 21)) >y : Symbol(y, Decl(tooFewArgumentsInGenericFunctionTypedArgument.ts, 3, 16)) @@ -25,7 +25,7 @@ interface Combinators { >Combinators : Symbol(Combinators, Decl(tooFewArgumentsInGenericFunctionTypedArgument.ts, 4, 1)) map(c: Collection, f: (x: T, y: U) => V): Collection; ->map : Symbol(map, Decl(tooFewArgumentsInGenericFunctionTypedArgument.ts, 5, 23), Decl(tooFewArgumentsInGenericFunctionTypedArgument.ts, 6, 77)) +>map : Symbol(Combinators.map, Decl(tooFewArgumentsInGenericFunctionTypedArgument.ts, 5, 23), Decl(tooFewArgumentsInGenericFunctionTypedArgument.ts, 6, 77)) >T : Symbol(T, Decl(tooFewArgumentsInGenericFunctionTypedArgument.ts, 6, 8)) >U : Symbol(U, Decl(tooFewArgumentsInGenericFunctionTypedArgument.ts, 6, 10)) >V : Symbol(V, Decl(tooFewArgumentsInGenericFunctionTypedArgument.ts, 6, 13)) @@ -44,7 +44,7 @@ interface Combinators { >V : Symbol(V, Decl(tooFewArgumentsInGenericFunctionTypedArgument.ts, 6, 13)) map(c: Collection, f: (x: T, y: U) => any): Collection; ->map : Symbol(map, Decl(tooFewArgumentsInGenericFunctionTypedArgument.ts, 5, 23), Decl(tooFewArgumentsInGenericFunctionTypedArgument.ts, 6, 77)) +>map : Symbol(Combinators.map, Decl(tooFewArgumentsInGenericFunctionTypedArgument.ts, 5, 23), Decl(tooFewArgumentsInGenericFunctionTypedArgument.ts, 6, 77)) >T : Symbol(T, Decl(tooFewArgumentsInGenericFunctionTypedArgument.ts, 7, 8)) >U : Symbol(U, Decl(tooFewArgumentsInGenericFunctionTypedArgument.ts, 7, 10)) >c : Symbol(c, Decl(tooFewArgumentsInGenericFunctionTypedArgument.ts, 7, 14)) diff --git a/tests/baselines/reference/topLevel.symbols b/tests/baselines/reference/topLevel.symbols index ebca65a13cf..a98b51d2b87 100644 --- a/tests/baselines/reference/topLevel.symbols +++ b/tests/baselines/reference/topLevel.symbols @@ -3,10 +3,10 @@ interface IPoint { >IPoint : Symbol(IPoint, Decl(topLevel.ts, 0, 0)) x:number; ->x : Symbol(x, Decl(topLevel.ts, 0, 18)) +>x : Symbol(IPoint.x, Decl(topLevel.ts, 0, 18)) y:number; ->y : Symbol(y, Decl(topLevel.ts, 1, 13)) +>y : Symbol(IPoint.y, Decl(topLevel.ts, 1, 13)) } class Point implements IPoint { @@ -14,39 +14,39 @@ class Point implements IPoint { >IPoint : Symbol(IPoint, Decl(topLevel.ts, 0, 0)) constructor(public x,public y){} ->x : Symbol(x, Decl(topLevel.ts, 6, 16)) ->y : Symbol(y, Decl(topLevel.ts, 6, 25)) +>x : Symbol(Point.x, Decl(topLevel.ts, 6, 16)) +>y : Symbol(Point.y, Decl(topLevel.ts, 6, 25)) public move(xo:number,yo:number) { ->move : Symbol(move, Decl(topLevel.ts, 6, 36)) +>move : Symbol(Point.move, Decl(topLevel.ts, 6, 36)) >xo : Symbol(xo, Decl(topLevel.ts, 7, 16)) >yo : Symbol(yo, Decl(topLevel.ts, 7, 26)) this.x+=xo; ->this.x : Symbol(x, Decl(topLevel.ts, 6, 16)) +>this.x : Symbol(Point.x, Decl(topLevel.ts, 6, 16)) >this : Symbol(Point, Decl(topLevel.ts, 3, 1)) ->x : Symbol(x, Decl(topLevel.ts, 6, 16)) +>x : Symbol(Point.x, Decl(topLevel.ts, 6, 16)) >xo : Symbol(xo, Decl(topLevel.ts, 7, 16)) this.y+=yo; ->this.y : Symbol(y, Decl(topLevel.ts, 6, 25)) +>this.y : Symbol(Point.y, Decl(topLevel.ts, 6, 25)) >this : Symbol(Point, Decl(topLevel.ts, 3, 1)) ->y : Symbol(y, Decl(topLevel.ts, 6, 25)) +>y : Symbol(Point.y, Decl(topLevel.ts, 6, 25)) >yo : Symbol(yo, Decl(topLevel.ts, 7, 26)) return this; >this : Symbol(Point, Decl(topLevel.ts, 3, 1)) } public toString() { ->toString : Symbol(toString, Decl(topLevel.ts, 11, 5)) +>toString : Symbol(Point.toString, Decl(topLevel.ts, 11, 5)) return ("("+this.x+","+this.y+")"); ->this.x : Symbol(x, Decl(topLevel.ts, 6, 16)) +>this.x : Symbol(Point.x, Decl(topLevel.ts, 6, 16)) >this : Symbol(Point, Decl(topLevel.ts, 3, 1)) ->x : Symbol(x, Decl(topLevel.ts, 6, 16)) ->this.y : Symbol(y, Decl(topLevel.ts, 6, 25)) +>x : Symbol(Point.x, Decl(topLevel.ts, 6, 16)) +>this.y : Symbol(Point.y, Decl(topLevel.ts, 6, 25)) >this : Symbol(Point, Decl(topLevel.ts, 3, 1)) ->y : Symbol(y, Decl(topLevel.ts, 6, 25)) +>y : Symbol(Point.y, Decl(topLevel.ts, 6, 25)) } } diff --git a/tests/baselines/reference/transitiveTypeArgumentInference1.symbols b/tests/baselines/reference/transitiveTypeArgumentInference1.symbols index 625857e11be..912e0d94f35 100644 --- a/tests/baselines/reference/transitiveTypeArgumentInference1.symbols +++ b/tests/baselines/reference/transitiveTypeArgumentInference1.symbols @@ -5,7 +5,7 @@ interface I1 { >U : Symbol(U, Decl(transitiveTypeArgumentInference1.ts, 0, 15)) m(value: T): U; ->m : Symbol(m, Decl(transitiveTypeArgumentInference1.ts, 0, 20)) +>m : Symbol(I1.m, Decl(transitiveTypeArgumentInference1.ts, 0, 20)) >value : Symbol(value, Decl(transitiveTypeArgumentInference1.ts, 1, 3)) >T : Symbol(T, Decl(transitiveTypeArgumentInference1.ts, 0, 13)) >U : Symbol(U, Decl(transitiveTypeArgumentInference1.ts, 0, 15)) diff --git a/tests/baselines/reference/tsxAttributeResolution.symbols b/tests/baselines/reference/tsxAttributeResolution.symbols index a40be3861b3..bb0c5e7878f 100644 --- a/tests/baselines/reference/tsxAttributeResolution.symbols +++ b/tests/baselines/reference/tsxAttributeResolution.symbols @@ -7,7 +7,7 @@ declare namespace JSX { >IntrinsicElements : Symbol(IntrinsicElements, Decl(tsxAttributeResolution.tsx, 1, 23)) x: { y: number; z: string; }; ->x : Symbol(x, Decl(tsxAttributeResolution.tsx, 2, 30)) +>x : Symbol(IntrinsicElements.x, Decl(tsxAttributeResolution.tsx, 2, 30)) >y : Symbol(y, Decl(tsxAttributeResolution.tsx, 3, 6)) >z : Symbol(z, Decl(tsxAttributeResolution.tsx, 3, 17)) } diff --git a/tests/baselines/reference/tsxAttributeResolution12.errors.txt b/tests/baselines/reference/tsxAttributeResolution12.errors.txt new file mode 100644 index 00000000000..ecf51a0f3dd --- /dev/null +++ b/tests/baselines/reference/tsxAttributeResolution12.errors.txt @@ -0,0 +1,54 @@ +tests/cases/conformance/jsx/file.tsx(26,10): error TS2324: Property 'reqd' is missing in type 'IntrinsicAttributes & { reqd: any; }'. +tests/cases/conformance/jsx/file.tsx(29,10): error TS2324: Property 'reqd' is missing in type 'IntrinsicAttributes & { reqd: any; }'. + + +==== tests/cases/conformance/jsx/react.d.ts (0 errors) ==== + + declare module JSX { + interface Element { } + interface IntrinsicElements { + } + interface ElementAttributesProperty { + props; + } + interface IntrinsicAttributes { + ref?: string; + } + } + +==== tests/cases/conformance/jsx/file.tsx (2 errors) ==== + + declare class Component { + constructor(props?: P, context?: any); + setState(f: (prevState: S, props: P) => S, callback?: () => any): void; + setState(state: S, callback?: () => any): void; + forceUpdate(callBack?: () => any): void; + render(): JSX.Element; + props: P; + state: S; + context: {}; + } + + + interface ComponentClass

{ + new (props?: P, context?: any): Component; + } + + declare module TestMod { + interface TestClass extends ComponentClass<{reqd: any}> { + } + var Test: TestClass; + } + + // Errors correctly + const T = TestMod.Test; + var t1 = ; + ~~~~~ +!!! error TS2324: Property 'reqd' is missing in type 'IntrinsicAttributes & { reqd: any; }'. + + // Should error + var t2 = ; + ~~~~~~~~~~~~~~~~ +!!! error TS2324: Property 'reqd' is missing in type 'IntrinsicAttributes & { reqd: any; }'. + + \ No newline at end of file diff --git a/tests/baselines/reference/tsxAttributeResolution12.js b/tests/baselines/reference/tsxAttributeResolution12.js new file mode 100644 index 00000000000..05a854a7cbc --- /dev/null +++ b/tests/baselines/reference/tsxAttributeResolution12.js @@ -0,0 +1,55 @@ +//// [tests/cases/conformance/jsx/tsxAttributeResolution12.tsx] //// + +//// [react.d.ts] + +declare module JSX { + interface Element { } + interface IntrinsicElements { + } + interface ElementAttributesProperty { + props; + } + interface IntrinsicAttributes { + ref?: string; + } +} + +//// [file.tsx] + +declare class Component { + constructor(props?: P, context?: any); + setState(f: (prevState: S, props: P) => S, callback?: () => any): void; + setState(state: S, callback?: () => any): void; + forceUpdate(callBack?: () => any): void; + render(): JSX.Element; + props: P; + state: S; + context: {}; +} + + +interface ComponentClass

{ + new (props?: P, context?: any): Component; +} + +declare module TestMod { + interface TestClass extends ComponentClass<{reqd: any}> { + } + var Test: TestClass; +} + +// Errors correctly +const T = TestMod.Test; +var t1 = ; + +// Should error +var t2 = ; + + + +//// [file.jsx] +// Errors correctly +var T = TestMod.Test; +var t1 = ; +// Should error +var t2 = ; diff --git a/tests/baselines/reference/tsxAttributeResolution13.js b/tests/baselines/reference/tsxAttributeResolution13.js new file mode 100644 index 00000000000..e6c942eb926 --- /dev/null +++ b/tests/baselines/reference/tsxAttributeResolution13.js @@ -0,0 +1,9 @@ +//// [test.tsx] + +function Test() { } + + + +//// [test.jsx] +function Test() { } +; diff --git a/tests/baselines/reference/tsxAttributeResolution13.symbols b/tests/baselines/reference/tsxAttributeResolution13.symbols new file mode 100644 index 00000000000..a913e50969c --- /dev/null +++ b/tests/baselines/reference/tsxAttributeResolution13.symbols @@ -0,0 +1,9 @@ +=== tests/cases/conformance/jsx/test.tsx === + +function Test() { } +>Test : Symbol(Test, Decl(test.tsx, 0, 0)) + + +>Test : Symbol(Test, Decl(test.tsx, 0, 0)) +>Test : Symbol(Test, Decl(test.tsx, 0, 0)) + diff --git a/tests/baselines/reference/tsxAttributeResolution13.types b/tests/baselines/reference/tsxAttributeResolution13.types new file mode 100644 index 00000000000..1a426d86e7d --- /dev/null +++ b/tests/baselines/reference/tsxAttributeResolution13.types @@ -0,0 +1,10 @@ +=== tests/cases/conformance/jsx/test.tsx === + +function Test() { } +>Test : () => void + + +> : any +>Test : () => void +>Test : () => void + diff --git a/tests/baselines/reference/tsxAttributeResolution8.symbols b/tests/baselines/reference/tsxAttributeResolution8.symbols index 58629c15b6f..354905faeec 100644 --- a/tests/baselines/reference/tsxAttributeResolution8.symbols +++ b/tests/baselines/reference/tsxAttributeResolution8.symbols @@ -9,7 +9,7 @@ declare module JSX { >IntrinsicElements : Symbol(IntrinsicElements, Decl(file.tsx, 1, 22)) test1: {x: string}; ->test1 : Symbol(test1, Decl(file.tsx, 2, 30)) +>test1 : Symbol(IntrinsicElements.test1, Decl(file.tsx, 2, 30)) >x : Symbol(x, Decl(file.tsx, 3, 10)) } } diff --git a/tests/baselines/reference/tsxElementResolution.symbols b/tests/baselines/reference/tsxElementResolution.symbols index 4cdd0c23cf1..729c3fc9f06 100644 --- a/tests/baselines/reference/tsxElementResolution.symbols +++ b/tests/baselines/reference/tsxElementResolution.symbols @@ -7,7 +7,7 @@ declare namespace JSX { >IntrinsicElements : Symbol(IntrinsicElements, Decl(tsxElementResolution.tsx, 1, 23)) foundFirst: { x: string }; ->foundFirst : Symbol(foundFirst, Decl(tsxElementResolution.tsx, 2, 30)) +>foundFirst : Symbol(IntrinsicElements.foundFirst, Decl(tsxElementResolution.tsx, 2, 30)) >x : Symbol(x, Decl(tsxElementResolution.tsx, 3, 15)) 'string_named'; @@ -36,7 +36,7 @@ var a = ; var b = ; >b : Symbol(b, Decl(tsxElementResolution.tsx, 18, 3)) ->string_named : Symbol(JSX.IntrinsicElements.'string_named', Decl(tsxElementResolution.tsx, 3, 28)) +>string_named : Symbol(JSX.IntrinsicElements['string_named'], Decl(tsxElementResolution.tsx, 3, 28)) // TODO: This should not be a parse error (should // parse a property name here, not identifier) @@ -47,5 +47,7 @@ var d = ; var e = ; >e : Symbol(e, Decl(tsxElementResolution.tsx, 23, 3)) +>Dotted.Name : Symbol(Dotted.Name, Decl(tsxElementResolution.tsx, 12, 15)) +>Dotted : Symbol(Dotted, Decl(tsxElementResolution.tsx, 10, 14)) >Name : Symbol(Dotted.Name, Decl(tsxElementResolution.tsx, 12, 15)) diff --git a/tests/baselines/reference/tsxElementResolution.types b/tests/baselines/reference/tsxElementResolution.types index 89600bbbc2f..a1c2abcef7c 100644 --- a/tests/baselines/reference/tsxElementResolution.types +++ b/tests/baselines/reference/tsxElementResolution.types @@ -51,6 +51,7 @@ var d = ; var e = ; >e : any > : any ->Dotted : any ->Name : any +>Dotted.Name : typeof Dotted.Name +>Dotted : typeof Dotted +>Name : typeof Dotted.Name diff --git a/tests/baselines/reference/tsxElementResolution13.symbols b/tests/baselines/reference/tsxElementResolution13.symbols index 94758b291ac..9122f553a88 100644 --- a/tests/baselines/reference/tsxElementResolution13.symbols +++ b/tests/baselines/reference/tsxElementResolution13.symbols @@ -7,8 +7,8 @@ declare module JSX { interface ElementAttributesProperty { pr1: any; pr2: any; } >ElementAttributesProperty : Symbol(ElementAttributesProperty, Decl(file.tsx, 1, 22)) ->pr1 : Symbol(pr1, Decl(file.tsx, 2, 38)) ->pr2 : Symbol(pr2, Decl(file.tsx, 2, 48)) +>pr1 : Symbol(ElementAttributesProperty.pr1, Decl(file.tsx, 2, 38)) +>pr2 : Symbol(ElementAttributesProperty.pr2, Decl(file.tsx, 2, 48)) } interface Obj1 { @@ -22,5 +22,6 @@ var obj1: Obj1; >Obj1 : Symbol(Obj1, Decl(file.tsx, 3, 1)) ; // Error +>obj1 : Symbol(unknown) >x : Symbol(unknown) diff --git a/tests/baselines/reference/tsxElementResolution14.symbols b/tests/baselines/reference/tsxElementResolution14.symbols index 2400ef620eb..a605606b1ed 100644 --- a/tests/baselines/reference/tsxElementResolution14.symbols +++ b/tests/baselines/reference/tsxElementResolution14.symbols @@ -17,5 +17,6 @@ var obj1: Obj1; >Obj1 : Symbol(Obj1, Decl(file.tsx, 2, 1)) ; // OK +>obj1 : Symbol(unknown) >x : Symbol(unknown) diff --git a/tests/baselines/reference/tsxElementResolution17.symbols b/tests/baselines/reference/tsxElementResolution17.symbols index 0b4459552de..0225cc35d91 100644 --- a/tests/baselines/reference/tsxElementResolution17.symbols +++ b/tests/baselines/reference/tsxElementResolution17.symbols @@ -8,6 +8,8 @@ import s2 = require('elements2'); >s2 : Symbol(s2, Decl(consumer.tsx, 2, 33)) ; +>s1.MyElement : Symbol(s1.MyElement, Decl(file.tsx, 6, 28)) +>s1 : Symbol(s1, Decl(consumer.tsx, 0, 0)) >MyElement : Symbol(s1.MyElement, Decl(file.tsx, 6, 28)) === tests/cases/conformance/jsx/file.tsx === diff --git a/tests/baselines/reference/tsxElementResolution17.types b/tests/baselines/reference/tsxElementResolution17.types index e6396a9a60b..c68c19f58e7 100644 --- a/tests/baselines/reference/tsxElementResolution17.types +++ b/tests/baselines/reference/tsxElementResolution17.types @@ -9,8 +9,9 @@ import s2 = require('elements2'); ; > : JSX.Element ->s1 : any ->MyElement : any +>s1.MyElement : typeof s1.MyElement +>s1 : typeof s1 +>MyElement : typeof s1.MyElement === tests/cases/conformance/jsx/file.tsx === diff --git a/tests/baselines/reference/tsxElementResolution5.symbols b/tests/baselines/reference/tsxElementResolution5.symbols index 461ffd78aaa..e0fc1147083 100644 --- a/tests/baselines/reference/tsxElementResolution5.symbols +++ b/tests/baselines/reference/tsxElementResolution5.symbols @@ -8,5 +8,6 @@ declare module JSX { // OK, but implicit any

; +>div : Symbol(unknown) >n : Symbol(unknown) diff --git a/tests/baselines/reference/tsxElementResolution9.js b/tests/baselines/reference/tsxElementResolution9.js index bc65bb0bb02..5ad47730e4a 100644 --- a/tests/baselines/reference/tsxElementResolution9.js +++ b/tests/baselines/reference/tsxElementResolution9.js @@ -1,6 +1,6 @@ //// [file.tsx] declare module JSX { - interface Element { } + interface Element { something; } interface IntrinsicElements { } } diff --git a/tests/baselines/reference/tsxElementResolution9.symbols b/tests/baselines/reference/tsxElementResolution9.symbols index e38c64d0847..d6b0da12e6f 100644 --- a/tests/baselines/reference/tsxElementResolution9.symbols +++ b/tests/baselines/reference/tsxElementResolution9.symbols @@ -2,11 +2,12 @@ declare module JSX { >JSX : Symbol(JSX, Decl(file.tsx, 0, 0)) - interface Element { } + interface Element { something; } >Element : Symbol(Element, Decl(file.tsx, 0, 20)) +>something : Symbol(Element.something, Decl(file.tsx, 1, 20)) interface IntrinsicElements { } ->IntrinsicElements : Symbol(IntrinsicElements, Decl(file.tsx, 1, 22)) +>IntrinsicElements : Symbol(IntrinsicElements, Decl(file.tsx, 1, 33)) } interface Obj1 { diff --git a/tests/baselines/reference/tsxElementResolution9.types b/tests/baselines/reference/tsxElementResolution9.types index dd84e6f07b5..b138aa0509e 100644 --- a/tests/baselines/reference/tsxElementResolution9.types +++ b/tests/baselines/reference/tsxElementResolution9.types @@ -2,8 +2,9 @@ declare module JSX { >JSX : any - interface Element { } + interface Element { something; } >Element : Element +>something : any interface IntrinsicElements { } >IntrinsicElements : IntrinsicElements diff --git a/tests/baselines/reference/tsxEmit1.symbols b/tests/baselines/reference/tsxEmit1.symbols index 9d373bc62be..9e32354b184 100644 --- a/tests/baselines/reference/tsxEmit1.symbols +++ b/tests/baselines/reference/tsxEmit1.symbols @@ -93,7 +93,7 @@ class SomeClass { >SomeClass : Symbol(SomeClass, Decl(file.tsx, 20, 43)) f() { ->f : Symbol(f, Decl(file.tsx, 22, 17)) +>f : Symbol(SomeClass.f, Decl(file.tsx, 22, 17)) var rewrites1 =
{() => this}
; >rewrites1 : Symbol(rewrites1, Decl(file.tsx, 24, 5)) diff --git a/tests/baselines/reference/tsxEmit3.symbols b/tests/baselines/reference/tsxEmit3.symbols index 3b88d4e0371..3eb4ef3b05d 100644 --- a/tests/baselines/reference/tsxEmit3.symbols +++ b/tests/baselines/reference/tsxEmit3.symbols @@ -59,6 +59,8 @@ module M { >S.Bar : Symbol(S.Bar, Decl(file.tsx, 8, 18)) >S : Symbol(S, Decl(file.tsx, 7, 39), Decl(file.tsx, 18, 14)) >Bar : Symbol(S.Bar, Decl(file.tsx, 8, 18)) +>S.Bar : Symbol(S.Bar, Decl(file.tsx, 8, 18)) +>S : Symbol(S, Decl(file.tsx, 7, 39), Decl(file.tsx, 18, 14)) >Bar : Symbol(S.Bar, Decl(file.tsx, 8, 18)) } diff --git a/tests/baselines/reference/tsxEmit3.types b/tests/baselines/reference/tsxEmit3.types index 49a5cf8a51b..e70c44d0041 100644 --- a/tests/baselines/reference/tsxEmit3.types +++ b/tests/baselines/reference/tsxEmit3.types @@ -67,8 +67,9 @@ module M { >S : typeof S >Bar : typeof S.Bar > : JSX.Element ->S : any ->Bar : any +>S.Bar : typeof S.Bar +>S : typeof S +>Bar : typeof S.Bar } module M { diff --git a/tests/baselines/reference/tsxErrorRecovery1.errors.txt b/tests/baselines/reference/tsxErrorRecovery1.errors.txt index 0937b0d37ac..c368e48ddd1 100644 --- a/tests/baselines/reference/tsxErrorRecovery1.errors.txt +++ b/tests/baselines/reference/tsxErrorRecovery1.errors.txt @@ -1,15 +1,18 @@ +tests/cases/conformance/jsx/file.tsx(5,11): error TS17008: JSX element 'div' has no corresponding closing tag. tests/cases/conformance/jsx/file.tsx(5,19): error TS1109: Expression expected. tests/cases/conformance/jsx/file.tsx(8,11): error TS2304: Cannot find name 'a'. tests/cases/conformance/jsx/file.tsx(8,12): error TS1005: '}' expected. -tests/cases/conformance/jsx/file.tsx(9,1): error TS17002: Expected corresponding JSX closing tag for 'div'. +tests/cases/conformance/jsx/file.tsx(9,1): error TS1005: ' {
+ ~~~ +!!! error TS17008: JSX element 'div' has no corresponding closing tag. ~~ !!! error TS1109: Expression expected. } @@ -21,4 +24,4 @@ tests/cases/conformance/jsx/file.tsx(9,1): error TS17002: Expected corresponding !!! error TS1005: '}' expected. -!!! error TS17002: Expected corresponding JSX closing tag for 'div'. \ No newline at end of file +!!! error TS1005: ' { >Component : Symbol(React.Component, Decl(react.d.ts, 1, 24)) render() { ->render : Symbol(render, Decl(app.tsx, 5, 52)) +>render : Symbol(App.render, Decl(app.tsx, 5, 52)) return ; +>button : Symbol(unknown) +>button : Symbol(unknown) } } diff --git a/tests/baselines/reference/tsxExternalModuleEmit2.js b/tests/baselines/reference/tsxExternalModuleEmit2.js index 2233c5181cb..25e186e140f 100644 --- a/tests/baselines/reference/tsxExternalModuleEmit2.js +++ b/tests/baselines/reference/tsxExternalModuleEmit2.js @@ -19,8 +19,16 @@ declare var Foo, React; //// [app.js] "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 mod_1 = require('mod'); // Should see mod_1['default'] in emit here React.createElement(Foo, {handler: mod_1["default"]}); // Should see mod_1['default'] in emit here -React.createElement(Foo, React.__spread({}, mod_1["default"])); +React.createElement(Foo, __assign({}, mod_1["default"])); diff --git a/tests/baselines/reference/tsxGenericArrowFunctionParsing.symbols b/tests/baselines/reference/tsxGenericArrowFunctionParsing.symbols index 85dec56b2f8..6d90c583a66 100644 --- a/tests/baselines/reference/tsxGenericArrowFunctionParsing.symbols +++ b/tests/baselines/reference/tsxGenericArrowFunctionParsing.symbols @@ -4,7 +4,7 @@ declare module JSX { interface Element { isElement; } >Element : Symbol(Element, Decl(file.tsx, 0, 20)) ->isElement : Symbol(isElement, Decl(file.tsx, 1, 20)) +>isElement : Symbol(Element.isElement, Decl(file.tsx, 1, 20)) } var T, T1, T2; diff --git a/tests/baselines/reference/tsxInArrowFunction.symbols b/tests/baselines/reference/tsxInArrowFunction.symbols index 5896dfa1eef..ff80428cf74 100644 --- a/tests/baselines/reference/tsxInArrowFunction.symbols +++ b/tests/baselines/reference/tsxInArrowFunction.symbols @@ -10,7 +10,7 @@ declare namespace JSX { >IntrinsicElements : Symbol(IntrinsicElements, Decl(tsxInArrowFunction.tsx, 2, 25)) div: { ->div : Symbol(div, Decl(tsxInArrowFunction.tsx, 3, 33)) +>div : Symbol(IntrinsicElements.div, Decl(tsxInArrowFunction.tsx, 3, 33)) text?: string; >text : Symbol(text, Decl(tsxInArrowFunction.tsx, 4, 14)) diff --git a/tests/baselines/reference/tsxNoJsx.symbols b/tests/baselines/reference/tsxNoJsx.symbols index 6744c2edb10..4492e83cf10 100644 --- a/tests/baselines/reference/tsxNoJsx.symbols +++ b/tests/baselines/reference/tsxNoJsx.symbols @@ -1,5 +1,5 @@ === tests/cases/conformance/jsx/tsxNoJsx.tsx === -No type information for this code.; -No type information for this code. -No type information for this code. \ No newline at end of file +; +>nope : Symbol(unknown) + diff --git a/tests/baselines/reference/tsxOpeningClosingNames.symbols b/tests/baselines/reference/tsxOpeningClosingNames.symbols index 08da0bf05fb..66010f74d2f 100644 --- a/tests/baselines/reference/tsxOpeningClosingNames.symbols +++ b/tests/baselines/reference/tsxOpeningClosingNames.symbols @@ -16,6 +16,18 @@ declare module A.B.C { } foo
->D : Symbol(unknown) ->D : Symbol(unknown) +>A.B.C.D : Symbol(A.B.C.D, Decl(file.tsx, 5, 5)) +>A.B.C : Symbol(A.B.C, Decl(file.tsx, 4, 19)) +>A.B : Symbol(A.B, Decl(file.tsx, 4, 17)) +>A : Symbol(A, Decl(file.tsx, 2, 1)) +>B : Symbol(A.B, Decl(file.tsx, 4, 17)) +>C : Symbol(A.B.C, Decl(file.tsx, 4, 19)) +>D : Symbol(A.B.C.D, Decl(file.tsx, 5, 5)) +>A . B . C.D : Symbol(A.B.C.D, Decl(file.tsx, 5, 5)) +>A . B . C : Symbol(A.B.C, Decl(file.tsx, 4, 19)) +>A . B : Symbol(A.B, Decl(file.tsx, 4, 17)) +>A : Symbol(A, Decl(file.tsx, 2, 1)) +>B : Symbol(A.B, Decl(file.tsx, 4, 17)) +>C : Symbol(A.B.C, Decl(file.tsx, 4, 19)) +>D : Symbol(A.B.C.D, Decl(file.tsx, 5, 5)) diff --git a/tests/baselines/reference/tsxOpeningClosingNames.types b/tests/baselines/reference/tsxOpeningClosingNames.types index ac36205029e..2e21f346d10 100644 --- a/tests/baselines/reference/tsxOpeningClosingNames.types +++ b/tests/baselines/reference/tsxOpeningClosingNames.types @@ -17,12 +17,18 @@ declare module A.B.C { foo
>foo : JSX.Element ->A : any ->B : any ->C : any +>A.B.C.D : any +>A.B.C : typeof A.B.C +>A.B : typeof A.B +>A : typeof A +>B : typeof A.B +>C : typeof A.B.C >D : any ->A : any ->B : any ->C : any +>A . B . C.D : any +>A . B . C : typeof A.B.C +>A . B : typeof A.B +>A : typeof A +>B : typeof A.B +>C : typeof A.B.C >D : any diff --git a/tests/baselines/reference/tsxParseTests1.symbols b/tests/baselines/reference/tsxParseTests1.symbols index 0ee595a9a3d..905a7f4860b 100644 --- a/tests/baselines/reference/tsxParseTests1.symbols +++ b/tests/baselines/reference/tsxParseTests1.symbols @@ -7,8 +7,8 @@ declare module JSX { interface IntrinsicElements { div; span; } >IntrinsicElements : Symbol(IntrinsicElements, Decl(file.tsx, 1, 22)) ->div : Symbol(div, Decl(file.tsx, 2, 30)) ->span : Symbol(span, Decl(file.tsx, 2, 35)) +>div : Symbol(IntrinsicElements.div, Decl(file.tsx, 2, 30)) +>span : Symbol(IntrinsicElements.span, Decl(file.tsx, 2, 35)) } var x =
; diff --git a/tests/baselines/reference/tsxParseTests2.symbols b/tests/baselines/reference/tsxParseTests2.symbols index 690bc183ddd..396edca4a0a 100644 --- a/tests/baselines/reference/tsxParseTests2.symbols +++ b/tests/baselines/reference/tsxParseTests2.symbols @@ -7,8 +7,8 @@ declare module JSX { interface IntrinsicElements { div; span; } >IntrinsicElements : Symbol(IntrinsicElements, Decl(file.tsx, 1, 22)) ->div : Symbol(div, Decl(file.tsx, 2, 30)) ->span : Symbol(span, Decl(file.tsx, 2, 35)) +>div : Symbol(IntrinsicElements.div, Decl(file.tsx, 2, 30)) +>span : Symbol(IntrinsicElements.span, Decl(file.tsx, 2, 35)) } var x =
; diff --git a/tests/baselines/reference/tsxReactEmit1.js b/tests/baselines/reference/tsxReactEmit1.js index 05781ab8530..f62a7bdc47d 100644 --- a/tests/baselines/reference/tsxReactEmit1.js +++ b/tests/baselines/reference/tsxReactEmit1.js @@ -70,5 +70,8 @@ var SomeClass = (function () { return SomeClass; }()); var whitespace1 = React.createElement("div", null, " "); -var whitespace2 = React.createElement("div", null, " ", p, " "); +var whitespace2 = React.createElement("div", null, + " ", + p, + " "); var whitespace3 = React.createElement("div", null, p); diff --git a/tests/baselines/reference/tsxReactEmit1.symbols b/tests/baselines/reference/tsxReactEmit1.symbols index 640f666c0d8..6887a9550c0 100644 --- a/tests/baselines/reference/tsxReactEmit1.symbols +++ b/tests/baselines/reference/tsxReactEmit1.symbols @@ -97,7 +97,7 @@ class SomeClass { >SomeClass : Symbol(SomeClass, Decl(file.tsx, 21, 45)) f() { ->f : Symbol(f, Decl(file.tsx, 23, 17)) +>f : Symbol(SomeClass.f, Decl(file.tsx, 23, 17)) var rewrites1 =
{() => this}
; >rewrites1 : Symbol(rewrites1, Decl(file.tsx, 25, 5)) diff --git a/tests/baselines/reference/tsxReactEmit2.js b/tests/baselines/reference/tsxReactEmit2.js index fd7fff16976..051c7380171 100644 --- a/tests/baselines/reference/tsxReactEmit2.js +++ b/tests/baselines/reference/tsxReactEmit2.js @@ -16,9 +16,17 @@ var spreads5 =
{p2}
; //// [file.js] +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 p1, p2, p3; -var spreads1 = React.createElement("div", React.__spread({}, p1), p2); -var spreads2 = React.createElement("div", React.__spread({}, p1), p2); -var spreads3 = React.createElement("div", React.__spread({x: p3}, p1), p2); -var spreads4 = React.createElement("div", React.__spread({}, p1, {x: p3}), p2); -var spreads5 = React.createElement("div", React.__spread({x: p2}, p1, {y: p3}), p2); +var spreads1 = React.createElement("div", __assign({}, p1), p2); +var spreads2 = React.createElement("div", __assign({}, p1), p2); +var spreads3 = React.createElement("div", __assign({x: p3}, p1), p2); +var spreads4 = React.createElement("div", __assign({}, p1, {x: p3}), p2); +var spreads5 = React.createElement("div", __assign({x: p2}, p1, {y: p3}), p2); diff --git a/tests/baselines/reference/tsxReactEmit3.js b/tests/baselines/reference/tsxReactEmit3.js index bd42177e187..07a8f22761f 100644 --- a/tests/baselines/reference/tsxReactEmit3.js +++ b/tests/baselines/reference/tsxReactEmit3.js @@ -8,4 +8,11 @@ declare var Foo, Bar, baz; q s ; //// [test.js] -React.createElement(Foo, null, " ", React.createElement(Bar, null, " q "), " ", React.createElement(Bar, null), " s ", React.createElement(Bar, null), React.createElement(Bar, null)); +React.createElement(Foo, null, + " ", + React.createElement(Bar, null, " q "), + " ", + React.createElement(Bar, null), + " s ", + React.createElement(Bar, null), + React.createElement(Bar, null)); diff --git a/tests/baselines/reference/tsxReactEmit4.js b/tests/baselines/reference/tsxReactEmit4.js index d61cea24d2c..3b554f17cb7 100644 --- a/tests/baselines/reference/tsxReactEmit4.js +++ b/tests/baselines/reference/tsxReactEmit4.js @@ -18,7 +18,15 @@ var openClosed1 =
var spread1 =
; //// [file.js] +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 p; var openClosed1 = React.createElement("div", null, blah); // Should emit React.__spread({}, p, {x: 0}) -var spread1 = React.createElement("div", React.__spread({}, p, {x: 0})); +var spread1 = React.createElement("div", __assign({}, p, {x: 0})); diff --git a/tests/baselines/reference/tsxReactEmit5.js b/tests/baselines/reference/tsxReactEmit5.js index 06b05f67d63..a6dde25edc3 100644 --- a/tests/baselines/reference/tsxReactEmit5.js +++ b/tests/baselines/reference/tsxReactEmit5.js @@ -23,8 +23,16 @@ var spread1 =
; //// [file.js] //// [react-consumer.js] "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 test_1 = require("./test"); // Should emit test_1.React.createElement // and React.__spread var foo; -var spread1 = test_1.React.createElement("div", test_1.React.__spread({x: ''}, foo, {y: ''})); +var spread1 = test_1.React.createElement("div", __assign({x: ''}, foo, {y: ''})); diff --git a/tests/baselines/reference/tsxReactEmit6.js b/tests/baselines/reference/tsxReactEmit6.js index 4f583929004..cb41bf4d1eb 100644 --- a/tests/baselines/reference/tsxReactEmit6.js +++ b/tests/baselines/reference/tsxReactEmit6.js @@ -28,6 +28,14 @@ namespace M { //// [file.js] //// [react-consumer.js] +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 M; (function (M) { })(M || (M = {})); @@ -36,7 +44,7 @@ var M; // Should emit M.React.createElement // and M.React.__spread var foo; - var spread1 = M.React.createElement("div", M.React.__spread({x: ''}, foo, {y: ''})); + var spread1 = M.React.createElement("div", __assign({x: ''}, foo, {y: ''})); // Quotes var x = M.React.createElement("div", null, "This \"quote\" thing"); })(M || (M = {})); diff --git a/tests/baselines/reference/tsxReactEmitNesting.js b/tests/baselines/reference/tsxReactEmitNesting.js new file mode 100644 index 00000000000..53abc04aa9b --- /dev/null +++ b/tests/baselines/reference/tsxReactEmitNesting.js @@ -0,0 +1,60 @@ +//// [file.tsx] + +declare var vdom: any; +declare var ctrl: any; +declare var model: any; + +// A simple render function with nesting and control statements +let render = (ctrl, model) => +
+
+

todos <x>

+ +
+
+ +
    + {model.filteredTodos.map((todo) => +
  • +
    + {(!todo.editable) ? + + : null + } + + +
    +
    +
    +
    +
  • + )} +
+
+
+ + + +//// [file.js] +// A simple render function with nesting and control statements +var render = function (ctrl, model) { + return vdom.createElement("section", {class: "todoapp"}, + vdom.createElement("header", {class: "header"}, + vdom.createElement("h1", null, "todos "), + vdom.createElement("input", {class: "new-todo", autofocus: true, autocomplete: "off", placeholder: "What needs to be done?", value: model.newTodo, onKeyup: ctrl.addTodo.bind(ctrl, model)})), + vdom.createElement("section", {class: "main", style: { display: (model.todos && model.todos.length) ? "block" : "none" }}, + vdom.createElement("input", {class: "toggle-all", type: "checkbox", onChange: ctrl.toggleAll.bind(ctrl)}), + vdom.createElement("ul", {class: "todo-list"}, model.filteredTodos.map(function (todo) { + return vdom.createElement("li", {class: { todo: true, completed: todo.completed, editing: todo == model.editedTodo }}, + vdom.createElement("div", {class: "view"}, + (!todo.editable) ? + vdom.createElement("input", {class: "toggle", type: "checkbox"}) + : null, + vdom.createElement("label", {onDoubleClick: function () { ctrl.editTodo(todo); }}, todo.title), + vdom.createElement("button", {class: "destroy", onClick: ctrl.removeTodo.bind(ctrl, todo)}), + vdom.createElement("div", {class: "iconBorder"}, + vdom.createElement("div", {class: "icon"}) + )) + ); + })))); +}; diff --git a/tests/baselines/reference/tsxReactEmitNesting.symbols b/tests/baselines/reference/tsxReactEmitNesting.symbols new file mode 100644 index 00000000000..efccb602747 --- /dev/null +++ b/tests/baselines/reference/tsxReactEmitNesting.symbols @@ -0,0 +1,139 @@ +=== tests/cases/conformance/jsx/file.tsx === + +declare var vdom: any; +>vdom : Symbol(vdom, Decl(file.tsx, 1, 11)) + +declare var ctrl: any; +>ctrl : Symbol(ctrl, Decl(file.tsx, 2, 11)) + +declare var model: any; +>model : Symbol(model, Decl(file.tsx, 3, 11)) + +// A simple render function with nesting and control statements +let render = (ctrl, model) => +>render : Symbol(render, Decl(file.tsx, 6, 3)) +>ctrl : Symbol(ctrl, Decl(file.tsx, 6, 14)) +>model : Symbol(model, Decl(file.tsx, 6, 19)) + +
+>section : Symbol(unknown) +>class : Symbol(unknown) + +
+>header : Symbol(unknown) +>class : Symbol(unknown) + +

todos <x>

+>h1 : Symbol(unknown) +>h1 : Symbol(unknown) + + +>input : Symbol(unknown) +>class : Symbol(unknown) +>autofocus : Symbol(unknown) +>autocomplete : Symbol(unknown) +>placeholder : Symbol(unknown) +>value : Symbol(unknown) +>model : Symbol(model, Decl(file.tsx, 6, 19)) +>onKeyup : Symbol(unknown) +>ctrl : Symbol(ctrl, Decl(file.tsx, 6, 14)) +>ctrl : Symbol(ctrl, Decl(file.tsx, 6, 14)) +>model : Symbol(model, Decl(file.tsx, 6, 19)) + +
+>header : Symbol(unknown) + +
+>section : Symbol(unknown) +>class : Symbol(unknown) +>style : Symbol(unknown) +>display : Symbol(display, Decl(file.tsx, 12, 38)) +>model : Symbol(model, Decl(file.tsx, 6, 19)) +>model : Symbol(model, Decl(file.tsx, 6, 19)) + + +>input : Symbol(unknown) +>class : Symbol(unknown) +>type : Symbol(unknown) +>onChange : Symbol(unknown) +>ctrl : Symbol(ctrl, Decl(file.tsx, 6, 14)) +>ctrl : Symbol(ctrl, Decl(file.tsx, 6, 14)) + +
    +>ul : Symbol(unknown) +>class : Symbol(unknown) + + {model.filteredTodos.map((todo) => +>model : Symbol(model, Decl(file.tsx, 6, 19)) +>todo : Symbol(todo, Decl(file.tsx, 15, 42)) + +
  • +>li : Symbol(unknown) +>class : Symbol(unknown) +>todo : Symbol(todo, Decl(file.tsx, 16, 32)) +>completed : Symbol(completed, Decl(file.tsx, 16, 43)) +>todo : Symbol(todo, Decl(file.tsx, 15, 42)) +>editing : Symbol(editing, Decl(file.tsx, 16, 70)) +>todo : Symbol(todo, Decl(file.tsx, 15, 42)) +>model : Symbol(model, Decl(file.tsx, 6, 19)) + +
    +>div : Symbol(unknown) +>class : Symbol(unknown) + + {(!todo.editable) ? +>todo : Symbol(todo, Decl(file.tsx, 15, 42)) + + +>input : Symbol(unknown) +>class : Symbol(unknown) +>type : Symbol(unknown) +>input : Symbol(unknown) + + : null + } + +>label : Symbol(unknown) +>onDoubleClick : Symbol(unknown) +>ctrl : Symbol(ctrl, Decl(file.tsx, 6, 14)) +>todo : Symbol(todo, Decl(file.tsx, 15, 42)) +>todo : Symbol(todo, Decl(file.tsx, 15, 42)) +>label : Symbol(unknown) + + +>button : Symbol(unknown) +>class : Symbol(unknown) +>onClick : Symbol(unknown) +>ctrl : Symbol(ctrl, Decl(file.tsx, 6, 14)) +>ctrl : Symbol(ctrl, Decl(file.tsx, 6, 14)) +>todo : Symbol(todo, Decl(file.tsx, 15, 42)) +>button : Symbol(unknown) + +
    +>div : Symbol(unknown) +>class : Symbol(unknown) + +
    +>div : Symbol(unknown) +>class : Symbol(unknown) + +
    +>div : Symbol(unknown) + +
    +>div : Symbol(unknown) + +
  • +>li : Symbol(unknown) + + )} +
+>ul : Symbol(unknown) + +
+>section : Symbol(unknown) + +
+>section : Symbol(unknown) + + diff --git a/tests/baselines/reference/tsxReactEmitNesting.types b/tests/baselines/reference/tsxReactEmitNesting.types new file mode 100644 index 00000000000..fff29c11525 --- /dev/null +++ b/tests/baselines/reference/tsxReactEmitNesting.types @@ -0,0 +1,208 @@ +=== tests/cases/conformance/jsx/file.tsx === + +declare var vdom: any; +>vdom : any + +declare var ctrl: any; +>ctrl : any + +declare var model: any; +>model : any + +// A simple render function with nesting and control statements +let render = (ctrl, model) => +>render : (ctrl: any, model: any) => any +>(ctrl, model) =>

todos <x>

    {model.filteredTodos.map((todo) =>
  • {(!todo.editable) ? : null }
  • )}
: (ctrl: any, model: any) => any +>ctrl : any +>model : any + +
+>

todos <x>

    {model.filteredTodos.map((todo) =>
  • {(!todo.editable) ? : null }
  • )}
: any +>section : any +>class : any + +
+>

todos <x>

: any +>header : any +>class : any + +

todos <x>

+>

todos <x>

: any +>h1 : any +>h1 : any + + +> : any +>input : any +>class : any +>autofocus : any +>autocomplete : any +>placeholder : any +>value : any +>model.newTodo : any +>model : any +>newTodo : any +>onKeyup : any +>ctrl.addTodo.bind(ctrl, model) : any +>ctrl.addTodo.bind : any +>ctrl.addTodo : any +>ctrl : any +>addTodo : any +>bind : any +>ctrl : any +>model : any + +
+>header : any + +
+>
    {model.filteredTodos.map((todo) =>
  • {(!todo.editable) ? : null }
  • )}
: any +>section : any +>class : any +>style : any +>{display:(model.todos && model.todos.length) ? "block" : "none"} : { display: string; } +>display : string +>(model.todos && model.todos.length) ? "block" : "none" : string +>(model.todos && model.todos.length) : any +>model.todos && model.todos.length : any +>model.todos : any +>model : any +>todos : any +>model.todos.length : any +>model.todos : any +>model : any +>todos : any +>length : any +>"block" : string +>"none" : string + + +> : any +>input : any +>class : any +>type : any +>onChange : any +>ctrl.toggleAll.bind(ctrl) : any +>ctrl.toggleAll.bind : any +>ctrl.toggleAll : any +>ctrl : any +>toggleAll : any +>bind : any +>ctrl : any + +
    +>
      {model.filteredTodos.map((todo) =>
    • {(!todo.editable) ? : null }
    • )}
    : any +>ul : any +>class : any + + {model.filteredTodos.map((todo) => +>model.filteredTodos.map((todo) =>
  • {(!todo.editable) ? : null }
  • ) : any +>model.filteredTodos.map : any +>model.filteredTodos : any +>model : any +>filteredTodos : any +>map : any +>(todo) =>
  • {(!todo.editable) ? : null }
  • : (todo: any) => any +>todo : any + +
  • +>
  • {(!todo.editable) ? : null }
  • : any +>li : any +>class : any +>{todo: true, completed: todo.completed, editing: todo == model.editedTodo} : { todo: boolean; completed: any; editing: boolean; } +>todo : boolean +>true : boolean +>completed : any +>todo.completed : any +>todo : any +>completed : any +>editing : boolean +>todo == model.editedTodo : boolean +>todo : any +>model.editedTodo : any +>model : any +>editedTodo : any + +
    +>
    {(!todo.editable) ? : null }
    : any +>div : any +>class : any + + {(!todo.editable) ? +>(!todo.editable) ? : null : any +>(!todo.editable) : boolean +>!todo.editable : boolean +>todo.editable : any +>todo : any +>editable : any + + +> : any +>input : any +>class : any +>type : any +>input : any + + : null +>null : null + } + +> : any +>label : any +>onDoubleClick : any +>()=>{ctrl.editTodo(todo)} : () => void +>ctrl.editTodo(todo) : any +>ctrl.editTodo : any +>ctrl : any +>editTodo : any +>todo : any +>todo.title : any +>todo : any +>title : any +>label : any + + +> : any +>button : any +>class : any +>onClick : any +>ctrl.removeTodo.bind(ctrl,todo) : any +>ctrl.removeTodo.bind : any +>ctrl.removeTodo : any +>ctrl : any +>removeTodo : any +>bind : any +>ctrl : any +>todo : any +>button : any + +
    +>
    : any +>div : any +>class : any + +
    +>
    : any +>div : any +>class : any + +
    +>div : any + +
    +>div : any + + +>li : any + + )} +
+>ul : any + +
+>section : any + +
+>section : any + + diff --git a/tests/baselines/reference/tsxReactEmitWhitespace.js b/tests/baselines/reference/tsxReactEmitWhitespace.js index 9614cbf2f2c..9a157d242e3 100644 --- a/tests/baselines/reference/tsxReactEmitWhitespace.js +++ b/tests/baselines/reference/tsxReactEmitWhitespace.js @@ -59,7 +59,10 @@ var p = 0; // Emit " " React.createElement("div", null, " "); // Emit " ", p, " " -React.createElement("div", null, " ", p, " "); +React.createElement("div", null, + " ", + p, + " "); // Emit only p React.createElement("div", null, p); // Emit only p diff --git a/tests/baselines/reference/tsxReactEmitWhitespace2.js b/tests/baselines/reference/tsxReactEmitWhitespace2.js index f649ca43ebd..152d869fc03 100644 --- a/tests/baselines/reference/tsxReactEmitWhitespace2.js +++ b/tests/baselines/reference/tsxReactEmitWhitespace2.js @@ -18,8 +18,15 @@ declare var React: any; //// [file.js] // Emit ' word' in the last string -React.createElement("div", null, "word ", React.createElement("code", null, "code"), " word"); +React.createElement("div", null, + "word ", + React.createElement("code", null, "code"), + " word"); // Same here -React.createElement("div", null, React.createElement("code", null, "code"), " word"); +React.createElement("div", null, + React.createElement("code", null, "code"), + " word"); // And here -React.createElement("div", null, React.createElement("code", null), " word"); +React.createElement("div", null, + React.createElement("code", null), + " word"); diff --git a/tests/baselines/reference/tsxStatelessFunctionComponents2.errors.txt b/tests/baselines/reference/tsxStatelessFunctionComponents2.errors.txt index cced3116b5e..f8a569838ee 100644 --- a/tests/baselines/reference/tsxStatelessFunctionComponents2.errors.txt +++ b/tests/baselines/reference/tsxStatelessFunctionComponents2.errors.txt @@ -1,15 +1,12 @@ -tests/cases/conformance/jsx/file.tsx(2,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/conformance/jsx/file.tsx(20,16): error TS2339: Property 'ref' does not exist on type 'IntrinsicAttributes & { name?: string; }'. tests/cases/conformance/jsx/file.tsx(26,42): error TS2339: Property 'subtr' does not exist on type 'string'. tests/cases/conformance/jsx/file.tsx(28,33): error TS2339: Property 'notARealProperty' does not exist on type 'BigGreeter'. tests/cases/conformance/jsx/file.tsx(36,26): error TS2339: Property 'propertyNotOnHtmlDivElement' does not exist on type 'HTMLDivElement'. -==== tests/cases/conformance/jsx/file.tsx (5 errors) ==== +==== tests/cases/conformance/jsx/file.tsx (4 errors) ==== import React = require('react'); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. function Greet(x: {name?: string}) { return
Hello, {x}
; diff --git a/tests/baselines/reference/tsxStatelessFunctionComponents3.js b/tests/baselines/reference/tsxStatelessFunctionComponents3.js new file mode 100644 index 00000000000..d58586dd1ee --- /dev/null +++ b/tests/baselines/reference/tsxStatelessFunctionComponents3.js @@ -0,0 +1,37 @@ +//// [file.tsx] + +import React = require('react'); + +const Foo = (props: any) =>
; +// Should be OK +const foo = ; + + +// Should be OK +var MainMenu: React.StatelessComponent<{}> = (props) => (
+

Main Menu

+
); + +var App: React.StatelessComponent<{ children }> = ({children}) => ( +
+ +
+); + +//// [file.jsx] +define(["require", "exports", 'react'], function (require, exports, React) { + "use strict"; + var Foo = function (props) { return
; }; + // Should be OK + var foo = ; + // Should be OK + var MainMenu = function (props) { return (
+

Main Menu

+
); }; + var App = function (_a) { + var children = _a.children; + return (
+ +
); + }; +}); diff --git a/tests/baselines/reference/tsxStatelessFunctionComponents3.symbols b/tests/baselines/reference/tsxStatelessFunctionComponents3.symbols new file mode 100644 index 00000000000..4ce502c6a6a --- /dev/null +++ b/tests/baselines/reference/tsxStatelessFunctionComponents3.symbols @@ -0,0 +1,48 @@ +=== tests/cases/conformance/jsx/file.tsx === + +import React = require('react'); +>React : Symbol(React, Decl(file.tsx, 0, 0)) + +const Foo = (props: any) =>
; +>Foo : Symbol(Foo, Decl(file.tsx, 3, 5)) +>props : Symbol(props, Decl(file.tsx, 3, 13)) +>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 927, 45)) + +// Should be OK +const foo = ; +>foo : Symbol(foo, Decl(file.tsx, 5, 5)) +>Foo : Symbol(Foo, Decl(file.tsx, 3, 5)) + + +// Should be OK +var MainMenu: React.StatelessComponent<{}> = (props) => (
+>MainMenu : Symbol(MainMenu, Decl(file.tsx, 9, 3)) +>React : Symbol(React, Decl(file.tsx, 0, 0)) +>StatelessComponent : Symbol(React.StatelessComponent, Decl(react.d.ts, 139, 5)) +>props : Symbol(props, Decl(file.tsx, 9, 46)) +>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 927, 45)) + +

Main Menu

+>h3 : Symbol(JSX.IntrinsicElements.h3, Decl(react.d.ts, 939, 48)) +>h3 : Symbol(JSX.IntrinsicElements.h3, Decl(react.d.ts, 939, 48)) + +
); +>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 927, 45)) + +var App: React.StatelessComponent<{ children }> = ({children}) => ( +>App : Symbol(App, Decl(file.tsx, 13, 3)) +>React : Symbol(React, Decl(file.tsx, 0, 0)) +>StatelessComponent : Symbol(React.StatelessComponent, Decl(react.d.ts, 139, 5)) +>children : Symbol(children, Decl(file.tsx, 13, 35)) +>children : Symbol(children, Decl(file.tsx, 13, 52)) + +
+>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 927, 45)) + + +>MainMenu : Symbol(MainMenu, Decl(file.tsx, 9, 3)) + +
+>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 927, 45)) + +); diff --git a/tests/baselines/reference/tsxStatelessFunctionComponents3.types b/tests/baselines/reference/tsxStatelessFunctionComponents3.types new file mode 100644 index 00000000000..6531ff737ba --- /dev/null +++ b/tests/baselines/reference/tsxStatelessFunctionComponents3.types @@ -0,0 +1,59 @@ +=== tests/cases/conformance/jsx/file.tsx === + +import React = require('react'); +>React : typeof React + +const Foo = (props: any) =>
; +>Foo : (props: any) => JSX.Element +>(props: any) =>
: (props: any) => JSX.Element +>props : any +>
: JSX.Element +>div : any + +// Should be OK +const foo = ; +>foo : JSX.Element +> : JSX.Element +>Foo : (props: any) => JSX.Element + + +// Should be OK +var MainMenu: React.StatelessComponent<{}> = (props) => (
+>MainMenu : React.StatelessComponent<{}> +>React : any +>StatelessComponent : React.StatelessComponent

+>(props) => (

Main Menu

) : (props: {}) => JSX.Element +>props : {} +>(

Main Menu

) : JSX.Element +>

Main Menu

: JSX.Element +>div : any + +

Main Menu

+>

Main Menu

: JSX.Element +>h3 : any +>h3 : any + +
); +>div : any + +var App: React.StatelessComponent<{ children }> = ({children}) => ( +>App : React.StatelessComponent<{ children: any; }> +>React : any +>StatelessComponent : React.StatelessComponent

+>children : any +>({children}) => (

) : ({children}: { children: any; }) => JSX.Element +>children : any +>(
) : JSX.Element + +
+>
: JSX.Element +>div : any + + +> : JSX.Element +>MainMenu : React.StatelessComponent<{}> + +
+>div : any + +); diff --git a/tests/baselines/reference/tsxTypeErrors.symbols b/tests/baselines/reference/tsxTypeErrors.symbols index 94399b95d1f..062442cda16 100644 --- a/tests/baselines/reference/tsxTypeErrors.symbols +++ b/tests/baselines/reference/tsxTypeErrors.symbols @@ -3,11 +3,13 @@ // A built-in element (OK) var a1 =
; >a1 : Symbol(a1, Decl(tsxTypeErrors.tsx, 2, 3)) +>div : Symbol(unknown) >id : Symbol(unknown) // A built-in element with a mistyped property (error) var a2 = >a2 : Symbol(a2, Decl(tsxTypeErrors.tsx, 5, 3)) +>img : Symbol(unknown) >srce : Symbol(unknown) // A built-in element with a badly-typed attribute value (error) @@ -17,12 +19,14 @@ var thing = { oops: 100 }; var a3 =
>a3 : Symbol(a3, Decl(tsxTypeErrors.tsx, 9, 3)) +>div : Symbol(unknown) >id : Symbol(unknown) >thing : Symbol(thing, Decl(tsxTypeErrors.tsx, 8, 3)) // Mistyped html name (error) var e1 = >e1 : Symbol(e1, Decl(tsxTypeErrors.tsx, 12, 3)) +>imag : Symbol(unknown) >src : Symbol(unknown) // A custom type @@ -30,7 +34,7 @@ class MyClass { >MyClass : Symbol(MyClass, Decl(tsxTypeErrors.tsx, 12, 31)) props: { ->props : Symbol(props, Decl(tsxTypeErrors.tsx, 15, 15)) +>props : Symbol(MyClass.props, Decl(tsxTypeErrors.tsx, 15, 15)) pt?: { x: number; y: number; }; >pt : Symbol(pt, Decl(tsxTypeErrors.tsx, 16, 10)) diff --git a/tests/baselines/reference/tsxUnionTypeComponent1.js b/tests/baselines/reference/tsxUnionTypeComponent1.js new file mode 100644 index 00000000000..11b41a2aa3d --- /dev/null +++ b/tests/baselines/reference/tsxUnionTypeComponent1.js @@ -0,0 +1,56 @@ +//// [file.tsx] + +import React = require('react'); + +interface ComponentProps { + AnyComponent: React.StatelessComponent | React.ComponentClass; +} + +class MyComponent extends React.Component { + render() { + const { AnyComponent } = this.props; + return (); + } +} + +// Stateless Component As Props + }/> + +// Component Class as Props +class MyButtonComponent extends React.Component<{},{}> { +} + + + + + +//// [file.js] +"use strict"; +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var React = require('react'); +var MyComponent = (function (_super) { + __extends(MyComponent, _super); + function MyComponent() { + _super.apply(this, arguments); + } + MyComponent.prototype.render = function () { + var AnyComponent = this.props.AnyComponent; + return (React.createElement(AnyComponent, null)); + }; + return MyComponent; +}(React.Component)); +// Stateless Component As Props +React.createElement(MyComponent, {AnyComponent: function () { return React.createElement("button", null, "test"); }}); +// Component Class as Props +var MyButtonComponent = (function (_super) { + __extends(MyButtonComponent, _super); + function MyButtonComponent() { + _super.apply(this, arguments); + } + return MyButtonComponent; +}(React.Component)); +React.createElement(MyComponent, {AnyComponent: MyButtonComponent}); diff --git a/tests/baselines/reference/tsxUnionTypeComponent1.symbols b/tests/baselines/reference/tsxUnionTypeComponent1.symbols new file mode 100644 index 00000000000..73f7180f3b8 --- /dev/null +++ b/tests/baselines/reference/tsxUnionTypeComponent1.symbols @@ -0,0 +1,58 @@ +=== tests/cases/conformance/jsx/file.tsx === + +import React = require('react'); +>React : Symbol(React, Decl(file.tsx, 0, 0)) + +interface ComponentProps { +>ComponentProps : Symbol(ComponentProps, Decl(file.tsx, 1, 32)) + + AnyComponent: React.StatelessComponent | React.ComponentClass; +>AnyComponent : Symbol(ComponentProps.AnyComponent, Decl(file.tsx, 3, 26)) +>React : Symbol(React, Decl(file.tsx, 0, 0)) +>StatelessComponent : Symbol(React.StatelessComponent, Decl(react.d.ts, 139, 5)) +>React : Symbol(React, Decl(file.tsx, 0, 0)) +>ComponentClass : Symbol(React.ComponentClass, Decl(react.d.ts, 150, 5)) +} + +class MyComponent extends React.Component { +>MyComponent : Symbol(MyComponent, Decl(file.tsx, 5, 1)) +>React.Component : Symbol(React.Component, Decl(react.d.ts, 114, 55)) +>React : Symbol(React, Decl(file.tsx, 0, 0)) +>Component : Symbol(React.Component, Decl(react.d.ts, 114, 55)) +>ComponentProps : Symbol(ComponentProps, Decl(file.tsx, 1, 32)) + + render() { +>render : Symbol(MyComponent.render, Decl(file.tsx, 7, 63)) + + const { AnyComponent } = this.props; +>AnyComponent : Symbol(AnyComponent, Decl(file.tsx, 9, 15)) +>this.props : Symbol(React.Component.props, Decl(react.d.ts, 122, 30)) +>this : Symbol(MyComponent, Decl(file.tsx, 5, 1)) +>props : Symbol(React.Component.props, Decl(react.d.ts, 122, 30)) + + return (); +>AnyComponent : Symbol(AnyComponent, Decl(file.tsx, 9, 15)) + } +} + +// Stateless Component As Props + }/> +>MyComponent : Symbol(MyComponent, Decl(file.tsx, 5, 1)) +>AnyComponent : Symbol(ComponentProps.AnyComponent, Decl(file.tsx, 3, 26)) +>button : Symbol(JSX.IntrinsicElements.button, Decl(react.d.ts, 913, 43)) +>button : Symbol(JSX.IntrinsicElements.button, Decl(react.d.ts, 913, 43)) + +// Component Class as Props +class MyButtonComponent extends React.Component<{},{}> { +>MyButtonComponent : Symbol(MyButtonComponent, Decl(file.tsx, 15, 57)) +>React.Component : Symbol(React.Component, Decl(react.d.ts, 114, 55)) +>React : Symbol(React, Decl(file.tsx, 0, 0)) +>Component : Symbol(React.Component, Decl(react.d.ts, 114, 55)) +} + + +>MyComponent : Symbol(MyComponent, Decl(file.tsx, 5, 1)) +>AnyComponent : Symbol(ComponentProps.AnyComponent, Decl(file.tsx, 3, 26)) +>MyButtonComponent : Symbol(MyButtonComponent, Decl(file.tsx, 15, 57)) + + diff --git a/tests/baselines/reference/tsxUnionTypeComponent1.types b/tests/baselines/reference/tsxUnionTypeComponent1.types new file mode 100644 index 00000000000..ce6e3bbeecc --- /dev/null +++ b/tests/baselines/reference/tsxUnionTypeComponent1.types @@ -0,0 +1,64 @@ +=== tests/cases/conformance/jsx/file.tsx === + +import React = require('react'); +>React : typeof React + +interface ComponentProps { +>ComponentProps : ComponentProps + + AnyComponent: React.StatelessComponent | React.ComponentClass; +>AnyComponent : React.StatelessComponent | React.ComponentClass +>React : any +>StatelessComponent : React.StatelessComponent

+>React : any +>ComponentClass : React.ComponentClass

+} + +class MyComponent extends React.Component { +>MyComponent : MyComponent +>React.Component : React.Component +>React : typeof React +>Component : typeof React.Component +>ComponentProps : ComponentProps + + render() { +>render : () => JSX.Element + + const { AnyComponent } = this.props; +>AnyComponent : React.StatelessComponent | React.ComponentClass +>this.props : ComponentProps +>this : this +>props : ComponentProps + + return (); +>() : JSX.Element +> : JSX.Element +>AnyComponent : React.StatelessComponent | React.ComponentClass + } +} + +// Stateless Component As Props + }/> +> }/> : JSX.Element +>MyComponent : typeof MyComponent +>AnyComponent : any +>() => : () => JSX.Element +> : JSX.Element +>button : any +>button : any + +// Component Class as Props +class MyButtonComponent extends React.Component<{},{}> { +>MyButtonComponent : MyButtonComponent +>React.Component : React.Component<{}, {}> +>React : typeof React +>Component : typeof React.Component +} + + +> : JSX.Element +>MyComponent : typeof MyComponent +>AnyComponent : any +>MyButtonComponent : typeof MyButtonComponent + + diff --git a/tests/baselines/reference/tsxUnionTypeComponent2.errors.txt b/tests/baselines/reference/tsxUnionTypeComponent2.errors.txt new file mode 100644 index 00000000000..e5a5c77da4c --- /dev/null +++ b/tests/baselines/reference/tsxUnionTypeComponent2.errors.txt @@ -0,0 +1,17 @@ +tests/cases/conformance/jsx/file.tsx(8,2): error TS2604: JSX element type 'X' does not have any construct or call signatures. + + +==== tests/cases/conformance/jsx/file.tsx (1 errors) ==== + + import React = require('react'); + + type Invalid1 = React.ComponentClass | string; + + const X: Invalid1 = "Should fail to construct"; + + ; + ~ +!!! error TS2604: JSX element type 'X' does not have any construct or call signatures. + + + \ No newline at end of file diff --git a/tests/baselines/reference/tsxUnionTypeComponent2.js b/tests/baselines/reference/tsxUnionTypeComponent2.js new file mode 100644 index 00000000000..18e86eb8b4c --- /dev/null +++ b/tests/baselines/reference/tsxUnionTypeComponent2.js @@ -0,0 +1,18 @@ +//// [file.tsx] + +import React = require('react'); + +type Invalid1 = React.ComponentClass | string; + +const X: Invalid1 = "Should fail to construct"; + +; + + + + +//// [file.js] +"use strict"; +var React = require('react'); +var X = "Should fail to construct"; +React.createElement(X, null); diff --git a/tests/baselines/reference/tupleTypeInference.symbols b/tests/baselines/reference/tupleTypeInference.symbols index 4dbed73e395..ec825e81f4b 100644 --- a/tests/baselines/reference/tupleTypeInference.symbols +++ b/tests/baselines/reference/tupleTypeInference.symbols @@ -7,7 +7,7 @@ interface IQService { >IQService : Symbol(IQService, Decl(tupleTypeInference.ts, 0, 26)) all(x: [IPromise, IPromise, IPromise]): IPromise<[T1, T2, T3]>; ->all : Symbol(all, Decl(tupleTypeInference.ts, 2, 21), Decl(tupleTypeInference.ts, 3, 91), Decl(tupleTypeInference.ts, 4, 69)) +>all : Symbol(IQService.all, Decl(tupleTypeInference.ts, 2, 21), Decl(tupleTypeInference.ts, 3, 91), Decl(tupleTypeInference.ts, 4, 69)) >T1 : Symbol(T1, Decl(tupleTypeInference.ts, 3, 8)) >T2 : Symbol(T2, Decl(tupleTypeInference.ts, 3, 11)) >T3 : Symbol(T3, Decl(tupleTypeInference.ts, 3, 15)) @@ -24,7 +24,7 @@ interface IQService { >T3 : Symbol(T3, Decl(tupleTypeInference.ts, 3, 15)) all(x: [IPromise, IPromise]): IPromise<[T1, T2]>; ->all : Symbol(all, Decl(tupleTypeInference.ts, 2, 21), Decl(tupleTypeInference.ts, 3, 91), Decl(tupleTypeInference.ts, 4, 69)) +>all : Symbol(IQService.all, Decl(tupleTypeInference.ts, 2, 21), Decl(tupleTypeInference.ts, 3, 91), Decl(tupleTypeInference.ts, 4, 69)) >T1 : Symbol(T1, Decl(tupleTypeInference.ts, 4, 8)) >T2 : Symbol(T2, Decl(tupleTypeInference.ts, 4, 11)) >x : Symbol(x, Decl(tupleTypeInference.ts, 4, 16)) @@ -37,7 +37,7 @@ interface IQService { >T2 : Symbol(T2, Decl(tupleTypeInference.ts, 4, 11)) all(x: [IPromise]): IPromise<[T1]>; ->all : Symbol(all, Decl(tupleTypeInference.ts, 2, 21), Decl(tupleTypeInference.ts, 3, 91), Decl(tupleTypeInference.ts, 4, 69)) +>all : Symbol(IQService.all, Decl(tupleTypeInference.ts, 2, 21), Decl(tupleTypeInference.ts, 3, 91), Decl(tupleTypeInference.ts, 4, 69)) >T1 : Symbol(T1, Decl(tupleTypeInference.ts, 5, 8)) >x : Symbol(x, Decl(tupleTypeInference.ts, 5, 12)) >IPromise : Symbol(IPromise, Decl(tupleTypeInference.ts, 7, 1)) @@ -46,7 +46,7 @@ interface IQService { >T1 : Symbol(T1, Decl(tupleTypeInference.ts, 5, 8)) when(t?: T): IPromise; ->when : Symbol(when, Decl(tupleTypeInference.ts, 5, 47)) +>when : Symbol(IQService.when, Decl(tupleTypeInference.ts, 5, 47)) >T : Symbol(T, Decl(tupleTypeInference.ts, 6, 9)) >t : Symbol(t, Decl(tupleTypeInference.ts, 6, 12)) >T : Symbol(T, Decl(tupleTypeInference.ts, 6, 9)) @@ -59,7 +59,7 @@ interface IPromise { >T : Symbol(T, Decl(tupleTypeInference.ts, 9, 19)) then(callback: (t: T) => TResult): IPromise; ->then : Symbol(then, Decl(tupleTypeInference.ts, 9, 23)) +>then : Symbol(IPromise.then, Decl(tupleTypeInference.ts, 9, 23)) >TResult : Symbol(TResult, Decl(tupleTypeInference.ts, 10, 9)) >callback : Symbol(callback, Decl(tupleTypeInference.ts, 10, 18)) >t : Symbol(t, Decl(tupleTypeInference.ts, 10, 29)) diff --git a/tests/baselines/reference/twoGenericInterfacesDifferingByTypeParameterName.errors.txt b/tests/baselines/reference/twoGenericInterfacesDifferingByTypeParameterName.errors.txt index adf9583095d..6c0f562ac64 100644 --- a/tests/baselines/reference/twoGenericInterfacesDifferingByTypeParameterName.errors.txt +++ b/tests/baselines/reference/twoGenericInterfacesDifferingByTypeParameterName.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName.ts(7,11): error TS2428: All declarations of an interface must have identical type parameters. -tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName.ts(15,11): error TS2428: All declarations of an interface must have identical type parameters. -tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName.ts(24,15): error TS2428: All declarations of an interface must have identical type parameters. -tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName.ts(32,15): error TS2428: All declarations of an interface must have identical type parameters. -tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName.ts(56,22): error TS2428: All declarations of an interface must have identical type parameters. +tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName.ts(7,11): error TS2428: All declarations of 'A' must have identical type parameters. +tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName.ts(15,11): error TS2428: All declarations of 'B' must have identical type parameters. +tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName.ts(24,15): error TS2428: All declarations of 'A' must have identical type parameters. +tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName.ts(32,15): error TS2428: All declarations of 'B' must have identical type parameters. +tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName.ts(56,22): error TS2428: All declarations of 'B' must have identical type parameters. ==== tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName.ts (5 errors) ==== @@ -14,7 +14,7 @@ tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDiffer interface A { // error ~ -!!! error TS2428: All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations of 'A' must have identical type parameters. y: U; } @@ -24,7 +24,7 @@ tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDiffer interface B { // error ~ -!!! error TS2428: All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations of 'B' must have identical type parameters. y: V; } @@ -35,7 +35,7 @@ tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDiffer interface A { // error ~ -!!! error TS2428: All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations of 'A' must have identical type parameters. y: U; } @@ -45,7 +45,7 @@ tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDiffer interface B { // error ~ -!!! error TS2428: All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations of 'B' must have identical type parameters. y: V; } } @@ -71,7 +71,7 @@ tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDiffer module M3 { export interface B { // error ~ -!!! error TS2428: All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations of 'B' must have identical type parameters. y: V; } } diff --git a/tests/baselines/reference/twoGenericInterfacesDifferingByTypeParameterName2.errors.txt b/tests/baselines/reference/twoGenericInterfacesDifferingByTypeParameterName2.errors.txt index dd1483b9e1d..f2a0063c230 100644 --- a/tests/baselines/reference/twoGenericInterfacesDifferingByTypeParameterName2.errors.txt +++ b/tests/baselines/reference/twoGenericInterfacesDifferingByTypeParameterName2.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName2.ts(7,11): error TS2428: All declarations of an interface must have identical type parameters. +tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName2.ts(7,11): error TS2428: All declarations of 'B' must have identical type parameters. tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName2.ts(8,8): error TS2304: Cannot find name 'V'. -tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName2.ts(16,15): error TS2428: All declarations of an interface must have identical type parameters. -tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName2.ts(40,22): error TS2428: All declarations of an interface must have identical type parameters. +tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName2.ts(16,15): error TS2428: All declarations of 'B' must have identical type parameters. +tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName2.ts(40,22): error TS2428: All declarations of 'B' must have identical type parameters. ==== tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName2.ts (4 errors) ==== @@ -13,7 +13,7 @@ tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDiffer interface B { // error ~ -!!! error TS2428: All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations of 'B' must have identical type parameters. y: V; ~ !!! error TS2304: Cannot find name 'V'. @@ -26,7 +26,7 @@ tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDiffer interface B { // error ~ -!!! error TS2428: All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations of 'B' must have identical type parameters. y: T; } } @@ -52,7 +52,7 @@ tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDiffer module M3 { export interface B { // error ~ -!!! error TS2428: All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations of 'B' must have identical type parameters. y: T; } } diff --git a/tests/baselines/reference/twoGenericInterfacesWithDifferentConstraints.errors.txt b/tests/baselines/reference/twoGenericInterfacesWithDifferentConstraints.errors.txt index 665a26f47f4..4b2455773f5 100644 --- a/tests/baselines/reference/twoGenericInterfacesWithDifferentConstraints.errors.txt +++ b/tests/baselines/reference/twoGenericInterfacesWithDifferentConstraints.errors.txt @@ -1,6 +1,6 @@ -tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithDifferentConstraints.ts(5,11): error TS2428: All declarations of an interface must have identical type parameters. -tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithDifferentConstraints.ts(14,15): error TS2428: All declarations of an interface must have identical type parameters. -tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithDifferentConstraints.ts(38,22): error TS2428: All declarations of an interface must have identical type parameters. +tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithDifferentConstraints.ts(5,11): error TS2428: All declarations of 'A' must have identical type parameters. +tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithDifferentConstraints.ts(14,15): error TS2428: All declarations of 'B' must have identical type parameters. +tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithDifferentConstraints.ts(38,22): error TS2428: All declarations of 'A' must have identical type parameters. ==== tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithDifferentConstraints.ts (3 errors) ==== @@ -10,7 +10,7 @@ tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithDi interface A { // error ~ -!!! error TS2428: All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations of 'A' must have identical type parameters. y: T; } @@ -21,7 +21,7 @@ tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithDi interface B> { // error ~ -!!! error TS2428: All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations of 'B' must have identical type parameters. y: T; } } @@ -47,7 +47,7 @@ tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithDi module M3 { export interface A { // error ~ -!!! error TS2428: All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations of 'A' must have identical type parameters. y: T; } } \ No newline at end of file diff --git a/tests/baselines/reference/twoGenericInterfacesWithTheSameNameButDifferentArity.errors.txt b/tests/baselines/reference/twoGenericInterfacesWithTheSameNameButDifferentArity.errors.txt index be0608c0cd6..de4c4d8e1c3 100644 --- a/tests/baselines/reference/twoGenericInterfacesWithTheSameNameButDifferentArity.errors.txt +++ b/tests/baselines/reference/twoGenericInterfacesWithTheSameNameButDifferentArity.errors.txt @@ -1,6 +1,6 @@ -tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithTheSameNameButDifferentArity.ts(5,11): error TS2428: All declarations of an interface must have identical type parameters. -tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithTheSameNameButDifferentArity.ts(14,15): error TS2428: All declarations of an interface must have identical type parameters. -tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithTheSameNameButDifferentArity.ts(38,22): error TS2428: All declarations of an interface must have identical type parameters. +tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithTheSameNameButDifferentArity.ts(5,11): error TS2428: All declarations of 'A' must have identical type parameters. +tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithTheSameNameButDifferentArity.ts(14,15): error TS2428: All declarations of 'A' must have identical type parameters. +tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithTheSameNameButDifferentArity.ts(38,22): error TS2428: All declarations of 'A' must have identical type parameters. ==== tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithTheSameNameButDifferentArity.ts (3 errors) ==== @@ -10,7 +10,7 @@ tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithTh interface A { // error ~ -!!! error TS2428: All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations of 'A' must have identical type parameters. y: T; } @@ -21,7 +21,7 @@ tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithTh interface A { // error ~ -!!! error TS2428: All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations of 'A' must have identical type parameters. y: T; } } @@ -47,7 +47,7 @@ tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithTh module M3 { export interface A { // error ~ -!!! error TS2428: All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations of 'A' must have identical type parameters. y: T; } } \ No newline at end of file diff --git a/tests/baselines/reference/twoMergedInterfacesWithDifferingOverloads.symbols b/tests/baselines/reference/twoMergedInterfacesWithDifferingOverloads.symbols index 5d46be73518..b93de8e55ce 100644 --- a/tests/baselines/reference/twoMergedInterfacesWithDifferingOverloads.symbols +++ b/tests/baselines/reference/twoMergedInterfacesWithDifferingOverloads.symbols @@ -5,11 +5,11 @@ interface A { >A : Symbol(A, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 0, 0), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 5, 1)) foo(x: number): number; ->foo : Symbol(foo, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 2, 13), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 3, 27), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 7, 13)) +>foo : Symbol(A.foo, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 2, 13), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 3, 27), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 7, 13)) >x : Symbol(x, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 3, 8)) foo(x: string): string; ->foo : Symbol(foo, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 2, 13), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 3, 27), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 7, 13)) +>foo : Symbol(A.foo, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 2, 13), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 3, 27), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 7, 13)) >x : Symbol(x, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 4, 8)) } @@ -17,10 +17,10 @@ interface A { >A : Symbol(A, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 0, 0), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 5, 1)) foo(x: Date): Date; ->foo : Symbol(foo, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 2, 13), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 3, 27), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 7, 13)) +>foo : Symbol(A.foo, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 2, 13), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 3, 27), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 7, 13)) >x : Symbol(x, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 8, 8)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) } interface B { @@ -28,12 +28,12 @@ interface B { >T : Symbol(T, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 11, 12), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 16, 12)) foo(x: T): number; ->foo : Symbol(foo, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 11, 16), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 12, 22), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 16, 16), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 17, 20)) +>foo : Symbol(B.foo, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 11, 16), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 12, 22), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 16, 16), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 17, 20)) >x : Symbol(x, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 12, 8)) >T : Symbol(T, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 11, 12), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 16, 12)) foo(x: string): string; ->foo : Symbol(foo, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 11, 16), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 12, 22), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 16, 16), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 17, 20)) +>foo : Symbol(B.foo, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 11, 16), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 12, 22), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 16, 16), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 17, 20)) >x : Symbol(x, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 13, 8)) } @@ -42,15 +42,15 @@ interface B { >T : Symbol(T, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 11, 12), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 16, 12)) foo(x: T): Date; ->foo : Symbol(foo, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 11, 16), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 12, 22), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 16, 16), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 17, 20)) +>foo : Symbol(B.foo, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 11, 16), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 12, 22), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 16, 16), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 17, 20)) >x : Symbol(x, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 17, 8)) >T : Symbol(T, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 11, 12), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 16, 12)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) foo(x: Date): string; ->foo : Symbol(foo, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 11, 16), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 12, 22), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 16, 16), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 17, 20)) +>foo : Symbol(B.foo, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 11, 16), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 12, 22), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 16, 16), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 17, 20)) >x : Symbol(x, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 18, 8)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) } var b: B; @@ -70,14 +70,14 @@ interface C { >U : Symbol(U, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 25, 14), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 30, 14)) foo(x: T, y: U): string; ->foo : Symbol(foo, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 25, 19), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 26, 28), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 30, 19)) +>foo : Symbol(C.foo, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 25, 19), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 26, 28), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 30, 19)) >x : Symbol(x, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 26, 8)) >T : Symbol(T, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 25, 12), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 30, 12)) >y : Symbol(y, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 26, 13)) >U : Symbol(U, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 25, 14), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 30, 14)) foo(x: string, y: string): number; ->foo : Symbol(foo, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 25, 19), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 26, 28), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 30, 19)) +>foo : Symbol(C.foo, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 25, 19), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 26, 28), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 30, 19)) >x : Symbol(x, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 27, 8)) >y : Symbol(y, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 27, 18)) } @@ -88,7 +88,7 @@ interface C { >U : Symbol(U, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 25, 14), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 30, 14)) foo(x: W, y: W): W; ->foo : Symbol(foo, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 25, 19), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 26, 28), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 30, 19)) +>foo : Symbol(C.foo, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 25, 19), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 26, 28), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 30, 19)) >W : Symbol(W, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 31, 8)) >x : Symbol(x, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 31, 11)) >W : Symbol(W, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 31, 8)) @@ -100,7 +100,7 @@ interface C { var c: C; >c : Symbol(c, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 34, 3)) >C : Symbol(C, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 22, 20), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 28, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) var r2 = c.foo(1, 2); // number >r2 : Symbol(r2, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 35, 3)) @@ -115,15 +115,15 @@ interface D { >U : Symbol(U, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 38, 14), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 44, 14)) a: T; ->a : Symbol(a, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 38, 19)) +>a : Symbol(D.a, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 38, 19)) >T : Symbol(T, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 38, 12), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 44, 12)) b: U; ->b : Symbol(b, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 39, 9)) +>b : Symbol(D.b, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 39, 9)) >U : Symbol(U, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 38, 14), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 44, 14)) foo(x: A, y: A): U; ->foo : Symbol(foo, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 40, 9), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 44, 19)) +>foo : Symbol(D.foo, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 40, 9), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 44, 19)) >A : Symbol(A, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 41, 8)) >x : Symbol(x, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 41, 11)) >A : Symbol(A, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 41, 8)) @@ -138,7 +138,7 @@ interface D { >U : Symbol(U, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 38, 14), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 44, 14)) foo(x: W, y: W): T; ->foo : Symbol(foo, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 40, 9), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 44, 19)) +>foo : Symbol(D.foo, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 40, 9), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 44, 19)) >W : Symbol(W, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 45, 8)) >x : Symbol(x, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 45, 11)) >W : Symbol(W, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 45, 8)) @@ -150,7 +150,7 @@ interface D { var d: D; >d : Symbol(d, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 48, 3)) >D : Symbol(D, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 35, 21), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 42, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) var r3 = d.foo(1, 1); // boolean, last definition wins >r3 : Symbol(r3, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 49, 3)) diff --git a/tests/baselines/reference/typeAliases.symbols b/tests/baselines/reference/typeAliases.symbols index 02cc5027b04..bedd6c8bb69 100644 --- a/tests/baselines/reference/typeAliases.symbols +++ b/tests/baselines/reference/typeAliases.symbols @@ -53,7 +53,7 @@ var x5: T5; interface I6 { x : string } >I6 : Symbol(I6, Decl(typeAliases.ts, 20, 11)) ->x : Symbol(x, Decl(typeAliases.ts, 22, 14)) +>x : Symbol(I6.x, Decl(typeAliases.ts, 22, 14)) type T6 = I6; >T6 : Symbol(T6, Decl(typeAliases.ts, 22, 27)) @@ -69,7 +69,7 @@ var x6: T6; class C7 { x: boolean } >C7 : Symbol(C7, Decl(typeAliases.ts, 25, 11)) ->x : Symbol(x, Decl(typeAliases.ts, 27, 10)) +>x : Symbol(C7.x, Decl(typeAliases.ts, 27, 10)) type T7 = C7; >T7 : Symbol(T7, Decl(typeAliases.ts, 27, 23)) @@ -127,7 +127,7 @@ var x11: T11; interface I13 { x: string }; >I13 : Symbol(I13, Decl(typeAliases.ts, 46, 13)) ->x : Symbol(x, Decl(typeAliases.ts, 48, 15)) +>x : Symbol(I13.x, Decl(typeAliases.ts, 48, 15)) type T13 = I13; >T13 : Symbol(T13, Decl(typeAliases.ts, 48, 28)) diff --git a/tests/baselines/reference/typeAnnotationBestCommonTypeInArrayLiteral.symbols b/tests/baselines/reference/typeAnnotationBestCommonTypeInArrayLiteral.symbols index f172c91f265..1e7604b44e7 100644 --- a/tests/baselines/reference/typeAnnotationBestCommonTypeInArrayLiteral.symbols +++ b/tests/baselines/reference/typeAnnotationBestCommonTypeInArrayLiteral.symbols @@ -3,22 +3,22 @@ interface IMenuItem { >IMenuItem : Symbol(IMenuItem, Decl(typeAnnotationBestCommonTypeInArrayLiteral.ts, 0, 0)) id: string; ->id : Symbol(id, Decl(typeAnnotationBestCommonTypeInArrayLiteral.ts, 0, 21)) +>id : Symbol(IMenuItem.id, Decl(typeAnnotationBestCommonTypeInArrayLiteral.ts, 0, 21)) type: string; ->type : Symbol(type, Decl(typeAnnotationBestCommonTypeInArrayLiteral.ts, 1, 15)) +>type : Symbol(IMenuItem.type, Decl(typeAnnotationBestCommonTypeInArrayLiteral.ts, 1, 15)) link?: string; ->link : Symbol(link, Decl(typeAnnotationBestCommonTypeInArrayLiteral.ts, 2, 17)) +>link : Symbol(IMenuItem.link, Decl(typeAnnotationBestCommonTypeInArrayLiteral.ts, 2, 17)) classes?: string; ->classes : Symbol(classes, Decl(typeAnnotationBestCommonTypeInArrayLiteral.ts, 3, 18)) +>classes : Symbol(IMenuItem.classes, Decl(typeAnnotationBestCommonTypeInArrayLiteral.ts, 3, 18)) text?: string; ->text : Symbol(text, Decl(typeAnnotationBestCommonTypeInArrayLiteral.ts, 4, 21)) +>text : Symbol(IMenuItem.text, Decl(typeAnnotationBestCommonTypeInArrayLiteral.ts, 4, 21)) icon?: string; ->icon : Symbol(icon, Decl(typeAnnotationBestCommonTypeInArrayLiteral.ts, 5, 18)) +>icon : Symbol(IMenuItem.icon, Decl(typeAnnotationBestCommonTypeInArrayLiteral.ts, 5, 18)) } var menuData: IMenuItem[] = [ >menuData : Symbol(menuData, Decl(typeAnnotationBestCommonTypeInArrayLiteral.ts, 8, 3)) diff --git a/tests/baselines/reference/typeArgInference.symbols b/tests/baselines/reference/typeArgInference.symbols index 37318e35906..3801b996ed7 100644 --- a/tests/baselines/reference/typeArgInference.symbols +++ b/tests/baselines/reference/typeArgInference.symbols @@ -3,7 +3,7 @@ interface I { >I : Symbol(I, Decl(typeArgInference.ts, 0, 0)) f(a1: { a: T; b: U }[], a2: { a: T; b: U }[]): { c: T; d: U }; ->f : Symbol(f, Decl(typeArgInference.ts, 0, 13)) +>f : Symbol(I.f, Decl(typeArgInference.ts, 0, 13)) >T : Symbol(T, Decl(typeArgInference.ts, 1, 6)) >U : Symbol(U, Decl(typeArgInference.ts, 1, 8)) >a1 : Symbol(a1, Decl(typeArgInference.ts, 1, 12)) @@ -22,7 +22,7 @@ interface I { >U : Symbol(U, Decl(typeArgInference.ts, 1, 8)) g(...arg: { a: T; b: U }[][]): { c: T; d: U }; ->g : Symbol(g, Decl(typeArgInference.ts, 1, 72)) +>g : Symbol(I.g, Decl(typeArgInference.ts, 1, 72)) >T : Symbol(T, Decl(typeArgInference.ts, 2, 6)) >U : Symbol(U, Decl(typeArgInference.ts, 2, 8)) >arg : Symbol(arg, Decl(typeArgInference.ts, 2, 12)) diff --git a/tests/baselines/reference/typeArgumentConstraintResolution1.errors.txt b/tests/baselines/reference/typeArgumentConstraintResolution1.errors.txt index d7cf5e83b8f..1131b6e1a68 100644 --- a/tests/baselines/reference/typeArgumentConstraintResolution1.errors.txt +++ b/tests/baselines/reference/typeArgumentConstraintResolution1.errors.txt @@ -1,5 +1,4 @@ tests/cases/compiler/typeArgumentConstraintResolution1.ts(4,12): error TS2345: Argument of type 'string' is not assignable to parameter of type 'Date'. - Property 'toDateString' is missing in type 'String'. tests/cases/compiler/typeArgumentConstraintResolution1.ts(11,12): error TS2345: Argument of type 'string' is not assignable to parameter of type 'Date'. @@ -10,7 +9,6 @@ tests/cases/compiler/typeArgumentConstraintResolution1.ts(11,12): error TS2345: foo1(""); // should error ~~ !!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'Date'. -!!! error TS2345: Property 'toDateString' is missing in type 'String'. diff --git a/tests/baselines/reference/typeArgumentInferenceApparentType1.symbols b/tests/baselines/reference/typeArgumentInferenceApparentType1.symbols index 00de7ec64c9..c9ef38b3c5c 100644 --- a/tests/baselines/reference/typeArgumentInferenceApparentType1.symbols +++ b/tests/baselines/reference/typeArgumentInferenceApparentType1.symbols @@ -3,7 +3,7 @@ function method(iterable: Iterable): T { >method : Symbol(method, Decl(typeArgumentInferenceApparentType1.ts, 0, 0)) >T : Symbol(T, Decl(typeArgumentInferenceApparentType1.ts, 0, 16)) >iterable : Symbol(iterable, Decl(typeArgumentInferenceApparentType1.ts, 0, 19)) ->Iterable : Symbol(Iterable, Decl(lib.d.ts, --, --)) +>Iterable : Symbol(Iterable, Decl(lib.es2015.iterable.d.ts, --, --)) >T : Symbol(T, Decl(typeArgumentInferenceApparentType1.ts, 0, 16)) >T : Symbol(T, Decl(typeArgumentInferenceApparentType1.ts, 0, 16)) diff --git a/tests/baselines/reference/typeArgumentInferenceApparentType2.symbols b/tests/baselines/reference/typeArgumentInferenceApparentType2.symbols index 4626aabb605..f257b3596ba 100644 --- a/tests/baselines/reference/typeArgumentInferenceApparentType2.symbols +++ b/tests/baselines/reference/typeArgumentInferenceApparentType2.symbols @@ -3,14 +3,14 @@ function method(iterable: Iterable): T { >method : Symbol(method, Decl(typeArgumentInferenceApparentType2.ts, 0, 0)) >T : Symbol(T, Decl(typeArgumentInferenceApparentType2.ts, 0, 16)) >iterable : Symbol(iterable, Decl(typeArgumentInferenceApparentType2.ts, 0, 19)) ->Iterable : Symbol(Iterable, Decl(lib.d.ts, --, --)) +>Iterable : Symbol(Iterable, Decl(lib.es2015.iterable.d.ts, --, --)) >T : Symbol(T, Decl(typeArgumentInferenceApparentType2.ts, 0, 16)) >T : Symbol(T, Decl(typeArgumentInferenceApparentType2.ts, 0, 16)) function inner>() { >inner : Symbol(inner, Decl(typeArgumentInferenceApparentType2.ts, 0, 46)) >U : Symbol(U, Decl(typeArgumentInferenceApparentType2.ts, 1, 19)) ->Iterable : Symbol(Iterable, Decl(lib.d.ts, --, --)) +>Iterable : Symbol(Iterable, Decl(lib.es2015.iterable.d.ts, --, --)) >T : Symbol(T, Decl(typeArgumentInferenceApparentType2.ts, 0, 16)) var u: U; diff --git a/tests/baselines/reference/typeArgumentInferenceConstructSignatures.errors.txt b/tests/baselines/reference/typeArgumentInferenceConstructSignatures.errors.txt index d058426b9c9..da01aa778b6 100644 --- a/tests/baselines/reference/typeArgumentInferenceConstructSignatures.errors.txt +++ b/tests/baselines/reference/typeArgumentInferenceConstructSignatures.errors.txt @@ -2,13 +2,13 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstruct tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstructSignatures.ts(51,19): error TS2304: Cannot find name 'Window'. tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstructSignatures.ts(61,39): error TS2345: Argument of type '(x: string) => string' is not assignable to parameter of type '(x: number) => void'. Types of parameters 'x' and 'x' are incompatible. - Type 'string' is not assignable to type 'number'. + Type 'number' is not assignable to type 'string'. tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstructSignatures.ts(71,39): error TS2345: Argument of type '(x: string) => string' is not assignable to parameter of type '(x: number) => void'. Types of parameters 'x' and 'x' are incompatible. - Type 'string' is not assignable to type 'number'. + Type 'number' is not assignable to type 'string'. tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstructSignatures.ts(81,45): error TS2345: Argument of type '(n: string) => string' is not assignable to parameter of type '(b: number) => number'. Types of parameters 'n' and 'b' are incompatible. - Type 'string' is not assignable to type 'number'. + Type 'number' is not assignable to type 'string'. tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstructSignatures.ts(106,15): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. Type argument candidate 'string' is not a valid type argument because it is not a supertype of candidate 'number'. tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstructSignatures.ts(118,9): error TS2304: Cannot find name 'Window'. @@ -90,7 +90,7 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstruct ~~~~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: string) => string' is not assignable to parameter of type '(x: number) => void'. !!! error TS2345: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2345: Type 'string' is not assignable to type 'number'. +!!! error TS2345: Type 'number' is not assignable to type 'string'. new someGenerics4(null, null); // 2 parameter generic call with argument 2 of type parameter type and argument 1 of function type whose parameter is of type parameter type @@ -104,7 +104,7 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstruct ~~~~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: string) => string' is not assignable to parameter of type '(x: number) => void'. !!! error TS2345: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2345: Type 'string' is not assignable to type 'number'. +!!! error TS2345: Type 'number' is not assignable to type 'string'. new someGenerics5(null, null); // Generic call with multiple arguments of function types that each have parameters of the same generic type @@ -118,7 +118,7 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstruct ~~~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(n: string) => string' is not assignable to parameter of type '(b: number) => number'. !!! error TS2345: Types of parameters 'n' and 'b' are incompatible. -!!! error TS2345: Type 'string' is not assignable to type 'number'. +!!! error TS2345: Type 'number' is not assignable to type 'string'. new someGenerics6((n: number) => n, (n: number) => n, (n: number) => n); // Generic call with multiple arguments of function types that each have parameters of different generic type diff --git a/tests/baselines/reference/typeArgumentInferenceErrors.errors.txt b/tests/baselines/reference/typeArgumentInferenceErrors.errors.txt index 9bd25dda4e6..36a17e166a5 100644 --- a/tests/baselines/reference/typeArgumentInferenceErrors.errors.txt +++ b/tests/baselines/reference/typeArgumentInferenceErrors.errors.txt @@ -1,13 +1,13 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceErrors.ts(3,31): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceErrors.ts(7,35): error TS2345: Argument of type '(x: string) => string' is not assignable to parameter of type '(x: number) => void'. Types of parameters 'x' and 'x' are incompatible. - Type 'string' is not assignable to type 'number'. + Type 'number' is not assignable to type 'string'. tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceErrors.ts(11,35): error TS2345: Argument of type '(x: string) => string' is not assignable to parameter of type '(x: number) => void'. Types of parameters 'x' and 'x' are incompatible. - Type 'string' is not assignable to type 'number'. + Type 'number' is not assignable to type 'string'. tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceErrors.ts(15,41): error TS2345: Argument of type '(n: string) => string' is not assignable to parameter of type '(b: number) => number'. Types of parameters 'n' and 'b' are incompatible. - Type 'string' is not assignable to type 'number'. + Type 'number' is not assignable to type 'string'. ==== tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceErrors.ts (4 errors) ==== @@ -23,7 +23,7 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceErrors.ts ~~~~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: string) => string' is not assignable to parameter of type '(x: number) => void'. !!! error TS2345: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2345: Type 'string' is not assignable to type 'number'. +!!! error TS2345: Type 'number' is not assignable to type 'string'. // 2 parameter generic call with argument 2 of type parameter type and argument 1 of function type whose parameter is of type parameter type function someGenerics5(n: T, f: (x: U) => void) { } @@ -31,7 +31,7 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceErrors.ts ~~~~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: string) => string' is not assignable to parameter of type '(x: number) => void'. !!! error TS2345: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2345: Type 'string' is not assignable to type 'number'. +!!! error TS2345: Type 'number' is not assignable to type 'string'. // Generic call with multiple arguments of function types that each have parameters of the same generic type function someGenerics6(a: (a: A) => A, b: (b: A) => A, c: (c: A) => A) { } @@ -39,5 +39,5 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceErrors.ts ~~~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(n: string) => string' is not assignable to parameter of type '(b: number) => number'. !!! error TS2345: Types of parameters 'n' and 'b' are incompatible. -!!! error TS2345: Type 'string' is not assignable to type 'number'. +!!! error TS2345: Type 'number' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/typeArgumentInferenceOrdering.symbols b/tests/baselines/reference/typeArgumentInferenceOrdering.symbols index 963be8731ec..630aebcf185 100644 --- a/tests/baselines/reference/typeArgumentInferenceOrdering.symbols +++ b/tests/baselines/reference/typeArgumentInferenceOrdering.symbols @@ -18,7 +18,7 @@ class C { >C : Symbol(C, Decl(typeArgumentInferenceOrdering.ts, 1, 23)) y: I; ->y : Symbol(y, Decl(typeArgumentInferenceOrdering.ts, 3, 9)) +>y : Symbol(C.y, Decl(typeArgumentInferenceOrdering.ts, 3, 9)) >I : Symbol(I, Decl(typeArgumentInferenceOrdering.ts, 5, 1)) } @@ -26,7 +26,7 @@ interface I { >I : Symbol(I, Decl(typeArgumentInferenceOrdering.ts, 5, 1)) x(): Goo; ->x : Symbol(x, Decl(typeArgumentInferenceOrdering.ts, 7, 13)) +>x : Symbol(I.x, Decl(typeArgumentInferenceOrdering.ts, 7, 13)) >Goo : Symbol(Goo, Decl(typeArgumentInferenceOrdering.ts, 9, 1)) } @@ -34,6 +34,6 @@ interface Goo { >Goo : Symbol(Goo, Decl(typeArgumentInferenceOrdering.ts, 9, 1)) p: string; ->p : Symbol(p, Decl(typeArgumentInferenceOrdering.ts, 11, 15)) +>p : Symbol(Goo.p, Decl(typeArgumentInferenceOrdering.ts, 11, 15)) } diff --git a/tests/baselines/reference/typeArgumentInferenceTransitiveConstraints.symbols b/tests/baselines/reference/typeArgumentInferenceTransitiveConstraints.symbols index 2d6270bbf5c..bc554ce9f86 100644 --- a/tests/baselines/reference/typeArgumentInferenceTransitiveConstraints.symbols +++ b/tests/baselines/reference/typeArgumentInferenceTransitiveConstraints.symbols @@ -3,7 +3,7 @@ function fn(a: A, b: B, c: C) { >fn : Symbol(fn, Decl(typeArgumentInferenceTransitiveConstraints.ts, 0, 0)) >A : Symbol(A, Decl(typeArgumentInferenceTransitiveConstraints.ts, 1, 12)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >B : Symbol(B, Decl(typeArgumentInferenceTransitiveConstraints.ts, 1, 27)) >A : Symbol(A, Decl(typeArgumentInferenceTransitiveConstraints.ts, 1, 12)) >C : Symbol(C, Decl(typeArgumentInferenceTransitiveConstraints.ts, 1, 40)) @@ -24,11 +24,11 @@ function fn(a: A, b: B, c: C) { var d = fn(new Date(), new Date(), new Date()); >d : Symbol(d, Decl(typeArgumentInferenceTransitiveConstraints.ts, 5, 3), Decl(typeArgumentInferenceTransitiveConstraints.ts, 6, 3)) >fn : Symbol(fn, Decl(typeArgumentInferenceTransitiveConstraints.ts, 0, 0)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) var d: Date[]; // Should be OK (d should be Date[]) >d : Symbol(d, Decl(typeArgumentInferenceTransitiveConstraints.ts, 5, 3), Decl(typeArgumentInferenceTransitiveConstraints.ts, 6, 3)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) diff --git a/tests/baselines/reference/typeArgumentInferenceWithConstraints.errors.txt b/tests/baselines/reference/typeArgumentInferenceWithConstraints.errors.txt index e6de840ec54..22d18e11eca 100644 --- a/tests/baselines/reference/typeArgumentInferenceWithConstraints.errors.txt +++ b/tests/baselines/reference/typeArgumentInferenceWithConstraints.errors.txt @@ -5,14 +5,14 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConst tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConstraints.ts(34,15): error TS2304: Cannot find name 'Window'. tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConstraints.ts(41,35): error TS2345: Argument of type '(x: string) => string' is not assignable to parameter of type '(x: number) => void'. Types of parameters 'x' and 'x' are incompatible. - Type 'string' is not assignable to type 'number'. + Type 'number' is not assignable to type 'string'. tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConstraints.ts(48,35): error TS2345: Argument of type '(x: string) => string' is not assignable to parameter of type '(x: number) => void'. Types of parameters 'x' and 'x' are incompatible. - Type 'string' is not assignable to type 'number'. + Type 'number' is not assignable to type 'string'. tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConstraints.ts(49,15): error TS2344: Type 'string' does not satisfy the constraint 'number'. tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConstraints.ts(55,41): error TS2345: Argument of type '(n: string) => string' is not assignable to parameter of type '(b: number) => number'. Types of parameters 'n' and 'b' are incompatible. - Type 'string' is not assignable to type 'number'. + Type 'number' is not assignable to type 'string'. tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConstraints.ts(66,31): error TS2345: Argument of type '(a: (a: A) => A, b: (b: B) => B, c: (c: C) => C) => void' is not assignable to parameter of type 'string'. tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConstraints.ts(73,11): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. Type argument candidate 'string' is not a valid type argument because it is not a supertype of candidate 'number'. @@ -81,7 +81,7 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConst ~~~~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: string) => string' is not assignable to parameter of type '(x: number) => void'. !!! error TS2345: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2345: Type 'string' is not assignable to type 'number'. +!!! error TS2345: Type 'number' is not assignable to type 'string'. someGenerics4(null, null); // 2 parameter generic call with argument 2 of type parameter type and argument 1 of function type whose parameter is of type parameter type @@ -92,7 +92,7 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConst ~~~~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: string) => string' is not assignable to parameter of type '(x: number) => void'. !!! error TS2345: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2345: Type 'string' is not assignable to type 'number'. +!!! error TS2345: Type 'number' is not assignable to type 'string'. someGenerics5(null, null); // Error ~~~~~~ !!! error TS2344: Type 'string' does not satisfy the constraint 'number'. @@ -105,7 +105,7 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConst ~~~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(n: string) => string' is not assignable to parameter of type '(b: number) => number'. !!! error TS2345: Types of parameters 'n' and 'b' are incompatible. -!!! error TS2345: Type 'string' is not assignable to type 'number'. +!!! error TS2345: Type 'number' is not assignable to type 'string'. someGenerics6((n: number) => n, (n: number) => n, (n: number) => n); // Generic call with multiple arguments of function types that each have parameters of different generic type diff --git a/tests/baselines/reference/typeArgumentsWithStringLiteralTypes01.errors.txt b/tests/baselines/reference/typeArgumentsWithStringLiteralTypes01.errors.txt index 49f17e7891d..48c7efb37e8 100644 --- a/tests/baselines/reference/typeArgumentsWithStringLiteralTypes01.errors.txt +++ b/tests/baselines/reference/typeArgumentsWithStringLiteralTypes01.errors.txt @@ -1,19 +1,13 @@ -tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(4,18): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(37,25): error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'. tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(38,25): error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'. tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(39,25): error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'. tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(40,25): error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'. tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(41,25): error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'. tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(44,30): error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello" | "World"'. - Type 'string' is not assignable to type '"World"'. tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(45,30): error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello" | "World"'. - Type 'string' is not assignable to type '"World"'. tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(46,30): error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello" | "World"'. - Type 'string' is not assignable to type '"World"'. tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(47,30): error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello" | "World"'. - Type 'string' is not assignable to type '"World"'. tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(48,30): error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello" | "World"'. - Type 'string' is not assignable to type '"World"'. tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(55,43): error TS2345: Argument of type '"World"' is not assignable to parameter of type '"Hello"'. tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(57,52): error TS2345: Argument of type '"World"' is not assignable to parameter of type '"Hello"'. tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(58,43): error TS2345: Argument of type '"World"' is not assignable to parameter of type '"Hello"'. @@ -27,22 +21,18 @@ tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes0 tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(88,43): error TS2345: Argument of type '"Hello"' is not assignable to parameter of type '"World"'. tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(89,52): error TS2345: Argument of type '"World"' is not assignable to parameter of type '"Hello"'. tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(93,5): error TS2322: Type 'string' is not assignable to type '"Hello" | "World"'. - Type 'string' is not assignable to type '"World"'. tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(97,5): error TS2322: Type 'string' is not assignable to type '"Hello" | "World"'. - Type 'string' is not assignable to type '"World"'. tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(100,25): error TS2345: Argument of type '"Hello" | "World"' is not assignable to parameter of type '"Hello"'. Type '"World"' is not assignable to type '"Hello"'. tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(104,25): error TS2345: Argument of type '"Hello" | "World"' is not assignable to parameter of type '"Hello"'. Type '"World"' is not assignable to type '"Hello"'. -==== tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts (25 errors) ==== +==== tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts (24 errors) ==== declare function randBool(): boolean; declare function takeReturnString(str: string): string; declare function takeReturnHello(str: "Hello"): "Hello"; - ~~~~~~~~~~~~~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. declare function takeReturnHelloWorld(str: "Hello" | "World"): "Hello" | "World"; function fun1(x: T, y: T) { @@ -95,23 +85,18 @@ tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes0 a = takeReturnHelloWorld(a); ~ !!! error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello" | "World"'. -!!! error TS2345: Type 'string' is not assignable to type '"World"'. b = takeReturnHelloWorld(b); ~ !!! error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello" | "World"'. -!!! error TS2345: Type 'string' is not assignable to type '"World"'. c = takeReturnHelloWorld(c); ~ !!! error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello" | "World"'. -!!! error TS2345: Type 'string' is not assignable to type '"World"'. d = takeReturnHelloWorld(d); ~ !!! error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello" | "World"'. -!!! error TS2345: Type 'string' is not assignable to type '"World"'. e = takeReturnHelloWorld(e); ~ !!! error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello" | "World"'. -!!! error TS2345: Type 'string' is not assignable to type '"World"'. } namespace n2 { @@ -181,14 +166,12 @@ tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes0 a = takeReturnString(a); ~ !!! error TS2322: Type 'string' is not assignable to type '"Hello" | "World"'. -!!! error TS2322: Type 'string' is not assignable to type '"World"'. b = takeReturnString(b); c = takeReturnString(c); d = takeReturnString(d); e = takeReturnString(e); ~ !!! error TS2322: Type 'string' is not assignable to type '"Hello" | "World"'. -!!! error TS2322: Type 'string' is not assignable to type '"World"'. // Passing these as arguments should cause an error. a = takeReturnHello(a); diff --git a/tests/baselines/reference/typeAssertions.errors.txt b/tests/baselines/reference/typeAssertions.errors.txt index a2ad28801c8..e330c23d737 100644 --- a/tests/baselines/reference/typeAssertions.errors.txt +++ b/tests/baselines/reference/typeAssertions.errors.txt @@ -1,15 +1,29 @@ tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts(5,5): error TS2346: Supplied parameters do not match any signature of call target. -tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts(31,12): error TS2352: Neither type 'SomeOther' nor type 'SomeBase' is assignable to the other. +tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts(31,12): error TS2352: Type 'SomeOther' cannot be converted to type 'SomeBase'. Property 'p' is missing in type 'SomeOther'. -tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts(35,15): error TS2352: Neither type 'SomeOther' nor type 'SomeDerived' is assignable to the other. +tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts(35,15): error TS2352: Type 'SomeOther' cannot be converted to type 'SomeDerived'. Property 'x' is missing in type 'SomeOther'. -tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts(37,13): error TS2352: Neither type 'SomeDerived' nor type 'SomeOther' is assignable to the other. +tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts(37,13): error TS2352: Type 'SomeDerived' cannot be converted to type 'SomeOther'. Property 'q' is missing in type 'SomeDerived'. -tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts(38,13): error TS2352: Neither type 'SomeBase' nor type 'SomeOther' is assignable to the other. +tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts(38,13): error TS2352: Type 'SomeBase' cannot be converted to type 'SomeOther'. Property 'q' is missing in type 'SomeBase'. +tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts(44,5): error TS2304: Cannot find name 'numOrStr'. +tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts(44,14): error TS1005: '>' expected. +tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts(44,14): error TS2304: Cannot find name 'is'. +tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts(44,17): error TS1005: ')' expected. +tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts(44,17): error TS2304: Cannot find name 'string'. +tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts(44,48): error TS1005: ';' expected. +tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts(45,2): error TS2322: Type 'number | string' is not assignable to type 'string'. + Type 'number' is not assignable to type 'string'. +tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts(48,32): error TS2304: Cannot find name 'numOrStr'. +tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts(48,41): error TS1005: ')' expected. +tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts(48,41): error TS2304: Cannot find name 'is'. +tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts(48,44): error TS1005: ';' expected. +tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts(48,44): error TS2304: Cannot find name 'string'. +tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts(48,50): error TS1005: ';' expected. -==== tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts (5 errors) ==== +==== tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts (18 errors) ==== // Function call whose argument is a 1 arg generic function call with explicit type arguments function fn1(t: T) { } function fn2(t: any) { } @@ -44,25 +58,61 @@ tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts(38,13): err someBase = someBase; someBase = someOther; // Error ~~~~~~~~~~~~~~~~~~~ -!!! error TS2352: Neither type 'SomeOther' nor type 'SomeBase' is assignable to the other. +!!! error TS2352: Type 'SomeOther' cannot be converted to type 'SomeBase'. !!! error TS2352: Property 'p' is missing in type 'SomeOther'. someDerived = someDerived; someDerived = someBase; someDerived = someOther; // Error ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2352: Neither type 'SomeOther' nor type 'SomeDerived' is assignable to the other. +!!! error TS2352: Type 'SomeOther' cannot be converted to type 'SomeDerived'. !!! error TS2352: Property 'x' is missing in type 'SomeOther'. someOther = someDerived; // Error ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2352: Neither type 'SomeDerived' nor type 'SomeOther' is assignable to the other. +!!! error TS2352: Type 'SomeDerived' cannot be converted to type 'SomeOther'. !!! error TS2352: Property 'q' is missing in type 'SomeDerived'. someOther = someBase; // Error ~~~~~~~~~~~~~~~~~~~ -!!! error TS2352: Neither type 'SomeBase' nor type 'SomeOther' is assignable to the other. +!!! error TS2352: Type 'SomeBase' cannot be converted to type 'SomeOther'. !!! error TS2352: Property 'q' is missing in type 'SomeBase'. someOther = someOther; + // Type assertion cannot be a type-predicate type + var numOrStr: number | string; + var str: string; + if((numOrStr === undefined)) { // Error + ~~~~~~~~ +!!! error TS2304: Cannot find name 'numOrStr'. + ~~ +!!! error TS1005: '>' expected. + ~~ +!!! error TS2304: Cannot find name 'is'. + ~~~~~~ +!!! error TS1005: ')' expected. + ~~~~~~ +!!! error TS2304: Cannot find name 'string'. + ~ +!!! error TS1005: ';' expected. + str = numOrStr; // Error, no narrowing occurred + ~~~ +!!! error TS2322: Type 'number | string' is not assignable to type 'string'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. + } + + if((numOrStr === undefined) as numOrStr is string) { // Error + ~~~~~~~~ +!!! error TS2304: Cannot find name 'numOrStr'. + ~~ +!!! error TS1005: ')' expected. + ~~ +!!! error TS2304: Cannot find name 'is'. + ~~~~~~ +!!! error TS1005: ';' expected. + ~~~~~~ +!!! error TS2304: Cannot find name 'string'. + ~ +!!! error TS1005: ';' expected. + } \ No newline at end of file diff --git a/tests/baselines/reference/typeAssertions.js b/tests/baselines/reference/typeAssertions.js index b58a46c37f6..1d33fa927a7 100644 --- a/tests/baselines/reference/typeAssertions.js +++ b/tests/baselines/reference/typeAssertions.js @@ -39,6 +39,15 @@ someOther = someDerived; // Error someOther = someBase; // Error someOther = someOther; +// Type assertion cannot be a type-predicate type +var numOrStr: number | string; +var str: string; +if((numOrStr === undefined)) { // Error + str = numOrStr; // Error, no narrowing occurred +} + +if((numOrStr === undefined) as numOrStr is string) { // Error +} @@ -87,3 +96,16 @@ someDerived = someOther; // Error someOther = someDerived; // Error someOther = someBase; // Error someOther = someOther; +// Type assertion cannot be a type-predicate type +var numOrStr; +var str; +if (is) + string > (numOrStr === undefined); +{ + str = numOrStr; // Error, no narrowing occurred +} +if ((numOrStr === undefined)) + is; +string; +{ +} diff --git a/tests/baselines/reference/typeAssertionsWithIntersectionTypes01.errors.txt b/tests/baselines/reference/typeAssertionsWithIntersectionTypes01.errors.txt new file mode 100644 index 00000000000..42ed640e8fc --- /dev/null +++ b/tests/baselines/reference/typeAssertionsWithIntersectionTypes01.errors.txt @@ -0,0 +1,34 @@ +tests/cases/conformance/types/typeRelationships/comparable/typeAssertionsWithIntersectionTypes01.ts(17,9): error TS2352: Type 'I2' cannot be converted to type 'I1 & I3'. + Type 'I2' is not comparable to type 'I3'. + Property 'p3' is missing in type 'I2'. +tests/cases/conformance/types/typeRelationships/comparable/typeAssertionsWithIntersectionTypes01.ts(18,9): error TS2352: Type 'I2' cannot be converted to type 'I3'. + + +==== tests/cases/conformance/types/typeRelationships/comparable/typeAssertionsWithIntersectionTypes01.ts (2 errors) ==== + interface I1 { + p1: number + } + + interface I2 extends I1 { + p2: number; + } + + interface I3 { + p3: number; + } + + var x = { p1: 10, p2: 20, p3: 30 }; + var y: I1 & I3 = x; + var z: I2 = x; + + var a = z; + ~~~~~~~~~~ +!!! error TS2352: Type 'I2' cannot be converted to type 'I1 & I3'. +!!! error TS2352: Type 'I2' is not comparable to type 'I3'. +!!! error TS2352: Property 'p3' is missing in type 'I2'. + var b = z; + ~~~~~ +!!! error TS2352: Type 'I2' cannot be converted to type 'I3'. + var c = z; + var d = y; + \ No newline at end of file diff --git a/tests/baselines/reference/typeAssertionsWithIntersectionTypes01.js b/tests/baselines/reference/typeAssertionsWithIntersectionTypes01.js new file mode 100644 index 00000000000..31fc831f95f --- /dev/null +++ b/tests/baselines/reference/typeAssertionsWithIntersectionTypes01.js @@ -0,0 +1,31 @@ +//// [typeAssertionsWithIntersectionTypes01.ts] +interface I1 { + p1: number +} + +interface I2 extends I1 { + p2: number; +} + +interface I3 { + p3: number; +} + +var x = { p1: 10, p2: 20, p3: 30 }; +var y: I1 & I3 = x; +var z: I2 = x; + +var a = z; +var b = z; +var c = z; +var d = y; + + +//// [typeAssertionsWithIntersectionTypes01.js] +var x = { p1: 10, p2: 20, p3: 30 }; +var y = x; +var z = x; +var a = z; +var b = z; +var c = z; +var d = y; diff --git a/tests/baselines/reference/typeAssertionsWithUnionTypes01.errors.txt b/tests/baselines/reference/typeAssertionsWithUnionTypes01.errors.txt new file mode 100644 index 00000000000..7bc2a9df9b3 --- /dev/null +++ b/tests/baselines/reference/typeAssertionsWithUnionTypes01.errors.txt @@ -0,0 +1,23 @@ +tests/cases/conformance/types/typeRelationships/comparable/typeAssertionsWithUnionTypes01.ts(14,9): error TS2352: Type 'I1' cannot be converted to type 'number'. + + +==== tests/cases/conformance/types/typeRelationships/comparable/typeAssertionsWithUnionTypes01.ts (1 errors) ==== + interface I1 { + p1: number + } + + interface I2 extends I1 { + p2: number; + } + + var x = { p1: 10, p2: 20 }; + var y: number | I2 = x; + var z: I1 = x; + + var a = z; + var b = z; + ~~~~~~~~~ +!!! error TS2352: Type 'I1' cannot be converted to type 'number'. + var c = z; + var d = y; + \ No newline at end of file diff --git a/tests/baselines/reference/typeAssertionsWithUnionTypes01.js b/tests/baselines/reference/typeAssertionsWithUnionTypes01.js new file mode 100644 index 00000000000..9cc448f6217 --- /dev/null +++ b/tests/baselines/reference/typeAssertionsWithUnionTypes01.js @@ -0,0 +1,27 @@ +//// [typeAssertionsWithUnionTypes01.ts] +interface I1 { + p1: number +} + +interface I2 extends I1 { + p2: number; +} + +var x = { p1: 10, p2: 20 }; +var y: number | I2 = x; +var z: I1 = x; + +var a = z; +var b = z; +var c = z; +var d = y; + + +//// [typeAssertionsWithUnionTypes01.js] +var x = { p1: 10, p2: 20 }; +var y = x; +var z = x; +var a = z; +var b = z; +var c = z; +var d = y; diff --git a/tests/baselines/reference/typeConstraintsWithConstructSignatures.symbols b/tests/baselines/reference/typeConstraintsWithConstructSignatures.symbols index f8848afcfab..6c6450ffd0e 100644 --- a/tests/baselines/reference/typeConstraintsWithConstructSignatures.symbols +++ b/tests/baselines/reference/typeConstraintsWithConstructSignatures.symbols @@ -11,25 +11,25 @@ class C { >Constructable : Symbol(Constructable, Decl(typeConstraintsWithConstructSignatures.ts, 0, 0)) constructor(public data: T, public data2: Constructable) { } ->data : Symbol(data, Decl(typeConstraintsWithConstructSignatures.ts, 5, 16)) +>data : Symbol(C.data, Decl(typeConstraintsWithConstructSignatures.ts, 5, 16)) >T : Symbol(T, Decl(typeConstraintsWithConstructSignatures.ts, 4, 8)) ->data2 : Symbol(data2, Decl(typeConstraintsWithConstructSignatures.ts, 5, 31)) +>data2 : Symbol(C.data2, Decl(typeConstraintsWithConstructSignatures.ts, 5, 31)) >Constructable : Symbol(Constructable, Decl(typeConstraintsWithConstructSignatures.ts, 0, 0)) create() { ->create : Symbol(create, Decl(typeConstraintsWithConstructSignatures.ts, 5, 64)) +>create : Symbol(C.create, Decl(typeConstraintsWithConstructSignatures.ts, 5, 64)) var x = new this.data(); // should not error >x : Symbol(x, Decl(typeConstraintsWithConstructSignatures.ts, 7, 11)) ->this.data : Symbol(data, Decl(typeConstraintsWithConstructSignatures.ts, 5, 16)) +>this.data : Symbol(C.data, Decl(typeConstraintsWithConstructSignatures.ts, 5, 16)) >this : Symbol(C, Decl(typeConstraintsWithConstructSignatures.ts, 2, 1)) ->data : Symbol(data, Decl(typeConstraintsWithConstructSignatures.ts, 5, 16)) +>data : Symbol(C.data, Decl(typeConstraintsWithConstructSignatures.ts, 5, 16)) var x2 = new this.data2(); // should not error >x2 : Symbol(x2, Decl(typeConstraintsWithConstructSignatures.ts, 8, 11)) ->this.data2 : Symbol(data2, Decl(typeConstraintsWithConstructSignatures.ts, 5, 31)) +>this.data2 : Symbol(C.data2, Decl(typeConstraintsWithConstructSignatures.ts, 5, 31)) >this : Symbol(C, Decl(typeConstraintsWithConstructSignatures.ts, 2, 1)) ->data2 : Symbol(data2, Decl(typeConstraintsWithConstructSignatures.ts, 5, 31)) +>data2 : Symbol(C.data2, Decl(typeConstraintsWithConstructSignatures.ts, 5, 31)) } } diff --git a/tests/baselines/reference/typeGuardEnums.types b/tests/baselines/reference/typeGuardEnums.types index 1d39a81d78a..2bef6915046 100644 --- a/tests/baselines/reference/typeGuardEnums.types +++ b/tests/baselines/reference/typeGuardEnums.types @@ -27,7 +27,7 @@ else { if (typeof x !== "number") { >typeof x !== "number" : boolean >typeof x : string ->x : number | string | E | V +>x : number | string >"number" : string x; // string @@ -35,6 +35,6 @@ if (typeof x !== "number") { } else { x; // number|E|V ->x : number | E | V +>x : number } diff --git a/tests/baselines/reference/typeGuardFunction.symbols b/tests/baselines/reference/typeGuardFunction.symbols index 13ad30de5c5..83bb3e713dd 100644 --- a/tests/baselines/reference/typeGuardFunction.symbols +++ b/tests/baselines/reference/typeGuardFunction.symbols @@ -4,14 +4,14 @@ class A { >A : Symbol(A, Decl(typeGuardFunction.ts, 0, 0)) propA: number; ->propA : Symbol(propA, Decl(typeGuardFunction.ts, 1, 9)) +>propA : Symbol(A.propA, Decl(typeGuardFunction.ts, 1, 9)) } class B { >B : Symbol(B, Decl(typeGuardFunction.ts, 3, 1)) propB: number; ->propB : Symbol(propB, Decl(typeGuardFunction.ts, 5, 9)) +>propB : Symbol(B.propB, Decl(typeGuardFunction.ts, 5, 9)) } class C extends A { @@ -19,7 +19,7 @@ class C extends A { >A : Symbol(A, Decl(typeGuardFunction.ts, 0, 0)) propC: number; ->propC : Symbol(propC, Decl(typeGuardFunction.ts, 9, 19)) +>propC : Symbol(C.propC, Decl(typeGuardFunction.ts, 9, 19)) } declare function isA(p1: any): p1 is A; @@ -139,7 +139,7 @@ class D { >D : Symbol(D, Decl(typeGuardFunction.ts, 54, 1)) method1(p1: A): p1 is C { ->method1 : Symbol(method1, Decl(typeGuardFunction.ts, 55, 9)) +>method1 : Symbol(D.method1, Decl(typeGuardFunction.ts, 55, 9)) >p1 : Symbol(p1, Decl(typeGuardFunction.ts, 56, 12)) >A : Symbol(A, Decl(typeGuardFunction.ts, 0, 0)) >p1 : Symbol(p1, Decl(typeGuardFunction.ts, 56, 12)) diff --git a/tests/baselines/reference/typeGuardFunction.types b/tests/baselines/reference/typeGuardFunction.types index 9bab1e7ca2c..50a5fcaf324 100644 --- a/tests/baselines/reference/typeGuardFunction.types +++ b/tests/baselines/reference/typeGuardFunction.types @@ -54,7 +54,7 @@ var b: B; // Basic if (isC(a)) { ->isC(a) : p1 is C +>isC(a) : boolean >isC : (p1: any) => p1 is C >a : A @@ -70,7 +70,7 @@ var subType: C; >C : C if(isA(subType)) { ->isA(subType) : p1 is A +>isA(subType) : boolean >isA : (p1: any) => p1 is A >subType : C @@ -87,7 +87,7 @@ var union: A | B; >B : B if(isA(union)) { ->isA(union) : p1 is A +>isA(union) : boolean >isA : (p1: any) => p1 is A >union : A | B @@ -118,7 +118,7 @@ declare function isC_multipleParams(p1, p2): p1 is C; >C : C if (isC_multipleParams(a, 0)) { ->isC_multipleParams(a, 0) : p1 is C +>isC_multipleParams(a, 0) : boolean >isC_multipleParams : (p1: any, p2: any) => p1 is C >a : A >0 : number @@ -197,7 +197,7 @@ declare function acceptingBoolean(a: boolean); acceptingBoolean(isA(a)); >acceptingBoolean(isA(a)) : any >acceptingBoolean : (a: boolean) => any ->isA(a) : p1 is A +>isA(a) : boolean >isA : (p1: any) => p1 is A >a : A @@ -223,8 +223,8 @@ let union2: C | B; let union3: boolean | B = isA(union2) || union2; >union3 : boolean | B >B : B ->isA(union2) || union2 : p1 is A | B ->isA(union2) : p1 is A +>isA(union2) || union2 : boolean | B +>isA(union2) : boolean >isA : (p1: any) => p1 is A >union2 : C | B >union2 : B diff --git a/tests/baselines/reference/typeGuardFunctionErrors.errors.txt b/tests/baselines/reference/typeGuardFunctionErrors.errors.txt index e1fdf303870..eac2660df81 100644 --- a/tests/baselines/reference/typeGuardFunctionErrors.errors.txt +++ b/tests/baselines/reference/typeGuardFunctionErrors.errors.txt @@ -1,15 +1,24 @@ -tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(15,12): error TS2322: Type 'string' is not assignable to type 'x is A'. +tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(2,7): error TS2300: Duplicate identifier 'A'. +tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(15,12): error TS2322: Type 'string' is not assignable to type 'boolean'. +tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(18,55): error TS2304: Cannot find name 'x'. +tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(18,57): error TS1144: '{' or ';' expected. +tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(18,57): error TS2304: Cannot find name 'is'. +tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(18,60): error TS1005: ';' expected. +tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(18,62): error TS1005: ';' expected. tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(22,33): error TS2304: Cannot find name 'x'. tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(26,33): error TS1225: Cannot find parameter 'x'. tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(30,10): error TS2391: Function implementation is missing or not immediately following the declaration. tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(31,5): error TS1131: Property or signature expected. +tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(31,5): error TS7027: Unreachable code detected. tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(32,1): error TS1128: Declaration or statement expected. tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(34,38): error TS1225: Cannot find parameter 'x'. -tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(38,51): error TS2322: Type 'B' is not assignable to type 'A'. - Property 'propA' is missing in type 'B'. -tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(42,56): error TS2322: Type 'number' is not assignable to type 'string'. -tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(46,56): error TS2322: Type 'T[]' is not assignable to type 'string'. -tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(50,1): error TS7027: Unreachable code detected. +tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(38,51): error TS2677: A type predicate's type must be assignable to its parameter's type. + Type 'B' is not assignable to type 'A'. + Property 'propA' is missing in type 'B'. +tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(42,56): error TS2677: A type predicate's type must be assignable to its parameter's type. + Type 'number' is not assignable to type 'string'. +tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(46,56): error TS2677: A type predicate's type must be assignable to its parameter's type. + Type 'T[]' is not assignable to type 'string'. tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(60,7): error TS2339: Property 'propB' does not exist on type 'A'. tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(65,7): error TS2339: Property 'propB' does not exist on type 'A'. tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(70,7): error TS2339: Property 'propB' does not exist on type 'A'. @@ -23,27 +32,43 @@ tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(85,1): Type predicate 'p2 is A' is not assignable to 'p1 is A'. Parameter 'p2' is not in the same position as parameter 'p1'. tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(91,1): error TS2322: Type '(p1: any, p2: any, p3: any) => p1 is A' is not assignable to type '(p1: any, p2: any) => p1 is A'. -tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(96,9): error TS1228: A type predicate is only allowed in return type position for functions and methods. -tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(97,16): error TS1228: A type predicate is only allowed in return type position for functions and methods. -tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(98,20): error TS1228: A type predicate is only allowed in return type position for functions and methods. +tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(96,9): error TS2304: Cannot find name 'b'. +tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(96,11): error TS1005: '=' expected. +tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(96,11): error TS2304: Cannot find name 'is'. +tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(96,14): error TS1005: ',' expected. +tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(96,14): error TS2300: Duplicate identifier 'A'. +tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(97,16): error TS2304: Cannot find name 'b'. +tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(97,18): error TS1005: '=' expected. +tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(97,18): error TS2304: Cannot find name 'is'. +tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(97,21): error TS1005: ',' expected. +tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(98,20): error TS2304: Cannot find name 'b'. +tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(98,22): error TS1144: '{' or ';' expected. +tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(98,22): error TS2304: Cannot find name 'is'. +tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(98,25): error TS1005: ';' expected. +tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(98,27): error TS1005: ';' expected. +tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(104,25): error TS1228: A type predicate is only allowed in return type position for functions and methods. tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(105,16): error TS2322: Type 'boolean' is not assignable to type 'D'. - Property 'm1' is missing in type 'Boolean'. tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(105,16): error TS2409: Return type of constructor signature must be assignable to the instance type of the class tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(107,20): error TS1228: A type predicate is only allowed in return type position for functions and methods. tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(110,20): error TS1228: A type predicate is only allowed in return type position for functions and methods. tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(111,16): error TS2408: Setters cannot return a value. tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(116,18): error TS1228: A type predicate is only allowed in return type position for functions and methods. -tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(120,22): error TS1225: Cannot find parameter 'p1'. -tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(120,22): error TS1228: A type predicate is only allowed in return type position for functions and methods. +tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(120,22): error TS2304: Cannot find name 'p1'. +tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(120,25): error TS1005: ';' expected. +tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(120,25): error TS2304: Cannot find name 'is'. +tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(120,28): error TS1005: ';' expected. +tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(121,1): error TS1128: Declaration or statement expected. tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(124,20): error TS1229: A type predicate cannot reference a rest parameter. tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(129,34): error TS1230: A type predicate cannot reference element 'p1' in a binding pattern. tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(133,34): error TS1230: A type predicate cannot reference element 'p1' in a binding pattern. tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(137,39): error TS1230: A type predicate cannot reference element 'p1' in a binding pattern. -==== tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts (33 errors) ==== +==== tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts (54 errors) ==== class A { + ~ +!!! error TS2300: Duplicate identifier 'A'. propA: number; } @@ -58,10 +83,20 @@ tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(137,39 function hasANonBooleanReturnStatement(x): x is A { return ''; ~~ -!!! error TS2322: Type 'string' is not assignable to type 'x is A'. +!!! error TS2322: Type 'string' is not assignable to type 'boolean'. } function hasTypeGuardTypeInsideTypeGuardType(x): x is x is A { + ~ +!!! error TS2304: Cannot find name 'x'. + ~~ +!!! error TS1144: '{' or ';' expected. + ~~ +!!! error TS2304: Cannot find name 'is'. + ~ +!!! error TS1005: ';' expected. + ~ +!!! error TS1005: ';' expected. return true; } @@ -83,6 +118,8 @@ tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(137,39 return true; ~~~~~~ !!! error TS1131: Property or signature expected. + ~~~~~~ +!!! error TS7027: Unreachable code detected. } ~ !!! error TS1128: Declaration or statement expected. @@ -95,26 +132,27 @@ tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(137,39 function hasNonMatchingParameterType1(x: A): x is B { ~ -!!! error TS2322: Type 'B' is not assignable to type 'A'. -!!! error TS2322: Property 'propA' is missing in type 'B'. +!!! error TS2677: A type predicate's type must be assignable to its parameter's type. +!!! error TS2677: Type 'B' is not assignable to type 'A'. +!!! error TS2677: Property 'propA' is missing in type 'B'. return true; } function hasNonMatchingParameterType2(x: string): x is number { ~~~~~~ -!!! error TS2322: Type 'number' is not assignable to type 'string'. +!!! error TS2677: A type predicate's type must be assignable to its parameter's type. +!!! error TS2677: Type 'number' is not assignable to type 'string'. return true; } function hasNonMathcingGenericType(a: string): a is T[] { ~~~ -!!! error TS2322: Type 'T[]' is not assignable to type 'string'. +!!! error TS2677: A type predicate's type must be assignable to its parameter's type. +!!! error TS2677: Type 'T[]' is not assignable to type 'string'. return true; } let a: A; - ~~~ -!!! error TS7027: Unreachable code detected. let b: B; declare function isB(p1): p1 is B; @@ -181,24 +219,47 @@ tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(137,39 // Type predicates in non-return type positions var b1: b is A; - ~~~~~~ -!!! error TS1228: A type predicate is only allowed in return type position for functions and methods. + ~ +!!! error TS2304: Cannot find name 'b'. + ~~ +!!! error TS1005: '=' expected. + ~~ +!!! error TS2304: Cannot find name 'is'. + ~ +!!! error TS1005: ',' expected. + ~ +!!! error TS2300: Duplicate identifier 'A'. function b2(a: b is A) {}; - ~~~~~~ -!!! error TS1228: A type predicate is only allowed in return type position for functions and methods. + ~ +!!! error TS2304: Cannot find name 'b'. + ~~ +!!! error TS1005: '=' expected. + ~~ +!!! error TS2304: Cannot find name 'is'. + ~ +!!! error TS1005: ',' expected. function b3(): A | b is A { - ~~~~~~ -!!! error TS1228: A type predicate is only allowed in return type position for functions and methods. + ~ +!!! error TS2304: Cannot find name 'b'. + ~~ +!!! error TS1144: '{' or ';' expected. + ~~ +!!! error TS2304: Cannot find name 'is'. + ~ +!!! error TS1005: ';' expected. + ~ +!!! error TS1005: ';' expected. return true; }; // Non-compatiable type predicate positions for signature declarations class D { constructor(p1: A): p1 is C { + ~~~~~~~ +!!! error TS1228: A type predicate is only allowed in return type position for functions and methods. return true; ~~~~ !!! error TS2322: Type 'boolean' is not assignable to type 'D'. -!!! error TS2322: Property 'm1' is missing in type 'Boolean'. ~~~~ !!! error TS2409: Return type of constructor signature must be assignable to the instance type of the class } @@ -225,10 +286,16 @@ tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(137,39 interface I2 { [index: number]: p1 is C; ~~ -!!! error TS1225: Cannot find parameter 'p1'. - ~~~~~~~ -!!! error TS1228: A type predicate is only allowed in return type position for functions and methods. +!!! error TS2304: Cannot find name 'p1'. + ~~ +!!! error TS1005: ';' expected. + ~~ +!!! error TS2304: Cannot find name 'is'. + ~ +!!! error TS1005: ';' expected. } + ~ +!!! error TS1128: Declaration or statement expected. // Reference to rest parameter function b4(...a): a is A { diff --git a/tests/baselines/reference/typeGuardFunctionErrors.js b/tests/baselines/reference/typeGuardFunctionErrors.js index 5e69749e582..dcd8ffcb265 100644 --- a/tests/baselines/reference/typeGuardFunctionErrors.js +++ b/tests/baselines/reference/typeGuardFunctionErrors.js @@ -171,7 +171,9 @@ var C = (function (_super) { function hasANonBooleanReturnStatement(x) { return ''; } -function hasTypeGuardTypeInsideTypeGuardType(x) { +is; +A; +{ return true; } function hasMissingIsKeyword() { @@ -224,10 +226,14 @@ assign3 = function (p1, p2, p3) { return true; }; // Type predicates in non-return type positions -var b1; -function b2(a) { } +var b1 = is, A; +function b2(a, A) { + if (a === void 0) { a = is; } +} ; -function b3() { +is; +A; +{ return true; } ; @@ -252,6 +258,8 @@ var D = (function () { }); return D; }()); +is; +C; // Reference to rest parameter function b4() { var a = []; diff --git a/tests/baselines/reference/typeGuardFunctionGenerics.symbols b/tests/baselines/reference/typeGuardFunctionGenerics.symbols index 100d610070d..45debfcf73d 100644 --- a/tests/baselines/reference/typeGuardFunctionGenerics.symbols +++ b/tests/baselines/reference/typeGuardFunctionGenerics.symbols @@ -4,14 +4,14 @@ class A { >A : Symbol(A, Decl(typeGuardFunctionGenerics.ts, 0, 0)) propA: number; ->propA : Symbol(propA, Decl(typeGuardFunctionGenerics.ts, 1, 9)) +>propA : Symbol(A.propA, Decl(typeGuardFunctionGenerics.ts, 1, 9)) } class B { >B : Symbol(B, Decl(typeGuardFunctionGenerics.ts, 3, 1)) propB: number; ->propB : Symbol(propB, Decl(typeGuardFunctionGenerics.ts, 5, 9)) +>propB : Symbol(B.propB, Decl(typeGuardFunctionGenerics.ts, 5, 9)) } class C extends A { @@ -19,7 +19,7 @@ class C extends A { >A : Symbol(A, Decl(typeGuardFunctionGenerics.ts, 0, 0)) propC: number; ->propC : Symbol(propC, Decl(typeGuardFunctionGenerics.ts, 9, 19)) +>propC : Symbol(C.propC, Decl(typeGuardFunctionGenerics.ts, 9, 19)) } declare function isB(p1): p1 is B; diff --git a/tests/baselines/reference/typeGuardFunctionGenerics.types b/tests/baselines/reference/typeGuardFunctionGenerics.types index 1f2ad2b69be..c4655e71f0c 100644 --- a/tests/baselines/reference/typeGuardFunctionGenerics.types +++ b/tests/baselines/reference/typeGuardFunctionGenerics.types @@ -100,7 +100,7 @@ let test1: boolean = funA(isB); >isB : (p1: any) => p1 is B if (funB(retC, a)) { ->funB(retC, a) : p2 is C +>funB(retC, a) : boolean >funB : (p1: (p1: any) => T, p2: any) => p2 is T >retC : (x: any) => C >a : A @@ -118,7 +118,7 @@ let test2: B = funC(isB); >isB : (p1: any) => p1 is B if (funD(isC, a)) { ->funD(isC, a) : p2 is C +>funD(isC, a) : boolean >funD : (p1: (p1: any) => p1 is T, p2: any) => p2 is T >isC : (p1: any) => p1 is C >a : A diff --git a/tests/baselines/reference/typeGuardFunctionOfFormThis.js b/tests/baselines/reference/typeGuardFunctionOfFormThis.js index 0d1dceccede..ad85f679e0a 100644 --- a/tests/baselines/reference/typeGuardFunctionOfFormThis.js +++ b/tests/baselines/reference/typeGuardFunctionOfFormThis.js @@ -34,19 +34,19 @@ else if (b.isFollower()) { b.follow(); } -if (((a.isLeader)())) { - a.lead(); -} -else if (((a).isFollower())) { - a.follow(); -} +// if (((a.isLeader)())) { +// a.lead(); +// } +// else if (((a).isFollower())) { +// a.follow(); +// } -if (((a["isLeader"])())) { - a.lead(); -} -else if (((a)["isFollower"]())) { - a.follow(); -} +// if (((a["isLeader"])())) { +// a.lead(); +// } +// else if (((a)["isFollower"]())) { +// a.follow(); +// } var holder2 = {a}; @@ -190,18 +190,18 @@ if (b.isLeader()) { else if (b.isFollower()) { b.follow(); } -if (((a.isLeader)())) { - a.lead(); -} -else if (((a).isFollower())) { - a.follow(); -} -if (((a["isLeader"])())) { - a.lead(); -} -else if (((a)["isFollower"]())) { - a.follow(); -} +// if (((a.isLeader)())) { +// a.lead(); +// } +// else if (((a).isFollower())) { +// a.follow(); +// } +// if (((a["isLeader"])())) { +// a.lead(); +// } +// else if (((a)["isFollower"]())) { +// a.follow(); +// } var holder2 = { a: a }; if (holder2.a.isLeader()) { holder2.a; diff --git a/tests/baselines/reference/typeGuardFunctionOfFormThis.symbols b/tests/baselines/reference/typeGuardFunctionOfFormThis.symbols index 2968063dc51..3ac972200e2 100644 --- a/tests/baselines/reference/typeGuardFunctionOfFormThis.symbols +++ b/tests/baselines/reference/typeGuardFunctionOfFormThis.symbols @@ -3,7 +3,7 @@ class RoyalGuard { >RoyalGuard : Symbol(RoyalGuard, Decl(typeGuardFunctionOfFormThis.ts, 0, 0)) isLeader(): this is LeadGuard { ->isLeader : Symbol(isLeader, Decl(typeGuardFunctionOfFormThis.ts, 0, 18)) +>isLeader : Symbol(RoyalGuard.isLeader, Decl(typeGuardFunctionOfFormThis.ts, 0, 18)) >LeadGuard : Symbol(LeadGuard, Decl(typeGuardFunctionOfFormThis.ts, 7, 1)) return this instanceof LeadGuard; @@ -11,7 +11,7 @@ class RoyalGuard { >LeadGuard : Symbol(LeadGuard, Decl(typeGuardFunctionOfFormThis.ts, 7, 1)) } isFollower(): this is FollowerGuard { ->isFollower : Symbol(isFollower, Decl(typeGuardFunctionOfFormThis.ts, 3, 5)) +>isFollower : Symbol(RoyalGuard.isFollower, Decl(typeGuardFunctionOfFormThis.ts, 3, 5)) >FollowerGuard : Symbol(FollowerGuard, Decl(typeGuardFunctionOfFormThis.ts, 11, 1)) return this instanceof FollowerGuard; @@ -25,7 +25,7 @@ class LeadGuard extends RoyalGuard { >RoyalGuard : Symbol(RoyalGuard, Decl(typeGuardFunctionOfFormThis.ts, 0, 0)) lead(): void {}; ->lead : Symbol(lead, Decl(typeGuardFunctionOfFormThis.ts, 9, 36)) +>lead : Symbol(LeadGuard.lead, Decl(typeGuardFunctionOfFormThis.ts, 9, 36)) } class FollowerGuard extends RoyalGuard { @@ -33,7 +33,7 @@ class FollowerGuard extends RoyalGuard { >RoyalGuard : Symbol(RoyalGuard, Decl(typeGuardFunctionOfFormThis.ts, 0, 0)) follow(): void {}; ->follow : Symbol(follow, Decl(typeGuardFunctionOfFormThis.ts, 13, 40)) +>follow : Symbol(FollowerGuard.follow, Decl(typeGuardFunctionOfFormThis.ts, 13, 40)) } let a: RoyalGuard = new FollowerGuard(); @@ -91,45 +91,19 @@ else if (b.isFollower()) { >follow : Symbol(FollowerGuard.follow, Decl(typeGuardFunctionOfFormThis.ts, 13, 40)) } -if (((a.isLeader)())) { ->a.isLeader : Symbol(RoyalGuard.isLeader, Decl(typeGuardFunctionOfFormThis.ts, 0, 18)) ->a : Symbol(a, Decl(typeGuardFunctionOfFormThis.ts, 17, 3)) ->isLeader : Symbol(RoyalGuard.isLeader, Decl(typeGuardFunctionOfFormThis.ts, 0, 18)) +// if (((a.isLeader)())) { +// a.lead(); +// } +// else if (((a).isFollower())) { +// a.follow(); +// } - a.lead(); ->a.lead : Symbol(LeadGuard.lead, Decl(typeGuardFunctionOfFormThis.ts, 9, 36)) ->a : Symbol(a, Decl(typeGuardFunctionOfFormThis.ts, 17, 3)) ->lead : Symbol(LeadGuard.lead, Decl(typeGuardFunctionOfFormThis.ts, 9, 36)) -} -else if (((a).isFollower())) { ->(a).isFollower : Symbol(RoyalGuard.isFollower, Decl(typeGuardFunctionOfFormThis.ts, 3, 5)) ->a : Symbol(a, Decl(typeGuardFunctionOfFormThis.ts, 17, 3)) ->isFollower : Symbol(RoyalGuard.isFollower, Decl(typeGuardFunctionOfFormThis.ts, 3, 5)) - - a.follow(); ->a.follow : Symbol(FollowerGuard.follow, Decl(typeGuardFunctionOfFormThis.ts, 13, 40)) ->a : Symbol(a, Decl(typeGuardFunctionOfFormThis.ts, 17, 3)) ->follow : Symbol(FollowerGuard.follow, Decl(typeGuardFunctionOfFormThis.ts, 13, 40)) -} - -if (((a["isLeader"])())) { ->a : Symbol(a, Decl(typeGuardFunctionOfFormThis.ts, 17, 3)) ->"isLeader" : Symbol(RoyalGuard.isLeader, Decl(typeGuardFunctionOfFormThis.ts, 0, 18)) - - a.lead(); ->a.lead : Symbol(LeadGuard.lead, Decl(typeGuardFunctionOfFormThis.ts, 9, 36)) ->a : Symbol(a, Decl(typeGuardFunctionOfFormThis.ts, 17, 3)) ->lead : Symbol(LeadGuard.lead, Decl(typeGuardFunctionOfFormThis.ts, 9, 36)) -} -else if (((a)["isFollower"]())) { ->a : Symbol(a, Decl(typeGuardFunctionOfFormThis.ts, 17, 3)) ->"isFollower" : Symbol(RoyalGuard.isFollower, Decl(typeGuardFunctionOfFormThis.ts, 3, 5)) - - a.follow(); ->a.follow : Symbol(FollowerGuard.follow, Decl(typeGuardFunctionOfFormThis.ts, 13, 40)) ->a : Symbol(a, Decl(typeGuardFunctionOfFormThis.ts, 17, 3)) ->follow : Symbol(FollowerGuard.follow, Decl(typeGuardFunctionOfFormThis.ts, 13, 40)) -} +// if (((a["isLeader"])())) { +// a.lead(); +// } +// else if (((a)["isFollower"]())) { +// a.follow(); +// } var holder2 = {a}; >holder2 : Symbol(holder2, Decl(typeGuardFunctionOfFormThis.ts, 49, 3)) @@ -158,7 +132,7 @@ class ArrowGuard { >ArrowGuard : Symbol(ArrowGuard, Decl(typeGuardFunctionOfFormThis.ts, 56, 1)) isElite = (): this is ArrowElite => { ->isElite : Symbol(isElite, Decl(typeGuardFunctionOfFormThis.ts, 58, 18)) +>isElite : Symbol(ArrowGuard.isElite, Decl(typeGuardFunctionOfFormThis.ts, 58, 18)) >ArrowElite : Symbol(ArrowElite, Decl(typeGuardFunctionOfFormThis.ts, 65, 1)) return this instanceof ArrowElite; @@ -166,7 +140,7 @@ class ArrowGuard { >ArrowElite : Symbol(ArrowElite, Decl(typeGuardFunctionOfFormThis.ts, 65, 1)) } isMedic = (): this is ArrowMedic => { ->isMedic : Symbol(isMedic, Decl(typeGuardFunctionOfFormThis.ts, 61, 5)) +>isMedic : Symbol(ArrowGuard.isMedic, Decl(typeGuardFunctionOfFormThis.ts, 61, 5)) >ArrowMedic : Symbol(ArrowMedic, Decl(typeGuardFunctionOfFormThis.ts, 69, 1)) return this instanceof ArrowMedic; @@ -180,7 +154,7 @@ class ArrowElite extends ArrowGuard { >ArrowGuard : Symbol(ArrowGuard, Decl(typeGuardFunctionOfFormThis.ts, 56, 1)) defend(): void {} ->defend : Symbol(defend, Decl(typeGuardFunctionOfFormThis.ts, 67, 37)) +>defend : Symbol(ArrowElite.defend, Decl(typeGuardFunctionOfFormThis.ts, 67, 37)) } class ArrowMedic extends ArrowGuard { @@ -188,7 +162,7 @@ class ArrowMedic extends ArrowGuard { >ArrowGuard : Symbol(ArrowGuard, Decl(typeGuardFunctionOfFormThis.ts, 56, 1)) heal(): void {} ->heal : Symbol(heal, Decl(typeGuardFunctionOfFormThis.ts, 71, 37)) +>heal : Symbol(ArrowMedic.heal, Decl(typeGuardFunctionOfFormThis.ts, 71, 37)) } let guard = new ArrowGuard(); @@ -220,14 +194,14 @@ interface Supplies { >Supplies : Symbol(Supplies, Decl(typeGuardFunctionOfFormThis.ts, 81, 1)) spoiled: boolean; ->spoiled : Symbol(spoiled, Decl(typeGuardFunctionOfFormThis.ts, 83, 20)) +>spoiled : Symbol(Supplies.spoiled, Decl(typeGuardFunctionOfFormThis.ts, 83, 20)) } interface Sundries { >Sundries : Symbol(Sundries, Decl(typeGuardFunctionOfFormThis.ts, 85, 1)) broken: boolean; ->broken : Symbol(broken, Decl(typeGuardFunctionOfFormThis.ts, 87, 20)) +>broken : Symbol(Sundries.broken, Decl(typeGuardFunctionOfFormThis.ts, 87, 20)) } interface Crate { @@ -235,19 +209,19 @@ interface Crate { >T : Symbol(T, Decl(typeGuardFunctionOfFormThis.ts, 91, 16)) contents: T; ->contents : Symbol(contents, Decl(typeGuardFunctionOfFormThis.ts, 91, 20)) +>contents : Symbol(Crate.contents, Decl(typeGuardFunctionOfFormThis.ts, 91, 20)) >T : Symbol(T, Decl(typeGuardFunctionOfFormThis.ts, 91, 16)) volume: number; ->volume : Symbol(volume, Decl(typeGuardFunctionOfFormThis.ts, 92, 16)) +>volume : Symbol(Crate.volume, Decl(typeGuardFunctionOfFormThis.ts, 92, 16)) isSupplies(): this is Crate; ->isSupplies : Symbol(isSupplies, Decl(typeGuardFunctionOfFormThis.ts, 93, 19)) +>isSupplies : Symbol(Crate.isSupplies, Decl(typeGuardFunctionOfFormThis.ts, 93, 19)) >Crate : Symbol(Crate, Decl(typeGuardFunctionOfFormThis.ts, 89, 1)) >Supplies : Symbol(Supplies, Decl(typeGuardFunctionOfFormThis.ts, 81, 1)) isSundries(): this is Crate; ->isSundries : Symbol(isSundries, Decl(typeGuardFunctionOfFormThis.ts, 94, 42)) +>isSundries : Symbol(Crate.isSundries, Decl(typeGuardFunctionOfFormThis.ts, 94, 42)) >Crate : Symbol(Crate, Decl(typeGuardFunctionOfFormThis.ts, 89, 1)) >Sundries : Symbol(Sundries, Decl(typeGuardFunctionOfFormThis.ts, 85, 1)) } @@ -303,13 +277,13 @@ class MimicGuard { >MimicGuard : Symbol(MimicGuard, Decl(typeGuardFunctionOfFormThis.ts, 110, 24)) isLeader(): this is MimicLeader { return this instanceof MimicLeader; }; ->isLeader : Symbol(isLeader, Decl(typeGuardFunctionOfFormThis.ts, 112, 18)) +>isLeader : Symbol(MimicGuard.isLeader, Decl(typeGuardFunctionOfFormThis.ts, 112, 18)) >MimicLeader : Symbol(MimicLeader, Decl(typeGuardFunctionOfFormThis.ts, 115, 1)) >this : Symbol(MimicGuard, Decl(typeGuardFunctionOfFormThis.ts, 110, 24)) >MimicLeader : Symbol(MimicLeader, Decl(typeGuardFunctionOfFormThis.ts, 115, 1)) isFollower(): this is MimicFollower { return this instanceof MimicFollower; }; ->isFollower : Symbol(isFollower, Decl(typeGuardFunctionOfFormThis.ts, 113, 76)) +>isFollower : Symbol(MimicGuard.isFollower, Decl(typeGuardFunctionOfFormThis.ts, 113, 76)) >MimicFollower : Symbol(MimicFollower, Decl(typeGuardFunctionOfFormThis.ts, 119, 1)) >this : Symbol(MimicGuard, Decl(typeGuardFunctionOfFormThis.ts, 110, 24)) >MimicFollower : Symbol(MimicFollower, Decl(typeGuardFunctionOfFormThis.ts, 119, 1)) @@ -320,7 +294,7 @@ class MimicLeader extends MimicGuard { >MimicGuard : Symbol(MimicGuard, Decl(typeGuardFunctionOfFormThis.ts, 110, 24)) lead(): void {} ->lead : Symbol(lead, Decl(typeGuardFunctionOfFormThis.ts, 117, 38)) +>lead : Symbol(MimicLeader.lead, Decl(typeGuardFunctionOfFormThis.ts, 117, 38)) } class MimicFollower extends MimicGuard { @@ -328,7 +302,7 @@ class MimicFollower extends MimicGuard { >MimicGuard : Symbol(MimicGuard, Decl(typeGuardFunctionOfFormThis.ts, 110, 24)) follow(): void {} ->follow : Symbol(follow, Decl(typeGuardFunctionOfFormThis.ts, 121, 40)) +>follow : Symbol(MimicFollower.follow, Decl(typeGuardFunctionOfFormThis.ts, 121, 40)) } let mimic = new MimicGuard(); @@ -375,11 +349,11 @@ interface MimicGuardInterface { >MimicGuardInterface : Symbol(MimicGuardInterface, Decl(typeGuardFunctionOfFormThis.ts, 133, 1)) isLeader(): this is LeadGuard; ->isLeader : Symbol(isLeader, Decl(typeGuardFunctionOfFormThis.ts, 136, 31)) +>isLeader : Symbol(MimicGuardInterface.isLeader, Decl(typeGuardFunctionOfFormThis.ts, 136, 31)) >LeadGuard : Symbol(LeadGuard, Decl(typeGuardFunctionOfFormThis.ts, 7, 1)) isFollower(): this is FollowerGuard; ->isFollower : Symbol(isFollower, Decl(typeGuardFunctionOfFormThis.ts, 137, 34)) +>isFollower : Symbol(MimicGuardInterface.isFollower, Decl(typeGuardFunctionOfFormThis.ts, 137, 34)) >FollowerGuard : Symbol(FollowerGuard, Decl(typeGuardFunctionOfFormThis.ts, 11, 1)) } diff --git a/tests/baselines/reference/typeGuardFunctionOfFormThis.types b/tests/baselines/reference/typeGuardFunctionOfFormThis.types index e91c77dd07a..66d1a4b5b11 100644 --- a/tests/baselines/reference/typeGuardFunctionOfFormThis.types +++ b/tests/baselines/reference/typeGuardFunctionOfFormThis.types @@ -45,7 +45,7 @@ let a: RoyalGuard = new FollowerGuard(); >FollowerGuard : typeof FollowerGuard if (a.isLeader()) { ->a.isLeader() : this is LeadGuard +>a.isLeader() : boolean >a.isLeader : () => this is LeadGuard >a : RoyalGuard >isLeader : () => this is LeadGuard @@ -57,7 +57,7 @@ if (a.isLeader()) { >lead : () => void } else if (a.isFollower()) { ->a.isFollower() : this is FollowerGuard +>a.isFollower() : boolean >a.isFollower : () => this is FollowerGuard >a : RoyalGuard >isFollower : () => this is FollowerGuard @@ -78,7 +78,7 @@ let b: GuardInterface; >GuardInterface : GuardInterface if (b.isLeader()) { ->b.isLeader() : this is LeadGuard +>b.isLeader() : boolean >b.isLeader : () => this is LeadGuard >b : GuardInterface >isLeader : () => this is LeadGuard @@ -90,7 +90,7 @@ if (b.isLeader()) { >lead : () => void } else if (b.isFollower()) { ->b.isFollower() : this is FollowerGuard +>b.isFollower() : boolean >b.isFollower : () => this is FollowerGuard >b : GuardInterface >isFollower : () => this is FollowerGuard @@ -102,63 +102,19 @@ else if (b.isFollower()) { >follow : () => void } -if (((a.isLeader)())) { ->((a.isLeader)()) : this is LeadGuard ->(a.isLeader)() : this is LeadGuard ->(a.isLeader) : () => this is LeadGuard ->a.isLeader : () => this is LeadGuard ->a : RoyalGuard ->isLeader : () => this is LeadGuard +// if (((a.isLeader)())) { +// a.lead(); +// } +// else if (((a).isFollower())) { +// a.follow(); +// } - a.lead(); ->a.lead() : void ->a.lead : () => void ->a : LeadGuard ->lead : () => void -} -else if (((a).isFollower())) { ->((a).isFollower()) : this is FollowerGuard ->(a).isFollower() : this is FollowerGuard ->(a).isFollower : () => this is FollowerGuard ->(a) : RoyalGuard ->a : RoyalGuard ->isFollower : () => this is FollowerGuard - - a.follow(); ->a.follow() : void ->a.follow : () => void ->a : FollowerGuard ->follow : () => void -} - -if (((a["isLeader"])())) { ->((a["isLeader"])()) : this is LeadGuard ->(a["isLeader"])() : this is LeadGuard ->(a["isLeader"]) : () => this is LeadGuard ->a["isLeader"] : () => this is LeadGuard ->a : RoyalGuard ->"isLeader" : string - - a.lead(); ->a.lead() : void ->a.lead : () => void ->a : LeadGuard ->lead : () => void -} -else if (((a)["isFollower"]())) { ->((a)["isFollower"]()) : this is FollowerGuard ->(a)["isFollower"]() : this is FollowerGuard ->(a)["isFollower"] : () => this is FollowerGuard ->(a) : RoyalGuard ->a : RoyalGuard ->"isFollower" : string - - a.follow(); ->a.follow() : void ->a.follow : () => void ->a : FollowerGuard ->follow : () => void -} +// if (((a["isLeader"])())) { +// a.lead(); +// } +// else if (((a)["isFollower"]())) { +// a.follow(); +// } var holder2 = {a}; >holder2 : { a: RoyalGuard; } @@ -166,7 +122,7 @@ var holder2 = {a}; >a : RoyalGuard if (holder2.a.isLeader()) { ->holder2.a.isLeader() : this is LeadGuard +>holder2.a.isLeader() : boolean >holder2.a.isLeader : () => this is LeadGuard >holder2.a : RoyalGuard >holder2 : { a: RoyalGuard; } @@ -174,9 +130,9 @@ if (holder2.a.isLeader()) { >isLeader : () => this is LeadGuard holder2.a; ->holder2.a : RoyalGuard +>holder2.a : LeadGuard >holder2 : { a: RoyalGuard; } ->a : RoyalGuard +>a : LeadGuard } else { holder2.a; @@ -232,7 +188,7 @@ let guard = new ArrowGuard(); >ArrowGuard : typeof ArrowGuard if (guard.isElite()) { ->guard.isElite() : this is ArrowElite +>guard.isElite() : boolean >guard.isElite : () => this is ArrowElite >guard : ArrowGuard >isElite : () => this is ArrowElite @@ -244,7 +200,7 @@ if (guard.isElite()) { >defend : () => void } else if (guard.isMedic()) { ->guard.isMedic() : this is ArrowMedic +>guard.isMedic() : boolean >guard.isMedic : () => this is ArrowMedic >guard : ArrowGuard >isMedic : () => this is ArrowMedic @@ -297,7 +253,7 @@ let crate: Crate<{}>; >Crate : Crate if (crate.isSundries()) { ->crate.isSundries() : this is Crate +>crate.isSundries() : boolean >crate.isSundries : () => this is Crate >crate : Crate<{}> >isSundries : () => this is Crate @@ -312,7 +268,7 @@ if (crate.isSundries()) { >true : boolean } else if (crate.isSupplies()) { ->crate.isSupplies() : this is Crate +>crate.isSupplies() : boolean >crate.isSupplies : () => this is Crate >crate : Crate<{}> >isSupplies : () => this is Crate @@ -405,7 +361,7 @@ a.isFollower = mimic.isFollower; >isFollower : () => this is MimicFollower if (mimic.isFollower()) { ->mimic.isFollower() : this is MimicFollower +>mimic.isFollower() : boolean >mimic.isFollower : () => this is MimicFollower >mimic : MimicGuard >isFollower : () => this is MimicFollower diff --git a/tests/baselines/reference/typeGuardInClass.errors.txt b/tests/baselines/reference/typeGuardInClass.errors.txt new file mode 100644 index 00000000000..aa86067576f --- /dev/null +++ b/tests/baselines/reference/typeGuardInClass.errors.txt @@ -0,0 +1,30 @@ +tests/cases/conformance/expressions/typeGuards/typeGuardInClass.ts(6,17): error TS2322: Type 'string | number' is not assignable to type 'string'. + Type 'number' is not assignable to type 'string'. +tests/cases/conformance/expressions/typeGuards/typeGuardInClass.ts(13,17): error TS2322: Type 'string | number' is not assignable to type 'number'. + Type 'string' is not assignable to type 'number'. + + +==== tests/cases/conformance/expressions/typeGuards/typeGuardInClass.ts (2 errors) ==== + let x: string | number; + + if (typeof x === "string") { + let n = class { + constructor() { + let y: string = x; + ~ +!!! error TS2322: Type 'string | number' is not assignable to type 'string'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. + } + } + } + else { + let m = class { + constructor() { + let y: number = x; + ~ +!!! error TS2322: Type 'string | number' is not assignable to type 'number'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. + } + } + } + \ No newline at end of file diff --git a/tests/baselines/reference/typeGuardInClass.symbols b/tests/baselines/reference/typeGuardInClass.symbols deleted file mode 100644 index cc0e745e4de..00000000000 --- a/tests/baselines/reference/typeGuardInClass.symbols +++ /dev/null @@ -1,29 +0,0 @@ -=== tests/cases/conformance/expressions/typeGuards/typeGuardInClass.ts === -let x: string | number; ->x : Symbol(x, Decl(typeGuardInClass.ts, 0, 3)) - -if (typeof x === "string") { ->x : Symbol(x, Decl(typeGuardInClass.ts, 0, 3)) - - let n = class { ->n : Symbol(n, Decl(typeGuardInClass.ts, 3, 7)) - - constructor() { - let y: string = x; ->y : Symbol(y, Decl(typeGuardInClass.ts, 5, 15)) ->x : Symbol(x, Decl(typeGuardInClass.ts, 0, 3)) - } - } -} -else { - let m = class { ->m : Symbol(m, Decl(typeGuardInClass.ts, 10, 7)) - - constructor() { - let y: number = x; ->y : Symbol(y, Decl(typeGuardInClass.ts, 12, 15)) ->x : Symbol(x, Decl(typeGuardInClass.ts, 0, 3)) - } - } -} - diff --git a/tests/baselines/reference/typeGuardInClass.types b/tests/baselines/reference/typeGuardInClass.types deleted file mode 100644 index 93fe9f28c5e..00000000000 --- a/tests/baselines/reference/typeGuardInClass.types +++ /dev/null @@ -1,34 +0,0 @@ -=== tests/cases/conformance/expressions/typeGuards/typeGuardInClass.ts === -let x: string | number; ->x : string | number - -if (typeof x === "string") { ->typeof x === "string" : boolean ->typeof x : string ->x : string | number ->"string" : string - - let n = class { ->n : typeof (Anonymous class) ->class { constructor() { let y: string = x; } } : typeof (Anonymous class) - - constructor() { - let y: string = x; ->y : string ->x : string - } - } -} -else { - let m = class { ->m : typeof (Anonymous class) ->class { constructor() { let y: number = x; } } : typeof (Anonymous class) - - constructor() { - let y: number = x; ->y : number ->x : number - } - } -} - diff --git a/tests/baselines/reference/typeGuardNesting.types b/tests/baselines/reference/typeGuardNesting.types index 255e96da89e..2b18e232412 100644 --- a/tests/baselines/reference/typeGuardNesting.types +++ b/tests/baselines/reference/typeGuardNesting.types @@ -34,7 +34,7 @@ if ((typeof strOrBool === 'boolean' && !strOrBool) || typeof strOrBool === 'stri >(typeof strOrBool === 'boolean') : boolean >typeof strOrBool === 'boolean' : boolean >typeof strOrBool : string ->strOrBool : boolean | string +>strOrBool : string | boolean >'boolean' : string >strOrBool : boolean >false : boolean @@ -56,7 +56,7 @@ if ((typeof strOrBool === 'boolean' && !strOrBool) || typeof strOrBool === 'stri >(typeof strOrBool !== 'string') : boolean >typeof strOrBool !== 'string' : boolean >typeof strOrBool : string ->strOrBool : boolean | string +>strOrBool : string | boolean >'string' : string >strOrBool : boolean >false : boolean @@ -68,7 +68,7 @@ if ((typeof strOrBool !== 'string' && !strOrBool) || typeof strOrBool !== 'boole >typeof strOrBool !== 'string' && !strOrBool : boolean >typeof strOrBool !== 'string' : boolean >typeof strOrBool : string ->strOrBool : string | boolean +>strOrBool : boolean | string >'string' : string >!strOrBool : boolean >strOrBool : boolean @@ -94,7 +94,7 @@ if ((typeof strOrBool !== 'string' && !strOrBool) || typeof strOrBool !== 'boole >(typeof strOrBool === 'boolean') : boolean >typeof strOrBool === 'boolean' : boolean >typeof strOrBool : string ->strOrBool : boolean | string +>strOrBool : string | boolean >'boolean' : string >strOrBool : boolean >false : boolean @@ -116,7 +116,7 @@ if ((typeof strOrBool !== 'string' && !strOrBool) || typeof strOrBool !== 'boole >(typeof strOrBool !== 'string') : boolean >typeof strOrBool !== 'string' : boolean >typeof strOrBool : string ->strOrBool : boolean | string +>strOrBool : string | boolean >'string' : string >strOrBool : boolean >false : boolean diff --git a/tests/baselines/reference/typeGuardOfFormExpr1AndExpr2.symbols b/tests/baselines/reference/typeGuardOfFormExpr1AndExpr2.symbols index b8db746ef91..3e8f00143ed 100644 --- a/tests/baselines/reference/typeGuardOfFormExpr1AndExpr2.symbols +++ b/tests/baselines/reference/typeGuardOfFormExpr1AndExpr2.symbols @@ -19,7 +19,7 @@ var numOrBool: number | boolean; class C { private p; } >C : Symbol(C, Decl(typeGuardOfFormExpr1AndExpr2.ts, 5, 32)) ->p : Symbol(p, Decl(typeGuardOfFormExpr1AndExpr2.ts, 6, 9)) +>p : Symbol(C.p, Decl(typeGuardOfFormExpr1AndExpr2.ts, 6, 9)) var c: C; >c : Symbol(c, Decl(typeGuardOfFormExpr1AndExpr2.ts, 7, 3)) diff --git a/tests/baselines/reference/typeGuardOfFormExpr1AndExpr2.types b/tests/baselines/reference/typeGuardOfFormExpr1AndExpr2.types index 10f50bed52e..a10d398988f 100644 --- a/tests/baselines/reference/typeGuardOfFormExpr1AndExpr2.types +++ b/tests/baselines/reference/typeGuardOfFormExpr1AndExpr2.types @@ -95,11 +95,11 @@ if (typeof strOrNumOrBoolOrC !== "string" && typeof strOrNumOrBoolOrC !== "numbe >typeof strOrNumOrBoolOrC !== "string" && typeof strOrNumOrBoolOrC !== "number" : boolean >typeof strOrNumOrBoolOrC !== "string" : boolean >typeof strOrNumOrBoolOrC : string ->strOrNumOrBoolOrC : string | number | boolean | C +>strOrNumOrBoolOrC : C | string | number | boolean >"string" : string >typeof strOrNumOrBoolOrC !== "number" : boolean >typeof strOrNumOrBoolOrC : string ->strOrNumOrBoolOrC : number | boolean | C +>strOrNumOrBoolOrC : C | number | boolean >"number" : string >typeof strOrNumOrBool === "boolean" : boolean >typeof strOrNumOrBool : string @@ -107,9 +107,9 @@ if (typeof strOrNumOrBoolOrC !== "string" && typeof strOrNumOrBoolOrC !== "numbe >"boolean" : string cOrBool = strOrNumOrBoolOrC; // C | boolean ->cOrBool = strOrNumOrBoolOrC : boolean | C +>cOrBool = strOrNumOrBoolOrC : C | boolean >cOrBool : C | boolean ->strOrNumOrBoolOrC : boolean | C +>strOrNumOrBoolOrC : C | boolean bool = strOrNumOrBool; // boolean >bool = strOrNumOrBool : boolean @@ -120,7 +120,7 @@ else { var r1: string | number | boolean | C = strOrNumOrBoolOrC; // string | number | boolean | C >r1 : string | number | boolean | C >C : C ->strOrNumOrBoolOrC : string | number | boolean | C +>strOrNumOrBoolOrC : string | number | C | boolean var r2: string | number | boolean = strOrNumOrBool; >r2 : string | number | boolean diff --git a/tests/baselines/reference/typeGuardOfFormExpr1OrExpr2.symbols b/tests/baselines/reference/typeGuardOfFormExpr1OrExpr2.symbols index f38b74b69b9..32a5422a393 100644 --- a/tests/baselines/reference/typeGuardOfFormExpr1OrExpr2.symbols +++ b/tests/baselines/reference/typeGuardOfFormExpr1OrExpr2.symbols @@ -19,7 +19,7 @@ var numOrBool: number | boolean; class C { private p; } >C : Symbol(C, Decl(typeGuardOfFormExpr1OrExpr2.ts, 5, 32)) ->p : Symbol(p, Decl(typeGuardOfFormExpr1OrExpr2.ts, 6, 9)) +>p : Symbol(C.p, Decl(typeGuardOfFormExpr1OrExpr2.ts, 6, 9)) var c: C; >c : Symbol(c, Decl(typeGuardOfFormExpr1OrExpr2.ts, 7, 3)) diff --git a/tests/baselines/reference/typeGuardOfFormFunctionEquality.js b/tests/baselines/reference/typeGuardOfFormFunctionEquality.js new file mode 100644 index 00000000000..c15c1a739a9 --- /dev/null +++ b/tests/baselines/reference/typeGuardOfFormFunctionEquality.js @@ -0,0 +1,26 @@ +//// [typeGuardOfFormFunctionEquality.ts] +declare function isString1(a: number, b: Object): b is string; + +declare function isString2(a: Object): a is string; + +switch (isString1(0, "")) { + case isString2(""): + default: +} + +var x = isString1(0, "") === isString2(""); + +function isString3(a: number, b: number, c: Object): c is string { + return isString1(0, c); +} + + +//// [typeGuardOfFormFunctionEquality.js] +switch (isString1(0, "")) { + case isString2(""): + default: +} +var x = isString1(0, "") === isString2(""); +function isString3(a, b, c) { + return isString1(0, c); +} diff --git a/tests/baselines/reference/typeGuardOfFormFunctionEquality.symbols b/tests/baselines/reference/typeGuardOfFormFunctionEquality.symbols new file mode 100644 index 00000000000..f1384050176 --- /dev/null +++ b/tests/baselines/reference/typeGuardOfFormFunctionEquality.symbols @@ -0,0 +1,41 @@ +=== tests/cases/conformance/expressions/typeGuards/typeGuardOfFormFunctionEquality.ts === +declare function isString1(a: number, b: Object): b is string; +>isString1 : Symbol(isString1, Decl(typeGuardOfFormFunctionEquality.ts, 0, 0)) +>a : Symbol(a, Decl(typeGuardOfFormFunctionEquality.ts, 0, 27)) +>b : Symbol(b, Decl(typeGuardOfFormFunctionEquality.ts, 0, 37)) +>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>b : Symbol(b, Decl(typeGuardOfFormFunctionEquality.ts, 0, 37)) + +declare function isString2(a: Object): a is string; +>isString2 : Symbol(isString2, Decl(typeGuardOfFormFunctionEquality.ts, 0, 62)) +>a : Symbol(a, Decl(typeGuardOfFormFunctionEquality.ts, 2, 27)) +>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>a : Symbol(a, Decl(typeGuardOfFormFunctionEquality.ts, 2, 27)) + +switch (isString1(0, "")) { +>isString1 : Symbol(isString1, Decl(typeGuardOfFormFunctionEquality.ts, 0, 0)) + + case isString2(""): +>isString2 : Symbol(isString2, Decl(typeGuardOfFormFunctionEquality.ts, 0, 62)) + + default: +} + +var x = isString1(0, "") === isString2(""); +>x : Symbol(x, Decl(typeGuardOfFormFunctionEquality.ts, 9, 3)) +>isString1 : Symbol(isString1, Decl(typeGuardOfFormFunctionEquality.ts, 0, 0)) +>isString2 : Symbol(isString2, Decl(typeGuardOfFormFunctionEquality.ts, 0, 62)) + +function isString3(a: number, b: number, c: Object): c is string { +>isString3 : Symbol(isString3, Decl(typeGuardOfFormFunctionEquality.ts, 9, 43)) +>a : Symbol(a, Decl(typeGuardOfFormFunctionEquality.ts, 11, 19)) +>b : Symbol(b, Decl(typeGuardOfFormFunctionEquality.ts, 11, 29)) +>c : Symbol(c, Decl(typeGuardOfFormFunctionEquality.ts, 11, 40)) +>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>c : Symbol(c, Decl(typeGuardOfFormFunctionEquality.ts, 11, 40)) + + return isString1(0, c); +>isString1 : Symbol(isString1, Decl(typeGuardOfFormFunctionEquality.ts, 0, 0)) +>c : Symbol(c, Decl(typeGuardOfFormFunctionEquality.ts, 11, 40)) +} + diff --git a/tests/baselines/reference/typeGuardOfFormFunctionEquality.types b/tests/baselines/reference/typeGuardOfFormFunctionEquality.types new file mode 100644 index 00000000000..55f2e2aac0e --- /dev/null +++ b/tests/baselines/reference/typeGuardOfFormFunctionEquality.types @@ -0,0 +1,54 @@ +=== tests/cases/conformance/expressions/typeGuards/typeGuardOfFormFunctionEquality.ts === +declare function isString1(a: number, b: Object): b is string; +>isString1 : (a: number, b: Object) => b is string +>a : number +>b : Object +>Object : Object +>b : any + +declare function isString2(a: Object): a is string; +>isString2 : (a: Object) => a is string +>a : Object +>Object : Object +>a : any + +switch (isString1(0, "")) { +>isString1(0, "") : boolean +>isString1 : (a: number, b: Object) => b is string +>0 : number +>"" : string + + case isString2(""): +>isString2("") : boolean +>isString2 : (a: Object) => a is string +>"" : string + + default: +} + +var x = isString1(0, "") === isString2(""); +>x : boolean +>isString1(0, "") === isString2("") : boolean +>isString1(0, "") : boolean +>isString1 : (a: number, b: Object) => b is string +>0 : number +>"" : string +>isString2("") : boolean +>isString2 : (a: Object) => a is string +>"" : string + +function isString3(a: number, b: number, c: Object): c is string { +>isString3 : (a: number, b: number, c: Object) => c is string +>a : number +>b : number +>c : Object +>Object : Object +>c : any + + return isString1(0, c); +>isString1(0, c) : boolean +>isString1 : (a: number, b: Object) => b is string +>0 : number +>c : Object +} + diff --git a/tests/baselines/reference/typeGuardOfFormInstanceOf.symbols b/tests/baselines/reference/typeGuardOfFormInstanceOf.symbols index 0dd2844f6ad..42797cc369f 100644 --- a/tests/baselines/reference/typeGuardOfFormInstanceOf.symbols +++ b/tests/baselines/reference/typeGuardOfFormInstanceOf.symbols @@ -9,26 +9,26 @@ class C1 { >C1 : Symbol(C1, Decl(typeGuardOfFormInstanceOf.ts, 0, 0)) p1: string; ->p1 : Symbol(p1, Decl(typeGuardOfFormInstanceOf.ts, 6, 10)) +>p1 : Symbol(C1.p1, Decl(typeGuardOfFormInstanceOf.ts, 6, 10)) } class C2 { >C2 : Symbol(C2, Decl(typeGuardOfFormInstanceOf.ts, 8, 1)) p2: number; ->p2 : Symbol(p2, Decl(typeGuardOfFormInstanceOf.ts, 9, 10)) +>p2 : Symbol(C2.p2, Decl(typeGuardOfFormInstanceOf.ts, 9, 10)) } class D1 extends C1 { >D1 : Symbol(D1, Decl(typeGuardOfFormInstanceOf.ts, 11, 1)) >C1 : Symbol(C1, Decl(typeGuardOfFormInstanceOf.ts, 0, 0)) p3: number; ->p3 : Symbol(p3, Decl(typeGuardOfFormInstanceOf.ts, 12, 21)) +>p3 : Symbol(D1.p3, Decl(typeGuardOfFormInstanceOf.ts, 12, 21)) } class C3 { >C3 : Symbol(C3, Decl(typeGuardOfFormInstanceOf.ts, 14, 1)) p4: number; ->p4 : Symbol(p4, Decl(typeGuardOfFormInstanceOf.ts, 15, 10)) +>p4 : Symbol(C3.p4, Decl(typeGuardOfFormInstanceOf.ts, 15, 10)) } var str: string; >str : Symbol(str, Decl(typeGuardOfFormInstanceOf.ts, 18, 3)) diff --git a/tests/baselines/reference/typeGuardOfFormInstanceOf.types b/tests/baselines/reference/typeGuardOfFormInstanceOf.types index 6b83b57dcb5..608e827f479 100644 --- a/tests/baselines/reference/typeGuardOfFormInstanceOf.types +++ b/tests/baselines/reference/typeGuardOfFormInstanceOf.types @@ -60,7 +60,7 @@ num = ctor1 instanceof C2 && ctor1.p2; // C2 >num : number >ctor1 instanceof C2 && ctor1.p2 : number >ctor1 instanceof C2 : boolean ->ctor1 : C1 | C2 +>ctor1 : C2 | C1 >C2 : typeof C2 >ctor1.p2 : number >ctor1 : C2 @@ -109,7 +109,7 @@ num = ctor2 instanceof D1 && ctor2.p3; // D1 >num : number >ctor2 instanceof D1 && ctor2.p3 : number >ctor2 instanceof D1 : boolean ->ctor2 : C2 | D1 +>ctor2 : D1 | C2 >D1 : typeof D1 >ctor2.p3 : number >ctor2 : D1 diff --git a/tests/baselines/reference/typeGuardOfFormInstanceOfOnInterface.symbols b/tests/baselines/reference/typeGuardOfFormInstanceOfOnInterface.symbols index aa634144399..177664ba339 100644 --- a/tests/baselines/reference/typeGuardOfFormInstanceOfOnInterface.symbols +++ b/tests/baselines/reference/typeGuardOfFormInstanceOfOnInterface.symbols @@ -12,11 +12,11 @@ interface C1 { >C1 : Symbol(C1, Decl(typeGuardOfFormInstanceOfOnInterface.ts, 0, 0)) prototype: C1; ->prototype : Symbol(prototype, Decl(typeGuardOfFormInstanceOfOnInterface.ts, 7, 11)) +>prototype : Symbol(C1.prototype, Decl(typeGuardOfFormInstanceOfOnInterface.ts, 7, 11)) >C1 : Symbol(C1, Decl(typeGuardOfFormInstanceOfOnInterface.ts, 0, 0)) p1: string; ->p1 : Symbol(p1, Decl(typeGuardOfFormInstanceOfOnInterface.ts, 8, 18)) +>p1 : Symbol(C1.p1, Decl(typeGuardOfFormInstanceOfOnInterface.ts, 8, 18)) } interface C2 { >C2 : Symbol(C2, Decl(typeGuardOfFormInstanceOfOnInterface.ts, 10, 1)) @@ -25,22 +25,22 @@ interface C2 { >C2 : Symbol(C2, Decl(typeGuardOfFormInstanceOfOnInterface.ts, 10, 1)) prototype: C2; ->prototype : Symbol(prototype, Decl(typeGuardOfFormInstanceOfOnInterface.ts, 12, 11)) +>prototype : Symbol(C2.prototype, Decl(typeGuardOfFormInstanceOfOnInterface.ts, 12, 11)) >C2 : Symbol(C2, Decl(typeGuardOfFormInstanceOfOnInterface.ts, 10, 1)) p2: number; ->p2 : Symbol(p2, Decl(typeGuardOfFormInstanceOfOnInterface.ts, 13, 18)) +>p2 : Symbol(C2.p2, Decl(typeGuardOfFormInstanceOfOnInterface.ts, 13, 18)) } interface D1 extends C1 { >D1 : Symbol(D1, Decl(typeGuardOfFormInstanceOfOnInterface.ts, 15, 1)) >C1 : Symbol(C1, Decl(typeGuardOfFormInstanceOfOnInterface.ts, 0, 0)) prototype: D1; ->prototype : Symbol(prototype, Decl(typeGuardOfFormInstanceOfOnInterface.ts, 16, 25)) +>prototype : Symbol(D1.prototype, Decl(typeGuardOfFormInstanceOfOnInterface.ts, 16, 25)) >D1 : Symbol(D1, Decl(typeGuardOfFormInstanceOfOnInterface.ts, 15, 1)) p3: number; ->p3 : Symbol(p3, Decl(typeGuardOfFormInstanceOfOnInterface.ts, 17, 18)) +>p3 : Symbol(D1.p3, Decl(typeGuardOfFormInstanceOfOnInterface.ts, 17, 18)) } var str: string; >str : Symbol(str, Decl(typeGuardOfFormInstanceOfOnInterface.ts, 20, 3)) diff --git a/tests/baselines/reference/typeGuardOfFormInstanceOfOnInterface.types b/tests/baselines/reference/typeGuardOfFormInstanceOfOnInterface.types index 20d1c1644fc..a5387e66d44 100644 --- a/tests/baselines/reference/typeGuardOfFormInstanceOfOnInterface.types +++ b/tests/baselines/reference/typeGuardOfFormInstanceOfOnInterface.types @@ -84,7 +84,7 @@ num = c1Orc2 instanceof c2 && c1Orc2.p2; // C2 >num : number >c1Orc2 instanceof c2 && c1Orc2.p2 : number >c1Orc2 instanceof c2 : boolean ->c1Orc2 : C1 | C2 +>c1Orc2 : C2 | C1 >c2 : C2 >c1Orc2.p2 : number >c1Orc2 : C2 @@ -133,7 +133,7 @@ num = c2Ord1 instanceof d1 && c2Ord1.p3; // D1 >num : number >c2Ord1 instanceof d1 && c2Ord1.p3 : number >c2Ord1 instanceof d1 : boolean ->c2Ord1 : C2 | D1 +>c2Ord1 : D1 | C2 >d1 : D1 >c2Ord1.p3 : number >c2Ord1 : D1 diff --git a/tests/baselines/reference/typeGuardOfFormIsType.symbols b/tests/baselines/reference/typeGuardOfFormIsType.symbols index e7e8965673d..faa825daeb4 100644 --- a/tests/baselines/reference/typeGuardOfFormIsType.symbols +++ b/tests/baselines/reference/typeGuardOfFormIsType.symbols @@ -4,20 +4,20 @@ class C1 { >C1 : Symbol(C1, Decl(typeGuardOfFormIsType.ts, 0, 0)) p1: string; ->p1 : Symbol(p1, Decl(typeGuardOfFormIsType.ts, 1, 10)) +>p1 : Symbol(C1.p1, Decl(typeGuardOfFormIsType.ts, 1, 10)) } class C2 { >C2 : Symbol(C2, Decl(typeGuardOfFormIsType.ts, 3, 1)) p2: number; ->p2 : Symbol(p2, Decl(typeGuardOfFormIsType.ts, 4, 10)) +>p2 : Symbol(C2.p2, Decl(typeGuardOfFormIsType.ts, 4, 10)) } class D1 extends C1 { >D1 : Symbol(D1, Decl(typeGuardOfFormIsType.ts, 6, 1)) >C1 : Symbol(C1, Decl(typeGuardOfFormIsType.ts, 0, 0)) p3: number; ->p3 : Symbol(p3, Decl(typeGuardOfFormIsType.ts, 7, 21)) +>p3 : Symbol(D1.p3, Decl(typeGuardOfFormIsType.ts, 7, 21)) } var str: string; >str : Symbol(str, Decl(typeGuardOfFormIsType.ts, 10, 3)) diff --git a/tests/baselines/reference/typeGuardOfFormIsType.types b/tests/baselines/reference/typeGuardOfFormIsType.types index aa8f8cc7d60..23ce38732cd 100644 --- a/tests/baselines/reference/typeGuardOfFormIsType.types +++ b/tests/baselines/reference/typeGuardOfFormIsType.types @@ -67,7 +67,7 @@ str = isC1(c1Orc2) && c1Orc2.p1; // C1 >str = isC1(c1Orc2) && c1Orc2.p1 : string >str : string >isC1(c1Orc2) && c1Orc2.p1 : string ->isC1(c1Orc2) : x is C1 +>isC1(c1Orc2) : boolean >isC1 : (x: any) => x is C1 >c1Orc2 : C1 | C2 >c1Orc2.p1 : string @@ -78,9 +78,9 @@ num = isC2(c1Orc2) && c1Orc2.p2; // C2 >num = isC2(c1Orc2) && c1Orc2.p2 : number >num : number >isC2(c1Orc2) && c1Orc2.p2 : number ->isC2(c1Orc2) : x is C2 +>isC2(c1Orc2) : boolean >isC2 : (x: any) => x is C2 ->c1Orc2 : C1 | C2 +>c1Orc2 : C2 | C1 >c1Orc2.p2 : number >c1Orc2 : C2 >p2 : number @@ -89,7 +89,7 @@ str = isD1(c1Orc2) && c1Orc2.p1; // D1 >str = isD1(c1Orc2) && c1Orc2.p1 : string >str : string >isD1(c1Orc2) && c1Orc2.p1 : string ->isD1(c1Orc2) : x is D1 +>isD1(c1Orc2) : boolean >isD1 : (x: any) => x is D1 >c1Orc2 : C1 | C2 >c1Orc2.p1 : string @@ -100,7 +100,7 @@ num = isD1(c1Orc2) && c1Orc2.p3; // D1 >num = isD1(c1Orc2) && c1Orc2.p3 : number >num : number >isD1(c1Orc2) && c1Orc2.p3 : number ->isD1(c1Orc2) : x is D1 +>isD1(c1Orc2) : boolean >isD1 : (x: any) => x is D1 >c1Orc2 : C1 | C2 >c1Orc2.p3 : number @@ -116,7 +116,7 @@ num = isC2(c2Ord1) && c2Ord1.p2; // C2 >num = isC2(c2Ord1) && c2Ord1.p2 : number >num : number >isC2(c2Ord1) && c2Ord1.p2 : number ->isC2(c2Ord1) : x is C2 +>isC2(c2Ord1) : boolean >isC2 : (x: any) => x is C2 >c2Ord1 : C2 | D1 >c2Ord1.p2 : number @@ -127,9 +127,9 @@ num = isD1(c2Ord1) && c2Ord1.p3; // D1 >num = isD1(c2Ord1) && c2Ord1.p3 : number >num : number >isD1(c2Ord1) && c2Ord1.p3 : number ->isD1(c2Ord1) : x is D1 +>isD1(c2Ord1) : boolean >isD1 : (x: any) => x is D1 ->c2Ord1 : C2 | D1 +>c2Ord1 : D1 | C2 >c2Ord1.p3 : number >c2Ord1 : D1 >p3 : number @@ -138,7 +138,7 @@ str = isD1(c2Ord1) && c2Ord1.p1; // D1 >str = isD1(c2Ord1) && c2Ord1.p1 : string >str : string >isD1(c2Ord1) && c2Ord1.p1 : string ->isD1(c2Ord1) : x is D1 +>isD1(c2Ord1) : boolean >isD1 : (x: any) => x is D1 >c2Ord1 : C2 | D1 >c2Ord1.p1 : string @@ -150,7 +150,7 @@ var r2: C2 | D1 = isC1(c2Ord1) && c2Ord1; // C2 | D1 >C2 : C2 >D1 : D1 >isC1(c2Ord1) && c2Ord1 : D1 ->isC1(c2Ord1) : x is C1 +>isC1(c2Ord1) : boolean >isC1 : (x: any) => x is C1 >c2Ord1 : C2 | D1 >c2Ord1 : D1 diff --git a/tests/baselines/reference/typeGuardOfFormIsTypeOnInterfaces.symbols b/tests/baselines/reference/typeGuardOfFormIsTypeOnInterfaces.symbols index 641d20d95cd..64ecc01d6f1 100644 --- a/tests/baselines/reference/typeGuardOfFormIsTypeOnInterfaces.symbols +++ b/tests/baselines/reference/typeGuardOfFormIsTypeOnInterfaces.symbols @@ -7,11 +7,11 @@ interface C1 { >C1 : Symbol(C1, Decl(typeGuardOfFormIsTypeOnInterfaces.ts, 0, 0)) prototype: C1; ->prototype : Symbol(prototype, Decl(typeGuardOfFormIsTypeOnInterfaces.ts, 2, 11)) +>prototype : Symbol(C1.prototype, Decl(typeGuardOfFormIsTypeOnInterfaces.ts, 2, 11)) >C1 : Symbol(C1, Decl(typeGuardOfFormIsTypeOnInterfaces.ts, 0, 0)) p1: string; ->p1 : Symbol(p1, Decl(typeGuardOfFormIsTypeOnInterfaces.ts, 3, 18)) +>p1 : Symbol(C1.p1, Decl(typeGuardOfFormIsTypeOnInterfaces.ts, 3, 18)) } interface C2 { >C2 : Symbol(C2, Decl(typeGuardOfFormIsTypeOnInterfaces.ts, 5, 1)) @@ -20,22 +20,22 @@ interface C2 { >C2 : Symbol(C2, Decl(typeGuardOfFormIsTypeOnInterfaces.ts, 5, 1)) prototype: C2; ->prototype : Symbol(prototype, Decl(typeGuardOfFormIsTypeOnInterfaces.ts, 7, 11)) +>prototype : Symbol(C2.prototype, Decl(typeGuardOfFormIsTypeOnInterfaces.ts, 7, 11)) >C2 : Symbol(C2, Decl(typeGuardOfFormIsTypeOnInterfaces.ts, 5, 1)) p2: number; ->p2 : Symbol(p2, Decl(typeGuardOfFormIsTypeOnInterfaces.ts, 8, 18)) +>p2 : Symbol(C2.p2, Decl(typeGuardOfFormIsTypeOnInterfaces.ts, 8, 18)) } interface D1 extends C1 { >D1 : Symbol(D1, Decl(typeGuardOfFormIsTypeOnInterfaces.ts, 10, 1)) >C1 : Symbol(C1, Decl(typeGuardOfFormIsTypeOnInterfaces.ts, 0, 0)) prototype: D1; ->prototype : Symbol(prototype, Decl(typeGuardOfFormIsTypeOnInterfaces.ts, 11, 25)) +>prototype : Symbol(D1.prototype, Decl(typeGuardOfFormIsTypeOnInterfaces.ts, 11, 25)) >D1 : Symbol(D1, Decl(typeGuardOfFormIsTypeOnInterfaces.ts, 10, 1)) p3: number; ->p3 : Symbol(p3, Decl(typeGuardOfFormIsTypeOnInterfaces.ts, 12, 18)) +>p3 : Symbol(D1.p3, Decl(typeGuardOfFormIsTypeOnInterfaces.ts, 12, 18)) } var str: string; >str : Symbol(str, Decl(typeGuardOfFormIsTypeOnInterfaces.ts, 15, 3)) diff --git a/tests/baselines/reference/typeGuardOfFormIsTypeOnInterfaces.types b/tests/baselines/reference/typeGuardOfFormIsTypeOnInterfaces.types index 4e28e6a4d38..728d3dc0e38 100644 --- a/tests/baselines/reference/typeGuardOfFormIsTypeOnInterfaces.types +++ b/tests/baselines/reference/typeGuardOfFormIsTypeOnInterfaces.types @@ -98,7 +98,7 @@ str = isC1(c1Orc2) && c1Orc2.p1; // C1 >str = isC1(c1Orc2) && c1Orc2.p1 : string >str : string >isC1(c1Orc2) && c1Orc2.p1 : string ->isC1(c1Orc2) : x is C1 +>isC1(c1Orc2) : boolean >isC1 : (x: any) => x is C1 >c1Orc2 : C1 | C2 >c1Orc2.p1 : string @@ -109,9 +109,9 @@ num = isC2(c1Orc2) && c1Orc2.p2; // C2 >num = isC2(c1Orc2) && c1Orc2.p2 : number >num : number >isC2(c1Orc2) && c1Orc2.p2 : number ->isC2(c1Orc2) : x is C2 +>isC2(c1Orc2) : boolean >isC2 : (x: any) => x is C2 ->c1Orc2 : C1 | C2 +>c1Orc2 : C2 | C1 >c1Orc2.p2 : number >c1Orc2 : C2 >p2 : number @@ -120,7 +120,7 @@ str = isD1(c1Orc2) && c1Orc2.p1; // D1 >str = isD1(c1Orc2) && c1Orc2.p1 : string >str : string >isD1(c1Orc2) && c1Orc2.p1 : string ->isD1(c1Orc2) : x is D1 +>isD1(c1Orc2) : boolean >isD1 : (x: any) => x is D1 >c1Orc2 : C1 | C2 >c1Orc2.p1 : string @@ -131,7 +131,7 @@ num = isD1(c1Orc2) && c1Orc2.p3; // D1 >num = isD1(c1Orc2) && c1Orc2.p3 : number >num : number >isD1(c1Orc2) && c1Orc2.p3 : number ->isD1(c1Orc2) : x is D1 +>isD1(c1Orc2) : boolean >isD1 : (x: any) => x is D1 >c1Orc2 : C1 | C2 >c1Orc2.p3 : number @@ -147,7 +147,7 @@ num = isC2(c2Ord1) && c2Ord1.p2; // C2 >num = isC2(c2Ord1) && c2Ord1.p2 : number >num : number >isC2(c2Ord1) && c2Ord1.p2 : number ->isC2(c2Ord1) : x is C2 +>isC2(c2Ord1) : boolean >isC2 : (x: any) => x is C2 >c2Ord1 : C2 | D1 >c2Ord1.p2 : number @@ -158,9 +158,9 @@ num = isD1(c2Ord1) && c2Ord1.p3; // D1 >num = isD1(c2Ord1) && c2Ord1.p3 : number >num : number >isD1(c2Ord1) && c2Ord1.p3 : number ->isD1(c2Ord1) : x is D1 +>isD1(c2Ord1) : boolean >isD1 : (x: any) => x is D1 ->c2Ord1 : C2 | D1 +>c2Ord1 : D1 | C2 >c2Ord1.p3 : number >c2Ord1 : D1 >p3 : number @@ -169,7 +169,7 @@ str = isD1(c2Ord1) && c2Ord1.p1; // D1 >str = isD1(c2Ord1) && c2Ord1.p1 : string >str : string >isD1(c2Ord1) && c2Ord1.p1 : string ->isD1(c2Ord1) : x is D1 +>isD1(c2Ord1) : boolean >isD1 : (x: any) => x is D1 >c2Ord1 : C2 | D1 >c2Ord1.p1 : string @@ -181,7 +181,7 @@ var r2: C2 | D1 = isC1(c2Ord1) && c2Ord1; // C2 | D1 >C2 : C2 >D1 : D1 >isC1(c2Ord1) && c2Ord1 : D1 ->isC1(c2Ord1) : x is C1 +>isC1(c2Ord1) : boolean >isC1 : (x: any) => x is C1 >c2Ord1 : C2 | D1 >c2Ord1 : D1 diff --git a/tests/baselines/reference/typeGuardOfFormNotExpr.types b/tests/baselines/reference/typeGuardOfFormNotExpr.types index a99db08efab..e7cfd6a0dce 100644 --- a/tests/baselines/reference/typeGuardOfFormNotExpr.types +++ b/tests/baselines/reference/typeGuardOfFormNotExpr.types @@ -73,13 +73,13 @@ if (!(typeof strOrNumOrBool !== "string") || !(typeof strOrNumOrBool !== "number >(typeof strOrNumOrBool !== "string") : boolean >typeof strOrNumOrBool !== "string" : boolean >typeof strOrNumOrBool : string ->strOrNumOrBool : string | number | boolean +>strOrNumOrBool : boolean | string | number >"string" : string >!(typeof strOrNumOrBool !== "number") : boolean >(typeof strOrNumOrBool !== "number") : boolean >typeof strOrNumOrBool !== "number" : boolean >typeof strOrNumOrBool : string ->strOrNumOrBool : number | boolean +>strOrNumOrBool : boolean | number >"number" : string strOrNum = strOrNumOrBool; // string | number @@ -152,19 +152,19 @@ if (!(typeof strOrNumOrBool === "string") && numOrBool !== strOrNumOrBool) { >(typeof strOrNumOrBool === "string") : boolean >typeof strOrNumOrBool === "string" : boolean >typeof strOrNumOrBool : string ->strOrNumOrBool : string | number | boolean +>strOrNumOrBool : boolean | string | number >"string" : string >numOrBool !== strOrNumOrBool : boolean >numOrBool : number | boolean ->strOrNumOrBool : number | boolean +>strOrNumOrBool : boolean | number numOrBool = strOrNumOrBool; // number | boolean ->numOrBool = strOrNumOrBool : number | boolean +>numOrBool = strOrNumOrBool : boolean | number >numOrBool : number | boolean ->strOrNumOrBool : number | boolean +>strOrNumOrBool : boolean | number } else { var r1: string | number | boolean = strOrNumOrBool; // string | number | boolean >r1 : string | number | boolean ->strOrNumOrBool : string | number | boolean +>strOrNumOrBool : string | boolean | number } diff --git a/tests/baselines/reference/typeGuardOfFormThisMember.errors.txt b/tests/baselines/reference/typeGuardOfFormThisMember.errors.txt new file mode 100644 index 00000000000..21dc896fbd9 --- /dev/null +++ b/tests/baselines/reference/typeGuardOfFormThisMember.errors.txt @@ -0,0 +1,130 @@ +tests/cases/conformance/expressions/typeGuards/typeGuardOfFormThisMember.ts(4,10): error TS1228: A type predicate is only allowed in return type position for functions and methods. +tests/cases/conformance/expressions/typeGuards/typeGuardOfFormThisMember.ts(5,17): error TS1228: A type predicate is only allowed in return type position for functions and methods. +tests/cases/conformance/expressions/typeGuards/typeGuardOfFormThisMember.ts(11,22): error TS1228: A type predicate is only allowed in return type position for functions and methods. +tests/cases/conformance/expressions/typeGuards/typeGuardOfFormThisMember.ts(14,16): error TS1228: A type predicate is only allowed in return type position for functions and methods. +tests/cases/conformance/expressions/typeGuards/typeGuardOfFormThisMember.ts(34,8): error TS2339: Property 'content' does not exist on type 'FileSystemObject'. +tests/cases/conformance/expressions/typeGuards/typeGuardOfFormThisMember.ts(36,9): error TS2339: Property 'host' does not exist on type 'FileSystemObject'. +tests/cases/conformance/expressions/typeGuards/typeGuardOfFormThisMember.ts(37,9): error TS2339: Property 'content' does not exist on type 'FileSystemObject'. +tests/cases/conformance/expressions/typeGuards/typeGuardOfFormThisMember.ts(41,8): error TS2339: Property 'children' does not exist on type 'FileSystemObject'. +tests/cases/conformance/expressions/typeGuards/typeGuardOfFormThisMember.ts(44,8): error TS2339: Property 'host' does not exist on type 'FileSystemObject'. +tests/cases/conformance/expressions/typeGuards/typeGuardOfFormThisMember.ts(57,13): error TS1228: A type predicate is only allowed in return type position for functions and methods. +tests/cases/conformance/expressions/typeGuards/typeGuardOfFormThisMember.ts(58,15): error TS1228: A type predicate is only allowed in return type position for functions and methods. +tests/cases/conformance/expressions/typeGuards/typeGuardOfFormThisMember.ts(63,9): error TS2339: Property 'lead' does not exist on type 'GenericGuard'. +tests/cases/conformance/expressions/typeGuards/typeGuardOfFormThisMember.ts(66,9): error TS2339: Property 'follow' does not exist on type 'GenericGuard'. +tests/cases/conformance/expressions/typeGuards/typeGuardOfFormThisMember.ts(70,19): error TS1228: A type predicate is only allowed in return type position for functions and methods. +tests/cases/conformance/expressions/typeGuards/typeGuardOfFormThisMember.ts(79,11): error TS2339: Property 'do' does not exist on type 'SpecificGuard'. + + +==== tests/cases/conformance/expressions/typeGuards/typeGuardOfFormThisMember.ts (15 errors) ==== + // There's a 'File' class in the stdlib, wrap with a namespace to avoid collision + namespace Test { + export class FileSystemObject { + isFSO: this is FileSystemObject; + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1228: A type predicate is only allowed in return type position for functions and methods. + get isFile(): this is File { + ~~~~~~~~~~~~ +!!! error TS1228: A type predicate is only allowed in return type position for functions and methods. + return this instanceof File; + } + set isFile(param) { + // noop + } + get isDirectory(): this is Directory { + ~~~~~~~~~~~~~~~~~ +!!! error TS1228: A type predicate is only allowed in return type position for functions and methods. + return this instanceof Directory; + } + isNetworked: this is (Networked & this); + ~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1228: A type predicate is only allowed in return type position for functions and methods. + constructor(public path: string) {} + } + + export class File extends FileSystemObject { + constructor(path: string, public content: string) { super(path); } + } + export class Directory extends FileSystemObject { + children: FileSystemObject[]; + } + export interface Networked { + host: string; + } + + let file: FileSystemObject = new File("foo/bar.txt", "foo"); + file.isNetworked = false; + file.isFSO = file.isFile; + file.isFile = true; + let x = file.isFile; + if (file.isFile) { + file.content; + ~~~~~~~ +!!! error TS2339: Property 'content' does not exist on type 'FileSystemObject'. + if (file.isNetworked) { + file.host; + ~~~~ +!!! error TS2339: Property 'host' does not exist on type 'FileSystemObject'. + file.content; + ~~~~~~~ +!!! error TS2339: Property 'content' does not exist on type 'FileSystemObject'. + } + } + else if (file.isDirectory) { + file.children; + ~~~~~~~~ +!!! error TS2339: Property 'children' does not exist on type 'FileSystemObject'. + } + else if (file.isNetworked) { + file.host; + ~~~~ +!!! error TS2339: Property 'host' does not exist on type 'FileSystemObject'. + } + + interface GenericLeadGuard extends GenericGuard { + lead(): void; + } + + interface GenericFollowerGuard extends GenericGuard { + follow(): void; + } + + interface GenericGuard { + target: T; + isLeader: this is (GenericLeadGuard); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1228: A type predicate is only allowed in return type position for functions and methods. + isFollower: this is GenericFollowerGuard; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1228: A type predicate is only allowed in return type position for functions and methods. + } + + let guard: GenericGuard; + if (guard.isLeader) { + guard.lead(); + ~~~~ +!!! error TS2339: Property 'lead' does not exist on type 'GenericGuard'. + } + else if (guard.isFollower) { + guard.follow(); + ~~~~~~ +!!! error TS2339: Property 'follow' does not exist on type 'GenericGuard'. + } + + interface SpecificGuard { + isMoreSpecific: this is MoreSpecificGuard; + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1228: A type predicate is only allowed in return type position for functions and methods. + } + + interface MoreSpecificGuard extends SpecificGuard { + do(): void; + } + + let general: SpecificGuard; + if (general.isMoreSpecific) { + general.do(); + ~~ +!!! error TS2339: Property 'do' does not exist on type 'SpecificGuard'. + } + } + \ No newline at end of file diff --git a/tests/baselines/reference/typeGuardOfFormThisMember.js b/tests/baselines/reference/typeGuardOfFormThisMember.js index 2f983d2cdf8..9d71613ed8f 100644 --- a/tests/baselines/reference/typeGuardOfFormThisMember.js +++ b/tests/baselines/reference/typeGuardOfFormThisMember.js @@ -170,7 +170,7 @@ declare namespace Test { path: string; isFSO: this is FileSystemObject; isFile: this is File; - isDirectory: this is Directory; + readonly isDirectory: this is Directory; isNetworked: this is (Networked & this); constructor(path: string); } diff --git a/tests/baselines/reference/typeGuardOfFormThisMember.symbols b/tests/baselines/reference/typeGuardOfFormThisMember.symbols deleted file mode 100644 index 50e15b68ca4..00000000000 --- a/tests/baselines/reference/typeGuardOfFormThisMember.symbols +++ /dev/null @@ -1,240 +0,0 @@ -=== tests/cases/conformance/expressions/typeGuards/typeGuardOfFormThisMember.ts === -// There's a 'File' class in the stdlib, wrap with a namespace to avoid collision -namespace Test { ->Test : Symbol(Test, Decl(typeGuardOfFormThisMember.ts, 0, 0)) - - export class FileSystemObject { ->FileSystemObject : Symbol(FileSystemObject, Decl(typeGuardOfFormThisMember.ts, 1, 16)) - - isFSO: this is FileSystemObject; ->isFSO : Symbol(isFSO, Decl(typeGuardOfFormThisMember.ts, 2, 32)) ->FileSystemObject : Symbol(FileSystemObject, Decl(typeGuardOfFormThisMember.ts, 1, 16)) - - get isFile(): this is File { ->isFile : Symbol(isFile, Decl(typeGuardOfFormThisMember.ts, 3, 34), Decl(typeGuardOfFormThisMember.ts, 6, 3)) ->File : Symbol(File, Decl(typeGuardOfFormThisMember.ts, 15, 2)) - - return this instanceof File; ->this : Symbol(FileSystemObject, Decl(typeGuardOfFormThisMember.ts, 1, 16)) ->File : Symbol(File, Decl(typeGuardOfFormThisMember.ts, 15, 2)) - } - set isFile(param) { ->isFile : Symbol(isFile, Decl(typeGuardOfFormThisMember.ts, 3, 34), Decl(typeGuardOfFormThisMember.ts, 6, 3)) ->param : Symbol(param, Decl(typeGuardOfFormThisMember.ts, 7, 13)) - - // noop - } - get isDirectory(): this is Directory { ->isDirectory : Symbol(isDirectory, Decl(typeGuardOfFormThisMember.ts, 9, 3)) ->Directory : Symbol(Directory, Decl(typeGuardOfFormThisMember.ts, 19, 2)) - - return this instanceof Directory; ->this : Symbol(FileSystemObject, Decl(typeGuardOfFormThisMember.ts, 1, 16)) ->Directory : Symbol(Directory, Decl(typeGuardOfFormThisMember.ts, 19, 2)) - } - isNetworked: this is (Networked & this); ->isNetworked : Symbol(isNetworked, Decl(typeGuardOfFormThisMember.ts, 12, 3)) ->Networked : Symbol(Networked, Decl(typeGuardOfFormThisMember.ts, 22, 2)) - - constructor(public path: string) {} ->path : Symbol(path, Decl(typeGuardOfFormThisMember.ts, 14, 14)) - } - - export class File extends FileSystemObject { ->File : Symbol(File, Decl(typeGuardOfFormThisMember.ts, 15, 2)) ->FileSystemObject : Symbol(FileSystemObject, Decl(typeGuardOfFormThisMember.ts, 1, 16)) - - constructor(path: string, public content: string) { super(path); } ->path : Symbol(path, Decl(typeGuardOfFormThisMember.ts, 18, 14)) ->content : Symbol(content, Decl(typeGuardOfFormThisMember.ts, 18, 27)) ->super : Symbol(FileSystemObject, Decl(typeGuardOfFormThisMember.ts, 1, 16)) ->path : Symbol(path, Decl(typeGuardOfFormThisMember.ts, 18, 14)) - } - export class Directory extends FileSystemObject { ->Directory : Symbol(Directory, Decl(typeGuardOfFormThisMember.ts, 19, 2)) ->FileSystemObject : Symbol(FileSystemObject, Decl(typeGuardOfFormThisMember.ts, 1, 16)) - - children: FileSystemObject[]; ->children : Symbol(children, Decl(typeGuardOfFormThisMember.ts, 20, 50)) ->FileSystemObject : Symbol(FileSystemObject, Decl(typeGuardOfFormThisMember.ts, 1, 16)) - } - export interface Networked { ->Networked : Symbol(Networked, Decl(typeGuardOfFormThisMember.ts, 22, 2)) - - host: string; ->host : Symbol(host, Decl(typeGuardOfFormThisMember.ts, 23, 29)) - } - - let file: FileSystemObject = new File("foo/bar.txt", "foo"); ->file : Symbol(file, Decl(typeGuardOfFormThisMember.ts, 27, 4)) ->FileSystemObject : Symbol(FileSystemObject, Decl(typeGuardOfFormThisMember.ts, 1, 16)) ->File : Symbol(File, Decl(typeGuardOfFormThisMember.ts, 15, 2)) - - file.isNetworked = false; ->file.isNetworked : Symbol(FileSystemObject.isNetworked, Decl(typeGuardOfFormThisMember.ts, 12, 3)) ->file : Symbol(file, Decl(typeGuardOfFormThisMember.ts, 27, 4)) ->isNetworked : Symbol(FileSystemObject.isNetworked, Decl(typeGuardOfFormThisMember.ts, 12, 3)) - - file.isFSO = file.isFile; ->file.isFSO : Symbol(FileSystemObject.isFSO, Decl(typeGuardOfFormThisMember.ts, 2, 32)) ->file : Symbol(file, Decl(typeGuardOfFormThisMember.ts, 27, 4)) ->isFSO : Symbol(FileSystemObject.isFSO, Decl(typeGuardOfFormThisMember.ts, 2, 32)) ->file.isFile : Symbol(FileSystemObject.isFile, Decl(typeGuardOfFormThisMember.ts, 3, 34), Decl(typeGuardOfFormThisMember.ts, 6, 3)) ->file : Symbol(file, Decl(typeGuardOfFormThisMember.ts, 27, 4)) ->isFile : Symbol(FileSystemObject.isFile, Decl(typeGuardOfFormThisMember.ts, 3, 34), Decl(typeGuardOfFormThisMember.ts, 6, 3)) - - file.isFile = true; ->file.isFile : Symbol(FileSystemObject.isFile, Decl(typeGuardOfFormThisMember.ts, 3, 34), Decl(typeGuardOfFormThisMember.ts, 6, 3)) ->file : Symbol(file, Decl(typeGuardOfFormThisMember.ts, 27, 4)) ->isFile : Symbol(FileSystemObject.isFile, Decl(typeGuardOfFormThisMember.ts, 3, 34), Decl(typeGuardOfFormThisMember.ts, 6, 3)) - - let x = file.isFile; ->x : Symbol(x, Decl(typeGuardOfFormThisMember.ts, 31, 4)) ->file.isFile : Symbol(FileSystemObject.isFile, Decl(typeGuardOfFormThisMember.ts, 3, 34), Decl(typeGuardOfFormThisMember.ts, 6, 3)) ->file : Symbol(file, Decl(typeGuardOfFormThisMember.ts, 27, 4)) ->isFile : Symbol(FileSystemObject.isFile, Decl(typeGuardOfFormThisMember.ts, 3, 34), Decl(typeGuardOfFormThisMember.ts, 6, 3)) - - if (file.isFile) { ->file.isFile : Symbol(FileSystemObject.isFile, Decl(typeGuardOfFormThisMember.ts, 3, 34), Decl(typeGuardOfFormThisMember.ts, 6, 3)) ->file : Symbol(file, Decl(typeGuardOfFormThisMember.ts, 27, 4)) ->isFile : Symbol(FileSystemObject.isFile, Decl(typeGuardOfFormThisMember.ts, 3, 34), Decl(typeGuardOfFormThisMember.ts, 6, 3)) - - file.content; ->file.content : Symbol(File.content, Decl(typeGuardOfFormThisMember.ts, 18, 27)) ->file : Symbol(file, Decl(typeGuardOfFormThisMember.ts, 27, 4)) ->content : Symbol(File.content, Decl(typeGuardOfFormThisMember.ts, 18, 27)) - - if (file.isNetworked) { ->file.isNetworked : Symbol(FileSystemObject.isNetworked, Decl(typeGuardOfFormThisMember.ts, 12, 3)) ->file : Symbol(file, Decl(typeGuardOfFormThisMember.ts, 27, 4)) ->isNetworked : Symbol(FileSystemObject.isNetworked, Decl(typeGuardOfFormThisMember.ts, 12, 3)) - - file.host; ->file.host : Symbol(Networked.host, Decl(typeGuardOfFormThisMember.ts, 23, 29)) ->file : Symbol(file, Decl(typeGuardOfFormThisMember.ts, 27, 4)) ->host : Symbol(Networked.host, Decl(typeGuardOfFormThisMember.ts, 23, 29)) - - file.content; ->file.content : Symbol(File.content, Decl(typeGuardOfFormThisMember.ts, 18, 27)) ->file : Symbol(file, Decl(typeGuardOfFormThisMember.ts, 27, 4)) ->content : Symbol(File.content, Decl(typeGuardOfFormThisMember.ts, 18, 27)) - } - } - else if (file.isDirectory) { ->file.isDirectory : Symbol(FileSystemObject.isDirectory, Decl(typeGuardOfFormThisMember.ts, 9, 3)) ->file : Symbol(file, Decl(typeGuardOfFormThisMember.ts, 27, 4)) ->isDirectory : Symbol(FileSystemObject.isDirectory, Decl(typeGuardOfFormThisMember.ts, 9, 3)) - - file.children; ->file.children : Symbol(Directory.children, Decl(typeGuardOfFormThisMember.ts, 20, 50)) ->file : Symbol(file, Decl(typeGuardOfFormThisMember.ts, 27, 4)) ->children : Symbol(Directory.children, Decl(typeGuardOfFormThisMember.ts, 20, 50)) - } - else if (file.isNetworked) { ->file.isNetworked : Symbol(FileSystemObject.isNetworked, Decl(typeGuardOfFormThisMember.ts, 12, 3)) ->file : Symbol(file, Decl(typeGuardOfFormThisMember.ts, 27, 4)) ->isNetworked : Symbol(FileSystemObject.isNetworked, Decl(typeGuardOfFormThisMember.ts, 12, 3)) - - file.host; ->file.host : Symbol(Networked.host, Decl(typeGuardOfFormThisMember.ts, 23, 29)) ->file : Symbol(file, Decl(typeGuardOfFormThisMember.ts, 27, 4)) ->host : Symbol(Networked.host, Decl(typeGuardOfFormThisMember.ts, 23, 29)) - } - - interface GenericLeadGuard extends GenericGuard { ->GenericLeadGuard : Symbol(GenericLeadGuard, Decl(typeGuardOfFormThisMember.ts, 44, 2)) ->T : Symbol(T, Decl(typeGuardOfFormThisMember.ts, 46, 28)) ->GenericGuard : Symbol(GenericGuard, Decl(typeGuardOfFormThisMember.ts, 52, 2)) ->T : Symbol(T, Decl(typeGuardOfFormThisMember.ts, 46, 28)) - - lead(): void; ->lead : Symbol(lead, Decl(typeGuardOfFormThisMember.ts, 46, 56)) - } - - interface GenericFollowerGuard extends GenericGuard { ->GenericFollowerGuard : Symbol(GenericFollowerGuard, Decl(typeGuardOfFormThisMember.ts, 48, 2)) ->T : Symbol(T, Decl(typeGuardOfFormThisMember.ts, 50, 32)) ->GenericGuard : Symbol(GenericGuard, Decl(typeGuardOfFormThisMember.ts, 52, 2)) ->T : Symbol(T, Decl(typeGuardOfFormThisMember.ts, 50, 32)) - - follow(): void; ->follow : Symbol(follow, Decl(typeGuardOfFormThisMember.ts, 50, 60)) - } - - interface GenericGuard { ->GenericGuard : Symbol(GenericGuard, Decl(typeGuardOfFormThisMember.ts, 52, 2)) ->T : Symbol(T, Decl(typeGuardOfFormThisMember.ts, 54, 24)) - - target: T; ->target : Symbol(target, Decl(typeGuardOfFormThisMember.ts, 54, 28)) ->T : Symbol(T, Decl(typeGuardOfFormThisMember.ts, 54, 24)) - - isLeader: this is (GenericLeadGuard); ->isLeader : Symbol(isLeader, Decl(typeGuardOfFormThisMember.ts, 55, 12)) ->GenericLeadGuard : Symbol(GenericLeadGuard, Decl(typeGuardOfFormThisMember.ts, 44, 2)) ->T : Symbol(T, Decl(typeGuardOfFormThisMember.ts, 54, 24)) - - isFollower: this is GenericFollowerGuard; ->isFollower : Symbol(isFollower, Decl(typeGuardOfFormThisMember.ts, 56, 42)) ->GenericFollowerGuard : Symbol(GenericFollowerGuard, Decl(typeGuardOfFormThisMember.ts, 48, 2)) ->T : Symbol(T, Decl(typeGuardOfFormThisMember.ts, 54, 24)) - } - - let guard: GenericGuard; ->guard : Symbol(guard, Decl(typeGuardOfFormThisMember.ts, 60, 4)) ->GenericGuard : Symbol(GenericGuard, Decl(typeGuardOfFormThisMember.ts, 52, 2)) ->File : Symbol(File, Decl(typeGuardOfFormThisMember.ts, 15, 2)) - - if (guard.isLeader) { ->guard.isLeader : Symbol(GenericGuard.isLeader, Decl(typeGuardOfFormThisMember.ts, 55, 12)) ->guard : Symbol(guard, Decl(typeGuardOfFormThisMember.ts, 60, 4)) ->isLeader : Symbol(GenericGuard.isLeader, Decl(typeGuardOfFormThisMember.ts, 55, 12)) - - guard.lead(); ->guard.lead : Symbol(GenericLeadGuard.lead, Decl(typeGuardOfFormThisMember.ts, 46, 56)) ->guard : Symbol(guard, Decl(typeGuardOfFormThisMember.ts, 60, 4)) ->lead : Symbol(GenericLeadGuard.lead, Decl(typeGuardOfFormThisMember.ts, 46, 56)) - } - else if (guard.isFollower) { ->guard.isFollower : Symbol(GenericGuard.isFollower, Decl(typeGuardOfFormThisMember.ts, 56, 42)) ->guard : Symbol(guard, Decl(typeGuardOfFormThisMember.ts, 60, 4)) ->isFollower : Symbol(GenericGuard.isFollower, Decl(typeGuardOfFormThisMember.ts, 56, 42)) - - guard.follow(); ->guard.follow : Symbol(GenericFollowerGuard.follow, Decl(typeGuardOfFormThisMember.ts, 50, 60)) ->guard : Symbol(guard, Decl(typeGuardOfFormThisMember.ts, 60, 4)) ->follow : Symbol(GenericFollowerGuard.follow, Decl(typeGuardOfFormThisMember.ts, 50, 60)) - } - - interface SpecificGuard { ->SpecificGuard : Symbol(SpecificGuard, Decl(typeGuardOfFormThisMember.ts, 66, 2)) - - isMoreSpecific: this is MoreSpecificGuard; ->isMoreSpecific : Symbol(isMoreSpecific, Decl(typeGuardOfFormThisMember.ts, 68, 26)) ->MoreSpecificGuard : Symbol(MoreSpecificGuard, Decl(typeGuardOfFormThisMember.ts, 70, 2)) - } - - interface MoreSpecificGuard extends SpecificGuard { ->MoreSpecificGuard : Symbol(MoreSpecificGuard, Decl(typeGuardOfFormThisMember.ts, 70, 2)) ->SpecificGuard : Symbol(SpecificGuard, Decl(typeGuardOfFormThisMember.ts, 66, 2)) - - do(): void; ->do : Symbol(do, Decl(typeGuardOfFormThisMember.ts, 72, 52)) - } - - let general: SpecificGuard; ->general : Symbol(general, Decl(typeGuardOfFormThisMember.ts, 76, 4)) ->SpecificGuard : Symbol(SpecificGuard, Decl(typeGuardOfFormThisMember.ts, 66, 2)) - - if (general.isMoreSpecific) { ->general.isMoreSpecific : Symbol(SpecificGuard.isMoreSpecific, Decl(typeGuardOfFormThisMember.ts, 68, 26)) ->general : Symbol(general, Decl(typeGuardOfFormThisMember.ts, 76, 4)) ->isMoreSpecific : Symbol(SpecificGuard.isMoreSpecific, Decl(typeGuardOfFormThisMember.ts, 68, 26)) - - general.do(); ->general.do : Symbol(MoreSpecificGuard.do, Decl(typeGuardOfFormThisMember.ts, 72, 52)) ->general : Symbol(general, Decl(typeGuardOfFormThisMember.ts, 76, 4)) ->do : Symbol(MoreSpecificGuard.do, Decl(typeGuardOfFormThisMember.ts, 72, 52)) - } -} - diff --git a/tests/baselines/reference/typeGuardOfFormThisMember.types b/tests/baselines/reference/typeGuardOfFormThisMember.types deleted file mode 100644 index 68343947fb4..00000000000 --- a/tests/baselines/reference/typeGuardOfFormThisMember.types +++ /dev/null @@ -1,254 +0,0 @@ -=== tests/cases/conformance/expressions/typeGuards/typeGuardOfFormThisMember.ts === -// There's a 'File' class in the stdlib, wrap with a namespace to avoid collision -namespace Test { ->Test : typeof Test - - export class FileSystemObject { ->FileSystemObject : FileSystemObject - - isFSO: this is FileSystemObject; ->isFSO : this is FileSystemObject ->FileSystemObject : FileSystemObject - - get isFile(): this is File { ->isFile : this is File ->File : File - - return this instanceof File; ->this instanceof File : boolean ->this : this ->File : typeof File - } - set isFile(param) { ->isFile : this is File ->param : boolean - - // noop - } - get isDirectory(): this is Directory { ->isDirectory : this is Directory ->Directory : Directory - - return this instanceof Directory; ->this instanceof Directory : boolean ->this : this ->Directory : typeof Directory - } - isNetworked: this is (Networked & this); ->isNetworked : this is Networked & this ->Networked : Networked - - constructor(public path: string) {} ->path : string - } - - export class File extends FileSystemObject { ->File : File ->FileSystemObject : FileSystemObject - - constructor(path: string, public content: string) { super(path); } ->path : string ->content : string ->super(path) : void ->super : typeof FileSystemObject ->path : string - } - export class Directory extends FileSystemObject { ->Directory : Directory ->FileSystemObject : FileSystemObject - - children: FileSystemObject[]; ->children : FileSystemObject[] ->FileSystemObject : FileSystemObject - } - export interface Networked { ->Networked : Networked - - host: string; ->host : string - } - - let file: FileSystemObject = new File("foo/bar.txt", "foo"); ->file : FileSystemObject ->FileSystemObject : FileSystemObject ->new File("foo/bar.txt", "foo") : File ->File : typeof File ->"foo/bar.txt" : string ->"foo" : string - - file.isNetworked = false; ->file.isNetworked = false : boolean ->file.isNetworked : this is Networked & FileSystemObject ->file : FileSystemObject ->isNetworked : this is Networked & FileSystemObject ->false : boolean - - file.isFSO = file.isFile; ->file.isFSO = file.isFile : this is File ->file.isFSO : this is FileSystemObject ->file : FileSystemObject ->isFSO : this is FileSystemObject ->file.isFile : this is File ->file : FileSystemObject ->isFile : this is File - - file.isFile = true; ->file.isFile = true : boolean ->file.isFile : this is File ->file : FileSystemObject ->isFile : this is File ->true : boolean - - let x = file.isFile; ->x : boolean ->file.isFile : this is File ->file : FileSystemObject ->isFile : this is File - - if (file.isFile) { ->file.isFile : this is File ->file : FileSystemObject ->isFile : this is File - - file.content; ->file.content : string ->file : File ->content : string - - if (file.isNetworked) { ->file.isNetworked : this is Networked & File ->file : File ->isNetworked : this is Networked & File - - file.host; ->file.host : string ->file : Networked & File ->host : string - - file.content; ->file.content : string ->file : Networked & File ->content : string - } - } - else if (file.isDirectory) { ->file.isDirectory : this is Directory ->file : FileSystemObject ->isDirectory : this is Directory - - file.children; ->file.children : FileSystemObject[] ->file : Directory ->children : FileSystemObject[] - } - else if (file.isNetworked) { ->file.isNetworked : this is Networked & FileSystemObject ->file : FileSystemObject ->isNetworked : this is Networked & FileSystemObject - - file.host; ->file.host : string ->file : Networked & FileSystemObject ->host : string - } - - interface GenericLeadGuard extends GenericGuard { ->GenericLeadGuard : GenericLeadGuard ->T : T ->GenericGuard : GenericGuard ->T : T - - lead(): void; ->lead : () => void - } - - interface GenericFollowerGuard extends GenericGuard { ->GenericFollowerGuard : GenericFollowerGuard ->T : T ->GenericGuard : GenericGuard ->T : T - - follow(): void; ->follow : () => void - } - - interface GenericGuard { ->GenericGuard : GenericGuard ->T : T - - target: T; ->target : T ->T : T - - isLeader: this is (GenericLeadGuard); ->isLeader : this is GenericLeadGuard ->GenericLeadGuard : GenericLeadGuard ->T : T - - isFollower: this is GenericFollowerGuard; ->isFollower : this is GenericFollowerGuard ->GenericFollowerGuard : GenericFollowerGuard ->T : T - } - - let guard: GenericGuard; ->guard : GenericGuard ->GenericGuard : GenericGuard ->File : File - - if (guard.isLeader) { ->guard.isLeader : this is GenericLeadGuard ->guard : GenericGuard ->isLeader : this is GenericLeadGuard - - guard.lead(); ->guard.lead() : void ->guard.lead : () => void ->guard : GenericLeadGuard ->lead : () => void - } - else if (guard.isFollower) { ->guard.isFollower : this is GenericFollowerGuard ->guard : GenericGuard ->isFollower : this is GenericFollowerGuard - - guard.follow(); ->guard.follow() : void ->guard.follow : () => void ->guard : GenericFollowerGuard ->follow : () => void - } - - interface SpecificGuard { ->SpecificGuard : SpecificGuard - - isMoreSpecific: this is MoreSpecificGuard; ->isMoreSpecific : this is MoreSpecificGuard ->MoreSpecificGuard : MoreSpecificGuard - } - - interface MoreSpecificGuard extends SpecificGuard { ->MoreSpecificGuard : MoreSpecificGuard ->SpecificGuard : SpecificGuard - - do(): void; ->do : () => void - } - - let general: SpecificGuard; ->general : SpecificGuard ->SpecificGuard : SpecificGuard - - if (general.isMoreSpecific) { ->general.isMoreSpecific : this is MoreSpecificGuard ->general : SpecificGuard ->isMoreSpecific : this is MoreSpecificGuard - - general.do(); ->general.do() : void ->general.do : () => void ->general : MoreSpecificGuard ->do : () => void - } -} - diff --git a/tests/baselines/reference/typeGuardOfFormThisMemberErrors.errors.txt b/tests/baselines/reference/typeGuardOfFormThisMemberErrors.errors.txt index 754cbffe6e6..88e9d41cc7b 100644 --- a/tests/baselines/reference/typeGuardOfFormThisMemberErrors.errors.txt +++ b/tests/baselines/reference/typeGuardOfFormThisMemberErrors.errors.txt @@ -1,27 +1,32 @@ -tests/cases/conformance/expressions/typeGuards/typeGuardOfFormThisMemberErrors.ts(29,2): error TS1226: Type predicate 'this is File' is not assignable to 'this is Networked & FileSystemObject'. - Type 'File' is not assignable to type 'Networked & FileSystemObject'. - Type 'File' is not assignable to type 'Networked'. - Property 'host' is missing in type 'File'. -tests/cases/conformance/expressions/typeGuards/typeGuardOfFormThisMemberErrors.ts(31,2): error TS1226: Type predicate 'this is FileSystemObject' is not assignable to 'this is File'. - Type 'FileSystemObject' is not assignable to type 'File'. - Property 'content' is missing in type 'FileSystemObject'. +tests/cases/conformance/expressions/typeGuards/typeGuardOfFormThisMemberErrors.ts(4,10): error TS1228: A type predicate is only allowed in return type position for functions and methods. +tests/cases/conformance/expressions/typeGuards/typeGuardOfFormThisMemberErrors.ts(5,17): error TS1228: A type predicate is only allowed in return type position for functions and methods. +tests/cases/conformance/expressions/typeGuards/typeGuardOfFormThisMemberErrors.ts(11,22): error TS1228: A type predicate is only allowed in return type position for functions and methods. +tests/cases/conformance/expressions/typeGuards/typeGuardOfFormThisMemberErrors.ts(14,16): error TS1228: A type predicate is only allowed in return type position for functions and methods. -==== tests/cases/conformance/expressions/typeGuards/typeGuardOfFormThisMemberErrors.ts (2 errors) ==== +==== tests/cases/conformance/expressions/typeGuards/typeGuardOfFormThisMemberErrors.ts (4 errors) ==== // There's a 'File' class in the stdlib, wrap with a namespace to avoid collision namespace Test { export class FileSystemObject { isFSO: this is FileSystemObject; + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1228: A type predicate is only allowed in return type position for functions and methods. get isFile(): this is File { + ~~~~~~~~~~~~ +!!! error TS1228: A type predicate is only allowed in return type position for functions and methods. return this instanceof File; } set isFile(param) { // noop } get isDirectory(): this is Directory { + ~~~~~~~~~~~~~~~~~ +!!! error TS1228: A type predicate is only allowed in return type position for functions and methods. return this instanceof Directory; } isNetworked: this is (Networked & this); + ~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1228: A type predicate is only allowed in return type position for functions and methods. constructor(public path: string) {} } @@ -37,15 +42,6 @@ tests/cases/conformance/expressions/typeGuards/typeGuardOfFormThisMemberErrors.t let file: FileSystemObject = new File("foo/bar.txt", "foo"); file.isNetworked = file.isFile; - ~~~~~~~~~~~~~~~~ -!!! error TS1226: Type predicate 'this is File' is not assignable to 'this is Networked & FileSystemObject'. -!!! error TS1226: Type 'File' is not assignable to type 'Networked & FileSystemObject'. -!!! error TS1226: Type 'File' is not assignable to type 'Networked'. -!!! error TS1226: Property 'host' is missing in type 'File'. file.isFSO = file.isNetworked; file.isFile = file.isFSO; - ~~~~~~~~~~~ -!!! error TS1226: Type predicate 'this is FileSystemObject' is not assignable to 'this is File'. -!!! error TS1226: Type 'FileSystemObject' is not assignable to type 'File'. -!!! error TS1226: Property 'content' is missing in type 'FileSystemObject'. } \ No newline at end of file diff --git a/tests/baselines/reference/typeGuardOfFormThisMemberErrors.js b/tests/baselines/reference/typeGuardOfFormThisMemberErrors.js index 6f681ab09cf..5991fdd3169 100644 --- a/tests/baselines/reference/typeGuardOfFormThisMemberErrors.js +++ b/tests/baselines/reference/typeGuardOfFormThisMemberErrors.js @@ -95,7 +95,7 @@ declare namespace Test { path: string; isFSO: this is FileSystemObject; isFile: this is File; - isDirectory: this is Directory; + readonly isDirectory: this is Directory; isNetworked: this is (Networked & this); constructor(path: string); } diff --git a/tests/baselines/reference/typeGuardOfFormTypeOfBoolean.js b/tests/baselines/reference/typeGuardOfFormTypeOfBoolean.js index e9e11275d0d..7d68b893373 100644 --- a/tests/baselines/reference/typeGuardOfFormTypeOfBoolean.js +++ b/tests/baselines/reference/typeGuardOfFormTypeOfBoolean.js @@ -42,12 +42,11 @@ else { c = boolOrC; // C } -// Narrowing occurs only if target type is a subtype of variable type if (typeof strOrNum === "boolean") { - var z1: string | number = strOrNum; // string | number + let z1: {} = strOrNum; // {} } else { - var z2: string | number = strOrNum; // string | number + let z2: string | number = strOrNum; // string | number } @@ -79,12 +78,11 @@ else { bool = boolOrC; // boolean } -// Narrowing occurs only if target type is a subtype of variable type if (typeof strOrNum !== "boolean") { - var z1: string | number = strOrNum; // string | number + let z1: string | number = strOrNum; // string | number } else { - var z2: string | number = strOrNum; // string | number + let z2: {} = strOrNum; // {} } @@ -134,9 +132,8 @@ if (typeof boolOrC === "boolean") { else { c = boolOrC; // C } -// Narrowing occurs only if target type is a subtype of variable type if (typeof strOrNum === "boolean") { - var z1 = strOrNum; // string | number + var z1 = strOrNum; // {} } else { var z2 = strOrNum; // string | number @@ -168,10 +165,9 @@ if (typeof boolOrC !== "boolean") { else { bool = boolOrC; // boolean } -// Narrowing occurs only if target type is a subtype of variable type if (typeof strOrNum !== "boolean") { var z1 = strOrNum; // string | number } else { - var z2 = strOrNum; // string | number + var z2 = strOrNum; // {} } diff --git a/tests/baselines/reference/typeGuardOfFormTypeOfBoolean.symbols b/tests/baselines/reference/typeGuardOfFormTypeOfBoolean.symbols index 7cb38bfdeaf..dbef84c28c7 100644 --- a/tests/baselines/reference/typeGuardOfFormTypeOfBoolean.symbols +++ b/tests/baselines/reference/typeGuardOfFormTypeOfBoolean.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfBoolean.ts === class C { private p: string }; >C : Symbol(C, Decl(typeGuardOfFormTypeOfBoolean.ts, 0, 0)) ->p : Symbol(p, Decl(typeGuardOfFormTypeOfBoolean.ts, 0, 9)) +>p : Symbol(C.p, Decl(typeGuardOfFormTypeOfBoolean.ts, 0, 9)) var str: string; >str : Symbol(str, Decl(typeGuardOfFormTypeOfBoolean.ts, 2, 3)) @@ -93,17 +93,16 @@ else { >boolOrC : Symbol(boolOrC, Decl(typeGuardOfFormTypeOfBoolean.ts, 11, 3)) } -// Narrowing occurs only if target type is a subtype of variable type if (typeof strOrNum === "boolean") { >strOrNum : Symbol(strOrNum, Decl(typeGuardOfFormTypeOfBoolean.ts, 5, 3)) - var z1: string | number = strOrNum; // string | number ->z1 : Symbol(z1, Decl(typeGuardOfFormTypeOfBoolean.ts, 45, 7), Decl(typeGuardOfFormTypeOfBoolean.ts, 82, 7)) + let z1: {} = strOrNum; // {} +>z1 : Symbol(z1, Decl(typeGuardOfFormTypeOfBoolean.ts, 44, 7)) >strOrNum : Symbol(strOrNum, Decl(typeGuardOfFormTypeOfBoolean.ts, 5, 3)) } else { - var z2: string | number = strOrNum; // string | number ->z2 : Symbol(z2, Decl(typeGuardOfFormTypeOfBoolean.ts, 48, 7), Decl(typeGuardOfFormTypeOfBoolean.ts, 85, 7)) + let z2: string | number = strOrNum; // string | number +>z2 : Symbol(z2, Decl(typeGuardOfFormTypeOfBoolean.ts, 47, 7)) >strOrNum : Symbol(strOrNum, Decl(typeGuardOfFormTypeOfBoolean.ts, 5, 3)) } @@ -160,17 +159,16 @@ else { >boolOrC : Symbol(boolOrC, Decl(typeGuardOfFormTypeOfBoolean.ts, 11, 3)) } -// Narrowing occurs only if target type is a subtype of variable type if (typeof strOrNum !== "boolean") { >strOrNum : Symbol(strOrNum, Decl(typeGuardOfFormTypeOfBoolean.ts, 5, 3)) - var z1: string | number = strOrNum; // string | number ->z1 : Symbol(z1, Decl(typeGuardOfFormTypeOfBoolean.ts, 45, 7), Decl(typeGuardOfFormTypeOfBoolean.ts, 82, 7)) + let z1: string | number = strOrNum; // string | number +>z1 : Symbol(z1, Decl(typeGuardOfFormTypeOfBoolean.ts, 80, 7)) >strOrNum : Symbol(strOrNum, Decl(typeGuardOfFormTypeOfBoolean.ts, 5, 3)) } else { - var z2: string | number = strOrNum; // string | number ->z2 : Symbol(z2, Decl(typeGuardOfFormTypeOfBoolean.ts, 48, 7), Decl(typeGuardOfFormTypeOfBoolean.ts, 85, 7)) + let z2: {} = strOrNum; // {} +>z2 : Symbol(z2, Decl(typeGuardOfFormTypeOfBoolean.ts, 83, 7)) >strOrNum : Symbol(strOrNum, Decl(typeGuardOfFormTypeOfBoolean.ts, 5, 3)) } diff --git a/tests/baselines/reference/typeGuardOfFormTypeOfBoolean.types b/tests/baselines/reference/typeGuardOfFormTypeOfBoolean.types index 9d9f28548be..7a4b279b572 100644 --- a/tests/baselines/reference/typeGuardOfFormTypeOfBoolean.types +++ b/tests/baselines/reference/typeGuardOfFormTypeOfBoolean.types @@ -113,19 +113,18 @@ else { >boolOrC : C } -// Narrowing occurs only if target type is a subtype of variable type if (typeof strOrNum === "boolean") { >typeof strOrNum === "boolean" : boolean >typeof strOrNum : string >strOrNum : string | number >"boolean" : string - var z1: string | number = strOrNum; // string | number ->z1 : string | number ->strOrNum : string | number + let z1: {} = strOrNum; // {} +>z1 : {} +>strOrNum : never } else { - var z2: string | number = strOrNum; // string | number + let z2: string | number = strOrNum; // string | number >z2 : string | number >strOrNum : string | number } @@ -137,7 +136,7 @@ else { if (typeof strOrBool !== "boolean") { >typeof strOrBool !== "boolean" : boolean >typeof strOrBool : string ->strOrBool : string | boolean +>strOrBool : boolean | string >"boolean" : string str = strOrBool; // string @@ -154,7 +153,7 @@ else { if (typeof numOrBool !== "boolean") { >typeof numOrBool !== "boolean" : boolean >typeof numOrBool : string ->numOrBool : number | boolean +>numOrBool : boolean | number >"boolean" : string num = numOrBool; // number @@ -171,7 +170,7 @@ else { if (typeof strOrNumOrBool !== "boolean") { >typeof strOrNumOrBool !== "boolean" : boolean >typeof strOrNumOrBool : string ->strOrNumOrBool : string | number | boolean +>strOrNumOrBool : boolean | string | number >"boolean" : string strOrNum = strOrNumOrBool; // string | number @@ -203,20 +202,19 @@ else { >boolOrC : boolean } -// Narrowing occurs only if target type is a subtype of variable type if (typeof strOrNum !== "boolean") { >typeof strOrNum !== "boolean" : boolean >typeof strOrNum : string >strOrNum : string | number >"boolean" : string - var z1: string | number = strOrNum; // string | number + let z1: string | number = strOrNum; // string | number >z1 : string | number >strOrNum : string | number } else { - var z2: string | number = strOrNum; // string | number ->z2 : string | number ->strOrNum : string | number + let z2: {} = strOrNum; // {} +>z2 : {} +>strOrNum : never } diff --git a/tests/baselines/reference/typeGuardOfFormTypeOfEqualEqualHasNoEffect.errors.txt b/tests/baselines/reference/typeGuardOfFormTypeOfEqualEqualHasNoEffect.errors.txt new file mode 100644 index 00000000000..c76c6e819df --- /dev/null +++ b/tests/baselines/reference/typeGuardOfFormTypeOfEqualEqualHasNoEffect.errors.txt @@ -0,0 +1,50 @@ +tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts(13,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'r1' must be of type 'string', but here has type 'number'. +tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts(20,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'r2' must be of type 'boolean', but here has type 'string'. +tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts(27,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'r3' must be of type 'number', but here has type 'boolean'. +tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts(34,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'r4' must be of type 'C', but here has type 'string'. + + +==== tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts (4 errors) ==== + class C { private p: string }; + + var strOrNum: string | number; + var strOrBool: string | boolean; + var numOrBool: number | boolean + var strOrC: string | C; + + // typeof x == s has not effect on typeguard + if (typeof strOrNum == "string") { + var r1 = strOrNum; // string | number + } + else { + var r1 = strOrNum; // string | number + ~~ +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'r1' must be of type 'string', but here has type 'number'. + } + + if (typeof strOrBool == "boolean") { + var r2 = strOrBool; // string | boolean + } + else { + var r2 = strOrBool; // string | boolean + ~~ +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'r2' must be of type 'boolean', but here has type 'string'. + } + + if (typeof numOrBool == "number") { + var r3 = numOrBool; // number | boolean + } + else { + var r3 = numOrBool; // number | boolean + ~~ +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'r3' must be of type 'number', but here has type 'boolean'. + } + + if (typeof strOrC == "Object") { + var r4 = strOrC; // string | C + } + else { + var r4 = strOrC; // string | C + ~~ +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'r4' must be of type 'C', but here has type 'string'. + } \ No newline at end of file diff --git a/tests/baselines/reference/typeGuardOfFormTypeOfEqualEqualHasNoEffect.symbols b/tests/baselines/reference/typeGuardOfFormTypeOfEqualEqualHasNoEffect.symbols deleted file mode 100644 index 69e0dc78738..00000000000 --- a/tests/baselines/reference/typeGuardOfFormTypeOfEqualEqualHasNoEffect.symbols +++ /dev/null @@ -1,70 +0,0 @@ -=== tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts === -class C { private p: string }; ->C : Symbol(C, Decl(typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts, 0, 0)) ->p : Symbol(p, Decl(typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts, 0, 9)) - -var strOrNum: string | number; ->strOrNum : Symbol(strOrNum, Decl(typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts, 2, 3)) - -var strOrBool: string | boolean; ->strOrBool : Symbol(strOrBool, Decl(typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts, 3, 3)) - -var numOrBool: number | boolean ->numOrBool : Symbol(numOrBool, Decl(typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts, 4, 3)) - -var strOrC: string | C; ->strOrC : Symbol(strOrC, Decl(typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts, 5, 3)) ->C : Symbol(C, Decl(typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts, 0, 0)) - -// typeof x == s has not effect on typeguard -if (typeof strOrNum == "string") { ->strOrNum : Symbol(strOrNum, Decl(typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts, 2, 3)) - - var r1 = strOrNum; // string | number ->r1 : Symbol(r1, Decl(typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts, 9, 7), Decl(typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts, 12, 7)) ->strOrNum : Symbol(strOrNum, Decl(typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts, 2, 3)) -} -else { - var r1 = strOrNum; // string | number ->r1 : Symbol(r1, Decl(typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts, 9, 7), Decl(typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts, 12, 7)) ->strOrNum : Symbol(strOrNum, Decl(typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts, 2, 3)) -} - -if (typeof strOrBool == "boolean") { ->strOrBool : Symbol(strOrBool, Decl(typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts, 3, 3)) - - var r2 = strOrBool; // string | boolean ->r2 : Symbol(r2, Decl(typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts, 16, 7), Decl(typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts, 19, 7)) ->strOrBool : Symbol(strOrBool, Decl(typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts, 3, 3)) -} -else { - var r2 = strOrBool; // string | boolean ->r2 : Symbol(r2, Decl(typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts, 16, 7), Decl(typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts, 19, 7)) ->strOrBool : Symbol(strOrBool, Decl(typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts, 3, 3)) -} - -if (typeof numOrBool == "number") { ->numOrBool : Symbol(numOrBool, Decl(typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts, 4, 3)) - - var r3 = numOrBool; // number | boolean ->r3 : Symbol(r3, Decl(typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts, 23, 7), Decl(typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts, 26, 7)) ->numOrBool : Symbol(numOrBool, Decl(typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts, 4, 3)) -} -else { - var r3 = numOrBool; // number | boolean ->r3 : Symbol(r3, Decl(typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts, 23, 7), Decl(typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts, 26, 7)) ->numOrBool : Symbol(numOrBool, Decl(typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts, 4, 3)) -} - -if (typeof strOrC == "Object") { ->strOrC : Symbol(strOrC, Decl(typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts, 5, 3)) - - var r4 = strOrC; // string | C ->r4 : Symbol(r4, Decl(typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts, 30, 7), Decl(typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts, 33, 7)) ->strOrC : Symbol(strOrC, Decl(typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts, 5, 3)) -} -else { - var r4 = strOrC; // string | C ->r4 : Symbol(r4, Decl(typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts, 30, 7), Decl(typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts, 33, 7)) ->strOrC : Symbol(strOrC, Decl(typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts, 5, 3)) -} diff --git a/tests/baselines/reference/typeGuardOfFormTypeOfEqualEqualHasNoEffect.types b/tests/baselines/reference/typeGuardOfFormTypeOfEqualEqualHasNoEffect.types deleted file mode 100644 index 4bfc8fe6bf1..00000000000 --- a/tests/baselines/reference/typeGuardOfFormTypeOfEqualEqualHasNoEffect.types +++ /dev/null @@ -1,82 +0,0 @@ -=== tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts === -class C { private p: string }; ->C : C ->p : string - -var strOrNum: string | number; ->strOrNum : string | number - -var strOrBool: string | boolean; ->strOrBool : string | boolean - -var numOrBool: number | boolean ->numOrBool : number | boolean - -var strOrC: string | C; ->strOrC : string | C ->C : C - -// typeof x == s has not effect on typeguard -if (typeof strOrNum == "string") { ->typeof strOrNum == "string" : boolean ->typeof strOrNum : string ->strOrNum : string | number ->"string" : string - - var r1 = strOrNum; // string | number ->r1 : string | number ->strOrNum : string | number -} -else { - var r1 = strOrNum; // string | number ->r1 : string | number ->strOrNum : string | number -} - -if (typeof strOrBool == "boolean") { ->typeof strOrBool == "boolean" : boolean ->typeof strOrBool : string ->strOrBool : string | boolean ->"boolean" : string - - var r2 = strOrBool; // string | boolean ->r2 : string | boolean ->strOrBool : string | boolean -} -else { - var r2 = strOrBool; // string | boolean ->r2 : string | boolean ->strOrBool : string | boolean -} - -if (typeof numOrBool == "number") { ->typeof numOrBool == "number" : boolean ->typeof numOrBool : string ->numOrBool : number | boolean ->"number" : string - - var r3 = numOrBool; // number | boolean ->r3 : number | boolean ->numOrBool : number | boolean -} -else { - var r3 = numOrBool; // number | boolean ->r3 : number | boolean ->numOrBool : number | boolean -} - -if (typeof strOrC == "Object") { ->typeof strOrC == "Object" : boolean ->typeof strOrC : string ->strOrC : string | C ->"Object" : string - - var r4 = strOrC; // string | C ->r4 : string | C ->strOrC : string | C -} -else { - var r4 = strOrC; // string | C ->r4 : string | C ->strOrC : string | C -} diff --git a/tests/baselines/reference/typeGuardOfFormTypeOfNotEqualHasNoEffect.errors.txt b/tests/baselines/reference/typeGuardOfFormTypeOfNotEqualHasNoEffect.errors.txt new file mode 100644 index 00000000000..3b29f3ecba8 --- /dev/null +++ b/tests/baselines/reference/typeGuardOfFormTypeOfNotEqualHasNoEffect.errors.txt @@ -0,0 +1,50 @@ +tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNotEqualHasNoEffect.ts(13,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'r1' must be of type 'number', but here has type 'string'. +tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNotEqualHasNoEffect.ts(20,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'r2' must be of type 'string', but here has type 'boolean'. +tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNotEqualHasNoEffect.ts(27,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'r3' must be of type 'boolean', but here has type 'number'. +tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNotEqualHasNoEffect.ts(34,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'r4' must be of type 'string', but here has type 'C'. + + +==== tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNotEqualHasNoEffect.ts (4 errors) ==== + class C { private p: string }; + + var strOrNum: string | number; + var strOrBool: string | boolean; + var numOrBool: number | boolean + var strOrC: string | C; + + // typeof x != s has not effect on typeguard + if (typeof strOrNum != "string") { + var r1 = strOrNum; // string | number + } + else { + var r1 = strOrNum; // string | number + ~~ +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'r1' must be of type 'number', but here has type 'string'. + } + + if (typeof strOrBool != "boolean") { + var r2 = strOrBool; // string | boolean + } + else { + var r2 = strOrBool; // string | boolean + ~~ +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'r2' must be of type 'string', but here has type 'boolean'. + } + + if (typeof numOrBool != "number") { + var r3 = numOrBool; // number | boolean + } + else { + var r3 = numOrBool; // number | boolean + ~~ +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'r3' must be of type 'boolean', but here has type 'number'. + } + + if (typeof strOrC != "Object") { + var r4 = strOrC; // string | C + } + else { + var r4 = strOrC; // string | C + ~~ +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'r4' must be of type 'string', but here has type 'C'. + } \ No newline at end of file diff --git a/tests/baselines/reference/typeGuardOfFormTypeOfNotEqualHasNoEffect.symbols b/tests/baselines/reference/typeGuardOfFormTypeOfNotEqualHasNoEffect.symbols deleted file mode 100644 index b22f1e313a4..00000000000 --- a/tests/baselines/reference/typeGuardOfFormTypeOfNotEqualHasNoEffect.symbols +++ /dev/null @@ -1,70 +0,0 @@ -=== tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNotEqualHasNoEffect.ts === -class C { private p: string }; ->C : Symbol(C, Decl(typeGuardOfFormTypeOfNotEqualHasNoEffect.ts, 0, 0)) ->p : Symbol(p, Decl(typeGuardOfFormTypeOfNotEqualHasNoEffect.ts, 0, 9)) - -var strOrNum: string | number; ->strOrNum : Symbol(strOrNum, Decl(typeGuardOfFormTypeOfNotEqualHasNoEffect.ts, 2, 3)) - -var strOrBool: string | boolean; ->strOrBool : Symbol(strOrBool, Decl(typeGuardOfFormTypeOfNotEqualHasNoEffect.ts, 3, 3)) - -var numOrBool: number | boolean ->numOrBool : Symbol(numOrBool, Decl(typeGuardOfFormTypeOfNotEqualHasNoEffect.ts, 4, 3)) - -var strOrC: string | C; ->strOrC : Symbol(strOrC, Decl(typeGuardOfFormTypeOfNotEqualHasNoEffect.ts, 5, 3)) ->C : Symbol(C, Decl(typeGuardOfFormTypeOfNotEqualHasNoEffect.ts, 0, 0)) - -// typeof x != s has not effect on typeguard -if (typeof strOrNum != "string") { ->strOrNum : Symbol(strOrNum, Decl(typeGuardOfFormTypeOfNotEqualHasNoEffect.ts, 2, 3)) - - var r1 = strOrNum; // string | number ->r1 : Symbol(r1, Decl(typeGuardOfFormTypeOfNotEqualHasNoEffect.ts, 9, 7), Decl(typeGuardOfFormTypeOfNotEqualHasNoEffect.ts, 12, 7)) ->strOrNum : Symbol(strOrNum, Decl(typeGuardOfFormTypeOfNotEqualHasNoEffect.ts, 2, 3)) -} -else { - var r1 = strOrNum; // string | number ->r1 : Symbol(r1, Decl(typeGuardOfFormTypeOfNotEqualHasNoEffect.ts, 9, 7), Decl(typeGuardOfFormTypeOfNotEqualHasNoEffect.ts, 12, 7)) ->strOrNum : Symbol(strOrNum, Decl(typeGuardOfFormTypeOfNotEqualHasNoEffect.ts, 2, 3)) -} - -if (typeof strOrBool != "boolean") { ->strOrBool : Symbol(strOrBool, Decl(typeGuardOfFormTypeOfNotEqualHasNoEffect.ts, 3, 3)) - - var r2 = strOrBool; // string | boolean ->r2 : Symbol(r2, Decl(typeGuardOfFormTypeOfNotEqualHasNoEffect.ts, 16, 7), Decl(typeGuardOfFormTypeOfNotEqualHasNoEffect.ts, 19, 7)) ->strOrBool : Symbol(strOrBool, Decl(typeGuardOfFormTypeOfNotEqualHasNoEffect.ts, 3, 3)) -} -else { - var r2 = strOrBool; // string | boolean ->r2 : Symbol(r2, Decl(typeGuardOfFormTypeOfNotEqualHasNoEffect.ts, 16, 7), Decl(typeGuardOfFormTypeOfNotEqualHasNoEffect.ts, 19, 7)) ->strOrBool : Symbol(strOrBool, Decl(typeGuardOfFormTypeOfNotEqualHasNoEffect.ts, 3, 3)) -} - -if (typeof numOrBool != "number") { ->numOrBool : Symbol(numOrBool, Decl(typeGuardOfFormTypeOfNotEqualHasNoEffect.ts, 4, 3)) - - var r3 = numOrBool; // number | boolean ->r3 : Symbol(r3, Decl(typeGuardOfFormTypeOfNotEqualHasNoEffect.ts, 23, 7), Decl(typeGuardOfFormTypeOfNotEqualHasNoEffect.ts, 26, 7)) ->numOrBool : Symbol(numOrBool, Decl(typeGuardOfFormTypeOfNotEqualHasNoEffect.ts, 4, 3)) -} -else { - var r3 = numOrBool; // number | boolean ->r3 : Symbol(r3, Decl(typeGuardOfFormTypeOfNotEqualHasNoEffect.ts, 23, 7), Decl(typeGuardOfFormTypeOfNotEqualHasNoEffect.ts, 26, 7)) ->numOrBool : Symbol(numOrBool, Decl(typeGuardOfFormTypeOfNotEqualHasNoEffect.ts, 4, 3)) -} - -if (typeof strOrC != "Object") { ->strOrC : Symbol(strOrC, Decl(typeGuardOfFormTypeOfNotEqualHasNoEffect.ts, 5, 3)) - - var r4 = strOrC; // string | C ->r4 : Symbol(r4, Decl(typeGuardOfFormTypeOfNotEqualHasNoEffect.ts, 30, 7), Decl(typeGuardOfFormTypeOfNotEqualHasNoEffect.ts, 33, 7)) ->strOrC : Symbol(strOrC, Decl(typeGuardOfFormTypeOfNotEqualHasNoEffect.ts, 5, 3)) -} -else { - var r4 = strOrC; // string | C ->r4 : Symbol(r4, Decl(typeGuardOfFormTypeOfNotEqualHasNoEffect.ts, 30, 7), Decl(typeGuardOfFormTypeOfNotEqualHasNoEffect.ts, 33, 7)) ->strOrC : Symbol(strOrC, Decl(typeGuardOfFormTypeOfNotEqualHasNoEffect.ts, 5, 3)) -} diff --git a/tests/baselines/reference/typeGuardOfFormTypeOfNotEqualHasNoEffect.types b/tests/baselines/reference/typeGuardOfFormTypeOfNotEqualHasNoEffect.types deleted file mode 100644 index 6eabeb25ede..00000000000 --- a/tests/baselines/reference/typeGuardOfFormTypeOfNotEqualHasNoEffect.types +++ /dev/null @@ -1,82 +0,0 @@ -=== tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNotEqualHasNoEffect.ts === -class C { private p: string }; ->C : C ->p : string - -var strOrNum: string | number; ->strOrNum : string | number - -var strOrBool: string | boolean; ->strOrBool : string | boolean - -var numOrBool: number | boolean ->numOrBool : number | boolean - -var strOrC: string | C; ->strOrC : string | C ->C : C - -// typeof x != s has not effect on typeguard -if (typeof strOrNum != "string") { ->typeof strOrNum != "string" : boolean ->typeof strOrNum : string ->strOrNum : string | number ->"string" : string - - var r1 = strOrNum; // string | number ->r1 : string | number ->strOrNum : string | number -} -else { - var r1 = strOrNum; // string | number ->r1 : string | number ->strOrNum : string | number -} - -if (typeof strOrBool != "boolean") { ->typeof strOrBool != "boolean" : boolean ->typeof strOrBool : string ->strOrBool : string | boolean ->"boolean" : string - - var r2 = strOrBool; // string | boolean ->r2 : string | boolean ->strOrBool : string | boolean -} -else { - var r2 = strOrBool; // string | boolean ->r2 : string | boolean ->strOrBool : string | boolean -} - -if (typeof numOrBool != "number") { ->typeof numOrBool != "number" : boolean ->typeof numOrBool : string ->numOrBool : number | boolean ->"number" : string - - var r3 = numOrBool; // number | boolean ->r3 : number | boolean ->numOrBool : number | boolean -} -else { - var r3 = numOrBool; // number | boolean ->r3 : number | boolean ->numOrBool : number | boolean -} - -if (typeof strOrC != "Object") { ->typeof strOrC != "Object" : boolean ->typeof strOrC : string ->strOrC : string | C ->"Object" : string - - var r4 = strOrC; // string | C ->r4 : string | C ->strOrC : string | C -} -else { - var r4 = strOrC; // string | C ->r4 : string | C ->strOrC : string | C -} diff --git a/tests/baselines/reference/typeGuardOfFormTypeOfNumber.js b/tests/baselines/reference/typeGuardOfFormTypeOfNumber.js index 66fcff0c387..3bea6e87d2b 100644 --- a/tests/baselines/reference/typeGuardOfFormTypeOfNumber.js +++ b/tests/baselines/reference/typeGuardOfFormTypeOfNumber.js @@ -42,12 +42,11 @@ else { c = numOrC; // C } -// Narrowing occurs only if target type is a subtype of variable type if (typeof strOrBool === "number") { - var y1: string | boolean = strOrBool; // string | boolean + let y1: {} = strOrBool; // {} } else { - var y2: string | boolean = strOrBool; // string | boolean + let y2: string | boolean = strOrBool; // string | boolean } // A type guard of the form typeof x !== s, where s is a string literal, @@ -78,12 +77,11 @@ else { num = numOrC; // number } -// Narrowing occurs only if target type is a subtype of variable type if (typeof strOrBool !== "number") { - var y1: string | boolean = strOrBool; // string | boolean + let y1: string | boolean = strOrBool; // string | boolean } else { - var y2: string | boolean = strOrBool; // string | boolean + let y2: {} = strOrBool; // {} } @@ -133,9 +131,8 @@ if (typeof numOrC === "number") { else { c = numOrC; // C } -// Narrowing occurs only if target type is a subtype of variable type if (typeof strOrBool === "number") { - var y1 = strOrBool; // string | boolean + var y1 = strOrBool; // {} } else { var y2 = strOrBool; // string | boolean @@ -167,10 +164,9 @@ if (typeof numOrC !== "number") { else { num = numOrC; // number } -// Narrowing occurs only if target type is a subtype of variable type if (typeof strOrBool !== "number") { var y1 = strOrBool; // string | boolean } else { - var y2 = strOrBool; // string | boolean + var y2 = strOrBool; // {} } diff --git a/tests/baselines/reference/typeGuardOfFormTypeOfNumber.symbols b/tests/baselines/reference/typeGuardOfFormTypeOfNumber.symbols index 0052fb90880..f38c348131e 100644 --- a/tests/baselines/reference/typeGuardOfFormTypeOfNumber.symbols +++ b/tests/baselines/reference/typeGuardOfFormTypeOfNumber.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNumber.ts === class C { private p: string }; >C : Symbol(C, Decl(typeGuardOfFormTypeOfNumber.ts, 0, 0)) ->p : Symbol(p, Decl(typeGuardOfFormTypeOfNumber.ts, 0, 9)) +>p : Symbol(C.p, Decl(typeGuardOfFormTypeOfNumber.ts, 0, 9)) var str: string; >str : Symbol(str, Decl(typeGuardOfFormTypeOfNumber.ts, 2, 3)) @@ -65,7 +65,7 @@ if (typeof numOrBool === "number") { } else { var x: number | boolean = numOrBool; // number | boolean ->x : Symbol(x, Decl(typeGuardOfFormTypeOfNumber.ts, 28, 7), Decl(typeGuardOfFormTypeOfNumber.ts, 61, 7)) +>x : Symbol(x, Decl(typeGuardOfFormTypeOfNumber.ts, 28, 7), Decl(typeGuardOfFormTypeOfNumber.ts, 60, 7)) >numOrBool : Symbol(numOrBool, Decl(typeGuardOfFormTypeOfNumber.ts, 7, 3)) } if (typeof strOrNumOrBool === "number") { @@ -93,17 +93,16 @@ else { >numOrC : Symbol(numOrC, Decl(typeGuardOfFormTypeOfNumber.ts, 10, 3)) } -// Narrowing occurs only if target type is a subtype of variable type if (typeof strOrBool === "number") { >strOrBool : Symbol(strOrBool, Decl(typeGuardOfFormTypeOfNumber.ts, 6, 3)) - var y1: string | boolean = strOrBool; // string | boolean ->y1 : Symbol(y1, Decl(typeGuardOfFormTypeOfNumber.ts, 45, 7), Decl(typeGuardOfFormTypeOfNumber.ts, 81, 7)) + let y1: {} = strOrBool; // {} +>y1 : Symbol(y1, Decl(typeGuardOfFormTypeOfNumber.ts, 44, 7)) >strOrBool : Symbol(strOrBool, Decl(typeGuardOfFormTypeOfNumber.ts, 6, 3)) } else { - var y2: string | boolean = strOrBool; // string | boolean ->y2 : Symbol(y2, Decl(typeGuardOfFormTypeOfNumber.ts, 48, 7), Decl(typeGuardOfFormTypeOfNumber.ts, 84, 7)) + let y2: string | boolean = strOrBool; // string | boolean +>y2 : Symbol(y2, Decl(typeGuardOfFormTypeOfNumber.ts, 47, 7)) >strOrBool : Symbol(strOrBool, Decl(typeGuardOfFormTypeOfNumber.ts, 6, 3)) } @@ -126,7 +125,7 @@ if (typeof numOrBool !== "number") { >numOrBool : Symbol(numOrBool, Decl(typeGuardOfFormTypeOfNumber.ts, 7, 3)) var x: number | boolean = numOrBool; // number | boolean ->x : Symbol(x, Decl(typeGuardOfFormTypeOfNumber.ts, 28, 7), Decl(typeGuardOfFormTypeOfNumber.ts, 61, 7)) +>x : Symbol(x, Decl(typeGuardOfFormTypeOfNumber.ts, 28, 7), Decl(typeGuardOfFormTypeOfNumber.ts, 60, 7)) >numOrBool : Symbol(numOrBool, Decl(typeGuardOfFormTypeOfNumber.ts, 7, 3)) } else { @@ -159,17 +158,16 @@ else { >numOrC : Symbol(numOrC, Decl(typeGuardOfFormTypeOfNumber.ts, 10, 3)) } -// Narrowing occurs only if target type is a subtype of variable type if (typeof strOrBool !== "number") { >strOrBool : Symbol(strOrBool, Decl(typeGuardOfFormTypeOfNumber.ts, 6, 3)) - var y1: string | boolean = strOrBool; // string | boolean ->y1 : Symbol(y1, Decl(typeGuardOfFormTypeOfNumber.ts, 45, 7), Decl(typeGuardOfFormTypeOfNumber.ts, 81, 7)) + let y1: string | boolean = strOrBool; // string | boolean +>y1 : Symbol(y1, Decl(typeGuardOfFormTypeOfNumber.ts, 79, 7)) >strOrBool : Symbol(strOrBool, Decl(typeGuardOfFormTypeOfNumber.ts, 6, 3)) } else { - var y2: string | boolean = strOrBool; // string | boolean ->y2 : Symbol(y2, Decl(typeGuardOfFormTypeOfNumber.ts, 48, 7), Decl(typeGuardOfFormTypeOfNumber.ts, 84, 7)) + let y2: {} = strOrBool; // {} +>y2 : Symbol(y2, Decl(typeGuardOfFormTypeOfNumber.ts, 82, 7)) >strOrBool : Symbol(strOrBool, Decl(typeGuardOfFormTypeOfNumber.ts, 6, 3)) } diff --git a/tests/baselines/reference/typeGuardOfFormTypeOfNumber.types b/tests/baselines/reference/typeGuardOfFormTypeOfNumber.types index d3caef24efd..c6a5615e75a 100644 --- a/tests/baselines/reference/typeGuardOfFormTypeOfNumber.types +++ b/tests/baselines/reference/typeGuardOfFormTypeOfNumber.types @@ -112,19 +112,18 @@ else { >numOrC : C } -// Narrowing occurs only if target type is a subtype of variable type if (typeof strOrBool === "number") { >typeof strOrBool === "number" : boolean >typeof strOrBool : string >strOrBool : string | boolean >"number" : string - var y1: string | boolean = strOrBool; // string | boolean ->y1 : string | boolean ->strOrBool : string | boolean + let y1: {} = strOrBool; // {} +>y1 : {} +>strOrBool : never } else { - var y2: string | boolean = strOrBool; // string | boolean + let y2: string | boolean = strOrBool; // string | boolean >y2 : string | boolean >strOrBool : string | boolean } @@ -135,7 +134,7 @@ else { if (typeof strOrNum !== "number") { >typeof strOrNum !== "number" : boolean >typeof strOrNum : string ->strOrNum : string | number +>strOrNum : number | string >"number" : string str === strOrNum; // string @@ -168,7 +167,7 @@ else { if (typeof strOrNumOrBool !== "number") { >typeof strOrNumOrBool !== "number" : boolean >typeof strOrNumOrBool : string ->strOrNumOrBool : string | number | boolean +>strOrNumOrBool : number | string | boolean >"number" : string strOrBool = strOrNumOrBool; // string | boolean @@ -200,20 +199,19 @@ else { >numOrC : number } -// Narrowing occurs only if target type is a subtype of variable type if (typeof strOrBool !== "number") { >typeof strOrBool !== "number" : boolean >typeof strOrBool : string >strOrBool : string | boolean >"number" : string - var y1: string | boolean = strOrBool; // string | boolean + let y1: string | boolean = strOrBool; // string | boolean >y1 : string | boolean >strOrBool : string | boolean } else { - var y2: string | boolean = strOrBool; // string | boolean ->y2 : string | boolean ->strOrBool : string | boolean + let y2: {} = strOrBool; // {} +>y2 : {} +>strOrBool : never } diff --git a/tests/baselines/reference/typeGuardOfFormTypeOfOther.js b/tests/baselines/reference/typeGuardOfFormTypeOfOther.js index b1e6ca26566..ee0b6f66332 100644 --- a/tests/baselines/reference/typeGuardOfFormTypeOfOther.js +++ b/tests/baselines/reference/typeGuardOfFormTypeOfOther.js @@ -38,12 +38,11 @@ else { var r4: boolean = boolOrC; // boolean } -// Narrowing occurs only if target type is a subtype of variable type if (typeof strOrNumOrBool === "Object") { - var q1: string | number | boolean = strOrNumOrBool; // string | number | boolean + let q1: {} = strOrNumOrBool; // {} } else { - var q2: string | number | boolean = strOrNumOrBool; // string | number | boolean + let q2: string | number | boolean = strOrNumOrBool; // string | number | boolean } // A type guard of the form typeof x !== s, where s is a string literal, @@ -68,12 +67,11 @@ else { c = boolOrC; // C } -// Narrowing occurs only if target type is a subtype of variable type if (typeof strOrNumOrBool !== "Object") { - var q1: string | number | boolean = strOrNumOrBool; // string | number | boolean + let q1: string | number | boolean = strOrNumOrBool; // string | number | boolean } else { - var q2: string | number | boolean = strOrNumOrBool; // string | number | boolean + let q2: {} = strOrNumOrBool; // {} } @@ -118,9 +116,8 @@ if (typeof boolOrC === "Object") { else { var r4 = boolOrC; // boolean } -// Narrowing occurs only if target type is a subtype of variable type if (typeof strOrNumOrBool === "Object") { - var q1 = strOrNumOrBool; // string | number | boolean + var q1 = strOrNumOrBool; // {} } else { var q2 = strOrNumOrBool; // string | number | boolean @@ -146,10 +143,9 @@ if (typeof boolOrC !== "Object") { else { c = boolOrC; // C } -// Narrowing occurs only if target type is a subtype of variable type if (typeof strOrNumOrBool !== "Object") { var q1 = strOrNumOrBool; // string | number | boolean } else { - var q2 = strOrNumOrBool; // string | number | boolean + var q2 = strOrNumOrBool; // {} } diff --git a/tests/baselines/reference/typeGuardOfFormTypeOfOther.symbols b/tests/baselines/reference/typeGuardOfFormTypeOfOther.symbols index eb120d468dc..a8760feda45 100644 --- a/tests/baselines/reference/typeGuardOfFormTypeOfOther.symbols +++ b/tests/baselines/reference/typeGuardOfFormTypeOfOther.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfOther.ts === class C { private p: string }; >C : Symbol(C, Decl(typeGuardOfFormTypeOfOther.ts, 0, 0)) ->p : Symbol(p, Decl(typeGuardOfFormTypeOfOther.ts, 0, 9)) +>p : Symbol(C.p, Decl(typeGuardOfFormTypeOfOther.ts, 0, 9)) var str: string; >str : Symbol(str, Decl(typeGuardOfFormTypeOfOther.ts, 2, 3)) @@ -57,7 +57,7 @@ if (typeof strOrC === "Object") { } else { var r2: string = strOrC; // string ->r2 : Symbol(r2, Decl(typeGuardOfFormTypeOfOther.ts, 24, 7), Decl(typeGuardOfFormTypeOfOther.ts, 51, 7)) +>r2 : Symbol(r2, Decl(typeGuardOfFormTypeOfOther.ts, 24, 7), Decl(typeGuardOfFormTypeOfOther.ts, 50, 7)) >strOrC : Symbol(strOrC, Decl(typeGuardOfFormTypeOfOther.ts, 9, 3)) } if (typeof numOrC === "Object") { @@ -69,7 +69,7 @@ if (typeof numOrC === "Object") { } else { var r3: number = numOrC; // number ->r3 : Symbol(r3, Decl(typeGuardOfFormTypeOfOther.ts, 30, 7), Decl(typeGuardOfFormTypeOfOther.ts, 57, 7)) +>r3 : Symbol(r3, Decl(typeGuardOfFormTypeOfOther.ts, 30, 7), Decl(typeGuardOfFormTypeOfOther.ts, 56, 7)) >numOrC : Symbol(numOrC, Decl(typeGuardOfFormTypeOfOther.ts, 10, 3)) } if (typeof boolOrC === "Object") { @@ -81,21 +81,20 @@ if (typeof boolOrC === "Object") { } else { var r4: boolean = boolOrC; // boolean ->r4 : Symbol(r4, Decl(typeGuardOfFormTypeOfOther.ts, 36, 7), Decl(typeGuardOfFormTypeOfOther.ts, 63, 7)) +>r4 : Symbol(r4, Decl(typeGuardOfFormTypeOfOther.ts, 36, 7), Decl(typeGuardOfFormTypeOfOther.ts, 62, 7)) >boolOrC : Symbol(boolOrC, Decl(typeGuardOfFormTypeOfOther.ts, 11, 3)) } -// Narrowing occurs only if target type is a subtype of variable type if (typeof strOrNumOrBool === "Object") { >strOrNumOrBool : Symbol(strOrNumOrBool, Decl(typeGuardOfFormTypeOfOther.ts, 8, 3)) - var q1: string | number | boolean = strOrNumOrBool; // string | number | boolean ->q1 : Symbol(q1, Decl(typeGuardOfFormTypeOfOther.ts, 41, 7), Decl(typeGuardOfFormTypeOfOther.ts, 71, 7)) + let q1: {} = strOrNumOrBool; // {} +>q1 : Symbol(q1, Decl(typeGuardOfFormTypeOfOther.ts, 40, 7)) >strOrNumOrBool : Symbol(strOrNumOrBool, Decl(typeGuardOfFormTypeOfOther.ts, 8, 3)) } else { - var q2: string | number | boolean = strOrNumOrBool; // string | number | boolean ->q2 : Symbol(q2, Decl(typeGuardOfFormTypeOfOther.ts, 44, 7), Decl(typeGuardOfFormTypeOfOther.ts, 74, 7)) + let q2: string | number | boolean = strOrNumOrBool; // string | number | boolean +>q2 : Symbol(q2, Decl(typeGuardOfFormTypeOfOther.ts, 43, 7)) >strOrNumOrBool : Symbol(strOrNumOrBool, Decl(typeGuardOfFormTypeOfOther.ts, 8, 3)) } @@ -106,7 +105,7 @@ if (typeof strOrC !== "Object") { >strOrC : Symbol(strOrC, Decl(typeGuardOfFormTypeOfOther.ts, 9, 3)) var r2: string = strOrC; // string ->r2 : Symbol(r2, Decl(typeGuardOfFormTypeOfOther.ts, 24, 7), Decl(typeGuardOfFormTypeOfOther.ts, 51, 7)) +>r2 : Symbol(r2, Decl(typeGuardOfFormTypeOfOther.ts, 24, 7), Decl(typeGuardOfFormTypeOfOther.ts, 50, 7)) >strOrC : Symbol(strOrC, Decl(typeGuardOfFormTypeOfOther.ts, 9, 3)) } else { @@ -118,7 +117,7 @@ if (typeof numOrC !== "Object") { >numOrC : Symbol(numOrC, Decl(typeGuardOfFormTypeOfOther.ts, 10, 3)) var r3: number = numOrC; // number ->r3 : Symbol(r3, Decl(typeGuardOfFormTypeOfOther.ts, 30, 7), Decl(typeGuardOfFormTypeOfOther.ts, 57, 7)) +>r3 : Symbol(r3, Decl(typeGuardOfFormTypeOfOther.ts, 30, 7), Decl(typeGuardOfFormTypeOfOther.ts, 56, 7)) >numOrC : Symbol(numOrC, Decl(typeGuardOfFormTypeOfOther.ts, 10, 3)) } else { @@ -130,7 +129,7 @@ if (typeof boolOrC !== "Object") { >boolOrC : Symbol(boolOrC, Decl(typeGuardOfFormTypeOfOther.ts, 11, 3)) var r4: boolean = boolOrC; // boolean ->r4 : Symbol(r4, Decl(typeGuardOfFormTypeOfOther.ts, 36, 7), Decl(typeGuardOfFormTypeOfOther.ts, 63, 7)) +>r4 : Symbol(r4, Decl(typeGuardOfFormTypeOfOther.ts, 36, 7), Decl(typeGuardOfFormTypeOfOther.ts, 62, 7)) >boolOrC : Symbol(boolOrC, Decl(typeGuardOfFormTypeOfOther.ts, 11, 3)) } else { @@ -139,17 +138,16 @@ else { >boolOrC : Symbol(boolOrC, Decl(typeGuardOfFormTypeOfOther.ts, 11, 3)) } -// Narrowing occurs only if target type is a subtype of variable type if (typeof strOrNumOrBool !== "Object") { >strOrNumOrBool : Symbol(strOrNumOrBool, Decl(typeGuardOfFormTypeOfOther.ts, 8, 3)) - var q1: string | number | boolean = strOrNumOrBool; // string | number | boolean ->q1 : Symbol(q1, Decl(typeGuardOfFormTypeOfOther.ts, 41, 7), Decl(typeGuardOfFormTypeOfOther.ts, 71, 7)) + let q1: string | number | boolean = strOrNumOrBool; // string | number | boolean +>q1 : Symbol(q1, Decl(typeGuardOfFormTypeOfOther.ts, 69, 7)) >strOrNumOrBool : Symbol(strOrNumOrBool, Decl(typeGuardOfFormTypeOfOther.ts, 8, 3)) } else { - var q2: string | number | boolean = strOrNumOrBool; // string | number | boolean ->q2 : Symbol(q2, Decl(typeGuardOfFormTypeOfOther.ts, 44, 7), Decl(typeGuardOfFormTypeOfOther.ts, 74, 7)) + let q2: {} = strOrNumOrBool; // {} +>q2 : Symbol(q2, Decl(typeGuardOfFormTypeOfOther.ts, 72, 7)) >strOrNumOrBool : Symbol(strOrNumOrBool, Decl(typeGuardOfFormTypeOfOther.ts, 8, 3)) } diff --git a/tests/baselines/reference/typeGuardOfFormTypeOfOther.types b/tests/baselines/reference/typeGuardOfFormTypeOfOther.types index 5cec3567194..8e42a8e0d8e 100644 --- a/tests/baselines/reference/typeGuardOfFormTypeOfOther.types +++ b/tests/baselines/reference/typeGuardOfFormTypeOfOther.types @@ -97,19 +97,18 @@ else { >boolOrC : boolean } -// Narrowing occurs only if target type is a subtype of variable type if (typeof strOrNumOrBool === "Object") { >typeof strOrNumOrBool === "Object" : boolean >typeof strOrNumOrBool : string >strOrNumOrBool : string | number | boolean >"Object" : string - var q1: string | number | boolean = strOrNumOrBool; // string | number | boolean ->q1 : string | number | boolean ->strOrNumOrBool : string | number | boolean + let q1: {} = strOrNumOrBool; // {} +>q1 : {} +>strOrNumOrBool : never } else { - var q2: string | number | boolean = strOrNumOrBool; // string | number | boolean + let q2: string | number | boolean = strOrNumOrBool; // string | number | boolean >q2 : string | number | boolean >strOrNumOrBool : string | number | boolean } @@ -120,7 +119,7 @@ else { if (typeof strOrC !== "Object") { >typeof strOrC !== "Object" : boolean >typeof strOrC : string ->strOrC : string | C +>strOrC : C | string >"Object" : string var r2: string = strOrC; // string @@ -136,7 +135,7 @@ else { if (typeof numOrC !== "Object") { >typeof numOrC !== "Object" : boolean >typeof numOrC : string ->numOrC : number | C +>numOrC : C | number >"Object" : string var r3: number = numOrC; // number @@ -152,7 +151,7 @@ else { if (typeof boolOrC !== "Object") { >typeof boolOrC !== "Object" : boolean >typeof boolOrC : string ->boolOrC : boolean | C +>boolOrC : C | boolean >"Object" : string var r4: boolean = boolOrC; // boolean @@ -166,20 +165,19 @@ else { >boolOrC : C } -// Narrowing occurs only if target type is a subtype of variable type if (typeof strOrNumOrBool !== "Object") { >typeof strOrNumOrBool !== "Object" : boolean >typeof strOrNumOrBool : string >strOrNumOrBool : string | number | boolean >"Object" : string - var q1: string | number | boolean = strOrNumOrBool; // string | number | boolean + let q1: string | number | boolean = strOrNumOrBool; // string | number | boolean >q1 : string | number | boolean >strOrNumOrBool : string | number | boolean } else { - var q2: string | number | boolean = strOrNumOrBool; // string | number | boolean ->q2 : string | number | boolean ->strOrNumOrBool : string | number | boolean + let q2: {} = strOrNumOrBool; // {} +>q2 : {} +>strOrNumOrBool : never } diff --git a/tests/baselines/reference/typeGuardOfFormTypeOfPrimitiveSubtype.js b/tests/baselines/reference/typeGuardOfFormTypeOfPrimitiveSubtype.js new file mode 100644 index 00000000000..0bd03890179 --- /dev/null +++ b/tests/baselines/reference/typeGuardOfFormTypeOfPrimitiveSubtype.js @@ -0,0 +1,45 @@ +//// [typeGuardOfFormTypeOfPrimitiveSubtype.ts] +let a: {}; +let b: {toString(): string}; +if (typeof a === "number") { + let c: number = a; +} +if (typeof a === "string") { + let c: string = a; +} +if (typeof a === "boolean") { + let c: boolean = a; +} + +if (typeof b === "number") { + let c: number = b; +} +if (typeof b === "string") { + let c: string = b; +} +if (typeof b === "boolean") { + let c: boolean = b; +} + + +//// [typeGuardOfFormTypeOfPrimitiveSubtype.js] +var a; +var b; +if (typeof a === "number") { + var c = a; +} +if (typeof a === "string") { + var c = a; +} +if (typeof a === "boolean") { + var c = a; +} +if (typeof b === "number") { + var c = b; +} +if (typeof b === "string") { + var c = b; +} +if (typeof b === "boolean") { + var c = b; +} diff --git a/tests/baselines/reference/typeGuardOfFormTypeOfPrimitiveSubtype.symbols b/tests/baselines/reference/typeGuardOfFormTypeOfPrimitiveSubtype.symbols new file mode 100644 index 00000000000..da962b6060f --- /dev/null +++ b/tests/baselines/reference/typeGuardOfFormTypeOfPrimitiveSubtype.symbols @@ -0,0 +1,52 @@ +=== tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfPrimitiveSubtype.ts === +let a: {}; +>a : Symbol(a, Decl(typeGuardOfFormTypeOfPrimitiveSubtype.ts, 0, 3)) + +let b: {toString(): string}; +>b : Symbol(b, Decl(typeGuardOfFormTypeOfPrimitiveSubtype.ts, 1, 3)) +>toString : Symbol(toString, Decl(typeGuardOfFormTypeOfPrimitiveSubtype.ts, 1, 8)) + +if (typeof a === "number") { +>a : Symbol(a, Decl(typeGuardOfFormTypeOfPrimitiveSubtype.ts, 0, 3)) + + let c: number = a; +>c : Symbol(c, Decl(typeGuardOfFormTypeOfPrimitiveSubtype.ts, 3, 7)) +>a : Symbol(a, Decl(typeGuardOfFormTypeOfPrimitiveSubtype.ts, 0, 3)) +} +if (typeof a === "string") { +>a : Symbol(a, Decl(typeGuardOfFormTypeOfPrimitiveSubtype.ts, 0, 3)) + + let c: string = a; +>c : Symbol(c, Decl(typeGuardOfFormTypeOfPrimitiveSubtype.ts, 6, 7)) +>a : Symbol(a, Decl(typeGuardOfFormTypeOfPrimitiveSubtype.ts, 0, 3)) +} +if (typeof a === "boolean") { +>a : Symbol(a, Decl(typeGuardOfFormTypeOfPrimitiveSubtype.ts, 0, 3)) + + let c: boolean = a; +>c : Symbol(c, Decl(typeGuardOfFormTypeOfPrimitiveSubtype.ts, 9, 7)) +>a : Symbol(a, Decl(typeGuardOfFormTypeOfPrimitiveSubtype.ts, 0, 3)) +} + +if (typeof b === "number") { +>b : Symbol(b, Decl(typeGuardOfFormTypeOfPrimitiveSubtype.ts, 1, 3)) + + let c: number = b; +>c : Symbol(c, Decl(typeGuardOfFormTypeOfPrimitiveSubtype.ts, 13, 7)) +>b : Symbol(b, Decl(typeGuardOfFormTypeOfPrimitiveSubtype.ts, 1, 3)) +} +if (typeof b === "string") { +>b : Symbol(b, Decl(typeGuardOfFormTypeOfPrimitiveSubtype.ts, 1, 3)) + + let c: string = b; +>c : Symbol(c, Decl(typeGuardOfFormTypeOfPrimitiveSubtype.ts, 16, 7)) +>b : Symbol(b, Decl(typeGuardOfFormTypeOfPrimitiveSubtype.ts, 1, 3)) +} +if (typeof b === "boolean") { +>b : Symbol(b, Decl(typeGuardOfFormTypeOfPrimitiveSubtype.ts, 1, 3)) + + let c: boolean = b; +>c : Symbol(c, Decl(typeGuardOfFormTypeOfPrimitiveSubtype.ts, 19, 7)) +>b : Symbol(b, Decl(typeGuardOfFormTypeOfPrimitiveSubtype.ts, 1, 3)) +} + diff --git a/tests/baselines/reference/typeGuardOfFormTypeOfPrimitiveSubtype.types b/tests/baselines/reference/typeGuardOfFormTypeOfPrimitiveSubtype.types new file mode 100644 index 00000000000..7e88ca5cb94 --- /dev/null +++ b/tests/baselines/reference/typeGuardOfFormTypeOfPrimitiveSubtype.types @@ -0,0 +1,70 @@ +=== tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfPrimitiveSubtype.ts === +let a: {}; +>a : {} + +let b: {toString(): string}; +>b : { toString(): string; } +>toString : () => string + +if (typeof a === "number") { +>typeof a === "number" : boolean +>typeof a : string +>a : {} +>"number" : string + + let c: number = a; +>c : number +>a : number +} +if (typeof a === "string") { +>typeof a === "string" : boolean +>typeof a : string +>a : {} +>"string" : string + + let c: string = a; +>c : string +>a : string +} +if (typeof a === "boolean") { +>typeof a === "boolean" : boolean +>typeof a : string +>a : {} +>"boolean" : string + + let c: boolean = a; +>c : boolean +>a : boolean +} + +if (typeof b === "number") { +>typeof b === "number" : boolean +>typeof b : string +>b : { toString(): string; } +>"number" : string + + let c: number = b; +>c : number +>b : number +} +if (typeof b === "string") { +>typeof b === "string" : boolean +>typeof b : string +>b : { toString(): string; } +>"string" : string + + let c: string = b; +>c : string +>b : string +} +if (typeof b === "boolean") { +>typeof b === "boolean" : boolean +>typeof b : string +>b : { toString(): string; } +>"boolean" : string + + let c: boolean = b; +>c : boolean +>b : boolean +} + diff --git a/tests/baselines/reference/typeGuardOfFormTypeOfString.js b/tests/baselines/reference/typeGuardOfFormTypeOfString.js index 5626396f73d..d79f73a87c5 100644 --- a/tests/baselines/reference/typeGuardOfFormTypeOfString.js +++ b/tests/baselines/reference/typeGuardOfFormTypeOfString.js @@ -42,12 +42,11 @@ else { c = strOrC; // C } -// Narrowing occurs only if target type is a subtype of variable type if (typeof numOrBool === "string") { - var x1: number | boolean = numOrBool; // number | boolean + let x1: {} = numOrBool; // {} } else { - var x2: number | boolean = numOrBool; // number | boolean + let x2: number | boolean = numOrBool; // number | boolean } // A type guard of the form typeof x !== s, where s is a string literal, @@ -78,12 +77,11 @@ else { str = strOrC; // string } -// Narrowing occurs only if target type is a subtype of variable type if (typeof numOrBool !== "string") { - var x1: number | boolean = numOrBool; // number | boolean + let x1: number | boolean = numOrBool; // number | boolean } else { - var x2: number | boolean = numOrBool; // number | boolean + let x2: {} = numOrBool; // {} } @@ -133,9 +131,8 @@ if (typeof strOrC === "string") { else { c = strOrC; // C } -// Narrowing occurs only if target type is a subtype of variable type if (typeof numOrBool === "string") { - var x1 = numOrBool; // number | boolean + var x1 = numOrBool; // {} } else { var x2 = numOrBool; // number | boolean @@ -167,10 +164,9 @@ if (typeof strOrC !== "string") { else { str = strOrC; // string } -// Narrowing occurs only if target type is a subtype of variable type if (typeof numOrBool !== "string") { var x1 = numOrBool; // number | boolean } else { - var x2 = numOrBool; // number | boolean + var x2 = numOrBool; // {} } diff --git a/tests/baselines/reference/typeGuardOfFormTypeOfString.symbols b/tests/baselines/reference/typeGuardOfFormTypeOfString.symbols index 54684f715a4..4a77ecb1ffb 100644 --- a/tests/baselines/reference/typeGuardOfFormTypeOfString.symbols +++ b/tests/baselines/reference/typeGuardOfFormTypeOfString.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfString.ts === class C { private p: string }; >C : Symbol(C, Decl(typeGuardOfFormTypeOfString.ts, 0, 0)) ->p : Symbol(p, Decl(typeGuardOfFormTypeOfString.ts, 0, 9)) +>p : Symbol(C.p, Decl(typeGuardOfFormTypeOfString.ts, 0, 9)) var str: string; >str : Symbol(str, Decl(typeGuardOfFormTypeOfString.ts, 2, 3)) @@ -93,17 +93,16 @@ else { >strOrC : Symbol(strOrC, Decl(typeGuardOfFormTypeOfString.ts, 9, 3)) } -// Narrowing occurs only if target type is a subtype of variable type if (typeof numOrBool === "string") { >numOrBool : Symbol(numOrBool, Decl(typeGuardOfFormTypeOfString.ts, 7, 3)) - var x1: number | boolean = numOrBool; // number | boolean ->x1 : Symbol(x1, Decl(typeGuardOfFormTypeOfString.ts, 45, 7), Decl(typeGuardOfFormTypeOfString.ts, 81, 7)) + let x1: {} = numOrBool; // {} +>x1 : Symbol(x1, Decl(typeGuardOfFormTypeOfString.ts, 44, 7)) >numOrBool : Symbol(numOrBool, Decl(typeGuardOfFormTypeOfString.ts, 7, 3)) } else { - var x2: number | boolean = numOrBool; // number | boolean ->x2 : Symbol(x2, Decl(typeGuardOfFormTypeOfString.ts, 48, 7), Decl(typeGuardOfFormTypeOfString.ts, 84, 7)) + let x2: number | boolean = numOrBool; // number | boolean +>x2 : Symbol(x2, Decl(typeGuardOfFormTypeOfString.ts, 47, 7)) >numOrBool : Symbol(numOrBool, Decl(typeGuardOfFormTypeOfString.ts, 7, 3)) } @@ -159,17 +158,16 @@ else { >strOrC : Symbol(strOrC, Decl(typeGuardOfFormTypeOfString.ts, 9, 3)) } -// Narrowing occurs only if target type is a subtype of variable type if (typeof numOrBool !== "string") { >numOrBool : Symbol(numOrBool, Decl(typeGuardOfFormTypeOfString.ts, 7, 3)) - var x1: number | boolean = numOrBool; // number | boolean ->x1 : Symbol(x1, Decl(typeGuardOfFormTypeOfString.ts, 45, 7), Decl(typeGuardOfFormTypeOfString.ts, 81, 7)) + let x1: number | boolean = numOrBool; // number | boolean +>x1 : Symbol(x1, Decl(typeGuardOfFormTypeOfString.ts, 79, 7)) >numOrBool : Symbol(numOrBool, Decl(typeGuardOfFormTypeOfString.ts, 7, 3)) } else { - var x2: number | boolean = numOrBool; // number | boolean ->x2 : Symbol(x2, Decl(typeGuardOfFormTypeOfString.ts, 48, 7), Decl(typeGuardOfFormTypeOfString.ts, 84, 7)) + let x2: {} = numOrBool; // {} +>x2 : Symbol(x2, Decl(typeGuardOfFormTypeOfString.ts, 82, 7)) >numOrBool : Symbol(numOrBool, Decl(typeGuardOfFormTypeOfString.ts, 7, 3)) } diff --git a/tests/baselines/reference/typeGuardOfFormTypeOfString.types b/tests/baselines/reference/typeGuardOfFormTypeOfString.types index d6a382261ac..971109215f7 100644 --- a/tests/baselines/reference/typeGuardOfFormTypeOfString.types +++ b/tests/baselines/reference/typeGuardOfFormTypeOfString.types @@ -113,19 +113,18 @@ else { >strOrC : C } -// Narrowing occurs only if target type is a subtype of variable type if (typeof numOrBool === "string") { >typeof numOrBool === "string" : boolean >typeof numOrBool : string >numOrBool : number | boolean >"string" : string - var x1: number | boolean = numOrBool; // number | boolean ->x1 : number | boolean ->numOrBool : number | boolean + let x1: {} = numOrBool; // {} +>x1 : {} +>numOrBool : never } else { - var x2: number | boolean = numOrBool; // number | boolean + let x2: number | boolean = numOrBool; // number | boolean >x2 : number | boolean >numOrBool : number | boolean } @@ -202,20 +201,19 @@ else { >strOrC : string } -// Narrowing occurs only if target type is a subtype of variable type if (typeof numOrBool !== "string") { >typeof numOrBool !== "string" : boolean >typeof numOrBool : string >numOrBool : number | boolean >"string" : string - var x1: number | boolean = numOrBool; // number | boolean + let x1: number | boolean = numOrBool; // number | boolean >x1 : number | boolean >numOrBool : number | boolean } else { - var x2: number | boolean = numOrBool; // number | boolean ->x2 : number | boolean ->numOrBool : number | boolean + let x2: {} = numOrBool; // {} +>x2 : {} +>numOrBool : never } diff --git a/tests/baselines/reference/typeGuardRedundancy.types b/tests/baselines/reference/typeGuardRedundancy.types index 1507ceb850e..754019de7ed 100644 --- a/tests/baselines/reference/typeGuardRedundancy.types +++ b/tests/baselines/reference/typeGuardRedundancy.types @@ -48,7 +48,7 @@ var r3 = typeof x === "string" || typeof x === "string" ? x.substr : x.toFixed; >typeof x === "string" || typeof x === "string" : boolean >typeof x === "string" : boolean >typeof x : string ->x : string | number +>x : number | string >"string" : string >typeof x === "string" : boolean >typeof x : string diff --git a/tests/baselines/reference/typeGuardTautologicalConsistiency.types b/tests/baselines/reference/typeGuardTautologicalConsistiency.types index d758dcde22b..8e681deb073 100644 --- a/tests/baselines/reference/typeGuardTautologicalConsistiency.types +++ b/tests/baselines/reference/typeGuardTautologicalConsistiency.types @@ -15,7 +15,7 @@ if (typeof stringOrNumber === "number") { >"number" : string stringOrNumber; ->stringOrNumber : string | number +>stringOrNumber : string } } @@ -31,6 +31,6 @@ if (typeof stringOrNumber === "number" && typeof stringOrNumber !== "number") { >"number" : string stringOrNumber; ->stringOrNumber : string | number +>stringOrNumber : string } diff --git a/tests/baselines/reference/typeGuardTypeOfUndefined.types b/tests/baselines/reference/typeGuardTypeOfUndefined.types index 6cf57e1a1dd..167d6204a98 100644 --- a/tests/baselines/reference/typeGuardTypeOfUndefined.types +++ b/tests/baselines/reference/typeGuardTypeOfUndefined.types @@ -26,7 +26,7 @@ function test1(a: any) { } else { a; ->a : any +>a : undefined } } @@ -43,7 +43,7 @@ function test2(a: any) { if (typeof a === "boolean") { >typeof a === "boolean" : boolean >typeof a : string ->a : any +>a : undefined >"boolean" : string a; @@ -51,7 +51,7 @@ function test2(a: any) { } else { a; ->a : any +>a : undefined } } else { @@ -76,7 +76,7 @@ function test3(a: any) { >"boolean" : string a; ->a : any +>a : boolean } else { a; @@ -121,7 +121,7 @@ function test5(a: boolean | void) { if (typeof a === "boolean") { >typeof a === "boolean" : boolean >typeof a : string ->a : boolean | void +>a : boolean >"boolean" : string a; @@ -164,7 +164,7 @@ function test6(a: boolean | void) { } else { a; ->a : boolean | void +>a : boolean } } @@ -180,7 +180,7 @@ function test7(a: boolean | void) { >"undefined" : string >typeof a === "boolean" : boolean >typeof a : string ->a : boolean | void +>a : boolean >"boolean" : string a; @@ -204,7 +204,7 @@ function test8(a: boolean | void) { >"undefined" : string >typeof a === "boolean" : boolean >typeof a : string ->a : boolean | void +>a : boolean >"boolean" : string a; @@ -337,7 +337,7 @@ function test13(a: boolean | number | void) { if (typeof a === "boolean") { >typeof a === "boolean" : boolean >typeof a : string ->a : boolean | number | void +>a : boolean | number >"boolean" : string a; @@ -345,7 +345,7 @@ function test13(a: boolean | number | void) { } else { a; ->a : number | void +>a : number } } else { @@ -380,7 +380,7 @@ function test14(a: boolean | number | void) { } else { a; ->a : boolean | number | void +>a : boolean | number } } @@ -396,7 +396,7 @@ function test15(a: boolean | number | void) { >"undefined" : string >typeof a === "boolean" : boolean >typeof a : string ->a : boolean | number | void +>a : boolean | number >"boolean" : string a; @@ -404,7 +404,7 @@ function test15(a: boolean | number | void) { } else { a; ->a : number | void +>a : number } } @@ -420,7 +420,7 @@ function test16(a: boolean | number | void) { >"undefined" : string >typeof a === "boolean" : boolean >typeof a : string ->a : boolean | number | void +>a : boolean | number >"boolean" : string a; diff --git a/tests/baselines/reference/typeGuardsAsAssertions.js b/tests/baselines/reference/typeGuardsAsAssertions.js new file mode 100644 index 00000000000..84fc996c3ab --- /dev/null +++ b/tests/baselines/reference/typeGuardsAsAssertions.js @@ -0,0 +1,229 @@ +//// [typeGuardsAsAssertions.ts] + +// Repro from #8513 + +let cond: boolean; + +export type Optional = Some | None; + +export interface None { readonly none: string; } +export interface Some { readonly some: a; } + +export const none : None = { none: '' }; + +export function isSome(value: Optional): value is Some { + return 'some' in value; +} + +function someFrom(some: a) { + return { some }; +} + +export function fn(makeSome: () => r): void { + let result: Optional = none; + result; // None + while (cond) { + result; // Some | None + result = someFrom(isSome(result) ? result.some : makeSome()); + result; // Some + } +} + +function foo1() { + let x: string | number | boolean = 0; + x; // number + while (cond) { + x; // number, then string | number + x = typeof x === "string" ? x.slice() : "abc"; + x; // string + } + x; +} + +function foo2() { + let x: string | number | boolean = 0; + x; // number + while (cond) { + x; // number, then string | number + if (typeof x === "string") { + x = x.slice(); + } + else { + x = "abc"; + } + x; // string + } + x; +} + +// Type guards as assertions + +function f1() { + let x: string | number | undefined = undefined; + x; // undefined + if (x) { + x; // string | number (guard as assertion) + } + x; // string | number | undefined +} + +function f2() { + let x: string | number | undefined = undefined; + x; // undefined + if (typeof x === "string") { + x; // string (guard as assertion) + } + x; // string | undefined +} + +function f3() { + let x: string | number | undefined = undefined; + x; // undefined + if (!x) { + return; + } + x; // string | number (guard as assertion) +} + +function f4() { + let x: string | number | undefined = undefined; + x; // undefined + if (typeof x === "boolean") { + x; // nothing (boolean not in declared type) + } + x; // undefined +} + +function f5(x: string | number) { + if (typeof x === "string" && typeof x === "number") { + x; // number (guard as assertion) + } + else { + x; // string | number + } + x; // string | number +} + +function f6() { + let x: string | undefined | null; + x!.slice(); + x = ""; + x!.slice(); + x = undefined; + x!.slice(); + x = null; + x!.slice(); + x = undefined; + x!.slice(); + x = ""; + x!.slice(); + x = ""; + x!.slice(); +} + + +//// [typeGuardsAsAssertions.js] +// Repro from #8513 +"use strict"; +var cond; +exports.none = { none: '' }; +function isSome(value) { + return 'some' in value; +} +exports.isSome = isSome; +function someFrom(some) { + return { some: some }; +} +function fn(makeSome) { + var result = exports.none; + result; // None + while (cond) { + result; // Some | None + result = someFrom(isSome(result) ? result.some : makeSome()); + result; // Some + } +} +exports.fn = fn; +function foo1() { + var x = 0; + x; // number + while (cond) { + x; // number, then string | number + x = typeof x === "string" ? x.slice() : "abc"; + x; // string + } + x; +} +function foo2() { + var x = 0; + x; // number + while (cond) { + x; // number, then string | number + if (typeof x === "string") { + x = x.slice(); + } + else { + x = "abc"; + } + x; // string + } + x; +} +// Type guards as assertions +function f1() { + var x = undefined; + x; // undefined + if (x) { + x; // string | number (guard as assertion) + } + x; // string | number | undefined +} +function f2() { + var x = undefined; + x; // undefined + if (typeof x === "string") { + x; // string (guard as assertion) + } + x; // string | undefined +} +function f3() { + var x = undefined; + x; // undefined + if (!x) { + return; + } + x; // string | number (guard as assertion) +} +function f4() { + var x = undefined; + x; // undefined + if (typeof x === "boolean") { + x; // nothing (boolean not in declared type) + } + x; // undefined +} +function f5(x) { + if (typeof x === "string" && typeof x === "number") { + x; // number (guard as assertion) + } + else { + x; // string | number + } + x; // string | number +} +function f6() { + var x; + x.slice(); + x = ""; + x.slice(); + x = undefined; + x.slice(); + x = null; + x.slice(); + x = undefined; + x.slice(); + x = ""; + x.slice(); + x = ""; + x.slice(); +} diff --git a/tests/baselines/reference/typeGuardsAsAssertions.symbols b/tests/baselines/reference/typeGuardsAsAssertions.symbols new file mode 100644 index 00000000000..5079f3b8cb4 --- /dev/null +++ b/tests/baselines/reference/typeGuardsAsAssertions.symbols @@ -0,0 +1,315 @@ +=== tests/cases/conformance/controlFlow/typeGuardsAsAssertions.ts === + +// Repro from #8513 + +let cond: boolean; +>cond : Symbol(cond, Decl(typeGuardsAsAssertions.ts, 3, 3)) + +export type Optional = Some | None; +>Optional : Symbol(Optional, Decl(typeGuardsAsAssertions.ts, 3, 18)) +>a : Symbol(a, Decl(typeGuardsAsAssertions.ts, 5, 21)) +>Some : Symbol(Some, Decl(typeGuardsAsAssertions.ts, 7, 48)) +>a : Symbol(a, Decl(typeGuardsAsAssertions.ts, 5, 21)) +>None : Symbol(None, Decl(typeGuardsAsAssertions.ts, 5, 41)) + +export interface None { readonly none: string; } +>None : Symbol(None, Decl(typeGuardsAsAssertions.ts, 5, 41)) +>none : Symbol(None.none, Decl(typeGuardsAsAssertions.ts, 7, 23)) + +export interface Some { readonly some: a; } +>Some : Symbol(Some, Decl(typeGuardsAsAssertions.ts, 7, 48)) +>a : Symbol(a, Decl(typeGuardsAsAssertions.ts, 8, 22)) +>some : Symbol(Some.some, Decl(typeGuardsAsAssertions.ts, 8, 26)) +>a : Symbol(a, Decl(typeGuardsAsAssertions.ts, 8, 22)) + +export const none : None = { none: '' }; +>none : Symbol(none, Decl(typeGuardsAsAssertions.ts, 10, 12)) +>None : Symbol(None, Decl(typeGuardsAsAssertions.ts, 5, 41)) +>none : Symbol(none, Decl(typeGuardsAsAssertions.ts, 10, 28)) + +export function isSome(value: Optional): value is Some { +>isSome : Symbol(isSome, Decl(typeGuardsAsAssertions.ts, 10, 40)) +>a : Symbol(a, Decl(typeGuardsAsAssertions.ts, 12, 23)) +>value : Symbol(value, Decl(typeGuardsAsAssertions.ts, 12, 26)) +>Optional : Symbol(Optional, Decl(typeGuardsAsAssertions.ts, 3, 18)) +>a : Symbol(a, Decl(typeGuardsAsAssertions.ts, 12, 23)) +>value : Symbol(value, Decl(typeGuardsAsAssertions.ts, 12, 26)) +>Some : Symbol(Some, Decl(typeGuardsAsAssertions.ts, 7, 48)) +>a : Symbol(a, Decl(typeGuardsAsAssertions.ts, 12, 23)) + + return 'some' in value; +>value : Symbol(value, Decl(typeGuardsAsAssertions.ts, 12, 26)) +} + +function someFrom(some: a) { +>someFrom : Symbol(someFrom, Decl(typeGuardsAsAssertions.ts, 14, 1)) +>a : Symbol(a, Decl(typeGuardsAsAssertions.ts, 16, 18)) +>some : Symbol(some, Decl(typeGuardsAsAssertions.ts, 16, 21)) +>a : Symbol(a, Decl(typeGuardsAsAssertions.ts, 16, 18)) + + return { some }; +>some : Symbol(some, Decl(typeGuardsAsAssertions.ts, 17, 12)) +} + +export function fn(makeSome: () => r): void { +>fn : Symbol(fn, Decl(typeGuardsAsAssertions.ts, 18, 1)) +>r : Symbol(r, Decl(typeGuardsAsAssertions.ts, 20, 19)) +>makeSome : Symbol(makeSome, Decl(typeGuardsAsAssertions.ts, 20, 22)) +>r : Symbol(r, Decl(typeGuardsAsAssertions.ts, 20, 19)) + + let result: Optional = none; +>result : Symbol(result, Decl(typeGuardsAsAssertions.ts, 21, 7)) +>Optional : Symbol(Optional, Decl(typeGuardsAsAssertions.ts, 3, 18)) +>r : Symbol(r, Decl(typeGuardsAsAssertions.ts, 20, 19)) +>none : Symbol(none, Decl(typeGuardsAsAssertions.ts, 10, 12)) + + result; // None +>result : Symbol(result, Decl(typeGuardsAsAssertions.ts, 21, 7)) + + while (cond) { +>cond : Symbol(cond, Decl(typeGuardsAsAssertions.ts, 3, 3)) + + result; // Some | None +>result : Symbol(result, Decl(typeGuardsAsAssertions.ts, 21, 7)) + + result = someFrom(isSome(result) ? result.some : makeSome()); +>result : Symbol(result, Decl(typeGuardsAsAssertions.ts, 21, 7)) +>someFrom : Symbol(someFrom, Decl(typeGuardsAsAssertions.ts, 14, 1)) +>isSome : Symbol(isSome, Decl(typeGuardsAsAssertions.ts, 10, 40)) +>result : Symbol(result, Decl(typeGuardsAsAssertions.ts, 21, 7)) +>result.some : Symbol(Some.some, Decl(typeGuardsAsAssertions.ts, 8, 26)) +>result : Symbol(result, Decl(typeGuardsAsAssertions.ts, 21, 7)) +>some : Symbol(Some.some, Decl(typeGuardsAsAssertions.ts, 8, 26)) +>makeSome : Symbol(makeSome, Decl(typeGuardsAsAssertions.ts, 20, 22)) + + result; // Some +>result : Symbol(result, Decl(typeGuardsAsAssertions.ts, 21, 7)) + } +} + +function foo1() { +>foo1 : Symbol(foo1, Decl(typeGuardsAsAssertions.ts, 28, 1)) + + let x: string | number | boolean = 0; +>x : Symbol(x, Decl(typeGuardsAsAssertions.ts, 31, 7)) + + x; // number +>x : Symbol(x, Decl(typeGuardsAsAssertions.ts, 31, 7)) + + while (cond) { +>cond : Symbol(cond, Decl(typeGuardsAsAssertions.ts, 3, 3)) + + x; // number, then string | number +>x : Symbol(x, Decl(typeGuardsAsAssertions.ts, 31, 7)) + + x = typeof x === "string" ? x.slice() : "abc"; +>x : Symbol(x, Decl(typeGuardsAsAssertions.ts, 31, 7)) +>x : Symbol(x, Decl(typeGuardsAsAssertions.ts, 31, 7)) +>x.slice : Symbol(String.slice, Decl(lib.d.ts, --, --)) +>x : Symbol(x, Decl(typeGuardsAsAssertions.ts, 31, 7)) +>slice : Symbol(String.slice, Decl(lib.d.ts, --, --)) + + x; // string +>x : Symbol(x, Decl(typeGuardsAsAssertions.ts, 31, 7)) + } + x; +>x : Symbol(x, Decl(typeGuardsAsAssertions.ts, 31, 7)) +} + +function foo2() { +>foo2 : Symbol(foo2, Decl(typeGuardsAsAssertions.ts, 39, 1)) + + let x: string | number | boolean = 0; +>x : Symbol(x, Decl(typeGuardsAsAssertions.ts, 42, 7)) + + x; // number +>x : Symbol(x, Decl(typeGuardsAsAssertions.ts, 42, 7)) + + while (cond) { +>cond : Symbol(cond, Decl(typeGuardsAsAssertions.ts, 3, 3)) + + x; // number, then string | number +>x : Symbol(x, Decl(typeGuardsAsAssertions.ts, 42, 7)) + + if (typeof x === "string") { +>x : Symbol(x, Decl(typeGuardsAsAssertions.ts, 42, 7)) + + x = x.slice(); +>x : Symbol(x, Decl(typeGuardsAsAssertions.ts, 42, 7)) +>x.slice : Symbol(String.slice, Decl(lib.d.ts, --, --)) +>x : Symbol(x, Decl(typeGuardsAsAssertions.ts, 42, 7)) +>slice : Symbol(String.slice, Decl(lib.d.ts, --, --)) + } + else { + x = "abc"; +>x : Symbol(x, Decl(typeGuardsAsAssertions.ts, 42, 7)) + } + x; // string +>x : Symbol(x, Decl(typeGuardsAsAssertions.ts, 42, 7)) + } + x; +>x : Symbol(x, Decl(typeGuardsAsAssertions.ts, 42, 7)) +} + +// Type guards as assertions + +function f1() { +>f1 : Symbol(f1, Decl(typeGuardsAsAssertions.ts, 55, 1)) + + let x: string | number | undefined = undefined; +>x : Symbol(x, Decl(typeGuardsAsAssertions.ts, 60, 7)) +>undefined : Symbol(undefined) + + x; // undefined +>x : Symbol(x, Decl(typeGuardsAsAssertions.ts, 60, 7)) + + if (x) { +>x : Symbol(x, Decl(typeGuardsAsAssertions.ts, 60, 7)) + + x; // string | number (guard as assertion) +>x : Symbol(x, Decl(typeGuardsAsAssertions.ts, 60, 7)) + } + x; // string | number | undefined +>x : Symbol(x, Decl(typeGuardsAsAssertions.ts, 60, 7)) +} + +function f2() { +>f2 : Symbol(f2, Decl(typeGuardsAsAssertions.ts, 66, 1)) + + let x: string | number | undefined = undefined; +>x : Symbol(x, Decl(typeGuardsAsAssertions.ts, 69, 7)) +>undefined : Symbol(undefined) + + x; // undefined +>x : Symbol(x, Decl(typeGuardsAsAssertions.ts, 69, 7)) + + if (typeof x === "string") { +>x : Symbol(x, Decl(typeGuardsAsAssertions.ts, 69, 7)) + + x; // string (guard as assertion) +>x : Symbol(x, Decl(typeGuardsAsAssertions.ts, 69, 7)) + } + x; // string | undefined +>x : Symbol(x, Decl(typeGuardsAsAssertions.ts, 69, 7)) +} + +function f3() { +>f3 : Symbol(f3, Decl(typeGuardsAsAssertions.ts, 75, 1)) + + let x: string | number | undefined = undefined; +>x : Symbol(x, Decl(typeGuardsAsAssertions.ts, 78, 7)) +>undefined : Symbol(undefined) + + x; // undefined +>x : Symbol(x, Decl(typeGuardsAsAssertions.ts, 78, 7)) + + if (!x) { +>x : Symbol(x, Decl(typeGuardsAsAssertions.ts, 78, 7)) + + return; + } + x; // string | number (guard as assertion) +>x : Symbol(x, Decl(typeGuardsAsAssertions.ts, 78, 7)) +} + +function f4() { +>f4 : Symbol(f4, Decl(typeGuardsAsAssertions.ts, 84, 1)) + + let x: string | number | undefined = undefined; +>x : Symbol(x, Decl(typeGuardsAsAssertions.ts, 87, 7)) +>undefined : Symbol(undefined) + + x; // undefined +>x : Symbol(x, Decl(typeGuardsAsAssertions.ts, 87, 7)) + + if (typeof x === "boolean") { +>x : Symbol(x, Decl(typeGuardsAsAssertions.ts, 87, 7)) + + x; // nothing (boolean not in declared type) +>x : Symbol(x, Decl(typeGuardsAsAssertions.ts, 87, 7)) + } + x; // undefined +>x : Symbol(x, Decl(typeGuardsAsAssertions.ts, 87, 7)) +} + +function f5(x: string | number) { +>f5 : Symbol(f5, Decl(typeGuardsAsAssertions.ts, 93, 1)) +>x : Symbol(x, Decl(typeGuardsAsAssertions.ts, 95, 12)) + + if (typeof x === "string" && typeof x === "number") { +>x : Symbol(x, Decl(typeGuardsAsAssertions.ts, 95, 12)) +>x : Symbol(x, Decl(typeGuardsAsAssertions.ts, 95, 12)) + + x; // number (guard as assertion) +>x : Symbol(x, Decl(typeGuardsAsAssertions.ts, 95, 12)) + } + else { + x; // string | number +>x : Symbol(x, Decl(typeGuardsAsAssertions.ts, 95, 12)) + } + x; // string | number +>x : Symbol(x, Decl(typeGuardsAsAssertions.ts, 95, 12)) +} + +function f6() { +>f6 : Symbol(f6, Decl(typeGuardsAsAssertions.ts, 103, 1)) + + let x: string | undefined | null; +>x : Symbol(x, Decl(typeGuardsAsAssertions.ts, 106, 7)) + + x!.slice(); +>x!.slice : Symbol(String.slice, Decl(lib.d.ts, --, --)) +>x : Symbol(x, Decl(typeGuardsAsAssertions.ts, 106, 7)) +>slice : Symbol(String.slice, Decl(lib.d.ts, --, --)) + + x = ""; +>x : Symbol(x, Decl(typeGuardsAsAssertions.ts, 106, 7)) + + x!.slice(); +>x!.slice : Symbol(String.slice, Decl(lib.d.ts, --, --)) +>x : Symbol(x, Decl(typeGuardsAsAssertions.ts, 106, 7)) +>slice : Symbol(String.slice, Decl(lib.d.ts, --, --)) + + x = undefined; +>x : Symbol(x, Decl(typeGuardsAsAssertions.ts, 106, 7)) +>undefined : Symbol(undefined) + + x!.slice(); +>x!.slice : Symbol(String.slice, Decl(lib.d.ts, --, --)) +>x : Symbol(x, Decl(typeGuardsAsAssertions.ts, 106, 7)) +>slice : Symbol(String.slice, Decl(lib.d.ts, --, --)) + + x = null; +>x : Symbol(x, Decl(typeGuardsAsAssertions.ts, 106, 7)) + + x!.slice(); +>x!.slice : Symbol(String.slice, Decl(lib.d.ts, --, --)) +>x : Symbol(x, Decl(typeGuardsAsAssertions.ts, 106, 7)) +>slice : Symbol(String.slice, Decl(lib.d.ts, --, --)) + + x = undefined; +>x : Symbol(x, Decl(typeGuardsAsAssertions.ts, 106, 7)) +>undefined : Symbol(undefined) + + x!.slice(); +>x!.slice : Symbol(String.slice, Decl(lib.d.ts, --, --)) +>x : Symbol(x, Decl(typeGuardsAsAssertions.ts, 106, 7)) +>slice : Symbol(String.slice, Decl(lib.d.ts, --, --)) + + x = ""; +>x : Symbol(x, Decl(typeGuardsAsAssertions.ts, 106, 7)) + + x!.slice(); +>x!.slice : Symbol(String.slice, Decl(lib.d.ts, --, --)) +>x : Symbol(x, Decl(typeGuardsAsAssertions.ts, 106, 7)) +>slice : Symbol(String.slice, Decl(lib.d.ts, --, --)) + + x = ""; +>x : Symbol(x, Decl(typeGuardsAsAssertions.ts, 106, 7)) + + x!.slice(); +>x!.slice : Symbol(String.slice, Decl(lib.d.ts, --, --)) +>x : Symbol(x, Decl(typeGuardsAsAssertions.ts, 106, 7)) +>slice : Symbol(String.slice, Decl(lib.d.ts, --, --)) +} + diff --git a/tests/baselines/reference/typeGuardsAsAssertions.types b/tests/baselines/reference/typeGuardsAsAssertions.types new file mode 100644 index 00000000000..82e92a72d8d --- /dev/null +++ b/tests/baselines/reference/typeGuardsAsAssertions.types @@ -0,0 +1,385 @@ +=== tests/cases/conformance/controlFlow/typeGuardsAsAssertions.ts === + +// Repro from #8513 + +let cond: boolean; +>cond : boolean + +export type Optional = Some | None; +>Optional : Some | None +>a : a +>Some : Some +>a : a +>None : None + +export interface None { readonly none: string; } +>None : None +>none : string + +export interface Some { readonly some: a; } +>Some : Some +>a : a +>some : a +>a : a + +export const none : None = { none: '' }; +>none : None +>None : None +>{ none: '' } : { none: string; } +>none : string +>'' : string + +export function isSome(value: Optional): value is Some { +>isSome : (value: Some | None) => value is Some +>a : a +>value : Some | None +>Optional : Some | None +>a : a +>value : any +>Some : Some +>a : a + + return 'some' in value; +>'some' in value : boolean +>'some' : string +>value : Some | None +} + +function someFrom(some: a) { +>someFrom : (some: a) => { some: a; } +>a : a +>some : a +>a : a + + return { some }; +>{ some } : { some: a; } +>some : a +} + +export function fn(makeSome: () => r): void { +>fn : (makeSome: () => r) => void +>r : r +>makeSome : () => r +>r : r + + let result: Optional = none; +>result : Some | None +>Optional : Some | None +>r : r +>none : None + + result; // None +>result : None + + while (cond) { +>cond : boolean + + result; // Some | None +>result : None | Some + + result = someFrom(isSome(result) ? result.some : makeSome()); +>result = someFrom(isSome(result) ? result.some : makeSome()) : { some: r; } +>result : Some | None +>someFrom(isSome(result) ? result.some : makeSome()) : { some: r; } +>someFrom : (some: a) => { some: a; } +>isSome(result) ? result.some : makeSome() : r +>isSome(result) : boolean +>isSome : (value: Some | None) => value is Some +>result : None | Some +>result.some : r +>result : Some +>some : r +>makeSome() : r +>makeSome : () => r + + result; // Some +>result : Some + } +} + +function foo1() { +>foo1 : () => void + + let x: string | number | boolean = 0; +>x : string | number | boolean +>0 : number + + x; // number +>x : number + + while (cond) { +>cond : boolean + + x; // number, then string | number +>x : number | string + + x = typeof x === "string" ? x.slice() : "abc"; +>x = typeof x === "string" ? x.slice() : "abc" : string +>x : string | number | boolean +>typeof x === "string" ? x.slice() : "abc" : string +>typeof x === "string" : boolean +>typeof x : string +>x : number | string +>"string" : string +>x.slice() : string +>x.slice : (start?: number | undefined, end?: number | undefined) => string +>x : string +>slice : (start?: number | undefined, end?: number | undefined) => string +>"abc" : string + + x; // string +>x : string + } + x; +>x : number | string +} + +function foo2() { +>foo2 : () => void + + let x: string | number | boolean = 0; +>x : string | number | boolean +>0 : number + + x; // number +>x : number + + while (cond) { +>cond : boolean + + x; // number, then string | number +>x : number | string + + if (typeof x === "string") { +>typeof x === "string" : boolean +>typeof x : string +>x : number | string +>"string" : string + + x = x.slice(); +>x = x.slice() : string +>x : string | number | boolean +>x.slice() : string +>x.slice : (start?: number | undefined, end?: number | undefined) => string +>x : string +>slice : (start?: number | undefined, end?: number | undefined) => string + } + else { + x = "abc"; +>x = "abc" : string +>x : string | number | boolean +>"abc" : string + } + x; // string +>x : string + } + x; +>x : number | string +} + +// Type guards as assertions + +function f1() { +>f1 : () => void + + let x: string | number | undefined = undefined; +>x : string | number | undefined +>undefined : undefined + + x; // undefined +>x : undefined + + if (x) { +>x : undefined + + x; // string | number (guard as assertion) +>x : string | number + } + x; // string | number | undefined +>x : string | number | undefined +} + +function f2() { +>f2 : () => void + + let x: string | number | undefined = undefined; +>x : string | number | undefined +>undefined : undefined + + x; // undefined +>x : undefined + + if (typeof x === "string") { +>typeof x === "string" : boolean +>typeof x : string +>x : undefined +>"string" : string + + x; // string (guard as assertion) +>x : string + } + x; // string | undefined +>x : string | undefined +} + +function f3() { +>f3 : () => void + + let x: string | number | undefined = undefined; +>x : string | number | undefined +>undefined : undefined + + x; // undefined +>x : undefined + + if (!x) { +>!x : boolean +>x : undefined + + return; + } + x; // string | number (guard as assertion) +>x : string | number +} + +function f4() { +>f4 : () => void + + let x: string | number | undefined = undefined; +>x : string | number | undefined +>undefined : undefined + + x; // undefined +>x : undefined + + if (typeof x === "boolean") { +>typeof x === "boolean" : boolean +>typeof x : string +>x : undefined +>"boolean" : string + + x; // nothing (boolean not in declared type) +>x : never + } + x; // undefined +>x : undefined +} + +function f5(x: string | number) { +>f5 : (x: string | number) => void +>x : string | number + + if (typeof x === "string" && typeof x === "number") { +>typeof x === "string" && typeof x === "number" : boolean +>typeof x === "string" : boolean +>typeof x : string +>x : string | number +>"string" : string +>typeof x === "number" : boolean +>typeof x : string +>x : string +>"number" : string + + x; // number (guard as assertion) +>x : number + } + else { + x; // string | number +>x : number | string + } + x; // string | number +>x : number | string +} + +function f6() { +>f6 : () => void + + let x: string | undefined | null; +>x : string | null | undefined +>null : null + + x!.slice(); +>x!.slice() : string +>x!.slice : (start?: number | undefined, end?: number | undefined) => string +>x! : string +>x : string | null | undefined +>slice : (start?: number | undefined, end?: number | undefined) => string + + x = ""; +>x = "" : string +>x : string | null | undefined +>"" : string + + x!.slice(); +>x!.slice() : string +>x!.slice : (start?: number | undefined, end?: number | undefined) => string +>x! : string +>x : string +>slice : (start?: number | undefined, end?: number | undefined) => string + + x = undefined; +>x = undefined : undefined +>x : string | null | undefined +>undefined : undefined + + x!.slice(); +>x!.slice() : string +>x!.slice : (start?: number | undefined, end?: number | undefined) => string +>x! : string +>x : string | null | undefined +>slice : (start?: number | undefined, end?: number | undefined) => string + + x = null; +>x = null : null +>x : string | null | undefined +>null : null + + x!.slice(); +>x!.slice() : string +>x!.slice : (start?: number | undefined, end?: number | undefined) => string +>x! : string +>x : string | null | undefined +>slice : (start?: number | undefined, end?: number | undefined) => string + + x = undefined; +>x = undefined : null | undefined +>x : string | null | undefined +>undefined : null | undefined +>null : null +>undefined : undefined + + x!.slice(); +>x!.slice() : string +>x!.slice : (start?: number | undefined, end?: number | undefined) => string +>x! : string +>x : string | null | undefined +>slice : (start?: number | undefined, end?: number | undefined) => string + + x = ""; +>x = "" : string | undefined +>x : string | null | undefined +>"" : string | undefined +>"" : string + + x!.slice(); +>x!.slice() : string +>x!.slice : (start?: number | undefined, end?: number | undefined) => string +>x! : string +>x : string | undefined +>slice : (start?: number | undefined, end?: number | undefined) => string + + x = ""; +>x = "" : string | null +>x : string | null | undefined +>"" : string | null +>null : null +>"" : string + + x!.slice(); +>x!.slice() : string +>x!.slice : (start?: number | undefined, end?: number | undefined) => string +>x! : string +>x : string | null +>slice : (start?: number | undefined, end?: number | undefined) => string +} + diff --git a/tests/baselines/reference/typeGuardsDefeat.errors.txt b/tests/baselines/reference/typeGuardsDefeat.errors.txt new file mode 100644 index 00000000000..d4006711d45 --- /dev/null +++ b/tests/baselines/reference/typeGuardsDefeat.errors.txt @@ -0,0 +1,52 @@ +tests/cases/conformance/expressions/typeGuards/typeGuardsDefeat.ts(21,20): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/typeGuards/typeGuardsDefeat.ts(21,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/typeGuards/typeGuardsDefeat.ts(32,23): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/typeGuards/typeGuardsDefeat.ts(32,27): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + +==== tests/cases/conformance/expressions/typeGuards/typeGuardsDefeat.ts (4 errors) ==== + // Also note that it is possible to defeat a type guard by calling a function that changes the + // type of the guarded variable. + function foo(x: number | string) { + function f() { + x = 10; + } + if (typeof x === "string") { + f(); + return x.length; // string + } + else { + return x++; // number + } + } + function foo2(x: number | string) { + if (typeof x === "string") { + return x.length; // string + } + else { + var f = function () { + return x * x; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + }; + } + x = "hello"; + f(); + } + function foo3(x: number | string) { + if (typeof x === "string") { + return x.length; // string + } + else { + var f = () => x * x; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + } + x = "hello"; + f(); + } + \ No newline at end of file diff --git a/tests/baselines/reference/typeGuardsDefeat.symbols b/tests/baselines/reference/typeGuardsDefeat.symbols deleted file mode 100644 index 388b69b5789..00000000000 --- a/tests/baselines/reference/typeGuardsDefeat.symbols +++ /dev/null @@ -1,82 +0,0 @@ -=== tests/cases/conformance/expressions/typeGuards/typeGuardsDefeat.ts === -// Also note that it is possible to defeat a type guard by calling a function that changes the -// type of the guarded variable. -function foo(x: number | string) { ->foo : Symbol(foo, Decl(typeGuardsDefeat.ts, 0, 0)) ->x : Symbol(x, Decl(typeGuardsDefeat.ts, 2, 13)) - - function f() { ->f : Symbol(f, Decl(typeGuardsDefeat.ts, 2, 34)) - - x = 10; ->x : Symbol(x, Decl(typeGuardsDefeat.ts, 2, 13)) - } - if (typeof x === "string") { ->x : Symbol(x, Decl(typeGuardsDefeat.ts, 2, 13)) - - f(); ->f : Symbol(f, Decl(typeGuardsDefeat.ts, 2, 34)) - - return x.length; // string ->x.length : Symbol(String.length, Decl(lib.d.ts, --, --)) ->x : Symbol(x, Decl(typeGuardsDefeat.ts, 2, 13)) ->length : Symbol(String.length, Decl(lib.d.ts, --, --)) - } - else { - return x++; // number ->x : Symbol(x, Decl(typeGuardsDefeat.ts, 2, 13)) - } -} -function foo2(x: number | string) { ->foo2 : Symbol(foo2, Decl(typeGuardsDefeat.ts, 13, 1)) ->x : Symbol(x, Decl(typeGuardsDefeat.ts, 14, 14)) - - if (typeof x === "string") { ->x : Symbol(x, Decl(typeGuardsDefeat.ts, 14, 14)) - - return x.length; // string ->x.length : Symbol(String.length, Decl(lib.d.ts, --, --)) ->x : Symbol(x, Decl(typeGuardsDefeat.ts, 14, 14)) ->length : Symbol(String.length, Decl(lib.d.ts, --, --)) - } - else { - var f = function () { ->f : Symbol(f, Decl(typeGuardsDefeat.ts, 19, 11)) - - return x * x; ->x : Symbol(x, Decl(typeGuardsDefeat.ts, 14, 14)) ->x : Symbol(x, Decl(typeGuardsDefeat.ts, 14, 14)) - - }; - } - x = "hello"; ->x : Symbol(x, Decl(typeGuardsDefeat.ts, 14, 14)) - - f(); ->f : Symbol(f, Decl(typeGuardsDefeat.ts, 19, 11)) -} -function foo3(x: number | string) { ->foo3 : Symbol(foo3, Decl(typeGuardsDefeat.ts, 25, 1)) ->x : Symbol(x, Decl(typeGuardsDefeat.ts, 26, 14)) - - if (typeof x === "string") { ->x : Symbol(x, Decl(typeGuardsDefeat.ts, 26, 14)) - - return x.length; // string ->x.length : Symbol(String.length, Decl(lib.d.ts, --, --)) ->x : Symbol(x, Decl(typeGuardsDefeat.ts, 26, 14)) ->length : Symbol(String.length, Decl(lib.d.ts, --, --)) - } - else { - var f = () => x * x; ->f : Symbol(f, Decl(typeGuardsDefeat.ts, 31, 11)) ->x : Symbol(x, Decl(typeGuardsDefeat.ts, 26, 14)) ->x : Symbol(x, Decl(typeGuardsDefeat.ts, 26, 14)) - } - x = "hello"; ->x : Symbol(x, Decl(typeGuardsDefeat.ts, 26, 14)) - - f(); ->f : Symbol(f, Decl(typeGuardsDefeat.ts, 31, 11)) -} - diff --git a/tests/baselines/reference/typeGuardsDefeat.types b/tests/baselines/reference/typeGuardsDefeat.types deleted file mode 100644 index cc655d3ce0f..00000000000 --- a/tests/baselines/reference/typeGuardsDefeat.types +++ /dev/null @@ -1,105 +0,0 @@ -=== tests/cases/conformance/expressions/typeGuards/typeGuardsDefeat.ts === -// Also note that it is possible to defeat a type guard by calling a function that changes the -// type of the guarded variable. -function foo(x: number | string) { ->foo : (x: number | string) => number ->x : number | string - - function f() { ->f : () => void - - x = 10; ->x = 10 : number ->x : number | string ->10 : number - } - if (typeof x === "string") { ->typeof x === "string" : boolean ->typeof x : string ->x : number | string ->"string" : string - - f(); ->f() : void ->f : () => void - - return x.length; // string ->x.length : number ->x : string ->length : number - } - else { - return x++; // number ->x++ : number ->x : number - } -} -function foo2(x: number | string) { ->foo2 : (x: number | string) => number ->x : number | string - - if (typeof x === "string") { ->typeof x === "string" : boolean ->typeof x : string ->x : number | string ->"string" : string - - return x.length; // string ->x.length : number ->x : string ->length : number - } - else { - var f = function () { ->f : () => number ->function () { return x * x; } : () => number - - return x * x; ->x * x : number ->x : number ->x : number - - }; - } - x = "hello"; ->x = "hello" : string ->x : number | string ->"hello" : string - - f(); ->f() : number ->f : () => number -} -function foo3(x: number | string) { ->foo3 : (x: number | string) => number ->x : number | string - - if (typeof x === "string") { ->typeof x === "string" : boolean ->typeof x : string ->x : number | string ->"string" : string - - return x.length; // string ->x.length : number ->x : string ->length : number - } - else { - var f = () => x * x; ->f : () => number ->() => x * x : () => number ->x * x : number ->x : number ->x : number - } - x = "hello"; ->x = "hello" : string ->x : number | string ->"hello" : string - - f(); ->f() : number ->f : () => number -} - diff --git a/tests/baselines/reference/typeGuardsInClassAccessors.symbols b/tests/baselines/reference/typeGuardsInClassAccessors.symbols index d38c3040e01..5f28ed4498c 100644 --- a/tests/baselines/reference/typeGuardsInClassAccessors.symbols +++ b/tests/baselines/reference/typeGuardsInClassAccessors.symbols @@ -18,7 +18,7 @@ class ClassWithAccessors { // Inside public accessor getter get p1() { ->p1 : Symbol(p1, Decl(typeGuardsInClassAccessors.ts, 8, 26), Decl(typeGuardsInClassAccessors.ts, 19, 5)) +>p1 : Symbol(ClassWithAccessors.p1, Decl(typeGuardsInClassAccessors.ts, 8, 26), Decl(typeGuardsInClassAccessors.ts, 19, 5)) // global vars in function declaration num = typeof var1 === "string" && var1.length; // string @@ -44,7 +44,7 @@ class ClassWithAccessors { } // Inside public accessor setter set p1(param: string | number) { ->p1 : Symbol(p1, Decl(typeGuardsInClassAccessors.ts, 8, 26), Decl(typeGuardsInClassAccessors.ts, 19, 5)) +>p1 : Symbol(ClassWithAccessors.p1, Decl(typeGuardsInClassAccessors.ts, 8, 26), Decl(typeGuardsInClassAccessors.ts, 19, 5)) >param : Symbol(param, Decl(typeGuardsInClassAccessors.ts, 21, 11)) // global vars in function declaration @@ -76,7 +76,7 @@ class ClassWithAccessors { } // Inside private accessor getter private get pp1() { ->pp1 : Symbol(pp1, Decl(typeGuardsInClassAccessors.ts, 31, 5), Decl(typeGuardsInClassAccessors.ts, 42, 5)) +>pp1 : Symbol(ClassWithAccessors.pp1, Decl(typeGuardsInClassAccessors.ts, 31, 5), Decl(typeGuardsInClassAccessors.ts, 42, 5)) // global vars in function declaration num = typeof var1 === "string" && var1.length; // string @@ -102,7 +102,7 @@ class ClassWithAccessors { } // Inside private accessor setter private set pp1(param: string | number) { ->pp1 : Symbol(pp1, Decl(typeGuardsInClassAccessors.ts, 31, 5), Decl(typeGuardsInClassAccessors.ts, 42, 5)) +>pp1 : Symbol(ClassWithAccessors.pp1, Decl(typeGuardsInClassAccessors.ts, 31, 5), Decl(typeGuardsInClassAccessors.ts, 42, 5)) >param : Symbol(param, Decl(typeGuardsInClassAccessors.ts, 44, 20)) // global vars in function declaration diff --git a/tests/baselines/reference/typeGuardsInClassMethods.symbols b/tests/baselines/reference/typeGuardsInClassMethods.symbols index 30f01d3619f..1808b97be47 100644 --- a/tests/baselines/reference/typeGuardsInClassMethods.symbols +++ b/tests/baselines/reference/typeGuardsInClassMethods.symbols @@ -44,7 +44,7 @@ class C1 { } // Inside function declaration private p1(param: string | number) { ->p1 : Symbol(p1, Decl(typeGuardsInClassMethods.ts, 17, 5)) +>p1 : Symbol(C1.p1, Decl(typeGuardsInClassMethods.ts, 17, 5)) >param : Symbol(param, Decl(typeGuardsInClassMethods.ts, 19, 15)) // global vars in function declaration @@ -76,7 +76,7 @@ class C1 { } // Inside function declaration p2(param: string | number) { ->p2 : Symbol(p2, Decl(typeGuardsInClassMethods.ts, 29, 5)) +>p2 : Symbol(C1.p2, Decl(typeGuardsInClassMethods.ts, 29, 5)) >param : Symbol(param, Decl(typeGuardsInClassMethods.ts, 31, 7)) // global vars in function declaration diff --git a/tests/baselines/reference/typeGuardsInConditionalExpression.js b/tests/baselines/reference/typeGuardsInConditionalExpression.js index 118ebbc02c0..9aade91612a 100644 --- a/tests/baselines/reference/typeGuardsInConditionalExpression.js +++ b/tests/baselines/reference/typeGuardsInConditionalExpression.js @@ -12,43 +12,37 @@ function foo(x: number | string) { : x++; // number } function foo2(x: number | string) { - // x is assigned in the if true branch, the type is not narrowed return typeof x === "string" - ? (x = 10 && x)// string | number - : x; // string | number + ? ((x = "hello") && x) // string + : x; // number } function foo3(x: number | string) { - // x is assigned in the if false branch, the type is not narrowed - // even though assigned using same type as narrowed expression return typeof x === "string" - ? (x = "Hello" && x) // string | number - : x; // string | number + ? ((x = 10) && x) // number + : x; // number } function foo4(x: number | string) { - // false branch updates the variable - so here it is not number - // even though assigned using same type as narrowed expression return typeof x === "string" - ? x // string | number - : (x = 10 && x); // string | number + ? x // string + : ((x = 10) && x); // number } function foo5(x: number | string) { - // false branch updates the variable - so here it is not number return typeof x === "string" - ? x // string | number - : (x = "hello" && x); // string | number + ? x // string + : ((x = "hello") && x); // string } function foo6(x: number | string) { // Modify in both branches return typeof x === "string" - ? (x = 10 && x) // string | number - : (x = "hello" && x); // string | number + ? ((x = 10) && x) // number + : ((x = "hello") && x); // string } function foo7(x: number | string | boolean) { return typeof x === "string" - ? x === "hello" // string + ? x === "hello" // boolean : typeof x === "boolean" ? x // boolean - : x == 10; // number + : x == 10; // boolean } function foo8(x: number | string | boolean) { var b: number | boolean; @@ -57,14 +51,14 @@ function foo8(x: number | string | boolean) { : ((b = x) && // number | boolean (typeof x === "boolean" ? x // boolean - : x == 10)); // number + : x == 10)); // boolean } function foo9(x: number | string) { var y = 10; // usage of x or assignment to separate variable shouldn't cause narrowing of type to stop return typeof x === "string" - ? ((y = x.length) && x === "hello") // string - : x === 10; // number + ? ((y = x.length) && x === "hello") // boolean + : x === 10; // boolean } function foo10(x: number | string | boolean) { // Mixing typeguards @@ -77,22 +71,20 @@ function foo10(x: number | string | boolean) { } function foo11(x: number | string | boolean) { // Mixing typeguards - // Assigning value to x deep inside another guard stops narrowing of type too var b: number | boolean | string; return typeof x === "string" - ? x // number | boolean | string - changed in the false branch - : ((b = x) // x is number | boolean | string - because the assignment changed it + ? x // string + : ((b = x) // x is number | boolean && typeof x === "number" && (x = 10) // assignment to x - && x); // x is number | boolean | string + && x); // x is number } function foo12(x: number | string | boolean) { // Mixing typeguards - // Assigning value to x in outer guard shouldn't stop narrowing in the inner expression var b: number | boolean | string; return typeof x === "string" - ? (x = 10 && x.toString().length) // number | boolean | string - changed here - : ((b = x) // x is number | boolean | string - changed in true branch + ? ((x = 10) && x.toString().length) // number + : ((b = x) // x is number | boolean && typeof x === "number" && x); // x is number } @@ -110,43 +102,37 @@ function foo(x) { : x++; // number } function foo2(x) { - // x is assigned in the if true branch, the type is not narrowed return typeof x === "string" - ? (x = 10 && x) // string | number - : x; // string | number + ? ((x = "hello") && x) // string + : x; // number } function foo3(x) { - // x is assigned in the if false branch, the type is not narrowed - // even though assigned using same type as narrowed expression return typeof x === "string" - ? (x = "Hello" && x) // string | number - : x; // string | number + ? ((x = 10) && x) // number + : x; // number } function foo4(x) { - // false branch updates the variable - so here it is not number - // even though assigned using same type as narrowed expression return typeof x === "string" - ? x // string | number - : (x = 10 && x); // string | number + ? x // string + : ((x = 10) && x); // number } function foo5(x) { - // false branch updates the variable - so here it is not number return typeof x === "string" - ? x // string | number - : (x = "hello" && x); // string | number + ? x // string + : ((x = "hello") && x); // string } function foo6(x) { // Modify in both branches return typeof x === "string" - ? (x = 10 && x) // string | number - : (x = "hello" && x); // string | number + ? ((x = 10) && x) // number + : ((x = "hello") && x); // string } function foo7(x) { return typeof x === "string" - ? x === "hello" // string + ? x === "hello" // boolean : typeof x === "boolean" ? x // boolean - : x == 10; // number + : x == 10; // boolean } function foo8(x) { var b; @@ -155,14 +141,14 @@ function foo8(x) { : ((b = x) && (typeof x === "boolean" ? x // boolean - : x == 10)); // number + : x == 10)); // boolean } function foo9(x) { var y = 10; // usage of x or assignment to separate variable shouldn't cause narrowing of type to stop return typeof x === "string" - ? ((y = x.length) && x === "hello") // string - : x === 10; // number + ? ((y = x.length) && x === "hello") // boolean + : x === 10; // boolean } function foo10(x) { // Mixing typeguards @@ -175,22 +161,20 @@ function foo10(x) { } function foo11(x) { // Mixing typeguards - // Assigning value to x deep inside another guard stops narrowing of type too var b; return typeof x === "string" - ? x // number | boolean | string - changed in the false branch - : ((b = x) // x is number | boolean | string - because the assignment changed it + ? x // string + : ((b = x) // x is number | boolean && typeof x === "number" && (x = 10) // assignment to x - && x); // x is number | boolean | string + && x); // x is number } function foo12(x) { // Mixing typeguards - // Assigning value to x in outer guard shouldn't stop narrowing in the inner expression var b; return typeof x === "string" - ? (x = 10 && x.toString().length) // number | boolean | string - changed here - : ((b = x) // x is number | boolean | string - changed in true branch + ? ((x = 10) && x.toString().length) // number + : ((b = x) // x is number | boolean && typeof x === "number" && x); // x is number } diff --git a/tests/baselines/reference/typeGuardsInConditionalExpression.symbols b/tests/baselines/reference/typeGuardsInConditionalExpression.symbols index 7de63d90bf9..ada6a6d99fd 100644 --- a/tests/baselines/reference/typeGuardsInConditionalExpression.symbols +++ b/tests/baselines/reference/typeGuardsInConditionalExpression.symbols @@ -25,227 +25,219 @@ function foo2(x: number | string) { >foo2 : Symbol(foo2, Decl(typeGuardsInConditionalExpression.ts, 11, 1)) >x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 12, 14)) - // x is assigned in the if true branch, the type is not narrowed return typeof x === "string" >x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 12, 14)) - ? (x = 10 && x)// string | number + ? ((x = "hello") && x) // string >x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 12, 14)) >x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 12, 14)) - : x; // string | number + : x; // number >x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 12, 14)) } function foo3(x: number | string) { ->foo3 : Symbol(foo3, Decl(typeGuardsInConditionalExpression.ts, 17, 1)) ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 18, 14)) +>foo3 : Symbol(foo3, Decl(typeGuardsInConditionalExpression.ts, 16, 1)) +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 17, 14)) - // x is assigned in the if false branch, the type is not narrowed - // even though assigned using same type as narrowed expression return typeof x === "string" ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 18, 14)) +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 17, 14)) - ? (x = "Hello" && x) // string | number ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 18, 14)) ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 18, 14)) + ? ((x = 10) && x) // number +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 17, 14)) +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 17, 14)) - : x; // string | number ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 18, 14)) + : x; // number +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 17, 14)) } function foo4(x: number | string) { ->foo4 : Symbol(foo4, Decl(typeGuardsInConditionalExpression.ts, 24, 1)) ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 25, 14)) +>foo4 : Symbol(foo4, Decl(typeGuardsInConditionalExpression.ts, 21, 1)) +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 22, 14)) - // false branch updates the variable - so here it is not number - // even though assigned using same type as narrowed expression return typeof x === "string" ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 25, 14)) +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 22, 14)) - ? x // string | number ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 25, 14)) + ? x // string +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 22, 14)) - : (x = 10 && x); // string | number ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 25, 14)) ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 25, 14)) + : ((x = 10) && x); // number +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 22, 14)) +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 22, 14)) } function foo5(x: number | string) { ->foo5 : Symbol(foo5, Decl(typeGuardsInConditionalExpression.ts, 31, 1)) ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 32, 14)) +>foo5 : Symbol(foo5, Decl(typeGuardsInConditionalExpression.ts, 26, 1)) +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 27, 14)) - // false branch updates the variable - so here it is not number return typeof x === "string" ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 32, 14)) +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 27, 14)) - ? x // string | number ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 32, 14)) + ? x // string +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 27, 14)) - : (x = "hello" && x); // string | number ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 32, 14)) ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 32, 14)) + : ((x = "hello") && x); // string +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 27, 14)) +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 27, 14)) } function foo6(x: number | string) { ->foo6 : Symbol(foo6, Decl(typeGuardsInConditionalExpression.ts, 37, 1)) ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 38, 14)) +>foo6 : Symbol(foo6, Decl(typeGuardsInConditionalExpression.ts, 31, 1)) +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 32, 14)) // Modify in both branches return typeof x === "string" ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 38, 14)) +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 32, 14)) - ? (x = 10 && x) // string | number ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 38, 14)) ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 38, 14)) + ? ((x = 10) && x) // number +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 32, 14)) +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 32, 14)) - : (x = "hello" && x); // string | number ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 38, 14)) ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 38, 14)) + : ((x = "hello") && x); // string +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 32, 14)) +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 32, 14)) } function foo7(x: number | string | boolean) { ->foo7 : Symbol(foo7, Decl(typeGuardsInConditionalExpression.ts, 43, 1)) ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 44, 14)) +>foo7 : Symbol(foo7, Decl(typeGuardsInConditionalExpression.ts, 37, 1)) +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 38, 14)) return typeof x === "string" ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 44, 14)) +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 38, 14)) - ? x === "hello" // string ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 44, 14)) + ? x === "hello" // boolean +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 38, 14)) : typeof x === "boolean" ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 44, 14)) +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 38, 14)) ? x // boolean ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 44, 14)) +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 38, 14)) - : x == 10; // number ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 44, 14)) + : x == 10; // boolean +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 38, 14)) } function foo8(x: number | string | boolean) { ->foo8 : Symbol(foo8, Decl(typeGuardsInConditionalExpression.ts, 50, 1)) ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 51, 14)) +>foo8 : Symbol(foo8, Decl(typeGuardsInConditionalExpression.ts, 44, 1)) +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 45, 14)) var b: number | boolean; ->b : Symbol(b, Decl(typeGuardsInConditionalExpression.ts, 52, 7)) +>b : Symbol(b, Decl(typeGuardsInConditionalExpression.ts, 46, 7)) return typeof x === "string" ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 51, 14)) +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 45, 14)) ? x === "hello" ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 51, 14)) +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 45, 14)) : ((b = x) && // number | boolean ->b : Symbol(b, Decl(typeGuardsInConditionalExpression.ts, 52, 7)) ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 51, 14)) +>b : Symbol(b, Decl(typeGuardsInConditionalExpression.ts, 46, 7)) +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 45, 14)) (typeof x === "boolean" ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 51, 14)) +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 45, 14)) ? x // boolean ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 51, 14)) +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 45, 14)) - : x == 10)); // number ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 51, 14)) + : x == 10)); // boolean +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 45, 14)) } function foo9(x: number | string) { ->foo9 : Symbol(foo9, Decl(typeGuardsInConditionalExpression.ts, 59, 1)) ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 60, 14)) +>foo9 : Symbol(foo9, Decl(typeGuardsInConditionalExpression.ts, 53, 1)) +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 54, 14)) var y = 10; ->y : Symbol(y, Decl(typeGuardsInConditionalExpression.ts, 61, 7)) +>y : Symbol(y, Decl(typeGuardsInConditionalExpression.ts, 55, 7)) // usage of x or assignment to separate variable shouldn't cause narrowing of type to stop return typeof x === "string" ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 60, 14)) +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 54, 14)) - ? ((y = x.length) && x === "hello") // string ->y : Symbol(y, Decl(typeGuardsInConditionalExpression.ts, 61, 7)) + ? ((y = x.length) && x === "hello") // boolean +>y : Symbol(y, Decl(typeGuardsInConditionalExpression.ts, 55, 7)) >x.length : Symbol(String.length, Decl(lib.d.ts, --, --)) ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 60, 14)) +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 54, 14)) >length : Symbol(String.length, Decl(lib.d.ts, --, --)) ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 60, 14)) +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 54, 14)) - : x === 10; // number ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 60, 14)) + : x === 10; // boolean +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 54, 14)) } function foo10(x: number | string | boolean) { ->foo10 : Symbol(foo10, Decl(typeGuardsInConditionalExpression.ts, 66, 1)) ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 67, 15)) +>foo10 : Symbol(foo10, Decl(typeGuardsInConditionalExpression.ts, 60, 1)) +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 61, 15)) // Mixing typeguards var b: boolean | number; ->b : Symbol(b, Decl(typeGuardsInConditionalExpression.ts, 69, 7)) +>b : Symbol(b, Decl(typeGuardsInConditionalExpression.ts, 63, 7)) return typeof x === "string" ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 67, 15)) +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 61, 15)) ? x // string ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 67, 15)) +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 61, 15)) : ((b = x) // x is number | boolean ->b : Symbol(b, Decl(typeGuardsInConditionalExpression.ts, 69, 7)) ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 67, 15)) +>b : Symbol(b, Decl(typeGuardsInConditionalExpression.ts, 63, 7)) +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 61, 15)) && typeof x === "number" ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 67, 15)) +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 61, 15)) && x.toString()); // x is number >x.toString : Symbol(Number.toString, Decl(lib.d.ts, --, --)) ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 67, 15)) +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 61, 15)) >toString : Symbol(Number.toString, Decl(lib.d.ts, --, --)) } function foo11(x: number | string | boolean) { ->foo11 : Symbol(foo11, Decl(typeGuardsInConditionalExpression.ts, 75, 1)) ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 76, 15)) +>foo11 : Symbol(foo11, Decl(typeGuardsInConditionalExpression.ts, 69, 1)) +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 70, 15)) // Mixing typeguards - // Assigning value to x deep inside another guard stops narrowing of type too var b: number | boolean | string; ->b : Symbol(b, Decl(typeGuardsInConditionalExpression.ts, 79, 7)) +>b : Symbol(b, Decl(typeGuardsInConditionalExpression.ts, 72, 7)) return typeof x === "string" ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 76, 15)) +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 70, 15)) - ? x // number | boolean | string - changed in the false branch ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 76, 15)) + ? x // string +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 70, 15)) - : ((b = x) // x is number | boolean | string - because the assignment changed it ->b : Symbol(b, Decl(typeGuardsInConditionalExpression.ts, 79, 7)) ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 76, 15)) + : ((b = x) // x is number | boolean +>b : Symbol(b, Decl(typeGuardsInConditionalExpression.ts, 72, 7)) +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 70, 15)) && typeof x === "number" ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 76, 15)) +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 70, 15)) && (x = 10) // assignment to x ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 76, 15)) - - && x); // x is number | boolean | string ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 76, 15)) -} -function foo12(x: number | string | boolean) { ->foo12 : Symbol(foo12, Decl(typeGuardsInConditionalExpression.ts, 86, 1)) ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 87, 15)) - - // Mixing typeguards - // Assigning value to x in outer guard shouldn't stop narrowing in the inner expression - var b: number | boolean | string; ->b : Symbol(b, Decl(typeGuardsInConditionalExpression.ts, 90, 7)) - - return typeof x === "string" ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 87, 15)) - - ? (x = 10 && x.toString().length) // number | boolean | string - changed here ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 87, 15)) ->x.toString().length : Symbol(String.length, Decl(lib.d.ts, --, --)) ->x.toString : Symbol(toString, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 87, 15)) ->toString : Symbol(toString, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->length : Symbol(String.length, Decl(lib.d.ts, --, --)) - - : ((b = x) // x is number | boolean | string - changed in true branch ->b : Symbol(b, Decl(typeGuardsInConditionalExpression.ts, 90, 7)) ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 87, 15)) - - && typeof x === "number" ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 87, 15)) +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 70, 15)) && x); // x is number ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 87, 15)) +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 70, 15)) +} +function foo12(x: number | string | boolean) { +>foo12 : Symbol(foo12, Decl(typeGuardsInConditionalExpression.ts, 79, 1)) +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 80, 15)) + + // Mixing typeguards + var b: number | boolean | string; +>b : Symbol(b, Decl(typeGuardsInConditionalExpression.ts, 82, 7)) + + return typeof x === "string" +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 80, 15)) + + ? ((x = 10) && x.toString().length) // number +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 80, 15)) +>x.toString().length : Symbol(String.length, Decl(lib.d.ts, --, --)) +>x.toString : Symbol(Number.toString, Decl(lib.d.ts, --, --)) +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 80, 15)) +>toString : Symbol(Number.toString, Decl(lib.d.ts, --, --)) +>length : Symbol(String.length, Decl(lib.d.ts, --, --)) + + : ((b = x) // x is number | boolean +>b : Symbol(b, Decl(typeGuardsInConditionalExpression.ts, 82, 7)) +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 80, 15)) + + && typeof x === "number" +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 80, 15)) + + && x); // x is number +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 80, 15)) } diff --git a/tests/baselines/reference/typeGuardsInConditionalExpression.types b/tests/baselines/reference/typeGuardsInConditionalExpression.types index 493a8c0a31a..cc1459738e4 100644 --- a/tests/baselines/reference/typeGuardsInConditionalExpression.types +++ b/tests/baselines/reference/typeGuardsInConditionalExpression.types @@ -27,98 +27,96 @@ function foo(x: number | string) { >x : number } function foo2(x: number | string) { ->foo2 : (x: number | string) => number | string +>foo2 : (x: number | string) => string | number >x : number | string - // x is assigned in the if true branch, the type is not narrowed return typeof x === "string" ->typeof x === "string" ? (x = 10 && x)// string | number : x : number | string +>typeof x === "string" ? ((x = "hello") && x) // string : x : string | number >typeof x === "string" : boolean >typeof x : string >x : number | string >"string" : string - ? (x = 10 && x)// string | number ->(x = 10 && x) : number | string ->x = 10 && x : number | string ->x : number | string ->10 && x : number | string ->10 : number + ? ((x = "hello") && x) // string +>((x = "hello") && x) : string +>(x = "hello") && x : string +>(x = "hello") : string +>x = "hello" : string >x : number | string +>"hello" : string +>x : string - : x; // string | number ->x : number | string + : x; // number +>x : number } function foo3(x: number | string) { ->foo3 : (x: number | string) => number | string +>foo3 : (x: number | string) => number >x : number | string - // x is assigned in the if false branch, the type is not narrowed - // even though assigned using same type as narrowed expression return typeof x === "string" ->typeof x === "string" ? (x = "Hello" && x) // string | number : x : number | string +>typeof x === "string" ? ((x = 10) && x) // number : x : number >typeof x === "string" : boolean >typeof x : string >x : number | string >"string" : string - ? (x = "Hello" && x) // string | number ->(x = "Hello" && x) : number | string ->x = "Hello" && x : number | string ->x : number | string ->"Hello" && x : number | string ->"Hello" : string + ? ((x = 10) && x) // number +>((x = 10) && x) : number +>(x = 10) && x : number +>(x = 10) : number +>x = 10 : number >x : number | string +>10 : number +>x : number - : x; // string | number ->x : number | string + : x; // number +>x : number } function foo4(x: number | string) { ->foo4 : (x: number | string) => number | string +>foo4 : (x: number | string) => string | number >x : number | string - // false branch updates the variable - so here it is not number - // even though assigned using same type as narrowed expression return typeof x === "string" ->typeof x === "string" ? x // string | number : (x = 10 && x) : number | string +>typeof x === "string" ? x // string : ((x = 10) && x) : string | number >typeof x === "string" : boolean >typeof x : string >x : number | string >"string" : string - ? x // string | number ->x : number | string + ? x // string +>x : string - : (x = 10 && x); // string | number ->(x = 10 && x) : number | string ->x = 10 && x : number | string + : ((x = 10) && x); // number +>((x = 10) && x) : number +>(x = 10) && x : number +>(x = 10) : number +>x = 10 : number >x : number | string ->10 && x : number | string >10 : number ->x : number | string +>x : number } function foo5(x: number | string) { ->foo5 : (x: number | string) => number | string +>foo5 : (x: number | string) => string >x : number | string - // false branch updates the variable - so here it is not number return typeof x === "string" ->typeof x === "string" ? x // string | number : (x = "hello" && x) : number | string +>typeof x === "string" ? x // string : ((x = "hello") && x) : string >typeof x === "string" : boolean >typeof x : string >x : number | string >"string" : string - ? x // string | number ->x : number | string + ? x // string +>x : string - : (x = "hello" && x); // string | number ->(x = "hello" && x) : number | string ->x = "hello" && x : number | string + : ((x = "hello") && x); // string +>((x = "hello") && x) : string +>(x = "hello") && x : string +>(x = "hello") : string +>x = "hello" : string >x : number | string ->"hello" && x : number | string >"hello" : string ->x : number | string +>x : string } function foo6(x: number | string) { >foo6 : (x: number | string) => number | string @@ -126,40 +124,42 @@ function foo6(x: number | string) { // Modify in both branches return typeof x === "string" ->typeof x === "string" ? (x = 10 && x) // string | number : (x = "hello" && x) : number | string +>typeof x === "string" ? ((x = 10) && x) // number : ((x = "hello") && x) : number | string >typeof x === "string" : boolean >typeof x : string >x : number | string >"string" : string - ? (x = 10 && x) // string | number ->(x = 10 && x) : number | string ->x = 10 && x : number | string + ? ((x = 10) && x) // number +>((x = 10) && x) : number +>(x = 10) && x : number +>(x = 10) : number +>x = 10 : number >x : number | string ->10 && x : number | string >10 : number ->x : number | string +>x : number - : (x = "hello" && x); // string | number ->(x = "hello" && x) : number | string ->x = "hello" && x : number | string + : ((x = "hello") && x); // string +>((x = "hello") && x) : string +>(x = "hello") && x : string +>(x = "hello") : string +>x = "hello" : string >x : number | string ->"hello" && x : number | string >"hello" : string ->x : number | string +>x : string } function foo7(x: number | string | boolean) { >foo7 : (x: number | string | boolean) => boolean >x : number | string | boolean return typeof x === "string" ->typeof x === "string" ? x === "hello" // string : typeof x === "boolean" ? x // boolean : x == 10 : boolean +>typeof x === "string" ? x === "hello" // boolean : typeof x === "boolean" ? x // boolean : x == 10 : boolean >typeof x === "string" : boolean >typeof x : string >x : number | string | boolean >"string" : string - ? x === "hello" // string + ? x === "hello" // boolean >x === "hello" : boolean >x : string >"hello" : string @@ -174,7 +174,7 @@ function foo7(x: number | string | boolean) { ? x // boolean >x : boolean - : x == 10; // number + : x == 10; // boolean >x == 10 : boolean >x : number >10 : number @@ -217,7 +217,7 @@ function foo8(x: number | string | boolean) { ? x // boolean >x : boolean - : x == 10)); // number + : x == 10)); // boolean >x == 10 : boolean >x : number >10 : number @@ -232,13 +232,13 @@ function foo9(x: number | string) { // usage of x or assignment to separate variable shouldn't cause narrowing of type to stop return typeof x === "string" ->typeof x === "string" ? ((y = x.length) && x === "hello") // string : x === 10 : boolean +>typeof x === "string" ? ((y = x.length) && x === "hello") // boolean : x === 10 : boolean >typeof x === "string" : boolean >typeof x : string >x : number | string >"string" : string - ? ((y = x.length) && x === "hello") // string + ? ((y = x.length) && x === "hello") // boolean >((y = x.length) && x === "hello") : boolean >(y = x.length) && x === "hello" : boolean >(y = x.length) : number @@ -251,7 +251,7 @@ function foo9(x: number | string) { >x : string >"hello" : string - : x === 10; // number + : x === 10; // boolean >x === 10 : boolean >x : number >10 : number @@ -296,38 +296,37 @@ function foo10(x: number | string | boolean) { >toString : (radix?: number) => string } function foo11(x: number | string | boolean) { ->foo11 : (x: number | string | boolean) => number | string | boolean +>foo11 : (x: number | string | boolean) => string | number >x : number | string | boolean // Mixing typeguards - // Assigning value to x deep inside another guard stops narrowing of type too var b: number | boolean | string; >b : number | boolean | string return typeof x === "string" ->typeof x === "string" ? x // number | boolean | string - changed in the false branch : ((b = x) // x is number | boolean | string - because the assignment changed it && typeof x === "number" && (x = 10) // assignment to x && x) : number | string | boolean +>typeof x === "string" ? x // string : ((b = x) // x is number | boolean && typeof x === "number" && (x = 10) // assignment to x && x) : string | number >typeof x === "string" : boolean >typeof x : string >x : number | string | boolean >"string" : string - ? x // number | boolean | string - changed in the false branch ->x : number | string | boolean + ? x // string +>x : string - : ((b = x) // x is number | boolean | string - because the assignment changed it ->((b = x) // x is number | boolean | string - because the assignment changed it && typeof x === "number" && (x = 10) // assignment to x && x) : number | string | boolean ->(b = x) // x is number | boolean | string - because the assignment changed it && typeof x === "number" && (x = 10) // assignment to x && x : number | string | boolean ->(b = x) // x is number | boolean | string - because the assignment changed it && typeof x === "number" && (x = 10) : number ->(b = x) // x is number | boolean | string - because the assignment changed it && typeof x === "number" : boolean ->(b = x) : number | string | boolean ->b = x : number | string | boolean + : ((b = x) // x is number | boolean +>((b = x) // x is number | boolean && typeof x === "number" && (x = 10) // assignment to x && x) : number +>(b = x) // x is number | boolean && typeof x === "number" && (x = 10) // assignment to x && x : number +>(b = x) // x is number | boolean && typeof x === "number" && (x = 10) : number +>(b = x) // x is number | boolean && typeof x === "number" : boolean +>(b = x) : number | boolean +>b = x : number | boolean >b : number | boolean | string ->x : number | string | boolean +>x : number | boolean && typeof x === "number" >typeof x === "number" : boolean >typeof x : string ->x : number | string | boolean +>x : number | boolean >"number" : string && (x = 10) // assignment to x @@ -336,51 +335,51 @@ function foo11(x: number | string | boolean) { >x : number | string | boolean >10 : number - && x); // x is number | boolean | string ->x : number | string | boolean + && x); // x is number +>x : number } function foo12(x: number | string | boolean) { >foo12 : (x: number | string | boolean) => number >x : number | string | boolean // Mixing typeguards - // Assigning value to x in outer guard shouldn't stop narrowing in the inner expression var b: number | boolean | string; >b : number | boolean | string return typeof x === "string" ->typeof x === "string" ? (x = 10 && x.toString().length) // number | boolean | string - changed here : ((b = x) // x is number | boolean | string - changed in true branch && typeof x === "number" && x) : number +>typeof x === "string" ? ((x = 10) && x.toString().length) // number : ((b = x) // x is number | boolean && typeof x === "number" && x) : number >typeof x === "string" : boolean >typeof x : string >x : number | string | boolean >"string" : string - ? (x = 10 && x.toString().length) // number | boolean | string - changed here ->(x = 10 && x.toString().length) : number ->x = 10 && x.toString().length : number + ? ((x = 10) && x.toString().length) // number +>((x = 10) && x.toString().length) : number +>(x = 10) && x.toString().length : number +>(x = 10) : number +>x = 10 : number >x : number | string | boolean ->10 && x.toString().length : number >10 : number >x.toString().length : number >x.toString() : string >x.toString : (radix?: number) => string ->x : number | string | boolean +>x : number >toString : (radix?: number) => string >length : number - : ((b = x) // x is number | boolean | string - changed in true branch ->((b = x) // x is number | boolean | string - changed in true branch && typeof x === "number" && x) : number ->(b = x) // x is number | boolean | string - changed in true branch && typeof x === "number" && x : number ->(b = x) // x is number | boolean | string - changed in true branch && typeof x === "number" : boolean ->(b = x) : number | string | boolean ->b = x : number | string | boolean + : ((b = x) // x is number | boolean +>((b = x) // x is number | boolean && typeof x === "number" && x) : number +>(b = x) // x is number | boolean && typeof x === "number" && x : number +>(b = x) // x is number | boolean && typeof x === "number" : boolean +>(b = x) : number | boolean +>b = x : number | boolean >b : number | boolean | string ->x : number | string | boolean +>x : number | boolean && typeof x === "number" >typeof x === "number" : boolean >typeof x : string ->x : number | string | boolean +>x : number | boolean >"number" : string && x); // x is number diff --git a/tests/baselines/reference/typeGuardsInDoStatement.js b/tests/baselines/reference/typeGuardsInDoStatement.js new file mode 100644 index 00000000000..7d299854f7d --- /dev/null +++ b/tests/baselines/reference/typeGuardsInDoStatement.js @@ -0,0 +1,60 @@ +//// [typeGuardsInDoStatement.ts] +let cond: boolean; +function a(x: string | number | boolean) { + x = true; + do { + x; // boolean | string + x = undefined; + } while (typeof x === "string") + x; // number | boolean +} +function b(x: string | number | boolean) { + x = true; + do { + x; // boolean | string + if (cond) continue; + x = undefined; + } while (typeof x === "string") + x; // number | boolean +} +function c(x: string | number) { + x = ""; + do { + x; // string + if (cond) break; + x = undefined; + } while (typeof x === "string") + x; // string | number +} + + +//// [typeGuardsInDoStatement.js] +var cond; +function a(x) { + x = true; + do { + x; // boolean | string + x = undefined; + } while (typeof x === "string"); + x; // number | boolean +} +function b(x) { + x = true; + do { + x; // boolean | string + if (cond) + continue; + x = undefined; + } while (typeof x === "string"); + x; // number | boolean +} +function c(x) { + x = ""; + do { + x; // string + if (cond) + break; + x = undefined; + } while (typeof x === "string"); + x; // string | number +} diff --git a/tests/baselines/reference/typeGuardsInDoStatement.symbols b/tests/baselines/reference/typeGuardsInDoStatement.symbols new file mode 100644 index 00000000000..7dff18d8d23 --- /dev/null +++ b/tests/baselines/reference/typeGuardsInDoStatement.symbols @@ -0,0 +1,74 @@ +=== tests/cases/conformance/expressions/typeGuards/typeGuardsInDoStatement.ts === +let cond: boolean; +>cond : Symbol(cond, Decl(typeGuardsInDoStatement.ts, 0, 3)) + +function a(x: string | number | boolean) { +>a : Symbol(a, Decl(typeGuardsInDoStatement.ts, 0, 18)) +>x : Symbol(x, Decl(typeGuardsInDoStatement.ts, 1, 11)) + + x = true; +>x : Symbol(x, Decl(typeGuardsInDoStatement.ts, 1, 11)) + + do { + x; // boolean | string +>x : Symbol(x, Decl(typeGuardsInDoStatement.ts, 1, 11)) + + x = undefined; +>x : Symbol(x, Decl(typeGuardsInDoStatement.ts, 1, 11)) +>undefined : Symbol(undefined) + + } while (typeof x === "string") +>x : Symbol(x, Decl(typeGuardsInDoStatement.ts, 1, 11)) + + x; // number | boolean +>x : Symbol(x, Decl(typeGuardsInDoStatement.ts, 1, 11)) +} +function b(x: string | number | boolean) { +>b : Symbol(b, Decl(typeGuardsInDoStatement.ts, 8, 1)) +>x : Symbol(x, Decl(typeGuardsInDoStatement.ts, 9, 11)) + + x = true; +>x : Symbol(x, Decl(typeGuardsInDoStatement.ts, 9, 11)) + + do { + x; // boolean | string +>x : Symbol(x, Decl(typeGuardsInDoStatement.ts, 9, 11)) + + if (cond) continue; +>cond : Symbol(cond, Decl(typeGuardsInDoStatement.ts, 0, 3)) + + x = undefined; +>x : Symbol(x, Decl(typeGuardsInDoStatement.ts, 9, 11)) +>undefined : Symbol(undefined) + + } while (typeof x === "string") +>x : Symbol(x, Decl(typeGuardsInDoStatement.ts, 9, 11)) + + x; // number | boolean +>x : Symbol(x, Decl(typeGuardsInDoStatement.ts, 9, 11)) +} +function c(x: string | number) { +>c : Symbol(c, Decl(typeGuardsInDoStatement.ts, 17, 1)) +>x : Symbol(x, Decl(typeGuardsInDoStatement.ts, 18, 11)) + + x = ""; +>x : Symbol(x, Decl(typeGuardsInDoStatement.ts, 18, 11)) + + do { + x; // string +>x : Symbol(x, Decl(typeGuardsInDoStatement.ts, 18, 11)) + + if (cond) break; +>cond : Symbol(cond, Decl(typeGuardsInDoStatement.ts, 0, 3)) + + x = undefined; +>x : Symbol(x, Decl(typeGuardsInDoStatement.ts, 18, 11)) +>undefined : Symbol(undefined) + + } while (typeof x === "string") +>x : Symbol(x, Decl(typeGuardsInDoStatement.ts, 18, 11)) + + x; // string | number +>x : Symbol(x, Decl(typeGuardsInDoStatement.ts, 18, 11)) +} + diff --git a/tests/baselines/reference/typeGuardsInDoStatement.types b/tests/baselines/reference/typeGuardsInDoStatement.types new file mode 100644 index 00000000000..79183e7d6c8 --- /dev/null +++ b/tests/baselines/reference/typeGuardsInDoStatement.types @@ -0,0 +1,92 @@ +=== tests/cases/conformance/expressions/typeGuards/typeGuardsInDoStatement.ts === +let cond: boolean; +>cond : boolean + +function a(x: string | number | boolean) { +>a : (x: string | number | boolean) => void +>x : string | number | boolean + + x = true; +>x = true : boolean +>x : string | number | boolean +>true : boolean + + do { + x; // boolean | string +>x : boolean | string + + x = undefined; +>x = undefined : undefined +>x : string | number | boolean +>undefined : undefined + + } while (typeof x === "string") +>typeof x === "string" : boolean +>typeof x : string +>x : string | number | boolean +>"string" : string + + x; // number | boolean +>x : number | boolean +} +function b(x: string | number | boolean) { +>b : (x: string | number | boolean) => void +>x : string | number | boolean + + x = true; +>x = true : boolean +>x : string | number | boolean +>true : boolean + + do { + x; // boolean | string +>x : boolean | string + + if (cond) continue; +>cond : boolean + + x = undefined; +>x = undefined : undefined +>x : string | number | boolean +>undefined : undefined + + } while (typeof x === "string") +>typeof x === "string" : boolean +>typeof x : string +>x : string | number | boolean +>"string" : string + + x; // number | boolean +>x : number | boolean +} +function c(x: string | number) { +>c : (x: string | number) => void +>x : string | number + + x = ""; +>x = "" : string +>x : string | number +>"" : string + + do { + x; // string +>x : string + + if (cond) break; +>cond : boolean + + x = undefined; +>x = undefined : undefined +>x : string | number +>undefined : undefined + + } while (typeof x === "string") +>typeof x === "string" : boolean +>typeof x : string +>x : string | number +>"string" : string + + x; // string | number +>x : string | number +} + diff --git a/tests/baselines/reference/typeGuardsInExternalModule.types b/tests/baselines/reference/typeGuardsInExternalModule.types index e20063719f5..940e7db831a 100644 --- a/tests/baselines/reference/typeGuardsInExternalModule.types +++ b/tests/baselines/reference/typeGuardsInExternalModule.types @@ -44,13 +44,13 @@ if (typeof var2 === "string") { // export makes the var property and not variable strOrNum = var2; // string | number ->strOrNum = var2 : string | number +>strOrNum = var2 : string >strOrNum : string | number ->var2 : string | number +>var2 : string } else { strOrNum = var2; // number | string ->strOrNum = var2 : string | number +>strOrNum = var2 : number >strOrNum : string | number ->var2 : string | number +>var2 : number } diff --git a/tests/baselines/reference/typeGuardsInForStatement.js b/tests/baselines/reference/typeGuardsInForStatement.js new file mode 100644 index 00000000000..a2e104bc3f1 --- /dev/null +++ b/tests/baselines/reference/typeGuardsInForStatement.js @@ -0,0 +1,48 @@ +//// [typeGuardsInForStatement.ts] +let cond: boolean; +function a(x: string | number) { + for (x = undefined; typeof x !== "number"; x = undefined) { + x; // string + } + x; // number +} +function b(x: string | number) { + for (x = undefined; typeof x !== "number"; x = undefined) { + x; // string + if (cond) continue; + } + x; // number +} +function c(x: string | number) { + for (x = undefined; typeof x !== "number"; x = undefined) { + x; // string + if (cond) break; + } + x; // string | number +} + + +//// [typeGuardsInForStatement.js] +var cond; +function a(x) { + for (x = undefined; typeof x !== "number"; x = undefined) { + x; // string + } + x; // number +} +function b(x) { + for (x = undefined; typeof x !== "number"; x = undefined) { + x; // string + if (cond) + continue; + } + x; // number +} +function c(x) { + for (x = undefined; typeof x !== "number"; x = undefined) { + x; // string + if (cond) + break; + } + x; // string | number +} diff --git a/tests/baselines/reference/typeGuardsInForStatement.symbols b/tests/baselines/reference/typeGuardsInForStatement.symbols new file mode 100644 index 00000000000..fe1c10eb14e --- /dev/null +++ b/tests/baselines/reference/typeGuardsInForStatement.symbols @@ -0,0 +1,62 @@ +=== tests/cases/conformance/expressions/typeGuards/typeGuardsInForStatement.ts === +let cond: boolean; +>cond : Symbol(cond, Decl(typeGuardsInForStatement.ts, 0, 3)) + +function a(x: string | number) { +>a : Symbol(a, Decl(typeGuardsInForStatement.ts, 0, 18)) +>x : Symbol(x, Decl(typeGuardsInForStatement.ts, 1, 11)) + + for (x = undefined; typeof x !== "number"; x = undefined) { +>x : Symbol(x, Decl(typeGuardsInForStatement.ts, 1, 11)) +>undefined : Symbol(undefined) +>x : Symbol(x, Decl(typeGuardsInForStatement.ts, 1, 11)) +>x : Symbol(x, Decl(typeGuardsInForStatement.ts, 1, 11)) +>undefined : Symbol(undefined) + + x; // string +>x : Symbol(x, Decl(typeGuardsInForStatement.ts, 1, 11)) + } + x; // number +>x : Symbol(x, Decl(typeGuardsInForStatement.ts, 1, 11)) +} +function b(x: string | number) { +>b : Symbol(b, Decl(typeGuardsInForStatement.ts, 6, 1)) +>x : Symbol(x, Decl(typeGuardsInForStatement.ts, 7, 11)) + + for (x = undefined; typeof x !== "number"; x = undefined) { +>x : Symbol(x, Decl(typeGuardsInForStatement.ts, 7, 11)) +>undefined : Symbol(undefined) +>x : Symbol(x, Decl(typeGuardsInForStatement.ts, 7, 11)) +>x : Symbol(x, Decl(typeGuardsInForStatement.ts, 7, 11)) +>undefined : Symbol(undefined) + + x; // string +>x : Symbol(x, Decl(typeGuardsInForStatement.ts, 7, 11)) + + if (cond) continue; +>cond : Symbol(cond, Decl(typeGuardsInForStatement.ts, 0, 3)) + } + x; // number +>x : Symbol(x, Decl(typeGuardsInForStatement.ts, 7, 11)) +} +function c(x: string | number) { +>c : Symbol(c, Decl(typeGuardsInForStatement.ts, 13, 1)) +>x : Symbol(x, Decl(typeGuardsInForStatement.ts, 14, 11)) + + for (x = undefined; typeof x !== "number"; x = undefined) { +>x : Symbol(x, Decl(typeGuardsInForStatement.ts, 14, 11)) +>undefined : Symbol(undefined) +>x : Symbol(x, Decl(typeGuardsInForStatement.ts, 14, 11)) +>x : Symbol(x, Decl(typeGuardsInForStatement.ts, 14, 11)) +>undefined : Symbol(undefined) + + x; // string +>x : Symbol(x, Decl(typeGuardsInForStatement.ts, 14, 11)) + + if (cond) break; +>cond : Symbol(cond, Decl(typeGuardsInForStatement.ts, 0, 3)) + } + x; // string | number +>x : Symbol(x, Decl(typeGuardsInForStatement.ts, 14, 11)) +} + diff --git a/tests/baselines/reference/typeGuardsInForStatement.types b/tests/baselines/reference/typeGuardsInForStatement.types new file mode 100644 index 00000000000..5ebdea53c31 --- /dev/null +++ b/tests/baselines/reference/typeGuardsInForStatement.types @@ -0,0 +1,77 @@ +=== tests/cases/conformance/expressions/typeGuards/typeGuardsInForStatement.ts === +let cond: boolean; +>cond : boolean + +function a(x: string | number) { +>a : (x: string | number) => void +>x : string | number + + for (x = undefined; typeof x !== "number"; x = undefined) { +>x = undefined : undefined +>x : string | number +>undefined : undefined +>typeof x !== "number" : boolean +>typeof x : string +>x : string | number +>"number" : string +>x = undefined : undefined +>x : string | number +>undefined : undefined + + x; // string +>x : string + } + x; // number +>x : number +} +function b(x: string | number) { +>b : (x: string | number) => void +>x : string | number + + for (x = undefined; typeof x !== "number"; x = undefined) { +>x = undefined : undefined +>x : string | number +>undefined : undefined +>typeof x !== "number" : boolean +>typeof x : string +>x : string | number +>"number" : string +>x = undefined : undefined +>x : string | number +>undefined : undefined + + x; // string +>x : string + + if (cond) continue; +>cond : boolean + } + x; // number +>x : number +} +function c(x: string | number) { +>c : (x: string | number) => void +>x : string | number + + for (x = undefined; typeof x !== "number"; x = undefined) { +>x = undefined : undefined +>x : string | number +>undefined : undefined +>typeof x !== "number" : boolean +>typeof x : string +>x : string | number +>"number" : string +>x = undefined : undefined +>x : string | number +>undefined : undefined + + x; // string +>x : string + + if (cond) break; +>cond : boolean + } + x; // string | number +>x : number | string +} + diff --git a/tests/baselines/reference/typeGuardsInFunctionAndModuleBlock.symbols b/tests/baselines/reference/typeGuardsInFunctionAndModuleBlock.symbols index 34810f303db..bf21641624e 100644 --- a/tests/baselines/reference/typeGuardsInFunctionAndModuleBlock.symbols +++ b/tests/baselines/reference/typeGuardsInFunctionAndModuleBlock.symbols @@ -27,9 +27,9 @@ function foo(x: number | string | boolean) { >toString : Symbol(Object.toString, Decl(lib.d.ts, --, --)) : x.toString(); // number ->x.toString : Symbol(Number.toString, Decl(lib.d.ts, --, --)) +>x.toString : Symbol(toString, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(typeGuardsInFunctionAndModuleBlock.ts, 2, 13)) ->toString : Symbol(Number.toString, Decl(lib.d.ts, --, --)) +>toString : Symbol(toString, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) } (); } @@ -60,9 +60,9 @@ function foo2(x: number | string | boolean) { >toString : Symbol(Object.toString, Decl(lib.d.ts, --, --)) : x.toString(); // number ->x.toString : Symbol(Number.toString, Decl(lib.d.ts, --, --)) +>x.toString : Symbol(toString, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(typeGuardsInFunctionAndModuleBlock.ts, 12, 14)) ->toString : Symbol(Number.toString, Decl(lib.d.ts, --, --)) +>toString : Symbol(toString, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) } (x); // x here is narrowed to number | boolean >x : Symbol(x, Decl(typeGuardsInFunctionAndModuleBlock.ts, 12, 14)) @@ -91,9 +91,9 @@ function foo3(x: number | string | boolean) { >toString : Symbol(Object.toString, Decl(lib.d.ts, --, --)) : x.toString(); // number ->x.toString : Symbol(Number.toString, Decl(lib.d.ts, --, --)) +>x.toString : Symbol(toString, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(typeGuardsInFunctionAndModuleBlock.ts, 22, 14)) ->toString : Symbol(Number.toString, Decl(lib.d.ts, --, --)) +>toString : Symbol(toString, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) })(); } @@ -123,9 +123,9 @@ function foo4(x: number | string | boolean) { >toString : Symbol(Object.toString, Decl(lib.d.ts, --, --)) : x.toString(); // number ->x.toString : Symbol(Number.toString, Decl(lib.d.ts, --, --)) +>x.toString : Symbol(toString, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(typeGuardsInFunctionAndModuleBlock.ts, 32, 14)) ->toString : Symbol(Number.toString, Decl(lib.d.ts, --, --)) +>toString : Symbol(toString, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) })(x); // x here is narrowed to number | boolean >x : Symbol(x, Decl(typeGuardsInFunctionAndModuleBlock.ts, 32, 14)) diff --git a/tests/baselines/reference/typeGuardsInFunctionAndModuleBlock.types b/tests/baselines/reference/typeGuardsInFunctionAndModuleBlock.types index f7d56ed17d1..67d1816cfc3 100644 --- a/tests/baselines/reference/typeGuardsInFunctionAndModuleBlock.types +++ b/tests/baselines/reference/typeGuardsInFunctionAndModuleBlock.types @@ -21,14 +21,14 @@ function foo(x: number | string | boolean) { >f : () => string var b = x; // number | boolean ->b : number | boolean ->x : number | boolean +>b : number | string | boolean +>x : number | string | boolean return typeof x === "boolean" >typeof x === "boolean" ? x.toString() // boolean : x.toString() : string >typeof x === "boolean" : boolean >typeof x : string ->x : number | boolean +>x : number | string | boolean >"boolean" : string ? x.toString() // boolean @@ -40,7 +40,7 @@ function foo(x: number | string | boolean) { : x.toString(); // number >x.toString() : string >x.toString : (radix?: number) => string ->x : number +>x : number | string >toString : (radix?: number) => string } (); @@ -66,14 +66,14 @@ function foo2(x: number | string | boolean) { >a : number | boolean var b = x; // new scope - number | boolean ->b : number | boolean ->x : number | boolean +>b : number | string | boolean +>x : number | string | boolean return typeof x === "boolean" >typeof x === "boolean" ? x.toString() // boolean : x.toString() : string >typeof x === "boolean" : boolean >typeof x : string ->x : number | boolean +>x : number | string | boolean >"boolean" : string ? x.toString() // boolean @@ -85,7 +85,7 @@ function foo2(x: number | string | boolean) { : x.toString(); // number >x.toString() : string >x.toString : (radix?: number) => string ->x : number +>x : number | string >toString : (radix?: number) => string } (x); // x here is narrowed to number | boolean @@ -111,14 +111,14 @@ function foo3(x: number | string | boolean) { >() => { var b = x; // new scope - number | boolean return typeof x === "boolean" ? x.toString() // boolean : x.toString(); // number } : () => string var b = x; // new scope - number | boolean ->b : number | boolean ->x : number | boolean +>b : number | string | boolean +>x : number | string | boolean return typeof x === "boolean" >typeof x === "boolean" ? x.toString() // boolean : x.toString() : string >typeof x === "boolean" : boolean >typeof x : string ->x : number | boolean +>x : number | string | boolean >"boolean" : string ? x.toString() // boolean @@ -130,7 +130,7 @@ function foo3(x: number | string | boolean) { : x.toString(); // number >x.toString() : string >x.toString : (radix?: number) => string ->x : number +>x : number | string >toString : (radix?: number) => string })(); @@ -156,14 +156,14 @@ function foo4(x: number | string | boolean) { >a : number | boolean var b = x; // new scope - number | boolean ->b : number | boolean ->x : number | boolean +>b : number | string | boolean +>x : number | string | boolean return typeof x === "boolean" >typeof x === "boolean" ? x.toString() // boolean : x.toString() : string >typeof x === "boolean" : boolean >typeof x : string ->x : number | boolean +>x : number | string | boolean >"boolean" : string ? x.toString() // boolean @@ -175,7 +175,7 @@ function foo4(x: number | string | boolean) { : x.toString(); // number >x.toString() : string >x.toString : (radix?: number) => string ->x : number +>x : number | string >toString : (radix?: number) => string })(x); // x here is narrowed to number | boolean @@ -200,8 +200,8 @@ function foo5(x: number | string | boolean) { >foo : () => void var z = x; // string ->z : string ->x : string +>z : number | string | boolean +>x : number | string | boolean } } } diff --git a/tests/baselines/reference/typeGuardsInIfStatement.errors.txt b/tests/baselines/reference/typeGuardsInIfStatement.errors.txt new file mode 100644 index 00000000000..984ca454e76 --- /dev/null +++ b/tests/baselines/reference/typeGuardsInIfStatement.errors.txt @@ -0,0 +1,153 @@ +tests/cases/conformance/expressions/typeGuards/typeGuardsInIfStatement.ts(22,10): error TS2354: No best common type exists among return expressions. +tests/cases/conformance/expressions/typeGuards/typeGuardsInIfStatement.ts(31,10): error TS2354: No best common type exists among return expressions. +tests/cases/conformance/expressions/typeGuards/typeGuardsInIfStatement.ts(49,10): error TS2354: No best common type exists among return expressions. + + +==== tests/cases/conformance/expressions/typeGuards/typeGuardsInIfStatement.ts (3 errors) ==== + // In the true branch statement of an 'if' statement, + // the type of a variable or parameter is narrowed by any type guard in the 'if' condition when true. + // In the false branch statement of an 'if' statement, + // the type of a variable or parameter is narrowed by any type guard in the 'if' condition when false. + function foo(x: number | string) { + if (typeof x === "string") { + return x.length; // string + } + else { + return x++; // number + } + } + function foo2(x: number | string) { + if (typeof x === "string") { + x = 10; + return x; // number + } + else { + return x; // number + } + } + function foo3(x: number | string) { + ~~~~ +!!! error TS2354: No best common type exists among return expressions. + if (typeof x === "string") { + x = "Hello"; + return x; // string + } + else { + return x; // number + } + } + function foo4(x: number | string) { + ~~~~ +!!! error TS2354: No best common type exists among return expressions. + if (typeof x === "string") { + return x; // string + } + else { + x = 10; + return x; // number + } + } + function foo5(x: number | string) { + if (typeof x === "string") { + return x; // string + } + else { + x = "hello"; + return x; // string + } + } + function foo6(x: number | string) { + ~~~~ +!!! error TS2354: No best common type exists among return expressions. + if (typeof x === "string") { + x = 10; + return x; // number + } + else { + x = "hello"; + return x; // string + } + } + function foo7(x: number | string | boolean) { + if (typeof x === "string") { + return x === "hello"; // string + } + else if (typeof x === "boolean") { + return x; // boolean + } + else { + return x == 10; // number + } + } + function foo8(x: number | string | boolean) { + if (typeof x === "string") { + return x === "hello"; // string + } + else { + var b: number | boolean = x; // number | boolean + if (typeof x === "boolean") { + return x; // boolean + } + else { + return x == 10; // number + } + } + } + function foo9(x: number | string) { + var y = 10; + if (typeof x === "string") { + // usage of x or assignment to separate variable shouldn't cause narrowing of type to stop + y = x.length; + return x === "hello"; // string + } + else { + return x == 10; // number + } + } + function foo10(x: number | string | boolean) { + // Mixing typeguard narrowing in if statement with conditional expression typeguard + if (typeof x === "string") { + return x === "hello"; // string + } + else { + var y: boolean | string; + var b = x; // number | boolean + return typeof x === "number" + ? x === 10 // number + : x; // x should be boolean + } + } + function foo11(x: number | string | boolean) { + // Mixing typeguard narrowing in if statement with conditional expression typeguard + // Assigning value to x deep inside another guard stops narrowing of type too + if (typeof x === "string") { + return x; // string | number | boolean - x changed in else branch + } + else { + var y: number| boolean | string; + var b = x; // number | boolean | string - because below we are changing value of x in if statement + return typeof x === "number" + ? ( + // change value of x + x = 10 && x.toString() // number | boolean | string + ) + : ( + // do not change value + y = x && x.toString() // number | boolean | string + ); + } + } + function foo12(x: number | string | boolean) { + // Mixing typeguard narrowing in if statement with conditional expression typeguard + // Assigning value to x in outer guard shouldn't stop narrowing in the inner expression + if (typeof x === "string") { + return x.toString(); // string | number | boolean - x changed in else branch + } + else { + x = 10; + var b = x; // number | boolean | string + return typeof x === "number" + ? x.toString() // number + : x.toString(); // boolean | string + } + } \ No newline at end of file diff --git a/tests/baselines/reference/typeGuardsInIfStatement.js b/tests/baselines/reference/typeGuardsInIfStatement.js index de05a7bf82a..8e841d2eac3 100644 --- a/tests/baselines/reference/typeGuardsInIfStatement.js +++ b/tests/baselines/reference/typeGuardsInIfStatement.js @@ -1,10 +1,8 @@ //// [typeGuardsInIfStatement.ts] // In the true branch statement of an 'if' statement, -// the type of a variable or parameter is narrowed by any type guard in the 'if' condition when true, -// provided the true branch statement contains no assignments to the variable or parameter. +// the type of a variable or parameter is narrowed by any type guard in the 'if' condition when true. // In the false branch statement of an 'if' statement, -// the type of a variable or parameter is narrowed by any type guard in the 'if' condition when false, -// provided the false branch statement contains no assignments to the variable or parameter +// the type of a variable or parameter is narrowed by any type guard in the 'if' condition when false. function foo(x: number | string) { if (typeof x === "string") { return x.length; // string @@ -14,54 +12,49 @@ function foo(x: number | string) { } } function foo2(x: number | string) { - // x is assigned in the if true branch, the type is not narrowed if (typeof x === "string") { x = 10; - return x; // string | number + return x; // number } else { - return x; // string | number + return x; // number } } function foo3(x: number | string) { - // x is assigned in the if true branch, the type is not narrowed if (typeof x === "string") { - x = "Hello"; // even though assigned using same type as narrowed expression - return x; // string | number + x = "Hello"; + return x; // string } else { - return x; // string | number + return x; // number } } function foo4(x: number | string) { - // false branch updates the variable - so here it is not number if (typeof x === "string") { - return x; // string | number + return x; // string } else { - x = 10; // even though assigned number - this should result in x to be string | number - return x; // string | number + x = 10; + return x; // number } } function foo5(x: number | string) { - // false branch updates the variable - so here it is not number if (typeof x === "string") { - return x; // string | number + return x; // string } else { x = "hello"; - return x; // string | number + return x; // string } } function foo6(x: number | string) { - // Modify in both branches if (typeof x === "string") { x = 10; - return x; // string | number + return x; // number } else { x = "hello"; - return x; // string | number + return x; // string } } function foo7(x: number | string | boolean) { @@ -150,11 +143,9 @@ function foo12(x: number | string | boolean) { //// [typeGuardsInIfStatement.js] // In the true branch statement of an 'if' statement, -// the type of a variable or parameter is narrowed by any type guard in the 'if' condition when true, -// provided the true branch statement contains no assignments to the variable or parameter. +// the type of a variable or parameter is narrowed by any type guard in the 'if' condition when true. // In the false branch statement of an 'if' statement, -// the type of a variable or parameter is narrowed by any type guard in the 'if' condition when false, -// provided the false branch statement contains no assignments to the variable or parameter +// the type of a variable or parameter is narrowed by any type guard in the 'if' condition when false. function foo(x) { if (typeof x === "string") { return x.length; // string @@ -164,54 +155,49 @@ function foo(x) { } } function foo2(x) { - // x is assigned in the if true branch, the type is not narrowed if (typeof x === "string") { x = 10; - return x; // string | number + return x; // number } else { - return x; // string | number + return x; // number } } function foo3(x) { - // x is assigned in the if true branch, the type is not narrowed if (typeof x === "string") { - x = "Hello"; // even though assigned using same type as narrowed expression - return x; // string | number + x = "Hello"; + return x; // string } else { - return x; // string | number + return x; // number } } function foo4(x) { - // false branch updates the variable - so here it is not number if (typeof x === "string") { - return x; // string | number + return x; // string } else { - x = 10; // even though assigned number - this should result in x to be string | number - return x; // string | number + x = 10; + return x; // number } } function foo5(x) { - // false branch updates the variable - so here it is not number if (typeof x === "string") { - return x; // string | number + return x; // string } else { x = "hello"; - return x; // string | number + return x; // string } } function foo6(x) { - // Modify in both branches if (typeof x === "string") { x = 10; - return x; // string | number + return x; // number } else { x = "hello"; - return x; // string | number + return x; // string } } function foo7(x) { diff --git a/tests/baselines/reference/typeGuardsInIfStatement.symbols b/tests/baselines/reference/typeGuardsInIfStatement.symbols deleted file mode 100644 index 54a65f0693b..00000000000 --- a/tests/baselines/reference/typeGuardsInIfStatement.symbols +++ /dev/null @@ -1,304 +0,0 @@ -=== tests/cases/conformance/expressions/typeGuards/typeGuardsInIfStatement.ts === -// In the true branch statement of an 'if' statement, -// the type of a variable or parameter is narrowed by any type guard in the 'if' condition when true, -// provided the true branch statement contains no assignments to the variable or parameter. -// In the false branch statement of an 'if' statement, -// the type of a variable or parameter is narrowed by any type guard in the 'if' condition when false, -// provided the false branch statement contains no assignments to the variable or parameter -function foo(x: number | string) { ->foo : Symbol(foo, Decl(typeGuardsInIfStatement.ts, 0, 0)) ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 6, 13)) - - if (typeof x === "string") { ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 6, 13)) - - return x.length; // string ->x.length : Symbol(String.length, Decl(lib.d.ts, --, --)) ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 6, 13)) ->length : Symbol(String.length, Decl(lib.d.ts, --, --)) - } - else { - return x++; // number ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 6, 13)) - } -} -function foo2(x: number | string) { ->foo2 : Symbol(foo2, Decl(typeGuardsInIfStatement.ts, 13, 1)) ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 14, 14)) - - // x is assigned in the if true branch, the type is not narrowed - if (typeof x === "string") { ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 14, 14)) - - x = 10; ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 14, 14)) - - return x; // string | number ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 14, 14)) - } - else { - return x; // string | number ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 14, 14)) - } -} -function foo3(x: number | string) { ->foo3 : Symbol(foo3, Decl(typeGuardsInIfStatement.ts, 23, 1)) ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 24, 14)) - - // x is assigned in the if true branch, the type is not narrowed - if (typeof x === "string") { ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 24, 14)) - - x = "Hello"; // even though assigned using same type as narrowed expression ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 24, 14)) - - return x; // string | number ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 24, 14)) - } - else { - return x; // string | number ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 24, 14)) - } -} -function foo4(x: number | string) { ->foo4 : Symbol(foo4, Decl(typeGuardsInIfStatement.ts, 33, 1)) ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 34, 14)) - - // false branch updates the variable - so here it is not number - if (typeof x === "string") { ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 34, 14)) - - return x; // string | number ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 34, 14)) - } - else { - x = 10; // even though assigned number - this should result in x to be string | number ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 34, 14)) - - return x; // string | number ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 34, 14)) - } -} -function foo5(x: number | string) { ->foo5 : Symbol(foo5, Decl(typeGuardsInIfStatement.ts, 43, 1)) ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 44, 14)) - - // false branch updates the variable - so here it is not number - if (typeof x === "string") { ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 44, 14)) - - return x; // string | number ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 44, 14)) - } - else { - x = "hello"; ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 44, 14)) - - return x; // string | number ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 44, 14)) - } -} -function foo6(x: number | string) { ->foo6 : Symbol(foo6, Decl(typeGuardsInIfStatement.ts, 53, 1)) ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 54, 14)) - - // Modify in both branches - if (typeof x === "string") { ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 54, 14)) - - x = 10; ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 54, 14)) - - return x; // string | number ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 54, 14)) - } - else { - x = "hello"; ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 54, 14)) - - return x; // string | number ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 54, 14)) - } -} -function foo7(x: number | string | boolean) { ->foo7 : Symbol(foo7, Decl(typeGuardsInIfStatement.ts, 64, 1)) ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 65, 14)) - - if (typeof x === "string") { ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 65, 14)) - - return x === "hello"; // string ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 65, 14)) - } - else if (typeof x === "boolean") { ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 65, 14)) - - return x; // boolean ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 65, 14)) - } - else { - return x == 10; // number ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 65, 14)) - } -} -function foo8(x: number | string | boolean) { ->foo8 : Symbol(foo8, Decl(typeGuardsInIfStatement.ts, 75, 1)) ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 76, 14)) - - if (typeof x === "string") { ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 76, 14)) - - return x === "hello"; // string ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 76, 14)) - } - else { - var b: number | boolean = x; // number | boolean ->b : Symbol(b, Decl(typeGuardsInIfStatement.ts, 81, 11)) ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 76, 14)) - - if (typeof x === "boolean") { ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 76, 14)) - - return x; // boolean ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 76, 14)) - } - else { - return x == 10; // number ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 76, 14)) - } - } -} -function foo9(x: number | string) { ->foo9 : Symbol(foo9, Decl(typeGuardsInIfStatement.ts, 89, 1)) ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 90, 14)) - - var y = 10; ->y : Symbol(y, Decl(typeGuardsInIfStatement.ts, 91, 7)) - - if (typeof x === "string") { ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 90, 14)) - - // usage of x or assignment to separate variable shouldn't cause narrowing of type to stop - y = x.length; ->y : Symbol(y, Decl(typeGuardsInIfStatement.ts, 91, 7)) ->x.length : Symbol(String.length, Decl(lib.d.ts, --, --)) ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 90, 14)) ->length : Symbol(String.length, Decl(lib.d.ts, --, --)) - - return x === "hello"; // string ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 90, 14)) - } - else { - return x == 10; // number ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 90, 14)) - } -} -function foo10(x: number | string | boolean) { ->foo10 : Symbol(foo10, Decl(typeGuardsInIfStatement.ts, 100, 1)) ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 101, 15)) - - // Mixing typeguard narrowing in if statement with conditional expression typeguard - if (typeof x === "string") { ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 101, 15)) - - return x === "hello"; // string ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 101, 15)) - } - else { - var y: boolean | string; ->y : Symbol(y, Decl(typeGuardsInIfStatement.ts, 107, 11)) - - var b = x; // number | boolean ->b : Symbol(b, Decl(typeGuardsInIfStatement.ts, 108, 11)) ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 101, 15)) - - return typeof x === "number" ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 101, 15)) - - ? x === 10 // number ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 101, 15)) - - : x; // x should be boolean ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 101, 15)) - } -} -function foo11(x: number | string | boolean) { ->foo11 : Symbol(foo11, Decl(typeGuardsInIfStatement.ts, 113, 1)) ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 114, 15)) - - // Mixing typeguard narrowing in if statement with conditional expression typeguard - // Assigning value to x deep inside another guard stops narrowing of type too - if (typeof x === "string") { ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 114, 15)) - - return x; // string | number | boolean - x changed in else branch ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 114, 15)) - } - else { - var y: number| boolean | string; ->y : Symbol(y, Decl(typeGuardsInIfStatement.ts, 121, 11)) - - var b = x; // number | boolean | string - because below we are changing value of x in if statement ->b : Symbol(b, Decl(typeGuardsInIfStatement.ts, 122, 11)) ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 114, 15)) - - return typeof x === "number" ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 114, 15)) - - ? ( - // change value of x - x = 10 && x.toString() // number | boolean | string ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 114, 15)) ->x.toString : Symbol(toString, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 114, 15)) ->toString : Symbol(toString, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) - - ) - : ( - // do not change value - y = x && x.toString() // number | boolean | string ->y : Symbol(y, Decl(typeGuardsInIfStatement.ts, 121, 11)) ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 114, 15)) ->x.toString : Symbol(toString, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 114, 15)) ->toString : Symbol(toString, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) - - ); - } -} -function foo12(x: number | string | boolean) { ->foo12 : Symbol(foo12, Decl(typeGuardsInIfStatement.ts, 133, 1)) ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 134, 15)) - - // Mixing typeguard narrowing in if statement with conditional expression typeguard - // Assigning value to x in outer guard shouldn't stop narrowing in the inner expression - if (typeof x === "string") { ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 134, 15)) - - return x.toString(); // string | number | boolean - x changed in else branch ->x.toString : Symbol(toString, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 134, 15)) ->toString : Symbol(toString, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) - } - else { - x = 10; ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 134, 15)) - - var b = x; // number | boolean | string ->b : Symbol(b, Decl(typeGuardsInIfStatement.ts, 142, 11)) ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 134, 15)) - - return typeof x === "number" ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 134, 15)) - - ? x.toString() // number ->x.toString : Symbol(Number.toString, Decl(lib.d.ts, --, --)) ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 134, 15)) ->toString : Symbol(Number.toString, Decl(lib.d.ts, --, --)) - - : x.toString(); // boolean | string ->x.toString : Symbol(toString, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 134, 15)) ->toString : Symbol(toString, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) - } -} diff --git a/tests/baselines/reference/typeGuardsInIfStatement.types b/tests/baselines/reference/typeGuardsInIfStatement.types deleted file mode 100644 index 0095a7cc768..00000000000 --- a/tests/baselines/reference/typeGuardsInIfStatement.types +++ /dev/null @@ -1,405 +0,0 @@ -=== tests/cases/conformance/expressions/typeGuards/typeGuardsInIfStatement.ts === -// In the true branch statement of an 'if' statement, -// the type of a variable or parameter is narrowed by any type guard in the 'if' condition when true, -// provided the true branch statement contains no assignments to the variable or parameter. -// In the false branch statement of an 'if' statement, -// the type of a variable or parameter is narrowed by any type guard in the 'if' condition when false, -// provided the false branch statement contains no assignments to the variable or parameter -function foo(x: number | string) { ->foo : (x: number | string) => number ->x : number | string - - if (typeof x === "string") { ->typeof x === "string" : boolean ->typeof x : string ->x : number | string ->"string" : string - - return x.length; // string ->x.length : number ->x : string ->length : number - } - else { - return x++; // number ->x++ : number ->x : number - } -} -function foo2(x: number | string) { ->foo2 : (x: number | string) => number | string ->x : number | string - - // x is assigned in the if true branch, the type is not narrowed - if (typeof x === "string") { ->typeof x === "string" : boolean ->typeof x : string ->x : number | string ->"string" : string - - x = 10; ->x = 10 : number ->x : number | string ->10 : number - - return x; // string | number ->x : number | string - } - else { - return x; // string | number ->x : number | string - } -} -function foo3(x: number | string) { ->foo3 : (x: number | string) => number | string ->x : number | string - - // x is assigned in the if true branch, the type is not narrowed - if (typeof x === "string") { ->typeof x === "string" : boolean ->typeof x : string ->x : number | string ->"string" : string - - x = "Hello"; // even though assigned using same type as narrowed expression ->x = "Hello" : string ->x : number | string ->"Hello" : string - - return x; // string | number ->x : number | string - } - else { - return x; // string | number ->x : number | string - } -} -function foo4(x: number | string) { ->foo4 : (x: number | string) => number | string ->x : number | string - - // false branch updates the variable - so here it is not number - if (typeof x === "string") { ->typeof x === "string" : boolean ->typeof x : string ->x : number | string ->"string" : string - - return x; // string | number ->x : number | string - } - else { - x = 10; // even though assigned number - this should result in x to be string | number ->x = 10 : number ->x : number | string ->10 : number - - return x; // string | number ->x : number | string - } -} -function foo5(x: number | string) { ->foo5 : (x: number | string) => number | string ->x : number | string - - // false branch updates the variable - so here it is not number - if (typeof x === "string") { ->typeof x === "string" : boolean ->typeof x : string ->x : number | string ->"string" : string - - return x; // string | number ->x : number | string - } - else { - x = "hello"; ->x = "hello" : string ->x : number | string ->"hello" : string - - return x; // string | number ->x : number | string - } -} -function foo6(x: number | string) { ->foo6 : (x: number | string) => number | string ->x : number | string - - // Modify in both branches - if (typeof x === "string") { ->typeof x === "string" : boolean ->typeof x : string ->x : number | string ->"string" : string - - x = 10; ->x = 10 : number ->x : number | string ->10 : number - - return x; // string | number ->x : number | string - } - else { - x = "hello"; ->x = "hello" : string ->x : number | string ->"hello" : string - - return x; // string | number ->x : number | string - } -} -function foo7(x: number | string | boolean) { ->foo7 : (x: number | string | boolean) => boolean ->x : number | string | boolean - - if (typeof x === "string") { ->typeof x === "string" : boolean ->typeof x : string ->x : number | string | boolean ->"string" : string - - return x === "hello"; // string ->x === "hello" : boolean ->x : string ->"hello" : string - } - else if (typeof x === "boolean") { ->typeof x === "boolean" : boolean ->typeof x : string ->x : number | boolean ->"boolean" : string - - return x; // boolean ->x : boolean - } - else { - return x == 10; // number ->x == 10 : boolean ->x : number ->10 : number - } -} -function foo8(x: number | string | boolean) { ->foo8 : (x: number | string | boolean) => boolean ->x : number | string | boolean - - if (typeof x === "string") { ->typeof x === "string" : boolean ->typeof x : string ->x : number | string | boolean ->"string" : string - - return x === "hello"; // string ->x === "hello" : boolean ->x : string ->"hello" : string - } - else { - var b: number | boolean = x; // number | boolean ->b : number | boolean ->x : number | boolean - - if (typeof x === "boolean") { ->typeof x === "boolean" : boolean ->typeof x : string ->x : number | boolean ->"boolean" : string - - return x; // boolean ->x : boolean - } - else { - return x == 10; // number ->x == 10 : boolean ->x : number ->10 : number - } - } -} -function foo9(x: number | string) { ->foo9 : (x: number | string) => boolean ->x : number | string - - var y = 10; ->y : number ->10 : number - - if (typeof x === "string") { ->typeof x === "string" : boolean ->typeof x : string ->x : number | string ->"string" : string - - // usage of x or assignment to separate variable shouldn't cause narrowing of type to stop - y = x.length; ->y = x.length : number ->y : number ->x.length : number ->x : string ->length : number - - return x === "hello"; // string ->x === "hello" : boolean ->x : string ->"hello" : string - } - else { - return x == 10; // number ->x == 10 : boolean ->x : number ->10 : number - } -} -function foo10(x: number | string | boolean) { ->foo10 : (x: number | string | boolean) => boolean ->x : number | string | boolean - - // Mixing typeguard narrowing in if statement with conditional expression typeguard - if (typeof x === "string") { ->typeof x === "string" : boolean ->typeof x : string ->x : number | string | boolean ->"string" : string - - return x === "hello"; // string ->x === "hello" : boolean ->x : string ->"hello" : string - } - else { - var y: boolean | string; ->y : boolean | string - - var b = x; // number | boolean ->b : number | boolean ->x : number | boolean - - return typeof x === "number" ->typeof x === "number" ? x === 10 // number : x : boolean ->typeof x === "number" : boolean ->typeof x : string ->x : number | boolean ->"number" : string - - ? x === 10 // number ->x === 10 : boolean ->x : number ->10 : number - - : x; // x should be boolean ->x : boolean - } -} -function foo11(x: number | string | boolean) { ->foo11 : (x: number | string | boolean) => number | string | boolean ->x : number | string | boolean - - // Mixing typeguard narrowing in if statement with conditional expression typeguard - // Assigning value to x deep inside another guard stops narrowing of type too - if (typeof x === "string") { ->typeof x === "string" : boolean ->typeof x : string ->x : number | string | boolean ->"string" : string - - return x; // string | number | boolean - x changed in else branch ->x : number | string | boolean - } - else { - var y: number| boolean | string; ->y : number | boolean | string - - var b = x; // number | boolean | string - because below we are changing value of x in if statement ->b : number | string | boolean ->x : number | string | boolean - - return typeof x === "number" ->typeof x === "number" ? ( // change value of x x = 10 && x.toString() // number | boolean | string ) : ( // do not change value y = x && x.toString() // number | boolean | string ) : string ->typeof x === "number" : boolean ->typeof x : string ->x : number | string | boolean ->"number" : string - - ? ( ->( // change value of x x = 10 && x.toString() // number | boolean | string ) : string - - // change value of x - x = 10 && x.toString() // number | boolean | string ->x = 10 && x.toString() : string ->x : number | string | boolean ->10 && x.toString() : string ->10 : number ->x.toString() : string ->x.toString : (radix?: number) => string ->x : number | string | boolean ->toString : (radix?: number) => string - - ) - : ( ->( // do not change value y = x && x.toString() // number | boolean | string ) : string - - // do not change value - y = x && x.toString() // number | boolean | string ->y = x && x.toString() : string ->y : number | boolean | string ->x && x.toString() : string ->x : number | string | boolean ->x.toString() : string ->x.toString : (radix?: number) => string ->x : number | string | boolean ->toString : (radix?: number) => string - - ); - } -} -function foo12(x: number | string | boolean) { ->foo12 : (x: number | string | boolean) => string ->x : number | string | boolean - - // Mixing typeguard narrowing in if statement with conditional expression typeguard - // Assigning value to x in outer guard shouldn't stop narrowing in the inner expression - if (typeof x === "string") { ->typeof x === "string" : boolean ->typeof x : string ->x : number | string | boolean ->"string" : string - - return x.toString(); // string | number | boolean - x changed in else branch ->x.toString() : string ->x.toString : (radix?: number) => string ->x : number | string | boolean ->toString : (radix?: number) => string - } - else { - x = 10; ->x = 10 : number ->x : number | string | boolean ->10 : number - - var b = x; // number | boolean | string ->b : number | string | boolean ->x : number | string | boolean - - return typeof x === "number" ->typeof x === "number" ? x.toString() // number : x.toString() : string ->typeof x === "number" : boolean ->typeof x : string ->x : number | string | boolean ->"number" : string - - ? x.toString() // number ->x.toString() : string ->x.toString : (radix?: number) => string ->x : number ->toString : (radix?: number) => string - - : x.toString(); // boolean | string ->x.toString() : string ->x.toString : () => string ->x : string | boolean ->toString : () => string - } -} diff --git a/tests/baselines/reference/typeGuardsInModule.types b/tests/baselines/reference/typeGuardsInModule.types index 6b6c552f0cc..7d3753037ad 100644 --- a/tests/baselines/reference/typeGuardsInModule.types +++ b/tests/baselines/reference/typeGuardsInModule.types @@ -64,15 +64,15 @@ module m1 { >"string" : string strOrNum = var3; // string | number ->strOrNum = var3 : string | number +>strOrNum = var3 : string >strOrNum : string | number ->var3 : string | number +>var3 : string } else { strOrNum = var3; // string | number ->strOrNum = var3 : string | number +>strOrNum = var3 : number >strOrNum : string | number ->var3 : string | number +>var3 : number } } // local module @@ -116,14 +116,14 @@ module m2 { // exported variable from outer the module strOrNum = typeof var3 === "string" && var3; // string | number ->strOrNum = typeof var3 === "string" && var3 : string | number +>strOrNum = typeof var3 === "string" && var3 : string >strOrNum : string | number ->typeof var3 === "string" && var3 : string | number +>typeof var3 === "string" && var3 : string >typeof var3 === "string" : boolean >typeof var3 : string >var3 : string | number >"string" : string ->var3 : string | number +>var3 : string // variables in module declaration var var4: string | number; @@ -160,15 +160,15 @@ module m2 { >"string" : string strOrNum = var5; // string | number ->strOrNum = var5 : string | number +>strOrNum = var5 : string >strOrNum : string | number ->var5 : string | number +>var5 : string } else { strOrNum = var5; // string | number ->strOrNum = var5 : string | number +>strOrNum = var5 : number >strOrNum : string | number ->var5 : string | number +>var5 : number } } } @@ -225,15 +225,15 @@ module m3.m4 { >"string" : string strOrNum = var3; // string | number ->strOrNum = var3 : string | number +>strOrNum = var3 : string >strOrNum : string | number ->var3 : string | number +>var3 : string } else { strOrNum = var3; // string | number ->strOrNum = var3 : string | number +>strOrNum = var3 : number >strOrNum : string | number ->var3 : string | number +>var3 : number } } diff --git a/tests/baselines/reference/typeGuardsInProperties.symbols b/tests/baselines/reference/typeGuardsInProperties.symbols index 61a4a9c2fdb..86faad794fe 100644 --- a/tests/baselines/reference/typeGuardsInProperties.symbols +++ b/tests/baselines/reference/typeGuardsInProperties.symbols @@ -13,47 +13,47 @@ class C1 { >C1 : Symbol(C1, Decl(typeGuardsInProperties.ts, 5, 30)) private pp1: string | number; ->pp1 : Symbol(pp1, Decl(typeGuardsInProperties.ts, 6, 10)) +>pp1 : Symbol(C1.pp1, Decl(typeGuardsInProperties.ts, 6, 10)) pp2: string | number; ->pp2 : Symbol(pp2, Decl(typeGuardsInProperties.ts, 7, 33)) +>pp2 : Symbol(C1.pp2, Decl(typeGuardsInProperties.ts, 7, 33)) // Inside public accessor getter get pp3() { ->pp3 : Symbol(pp3, Decl(typeGuardsInProperties.ts, 8, 25)) +>pp3 : Symbol(C1.pp3, Decl(typeGuardsInProperties.ts, 8, 25)) return strOrNum; >strOrNum : Symbol(strOrNum, Decl(typeGuardsInProperties.ts, 5, 3)) } method() { ->method : Symbol(method, Decl(typeGuardsInProperties.ts, 12, 5)) +>method : Symbol(C1.method, Decl(typeGuardsInProperties.ts, 12, 5)) strOrNum = typeof this.pp1 === "string" && this.pp1; // string | number >strOrNum : Symbol(strOrNum, Decl(typeGuardsInProperties.ts, 5, 3)) ->this.pp1 : Symbol(pp1, Decl(typeGuardsInProperties.ts, 6, 10)) +>this.pp1 : Symbol(C1.pp1, Decl(typeGuardsInProperties.ts, 6, 10)) >this : Symbol(C1, Decl(typeGuardsInProperties.ts, 5, 30)) ->pp1 : Symbol(pp1, Decl(typeGuardsInProperties.ts, 6, 10)) ->this.pp1 : Symbol(pp1, Decl(typeGuardsInProperties.ts, 6, 10)) +>pp1 : Symbol(C1.pp1, Decl(typeGuardsInProperties.ts, 6, 10)) +>this.pp1 : Symbol(C1.pp1, Decl(typeGuardsInProperties.ts, 6, 10)) >this : Symbol(C1, Decl(typeGuardsInProperties.ts, 5, 30)) ->pp1 : Symbol(pp1, Decl(typeGuardsInProperties.ts, 6, 10)) +>pp1 : Symbol(C1.pp1, Decl(typeGuardsInProperties.ts, 6, 10)) strOrNum = typeof this.pp2 === "string" && this.pp2; // string | number >strOrNum : Symbol(strOrNum, Decl(typeGuardsInProperties.ts, 5, 3)) ->this.pp2 : Symbol(pp2, Decl(typeGuardsInProperties.ts, 7, 33)) +>this.pp2 : Symbol(C1.pp2, Decl(typeGuardsInProperties.ts, 7, 33)) >this : Symbol(C1, Decl(typeGuardsInProperties.ts, 5, 30)) ->pp2 : Symbol(pp2, Decl(typeGuardsInProperties.ts, 7, 33)) ->this.pp2 : Symbol(pp2, Decl(typeGuardsInProperties.ts, 7, 33)) +>pp2 : Symbol(C1.pp2, Decl(typeGuardsInProperties.ts, 7, 33)) +>this.pp2 : Symbol(C1.pp2, Decl(typeGuardsInProperties.ts, 7, 33)) >this : Symbol(C1, Decl(typeGuardsInProperties.ts, 5, 30)) ->pp2 : Symbol(pp2, Decl(typeGuardsInProperties.ts, 7, 33)) +>pp2 : Symbol(C1.pp2, Decl(typeGuardsInProperties.ts, 7, 33)) strOrNum = typeof this.pp3 === "string" && this.pp3; // string | number >strOrNum : Symbol(strOrNum, Decl(typeGuardsInProperties.ts, 5, 3)) ->this.pp3 : Symbol(pp3, Decl(typeGuardsInProperties.ts, 8, 25)) +>this.pp3 : Symbol(C1.pp3, Decl(typeGuardsInProperties.ts, 8, 25)) >this : Symbol(C1, Decl(typeGuardsInProperties.ts, 5, 30)) ->pp3 : Symbol(pp3, Decl(typeGuardsInProperties.ts, 8, 25)) ->this.pp3 : Symbol(pp3, Decl(typeGuardsInProperties.ts, 8, 25)) +>pp3 : Symbol(C1.pp3, Decl(typeGuardsInProperties.ts, 8, 25)) +>this.pp3 : Symbol(C1.pp3, Decl(typeGuardsInProperties.ts, 8, 25)) >this : Symbol(C1, Decl(typeGuardsInProperties.ts, 5, 30)) ->pp3 : Symbol(pp3, Decl(typeGuardsInProperties.ts, 8, 25)) +>pp3 : Symbol(C1.pp3, Decl(typeGuardsInProperties.ts, 8, 25)) } } var c1: C1; diff --git a/tests/baselines/reference/typeGuardsInProperties.types b/tests/baselines/reference/typeGuardsInProperties.types index ca4d8b94527..4ddf8af7a67 100644 --- a/tests/baselines/reference/typeGuardsInProperties.types +++ b/tests/baselines/reference/typeGuardsInProperties.types @@ -29,46 +29,46 @@ class C1 { >method : () => void strOrNum = typeof this.pp1 === "string" && this.pp1; // string | number ->strOrNum = typeof this.pp1 === "string" && this.pp1 : string | number +>strOrNum = typeof this.pp1 === "string" && this.pp1 : string >strOrNum : string | number ->typeof this.pp1 === "string" && this.pp1 : string | number +>typeof this.pp1 === "string" && this.pp1 : string >typeof this.pp1 === "string" : boolean >typeof this.pp1 : string >this.pp1 : string | number >this : this >pp1 : string | number >"string" : string ->this.pp1 : string | number +>this.pp1 : string >this : this ->pp1 : string | number +>pp1 : string strOrNum = typeof this.pp2 === "string" && this.pp2; // string | number ->strOrNum = typeof this.pp2 === "string" && this.pp2 : string | number +>strOrNum = typeof this.pp2 === "string" && this.pp2 : string >strOrNum : string | number ->typeof this.pp2 === "string" && this.pp2 : string | number +>typeof this.pp2 === "string" && this.pp2 : string >typeof this.pp2 === "string" : boolean >typeof this.pp2 : string >this.pp2 : string | number >this : this >pp2 : string | number >"string" : string ->this.pp2 : string | number +>this.pp2 : string >this : this ->pp2 : string | number +>pp2 : string strOrNum = typeof this.pp3 === "string" && this.pp3; // string | number ->strOrNum = typeof this.pp3 === "string" && this.pp3 : string | number +>strOrNum = typeof this.pp3 === "string" && this.pp3 : string >strOrNum : string | number ->typeof this.pp3 === "string" && this.pp3 : string | number +>typeof this.pp3 === "string" && this.pp3 : string >typeof this.pp3 === "string" : boolean >typeof this.pp3 : string >this.pp3 : string | number >this : this >pp3 : string | number >"string" : string ->this.pp3 : string | number +>this.pp3 : string >this : this ->pp3 : string | number +>pp3 : string } } var c1: C1; @@ -76,32 +76,32 @@ var c1: C1; >C1 : C1 strOrNum = typeof c1.pp2 === "string" && c1.pp2; // string | number ->strOrNum = typeof c1.pp2 === "string" && c1.pp2 : string | number +>strOrNum = typeof c1.pp2 === "string" && c1.pp2 : string >strOrNum : string | number ->typeof c1.pp2 === "string" && c1.pp2 : string | number +>typeof c1.pp2 === "string" && c1.pp2 : string >typeof c1.pp2 === "string" : boolean >typeof c1.pp2 : string >c1.pp2 : string | number >c1 : C1 >pp2 : string | number >"string" : string ->c1.pp2 : string | number +>c1.pp2 : string >c1 : C1 ->pp2 : string | number +>pp2 : string strOrNum = typeof c1.pp3 === "string" && c1.pp3; // string | number ->strOrNum = typeof c1.pp3 === "string" && c1.pp3 : string | number +>strOrNum = typeof c1.pp3 === "string" && c1.pp3 : string >strOrNum : string | number ->typeof c1.pp3 === "string" && c1.pp3 : string | number +>typeof c1.pp3 === "string" && c1.pp3 : string >typeof c1.pp3 === "string" : boolean >typeof c1.pp3 : string >c1.pp3 : string | number >c1 : C1 >pp3 : string | number >"string" : string ->c1.pp3 : string | number +>c1.pp3 : string >c1 : C1 ->pp3 : string | number +>pp3 : string var obj1: { >obj1 : { x: string | number; } @@ -111,16 +111,16 @@ var obj1: { }; strOrNum = typeof obj1.x === "string" && obj1.x; // string | number ->strOrNum = typeof obj1.x === "string" && obj1.x : string | number +>strOrNum = typeof obj1.x === "string" && obj1.x : string >strOrNum : string | number ->typeof obj1.x === "string" && obj1.x : string | number +>typeof obj1.x === "string" && obj1.x : string >typeof obj1.x === "string" : boolean >typeof obj1.x : string >obj1.x : string | number >obj1 : { x: string | number; } >x : string | number >"string" : string ->obj1.x : string | number +>obj1.x : string >obj1 : { x: string | number; } ->x : string | number +>x : string diff --git a/tests/baselines/reference/typeGuardsInRightOperandOfAndAndOperator.js b/tests/baselines/reference/typeGuardsInRightOperandOfAndAndOperator.js index e3f1a8c72c2..be1c497e3ea 100644 --- a/tests/baselines/reference/typeGuardsInRightOperandOfAndAndOperator.js +++ b/tests/baselines/reference/typeGuardsInRightOperandOfAndAndOperator.js @@ -1,7 +1,6 @@ //// [typeGuardsInRightOperandOfAndAndOperator.ts] // In the right operand of a && operation, -// the type of a variable or parameter is narrowed by any type guard in the left operand when true, -// provided the right operand contains no assignments to the variable or parameter. +// the type of a variable or parameter is narrowed by any type guard in the left operand when true. function foo(x: number | string) { return typeof x === "string" && x.length === 10; // string } @@ -36,29 +35,19 @@ function foo7(x: number | string | boolean) { var y: number| boolean | string; var z: number| boolean | string; // Mixing typeguard narrowing - // Assigning value to x deep inside another guard stops narrowing of type too return typeof x !== "string" - && ((z = x) // string | number | boolean - x changed deeper in conditional expression + && ((z = x) // number | boolean && (typeof x === "number" // change value of x - ? (x = 10 && x.toString()) // number | boolean | string + ? ((x = 10) && x.toString()) // x is number // do not change value - : (y = x && x.toString()))); // number | boolean | string + : ((y = x) && x.toString()))); // x is boolean } -function foo8(x: number | string) { - // Mixing typeguard - // Assigning value to x in outer guard shouldn't stop narrowing in the inner expression - return typeof x !== "string" - && (x = 10) // change x - number| string - && (typeof x === "number" - ? x // number - : x.length); // string -} + //// [typeGuardsInRightOperandOfAndAndOperator.js] // In the right operand of a && operation, -// the type of a variable or parameter is narrowed by any type guard in the left operand when true, -// provided the right operand contains no assignments to the variable or parameter. +// the type of a variable or parameter is narrowed by any type guard in the left operand when true. function foo(x) { return typeof x === "string" && x.length === 10; // string } @@ -93,19 +82,9 @@ function foo7(x) { var y; var z; // Mixing typeguard narrowing - // Assigning value to x deep inside another guard stops narrowing of type too return typeof x !== "string" - && ((z = x) // string | number | boolean - x changed deeper in conditional expression + && ((z = x) // number | boolean && (typeof x === "number" - ? (x = 10 && x.toString()) // number | boolean | string - : (y = x && x.toString()))); // number | boolean | string -} -function foo8(x) { - // Mixing typeguard - // Assigning value to x in outer guard shouldn't stop narrowing in the inner expression - return typeof x !== "string" - && (x = 10) // change x - number| string - && (typeof x === "number" - ? x // number - : x.length); // string + ? ((x = 10) && x.toString()) // x is number + : ((y = x) && x.toString()))); // x is boolean } diff --git a/tests/baselines/reference/typeGuardsInRightOperandOfAndAndOperator.symbols b/tests/baselines/reference/typeGuardsInRightOperandOfAndAndOperator.symbols index 21e3dd3701f..4028edb6b42 100644 --- a/tests/baselines/reference/typeGuardsInRightOperandOfAndAndOperator.symbols +++ b/tests/baselines/reference/typeGuardsInRightOperandOfAndAndOperator.symbols @@ -1,143 +1,119 @@ === tests/cases/conformance/expressions/typeGuards/typeGuardsInRightOperandOfAndAndOperator.ts === // In the right operand of a && operation, -// the type of a variable or parameter is narrowed by any type guard in the left operand when true, -// provided the right operand contains no assignments to the variable or parameter. +// the type of a variable or parameter is narrowed by any type guard in the left operand when true. function foo(x: number | string) { >foo : Symbol(foo, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 0, 0)) ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 3, 13)) +>x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 2, 13)) return typeof x === "string" && x.length === 10; // string ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 3, 13)) +>x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 2, 13)) >x.length : Symbol(String.length, Decl(lib.d.ts, --, --)) ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 3, 13)) +>x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 2, 13)) >length : Symbol(String.length, Decl(lib.d.ts, --, --)) } function foo2(x: number | string) { ->foo2 : Symbol(foo2, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 5, 1)) ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 6, 14)) +>foo2 : Symbol(foo2, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 4, 1)) +>x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 5, 14)) // modify x in right hand operand return typeof x === "string" && ((x = 10) && x); // string | number ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 6, 14)) ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 6, 14)) ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 6, 14)) +>x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 5, 14)) +>x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 5, 14)) +>x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 5, 14)) } function foo3(x: number | string) { ->foo3 : Symbol(foo3, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 9, 1)) ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 10, 14)) +>foo3 : Symbol(foo3, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 8, 1)) +>x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 9, 14)) // modify x in right hand operand with string type itself return typeof x === "string" && ((x = "hello") && x); // string | number ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 10, 14)) ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 10, 14)) ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 10, 14)) +>x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 9, 14)) +>x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 9, 14)) +>x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 9, 14)) } function foo4(x: number | string | boolean) { ->foo4 : Symbol(foo4, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 13, 1)) ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 14, 14)) +>foo4 : Symbol(foo4, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 12, 1)) +>x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 13, 14)) return typeof x !== "string" // string | number | boolean ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 14, 14)) +>x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 13, 14)) && typeof x !== "number" // number | boolean ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 14, 14)) +>x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 13, 14)) && x; // boolean ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 14, 14)) +>x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 13, 14)) } function foo5(x: number | string | boolean) { ->foo5 : Symbol(foo5, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 18, 1)) ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 19, 14)) +>foo5 : Symbol(foo5, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 17, 1)) +>x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 18, 14)) // usage of x or assignment to separate variable shouldn't cause narrowing of type to stop var b: number | boolean; ->b : Symbol(b, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 21, 7)) +>b : Symbol(b, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 20, 7)) return typeof x !== "string" // string | number | boolean ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 19, 14)) +>x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 18, 14)) && ((b = x) && (typeof x !== "number" // number | boolean ->b : Symbol(b, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 21, 7)) ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 19, 14)) ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 19, 14)) +>b : Symbol(b, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 20, 7)) +>x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 18, 14)) +>x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 18, 14)) && x)); // boolean ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 19, 14)) +>x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 18, 14)) } function foo6(x: number | string | boolean) { ->foo6 : Symbol(foo6, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 25, 1)) ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 26, 14)) +>foo6 : Symbol(foo6, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 24, 1)) +>x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 25, 14)) // Mixing typeguard narrowing in if statement with conditional expression typeguard return typeof x !== "string" // string | number | boolean ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 26, 14)) +>x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 25, 14)) && (typeof x !== "number" // number | boolean ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 26, 14)) +>x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 25, 14)) ? x // boolean ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 26, 14)) +>x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 25, 14)) : x === 10) // number ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 26, 14)) +>x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 25, 14)) } function foo7(x: number | string | boolean) { ->foo7 : Symbol(foo7, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 32, 1)) ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 33, 14)) +>foo7 : Symbol(foo7, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 31, 1)) +>x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 32, 14)) var y: number| boolean | string; ->y : Symbol(y, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 34, 7)) +>y : Symbol(y, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 33, 7)) var z: number| boolean | string; ->z : Symbol(z, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 35, 7)) +>z : Symbol(z, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 34, 7)) // Mixing typeguard narrowing - // Assigning value to x deep inside another guard stops narrowing of type too return typeof x !== "string" ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 33, 14)) +>x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 32, 14)) - && ((z = x) // string | number | boolean - x changed deeper in conditional expression ->z : Symbol(z, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 35, 7)) ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 33, 14)) + && ((z = x) // number | boolean +>z : Symbol(z, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 34, 7)) +>x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 32, 14)) && (typeof x === "number" ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 33, 14)) +>x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 32, 14)) // change value of x - ? (x = 10 && x.toString()) // number | boolean | string ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 33, 14)) ->x.toString : Symbol(toString, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 33, 14)) ->toString : Symbol(toString, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) + ? ((x = 10) && x.toString()) // x is number +>x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 32, 14)) +>x.toString : Symbol(Number.toString, Decl(lib.d.ts, --, --)) +>x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 32, 14)) +>toString : Symbol(Number.toString, Decl(lib.d.ts, --, --)) // do not change value - : (y = x && x.toString()))); // number | boolean | string ->y : Symbol(y, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 34, 7)) ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 33, 14)) ->x.toString : Symbol(toString, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 33, 14)) ->toString : Symbol(toString, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) + : ((y = x) && x.toString()))); // x is boolean +>y : Symbol(y, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 33, 7)) +>x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 32, 14)) +>x.toString : Symbol(Object.toString, Decl(lib.d.ts, --, --)) +>x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 32, 14)) +>toString : Symbol(Object.toString, Decl(lib.d.ts, --, --)) } -function foo8(x: number | string) { ->foo8 : Symbol(foo8, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 45, 1)) ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 46, 14)) - // Mixing typeguard - // Assigning value to x in outer guard shouldn't stop narrowing in the inner expression - return typeof x !== "string" ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 46, 14)) - - && (x = 10) // change x - number| string ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 46, 14)) - - && (typeof x === "number" ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 46, 14)) - - ? x // number ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 46, 14)) - - : x.length); // string ->x.length : Symbol(String.length, Decl(lib.d.ts, --, --)) ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 46, 14)) ->length : Symbol(String.length, Decl(lib.d.ts, --, --)) -} diff --git a/tests/baselines/reference/typeGuardsInRightOperandOfAndAndOperator.types b/tests/baselines/reference/typeGuardsInRightOperandOfAndAndOperator.types index 22d390618c1..2da52b8b1b8 100644 --- a/tests/baselines/reference/typeGuardsInRightOperandOfAndAndOperator.types +++ b/tests/baselines/reference/typeGuardsInRightOperandOfAndAndOperator.types @@ -1,7 +1,6 @@ === tests/cases/conformance/expressions/typeGuards/typeGuardsInRightOperandOfAndAndOperator.ts === // In the right operand of a && operation, -// the type of a variable or parameter is narrowed by any type guard in the left operand when true, -// provided the right operand contains no assignments to the variable or parameter. +// the type of a variable or parameter is narrowed by any type guard in the left operand when true. function foo(x: number | string) { >foo : (x: number | string) => boolean >x : number | string @@ -19,42 +18,42 @@ function foo(x: number | string) { >10 : number } function foo2(x: number | string) { ->foo2 : (x: number | string) => number | string +>foo2 : (x: number | string) => number >x : number | string // modify x in right hand operand return typeof x === "string" && ((x = 10) && x); // string | number ->typeof x === "string" && ((x = 10) && x) : number | string +>typeof x === "string" && ((x = 10) && x) : number >typeof x === "string" : boolean >typeof x : string >x : number | string >"string" : string ->((x = 10) && x) : number | string ->(x = 10) && x : number | string +>((x = 10) && x) : number +>(x = 10) && x : number >(x = 10) : number >x = 10 : number >x : number | string >10 : number ->x : number | string +>x : number } function foo3(x: number | string) { ->foo3 : (x: number | string) => number | string +>foo3 : (x: number | string) => string >x : number | string // modify x in right hand operand with string type itself return typeof x === "string" && ((x = "hello") && x); // string | number ->typeof x === "string" && ((x = "hello") && x) : number | string +>typeof x === "string" && ((x = "hello") && x) : string >typeof x === "string" : boolean >typeof x : string >x : number | string >"string" : string ->((x = "hello") && x) : number | string ->(x = "hello") && x : number | string +>((x = "hello") && x) : string +>(x = "hello") && x : string >(x = "hello") : string >x = "hello" : string >x : number | string >"hello" : string ->x : number | string +>x : string } function foo4(x: number | string | boolean) { >foo4 : (x: number | string | boolean) => boolean @@ -148,87 +147,53 @@ function foo7(x: number | string | boolean) { >z : number | boolean | string // Mixing typeguard narrowing - // Assigning value to x deep inside another guard stops narrowing of type too return typeof x !== "string" ->typeof x !== "string" && ((z = x) // string | number | boolean - x changed deeper in conditional expression && (typeof x === "number" // change value of x ? (x = 10 && x.toString()) // number | boolean | string // do not change value : (y = x && x.toString()))) : string +>typeof x !== "string" && ((z = x) // number | boolean && (typeof x === "number" // change value of x ? ((x = 10) && x.toString()) // x is number // do not change value : ((y = x) && x.toString()))) : string >typeof x !== "string" : boolean >typeof x : string >x : number | string | boolean >"string" : string - && ((z = x) // string | number | boolean - x changed deeper in conditional expression ->((z = x) // string | number | boolean - x changed deeper in conditional expression && (typeof x === "number" // change value of x ? (x = 10 && x.toString()) // number | boolean | string // do not change value : (y = x && x.toString()))) : string ->(z = x) // string | number | boolean - x changed deeper in conditional expression && (typeof x === "number" // change value of x ? (x = 10 && x.toString()) // number | boolean | string // do not change value : (y = x && x.toString())) : string ->(z = x) : number | string | boolean ->z = x : number | string | boolean + && ((z = x) // number | boolean +>((z = x) // number | boolean && (typeof x === "number" // change value of x ? ((x = 10) && x.toString()) // x is number // do not change value : ((y = x) && x.toString()))) : string +>(z = x) // number | boolean && (typeof x === "number" // change value of x ? ((x = 10) && x.toString()) // x is number // do not change value : ((y = x) && x.toString())) : string +>(z = x) : number | boolean +>z = x : number | boolean >z : number | boolean | string ->x : number | string | boolean +>x : number | boolean && (typeof x === "number" ->(typeof x === "number" // change value of x ? (x = 10 && x.toString()) // number | boolean | string // do not change value : (y = x && x.toString())) : string ->typeof x === "number" // change value of x ? (x = 10 && x.toString()) // number | boolean | string // do not change value : (y = x && x.toString()) : string +>(typeof x === "number" // change value of x ? ((x = 10) && x.toString()) // x is number // do not change value : ((y = x) && x.toString())) : string +>typeof x === "number" // change value of x ? ((x = 10) && x.toString()) // x is number // do not change value : ((y = x) && x.toString()) : string >typeof x === "number" : boolean >typeof x : string ->x : number | string | boolean +>x : number | boolean >"number" : string // change value of x - ? (x = 10 && x.toString()) // number | boolean | string ->(x = 10 && x.toString()) : string ->x = 10 && x.toString() : string + ? ((x = 10) && x.toString()) // x is number +>((x = 10) && x.toString()) : string +>(x = 10) && x.toString() : string +>(x = 10) : number +>x = 10 : number >x : number | string | boolean ->10 && x.toString() : string >10 : number >x.toString() : string >x.toString : (radix?: number) => string ->x : number | string | boolean +>x : number >toString : (radix?: number) => string // do not change value - : (y = x && x.toString()))); // number | boolean | string ->(y = x && x.toString()) : string ->y = x && x.toString() : string + : ((y = x) && x.toString()))); // x is boolean +>((y = x) && x.toString()) : string +>(y = x) && x.toString() : string +>(y = x) : boolean +>y = x : boolean >y : number | boolean | string ->x && x.toString() : string ->x : number | string | boolean +>x : boolean >x.toString() : string ->x.toString : (radix?: number) => string ->x : number | string | boolean ->toString : (radix?: number) => string +>x.toString : () => string +>x : boolean +>toString : () => string } -function foo8(x: number | string) { ->foo8 : (x: number | string) => number ->x : number | string - // Mixing typeguard - // Assigning value to x in outer guard shouldn't stop narrowing in the inner expression - return typeof x !== "string" ->typeof x !== "string" && (x = 10) // change x - number| string && (typeof x === "number" ? x // number : x.length) : number ->typeof x !== "string" && (x = 10) : number ->typeof x !== "string" : boolean ->typeof x : string ->x : number | string ->"string" : string - - && (x = 10) // change x - number| string ->(x = 10) : number ->x = 10 : number ->x : number | string ->10 : number - - && (typeof x === "number" ->(typeof x === "number" ? x // number : x.length) : number ->typeof x === "number" ? x // number : x.length : number ->typeof x === "number" : boolean ->typeof x : string ->x : number | string ->"number" : string - - ? x // number ->x : number - - : x.length); // string ->x.length : number ->x : string ->length : number -} diff --git a/tests/baselines/reference/typeGuardsInRightOperandOfOrOrOperator.js b/tests/baselines/reference/typeGuardsInRightOperandOfOrOrOperator.js index 188d226da13..a8d66dc5fa2 100644 --- a/tests/baselines/reference/typeGuardsInRightOperandOfOrOrOperator.js +++ b/tests/baselines/reference/typeGuardsInRightOperandOfOrOrOperator.js @@ -36,24 +36,15 @@ function foo7(x: number | string | boolean) { var y: number| boolean | string; var z: number| boolean | string; // Mixing typeguard narrowing - // Assigning value to x deep inside another guard stops narrowing of type too return typeof x === "string" - || ((z = x) // string | number | boolean - x changed deeper in conditional expression + || ((z = x) // number | boolean || (typeof x === "number" // change value of x - ? (x = 10 && x.toString()) // number | boolean | string + ? ((x = 10) && x.toString()) // number | boolean | string // do not change value - : (y = x && x.toString()))); // number | boolean | string + : ((y = x) && x.toString()))); // number | boolean | string } -function foo8(x: number | string) { - // Mixing typeguard - // Assigning value to x in outer guard shouldn't stop narrowing in the inner expression - return typeof x === "string" - || (x = 10) // change x - number| string - || (typeof x === "number" - ? x // number - : x.length); // string -} + //// [typeGuardsInRightOperandOfOrOrOperator.js] // In the right operand of a || operation, @@ -93,19 +84,9 @@ function foo7(x) { var y; var z; // Mixing typeguard narrowing - // Assigning value to x deep inside another guard stops narrowing of type too return typeof x === "string" - || ((z = x) // string | number | boolean - x changed deeper in conditional expression + || ((z = x) // number | boolean || (typeof x === "number" - ? (x = 10 && x.toString()) // number | boolean | string - : (y = x && x.toString()))); // number | boolean | string -} -function foo8(x) { - // Mixing typeguard - // Assigning value to x in outer guard shouldn't stop narrowing in the inner expression - return typeof x === "string" - || (x = 10) // change x - number| string - || (typeof x === "number" - ? x // number - : x.length); // string + ? ((x = 10) && x.toString()) // number | boolean | string + : ((y = x) && x.toString()))); // number | boolean | string } diff --git a/tests/baselines/reference/typeGuardsInRightOperandOfOrOrOperator.symbols b/tests/baselines/reference/typeGuardsInRightOperandOfOrOrOperator.symbols index de9b4396d3d..b276671819a 100644 --- a/tests/baselines/reference/typeGuardsInRightOperandOfOrOrOperator.symbols +++ b/tests/baselines/reference/typeGuardsInRightOperandOfOrOrOperator.symbols @@ -92,11 +92,10 @@ function foo7(x: number | string | boolean) { >z : Symbol(z, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 35, 7)) // Mixing typeguard narrowing - // Assigning value to x deep inside another guard stops narrowing of type too return typeof x === "string" >x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 33, 14)) - || ((z = x) // string | number | boolean - x changed deeper in conditional expression + || ((z = x) // number | boolean >z : Symbol(z, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 35, 7)) >x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 33, 14)) @@ -104,40 +103,18 @@ function foo7(x: number | string | boolean) { >x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 33, 14)) // change value of x - ? (x = 10 && x.toString()) // number | boolean | string + ? ((x = 10) && x.toString()) // number | boolean | string >x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 33, 14)) ->x.toString : Symbol(toString, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>x.toString : Symbol(Number.toString, Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 33, 14)) ->toString : Symbol(toString, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>toString : Symbol(Number.toString, Decl(lib.d.ts, --, --)) // do not change value - : (y = x && x.toString()))); // number | boolean | string + : ((y = x) && x.toString()))); // number | boolean | string >y : Symbol(y, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 34, 7)) >x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 33, 14)) ->x.toString : Symbol(toString, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>x.toString : Symbol(Object.toString, Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 33, 14)) ->toString : Symbol(toString, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>toString : Symbol(Object.toString, Decl(lib.d.ts, --, --)) } -function foo8(x: number | string) { ->foo8 : Symbol(foo8, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 45, 1)) ->x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 46, 14)) - // Mixing typeguard - // Assigning value to x in outer guard shouldn't stop narrowing in the inner expression - return typeof x === "string" ->x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 46, 14)) - - || (x = 10) // change x - number| string ->x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 46, 14)) - - || (typeof x === "number" ->x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 46, 14)) - - ? x // number ->x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 46, 14)) - - : x.length); // string ->x.length : Symbol(String.length, Decl(lib.d.ts, --, --)) ->x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 46, 14)) ->length : Symbol(String.length, Decl(lib.d.ts, --, --)) -} diff --git a/tests/baselines/reference/typeGuardsInRightOperandOfOrOrOperator.types b/tests/baselines/reference/typeGuardsInRightOperandOfOrOrOperator.types index 38d9a723d3a..659182ab888 100644 --- a/tests/baselines/reference/typeGuardsInRightOperandOfOrOrOperator.types +++ b/tests/baselines/reference/typeGuardsInRightOperandOfOrOrOperator.types @@ -19,42 +19,42 @@ function foo(x: number | string) { >10 : number } function foo2(x: number | string) { ->foo2 : (x: number | string) => boolean | number | string +>foo2 : (x: number | string) => boolean | number >x : number | string // modify x in right hand operand return typeof x !== "string" || ((x = 10) || x); // string | number ->typeof x !== "string" || ((x = 10) || x) : boolean | number | string +>typeof x !== "string" || ((x = 10) || x) : boolean | number >typeof x !== "string" : boolean >typeof x : string >x : number | string >"string" : string ->((x = 10) || x) : number | string ->(x = 10) || x : number | string +>((x = 10) || x) : number +>(x = 10) || x : number >(x = 10) : number >x = 10 : number >x : number | string >10 : number ->x : number | string +>x : number } function foo3(x: number | string) { ->foo3 : (x: number | string) => boolean | string | number +>foo3 : (x: number | string) => boolean | string >x : number | string // modify x in right hand operand with string type itself return typeof x !== "string" || ((x = "hello") || x); // string | number ->typeof x !== "string" || ((x = "hello") || x) : boolean | string | number +>typeof x !== "string" || ((x = "hello") || x) : boolean | string >typeof x !== "string" : boolean >typeof x : string >x : number | string >"string" : string ->((x = "hello") || x) : string | number ->(x = "hello") || x : string | number +>((x = "hello") || x) : string +>(x = "hello") || x : string >(x = "hello") : string >x = "hello" : string >x : number | string >"hello" : string ->x : number | string +>x : string } function foo4(x: number | string | boolean) { >foo4 : (x: number | string | boolean) => boolean @@ -148,87 +148,53 @@ function foo7(x: number | string | boolean) { >z : number | boolean | string // Mixing typeguard narrowing - // Assigning value to x deep inside another guard stops narrowing of type too return typeof x === "string" ->typeof x === "string" || ((z = x) // string | number | boolean - x changed deeper in conditional expression || (typeof x === "number" // change value of x ? (x = 10 && x.toString()) // number | boolean | string // do not change value : (y = x && x.toString()))) : boolean | number | string +>typeof x === "string" || ((z = x) // number | boolean || (typeof x === "number" // change value of x ? ((x = 10) && x.toString()) // number | boolean | string // do not change value : ((y = x) && x.toString()))) : boolean | number | string >typeof x === "string" : boolean >typeof x : string >x : number | string | boolean >"string" : string - || ((z = x) // string | number | boolean - x changed deeper in conditional expression ->((z = x) // string | number | boolean - x changed deeper in conditional expression || (typeof x === "number" // change value of x ? (x = 10 && x.toString()) // number | boolean | string // do not change value : (y = x && x.toString()))) : number | string | boolean ->(z = x) // string | number | boolean - x changed deeper in conditional expression || (typeof x === "number" // change value of x ? (x = 10 && x.toString()) // number | boolean | string // do not change value : (y = x && x.toString())) : number | string | boolean ->(z = x) : number | string | boolean ->z = x : number | string | boolean + || ((z = x) // number | boolean +>((z = x) // number | boolean || (typeof x === "number" // change value of x ? ((x = 10) && x.toString()) // number | boolean | string // do not change value : ((y = x) && x.toString()))) : number | boolean | string +>(z = x) // number | boolean || (typeof x === "number" // change value of x ? ((x = 10) && x.toString()) // number | boolean | string // do not change value : ((y = x) && x.toString())) : number | boolean | string +>(z = x) : number | boolean +>z = x : number | boolean >z : number | boolean | string ->x : number | string | boolean +>x : number | boolean || (typeof x === "number" ->(typeof x === "number" // change value of x ? (x = 10 && x.toString()) // number | boolean | string // do not change value : (y = x && x.toString())) : string ->typeof x === "number" // change value of x ? (x = 10 && x.toString()) // number | boolean | string // do not change value : (y = x && x.toString()) : string +>(typeof x === "number" // change value of x ? ((x = 10) && x.toString()) // number | boolean | string // do not change value : ((y = x) && x.toString())) : string +>typeof x === "number" // change value of x ? ((x = 10) && x.toString()) // number | boolean | string // do not change value : ((y = x) && x.toString()) : string >typeof x === "number" : boolean >typeof x : string ->x : number | string | boolean +>x : number | boolean >"number" : string // change value of x - ? (x = 10 && x.toString()) // number | boolean | string ->(x = 10 && x.toString()) : string ->x = 10 && x.toString() : string + ? ((x = 10) && x.toString()) // number | boolean | string +>((x = 10) && x.toString()) : string +>(x = 10) && x.toString() : string +>(x = 10) : number +>x = 10 : number >x : number | string | boolean ->10 && x.toString() : string >10 : number >x.toString() : string >x.toString : (radix?: number) => string ->x : number | string | boolean +>x : number >toString : (radix?: number) => string // do not change value - : (y = x && x.toString()))); // number | boolean | string ->(y = x && x.toString()) : string ->y = x && x.toString() : string + : ((y = x) && x.toString()))); // number | boolean | string +>((y = x) && x.toString()) : string +>(y = x) && x.toString() : string +>(y = x) : boolean +>y = x : boolean >y : number | boolean | string ->x && x.toString() : string ->x : number | string | boolean +>x : boolean >x.toString() : string ->x.toString : (radix?: number) => string ->x : number | string | boolean ->toString : (radix?: number) => string +>x.toString : () => string +>x : boolean +>toString : () => string } -function foo8(x: number | string) { ->foo8 : (x: number | string) => boolean | number ->x : number | string - // Mixing typeguard - // Assigning value to x in outer guard shouldn't stop narrowing in the inner expression - return typeof x === "string" ->typeof x === "string" || (x = 10) // change x - number| string || (typeof x === "number" ? x // number : x.length) : boolean | number ->typeof x === "string" || (x = 10) : boolean | number ->typeof x === "string" : boolean ->typeof x : string ->x : number | string ->"string" : string - - || (x = 10) // change x - number| string ->(x = 10) : number ->x = 10 : number ->x : number | string ->10 : number - - || (typeof x === "number" ->(typeof x === "number" ? x // number : x.length) : number ->typeof x === "number" ? x // number : x.length : number ->typeof x === "number" : boolean ->typeof x : string ->x : number | string ->"number" : string - - ? x // number ->x : number - - : x.length); // string ->x.length : number ->x : string ->length : number -} diff --git a/tests/baselines/reference/typeGuardsInWhileStatement.js b/tests/baselines/reference/typeGuardsInWhileStatement.js new file mode 100644 index 00000000000..ac2ceaaf590 --- /dev/null +++ b/tests/baselines/reference/typeGuardsInWhileStatement.js @@ -0,0 +1,54 @@ +//// [typeGuardsInWhileStatement.ts] +let cond: boolean; +function a(x: string | number) { + while (typeof x === "string") { + x; // string + x = undefined; + } + x; // number +} +function b(x: string | number) { + while (typeof x === "string") { + if (cond) continue; + x; // string + x = undefined; + } + x; // number +} +function c(x: string | number) { + while (typeof x === "string") { + if (cond) break; + x; // string + x = undefined; + } + x; // string | number +} + + +//// [typeGuardsInWhileStatement.js] +var cond; +function a(x) { + while (typeof x === "string") { + x; // string + x = undefined; + } + x; // number +} +function b(x) { + while (typeof x === "string") { + if (cond) + continue; + x; // string + x = undefined; + } + x; // number +} +function c(x) { + while (typeof x === "string") { + if (cond) + break; + x; // string + x = undefined; + } + x; // string | number +} diff --git a/tests/baselines/reference/typeGuardsInWhileStatement.symbols b/tests/baselines/reference/typeGuardsInWhileStatement.symbols new file mode 100644 index 00000000000..b981943e216 --- /dev/null +++ b/tests/baselines/reference/typeGuardsInWhileStatement.symbols @@ -0,0 +1,62 @@ +=== tests/cases/conformance/expressions/typeGuards/typeGuardsInWhileStatement.ts === +let cond: boolean; +>cond : Symbol(cond, Decl(typeGuardsInWhileStatement.ts, 0, 3)) + +function a(x: string | number) { +>a : Symbol(a, Decl(typeGuardsInWhileStatement.ts, 0, 18)) +>x : Symbol(x, Decl(typeGuardsInWhileStatement.ts, 1, 11)) + + while (typeof x === "string") { +>x : Symbol(x, Decl(typeGuardsInWhileStatement.ts, 1, 11)) + + x; // string +>x : Symbol(x, Decl(typeGuardsInWhileStatement.ts, 1, 11)) + + x = undefined; +>x : Symbol(x, Decl(typeGuardsInWhileStatement.ts, 1, 11)) +>undefined : Symbol(undefined) + } + x; // number +>x : Symbol(x, Decl(typeGuardsInWhileStatement.ts, 1, 11)) +} +function b(x: string | number) { +>b : Symbol(b, Decl(typeGuardsInWhileStatement.ts, 7, 1)) +>x : Symbol(x, Decl(typeGuardsInWhileStatement.ts, 8, 11)) + + while (typeof x === "string") { +>x : Symbol(x, Decl(typeGuardsInWhileStatement.ts, 8, 11)) + + if (cond) continue; +>cond : Symbol(cond, Decl(typeGuardsInWhileStatement.ts, 0, 3)) + + x; // string +>x : Symbol(x, Decl(typeGuardsInWhileStatement.ts, 8, 11)) + + x = undefined; +>x : Symbol(x, Decl(typeGuardsInWhileStatement.ts, 8, 11)) +>undefined : Symbol(undefined) + } + x; // number +>x : Symbol(x, Decl(typeGuardsInWhileStatement.ts, 8, 11)) +} +function c(x: string | number) { +>c : Symbol(c, Decl(typeGuardsInWhileStatement.ts, 15, 1)) +>x : Symbol(x, Decl(typeGuardsInWhileStatement.ts, 16, 11)) + + while (typeof x === "string") { +>x : Symbol(x, Decl(typeGuardsInWhileStatement.ts, 16, 11)) + + if (cond) break; +>cond : Symbol(cond, Decl(typeGuardsInWhileStatement.ts, 0, 3)) + + x; // string +>x : Symbol(x, Decl(typeGuardsInWhileStatement.ts, 16, 11)) + + x = undefined; +>x : Symbol(x, Decl(typeGuardsInWhileStatement.ts, 16, 11)) +>undefined : Symbol(undefined) + } + x; // string | number +>x : Symbol(x, Decl(typeGuardsInWhileStatement.ts, 16, 11)) +} + diff --git a/tests/baselines/reference/typeGuardsInWhileStatement.types b/tests/baselines/reference/typeGuardsInWhileStatement.types new file mode 100644 index 00000000000..cde045cc621 --- /dev/null +++ b/tests/baselines/reference/typeGuardsInWhileStatement.types @@ -0,0 +1,74 @@ +=== tests/cases/conformance/expressions/typeGuards/typeGuardsInWhileStatement.ts === +let cond: boolean; +>cond : boolean + +function a(x: string | number) { +>a : (x: string | number) => void +>x : string | number + + while (typeof x === "string") { +>typeof x === "string" : boolean +>typeof x : string +>x : string | number +>"string" : string + + x; // string +>x : string + + x = undefined; +>x = undefined : undefined +>x : string | number +>undefined : undefined + } + x; // number +>x : number +} +function b(x: string | number) { +>b : (x: string | number) => void +>x : string | number + + while (typeof x === "string") { +>typeof x === "string" : boolean +>typeof x : string +>x : string | number +>"string" : string + + if (cond) continue; +>cond : boolean + + x; // string +>x : string + + x = undefined; +>x = undefined : undefined +>x : string | number +>undefined : undefined + } + x; // number +>x : number +} +function c(x: string | number) { +>c : (x: string | number) => void +>x : string | number + + while (typeof x === "string") { +>typeof x === "string" : boolean +>typeof x : string +>x : string | number +>"string" : string + + if (cond) break; +>cond : boolean + + x; // string +>x : string + + x = undefined; +>x = undefined : undefined +>x : string | number +>undefined : undefined + } + x; // string | number +>x : number | string +} + diff --git a/tests/baselines/reference/typeGuardsObjectMethods.types b/tests/baselines/reference/typeGuardsObjectMethods.types index 4ca691bc020..f409bf5caf9 100644 --- a/tests/baselines/reference/typeGuardsObjectMethods.types +++ b/tests/baselines/reference/typeGuardsObjectMethods.types @@ -172,16 +172,16 @@ strOrNum = typeof obj1.method(strOrNum) === "string" && obj1.method(strOrNum); // accessing getter property strOrNum = typeof obj1.prop === "string" && obj1.prop; ->strOrNum = typeof obj1.prop === "string" && obj1.prop : string | number +>strOrNum = typeof obj1.prop === "string" && obj1.prop : string >strOrNum : string | number ->typeof obj1.prop === "string" && obj1.prop : string | number +>typeof obj1.prop === "string" && obj1.prop : string >typeof obj1.prop === "string" : boolean >typeof obj1.prop : string >obj1.prop : string | number >obj1 : { method(param: string | number): string | number; prop: string | number; } >prop : string | number >"string" : string ->obj1.prop : string | number +>obj1.prop : string >obj1 : { method(param: string | number): string | number; prop: string | number; } ->prop : string | number +>prop : string diff --git a/tests/baselines/reference/typeGuardsOnClassProperty.errors.txt b/tests/baselines/reference/typeGuardsOnClassProperty.errors.txt deleted file mode 100644 index 91d6d6998bc..00000000000 --- a/tests/baselines/reference/typeGuardsOnClassProperty.errors.txt +++ /dev/null @@ -1,37 +0,0 @@ -tests/cases/conformance/expressions/typeGuards/typeGuardsOnClassProperty.ts(14,70): error TS2339: Property 'join' does not exist on type 'string | string[]'. -tests/cases/conformance/expressions/typeGuards/typeGuardsOnClassProperty.ts(26,44): error TS2339: Property 'toLowerCase' does not exist on type 'number | string'. - - -==== tests/cases/conformance/expressions/typeGuards/typeGuardsOnClassProperty.ts (2 errors) ==== - // Note that type guards affect types of variables and parameters only and - // have no effect on members of objects such as properties. - - // Note that the class's property must be copied to a local variable for - // the type guard to have an effect - class D { - data: string | string[]; - getData() { - var data = this.data; - return typeof data === "string" ? data : data.join(" "); - } - - getData1() { - return typeof this.data === "string" ? this.data : this.data.join(" "); - ~~~~ -!!! error TS2339: Property 'join' does not exist on type 'string | string[]'. - } - } - - var o: { - prop1: number|string; - prop2: boolean|string; - } = { - prop1: "string" , - prop2: true - } - - if (typeof o.prop1 === "string" && o.prop1.toLowerCase()) {} - ~~~~~~~~~~~ -!!! error TS2339: Property 'toLowerCase' does not exist on type 'number | string'. - var prop1 = o.prop1; - if (typeof prop1 === "string" && prop1.toLocaleLowerCase()) { } \ No newline at end of file diff --git a/tests/baselines/reference/typeGuardsOnClassProperty.symbols b/tests/baselines/reference/typeGuardsOnClassProperty.symbols new file mode 100644 index 00000000000..5017c442b2f --- /dev/null +++ b/tests/baselines/reference/typeGuardsOnClassProperty.symbols @@ -0,0 +1,86 @@ +=== tests/cases/conformance/expressions/typeGuards/typeGuardsOnClassProperty.ts === +// Note that type guards affect types of variables and parameters only and +// have no effect on members of objects such as properties. + +// Note that the class's property must be copied to a local variable for +// the type guard to have an effect +class D { +>D : Symbol(D, Decl(typeGuardsOnClassProperty.ts, 0, 0)) + + data: string | string[]; +>data : Symbol(D.data, Decl(typeGuardsOnClassProperty.ts, 5, 9)) + + getData() { +>getData : Symbol(D.getData, Decl(typeGuardsOnClassProperty.ts, 6, 28)) + + var data = this.data; +>data : Symbol(data, Decl(typeGuardsOnClassProperty.ts, 8, 11)) +>this.data : Symbol(D.data, Decl(typeGuardsOnClassProperty.ts, 5, 9)) +>this : Symbol(D, Decl(typeGuardsOnClassProperty.ts, 0, 0)) +>data : Symbol(D.data, Decl(typeGuardsOnClassProperty.ts, 5, 9)) + + return typeof data === "string" ? data : data.join(" "); +>data : Symbol(data, Decl(typeGuardsOnClassProperty.ts, 8, 11)) +>data : Symbol(data, Decl(typeGuardsOnClassProperty.ts, 8, 11)) +>data.join : Symbol(Array.join, Decl(lib.d.ts, --, --)) +>data : Symbol(data, Decl(typeGuardsOnClassProperty.ts, 8, 11)) +>join : Symbol(Array.join, Decl(lib.d.ts, --, --)) + } + + getData1() { +>getData1 : Symbol(D.getData1, Decl(typeGuardsOnClassProperty.ts, 10, 5)) + + return typeof this.data === "string" ? this.data : this.data.join(" "); +>this.data : Symbol(D.data, Decl(typeGuardsOnClassProperty.ts, 5, 9)) +>this : Symbol(D, Decl(typeGuardsOnClassProperty.ts, 0, 0)) +>data : Symbol(D.data, Decl(typeGuardsOnClassProperty.ts, 5, 9)) +>this.data : Symbol(D.data, Decl(typeGuardsOnClassProperty.ts, 5, 9)) +>this : Symbol(D, Decl(typeGuardsOnClassProperty.ts, 0, 0)) +>data : Symbol(D.data, Decl(typeGuardsOnClassProperty.ts, 5, 9)) +>this.data.join : Symbol(Array.join, Decl(lib.d.ts, --, --)) +>this.data : Symbol(D.data, Decl(typeGuardsOnClassProperty.ts, 5, 9)) +>this : Symbol(D, Decl(typeGuardsOnClassProperty.ts, 0, 0)) +>data : Symbol(D.data, Decl(typeGuardsOnClassProperty.ts, 5, 9)) +>join : Symbol(Array.join, Decl(lib.d.ts, --, --)) + } +} + +var o: { +>o : Symbol(o, Decl(typeGuardsOnClassProperty.ts, 17, 3)) + + prop1: number|string; +>prop1 : Symbol(prop1, Decl(typeGuardsOnClassProperty.ts, 17, 8)) + + prop2: boolean|string; +>prop2 : Symbol(prop2, Decl(typeGuardsOnClassProperty.ts, 18, 25)) + +} = { + prop1: "string" , +>prop1 : Symbol(prop1, Decl(typeGuardsOnClassProperty.ts, 20, 5)) + + prop2: true +>prop2 : Symbol(prop2, Decl(typeGuardsOnClassProperty.ts, 21, 25)) + } + +if (typeof o.prop1 === "string" && o.prop1.toLowerCase()) {} +>o.prop1 : Symbol(prop1, Decl(typeGuardsOnClassProperty.ts, 17, 8)) +>o : Symbol(o, Decl(typeGuardsOnClassProperty.ts, 17, 3)) +>prop1 : Symbol(prop1, Decl(typeGuardsOnClassProperty.ts, 17, 8)) +>o.prop1.toLowerCase : Symbol(String.toLowerCase, Decl(lib.d.ts, --, --)) +>o.prop1 : Symbol(prop1, Decl(typeGuardsOnClassProperty.ts, 17, 8)) +>o : Symbol(o, Decl(typeGuardsOnClassProperty.ts, 17, 3)) +>prop1 : Symbol(prop1, Decl(typeGuardsOnClassProperty.ts, 17, 8)) +>toLowerCase : Symbol(String.toLowerCase, Decl(lib.d.ts, --, --)) + +var prop1 = o.prop1; +>prop1 : Symbol(prop1, Decl(typeGuardsOnClassProperty.ts, 26, 3)) +>o.prop1 : Symbol(prop1, Decl(typeGuardsOnClassProperty.ts, 17, 8)) +>o : Symbol(o, Decl(typeGuardsOnClassProperty.ts, 17, 3)) +>prop1 : Symbol(prop1, Decl(typeGuardsOnClassProperty.ts, 17, 8)) + +if (typeof prop1 === "string" && prop1.toLocaleLowerCase()) { } +>prop1 : Symbol(prop1, Decl(typeGuardsOnClassProperty.ts, 26, 3)) +>prop1.toLocaleLowerCase : Symbol(String.toLocaleLowerCase, Decl(lib.d.ts, --, --)) +>prop1 : Symbol(prop1, Decl(typeGuardsOnClassProperty.ts, 26, 3)) +>toLocaleLowerCase : Symbol(String.toLocaleLowerCase, Decl(lib.d.ts, --, --)) + diff --git a/tests/baselines/reference/typeGuardsOnClassProperty.types b/tests/baselines/reference/typeGuardsOnClassProperty.types new file mode 100644 index 00000000000..6d524ccf674 --- /dev/null +++ b/tests/baselines/reference/typeGuardsOnClassProperty.types @@ -0,0 +1,112 @@ +=== tests/cases/conformance/expressions/typeGuards/typeGuardsOnClassProperty.ts === +// Note that type guards affect types of variables and parameters only and +// have no effect on members of objects such as properties. + +// Note that the class's property must be copied to a local variable for +// the type guard to have an effect +class D { +>D : D + + data: string | string[]; +>data : string | string[] + + getData() { +>getData : () => string + + var data = this.data; +>data : string | string[] +>this.data : string | string[] +>this : this +>data : string | string[] + + return typeof data === "string" ? data : data.join(" "); +>typeof data === "string" ? data : data.join(" ") : string +>typeof data === "string" : boolean +>typeof data : string +>data : string | string[] +>"string" : string +>data : string +>data.join(" ") : string +>data.join : (separator?: string) => string +>data : string[] +>join : (separator?: string) => string +>" " : string + } + + getData1() { +>getData1 : () => string + + return typeof this.data === "string" ? this.data : this.data.join(" "); +>typeof this.data === "string" ? this.data : this.data.join(" ") : string +>typeof this.data === "string" : boolean +>typeof this.data : string +>this.data : string | string[] +>this : this +>data : string | string[] +>"string" : string +>this.data : string +>this : this +>data : string +>this.data.join(" ") : string +>this.data.join : (separator?: string) => string +>this.data : string[] +>this : this +>data : string[] +>join : (separator?: string) => string +>" " : string + } +} + +var o: { +>o : { prop1: number | string; prop2: boolean | string; } + + prop1: number|string; +>prop1 : number | string + + prop2: boolean|string; +>prop2 : boolean | string + +} = { +>{ prop1: "string" , prop2: true } : { prop1: string; prop2: boolean; } + + prop1: "string" , +>prop1 : string +>"string" : string + + prop2: true +>prop2 : boolean +>true : boolean + } + +if (typeof o.prop1 === "string" && o.prop1.toLowerCase()) {} +>typeof o.prop1 === "string" && o.prop1.toLowerCase() : string +>typeof o.prop1 === "string" : boolean +>typeof o.prop1 : string +>o.prop1 : number | string +>o : { prop1: number | string; prop2: boolean | string; } +>prop1 : number | string +>"string" : string +>o.prop1.toLowerCase() : string +>o.prop1.toLowerCase : () => string +>o.prop1 : string +>o : { prop1: number | string; prop2: boolean | string; } +>prop1 : string +>toLowerCase : () => string + +var prop1 = o.prop1; +>prop1 : number | string +>o.prop1 : number | string +>o : { prop1: number | string; prop2: boolean | string; } +>prop1 : number | string + +if (typeof prop1 === "string" && prop1.toLocaleLowerCase()) { } +>typeof prop1 === "string" && prop1.toLocaleLowerCase() : string +>typeof prop1 === "string" : boolean +>typeof prop1 : string +>prop1 : number | string +>"string" : string +>prop1.toLocaleLowerCase() : string +>prop1.toLocaleLowerCase : () => string +>prop1 : string +>toLocaleLowerCase : () => string + diff --git a/tests/baselines/reference/typeGuardsWithInstanceOf.errors.txt b/tests/baselines/reference/typeGuardsWithInstanceOf.errors.txt new file mode 100644 index 00000000000..dfcb8a598da --- /dev/null +++ b/tests/baselines/reference/typeGuardsWithInstanceOf.errors.txt @@ -0,0 +1,14 @@ +tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOf.ts(7,20): error TS2339: Property 'global' does not exist on type 'never'. + + +==== tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOf.ts (1 errors) ==== + interface I { global: string; } + var result: I; + var result2: I; + + if (!(result instanceof RegExp)) { + result = result2; + } else if (!result.global) { + ~~~~~~ +!!! error TS2339: Property 'global' does not exist on type 'never'. + } \ No newline at end of file diff --git a/tests/baselines/reference/typeGuardsWithInstanceOf.symbols b/tests/baselines/reference/typeGuardsWithInstanceOf.symbols deleted file mode 100644 index 81efb5d5b1d..00000000000 --- a/tests/baselines/reference/typeGuardsWithInstanceOf.symbols +++ /dev/null @@ -1,26 +0,0 @@ -=== tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOf.ts === -interface I { global: string; } ->I : Symbol(I, Decl(typeGuardsWithInstanceOf.ts, 0, 0)) ->global : Symbol(global, Decl(typeGuardsWithInstanceOf.ts, 0, 13)) - -var result: I; ->result : Symbol(result, Decl(typeGuardsWithInstanceOf.ts, 1, 3)) ->I : Symbol(I, Decl(typeGuardsWithInstanceOf.ts, 0, 0)) - -var result2: I; ->result2 : Symbol(result2, Decl(typeGuardsWithInstanceOf.ts, 2, 3)) ->I : Symbol(I, Decl(typeGuardsWithInstanceOf.ts, 0, 0)) - -if (!(result instanceof RegExp)) { ->result : Symbol(result, Decl(typeGuardsWithInstanceOf.ts, 1, 3)) ->RegExp : Symbol(RegExp, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) - - result = result2; ->result : Symbol(result, Decl(typeGuardsWithInstanceOf.ts, 1, 3)) ->result2 : Symbol(result2, Decl(typeGuardsWithInstanceOf.ts, 2, 3)) - -} else if (!result.global) { ->result.global : Symbol(I.global, Decl(typeGuardsWithInstanceOf.ts, 0, 13)) ->result : Symbol(result, Decl(typeGuardsWithInstanceOf.ts, 1, 3)) ->global : Symbol(I.global, Decl(typeGuardsWithInstanceOf.ts, 0, 13)) -} diff --git a/tests/baselines/reference/typeGuardsWithInstanceOf.types b/tests/baselines/reference/typeGuardsWithInstanceOf.types deleted file mode 100644 index 0d7b477faed..00000000000 --- a/tests/baselines/reference/typeGuardsWithInstanceOf.types +++ /dev/null @@ -1,31 +0,0 @@ -=== tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOf.ts === -interface I { global: string; } ->I : I ->global : string - -var result: I; ->result : I ->I : I - -var result2: I; ->result2 : I ->I : I - -if (!(result instanceof RegExp)) { ->!(result instanceof RegExp) : boolean ->(result instanceof RegExp) : boolean ->result instanceof RegExp : boolean ->result : I ->RegExp : RegExpConstructor - - result = result2; ->result = result2 : I ->result : I ->result2 : I - -} else if (!result.global) { ->!result.global : boolean ->result.global : string ->result : I ->global : string -} diff --git a/tests/baselines/reference/typeInferenceReturnTypeCallback.symbols b/tests/baselines/reference/typeInferenceReturnTypeCallback.symbols index a7322f7e69b..5e65945f9ad 100644 --- a/tests/baselines/reference/typeInferenceReturnTypeCallback.symbols +++ b/tests/baselines/reference/typeInferenceReturnTypeCallback.symbols @@ -4,7 +4,7 @@ interface IList { >A : Symbol(A, Decl(typeInferenceReturnTypeCallback.ts, 0, 16)) map(f: (t: A) => B): IList; ->map : Symbol(map, Decl(typeInferenceReturnTypeCallback.ts, 0, 20)) +>map : Symbol(IList.map, Decl(typeInferenceReturnTypeCallback.ts, 0, 20)) >B : Symbol(B, Decl(typeInferenceReturnTypeCallback.ts, 1, 8)) >f : Symbol(f, Decl(typeInferenceReturnTypeCallback.ts, 1, 11)) >t : Symbol(t, Decl(typeInferenceReturnTypeCallback.ts, 1, 15)) @@ -21,7 +21,7 @@ class Nil implements IList{ >C : Symbol(C, Decl(typeInferenceReturnTypeCallback.ts, 4, 10)) map(f: (t: C) => D): IList { ->map : Symbol(map, Decl(typeInferenceReturnTypeCallback.ts, 4, 33)) +>map : Symbol(Nil.map, Decl(typeInferenceReturnTypeCallback.ts, 4, 33)) >D : Symbol(D, Decl(typeInferenceReturnTypeCallback.ts, 5, 8)) >f : Symbol(f, Decl(typeInferenceReturnTypeCallback.ts, 5, 11)) >t : Symbol(t, Decl(typeInferenceReturnTypeCallback.ts, 5, 15)) @@ -41,7 +41,7 @@ class Cons implements IList{ >T : Symbol(T, Decl(typeInferenceReturnTypeCallback.ts, 10, 11)) map(f: (t: T) => U): IList { ->map : Symbol(map, Decl(typeInferenceReturnTypeCallback.ts, 10, 34)) +>map : Symbol(Cons.map, Decl(typeInferenceReturnTypeCallback.ts, 10, 34)) >U : Symbol(U, Decl(typeInferenceReturnTypeCallback.ts, 11, 8)) >f : Symbol(f, Decl(typeInferenceReturnTypeCallback.ts, 11, 11)) >t : Symbol(t, Decl(typeInferenceReturnTypeCallback.ts, 11, 15)) @@ -51,9 +51,9 @@ class Cons implements IList{ >U : Symbol(U, Decl(typeInferenceReturnTypeCallback.ts, 11, 8)) return this.foldRight(new Nil(), (t, acc) => { ->this.foldRight : Symbol(foldRight, Decl(typeInferenceReturnTypeCallback.ts, 15, 5)) +>this.foldRight : Symbol(Cons.foldRight, Decl(typeInferenceReturnTypeCallback.ts, 15, 5)) >this : Symbol(Cons, Decl(typeInferenceReturnTypeCallback.ts, 8, 1)) ->foldRight : Symbol(foldRight, Decl(typeInferenceReturnTypeCallback.ts, 15, 5)) +>foldRight : Symbol(Cons.foldRight, Decl(typeInferenceReturnTypeCallback.ts, 15, 5)) >Nil : Symbol(Nil, Decl(typeInferenceReturnTypeCallback.ts, 2, 1)) >U : Symbol(U, Decl(typeInferenceReturnTypeCallback.ts, 11, 8)) >t : Symbol(t, Decl(typeInferenceReturnTypeCallback.ts, 12, 45)) @@ -67,7 +67,7 @@ class Cons implements IList{ } foldRight(z: E, f: (t: T, acc: E) => E): E { ->foldRight : Symbol(foldRight, Decl(typeInferenceReturnTypeCallback.ts, 15, 5)) +>foldRight : Symbol(Cons.foldRight, Decl(typeInferenceReturnTypeCallback.ts, 15, 5)) >E : Symbol(E, Decl(typeInferenceReturnTypeCallback.ts, 17, 14)) >z : Symbol(z, Decl(typeInferenceReturnTypeCallback.ts, 17, 17)) >E : Symbol(E, Decl(typeInferenceReturnTypeCallback.ts, 17, 14)) diff --git a/tests/baselines/reference/typeLiteralCallback.symbols b/tests/baselines/reference/typeLiteralCallback.symbols index 14bdd240612..824998a3a99 100644 --- a/tests/baselines/reference/typeLiteralCallback.symbols +++ b/tests/baselines/reference/typeLiteralCallback.symbols @@ -4,7 +4,7 @@ interface Foo { >T : Symbol(T, Decl(typeLiteralCallback.ts, 0, 14)) reject(arg: T): void ; ->reject : Symbol(reject, Decl(typeLiteralCallback.ts, 0, 18)) +>reject : Symbol(Foo.reject, Decl(typeLiteralCallback.ts, 0, 18)) >arg : Symbol(arg, Decl(typeLiteralCallback.ts, 1, 11)) >T : Symbol(T, Decl(typeLiteralCallback.ts, 0, 14)) } @@ -17,13 +17,13 @@ interface bar { >T : Symbol(T, Decl(typeLiteralCallback.ts, 5, 14)) fail(func: (arg: T) => void ): void ; ->fail : Symbol(fail, Decl(typeLiteralCallback.ts, 5, 18)) +>fail : Symbol(bar.fail, Decl(typeLiteralCallback.ts, 5, 18)) >func : Symbol(func, Decl(typeLiteralCallback.ts, 6, 9)) >arg : Symbol(arg, Decl(typeLiteralCallback.ts, 6, 16)) >T : Symbol(T, Decl(typeLiteralCallback.ts, 5, 14)) fail2(func: { (arg: T): void ; }): void ; ->fail2 : Symbol(fail2, Decl(typeLiteralCallback.ts, 6, 41)) +>fail2 : Symbol(bar.fail2, Decl(typeLiteralCallback.ts, 6, 41)) >func : Symbol(func, Decl(typeLiteralCallback.ts, 7, 10)) >arg : Symbol(arg, Decl(typeLiteralCallback.ts, 7, 19)) >T : Symbol(T, Decl(typeLiteralCallback.ts, 5, 14)) diff --git a/tests/baselines/reference/typeName1.errors.txt b/tests/baselines/reference/typeName1.errors.txt index 84c8be360bd..152a5b951e7 100644 --- a/tests/baselines/reference/typeName1.errors.txt +++ b/tests/baselines/reference/typeName1.errors.txt @@ -1,31 +1,19 @@ tests/cases/compiler/typeName1.ts(9,5): error TS2322: Type 'number' is not assignable to type '{ f(s: string): number; f(n: number): string; }'. - Property 'f' is missing in type 'Number'. tests/cases/compiler/typeName1.ts(10,5): error TS2322: Type 'number' is not assignable to type '{ f(s: string): number; }'. - Property 'f' is missing in type 'Number'. tests/cases/compiler/typeName1.ts(11,5): error TS2322: Type 'number' is not assignable to type '{ (s: string): number; (n: number): string; }'. tests/cases/compiler/typeName1.ts(12,5): error TS2322: Type 'number' is not assignable to type '{ x: any; y: any; z: number; f(n: number): string; f(s: string): number; }'. - Property 'x' is missing in type 'Number'. tests/cases/compiler/typeName1.ts(13,5): error TS2322: Type 'number' is not assignable to type '{ (s: string): number; (n: number): string; x: any; y: any; z: number; f(n: number): string; f(s: string): number; }'. - Property 'x' is missing in type 'Number'. tests/cases/compiler/typeName1.ts(14,5): error TS2322: Type 'number' is not assignable to type '{ z: number; f: { (n: number): string; (s: string): number; }; }'. - Property 'z' is missing in type 'Number'. tests/cases/compiler/typeName1.ts(15,5): error TS2322: Type 'number' is not assignable to type '(s: string) => boolean'. tests/cases/compiler/typeName1.ts(16,5): error TS2322: Type 'number' is not assignable to type '{ (): boolean; [s: string]: { x: any; y: any; }; [n: number]: { x: any; y: any; }; z: I; }'. - Property 'z' is missing in type 'Number'. tests/cases/compiler/typeName1.ts(16,10): error TS2411: Property 'z' of type 'I' is not assignable to string index type '{ x: any; y: any; }'. tests/cases/compiler/typeName1.ts(17,5): error TS2322: Type 'number' is not assignable to type 'I'. - Property 'k' is missing in type 'Number'. tests/cases/compiler/typeName1.ts(18,5): error TS2322: Type 'number' is not assignable to type 'I[][][][]'. - Property 'length' is missing in type 'Number'. tests/cases/compiler/typeName1.ts(19,5): error TS2322: Type 'number' is not assignable to type '{ z: I; x: boolean; }[][]'. - Property 'length' is missing in type 'Number'. tests/cases/compiler/typeName1.ts(20,5): error TS2322: Type 'number' is not assignable to type '{ z: I; x: boolean; y: (s: string) => boolean; w: { (): boolean; [s: string]: { x: any; y: any; }; [n: number]: { x: any; y: any; }; z: I; }; }[][]'. - Property 'length' is missing in type 'Number'. tests/cases/compiler/typeName1.ts(20,50): error TS2411: Property 'z' of type 'I' is not assignable to string index type '{ x: any; y: any; }'. tests/cases/compiler/typeName1.ts(21,5): error TS2322: Type 'number' is not assignable to type '{ (): {}; new (): number; new (n: number): number; x: string; w: { y: number; }; }'. - Property 'x' is missing in type 'Number'. tests/cases/compiler/typeName1.ts(22,5): error TS2322: Type 'number' is not assignable to type '{ (): string; f(x: number): boolean; p: any; q: any; }'. - Property 'f' is missing in type 'Number'. tests/cases/compiler/typeName1.ts(23,5): error TS2322: Type 'typeof C' is not assignable to type 'number'. @@ -41,61 +29,49 @@ tests/cases/compiler/typeName1.ts(23,5): error TS2322: Type 'typeof C' is not as var x1:{ f(s:string):number;f(n:number):string; }=3; ~~ !!! error TS2322: Type 'number' is not assignable to type '{ f(s: string): number; f(n: number): string; }'. -!!! error TS2322: Property 'f' is missing in type 'Number'. var x2:{ f(s:string):number; } =3; ~~ !!! error TS2322: Type 'number' is not assignable to type '{ f(s: string): number; }'. -!!! error TS2322: Property 'f' is missing in type 'Number'. var x3:{ (s:string):number;(n:number):string; }=3; ~~ !!! error TS2322: Type 'number' is not assignable to type '{ (s: string): number; (n: number): string; }'. var x4:{ x;y;z:number;f(n:number):string;f(s:string):number; }=3; ~~ !!! error TS2322: Type 'number' is not assignable to type '{ x: any; y: any; z: number; f(n: number): string; f(s: string): number; }'. -!!! error TS2322: Property 'x' is missing in type 'Number'. var x5:{ (s:string):number;(n:number):string;x;y;z:number;f(n:number):string;f(s:string):number; }=3; ~~ !!! error TS2322: Type 'number' is not assignable to type '{ (s: string): number; (n: number): string; x: any; y: any; z: number; f(n: number): string; f(s: string): number; }'. -!!! error TS2322: Property 'x' is missing in type 'Number'. var x6:{ z:number;f:{(n:number):string;(s:string):number;}; }=3; ~~ !!! error TS2322: Type 'number' is not assignable to type '{ z: number; f: { (n: number): string; (s: string): number; }; }'. -!!! error TS2322: Property 'z' is missing in type 'Number'. var x7:(s:string)=>boolean=3; ~~ !!! error TS2322: Type 'number' is not assignable to type '(s: string) => boolean'. var x8:{ z:I;[s:string]:{ x; y; };[n:number]:{x; y;};():boolean; }=3; ~~ !!! error TS2322: Type 'number' is not assignable to type '{ (): boolean; [s: string]: { x: any; y: any; }; [n: number]: { x: any; y: any; }; z: I; }'. -!!! error TS2322: Property 'z' is missing in type 'Number'. ~~~~ !!! error TS2411: Property 'z' of type 'I' is not assignable to string index type '{ x: any; y: any; }'. var x9:I=3; ~~ !!! error TS2322: Type 'number' is not assignable to type 'I'. -!!! error TS2322: Property 'k' is missing in type 'Number'. var x10:I[][][][]=3; ~~~ !!! error TS2322: Type 'number' is not assignable to type 'I[][][][]'. -!!! error TS2322: Property 'length' is missing in type 'Number'. var x11:{z:I;x:boolean;}[][]=3; ~~~ !!! error TS2322: Type 'number' is not assignable to type '{ z: I; x: boolean; }[][]'. -!!! error TS2322: Property 'length' is missing in type 'Number'. var x12:{z:I;x:boolean;y:(s:string)=>boolean;w:{ z:I;[s:string]:{ x; y; };[n:number]:{x; y;};():boolean; };}[][]=3; ~~~ !!! error TS2322: Type 'number' is not assignable to type '{ z: I; x: boolean; y: (s: string) => boolean; w: { (): boolean; [s: string]: { x: any; y: any; }; [n: number]: { x: any; y: any; }; z: I; }; }[][]'. -!!! error TS2322: Property 'length' is missing in type 'Number'. ~~~~ !!! error TS2411: Property 'z' of type 'I' is not assignable to string index type '{ x: any; y: any; }'. var x13:{ new(): number; new(n:number):number; x: string; w: {y: number;}; (): {}; } = 3; ~~~ !!! error TS2322: Type 'number' is not assignable to type '{ (): {}; new (): number; new (n: number): number; x: string; w: { y: number; }; }'. -!!! error TS2322: Property 'x' is missing in type 'Number'. var x14:{ f(x:number):boolean; p; q; ():string; }=3; ~~~ !!! error TS2322: Type 'number' is not assignable to type '{ (): string; f(x: number): boolean; p: any; q: any; }'. -!!! error TS2322: Property 'f' is missing in type 'Number'. var x15:number=C; ~~~ !!! error TS2322: Type 'typeof C' is not assignable to type 'number'. diff --git a/tests/baselines/reference/typeOfEnumAndVarRedeclarations.errors.txt b/tests/baselines/reference/typeOfEnumAndVarRedeclarations.errors.txt index d97d33b0103..d7410ec04cb 100644 --- a/tests/baselines/reference/typeOfEnumAndVarRedeclarations.errors.txt +++ b/tests/baselines/reference/typeOfEnumAndVarRedeclarations.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/typeOfEnumAndVarRedeclarations.ts(10,41): error TS2375: Duplicate number index signature. +tests/cases/compiler/typeOfEnumAndVarRedeclarations.ts(10,70): error TS2375: Duplicate number index signature. ==== tests/cases/compiler/typeOfEnumAndVarRedeclarations.ts (1 errors) ==== @@ -9,8 +9,8 @@ tests/cases/compiler/typeOfEnumAndVarRedeclarations.ts(10,41): error TS2375: Dup b = 1 } var x = E; - var x: { a: E; b: E;[x: number]: string; }; // Shouldnt error + var x: { readonly a: E; readonly b: E; readonly [x: number]: string; }; // Shouldnt error var y = E; - var y: { a: E; b: E;[x: number]: string;[x: number]: string } // two errors: the types are not identical and duplicate signatures - ~~~~~~~~~~~~~~~~~~~ + var y: { readonly a: E; readonly b: E; readonly [x: number]: string; readonly [x: number]: string } // two errors: the types are not identical and duplicate signatures + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2375: Duplicate number index signature. \ No newline at end of file diff --git a/tests/baselines/reference/typeOfEnumAndVarRedeclarations.js b/tests/baselines/reference/typeOfEnumAndVarRedeclarations.js index ce77eac85e6..391c9c1679a 100644 --- a/tests/baselines/reference/typeOfEnumAndVarRedeclarations.js +++ b/tests/baselines/reference/typeOfEnumAndVarRedeclarations.js @@ -6,9 +6,9 @@ enum E { b = 1 } var x = E; -var x: { a: E; b: E;[x: number]: string; }; // Shouldnt error +var x: { readonly a: E; readonly b: E; readonly [x: number]: string; }; // Shouldnt error var y = E; -var y: { a: E; b: E;[x: number]: string;[x: number]: string } // two errors: the types are not identical and duplicate signatures +var y: { readonly a: E; readonly b: E; readonly [x: number]: string; readonly [x: number]: string } // two errors: the types are not identical and duplicate signatures //// [typeOfEnumAndVarRedeclarations.js] var E; diff --git a/tests/baselines/reference/typeOfOnTypeArg.errors.txt b/tests/baselines/reference/typeOfOnTypeArg.errors.txt index 8562b7f134a..46b48983f21 100644 --- a/tests/baselines/reference/typeOfOnTypeArg.errors.txt +++ b/tests/baselines/reference/typeOfOnTypeArg.errors.txt @@ -1,5 +1,4 @@ tests/cases/compiler/typeOfOnTypeArg.ts(7,6): error TS2345: Argument of type 'number' is not assignable to parameter of type '{ '': number; }'. - Property '''' is missing in type 'Number'. ==== tests/cases/compiler/typeOfOnTypeArg.ts (1 errors) ==== @@ -12,5 +11,4 @@ tests/cases/compiler/typeOfOnTypeArg.ts(7,6): error TS2345: Argument of type 'nu fill(32); ~~ !!! error TS2345: Argument of type 'number' is not assignable to parameter of type '{ '': number; }'. -!!! error TS2345: Property '''' is missing in type 'Number'. \ No newline at end of file diff --git a/tests/baselines/reference/typeOfPrototype.symbols b/tests/baselines/reference/typeOfPrototype.symbols index ee44b3c9ae0..f6ba0d1600e 100644 --- a/tests/baselines/reference/typeOfPrototype.symbols +++ b/tests/baselines/reference/typeOfPrototype.symbols @@ -3,7 +3,7 @@ class Foo { >Foo : Symbol(Foo, Decl(typeOfPrototype.ts, 0, 0)) bar = 3; ->bar : Symbol(bar, Decl(typeOfPrototype.ts, 0, 11)) +>bar : Symbol(Foo.bar, Decl(typeOfPrototype.ts, 0, 11)) static bar = ''; >bar : Symbol(Foo.bar, Decl(typeOfPrototype.ts, 1, 12)) diff --git a/tests/baselines/reference/typeOfThisInFunctionExpression.symbols b/tests/baselines/reference/typeOfThisInFunctionExpression.symbols index 59a7b11bc9f..4b6bd18509b 100644 --- a/tests/baselines/reference/typeOfThisInFunctionExpression.symbols +++ b/tests/baselines/reference/typeOfThisInFunctionExpression.symbols @@ -36,7 +36,7 @@ class C { >C : Symbol(C, Decl(typeOfThisInFunctionExpression.ts, 15, 1)) x = function () { ->x : Symbol(x, Decl(typeOfThisInFunctionExpression.ts, 17, 9)) +>x : Symbol(C.x, Decl(typeOfThisInFunctionExpression.ts, 17, 9)) var q: any; >q : Symbol(q, Decl(typeOfThisInFunctionExpression.ts, 19, 11), Decl(typeOfThisInFunctionExpression.ts, 20, 11)) @@ -45,7 +45,7 @@ class C { >q : Symbol(q, Decl(typeOfThisInFunctionExpression.ts, 19, 11), Decl(typeOfThisInFunctionExpression.ts, 20, 11)) } y = function ff() { ->y : Symbol(y, Decl(typeOfThisInFunctionExpression.ts, 21, 5)) +>y : Symbol(C.y, Decl(typeOfThisInFunctionExpression.ts, 21, 5)) >ff : Symbol(ff, Decl(typeOfThisInFunctionExpression.ts, 22, 7)) var q: any; diff --git a/tests/baselines/reference/typeOfThisInMemberFunctions.symbols b/tests/baselines/reference/typeOfThisInMemberFunctions.symbols index c0a860af4f7..a98234023c5 100644 --- a/tests/baselines/reference/typeOfThisInMemberFunctions.symbols +++ b/tests/baselines/reference/typeOfThisInMemberFunctions.symbols @@ -3,7 +3,7 @@ class C { >C : Symbol(C, Decl(typeOfThisInMemberFunctions.ts, 0, 0)) foo() { ->foo : Symbol(foo, Decl(typeOfThisInMemberFunctions.ts, 0, 9)) +>foo : Symbol(C.foo, Decl(typeOfThisInMemberFunctions.ts, 0, 9)) var r = this; >r : Symbol(r, Decl(typeOfThisInMemberFunctions.ts, 2, 11)) @@ -24,11 +24,11 @@ class D { >T : Symbol(T, Decl(typeOfThisInMemberFunctions.ts, 10, 8)) x: T; ->x : Symbol(x, Decl(typeOfThisInMemberFunctions.ts, 10, 12)) +>x : Symbol(D.x, Decl(typeOfThisInMemberFunctions.ts, 10, 12)) >T : Symbol(T, Decl(typeOfThisInMemberFunctions.ts, 10, 8)) foo() { ->foo : Symbol(foo, Decl(typeOfThisInMemberFunctions.ts, 11, 9)) +>foo : Symbol(D.foo, Decl(typeOfThisInMemberFunctions.ts, 11, 9)) var r = this; >r : Symbol(r, Decl(typeOfThisInMemberFunctions.ts, 13, 11)) @@ -47,14 +47,14 @@ class D { class E { >E : Symbol(E, Decl(typeOfThisInMemberFunctions.ts, 19, 1)) >T : Symbol(T, Decl(typeOfThisInMemberFunctions.ts, 21, 8)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) x: T; ->x : Symbol(x, Decl(typeOfThisInMemberFunctions.ts, 21, 25)) +>x : Symbol(E.x, Decl(typeOfThisInMemberFunctions.ts, 21, 25)) >T : Symbol(T, Decl(typeOfThisInMemberFunctions.ts, 21, 8)) foo() { ->foo : Symbol(foo, Decl(typeOfThisInMemberFunctions.ts, 22, 9)) +>foo : Symbol(E.foo, Decl(typeOfThisInMemberFunctions.ts, 22, 9)) var r = this; >r : Symbol(r, Decl(typeOfThisInMemberFunctions.ts, 24, 11)) diff --git a/tests/baselines/reference/typeParameterAndArgumentOfSameName1.symbols b/tests/baselines/reference/typeParameterAndArgumentOfSameName1.symbols index e38953fe8a2..cacd7f91dfe 100644 --- a/tests/baselines/reference/typeParameterAndArgumentOfSameName1.symbols +++ b/tests/baselines/reference/typeParameterAndArgumentOfSameName1.symbols @@ -2,7 +2,7 @@ function f(A: A): A { >f : Symbol(f, Decl(typeParameterAndArgumentOfSameName1.ts, 0, 0)) >A : Symbol(A, Decl(typeParameterAndArgumentOfSameName1.ts, 0, 11), Decl(typeParameterAndArgumentOfSameName1.ts, 0, 29)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >A : Symbol(A, Decl(typeParameterAndArgumentOfSameName1.ts, 0, 11), Decl(typeParameterAndArgumentOfSameName1.ts, 0, 29)) >A : Symbol(A, Decl(typeParameterAndArgumentOfSameName1.ts, 0, 11), Decl(typeParameterAndArgumentOfSameName1.ts, 0, 29)) >A : Symbol(A, Decl(typeParameterAndArgumentOfSameName1.ts, 0, 11), Decl(typeParameterAndArgumentOfSameName1.ts, 0, 29)) diff --git a/tests/baselines/reference/typeParameterArgumentEquivalence.errors.txt b/tests/baselines/reference/typeParameterArgumentEquivalence.errors.txt index f47266f2850..39e6db64fbf 100644 --- a/tests/baselines/reference/typeParameterArgumentEquivalence.errors.txt +++ b/tests/baselines/reference/typeParameterArgumentEquivalence.errors.txt @@ -1,9 +1,9 @@ tests/cases/compiler/typeParameterArgumentEquivalence.ts(4,5): error TS2322: Type '(item: T) => boolean' is not assignable to type '(item: number) => boolean'. Types of parameters 'item' and 'item' are incompatible. - Type 'T' is not assignable to type 'number'. + Type 'number' is not assignable to type 'T'. tests/cases/compiler/typeParameterArgumentEquivalence.ts(5,5): error TS2322: Type '(item: number) => boolean' is not assignable to type '(item: T) => boolean'. Types of parameters 'item' and 'item' are incompatible. - Type 'number' is not assignable to type 'T'. + Type 'T' is not assignable to type 'number'. ==== tests/cases/compiler/typeParameterArgumentEquivalence.ts (2 errors) ==== @@ -14,11 +14,11 @@ tests/cases/compiler/typeParameterArgumentEquivalence.ts(5,5): error TS2322: Typ ~ !!! error TS2322: Type '(item: T) => boolean' is not assignable to type '(item: number) => boolean'. !!! error TS2322: Types of parameters 'item' and 'item' are incompatible. -!!! error TS2322: Type 'T' is not assignable to type 'number'. +!!! error TS2322: Type 'number' is not assignable to type 'T'. y = x; // Shound be an error ~ !!! error TS2322: Type '(item: number) => boolean' is not assignable to type '(item: T) => boolean'. !!! error TS2322: Types of parameters 'item' and 'item' are incompatible. -!!! error TS2322: Type 'number' is not assignable to type 'T'. +!!! error TS2322: Type 'T' is not assignable to type 'number'. } \ No newline at end of file diff --git a/tests/baselines/reference/typeParameterArgumentEquivalence2.errors.txt b/tests/baselines/reference/typeParameterArgumentEquivalence2.errors.txt index 2aa8d77ba6d..17fce0384f7 100644 --- a/tests/baselines/reference/typeParameterArgumentEquivalence2.errors.txt +++ b/tests/baselines/reference/typeParameterArgumentEquivalence2.errors.txt @@ -1,9 +1,9 @@ tests/cases/compiler/typeParameterArgumentEquivalence2.ts(4,5): error TS2322: Type '(item: T) => boolean' is not assignable to type '(item: U) => boolean'. Types of parameters 'item' and 'item' are incompatible. - Type 'T' is not assignable to type 'U'. + Type 'U' is not assignable to type 'T'. tests/cases/compiler/typeParameterArgumentEquivalence2.ts(5,5): error TS2322: Type '(item: U) => boolean' is not assignable to type '(item: T) => boolean'. Types of parameters 'item' and 'item' are incompatible. - Type 'U' is not assignable to type 'T'. + Type 'T' is not assignable to type 'U'. ==== tests/cases/compiler/typeParameterArgumentEquivalence2.ts (2 errors) ==== @@ -14,11 +14,11 @@ tests/cases/compiler/typeParameterArgumentEquivalence2.ts(5,5): error TS2322: Ty ~ !!! error TS2322: Type '(item: T) => boolean' is not assignable to type '(item: U) => boolean'. !!! error TS2322: Types of parameters 'item' and 'item' are incompatible. -!!! error TS2322: Type 'T' is not assignable to type 'U'. +!!! error TS2322: Type 'U' is not assignable to type 'T'. y = x; // Shound be an error ~ !!! error TS2322: Type '(item: U) => boolean' is not assignable to type '(item: T) => boolean'. !!! error TS2322: Types of parameters 'item' and 'item' are incompatible. -!!! error TS2322: Type 'U' is not assignable to type 'T'. +!!! error TS2322: Type 'T' is not assignable to type 'U'. } \ No newline at end of file diff --git a/tests/baselines/reference/typeParameterAsTypeArgument.symbols b/tests/baselines/reference/typeParameterAsTypeArgument.symbols index a0e03fcf639..cfff8926e55 100644 --- a/tests/baselines/reference/typeParameterAsTypeArgument.symbols +++ b/tests/baselines/reference/typeParameterAsTypeArgument.symbols @@ -29,7 +29,7 @@ class C { >U : Symbol(U, Decl(typeParameterAsTypeArgument.ts, 7, 10)) x: T; ->x : Symbol(x, Decl(typeParameterAsTypeArgument.ts, 7, 15)) +>x : Symbol(C.x, Decl(typeParameterAsTypeArgument.ts, 7, 15)) >T : Symbol(T, Decl(typeParameterAsTypeArgument.ts, 7, 8)) } @@ -39,7 +39,7 @@ interface I { >U : Symbol(U, Decl(typeParameterAsTypeArgument.ts, 11, 14)) x: C; ->x : Symbol(x, Decl(typeParameterAsTypeArgument.ts, 11, 19)) +>x : Symbol(I.x, Decl(typeParameterAsTypeArgument.ts, 11, 19)) >C : Symbol(C, Decl(typeParameterAsTypeArgument.ts, 5, 1)) >U : Symbol(U, Decl(typeParameterAsTypeArgument.ts, 11, 14)) >T : Symbol(T, Decl(typeParameterAsTypeArgument.ts, 11, 12)) diff --git a/tests/baselines/reference/typeParameterAsTypeParameterConstraint.symbols b/tests/baselines/reference/typeParameterAsTypeParameterConstraint.symbols index 569b37e64d1..a530a6c7864 100644 --- a/tests/baselines/reference/typeParameterAsTypeParameterConstraint.symbols +++ b/tests/baselines/reference/typeParameterAsTypeParameterConstraint.symbols @@ -26,14 +26,14 @@ interface A { >A : Symbol(A, Decl(typeParameterAsTypeParameterConstraint.ts, 6, 19)) foo: string; ->foo : Symbol(foo, Decl(typeParameterAsTypeParameterConstraint.ts, 8, 13)) +>foo : Symbol(A.foo, Decl(typeParameterAsTypeParameterConstraint.ts, 8, 13)) } interface B extends A { >B : Symbol(B, Decl(typeParameterAsTypeParameterConstraint.ts, 10, 1)) >A : Symbol(A, Decl(typeParameterAsTypeParameterConstraint.ts, 6, 19)) bar: number; ->bar : Symbol(bar, Decl(typeParameterAsTypeParameterConstraint.ts, 11, 23)) +>bar : Symbol(B.bar, Decl(typeParameterAsTypeParameterConstraint.ts, 11, 23)) } var a: A; >a : Symbol(a, Decl(typeParameterAsTypeParameterConstraint.ts, 14, 3)) diff --git a/tests/baselines/reference/typeParameterAsTypeParameterConstraint2.errors.txt b/tests/baselines/reference/typeParameterAsTypeParameterConstraint2.errors.txt index 282e942e0f7..0e148cb5689 100644 --- a/tests/baselines/reference/typeParameterAsTypeParameterConstraint2.errors.txt +++ b/tests/baselines/reference/typeParameterAsTypeParameterConstraint2.errors.txt @@ -10,7 +10,6 @@ tests/cases/conformance/types/typeParameters/typeArgumentLists/typeParameterAsTy tests/cases/conformance/types/typeParameters/typeArgumentLists/typeParameterAsTypeParameterConstraint2.ts(18,10): error TS2345: Argument of type 'string[]' is not assignable to parameter of type '{ length: any[]; }'. Types of property 'length' are incompatible. Type 'number' is not assignable to type 'any[]'. - Property 'length' is missing in type 'Number'. ==== tests/cases/conformance/types/typeParameters/typeArgumentLists/typeParameterAsTypeParameterConstraint2.ts (6 errors) ==== @@ -49,5 +48,4 @@ tests/cases/conformance/types/typeParameters/typeArgumentLists/typeParameterAsTy ~~~~ !!! error TS2345: Argument of type 'string[]' is not assignable to parameter of type '{ length: any[]; }'. !!! error TS2345: Types of property 'length' are incompatible. -!!! error TS2345: Type 'number' is not assignable to type 'any[]'. -!!! error TS2345: Property 'length' is missing in type 'Number'. \ No newline at end of file +!!! error TS2345: Type 'number' is not assignable to type 'any[]'. \ No newline at end of file diff --git a/tests/baselines/reference/typeParameterAsTypeParameterConstraintTransitively.symbols b/tests/baselines/reference/typeParameterAsTypeParameterConstraintTransitively.symbols index 90276a96b3d..6739f6930f1 100644 --- a/tests/baselines/reference/typeParameterAsTypeParameterConstraintTransitively.symbols +++ b/tests/baselines/reference/typeParameterAsTypeParameterConstraintTransitively.symbols @@ -4,17 +4,17 @@ interface A { foo: number } >A : Symbol(A, Decl(typeParameterAsTypeParameterConstraintTransitively.ts, 0, 0)) ->foo : Symbol(foo, Decl(typeParameterAsTypeParameterConstraintTransitively.ts, 3, 13)) +>foo : Symbol(A.foo, Decl(typeParameterAsTypeParameterConstraintTransitively.ts, 3, 13)) interface B extends A { bar: string; } >B : Symbol(B, Decl(typeParameterAsTypeParameterConstraintTransitively.ts, 3, 27)) >A : Symbol(A, Decl(typeParameterAsTypeParameterConstraintTransitively.ts, 0, 0)) ->bar : Symbol(bar, Decl(typeParameterAsTypeParameterConstraintTransitively.ts, 4, 23)) +>bar : Symbol(B.bar, Decl(typeParameterAsTypeParameterConstraintTransitively.ts, 4, 23)) interface C extends B { baz: boolean; } >C : Symbol(C, Decl(typeParameterAsTypeParameterConstraintTransitively.ts, 4, 38)) >B : Symbol(B, Decl(typeParameterAsTypeParameterConstraintTransitively.ts, 3, 27)) ->baz : Symbol(baz, Decl(typeParameterAsTypeParameterConstraintTransitively.ts, 5, 23)) +>baz : Symbol(C.baz, Decl(typeParameterAsTypeParameterConstraintTransitively.ts, 5, 23)) var a: A; >a : Symbol(a, Decl(typeParameterAsTypeParameterConstraintTransitively.ts, 6, 3)) diff --git a/tests/baselines/reference/typeParameterAsTypeParameterConstraintTransitively2.symbols b/tests/baselines/reference/typeParameterAsTypeParameterConstraintTransitively2.symbols index 5635d0e61ed..f0fbba60d9a 100644 --- a/tests/baselines/reference/typeParameterAsTypeParameterConstraintTransitively2.symbols +++ b/tests/baselines/reference/typeParameterAsTypeParameterConstraintTransitively2.symbols @@ -4,17 +4,17 @@ interface A { foo: number } >A : Symbol(A, Decl(typeParameterAsTypeParameterConstraintTransitively2.ts, 0, 0)) ->foo : Symbol(foo, Decl(typeParameterAsTypeParameterConstraintTransitively2.ts, 3, 13)) +>foo : Symbol(A.foo, Decl(typeParameterAsTypeParameterConstraintTransitively2.ts, 3, 13)) interface B extends A { bar: string; } >B : Symbol(B, Decl(typeParameterAsTypeParameterConstraintTransitively2.ts, 3, 27)) >A : Symbol(A, Decl(typeParameterAsTypeParameterConstraintTransitively2.ts, 0, 0)) ->bar : Symbol(bar, Decl(typeParameterAsTypeParameterConstraintTransitively2.ts, 4, 23)) +>bar : Symbol(B.bar, Decl(typeParameterAsTypeParameterConstraintTransitively2.ts, 4, 23)) interface C extends B { baz: boolean; } >C : Symbol(C, Decl(typeParameterAsTypeParameterConstraintTransitively2.ts, 4, 38)) >B : Symbol(B, Decl(typeParameterAsTypeParameterConstraintTransitively2.ts, 3, 27)) ->baz : Symbol(baz, Decl(typeParameterAsTypeParameterConstraintTransitively2.ts, 5, 23)) +>baz : Symbol(C.baz, Decl(typeParameterAsTypeParameterConstraintTransitively2.ts, 5, 23)) var a: A; >a : Symbol(a, Decl(typeParameterAsTypeParameterConstraintTransitively2.ts, 6, 3)) diff --git a/tests/baselines/reference/typeParameterCompatibilityAccrossDeclarations.symbols b/tests/baselines/reference/typeParameterCompatibilityAccrossDeclarations.symbols index eb1aeeaca27..d7d4980d21d 100644 --- a/tests/baselines/reference/typeParameterCompatibilityAccrossDeclarations.symbols +++ b/tests/baselines/reference/typeParameterCompatibilityAccrossDeclarations.symbols @@ -20,7 +20,7 @@ export interface I { >I : Symbol(I, Decl(typeParameterCompatibilityAccrossDeclarations.ts, 5, 1)) x(y: T): T; ->x : Symbol(x, Decl(typeParameterCompatibilityAccrossDeclarations.ts, 6, 20)) +>x : Symbol(I.x, Decl(typeParameterCompatibilityAccrossDeclarations.ts, 6, 20)) >T : Symbol(T, Decl(typeParameterCompatibilityAccrossDeclarations.ts, 7, 5)) >y : Symbol(y, Decl(typeParameterCompatibilityAccrossDeclarations.ts, 7, 8)) >T : Symbol(T, Decl(typeParameterCompatibilityAccrossDeclarations.ts, 7, 5)) @@ -30,7 +30,7 @@ export interface I2 { >I2 : Symbol(I2, Decl(typeParameterCompatibilityAccrossDeclarations.ts, 8, 1)) x(y: any): any; ->x : Symbol(x, Decl(typeParameterCompatibilityAccrossDeclarations.ts, 9, 21)) +>x : Symbol(I2.x, Decl(typeParameterCompatibilityAccrossDeclarations.ts, 9, 21)) >y : Symbol(y, Decl(typeParameterCompatibilityAccrossDeclarations.ts, 10, 5)) } diff --git a/tests/baselines/reference/typeParameterConstrainedToOuterTypeParameter2.symbols b/tests/baselines/reference/typeParameterConstrainedToOuterTypeParameter2.symbols index cd6cefc5ec0..0d9365e4753 100644 --- a/tests/baselines/reference/typeParameterConstrainedToOuterTypeParameter2.symbols +++ b/tests/baselines/reference/typeParameterConstrainedToOuterTypeParameter2.symbols @@ -4,7 +4,7 @@ interface A { >T : Symbol(T, Decl(typeParameterConstrainedToOuterTypeParameter2.ts, 0, 12)) foo(x: A>) ->foo : Symbol(foo, Decl(typeParameterConstrainedToOuterTypeParameter2.ts, 0, 16)) +>foo : Symbol(A.foo, Decl(typeParameterConstrainedToOuterTypeParameter2.ts, 0, 16)) >U : Symbol(U, Decl(typeParameterConstrainedToOuterTypeParameter2.ts, 1, 8)) >T : Symbol(T, Decl(typeParameterConstrainedToOuterTypeParameter2.ts, 0, 12)) >x : Symbol(x, Decl(typeParameterConstrainedToOuterTypeParameter2.ts, 1, 21)) @@ -18,7 +18,7 @@ interface B { >T : Symbol(T, Decl(typeParameterConstrainedToOuterTypeParameter2.ts, 4, 12)) foo(x: B>) ->foo : Symbol(foo, Decl(typeParameterConstrainedToOuterTypeParameter2.ts, 4, 16)) +>foo : Symbol(B.foo, Decl(typeParameterConstrainedToOuterTypeParameter2.ts, 4, 16)) >U : Symbol(U, Decl(typeParameterConstrainedToOuterTypeParameter2.ts, 5, 8)) >T : Symbol(T, Decl(typeParameterConstrainedToOuterTypeParameter2.ts, 4, 12)) >x : Symbol(x, Decl(typeParameterConstrainedToOuterTypeParameter2.ts, 5, 21)) diff --git a/tests/baselines/reference/typeParameterConstraintInstantiation.symbols b/tests/baselines/reference/typeParameterConstraintInstantiation.symbols index 9103d65c0e9..f3b5a01eef9 100644 --- a/tests/baselines/reference/typeParameterConstraintInstantiation.symbols +++ b/tests/baselines/reference/typeParameterConstraintInstantiation.symbols @@ -6,7 +6,7 @@ interface Mapper { >T : Symbol(T, Decl(typeParameterConstraintInstantiation.ts, 2, 17)) map(f: (item: T) => U): V; ->map : Symbol(map, Decl(typeParameterConstraintInstantiation.ts, 2, 21)) +>map : Symbol(Mapper.map, Decl(typeParameterConstraintInstantiation.ts, 2, 21)) >U : Symbol(U, Decl(typeParameterConstraintInstantiation.ts, 3, 8)) >T : Symbol(T, Decl(typeParameterConstraintInstantiation.ts, 2, 17)) >V : Symbol(V, Decl(typeParameterConstraintInstantiation.ts, 3, 20)) diff --git a/tests/baselines/reference/typeParameterConstraints1.errors.txt b/tests/baselines/reference/typeParameterConstraints1.errors.txt index e837e19317d..97bc8165751 100644 --- a/tests/baselines/reference/typeParameterConstraints1.errors.txt +++ b/tests/baselines/reference/typeParameterConstraints1.errors.txt @@ -1,11 +1,9 @@ tests/cases/compiler/typeParameterConstraints1.ts(6,25): error TS2304: Cannot find name 'hm'. tests/cases/compiler/typeParameterConstraints1.ts(9,25): error TS1110: Type expected. tests/cases/compiler/typeParameterConstraints1.ts(10,26): error TS1110: Type expected. -tests/cases/compiler/typeParameterConstraints1.ts(11,26): error TS1110: Type expected. -tests/cases/compiler/typeParameterConstraints1.ts(12,26): error TS2304: Cannot find name 'undefined'. -==== tests/cases/compiler/typeParameterConstraints1.ts (5 errors) ==== +==== tests/cases/compiler/typeParameterConstraints1.ts (3 errors) ==== function foo1(test: T) { } function foo2(test: T) { } function foo3(test: T) { } @@ -23,9 +21,5 @@ tests/cases/compiler/typeParameterConstraints1.ts(12,26): error TS2304: Cannot f ~ !!! error TS1110: Type expected. function foo11 (test: T) { } - ~~~~ -!!! error TS1110: Type expected. function foo12(test: T) { } - ~~~~~~~~~ -!!! error TS2304: Cannot find name 'undefined'. function foo13(test: T) { } \ No newline at end of file diff --git a/tests/baselines/reference/typeParameterEquality.symbols b/tests/baselines/reference/typeParameterEquality.symbols index 562d6277d93..711d6264c48 100644 --- a/tests/baselines/reference/typeParameterEquality.symbols +++ b/tests/baselines/reference/typeParameterEquality.symbols @@ -3,14 +3,14 @@ class C { >C : Symbol(C, Decl(typeParameterEquality.ts, 0, 0)) get x(): (a: T) => T { return null; } ->x : Symbol(x, Decl(typeParameterEquality.ts, 0, 9), Decl(typeParameterEquality.ts, 1, 44)) +>x : Symbol(C.x, Decl(typeParameterEquality.ts, 0, 9), Decl(typeParameterEquality.ts, 1, 44)) >T : Symbol(T, Decl(typeParameterEquality.ts, 1, 14)) >a : Symbol(a, Decl(typeParameterEquality.ts, 1, 17)) >T : Symbol(T, Decl(typeParameterEquality.ts, 1, 14)) >T : Symbol(T, Decl(typeParameterEquality.ts, 1, 14)) set x(p: (a: U) => U) {} ->x : Symbol(x, Decl(typeParameterEquality.ts, 0, 9), Decl(typeParameterEquality.ts, 1, 44)) +>x : Symbol(C.x, Decl(typeParameterEquality.ts, 0, 9), Decl(typeParameterEquality.ts, 1, 44)) >p : Symbol(p, Decl(typeParameterEquality.ts, 2, 10)) >U : Symbol(U, Decl(typeParameterEquality.ts, 2, 14)) >a : Symbol(a, Decl(typeParameterEquality.ts, 2, 17)) diff --git a/tests/baselines/reference/typeParameterExtendingUnion1.symbols b/tests/baselines/reference/typeParameterExtendingUnion1.symbols index 39b67e6428c..0538dcf91e0 100644 --- a/tests/baselines/reference/typeParameterExtendingUnion1.symbols +++ b/tests/baselines/reference/typeParameterExtendingUnion1.symbols @@ -1,17 +1,17 @@ === tests/cases/compiler/typeParameterExtendingUnion1.ts === class Animal { run() { } } >Animal : Symbol(Animal, Decl(typeParameterExtendingUnion1.ts, 0, 0)) ->run : Symbol(run, Decl(typeParameterExtendingUnion1.ts, 0, 14)) +>run : Symbol(Animal.run, Decl(typeParameterExtendingUnion1.ts, 0, 14)) class Cat extends Animal { meow } >Cat : Symbol(Cat, Decl(typeParameterExtendingUnion1.ts, 0, 26)) >Animal : Symbol(Animal, Decl(typeParameterExtendingUnion1.ts, 0, 0)) ->meow : Symbol(meow, Decl(typeParameterExtendingUnion1.ts, 1, 26)) +>meow : Symbol(Cat.meow, Decl(typeParameterExtendingUnion1.ts, 1, 26)) class Dog extends Animal { woof } >Dog : Symbol(Dog, Decl(typeParameterExtendingUnion1.ts, 1, 33)) >Animal : Symbol(Animal, Decl(typeParameterExtendingUnion1.ts, 0, 0)) ->woof : Symbol(woof, Decl(typeParameterExtendingUnion1.ts, 2, 26)) +>woof : Symbol(Dog.woof, Decl(typeParameterExtendingUnion1.ts, 2, 26)) function run(a: Animal) { >run : Symbol(run, Decl(typeParameterExtendingUnion1.ts, 2, 33)) diff --git a/tests/baselines/reference/typeParameterExtendingUnion2.symbols b/tests/baselines/reference/typeParameterExtendingUnion2.symbols index 44d47692a82..f29f12f6f09 100644 --- a/tests/baselines/reference/typeParameterExtendingUnion2.symbols +++ b/tests/baselines/reference/typeParameterExtendingUnion2.symbols @@ -1,17 +1,17 @@ === tests/cases/compiler/typeParameterExtendingUnion2.ts === class Animal { run() { } } >Animal : Symbol(Animal, Decl(typeParameterExtendingUnion2.ts, 0, 0)) ->run : Symbol(run, Decl(typeParameterExtendingUnion2.ts, 0, 14)) +>run : Symbol(Animal.run, Decl(typeParameterExtendingUnion2.ts, 0, 14)) class Cat extends Animal { meow } >Cat : Symbol(Cat, Decl(typeParameterExtendingUnion2.ts, 0, 26)) >Animal : Symbol(Animal, Decl(typeParameterExtendingUnion2.ts, 0, 0)) ->meow : Symbol(meow, Decl(typeParameterExtendingUnion2.ts, 1, 26)) +>meow : Symbol(Cat.meow, Decl(typeParameterExtendingUnion2.ts, 1, 26)) class Dog extends Animal { woof } >Dog : Symbol(Dog, Decl(typeParameterExtendingUnion2.ts, 1, 33)) >Animal : Symbol(Animal, Decl(typeParameterExtendingUnion2.ts, 0, 0)) ->woof : Symbol(woof, Decl(typeParameterExtendingUnion2.ts, 2, 26)) +>woof : Symbol(Dog.woof, Decl(typeParameterExtendingUnion2.ts, 2, 26)) function run(a: Cat | Dog) { >run : Symbol(run, Decl(typeParameterExtendingUnion2.ts, 2, 33)) diff --git a/tests/baselines/reference/typeParameterFixingWithConstraints.symbols b/tests/baselines/reference/typeParameterFixingWithConstraints.symbols index 94e1b8172cb..4b998238130 100644 --- a/tests/baselines/reference/typeParameterFixingWithConstraints.symbols +++ b/tests/baselines/reference/typeParameterFixingWithConstraints.symbols @@ -10,7 +10,7 @@ interface IFoo { >IFoo : Symbol(IFoo, Decl(typeParameterFixingWithConstraints.ts, 2, 1)) foo(bar: TBar, bar1: (bar: TBar) => TBar, bar2: (bar: TBar) => TBar): TBar; ->foo : Symbol(foo, Decl(typeParameterFixingWithConstraints.ts, 4, 16)) +>foo : Symbol(IFoo.foo, Decl(typeParameterFixingWithConstraints.ts, 4, 16)) >TBar : Symbol(TBar, Decl(typeParameterFixingWithConstraints.ts, 5, 8)) >IBar : Symbol(IBar, Decl(typeParameterFixingWithConstraints.ts, 0, 0)) >bar : Symbol(bar, Decl(typeParameterFixingWithConstraints.ts, 5, 27)) diff --git a/tests/baselines/reference/typeParameterFixingWithConstraints.types b/tests/baselines/reference/typeParameterFixingWithConstraints.types index 22d294f9d2e..1e71f439e5e 100644 --- a/tests/baselines/reference/typeParameterFixingWithConstraints.types +++ b/tests/baselines/reference/typeParameterFixingWithConstraints.types @@ -31,17 +31,17 @@ var foo: IFoo; >IFoo : IFoo foo.foo({ bar: null }, bar => null, bar => null); ->foo.foo({ bar: null }, bar => null, bar => null) : { [x: string]: any; bar: any; } +>foo.foo({ bar: null }, bar => null, bar => null) : { bar: any; } >foo.foo : (bar: TBar, bar1: (bar: TBar) => TBar, bar2: (bar: TBar) => TBar) => TBar >foo : IFoo >foo : (bar: TBar, bar1: (bar: TBar) => TBar, bar2: (bar: TBar) => TBar) => TBar ->{ bar: null } : { [x: string]: null; bar: null; } +>{ bar: null } : { bar: null; } >bar : null >null : null ->bar => null : (bar: { [x: string]: any; bar: any; }) => any ->bar : { [x: string]: any; bar: any; } +>bar => null : (bar: { bar: any; }) => any +>bar : { bar: any; } >null : null ->bar => null : (bar: { [x: string]: any; bar: any; }) => any ->bar : { [x: string]: any; bar: any; } +>bar => null : (bar: { bar: any; }) => any +>bar : { bar: any; } >null : null diff --git a/tests/baselines/reference/typeParameterFixingWithContextSensitiveArguments.symbols b/tests/baselines/reference/typeParameterFixingWithContextSensitiveArguments.symbols index fcf8fcb8dc4..d5dad41b449 100644 --- a/tests/baselines/reference/typeParameterFixingWithContextSensitiveArguments.symbols +++ b/tests/baselines/reference/typeParameterFixingWithContextSensitiveArguments.symbols @@ -19,13 +19,13 @@ function f(y: T, f: (x: T) => U, x: T): [T, U] { return [y, f(x)]; } interface A { a: A; } >A : Symbol(A, Decl(typeParameterFixingWithContextSensitiveArguments.ts, 0, 74)) ->a : Symbol(a, Decl(typeParameterFixingWithContextSensitiveArguments.ts, 1, 13)) +>a : Symbol(A.a, Decl(typeParameterFixingWithContextSensitiveArguments.ts, 1, 13)) >A : Symbol(A, Decl(typeParameterFixingWithContextSensitiveArguments.ts, 0, 74)) interface B extends A { b; } >B : Symbol(B, Decl(typeParameterFixingWithContextSensitiveArguments.ts, 1, 21)) >A : Symbol(A, Decl(typeParameterFixingWithContextSensitiveArguments.ts, 0, 74)) ->b : Symbol(b, Decl(typeParameterFixingWithContextSensitiveArguments.ts, 2, 23)) +>b : Symbol(B.b, Decl(typeParameterFixingWithContextSensitiveArguments.ts, 2, 23)) var a: A, b: B; >a : Symbol(a, Decl(typeParameterFixingWithContextSensitiveArguments.ts, 4, 3)) diff --git a/tests/baselines/reference/typeParameterFixingWithContextSensitiveArguments4.symbols b/tests/baselines/reference/typeParameterFixingWithContextSensitiveArguments4.symbols index d8f7abea606..1e50e4a18e3 100644 --- a/tests/baselines/reference/typeParameterFixingWithContextSensitiveArguments4.symbols +++ b/tests/baselines/reference/typeParameterFixingWithContextSensitiveArguments4.symbols @@ -23,13 +23,13 @@ function f(y: T, y1: U, p: (z: U) => T, p1: (x: T) => U): [T, U] { return interface A { a: A; } >A : Symbol(A, Decl(typeParameterFixingWithContextSensitiveArguments4.ts, 0, 93)) ->a : Symbol(a, Decl(typeParameterFixingWithContextSensitiveArguments4.ts, 1, 13)) +>a : Symbol(A.a, Decl(typeParameterFixingWithContextSensitiveArguments4.ts, 1, 13)) >A : Symbol(A, Decl(typeParameterFixingWithContextSensitiveArguments4.ts, 0, 93)) interface B extends A { b; } >B : Symbol(B, Decl(typeParameterFixingWithContextSensitiveArguments4.ts, 1, 21)) >A : Symbol(A, Decl(typeParameterFixingWithContextSensitiveArguments4.ts, 0, 93)) ->b : Symbol(b, Decl(typeParameterFixingWithContextSensitiveArguments4.ts, 2, 23)) +>b : Symbol(B.b, Decl(typeParameterFixingWithContextSensitiveArguments4.ts, 2, 23)) var a: A, b: B; >a : Symbol(a, Decl(typeParameterFixingWithContextSensitiveArguments4.ts, 4, 3)) diff --git a/tests/baselines/reference/typeParameterFixingWithContextSensitiveArguments5.symbols b/tests/baselines/reference/typeParameterFixingWithContextSensitiveArguments5.symbols index 5ba8aee8dba..1f9711a19ab 100644 --- a/tests/baselines/reference/typeParameterFixingWithContextSensitiveArguments5.symbols +++ b/tests/baselines/reference/typeParameterFixingWithContextSensitiveArguments5.symbols @@ -23,13 +23,13 @@ function f(t1: T, u1: U, pf1: (u2: U) => T, pf2: (t2: T) => U): [T, U] { r interface A { a: A; } >A : Symbol(A, Decl(typeParameterFixingWithContextSensitiveArguments5.ts, 0, 102)) ->a : Symbol(a, Decl(typeParameterFixingWithContextSensitiveArguments5.ts, 1, 13)) +>a : Symbol(A.a, Decl(typeParameterFixingWithContextSensitiveArguments5.ts, 1, 13)) >A : Symbol(A, Decl(typeParameterFixingWithContextSensitiveArguments5.ts, 0, 102)) interface B extends A { b: any; } >B : Symbol(B, Decl(typeParameterFixingWithContextSensitiveArguments5.ts, 1, 21)) >A : Symbol(A, Decl(typeParameterFixingWithContextSensitiveArguments5.ts, 0, 102)) ->b : Symbol(b, Decl(typeParameterFixingWithContextSensitiveArguments5.ts, 2, 23)) +>b : Symbol(B.b, Decl(typeParameterFixingWithContextSensitiveArguments5.ts, 2, 23)) var a: A, b: B; >a : Symbol(a, Decl(typeParameterFixingWithContextSensitiveArguments5.ts, 4, 3)) diff --git a/tests/baselines/reference/typeParameterOrderReversal.symbols b/tests/baselines/reference/typeParameterOrderReversal.symbols index 6b17ac1da55..1c8fbad5550 100644 --- a/tests/baselines/reference/typeParameterOrderReversal.symbols +++ b/tests/baselines/reference/typeParameterOrderReversal.symbols @@ -4,7 +4,7 @@ interface X { >T : Symbol(T, Decl(typeParameterOrderReversal.ts, 0, 12)) n: T; ->n : Symbol(n, Decl(typeParameterOrderReversal.ts, 0, 16)) +>n : Symbol(X.n, Decl(typeParameterOrderReversal.ts, 0, 16)) >T : Symbol(T, Decl(typeParameterOrderReversal.ts, 0, 12)) } diff --git a/tests/baselines/reference/typeParameterUsedAsConstraint.symbols b/tests/baselines/reference/typeParameterUsedAsConstraint.symbols index 0b031742e75..2ab34915a65 100644 --- a/tests/baselines/reference/typeParameterUsedAsConstraint.symbols +++ b/tests/baselines/reference/typeParameterUsedAsConstraint.symbols @@ -14,7 +14,7 @@ class C2 { } class C3 { } >C3 : Symbol(C3, Decl(typeParameterUsedAsConstraint.ts, 1, 28)) >T : Symbol(T, Decl(typeParameterUsedAsConstraint.ts, 2, 9)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >U : Symbol(U, Decl(typeParameterUsedAsConstraint.ts, 2, 24)) >T : Symbol(T, Decl(typeParameterUsedAsConstraint.ts, 2, 9)) @@ -23,7 +23,7 @@ class C4 { } >T : Symbol(T, Decl(typeParameterUsedAsConstraint.ts, 3, 9)) >U : Symbol(U, Decl(typeParameterUsedAsConstraint.ts, 3, 21)) >U : Symbol(U, Decl(typeParameterUsedAsConstraint.ts, 3, 21)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) class C5 { } >C5 : Symbol(C5, Decl(typeParameterUsedAsConstraint.ts, 3, 41)) @@ -56,7 +56,7 @@ interface I2 { } interface I3 { } >I3 : Symbol(I3, Decl(typeParameterUsedAsConstraint.ts, 8, 32)) >T : Symbol(T, Decl(typeParameterUsedAsConstraint.ts, 9, 13)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >U : Symbol(U, Decl(typeParameterUsedAsConstraint.ts, 9, 28)) >T : Symbol(T, Decl(typeParameterUsedAsConstraint.ts, 9, 13)) @@ -65,7 +65,7 @@ interface I4 { } >T : Symbol(T, Decl(typeParameterUsedAsConstraint.ts, 10, 13)) >U : Symbol(U, Decl(typeParameterUsedAsConstraint.ts, 10, 25)) >U : Symbol(U, Decl(typeParameterUsedAsConstraint.ts, 10, 25)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) interface I5 { } >I5 : Symbol(I5, Decl(typeParameterUsedAsConstraint.ts, 10, 45)) @@ -98,7 +98,7 @@ function f2() { } function f3() { } >f3 : Symbol(f3, Decl(typeParameterUsedAsConstraint.ts, 15, 33)) >T : Symbol(T, Decl(typeParameterUsedAsConstraint.ts, 16, 12)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >U : Symbol(U, Decl(typeParameterUsedAsConstraint.ts, 16, 27)) >T : Symbol(T, Decl(typeParameterUsedAsConstraint.ts, 16, 12)) @@ -107,7 +107,7 @@ function f4() { } >T : Symbol(T, Decl(typeParameterUsedAsConstraint.ts, 17, 12)) >U : Symbol(U, Decl(typeParameterUsedAsConstraint.ts, 17, 24)) >U : Symbol(U, Decl(typeParameterUsedAsConstraint.ts, 17, 24)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function f5() { } >f5 : Symbol(f5, Decl(typeParameterUsedAsConstraint.ts, 17, 46)) @@ -140,7 +140,7 @@ var e2 = () => { } var e3 = () => { } >e3 : Symbol(e3, Decl(typeParameterUsedAsConstraint.ts, 23, 3)) >T : Symbol(T, Decl(typeParameterUsedAsConstraint.ts, 23, 10)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >U : Symbol(U, Decl(typeParameterUsedAsConstraint.ts, 23, 25)) >T : Symbol(T, Decl(typeParameterUsedAsConstraint.ts, 23, 10)) @@ -149,7 +149,7 @@ var e4 = () => { } >T : Symbol(T, Decl(typeParameterUsedAsConstraint.ts, 24, 10)) >U : Symbol(U, Decl(typeParameterUsedAsConstraint.ts, 24, 22)) >U : Symbol(U, Decl(typeParameterUsedAsConstraint.ts, 24, 22)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) var e5 = () => { } >e5 : Symbol(e5, Decl(typeParameterUsedAsConstraint.ts, 25, 3)) @@ -182,7 +182,7 @@ var a2: { (): void } var a3: { (): void } >a3 : Symbol(a3, Decl(typeParameterUsedAsConstraint.ts, 30, 3)) >T : Symbol(T, Decl(typeParameterUsedAsConstraint.ts, 30, 11)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >U : Symbol(U, Decl(typeParameterUsedAsConstraint.ts, 30, 26)) >T : Symbol(T, Decl(typeParameterUsedAsConstraint.ts, 30, 11)) @@ -191,7 +191,7 @@ var a4: { (): void } >T : Symbol(T, Decl(typeParameterUsedAsConstraint.ts, 31, 11)) >U : Symbol(U, Decl(typeParameterUsedAsConstraint.ts, 31, 23)) >U : Symbol(U, Decl(typeParameterUsedAsConstraint.ts, 31, 23)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) var a5: { (): void } >a5 : Symbol(a5, Decl(typeParameterUsedAsConstraint.ts, 32, 3)) diff --git a/tests/baselines/reference/typeParameterUsedAsTypeParameterConstraint3.symbols b/tests/baselines/reference/typeParameterUsedAsTypeParameterConstraint3.symbols index 5142fc44af9..afd41a6ee94 100644 --- a/tests/baselines/reference/typeParameterUsedAsTypeParameterConstraint3.symbols +++ b/tests/baselines/reference/typeParameterUsedAsTypeParameterConstraint3.symbols @@ -29,19 +29,19 @@ interface I { >V : Symbol(V, Decl(typeParameterUsedAsTypeParameterConstraint3.ts, 23, 17)) x: T; ->x : Symbol(x, Decl(typeParameterUsedAsTypeParameterConstraint3.ts, 23, 22)) +>x : Symbol(I.x, Decl(typeParameterUsedAsTypeParameterConstraint3.ts, 23, 22)) >T : Symbol(T, Decl(typeParameterUsedAsTypeParameterConstraint3.ts, 23, 12)) y: U; ->y : Symbol(y, Decl(typeParameterUsedAsTypeParameterConstraint3.ts, 24, 9)) +>y : Symbol(I.y, Decl(typeParameterUsedAsTypeParameterConstraint3.ts, 24, 9)) >U : Symbol(U, Decl(typeParameterUsedAsTypeParameterConstraint3.ts, 23, 14)) z: V; ->z : Symbol(z, Decl(typeParameterUsedAsTypeParameterConstraint3.ts, 25, 9)) +>z : Symbol(I.z, Decl(typeParameterUsedAsTypeParameterConstraint3.ts, 25, 9)) >V : Symbol(V, Decl(typeParameterUsedAsTypeParameterConstraint3.ts, 23, 17)) foo(x: W): T; ->foo : Symbol(foo, Decl(typeParameterUsedAsTypeParameterConstraint3.ts, 26, 9)) +>foo : Symbol(I.foo, Decl(typeParameterUsedAsTypeParameterConstraint3.ts, 26, 9)) >W : Symbol(W, Decl(typeParameterUsedAsTypeParameterConstraint3.ts, 27, 8)) >V : Symbol(V, Decl(typeParameterUsedAsTypeParameterConstraint3.ts, 23, 17)) >x : Symbol(x, Decl(typeParameterUsedAsTypeParameterConstraint3.ts, 27, 21)) @@ -56,19 +56,19 @@ interface I2 { >U : Symbol(U, Decl(typeParameterUsedAsTypeParameterConstraint3.ts, 30, 18)) x: T; ->x : Symbol(x, Decl(typeParameterUsedAsTypeParameterConstraint3.ts, 30, 23)) +>x : Symbol(I2.x, Decl(typeParameterUsedAsTypeParameterConstraint3.ts, 30, 23)) >T : Symbol(T, Decl(typeParameterUsedAsTypeParameterConstraint3.ts, 30, 15)) y: U; ->y : Symbol(y, Decl(typeParameterUsedAsTypeParameterConstraint3.ts, 31, 9)) +>y : Symbol(I2.y, Decl(typeParameterUsedAsTypeParameterConstraint3.ts, 31, 9)) >U : Symbol(U, Decl(typeParameterUsedAsTypeParameterConstraint3.ts, 30, 18)) z: V; ->z : Symbol(z, Decl(typeParameterUsedAsTypeParameterConstraint3.ts, 32, 9)) +>z : Symbol(I2.z, Decl(typeParameterUsedAsTypeParameterConstraint3.ts, 32, 9)) >V : Symbol(V, Decl(typeParameterUsedAsTypeParameterConstraint3.ts, 30, 13)) foo(x: W): T; ->foo : Symbol(foo, Decl(typeParameterUsedAsTypeParameterConstraint3.ts, 33, 9)) +>foo : Symbol(I2.foo, Decl(typeParameterUsedAsTypeParameterConstraint3.ts, 33, 9)) >W : Symbol(W, Decl(typeParameterUsedAsTypeParameterConstraint3.ts, 34, 8)) >V : Symbol(V, Decl(typeParameterUsedAsTypeParameterConstraint3.ts, 30, 13)) >x : Symbol(x, Decl(typeParameterUsedAsTypeParameterConstraint3.ts, 34, 21)) diff --git a/tests/baselines/reference/typeParametersAreIdenticalToThemselves.symbols b/tests/baselines/reference/typeParametersAreIdenticalToThemselves.symbols index e50bce9e043..39479bdba90 100644 --- a/tests/baselines/reference/typeParametersAreIdenticalToThemselves.symbols +++ b/tests/baselines/reference/typeParametersAreIdenticalToThemselves.symbols @@ -85,22 +85,22 @@ class C { >T : Symbol(T, Decl(typeParametersAreIdenticalToThemselves.ts, 20, 8)) foo1(x: T); ->foo1 : Symbol(foo1, Decl(typeParametersAreIdenticalToThemselves.ts, 20, 12), Decl(typeParametersAreIdenticalToThemselves.ts, 21, 15), Decl(typeParametersAreIdenticalToThemselves.ts, 22, 15)) +>foo1 : Symbol(C.foo1, Decl(typeParametersAreIdenticalToThemselves.ts, 20, 12), Decl(typeParametersAreIdenticalToThemselves.ts, 21, 15), Decl(typeParametersAreIdenticalToThemselves.ts, 22, 15)) >x : Symbol(x, Decl(typeParametersAreIdenticalToThemselves.ts, 21, 9)) >T : Symbol(T, Decl(typeParametersAreIdenticalToThemselves.ts, 20, 8)) foo1(x: T); // error, same T ->foo1 : Symbol(foo1, Decl(typeParametersAreIdenticalToThemselves.ts, 20, 12), Decl(typeParametersAreIdenticalToThemselves.ts, 21, 15), Decl(typeParametersAreIdenticalToThemselves.ts, 22, 15)) +>foo1 : Symbol(C.foo1, Decl(typeParametersAreIdenticalToThemselves.ts, 20, 12), Decl(typeParametersAreIdenticalToThemselves.ts, 21, 15), Decl(typeParametersAreIdenticalToThemselves.ts, 22, 15)) >x : Symbol(x, Decl(typeParametersAreIdenticalToThemselves.ts, 22, 9)) >T : Symbol(T, Decl(typeParametersAreIdenticalToThemselves.ts, 20, 8)) foo1(x: T) { } ->foo1 : Symbol(foo1, Decl(typeParametersAreIdenticalToThemselves.ts, 20, 12), Decl(typeParametersAreIdenticalToThemselves.ts, 21, 15), Decl(typeParametersAreIdenticalToThemselves.ts, 22, 15)) +>foo1 : Symbol(C.foo1, Decl(typeParametersAreIdenticalToThemselves.ts, 20, 12), Decl(typeParametersAreIdenticalToThemselves.ts, 21, 15), Decl(typeParametersAreIdenticalToThemselves.ts, 22, 15)) >x : Symbol(x, Decl(typeParametersAreIdenticalToThemselves.ts, 23, 9)) >T : Symbol(T, Decl(typeParametersAreIdenticalToThemselves.ts, 20, 8)) foo2(a: T, x: U); ->foo2 : Symbol(foo2, Decl(typeParametersAreIdenticalToThemselves.ts, 23, 18), Decl(typeParametersAreIdenticalToThemselves.ts, 25, 24), Decl(typeParametersAreIdenticalToThemselves.ts, 26, 24)) +>foo2 : Symbol(C.foo2, Decl(typeParametersAreIdenticalToThemselves.ts, 23, 18), Decl(typeParametersAreIdenticalToThemselves.ts, 25, 24), Decl(typeParametersAreIdenticalToThemselves.ts, 26, 24)) >U : Symbol(U, Decl(typeParametersAreIdenticalToThemselves.ts, 25, 9)) >a : Symbol(a, Decl(typeParametersAreIdenticalToThemselves.ts, 25, 12)) >T : Symbol(T, Decl(typeParametersAreIdenticalToThemselves.ts, 20, 8)) @@ -108,7 +108,7 @@ class C { >U : Symbol(U, Decl(typeParametersAreIdenticalToThemselves.ts, 25, 9)) foo2(a: T, x: U); // no error, different declaration for each U ->foo2 : Symbol(foo2, Decl(typeParametersAreIdenticalToThemselves.ts, 23, 18), Decl(typeParametersAreIdenticalToThemselves.ts, 25, 24), Decl(typeParametersAreIdenticalToThemselves.ts, 26, 24)) +>foo2 : Symbol(C.foo2, Decl(typeParametersAreIdenticalToThemselves.ts, 23, 18), Decl(typeParametersAreIdenticalToThemselves.ts, 25, 24), Decl(typeParametersAreIdenticalToThemselves.ts, 26, 24)) >U : Symbol(U, Decl(typeParametersAreIdenticalToThemselves.ts, 26, 9)) >a : Symbol(a, Decl(typeParametersAreIdenticalToThemselves.ts, 26, 12)) >T : Symbol(T, Decl(typeParametersAreIdenticalToThemselves.ts, 20, 8)) @@ -116,7 +116,7 @@ class C { >U : Symbol(U, Decl(typeParametersAreIdenticalToThemselves.ts, 26, 9)) foo2(a: T, x: U) { } ->foo2 : Symbol(foo2, Decl(typeParametersAreIdenticalToThemselves.ts, 23, 18), Decl(typeParametersAreIdenticalToThemselves.ts, 25, 24), Decl(typeParametersAreIdenticalToThemselves.ts, 26, 24)) +>foo2 : Symbol(C.foo2, Decl(typeParametersAreIdenticalToThemselves.ts, 23, 18), Decl(typeParametersAreIdenticalToThemselves.ts, 25, 24), Decl(typeParametersAreIdenticalToThemselves.ts, 26, 24)) >U : Symbol(U, Decl(typeParametersAreIdenticalToThemselves.ts, 27, 9)) >a : Symbol(a, Decl(typeParametersAreIdenticalToThemselves.ts, 27, 12)) >T : Symbol(T, Decl(typeParametersAreIdenticalToThemselves.ts, 20, 8)) @@ -124,41 +124,41 @@ class C { >U : Symbol(U, Decl(typeParametersAreIdenticalToThemselves.ts, 27, 9)) foo3(x: T); ->foo3 : Symbol(foo3, Decl(typeParametersAreIdenticalToThemselves.ts, 27, 27), Decl(typeParametersAreIdenticalToThemselves.ts, 29, 18), Decl(typeParametersAreIdenticalToThemselves.ts, 30, 18)) +>foo3 : Symbol(C.foo3, Decl(typeParametersAreIdenticalToThemselves.ts, 27, 27), Decl(typeParametersAreIdenticalToThemselves.ts, 29, 18), Decl(typeParametersAreIdenticalToThemselves.ts, 30, 18)) >T : Symbol(T, Decl(typeParametersAreIdenticalToThemselves.ts, 29, 9)) >x : Symbol(x, Decl(typeParametersAreIdenticalToThemselves.ts, 29, 12)) >T : Symbol(T, Decl(typeParametersAreIdenticalToThemselves.ts, 29, 9)) foo3(x: T); // no error, different declaration for each T ->foo3 : Symbol(foo3, Decl(typeParametersAreIdenticalToThemselves.ts, 27, 27), Decl(typeParametersAreIdenticalToThemselves.ts, 29, 18), Decl(typeParametersAreIdenticalToThemselves.ts, 30, 18)) +>foo3 : Symbol(C.foo3, Decl(typeParametersAreIdenticalToThemselves.ts, 27, 27), Decl(typeParametersAreIdenticalToThemselves.ts, 29, 18), Decl(typeParametersAreIdenticalToThemselves.ts, 30, 18)) >T : Symbol(T, Decl(typeParametersAreIdenticalToThemselves.ts, 30, 9)) >x : Symbol(x, Decl(typeParametersAreIdenticalToThemselves.ts, 30, 12)) >T : Symbol(T, Decl(typeParametersAreIdenticalToThemselves.ts, 30, 9)) foo3(x: T) { } ->foo3 : Symbol(foo3, Decl(typeParametersAreIdenticalToThemselves.ts, 27, 27), Decl(typeParametersAreIdenticalToThemselves.ts, 29, 18), Decl(typeParametersAreIdenticalToThemselves.ts, 30, 18)) +>foo3 : Symbol(C.foo3, Decl(typeParametersAreIdenticalToThemselves.ts, 27, 27), Decl(typeParametersAreIdenticalToThemselves.ts, 29, 18), Decl(typeParametersAreIdenticalToThemselves.ts, 30, 18)) >T : Symbol(T, Decl(typeParametersAreIdenticalToThemselves.ts, 31, 9)) >x : Symbol(x, Decl(typeParametersAreIdenticalToThemselves.ts, 31, 12)) >T : Symbol(T, Decl(typeParametersAreIdenticalToThemselves.ts, 31, 9)) foo4(x: T); ->foo4 : Symbol(foo4, Decl(typeParametersAreIdenticalToThemselves.ts, 31, 21), Decl(typeParametersAreIdenticalToThemselves.ts, 33, 31), Decl(typeParametersAreIdenticalToThemselves.ts, 34, 31)) +>foo4 : Symbol(C.foo4, Decl(typeParametersAreIdenticalToThemselves.ts, 31, 21), Decl(typeParametersAreIdenticalToThemselves.ts, 33, 31), Decl(typeParametersAreIdenticalToThemselves.ts, 34, 31)) >T : Symbol(T, Decl(typeParametersAreIdenticalToThemselves.ts, 33, 9)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(typeParametersAreIdenticalToThemselves.ts, 33, 25)) >T : Symbol(T, Decl(typeParametersAreIdenticalToThemselves.ts, 33, 9)) foo4(x: T); // no error, different declaration for each T ->foo4 : Symbol(foo4, Decl(typeParametersAreIdenticalToThemselves.ts, 31, 21), Decl(typeParametersAreIdenticalToThemselves.ts, 33, 31), Decl(typeParametersAreIdenticalToThemselves.ts, 34, 31)) +>foo4 : Symbol(C.foo4, Decl(typeParametersAreIdenticalToThemselves.ts, 31, 21), Decl(typeParametersAreIdenticalToThemselves.ts, 33, 31), Decl(typeParametersAreIdenticalToThemselves.ts, 34, 31)) >T : Symbol(T, Decl(typeParametersAreIdenticalToThemselves.ts, 34, 9)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(typeParametersAreIdenticalToThemselves.ts, 34, 25)) >T : Symbol(T, Decl(typeParametersAreIdenticalToThemselves.ts, 34, 9)) foo4(x: T) { } ->foo4 : Symbol(foo4, Decl(typeParametersAreIdenticalToThemselves.ts, 31, 21), Decl(typeParametersAreIdenticalToThemselves.ts, 33, 31), Decl(typeParametersAreIdenticalToThemselves.ts, 34, 31)) +>foo4 : Symbol(C.foo4, Decl(typeParametersAreIdenticalToThemselves.ts, 31, 21), Decl(typeParametersAreIdenticalToThemselves.ts, 33, 31), Decl(typeParametersAreIdenticalToThemselves.ts, 34, 31)) >T : Symbol(T, Decl(typeParametersAreIdenticalToThemselves.ts, 35, 9)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(typeParametersAreIdenticalToThemselves.ts, 35, 25)) >T : Symbol(T, Decl(typeParametersAreIdenticalToThemselves.ts, 35, 9)) } @@ -166,25 +166,25 @@ class C { class C2 { >C2 : Symbol(C2, Decl(typeParametersAreIdenticalToThemselves.ts, 36, 1)) >T : Symbol(T, Decl(typeParametersAreIdenticalToThemselves.ts, 38, 9)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) foo1(x: T); ->foo1 : Symbol(foo1, Decl(typeParametersAreIdenticalToThemselves.ts, 38, 26), Decl(typeParametersAreIdenticalToThemselves.ts, 39, 15), Decl(typeParametersAreIdenticalToThemselves.ts, 40, 15)) +>foo1 : Symbol(C2.foo1, Decl(typeParametersAreIdenticalToThemselves.ts, 38, 26), Decl(typeParametersAreIdenticalToThemselves.ts, 39, 15), Decl(typeParametersAreIdenticalToThemselves.ts, 40, 15)) >x : Symbol(x, Decl(typeParametersAreIdenticalToThemselves.ts, 39, 9)) >T : Symbol(T, Decl(typeParametersAreIdenticalToThemselves.ts, 38, 9)) foo1(x: T); // error, same T ->foo1 : Symbol(foo1, Decl(typeParametersAreIdenticalToThemselves.ts, 38, 26), Decl(typeParametersAreIdenticalToThemselves.ts, 39, 15), Decl(typeParametersAreIdenticalToThemselves.ts, 40, 15)) +>foo1 : Symbol(C2.foo1, Decl(typeParametersAreIdenticalToThemselves.ts, 38, 26), Decl(typeParametersAreIdenticalToThemselves.ts, 39, 15), Decl(typeParametersAreIdenticalToThemselves.ts, 40, 15)) >x : Symbol(x, Decl(typeParametersAreIdenticalToThemselves.ts, 40, 9)) >T : Symbol(T, Decl(typeParametersAreIdenticalToThemselves.ts, 38, 9)) foo1(x: T) { } ->foo1 : Symbol(foo1, Decl(typeParametersAreIdenticalToThemselves.ts, 38, 26), Decl(typeParametersAreIdenticalToThemselves.ts, 39, 15), Decl(typeParametersAreIdenticalToThemselves.ts, 40, 15)) +>foo1 : Symbol(C2.foo1, Decl(typeParametersAreIdenticalToThemselves.ts, 38, 26), Decl(typeParametersAreIdenticalToThemselves.ts, 39, 15), Decl(typeParametersAreIdenticalToThemselves.ts, 40, 15)) >x : Symbol(x, Decl(typeParametersAreIdenticalToThemselves.ts, 41, 9)) >T : Symbol(T, Decl(typeParametersAreIdenticalToThemselves.ts, 38, 9)) foo2(a: T, x: U); ->foo2 : Symbol(foo2, Decl(typeParametersAreIdenticalToThemselves.ts, 41, 18), Decl(typeParametersAreIdenticalToThemselves.ts, 43, 24), Decl(typeParametersAreIdenticalToThemselves.ts, 44, 24)) +>foo2 : Symbol(C2.foo2, Decl(typeParametersAreIdenticalToThemselves.ts, 41, 18), Decl(typeParametersAreIdenticalToThemselves.ts, 43, 24), Decl(typeParametersAreIdenticalToThemselves.ts, 44, 24)) >U : Symbol(U, Decl(typeParametersAreIdenticalToThemselves.ts, 43, 9)) >a : Symbol(a, Decl(typeParametersAreIdenticalToThemselves.ts, 43, 12)) >T : Symbol(T, Decl(typeParametersAreIdenticalToThemselves.ts, 38, 9)) @@ -192,7 +192,7 @@ class C2 { >U : Symbol(U, Decl(typeParametersAreIdenticalToThemselves.ts, 43, 9)) foo2(a: T, x: U); // no error, different declaration for each U ->foo2 : Symbol(foo2, Decl(typeParametersAreIdenticalToThemselves.ts, 41, 18), Decl(typeParametersAreIdenticalToThemselves.ts, 43, 24), Decl(typeParametersAreIdenticalToThemselves.ts, 44, 24)) +>foo2 : Symbol(C2.foo2, Decl(typeParametersAreIdenticalToThemselves.ts, 41, 18), Decl(typeParametersAreIdenticalToThemselves.ts, 43, 24), Decl(typeParametersAreIdenticalToThemselves.ts, 44, 24)) >U : Symbol(U, Decl(typeParametersAreIdenticalToThemselves.ts, 44, 9)) >a : Symbol(a, Decl(typeParametersAreIdenticalToThemselves.ts, 44, 12)) >T : Symbol(T, Decl(typeParametersAreIdenticalToThemselves.ts, 38, 9)) @@ -200,7 +200,7 @@ class C2 { >U : Symbol(U, Decl(typeParametersAreIdenticalToThemselves.ts, 44, 9)) foo2(a: T, x: U) { } ->foo2 : Symbol(foo2, Decl(typeParametersAreIdenticalToThemselves.ts, 41, 18), Decl(typeParametersAreIdenticalToThemselves.ts, 43, 24), Decl(typeParametersAreIdenticalToThemselves.ts, 44, 24)) +>foo2 : Symbol(C2.foo2, Decl(typeParametersAreIdenticalToThemselves.ts, 41, 18), Decl(typeParametersAreIdenticalToThemselves.ts, 43, 24), Decl(typeParametersAreIdenticalToThemselves.ts, 44, 24)) >U : Symbol(U, Decl(typeParametersAreIdenticalToThemselves.ts, 45, 9)) >a : Symbol(a, Decl(typeParametersAreIdenticalToThemselves.ts, 45, 12)) >T : Symbol(T, Decl(typeParametersAreIdenticalToThemselves.ts, 38, 9)) @@ -208,19 +208,19 @@ class C2 { >U : Symbol(U, Decl(typeParametersAreIdenticalToThemselves.ts, 45, 9)) foo3(x: T); ->foo3 : Symbol(foo3, Decl(typeParametersAreIdenticalToThemselves.ts, 45, 27), Decl(typeParametersAreIdenticalToThemselves.ts, 47, 18), Decl(typeParametersAreIdenticalToThemselves.ts, 48, 18)) +>foo3 : Symbol(C2.foo3, Decl(typeParametersAreIdenticalToThemselves.ts, 45, 27), Decl(typeParametersAreIdenticalToThemselves.ts, 47, 18), Decl(typeParametersAreIdenticalToThemselves.ts, 48, 18)) >T : Symbol(T, Decl(typeParametersAreIdenticalToThemselves.ts, 47, 9)) >x : Symbol(x, Decl(typeParametersAreIdenticalToThemselves.ts, 47, 12)) >T : Symbol(T, Decl(typeParametersAreIdenticalToThemselves.ts, 47, 9)) foo3(x: T); // no error, different declaration for each T ->foo3 : Symbol(foo3, Decl(typeParametersAreIdenticalToThemselves.ts, 45, 27), Decl(typeParametersAreIdenticalToThemselves.ts, 47, 18), Decl(typeParametersAreIdenticalToThemselves.ts, 48, 18)) +>foo3 : Symbol(C2.foo3, Decl(typeParametersAreIdenticalToThemselves.ts, 45, 27), Decl(typeParametersAreIdenticalToThemselves.ts, 47, 18), Decl(typeParametersAreIdenticalToThemselves.ts, 48, 18)) >T : Symbol(T, Decl(typeParametersAreIdenticalToThemselves.ts, 48, 9)) >x : Symbol(x, Decl(typeParametersAreIdenticalToThemselves.ts, 48, 12)) >T : Symbol(T, Decl(typeParametersAreIdenticalToThemselves.ts, 48, 9)) foo3(x: T) { } ->foo3 : Symbol(foo3, Decl(typeParametersAreIdenticalToThemselves.ts, 45, 27), Decl(typeParametersAreIdenticalToThemselves.ts, 47, 18), Decl(typeParametersAreIdenticalToThemselves.ts, 48, 18)) +>foo3 : Symbol(C2.foo3, Decl(typeParametersAreIdenticalToThemselves.ts, 45, 27), Decl(typeParametersAreIdenticalToThemselves.ts, 47, 18), Decl(typeParametersAreIdenticalToThemselves.ts, 48, 18)) >T : Symbol(T, Decl(typeParametersAreIdenticalToThemselves.ts, 49, 9)) >x : Symbol(x, Decl(typeParametersAreIdenticalToThemselves.ts, 49, 12)) >T : Symbol(T, Decl(typeParametersAreIdenticalToThemselves.ts, 49, 9)) @@ -231,17 +231,17 @@ interface I { >T : Symbol(T, Decl(typeParametersAreIdenticalToThemselves.ts, 52, 12)) foo1(x: T); ->foo1 : Symbol(foo1, Decl(typeParametersAreIdenticalToThemselves.ts, 52, 16), Decl(typeParametersAreIdenticalToThemselves.ts, 53, 15)) +>foo1 : Symbol(I.foo1, Decl(typeParametersAreIdenticalToThemselves.ts, 52, 16), Decl(typeParametersAreIdenticalToThemselves.ts, 53, 15)) >x : Symbol(x, Decl(typeParametersAreIdenticalToThemselves.ts, 53, 9)) >T : Symbol(T, Decl(typeParametersAreIdenticalToThemselves.ts, 52, 12)) foo1(x: T); // error, same T ->foo1 : Symbol(foo1, Decl(typeParametersAreIdenticalToThemselves.ts, 52, 16), Decl(typeParametersAreIdenticalToThemselves.ts, 53, 15)) +>foo1 : Symbol(I.foo1, Decl(typeParametersAreIdenticalToThemselves.ts, 52, 16), Decl(typeParametersAreIdenticalToThemselves.ts, 53, 15)) >x : Symbol(x, Decl(typeParametersAreIdenticalToThemselves.ts, 54, 9)) >T : Symbol(T, Decl(typeParametersAreIdenticalToThemselves.ts, 52, 12)) foo2(a: T, x: U); ->foo2 : Symbol(foo2, Decl(typeParametersAreIdenticalToThemselves.ts, 54, 15), Decl(typeParametersAreIdenticalToThemselves.ts, 56, 24)) +>foo2 : Symbol(I.foo2, Decl(typeParametersAreIdenticalToThemselves.ts, 54, 15), Decl(typeParametersAreIdenticalToThemselves.ts, 56, 24)) >U : Symbol(U, Decl(typeParametersAreIdenticalToThemselves.ts, 56, 9)) >a : Symbol(a, Decl(typeParametersAreIdenticalToThemselves.ts, 56, 12)) >T : Symbol(T, Decl(typeParametersAreIdenticalToThemselves.ts, 52, 12)) @@ -249,7 +249,7 @@ interface I { >U : Symbol(U, Decl(typeParametersAreIdenticalToThemselves.ts, 56, 9)) foo2(a: T, x: U); // no error, different declaration for each U ->foo2 : Symbol(foo2, Decl(typeParametersAreIdenticalToThemselves.ts, 54, 15), Decl(typeParametersAreIdenticalToThemselves.ts, 56, 24)) +>foo2 : Symbol(I.foo2, Decl(typeParametersAreIdenticalToThemselves.ts, 54, 15), Decl(typeParametersAreIdenticalToThemselves.ts, 56, 24)) >U : Symbol(U, Decl(typeParametersAreIdenticalToThemselves.ts, 57, 9)) >a : Symbol(a, Decl(typeParametersAreIdenticalToThemselves.ts, 57, 12)) >T : Symbol(T, Decl(typeParametersAreIdenticalToThemselves.ts, 52, 12)) @@ -257,28 +257,28 @@ interface I { >U : Symbol(U, Decl(typeParametersAreIdenticalToThemselves.ts, 57, 9)) foo3(x: T); ->foo3 : Symbol(foo3, Decl(typeParametersAreIdenticalToThemselves.ts, 57, 24), Decl(typeParametersAreIdenticalToThemselves.ts, 59, 18)) +>foo3 : Symbol(I.foo3, Decl(typeParametersAreIdenticalToThemselves.ts, 57, 24), Decl(typeParametersAreIdenticalToThemselves.ts, 59, 18)) >T : Symbol(T, Decl(typeParametersAreIdenticalToThemselves.ts, 59, 9)) >x : Symbol(x, Decl(typeParametersAreIdenticalToThemselves.ts, 59, 12)) >T : Symbol(T, Decl(typeParametersAreIdenticalToThemselves.ts, 59, 9)) foo3(x: T); // no error, different declaration for each T ->foo3 : Symbol(foo3, Decl(typeParametersAreIdenticalToThemselves.ts, 57, 24), Decl(typeParametersAreIdenticalToThemselves.ts, 59, 18)) +>foo3 : Symbol(I.foo3, Decl(typeParametersAreIdenticalToThemselves.ts, 57, 24), Decl(typeParametersAreIdenticalToThemselves.ts, 59, 18)) >T : Symbol(T, Decl(typeParametersAreIdenticalToThemselves.ts, 60, 9)) >x : Symbol(x, Decl(typeParametersAreIdenticalToThemselves.ts, 60, 12)) >T : Symbol(T, Decl(typeParametersAreIdenticalToThemselves.ts, 60, 9)) foo4(x: T); ->foo4 : Symbol(foo4, Decl(typeParametersAreIdenticalToThemselves.ts, 60, 18), Decl(typeParametersAreIdenticalToThemselves.ts, 62, 31)) +>foo4 : Symbol(I.foo4, Decl(typeParametersAreIdenticalToThemselves.ts, 60, 18), Decl(typeParametersAreIdenticalToThemselves.ts, 62, 31)) >T : Symbol(T, Decl(typeParametersAreIdenticalToThemselves.ts, 62, 9)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(typeParametersAreIdenticalToThemselves.ts, 62, 25)) >T : Symbol(T, Decl(typeParametersAreIdenticalToThemselves.ts, 62, 9)) foo4(x: T); // no error, different declaration for each T ->foo4 : Symbol(foo4, Decl(typeParametersAreIdenticalToThemselves.ts, 60, 18), Decl(typeParametersAreIdenticalToThemselves.ts, 62, 31)) +>foo4 : Symbol(I.foo4, Decl(typeParametersAreIdenticalToThemselves.ts, 60, 18), Decl(typeParametersAreIdenticalToThemselves.ts, 62, 31)) >T : Symbol(T, Decl(typeParametersAreIdenticalToThemselves.ts, 63, 9)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(typeParametersAreIdenticalToThemselves.ts, 63, 25)) >T : Symbol(T, Decl(typeParametersAreIdenticalToThemselves.ts, 63, 9)) } @@ -286,20 +286,20 @@ interface I { interface I2 { >I2 : Symbol(I2, Decl(typeParametersAreIdenticalToThemselves.ts, 64, 1)) >T : Symbol(T, Decl(typeParametersAreIdenticalToThemselves.ts, 66, 13)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) foo1(x: T); ->foo1 : Symbol(foo1, Decl(typeParametersAreIdenticalToThemselves.ts, 66, 30), Decl(typeParametersAreIdenticalToThemselves.ts, 67, 15)) +>foo1 : Symbol(I2.foo1, Decl(typeParametersAreIdenticalToThemselves.ts, 66, 30), Decl(typeParametersAreIdenticalToThemselves.ts, 67, 15)) >x : Symbol(x, Decl(typeParametersAreIdenticalToThemselves.ts, 67, 9)) >T : Symbol(T, Decl(typeParametersAreIdenticalToThemselves.ts, 66, 13)) foo1(x: T); // error, same T ->foo1 : Symbol(foo1, Decl(typeParametersAreIdenticalToThemselves.ts, 66, 30), Decl(typeParametersAreIdenticalToThemselves.ts, 67, 15)) +>foo1 : Symbol(I2.foo1, Decl(typeParametersAreIdenticalToThemselves.ts, 66, 30), Decl(typeParametersAreIdenticalToThemselves.ts, 67, 15)) >x : Symbol(x, Decl(typeParametersAreIdenticalToThemselves.ts, 68, 9)) >T : Symbol(T, Decl(typeParametersAreIdenticalToThemselves.ts, 66, 13)) foo2(a: T, x: U); ->foo2 : Symbol(foo2, Decl(typeParametersAreIdenticalToThemselves.ts, 68, 15), Decl(typeParametersAreIdenticalToThemselves.ts, 70, 24)) +>foo2 : Symbol(I2.foo2, Decl(typeParametersAreIdenticalToThemselves.ts, 68, 15), Decl(typeParametersAreIdenticalToThemselves.ts, 70, 24)) >U : Symbol(U, Decl(typeParametersAreIdenticalToThemselves.ts, 70, 9)) >a : Symbol(a, Decl(typeParametersAreIdenticalToThemselves.ts, 70, 12)) >T : Symbol(T, Decl(typeParametersAreIdenticalToThemselves.ts, 66, 13)) @@ -307,7 +307,7 @@ interface I2 { >U : Symbol(U, Decl(typeParametersAreIdenticalToThemselves.ts, 70, 9)) foo2(a: T, x: U); // no error, different declaration for each U ->foo2 : Symbol(foo2, Decl(typeParametersAreIdenticalToThemselves.ts, 68, 15), Decl(typeParametersAreIdenticalToThemselves.ts, 70, 24)) +>foo2 : Symbol(I2.foo2, Decl(typeParametersAreIdenticalToThemselves.ts, 68, 15), Decl(typeParametersAreIdenticalToThemselves.ts, 70, 24)) >U : Symbol(U, Decl(typeParametersAreIdenticalToThemselves.ts, 71, 9)) >a : Symbol(a, Decl(typeParametersAreIdenticalToThemselves.ts, 71, 12)) >T : Symbol(T, Decl(typeParametersAreIdenticalToThemselves.ts, 66, 13)) @@ -315,13 +315,13 @@ interface I2 { >U : Symbol(U, Decl(typeParametersAreIdenticalToThemselves.ts, 71, 9)) foo3(x: T); ->foo3 : Symbol(foo3, Decl(typeParametersAreIdenticalToThemselves.ts, 71, 24), Decl(typeParametersAreIdenticalToThemselves.ts, 73, 18)) +>foo3 : Symbol(I2.foo3, Decl(typeParametersAreIdenticalToThemselves.ts, 71, 24), Decl(typeParametersAreIdenticalToThemselves.ts, 73, 18)) >T : Symbol(T, Decl(typeParametersAreIdenticalToThemselves.ts, 73, 9)) >x : Symbol(x, Decl(typeParametersAreIdenticalToThemselves.ts, 73, 12)) >T : Symbol(T, Decl(typeParametersAreIdenticalToThemselves.ts, 73, 9)) foo3(x: T); // no error, different declaration for each T ->foo3 : Symbol(foo3, Decl(typeParametersAreIdenticalToThemselves.ts, 71, 24), Decl(typeParametersAreIdenticalToThemselves.ts, 73, 18)) +>foo3 : Symbol(I2.foo3, Decl(typeParametersAreIdenticalToThemselves.ts, 71, 24), Decl(typeParametersAreIdenticalToThemselves.ts, 73, 18)) >T : Symbol(T, Decl(typeParametersAreIdenticalToThemselves.ts, 74, 9)) >x : Symbol(x, Decl(typeParametersAreIdenticalToThemselves.ts, 74, 12)) >T : Symbol(T, Decl(typeParametersAreIdenticalToThemselves.ts, 74, 9)) diff --git a/tests/baselines/reference/typeParametersAvailableInNestedScope.symbols b/tests/baselines/reference/typeParametersAvailableInNestedScope.symbols index 905ccba8f3f..d9b3661ace9 100644 --- a/tests/baselines/reference/typeParametersAvailableInNestedScope.symbols +++ b/tests/baselines/reference/typeParametersAvailableInNestedScope.symbols @@ -4,11 +4,11 @@ class C { >T : Symbol(T, Decl(typeParametersAvailableInNestedScope.ts, 0, 8)) data: T; ->data : Symbol(data, Decl(typeParametersAvailableInNestedScope.ts, 0, 12)) +>data : Symbol(C.data, Decl(typeParametersAvailableInNestedScope.ts, 0, 12)) >T : Symbol(T, Decl(typeParametersAvailableInNestedScope.ts, 0, 8)) x = (a: U) => { ->x : Symbol(x, Decl(typeParametersAvailableInNestedScope.ts, 1, 12)) +>x : Symbol(C.x, Decl(typeParametersAvailableInNestedScope.ts, 1, 12)) >U : Symbol(U, Decl(typeParametersAvailableInNestedScope.ts, 3, 9)) >a : Symbol(a, Decl(typeParametersAvailableInNestedScope.ts, 3, 12)) >U : Symbol(U, Decl(typeParametersAvailableInNestedScope.ts, 3, 9)) @@ -22,7 +22,7 @@ class C { } foo() { ->foo : Symbol(foo, Decl(typeParametersAvailableInNestedScope.ts, 6, 5)) +>foo : Symbol(C.foo, Decl(typeParametersAvailableInNestedScope.ts, 6, 5)) function temp(a: U) { >temp : Symbol(temp, Decl(typeParametersAvailableInNestedScope.ts, 8, 11)) diff --git a/tests/baselines/reference/typePredicateASI.symbols b/tests/baselines/reference/typePredicateASI.symbols index c451c4caf06..b3a9c3fd030 100644 --- a/tests/baselines/reference/typePredicateASI.symbols +++ b/tests/baselines/reference/typePredicateASI.symbols @@ -3,12 +3,12 @@ interface I { >I : Symbol(I, Decl(typePredicateASI.ts, 0, 0)) foo(callback: (a: any, b: any) => void): I ->foo : Symbol(foo, Decl(typePredicateASI.ts, 0, 13)) +>foo : Symbol(I.foo, Decl(typePredicateASI.ts, 0, 13)) >callback : Symbol(callback, Decl(typePredicateASI.ts, 1, 8)) >a : Symbol(a, Decl(typePredicateASI.ts, 1, 19)) >b : Symbol(b, Decl(typePredicateASI.ts, 1, 26)) >I : Symbol(I, Decl(typePredicateASI.ts, 0, 0)) is(): boolean; ->is : Symbol(is, Decl(typePredicateASI.ts, 1, 46)) +>is : Symbol(I.is, Decl(typePredicateASI.ts, 1, 46)) } diff --git a/tests/baselines/reference/typePredicateOnVariableDeclaration01.errors.txt b/tests/baselines/reference/typePredicateOnVariableDeclaration01.errors.txt new file mode 100644 index 00000000000..b713dd12ae7 --- /dev/null +++ b/tests/baselines/reference/typePredicateOnVariableDeclaration01.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/expressions/typeGuards/typePredicateOnVariableDeclaration01.ts(2,8): error TS1228: A type predicate is only allowed in return type position for functions and methods. + + +==== tests/cases/conformance/expressions/typeGuards/typePredicateOnVariableDeclaration01.ts (1 errors) ==== + + var x: this is string; + ~~~~~~~~~~~~~~ +!!! error TS1228: A type predicate is only allowed in return type position for functions and methods. \ No newline at end of file diff --git a/tests/baselines/reference/typePredicateOnVariableDeclaration01.js b/tests/baselines/reference/typePredicateOnVariableDeclaration01.js new file mode 100644 index 00000000000..5831142cf5c --- /dev/null +++ b/tests/baselines/reference/typePredicateOnVariableDeclaration01.js @@ -0,0 +1,10 @@ +//// [typePredicateOnVariableDeclaration01.ts] + +var x: this is string; + +//// [typePredicateOnVariableDeclaration01.js] +var x; + + +//// [typePredicateOnVariableDeclaration01.d.ts] +declare var x: this is string; diff --git a/tests/baselines/reference/typePredicateOnVariableDeclaration02.errors.txt b/tests/baselines/reference/typePredicateOnVariableDeclaration02.errors.txt new file mode 100644 index 00000000000..af967b22b79 --- /dev/null +++ b/tests/baselines/reference/typePredicateOnVariableDeclaration02.errors.txt @@ -0,0 +1,20 @@ +tests/cases/conformance/expressions/typeGuards/typePredicateOnVariableDeclaration02.ts(2,8): error TS2304: Cannot find name 'z'. +tests/cases/conformance/expressions/typeGuards/typePredicateOnVariableDeclaration02.ts(2,8): error TS4025: Exported variable 'y' has or is using private name 'z'. +tests/cases/conformance/expressions/typeGuards/typePredicateOnVariableDeclaration02.ts(2,10): error TS1005: '=' expected. +tests/cases/conformance/expressions/typeGuards/typePredicateOnVariableDeclaration02.ts(2,10): error TS2304: Cannot find name 'is'. +tests/cases/conformance/expressions/typeGuards/typePredicateOnVariableDeclaration02.ts(2,13): error TS1005: ',' expected. + + +==== tests/cases/conformance/expressions/typeGuards/typePredicateOnVariableDeclaration02.ts (5 errors) ==== + + var y: z is number; + ~ +!!! error TS2304: Cannot find name 'z'. + ~ +!!! error TS4025: Exported variable 'y' has or is using private name 'z'. + ~~ +!!! error TS1005: '=' expected. + ~~ +!!! error TS2304: Cannot find name 'is'. + ~~~~~~ +!!! error TS1005: ',' expected. \ No newline at end of file diff --git a/tests/baselines/reference/typePredicateOnVariableDeclaration02.js b/tests/baselines/reference/typePredicateOnVariableDeclaration02.js new file mode 100644 index 00000000000..b28a89116ba --- /dev/null +++ b/tests/baselines/reference/typePredicateOnVariableDeclaration02.js @@ -0,0 +1,6 @@ +//// [typePredicateOnVariableDeclaration02.ts] + +var y: z is number; + +//// [typePredicateOnVariableDeclaration02.js] +var y = is, number; diff --git a/tests/baselines/reference/typeQueryWithReservedWords.symbols b/tests/baselines/reference/typeQueryWithReservedWords.symbols index c8c04e3c2aa..e804d9dddaa 100644 --- a/tests/baselines/reference/typeQueryWithReservedWords.symbols +++ b/tests/baselines/reference/typeQueryWithReservedWords.symbols @@ -3,13 +3,13 @@ class Controller { >Controller : Symbol(Controller, Decl(typeQueryWithReservedWords.ts, 0, 0)) create() { ->create : Symbol(create, Decl(typeQueryWithReservedWords.ts, 0, 18)) +>create : Symbol(Controller.create, Decl(typeQueryWithReservedWords.ts, 0, 18)) } delete() { ->delete : Symbol(delete, Decl(typeQueryWithReservedWords.ts, 2, 5)) +>delete : Symbol(Controller.delete, Decl(typeQueryWithReservedWords.ts, 2, 5)) } var() { ->var : Symbol(var, Decl(typeQueryWithReservedWords.ts, 4, 5)) +>var : Symbol(Controller.var, Decl(typeQueryWithReservedWords.ts, 4, 5)) } } @@ -17,7 +17,7 @@ interface IScope { >IScope : Symbol(IScope, Decl(typeQueryWithReservedWords.ts, 7, 1)) create: typeof Controller.prototype.create; ->create : Symbol(create, Decl(typeQueryWithReservedWords.ts, 9, 18)) +>create : Symbol(IScope.create, Decl(typeQueryWithReservedWords.ts, 9, 18)) >Controller.prototype.create : Symbol(Controller.create, Decl(typeQueryWithReservedWords.ts, 0, 18)) >Controller.prototype : Symbol(Controller.prototype) >Controller : Symbol(Controller, Decl(typeQueryWithReservedWords.ts, 0, 0)) @@ -25,7 +25,7 @@ interface IScope { >create : Symbol(Controller.create, Decl(typeQueryWithReservedWords.ts, 0, 18)) delete: typeof Controller.prototype.delete; // Should not error ->delete : Symbol(delete, Decl(typeQueryWithReservedWords.ts, 10, 47)) +>delete : Symbol(IScope.delete, Decl(typeQueryWithReservedWords.ts, 10, 47)) >Controller.prototype.delete : Symbol(Controller.delete, Decl(typeQueryWithReservedWords.ts, 2, 5)) >Controller.prototype : Symbol(Controller.prototype) >Controller : Symbol(Controller, Decl(typeQueryWithReservedWords.ts, 0, 0)) @@ -33,7 +33,7 @@ interface IScope { >delete : Symbol(Controller.delete, Decl(typeQueryWithReservedWords.ts, 2, 5)) var: typeof Controller.prototype.var; // Should not error ->var : Symbol(var, Decl(typeQueryWithReservedWords.ts, 11, 47)) +>var : Symbol(IScope.var, Decl(typeQueryWithReservedWords.ts, 11, 47)) >Controller.prototype.var : Symbol(Controller.var, Decl(typeQueryWithReservedWords.ts, 4, 5)) >Controller.prototype : Symbol(Controller.prototype) >Controller : Symbol(Controller, Decl(typeQueryWithReservedWords.ts, 0, 0)) diff --git a/tests/baselines/reference/typeReferenceDirectives1.js b/tests/baselines/reference/typeReferenceDirectives1.js new file mode 100644 index 00000000000..775af9c5283 --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives1.js @@ -0,0 +1,21 @@ +//// [tests/cases/compiler/typeReferenceDirectives1.ts] //// + +//// [index.d.ts] + + +interface $ { x } + +//// [app.ts] +/// +interface A { + x: $ +} + +//// [app.js] + + +//// [app.d.ts] +/// +interface A { + x: $; +} diff --git a/tests/baselines/reference/typeReferenceDirectives1.symbols b/tests/baselines/reference/typeReferenceDirectives1.symbols new file mode 100644 index 00000000000..55c17b219ec --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives1.symbols @@ -0,0 +1,16 @@ +=== /app.ts === +/// +interface A { +>A : Symbol(A, Decl(app.ts, 0, 0)) + + x: $ +>x : Symbol(A.x, Decl(app.ts, 1, 13)) +>$ : Symbol($, Decl(index.d.ts, 0, 0)) +} +=== /types/lib/index.d.ts === + + +interface $ { x } +>$ : Symbol($, Decl(index.d.ts, 0, 0)) +>x : Symbol($.x, Decl(index.d.ts, 2, 13)) + diff --git a/tests/baselines/reference/typeReferenceDirectives1.trace.json b/tests/baselines/reference/typeReferenceDirectives1.trace.json new file mode 100644 index 00000000000..c936a84dcc0 --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives1.trace.json @@ -0,0 +1,7 @@ +[ + "======== Resolving type reference directive 'lib', containing file '/app.ts', root directory '/'. ========", + "Resolving with primary search path '/types/'", + "File '/types/lib/package.json' does not exist.", + "File '/types/lib/index.d.ts' exist - use it as a name resolution result.", + "======== Type reference directive 'lib' was successfully resolved to '/types/lib/index.d.ts', primary: true. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/typeReferenceDirectives1.types b/tests/baselines/reference/typeReferenceDirectives1.types new file mode 100644 index 00000000000..05080e05651 --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives1.types @@ -0,0 +1,16 @@ +=== /app.ts === +/// +interface A { +>A : A + + x: $ +>x : $ +>$ : $ +} +=== /types/lib/index.d.ts === + + +interface $ { x } +>$ : $ +>x : any + diff --git a/tests/baselines/reference/typeReferenceDirectives10.js b/tests/baselines/reference/typeReferenceDirectives10.js new file mode 100644 index 00000000000..e4253bb3a58 --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives10.js @@ -0,0 +1,26 @@ +//// [tests/cases/compiler/typeReferenceDirectives10.ts] //// + +//// [ref.d.ts] + +export interface $ { x } + +//// [index.d.ts] +declare let $: { x: number } + +//// [app.ts] +/// +import {$} from "./ref"; +export interface A { + x: $ +} + + +//// [app.js] +"use strict"; + + +//// [app.d.ts] +import { $ } from "./ref"; +export interface A { + x: $; +} diff --git a/tests/baselines/reference/typeReferenceDirectives10.symbols b/tests/baselines/reference/typeReferenceDirectives10.symbols new file mode 100644 index 00000000000..910f9ac6643 --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives10.symbols @@ -0,0 +1,24 @@ +=== /app.ts === +/// +import {$} from "./ref"; +>$ : Symbol($, Decl(app.ts, 1, 8)) + +export interface A { +>A : Symbol(A, Decl(app.ts, 1, 24)) + + x: $ +>x : Symbol(A.x, Decl(app.ts, 2, 20)) +>$ : Symbol($, Decl(app.ts, 1, 8)) +} + +=== /ref.d.ts === + +export interface $ { x } +>$ : Symbol($, Decl(ref.d.ts, 0, 0)) +>x : Symbol($.x, Decl(ref.d.ts, 1, 20)) + +=== /types/lib/index.d.ts === +declare let $: { x: number } +>$ : Symbol($, Decl(index.d.ts, 0, 11)) +>x : Symbol(x, Decl(index.d.ts, 0, 16)) + diff --git a/tests/baselines/reference/typeReferenceDirectives10.trace.json b/tests/baselines/reference/typeReferenceDirectives10.trace.json new file mode 100644 index 00000000000..b6adaf1f513 --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives10.trace.json @@ -0,0 +1,14 @@ +[ + "======== Resolving type reference directive 'lib', containing file '/app.ts', root directory '/'. ========", + "Resolving with primary search path '/types/'", + "File '/types/lib/package.json' does not exist.", + "File '/types/lib/index.d.ts' exist - use it as a name resolution result.", + "======== Type reference directive 'lib' was successfully resolved to '/types/lib/index.d.ts', primary: true. ========", + "======== Resolving module './ref' from '/app.ts'. ========", + "Module resolution kind is not specified, using 'NodeJs'.", + "Loading module as file / folder, candidate module location '/ref'.", + "File '/ref.ts' does not exist.", + "File '/ref.tsx' does not exist.", + "File '/ref.d.ts' exist - use it as a name resolution result.", + "======== Module name './ref' was successfully resolved to '/ref.d.ts'. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/typeReferenceDirectives10.types b/tests/baselines/reference/typeReferenceDirectives10.types new file mode 100644 index 00000000000..c33e2e64a88 --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives10.types @@ -0,0 +1,24 @@ +=== /app.ts === +/// +import {$} from "./ref"; +>$ : any + +export interface A { +>A : A + + x: $ +>x : $ +>$ : $ +} + +=== /ref.d.ts === + +export interface $ { x } +>$ : $ +>x : any + +=== /types/lib/index.d.ts === +declare let $: { x: number } +>$ : { x: number; } +>x : number + diff --git a/tests/baselines/reference/typeReferenceDirectives11.js b/tests/baselines/reference/typeReferenceDirectives11.js new file mode 100644 index 00000000000..cb41c843adc --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives11.js @@ -0,0 +1,27 @@ +//// [tests/cases/compiler/typeReferenceDirectives11.ts] //// + +//// [index.d.ts] + + +interface Lib { x } + +//// [mod1.ts] + +export function foo(): Lib { return {x: 1} } + +//// [mod2.ts] + +import {foo} from "./mod1"; +export const bar = foo(); + +//// [output.js] + + +//// [output.d.ts] +/// +declare module "mod1" { + export function foo(): Lib; +} +declare module "mod2" { + export const bar: Lib; +} diff --git a/tests/baselines/reference/typeReferenceDirectives11.symbols b/tests/baselines/reference/typeReferenceDirectives11.symbols new file mode 100644 index 00000000000..875bb2a0900 --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives11.symbols @@ -0,0 +1,23 @@ +=== /mod2.ts === + +import {foo} from "./mod1"; +>foo : Symbol(foo, Decl(mod2.ts, 1, 8)) + +export const bar = foo(); +>bar : Symbol(bar, Decl(mod2.ts, 2, 12)) +>foo : Symbol(foo, Decl(mod2.ts, 1, 8)) + +=== /types/lib/index.d.ts === + + +interface Lib { x } +>Lib : Symbol(Lib, Decl(index.d.ts, 0, 0)) +>x : Symbol(Lib.x, Decl(index.d.ts, 2, 15)) + +=== /mod1.ts === + +export function foo(): Lib { return {x: 1} } +>foo : Symbol(foo, Decl(mod1.ts, 0, 0)) +>Lib : Symbol(Lib, Decl(index.d.ts, 0, 0)) +>x : Symbol(x, Decl(mod1.ts, 1, 37)) + diff --git a/tests/baselines/reference/typeReferenceDirectives11.trace.json b/tests/baselines/reference/typeReferenceDirectives11.trace.json new file mode 100644 index 00000000000..be060569d83 --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives11.trace.json @@ -0,0 +1,12 @@ +[ + "======== Resolving type reference directive 'lib', containing file not set, root directory '/'. ========", + "Resolving with primary search path '/types/'", + "File '/types/lib/package.json' does not exist.", + "File '/types/lib/index.d.ts' exist - use it as a name resolution result.", + "======== Type reference directive 'lib' was successfully resolved to '/types/lib/index.d.ts', primary: true. ========", + "======== Resolving module './mod1' from '/mod2.ts'. ========", + "Module resolution kind is not specified, using 'NodeJs'.", + "Loading module as file / folder, candidate module location '/mod1'.", + "File '/mod1.ts' exist - use it as a name resolution result.", + "======== Module name './mod1' was successfully resolved to '/mod1.ts'. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/typeReferenceDirectives11.types b/tests/baselines/reference/typeReferenceDirectives11.types new file mode 100644 index 00000000000..93d80b7988a --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives11.types @@ -0,0 +1,26 @@ +=== /mod2.ts === + +import {foo} from "./mod1"; +>foo : () => Lib + +export const bar = foo(); +>bar : Lib +>foo() : Lib +>foo : () => Lib + +=== /types/lib/index.d.ts === + + +interface Lib { x } +>Lib : Lib +>x : any + +=== /mod1.ts === + +export function foo(): Lib { return {x: 1} } +>foo : () => Lib +>Lib : Lib +>{x: 1} : { x: number; } +>x : number +>1 : number + diff --git a/tests/baselines/reference/typeReferenceDirectives12.js b/tests/baselines/reference/typeReferenceDirectives12.js new file mode 100644 index 00000000000..c9c4a912da1 --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives12.js @@ -0,0 +1,63 @@ +//// [tests/cases/compiler/typeReferenceDirectives12.ts] //// + +//// [index.d.ts] + + +interface Lib { x } + +//// [main.ts] +export class Cls { + x +} + +//// [mod1.ts] +/// + +import {Cls} from "./main"; +Cls.prototype.foo = function() { return undefined; } + +declare module "./main" { + interface Cls { + foo(): Lib; + } + namespace Cls { + function bar(): Lib; + } +} + +//// [mod2.ts] +import { Cls } from "./main"; +import "./mod1"; + +export const cls = Cls; +export const foo = new Cls().foo(); +export const bar = Cls.bar(); + +//// [output.js] +/// + + +//// [output.d.ts] +/// +declare module "main" { + export class Cls { + x: any; + } +} +declare module "mod1" { + module "main" { + interface Cls { + foo(): Lib; + } + namespace Cls { + function bar(): Lib; + } + } +} +declare module "mod2" { + import { Cls } from "main"; + import "mod1"; + export const cls: typeof Cls; + export const foo: Lib; + export const bar: Lib; +} diff --git a/tests/baselines/reference/typeReferenceDirectives12.symbols b/tests/baselines/reference/typeReferenceDirectives12.symbols new file mode 100644 index 00000000000..30b24c39284 --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives12.symbols @@ -0,0 +1,68 @@ +=== /mod2.ts === +import { Cls } from "./main"; +>Cls : Symbol(Cls, Decl(mod2.ts, 0, 8)) + +import "./mod1"; + +export const cls = Cls; +>cls : Symbol(cls, Decl(mod2.ts, 3, 12)) +>Cls : Symbol(Cls, Decl(mod2.ts, 0, 8)) + +export const foo = new Cls().foo(); +>foo : Symbol(foo, Decl(mod2.ts, 4, 12)) +>new Cls().foo : Symbol(Cls.foo, Decl(mod1.ts, 6, 19)) +>Cls : Symbol(Cls, Decl(mod2.ts, 0, 8)) +>foo : Symbol(Cls.foo, Decl(mod1.ts, 6, 19)) + +export const bar = Cls.bar(); +>bar : Symbol(bar, Decl(mod2.ts, 5, 12)) +>Cls.bar : Symbol(Cls.bar, Decl(mod1.ts, 9, 19)) +>Cls : Symbol(Cls, Decl(mod2.ts, 0, 8)) +>bar : Symbol(Cls.bar, Decl(mod1.ts, 9, 19)) + +=== /types/lib/index.d.ts === + + +interface Lib { x } +>Lib : Symbol(Lib, Decl(index.d.ts, 0, 0)) +>x : Symbol(Lib.x, Decl(index.d.ts, 2, 15)) + +=== /main.ts === +export class Cls { +>Cls : Symbol(Cls, Decl(main.ts, 0, 0), Decl(mod1.ts, 5, 25), Decl(mod1.ts, 8, 5)) + + x +>x : Symbol(Cls.x, Decl(main.ts, 0, 18)) +} + +=== /mod1.ts === +/// + +import {Cls} from "./main"; +>Cls : Symbol(Cls, Decl(mod1.ts, 2, 8)) + +Cls.prototype.foo = function() { return undefined; } +>Cls.prototype.foo : Symbol(Cls.foo, Decl(mod1.ts, 6, 19)) +>Cls.prototype : Symbol(Cls.prototype) +>Cls : Symbol(Cls, Decl(mod1.ts, 2, 8)) +>prototype : Symbol(Cls.prototype) +>foo : Symbol(Cls.foo, Decl(mod1.ts, 6, 19)) +>undefined : Symbol(undefined) + +declare module "./main" { + interface Cls { +>Cls : Symbol(Cls, Decl(main.ts, 0, 0), Decl(mod1.ts, 5, 25), Decl(mod1.ts, 8, 5)) + + foo(): Lib; +>foo : Symbol(Cls.foo, Decl(mod1.ts, 6, 19)) +>Lib : Symbol(Lib, Decl(index.d.ts, 0, 0)) + } + namespace Cls { +>Cls : Symbol(Cls, Decl(main.ts, 0, 0), Decl(mod1.ts, 5, 25), Decl(mod1.ts, 8, 5)) + + function bar(): Lib; +>bar : Symbol(bar, Decl(mod1.ts, 9, 19)) +>Lib : Symbol(Lib, Decl(index.d.ts, 0, 0)) + } +} + diff --git a/tests/baselines/reference/typeReferenceDirectives12.trace.json b/tests/baselines/reference/typeReferenceDirectives12.trace.json new file mode 100644 index 00000000000..f4fc0937325 --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives12.trace.json @@ -0,0 +1,22 @@ +[ + "======== Resolving module './main' from '/mod2.ts'. ========", + "Module resolution kind is not specified, using 'NodeJs'.", + "Loading module as file / folder, candidate module location '/main'.", + "File '/main.ts' exist - use it as a name resolution result.", + "======== Module name './main' was successfully resolved to '/main.ts'. ========", + "======== Resolving module './mod1' from '/mod2.ts'. ========", + "Module resolution kind is not specified, using 'NodeJs'.", + "Loading module as file / folder, candidate module location '/mod1'.", + "File '/mod1.ts' exist - use it as a name resolution result.", + "======== Module name './mod1' was successfully resolved to '/mod1.ts'. ========", + "======== Resolving type reference directive 'lib', containing file '/mod1.ts', root directory '/'. ========", + "Resolving with primary search path '/types/'", + "File '/types/lib/package.json' does not exist.", + "File '/types/lib/index.d.ts' exist - use it as a name resolution result.", + "======== Type reference directive 'lib' was successfully resolved to '/types/lib/index.d.ts', primary: true. ========", + "======== Resolving module './main' from '/mod1.ts'. ========", + "Module resolution kind is not specified, using 'NodeJs'.", + "Loading module as file / folder, candidate module location '/main'.", + "File '/main.ts' exist - use it as a name resolution result.", + "======== Module name './main' was successfully resolved to '/main.ts'. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/typeReferenceDirectives12.types b/tests/baselines/reference/typeReferenceDirectives12.types new file mode 100644 index 00000000000..bd429b91f1c --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives12.types @@ -0,0 +1,73 @@ +=== /mod2.ts === +import { Cls } from "./main"; +>Cls : typeof Cls + +import "./mod1"; + +export const cls = Cls; +>cls : typeof Cls +>Cls : typeof Cls + +export const foo = new Cls().foo(); +>foo : Lib +>new Cls().foo() : Lib +>new Cls().foo : () => Lib +>new Cls() : Cls +>Cls : typeof Cls +>foo : () => Lib + +export const bar = Cls.bar(); +>bar : Lib +>Cls.bar() : Lib +>Cls.bar : () => Lib +>Cls : typeof Cls +>bar : () => Lib + +=== /types/lib/index.d.ts === + + +interface Lib { x } +>Lib : Lib +>x : any + +=== /main.ts === +export class Cls { +>Cls : Cls + + x +>x : any +} + +=== /mod1.ts === +/// + +import {Cls} from "./main"; +>Cls : typeof Cls + +Cls.prototype.foo = function() { return undefined; } +>Cls.prototype.foo = function() { return undefined; } : () => any +>Cls.prototype.foo : () => Lib +>Cls.prototype : Cls +>Cls : typeof Cls +>prototype : Cls +>foo : () => Lib +>function() { return undefined; } : () => any +>undefined : undefined + +declare module "./main" { + interface Cls { +>Cls : Cls + + foo(): Lib; +>foo : () => Lib +>Lib : Lib + } + namespace Cls { +>Cls : typeof Cls + + function bar(): Lib; +>bar : () => Lib +>Lib : Lib + } +} + diff --git a/tests/baselines/reference/typeReferenceDirectives13.js b/tests/baselines/reference/typeReferenceDirectives13.js new file mode 100644 index 00000000000..9fecdd47f77 --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives13.js @@ -0,0 +1,26 @@ +//// [tests/cases/compiler/typeReferenceDirectives13.ts] //// + +//// [ref.d.ts] + +export interface $ { x } + +//// [index.d.ts] +declare let $: { x: number } + +//// [app.ts] +/// +import {$} from "./ref"; +export interface A { + x: () => typeof $ +} + + +//// [app.js] +"use strict"; + + +//// [app.d.ts] +/// +export interface A { + x: () => typeof $; +} diff --git a/tests/baselines/reference/typeReferenceDirectives13.symbols b/tests/baselines/reference/typeReferenceDirectives13.symbols new file mode 100644 index 00000000000..90a32b16341 --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives13.symbols @@ -0,0 +1,24 @@ +=== /app.ts === +/// +import {$} from "./ref"; +>$ : Symbol($, Decl(app.ts, 1, 8)) + +export interface A { +>A : Symbol(A, Decl(app.ts, 1, 24)) + + x: () => typeof $ +>x : Symbol(A.x, Decl(app.ts, 2, 20)) +>$ : Symbol($, Decl(app.ts, 1, 8)) +} + +=== /ref.d.ts === + +export interface $ { x } +>$ : Symbol($, Decl(ref.d.ts, 0, 0)) +>x : Symbol($.x, Decl(ref.d.ts, 1, 20)) + +=== /types/lib/index.d.ts === +declare let $: { x: number } +>$ : Symbol($, Decl(index.d.ts, 0, 11)) +>x : Symbol(x, Decl(index.d.ts, 0, 16)) + diff --git a/tests/baselines/reference/typeReferenceDirectives13.trace.json b/tests/baselines/reference/typeReferenceDirectives13.trace.json new file mode 100644 index 00000000000..b6adaf1f513 --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives13.trace.json @@ -0,0 +1,14 @@ +[ + "======== Resolving type reference directive 'lib', containing file '/app.ts', root directory '/'. ========", + "Resolving with primary search path '/types/'", + "File '/types/lib/package.json' does not exist.", + "File '/types/lib/index.d.ts' exist - use it as a name resolution result.", + "======== Type reference directive 'lib' was successfully resolved to '/types/lib/index.d.ts', primary: true. ========", + "======== Resolving module './ref' from '/app.ts'. ========", + "Module resolution kind is not specified, using 'NodeJs'.", + "Loading module as file / folder, candidate module location '/ref'.", + "File '/ref.ts' does not exist.", + "File '/ref.tsx' does not exist.", + "File '/ref.d.ts' exist - use it as a name resolution result.", + "======== Module name './ref' was successfully resolved to '/ref.d.ts'. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/typeReferenceDirectives13.types b/tests/baselines/reference/typeReferenceDirectives13.types new file mode 100644 index 00000000000..240661883bb --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives13.types @@ -0,0 +1,24 @@ +=== /app.ts === +/// +import {$} from "./ref"; +>$ : any + +export interface A { +>A : A + + x: () => typeof $ +>x : () => { x: number; } +>$ : { x: number; } +} + +=== /ref.d.ts === + +export interface $ { x } +>$ : $ +>x : any + +=== /types/lib/index.d.ts === +declare let $: { x: number } +>$ : { x: number; } +>x : number + diff --git a/tests/baselines/reference/typeReferenceDirectives2.js b/tests/baselines/reference/typeReferenceDirectives2.js new file mode 100644 index 00000000000..3d441ac04fc --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives2.js @@ -0,0 +1,19 @@ +//// [tests/cases/compiler/typeReferenceDirectives2.ts] //// + +//// [index.d.ts] + +interface $ { x } + +//// [app.ts] +interface A { + x: $ +} + +//// [app.js] + + +//// [app.d.ts] +/// +interface A { + x: $; +} diff --git a/tests/baselines/reference/typeReferenceDirectives2.symbols b/tests/baselines/reference/typeReferenceDirectives2.symbols new file mode 100644 index 00000000000..100296c11cf --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives2.symbols @@ -0,0 +1,14 @@ +=== /app.ts === +interface A { +>A : Symbol(A, Decl(app.ts, 0, 0)) + + x: $ +>x : Symbol(A.x, Decl(app.ts, 0, 13)) +>$ : Symbol($, Decl(index.d.ts, 0, 0)) +} +=== /types/lib/index.d.ts === + +interface $ { x } +>$ : Symbol($, Decl(index.d.ts, 0, 0)) +>x : Symbol($.x, Decl(index.d.ts, 1, 13)) + diff --git a/tests/baselines/reference/typeReferenceDirectives2.trace.json b/tests/baselines/reference/typeReferenceDirectives2.trace.json new file mode 100644 index 00000000000..826abe5d51a --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives2.trace.json @@ -0,0 +1,7 @@ +[ + "======== Resolving type reference directive 'lib', containing file not set, root directory '/'. ========", + "Resolving with primary search path '/types/'", + "File '/types/lib/package.json' does not exist.", + "File '/types/lib/index.d.ts' exist - use it as a name resolution result.", + "======== Type reference directive 'lib' was successfully resolved to '/types/lib/index.d.ts', primary: true. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/typeReferenceDirectives2.types b/tests/baselines/reference/typeReferenceDirectives2.types new file mode 100644 index 00000000000..284e2ef1f44 --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives2.types @@ -0,0 +1,14 @@ +=== /app.ts === +interface A { +>A : A + + x: $ +>x : $ +>$ : $ +} +=== /types/lib/index.d.ts === + +interface $ { x } +>$ : $ +>x : any + diff --git a/tests/baselines/reference/typeReferenceDirectives3.js b/tests/baselines/reference/typeReferenceDirectives3.js new file mode 100644 index 00000000000..9a41c69e30a --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives3.js @@ -0,0 +1,27 @@ +//// [tests/cases/compiler/typeReferenceDirectives3.ts] //// + +//// [ref.d.ts] + +// $ comes from d.ts file - no need to add type reference directive + +interface $ { x } + +//// [index.d.ts] +declare let $: { x: number } + +//// [app.ts] +/// +/// +interface A { + x: () => $ +} + +//// [app.js] +/// + + +//// [app.d.ts] +/// +interface A { + x: () => $; +} diff --git a/tests/baselines/reference/typeReferenceDirectives3.symbols b/tests/baselines/reference/typeReferenceDirectives3.symbols new file mode 100644 index 00000000000..6ab3cd7d1ee --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives3.symbols @@ -0,0 +1,23 @@ +=== /app.ts === +/// +/// +interface A { +>A : Symbol(A, Decl(app.ts, 0, 0)) + + x: () => $ +>x : Symbol(A.x, Decl(app.ts, 2, 13)) +>$ : Symbol($, Decl(ref.d.ts, 0, 0), Decl(index.d.ts, 0, 11)) +} +=== /ref.d.ts === + +// $ comes from d.ts file - no need to add type reference directive + +interface $ { x } +>$ : Symbol($, Decl(ref.d.ts, 0, 0), Decl(index.d.ts, 0, 11)) +>x : Symbol($.x, Decl(ref.d.ts, 3, 13)) + +=== /types/lib/index.d.ts === +declare let $: { x: number } +>$ : Symbol($, Decl(ref.d.ts, 0, 0), Decl(index.d.ts, 0, 11)) +>x : Symbol(x, Decl(index.d.ts, 0, 16)) + diff --git a/tests/baselines/reference/typeReferenceDirectives3.trace.json b/tests/baselines/reference/typeReferenceDirectives3.trace.json new file mode 100644 index 00000000000..c936a84dcc0 --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives3.trace.json @@ -0,0 +1,7 @@ +[ + "======== Resolving type reference directive 'lib', containing file '/app.ts', root directory '/'. ========", + "Resolving with primary search path '/types/'", + "File '/types/lib/package.json' does not exist.", + "File '/types/lib/index.d.ts' exist - use it as a name resolution result.", + "======== Type reference directive 'lib' was successfully resolved to '/types/lib/index.d.ts', primary: true. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/typeReferenceDirectives3.types b/tests/baselines/reference/typeReferenceDirectives3.types new file mode 100644 index 00000000000..3f82a9c666b --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives3.types @@ -0,0 +1,23 @@ +=== /app.ts === +/// +/// +interface A { +>A : A + + x: () => $ +>x : () => $ +>$ : $ +} +=== /ref.d.ts === + +// $ comes from d.ts file - no need to add type reference directive + +interface $ { x } +>$ : $ +>x : any + +=== /types/lib/index.d.ts === +declare let $: { x: number } +>$ : { x: number; } +>x : number + diff --git a/tests/baselines/reference/typeReferenceDirectives4.js b/tests/baselines/reference/typeReferenceDirectives4.js new file mode 100644 index 00000000000..ebe66d7b4dc --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives4.js @@ -0,0 +1,30 @@ +//// [tests/cases/compiler/typeReferenceDirectives4.ts] //// + +//// [ref.d.ts] + +// $ comes from d.ts file - no need to add type reference directive + +interface $ { x } + +//// [index.d.ts] +declare let $: { x: number } + + +//// [app.ts] +/// +/// + +let x: $; +let y = () => x + +//// [app.js] +/// +/// +var x; +var y = function () { return x; }; + + +//// [app.d.ts] +/// +declare let x: $; +declare let y: () => $; diff --git a/tests/baselines/reference/typeReferenceDirectives4.symbols b/tests/baselines/reference/typeReferenceDirectives4.symbols new file mode 100644 index 00000000000..2877064934a --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives4.symbols @@ -0,0 +1,26 @@ +=== /app.ts === +/// +/// + +let x: $; +>x : Symbol(x, Decl(app.ts, 3, 3)) +>$ : Symbol($, Decl(ref.d.ts, 0, 0), Decl(index.d.ts, 0, 11)) + +let y = () => x +>y : Symbol(y, Decl(app.ts, 4, 3)) +>x : Symbol(x, Decl(app.ts, 3, 3)) + +=== /ref.d.ts === + +// $ comes from d.ts file - no need to add type reference directive + +interface $ { x } +>$ : Symbol($, Decl(ref.d.ts, 0, 0), Decl(index.d.ts, 0, 11)) +>x : Symbol($.x, Decl(ref.d.ts, 3, 13)) + +=== /types/lib/index.d.ts === +declare let $: { x: number } +>$ : Symbol($, Decl(ref.d.ts, 0, 0), Decl(index.d.ts, 0, 11)) +>x : Symbol(x, Decl(index.d.ts, 0, 16)) + + diff --git a/tests/baselines/reference/typeReferenceDirectives4.trace.json b/tests/baselines/reference/typeReferenceDirectives4.trace.json new file mode 100644 index 00000000000..c936a84dcc0 --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives4.trace.json @@ -0,0 +1,7 @@ +[ + "======== Resolving type reference directive 'lib', containing file '/app.ts', root directory '/'. ========", + "Resolving with primary search path '/types/'", + "File '/types/lib/package.json' does not exist.", + "File '/types/lib/index.d.ts' exist - use it as a name resolution result.", + "======== Type reference directive 'lib' was successfully resolved to '/types/lib/index.d.ts', primary: true. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/typeReferenceDirectives4.types b/tests/baselines/reference/typeReferenceDirectives4.types new file mode 100644 index 00000000000..39d40a1ee78 --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives4.types @@ -0,0 +1,27 @@ +=== /app.ts === +/// +/// + +let x: $; +>x : $ +>$ : $ + +let y = () => x +>y : () => $ +>() => x : () => $ +>x : $ + +=== /ref.d.ts === + +// $ comes from d.ts file - no need to add type reference directive + +interface $ { x } +>$ : $ +>x : any + +=== /types/lib/index.d.ts === +declare let $: { x: number } +>$ : { x: number; } +>x : number + + diff --git a/tests/baselines/reference/typeReferenceDirectives5.js b/tests/baselines/reference/typeReferenceDirectives5.js new file mode 100644 index 00000000000..41448cbeab2 --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives5.js @@ -0,0 +1,25 @@ +//// [tests/cases/compiler/typeReferenceDirectives5.ts] //// + +//// [ref.d.ts] + +export interface $ { x } + +//// [index.d.ts] +declare let $: { x: number } + +//// [app.ts] +/// +import {$} from "./ref"; +export interface A { + x: typeof $; +} + +//// [app.js] +"use strict"; + + +//// [app.d.ts] +/// +export interface A { + x: typeof $; +} diff --git a/tests/baselines/reference/typeReferenceDirectives5.symbols b/tests/baselines/reference/typeReferenceDirectives5.symbols new file mode 100644 index 00000000000..fbbb06d6834 --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives5.symbols @@ -0,0 +1,23 @@ +=== /app.ts === +/// +import {$} from "./ref"; +>$ : Symbol($, Decl(app.ts, 1, 8)) + +export interface A { +>A : Symbol(A, Decl(app.ts, 1, 24)) + + x: typeof $; +>x : Symbol(A.x, Decl(app.ts, 2, 20)) +>$ : Symbol($, Decl(app.ts, 1, 8)) +} +=== /ref.d.ts === + +export interface $ { x } +>$ : Symbol($, Decl(ref.d.ts, 0, 0)) +>x : Symbol($.x, Decl(ref.d.ts, 1, 20)) + +=== /types/lib/index.d.ts === +declare let $: { x: number } +>$ : Symbol($, Decl(index.d.ts, 0, 11)) +>x : Symbol(x, Decl(index.d.ts, 0, 16)) + diff --git a/tests/baselines/reference/typeReferenceDirectives5.trace.json b/tests/baselines/reference/typeReferenceDirectives5.trace.json new file mode 100644 index 00000000000..b6adaf1f513 --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives5.trace.json @@ -0,0 +1,14 @@ +[ + "======== Resolving type reference directive 'lib', containing file '/app.ts', root directory '/'. ========", + "Resolving with primary search path '/types/'", + "File '/types/lib/package.json' does not exist.", + "File '/types/lib/index.d.ts' exist - use it as a name resolution result.", + "======== Type reference directive 'lib' was successfully resolved to '/types/lib/index.d.ts', primary: true. ========", + "======== Resolving module './ref' from '/app.ts'. ========", + "Module resolution kind is not specified, using 'NodeJs'.", + "Loading module as file / folder, candidate module location '/ref'.", + "File '/ref.ts' does not exist.", + "File '/ref.tsx' does not exist.", + "File '/ref.d.ts' exist - use it as a name resolution result.", + "======== Module name './ref' was successfully resolved to '/ref.d.ts'. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/typeReferenceDirectives5.types b/tests/baselines/reference/typeReferenceDirectives5.types new file mode 100644 index 00000000000..9b7cd93f6cc --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives5.types @@ -0,0 +1,23 @@ +=== /app.ts === +/// +import {$} from "./ref"; +>$ : any + +export interface A { +>A : A + + x: typeof $; +>x : { x: number; } +>$ : { x: number; } +} +=== /ref.d.ts === + +export interface $ { x } +>$ : $ +>x : any + +=== /types/lib/index.d.ts === +declare let $: { x: number } +>$ : { x: number; } +>x : number + diff --git a/tests/baselines/reference/typeReferenceDirectives6.js b/tests/baselines/reference/typeReferenceDirectives6.js new file mode 100644 index 00000000000..3d1ea0e41c9 --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives6.js @@ -0,0 +1,33 @@ +//// [tests/cases/compiler/typeReferenceDirectives6.ts] //// + +//// [ref.d.ts] + +// $ comes from type declaration file - type reference directive should be added + +declare let $: { x: number } + +//// [index.d.ts] +interface $ { x } + + +//// [app.ts] +/// +/// + +let x: $; +let y = () => x + + + +//// [app.js] +/// +/// +var x; +var y = function () { return x; }; + + +//// [app.d.ts] +/// +/// +declare let x: $; +declare let y: () => $; diff --git a/tests/baselines/reference/typeReferenceDirectives6.symbols b/tests/baselines/reference/typeReferenceDirectives6.symbols new file mode 100644 index 00000000000..f8a5245a0a5 --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives6.symbols @@ -0,0 +1,27 @@ +=== /app.ts === +/// +/// + +let x: $; +>x : Symbol(x, Decl(app.ts, 3, 3)) +>$ : Symbol($, Decl(ref.d.ts, 3, 11), Decl(index.d.ts, 0, 0)) + +let y = () => x +>y : Symbol(y, Decl(app.ts, 4, 3)) +>x : Symbol(x, Decl(app.ts, 3, 3)) + + +=== /ref.d.ts === + +// $ comes from type declaration file - type reference directive should be added + +declare let $: { x: number } +>$ : Symbol($, Decl(ref.d.ts, 3, 11), Decl(index.d.ts, 0, 0)) +>x : Symbol(x, Decl(ref.d.ts, 3, 16)) + +=== /types/lib/index.d.ts === +interface $ { x } +>$ : Symbol($, Decl(ref.d.ts, 3, 11), Decl(index.d.ts, 0, 0)) +>x : Symbol($.x, Decl(index.d.ts, 0, 13)) + + diff --git a/tests/baselines/reference/typeReferenceDirectives6.trace.json b/tests/baselines/reference/typeReferenceDirectives6.trace.json new file mode 100644 index 00000000000..c936a84dcc0 --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives6.trace.json @@ -0,0 +1,7 @@ +[ + "======== Resolving type reference directive 'lib', containing file '/app.ts', root directory '/'. ========", + "Resolving with primary search path '/types/'", + "File '/types/lib/package.json' does not exist.", + "File '/types/lib/index.d.ts' exist - use it as a name resolution result.", + "======== Type reference directive 'lib' was successfully resolved to '/types/lib/index.d.ts', primary: true. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/typeReferenceDirectives6.types b/tests/baselines/reference/typeReferenceDirectives6.types new file mode 100644 index 00000000000..db4d3514bde --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives6.types @@ -0,0 +1,28 @@ +=== /app.ts === +/// +/// + +let x: $; +>x : $ +>$ : $ + +let y = () => x +>y : () => $ +>() => x : () => $ +>x : $ + + +=== /ref.d.ts === + +// $ comes from type declaration file - type reference directive should be added + +declare let $: { x: number } +>$ : { x: number; } +>x : number + +=== /types/lib/index.d.ts === +interface $ { x } +>$ : $ +>x : any + + diff --git a/tests/baselines/reference/typeReferenceDirectives7.js b/tests/baselines/reference/typeReferenceDirectives7.js new file mode 100644 index 00000000000..6a15180d3e7 --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives7.js @@ -0,0 +1,28 @@ +//// [tests/cases/compiler/typeReferenceDirectives7.ts] //// + +//// [index.d.ts] + +// local value shadows global - no need to add type reference directive + +declare let $: { x: number } + + +//// [app.ts] +/// + +export let $ = 1; + +export let x: typeof $; +export let y = () => x + +//// [app.js] +/// +"use strict"; +exports.$ = 1; +exports.y = function () { return exports.x; }; + + +//// [app.d.ts] +export declare let $: number; +export declare let x: typeof $; +export declare let y: () => number; diff --git a/tests/baselines/reference/typeReferenceDirectives7.symbols b/tests/baselines/reference/typeReferenceDirectives7.symbols new file mode 100644 index 00000000000..27637dfaa0e --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives7.symbols @@ -0,0 +1,23 @@ +=== /app.ts === +/// + +export let $ = 1; +>$ : Symbol($, Decl(app.ts, 2, 10)) + +export let x: typeof $; +>x : Symbol(x, Decl(app.ts, 4, 10)) +>$ : Symbol($, Decl(app.ts, 2, 10)) + +export let y = () => x +>y : Symbol(y, Decl(app.ts, 5, 10)) +>x : Symbol(x, Decl(app.ts, 4, 10)) + +=== /types/lib/index.d.ts === + +// local value shadows global - no need to add type reference directive + +declare let $: { x: number } +>$ : Symbol($, Decl(index.d.ts, 3, 11)) +>x : Symbol(x, Decl(index.d.ts, 3, 16)) + + diff --git a/tests/baselines/reference/typeReferenceDirectives7.trace.json b/tests/baselines/reference/typeReferenceDirectives7.trace.json new file mode 100644 index 00000000000..c936a84dcc0 --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives7.trace.json @@ -0,0 +1,7 @@ +[ + "======== Resolving type reference directive 'lib', containing file '/app.ts', root directory '/'. ========", + "Resolving with primary search path '/types/'", + "File '/types/lib/package.json' does not exist.", + "File '/types/lib/index.d.ts' exist - use it as a name resolution result.", + "======== Type reference directive 'lib' was successfully resolved to '/types/lib/index.d.ts', primary: true. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/typeReferenceDirectives7.types b/tests/baselines/reference/typeReferenceDirectives7.types new file mode 100644 index 00000000000..dab53a49899 --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives7.types @@ -0,0 +1,25 @@ +=== /app.ts === +/// + +export let $ = 1; +>$ : number +>1 : number + +export let x: typeof $; +>x : number +>$ : number + +export let y = () => x +>y : () => number +>() => x : () => number +>x : number + +=== /types/lib/index.d.ts === + +// local value shadows global - no need to add type reference directive + +declare let $: { x: number } +>$ : { x: number; } +>x : number + + diff --git a/tests/baselines/reference/typeReferenceDirectives8.js b/tests/baselines/reference/typeReferenceDirectives8.js new file mode 100644 index 00000000000..cfa22c4228c --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives8.js @@ -0,0 +1,32 @@ +//// [tests/cases/compiler/typeReferenceDirectives8.ts] //// + +//// [index.d.ts] + + +interface Lib { x } + +//// [mod1.ts] + +export function foo(): Lib { return {x: 1} } + +//// [mod2.ts] + +import {foo} from "./mod1"; +export const bar = foo(); + +//// [mod1.js] +"use strict"; +function foo() { return { x: 1 }; } +exports.foo = foo; +//// [mod2.js] +"use strict"; +var mod1_1 = require("./mod1"); +exports.bar = mod1_1.foo(); + + +//// [mod1.d.ts] +/// +export declare function foo(): Lib; +//// [mod2.d.ts] +/// +export declare const bar: Lib; diff --git a/tests/baselines/reference/typeReferenceDirectives8.symbols b/tests/baselines/reference/typeReferenceDirectives8.symbols new file mode 100644 index 00000000000..875bb2a0900 --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives8.symbols @@ -0,0 +1,23 @@ +=== /mod2.ts === + +import {foo} from "./mod1"; +>foo : Symbol(foo, Decl(mod2.ts, 1, 8)) + +export const bar = foo(); +>bar : Symbol(bar, Decl(mod2.ts, 2, 12)) +>foo : Symbol(foo, Decl(mod2.ts, 1, 8)) + +=== /types/lib/index.d.ts === + + +interface Lib { x } +>Lib : Symbol(Lib, Decl(index.d.ts, 0, 0)) +>x : Symbol(Lib.x, Decl(index.d.ts, 2, 15)) + +=== /mod1.ts === + +export function foo(): Lib { return {x: 1} } +>foo : Symbol(foo, Decl(mod1.ts, 0, 0)) +>Lib : Symbol(Lib, Decl(index.d.ts, 0, 0)) +>x : Symbol(x, Decl(mod1.ts, 1, 37)) + diff --git a/tests/baselines/reference/typeReferenceDirectives8.trace.json b/tests/baselines/reference/typeReferenceDirectives8.trace.json new file mode 100644 index 00000000000..be060569d83 --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives8.trace.json @@ -0,0 +1,12 @@ +[ + "======== Resolving type reference directive 'lib', containing file not set, root directory '/'. ========", + "Resolving with primary search path '/types/'", + "File '/types/lib/package.json' does not exist.", + "File '/types/lib/index.d.ts' exist - use it as a name resolution result.", + "======== Type reference directive 'lib' was successfully resolved to '/types/lib/index.d.ts', primary: true. ========", + "======== Resolving module './mod1' from '/mod2.ts'. ========", + "Module resolution kind is not specified, using 'NodeJs'.", + "Loading module as file / folder, candidate module location '/mod1'.", + "File '/mod1.ts' exist - use it as a name resolution result.", + "======== Module name './mod1' was successfully resolved to '/mod1.ts'. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/typeReferenceDirectives8.types b/tests/baselines/reference/typeReferenceDirectives8.types new file mode 100644 index 00000000000..93d80b7988a --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives8.types @@ -0,0 +1,26 @@ +=== /mod2.ts === + +import {foo} from "./mod1"; +>foo : () => Lib + +export const bar = foo(); +>bar : Lib +>foo() : Lib +>foo : () => Lib + +=== /types/lib/index.d.ts === + + +interface Lib { x } +>Lib : Lib +>x : any + +=== /mod1.ts === + +export function foo(): Lib { return {x: 1} } +>foo : () => Lib +>Lib : Lib +>{x: 1} : { x: number; } +>x : number +>1 : number + diff --git a/tests/baselines/reference/typeReferenceDirectives9.js b/tests/baselines/reference/typeReferenceDirectives9.js new file mode 100644 index 00000000000..5fd17ea16d3 --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives9.js @@ -0,0 +1,79 @@ +//// [tests/cases/compiler/typeReferenceDirectives9.ts] //// + +//// [index.d.ts] + + +interface Lib { x } + +//// [main.ts] +export class Cls { + x +} + +//// [mod1.ts] +/// + +import {Cls} from "./main"; +Cls.prototype.foo = function() { return undefined; } + +declare module "./main" { + interface Cls { + foo(): Lib; + } + namespace Cls { + function bar(): Lib; + } +} + +//// [mod2.ts] +import { Cls } from "./main"; +import "./mod1"; + +export const cls = Cls; +export const foo = new Cls().foo(); +export const bar = Cls.bar(); + +//// [main.js] +"use strict"; +var Cls = (function () { + function Cls() { + } + return Cls; +}()); +exports.Cls = Cls; +//// [mod1.js] +/// +"use strict"; +var main_1 = require("./main"); +main_1.Cls.prototype.foo = function () { return undefined; }; +//// [mod2.js] +"use strict"; +var main_1 = require("./main"); +require("./mod1"); +exports.cls = main_1.Cls; +exports.foo = new main_1.Cls().foo(); +exports.bar = main_1.Cls.bar(); + + +//// [main.d.ts] +export declare class Cls { + x: any; +} +//// [mod1.d.ts] +/// +declare module "./main" { + interface Cls { + foo(): Lib; + } + namespace Cls { + function bar(): Lib; + } +} +export {}; +//// [mod2.d.ts] +/// +import { Cls } from "./main"; +import "./mod1"; +export declare const cls: typeof Cls; +export declare const foo: Lib; +export declare const bar: Lib; diff --git a/tests/baselines/reference/typeReferenceDirectives9.symbols b/tests/baselines/reference/typeReferenceDirectives9.symbols new file mode 100644 index 00000000000..30b24c39284 --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives9.symbols @@ -0,0 +1,68 @@ +=== /mod2.ts === +import { Cls } from "./main"; +>Cls : Symbol(Cls, Decl(mod2.ts, 0, 8)) + +import "./mod1"; + +export const cls = Cls; +>cls : Symbol(cls, Decl(mod2.ts, 3, 12)) +>Cls : Symbol(Cls, Decl(mod2.ts, 0, 8)) + +export const foo = new Cls().foo(); +>foo : Symbol(foo, Decl(mod2.ts, 4, 12)) +>new Cls().foo : Symbol(Cls.foo, Decl(mod1.ts, 6, 19)) +>Cls : Symbol(Cls, Decl(mod2.ts, 0, 8)) +>foo : Symbol(Cls.foo, Decl(mod1.ts, 6, 19)) + +export const bar = Cls.bar(); +>bar : Symbol(bar, Decl(mod2.ts, 5, 12)) +>Cls.bar : Symbol(Cls.bar, Decl(mod1.ts, 9, 19)) +>Cls : Symbol(Cls, Decl(mod2.ts, 0, 8)) +>bar : Symbol(Cls.bar, Decl(mod1.ts, 9, 19)) + +=== /types/lib/index.d.ts === + + +interface Lib { x } +>Lib : Symbol(Lib, Decl(index.d.ts, 0, 0)) +>x : Symbol(Lib.x, Decl(index.d.ts, 2, 15)) + +=== /main.ts === +export class Cls { +>Cls : Symbol(Cls, Decl(main.ts, 0, 0), Decl(mod1.ts, 5, 25), Decl(mod1.ts, 8, 5)) + + x +>x : Symbol(Cls.x, Decl(main.ts, 0, 18)) +} + +=== /mod1.ts === +/// + +import {Cls} from "./main"; +>Cls : Symbol(Cls, Decl(mod1.ts, 2, 8)) + +Cls.prototype.foo = function() { return undefined; } +>Cls.prototype.foo : Symbol(Cls.foo, Decl(mod1.ts, 6, 19)) +>Cls.prototype : Symbol(Cls.prototype) +>Cls : Symbol(Cls, Decl(mod1.ts, 2, 8)) +>prototype : Symbol(Cls.prototype) +>foo : Symbol(Cls.foo, Decl(mod1.ts, 6, 19)) +>undefined : Symbol(undefined) + +declare module "./main" { + interface Cls { +>Cls : Symbol(Cls, Decl(main.ts, 0, 0), Decl(mod1.ts, 5, 25), Decl(mod1.ts, 8, 5)) + + foo(): Lib; +>foo : Symbol(Cls.foo, Decl(mod1.ts, 6, 19)) +>Lib : Symbol(Lib, Decl(index.d.ts, 0, 0)) + } + namespace Cls { +>Cls : Symbol(Cls, Decl(main.ts, 0, 0), Decl(mod1.ts, 5, 25), Decl(mod1.ts, 8, 5)) + + function bar(): Lib; +>bar : Symbol(bar, Decl(mod1.ts, 9, 19)) +>Lib : Symbol(Lib, Decl(index.d.ts, 0, 0)) + } +} + diff --git a/tests/baselines/reference/typeReferenceDirectives9.trace.json b/tests/baselines/reference/typeReferenceDirectives9.trace.json new file mode 100644 index 00000000000..f4fc0937325 --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives9.trace.json @@ -0,0 +1,22 @@ +[ + "======== Resolving module './main' from '/mod2.ts'. ========", + "Module resolution kind is not specified, using 'NodeJs'.", + "Loading module as file / folder, candidate module location '/main'.", + "File '/main.ts' exist - use it as a name resolution result.", + "======== Module name './main' was successfully resolved to '/main.ts'. ========", + "======== Resolving module './mod1' from '/mod2.ts'. ========", + "Module resolution kind is not specified, using 'NodeJs'.", + "Loading module as file / folder, candidate module location '/mod1'.", + "File '/mod1.ts' exist - use it as a name resolution result.", + "======== Module name './mod1' was successfully resolved to '/mod1.ts'. ========", + "======== Resolving type reference directive 'lib', containing file '/mod1.ts', root directory '/'. ========", + "Resolving with primary search path '/types/'", + "File '/types/lib/package.json' does not exist.", + "File '/types/lib/index.d.ts' exist - use it as a name resolution result.", + "======== Type reference directive 'lib' was successfully resolved to '/types/lib/index.d.ts', primary: true. ========", + "======== Resolving module './main' from '/mod1.ts'. ========", + "Module resolution kind is not specified, using 'NodeJs'.", + "Loading module as file / folder, candidate module location '/main'.", + "File '/main.ts' exist - use it as a name resolution result.", + "======== Module name './main' was successfully resolved to '/main.ts'. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/typeReferenceDirectives9.types b/tests/baselines/reference/typeReferenceDirectives9.types new file mode 100644 index 00000000000..bd429b91f1c --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives9.types @@ -0,0 +1,73 @@ +=== /mod2.ts === +import { Cls } from "./main"; +>Cls : typeof Cls + +import "./mod1"; + +export const cls = Cls; +>cls : typeof Cls +>Cls : typeof Cls + +export const foo = new Cls().foo(); +>foo : Lib +>new Cls().foo() : Lib +>new Cls().foo : () => Lib +>new Cls() : Cls +>Cls : typeof Cls +>foo : () => Lib + +export const bar = Cls.bar(); +>bar : Lib +>Cls.bar() : Lib +>Cls.bar : () => Lib +>Cls : typeof Cls +>bar : () => Lib + +=== /types/lib/index.d.ts === + + +interface Lib { x } +>Lib : Lib +>x : any + +=== /main.ts === +export class Cls { +>Cls : Cls + + x +>x : any +} + +=== /mod1.ts === +/// + +import {Cls} from "./main"; +>Cls : typeof Cls + +Cls.prototype.foo = function() { return undefined; } +>Cls.prototype.foo = function() { return undefined; } : () => any +>Cls.prototype.foo : () => Lib +>Cls.prototype : Cls +>Cls : typeof Cls +>prototype : Cls +>foo : () => Lib +>function() { return undefined; } : () => any +>undefined : undefined + +declare module "./main" { + interface Cls { +>Cls : Cls + + foo(): Lib; +>foo : () => Lib +>Lib : Lib + } + namespace Cls { +>Cls : typeof Cls + + function bar(): Lib; +>bar : () => Lib +>Lib : Lib + } +} + diff --git a/tests/baselines/reference/typeResolution.symbols b/tests/baselines/reference/typeResolution.symbols index aa0d611e52e..b967bd3d7ff 100644 --- a/tests/baselines/reference/typeResolution.symbols +++ b/tests/baselines/reference/typeResolution.symbols @@ -12,7 +12,7 @@ export module TopLevelModule1 { >ClassA : Symbol(ClassA, Decl(typeResolution.ts, 2, 37)) public AisIn1_1_1() { ->AisIn1_1_1 : Symbol(AisIn1_1_1, Decl(typeResolution.ts, 3, 33)) +>AisIn1_1_1 : Symbol(ClassA.AisIn1_1_1, Decl(typeResolution.ts, 3, 33)) // Try all qualified names of this type var a1: ClassA; a1.AisIn1_1_1(); @@ -99,7 +99,7 @@ export module TopLevelModule1 { >ClassB : Symbol(ClassB, Decl(typeResolution.ts, 22, 13)) public BisIn1_1_1() { ->BisIn1_1_1 : Symbol(BisIn1_1_1, Decl(typeResolution.ts, 23, 33)) +>BisIn1_1_1 : Symbol(ClassB.BisIn1_1_1, Decl(typeResolution.ts, 23, 33)) /** Exactly the same as above in AisIn1_1_1 **/ @@ -195,7 +195,7 @@ export module TopLevelModule1 { } export interface InterfaceX { XisIn1_1_1(); } >InterfaceX : Symbol(InterfaceX, Decl(typeResolution.ts, 45, 13)) ->XisIn1_1_1 : Symbol(XisIn1_1_1, Decl(typeResolution.ts, 46, 41)) +>XisIn1_1_1 : Symbol(InterfaceX.XisIn1_1_1, Decl(typeResolution.ts, 46, 41)) class NonExportedClassQ { >NonExportedClassQ : Symbol(NonExportedClassQ, Decl(typeResolution.ts, 46, 57)) @@ -302,19 +302,19 @@ export module TopLevelModule1 { // No code here since these are the mirror of the above calls export class ClassA { public AisIn1_2_2() { } } >ClassA : Symbol(ClassA, Decl(typeResolution.ts, 76, 37)) ->AisIn1_2_2 : Symbol(AisIn1_2_2, Decl(typeResolution.ts, 78, 33)) +>AisIn1_2_2 : Symbol(ClassA.AisIn1_2_2, Decl(typeResolution.ts, 78, 33)) export class ClassB { public BisIn1_2_2() { } } >ClassB : Symbol(ClassB, Decl(typeResolution.ts, 78, 59)) ->BisIn1_2_2 : Symbol(BisIn1_2_2, Decl(typeResolution.ts, 79, 33)) +>BisIn1_2_2 : Symbol(ClassB.BisIn1_2_2, Decl(typeResolution.ts, 79, 33)) export class ClassC { public CisIn1_2_2() { } } >ClassC : Symbol(ClassC, Decl(typeResolution.ts, 79, 59)) ->CisIn1_2_2 : Symbol(CisIn1_2_2, Decl(typeResolution.ts, 80, 33)) +>CisIn1_2_2 : Symbol(ClassC.CisIn1_2_2, Decl(typeResolution.ts, 80, 33)) export interface InterfaceY { YisIn1_2_2(); } >InterfaceY : Symbol(InterfaceY, Decl(typeResolution.ts, 80, 59)) ->YisIn1_2_2 : Symbol(YisIn1_2_2, Decl(typeResolution.ts, 81, 41)) +>YisIn1_2_2 : Symbol(InterfaceY.YisIn1_2_2, Decl(typeResolution.ts, 81, 41)) interface NonExportedInterfaceQ { } >NonExportedInterfaceQ : Symbol(NonExportedInterfaceQ, Decl(typeResolution.ts, 81, 57)) @@ -322,21 +322,21 @@ export module TopLevelModule1 { export interface InterfaceY { YisIn1_2(); } >InterfaceY : Symbol(InterfaceY, Decl(typeResolution.ts, 83, 9)) ->YisIn1_2 : Symbol(YisIn1_2, Decl(typeResolution.ts, 85, 37)) +>YisIn1_2 : Symbol(InterfaceY.YisIn1_2, Decl(typeResolution.ts, 85, 37)) } class ClassA { >ClassA : Symbol(ClassA, Decl(typeResolution.ts, 86, 5)) public AisIn1() { } ->AisIn1 : Symbol(AisIn1, Decl(typeResolution.ts, 88, 18)) +>AisIn1 : Symbol(ClassA.AisIn1, Decl(typeResolution.ts, 88, 18)) } interface InterfaceY { >InterfaceY : Symbol(InterfaceY, Decl(typeResolution.ts, 90, 5)) YisIn1(); ->YisIn1 : Symbol(YisIn1, Decl(typeResolution.ts, 92, 26)) +>YisIn1 : Symbol(InterfaceY.YisIn1, Decl(typeResolution.ts, 92, 26)) } module NotExportedModule { @@ -357,7 +357,7 @@ module TopLevelModule2 { >ClassA : Symbol(ClassA, Decl(typeResolution.ts, 102, 30)) public AisIn2_3() { } ->AisIn2_3 : Symbol(AisIn2_3, Decl(typeResolution.ts, 103, 29)) +>AisIn2_3 : Symbol(ClassA.AisIn2_3, Decl(typeResolution.ts, 103, 29)) } } } diff --git a/tests/baselines/reference/typeVal.symbols b/tests/baselines/reference/typeVal.symbols index 353b187a48e..42c8b7158e2 100644 --- a/tests/baselines/reference/typeVal.symbols +++ b/tests/baselines/reference/typeVal.symbols @@ -3,7 +3,7 @@ interface I { >I : Symbol(I, Decl(typeVal.ts, 0, 0), Decl(typeVal.ts, 4, 3)) I:number; ->I : Symbol(I, Decl(typeVal.ts, 0, 13)) +>I : Symbol(I.I, Decl(typeVal.ts, 0, 13)) } var I:I = { I: 3}; diff --git a/tests/baselines/reference/typedArrays.js b/tests/baselines/reference/typedArrays.js index 89e6f43ecae..6159edc1187 100644 --- a/tests/baselines/reference/typedArrays.js +++ b/tests/baselines/reference/typedArrays.js @@ -75,7 +75,6 @@ function CreateIntegerTypedArraysFromArrayLike(obj:ArrayLike) { return typedArrays; } -/* function CreateTypedArraysOf(obj) { var typedArrays = []; typedArrays[0] = Int8Array.of(...obj); @@ -90,7 +89,6 @@ function CreateTypedArraysOf(obj) { return typedArrays; } -*/ function CreateTypedArraysOf2() { var typedArrays = []; @@ -203,7 +201,6 @@ function CreateIntegerTypedArraysFromArrayLike(obj) { typedArrays[8] = Uint8ClampedArray.from(obj); return typedArrays; } -/* function CreateTypedArraysOf(obj) { var typedArrays = []; typedArrays[0] = Int8Array.of(...obj); @@ -215,10 +212,8 @@ function CreateTypedArraysOf(obj) { typedArrays[6] = Float32Array.of(...obj); typedArrays[7] = Float64Array.of(...obj); typedArrays[8] = Uint8ClampedArray.of(...obj); - return typedArrays; } -*/ function CreateTypedArraysOf2() { var typedArrays = []; typedArrays[0] = Int8Array.of(1, 2, 3, 4); diff --git a/tests/baselines/reference/typedArrays.symbols b/tests/baselines/reference/typedArrays.symbols index cf5e68b956a..2d45fb7e5c1 100644 --- a/tests/baselines/reference/typedArrays.symbols +++ b/tests/baselines/reference/typedArrays.symbols @@ -8,39 +8,39 @@ function CreateTypedArrayTypes() { typedArrays[0] = Int8Array; >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 2, 7)) ->Int8Array : Symbol(Int8Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Int8Array : Symbol(Int8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) typedArrays[1] = Uint8Array; >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 2, 7)) ->Uint8Array : Symbol(Uint8Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Uint8Array : Symbol(Uint8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) typedArrays[2] = Int16Array; >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 2, 7)) ->Int16Array : Symbol(Int16Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Int16Array : Symbol(Int16Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) typedArrays[3] = Uint16Array; >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 2, 7)) ->Uint16Array : Symbol(Uint16Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Uint16Array : Symbol(Uint16Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) typedArrays[4] = Int32Array; >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 2, 7)) ->Int32Array : Symbol(Int32Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Int32Array : Symbol(Int32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) typedArrays[5] = Uint32Array; >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 2, 7)) ->Uint32Array : Symbol(Uint32Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Uint32Array : Symbol(Uint32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) typedArrays[6] = Float32Array; >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 2, 7)) ->Float32Array : Symbol(Float32Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Float32Array : Symbol(Float32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) typedArrays[7] = Float64Array; >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 2, 7)) ->Float64Array : Symbol(Float64Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Float64Array : Symbol(Float64Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) typedArrays[8] = Uint8ClampedArray; >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 2, 7)) ->Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) return typedArrays; >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 2, 7)) @@ -55,47 +55,47 @@ function CreateTypedArrayInstancesFromLength(obj: number) { typedArrays[0] = new Int8Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 17, 7)) ->Int8Array : Symbol(Int8Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Int8Array : Symbol(Int8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 16, 45)) typedArrays[1] = new Uint8Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 17, 7)) ->Uint8Array : Symbol(Uint8Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Uint8Array : Symbol(Uint8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 16, 45)) typedArrays[2] = new Int16Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 17, 7)) ->Int16Array : Symbol(Int16Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Int16Array : Symbol(Int16Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 16, 45)) typedArrays[3] = new Uint16Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 17, 7)) ->Uint16Array : Symbol(Uint16Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Uint16Array : Symbol(Uint16Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 16, 45)) typedArrays[4] = new Int32Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 17, 7)) ->Int32Array : Symbol(Int32Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Int32Array : Symbol(Int32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 16, 45)) typedArrays[5] = new Uint32Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 17, 7)) ->Uint32Array : Symbol(Uint32Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Uint32Array : Symbol(Uint32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 16, 45)) typedArrays[6] = new Float32Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 17, 7)) ->Float32Array : Symbol(Float32Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Float32Array : Symbol(Float32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 16, 45)) typedArrays[7] = new Float64Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 17, 7)) ->Float64Array : Symbol(Float64Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Float64Array : Symbol(Float64Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 16, 45)) typedArrays[8] = new Uint8ClampedArray(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 17, 7)) ->Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 16, 45)) return typedArrays; @@ -111,47 +111,47 @@ function CreateTypedArrayInstancesFromArray(obj: number[]) { typedArrays[0] = new Int8Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 32, 7)) ->Int8Array : Symbol(Int8Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Int8Array : Symbol(Int8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 31, 44)) typedArrays[1] = new Uint8Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 32, 7)) ->Uint8Array : Symbol(Uint8Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Uint8Array : Symbol(Uint8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 31, 44)) typedArrays[2] = new Int16Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 32, 7)) ->Int16Array : Symbol(Int16Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Int16Array : Symbol(Int16Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 31, 44)) typedArrays[3] = new Uint16Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 32, 7)) ->Uint16Array : Symbol(Uint16Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Uint16Array : Symbol(Uint16Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 31, 44)) typedArrays[4] = new Int32Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 32, 7)) ->Int32Array : Symbol(Int32Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Int32Array : Symbol(Int32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 31, 44)) typedArrays[5] = new Uint32Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 32, 7)) ->Uint32Array : Symbol(Uint32Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Uint32Array : Symbol(Uint32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 31, 44)) typedArrays[6] = new Float32Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 32, 7)) ->Float32Array : Symbol(Float32Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Float32Array : Symbol(Float32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 31, 44)) typedArrays[7] = new Float64Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 32, 7)) ->Float64Array : Symbol(Float64Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Float64Array : Symbol(Float64Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 31, 44)) typedArrays[8] = new Uint8ClampedArray(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 32, 7)) ->Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 31, 44)) return typedArrays; @@ -167,65 +167,65 @@ function CreateIntegerTypedArraysFromArray2(obj:number[]) { typedArrays[0] = Int8Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 47, 7)) ->Int8Array.from : Symbol(Int8ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Int8Array : Symbol(Int8Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->from : Symbol(Int8ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Int8Array.from : Symbol(Int8ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Int8Array : Symbol(Int8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>from : Symbol(Int8ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 46, 44)) typedArrays[1] = Uint8Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 47, 7)) ->Uint8Array.from : Symbol(Uint8ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Uint8Array : Symbol(Uint8Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->from : Symbol(Uint8ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Uint8Array.from : Symbol(Uint8ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Uint8Array : Symbol(Uint8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>from : Symbol(Uint8ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 46, 44)) typedArrays[2] = Int16Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 47, 7)) ->Int16Array.from : Symbol(Int16ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Int16Array : Symbol(Int16Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->from : Symbol(Int16ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Int16Array.from : Symbol(Int16ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Int16Array : Symbol(Int16Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>from : Symbol(Int16ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 46, 44)) typedArrays[3] = Uint16Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 47, 7)) ->Uint16Array.from : Symbol(Uint16ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Uint16Array : Symbol(Uint16Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->from : Symbol(Uint16ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Uint16Array.from : Symbol(Uint16ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Uint16Array : Symbol(Uint16Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>from : Symbol(Uint16ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 46, 44)) typedArrays[4] = Int32Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 47, 7)) ->Int32Array.from : Symbol(Int32ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Int32Array : Symbol(Int32Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->from : Symbol(Int32ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Int32Array.from : Symbol(Int32ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Int32Array : Symbol(Int32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>from : Symbol(Int32ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 46, 44)) typedArrays[5] = Uint32Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 47, 7)) ->Uint32Array.from : Symbol(Uint32ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Uint32Array : Symbol(Uint32Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->from : Symbol(Uint32ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Uint32Array.from : Symbol(Uint32ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Uint32Array : Symbol(Uint32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>from : Symbol(Uint32ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 46, 44)) typedArrays[6] = Float32Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 47, 7)) ->Float32Array.from : Symbol(Float32ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Float32Array : Symbol(Float32Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->from : Symbol(Float32ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Float32Array.from : Symbol(Float32ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Float32Array : Symbol(Float32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>from : Symbol(Float32ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 46, 44)) typedArrays[7] = Float64Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 47, 7)) ->Float64Array.from : Symbol(Float64ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Float64Array : Symbol(Float64Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->from : Symbol(Float64ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Float64Array.from : Symbol(Float64ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Float64Array : Symbol(Float64Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>from : Symbol(Float64ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 46, 44)) typedArrays[8] = Uint8ClampedArray.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 47, 7)) ->Uint8ClampedArray.from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Uint8ClampedArray.from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 46, 44)) return typedArrays; @@ -235,339 +235,396 @@ function CreateIntegerTypedArraysFromArray2(obj:number[]) { function CreateIntegerTypedArraysFromArrayLike(obj:ArrayLike) { >CreateIntegerTypedArraysFromArrayLike : Symbol(CreateIntegerTypedArraysFromArrayLike, Decl(typedArrays.ts, 59, 1)) >obj : Symbol(obj, Decl(typedArrays.ts, 61, 47)) ->ArrayLike : Symbol(ArrayLike, Decl(lib.d.ts, --, --)) +>ArrayLike : Symbol(ArrayLike, Decl(lib.es5.d.ts, --, --)) var typedArrays = []; >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 62, 7)) typedArrays[0] = Int8Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 62, 7)) ->Int8Array.from : Symbol(Int8ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Int8Array : Symbol(Int8Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->from : Symbol(Int8ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Int8Array.from : Symbol(Int8ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Int8Array : Symbol(Int8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>from : Symbol(Int8ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 61, 47)) typedArrays[1] = Uint8Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 62, 7)) ->Uint8Array.from : Symbol(Uint8ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Uint8Array : Symbol(Uint8Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->from : Symbol(Uint8ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Uint8Array.from : Symbol(Uint8ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Uint8Array : Symbol(Uint8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>from : Symbol(Uint8ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 61, 47)) typedArrays[2] = Int16Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 62, 7)) ->Int16Array.from : Symbol(Int16ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Int16Array : Symbol(Int16Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->from : Symbol(Int16ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Int16Array.from : Symbol(Int16ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Int16Array : Symbol(Int16Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>from : Symbol(Int16ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 61, 47)) typedArrays[3] = Uint16Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 62, 7)) ->Uint16Array.from : Symbol(Uint16ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Uint16Array : Symbol(Uint16Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->from : Symbol(Uint16ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Uint16Array.from : Symbol(Uint16ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Uint16Array : Symbol(Uint16Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>from : Symbol(Uint16ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 61, 47)) typedArrays[4] = Int32Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 62, 7)) ->Int32Array.from : Symbol(Int32ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Int32Array : Symbol(Int32Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->from : Symbol(Int32ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Int32Array.from : Symbol(Int32ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Int32Array : Symbol(Int32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>from : Symbol(Int32ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 61, 47)) typedArrays[5] = Uint32Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 62, 7)) ->Uint32Array.from : Symbol(Uint32ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Uint32Array : Symbol(Uint32Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->from : Symbol(Uint32ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Uint32Array.from : Symbol(Uint32ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Uint32Array : Symbol(Uint32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>from : Symbol(Uint32ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 61, 47)) typedArrays[6] = Float32Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 62, 7)) ->Float32Array.from : Symbol(Float32ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Float32Array : Symbol(Float32Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->from : Symbol(Float32ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Float32Array.from : Symbol(Float32ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Float32Array : Symbol(Float32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>from : Symbol(Float32ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 61, 47)) typedArrays[7] = Float64Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 62, 7)) ->Float64Array.from : Symbol(Float64ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Float64Array : Symbol(Float64Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->from : Symbol(Float64ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Float64Array.from : Symbol(Float64ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Float64Array : Symbol(Float64Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>from : Symbol(Float64ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 61, 47)) typedArrays[8] = Uint8ClampedArray.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 62, 7)) ->Uint8ClampedArray.from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Uint8ClampedArray.from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 61, 47)) return typedArrays; >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 62, 7)) } -/* function CreateTypedArraysOf(obj) { +>CreateTypedArraysOf : Symbol(CreateTypedArraysOf, Decl(typedArrays.ts, 74, 1)) +>obj : Symbol(obj, Decl(typedArrays.ts, 76, 29)) + var typedArrays = []; +>typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 77, 7)) + typedArrays[0] = Int8Array.of(...obj); +>typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 77, 7)) +>Int8Array.of : Symbol(Int8ArrayConstructor.of, Decl(lib.es5.d.ts, --, --)) +>Int8Array : Symbol(Int8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>of : Symbol(Int8ArrayConstructor.of, Decl(lib.es5.d.ts, --, --)) +>obj : Symbol(obj, Decl(typedArrays.ts, 76, 29)) + typedArrays[1] = Uint8Array.of(...obj); +>typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 77, 7)) +>Uint8Array.of : Symbol(Uint8ArrayConstructor.of, Decl(lib.es5.d.ts, --, --)) +>Uint8Array : Symbol(Uint8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>of : Symbol(Uint8ArrayConstructor.of, Decl(lib.es5.d.ts, --, --)) +>obj : Symbol(obj, Decl(typedArrays.ts, 76, 29)) + typedArrays[2] = Int16Array.of(...obj); +>typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 77, 7)) +>Int16Array.of : Symbol(Int16ArrayConstructor.of, Decl(lib.es5.d.ts, --, --)) +>Int16Array : Symbol(Int16Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>of : Symbol(Int16ArrayConstructor.of, Decl(lib.es5.d.ts, --, --)) +>obj : Symbol(obj, Decl(typedArrays.ts, 76, 29)) + typedArrays[3] = Uint16Array.of(...obj); +>typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 77, 7)) +>Uint16Array.of : Symbol(Uint16ArrayConstructor.of, Decl(lib.es5.d.ts, --, --)) +>Uint16Array : Symbol(Uint16Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>of : Symbol(Uint16ArrayConstructor.of, Decl(lib.es5.d.ts, --, --)) +>obj : Symbol(obj, Decl(typedArrays.ts, 76, 29)) + typedArrays[4] = Int32Array.of(...obj); +>typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 77, 7)) +>Int32Array.of : Symbol(Int32ArrayConstructor.of, Decl(lib.es5.d.ts, --, --)) +>Int32Array : Symbol(Int32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>of : Symbol(Int32ArrayConstructor.of, Decl(lib.es5.d.ts, --, --)) +>obj : Symbol(obj, Decl(typedArrays.ts, 76, 29)) + typedArrays[5] = Uint32Array.of(...obj); +>typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 77, 7)) +>Uint32Array.of : Symbol(Uint32ArrayConstructor.of, Decl(lib.es5.d.ts, --, --)) +>Uint32Array : Symbol(Uint32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>of : Symbol(Uint32ArrayConstructor.of, Decl(lib.es5.d.ts, --, --)) +>obj : Symbol(obj, Decl(typedArrays.ts, 76, 29)) + typedArrays[6] = Float32Array.of(...obj); +>typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 77, 7)) +>Float32Array.of : Symbol(Float32ArrayConstructor.of, Decl(lib.es5.d.ts, --, --)) +>Float32Array : Symbol(Float32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>of : Symbol(Float32ArrayConstructor.of, Decl(lib.es5.d.ts, --, --)) +>obj : Symbol(obj, Decl(typedArrays.ts, 76, 29)) + typedArrays[7] = Float64Array.of(...obj); +>typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 77, 7)) +>Float64Array.of : Symbol(Float64ArrayConstructor.of, Decl(lib.es5.d.ts, --, --)) +>Float64Array : Symbol(Float64Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>of : Symbol(Float64ArrayConstructor.of, Decl(lib.es5.d.ts, --, --)) +>obj : Symbol(obj, Decl(typedArrays.ts, 76, 29)) + typedArrays[8] = Uint8ClampedArray.of(...obj); +>typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 77, 7)) +>Uint8ClampedArray.of : Symbol(Uint8ClampedArrayConstructor.of, Decl(lib.es5.d.ts, --, --)) +>Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>of : Symbol(Uint8ClampedArrayConstructor.of, Decl(lib.es5.d.ts, --, --)) +>obj : Symbol(obj, Decl(typedArrays.ts, 76, 29)) return typedArrays; +>typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 77, 7)) } -*/ function CreateTypedArraysOf2() { ->CreateTypedArraysOf2 : Symbol(CreateTypedArraysOf2, Decl(typedArrays.ts, 74, 1)) +>CreateTypedArraysOf2 : Symbol(CreateTypedArraysOf2, Decl(typedArrays.ts, 89, 1)) var typedArrays = []; ->typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 94, 7)) +>typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 92, 7)) typedArrays[0] = Int8Array.of(1,2,3,4); ->typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 94, 7)) ->Int8Array.of : Symbol(Int8ArrayConstructor.of, Decl(lib.d.ts, --, --)) ->Int8Array : Symbol(Int8Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->of : Symbol(Int8ArrayConstructor.of, Decl(lib.d.ts, --, --)) +>typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 92, 7)) +>Int8Array.of : Symbol(Int8ArrayConstructor.of, Decl(lib.es5.d.ts, --, --)) +>Int8Array : Symbol(Int8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>of : Symbol(Int8ArrayConstructor.of, Decl(lib.es5.d.ts, --, --)) typedArrays[1] = Uint8Array.of(1,2,3,4); ->typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 94, 7)) ->Uint8Array.of : Symbol(Uint8ArrayConstructor.of, Decl(lib.d.ts, --, --)) ->Uint8Array : Symbol(Uint8Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->of : Symbol(Uint8ArrayConstructor.of, Decl(lib.d.ts, --, --)) +>typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 92, 7)) +>Uint8Array.of : Symbol(Uint8ArrayConstructor.of, Decl(lib.es5.d.ts, --, --)) +>Uint8Array : Symbol(Uint8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>of : Symbol(Uint8ArrayConstructor.of, Decl(lib.es5.d.ts, --, --)) typedArrays[2] = Int16Array.of(1,2,3,4); ->typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 94, 7)) ->Int16Array.of : Symbol(Int16ArrayConstructor.of, Decl(lib.d.ts, --, --)) ->Int16Array : Symbol(Int16Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->of : Symbol(Int16ArrayConstructor.of, Decl(lib.d.ts, --, --)) +>typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 92, 7)) +>Int16Array.of : Symbol(Int16ArrayConstructor.of, Decl(lib.es5.d.ts, --, --)) +>Int16Array : Symbol(Int16Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>of : Symbol(Int16ArrayConstructor.of, Decl(lib.es5.d.ts, --, --)) typedArrays[3] = Uint16Array.of(1,2,3,4); ->typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 94, 7)) ->Uint16Array.of : Symbol(Uint16ArrayConstructor.of, Decl(lib.d.ts, --, --)) ->Uint16Array : Symbol(Uint16Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->of : Symbol(Uint16ArrayConstructor.of, Decl(lib.d.ts, --, --)) +>typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 92, 7)) +>Uint16Array.of : Symbol(Uint16ArrayConstructor.of, Decl(lib.es5.d.ts, --, --)) +>Uint16Array : Symbol(Uint16Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>of : Symbol(Uint16ArrayConstructor.of, Decl(lib.es5.d.ts, --, --)) typedArrays[4] = Int32Array.of(1,2,3,4); ->typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 94, 7)) ->Int32Array.of : Symbol(Int32ArrayConstructor.of, Decl(lib.d.ts, --, --)) ->Int32Array : Symbol(Int32Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->of : Symbol(Int32ArrayConstructor.of, Decl(lib.d.ts, --, --)) +>typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 92, 7)) +>Int32Array.of : Symbol(Int32ArrayConstructor.of, Decl(lib.es5.d.ts, --, --)) +>Int32Array : Symbol(Int32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>of : Symbol(Int32ArrayConstructor.of, Decl(lib.es5.d.ts, --, --)) typedArrays[5] = Uint32Array.of(1,2,3,4); ->typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 94, 7)) ->Uint32Array.of : Symbol(Uint32ArrayConstructor.of, Decl(lib.d.ts, --, --)) ->Uint32Array : Symbol(Uint32Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->of : Symbol(Uint32ArrayConstructor.of, Decl(lib.d.ts, --, --)) +>typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 92, 7)) +>Uint32Array.of : Symbol(Uint32ArrayConstructor.of, Decl(lib.es5.d.ts, --, --)) +>Uint32Array : Symbol(Uint32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>of : Symbol(Uint32ArrayConstructor.of, Decl(lib.es5.d.ts, --, --)) typedArrays[6] = Float32Array.of(1,2,3,4); ->typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 94, 7)) ->Float32Array.of : Symbol(Float32ArrayConstructor.of, Decl(lib.d.ts, --, --)) ->Float32Array : Symbol(Float32Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->of : Symbol(Float32ArrayConstructor.of, Decl(lib.d.ts, --, --)) +>typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 92, 7)) +>Float32Array.of : Symbol(Float32ArrayConstructor.of, Decl(lib.es5.d.ts, --, --)) +>Float32Array : Symbol(Float32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>of : Symbol(Float32ArrayConstructor.of, Decl(lib.es5.d.ts, --, --)) typedArrays[7] = Float64Array.of(1,2,3,4); ->typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 94, 7)) ->Float64Array.of : Symbol(Float64ArrayConstructor.of, Decl(lib.d.ts, --, --)) ->Float64Array : Symbol(Float64Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->of : Symbol(Float64ArrayConstructor.of, Decl(lib.d.ts, --, --)) +>typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 92, 7)) +>Float64Array.of : Symbol(Float64ArrayConstructor.of, Decl(lib.es5.d.ts, --, --)) +>Float64Array : Symbol(Float64Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>of : Symbol(Float64ArrayConstructor.of, Decl(lib.es5.d.ts, --, --)) typedArrays[8] = Uint8ClampedArray.of(1,2,3,4); ->typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 94, 7)) ->Uint8ClampedArray.of : Symbol(Uint8ClampedArrayConstructor.of, Decl(lib.d.ts, --, --)) ->Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->of : Symbol(Uint8ClampedArrayConstructor.of, Decl(lib.d.ts, --, --)) +>typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 92, 7)) +>Uint8ClampedArray.of : Symbol(Uint8ClampedArrayConstructor.of, Decl(lib.es5.d.ts, --, --)) +>Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>of : Symbol(Uint8ClampedArrayConstructor.of, Decl(lib.es5.d.ts, --, --)) return typedArrays; ->typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 94, 7)) +>typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 92, 7)) } function CreateTypedArraysFromMapFn(obj:ArrayLike, mapFn: (n:number, v:number)=> number) { ->CreateTypedArraysFromMapFn : Symbol(CreateTypedArraysFromMapFn, Decl(typedArrays.ts, 106, 1)) ->obj : Symbol(obj, Decl(typedArrays.ts, 108, 36)) ->ArrayLike : Symbol(ArrayLike, Decl(lib.d.ts, --, --)) ->mapFn : Symbol(mapFn, Decl(typedArrays.ts, 108, 58)) ->n : Symbol(n, Decl(typedArrays.ts, 108, 67)) ->v : Symbol(v, Decl(typedArrays.ts, 108, 76)) +>CreateTypedArraysFromMapFn : Symbol(CreateTypedArraysFromMapFn, Decl(typedArrays.ts, 104, 1)) +>obj : Symbol(obj, Decl(typedArrays.ts, 106, 36)) +>ArrayLike : Symbol(ArrayLike, Decl(lib.es5.d.ts, --, --)) +>mapFn : Symbol(mapFn, Decl(typedArrays.ts, 106, 58)) +>n : Symbol(n, Decl(typedArrays.ts, 106, 67)) +>v : Symbol(v, Decl(typedArrays.ts, 106, 76)) var typedArrays = []; ->typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 109, 7)) +>typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 107, 7)) typedArrays[0] = Int8Array.from(obj, mapFn); ->typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 109, 7)) ->Int8Array.from : Symbol(Int8ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Int8Array : Symbol(Int8Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->from : Symbol(Int8ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->obj : Symbol(obj, Decl(typedArrays.ts, 108, 36)) ->mapFn : Symbol(mapFn, Decl(typedArrays.ts, 108, 58)) +>typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 107, 7)) +>Int8Array.from : Symbol(Int8ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Int8Array : Symbol(Int8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>from : Symbol(Int8ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>obj : Symbol(obj, Decl(typedArrays.ts, 106, 36)) +>mapFn : Symbol(mapFn, Decl(typedArrays.ts, 106, 58)) typedArrays[1] = Uint8Array.from(obj, mapFn); ->typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 109, 7)) ->Uint8Array.from : Symbol(Uint8ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Uint8Array : Symbol(Uint8Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->from : Symbol(Uint8ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->obj : Symbol(obj, Decl(typedArrays.ts, 108, 36)) ->mapFn : Symbol(mapFn, Decl(typedArrays.ts, 108, 58)) +>typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 107, 7)) +>Uint8Array.from : Symbol(Uint8ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Uint8Array : Symbol(Uint8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>from : Symbol(Uint8ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>obj : Symbol(obj, Decl(typedArrays.ts, 106, 36)) +>mapFn : Symbol(mapFn, Decl(typedArrays.ts, 106, 58)) typedArrays[2] = Int16Array.from(obj, mapFn); ->typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 109, 7)) ->Int16Array.from : Symbol(Int16ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Int16Array : Symbol(Int16Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->from : Symbol(Int16ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->obj : Symbol(obj, Decl(typedArrays.ts, 108, 36)) ->mapFn : Symbol(mapFn, Decl(typedArrays.ts, 108, 58)) +>typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 107, 7)) +>Int16Array.from : Symbol(Int16ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Int16Array : Symbol(Int16Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>from : Symbol(Int16ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>obj : Symbol(obj, Decl(typedArrays.ts, 106, 36)) +>mapFn : Symbol(mapFn, Decl(typedArrays.ts, 106, 58)) typedArrays[3] = Uint16Array.from(obj, mapFn); ->typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 109, 7)) ->Uint16Array.from : Symbol(Uint16ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Uint16Array : Symbol(Uint16Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->from : Symbol(Uint16ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->obj : Symbol(obj, Decl(typedArrays.ts, 108, 36)) ->mapFn : Symbol(mapFn, Decl(typedArrays.ts, 108, 58)) +>typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 107, 7)) +>Uint16Array.from : Symbol(Uint16ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Uint16Array : Symbol(Uint16Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>from : Symbol(Uint16ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>obj : Symbol(obj, Decl(typedArrays.ts, 106, 36)) +>mapFn : Symbol(mapFn, Decl(typedArrays.ts, 106, 58)) typedArrays[4] = Int32Array.from(obj, mapFn); ->typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 109, 7)) ->Int32Array.from : Symbol(Int32ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Int32Array : Symbol(Int32Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->from : Symbol(Int32ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->obj : Symbol(obj, Decl(typedArrays.ts, 108, 36)) ->mapFn : Symbol(mapFn, Decl(typedArrays.ts, 108, 58)) +>typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 107, 7)) +>Int32Array.from : Symbol(Int32ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Int32Array : Symbol(Int32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>from : Symbol(Int32ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>obj : Symbol(obj, Decl(typedArrays.ts, 106, 36)) +>mapFn : Symbol(mapFn, Decl(typedArrays.ts, 106, 58)) typedArrays[5] = Uint32Array.from(obj, mapFn); ->typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 109, 7)) ->Uint32Array.from : Symbol(Uint32ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Uint32Array : Symbol(Uint32Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->from : Symbol(Uint32ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->obj : Symbol(obj, Decl(typedArrays.ts, 108, 36)) ->mapFn : Symbol(mapFn, Decl(typedArrays.ts, 108, 58)) +>typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 107, 7)) +>Uint32Array.from : Symbol(Uint32ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Uint32Array : Symbol(Uint32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>from : Symbol(Uint32ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>obj : Symbol(obj, Decl(typedArrays.ts, 106, 36)) +>mapFn : Symbol(mapFn, Decl(typedArrays.ts, 106, 58)) typedArrays[6] = Float32Array.from(obj, mapFn); ->typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 109, 7)) ->Float32Array.from : Symbol(Float32ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Float32Array : Symbol(Float32Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->from : Symbol(Float32ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->obj : Symbol(obj, Decl(typedArrays.ts, 108, 36)) ->mapFn : Symbol(mapFn, Decl(typedArrays.ts, 108, 58)) +>typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 107, 7)) +>Float32Array.from : Symbol(Float32ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Float32Array : Symbol(Float32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>from : Symbol(Float32ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>obj : Symbol(obj, Decl(typedArrays.ts, 106, 36)) +>mapFn : Symbol(mapFn, Decl(typedArrays.ts, 106, 58)) typedArrays[7] = Float64Array.from(obj, mapFn); ->typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 109, 7)) ->Float64Array.from : Symbol(Float64ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Float64Array : Symbol(Float64Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->from : Symbol(Float64ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->obj : Symbol(obj, Decl(typedArrays.ts, 108, 36)) ->mapFn : Symbol(mapFn, Decl(typedArrays.ts, 108, 58)) +>typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 107, 7)) +>Float64Array.from : Symbol(Float64ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Float64Array : Symbol(Float64Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>from : Symbol(Float64ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>obj : Symbol(obj, Decl(typedArrays.ts, 106, 36)) +>mapFn : Symbol(mapFn, Decl(typedArrays.ts, 106, 58)) typedArrays[8] = Uint8ClampedArray.from(obj, mapFn); ->typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 109, 7)) ->Uint8ClampedArray.from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->obj : Symbol(obj, Decl(typedArrays.ts, 108, 36)) ->mapFn : Symbol(mapFn, Decl(typedArrays.ts, 108, 58)) +>typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 107, 7)) +>Uint8ClampedArray.from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>obj : Symbol(obj, Decl(typedArrays.ts, 106, 36)) +>mapFn : Symbol(mapFn, Decl(typedArrays.ts, 106, 58)) return typedArrays; ->typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 109, 7)) +>typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 107, 7)) } function CreateTypedArraysFromThisObj(obj:ArrayLike, mapFn: (n:number, v:number)=> number, thisArg: {}) { ->CreateTypedArraysFromThisObj : Symbol(CreateTypedArraysFromThisObj, Decl(typedArrays.ts, 121, 1)) ->obj : Symbol(obj, Decl(typedArrays.ts, 123, 38)) ->ArrayLike : Symbol(ArrayLike, Decl(lib.d.ts, --, --)) ->mapFn : Symbol(mapFn, Decl(typedArrays.ts, 123, 60)) ->n : Symbol(n, Decl(typedArrays.ts, 123, 69)) ->v : Symbol(v, Decl(typedArrays.ts, 123, 78)) ->thisArg : Symbol(thisArg, Decl(typedArrays.ts, 123, 98)) +>CreateTypedArraysFromThisObj : Symbol(CreateTypedArraysFromThisObj, Decl(typedArrays.ts, 119, 1)) +>obj : Symbol(obj, Decl(typedArrays.ts, 121, 38)) +>ArrayLike : Symbol(ArrayLike, Decl(lib.es5.d.ts, --, --)) +>mapFn : Symbol(mapFn, Decl(typedArrays.ts, 121, 60)) +>n : Symbol(n, Decl(typedArrays.ts, 121, 69)) +>v : Symbol(v, Decl(typedArrays.ts, 121, 78)) +>thisArg : Symbol(thisArg, Decl(typedArrays.ts, 121, 98)) var typedArrays = []; ->typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 124, 7)) +>typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 122, 7)) typedArrays[0] = Int8Array.from(obj, mapFn, thisArg); ->typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 124, 7)) ->Int8Array.from : Symbol(Int8ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Int8Array : Symbol(Int8Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->from : Symbol(Int8ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->obj : Symbol(obj, Decl(typedArrays.ts, 123, 38)) ->mapFn : Symbol(mapFn, Decl(typedArrays.ts, 123, 60)) ->thisArg : Symbol(thisArg, Decl(typedArrays.ts, 123, 98)) +>typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 122, 7)) +>Int8Array.from : Symbol(Int8ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Int8Array : Symbol(Int8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>from : Symbol(Int8ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>obj : Symbol(obj, Decl(typedArrays.ts, 121, 38)) +>mapFn : Symbol(mapFn, Decl(typedArrays.ts, 121, 60)) +>thisArg : Symbol(thisArg, Decl(typedArrays.ts, 121, 98)) typedArrays[1] = Uint8Array.from(obj, mapFn, thisArg); ->typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 124, 7)) ->Uint8Array.from : Symbol(Uint8ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Uint8Array : Symbol(Uint8Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->from : Symbol(Uint8ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->obj : Symbol(obj, Decl(typedArrays.ts, 123, 38)) ->mapFn : Symbol(mapFn, Decl(typedArrays.ts, 123, 60)) ->thisArg : Symbol(thisArg, Decl(typedArrays.ts, 123, 98)) +>typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 122, 7)) +>Uint8Array.from : Symbol(Uint8ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Uint8Array : Symbol(Uint8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>from : Symbol(Uint8ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>obj : Symbol(obj, Decl(typedArrays.ts, 121, 38)) +>mapFn : Symbol(mapFn, Decl(typedArrays.ts, 121, 60)) +>thisArg : Symbol(thisArg, Decl(typedArrays.ts, 121, 98)) typedArrays[2] = Int16Array.from(obj, mapFn, thisArg); ->typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 124, 7)) ->Int16Array.from : Symbol(Int16ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Int16Array : Symbol(Int16Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->from : Symbol(Int16ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->obj : Symbol(obj, Decl(typedArrays.ts, 123, 38)) ->mapFn : Symbol(mapFn, Decl(typedArrays.ts, 123, 60)) ->thisArg : Symbol(thisArg, Decl(typedArrays.ts, 123, 98)) +>typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 122, 7)) +>Int16Array.from : Symbol(Int16ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Int16Array : Symbol(Int16Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>from : Symbol(Int16ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>obj : Symbol(obj, Decl(typedArrays.ts, 121, 38)) +>mapFn : Symbol(mapFn, Decl(typedArrays.ts, 121, 60)) +>thisArg : Symbol(thisArg, Decl(typedArrays.ts, 121, 98)) typedArrays[3] = Uint16Array.from(obj, mapFn, thisArg); ->typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 124, 7)) ->Uint16Array.from : Symbol(Uint16ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Uint16Array : Symbol(Uint16Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->from : Symbol(Uint16ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->obj : Symbol(obj, Decl(typedArrays.ts, 123, 38)) ->mapFn : Symbol(mapFn, Decl(typedArrays.ts, 123, 60)) ->thisArg : Symbol(thisArg, Decl(typedArrays.ts, 123, 98)) +>typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 122, 7)) +>Uint16Array.from : Symbol(Uint16ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Uint16Array : Symbol(Uint16Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>from : Symbol(Uint16ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>obj : Symbol(obj, Decl(typedArrays.ts, 121, 38)) +>mapFn : Symbol(mapFn, Decl(typedArrays.ts, 121, 60)) +>thisArg : Symbol(thisArg, Decl(typedArrays.ts, 121, 98)) typedArrays[4] = Int32Array.from(obj, mapFn, thisArg); ->typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 124, 7)) ->Int32Array.from : Symbol(Int32ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Int32Array : Symbol(Int32Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->from : Symbol(Int32ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->obj : Symbol(obj, Decl(typedArrays.ts, 123, 38)) ->mapFn : Symbol(mapFn, Decl(typedArrays.ts, 123, 60)) ->thisArg : Symbol(thisArg, Decl(typedArrays.ts, 123, 98)) +>typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 122, 7)) +>Int32Array.from : Symbol(Int32ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Int32Array : Symbol(Int32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>from : Symbol(Int32ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>obj : Symbol(obj, Decl(typedArrays.ts, 121, 38)) +>mapFn : Symbol(mapFn, Decl(typedArrays.ts, 121, 60)) +>thisArg : Symbol(thisArg, Decl(typedArrays.ts, 121, 98)) typedArrays[5] = Uint32Array.from(obj, mapFn, thisArg); ->typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 124, 7)) ->Uint32Array.from : Symbol(Uint32ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Uint32Array : Symbol(Uint32Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->from : Symbol(Uint32ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->obj : Symbol(obj, Decl(typedArrays.ts, 123, 38)) ->mapFn : Symbol(mapFn, Decl(typedArrays.ts, 123, 60)) ->thisArg : Symbol(thisArg, Decl(typedArrays.ts, 123, 98)) +>typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 122, 7)) +>Uint32Array.from : Symbol(Uint32ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Uint32Array : Symbol(Uint32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>from : Symbol(Uint32ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>obj : Symbol(obj, Decl(typedArrays.ts, 121, 38)) +>mapFn : Symbol(mapFn, Decl(typedArrays.ts, 121, 60)) +>thisArg : Symbol(thisArg, Decl(typedArrays.ts, 121, 98)) typedArrays[6] = Float32Array.from(obj, mapFn, thisArg); ->typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 124, 7)) ->Float32Array.from : Symbol(Float32ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Float32Array : Symbol(Float32Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->from : Symbol(Float32ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->obj : Symbol(obj, Decl(typedArrays.ts, 123, 38)) ->mapFn : Symbol(mapFn, Decl(typedArrays.ts, 123, 60)) ->thisArg : Symbol(thisArg, Decl(typedArrays.ts, 123, 98)) +>typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 122, 7)) +>Float32Array.from : Symbol(Float32ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Float32Array : Symbol(Float32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>from : Symbol(Float32ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>obj : Symbol(obj, Decl(typedArrays.ts, 121, 38)) +>mapFn : Symbol(mapFn, Decl(typedArrays.ts, 121, 60)) +>thisArg : Symbol(thisArg, Decl(typedArrays.ts, 121, 98)) typedArrays[7] = Float64Array.from(obj, mapFn, thisArg); ->typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 124, 7)) ->Float64Array.from : Symbol(Float64ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Float64Array : Symbol(Float64Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->from : Symbol(Float64ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->obj : Symbol(obj, Decl(typedArrays.ts, 123, 38)) ->mapFn : Symbol(mapFn, Decl(typedArrays.ts, 123, 60)) ->thisArg : Symbol(thisArg, Decl(typedArrays.ts, 123, 98)) +>typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 122, 7)) +>Float64Array.from : Symbol(Float64ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Float64Array : Symbol(Float64Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>from : Symbol(Float64ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>obj : Symbol(obj, Decl(typedArrays.ts, 121, 38)) +>mapFn : Symbol(mapFn, Decl(typedArrays.ts, 121, 60)) +>thisArg : Symbol(thisArg, Decl(typedArrays.ts, 121, 98)) typedArrays[8] = Uint8ClampedArray.from(obj, mapFn, thisArg); ->typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 124, 7)) ->Uint8ClampedArray.from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->obj : Symbol(obj, Decl(typedArrays.ts, 123, 38)) ->mapFn : Symbol(mapFn, Decl(typedArrays.ts, 123, 60)) ->thisArg : Symbol(thisArg, Decl(typedArrays.ts, 123, 98)) +>typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 122, 7)) +>Uint8ClampedArray.from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>obj : Symbol(obj, Decl(typedArrays.ts, 121, 38)) +>mapFn : Symbol(mapFn, Decl(typedArrays.ts, 121, 60)) +>thisArg : Symbol(thisArg, Decl(typedArrays.ts, 121, 98)) return typedArrays; ->typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 124, 7)) +>typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 122, 7)) } diff --git a/tests/baselines/reference/typedArrays.types b/tests/baselines/reference/typedArrays.types index 9886982c0f2..f7d3cbdd19f 100644 --- a/tests/baselines/reference/typedArrays.types +++ b/tests/baselines/reference/typedArrays.types @@ -483,22 +483,125 @@ function CreateIntegerTypedArraysFromArrayLike(obj:ArrayLike) { >typedArrays : any[] } -/* function CreateTypedArraysOf(obj) { +>CreateTypedArraysOf : (obj: any) => any[] +>obj : any + var typedArrays = []; +>typedArrays : any[] +>[] : undefined[] + typedArrays[0] = Int8Array.of(...obj); +>typedArrays[0] = Int8Array.of(...obj) : Int8Array +>typedArrays[0] : any +>typedArrays : any[] +>0 : number +>Int8Array.of(...obj) : Int8Array +>Int8Array.of : (...items: number[]) => Int8Array +>Int8Array : Int8ArrayConstructor +>of : (...items: number[]) => Int8Array +>...obj : any +>obj : any + typedArrays[1] = Uint8Array.of(...obj); +>typedArrays[1] = Uint8Array.of(...obj) : Uint8Array +>typedArrays[1] : any +>typedArrays : any[] +>1 : number +>Uint8Array.of(...obj) : Uint8Array +>Uint8Array.of : (...items: number[]) => Uint8Array +>Uint8Array : Uint8ArrayConstructor +>of : (...items: number[]) => Uint8Array +>...obj : any +>obj : any + typedArrays[2] = Int16Array.of(...obj); +>typedArrays[2] = Int16Array.of(...obj) : Int16Array +>typedArrays[2] : any +>typedArrays : any[] +>2 : number +>Int16Array.of(...obj) : Int16Array +>Int16Array.of : (...items: number[]) => Int16Array +>Int16Array : Int16ArrayConstructor +>of : (...items: number[]) => Int16Array +>...obj : any +>obj : any + typedArrays[3] = Uint16Array.of(...obj); +>typedArrays[3] = Uint16Array.of(...obj) : Uint16Array +>typedArrays[3] : any +>typedArrays : any[] +>3 : number +>Uint16Array.of(...obj) : Uint16Array +>Uint16Array.of : (...items: number[]) => Uint16Array +>Uint16Array : Uint16ArrayConstructor +>of : (...items: number[]) => Uint16Array +>...obj : any +>obj : any + typedArrays[4] = Int32Array.of(...obj); +>typedArrays[4] = Int32Array.of(...obj) : Int32Array +>typedArrays[4] : any +>typedArrays : any[] +>4 : number +>Int32Array.of(...obj) : Int32Array +>Int32Array.of : (...items: number[]) => Int32Array +>Int32Array : Int32ArrayConstructor +>of : (...items: number[]) => Int32Array +>...obj : any +>obj : any + typedArrays[5] = Uint32Array.of(...obj); +>typedArrays[5] = Uint32Array.of(...obj) : Uint32Array +>typedArrays[5] : any +>typedArrays : any[] +>5 : number +>Uint32Array.of(...obj) : Uint32Array +>Uint32Array.of : (...items: number[]) => Uint32Array +>Uint32Array : Uint32ArrayConstructor +>of : (...items: number[]) => Uint32Array +>...obj : any +>obj : any + typedArrays[6] = Float32Array.of(...obj); +>typedArrays[6] = Float32Array.of(...obj) : Float32Array +>typedArrays[6] : any +>typedArrays : any[] +>6 : number +>Float32Array.of(...obj) : Float32Array +>Float32Array.of : (...items: number[]) => Float32Array +>Float32Array : Float32ArrayConstructor +>of : (...items: number[]) => Float32Array +>...obj : any +>obj : any + typedArrays[7] = Float64Array.of(...obj); +>typedArrays[7] = Float64Array.of(...obj) : Float64Array +>typedArrays[7] : any +>typedArrays : any[] +>7 : number +>Float64Array.of(...obj) : Float64Array +>Float64Array.of : (...items: number[]) => Float64Array +>Float64Array : Float64ArrayConstructor +>of : (...items: number[]) => Float64Array +>...obj : any +>obj : any + typedArrays[8] = Uint8ClampedArray.of(...obj); +>typedArrays[8] = Uint8ClampedArray.of(...obj) : Uint8ClampedArray +>typedArrays[8] : any +>typedArrays : any[] +>8 : number +>Uint8ClampedArray.of(...obj) : Uint8ClampedArray +>Uint8ClampedArray.of : (...items: number[]) => Uint8ClampedArray +>Uint8ClampedArray : Uint8ClampedArrayConstructor +>of : (...items: number[]) => Uint8ClampedArray +>...obj : any +>obj : any return typedArrays; +>typedArrays : any[] } -*/ function CreateTypedArraysOf2() { >CreateTypedArraysOf2 : () => any[] diff --git a/tests/baselines/reference/typedArraysCrossAssignability01.errors.txt b/tests/baselines/reference/typedArraysCrossAssignability01.errors.txt new file mode 100644 index 00000000000..bd3422b4826 --- /dev/null +++ b/tests/baselines/reference/typedArraysCrossAssignability01.errors.txt @@ -0,0 +1,545 @@ +tests/cases/compiler/typedArraysCrossAssignability01.ts(14,5): error TS2322: Type 'Uint8Array' is not assignable to type 'Int8Array'. + Types of property '[Symbol.toStringTag]' are incompatible. + Type '"UInt8Array"' is not assignable to type '"Int8Array"'. +tests/cases/compiler/typedArraysCrossAssignability01.ts(15,5): error TS2322: Type 'Int16Array' is not assignable to type 'Int8Array'. + Types of property '[Symbol.toStringTag]' are incompatible. + Type '"Int16Array"' is not assignable to type '"Int8Array"'. +tests/cases/compiler/typedArraysCrossAssignability01.ts(16,5): error TS2322: Type 'Uint16Array' is not assignable to type 'Int8Array'. + Types of property '[Symbol.toStringTag]' are incompatible. + Type '"Uint16Array"' is not assignable to type '"Int8Array"'. +tests/cases/compiler/typedArraysCrossAssignability01.ts(17,5): error TS2322: Type 'Int32Array' is not assignable to type 'Int8Array'. + Types of property '[Symbol.toStringTag]' are incompatible. + Type '"Int32Array"' is not assignable to type '"Int8Array"'. +tests/cases/compiler/typedArraysCrossAssignability01.ts(18,5): error TS2322: Type 'Uint32Array' is not assignable to type 'Int8Array'. + Types of property '[Symbol.toStringTag]' are incompatible. + Type '"Uint32Array"' is not assignable to type '"Int8Array"'. +tests/cases/compiler/typedArraysCrossAssignability01.ts(19,5): error TS2322: Type 'Float32Array' is not assignable to type 'Int8Array'. + Types of property '[Symbol.toStringTag]' are incompatible. + Type '"Float32Array"' is not assignable to type '"Int8Array"'. +tests/cases/compiler/typedArraysCrossAssignability01.ts(20,5): error TS2322: Type 'Float64Array' is not assignable to type 'Int8Array'. + Types of property '[Symbol.toStringTag]' are incompatible. + Type '"Float64Array"' is not assignable to type '"Int8Array"'. +tests/cases/compiler/typedArraysCrossAssignability01.ts(21,5): error TS2322: Type 'Uint8ClampedArray' is not assignable to type 'Int8Array'. + Types of property '[Symbol.toStringTag]' are incompatible. + Type '"Uint8ClampedArray"' is not assignable to type '"Int8Array"'. +tests/cases/compiler/typedArraysCrossAssignability01.ts(23,5): error TS2322: Type 'Int8Array' is not assignable to type 'Uint8Array'. + Types of property '[Symbol.toStringTag]' are incompatible. + Type '"Int8Array"' is not assignable to type '"UInt8Array"'. +tests/cases/compiler/typedArraysCrossAssignability01.ts(25,5): error TS2322: Type 'Int16Array' is not assignable to type 'Uint8Array'. + Types of property '[Symbol.toStringTag]' are incompatible. + Type '"Int16Array"' is not assignable to type '"UInt8Array"'. +tests/cases/compiler/typedArraysCrossAssignability01.ts(26,5): error TS2322: Type 'Uint16Array' is not assignable to type 'Uint8Array'. + Types of property '[Symbol.toStringTag]' are incompatible. + Type '"Uint16Array"' is not assignable to type '"UInt8Array"'. +tests/cases/compiler/typedArraysCrossAssignability01.ts(27,5): error TS2322: Type 'Int32Array' is not assignable to type 'Uint8Array'. + Types of property '[Symbol.toStringTag]' are incompatible. + Type '"Int32Array"' is not assignable to type '"UInt8Array"'. +tests/cases/compiler/typedArraysCrossAssignability01.ts(28,5): error TS2322: Type 'Uint32Array' is not assignable to type 'Uint8Array'. + Types of property '[Symbol.toStringTag]' are incompatible. + Type '"Uint32Array"' is not assignable to type '"UInt8Array"'. +tests/cases/compiler/typedArraysCrossAssignability01.ts(29,5): error TS2322: Type 'Float32Array' is not assignable to type 'Uint8Array'. + Types of property '[Symbol.toStringTag]' are incompatible. + Type '"Float32Array"' is not assignable to type '"UInt8Array"'. +tests/cases/compiler/typedArraysCrossAssignability01.ts(30,5): error TS2322: Type 'Float64Array' is not assignable to type 'Uint8Array'. + Types of property '[Symbol.toStringTag]' are incompatible. + Type '"Float64Array"' is not assignable to type '"UInt8Array"'. +tests/cases/compiler/typedArraysCrossAssignability01.ts(31,5): error TS2322: Type 'Uint8ClampedArray' is not assignable to type 'Uint8Array'. + Types of property '[Symbol.toStringTag]' are incompatible. + Type '"Uint8ClampedArray"' is not assignable to type '"UInt8Array"'. +tests/cases/compiler/typedArraysCrossAssignability01.ts(33,5): error TS2322: Type 'Int8Array' is not assignable to type 'Int16Array'. + Types of property '[Symbol.toStringTag]' are incompatible. + Type '"Int8Array"' is not assignable to type '"Int16Array"'. +tests/cases/compiler/typedArraysCrossAssignability01.ts(34,5): error TS2322: Type 'Uint8Array' is not assignable to type 'Int16Array'. + Types of property '[Symbol.toStringTag]' are incompatible. + Type '"UInt8Array"' is not assignable to type '"Int16Array"'. +tests/cases/compiler/typedArraysCrossAssignability01.ts(36,5): error TS2322: Type 'Uint16Array' is not assignable to type 'Int16Array'. + Types of property '[Symbol.toStringTag]' are incompatible. + Type '"Uint16Array"' is not assignable to type '"Int16Array"'. +tests/cases/compiler/typedArraysCrossAssignability01.ts(37,5): error TS2322: Type 'Int32Array' is not assignable to type 'Int16Array'. + Types of property '[Symbol.toStringTag]' are incompatible. + Type '"Int32Array"' is not assignable to type '"Int16Array"'. +tests/cases/compiler/typedArraysCrossAssignability01.ts(38,5): error TS2322: Type 'Uint32Array' is not assignable to type 'Int16Array'. + Types of property '[Symbol.toStringTag]' are incompatible. + Type '"Uint32Array"' is not assignable to type '"Int16Array"'. +tests/cases/compiler/typedArraysCrossAssignability01.ts(39,5): error TS2322: Type 'Float32Array' is not assignable to type 'Int16Array'. + Types of property '[Symbol.toStringTag]' are incompatible. + Type '"Float32Array"' is not assignable to type '"Int16Array"'. +tests/cases/compiler/typedArraysCrossAssignability01.ts(40,5): error TS2322: Type 'Float64Array' is not assignable to type 'Int16Array'. + Types of property '[Symbol.toStringTag]' are incompatible. + Type '"Float64Array"' is not assignable to type '"Int16Array"'. +tests/cases/compiler/typedArraysCrossAssignability01.ts(41,5): error TS2322: Type 'Uint8ClampedArray' is not assignable to type 'Int16Array'. + Types of property '[Symbol.toStringTag]' are incompatible. + Type '"Uint8ClampedArray"' is not assignable to type '"Int16Array"'. +tests/cases/compiler/typedArraysCrossAssignability01.ts(43,5): error TS2322: Type 'Int8Array' is not assignable to type 'Uint16Array'. + Types of property '[Symbol.toStringTag]' are incompatible. + Type '"Int8Array"' is not assignable to type '"Uint16Array"'. +tests/cases/compiler/typedArraysCrossAssignability01.ts(44,5): error TS2322: Type 'Uint8Array' is not assignable to type 'Uint16Array'. + Types of property '[Symbol.toStringTag]' are incompatible. + Type '"UInt8Array"' is not assignable to type '"Uint16Array"'. +tests/cases/compiler/typedArraysCrossAssignability01.ts(45,5): error TS2322: Type 'Int16Array' is not assignable to type 'Uint16Array'. + Types of property '[Symbol.toStringTag]' are incompatible. + Type '"Int16Array"' is not assignable to type '"Uint16Array"'. +tests/cases/compiler/typedArraysCrossAssignability01.ts(47,5): error TS2322: Type 'Int32Array' is not assignable to type 'Uint16Array'. + Types of property '[Symbol.toStringTag]' are incompatible. + Type '"Int32Array"' is not assignable to type '"Uint16Array"'. +tests/cases/compiler/typedArraysCrossAssignability01.ts(48,5): error TS2322: Type 'Uint32Array' is not assignable to type 'Uint16Array'. + Types of property '[Symbol.toStringTag]' are incompatible. + Type '"Uint32Array"' is not assignable to type '"Uint16Array"'. +tests/cases/compiler/typedArraysCrossAssignability01.ts(49,5): error TS2322: Type 'Float32Array' is not assignable to type 'Uint16Array'. + Types of property '[Symbol.toStringTag]' are incompatible. + Type '"Float32Array"' is not assignable to type '"Uint16Array"'. +tests/cases/compiler/typedArraysCrossAssignability01.ts(50,5): error TS2322: Type 'Float64Array' is not assignable to type 'Uint16Array'. + Types of property '[Symbol.toStringTag]' are incompatible. + Type '"Float64Array"' is not assignable to type '"Uint16Array"'. +tests/cases/compiler/typedArraysCrossAssignability01.ts(51,5): error TS2322: Type 'Uint8ClampedArray' is not assignable to type 'Uint16Array'. + Types of property '[Symbol.toStringTag]' are incompatible. + Type '"Uint8ClampedArray"' is not assignable to type '"Uint16Array"'. +tests/cases/compiler/typedArraysCrossAssignability01.ts(53,5): error TS2322: Type 'Int8Array' is not assignable to type 'Int32Array'. + Types of property '[Symbol.toStringTag]' are incompatible. + Type '"Int8Array"' is not assignable to type '"Int32Array"'. +tests/cases/compiler/typedArraysCrossAssignability01.ts(54,5): error TS2322: Type 'Uint8Array' is not assignable to type 'Int32Array'. + Types of property '[Symbol.toStringTag]' are incompatible. + Type '"UInt8Array"' is not assignable to type '"Int32Array"'. +tests/cases/compiler/typedArraysCrossAssignability01.ts(55,5): error TS2322: Type 'Int16Array' is not assignable to type 'Int32Array'. + Types of property '[Symbol.toStringTag]' are incompatible. + Type '"Int16Array"' is not assignable to type '"Int32Array"'. +tests/cases/compiler/typedArraysCrossAssignability01.ts(56,5): error TS2322: Type 'Uint16Array' is not assignable to type 'Int32Array'. + Types of property '[Symbol.toStringTag]' are incompatible. + Type '"Uint16Array"' is not assignable to type '"Int32Array"'. +tests/cases/compiler/typedArraysCrossAssignability01.ts(58,5): error TS2322: Type 'Uint32Array' is not assignable to type 'Int32Array'. + Types of property '[Symbol.toStringTag]' are incompatible. + Type '"Uint32Array"' is not assignable to type '"Int32Array"'. +tests/cases/compiler/typedArraysCrossAssignability01.ts(59,5): error TS2322: Type 'Float32Array' is not assignable to type 'Int32Array'. + Types of property '[Symbol.toStringTag]' are incompatible. + Type '"Float32Array"' is not assignable to type '"Int32Array"'. +tests/cases/compiler/typedArraysCrossAssignability01.ts(60,5): error TS2322: Type 'Float64Array' is not assignable to type 'Int32Array'. + Types of property '[Symbol.toStringTag]' are incompatible. + Type '"Float64Array"' is not assignable to type '"Int32Array"'. +tests/cases/compiler/typedArraysCrossAssignability01.ts(61,5): error TS2322: Type 'Uint8ClampedArray' is not assignable to type 'Int32Array'. + Types of property '[Symbol.toStringTag]' are incompatible. + Type '"Uint8ClampedArray"' is not assignable to type '"Int32Array"'. +tests/cases/compiler/typedArraysCrossAssignability01.ts(63,5): error TS2322: Type 'Int8Array' is not assignable to type 'Float32Array'. + Types of property '[Symbol.toStringTag]' are incompatible. + Type '"Int8Array"' is not assignable to type '"Float32Array"'. +tests/cases/compiler/typedArraysCrossAssignability01.ts(64,5): error TS2322: Type 'Uint8Array' is not assignable to type 'Float32Array'. + Types of property '[Symbol.toStringTag]' are incompatible. + Type '"UInt8Array"' is not assignable to type '"Float32Array"'. +tests/cases/compiler/typedArraysCrossAssignability01.ts(65,5): error TS2322: Type 'Int16Array' is not assignable to type 'Float32Array'. + Types of property '[Symbol.toStringTag]' are incompatible. + Type '"Int16Array"' is not assignable to type '"Float32Array"'. +tests/cases/compiler/typedArraysCrossAssignability01.ts(66,5): error TS2322: Type 'Uint16Array' is not assignable to type 'Float32Array'. + Types of property '[Symbol.toStringTag]' are incompatible. + Type '"Uint16Array"' is not assignable to type '"Float32Array"'. +tests/cases/compiler/typedArraysCrossAssignability01.ts(67,5): error TS2322: Type 'Int32Array' is not assignable to type 'Float32Array'. + Types of property '[Symbol.toStringTag]' are incompatible. + Type '"Int32Array"' is not assignable to type '"Float32Array"'. +tests/cases/compiler/typedArraysCrossAssignability01.ts(68,5): error TS2322: Type 'Uint32Array' is not assignable to type 'Float32Array'. + Types of property '[Symbol.toStringTag]' are incompatible. + Type '"Uint32Array"' is not assignable to type '"Float32Array"'. +tests/cases/compiler/typedArraysCrossAssignability01.ts(70,5): error TS2322: Type 'Float64Array' is not assignable to type 'Float32Array'. + Types of property '[Symbol.toStringTag]' are incompatible. + Type '"Float64Array"' is not assignable to type '"Float32Array"'. +tests/cases/compiler/typedArraysCrossAssignability01.ts(71,5): error TS2322: Type 'Uint8ClampedArray' is not assignable to type 'Float32Array'. + Types of property '[Symbol.toStringTag]' are incompatible. + Type '"Uint8ClampedArray"' is not assignable to type '"Float32Array"'. +tests/cases/compiler/typedArraysCrossAssignability01.ts(73,5): error TS2322: Type 'Int8Array' is not assignable to type 'Float64Array'. + Types of property '[Symbol.toStringTag]' are incompatible. + Type '"Int8Array"' is not assignable to type '"Float64Array"'. +tests/cases/compiler/typedArraysCrossAssignability01.ts(74,5): error TS2322: Type 'Uint8Array' is not assignable to type 'Float64Array'. + Types of property '[Symbol.toStringTag]' are incompatible. + Type '"UInt8Array"' is not assignable to type '"Float64Array"'. +tests/cases/compiler/typedArraysCrossAssignability01.ts(75,5): error TS2322: Type 'Int16Array' is not assignable to type 'Float64Array'. + Types of property '[Symbol.toStringTag]' are incompatible. + Type '"Int16Array"' is not assignable to type '"Float64Array"'. +tests/cases/compiler/typedArraysCrossAssignability01.ts(76,5): error TS2322: Type 'Uint16Array' is not assignable to type 'Float64Array'. + Types of property '[Symbol.toStringTag]' are incompatible. + Type '"Uint16Array"' is not assignable to type '"Float64Array"'. +tests/cases/compiler/typedArraysCrossAssignability01.ts(77,5): error TS2322: Type 'Int32Array' is not assignable to type 'Float64Array'. + Types of property '[Symbol.toStringTag]' are incompatible. + Type '"Int32Array"' is not assignable to type '"Float64Array"'. +tests/cases/compiler/typedArraysCrossAssignability01.ts(78,5): error TS2322: Type 'Uint32Array' is not assignable to type 'Float64Array'. + Types of property '[Symbol.toStringTag]' are incompatible. + Type '"Uint32Array"' is not assignable to type '"Float64Array"'. +tests/cases/compiler/typedArraysCrossAssignability01.ts(79,5): error TS2322: Type 'Float32Array' is not assignable to type 'Float64Array'. + Types of property '[Symbol.toStringTag]' are incompatible. + Type '"Float32Array"' is not assignable to type '"Float64Array"'. +tests/cases/compiler/typedArraysCrossAssignability01.ts(81,5): error TS2322: Type 'Uint8ClampedArray' is not assignable to type 'Float64Array'. + Types of property '[Symbol.toStringTag]' are incompatible. + Type '"Uint8ClampedArray"' is not assignable to type '"Float64Array"'. +tests/cases/compiler/typedArraysCrossAssignability01.ts(83,5): error TS2322: Type 'Int8Array' is not assignable to type 'Uint8ClampedArray'. + Types of property '[Symbol.toStringTag]' are incompatible. + Type '"Int8Array"' is not assignable to type '"Uint8ClampedArray"'. +tests/cases/compiler/typedArraysCrossAssignability01.ts(84,5): error TS2322: Type 'Uint8Array' is not assignable to type 'Uint8ClampedArray'. + Types of property '[Symbol.toStringTag]' are incompatible. + Type '"UInt8Array"' is not assignable to type '"Uint8ClampedArray"'. +tests/cases/compiler/typedArraysCrossAssignability01.ts(85,5): error TS2322: Type 'Int16Array' is not assignable to type 'Uint8ClampedArray'. + Types of property '[Symbol.toStringTag]' are incompatible. + Type '"Int16Array"' is not assignable to type '"Uint8ClampedArray"'. +tests/cases/compiler/typedArraysCrossAssignability01.ts(86,5): error TS2322: Type 'Uint16Array' is not assignable to type 'Uint8ClampedArray'. + Types of property '[Symbol.toStringTag]' are incompatible. + Type '"Uint16Array"' is not assignable to type '"Uint8ClampedArray"'. +tests/cases/compiler/typedArraysCrossAssignability01.ts(87,5): error TS2322: Type 'Int32Array' is not assignable to type 'Uint8ClampedArray'. + Types of property '[Symbol.toStringTag]' are incompatible. + Type '"Int32Array"' is not assignable to type '"Uint8ClampedArray"'. +tests/cases/compiler/typedArraysCrossAssignability01.ts(88,5): error TS2322: Type 'Uint32Array' is not assignable to type 'Uint8ClampedArray'. + Types of property '[Symbol.toStringTag]' are incompatible. + Type '"Uint32Array"' is not assignable to type '"Uint8ClampedArray"'. +tests/cases/compiler/typedArraysCrossAssignability01.ts(89,5): error TS2322: Type 'Float32Array' is not assignable to type 'Uint8ClampedArray'. + Types of property '[Symbol.toStringTag]' are incompatible. + Type '"Float32Array"' is not assignable to type '"Uint8ClampedArray"'. +tests/cases/compiler/typedArraysCrossAssignability01.ts(90,5): error TS2322: Type 'Float64Array' is not assignable to type 'Uint8ClampedArray'. + Types of property '[Symbol.toStringTag]' are incompatible. + Type '"Float64Array"' is not assignable to type '"Uint8ClampedArray"'. + + +==== tests/cases/compiler/typedArraysCrossAssignability01.ts (64 errors) ==== + + function CheckAssignability() { + let arr_Int8Array = new Int8Array(1); + let arr_Uint8Array = new Uint8Array(1); + let arr_Int16Array = new Int16Array(1); + let arr_Uint16Array = new Uint16Array(1); + let arr_Int32Array = new Int32Array(1); + let arr_Uint32Array = new Uint32Array(1); + let arr_Float32Array = new Float32Array(1); + let arr_Float64Array = new Float64Array(1); + let arr_Uint8ClampedArray = new Uint8ClampedArray(1); + + arr_Int8Array = arr_Int8Array; + arr_Int8Array = arr_Uint8Array; + ~~~~~~~~~~~~~ +!!! error TS2322: Type 'Uint8Array' is not assignable to type 'Int8Array'. +!!! error TS2322: Types of property '[Symbol.toStringTag]' are incompatible. +!!! error TS2322: Type '"UInt8Array"' is not assignable to type '"Int8Array"'. + arr_Int8Array = arr_Int16Array; + ~~~~~~~~~~~~~ +!!! error TS2322: Type 'Int16Array' is not assignable to type 'Int8Array'. +!!! error TS2322: Types of property '[Symbol.toStringTag]' are incompatible. +!!! error TS2322: Type '"Int16Array"' is not assignable to type '"Int8Array"'. + arr_Int8Array = arr_Uint16Array; + ~~~~~~~~~~~~~ +!!! error TS2322: Type 'Uint16Array' is not assignable to type 'Int8Array'. +!!! error TS2322: Types of property '[Symbol.toStringTag]' are incompatible. +!!! error TS2322: Type '"Uint16Array"' is not assignable to type '"Int8Array"'. + arr_Int8Array = arr_Int32Array; + ~~~~~~~~~~~~~ +!!! error TS2322: Type 'Int32Array' is not assignable to type 'Int8Array'. +!!! error TS2322: Types of property '[Symbol.toStringTag]' are incompatible. +!!! error TS2322: Type '"Int32Array"' is not assignable to type '"Int8Array"'. + arr_Int8Array = arr_Uint32Array; + ~~~~~~~~~~~~~ +!!! error TS2322: Type 'Uint32Array' is not assignable to type 'Int8Array'. +!!! error TS2322: Types of property '[Symbol.toStringTag]' are incompatible. +!!! error TS2322: Type '"Uint32Array"' is not assignable to type '"Int8Array"'. + arr_Int8Array = arr_Float32Array; + ~~~~~~~~~~~~~ +!!! error TS2322: Type 'Float32Array' is not assignable to type 'Int8Array'. +!!! error TS2322: Types of property '[Symbol.toStringTag]' are incompatible. +!!! error TS2322: Type '"Float32Array"' is not assignable to type '"Int8Array"'. + arr_Int8Array = arr_Float64Array; + ~~~~~~~~~~~~~ +!!! error TS2322: Type 'Float64Array' is not assignable to type 'Int8Array'. +!!! error TS2322: Types of property '[Symbol.toStringTag]' are incompatible. +!!! error TS2322: Type '"Float64Array"' is not assignable to type '"Int8Array"'. + arr_Int8Array = arr_Uint8ClampedArray; + ~~~~~~~~~~~~~ +!!! error TS2322: Type 'Uint8ClampedArray' is not assignable to type 'Int8Array'. +!!! error TS2322: Types of property '[Symbol.toStringTag]' are incompatible. +!!! error TS2322: Type '"Uint8ClampedArray"' is not assignable to type '"Int8Array"'. + + arr_Uint8Array = arr_Int8Array; + ~~~~~~~~~~~~~~ +!!! error TS2322: Type 'Int8Array' is not assignable to type 'Uint8Array'. +!!! error TS2322: Types of property '[Symbol.toStringTag]' are incompatible. +!!! error TS2322: Type '"Int8Array"' is not assignable to type '"UInt8Array"'. + arr_Uint8Array = arr_Uint8Array; + arr_Uint8Array = arr_Int16Array; + ~~~~~~~~~~~~~~ +!!! error TS2322: Type 'Int16Array' is not assignable to type 'Uint8Array'. +!!! error TS2322: Types of property '[Symbol.toStringTag]' are incompatible. +!!! error TS2322: Type '"Int16Array"' is not assignable to type '"UInt8Array"'. + arr_Uint8Array = arr_Uint16Array; + ~~~~~~~~~~~~~~ +!!! error TS2322: Type 'Uint16Array' is not assignable to type 'Uint8Array'. +!!! error TS2322: Types of property '[Symbol.toStringTag]' are incompatible. +!!! error TS2322: Type '"Uint16Array"' is not assignable to type '"UInt8Array"'. + arr_Uint8Array = arr_Int32Array; + ~~~~~~~~~~~~~~ +!!! error TS2322: Type 'Int32Array' is not assignable to type 'Uint8Array'. +!!! error TS2322: Types of property '[Symbol.toStringTag]' are incompatible. +!!! error TS2322: Type '"Int32Array"' is not assignable to type '"UInt8Array"'. + arr_Uint8Array = arr_Uint32Array; + ~~~~~~~~~~~~~~ +!!! error TS2322: Type 'Uint32Array' is not assignable to type 'Uint8Array'. +!!! error TS2322: Types of property '[Symbol.toStringTag]' are incompatible. +!!! error TS2322: Type '"Uint32Array"' is not assignable to type '"UInt8Array"'. + arr_Uint8Array = arr_Float32Array; + ~~~~~~~~~~~~~~ +!!! error TS2322: Type 'Float32Array' is not assignable to type 'Uint8Array'. +!!! error TS2322: Types of property '[Symbol.toStringTag]' are incompatible. +!!! error TS2322: Type '"Float32Array"' is not assignable to type '"UInt8Array"'. + arr_Uint8Array = arr_Float64Array; + ~~~~~~~~~~~~~~ +!!! error TS2322: Type 'Float64Array' is not assignable to type 'Uint8Array'. +!!! error TS2322: Types of property '[Symbol.toStringTag]' are incompatible. +!!! error TS2322: Type '"Float64Array"' is not assignable to type '"UInt8Array"'. + arr_Uint8Array = arr_Uint8ClampedArray; + ~~~~~~~~~~~~~~ +!!! error TS2322: Type 'Uint8ClampedArray' is not assignable to type 'Uint8Array'. +!!! error TS2322: Types of property '[Symbol.toStringTag]' are incompatible. +!!! error TS2322: Type '"Uint8ClampedArray"' is not assignable to type '"UInt8Array"'. + + arr_Int16Array = arr_Int8Array; + ~~~~~~~~~~~~~~ +!!! error TS2322: Type 'Int8Array' is not assignable to type 'Int16Array'. +!!! error TS2322: Types of property '[Symbol.toStringTag]' are incompatible. +!!! error TS2322: Type '"Int8Array"' is not assignable to type '"Int16Array"'. + arr_Int16Array = arr_Uint8Array; + ~~~~~~~~~~~~~~ +!!! error TS2322: Type 'Uint8Array' is not assignable to type 'Int16Array'. +!!! error TS2322: Types of property '[Symbol.toStringTag]' are incompatible. +!!! error TS2322: Type '"UInt8Array"' is not assignable to type '"Int16Array"'. + arr_Int16Array = arr_Int16Array; + arr_Int16Array = arr_Uint16Array; + ~~~~~~~~~~~~~~ +!!! error TS2322: Type 'Uint16Array' is not assignable to type 'Int16Array'. +!!! error TS2322: Types of property '[Symbol.toStringTag]' are incompatible. +!!! error TS2322: Type '"Uint16Array"' is not assignable to type '"Int16Array"'. + arr_Int16Array = arr_Int32Array; + ~~~~~~~~~~~~~~ +!!! error TS2322: Type 'Int32Array' is not assignable to type 'Int16Array'. +!!! error TS2322: Types of property '[Symbol.toStringTag]' are incompatible. +!!! error TS2322: Type '"Int32Array"' is not assignable to type '"Int16Array"'. + arr_Int16Array = arr_Uint32Array; + ~~~~~~~~~~~~~~ +!!! error TS2322: Type 'Uint32Array' is not assignable to type 'Int16Array'. +!!! error TS2322: Types of property '[Symbol.toStringTag]' are incompatible. +!!! error TS2322: Type '"Uint32Array"' is not assignable to type '"Int16Array"'. + arr_Int16Array = arr_Float32Array; + ~~~~~~~~~~~~~~ +!!! error TS2322: Type 'Float32Array' is not assignable to type 'Int16Array'. +!!! error TS2322: Types of property '[Symbol.toStringTag]' are incompatible. +!!! error TS2322: Type '"Float32Array"' is not assignable to type '"Int16Array"'. + arr_Int16Array = arr_Float64Array; + ~~~~~~~~~~~~~~ +!!! error TS2322: Type 'Float64Array' is not assignable to type 'Int16Array'. +!!! error TS2322: Types of property '[Symbol.toStringTag]' are incompatible. +!!! error TS2322: Type '"Float64Array"' is not assignable to type '"Int16Array"'. + arr_Int16Array = arr_Uint8ClampedArray; + ~~~~~~~~~~~~~~ +!!! error TS2322: Type 'Uint8ClampedArray' is not assignable to type 'Int16Array'. +!!! error TS2322: Types of property '[Symbol.toStringTag]' are incompatible. +!!! error TS2322: Type '"Uint8ClampedArray"' is not assignable to type '"Int16Array"'. + + arr_Uint16Array = arr_Int8Array; + ~~~~~~~~~~~~~~~ +!!! error TS2322: Type 'Int8Array' is not assignable to type 'Uint16Array'. +!!! error TS2322: Types of property '[Symbol.toStringTag]' are incompatible. +!!! error TS2322: Type '"Int8Array"' is not assignable to type '"Uint16Array"'. + arr_Uint16Array = arr_Uint8Array; + ~~~~~~~~~~~~~~~ +!!! error TS2322: Type 'Uint8Array' is not assignable to type 'Uint16Array'. +!!! error TS2322: Types of property '[Symbol.toStringTag]' are incompatible. +!!! error TS2322: Type '"UInt8Array"' is not assignable to type '"Uint16Array"'. + arr_Uint16Array = arr_Int16Array; + ~~~~~~~~~~~~~~~ +!!! error TS2322: Type 'Int16Array' is not assignable to type 'Uint16Array'. +!!! error TS2322: Types of property '[Symbol.toStringTag]' are incompatible. +!!! error TS2322: Type '"Int16Array"' is not assignable to type '"Uint16Array"'. + arr_Uint16Array = arr_Uint16Array; + arr_Uint16Array = arr_Int32Array; + ~~~~~~~~~~~~~~~ +!!! error TS2322: Type 'Int32Array' is not assignable to type 'Uint16Array'. +!!! error TS2322: Types of property '[Symbol.toStringTag]' are incompatible. +!!! error TS2322: Type '"Int32Array"' is not assignable to type '"Uint16Array"'. + arr_Uint16Array = arr_Uint32Array; + ~~~~~~~~~~~~~~~ +!!! error TS2322: Type 'Uint32Array' is not assignable to type 'Uint16Array'. +!!! error TS2322: Types of property '[Symbol.toStringTag]' are incompatible. +!!! error TS2322: Type '"Uint32Array"' is not assignable to type '"Uint16Array"'. + arr_Uint16Array = arr_Float32Array; + ~~~~~~~~~~~~~~~ +!!! error TS2322: Type 'Float32Array' is not assignable to type 'Uint16Array'. +!!! error TS2322: Types of property '[Symbol.toStringTag]' are incompatible. +!!! error TS2322: Type '"Float32Array"' is not assignable to type '"Uint16Array"'. + arr_Uint16Array = arr_Float64Array; + ~~~~~~~~~~~~~~~ +!!! error TS2322: Type 'Float64Array' is not assignable to type 'Uint16Array'. +!!! error TS2322: Types of property '[Symbol.toStringTag]' are incompatible. +!!! error TS2322: Type '"Float64Array"' is not assignable to type '"Uint16Array"'. + arr_Uint16Array = arr_Uint8ClampedArray; + ~~~~~~~~~~~~~~~ +!!! error TS2322: Type 'Uint8ClampedArray' is not assignable to type 'Uint16Array'. +!!! error TS2322: Types of property '[Symbol.toStringTag]' are incompatible. +!!! error TS2322: Type '"Uint8ClampedArray"' is not assignable to type '"Uint16Array"'. + + arr_Int32Array = arr_Int8Array; + ~~~~~~~~~~~~~~ +!!! error TS2322: Type 'Int8Array' is not assignable to type 'Int32Array'. +!!! error TS2322: Types of property '[Symbol.toStringTag]' are incompatible. +!!! error TS2322: Type '"Int8Array"' is not assignable to type '"Int32Array"'. + arr_Int32Array = arr_Uint8Array; + ~~~~~~~~~~~~~~ +!!! error TS2322: Type 'Uint8Array' is not assignable to type 'Int32Array'. +!!! error TS2322: Types of property '[Symbol.toStringTag]' are incompatible. +!!! error TS2322: Type '"UInt8Array"' is not assignable to type '"Int32Array"'. + arr_Int32Array = arr_Int16Array; + ~~~~~~~~~~~~~~ +!!! error TS2322: Type 'Int16Array' is not assignable to type 'Int32Array'. +!!! error TS2322: Types of property '[Symbol.toStringTag]' are incompatible. +!!! error TS2322: Type '"Int16Array"' is not assignable to type '"Int32Array"'. + arr_Int32Array = arr_Uint16Array; + ~~~~~~~~~~~~~~ +!!! error TS2322: Type 'Uint16Array' is not assignable to type 'Int32Array'. +!!! error TS2322: Types of property '[Symbol.toStringTag]' are incompatible. +!!! error TS2322: Type '"Uint16Array"' is not assignable to type '"Int32Array"'. + arr_Int32Array = arr_Int32Array; + arr_Int32Array = arr_Uint32Array; + ~~~~~~~~~~~~~~ +!!! error TS2322: Type 'Uint32Array' is not assignable to type 'Int32Array'. +!!! error TS2322: Types of property '[Symbol.toStringTag]' are incompatible. +!!! error TS2322: Type '"Uint32Array"' is not assignable to type '"Int32Array"'. + arr_Int32Array = arr_Float32Array; + ~~~~~~~~~~~~~~ +!!! error TS2322: Type 'Float32Array' is not assignable to type 'Int32Array'. +!!! error TS2322: Types of property '[Symbol.toStringTag]' are incompatible. +!!! error TS2322: Type '"Float32Array"' is not assignable to type '"Int32Array"'. + arr_Int32Array = arr_Float64Array; + ~~~~~~~~~~~~~~ +!!! error TS2322: Type 'Float64Array' is not assignable to type 'Int32Array'. +!!! error TS2322: Types of property '[Symbol.toStringTag]' are incompatible. +!!! error TS2322: Type '"Float64Array"' is not assignable to type '"Int32Array"'. + arr_Int32Array = arr_Uint8ClampedArray; + ~~~~~~~~~~~~~~ +!!! error TS2322: Type 'Uint8ClampedArray' is not assignable to type 'Int32Array'. +!!! error TS2322: Types of property '[Symbol.toStringTag]' are incompatible. +!!! error TS2322: Type '"Uint8ClampedArray"' is not assignable to type '"Int32Array"'. + + arr_Float32Array = arr_Int8Array; + ~~~~~~~~~~~~~~~~ +!!! error TS2322: Type 'Int8Array' is not assignable to type 'Float32Array'. +!!! error TS2322: Types of property '[Symbol.toStringTag]' are incompatible. +!!! error TS2322: Type '"Int8Array"' is not assignable to type '"Float32Array"'. + arr_Float32Array = arr_Uint8Array; + ~~~~~~~~~~~~~~~~ +!!! error TS2322: Type 'Uint8Array' is not assignable to type 'Float32Array'. +!!! error TS2322: Types of property '[Symbol.toStringTag]' are incompatible. +!!! error TS2322: Type '"UInt8Array"' is not assignable to type '"Float32Array"'. + arr_Float32Array = arr_Int16Array; + ~~~~~~~~~~~~~~~~ +!!! error TS2322: Type 'Int16Array' is not assignable to type 'Float32Array'. +!!! error TS2322: Types of property '[Symbol.toStringTag]' are incompatible. +!!! error TS2322: Type '"Int16Array"' is not assignable to type '"Float32Array"'. + arr_Float32Array = arr_Uint16Array; + ~~~~~~~~~~~~~~~~ +!!! error TS2322: Type 'Uint16Array' is not assignable to type 'Float32Array'. +!!! error TS2322: Types of property '[Symbol.toStringTag]' are incompatible. +!!! error TS2322: Type '"Uint16Array"' is not assignable to type '"Float32Array"'. + arr_Float32Array = arr_Int32Array; + ~~~~~~~~~~~~~~~~ +!!! error TS2322: Type 'Int32Array' is not assignable to type 'Float32Array'. +!!! error TS2322: Types of property '[Symbol.toStringTag]' are incompatible. +!!! error TS2322: Type '"Int32Array"' is not assignable to type '"Float32Array"'. + arr_Float32Array = arr_Uint32Array; + ~~~~~~~~~~~~~~~~ +!!! error TS2322: Type 'Uint32Array' is not assignable to type 'Float32Array'. +!!! error TS2322: Types of property '[Symbol.toStringTag]' are incompatible. +!!! error TS2322: Type '"Uint32Array"' is not assignable to type '"Float32Array"'. + arr_Float32Array = arr_Float32Array; + arr_Float32Array = arr_Float64Array; + ~~~~~~~~~~~~~~~~ +!!! error TS2322: Type 'Float64Array' is not assignable to type 'Float32Array'. +!!! error TS2322: Types of property '[Symbol.toStringTag]' are incompatible. +!!! error TS2322: Type '"Float64Array"' is not assignable to type '"Float32Array"'. + arr_Float32Array = arr_Uint8ClampedArray; + ~~~~~~~~~~~~~~~~ +!!! error TS2322: Type 'Uint8ClampedArray' is not assignable to type 'Float32Array'. +!!! error TS2322: Types of property '[Symbol.toStringTag]' are incompatible. +!!! error TS2322: Type '"Uint8ClampedArray"' is not assignable to type '"Float32Array"'. + + arr_Float64Array = arr_Int8Array; + ~~~~~~~~~~~~~~~~ +!!! error TS2322: Type 'Int8Array' is not assignable to type 'Float64Array'. +!!! error TS2322: Types of property '[Symbol.toStringTag]' are incompatible. +!!! error TS2322: Type '"Int8Array"' is not assignable to type '"Float64Array"'. + arr_Float64Array = arr_Uint8Array; + ~~~~~~~~~~~~~~~~ +!!! error TS2322: Type 'Uint8Array' is not assignable to type 'Float64Array'. +!!! error TS2322: Types of property '[Symbol.toStringTag]' are incompatible. +!!! error TS2322: Type '"UInt8Array"' is not assignable to type '"Float64Array"'. + arr_Float64Array = arr_Int16Array; + ~~~~~~~~~~~~~~~~ +!!! error TS2322: Type 'Int16Array' is not assignable to type 'Float64Array'. +!!! error TS2322: Types of property '[Symbol.toStringTag]' are incompatible. +!!! error TS2322: Type '"Int16Array"' is not assignable to type '"Float64Array"'. + arr_Float64Array = arr_Uint16Array; + ~~~~~~~~~~~~~~~~ +!!! error TS2322: Type 'Uint16Array' is not assignable to type 'Float64Array'. +!!! error TS2322: Types of property '[Symbol.toStringTag]' are incompatible. +!!! error TS2322: Type '"Uint16Array"' is not assignable to type '"Float64Array"'. + arr_Float64Array = arr_Int32Array; + ~~~~~~~~~~~~~~~~ +!!! error TS2322: Type 'Int32Array' is not assignable to type 'Float64Array'. +!!! error TS2322: Types of property '[Symbol.toStringTag]' are incompatible. +!!! error TS2322: Type '"Int32Array"' is not assignable to type '"Float64Array"'. + arr_Float64Array = arr_Uint32Array; + ~~~~~~~~~~~~~~~~ +!!! error TS2322: Type 'Uint32Array' is not assignable to type 'Float64Array'. +!!! error TS2322: Types of property '[Symbol.toStringTag]' are incompatible. +!!! error TS2322: Type '"Uint32Array"' is not assignable to type '"Float64Array"'. + arr_Float64Array = arr_Float32Array; + ~~~~~~~~~~~~~~~~ +!!! error TS2322: Type 'Float32Array' is not assignable to type 'Float64Array'. +!!! error TS2322: Types of property '[Symbol.toStringTag]' are incompatible. +!!! error TS2322: Type '"Float32Array"' is not assignable to type '"Float64Array"'. + arr_Float64Array = arr_Float64Array; + arr_Float64Array = arr_Uint8ClampedArray; + ~~~~~~~~~~~~~~~~ +!!! error TS2322: Type 'Uint8ClampedArray' is not assignable to type 'Float64Array'. +!!! error TS2322: Types of property '[Symbol.toStringTag]' are incompatible. +!!! error TS2322: Type '"Uint8ClampedArray"' is not assignable to type '"Float64Array"'. + + arr_Uint8ClampedArray = arr_Int8Array; + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type 'Int8Array' is not assignable to type 'Uint8ClampedArray'. +!!! error TS2322: Types of property '[Symbol.toStringTag]' are incompatible. +!!! error TS2322: Type '"Int8Array"' is not assignable to type '"Uint8ClampedArray"'. + arr_Uint8ClampedArray = arr_Uint8Array; + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type 'Uint8Array' is not assignable to type 'Uint8ClampedArray'. +!!! error TS2322: Types of property '[Symbol.toStringTag]' are incompatible. +!!! error TS2322: Type '"UInt8Array"' is not assignable to type '"Uint8ClampedArray"'. + arr_Uint8ClampedArray = arr_Int16Array; + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type 'Int16Array' is not assignable to type 'Uint8ClampedArray'. +!!! error TS2322: Types of property '[Symbol.toStringTag]' are incompatible. +!!! error TS2322: Type '"Int16Array"' is not assignable to type '"Uint8ClampedArray"'. + arr_Uint8ClampedArray = arr_Uint16Array; + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type 'Uint16Array' is not assignable to type 'Uint8ClampedArray'. +!!! error TS2322: Types of property '[Symbol.toStringTag]' are incompatible. +!!! error TS2322: Type '"Uint16Array"' is not assignable to type '"Uint8ClampedArray"'. + arr_Uint8ClampedArray = arr_Int32Array; + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type 'Int32Array' is not assignable to type 'Uint8ClampedArray'. +!!! error TS2322: Types of property '[Symbol.toStringTag]' are incompatible. +!!! error TS2322: Type '"Int32Array"' is not assignable to type '"Uint8ClampedArray"'. + arr_Uint8ClampedArray = arr_Uint32Array; + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type 'Uint32Array' is not assignable to type 'Uint8ClampedArray'. +!!! error TS2322: Types of property '[Symbol.toStringTag]' are incompatible. +!!! error TS2322: Type '"Uint32Array"' is not assignable to type '"Uint8ClampedArray"'. + arr_Uint8ClampedArray = arr_Float32Array; + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type 'Float32Array' is not assignable to type 'Uint8ClampedArray'. +!!! error TS2322: Types of property '[Symbol.toStringTag]' are incompatible. +!!! error TS2322: Type '"Float32Array"' is not assignable to type '"Uint8ClampedArray"'. + arr_Uint8ClampedArray = arr_Float64Array; + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type 'Float64Array' is not assignable to type 'Uint8ClampedArray'. +!!! error TS2322: Types of property '[Symbol.toStringTag]' are incompatible. +!!! error TS2322: Type '"Float64Array"' is not assignable to type '"Uint8ClampedArray"'. + arr_Uint8ClampedArray = arr_Uint8ClampedArray; + + } + \ No newline at end of file diff --git a/tests/baselines/reference/typedArraysCrossAssignability01.js b/tests/baselines/reference/typedArraysCrossAssignability01.js new file mode 100644 index 00000000000..9572bfcaf59 --- /dev/null +++ b/tests/baselines/reference/typedArraysCrossAssignability01.js @@ -0,0 +1,180 @@ +//// [typedArraysCrossAssignability01.ts] + +function CheckAssignability() { + let arr_Int8Array = new Int8Array(1); + let arr_Uint8Array = new Uint8Array(1); + let arr_Int16Array = new Int16Array(1); + let arr_Uint16Array = new Uint16Array(1); + let arr_Int32Array = new Int32Array(1); + let arr_Uint32Array = new Uint32Array(1); + let arr_Float32Array = new Float32Array(1); + let arr_Float64Array = new Float64Array(1); + let arr_Uint8ClampedArray = new Uint8ClampedArray(1); + + arr_Int8Array = arr_Int8Array; + arr_Int8Array = arr_Uint8Array; + arr_Int8Array = arr_Int16Array; + arr_Int8Array = arr_Uint16Array; + arr_Int8Array = arr_Int32Array; + arr_Int8Array = arr_Uint32Array; + arr_Int8Array = arr_Float32Array; + arr_Int8Array = arr_Float64Array; + arr_Int8Array = arr_Uint8ClampedArray; + + arr_Uint8Array = arr_Int8Array; + arr_Uint8Array = arr_Uint8Array; + arr_Uint8Array = arr_Int16Array; + arr_Uint8Array = arr_Uint16Array; + arr_Uint8Array = arr_Int32Array; + arr_Uint8Array = arr_Uint32Array; + arr_Uint8Array = arr_Float32Array; + arr_Uint8Array = arr_Float64Array; + arr_Uint8Array = arr_Uint8ClampedArray; + + arr_Int16Array = arr_Int8Array; + arr_Int16Array = arr_Uint8Array; + arr_Int16Array = arr_Int16Array; + arr_Int16Array = arr_Uint16Array; + arr_Int16Array = arr_Int32Array; + arr_Int16Array = arr_Uint32Array; + arr_Int16Array = arr_Float32Array; + arr_Int16Array = arr_Float64Array; + arr_Int16Array = arr_Uint8ClampedArray; + + arr_Uint16Array = arr_Int8Array; + arr_Uint16Array = arr_Uint8Array; + arr_Uint16Array = arr_Int16Array; + arr_Uint16Array = arr_Uint16Array; + arr_Uint16Array = arr_Int32Array; + arr_Uint16Array = arr_Uint32Array; + arr_Uint16Array = arr_Float32Array; + arr_Uint16Array = arr_Float64Array; + arr_Uint16Array = arr_Uint8ClampedArray; + + arr_Int32Array = arr_Int8Array; + arr_Int32Array = arr_Uint8Array; + arr_Int32Array = arr_Int16Array; + arr_Int32Array = arr_Uint16Array; + arr_Int32Array = arr_Int32Array; + arr_Int32Array = arr_Uint32Array; + arr_Int32Array = arr_Float32Array; + arr_Int32Array = arr_Float64Array; + arr_Int32Array = arr_Uint8ClampedArray; + + arr_Float32Array = arr_Int8Array; + arr_Float32Array = arr_Uint8Array; + arr_Float32Array = arr_Int16Array; + arr_Float32Array = arr_Uint16Array; + arr_Float32Array = arr_Int32Array; + arr_Float32Array = arr_Uint32Array; + arr_Float32Array = arr_Float32Array; + arr_Float32Array = arr_Float64Array; + arr_Float32Array = arr_Uint8ClampedArray; + + arr_Float64Array = arr_Int8Array; + arr_Float64Array = arr_Uint8Array; + arr_Float64Array = arr_Int16Array; + arr_Float64Array = arr_Uint16Array; + arr_Float64Array = arr_Int32Array; + arr_Float64Array = arr_Uint32Array; + arr_Float64Array = arr_Float32Array; + arr_Float64Array = arr_Float64Array; + arr_Float64Array = arr_Uint8ClampedArray; + + arr_Uint8ClampedArray = arr_Int8Array; + arr_Uint8ClampedArray = arr_Uint8Array; + arr_Uint8ClampedArray = arr_Int16Array; + arr_Uint8ClampedArray = arr_Uint16Array; + arr_Uint8ClampedArray = arr_Int32Array; + arr_Uint8ClampedArray = arr_Uint32Array; + arr_Uint8ClampedArray = arr_Float32Array; + arr_Uint8ClampedArray = arr_Float64Array; + arr_Uint8ClampedArray = arr_Uint8ClampedArray; + +} + + +//// [typedArraysCrossAssignability01.js] +function CheckAssignability() { + let arr_Int8Array = new Int8Array(1); + let arr_Uint8Array = new Uint8Array(1); + let arr_Int16Array = new Int16Array(1); + let arr_Uint16Array = new Uint16Array(1); + let arr_Int32Array = new Int32Array(1); + let arr_Uint32Array = new Uint32Array(1); + let arr_Float32Array = new Float32Array(1); + let arr_Float64Array = new Float64Array(1); + let arr_Uint8ClampedArray = new Uint8ClampedArray(1); + arr_Int8Array = arr_Int8Array; + arr_Int8Array = arr_Uint8Array; + arr_Int8Array = arr_Int16Array; + arr_Int8Array = arr_Uint16Array; + arr_Int8Array = arr_Int32Array; + arr_Int8Array = arr_Uint32Array; + arr_Int8Array = arr_Float32Array; + arr_Int8Array = arr_Float64Array; + arr_Int8Array = arr_Uint8ClampedArray; + arr_Uint8Array = arr_Int8Array; + arr_Uint8Array = arr_Uint8Array; + arr_Uint8Array = arr_Int16Array; + arr_Uint8Array = arr_Uint16Array; + arr_Uint8Array = arr_Int32Array; + arr_Uint8Array = arr_Uint32Array; + arr_Uint8Array = arr_Float32Array; + arr_Uint8Array = arr_Float64Array; + arr_Uint8Array = arr_Uint8ClampedArray; + arr_Int16Array = arr_Int8Array; + arr_Int16Array = arr_Uint8Array; + arr_Int16Array = arr_Int16Array; + arr_Int16Array = arr_Uint16Array; + arr_Int16Array = arr_Int32Array; + arr_Int16Array = arr_Uint32Array; + arr_Int16Array = arr_Float32Array; + arr_Int16Array = arr_Float64Array; + arr_Int16Array = arr_Uint8ClampedArray; + arr_Uint16Array = arr_Int8Array; + arr_Uint16Array = arr_Uint8Array; + arr_Uint16Array = arr_Int16Array; + arr_Uint16Array = arr_Uint16Array; + arr_Uint16Array = arr_Int32Array; + arr_Uint16Array = arr_Uint32Array; + arr_Uint16Array = arr_Float32Array; + arr_Uint16Array = arr_Float64Array; + arr_Uint16Array = arr_Uint8ClampedArray; + arr_Int32Array = arr_Int8Array; + arr_Int32Array = arr_Uint8Array; + arr_Int32Array = arr_Int16Array; + arr_Int32Array = arr_Uint16Array; + arr_Int32Array = arr_Int32Array; + arr_Int32Array = arr_Uint32Array; + arr_Int32Array = arr_Float32Array; + arr_Int32Array = arr_Float64Array; + arr_Int32Array = arr_Uint8ClampedArray; + arr_Float32Array = arr_Int8Array; + arr_Float32Array = arr_Uint8Array; + arr_Float32Array = arr_Int16Array; + arr_Float32Array = arr_Uint16Array; + arr_Float32Array = arr_Int32Array; + arr_Float32Array = arr_Uint32Array; + arr_Float32Array = arr_Float32Array; + arr_Float32Array = arr_Float64Array; + arr_Float32Array = arr_Uint8ClampedArray; + arr_Float64Array = arr_Int8Array; + arr_Float64Array = arr_Uint8Array; + arr_Float64Array = arr_Int16Array; + arr_Float64Array = arr_Uint16Array; + arr_Float64Array = arr_Int32Array; + arr_Float64Array = arr_Uint32Array; + arr_Float64Array = arr_Float32Array; + arr_Float64Array = arr_Float64Array; + arr_Float64Array = arr_Uint8ClampedArray; + arr_Uint8ClampedArray = arr_Int8Array; + arr_Uint8ClampedArray = arr_Uint8Array; + arr_Uint8ClampedArray = arr_Int16Array; + arr_Uint8ClampedArray = arr_Uint16Array; + arr_Uint8ClampedArray = arr_Int32Array; + arr_Uint8ClampedArray = arr_Uint32Array; + arr_Uint8ClampedArray = arr_Float32Array; + arr_Uint8ClampedArray = arr_Float64Array; + arr_Uint8ClampedArray = arr_Uint8ClampedArray; +} diff --git a/tests/baselines/reference/typedGenericPrototypeMember.symbols b/tests/baselines/reference/typedGenericPrototypeMember.symbols index ee1d6a1c9f6..e733ea63bdf 100644 --- a/tests/baselines/reference/typedGenericPrototypeMember.symbols +++ b/tests/baselines/reference/typedGenericPrototypeMember.symbols @@ -4,7 +4,7 @@ class List { >T : Symbol(T, Decl(typedGenericPrototypeMember.ts, 0, 11)) add(item: T) { } ->add : Symbol(add, Decl(typedGenericPrototypeMember.ts, 0, 15)) +>add : Symbol(List.add, Decl(typedGenericPrototypeMember.ts, 0, 15)) >item : Symbol(item, Decl(typedGenericPrototypeMember.ts, 1, 7)) >T : Symbol(T, Decl(typedGenericPrototypeMember.ts, 0, 11)) } diff --git a/tests/baselines/reference/typeofANonExportedType.errors.txt b/tests/baselines/reference/typeofANonExportedType.errors.txt index 2399938dcfc..b54cbf74c66 100644 --- a/tests/baselines/reference/typeofANonExportedType.errors.txt +++ b/tests/baselines/reference/typeofANonExportedType.errors.txt @@ -1,14 +1,11 @@ -tests/cases/conformance/types/specifyingTypes/typeQueries/typeofANonExportedType.ts(2,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/conformance/types/specifyingTypes/typeQueries/typeofANonExportedType.ts(20,12): error TS2323: Cannot redeclare exported variable 'r5'. tests/cases/conformance/types/specifyingTypes/typeQueries/typeofANonExportedType.ts(21,12): error TS2323: Cannot redeclare exported variable 'r5'. tests/cases/conformance/types/specifyingTypes/typeQueries/typeofANonExportedType.ts(42,12): error TS2502: 'r12' is referenced directly or indirectly in its own type annotation. -==== tests/cases/conformance/types/specifyingTypes/typeQueries/typeofANonExportedType.ts (4 errors) ==== +==== tests/cases/conformance/types/specifyingTypes/typeQueries/typeofANonExportedType.ts (3 errors) ==== var x = 1; export var r1: typeof x; - ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. var y = { foo: '' }; export var r2: typeof y; class C { diff --git a/tests/baselines/reference/typeofAnExportedType.errors.txt b/tests/baselines/reference/typeofAnExportedType.errors.txt index 9740909bd59..520b8138ba5 100644 --- a/tests/baselines/reference/typeofAnExportedType.errors.txt +++ b/tests/baselines/reference/typeofAnExportedType.errors.txt @@ -1,13 +1,10 @@ -tests/cases/conformance/types/specifyingTypes/typeQueries/typeofAnExportedType.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/conformance/types/specifyingTypes/typeQueries/typeofAnExportedType.ts(20,12): error TS2323: Cannot redeclare exported variable 'r5'. tests/cases/conformance/types/specifyingTypes/typeQueries/typeofAnExportedType.ts(21,12): error TS2323: Cannot redeclare exported variable 'r5'. tests/cases/conformance/types/specifyingTypes/typeQueries/typeofAnExportedType.ts(42,12): error TS2502: 'r12' is referenced directly or indirectly in its own type annotation. -==== tests/cases/conformance/types/specifyingTypes/typeQueries/typeofAnExportedType.ts (4 errors) ==== +==== tests/cases/conformance/types/specifyingTypes/typeQueries/typeofAnExportedType.ts (3 errors) ==== export var x = 1; - ~~~~~~~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. export var r1: typeof x; export var y = { foo: '' }; export var r2: typeof y; diff --git a/tests/baselines/reference/typeofClass2.symbols b/tests/baselines/reference/typeofClass2.symbols index 9f06726d368..bd306596f66 100644 --- a/tests/baselines/reference/typeofClass2.symbols +++ b/tests/baselines/reference/typeofClass2.symbols @@ -38,7 +38,7 @@ class D extends C { >x : Symbol(x, Decl(typeofClass2.ts, 13, 15)) foo() { } ->foo : Symbol(foo, Decl(typeofClass2.ts, 13, 29)) +>foo : Symbol(D.foo, Decl(typeofClass2.ts, 13, 29)) } var d: D; diff --git a/tests/baselines/reference/typeofInterface.symbols b/tests/baselines/reference/typeofInterface.symbols index 9aa305e0a30..267b8c0926c 100644 --- a/tests/baselines/reference/typeofInterface.symbols +++ b/tests/baselines/reference/typeofInterface.symbols @@ -7,10 +7,10 @@ interface I { >I : Symbol(I, Decl(typeofInterface.ts, 0, 3), Decl(typeofInterface.ts, 0, 20)) I: number; ->I : Symbol(I, Decl(typeofInterface.ts, 2, 13)) +>I : Symbol(I.I, Decl(typeofInterface.ts, 2, 13)) foo: typeof I; ->foo : Symbol(foo, Decl(typeofInterface.ts, 3, 14)) +>foo : Symbol(I.foo, Decl(typeofInterface.ts, 3, 14)) >I : Symbol(I, Decl(typeofInterface.ts, 0, 3), Decl(typeofInterface.ts, 0, 20)) } diff --git a/tests/baselines/reference/typeofModuleWithoutExports.symbols b/tests/baselines/reference/typeofModuleWithoutExports.symbols index 7ad01e1eda7..747bff96bf5 100644 --- a/tests/baselines/reference/typeofModuleWithoutExports.symbols +++ b/tests/baselines/reference/typeofModuleWithoutExports.symbols @@ -9,7 +9,7 @@ module M { >C : Symbol(C, Decl(typeofModuleWithoutExports.ts, 1, 14)) foo: number; ->foo : Symbol(foo, Decl(typeofModuleWithoutExports.ts, 2, 13)) +>foo : Symbol(C.foo, Decl(typeofModuleWithoutExports.ts, 2, 13)) } } diff --git a/tests/baselines/reference/typeofOperatorWithAnyOtherType.errors.txt b/tests/baselines/reference/typeofOperatorWithAnyOtherType.errors.txt index 0139c96b3f9..f9394c622c0 100644 --- a/tests/baselines/reference/typeofOperatorWithAnyOtherType.errors.txt +++ b/tests/baselines/reference/typeofOperatorWithAnyOtherType.errors.txt @@ -4,9 +4,13 @@ tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperator tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithAnyOtherType.ts(68,1): error TS7028: Unused label. tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithAnyOtherType.ts(69,1): error TS7028: Unused label. tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithAnyOtherType.ts(70,1): error TS7028: Unused label. +tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithAnyOtherType.ts(71,1): error TS7028: Unused label. +tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithAnyOtherType.ts(72,1): error TS7028: Unused label. +tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithAnyOtherType.ts(73,1): error TS7028: Unused label. +tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithAnyOtherType.ts(74,1): error TS7028: Unused label. -==== tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithAnyOtherType.ts (6 errors) ==== +==== tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithAnyOtherType.ts (10 errors) ==== // typeof operator on any type var ANY: any; @@ -90,6 +94,14 @@ tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperator ~ !!! error TS7028: Unused label. z: typeof objA.a; + ~ +!!! error TS7028: Unused label. z: typeof A.foo; + ~ +!!! error TS7028: Unused label. z: typeof M.n; - z: typeof obj1.x; \ No newline at end of file + ~ +!!! error TS7028: Unused label. + z: typeof obj1.x; + ~ +!!! error TS7028: Unused label. \ No newline at end of file diff --git a/tests/baselines/reference/typeofOperatorWithBooleanType.symbols b/tests/baselines/reference/typeofOperatorWithBooleanType.symbols index 0167a14ae03..33589277e01 100644 --- a/tests/baselines/reference/typeofOperatorWithBooleanType.symbols +++ b/tests/baselines/reference/typeofOperatorWithBooleanType.symbols @@ -11,7 +11,7 @@ class A { >A : Symbol(A, Decl(typeofOperatorWithBooleanType.ts, 4, 40)) public a: boolean; ->a : Symbol(a, Decl(typeofOperatorWithBooleanType.ts, 6, 9)) +>a : Symbol(A.a, Decl(typeofOperatorWithBooleanType.ts, 6, 9)) static foo() { return false; } >foo : Symbol(A.foo, Decl(typeofOperatorWithBooleanType.ts, 7, 22)) diff --git a/tests/baselines/reference/typeofOperatorWithNumberType.symbols b/tests/baselines/reference/typeofOperatorWithNumberType.symbols index df49b7dccb6..b413c6e2af8 100644 --- a/tests/baselines/reference/typeofOperatorWithNumberType.symbols +++ b/tests/baselines/reference/typeofOperatorWithNumberType.symbols @@ -13,7 +13,7 @@ class A { >A : Symbol(A, Decl(typeofOperatorWithNumberType.ts, 4, 36)) public a: number; ->a : Symbol(a, Decl(typeofOperatorWithNumberType.ts, 6, 9)) +>a : Symbol(A.a, Decl(typeofOperatorWithNumberType.ts, 6, 9)) static foo() { return 1; } >foo : Symbol(A.foo, Decl(typeofOperatorWithNumberType.ts, 7, 21)) diff --git a/tests/baselines/reference/typeofOperatorWithStringType.errors.txt b/tests/baselines/reference/typeofOperatorWithStringType.errors.txt index 37b2cafab37..bd891c949a3 100644 --- a/tests/baselines/reference/typeofOperatorWithStringType.errors.txt +++ b/tests/baselines/reference/typeofOperatorWithStringType.errors.txt @@ -1,9 +1,13 @@ tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithStringType.ts(50,1): error TS7028: Unused label. tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithStringType.ts(51,1): error TS7028: Unused label. tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithStringType.ts(52,1): error TS7028: Unused label. +tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithStringType.ts(54,1): error TS7028: Unused label. +tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithStringType.ts(55,1): error TS7028: Unused label. +tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithStringType.ts(56,1): error TS7028: Unused label. +tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithStringType.ts(57,1): error TS7028: Unused label. -==== tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithStringType.ts (3 errors) ==== +==== tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithStringType.ts (7 errors) ==== // typeof operator on string type var STRING: string; var STRING1: string[] = ["", "abc"]; @@ -64,6 +68,14 @@ tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperator !!! error TS7028: Unused label. var y = { a: "", b: "" }; z: typeof y.a; + ~ +!!! error TS7028: Unused label. z: typeof objA.a; + ~ +!!! error TS7028: Unused label. z: typeof A.foo; - z: typeof M.n; \ No newline at end of file + ~ +!!! error TS7028: Unused label. + z: typeof M.n; + ~ +!!! error TS7028: Unused label. \ No newline at end of file diff --git a/tests/baselines/reference/typesWithOptionalProperty.symbols b/tests/baselines/reference/typesWithOptionalProperty.symbols index 9c546101099..07af97da644 100644 --- a/tests/baselines/reference/typesWithOptionalProperty.symbols +++ b/tests/baselines/reference/typesWithOptionalProperty.symbols @@ -5,13 +5,13 @@ interface I { >I : Symbol(I, Decl(typesWithOptionalProperty.ts, 0, 0)) foo: string; ->foo : Symbol(foo, Decl(typesWithOptionalProperty.ts, 2, 13)) +>foo : Symbol(I.foo, Decl(typesWithOptionalProperty.ts, 2, 13)) bar?: number; ->bar : Symbol(bar, Decl(typesWithOptionalProperty.ts, 3, 16)) +>bar : Symbol(I.bar, Decl(typesWithOptionalProperty.ts, 3, 16)) baz? (): string; ->baz : Symbol(baz, Decl(typesWithOptionalProperty.ts, 4, 17)) +>baz : Symbol(I.baz, Decl(typesWithOptionalProperty.ts, 4, 17)) } var a: { diff --git a/tests/baselines/reference/typesWithPrivateConstructor.errors.txt b/tests/baselines/reference/typesWithPrivateConstructor.errors.txt index 261038a1f4a..ab8ea4e26ad 100644 --- a/tests/baselines/reference/typesWithPrivateConstructor.errors.txt +++ b/tests/baselines/reference/typesWithPrivateConstructor.errors.txt @@ -1,36 +1,24 @@ -tests/cases/conformance/types/members/typesWithPrivateConstructor.ts(4,5): error TS1089: 'private' modifier cannot appear on a constructor declaration. -tests/cases/conformance/types/members/typesWithPrivateConstructor.ts(8,5): error TS2322: Type 'Function' is not assignable to type '() => void'. - Type 'Function' provides no match for the signature '(): void' -tests/cases/conformance/types/members/typesWithPrivateConstructor.ts(11,5): error TS1089: 'private' modifier cannot appear on a constructor declaration. -tests/cases/conformance/types/members/typesWithPrivateConstructor.ts(12,5): error TS1089: 'private' modifier cannot appear on a constructor declaration. -tests/cases/conformance/types/members/typesWithPrivateConstructor.ts(15,10): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/members/typesWithPrivateConstructor.ts(6,9): error TS2673: Constructor of class 'C' is private and only accessible within the class declaration. +tests/cases/conformance/types/members/typesWithPrivateConstructor.ts(14,10): error TS2673: Constructor of class 'C2' is private and only accessible within the class declaration. -==== tests/cases/conformance/types/members/typesWithPrivateConstructor.ts (5 errors) ==== - // private constructors are not allowed +==== tests/cases/conformance/types/members/typesWithPrivateConstructor.ts (2 errors) ==== class C { private constructor() { } - ~~~~~~~ -!!! error TS1089: 'private' modifier cannot appear on a constructor declaration. } - var c = new C(); + var c = new C(); // error C is private + ~~~~~~~ +!!! error TS2673: Constructor of class 'C' is private and only accessible within the class declaration. var r: () => void = c.constructor; - ~ -!!! error TS2322: Type 'Function' is not assignable to type '() => void'. -!!! error TS2322: Type 'Function' provides no match for the signature '(): void' class C2 { private constructor(x: number); - ~~~~~~~ -!!! error TS1089: 'private' modifier cannot appear on a constructor declaration. private constructor(x: any) { } - ~~~~~~~ -!!! error TS1089: 'private' modifier cannot appear on a constructor declaration. } - var c2 = new C2(); + var c2 = new C2(); // error C2 is private ~~~~~~~~ -!!! error TS2346: Supplied parameters do not match any signature of call target. +!!! error TS2673: Constructor of class 'C2' is private and only accessible within the class declaration. var r2: (x: number) => void = c2.constructor; \ No newline at end of file diff --git a/tests/baselines/reference/typesWithPrivateConstructor.js b/tests/baselines/reference/typesWithPrivateConstructor.js index d894eeda49a..1795ee6b316 100644 --- a/tests/baselines/reference/typesWithPrivateConstructor.js +++ b/tests/baselines/reference/typesWithPrivateConstructor.js @@ -1,11 +1,10 @@ //// [typesWithPrivateConstructor.ts] -// private constructors are not allowed class C { private constructor() { } } -var c = new C(); +var c = new C(); // error C is private var r: () => void = c.constructor; class C2 { @@ -13,22 +12,34 @@ class C2 { private constructor(x: any) { } } -var c2 = new C2(); +var c2 = new C2(); // error C2 is private var r2: (x: number) => void = c2.constructor; //// [typesWithPrivateConstructor.js] -// private constructors are not allowed var C = (function () { function C() { } return C; }()); -var c = new C(); +var c = new C(); // error C is private var r = c.constructor; var C2 = (function () { function C2(x) { } return C2; }()); -var c2 = new C2(); +var c2 = new C2(); // error C2 is private var r2 = c2.constructor; + + +//// [typesWithPrivateConstructor.d.ts] +declare class C { + private constructor(); +} +declare var c: any; +declare var r: () => void; +declare class C2 { + private constructor(x); +} +declare var c2: any; +declare var r2: (x: number) => void; diff --git a/tests/baselines/reference/typesWithProtectedConstructor.errors.txt b/tests/baselines/reference/typesWithProtectedConstructor.errors.txt new file mode 100644 index 00000000000..2a5a059f44d --- /dev/null +++ b/tests/baselines/reference/typesWithProtectedConstructor.errors.txt @@ -0,0 +1,24 @@ +tests/cases/conformance/types/members/typesWithProtectedConstructor.ts(6,9): error TS2674: Constructor of class 'C' is protected and only accessible within the class declaration. +tests/cases/conformance/types/members/typesWithProtectedConstructor.ts(14,10): error TS2674: Constructor of class 'C2' is protected and only accessible within the class declaration. + + +==== tests/cases/conformance/types/members/typesWithProtectedConstructor.ts (2 errors) ==== + + class C { + protected constructor() { } + } + + var c = new C(); // error C is protected + ~~~~~~~ +!!! error TS2674: Constructor of class 'C' is protected and only accessible within the class declaration. + var r: () => void = c.constructor; + + class C2 { + protected constructor(x: number); + protected constructor(x: any) { } + } + + var c2 = new C2(); // error C2 is protected + ~~~~~~~~ +!!! error TS2674: Constructor of class 'C2' is protected and only accessible within the class declaration. + var r2: (x: number) => void = c2.constructor; \ No newline at end of file diff --git a/tests/baselines/reference/typesWithProtectedConstructor.js b/tests/baselines/reference/typesWithProtectedConstructor.js new file mode 100644 index 00000000000..e75b3b6ecd3 --- /dev/null +++ b/tests/baselines/reference/typesWithProtectedConstructor.js @@ -0,0 +1,45 @@ +//// [typesWithProtectedConstructor.ts] + +class C { + protected constructor() { } +} + +var c = new C(); // error C is protected +var r: () => void = c.constructor; + +class C2 { + protected constructor(x: number); + protected constructor(x: any) { } +} + +var c2 = new C2(); // error C2 is protected +var r2: (x: number) => void = c2.constructor; + +//// [typesWithProtectedConstructor.js] +var C = (function () { + function C() { + } + return C; +}()); +var c = new C(); // error C is protected +var r = c.constructor; +var C2 = (function () { + function C2(x) { + } + return C2; +}()); +var c2 = new C2(); // error C2 is protected +var r2 = c2.constructor; + + +//// [typesWithProtectedConstructor.d.ts] +declare class C { + protected constructor(); +} +declare var c: any; +declare var r: () => void; +declare class C2 { + protected constructor(x: number); +} +declare var c2: any; +declare var r2: (x: number) => void; diff --git a/tests/baselines/reference/typesWithSpecializedCallSignatures.symbols b/tests/baselines/reference/typesWithSpecializedCallSignatures.symbols index 87aa18e3564..f51f9322913 100644 --- a/tests/baselines/reference/typesWithSpecializedCallSignatures.symbols +++ b/tests/baselines/reference/typesWithSpecializedCallSignatures.symbols @@ -3,38 +3,38 @@ class Base { foo: string } >Base : Symbol(Base, Decl(typesWithSpecializedCallSignatures.ts, 0, 0)) ->foo : Symbol(foo, Decl(typesWithSpecializedCallSignatures.ts, 2, 12)) +>foo : Symbol(Base.foo, Decl(typesWithSpecializedCallSignatures.ts, 2, 12)) class Derived1 extends Base { bar: string } >Derived1 : Symbol(Derived1, Decl(typesWithSpecializedCallSignatures.ts, 2, 26)) >Base : Symbol(Base, Decl(typesWithSpecializedCallSignatures.ts, 0, 0)) ->bar : Symbol(bar, Decl(typesWithSpecializedCallSignatures.ts, 3, 29)) +>bar : Symbol(Derived1.bar, Decl(typesWithSpecializedCallSignatures.ts, 3, 29)) class Derived2 extends Base { baz: string } >Derived2 : Symbol(Derived2, Decl(typesWithSpecializedCallSignatures.ts, 3, 43)) >Base : Symbol(Base, Decl(typesWithSpecializedCallSignatures.ts, 0, 0)) ->baz : Symbol(baz, Decl(typesWithSpecializedCallSignatures.ts, 4, 29)) +>baz : Symbol(Derived2.baz, Decl(typesWithSpecializedCallSignatures.ts, 4, 29)) class C { >C : Symbol(C, Decl(typesWithSpecializedCallSignatures.ts, 4, 43)) foo(x: 'hi'): Derived1; ->foo : Symbol(foo, Decl(typesWithSpecializedCallSignatures.ts, 6, 9), Decl(typesWithSpecializedCallSignatures.ts, 7, 27), Decl(typesWithSpecializedCallSignatures.ts, 8, 28), Decl(typesWithSpecializedCallSignatures.ts, 9, 25)) +>foo : Symbol(C.foo, Decl(typesWithSpecializedCallSignatures.ts, 6, 9), Decl(typesWithSpecializedCallSignatures.ts, 7, 27), Decl(typesWithSpecializedCallSignatures.ts, 8, 28), Decl(typesWithSpecializedCallSignatures.ts, 9, 25)) >x : Symbol(x, Decl(typesWithSpecializedCallSignatures.ts, 7, 8)) >Derived1 : Symbol(Derived1, Decl(typesWithSpecializedCallSignatures.ts, 2, 26)) foo(x: 'bye'): Derived2; ->foo : Symbol(foo, Decl(typesWithSpecializedCallSignatures.ts, 6, 9), Decl(typesWithSpecializedCallSignatures.ts, 7, 27), Decl(typesWithSpecializedCallSignatures.ts, 8, 28), Decl(typesWithSpecializedCallSignatures.ts, 9, 25)) +>foo : Symbol(C.foo, Decl(typesWithSpecializedCallSignatures.ts, 6, 9), Decl(typesWithSpecializedCallSignatures.ts, 7, 27), Decl(typesWithSpecializedCallSignatures.ts, 8, 28), Decl(typesWithSpecializedCallSignatures.ts, 9, 25)) >x : Symbol(x, Decl(typesWithSpecializedCallSignatures.ts, 8, 8)) >Derived2 : Symbol(Derived2, Decl(typesWithSpecializedCallSignatures.ts, 3, 43)) foo(x: string): Base; ->foo : Symbol(foo, Decl(typesWithSpecializedCallSignatures.ts, 6, 9), Decl(typesWithSpecializedCallSignatures.ts, 7, 27), Decl(typesWithSpecializedCallSignatures.ts, 8, 28), Decl(typesWithSpecializedCallSignatures.ts, 9, 25)) +>foo : Symbol(C.foo, Decl(typesWithSpecializedCallSignatures.ts, 6, 9), Decl(typesWithSpecializedCallSignatures.ts, 7, 27), Decl(typesWithSpecializedCallSignatures.ts, 8, 28), Decl(typesWithSpecializedCallSignatures.ts, 9, 25)) >x : Symbol(x, Decl(typesWithSpecializedCallSignatures.ts, 9, 8)) >Base : Symbol(Base, Decl(typesWithSpecializedCallSignatures.ts, 0, 0)) foo(x) { ->foo : Symbol(foo, Decl(typesWithSpecializedCallSignatures.ts, 6, 9), Decl(typesWithSpecializedCallSignatures.ts, 7, 27), Decl(typesWithSpecializedCallSignatures.ts, 8, 28), Decl(typesWithSpecializedCallSignatures.ts, 9, 25)) +>foo : Symbol(C.foo, Decl(typesWithSpecializedCallSignatures.ts, 6, 9), Decl(typesWithSpecializedCallSignatures.ts, 7, 27), Decl(typesWithSpecializedCallSignatures.ts, 8, 28), Decl(typesWithSpecializedCallSignatures.ts, 9, 25)) >x : Symbol(x, Decl(typesWithSpecializedCallSignatures.ts, 10, 8)) return x; @@ -49,17 +49,17 @@ interface I { >I : Symbol(I, Decl(typesWithSpecializedCallSignatures.ts, 14, 16)) foo(x: 'hi'): Derived1; ->foo : Symbol(foo, Decl(typesWithSpecializedCallSignatures.ts, 16, 13), Decl(typesWithSpecializedCallSignatures.ts, 17, 27), Decl(typesWithSpecializedCallSignatures.ts, 18, 28)) +>foo : Symbol(I.foo, Decl(typesWithSpecializedCallSignatures.ts, 16, 13), Decl(typesWithSpecializedCallSignatures.ts, 17, 27), Decl(typesWithSpecializedCallSignatures.ts, 18, 28)) >x : Symbol(x, Decl(typesWithSpecializedCallSignatures.ts, 17, 8)) >Derived1 : Symbol(Derived1, Decl(typesWithSpecializedCallSignatures.ts, 2, 26)) foo(x: 'bye'): Derived2; ->foo : Symbol(foo, Decl(typesWithSpecializedCallSignatures.ts, 16, 13), Decl(typesWithSpecializedCallSignatures.ts, 17, 27), Decl(typesWithSpecializedCallSignatures.ts, 18, 28)) +>foo : Symbol(I.foo, Decl(typesWithSpecializedCallSignatures.ts, 16, 13), Decl(typesWithSpecializedCallSignatures.ts, 17, 27), Decl(typesWithSpecializedCallSignatures.ts, 18, 28)) >x : Symbol(x, Decl(typesWithSpecializedCallSignatures.ts, 18, 8)) >Derived2 : Symbol(Derived2, Decl(typesWithSpecializedCallSignatures.ts, 3, 43)) foo(x: string): Base; ->foo : Symbol(foo, Decl(typesWithSpecializedCallSignatures.ts, 16, 13), Decl(typesWithSpecializedCallSignatures.ts, 17, 27), Decl(typesWithSpecializedCallSignatures.ts, 18, 28)) +>foo : Symbol(I.foo, Decl(typesWithSpecializedCallSignatures.ts, 16, 13), Decl(typesWithSpecializedCallSignatures.ts, 17, 27), Decl(typesWithSpecializedCallSignatures.ts, 18, 28)) >x : Symbol(x, Decl(typesWithSpecializedCallSignatures.ts, 19, 8)) >Base : Symbol(Base, Decl(typesWithSpecializedCallSignatures.ts, 0, 0)) } diff --git a/tests/baselines/reference/typesWithSpecializedConstructSignatures.symbols b/tests/baselines/reference/typesWithSpecializedConstructSignatures.symbols index 428be5f7438..1adb4e6d96c 100644 --- a/tests/baselines/reference/typesWithSpecializedConstructSignatures.symbols +++ b/tests/baselines/reference/typesWithSpecializedConstructSignatures.symbols @@ -3,17 +3,17 @@ class Base { foo: string } >Base : Symbol(Base, Decl(typesWithSpecializedConstructSignatures.ts, 0, 0)) ->foo : Symbol(foo, Decl(typesWithSpecializedConstructSignatures.ts, 2, 12)) +>foo : Symbol(Base.foo, Decl(typesWithSpecializedConstructSignatures.ts, 2, 12)) class Derived1 extends Base { bar: string } >Derived1 : Symbol(Derived1, Decl(typesWithSpecializedConstructSignatures.ts, 2, 26)) >Base : Symbol(Base, Decl(typesWithSpecializedConstructSignatures.ts, 0, 0)) ->bar : Symbol(bar, Decl(typesWithSpecializedConstructSignatures.ts, 3, 29)) +>bar : Symbol(Derived1.bar, Decl(typesWithSpecializedConstructSignatures.ts, 3, 29)) class Derived2 extends Base { baz: string } >Derived2 : Symbol(Derived2, Decl(typesWithSpecializedConstructSignatures.ts, 3, 43)) >Base : Symbol(Base, Decl(typesWithSpecializedConstructSignatures.ts, 0, 0)) ->baz : Symbol(baz, Decl(typesWithSpecializedConstructSignatures.ts, 4, 29)) +>baz : Symbol(Derived2.baz, Decl(typesWithSpecializedConstructSignatures.ts, 4, 29)) class C { >C : Symbol(C, Decl(typesWithSpecializedConstructSignatures.ts, 4, 43)) diff --git a/tests/baselines/reference/umd-augmentation-1.js b/tests/baselines/reference/umd-augmentation-1.js new file mode 100644 index 00000000000..b3ffcf670a8 --- /dev/null +++ b/tests/baselines/reference/umd-augmentation-1.js @@ -0,0 +1,50 @@ +//// [tests/cases/conformance/externalModules/umd-augmentation-1.ts] //// + +//// [index.d.ts] + +export as namespace Math2d; + +export interface Point { + x: number; + y: number; +} + +export class Vector implements Point { + x: number; + y: number; + constructor(x: number, y: number); + + translate(dx: number, dy: number): Vector; +} + +export function getLength(p: Vector): number; + +//// [math2d-augment.d.ts] +import * as Math2d from 'math2d'; +// Augment the module +declare module 'math2d' { + // Add a method to the class + interface Vector { + reverse(): Math2d.Point; + } +} + +//// [b.ts] +/// +import * as m from 'math2d'; +let v = new m.Vector(3, 2); +let magnitude = m.getLength(v); +let p: m.Point = v.translate(5, 5); +p = v.reverse(); +var t = p.x; + + +//// [b.js] +"use strict"; +/// +var m = require('math2d'); +var v = new m.Vector(3, 2); +var magnitude = m.getLength(v); +var p = v.translate(5, 5); +p = v.reverse(); +var t = p.x; diff --git a/tests/baselines/reference/umd-augmentation-1.symbols b/tests/baselines/reference/umd-augmentation-1.symbols new file mode 100644 index 00000000000..645511350a9 --- /dev/null +++ b/tests/baselines/reference/umd-augmentation-1.symbols @@ -0,0 +1,95 @@ +=== tests/cases/conformance/externalModules/b.ts === +/// +import * as m from 'math2d'; +>m : Symbol(m, Decl(b.ts, 1, 6)) + +let v = new m.Vector(3, 2); +>v : Symbol(v, Decl(b.ts, 2, 3)) +>m.Vector : Symbol(m.Vector, Decl(index.d.ts, 6, 1), Decl(math2d-augment.d.ts, 2, 25)) +>m : Symbol(m, Decl(b.ts, 1, 6)) +>Vector : Symbol(m.Vector, Decl(index.d.ts, 6, 1), Decl(math2d-augment.d.ts, 2, 25)) + +let magnitude = m.getLength(v); +>magnitude : Symbol(magnitude, Decl(b.ts, 3, 3)) +>m.getLength : Symbol(m.getLength, Decl(index.d.ts, 14, 1)) +>m : Symbol(m, Decl(b.ts, 1, 6)) +>getLength : Symbol(m.getLength, Decl(index.d.ts, 14, 1)) +>v : Symbol(v, Decl(b.ts, 2, 3)) + +let p: m.Point = v.translate(5, 5); +>p : Symbol(p, Decl(b.ts, 4, 3)) +>m : Symbol(m, Decl(b.ts, 1, 6)) +>Point : Symbol(m.Point, Decl(index.d.ts, 1, 27)) +>v.translate : Symbol(m.Vector.translate, Decl(index.d.ts, 11, 35)) +>v : Symbol(v, Decl(b.ts, 2, 3)) +>translate : Symbol(m.Vector.translate, Decl(index.d.ts, 11, 35)) + +p = v.reverse(); +>p : Symbol(p, Decl(b.ts, 4, 3)) +>v.reverse : Symbol(m.Vector.reverse, Decl(math2d-augment.d.ts, 4, 19)) +>v : Symbol(v, Decl(b.ts, 2, 3)) +>reverse : Symbol(m.Vector.reverse, Decl(math2d-augment.d.ts, 4, 19)) + +var t = p.x; +>t : Symbol(t, Decl(b.ts, 6, 3)) +>p.x : Symbol(m.Point.x, Decl(index.d.ts, 3, 24)) +>p : Symbol(p, Decl(b.ts, 4, 3)) +>x : Symbol(m.Point.x, Decl(index.d.ts, 3, 24)) + +=== tests/cases/conformance/externalModules/node_modules/math2d/index.d.ts === + +export as namespace Math2d; + +export interface Point { +>Point : Symbol(Point, Decl(index.d.ts, 1, 27)) + + x: number; +>x : Symbol(Point.x, Decl(index.d.ts, 3, 24)) + + y: number; +>y : Symbol(Point.y, Decl(index.d.ts, 4, 11)) +} + +export class Vector implements Point { +>Vector : Symbol(Vector, Decl(index.d.ts, 6, 1), Decl(math2d-augment.d.ts, 2, 25)) +>Point : Symbol(Point, Decl(index.d.ts, 1, 27)) + + x: number; +>x : Symbol(Vector.x, Decl(index.d.ts, 8, 38)) + + y: number; +>y : Symbol(Vector.y, Decl(index.d.ts, 9, 11)) + + constructor(x: number, y: number); +>x : Symbol(x, Decl(index.d.ts, 11, 13)) +>y : Symbol(y, Decl(index.d.ts, 11, 23)) + + translate(dx: number, dy: number): Vector; +>translate : Symbol(Vector.translate, Decl(index.d.ts, 11, 35)) +>dx : Symbol(dx, Decl(index.d.ts, 13, 11)) +>dy : Symbol(dy, Decl(index.d.ts, 13, 22)) +>Vector : Symbol(Vector, Decl(index.d.ts, 6, 1), Decl(math2d-augment.d.ts, 2, 25)) +} + +export function getLength(p: Vector): number; +>getLength : Symbol(getLength, Decl(index.d.ts, 14, 1)) +>p : Symbol(p, Decl(index.d.ts, 16, 26)) +>Vector : Symbol(Vector, Decl(index.d.ts, 6, 1), Decl(math2d-augment.d.ts, 2, 25)) + +=== tests/cases/conformance/externalModules/math2d-augment.d.ts === +import * as Math2d from 'math2d'; +>Math2d : Symbol(Math2d, Decl(math2d-augment.d.ts, 0, 6)) + +// Augment the module +declare module 'math2d' { + // Add a method to the class + interface Vector { +>Vector : Symbol(Vector, Decl(index.d.ts, 6, 1), Decl(math2d-augment.d.ts, 2, 25)) + + reverse(): Math2d.Point; +>reverse : Symbol(Vector.reverse, Decl(math2d-augment.d.ts, 4, 19)) +>Math2d : Symbol(Math2d, Decl(math2d-augment.d.ts, 0, 6)) +>Point : Symbol(Point, Decl(index.d.ts, 1, 27)) + } +} + diff --git a/tests/baselines/reference/umd-augmentation-1.types b/tests/baselines/reference/umd-augmentation-1.types new file mode 100644 index 00000000000..31ac43fe855 --- /dev/null +++ b/tests/baselines/reference/umd-augmentation-1.types @@ -0,0 +1,105 @@ +=== tests/cases/conformance/externalModules/b.ts === +/// +import * as m from 'math2d'; +>m : typeof m + +let v = new m.Vector(3, 2); +>v : m.Vector +>new m.Vector(3, 2) : m.Vector +>m.Vector : typeof m.Vector +>m : typeof m +>Vector : typeof m.Vector +>3 : number +>2 : number + +let magnitude = m.getLength(v); +>magnitude : number +>m.getLength(v) : number +>m.getLength : (p: m.Vector) => number +>m : typeof m +>getLength : (p: m.Vector) => number +>v : m.Vector + +let p: m.Point = v.translate(5, 5); +>p : m.Point +>m : any +>Point : m.Point +>v.translate(5, 5) : m.Vector +>v.translate : (dx: number, dy: number) => m.Vector +>v : m.Vector +>translate : (dx: number, dy: number) => m.Vector +>5 : number +>5 : number + +p = v.reverse(); +>p = v.reverse() : m.Point +>p : m.Point +>v.reverse() : m.Point +>v.reverse : () => m.Point +>v : m.Vector +>reverse : () => m.Point + +var t = p.x; +>t : number +>p.x : number +>p : m.Point +>x : number + +=== tests/cases/conformance/externalModules/node_modules/math2d/index.d.ts === + +export as namespace Math2d; +>Math2d : any + +export interface Point { +>Point : Point + + x: number; +>x : number + + y: number; +>y : number +} + +export class Vector implements Point { +>Vector : Vector +>Point : Point + + x: number; +>x : number + + y: number; +>y : number + + constructor(x: number, y: number); +>x : number +>y : number + + translate(dx: number, dy: number): Vector; +>translate : (dx: number, dy: number) => Vector +>dx : number +>dy : number +>Vector : Vector +} + +export function getLength(p: Vector): number; +>getLength : (p: Vector) => number +>p : Vector +>Vector : Vector + +=== tests/cases/conformance/externalModules/math2d-augment.d.ts === +import * as Math2d from 'math2d'; +>Math2d : typeof Math2d + +// Augment the module +declare module 'math2d' { + // Add a method to the class + interface Vector { +>Vector : Vector + + reverse(): Math2d.Point; +>reverse : () => Point +>Math2d : any +>Point : Point + } +} + diff --git a/tests/baselines/reference/umd-augmentation-2.js b/tests/baselines/reference/umd-augmentation-2.js new file mode 100644 index 00000000000..a4a98690b52 --- /dev/null +++ b/tests/baselines/reference/umd-augmentation-2.js @@ -0,0 +1,49 @@ +//// [tests/cases/conformance/externalModules/umd-augmentation-2.ts] //// + +//// [index.d.ts] + +export as namespace Math2d; + +export interface Point { + x: number; + y: number; +} + +export class Vector implements Point { + x: number; + y: number; + constructor(x: number, y: number); + + translate(dx: number, dy: number): Vector; +} + +export function getLength(p: Vector): number; + +//// [math2d-augment.d.ts] +import * as Math2d from 'math2d'; +// Augment the module +declare module 'math2d' { + // Add a method to the class + interface Vector { + reverse(): Math2d.Point; + } +} + +//// [a.ts] +/// +/// +let v = new Math2d.Vector(3, 2); +let magnitude = Math2d.getLength(v); +let p: Math2d.Point = v.translate(5, 5); +p = v.reverse(); +var t = p.x; + + +//// [a.js] +/// +/// +var v = new exports.Math2d.Vector(3, 2); +var magnitude = exports.Math2d.getLength(v); +var p = v.translate(5, 5); +p = v.reverse(); +var t = p.x; diff --git a/tests/baselines/reference/umd-augmentation-2.symbols b/tests/baselines/reference/umd-augmentation-2.symbols new file mode 100644 index 00000000000..bd6584d3d74 --- /dev/null +++ b/tests/baselines/reference/umd-augmentation-2.symbols @@ -0,0 +1,93 @@ +=== tests/cases/conformance/externalModules/a.ts === +/// +/// +let v = new Math2d.Vector(3, 2); +>v : Symbol(v, Decl(a.ts, 2, 3)) +>Math2d.Vector : Symbol(Math2d.Vector, Decl(index.d.ts, 6, 1)) +>Math2d : Symbol(Math2d, Decl(index.d.ts, 0, 0)) +>Vector : Symbol(Math2d.Vector, Decl(index.d.ts, 6, 1)) + +let magnitude = Math2d.getLength(v); +>magnitude : Symbol(magnitude, Decl(a.ts, 3, 3)) +>Math2d.getLength : Symbol(Math2d.getLength, Decl(index.d.ts, 14, 1)) +>Math2d : Symbol(Math2d, Decl(index.d.ts, 0, 0)) +>getLength : Symbol(Math2d.getLength, Decl(index.d.ts, 14, 1)) +>v : Symbol(v, Decl(a.ts, 2, 3)) + +let p: Math2d.Point = v.translate(5, 5); +>p : Symbol(p, Decl(a.ts, 4, 3)) +>Math2d : Symbol(Math2d, Decl(index.d.ts, 0, 0)) +>Point : Symbol(Math2d.Point, Decl(index.d.ts, 1, 27)) +>v.translate : Symbol(Vector.translate, Decl(index.d.ts, 11, 35)) +>v : Symbol(v, Decl(a.ts, 2, 3)) +>translate : Symbol(Vector.translate, Decl(index.d.ts, 11, 35)) + +p = v.reverse(); +>p : Symbol(p, Decl(a.ts, 4, 3)) +>v.reverse : Symbol(Vector.reverse, Decl(math2d-augment.d.ts, 4, 19)) +>v : Symbol(v, Decl(a.ts, 2, 3)) +>reverse : Symbol(Vector.reverse, Decl(math2d-augment.d.ts, 4, 19)) + +var t = p.x; +>t : Symbol(t, Decl(a.ts, 6, 3)) +>p.x : Symbol(Math2d.Point.x, Decl(index.d.ts, 3, 24)) +>p : Symbol(p, Decl(a.ts, 4, 3)) +>x : Symbol(Math2d.Point.x, Decl(index.d.ts, 3, 24)) + +=== tests/cases/conformance/externalModules/node_modules/math2d/index.d.ts === + +export as namespace Math2d; + +export interface Point { +>Point : Symbol(Point, Decl(index.d.ts, 1, 27)) + + x: number; +>x : Symbol(Point.x, Decl(index.d.ts, 3, 24)) + + y: number; +>y : Symbol(Point.y, Decl(index.d.ts, 4, 11)) +} + +export class Vector implements Point { +>Vector : Symbol(Vector, Decl(index.d.ts, 6, 1), Decl(math2d-augment.d.ts, 2, 25)) +>Point : Symbol(Point, Decl(index.d.ts, 1, 27)) + + x: number; +>x : Symbol(Vector.x, Decl(index.d.ts, 8, 38)) + + y: number; +>y : Symbol(Vector.y, Decl(index.d.ts, 9, 11)) + + constructor(x: number, y: number); +>x : Symbol(x, Decl(index.d.ts, 11, 13)) +>y : Symbol(y, Decl(index.d.ts, 11, 23)) + + translate(dx: number, dy: number): Vector; +>translate : Symbol(Vector.translate, Decl(index.d.ts, 11, 35)) +>dx : Symbol(dx, Decl(index.d.ts, 13, 11)) +>dy : Symbol(dy, Decl(index.d.ts, 13, 22)) +>Vector : Symbol(Vector, Decl(index.d.ts, 6, 1), Decl(math2d-augment.d.ts, 2, 25)) +} + +export function getLength(p: Vector): number; +>getLength : Symbol(getLength, Decl(index.d.ts, 14, 1)) +>p : Symbol(p, Decl(index.d.ts, 16, 26)) +>Vector : Symbol(Vector, Decl(index.d.ts, 6, 1), Decl(math2d-augment.d.ts, 2, 25)) + +=== tests/cases/conformance/externalModules/math2d-augment.d.ts === +import * as Math2d from 'math2d'; +>Math2d : Symbol(Math2d, Decl(math2d-augment.d.ts, 0, 6)) + +// Augment the module +declare module 'math2d' { + // Add a method to the class + interface Vector { +>Vector : Symbol(Vector, Decl(index.d.ts, 6, 1), Decl(math2d-augment.d.ts, 2, 25)) + + reverse(): Math2d.Point; +>reverse : Symbol(Vector.reverse, Decl(math2d-augment.d.ts, 4, 19)) +>Math2d : Symbol(Math2d, Decl(math2d-augment.d.ts, 0, 6)) +>Point : Symbol(Point, Decl(index.d.ts, 1, 27)) + } +} + diff --git a/tests/baselines/reference/umd-augmentation-2.types b/tests/baselines/reference/umd-augmentation-2.types new file mode 100644 index 00000000000..20bba091903 --- /dev/null +++ b/tests/baselines/reference/umd-augmentation-2.types @@ -0,0 +1,103 @@ +=== tests/cases/conformance/externalModules/a.ts === +/// +/// +let v = new Math2d.Vector(3, 2); +>v : Vector +>new Math2d.Vector(3, 2) : Vector +>Math2d.Vector : typeof Math2d.Vector +>Math2d : typeof Math2d +>Vector : typeof Math2d.Vector +>3 : number +>2 : number + +let magnitude = Math2d.getLength(v); +>magnitude : number +>Math2d.getLength(v) : number +>Math2d.getLength : (p: Vector) => number +>Math2d : typeof Math2d +>getLength : (p: Vector) => number +>v : Vector + +let p: Math2d.Point = v.translate(5, 5); +>p : Math2d.Point +>Math2d : any +>Point : Math2d.Point +>v.translate(5, 5) : Vector +>v.translate : (dx: number, dy: number) => Vector +>v : Vector +>translate : (dx: number, dy: number) => Vector +>5 : number +>5 : number + +p = v.reverse(); +>p = v.reverse() : Math2d.Point +>p : Math2d.Point +>v.reverse() : Math2d.Point +>v.reverse : () => Math2d.Point +>v : Vector +>reverse : () => Math2d.Point + +var t = p.x; +>t : number +>p.x : number +>p : Math2d.Point +>x : number + +=== tests/cases/conformance/externalModules/node_modules/math2d/index.d.ts === + +export as namespace Math2d; +>Math2d : any + +export interface Point { +>Point : Point + + x: number; +>x : number + + y: number; +>y : number +} + +export class Vector implements Point { +>Vector : Vector +>Point : Point + + x: number; +>x : number + + y: number; +>y : number + + constructor(x: number, y: number); +>x : number +>y : number + + translate(dx: number, dy: number): Vector; +>translate : (dx: number, dy: number) => Vector +>dx : number +>dy : number +>Vector : Vector +} + +export function getLength(p: Vector): number; +>getLength : (p: Vector) => number +>p : Vector +>Vector : Vector + +=== tests/cases/conformance/externalModules/math2d-augment.d.ts === +import * as Math2d from 'math2d'; +>Math2d : typeof Math2d + +// Augment the module +declare module 'math2d' { + // Add a method to the class + interface Vector { +>Vector : Vector + + reverse(): Math2d.Point; +>reverse : () => Point +>Math2d : any +>Point : Point + } +} + diff --git a/tests/baselines/reference/umd-augmentation-3.js b/tests/baselines/reference/umd-augmentation-3.js new file mode 100644 index 00000000000..2b8eac7bf63 --- /dev/null +++ b/tests/baselines/reference/umd-augmentation-3.js @@ -0,0 +1,56 @@ +//// [tests/cases/conformance/externalModules/umd-augmentation-3.ts] //// + +//// [index.d.ts] + +export as namespace Math2d; + +export = M2D; + +declare namespace M2D { + interface Point { + x: number; + y: number; + } + + class Vector implements Point { + x: number; + y: number; + constructor(x: number, y: number); + + translate(dx: number, dy: number): Vector; + } + + function getLength(p: Vector): number; + +} + + +//// [math2d-augment.d.ts] +import * as Math2d from 'math2d'; +// Augment the module +declare module 'math2d' { + // Add a method to the class + interface Vector { + reverse(): Math2d.Point; + } +} + +//// [b.ts] +/// +import * as m from 'math2d'; +let v = new m.Vector(3, 2); +let magnitude = m.getLength(v); +let p: m.Point = v.translate(5, 5); +p = v.reverse(); +var t = p.x; + + +//// [b.js] +"use strict"; +/// +var m = require('math2d'); +var v = new m.Vector(3, 2); +var magnitude = m.getLength(v); +var p = v.translate(5, 5); +p = v.reverse(); +var t = p.x; diff --git a/tests/baselines/reference/umd-augmentation-3.symbols b/tests/baselines/reference/umd-augmentation-3.symbols new file mode 100644 index 00000000000..4923c17954f --- /dev/null +++ b/tests/baselines/reference/umd-augmentation-3.symbols @@ -0,0 +1,104 @@ +=== tests/cases/conformance/externalModules/b.ts === +/// +import * as m from 'math2d'; +>m : Symbol(m, Decl(b.ts, 1, 6)) + +let v = new m.Vector(3, 2); +>v : Symbol(v, Decl(b.ts, 2, 3)) +>m.Vector : Symbol(m.Vector, Decl(index.d.ts, 9, 2), Decl(math2d-augment.d.ts, 2, 25)) +>m : Symbol(m, Decl(b.ts, 1, 6)) +>Vector : Symbol(m.Vector, Decl(index.d.ts, 9, 2), Decl(math2d-augment.d.ts, 2, 25)) + +let magnitude = m.getLength(v); +>magnitude : Symbol(magnitude, Decl(b.ts, 3, 3)) +>m.getLength : Symbol(m.getLength, Decl(index.d.ts, 17, 2)) +>m : Symbol(m, Decl(b.ts, 1, 6)) +>getLength : Symbol(m.getLength, Decl(index.d.ts, 17, 2)) +>v : Symbol(v, Decl(b.ts, 2, 3)) + +let p: m.Point = v.translate(5, 5); +>p : Symbol(p, Decl(b.ts, 4, 3)) +>m : Symbol(m, Decl(b.ts, 1, 6)) +>Point : Symbol(m.Point, Decl(index.d.ts, 5, 23)) +>v.translate : Symbol(m.Vector.translate, Decl(index.d.ts, 14, 36)) +>v : Symbol(v, Decl(b.ts, 2, 3)) +>translate : Symbol(m.Vector.translate, Decl(index.d.ts, 14, 36)) + +p = v.reverse(); +>p : Symbol(p, Decl(b.ts, 4, 3)) +>v.reverse : Symbol(m.Vector.reverse, Decl(math2d-augment.d.ts, 4, 19)) +>v : Symbol(v, Decl(b.ts, 2, 3)) +>reverse : Symbol(m.Vector.reverse, Decl(math2d-augment.d.ts, 4, 19)) + +var t = p.x; +>t : Symbol(t, Decl(b.ts, 6, 3)) +>p.x : Symbol(m.Point.x, Decl(index.d.ts, 6, 18)) +>p : Symbol(p, Decl(b.ts, 4, 3)) +>x : Symbol(m.Point.x, Decl(index.d.ts, 6, 18)) + +=== tests/cases/conformance/externalModules/node_modules/math2d/index.d.ts === + +export as namespace Math2d; + +export = M2D; +>M2D : Symbol(M2D, Decl(index.d.ts, 3, 13)) + +declare namespace M2D { +>M2D : Symbol(, Decl(index.d.ts, 3, 13), Decl(math2d-augment.d.ts, 0, 33)) + + interface Point { +>Point : Symbol(Point, Decl(index.d.ts, 5, 23)) + + x: number; +>x : Symbol(Point.x, Decl(index.d.ts, 6, 18)) + + y: number; +>y : Symbol(Point.y, Decl(index.d.ts, 7, 12)) + } + + class Vector implements Point { +>Vector : Symbol(Vector, Decl(index.d.ts, 9, 2), Decl(math2d-augment.d.ts, 2, 25)) +>Point : Symbol(Point, Decl(index.d.ts, 5, 23)) + + x: number; +>x : Symbol(Vector.x, Decl(index.d.ts, 11, 32)) + + y: number; +>y : Symbol(Vector.y, Decl(index.d.ts, 12, 12)) + + constructor(x: number, y: number); +>x : Symbol(x, Decl(index.d.ts, 14, 14)) +>y : Symbol(y, Decl(index.d.ts, 14, 24)) + + translate(dx: number, dy: number): Vector; +>translate : Symbol(Vector.translate, Decl(index.d.ts, 14, 36)) +>dx : Symbol(dx, Decl(index.d.ts, 16, 12)) +>dy : Symbol(dy, Decl(index.d.ts, 16, 23)) +>Vector : Symbol(Vector, Decl(index.d.ts, 9, 2), Decl(math2d-augment.d.ts, 2, 25)) + } + + function getLength(p: Vector): number; +>getLength : Symbol(getLength, Decl(index.d.ts, 17, 2)) +>p : Symbol(p, Decl(index.d.ts, 19, 20)) +>Vector : Symbol(Vector, Decl(index.d.ts, 9, 2), Decl(math2d-augment.d.ts, 2, 25)) + +} + + +=== tests/cases/conformance/externalModules/math2d-augment.d.ts === +import * as Math2d from 'math2d'; +>Math2d : Symbol(Math2d, Decl(math2d-augment.d.ts, 0, 6)) + +// Augment the module +declare module 'math2d' { + // Add a method to the class + interface Vector { +>Vector : Symbol(Vector, Decl(index.d.ts, 9, 2), Decl(math2d-augment.d.ts, 2, 25)) + + reverse(): Math2d.Point; +>reverse : Symbol(Vector.reverse, Decl(math2d-augment.d.ts, 4, 19)) +>Math2d : Symbol(Math2d, Decl(math2d-augment.d.ts, 0, 6)) +>Point : Symbol(Point, Decl(index.d.ts, 5, 23)) + } +} + diff --git a/tests/baselines/reference/umd-augmentation-3.types b/tests/baselines/reference/umd-augmentation-3.types new file mode 100644 index 00000000000..09a383dc881 --- /dev/null +++ b/tests/baselines/reference/umd-augmentation-3.types @@ -0,0 +1,114 @@ +=== tests/cases/conformance/externalModules/b.ts === +/// +import * as m from 'math2d'; +>m : typeof m + +let v = new m.Vector(3, 2); +>v : m.Vector +>new m.Vector(3, 2) : m.Vector +>m.Vector : typeof m.Vector +>m : typeof m +>Vector : typeof m.Vector +>3 : number +>2 : number + +let magnitude = m.getLength(v); +>magnitude : number +>m.getLength(v) : number +>m.getLength : (p: m.Vector) => number +>m : typeof m +>getLength : (p: m.Vector) => number +>v : m.Vector + +let p: m.Point = v.translate(5, 5); +>p : m.Point +>m : any +>Point : m.Point +>v.translate(5, 5) : m.Vector +>v.translate : (dx: number, dy: number) => m.Vector +>v : m.Vector +>translate : (dx: number, dy: number) => m.Vector +>5 : number +>5 : number + +p = v.reverse(); +>p = v.reverse() : m.Point +>p : m.Point +>v.reverse() : m.Point +>v.reverse : () => m.Point +>v : m.Vector +>reverse : () => m.Point + +var t = p.x; +>t : number +>p.x : number +>p : m.Point +>x : number + +=== tests/cases/conformance/externalModules/node_modules/math2d/index.d.ts === + +export as namespace Math2d; +>Math2d : any + +export = M2D; +>M2D : typeof M2D + +declare namespace M2D { +>M2D : typeof + + interface Point { +>Point : Point + + x: number; +>x : number + + y: number; +>y : number + } + + class Vector implements Point { +>Vector : Vector +>Point : Point + + x: number; +>x : number + + y: number; +>y : number + + constructor(x: number, y: number); +>x : number +>y : number + + translate(dx: number, dy: number): Vector; +>translate : (dx: number, dy: number) => Vector +>dx : number +>dy : number +>Vector : Vector + } + + function getLength(p: Vector): number; +>getLength : (p: Vector) => number +>p : Vector +>Vector : Vector + +} + + +=== tests/cases/conformance/externalModules/math2d-augment.d.ts === +import * as Math2d from 'math2d'; +>Math2d : typeof Math2d + +// Augment the module +declare module 'math2d' { + // Add a method to the class + interface Vector { +>Vector : Vector + + reverse(): Math2d.Point; +>reverse : () => Point +>Math2d : any +>Point : Point + } +} + diff --git a/tests/baselines/reference/umd-augmentation-4.js b/tests/baselines/reference/umd-augmentation-4.js new file mode 100644 index 00000000000..da0f2ec1777 --- /dev/null +++ b/tests/baselines/reference/umd-augmentation-4.js @@ -0,0 +1,55 @@ +//// [tests/cases/conformance/externalModules/umd-augmentation-4.ts] //// + +//// [index.d.ts] + +export as namespace Math2d; + +export = M2D; + +declare namespace M2D { + interface Point { + x: number; + y: number; + } + + class Vector implements Point { + x: number; + y: number; + constructor(x: number, y: number); + + translate(dx: number, dy: number): Vector; + } + + function getLength(p: Vector): number; + +} + + +//// [math2d-augment.d.ts] +import * as Math2d from 'math2d'; +// Augment the module +declare module 'math2d' { + // Add a method to the class + interface Vector { + reverse(): Math2d.Point; + } +} + +//// [a.ts] +/// +/// +let v = new Math2d.Vector(3, 2); +let magnitude = Math2d.getLength(v); +let p: Math2d.Point = v.translate(5, 5); +p = v.reverse(); +var t = p.x; + + +//// [a.js] +/// +/// +var v = new exports.Math2d.Vector(3, 2); +var magnitude = exports.Math2d.getLength(v); +var p = v.translate(5, 5); +p = v.reverse(); +var t = p.x; diff --git a/tests/baselines/reference/umd-augmentation-4.symbols b/tests/baselines/reference/umd-augmentation-4.symbols new file mode 100644 index 00000000000..3f2cc913d86 --- /dev/null +++ b/tests/baselines/reference/umd-augmentation-4.symbols @@ -0,0 +1,102 @@ +=== tests/cases/conformance/externalModules/a.ts === +/// +/// +let v = new Math2d.Vector(3, 2); +>v : Symbol(v, Decl(a.ts, 2, 3)) +>Math2d.Vector : Symbol(Math2d.Vector, Decl(index.d.ts, 9, 2), Decl(math2d-augment.d.ts, 2, 25)) +>Math2d : Symbol(Math2d, Decl(index.d.ts, 0, 0)) +>Vector : Symbol(Math2d.Vector, Decl(index.d.ts, 9, 2), Decl(math2d-augment.d.ts, 2, 25)) + +let magnitude = Math2d.getLength(v); +>magnitude : Symbol(magnitude, Decl(a.ts, 3, 3)) +>Math2d.getLength : Symbol(Math2d.getLength, Decl(index.d.ts, 17, 2)) +>Math2d : Symbol(Math2d, Decl(index.d.ts, 0, 0)) +>getLength : Symbol(Math2d.getLength, Decl(index.d.ts, 17, 2)) +>v : Symbol(v, Decl(a.ts, 2, 3)) + +let p: Math2d.Point = v.translate(5, 5); +>p : Symbol(p, Decl(a.ts, 4, 3)) +>Math2d : Symbol(Math2d, Decl(index.d.ts, 0, 0)) +>Point : Symbol(Math2d.Point, Decl(index.d.ts, 5, 23)) +>v.translate : Symbol(Math2d.Vector.translate, Decl(index.d.ts, 14, 36)) +>v : Symbol(v, Decl(a.ts, 2, 3)) +>translate : Symbol(Math2d.Vector.translate, Decl(index.d.ts, 14, 36)) + +p = v.reverse(); +>p : Symbol(p, Decl(a.ts, 4, 3)) +>v.reverse : Symbol(Math2d.Vector.reverse, Decl(math2d-augment.d.ts, 4, 19)) +>v : Symbol(v, Decl(a.ts, 2, 3)) +>reverse : Symbol(Math2d.Vector.reverse, Decl(math2d-augment.d.ts, 4, 19)) + +var t = p.x; +>t : Symbol(t, Decl(a.ts, 6, 3)) +>p.x : Symbol(Math2d.Point.x, Decl(index.d.ts, 6, 18)) +>p : Symbol(p, Decl(a.ts, 4, 3)) +>x : Symbol(Math2d.Point.x, Decl(index.d.ts, 6, 18)) + +=== tests/cases/conformance/externalModules/node_modules/math2d/index.d.ts === + +export as namespace Math2d; + +export = M2D; +>M2D : Symbol(M2D, Decl(index.d.ts, 3, 13)) + +declare namespace M2D { +>M2D : Symbol(Math2d, Decl(index.d.ts, 3, 13), Decl(math2d-augment.d.ts, 0, 33)) + + interface Point { +>Point : Symbol(Point, Decl(index.d.ts, 5, 23)) + + x: number; +>x : Symbol(Point.x, Decl(index.d.ts, 6, 18)) + + y: number; +>y : Symbol(Point.y, Decl(index.d.ts, 7, 12)) + } + + class Vector implements Point { +>Vector : Symbol(Vector, Decl(index.d.ts, 9, 2), Decl(math2d-augment.d.ts, 2, 25)) +>Point : Symbol(Point, Decl(index.d.ts, 5, 23)) + + x: number; +>x : Symbol(Vector.x, Decl(index.d.ts, 11, 32)) + + y: number; +>y : Symbol(Vector.y, Decl(index.d.ts, 12, 12)) + + constructor(x: number, y: number); +>x : Symbol(x, Decl(index.d.ts, 14, 14)) +>y : Symbol(y, Decl(index.d.ts, 14, 24)) + + translate(dx: number, dy: number): Vector; +>translate : Symbol(Vector.translate, Decl(index.d.ts, 14, 36)) +>dx : Symbol(dx, Decl(index.d.ts, 16, 12)) +>dy : Symbol(dy, Decl(index.d.ts, 16, 23)) +>Vector : Symbol(Vector, Decl(index.d.ts, 9, 2), Decl(math2d-augment.d.ts, 2, 25)) + } + + function getLength(p: Vector): number; +>getLength : Symbol(getLength, Decl(index.d.ts, 17, 2)) +>p : Symbol(p, Decl(index.d.ts, 19, 20)) +>Vector : Symbol(Vector, Decl(index.d.ts, 9, 2), Decl(math2d-augment.d.ts, 2, 25)) + +} + + +=== tests/cases/conformance/externalModules/math2d-augment.d.ts === +import * as Math2d from 'math2d'; +>Math2d : Symbol(Math2d, Decl(math2d-augment.d.ts, 0, 6)) + +// Augment the module +declare module 'math2d' { + // Add a method to the class + interface Vector { +>Vector : Symbol(Vector, Decl(index.d.ts, 9, 2), Decl(math2d-augment.d.ts, 2, 25)) + + reverse(): Math2d.Point; +>reverse : Symbol(Vector.reverse, Decl(math2d-augment.d.ts, 4, 19)) +>Math2d : Symbol(Math2d, Decl(math2d-augment.d.ts, 0, 6)) +>Point : Symbol(Point, Decl(index.d.ts, 5, 23)) + } +} + diff --git a/tests/baselines/reference/umd-augmentation-4.types b/tests/baselines/reference/umd-augmentation-4.types new file mode 100644 index 00000000000..71783d03012 --- /dev/null +++ b/tests/baselines/reference/umd-augmentation-4.types @@ -0,0 +1,112 @@ +=== tests/cases/conformance/externalModules/a.ts === +/// +/// +let v = new Math2d.Vector(3, 2); +>v : Math2d.Vector +>new Math2d.Vector(3, 2) : Math2d.Vector +>Math2d.Vector : typeof Math2d.Vector +>Math2d : typeof Math2d +>Vector : typeof Math2d.Vector +>3 : number +>2 : number + +let magnitude = Math2d.getLength(v); +>magnitude : number +>Math2d.getLength(v) : number +>Math2d.getLength : (p: Math2d.Vector) => number +>Math2d : typeof Math2d +>getLength : (p: Math2d.Vector) => number +>v : Math2d.Vector + +let p: Math2d.Point = v.translate(5, 5); +>p : Math2d.Point +>Math2d : any +>Point : Math2d.Point +>v.translate(5, 5) : Math2d.Vector +>v.translate : (dx: number, dy: number) => Math2d.Vector +>v : Math2d.Vector +>translate : (dx: number, dy: number) => Math2d.Vector +>5 : number +>5 : number + +p = v.reverse(); +>p = v.reverse() : Math2d.Point +>p : Math2d.Point +>v.reverse() : Math2d.Point +>v.reverse : () => Math2d.Point +>v : Math2d.Vector +>reverse : () => Math2d.Point + +var t = p.x; +>t : number +>p.x : number +>p : Math2d.Point +>x : number + +=== tests/cases/conformance/externalModules/node_modules/math2d/index.d.ts === + +export as namespace Math2d; +>Math2d : any + +export = M2D; +>M2D : typeof M2D + +declare namespace M2D { +>M2D : typeof Math2d + + interface Point { +>Point : Point + + x: number; +>x : number + + y: number; +>y : number + } + + class Vector implements Point { +>Vector : Vector +>Point : Point + + x: number; +>x : number + + y: number; +>y : number + + constructor(x: number, y: number); +>x : number +>y : number + + translate(dx: number, dy: number): Vector; +>translate : (dx: number, dy: number) => Vector +>dx : number +>dy : number +>Vector : Vector + } + + function getLength(p: Vector): number; +>getLength : (p: Vector) => number +>p : Vector +>Vector : Vector + +} + + +=== tests/cases/conformance/externalModules/math2d-augment.d.ts === +import * as Math2d from 'math2d'; +>Math2d : typeof Math2d + +// Augment the module +declare module 'math2d' { + // Add a method to the class + interface Vector { +>Vector : Vector + + reverse(): Math2d.Point; +>reverse : () => Point +>Math2d : any +>Point : Point + } +} + diff --git a/tests/baselines/reference/umd-errors.errors.txt b/tests/baselines/reference/umd-errors.errors.txt new file mode 100644 index 00000000000..a9575665277 --- /dev/null +++ b/tests/baselines/reference/umd-errors.errors.txt @@ -0,0 +1,57 @@ +tests/cases/conformance/externalModules/err1.d.ts(3,1): error TS1314: Global module exports may only appear in module files. +tests/cases/conformance/externalModules/err2.d.ts(3,2): error TS1316: Global module exports may only appear at top level. +tests/cases/conformance/externalModules/err3.d.ts(3,1): error TS1184: Modifiers cannot appear here. +tests/cases/conformance/externalModules/err3.d.ts(4,1): error TS1184: Modifiers cannot appear here. +tests/cases/conformance/externalModules/err3.d.ts(5,1): error TS1184: Modifiers cannot appear here. +tests/cases/conformance/externalModules/err3.d.ts(6,7): error TS1134: Variable declaration expected. +tests/cases/conformance/externalModules/err4.d.ts(3,2): error TS1316: Global module exports may only appear at top level. +tests/cases/conformance/externalModules/err5.ts(3,1): error TS1315: Global module exports may only appear in declaration files. + + +==== tests/cases/conformance/externalModules/err1.d.ts (1 errors) ==== + + // Illegal, can't be in script file + export as namespace Foo; + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1314: Global module exports may only appear in module files. + +==== tests/cases/conformance/externalModules/err2.d.ts (1 errors) ==== + // Illegal, can't be in external ambient module + declare module "Foo" { + export as namespace Bar; + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1316: Global module exports may only appear at top level. + } + +==== tests/cases/conformance/externalModules/err3.d.ts (4 errors) ==== + // Illegal, can't have modifiers + export var p; + static export as namespace oo1; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1184: Modifiers cannot appear here. + declare export as namespace oo2; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1184: Modifiers cannot appear here. + public export as namespace oo3; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1184: Modifiers cannot appear here. + const export as namespace oo4; + ~~~~~~ +!!! error TS1134: Variable declaration expected. + +==== tests/cases/conformance/externalModules/err4.d.ts (1 errors) ==== + // Illegal, must be at top-level + export namespace B { + export as namespace C1; + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1316: Global module exports may only appear at top level. + } + +==== tests/cases/conformance/externalModules/err5.ts (1 errors) ==== + // Illegal, may not appear in implementation files + export var v; + export as namespace C2; + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1315: Global module exports may only appear in declaration files. + + \ No newline at end of file diff --git a/tests/baselines/reference/umd-errors.js b/tests/baselines/reference/umd-errors.js new file mode 100644 index 00000000000..7423c81f9ed --- /dev/null +++ b/tests/baselines/reference/umd-errors.js @@ -0,0 +1,36 @@ +//// [tests/cases/conformance/externalModules/umd-errors.ts] //// + +//// [err1.d.ts] + +// Illegal, can't be in script file +export as namespace Foo; + +//// [err2.d.ts] +// Illegal, can't be in external ambient module +declare module "Foo" { + export as namespace Bar; +} + +//// [err3.d.ts] +// Illegal, can't have modifiers +export var p; +static export as namespace oo1; +declare export as namespace oo2; +public export as namespace oo3; +const export as namespace oo4; + +//// [err4.d.ts] +// Illegal, must be at top-level +export namespace B { + export as namespace C1; +} + +//// [err5.ts] +// Illegal, may not appear in implementation files +export var v; +export as namespace C2; + + + +//// [err5.js] +"use strict"; diff --git a/tests/baselines/reference/umd1.js b/tests/baselines/reference/umd1.js new file mode 100644 index 00000000000..9b059da4887 --- /dev/null +++ b/tests/baselines/reference/umd1.js @@ -0,0 +1,21 @@ +//// [tests/cases/conformance/externalModules/umd1.ts] //// + +//// [foo.d.ts] + +export var x: number; +export function fn(): void; +export interface Thing { n: typeof x } +export as namespace Foo; + +//// [a.ts] +/// +Foo.fn(); +let x: Foo.Thing; +let y: number = x.n; + + +//// [a.js] +/// +exports.Foo.fn(); +var x; +var y = x.n; diff --git a/tests/baselines/reference/umd1.symbols b/tests/baselines/reference/umd1.symbols new file mode 100644 index 00000000000..9b964456bcf --- /dev/null +++ b/tests/baselines/reference/umd1.symbols @@ -0,0 +1,33 @@ +=== tests/cases/conformance/externalModules/a.ts === +/// +Foo.fn(); +>Foo.fn : Symbol(Foo.fn, Decl(foo.d.ts, 1, 21)) +>Foo : Symbol(Foo, Decl(foo.d.ts, 3, 38)) +>fn : Symbol(Foo.fn, Decl(foo.d.ts, 1, 21)) + +let x: Foo.Thing; +>x : Symbol(x, Decl(a.ts, 2, 3)) +>Foo : Symbol(Foo, Decl(foo.d.ts, 3, 38)) +>Thing : Symbol(Foo.Thing, Decl(foo.d.ts, 2, 27)) + +let y: number = x.n; +>y : Symbol(y, Decl(a.ts, 3, 3)) +>x.n : Symbol(Foo.Thing.n, Decl(foo.d.ts, 3, 24)) +>x : Symbol(x, Decl(a.ts, 2, 3)) +>n : Symbol(Foo.Thing.n, Decl(foo.d.ts, 3, 24)) + +=== tests/cases/conformance/externalModules/foo.d.ts === + +export var x: number; +>x : Symbol(x, Decl(foo.d.ts, 1, 10)) + +export function fn(): void; +>fn : Symbol(fn, Decl(foo.d.ts, 1, 21)) + +export interface Thing { n: typeof x } +>Thing : Symbol(Thing, Decl(foo.d.ts, 2, 27)) +>n : Symbol(Thing.n, Decl(foo.d.ts, 3, 24)) +>x : Symbol(x, Decl(foo.d.ts, 1, 10)) + +export as namespace Foo; + diff --git a/tests/baselines/reference/umd1.types b/tests/baselines/reference/umd1.types new file mode 100644 index 00000000000..1767f3b5a89 --- /dev/null +++ b/tests/baselines/reference/umd1.types @@ -0,0 +1,35 @@ +=== tests/cases/conformance/externalModules/a.ts === +/// +Foo.fn(); +>Foo.fn() : void +>Foo.fn : () => void +>Foo : typeof Foo +>fn : () => void + +let x: Foo.Thing; +>x : Foo.Thing +>Foo : any +>Thing : Foo.Thing + +let y: number = x.n; +>y : number +>x.n : number +>x : Foo.Thing +>n : number + +=== tests/cases/conformance/externalModules/foo.d.ts === + +export var x: number; +>x : number + +export function fn(): void; +>fn : () => void + +export interface Thing { n: typeof x } +>Thing : Thing +>n : number +>x : number + +export as namespace Foo; +>Foo : any + diff --git a/tests/baselines/reference/umd2.errors.txt b/tests/baselines/reference/umd2.errors.txt new file mode 100644 index 00000000000..76a4d33f65a --- /dev/null +++ b/tests/baselines/reference/umd2.errors.txt @@ -0,0 +1,19 @@ +tests/cases/conformance/externalModules/a.ts(1,1): error TS2304: Cannot find name 'Foo'. +tests/cases/conformance/externalModules/a.ts(2,8): error TS2503: Cannot find namespace 'Foo'. + + +==== tests/cases/conformance/externalModules/a.ts (2 errors) ==== + Foo.fn(); + ~~~ +!!! error TS2304: Cannot find name 'Foo'. + let x: Foo.Thing; + ~~~ +!!! error TS2503: Cannot find namespace 'Foo'. + let y: number = x.n; + +==== tests/cases/conformance/externalModules/foo.d.ts (0 errors) ==== + + export var x: number; + export function fn(): void; + export as namespace Foo; + \ No newline at end of file diff --git a/tests/baselines/reference/umd2.js b/tests/baselines/reference/umd2.js new file mode 100644 index 00000000000..2737856dcfd --- /dev/null +++ b/tests/baselines/reference/umd2.js @@ -0,0 +1,18 @@ +//// [tests/cases/conformance/externalModules/umd2.ts] //// + +//// [foo.d.ts] + +export var x: number; +export function fn(): void; +export as namespace Foo; + +//// [a.ts] +Foo.fn(); +let x: Foo.Thing; +let y: number = x.n; + + +//// [a.js] +Foo.fn(); +var x; +var y = x.n; diff --git a/tests/baselines/reference/umd3.js b/tests/baselines/reference/umd3.js new file mode 100644 index 00000000000..5e869148beb --- /dev/null +++ b/tests/baselines/reference/umd3.js @@ -0,0 +1,22 @@ +//// [tests/cases/conformance/externalModules/umd3.ts] //// + +//// [foo.d.ts] + +export var x: number; +export function fn(): void; +export interface Thing { n: typeof x } +export as namespace Foo; + +//// [a.ts] +import * as Foo from './foo'; +Foo.fn(); +let x: Foo.Thing; +let y: number = x.n; + + +//// [a.js] +"use strict"; +var Foo = require('./foo'); +Foo.fn(); +var x; +var y = x.n; diff --git a/tests/baselines/reference/umd3.symbols b/tests/baselines/reference/umd3.symbols new file mode 100644 index 00000000000..165fd81597a --- /dev/null +++ b/tests/baselines/reference/umd3.symbols @@ -0,0 +1,35 @@ +=== tests/cases/conformance/externalModules/a.ts === +import * as Foo from './foo'; +>Foo : Symbol(Foo, Decl(a.ts, 0, 6)) + +Foo.fn(); +>Foo.fn : Symbol(Foo.fn, Decl(foo.d.ts, 1, 21)) +>Foo : Symbol(Foo, Decl(a.ts, 0, 6)) +>fn : Symbol(Foo.fn, Decl(foo.d.ts, 1, 21)) + +let x: Foo.Thing; +>x : Symbol(x, Decl(a.ts, 2, 3)) +>Foo : Symbol(Foo, Decl(a.ts, 0, 6)) +>Thing : Symbol(Foo.Thing, Decl(foo.d.ts, 2, 27)) + +let y: number = x.n; +>y : Symbol(y, Decl(a.ts, 3, 3)) +>x.n : Symbol(Foo.Thing.n, Decl(foo.d.ts, 3, 24)) +>x : Symbol(x, Decl(a.ts, 2, 3)) +>n : Symbol(Foo.Thing.n, Decl(foo.d.ts, 3, 24)) + +=== tests/cases/conformance/externalModules/foo.d.ts === + +export var x: number; +>x : Symbol(x, Decl(foo.d.ts, 1, 10)) + +export function fn(): void; +>fn : Symbol(fn, Decl(foo.d.ts, 1, 21)) + +export interface Thing { n: typeof x } +>Thing : Symbol(Thing, Decl(foo.d.ts, 2, 27)) +>n : Symbol(Thing.n, Decl(foo.d.ts, 3, 24)) +>x : Symbol(x, Decl(foo.d.ts, 1, 10)) + +export as namespace Foo; + diff --git a/tests/baselines/reference/umd3.types b/tests/baselines/reference/umd3.types new file mode 100644 index 00000000000..85ee6bafe5e --- /dev/null +++ b/tests/baselines/reference/umd3.types @@ -0,0 +1,37 @@ +=== tests/cases/conformance/externalModules/a.ts === +import * as Foo from './foo'; +>Foo : typeof Foo + +Foo.fn(); +>Foo.fn() : void +>Foo.fn : () => void +>Foo : typeof Foo +>fn : () => void + +let x: Foo.Thing; +>x : Foo.Thing +>Foo : any +>Thing : Foo.Thing + +let y: number = x.n; +>y : number +>x.n : number +>x : Foo.Thing +>n : number + +=== tests/cases/conformance/externalModules/foo.d.ts === + +export var x: number; +>x : number + +export function fn(): void; +>fn : () => void + +export interface Thing { n: typeof x } +>Thing : Thing +>n : number +>x : number + +export as namespace Foo; +>Foo : any + diff --git a/tests/baselines/reference/umd4.js b/tests/baselines/reference/umd4.js new file mode 100644 index 00000000000..b7a7d1da0e2 --- /dev/null +++ b/tests/baselines/reference/umd4.js @@ -0,0 +1,22 @@ +//// [tests/cases/conformance/externalModules/umd4.ts] //// + +//// [foo.d.ts] + +export var x: number; +export function fn(): void; +export interface Thing { n: typeof x } +export as namespace Foo; + +//// [a.ts] +import * as Bar from './foo'; +Bar.fn(); +let x: Bar.Thing; +let y: number = x.n; + + +//// [a.js] +"use strict"; +var Bar = require('./foo'); +Bar.fn(); +var x; +var y = x.n; diff --git a/tests/baselines/reference/umd4.symbols b/tests/baselines/reference/umd4.symbols new file mode 100644 index 00000000000..8403187198b --- /dev/null +++ b/tests/baselines/reference/umd4.symbols @@ -0,0 +1,35 @@ +=== tests/cases/conformance/externalModules/a.ts === +import * as Bar from './foo'; +>Bar : Symbol(Bar, Decl(a.ts, 0, 6)) + +Bar.fn(); +>Bar.fn : Symbol(Bar.fn, Decl(foo.d.ts, 1, 21)) +>Bar : Symbol(Bar, Decl(a.ts, 0, 6)) +>fn : Symbol(Bar.fn, Decl(foo.d.ts, 1, 21)) + +let x: Bar.Thing; +>x : Symbol(x, Decl(a.ts, 2, 3)) +>Bar : Symbol(Bar, Decl(a.ts, 0, 6)) +>Thing : Symbol(Bar.Thing, Decl(foo.d.ts, 2, 27)) + +let y: number = x.n; +>y : Symbol(y, Decl(a.ts, 3, 3)) +>x.n : Symbol(Bar.Thing.n, Decl(foo.d.ts, 3, 24)) +>x : Symbol(x, Decl(a.ts, 2, 3)) +>n : Symbol(Bar.Thing.n, Decl(foo.d.ts, 3, 24)) + +=== tests/cases/conformance/externalModules/foo.d.ts === + +export var x: number; +>x : Symbol(x, Decl(foo.d.ts, 1, 10)) + +export function fn(): void; +>fn : Symbol(fn, Decl(foo.d.ts, 1, 21)) + +export interface Thing { n: typeof x } +>Thing : Symbol(Thing, Decl(foo.d.ts, 2, 27)) +>n : Symbol(Thing.n, Decl(foo.d.ts, 3, 24)) +>x : Symbol(x, Decl(foo.d.ts, 1, 10)) + +export as namespace Foo; + diff --git a/tests/baselines/reference/umd4.types b/tests/baselines/reference/umd4.types new file mode 100644 index 00000000000..579599f5661 --- /dev/null +++ b/tests/baselines/reference/umd4.types @@ -0,0 +1,37 @@ +=== tests/cases/conformance/externalModules/a.ts === +import * as Bar from './foo'; +>Bar : typeof Bar + +Bar.fn(); +>Bar.fn() : void +>Bar.fn : () => void +>Bar : typeof Bar +>fn : () => void + +let x: Bar.Thing; +>x : Bar.Thing +>Bar : any +>Thing : Bar.Thing + +let y: number = x.n; +>y : number +>x.n : number +>x : Bar.Thing +>n : number + +=== tests/cases/conformance/externalModules/foo.d.ts === + +export var x: number; +>x : number + +export function fn(): void; +>fn : () => void + +export interface Thing { n: typeof x } +>Thing : Thing +>n : number +>x : number + +export as namespace Foo; +>Foo : any + diff --git a/tests/baselines/reference/umd5.errors.txt b/tests/baselines/reference/umd5.errors.txt new file mode 100644 index 00000000000..19529ce195a --- /dev/null +++ b/tests/baselines/reference/umd5.errors.txt @@ -0,0 +1,20 @@ +tests/cases/conformance/externalModules/a.ts(6,9): error TS2304: Cannot find name 'Foo'. + + +==== tests/cases/conformance/externalModules/a.ts (1 errors) ==== + import * as Bar from './foo'; + Bar.fn(); + let x: Bar.Thing; + let y: number = x.n; + // should error + let z = Foo; + ~~~ +!!! error TS2304: Cannot find name 'Foo'. + +==== tests/cases/conformance/externalModules/foo.d.ts (0 errors) ==== + + export var x: number; + export function fn(): void; + export interface Thing { n: typeof x } + export as namespace Foo; + \ No newline at end of file diff --git a/tests/baselines/reference/umd5.js b/tests/baselines/reference/umd5.js new file mode 100644 index 00000000000..d054daf93fd --- /dev/null +++ b/tests/baselines/reference/umd5.js @@ -0,0 +1,26 @@ +//// [tests/cases/conformance/externalModules/umd5.ts] //// + +//// [foo.d.ts] + +export var x: number; +export function fn(): void; +export interface Thing { n: typeof x } +export as namespace Foo; + +//// [a.ts] +import * as Bar from './foo'; +Bar.fn(); +let x: Bar.Thing; +let y: number = x.n; +// should error +let z = Foo; + + +//// [a.js] +"use strict"; +var Bar = require('./foo'); +Bar.fn(); +var x; +var y = x.n; +// should error +var z = Foo; diff --git a/tests/baselines/reference/umd6.js b/tests/baselines/reference/umd6.js new file mode 100644 index 00000000000..d4d84fd0384 --- /dev/null +++ b/tests/baselines/reference/umd6.js @@ -0,0 +1,18 @@ +//// [tests/cases/conformance/externalModules/umd6.ts] //// + +//// [foo.d.ts] + +declare namespace Thing { + export function fn(): number; +} +export = Thing; +export as namespace Foo; + +//// [a.ts] +/// +let y: number = Foo.fn(); + + +//// [a.js] +/// +var y = exports.Foo.fn(); diff --git a/tests/baselines/reference/umd6.symbols b/tests/baselines/reference/umd6.symbols new file mode 100644 index 00000000000..d08507f1ea2 --- /dev/null +++ b/tests/baselines/reference/umd6.symbols @@ -0,0 +1,21 @@ +=== tests/cases/conformance/externalModules/a.ts === +/// +let y: number = Foo.fn(); +>y : Symbol(y, Decl(a.ts, 1, 3)) +>Foo.fn : Symbol(Foo.fn, Decl(foo.d.ts, 1, 25)) +>Foo : Symbol(Foo, Decl(foo.d.ts, 4, 15)) +>fn : Symbol(Foo.fn, Decl(foo.d.ts, 1, 25)) + +=== tests/cases/conformance/externalModules/foo.d.ts === + +declare namespace Thing { +>Thing : Symbol(Thing, Decl(foo.d.ts, 0, 0)) + + export function fn(): number; +>fn : Symbol(fn, Decl(foo.d.ts, 1, 25)) +} +export = Thing; +>Thing : Symbol(Thing, Decl(foo.d.ts, 0, 0)) + +export as namespace Foo; + diff --git a/tests/baselines/reference/umd6.types b/tests/baselines/reference/umd6.types new file mode 100644 index 00000000000..7318a43057a --- /dev/null +++ b/tests/baselines/reference/umd6.types @@ -0,0 +1,23 @@ +=== tests/cases/conformance/externalModules/a.ts === +/// +let y: number = Foo.fn(); +>y : number +>Foo.fn() : number +>Foo.fn : () => number +>Foo : typeof Foo +>fn : () => number + +=== tests/cases/conformance/externalModules/foo.d.ts === + +declare namespace Thing { +>Thing : typeof Thing + + export function fn(): number; +>fn : () => number +} +export = Thing; +>Thing : typeof Thing + +export as namespace Foo; +>Foo : any + diff --git a/tests/baselines/reference/umd7.js b/tests/baselines/reference/umd7.js new file mode 100644 index 00000000000..12d0a8651fc --- /dev/null +++ b/tests/baselines/reference/umd7.js @@ -0,0 +1,16 @@ +//// [tests/cases/conformance/externalModules/umd7.ts] //// + +//// [foo.d.ts] + +declare function Thing(): number; +export = Thing; +export as namespace Foo; + +//// [a.ts] +/// +let y: number = Foo(); + + +//// [a.js] +/// +var y = exports.Foo(); diff --git a/tests/baselines/reference/umd7.symbols b/tests/baselines/reference/umd7.symbols new file mode 100644 index 00000000000..0b3ef17fb7b --- /dev/null +++ b/tests/baselines/reference/umd7.symbols @@ -0,0 +1,16 @@ +=== tests/cases/conformance/externalModules/a.ts === +/// +let y: number = Foo(); +>y : Symbol(y, Decl(a.ts, 1, 3)) +>Foo : Symbol(Foo, Decl(foo.d.ts, 2, 15)) + +=== tests/cases/conformance/externalModules/foo.d.ts === + +declare function Thing(): number; +>Thing : Symbol(Thing, Decl(foo.d.ts, 0, 0)) + +export = Thing; +>Thing : Symbol(Thing, Decl(foo.d.ts, 0, 0)) + +export as namespace Foo; + diff --git a/tests/baselines/reference/umd7.types b/tests/baselines/reference/umd7.types new file mode 100644 index 00000000000..60782543710 --- /dev/null +++ b/tests/baselines/reference/umd7.types @@ -0,0 +1,18 @@ +=== tests/cases/conformance/externalModules/a.ts === +/// +let y: number = Foo(); +>y : number +>Foo() : number +>Foo : () => number + +=== tests/cases/conformance/externalModules/foo.d.ts === + +declare function Thing(): number; +>Thing : () => number + +export = Thing; +>Thing : () => number + +export as namespace Foo; +>Foo : any + diff --git a/tests/baselines/reference/umd8.js b/tests/baselines/reference/umd8.js new file mode 100644 index 00000000000..b4c6e0fa76b --- /dev/null +++ b/tests/baselines/reference/umd8.js @@ -0,0 +1,21 @@ +//// [tests/cases/conformance/externalModules/umd8.ts] //// + +//// [foo.d.ts] + +declare class Thing { + foo(): number; +} +export = Thing; +export as namespace Foo; + +//// [a.ts] +/// +let y: Foo; +y.foo(); + + + +//// [a.js] +/// +var y; +y.foo(); diff --git a/tests/baselines/reference/umd8.symbols b/tests/baselines/reference/umd8.symbols new file mode 100644 index 00000000000..8c38f267a2a --- /dev/null +++ b/tests/baselines/reference/umd8.symbols @@ -0,0 +1,25 @@ +=== tests/cases/conformance/externalModules/a.ts === +/// +let y: Foo; +>y : Symbol(y, Decl(a.ts, 1, 3)) +>Foo : Symbol(Foo, Decl(foo.d.ts, 4, 15)) + +y.foo(); +>y.foo : Symbol(Foo.foo, Decl(foo.d.ts, 1, 21)) +>y : Symbol(y, Decl(a.ts, 1, 3)) +>foo : Symbol(Foo.foo, Decl(foo.d.ts, 1, 21)) + + +=== tests/cases/conformance/externalModules/foo.d.ts === + +declare class Thing { +>Thing : Symbol(Thing, Decl(foo.d.ts, 0, 0)) + + foo(): number; +>foo : Symbol(Thing.foo, Decl(foo.d.ts, 1, 21)) +} +export = Thing; +>Thing : Symbol(Thing, Decl(foo.d.ts, 0, 0)) + +export as namespace Foo; + diff --git a/tests/baselines/reference/umd8.types b/tests/baselines/reference/umd8.types new file mode 100644 index 00000000000..0e66a49b963 --- /dev/null +++ b/tests/baselines/reference/umd8.types @@ -0,0 +1,27 @@ +=== tests/cases/conformance/externalModules/a.ts === +/// +let y: Foo; +>y : Foo +>Foo : Foo + +y.foo(); +>y.foo() : number +>y.foo : () => number +>y : Foo +>foo : () => number + + +=== tests/cases/conformance/externalModules/foo.d.ts === + +declare class Thing { +>Thing : Thing + + foo(): number; +>foo : () => number +} +export = Thing; +>Thing : Thing + +export as namespace Foo; +>Foo : any + diff --git a/tests/baselines/reference/unclosedExportClause01.js b/tests/baselines/reference/unclosedExportClause01.js index 53b63e59b59..1fe59e24a51 100644 --- a/tests/baselines/reference/unclosedExportClause01.js +++ b/tests/baselines/reference/unclosedExportClause01.js @@ -23,13 +23,18 @@ exports.x = "x"; "use strict"; var t1_1 = require("./t1"); exports.x = t1_1.x; +exports.from = t1_1.from; //// [t3.js] "use strict"; +var t1_1 = require("./t1"); +exports.from = t1_1.from; //// [t4.js] "use strict"; var t1_1 = require("./t1"); exports.a = t1_1.x; +exports.from = t1_1.from; //// [t5.js] "use strict"; var t1_1 = require("./t1"); exports.a = t1_1.x; +exports.from = t1_1.from; diff --git a/tests/baselines/reference/undeclaredModuleError.errors.txt b/tests/baselines/reference/undeclaredModuleError.errors.txt index 74e36318595..4a8248bfd6c 100644 --- a/tests/baselines/reference/undeclaredModuleError.errors.txt +++ b/tests/baselines/reference/undeclaredModuleError.errors.txt @@ -16,10 +16,9 @@ tests/cases/compiler/undeclaredModuleError.ts(11,41): error TS2304: Cannot find fs.readFile(originalFilePath, () => { readdir(covFileDir, () => { ~~~~~~~ - } , (error: Error, files: {}[]) => { - ~~~~~~~~~ !!! error TS2345: Argument of type '() => void' is not assignable to parameter of type '(stat: any, name: string) => boolean'. !!! error TS2345: Type 'void' is not assignable to type 'boolean'. + } , (error: Error, files: {}[]) => { files.forEach((file) => { var fullPath = join(IDoNotExist); ~~~~~~~~~~~ diff --git a/tests/baselines/reference/undefinedAssignableToEveryType.symbols b/tests/baselines/reference/undefinedAssignableToEveryType.symbols index f511231515e..c48839ea50f 100644 --- a/tests/baselines/reference/undefinedAssignableToEveryType.symbols +++ b/tests/baselines/reference/undefinedAssignableToEveryType.symbols @@ -3,7 +3,7 @@ class C { >C : Symbol(C, Decl(undefinedAssignableToEveryType.ts, 0, 0)) foo: string; ->foo : Symbol(foo, Decl(undefinedAssignableToEveryType.ts, 0, 9)) +>foo : Symbol(C.foo, Decl(undefinedAssignableToEveryType.ts, 0, 9)) } var ac: C; >ac : Symbol(ac, Decl(undefinedAssignableToEveryType.ts, 3, 3)) @@ -13,7 +13,7 @@ interface I { >I : Symbol(I, Decl(undefinedAssignableToEveryType.ts, 3, 10)) foo: string; ->foo : Symbol(foo, Decl(undefinedAssignableToEveryType.ts, 4, 13)) +>foo : Symbol(I.foo, Decl(undefinedAssignableToEveryType.ts, 4, 13)) } var ai: I; >ai : Symbol(ai, Decl(undefinedAssignableToEveryType.ts, 7, 3)) @@ -41,7 +41,7 @@ var d: boolean = undefined; var e: Date = undefined; >e : Symbol(e, Decl(undefinedAssignableToEveryType.ts, 15, 3)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >undefined : Symbol(undefined) var f: any = undefined; @@ -106,12 +106,12 @@ var o: (x: T) => T = undefined; var p: Number = undefined; >p : Symbol(p, Decl(undefinedAssignableToEveryType.ts, 29, 3)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >undefined : Symbol(undefined) var q: String = undefined; >q : Symbol(q, Decl(undefinedAssignableToEveryType.ts, 30, 3)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >undefined : Symbol(undefined) function foo(x: T, y: U, z: V) { @@ -119,7 +119,7 @@ function foo(x: T, y: U, z: V) { >T : Symbol(T, Decl(undefinedAssignableToEveryType.ts, 32, 13)) >U : Symbol(U, Decl(undefinedAssignableToEveryType.ts, 32, 15)) >V : Symbol(V, Decl(undefinedAssignableToEveryType.ts, 32, 18)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(undefinedAssignableToEveryType.ts, 32, 35)) >T : Symbol(T, Decl(undefinedAssignableToEveryType.ts, 32, 13)) >y : Symbol(y, Decl(undefinedAssignableToEveryType.ts, 32, 40)) diff --git a/tests/baselines/reference/undefinedIsSubtypeOfEverything.symbols b/tests/baselines/reference/undefinedIsSubtypeOfEverything.symbols index de4f6f0da05..f2776039d3a 100644 --- a/tests/baselines/reference/undefinedIsSubtypeOfEverything.symbols +++ b/tests/baselines/reference/undefinedIsSubtypeOfEverything.symbols @@ -5,7 +5,7 @@ class Base { >Base : Symbol(Base, Decl(undefinedIsSubtypeOfEverything.ts, 0, 0)) foo: typeof undefined; ->foo : Symbol(foo, Decl(undefinedIsSubtypeOfEverything.ts, 2, 12)) +>foo : Symbol(Base.foo, Decl(undefinedIsSubtypeOfEverything.ts, 2, 12)) >undefined : Symbol(undefined) } @@ -14,7 +14,7 @@ class D0 extends Base { >Base : Symbol(Base, Decl(undefinedIsSubtypeOfEverything.ts, 0, 0)) foo: any; ->foo : Symbol(foo, Decl(undefinedIsSubtypeOfEverything.ts, 6, 23)) +>foo : Symbol(D0.foo, Decl(undefinedIsSubtypeOfEverything.ts, 6, 23)) } class DA extends Base { @@ -22,7 +22,7 @@ class DA extends Base { >Base : Symbol(Base, Decl(undefinedIsSubtypeOfEverything.ts, 0, 0)) foo: typeof undefined; ->foo : Symbol(foo, Decl(undefinedIsSubtypeOfEverything.ts, 10, 23)) +>foo : Symbol(DA.foo, Decl(undefinedIsSubtypeOfEverything.ts, 10, 23)) >undefined : Symbol(undefined) } @@ -31,7 +31,7 @@ class D1 extends Base { >Base : Symbol(Base, Decl(undefinedIsSubtypeOfEverything.ts, 0, 0)) foo: string; ->foo : Symbol(foo, Decl(undefinedIsSubtypeOfEverything.ts, 14, 23)) +>foo : Symbol(D1.foo, Decl(undefinedIsSubtypeOfEverything.ts, 14, 23)) } class D1A extends Base { @@ -39,8 +39,8 @@ class D1A extends Base { >Base : Symbol(Base, Decl(undefinedIsSubtypeOfEverything.ts, 0, 0)) foo: String; ->foo : Symbol(foo, Decl(undefinedIsSubtypeOfEverything.ts, 18, 24)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>foo : Symbol(D1A.foo, Decl(undefinedIsSubtypeOfEverything.ts, 18, 24)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) } @@ -49,7 +49,7 @@ class D2 extends Base { >Base : Symbol(Base, Decl(undefinedIsSubtypeOfEverything.ts, 0, 0)) foo: number; ->foo : Symbol(foo, Decl(undefinedIsSubtypeOfEverything.ts, 23, 23)) +>foo : Symbol(D2.foo, Decl(undefinedIsSubtypeOfEverything.ts, 23, 23)) } class D2A extends Base { @@ -57,8 +57,8 @@ class D2A extends Base { >Base : Symbol(Base, Decl(undefinedIsSubtypeOfEverything.ts, 0, 0)) foo: Number; ->foo : Symbol(foo, Decl(undefinedIsSubtypeOfEverything.ts, 27, 24)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>foo : Symbol(D2A.foo, Decl(undefinedIsSubtypeOfEverything.ts, 27, 24)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) } @@ -67,7 +67,7 @@ class D3 extends Base { >Base : Symbol(Base, Decl(undefinedIsSubtypeOfEverything.ts, 0, 0)) foo: boolean; ->foo : Symbol(foo, Decl(undefinedIsSubtypeOfEverything.ts, 32, 23)) +>foo : Symbol(D3.foo, Decl(undefinedIsSubtypeOfEverything.ts, 32, 23)) } class D3A extends Base { @@ -75,7 +75,7 @@ class D3A extends Base { >Base : Symbol(Base, Decl(undefinedIsSubtypeOfEverything.ts, 0, 0)) foo: Boolean; ->foo : Symbol(foo, Decl(undefinedIsSubtypeOfEverything.ts, 36, 24)) +>foo : Symbol(D3A.foo, Decl(undefinedIsSubtypeOfEverything.ts, 36, 24)) >Boolean : Symbol(Boolean, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) } @@ -85,7 +85,7 @@ class D4 extends Base { >Base : Symbol(Base, Decl(undefinedIsSubtypeOfEverything.ts, 0, 0)) foo: RegExp; ->foo : Symbol(foo, Decl(undefinedIsSubtypeOfEverything.ts, 41, 23)) +>foo : Symbol(D4.foo, Decl(undefinedIsSubtypeOfEverything.ts, 41, 23)) >RegExp : Symbol(RegExp, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) } @@ -94,8 +94,8 @@ class D5 extends Base { >Base : Symbol(Base, Decl(undefinedIsSubtypeOfEverything.ts, 0, 0)) foo: Date; ->foo : Symbol(foo, Decl(undefinedIsSubtypeOfEverything.ts, 45, 23)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>foo : Symbol(D5.foo, Decl(undefinedIsSubtypeOfEverything.ts, 45, 23)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) } @@ -104,7 +104,7 @@ class D6 extends Base { >Base : Symbol(Base, Decl(undefinedIsSubtypeOfEverything.ts, 0, 0)) foo: number[]; ->foo : Symbol(foo, Decl(undefinedIsSubtypeOfEverything.ts, 50, 23)) +>foo : Symbol(D6.foo, Decl(undefinedIsSubtypeOfEverything.ts, 50, 23)) } class D7 extends Base { @@ -112,7 +112,7 @@ class D7 extends Base { >Base : Symbol(Base, Decl(undefinedIsSubtypeOfEverything.ts, 0, 0)) foo: { bar: number }; ->foo : Symbol(foo, Decl(undefinedIsSubtypeOfEverything.ts, 54, 23)) +>foo : Symbol(D7.foo, Decl(undefinedIsSubtypeOfEverything.ts, 54, 23)) >bar : Symbol(bar, Decl(undefinedIsSubtypeOfEverything.ts, 55, 10)) } @@ -122,7 +122,7 @@ class D8 extends Base { >Base : Symbol(Base, Decl(undefinedIsSubtypeOfEverything.ts, 0, 0)) foo: D7; ->foo : Symbol(foo, Decl(undefinedIsSubtypeOfEverything.ts, 59, 23)) +>foo : Symbol(D8.foo, Decl(undefinedIsSubtypeOfEverything.ts, 59, 23)) >D7 : Symbol(D7, Decl(undefinedIsSubtypeOfEverything.ts, 52, 1)) } @@ -130,14 +130,14 @@ interface I1 { >I1 : Symbol(I1, Decl(undefinedIsSubtypeOfEverything.ts, 61, 1)) bar: string; ->bar : Symbol(bar, Decl(undefinedIsSubtypeOfEverything.ts, 63, 14)) +>bar : Symbol(I1.bar, Decl(undefinedIsSubtypeOfEverything.ts, 63, 14)) } class D9 extends Base { >D9 : Symbol(D9, Decl(undefinedIsSubtypeOfEverything.ts, 65, 1)) >Base : Symbol(Base, Decl(undefinedIsSubtypeOfEverything.ts, 0, 0)) foo: I1; ->foo : Symbol(foo, Decl(undefinedIsSubtypeOfEverything.ts, 66, 23)) +>foo : Symbol(D9.foo, Decl(undefinedIsSubtypeOfEverything.ts, 66, 23)) >I1 : Symbol(I1, Decl(undefinedIsSubtypeOfEverything.ts, 61, 1)) } @@ -147,7 +147,7 @@ class D10 extends Base { >Base : Symbol(Base, Decl(undefinedIsSubtypeOfEverything.ts, 0, 0)) foo: () => number; ->foo : Symbol(foo, Decl(undefinedIsSubtypeOfEverything.ts, 71, 24)) +>foo : Symbol(D10.foo, Decl(undefinedIsSubtypeOfEverything.ts, 71, 24)) } enum E { A } @@ -159,7 +159,7 @@ class D11 extends Base { >Base : Symbol(Base, Decl(undefinedIsSubtypeOfEverything.ts, 0, 0)) foo: E; ->foo : Symbol(foo, Decl(undefinedIsSubtypeOfEverything.ts, 76, 24)) +>foo : Symbol(D11.foo, Decl(undefinedIsSubtypeOfEverything.ts, 76, 24)) >E : Symbol(E, Decl(undefinedIsSubtypeOfEverything.ts, 73, 1)) } @@ -177,14 +177,14 @@ class D12 extends Base { >Base : Symbol(Base, Decl(undefinedIsSubtypeOfEverything.ts, 0, 0)) foo: typeof f; ->foo : Symbol(foo, Decl(undefinedIsSubtypeOfEverything.ts, 84, 24)) +>foo : Symbol(D12.foo, Decl(undefinedIsSubtypeOfEverything.ts, 84, 24)) >f : Symbol(f, Decl(undefinedIsSubtypeOfEverything.ts, 78, 1), Decl(undefinedIsSubtypeOfEverything.ts, 80, 16)) } class c { baz: string } >c : Symbol(c, Decl(undefinedIsSubtypeOfEverything.ts, 86, 1), Decl(undefinedIsSubtypeOfEverything.ts, 89, 23)) ->baz : Symbol(baz, Decl(undefinedIsSubtypeOfEverything.ts, 89, 9)) +>baz : Symbol(c.baz, Decl(undefinedIsSubtypeOfEverything.ts, 89, 9)) module c { >c : Symbol(c, Decl(undefinedIsSubtypeOfEverything.ts, 86, 1), Decl(undefinedIsSubtypeOfEverything.ts, 89, 23)) @@ -197,7 +197,7 @@ class D13 extends Base { >Base : Symbol(Base, Decl(undefinedIsSubtypeOfEverything.ts, 0, 0)) foo: typeof c; ->foo : Symbol(foo, Decl(undefinedIsSubtypeOfEverything.ts, 93, 24)) +>foo : Symbol(D13.foo, Decl(undefinedIsSubtypeOfEverything.ts, 93, 24)) >c : Symbol(c, Decl(undefinedIsSubtypeOfEverything.ts, 86, 1), Decl(undefinedIsSubtypeOfEverything.ts, 89, 23)) } @@ -208,7 +208,7 @@ class D14 extends Base { >Base : Symbol(Base, Decl(undefinedIsSubtypeOfEverything.ts, 0, 0)) foo: T; ->foo : Symbol(foo, Decl(undefinedIsSubtypeOfEverything.ts, 98, 27)) +>foo : Symbol(D14.foo, Decl(undefinedIsSubtypeOfEverything.ts, 98, 27)) >T : Symbol(T, Decl(undefinedIsSubtypeOfEverything.ts, 98, 10)) } @@ -220,7 +220,7 @@ class D15 extends Base { >Base : Symbol(Base, Decl(undefinedIsSubtypeOfEverything.ts, 0, 0)) foo: U; ->foo : Symbol(foo, Decl(undefinedIsSubtypeOfEverything.ts, 103, 30)) +>foo : Symbol(D15.foo, Decl(undefinedIsSubtypeOfEverything.ts, 103, 30)) >U : Symbol(U, Decl(undefinedIsSubtypeOfEverything.ts, 103, 12)) } @@ -234,7 +234,7 @@ class D16 extends Base { >Base : Symbol(Base, Decl(undefinedIsSubtypeOfEverything.ts, 0, 0)) foo: Object; ->foo : Symbol(foo, Decl(undefinedIsSubtypeOfEverything.ts, 112, 24)) +>foo : Symbol(D16.foo, Decl(undefinedIsSubtypeOfEverything.ts, 112, 24)) >Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) } @@ -244,6 +244,6 @@ class D17 extends Base { >Base : Symbol(Base, Decl(undefinedIsSubtypeOfEverything.ts, 0, 0)) foo: {}; ->foo : Symbol(foo, Decl(undefinedIsSubtypeOfEverything.ts, 117, 24)) +>foo : Symbol(D17.foo, Decl(undefinedIsSubtypeOfEverything.ts, 117, 24)) } diff --git a/tests/baselines/reference/undefinedTypeAssignment1.errors.txt b/tests/baselines/reference/undefinedTypeAssignment1.errors.txt index b8dd74a58a8..61021a463ab 100644 --- a/tests/baselines/reference/undefinedTypeAssignment1.errors.txt +++ b/tests/baselines/reference/undefinedTypeAssignment1.errors.txt @@ -1,9 +1,9 @@ -tests/cases/compiler/undefinedTypeAssignment1.ts(1,1): error TS2397: Declaration name conflicts with built-in global identifier 'undefined'. +tests/cases/compiler/undefinedTypeAssignment1.ts(1,6): error TS2397: Declaration name conflicts with built-in global identifier 'undefined'. ==== tests/cases/compiler/undefinedTypeAssignment1.ts (1 errors) ==== type undefined = string; - ~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~ !!! error TS2397: Declaration name conflicts with built-in global identifier 'undefined'. function p(undefined = "wat") { return undefined; diff --git a/tests/baselines/reference/underscoreMapFirst.symbols b/tests/baselines/reference/underscoreMapFirst.symbols index e926121db57..9b08a7ab4eb 100644 --- a/tests/baselines/reference/underscoreMapFirst.symbols +++ b/tests/baselines/reference/underscoreMapFirst.symbols @@ -17,7 +17,7 @@ declare module _ { >T : Symbol(T, Decl(underscoreMapFirst.ts, 2, 19)) length: number; ->length : Symbol(length, Decl(underscoreMapFirst.ts, 3, 27)) +>length : Symbol(List.length, Decl(underscoreMapFirst.ts, 3, 27)) } interface ListIterator { @@ -89,14 +89,14 @@ declare class View { >View : Symbol(View, Decl(underscoreMapFirst.ts, 24, 1)) model: any; ->model : Symbol(model, Decl(underscoreMapFirst.ts, 26, 20)) +>model : Symbol(View.model, Decl(underscoreMapFirst.ts, 26, 20)) } interface IData { >IData : Symbol(IData, Decl(underscoreMapFirst.ts, 28, 1)) series: ISeries[]; ->series : Symbol(series, Decl(underscoreMapFirst.ts, 30, 17)) +>series : Symbol(IData.series, Decl(underscoreMapFirst.ts, 30, 17)) >ISeries : Symbol(ISeries, Decl(underscoreMapFirst.ts, 32, 1)) } @@ -104,10 +104,10 @@ interface ISeries { >ISeries : Symbol(ISeries, Decl(underscoreMapFirst.ts, 32, 1)) items: any[]; ->items : Symbol(items, Decl(underscoreMapFirst.ts, 34, 19)) +>items : Symbol(ISeries.items, Decl(underscoreMapFirst.ts, 34, 19)) key: string; ->key : Symbol(key, Decl(underscoreMapFirst.ts, 35, 17)) +>key : Symbol(ISeries.key, Decl(underscoreMapFirst.ts, 35, 17)) } class MyView extends View { @@ -115,7 +115,7 @@ class MyView extends View { >View : Symbol(View, Decl(underscoreMapFirst.ts, 24, 1)) public getDataSeries(): ISeries[] { ->getDataSeries : Symbol(getDataSeries, Decl(underscoreMapFirst.ts, 39, 27)) +>getDataSeries : Symbol(MyView.getDataSeries, Decl(underscoreMapFirst.ts, 39, 27)) >ISeries : Symbol(ISeries, Decl(underscoreMapFirst.ts, 32, 1)) var data: IData[] = this.model.get("data"); diff --git a/tests/baselines/reference/underscoreTest1.symbols b/tests/baselines/reference/underscoreTest1.symbols index 9de509de417..3506f23510e 100644 --- a/tests/baselines/reference/underscoreTest1.symbols +++ b/tests/baselines/reference/underscoreTest1.symbols @@ -71,9 +71,9 @@ var flat = _.reduceRight(list, (a, b) => a.concat(b), []); >list : Symbol(list, Decl(underscoreTest1_underscoreTests.ts, 13, 3)) >a : Symbol(a, Decl(underscoreTest1_underscoreTests.ts, 14, 32)) >b : Symbol(b, Decl(underscoreTest1_underscoreTests.ts, 14, 34)) ->a.concat : Symbol(Array.concat, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>a.concat : Symbol(Array.concat, Decl(lib.d.ts, --, --)) >a : Symbol(a, Decl(underscoreTest1_underscoreTests.ts, 14, 32)) ->concat : Symbol(Array.concat, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>concat : Symbol(Array.concat, Decl(lib.d.ts, --, --)) >b : Symbol(b, Decl(underscoreTest1_underscoreTests.ts, 14, 34)) var even = _.find([1, 2, 3, 4, 5, 6], (num) => num % 2 == 0); @@ -437,7 +437,7 @@ var log = _.bind((message?: string, ...rest: string[]) => { }, Date); >bind : Symbol(Underscore.Static.bind, Decl(underscoreTest1_underscore.ts, 548, 68), Decl(underscoreTest1_underscore.ts, 550, 58)) >message : Symbol(message, Decl(underscoreTest1_underscoreTests.ts, 108, 18)) >rest : Symbol(rest, Decl(underscoreTest1_underscoreTests.ts, 108, 35)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) _.delay(log, 1000, 'logged later'); >_.delay : Symbol(Underscore.Static.delay, Decl(underscoreTest1_underscore.ts, 557, 73)) @@ -782,7 +782,7 @@ _.isDate(new Date()); >_.isDate : Symbol(Underscore.Static.isDate, Decl(underscoreTest1_underscore.ts, 611, 40)) >_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) >isDate : Symbol(Underscore.Static.isDate, Decl(underscoreTest1_underscore.ts, 611, 40)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) _.isRegExp(/moe/); >_.isRegExp : Symbol(Underscore.Static.isRegExp, Decl(underscoreTest1_underscore.ts, 612, 37)) @@ -1063,110 +1063,110 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 31, 35)) keys(): string[]; ->keys : Symbol(keys, Decl(underscoreTest1_underscore.ts, 31, 39)) +>keys : Symbol(WrappedObject.keys, Decl(underscoreTest1_underscore.ts, 31, 39)) values(): any[]; ->values : Symbol(values, Decl(underscoreTest1_underscore.ts, 32, 25)) +>values : Symbol(WrappedObject.values, Decl(underscoreTest1_underscore.ts, 32, 25)) pairs(): any[][]; ->pairs : Symbol(pairs, Decl(underscoreTest1_underscore.ts, 33, 24)) +>pairs : Symbol(WrappedObject.pairs, Decl(underscoreTest1_underscore.ts, 33, 24)) invert(): any; ->invert : Symbol(invert, Decl(underscoreTest1_underscore.ts, 34, 25)) +>invert : Symbol(WrappedObject.invert, Decl(underscoreTest1_underscore.ts, 34, 25)) functions(): string[]; ->functions : Symbol(functions, Decl(underscoreTest1_underscore.ts, 35, 22)) +>functions : Symbol(WrappedObject.functions, Decl(underscoreTest1_underscore.ts, 35, 22)) methods(): string[]; ->methods : Symbol(methods, Decl(underscoreTest1_underscore.ts, 36, 30)) +>methods : Symbol(WrappedObject.methods, Decl(underscoreTest1_underscore.ts, 36, 30)) extend(...sources: any[]): T; ->extend : Symbol(extend, Decl(underscoreTest1_underscore.ts, 37, 28)) +>extend : Symbol(WrappedObject.extend, Decl(underscoreTest1_underscore.ts, 37, 28)) >sources : Symbol(sources, Decl(underscoreTest1_underscore.ts, 38, 15)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 31, 35)) pick(...keys: string[]): T; ->pick : Symbol(pick, Decl(underscoreTest1_underscore.ts, 38, 37)) +>pick : Symbol(WrappedObject.pick, Decl(underscoreTest1_underscore.ts, 38, 37)) >keys : Symbol(keys, Decl(underscoreTest1_underscore.ts, 39, 13)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 31, 35)) omit(...keys: string[]): T; ->omit : Symbol(omit, Decl(underscoreTest1_underscore.ts, 39, 35)) +>omit : Symbol(WrappedObject.omit, Decl(underscoreTest1_underscore.ts, 39, 35)) >keys : Symbol(keys, Decl(underscoreTest1_underscore.ts, 40, 13)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 31, 35)) defaults(...defaults: any[]): T; ->defaults : Symbol(defaults, Decl(underscoreTest1_underscore.ts, 40, 35)) +>defaults : Symbol(WrappedObject.defaults, Decl(underscoreTest1_underscore.ts, 40, 35)) >defaults : Symbol(defaults, Decl(underscoreTest1_underscore.ts, 41, 17)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 31, 35)) clone(): T; ->clone : Symbol(clone, Decl(underscoreTest1_underscore.ts, 41, 40)) +>clone : Symbol(WrappedObject.clone, Decl(underscoreTest1_underscore.ts, 41, 40)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 31, 35)) tap(interceptor: (object: T) => void): T; ->tap : Symbol(tap, Decl(underscoreTest1_underscore.ts, 42, 19)) +>tap : Symbol(WrappedObject.tap, Decl(underscoreTest1_underscore.ts, 42, 19)) >interceptor : Symbol(interceptor, Decl(underscoreTest1_underscore.ts, 43, 12)) >object : Symbol(object, Decl(underscoreTest1_underscore.ts, 43, 26)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 31, 35)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 31, 35)) has(key: string): boolean; ->has : Symbol(has, Decl(underscoreTest1_underscore.ts, 43, 49)) +>has : Symbol(WrappedObject.has, Decl(underscoreTest1_underscore.ts, 43, 49)) >key : Symbol(key, Decl(underscoreTest1_underscore.ts, 44, 12)) isEqual(other: T): boolean; ->isEqual : Symbol(isEqual, Decl(underscoreTest1_underscore.ts, 44, 34)) +>isEqual : Symbol(WrappedObject.isEqual, Decl(underscoreTest1_underscore.ts, 44, 34)) >other : Symbol(other, Decl(underscoreTest1_underscore.ts, 45, 16)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 31, 35)) isEmpty(): boolean; ->isEmpty : Symbol(isEmpty, Decl(underscoreTest1_underscore.ts, 45, 35)) +>isEmpty : Symbol(WrappedObject.isEmpty, Decl(underscoreTest1_underscore.ts, 45, 35)) isElement(): boolean; ->isElement : Symbol(isElement, Decl(underscoreTest1_underscore.ts, 46, 27)) +>isElement : Symbol(WrappedObject.isElement, Decl(underscoreTest1_underscore.ts, 46, 27)) isArray(): boolean; ->isArray : Symbol(isArray, Decl(underscoreTest1_underscore.ts, 47, 29)) +>isArray : Symbol(WrappedObject.isArray, Decl(underscoreTest1_underscore.ts, 47, 29)) isObject(): boolean; ->isObject : Symbol(isObject, Decl(underscoreTest1_underscore.ts, 48, 27)) +>isObject : Symbol(WrappedObject.isObject, Decl(underscoreTest1_underscore.ts, 48, 27)) isArguments(): boolean; ->isArguments : Symbol(isArguments, Decl(underscoreTest1_underscore.ts, 49, 28)) +>isArguments : Symbol(WrappedObject.isArguments, Decl(underscoreTest1_underscore.ts, 49, 28)) isFunction(): boolean; ->isFunction : Symbol(isFunction, Decl(underscoreTest1_underscore.ts, 50, 31)) +>isFunction : Symbol(WrappedObject.isFunction, Decl(underscoreTest1_underscore.ts, 50, 31)) isString(): boolean; ->isString : Symbol(isString, Decl(underscoreTest1_underscore.ts, 51, 30)) +>isString : Symbol(WrappedObject.isString, Decl(underscoreTest1_underscore.ts, 51, 30)) isNumber(): boolean; ->isNumber : Symbol(isNumber, Decl(underscoreTest1_underscore.ts, 52, 28)) +>isNumber : Symbol(WrappedObject.isNumber, Decl(underscoreTest1_underscore.ts, 52, 28)) isFinite(): boolean; ->isFinite : Symbol(isFinite, Decl(underscoreTest1_underscore.ts, 53, 28)) +>isFinite : Symbol(WrappedObject.isFinite, Decl(underscoreTest1_underscore.ts, 53, 28)) isBoolean(): boolean; ->isBoolean : Symbol(isBoolean, Decl(underscoreTest1_underscore.ts, 54, 28)) +>isBoolean : Symbol(WrappedObject.isBoolean, Decl(underscoreTest1_underscore.ts, 54, 28)) isDate(): boolean; ->isDate : Symbol(isDate, Decl(underscoreTest1_underscore.ts, 55, 29)) +>isDate : Symbol(WrappedObject.isDate, Decl(underscoreTest1_underscore.ts, 55, 29)) isRegExp(): boolean; ->isRegExp : Symbol(isRegExp, Decl(underscoreTest1_underscore.ts, 56, 26)) +>isRegExp : Symbol(WrappedObject.isRegExp, Decl(underscoreTest1_underscore.ts, 56, 26)) isNaN(): boolean; ->isNaN : Symbol(isNaN, Decl(underscoreTest1_underscore.ts, 57, 28)) +>isNaN : Symbol(WrappedObject.isNaN, Decl(underscoreTest1_underscore.ts, 57, 28)) isNull(): boolean; ->isNull : Symbol(isNull, Decl(underscoreTest1_underscore.ts, 58, 25)) +>isNull : Symbol(WrappedObject.isNull, Decl(underscoreTest1_underscore.ts, 58, 25)) isUndefined(): boolean; ->isUndefined : Symbol(isUndefined, Decl(underscoreTest1_underscore.ts, 59, 26)) +>isUndefined : Symbol(WrappedObject.isUndefined, Decl(underscoreTest1_underscore.ts, 59, 26)) value(): T; ->value : Symbol(value, Decl(underscoreTest1_underscore.ts, 60, 31)) +>value : Symbol(WrappedObject.value, Decl(underscoreTest1_underscore.ts, 60, 31)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 31, 35)) } @@ -1178,58 +1178,58 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 64, 37)) bind(object: any): T; ->bind : Symbol(bind, Decl(underscoreTest1_underscore.ts, 64, 83), Decl(underscoreTest1_underscore.ts, 65, 29)) +>bind : Symbol(WrappedFunction.bind, Decl(underscoreTest1_underscore.ts, 64, 83), Decl(underscoreTest1_underscore.ts, 65, 29)) >object : Symbol(object, Decl(underscoreTest1_underscore.ts, 65, 13)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 64, 37)) bind(object: any, ...args: any[]): Function; ->bind : Symbol(bind, Decl(underscoreTest1_underscore.ts, 64, 83), Decl(underscoreTest1_underscore.ts, 65, 29)) +>bind : Symbol(WrappedFunction.bind, Decl(underscoreTest1_underscore.ts, 64, 83), Decl(underscoreTest1_underscore.ts, 65, 29)) >object : Symbol(object, Decl(underscoreTest1_underscore.ts, 66, 13)) >args : Symbol(args, Decl(underscoreTest1_underscore.ts, 66, 25)) >Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) bindAll(...methodNames: string[]): T; ->bindAll : Symbol(bindAll, Decl(underscoreTest1_underscore.ts, 66, 52)) +>bindAll : Symbol(WrappedFunction.bindAll, Decl(underscoreTest1_underscore.ts, 66, 52)) >methodNames : Symbol(methodNames, Decl(underscoreTest1_underscore.ts, 67, 16)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 64, 37)) partial(...args: any[]): Function; ->partial : Symbol(partial, Decl(underscoreTest1_underscore.ts, 67, 45)) +>partial : Symbol(WrappedFunction.partial, Decl(underscoreTest1_underscore.ts, 67, 45)) >args : Symbol(args, Decl(underscoreTest1_underscore.ts, 68, 16)) >Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) memoize(hashFunction?: Function): T; ->memoize : Symbol(memoize, Decl(underscoreTest1_underscore.ts, 68, 42)) +>memoize : Symbol(WrappedFunction.memoize, Decl(underscoreTest1_underscore.ts, 68, 42)) >hashFunction : Symbol(hashFunction, Decl(underscoreTest1_underscore.ts, 69, 16)) >Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 64, 37)) delay(wait: number, ...args: any[]): number; ->delay : Symbol(delay, Decl(underscoreTest1_underscore.ts, 69, 44)) +>delay : Symbol(WrappedFunction.delay, Decl(underscoreTest1_underscore.ts, 69, 44)) >wait : Symbol(wait, Decl(underscoreTest1_underscore.ts, 70, 14)) >args : Symbol(args, Decl(underscoreTest1_underscore.ts, 70, 27)) defer(...args: any[]): number; ->defer : Symbol(defer, Decl(underscoreTest1_underscore.ts, 70, 52)) +>defer : Symbol(WrappedFunction.defer, Decl(underscoreTest1_underscore.ts, 70, 52)) >args : Symbol(args, Decl(underscoreTest1_underscore.ts, 71, 14)) throttle(wait: number): T; ->throttle : Symbol(throttle, Decl(underscoreTest1_underscore.ts, 71, 38)) +>throttle : Symbol(WrappedFunction.throttle, Decl(underscoreTest1_underscore.ts, 71, 38)) >wait : Symbol(wait, Decl(underscoreTest1_underscore.ts, 72, 17)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 64, 37)) debounce(wait: number, immediate?: boolean): T; ->debounce : Symbol(debounce, Decl(underscoreTest1_underscore.ts, 72, 34)) +>debounce : Symbol(WrappedFunction.debounce, Decl(underscoreTest1_underscore.ts, 72, 34)) >wait : Symbol(wait, Decl(underscoreTest1_underscore.ts, 73, 17)) >immediate : Symbol(immediate, Decl(underscoreTest1_underscore.ts, 73, 30)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 64, 37)) once(): T; ->once : Symbol(once, Decl(underscoreTest1_underscore.ts, 73, 55)) +>once : Symbol(WrappedFunction.once, Decl(underscoreTest1_underscore.ts, 73, 55)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 64, 37)) wrap(wrapper: (func: T, ...args: any[]) => any): T; ->wrap : Symbol(wrap, Decl(underscoreTest1_underscore.ts, 74, 18)) +>wrap : Symbol(WrappedFunction.wrap, Decl(underscoreTest1_underscore.ts, 74, 18)) >wrapper : Symbol(wrapper, Decl(underscoreTest1_underscore.ts, 75, 13)) >func : Symbol(func, Decl(underscoreTest1_underscore.ts, 75, 23)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 64, 37)) @@ -1237,7 +1237,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 64, 37)) compose(...funcs: Function[]): Function; ->compose : Symbol(compose, Decl(underscoreTest1_underscore.ts, 75, 59)) +>compose : Symbol(WrappedFunction.compose, Decl(underscoreTest1_underscore.ts, 75, 59)) >funcs : Symbol(funcs, Decl(underscoreTest1_underscore.ts, 76, 16)) >Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) @@ -1251,21 +1251,21 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) each(iterator: Iterator, context?: any): void; ->each : Symbol(each, Decl(underscoreTest1_underscore.ts, 79, 70)) +>each : Symbol(WrappedArray.each, Decl(underscoreTest1_underscore.ts, 79, 70)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 80, 13)) >Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) >context : Symbol(context, Decl(underscoreTest1_underscore.ts, 80, 41)) forEach(iterator: Iterator, context?: any): void; ->forEach : Symbol(forEach, Decl(underscoreTest1_underscore.ts, 80, 63)) +>forEach : Symbol(WrappedArray.forEach, Decl(underscoreTest1_underscore.ts, 80, 63)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 81, 16)) >Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) >context : Symbol(context, Decl(underscoreTest1_underscore.ts, 81, 44)) map(iterator: Iterator, context?: any): U[]; ->map : Symbol(map, Decl(underscoreTest1_underscore.ts, 81, 66)) +>map : Symbol(WrappedArray.map, Decl(underscoreTest1_underscore.ts, 81, 66)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 82, 12)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 82, 15)) >Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) @@ -1275,7 +1275,7 @@ module Underscore { >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 82, 12)) collect(iterator: Iterator, context?: any): U[]; ->collect : Symbol(collect, Decl(underscoreTest1_underscore.ts, 82, 61)) +>collect : Symbol(WrappedArray.collect, Decl(underscoreTest1_underscore.ts, 82, 61)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 83, 16)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 83, 19)) >Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) @@ -1285,7 +1285,7 @@ module Underscore { >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 83, 16)) reduce(iterator: Reducer, initialValue?: T, context?: any): T; ->reduce : Symbol(reduce, Decl(underscoreTest1_underscore.ts, 83, 65), Decl(underscoreTest1_underscore.ts, 84, 76)) +>reduce : Symbol(WrappedArray.reduce, Decl(underscoreTest1_underscore.ts, 83, 65), Decl(underscoreTest1_underscore.ts, 84, 76)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 84, 15)) >Reducer : Symbol(Reducer, Decl(underscoreTest1_underscore.ts, 6, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) @@ -1296,7 +1296,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) reduce(iterator: Reducer, initialValue: U, context?: any): U; ->reduce : Symbol(reduce, Decl(underscoreTest1_underscore.ts, 83, 65), Decl(underscoreTest1_underscore.ts, 84, 76)) +>reduce : Symbol(WrappedArray.reduce, Decl(underscoreTest1_underscore.ts, 83, 65), Decl(underscoreTest1_underscore.ts, 84, 76)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 85, 15)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 85, 18)) >Reducer : Symbol(Reducer, Decl(underscoreTest1_underscore.ts, 6, 1)) @@ -1308,7 +1308,7 @@ module Underscore { >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 85, 15)) foldl(iterator: Reducer, initialValue?: T, context?: any): T; ->foldl : Symbol(foldl, Decl(underscoreTest1_underscore.ts, 85, 78), Decl(underscoreTest1_underscore.ts, 86, 75)) +>foldl : Symbol(WrappedArray.foldl, Decl(underscoreTest1_underscore.ts, 85, 78), Decl(underscoreTest1_underscore.ts, 86, 75)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 86, 14)) >Reducer : Symbol(Reducer, Decl(underscoreTest1_underscore.ts, 6, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) @@ -1319,7 +1319,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) foldl(iterator: Reducer, initialValue: U, context?: any): U; ->foldl : Symbol(foldl, Decl(underscoreTest1_underscore.ts, 85, 78), Decl(underscoreTest1_underscore.ts, 86, 75)) +>foldl : Symbol(WrappedArray.foldl, Decl(underscoreTest1_underscore.ts, 85, 78), Decl(underscoreTest1_underscore.ts, 86, 75)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 87, 14)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 87, 17)) >Reducer : Symbol(Reducer, Decl(underscoreTest1_underscore.ts, 6, 1)) @@ -1331,7 +1331,7 @@ module Underscore { >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 87, 14)) inject(iterator: Reducer, initialValue?: T, context?: any): T; ->inject : Symbol(inject, Decl(underscoreTest1_underscore.ts, 87, 77), Decl(underscoreTest1_underscore.ts, 88, 76)) +>inject : Symbol(WrappedArray.inject, Decl(underscoreTest1_underscore.ts, 87, 77), Decl(underscoreTest1_underscore.ts, 88, 76)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 88, 15)) >Reducer : Symbol(Reducer, Decl(underscoreTest1_underscore.ts, 6, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) @@ -1342,7 +1342,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) inject(iterator: Reducer, initialValue: U, context?: any): U; ->inject : Symbol(inject, Decl(underscoreTest1_underscore.ts, 87, 77), Decl(underscoreTest1_underscore.ts, 88, 76)) +>inject : Symbol(WrappedArray.inject, Decl(underscoreTest1_underscore.ts, 87, 77), Decl(underscoreTest1_underscore.ts, 88, 76)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 89, 15)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 89, 18)) >Reducer : Symbol(Reducer, Decl(underscoreTest1_underscore.ts, 6, 1)) @@ -1354,7 +1354,7 @@ module Underscore { >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 89, 15)) reduceRight(iterator: Reducer, initialValue?: T, context?: any): T; ->reduceRight : Symbol(reduceRight, Decl(underscoreTest1_underscore.ts, 89, 78), Decl(underscoreTest1_underscore.ts, 90, 81)) +>reduceRight : Symbol(WrappedArray.reduceRight, Decl(underscoreTest1_underscore.ts, 89, 78), Decl(underscoreTest1_underscore.ts, 90, 81)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 90, 20)) >Reducer : Symbol(Reducer, Decl(underscoreTest1_underscore.ts, 6, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) @@ -1365,7 +1365,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) reduceRight(iterator: Reducer, initialValue: U, context?: any): U; ->reduceRight : Symbol(reduceRight, Decl(underscoreTest1_underscore.ts, 89, 78), Decl(underscoreTest1_underscore.ts, 90, 81)) +>reduceRight : Symbol(WrappedArray.reduceRight, Decl(underscoreTest1_underscore.ts, 89, 78), Decl(underscoreTest1_underscore.ts, 90, 81)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 91, 20)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 91, 23)) >Reducer : Symbol(Reducer, Decl(underscoreTest1_underscore.ts, 6, 1)) @@ -1377,7 +1377,7 @@ module Underscore { >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 91, 20)) foldr(iterator: Reducer, initialValue?: T, context?: any): T; ->foldr : Symbol(foldr, Decl(underscoreTest1_underscore.ts, 91, 83), Decl(underscoreTest1_underscore.ts, 92, 75)) +>foldr : Symbol(WrappedArray.foldr, Decl(underscoreTest1_underscore.ts, 91, 83), Decl(underscoreTest1_underscore.ts, 92, 75)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 92, 14)) >Reducer : Symbol(Reducer, Decl(underscoreTest1_underscore.ts, 6, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) @@ -1388,7 +1388,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) foldr(iterator: Reducer, initialValue: U, context?: any): U; ->foldr : Symbol(foldr, Decl(underscoreTest1_underscore.ts, 91, 83), Decl(underscoreTest1_underscore.ts, 92, 75)) +>foldr : Symbol(WrappedArray.foldr, Decl(underscoreTest1_underscore.ts, 91, 83), Decl(underscoreTest1_underscore.ts, 92, 75)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 93, 14)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 93, 17)) >Reducer : Symbol(Reducer, Decl(underscoreTest1_underscore.ts, 6, 1)) @@ -1400,7 +1400,7 @@ module Underscore { >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 93, 14)) find(iterator: Iterator, context?: any): T; ->find : Symbol(find, Decl(underscoreTest1_underscore.ts, 93, 77)) +>find : Symbol(WrappedArray.find, Decl(underscoreTest1_underscore.ts, 93, 77)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 94, 13)) >Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) @@ -1408,7 +1408,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) detect(iterator: Iterator, context?: any): T; ->detect : Symbol(detect, Decl(underscoreTest1_underscore.ts, 94, 63)) +>detect : Symbol(WrappedArray.detect, Decl(underscoreTest1_underscore.ts, 94, 63)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 95, 15)) >Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) @@ -1416,7 +1416,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) filter(iterator: Iterator, context?: any): T[]; ->filter : Symbol(filter, Decl(underscoreTest1_underscore.ts, 95, 65)) +>filter : Symbol(WrappedArray.filter, Decl(underscoreTest1_underscore.ts, 95, 65)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 96, 15)) >Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) @@ -1424,7 +1424,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) select(iterator: Iterator, context?: any): T[]; ->select : Symbol(select, Decl(underscoreTest1_underscore.ts, 96, 67)) +>select : Symbol(WrappedArray.select, Decl(underscoreTest1_underscore.ts, 96, 67)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 97, 15)) >Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) @@ -1432,19 +1432,19 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) where(properties: Object): T[]; ->where : Symbol(where, Decl(underscoreTest1_underscore.ts, 97, 67)) +>where : Symbol(WrappedArray.where, Decl(underscoreTest1_underscore.ts, 97, 67)) >properties : Symbol(properties, Decl(underscoreTest1_underscore.ts, 98, 14)) >Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) findWhere(properties: Object): T; ->findWhere : Symbol(findWhere, Decl(underscoreTest1_underscore.ts, 98, 39)) +>findWhere : Symbol(WrappedArray.findWhere, Decl(underscoreTest1_underscore.ts, 98, 39)) >properties : Symbol(properties, Decl(underscoreTest1_underscore.ts, 99, 18)) >Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) reject(iterator: Iterator, context?: any): T[]; ->reject : Symbol(reject, Decl(underscoreTest1_underscore.ts, 99, 41)) +>reject : Symbol(WrappedArray.reject, Decl(underscoreTest1_underscore.ts, 99, 41)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 100, 15)) >Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) @@ -1452,54 +1452,54 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) every(iterator?: Iterator, context?: any): boolean; ->every : Symbol(every, Decl(underscoreTest1_underscore.ts, 100, 67)) +>every : Symbol(WrappedArray.every, Decl(underscoreTest1_underscore.ts, 100, 67)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 101, 14)) >Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) >context : Symbol(context, Decl(underscoreTest1_underscore.ts, 101, 46)) all(iterator?: Iterator, context?: any): boolean; ->all : Symbol(all, Decl(underscoreTest1_underscore.ts, 101, 71)) +>all : Symbol(WrappedArray.all, Decl(underscoreTest1_underscore.ts, 101, 71)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 102, 12)) >Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) >context : Symbol(context, Decl(underscoreTest1_underscore.ts, 102, 44)) some(iterator?: Iterator, context?: any): boolean; ->some : Symbol(some, Decl(underscoreTest1_underscore.ts, 102, 69)) +>some : Symbol(WrappedArray.some, Decl(underscoreTest1_underscore.ts, 102, 69)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 103, 13)) >Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) >context : Symbol(context, Decl(underscoreTest1_underscore.ts, 103, 45)) any(iterator?: Iterator, context?: any): boolean; ->any : Symbol(any, Decl(underscoreTest1_underscore.ts, 103, 70)) +>any : Symbol(WrappedArray.any, Decl(underscoreTest1_underscore.ts, 103, 70)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 104, 12)) >Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) >context : Symbol(context, Decl(underscoreTest1_underscore.ts, 104, 44)) contains(value: T): boolean; ->contains : Symbol(contains, Decl(underscoreTest1_underscore.ts, 104, 69)) +>contains : Symbol(WrappedArray.contains, Decl(underscoreTest1_underscore.ts, 104, 69)) >value : Symbol(value, Decl(underscoreTest1_underscore.ts, 105, 17)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) include(value: T): boolean; ->include : Symbol(include, Decl(underscoreTest1_underscore.ts, 105, 36)) +>include : Symbol(WrappedArray.include, Decl(underscoreTest1_underscore.ts, 105, 36)) >value : Symbol(value, Decl(underscoreTest1_underscore.ts, 106, 16)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) invoke(methodName: string, ...args: any[]): any[]; ->invoke : Symbol(invoke, Decl(underscoreTest1_underscore.ts, 106, 35)) +>invoke : Symbol(WrappedArray.invoke, Decl(underscoreTest1_underscore.ts, 106, 35)) >methodName : Symbol(methodName, Decl(underscoreTest1_underscore.ts, 107, 15)) >args : Symbol(args, Decl(underscoreTest1_underscore.ts, 107, 34)) pluck(propertyName: string): any[]; ->pluck : Symbol(pluck, Decl(underscoreTest1_underscore.ts, 107, 58)) +>pluck : Symbol(WrappedArray.pluck, Decl(underscoreTest1_underscore.ts, 107, 58)) >propertyName : Symbol(propertyName, Decl(underscoreTest1_underscore.ts, 108, 14)) max(iterator?: Iterator, context?: any): T; ->max : Symbol(max, Decl(underscoreTest1_underscore.ts, 108, 43)) +>max : Symbol(WrappedArray.max, Decl(underscoreTest1_underscore.ts, 108, 43)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 109, 12)) >Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) @@ -1507,7 +1507,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) min(iterator?: Iterator, context?: any): T; ->min : Symbol(min, Decl(underscoreTest1_underscore.ts, 109, 59)) +>min : Symbol(WrappedArray.min, Decl(underscoreTest1_underscore.ts, 109, 59)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 110, 12)) >Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) @@ -1515,7 +1515,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) sortBy(iterator: Iterator, context?: any): T[]; ->sortBy : Symbol(sortBy, Decl(underscoreTest1_underscore.ts, 110, 59), Decl(underscoreTest1_underscore.ts, 111, 63)) +>sortBy : Symbol(WrappedArray.sortBy, Decl(underscoreTest1_underscore.ts, 110, 59), Decl(underscoreTest1_underscore.ts, 111, 63)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 111, 15)) >Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) @@ -1523,12 +1523,12 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) sortBy(propertyName: string): T[]; ->sortBy : Symbol(sortBy, Decl(underscoreTest1_underscore.ts, 110, 59), Decl(underscoreTest1_underscore.ts, 111, 63)) +>sortBy : Symbol(WrappedArray.sortBy, Decl(underscoreTest1_underscore.ts, 110, 59), Decl(underscoreTest1_underscore.ts, 111, 63)) >propertyName : Symbol(propertyName, Decl(underscoreTest1_underscore.ts, 112, 15)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) groupBy(iterator?: Iterator, context?: any): Dictionary; ->groupBy : Symbol(groupBy, Decl(underscoreTest1_underscore.ts, 112, 42), Decl(underscoreTest1_underscore.ts, 113, 77)) +>groupBy : Symbol(WrappedArray.groupBy, Decl(underscoreTest1_underscore.ts, 112, 42), Decl(underscoreTest1_underscore.ts, 113, 77)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 113, 16)) >Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) @@ -1537,13 +1537,13 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) groupBy(propertyName: string): Dictionary; ->groupBy : Symbol(groupBy, Decl(underscoreTest1_underscore.ts, 112, 42), Decl(underscoreTest1_underscore.ts, 113, 77)) +>groupBy : Symbol(WrappedArray.groupBy, Decl(underscoreTest1_underscore.ts, 112, 42), Decl(underscoreTest1_underscore.ts, 113, 77)) >propertyName : Symbol(propertyName, Decl(underscoreTest1_underscore.ts, 114, 16)) >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) countBy(iterator?: Iterator, context?: any): Dictionary; ->countBy : Symbol(countBy, Decl(underscoreTest1_underscore.ts, 114, 55), Decl(underscoreTest1_underscore.ts, 115, 80)) +>countBy : Symbol(WrappedArray.countBy, Decl(underscoreTest1_underscore.ts, 114, 55), Decl(underscoreTest1_underscore.ts, 115, 80)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 115, 16)) >Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) @@ -1551,112 +1551,112 @@ module Underscore { >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) countBy(propertyName: string): Dictionary; ->countBy : Symbol(countBy, Decl(underscoreTest1_underscore.ts, 114, 55), Decl(underscoreTest1_underscore.ts, 115, 80)) +>countBy : Symbol(WrappedArray.countBy, Decl(underscoreTest1_underscore.ts, 114, 55), Decl(underscoreTest1_underscore.ts, 115, 80)) >propertyName : Symbol(propertyName, Decl(underscoreTest1_underscore.ts, 116, 16)) >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) shuffle(): T[]; ->shuffle : Symbol(shuffle, Decl(underscoreTest1_underscore.ts, 116, 58)) +>shuffle : Symbol(WrappedArray.shuffle, Decl(underscoreTest1_underscore.ts, 116, 58)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) toArray(): T[]; ->toArray : Symbol(toArray, Decl(underscoreTest1_underscore.ts, 117, 23)) +>toArray : Symbol(WrappedArray.toArray, Decl(underscoreTest1_underscore.ts, 117, 23)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) size(): number; ->size : Symbol(size, Decl(underscoreTest1_underscore.ts, 118, 23)) +>size : Symbol(WrappedArray.size, Decl(underscoreTest1_underscore.ts, 118, 23)) first(): T; ->first : Symbol(first, Decl(underscoreTest1_underscore.ts, 119, 23), Decl(underscoreTest1_underscore.ts, 120, 19)) +>first : Symbol(WrappedArray.first, Decl(underscoreTest1_underscore.ts, 119, 23), Decl(underscoreTest1_underscore.ts, 120, 19)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) first(count: number): T[]; ->first : Symbol(first, Decl(underscoreTest1_underscore.ts, 119, 23), Decl(underscoreTest1_underscore.ts, 120, 19)) +>first : Symbol(WrappedArray.first, Decl(underscoreTest1_underscore.ts, 119, 23), Decl(underscoreTest1_underscore.ts, 120, 19)) >count : Symbol(count, Decl(underscoreTest1_underscore.ts, 121, 14)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) head(): T; ->head : Symbol(head, Decl(underscoreTest1_underscore.ts, 121, 34), Decl(underscoreTest1_underscore.ts, 122, 18)) +>head : Symbol(WrappedArray.head, Decl(underscoreTest1_underscore.ts, 121, 34), Decl(underscoreTest1_underscore.ts, 122, 18)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) head(count: number): T[]; ->head : Symbol(head, Decl(underscoreTest1_underscore.ts, 121, 34), Decl(underscoreTest1_underscore.ts, 122, 18)) +>head : Symbol(WrappedArray.head, Decl(underscoreTest1_underscore.ts, 121, 34), Decl(underscoreTest1_underscore.ts, 122, 18)) >count : Symbol(count, Decl(underscoreTest1_underscore.ts, 123, 13)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) take(): T; ->take : Symbol(take, Decl(underscoreTest1_underscore.ts, 123, 33), Decl(underscoreTest1_underscore.ts, 124, 18)) +>take : Symbol(WrappedArray.take, Decl(underscoreTest1_underscore.ts, 123, 33), Decl(underscoreTest1_underscore.ts, 124, 18)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) take(count: number): T[]; ->take : Symbol(take, Decl(underscoreTest1_underscore.ts, 123, 33), Decl(underscoreTest1_underscore.ts, 124, 18)) +>take : Symbol(WrappedArray.take, Decl(underscoreTest1_underscore.ts, 123, 33), Decl(underscoreTest1_underscore.ts, 124, 18)) >count : Symbol(count, Decl(underscoreTest1_underscore.ts, 125, 13)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) initial(): T; ->initial : Symbol(initial, Decl(underscoreTest1_underscore.ts, 125, 33), Decl(underscoreTest1_underscore.ts, 126, 21)) +>initial : Symbol(WrappedArray.initial, Decl(underscoreTest1_underscore.ts, 125, 33), Decl(underscoreTest1_underscore.ts, 126, 21)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) initial(count: number): T[]; ->initial : Symbol(initial, Decl(underscoreTest1_underscore.ts, 125, 33), Decl(underscoreTest1_underscore.ts, 126, 21)) +>initial : Symbol(WrappedArray.initial, Decl(underscoreTest1_underscore.ts, 125, 33), Decl(underscoreTest1_underscore.ts, 126, 21)) >count : Symbol(count, Decl(underscoreTest1_underscore.ts, 127, 16)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) last(): T; ->last : Symbol(last, Decl(underscoreTest1_underscore.ts, 127, 36), Decl(underscoreTest1_underscore.ts, 128, 18)) +>last : Symbol(WrappedArray.last, Decl(underscoreTest1_underscore.ts, 127, 36), Decl(underscoreTest1_underscore.ts, 128, 18)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) last(count: number): T[]; ->last : Symbol(last, Decl(underscoreTest1_underscore.ts, 127, 36), Decl(underscoreTest1_underscore.ts, 128, 18)) +>last : Symbol(WrappedArray.last, Decl(underscoreTest1_underscore.ts, 127, 36), Decl(underscoreTest1_underscore.ts, 128, 18)) >count : Symbol(count, Decl(underscoreTest1_underscore.ts, 129, 13)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) rest(index?: number): T[]; ->rest : Symbol(rest, Decl(underscoreTest1_underscore.ts, 129, 33)) +>rest : Symbol(WrappedArray.rest, Decl(underscoreTest1_underscore.ts, 129, 33)) >index : Symbol(index, Decl(underscoreTest1_underscore.ts, 130, 13)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) compact(): T[]; ->compact : Symbol(compact, Decl(underscoreTest1_underscore.ts, 130, 34)) +>compact : Symbol(WrappedArray.compact, Decl(underscoreTest1_underscore.ts, 130, 34)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) flatten(shallow?: boolean): U[]; ->flatten : Symbol(flatten, Decl(underscoreTest1_underscore.ts, 131, 23)) +>flatten : Symbol(WrappedArray.flatten, Decl(underscoreTest1_underscore.ts, 131, 23)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 132, 16)) >shallow : Symbol(shallow, Decl(underscoreTest1_underscore.ts, 132, 19)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 132, 16)) without(...values: T[]): T[]; ->without : Symbol(without, Decl(underscoreTest1_underscore.ts, 132, 43)) +>without : Symbol(WrappedArray.without, Decl(underscoreTest1_underscore.ts, 132, 43)) >values : Symbol(values, Decl(underscoreTest1_underscore.ts, 133, 16)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) union(...arrays: T[][]): T[]; ->union : Symbol(union, Decl(underscoreTest1_underscore.ts, 133, 37)) +>union : Symbol(WrappedArray.union, Decl(underscoreTest1_underscore.ts, 133, 37)) >arrays : Symbol(arrays, Decl(underscoreTest1_underscore.ts, 134, 14)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) intersection(...arrays: T[][]): T[]; ->intersection : Symbol(intersection, Decl(underscoreTest1_underscore.ts, 134, 37)) +>intersection : Symbol(WrappedArray.intersection, Decl(underscoreTest1_underscore.ts, 134, 37)) >arrays : Symbol(arrays, Decl(underscoreTest1_underscore.ts, 135, 21)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) difference(...others: T[][]): T[]; ->difference : Symbol(difference, Decl(underscoreTest1_underscore.ts, 135, 44)) +>difference : Symbol(WrappedArray.difference, Decl(underscoreTest1_underscore.ts, 135, 44)) >others : Symbol(others, Decl(underscoreTest1_underscore.ts, 136, 19)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) uniq(isSorted?: boolean): T[]; ->uniq : Symbol(uniq, Decl(underscoreTest1_underscore.ts, 136, 42), Decl(underscoreTest1_underscore.ts, 137, 38)) +>uniq : Symbol(WrappedArray.uniq, Decl(underscoreTest1_underscore.ts, 136, 42), Decl(underscoreTest1_underscore.ts, 137, 38)) >isSorted : Symbol(isSorted, Decl(underscoreTest1_underscore.ts, 137, 13)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) uniq(isSorted: boolean, iterator: Iterator, context?: any): U[]; ->uniq : Symbol(uniq, Decl(underscoreTest1_underscore.ts, 136, 42), Decl(underscoreTest1_underscore.ts, 137, 38)) +>uniq : Symbol(WrappedArray.uniq, Decl(underscoreTest1_underscore.ts, 136, 42), Decl(underscoreTest1_underscore.ts, 137, 38)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 138, 13)) >isSorted : Symbol(isSorted, Decl(underscoreTest1_underscore.ts, 138, 16)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 138, 34)) @@ -1667,12 +1667,12 @@ module Underscore { >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 138, 13)) unique(isSorted?: boolean): T[]; ->unique : Symbol(unique, Decl(underscoreTest1_underscore.ts, 138, 81), Decl(underscoreTest1_underscore.ts, 139, 40)) +>unique : Symbol(WrappedArray.unique, Decl(underscoreTest1_underscore.ts, 138, 81), Decl(underscoreTest1_underscore.ts, 139, 40)) >isSorted : Symbol(isSorted, Decl(underscoreTest1_underscore.ts, 139, 15)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) unique(isSorted: boolean, iterator: Iterator, context?: any): U[]; ->unique : Symbol(unique, Decl(underscoreTest1_underscore.ts, 138, 81), Decl(underscoreTest1_underscore.ts, 139, 40)) +>unique : Symbol(WrappedArray.unique, Decl(underscoreTest1_underscore.ts, 138, 81), Decl(underscoreTest1_underscore.ts, 139, 40)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 140, 15)) >isSorted : Symbol(isSorted, Decl(underscoreTest1_underscore.ts, 140, 18)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 140, 36)) @@ -1683,36 +1683,36 @@ module Underscore { >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 140, 15)) zip(...arrays: any[][]): any[][]; ->zip : Symbol(zip, Decl(underscoreTest1_underscore.ts, 140, 83)) +>zip : Symbol(WrappedArray.zip, Decl(underscoreTest1_underscore.ts, 140, 83)) >arrays : Symbol(arrays, Decl(underscoreTest1_underscore.ts, 141, 12)) object(): any; ->object : Symbol(object, Decl(underscoreTest1_underscore.ts, 141, 41), Decl(underscoreTest1_underscore.ts, 142, 22)) +>object : Symbol(WrappedArray.object, Decl(underscoreTest1_underscore.ts, 141, 41), Decl(underscoreTest1_underscore.ts, 142, 22)) object(values: any[]): any; ->object : Symbol(object, Decl(underscoreTest1_underscore.ts, 141, 41), Decl(underscoreTest1_underscore.ts, 142, 22)) +>object : Symbol(WrappedArray.object, Decl(underscoreTest1_underscore.ts, 141, 41), Decl(underscoreTest1_underscore.ts, 142, 22)) >values : Symbol(values, Decl(underscoreTest1_underscore.ts, 143, 15)) indexOf(value: T, isSorted?: boolean): number; ->indexOf : Symbol(indexOf, Decl(underscoreTest1_underscore.ts, 143, 35)) +>indexOf : Symbol(WrappedArray.indexOf, Decl(underscoreTest1_underscore.ts, 143, 35)) >value : Symbol(value, Decl(underscoreTest1_underscore.ts, 144, 16)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) >isSorted : Symbol(isSorted, Decl(underscoreTest1_underscore.ts, 144, 25)) lastIndexOf(value: T, fromIndex?: number): number; ->lastIndexOf : Symbol(lastIndexOf, Decl(underscoreTest1_underscore.ts, 144, 54)) +>lastIndexOf : Symbol(WrappedArray.lastIndexOf, Decl(underscoreTest1_underscore.ts, 144, 54)) >value : Symbol(value, Decl(underscoreTest1_underscore.ts, 145, 20)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) >fromIndex : Symbol(fromIndex, Decl(underscoreTest1_underscore.ts, 145, 29)) sortedIndex(obj: T, propertyName: string): number; ->sortedIndex : Symbol(sortedIndex, Decl(underscoreTest1_underscore.ts, 145, 58), Decl(underscoreTest1_underscore.ts, 146, 58)) +>sortedIndex : Symbol(WrappedArray.sortedIndex, Decl(underscoreTest1_underscore.ts, 145, 58), Decl(underscoreTest1_underscore.ts, 146, 58)) >obj : Symbol(obj, Decl(underscoreTest1_underscore.ts, 146, 20)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) >propertyName : Symbol(propertyName, Decl(underscoreTest1_underscore.ts, 146, 27)) sortedIndex(obj: T, iterator?: Iterator, context?: any): number; ->sortedIndex : Symbol(sortedIndex, Decl(underscoreTest1_underscore.ts, 145, 58), Decl(underscoreTest1_underscore.ts, 146, 58)) +>sortedIndex : Symbol(WrappedArray.sortedIndex, Decl(underscoreTest1_underscore.ts, 145, 58), Decl(underscoreTest1_underscore.ts, 146, 58)) >obj : Symbol(obj, Decl(underscoreTest1_underscore.ts, 147, 20)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 147, 27)) @@ -1722,40 +1722,40 @@ module Underscore { // Methods from Array concat(...items: T[]): T[]; ->concat : Symbol(concat, Decl(underscoreTest1_underscore.ts, 147, 80)) +>concat : Symbol(WrappedArray.concat, Decl(underscoreTest1_underscore.ts, 147, 80)) >items : Symbol(items, Decl(underscoreTest1_underscore.ts, 149, 15)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) join(separator?: string): string; ->join : Symbol(join, Decl(underscoreTest1_underscore.ts, 149, 35)) +>join : Symbol(WrappedArray.join, Decl(underscoreTest1_underscore.ts, 149, 35)) >separator : Symbol(separator, Decl(underscoreTest1_underscore.ts, 150, 13)) pop(): T; ->pop : Symbol(pop, Decl(underscoreTest1_underscore.ts, 150, 41)) +>pop : Symbol(WrappedArray.pop, Decl(underscoreTest1_underscore.ts, 150, 41)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) push(...items: T[]): number; ->push : Symbol(push, Decl(underscoreTest1_underscore.ts, 151, 17)) +>push : Symbol(WrappedArray.push, Decl(underscoreTest1_underscore.ts, 151, 17)) >items : Symbol(items, Decl(underscoreTest1_underscore.ts, 152, 13)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) reverse(): T[]; ->reverse : Symbol(reverse, Decl(underscoreTest1_underscore.ts, 152, 36)) +>reverse : Symbol(WrappedArray.reverse, Decl(underscoreTest1_underscore.ts, 152, 36)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) shift(): T; ->shift : Symbol(shift, Decl(underscoreTest1_underscore.ts, 153, 23)) +>shift : Symbol(WrappedArray.shift, Decl(underscoreTest1_underscore.ts, 153, 23)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) slice(start: number, end?: number): T[]; ->slice : Symbol(slice, Decl(underscoreTest1_underscore.ts, 154, 19)) +>slice : Symbol(WrappedArray.slice, Decl(underscoreTest1_underscore.ts, 154, 19)) >start : Symbol(start, Decl(underscoreTest1_underscore.ts, 155, 14)) >end : Symbol(end, Decl(underscoreTest1_underscore.ts, 155, 28)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) sort(compareFn?: (a: T, b: T) => number): T[]; ->sort : Symbol(sort, Decl(underscoreTest1_underscore.ts, 155, 48)) +>sort : Symbol(WrappedArray.sort, Decl(underscoreTest1_underscore.ts, 155, 48)) >compareFn : Symbol(compareFn, Decl(underscoreTest1_underscore.ts, 156, 13)) >a : Symbol(a, Decl(underscoreTest1_underscore.ts, 156, 26)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) @@ -1764,12 +1764,12 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) splice(start: number): T[]; ->splice : Symbol(splice, Decl(underscoreTest1_underscore.ts, 156, 54), Decl(underscoreTest1_underscore.ts, 157, 35)) +>splice : Symbol(WrappedArray.splice, Decl(underscoreTest1_underscore.ts, 156, 54), Decl(underscoreTest1_underscore.ts, 157, 35)) >start : Symbol(start, Decl(underscoreTest1_underscore.ts, 157, 15)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) splice(start: number, deleteCount: number, ...items: T[]): T[]; ->splice : Symbol(splice, Decl(underscoreTest1_underscore.ts, 156, 54), Decl(underscoreTest1_underscore.ts, 157, 35)) +>splice : Symbol(WrappedArray.splice, Decl(underscoreTest1_underscore.ts, 156, 54), Decl(underscoreTest1_underscore.ts, 157, 35)) >start : Symbol(start, Decl(underscoreTest1_underscore.ts, 158, 15)) >deleteCount : Symbol(deleteCount, Decl(underscoreTest1_underscore.ts, 158, 29)) >items : Symbol(items, Decl(underscoreTest1_underscore.ts, 158, 50)) @@ -1777,7 +1777,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) unshift(...items: T[]): number; ->unshift : Symbol(unshift, Decl(underscoreTest1_underscore.ts, 158, 71)) +>unshift : Symbol(WrappedArray.unshift, Decl(underscoreTest1_underscore.ts, 158, 71)) >items : Symbol(items, Decl(underscoreTest1_underscore.ts, 159, 16)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) } @@ -1790,21 +1790,21 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) each(iterator: Iterator, context?: any): void; ->each : Symbol(each, Decl(underscoreTest1_underscore.ts, 162, 80)) +>each : Symbol(WrappedDictionary.each, Decl(underscoreTest1_underscore.ts, 162, 80)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 163, 13)) >Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) >context : Symbol(context, Decl(underscoreTest1_underscore.ts, 163, 41)) forEach(iterator: Iterator, context?: any): void; ->forEach : Symbol(forEach, Decl(underscoreTest1_underscore.ts, 163, 63)) +>forEach : Symbol(WrappedDictionary.forEach, Decl(underscoreTest1_underscore.ts, 163, 63)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 164, 16)) >Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) >context : Symbol(context, Decl(underscoreTest1_underscore.ts, 164, 44)) map(iterator: Iterator, context?: any): U[]; ->map : Symbol(map, Decl(underscoreTest1_underscore.ts, 164, 66)) +>map : Symbol(WrappedDictionary.map, Decl(underscoreTest1_underscore.ts, 164, 66)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 165, 12)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 165, 15)) >Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) @@ -1814,7 +1814,7 @@ module Underscore { >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 165, 12)) collect(iterator: Iterator, context?: any): U[]; ->collect : Symbol(collect, Decl(underscoreTest1_underscore.ts, 165, 61)) +>collect : Symbol(WrappedDictionary.collect, Decl(underscoreTest1_underscore.ts, 165, 61)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 166, 16)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 166, 19)) >Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) @@ -1824,7 +1824,7 @@ module Underscore { >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 166, 16)) reduce(iterator: Reducer, initialValue?: T, context?: any): T; ->reduce : Symbol(reduce, Decl(underscoreTest1_underscore.ts, 166, 65), Decl(underscoreTest1_underscore.ts, 167, 76)) +>reduce : Symbol(WrappedDictionary.reduce, Decl(underscoreTest1_underscore.ts, 166, 65), Decl(underscoreTest1_underscore.ts, 167, 76)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 167, 15)) >Reducer : Symbol(Reducer, Decl(underscoreTest1_underscore.ts, 6, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) @@ -1835,7 +1835,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) reduce(iterator: Reducer, initialValue: U, context?: any): U; ->reduce : Symbol(reduce, Decl(underscoreTest1_underscore.ts, 166, 65), Decl(underscoreTest1_underscore.ts, 167, 76)) +>reduce : Symbol(WrappedDictionary.reduce, Decl(underscoreTest1_underscore.ts, 166, 65), Decl(underscoreTest1_underscore.ts, 167, 76)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 168, 15)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 168, 18)) >Reducer : Symbol(Reducer, Decl(underscoreTest1_underscore.ts, 6, 1)) @@ -1847,7 +1847,7 @@ module Underscore { >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 168, 15)) foldl(iterator: Reducer, initialValue?: T, context?: any): T; ->foldl : Symbol(foldl, Decl(underscoreTest1_underscore.ts, 168, 78), Decl(underscoreTest1_underscore.ts, 169, 75)) +>foldl : Symbol(WrappedDictionary.foldl, Decl(underscoreTest1_underscore.ts, 168, 78), Decl(underscoreTest1_underscore.ts, 169, 75)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 169, 14)) >Reducer : Symbol(Reducer, Decl(underscoreTest1_underscore.ts, 6, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) @@ -1858,7 +1858,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) foldl(iterator: Reducer, initialValue: U, context?: any): U; ->foldl : Symbol(foldl, Decl(underscoreTest1_underscore.ts, 168, 78), Decl(underscoreTest1_underscore.ts, 169, 75)) +>foldl : Symbol(WrappedDictionary.foldl, Decl(underscoreTest1_underscore.ts, 168, 78), Decl(underscoreTest1_underscore.ts, 169, 75)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 170, 14)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 170, 17)) >Reducer : Symbol(Reducer, Decl(underscoreTest1_underscore.ts, 6, 1)) @@ -1870,7 +1870,7 @@ module Underscore { >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 170, 14)) inject(iterator: Reducer, initialValue?: T, context?: any): T; ->inject : Symbol(inject, Decl(underscoreTest1_underscore.ts, 170, 77), Decl(underscoreTest1_underscore.ts, 171, 76)) +>inject : Symbol(WrappedDictionary.inject, Decl(underscoreTest1_underscore.ts, 170, 77), Decl(underscoreTest1_underscore.ts, 171, 76)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 171, 15)) >Reducer : Symbol(Reducer, Decl(underscoreTest1_underscore.ts, 6, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) @@ -1881,7 +1881,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) inject(iterator: Reducer, initialValue: U, context?: any): U; ->inject : Symbol(inject, Decl(underscoreTest1_underscore.ts, 170, 77), Decl(underscoreTest1_underscore.ts, 171, 76)) +>inject : Symbol(WrappedDictionary.inject, Decl(underscoreTest1_underscore.ts, 170, 77), Decl(underscoreTest1_underscore.ts, 171, 76)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 172, 15)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 172, 18)) >Reducer : Symbol(Reducer, Decl(underscoreTest1_underscore.ts, 6, 1)) @@ -1893,7 +1893,7 @@ module Underscore { >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 172, 15)) reduceRight(iterator: Reducer, initialValue?: T, context?: any): T; ->reduceRight : Symbol(reduceRight, Decl(underscoreTest1_underscore.ts, 172, 78), Decl(underscoreTest1_underscore.ts, 173, 81)) +>reduceRight : Symbol(WrappedDictionary.reduceRight, Decl(underscoreTest1_underscore.ts, 172, 78), Decl(underscoreTest1_underscore.ts, 173, 81)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 173, 20)) >Reducer : Symbol(Reducer, Decl(underscoreTest1_underscore.ts, 6, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) @@ -1904,7 +1904,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) reduceRight(iterator: Reducer, initialValue: U, context?: any): U; ->reduceRight : Symbol(reduceRight, Decl(underscoreTest1_underscore.ts, 172, 78), Decl(underscoreTest1_underscore.ts, 173, 81)) +>reduceRight : Symbol(WrappedDictionary.reduceRight, Decl(underscoreTest1_underscore.ts, 172, 78), Decl(underscoreTest1_underscore.ts, 173, 81)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 174, 20)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 174, 23)) >Reducer : Symbol(Reducer, Decl(underscoreTest1_underscore.ts, 6, 1)) @@ -1916,7 +1916,7 @@ module Underscore { >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 174, 20)) foldr(iterator: Reducer, initialValue?: T, context?: any): T; ->foldr : Symbol(foldr, Decl(underscoreTest1_underscore.ts, 174, 83), Decl(underscoreTest1_underscore.ts, 175, 75)) +>foldr : Symbol(WrappedDictionary.foldr, Decl(underscoreTest1_underscore.ts, 174, 83), Decl(underscoreTest1_underscore.ts, 175, 75)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 175, 14)) >Reducer : Symbol(Reducer, Decl(underscoreTest1_underscore.ts, 6, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) @@ -1927,7 +1927,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) foldr(iterator: Reducer, initialValue: U, context?: any): U; ->foldr : Symbol(foldr, Decl(underscoreTest1_underscore.ts, 174, 83), Decl(underscoreTest1_underscore.ts, 175, 75)) +>foldr : Symbol(WrappedDictionary.foldr, Decl(underscoreTest1_underscore.ts, 174, 83), Decl(underscoreTest1_underscore.ts, 175, 75)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 176, 14)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 176, 17)) >Reducer : Symbol(Reducer, Decl(underscoreTest1_underscore.ts, 6, 1)) @@ -1939,7 +1939,7 @@ module Underscore { >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 176, 14)) find(iterator: Iterator, context?: any): T; ->find : Symbol(find, Decl(underscoreTest1_underscore.ts, 176, 77)) +>find : Symbol(WrappedDictionary.find, Decl(underscoreTest1_underscore.ts, 176, 77)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 177, 13)) >Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) @@ -1947,7 +1947,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) detect(iterator: Iterator, context?: any): T; ->detect : Symbol(detect, Decl(underscoreTest1_underscore.ts, 177, 63)) +>detect : Symbol(WrappedDictionary.detect, Decl(underscoreTest1_underscore.ts, 177, 63)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 178, 15)) >Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) @@ -1955,7 +1955,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) filter(iterator: Iterator, context?: any): T[]; ->filter : Symbol(filter, Decl(underscoreTest1_underscore.ts, 178, 65)) +>filter : Symbol(WrappedDictionary.filter, Decl(underscoreTest1_underscore.ts, 178, 65)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 179, 15)) >Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) @@ -1963,7 +1963,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) select(iterator: Iterator, context?: any): T[]; ->select : Symbol(select, Decl(underscoreTest1_underscore.ts, 179, 67)) +>select : Symbol(WrappedDictionary.select, Decl(underscoreTest1_underscore.ts, 179, 67)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 180, 15)) >Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) @@ -1971,19 +1971,19 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) where(properties: Object): T[]; ->where : Symbol(where, Decl(underscoreTest1_underscore.ts, 180, 67)) +>where : Symbol(WrappedDictionary.where, Decl(underscoreTest1_underscore.ts, 180, 67)) >properties : Symbol(properties, Decl(underscoreTest1_underscore.ts, 181, 14)) >Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) findWhere(properties: Object): T; ->findWhere : Symbol(findWhere, Decl(underscoreTest1_underscore.ts, 181, 39)) +>findWhere : Symbol(WrappedDictionary.findWhere, Decl(underscoreTest1_underscore.ts, 181, 39)) >properties : Symbol(properties, Decl(underscoreTest1_underscore.ts, 182, 18)) >Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) reject(iterator: Iterator, context?: any): T[]; ->reject : Symbol(reject, Decl(underscoreTest1_underscore.ts, 182, 41)) +>reject : Symbol(WrappedDictionary.reject, Decl(underscoreTest1_underscore.ts, 182, 41)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 183, 15)) >Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) @@ -1991,54 +1991,54 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) every(iterator?: Iterator, context?: any): boolean; ->every : Symbol(every, Decl(underscoreTest1_underscore.ts, 183, 67)) +>every : Symbol(WrappedDictionary.every, Decl(underscoreTest1_underscore.ts, 183, 67)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 184, 14)) >Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) >context : Symbol(context, Decl(underscoreTest1_underscore.ts, 184, 46)) all(iterator?: Iterator, context?: any): boolean; ->all : Symbol(all, Decl(underscoreTest1_underscore.ts, 184, 71)) +>all : Symbol(WrappedDictionary.all, Decl(underscoreTest1_underscore.ts, 184, 71)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 185, 12)) >Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) >context : Symbol(context, Decl(underscoreTest1_underscore.ts, 185, 44)) some(iterator?: Iterator, context?: any): boolean; ->some : Symbol(some, Decl(underscoreTest1_underscore.ts, 185, 69)) +>some : Symbol(WrappedDictionary.some, Decl(underscoreTest1_underscore.ts, 185, 69)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 186, 13)) >Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) >context : Symbol(context, Decl(underscoreTest1_underscore.ts, 186, 45)) any(iterator?: Iterator, context?: any): boolean; ->any : Symbol(any, Decl(underscoreTest1_underscore.ts, 186, 70)) +>any : Symbol(WrappedDictionary.any, Decl(underscoreTest1_underscore.ts, 186, 70)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 187, 12)) >Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) >context : Symbol(context, Decl(underscoreTest1_underscore.ts, 187, 44)) contains(value: T): boolean; ->contains : Symbol(contains, Decl(underscoreTest1_underscore.ts, 187, 69)) +>contains : Symbol(WrappedDictionary.contains, Decl(underscoreTest1_underscore.ts, 187, 69)) >value : Symbol(value, Decl(underscoreTest1_underscore.ts, 188, 17)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) include(value: T): boolean; ->include : Symbol(include, Decl(underscoreTest1_underscore.ts, 188, 36)) +>include : Symbol(WrappedDictionary.include, Decl(underscoreTest1_underscore.ts, 188, 36)) >value : Symbol(value, Decl(underscoreTest1_underscore.ts, 189, 16)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) invoke(methodName: string, ...args: any[]): any[]; ->invoke : Symbol(invoke, Decl(underscoreTest1_underscore.ts, 189, 35)) +>invoke : Symbol(WrappedDictionary.invoke, Decl(underscoreTest1_underscore.ts, 189, 35)) >methodName : Symbol(methodName, Decl(underscoreTest1_underscore.ts, 190, 15)) >args : Symbol(args, Decl(underscoreTest1_underscore.ts, 190, 34)) pluck(propertyName: string): any[]; ->pluck : Symbol(pluck, Decl(underscoreTest1_underscore.ts, 190, 58)) +>pluck : Symbol(WrappedDictionary.pluck, Decl(underscoreTest1_underscore.ts, 190, 58)) >propertyName : Symbol(propertyName, Decl(underscoreTest1_underscore.ts, 191, 14)) max(iterator?: Iterator, context?: any): T; ->max : Symbol(max, Decl(underscoreTest1_underscore.ts, 191, 43)) +>max : Symbol(WrappedDictionary.max, Decl(underscoreTest1_underscore.ts, 191, 43)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 192, 12)) >Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) @@ -2046,7 +2046,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) min(iterator?: Iterator, context?: any): T; ->min : Symbol(min, Decl(underscoreTest1_underscore.ts, 192, 59)) +>min : Symbol(WrappedDictionary.min, Decl(underscoreTest1_underscore.ts, 192, 59)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 193, 12)) >Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) @@ -2054,7 +2054,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) sortBy(iterator: Iterator, context?: any): T[]; ->sortBy : Symbol(sortBy, Decl(underscoreTest1_underscore.ts, 193, 59), Decl(underscoreTest1_underscore.ts, 194, 63)) +>sortBy : Symbol(WrappedDictionary.sortBy, Decl(underscoreTest1_underscore.ts, 193, 59), Decl(underscoreTest1_underscore.ts, 194, 63)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 194, 15)) >Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) @@ -2062,12 +2062,12 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) sortBy(propertyName: string): T[]; ->sortBy : Symbol(sortBy, Decl(underscoreTest1_underscore.ts, 193, 59), Decl(underscoreTest1_underscore.ts, 194, 63)) +>sortBy : Symbol(WrappedDictionary.sortBy, Decl(underscoreTest1_underscore.ts, 193, 59), Decl(underscoreTest1_underscore.ts, 194, 63)) >propertyName : Symbol(propertyName, Decl(underscoreTest1_underscore.ts, 195, 15)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) groupBy(iterator?: Iterator, context?: any): Dictionary; ->groupBy : Symbol(groupBy, Decl(underscoreTest1_underscore.ts, 195, 42), Decl(underscoreTest1_underscore.ts, 196, 77)) +>groupBy : Symbol(WrappedDictionary.groupBy, Decl(underscoreTest1_underscore.ts, 195, 42), Decl(underscoreTest1_underscore.ts, 196, 77)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 196, 16)) >Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) @@ -2076,13 +2076,13 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) groupBy(propertyName: string): Dictionary; ->groupBy : Symbol(groupBy, Decl(underscoreTest1_underscore.ts, 195, 42), Decl(underscoreTest1_underscore.ts, 196, 77)) +>groupBy : Symbol(WrappedDictionary.groupBy, Decl(underscoreTest1_underscore.ts, 195, 42), Decl(underscoreTest1_underscore.ts, 196, 77)) >propertyName : Symbol(propertyName, Decl(underscoreTest1_underscore.ts, 197, 16)) >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) countBy(iterator?: Iterator, context?: any): Dictionary; ->countBy : Symbol(countBy, Decl(underscoreTest1_underscore.ts, 197, 55), Decl(underscoreTest1_underscore.ts, 198, 80)) +>countBy : Symbol(WrappedDictionary.countBy, Decl(underscoreTest1_underscore.ts, 197, 55), Decl(underscoreTest1_underscore.ts, 198, 80)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 198, 16)) >Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) @@ -2090,20 +2090,20 @@ module Underscore { >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) countBy(propertyName: string): Dictionary; ->countBy : Symbol(countBy, Decl(underscoreTest1_underscore.ts, 197, 55), Decl(underscoreTest1_underscore.ts, 198, 80)) +>countBy : Symbol(WrappedDictionary.countBy, Decl(underscoreTest1_underscore.ts, 197, 55), Decl(underscoreTest1_underscore.ts, 198, 80)) >propertyName : Symbol(propertyName, Decl(underscoreTest1_underscore.ts, 199, 16)) >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) shuffle(): T[]; ->shuffle : Symbol(shuffle, Decl(underscoreTest1_underscore.ts, 199, 58)) +>shuffle : Symbol(WrappedDictionary.shuffle, Decl(underscoreTest1_underscore.ts, 199, 58)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) toArray(): T[]; ->toArray : Symbol(toArray, Decl(underscoreTest1_underscore.ts, 200, 23)) +>toArray : Symbol(WrappedDictionary.toArray, Decl(underscoreTest1_underscore.ts, 200, 23)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) size(): number; ->size : Symbol(size, Decl(underscoreTest1_underscore.ts, 201, 23)) +>size : Symbol(WrappedDictionary.size, Decl(underscoreTest1_underscore.ts, 201, 23)) } export interface ChainedObject { @@ -2111,60 +2111,60 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 205, 35)) keys(): ChainedArray; ->keys : Symbol(keys, Decl(underscoreTest1_underscore.ts, 205, 39)) +>keys : Symbol(ChainedObject.keys, Decl(underscoreTest1_underscore.ts, 205, 39)) >ChainedArray : Symbol(ChainedArray, Decl(underscoreTest1_underscore.ts, 236, 5)) values(): ChainedArray; ->values : Symbol(values, Decl(underscoreTest1_underscore.ts, 206, 37)) +>values : Symbol(ChainedObject.values, Decl(underscoreTest1_underscore.ts, 206, 37)) >ChainedArray : Symbol(ChainedArray, Decl(underscoreTest1_underscore.ts, 236, 5)) pairs(): ChainedArray; ->pairs : Symbol(pairs, Decl(underscoreTest1_underscore.ts, 207, 36)) +>pairs : Symbol(ChainedObject.pairs, Decl(underscoreTest1_underscore.ts, 207, 36)) >ChainedArray : Symbol(ChainedArray, Decl(underscoreTest1_underscore.ts, 236, 5)) invert(): ChainedObject; ->invert : Symbol(invert, Decl(underscoreTest1_underscore.ts, 208, 37)) +>invert : Symbol(ChainedObject.invert, Decl(underscoreTest1_underscore.ts, 208, 37)) >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) functions(): ChainedArray; ->functions : Symbol(functions, Decl(underscoreTest1_underscore.ts, 209, 37)) +>functions : Symbol(ChainedObject.functions, Decl(underscoreTest1_underscore.ts, 209, 37)) >ChainedArray : Symbol(ChainedArray, Decl(underscoreTest1_underscore.ts, 236, 5)) methods(): ChainedArray; ->methods : Symbol(methods, Decl(underscoreTest1_underscore.ts, 210, 42)) +>methods : Symbol(ChainedObject.methods, Decl(underscoreTest1_underscore.ts, 210, 42)) >ChainedArray : Symbol(ChainedArray, Decl(underscoreTest1_underscore.ts, 236, 5)) extend(...sources: any[]): ChainedObject; ->extend : Symbol(extend, Decl(underscoreTest1_underscore.ts, 211, 40)) +>extend : Symbol(ChainedObject.extend, Decl(underscoreTest1_underscore.ts, 211, 40)) >sources : Symbol(sources, Decl(underscoreTest1_underscore.ts, 212, 15)) >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 205, 35)) pick(...keys: string[]): ChainedObject; ->pick : Symbol(pick, Decl(underscoreTest1_underscore.ts, 212, 52)) +>pick : Symbol(ChainedObject.pick, Decl(underscoreTest1_underscore.ts, 212, 52)) >keys : Symbol(keys, Decl(underscoreTest1_underscore.ts, 213, 13)) >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 205, 35)) omit(...keys: string[]): ChainedObject; ->omit : Symbol(omit, Decl(underscoreTest1_underscore.ts, 213, 50)) +>omit : Symbol(ChainedObject.omit, Decl(underscoreTest1_underscore.ts, 213, 50)) >keys : Symbol(keys, Decl(underscoreTest1_underscore.ts, 214, 13)) >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 205, 35)) defaults(...defaults: any[]): ChainedObject; ->defaults : Symbol(defaults, Decl(underscoreTest1_underscore.ts, 214, 50)) +>defaults : Symbol(ChainedObject.defaults, Decl(underscoreTest1_underscore.ts, 214, 50)) >defaults : Symbol(defaults, Decl(underscoreTest1_underscore.ts, 215, 17)) >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 205, 35)) clone(): ChainedObject; ->clone : Symbol(clone, Decl(underscoreTest1_underscore.ts, 215, 55)) +>clone : Symbol(ChainedObject.clone, Decl(underscoreTest1_underscore.ts, 215, 55)) >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 205, 35)) tap(interceptor: (object: T) => void): ChainedObject; ->tap : Symbol(tap, Decl(underscoreTest1_underscore.ts, 216, 34)) +>tap : Symbol(ChainedObject.tap, Decl(underscoreTest1_underscore.ts, 216, 34)) >interceptor : Symbol(interceptor, Decl(underscoreTest1_underscore.ts, 217, 12)) >object : Symbol(object, Decl(underscoreTest1_underscore.ts, 217, 26)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 205, 35)) @@ -2172,78 +2172,78 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 205, 35)) has(key: string): ChainedObject; ->has : Symbol(has, Decl(underscoreTest1_underscore.ts, 217, 64)) +>has : Symbol(ChainedObject.has, Decl(underscoreTest1_underscore.ts, 217, 64)) >key : Symbol(key, Decl(underscoreTest1_underscore.ts, 218, 12)) >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) isEqual(other: T): ChainedObject; ->isEqual : Symbol(isEqual, Decl(underscoreTest1_underscore.ts, 218, 49)) +>isEqual : Symbol(ChainedObject.isEqual, Decl(underscoreTest1_underscore.ts, 218, 49)) >other : Symbol(other, Decl(underscoreTest1_underscore.ts, 219, 16)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 205, 35)) >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) isEmpty(): ChainedObject; ->isEmpty : Symbol(isEmpty, Decl(underscoreTest1_underscore.ts, 219, 50)) +>isEmpty : Symbol(ChainedObject.isEmpty, Decl(underscoreTest1_underscore.ts, 219, 50)) >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) isElement(): ChainedObject; ->isElement : Symbol(isElement, Decl(underscoreTest1_underscore.ts, 220, 42)) +>isElement : Symbol(ChainedObject.isElement, Decl(underscoreTest1_underscore.ts, 220, 42)) >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) isArray(): ChainedObject; ->isArray : Symbol(isArray, Decl(underscoreTest1_underscore.ts, 221, 44)) +>isArray : Symbol(ChainedObject.isArray, Decl(underscoreTest1_underscore.ts, 221, 44)) >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) isObject(): ChainedObject; ->isObject : Symbol(isObject, Decl(underscoreTest1_underscore.ts, 222, 42)) +>isObject : Symbol(ChainedObject.isObject, Decl(underscoreTest1_underscore.ts, 222, 42)) >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) isArguments(): ChainedObject; ->isArguments : Symbol(isArguments, Decl(underscoreTest1_underscore.ts, 223, 43)) +>isArguments : Symbol(ChainedObject.isArguments, Decl(underscoreTest1_underscore.ts, 223, 43)) >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) isFunction(): ChainedObject; ->isFunction : Symbol(isFunction, Decl(underscoreTest1_underscore.ts, 224, 46)) +>isFunction : Symbol(ChainedObject.isFunction, Decl(underscoreTest1_underscore.ts, 224, 46)) >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) isString(): ChainedObject; ->isString : Symbol(isString, Decl(underscoreTest1_underscore.ts, 225, 45)) +>isString : Symbol(ChainedObject.isString, Decl(underscoreTest1_underscore.ts, 225, 45)) >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) isNumber(): ChainedObject; ->isNumber : Symbol(isNumber, Decl(underscoreTest1_underscore.ts, 226, 43)) +>isNumber : Symbol(ChainedObject.isNumber, Decl(underscoreTest1_underscore.ts, 226, 43)) >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) isFinite(): ChainedObject; ->isFinite : Symbol(isFinite, Decl(underscoreTest1_underscore.ts, 227, 43)) +>isFinite : Symbol(ChainedObject.isFinite, Decl(underscoreTest1_underscore.ts, 227, 43)) >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) isBoolean(): ChainedObject; ->isBoolean : Symbol(isBoolean, Decl(underscoreTest1_underscore.ts, 228, 43)) +>isBoolean : Symbol(ChainedObject.isBoolean, Decl(underscoreTest1_underscore.ts, 228, 43)) >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) isDate(): ChainedObject; ->isDate : Symbol(isDate, Decl(underscoreTest1_underscore.ts, 229, 44)) +>isDate : Symbol(ChainedObject.isDate, Decl(underscoreTest1_underscore.ts, 229, 44)) >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) isRegExp(): ChainedObject; ->isRegExp : Symbol(isRegExp, Decl(underscoreTest1_underscore.ts, 230, 41)) +>isRegExp : Symbol(ChainedObject.isRegExp, Decl(underscoreTest1_underscore.ts, 230, 41)) >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) isNaN(): ChainedObject; ->isNaN : Symbol(isNaN, Decl(underscoreTest1_underscore.ts, 231, 43)) +>isNaN : Symbol(ChainedObject.isNaN, Decl(underscoreTest1_underscore.ts, 231, 43)) >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) isNull(): ChainedObject; ->isNull : Symbol(isNull, Decl(underscoreTest1_underscore.ts, 232, 40)) +>isNull : Symbol(ChainedObject.isNull, Decl(underscoreTest1_underscore.ts, 232, 40)) >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) isUndefined(): ChainedObject; ->isUndefined : Symbol(isUndefined, Decl(underscoreTest1_underscore.ts, 233, 41)) +>isUndefined : Symbol(ChainedObject.isUndefined, Decl(underscoreTest1_underscore.ts, 233, 41)) >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) value(): T; ->value : Symbol(value, Decl(underscoreTest1_underscore.ts, 234, 46)) +>value : Symbol(ChainedObject.value, Decl(underscoreTest1_underscore.ts, 234, 46)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 205, 35)) } @@ -2255,7 +2255,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) each(iterator: Iterator, context?: any): ChainedObject; ->each : Symbol(each, Decl(underscoreTest1_underscore.ts, 238, 70)) +>each : Symbol(ChainedArray.each, Decl(underscoreTest1_underscore.ts, 238, 70)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 239, 13)) >Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) @@ -2263,7 +2263,7 @@ module Underscore { >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) forEach(iterator: Iterator, context?: any): ChainedObject; ->forEach : Symbol(forEach, Decl(underscoreTest1_underscore.ts, 239, 78)) +>forEach : Symbol(ChainedArray.forEach, Decl(underscoreTest1_underscore.ts, 239, 78)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 240, 16)) >Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) @@ -2271,7 +2271,7 @@ module Underscore { >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) map(iterator: Iterator, context?: any): ChainedArray; ->map : Symbol(map, Decl(underscoreTest1_underscore.ts, 240, 81)) +>map : Symbol(ChainedArray.map, Decl(underscoreTest1_underscore.ts, 240, 81)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 241, 12)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 241, 15)) >Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) @@ -2282,7 +2282,7 @@ module Underscore { >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 241, 12)) collect(iterator: Iterator, context?: any): ChainedArray; ->collect : Symbol(collect, Decl(underscoreTest1_underscore.ts, 241, 73)) +>collect : Symbol(ChainedArray.collect, Decl(underscoreTest1_underscore.ts, 241, 73)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 242, 16)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 242, 19)) >Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) @@ -2293,7 +2293,7 @@ module Underscore { >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 242, 16)) reduce(iterator: Reducer, initialValue?: T, context?: any): ChainedObject; ->reduce : Symbol(reduce, Decl(underscoreTest1_underscore.ts, 242, 77), Decl(underscoreTest1_underscore.ts, 243, 91)) +>reduce : Symbol(ChainedArray.reduce, Decl(underscoreTest1_underscore.ts, 242, 77), Decl(underscoreTest1_underscore.ts, 243, 91)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 243, 15)) >Reducer : Symbol(Reducer, Decl(underscoreTest1_underscore.ts, 6, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) @@ -2305,7 +2305,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) reduce(iterator: Reducer, initialValue: U, context?: any): ChainedObject; ->reduce : Symbol(reduce, Decl(underscoreTest1_underscore.ts, 242, 77), Decl(underscoreTest1_underscore.ts, 243, 91)) +>reduce : Symbol(ChainedArray.reduce, Decl(underscoreTest1_underscore.ts, 242, 77), Decl(underscoreTest1_underscore.ts, 243, 91)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 244, 15)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 244, 18)) >Reducer : Symbol(Reducer, Decl(underscoreTest1_underscore.ts, 6, 1)) @@ -2318,7 +2318,7 @@ module Underscore { >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 244, 15)) foldl(iterator: Reducer, initialValue?: T, context?: any): ChainedObject; ->foldl : Symbol(foldl, Decl(underscoreTest1_underscore.ts, 244, 93), Decl(underscoreTest1_underscore.ts, 245, 90)) +>foldl : Symbol(ChainedArray.foldl, Decl(underscoreTest1_underscore.ts, 244, 93), Decl(underscoreTest1_underscore.ts, 245, 90)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 245, 14)) >Reducer : Symbol(Reducer, Decl(underscoreTest1_underscore.ts, 6, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) @@ -2330,7 +2330,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) foldl(iterator: Reducer, initialValue: U, context?: any): ChainedObject; ->foldl : Symbol(foldl, Decl(underscoreTest1_underscore.ts, 244, 93), Decl(underscoreTest1_underscore.ts, 245, 90)) +>foldl : Symbol(ChainedArray.foldl, Decl(underscoreTest1_underscore.ts, 244, 93), Decl(underscoreTest1_underscore.ts, 245, 90)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 246, 14)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 246, 17)) >Reducer : Symbol(Reducer, Decl(underscoreTest1_underscore.ts, 6, 1)) @@ -2343,7 +2343,7 @@ module Underscore { >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 246, 14)) inject(iterator: Reducer, initialValue?: T, context?: any): ChainedObject; ->inject : Symbol(inject, Decl(underscoreTest1_underscore.ts, 246, 92), Decl(underscoreTest1_underscore.ts, 247, 91)) +>inject : Symbol(ChainedArray.inject, Decl(underscoreTest1_underscore.ts, 246, 92), Decl(underscoreTest1_underscore.ts, 247, 91)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 247, 15)) >Reducer : Symbol(Reducer, Decl(underscoreTest1_underscore.ts, 6, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) @@ -2355,7 +2355,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) inject(iterator: Reducer, initialValue: U, context?: any): ChainedObject; ->inject : Symbol(inject, Decl(underscoreTest1_underscore.ts, 246, 92), Decl(underscoreTest1_underscore.ts, 247, 91)) +>inject : Symbol(ChainedArray.inject, Decl(underscoreTest1_underscore.ts, 246, 92), Decl(underscoreTest1_underscore.ts, 247, 91)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 248, 15)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 248, 18)) >Reducer : Symbol(Reducer, Decl(underscoreTest1_underscore.ts, 6, 1)) @@ -2368,7 +2368,7 @@ module Underscore { >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 248, 15)) reduceRight(iterator: Reducer, initialValue?: T, context?: any): ChainedObject; ->reduceRight : Symbol(reduceRight, Decl(underscoreTest1_underscore.ts, 248, 93), Decl(underscoreTest1_underscore.ts, 249, 96)) +>reduceRight : Symbol(ChainedArray.reduceRight, Decl(underscoreTest1_underscore.ts, 248, 93), Decl(underscoreTest1_underscore.ts, 249, 96)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 249, 20)) >Reducer : Symbol(Reducer, Decl(underscoreTest1_underscore.ts, 6, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) @@ -2380,7 +2380,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) reduceRight(iterator: Reducer, initialValue: U, context?: any): ChainedObject; ->reduceRight : Symbol(reduceRight, Decl(underscoreTest1_underscore.ts, 248, 93), Decl(underscoreTest1_underscore.ts, 249, 96)) +>reduceRight : Symbol(ChainedArray.reduceRight, Decl(underscoreTest1_underscore.ts, 248, 93), Decl(underscoreTest1_underscore.ts, 249, 96)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 250, 20)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 250, 23)) >Reducer : Symbol(Reducer, Decl(underscoreTest1_underscore.ts, 6, 1)) @@ -2393,7 +2393,7 @@ module Underscore { >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 250, 20)) foldr(iterator: Reducer, initialValue?: T, context?: any): ChainedObject; ->foldr : Symbol(foldr, Decl(underscoreTest1_underscore.ts, 250, 98), Decl(underscoreTest1_underscore.ts, 251, 90)) +>foldr : Symbol(ChainedArray.foldr, Decl(underscoreTest1_underscore.ts, 250, 98), Decl(underscoreTest1_underscore.ts, 251, 90)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 251, 14)) >Reducer : Symbol(Reducer, Decl(underscoreTest1_underscore.ts, 6, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) @@ -2405,7 +2405,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) foldr(iterator: Reducer, initialValue: U, context?: any): ChainedObject; ->foldr : Symbol(foldr, Decl(underscoreTest1_underscore.ts, 250, 98), Decl(underscoreTest1_underscore.ts, 251, 90)) +>foldr : Symbol(ChainedArray.foldr, Decl(underscoreTest1_underscore.ts, 250, 98), Decl(underscoreTest1_underscore.ts, 251, 90)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 252, 14)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 252, 17)) >Reducer : Symbol(Reducer, Decl(underscoreTest1_underscore.ts, 6, 1)) @@ -2418,7 +2418,7 @@ module Underscore { >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 252, 14)) find(iterator: Iterator, context?: any): ChainedObject; ->find : Symbol(find, Decl(underscoreTest1_underscore.ts, 252, 92)) +>find : Symbol(ChainedArray.find, Decl(underscoreTest1_underscore.ts, 252, 92)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 253, 13)) >Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) @@ -2427,7 +2427,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) detect(iterator: Iterator, context?: any): ChainedObject; ->detect : Symbol(detect, Decl(underscoreTest1_underscore.ts, 253, 78)) +>detect : Symbol(ChainedArray.detect, Decl(underscoreTest1_underscore.ts, 253, 78)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 254, 15)) >Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) @@ -2436,7 +2436,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) filter(iterator: Iterator, context?: any): ChainedArray; ->filter : Symbol(filter, Decl(underscoreTest1_underscore.ts, 254, 80)) +>filter : Symbol(ChainedArray.filter, Decl(underscoreTest1_underscore.ts, 254, 80)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 255, 15)) >Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) @@ -2445,7 +2445,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) select(iterator: Iterator, context?: any): ChainedArray; ->select : Symbol(select, Decl(underscoreTest1_underscore.ts, 255, 79)) +>select : Symbol(ChainedArray.select, Decl(underscoreTest1_underscore.ts, 255, 79)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 256, 15)) >Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) @@ -2454,21 +2454,21 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) where(properties: Object): ChainedArray; ->where : Symbol(where, Decl(underscoreTest1_underscore.ts, 256, 79)) +>where : Symbol(ChainedArray.where, Decl(underscoreTest1_underscore.ts, 256, 79)) >properties : Symbol(properties, Decl(underscoreTest1_underscore.ts, 257, 14)) >Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >ChainedArray : Symbol(ChainedArray, Decl(underscoreTest1_underscore.ts, 236, 5)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) findWhere(properties: Object): ChainedObject; ->findWhere : Symbol(findWhere, Decl(underscoreTest1_underscore.ts, 257, 51)) +>findWhere : Symbol(ChainedArray.findWhere, Decl(underscoreTest1_underscore.ts, 257, 51)) >properties : Symbol(properties, Decl(underscoreTest1_underscore.ts, 258, 18)) >Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) reject(iterator: Iterator, context?: any): ChainedArray; ->reject : Symbol(reject, Decl(underscoreTest1_underscore.ts, 258, 56)) +>reject : Symbol(ChainedArray.reject, Decl(underscoreTest1_underscore.ts, 258, 56)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 259, 15)) >Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) @@ -2477,7 +2477,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) every(iterator?: Iterator, context?: any): ChainedObject; ->every : Symbol(every, Decl(underscoreTest1_underscore.ts, 259, 79)) +>every : Symbol(ChainedArray.every, Decl(underscoreTest1_underscore.ts, 259, 79)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 260, 14)) >Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) @@ -2485,7 +2485,7 @@ module Underscore { >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) all(iterator?: Iterator, context?: any): ChainedObject; ->all : Symbol(all, Decl(underscoreTest1_underscore.ts, 260, 86)) +>all : Symbol(ChainedArray.all, Decl(underscoreTest1_underscore.ts, 260, 86)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 261, 12)) >Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) @@ -2493,7 +2493,7 @@ module Underscore { >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) some(iterator?: Iterator, context?: any): ChainedObject; ->some : Symbol(some, Decl(underscoreTest1_underscore.ts, 261, 84)) +>some : Symbol(ChainedArray.some, Decl(underscoreTest1_underscore.ts, 261, 84)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 262, 13)) >Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) @@ -2501,7 +2501,7 @@ module Underscore { >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) any(iterator?: Iterator, context?: any): ChainedObject; ->any : Symbol(any, Decl(underscoreTest1_underscore.ts, 262, 85)) +>any : Symbol(ChainedArray.any, Decl(underscoreTest1_underscore.ts, 262, 85)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 263, 12)) >Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) @@ -2509,30 +2509,30 @@ module Underscore { >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) contains(value: T): ChainedObject; ->contains : Symbol(contains, Decl(underscoreTest1_underscore.ts, 263, 84)) +>contains : Symbol(ChainedArray.contains, Decl(underscoreTest1_underscore.ts, 263, 84)) >value : Symbol(value, Decl(underscoreTest1_underscore.ts, 264, 17)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) include(value: T): ChainedObject; ->include : Symbol(include, Decl(underscoreTest1_underscore.ts, 264, 51)) +>include : Symbol(ChainedArray.include, Decl(underscoreTest1_underscore.ts, 264, 51)) >value : Symbol(value, Decl(underscoreTest1_underscore.ts, 265, 16)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) invoke(methodName: string, ...args: any[]): ChainedArray; ->invoke : Symbol(invoke, Decl(underscoreTest1_underscore.ts, 265, 50)) +>invoke : Symbol(ChainedArray.invoke, Decl(underscoreTest1_underscore.ts, 265, 50)) >methodName : Symbol(methodName, Decl(underscoreTest1_underscore.ts, 266, 15)) >args : Symbol(args, Decl(underscoreTest1_underscore.ts, 266, 34)) >ChainedArray : Symbol(ChainedArray, Decl(underscoreTest1_underscore.ts, 236, 5)) pluck(propertyName: string): ChainedArray; ->pluck : Symbol(pluck, Decl(underscoreTest1_underscore.ts, 266, 70)) +>pluck : Symbol(ChainedArray.pluck, Decl(underscoreTest1_underscore.ts, 266, 70)) >propertyName : Symbol(propertyName, Decl(underscoreTest1_underscore.ts, 267, 14)) >ChainedArray : Symbol(ChainedArray, Decl(underscoreTest1_underscore.ts, 236, 5)) max(iterator?: Iterator, context?: any): ChainedObject; ->max : Symbol(max, Decl(underscoreTest1_underscore.ts, 267, 55)) +>max : Symbol(ChainedArray.max, Decl(underscoreTest1_underscore.ts, 267, 55)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 268, 12)) >Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) @@ -2541,7 +2541,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) min(iterator?: Iterator, context?: any): ChainedObject; ->min : Symbol(min, Decl(underscoreTest1_underscore.ts, 268, 74)) +>min : Symbol(ChainedArray.min, Decl(underscoreTest1_underscore.ts, 268, 74)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 269, 12)) >Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) @@ -2550,7 +2550,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) sortBy(iterator: Iterator, context?: any): ChainedArray; ->sortBy : Symbol(sortBy, Decl(underscoreTest1_underscore.ts, 269, 74), Decl(underscoreTest1_underscore.ts, 270, 75)) +>sortBy : Symbol(ChainedArray.sortBy, Decl(underscoreTest1_underscore.ts, 269, 74), Decl(underscoreTest1_underscore.ts, 270, 75)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 270, 15)) >Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) @@ -2559,14 +2559,14 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) sortBy(propertyName: string): ChainedArray; ->sortBy : Symbol(sortBy, Decl(underscoreTest1_underscore.ts, 269, 74), Decl(underscoreTest1_underscore.ts, 270, 75)) +>sortBy : Symbol(ChainedArray.sortBy, Decl(underscoreTest1_underscore.ts, 269, 74), Decl(underscoreTest1_underscore.ts, 270, 75)) >propertyName : Symbol(propertyName, Decl(underscoreTest1_underscore.ts, 271, 15)) >ChainedArray : Symbol(ChainedArray, Decl(underscoreTest1_underscore.ts, 236, 5)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) // Should return ChainedDictionary, but expansive recursion not allowed groupBy(iterator?: Iterator, context?: any): ChainedDictionary; ->groupBy : Symbol(groupBy, Decl(underscoreTest1_underscore.ts, 271, 54), Decl(underscoreTest1_underscore.ts, 273, 86)) +>groupBy : Symbol(ChainedArray.groupBy, Decl(underscoreTest1_underscore.ts, 271, 54), Decl(underscoreTest1_underscore.ts, 273, 86)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 273, 16)) >Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) @@ -2574,12 +2574,12 @@ module Underscore { >ChainedDictionary : Symbol(ChainedDictionary, Decl(underscoreTest1_underscore.ts, 327, 5)) groupBy(propertyName: string): ChainedDictionary; ->groupBy : Symbol(groupBy, Decl(underscoreTest1_underscore.ts, 271, 54), Decl(underscoreTest1_underscore.ts, 273, 86)) +>groupBy : Symbol(ChainedArray.groupBy, Decl(underscoreTest1_underscore.ts, 271, 54), Decl(underscoreTest1_underscore.ts, 273, 86)) >propertyName : Symbol(propertyName, Decl(underscoreTest1_underscore.ts, 274, 16)) >ChainedDictionary : Symbol(ChainedDictionary, Decl(underscoreTest1_underscore.ts, 327, 5)) countBy(iterator?: Iterator, context?: any): ChainedDictionary; ->countBy : Symbol(countBy, Decl(underscoreTest1_underscore.ts, 274, 64), Decl(underscoreTest1_underscore.ts, 275, 87)) +>countBy : Symbol(ChainedArray.countBy, Decl(underscoreTest1_underscore.ts, 274, 64), Decl(underscoreTest1_underscore.ts, 275, 87)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 275, 16)) >Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) @@ -2587,133 +2587,133 @@ module Underscore { >ChainedDictionary : Symbol(ChainedDictionary, Decl(underscoreTest1_underscore.ts, 327, 5)) countBy(propertyName: string): ChainedDictionary; ->countBy : Symbol(countBy, Decl(underscoreTest1_underscore.ts, 274, 64), Decl(underscoreTest1_underscore.ts, 275, 87)) +>countBy : Symbol(ChainedArray.countBy, Decl(underscoreTest1_underscore.ts, 274, 64), Decl(underscoreTest1_underscore.ts, 275, 87)) >propertyName : Symbol(propertyName, Decl(underscoreTest1_underscore.ts, 276, 16)) >ChainedDictionary : Symbol(ChainedDictionary, Decl(underscoreTest1_underscore.ts, 327, 5)) shuffle(): ChainedArray; ->shuffle : Symbol(shuffle, Decl(underscoreTest1_underscore.ts, 276, 65)) +>shuffle : Symbol(ChainedArray.shuffle, Decl(underscoreTest1_underscore.ts, 276, 65)) >ChainedArray : Symbol(ChainedArray, Decl(underscoreTest1_underscore.ts, 236, 5)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) toArray(): ChainedArray; ->toArray : Symbol(toArray, Decl(underscoreTest1_underscore.ts, 277, 35)) +>toArray : Symbol(ChainedArray.toArray, Decl(underscoreTest1_underscore.ts, 277, 35)) >ChainedArray : Symbol(ChainedArray, Decl(underscoreTest1_underscore.ts, 236, 5)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) size(): ChainedObject; ->size : Symbol(size, Decl(underscoreTest1_underscore.ts, 278, 35)) +>size : Symbol(ChainedArray.size, Decl(underscoreTest1_underscore.ts, 278, 35)) >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) first(): ChainedObject; ->first : Symbol(first, Decl(underscoreTest1_underscore.ts, 279, 38), Decl(underscoreTest1_underscore.ts, 280, 34)) +>first : Symbol(ChainedArray.first, Decl(underscoreTest1_underscore.ts, 279, 38), Decl(underscoreTest1_underscore.ts, 280, 34)) >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) first(count: number): ChainedArray; ->first : Symbol(first, Decl(underscoreTest1_underscore.ts, 279, 38), Decl(underscoreTest1_underscore.ts, 280, 34)) +>first : Symbol(ChainedArray.first, Decl(underscoreTest1_underscore.ts, 279, 38), Decl(underscoreTest1_underscore.ts, 280, 34)) >count : Symbol(count, Decl(underscoreTest1_underscore.ts, 281, 14)) >ChainedArray : Symbol(ChainedArray, Decl(underscoreTest1_underscore.ts, 236, 5)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) head(): ChainedObject; ->head : Symbol(head, Decl(underscoreTest1_underscore.ts, 281, 46), Decl(underscoreTest1_underscore.ts, 282, 33)) +>head : Symbol(ChainedArray.head, Decl(underscoreTest1_underscore.ts, 281, 46), Decl(underscoreTest1_underscore.ts, 282, 33)) >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) head(count: number): ChainedArray; ->head : Symbol(head, Decl(underscoreTest1_underscore.ts, 281, 46), Decl(underscoreTest1_underscore.ts, 282, 33)) +>head : Symbol(ChainedArray.head, Decl(underscoreTest1_underscore.ts, 281, 46), Decl(underscoreTest1_underscore.ts, 282, 33)) >count : Symbol(count, Decl(underscoreTest1_underscore.ts, 283, 13)) >ChainedArray : Symbol(ChainedArray, Decl(underscoreTest1_underscore.ts, 236, 5)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) take(): ChainedObject; ->take : Symbol(take, Decl(underscoreTest1_underscore.ts, 283, 45), Decl(underscoreTest1_underscore.ts, 284, 33)) +>take : Symbol(ChainedArray.take, Decl(underscoreTest1_underscore.ts, 283, 45), Decl(underscoreTest1_underscore.ts, 284, 33)) >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) take(count: number): ChainedArray; ->take : Symbol(take, Decl(underscoreTest1_underscore.ts, 283, 45), Decl(underscoreTest1_underscore.ts, 284, 33)) +>take : Symbol(ChainedArray.take, Decl(underscoreTest1_underscore.ts, 283, 45), Decl(underscoreTest1_underscore.ts, 284, 33)) >count : Symbol(count, Decl(underscoreTest1_underscore.ts, 285, 13)) >ChainedArray : Symbol(ChainedArray, Decl(underscoreTest1_underscore.ts, 236, 5)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) initial(): ChainedObject; ->initial : Symbol(initial, Decl(underscoreTest1_underscore.ts, 285, 45), Decl(underscoreTest1_underscore.ts, 286, 36)) +>initial : Symbol(ChainedArray.initial, Decl(underscoreTest1_underscore.ts, 285, 45), Decl(underscoreTest1_underscore.ts, 286, 36)) >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) initial(count: number): ChainedArray; ->initial : Symbol(initial, Decl(underscoreTest1_underscore.ts, 285, 45), Decl(underscoreTest1_underscore.ts, 286, 36)) +>initial : Symbol(ChainedArray.initial, Decl(underscoreTest1_underscore.ts, 285, 45), Decl(underscoreTest1_underscore.ts, 286, 36)) >count : Symbol(count, Decl(underscoreTest1_underscore.ts, 287, 16)) >ChainedArray : Symbol(ChainedArray, Decl(underscoreTest1_underscore.ts, 236, 5)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) last(): ChainedObject; ->last : Symbol(last, Decl(underscoreTest1_underscore.ts, 287, 48), Decl(underscoreTest1_underscore.ts, 288, 33)) +>last : Symbol(ChainedArray.last, Decl(underscoreTest1_underscore.ts, 287, 48), Decl(underscoreTest1_underscore.ts, 288, 33)) >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) last(count: number): ChainedArray; ->last : Symbol(last, Decl(underscoreTest1_underscore.ts, 287, 48), Decl(underscoreTest1_underscore.ts, 288, 33)) +>last : Symbol(ChainedArray.last, Decl(underscoreTest1_underscore.ts, 287, 48), Decl(underscoreTest1_underscore.ts, 288, 33)) >count : Symbol(count, Decl(underscoreTest1_underscore.ts, 289, 13)) >ChainedArray : Symbol(ChainedArray, Decl(underscoreTest1_underscore.ts, 236, 5)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) rest(index?: number): ChainedArray; ->rest : Symbol(rest, Decl(underscoreTest1_underscore.ts, 289, 45)) +>rest : Symbol(ChainedArray.rest, Decl(underscoreTest1_underscore.ts, 289, 45)) >index : Symbol(index, Decl(underscoreTest1_underscore.ts, 290, 13)) >ChainedArray : Symbol(ChainedArray, Decl(underscoreTest1_underscore.ts, 236, 5)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) compact(): ChainedArray; ->compact : Symbol(compact, Decl(underscoreTest1_underscore.ts, 290, 46)) +>compact : Symbol(ChainedArray.compact, Decl(underscoreTest1_underscore.ts, 290, 46)) >ChainedArray : Symbol(ChainedArray, Decl(underscoreTest1_underscore.ts, 236, 5)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) flatten(shallow?: boolean): ChainedArray; ->flatten : Symbol(flatten, Decl(underscoreTest1_underscore.ts, 291, 35)) +>flatten : Symbol(ChainedArray.flatten, Decl(underscoreTest1_underscore.ts, 291, 35)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 292, 16)) >shallow : Symbol(shallow, Decl(underscoreTest1_underscore.ts, 292, 19)) >ChainedArray : Symbol(ChainedArray, Decl(underscoreTest1_underscore.ts, 236, 5)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 292, 16)) without(...values: T[]): ChainedArray; ->without : Symbol(without, Decl(underscoreTest1_underscore.ts, 292, 55)) +>without : Symbol(ChainedArray.without, Decl(underscoreTest1_underscore.ts, 292, 55)) >values : Symbol(values, Decl(underscoreTest1_underscore.ts, 293, 16)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) >ChainedArray : Symbol(ChainedArray, Decl(underscoreTest1_underscore.ts, 236, 5)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) union(...arrays: T[][]): ChainedArray; ->union : Symbol(union, Decl(underscoreTest1_underscore.ts, 293, 49)) +>union : Symbol(ChainedArray.union, Decl(underscoreTest1_underscore.ts, 293, 49)) >arrays : Symbol(arrays, Decl(underscoreTest1_underscore.ts, 294, 14)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) >ChainedArray : Symbol(ChainedArray, Decl(underscoreTest1_underscore.ts, 236, 5)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) intersection(...arrays: T[][]): ChainedArray; ->intersection : Symbol(intersection, Decl(underscoreTest1_underscore.ts, 294, 49)) +>intersection : Symbol(ChainedArray.intersection, Decl(underscoreTest1_underscore.ts, 294, 49)) >arrays : Symbol(arrays, Decl(underscoreTest1_underscore.ts, 295, 21)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) >ChainedArray : Symbol(ChainedArray, Decl(underscoreTest1_underscore.ts, 236, 5)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) difference(...others: T[][]): ChainedArray; ->difference : Symbol(difference, Decl(underscoreTest1_underscore.ts, 295, 56)) +>difference : Symbol(ChainedArray.difference, Decl(underscoreTest1_underscore.ts, 295, 56)) >others : Symbol(others, Decl(underscoreTest1_underscore.ts, 296, 19)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) >ChainedArray : Symbol(ChainedArray, Decl(underscoreTest1_underscore.ts, 236, 5)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) uniq(isSorted?: boolean): ChainedArray; ->uniq : Symbol(uniq, Decl(underscoreTest1_underscore.ts, 296, 54), Decl(underscoreTest1_underscore.ts, 297, 50)) +>uniq : Symbol(ChainedArray.uniq, Decl(underscoreTest1_underscore.ts, 296, 54), Decl(underscoreTest1_underscore.ts, 297, 50)) >isSorted : Symbol(isSorted, Decl(underscoreTest1_underscore.ts, 297, 13)) >ChainedArray : Symbol(ChainedArray, Decl(underscoreTest1_underscore.ts, 236, 5)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) uniq(isSorted: boolean, iterator: Iterator, context?: any): ChainedArray; ->uniq : Symbol(uniq, Decl(underscoreTest1_underscore.ts, 296, 54), Decl(underscoreTest1_underscore.ts, 297, 50)) +>uniq : Symbol(ChainedArray.uniq, Decl(underscoreTest1_underscore.ts, 296, 54), Decl(underscoreTest1_underscore.ts, 297, 50)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 298, 13)) >isSorted : Symbol(isSorted, Decl(underscoreTest1_underscore.ts, 298, 16)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 298, 34)) @@ -2725,13 +2725,13 @@ module Underscore { >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 298, 13)) unique(isSorted?: boolean): ChainedArray; ->unique : Symbol(unique, Decl(underscoreTest1_underscore.ts, 298, 93), Decl(underscoreTest1_underscore.ts, 299, 52)) +>unique : Symbol(ChainedArray.unique, Decl(underscoreTest1_underscore.ts, 298, 93), Decl(underscoreTest1_underscore.ts, 299, 52)) >isSorted : Symbol(isSorted, Decl(underscoreTest1_underscore.ts, 299, 15)) >ChainedArray : Symbol(ChainedArray, Decl(underscoreTest1_underscore.ts, 236, 5)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) unique(isSorted: boolean, iterator: Iterator, context?: any): ChainedArray; ->unique : Symbol(unique, Decl(underscoreTest1_underscore.ts, 298, 93), Decl(underscoreTest1_underscore.ts, 299, 52)) +>unique : Symbol(ChainedArray.unique, Decl(underscoreTest1_underscore.ts, 298, 93), Decl(underscoreTest1_underscore.ts, 299, 52)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 300, 15)) >isSorted : Symbol(isSorted, Decl(underscoreTest1_underscore.ts, 300, 18)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 300, 36)) @@ -2743,42 +2743,42 @@ module Underscore { >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 300, 15)) zip(...arrays: any[][]): ChainedArray; ->zip : Symbol(zip, Decl(underscoreTest1_underscore.ts, 300, 95)) +>zip : Symbol(ChainedArray.zip, Decl(underscoreTest1_underscore.ts, 300, 95)) >arrays : Symbol(arrays, Decl(underscoreTest1_underscore.ts, 301, 12)) >ChainedArray : Symbol(ChainedArray, Decl(underscoreTest1_underscore.ts, 236, 5)) object(): ChainedObject; ->object : Symbol(object, Decl(underscoreTest1_underscore.ts, 301, 53), Decl(underscoreTest1_underscore.ts, 302, 37)) +>object : Symbol(ChainedArray.object, Decl(underscoreTest1_underscore.ts, 301, 53), Decl(underscoreTest1_underscore.ts, 302, 37)) >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) object(values: any[]): ChainedObject; ->object : Symbol(object, Decl(underscoreTest1_underscore.ts, 301, 53), Decl(underscoreTest1_underscore.ts, 302, 37)) +>object : Symbol(ChainedArray.object, Decl(underscoreTest1_underscore.ts, 301, 53), Decl(underscoreTest1_underscore.ts, 302, 37)) >values : Symbol(values, Decl(underscoreTest1_underscore.ts, 303, 15)) >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) indexOf(value: T, isSorted?: boolean): ChainedObject; ->indexOf : Symbol(indexOf, Decl(underscoreTest1_underscore.ts, 303, 50)) +>indexOf : Symbol(ChainedArray.indexOf, Decl(underscoreTest1_underscore.ts, 303, 50)) >value : Symbol(value, Decl(underscoreTest1_underscore.ts, 304, 16)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) >isSorted : Symbol(isSorted, Decl(underscoreTest1_underscore.ts, 304, 25)) >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) lastIndexOf(value: T, fromIndex?: number): ChainedObject; ->lastIndexOf : Symbol(lastIndexOf, Decl(underscoreTest1_underscore.ts, 304, 69)) +>lastIndexOf : Symbol(ChainedArray.lastIndexOf, Decl(underscoreTest1_underscore.ts, 304, 69)) >value : Symbol(value, Decl(underscoreTest1_underscore.ts, 305, 20)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) >fromIndex : Symbol(fromIndex, Decl(underscoreTest1_underscore.ts, 305, 29)) >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) sortedIndex(obj: T, propertyName: string): ChainedObject; ->sortedIndex : Symbol(sortedIndex, Decl(underscoreTest1_underscore.ts, 305, 73), Decl(underscoreTest1_underscore.ts, 306, 73)) +>sortedIndex : Symbol(ChainedArray.sortedIndex, Decl(underscoreTest1_underscore.ts, 305, 73), Decl(underscoreTest1_underscore.ts, 306, 73)) >obj : Symbol(obj, Decl(underscoreTest1_underscore.ts, 306, 20)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) >propertyName : Symbol(propertyName, Decl(underscoreTest1_underscore.ts, 306, 27)) >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) sortedIndex(obj: T, iterator?: Iterator, context?: any): ChainedObject; ->sortedIndex : Symbol(sortedIndex, Decl(underscoreTest1_underscore.ts, 305, 73), Decl(underscoreTest1_underscore.ts, 306, 73)) +>sortedIndex : Symbol(ChainedArray.sortedIndex, Decl(underscoreTest1_underscore.ts, 305, 73), Decl(underscoreTest1_underscore.ts, 306, 73)) >obj : Symbol(obj, Decl(underscoreTest1_underscore.ts, 307, 20)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 307, 27)) @@ -2789,47 +2789,47 @@ module Underscore { // Methods from Array concat(...items: T[]): ChainedArray; ->concat : Symbol(concat, Decl(underscoreTest1_underscore.ts, 307, 95)) +>concat : Symbol(ChainedArray.concat, Decl(underscoreTest1_underscore.ts, 307, 95)) >items : Symbol(items, Decl(underscoreTest1_underscore.ts, 309, 15)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) >ChainedArray : Symbol(ChainedArray, Decl(underscoreTest1_underscore.ts, 236, 5)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) join(separator?: string): ChainedObject; ->join : Symbol(join, Decl(underscoreTest1_underscore.ts, 309, 47)) +>join : Symbol(ChainedArray.join, Decl(underscoreTest1_underscore.ts, 309, 47)) >separator : Symbol(separator, Decl(underscoreTest1_underscore.ts, 310, 13)) >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) pop(): ChainedObject; ->pop : Symbol(pop, Decl(underscoreTest1_underscore.ts, 310, 56)) +>pop : Symbol(ChainedArray.pop, Decl(underscoreTest1_underscore.ts, 310, 56)) >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) push(...items: T[]): ChainedObject; ->push : Symbol(push, Decl(underscoreTest1_underscore.ts, 311, 32)) +>push : Symbol(ChainedArray.push, Decl(underscoreTest1_underscore.ts, 311, 32)) >items : Symbol(items, Decl(underscoreTest1_underscore.ts, 312, 13)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) reverse(): ChainedArray; ->reverse : Symbol(reverse, Decl(underscoreTest1_underscore.ts, 312, 51)) +>reverse : Symbol(ChainedArray.reverse, Decl(underscoreTest1_underscore.ts, 312, 51)) >ChainedArray : Symbol(ChainedArray, Decl(underscoreTest1_underscore.ts, 236, 5)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) shift(): ChainedObject; ->shift : Symbol(shift, Decl(underscoreTest1_underscore.ts, 313, 35)) +>shift : Symbol(ChainedArray.shift, Decl(underscoreTest1_underscore.ts, 313, 35)) >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) slice(start: number, end?: number): ChainedArray; ->slice : Symbol(slice, Decl(underscoreTest1_underscore.ts, 314, 34)) +>slice : Symbol(ChainedArray.slice, Decl(underscoreTest1_underscore.ts, 314, 34)) >start : Symbol(start, Decl(underscoreTest1_underscore.ts, 315, 14)) >end : Symbol(end, Decl(underscoreTest1_underscore.ts, 315, 28)) >ChainedArray : Symbol(ChainedArray, Decl(underscoreTest1_underscore.ts, 236, 5)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) sort(compareFn?: (a: T, b: T) => number): ChainedArray; ->sort : Symbol(sort, Decl(underscoreTest1_underscore.ts, 315, 60)) +>sort : Symbol(ChainedArray.sort, Decl(underscoreTest1_underscore.ts, 315, 60)) >compareFn : Symbol(compareFn, Decl(underscoreTest1_underscore.ts, 316, 13)) >a : Symbol(a, Decl(underscoreTest1_underscore.ts, 316, 26)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) @@ -2839,13 +2839,13 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) splice(start: number): ChainedArray; ->splice : Symbol(splice, Decl(underscoreTest1_underscore.ts, 316, 66), Decl(underscoreTest1_underscore.ts, 317, 47)) +>splice : Symbol(ChainedArray.splice, Decl(underscoreTest1_underscore.ts, 316, 66), Decl(underscoreTest1_underscore.ts, 317, 47)) >start : Symbol(start, Decl(underscoreTest1_underscore.ts, 317, 15)) >ChainedArray : Symbol(ChainedArray, Decl(underscoreTest1_underscore.ts, 236, 5)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) splice(start: number, deleteCount: number, ...items: T[]): ChainedArray; ->splice : Symbol(splice, Decl(underscoreTest1_underscore.ts, 316, 66), Decl(underscoreTest1_underscore.ts, 317, 47)) +>splice : Symbol(ChainedArray.splice, Decl(underscoreTest1_underscore.ts, 316, 66), Decl(underscoreTest1_underscore.ts, 317, 47)) >start : Symbol(start, Decl(underscoreTest1_underscore.ts, 318, 15)) >deleteCount : Symbol(deleteCount, Decl(underscoreTest1_underscore.ts, 318, 29)) >items : Symbol(items, Decl(underscoreTest1_underscore.ts, 318, 50)) @@ -2854,43 +2854,43 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) unshift(...items: T[]): ChainedObject; ->unshift : Symbol(unshift, Decl(underscoreTest1_underscore.ts, 318, 83)) +>unshift : Symbol(ChainedArray.unshift, Decl(underscoreTest1_underscore.ts, 318, 83)) >items : Symbol(items, Decl(underscoreTest1_underscore.ts, 319, 16)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) // Methods from ChainedObject with promoted return types extend(...sources: any[]): ChainedArray; ->extend : Symbol(extend, Decl(underscoreTest1_underscore.ts, 319, 54)) +>extend : Symbol(ChainedArray.extend, Decl(underscoreTest1_underscore.ts, 319, 54)) >sources : Symbol(sources, Decl(underscoreTest1_underscore.ts, 321, 15)) >ChainedArray : Symbol(ChainedArray, Decl(underscoreTest1_underscore.ts, 236, 5)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) pick(...keys: string[]): ChainedArray; ->pick : Symbol(pick, Decl(underscoreTest1_underscore.ts, 321, 51)) +>pick : Symbol(ChainedArray.pick, Decl(underscoreTest1_underscore.ts, 321, 51)) >keys : Symbol(keys, Decl(underscoreTest1_underscore.ts, 322, 13)) >ChainedArray : Symbol(ChainedArray, Decl(underscoreTest1_underscore.ts, 236, 5)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) omit(...keys: string[]): ChainedArray; ->omit : Symbol(omit, Decl(underscoreTest1_underscore.ts, 322, 49)) +>omit : Symbol(ChainedArray.omit, Decl(underscoreTest1_underscore.ts, 322, 49)) >keys : Symbol(keys, Decl(underscoreTest1_underscore.ts, 323, 13)) >ChainedArray : Symbol(ChainedArray, Decl(underscoreTest1_underscore.ts, 236, 5)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) defaults(...defaults: any[]): ChainedArray; ->defaults : Symbol(defaults, Decl(underscoreTest1_underscore.ts, 323, 49)) +>defaults : Symbol(ChainedArray.defaults, Decl(underscoreTest1_underscore.ts, 323, 49)) >defaults : Symbol(defaults, Decl(underscoreTest1_underscore.ts, 324, 17)) >ChainedArray : Symbol(ChainedArray, Decl(underscoreTest1_underscore.ts, 236, 5)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) clone(): ChainedArray; ->clone : Symbol(clone, Decl(underscoreTest1_underscore.ts, 324, 54)) +>clone : Symbol(ChainedArray.clone, Decl(underscoreTest1_underscore.ts, 324, 54)) >ChainedArray : Symbol(ChainedArray, Decl(underscoreTest1_underscore.ts, 236, 5)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) tap(interceptor: (object: T[]) => void): ChainedArray; ->tap : Symbol(tap, Decl(underscoreTest1_underscore.ts, 325, 33)) +>tap : Symbol(ChainedArray.tap, Decl(underscoreTest1_underscore.ts, 325, 33)) >interceptor : Symbol(interceptor, Decl(underscoreTest1_underscore.ts, 326, 12)) >object : Symbol(object, Decl(underscoreTest1_underscore.ts, 326, 26)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) @@ -2906,7 +2906,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) each(iterator: Iterator, context?: any): ChainedObject; ->each : Symbol(each, Decl(underscoreTest1_underscore.ts, 329, 80)) +>each : Symbol(ChainedDictionary.each, Decl(underscoreTest1_underscore.ts, 329, 80)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 330, 13)) >Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) @@ -2914,7 +2914,7 @@ module Underscore { >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) forEach(iterator: Iterator, context?: any): ChainedObject; ->forEach : Symbol(forEach, Decl(underscoreTest1_underscore.ts, 330, 78)) +>forEach : Symbol(ChainedDictionary.forEach, Decl(underscoreTest1_underscore.ts, 330, 78)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 331, 16)) >Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) @@ -2922,7 +2922,7 @@ module Underscore { >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) map(iterator: Iterator, context?: any): ChainedArray; ->map : Symbol(map, Decl(underscoreTest1_underscore.ts, 331, 81)) +>map : Symbol(ChainedDictionary.map, Decl(underscoreTest1_underscore.ts, 331, 81)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 332, 12)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 332, 15)) >Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) @@ -2933,7 +2933,7 @@ module Underscore { >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 332, 12)) collect(iterator: Iterator, context?: any): ChainedArray; ->collect : Symbol(collect, Decl(underscoreTest1_underscore.ts, 332, 73)) +>collect : Symbol(ChainedDictionary.collect, Decl(underscoreTest1_underscore.ts, 332, 73)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 333, 16)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 333, 19)) >Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) @@ -2944,7 +2944,7 @@ module Underscore { >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 333, 16)) reduce(iterator: Reducer, initialValue?: T, context?: any): ChainedObject; ->reduce : Symbol(reduce, Decl(underscoreTest1_underscore.ts, 333, 77), Decl(underscoreTest1_underscore.ts, 334, 91)) +>reduce : Symbol(ChainedDictionary.reduce, Decl(underscoreTest1_underscore.ts, 333, 77), Decl(underscoreTest1_underscore.ts, 334, 91)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 334, 15)) >Reducer : Symbol(Reducer, Decl(underscoreTest1_underscore.ts, 6, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) @@ -2956,7 +2956,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) reduce(iterator: Reducer, initialValue: U, context?: any): ChainedObject; ->reduce : Symbol(reduce, Decl(underscoreTest1_underscore.ts, 333, 77), Decl(underscoreTest1_underscore.ts, 334, 91)) +>reduce : Symbol(ChainedDictionary.reduce, Decl(underscoreTest1_underscore.ts, 333, 77), Decl(underscoreTest1_underscore.ts, 334, 91)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 335, 15)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 335, 18)) >Reducer : Symbol(Reducer, Decl(underscoreTest1_underscore.ts, 6, 1)) @@ -2969,7 +2969,7 @@ module Underscore { >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 335, 15)) foldl(iterator: Reducer, initialValue?: T, context?: any): ChainedObject; ->foldl : Symbol(foldl, Decl(underscoreTest1_underscore.ts, 335, 93), Decl(underscoreTest1_underscore.ts, 336, 90)) +>foldl : Symbol(ChainedDictionary.foldl, Decl(underscoreTest1_underscore.ts, 335, 93), Decl(underscoreTest1_underscore.ts, 336, 90)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 336, 14)) >Reducer : Symbol(Reducer, Decl(underscoreTest1_underscore.ts, 6, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) @@ -2981,7 +2981,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) foldl(iterator: Reducer, initialValue: U, context?: any): ChainedObject; ->foldl : Symbol(foldl, Decl(underscoreTest1_underscore.ts, 335, 93), Decl(underscoreTest1_underscore.ts, 336, 90)) +>foldl : Symbol(ChainedDictionary.foldl, Decl(underscoreTest1_underscore.ts, 335, 93), Decl(underscoreTest1_underscore.ts, 336, 90)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 337, 14)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 337, 17)) >Reducer : Symbol(Reducer, Decl(underscoreTest1_underscore.ts, 6, 1)) @@ -2994,7 +2994,7 @@ module Underscore { >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 337, 14)) inject(iterator: Reducer, initialValue?: T, context?: any): ChainedObject; ->inject : Symbol(inject, Decl(underscoreTest1_underscore.ts, 337, 92), Decl(underscoreTest1_underscore.ts, 338, 91)) +>inject : Symbol(ChainedDictionary.inject, Decl(underscoreTest1_underscore.ts, 337, 92), Decl(underscoreTest1_underscore.ts, 338, 91)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 338, 15)) >Reducer : Symbol(Reducer, Decl(underscoreTest1_underscore.ts, 6, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) @@ -3006,7 +3006,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) inject(iterator: Reducer, initialValue: U, context?: any): ChainedObject; ->inject : Symbol(inject, Decl(underscoreTest1_underscore.ts, 337, 92), Decl(underscoreTest1_underscore.ts, 338, 91)) +>inject : Symbol(ChainedDictionary.inject, Decl(underscoreTest1_underscore.ts, 337, 92), Decl(underscoreTest1_underscore.ts, 338, 91)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 339, 15)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 339, 18)) >Reducer : Symbol(Reducer, Decl(underscoreTest1_underscore.ts, 6, 1)) @@ -3019,7 +3019,7 @@ module Underscore { >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 339, 15)) reduceRight(iterator: Reducer, initialValue?: T, context?: any): ChainedObject; ->reduceRight : Symbol(reduceRight, Decl(underscoreTest1_underscore.ts, 339, 93), Decl(underscoreTest1_underscore.ts, 340, 96)) +>reduceRight : Symbol(ChainedDictionary.reduceRight, Decl(underscoreTest1_underscore.ts, 339, 93), Decl(underscoreTest1_underscore.ts, 340, 96)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 340, 20)) >Reducer : Symbol(Reducer, Decl(underscoreTest1_underscore.ts, 6, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) @@ -3031,7 +3031,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) reduceRight(iterator: Reducer, initialValue: U, context?: any): ChainedObject; ->reduceRight : Symbol(reduceRight, Decl(underscoreTest1_underscore.ts, 339, 93), Decl(underscoreTest1_underscore.ts, 340, 96)) +>reduceRight : Symbol(ChainedDictionary.reduceRight, Decl(underscoreTest1_underscore.ts, 339, 93), Decl(underscoreTest1_underscore.ts, 340, 96)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 341, 20)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 341, 23)) >Reducer : Symbol(Reducer, Decl(underscoreTest1_underscore.ts, 6, 1)) @@ -3044,7 +3044,7 @@ module Underscore { >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 341, 20)) foldr(iterator: Reducer, initialValue?: T, context?: any): ChainedObject; ->foldr : Symbol(foldr, Decl(underscoreTest1_underscore.ts, 341, 98), Decl(underscoreTest1_underscore.ts, 342, 90)) +>foldr : Symbol(ChainedDictionary.foldr, Decl(underscoreTest1_underscore.ts, 341, 98), Decl(underscoreTest1_underscore.ts, 342, 90)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 342, 14)) >Reducer : Symbol(Reducer, Decl(underscoreTest1_underscore.ts, 6, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) @@ -3056,7 +3056,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) foldr(iterator: Reducer, initialValue: U, context?: any): ChainedObject; ->foldr : Symbol(foldr, Decl(underscoreTest1_underscore.ts, 341, 98), Decl(underscoreTest1_underscore.ts, 342, 90)) +>foldr : Symbol(ChainedDictionary.foldr, Decl(underscoreTest1_underscore.ts, 341, 98), Decl(underscoreTest1_underscore.ts, 342, 90)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 343, 14)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 343, 17)) >Reducer : Symbol(Reducer, Decl(underscoreTest1_underscore.ts, 6, 1)) @@ -3069,7 +3069,7 @@ module Underscore { >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 343, 14)) find(iterator: Iterator, context?: any): ChainedObject; ->find : Symbol(find, Decl(underscoreTest1_underscore.ts, 343, 92)) +>find : Symbol(ChainedDictionary.find, Decl(underscoreTest1_underscore.ts, 343, 92)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 344, 13)) >Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) @@ -3078,7 +3078,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) detect(iterator: Iterator, context?: any): ChainedObject; ->detect : Symbol(detect, Decl(underscoreTest1_underscore.ts, 344, 78)) +>detect : Symbol(ChainedDictionary.detect, Decl(underscoreTest1_underscore.ts, 344, 78)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 345, 15)) >Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) @@ -3087,7 +3087,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) filter(iterator: Iterator, context?: any): ChainedArray; ->filter : Symbol(filter, Decl(underscoreTest1_underscore.ts, 345, 80)) +>filter : Symbol(ChainedDictionary.filter, Decl(underscoreTest1_underscore.ts, 345, 80)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 346, 15)) >Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) @@ -3096,7 +3096,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) select(iterator: Iterator, context?: any): ChainedArray; ->select : Symbol(select, Decl(underscoreTest1_underscore.ts, 346, 79)) +>select : Symbol(ChainedDictionary.select, Decl(underscoreTest1_underscore.ts, 346, 79)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 347, 15)) >Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) @@ -3105,21 +3105,21 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) where(properties: Object): ChainedArray; ->where : Symbol(where, Decl(underscoreTest1_underscore.ts, 347, 79)) +>where : Symbol(ChainedDictionary.where, Decl(underscoreTest1_underscore.ts, 347, 79)) >properties : Symbol(properties, Decl(underscoreTest1_underscore.ts, 348, 14)) >Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >ChainedArray : Symbol(ChainedArray, Decl(underscoreTest1_underscore.ts, 236, 5)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) findWhere(properties: Object): ChainedObject; ->findWhere : Symbol(findWhere, Decl(underscoreTest1_underscore.ts, 348, 51)) +>findWhere : Symbol(ChainedDictionary.findWhere, Decl(underscoreTest1_underscore.ts, 348, 51)) >properties : Symbol(properties, Decl(underscoreTest1_underscore.ts, 349, 18)) >Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) reject(iterator: Iterator, context?: any): ChainedArray; ->reject : Symbol(reject, Decl(underscoreTest1_underscore.ts, 349, 56)) +>reject : Symbol(ChainedDictionary.reject, Decl(underscoreTest1_underscore.ts, 349, 56)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 350, 15)) >Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) @@ -3128,7 +3128,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) every(iterator?: Iterator, context?: any): ChainedObject; ->every : Symbol(every, Decl(underscoreTest1_underscore.ts, 350, 79)) +>every : Symbol(ChainedDictionary.every, Decl(underscoreTest1_underscore.ts, 350, 79)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 351, 14)) >Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) @@ -3136,7 +3136,7 @@ module Underscore { >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) all(iterator?: Iterator, context?: any): ChainedObject; ->all : Symbol(all, Decl(underscoreTest1_underscore.ts, 351, 86)) +>all : Symbol(ChainedDictionary.all, Decl(underscoreTest1_underscore.ts, 351, 86)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 352, 12)) >Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) @@ -3144,7 +3144,7 @@ module Underscore { >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) some(iterator?: Iterator, context?: any): ChainedObject; ->some : Symbol(some, Decl(underscoreTest1_underscore.ts, 352, 84)) +>some : Symbol(ChainedDictionary.some, Decl(underscoreTest1_underscore.ts, 352, 84)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 353, 13)) >Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) @@ -3152,7 +3152,7 @@ module Underscore { >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) any(iterator?: Iterator, context?: any): ChainedObject; ->any : Symbol(any, Decl(underscoreTest1_underscore.ts, 353, 85)) +>any : Symbol(ChainedDictionary.any, Decl(underscoreTest1_underscore.ts, 353, 85)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 354, 12)) >Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) @@ -3160,30 +3160,30 @@ module Underscore { >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) contains(value: T): ChainedObject; ->contains : Symbol(contains, Decl(underscoreTest1_underscore.ts, 354, 84)) +>contains : Symbol(ChainedDictionary.contains, Decl(underscoreTest1_underscore.ts, 354, 84)) >value : Symbol(value, Decl(underscoreTest1_underscore.ts, 355, 17)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) include(value: T): ChainedObject; ->include : Symbol(include, Decl(underscoreTest1_underscore.ts, 355, 51)) +>include : Symbol(ChainedDictionary.include, Decl(underscoreTest1_underscore.ts, 355, 51)) >value : Symbol(value, Decl(underscoreTest1_underscore.ts, 356, 16)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) invoke(methodName: string, ...args: any[]): ChainedArray; ->invoke : Symbol(invoke, Decl(underscoreTest1_underscore.ts, 356, 50)) +>invoke : Symbol(ChainedDictionary.invoke, Decl(underscoreTest1_underscore.ts, 356, 50)) >methodName : Symbol(methodName, Decl(underscoreTest1_underscore.ts, 357, 15)) >args : Symbol(args, Decl(underscoreTest1_underscore.ts, 357, 34)) >ChainedArray : Symbol(ChainedArray, Decl(underscoreTest1_underscore.ts, 236, 5)) pluck(propertyName: string): ChainedArray; ->pluck : Symbol(pluck, Decl(underscoreTest1_underscore.ts, 357, 70)) +>pluck : Symbol(ChainedDictionary.pluck, Decl(underscoreTest1_underscore.ts, 357, 70)) >propertyName : Symbol(propertyName, Decl(underscoreTest1_underscore.ts, 358, 14)) >ChainedArray : Symbol(ChainedArray, Decl(underscoreTest1_underscore.ts, 236, 5)) max(iterator?: Iterator, context?: any): ChainedObject; ->max : Symbol(max, Decl(underscoreTest1_underscore.ts, 358, 55)) +>max : Symbol(ChainedDictionary.max, Decl(underscoreTest1_underscore.ts, 358, 55)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 359, 12)) >Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) @@ -3192,7 +3192,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) min(iterator?: Iterator, context?: any): ChainedObject; ->min : Symbol(min, Decl(underscoreTest1_underscore.ts, 359, 74)) +>min : Symbol(ChainedDictionary.min, Decl(underscoreTest1_underscore.ts, 359, 74)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 360, 12)) >Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) @@ -3201,7 +3201,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) sortBy(iterator: Iterator, context?: any): ChainedArray; ->sortBy : Symbol(sortBy, Decl(underscoreTest1_underscore.ts, 360, 74), Decl(underscoreTest1_underscore.ts, 361, 75)) +>sortBy : Symbol(ChainedDictionary.sortBy, Decl(underscoreTest1_underscore.ts, 360, 74), Decl(underscoreTest1_underscore.ts, 361, 75)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 361, 15)) >Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) @@ -3210,14 +3210,14 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) sortBy(propertyName: string): ChainedArray; ->sortBy : Symbol(sortBy, Decl(underscoreTest1_underscore.ts, 360, 74), Decl(underscoreTest1_underscore.ts, 361, 75)) +>sortBy : Symbol(ChainedDictionary.sortBy, Decl(underscoreTest1_underscore.ts, 360, 74), Decl(underscoreTest1_underscore.ts, 361, 75)) >propertyName : Symbol(propertyName, Decl(underscoreTest1_underscore.ts, 362, 15)) >ChainedArray : Symbol(ChainedArray, Decl(underscoreTest1_underscore.ts, 236, 5)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) // Should return ChainedDictionary, but expansive recursion not allowed groupBy(iterator?: Iterator, context?: any): ChainedDictionary; ->groupBy : Symbol(groupBy, Decl(underscoreTest1_underscore.ts, 362, 54), Decl(underscoreTest1_underscore.ts, 364, 86)) +>groupBy : Symbol(ChainedDictionary.groupBy, Decl(underscoreTest1_underscore.ts, 362, 54), Decl(underscoreTest1_underscore.ts, 364, 86)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 364, 16)) >Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) @@ -3225,12 +3225,12 @@ module Underscore { >ChainedDictionary : Symbol(ChainedDictionary, Decl(underscoreTest1_underscore.ts, 327, 5)) groupBy(propertyName: string): ChainedDictionary; ->groupBy : Symbol(groupBy, Decl(underscoreTest1_underscore.ts, 362, 54), Decl(underscoreTest1_underscore.ts, 364, 86)) +>groupBy : Symbol(ChainedDictionary.groupBy, Decl(underscoreTest1_underscore.ts, 362, 54), Decl(underscoreTest1_underscore.ts, 364, 86)) >propertyName : Symbol(propertyName, Decl(underscoreTest1_underscore.ts, 365, 16)) >ChainedDictionary : Symbol(ChainedDictionary, Decl(underscoreTest1_underscore.ts, 327, 5)) countBy(iterator?: Iterator, context?: any): ChainedDictionary; ->countBy : Symbol(countBy, Decl(underscoreTest1_underscore.ts, 365, 64), Decl(underscoreTest1_underscore.ts, 366, 87)) +>countBy : Symbol(ChainedDictionary.countBy, Decl(underscoreTest1_underscore.ts, 365, 64), Decl(underscoreTest1_underscore.ts, 366, 87)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 366, 16)) >Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) @@ -3238,56 +3238,56 @@ module Underscore { >ChainedDictionary : Symbol(ChainedDictionary, Decl(underscoreTest1_underscore.ts, 327, 5)) countBy(propertyName: string): ChainedDictionary; ->countBy : Symbol(countBy, Decl(underscoreTest1_underscore.ts, 365, 64), Decl(underscoreTest1_underscore.ts, 366, 87)) +>countBy : Symbol(ChainedDictionary.countBy, Decl(underscoreTest1_underscore.ts, 365, 64), Decl(underscoreTest1_underscore.ts, 366, 87)) >propertyName : Symbol(propertyName, Decl(underscoreTest1_underscore.ts, 367, 16)) >ChainedDictionary : Symbol(ChainedDictionary, Decl(underscoreTest1_underscore.ts, 327, 5)) shuffle(): ChainedArray; ->shuffle : Symbol(shuffle, Decl(underscoreTest1_underscore.ts, 367, 65)) +>shuffle : Symbol(ChainedDictionary.shuffle, Decl(underscoreTest1_underscore.ts, 367, 65)) >ChainedArray : Symbol(ChainedArray, Decl(underscoreTest1_underscore.ts, 236, 5)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) toArray(): ChainedArray; ->toArray : Symbol(toArray, Decl(underscoreTest1_underscore.ts, 368, 35)) +>toArray : Symbol(ChainedDictionary.toArray, Decl(underscoreTest1_underscore.ts, 368, 35)) >ChainedArray : Symbol(ChainedArray, Decl(underscoreTest1_underscore.ts, 236, 5)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) size(): ChainedObject; ->size : Symbol(size, Decl(underscoreTest1_underscore.ts, 369, 35)) +>size : Symbol(ChainedDictionary.size, Decl(underscoreTest1_underscore.ts, 369, 35)) >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) // Methods from ChainedObject with promoted return types extend(...sources: any[]): ChainedDictionary; ->extend : Symbol(extend, Decl(underscoreTest1_underscore.ts, 370, 38)) +>extend : Symbol(ChainedDictionary.extend, Decl(underscoreTest1_underscore.ts, 370, 38)) >sources : Symbol(sources, Decl(underscoreTest1_underscore.ts, 372, 15)) >ChainedDictionary : Symbol(ChainedDictionary, Decl(underscoreTest1_underscore.ts, 327, 5)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) pick(...keys: string[]): ChainedDictionary; ->pick : Symbol(pick, Decl(underscoreTest1_underscore.ts, 372, 56)) +>pick : Symbol(ChainedDictionary.pick, Decl(underscoreTest1_underscore.ts, 372, 56)) >keys : Symbol(keys, Decl(underscoreTest1_underscore.ts, 373, 13)) >ChainedDictionary : Symbol(ChainedDictionary, Decl(underscoreTest1_underscore.ts, 327, 5)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) omit(...keys: string[]): ChainedDictionary; ->omit : Symbol(omit, Decl(underscoreTest1_underscore.ts, 373, 54)) +>omit : Symbol(ChainedDictionary.omit, Decl(underscoreTest1_underscore.ts, 373, 54)) >keys : Symbol(keys, Decl(underscoreTest1_underscore.ts, 374, 13)) >ChainedDictionary : Symbol(ChainedDictionary, Decl(underscoreTest1_underscore.ts, 327, 5)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) defaults(...defaults: any[]): ChainedDictionary; ->defaults : Symbol(defaults, Decl(underscoreTest1_underscore.ts, 374, 54)) +>defaults : Symbol(ChainedDictionary.defaults, Decl(underscoreTest1_underscore.ts, 374, 54)) >defaults : Symbol(defaults, Decl(underscoreTest1_underscore.ts, 375, 17)) >ChainedDictionary : Symbol(ChainedDictionary, Decl(underscoreTest1_underscore.ts, 327, 5)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) clone(): ChainedDictionary; ->clone : Symbol(clone, Decl(underscoreTest1_underscore.ts, 375, 59)) +>clone : Symbol(ChainedDictionary.clone, Decl(underscoreTest1_underscore.ts, 375, 59)) >ChainedDictionary : Symbol(ChainedDictionary, Decl(underscoreTest1_underscore.ts, 327, 5)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) tap(interceptor: (object: Dictionary) => void): ChainedDictionary; ->tap : Symbol(tap, Decl(underscoreTest1_underscore.ts, 376, 38)) +>tap : Symbol(ChainedDictionary.tap, Decl(underscoreTest1_underscore.ts, 376, 38)) >interceptor : Symbol(interceptor, Decl(underscoreTest1_underscore.ts, 377, 12)) >object : Symbol(object, Decl(underscoreTest1_underscore.ts, 377, 26)) >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) @@ -3300,19 +3300,19 @@ module Underscore { >TemplateSettings : Symbol(TemplateSettings, Decl(underscoreTest1_underscore.ts, 378, 5)) evaluate?: RegExp; ->evaluate : Symbol(evaluate, Decl(underscoreTest1_underscore.ts, 380, 39)) +>evaluate : Symbol(TemplateSettings.evaluate, Decl(underscoreTest1_underscore.ts, 380, 39)) >RegExp : Symbol(RegExp, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) interpolate?: RegExp; ->interpolate : Symbol(interpolate, Decl(underscoreTest1_underscore.ts, 381, 26)) +>interpolate : Symbol(TemplateSettings.interpolate, Decl(underscoreTest1_underscore.ts, 381, 26)) >RegExp : Symbol(RegExp, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) escape?: RegExp; ->escape : Symbol(escape, Decl(underscoreTest1_underscore.ts, 382, 29)) +>escape : Symbol(TemplateSettings.escape, Decl(underscoreTest1_underscore.ts, 382, 29)) >RegExp : Symbol(RegExp, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) variable?: string; ->variable : Symbol(variable, Decl(underscoreTest1_underscore.ts, 383, 24)) +>variable : Symbol(TemplateSettings.variable, Decl(underscoreTest1_underscore.ts, 383, 24)) } export interface Static { @@ -3349,7 +3349,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 391, 9)) chain(list: T[]): ChainedArray; ->chain : Symbol(chain, Decl(underscoreTest1_underscore.ts, 391, 38), Decl(underscoreTest1_underscore.ts, 393, 45), Decl(underscoreTest1_underscore.ts, 394, 60)) +>chain : Symbol(Static.chain, Decl(underscoreTest1_underscore.ts, 391, 38), Decl(underscoreTest1_underscore.ts, 393, 45), Decl(underscoreTest1_underscore.ts, 394, 60)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 393, 14)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 393, 17)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 393, 14)) @@ -3357,7 +3357,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 393, 14)) chain(list: Dictionary): ChainedDictionary; ->chain : Symbol(chain, Decl(underscoreTest1_underscore.ts, 391, 38), Decl(underscoreTest1_underscore.ts, 393, 45), Decl(underscoreTest1_underscore.ts, 394, 60)) +>chain : Symbol(Static.chain, Decl(underscoreTest1_underscore.ts, 391, 38), Decl(underscoreTest1_underscore.ts, 393, 45), Decl(underscoreTest1_underscore.ts, 394, 60)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 394, 14)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 394, 17)) >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) @@ -3366,7 +3366,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 394, 14)) chain(obj: T): ChainedObject; ->chain : Symbol(chain, Decl(underscoreTest1_underscore.ts, 391, 38), Decl(underscoreTest1_underscore.ts, 393, 45), Decl(underscoreTest1_underscore.ts, 394, 60)) +>chain : Symbol(Static.chain, Decl(underscoreTest1_underscore.ts, 391, 38), Decl(underscoreTest1_underscore.ts, 393, 45), Decl(underscoreTest1_underscore.ts, 394, 60)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 395, 14)) >obj : Symbol(obj, Decl(underscoreTest1_underscore.ts, 395, 17)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 395, 14)) @@ -3374,7 +3374,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 395, 14)) each(list: T[], iterator: Iterator, context?: any): void; ->each : Symbol(each, Decl(underscoreTest1_underscore.ts, 395, 43), Decl(underscoreTest1_underscore.ts, 397, 77)) +>each : Symbol(Static.each, Decl(underscoreTest1_underscore.ts, 395, 43), Decl(underscoreTest1_underscore.ts, 397, 77)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 397, 13)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 397, 16)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 397, 13)) @@ -3384,7 +3384,7 @@ module Underscore { >context : Symbol(context, Decl(underscoreTest1_underscore.ts, 397, 55)) each(list: Dictionary, iterator: Iterator, context?: any): void; ->each : Symbol(each, Decl(underscoreTest1_underscore.ts, 395, 43), Decl(underscoreTest1_underscore.ts, 397, 77)) +>each : Symbol(Static.each, Decl(underscoreTest1_underscore.ts, 395, 43), Decl(underscoreTest1_underscore.ts, 397, 77)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 398, 13)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 398, 16)) >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) @@ -3395,7 +3395,7 @@ module Underscore { >context : Symbol(context, Decl(underscoreTest1_underscore.ts, 398, 65)) forEach(list: T[], iterator: Iterator, context?: any): void; ->forEach : Symbol(forEach, Decl(underscoreTest1_underscore.ts, 398, 87), Decl(underscoreTest1_underscore.ts, 399, 80)) +>forEach : Symbol(Static.forEach, Decl(underscoreTest1_underscore.ts, 398, 87), Decl(underscoreTest1_underscore.ts, 399, 80)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 399, 16)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 399, 19)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 399, 16)) @@ -3405,7 +3405,7 @@ module Underscore { >context : Symbol(context, Decl(underscoreTest1_underscore.ts, 399, 58)) forEach(list: Dictionary, iterator: Iterator, context?: any): void; ->forEach : Symbol(forEach, Decl(underscoreTest1_underscore.ts, 398, 87), Decl(underscoreTest1_underscore.ts, 399, 80)) +>forEach : Symbol(Static.forEach, Decl(underscoreTest1_underscore.ts, 398, 87), Decl(underscoreTest1_underscore.ts, 399, 80)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 400, 16)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 400, 19)) >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) @@ -3416,7 +3416,7 @@ module Underscore { >context : Symbol(context, Decl(underscoreTest1_underscore.ts, 400, 68)) map(list: T[], iterator: Iterator, context?: any): U[]; ->map : Symbol(map, Decl(underscoreTest1_underscore.ts, 400, 90), Decl(underscoreTest1_underscore.ts, 402, 75)) +>map : Symbol(Static.map, Decl(underscoreTest1_underscore.ts, 400, 90), Decl(underscoreTest1_underscore.ts, 402, 75)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 402, 12)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 402, 14)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 402, 18)) @@ -3429,7 +3429,7 @@ module Underscore { >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 402, 14)) map(list: Dictionary, iterator: Iterator, context?: any): U[]; ->map : Symbol(map, Decl(underscoreTest1_underscore.ts, 400, 90), Decl(underscoreTest1_underscore.ts, 402, 75)) +>map : Symbol(Static.map, Decl(underscoreTest1_underscore.ts, 400, 90), Decl(underscoreTest1_underscore.ts, 402, 75)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 403, 12)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 403, 14)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 403, 18)) @@ -3443,7 +3443,7 @@ module Underscore { >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 403, 14)) collect(list: T[], iterator: Iterator, context?: any): U[]; ->collect : Symbol(collect, Decl(underscoreTest1_underscore.ts, 403, 85), Decl(underscoreTest1_underscore.ts, 404, 79)) +>collect : Symbol(Static.collect, Decl(underscoreTest1_underscore.ts, 403, 85), Decl(underscoreTest1_underscore.ts, 404, 79)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 404, 16)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 404, 18)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 404, 22)) @@ -3456,7 +3456,7 @@ module Underscore { >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 404, 18)) collect(list: Dictionary, iterator: Iterator, context?: any): U[]; ->collect : Symbol(collect, Decl(underscoreTest1_underscore.ts, 403, 85), Decl(underscoreTest1_underscore.ts, 404, 79)) +>collect : Symbol(Static.collect, Decl(underscoreTest1_underscore.ts, 403, 85), Decl(underscoreTest1_underscore.ts, 404, 79)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 405, 16)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 405, 18)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 405, 22)) @@ -3470,7 +3470,7 @@ module Underscore { >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 405, 18)) reduce(list: T[], iterator: Reducer, initialValue?: T, context?: any): T; ->reduce : Symbol(reduce, Decl(underscoreTest1_underscore.ts, 405, 89), Decl(underscoreTest1_underscore.ts, 407, 90), Decl(underscoreTest1_underscore.ts, 408, 92), Decl(underscoreTest1_underscore.ts, 409, 100)) +>reduce : Symbol(Static.reduce, Decl(underscoreTest1_underscore.ts, 405, 89), Decl(underscoreTest1_underscore.ts, 407, 90), Decl(underscoreTest1_underscore.ts, 408, 92), Decl(underscoreTest1_underscore.ts, 409, 100)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 407, 15)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 407, 18)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 407, 15)) @@ -3484,7 +3484,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 407, 15)) reduce(list: T[], iterator: Reducer, initialValue: U, context?: any): U; ->reduce : Symbol(reduce, Decl(underscoreTest1_underscore.ts, 405, 89), Decl(underscoreTest1_underscore.ts, 407, 90), Decl(underscoreTest1_underscore.ts, 408, 92), Decl(underscoreTest1_underscore.ts, 409, 100)) +>reduce : Symbol(Static.reduce, Decl(underscoreTest1_underscore.ts, 405, 89), Decl(underscoreTest1_underscore.ts, 407, 90), Decl(underscoreTest1_underscore.ts, 408, 92), Decl(underscoreTest1_underscore.ts, 409, 100)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 408, 15)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 408, 17)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 408, 21)) @@ -3499,7 +3499,7 @@ module Underscore { >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 408, 17)) reduce(list: Dictionary, iterator: Reducer, initialValue?: T, context?: any): T; ->reduce : Symbol(reduce, Decl(underscoreTest1_underscore.ts, 405, 89), Decl(underscoreTest1_underscore.ts, 407, 90), Decl(underscoreTest1_underscore.ts, 408, 92), Decl(underscoreTest1_underscore.ts, 409, 100)) +>reduce : Symbol(Static.reduce, Decl(underscoreTest1_underscore.ts, 405, 89), Decl(underscoreTest1_underscore.ts, 407, 90), Decl(underscoreTest1_underscore.ts, 408, 92), Decl(underscoreTest1_underscore.ts, 409, 100)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 409, 15)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 409, 18)) >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) @@ -3514,7 +3514,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 409, 15)) reduce(list: Dictionary, iterator: Reducer, initialValue: U, context?: any): U; ->reduce : Symbol(reduce, Decl(underscoreTest1_underscore.ts, 405, 89), Decl(underscoreTest1_underscore.ts, 407, 90), Decl(underscoreTest1_underscore.ts, 408, 92), Decl(underscoreTest1_underscore.ts, 409, 100)) +>reduce : Symbol(Static.reduce, Decl(underscoreTest1_underscore.ts, 405, 89), Decl(underscoreTest1_underscore.ts, 407, 90), Decl(underscoreTest1_underscore.ts, 408, 92), Decl(underscoreTest1_underscore.ts, 409, 100)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 410, 15)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 410, 17)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 410, 21)) @@ -3530,7 +3530,7 @@ module Underscore { >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 410, 17)) foldl(list: T[], iterator: Reducer, initialValue?: T, context?: any): T; ->foldl : Symbol(foldl, Decl(underscoreTest1_underscore.ts, 410, 102), Decl(underscoreTest1_underscore.ts, 411, 89), Decl(underscoreTest1_underscore.ts, 412, 91), Decl(underscoreTest1_underscore.ts, 413, 99)) +>foldl : Symbol(Static.foldl, Decl(underscoreTest1_underscore.ts, 410, 102), Decl(underscoreTest1_underscore.ts, 411, 89), Decl(underscoreTest1_underscore.ts, 412, 91), Decl(underscoreTest1_underscore.ts, 413, 99)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 411, 14)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 411, 17)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 411, 14)) @@ -3544,7 +3544,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 411, 14)) foldl(list: T[], iterator: Reducer, initialValue: U, context?: any): U; ->foldl : Symbol(foldl, Decl(underscoreTest1_underscore.ts, 410, 102), Decl(underscoreTest1_underscore.ts, 411, 89), Decl(underscoreTest1_underscore.ts, 412, 91), Decl(underscoreTest1_underscore.ts, 413, 99)) +>foldl : Symbol(Static.foldl, Decl(underscoreTest1_underscore.ts, 410, 102), Decl(underscoreTest1_underscore.ts, 411, 89), Decl(underscoreTest1_underscore.ts, 412, 91), Decl(underscoreTest1_underscore.ts, 413, 99)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 412, 14)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 412, 16)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 412, 20)) @@ -3559,7 +3559,7 @@ module Underscore { >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 412, 16)) foldl(list: Dictionary, iterator: Reducer, initialValue?: T, context?: any): T; ->foldl : Symbol(foldl, Decl(underscoreTest1_underscore.ts, 410, 102), Decl(underscoreTest1_underscore.ts, 411, 89), Decl(underscoreTest1_underscore.ts, 412, 91), Decl(underscoreTest1_underscore.ts, 413, 99)) +>foldl : Symbol(Static.foldl, Decl(underscoreTest1_underscore.ts, 410, 102), Decl(underscoreTest1_underscore.ts, 411, 89), Decl(underscoreTest1_underscore.ts, 412, 91), Decl(underscoreTest1_underscore.ts, 413, 99)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 413, 14)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 413, 17)) >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) @@ -3574,7 +3574,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 413, 14)) foldl(list: Dictionary, iterator: Reducer, initialValue: U, context?: any): U; ->foldl : Symbol(foldl, Decl(underscoreTest1_underscore.ts, 410, 102), Decl(underscoreTest1_underscore.ts, 411, 89), Decl(underscoreTest1_underscore.ts, 412, 91), Decl(underscoreTest1_underscore.ts, 413, 99)) +>foldl : Symbol(Static.foldl, Decl(underscoreTest1_underscore.ts, 410, 102), Decl(underscoreTest1_underscore.ts, 411, 89), Decl(underscoreTest1_underscore.ts, 412, 91), Decl(underscoreTest1_underscore.ts, 413, 99)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 414, 14)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 414, 16)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 414, 20)) @@ -3590,7 +3590,7 @@ module Underscore { >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 414, 16)) inject(list: T[], iterator: Reducer, initialValue?: T, context?: any): T; ->inject : Symbol(inject, Decl(underscoreTest1_underscore.ts, 414, 101), Decl(underscoreTest1_underscore.ts, 415, 90), Decl(underscoreTest1_underscore.ts, 416, 92), Decl(underscoreTest1_underscore.ts, 417, 100)) +>inject : Symbol(Static.inject, Decl(underscoreTest1_underscore.ts, 414, 101), Decl(underscoreTest1_underscore.ts, 415, 90), Decl(underscoreTest1_underscore.ts, 416, 92), Decl(underscoreTest1_underscore.ts, 417, 100)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 415, 15)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 415, 18)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 415, 15)) @@ -3604,7 +3604,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 415, 15)) inject(list: T[], iterator: Reducer, initialValue: U, context?: any): U; ->inject : Symbol(inject, Decl(underscoreTest1_underscore.ts, 414, 101), Decl(underscoreTest1_underscore.ts, 415, 90), Decl(underscoreTest1_underscore.ts, 416, 92), Decl(underscoreTest1_underscore.ts, 417, 100)) +>inject : Symbol(Static.inject, Decl(underscoreTest1_underscore.ts, 414, 101), Decl(underscoreTest1_underscore.ts, 415, 90), Decl(underscoreTest1_underscore.ts, 416, 92), Decl(underscoreTest1_underscore.ts, 417, 100)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 416, 15)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 416, 17)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 416, 21)) @@ -3619,7 +3619,7 @@ module Underscore { >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 416, 17)) inject(list: Dictionary, iterator: Reducer, initialValue?: T, context?: any): T; ->inject : Symbol(inject, Decl(underscoreTest1_underscore.ts, 414, 101), Decl(underscoreTest1_underscore.ts, 415, 90), Decl(underscoreTest1_underscore.ts, 416, 92), Decl(underscoreTest1_underscore.ts, 417, 100)) +>inject : Symbol(Static.inject, Decl(underscoreTest1_underscore.ts, 414, 101), Decl(underscoreTest1_underscore.ts, 415, 90), Decl(underscoreTest1_underscore.ts, 416, 92), Decl(underscoreTest1_underscore.ts, 417, 100)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 417, 15)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 417, 18)) >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) @@ -3634,7 +3634,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 417, 15)) inject(list: Dictionary, iterator: Reducer, initialValue: U, context?: any): U; ->inject : Symbol(inject, Decl(underscoreTest1_underscore.ts, 414, 101), Decl(underscoreTest1_underscore.ts, 415, 90), Decl(underscoreTest1_underscore.ts, 416, 92), Decl(underscoreTest1_underscore.ts, 417, 100)) +>inject : Symbol(Static.inject, Decl(underscoreTest1_underscore.ts, 414, 101), Decl(underscoreTest1_underscore.ts, 415, 90), Decl(underscoreTest1_underscore.ts, 416, 92), Decl(underscoreTest1_underscore.ts, 417, 100)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 418, 15)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 418, 17)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 418, 21)) @@ -3650,7 +3650,7 @@ module Underscore { >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 418, 17)) reduceRight(list: T[], iterator: Reducer, initialValue?: T, context?: any): T; ->reduceRight : Symbol(reduceRight, Decl(underscoreTest1_underscore.ts, 418, 102), Decl(underscoreTest1_underscore.ts, 420, 95), Decl(underscoreTest1_underscore.ts, 421, 97), Decl(underscoreTest1_underscore.ts, 422, 105)) +>reduceRight : Symbol(Static.reduceRight, Decl(underscoreTest1_underscore.ts, 418, 102), Decl(underscoreTest1_underscore.ts, 420, 95), Decl(underscoreTest1_underscore.ts, 421, 97), Decl(underscoreTest1_underscore.ts, 422, 105)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 420, 20)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 420, 23)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 420, 20)) @@ -3664,7 +3664,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 420, 20)) reduceRight(list: T[], iterator: Reducer, initialValue: U, context?: any): U; ->reduceRight : Symbol(reduceRight, Decl(underscoreTest1_underscore.ts, 418, 102), Decl(underscoreTest1_underscore.ts, 420, 95), Decl(underscoreTest1_underscore.ts, 421, 97), Decl(underscoreTest1_underscore.ts, 422, 105)) +>reduceRight : Symbol(Static.reduceRight, Decl(underscoreTest1_underscore.ts, 418, 102), Decl(underscoreTest1_underscore.ts, 420, 95), Decl(underscoreTest1_underscore.ts, 421, 97), Decl(underscoreTest1_underscore.ts, 422, 105)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 421, 20)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 421, 22)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 421, 26)) @@ -3679,7 +3679,7 @@ module Underscore { >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 421, 22)) reduceRight(list: Dictionary, iterator: Reducer, initialValue?: T, context?: any): T; ->reduceRight : Symbol(reduceRight, Decl(underscoreTest1_underscore.ts, 418, 102), Decl(underscoreTest1_underscore.ts, 420, 95), Decl(underscoreTest1_underscore.ts, 421, 97), Decl(underscoreTest1_underscore.ts, 422, 105)) +>reduceRight : Symbol(Static.reduceRight, Decl(underscoreTest1_underscore.ts, 418, 102), Decl(underscoreTest1_underscore.ts, 420, 95), Decl(underscoreTest1_underscore.ts, 421, 97), Decl(underscoreTest1_underscore.ts, 422, 105)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 422, 20)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 422, 23)) >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) @@ -3694,7 +3694,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 422, 20)) reduceRight(list: Dictionary, iterator: Reducer, initialValue: U, context?: any): U; ->reduceRight : Symbol(reduceRight, Decl(underscoreTest1_underscore.ts, 418, 102), Decl(underscoreTest1_underscore.ts, 420, 95), Decl(underscoreTest1_underscore.ts, 421, 97), Decl(underscoreTest1_underscore.ts, 422, 105)) +>reduceRight : Symbol(Static.reduceRight, Decl(underscoreTest1_underscore.ts, 418, 102), Decl(underscoreTest1_underscore.ts, 420, 95), Decl(underscoreTest1_underscore.ts, 421, 97), Decl(underscoreTest1_underscore.ts, 422, 105)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 423, 20)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 423, 22)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 423, 26)) @@ -3710,7 +3710,7 @@ module Underscore { >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 423, 22)) foldr(list: T[], iterator: Reducer, initialValue?: T, context?: any): T; ->foldr : Symbol(foldr, Decl(underscoreTest1_underscore.ts, 423, 107), Decl(underscoreTest1_underscore.ts, 424, 89), Decl(underscoreTest1_underscore.ts, 425, 91), Decl(underscoreTest1_underscore.ts, 426, 99)) +>foldr : Symbol(Static.foldr, Decl(underscoreTest1_underscore.ts, 423, 107), Decl(underscoreTest1_underscore.ts, 424, 89), Decl(underscoreTest1_underscore.ts, 425, 91), Decl(underscoreTest1_underscore.ts, 426, 99)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 424, 14)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 424, 17)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 424, 14)) @@ -3724,7 +3724,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 424, 14)) foldr(list: T[], iterator: Reducer, initialValue: U, context?: any): U; ->foldr : Symbol(foldr, Decl(underscoreTest1_underscore.ts, 423, 107), Decl(underscoreTest1_underscore.ts, 424, 89), Decl(underscoreTest1_underscore.ts, 425, 91), Decl(underscoreTest1_underscore.ts, 426, 99)) +>foldr : Symbol(Static.foldr, Decl(underscoreTest1_underscore.ts, 423, 107), Decl(underscoreTest1_underscore.ts, 424, 89), Decl(underscoreTest1_underscore.ts, 425, 91), Decl(underscoreTest1_underscore.ts, 426, 99)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 425, 14)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 425, 16)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 425, 20)) @@ -3739,7 +3739,7 @@ module Underscore { >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 425, 16)) foldr(list: Dictionary, iterator: Reducer, initialValue?: T, context?: any): T; ->foldr : Symbol(foldr, Decl(underscoreTest1_underscore.ts, 423, 107), Decl(underscoreTest1_underscore.ts, 424, 89), Decl(underscoreTest1_underscore.ts, 425, 91), Decl(underscoreTest1_underscore.ts, 426, 99)) +>foldr : Symbol(Static.foldr, Decl(underscoreTest1_underscore.ts, 423, 107), Decl(underscoreTest1_underscore.ts, 424, 89), Decl(underscoreTest1_underscore.ts, 425, 91), Decl(underscoreTest1_underscore.ts, 426, 99)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 426, 14)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 426, 17)) >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) @@ -3754,7 +3754,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 426, 14)) foldr(list: Dictionary, iterator: Reducer, initialValue: U, context?: any): U; ->foldr : Symbol(foldr, Decl(underscoreTest1_underscore.ts, 423, 107), Decl(underscoreTest1_underscore.ts, 424, 89), Decl(underscoreTest1_underscore.ts, 425, 91), Decl(underscoreTest1_underscore.ts, 426, 99)) +>foldr : Symbol(Static.foldr, Decl(underscoreTest1_underscore.ts, 423, 107), Decl(underscoreTest1_underscore.ts, 424, 89), Decl(underscoreTest1_underscore.ts, 425, 91), Decl(underscoreTest1_underscore.ts, 426, 99)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 427, 14)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 427, 16)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 427, 20)) @@ -3770,7 +3770,7 @@ module Underscore { >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 427, 16)) find(list: T[], iterator: Iterator, context?: any): T; ->find : Symbol(find, Decl(underscoreTest1_underscore.ts, 427, 101), Decl(underscoreTest1_underscore.ts, 429, 77)) +>find : Symbol(Static.find, Decl(underscoreTest1_underscore.ts, 427, 101), Decl(underscoreTest1_underscore.ts, 429, 77)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 429, 13)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 429, 16)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 429, 13)) @@ -3781,7 +3781,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 429, 13)) find(list: Dictionary, iterator: Iterator, context?: any): T; ->find : Symbol(find, Decl(underscoreTest1_underscore.ts, 427, 101), Decl(underscoreTest1_underscore.ts, 429, 77)) +>find : Symbol(Static.find, Decl(underscoreTest1_underscore.ts, 427, 101), Decl(underscoreTest1_underscore.ts, 429, 77)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 430, 13)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 430, 16)) >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) @@ -3793,7 +3793,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 430, 13)) detect(list: T[], iterator: Iterator, context?: any): T; ->detect : Symbol(detect, Decl(underscoreTest1_underscore.ts, 430, 87), Decl(underscoreTest1_underscore.ts, 431, 79)) +>detect : Symbol(Static.detect, Decl(underscoreTest1_underscore.ts, 430, 87), Decl(underscoreTest1_underscore.ts, 431, 79)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 431, 15)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 431, 18)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 431, 15)) @@ -3804,7 +3804,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 431, 15)) detect(list: Dictionary, iterator: Iterator, context?: any): T; ->detect : Symbol(detect, Decl(underscoreTest1_underscore.ts, 430, 87), Decl(underscoreTest1_underscore.ts, 431, 79)) +>detect : Symbol(Static.detect, Decl(underscoreTest1_underscore.ts, 430, 87), Decl(underscoreTest1_underscore.ts, 431, 79)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 432, 15)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 432, 18)) >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) @@ -3816,7 +3816,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 432, 15)) filter(list: T[], iterator: Iterator, context?: any): T[]; ->filter : Symbol(filter, Decl(underscoreTest1_underscore.ts, 432, 89), Decl(underscoreTest1_underscore.ts, 434, 81)) +>filter : Symbol(Static.filter, Decl(underscoreTest1_underscore.ts, 432, 89), Decl(underscoreTest1_underscore.ts, 434, 81)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 434, 15)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 434, 18)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 434, 15)) @@ -3827,7 +3827,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 434, 15)) filter(list: Dictionary, iterator: Iterator, context?: any): T[]; ->filter : Symbol(filter, Decl(underscoreTest1_underscore.ts, 432, 89), Decl(underscoreTest1_underscore.ts, 434, 81)) +>filter : Symbol(Static.filter, Decl(underscoreTest1_underscore.ts, 432, 89), Decl(underscoreTest1_underscore.ts, 434, 81)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 435, 15)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 435, 18)) >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) @@ -3839,7 +3839,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 435, 15)) select(list: T[], iterator: Iterator, context?: any): T[]; ->select : Symbol(select, Decl(underscoreTest1_underscore.ts, 435, 91), Decl(underscoreTest1_underscore.ts, 436, 81)) +>select : Symbol(Static.select, Decl(underscoreTest1_underscore.ts, 435, 91), Decl(underscoreTest1_underscore.ts, 436, 81)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 436, 15)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 436, 18)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 436, 15)) @@ -3850,7 +3850,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 436, 15)) select(list: Dictionary, iterator: Iterator, context?: any): T[]; ->select : Symbol(select, Decl(underscoreTest1_underscore.ts, 435, 91), Decl(underscoreTest1_underscore.ts, 436, 81)) +>select : Symbol(Static.select, Decl(underscoreTest1_underscore.ts, 435, 91), Decl(underscoreTest1_underscore.ts, 436, 81)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 437, 15)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 437, 18)) >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) @@ -3862,7 +3862,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 437, 15)) where(list: T[], properties: Object): T[]; ->where : Symbol(where, Decl(underscoreTest1_underscore.ts, 437, 91), Decl(underscoreTest1_underscore.ts, 439, 53)) +>where : Symbol(Static.where, Decl(underscoreTest1_underscore.ts, 437, 91), Decl(underscoreTest1_underscore.ts, 439, 53)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 439, 14)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 439, 17)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 439, 14)) @@ -3871,7 +3871,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 439, 14)) where(list: Dictionary, properties: Object): T[]; ->where : Symbol(where, Decl(underscoreTest1_underscore.ts, 437, 91), Decl(underscoreTest1_underscore.ts, 439, 53)) +>where : Symbol(Static.where, Decl(underscoreTest1_underscore.ts, 437, 91), Decl(underscoreTest1_underscore.ts, 439, 53)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 440, 14)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 440, 17)) >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) @@ -3881,7 +3881,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 440, 14)) findWhere(list: T[], properties: Object): T; ->findWhere : Symbol(findWhere, Decl(underscoreTest1_underscore.ts, 440, 63), Decl(underscoreTest1_underscore.ts, 442, 55)) +>findWhere : Symbol(Static.findWhere, Decl(underscoreTest1_underscore.ts, 440, 63), Decl(underscoreTest1_underscore.ts, 442, 55)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 442, 18)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 442, 21)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 442, 18)) @@ -3890,7 +3890,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 442, 18)) findWhere(list: Dictionary, properties: Object): T; ->findWhere : Symbol(findWhere, Decl(underscoreTest1_underscore.ts, 440, 63), Decl(underscoreTest1_underscore.ts, 442, 55)) +>findWhere : Symbol(Static.findWhere, Decl(underscoreTest1_underscore.ts, 440, 63), Decl(underscoreTest1_underscore.ts, 442, 55)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 443, 18)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 443, 21)) >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) @@ -3900,7 +3900,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 443, 18)) reject(list: T[], iterator: Iterator, context?: any): T[]; ->reject : Symbol(reject, Decl(underscoreTest1_underscore.ts, 443, 65), Decl(underscoreTest1_underscore.ts, 445, 81)) +>reject : Symbol(Static.reject, Decl(underscoreTest1_underscore.ts, 443, 65), Decl(underscoreTest1_underscore.ts, 445, 81)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 445, 15)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 445, 18)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 445, 15)) @@ -3911,7 +3911,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 445, 15)) reject(list: Dictionary, iterator: Iterator, context?: any): T[]; ->reject : Symbol(reject, Decl(underscoreTest1_underscore.ts, 443, 65), Decl(underscoreTest1_underscore.ts, 445, 81)) +>reject : Symbol(Static.reject, Decl(underscoreTest1_underscore.ts, 443, 65), Decl(underscoreTest1_underscore.ts, 445, 81)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 446, 15)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 446, 18)) >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) @@ -3923,7 +3923,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 446, 15)) every(list: T[], iterator?: Iterator, context?: any): boolean; ->every : Symbol(every, Decl(underscoreTest1_underscore.ts, 446, 91), Decl(underscoreTest1_underscore.ts, 448, 85)) +>every : Symbol(Static.every, Decl(underscoreTest1_underscore.ts, 446, 91), Decl(underscoreTest1_underscore.ts, 448, 85)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 448, 14)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 448, 17)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 448, 14)) @@ -3933,7 +3933,7 @@ module Underscore { >context : Symbol(context, Decl(underscoreTest1_underscore.ts, 448, 60)) every(list: Dictionary, iterator?: Iterator, context?: any): boolean; ->every : Symbol(every, Decl(underscoreTest1_underscore.ts, 446, 91), Decl(underscoreTest1_underscore.ts, 448, 85)) +>every : Symbol(Static.every, Decl(underscoreTest1_underscore.ts, 446, 91), Decl(underscoreTest1_underscore.ts, 448, 85)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 449, 14)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 449, 17)) >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) @@ -3944,7 +3944,7 @@ module Underscore { >context : Symbol(context, Decl(underscoreTest1_underscore.ts, 449, 70)) all(list: T[], iterator?: Iterator, context?: any): boolean; ->all : Symbol(all, Decl(underscoreTest1_underscore.ts, 449, 95), Decl(underscoreTest1_underscore.ts, 450, 83)) +>all : Symbol(Static.all, Decl(underscoreTest1_underscore.ts, 449, 95), Decl(underscoreTest1_underscore.ts, 450, 83)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 450, 12)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 450, 15)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 450, 12)) @@ -3954,7 +3954,7 @@ module Underscore { >context : Symbol(context, Decl(underscoreTest1_underscore.ts, 450, 58)) all(list: Dictionary, iterator?: Iterator, context?: any): boolean; ->all : Symbol(all, Decl(underscoreTest1_underscore.ts, 449, 95), Decl(underscoreTest1_underscore.ts, 450, 83)) +>all : Symbol(Static.all, Decl(underscoreTest1_underscore.ts, 449, 95), Decl(underscoreTest1_underscore.ts, 450, 83)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 451, 12)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 451, 15)) >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) @@ -3965,7 +3965,7 @@ module Underscore { >context : Symbol(context, Decl(underscoreTest1_underscore.ts, 451, 68)) some(list: T[], iterator?: Iterator, context?: any): boolean; ->some : Symbol(some, Decl(underscoreTest1_underscore.ts, 451, 93), Decl(underscoreTest1_underscore.ts, 453, 84)) +>some : Symbol(Static.some, Decl(underscoreTest1_underscore.ts, 451, 93), Decl(underscoreTest1_underscore.ts, 453, 84)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 453, 13)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 453, 16)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 453, 13)) @@ -3975,7 +3975,7 @@ module Underscore { >context : Symbol(context, Decl(underscoreTest1_underscore.ts, 453, 59)) some(list: Dictionary, iterator?: Iterator, context?: any): boolean; ->some : Symbol(some, Decl(underscoreTest1_underscore.ts, 451, 93), Decl(underscoreTest1_underscore.ts, 453, 84)) +>some : Symbol(Static.some, Decl(underscoreTest1_underscore.ts, 451, 93), Decl(underscoreTest1_underscore.ts, 453, 84)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 454, 13)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 454, 16)) >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) @@ -3986,7 +3986,7 @@ module Underscore { >context : Symbol(context, Decl(underscoreTest1_underscore.ts, 454, 69)) any(list: T[], iterator?: Iterator, context?: any): boolean; ->any : Symbol(any, Decl(underscoreTest1_underscore.ts, 454, 94), Decl(underscoreTest1_underscore.ts, 455, 83)) +>any : Symbol(Static.any, Decl(underscoreTest1_underscore.ts, 454, 94), Decl(underscoreTest1_underscore.ts, 455, 83)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 455, 12)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 455, 15)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 455, 12)) @@ -3996,7 +3996,7 @@ module Underscore { >context : Symbol(context, Decl(underscoreTest1_underscore.ts, 455, 58)) any(list: Dictionary, iterator?: Iterator, context?: any): boolean; ->any : Symbol(any, Decl(underscoreTest1_underscore.ts, 454, 94), Decl(underscoreTest1_underscore.ts, 455, 83)) +>any : Symbol(Static.any, Decl(underscoreTest1_underscore.ts, 454, 94), Decl(underscoreTest1_underscore.ts, 455, 83)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 456, 12)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 456, 15)) >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) @@ -4007,7 +4007,7 @@ module Underscore { >context : Symbol(context, Decl(underscoreTest1_underscore.ts, 456, 68)) contains(list: T[], value: T): boolean; ->contains : Symbol(contains, Decl(underscoreTest1_underscore.ts, 456, 93), Decl(underscoreTest1_underscore.ts, 458, 50)) +>contains : Symbol(Static.contains, Decl(underscoreTest1_underscore.ts, 456, 93), Decl(underscoreTest1_underscore.ts, 458, 50)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 458, 17)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 458, 20)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 458, 17)) @@ -4015,7 +4015,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 458, 17)) contains(list: Dictionary, value: T): boolean; ->contains : Symbol(contains, Decl(underscoreTest1_underscore.ts, 456, 93), Decl(underscoreTest1_underscore.ts, 458, 50)) +>contains : Symbol(Static.contains, Decl(underscoreTest1_underscore.ts, 456, 93), Decl(underscoreTest1_underscore.ts, 458, 50)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 459, 17)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 459, 20)) >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) @@ -4024,7 +4024,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 459, 17)) include(list: T[], value: T): boolean; ->include : Symbol(include, Decl(underscoreTest1_underscore.ts, 459, 60), Decl(underscoreTest1_underscore.ts, 460, 49)) +>include : Symbol(Static.include, Decl(underscoreTest1_underscore.ts, 459, 60), Decl(underscoreTest1_underscore.ts, 460, 49)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 460, 16)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 460, 19)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 460, 16)) @@ -4032,7 +4032,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 460, 16)) include(list: Dictionary, value: T): boolean; ->include : Symbol(include, Decl(underscoreTest1_underscore.ts, 459, 60), Decl(underscoreTest1_underscore.ts, 460, 49)) +>include : Symbol(Static.include, Decl(underscoreTest1_underscore.ts, 459, 60), Decl(underscoreTest1_underscore.ts, 460, 49)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 461, 16)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 461, 19)) >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) @@ -4041,31 +4041,31 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 461, 16)) invoke(list: any[], methodName: string, ...args: any[]): any[]; ->invoke : Symbol(invoke, Decl(underscoreTest1_underscore.ts, 461, 59), Decl(underscoreTest1_underscore.ts, 463, 71)) +>invoke : Symbol(Static.invoke, Decl(underscoreTest1_underscore.ts, 461, 59), Decl(underscoreTest1_underscore.ts, 463, 71)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 463, 15)) >methodName : Symbol(methodName, Decl(underscoreTest1_underscore.ts, 463, 27)) >args : Symbol(args, Decl(underscoreTest1_underscore.ts, 463, 47)) invoke(list: Dictionary, methodName: string, ...args: any[]): any[]; ->invoke : Symbol(invoke, Decl(underscoreTest1_underscore.ts, 461, 59), Decl(underscoreTest1_underscore.ts, 463, 71)) +>invoke : Symbol(Static.invoke, Decl(underscoreTest1_underscore.ts, 461, 59), Decl(underscoreTest1_underscore.ts, 463, 71)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 464, 15)) >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) >methodName : Symbol(methodName, Decl(underscoreTest1_underscore.ts, 464, 37)) >args : Symbol(args, Decl(underscoreTest1_underscore.ts, 464, 57)) pluck(list: any[], propertyName: string): any[]; ->pluck : Symbol(pluck, Decl(underscoreTest1_underscore.ts, 464, 81), Decl(underscoreTest1_underscore.ts, 466, 56)) +>pluck : Symbol(Static.pluck, Decl(underscoreTest1_underscore.ts, 464, 81), Decl(underscoreTest1_underscore.ts, 466, 56)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 466, 14)) >propertyName : Symbol(propertyName, Decl(underscoreTest1_underscore.ts, 466, 26)) pluck(list: Dictionary, propertyName: string): any[]; ->pluck : Symbol(pluck, Decl(underscoreTest1_underscore.ts, 464, 81), Decl(underscoreTest1_underscore.ts, 466, 56)) +>pluck : Symbol(Static.pluck, Decl(underscoreTest1_underscore.ts, 464, 81), Decl(underscoreTest1_underscore.ts, 466, 56)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 467, 14)) >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) >propertyName : Symbol(propertyName, Decl(underscoreTest1_underscore.ts, 467, 36)) max(list: T[], iterator?: Iterator, context?: any): T; ->max : Symbol(max, Decl(underscoreTest1_underscore.ts, 467, 66), Decl(underscoreTest1_underscore.ts, 469, 73)) +>max : Symbol(Static.max, Decl(underscoreTest1_underscore.ts, 467, 66), Decl(underscoreTest1_underscore.ts, 469, 73)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 469, 12)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 469, 15)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 469, 12)) @@ -4076,7 +4076,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 469, 12)) max(list: Dictionary, iterator?: Iterator, context?: any): T; ->max : Symbol(max, Decl(underscoreTest1_underscore.ts, 467, 66), Decl(underscoreTest1_underscore.ts, 469, 73)) +>max : Symbol(Static.max, Decl(underscoreTest1_underscore.ts, 467, 66), Decl(underscoreTest1_underscore.ts, 469, 73)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 470, 12)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 470, 15)) >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) @@ -4088,7 +4088,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 470, 12)) min(list: T[], iterator?: Iterator, context?: any): T; ->min : Symbol(min, Decl(underscoreTest1_underscore.ts, 470, 83), Decl(underscoreTest1_underscore.ts, 472, 73)) +>min : Symbol(Static.min, Decl(underscoreTest1_underscore.ts, 470, 83), Decl(underscoreTest1_underscore.ts, 472, 73)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 472, 12)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 472, 15)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 472, 12)) @@ -4099,7 +4099,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 472, 12)) min(list: Dictionary, iterator?: Iterator, context?: any): T; ->min : Symbol(min, Decl(underscoreTest1_underscore.ts, 470, 83), Decl(underscoreTest1_underscore.ts, 472, 73)) +>min : Symbol(Static.min, Decl(underscoreTest1_underscore.ts, 470, 83), Decl(underscoreTest1_underscore.ts, 472, 73)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 473, 12)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 473, 15)) >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) @@ -4111,7 +4111,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 473, 12)) sortBy(list: T[], iterator: Iterator, context?: any): T[]; ->sortBy : Symbol(sortBy, Decl(underscoreTest1_underscore.ts, 473, 83), Decl(underscoreTest1_underscore.ts, 475, 77), Decl(underscoreTest1_underscore.ts, 476, 87), Decl(underscoreTest1_underscore.ts, 477, 56)) +>sortBy : Symbol(Static.sortBy, Decl(underscoreTest1_underscore.ts, 473, 83), Decl(underscoreTest1_underscore.ts, 475, 77), Decl(underscoreTest1_underscore.ts, 476, 87), Decl(underscoreTest1_underscore.ts, 477, 56)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 475, 15)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 475, 18)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 475, 15)) @@ -4122,7 +4122,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 475, 15)) sortBy(list: Dictionary, iterator: Iterator, context?: any): T[]; ->sortBy : Symbol(sortBy, Decl(underscoreTest1_underscore.ts, 473, 83), Decl(underscoreTest1_underscore.ts, 475, 77), Decl(underscoreTest1_underscore.ts, 476, 87), Decl(underscoreTest1_underscore.ts, 477, 56)) +>sortBy : Symbol(Static.sortBy, Decl(underscoreTest1_underscore.ts, 473, 83), Decl(underscoreTest1_underscore.ts, 475, 77), Decl(underscoreTest1_underscore.ts, 476, 87), Decl(underscoreTest1_underscore.ts, 477, 56)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 476, 15)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 476, 18)) >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) @@ -4134,7 +4134,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 476, 15)) sortBy(list: T[], propertyName: string): T[]; ->sortBy : Symbol(sortBy, Decl(underscoreTest1_underscore.ts, 473, 83), Decl(underscoreTest1_underscore.ts, 475, 77), Decl(underscoreTest1_underscore.ts, 476, 87), Decl(underscoreTest1_underscore.ts, 477, 56)) +>sortBy : Symbol(Static.sortBy, Decl(underscoreTest1_underscore.ts, 473, 83), Decl(underscoreTest1_underscore.ts, 475, 77), Decl(underscoreTest1_underscore.ts, 476, 87), Decl(underscoreTest1_underscore.ts, 477, 56)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 477, 15)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 477, 18)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 477, 15)) @@ -4142,7 +4142,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 477, 15)) sortBy(list: Dictionary, propertyName: string): T[]; ->sortBy : Symbol(sortBy, Decl(underscoreTest1_underscore.ts, 473, 83), Decl(underscoreTest1_underscore.ts, 475, 77), Decl(underscoreTest1_underscore.ts, 476, 87), Decl(underscoreTest1_underscore.ts, 477, 56)) +>sortBy : Symbol(Static.sortBy, Decl(underscoreTest1_underscore.ts, 473, 83), Decl(underscoreTest1_underscore.ts, 475, 77), Decl(underscoreTest1_underscore.ts, 476, 87), Decl(underscoreTest1_underscore.ts, 477, 56)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 478, 15)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 478, 18)) >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) @@ -4151,7 +4151,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 478, 15)) groupBy(list: T[], iterator?: Iterator, context?: any): Dictionary; ->groupBy : Symbol(groupBy, Decl(underscoreTest1_underscore.ts, 478, 66), Decl(underscoreTest1_underscore.ts, 480, 91), Decl(underscoreTest1_underscore.ts, 481, 101), Decl(underscoreTest1_underscore.ts, 482, 69)) +>groupBy : Symbol(Static.groupBy, Decl(underscoreTest1_underscore.ts, 478, 66), Decl(underscoreTest1_underscore.ts, 480, 91), Decl(underscoreTest1_underscore.ts, 481, 101), Decl(underscoreTest1_underscore.ts, 482, 69)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 480, 16)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 480, 19)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 480, 16)) @@ -4163,7 +4163,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 480, 16)) groupBy(list: Dictionary, iterator?: Iterator, context?: any): Dictionary; ->groupBy : Symbol(groupBy, Decl(underscoreTest1_underscore.ts, 478, 66), Decl(underscoreTest1_underscore.ts, 480, 91), Decl(underscoreTest1_underscore.ts, 481, 101), Decl(underscoreTest1_underscore.ts, 482, 69)) +>groupBy : Symbol(Static.groupBy, Decl(underscoreTest1_underscore.ts, 478, 66), Decl(underscoreTest1_underscore.ts, 480, 91), Decl(underscoreTest1_underscore.ts, 481, 101), Decl(underscoreTest1_underscore.ts, 482, 69)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 481, 16)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 481, 19)) >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) @@ -4176,7 +4176,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 481, 16)) groupBy(list: T[], propertyName: string): Dictionary; ->groupBy : Symbol(groupBy, Decl(underscoreTest1_underscore.ts, 478, 66), Decl(underscoreTest1_underscore.ts, 480, 91), Decl(underscoreTest1_underscore.ts, 481, 101), Decl(underscoreTest1_underscore.ts, 482, 69)) +>groupBy : Symbol(Static.groupBy, Decl(underscoreTest1_underscore.ts, 478, 66), Decl(underscoreTest1_underscore.ts, 480, 91), Decl(underscoreTest1_underscore.ts, 481, 101), Decl(underscoreTest1_underscore.ts, 482, 69)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 482, 16)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 482, 19)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 482, 16)) @@ -4185,7 +4185,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 482, 16)) groupBy(list: Dictionary, propertyName: string): Dictionary; ->groupBy : Symbol(groupBy, Decl(underscoreTest1_underscore.ts, 478, 66), Decl(underscoreTest1_underscore.ts, 480, 91), Decl(underscoreTest1_underscore.ts, 481, 101), Decl(underscoreTest1_underscore.ts, 482, 69)) +>groupBy : Symbol(Static.groupBy, Decl(underscoreTest1_underscore.ts, 478, 66), Decl(underscoreTest1_underscore.ts, 480, 91), Decl(underscoreTest1_underscore.ts, 481, 101), Decl(underscoreTest1_underscore.ts, 482, 69)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 483, 16)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 483, 19)) >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) @@ -4195,7 +4195,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 483, 16)) countBy(list: T[], iterator?: Iterator, context?: any): Dictionary; ->countBy : Symbol(countBy, Decl(underscoreTest1_underscore.ts, 483, 79), Decl(underscoreTest1_underscore.ts, 485, 94), Decl(underscoreTest1_underscore.ts, 486, 104), Decl(underscoreTest1_underscore.ts, 487, 72)) +>countBy : Symbol(Static.countBy, Decl(underscoreTest1_underscore.ts, 483, 79), Decl(underscoreTest1_underscore.ts, 485, 94), Decl(underscoreTest1_underscore.ts, 486, 104), Decl(underscoreTest1_underscore.ts, 487, 72)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 485, 16)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 485, 19)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 485, 16)) @@ -4206,7 +4206,7 @@ module Underscore { >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) countBy(list: Dictionary, iterator?: Iterator, context?: any): Dictionary; ->countBy : Symbol(countBy, Decl(underscoreTest1_underscore.ts, 483, 79), Decl(underscoreTest1_underscore.ts, 485, 94), Decl(underscoreTest1_underscore.ts, 486, 104), Decl(underscoreTest1_underscore.ts, 487, 72)) +>countBy : Symbol(Static.countBy, Decl(underscoreTest1_underscore.ts, 483, 79), Decl(underscoreTest1_underscore.ts, 485, 94), Decl(underscoreTest1_underscore.ts, 486, 104), Decl(underscoreTest1_underscore.ts, 487, 72)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 486, 16)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 486, 19)) >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) @@ -4218,7 +4218,7 @@ module Underscore { >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) countBy(list: T[], propertyName: string): Dictionary; ->countBy : Symbol(countBy, Decl(underscoreTest1_underscore.ts, 483, 79), Decl(underscoreTest1_underscore.ts, 485, 94), Decl(underscoreTest1_underscore.ts, 486, 104), Decl(underscoreTest1_underscore.ts, 487, 72)) +>countBy : Symbol(Static.countBy, Decl(underscoreTest1_underscore.ts, 483, 79), Decl(underscoreTest1_underscore.ts, 485, 94), Decl(underscoreTest1_underscore.ts, 486, 104), Decl(underscoreTest1_underscore.ts, 487, 72)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 487, 16)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 487, 19)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 487, 16)) @@ -4226,7 +4226,7 @@ module Underscore { >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) countBy(list: Dictionary, propertyName: string): Dictionary; ->countBy : Symbol(countBy, Decl(underscoreTest1_underscore.ts, 483, 79), Decl(underscoreTest1_underscore.ts, 485, 94), Decl(underscoreTest1_underscore.ts, 486, 104), Decl(underscoreTest1_underscore.ts, 487, 72)) +>countBy : Symbol(Static.countBy, Decl(underscoreTest1_underscore.ts, 483, 79), Decl(underscoreTest1_underscore.ts, 485, 94), Decl(underscoreTest1_underscore.ts, 486, 104), Decl(underscoreTest1_underscore.ts, 487, 72)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 488, 16)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 488, 19)) >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) @@ -4235,14 +4235,14 @@ module Underscore { >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) shuffle(list: T[]): T[]; ->shuffle : Symbol(shuffle, Decl(underscoreTest1_underscore.ts, 488, 82), Decl(underscoreTest1_underscore.ts, 490, 35)) +>shuffle : Symbol(Static.shuffle, Decl(underscoreTest1_underscore.ts, 488, 82), Decl(underscoreTest1_underscore.ts, 490, 35)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 490, 16)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 490, 19)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 490, 16)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 490, 16)) shuffle(list: Dictionary): T[]; ->shuffle : Symbol(shuffle, Decl(underscoreTest1_underscore.ts, 488, 82), Decl(underscoreTest1_underscore.ts, 490, 35)) +>shuffle : Symbol(Static.shuffle, Decl(underscoreTest1_underscore.ts, 488, 82), Decl(underscoreTest1_underscore.ts, 490, 35)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 491, 16)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 491, 19)) >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) @@ -4250,14 +4250,14 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 491, 16)) toArray(list: T[]): T[]; ->toArray : Symbol(toArray, Decl(underscoreTest1_underscore.ts, 491, 45), Decl(underscoreTest1_underscore.ts, 493, 35)) +>toArray : Symbol(Static.toArray, Decl(underscoreTest1_underscore.ts, 491, 45), Decl(underscoreTest1_underscore.ts, 493, 35)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 493, 16)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 493, 19)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 493, 16)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 493, 16)) toArray(list: Dictionary): T[]; ->toArray : Symbol(toArray, Decl(underscoreTest1_underscore.ts, 491, 45), Decl(underscoreTest1_underscore.ts, 493, 35)) +>toArray : Symbol(Static.toArray, Decl(underscoreTest1_underscore.ts, 491, 45), Decl(underscoreTest1_underscore.ts, 493, 35)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 494, 16)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 494, 19)) >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) @@ -4265,27 +4265,27 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 494, 16)) size(list: T[]): number; ->size : Symbol(size, Decl(underscoreTest1_underscore.ts, 494, 45), Decl(underscoreTest1_underscore.ts, 496, 35)) +>size : Symbol(Static.size, Decl(underscoreTest1_underscore.ts, 494, 45), Decl(underscoreTest1_underscore.ts, 496, 35)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 496, 13)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 496, 16)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 496, 13)) size(list: Dictionary): number; ->size : Symbol(size, Decl(underscoreTest1_underscore.ts, 494, 45), Decl(underscoreTest1_underscore.ts, 496, 35)) +>size : Symbol(Static.size, Decl(underscoreTest1_underscore.ts, 494, 45), Decl(underscoreTest1_underscore.ts, 496, 35)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 497, 13)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 497, 16)) >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 497, 13)) first(list: T[]): T; ->first : Symbol(first, Decl(underscoreTest1_underscore.ts, 497, 45), Decl(underscoreTest1_underscore.ts, 499, 31)) +>first : Symbol(Static.first, Decl(underscoreTest1_underscore.ts, 497, 45), Decl(underscoreTest1_underscore.ts, 499, 31)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 499, 14)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 499, 17)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 499, 14)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 499, 14)) first(list: T[], count: number): T[]; ->first : Symbol(first, Decl(underscoreTest1_underscore.ts, 497, 45), Decl(underscoreTest1_underscore.ts, 499, 31)) +>first : Symbol(Static.first, Decl(underscoreTest1_underscore.ts, 497, 45), Decl(underscoreTest1_underscore.ts, 499, 31)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 500, 14)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 500, 17)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 500, 14)) @@ -4293,14 +4293,14 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 500, 14)) head(list: T[]): T; ->head : Symbol(head, Decl(underscoreTest1_underscore.ts, 500, 48), Decl(underscoreTest1_underscore.ts, 501, 30)) +>head : Symbol(Static.head, Decl(underscoreTest1_underscore.ts, 500, 48), Decl(underscoreTest1_underscore.ts, 501, 30)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 501, 13)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 501, 16)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 501, 13)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 501, 13)) head(list: T[], count: number): T[]; ->head : Symbol(head, Decl(underscoreTest1_underscore.ts, 500, 48), Decl(underscoreTest1_underscore.ts, 501, 30)) +>head : Symbol(Static.head, Decl(underscoreTest1_underscore.ts, 500, 48), Decl(underscoreTest1_underscore.ts, 501, 30)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 502, 13)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 502, 16)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 502, 13)) @@ -4308,14 +4308,14 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 502, 13)) take(list: T[]): T; ->take : Symbol(take, Decl(underscoreTest1_underscore.ts, 502, 47), Decl(underscoreTest1_underscore.ts, 503, 30)) +>take : Symbol(Static.take, Decl(underscoreTest1_underscore.ts, 502, 47), Decl(underscoreTest1_underscore.ts, 503, 30)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 503, 13)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 503, 16)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 503, 13)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 503, 13)) take(list: T[], count: number): T[]; ->take : Symbol(take, Decl(underscoreTest1_underscore.ts, 502, 47), Decl(underscoreTest1_underscore.ts, 503, 30)) +>take : Symbol(Static.take, Decl(underscoreTest1_underscore.ts, 502, 47), Decl(underscoreTest1_underscore.ts, 503, 30)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 504, 13)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 504, 16)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 504, 13)) @@ -4323,14 +4323,14 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 504, 13)) initial(list: T[]): T; ->initial : Symbol(initial, Decl(underscoreTest1_underscore.ts, 504, 47), Decl(underscoreTest1_underscore.ts, 506, 33)) +>initial : Symbol(Static.initial, Decl(underscoreTest1_underscore.ts, 504, 47), Decl(underscoreTest1_underscore.ts, 506, 33)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 506, 16)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 506, 19)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 506, 16)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 506, 16)) initial(list: T[], count: number): T[]; ->initial : Symbol(initial, Decl(underscoreTest1_underscore.ts, 504, 47), Decl(underscoreTest1_underscore.ts, 506, 33)) +>initial : Symbol(Static.initial, Decl(underscoreTest1_underscore.ts, 504, 47), Decl(underscoreTest1_underscore.ts, 506, 33)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 507, 16)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 507, 19)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 507, 16)) @@ -4338,14 +4338,14 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 507, 16)) last(list: T[]): T; ->last : Symbol(last, Decl(underscoreTest1_underscore.ts, 507, 50), Decl(underscoreTest1_underscore.ts, 509, 30)) +>last : Symbol(Static.last, Decl(underscoreTest1_underscore.ts, 507, 50), Decl(underscoreTest1_underscore.ts, 509, 30)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 509, 13)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 509, 16)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 509, 13)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 509, 13)) last(list: T[], count: number): T[]; ->last : Symbol(last, Decl(underscoreTest1_underscore.ts, 507, 50), Decl(underscoreTest1_underscore.ts, 509, 30)) +>last : Symbol(Static.last, Decl(underscoreTest1_underscore.ts, 507, 50), Decl(underscoreTest1_underscore.ts, 509, 30)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 510, 13)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 510, 16)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 510, 13)) @@ -4353,7 +4353,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 510, 13)) rest(list: T[], index?: number): T[]; ->rest : Symbol(rest, Decl(underscoreTest1_underscore.ts, 510, 47)) +>rest : Symbol(Static.rest, Decl(underscoreTest1_underscore.ts, 510, 47)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 512, 13)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 512, 16)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 512, 13)) @@ -4361,28 +4361,28 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 512, 13)) compact(list: T[]): T[]; ->compact : Symbol(compact, Decl(underscoreTest1_underscore.ts, 512, 48)) +>compact : Symbol(Static.compact, Decl(underscoreTest1_underscore.ts, 512, 48)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 514, 16)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 514, 19)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 514, 16)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 514, 16)) flatten(list: T[][]): T[]; ->flatten : Symbol(flatten, Decl(underscoreTest1_underscore.ts, 514, 35), Decl(underscoreTest1_underscore.ts, 516, 37)) +>flatten : Symbol(Static.flatten, Decl(underscoreTest1_underscore.ts, 514, 35), Decl(underscoreTest1_underscore.ts, 516, 37)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 516, 16)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 516, 19)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 516, 16)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 516, 16)) flatten(array: any[], shallow?: boolean): T[]; ->flatten : Symbol(flatten, Decl(underscoreTest1_underscore.ts, 514, 35), Decl(underscoreTest1_underscore.ts, 516, 37)) +>flatten : Symbol(Static.flatten, Decl(underscoreTest1_underscore.ts, 514, 35), Decl(underscoreTest1_underscore.ts, 516, 37)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 517, 16)) >array : Symbol(array, Decl(underscoreTest1_underscore.ts, 517, 19)) >shallow : Symbol(shallow, Decl(underscoreTest1_underscore.ts, 517, 32)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 517, 16)) without(list: T[], ...values: T[]): T[]; ->without : Symbol(without, Decl(underscoreTest1_underscore.ts, 517, 57)) +>without : Symbol(Static.without, Decl(underscoreTest1_underscore.ts, 517, 57)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 519, 16)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 519, 19)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 519, 16)) @@ -4391,21 +4391,21 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 519, 16)) union(...arrays: T[][]): T[]; ->union : Symbol(union, Decl(underscoreTest1_underscore.ts, 519, 51)) +>union : Symbol(Static.union, Decl(underscoreTest1_underscore.ts, 519, 51)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 521, 14)) >arrays : Symbol(arrays, Decl(underscoreTest1_underscore.ts, 521, 17)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 521, 14)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 521, 14)) intersection(...arrays: T[][]): T[]; ->intersection : Symbol(intersection, Decl(underscoreTest1_underscore.ts, 521, 40)) +>intersection : Symbol(Static.intersection, Decl(underscoreTest1_underscore.ts, 521, 40)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 523, 21)) >arrays : Symbol(arrays, Decl(underscoreTest1_underscore.ts, 523, 24)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 523, 21)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 523, 21)) difference(list: T[], ...others: T[][]): T[]; ->difference : Symbol(difference, Decl(underscoreTest1_underscore.ts, 523, 47)) +>difference : Symbol(Static.difference, Decl(underscoreTest1_underscore.ts, 523, 47)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 525, 19)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 525, 22)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 525, 19)) @@ -4414,7 +4414,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 525, 19)) uniq(list: T[], isSorted?: boolean): T[]; ->uniq : Symbol(uniq, Decl(underscoreTest1_underscore.ts, 525, 56), Decl(underscoreTest1_underscore.ts, 527, 52)) +>uniq : Symbol(Static.uniq, Decl(underscoreTest1_underscore.ts, 525, 56), Decl(underscoreTest1_underscore.ts, 527, 52)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 527, 13)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 527, 16)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 527, 13)) @@ -4422,7 +4422,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 527, 13)) uniq(list: T[], isSorted: boolean, iterator: Iterator, context?: any): U[]; ->uniq : Symbol(uniq, Decl(underscoreTest1_underscore.ts, 525, 56), Decl(underscoreTest1_underscore.ts, 527, 52)) +>uniq : Symbol(Static.uniq, Decl(underscoreTest1_underscore.ts, 525, 56), Decl(underscoreTest1_underscore.ts, 527, 52)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 528, 13)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 528, 15)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 528, 19)) @@ -4436,7 +4436,7 @@ module Underscore { >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 528, 15)) unique(list: T[], isSorted?: boolean): T[]; ->unique : Symbol(unique, Decl(underscoreTest1_underscore.ts, 528, 95), Decl(underscoreTest1_underscore.ts, 529, 54)) +>unique : Symbol(Static.unique, Decl(underscoreTest1_underscore.ts, 528, 95), Decl(underscoreTest1_underscore.ts, 529, 54)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 529, 15)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 529, 18)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 529, 15)) @@ -4444,7 +4444,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 529, 15)) unique(list: T[], isSorted: boolean, iterator: Iterator, context?: any): U[]; ->unique : Symbol(unique, Decl(underscoreTest1_underscore.ts, 528, 95), Decl(underscoreTest1_underscore.ts, 529, 54)) +>unique : Symbol(Static.unique, Decl(underscoreTest1_underscore.ts, 528, 95), Decl(underscoreTest1_underscore.ts, 529, 54)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 530, 15)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 530, 17)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 530, 21)) @@ -4458,7 +4458,7 @@ module Underscore { >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 530, 17)) zip(a0: T0[], a1: T1[]): Tuple2[]; ->zip : Symbol(zip, Decl(underscoreTest1_underscore.ts, 530, 97), Decl(underscoreTest1_underscore.ts, 532, 58), Decl(underscoreTest1_underscore.ts, 533, 76), Decl(underscoreTest1_underscore.ts, 534, 94)) +>zip : Symbol(Static.zip, Decl(underscoreTest1_underscore.ts, 530, 97), Decl(underscoreTest1_underscore.ts, 532, 58), Decl(underscoreTest1_underscore.ts, 533, 76), Decl(underscoreTest1_underscore.ts, 534, 94)) >T0 : Symbol(T0, Decl(underscoreTest1_underscore.ts, 532, 12)) >T1 : Symbol(T1, Decl(underscoreTest1_underscore.ts, 532, 15)) >a0 : Symbol(a0, Decl(underscoreTest1_underscore.ts, 532, 20)) @@ -4470,7 +4470,7 @@ module Underscore { >T1 : Symbol(T1, Decl(underscoreTest1_underscore.ts, 532, 15)) zip(a0: T0[], a1: T1[], a2: T2[]): Tuple3[]; ->zip : Symbol(zip, Decl(underscoreTest1_underscore.ts, 530, 97), Decl(underscoreTest1_underscore.ts, 532, 58), Decl(underscoreTest1_underscore.ts, 533, 76), Decl(underscoreTest1_underscore.ts, 534, 94)) +>zip : Symbol(Static.zip, Decl(underscoreTest1_underscore.ts, 530, 97), Decl(underscoreTest1_underscore.ts, 532, 58), Decl(underscoreTest1_underscore.ts, 533, 76), Decl(underscoreTest1_underscore.ts, 534, 94)) >T0 : Symbol(T0, Decl(underscoreTest1_underscore.ts, 533, 12)) >T1 : Symbol(T1, Decl(underscoreTest1_underscore.ts, 533, 15)) >T2 : Symbol(T2, Decl(underscoreTest1_underscore.ts, 533, 19)) @@ -4486,7 +4486,7 @@ module Underscore { >T2 : Symbol(T2, Decl(underscoreTest1_underscore.ts, 533, 19)) zip(a0: T0[], a1: T1[], a2: T2[], a3: T3[]): Tuple4[]; ->zip : Symbol(zip, Decl(underscoreTest1_underscore.ts, 530, 97), Decl(underscoreTest1_underscore.ts, 532, 58), Decl(underscoreTest1_underscore.ts, 533, 76), Decl(underscoreTest1_underscore.ts, 534, 94)) +>zip : Symbol(Static.zip, Decl(underscoreTest1_underscore.ts, 530, 97), Decl(underscoreTest1_underscore.ts, 532, 58), Decl(underscoreTest1_underscore.ts, 533, 76), Decl(underscoreTest1_underscore.ts, 534, 94)) >T0 : Symbol(T0, Decl(underscoreTest1_underscore.ts, 534, 12)) >T1 : Symbol(T1, Decl(underscoreTest1_underscore.ts, 534, 15)) >T2 : Symbol(T2, Decl(underscoreTest1_underscore.ts, 534, 19)) @@ -4506,20 +4506,20 @@ module Underscore { >T3 : Symbol(T3, Decl(underscoreTest1_underscore.ts, 534, 23)) zip(...arrays: any[][]): any[][]; ->zip : Symbol(zip, Decl(underscoreTest1_underscore.ts, 530, 97), Decl(underscoreTest1_underscore.ts, 532, 58), Decl(underscoreTest1_underscore.ts, 533, 76), Decl(underscoreTest1_underscore.ts, 534, 94)) +>zip : Symbol(Static.zip, Decl(underscoreTest1_underscore.ts, 530, 97), Decl(underscoreTest1_underscore.ts, 532, 58), Decl(underscoreTest1_underscore.ts, 533, 76), Decl(underscoreTest1_underscore.ts, 534, 94)) >arrays : Symbol(arrays, Decl(underscoreTest1_underscore.ts, 535, 12)) object(list: any[][]): any; ->object : Symbol(object, Decl(underscoreTest1_underscore.ts, 535, 41), Decl(underscoreTest1_underscore.ts, 537, 35)) +>object : Symbol(Static.object, Decl(underscoreTest1_underscore.ts, 535, 41), Decl(underscoreTest1_underscore.ts, 537, 35)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 537, 15)) object(keys: string[], values: any[]): any; ->object : Symbol(object, Decl(underscoreTest1_underscore.ts, 535, 41), Decl(underscoreTest1_underscore.ts, 537, 35)) +>object : Symbol(Static.object, Decl(underscoreTest1_underscore.ts, 535, 41), Decl(underscoreTest1_underscore.ts, 537, 35)) >keys : Symbol(keys, Decl(underscoreTest1_underscore.ts, 538, 15)) >values : Symbol(values, Decl(underscoreTest1_underscore.ts, 538, 30)) indexOf(list: T[], value: T, isSorted?: boolean): number; ->indexOf : Symbol(indexOf, Decl(underscoreTest1_underscore.ts, 538, 51)) +>indexOf : Symbol(Static.indexOf, Decl(underscoreTest1_underscore.ts, 538, 51)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 540, 16)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 540, 19)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 540, 16)) @@ -4528,7 +4528,7 @@ module Underscore { >isSorted : Symbol(isSorted, Decl(underscoreTest1_underscore.ts, 540, 39)) lastIndexOf(list: T[], value: T, fromIndex?: number): number; ->lastIndexOf : Symbol(lastIndexOf, Decl(underscoreTest1_underscore.ts, 540, 68)) +>lastIndexOf : Symbol(Static.lastIndexOf, Decl(underscoreTest1_underscore.ts, 540, 68)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 542, 20)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 542, 23)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 542, 20)) @@ -4537,7 +4537,7 @@ module Underscore { >fromIndex : Symbol(fromIndex, Decl(underscoreTest1_underscore.ts, 542, 43)) sortedIndex(list: T[], obj: T, propertyName: string): number; ->sortedIndex : Symbol(sortedIndex, Decl(underscoreTest1_underscore.ts, 542, 72), Decl(underscoreTest1_underscore.ts, 544, 72)) +>sortedIndex : Symbol(Static.sortedIndex, Decl(underscoreTest1_underscore.ts, 542, 72), Decl(underscoreTest1_underscore.ts, 544, 72)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 544, 20)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 544, 23)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 544, 20)) @@ -4546,7 +4546,7 @@ module Underscore { >propertyName : Symbol(propertyName, Decl(underscoreTest1_underscore.ts, 544, 41)) sortedIndex(list: T[], obj: T, iterator?: Iterator, context?: any): number; ->sortedIndex : Symbol(sortedIndex, Decl(underscoreTest1_underscore.ts, 542, 72), Decl(underscoreTest1_underscore.ts, 544, 72)) +>sortedIndex : Symbol(Static.sortedIndex, Decl(underscoreTest1_underscore.ts, 542, 72), Decl(underscoreTest1_underscore.ts, 544, 72)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 545, 20)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 545, 23)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 545, 20)) @@ -4558,17 +4558,17 @@ module Underscore { >context : Symbol(context, Decl(underscoreTest1_underscore.ts, 545, 70)) range(stop: number): number[]; ->range : Symbol(range, Decl(underscoreTest1_underscore.ts, 545, 94), Decl(underscoreTest1_underscore.ts, 547, 38)) +>range : Symbol(Static.range, Decl(underscoreTest1_underscore.ts, 545, 94), Decl(underscoreTest1_underscore.ts, 547, 38)) >stop : Symbol(stop, Decl(underscoreTest1_underscore.ts, 547, 14)) range(start: number, stop: number, step?: number): number[]; ->range : Symbol(range, Decl(underscoreTest1_underscore.ts, 545, 94), Decl(underscoreTest1_underscore.ts, 547, 38)) +>range : Symbol(Static.range, Decl(underscoreTest1_underscore.ts, 545, 94), Decl(underscoreTest1_underscore.ts, 547, 38)) >start : Symbol(start, Decl(underscoreTest1_underscore.ts, 548, 14)) >stop : Symbol(stop, Decl(underscoreTest1_underscore.ts, 548, 28)) >step : Symbol(step, Decl(underscoreTest1_underscore.ts, 548, 42)) bind(func: T, object: any): T; ->bind : Symbol(bind, Decl(underscoreTest1_underscore.ts, 548, 68), Decl(underscoreTest1_underscore.ts, 550, 58)) +>bind : Symbol(Static.bind, Decl(underscoreTest1_underscore.ts, 548, 68), Decl(underscoreTest1_underscore.ts, 550, 58)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 550, 13)) >Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >func : Symbol(func, Decl(underscoreTest1_underscore.ts, 550, 33)) @@ -4577,7 +4577,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 550, 13)) bind(func: Function, object: any, ...args: any[]): Function; ->bind : Symbol(bind, Decl(underscoreTest1_underscore.ts, 548, 68), Decl(underscoreTest1_underscore.ts, 550, 58)) +>bind : Symbol(Static.bind, Decl(underscoreTest1_underscore.ts, 548, 68), Decl(underscoreTest1_underscore.ts, 550, 58)) >func : Symbol(func, Decl(underscoreTest1_underscore.ts, 551, 13)) >Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >object : Symbol(object, Decl(underscoreTest1_underscore.ts, 551, 28)) @@ -4585,7 +4585,7 @@ module Underscore { >Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) bindAll(object: T, ...methodNames: string[]): T; ->bindAll : Symbol(bindAll, Decl(underscoreTest1_underscore.ts, 551, 68)) +>bindAll : Symbol(Static.bindAll, Decl(underscoreTest1_underscore.ts, 551, 68)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 553, 16)) >object : Symbol(object, Decl(underscoreTest1_underscore.ts, 553, 19)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 553, 16)) @@ -4593,14 +4593,14 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 553, 16)) partial(func: Function, ...args: any[]): Function; ->partial : Symbol(partial, Decl(underscoreTest1_underscore.ts, 553, 59)) +>partial : Symbol(Static.partial, Decl(underscoreTest1_underscore.ts, 553, 59)) >func : Symbol(func, Decl(underscoreTest1_underscore.ts, 555, 16)) >Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >args : Symbol(args, Decl(underscoreTest1_underscore.ts, 555, 31)) >Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) memoize(func: T, hashFunction?: Function): T; ->memoize : Symbol(memoize, Decl(underscoreTest1_underscore.ts, 555, 58)) +>memoize : Symbol(Static.memoize, Decl(underscoreTest1_underscore.ts, 555, 58)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 557, 16)) >Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >func : Symbol(func, Decl(underscoreTest1_underscore.ts, 557, 36)) @@ -4610,20 +4610,20 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 557, 16)) delay(func: Function, wait: number, ...args: any[]): number; ->delay : Symbol(delay, Decl(underscoreTest1_underscore.ts, 557, 73)) +>delay : Symbol(Static.delay, Decl(underscoreTest1_underscore.ts, 557, 73)) >func : Symbol(func, Decl(underscoreTest1_underscore.ts, 559, 14)) >Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >wait : Symbol(wait, Decl(underscoreTest1_underscore.ts, 559, 29)) >args : Symbol(args, Decl(underscoreTest1_underscore.ts, 559, 43)) defer(func: Function, ...args: any[]): number; ->defer : Symbol(defer, Decl(underscoreTest1_underscore.ts, 559, 68)) +>defer : Symbol(Static.defer, Decl(underscoreTest1_underscore.ts, 559, 68)) >func : Symbol(func, Decl(underscoreTest1_underscore.ts, 561, 14)) >Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >args : Symbol(args, Decl(underscoreTest1_underscore.ts, 561, 29)) throttle(func: T, wait: number): T; ->throttle : Symbol(throttle, Decl(underscoreTest1_underscore.ts, 561, 54)) +>throttle : Symbol(Static.throttle, Decl(underscoreTest1_underscore.ts, 561, 54)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 563, 17)) >Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >func : Symbol(func, Decl(underscoreTest1_underscore.ts, 563, 37)) @@ -4632,7 +4632,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 563, 17)) debounce(func: T, wait: number, immediate?: boolean): T; ->debounce : Symbol(debounce, Decl(underscoreTest1_underscore.ts, 563, 63)) +>debounce : Symbol(Static.debounce, Decl(underscoreTest1_underscore.ts, 563, 63)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 565, 17)) >Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >func : Symbol(func, Decl(underscoreTest1_underscore.ts, 565, 37)) @@ -4642,7 +4642,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 565, 17)) once(func: T): T; ->once : Symbol(once, Decl(underscoreTest1_underscore.ts, 565, 84)) +>once : Symbol(Static.once, Decl(underscoreTest1_underscore.ts, 565, 84)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 567, 13)) >Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >func : Symbol(func, Decl(underscoreTest1_underscore.ts, 567, 33)) @@ -4650,7 +4650,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 567, 13)) after(count: number, func: T): T; ->after : Symbol(after, Decl(underscoreTest1_underscore.ts, 567, 45)) +>after : Symbol(Static.after, Decl(underscoreTest1_underscore.ts, 567, 45)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 569, 14)) >Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >count : Symbol(count, Decl(underscoreTest1_underscore.ts, 569, 34)) @@ -4659,7 +4659,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 569, 14)) wrap(func: T, wrapper: (func: T, ...args: any[]) => any): T; ->wrap : Symbol(wrap, Decl(underscoreTest1_underscore.ts, 569, 61)) +>wrap : Symbol(Static.wrap, Decl(underscoreTest1_underscore.ts, 569, 61)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 571, 13)) >Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >func : Symbol(func, Decl(underscoreTest1_underscore.ts, 571, 33)) @@ -4671,37 +4671,37 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 571, 13)) compose(...funcs: Function[]): Function; ->compose : Symbol(compose, Decl(underscoreTest1_underscore.ts, 571, 88)) +>compose : Symbol(Static.compose, Decl(underscoreTest1_underscore.ts, 571, 88)) >funcs : Symbol(funcs, Decl(underscoreTest1_underscore.ts, 573, 16)) >Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) keys(object: any): string[]; ->keys : Symbol(keys, Decl(underscoreTest1_underscore.ts, 573, 48)) +>keys : Symbol(Static.keys, Decl(underscoreTest1_underscore.ts, 573, 48)) >object : Symbol(object, Decl(underscoreTest1_underscore.ts, 575, 13)) values(object: any): any[]; ->values : Symbol(values, Decl(underscoreTest1_underscore.ts, 575, 36)) +>values : Symbol(Static.values, Decl(underscoreTest1_underscore.ts, 575, 36)) >object : Symbol(object, Decl(underscoreTest1_underscore.ts, 577, 15)) pairs(object: any): any[][]; ->pairs : Symbol(pairs, Decl(underscoreTest1_underscore.ts, 577, 35)) +>pairs : Symbol(Static.pairs, Decl(underscoreTest1_underscore.ts, 577, 35)) >object : Symbol(object, Decl(underscoreTest1_underscore.ts, 579, 14)) invert(object: any): any; ->invert : Symbol(invert, Decl(underscoreTest1_underscore.ts, 579, 36)) +>invert : Symbol(Static.invert, Decl(underscoreTest1_underscore.ts, 579, 36)) >object : Symbol(object, Decl(underscoreTest1_underscore.ts, 581, 15)) functions(object: any): string[]; ->functions : Symbol(functions, Decl(underscoreTest1_underscore.ts, 581, 33)) +>functions : Symbol(Static.functions, Decl(underscoreTest1_underscore.ts, 581, 33)) >object : Symbol(object, Decl(underscoreTest1_underscore.ts, 583, 18)) methods(object: any): string[]; ->methods : Symbol(methods, Decl(underscoreTest1_underscore.ts, 583, 41)) +>methods : Symbol(Static.methods, Decl(underscoreTest1_underscore.ts, 583, 41)) >object : Symbol(object, Decl(underscoreTest1_underscore.ts, 584, 16)) extend(destination: T, ...sources: any[]): T; ->extend : Symbol(extend, Decl(underscoreTest1_underscore.ts, 584, 39)) +>extend : Symbol(Static.extend, Decl(underscoreTest1_underscore.ts, 584, 39)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 586, 15)) >destination : Symbol(destination, Decl(underscoreTest1_underscore.ts, 586, 18)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 586, 15)) @@ -4709,7 +4709,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 586, 15)) pick(object: T, ...keys: string[]): T; ->pick : Symbol(pick, Decl(underscoreTest1_underscore.ts, 586, 56)) +>pick : Symbol(Static.pick, Decl(underscoreTest1_underscore.ts, 586, 56)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 588, 13)) >object : Symbol(object, Decl(underscoreTest1_underscore.ts, 588, 16)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 588, 13)) @@ -4717,7 +4717,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 588, 13)) omit(object: T, ...keys: string[]): T; ->omit : Symbol(omit, Decl(underscoreTest1_underscore.ts, 588, 49)) +>omit : Symbol(Static.omit, Decl(underscoreTest1_underscore.ts, 588, 49)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 590, 13)) >object : Symbol(object, Decl(underscoreTest1_underscore.ts, 590, 16)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 590, 13)) @@ -4725,7 +4725,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 590, 13)) defaults(object: T, ...defaults: any[]): T; ->defaults : Symbol(defaults, Decl(underscoreTest1_underscore.ts, 590, 49)) +>defaults : Symbol(Static.defaults, Decl(underscoreTest1_underscore.ts, 590, 49)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 592, 17)) >object : Symbol(object, Decl(underscoreTest1_underscore.ts, 592, 20)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 592, 17)) @@ -4733,14 +4733,14 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 592, 17)) clone(object: T): T; ->clone : Symbol(clone, Decl(underscoreTest1_underscore.ts, 592, 54)) +>clone : Symbol(Static.clone, Decl(underscoreTest1_underscore.ts, 592, 54)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 594, 14)) >object : Symbol(object, Decl(underscoreTest1_underscore.ts, 594, 17)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 594, 14)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 594, 14)) tap(object: T, interceptor: (object: T) => void): T; ->tap : Symbol(tap, Decl(underscoreTest1_underscore.ts, 594, 31)) +>tap : Symbol(Static.tap, Decl(underscoreTest1_underscore.ts, 594, 31)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 596, 12)) >object : Symbol(object, Decl(underscoreTest1_underscore.ts, 596, 15)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 596, 12)) @@ -4750,12 +4750,12 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 596, 12)) has(object: any, key: string): boolean; ->has : Symbol(has, Decl(underscoreTest1_underscore.ts, 596, 63)) +>has : Symbol(Static.has, Decl(underscoreTest1_underscore.ts, 596, 63)) >object : Symbol(object, Decl(underscoreTest1_underscore.ts, 598, 12)) >key : Symbol(key, Decl(underscoreTest1_underscore.ts, 598, 24)) isEqual(object: T, other: T): boolean; ->isEqual : Symbol(isEqual, Decl(underscoreTest1_underscore.ts, 598, 47)) +>isEqual : Symbol(Static.isEqual, Decl(underscoreTest1_underscore.ts, 598, 47)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 600, 16)) >object : Symbol(object, Decl(underscoreTest1_underscore.ts, 600, 19)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 600, 16)) @@ -4763,78 +4763,78 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 600, 16)) isEmpty(object: any): boolean; ->isEmpty : Symbol(isEmpty, Decl(underscoreTest1_underscore.ts, 600, 49)) +>isEmpty : Symbol(Static.isEmpty, Decl(underscoreTest1_underscore.ts, 600, 49)) >object : Symbol(object, Decl(underscoreTest1_underscore.ts, 602, 16)) isElement(object: any): boolean; ->isElement : Symbol(isElement, Decl(underscoreTest1_underscore.ts, 602, 38)) +>isElement : Symbol(Static.isElement, Decl(underscoreTest1_underscore.ts, 602, 38)) >object : Symbol(object, Decl(underscoreTest1_underscore.ts, 603, 18)) isArray(object: any): boolean; ->isArray : Symbol(isArray, Decl(underscoreTest1_underscore.ts, 603, 40)) +>isArray : Symbol(Static.isArray, Decl(underscoreTest1_underscore.ts, 603, 40)) >object : Symbol(object, Decl(underscoreTest1_underscore.ts, 604, 16)) isObject(value: any): boolean; ->isObject : Symbol(isObject, Decl(underscoreTest1_underscore.ts, 604, 38)) +>isObject : Symbol(Static.isObject, Decl(underscoreTest1_underscore.ts, 604, 38)) >value : Symbol(value, Decl(underscoreTest1_underscore.ts, 605, 17)) isArguments(object: any): boolean; ->isArguments : Symbol(isArguments, Decl(underscoreTest1_underscore.ts, 605, 38)) +>isArguments : Symbol(Static.isArguments, Decl(underscoreTest1_underscore.ts, 605, 38)) >object : Symbol(object, Decl(underscoreTest1_underscore.ts, 606, 20)) isFunction(object: any): boolean; ->isFunction : Symbol(isFunction, Decl(underscoreTest1_underscore.ts, 606, 42)) +>isFunction : Symbol(Static.isFunction, Decl(underscoreTest1_underscore.ts, 606, 42)) >object : Symbol(object, Decl(underscoreTest1_underscore.ts, 607, 19)) isString(object: any): boolean; ->isString : Symbol(isString, Decl(underscoreTest1_underscore.ts, 607, 41)) +>isString : Symbol(Static.isString, Decl(underscoreTest1_underscore.ts, 607, 41)) >object : Symbol(object, Decl(underscoreTest1_underscore.ts, 608, 17)) isNumber(object: any): boolean; ->isNumber : Symbol(isNumber, Decl(underscoreTest1_underscore.ts, 608, 39)) +>isNumber : Symbol(Static.isNumber, Decl(underscoreTest1_underscore.ts, 608, 39)) >object : Symbol(object, Decl(underscoreTest1_underscore.ts, 609, 17)) isFinite(object: any): boolean; ->isFinite : Symbol(isFinite, Decl(underscoreTest1_underscore.ts, 609, 39)) +>isFinite : Symbol(Static.isFinite, Decl(underscoreTest1_underscore.ts, 609, 39)) >object : Symbol(object, Decl(underscoreTest1_underscore.ts, 610, 17)) isBoolean(object: any): boolean; ->isBoolean : Symbol(isBoolean, Decl(underscoreTest1_underscore.ts, 610, 39)) +>isBoolean : Symbol(Static.isBoolean, Decl(underscoreTest1_underscore.ts, 610, 39)) >object : Symbol(object, Decl(underscoreTest1_underscore.ts, 611, 18)) isDate(object: any): boolean; ->isDate : Symbol(isDate, Decl(underscoreTest1_underscore.ts, 611, 40)) +>isDate : Symbol(Static.isDate, Decl(underscoreTest1_underscore.ts, 611, 40)) >object : Symbol(object, Decl(underscoreTest1_underscore.ts, 612, 15)) isRegExp(object: any): boolean; ->isRegExp : Symbol(isRegExp, Decl(underscoreTest1_underscore.ts, 612, 37)) +>isRegExp : Symbol(Static.isRegExp, Decl(underscoreTest1_underscore.ts, 612, 37)) >object : Symbol(object, Decl(underscoreTest1_underscore.ts, 613, 17)) isNaN(object: any): boolean; ->isNaN : Symbol(isNaN, Decl(underscoreTest1_underscore.ts, 613, 39)) +>isNaN : Symbol(Static.isNaN, Decl(underscoreTest1_underscore.ts, 613, 39)) >object : Symbol(object, Decl(underscoreTest1_underscore.ts, 614, 14)) isNull(object: any): boolean; ->isNull : Symbol(isNull, Decl(underscoreTest1_underscore.ts, 614, 36)) +>isNull : Symbol(Static.isNull, Decl(underscoreTest1_underscore.ts, 614, 36)) >object : Symbol(object, Decl(underscoreTest1_underscore.ts, 615, 15)) isUndefined(value: any): boolean; ->isUndefined : Symbol(isUndefined, Decl(underscoreTest1_underscore.ts, 615, 37)) +>isUndefined : Symbol(Static.isUndefined, Decl(underscoreTest1_underscore.ts, 615, 37)) >value : Symbol(value, Decl(underscoreTest1_underscore.ts, 616, 20)) noConflict(): Static; ->noConflict : Symbol(noConflict, Decl(underscoreTest1_underscore.ts, 616, 41)) +>noConflict : Symbol(Static.noConflict, Decl(underscoreTest1_underscore.ts, 616, 41)) >Static : Symbol(Static, Decl(underscoreTest1_underscore.ts, 385, 5)) identity(value: T): T; ->identity : Symbol(identity, Decl(underscoreTest1_underscore.ts, 618, 29)) +>identity : Symbol(Static.identity, Decl(underscoreTest1_underscore.ts, 618, 29)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 620, 17)) >value : Symbol(value, Decl(underscoreTest1_underscore.ts, 620, 20)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 620, 17)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 620, 17)) times(n: number, iterator: Iterator, context?: any): U[]; ->times : Symbol(times, Decl(underscoreTest1_underscore.ts, 620, 33)) +>times : Symbol(Static.times, Decl(underscoreTest1_underscore.ts, 620, 33)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 622, 14)) >n : Symbol(n, Decl(underscoreTest1_underscore.ts, 622, 17)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 622, 27)) @@ -4844,49 +4844,49 @@ module Underscore { >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 622, 14)) random(max: number): number; ->random : Symbol(random, Decl(underscoreTest1_underscore.ts, 622, 79), Decl(underscoreTest1_underscore.ts, 624, 36)) +>random : Symbol(Static.random, Decl(underscoreTest1_underscore.ts, 622, 79), Decl(underscoreTest1_underscore.ts, 624, 36)) >max : Symbol(max, Decl(underscoreTest1_underscore.ts, 624, 15)) random(min: number, max: number): number; ->random : Symbol(random, Decl(underscoreTest1_underscore.ts, 622, 79), Decl(underscoreTest1_underscore.ts, 624, 36)) +>random : Symbol(Static.random, Decl(underscoreTest1_underscore.ts, 622, 79), Decl(underscoreTest1_underscore.ts, 624, 36)) >min : Symbol(min, Decl(underscoreTest1_underscore.ts, 625, 15)) >max : Symbol(max, Decl(underscoreTest1_underscore.ts, 625, 27)) mixin(object: any): void; ->mixin : Symbol(mixin, Decl(underscoreTest1_underscore.ts, 625, 49)) +>mixin : Symbol(Static.mixin, Decl(underscoreTest1_underscore.ts, 625, 49)) >object : Symbol(object, Decl(underscoreTest1_underscore.ts, 627, 14)) uniqueId(): number; ->uniqueId : Symbol(uniqueId, Decl(underscoreTest1_underscore.ts, 627, 33), Decl(underscoreTest1_underscore.ts, 629, 27)) +>uniqueId : Symbol(Static.uniqueId, Decl(underscoreTest1_underscore.ts, 627, 33), Decl(underscoreTest1_underscore.ts, 629, 27)) uniqueId(prefix: string): string; ->uniqueId : Symbol(uniqueId, Decl(underscoreTest1_underscore.ts, 627, 33), Decl(underscoreTest1_underscore.ts, 629, 27)) +>uniqueId : Symbol(Static.uniqueId, Decl(underscoreTest1_underscore.ts, 627, 33), Decl(underscoreTest1_underscore.ts, 629, 27)) >prefix : Symbol(prefix, Decl(underscoreTest1_underscore.ts, 630, 17)) escape(s: string): string; ->escape : Symbol(escape, Decl(underscoreTest1_underscore.ts, 630, 41)) +>escape : Symbol(Static.escape, Decl(underscoreTest1_underscore.ts, 630, 41)) >s : Symbol(s, Decl(underscoreTest1_underscore.ts, 632, 15)) unescape(s: string): string; ->unescape : Symbol(unescape, Decl(underscoreTest1_underscore.ts, 632, 34)) +>unescape : Symbol(Static.unescape, Decl(underscoreTest1_underscore.ts, 632, 34)) >s : Symbol(s, Decl(underscoreTest1_underscore.ts, 634, 17)) result(object: any, property: string): any; ->result : Symbol(result, Decl(underscoreTest1_underscore.ts, 634, 36)) +>result : Symbol(Static.result, Decl(underscoreTest1_underscore.ts, 634, 36)) >object : Symbol(object, Decl(underscoreTest1_underscore.ts, 636, 15)) >property : Symbol(property, Decl(underscoreTest1_underscore.ts, 636, 27)) templateSettings: TemplateSettings; ->templateSettings : Symbol(templateSettings, Decl(underscoreTest1_underscore.ts, 636, 51)) +>templateSettings : Symbol(Static.templateSettings, Decl(underscoreTest1_underscore.ts, 636, 51)) >TemplateSettings : Symbol(TemplateSettings, Decl(underscoreTest1_underscore.ts, 378, 5)) template(templateString: string): (data: any) => string; ->template : Symbol(template, Decl(underscoreTest1_underscore.ts, 638, 43), Decl(underscoreTest1_underscore.ts, 640, 64)) +>template : Symbol(Static.template, Decl(underscoreTest1_underscore.ts, 638, 43), Decl(underscoreTest1_underscore.ts, 640, 64)) >templateString : Symbol(templateString, Decl(underscoreTest1_underscore.ts, 640, 17)) >data : Symbol(data, Decl(underscoreTest1_underscore.ts, 640, 43)) template(templateString: string, data: any, settings?: TemplateSettings): string; ->template : Symbol(template, Decl(underscoreTest1_underscore.ts, 638, 43), Decl(underscoreTest1_underscore.ts, 640, 64)) +>template : Symbol(Static.template, Decl(underscoreTest1_underscore.ts, 638, 43), Decl(underscoreTest1_underscore.ts, 640, 64)) >templateString : Symbol(templateString, Decl(underscoreTest1_underscore.ts, 641, 17)) >data : Symbol(data, Decl(underscoreTest1_underscore.ts, 641, 40)) >settings : Symbol(settings, Decl(underscoreTest1_underscore.ts, 641, 51)) diff --git a/tests/baselines/reference/underscoreTest1.types b/tests/baselines/reference/underscoreTest1.types index 7fe233c4490..37f3bdb12ab 100644 --- a/tests/baselines/reference/underscoreTest1.types +++ b/tests/baselines/reference/underscoreTest1.types @@ -31,7 +31,7 @@ _.each({ one: 1, two: 2, three: 3 }, (value: number, key?: string) => alert(valu >_.each : { (list: T[], iterator: Iterator, context?: any): void; (list: Dictionary, iterator: Iterator, context?: any): void; } >_ : Underscore.Static >each : { (list: T[], iterator: Iterator, context?: any): void; (list: Dictionary, iterator: Iterator, context?: any): void; } ->{ one: 1, two: 2, three: 3 } : { [x: string]: number; one: number; two: number; three: number; } +>{ one: 1, two: 2, three: 3 } : { one: number; two: number; three: number; } >one : number >1 : number >two : number @@ -68,7 +68,7 @@ _.map({ one: 1, two: 2, three: 3 }, (value: number, key?: string) => value * 3); >_.map : { (list: T[], iterator: Iterator, context?: any): U[]; (list: Dictionary, iterator: Iterator, context?: any): U[]; } >_ : Underscore.Static >map : { (list: T[], iterator: Iterator, context?: any): U[]; (list: Dictionary, iterator: Iterator, context?: any): U[]; } ->{ one: 1, two: 2, three: 3 } : { [x: string]: number; one: number; two: number; three: number; } +>{ one: 1, two: 2, three: 3 } : { one: number; two: number; three: number; } >one : number >1 : number >two : number @@ -124,9 +124,9 @@ var flat = _.reduceRight(list, (a, b) => a.concat(b), []); >a : number[] >b : number[] >a.concat(b) : number[] ->a.concat : { (...items: U[]): number[]; (...items: number[]): number[]; } +>a.concat : (...items: (number | number[])[]) => number[] >a : number[] ->concat : { (...items: U[]): number[]; (...items: number[]): number[]; } +>concat : (...items: (number | number[])[]) => number[] >b : number[] >[] : undefined[] @@ -449,7 +449,7 @@ _.size({ one: 1, two: 2, three: 3 }); >_.size : { (list: T[]): number; (list: Dictionary): number; } >_ : Underscore.Static >size : { (list: T[]): number; (list: Dictionary): number; } ->{ one: 1, two: 2, three: 3 } : { [x: string]: number; one: number; two: number; three: number; } +>{ one: 1, two: 2, three: 3 } : { one: number; two: number; three: number; } >one : number >1 : number >two : number diff --git a/tests/baselines/reference/unionAndIntersectionInference1.symbols b/tests/baselines/reference/unionAndIntersectionInference1.symbols index 5e96790ea34..685b21dd215 100644 --- a/tests/baselines/reference/unionAndIntersectionInference1.symbols +++ b/tests/baselines/reference/unionAndIntersectionInference1.symbols @@ -157,21 +157,21 @@ interface Man { >Man : Symbol(Man, Decl(unionAndIntersectionInference1.ts, 51, 23)) walks: boolean; ->walks : Symbol(walks, Decl(unionAndIntersectionInference1.ts, 55, 15)) +>walks : Symbol(Man.walks, Decl(unionAndIntersectionInference1.ts, 55, 15)) } interface Bear { >Bear : Symbol(Bear, Decl(unionAndIntersectionInference1.ts, 57, 1)) roars: boolean; ->roars : Symbol(roars, Decl(unionAndIntersectionInference1.ts, 59, 16)) +>roars : Symbol(Bear.roars, Decl(unionAndIntersectionInference1.ts, 59, 16)) } interface Pig { >Pig : Symbol(Pig, Decl(unionAndIntersectionInference1.ts, 61, 1)) oinks: boolean; ->oinks : Symbol(oinks, Decl(unionAndIntersectionInference1.ts, 63, 15)) +>oinks : Symbol(Pig.oinks, Decl(unionAndIntersectionInference1.ts, 63, 15)) } declare function pigify(y: T & Bear): T & Pig; diff --git a/tests/baselines/reference/unionAndIntersectionInference1.types b/tests/baselines/reference/unionAndIntersectionInference1.types index 073a677b659..5d23688f0b7 100644 --- a/tests/baselines/reference/unionAndIntersectionInference1.types +++ b/tests/baselines/reference/unionAndIntersectionInference1.types @@ -110,7 +110,7 @@ function foo1(value: void|a): void { >a : a if (isVoid(value)) { ->isVoid(value) : value is void +>isVoid(value) : boolean >isVoid : (value: void | a) => value is void >value : void | a @@ -130,7 +130,7 @@ function baz1(value: void|a): void { >a : a if (isNonVoid(value)) { ->isNonVoid(value) : value is a +>isNonVoid(value) : boolean >isNonVoid : (value: void | a) => value is a >value : void | a diff --git a/tests/baselines/reference/unionThisTypeInFunctions.js b/tests/baselines/reference/unionThisTypeInFunctions.js new file mode 100644 index 00000000000..0d4b535ff8b --- /dev/null +++ b/tests/baselines/reference/unionThisTypeInFunctions.js @@ -0,0 +1,18 @@ +//// [unionThisTypeInFunctions.ts] +interface Real { + method(this: this, n: number): void; + data: string; +} +interface Fake { + method(this: this, n: number): void; + data: number; +} +function test(r: Real | Fake) { + r.method(12); +} + + +//// [unionThisTypeInFunctions.js] +function test(r) { + r.method(12); +} diff --git a/tests/baselines/reference/unionThisTypeInFunctions.symbols b/tests/baselines/reference/unionThisTypeInFunctions.symbols new file mode 100644 index 00000000000..eada1231750 --- /dev/null +++ b/tests/baselines/reference/unionThisTypeInFunctions.symbols @@ -0,0 +1,35 @@ +=== tests/cases/conformance/types/thisType/unionThisTypeInFunctions.ts === +interface Real { +>Real : Symbol(Real, Decl(unionThisTypeInFunctions.ts, 0, 0)) + + method(this: this, n: number): void; +>method : Symbol(Real.method, Decl(unionThisTypeInFunctions.ts, 0, 16)) +>this : Symbol(this, Decl(unionThisTypeInFunctions.ts, 1, 11)) +>n : Symbol(n, Decl(unionThisTypeInFunctions.ts, 1, 22)) + + data: string; +>data : Symbol(Real.data, Decl(unionThisTypeInFunctions.ts, 1, 40)) +} +interface Fake { +>Fake : Symbol(Fake, Decl(unionThisTypeInFunctions.ts, 3, 1)) + + method(this: this, n: number): void; +>method : Symbol(Fake.method, Decl(unionThisTypeInFunctions.ts, 4, 16)) +>this : Symbol(this, Decl(unionThisTypeInFunctions.ts, 5, 11)) +>n : Symbol(n, Decl(unionThisTypeInFunctions.ts, 5, 22)) + + data: number; +>data : Symbol(Fake.data, Decl(unionThisTypeInFunctions.ts, 5, 40)) +} +function test(r: Real | Fake) { +>test : Symbol(test, Decl(unionThisTypeInFunctions.ts, 7, 1)) +>r : Symbol(r, Decl(unionThisTypeInFunctions.ts, 8, 14)) +>Real : Symbol(Real, Decl(unionThisTypeInFunctions.ts, 0, 0)) +>Fake : Symbol(Fake, Decl(unionThisTypeInFunctions.ts, 3, 1)) + + r.method(12); +>r.method : Symbol(method, Decl(unionThisTypeInFunctions.ts, 0, 16), Decl(unionThisTypeInFunctions.ts, 4, 16)) +>r : Symbol(r, Decl(unionThisTypeInFunctions.ts, 8, 14)) +>method : Symbol(method, Decl(unionThisTypeInFunctions.ts, 0, 16), Decl(unionThisTypeInFunctions.ts, 4, 16)) +} + diff --git a/tests/baselines/reference/unionThisTypeInFunctions.types b/tests/baselines/reference/unionThisTypeInFunctions.types new file mode 100644 index 00000000000..3c5181166b6 --- /dev/null +++ b/tests/baselines/reference/unionThisTypeInFunctions.types @@ -0,0 +1,37 @@ +=== tests/cases/conformance/types/thisType/unionThisTypeInFunctions.ts === +interface Real { +>Real : Real + + method(this: this, n: number): void; +>method : (this: this, n: number) => void +>this : this +>n : number + + data: string; +>data : string +} +interface Fake { +>Fake : Fake + + method(this: this, n: number): void; +>method : (this: this, n: number) => void +>this : this +>n : number + + data: number; +>data : number +} +function test(r: Real | Fake) { +>test : (r: Real | Fake) => void +>r : Real | Fake +>Real : Real +>Fake : Fake + + r.method(12); +>r.method(12) : void +>r.method : ((this: Real, n: number) => void) | ((this: Fake, n: number) => void) +>r : Real | Fake +>method : ((this: Real, n: number) => void) | ((this: Fake, n: number) => void) +>12 : number +} + diff --git a/tests/baselines/reference/unionTypeCallSignatures2.symbols b/tests/baselines/reference/unionTypeCallSignatures2.symbols index 32ce4c352b8..19279346cde 100644 --- a/tests/baselines/reference/unionTypeCallSignatures2.symbols +++ b/tests/baselines/reference/unionTypeCallSignatures2.symbols @@ -11,7 +11,7 @@ interface A { (x: Date): void; >x : Symbol(x, Decl(unionTypeCallSignatures2.ts, 3, 5)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) (x: T[]): T[]; >T : Symbol(T, Decl(unionTypeCallSignatures2.ts, 4, 5)) @@ -31,7 +31,7 @@ interface B { (x: Date): void; >x : Symbol(x, Decl(unionTypeCallSignatures2.ts, 10, 5)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) (x: T[]): T[]; >T : Symbol(T, Decl(unionTypeCallSignatures2.ts, 11, 5)) diff --git a/tests/baselines/reference/unionTypeFromArrayLiteral.symbols b/tests/baselines/reference/unionTypeFromArrayLiteral.symbols index 74047b6be11..7699e89dedd 100644 --- a/tests/baselines/reference/unionTypeFromArrayLiteral.symbols +++ b/tests/baselines/reference/unionTypeFromArrayLiteral.symbols @@ -27,21 +27,21 @@ var arr5Tuple: { } = ["hello", true, false, " hello", true, 10, "any"]; // Tuple class C { foo() { } } >C : Symbol(C, Decl(unionTypeFromArrayLiteral.ts, 13, 54)) ->foo : Symbol(foo, Decl(unionTypeFromArrayLiteral.ts, 14, 9)) +>foo : Symbol(C.foo, Decl(unionTypeFromArrayLiteral.ts, 14, 9)) class D { foo2() { } } >D : Symbol(D, Decl(unionTypeFromArrayLiteral.ts, 14, 21)) ->foo2 : Symbol(foo2, Decl(unionTypeFromArrayLiteral.ts, 15, 9)) +>foo2 : Symbol(D.foo2, Decl(unionTypeFromArrayLiteral.ts, 15, 9)) class E extends C { foo3() { } } >E : Symbol(E, Decl(unionTypeFromArrayLiteral.ts, 15, 22)) >C : Symbol(C, Decl(unionTypeFromArrayLiteral.ts, 13, 54)) ->foo3 : Symbol(foo3, Decl(unionTypeFromArrayLiteral.ts, 16, 19)) +>foo3 : Symbol(E.foo3, Decl(unionTypeFromArrayLiteral.ts, 16, 19)) class F extends C { foo4() { } } >F : Symbol(F, Decl(unionTypeFromArrayLiteral.ts, 16, 32)) >C : Symbol(C, Decl(unionTypeFromArrayLiteral.ts, 13, 54)) ->foo4 : Symbol(foo4, Decl(unionTypeFromArrayLiteral.ts, 17, 19)) +>foo4 : Symbol(F.foo4, Decl(unionTypeFromArrayLiteral.ts, 17, 19)) var c: C, d: D, e: E, f: F; >c : Symbol(c, Decl(unionTypeFromArrayLiteral.ts, 18, 3)) diff --git a/tests/baselines/reference/unionTypeIndexSignature.symbols b/tests/baselines/reference/unionTypeIndexSignature.symbols index 7295b860f3f..dc3923f2f24 100644 --- a/tests/baselines/reference/unionTypeIndexSignature.symbols +++ b/tests/baselines/reference/unionTypeIndexSignature.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/types/union/unionTypeIndexSignature.ts === var numOrDate: number | Date; >numOrDate : Symbol(numOrDate, Decl(unionTypeIndexSignature.ts, 0, 3)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) var anyVar: number; >anyVar : Symbol(anyVar, Decl(unionTypeIndexSignature.ts, 1, 3)) @@ -13,7 +13,7 @@ var unionOfDifferentReturnType: { [a: string]: number; } | { [a: string]: Date; >unionOfDifferentReturnType : Symbol(unionOfDifferentReturnType, Decl(unionTypeIndexSignature.ts, 6, 3)) >a : Symbol(a, Decl(unionTypeIndexSignature.ts, 6, 35)) >a : Symbol(a, Decl(unionTypeIndexSignature.ts, 6, 62)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) numOrDate = unionOfDifferentReturnType["hello"]; // number | Date >numOrDate : Symbol(numOrDate, Decl(unionTypeIndexSignature.ts, 0, 3)) @@ -41,7 +41,7 @@ var unionOfDifferentReturnType1: { [a: number]: number; } | { [a: number]: Date; >unionOfDifferentReturnType1 : Symbol(unionOfDifferentReturnType1, Decl(unionTypeIndexSignature.ts, 16, 3)) >a : Symbol(a, Decl(unionTypeIndexSignature.ts, 16, 36)) >a : Symbol(a, Decl(unionTypeIndexSignature.ts, 16, 63)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) numOrDate = unionOfDifferentReturnType1["hello"]; // any >numOrDate : Symbol(numOrDate, Decl(unionTypeIndexSignature.ts, 0, 3)) diff --git a/tests/baselines/reference/unionTypeParameterInference.symbols b/tests/baselines/reference/unionTypeParameterInference.symbols index f2dbaac31ff..0e7e53f4049 100644 --- a/tests/baselines/reference/unionTypeParameterInference.symbols +++ b/tests/baselines/reference/unionTypeParameterInference.symbols @@ -4,7 +4,7 @@ interface Foo { prop: T; } >Foo : Symbol(Foo, Decl(unionTypeParameterInference.ts, 0, 0)) >T : Symbol(T, Decl(unionTypeParameterInference.ts, 2, 14)) ->prop : Symbol(prop, Decl(unionTypeParameterInference.ts, 2, 18)) +>prop : Symbol(Foo.prop, Decl(unionTypeParameterInference.ts, 2, 18)) >T : Symbol(T, Decl(unionTypeParameterInference.ts, 2, 14)) declare function lift(value: U | Foo): Foo; diff --git a/tests/baselines/reference/unionTypePropertyAccessibility.errors.txt b/tests/baselines/reference/unionTypePropertyAccessibility.errors.txt index 83e69cbcfc3..33b20183b5e 100644 --- a/tests/baselines/reference/unionTypePropertyAccessibility.errors.txt +++ b/tests/baselines/reference/unionTypePropertyAccessibility.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/types/union/unionTypePropertyAccessibility.ts(35,1): error TS2445: Property 'member' is protected and only accessible within class 'Protected' and its subclasses. -tests/cases/conformance/types/union/unionTypePropertyAccessibility.ts(36,1): error TS2341: Property 'member' is private and only accessible within class 'Private'. +tests/cases/conformance/types/union/unionTypePropertyAccessibility.ts(35,4): error TS2445: Property 'member' is protected and only accessible within class 'Protected' and its subclasses. +tests/cases/conformance/types/union/unionTypePropertyAccessibility.ts(36,4): error TS2341: Property 'member' is private and only accessible within class 'Private'. tests/cases/conformance/types/union/unionTypePropertyAccessibility.ts(38,4): error TS2339: Property 'member' does not exist on type 'Default | Protected'. tests/cases/conformance/types/union/unionTypePropertyAccessibility.ts(39,4): error TS2339: Property 'member' does not exist on type 'Default | Private'. tests/cases/conformance/types/union/unionTypePropertyAccessibility.ts(40,4): error TS2339: Property 'member' does not exist on type 'Public | Protected'. @@ -48,10 +48,10 @@ tests/cases/conformance/types/union/unionTypePropertyAccessibility.ts(47,5): err v1.member; v2.member; v3.member; - ~~~~~~~~~ + ~~~~~~ !!! error TS2445: Property 'member' is protected and only accessible within class 'Protected' and its subclasses. v4.member; - ~~~~~~~~~ + ~~~~~~ !!! error TS2341: Property 'member' is private and only accessible within class 'Private'. v5.member; v6.member; diff --git a/tests/baselines/reference/unionTypeWithRecursiveSubtypeReduction1.symbols b/tests/baselines/reference/unionTypeWithRecursiveSubtypeReduction1.symbols index 24ba3b8a8cd..3056f8d21c0 100644 --- a/tests/baselines/reference/unionTypeWithRecursiveSubtypeReduction1.symbols +++ b/tests/baselines/reference/unionTypeWithRecursiveSubtypeReduction1.symbols @@ -3,7 +3,7 @@ class Module { >Module : Symbol(Module, Decl(unionTypeWithRecursiveSubtypeReduction1.ts, 0, 0)) public members: Class[]; ->members : Symbol(members, Decl(unionTypeWithRecursiveSubtypeReduction1.ts, 0, 14)) +>members : Symbol(Module.members, Decl(unionTypeWithRecursiveSubtypeReduction1.ts, 0, 14)) >Class : Symbol(Class, Decl(unionTypeWithRecursiveSubtypeReduction1.ts, 6, 1)) } @@ -11,7 +11,7 @@ class Namespace { >Namespace : Symbol(Namespace, Decl(unionTypeWithRecursiveSubtypeReduction1.ts, 2, 1)) public members: (Class | Property)[]; ->members : Symbol(members, Decl(unionTypeWithRecursiveSubtypeReduction1.ts, 4, 17)) +>members : Symbol(Namespace.members, Decl(unionTypeWithRecursiveSubtypeReduction1.ts, 4, 17)) >Class : Symbol(Class, Decl(unionTypeWithRecursiveSubtypeReduction1.ts, 6, 1)) >Property : Symbol(Property, Decl(unionTypeWithRecursiveSubtypeReduction1.ts, 10, 1)) } @@ -20,7 +20,7 @@ class Class { >Class : Symbol(Class, Decl(unionTypeWithRecursiveSubtypeReduction1.ts, 6, 1)) public parent: Namespace; ->parent : Symbol(parent, Decl(unionTypeWithRecursiveSubtypeReduction1.ts, 8, 13)) +>parent : Symbol(Class.parent, Decl(unionTypeWithRecursiveSubtypeReduction1.ts, 8, 13)) >Namespace : Symbol(Namespace, Decl(unionTypeWithRecursiveSubtypeReduction1.ts, 2, 1)) } @@ -28,7 +28,7 @@ class Property { >Property : Symbol(Property, Decl(unionTypeWithRecursiveSubtypeReduction1.ts, 10, 1)) public parent: Module | Class; ->parent : Symbol(parent, Decl(unionTypeWithRecursiveSubtypeReduction1.ts, 12, 16)) +>parent : Symbol(Property.parent, Decl(unionTypeWithRecursiveSubtypeReduction1.ts, 12, 16)) >Module : Symbol(Module, Decl(unionTypeWithRecursiveSubtypeReduction1.ts, 0, 0)) >Class : Symbol(Class, Decl(unionTypeWithRecursiveSubtypeReduction1.ts, 6, 1)) } diff --git a/tests/baselines/reference/unionTypesAssignability.errors.txt b/tests/baselines/reference/unionTypesAssignability.errors.txt index cad61f41d1d..5be1ff3d246 100644 --- a/tests/baselines/reference/unionTypesAssignability.errors.txt +++ b/tests/baselines/reference/unionTypesAssignability.errors.txt @@ -24,9 +24,9 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/unionTyp tests/cases/conformance/types/typeRelationships/assignmentCompatibility/unionTypesAssignability.ts(43,1): error TS2322: Type 'string' is not assignable to type 'number'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/unionTypesAssignability.ts(64,5): error TS2322: Type 'U' is not assignable to type 'T'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/unionTypesAssignability.ts(65,5): error TS2322: Type 'T' is not assignable to type 'U'. -tests/cases/conformance/types/typeRelationships/assignmentCompatibility/unionTypesAssignability.ts(69,5): error TS2322: Type 'T | U' is not assignable to type 'T'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/unionTypesAssignability.ts(70,5): error TS2322: Type 'T | U' is not assignable to type 'T'. Type 'U' is not assignable to type 'T'. -tests/cases/conformance/types/typeRelationships/assignmentCompatibility/unionTypesAssignability.ts(70,5): error TS2322: Type 'T | U' is not assignable to type 'U'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/unionTypesAssignability.ts(71,5): error TS2322: Type 'T | U' is not assignable to type 'U'. Type 'T' is not assignable to type 'U'. @@ -142,6 +142,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/unionTyp var x : T | U; x = t; // ok x = u; // ok + x = undefined; t = x; // error U not assignable to T ~ !!! error TS2322: Type 'T | U' is not assignable to type 'T'. diff --git a/tests/baselines/reference/unionTypesAssignability.js b/tests/baselines/reference/unionTypesAssignability.js index e07901347a5..c7105608004 100644 --- a/tests/baselines/reference/unionTypesAssignability.js +++ b/tests/baselines/reference/unionTypesAssignability.js @@ -67,6 +67,7 @@ function foo(t: T, u: U) { var x : T | U; x = t; // ok x = u; // ok + x = undefined; t = x; // error U not assignable to T u = x; // error T not assignable to U } @@ -157,6 +158,7 @@ function foo(t, u) { var x; x = t; // ok x = u; // ok + x = undefined; t = x; // error U not assignable to T u = x; // error T not assignable to U } diff --git a/tests/baselines/reference/unqualifiedCallToClassStatic1.errors.txt b/tests/baselines/reference/unqualifiedCallToClassStatic1.errors.txt index af9edd115e9..4152c182d45 100644 --- a/tests/baselines/reference/unqualifiedCallToClassStatic1.errors.txt +++ b/tests/baselines/reference/unqualifiedCallToClassStatic1.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/unqualifiedCallToClassStatic1.ts(4,3): error TS2304: Cannot find name 'foo'. +tests/cases/compiler/unqualifiedCallToClassStatic1.ts(4,3): error TS2662: Cannot find name 'foo'. Did you mean the static member 'Vector.foo'? ==== tests/cases/compiler/unqualifiedCallToClassStatic1.ts (1 errors) ==== @@ -7,6 +7,6 @@ tests/cases/compiler/unqualifiedCallToClassStatic1.ts(4,3): error TS2304: Cannot // 'foo' cannot be called in an unqualified manner. foo(); ~~~ -!!! error TS2304: Cannot find name 'foo'. +!!! error TS2662: Cannot find name 'foo'. Did you mean the static member 'Vector.foo'? } } \ No newline at end of file diff --git a/tests/baselines/reference/unusedImportDeclaration.symbols b/tests/baselines/reference/unusedImportDeclaration.symbols index a298ba94631..6a65f360559 100644 --- a/tests/baselines/reference/unusedImportDeclaration.symbols +++ b/tests/baselines/reference/unusedImportDeclaration.symbols @@ -25,7 +25,7 @@ class TesterB { >TesterB : Symbol(TesterB, Decl(unusedImportDeclaration_testerB.ts, 0, 0)) me: string; ->me : Symbol(me, Decl(unusedImportDeclaration_testerB.ts, 0, 15)) +>me : Symbol(TesterB.me, Decl(unusedImportDeclaration_testerB.ts, 0, 15)) } export = TesterB; >TesterB : Symbol(TesterB, Decl(unusedImportDeclaration_testerB.ts, 0, 0)) diff --git a/tests/baselines/reference/useObjectValuesAndEntries1.js b/tests/baselines/reference/useObjectValuesAndEntries1.js new file mode 100644 index 00000000000..ee2c7115813 --- /dev/null +++ b/tests/baselines/reference/useObjectValuesAndEntries1.js @@ -0,0 +1,19 @@ +//// [useObjectValuesAndEntries1.ts] + +var o = { a: 1, b: 2 }; + +for (var x of Object.values(o)) { + let y = x; +} + +var entries = Object.entries(o); +var entries1 = Object.entries(1); // <-- entries: [string, any][] + +//// [useObjectValuesAndEntries1.js] +var o = { a: 1, b: 2 }; +for (var _i = 0, _a = Object.values(o); _i < _a.length; _i++) { + var x = _a[_i]; + var y = x; +} +var entries = Object.entries(o); +var entries1 = Object.entries(1); // <-- entries: [string, any][] diff --git a/tests/baselines/reference/useObjectValuesAndEntries1.symbols b/tests/baselines/reference/useObjectValuesAndEntries1.symbols new file mode 100644 index 00000000000..55181e49bab --- /dev/null +++ b/tests/baselines/reference/useObjectValuesAndEntries1.symbols @@ -0,0 +1,32 @@ +=== tests/cases/conformance/es2017/useObjectValuesAndEntries1.ts === + +var o = { a: 1, b: 2 }; +>o : Symbol(o, Decl(useObjectValuesAndEntries1.ts, 1, 3)) +>a : Symbol(a, Decl(useObjectValuesAndEntries1.ts, 1, 9)) +>b : Symbol(b, Decl(useObjectValuesAndEntries1.ts, 1, 15)) + +for (var x of Object.values(o)) { +>x : Symbol(x, Decl(useObjectValuesAndEntries1.ts, 3, 8)) +>Object.values : Symbol(ObjectConstructor.values, Decl(lib.es2017.object.d.ts, --, --), Decl(lib.es2017.object.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>values : Symbol(ObjectConstructor.values, Decl(lib.es2017.object.d.ts, --, --), Decl(lib.es2017.object.d.ts, --, --)) +>o : Symbol(o, Decl(useObjectValuesAndEntries1.ts, 1, 3)) + + let y = x; +>y : Symbol(y, Decl(useObjectValuesAndEntries1.ts, 4, 7)) +>x : Symbol(x, Decl(useObjectValuesAndEntries1.ts, 3, 8)) +} + +var entries = Object.entries(o); +>entries : Symbol(entries, Decl(useObjectValuesAndEntries1.ts, 7, 3)) +>Object.entries : Symbol(ObjectConstructor.entries, Decl(lib.es2017.object.d.ts, --, --), Decl(lib.es2017.object.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>entries : Symbol(ObjectConstructor.entries, Decl(lib.es2017.object.d.ts, --, --), Decl(lib.es2017.object.d.ts, --, --)) +>o : Symbol(o, Decl(useObjectValuesAndEntries1.ts, 1, 3)) + +var entries1 = Object.entries(1); // <-- entries: [string, any][] +>entries1 : Symbol(entries1, Decl(useObjectValuesAndEntries1.ts, 8, 3)) +>Object.entries : Symbol(ObjectConstructor.entries, Decl(lib.es2017.object.d.ts, --, --), Decl(lib.es2017.object.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>entries : Symbol(ObjectConstructor.entries, Decl(lib.es2017.object.d.ts, --, --), Decl(lib.es2017.object.d.ts, --, --)) + diff --git a/tests/baselines/reference/useObjectValuesAndEntries1.types b/tests/baselines/reference/useObjectValuesAndEntries1.types new file mode 100644 index 00000000000..27a0abb81eb --- /dev/null +++ b/tests/baselines/reference/useObjectValuesAndEntries1.types @@ -0,0 +1,39 @@ +=== tests/cases/conformance/es2017/useObjectValuesAndEntries1.ts === + +var o = { a: 1, b: 2 }; +>o : { a: number; b: number; } +>{ a: 1, b: 2 } : { a: number; b: number; } +>a : number +>1 : number +>b : number +>2 : number + +for (var x of Object.values(o)) { +>x : number +>Object.values(o) : number[] +>Object.values : { (o: { [s: string]: T; }): T[]; (o: any): any[]; } +>Object : ObjectConstructor +>values : { (o: { [s: string]: T; }): T[]; (o: any): any[]; } +>o : { a: number; b: number; } + + let y = x; +>y : number +>x : number +} + +var entries = Object.entries(o); +>entries : [string, number][] +>Object.entries(o) : [string, number][] +>Object.entries : { (o: { [s: string]: T; }): [string, T][]; (o: any): [string, any][]; } +>Object : ObjectConstructor +>entries : { (o: { [s: string]: T; }): [string, T][]; (o: any): [string, any][]; } +>o : { a: number; b: number; } + +var entries1 = Object.entries(1); // <-- entries: [string, any][] +>entries1 : [string, any][] +>Object.entries(1) : [string, any][] +>Object.entries : { (o: { [s: string]: T; }): [string, T][]; (o: any): [string, any][]; } +>Object : ObjectConstructor +>entries : { (o: { [s: string]: T; }): [string, T][]; (o: any): [string, any][]; } +>1 : number + diff --git a/tests/baselines/reference/useObjectValuesAndEntries2.errors.txt b/tests/baselines/reference/useObjectValuesAndEntries2.errors.txt new file mode 100644 index 00000000000..74119083a5f --- /dev/null +++ b/tests/baselines/reference/useObjectValuesAndEntries2.errors.txt @@ -0,0 +1,17 @@ +tests/cases/conformance/es2017/useObjectValuesAndEntries2.ts(4,22): error TS2339: Property 'values' does not exist on type 'ObjectConstructor'. +tests/cases/conformance/es2017/useObjectValuesAndEntries2.ts(8,22): error TS2339: Property 'entries' does not exist on type 'ObjectConstructor'. + + +==== tests/cases/conformance/es2017/useObjectValuesAndEntries2.ts (2 errors) ==== + + var o = { a: 1, b: 2 }; + + for (var x of Object.values(o)) { + ~~~~~~ +!!! error TS2339: Property 'values' does not exist on type 'ObjectConstructor'. + let y = x; + } + + var entries = Object.entries(o); + ~~~~~~~ +!!! error TS2339: Property 'entries' does not exist on type 'ObjectConstructor'. \ No newline at end of file diff --git a/tests/baselines/reference/useObjectValuesAndEntries2.js b/tests/baselines/reference/useObjectValuesAndEntries2.js new file mode 100644 index 00000000000..31918566844 --- /dev/null +++ b/tests/baselines/reference/useObjectValuesAndEntries2.js @@ -0,0 +1,17 @@ +//// [useObjectValuesAndEntries2.ts] + +var o = { a: 1, b: 2 }; + +for (var x of Object.values(o)) { + let y = x; +} + +var entries = Object.entries(o); + +//// [useObjectValuesAndEntries2.js] +var o = { a: 1, b: 2 }; +for (var _i = 0, _a = Object.values(o); _i < _a.length; _i++) { + var x = _a[_i]; + var y = x; +} +var entries = Object.entries(o); diff --git a/tests/baselines/reference/useObjectValuesAndEntries3.errors.txt b/tests/baselines/reference/useObjectValuesAndEntries3.errors.txt new file mode 100644 index 00000000000..2b2c38bd9fe --- /dev/null +++ b/tests/baselines/reference/useObjectValuesAndEntries3.errors.txt @@ -0,0 +1,17 @@ +tests/cases/conformance/es2017/useObjectValuesAndEntries3.ts(4,22): error TS2339: Property 'values' does not exist on type 'ObjectConstructor'. +tests/cases/conformance/es2017/useObjectValuesAndEntries3.ts(8,22): error TS2339: Property 'entries' does not exist on type 'ObjectConstructor'. + + +==== tests/cases/conformance/es2017/useObjectValuesAndEntries3.ts (2 errors) ==== + + var o = { a: 1, b: 2 }; + + for (var x of Object.values(o)) { + ~~~~~~ +!!! error TS2339: Property 'values' does not exist on type 'ObjectConstructor'. + let y = x; + } + + var entries = Object.entries(o); + ~~~~~~~ +!!! error TS2339: Property 'entries' does not exist on type 'ObjectConstructor'. \ No newline at end of file diff --git a/tests/baselines/reference/useObjectValuesAndEntries3.js b/tests/baselines/reference/useObjectValuesAndEntries3.js new file mode 100644 index 00000000000..9d3d4368cc7 --- /dev/null +++ b/tests/baselines/reference/useObjectValuesAndEntries3.js @@ -0,0 +1,16 @@ +//// [useObjectValuesAndEntries3.ts] + +var o = { a: 1, b: 2 }; + +for (var x of Object.values(o)) { + let y = x; +} + +var entries = Object.entries(o); + +//// [useObjectValuesAndEntries3.js] +var o = { a: 1, b: 2 }; +for (var x of Object.values(o)) { + let y = x; +} +var entries = Object.entries(o); diff --git a/tests/baselines/reference/useObjectValuesAndEntries4.js b/tests/baselines/reference/useObjectValuesAndEntries4.js new file mode 100644 index 00000000000..7eb24e7aa71 --- /dev/null +++ b/tests/baselines/reference/useObjectValuesAndEntries4.js @@ -0,0 +1,16 @@ +//// [useObjectValuesAndEntries4.ts] + +var o = { a: 1, b: 2 }; + +for (var x of Object.values(o)) { + let y = x; +} + +var entries = Object.entries(o); + +//// [useObjectValuesAndEntries4.js] +var o = { a: 1, b: 2 }; +for (var x of Object.values(o)) { + let y = x; +} +var entries = Object.entries(o); diff --git a/tests/baselines/reference/useObjectValuesAndEntries4.symbols b/tests/baselines/reference/useObjectValuesAndEntries4.symbols new file mode 100644 index 00000000000..5edf23790cd --- /dev/null +++ b/tests/baselines/reference/useObjectValuesAndEntries4.symbols @@ -0,0 +1,26 @@ +=== tests/cases/conformance/es2017/useObjectValuesAndEntries4.ts === + +var o = { a: 1, b: 2 }; +>o : Symbol(o, Decl(useObjectValuesAndEntries4.ts, 1, 3)) +>a : Symbol(a, Decl(useObjectValuesAndEntries4.ts, 1, 9)) +>b : Symbol(b, Decl(useObjectValuesAndEntries4.ts, 1, 15)) + +for (var x of Object.values(o)) { +>x : Symbol(x, Decl(useObjectValuesAndEntries4.ts, 3, 8)) +>Object.values : Symbol(ObjectConstructor.values, Decl(lib.es2017.object.d.ts, --, --), Decl(lib.es2017.object.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>values : Symbol(ObjectConstructor.values, Decl(lib.es2017.object.d.ts, --, --), Decl(lib.es2017.object.d.ts, --, --)) +>o : Symbol(o, Decl(useObjectValuesAndEntries4.ts, 1, 3)) + + let y = x; +>y : Symbol(y, Decl(useObjectValuesAndEntries4.ts, 4, 7)) +>x : Symbol(x, Decl(useObjectValuesAndEntries4.ts, 3, 8)) +} + +var entries = Object.entries(o); +>entries : Symbol(entries, Decl(useObjectValuesAndEntries4.ts, 7, 3)) +>Object.entries : Symbol(ObjectConstructor.entries, Decl(lib.es2017.object.d.ts, --, --), Decl(lib.es2017.object.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>entries : Symbol(ObjectConstructor.entries, Decl(lib.es2017.object.d.ts, --, --), Decl(lib.es2017.object.d.ts, --, --)) +>o : Symbol(o, Decl(useObjectValuesAndEntries4.ts, 1, 3)) + diff --git a/tests/baselines/reference/useObjectValuesAndEntries4.types b/tests/baselines/reference/useObjectValuesAndEntries4.types new file mode 100644 index 00000000000..8defd2bf758 --- /dev/null +++ b/tests/baselines/reference/useObjectValuesAndEntries4.types @@ -0,0 +1,31 @@ +=== tests/cases/conformance/es2017/useObjectValuesAndEntries4.ts === + +var o = { a: 1, b: 2 }; +>o : { a: number; b: number; } +>{ a: 1, b: 2 } : { a: number; b: number; } +>a : number +>1 : number +>b : number +>2 : number + +for (var x of Object.values(o)) { +>x : number +>Object.values(o) : number[] +>Object.values : { (o: { [s: string]: T; }): T[]; (o: any): any[]; } +>Object : ObjectConstructor +>values : { (o: { [s: string]: T; }): T[]; (o: any): any[]; } +>o : { a: number; b: number; } + + let y = x; +>y : number +>x : number +} + +var entries = Object.entries(o); +>entries : [string, number][] +>Object.entries(o) : [string, number][] +>Object.entries : { (o: { [s: string]: T; }): [string, T][]; (o: any): [string, any][]; } +>Object : ObjectConstructor +>entries : { (o: { [s: string]: T; }): [string, T][]; (o: any): [string, any][]; } +>o : { a: number; b: number; } + diff --git a/tests/baselines/reference/useStrictLikePrologueString01.js b/tests/baselines/reference/useStrictLikePrologueString01.js new file mode 100644 index 00000000000..56df03abfe5 --- /dev/null +++ b/tests/baselines/reference/useStrictLikePrologueString01.js @@ -0,0 +1,14 @@ +//// [useStrictLikePrologueString01.ts] + +"hey!" +" use strict " +export function f() { +} + +//// [useStrictLikePrologueString01.js] +"hey!"; +" use strict "; +"use strict"; +function f() { +} +exports.f = f; diff --git a/tests/baselines/reference/useStrictLikePrologueString01.symbols b/tests/baselines/reference/useStrictLikePrologueString01.symbols new file mode 100644 index 00000000000..e96d48d9933 --- /dev/null +++ b/tests/baselines/reference/useStrictLikePrologueString01.symbols @@ -0,0 +1,7 @@ +=== tests/cases/compiler/useStrictLikePrologueString01.ts === + +"hey!" +" use strict " +export function f() { +>f : Symbol(f, Decl(useStrictLikePrologueString01.ts, 2, 14)) +} diff --git a/tests/baselines/reference/useStrictLikePrologueString01.types b/tests/baselines/reference/useStrictLikePrologueString01.types new file mode 100644 index 00000000000..a12dfe3abd3 --- /dev/null +++ b/tests/baselines/reference/useStrictLikePrologueString01.types @@ -0,0 +1,11 @@ +=== tests/cases/compiler/useStrictLikePrologueString01.ts === + +"hey!" +>"hey!" : string + +" use strict " +>" use strict " : string + +export function f() { +>f : () => void +} diff --git a/tests/baselines/reference/usingModuleWithExportImportInValuePosition.symbols b/tests/baselines/reference/usingModuleWithExportImportInValuePosition.symbols index a918e3ddec7..fc049a84260 100644 --- a/tests/baselines/reference/usingModuleWithExportImportInValuePosition.symbols +++ b/tests/baselines/reference/usingModuleWithExportImportInValuePosition.symbols @@ -9,8 +9,8 @@ export class Point { >Point : Symbol(Point, Decl(usingModuleWithExportImportInValuePosition.ts, 1, 28)) constructor(public x: number, public y: number) { } ->x : Symbol(x, Decl(usingModuleWithExportImportInValuePosition.ts, 3, 20)) ->y : Symbol(y, Decl(usingModuleWithExportImportInValuePosition.ts, 3, 37)) +>x : Symbol(Point.x, Decl(usingModuleWithExportImportInValuePosition.ts, 3, 20)) +>y : Symbol(Point.y, Decl(usingModuleWithExportImportInValuePosition.ts, 3, 37)) } export module B { >B : Symbol(B, Decl(usingModuleWithExportImportInValuePosition.ts, 4, 5)) @@ -19,7 +19,7 @@ export class Point { >Id : Symbol(Id, Decl(usingModuleWithExportImportInValuePosition.ts, 5, 21)) name: string; ->name : Symbol(name, Decl(usingModuleWithExportImportInValuePosition.ts, 6, 29)) +>name : Symbol(Id.name, Decl(usingModuleWithExportImportInValuePosition.ts, 6, 29)) } } } diff --git a/tests/baselines/reference/validNullAssignments.errors.txt b/tests/baselines/reference/validNullAssignments.errors.txt index 042a7172b52..057d6ce4791 100644 --- a/tests/baselines/reference/validNullAssignments.errors.txt +++ b/tests/baselines/reference/validNullAssignments.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/types/primitives/null/validNullAssignments.ts(10,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/types/primitives/null/validNullAssignments.ts(10,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. tests/cases/conformance/types/primitives/null/validNullAssignments.ts(15,1): error TS2364: Invalid left-hand side of assignment expression. tests/cases/conformance/types/primitives/null/validNullAssignments.ts(20,1): error TS2304: Cannot find name 'I'. tests/cases/conformance/types/primitives/null/validNullAssignments.ts(23,1): error TS2364: Invalid left-hand side of assignment expression. @@ -17,7 +17,7 @@ tests/cases/conformance/types/primitives/null/validNullAssignments.ts(30,1): err enum E { A } E.A = null; // error ~~~ -!!! error TS2364: Invalid left-hand side of assignment expression. +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. class C { foo: string } var f: C; diff --git a/tests/baselines/reference/validStringAssignments.symbols b/tests/baselines/reference/validStringAssignments.symbols index bb24a6c1574..cb949fd076e 100644 --- a/tests/baselines/reference/validStringAssignments.symbols +++ b/tests/baselines/reference/validStringAssignments.symbols @@ -17,6 +17,6 @@ var c: string = x; var d: String = x; >d : Symbol(d, Decl(validStringAssignments.ts, 5, 3)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(validStringAssignments.ts, 0, 3)) diff --git a/tests/baselines/reference/validUndefinedAssignments.symbols b/tests/baselines/reference/validUndefinedAssignments.symbols index 791834eefde..802bf55fee6 100644 --- a/tests/baselines/reference/validUndefinedAssignments.symbols +++ b/tests/baselines/reference/validUndefinedAssignments.symbols @@ -30,7 +30,7 @@ e = x; // should work class C { foo: string } >C : Symbol(C, Decl(validUndefinedAssignments.ts, 8, 6)) ->foo : Symbol(foo, Decl(validUndefinedAssignments.ts, 10, 9)) +>foo : Symbol(C.foo, Decl(validUndefinedAssignments.ts, 10, 9)) var f: C; >f : Symbol(f, Decl(validUndefinedAssignments.ts, 11, 3)) @@ -42,7 +42,7 @@ f = x; interface I { foo: string } >I : Symbol(I, Decl(validUndefinedAssignments.ts, 12, 6)) ->foo : Symbol(foo, Decl(validUndefinedAssignments.ts, 14, 13)) +>foo : Symbol(I.foo, Decl(validUndefinedAssignments.ts, 14, 13)) var g: I; >g : Symbol(g, Decl(validUndefinedAssignments.ts, 15, 3)) diff --git a/tests/baselines/reference/validUseOfThisInSuper.symbols b/tests/baselines/reference/validUseOfThisInSuper.symbols index 2e71c859a4f..650eec44dde 100644 --- a/tests/baselines/reference/validUseOfThisInSuper.symbols +++ b/tests/baselines/reference/validUseOfThisInSuper.symbols @@ -3,7 +3,7 @@ class Base { >Base : Symbol(Base, Decl(validUseOfThisInSuper.ts, 0, 0)) constructor(public b: Base) { ->b : Symbol(b, Decl(validUseOfThisInSuper.ts, 1, 16)) +>b : Symbol(Base.b, Decl(validUseOfThisInSuper.ts, 1, 16)) >Base : Symbol(Base, Decl(validUseOfThisInSuper.ts, 0, 0)) } } diff --git a/tests/baselines/reference/varArgsOnConstructorTypes.symbols b/tests/baselines/reference/varArgsOnConstructorTypes.symbols index 2b391612356..e810955f443 100644 --- a/tests/baselines/reference/varArgsOnConstructorTypes.symbols +++ b/tests/baselines/reference/varArgsOnConstructorTypes.symbols @@ -11,10 +11,10 @@ export class B extends A { >A : Symbol(A, Decl(varArgsOnConstructorTypes.ts, 0, 0)) private p1: number; ->p1 : Symbol(p1, Decl(varArgsOnConstructorTypes.ts, 4, 26)) +>p1 : Symbol(B.p1, Decl(varArgsOnConstructorTypes.ts, 4, 26)) private p2: string; ->p2 : Symbol(p2, Decl(varArgsOnConstructorTypes.ts, 5, 23)) +>p2 : Symbol(B.p2, Decl(varArgsOnConstructorTypes.ts, 5, 23)) constructor(element: any, url: string) { >element : Symbol(element, Decl(varArgsOnConstructorTypes.ts, 8, 16)) @@ -25,15 +25,15 @@ export class B extends A { >element : Symbol(element, Decl(varArgsOnConstructorTypes.ts, 8, 16)) this.p1 = element; ->this.p1 : Symbol(p1, Decl(varArgsOnConstructorTypes.ts, 4, 26)) +>this.p1 : Symbol(B.p1, Decl(varArgsOnConstructorTypes.ts, 4, 26)) >this : Symbol(B, Decl(varArgsOnConstructorTypes.ts, 2, 1)) ->p1 : Symbol(p1, Decl(varArgsOnConstructorTypes.ts, 4, 26)) +>p1 : Symbol(B.p1, Decl(varArgsOnConstructorTypes.ts, 4, 26)) >element : Symbol(element, Decl(varArgsOnConstructorTypes.ts, 8, 16)) this.p2 = url; ->this.p2 : Symbol(p2, Decl(varArgsOnConstructorTypes.ts, 5, 23)) +>this.p2 : Symbol(B.p2, Decl(varArgsOnConstructorTypes.ts, 5, 23)) >this : Symbol(B, Decl(varArgsOnConstructorTypes.ts, 2, 1)) ->p2 : Symbol(p2, Decl(varArgsOnConstructorTypes.ts, 5, 23)) +>p2 : Symbol(B.p2, Decl(varArgsOnConstructorTypes.ts, 5, 23)) >url : Symbol(url, Decl(varArgsOnConstructorTypes.ts, 8, 29)) } } @@ -42,13 +42,13 @@ export interface I1 { >I1 : Symbol(I1, Decl(varArgsOnConstructorTypes.ts, 13, 1)) register(inputClass: new(...params: any[]) => A); ->register : Symbol(register, Decl(varArgsOnConstructorTypes.ts, 15, 21), Decl(varArgsOnConstructorTypes.ts, 16, 53)) +>register : Symbol(I1.register, Decl(varArgsOnConstructorTypes.ts, 15, 21), Decl(varArgsOnConstructorTypes.ts, 16, 53)) >inputClass : Symbol(inputClass, Decl(varArgsOnConstructorTypes.ts, 16, 13)) >params : Symbol(params, Decl(varArgsOnConstructorTypes.ts, 16, 29)) >A : Symbol(A, Decl(varArgsOnConstructorTypes.ts, 0, 0)) register(inputClass: { new (...params: any[]): A; }[]); ->register : Symbol(register, Decl(varArgsOnConstructorTypes.ts, 15, 21), Decl(varArgsOnConstructorTypes.ts, 16, 53)) +>register : Symbol(I1.register, Decl(varArgsOnConstructorTypes.ts, 15, 21), Decl(varArgsOnConstructorTypes.ts, 16, 53)) >inputClass : Symbol(inputClass, Decl(varArgsOnConstructorTypes.ts, 17, 13)) >params : Symbol(params, Decl(varArgsOnConstructorTypes.ts, 17, 32)) >A : Symbol(A, Decl(varArgsOnConstructorTypes.ts, 0, 0)) diff --git a/tests/baselines/reference/varAsID.symbols b/tests/baselines/reference/varAsID.symbols index accc605e347..6206fa5901c 100644 --- a/tests/baselines/reference/varAsID.symbols +++ b/tests/baselines/reference/varAsID.symbols @@ -4,10 +4,10 @@ class Foo { >Foo : Symbol(Foo, Decl(varAsID.ts, 0, 0)) var; // ok ->var : Symbol(var, Decl(varAsID.ts, 1, 11)) +>var : Symbol(Foo.var, Decl(varAsID.ts, 1, 11)) x=1; ->x : Symbol(x, Decl(varAsID.ts, 2, 8)) +>x : Symbol(Foo.x, Decl(varAsID.ts, 2, 8)) } var f = new Foo(); @@ -19,10 +19,10 @@ class Foo2 { >Foo2 : Symbol(Foo2, Decl(varAsID.ts, 6, 18)) var // not an error, because of ASI. ->var : Symbol(var, Decl(varAsID.ts, 9, 12)) +>var : Symbol(Foo2.var, Decl(varAsID.ts, 9, 12)) x=1; ->x : Symbol(x, Decl(varAsID.ts, 10, 7)) +>x : Symbol(Foo2.x, Decl(varAsID.ts, 10, 7)) } var f2 = new Foo2(); diff --git a/tests/baselines/reference/vardecl.symbols b/tests/baselines/reference/vardecl.symbols index 0860fc19500..98e6f1b5330 100644 --- a/tests/baselines/reference/vardecl.symbols +++ b/tests/baselines/reference/vardecl.symbols @@ -150,7 +150,7 @@ module m2 { >C : Symbol(C, Decl(vardecl.ts, 65, 11)) constructor (public b) { ->b : Symbol(b, Decl(vardecl.ts, 68, 21)) +>b : Symbol(C.b, Decl(vardecl.ts, 68, 21)) } } @@ -158,7 +158,7 @@ module m2 { >C2 : Symbol(C2, Decl(vardecl.ts, 70, 5)) constructor (public b) { ->b : Symbol(b, Decl(vardecl.ts, 73, 21)) +>b : Symbol(C2.b, Decl(vardecl.ts, 73, 21)) } } var m; diff --git a/tests/baselines/reference/variableDeclarationInStrictMode1.errors.txt b/tests/baselines/reference/variableDeclarationInStrictMode1.errors.txt index 328e080fbaa..9dd9a8d41a1 100644 --- a/tests/baselines/reference/variableDeclarationInStrictMode1.errors.txt +++ b/tests/baselines/reference/variableDeclarationInStrictMode1.errors.txt @@ -1,4 +1,4 @@ -lib.d.ts(29,18): error TS2300: Duplicate identifier 'eval'. +lib.d.ts(28,18): error TS2300: Duplicate identifier 'eval'. tests/cases/compiler/variableDeclarationInStrictMode1.ts(2,5): error TS1100: Invalid use of 'eval' in strict mode. tests/cases/compiler/variableDeclarationInStrictMode1.ts(2,5): error TS2300: Duplicate identifier 'eval'. diff --git a/tests/baselines/reference/visibilityOfCrossModuleTypeUsage.symbols b/tests/baselines/reference/visibilityOfCrossModuleTypeUsage.symbols index d1132151097..6b685cd13a4 100644 --- a/tests/baselines/reference/visibilityOfCrossModuleTypeUsage.symbols +++ b/tests/baselines/reference/visibilityOfCrossModuleTypeUsage.symbols @@ -32,12 +32,12 @@ export interface IConfiguration { >IConfiguration : Symbol(IConfiguration, Decl(visibilityOfCrossModuleTypeUsage_commands.ts, 3, 69)) workspace: server.IWorkspace; ->workspace : Symbol(workspace, Decl(visibilityOfCrossModuleTypeUsage_commands.ts, 5, 33)) +>workspace : Symbol(IConfiguration.workspace, Decl(visibilityOfCrossModuleTypeUsage_commands.ts, 5, 33)) >server : Symbol(server, Decl(visibilityOfCrossModuleTypeUsage_commands.ts, 2, 61)) >IWorkspace : Symbol(server.IWorkspace, Decl(visibilityOfCrossModuleTypeUsage_server.ts, 1, 1)) server?: server.IServer; ->server : Symbol(server, Decl(visibilityOfCrossModuleTypeUsage_commands.ts, 6, 33)) +>server : Symbol(IConfiguration.server, Decl(visibilityOfCrossModuleTypeUsage_commands.ts, 6, 33)) >server : Symbol(server, Decl(visibilityOfCrossModuleTypeUsage_commands.ts, 2, 61)) >IServer : Symbol(server.IServer, Decl(visibilityOfCrossModuleTypeUsage_server.ts, 0, 0)) } @@ -51,7 +51,7 @@ export interface IWorkspace { >IWorkspace : Symbol(IWorkspace, Decl(visibilityOfCrossModuleTypeUsage_server.ts, 1, 1)) toAbsolutePath(server: IServer, workspaceRelativePath?: string): string; ->toAbsolutePath : Symbol(toAbsolutePath, Decl(visibilityOfCrossModuleTypeUsage_server.ts, 3, 29)) +>toAbsolutePath : Symbol(IWorkspace.toAbsolutePath, Decl(visibilityOfCrossModuleTypeUsage_server.ts, 3, 29)) >server : Symbol(server, Decl(visibilityOfCrossModuleTypeUsage_server.ts, 4, 19)) >IServer : Symbol(IServer, Decl(visibilityOfCrossModuleTypeUsage_server.ts, 0, 0)) >workspaceRelativePath : Symbol(workspaceRelativePath, Decl(visibilityOfCrossModuleTypeUsage_server.ts, 4, 35)) diff --git a/tests/baselines/reference/visibilityOfTypeParameters.symbols b/tests/baselines/reference/visibilityOfTypeParameters.symbols index 1380822e9b2..1f80a77e2b3 100644 --- a/tests/baselines/reference/visibilityOfTypeParameters.symbols +++ b/tests/baselines/reference/visibilityOfTypeParameters.symbols @@ -4,7 +4,7 @@ export class MyClass { >MyClass : Symbol(MyClass, Decl(visibilityOfTypeParameters.ts, 0, 0)) protected myMethod(val: T): T { ->myMethod : Symbol(myMethod, Decl(visibilityOfTypeParameters.ts, 1, 22)) +>myMethod : Symbol(MyClass.myMethod, Decl(visibilityOfTypeParameters.ts, 1, 22)) >T : Symbol(T, Decl(visibilityOfTypeParameters.ts, 2, 23)) >val : Symbol(val, Decl(visibilityOfTypeParameters.ts, 2, 26)) >T : Symbol(T, Decl(visibilityOfTypeParameters.ts, 2, 23)) diff --git a/tests/baselines/reference/voidOperatorWithBooleanType.symbols b/tests/baselines/reference/voidOperatorWithBooleanType.symbols index 1d044a6d9c6..b8132c2a993 100644 --- a/tests/baselines/reference/voidOperatorWithBooleanType.symbols +++ b/tests/baselines/reference/voidOperatorWithBooleanType.symbols @@ -10,7 +10,7 @@ class A { >A : Symbol(A, Decl(voidOperatorWithBooleanType.ts, 3, 40)) public a: boolean; ->a : Symbol(a, Decl(voidOperatorWithBooleanType.ts, 5, 9)) +>a : Symbol(A.a, Decl(voidOperatorWithBooleanType.ts, 5, 9)) static foo() { return false; } >foo : Symbol(A.foo, Decl(voidOperatorWithBooleanType.ts, 6, 22)) diff --git a/tests/baselines/reference/voidOperatorWithNumberType.symbols b/tests/baselines/reference/voidOperatorWithNumberType.symbols index 43f10478499..ae8371a6bab 100644 --- a/tests/baselines/reference/voidOperatorWithNumberType.symbols +++ b/tests/baselines/reference/voidOperatorWithNumberType.symbols @@ -13,7 +13,7 @@ class A { >A : Symbol(A, Decl(voidOperatorWithNumberType.ts, 4, 36)) public a: number; ->a : Symbol(a, Decl(voidOperatorWithNumberType.ts, 6, 9)) +>a : Symbol(A.a, Decl(voidOperatorWithNumberType.ts, 6, 9)) static foo() { return 1; } >foo : Symbol(A.foo, Decl(voidOperatorWithNumberType.ts, 7, 21)) diff --git a/tests/baselines/reference/voidOperatorWithStringType.symbols b/tests/baselines/reference/voidOperatorWithStringType.symbols index 64fb0e600e8..448b5f79c00 100644 --- a/tests/baselines/reference/voidOperatorWithStringType.symbols +++ b/tests/baselines/reference/voidOperatorWithStringType.symbols @@ -13,7 +13,7 @@ class A { >A : Symbol(A, Decl(voidOperatorWithStringType.ts, 4, 40)) public a: string; ->a : Symbol(a, Decl(voidOperatorWithStringType.ts, 6, 9)) +>a : Symbol(A.a, Decl(voidOperatorWithStringType.ts, 6, 9)) static foo() { return ""; } >foo : Symbol(A.foo, Decl(voidOperatorWithStringType.ts, 7, 21)) diff --git a/tests/baselines/reference/widenedTypes.errors.txt b/tests/baselines/reference/widenedTypes.errors.txt index 2277ef6eea7..beda634c2a6 100644 --- a/tests/baselines/reference/widenedTypes.errors.txt +++ b/tests/baselines/reference/widenedTypes.errors.txt @@ -6,8 +6,8 @@ tests/cases/compiler/widenedTypes.ts(11,1): error TS2322: Type 'string' is not a tests/cases/compiler/widenedTypes.ts(18,1): error TS2322: Type 'string' is not assignable to type 'number'. tests/cases/compiler/widenedTypes.ts(23,5): error TS2322: Type 'number[]' is not assignable to type 'string[]'. Type 'number' is not assignable to type 'string'. -tests/cases/compiler/widenedTypes.ts(24,5): error TS2322: Type '{ [x: string]: number; x: number; y: null; }' is not assignable to type '{ [x: string]: string; }'. - Index signatures are incompatible. +tests/cases/compiler/widenedTypes.ts(24,5): error TS2322: Type '{ x: number; y: null; }' is not assignable to type '{ [x: string]: string; }'. + Property 'x' is incompatible with index signature. Type 'number' is not assignable to type 'string'. @@ -52,6 +52,6 @@ tests/cases/compiler/widenedTypes.ts(24,5): error TS2322: Type '{ [x: string]: n !!! error TS2322: Type 'number' is not assignable to type 'string'. var obj: { [x: string]: string; } = { x: 3, y: null }; // assignable because null is widened, and therefore BCT is any ~~~ -!!! error TS2322: Type '{ [x: string]: number; x: number; y: null; }' is not assignable to type '{ [x: string]: string; }'. -!!! error TS2322: Index signatures are incompatible. +!!! error TS2322: Type '{ x: number; y: null; }' is not assignable to type '{ [x: string]: string; }'. +!!! error TS2322: Property 'x' is incompatible with index signature. !!! error TS2322: Type 'number' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/wideningTuples5.errors.txt b/tests/baselines/reference/wideningTuples5.errors.txt index bfd72079f55..cd6bf6161c9 100644 --- a/tests/baselines/reference/wideningTuples5.errors.txt +++ b/tests/baselines/reference/wideningTuples5.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/types/tuple/wideningTuples5.ts(1,6): error TS7005: Variable 'a' implicitly has an 'any' type. -tests/cases/conformance/types/tuple/wideningTuples5.ts(1,9): error TS7005: Variable 'b' implicitly has an 'any' type. +tests/cases/conformance/types/tuple/wideningTuples5.ts(1,6): error TS7031: Binding element 'a' implicitly has an 'any' type. +tests/cases/conformance/types/tuple/wideningTuples5.ts(1,9): error TS7031: Binding element 'b' implicitly has an 'any' type. ==== tests/cases/conformance/types/tuple/wideningTuples5.ts (2 errors) ==== var [a, b] = [undefined, null]; ~ -!!! error TS7005: Variable 'a' implicitly has an 'any' type. +!!! error TS7031: Binding element 'a' implicitly has an 'any' type. ~ -!!! error TS7005: Variable 'b' implicitly has an 'any' type. \ No newline at end of file +!!! error TS7031: Binding element 'b' implicitly has an 'any' type. \ No newline at end of file diff --git a/tests/baselines/reference/withImportDecl.symbols b/tests/baselines/reference/withImportDecl.symbols index ae41e927cfa..4ba677d8878 100644 --- a/tests/baselines/reference/withImportDecl.symbols +++ b/tests/baselines/reference/withImportDecl.symbols @@ -80,5 +80,5 @@ b.foo; === tests/cases/compiler/withImportDecl_0.ts === export class A { foo: string; } >A : Symbol(A, Decl(withImportDecl_0.ts, 0, 0)) ->foo : Symbol(foo, Decl(withImportDecl_0.ts, 0, 16)) +>foo : Symbol(A.foo, Decl(withImportDecl_0.ts, 0, 16)) diff --git a/tests/baselines/reference/wrappedAndRecursiveConstraints.symbols b/tests/baselines/reference/wrappedAndRecursiveConstraints.symbols index b0128b37797..4f56145951d 100644 --- a/tests/baselines/reference/wrappedAndRecursiveConstraints.symbols +++ b/tests/baselines/reference/wrappedAndRecursiveConstraints.symbols @@ -4,14 +4,14 @@ class C { >C : Symbol(C, Decl(wrappedAndRecursiveConstraints.ts, 0, 0)) >T : Symbol(T, Decl(wrappedAndRecursiveConstraints.ts, 2, 8)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) constructor(public data: T) { } ->data : Symbol(data, Decl(wrappedAndRecursiveConstraints.ts, 3, 16)) +>data : Symbol(C.data, Decl(wrappedAndRecursiveConstraints.ts, 3, 16)) >T : Symbol(T, Decl(wrappedAndRecursiveConstraints.ts, 2, 8)) foo(x: U) { ->foo : Symbol(foo, Decl(wrappedAndRecursiveConstraints.ts, 3, 35)) +>foo : Symbol(C.foo, Decl(wrappedAndRecursiveConstraints.ts, 3, 35)) >U : Symbol(U, Decl(wrappedAndRecursiveConstraints.ts, 4, 8)) >T : Symbol(T, Decl(wrappedAndRecursiveConstraints.ts, 2, 8)) >x : Symbol(x, Decl(wrappedAndRecursiveConstraints.ts, 4, 21)) @@ -24,10 +24,10 @@ class C { interface Foo extends Date { >Foo : Symbol(Foo, Decl(wrappedAndRecursiveConstraints.ts, 7, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) foo: string; ->foo : Symbol(foo, Decl(wrappedAndRecursiveConstraints.ts, 9, 28)) +>foo : Symbol(Foo.foo, Decl(wrappedAndRecursiveConstraints.ts, 9, 28)) } var y: Foo = null; diff --git a/tests/baselines/reference/wrappedAndRecursiveConstraints3.symbols b/tests/baselines/reference/wrappedAndRecursiveConstraints3.symbols index 06279a5c264..db796c6eca0 100644 --- a/tests/baselines/reference/wrappedAndRecursiveConstraints3.symbols +++ b/tests/baselines/reference/wrappedAndRecursiveConstraints3.symbols @@ -11,7 +11,7 @@ class C { >T : Symbol(T, Decl(wrappedAndRecursiveConstraints3.ts, 2, 8)) foo(x: U) { ->foo : Symbol(foo, Decl(wrappedAndRecursiveConstraints3.ts, 3, 25)) +>foo : Symbol(C.foo, Decl(wrappedAndRecursiveConstraints3.ts, 3, 25)) >U : Symbol(U, Decl(wrappedAndRecursiveConstraints3.ts, 4, 8)) >T : Symbol(T, Decl(wrappedAndRecursiveConstraints3.ts, 2, 8)) >x : Symbol(x, Decl(wrappedAndRecursiveConstraints3.ts, 4, 21)) diff --git a/tests/baselines/reference/wrappedAndRecursiveConstraints4.errors.txt b/tests/baselines/reference/wrappedAndRecursiveConstraints4.errors.txt index 60602351b46..47e8e6ff4f2 100644 --- a/tests/baselines/reference/wrappedAndRecursiveConstraints4.errors.txt +++ b/tests/baselines/reference/wrappedAndRecursiveConstraints4.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/types/typeParameters/typeArgumentLists/wrappedAndRecursiveConstraints4.ts(13,12): error TS2345: Argument of type '{ [x: number]: undefined; length: number; charAt: (x: number) => void; }' is not assignable to parameter of type 'string'. +tests/cases/conformance/types/typeParameters/typeArgumentLists/wrappedAndRecursiveConstraints4.ts(13,12): error TS2345: Argument of type '{ length: number; charAt: (x: number) => void; }' is not assignable to parameter of type 'string'. ==== tests/cases/conformance/types/typeParameters/typeArgumentLists/wrappedAndRecursiveConstraints4.ts (1 errors) ==== @@ -16,4 +16,4 @@ tests/cases/conformance/types/typeParameters/typeArgumentLists/wrappedAndRecursi var r = c.foo(''); var r2 = r({ length: 3, charAt: (x: number) => { '' } }); // error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '{ [x: number]: undefined; length: number; charAt: (x: number) => void; }' is not assignable to parameter of type 'string'. \ No newline at end of file +!!! error TS2345: Argument of type '{ length: number; charAt: (x: number) => void; }' is not assignable to parameter of type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/wrappedRecursiveGenericType.errors.txt b/tests/baselines/reference/wrappedRecursiveGenericType.errors.txt index 5afc7361a23..da97e05713b 100644 --- a/tests/baselines/reference/wrappedRecursiveGenericType.errors.txt +++ b/tests/baselines/reference/wrappedRecursiveGenericType.errors.txt @@ -1,5 +1,4 @@ tests/cases/compiler/wrappedRecursiveGenericType.ts(13,1): error TS2322: Type 'number' is not assignable to type 'X'. - Property 'e' is missing in type 'Number'. tests/cases/compiler/wrappedRecursiveGenericType.ts(14,1): error TS2322: Type 'number' is not assignable to type 'X'. @@ -19,7 +18,6 @@ tests/cases/compiler/wrappedRecursiveGenericType.ts(14,1): error TS2322: Type 'n x.a.b.val = 5; // val -> X (This should be an error) ~~~~~~~~~ !!! error TS2322: Type 'number' is not assignable to type 'X'. -!!! error TS2322: Property 'e' is missing in type 'Number'. x.a.b.a.val = 5; // val -> X (This should be an error) ~~~~~~~~~~~ !!! error TS2322: Type 'number' is not assignable to type 'X'. \ No newline at end of file diff --git a/tests/cases/compiler/APISample_compile.ts b/tests/cases/compiler/APISample_compile.ts index c63009f7d63..b60c53685aa 100644 --- a/tests/cases/compiler/APISample_compile.ts +++ b/tests/cases/compiler/APISample_compile.ts @@ -1,6 +1,7 @@ // @module: commonjs // @includebuiltfile: typescript_standalone.d.ts -// @stripInternal:true +// @noImplicitAny:true +// @strictNullChecks:true /* * Note: This test is a public API sample. The sample sources can be found @@ -18,7 +19,7 @@ export function compile(fileNames: string[], options: ts.CompilerOptions): void var program = ts.createProgram(fileNames, options); var emitResult = program.emit(); - var allDiagnostics = ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics); + var allDiagnostics = ts.getPreEmitDiagnostics(program); allDiagnostics.forEach(diagnostic => { var { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start); diff --git a/tests/cases/compiler/APISample_linter.ts b/tests/cases/compiler/APISample_linter.ts index 8cb6934cee3..89f0be7a0f5 100644 --- a/tests/cases/compiler/APISample_linter.ts +++ b/tests/cases/compiler/APISample_linter.ts @@ -1,6 +1,7 @@ // @module: commonjs // @includebuiltfile: typescript_standalone.d.ts -// @stripInternal:true +// @noImplicitAny:true +// @strictNullChecks:true /* * Note: This test is a public API sample. The sample sources can be found @@ -57,7 +58,7 @@ export function delint(sourceFile: ts.SourceFile) { } } -const fileNames = process.argv.slice(2); +const fileNames: string[] = process.argv.slice(2); fileNames.forEach(fileName => { // Parse a file let sourceFile = ts.createSourceFile(fileName, readFileSync(fileName).toString(), ts.ScriptTarget.ES6, /*setParentNodes */ true); diff --git a/tests/cases/compiler/APISample_parseConfig.ts b/tests/cases/compiler/APISample_parseConfig.ts new file mode 100644 index 00000000000..f59f64dc4ad --- /dev/null +++ b/tests/cases/compiler/APISample_parseConfig.ts @@ -0,0 +1,40 @@ +// @module: commonjs +// @includebuiltfile: typescript_standalone.d.ts +// @noImplicitAny:true +// @strictNullChecks:true + +/* + * Note: This test is a public API sample. The sample sources can be found + at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#a-minimal-compiler + * Please log a "breaking change" issue for any API breaking change affecting this issue + */ + +declare var process: any; +declare var console: any; +declare var os: any; + +import ts = require("typescript"); + +function printError(error: ts.Diagnostic): void { + if (!error) { + return; + } + console.log(`${error.file && error.file.fileName}: ${error.messageText}`); +} + +export function createProgram(rootFiles: string[], compilerOptionsJson: string): ts.Program | undefined { + const { config, error } = ts.parseConfigFileTextToJson("tsconfig.json", compilerOptionsJson) + if (error) { + printError(error); + return undefined; + } + const basePath: string = process.cwd(); + const settings = ts.convertCompilerOptionsFromJson(config.config["compilerOptions"], basePath); + if (!settings.options) { + for (const err of settings.errors) { + printError(err); + } + return undefined; + } + return ts.createProgram(rootFiles, settings.options); +} \ No newline at end of file diff --git a/tests/cases/compiler/APISample_transform.ts b/tests/cases/compiler/APISample_transform.ts index 88b9754536a..a76d6b15463 100644 --- a/tests/cases/compiler/APISample_transform.ts +++ b/tests/cases/compiler/APISample_transform.ts @@ -1,6 +1,7 @@ // @module: commonjs // @includebuiltfile: typescript_standalone.d.ts -// @stripInternal:true +// @noImplicitAny:true +// @strictNullChecks:true /* * Note: This test is a public API sample. The sample sources can be found diff --git a/tests/cases/compiler/APISample_watcher.ts b/tests/cases/compiler/APISample_watcher.ts index 9afa53ddf14..34baa04c850 100644 --- a/tests/cases/compiler/APISample_watcher.ts +++ b/tests/cases/compiler/APISample_watcher.ts @@ -1,6 +1,7 @@ // @module: commonjs // @includebuiltfile: typescript_standalone.d.ts -// @stripInternal:true +// @noImplicitAny:true +// @strictNullChecks:true /* * Note: This test is a public API sample. The sample sources can be found @@ -10,7 +11,13 @@ declare var process: any; declare var console: any; -declare var fs: any; +declare var fs: { + existsSync(path: string): boolean; + readdirSync(path: string): string[]; + readFileSync(filename: string, encoding?: string): string; + writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void; + watchFile(filename: string, options: { persistent?: boolean; interval?: number; }, listener: (curr: { mtime: Date }, prev: { mtime: Date }) => void): void; +}; declare var path: any; import * as ts from "typescript"; diff --git a/tests/cases/compiler/abstractProperty.ts b/tests/cases/compiler/abstractProperty.ts new file mode 100644 index 00000000000..c0b76057a6b --- /dev/null +++ b/tests/cases/compiler/abstractProperty.ts @@ -0,0 +1,22 @@ +//@target: ES5 +interface A { + prop: string; + raw: string; + m(): void; +} +abstract class B implements A { + abstract prop: string; + abstract raw: string; + abstract readonly ro: string; + abstract get readonlyProp(): string; + abstract set readonlyProp(val: string); + abstract m(): void; +} +class C extends B { + get prop() { return "foo"; } + set prop(v) { } + raw = "edge"; + readonly ro = "readonly please"; + readonlyProp: string; // don't have to give a value, in fact + m() { } +} \ No newline at end of file diff --git a/tests/cases/compiler/abstractPropertyNegative.ts b/tests/cases/compiler/abstractPropertyNegative.ts new file mode 100644 index 00000000000..16c09b10573 --- /dev/null +++ b/tests/cases/compiler/abstractPropertyNegative.ts @@ -0,0 +1,43 @@ +//@target: ES5 +interface A { + prop: string; + m(): string; +} +abstract class B implements A { + abstract prop: string; + public abstract readonly ro: string; + abstract get readonlyProp(): string; + abstract m(): string; + abstract get mismatch(): string; + abstract set mismatch(val: number); // error, not same type +} +class C extends B { + readonly ro = "readonly please"; + abstract notAllowed: string; + get concreteWithNoBody(): string; +} +let c = new C(); +c.ro = "error: lhs of assignment can't be readonly"; + +abstract class WrongTypeProperty { + abstract num: number; +} +class WrongTypePropertyImpl extends WrongTypeProperty { + num = "nope, wrong"; +} +abstract class WrongTypeAccessor { + abstract get num(): number; +} +class WrongTypeAccessorImpl extends WrongTypeAccessor { + get num() { return "nope, wrong"; } +} +class WrongTypeAccessorImpl2 extends WrongTypeAccessor { + num = "nope, wrong"; +} + +abstract class AbstractAccessorMismatch { + abstract get p1(): string; + set p1(val: string) { }; + get p2(): string { return "should work"; } + abstract set p2(val: string); +} diff --git a/tests/cases/compiler/accessInstanceMemberFromStaticMethod01.ts b/tests/cases/compiler/accessInstanceMemberFromStaticMethod01.ts new file mode 100644 index 00000000000..cdca697f13f --- /dev/null +++ b/tests/cases/compiler/accessInstanceMemberFromStaticMethod01.ts @@ -0,0 +1,7 @@ +class C { + static foo: string; + + bar() { + let k = foo; + } +} \ No newline at end of file diff --git a/tests/cases/compiler/accessStaticMemberFromInstanceMethod01.ts b/tests/cases/compiler/accessStaticMemberFromInstanceMethod01.ts new file mode 100644 index 00000000000..654ae39aacd --- /dev/null +++ b/tests/cases/compiler/accessStaticMemberFromInstanceMethod01.ts @@ -0,0 +1,7 @@ +class C { + foo: string; + + static bar() { + let k = foo; + } +} \ No newline at end of file diff --git a/tests/cases/compiler/ambientNameRestrictions.ts b/tests/cases/compiler/ambientNameRestrictions.ts new file mode 100644 index 00000000000..dc601e91851 --- /dev/null +++ b/tests/cases/compiler/ambientNameRestrictions.ts @@ -0,0 +1,3 @@ +export declare namespace Foo { + export var static: any; +} diff --git a/tests/cases/compiler/arrayFilter.ts b/tests/cases/compiler/arrayFilter.ts new file mode 100644 index 00000000000..d13dc0dc9fa --- /dev/null +++ b/tests/cases/compiler/arrayFilter.ts @@ -0,0 +1,7 @@ +var foo = [ + { name: 'bar' }, + { name: null }, + { name: 'baz' } +] + +foo.filter(x => x.name); //should accepted all possible types not only boolean! \ No newline at end of file diff --git a/tests/cases/compiler/arrowFunctionErrorSpan.ts b/tests/cases/compiler/arrowFunctionErrorSpan.ts new file mode 100644 index 00000000000..4c7fff88a93 --- /dev/null +++ b/tests/cases/compiler/arrowFunctionErrorSpan.ts @@ -0,0 +1,53 @@ +function f(a: () => number) { } + +// oneliner +f(() => { }); + +// multiline, body +f(() => { + +}); + +// multiline 2, body +f(() => { + +}); + +// multiline 3, arrow on a new line +f(() + => { }); + +// multiline 4, arguments +f((a, + b, + c, + d) => { }); + +// single line with a comment +f(/* + */() => { }); + +// multi line with a comment +f(/* + */() => { }); + +// multi line with a comment 2 +f(/* + */() => { + + }); + +// multi line with a comment 3 +f( // comment 1 + // comment 2 + () => + // comment 3 + { + // comment 4 + } + // comment 5 +); + +// body is not a block +f(_ => 1 + + 2); diff --git a/tests/cases/compiler/asyncFunctionsAcrossFiles.ts b/tests/cases/compiler/asyncFunctionsAcrossFiles.ts new file mode 100644 index 00000000000..c5f6a220fd8 --- /dev/null +++ b/tests/cases/compiler/asyncFunctionsAcrossFiles.ts @@ -0,0 +1,15 @@ +// @target: es6 +// @filename: a.ts +import { b } from './b'; +export const a = { + f: async () => { + await b.f(); + } +}; +// @filename: b.ts +import { a } from './a'; +export const b = { + f: async () => { + await a.f(); + } +}; \ No newline at end of file diff --git a/tests/cases/compiler/asyncFunctionsAndStrictNullChecks.ts b/tests/cases/compiler/asyncFunctionsAndStrictNullChecks.ts new file mode 100644 index 00000000000..9b7185f8853 --- /dev/null +++ b/tests/cases/compiler/asyncFunctionsAndStrictNullChecks.ts @@ -0,0 +1,27 @@ +// @target: es6 +// @strictNullChecks: true + +declare namespace Windows.Foundation { + interface IPromise { + then(success?: (value: TResult) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; + then(success?: (value: TResult) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; + then(success?: (value: TResult) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; + then(success?: (value: TResult) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; + done(success?: (value: TResult) => any, error?: (error: any) => any, progress?: (progress: any) => void): void; + + cancel(): void; + } +} + +async function sample(promise: Windows.Foundation.IPromise) { + var number = await promise; +} + + +declare function resolve1(value: T): Promise; +declare function resolve2(value: T): Windows.Foundation.IPromise; + +async function sample2(x?: number) { + let x1 = await resolve1(x); + let x2 = await resolve2(x); +} diff --git a/tests/cases/compiler/augmentExportEquals1.ts b/tests/cases/compiler/augmentExportEquals1.ts new file mode 100644 index 00000000000..4479fd063b9 --- /dev/null +++ b/tests/cases/compiler/augmentExportEquals1.ts @@ -0,0 +1,19 @@ +// @module: amd +// @filename: file1.ts +var x = 1; +export = x; + +// @filename: file2.ts + +import x = require("./file1"); + +// augmentation for './file1' +// should error since './file1' does not have namespace meaning +declare module "./file1" { + interface A { a } +} + +// @filename: file3.ts +import x = require("./file1"); +import "./file2"; +let a: x.A; // should not work \ No newline at end of file diff --git a/tests/cases/compiler/augmentExportEquals1_1.ts b/tests/cases/compiler/augmentExportEquals1_1.ts new file mode 100644 index 00000000000..6afc6e70910 --- /dev/null +++ b/tests/cases/compiler/augmentExportEquals1_1.ts @@ -0,0 +1,22 @@ +// @module: amd + +// @filename: file1.d.ts +declare module "file1" { + var x: number; + export = x; +} + +// @filename: file2.ts +/// +import x = require("file1"); + +// augmentation for 'file1' +// should error since 'file1' does not have namespace meaning +declare module "file1" { + interface A { a } +} + +// @filename: file3.ts +import x = require("file1"); +import "file2"; +let a: x.A; // should not work \ No newline at end of file diff --git a/tests/cases/compiler/augmentExportEquals2.ts b/tests/cases/compiler/augmentExportEquals2.ts new file mode 100644 index 00000000000..1d4c1fae35c --- /dev/null +++ b/tests/cases/compiler/augmentExportEquals2.ts @@ -0,0 +1,19 @@ +// @module: amd + +// @filename: file1.ts +function foo() {} +export = foo; + +// @filename: file2.ts +import x = require("./file1"); + +// should error since './file1' does not have namespace meaning +declare module "./file1" { + interface A { a } +} + +// @filename: file3.ts +// @filename: file3.ts +import x = require("./file1"); +import "./file2"; +let a: x.A; // should not work \ No newline at end of file diff --git a/tests/cases/compiler/augmentExportEquals2_1.ts b/tests/cases/compiler/augmentExportEquals2_1.ts new file mode 100644 index 00000000000..b6aeb21efd0 --- /dev/null +++ b/tests/cases/compiler/augmentExportEquals2_1.ts @@ -0,0 +1,22 @@ +// @module: amd + +// @filename: file1.d.ts +declare module "file1" { + function foo(): void; + export = foo; +} + +// @filename: file2.ts + +/// +import x = require("file1"); + +// should error since './file1' does not have namespace meaning +declare module "file1" { + interface A { a } +} + +// @filename: file3.ts +import x = require("file1"); +import "file2"; +let a: x.A; // should not work \ No newline at end of file diff --git a/tests/cases/compiler/augmentExportEquals3.ts b/tests/cases/compiler/augmentExportEquals3.ts new file mode 100644 index 00000000000..81a0e1d5448 --- /dev/null +++ b/tests/cases/compiler/augmentExportEquals3.ts @@ -0,0 +1,24 @@ +// @module: amd + +// @filename: file1.ts +function foo() {} +namespace foo { + export var v = 1; +} +export = foo; + +// @filename: file2.ts +import x = require("./file1"); +x.b = 1; + +// OK - './file1' is a namespace +declare module "./file1" { + interface A { a } + let b: number; +} + +// @filename: file3.ts +import * as x from "./file1"; +import "./file2"; +let a: x.A; +let b = x.b; \ No newline at end of file diff --git a/tests/cases/compiler/augmentExportEquals3_1.ts b/tests/cases/compiler/augmentExportEquals3_1.ts new file mode 100644 index 00000000000..ad329643fa5 --- /dev/null +++ b/tests/cases/compiler/augmentExportEquals3_1.ts @@ -0,0 +1,27 @@ +// @module: amd +// @filename: file1.d.ts +declare module "file1" { + function foo(): void; + namespace foo { + export var v: number; + } + export = foo; +} + + +// @filename: file2.ts +/// +import x = require("file1"); +x.b = 1; + +// OK - './file1' is a namespace +declare module "file1" { + interface A { a } + let b: number; +} + +// @filename: file3.ts +import * as x from "file1"; +import "file2"; +let a: x.A; +let b = x.b; \ No newline at end of file diff --git a/tests/cases/compiler/augmentExportEquals4.ts b/tests/cases/compiler/augmentExportEquals4.ts new file mode 100644 index 00000000000..85294682f5c --- /dev/null +++ b/tests/cases/compiler/augmentExportEquals4.ts @@ -0,0 +1,24 @@ +// @module: amd + +// @filename: file1.ts +class foo {} +namespace foo { + export var v = 1; +} +export = foo; + +// @filename: file2.ts +import x = require("./file1"); +x.b = 1; + +// OK - './file1' is a namespace +declare module "./file1" { + interface A { a } + let b: number; +} + +// @filename: file3.ts +import * as x from "./file1"; +import "./file2"; +let a: x.A; +let b = x.b; \ No newline at end of file diff --git a/tests/cases/compiler/augmentExportEquals4_1.ts b/tests/cases/compiler/augmentExportEquals4_1.ts new file mode 100644 index 00000000000..467d0af38ef --- /dev/null +++ b/tests/cases/compiler/augmentExportEquals4_1.ts @@ -0,0 +1,28 @@ +// @module: amd + +// @filename: file1.d.ts +declare module "file1" { + class foo {} + namespace foo { + export var v: number; + } + export = foo; +} + + +// @filename: file2.ts +/// +import x = require("file1"); +x.b = 1; + +// OK - './file1' is a namespace +declare module "file1" { + interface A { a } + let b: number; +} + +// @filename: file3.ts +import * as x from "file1"; +import "file2"; +let a: x.A; +let b = x.b; \ No newline at end of file diff --git a/tests/cases/compiler/augmentExportEquals5.ts b/tests/cases/compiler/augmentExportEquals5.ts new file mode 100644 index 00000000000..3250a40f131 --- /dev/null +++ b/tests/cases/compiler/augmentExportEquals5.ts @@ -0,0 +1,82 @@ +// @module: amd + +// @filename: express.d.ts + +declare module Express { + export interface Request { } + export interface Response { } + export interface Application { } +} + +declare module "express" { + function e(): e.Express; + namespace e { + interface IRoute { + all(...handler: RequestHandler[]): IRoute; + } + + interface IRouterMatcher { + (name: string|RegExp, ...handlers: RequestHandler[]): T; + } + + interface IRouter extends RequestHandler { + route(path: string): IRoute; + } + + export function Router(options?: any): Router; + + export interface Router extends IRouter {} + + interface Errback { (err: Error): void; } + + interface Request extends Express.Request { + + get (name: string): string; + } + + interface Response extends Express.Response { + charset: string; + } + + interface ErrorRequestHandler { + (err: any, req: Request, res: Response, next: Function): any; + } + + interface RequestHandler { + (req: Request, res: Response, next: Function): any; + } + + interface Handler extends RequestHandler {} + + interface RequestParamHandler { + (req: Request, res: Response, next: Function, param: any): any; + } + + interface Application extends IRouter, Express.Application { + routes: any; + } + + interface Express extends Application { + createApplication(): Application; + } + + var static: any; + } + + export = e; +} + +// @filename: augmentation.ts +/// +import * as e from "express"; +declare module "express" { + interface Request { + id: number; + } +} + +// @filename: consumer.ts +import { Request } from "express"; +import "./augmentation"; +let x: Request; +const y = x.id; \ No newline at end of file diff --git a/tests/cases/compiler/augmentExportEquals6.ts b/tests/cases/compiler/augmentExportEquals6.ts new file mode 100644 index 00000000000..a0dd50c53f0 --- /dev/null +++ b/tests/cases/compiler/augmentExportEquals6.ts @@ -0,0 +1,28 @@ +// @module: amd + +// @filename: file1.ts +class foo {} +namespace foo { + export class A {} + export namespace B { export let a; } +} +export = foo; + +// @filename: file2.ts +import x = require("./file1"); +x.B.b = 1; + +// OK - './file1' is a namespace +declare module "./file1" { + interface A { a: number } + namespace B { + export let b: number; + } +} + +// @filename: file3.ts +import * as x from "./file1"; +import "./file2"; +let a: x.A; +let b = a.a; +let c = x.B.b; \ No newline at end of file diff --git a/tests/cases/compiler/augmentExportEquals6_1.ts b/tests/cases/compiler/augmentExportEquals6_1.ts new file mode 100644 index 00000000000..aaee43bae74 --- /dev/null +++ b/tests/cases/compiler/augmentExportEquals6_1.ts @@ -0,0 +1,26 @@ +// @module: amd + +// @filename: file1.d.ts +declare module "file1" { + class foo {} + namespace foo { + class A {} + } + export = foo; +} + + +// @filename: file2.ts +/// +import x = require("file1"); + +// OK - './file1' is a namespace +declare module "file1" { + interface A { a: number } +} + +// @filename: file3.ts +import * as x from "file1"; +import "file2"; +let a: x.A; +let b = a.a; \ No newline at end of file diff --git a/tests/cases/compiler/blockScopedBindingUsedBeforeDef.ts b/tests/cases/compiler/blockScopedBindingUsedBeforeDef.ts new file mode 100644 index 00000000000..c0b803df6e8 --- /dev/null +++ b/tests/cases/compiler/blockScopedBindingUsedBeforeDef.ts @@ -0,0 +1,8 @@ +// 1: +for (let {[a]: a} of [{ }]) continue; + +// 2: +for (let {[a]: a} = { }; false; ) continue; + +// 3: +let {[b]: b} = { }; \ No newline at end of file diff --git a/tests/cases/compiler/blockScopedBindingsReassignedInLoop1.ts b/tests/cases/compiler/blockScopedBindingsReassignedInLoop1.ts new file mode 100644 index 00000000000..e052702bce2 --- /dev/null +++ b/tests/cases/compiler/blockScopedBindingsReassignedInLoop1.ts @@ -0,0 +1,7 @@ +declare function use(n: number): void; +(function () { + 'use strict' + for (let i = 0; i < 9; ++i) { + (() => use(++i))(); + } +})(); \ No newline at end of file diff --git a/tests/cases/compiler/blockScopedBindingsReassignedInLoop2.ts b/tests/cases/compiler/blockScopedBindingsReassignedInLoop2.ts new file mode 100644 index 00000000000..84d9f8d214b --- /dev/null +++ b/tests/cases/compiler/blockScopedBindingsReassignedInLoop2.ts @@ -0,0 +1,41 @@ +for (let x = 1, y = 2; x < y; ++x, --y) { + let a = () => x++ + y++; + if (x == 1) { + break; + } + else { + y = 5; + } +} + +for (let x = 1, y = 2; x < y; ++x, --y) { + let a = () => x++ + y++; + if (x == 1) { + continue; + } + else { + y = 5; + } +} + +loop: +for (let x = 1, y = 2; x < y; ++x, --y) { + let a = () => x++ + y++; + if (x == 1) { + break loop; + } + else { + y = 5; + } +} + +loop: +for (let x = 1, y = 2; x < y; ++x, --y) { + let a = () => x++ + y++; + if (x == 1) { + continue loop; + } + else { + y = 5; + } +} \ No newline at end of file diff --git a/tests/cases/compiler/blockScopedBindingsReassignedInLoop3.ts b/tests/cases/compiler/blockScopedBindingsReassignedInLoop3.ts new file mode 100644 index 00000000000..a68c708193a --- /dev/null +++ b/tests/cases/compiler/blockScopedBindingsReassignedInLoop3.ts @@ -0,0 +1,91 @@ + +for (let x = 1, y = 2; x < y; ++x, --y) { + let a = () => x++ + y++; + if (x == 1) { + break; + } + else { + for (let a = 1; a < 5; --a) { + let f = () => a; + if (a) { + a = x; + break; + } + else { + y++; + } + } + + y = 5; + } +} + + +for (let x = 1, y = 2; x < y; ++x, --y) { + let a = () => x++ + y++; + if (x == 1) { + continue; + } + else { + for (let a = 1; a < 5; --a) { + let f = () => a; + if (a) { + a = x; + continue; + } + else { + y++; + } + } + + y = 5; + } +} + +loop2: +for (let x = 1, y = 2; x < y; ++x, --y) { + let a = () => x++ + y++; + if (x == 1) { + break loop2; + } + else { + loop1: + for (let a = 1; a < 5; --a) { + let f = () => a; + if (a) { + a = x; + break loop1; + } + else { + y++; + break loop2 + } + } + + y = 5; + } +} + +loop2: +for (let x = 1, y = 2; x < y; ++x, --y) { + let a = () => x++ + y++; + if (x == 1) { + continue loop2; + } + else { + loop1: + for (let a = 1; a < 5; --a) { + let f = () => a; + if (a) { + a = x; + continue loop1; + } + else { + y++; + continue loop2 + } + } + + y = 5; + } +} diff --git a/tests/cases/compiler/blockScopedBindingsReassignedInLoop4.ts b/tests/cases/compiler/blockScopedBindingsReassignedInLoop4.ts new file mode 100644 index 00000000000..82f4bcc5dd0 --- /dev/null +++ b/tests/cases/compiler/blockScopedBindingsReassignedInLoop4.ts @@ -0,0 +1,11 @@ +function f1() { + for (let x = 1, y = 2; x < y; ++x, --y) { + let a = () => x++ + y++; + if (x == 1) { + return 1; + } + else { + y = 5; + } + } +} \ No newline at end of file diff --git a/tests/cases/compiler/blockScopedBindingsReassignedInLoop5.ts b/tests/cases/compiler/blockScopedBindingsReassignedInLoop5.ts new file mode 100644 index 00000000000..c6c577ea9fb --- /dev/null +++ b/tests/cases/compiler/blockScopedBindingsReassignedInLoop5.ts @@ -0,0 +1,7 @@ +for (let x = 1, y = 2; x < y; ++x, --y) { + let a = () => x++ + y++; + if (x == 1) + break; + else + y = 5; +} diff --git a/tests/cases/compiler/blockScopedBindingsReassignedInLoop6.ts b/tests/cases/compiler/blockScopedBindingsReassignedInLoop6.ts new file mode 100644 index 00000000000..e735bb61ac8 --- /dev/null +++ b/tests/cases/compiler/blockScopedBindingsReassignedInLoop6.ts @@ -0,0 +1,28 @@ +function f1() { + for (let [x, y] = [1, 2]; x < y; ++x, --y) { + let a = () => x++ + y++; + if (x == 1) + break; + else if (y == 2) + y = 5; + else + return; + } +} + +function f2() { + for (let [{a: x, b: {c: y}}] = [{a: 1, b: {c: 2}}]; x < y; ++x, --y) { + let a = () => x++ + y++; + if (x == 1) + break; + else if (y == 2) + y = 5; + else + return; + } +} + + + + + diff --git a/tests/cases/compiler/blockScopedFunctionDeclarationES5.ts b/tests/cases/compiler/blockScopedFunctionDeclarationES5.ts new file mode 100644 index 00000000000..dbb725361a0 --- /dev/null +++ b/tests/cases/compiler/blockScopedFunctionDeclarationES5.ts @@ -0,0 +1,6 @@ +// @target: ES5 +if (true) { + function foo() { } + foo(); +} +foo(); \ No newline at end of file diff --git a/tests/cases/compiler/blockScopedFunctionDeclarationES6.ts b/tests/cases/compiler/blockScopedFunctionDeclarationES6.ts new file mode 100644 index 00000000000..fd0e678b806 --- /dev/null +++ b/tests/cases/compiler/blockScopedFunctionDeclarationES6.ts @@ -0,0 +1,6 @@ +// @target: ES6 +if (true) { + function foo() { } + foo(); +} +foo(); \ No newline at end of file diff --git a/tests/cases/compiler/blockScopedFunctionDeclarationInStrictClass.ts b/tests/cases/compiler/blockScopedFunctionDeclarationInStrictClass.ts new file mode 100644 index 00000000000..48d83e6ad87 --- /dev/null +++ b/tests/cases/compiler/blockScopedFunctionDeclarationInStrictClass.ts @@ -0,0 +1,10 @@ +// @target: ES5 +class c { + method() { + if (true) { + function foo() { } + foo(); // ok + } + foo(); // not ok + } +} \ No newline at end of file diff --git a/tests/cases/compiler/blockScopedFunctionDeclarationInStrictModule.ts b/tests/cases/compiler/blockScopedFunctionDeclarationInStrictModule.ts new file mode 100644 index 00000000000..48c68770620 --- /dev/null +++ b/tests/cases/compiler/blockScopedFunctionDeclarationInStrictModule.ts @@ -0,0 +1,8 @@ +// @target: ES5 +// @module: amd +if (true) { + function foo() { } + foo(); // ok +} + +export = foo; // not ok \ No newline at end of file diff --git a/tests/cases/compiler/blockScopedFunctionDeclarationStrictES5.ts b/tests/cases/compiler/blockScopedFunctionDeclarationStrictES5.ts new file mode 100644 index 00000000000..c5035e1130c --- /dev/null +++ b/tests/cases/compiler/blockScopedFunctionDeclarationStrictES5.ts @@ -0,0 +1,7 @@ +// @target: ES5 +"use strict"; +if (true) { + function foo() { } // Error to declare function in block scope + foo(); // This call should be ok +} +foo(); // Error to find name foo \ No newline at end of file diff --git a/tests/cases/compiler/blockScopedFunctionDeclarationStrictES6.ts b/tests/cases/compiler/blockScopedFunctionDeclarationStrictES6.ts new file mode 100644 index 00000000000..043890add06 --- /dev/null +++ b/tests/cases/compiler/blockScopedFunctionDeclarationStrictES6.ts @@ -0,0 +1,7 @@ +// @target: ES6 +"use strict"; +if (true) { + function foo() { } // Allowed to declare block scope function + foo(); // This call should be ok +} +foo(); // Cannot find name since foo is block scoped \ No newline at end of file diff --git a/tests/cases/compiler/blockScopedSameNameFunctionDeclarationES5.ts b/tests/cases/compiler/blockScopedSameNameFunctionDeclarationES5.ts new file mode 100644 index 00000000000..a5e10d19af2 --- /dev/null +++ b/tests/cases/compiler/blockScopedSameNameFunctionDeclarationES5.ts @@ -0,0 +1,17 @@ +// @target: ES5 +function foo(a: number) { + if (a === 1) { + function foo() { } // duplicate function + foo(); + foo(10); // not ok + } + else { + function foo() { } // duplicate function + foo(); + foo(10); // not ok + } + foo(10); // not ok + foo(); +} +foo(10); +foo(); // not ok - needs number \ No newline at end of file diff --git a/tests/cases/compiler/blockScopedSameNameFunctionDeclarationES6.ts b/tests/cases/compiler/blockScopedSameNameFunctionDeclarationES6.ts new file mode 100644 index 00000000000..c97e50964e7 --- /dev/null +++ b/tests/cases/compiler/blockScopedSameNameFunctionDeclarationES6.ts @@ -0,0 +1,17 @@ +// @target: ES6 +function foo(a: number) { + if (a === 10) { + function foo() { } // duplicate + foo(); + foo(10); // not ok + } + else { + function foo() { } // duplicate + foo(); + foo(10);// not ok + } + foo(10); // not ok + foo(); +} +foo(10); +foo(); // not ok - needs number \ No newline at end of file diff --git a/tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES5.ts b/tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES5.ts new file mode 100644 index 00000000000..a0073c75d43 --- /dev/null +++ b/tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES5.ts @@ -0,0 +1,18 @@ +// @target: ES5 +"use strict"; +function foo(a: number) { + if (a === 1) { + function foo() { } // Error to declare function in block scope + foo(); + foo(10); // not ok + } + else { + function foo() { } // Error to declare function in block scope + foo(); + foo(10); // not ok + } + foo(10); + foo(); // not ok - needs number +} +foo(10); +foo(); // not ok - needs number \ No newline at end of file diff --git a/tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES6.ts b/tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES6.ts new file mode 100644 index 00000000000..34d73a05201 --- /dev/null +++ b/tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES6.ts @@ -0,0 +1,18 @@ +// @target: ES6 +"use strict"; +function foo(a: number) { + if (a === 10) { + function foo() { } + foo(); + foo(10); // not ok + } + else { + function foo() { } + foo(); + foo(10); // not ok + } + foo(10); + foo(); // not ok +} +foo(10); +foo(); // not ok - needs number \ No newline at end of file diff --git a/tests/cases/compiler/bluebirdStaticThis.ts b/tests/cases/compiler/bluebirdStaticThis.ts new file mode 100644 index 00000000000..55b1d0022d8 --- /dev/null +++ b/tests/cases/compiler/bluebirdStaticThis.ts @@ -0,0 +1,141 @@ +// This version is reduced from the full d.ts by removing almost all the tests +// and all the comments. +// Then it adds explicit `this` arguments to the static members. +// Tests by: Bart van der Schoor +declare class Promise implements Promise.Thenable { + constructor(callback: (resolve: (thenableOrResult: R | Promise.Thenable) => void, reject: (error: any) => void) => void); + static try(dit: typeof Promise, fn: () => Promise.Thenable, args?: any[], ctx?: any): Promise; + static try(dit: typeof Promise, fn: () => R, args?: any[], ctx?: any): Promise; + + static attempt(dit: typeof Promise, fn: () => Promise.Thenable, args?: any[], ctx?: any): Promise; + static attempt(dit: typeof Promise, fn: () => R, args?: any[], ctx?: any): Promise; + + static method(dit: typeof Promise, fn: Function): Function; + + static resolve(dit: typeof Promise): Promise; + static resolve(dit: typeof Promise, value: Promise.Thenable): Promise; + static resolve(dit: typeof Promise, value: R): Promise; + + static reject(dit: typeof Promise, reason: any): Promise; + static reject(dit: typeof Promise, reason: any): Promise; + + static defer(dit: typeof Promise): Promise.Resolver; + + static cast(dit: typeof Promise, value: Promise.Thenable): Promise; + static cast(dit: typeof Promise, value: R): Promise; + + static bind(dit: typeof Promise, thisArg: any): Promise; + + static is(dit: typeof Promise, value: any): boolean; + + static longStackTraces(dit: typeof Promise): void; + + static delay(dit: typeof Promise, value: Promise.Thenable, ms: number): Promise; + static delay(dit: typeof Promise, value: R, ms: number): Promise; + static delay(dit: typeof Promise, ms: number): Promise; + + static promisify(dit: typeof Promise, nodeFunction: Function, receiver?: any): Function; + + static promisifyAll(dit: typeof Promise, target: Object): Object; + + static coroutine(dit: typeof Promise, generatorFunction: Function): Function; + + static spawn(dit: typeof Promise, generatorFunction: Function): Promise; + + static noConflict(dit: typeof Promise): typeof Promise; + + static onPossiblyUnhandledRejection(dit: typeof Promise, handler: (reason: any) => any): void; + + static all(dit: typeof Promise, values: Promise.Thenable[]>): Promise; + static all(dit: typeof Promise, values: Promise.Thenable): Promise; + static all(dit: typeof Promise, values: Promise.Thenable[]): Promise; + static all(dit: typeof Promise, values: R[]): Promise; + + static props(dit: typeof Promise, object: Promise): Promise; + static props(dit: typeof Promise, object: Object): Promise; + + static settle(dit: typeof Promise, values: Promise.Thenable[]>): Promise[]>; + static settle(dit: typeof Promise, values: Promise.Thenable): Promise[]>; + static settle(dit: typeof Promise, values: Promise.Thenable[]): Promise[]>; + static settle(dit: typeof Promise, values: R[]): Promise[]>; + + static any(dit: typeof Promise, values: Promise.Thenable[]>): Promise; + static any(dit: typeof Promise, values: Promise.Thenable): Promise; + static any(dit: typeof Promise, values: Promise.Thenable[]): Promise; + static any(dit: typeof Promise, values: R[]): Promise; + + static race(dit: typeof Promise, values: Promise.Thenable[]>): Promise; + static race(dit: typeof Promise, values: Promise.Thenable): Promise; + static race(dit: typeof Promise, values: Promise.Thenable[]): Promise; + static race(dit: typeof Promise, values: R[]): Promise; + + static some(dit: typeof Promise, values: Promise.Thenable[]>, count: number): Promise; + static some(dit: typeof Promise, values: Promise.Thenable, count: number): Promise; + static some(dit: typeof Promise, values: Promise.Thenable[], count: number): Promise; + static some(dit: typeof Promise, values: R[], count: number): Promise; + + static join(dit: typeof Promise, ...values: Promise.Thenable[]): Promise; + static join(dit: typeof Promise, ...values: R[]): Promise; + + static map(dit: typeof Promise, values: Promise.Thenable[]>, mapper: (item: R, index: number, arrayLength: number) => Promise.Thenable): Promise; + static map(dit: typeof Promise, values: Promise.Thenable[]>, mapper: (item: R, index: number, arrayLength: number) => U): Promise; + static map(dit: typeof Promise, values: Promise.Thenable, mapper: (item: R, index: number, arrayLength: number) => Promise.Thenable): Promise; + static map(dit: typeof Promise, values: Promise.Thenable, mapper: (item: R, index: number, arrayLength: number) => U): Promise; + static map(dit: typeof Promise, values: Promise.Thenable[], mapper: (item: R, index: number, arrayLength: number) => Promise.Thenable): Promise; + static map(dit: typeof Promise, values: Promise.Thenable[], mapper: (item: R, index: number, arrayLength: number) => U): Promise; + static map(dit: typeof Promise, values: R[], mapper: (item: R, index: number, arrayLength: number) => Promise.Thenable): Promise; + static map(dit: typeof Promise, values: R[], mapper: (item: R, index: number, arrayLength: number) => U): Promise; + + static reduce(dit: typeof Promise, values: Promise.Thenable[]>, reducer: (total: U, current: R, index: number, arrayLength: number) => Promise.Thenable, initialValue?: U): Promise; + static reduce(dit: typeof Promise, values: Promise.Thenable[]>, reducer: (total: U, current: R, index: number, arrayLength: number) => U, initialValue?: U): Promise; + + static reduce(dit: typeof Promise, values: Promise.Thenable, reducer: (total: U, current: R, index: number, arrayLength: number) => Promise.Thenable, initialValue?: U): Promise; + static reduce(dit: typeof Promise, values: Promise.Thenable, reducer: (total: U, current: R, index: number, arrayLength: number) => U, initialValue?: U): Promise; + + static reduce(dit: typeof Promise, values: Promise.Thenable[], reducer: (total: U, current: R, index: number, arrayLength: number) => Promise.Thenable, initialValue?: U): Promise; + static reduce(dit: typeof Promise, values: Promise.Thenable[], reducer: (total: U, current: R, index: number, arrayLength: number) => U, initialValue?: U): Promise; + + static reduce(dit: typeof Promise, values: R[], reducer: (total: U, current: R, index: number, arrayLength: number) => Promise.Thenable, initialValue?: U): Promise; + static reduce(dit: typeof Promise, values: R[], reducer: (total: U, current: R, index: number, arrayLength: number) => U, initialValue?: U): Promise; + + static filter(dit: typeof Promise, values: Promise.Thenable[]>, filterer: (item: R, index: number, arrayLength: number) => Promise.Thenable): Promise; + static filter(dit: typeof Promise, values: Promise.Thenable[]>, filterer: (item: R, index: number, arrayLength: number) => boolean): Promise; + static filter(dit: typeof Promise, values: Promise.Thenable, filterer: (item: R, index: number, arrayLength: number) => Promise.Thenable): Promise; + static filter(dit: typeof Promise, values: Promise.Thenable, filterer: (item: R, index: number, arrayLength: number) => boolean): Promise; + static filter(dit: typeof Promise, values: Promise.Thenable[], filterer: (item: R, index: number, arrayLength: number) => Promise.Thenable): Promise; + static filter(dit: typeof Promise, values: Promise.Thenable[], filterer: (item: R, index: number, arrayLength: number) => boolean): Promise; + static filter(dit: typeof Promise, values: R[], filterer: (item: R, index: number, arrayLength: number) => Promise.Thenable): Promise; + static filter(dit: typeof Promise, values: R[], filterer: (item: R, index: number, arrayLength: number) => boolean): Promise; +} + +declare module Promise { + export interface Thenable { + then(onFulfilled: (value: R) => Thenable, onRejected: (error: any) => Thenable): Thenable; + then(onFulfilled: (value: R) => Thenable, onRejected?: (error: any) => U): Thenable; + then(onFulfilled: (value: R) => U, onRejected: (error: any) => Thenable): Thenable; + then(onFulfilled?: (value: R) => U, onRejected?: (error: any) => U): Thenable; + } + +} + +declare module 'bluebird' { + export = Promise; +} +interface Foo { + a: number; + b: string; +} +var x: any; +var arr: any[]; +var foo: Foo; +var fooProm: Promise; + +fooProm = Promise.try(Promise, () => { + return foo; +}); +fooProm = Promise.try(Promise, () => { + return foo; +}, arr); +fooProm = Promise.try(Promise, () => { + return foo; +}, arr, x); \ No newline at end of file diff --git a/tests/cases/compiler/capturedLetConstInLoop11.ts b/tests/cases/compiler/capturedLetConstInLoop11.ts new file mode 100644 index 00000000000..bda0cec9d69 --- /dev/null +++ b/tests/cases/compiler/capturedLetConstInLoop11.ts @@ -0,0 +1,13 @@ +for (;;) { + let x = 1; + () => x; +} + +function foo() { + for (;;) { + const a = 0; + switch(a) { + case 0: return () => a; + } + } +} \ No newline at end of file diff --git a/tests/cases/compiler/capturedLetConstInLoop11_ES6.ts b/tests/cases/compiler/capturedLetConstInLoop11_ES6.ts new file mode 100644 index 00000000000..24005ed4833 --- /dev/null +++ b/tests/cases/compiler/capturedLetConstInLoop11_ES6.ts @@ -0,0 +1,14 @@ +// @target: ES6 +for (;;) { + let x = 1; + () => x; +} + +function foo() { + for (;;) { + const a = 0; + switch(a) { + case 0: return () => a; + } + } +} \ No newline at end of file diff --git a/tests/cases/compiler/capturedLetConstInLoop12.ts b/tests/cases/compiler/capturedLetConstInLoop12.ts new file mode 100644 index 00000000000..5540f75635e --- /dev/null +++ b/tests/cases/compiler/capturedLetConstInLoop12.ts @@ -0,0 +1,15 @@ +(function() { + "use strict"; + + for (let i = 0; i < 4; i++) { + (() => [i] = [i + 1])(); + } +})(); + +(function() { + "use strict"; + + for (let i = 0; i < 4; i++) { + (() => ({a:i} = {a:i + 1}))(); + } +})(); \ No newline at end of file diff --git a/tests/cases/compiler/capturedLetConstInLoop5.ts b/tests/cases/compiler/capturedLetConstInLoop5.ts index 475137c14cc..5eedd5aac85 100644 --- a/tests/cases/compiler/capturedLetConstInLoop5.ts +++ b/tests/cases/compiler/capturedLetConstInLoop5.ts @@ -19,7 +19,7 @@ function foo00(x) { var v = x; (function() { return x + v }); (() => x + v); - if (x == 1) { + if (x == "1") { return; } } @@ -158,7 +158,7 @@ function foo00_c(x) { var v = x; (function() { return x + v }); (() => x + v); - if (x == 1) { + if (x == "1") { return; } } diff --git a/tests/cases/compiler/capturedLetConstInLoop5_ES6.ts b/tests/cases/compiler/capturedLetConstInLoop5_ES6.ts index 035e21b9e84..224ffa823bf 100644 --- a/tests/cases/compiler/capturedLetConstInLoop5_ES6.ts +++ b/tests/cases/compiler/capturedLetConstInLoop5_ES6.ts @@ -21,7 +21,7 @@ function foo00(x) { var v = x; (function() { return x + v }); (() => x + v); - if (x == 1) { + if (x == "1") { return; } } @@ -160,7 +160,7 @@ function foo00_c(x) { var v = x; (function() { return x + v }); (() => x + v); - if (x == 1) { + if (x == "1") { return; } } diff --git a/tests/cases/compiler/capturedLetConstInLoop6.ts b/tests/cases/compiler/capturedLetConstInLoop6.ts index 321d20e3c20..a854be46195 100644 --- a/tests/cases/compiler/capturedLetConstInLoop6.ts +++ b/tests/cases/compiler/capturedLetConstInLoop6.ts @@ -13,10 +13,10 @@ for (let x of []) { for (let x in []) { (function() { return x}); (() => x); - if (x == 1) { + if (x == "1") { break; } - if (x == 2) { + if (x == "2") { continue; } } @@ -132,10 +132,10 @@ for (const x of []) { for (const x in []) { (function() { return x}); (() => x); - if (x == 1) { + if (x == "1") { break; } - if (x == 2) { + if (x == "2") { continue; } } diff --git a/tests/cases/compiler/capturedLetConstInLoop6_ES6.ts b/tests/cases/compiler/capturedLetConstInLoop6_ES6.ts index f43fe5851d2..ad10f1fcb74 100644 --- a/tests/cases/compiler/capturedLetConstInLoop6_ES6.ts +++ b/tests/cases/compiler/capturedLetConstInLoop6_ES6.ts @@ -14,10 +14,10 @@ for (let x of []) { for (let x in []) { (function() { return x}); (() => x); - if (x == 1) { + if (x == "1") { break; } - if (x == 2) { + if (x == "2") { continue; } } @@ -133,10 +133,10 @@ for (const x of []) { for (const x in []) { (function() { return x}); (() => x); - if (x == 1) { + if (x == "1") { break; } - if (x == 2) { + if (x == "2") { continue; } } diff --git a/tests/cases/compiler/capturedLetConstInLoop7.ts b/tests/cases/compiler/capturedLetConstInLoop7.ts index a1d35c4038b..12805411f96 100644 --- a/tests/cases/compiler/capturedLetConstInLoop7.ts +++ b/tests/cases/compiler/capturedLetConstInLoop7.ts @@ -21,16 +21,16 @@ l00: for (let x in []) { (function() { return x}); (() => x); - if (x == 1) { + if (x == "1") { break; } - if (x == 1) { + if (x == "1") { break l00; } - if (x == 2) { + if (x == "2") { continue; } - if (x == 2) { + if (x == "2") { continue l00; } } @@ -209,16 +209,16 @@ l00_c: for (const x in []) { (function() { return x}); (() => x); - if (x == 1) { + if (x == "1") { break; } - if (x == 1) { + if (x == "1") { break l00_c; } - if (x == 2) { + if (x == "2") { continue; } - if (x == 2) { + if (x == "2") { continue l00_c; } } diff --git a/tests/cases/compiler/capturedLetConstInLoop7_ES6.ts b/tests/cases/compiler/capturedLetConstInLoop7_ES6.ts index 14b1d0c85af..2e2784f9a16 100644 --- a/tests/cases/compiler/capturedLetConstInLoop7_ES6.ts +++ b/tests/cases/compiler/capturedLetConstInLoop7_ES6.ts @@ -22,16 +22,16 @@ l00: for (let x in []) { (function() { return x}); (() => x); - if (x == 1) { + if (x == "1") { break; } - if (x == 1) { + if (x == "1") { break l00; } - if (x == 2) { + if (x == "2") { continue; } - if (x == 2) { + if (x == "2") { continue l00; } } @@ -210,16 +210,16 @@ l00_c: for (const x in []) { (function() { return x}); (() => x); - if (x == 1) { + if (x == "1") { break; } - if (x == 1) { + if (x == "1") { break l00_c; } - if (x == 2) { + if (x == "2") { continue; } - if (x == 2) { + if (x == "2") { continue l00_c; } } diff --git a/tests/cases/compiler/capturedParametersInInitializers1.ts b/tests/cases/compiler/capturedParametersInInitializers1.ts new file mode 100644 index 00000000000..b4150f6b623 --- /dev/null +++ b/tests/cases/compiler/capturedParametersInInitializers1.ts @@ -0,0 +1,15 @@ +// ok - usage is deferred +function foo1(y = class {c = x}, x = 1) { + new y().c; +} + +// ok - used in file +function foo2(y = function(x: typeof z) {}, z = 1) { + +} + +// ok -used in type +let a; +function foo3(y = { x: a }, z = 1) { + +} \ No newline at end of file diff --git a/tests/cases/compiler/capturedParametersInInitializers2.ts b/tests/cases/compiler/capturedParametersInInitializers2.ts new file mode 100644 index 00000000000..718c2db7131 --- /dev/null +++ b/tests/cases/compiler/capturedParametersInInitializers2.ts @@ -0,0 +1,5 @@ +function foo(y = class {static c = x}, x = 1) { + y.c +} +function foo2(y = class {[x] = x}, x = 1) { +} \ No newline at end of file diff --git a/tests/cases/compiler/checkSuperCallBeforeThisAccessing1.ts b/tests/cases/compiler/checkSuperCallBeforeThisAccessing1.ts new file mode 100644 index 00000000000..e8dd78ef546 --- /dev/null +++ b/tests/cases/compiler/checkSuperCallBeforeThisAccessing1.ts @@ -0,0 +1,10 @@ +class Based { } +class Derived extends Based { + public x: number; + constructor() { + super(); + this; + this.x = 10; + var that = this; + } +} \ No newline at end of file diff --git a/tests/cases/compiler/checkSuperCallBeforeThisAccessing2.ts b/tests/cases/compiler/checkSuperCallBeforeThisAccessing2.ts new file mode 100644 index 00000000000..e6545f24288 --- /dev/null +++ b/tests/cases/compiler/checkSuperCallBeforeThisAccessing2.ts @@ -0,0 +1,10 @@ +class Based { } +class Derived extends Based { + public x: number; + constructor() { + this.x = 100; + super(); + this.x = 10; + var that = this; + } +} \ No newline at end of file diff --git a/tests/cases/compiler/checkSuperCallBeforeThisAccessing3.ts b/tests/cases/compiler/checkSuperCallBeforeThisAccessing3.ts new file mode 100644 index 00000000000..fd9de120b05 --- /dev/null +++ b/tests/cases/compiler/checkSuperCallBeforeThisAccessing3.ts @@ -0,0 +1,15 @@ +class Based { } +class Derived extends Based { + public x: number; + constructor() { + class innver { + public y: boolean; + constructor() { + this.y = true; + } + } + super(); + this.x = 10; + var that = this; + } +} \ No newline at end of file diff --git a/tests/cases/compiler/checkSuperCallBeforeThisAccessing4.ts b/tests/cases/compiler/checkSuperCallBeforeThisAccessing4.ts new file mode 100644 index 00000000000..1fdee00c2f8 --- /dev/null +++ b/tests/cases/compiler/checkSuperCallBeforeThisAccessing4.ts @@ -0,0 +1,19 @@ +class Based { } +class Derived extends Based { + public x: number; + constructor() { + (() => { + this; // No error + }); + () => { + this; // No error + }; + (() => { + this; // No error + })(); + super(); + super(); + this.x = 10; + var that = this; + } +} \ No newline at end of file diff --git a/tests/cases/compiler/checkSuperCallBeforeThisAccessing5.ts b/tests/cases/compiler/checkSuperCallBeforeThisAccessing5.ts new file mode 100644 index 00000000000..65d1db6df75 --- /dev/null +++ b/tests/cases/compiler/checkSuperCallBeforeThisAccessing5.ts @@ -0,0 +1,7 @@ +class Based { constructor(...arg) { } } +class Derived extends Based { + public x: number; + constructor() { + super(this.x); + } +} \ No newline at end of file diff --git a/tests/cases/compiler/checkSuperCallBeforeThisAccessing6.ts b/tests/cases/compiler/checkSuperCallBeforeThisAccessing6.ts new file mode 100644 index 00000000000..2cdcb9ad3a8 --- /dev/null +++ b/tests/cases/compiler/checkSuperCallBeforeThisAccessing6.ts @@ -0,0 +1,10 @@ +class Base { + constructor(...arg) { + } +} +class Super extends Base { + constructor() { + (() => this); // No Error + super(); + } +} \ No newline at end of file diff --git a/tests/cases/compiler/checkSuperCallBeforeThisAccessing7.ts b/tests/cases/compiler/checkSuperCallBeforeThisAccessing7.ts new file mode 100644 index 00000000000..1c4af98f0a2 --- /dev/null +++ b/tests/cases/compiler/checkSuperCallBeforeThisAccessing7.ts @@ -0,0 +1,9 @@ +class Base { + constructor(func: ()=>Base) { + } +} +class Super extends Base { + constructor() { + super((() => this)); // No error + } +} \ No newline at end of file diff --git a/tests/cases/compiler/checkSuperCallBeforeThisAccessing8.ts b/tests/cases/compiler/checkSuperCallBeforeThisAccessing8.ts new file mode 100644 index 00000000000..230b40fc24d --- /dev/null +++ b/tests/cases/compiler/checkSuperCallBeforeThisAccessing8.ts @@ -0,0 +1,10 @@ +class Base { + constructor(...arg) { + } +} +class Super extends Base { + constructor() { + var that = this; + super(); + } +} \ No newline at end of file diff --git a/tests/cases/compiler/classExtendsAcrossFiles.ts b/tests/cases/compiler/classExtendsAcrossFiles.ts new file mode 100644 index 00000000000..14e227647e7 --- /dev/null +++ b/tests/cases/compiler/classExtendsAcrossFiles.ts @@ -0,0 +1,20 @@ +// @target: es5 +// @module: commonjs +// @filename: a.ts +import { b } from './b'; +export const a = { + f: () => { + class A { } + class B extends A { } + b.f(); + } +}; +// @filename: b.ts +import { a } from './a'; +export const b = { + f: () => { + class A { } + class B extends A { } + a.f(); + } +}; \ No newline at end of file diff --git a/tests/cases/compiler/commentsAfterFunctionExpression1.ts b/tests/cases/compiler/commentsAfterFunctionExpression1.ts new file mode 100644 index 00000000000..04fb0aec3b1 --- /dev/null +++ b/tests/cases/compiler/commentsAfterFunctionExpression1.ts @@ -0,0 +1,6 @@ +// @removeComments: false +var v = { + f: a => 0 /*t1*/, + g: (a => 0) /*t2*/, + h: (a => 0 /*t3*/) +} diff --git a/tests/cases/compiler/commentsOnObjectLiteral4.ts b/tests/cases/compiler/commentsOnObjectLiteral4.ts index d685304f31e..dfb9e42b3cb 100644 --- a/tests/cases/compiler/commentsOnObjectLiteral4.ts +++ b/tests/cases/compiler/commentsOnObjectLiteral4.ts @@ -6,6 +6,6 @@ var v = { * @type {number} */ get bar(): number { - return this._bar; + return 12; } -} \ No newline at end of file +} diff --git a/tests/cases/compiler/compilerOptionsDeclarationAndNoEmit.ts b/tests/cases/compiler/compilerOptionsDeclarationAndNoEmit.ts new file mode 100644 index 00000000000..41a89011020 --- /dev/null +++ b/tests/cases/compiler/compilerOptionsDeclarationAndNoEmit.ts @@ -0,0 +1,6 @@ +// @declaration: true +// @noEmit: true +// @fileName: a.ts + +class c { +} diff --git a/tests/cases/compiler/compilerOptionsOutAndNoEmit.ts b/tests/cases/compiler/compilerOptionsOutAndNoEmit.ts new file mode 100644 index 00000000000..126043826bd --- /dev/null +++ b/tests/cases/compiler/compilerOptionsOutAndNoEmit.ts @@ -0,0 +1,6 @@ +// @out: outDir +// @noEmit: true +// @fileName: a.ts + +class c { +} diff --git a/tests/cases/compiler/compilerOptionsOutDirAndNoEmit.ts b/tests/cases/compiler/compilerOptionsOutDirAndNoEmit.ts new file mode 100644 index 00000000000..fb701a52661 --- /dev/null +++ b/tests/cases/compiler/compilerOptionsOutDirAndNoEmit.ts @@ -0,0 +1,6 @@ +// @outDir: outDir +// @noEmit: true +// @fileName: a.ts + +class c { +} diff --git a/tests/cases/compiler/compilerOptionsOutFileAndNoEmit.ts b/tests/cases/compiler/compilerOptionsOutFileAndNoEmit.ts new file mode 100644 index 00000000000..2e75c0a976f --- /dev/null +++ b/tests/cases/compiler/compilerOptionsOutFileAndNoEmit.ts @@ -0,0 +1,6 @@ +// @outFile: a.js +// @noEmit: true +// @fileName: a.ts + +class c { +} diff --git a/tests/cases/compiler/contextualTyping24.ts b/tests/cases/compiler/contextualTyping24.ts index be28ff3b04c..fad23fa313c 100644 --- a/tests/cases/compiler/contextualTyping24.ts +++ b/tests/cases/compiler/contextualTyping24.ts @@ -1 +1 @@ -var foo:(a:{():number; (i:number):number; })=>number; foo = function(a:string){return 5}; \ No newline at end of file +var foo:(a:{():number; (i:number):number; })=>number; foo = function(this: void, a:string){return 5}; \ No newline at end of file diff --git a/tests/cases/compiler/continueInLoopsWithCapturedBlockScopedBindings1.ts b/tests/cases/compiler/continueInLoopsWithCapturedBlockScopedBindings1.ts new file mode 100644 index 00000000000..8a17435edd6 --- /dev/null +++ b/tests/cases/compiler/continueInLoopsWithCapturedBlockScopedBindings1.ts @@ -0,0 +1,13 @@ +// @target: ES5 +function foo() { + for (const i of [0, 1]) { + if (i === 0) { + continue; + } + + // Trigger non-simple-loop emit + (() => { + return i; + })(); + } +} \ No newline at end of file diff --git a/tests/cases/compiler/controlFlowCaching.ts b/tests/cases/compiler/controlFlowCaching.ts new file mode 100644 index 00000000000..6510a89b06e --- /dev/null +++ b/tests/cases/compiler/controlFlowCaching.ts @@ -0,0 +1,68 @@ +// @strictNullChecks: true + +// Repro for #8401 + +function f(dim, offsets, arr, acommon, centerAnchorLimit, g, has, lin) { + var isRtl = this._isRtl(); // chart mirroring + // prepare variable + var o = this.opt, ta = this.chart.theme.axis, position = o.position, + leftBottom = position !== "rightOrTop", rotation = o.rotation % 360, + start, stop, titlePos, titleRotation = 0, titleOffset, axisVector, tickVector, anchorOffset, labelOffset, labelAlign, + labelGap = this.chart.theme.axis.tick.labelGap, + taFont = o.font || (ta.majorTick && ta.majorTick.font) || (ta.tick && ta.tick.font), + taTitleFont = o.titleFont || (ta.title && ta.title.font), + taFontColor = o.fontColor || (ta.majorTick && ta.majorTick.fontColor) || (ta.tick && ta.tick.fontColor) || "black", + taTitleFontColor = o.titleFontColor || (ta.title && ta.title.fontColor) || "black", + taTitleGap = (o.titleGap == 0) ? 0 : o.titleGap || (ta.title && ta.title.gap) || 15, + taTitleOrientation = o.titleOrientation || (ta.title && ta.title.orientation) || "axis", + taMajorTick = this.chart.theme.getTick("major", o), + taMinorTick = this.chart.theme.getTick("minor", o), + taMicroTick = this.chart.theme.getTick("micro", o), + + taStroke = "stroke" in o ? o.stroke : ta.stroke, + size = taFont ? g.normalizedLength(g.splitFontString(taFont).size) : 0, + cosr = Math.abs(Math.cos(rotation * Math.PI / 180)), + sinr = Math.abs(Math.sin(rotation * Math.PI / 180)), + tsize = taTitleFont ? g.normalizedLength(g.splitFontString(taTitleFont).size) : 0; + if (rotation < 0) { + rotation += 360; + } + var cachedLabelW = this._getMaxLabelSize(); + cachedLabelW = cachedLabelW && cachedLabelW.majLabelW; + titleOffset = size * cosr + (cachedLabelW || 0) * sinr + labelGap + Math.max(taMajorTick.length > 0 ? taMajorTick.length : 0, + taMinorTick.length > 0 ? taMinorTick.length : 0) + + tsize + taTitleGap; + axisVector = { x: isRtl ? -1 : 1, y: 0 }; // chart mirroring + switch (rotation) { + default: + if (rotation < (90 - centerAnchorLimit)) { + labelOffset.y = leftBottom ? size : 0; + } else if (rotation < (90 + centerAnchorLimit)) { + labelOffset.x = -size * 0.4; + } else if (rotation < 180) { + labelOffset.y = leftBottom ? 0 : -size; + } else if (rotation < (270 - centerAnchorLimit)) { + labelOffset.y = leftBottom ? 0 : -size; + } else if (rotation < (270 + centerAnchorLimit)) { + labelOffset.y = leftBottom ? size * 0.4 : 0; + } else { + labelOffset.y = leftBottom ? size : 0; + } + } + + titleRotation = (taTitleOrientation && taTitleOrientation == "away") ? 180 : 0; + titlePos.y = offsets.t - titleOffset + (titleRotation ? 0 : tsize); + switch (labelAlign) { + case "start": + labelAlign = "end"; + break; + case "end": + labelAlign = "start"; + break; + case "middle": + labelOffset.y -= size; + break; + } + + let _ = rotation; +} diff --git a/tests/cases/compiler/controlFlowDestructuringParameters.ts b/tests/cases/compiler/controlFlowDestructuringParameters.ts new file mode 100644 index 00000000000..3efcd8c4814 --- /dev/null +++ b/tests/cases/compiler/controlFlowDestructuringParameters.ts @@ -0,0 +1,7 @@ +// Repro for #8376 + +// @strictNullChecks: true + +[{ x: 1 }].map( + ({ x }) => x +); diff --git a/tests/cases/compiler/controlFlowLoopAnalysis.ts b/tests/cases/compiler/controlFlowLoopAnalysis.ts new file mode 100644 index 00000000000..e4fb2f91f7e --- /dev/null +++ b/tests/cases/compiler/controlFlowLoopAnalysis.ts @@ -0,0 +1,51 @@ +// @strictNullChecks: true +// @noImplicitAny: true + +// Repro from #8418 + +let cond: boolean; + +function foo(x: number): number { return 1; } + +function test1() { + let x: number | undefined; + while (cond) { + while (cond) { + while (cond) { + x = foo(x); + } + } + x = 1; + } +} + +// Repro from #8418 + +function test2() { + let x: number | undefined; + x = 1; + while (cond) { + while (cond) { + x = foo(x); + } + } +} + +// Repro from #8511 + +function mapUntilCant( + values: a[], + canTake: (value: a, index: number) => boolean, + mapping: (value: a, index: number) => b +): b[] { + let result: b[] = []; + for (let index = 0, length = values.length; index < length; index++) { + let value = values[index]; + if (canTake(value, index)) { + result.push(mapping(value, index)); + } else { + return result; + } + } + return result; +} diff --git a/tests/cases/compiler/declarationEmitDefaultExportWithTempVarName.ts b/tests/cases/compiler/declarationEmitDefaultExportWithTempVarName.ts new file mode 100644 index 00000000000..13c967c4fe5 --- /dev/null +++ b/tests/cases/compiler/declarationEmitDefaultExportWithTempVarName.ts @@ -0,0 +1,4 @@ +// @declaration: true +// @module: system +// @Filename: pi.ts +export default 3.14159; \ No newline at end of file diff --git a/tests/cases/compiler/declarationEmitDefaultExportWithTempVarNameWithBundling.ts b/tests/cases/compiler/declarationEmitDefaultExportWithTempVarNameWithBundling.ts new file mode 100644 index 00000000000..6bd5320f3fe --- /dev/null +++ b/tests/cases/compiler/declarationEmitDefaultExportWithTempVarNameWithBundling.ts @@ -0,0 +1,6 @@ +// @declaration: true +// @module: system +// @outFile: app.js + +// @Filename: pi.ts +export default 3.14159; \ No newline at end of file diff --git a/tests/cases/compiler/declarationEmitFirstTypeArgumentGenericFunctionType.ts b/tests/cases/compiler/declarationEmitFirstTypeArgumentGenericFunctionType.ts new file mode 100644 index 00000000000..3c5100d0772 --- /dev/null +++ b/tests/cases/compiler/declarationEmitFirstTypeArgumentGenericFunctionType.ts @@ -0,0 +1,26 @@ +// @declaration: true +// @module: commonjs +// @target: es6 + +class X { +} +var prop11: X< () => Tany >; // spaces before the first type argument +var prop12: X<(() => Tany)>; // spaces before the first type argument +function f1() { // Inferred return type + return prop11; +} +function f2() { // Inferred return type + return prop12; +} +function f3(): X< () => Tany> { // written with space before type argument + return prop11; +} +function f4(): X<(() => Tany)> { // written type with parenthesis + return prop12; +} +class Y { +} +var prop2: Y() => Tany>; // No space after second type argument +var prop2: Y() => Tany>; // space after second type argument +var prop3: Y< () => Tany, () => Tany>; // space before first type argument +var prop4: Y<(() => Tany), () => Tany>; // parenthesized first type argument diff --git a/tests/cases/compiler/declarationEmitPromise.ts b/tests/cases/compiler/declarationEmitPromise.ts new file mode 100644 index 00000000000..2eff0b6c50c --- /dev/null +++ b/tests/cases/compiler/declarationEmitPromise.ts @@ -0,0 +1,25 @@ +// @declaration: true +// @module: commonjs +// @target: es6 + +export class bluebird { + static all: Array>; +} + +export async function runSampleWorks( + a: bluebird, b?: bluebird, c?: bluebird, d?: bluebird, e?: bluebird) { + let result = await (bluebird.all as any)([a, b, c, d, e].filter(el => !!el)); + let func = (f: (a: A, b?: B, c?: C, d?: D, e?: E) => T): T => + f.apply(this, result); + let rfunc: typeof func & {} = func as any; // <- This is the only difference + return rfunc +} + +export async function runSampleBreaks( + a: bluebird, b?: bluebird, c?: bluebird, d?: bluebird, e?: bluebird) { + let result = await (bluebird.all as any)([a, b, c, d, e].filter(el => !!el)); + let func = (f: (a: A, b?: B, c?: C, d?: D, e?: E) => T): T => + f.apply(this, result); + let rfunc: typeof func = func as any; // <- This is the only difference + return rfunc +} \ No newline at end of file diff --git a/tests/cases/compiler/declarationEmit_UnknownImport.ts b/tests/cases/compiler/declarationEmit_UnknownImport.ts new file mode 100644 index 00000000000..9f6344322bc --- /dev/null +++ b/tests/cases/compiler/declarationEmit_UnknownImport.ts @@ -0,0 +1,6 @@ +// @target: es5 +// @module: commonjs +// @declaration: true + +import Foo = SomeNonExistingName +export {Foo} \ No newline at end of file diff --git a/tests/cases/compiler/declarationEmit_UnknownImport2.ts b/tests/cases/compiler/declarationEmit_UnknownImport2.ts new file mode 100644 index 00000000000..035d1d860c5 --- /dev/null +++ b/tests/cases/compiler/declarationEmit_UnknownImport2.ts @@ -0,0 +1,6 @@ +// @target: es5 +// @module: commonjs +// @declaration: true + +import Foo From './Foo'; // Syntax error +export default Foo \ No newline at end of file diff --git a/tests/cases/compiler/declarationEmit_bindingPatterns.ts b/tests/cases/compiler/declarationEmit_bindingPatterns.ts new file mode 100644 index 00000000000..16d380307fd --- /dev/null +++ b/tests/cases/compiler/declarationEmit_bindingPatterns.ts @@ -0,0 +1,7 @@ +// @declaration: true + +const k = ({x: z = 'y'}) => { } + +var a; +function f({} = a, [] = a, { p: {} = a} = a) { +} \ No newline at end of file diff --git a/tests/cases/compiler/declarationEmit_classMemberNameConflict.ts b/tests/cases/compiler/declarationEmit_classMemberNameConflict.ts new file mode 100644 index 00000000000..16f096d43ca --- /dev/null +++ b/tests/cases/compiler/declarationEmit_classMemberNameConflict.ts @@ -0,0 +1,39 @@ +// @target: es5 +// @module: commonjs +// @declaration: true + +export class C1 { + C1() { } // has to be the same as the class name + + bar() { + return function (t: typeof C1) { + }; + } +} + +export class C2 { + C2: any // has to be the same as the class name + + bar() { + return function (t: typeof C2) { + }; + } +} + +export class C3 { + get C3() { return 0; } // has to be the same as the class name + + bar() { + return function (t: typeof C3) { + }; + } +} + +export class C4 { + set C4(v) { } // has to be the same as the class name + + bar() { + return function (t: typeof C4) { + }; + } +} \ No newline at end of file diff --git a/tests/cases/compiler/declarationEmit_classMemberNameConflict2.ts b/tests/cases/compiler/declarationEmit_classMemberNameConflict2.ts new file mode 100644 index 00000000000..90b488ebec7 --- /dev/null +++ b/tests/cases/compiler/declarationEmit_classMemberNameConflict2.ts @@ -0,0 +1,24 @@ +// @target: es5 +// @module: commonjs +// @declaration: true + +const Bar = 'bar'; + +enum Hello { + World +} + +enum Hello1 { + World1 +} + +class Foo { + // Same names + string => OK + Bar = Bar; + + // Same names + enum => OK + Hello = Hello; + + // Different names + enum => OK + Hello2 = Hello1; +} \ No newline at end of file diff --git a/tests/cases/compiler/declarationEmit_expressionInExtends.ts b/tests/cases/compiler/declarationEmit_expressionInExtends.ts new file mode 100644 index 00000000000..8544ca20d92 --- /dev/null +++ b/tests/cases/compiler/declarationEmit_expressionInExtends.ts @@ -0,0 +1,15 @@ +// @declaration: true + +var x: { + new(s: any): Q; +} + +class Q { + s: string; +} + +class B extends x { +} + +var q: B; +q.s; \ No newline at end of file diff --git a/tests/cases/compiler/declarationEmit_expressionInExtends2.ts b/tests/cases/compiler/declarationEmit_expressionInExtends2.ts new file mode 100644 index 00000000000..0b2ccab8385 --- /dev/null +++ b/tests/cases/compiler/declarationEmit_expressionInExtends2.ts @@ -0,0 +1,13 @@ +// @declaration: true + +class C { + x: T; + y: U; +} + +function getClass(c: T) { + return C; +} + +class MyClass extends getClass(2) { +} \ No newline at end of file diff --git a/tests/cases/compiler/declarationEmit_expressionInExtends3.ts b/tests/cases/compiler/declarationEmit_expressionInExtends3.ts new file mode 100644 index 00000000000..348d0d188f7 --- /dev/null +++ b/tests/cases/compiler/declarationEmit_expressionInExtends3.ts @@ -0,0 +1,43 @@ +// @declaration: true + +export class ExportedClass { + x: T; +} + +class LocalClass { + x: T; + y: U; +} + +export interface ExportedInterface { + x: number; +} + +interface LocalInterface { + x: number; +} + +function getLocalClass(c: T) { + return LocalClass; +} + +function getExportedClass(c: T) { + return ExportedClass; +} + + + +export class MyClass extends getLocalClass(undefined) { // error LocalClass is inaccisible +} + + +export class MyClass2 extends getExportedClass(undefined) { // OK +} + + +export class MyClass3 extends getExportedClass(undefined) { // Error LocalInterface is inaccisble +} + + +export class MyClass4 extends getExportedClass(undefined) { // OK +} diff --git a/tests/cases/compiler/declarationEmit_expressionInExtends4.ts b/tests/cases/compiler/declarationEmit_expressionInExtends4.ts new file mode 100644 index 00000000000..6b3044f227f --- /dev/null +++ b/tests/cases/compiler/declarationEmit_expressionInExtends4.ts @@ -0,0 +1,18 @@ +// @declaration: true + +function getSomething() { + return class D { } +} + +class C extends getSomething() { + +} + +class C2 extends SomeUndefinedFunction() { + +} + + +class C3 extends SomeUndefinedFunction { + +} \ No newline at end of file diff --git a/tests/cases/compiler/declarationEmit_inferedDefaultExportType.ts b/tests/cases/compiler/declarationEmit_inferedDefaultExportType.ts new file mode 100644 index 00000000000..3c3adc1af2f --- /dev/null +++ b/tests/cases/compiler/declarationEmit_inferedDefaultExportType.ts @@ -0,0 +1,9 @@ +// @declaration: true +// @module: commonjs + +// test.ts +export default { + foo: [], + bar: undefined, + baz: null +} \ No newline at end of file diff --git a/tests/cases/compiler/declarationEmit_inferedDefaultExportType2.ts b/tests/cases/compiler/declarationEmit_inferedDefaultExportType2.ts new file mode 100644 index 00000000000..274996cbe12 --- /dev/null +++ b/tests/cases/compiler/declarationEmit_inferedDefaultExportType2.ts @@ -0,0 +1,9 @@ +// @declaration: true +// @module: commonjs + +// test.ts +export = { + foo: [], + bar: undefined, + baz: null +} \ No newline at end of file diff --git a/tests/cases/compiler/declarationEmit_invalidExport.ts b/tests/cases/compiler/declarationEmit_invalidExport.ts new file mode 100644 index 00000000000..8b0826dbf96 --- /dev/null +++ b/tests/cases/compiler/declarationEmit_invalidExport.ts @@ -0,0 +1,7 @@ +// @declaration: true + +if (false) { + export var myClass = 0; +} +export type MyClass = typeof myClass; +} diff --git a/tests/cases/compiler/declarationMerging1.ts b/tests/cases/compiler/declarationMerging1.ts new file mode 100644 index 00000000000..256cacf4a52 --- /dev/null +++ b/tests/cases/compiler/declarationMerging1.ts @@ -0,0 +1,10 @@ +// @filename: file1.ts +class A { + protected _f: number; + getF() { return this._f; } +} + +// @filename: file2.ts +interface A { + run(); +} \ No newline at end of file diff --git a/tests/cases/compiler/declarationMerging2.ts b/tests/cases/compiler/declarationMerging2.ts new file mode 100644 index 00000000000..6be5f4d0e4d --- /dev/null +++ b/tests/cases/compiler/declarationMerging2.ts @@ -0,0 +1,15 @@ +// @module: amd + +// @filename: a.ts +export class A { + protected _f: number; + getF() { return this._f; } +} + +// @filename: b.ts +export {} +declare module "./a" { + interface A { + run(); + } +} \ No newline at end of file diff --git a/tests/cases/compiler/deduplicateImportsInSystem.ts b/tests/cases/compiler/deduplicateImportsInSystem.ts new file mode 100644 index 00000000000..2fcbc16be05 --- /dev/null +++ b/tests/cases/compiler/deduplicateImportsInSystem.ts @@ -0,0 +1,9 @@ +// @module: system +import {A} from "f1"; +import {B} from "f2"; +import {C} from "f3"; +import {D} from 'f2'; +import {E} from "f2"; +import {F} from 'f1'; + +console.log(A + B + C + D + E + F) \ No newline at end of file diff --git a/tests/cases/compiler/defaultOfAnyInStrictNullChecks.ts b/tests/cases/compiler/defaultOfAnyInStrictNullChecks.ts new file mode 100644 index 00000000000..17568f48029 --- /dev/null +++ b/tests/cases/compiler/defaultOfAnyInStrictNullChecks.ts @@ -0,0 +1,11 @@ +// @strictNullChecks: true + +// Regression test for #8295 + +function foo() { + try { + } + catch (e) { + let s = e.message; + } +} diff --git a/tests/cases/compiler/destructuringInVariableDeclarations1.ts b/tests/cases/compiler/destructuringInVariableDeclarations1.ts new file mode 100644 index 00000000000..275564c07c5 --- /dev/null +++ b/tests/cases/compiler/destructuringInVariableDeclarations1.ts @@ -0,0 +1,6 @@ +// @target: es6 +// @module: commonjs +export let { toString } = 1; +{ + let { toFixed } = 1; +} diff --git a/tests/cases/compiler/destructuringInVariableDeclarations2.ts b/tests/cases/compiler/destructuringInVariableDeclarations2.ts new file mode 100644 index 00000000000..07190dddd52 --- /dev/null +++ b/tests/cases/compiler/destructuringInVariableDeclarations2.ts @@ -0,0 +1,7 @@ +// @target: es6 +// @module: commonjs +let { toString } = 1; +{ + let { toFixed } = 1; +} +export {}; diff --git a/tests/cases/compiler/destructuringInVariableDeclarations3.ts b/tests/cases/compiler/destructuringInVariableDeclarations3.ts new file mode 100644 index 00000000000..7881b3073a1 --- /dev/null +++ b/tests/cases/compiler/destructuringInVariableDeclarations3.ts @@ -0,0 +1,6 @@ +// @target: es6 +// @module: amd +export let { toString } = 1; +{ + let { toFixed } = 1; +} diff --git a/tests/cases/compiler/destructuringInVariableDeclarations4.ts b/tests/cases/compiler/destructuringInVariableDeclarations4.ts new file mode 100644 index 00000000000..81ed4d04c4e --- /dev/null +++ b/tests/cases/compiler/destructuringInVariableDeclarations4.ts @@ -0,0 +1,7 @@ +// @target: es6 +// @module: amd +let { toString } = 1; +{ + let { toFixed } = 1; +} +export {}; diff --git a/tests/cases/compiler/destructuringInVariableDeclarations5.ts b/tests/cases/compiler/destructuringInVariableDeclarations5.ts new file mode 100644 index 00000000000..610fa8715f3 --- /dev/null +++ b/tests/cases/compiler/destructuringInVariableDeclarations5.ts @@ -0,0 +1,6 @@ +// @target: es6 +// @module: umd +export let { toString } = 1; +{ + let { toFixed } = 1; +} diff --git a/tests/cases/compiler/destructuringInVariableDeclarations6.ts b/tests/cases/compiler/destructuringInVariableDeclarations6.ts new file mode 100644 index 00000000000..2e63209f4e8 --- /dev/null +++ b/tests/cases/compiler/destructuringInVariableDeclarations6.ts @@ -0,0 +1,7 @@ +// @target: es6 +// @module: umd +let { toString } = 1; +{ + let { toFixed } = 1; +} +export {}; diff --git a/tests/cases/compiler/destructuringInVariableDeclarations7.ts b/tests/cases/compiler/destructuringInVariableDeclarations7.ts new file mode 100644 index 00000000000..3a2827eccc3 --- /dev/null +++ b/tests/cases/compiler/destructuringInVariableDeclarations7.ts @@ -0,0 +1,6 @@ +// @target: es6 +// @module: system +export let { toString } = 1; +{ + let { toFixed } = 1; +} diff --git a/tests/cases/compiler/destructuringInVariableDeclarations8.ts b/tests/cases/compiler/destructuringInVariableDeclarations8.ts new file mode 100644 index 00000000000..4925c47d85b --- /dev/null +++ b/tests/cases/compiler/destructuringInVariableDeclarations8.ts @@ -0,0 +1,7 @@ +// @target: es6 +// @module: system +let { toString } = 1; +{ + let { toFixed } = 1; +} +export {}; diff --git a/tests/cases/compiler/dottedNamesInSystem.ts b/tests/cases/compiler/dottedNamesInSystem.ts new file mode 100644 index 00000000000..43b8eb233b9 --- /dev/null +++ b/tests/cases/compiler/dottedNamesInSystem.ts @@ -0,0 +1,8 @@ +// @module: system +export namespace A.B.C { + export function foo() {} +} + +export function bar() { + return A.B.C.foo(); +} \ No newline at end of file diff --git a/tests/cases/compiler/doubleUnderStringLiteralAssignability.ts b/tests/cases/compiler/doubleUnderStringLiteralAssignability.ts new file mode 100644 index 00000000000..4a1ae75164c --- /dev/null +++ b/tests/cases/compiler/doubleUnderStringLiteralAssignability.ts @@ -0,0 +1,4 @@ +var shouldBeOk: '__dunder' = '__dunder'; +var bad: '__dunder' = 'no_dunder'; +var okok: '___thunder' = '___thunder'; +var alsoOk: '_sunder' = '_sunder'; diff --git a/tests/cases/compiler/dynamicRequire.ts b/tests/cases/compiler/dynamicRequire.ts new file mode 100644 index 00000000000..8d72a37dceb --- /dev/null +++ b/tests/cases/compiler/dynamicRequire.ts @@ -0,0 +1,8 @@ +// @allowJs: true +// @module: amd +// @out: a_out.js + +// @filename: a.js +function foo(name) { + var s = require("t/" + name) +} \ No newline at end of file diff --git a/tests/cases/compiler/emitSuperCallBeforeEmitParameterPropertyDeclaration1.ts b/tests/cases/compiler/emitSuperCallBeforeEmitParameterPropertyDeclaration1.ts new file mode 100644 index 00000000000..5172ccfe21f --- /dev/null +++ b/tests/cases/compiler/emitSuperCallBeforeEmitParameterPropertyDeclaration1.ts @@ -0,0 +1,12 @@ +class A { + blub = 6; +} + + +class B extends A { + constructor(public x: number) { + "use strict"; + 'someStringForEgngInject'; + super() + } +} diff --git a/tests/cases/compiler/emitSuperCallBeforeEmitParameterPropertyDeclaration1ES6.ts b/tests/cases/compiler/emitSuperCallBeforeEmitParameterPropertyDeclaration1ES6.ts new file mode 100644 index 00000000000..e62f753d725 --- /dev/null +++ b/tests/cases/compiler/emitSuperCallBeforeEmitParameterPropertyDeclaration1ES6.ts @@ -0,0 +1,13 @@ +// @target: ES6 +class A { + blub = 6; +} + + +class B extends A { + constructor(public x: number) { + "use strict"; + 'someStringForEgngInject'; + super() + } +} diff --git a/tests/cases/compiler/emitSuperCallBeforeEmitPropertyDeclaration1.ts b/tests/cases/compiler/emitSuperCallBeforeEmitPropertyDeclaration1.ts new file mode 100644 index 00000000000..52d41c3731a --- /dev/null +++ b/tests/cases/compiler/emitSuperCallBeforeEmitPropertyDeclaration1.ts @@ -0,0 +1,15 @@ +class A { + blub = 6; +} + + +class B extends A { + + blub = 12; + + constructor() { + "use strict"; + 'someStringForEgngInject'; + super() + } +} \ No newline at end of file diff --git a/tests/cases/compiler/emitSuperCallBeforeEmitPropertyDeclaration1ES6.ts b/tests/cases/compiler/emitSuperCallBeforeEmitPropertyDeclaration1ES6.ts new file mode 100644 index 00000000000..f6c7164ae75 --- /dev/null +++ b/tests/cases/compiler/emitSuperCallBeforeEmitPropertyDeclaration1ES6.ts @@ -0,0 +1,15 @@ +// @target: ES6 +class A { + blub = 6; +} + + +class B extends A { + + blub = 12; + + constructor() { + 'someStringForEgngInject'; + super() + } +} \ No newline at end of file diff --git a/tests/cases/compiler/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.ts b/tests/cases/compiler/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.ts new file mode 100644 index 00000000000..a2d8bf8473f --- /dev/null +++ b/tests/cases/compiler/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.ts @@ -0,0 +1,13 @@ +class A { + blub = 6; +} + + +class B extends A { + blah = 2; + constructor(public x: number) { + "use strict"; + 'someStringForEgngInject'; + super() + } +} \ No newline at end of file diff --git a/tests/cases/compiler/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1ES6.ts b/tests/cases/compiler/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1ES6.ts new file mode 100644 index 00000000000..8bd8420f8f7 --- /dev/null +++ b/tests/cases/compiler/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1ES6.ts @@ -0,0 +1,14 @@ +// @target: ES6 +class A { + blub = 6; +} + + +class B extends A { + blah = 2; + constructor(public x: number) { + "use strict"; + 'someStringForEgngInject'; + super() + } +} \ No newline at end of file diff --git a/tests/cases/compiler/enumAssignmentCompat4.ts b/tests/cases/compiler/enumAssignmentCompat4.ts new file mode 100644 index 00000000000..0a5fc896604 --- /dev/null +++ b/tests/cases/compiler/enumAssignmentCompat4.ts @@ -0,0 +1,22 @@ +namespace M { + export enum MyEnum { + BAR + } + export var object2 = { + foo: MyEnum.BAR + }; +} + +namespace N { + export enum MyEnum { + FOO + }; + export var object1 = { + foo: MyEnum.FOO + }; +} + +let broken = [ + N.object1, + M.object2 +]; diff --git a/tests/cases/compiler/errorMessagesIntersectionTypes01.ts b/tests/cases/compiler/errorMessagesIntersectionTypes01.ts new file mode 100644 index 00000000000..b5e375cb8a9 --- /dev/null +++ b/tests/cases/compiler/errorMessagesIntersectionTypes01.ts @@ -0,0 +1,16 @@ +interface Foo { + fooProp: boolean; +} + +interface Bar { + barProp: string; +} + +interface FooBar extends Foo, Bar { +} + +declare function mixBar(obj: T): T & Bar; + +let fooBar: FooBar = mixBar({ + fooProp: "frizzlebizzle" +}); \ No newline at end of file diff --git a/tests/cases/compiler/errorMessagesIntersectionTypes02.ts b/tests/cases/compiler/errorMessagesIntersectionTypes02.ts new file mode 100644 index 00000000000..3f21221e139 --- /dev/null +++ b/tests/cases/compiler/errorMessagesIntersectionTypes02.ts @@ -0,0 +1,16 @@ +interface Foo { + fooProp: "hello" | "world"; +} + +interface Bar { + barProp: string; +} + +interface FooBar extends Foo, Bar { +} + +declare function mixBar(obj: T): T & Bar; + +let fooBar: FooBar = mixBar({ + fooProp: "frizzlebizzle" +}); \ No newline at end of file diff --git a/tests/cases/compiler/errorMessagesIntersectionTypes03.ts b/tests/cases/compiler/errorMessagesIntersectionTypes03.ts new file mode 100644 index 00000000000..73969bc17b3 --- /dev/null +++ b/tests/cases/compiler/errorMessagesIntersectionTypes03.ts @@ -0,0 +1,24 @@ +interface A { + a; +} + +interface B { + b; +} + +function f(): void { + let t: T; + let u: U; + let v: V; + + let a_and_b: A & B; + let t_and_b: T & B; + + t = a_and_b; + u = a_and_b; + v = a_and_b; + + t = t_and_b; + u = t_and_b; + v = t_and_b; +} \ No newline at end of file diff --git a/tests/cases/compiler/errorMessagesIntersectionTypes04.ts b/tests/cases/compiler/errorMessagesIntersectionTypes04.ts new file mode 100644 index 00000000000..74dcfa658e7 --- /dev/null +++ b/tests/cases/compiler/errorMessagesIntersectionTypes04.ts @@ -0,0 +1,22 @@ +interface A { + a; +} + +interface B { + b; +} + +function f(): void { + let num: number; + let bool: boolean; + let str: string; + + let a_and_b: A & B; + let num_and_bool: number & boolean; + + num = a_and_b; + bool = a_and_b; + str = a_and_b; + + str = num_and_bool; +} \ No newline at end of file diff --git a/tests/cases/compiler/excessPropertyErrorForFunctionTypes.ts b/tests/cases/compiler/excessPropertyErrorForFunctionTypes.ts new file mode 100644 index 00000000000..d86d6ddb77c --- /dev/null +++ b/tests/cases/compiler/excessPropertyErrorForFunctionTypes.ts @@ -0,0 +1,4 @@ +type FunctionType = () => any; +type DoesntWork = { a: number, c: number } | FunctionType; + +let doesntWork: DoesntWork = { a: 1, c: 2, d: 3 } \ No newline at end of file diff --git a/tests/cases/compiler/exportEqualsAmd.ts b/tests/cases/compiler/exportEqualsAmd.ts new file mode 100644 index 00000000000..132d9fe22cf --- /dev/null +++ b/tests/cases/compiler/exportEqualsAmd.ts @@ -0,0 +1,2 @@ +// @module: amd +export = { ["hi"]: "there" }; \ No newline at end of file diff --git a/tests/cases/compiler/exportEqualsCommonJs.ts b/tests/cases/compiler/exportEqualsCommonJs.ts new file mode 100644 index 00000000000..d075504ab03 --- /dev/null +++ b/tests/cases/compiler/exportEqualsCommonJs.ts @@ -0,0 +1,2 @@ +// @module: commonjs +export = { ["hi"]: "there" }; \ No newline at end of file diff --git a/tests/cases/compiler/exportEqualsDefaultProperty.ts b/tests/cases/compiler/exportEqualsDefaultProperty.ts new file mode 100644 index 00000000000..1adce3cabe1 --- /dev/null +++ b/tests/cases/compiler/exportEqualsDefaultProperty.ts @@ -0,0 +1,12 @@ + +// @Filename: exp.ts +var x = { + "greeting": "hello, world", + "default": 42 +}; + +export = x + +// @Filename: imp.ts +import foo from "./exp"; +foo.toExponential(2); diff --git a/tests/cases/compiler/exportEqualsOfModule.ts b/tests/cases/compiler/exportEqualsOfModule.ts new file mode 100644 index 00000000000..b953c65a8ad --- /dev/null +++ b/tests/cases/compiler/exportEqualsOfModule.ts @@ -0,0 +1,19 @@ +declare module '~popsicle/dist/request' { + export class Request {} +} + +declare module '~popsicle/dist/common' { + import { Request } from '~popsicle/dist/request'; + export { Request }; +} + +declare module 'popsicle' { + import alias = require('~popsicle/dist/common'); + export = alias; +} + +declare module 'popsicle-proxy-agent' { + import { Request } from 'popsicle'; + function proxy(): (request: Request) => any; + export = proxy; +} diff --git a/tests/cases/compiler/exportEqualsUmd.ts b/tests/cases/compiler/exportEqualsUmd.ts new file mode 100644 index 00000000000..250aaccd2b8 --- /dev/null +++ b/tests/cases/compiler/exportEqualsUmd.ts @@ -0,0 +1,2 @@ +// @module: umd +export = { ["hi"]: "there" }; \ No newline at end of file diff --git a/tests/cases/compiler/exportRedeclarationTypeAliases.ts b/tests/cases/compiler/exportRedeclarationTypeAliases.ts new file mode 100644 index 00000000000..eb5cbcd4c6d --- /dev/null +++ b/tests/cases/compiler/exportRedeclarationTypeAliases.ts @@ -0,0 +1,4 @@ +// @module: commonjs +export type Foo = number; +export function Foo(): number; +export function Foo(): any {} \ No newline at end of file diff --git a/tests/cases/compiler/fallFromLastCase1.ts b/tests/cases/compiler/fallFromLastCase1.ts new file mode 100644 index 00000000000..d8037c61a96 --- /dev/null +++ b/tests/cases/compiler/fallFromLastCase1.ts @@ -0,0 +1,24 @@ +// @noFallthroughCasesInSwitch: true + +declare function use(a: string); + +function foo1(a: number) { + switch (a) { + case 1: + use("1"); + break; + case 2: + use("2"); + } +} + + +function foo2(a: number) { + switch (a) { + case 1: + use("1"); + break; + default: + use("2"); + } +} \ No newline at end of file diff --git a/tests/cases/compiler/fallFromLastCase2.ts b/tests/cases/compiler/fallFromLastCase2.ts new file mode 100644 index 00000000000..231d3512dbe --- /dev/null +++ b/tests/cases/compiler/fallFromLastCase2.ts @@ -0,0 +1,28 @@ +// @noFallthroughCasesInSwitch: true + +declare function use(a: string); + +function foo1(a: number) { + switch (a) { + case 1: + use("1"); + break; + case 2: + use("2"); + case 3: + use("3"); + } +} + + +function foo2(a: number) { + switch (a) { + case 1: + use("1"); + break; + default: + use("2"); + case 2: + use("3"); + } +} \ No newline at end of file diff --git a/tests/cases/compiler/fallbackToBindingPatternForTypeInference.ts b/tests/cases/compiler/fallbackToBindingPatternForTypeInference.ts new file mode 100644 index 00000000000..9aa979c1020 --- /dev/null +++ b/tests/cases/compiler/fallbackToBindingPatternForTypeInference.ts @@ -0,0 +1,6 @@ +declare function trans(f: (x: T) => string): number; +trans(({a}) => a); +trans(([b,c]) => 'foo'); +trans(({d: [e,f]}) => 'foo'); +trans(([{g},{h}]) => 'foo'); +trans(({a, b = 10}) => a); diff --git a/tests/cases/compiler/functionAndImportNameConflict.ts b/tests/cases/compiler/functionAndImportNameConflict.ts new file mode 100644 index 00000000000..9126dd20910 --- /dev/null +++ b/tests/cases/compiler/functionAndImportNameConflict.ts @@ -0,0 +1,9 @@ +// @module: commonjs +// @filename: f1.ts +export function f() { +} + +// @filename: f2.ts +import {f} from './f1'; +export function f() { +} \ No newline at end of file diff --git a/tests/cases/compiler/functionLikeInParameterInitializer.ts b/tests/cases/compiler/functionLikeInParameterInitializer.ts new file mode 100644 index 00000000000..2040a65efa1 --- /dev/null +++ b/tests/cases/compiler/functionLikeInParameterInitializer.ts @@ -0,0 +1,18 @@ +// error +export function bar(func = () => foo) { + let foo = "in"; +} +// error +export function baz1(func = { f() { return foo } }) { + let foo = "in"; +} + +// error +export function baz2(func = function () { return foo }) { + let foo = "in"; +} + +// error +export function baz3(func = class { x = foo }) { + let foo = "in"; +} diff --git a/tests/cases/compiler/functionsMissingReturnStatementsAndExpressions.ts b/tests/cases/compiler/functionsMissingReturnStatementsAndExpressions.ts index fde615af41d..582940038c5 100644 --- a/tests/cases/compiler/functionsMissingReturnStatementsAndExpressions.ts +++ b/tests/cases/compiler/functionsMissingReturnStatementsAndExpressions.ts @@ -92,6 +92,17 @@ function f18() { return "Okay, not type annotated."; } +function f19(): void | number { + // Okay; function return type is union containing void +} + +function f20(): any | number { + // Okay; function return type is union containing any +} + +function f21(): number | string { + // Not okay; union does not contain void or any +} class C { public get m1() { diff --git a/tests/cases/compiler/genericInheritedDefaultConstructors.ts b/tests/cases/compiler/genericInheritedDefaultConstructors.ts new file mode 100644 index 00000000000..9b0bb94e877 --- /dev/null +++ b/tests/cases/compiler/genericInheritedDefaultConstructors.ts @@ -0,0 +1,9 @@ +// repro from #8166 +interface Constructor { + new(...args: any[]): T; + prototype: T; +} + +class A { a: U; } +class B extends A { b: V; } +var c:Constructor> = B; // shouldn't error here diff --git a/tests/cases/compiler/globalIsContextualKeyword.ts b/tests/cases/compiler/globalIsContextualKeyword.ts new file mode 100644 index 00000000000..ceae834a267 --- /dev/null +++ b/tests/cases/compiler/globalIsContextualKeyword.ts @@ -0,0 +1,16 @@ +function a() { + let global = 1; +} +function b() { + class global {} +} + +namespace global { +} + +function foo(global: number) { +} + +let obj = { + global: "123" +} \ No newline at end of file diff --git a/tests/cases/compiler/implementArrayInterface.ts b/tests/cases/compiler/implementArrayInterface.ts index 1ba8b8f2524..79ba68bdc42 100644 --- a/tests/cases/compiler/implementArrayInterface.ts +++ b/tests/cases/compiler/implementArrayInterface.ts @@ -9,7 +9,7 @@ declare class MyArray implements Array { reverse(): T[]; shift(): T; slice(start?: number, end?: number): T[]; - sort(compareFn?: (a: T, b: T) => number): T[]; + sort(compareFn?: (a: T, b: T) => number): this; splice(start: number): T[]; splice(start: number, deleteCount: number, ...items: T[]): T[]; unshift(...items: T[]): number; diff --git a/tests/cases/compiler/implicitIndexSignatures.ts b/tests/cases/compiler/implicitIndexSignatures.ts new file mode 100644 index 00000000000..2e36a91bada --- /dev/null +++ b/tests/cases/compiler/implicitIndexSignatures.ts @@ -0,0 +1,45 @@ +type StringMap = { [x: string]: string }; + +const empty1 = {}; +let empty2: {}; +const names1 = { a: "foo", b: "bar" }; +let names2: { a: string, b: string }; +let map: StringMap; +map = { x: "xxx", y: "yyy" }; +map = empty1; +map = empty2; +map = names1; +map = names2; + +declare function getStringIndexValue(map: { [x: string]: T }): T; +declare function getNumberIndexValue(map: { [x: number]: T }): T; + +function f1() { + const o1 = { a: 1, b: 2 }; + let o2: { a: number, b: number }; + const v1 = getStringIndexValue(o1); + const v2 = getStringIndexValue(o2); +} + +function f2() { + const o1 = { a: "1", b: "2" }; + let o2: { a: string, b: string }; + const v1 = getStringIndexValue(o1); + const v2 = getStringIndexValue(o2); +} + +function f3() { + const o1 = { a: 1, b: "2" }; + let o2: { a: number, b: string }; + const v1 = getStringIndexValue(o1); + const v2 = getStringIndexValue(o2); +} + +function f4() { + const o1 = { 0: "0", 1: "1", count: 2 }; + let o2: { 0: string, 1: string, count: number }; + const v1 = getStringIndexValue(o1); + const v2 = getStringIndexValue(o2); + const v3 = getNumberIndexValue(o1); + const v4 = getNumberIndexValue(o2); +} diff --git a/tests/cases/compiler/importAliasAnExternalModuleInsideAnInternalModule.ts b/tests/cases/compiler/importAliasAnExternalModuleInsideAnInternalModule.ts index 99356afd3b7..0743ac6f4ca 100644 --- a/tests/cases/compiler/importAliasAnExternalModuleInsideAnInternalModule.ts +++ b/tests/cases/compiler/importAliasAnExternalModuleInsideAnInternalModule.ts @@ -4,7 +4,7 @@ export module m { } // @Filename: importAliasAnExternalModuleInsideAnInternalModule_file1.ts -import r = require('importAliasAnExternalModuleInsideAnInternalModule_file0'); +import r = require('./importAliasAnExternalModuleInsideAnInternalModule_file0'); module m_private { //import r2 = require('m'); // would be error export import C = r; // no error diff --git a/tests/cases/compiler/inferenceLimit.ts b/tests/cases/compiler/inferenceLimit.ts new file mode 100644 index 00000000000..adaf13bad22 --- /dev/null +++ b/tests/cases/compiler/inferenceLimit.ts @@ -0,0 +1,41 @@ +// @target: es6 +// @module: commonjs +// @filename: file1.ts +"use strict"; +import * as MyModule from "./mymodule"; + +export class BrokenClass { + + constructor() {} + + public brokenMethod(field: string, value: string) { + return new Promise>((resolve, reject) => { + + let result: Array = []; + + let populateItems = (order) => { + return new Promise((resolve, reject) => { + this.doStuff(order.id) + .then((items) => { + order.items = items; + resolve(order); + }); + }); + }; + + return Promise.all(result.map(populateItems)) + .then((orders: Array) => { + resolve(orders); + }); + }); + } + + public async doStuff(id: number) { + return; + } +} + +// @filename: mymodule.ts +export interface MyModel { + id: number; +} \ No newline at end of file diff --git a/tests/cases/compiler/instantiateCrossFileMerge.ts b/tests/cases/compiler/instantiateCrossFileMerge.ts new file mode 100644 index 00000000000..00f5ce22faf --- /dev/null +++ b/tests/cases/compiler/instantiateCrossFileMerge.ts @@ -0,0 +1,8 @@ +// @filename: first.ts +declare class P { + constructor(callback: (resolve: (value: R) => void) => void); +} + +// @filename: second.ts +interface P { } +new P(r => { r('foo') }); diff --git a/tests/cases/compiler/invalidThisEmitInContextualObjectLiteral.ts b/tests/cases/compiler/invalidThisEmitInContextualObjectLiteral.ts new file mode 100644 index 00000000000..c01e4993950 --- /dev/null +++ b/tests/cases/compiler/invalidThisEmitInContextualObjectLiteral.ts @@ -0,0 +1,12 @@ +interface IDef { + p1: (e:string) => void; + p2: () => (n: number) => any; +} + +class TestController { + public m(def: IDef) { } + public p = this.m({ + p1: e => { }, + p2: () => { return vvvvvvvvv => this; }, + }); +} diff --git a/tests/cases/compiler/iteratorsAndStrictNullChecks.ts b/tests/cases/compiler/iteratorsAndStrictNullChecks.ts new file mode 100644 index 00000000000..5bc43343873 --- /dev/null +++ b/tests/cases/compiler/iteratorsAndStrictNullChecks.ts @@ -0,0 +1,12 @@ +// @target : ES6 +// @strictNullChecks: true + +// for..of +for (const x of ["a", "b"]) { + x.substring; +} + +// Spread +const xs = [1, 2, 3]; +const ys = [4, 5]; +xs.push(...ys); diff --git a/tests/cases/compiler/jsFileCompilationDecoratorSyntax.ts b/tests/cases/compiler/jsFileCompilationDecoratorSyntax.ts index 2ef95db01fe..6627fb5dca0 100644 --- a/tests/cases/compiler/jsFileCompilationDecoratorSyntax.ts +++ b/tests/cases/compiler/jsFileCompilationDecoratorSyntax.ts @@ -1,3 +1,5 @@ // @allowJs: true +// @noEmit: true +// @experimentalDecorators: true // @filename: a.js -@internal class C { } \ No newline at end of file +@internal class C { } diff --git a/tests/cases/compiler/jsFileCompilationRestParamJsDocFunction.ts b/tests/cases/compiler/jsFileCompilationRestParamJsDocFunction.ts new file mode 100644 index 00000000000..03ad2d1b2ff --- /dev/null +++ b/tests/cases/compiler/jsFileCompilationRestParamJsDocFunction.ts @@ -0,0 +1,27 @@ +// @allowJs: true +// @out: apply.js +// @module: amd + +// @filename: _apply.js +/** + * A faster alternative to `Function#apply`, this function invokes `func` + * with the `this` binding of `thisArg` and the arguments of `args`. + * + * @private + * @param {Function} func The function to invoke. + * @param {*} thisArg The `this` binding of `func`. + * @param {...*} args The arguments to invoke `func` with. + * @returns {*} Returns the result of `func`. + */ +function apply(func, thisArg, args) { + var length = args.length; + switch (length) { + case 0: return func.call(thisArg); + case 1: return func.call(thisArg, args[0]); + case 2: return func.call(thisArg, args[0], args[1]); + case 3: return func.call(thisArg, args[0], args[1], args[2]); + } + return func.apply(thisArg, args); +} + +export default apply; \ No newline at end of file diff --git a/tests/cases/compiler/json.stringify.ts b/tests/cases/compiler/json.stringify.ts new file mode 100644 index 00000000000..58400f859df --- /dev/null +++ b/tests/cases/compiler/json.stringify.ts @@ -0,0 +1,8 @@ +// @strictNullChecks: true + +var value = null; +JSON.stringify(value, undefined, 2); +JSON.stringify(value, null, 2); +JSON.stringify(value, ["a", 1], 2); +JSON.stringify(value, (k) => undefined, 2); +JSON.stringify(value, undefined, 2); \ No newline at end of file diff --git a/tests/cases/compiler/jsxPreserveWithJsInput.ts b/tests/cases/compiler/jsxPreserveWithJsInput.ts new file mode 100644 index 00000000000..f229e40a550 --- /dev/null +++ b/tests/cases/compiler/jsxPreserveWithJsInput.ts @@ -0,0 +1,18 @@ +// @outdir: out +// @jsx: preserve +// @allowjs: true + +// @filename: a.js +var elemA = 42; + +// @filename: b.jsx +var elemB = {"test"}; + +// @filename: c.js +var elemC = {42}; + +// @filename: d.ts +var elemD = 42; + +// @filename: e.tsx +var elemE = {true}; diff --git a/tests/cases/compiler/keepImportsInDts1.ts b/tests/cases/compiler/keepImportsInDts1.ts new file mode 100644 index 00000000000..50bdc5830a8 --- /dev/null +++ b/tests/cases/compiler/keepImportsInDts1.ts @@ -0,0 +1,7 @@ +// @module: amd +// @declaration: true + +// @filename: c:/test.d.ts +export {}; +// @filename: c:/app/main.ts +import "test" \ No newline at end of file diff --git a/tests/cases/compiler/keepImportsInDts2.ts b/tests/cases/compiler/keepImportsInDts2.ts new file mode 100644 index 00000000000..407526d7595 --- /dev/null +++ b/tests/cases/compiler/keepImportsInDts2.ts @@ -0,0 +1,7 @@ +// @module: amd +// @declaration: true + +// @filename: folder/test.ts +export {}; +// @filename: main.ts +import "./folder/test" \ No newline at end of file diff --git a/tests/cases/compiler/keepImportsInDts3.ts b/tests/cases/compiler/keepImportsInDts3.ts new file mode 100644 index 00000000000..cdd83dce132 --- /dev/null +++ b/tests/cases/compiler/keepImportsInDts3.ts @@ -0,0 +1,8 @@ +// @module: amd +// @declaration: true +// @out: outputfile.js + +// @filename: c:/test.ts +export {}; +// @filename: c:/app/main.ts +import "test" \ No newline at end of file diff --git a/tests/cases/compiler/keepImportsInDts4.ts b/tests/cases/compiler/keepImportsInDts4.ts new file mode 100644 index 00000000000..272932be488 --- /dev/null +++ b/tests/cases/compiler/keepImportsInDts4.ts @@ -0,0 +1,8 @@ +// @module: amd +// @declaration: true +// @out: outputfile.js + +// @filename: folder/test.ts +export {}; +// @filename: main.ts +import "./folder/test" \ No newline at end of file diff --git a/tests/cases/compiler/mergeWithImportedNamespace.ts b/tests/cases/compiler/mergeWithImportedNamespace.ts new file mode 100644 index 00000000000..79a94fd0ba4 --- /dev/null +++ b/tests/cases/compiler/mergeWithImportedNamespace.ts @@ -0,0 +1,10 @@ +// @module:commonjs +// @filename: f1.ts +export namespace N { export var x = 1; } + +// @filename: f2.ts +import {N} from "./f1"; +// partial revert of https://github.com/Microsoft/TypeScript/pull/7583 to prevent breaking changes +export namespace N { + export interface I {x: any} +} \ No newline at end of file diff --git a/tests/cases/compiler/mergeWithImportedType.ts b/tests/cases/compiler/mergeWithImportedType.ts new file mode 100644 index 00000000000..2310022012f --- /dev/null +++ b/tests/cases/compiler/mergeWithImportedType.ts @@ -0,0 +1,8 @@ +// @module:commonjs +// @filename: f1.ts +export enum E {X} + +// @filename: f2.ts +import {E} from "./f1"; +// partial revert of https://github.com/Microsoft/TypeScript/pull/7583 to prevent breaking changes +export type E = E; \ No newline at end of file diff --git a/tests/cases/compiler/mergedDeclarations5.ts b/tests/cases/compiler/mergedDeclarations5.ts new file mode 100644 index 00000000000..df5734453d3 --- /dev/null +++ b/tests/cases/compiler/mergedDeclarations5.ts @@ -0,0 +1,10 @@ +// @filename: a.ts +class A { + protected foo() {} +} +// @filename: b.ts +interface A { } + +class B extends A { + protected foo() {} +} \ No newline at end of file diff --git a/tests/cases/compiler/mergedDeclarations6.ts b/tests/cases/compiler/mergedDeclarations6.ts new file mode 100644 index 00000000000..406bed518c1 --- /dev/null +++ b/tests/cases/compiler/mergedDeclarations6.ts @@ -0,0 +1,23 @@ +// @module: amd + +// @filename: a.ts +export class A { + protected protected: any; + + protected setProtected(val: any) { + this.protected = val; + } +} + +// @filename: b.ts +import {A} from './a'; + +declare module "./a" { + interface A { } +} + +export class B extends A { + protected setProtected() { + + } +} \ No newline at end of file diff --git a/tests/cases/compiler/modularizeLibrary_ErrorFromUsingES6ArrayWithOnlyES6ArrayLib.ts b/tests/cases/compiler/modularizeLibrary_ErrorFromUsingES6ArrayWithOnlyES6ArrayLib.ts new file mode 100644 index 00000000000..3f6b9a5e35a --- /dev/null +++ b/tests/cases/compiler/modularizeLibrary_ErrorFromUsingES6ArrayWithOnlyES6ArrayLib.ts @@ -0,0 +1,9 @@ +// @lib: es2015.core +// @target: es5 + +// Error missing basic JavaScript objects +function f(x: number, y: number, z: number) { + return Array.from(arguments); +} + +f(1, 2, 3); diff --git a/tests/cases/compiler/modularizeLibrary_ErrorFromUsingES6FeaturesWithOnlyES5Lib.ts b/tests/cases/compiler/modularizeLibrary_ErrorFromUsingES6FeaturesWithOnlyES5Lib.ts new file mode 100644 index 00000000000..290cf0e4211 --- /dev/null +++ b/tests/cases/compiler/modularizeLibrary_ErrorFromUsingES6FeaturesWithOnlyES5Lib.ts @@ -0,0 +1,57 @@ +// @lib: es5 +// @target: es6 + +// All will be error from using ES6 features but only include ES5 library +// Using Es6 array +function f(x: number, y: number, z: number) { + return Array.from(arguments); +} + +f(1, 2, 3); // no error + +// Using ES6 collection +var m = new Map(); +m.clear(); +// Using ES6 iterable +m.keys(); + +// Using ES6 function +function Baz() { } +Baz.name; + +// Using ES6 math +Math.sign(1); + +// Using ES6 object +var o = { + a: 2, + [Symbol.hasInstance](value: any) { + return false; + } +}; +o.hasOwnProperty(Symbol.hasInstance); + +// Using Es6 proxy +var t = {} +var p = new Proxy(t, {}); + +// Using ES6 reflect +Reflect.isExtensible({}); + +// Using Es6 regexp +var reg = new RegExp("/s"); +reg.flags; + +// Using ES6 string +var str = "Hello world"; +str.includes("hello", 0); + +// Using ES6 symbol +var s = Symbol(); + +// Using ES6 wellknown-symbol +const o1 = { + [Symbol.hasInstance](value: any) { + return false; + } +} \ No newline at end of file diff --git a/tests/cases/compiler/modularizeLibrary_ErrorFromUsingWellknownSymbolWithOutES6WellknownSymbolLib.ts b/tests/cases/compiler/modularizeLibrary_ErrorFromUsingWellknownSymbolWithOutES6WellknownSymbolLib.ts new file mode 100644 index 00000000000..c3e1d616ea5 --- /dev/null +++ b/tests/cases/compiler/modularizeLibrary_ErrorFromUsingWellknownSymbolWithOutES6WellknownSymbolLib.ts @@ -0,0 +1,9 @@ +// @lib: es5,es2015.core + +function f(x: number, y: number, z: number) { + return Array.from(arguments); +} + +f(1, 2, 3); // no error +let a = ['c', 'd']; +a[Symbol.isConcatSpreadable] = false; \ No newline at end of file diff --git a/tests/cases/compiler/modularizeLibrary_NoErrorDuplicateLibOptions1.ts b/tests/cases/compiler/modularizeLibrary_NoErrorDuplicateLibOptions1.ts new file mode 100644 index 00000000000..4b2a88c1320 --- /dev/null +++ b/tests/cases/compiler/modularizeLibrary_NoErrorDuplicateLibOptions1.ts @@ -0,0 +1,83 @@ +// @lib: es5,es6,es6 +// @target: es6 + +// Using Es6 array +function f(x: number, y: number, z: number) { + return Array.from(arguments); +} + +f(1, 2, 3); // no error + +// Using ES6 collection +var m = new Map(); +m.clear(); +// Using ES6 iterable +m.keys(); + +// Using ES6 function +function Baz() { } +Baz.name; + +// Using ES6 generator +function* gen() { + let i = 0; + while (i < 10) { + yield i; + i++; + } +} + +function* gen2() { + let i = 0; + while (i < 10) { + yield i; + i++; + } +} + +// Using ES6 math +Math.sign(1); + +// Using ES6 object +var o = { + a: 2, + [Symbol.hasInstance](value: any) { + return false; + } +}; +o.hasOwnProperty(Symbol.hasInstance); + +// Using ES6 promise +async function out() { + return new Promise(function (resolve, reject) {}); +} + +declare var console: any; +out().then(() => { + console.log("Yea!"); +}); + +// Using Es6 proxy +var t = {} +var p = new Proxy(t, {}); + +// Using ES6 reflect +Reflect.isExtensible({}); + +// Using Es6 regexp +var reg = new RegExp("/s"); +reg.flags; + +// Using ES6 string +var str = "Hello world"; +str.includes("hello", 0); + +// Using ES6 symbol +var s = Symbol(); + +// Using ES6 wellknown-symbol +const o1 = { + [Symbol.hasInstance](value: any) { + return false; + } +} \ No newline at end of file diff --git a/tests/cases/compiler/modularizeLibrary_NoErrorDuplicateLibOptions2.ts b/tests/cases/compiler/modularizeLibrary_NoErrorDuplicateLibOptions2.ts new file mode 100644 index 00000000000..9ddfac81223 --- /dev/null +++ b/tests/cases/compiler/modularizeLibrary_NoErrorDuplicateLibOptions2.ts @@ -0,0 +1,83 @@ +// @lib: es5,es2015,es2015.core,es2015.symbol.wellknown +// @target: es6 + +// Using Es6 array +function f(x: number, y: number, z: number) { + return Array.from(arguments); +} + +f(1, 2, 3); // no error + +// Using ES6 collection +var m = new Map(); +m.clear(); +// Using ES6 iterable +m.keys(); + +// Using ES6 function +function Baz() { } +Baz.name; + +// Using ES6 generator +function* gen() { + let i = 0; + while (i < 10) { + yield i; + i++; + } +} + +function* gen2() { + let i = 0; + while (i < 10) { + yield i; + i++; + } +} + +// Using ES6 math +Math.sign(1); + +// Using ES6 object +var o = { + a: 2, + [Symbol.hasInstance](value: any) { + return false; + } +}; +o.hasOwnProperty(Symbol.hasInstance); + +// Using ES6 promise +async function out() { + return new Promise(function (resolve, reject) {}); +} + +declare var console: any; +out().then(() => { + console.log("Yea!"); +}); + +// Using Es6 proxy +var t = {} +var p = new Proxy(t, {}); + +// Using ES6 reflect +Reflect.isExtensible({}); + +// Using Es6 regexp +var reg = new RegExp("/s"); +reg.flags; + +// Using ES6 string +var str = "Hello world"; +str.includes("hello", 0); + +// Using ES6 symbol +var s = Symbol(); + +// Using ES6 wellknown-symbol +const o1 = { + [Symbol.hasInstance](value: any) { + return false; + } +} \ No newline at end of file diff --git a/tests/cases/compiler/modularizeLibrary_TargetES5UsingES6Lib.ts b/tests/cases/compiler/modularizeLibrary_TargetES5UsingES6Lib.ts new file mode 100644 index 00000000000..e308912757b --- /dev/null +++ b/tests/cases/compiler/modularizeLibrary_TargetES5UsingES6Lib.ts @@ -0,0 +1,83 @@ +// @lib: es5,es6 +// @target: es6 + +// Using Es6 array +function f(x: number, y: number, z: number) { + return Array.from(arguments); +} + +f(1, 2, 3); // no error + +// Using ES6 collection +var m = new Map(); +m.clear(); +// Using ES6 iterable +m.keys(); + +// Using ES6 function +function Baz() { } +Baz.name; + +// Using ES6 generator +function* gen() { + let i = 0; + while (i < 10) { + yield i; + i++; + } +} + +function* gen2() { + let i = 0; + while (i < 10) { + yield i; + i++; + } +} + +// Using ES6 math +Math.sign(1); + +// Using ES6 object +var o = { + a: 2, + [Symbol.hasInstance](value: any) { + return false; + } +}; +o.hasOwnProperty(Symbol.hasInstance); + +// Using ES6 promise +async function out() { + return new Promise(function (resolve, reject) {}); +} + +declare var console: any; +out().then(() => { + console.log("Yea!"); +}); + +// Using Es6 proxy +var t = {} +var p = new Proxy(t, {}); + +// Using ES6 reflect +Reflect.isExtensible({}); + +// Using Es6 regexp +var reg = new RegExp("/s"); +reg.flags; + +// Using ES6 string +var str = "Hello world"; +str.includes("hello", 0); + +// Using ES6 symbol +var s = Symbol(); + +// Using ES6 wellknown-symbol +const o1 = { + [Symbol.hasInstance](value: any) { + return false; + } +} \ No newline at end of file diff --git a/tests/cases/compiler/modularizeLibrary_TargetES6UsingES6Lib.ts b/tests/cases/compiler/modularizeLibrary_TargetES6UsingES6Lib.ts new file mode 100644 index 00000000000..3a938fe1a69 --- /dev/null +++ b/tests/cases/compiler/modularizeLibrary_TargetES6UsingES6Lib.ts @@ -0,0 +1,56 @@ +// @lib: es6 +// @target: es6 + +// Using Es6 array +function f(x: number, y: number, z: number) { + return Array.from(arguments); +} + +f(1, 2, 3); // no error + +// Using ES6 collection +var m = new Map(); +m.clear(); +// Using ES6 iterable +m.keys(); + +// Using ES6 function +function Baz() { } +Baz.name; + +// Using ES6 math +Math.sign(1); + +// Using ES6 object +var o = { + a: 2, + [Symbol.hasInstance](value: any) { + return false; + } +}; +o.hasOwnProperty(Symbol.hasInstance); + +// Using Es6 proxy +var t = {} +var p = new Proxy(t, {}); + +// Using ES6 reflect +Reflect.isExtensible({}); + +// Using Es6 regexp +var reg = new RegExp("/s"); +reg.flags; + +// Using ES6 string +var str = "Hello world"; +str.includes("hello", 0); + +// Using ES6 symbol +var s = Symbol(); + +// Using ES6 wellknown-symbol +const o1 = { + [Symbol.hasInstance](value: any) { + return false; + } +} \ No newline at end of file diff --git a/tests/cases/compiler/modularizeLibrary_UsingES5LibAndES6ArrayLib.ts b/tests/cases/compiler/modularizeLibrary_UsingES5LibAndES6ArrayLib.ts new file mode 100644 index 00000000000..b7697af1f7f --- /dev/null +++ b/tests/cases/compiler/modularizeLibrary_UsingES5LibAndES6ArrayLib.ts @@ -0,0 +1,9 @@ +// @lib: es5,es2015.core +// @target: es5 + +// No error +function f(x: number, y: number, z: number) { + return Array.from(arguments); +} + +f(1, 2, 3); \ No newline at end of file diff --git a/tests/cases/compiler/modularizeLibrary_UsingES5LibAndES6FeatureLibs.ts b/tests/cases/compiler/modularizeLibrary_UsingES5LibAndES6FeatureLibs.ts new file mode 100644 index 00000000000..327df2e679f --- /dev/null +++ b/tests/cases/compiler/modularizeLibrary_UsingES5LibAndES6FeatureLibs.ts @@ -0,0 +1,15 @@ +// @lib: es5,es2015.core,es2015.symbol,es2015.proxy,es2015.generator,es2015.iterable,es2015.reflect +// @target: es6 + +var s = Symbol(); +var t = {}; +var p = new Proxy(t, {}); + +Reflect.ownKeys({}); + +function* idGen() { + let i = 10; + while (i < 20) { + yield i + 2; + } +} diff --git a/tests/cases/compiler/modularizeLibrary_UsingES5LibES6ArrayLibES6WellknownSymbolLib.ts b/tests/cases/compiler/modularizeLibrary_UsingES5LibES6ArrayLibES6WellknownSymbolLib.ts new file mode 100644 index 00000000000..51a0ee5d1f5 --- /dev/null +++ b/tests/cases/compiler/modularizeLibrary_UsingES5LibES6ArrayLibES6WellknownSymbolLib.ts @@ -0,0 +1,9 @@ +// @lib: es5,es2015.core,es2015.symbol.wellknown + +function f(x: number, y: number, z: number) { + return Array.from(arguments); +} + +f(1, 2, 3); // no error +let a = ['c', 'd']; +a[Symbol.isConcatSpreadable] = false; \ No newline at end of file diff --git a/tests/cases/compiler/moduleAugmentationCollidingNamesInAugmentation1.ts b/tests/cases/compiler/moduleAugmentationCollidingNamesInAugmentation1.ts new file mode 100644 index 00000000000..7cbb78a333b --- /dev/null +++ b/tests/cases/compiler/moduleAugmentationCollidingNamesInAugmentation1.ts @@ -0,0 +1,33 @@ +// @module: amd +// @declaration: true + +// @filename: map1.ts +import { Observable } from "./observable" + +(Observable.prototype).map = function() { } + +declare module "./observable" { + interface I {x0} +} + +// @filename: map2.ts +import { Observable } from "./observable" + +(Observable.prototype).map = function() { } + +declare module "./observable" { + interface I {x1} +} + + +// @filename: observable.ts +export declare class Observable { + filter(pred: (e:T) => boolean): Observable; +} + +// @filename: main.ts +import { Observable } from "./observable" +import "./map1"; +import "./map2"; + +let x: Observable; diff --git a/tests/cases/compiler/moduleAugmentationDeclarationEmit1.ts b/tests/cases/compiler/moduleAugmentationDeclarationEmit1.ts new file mode 100644 index 00000000000..460cdfc53b6 --- /dev/null +++ b/tests/cases/compiler/moduleAugmentationDeclarationEmit1.ts @@ -0,0 +1,33 @@ +// @module: commonjs +// @declaration: true + +// @filename: map.ts +import { Observable } from "./observable" + +(Observable.prototype).map = function() { } + +declare module "./observable" { + interface Observable { + map(proj: (e:T) => U): Observable + } + namespace Observable { + let someAnotherValue: number; + } +} + +// @filename: observable.ts +export declare class Observable { + filter(pred: (e:T) => boolean): Observable; +} + +export namespace Observable { + let someValue: number; +} + + +// @filename: main.ts +import { Observable } from "./observable" +import "./map"; + +let x: Observable; +let y = x.map(x => x + 1); \ No newline at end of file diff --git a/tests/cases/compiler/moduleAugmentationDeclarationEmit2.ts b/tests/cases/compiler/moduleAugmentationDeclarationEmit2.ts new file mode 100644 index 00000000000..22cb4392675 --- /dev/null +++ b/tests/cases/compiler/moduleAugmentationDeclarationEmit2.ts @@ -0,0 +1,35 @@ +// @module: commonjs +// @declaration: true + +// @filename: map.ts +import { Observable } from "./observable" + +(Observable.prototype).map = function() { } + +declare module "./observable" { + interface Observable { + map(proj: (e:T) => U): Observable + } + namespace Observable { + let someAnotherValue: string; + } +} + +// @filename: observable.ts +export declare class Observable { + filter(pred: (e:T) => boolean): Observable; +} + +export namespace Observable { + export let someValue: number; +} + + +// @filename: main.ts +import { Observable } from "./observable" +import "./map"; + +let x: Observable; +let y = x.map(x => x + 1); +let z1 = Observable.someValue.toFixed(); +let z2 = Observable.someAnotherValue.toLowerCase(); \ No newline at end of file diff --git a/tests/cases/compiler/moduleAugmentationDisallowedExtensions.ts b/tests/cases/compiler/moduleAugmentationDisallowedExtensions.ts new file mode 100644 index 00000000000..b4b286db502 --- /dev/null +++ b/tests/cases/compiler/moduleAugmentationDisallowedExtensions.ts @@ -0,0 +1,46 @@ +// @module: commonjs + +// @filename: x0.ts +export let a = 1; + +// @filename: x.ts + +namespace N1 { + export let x = 1; +} + +declare module "./observable" { + var x: number; + let y: number; + const z: number; + let {x1, y1, z0: {n}, z1: {arr: [el1, el2, el3]}}: {x1: number, y1: string, z0: {n: number}, z1: {arr: number[]} } + interface A { x } + namespace N { + export class C {} + } + class Cls {} + function foo(): number; + type T = number; + import * as all from "./x0"; + import {a} from "./x0"; + export * from "./x0"; + export {a} from "./x0"; +} + +declare module "./test" { + export = N1; +} +export {} + +// @filename: observable.ts +export declare class Observable { + filter(pred: (e:T) => boolean): Observable; +} +export var x = 1; + +// @filename: test.ts +export let b = 1; + +// @filename: main.ts +import { Observable } from "./observable" +import "./x"; diff --git a/tests/cases/compiler/moduleAugmentationExtendAmbientModule1.ts b/tests/cases/compiler/moduleAugmentationExtendAmbientModule1.ts new file mode 100644 index 00000000000..b8b144fcc14 --- /dev/null +++ b/tests/cases/compiler/moduleAugmentationExtendAmbientModule1.ts @@ -0,0 +1,34 @@ +// @module: commonjs + +// @filename: map.ts +import { Observable } from "observable" + +(Observable.prototype).map = function() { } + +declare module "observable" { + interface Observable { + map(proj: (e:T) => U): Observable + } + namespace Observable { + let someAnotherValue: number; + } +} + +// @filename: observable.d.ts +declare module "observable" { + class Observable { + filter(pred: (e:T) => boolean): Observable; + } + namespace Observable { + let someValue: number; + } +} + +// @filename: main.ts + +/// +import { Observable } from "observable" +import "./map"; + +let x: Observable; +let y = x.map(x => x + 1); \ No newline at end of file diff --git a/tests/cases/compiler/moduleAugmentationExtendAmbientModule2.ts b/tests/cases/compiler/moduleAugmentationExtendAmbientModule2.ts new file mode 100644 index 00000000000..6e6614ce9f7 --- /dev/null +++ b/tests/cases/compiler/moduleAugmentationExtendAmbientModule2.ts @@ -0,0 +1,37 @@ +// @module: commonjs +// @declaration: true + +// @filename: map.ts +import { Observable } from "observable" + +(Observable.prototype).map = function() { } + +declare module "observable" { + interface Observable { + map(proj: (e:T) => U): Observable + } + namespace Observable { + let someAnotherValue: string; + } +} + +// @filename: observable.d.ts +declare module "observable" { + class Observable { + filter(pred: (e:T) => boolean): Observable; + } + namespace Observable { + export let someValue: number; + } +} + +// @filename: main.ts + +/// +import { Observable } from "observable" +import "./map"; + +let x: Observable; +let y = x.map(x => x + 1); +let z1 = Observable.someValue.toFixed(); +let z2 = Observable.someAnotherValue.toLowerCase(); \ No newline at end of file diff --git a/tests/cases/compiler/moduleAugmentationExtendFileModule1.ts b/tests/cases/compiler/moduleAugmentationExtendFileModule1.ts new file mode 100644 index 00000000000..f87757b4871 --- /dev/null +++ b/tests/cases/compiler/moduleAugmentationExtendFileModule1.ts @@ -0,0 +1,32 @@ +// @module: commonjs + +// @filename: map.ts +import { Observable } from "./observable" + +(Observable.prototype).map = function() { } + +declare module "./observable" { + interface Observable { + map(proj: (e:T) => U): Observable + } + namespace Observable { + let someAnotherValue: number; + } +} + +// @filename: observable.ts +export declare class Observable { + filter(pred: (e:T) => boolean): Observable; +} + +export namespace Observable { + let someValue: number; +} + + +// @filename: main.ts +import { Observable } from "./observable" +import "./map"; + +let x: Observable; +let y = x.map(x => x + 1); \ No newline at end of file diff --git a/tests/cases/compiler/moduleAugmentationExtendFileModule2.ts b/tests/cases/compiler/moduleAugmentationExtendFileModule2.ts new file mode 100644 index 00000000000..454e5148790 --- /dev/null +++ b/tests/cases/compiler/moduleAugmentationExtendFileModule2.ts @@ -0,0 +1,34 @@ +// @module: commonjs + +// @filename: map.ts +import { Observable } from "./observable" + +(Observable.prototype).map = function() { } + +declare module "./observable" { + interface Observable { + map(proj: (e:T) => U): Observable + } + namespace Observable { + let someAnotherValue: string; + } +} + +// @filename: observable.ts +export declare class Observable { + filter(pred: (e:T) => boolean): Observable; +} + +export namespace Observable { + export let someValue: number; +} + + +// @filename: main.ts +import { Observable } from "./observable" +import "./map"; + +let x: Observable; +let y = x.map(x => x + 1); +let z1 = Observable.someValue.toFixed(); +let z2 = Observable.someAnotherValue.toLowerCase(); \ No newline at end of file diff --git a/tests/cases/compiler/moduleAugmentationGlobal1.ts b/tests/cases/compiler/moduleAugmentationGlobal1.ts new file mode 100644 index 00000000000..bef373ff139 --- /dev/null +++ b/tests/cases/compiler/moduleAugmentationGlobal1.ts @@ -0,0 +1,18 @@ +// @module: commonjs +// @declaration: true + +// @filename: f1.ts +export class A {x: number;} + +// @filename: f2.ts +import {A} from "./f1"; + +// change the shape of Array +declare global { + interface Array { + getA(): A; + } +} + +let x = [1]; +let y = x.getA().x; diff --git a/tests/cases/compiler/moduleAugmentationGlobal2.ts b/tests/cases/compiler/moduleAugmentationGlobal2.ts new file mode 100644 index 00000000000..5a5c44f1109 --- /dev/null +++ b/tests/cases/compiler/moduleAugmentationGlobal2.ts @@ -0,0 +1,18 @@ +// @module: commonjs +// @declaration: true + +// @filename: f1.ts +export class A {}; +// @filename: f2.ts + +// change the shape of Array +import {A} from "./f1"; + +declare global { + interface Array { + getCountAsString(): string; + } +} + +let x = [1]; +let y = x.getCountAsString().toLowerCase(); diff --git a/tests/cases/compiler/moduleAugmentationGlobal3.ts b/tests/cases/compiler/moduleAugmentationGlobal3.ts new file mode 100644 index 00000000000..5986b689c55 --- /dev/null +++ b/tests/cases/compiler/moduleAugmentationGlobal3.ts @@ -0,0 +1,21 @@ +// @module: commonjs +// @declaration: true + +// @filename: f1.ts +export class A {}; +// @filename: f2.ts + +// change the shape of Array +import {A} from "./f1"; + +declare global { + interface Array { + getCountAsString(): string; + } +} + +// @filename: f3.ts +import "./f2"; + +let x = [1]; +let y = x.getCountAsString().toLowerCase(); diff --git a/tests/cases/compiler/moduleAugmentationGlobal4.ts b/tests/cases/compiler/moduleAugmentationGlobal4.ts new file mode 100644 index 00000000000..44ba2ba9c57 --- /dev/null +++ b/tests/cases/compiler/moduleAugmentationGlobal4.ts @@ -0,0 +1,18 @@ +// @module: commonjs +// @declaration: true + +// @filename: f1.ts +declare global { + interface Something {x} +} +export {}; +// @filename: f2.ts + +declare global { + interface Something {y} +} +export {}; +// @filename: f3.ts +import "./f1"; +import "./f2"; + diff --git a/tests/cases/compiler/moduleAugmentationGlobal5.ts b/tests/cases/compiler/moduleAugmentationGlobal5.ts new file mode 100644 index 00000000000..6d2920fd55f --- /dev/null +++ b/tests/cases/compiler/moduleAugmentationGlobal5.ts @@ -0,0 +1,21 @@ +// @module: commonjs +// @declaration: true + +// @filename: f1.d.ts +declare module "A" { + global { + interface Something {x} + } +} +// @filename: f2.d.ts +declare module "B" { + global { + interface Something {y} + } +} +// @filename: f3.ts +/// +/// +import "A"; +import "B"; + diff --git a/tests/cases/compiler/moduleAugmentationGlobal6.ts b/tests/cases/compiler/moduleAugmentationGlobal6.ts new file mode 100644 index 00000000000..37e5e33725b --- /dev/null +++ b/tests/cases/compiler/moduleAugmentationGlobal6.ts @@ -0,0 +1,3 @@ +declare global { + interface Array { x } +} \ No newline at end of file diff --git a/tests/cases/compiler/moduleAugmentationGlobal6_1.ts b/tests/cases/compiler/moduleAugmentationGlobal6_1.ts new file mode 100644 index 00000000000..d255b7f8319 --- /dev/null +++ b/tests/cases/compiler/moduleAugmentationGlobal6_1.ts @@ -0,0 +1,3 @@ +global { + interface Array { x } +} \ No newline at end of file diff --git a/tests/cases/compiler/moduleAugmentationGlobal7.ts b/tests/cases/compiler/moduleAugmentationGlobal7.ts new file mode 100644 index 00000000000..66dd41c8bc9 --- /dev/null +++ b/tests/cases/compiler/moduleAugmentationGlobal7.ts @@ -0,0 +1,5 @@ +namespace A { + declare global { + interface Array { x } + } +} \ No newline at end of file diff --git a/tests/cases/compiler/moduleAugmentationGlobal7_1.ts b/tests/cases/compiler/moduleAugmentationGlobal7_1.ts new file mode 100644 index 00000000000..b7d99dfd413 --- /dev/null +++ b/tests/cases/compiler/moduleAugmentationGlobal7_1.ts @@ -0,0 +1,5 @@ +namespace A { + global { + interface Array { x } + } +} \ No newline at end of file diff --git a/tests/cases/compiler/moduleAugmentationGlobal8.ts b/tests/cases/compiler/moduleAugmentationGlobal8.ts new file mode 100644 index 00000000000..e28b07d6bfd --- /dev/null +++ b/tests/cases/compiler/moduleAugmentationGlobal8.ts @@ -0,0 +1,8 @@ +// @target: es5 +// @module: amd +namespace A { + declare global { + interface Array { x } + } +} +export {} diff --git a/tests/cases/compiler/moduleAugmentationGlobal8_1.ts b/tests/cases/compiler/moduleAugmentationGlobal8_1.ts new file mode 100644 index 00000000000..9031e4742b0 --- /dev/null +++ b/tests/cases/compiler/moduleAugmentationGlobal8_1.ts @@ -0,0 +1,8 @@ +// @target: es5 +// @module: amd +namespace A { + global { + interface Array { x } + } +} +export {} diff --git a/tests/cases/compiler/moduleAugmentationImportsAndExports1.ts b/tests/cases/compiler/moduleAugmentationImportsAndExports1.ts new file mode 100644 index 00000000000..165057cf025 --- /dev/null +++ b/tests/cases/compiler/moduleAugmentationImportsAndExports1.ts @@ -0,0 +1,28 @@ +// @module: commonjs +// @declaration: true + +// @filename: f1.ts +export class A {} + +// @filename: f2.ts +export class B { + n: number; +} + +// @filename: f3.ts +import {A} from "./f1"; +import {B} from "./f2"; + +A.prototype.foo = function () { return undefined; } +declare module "./f1" { + interface A { + foo(): B; + } +} + +// @filename: f4.ts +import {A} from "./f1"; +import "./f3"; + +let a: A; +let b = a.foo().n; \ No newline at end of file diff --git a/tests/cases/compiler/moduleAugmentationImportsAndExports2.ts b/tests/cases/compiler/moduleAugmentationImportsAndExports2.ts new file mode 100644 index 00000000000..8e76475c404 --- /dev/null +++ b/tests/cases/compiler/moduleAugmentationImportsAndExports2.ts @@ -0,0 +1,40 @@ +// @module: commonjs +// @declaration: true + +// @filename: f1.ts +export class A {} + +// @filename: f2.ts +export class B { + n: number; +} + +// @filename: f3.ts +import {A} from "./f1"; + +A.prototype.foo = function () { return undefined; } + +namespace N { + export interface Ifc { a } + export interface Cls { a } +} + +declare module "./f1" { + import {B} from "./f2"; + export {B} from "./f2"; + import I = N.Ifc; + import C = N.Cls; + // should have explicit export + interface A { + foo(): B; + bar(): I; + baz(): C; + } +} + +// @filename: f4.ts +import {A} from "./f1"; +import "./f3"; + +let a: A; +let b = a.foo().n; \ No newline at end of file diff --git a/tests/cases/compiler/moduleAugmentationImportsAndExports3.ts b/tests/cases/compiler/moduleAugmentationImportsAndExports3.ts new file mode 100644 index 00000000000..ea1d5e435da --- /dev/null +++ b/tests/cases/compiler/moduleAugmentationImportsAndExports3.ts @@ -0,0 +1,38 @@ +// @module: commonjs +// @declaration: true + +// @filename: f1.ts +export class A {} + +// @filename: f2.ts +export class B { + n: number; +} + +// @filename: f3.ts +import {A} from "./f1"; + +A.prototype.foo = function () { return undefined; } + +namespace N { + export interface Ifc { a } + export interface Cls { a } +} + +declare module "./f1" { + import {B} from "./f2"; + import I = N.Ifc; + import C = N.Cls; + interface A { + foo(): B; + bar(): I; + baz(): C; + } +} + +// @filename: f4.ts +import {A} from "./f1"; +import "./f3"; + +let a: A; +let b = a.foo().n; \ No newline at end of file diff --git a/tests/cases/compiler/moduleAugmentationImportsAndExports4.ts b/tests/cases/compiler/moduleAugmentationImportsAndExports4.ts new file mode 100644 index 00000000000..3f3b9e19400 --- /dev/null +++ b/tests/cases/compiler/moduleAugmentationImportsAndExports4.ts @@ -0,0 +1,39 @@ +// @module: commonjs + +// @filename: f1.ts +export class A {} + +// @filename: f2.ts +export class B { + n: number; +} + +// @filename: f3.ts +import {A} from "./f1"; +import {B} from "./f2"; + +A.prototype.foo = function () { return undefined; } + +namespace N { + export interface Ifc { a: number; } + export interface Cls { b: number; } +} +import I = N.Ifc; +import C = N.Cls; + +declare module "./f1" { + interface A { + foo(): B; + bar(): I; + baz(): C; + } +} + +// @filename: f4.ts +import {A} from "./f1"; +import "./f3"; + +let a: A; +let b = a.foo().n; +let c = a.bar().a; +let d = a.baz().b; \ No newline at end of file diff --git a/tests/cases/compiler/moduleAugmentationImportsAndExports5.ts b/tests/cases/compiler/moduleAugmentationImportsAndExports5.ts new file mode 100644 index 00000000000..8dbff8f7cc9 --- /dev/null +++ b/tests/cases/compiler/moduleAugmentationImportsAndExports5.ts @@ -0,0 +1,40 @@ +// @module: commonjs +// @declaration: true + +// @filename: f1.ts +export class A {} + +// @filename: f2.ts +export class B { + n: number; +} + +// @filename: f3.ts +import {A} from "./f1"; +import {B} from "./f2"; + +A.prototype.foo = function () { return undefined; } + +namespace N { + export interface Ifc { a: number; } + export interface Cls { b: number; } +} +import I = N.Ifc; +import C = N.Cls; + +declare module "./f1" { + interface A { + foo(): B; + bar(): I; + baz(): C; + } +} + +// @filename: f4.ts +import {A} from "./f1"; +import "./f3"; + +let a: A; +let b = a.foo().n; +let c = a.bar().a; +let d = a.baz().b; \ No newline at end of file diff --git a/tests/cases/compiler/moduleAugmentationImportsAndExports6.ts b/tests/cases/compiler/moduleAugmentationImportsAndExports6.ts new file mode 100644 index 00000000000..e9e216cbbbe --- /dev/null +++ b/tests/cases/compiler/moduleAugmentationImportsAndExports6.ts @@ -0,0 +1,40 @@ +// @module: commonjs +// @declaration: true + +// @filename: f1.ts +export class A {} + +// @filename: f2.ts +export class B { + n: number; +} + +// @filename: f3.ts +import {A} from "./f1"; +import {B} from "./f2"; + +A.prototype.foo = function () { return undefined; } + +export namespace N { + export interface Ifc { a: number; } + export interface Cls { b: number; } +} +import I = N.Ifc; +import C = N.Cls; + +declare module "./f1" { + interface A { + foo(): B; + bar(): I; + baz(): C; + } +} + +// @filename: f4.ts +import {A} from "./f1"; +import "./f3"; + +let a: A; +let b = a.foo().n; +let c = a.bar().a; +let d = a.baz().b; \ No newline at end of file diff --git a/tests/cases/compiler/moduleAugmentationInAmbientModule1.ts b/tests/cases/compiler/moduleAugmentationInAmbientModule1.ts new file mode 100644 index 00000000000..07b7ccb99ca --- /dev/null +++ b/tests/cases/compiler/moduleAugmentationInAmbientModule1.ts @@ -0,0 +1,28 @@ +// @module: commonjs +// @declaration: true + +// @filename: O.d.ts + +declare module "Observable" { + class Observable {} +} + +declare module "M" { + class Cls { x: number } +} + +declare module "Map" { + import { Cls } from "M"; + module "Observable" { + interface Observable { + foo(): Cls; + } + } +} + +// @filename: main.ts +/// + +import {Observable} from "Observable"; +let x: Observable; +x.foo().x; diff --git a/tests/cases/compiler/moduleAugmentationInAmbientModule2.ts b/tests/cases/compiler/moduleAugmentationInAmbientModule2.ts new file mode 100644 index 00000000000..e2979478574 --- /dev/null +++ b/tests/cases/compiler/moduleAugmentationInAmbientModule2.ts @@ -0,0 +1,28 @@ +// @module: commonjs +// @declaration: true; +// @filename: O.d.ts + +declare module "Observable" { + class Observable {} +} + +declare module "M" { + class Cls { x: number } +} + +declare module "Map" { + import { Cls } from "M"; + module "Observable" { + interface Observable { + foo(): Cls; + } + } +} + +// @filename: main.ts +/// + +import {Observable} from "Observable"; +import "Map"; +let x: Observable; +x.foo().x; diff --git a/tests/cases/compiler/moduleAugmentationInAmbientModule3.ts b/tests/cases/compiler/moduleAugmentationInAmbientModule3.ts new file mode 100644 index 00000000000..bc233294ed4 --- /dev/null +++ b/tests/cases/compiler/moduleAugmentationInAmbientModule3.ts @@ -0,0 +1,38 @@ +// @module: commonjs +// @declaration: true; +// @filename: O.d.ts + +declare module "Observable" { + class Observable {} +} + +declare module "M" { + class Cls { x: number } +} + +declare module "Map" { + import { Cls } from "M"; + module "Observable" { + interface Observable { + foo(): Cls; + } + } +} + +declare module "Map" { + class Cls2 { x2: number } + module "Observable" { + interface Observable { + foo2(): Cls2; + } + } +} + +// @filename: main.ts +/// + +import {Observable} from "Observable"; +import "Map"; +let x: Observable; +x.foo().x; +x.foo2().x2; diff --git a/tests/cases/compiler/moduleAugmentationInAmbientModule4.ts b/tests/cases/compiler/moduleAugmentationInAmbientModule4.ts new file mode 100644 index 00000000000..59386ad3d08 --- /dev/null +++ b/tests/cases/compiler/moduleAugmentationInAmbientModule4.ts @@ -0,0 +1,40 @@ +// @module: commonjs +// @declaration: true; +// @filename: O.d.ts + +declare module "Observable" { + class Observable {} +} + +declare module "M" { + class Cls { x: number } +} + +declare module "Map" { + import { Cls } from "M"; + module "Observable" { + interface Observable { + foo(): Cls; + } + } +} + +// @filename: O2.d.ts +declare module "Map" { + class Cls2 { x2: number } + module "Observable" { + interface Observable { + foo2(): Cls2; + } + } +} + +// @filename: main.ts +/// +/// + +import {Observable} from "Observable"; +import "Map"; +let x: Observable; +x.foo().x; +x.foo2().x2; diff --git a/tests/cases/compiler/moduleAugmentationInAmbientModule5.ts b/tests/cases/compiler/moduleAugmentationInAmbientModule5.ts new file mode 100644 index 00000000000..5068ba396c3 --- /dev/null +++ b/tests/cases/compiler/moduleAugmentationInAmbientModule5.ts @@ -0,0 +1,23 @@ +// @module: commonjs +// @declaration: true + +// @filename: array.d.ts +declare module "A" { + class A { x: number; } +} + +declare module "array" { + import {A} from "A"; + global { + interface Array { + getA(): A; + } + } +} + +// @filename: f.ts +/// +import "array"; + +let x = [1]; +let y = x.getA().x; diff --git a/tests/cases/compiler/moduleAugmentationInDependency.ts b/tests/cases/compiler/moduleAugmentationInDependency.ts new file mode 100644 index 00000000000..23d10edbd74 --- /dev/null +++ b/tests/cases/compiler/moduleAugmentationInDependency.ts @@ -0,0 +1,7 @@ +// @filename: /node_modules/A/index.d.ts +declare module "ext" { +} +export {}; + +// @filename: /src/app.ts +import "A" \ No newline at end of file diff --git a/tests/cases/compiler/moduleAugmentationInDependency2.ts b/tests/cases/compiler/moduleAugmentationInDependency2.ts new file mode 100644 index 00000000000..189e020fd2e --- /dev/null +++ b/tests/cases/compiler/moduleAugmentationInDependency2.ts @@ -0,0 +1,7 @@ +// @filename: /node_modules/A/index.ts +declare module "ext" { +} +export {}; + +// @filename: /src/app.ts +import "A" \ No newline at end of file diff --git a/tests/cases/compiler/moduleAugmentationNoNewNames.ts b/tests/cases/compiler/moduleAugmentationNoNewNames.ts new file mode 100644 index 00000000000..2ab82ba5f0b --- /dev/null +++ b/tests/cases/compiler/moduleAugmentationNoNewNames.ts @@ -0,0 +1,28 @@ +// @module: commonjs + +// @filename: map.ts +import { Observable } from "./observable" + +(Observable.prototype).map = function() { } + +declare module "./observable" { + interface Observable { + map(proj: (e:T) => U): Observable + } + class Bar {} + let y: number, z: string; + let {a: x, b: x1}: {a: number, b: number}; + module Z {} +} + +// @filename: observable.ts +export declare class Observable { + filter(pred: (e:T) => boolean): Observable; +} + +// @filename: main.ts +import { Observable } from "./observable" +import "./map"; + +let x: Observable; +let y = x.map(x => x + 1); \ No newline at end of file diff --git a/tests/cases/compiler/moduleAugmentationsBundledOutput1.ts b/tests/cases/compiler/moduleAugmentationsBundledOutput1.ts new file mode 100644 index 00000000000..e633e355d80 --- /dev/null +++ b/tests/cases/compiler/moduleAugmentationsBundledOutput1.ts @@ -0,0 +1,57 @@ +// @target: es5 +// @module: amd +// @declaration: true +// @out: out.js + +// @filename: m1.ts +export class Cls { +} + +// @filename: m2.ts +import {Cls} from "./m1"; +(Cls.prototype).foo = function() { return 1; }; +(Cls.prototype).bar = function() { return "1"; }; + +declare module "./m1" { + interface Cls { + foo(): number; + } +} + +declare module "./m1" { + interface Cls { + bar(): string; + } +} + +// @filename: m3.ts +export class C1 { x: number } +export class C2 { x: string } + +// @filename: m4.ts +import {Cls} from "./m1"; +import {C1, C2} from "./m3"; +(Cls.prototype).baz1 = function() { return undefined }; +(Cls.prototype).baz2 = function() { return undefined }; + +declare module "./m1" { + interface Cls { + baz1(): C1; + } +} + +declare module "./m1" { + interface Cls { + baz2(): C2; + } +} + +// @filename: test.ts +import { Cls } from "./m1"; +import "m2"; +import "m4"; +let c: Cls; +c.foo().toExponential(); +c.bar().toLowerCase(); +c.baz1().x.toExponential(); +c.baz2().x.toLowerCase(); diff --git a/tests/cases/compiler/moduleAugmentationsImports1.ts b/tests/cases/compiler/moduleAugmentationsImports1.ts new file mode 100644 index 00000000000..ad029bdfc4a --- /dev/null +++ b/tests/cases/compiler/moduleAugmentationsImports1.ts @@ -0,0 +1,44 @@ +// @module: amd +// @declaration: true +// @out: f.js + +// @filename: a.ts +export class A {} + +// @filename: b.ts +export class B {x: number;} + +// @filename: c.d.ts +declare module "C" { + class Cls {y: string; } +} + +// @filename: d.ts +/// + +import {A} from "./a"; +import {B} from "./b"; +import {Cls} from "C"; + +A.prototype.getB = function () { return undefined; } +A.prototype.getCls = function () { return undefined; } + +declare module "./a" { + interface A { + getB(): B; + } +} + +declare module "./a" { + interface A { + getCls(): Cls; + } +} + +// @filename: main.ts +import {A} from "./a"; +import "d"; + +let a: A; +let b = a.getB().x.toFixed(); +let c = a.getCls().y.toLowerCase(); \ No newline at end of file diff --git a/tests/cases/compiler/moduleAugmentationsImports2.ts b/tests/cases/compiler/moduleAugmentationsImports2.ts new file mode 100644 index 00000000000..bf5b4b1cd17 --- /dev/null +++ b/tests/cases/compiler/moduleAugmentationsImports2.ts @@ -0,0 +1,49 @@ +// @module: amd +// @declaration: true +// @out: f.js + +// @filename: a.ts +export class A {} + +// @filename: b.ts +export class B {x: number;} + +// @filename: c.d.ts +declare module "C" { + class Cls {y: string; } +} + +// @filename: d.ts +/// + +import {A} from "./a"; +import {B} from "./b"; + +A.prototype.getB = function () { return undefined; } + +declare module "./a" { + interface A { + getB(): B; + } +} + +// @filename: e.ts +import {A} from "./a"; +import {Cls} from "C"; + +A.prototype.getCls = function () { return undefined; } + +declare module "./a" { + interface A { + getCls(): Cls; + } +} + +// @filename: main.ts +import {A} from "./a"; +import "d"; +import "e"; + +let a: A; +let b = a.getB().x.toFixed(); +let c = a.getCls().y.toLowerCase(); \ No newline at end of file diff --git a/tests/cases/compiler/moduleAugmentationsImports3.ts b/tests/cases/compiler/moduleAugmentationsImports3.ts new file mode 100644 index 00000000000..92cc6c73a3c --- /dev/null +++ b/tests/cases/compiler/moduleAugmentationsImports3.ts @@ -0,0 +1,48 @@ +// @module: amd +// @declaration: true +// @out: f.js + +// @filename: a.ts +export class A {} + +// @filename: b.ts +export class B {x: number;} + +// @filename: c.d.ts +declare module "C" { + class Cls {y: string; } +} + +// @filename: d.d.ts +declare module "D" { + import {A} from "a"; + import {B} from "b"; + module "a" { + interface A { + getB(): B; + } + } +} + +// @filename: e.ts +/// +import {A} from "./a"; +import {Cls} from "C"; + +A.prototype.getCls = function () { return undefined; } + +declare module "./a" { + interface A { + getCls(): Cls; + } +} + +// @filename: main.ts +/// +import {A} from "./a"; +import "D"; +import "e"; + +let a: A; +let b = a.getB().x.toFixed(); +let c = a.getCls().y.toLowerCase(); \ No newline at end of file diff --git a/tests/cases/compiler/moduleAugmentationsImports4.ts b/tests/cases/compiler/moduleAugmentationsImports4.ts new file mode 100644 index 00000000000..5e48954c092 --- /dev/null +++ b/tests/cases/compiler/moduleAugmentationsImports4.ts @@ -0,0 +1,49 @@ +// @module: amd +// @declaration: true +// @out: f.js + +// @filename: a.ts +export class A {} + +// @filename: b.ts +export class B {x: number;} + +// @filename: c.d.ts +declare module "C" { + class Cls {y: string; } +} + +// @filename: d.d.ts +declare module "D" { + import {A} from "a"; + import {B} from "b"; + module "a" { + interface A { + getB(): B; + } + } +} + +// @filename: e.d.ts +/// +declare module "E" { + import {A} from "a"; + import {Cls} from "C"; + + module "a" { + interface A { + getCls(): Cls; + } + } +} + +// @filename: main.ts +/// +/// +import {A} from "./a"; +import "D"; +import "E"; + +let a: A; +let b = a.getB().x.toFixed(); +let c = a.getCls().y.toLowerCase(); \ No newline at end of file diff --git a/tests/cases/compiler/moduleNoneErrors.ts b/tests/cases/compiler/moduleNoneErrors.ts new file mode 100644 index 00000000000..c5f34a28c77 --- /dev/null +++ b/tests/cases/compiler/moduleNoneErrors.ts @@ -0,0 +1,5 @@ +// @module: none +// @Filename: a.ts +export class Foo { + foo: string; +} diff --git a/tests/cases/compiler/moduleResolutionWithSymlinks.ts b/tests/cases/compiler/moduleResolutionWithSymlinks.ts new file mode 100644 index 00000000000..8f6f1ca1fbd --- /dev/null +++ b/tests/cases/compiler/moduleResolutionWithSymlinks.ts @@ -0,0 +1,20 @@ +// @module: commonjs +// @noImplicitReferences: true +// @traceResolution: true + +// @filename: /src/library-a/index.ts +// @symlink: /src/library-b/node_modules/library-a/index.ts +export class MyClass{} + +// @filename: /src/library-b/index.ts +import {MyClass} from "library-a"; +export { MyClass as MyClass2 } + +// @filename: /src/app.ts +import { MyClass } from "./library-a"; +import { MyClass2 } from "./library-b"; + +let x: MyClass; +let y: MyClass2; +x = y; +y = x; \ No newline at end of file diff --git a/tests/cases/compiler/module_augmentUninstantiatedModule.ts b/tests/cases/compiler/module_augmentUninstantiatedModule.ts new file mode 100644 index 00000000000..4d71c6c1389 --- /dev/null +++ b/tests/cases/compiler/module_augmentUninstantiatedModule.ts @@ -0,0 +1,9 @@ +declare module "foo" { + namespace M {} + var M; + export = M; +} + +declare module "bar" { + module "foo" {} +} \ No newline at end of file diff --git a/tests/cases/compiler/module_augmentUninstantiatedModule2.ts b/tests/cases/compiler/module_augmentUninstantiatedModule2.ts new file mode 100644 index 00000000000..101e26bf85b --- /dev/null +++ b/tests/cases/compiler/module_augmentUninstantiatedModule2.ts @@ -0,0 +1,2 @@ +// @module: commonjs // @moduleResolution: node // @fileName: app.ts import ng = require("angular"); import "./moduleAugmentation"; var x: number = ng.getNumber(); // @filename: moduleAugmentation.ts import * as ng from "angular" declare module "angular" { export interface IAngularStatic { getNumber: () => number; } } // @filename: node_modules/angular/index.d.ts +declare var ng: ng.IAngularStatic; declare module ng { export interface IModule { name: string; } export interface IAngularStatic { module: (s: string) => IModule; } } export = ng; \ No newline at end of file diff --git a/tests/cases/compiler/narrowingOfDottedNames.ts b/tests/cases/compiler/narrowingOfDottedNames.ts new file mode 100644 index 00000000000..af417f0830c --- /dev/null +++ b/tests/cases/compiler/narrowingOfDottedNames.ts @@ -0,0 +1,39 @@ +// Repro from #8383 + +class A { + prop: { a: string; }; +} + +class B { + prop: { b: string; } +} + +function isA(x: any): x is A { + return x instanceof A; +} + +function isB(x: any): x is B { + return x instanceof B; +} + +function f1(x: A | B) { + while (true) { + if (x instanceof A) { + x.prop.a; + } + else if (x instanceof B) { + x.prop.b; + } + } +} + +function f2(x: A | B) { + while (true) { + if (isA(x)) { + x.prop.a; + } + else if (isB(x)) { + x.prop.b; + } + } +} diff --git a/tests/cases/compiler/nestedBlockScopedBindings1.ts b/tests/cases/compiler/nestedBlockScopedBindings1.ts new file mode 100644 index 00000000000..9fd580044a5 --- /dev/null +++ b/tests/cases/compiler/nestedBlockScopedBindings1.ts @@ -0,0 +1,49 @@ +function a0() { + { + let x = 1; + } + { + let x = 1; + } +} + +function a1() { + { + let x; + } + { + let x = 1; + } +} + +function a2() { + { + let x = 1; + } + { + let x; + } +} + +function a3() { + { + let x = 1; + } + switch (1) { + case 1: + let x; + break; + } +} + + +function a4() { + { + let x; + } + switch (1) { + case 1: + let x = 1; + break; + } +} diff --git a/tests/cases/compiler/nestedBlockScopedBindings10.ts b/tests/cases/compiler/nestedBlockScopedBindings10.ts new file mode 100644 index 00000000000..5b3e5ad34a6 --- /dev/null +++ b/tests/cases/compiler/nestedBlockScopedBindings10.ts @@ -0,0 +1,11 @@ +{ + let x; + x = 1; +} + +switch (1) { + case 1: + let y; + y = 1; + break; +} \ No newline at end of file diff --git a/tests/cases/compiler/nestedBlockScopedBindings11.ts b/tests/cases/compiler/nestedBlockScopedBindings11.ts new file mode 100644 index 00000000000..5d3e527eaf0 --- /dev/null +++ b/tests/cases/compiler/nestedBlockScopedBindings11.ts @@ -0,0 +1,13 @@ +var x; +{ + let x; + () => x; +} + +var y; +switch (1) { + case 1: + let y; + () => y; + break; +} \ No newline at end of file diff --git a/tests/cases/compiler/nestedBlockScopedBindings12.ts b/tests/cases/compiler/nestedBlockScopedBindings12.ts new file mode 100644 index 00000000000..05aa00c1b5b --- /dev/null +++ b/tests/cases/compiler/nestedBlockScopedBindings12.ts @@ -0,0 +1,13 @@ +var x; +{ + let x; + x = 1; +} + +var y; +switch (1) { + case 1: + let y; + y = 1; + break; +} \ No newline at end of file diff --git a/tests/cases/compiler/nestedBlockScopedBindings13.ts b/tests/cases/compiler/nestedBlockScopedBindings13.ts new file mode 100644 index 00000000000..6cb1133a9f6 --- /dev/null +++ b/tests/cases/compiler/nestedBlockScopedBindings13.ts @@ -0,0 +1,9 @@ +for (; false;) { + let x; + () => x; +} + +for (; false;) { + let y; + y = 1; +} \ No newline at end of file diff --git a/tests/cases/compiler/nestedBlockScopedBindings14.ts b/tests/cases/compiler/nestedBlockScopedBindings14.ts new file mode 100644 index 00000000000..879551a041a --- /dev/null +++ b/tests/cases/compiler/nestedBlockScopedBindings14.ts @@ -0,0 +1,11 @@ +var x; +for (; false;) { + let x; + () => x; +} + +var y; +for (; false;) { + let y; + y = 1; +} \ No newline at end of file diff --git a/tests/cases/compiler/nestedBlockScopedBindings15.ts b/tests/cases/compiler/nestedBlockScopedBindings15.ts new file mode 100644 index 00000000000..703494e0949 --- /dev/null +++ b/tests/cases/compiler/nestedBlockScopedBindings15.ts @@ -0,0 +1,31 @@ +for (; false;) { + { + let x; + () => x; + } +} + +for (; false;) { + { + let y; + y = 1; + } +} + +for (; false;) { + switch (1){ + case 1: + let z0; + () => z0; + break; + } +} + +for (; false;) { + switch (1){ + case 1: + let z; + z = 1; + break; + } +} \ No newline at end of file diff --git a/tests/cases/compiler/nestedBlockScopedBindings16.ts b/tests/cases/compiler/nestedBlockScopedBindings16.ts new file mode 100644 index 00000000000..c85a9421102 --- /dev/null +++ b/tests/cases/compiler/nestedBlockScopedBindings16.ts @@ -0,0 +1,35 @@ +var x; +for (; false;) { + { + let x; + () => x; + } +} + +var y; +for (; false;) { + { + let y; + y = 1; + } +} + +var z0; +for (; false;) { + switch (1){ + case 1: + let z0; + () => z0; + break; + } +} + +var z; +for (; false;) { + switch (1){ + case 1: + let z; + z = 1; + break; + } +} \ No newline at end of file diff --git a/tests/cases/compiler/nestedBlockScopedBindings2.ts b/tests/cases/compiler/nestedBlockScopedBindings2.ts new file mode 100644 index 00000000000..694f27d1a24 --- /dev/null +++ b/tests/cases/compiler/nestedBlockScopedBindings2.ts @@ -0,0 +1,126 @@ +function a0() { + { + let x = 1; + () => x; + } + { + let x = 1; + } +} + +function a1() { + { + let x; + } + { + let x = 1; + () => x; + } +} + +function a2() { + { + let x = 1; + () => x; + } + { + let x; + () => x; + } +} + + +function a3() { + { + let x = 1; + () => x; + } + switch (1) { + case 1: + let x; + () => x; + break; + } +} + + +function a4() { + { + let x; + } + switch (1) { + case 1: + let x; + () => x; + break; + } +} + + +function a5() { + { + let x; + () => x; + } + switch (1) { + case 1: + let x; + break; + } +} + +function a6() { + switch (1) { + case 1: + let x; + break; + } + switch (1) { + case 1: + let x; + break; + } +} + +function a7() { + switch (1) { + case 1: + let x; + () => x; + break; + } + switch (1) { + case 1: + let x; + break; + } +} + +function a8() { + switch (1) { + case 1: + let x; + break; + } + switch (1) { + case 1: + let x; + () => x; + break; + } +} + +function a9() { + switch (1) { + case 1: + let x; + () => x; + break; + } + switch (1) { + case 1: + let x; + () => x; + break; + } +} diff --git a/tests/cases/compiler/nestedBlockScopedBindings3.ts b/tests/cases/compiler/nestedBlockScopedBindings3.ts new file mode 100644 index 00000000000..e073bebadb9 --- /dev/null +++ b/tests/cases/compiler/nestedBlockScopedBindings3.ts @@ -0,0 +1,68 @@ +function a0() { + { + for (let x = 0; x < 1; ) { + () => x; + } + } + { + for (let x;;) { + () => x; + } + } +} + +function a1() { + for (let x; x < 1;) { + () => x; + } + for (let x;;) { + () => x; + } +} + +function a2() { + for (let x; x < 1;) { + x = x + 1; + } + for (let x;;) { + x = x + 2; + } +} + + +function a3() { + for (let x; x < 1;) { + x = x + 1; + } + switch (1) { + case 1: + let x; + break; + } +} + +function a4() { + for (let x; x < 1;) { + x = x + 1; + () => x; + } + switch (1) { + case 1: + let x; + break; + } +} + + +function a5() { + for (let x; x < 1;) { + x = x + 1; + () => x; + } + switch (1) { + case 1: + let x; + () => x; + break; + } +} \ No newline at end of file diff --git a/tests/cases/compiler/nestedBlockScopedBindings4.ts b/tests/cases/compiler/nestedBlockScopedBindings4.ts new file mode 100644 index 00000000000..33ad21e2c42 --- /dev/null +++ b/tests/cases/compiler/nestedBlockScopedBindings4.ts @@ -0,0 +1,40 @@ +function a0() { + for (let x; x < 1;) { + x = x + 1; + } + for (let x;;) { + x = x + 2; + } +} + +function a1() { + for (let x; x < 1;) { + x = x + 1; + () => x; + } + for (let x;;) { + x = x + 2; + } +} + +function a2() { + for (let x; x < 1;) { + x = x + 1; + } + for (let x;;) { + x = x + 2; + () => x; + } +} + + +function a3() { + for (let x; x < 1;) { + x = x + 1; + () => x; + } + for (let x;;) { + x = x + 2; + () => x; + } +} \ No newline at end of file diff --git a/tests/cases/compiler/nestedBlockScopedBindings5.ts b/tests/cases/compiler/nestedBlockScopedBindings5.ts new file mode 100644 index 00000000000..65093bcc91f --- /dev/null +++ b/tests/cases/compiler/nestedBlockScopedBindings5.ts @@ -0,0 +1,80 @@ +function a0() { + for (let x in []) { + x = x + 1; + } + for (let x;;) { + x = x + 2; + } +} + +function a1() { + for (let x in []) { + x = x + 1; + () => x; + } + for (let x;;) { + x = x + 2; + } +} + +function a2() { + for (let x in []) { + x = x + 1; + } + for (let x;;) { + x = x + 2; + () => x; + } +} + + +function a3() { + for (let x in []) { + x = x + 1; + () => x; + } + for (let x;false;) { + x = x + 2; + () => x; + } + switch (1) { + case 1: + let x; + () => x; + break; + } + +} + +function a4() { + for (let x in []) { + x = x + 1; + } + for (let x;false;) { + x = x + 2; + } + switch (1) { + case 1: + let x; + () => x; + break; + } + +} + +function a5() { + let y; + for (let x in []) { + x = x + 1; + } + for (let x;false;) { + x = x + 2; + () => x; + } + switch (1) { + case 1: + let x; + break; + } + +} \ No newline at end of file diff --git a/tests/cases/compiler/nestedBlockScopedBindings6.ts b/tests/cases/compiler/nestedBlockScopedBindings6.ts new file mode 100644 index 00000000000..badf1db6e59 --- /dev/null +++ b/tests/cases/compiler/nestedBlockScopedBindings6.ts @@ -0,0 +1,88 @@ +function a0() { + for (let x of [1]) { + x = x + 1; + } + for (let x;;) { + x = x + 2; + } +} + +function a1() { + for (let x of [1]) { + x = x + 1; + () => x; + } + for (let x;;) { + x = x + 2; + } +} + +function a2() { + for (let x of [1]) { + x = x + 1; + } + for (let x;;) { + x = x + 2; + () => x; + } +} + +function a3() { + for (let x of [1]) { + x = x + 1; + () => x; + } + for (let x;;) { + x = x + 2; + () => x; + } +} + +function a4() { + for (let x of [1]) { + x = x + 1; + () => x; + } + switch (1) { + case 1: + let x; + break; + } +} + + +function a5() { + for (let x of [1]) { + x = x + 1; + } + switch (1) { + case 1: + let x; + () => x; + break; + } +} + +function a6() { + for (let x of [1]) { + x = x + 1; + } + switch (1) { + case 1: + let x; + break; + } +} + +function a7() { + for (let x of [1]) { + x = x + 1; + () => x; + } + switch (1) { + case 1: + let x; + () => x; + break; + } +} \ No newline at end of file diff --git a/tests/cases/compiler/nestedBlockScopedBindings7.ts b/tests/cases/compiler/nestedBlockScopedBindings7.ts new file mode 100644 index 00000000000..67da827305b --- /dev/null +++ b/tests/cases/compiler/nestedBlockScopedBindings7.ts @@ -0,0 +1,7 @@ +for (let x; false;) { + () => x; +} + +for (let y; false;) { + y = 1; +} \ No newline at end of file diff --git a/tests/cases/compiler/nestedBlockScopedBindings8.ts b/tests/cases/compiler/nestedBlockScopedBindings8.ts new file mode 100644 index 00000000000..14e33615dc2 --- /dev/null +++ b/tests/cases/compiler/nestedBlockScopedBindings8.ts @@ -0,0 +1,9 @@ +var x; +for (let x; false; ) { + () => x; +} + +var y; +for (let y; false; ) { + y = 1; +} \ No newline at end of file diff --git a/tests/cases/compiler/nestedBlockScopedBindings9.ts b/tests/cases/compiler/nestedBlockScopedBindings9.ts new file mode 100644 index 00000000000..d7d749dcf7c --- /dev/null +++ b/tests/cases/compiler/nestedBlockScopedBindings9.ts @@ -0,0 +1,11 @@ +{ + let x; + () => x; +} + +switch (1) { + case 1: + let y; + () => y; + break; +} \ No newline at end of file diff --git a/tests/cases/compiler/newNamesInGlobalAugmentations1.ts b/tests/cases/compiler/newNamesInGlobalAugmentations1.ts new file mode 100644 index 00000000000..73ed4e5e2e8 --- /dev/null +++ b/tests/cases/compiler/newNamesInGlobalAugmentations1.ts @@ -0,0 +1,22 @@ +// @target: es6 + +// @filename: f1.d.ts +export {}; + +declare module M.M1 { + export let x: number; +} +declare global { + interface SymbolConstructor { + observable: symbol; + } + class Cls {x} + let [a, b]: number[]; + export import X = M.M1.x; +} + +// @filename: main.ts + +Symbol.observable; +new Cls().x +let c = a + b + X; \ No newline at end of file diff --git a/tests/cases/compiler/noImplicitAnyDestructuringInPrivateMethod.ts b/tests/cases/compiler/noImplicitAnyDestructuringInPrivateMethod.ts new file mode 100644 index 00000000000..b6ff1fa6969 --- /dev/null +++ b/tests/cases/compiler/noImplicitAnyDestructuringInPrivateMethod.ts @@ -0,0 +1,13 @@ +// @noimplicitany: true +// @declaration: true +type Arg = { + a: number; +}; +export class Bar { + private bar({ a, }: Arg): number { + return a; + } +} +export declare class Bar2 { + private bar({ a, }); +} \ No newline at end of file diff --git a/tests/cases/compiler/noImplicitAnyDestructuringParameterDeclaration.ts b/tests/cases/compiler/noImplicitAnyDestructuringParameterDeclaration.ts new file mode 100644 index 00000000000..9f4e579dcff --- /dev/null +++ b/tests/cases/compiler/noImplicitAnyDestructuringParameterDeclaration.ts @@ -0,0 +1,11 @@ +// @noimplicitany: true +function f1([a], {b}, c, d) { // error +} +function f2([a = undefined], {b = null}, c = undefined, d = null) { // error +} +function f3([a]: [any], {b}: { b: any }, c: any, d: any) { +} +function f4({b}: { b }, x: { b }) { // error in type instead +} +function f5([a1] = [undefined], {b1} = { b1: null }, c1 = undefined, d1 = null) { // error +} \ No newline at end of file diff --git a/tests/cases/compiler/noImplicitAnyDestructuringVarDeclaration.ts b/tests/cases/compiler/noImplicitAnyDestructuringVarDeclaration.ts new file mode 100644 index 00000000000..6988416d4de --- /dev/null +++ b/tests/cases/compiler/noImplicitAnyDestructuringVarDeclaration.ts @@ -0,0 +1,10 @@ +// @noimplicitany: true +var [a], {b}, c, d; // error + +var [a1 = undefined], {b1 = null}, c1 = undefined, d1 = null; // error + +var [a2]: [any], {b2}: { b2: any }, c2: any, d2: any; + +var {b3}: { b3 }, c3: { b3 }; // error in type instead + +var [a1] = [undefined], {b1} = { b1: null }, c1 = undefined, d1 = null; // error \ No newline at end of file diff --git a/tests/cases/compiler/noImplicitReturnInConstructors.ts b/tests/cases/compiler/noImplicitReturnInConstructors.ts new file mode 100644 index 00000000000..ac6f5145318 --- /dev/null +++ b/tests/cases/compiler/noImplicitReturnInConstructors.ts @@ -0,0 +1,6 @@ +// @noImplicitReturns: true +class C { + constructor() { + return; + } +} \ No newline at end of file diff --git a/tests/cases/compiler/noImplicitReturnsInAsync1.ts b/tests/cases/compiler/noImplicitReturnsInAsync1.ts new file mode 100644 index 00000000000..a4aadd81f75 --- /dev/null +++ b/tests/cases/compiler/noImplicitReturnsInAsync1.ts @@ -0,0 +1,9 @@ +// @target: es6 +// @noImplicitReturns: true + +async function test(isError: boolean = false) { + if (isError === true) { + return; + } + let x = await Promise.resolve("The test is passed without an error."); +} \ No newline at end of file diff --git a/tests/cases/compiler/noImplicitReturnsInAsync2.ts b/tests/cases/compiler/noImplicitReturnsInAsync2.ts new file mode 100644 index 00000000000..20488b6bd37 --- /dev/null +++ b/tests/cases/compiler/noImplicitReturnsInAsync2.ts @@ -0,0 +1,38 @@ +// @target: es6 +// @noImplicitReturns: true + +// Should be an error, Promise, currently retorted correctly +async function test3(isError: boolean = true) { + if (isError === true) { + return 6; + } +} + +// Should not be an error, Promise, currently **not** working +async function test4(isError: boolean = true) { + if (isError === true) { + return undefined; + } +} + +// should not be error, Promise currently working correctly +async function test5(isError: boolean = true): Promise { //should not be error + if (isError === true) { + return undefined; + } +} + + +// should be error, currently reported correctly +async function test6(isError: boolean = true): Promise { + if (isError === true) { + return undefined; + } +} + +// infered to be Promise, should not be an error, currently reported correctly +async function test7(isError: boolean = true) { + if (isError === true) { + return; + } +} \ No newline at end of file diff --git a/tests/cases/compiler/noImplicitReturnsWithProtectedBlocks1.ts b/tests/cases/compiler/noImplicitReturnsWithProtectedBlocks1.ts new file mode 100644 index 00000000000..4b2174386fa --- /dev/null +++ b/tests/cases/compiler/noImplicitReturnsWithProtectedBlocks1.ts @@ -0,0 +1,12 @@ +// @noImplicitReturns: true +declare function log(s: string): void; +declare function get(): number; + +function main1() : number { + try { + return get(); + } + finally { + log("in finally"); + } +} \ No newline at end of file diff --git a/tests/cases/compiler/noImplicitReturnsWithProtectedBlocks2.ts b/tests/cases/compiler/noImplicitReturnsWithProtectedBlocks2.ts new file mode 100644 index 00000000000..fbd12526cf9 --- /dev/null +++ b/tests/cases/compiler/noImplicitReturnsWithProtectedBlocks2.ts @@ -0,0 +1,15 @@ +// @noImplicitReturns: true +declare function log(s: string): void; +declare function get(): number; + +function main1() : number { + try { + return get(); + } + catch(e) { + log("in catch"); + } + finally { + log("in finally"); + } +} \ No newline at end of file diff --git a/tests/cases/compiler/noImplicitReturnsWithProtectedBlocks3.ts b/tests/cases/compiler/noImplicitReturnsWithProtectedBlocks3.ts new file mode 100644 index 00000000000..1cbb12b1ae0 --- /dev/null +++ b/tests/cases/compiler/noImplicitReturnsWithProtectedBlocks3.ts @@ -0,0 +1,12 @@ +// @noImplicitReturns: true +declare function log(s: string): void; +declare function get(): number; + +function main1() : number { + try { + return get(); + } + catch(e) { + log("in catch"); + } +} \ No newline at end of file diff --git a/tests/cases/compiler/noImplicitReturnsWithoutReturnExpression.ts b/tests/cases/compiler/noImplicitReturnsWithoutReturnExpression.ts new file mode 100644 index 00000000000..f532b1280d3 --- /dev/null +++ b/tests/cases/compiler/noImplicitReturnsWithoutReturnExpression.ts @@ -0,0 +1,25 @@ +// @noImplicitReturns: true +function isMissingReturnExpression(): number { + return; +} + +function isMissingReturnExpression2(): any { + return; +} + +function isMissingReturnExpression3(): number|void { + return; +} + +function isMissingReturnExpression4(): void { + return; +} + +function isMissingReturnExpression5(x) { + if (x) { + return 0; + } + else { + return; + } +} diff --git a/tests/cases/compiler/noImplicitThisFunctions.ts b/tests/cases/compiler/noImplicitThisFunctions.ts new file mode 100644 index 00000000000..45f0e5a1eb9 --- /dev/null +++ b/tests/cases/compiler/noImplicitThisFunctions.ts @@ -0,0 +1,19 @@ +// @noImplicitThis: true + +function f1(x) { + // implicit any is still allowed + return x + 1; +} + +function f2(y: number) { + // ok: no reference to this + return y + 1; +} + +function f3(z: number): number { + // error: this is implicitly any + return this.a + z; +} + +// error: `this` is `window`, but is still of type `any` +let f4: (b: number) => number = b => this.c + b; diff --git a/tests/cases/compiler/noImplicitThisObjectLiterals.ts b/tests/cases/compiler/noImplicitThisObjectLiterals.ts new file mode 100644 index 00000000000..abd5d9dcfba --- /dev/null +++ b/tests/cases/compiler/noImplicitThisObjectLiterals.ts @@ -0,0 +1,10 @@ +// @noImplicitThis: true +let o = { + d: this, // error, this: any + m() { + return this.d.length; // error, this: any + }, + f: function() { + return this.d.length; // error, this: any + } +} diff --git a/tests/cases/compiler/noImplicitUseStrict_amd.ts b/tests/cases/compiler/noImplicitUseStrict_amd.ts new file mode 100644 index 00000000000..3a2a4760221 --- /dev/null +++ b/tests/cases/compiler/noImplicitUseStrict_amd.ts @@ -0,0 +1,4 @@ +// @module: amd +// @noImplicitUseStrict: true + +export var x = 0; \ No newline at end of file diff --git a/tests/cases/compiler/noImplicitUseStrict_commonjs.ts b/tests/cases/compiler/noImplicitUseStrict_commonjs.ts new file mode 100644 index 00000000000..f8377dba07a --- /dev/null +++ b/tests/cases/compiler/noImplicitUseStrict_commonjs.ts @@ -0,0 +1,4 @@ +// @module: commonjs +// @noImplicitUseStrict: true + +export var x = 0; \ No newline at end of file diff --git a/tests/cases/compiler/noImplicitUseStrict_es6.ts b/tests/cases/compiler/noImplicitUseStrict_es6.ts new file mode 100644 index 00000000000..f56b0fd9021 --- /dev/null +++ b/tests/cases/compiler/noImplicitUseStrict_es6.ts @@ -0,0 +1,5 @@ +// @module: es6 +// @target: es6 +// @noImplicitUseStrict: true + +export var x = 0; \ No newline at end of file diff --git a/tests/cases/compiler/noImplicitUseStrict_system.ts b/tests/cases/compiler/noImplicitUseStrict_system.ts new file mode 100644 index 00000000000..37ff5de469d --- /dev/null +++ b/tests/cases/compiler/noImplicitUseStrict_system.ts @@ -0,0 +1,4 @@ +// @module: system +// @noImplicitUseStrict: true + +export var x = 0; \ No newline at end of file diff --git a/tests/cases/compiler/noImplicitUseStrict_umd.ts b/tests/cases/compiler/noImplicitUseStrict_umd.ts new file mode 100644 index 00000000000..f26f2ee2aff --- /dev/null +++ b/tests/cases/compiler/noImplicitUseStrict_umd.ts @@ -0,0 +1,4 @@ +// @module: umd +// @noImplicitUseStrict: true + +export var x = 0; \ No newline at end of file diff --git a/tests/cases/compiler/nonIdenticalTypeConstraints.ts b/tests/cases/compiler/nonIdenticalTypeConstraints.ts new file mode 100644 index 00000000000..c0271edc91a --- /dev/null +++ b/tests/cases/compiler/nonIdenticalTypeConstraints.ts @@ -0,0 +1,38 @@ +class Different { + a: number; + b: string; + c: boolean; +} + +class Foo { + n: T; +} +interface Foo { + y: T; +} +interface Qux { + y: T; +} +class Qux { + n: T; +} + +class Bar { + n: T; +} +interface Bar { + y: T; +} +interface Baz { + y: T; +} +class Baz { + n: T; +} + +class Quux { + n: T; +} +interface Quux { + m: U; +} \ No newline at end of file diff --git a/tests/cases/compiler/overloadOnConstAsTypeAnnotation.ts b/tests/cases/compiler/overloadOnConstAsTypeAnnotation.ts index 12b99fb29ce..4188d6919a7 100644 --- a/tests/cases/compiler/overloadOnConstAsTypeAnnotation.ts +++ b/tests/cases/compiler/overloadOnConstAsTypeAnnotation.ts @@ -1,3 +1,3 @@ // @allowUnreachableCode: true -var f: (x: 'hi') => number = ('hi') => { return 1; }; \ No newline at end of file +var f: (x: 'hi') => number = (x: 'hi') => { return 1; }; \ No newline at end of file diff --git a/tests/cases/compiler/parameterReferenceInInitializer1.ts b/tests/cases/compiler/parameterReferenceInInitializer1.ts new file mode 100644 index 00000000000..c2ca2f08dbd --- /dev/null +++ b/tests/cases/compiler/parameterReferenceInInitializer1.ts @@ -0,0 +1,12 @@ +function fn(y: Y, set: (y: Y, x: number) => void): a { + return undefined; +} +interface Y { x: number } + +class C { + constructor( + y: Y, + public x = fn(y, (y, x) => y.x = x) // expected to work, but actually doesn't + ) { + } +} \ No newline at end of file diff --git a/tests/cases/compiler/parameterReferenceInInitializer2.ts b/tests/cases/compiler/parameterReferenceInInitializer2.ts new file mode 100644 index 00000000000..f093f3f88f9 --- /dev/null +++ b/tests/cases/compiler/parameterReferenceInInitializer2.ts @@ -0,0 +1,3 @@ +function Example(x = function(x: any) { return x; }) { // Error: parameter 'x' cannot be + // referenced in its initializer +} \ No newline at end of file diff --git a/tests/cases/compiler/pathMappingBasedModuleResolution1_classic.ts b/tests/cases/compiler/pathMappingBasedModuleResolution1_classic.ts new file mode 100644 index 00000000000..054d6ed8a0b --- /dev/null +++ b/tests/cases/compiler/pathMappingBasedModuleResolution1_classic.ts @@ -0,0 +1,19 @@ +// @module: amd +// @traceResolution: true + +// paths should error in the absence of baseurl + +// @filename: c:/root/tsconfig.json +{ + "compilerOptions": { + "paths": { + "*": [ + "*", + "generated/*" + ] + } + } +} + +// @filename: c:/root/f1.ts +export var x = 1; diff --git a/tests/cases/compiler/pathMappingBasedModuleResolution1_node.ts b/tests/cases/compiler/pathMappingBasedModuleResolution1_node.ts new file mode 100644 index 00000000000..a0ce95f2c1a --- /dev/null +++ b/tests/cases/compiler/pathMappingBasedModuleResolution1_node.ts @@ -0,0 +1,18 @@ +// @module: commonjs +// @traceResolution: true + +// paths should error in the absence of baseurl +// @filename: c:/root/tsconfig.json +{ + "compilerOptions": { + "paths": { + "*": [ + "*", + "generated/*" + ] + } + } +} + +// @filename: c:/root/f1.ts +export var x = 1; diff --git a/tests/cases/compiler/pathMappingBasedModuleResolution2_classic.ts b/tests/cases/compiler/pathMappingBasedModuleResolution2_classic.ts new file mode 100644 index 00000000000..f24e857fa41 --- /dev/null +++ b/tests/cases/compiler/pathMappingBasedModuleResolution2_classic.ts @@ -0,0 +1,18 @@ +// @module: amd +// @traceResolution: true + +// baseurl is defined in tsconfig.json +// paths has errors + +// @filename: root/tsconfig.json +{ + "compilerOptions": { + "baseUrl": "./src", + "paths": { + "*1*": [ "*2*" ] + } + } +} + +// @filename: root/src/folder1/file1.ts +export var x = 1; \ No newline at end of file diff --git a/tests/cases/compiler/pathMappingBasedModuleResolution2_node.ts b/tests/cases/compiler/pathMappingBasedModuleResolution2_node.ts new file mode 100644 index 00000000000..ac4d51bacf5 --- /dev/null +++ b/tests/cases/compiler/pathMappingBasedModuleResolution2_node.ts @@ -0,0 +1,18 @@ +// @module: commonjs +// @traceResolution: true + +// baseurl is defined in tsconfig.json +// paths has errors + +// @filename: root/tsconfig.json +{ + "compilerOptions": { + "baseUrl": "./src", + "paths": { + "*1*": [ "*2*" ] + } + } +} + +// @filename: root/src/folder1/file1.ts +export var x = 1; \ No newline at end of file diff --git a/tests/cases/compiler/pathMappingBasedModuleResolution3_classic.ts b/tests/cases/compiler/pathMappingBasedModuleResolution3_classic.ts new file mode 100644 index 00000000000..350346adebc --- /dev/null +++ b/tests/cases/compiler/pathMappingBasedModuleResolution3_classic.ts @@ -0,0 +1,22 @@ +// @moduleResolution: classic +// @module: amd +// @baseUrl: c:/root +// @traceResolution: true + +// baseUrl set via command line + +// @filename: c:/root/folder1/file1.ts +import {x} from "folder2/file2" +declare function use(a: any): void; +use(x.toExponential()); + +// @filename: c:/root/folder2/file2.ts +import {x as a} from "./file3" // found with baseurl +import {y as b} from "file4" // found with fallback +export var x = a + b; + +// @filename: c:/root/folder2/file3.ts +export var x = 1; + +// @filename: c:/file4.ts +export var y = 100; \ No newline at end of file diff --git a/tests/cases/compiler/pathMappingBasedModuleResolution3_node.ts b/tests/cases/compiler/pathMappingBasedModuleResolution3_node.ts new file mode 100644 index 00000000000..6cab1df06b0 --- /dev/null +++ b/tests/cases/compiler/pathMappingBasedModuleResolution3_node.ts @@ -0,0 +1,22 @@ +// @moduleResolution: node +// @module: commonjs +// @baseUrl: c:/root +// @traceResolution: true + +// baseUrl set via command line + +// @filename: c:/root/folder1/file1.ts +import {x} from "folder2/file2" +declare function use(a: any): void; +use(x.toExponential()); + +// @filename: c:/root/folder2/file2.ts +import {x as a} from "./file3" // found with baseurl +import {y as b} from "file4" // found with fallback +export var x = a + b; + +// @filename: c:/root/folder2/file3.ts +export var x = 1; + +// @filename: c:/node_modules/file4/index.d.ts +export var y: number; \ No newline at end of file diff --git a/tests/cases/compiler/pathMappingBasedModuleResolution4_classic.ts b/tests/cases/compiler/pathMappingBasedModuleResolution4_classic.ts new file mode 100644 index 00000000000..fbf11e61716 --- /dev/null +++ b/tests/cases/compiler/pathMappingBasedModuleResolution4_classic.ts @@ -0,0 +1,28 @@ +// @moduleResolution: classic +// @module: amd +// @traceResolution: true + +// baseUrl set via command line + +// @filename: c:/root/tsconfig.json +{ + "compilerOptions": { + "baseUrl": "." + } +} + +// @filename: c:/root/folder1/file1.ts +import {x} from "folder2/file2" +declare function use(a: any): void; +use(x.toExponential()); + +// @filename: c:/root/folder2/file2.ts +import {x as a} from "./file3" // found with baseurl +import {y as b} from "file4" // found with fallback +export var x = a + b; + +// @filename: c:/root/folder2/file3.ts +export var x = 1; + +// @filename: c:/file4.ts +export var y = 100; \ No newline at end of file diff --git a/tests/cases/compiler/pathMappingBasedModuleResolution4_node.ts b/tests/cases/compiler/pathMappingBasedModuleResolution4_node.ts new file mode 100644 index 00000000000..cfb90ca1cc5 --- /dev/null +++ b/tests/cases/compiler/pathMappingBasedModuleResolution4_node.ts @@ -0,0 +1,28 @@ +// @moduleResolution: node +// @module: commonjs +// @traceResolution: true + +// baseUrl set via command line + +// @filename: c:/root/tsconfig.json +{ + "compilerOptions": { + "baseUrl": "." + } +} + +// @filename: c:/root/folder1/file1.ts +import {x} from "folder2/file2" +declare function use(a: any): void; +use(x.toExponential()); + +// @filename: c:/root/folder2/file2.ts +import {x as a} from "./file3" // found with baseurl +import {y as b} from "file4" // found with fallback +export var x = a + b; + +// @filename: c:/root/folder2/file3.ts +export var x = 1; + +// @filename: c:/node_modules/file4/index.d.ts +export var y: number; \ No newline at end of file diff --git a/tests/cases/compiler/pathMappingBasedModuleResolution5_classic.ts b/tests/cases/compiler/pathMappingBasedModuleResolution5_classic.ts new file mode 100644 index 00000000000..9779f0ca644 --- /dev/null +++ b/tests/cases/compiler/pathMappingBasedModuleResolution5_classic.ts @@ -0,0 +1,43 @@ +// @module: amd +// @traceResolution: true + +// paths is defined in tsconfig.json +// @filename: c:/root/tsconfig.json +{ + "compilerOptions": { + "baseUrl": ".", + "paths": { + "*": [ + "*", + "generated/*" + ], + "components/*": [ + "shared/components/*" + ] + } + } +} +// @filename: c:/root/folder1/file1.ts +import {x} from "folder2/file1" +import {y} from "folder3/file2" +import {z} from "components/file3" +import {z1} from "file4" + +declare function use(a: any): void; + +use(x.toExponential()); +use(y.toExponential()); +use(z.toExponential()); +use(z1.toExponential()); + +// @filename: c:/root/folder2/file1.ts +export var x = 1; + +// @filename: c:/root/generated/folder3/file2.ts +export var y = 1; + +// @filename: c:/root/shared/components/file3.ts +export var z = 1; + +// @filename: c:/file4.ts +export var z1 = 1; \ No newline at end of file diff --git a/tests/cases/compiler/pathMappingBasedModuleResolution5_node.ts b/tests/cases/compiler/pathMappingBasedModuleResolution5_node.ts new file mode 100644 index 00000000000..3606ab08cd1 --- /dev/null +++ b/tests/cases/compiler/pathMappingBasedModuleResolution5_node.ts @@ -0,0 +1,43 @@ +// @module: commonjs +// @traceResolution: true + +// paths is defined in tsconfig.json +// @filename: c:/root/tsconfig.json +{ + "compilerOptions": { + "baseUrl": ".", + "paths": { + "*": [ + "*", + "generated/*" + ], + "components/*": [ + "shared/components/*" + ] + } + } +} +// @filename: c:/root/folder1/file1.ts +import {x} from "folder2/file1" +import {y} from "folder3/file2" +import {z} from "components/file3" +import {z1} from "file4" + +declare function use(a: any): void; + +use(x.toExponential()); +use(y.toExponential()); +use(z.toExponential()); +use(z1.toExponential()); + +// @filename: c:/root/folder2/file1.ts +export var x = 1; + +// @filename: c:/root/generated/folder3/file2.ts +export var y = 1; + +// @filename: c:/root/shared/components/file3/index.d.ts +export var z: number; + +// @filename: c:/node_modules/file4.ts +export var z1 = 1; \ No newline at end of file diff --git a/tests/cases/compiler/pathMappingBasedModuleResolution6_classic.ts b/tests/cases/compiler/pathMappingBasedModuleResolution6_classic.ts new file mode 100644 index 00000000000..5ce4bd2a18f --- /dev/null +++ b/tests/cases/compiler/pathMappingBasedModuleResolution6_classic.ts @@ -0,0 +1,23 @@ +// @module: amd +// @traceResolution: true + +// @filename: c:/root/src/tsconfig.json +{ + "compilerOptions": { + "rootDirs": [ + ".", + "../generated/src" + ] + } +} + +// @filename: c:/root/src/file1.ts +import {x} from "./project/file3"; +declare function use(x: string); +use(x.toExponential()); + +// @filename: c:/root/src/file2.d.ts +export let x: number; + +// @filename: c:/root/generated/src/project/file3.ts +export {x} from "../file2"; \ No newline at end of file diff --git a/tests/cases/compiler/pathMappingBasedModuleResolution6_node.ts b/tests/cases/compiler/pathMappingBasedModuleResolution6_node.ts new file mode 100644 index 00000000000..29a82e5412d --- /dev/null +++ b/tests/cases/compiler/pathMappingBasedModuleResolution6_node.ts @@ -0,0 +1,23 @@ +// @module: commonjs +// @traceResolution: true + +// @filename: c:/root/src/tsconfig.json +{ + "compilerOptions": { + "rootDirs": [ + ".", + "../generated/src" + ] + } +} + +// @filename: c:/root/src/file1.ts +import {x} from "./project/file3"; +declare function use(x: string); +use(x.toFixed()); + +// @filename: c:/root/src/file2/index.d.ts +export let x: number; + +// @filename: c:/root/generated/src/project/file3.ts +export {x} from "../file2"; \ No newline at end of file diff --git a/tests/cases/compiler/pathMappingBasedModuleResolution7_classic.ts b/tests/cases/compiler/pathMappingBasedModuleResolution7_classic.ts new file mode 100644 index 00000000000..81c2328df67 --- /dev/null +++ b/tests/cases/compiler/pathMappingBasedModuleResolution7_classic.ts @@ -0,0 +1,49 @@ +// @module: amd +// @traceResolution: true + +// @filename: c:/root/src/tsconfig.json +{ + "compilerOptions": { + "baseUrl": "../", + "paths": { + "*": [ + "*", + "c:/shared/*" + ], + "templates/*": [ + "generated/src/templates/*" + ] + }, + "rootDirs": [ + ".", + "../generated/src" + ] + } +} + +// @filename: c:/root/src/file1.ts +import {x} from "./project/file2"; +import {y} from "module3"; + +declare function use(x: string); +use(x.toFixed()); +use(y.toFixed()); + +// @filename: c:/root/generated/src/project/file2.ts +import {a} from "module1"; +import {b} from "templates/module2"; +import {x as c} from "../file3"; +export let x = a + b + c; + +// @filename: c:/shared/module1.d.ts +export let a: number + +// @filename: c:/root/generated/src/templates/module2.ts +export let b: number; + +// @filename: c:/root/src/file3.d.ts +export let x: number; + +// @filename: c:/module3.d.ts +export let y: number; + diff --git a/tests/cases/compiler/pathMappingBasedModuleResolution7_node.ts b/tests/cases/compiler/pathMappingBasedModuleResolution7_node.ts new file mode 100644 index 00000000000..1ba9630e0cf --- /dev/null +++ b/tests/cases/compiler/pathMappingBasedModuleResolution7_node.ts @@ -0,0 +1,49 @@ +// @module: commonjs +// @traceResolution: true + +// @filename: c:/root/src/tsconfig.json +{ + "compilerOptions": { + "baseUrl": "../", + "paths": { + "*": [ + "*", + "c:/shared/*" + ], + "templates/*": [ + "generated/src/templates/*" + ] + }, + "rootDirs": [ + ".", + "../generated/src" + ] + } +} + +// @filename: c:/root/src/file1.ts +import {x} from "./project/file2"; +import {y} from "module3"; + +declare function use(x: string); +use(x.toFixed()); +use(y.toFixed()); + +// @filename: c:/root/generated/src/project/file2.ts +import {a} from "module1"; +import {b} from "templates/module2"; +import {x as c} from "../file3"; +export let x = a + b + c; + +// @filename: c:/shared/module1/index.d.ts +export let a: number + +// @filename: c:/root/generated/src/templates/module2.ts +export let b: number; + +// @filename: c:/root/src/file3/index.d.ts +export let x: number; + +// @filename: c:/node_modules/module3.d.ts +export let y: number; + diff --git a/tests/cases/compiler/pathsValidation1.ts b/tests/cases/compiler/pathsValidation1.ts new file mode 100644 index 00000000000..45a4409cf03 --- /dev/null +++ b/tests/cases/compiler/pathsValidation1.ts @@ -0,0 +1,11 @@ +// @filename: tsconfig.json +{ + "compilerOptions": { + "baseUrl": ".", + "paths": { + "*": "*" + } + } +} +// @filename: a.ts +let x = 1; \ No newline at end of file diff --git a/tests/cases/compiler/pathsValidation2.ts b/tests/cases/compiler/pathsValidation2.ts new file mode 100644 index 00000000000..b15ad4e236a --- /dev/null +++ b/tests/cases/compiler/pathsValidation2.ts @@ -0,0 +1,11 @@ +// @filename: tsconfig.json +{ + "compilerOptions": { + "baseUrl": ".", + "paths": { + "*": [1] + } + } +} +// @filename: a.ts +let x = 1; \ No newline at end of file diff --git a/tests/cases/compiler/protectedMembers.ts b/tests/cases/compiler/protectedMembers.ts index ae32e472425..b7528f26068 100644 --- a/tests/cases/compiler/protectedMembers.ts +++ b/tests/cases/compiler/protectedMembers.ts @@ -82,7 +82,6 @@ interface E extends C { } class CC { - // Error, constructor cannot be protected protected constructor() { } } diff --git a/tests/cases/compiler/reExportGlobalDeclaration1.ts b/tests/cases/compiler/reExportGlobalDeclaration1.ts new file mode 100644 index 00000000000..9b3f0c030de --- /dev/null +++ b/tests/cases/compiler/reExportGlobalDeclaration1.ts @@ -0,0 +1,19 @@ +// @module: commonjs + +// @filename: file1.d.ts +declare var x: number; +declare var x1: number; +declare let {a, b}: {a: number, b: number}; + +// @filename: file2.ts +export {x, x as y}; +export {x1, x1 as y1}; + +export {a, a as a1}; +export {b, b as b1}; + + +export {x as z}; +export {x1 as z1}; +export {a as a2}; +export {b as b2}; diff --git a/tests/cases/compiler/reExportGlobalDeclaration2.ts b/tests/cases/compiler/reExportGlobalDeclaration2.ts new file mode 100644 index 00000000000..4dba4fd20fa --- /dev/null +++ b/tests/cases/compiler/reExportGlobalDeclaration2.ts @@ -0,0 +1,16 @@ +// @module: commonjs + +// @filename: file1.d.ts +declare interface I1 { + x: number +} + +declare interface I2 { + x: number +} + +// @filename: file2.ts +export {I1, I1 as II1}; +export {I2, I2 as II2}; +export {I1 as III1}; +export {I2 as III2}; \ No newline at end of file diff --git a/tests/cases/compiler/reExportGlobalDeclaration3.ts b/tests/cases/compiler/reExportGlobalDeclaration3.ts new file mode 100644 index 00000000000..dc188ac6fb5 --- /dev/null +++ b/tests/cases/compiler/reExportGlobalDeclaration3.ts @@ -0,0 +1,16 @@ +// @module: commonjs + +// @filename: file1.d.ts +declare namespace NS1 { + export var foo: number; +} + +declare namespace NS2 { + export var foo: number; +} + +// @filename: file2.ts +export {NS1, NS1 as NNS1}; +export {NS2, NS2 as NNS2}; +export {NS1 as NNNS1}; +export {NS2 as NNNS2}; \ No newline at end of file diff --git a/tests/cases/compiler/reExportGlobalDeclaration4.ts b/tests/cases/compiler/reExportGlobalDeclaration4.ts new file mode 100644 index 00000000000..7298aa682fe --- /dev/null +++ b/tests/cases/compiler/reExportGlobalDeclaration4.ts @@ -0,0 +1,16 @@ +// @module: commonjs + +// @filename: file1.d.ts +declare class Cls1 { + x: number +} +declare class Cls2 { + x: number +} + + +// @filename: file2.ts +export {Cls1, Cls1 as CCls1}; +export {Cls2, Cls2 as CCls2}; +export {Cls1 as CCCls1}; +export {Cls2 as CCCls2}; \ No newline at end of file diff --git a/tests/cases/compiler/reExportUndefined1.ts b/tests/cases/compiler/reExportUndefined1.ts new file mode 100644 index 00000000000..7d949ca1c28 --- /dev/null +++ b/tests/cases/compiler/reExportUndefined1.ts @@ -0,0 +1,4 @@ +// @module: commonjs + +// @filename: a.ts +export { undefined }; \ No newline at end of file diff --git a/tests/cases/compiler/reExportUndefined2.ts b/tests/cases/compiler/reExportUndefined2.ts new file mode 100644 index 00000000000..0d3e381fcfa --- /dev/null +++ b/tests/cases/compiler/reExportUndefined2.ts @@ -0,0 +1,10 @@ +// @module: commonjs + +// @filename: a.ts +var undefined; +export { undefined }; + +// @filename: b.ts +import { undefined } from "./a"; +declare function use(a: number); +use(undefined); \ No newline at end of file diff --git a/tests/cases/compiler/reactNamespaceImportPresevation.tsx b/tests/cases/compiler/reactNamespaceImportPresevation.tsx new file mode 100644 index 00000000000..ec7e5d0d6ac --- /dev/null +++ b/tests/cases/compiler/reactNamespaceImportPresevation.tsx @@ -0,0 +1,15 @@ +//@jsx: preserve +//@module: commonjs +//@reactNamespace: myReactLib + +//@filename: modules.d.ts +declare module "my-React-Lib" { + var a: any; + export = a; +} + +//@filename: test.tsx +import * as myReactLib from "my-React-Lib"; // should not be elided +declare var foo: any; + +; diff --git a/tests/cases/compiler/reactNamespaceInvalidInput.tsx b/tests/cases/compiler/reactNamespaceInvalidInput.tsx new file mode 100644 index 00000000000..a8595de5d6e --- /dev/null +++ b/tests/cases/compiler/reactNamespaceInvalidInput.tsx @@ -0,0 +1,4 @@ +//@jsx: react +//@reactNamespace: my-React-Lib + +; diff --git a/tests/cases/compiler/reactNamespaceJSXEmit.tsx b/tests/cases/compiler/reactNamespaceJSXEmit.tsx new file mode 100644 index 00000000000..f5ec957a78b --- /dev/null +++ b/tests/cases/compiler/reactNamespaceJSXEmit.tsx @@ -0,0 +1,13 @@ +//@jsx: react +//@reactNamespace: myReactLib + +declare var myReactLib: any; +declare var foo: any; +declare var Bar: any; +declare var x: any; + +; +; +; +; +; diff --git a/tests/cases/compiler/reactNamespaceMissingDeclaration.tsx b/tests/cases/compiler/reactNamespaceMissingDeclaration.tsx new file mode 100644 index 00000000000..fdfed629606 --- /dev/null +++ b/tests/cases/compiler/reactNamespaceMissingDeclaration.tsx @@ -0,0 +1,5 @@ +//@jsx: react +//@reactNamespace: myReactLib + +// Error myReactLib not declared + \ No newline at end of file diff --git a/tests/cases/compiler/readonlyInDeclarationFile.ts b/tests/cases/compiler/readonlyInDeclarationFile.ts new file mode 100644 index 00000000000..03e643782f0 --- /dev/null +++ b/tests/cases/compiler/readonlyInDeclarationFile.ts @@ -0,0 +1,56 @@ +// @target: es5 +// @declaration: true + +interface Foo { + readonly x: number; + readonly [x: string]: Object; +} + +class C { + readonly [x: string]: Object; + private readonly a1: number; + protected readonly a2: number; + public readonly a3: number; + private get b1() { return 1 } + protected get b2() { return 1 } + public get b3() { return 1 } + private get c1() { return 1 } + private set c1(value) { } + protected get c2() { return 1 } + protected set c2(value) { } + public get c3() { return 1 } + public set c3(value) { } + private static readonly s1: number; + protected static readonly s2: number; + public static readonly s3: number; + private static get t1() { return 1 } + protected static get t2() { return 1 } + public static get t3() { return 1 } + private static get u1() { return 1 } + private static set u1(value) { } + protected static get u2() { return 1 } + protected static set u2(value) { } + public static get u3() { return 1 } + public static set u3(value) { } +} + +var z: { + readonly a: string; + readonly [x: string]: Object; +} + +function f() { + return { + get x() { return 1; }, + get y() { return 1; }, + set y(value) { } + } +} + +function g() { + var x: { + readonly a: string; + readonly [x: string]: Object; + } + return x; +} \ No newline at end of file diff --git a/tests/cases/compiler/readonlyInNonPropertyParameters.ts b/tests/cases/compiler/readonlyInNonPropertyParameters.ts new file mode 100644 index 00000000000..e3334e39719 --- /dev/null +++ b/tests/cases/compiler/readonlyInNonPropertyParameters.ts @@ -0,0 +1,10 @@ +//@target: ES5 + +// `readonly` won't work outside of property parameters +class X { + method(readonly x: number) {} + set x(readonly value: number) {} +} +(readonly x) => 0; +// OK to use `readonly` as a name +(readonly) => 0; \ No newline at end of file diff --git a/tests/cases/compiler/readonlyMembers.ts b/tests/cases/compiler/readonlyMembers.ts new file mode 100644 index 00000000000..f24b3657727 --- /dev/null +++ b/tests/cases/compiler/readonlyMembers.ts @@ -0,0 +1,67 @@ +// @target: es5 + +interface X { + readonly a: number; + readonly b?: number; +} +var x: X = { a: 0 }; +x.a = 1; // Error +x.b = 1; // Error + +class C { + readonly a: number; + readonly b = 1; + get c() { return 1 } + constructor() { + this.a = 1; // Ok + this.b = 1; // Ok + this.c = 1; // Error + const f = () => { + this.a = 1; // Error + this.b = 1; // Error + this.c = 1; // Error + } + } + foo() { + this.a = 1; // Error + this.b = 1; // Error + this.c = 1; // Error + } +} + +var o = { + get a() { return 1 }, + get b() { return 1 }, + set b(value) { } +}; +o.a = 1; // Error +o.b = 1; + +var p: { readonly a: number, b: number } = { a: 1, b: 1 }; +p.a = 1; // Error +p.b = 1; +var q: { a: number, b: number } = p; +q.a = 1; +q.b = 1; + +enum E { + A, B, C +} +E.A = 1; // Error + +namespace N { + export const a = 1; + export let b = 1; + export var c = 1; +} +N.a = 1; // Error +N.b = 1; +N.c = 1; + +let xx: { readonly [x: string]: string }; +let s = xx["foo"]; +xx["foo"] = "abc"; // Error + +let yy: { readonly [x: number]: string, [x: string]: string }; +yy[1] = "abc"; // Error +yy["foo"] = "abc"; \ No newline at end of file diff --git a/tests/cases/compiler/relativeNamesInClassicResolution.ts b/tests/cases/compiler/relativeNamesInClassicResolution.ts new file mode 100644 index 00000000000..7c73a2e3cad --- /dev/null +++ b/tests/cases/compiler/relativeNamesInClassicResolution.ts @@ -0,0 +1,7 @@ +// @module:amd + +// @filename: somefolder/a.ts +import {x} from "./b" + +// @filename: b.ts +export let x = 1; \ No newline at end of file diff --git a/tests/cases/compiler/shorthand-property-es5-es6.ts b/tests/cases/compiler/shorthand-property-es5-es6.ts new file mode 100644 index 00000000000..8c8ae4368a0 --- /dev/null +++ b/tests/cases/compiler/shorthand-property-es5-es6.ts @@ -0,0 +1,8 @@ +// @target: ES5 +// @module: ES6 +// @declaration: true + +// @filename: test.ts +import {foo} from './foo'; +const baz = 42; +const bar = { foo, baz }; diff --git a/tests/cases/compiler/shorthand-property-es6-amd.ts b/tests/cases/compiler/shorthand-property-es6-amd.ts new file mode 100644 index 00000000000..0f2a62ad86c --- /dev/null +++ b/tests/cases/compiler/shorthand-property-es6-amd.ts @@ -0,0 +1,8 @@ +// @target: ES6 +// @module: amd +// @declaration: true + +// @filename: test.ts +import {foo} from './foo'; +const baz = 42; +const bar = { foo, baz }; diff --git a/tests/cases/compiler/shorthand-property-es6-es6.ts b/tests/cases/compiler/shorthand-property-es6-es6.ts new file mode 100644 index 00000000000..f904e4f8dcf --- /dev/null +++ b/tests/cases/compiler/shorthand-property-es6-es6.ts @@ -0,0 +1,8 @@ +// @target: ES6 +// @module: ES6 +// @declaration: true + +// @filename: test.ts +import {foo} from './foo'; +const baz = 42; +const bar = { foo, baz }; diff --git a/tests/cases/compiler/singleLineCommentInConciseArrowFunctionES3.ts b/tests/cases/compiler/singleLineCommentInConciseArrowFunctionES3.ts new file mode 100644 index 00000000000..0538df1c2d0 --- /dev/null +++ b/tests/cases/compiler/singleLineCommentInConciseArrowFunctionES3.ts @@ -0,0 +1,5 @@ +function test() { + return () => + // some comments here; + 123; +} \ No newline at end of file diff --git a/tests/cases/compiler/sourceMapValidationDestructuringForArrayBindingPattern.ts b/tests/cases/compiler/sourceMapValidationDestructuringForArrayBindingPattern.ts new file mode 100644 index 00000000000..cd1ad012b25 --- /dev/null +++ b/tests/cases/compiler/sourceMapValidationDestructuringForArrayBindingPattern.ts @@ -0,0 +1,93 @@ +// @sourcemap: true +declare var console: { + log(msg: any): void; +} +type Robot = [number, string, string]; +type MultiSkilledRobot = [string, [string, string]]; + +let robotA: Robot = [1, "mower", "mowing"]; +function getRobot() { + return robotA; +} + +let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; +let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; +function getMultiRobot() { + return multiRobotA; +} + +for (let [, nameA] = robotA, i = 0; i < 1; i++) { + console.log(nameA); +} +for (let [, nameA] = getRobot(), i = 0; i < 1; i++) { + console.log(nameA); +} +for (let [, nameA] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + console.log(nameA); +} +for (let [, [primarySkillA, secondarySkillA]] = multiRobotA, i = 0; i < 1; i++) { + console.log(primarySkillA); +} +for (let [, [primarySkillA, secondarySkillA]] = getMultiRobot(), i = 0; i < 1; i++) { + console.log(primarySkillA); +} +for (let [, [primarySkillA, secondarySkillA]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + console.log(primarySkillA); +} + +for (let [numberB] = robotA, i = 0; i < 1; i++) { + console.log(numberB); +} +for (let [numberB] = getRobot(), i = 0; i < 1; i++) { + console.log(numberB); +} +for (let [numberB] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + console.log(numberB); +} +for (let [nameB] = multiRobotA, i = 0; i < 1; i++) { + console.log(nameB); +} +for (let [nameB] = getMultiRobot(), i = 0; i < 1; i++) { + console.log(nameB); +} +for (let [nameB] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + console.log(nameB); +} + +for (let [numberA2, nameA2, skillA2] = robotA, i = 0; i < 1; i++) { + console.log(nameA2); +} +for (let [numberA2, nameA2, skillA2] = getRobot(), i = 0; i < 1; i++) { + console.log(nameA2); +} +for (let [numberA2, nameA2, skillA2] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + console.log(nameA2); +} +for (let [nameMA, [primarySkillA, secondarySkillA]] = multiRobotA, i = 0; i < 1; i++) { + console.log(nameMA); +} +for (let [nameMA, [primarySkillA, secondarySkillA]] = getMultiRobot(), i = 0; i < 1; i++) { + console.log(nameMA); +} +for (let [nameMA, [primarySkillA, secondarySkillA]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + console.log(nameMA); +} + +for (let [numberA3, ...robotAInfo] = robotA, i = 0; i < 1; i++) { + console.log(numberA3); +} +for (let [numberA3, ...robotAInfo] = getRobot(), i = 0; i < 1; i++) { + console.log(numberA3); +} +for (let [numberA3, ...robotAInfo] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + console.log(numberA3); +} +for (let [...multiRobotAInfo] = multiRobotA, i = 0; i < 1; i++) { + console.log(multiRobotAInfo); +} +for (let [...multiRobotAInfo] = getMultiRobot(), i = 0; i < 1; i++) { + console.log(multiRobotAInfo); +} +for (let [...multiRobotAInfo] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + console.log(multiRobotAInfo); +} \ No newline at end of file diff --git a/tests/cases/compiler/sourceMapValidationDestructuringForArrayBindingPattern2.ts b/tests/cases/compiler/sourceMapValidationDestructuringForArrayBindingPattern2.ts new file mode 100644 index 00000000000..597f40afe86 --- /dev/null +++ b/tests/cases/compiler/sourceMapValidationDestructuringForArrayBindingPattern2.ts @@ -0,0 +1,99 @@ +// @sourcemap: true +declare var console: { + log(msg: any): void; +} +type Robot = [number, string, string]; +type MultiSkilledRobot = [string, [string, string]]; + +let robotA: Robot = [1, "mower", "mowing"]; +function getRobot() { + return robotA; +} + +let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; +let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; +function getMultiRobot() { + return multiRobotA; +} + +let nameA: string, primarySkillA: string, secondarySkillA: string; +let numberB: number, nameB: string; +let numberA2: number, nameA2: string, skillA2: string, nameMA: string; +let numberA3: number, robotAInfo: (number | string)[], multiRobotAInfo: (string | [string, string])[]; +let i: number; + +for ([, nameA] = robotA, i = 0; i < 1; i++) { + console.log(nameA); +} +for ([, nameA] = getRobot(), i = 0; i < 1; i++) { + console.log(nameA); +} +for ([, nameA] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + console.log(nameA); +} +for ([, [primarySkillA, secondarySkillA]] = multiRobotA, i = 0; i < 1; i++) { + console.log(primarySkillA); +} +for ([, [primarySkillA, secondarySkillA]] = getMultiRobot(), i = 0; i < 1; i++) { + console.log(primarySkillA); +} +for ([, [primarySkillA, secondarySkillA]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + console.log(primarySkillA); +} + +for ([numberB] = robotA, i = 0; i < 1; i++) { + console.log(numberB); +} +for ([numberB] = getRobot(), i = 0; i < 1; i++) { + console.log(numberB); +} +for ([numberB] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + console.log(numberB); +} +for ([nameB] = multiRobotA, i = 0; i < 1; i++) { + console.log(nameB); +} +for ([nameB] = getMultiRobot(), i = 0; i < 1; i++) { + console.log(nameB); +} +for ([nameB] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + console.log(nameB); +} + +for ([numberA2, nameA2, skillA2] = robotA, i = 0; i < 1; i++) { + console.log(nameA2); +} +for ([numberA2, nameA2, skillA2] = getRobot(), i = 0; i < 1; i++) { + console.log(nameA2); +} +for ([numberA2, nameA2, skillA2] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + console.log(nameA2); +} +for ([nameMA, [primarySkillA, secondarySkillA]] = multiRobotA, i = 0; i < 1; i++) { + console.log(nameMA); +} +for ([nameMA, [primarySkillA, secondarySkillA]] = getMultiRobot(), i = 0; i < 1; i++) { + console.log(nameMA); +} +for ([nameMA, [primarySkillA, secondarySkillA]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + console.log(nameMA); +} + +for ([numberA3, ...robotAInfo] = robotA, i = 0; i < 1; i++) { + console.log(numberA3); +} +for ([numberA3, ...robotAInfo] = getRobot(), i = 0; i < 1; i++) { + console.log(numberA3); +} +for ([numberA3, ...robotAInfo] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + console.log(numberA3); +} +for ([...multiRobotAInfo] = multiRobotA, i = 0; i < 1; i++) { + console.log(multiRobotAInfo); +} +for ([...multiRobotAInfo] = getMultiRobot(), i = 0; i < 1; i++) { + console.log(multiRobotAInfo); +} +for ([...multiRobotAInfo] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + console.log(multiRobotAInfo); +} \ No newline at end of file diff --git a/tests/cases/compiler/sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts b/tests/cases/compiler/sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts new file mode 100644 index 00000000000..36c3c8cb48c --- /dev/null +++ b/tests/cases/compiler/sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts @@ -0,0 +1,109 @@ +// @sourcemap: true +declare var console: { + log(msg: any): void; +} +type Robot = [number, string, string]; +type MultiSkilledRobot = [string, string[]]; + +let robotA: Robot = [1, "mower", "mowing"]; +function getRobot() { + return robotA; +} + +let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; +let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; +function getMultiRobot() { + return multiRobotA; +} + +for (let [, nameA ="name"] = robotA, i = 0; i < 1; i++) { + console.log(nameA); +} +for (let [, nameA = "name"] = getRobot(), i = 0; i < 1; i++) { + console.log(nameA); +} +for (let [, nameA = "name"] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + console.log(nameA); +} +for (let [, [ + primarySkillA = "primary", + secondarySkillA = "secondary" +] = ["none", "none"]] = multiRobotA, i = 0; i < 1; i++) { + console.log(primarySkillA); +} +for (let [, [ + primarySkillA = "primary", + secondarySkillA = "secondary" +] = ["none", "none"]] = getMultiRobot(), i = 0; i < 1; i++) { + console.log(primarySkillA); +} +for (let [, [ + primarySkillA = "primary", + secondarySkillA = "secondary" +] = ["none", "none"]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + console.log(primarySkillA); +} + +for (let [numberB = -1] = robotA, i = 0; i < 1; i++) { + console.log(numberB); +} +for (let [numberB = -1] = getRobot(), i = 0; i < 1; i++) { + console.log(numberB); +} +for (let [numberB = -1] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + console.log(numberB); +} +for (let [nameB = "name"] = multiRobotA, i = 0; i < 1; i++) { + console.log(nameB); +} +for (let [nameB = "name"] = getMultiRobot(), i = 0; i < 1; i++) { + console.log(nameB); +} +for (let [nameB = "name"] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + console.log(nameB); +} + +for (let [numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = robotA, i = 0; i < 1; i++) { + console.log(nameA2); +} +for (let [numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = getRobot(), i = 0; i < 1; i++) { + console.log(nameA2); +} +for (let [numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + console.log(nameA2); +} +for (let + [nameMA = "noName", + [ + primarySkillA = "primary", + secondarySkillA = "secondary" + ] = ["none", "none"] + ] = multiRobotA, i = 0; i < 1; i++) { + console.log(nameMA); +} +for (let [nameMA = "noName", + [ + primarySkillA = "primary", + secondarySkillA = "secondary" + ] = ["none", "none"] +] = getMultiRobot(), i = 0; i < 1; i++) { + console.log(nameMA); +} +for (let [nameMA = "noName", + [ + primarySkillA = "primary", + secondarySkillA = "secondary" + ] = ["none", "none"] +] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + console.log(nameMA); +} + +for (let [numberA3 = -1, ...robotAInfo] = robotA, i = 0; i < 1; i++) { + console.log(numberA3); +} +for (let [numberA3 = -1, ...robotAInfo] = getRobot(), i = 0; i < 1; i++) { + console.log(numberA3); +} +for (let [numberA3 = -1, ...robotAInfo] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + console.log(numberA3); +} \ No newline at end of file diff --git a/tests/cases/compiler/sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts b/tests/cases/compiler/sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts new file mode 100644 index 00000000000..4e0e5d053b3 --- /dev/null +++ b/tests/cases/compiler/sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts @@ -0,0 +1,115 @@ +// @sourcemap: true +declare var console: { + log(msg: any): void; +} +type Robot = [number, string, string]; +type MultiSkilledRobot = [string, [string, string]]; + +let robotA: Robot = [1, "mower", "mowing"]; +function getRobot() { + return robotA; +} + +let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; +let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; +function getMultiRobot() { + return multiRobotA; +} + +let nameA: string, primarySkillA: string, secondarySkillA: string; +let numberB: number, nameB: string; +let numberA2: number, nameA2: string, skillA2: string, nameMA: string; +let numberA3: number, robotAInfo: (number | string)[], multiRobotAInfo: (string | [string, string])[]; +let i: number; + +for ([, nameA = "name"] = robotA, i = 0; i < 1; i++) { + console.log(nameA); +} +for ([, nameA = "name"] = getRobot(), i = 0; i < 1; i++) { + console.log(nameA); +} +for ([, nameA = "name"] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + console.log(nameA); +} +for ([, [ + primarySkillA = "primary", + secondarySkillA = "secondary" +] = ["none", "none"]] = multiRobotA, i = 0; i < 1; i++) { + console.log(primarySkillA); +} +for ([, [ + primarySkillA = "primary", + secondarySkillA = "secondary" +] = ["none", "none"]] = getMultiRobot(), i = 0; i < 1; i++) { + console.log(primarySkillA); +} +for ([, [ + primarySkillA = "primary", + secondarySkillA = "secondary" +] = ["none", "none"]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + console.log(primarySkillA); +} + +for ([numberB = -1] = robotA, i = 0; i < 1; i++) { + console.log(numberB); +} +for ([numberB = -1] = getRobot(), i = 0; i < 1; i++) { + console.log(numberB); +} +for ([numberB = -1] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + console.log(numberB); +} +for ([nameB = "name"] = multiRobotA, i = 0; i < 1; i++) { + console.log(nameB); +} +for ([nameB = "name"] = getMultiRobot(), i = 0; i < 1; i++) { + console.log(nameB); +} +for ([nameB = "name"] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + console.log(nameB); +} + +for ([numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = robotA, i = 0; i < 1; i++) { + console.log(nameA2); +} +for ([numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = getRobot(), i = 0; i < 1; i++) { + console.log(nameA2); +} +for ([numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + console.log(nameA2); +} +for (let + [nameMA = "noName", + [ + primarySkillA = "primary", + secondarySkillA = "secondary" + ] = ["none", "none"] + ] = multiRobotA, i = 0; i < 1; i++) { + console.log(nameMA); +} +for ([nameMA = "noName", + [ + primarySkillA = "primary", + secondarySkillA = "secondary" + ] = ["none", "none"] +] = getMultiRobot(), i = 0; i < 1; i++) { + console.log(nameMA); +} +for ([nameMA = "noName", + [ + primarySkillA = "primary", + secondarySkillA = "secondary" + ] = ["none", "none"] +] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { + console.log(nameMA); +} + +for ([numberA3 = -1, ...robotAInfo] = robotA, i = 0; i < 1; i++) { + console.log(numberA3); +} +for ([numberA3 = -1, ...robotAInfo] = getRobot(), i = 0; i < 1; i++) { + console.log(numberA3); +} +for ([numberA3 = -1, ...robotAInfo] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { + console.log(numberA3); +} \ No newline at end of file diff --git a/tests/cases/compiler/sourceMapValidationDestructuringForObjectBindingPattern.ts b/tests/cases/compiler/sourceMapValidationDestructuringForObjectBindingPattern.ts new file mode 100644 index 00000000000..7d5471db324 --- /dev/null +++ b/tests/cases/compiler/sourceMapValidationDestructuringForObjectBindingPattern.ts @@ -0,0 +1,67 @@ +// @sourcemap: true +declare var console: { + log(msg: any): void; +} +interface Robot { + name: string; + skill: string; +} + +interface MultiRobot { + name: string; + skills: { + primary: string; + secondary: string; + }; +} + +let robot: Robot = { name: "mower", skill: "mowing" }; +let multiRobot: MultiRobot = { name: "mower", skills: { primary: "mowing", secondary: "none" } }; +function getRobot() { + return robot; +} +function getMultiRobot() { + return multiRobot; +} + +for (let {name: nameA } = robot, i = 0; i < 1; i++) { + console.log(nameA); +} +for (let {name: nameA } = getRobot(), i = 0; i < 1; i++) { + console.log(nameA); +} +for (let {name: nameA } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + console.log(nameA); +} +for (let { skills: { primary: primaryA, secondary: secondaryA } } = multiRobot, i = 0; i < 1; i++) { + console.log(primaryA); +} +for (let { skills: { primary: primaryA, secondary: secondaryA } } = getMultiRobot(), i = 0; i < 1; i++) { + console.log(primaryA); +} +for (let { skills: { primary: primaryA, secondary: secondaryA } } = + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, + i = 0; i < 1; i++) { + console.log(primaryA); +} + +for (let {name: nameA, skill: skillA } = robot, i = 0; i < 1; i++) { + console.log(nameA); +} +for (let {name: nameA, skill: skillA } = getRobot(), i = 0; i < 1; i++) { + console.log(nameA); +} +for (let {name: nameA, skill: skillA } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + console.log(nameA); +} +for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = multiRobot, i = 0; i < 1; i++) { + console.log(primaryA); +} +for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = getMultiRobot(), i = 0; i < 1; i++) { + console.log(primaryA); +} +for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, + i = 0; i < 1; i++) { + console.log(primaryA); +} \ No newline at end of file diff --git a/tests/cases/compiler/sourceMapValidationDestructuringForObjectBindingPattern2.ts b/tests/cases/compiler/sourceMapValidationDestructuringForObjectBindingPattern2.ts new file mode 100644 index 00000000000..3e018b2a6d5 --- /dev/null +++ b/tests/cases/compiler/sourceMapValidationDestructuringForObjectBindingPattern2.ts @@ -0,0 +1,111 @@ +// @sourcemap: true +declare var console: { + log(msg: any): void; +} +interface Robot { + name: string; + skill: string; +} + +interface MultiRobot { + name: string; + skills: { + primary: string; + secondary: string; + }; +} + +let robot: Robot = { name: "mower", skill: "mowing" }; +let multiRobot: MultiRobot = { name: "mower", skills: { primary: "mowing", secondary: "none" } }; +function getRobot() { + return robot; +} +function getMultiRobot() { + return multiRobot; +} + +let nameA: string, primaryA: string, secondaryA: string, i: number, skillA: string; +let name: string, primary: string, secondary: string, skill: string; + +for ({ name: nameA } = robot, i = 0; i < 1; i++) { + console.log(nameA); +} +for ({ name: nameA } = getRobot(), i = 0; i < 1; i++) { + console.log(nameA); +} +for ({ name: nameA } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + console.log(nameA); +} +for ({ skills: { primary: primaryA, secondary: secondaryA } } = multiRobot, i = 0; i < 1; i++) { + console.log(primaryA); +} +for ({ skills: { primary: primaryA, secondary: secondaryA } } = getMultiRobot(), i = 0; i < 1; i++) { + console.log(primaryA); +} +for ({ skills: { primary: primaryA, secondary: secondaryA } } = + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, + i = 0; i < 1; i++) { + console.log(primaryA); +} +for ({ name } = robot, i = 0; i < 1; i++) { + console.log(nameA); +} +for ({ name } = getRobot(), i = 0; i < 1; i++) { + console.log(nameA); +} +for ({ name } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + console.log(nameA); +} +for ({ skills: { primary, secondary } } = multiRobot, i = 0; i < 1; i++) { + console.log(primaryA); +} +for ({ skills: { primary, secondary } } = getMultiRobot(), i = 0; i < 1; i++) { + console.log(primaryA); +} +for ({ skills: { primary, secondary } } = + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, + i = 0; i < 1; i++) { + console.log(primaryA); +} + + +for ({ name: nameA, skill: skillA } = robot, i = 0; i < 1; i++) { + console.log(nameA); +} +for ({ name: nameA, skill: skillA } = getRobot(), i = 0; i < 1; i++) { + console.log(nameA); +} +for ({ name: nameA, skill: skillA } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + console.log(nameA); +} +for ({ name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = multiRobot, i = 0; i < 1; i++) { + console.log(primaryA); +} +for ({ name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = getMultiRobot(), i = 0; i < 1; i++) { + console.log(primaryA); +} +for ({ name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, + i = 0; i < 1; i++) { + console.log(primaryA); +} +for ({ name, skill } = robot, i = 0; i < 1; i++) { + console.log(nameA); +} +for ({ name, skill } = getRobot(), i = 0; i < 1; i++) { + console.log(nameA); +} +for ({ name, skill } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + console.log(nameA); +} +for ({ name, skills: { primary, secondary } } = multiRobot, i = 0; i < 1; i++) { + console.log(primaryA); +} +for ({ name, skills: { primary, secondary } } = getMultiRobot(), i = 0; i < 1; i++) { + console.log(primaryA); +} +for ({ name, skills: { primary, secondary } } = + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, + i = 0; i < 1; i++) { + console.log(primaryA); +} \ No newline at end of file diff --git a/tests/cases/compiler/sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts b/tests/cases/compiler/sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts new file mode 100644 index 00000000000..22c9ecdf66d --- /dev/null +++ b/tests/cases/compiler/sourceMapValidationDestructuringForObjectBindingPatternDefaultValues.ts @@ -0,0 +1,98 @@ +// @sourcemap: true +declare var console: { + log(msg: any): void; +} +interface Robot { + name: string; + skill: string; +} + +interface MultiRobot { + name: string; + skills: { + primary?: string; + secondary?: string; + }; +} + +let robot: Robot = { name: "mower", skill: "mowing" }; +let multiRobot: MultiRobot = { name: "mower", skills: { primary: "mowing", secondary: "none" } }; +function getRobot() { + return robot; +} +function getMultiRobot() { + return multiRobot; +} + +for (let {name: nameA= "noName" } = robot, i = 0; i < 1; i++) { + console.log(nameA); +} +for (let {name: nameA = "noName" } = getRobot(), i = 0; i < 1; i++) { + console.log(nameA); +} +for (let {name: nameA = "noName" } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + console.log(nameA); +} +for (let { + skills: { + primary: primaryA = "primary", + secondary: secondaryA = "secondary" + } = { primary: "none", secondary: "none" } +} = multiRobot, i = 0; i < 1; i++) { + console.log(primaryA); +} +for (let { + skills: { + primary: primaryA = "primary", + secondary: secondaryA = "secondary" + } = { primary: "none", secondary: "none" } +} = getMultiRobot(), i = 0; i < 1; i++) { + console.log(primaryA); +} +for (let { + skills: { + primary: primaryA = "primary", + secondary: secondaryA = "secondary" + } = { primary: "none", secondary: "none" } +} = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, + i = 0; i < 1; i++) { + console.log(primaryA); +} + +for (let {name: nameA = "noName", skill: skillA = "skill" } = robot, i = 0; i < 1; i++) { + console.log(nameA); +} +for (let {name: nameA = "noName", skill: skillA = "skill" } = getRobot(), i = 0; i < 1; i++) { + console.log(nameA); +} +for (let {name: nameA = "noName", skill: skillA = "skill" } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + console.log(nameA); +} +for (let { + name: nameA = "noName", + skills: { + primary: primaryA = "primary", + secondary: secondaryA = "secondary" + } = { primary: "none", secondary: "none" } +} = multiRobot, i = 0; i < 1; i++) { + console.log(primaryA); +} +for (let { + name: nameA = "noName", + skills: { + primary: primaryA = "primary", + secondary: secondaryA = "secondary" + } = { primary: "none", secondary: "none" } +} = getMultiRobot(), i = 0; i < 1; i++) { + console.log(primaryA); +} +for (let { + name: nameA = "noName", + skills: { + primary: primaryA = "primary", + secondary: secondaryA = "secondary" + } = { primary: "none", secondary: "none" } +} = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, + i = 0; i < 1; i++) { + console.log(primaryA); +} \ No newline at end of file diff --git a/tests/cases/compiler/sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts b/tests/cases/compiler/sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts new file mode 100644 index 00000000000..0240a82c40b --- /dev/null +++ b/tests/cases/compiler/sourceMapValidationDestructuringForObjectBindingPatternDefaultValues2.ts @@ -0,0 +1,175 @@ +// @sourcemap: true +declare var console: { + log(msg: any): void; +} +interface Robot { + name: string; + skill: string; +} + +interface MultiRobot { + name: string; + skills: { + primary?: string; + secondary?: string; + }; +} + +let robot: Robot = { name: "mower", skill: "mowing" }; +let multiRobot: MultiRobot = { name: "mower", skills: { primary: "mowing", secondary: "none" } }; +function getRobot() { + return robot; +} +function getMultiRobot() { + return multiRobot; +} + +let nameA: string, primaryA: string, secondaryA: string, i: number, skillA: string; +let name: string, primary: string, secondary: string, skill: string; + +for ({name: nameA = "noName" } = robot, i = 0; i < 1; i++) { + console.log(nameA); +} +for ({name: nameA = "noName" } = getRobot(), i = 0; i < 1; i++) { + console.log(nameA); +} +for ({name: nameA = "noName" } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + console.log(nameA); +} +for ({ + skills: { + primary: primaryA = "primary", + secondary: secondaryA = "secondary" + } = { primary: "none", secondary: "none" } +} = multiRobot, i = 0; i < 1; i++) { + console.log(primaryA); +} +for ({ + skills: { + primary: primaryA = "primary", + secondary: secondaryA = "secondary" + } = { primary: "none", secondary: "none" } +} = getMultiRobot(), i = 0; i < 1; i++) { + console.log(primaryA); +} +for ({ + skills: { + primary: primaryA = "primary", + secondary: secondaryA = "secondary" + } = { primary: "none", secondary: "none" } +} = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, + i = 0; i < 1; i++) { + console.log(primaryA); +} + +for ({ name = "noName" } = robot, i = 0; i < 1; i++) { + console.log(nameA); +} +for ({ name = "noName" } = getRobot(), i = 0; i < 1; i++) { + console.log(nameA); +} +for ({ name = "noName" } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + console.log(nameA); +} +for ({ + skills: { + primary = "primary", + secondary = "secondary" + } = { primary: "none", secondary: "none" } +} = multiRobot, i = 0; i < 1; i++) { + console.log(primaryA); +} +for ({ + skills: { + primary = "primary", + secondary = "secondary" + } = { primary: "none", secondary: "none" } +} = getMultiRobot(), i = 0; i < 1; i++) { + console.log(primaryA); +} +for ({ + skills: { + primary = "primary", + secondary = "secondary" + } = { primary: "none", secondary: "none" } +} = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, + i = 0; i < 1; i++) { + console.log(primaryA); +} + + +for ({name: nameA = "noName", skill: skillA = "skill" } = robot, i = 0; i < 1; i++) { + console.log(nameA); +} +for ({name: nameA = "noName", skill: skillA = "skill" } = getRobot(), i = 0; i < 1; i++) { + console.log(nameA); +} +for ({name: nameA = "noName", skill: skillA = "skill" } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + console.log(nameA); +} +for ({ + name: nameA = "noName", + skills: { + primary: primaryA = "primary", + secondary: secondaryA = "secondary" + } = { primary: "none", secondary: "none" } +} = multiRobot, i = 0; i < 1; i++) { + console.log(primaryA); +} +for ({ + name: nameA = "noName", + skills: { + primary: primaryA = "primary", + secondary: secondaryA = "secondary" + } = { primary: "none", secondary: "none" } +} = getMultiRobot(), i = 0; i < 1; i++) { + console.log(primaryA); +} +for ({ + name: nameA = "noName", + skills: { + primary: primaryA = "primary", + secondary: secondaryA = "secondary" + } = { primary: "none", secondary: "none" } +} = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, + i = 0; i < 1; i++) { + console.log(primaryA); +} + +for ({ name = "noName", skill = "skill" } = robot, i = 0; i < 1; i++) { + console.log(nameA); +} +for ({ name = "noName", skill = "skill" } = getRobot(), i = 0; i < 1; i++) { + console.log(nameA); +} +for ({ name = "noName", skill = "skill" } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { + console.log(nameA); +} +for ({ + name = "noName", + skills: { + primary = "primary", + secondary = "secondary" + } = { primary: "none", secondary: "none" } +} = multiRobot, i = 0; i < 1; i++) { + console.log(primaryA); +} +for ({ + name = "noName", + skills: { + primary = "primary", + secondary = "secondary" + } = { primary: "none", secondary: "none" } +} = getMultiRobot(), i = 0; i < 1; i++) { + console.log(primaryA); +} +for ({ + name = "noName", + skills: { + primary = "primary", + secondary = "secondary" + } = { primary: "none", secondary: "none" } +} = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, + i = 0; i < 1; i++) { + console.log(primaryA); +} \ No newline at end of file diff --git a/tests/cases/compiler/sourceMapValidationDestructuringForOfArrayBindingPattern.ts b/tests/cases/compiler/sourceMapValidationDestructuringForOfArrayBindingPattern.ts new file mode 100644 index 00000000000..f2fb461f443 --- /dev/null +++ b/tests/cases/compiler/sourceMapValidationDestructuringForOfArrayBindingPattern.ts @@ -0,0 +1,96 @@ +// @sourcemap: true +declare var console: { + log(msg: any): void; +} +type Robot = [number, string, string]; +type MultiSkilledRobot = [string, [string, string]]; + +let robotA: Robot = [1, "mower", "mowing"]; +let robotB: Robot = [2, "trimmer", "trimming"]; +let robots = [robotA, robotB]; +function getRobots() { + return robots; +} + +let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; +let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; +let multiRobots = [multiRobotA, multiRobotB]; +function getMultiRobots() { + return multiRobots; +} + +for (let [, nameA] of robots) { + console.log(nameA); +} +for (let [, nameA] of getRobots()) { + console.log(nameA); +} +for (let [, nameA] of [robotA, robotB]) { + console.log(nameA); +} +for (let [, [primarySkillA, secondarySkillA]] of multiRobots) { + console.log(primarySkillA); +} +for (let [, [primarySkillA, secondarySkillA]] of getMultiRobots()) { + console.log(primarySkillA); +} +for (let [, [primarySkillA, secondarySkillA]] of [multiRobotA, multiRobotB]) { + console.log(primarySkillA); +} + +for (let [numberB] of robots) { + console.log(numberB); +} +for (let [numberB] of getRobots()) { + console.log(numberB); +} +for (let [numberB] of [robotA, robotB]) { + console.log(numberB); +} +for (let [nameB] of multiRobots) { + console.log(nameB); +} +for (let [nameB] of getMultiRobots()) { + console.log(nameB); +} +for (let [nameB] of [multiRobotA, multiRobotB]) { + console.log(nameB); +} + +for (let [numberA2, nameA2, skillA2] of robots) { + console.log(nameA2); +} +for (let [numberA2, nameA2, skillA2] of getRobots()) { + console.log(nameA2); +} +for (let [numberA2, nameA2, skillA2] of [robotA, robotB]) { + console.log(nameA2); +} +for (let [nameMA, [primarySkillA, secondarySkillA]] of multiRobots) { + console.log(nameMA); +} +for (let [nameMA, [primarySkillA, secondarySkillA]] of getMultiRobots()) { + console.log(nameMA); +} +for (let [nameMA, [primarySkillA, secondarySkillA]] of [multiRobotA, multiRobotB]) { + console.log(nameMA); +} + +for (let [numberA3, ...robotAInfo] of robots) { + console.log(numberA3); +} +for (let [numberA3, ...robotAInfo] of getRobots()) { + console.log(numberA3); +} +for (let [numberA3, ...robotAInfo] of [robotA, robotB]) { + console.log(numberA3); +} +for (let [...multiRobotAInfo] of multiRobots) { + console.log(multiRobotAInfo); +} +for (let [...multiRobotAInfo] of getMultiRobots()) { + console.log(multiRobotAInfo); +} +for (let [...multiRobotAInfo] of [multiRobotA, multiRobotB]) { + console.log(multiRobotAInfo); +} \ No newline at end of file diff --git a/tests/cases/compiler/sourceMapValidationDestructuringForOfArrayBindingPattern2.ts b/tests/cases/compiler/sourceMapValidationDestructuringForOfArrayBindingPattern2.ts new file mode 100644 index 00000000000..365a030f8e9 --- /dev/null +++ b/tests/cases/compiler/sourceMapValidationDestructuringForOfArrayBindingPattern2.ts @@ -0,0 +1,101 @@ +// @sourcemap: true +declare var console: { + log(msg: any): void; +} +type Robot = [number, string, string]; +type MultiSkilledRobot = [string, [string, string]]; + +let robotA: Robot = [1, "mower", "mowing"]; +let robotB: Robot = [2, "trimmer", "trimming"]; +let robots = [robotA, robotB]; +function getRobots() { + return robots; +} + +let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; +let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; +let multiRobots = [multiRobotA, multiRobotB]; +function getMultiRobots() { + return multiRobots; +} + +let nameA: string, primarySkillA: string, secondarySkillA: string; +let numberB: number, nameB: string; +let numberA2: number, nameA2: string, skillA2: string, nameMA: string; +let numberA3: number, robotAInfo: (number | string)[], multiRobotAInfo: (string | [string, string])[]; + +for ([, nameA] of robots) { + console.log(nameA); +} +for ([, nameA] of getRobots()) { + console.log(nameA); +} +for ([, nameA] of [robotA, robotB]) { + console.log(nameA); +} +for ([, [primarySkillA, secondarySkillA]] of multiRobots) { + console.log(primarySkillA); +} +for ([, [primarySkillA, secondarySkillA]] of getMultiRobots()) { + console.log(primarySkillA); +} +for ([, [primarySkillA, secondarySkillA]] of [multiRobotA, multiRobotB]) { + console.log(primarySkillA); +} + +for ([numberB] of robots) { + console.log(numberB); +} +for ([numberB] of getRobots()) { + console.log(numberB); +} +for ([numberB] of [robotA, robotB]) { + console.log(numberB); +} +for ([nameB] of multiRobots) { + console.log(nameB); +} +for ([nameB] of getMultiRobots()) { + console.log(nameB); +} +for ([nameB] of [multiRobotA, multiRobotB]) { + console.log(nameB); +} + +for ([numberA2, nameA2, skillA2] of robots) { + console.log(nameA2); +} +for ([numberA2, nameA2, skillA2] of getRobots()) { + console.log(nameA2); +} +for ([numberA2, nameA2, skillA2] of [robotA, robotB]) { + console.log(nameA2); +} +for ([nameMA, [primarySkillA, secondarySkillA]] of multiRobots) { + console.log(nameMA); +} +for ([nameMA, [primarySkillA, secondarySkillA]] of getMultiRobots()) { + console.log(nameMA); +} +for ([nameMA, [primarySkillA, secondarySkillA]] of [multiRobotA, multiRobotB]) { + console.log(nameMA); +} + +for ([numberA3, ...robotAInfo] of robots) { + console.log(numberA3); +} +for ([numberA3, ...robotAInfo] of getRobots()) { + console.log(numberA3); +} +for ([numberA3, ...robotAInfo] of [robotA, robotB]) { + console.log(numberA3); +} +for ([...multiRobotAInfo] of multiRobots) { + console.log(multiRobotAInfo); +} +for ([...multiRobotAInfo] of getMultiRobots()) { + console.log(multiRobotAInfo); +} +for ([...multiRobotAInfo] of [multiRobotA, multiRobotB]) { + console.log(multiRobotAInfo); +} \ No newline at end of file diff --git a/tests/cases/compiler/sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts b/tests/cases/compiler/sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts new file mode 100644 index 00000000000..a619fc1c42f --- /dev/null +++ b/tests/cases/compiler/sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts @@ -0,0 +1,105 @@ +// @sourcemap: true +declare var console: { + log(msg: any): void; +} +type Robot = [number, string, string]; +type MultiSkilledRobot = [string, [string, string]]; + +let robotA: Robot = [1, "mower", "mowing"]; +let robotB: Robot = [2, "trimmer", "trimming"]; +let robots = [robotA, robotB]; +function getRobots() { + return robots; +} + +let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; +let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; +let multiRobots = [multiRobotA, multiRobotB]; +function getMultiRobots() { + return multiRobots; +} + +for (let [, nameA = "noName"] of robots) { + console.log(nameA); +} +for (let [, nameA = "noName"] of getRobots()) { + console.log(nameA); +} +for (let [, nameA = "noName"] of [robotA, robotB]) { + console.log(nameA); +} +for (let [, [ + primarySkillA = "primary", + secondarySkillA = "secondary" +] = ["skill1", "skill2"]] of multiRobots) { + console.log(primarySkillA); +} +for (let [, [ + primarySkillA = "primary", + secondarySkillA = "secondary" +] = ["skill1", "skill2"]] of getMultiRobots()) { + console.log(primarySkillA); +} +for (let [, [ + primarySkillA = "primary", + secondarySkillA = "secondary" +] = ["skill1", "skill2"]] of [multiRobotA, multiRobotB]) { + console.log(primarySkillA); +} + +for (let [numberB = -1] of robots) { + console.log(numberB); +} +for (let [numberB = -1] of getRobots()) { + console.log(numberB); +} +for (let [numberB = -1] of [robotA, robotB]) { + console.log(numberB); +} +for (let [nameB = "noName"] of multiRobots) { + console.log(nameB); +} +for (let [nameB = "noName"] of getMultiRobots()) { + console.log(nameB); +} +for (let [nameB = "noName"] of [multiRobotA, multiRobotB]) { + console.log(nameB); +} + +for (let [numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of robots) { + console.log(nameA2); +} +for (let [numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of getRobots()) { + console.log(nameA2); +} +for (let [numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of [robotA, robotB]) { + console.log(nameA2); +} +for (let [nameMA = "noName", [ + primarySkillA = "primary", + secondarySkillA = "secondary" +] = ["skill1", "skill2"]] of multiRobots) { + console.log(nameMA); +} +for (let [nameMA = "noName", [ + primarySkillA = "primary", + secondarySkillA = "secondary" +] = ["skill1", "skill2"]] of getMultiRobots()) { + console.log(nameMA); +} +for (let [nameMA = "noName", [ + primarySkillA = "primary", + secondarySkillA = "secondary" +] = ["skill1", "skill2"]] of [multiRobotA, multiRobotB]) { + console.log(nameMA); +} + +for (let [numberA3 = -1, ...robotAInfo] of robots) { + console.log(numberA3); +} +for (let [numberA3 = -1, ...robotAInfo] of getRobots()) { + console.log(numberA3); +} +for (let [numberA3 = -1, ...robotAInfo] of [robotA, robotB]) { + console.log(numberA3); +} \ No newline at end of file diff --git a/tests/cases/compiler/sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts b/tests/cases/compiler/sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts new file mode 100644 index 00000000000..ac0c8774567 --- /dev/null +++ b/tests/cases/compiler/sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts @@ -0,0 +1,110 @@ +// @sourcemap: true +declare var console: { + log(msg: any): void; +} +type Robot = [number, string, string]; +type MultiSkilledRobot = [string, [string, string]]; + +let robotA: Robot = [1, "mower", "mowing"]; +let robotB: Robot = [2, "trimmer", "trimming"]; +let robots = [robotA, robotB]; +function getRobots() { + return robots; +} + +let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; +let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; +let multiRobots = [multiRobotA, multiRobotB]; +function getMultiRobots() { + return multiRobots; +} + +let nameA: string, primarySkillA: string, secondarySkillA: string; +let numberB: number, nameB: string; +let numberA2: number, nameA2: string, skillA2: string, nameMA: string; +let numberA3: number, robotAInfo: (number | string)[], multiRobotAInfo: (string | [string, string])[]; + +for ([, nameA = "noName"] of robots) { + console.log(nameA); +} +for ([, nameA = "noName"] of getRobots()) { + console.log(nameA); +} +for ([, nameA = "noName"] of [robotA, robotB]) { + console.log(nameA); +} +for ([, [ + primarySkillA = "primary", + secondarySkillA = "secondary" +] = ["skill1", "skill2"]] of multiRobots) { + console.log(primarySkillA); +} +for ([, [ + primarySkillA = "primary", + secondarySkillA = "secondary" +] = ["skill1", "skill2"]] of getMultiRobots()) { + console.log(primarySkillA); +} +for ([, [ + primarySkillA = "primary", + secondarySkillA = "secondary" +] = ["skill1", "skill2"]] of [multiRobotA, multiRobotB]) { + console.log(primarySkillA); +} + +for ([numberB = -1] of robots) { + console.log(numberB); +} +for ([numberB = -1] of getRobots()) { + console.log(numberB); +} +for ([numberB = -1] of [robotA, robotB]) { + console.log(numberB); +} +for ([nameB = "noName"] of multiRobots) { + console.log(nameB); +} +for ([nameB = "noName"] of getMultiRobots()) { + console.log(nameB); +} +for ([nameB = "noName"] of [multiRobotA, multiRobotB]) { + console.log(nameB); +} + +for ([numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of robots) { + console.log(nameA2); +} +for ([numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of getRobots()) { + console.log(nameA2); +} +for ([numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of [robotA, robotB]) { + console.log(nameA2); +} +for ([nameMA = "noName", [ + primarySkillA = "primary", + secondarySkillA = "secondary" +] = ["skill1", "skill2"]] of multiRobots) { + console.log(nameMA); +} +for ([nameMA = "noName", [ + primarySkillA = "primary", + secondarySkillA = "secondary" +] = ["skill1", "skill2"]] of getMultiRobots()) { + console.log(nameMA); +} +for ([nameMA = "noName", [ + primarySkillA = "primary", + secondarySkillA = "secondary" +] = ["skill1", "skill2"]] of [multiRobotA, multiRobotB]) { + console.log(nameMA); +} + +for ([numberA3 = -1, ...robotAInfo] of robots) { + console.log(numberA3); +} +for ([numberA3 = -1, ...robotAInfo] of getRobots()) { + console.log(numberA3); +} +for ([numberA3 = -1, ...robotAInfo] of [robotA, robotB]) { + console.log(numberA3); +} \ No newline at end of file diff --git a/tests/cases/compiler/sourceMapValidationDestructuringForOfObjectBindingPattern.ts b/tests/cases/compiler/sourceMapValidationDestructuringForOfObjectBindingPattern.ts new file mode 100644 index 00000000000..df822f89bc0 --- /dev/null +++ b/tests/cases/compiler/sourceMapValidationDestructuringForOfObjectBindingPattern.ts @@ -0,0 +1,68 @@ +// @sourcemap: true +declare var console: { + log(msg: any): void; +} +interface Robot { + name: string; + skill: string; +} + +interface MultiRobot { + name: string; + skills: { + primary: string; + secondary: string; + }; +} + +let robots: Robot[] = [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]; +let multiRobots: MultiRobot[] = [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]; + +function getRobots() { + return robots; +} + +function getMultiRobots() { + return multiRobots; +} + +for (let {name: nameA } of robots) { + console.log(nameA); +} +for (let {name: nameA } of getRobots()) { + console.log(nameA); +} +for (let {name: nameA } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { + console.log(nameA); +} +for (let { skills: { primary: primaryA, secondary: secondaryA } } of multiRobots) { + console.log(primaryA); +} +for (let { skills: { primary: primaryA, secondary: secondaryA } } of getMultiRobots()) { + console.log(primaryA); +} +for (let { skills: { primary: primaryA, secondary: secondaryA } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { + console.log(primaryA); +} + +for (let {name: nameA, skill: skillA } of robots) { + console.log(nameA); +} +for (let {name: nameA, skill: skillA } of getRobots()) { + console.log(nameA); +} +for (let {name: nameA, skill: skillA } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { + console.log(nameA); +} +for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of multiRobots) { + console.log(nameA); +} +for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of getMultiRobots()) { + console.log(nameA); +} +for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { + console.log(nameA); +} \ No newline at end of file diff --git a/tests/cases/compiler/sourceMapValidationDestructuringForOfObjectBindingPattern2.ts b/tests/cases/compiler/sourceMapValidationDestructuringForOfObjectBindingPattern2.ts new file mode 100644 index 00000000000..7f71e7d6bdd --- /dev/null +++ b/tests/cases/compiler/sourceMapValidationDestructuringForOfObjectBindingPattern2.ts @@ -0,0 +1,110 @@ +// @sourcemap: true +declare var console: { + log(msg: any): void; +} +interface Robot { + name: string; + skill: string; +} + +interface MultiRobot { + name: string; + skills: { + primary: string; + secondary: string; + }; +} + +let robots: Robot[] = [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]; +let multiRobots: MultiRobot[] = [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]; + +function getRobots() { + return robots; +} + +function getMultiRobots() { + return multiRobots; +} + +let nameA: string, primaryA: string, secondaryA: string, i: number, skillA: string; +let name: string, primary: string, secondary: string, skill: string; + +for ({name: nameA } of robots) { + console.log(nameA); +} +for ({name: nameA } of getRobots()) { + console.log(nameA); +} +for ({name: nameA } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { + console.log(nameA); +} +for ({ skills: { primary: primaryA, secondary: secondaryA } } of multiRobots) { + console.log(primaryA); +} +for ({ skills: { primary: primaryA, secondary: secondaryA } } of getMultiRobots()) { + console.log(primaryA); +} +for ({ skills: { primary: primaryA, secondary: secondaryA } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { + console.log(primaryA); +} +for ({name } of robots) { + console.log(nameA); +} +for ({name } of getRobots()) { + console.log(nameA); +} +for ({name } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { + console.log(nameA); +} +for ({ skills: { primary, secondary } } of multiRobots) { + console.log(primaryA); +} +for ({ skills: { primary, secondary } } of getMultiRobots()) { + console.log(primaryA); +} +for ({ skills: { primary, secondary } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { + console.log(primaryA); +} + + +for ({name: nameA, skill: skillA } of robots) { + console.log(nameA); +} +for ({name: nameA, skill: skillA } of getRobots()) { + console.log(nameA); +} +for ({name: nameA, skill: skillA } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { + console.log(nameA); +} +for ({name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of multiRobots) { + console.log(nameA); +} +for ({name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of getMultiRobots()) { + console.log(nameA); +} +for ({name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { + console.log(nameA); +} +for ({name, skill } of robots) { + console.log(nameA); +} +for ({name, skill } of getRobots()) { + console.log(nameA); +} +for ({name, skill } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { + console.log(nameA); +} +for ({name, skills: { primary, secondary } } of multiRobots) { + console.log(nameA); +} +for ({name, skills: { primary, secondary } } of getMultiRobots()) { + console.log(nameA); +} +for ({name, skills: { primary, secondary } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { + console.log(nameA); +} \ No newline at end of file diff --git a/tests/cases/compiler/sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts b/tests/cases/compiler/sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts new file mode 100644 index 00000000000..d8f88189c01 --- /dev/null +++ b/tests/cases/compiler/sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts @@ -0,0 +1,90 @@ +// @sourcemap: true +declare var console: { + log(msg: any): void; +} +interface Robot { + name: string; + skill: string; +} + +interface MultiRobot { + name: string; + skills: { + primary?: string; + secondary?: string; + }; +} + +let robots: Robot[] = [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]; +let multiRobots: MultiRobot[] = [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]; + +function getRobots() { + return robots; +} + +function getMultiRobots() { + return multiRobots; +} + +for (let {name: nameA = "noName" } of robots) { + console.log(nameA); +} +for (let {name: nameA = "noName" } of getRobots()) { + console.log(nameA); +} +for (let {name: nameA = "noName" } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { + console.log(nameA); +} +for (let { skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = + { primary: "nosKill", secondary: "noSkill" } } of multiRobots) { + console.log(primaryA); +} +for (let { skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = + { primary: "nosKill", secondary: "noSkill" } } of getMultiRobots()) { + console.log(primaryA); +} +for (let { skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = + { primary: "nosKill", secondary: "noSkill" } } of + [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { + console.log(primaryA); +} + +for (let {name: nameA = "noName", skill: skillA = "noSkill" } of robots) { + console.log(nameA); +} +for (let {name: nameA = "noName", skill: skillA = "noSkill" } of getRobots()) { + console.log(nameA); +} +for (let {name: nameA = "noName", skill: skillA = "noSkill" } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { + console.log(nameA); +} +for (let { + name: nameA = "noName", + skills: { + primary: primaryA = "primary", + secondary: secondaryA = "secondary" + } = { primary: "noSkill", secondary: "noSkill" } +} of multiRobots) { + console.log(nameA); +} +for (let { + name: nameA = "noName", + skills: { + primary: primaryA = "primary", + secondary: secondaryA = "secondary" + } = { primary: "noSkill", secondary: "noSkill" } +} of getMultiRobots()) { + console.log(nameA); +} +for (let { + name: nameA = "noName", + skills: { + primary: primaryA = "primary", + secondary: secondaryA = "secondary" + } = { primary: "noSkill", secondary: "noSkill" } +} of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { + console.log(nameA); +} \ No newline at end of file diff --git a/tests/cases/compiler/sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts b/tests/cases/compiler/sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts new file mode 100644 index 00000000000..01d2f6133a3 --- /dev/null +++ b/tests/cases/compiler/sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts @@ -0,0 +1,167 @@ +// @sourcemap: true +declare var console: { + log(msg: any): void; +} +interface Robot { + name: string; + skill: string; +} + +interface MultiRobot { + name: string; + skills: { + primary: string; + secondary: string; + }; +} + +let robots: Robot[] = [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]; +let multiRobots: MultiRobot[] = [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]; + +function getRobots() { + return robots; +} + +function getMultiRobots() { + return multiRobots; +} + +let nameA: string, primaryA: string, secondaryA: string, i: number, skillA: string; +let name: string, primary: string, secondary: string, skill: string; + +for ({name: nameA = "noName" } of robots) { + console.log(nameA); +} +for ({name: nameA = "noName" } of getRobots()) { + console.log(nameA); +} +for ({name: nameA = "noName" } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { + console.log(nameA); +} +for ({ skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = + { primary: "nosKill", secondary: "noSkill" } } of multiRobots) { + console.log(primaryA); +} +for ({ skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = + { primary: "nosKill", secondary: "noSkill" } } of getMultiRobots()) { + console.log(primaryA); +} +for ({ skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = + { primary: "nosKill", secondary: "noSkill" } } of + [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { + console.log(primaryA); +} + +for ({ name = "noName" } of robots) { + console.log(nameA); +} +for ({ name = "noName" } of getRobots()) { + console.log(nameA); +} +for ({ name = "noName" } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { + console.log(nameA); +} +for ({ + skills: { + primary = "primary", + secondary = "secondary" + } = { primary: "noSkill", secondary: "noSkill" } +} of multiRobots) { + console.log(primaryA); +} +for ({ + skills: { + primary = "primary", + secondary = "secondary" + } = { primary: "noSkill", secondary: "noSkill" } +} of getMultiRobots()) { + console.log(primaryA); +} +for ({ + skills: { + primary = "primary", + secondary = "secondary" + } = { primary: "noSkill", secondary: "noSkill" } +} of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { + console.log(primaryA); +} + + +for ({name: nameA = "noName", skill: skillA = "noSkill" } of robots) { + console.log(nameA); +} +for ({name: nameA = "noName", skill: skillA = "noSkill" } of getRobots()) { + console.log(nameA); +} +for ({name: nameA = "noName", skill: skillA = "noSkill" } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { + console.log(nameA); +} +for ({ + name: nameA = "noName", + skills: { + primary: primaryA = "primary", + secondary: secondaryA = "secondary" + } = { primary: "noSkill", secondary: "noSkill" } +} of multiRobots) { + console.log(nameA); +} +for ({ + name: nameA = "noName", + skills: { + primary: primaryA = "primary", + secondary: secondaryA = "secondary" + } = { primary: "noSkill", secondary: "noSkill" } +} of getMultiRobots()) { + console.log(nameA); +} +for ({ + name: nameA = "noName", + skills: { + primary: primaryA = "primary", + secondary: secondaryA = "secondary" + } = { primary: "noSkill", secondary: "noSkill" } +} of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { + console.log(nameA); +} + +for ({ name = "noName", skill = "noSkill" } of robots) { + console.log(nameA); +} +for ({ name = "noName", skill = "noSkill" } of getRobots()) { + console.log(nameA); +} +for ({ name = "noName", skill = "noSkill" } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { + console.log(nameA); +} +for ({ + name = "noName", + skills: { + primary = "primary", + secondary = "secondary" + } = { primary: "noSkill", secondary: "noSkill" } +} of multiRobots) { + console.log(nameA); +} +for ({ + name = "noName", + skills: { + primary = "primary", + secondary = "secondary" + } = { primary: "noSkill", secondary: "noSkill" } +} of getMultiRobots()) { + console.log(nameA); +} +for ({ + name = "noName", + skills: { + primary = "primary", + secondary = "secondary" + } = { primary: "noSkill", secondary: "noSkill" } +} of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, + { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { + console.log(nameA); +} \ No newline at end of file diff --git a/tests/cases/compiler/sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts b/tests/cases/compiler/sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts new file mode 100644 index 00000000000..062acd823ac --- /dev/null +++ b/tests/cases/compiler/sourceMapValidationDestructuringParameterNestedObjectBindingPattern.ts @@ -0,0 +1,31 @@ +// @sourcemap: true +declare var console: { + log(msg: string): void; +} +interface Robot { + name: string; + skills: { + primary: string; + secondary: string; + }; +} +var robotA: Robot = { name: "mower", skills: { primary: "mowing", secondary: "none" } }; + +function foo1({ skills: { primary: primaryA, secondary: secondaryA } }: Robot) { + console.log(primaryA); +} +function foo2({ name: nameC, skills: { primary: primaryB, secondary: secondaryB } }: Robot) { + console.log(secondaryB); +} +function foo3({ skills }: Robot) { + console.log(skills.primary); +} + +foo1(robotA); +foo1({ name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }); + +foo2(robotA); +foo2({ name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }); + +foo3(robotA); +foo3({ name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }); diff --git a/tests/cases/compiler/sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts b/tests/cases/compiler/sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts new file mode 100644 index 00000000000..c9dd735e8b6 --- /dev/null +++ b/tests/cases/compiler/sourceMapValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts @@ -0,0 +1,44 @@ +// @sourcemap: true +declare var console: { + log(msg: string): void; +} +interface Robot { + name: string; + skills: { + primary?: string; + secondary?: string; + }; +} +var robotA: Robot = { name: "mower", skills: { primary: "mowing", secondary: "none" } }; + +function foo1( + { + skills: { + primary: primaryA = "primary", + secondary: secondaryA = "secondary" + } = { primary: "SomeSkill", secondary: "someSkill" } + }: Robot = robotA) { + console.log(primaryA); +} +function foo2( + { + name: nameC = "name", + skills: { + primary: primaryB = "primary", + secondary: secondaryB = "secondary" + } = { primary: "SomeSkill", secondary: "someSkill" } + }: Robot = robotA) { + console.log(secondaryB); +} +function foo3({ skills = { primary: "SomeSkill", secondary: "someSkill" } }: Robot = robotA) { + console.log(skills.primary); +} + +foo1(robotA); +foo1({ name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }); + +foo2(robotA); +foo2({ name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }); + +foo3(robotA); +foo3({ name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }); diff --git a/tests/cases/compiler/sourceMapValidationDestructuringParameterObjectBindingPattern.ts b/tests/cases/compiler/sourceMapValidationDestructuringParameterObjectBindingPattern.ts new file mode 100644 index 00000000000..0f52806dd16 --- /dev/null +++ b/tests/cases/compiler/sourceMapValidationDestructuringParameterObjectBindingPattern.ts @@ -0,0 +1,29 @@ +// @sourcemap: true +interface Robot { + name: string; + skill: string; +} +declare var console: { + log(msg: string): void; +} +var hello = "hello"; +var robotA: Robot = { name: "mower", skill: "mowing" }; + +function foo1({ name: nameA }: Robot) { + console.log(nameA); +} +function foo2({ name: nameB, skill: skillB }: Robot) { + console.log(nameB); +} +function foo3({ name }: Robot) { + console.log(name); +} + +foo1(robotA); +foo1({ name: "Edger", skill: "cutting edges" }); + +foo2(robotA); +foo2({ name: "Edger", skill: "cutting edges" }); + +foo3(robotA); +foo3({ name: "Edger", skill: "cutting edges" }); diff --git a/tests/cases/compiler/sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.ts b/tests/cases/compiler/sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.ts new file mode 100644 index 00000000000..6fc9c5a605e --- /dev/null +++ b/tests/cases/compiler/sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.ts @@ -0,0 +1,29 @@ +// @sourcemap: true +interface Robot { + name?: string; + skill?: string; +} +declare var console: { + log(msg: string): void; +} +var hello = "hello"; +var robotA: Robot = { name: "mower", skill: "mowing" }; + +function foo1({ name: nameA = "" }: Robot = { }) { + console.log(nameA); +} +function foo2({ name: nameB = "", skill: skillB = "noSkill" }: Robot = {}) { + console.log(nameB); +} +function foo3({ name = "" }: Robot = {}) { + console.log(name); +} + +foo1(robotA); +foo1({ name: "Edger", skill: "cutting edges" }); + +foo2(robotA); +foo2({ name: "Edger", skill: "cutting edges" }); + +foo3(robotA); +foo3({ name: "Edger", skill: "cutting edges" }); diff --git a/tests/cases/compiler/sourceMapValidationDestructuringParametertArrayBindingPattern.ts b/tests/cases/compiler/sourceMapValidationDestructuringParametertArrayBindingPattern.ts new file mode 100644 index 00000000000..731dc7f2657 --- /dev/null +++ b/tests/cases/compiler/sourceMapValidationDestructuringParametertArrayBindingPattern.ts @@ -0,0 +1,34 @@ +// @sourcemap: true +declare var console: { + log(msg: any): void; +} +type Robot = [number, string, string]; +var robotA: Robot = [1, "mower", "mowing"]; + +function foo1([, nameA]: Robot) { + console.log(nameA); +} + +function foo2([numberB]: Robot) { + console.log(numberB); +} + +function foo3([numberA2, nameA2, skillA2]: Robot) { + console.log(nameA2); +} + +function foo4([numberA3, ...robotAInfo]: Robot) { + console.log(robotAInfo); +} + +foo1(robotA); +foo1([2, "trimmer", "trimming"]); + +foo2(robotA); +foo2([2, "trimmer", "trimming"]); + +foo3(robotA); +foo3([2, "trimmer", "trimming"]); + +foo4(robotA); +foo4([2, "trimmer", "trimming"]); \ No newline at end of file diff --git a/tests/cases/compiler/sourceMapValidationDestructuringParametertArrayBindingPattern2.ts b/tests/cases/compiler/sourceMapValidationDestructuringParametertArrayBindingPattern2.ts new file mode 100644 index 00000000000..07c2a24e70e --- /dev/null +++ b/tests/cases/compiler/sourceMapValidationDestructuringParametertArrayBindingPattern2.ts @@ -0,0 +1,34 @@ +// @sourcemap: true +declare var console: { + log(msg: any): void; +} +type Robot = [string, [string, string]]; +var robotA: Robot = ["trimmer", ["trimming", "edging"]]; + +function foo1([, skillA]: Robot) { + console.log(skillA); +} + +function foo2([nameMB]: Robot) { + console.log(nameMB); +} + +function foo3([nameMA, [primarySkillA, secondarySkillA]]: Robot) { + console.log(nameMA); +} + +function foo4([...multiRobotAInfo]: Robot) { + console.log(multiRobotAInfo); +} + +foo1(robotA); +foo1(["roomba", ["vaccum", "mopping"]]); + +foo2(robotA); +foo2(["roomba", ["vaccum", "mopping"]]); + +foo3(robotA); +foo3(["roomba", ["vaccum", "mopping"]]); + +foo4(robotA); +foo4(["roomba", ["vaccum", "mopping"]]); \ No newline at end of file diff --git a/tests/cases/compiler/sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.ts b/tests/cases/compiler/sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.ts new file mode 100644 index 00000000000..345d3965156 --- /dev/null +++ b/tests/cases/compiler/sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.ts @@ -0,0 +1,34 @@ +// @sourcemap: true +declare var console: { + log(msg: any): void; +} +type Robot = [number, string, string]; +var robotA: Robot = [1, "mower", "mowing"]; + +function foo1([, nameA = "noName"]: Robot = [-1, "name", "skill"]) { + console.log(nameA); +} + +function foo2([numberB = -1]: Robot = [-1, "name", "skill"]) { + console.log(numberB); +} + +function foo3([numberA2 = -1, nameA2 = "name", skillA2 = "skill"]: Robot = [-1, "name", "skill"]) { + console.log(nameA2); +} + +function foo4([numberA3 = -1, ...robotAInfo]: Robot = [-1, "name", "skill"]) { + console.log(robotAInfo); +} + +foo1(robotA); +foo1([2, "trimmer", "trimming"]); + +foo2(robotA); +foo2([2, "trimmer", "trimming"]); + +foo3(robotA); +foo3([2, "trimmer", "trimming"]); + +foo4(robotA); +foo4([2, "trimmer", "trimming"]); \ No newline at end of file diff --git a/tests/cases/compiler/sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2.ts b/tests/cases/compiler/sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2.ts new file mode 100644 index 00000000000..83f95c09c02 --- /dev/null +++ b/tests/cases/compiler/sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2.ts @@ -0,0 +1,30 @@ +// @sourcemap: true +declare var console: { + log(msg: any): void; +} +type Robot = [string, string[]]; +var robotA: Robot = ["trimmer", ["trimming", "edging"]]; + +function foo1([, skillA = ["noSkill", "noSkill"]]: Robot= ["name", ["skill1", "skill2"]]) { + console.log(skillA); +} + +function foo2([nameMB = "noName"]: Robot = ["name", ["skill1", "skill2"]]) { + console.log(nameMB); +} + +function foo3([nameMA = "noName", [ + primarySkillA = "primary", + secondarySkillA = "secondary" +] = ["noSkill", "noSkill"]]: Robot) { + console.log(nameMA); +} + +foo1(robotA); +foo1(["roomba", ["vaccum", "mopping"]]); + +foo2(robotA); +foo2(["roomba", ["vaccum", "mopping"]]); + +foo3(robotA); +foo3(["roomba", ["vaccum", "mopping"]]); \ No newline at end of file diff --git a/tests/cases/compiler/sourceMapValidationDestructuringVariableStatement.ts b/tests/cases/compiler/sourceMapValidationDestructuringVariableStatement.ts new file mode 100644 index 00000000000..88e49498f60 --- /dev/null +++ b/tests/cases/compiler/sourceMapValidationDestructuringVariableStatement.ts @@ -0,0 +1,20 @@ +// @sourcemap: true +interface Robot { + name: string; + skill: string; +} +declare var console: { + log(msg: string): void; +} +var hello = "hello"; +var robotA: Robot = { name: "mower", skill: "mowing" }; +var robotB: Robot = { name: "trimmer", skill: "trimming" }; +var { name: nameA } = robotA; +var { name: nameB, skill: skillB } = robotB; +var { name: nameC, skill: skillC } = { name: "Edger", skill: "cutting edges" }; +if (nameA == nameB) { + console.log(skillB); +} +else { + console.log(nameC); +} \ No newline at end of file diff --git a/tests/cases/compiler/sourceMapValidationDestructuringVariableStatement1.ts b/tests/cases/compiler/sourceMapValidationDestructuringVariableStatement1.ts new file mode 100644 index 00000000000..3697402bbcf --- /dev/null +++ b/tests/cases/compiler/sourceMapValidationDestructuringVariableStatement1.ts @@ -0,0 +1,28 @@ +// @sourcemap: true +interface Robot { + name: string; + skill: string; +} +declare var console: { + log(msg: string): void; +} +var hello = "hello"; +var robotA: Robot = { name: "mower", skill: "mowing" }; +var robotB: Robot = { name: "trimmer", skill: "trimming" }; +var a: string, { name: nameA } = robotA; +var b: string, { name: nameB, skill: skillB } = robotB; +var c: string, { name: nameC, skill: skillC } = { name: "Edger", skill: "cutting edges" }; + +var { name: nameA } = robotA, a = hello; +var { name: nameB, skill: skillB } = robotB, b = " hello"; +var { name: nameC, skill: skillC } = { name: "Edger", skill: "cutting edges" }, c = hello; + +var a = hello, { name: nameA } = robotA, a1= "hello"; +var b = hello, { name: nameB, skill: skillB } = robotB, b1 = "hello"; +var c = hello, { name: nameC, skill: skillC } = { name: "Edger", skill: "cutting edges" }, c1 = hello; +if (nameA == nameB) { + console.log(skillB); +} +else { + console.log(nameC); +} \ No newline at end of file diff --git a/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts b/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts new file mode 100644 index 00000000000..3ac03143aa2 --- /dev/null +++ b/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts @@ -0,0 +1,21 @@ +// @sourcemap: true +declare var console: { + log(msg: string): void; +} +type Robot = [number, string, string]; +var robotA: Robot = [1, "mower", "mowing"]; +var robotB: Robot = [2, "trimmer", "trimming"]; + + +let [, nameA] = robotA; +let [numberB] = robotB; +let [numberA2, nameA2, skillA2] = robotA; + +let [numberC2] = [3, "edging", "Trimming edges"]; +let [numberC, nameC, skillC] = [3, "edging", "Trimming edges"]; + +let [numberA3, ...robotAInfo] = robotA; + +if (nameA == nameA2) { + console.log(skillA2); +} \ No newline at end of file diff --git a/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPattern2.ts b/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPattern2.ts new file mode 100644 index 00000000000..27497f2c220 --- /dev/null +++ b/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPattern2.ts @@ -0,0 +1,20 @@ +// @sourcemap: true +declare var console: { + log(msg: string): void; +} +type MultiSkilledRobot = [string, [string, string]]; +var multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; +var multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; + +let [, skillA] = multiRobotA; +let [nameMB] = multiRobotB; +let [nameMA, [primarySkillA, secondarySkillA]] = multiRobotA; + +let [nameMC] = ["roomba", ["vaccum", "mopping"]]; +let [nameMC2, [primarySkillC, secondarySkillC]] = ["roomba", ["vaccum", "mopping"]]; + +let [...multiRobotAInfo] = multiRobotA; + +if (nameMB == nameMA) { + console.log(skillA[0] + skillA[1]); +} \ No newline at end of file diff --git a/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts b/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts new file mode 100644 index 00000000000..78ed29c397b --- /dev/null +++ b/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts @@ -0,0 +1,57 @@ +// @sourcemap: true +declare var console: { + log(msg: any): void; +} +type Robot = [number, string, string]; +type MultiSkilledRobot = [string, [string, string]]; + +var robotA: Robot = [1, "mower", "mowing"]; +var robotB: Robot = [2, "trimmer", "trimming"]; +var multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; +var multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; + +let nameA: string, numberB: number, nameB: string, skillB: string; +let robotAInfo: (number | string)[]; + +let multiSkillB: [string, string], nameMB: string, primarySkillB: string, secondarySkillB: string; +let multiRobotAInfo: (string | [string, string])[]; + +[, nameA] = robotA; +[, nameB] = getRobotB(); +[, nameB] = [2, "trimmer", "trimming"]; +[, multiSkillB] = multiRobotB; +[, multiSkillB] = getMultiRobotB(); +[, multiSkillB] = ["roomba", ["vaccum", "mopping"]]; + +[numberB] = robotB; +[numberB] = getRobotB(); +[numberB] = [2, "trimmer", "trimming"]; +[nameMB] = multiRobotB; +[nameMB] = getMultiRobotB(); +[nameMB] = ["trimmer", ["trimming", "edging"]]; + +[numberB, nameB, skillB] = robotB; +[numberB, nameB, skillB] = getRobotB(); +[numberB, nameB, skillB] = [2, "trimmer", "trimming"]; +[nameMB, [primarySkillB, secondarySkillB]] = multiRobotB; +[nameMB, [primarySkillB, secondarySkillB]] = getMultiRobotB(); +[nameMB, [primarySkillB, secondarySkillB]] = ["trimmer", ["trimming", "edging"]]; + +[numberB, ...robotAInfo] = robotB; +[numberB, ...robotAInfo] = getRobotB(); +[numberB, ...robotAInfo] = [2, "trimmer", "trimming"]; +[...multiRobotAInfo] = multiRobotA; +[...multiRobotAInfo] = getMultiRobotB(); +[...multiRobotAInfo] = ["trimmer", ["trimming", "edging"]]; + +if (nameA == nameB) { + console.log(skillB); +} + +function getRobotB() { + return robotB; +} + +function getMultiRobotB() { + return multiRobotB; +} \ No newline at end of file diff --git a/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPattern4.ts b/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPattern4.ts new file mode 100644 index 00000000000..da41b8ca49f --- /dev/null +++ b/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPattern4.ts @@ -0,0 +1,3 @@ +// @sourcemap: true + +var [x] = [1, 2]; \ No newline at end of file diff --git a/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPattern5.ts b/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPattern5.ts new file mode 100644 index 00000000000..8e9d05fadd5 --- /dev/null +++ b/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPattern5.ts @@ -0,0 +1,4 @@ +// @sourcemap: true + +var [x] = [1, 2]; +var [y, z] = [1, 2]; \ No newline at end of file diff --git a/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPattern6.ts b/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPattern6.ts new file mode 100644 index 00000000000..6c3ea7bedd7 --- /dev/null +++ b/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPattern6.ts @@ -0,0 +1,3 @@ +// @sourcemap: true + +var [x = 20] = [1, 2]; \ No newline at end of file diff --git a/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPattern7.ts b/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPattern7.ts new file mode 100644 index 00000000000..d9d91eb578b --- /dev/null +++ b/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPattern7.ts @@ -0,0 +1,3 @@ +// @sourcemap: true + +var [x = 20, j] = [1, 2]; \ No newline at end of file diff --git a/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.ts b/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.ts new file mode 100644 index 00000000000..fb942310389 --- /dev/null +++ b/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.ts @@ -0,0 +1,20 @@ +// @sourcemap: true +declare var console: { + log(msg: string): void; +} +type Robot = [number, string, string]; +var robotA: Robot = [1, "mower", "mowing"]; +var robotB: Robot = [2, "trimmer", "trimming"]; + +let [, nameA = "noName"] = robotA; +let [numberB = -1] = robotB; +let [numberA2 = -1, nameA2 = "noName", skillA2 = "noSkill"] = robotA; + +let [numberC2 = -1] = [3, "edging", "Trimming edges"]; +let [numberC = -1, nameC = "noName", skillC = "noSkill"] = [3, "edging", "Trimming edges"]; + +let [numberA3 = -1, ...robotAInfo] = robotA; + +if (nameA == nameA2) { + console.log(skillA2); +} \ No newline at end of file diff --git a/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues2.ts b/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues2.ts new file mode 100644 index 00000000000..4b4ef07d232 --- /dev/null +++ b/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues2.ts @@ -0,0 +1,18 @@ +// @sourcemap: true +declare var console: { + log(msg: string): void; +} +type MultiSkilledRobot = [string, string[]]; +var multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; +var multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; + +let [, skillA = ["noSkill", "noSkill"]] = multiRobotA; +let [nameMB = "noName" ] = multiRobotB; +let [nameMA = "noName", [primarySkillA = "noSkill", secondarySkillA = "noSkill"] = ["noSkill", "noSkill"]] = multiRobotA; + +let [nameMC = "noName" ] = ["roomba", ["vaccum", "mopping"]]; +let [nameMC2 = "noName", [primarySkillC = "noSkill", secondarySkillC = "noSkill"] = ["noSkill", "noSkill"]] = ["roomba", ["vaccum", "mopping"]]; + +if (nameMB == nameMA) { + console.log(skillA[0] + skillA[1]); +} \ No newline at end of file diff --git a/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts b/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts new file mode 100644 index 00000000000..253d96d4b35 --- /dev/null +++ b/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts @@ -0,0 +1,55 @@ +// @sourcemap: true +declare var console: { + log(msg: any): void; +} +type Robot = [number, string, string]; +type MultiSkilledRobot = [string, string[]]; + +var robotA: Robot = [1, "mower", "mowing"]; +var robotB: Robot = [2, "trimmer", "trimming"]; +var multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; +var multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; + +let nameA: string, numberB: number, nameB: string, skillB: string; +let robotAInfo: (number | string)[]; + +let multiSkillB: string[], nameMB: string, primarySkillB: string, secondarySkillB: string; +let multiRobotAInfo: (string | string[])[]; + +[, nameA = "helloNoName"] = robotA; +[, nameB = "helloNoName"] = getRobotB(); +[, nameB = "helloNoName"] = [2, "trimmer", "trimming"]; +[, multiSkillB = []] = multiRobotB; +[, multiSkillB = []] = getMultiRobotB(); +[, multiSkillB = []] = ["roomba", ["vaccum", "mopping"]]; + +[numberB = -1] = robotB; +[numberB = -1] = getRobotB(); +[numberB = -1] = [2, "trimmer", "trimming"]; +[nameMB = "helloNoName"] = multiRobotB; +[nameMB = "helloNoName"] = getMultiRobotB(); +[nameMB = "helloNoName"] = ["trimmer", ["trimming", "edging"]]; + +[numberB = -1, nameB = "helloNoName", skillB = "noSkill"] = robotB; +[numberB = -1, nameB = "helloNoName", skillB = "noSkill"] = getRobotB(); +[numberB = -1, nameB = "helloNoName", skillB = "noSkill"] = [2, "trimmer", "trimming"]; +[nameMB = "helloNoName", [primarySkillB = "noSkill", secondarySkillB = "noSkill"] = []] = multiRobotB; +[nameMB = "helloNoName", [primarySkillB = "noSkill", secondarySkillB = "noSkill"] = []] = getMultiRobotB(); +[nameMB = "helloNoName", [primarySkillB = "noSkill", secondarySkillB = "noSkill"] = []] = + ["trimmer", ["trimming", "edging"]]; + +[numberB = -1, ...robotAInfo] = robotB; +[numberB = -1, ...robotAInfo] = getRobotB(); +[numberB = -1, ...robotAInfo] = [2, "trimmer", "trimming"]; + +if (nameA == nameB) { + console.log(skillB); +} + +function getRobotB() { + return robotB; +} + +function getMultiRobotB() { + return multiRobotB; +} \ No newline at end of file diff --git a/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementDefaultValues.ts b/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementDefaultValues.ts new file mode 100644 index 00000000000..b95e7e5464a --- /dev/null +++ b/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementDefaultValues.ts @@ -0,0 +1,20 @@ +// @sourcemap: true +interface Robot { + name: string; + skill: string; +} +declare var console: { + log(msg: string): void; +} +var hello = "hello"; +var robotA: Robot = { name: "mower", skill: "mowing" }; +var robotB: Robot = { name: "trimmer", skill: "trimming" }; +var { name: nameA = "" } = robotA; +var { name: nameB = "", skill: skillB = "" } = robotB; +var { name: nameC = "", skill: skillC = "" } = { name: "Edger", skill: "cutting edges" }; +if (nameA == nameB) { + console.log(skillB); +} +else { + console.log(nameC); +} \ No newline at end of file diff --git a/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts b/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts new file mode 100644 index 00000000000..a40e5f11ebb --- /dev/null +++ b/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts @@ -0,0 +1,24 @@ +// @sourcemap: true +declare var console: { + log(msg: string): void; +} +interface Robot { + name: string; + skills: { + primary: string; + secondary: string; + }; +} +var robotA: Robot = { name: "mower", skills: { primary: "mowing", secondary: "none" } }; +var robotB: Robot = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }; + +var { skills: { primary: primaryA, secondary: secondaryA } } = robotA; +var { name: nameB, skills: { primary: primaryB, secondary: secondaryB } } = robotB; +var { name: nameC, skills: { primary: primaryB, secondary: secondaryB } } = { name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }; + +if (nameB == nameB) { + console.log(nameC); +} +else { + console.log(nameC); +} \ No newline at end of file diff --git a/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts b/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts new file mode 100644 index 00000000000..95eda6f2050 --- /dev/null +++ b/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts @@ -0,0 +1,41 @@ +// @sourcemap: true +declare var console: { + log(msg: string): void; +} +interface Robot { + name: string; + skills: { + primary?: string; + secondary?: string; + }; +} +var robotA: Robot = { name: "mower", skills: { primary: "mowing", secondary: "none" } }; +var robotB: Robot = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }; + +var { + skills: { + primary: primaryA = "noSkill", + secondary: secondaryA = "noSkill" + } = { primary: "noSkill", secondary: "noSkill" } +} = robotA; +var { + name: nameB = "noNameSpecified", + skills: { + primary: primaryB = "noSkill", + secondary: secondaryB = "noSkill" + } = { primary: "noSkill", secondary: "noSkill" } +} = robotB; +var { + name: nameC = "noNameSpecified", + skills: { + primary: primaryB = "noSkill", + secondary: secondaryB = "noSkill" + } = { primary: "noSkill", secondary: "noSkill" } +} = { name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }; + +if (nameB == nameB) { + console.log(nameC); +} +else { + console.log(nameC); +} \ No newline at end of file diff --git a/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementObjectBindingPattern1.ts b/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementObjectBindingPattern1.ts new file mode 100644 index 00000000000..80adb1cf0c1 --- /dev/null +++ b/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementObjectBindingPattern1.ts @@ -0,0 +1,3 @@ +// @sourcemap: true + +var {x} = { x: 20 }; \ No newline at end of file diff --git a/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.ts b/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.ts new file mode 100644 index 00000000000..93465864cd6 --- /dev/null +++ b/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.ts @@ -0,0 +1,4 @@ +// @sourcemap: true + +var {x} = { x: 20 }; +var { a, b } = { a: 30, b: 40 }; \ No newline at end of file diff --git a/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementObjectBindingPattern3.ts b/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementObjectBindingPattern3.ts new file mode 100644 index 00000000000..5af6b55272f --- /dev/null +++ b/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementObjectBindingPattern3.ts @@ -0,0 +1,3 @@ +// @sourcemap: true + +var {x = 500} = { x: 20 }; \ No newline at end of file diff --git a/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.ts b/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.ts new file mode 100644 index 00000000000..e0afcb60c27 --- /dev/null +++ b/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.ts @@ -0,0 +1,4 @@ +// @sourcemap: true + +var {x = 500, + y} = { x: 20, y: "hi" }; \ No newline at end of file diff --git a/tests/cases/compiler/staticAnonymousTypeNotReferencingTypeParameter.ts b/tests/cases/compiler/staticAnonymousTypeNotReferencingTypeParameter.ts new file mode 100644 index 00000000000..3923e1d707f --- /dev/null +++ b/tests/cases/compiler/staticAnonymousTypeNotReferencingTypeParameter.ts @@ -0,0 +1,141 @@ +// This test case is a condensed version of Angular 2's ListWrapper. Prior to #7448 +// this would cause the compiler to run out of memory. + +function outer(x: T) { + class Inner { + static y: T = x; + } + return Inner; +} +let y: number = outer(5).y; + +class ListWrapper2 { + static clone(dit: typeof ListWrapper2, array: T[]): T[] { return array.slice(0); } + static reversed(dit: typeof ListWrapper2, array: T[]): T[] { + var a = ListWrapper2.clone(dit, array); + return a; + } +} +namespace tessst { + /** + * 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. + */ + export function funkyFor(array: T[], callback: (element: T, index: number) => U): U { + if (array) { + for (let i = 0, len = array.length; i < len; i++) { + const result = callback(array[i], i); + if (result) { + return result; + } + } + } + return undefined; + } +} +interface Scanner { + scanRange(start: number, length: number, callback: () => T): T; +} +class ListWrapper { + // JS has no way to express a statically fixed size list, but dart does so we + // keep both methods. + static createFixedSize(dit: typeof ListWrapper, size: number): any[] { return new Array(size); } + static createGrowableSize(dit: typeof ListWrapper, size: number): any[] { return new Array(size); } + static clone(dit: typeof ListWrapper, array: T[]): T[] { return array.slice(0); } + static forEachWithIndex(dit: typeof ListWrapper, array: T[], fn: (t: T, n: number) => void) { + for (var i = 0; i < array.length; i++) { + fn(array[i], i); + } + } + static first(dit: typeof ListWrapper, array: T[]): T { + if (!array) return null; + return array[0]; + } + static last(dit: typeof ListWrapper, array: T[]): T { + if (!array || array.length == 0) return null; + return array[array.length - 1]; + } + static indexOf(dit: typeof ListWrapper, array: T[], value: T, startIndex: number = 0): number { + return array.indexOf(value, startIndex); + } + static contains(dit: typeof ListWrapper, list: T[], el: T): boolean { return list.indexOf(el) !== -1; } + static reversed(dit: typeof ListWrapper, array: T[]): T[] { + var a = ListWrapper.clone(dit, array); + let scanner: Scanner; + scanner.scanRange(3, 5, () => { }); + return tessst.funkyFor(array, t => t.toString()) ? a.reverse() : a; + } + static concat(dit: typeof ListWrapper, a: any[], b: any[]): any[] { return a.concat(b); } + static insert(dit: typeof ListWrapper, list: T[], index: number, value: T) { list.splice(index, 0, value); } + static removeAt(dit: typeof ListWrapper, list: T[], index: number): T { + var res = list[index]; + list.splice(index, 1); + return res; + } + static removeAll(dit: typeof ListWrapper, list: T[], items: T[]) { + for (var i = 0; i < items.length; ++i) { + var index = list.indexOf(items[i]); + list.splice(index, 1); + } + } + static remove(dit: typeof ListWrapper, list: T[], el: T): boolean { + var index = list.indexOf(el); + if (index > -1) { + list.splice(index, 1); + return true; + } + return false; + } + static clear(dit: typeof ListWrapper, list: any[]) { list.length = 0; } + static isEmpty(dit: typeof ListWrapper, list: any[]): boolean { return list.length == 0; } + static fill(dit: typeof ListWrapper, list: any[], value: any, start: number = 0, end: number = null) { + list.fill(value, start, end === null ? list.length : end); + } + static equals(dit: typeof ListWrapper, a: any[], b: any[]): boolean { + if (a.length != b.length) return false; + for (var i = 0; i < a.length; ++i) { + if (a[i] !== b[i]) return false; + } + return true; + } + static slice(dit: typeof ListWrapper, l: T[], from: number = 0, to: number = null): T[] { + return l.slice(from, to === null ? undefined : to); + } + static splice(dit: typeof ListWrapper, l: T[], from: number, length: number): T[] { return l.splice(from, length); } + static sort(dit: typeof ListWrapper, l: T[], compareFn?: (a: T, b: T) => number) { + if (isPresent(compareFn)) { + l.sort(compareFn); + } else { + l.sort(); + } + } + static toString(dit: typeof ListWrapper, l: T[]): string { return l.toString(); } + static toJSON(dit: typeof ListWrapper, l: T[]): string { return JSON.stringify(l); } + + static maximum(dit: typeof ListWrapper, list: T[], predicate: (t: T) => number): T { + if (list.length == 0) { + return null; + } + var solution: T = null; + var maxValue = -Infinity; + for (var index = 0; index < list.length; index++) { + var candidate = list[index]; + if (isBlank(candidate)) { + continue; + } + var candidateValue = predicate(candidate); + if (candidateValue > maxValue) { + solution = candidate; + maxValue = candidateValue; + } + } + return solution; + } +} +let cloned = ListWrapper.clone(ListWrapper, [1,2,3,4]); +declare function isBlank(x: any): boolean; +declare function isPresent(compareFn?: (a: T, b: T) => number): boolean; +interface Array { + fill(value: any, start: number, end: number): void; +} \ No newline at end of file diff --git a/tests/cases/compiler/systemModuleTargetES6.ts b/tests/cases/compiler/systemModuleTargetES6.ts new file mode 100644 index 00000000000..a41b0a62c86 --- /dev/null +++ b/tests/cases/compiler/systemModuleTargetES6.ts @@ -0,0 +1,15 @@ +// @target: ES6 +// @module: System +export class MyClass { } +export class MyClass2 { + static value = 42; + static getInstance() { return MyClass2.value; } +} + +export function myFunction() { + return new MyClass(); +} + +export function myFunction2() { + return new MyClass2(); +} \ No newline at end of file diff --git a/tests/cases/compiler/thisInSuperCall.ts b/tests/cases/compiler/thisInSuperCall.ts index 6a54e9ac6f1..b7df7cbafad 100644 --- a/tests/cases/compiler/thisInSuperCall.ts +++ b/tests/cases/compiler/thisInSuperCall.ts @@ -4,7 +4,7 @@ class Base { class Foo extends Base { constructor() { - super(this); // no error + super(this); // error: "super" has to be called before "this" accessing } } diff --git a/tests/cases/compiler/thisInSuperCall2.ts b/tests/cases/compiler/thisInSuperCall2.ts index 5de7c34cf32..2869ab9a805 100644 --- a/tests/cases/compiler/thisInSuperCall2.ts +++ b/tests/cases/compiler/thisInSuperCall2.ts @@ -5,7 +5,7 @@ class Base { class Foo extends Base { public x: number; constructor() { - super(this); // no error + super(this); // error: "super" has to be called before "this" accessing } } diff --git a/tests/cases/compiler/thisTypeAsConstraint.ts b/tests/cases/compiler/thisTypeAsConstraint.ts new file mode 100644 index 00000000000..fcab82bc7cc --- /dev/null +++ b/tests/cases/compiler/thisTypeAsConstraint.ts @@ -0,0 +1,4 @@ +class C { + public m() { + } +} \ No newline at end of file diff --git a/tests/cases/compiler/typeOfEnumAndVarRedeclarations.ts b/tests/cases/compiler/typeOfEnumAndVarRedeclarations.ts index 996560385d8..2033ef743a4 100644 --- a/tests/cases/compiler/typeOfEnumAndVarRedeclarations.ts +++ b/tests/cases/compiler/typeOfEnumAndVarRedeclarations.ts @@ -5,6 +5,6 @@ enum E { b = 1 } var x = E; -var x: { a: E; b: E;[x: number]: string; }; // Shouldnt error +var x: { readonly a: E; readonly b: E; readonly [x: number]: string; }; // Shouldnt error var y = E; -var y: { a: E; b: E;[x: number]: string;[x: number]: string } // two errors: the types are not identical and duplicate signatures \ No newline at end of file +var y: { readonly a: E; readonly b: E; readonly [x: number]: string; readonly [x: number]: string } // two errors: the types are not identical and duplicate signatures \ No newline at end of file diff --git a/tests/cases/compiler/typeReferenceDirectives1.ts b/tests/cases/compiler/typeReferenceDirectives1.ts new file mode 100644 index 00000000000..2127bd13f7b --- /dev/null +++ b/tests/cases/compiler/typeReferenceDirectives1.ts @@ -0,0 +1,14 @@ +// @noImplicitReferences: true +// @traceResolution: true +// @declaration: true +// @typesRoot: / + + +// @filename: /types/lib/index.d.ts +interface $ { x } + +// @filename: /app.ts +/// +interface A { + x: $ +} \ No newline at end of file diff --git a/tests/cases/compiler/typeReferenceDirectives10.ts b/tests/cases/compiler/typeReferenceDirectives10.ts new file mode 100644 index 00000000000..bf0768993c9 --- /dev/null +++ b/tests/cases/compiler/typeReferenceDirectives10.ts @@ -0,0 +1,17 @@ +// @noImplicitReferences: true +// @declaration: true +// @typesRoot: / +// @traceResolution: true + +// @filename: /ref.d.ts +export interface $ { x } + +// @filename: /types/lib/index.d.ts +declare let $: { x: number } + +// @filename: /app.ts +/// +import {$} from "./ref"; +export interface A { + x: $ +} diff --git a/tests/cases/compiler/typeReferenceDirectives11.ts b/tests/cases/compiler/typeReferenceDirectives11.ts new file mode 100644 index 00000000000..c955a5daffc --- /dev/null +++ b/tests/cases/compiler/typeReferenceDirectives11.ts @@ -0,0 +1,19 @@ +// @noImplicitReferences: true +// @declaration: true +// @typesRoot: / +// @traceResolution: true +// @types: lib +// @out: output.js + +// @filename: /types/lib/index.d.ts + +interface Lib { x } + +// @filename: /mod1.ts + +export function foo(): Lib { return {x: 1} } + +// @filename: /mod2.ts + +import {foo} from "./mod1"; +export const bar = foo(); \ No newline at end of file diff --git a/tests/cases/compiler/typeReferenceDirectives12.ts b/tests/cases/compiler/typeReferenceDirectives12.ts new file mode 100644 index 00000000000..ef3c8d9755f --- /dev/null +++ b/tests/cases/compiler/typeReferenceDirectives12.ts @@ -0,0 +1,37 @@ +// @noImplicitReferences: true +// @declaration: true +// @typesRoot: / +// @traceResolution: true +// @out: output.js + +// @filename: /types/lib/index.d.ts + +interface Lib { x } + +// @filename: /main.ts +export class Cls { + x +} + +// @filename: /mod1.ts +/// + +import {Cls} from "./main"; +Cls.prototype.foo = function() { return undefined; } + +declare module "./main" { + interface Cls { + foo(): Lib; + } + namespace Cls { + function bar(): Lib; + } +} + +// @filename: /mod2.ts +import { Cls } from "./main"; +import "./mod1"; + +export const cls = Cls; +export const foo = new Cls().foo(); +export const bar = Cls.bar(); \ No newline at end of file diff --git a/tests/cases/compiler/typeReferenceDirectives13.ts b/tests/cases/compiler/typeReferenceDirectives13.ts new file mode 100644 index 00000000000..816d419e9d5 --- /dev/null +++ b/tests/cases/compiler/typeReferenceDirectives13.ts @@ -0,0 +1,17 @@ +// @noImplicitReferences: true +// @declaration: true +// @typesRoot: / +// @traceResolution: true + +// @filename: /ref.d.ts +export interface $ { x } + +// @filename: /types/lib/index.d.ts +declare let $: { x: number } + +// @filename: /app.ts +/// +import {$} from "./ref"; +export interface A { + x: () => typeof $ +} diff --git a/tests/cases/compiler/typeReferenceDirectives2.ts b/tests/cases/compiler/typeReferenceDirectives2.ts new file mode 100644 index 00000000000..eb651728cea --- /dev/null +++ b/tests/cases/compiler/typeReferenceDirectives2.ts @@ -0,0 +1,13 @@ +// @noImplicitReferences: true +// @traceResolution: true +// @declaration: true +// @typesRoot: / +// @types: lib + +// @filename: /types/lib/index.d.ts +interface $ { x } + +// @filename: /app.ts +interface A { + x: $ +} \ No newline at end of file diff --git a/tests/cases/compiler/typeReferenceDirectives3.ts b/tests/cases/compiler/typeReferenceDirectives3.ts new file mode 100644 index 00000000000..bf81268d141 --- /dev/null +++ b/tests/cases/compiler/typeReferenceDirectives3.ts @@ -0,0 +1,19 @@ +// @noImplicitReferences: true +// @declaration: true +// @typesRoot: / +// @traceResolution: true + +// $ comes from d.ts file - no need to add type reference directive + +// @filename: /ref.d.ts +interface $ { x } + +// @filename: /types/lib/index.d.ts +declare let $: { x: number } + +// @filename: /app.ts +/// +/// +interface A { + x: () => $ +} \ No newline at end of file diff --git a/tests/cases/compiler/typeReferenceDirectives4.ts b/tests/cases/compiler/typeReferenceDirectives4.ts new file mode 100644 index 00000000000..48eb8a5324a --- /dev/null +++ b/tests/cases/compiler/typeReferenceDirectives4.ts @@ -0,0 +1,20 @@ +// @noImplicitReferences: true +// @traceResolution: true +// @declaration: true +// @typesRoot: / + +// $ comes from d.ts file - no need to add type reference directive + +// @filename: /ref.d.ts +interface $ { x } + +// @filename: /types/lib/index.d.ts +declare let $: { x: number } + + +// @filename: /app.ts +/// +/// + +let x: $; +let y = () => x \ No newline at end of file diff --git a/tests/cases/compiler/typeReferenceDirectives5.ts b/tests/cases/compiler/typeReferenceDirectives5.ts new file mode 100644 index 00000000000..675f932da68 --- /dev/null +++ b/tests/cases/compiler/typeReferenceDirectives5.ts @@ -0,0 +1,17 @@ +// @noImplicitReferences: true +// @traceResolution: true +// @declaration: true +// @typesRoot: / + +// @filename: /ref.d.ts +export interface $ { x } + +// @filename: /types/lib/index.d.ts +declare let $: { x: number } + +// @filename: /app.ts +/// +import {$} from "./ref"; +export interface A { + x: typeof $; +} \ No newline at end of file diff --git a/tests/cases/compiler/typeReferenceDirectives6.ts b/tests/cases/compiler/typeReferenceDirectives6.ts new file mode 100644 index 00000000000..120a743009c --- /dev/null +++ b/tests/cases/compiler/typeReferenceDirectives6.ts @@ -0,0 +1,21 @@ +// @noImplicitReferences: true +// @traceResolution: true +// @declaration: true +// @typesRoot: / + +// $ comes from type declaration file - type reference directive should be added + +// @filename: /ref.d.ts +declare let $: { x: number } + +// @filename: /types/lib/index.d.ts +interface $ { x } + + +// @filename: /app.ts +/// +/// + +let x: $; +let y = () => x + diff --git a/tests/cases/compiler/typeReferenceDirectives7.ts b/tests/cases/compiler/typeReferenceDirectives7.ts new file mode 100644 index 00000000000..f18fed37741 --- /dev/null +++ b/tests/cases/compiler/typeReferenceDirectives7.ts @@ -0,0 +1,18 @@ +// @noImplicitReferences: true +// @traceResolution: true +// @declaration: true +// @typesRoot: / + +// local value shadows global - no need to add type reference directive + +// @filename: /types/lib/index.d.ts +declare let $: { x: number } + + +// @filename: /app.ts +/// + +export let $ = 1; + +export let x: typeof $; +export let y = () => x \ No newline at end of file diff --git a/tests/cases/compiler/typeReferenceDirectives8.ts b/tests/cases/compiler/typeReferenceDirectives8.ts new file mode 100644 index 00000000000..2465d2afb10 --- /dev/null +++ b/tests/cases/compiler/typeReferenceDirectives8.ts @@ -0,0 +1,18 @@ +// @noImplicitReferences: true +// @declaration: true +// @typesRoot: / +// @traceResolution: true +// @types: lib + +// @filename: /types/lib/index.d.ts + +interface Lib { x } + +// @filename: /mod1.ts + +export function foo(): Lib { return {x: 1} } + +// @filename: /mod2.ts + +import {foo} from "./mod1"; +export const bar = foo(); \ No newline at end of file diff --git a/tests/cases/compiler/typeReferenceDirectives9.ts b/tests/cases/compiler/typeReferenceDirectives9.ts new file mode 100644 index 00000000000..eb8d6abaef1 --- /dev/null +++ b/tests/cases/compiler/typeReferenceDirectives9.ts @@ -0,0 +1,36 @@ +// @noImplicitReferences: true +// @declaration: true +// @typesRoot: / +// @traceResolution: true + +// @filename: /types/lib/index.d.ts + +interface Lib { x } + +// @filename: /main.ts +export class Cls { + x +} + +// @filename: /mod1.ts +/// + +import {Cls} from "./main"; +Cls.prototype.foo = function() { return undefined; } + +declare module "./main" { + interface Cls { + foo(): Lib; + } + namespace Cls { + function bar(): Lib; + } +} + +// @filename: /mod2.ts +import { Cls } from "./main"; +import "./mod1"; + +export const cls = Cls; +export const foo = new Cls().foo(); +export const bar = Cls.bar(); \ No newline at end of file diff --git a/tests/cases/compiler/typedArrays.ts b/tests/cases/compiler/typedArrays.ts index 4508632f6d6..602e15dc2d7 100644 --- a/tests/cases/compiler/typedArrays.ts +++ b/tests/cases/compiler/typedArrays.ts @@ -75,7 +75,6 @@ function CreateIntegerTypedArraysFromArrayLike(obj:ArrayLike) { return typedArrays; } -/* function CreateTypedArraysOf(obj) { var typedArrays = []; typedArrays[0] = Int8Array.of(...obj); @@ -90,7 +89,6 @@ function CreateTypedArraysOf(obj) { return typedArrays; } -*/ function CreateTypedArraysOf2() { var typedArrays = []; diff --git a/tests/cases/compiler/typedArraysCrossAssignability01.ts b/tests/cases/compiler/typedArraysCrossAssignability01.ts new file mode 100644 index 00000000000..27607b64161 --- /dev/null +++ b/tests/cases/compiler/typedArraysCrossAssignability01.ts @@ -0,0 +1,94 @@ +// @target: ES6 + +function CheckAssignability() { + let arr_Int8Array = new Int8Array(1); + let arr_Uint8Array = new Uint8Array(1); + let arr_Int16Array = new Int16Array(1); + let arr_Uint16Array = new Uint16Array(1); + let arr_Int32Array = new Int32Array(1); + let arr_Uint32Array = new Uint32Array(1); + let arr_Float32Array = new Float32Array(1); + let arr_Float64Array = new Float64Array(1); + let arr_Uint8ClampedArray = new Uint8ClampedArray(1); + + arr_Int8Array = arr_Int8Array; + arr_Int8Array = arr_Uint8Array; + arr_Int8Array = arr_Int16Array; + arr_Int8Array = arr_Uint16Array; + arr_Int8Array = arr_Int32Array; + arr_Int8Array = arr_Uint32Array; + arr_Int8Array = arr_Float32Array; + arr_Int8Array = arr_Float64Array; + arr_Int8Array = arr_Uint8ClampedArray; + + arr_Uint8Array = arr_Int8Array; + arr_Uint8Array = arr_Uint8Array; + arr_Uint8Array = arr_Int16Array; + arr_Uint8Array = arr_Uint16Array; + arr_Uint8Array = arr_Int32Array; + arr_Uint8Array = arr_Uint32Array; + arr_Uint8Array = arr_Float32Array; + arr_Uint8Array = arr_Float64Array; + arr_Uint8Array = arr_Uint8ClampedArray; + + arr_Int16Array = arr_Int8Array; + arr_Int16Array = arr_Uint8Array; + arr_Int16Array = arr_Int16Array; + arr_Int16Array = arr_Uint16Array; + arr_Int16Array = arr_Int32Array; + arr_Int16Array = arr_Uint32Array; + arr_Int16Array = arr_Float32Array; + arr_Int16Array = arr_Float64Array; + arr_Int16Array = arr_Uint8ClampedArray; + + arr_Uint16Array = arr_Int8Array; + arr_Uint16Array = arr_Uint8Array; + arr_Uint16Array = arr_Int16Array; + arr_Uint16Array = arr_Uint16Array; + arr_Uint16Array = arr_Int32Array; + arr_Uint16Array = arr_Uint32Array; + arr_Uint16Array = arr_Float32Array; + arr_Uint16Array = arr_Float64Array; + arr_Uint16Array = arr_Uint8ClampedArray; + + arr_Int32Array = arr_Int8Array; + arr_Int32Array = arr_Uint8Array; + arr_Int32Array = arr_Int16Array; + arr_Int32Array = arr_Uint16Array; + arr_Int32Array = arr_Int32Array; + arr_Int32Array = arr_Uint32Array; + arr_Int32Array = arr_Float32Array; + arr_Int32Array = arr_Float64Array; + arr_Int32Array = arr_Uint8ClampedArray; + + arr_Float32Array = arr_Int8Array; + arr_Float32Array = arr_Uint8Array; + arr_Float32Array = arr_Int16Array; + arr_Float32Array = arr_Uint16Array; + arr_Float32Array = arr_Int32Array; + arr_Float32Array = arr_Uint32Array; + arr_Float32Array = arr_Float32Array; + arr_Float32Array = arr_Float64Array; + arr_Float32Array = arr_Uint8ClampedArray; + + arr_Float64Array = arr_Int8Array; + arr_Float64Array = arr_Uint8Array; + arr_Float64Array = arr_Int16Array; + arr_Float64Array = arr_Uint16Array; + arr_Float64Array = arr_Int32Array; + arr_Float64Array = arr_Uint32Array; + arr_Float64Array = arr_Float32Array; + arr_Float64Array = arr_Float64Array; + arr_Float64Array = arr_Uint8ClampedArray; + + arr_Uint8ClampedArray = arr_Int8Array; + arr_Uint8ClampedArray = arr_Uint8Array; + arr_Uint8ClampedArray = arr_Int16Array; + arr_Uint8ClampedArray = arr_Uint16Array; + arr_Uint8ClampedArray = arr_Int32Array; + arr_Uint8ClampedArray = arr_Uint32Array; + arr_Uint8ClampedArray = arr_Float32Array; + arr_Uint8ClampedArray = arr_Float64Array; + arr_Uint8ClampedArray = arr_Uint8ClampedArray; + +} diff --git a/tests/cases/compiler/useStrictLikePrologueString01.ts b/tests/cases/compiler/useStrictLikePrologueString01.ts new file mode 100644 index 00000000000..b76e38ebb06 --- /dev/null +++ b/tests/cases/compiler/useStrictLikePrologueString01.ts @@ -0,0 +1,7 @@ +//@target: commonjs +//@target: es5 + +"hey!" +" use strict " +export function f() { +} \ No newline at end of file diff --git a/tests/cases/conformance/async/es6/asyncArrowFunction/arrowFunctionWithParameterNameAsync.ts b/tests/cases/conformance/async/es6/asyncArrowFunction/arrowFunctionWithParameterNameAsync.ts new file mode 100644 index 00000000000..1ade02c09d2 --- /dev/null +++ b/tests/cases/conformance/async/es6/asyncArrowFunction/arrowFunctionWithParameterNameAsync.ts @@ -0,0 +1,4 @@ +// @target: ES5 +// @noEmitHelpers: true + +const x = async => async; \ No newline at end of file diff --git a/tests/cases/conformance/async/es6/asyncArrowFunction/asyncUnParenthesizedArrowFunction_es6.ts b/tests/cases/conformance/async/es6/asyncArrowFunction/asyncUnParenthesizedArrowFunction_es6.ts new file mode 100644 index 00000000000..6a5086f70d0 --- /dev/null +++ b/tests/cases/conformance/async/es6/asyncArrowFunction/asyncUnParenthesizedArrowFunction_es6.ts @@ -0,0 +1,6 @@ +// @target: ES6 +// @noEmitHelpers: true + +declare function someOtherFunction(i: any): Promise; +const x = async i => await someOtherFunction(i) +const x1 = async (i) => await someOtherFunction(i); \ No newline at end of file diff --git a/tests/cases/conformance/async/es6/asyncMethodWithSuper_es6.ts b/tests/cases/conformance/async/es6/asyncMethodWithSuper_es6.ts new file mode 100644 index 00000000000..795fe7defb0 --- /dev/null +++ b/tests/cases/conformance/async/es6/asyncMethodWithSuper_es6.ts @@ -0,0 +1,52 @@ +// @target: ES6 +// @noEmitHelpers: true +class A { + x() { + } +} + +class B extends A { + // async method with only call/get on 'super' does not require a binding + async simple() { + // call with property access + super.x(); + + // call with element access + super["x"](); + + // property access (read) + const a = super.x; + + // element access (read) + const b = super["x"]; + } + + // async method with assignment/destructuring on 'super' requires a binding + async advanced() { + const f = () => {}; + + // call with property access + super.x(); + + // call with element access + super["x"](); + + // property access (read) + const a = super.x; + + // element access (read) + const b = super["x"]; + + // property access (assign) + super.x = f; + + // element access (assign) + super["x"] = f; + + // destructuring assign with property access + ({ f: super.x } = { f }); + + // destructuring assign with element access + ({ f: super["x"] } = { f }); + } +} \ No newline at end of file diff --git a/tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility.ts b/tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility.ts index c2e4855e63a..1c9a801429d 100644 --- a/tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility.ts +++ b/tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility.ts @@ -1,18 +1,20 @@ +// @declaration: true + class C { public constructor(public x: number) { } } class D { - private constructor(public x: number) { } // error + private constructor(public x: number) { } } class E { - protected constructor(public x: number) { } // error + protected constructor(public x: number) { } } var c = new C(1); -var d = new D(1); -var e = new E(1); +var d = new D(1); // error +var e = new E(1); // error module Generic { class C { @@ -20,14 +22,14 @@ module Generic { } class D { - private constructor(public x: T) { } // error + private constructor(public x: T) { } } class E { - protected constructor(public x: T) { } // error + protected constructor(public x: T) { } } var c = new C(1); - var d = new D(1); - var e = new E(1); + var d = new D(1); // error + var e = new E(1); // error } diff --git a/tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility2.ts b/tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility2.ts new file mode 100644 index 00000000000..2a961e2c067 --- /dev/null +++ b/tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility2.ts @@ -0,0 +1,42 @@ +// @declaration: true + +class BaseA { + public constructor(public x: number) { } + createInstance() { new BaseA(1); } +} + +class BaseB { + protected constructor(public x: number) { } + createInstance() { new BaseB(1); } +} + +class BaseC { + private constructor(public x: number) { } + createInstance() { new BaseC(1); } +} + +class DerivedA extends BaseA { + constructor(public x: number) { super(x); } + createInstance() { new DerivedA(1); } + createBaseInstance() { new BaseA(1); } +} + +class DerivedB extends BaseB { + constructor(public x: number) { super(x); } + createInstance() { new DerivedB(1); } + createBaseInstance() { new BaseB(1); } // error +} + +class DerivedC extends BaseC { // error + constructor(public x: number) { super(x); } + createInstance() { new DerivedC(1); } + createBaseInstance() { new BaseC(1); } // error +} + +var ba = new BaseA(1); +var bb = new BaseB(1); // error +var bc = new BaseC(1); // error + +var da = new DerivedA(1); +var db = new DerivedB(1); +var dc = new DerivedC(1); \ No newline at end of file diff --git a/tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility3.ts b/tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility3.ts new file mode 100644 index 00000000000..91bb4873d96 --- /dev/null +++ b/tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility3.ts @@ -0,0 +1,35 @@ +// @declaration: true + +class Foo { + constructor(public x: number) { } +} + +class Bar { + public constructor(public x: number) { } +} + +class Baz { + protected constructor(public x: number) { } +} + +class Qux { + private constructor(public x: number) { } +} + +// b is public +let a = Foo; +a = Bar; +a = Baz; // error Baz is protected +a = Qux; // error Qux is private + +// b is protected +let b = Baz; +b = Foo; +b = Bar; +b = Qux; // error Qux is private + +// c is private +let c = Qux; +c = Foo; +c = Bar; +c = Baz; \ No newline at end of file diff --git a/tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility4.ts b/tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility4.ts new file mode 100644 index 00000000000..3760f2176ae --- /dev/null +++ b/tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility4.ts @@ -0,0 +1,31 @@ +// @declaration: true + +class A { + private constructor() { } + + method() { + class B { + method() { + new A(); // OK + } + } + + class C extends A { // OK + } + } +} + +class D { + protected constructor() { } + + method() { + class E { + method() { + new D(); // OK + } + } + + class F extends D { // OK + } + } +} \ No newline at end of file diff --git a/tests/cases/conformance/classes/constructorDeclarations/classConstructorOverloadsAccessibility.ts b/tests/cases/conformance/classes/constructorDeclarations/classConstructorOverloadsAccessibility.ts new file mode 100644 index 00000000000..5ed20d03853 --- /dev/null +++ b/tests/cases/conformance/classes/constructorDeclarations/classConstructorOverloadsAccessibility.ts @@ -0,0 +1,34 @@ +// @declaration: true + +class A { + public constructor(a: boolean) // error + protected constructor(a: number) // error + private constructor(a: string) + private constructor() { + + } +} + +class B { + protected constructor(a: number) // error + constructor(a: string) + constructor() { + + } +} + +class C { + protected constructor(a: number) + protected constructor(a: string) + protected constructor() { + + } +} + +class D { + constructor(a: number) + constructor(a: string) + public constructor() { + + } +} \ No newline at end of file diff --git a/tests/cases/conformance/classes/constructorDeclarations/constructorParameters/declarationEmit_readonly.ts b/tests/cases/conformance/classes/constructorDeclarations/constructorParameters/declarationEmit_readonly.ts new file mode 100644 index 00000000000..76b41eabba4 --- /dev/null +++ b/tests/cases/conformance/classes/constructorDeclarations/constructorParameters/declarationEmit_readonly.ts @@ -0,0 +1,5 @@ +// @declaration: true + +class C { + constructor(readonly x: number) {} +} \ No newline at end of file diff --git a/tests/cases/conformance/classes/constructorDeclarations/constructorParameters/readonlyInAmbientClass.ts b/tests/cases/conformance/classes/constructorDeclarations/constructorParameters/readonlyInAmbientClass.ts new file mode 100644 index 00000000000..c84594eb4f0 --- /dev/null +++ b/tests/cases/conformance/classes/constructorDeclarations/constructorParameters/readonlyInAmbientClass.ts @@ -0,0 +1,4 @@ +declare class C{ + constructor(readonly x: number); + method(readonly x: number); +} \ No newline at end of file diff --git a/tests/cases/conformance/classes/constructorDeclarations/constructorParameters/readonlyInConstructorParameters.ts b/tests/cases/conformance/classes/constructorDeclarations/constructorParameters/readonlyInConstructorParameters.ts new file mode 100644 index 00000000000..dbcdff7a2d9 --- /dev/null +++ b/tests/cases/conformance/classes/constructorDeclarations/constructorParameters/readonlyInConstructorParameters.ts @@ -0,0 +1,13 @@ +class C { + constructor(readonly x: number) {} +} +new C(1).x = 2; + +class E { + constructor(readonly public x: number) {} +} + +class F { + constructor(private readonly x: number) {} +} +new F(1).x; \ No newline at end of file diff --git a/tests/cases/conformance/classes/constructorDeclarations/constructorParameters/readonlyReadonly.ts b/tests/cases/conformance/classes/constructorDeclarations/constructorParameters/readonlyReadonly.ts new file mode 100644 index 00000000000..8fb611a0181 --- /dev/null +++ b/tests/cases/conformance/classes/constructorDeclarations/constructorParameters/readonlyReadonly.ts @@ -0,0 +1,4 @@ +class C { + readonly readonly x: number; + constructor(readonly readonly y: number) {} +} \ No newline at end of file diff --git a/tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassParameterProperties.ts b/tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassParameterProperties.ts index edfd7ab4f8c..a054ed0f683 100644 --- a/tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassParameterProperties.ts +++ b/tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassParameterProperties.ts @@ -46,7 +46,7 @@ class Derived6 extends Base { constructor(y: string) { this.a = 1; var b = 2; - super(); // ok + super(); // error: "super" has to be called before "this" accessing } } diff --git a/tests/cases/conformance/classes/members/accessibility/privateClassPropertyAccessibleWithinNestedClass.ts b/tests/cases/conformance/classes/members/accessibility/privateClassPropertyAccessibleWithinNestedClass.ts new file mode 100644 index 00000000000..a958a5ae624 --- /dev/null +++ b/tests/cases/conformance/classes/members/accessibility/privateClassPropertyAccessibleWithinNestedClass.ts @@ -0,0 +1,38 @@ +// @target: ES5 +// no errors + +class C { + private x: string; + private get y() { return this.x; } + private set y(x) { this.y = this.x; } + private foo() { return this.foo; } + + private static x: string; + private static get y() { return this.x; } + private static set y(x) { this.y = this.x; } + private static foo() { return this.foo; } + private static bar() { this.foo(); } + + private bar() { + class C2 { + private foo() { + let x: C; + var x1 = x.foo; + var x2 = x.bar; + var x3 = x.x; + var x4 = x.y; + + var sx1 = C.x; + var sx2 = C.y; + var sx3 = C.bar; + var sx4 = C.foo; + + let y = new C(); + var y1 = y.foo; + var y2 = y.bar; + var y3 = y.x; + var y4 = y.y; + } + } + } +} \ No newline at end of file diff --git a/tests/cases/conformance/classes/members/accessibility/privateProtectedMembersAreNotAccessibleDestructuring.ts b/tests/cases/conformance/classes/members/accessibility/privateProtectedMembersAreNotAccessibleDestructuring.ts new file mode 100644 index 00000000000..4473756d98d --- /dev/null +++ b/tests/cases/conformance/classes/members/accessibility/privateProtectedMembersAreNotAccessibleDestructuring.ts @@ -0,0 +1,20 @@ +class K { + private priv; + protected prot; + private privateMethod() { } + m() { + let { priv: a, prot: b } = this; // ok + let { priv, prot } = new K(); // ok + } +} +class C extends K { + m2() { + let { priv: a } = this; // error + let { prot: b } = this; // ok + } +} +let k = new K(); +let { priv } = k; // error +let { prot } = k; // error +let { privateMethod } = k; // error +let { priv: a, prot: b, privateMethod: f } = k; // error diff --git a/tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinNestedClass.ts b/tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinNestedClass.ts new file mode 100644 index 00000000000..3482d1a09e9 --- /dev/null +++ b/tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinNestedClass.ts @@ -0,0 +1,38 @@ +// @target: ES5 +// no errors + +class C { + protected x: string; + protected get y() { return this.x; } + protected set y(x) { this.y = this.x; } + protected foo() { return this.foo; } + + protected static x: string; + protected static get y() { return this.x; } + protected static set y(x) { this.y = this.x; } + protected static foo() { return this.foo; } + protected static bar() { this.foo(); } + + protected bar() { + class C2 { + protected foo() { + let x: C; + var x1 = x.foo; + var x2 = x.bar; + var x3 = x.x; + var x4 = x.y; + + var sx1 = C.x; + var sx2 = C.y; + var sx3 = C.bar; + var sx4 = C.foo; + + let y = new C(); + var y1 = y.foo; + var y2 = y.bar; + var y3 = y.x; + var y4 = y.y; + } + } + } +} \ No newline at end of file diff --git a/tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinNestedSubclass.ts b/tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinNestedSubclass.ts new file mode 100644 index 00000000000..aae17b8362f --- /dev/null +++ b/tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinNestedSubclass.ts @@ -0,0 +1,39 @@ +// @target: ES5 + +class B { + protected x: string; + protected static x: string; +} + +class C extends B { + protected get y() { return this.x; } + protected set y(x) { this.y = this.x; } + protected foo() { return this.x; } + + protected static get y() { return this.x; } + protected static set y(x) { this.y = this.x; } + protected static foo() { return this.x; } + protected static bar() { this.foo(); } + + protected bar() { + class D { + protected foo() { + var c = new C(); + var c1 = c.y; + var c2 = c.x; + var c3 = c.foo; + var c4 = c.bar; + var c5 = c.z; // error + + var sc1 = C.x; + var sc2 = C.y; + var sc3 = C.foo; + var sc4 = C.bar; + } + } + } +} + +class E extends C { + protected z: string; +} \ No newline at end of file diff --git a/tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinNestedSubclass1.ts b/tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinNestedSubclass1.ts new file mode 100644 index 00000000000..1128da70795 --- /dev/null +++ b/tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinNestedSubclass1.ts @@ -0,0 +1,114 @@ +class Base { + protected x: string; + method() { + class A { + methoda() { + var b: Base; + var d1: Derived1; + var d2: Derived2; + var d3: Derived3; + var d4: Derived4; + + b.x; // OK, accessed within their declaring class + d1.x; // OK, accessed within their declaring class + d2.x; // OK, accessed within their declaring class + d3.x; // Error, redefined in a subclass, can only be accessed in the declaring class or one of its subclasses + d4.x; // OK, accessed within their declaring class + } + } + } +} + +class Derived1 extends Base { + method1() { + class B { + method1b() { + var b: Base; + var d1: Derived1; + var d2: Derived2; + var d3: Derived3; + var d4: Derived4; + + b.x; // Error, isn't accessed through an instance of the enclosing class + d1.x; // OK, accessed within a class derived from their declaring class, and through an instance of the enclosing class + d2.x; // Error, isn't accessed through an instance of the enclosing class + d3.x; // Error, redefined in a subclass, can only be accessed in the declaring class or one of its subclasses + d4.x; // Error, isn't accessed through an instance of the enclosing class + } + } + } +} + +class Derived2 extends Base { + method2() { + class C { + method2c() { + var b: Base; + var d1: Derived1; + var d2: Derived2; + var d3: Derived3; + var d4: Derived4; + + b.x; // Error, isn't accessed through an instance of the enclosing class + d1.x; // Error, isn't accessed through an instance of the enclosing class + d2.x; // OK, accessed within a class derived from their declaring class, and through an instance of the enclosing class + d3.x; // Error, redefined in a subclass, can only be accessed in the declaring class or one of its subclasses + d4.x; // OK, accessed within a class derived from their declaring class, and through an instance of the enclosing class or one of its subclasses + } + } + } +} + +class Derived3 extends Derived1 { + protected x: string; + method3() { + class D { + method3d() { + var b: Base; + var d1: Derived1; + var d2: Derived2; + var d3: Derived3; + var d4: Derived4; + + b.x; // Error, isn't accessed through an instance of the enclosing class + d1.x; // Error, isn't accessed through an instance of the enclosing class + d2.x; // Error, isn't accessed through an instance of the enclosing class + d3.x; // OK, accessed within their declaring class + d4.x; // Error, isn't accessed through an instance of the enclosing class + } + } + } +} + +class Derived4 extends Derived2 { + method4() { + class E { + method4e() { + var b: Base; + var d1: Derived1; + var d2: Derived2; + var d3: Derived3; + var d4: Derived4; + + b.x; // Error, isn't accessed through an instance of the enclosing class + d1.x; // Error, isn't accessed through an instance of the enclosing class + d2.x; // Error, isn't accessed through an instance of the enclosing class + d3.x; // Error, redefined in a subclass, can only be accessed in the declaring class or one of its subclasses + d4.x; // OK, accessed within a class derived from their declaring class, and through an instance of the enclosing class + } + } + } +} + + +var b: Base; +var d1: Derived1; +var d2: Derived2; +var d3: Derived3; +var d4: Derived4; + +b.x; // Error, neither within their declaring class nor classes derived from their declaring class +d1.x; // Error, neither within their declaring class nor classes derived from their declaring class +d2.x; // Error, neither within their declaring class nor classes derived from their declaring class +d3.x; // Error, neither within their declaring class nor classes derived from their declaring class +d4.x; // Error, neither within their declaring class nor classes derived from their declaring class \ No newline at end of file diff --git a/tests/cases/conformance/controlFlow/controlFlowAssignmentExpression.ts b/tests/cases/conformance/controlFlow/controlFlowAssignmentExpression.ts new file mode 100644 index 00000000000..83bf75ab94d --- /dev/null +++ b/tests/cases/conformance/controlFlow/controlFlowAssignmentExpression.ts @@ -0,0 +1,10 @@ +let x: string | boolean | number; +let obj: any; + +x = ""; +x = x.length; +x; // number + +x = true; +(x = "", obj).foo = (x = x.length); +x; // number diff --git a/tests/cases/conformance/controlFlow/controlFlowBinaryAndExpression.ts b/tests/cases/conformance/controlFlow/controlFlowBinaryAndExpression.ts new file mode 100644 index 00000000000..caaef9b890f --- /dev/null +++ b/tests/cases/conformance/controlFlow/controlFlowBinaryAndExpression.ts @@ -0,0 +1,9 @@ +let x: string | number | boolean; +let cond: boolean; + +(x = "") && (x = 0); +x; // string | number + +x = ""; +cond && (x = 0); +x; // string | number diff --git a/tests/cases/conformance/controlFlow/controlFlowBinaryOrExpression.ts b/tests/cases/conformance/controlFlow/controlFlowBinaryOrExpression.ts new file mode 100644 index 00000000000..9dab32e0cb8 --- /dev/null +++ b/tests/cases/conformance/controlFlow/controlFlowBinaryOrExpression.ts @@ -0,0 +1,35 @@ +let x: string | number | boolean; +let cond: boolean; + +(x = "") || (x = 0); +x; // string | number + +x = ""; +cond || (x = 0); +x; // string | number + +export interface NodeList { + length: number; +} + +export interface HTMLCollection { + length: number; +} + +declare function isNodeList(sourceObj: any): sourceObj is NodeList; +declare function isHTMLCollection(sourceObj: any): sourceObj is HTMLCollection; + +type EventTargetLike = {a: string} | HTMLCollection | NodeList; + +var sourceObj: EventTargetLike = undefined; +if (isNodeList(sourceObj)) { + sourceObj.length; +} + +if (isHTMLCollection(sourceObj)) { + sourceObj.length; +} + +if (isNodeList(sourceObj) || isHTMLCollection(sourceObj)) { + sourceObj.length; +} diff --git a/tests/cases/conformance/controlFlow/controlFlowCommaOperator.ts b/tests/cases/conformance/controlFlow/controlFlowCommaOperator.ts new file mode 100644 index 00000000000..d6d49e48f34 --- /dev/null +++ b/tests/cases/conformance/controlFlow/controlFlowCommaOperator.ts @@ -0,0 +1,22 @@ +function f(x: string | number | boolean) { + let y: string | number | boolean = false; + let z: string | number | boolean = false; + if (y = "", typeof x === "string") { + x; // string + y; // string + z; // boolean + } + else if (z = 1, typeof x === "number") { + x; // number + y; // string + z; // number + } + else { + x; // boolean + y; // string + z; // number + } + x; // string | number | boolean + y; // string + z; // number | boolean +} diff --git a/tests/cases/conformance/controlFlow/controlFlowConditionalExpression.ts b/tests/cases/conformance/controlFlow/controlFlowConditionalExpression.ts new file mode 100644 index 00000000000..c1c1d9956ea --- /dev/null +++ b/tests/cases/conformance/controlFlow/controlFlowConditionalExpression.ts @@ -0,0 +1,5 @@ +let x: string | number | boolean; +let cond: boolean; + +cond ? x = "" : x = 3; +x; // string | number diff --git a/tests/cases/conformance/controlFlow/controlFlowDeleteOperator.ts b/tests/cases/conformance/controlFlow/controlFlowDeleteOperator.ts new file mode 100644 index 00000000000..0f4b209bd45 --- /dev/null +++ b/tests/cases/conformance/controlFlow/controlFlowDeleteOperator.ts @@ -0,0 +1,18 @@ +// @strictNullChecks: true + +function f() { + let x: { a?: number | string, b: number | string } = { b: 1 }; + x.a; + x.b; + x.a = 1; + x.b = 1; + x.a; + x.b; + delete x.a; + delete x.b; + x.a; + x.b; + x; + delete x; // No effect + x; +} \ No newline at end of file diff --git a/tests/cases/conformance/controlFlow/controlFlowDestructuringDeclaration.ts b/tests/cases/conformance/controlFlow/controlFlowDestructuringDeclaration.ts new file mode 100644 index 00000000000..fc9c3ffb4d7 --- /dev/null +++ b/tests/cases/conformance/controlFlow/controlFlowDestructuringDeclaration.ts @@ -0,0 +1,59 @@ +// @strictNullChecks: true + +function f1() { + let x: string | number = 1; + x; + let y: string | undefined = ""; + y; +} + +function f2() { + let [x]: [string | number] = [1]; + x; + let [y]: [string | undefined] = [""]; + y; + let [z = ""]: [string | undefined] = [undefined]; + z; +} + +function f3() { + let [x]: (string | number)[] = [1]; + x; + let [y]: (string | undefined)[] = [""]; + y; + let [z = ""]: (string | undefined)[] = [undefined]; + z; +} + +function f4() { + let { x }: { x: string | number } = { x: 1 }; + x; + let { y }: { y: string | undefined } = { y: "" }; + y; + let { z = "" }: { z: string | undefined } = { z: undefined }; + z; +} + +function f5() { + let { x }: { x?: string | number } = { x: 1 }; + x; + let { y }: { y?: string | undefined } = { y: "" }; + y; + let { z = "" }: { z?: string | undefined } = { z: undefined }; + z; +} + +function f6() { + let { x }: { x?: string | number } = {}; + x; + let { y }: { y?: string | undefined } = {}; + y; + let { z = "" }: { z?: string | undefined } = {}; + z; +} + +function f7() { + let o: { [x: string]: number } = { x: 1 }; + let { x }: { [x: string]: string | number } = o; + x; +} diff --git a/tests/cases/conformance/controlFlow/controlFlowDoWhileStatement.ts b/tests/cases/conformance/controlFlow/controlFlowDoWhileStatement.ts new file mode 100644 index 00000000000..bd253bc064d --- /dev/null +++ b/tests/cases/conformance/controlFlow/controlFlowDoWhileStatement.ts @@ -0,0 +1,76 @@ +let cond: boolean; +function a() { + let x: string | number; + x = ""; + do { + x; // string + } while (cond) +} +function b() { + let x: string | number; + x = ""; + do { + x; // string + x = 42; + break; + } while (cond) +} +function c() { + let x: string | number; + x = ""; + do { + x; // string + x = undefined; + if (typeof x === "string") continue; + break; + } while (cond) +} +function d() { + let x: string | number; + x = 1000; + do { + x; // number + x = ""; + } while (x = x.length) + x; // number +} +function e() { + let x: string | number; + x = ""; + do { + x = 42; + } while (cond) + x; // number +} +function f() { + let x: string | number | boolean | RegExp | Function; + x = ""; + do { + if (cond) { + x = 42; + break; + } + if (cond) { + x = true; + continue; + } + x = /a/; + } while (cond) + x; // number | boolean | RegExp +} +function g() { + let x: string | number | boolean | RegExp | Function; + x = ""; + do { + if (cond) { + x = 42; + break; + } + if (cond) { + x = true; + continue; + } + x = /a/; + } while (true) + x; // number +} diff --git a/tests/cases/conformance/controlFlow/controlFlowForInStatement.ts b/tests/cases/conformance/controlFlow/controlFlowForInStatement.ts new file mode 100644 index 00000000000..a22e79506c2 --- /dev/null +++ b/tests/cases/conformance/controlFlow/controlFlowForInStatement.ts @@ -0,0 +1,17 @@ +let x: string | number | boolean | RegExp | Function; +let obj: any; +let cond: boolean; + +x = /a/; +for (let y in obj) { + x = y; + if (cond) { + x = 42; + continue; + } + if (cond) { + x = true; + break; + } +} +x; // RegExp | string | number | boolean diff --git a/tests/cases/conformance/controlFlow/controlFlowForOfStatement.ts b/tests/cases/conformance/controlFlow/controlFlowForOfStatement.ts new file mode 100644 index 00000000000..3abcf814f2a --- /dev/null +++ b/tests/cases/conformance/controlFlow/controlFlowForOfStatement.ts @@ -0,0 +1,10 @@ +let obj: number[]; +let x: string | number | boolean | RegExp; + +function a() { + x = true; + for (x of obj) { + x = x.toExponential(); + } + x; // string | boolean +} diff --git a/tests/cases/conformance/controlFlow/controlFlowForStatement.ts b/tests/cases/conformance/controlFlow/controlFlowForStatement.ts new file mode 100644 index 00000000000..d9e46781aa7 --- /dev/null +++ b/tests/cases/conformance/controlFlow/controlFlowForStatement.ts @@ -0,0 +1,41 @@ +let cond: boolean; +function a() { + let x: string | number | boolean; + for (x = ""; cond; x = 5) { + x; // string | number + } +} +function b() { + let x: string | number | boolean; + for (x = 5; cond; x = x.length) { + x; // number + x = ""; + } +} +function c() { + let x: string | number | boolean; + for (x = 5; x = x.toExponential(); x = 5) { + x; // string + } +} +function d() { + let x: string | number | boolean; + for (x = ""; typeof x === "string"; x = 5) { + x; // string + } +} +function e() { + let x: string | number | boolean | RegExp; + for (x = "" || 0; typeof x !== "string"; x = "" || true) { + x; // number | boolean + } +} +function f() { + let x: string | number | boolean; + for (; typeof x !== "string";) { + x; // number | boolean + if (typeof x === "number") break; + x = undefined; + } + x; // string | number +} diff --git a/tests/cases/conformance/controlFlow/controlFlowIfStatement.ts b/tests/cases/conformance/controlFlow/controlFlowIfStatement.ts new file mode 100644 index 00000000000..c9e9be92f8e --- /dev/null +++ b/tests/cases/conformance/controlFlow/controlFlowIfStatement.ts @@ -0,0 +1,36 @@ +let x: string | number | boolean | RegExp; +let cond: boolean; + +x = /a/; +if (x /* RegExp */, (x = true)) { + x; // boolean + x = ""; +} +else { + x; // boolean + x = 42; +} +x; // string | number + +function a() { + let x: string | number; + if (cond) { + x = 42; + } + else { + x = ""; + return; + } + x; // number +} +function b() { + let x: string | number; + if (cond) { + x = 42; + throw ""; + } + else { + x = ""; + } + x; // string +} diff --git a/tests/cases/conformance/controlFlow/controlFlowIteration.ts b/tests/cases/conformance/controlFlow/controlFlowIteration.ts new file mode 100644 index 00000000000..56172b1bbdf --- /dev/null +++ b/tests/cases/conformance/controlFlow/controlFlowIteration.ts @@ -0,0 +1,20 @@ +// @strictNullChecks: true + +let cond: boolean; + +function ff() { + let x: string | undefined; + while (true) { + if (cond) { + x = ""; + } + else { + if (x) { + x.length; + } + if (x) { + x.length; + } + } + } +} diff --git a/tests/cases/conformance/controlFlow/controlFlowIterationErrors.ts b/tests/cases/conformance/controlFlow/controlFlowIterationErrors.ts new file mode 100644 index 00000000000..2e54b335537 --- /dev/null +++ b/tests/cases/conformance/controlFlow/controlFlowIterationErrors.ts @@ -0,0 +1,93 @@ +// @noImplicitAny: true + +let cond: boolean; + +function len(s: string) { + return s.length; +} + +function f1() { + let x: string | number | boolean; + x = ""; + while (cond) { + x = len(x); + x; + } + x; +} + +function f2() { + let x: string | number | boolean; + x = ""; + while (cond) { + x; + x = len(x); + } + x; +} + +declare function foo(x: string): number; +declare function foo(x: number): string; + +function g1() { + let x: string | number | boolean; + x = ""; + while (cond) { + x = foo(x); + x; + } + x; +} + +function g2() { + let x: string | number | boolean; + x = ""; + while (cond) { + x; + x = foo(x); + } + x; +} + +function asNumber(x: string | number): number { + return +x; +} + +function h1() { + let x: string | number | boolean; + x = "0"; + while (cond) { + x = +x + 1; + x; + } +} + +function h2() { + let x: string | number | boolean; + x = "0"; + while (cond) { + x = asNumber(x) + 1; + x; + } +} + +function h3() { + let x: string | number | boolean; + x = "0"; + while (cond) { + let y = asNumber(x); + x = y + 1; + x; + } +} + +function h4() { + let x: string | number | boolean; + x = "0"; + while (cond) { + x; + let y = asNumber(x); + x = y + 1; + x; + } +} diff --git a/tests/cases/conformance/controlFlow/controlFlowTruthiness.ts b/tests/cases/conformance/controlFlow/controlFlowTruthiness.ts new file mode 100644 index 00000000000..ba1947da13b --- /dev/null +++ b/tests/cases/conformance/controlFlow/controlFlowTruthiness.ts @@ -0,0 +1,70 @@ +// @strictNullChecks: true + +declare function foo(): string | undefined; + +function f1() { + let x = foo(); + if (x) { + x; // string + } + else { + x; // string | undefined + } +} + +function f2() { + let x: string | undefined; + x = foo(); + if (x) { + x; // string + } + else { + x; // string | undefined + } +} + +function f3() { + let x: string | undefined; + if (x = foo()) { + x; // string + } + else { + x; // string | undefined + } +} + +function f4() { + let x: string | undefined; + if (!(x = foo())) { + x; // string | undefined + } + else { + x; // string + } +} + +function f5() { + let x: string | undefined; + let y: string | undefined; + if (x = y = foo()) { + x; // string + y; // string | undefined + } + else { + x; // string | undefined + y; // string | undefined + } +} + +function f6() { + let x: string | undefined; + let y: string | undefined; + if (x = foo(), y = foo()) { + x; // string | undefined + y; // string + } + else { + x; // string | undefined + y; // string | undefined + } +} diff --git a/tests/cases/conformance/controlFlow/controlFlowWhileStatement.ts b/tests/cases/conformance/controlFlow/controlFlowWhileStatement.ts new file mode 100644 index 00000000000..7bf49dd7224 --- /dev/null +++ b/tests/cases/conformance/controlFlow/controlFlowWhileStatement.ts @@ -0,0 +1,106 @@ +let cond: boolean; +function a() { + let x: string | number; + x = ""; + while (cond) { + x; // string + } +} +function b() { + let x: string | number; + x = ""; + while (cond) { + x; // string + x = 42; + break; + } +} +function c() { + let x: string | number; + x = ""; + while (cond) { + x; // string + x = undefined; + if (typeof x === "string") continue; + break; + } +} +function d() { + let x: string | number; + x = ""; + while (x = x.length) { + x; // number + x = ""; + } +} +function e() { + let x: string | number; + x = ""; + while (cond) { + x; // string | number + x = 42; + x; // number + } + x; // string | number +} +function f() { + let x: string | number | boolean | RegExp | Function; + x = ""; + while (cond) { + if (cond) { + x = 42; + break; + } + if (cond) { + x = true; + continue; + } + x = /a/; + } + x; // string | number | boolean | RegExp +} +function g() { + let x: string | number | boolean | RegExp | Function; + x = ""; + while (true) { + if (cond) { + x = 42; + break; + } + if (cond) { + x = true; + continue; + } + x = /a/; + } + x; // number +} +function h1() { + let x: string | number | boolean; + x = ""; + while (x > 1) { + x; // string | number + x = 1; + x; // number + } + x; // string | number +} +declare function len(s: string | number): number; +function h2() { + let x: string | number | boolean; + x = ""; + while (cond) { + x = len(x); + x; // number + } + x; // string | number +} +function h3() { + let x: string | number | boolean; + x = ""; + while (cond) { + x; // string | number + x = len(x); + } + x; // string | number +} diff --git a/tests/cases/conformance/controlFlow/typeGuardsAsAssertions.ts b/tests/cases/conformance/controlFlow/typeGuardsAsAssertions.ts new file mode 100644 index 00000000000..912eaa64e80 --- /dev/null +++ b/tests/cases/conformance/controlFlow/typeGuardsAsAssertions.ts @@ -0,0 +1,122 @@ +// @strictNullChecks: true + +// Repro from #8513 + +let cond: boolean; + +export type Optional = Some | None; + +export interface None { readonly none: string; } +export interface Some { readonly some: a; } + +export const none : None = { none: '' }; + +export function isSome(value: Optional): value is Some { + return 'some' in value; +} + +function someFrom(some: a) { + return { some }; +} + +export function fn(makeSome: () => r): void { + let result: Optional = none; + result; // None + while (cond) { + result; // Some | None + result = someFrom(isSome(result) ? result.some : makeSome()); + result; // Some + } +} + +function foo1() { + let x: string | number | boolean = 0; + x; // number + while (cond) { + x; // number, then string | number + x = typeof x === "string" ? x.slice() : "abc"; + x; // string + } + x; +} + +function foo2() { + let x: string | number | boolean = 0; + x; // number + while (cond) { + x; // number, then string | number + if (typeof x === "string") { + x = x.slice(); + } + else { + x = "abc"; + } + x; // string + } + x; +} + +// Type guards as assertions + +function f1() { + let x: string | number | undefined = undefined; + x; // undefined + if (x) { + x; // string | number (guard as assertion) + } + x; // string | number | undefined +} + +function f2() { + let x: string | number | undefined = undefined; + x; // undefined + if (typeof x === "string") { + x; // string (guard as assertion) + } + x; // string | undefined +} + +function f3() { + let x: string | number | undefined = undefined; + x; // undefined + if (!x) { + return; + } + x; // string | number (guard as assertion) +} + +function f4() { + let x: string | number | undefined = undefined; + x; // undefined + if (typeof x === "boolean") { + x; // nothing (boolean not in declared type) + } + x; // undefined +} + +function f5(x: string | number) { + if (typeof x === "string" && typeof x === "number") { + x; // number (guard as assertion) + } + else { + x; // string | number + } + x; // string | number +} + +function f6() { + let x: string | undefined | null; + x!.slice(); + x = ""; + x!.slice(); + x = undefined; + x!.slice(); + x = null; + x!.slice(); + x = undefined; + x!.slice(); + x = ""; + x!.slice(); + x = ""; + x!.slice(); +} diff --git a/tests/cases/conformance/declarationEmit/typePredicates/declarationEmitIdentifierPredicates01.ts b/tests/cases/conformance/declarationEmit/typePredicates/declarationEmitIdentifierPredicates01.ts new file mode 100644 index 00000000000..c4a223f07ef --- /dev/null +++ b/tests/cases/conformance/declarationEmit/typePredicates/declarationEmitIdentifierPredicates01.ts @@ -0,0 +1,6 @@ +// @declaration: true +// @module: commonjs + +export function f(x: any): x is number { + return typeof x === "number"; +} \ No newline at end of file diff --git a/tests/cases/conformance/declarationEmit/typePredicates/declarationEmitIdentifierPredicatesWithPrivateName01.ts b/tests/cases/conformance/declarationEmit/typePredicates/declarationEmitIdentifierPredicatesWithPrivateName01.ts new file mode 100644 index 00000000000..1398b2bc040 --- /dev/null +++ b/tests/cases/conformance/declarationEmit/typePredicates/declarationEmitIdentifierPredicatesWithPrivateName01.ts @@ -0,0 +1,10 @@ +// @declaration: true +// @module: commonjs + +interface I { + a: number; +} + +export function f(x: any): x is I { + return typeof x.a === "number"; +} \ No newline at end of file diff --git a/tests/cases/conformance/declarationEmit/typePredicates/declarationEmitThisPredicates01.ts b/tests/cases/conformance/declarationEmit/typePredicates/declarationEmitThisPredicates01.ts new file mode 100644 index 00000000000..69af9c5b077 --- /dev/null +++ b/tests/cases/conformance/declarationEmit/typePredicates/declarationEmitThisPredicates01.ts @@ -0,0 +1,11 @@ +// @declaration: true +// @module: commonjs + +export class C { + m(): this is D { + return this instanceof D; + } +} + +export class D extends C { +} \ No newline at end of file diff --git a/tests/cases/conformance/declarationEmit/typePredicates/declarationEmitThisPredicates02.ts b/tests/cases/conformance/declarationEmit/typePredicates/declarationEmitThisPredicates02.ts new file mode 100644 index 00000000000..02f2a798831 --- /dev/null +++ b/tests/cases/conformance/declarationEmit/typePredicates/declarationEmitThisPredicates02.ts @@ -0,0 +1,15 @@ +// @declaration: true +// @module: commonjs + +export interface Foo { + a: string; + b: number; + c: boolean; +} + +export const obj = { + m(): this is Foo { + let dis = this as Foo; + return dis.a != null && dis.b != null && dis.c != null; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/declarationEmit/typePredicates/declarationEmitThisPredicatesWithPrivateName01.ts b/tests/cases/conformance/declarationEmit/typePredicates/declarationEmitThisPredicatesWithPrivateName01.ts new file mode 100644 index 00000000000..461c7d17571 --- /dev/null +++ b/tests/cases/conformance/declarationEmit/typePredicates/declarationEmitThisPredicatesWithPrivateName01.ts @@ -0,0 +1,11 @@ +// @declaration: true +// @module: commonjs + +export class C { + m(): this is D { + return this instanceof D; + } +} + +class D extends C { +} \ No newline at end of file diff --git a/tests/cases/conformance/declarationEmit/typePredicates/declarationEmitThisPredicatesWithPrivateName02.ts b/tests/cases/conformance/declarationEmit/typePredicates/declarationEmitThisPredicatesWithPrivateName02.ts new file mode 100644 index 00000000000..c238bb16ec8 --- /dev/null +++ b/tests/cases/conformance/declarationEmit/typePredicates/declarationEmitThisPredicatesWithPrivateName02.ts @@ -0,0 +1,15 @@ +// @declaration: true +// @module: commonjs + +interface Foo { + a: string; + b: number; + c: boolean; +} + +export const obj = { + m(): this is Foo { + let dis = this as Foo; + return dis.a != null && dis.b != null && dis.c != null; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/enums/enumBasics.ts b/tests/cases/conformance/enums/enumBasics.ts index 756e08e97af..1e134540713 100644 --- a/tests/cases/conformance/enums/enumBasics.ts +++ b/tests/cases/conformance/enums/enumBasics.ts @@ -11,10 +11,10 @@ var x: number = E1.A; // Enum object type is anonymous with properties of the enum type and numeric indexer var e = E1; var e: { - A: E1; - B: E1; - C: E1; - [n: number]: string; + readonly A: E1; + readonly B: E1; + readonly C: E1; + readonly [n: number]: string; }; var e: typeof E1; diff --git a/tests/cases/conformance/es2017/useObjectValuesAndEntries1.ts b/tests/cases/conformance/es2017/useObjectValuesAndEntries1.ts new file mode 100644 index 00000000000..145239a84b2 --- /dev/null +++ b/tests/cases/conformance/es2017/useObjectValuesAndEntries1.ts @@ -0,0 +1,11 @@ +// @target: es5 +// @lib: es5,es2017.object + +var o = { a: 1, b: 2 }; + +for (var x of Object.values(o)) { + let y = x; +} + +var entries = Object.entries(o); +var entries1 = Object.entries(1); // <-- entries: [string, any][] \ No newline at end of file diff --git a/tests/cases/conformance/es2017/useObjectValuesAndEntries2.ts b/tests/cases/conformance/es2017/useObjectValuesAndEntries2.ts new file mode 100644 index 00000000000..d3596222a47 --- /dev/null +++ b/tests/cases/conformance/es2017/useObjectValuesAndEntries2.ts @@ -0,0 +1,10 @@ +// @target: es5 +// @lib: es5 + +var o = { a: 1, b: 2 }; + +for (var x of Object.values(o)) { + let y = x; +} + +var entries = Object.entries(o); \ No newline at end of file diff --git a/tests/cases/conformance/es2017/useObjectValuesAndEntries3.ts b/tests/cases/conformance/es2017/useObjectValuesAndEntries3.ts new file mode 100644 index 00000000000..b05d32744bf --- /dev/null +++ b/tests/cases/conformance/es2017/useObjectValuesAndEntries3.ts @@ -0,0 +1,9 @@ +// @target: es6 + +var o = { a: 1, b: 2 }; + +for (var x of Object.values(o)) { + let y = x; +} + +var entries = Object.entries(o); \ No newline at end of file diff --git a/tests/cases/conformance/es2017/useObjectValuesAndEntries4.ts b/tests/cases/conformance/es2017/useObjectValuesAndEntries4.ts new file mode 100644 index 00000000000..d319d6efee7 --- /dev/null +++ b/tests/cases/conformance/es2017/useObjectValuesAndEntries4.ts @@ -0,0 +1,10 @@ +// @target: es6 +// @lib: es2017 + +var o = { a: 1, b: 2 }; + +for (var x of Object.values(o)) { + let y = x; +} + +var entries = Object.entries(o); \ No newline at end of file diff --git a/tests/cases/conformance/es6/classDeclaration/superCallBeforeThisAccessing1.ts b/tests/cases/conformance/es6/classDeclaration/superCallBeforeThisAccessing1.ts new file mode 100644 index 00000000000..e5d63f2e930 --- /dev/null +++ b/tests/cases/conformance/es6/classDeclaration/superCallBeforeThisAccessing1.ts @@ -0,0 +1,15 @@ +declare var Factory: any + +class Base { + constructor(c) { } +} +class D extends Base { + private _t; + constructor() { + super(i); + var s = { + t: this._t + } + var i = Factory.create(s); + } +} diff --git a/tests/cases/conformance/es6/classDeclaration/superCallBeforeThisAccessing2.ts b/tests/cases/conformance/es6/classDeclaration/superCallBeforeThisAccessing2.ts new file mode 100644 index 00000000000..1b0a0d541e9 --- /dev/null +++ b/tests/cases/conformance/es6/classDeclaration/superCallBeforeThisAccessing2.ts @@ -0,0 +1,9 @@ +class Base { + constructor(c) { } +} +class D extends Base { + private _t; + constructor() { + super(() => { this._t }); // no error. only check when this is directly accessing in constructor + } +} diff --git a/tests/cases/conformance/es6/classDeclaration/superCallBeforeThisAccessing3.ts b/tests/cases/conformance/es6/classDeclaration/superCallBeforeThisAccessing3.ts new file mode 100644 index 00000000000..1386998aaae --- /dev/null +++ b/tests/cases/conformance/es6/classDeclaration/superCallBeforeThisAccessing3.ts @@ -0,0 +1,12 @@ +class Base { + constructor(c) { } +} +class D extends Base { + private _t; + constructor() { + let x = () => { this._t }; + x(); // no error; we only check super is called before this when the container is a constructor + this._t; // error + super(undefined); + } +} diff --git a/tests/cases/conformance/es6/classDeclaration/superCallBeforeThisAccessing4.ts b/tests/cases/conformance/es6/classDeclaration/superCallBeforeThisAccessing4.ts new file mode 100644 index 00000000000..9135e03b0ce --- /dev/null +++ b/tests/cases/conformance/es6/classDeclaration/superCallBeforeThisAccessing4.ts @@ -0,0 +1,15 @@ +class D extends null { + private _t; + constructor() { + this._t; + super(); + } +} + +class E extends null { + private _t; + constructor() { + super(); + this._t; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/classDeclaration/superCallBeforeThisAccessing5.ts b/tests/cases/conformance/es6/classDeclaration/superCallBeforeThisAccessing5.ts new file mode 100644 index 00000000000..17820277585 --- /dev/null +++ b/tests/cases/conformance/es6/classDeclaration/superCallBeforeThisAccessing5.ts @@ -0,0 +1,6 @@ +class D extends null { + private _t; + constructor() { + this._t; // No error + } +} diff --git a/tests/cases/conformance/es6/classDeclaration/superCallBeforeThisAccessing6.ts b/tests/cases/conformance/es6/classDeclaration/superCallBeforeThisAccessing6.ts new file mode 100644 index 00000000000..8f36f2eb056 --- /dev/null +++ b/tests/cases/conformance/es6/classDeclaration/superCallBeforeThisAccessing6.ts @@ -0,0 +1,9 @@ +class Base { + constructor(c) { } +} +class D extends Base { + private _t; + constructor() { + super(this); + } +} diff --git a/tests/cases/conformance/es6/classDeclaration/superCallBeforeThisAccessing7.ts b/tests/cases/conformance/es6/classDeclaration/superCallBeforeThisAccessing7.ts new file mode 100644 index 00000000000..d40c96a60f3 --- /dev/null +++ b/tests/cases/conformance/es6/classDeclaration/superCallBeforeThisAccessing7.ts @@ -0,0 +1,12 @@ +class Base { + constructor(c) { } +} +class D extends Base { + private _t; + constructor() { + let x = { + j: this._t, + } + super(undefined); + } +} diff --git a/tests/cases/conformance/es6/classDeclaration/superCallBeforeThisAccessing8.ts b/tests/cases/conformance/es6/classDeclaration/superCallBeforeThisAccessing8.ts new file mode 100644 index 00000000000..5742cdab845 --- /dev/null +++ b/tests/cases/conformance/es6/classDeclaration/superCallBeforeThisAccessing8.ts @@ -0,0 +1,12 @@ +class Base { + constructor(c) { } +} +class D extends Base { + private _t; + constructor() { + let x = { + k: super(undefined), + j: this._t, // no error + } + } +} diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap1_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap1_ES5.ts index 9454483cdb4..5eb378ebc4c 100644 --- a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap1_ES5.ts +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap1_ES5.ts @@ -4,4 +4,7 @@ class C { ["hello"]() { debugger; } + get ["goodbye"]() { + return 0; + } } \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap1_ES6.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap1_ES6.ts index 73d9dc215d9..bb7080e760f 100644 --- a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap1_ES6.ts +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap1_ES6.ts @@ -3,5 +3,8 @@ class C { ["hello"]() { debugger; - } + } + get ["goodbye"]() { + return 0; + } } \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2_ES5.ts index 3d35cd12430..53e3a515773 100644 --- a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2_ES5.ts +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2_ES5.ts @@ -3,5 +3,8 @@ var v = { ["hello"]() { debugger; - } + }, + get ["goodbye"]() { + return 0; + } } \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2_ES6.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2_ES6.ts index fc7f4fcb39d..49d048445c8 100644 --- a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2_ES6.ts +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2_ES6.ts @@ -3,5 +3,8 @@ var v = { ["hello"]() { debugger; - } + }, + get ["goodbye"]() { + return 0; + } } \ No newline at end of file diff --git a/tests/cases/conformance/es6/decorators/class/decoratorOnClass1.es6.ts b/tests/cases/conformance/es6/decorators/class/decoratorOnClass1.es6.ts new file mode 100644 index 00000000000..7dccedc5d1f --- /dev/null +++ b/tests/cases/conformance/es6/decorators/class/decoratorOnClass1.es6.ts @@ -0,0 +1,9 @@ +// @target:es6 +// @experimentaldecorators: true +declare function dec(target: T): T; + +@dec +class C { +} + +let c = new C(); \ No newline at end of file diff --git a/tests/cases/conformance/es6/decorators/class/decoratorOnClass2.es6.ts b/tests/cases/conformance/es6/decorators/class/decoratorOnClass2.es6.ts new file mode 100644 index 00000000000..62d6a15d0bc --- /dev/null +++ b/tests/cases/conformance/es6/decorators/class/decoratorOnClass2.es6.ts @@ -0,0 +1,9 @@ +// @target:es6 +// @experimentaldecorators: true +declare function dec(target: T): T; + +@dec +export class C { +} + +let c = new C(); \ No newline at end of file diff --git a/tests/cases/conformance/es6/decorators/class/decoratorOnClass3.es6.ts b/tests/cases/conformance/es6/decorators/class/decoratorOnClass3.es6.ts new file mode 100644 index 00000000000..cc62befe2d8 --- /dev/null +++ b/tests/cases/conformance/es6/decorators/class/decoratorOnClass3.es6.ts @@ -0,0 +1,9 @@ +// @target:es6 +// @experimentaldecorators: true +declare function dec(target: T): T; + +@dec +export default class C { +} + +let c = new C(); \ No newline at end of file diff --git a/tests/cases/conformance/es6/decorators/class/decoratorOnClass4.es6.ts b/tests/cases/conformance/es6/decorators/class/decoratorOnClass4.es6.ts new file mode 100644 index 00000000000..050c8ae15fc --- /dev/null +++ b/tests/cases/conformance/es6/decorators/class/decoratorOnClass4.es6.ts @@ -0,0 +1,7 @@ +// @target:es6 +// @experimentaldecorators: true +declare function dec(target: T): T; + +@dec +export default class { +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/decorators/class/decoratorOnClass5.es6.ts b/tests/cases/conformance/es6/decorators/class/decoratorOnClass5.es6.ts new file mode 100644 index 00000000000..daa21330c2b --- /dev/null +++ b/tests/cases/conformance/es6/decorators/class/decoratorOnClass5.es6.ts @@ -0,0 +1,11 @@ +// @target:es6 +// @experimentaldecorators: true +declare function dec(target: T): T; + +@dec +class C { + static x() { return C.y; } + static y = 1; +} + +let c = new C(); \ No newline at end of file diff --git a/tests/cases/conformance/es6/decorators/class/decoratorOnClass6.es6.ts b/tests/cases/conformance/es6/decorators/class/decoratorOnClass6.es6.ts new file mode 100644 index 00000000000..b28f8918495 --- /dev/null +++ b/tests/cases/conformance/es6/decorators/class/decoratorOnClass6.es6.ts @@ -0,0 +1,11 @@ +// @target:es6 +// @experimentaldecorators: true +declare function dec(target: T): T; + +@dec +export class C { + static x() { return C.y; } + static y = 1; +} + +let c = new C(); \ No newline at end of file diff --git a/tests/cases/conformance/es6/decorators/class/decoratorOnClass7.es6.ts b/tests/cases/conformance/es6/decorators/class/decoratorOnClass7.es6.ts new file mode 100644 index 00000000000..a69b7556d97 --- /dev/null +++ b/tests/cases/conformance/es6/decorators/class/decoratorOnClass7.es6.ts @@ -0,0 +1,11 @@ +// @target:es6 +// @experimentaldecorators: true +declare function dec(target: T): T; + +@dec +export default class C { + static x() { return C.y; } + static y = 1; +} + +let c = new C(); \ No newline at end of file diff --git a/tests/cases/conformance/es6/decorators/class/decoratorOnClass8.es6.ts b/tests/cases/conformance/es6/decorators/class/decoratorOnClass8.es6.ts new file mode 100644 index 00000000000..2e85fc801f2 --- /dev/null +++ b/tests/cases/conformance/es6/decorators/class/decoratorOnClass8.es6.ts @@ -0,0 +1,8 @@ +// @target:es6 +// @experimentaldecorators: true +declare function dec(target: T): T; + +@dec +export default class { + static y = 1; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/destructuring/destructuringInFunctionType.ts b/tests/cases/conformance/es6/destructuring/destructuringInFunctionType.ts new file mode 100644 index 00000000000..51333b1ca53 --- /dev/null +++ b/tests/cases/conformance/es6/destructuring/destructuringInFunctionType.ts @@ -0,0 +1,22 @@ +// @declaration: true + +interface a { a } +interface b { b } +interface c { c } + +type T1 = ([a, b, c]); +type F1 = ([a, b, c]) => void; + +type T2 = ({ a }); +type F2 = ({ a }) => void; + +type T3 = ([{ a: b }, { b: a }]); +type F3 = ([{ a: b }, { b: a }]) => void; + +type T4 = ([{ a: [b, c] }]); +type F4 = ([{ a: [b, c] }]) => void; + +type C1 = new ([{ a: [b, c] }]) => void; + +var v1 = ([a, b, c]) => "hello"; +var v2: ([a, b, c]) => string; diff --git a/tests/cases/conformance/es6/modules/defaultExportInAwaitExpression01.ts b/tests/cases/conformance/es6/modules/defaultExportInAwaitExpression01.ts new file mode 100644 index 00000000000..45f15423016 --- /dev/null +++ b/tests/cases/conformance/es6/modules/defaultExportInAwaitExpression01.ts @@ -0,0 +1,12 @@ +// @target: ES6 +// @module: umd +// @filename: a.ts +const x = new Promise( ( resolve, reject ) => { resolve( {} ); } ); +export default x; + +// @filename: b.ts +import x from './a'; + +( async function() { + const value = await x; +}() ); diff --git a/tests/cases/conformance/es6/modules/defaultExportInAwaitExpression02.ts b/tests/cases/conformance/es6/modules/defaultExportInAwaitExpression02.ts new file mode 100644 index 00000000000..cd878540a3c --- /dev/null +++ b/tests/cases/conformance/es6/modules/defaultExportInAwaitExpression02.ts @@ -0,0 +1,12 @@ +// @target: ES6 +// @module: commonjs +// @filename: a.ts +const x = new Promise( ( resolve, reject ) => { resolve( {} ); } ); +export default x; + +// @filename: b.ts +import x from './a'; + +( async function() { + const value = await x; +}() ); diff --git a/tests/cases/conformance/es6/modules/exportsAndImportsWithUnderscores1.ts b/tests/cases/conformance/es6/modules/exportsAndImportsWithUnderscores1.ts new file mode 100644 index 00000000000..8e38deaaf13 --- /dev/null +++ b/tests/cases/conformance/es6/modules/exportsAndImportsWithUnderscores1.ts @@ -0,0 +1,14 @@ +//@module: commonjs +//@target: ES3 + +// @filename: m1.ts +var R: any +export default R = { + "__": 20, + "_": 10 + "___": 30 +} + +// @filename: m2.ts +import R from "./m1"; +const { __, _, ___ } = R; diff --git a/tests/cases/conformance/es6/modules/exportsAndImportsWithUnderscores2.ts b/tests/cases/conformance/es6/modules/exportsAndImportsWithUnderscores2.ts new file mode 100644 index 00000000000..fac9f467549 --- /dev/null +++ b/tests/cases/conformance/es6/modules/exportsAndImportsWithUnderscores2.ts @@ -0,0 +1,13 @@ +//@module: commonjs +//@target: ES3 + +// @filename: m1.ts +var R: any +export default R = { + "__esmodule": true, + "__proto__": {} +} + +// @filename: m2.ts +import R from "./m1"; +const { __esmodule, __proto__ } = R; diff --git a/tests/cases/conformance/es6/modules/exportsAndImportsWithUnderscores3.ts b/tests/cases/conformance/es6/modules/exportsAndImportsWithUnderscores3.ts new file mode 100644 index 00000000000..cd71808915c --- /dev/null +++ b/tests/cases/conformance/es6/modules/exportsAndImportsWithUnderscores3.ts @@ -0,0 +1,14 @@ +//@module: commonjs +//@target: ES3 + +// @filename: m1.ts +var R: any +export default R = { + "___": 30, + "___hello": 21, + "_hi": 40, +} + +// @filename: m2.ts +import R from "./m1"; +const { ___, ___hello, _hi } = R; diff --git a/tests/cases/conformance/es6/modules/exportsAndImportsWithUnderscores4.ts b/tests/cases/conformance/es6/modules/exportsAndImportsWithUnderscores4.ts new file mode 100644 index 00000000000..34022597552 --- /dev/null +++ b/tests/cases/conformance/es6/modules/exportsAndImportsWithUnderscores4.ts @@ -0,0 +1,35 @@ +//@module: commonjs +//@target: ES3 + +// @filename: m1.ts +declare var console: any; +export function _() { + console.log("_"); +} +export function __() { + console.log("__"); +} +export function ___() { + console.log("___"); +} +export function _hi() { + console.log("_hi"); +} +export function __proto() { + console.log("__proto"); +} +export function __esmodule() { + console.log("__esmodule"); +} +export function ___hello(){ + console.log("___hello"); +} + +// @filename: m2.ts +import {_, __, ___hello, __esmodule, __proto, _hi} from "./m1"; +_(); +__(); +___hello(); +__esmodule(); +__proto(); +_hi(); \ No newline at end of file diff --git a/tests/cases/conformance/es6/variableDeclarations/VariableDeclaration12_es6.ts b/tests/cases/conformance/es6/variableDeclarations/VariableDeclaration12_es6.ts new file mode 100644 index 00000000000..f9839cf8502 --- /dev/null +++ b/tests/cases/conformance/es6/variableDeclarations/VariableDeclaration12_es6.ts @@ -0,0 +1,4 @@ +// @target:es6 + +let +x \ No newline at end of file diff --git a/tests/cases/conformance/es6/variableDeclarations/VariableDeclaration13_es6.ts b/tests/cases/conformance/es6/variableDeclarations/VariableDeclaration13_es6.ts new file mode 100644 index 00000000000..0f20b02c01c --- /dev/null +++ b/tests/cases/conformance/es6/variableDeclarations/VariableDeclaration13_es6.ts @@ -0,0 +1,6 @@ +// @target:es6 + +// An ExpressionStatement cannot start with the two token sequence `let [` because +// that would make it ambiguous with a `let` LexicalDeclaration whose first LexicalBinding was an ArrayBindingPattern. +var let: any; +let[0] = 100; \ No newline at end of file diff --git a/tests/cases/conformance/expressions/assignmentOperator/assignmentTypeNarrowing.ts b/tests/cases/conformance/expressions/assignmentOperator/assignmentTypeNarrowing.ts new file mode 100644 index 00000000000..0e5e257635a --- /dev/null +++ b/tests/cases/conformance/expressions/assignmentOperator/assignmentTypeNarrowing.ts @@ -0,0 +1,28 @@ +let x: string | number | boolean | RegExp; + +x = ""; +x; // string + +[x] = [true]; +x; // boolean + +[x = ""] = [1]; +x; // string | number + +({x} = {x: true}); +x; // boolean + +({y: x} = {y: 1}); +x; // number + +({x = ""} = {x: true}); +x; // string | boolean + +({y: x = /a/} = {y: 1}); +x; // number | RegExp + +let a: string[]; + +for (x of a) { + x; // string +} diff --git a/tests/cases/conformance/expressions/elementAccess/letIdentifierInElementAccess01.ts b/tests/cases/conformance/expressions/elementAccess/letIdentifierInElementAccess01.ts new file mode 100644 index 00000000000..f0f71dc6ceb --- /dev/null +++ b/tests/cases/conformance/expressions/elementAccess/letIdentifierInElementAccess01.ts @@ -0,0 +1,2 @@ +var let: any = {}; +(let[0] = 100); \ No newline at end of file diff --git a/tests/cases/conformance/expressions/functions/contextuallyTypedIife.ts b/tests/cases/conformance/expressions/functions/contextuallyTypedIife.ts new file mode 100644 index 00000000000..ed3c24e0ac7 --- /dev/null +++ b/tests/cases/conformance/expressions/functions/contextuallyTypedIife.ts @@ -0,0 +1,29 @@ +// arrow +(jake => { })("build"); +// function expression +(function (cats) { })("lol"); +// Lots of Irritating Superfluous Parentheses +(function (x) { } ("!")); +((((function (y) { }))))("-"); +// multiple arguments +((a, b, c) => { })("foo", 101, false); +// default parameters +((m = 10) => m + 1)(12); +((n = 10) => n + 1)(); +// optional parameters +((j?) => j + 1)(12); +((k?) => k + 1)(); +((l, o?) => l + o)(12); // o should be any +// rest parameters +((...numbers) => numbers.every(n => n > 0))(5,6,7); +((...mixed) => mixed.every(n => !!n))(5,'oops','oh no'); +((...noNumbers) => noNumbers.some(n => n > 0))(); +((first, ...rest) => first ? [] : rest.map(n => n > 0))(8,9,10); +// destructuring parameters (with defaults too!) +(({ q }) => q)({ q : 13 }); +(({ p = 14 }) => p)({ p : 15 }); +(({ r = 17 } = { r: 18 }) => r)({r : 19}); +(({ u = 22 } = { u: 23 }) => u)(); +// contextually typed parameters. +let twelve = (f => f(12))(i => i); +let eleven = (o => o.a(11))({ a: function(n) { return n; } }); diff --git a/tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts b/tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts index 5a6bc87af36..af0622179ac 100644 --- a/tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts +++ b/tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts @@ -16,11 +16,11 @@ var callSig3: { num: (n: number) => string; }; // Get accessor only, type of the property is the annotated return type of the get accessor var getter1 = { get x(): string { return undefined; } }; -var getter1: { x: string; } +var getter1: { readonly x: string; } // Get accessor only, type of the property is the inferred return type of the get accessor var getter2 = { get x() { return ''; } }; -var getter2: { x: string; } +var getter2: { readonly x: string; } // Set accessor only, type of the property is the param type of the set accessor var setter1 = { set x(n: number) { } }; diff --git a/tests/cases/conformance/expressions/thisKeyword/thisInInvalidContexts.ts b/tests/cases/conformance/expressions/thisKeyword/thisInInvalidContexts.ts index 0afbc450040..2b929318c13 100644 --- a/tests/cases/conformance/expressions/thisKeyword/thisInInvalidContexts.ts +++ b/tests/cases/conformance/expressions/thisKeyword/thisInInvalidContexts.ts @@ -11,7 +11,7 @@ class ClassWithNoInitializer extends BaseErrClass { t; //'this' in optional super call constructor() { - super(this); // OK + super(this); // Error } } diff --git a/tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts b/tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts index 513e56977df..e3d8ce9f5fc 100644 --- a/tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts +++ b/tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts @@ -11,7 +11,7 @@ class ClassWithNoInitializer extends BaseErrClass { t; //'this' in optional super call constructor() { - super(this); // OK + super(this); // error: "super" has to be called before "this" accessing } } diff --git a/tests/cases/conformance/expressions/thisKeyword/thisInObjectLiterals.ts b/tests/cases/conformance/expressions/thisKeyword/thisInObjectLiterals.ts index da38484bc07..ddfbb790980 100644 --- a/tests/cases/conformance/expressions/thisKeyword/thisInObjectLiterals.ts +++ b/tests/cases/conformance/expressions/thisKeyword/thisInObjectLiterals.ts @@ -8,7 +8,7 @@ class MyClass { } } -//type of 'this' in an object literal property of a function type is Any +//type of 'this' in an object literal method is the type of the object literal var obj = { f() { return this.spaaace; diff --git a/tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts b/tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts index 2acbbe53789..f30eafb3918 100644 --- a/tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts +++ b/tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts @@ -38,4 +38,13 @@ someOther = someDerived; // Error someOther = someBase; // Error someOther = someOther; +// Type assertion cannot be a type-predicate type +var numOrStr: number | string; +var str: string; +if((numOrStr === undefined)) { // Error + str = numOrStr; // Error, no narrowing occurred +} + +if((numOrStr === undefined) as numOrStr is string) { // Error +} diff --git a/tests/cases/conformance/expressions/typeGuards/typeGuardFunctionOfFormThis.ts b/tests/cases/conformance/expressions/typeGuards/typeGuardFunctionOfFormThis.ts index aadbf3cd9c5..12f6687c401 100644 --- a/tests/cases/conformance/expressions/typeGuards/typeGuardFunctionOfFormThis.ts +++ b/tests/cases/conformance/expressions/typeGuards/typeGuardFunctionOfFormThis.ts @@ -34,19 +34,19 @@ else if (b.isFollower()) { b.follow(); } -if (((a.isLeader)())) { - a.lead(); -} -else if (((a).isFollower())) { - a.follow(); -} +// if (((a.isLeader)())) { +// a.lead(); +// } +// else if (((a).isFollower())) { +// a.follow(); +// } -if (((a["isLeader"])())) { - a.lead(); -} -else if (((a)["isFollower"]())) { - a.follow(); -} +// if (((a["isLeader"])())) { +// a.lead(); +// } +// else if (((a)["isFollower"]())) { +// a.follow(); +// } var holder2 = {a}; diff --git a/tests/cases/conformance/expressions/typeGuards/typeGuardOfFormFunctionEquality.ts b/tests/cases/conformance/expressions/typeGuards/typeGuardOfFormFunctionEquality.ts new file mode 100644 index 00000000000..baff942bb8e --- /dev/null +++ b/tests/cases/conformance/expressions/typeGuards/typeGuardOfFormFunctionEquality.ts @@ -0,0 +1,14 @@ +declare function isString1(a: number, b: Object): b is string; + +declare function isString2(a: Object): a is string; + +switch (isString1(0, "")) { + case isString2(""): + default: +} + +var x = isString1(0, "") === isString2(""); + +function isString3(a: number, b: number, c: Object): c is string { + return isString1(0, c); +} diff --git a/tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfBoolean.ts b/tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfBoolean.ts index fb699ce8ce0..37651071b7f 100644 --- a/tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfBoolean.ts +++ b/tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfBoolean.ts @@ -41,12 +41,11 @@ else { c = boolOrC; // C } -// Narrowing occurs only if target type is a subtype of variable type if (typeof strOrNum === "boolean") { - var z1: string | number = strOrNum; // string | number + let z1: {} = strOrNum; // {} } else { - var z2: string | number = strOrNum; // string | number + let z2: string | number = strOrNum; // string | number } @@ -78,10 +77,9 @@ else { bool = boolOrC; // boolean } -// Narrowing occurs only if target type is a subtype of variable type if (typeof strOrNum !== "boolean") { - var z1: string | number = strOrNum; // string | number + let z1: string | number = strOrNum; // string | number } else { - var z2: string | number = strOrNum; // string | number + let z2: {} = strOrNum; // {} } diff --git a/tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNumber.ts b/tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNumber.ts index 2868b114077..b4cdf81660e 100644 --- a/tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNumber.ts +++ b/tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNumber.ts @@ -41,12 +41,11 @@ else { c = numOrC; // C } -// Narrowing occurs only if target type is a subtype of variable type if (typeof strOrBool === "number") { - var y1: string | boolean = strOrBool; // string | boolean + let y1: {} = strOrBool; // {} } else { - var y2: string | boolean = strOrBool; // string | boolean + let y2: string | boolean = strOrBool; // string | boolean } // A type guard of the form typeof x !== s, where s is a string literal, @@ -77,10 +76,9 @@ else { num = numOrC; // number } -// Narrowing occurs only if target type is a subtype of variable type if (typeof strOrBool !== "number") { - var y1: string | boolean = strOrBool; // string | boolean + let y1: string | boolean = strOrBool; // string | boolean } else { - var y2: string | boolean = strOrBool; // string | boolean + let y2: {} = strOrBool; // {} } diff --git a/tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfOther.ts b/tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfOther.ts index ac3403d8151..44b064c3219 100644 --- a/tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfOther.ts +++ b/tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfOther.ts @@ -37,12 +37,11 @@ else { var r4: boolean = boolOrC; // boolean } -// Narrowing occurs only if target type is a subtype of variable type if (typeof strOrNumOrBool === "Object") { - var q1: string | number | boolean = strOrNumOrBool; // string | number | boolean + let q1: {} = strOrNumOrBool; // {} } else { - var q2: string | number | boolean = strOrNumOrBool; // string | number | boolean + let q2: string | number | boolean = strOrNumOrBool; // string | number | boolean } // A type guard of the form typeof x !== s, where s is a string literal, @@ -67,10 +66,9 @@ else { c = boolOrC; // C } -// Narrowing occurs only if target type is a subtype of variable type if (typeof strOrNumOrBool !== "Object") { - var q1: string | number | boolean = strOrNumOrBool; // string | number | boolean + let q1: string | number | boolean = strOrNumOrBool; // string | number | boolean } else { - var q2: string | number | boolean = strOrNumOrBool; // string | number | boolean + let q2: {} = strOrNumOrBool; // {} } diff --git a/tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfPrimitiveSubtype.ts b/tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfPrimitiveSubtype.ts new file mode 100644 index 00000000000..b0493db428e --- /dev/null +++ b/tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfPrimitiveSubtype.ts @@ -0,0 +1,21 @@ +let a: {}; +let b: {toString(): string}; +if (typeof a === "number") { + let c: number = a; +} +if (typeof a === "string") { + let c: string = a; +} +if (typeof a === "boolean") { + let c: boolean = a; +} + +if (typeof b === "number") { + let c: number = b; +} +if (typeof b === "string") { + let c: string = b; +} +if (typeof b === "boolean") { + let c: boolean = b; +} diff --git a/tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfString.ts b/tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfString.ts index a356858e6c8..f742124708f 100644 --- a/tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfString.ts +++ b/tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfString.ts @@ -41,12 +41,11 @@ else { c = strOrC; // C } -// Narrowing occurs only if target type is a subtype of variable type if (typeof numOrBool === "string") { - var x1: number | boolean = numOrBool; // number | boolean + let x1: {} = numOrBool; // {} } else { - var x2: number | boolean = numOrBool; // number | boolean + let x2: number | boolean = numOrBool; // number | boolean } // A type guard of the form typeof x !== s, where s is a string literal, @@ -77,10 +76,9 @@ else { str = strOrC; // string } -// Narrowing occurs only if target type is a subtype of variable type if (typeof numOrBool !== "string") { - var x1: number | boolean = numOrBool; // number | boolean + let x1: number | boolean = numOrBool; // number | boolean } else { - var x2: number | boolean = numOrBool; // number | boolean + let x2: {} = numOrBool; // {} } diff --git a/tests/cases/conformance/expressions/typeGuards/typeGuardsInConditionalExpression.ts b/tests/cases/conformance/expressions/typeGuards/typeGuardsInConditionalExpression.ts index 1633c80ab67..01f9361ebc3 100644 --- a/tests/cases/conformance/expressions/typeGuards/typeGuardsInConditionalExpression.ts +++ b/tests/cases/conformance/expressions/typeGuards/typeGuardsInConditionalExpression.ts @@ -11,43 +11,37 @@ function foo(x: number | string) { : x++; // number } function foo2(x: number | string) { - // x is assigned in the if true branch, the type is not narrowed return typeof x === "string" - ? (x = 10 && x)// string | number - : x; // string | number + ? ((x = "hello") && x) // string + : x; // number } function foo3(x: number | string) { - // x is assigned in the if false branch, the type is not narrowed - // even though assigned using same type as narrowed expression return typeof x === "string" - ? (x = "Hello" && x) // string | number - : x; // string | number + ? ((x = 10) && x) // number + : x; // number } function foo4(x: number | string) { - // false branch updates the variable - so here it is not number - // even though assigned using same type as narrowed expression return typeof x === "string" - ? x // string | number - : (x = 10 && x); // string | number + ? x // string + : ((x = 10) && x); // number } function foo5(x: number | string) { - // false branch updates the variable - so here it is not number return typeof x === "string" - ? x // string | number - : (x = "hello" && x); // string | number + ? x // string + : ((x = "hello") && x); // string } function foo6(x: number | string) { // Modify in both branches return typeof x === "string" - ? (x = 10 && x) // string | number - : (x = "hello" && x); // string | number + ? ((x = 10) && x) // number + : ((x = "hello") && x); // string } function foo7(x: number | string | boolean) { return typeof x === "string" - ? x === "hello" // string + ? x === "hello" // boolean : typeof x === "boolean" ? x // boolean - : x == 10; // number + : x == 10; // boolean } function foo8(x: number | string | boolean) { var b: number | boolean; @@ -56,14 +50,14 @@ function foo8(x: number | string | boolean) { : ((b = x) && // number | boolean (typeof x === "boolean" ? x // boolean - : x == 10)); // number + : x == 10)); // boolean } function foo9(x: number | string) { var y = 10; // usage of x or assignment to separate variable shouldn't cause narrowing of type to stop return typeof x === "string" - ? ((y = x.length) && x === "hello") // string - : x === 10; // number + ? ((y = x.length) && x === "hello") // boolean + : x === 10; // boolean } function foo10(x: number | string | boolean) { // Mixing typeguards @@ -76,22 +70,20 @@ function foo10(x: number | string | boolean) { } function foo11(x: number | string | boolean) { // Mixing typeguards - // Assigning value to x deep inside another guard stops narrowing of type too var b: number | boolean | string; return typeof x === "string" - ? x // number | boolean | string - changed in the false branch - : ((b = x) // x is number | boolean | string - because the assignment changed it + ? x // string + : ((b = x) // x is number | boolean && typeof x === "number" && (x = 10) // assignment to x - && x); // x is number | boolean | string + && x); // x is number } function foo12(x: number | string | boolean) { // Mixing typeguards - // Assigning value to x in outer guard shouldn't stop narrowing in the inner expression var b: number | boolean | string; return typeof x === "string" - ? (x = 10 && x.toString().length) // number | boolean | string - changed here - : ((b = x) // x is number | boolean | string - changed in true branch + ? ((x = 10) && x.toString().length) // number + : ((b = x) // x is number | boolean && typeof x === "number" && x); // x is number } \ No newline at end of file diff --git a/tests/cases/conformance/expressions/typeGuards/typeGuardsInDoStatement.ts b/tests/cases/conformance/expressions/typeGuards/typeGuardsInDoStatement.ts new file mode 100644 index 00000000000..1afbe515df8 --- /dev/null +++ b/tests/cases/conformance/expressions/typeGuards/typeGuardsInDoStatement.ts @@ -0,0 +1,27 @@ +let cond: boolean; +function a(x: string | number | boolean) { + x = true; + do { + x; // boolean | string + x = undefined; + } while (typeof x === "string") + x; // number | boolean +} +function b(x: string | number | boolean) { + x = true; + do { + x; // boolean | string + if (cond) continue; + x = undefined; + } while (typeof x === "string") + x; // number | boolean +} +function c(x: string | number) { + x = ""; + do { + x; // string + if (cond) break; + x = undefined; + } while (typeof x === "string") + x; // string | number +} diff --git a/tests/cases/conformance/expressions/typeGuards/typeGuardsInForStatement.ts b/tests/cases/conformance/expressions/typeGuards/typeGuardsInForStatement.ts new file mode 100644 index 00000000000..cf5c008e800 --- /dev/null +++ b/tests/cases/conformance/expressions/typeGuards/typeGuardsInForStatement.ts @@ -0,0 +1,21 @@ +let cond: boolean; +function a(x: string | number) { + for (x = undefined; typeof x !== "number"; x = undefined) { + x; // string + } + x; // number +} +function b(x: string | number) { + for (x = undefined; typeof x !== "number"; x = undefined) { + x; // string + if (cond) continue; + } + x; // number +} +function c(x: string | number) { + for (x = undefined; typeof x !== "number"; x = undefined) { + x; // string + if (cond) break; + } + x; // string | number +} diff --git a/tests/cases/conformance/expressions/typeGuards/typeGuardsInIfStatement.ts b/tests/cases/conformance/expressions/typeGuards/typeGuardsInIfStatement.ts index f72845c18a4..1626cfdb82e 100644 --- a/tests/cases/conformance/expressions/typeGuards/typeGuardsInIfStatement.ts +++ b/tests/cases/conformance/expressions/typeGuards/typeGuardsInIfStatement.ts @@ -1,9 +1,7 @@ // In the true branch statement of an 'if' statement, -// the type of a variable or parameter is narrowed by any type guard in the 'if' condition when true, -// provided the true branch statement contains no assignments to the variable or parameter. +// the type of a variable or parameter is narrowed by any type guard in the 'if' condition when true. // In the false branch statement of an 'if' statement, -// the type of a variable or parameter is narrowed by any type guard in the 'if' condition when false, -// provided the false branch statement contains no assignments to the variable or parameter +// the type of a variable or parameter is narrowed by any type guard in the 'if' condition when false. function foo(x: number | string) { if (typeof x === "string") { return x.length; // string @@ -13,54 +11,49 @@ function foo(x: number | string) { } } function foo2(x: number | string) { - // x is assigned in the if true branch, the type is not narrowed if (typeof x === "string") { x = 10; - return x; // string | number + return x; // number } else { - return x; // string | number + return x; // number } } function foo3(x: number | string) { - // x is assigned in the if true branch, the type is not narrowed if (typeof x === "string") { - x = "Hello"; // even though assigned using same type as narrowed expression - return x; // string | number + x = "Hello"; + return x; // string } else { - return x; // string | number + return x; // number } } function foo4(x: number | string) { - // false branch updates the variable - so here it is not number if (typeof x === "string") { - return x; // string | number + return x; // string } else { - x = 10; // even though assigned number - this should result in x to be string | number - return x; // string | number + x = 10; + return x; // number } } function foo5(x: number | string) { - // false branch updates the variable - so here it is not number if (typeof x === "string") { - return x; // string | number + return x; // string } else { x = "hello"; - return x; // string | number + return x; // string } } function foo6(x: number | string) { - // Modify in both branches if (typeof x === "string") { x = 10; - return x; // string | number + return x; // number } else { x = "hello"; - return x; // string | number + return x; // string } } function foo7(x: number | string | boolean) { diff --git a/tests/cases/conformance/expressions/typeGuards/typeGuardsInRightOperandOfAndAndOperator.ts b/tests/cases/conformance/expressions/typeGuards/typeGuardsInRightOperandOfAndAndOperator.ts index da0d8ce24b5..acd71f37d91 100644 --- a/tests/cases/conformance/expressions/typeGuards/typeGuardsInRightOperandOfAndAndOperator.ts +++ b/tests/cases/conformance/expressions/typeGuards/typeGuardsInRightOperandOfAndAndOperator.ts @@ -1,6 +1,5 @@ // In the right operand of a && operation, -// the type of a variable or parameter is narrowed by any type guard in the left operand when true, -// provided the right operand contains no assignments to the variable or parameter. +// the type of a variable or parameter is narrowed by any type guard in the left operand when true. function foo(x: number | string) { return typeof x === "string" && x.length === 10; // string } @@ -35,21 +34,11 @@ function foo7(x: number | string | boolean) { var y: number| boolean | string; var z: number| boolean | string; // Mixing typeguard narrowing - // Assigning value to x deep inside another guard stops narrowing of type too return typeof x !== "string" - && ((z = x) // string | number | boolean - x changed deeper in conditional expression + && ((z = x) // number | boolean && (typeof x === "number" // change value of x - ? (x = 10 && x.toString()) // number | boolean | string + ? ((x = 10) && x.toString()) // x is number // do not change value - : (y = x && x.toString()))); // number | boolean | string + : ((y = x) && x.toString()))); // x is boolean } -function foo8(x: number | string) { - // Mixing typeguard - // Assigning value to x in outer guard shouldn't stop narrowing in the inner expression - return typeof x !== "string" - && (x = 10) // change x - number| string - && (typeof x === "number" - ? x // number - : x.length); // string -} \ No newline at end of file diff --git a/tests/cases/conformance/expressions/typeGuards/typeGuardsInRightOperandOfOrOrOperator.ts b/tests/cases/conformance/expressions/typeGuards/typeGuardsInRightOperandOfOrOrOperator.ts index 867dc143a85..131e5dd10bc 100644 --- a/tests/cases/conformance/expressions/typeGuards/typeGuardsInRightOperandOfOrOrOperator.ts +++ b/tests/cases/conformance/expressions/typeGuards/typeGuardsInRightOperandOfOrOrOperator.ts @@ -35,21 +35,11 @@ function foo7(x: number | string | boolean) { var y: number| boolean | string; var z: number| boolean | string; // Mixing typeguard narrowing - // Assigning value to x deep inside another guard stops narrowing of type too return typeof x === "string" - || ((z = x) // string | number | boolean - x changed deeper in conditional expression + || ((z = x) // number | boolean || (typeof x === "number" // change value of x - ? (x = 10 && x.toString()) // number | boolean | string + ? ((x = 10) && x.toString()) // number | boolean | string // do not change value - : (y = x && x.toString()))); // number | boolean | string + : ((y = x) && x.toString()))); // number | boolean | string } -function foo8(x: number | string) { - // Mixing typeguard - // Assigning value to x in outer guard shouldn't stop narrowing in the inner expression - return typeof x === "string" - || (x = 10) // change x - number| string - || (typeof x === "number" - ? x // number - : x.length); // string -} \ No newline at end of file diff --git a/tests/cases/conformance/expressions/typeGuards/typeGuardsInWhileStatement.ts b/tests/cases/conformance/expressions/typeGuards/typeGuardsInWhileStatement.ts new file mode 100644 index 00000000000..642c8995795 --- /dev/null +++ b/tests/cases/conformance/expressions/typeGuards/typeGuardsInWhileStatement.ts @@ -0,0 +1,24 @@ +let cond: boolean; +function a(x: string | number) { + while (typeof x === "string") { + x; // string + x = undefined; + } + x; // number +} +function b(x: string | number) { + while (typeof x === "string") { + if (cond) continue; + x; // string + x = undefined; + } + x; // number +} +function c(x: string | number) { + while (typeof x === "string") { + if (cond) break; + x; // string + x = undefined; + } + x; // string | number +} diff --git a/tests/cases/conformance/expressions/typeGuards/typePredicateOnVariableDeclaration01.ts b/tests/cases/conformance/expressions/typeGuards/typePredicateOnVariableDeclaration01.ts new file mode 100644 index 00000000000..a445e18ee40 --- /dev/null +++ b/tests/cases/conformance/expressions/typeGuards/typePredicateOnVariableDeclaration01.ts @@ -0,0 +1,3 @@ +// @declaration: true + +var x: this is string; \ No newline at end of file diff --git a/tests/cases/conformance/expressions/typeGuards/typePredicateOnVariableDeclaration02.ts b/tests/cases/conformance/expressions/typeGuards/typePredicateOnVariableDeclaration02.ts new file mode 100644 index 00000000000..4b010287337 --- /dev/null +++ b/tests/cases/conformance/expressions/typeGuards/typePredicateOnVariableDeclaration02.ts @@ -0,0 +1,3 @@ +// @declaration: true + +var y: z is number; \ No newline at end of file diff --git a/tests/cases/conformance/externalModules/importsImplicitlyReadonly.ts b/tests/cases/conformance/externalModules/importsImplicitlyReadonly.ts new file mode 100644 index 00000000000..f527606e576 --- /dev/null +++ b/tests/cases/conformance/externalModules/importsImplicitlyReadonly.ts @@ -0,0 +1,21 @@ +// @module: commonjs + +// @filename: a.ts +export var x = 1; +var y = 1; +export { y }; + +// @filename: b.ts +import { x, y } from "./a"; +import * as a1 from "./a"; +import a2 = require("./a"); +const a3 = a1; + +x = 1; // Error +y = 1; // Error +a1.x = 1; // Error +a1.y = 1; // Error +a2.x = 1; +a2.y = 1; +a3.x = 1; +a3.y = 1; \ No newline at end of file diff --git a/tests/cases/conformance/externalModules/relativePathToDeclarationFile.ts b/tests/cases/conformance/externalModules/relativePathToDeclarationFile.ts index 8d166122b46..71b8a1eb1a2 100644 --- a/tests/cases/conformance/externalModules/relativePathToDeclarationFile.ts +++ b/tests/cases/conformance/externalModules/relativePathToDeclarationFile.ts @@ -1,3 +1,4 @@ +// @ModuleResolution: classic // @Filename: test/foo.d.ts export declare module M2 { export var x: boolean; diff --git a/tests/cases/conformance/externalModules/umd-augmentation-1.ts b/tests/cases/conformance/externalModules/umd-augmentation-1.ts new file mode 100644 index 00000000000..312f21846e6 --- /dev/null +++ b/tests/cases/conformance/externalModules/umd-augmentation-1.ts @@ -0,0 +1,39 @@ +// @module: commonjs +// @noImplicitReferences: true + +// @filename: node_modules/math2d/index.d.ts +export as namespace Math2d; + +export interface Point { + x: number; + y: number; +} + +export class Vector implements Point { + x: number; + y: number; + constructor(x: number, y: number); + + translate(dx: number, dy: number): Vector; +} + +export function getLength(p: Vector): number; + +// @filename: math2d-augment.d.ts +import * as Math2d from 'math2d'; +// Augment the module +declare module 'math2d' { + // Add a method to the class + interface Vector { + reverse(): Math2d.Point; + } +} + +// @filename: b.ts +/// +import * as m from 'math2d'; +let v = new m.Vector(3, 2); +let magnitude = m.getLength(v); +let p: m.Point = v.translate(5, 5); +p = v.reverse(); +var t = p.x; diff --git a/tests/cases/conformance/externalModules/umd-augmentation-2.ts b/tests/cases/conformance/externalModules/umd-augmentation-2.ts new file mode 100644 index 00000000000..2f8330e7fa2 --- /dev/null +++ b/tests/cases/conformance/externalModules/umd-augmentation-2.ts @@ -0,0 +1,39 @@ +// @module: commonjs +// @noImplicitReferences: true + +// @filename: node_modules/math2d/index.d.ts +export as namespace Math2d; + +export interface Point { + x: number; + y: number; +} + +export class Vector implements Point { + x: number; + y: number; + constructor(x: number, y: number); + + translate(dx: number, dy: number): Vector; +} + +export function getLength(p: Vector): number; + +// @filename: math2d-augment.d.ts +import * as Math2d from 'math2d'; +// Augment the module +declare module 'math2d' { + // Add a method to the class + interface Vector { + reverse(): Math2d.Point; + } +} + +// @filename: a.ts +/// +/// +let v = new Math2d.Vector(3, 2); +let magnitude = Math2d.getLength(v); +let p: Math2d.Point = v.translate(5, 5); +p = v.reverse(); +var t = p.x; diff --git a/tests/cases/conformance/externalModules/umd-augmentation-3.ts b/tests/cases/conformance/externalModules/umd-augmentation-3.ts new file mode 100644 index 00000000000..1524d7128de --- /dev/null +++ b/tests/cases/conformance/externalModules/umd-augmentation-3.ts @@ -0,0 +1,45 @@ +// @module: commonjs +// @noImplicitReferences: true + +// @filename: node_modules/math2d/index.d.ts +export as namespace Math2d; + +export = M2D; + +declare namespace M2D { + interface Point { + x: number; + y: number; + } + + class Vector implements Point { + x: number; + y: number; + constructor(x: number, y: number); + + translate(dx: number, dy: number): Vector; + } + + function getLength(p: Vector): number; + +} + + +// @filename: math2d-augment.d.ts +import * as Math2d from 'math2d'; +// Augment the module +declare module 'math2d' { + // Add a method to the class + interface Vector { + reverse(): Math2d.Point; + } +} + +// @filename: b.ts +/// +import * as m from 'math2d'; +let v = new m.Vector(3, 2); +let magnitude = m.getLength(v); +let p: m.Point = v.translate(5, 5); +p = v.reverse(); +var t = p.x; diff --git a/tests/cases/conformance/externalModules/umd-augmentation-4.ts b/tests/cases/conformance/externalModules/umd-augmentation-4.ts new file mode 100644 index 00000000000..729465504c1 --- /dev/null +++ b/tests/cases/conformance/externalModules/umd-augmentation-4.ts @@ -0,0 +1,45 @@ +// @module: commonjs +// @noImplicitReferences: true + +// @filename: node_modules/math2d/index.d.ts +export as namespace Math2d; + +export = M2D; + +declare namespace M2D { + interface Point { + x: number; + y: number; + } + + class Vector implements Point { + x: number; + y: number; + constructor(x: number, y: number); + + translate(dx: number, dy: number): Vector; + } + + function getLength(p: Vector): number; + +} + + +// @filename: math2d-augment.d.ts +import * as Math2d from 'math2d'; +// Augment the module +declare module 'math2d' { + // Add a method to the class + interface Vector { + reverse(): Math2d.Point; + } +} + +// @filename: a.ts +/// +/// +let v = new Math2d.Vector(3, 2); +let magnitude = Math2d.getLength(v); +let p: Math2d.Point = v.translate(5, 5); +p = v.reverse(); +var t = p.x; diff --git a/tests/cases/conformance/externalModules/umd-errors.ts b/tests/cases/conformance/externalModules/umd-errors.ts new file mode 100644 index 00000000000..95e6cb7c7a4 --- /dev/null +++ b/tests/cases/conformance/externalModules/umd-errors.ts @@ -0,0 +1,31 @@ +// @module: commonjs + +// @filename: err1.d.ts +// Illegal, can't be in script file +export as namespace Foo; + +// @filename: err2.d.ts +// Illegal, can't be in external ambient module +declare module "Foo" { + export as namespace Bar; +} + +// @filename: err3.d.ts +// Illegal, can't have modifiers +export var p; +static export as namespace oo1; +declare export as namespace oo2; +public export as namespace oo3; +const export as namespace oo4; + +// @filename: err4.d.ts +// Illegal, must be at top-level +export namespace B { + export as namespace C1; +} + +// @filename: err5.ts +// Illegal, may not appear in implementation files +export var v; +export as namespace C2; + diff --git a/tests/cases/conformance/externalModules/umd1.ts b/tests/cases/conformance/externalModules/umd1.ts new file mode 100644 index 00000000000..5ceb7fa59ba --- /dev/null +++ b/tests/cases/conformance/externalModules/umd1.ts @@ -0,0 +1,14 @@ +// @module: commonjs +// @noImplicitReferences: true + +// @filename: foo.d.ts +export var x: number; +export function fn(): void; +export interface Thing { n: typeof x } +export as namespace Foo; + +// @filename: a.ts +/// +Foo.fn(); +let x: Foo.Thing; +let y: number = x.n; diff --git a/tests/cases/conformance/externalModules/umd2.ts b/tests/cases/conformance/externalModules/umd2.ts new file mode 100644 index 00000000000..2fb98491ebf --- /dev/null +++ b/tests/cases/conformance/externalModules/umd2.ts @@ -0,0 +1,12 @@ +// @module: commonjs +// @noImplicitReferences: true + +// @filename: foo.d.ts +export var x: number; +export function fn(): void; +export as namespace Foo; + +// @filename: a.ts +Foo.fn(); +let x: Foo.Thing; +let y: number = x.n; diff --git a/tests/cases/conformance/externalModules/umd3.ts b/tests/cases/conformance/externalModules/umd3.ts new file mode 100644 index 00000000000..dad0dfc644d --- /dev/null +++ b/tests/cases/conformance/externalModules/umd3.ts @@ -0,0 +1,14 @@ +// @module: commonjs +// @noImplicitReferences: true + +// @filename: foo.d.ts +export var x: number; +export function fn(): void; +export interface Thing { n: typeof x } +export as namespace Foo; + +// @filename: a.ts +import * as Foo from './foo'; +Foo.fn(); +let x: Foo.Thing; +let y: number = x.n; diff --git a/tests/cases/conformance/externalModules/umd4.ts b/tests/cases/conformance/externalModules/umd4.ts new file mode 100644 index 00000000000..e927d21f1cc --- /dev/null +++ b/tests/cases/conformance/externalModules/umd4.ts @@ -0,0 +1,14 @@ +// @module: commonjs +// @noImplicitReferences: true + +// @filename: foo.d.ts +export var x: number; +export function fn(): void; +export interface Thing { n: typeof x } +export as namespace Foo; + +// @filename: a.ts +import * as Bar from './foo'; +Bar.fn(); +let x: Bar.Thing; +let y: number = x.n; diff --git a/tests/cases/conformance/externalModules/umd5.ts b/tests/cases/conformance/externalModules/umd5.ts new file mode 100644 index 00000000000..b6d949c2d0a --- /dev/null +++ b/tests/cases/conformance/externalModules/umd5.ts @@ -0,0 +1,16 @@ +// @module: commonjs +// @noImplicitReferences: true + +// @filename: foo.d.ts +export var x: number; +export function fn(): void; +export interface Thing { n: typeof x } +export as namespace Foo; + +// @filename: a.ts +import * as Bar from './foo'; +Bar.fn(); +let x: Bar.Thing; +let y: number = x.n; +// should error +let z = Foo; diff --git a/tests/cases/conformance/externalModules/umd6.ts b/tests/cases/conformance/externalModules/umd6.ts new file mode 100644 index 00000000000..2f9e49072cf --- /dev/null +++ b/tests/cases/conformance/externalModules/umd6.ts @@ -0,0 +1,13 @@ +// @module: commonjs +// @noImplicitReferences: true + +// @filename: foo.d.ts +declare namespace Thing { + export function fn(): number; +} +export = Thing; +export as namespace Foo; + +// @filename: a.ts +/// +let y: number = Foo.fn(); diff --git a/tests/cases/conformance/externalModules/umd7.ts b/tests/cases/conformance/externalModules/umd7.ts new file mode 100644 index 00000000000..9b9a9959efc --- /dev/null +++ b/tests/cases/conformance/externalModules/umd7.ts @@ -0,0 +1,11 @@ +// @module: commonjs +// @noImplicitReferences: true + +// @filename: foo.d.ts +declare function Thing(): number; +export = Thing; +export as namespace Foo; + +// @filename: a.ts +/// +let y: number = Foo(); diff --git a/tests/cases/conformance/externalModules/umd8.ts b/tests/cases/conformance/externalModules/umd8.ts new file mode 100644 index 00000000000..caab734f5e0 --- /dev/null +++ b/tests/cases/conformance/externalModules/umd8.ts @@ -0,0 +1,15 @@ +// @module: commonjs +// @noImplicitReferences: true + +// @filename: foo.d.ts +declare class Thing { + foo(): number; +} +export = Thing; +export as namespace Foo; + +// @filename: a.ts +/// +let y: Foo; +y.foo(); + diff --git a/tests/cases/conformance/jsx/jsxParsingError2.tsx b/tests/cases/conformance/jsx/jsxParsingError2.tsx new file mode 100644 index 00000000000..241978106ae --- /dev/null +++ b/tests/cases/conformance/jsx/jsxParsingError2.tsx @@ -0,0 +1,28 @@ +//@jsx: preserve + +//@filename: file.tsx +declare module JSX { + interface Element { } + interface IntrinsicElements { + [s: string]: any; + } +} + +// @filename: Error1.tsx +// Issue error about missing span closing tag, not missing div closing tag +let x1 =
; + +// @filename: Error2.tsx +let x2 =
; + + +// @filename: Error3.tsx +let x3 =
; + + +// @filename: Error4.tsx +let x4 =
; + +// @filename: Error5.tsx +let x5 =
+ diff --git a/tests/cases/conformance/jsx/tsxAttributeResolution12.tsx b/tests/cases/conformance/jsx/tsxAttributeResolution12.tsx new file mode 100644 index 00000000000..a9be0aad7b9 --- /dev/null +++ b/tests/cases/conformance/jsx/tsxAttributeResolution12.tsx @@ -0,0 +1,46 @@ +//@jsx: preserve + +//@filename: react.d.ts +declare module JSX { + interface Element { } + interface IntrinsicElements { + } + interface ElementAttributesProperty { + props; + } + interface IntrinsicAttributes { + ref?: string; + } +} + +//@filename: file.tsx + +declare class Component { + constructor(props?: P, context?: any); + setState(f: (prevState: S, props: P) => S, callback?: () => any): void; + setState(state: S, callback?: () => any): void; + forceUpdate(callBack?: () => any): void; + render(): JSX.Element; + props: P; + state: S; + context: {}; +} + + +interface ComponentClass

{ + new (props?: P, context?: any): Component; +} + +declare module TestMod { + interface TestClass extends ComponentClass<{reqd: any}> { + } + var Test: TestClass; +} + +// Errors correctly +const T = TestMod.Test; +var t1 = ; + +// Should error +var t2 = ; + diff --git a/tests/cases/conformance/jsx/tsxAttributeResolution13.tsx b/tests/cases/conformance/jsx/tsxAttributeResolution13.tsx new file mode 100644 index 00000000000..1b5937a7db2 --- /dev/null +++ b/tests/cases/conformance/jsx/tsxAttributeResolution13.tsx @@ -0,0 +1,5 @@ +//@jsx: preserve + +//@filename: test.tsx +function Test() { } + diff --git a/tests/cases/conformance/jsx/tsxElementResolution9.tsx b/tests/cases/conformance/jsx/tsxElementResolution9.tsx index 7165f8277b3..4854484a225 100644 --- a/tests/cases/conformance/jsx/tsxElementResolution9.tsx +++ b/tests/cases/conformance/jsx/tsxElementResolution9.tsx @@ -1,7 +1,7 @@ //@filename: file.tsx //@jsx: preserve declare module JSX { - interface Element { } + interface Element { something; } interface IntrinsicElements { } } diff --git a/tests/cases/conformance/jsx/tsxReactEmitNesting.tsx b/tests/cases/conformance/jsx/tsxReactEmitNesting.tsx new file mode 100644 index 00000000000..6c56ed781a6 --- /dev/null +++ b/tests/cases/conformance/jsx/tsxReactEmitNesting.tsx @@ -0,0 +1,37 @@ +//@filename: file.tsx +//@jsx: react +//@reactNamespace: vdom + +declare var vdom: any; +declare var ctrl: any; +declare var model: any; + +// A simple render function with nesting and control statements +let render = (ctrl, model) => +

+
+

todos <x>

+ +
+
+ +
    + {model.filteredTodos.map((todo) => +
  • +
    + {(!todo.editable) ? + + : null + } + + +
    +
    +
    +
    +
  • + )} +
+
+
+ diff --git a/tests/cases/conformance/jsx/tsxStatelessFunctionComponents3.tsx b/tests/cases/conformance/jsx/tsxStatelessFunctionComponents3.tsx new file mode 100644 index 00000000000..48ce5fb5efb --- /dev/null +++ b/tests/cases/conformance/jsx/tsxStatelessFunctionComponents3.tsx @@ -0,0 +1,23 @@ +// @filename: file.tsx +// @jsx: preserve +// @module: amd +// @noLib: true +// @libFiles: react.d.ts,lib.d.ts + +import React = require('react'); + +const Foo = (props: any) =>
; +// Should be OK +const foo = ; + + +// Should be OK +var MainMenu: React.StatelessComponent<{}> = (props) => (
+

Main Menu

+
); + +var App: React.StatelessComponent<{ children }> = ({children}) => ( +
+ +
+); \ No newline at end of file diff --git a/tests/cases/conformance/jsx/tsxUnionTypeComponent1.tsx b/tests/cases/conformance/jsx/tsxUnionTypeComponent1.tsx new file mode 100644 index 00000000000..b9e50357185 --- /dev/null +++ b/tests/cases/conformance/jsx/tsxUnionTypeComponent1.tsx @@ -0,0 +1,27 @@ +// @filename: file.tsx +// @jsx: react +// @noLib: true +// @libFiles: react.d.ts,lib.d.ts + +import React = require('react'); + +interface ComponentProps { + AnyComponent: React.StatelessComponent | React.ComponentClass; +} + +class MyComponent extends React.Component { + render() { + const { AnyComponent } = this.props; + return (); + } +} + +// Stateless Component As Props + }/> + +// Component Class as Props +class MyButtonComponent extends React.Component<{},{}> { +} + + + diff --git a/tests/cases/conformance/jsx/tsxUnionTypeComponent2.tsx b/tests/cases/conformance/jsx/tsxUnionTypeComponent2.tsx new file mode 100644 index 00000000000..39807219661 --- /dev/null +++ b/tests/cases/conformance/jsx/tsxUnionTypeComponent2.tsx @@ -0,0 +1,14 @@ +// @filename: file.tsx +// @jsx: react +// @noLib: true +// @libFiles: react.d.ts,lib.d.ts + +import React = require('react'); + +type Invalid1 = React.ComponentClass | string; + +const X: Invalid1 = "Should fail to construct"; + +; + + diff --git a/tests/cases/conformance/references/library-reference-1.ts b/tests/cases/conformance/references/library-reference-1.ts new file mode 100644 index 00000000000..ca25441521f --- /dev/null +++ b/tests/cases/conformance/references/library-reference-1.ts @@ -0,0 +1,13 @@ +// @noImplicitReferences: true +// @traceResolution: true +// @typesRoot: / + +// We can find typings in the ./types folder + +// @filename: /types/jquery/index.d.ts +declare var $: { foo(): void }; + + +// @filename: /consumer.ts +/// +$.foo(); diff --git a/tests/cases/conformance/references/library-reference-10.ts b/tests/cases/conformance/references/library-reference-10.ts new file mode 100644 index 00000000000..11e065b0a7d --- /dev/null +++ b/tests/cases/conformance/references/library-reference-10.ts @@ -0,0 +1,18 @@ +// @noImplicitReferences: true +// @traceResolution: true +// @typesRoot: / + +// package.json in a primary reference can refer to another file + +// @filename: /types/jquery/package.json +{ + "typings": "jquery.d.ts" +} + +// @filename: /types/jquery/jquery.d.ts +declare var $: { foo(): void }; + + +// @filename: /consumer.ts +/// +$.foo(); diff --git a/tests/cases/conformance/references/library-reference-11.ts b/tests/cases/conformance/references/library-reference-11.ts new file mode 100644 index 00000000000..39c8af56543 --- /dev/null +++ b/tests/cases/conformance/references/library-reference-11.ts @@ -0,0 +1,17 @@ +// @noImplicitReferences: true +// @traceResolution: true + +// package.json in a secondary reference can refer to another file + +// @filename: /a/node_modules/jquery/package.json +{ + "typings": "jquery.d.ts" +} + +// @filename: /a/node_modules/jquery/jquery.d.ts +declare var $: { foo(): void }; + + +// @filename: /a/b/consumer.ts +/// +$.foo(); diff --git a/tests/cases/conformance/references/library-reference-12.ts b/tests/cases/conformance/references/library-reference-12.ts new file mode 100644 index 00000000000..c61d6d916ff --- /dev/null +++ b/tests/cases/conformance/references/library-reference-12.ts @@ -0,0 +1,17 @@ +// @noImplicitReferences: true +// @traceResolution: true + +// package.json in a secondary reference can refer to another file + +// @filename: /a/node_modules/jquery/package.json +{ + "types": "dist/jquery.d.ts" +} + +// @filename: /a/node_modules/jquery/dist/jquery.d.ts +declare var $: { foo(): void }; + + +// @filename: /a/b/consumer.ts +/// +$.foo(); diff --git a/tests/cases/conformance/references/library-reference-13.ts b/tests/cases/conformance/references/library-reference-13.ts new file mode 100644 index 00000000000..a96437f9b2c --- /dev/null +++ b/tests/cases/conformance/references/library-reference-13.ts @@ -0,0 +1,18 @@ +// @noImplicitReferences: true +// @traceResolution: true + +// load type declarations from types section of tsconfig + +// @filename: /a/tsconfig.json +{ + "compilerOptions": { + "types": [ "jquery" ] + } +} + +// @filename: /a/types/jquery/index.d.ts +declare var $: { foo(): void }; + + +// @filename: /a/b/consumer.ts +$.foo(); diff --git a/tests/cases/conformance/references/library-reference-14.ts b/tests/cases/conformance/references/library-reference-14.ts new file mode 100644 index 00000000000..53bca2ab40d --- /dev/null +++ b/tests/cases/conformance/references/library-reference-14.ts @@ -0,0 +1,11 @@ +// @noImplicitReferences: true +// @traceResolution: true +// @types: jquery +// @typesRoot: /a + +// @filename: /a/types/jquery/index.d.ts +declare var $: { foo(): void }; + + +// @filename: /a/b/consumer.ts +$.foo(); diff --git a/tests/cases/conformance/references/library-reference-15.ts b/tests/cases/conformance/references/library-reference-15.ts new file mode 100644 index 00000000000..92c96e74c97 --- /dev/null +++ b/tests/cases/conformance/references/library-reference-15.ts @@ -0,0 +1,10 @@ +// @noImplicitReferences: true +// @traceResolution: true +// @types: jquery + +// @filename: /a/types/jquery/index.d.ts +declare var $: { foo(): void }; + + +// @filename: /a/b/consumer.ts +$.foo(); diff --git a/tests/cases/conformance/references/library-reference-2.ts b/tests/cases/conformance/references/library-reference-2.ts new file mode 100644 index 00000000000..d8975664428 --- /dev/null +++ b/tests/cases/conformance/references/library-reference-2.ts @@ -0,0 +1,18 @@ +// @noImplicitReferences: true +// @traceResolution: true +// @typesRoot: / + +// package.json in a primary reference can refer to another file + +// @filename: /types/jquery/package.json +{ + "types": "jquery.d.ts" +} + +// @filename: /types/jquery/jquery.d.ts +declare var $: { foo(): void }; + + +// @filename: /consumer.ts +/// +$.foo(); diff --git a/tests/cases/conformance/references/library-reference-3.ts b/tests/cases/conformance/references/library-reference-3.ts new file mode 100644 index 00000000000..1af6df89d19 --- /dev/null +++ b/tests/cases/conformance/references/library-reference-3.ts @@ -0,0 +1,12 @@ +// @noImplicitReferences: true +// @traceResolution: true +// @typesRoot: /src + +// Secondary references are possible + +// @filename: /src/node_modules/jquery/index.d.ts +declare var $: { foo(): void }; + +// @filename: /src/consumer.ts +/// +$.foo(); diff --git a/tests/cases/conformance/references/library-reference-4.ts b/tests/cases/conformance/references/library-reference-4.ts new file mode 100644 index 00000000000..92f1b4008be --- /dev/null +++ b/tests/cases/conformance/references/library-reference-4.ts @@ -0,0 +1,23 @@ +// @noImplicitReferences: true +// @traceResolution: true +// @typesRoot: /src + +// Secondary references may be duplicated if they agree in content + +// @filename: /node_modules/foo/index.d.ts +/// +declare var foo: any; + +// @filename: /node_modules/foo/node_modules/alpha/index.d.ts +declare var alpha: any; + +// @filename: /node_modules/bar/index.d.ts +/// +declare var bar: any; + +// @filename: /node_modules/bar/node_modules/alpha/index.d.ts +declare var alpha: any; + +// @filename: /src/root.ts +/// +/// diff --git a/tests/cases/conformance/references/library-reference-5.ts b/tests/cases/conformance/references/library-reference-5.ts new file mode 100644 index 00000000000..4660da00a2a --- /dev/null +++ b/tests/cases/conformance/references/library-reference-5.ts @@ -0,0 +1,22 @@ +// @noImplicitReferences: true +// @traceResolution: true + +// Secondary references may not be duplicated if they disagree in content + +// @filename: /node_modules/foo/index.d.ts +/// +declare var foo: any; + +// @filename: /node_modules/foo/node_modules/alpha/index.d.ts +declare var alpha: any; + +// @filename: /node_modules/bar/index.d.ts +/// +declare var bar: any; + +// @filename: /node_modules/bar/node_modules/alpha/index.d.ts +declare var alpha: {}; + +// @filename: /src/root.ts +/// +/// diff --git a/tests/cases/conformance/references/library-reference-6.ts b/tests/cases/conformance/references/library-reference-6.ts new file mode 100644 index 00000000000..a746262dd73 --- /dev/null +++ b/tests/cases/conformance/references/library-reference-6.ts @@ -0,0 +1,15 @@ +// @noImplicitReferences: true +// @traceResolution: true + +// The primary lookup folder is relative to tsconfig.json, if present + +// @filename: /types/alpha/index.d.ts +declare var alpha: { a: string }; + +// @filename: /src/foo.ts +/// +var x: string = alpha.a; + +// @filename: /tsconfig.json +{ +} diff --git a/tests/cases/conformance/references/library-reference-7.ts b/tests/cases/conformance/references/library-reference-7.ts new file mode 100644 index 00000000000..e938aef7d3a --- /dev/null +++ b/tests/cases/conformance/references/library-reference-7.ts @@ -0,0 +1,11 @@ +// @noImplicitReferences: true +// @traceResolution: true + +// Secondary references are possible + +// @filename: /src/node_modules/jquery/index.d.ts +declare var $: { foo(): void }; + +// @filename: /src/consumer.ts +/// +$.foo(); diff --git a/tests/cases/conformance/references/library-reference-8.ts b/tests/cases/conformance/references/library-reference-8.ts new file mode 100644 index 00000000000..9de93776989 --- /dev/null +++ b/tests/cases/conformance/references/library-reference-8.ts @@ -0,0 +1,19 @@ +// @noImplicitReferences: true +// @traceResolution: true +// @typesRoot: / + +// Don't crash in circular library reference situations + +// @filename: /types/alpha/index.d.ts +/// +declare var alpha: { a: string }; + +// @filename: /types/beta/index.d.ts +/// +declare var beta: { b: string }; + +// @filename: /foo.ts +/// +/// +var x: string = alpha.a + beta.b; + diff --git a/tests/cases/conformance/references/library-reference-9.ts b/tests/cases/conformance/references/library-reference-9.ts new file mode 100644 index 00000000000..a187d3c23b9 --- /dev/null +++ b/tests/cases/conformance/references/library-reference-9.ts @@ -0,0 +1,20 @@ +// @noImplicitReferences: true +// @traceResolution: true + +// Use types search path + +// @filename: /share/typelib/alpha/index.d.ts +declare var alpha: { a: string }; + +// @filename: /base/src/foo.ts +/// +var x: string = alpha.a; + +// @filename: /tsconfig.json +{ + "compilerOptions": { + "typesSearchPaths": [ + "./share/typelib" + ] + } +} diff --git a/tests/cases/conformance/salsa/exportDefaultInJsFile01.ts b/tests/cases/conformance/salsa/exportDefaultInJsFile01.ts new file mode 100644 index 00000000000..bf2f3a4e99b --- /dev/null +++ b/tests/cases/conformance/salsa/exportDefaultInJsFile01.ts @@ -0,0 +1,6 @@ +// @allowJS: true +// @target: es3 +// @module: commonjs + +// @filename: myFile01.js +export default "hello"; \ No newline at end of file diff --git a/tests/cases/conformance/salsa/exportDefaultInJsFile02.ts b/tests/cases/conformance/salsa/exportDefaultInJsFile02.ts new file mode 100644 index 00000000000..1075b135f17 --- /dev/null +++ b/tests/cases/conformance/salsa/exportDefaultInJsFile02.ts @@ -0,0 +1,6 @@ +// @allowJS: true +// @target: es2015 +// @module: es2015 + +// @filename: myFile02.js +export default "hello"; \ No newline at end of file diff --git a/tests/cases/conformance/salsa/malformedTags.ts b/tests/cases/conformance/salsa/malformedTags.ts new file mode 100644 index 00000000000..1128ce73f15 --- /dev/null +++ b/tests/cases/conformance/salsa/malformedTags.ts @@ -0,0 +1,10 @@ +// @allowJS: true +// @suppressOutputPathCheck: true + +// @filename: myFile02.js +/** + * Checks if `value` is classified as an `Array` object. + * + * @type Function + */ +var isArray = Array.isArray; diff --git a/tests/cases/conformance/statements/for-inStatements/for-inStatementsArray.ts b/tests/cases/conformance/statements/for-inStatements/for-inStatementsArray.ts new file mode 100644 index 00000000000..6acf8d4b355 --- /dev/null +++ b/tests/cases/conformance/statements/for-inStatements/for-inStatementsArray.ts @@ -0,0 +1,38 @@ +let a: Date[]; +let b: boolean[]; + +for (let x in a) { + let a1 = a[x]; + let a2 = a[(x)]; + let a3 = a[+x]; + let b1 = b[x]; + let b2 = b[(x)]; + let b3 = b[+x]; +} + +for (let x in a) { + for (let y in a) { + for (let z in a) { + let a1 = a[x]; + let a2 = a[y]; + let a3 = a[z]; + } + } +} + +let i: string; +let j: string; +for (i in a) { + for (j in b) { + let a1 = a[i]; + let a2 = a[j]; + } +} + +var s: string; +for (var s in a) { + let a1 = a[s]; +} +for (s in a) { + let a1 = a[s]; +} diff --git a/tests/cases/conformance/statements/for-inStatements/for-inStatementsArrayErrors.ts b/tests/cases/conformance/statements/for-inStatements/for-inStatementsArrayErrors.ts new file mode 100644 index 00000000000..c87ab6cea03 --- /dev/null +++ b/tests/cases/conformance/statements/for-inStatements/for-inStatementsArrayErrors.ts @@ -0,0 +1,19 @@ +// @noImplicitAny: true + +let a: Date[]; + +for (let x in a) { + let a1 = a[x + 1]; + let a2 = a[x - 1]; + if (x === 1) { + } + let a3 = x.unknownProperty; +} + +var i: number; +for (var i in a ) { +} + +var j: any; +for (var j in a ) { +} diff --git a/tests/cases/conformance/types/contextualTypes/commaOperator/contextuallyTypeCommaOperator01.ts b/tests/cases/conformance/types/contextualTypes/commaOperator/contextuallyTypeCommaOperator01.ts new file mode 100644 index 00000000000..167369a020b --- /dev/null +++ b/tests/cases/conformance/types/contextualTypes/commaOperator/contextuallyTypeCommaOperator01.ts @@ -0,0 +1,5 @@ +// @noImplicitAny: true + +let x: (a: string) => string; + +x = (100, a => a); \ No newline at end of file diff --git a/tests/cases/conformance/types/contextualTypes/commaOperator/contextuallyTypeCommaOperator02.ts b/tests/cases/conformance/types/contextualTypes/commaOperator/contextuallyTypeCommaOperator02.ts new file mode 100644 index 00000000000..11e743b583e --- /dev/null +++ b/tests/cases/conformance/types/contextualTypes/commaOperator/contextuallyTypeCommaOperator02.ts @@ -0,0 +1,8 @@ +// @noImplicitAny: true + +let x: (a: string) => string; + +x = (100, a => { + const b: number = a; + return b; +}); \ No newline at end of file diff --git a/tests/cases/conformance/types/contextualTypes/commaOperator/contextuallyTypeCommaOperator03.ts b/tests/cases/conformance/types/contextualTypes/commaOperator/contextuallyTypeCommaOperator03.ts new file mode 100644 index 00000000000..321eb99d153 --- /dev/null +++ b/tests/cases/conformance/types/contextualTypes/commaOperator/contextuallyTypeCommaOperator03.ts @@ -0,0 +1,5 @@ +// @noImplicitAny: true + +let x: (a: string) => string; + +x = (a => a, b => b); \ No newline at end of file diff --git a/tests/cases/conformance/types/contextualTypes/jsxAttributes/contextuallyTypedStringLiteralsInJsxAttributes01.tsx b/tests/cases/conformance/types/contextualTypes/jsxAttributes/contextuallyTypedStringLiteralsInJsxAttributes01.tsx new file mode 100644 index 00000000000..2235961086f --- /dev/null +++ b/tests/cases/conformance/types/contextualTypes/jsxAttributes/contextuallyTypedStringLiteralsInJsxAttributes01.tsx @@ -0,0 +1,19 @@ +// @jsx: preserve +// @declaration: true + +namespace JSX { + export interface IntrinsicElements { + span: {}; + } + export interface Element { + something?: any; + } +} + +const FooComponent = (props: { foo: "A" | "B" | "C" }) => {props.foo}; + +; +; + +; +; \ No newline at end of file diff --git a/tests/cases/conformance/types/contextualTypes/logicalAnd/contextuallyTypeLogicalAnd01.ts b/tests/cases/conformance/types/contextualTypes/logicalAnd/contextuallyTypeLogicalAnd01.ts new file mode 100644 index 00000000000..30e46429fa1 --- /dev/null +++ b/tests/cases/conformance/types/contextualTypes/logicalAnd/contextuallyTypeLogicalAnd01.ts @@ -0,0 +1,6 @@ +// @noImplicitAny: true + +let x: (a: string) => string; +let y = true; + +x = y && (a => a); \ No newline at end of file diff --git a/tests/cases/conformance/types/contextualTypes/logicalAnd/contextuallyTypeLogicalAnd02.ts b/tests/cases/conformance/types/contextualTypes/logicalAnd/contextuallyTypeLogicalAnd02.ts new file mode 100644 index 00000000000..26e58ae49ec --- /dev/null +++ b/tests/cases/conformance/types/contextualTypes/logicalAnd/contextuallyTypeLogicalAnd02.ts @@ -0,0 +1,9 @@ +// @noImplicitAny: true + +let x: (a: string) => string; +let y = true; + +x = y && (a => { + const b: number = a; + return b; +}); \ No newline at end of file diff --git a/tests/cases/conformance/types/contextualTypes/logicalAnd/contextuallyTypeLogicalAnd03.ts b/tests/cases/conformance/types/contextualTypes/logicalAnd/contextuallyTypeLogicalAnd03.ts new file mode 100644 index 00000000000..1fba96c048a --- /dev/null +++ b/tests/cases/conformance/types/contextualTypes/logicalAnd/contextuallyTypeLogicalAnd03.ts @@ -0,0 +1,6 @@ +// @noImplicitAny: true + +let x: (a: string) => string; +let y = true; + +x = (a => a) && (b => b); \ No newline at end of file diff --git a/tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTypedBindingInitializer.ts b/tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTypedBindingInitializer.ts new file mode 100644 index 00000000000..c02aa5b63e8 --- /dev/null +++ b/tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTypedBindingInitializer.ts @@ -0,0 +1,29 @@ +// @noImplicitAny: true +interface Show { + show: (x: number) => string; +} +function f({ show = v => v.toString() }: Show) {} +function f2({ "show": showRename = v => v.toString() }: Show) {} +function f3({ ["show"]: showRename = v => v.toString() }: Show) {} + +interface Nested { + nested: Show +} +function ff({ nested = { show: v => v.toString() } }: Nested) {} + +interface Tuples { + prop: [string, number]; +} +function g({ prop = ["hello", 1234] }: Tuples) {} + +interface StringUnion { + prop: "foo" | "bar"; +} +function h({ prop = "foo" }: StringUnion) {} + +interface StringIdentity { + stringIdentity(s: string): string; +} +let { stringIdentity: id = arg => arg }: StringIdentity = { stringIdentity: x => x}; + + diff --git a/tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTypedBindingInitializerNegative.ts b/tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTypedBindingInitializerNegative.ts new file mode 100644 index 00000000000..fb71da7b655 --- /dev/null +++ b/tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTypedBindingInitializerNegative.ts @@ -0,0 +1,27 @@ +// @noImplicitAny: true +interface Show { + show: (x: number) => string; +} +function f({ show: showRename = v => v }: Show) {} +function f2({ "show": showRename = v => v }: Show) {} +function f3({ ["show"]: showRename = v => v }: Show) {} + +interface Nested { + nested: Show +} +function ff({ nested: nestedRename = { show: v => v } }: Nested) {} + +interface StringIdentity { + stringIdentity(s: string): string; +} +let { stringIdentity: id = arg => arg.length }: StringIdentity = { stringIdentity: x => x}; + +interface Tuples { + prop: [string, number]; +} +function g({ prop = [101, 1234] }: Tuples) {} + +interface StringUnion { + prop: "foo" | "bar"; +} +function h({ prop = "baz" }: StringUnion) {} diff --git a/tests/cases/conformance/types/intersection/operatorsAndIntersectionTypes.ts b/tests/cases/conformance/types/intersection/operatorsAndIntersectionTypes.ts new file mode 100644 index 00000000000..5689d221840 --- /dev/null +++ b/tests/cases/conformance/types/intersection/operatorsAndIntersectionTypes.ts @@ -0,0 +1,30 @@ +type Guid = string & { $Guid }; // Tagged string type +type SerialNo = number & { $SerialNo }; // Tagged number type + +function createGuid() { + return "21EC2020-3AEA-4069-A2DD-08002B30309D" as Guid; +} + +function createSerialNo() { + return 12345 as SerialNo; +} + +let map1: { [x: string]: number } = {}; +let guid = createGuid(); +map1[guid] = 123; // Can with tagged string + +let map2: { [x: number]: string } = {}; +let serialNo = createSerialNo(); +map2[serialNo] = "hello"; // Can index with tagged number + +const s1 = "{" + guid + "}"; +const s2 = guid.toLowerCase(); +const s3 = guid + guid; +const s4 = guid + serialNo; +const s5 = serialNo.toPrecision(0); +const n1 = serialNo * 3; +const n2 = serialNo + serialNo; +const b1 = guid === ""; +const b2 = guid === guid; +const b3 = serialNo === 0; +const b4 = serialNo === serialNo; diff --git a/tests/cases/conformance/types/members/typesWithPrivateConstructor.ts b/tests/cases/conformance/types/members/typesWithPrivateConstructor.ts index 4fb24ca58e4..321864e1751 100644 --- a/tests/cases/conformance/types/members/typesWithPrivateConstructor.ts +++ b/tests/cases/conformance/types/members/typesWithPrivateConstructor.ts @@ -1,10 +1,10 @@ -// private constructors are not allowed +// @declaration: true class C { private constructor() { } } -var c = new C(); +var c = new C(); // error C is private var r: () => void = c.constructor; class C2 { @@ -12,5 +12,5 @@ class C2 { private constructor(x: any) { } } -var c2 = new C2(); +var c2 = new C2(); // error C2 is private var r2: (x: number) => void = c2.constructor; \ No newline at end of file diff --git a/tests/cases/conformance/types/members/typesWithProtectedConstructor.ts b/tests/cases/conformance/types/members/typesWithProtectedConstructor.ts new file mode 100644 index 00000000000..e7f6adc38a8 --- /dev/null +++ b/tests/cases/conformance/types/members/typesWithProtectedConstructor.ts @@ -0,0 +1,16 @@ +// @declaration: true + +class C { + protected constructor() { } +} + +var c = new C(); // error C is protected +var r: () => void = c.constructor; + +class C2 { + protected constructor(x: number); + protected constructor(x: any) { } +} + +var c2 = new C2(); // error C2 is protected +var r2: (x: number) => void = c2.constructor; \ No newline at end of file diff --git a/tests/cases/conformance/types/namedTypes/optionalMethods.ts b/tests/cases/conformance/types/namedTypes/optionalMethods.ts new file mode 100644 index 00000000000..932521425f9 --- /dev/null +++ b/tests/cases/conformance/types/namedTypes/optionalMethods.ts @@ -0,0 +1,58 @@ +// @strictNullChecks: true +// @declaration: true + +interface Foo { + a: number; + b?: number; + f(): number; + g?(): number; +} + +function test1(x: Foo) { + x.a; + x.b; + x.f; + x.g; + let f1 = x.f(); + let g1 = x.g && x.g(); + let g2 = x.g ? x.g() : 0; +} + +class Bar { + a: number; + b?: number; + c? = 2; + constructor(public d?: number, public e = 10) {} + f() { + return 1; + } + g?(): number; // Body of optional method can be omitted + h?() { + return 2; + } +} + +function test2(x: Bar) { + x.a; + x.b; + x.c; + x.d; + x.e; + x.f; + x.g; + let f1 = x.f(); + let g1 = x.g && x.g(); + let g2 = x.g ? x.g() : 0; + let h1 = x.h && x.h(); + let h2 = x.h ? x.h() : 0; +} + +class Base { + a?: number; + f?(): number; +} + +class Derived extends Base { + a = 1; + f(): number { return 1; } +} diff --git a/tests/cases/conformance/types/never/neverType.ts b/tests/cases/conformance/types/never/neverType.ts new file mode 100644 index 00000000000..d37528a022d --- /dev/null +++ b/tests/cases/conformance/types/never/neverType.ts @@ -0,0 +1,68 @@ +// @strictNullChecks: true +// @declaration: true + +function error(message: string) { + throw new Error(message); +} + +function fail() { + return error("Something failed"); +} + +function infiniteLoop() { + while (true) { + } +} + +function move1(direction: "up" | "down") { + switch (direction) { + case "up": + return 1; + case "down": + return -1; + } + return error("Should never get here"); +} + +function move2(direction: "up" | "down") { + return direction === "up" ? 1 : + direction === "down" ? -1 : + error("Should never get here"); +} + +function check(x: T | undefined) { + return x || error("Undefined value"); +} + +function f1(x: string | number) { + if (typeof x === "boolean") { + x; // never + } +} + +function f2(x: string | number) { + while (true) { + if (typeof x === "boolean") { + return x; // never + } + } +} + +function failOrThrow(shouldFail: boolean) { + if (shouldFail) { + return fail(); + } + throw new Error(); +} + +function test(cb: () => string) { + let s = cb(); + return s; +} + +let errorCallback = () => error("Error callback"); + +test(() => "hello"); +test(() => fail()); +test(() => { throw new Error(); }) +test(errorCallback); diff --git a/tests/cases/conformance/types/never/neverTypeErrors1.ts b/tests/cases/conformance/types/never/neverTypeErrors1.ts new file mode 100644 index 00000000000..8d78e863098 --- /dev/null +++ b/tests/cases/conformance/types/never/neverTypeErrors1.ts @@ -0,0 +1,20 @@ +function f1() { + let x: never; + x = 1; + x = "abc"; + x = false; + x = undefined; + x = null; + x = {}; +} + +function f2(): never { + return; +} + +function f3(): never { + return 1; +} + +function f4(): never { +} \ No newline at end of file diff --git a/tests/cases/conformance/types/never/neverTypeErrors2.ts b/tests/cases/conformance/types/never/neverTypeErrors2.ts new file mode 100644 index 00000000000..635d1c9c6ad --- /dev/null +++ b/tests/cases/conformance/types/never/neverTypeErrors2.ts @@ -0,0 +1,22 @@ +// @strictNullChecks: true + +function f1() { + let x: never; + x = 1; + x = "abc"; + x = false; + x = undefined; + x = null; + x = {}; +} + +function f2(): never { + return; +} + +function f3(): never { + return 1; +} + +function f4(): never { +} \ No newline at end of file diff --git a/tests/cases/conformance/types/objectTypeLiteral/callSignatures/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.ts b/tests/cases/conformance/types/objectTypeLiteral/callSignatures/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.ts index 46bb0ea2c81..01f33fbd7bb 100644 --- a/tests/cases/conformance/types/objectTypeLiteral/callSignatures/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.ts +++ b/tests/cases/conformance/types/objectTypeLiteral/callSignatures/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.ts @@ -1,5 +1,4 @@ -// Specialized signatures must be a subtype of a non-specialized signature -// All the below should be errors +// @declaration: true function foo(x: 'a'); function foo(x: number) { } diff --git a/tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties.ts b/tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties.ts index f80c3a5952d..7c05ff09e56 100644 --- a/tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties.ts +++ b/tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties.ts @@ -9,7 +9,7 @@ interface I { } class C { - x?: number; // error + x?: number; // ok } interface I2 { @@ -17,7 +17,7 @@ interface I2 { } class C2 { - x?: T; // error + x?: T; // ok } var b = { diff --git a/tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes01.ts b/tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes01.ts index b8ed1b47dd4..05f8c511118 100644 --- a/tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes01.ts +++ b/tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes01.ts @@ -2,8 +2,8 @@ type T = "foo" | "bar" | "baz"; -var x: "foo" | "bar" | "baz" = "foo"; -var y: T = "bar"; +var x: "foo" | "bar" | "baz" = undefined; +var y: T = undefined; if (x === "foo") { let a = x; diff --git a/tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes02.ts b/tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes02.ts index 2cc63ab4460..ee61efc37ca 100644 --- a/tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes02.ts +++ b/tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes02.ts @@ -2,8 +2,8 @@ type T = string | "foo" | "bar" | "baz"; -var x: "foo" | "bar" | "baz" | string = "foo"; -var y: T = "bar"; +var x: "foo" | "bar" | "baz" | string = undefined; +var y: T = undefined; if (x === "foo") { let a = x; diff --git a/tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes03.ts b/tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes03.ts index d5c6a38af79..96a4f035c4b 100644 --- a/tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes03.ts +++ b/tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes03.ts @@ -3,7 +3,7 @@ type T = number | "foo" | "bar"; var x: "foo" | "bar" | number; -var y: T = "bar"; +var y: T = undefined; if (x === "foo") { let a = x; diff --git a/tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes04.ts b/tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes04.ts index e9d062b0e5c..9f37e272b46 100644 --- a/tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes04.ts +++ b/tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes04.ts @@ -2,8 +2,8 @@ type T = "" | "foo"; -let x: T = ""; -let y: T = "foo"; +let x: T = undefined; +let y: T = undefined; if (x === "") { let a = x; diff --git a/tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloadAssignability01.ts b/tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloadAssignability01.ts new file mode 100644 index 00000000000..fce073f16ef --- /dev/null +++ b/tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloadAssignability01.ts @@ -0,0 +1,17 @@ +// @declaration: true + +function f(x: "foo"): number; +function f(x: string): number { + return 0; +} + +function g(x: "bar"): number; +function g(x: string): number { + return 0; +} + +let a = f; +let b = g; + +a = b; +b = a; \ No newline at end of file diff --git a/tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloadAssignability02.ts b/tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloadAssignability02.ts new file mode 100644 index 00000000000..1a4f18430d5 --- /dev/null +++ b/tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloadAssignability02.ts @@ -0,0 +1,17 @@ +// @declaration: true + +function f(x: "foo"): number; +function f(x: "foo"): number { + return 0; +} + +function g(x: "bar"): number; +function g(x: "bar"): number { + return 0; +} + +let a = f; +let b = g; + +a = b; +b = a; \ No newline at end of file diff --git a/tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloadAssignability03.ts b/tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloadAssignability03.ts new file mode 100644 index 00000000000..0aacd899bcc --- /dev/null +++ b/tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloadAssignability03.ts @@ -0,0 +1,17 @@ +// @declaration: true + +function f(x: "foo"): number; +function f(x: string): number { + return 0; +} + +function g(x: "foo"): number; +function g(x: string): number { + return 0; +} + +let a = f; +let b = g; + +a = b; +b = a; \ No newline at end of file diff --git a/tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloadAssignability04.ts b/tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloadAssignability04.ts new file mode 100644 index 00000000000..eae4046286f --- /dev/null +++ b/tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloadAssignability04.ts @@ -0,0 +1,17 @@ +// @declaration: true + +function f(x: "foo"): number; +function f(x: "foo"): number { + return 0; +} + +function g(x: "foo"): number; +function g(x: "foo"): number { + return 0; +} + +let a = f; +let b = g; + +a = b; +b = a; \ No newline at end of file diff --git a/tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloadAssignability05.ts b/tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloadAssignability05.ts new file mode 100644 index 00000000000..9482ff02a1e --- /dev/null +++ b/tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloadAssignability05.ts @@ -0,0 +1,18 @@ +// @declaration: true + +function f(x: "foo"): number; +function f(x: string): number; +function f(x: string): number { + return 0; +} + +function g(x: "foo"): number; +function g(x: string): number { + return 0; +} + +let a = f; +let b = g; + +a = b; +b = a; \ No newline at end of file diff --git a/tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads05.ts b/tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads05.ts new file mode 100644 index 00000000000..182155790a6 --- /dev/null +++ b/tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads05.ts @@ -0,0 +1,13 @@ +// @declaration: true + +interface Animal { animal: {} }; +interface Dog extends Animal { dog: {} } +interface Cat extends Animal { cat: {} } +interface Moose extends Animal { moose: {} } + +function doThing(x: "dog"): Dog; +function doThing(x: "cat"): Cat; +function doThing(x: string): Animal; +function doThing(x: string, y?: string): Moose { + return undefined; +} \ No newline at end of file diff --git a/tests/cases/conformance/types/stringLiteral/stringLiteralTypesTypePredicates01.ts b/tests/cases/conformance/types/stringLiteral/stringLiteralTypesTypePredicates01.ts index a78918c8122..2199ff3a7c7 100644 --- a/tests/cases/conformance/types/stringLiteral/stringLiteralTypesTypePredicates01.ts +++ b/tests/cases/conformance/types/stringLiteral/stringLiteralTypesTypePredicates01.ts @@ -8,7 +8,7 @@ function kindIs(kind: Kind, is: Kind): boolean { return kind === is; } -var x: Kind = "A"; +var x: Kind = undefined; if (kindIs(x, "A")) { let a = x; diff --git a/tests/cases/conformance/types/thisType/looseThisTypeInFunctions.ts b/tests/cases/conformance/types/thisType/looseThisTypeInFunctions.ts new file mode 100644 index 00000000000..b70f064f43a --- /dev/null +++ b/tests/cases/conformance/types/thisType/looseThisTypeInFunctions.ts @@ -0,0 +1,47 @@ +interface I { + n: number; + explicitThis(this: this, m: number): number; +} +interface Unused { + implicitNoThis(m: number): number; +} +class C implements I { + n: number; + explicitThis(this: this, m: number): number { + return this.n + m; + } + implicitThis(m: number): number { + return this.n + m; + } + explicitVoid(this: void, m: number): number { + return m + 1; + } +} +let c = new C(); +c.explicitVoid = c.explicitThis; // error, 'void' is missing everything +let o = { + n: 101, + explicitThis: function (m: number) { + return m + this.n.length; // error, 'length' does not exist on 'number' + }, + implicitThis(m: number): number { return m; } +}; +let i: I = o; +let o2: I = { + n: 1001, + explicitThis: function (m) { + return m + this.n.length; // error, this.n: number, no member 'length' + }, +} +let x = i.explicitThis; +let n = x(12); // callee:void doesn't match this:I +let u: Unused; +let y = u.implicitNoThis; +n = y(12); // ok, callee:void matches this:any +c.explicitVoid = c.implicitThis // ok, implicitThis(this:any) +o.implicitThis = c.implicitThis; // ok, implicitThis(this:any) +o.implicitThis = c.explicitThis; // ok, implicitThis(this:any) is assignable to explicitThis(this: this) +o.implicitThis = i.explicitThis; +i.explicitThis = function(m) { + return this.n.length; // error, this.n: number +} diff --git a/tests/cases/conformance/types/thisType/thisTypeInAccessors.ts b/tests/cases/conformance/types/thisType/thisTypeInAccessors.ts new file mode 100644 index 00000000000..b0903759767 --- /dev/null +++ b/tests/cases/conformance/types/thisType/thisTypeInAccessors.ts @@ -0,0 +1,38 @@ +// @noImplicitAny: true +// @noImplicitThis: true +// @target: es5 +interface Foo { + n: number; + x: number; +} + +const explicit = { + n: 12, + get x(this: Foo): number { return this.n; }, + set x(this: Foo, n: number) { this.n = n; } +} +const copiedFromGetter = { + n: 14, + get x(this: Foo): number { return this.n; }, + set x(n) { this.n = n; } +} +const copiedFromSetter = { + n: 15, + get x() { return this.n }, + set x(this: Foo, n: number) { this.n = n; } +} +const copiedFromGetterUnannotated = { + n: 16, + get x(this: Foo) { return this.n }, + set x(this, n) { this.n = n; } +} + +class Explicit { + n = 17; + get x(this: Foo): number { return this.n; } + set x(this: Foo, n: number) { this.n = n; } +} +class Contextual { + n = 21; + get x() { return this.n } // inside a class, so already correct +} diff --git a/tests/cases/conformance/types/thisType/thisTypeInAccessorsNegative.ts b/tests/cases/conformance/types/thisType/thisTypeInAccessorsNegative.ts new file mode 100644 index 00000000000..69ff4175a92 --- /dev/null +++ b/tests/cases/conformance/types/thisType/thisTypeInAccessorsNegative.ts @@ -0,0 +1,20 @@ +// @noImplicitAny: true +// @noImplicitThis: true +// @target: es5 +interface Foo { + n: number; + x: number; +} +interface Bar { + wrong: "place" | "time" | "method" | "technique"; +} +const mismatch = { + n: 13, + get x(this: Foo) { return this.n; }, + set x(this: Bar, n) { this.wrong = "method"; } +} +const contextual: Foo = { + n: 16, + // there is no contextual this type from an Foo.x. + get x() { return this.n; } +} diff --git a/tests/cases/conformance/types/thisType/thisTypeInBasePropertyAndDerivedContainerOfBase01.ts b/tests/cases/conformance/types/thisType/thisTypeInBasePropertyAndDerivedContainerOfBase01.ts new file mode 100644 index 00000000000..6597f32adc9 --- /dev/null +++ b/tests/cases/conformance/types/thisType/thisTypeInBasePropertyAndDerivedContainerOfBase01.ts @@ -0,0 +1,13 @@ +// @declaration: true + +interface BoxOfFoo { + item: T +} + +interface Foo { + self: this; +} + +interface Bar extends Foo { + other: BoxOfFoo; +} \ No newline at end of file diff --git a/tests/cases/conformance/types/thisType/thisTypeInFunctions.ts b/tests/cases/conformance/types/thisType/thisTypeInFunctions.ts new file mode 100644 index 00000000000..481e1630092 --- /dev/null +++ b/tests/cases/conformance/types/thisType/thisTypeInFunctions.ts @@ -0,0 +1,193 @@ +// body checking +class B { + n: number; +} +class C { + n: number; + explicitThis(this: this, m: number): number { + return this.n + m; + } + explicitC(this: C, m: number): number { + return this.n + m; + } + explicitProperty(this: {n: number}, m: number): number { + return this.n + m; + } + explicitVoid(this: void, m: number): number { + return m + 1; + } +} +class D extends C { } +interface I { + a: number; + explicitVoid1(this: void): number; + explicitVoid2(this: void): number; + explicitStructural(this: {a: number}): number; + explicitInterface(this: I): number; + explicitThis(this: this): number; +} +function explicitStructural(this: { y: number }, x: number): number { + return x + this.y; +} +function justThis(this: { y: number }): number { + return this.y; +} +function implicitThis(n: number): number { + return this.m + n + 12; +} +let impl: I = { + a: 12, + explicitVoid2: () => this.a, // ok, this: any because it refers to some outer object (window?) + explicitVoid1() { return 12; }, + explicitStructural() { + return this.a; + }, + explicitInterface() { + return this.a; + }, + explicitThis() { + return this.a; + }, +} +impl.explicitVoid1 = function () { return 12; }; +impl.explicitVoid2 = () => 12; +impl.explicitStructural = function() { return this.a; }; +impl.explicitInterface = function() { return this.a; }; +impl.explicitStructural = () => 12; +impl.explicitInterface = () => 12; +impl.explicitThis = function () { return this.a; }; +// parameter checking +let ok: {y: number, f: (this: { y: number }, x: number) => number} = { y: 12, f: explicitStructural }; +let implicitAnyOk: {notSpecified: number, f: (x: number) => number} = { notSpecified: 12, f: implicitThis }; +ok.f(13); +implicitThis(12); +implicitAnyOk.f(12); + +let c = new C(); +let d = new D(); +let ripped = c.explicitC; +c.explicitC(12); +c.explicitProperty(12); +c.explicitThis(12); +d.explicitC(12); +d.explicitProperty(12); +d.explicitThis(12); +let reconstructed: { + n: number, + explicitThis(this: C, m: number): number, // note: this: this is not allowed in an object literal type. + explicitC(this: C, m: number): number, + explicitProperty: (this: {n : number}, m: number) => number, + explicitVoid(this: void, m: number): number, +} = { + n: 12, + explicitThis: c.explicitThis, + explicitC: c.explicitC, + explicitProperty: c.explicitProperty, + explicitVoid: c.explicitVoid +}; +reconstructed.explicitThis(10); +reconstructed.explicitProperty(11); +let explicitVoid = reconstructed.explicitVoid; +explicitVoid(12); +// assignment checking +let unboundToSpecified: (this: { y: number }, x: number) => number = x => x + this.y; // ok, this:any +let specifiedToSpecified: (this: {y: number}, x: number) => number = explicitStructural; +let anyToSpecified: (this: { y: number }, x: number) => number = function(x: number): number { return x + 12; }; + +let unspecifiedLambda: (x: number) => number = x => x + 12; +let specifiedLambda: (this: void, x: number) => number = x => x + 12; +let unspecifiedLambdaToSpecified: (this: {y: number}, x: number) => number = unspecifiedLambda; +let specifiedLambdaToSpecified: (this: {y: number}, x: number) => number = specifiedLambda; + + +let explicitCFunction: (this: C, m: number) => number; +let explicitPropertyFunction: (this: {n: number}, m: number) => number; +c.explicitC = explicitCFunction; +c.explicitC = function(this: C, m: number) { return this.n + m }; +c.explicitProperty = explicitPropertyFunction; +c.explicitProperty = function(this: {n: number}, m: number) { return this.n + m }; +c.explicitProperty = reconstructed.explicitProperty; + +// lambdas are assignable to anything +c.explicitC = m => m; +c.explicitThis = m => m; +c.explicitProperty = m => m; + +// this inside lambdas refer to outer scope +// the outer-scoped lambda at top-level is still just `any` +c.explicitC = m => m + this.n; +c.explicitThis = m => m + this.n; +c.explicitProperty = m => m + this.n; + +//NOTE: this=C here, I guess? +c.explicitThis = explicitCFunction; +c.explicitThis = function(this: C, m: number) { return this.n + m }; + +// this:any compatibility +c.explicitC = function(m) { return this.n + m }; +c.explicitProperty = function(m) { return this.n + m }; +c.explicitThis = function(m) { return this.n + m }; + +// this: contextual typing +c.explicitThis = function(this, m) { return this.n + m }; + +// this: superclass compatibility +c.explicitC = function(this: B, m: number) { return this.n + m }; + +// this:void compatibility +c.explicitVoid = n => n; + +// class-based assignability +class Base1 { + x: number; + public polymorphic(this: this): number { return this.x; } + explicit(this: Base1): number { return this.x; } + static explicitStatic(this: typeof Base1): number { return this.y; } + static y: number; +} +class Derived1 extends Base1 { + y: number +} +class Base2 { + y: number + polymorphic(this: this): number { return this.y; } + explicit(this: Base1): number { return this.x; } +} +class Derived2 extends Base2 { + x: number +} +let b1 = new Base1(); +let b2 = new Base2(); +let d1 = new Derived1(); +let d2 = new Derived2(); +d2.polymorphic = d1.polymorphic // ok, 'x' and 'y' in { x, y } +d1.polymorphic = d2.polymorphic // ok, 'x' and 'y' in { x, y } + +// bivariance-allowed cases +d1.polymorphic = b2.polymorphic // ok, 'y' in D: { x, y } +d2.polymorphic = d1.explicit // ok, 'y' in { x, y } +b1.polymorphic = d2.polymorphic // ok, 'x' and 'y' not in Base1: { x } +b1.explicit = d2.polymorphic // ok, 'x' and 'y' not in Base1: { x } + +////// use this-type for construction with new //// +function InterfaceThis(this: I) { + this.a = 12; +} +function LiteralTypeThis(this: {x: string}) { + this.x = "ok"; +} +function AnyThis(this: any) { + this.x = "ok"; +} +let interfaceThis = new InterfaceThis(); +let literalTypeThis = new LiteralTypeThis(); +let anyThis = new AnyThis(); + +//// type parameter inference //// +declare var f: { + (this: void, x: number): number, + call(this: (...argArray: any[]) => U, ...argArray: any[]): U; +}; +let n: number = f.call(12); + +function missingTypeIsImplicitAny(this, a: number) { return this.anything + a; } diff --git a/tests/cases/conformance/types/thisType/thisTypeInFunctions2.ts b/tests/cases/conformance/types/thisType/thisTypeInFunctions2.ts new file mode 100644 index 00000000000..a574c7a07e9 --- /dev/null +++ b/tests/cases/conformance/types/thisType/thisTypeInFunctions2.ts @@ -0,0 +1,54 @@ +interface IndexedWithThis { + // this is a workaround for React + init?: (this: this) => void; + willDestroy?: (this: any) => void; + [propName: string]: number | string | boolean | symbol | undefined | null | {} | ((this: any, ...args:any[]) => any); +} +interface IndexedWithoutThis { + // this is what React would like to write (and what they write today) + init?: () => void; + willDestroy?: () => void; + [propName: string]: any; +} +interface SimpleInterface { + foo(n: string); + bar(): number; +} +declare function extend1(args: IndexedWithThis): void; +declare function extend2(args: IndexedWithoutThis): void; +declare function simple(arg: SimpleInterface): void; + +extend1({ + init() { + this // this: IndexedWithThis because of contextual typing. + // this.mine + this.willDestroy + }, + mine: 12, + foo() { + this.url; // this: any because 'foo' matches the string indexer + this.willDestroy; + } +}); +extend2({ + init() { + this // this: any because the contextual signature of init doesn't specify this' type + this.mine + this.willDestroy + }, + mine: 13, + foo() { + this // this: any because of the string indexer + this.mine + this.willDestroy + } +}); + +simple({ + foo(n) { + return n.length + this.bar(); + }, + bar() { + return 14; + } +}) diff --git a/tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts b/tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts new file mode 100644 index 00000000000..aa2a48d5f47 --- /dev/null +++ b/tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts @@ -0,0 +1,175 @@ +class C { + n: number; + explicitThis(this: this, m: number): number { + return this.n + m; + } + implicitThis(m: number): number { + return this.n + m; + } + explicitC(this: C, m: number): number { + return this.n + m; + } + explicitProperty(this: {n: number}, m: number): number { + return this.n + m; + } + explicitVoid(this: void, m: number): number { + return this.n + m; // 'n' doesn't exist on type 'void'. + } +} +class D { + x: number; + explicitThis(this: this, m: number): number { + return this.x + m; + } + explicitD(this: D, m: number): number { + return this.x + m; + } +} +interface I { + a: number; + explicitVoid1(this: void): number; + explicitVoid2(this: void): number; + explicitStructural(this: {a: number}): number; + explicitInterface(this: I): number; + explicitThis(this: this): number; // TODO: Allow `this` types for interfaces +} +let impl: I = { + a: 12, + explicitVoid1() { + return this.a; // error, no 'a' in 'void' + }, + explicitVoid2: () => this.a, // ok, `this:any` because it refers to an outer object + explicitStructural: () => 12, + explicitInterface: () => 12, + explicitThis() { + return this.a; + }, +} +let implExplicitStructural = impl.explicitStructural; +implExplicitStructural(); // error, no 'a' in 'void' +let implExplicitInterface = impl.explicitInterface; +implExplicitInterface(); // error, no 'a' in 'void' +function explicitStructural(this: { y: number }, x: number): number { + return x + this.y; +} +function propertyName(this: { y: number }, x: number): number { + return x + this.notFound; +} +function voidThisSpecified(this: void, x: number): number { + return x + this.notSpecified; +} +let ok: {y: number, f: (this: { y: number }, x: number) => number} = { y: 12, explicitStructural }; +let wrongPropertyType: {y: string, f: (this: { y: number }, x: number) => number} = { y: 'foo', explicitStructural }; +let wrongPropertyName: {wrongName: number, f: (this: { y: number }, x: number) => number} = { wrongName: 12, explicitStructural }; + +ok.f(); // not enough arguments +ok.f('wrong type'); +ok.f(13, 'too many arguments'); +wrongPropertyType.f(13); +wrongPropertyName.f(13); + +let c = new C(); +c.explicitC(); // not enough arguments +c.explicitC('wrong type'); +c.explicitC(13, 'too many arguments'); +c.explicitThis(); // not enough arguments +c.explicitThis('wrong type 2'); +c.explicitThis(14, 'too many arguments 2'); +c.implicitThis(); // not enough arguments +c.implicitThis('wrong type 2'); +c.implicitThis(14, 'too many arguments 2'); +c.explicitProperty(); // not enough arguments +c.explicitProperty('wrong type 3'); +c.explicitProperty(15, 'too many arguments 3'); + +// oops, this triggers contextual typing, which needs to be updated to understand that =>'s `this` is void. +let specifiedToVoid: (this: void, x: number) => number = explicitStructural; + +let reconstructed: { + n: number, + explicitThis(this: C, m: number): number, // note: this: this is not allowed in an object literal type. + explicitC(this: C, m: number): number, + explicitProperty: (this: {n : number}, m: number) => number, + explicitVoid(this: void, m: number): number, +} = { + n: 12, + explicitThis: c.explicitThis, + explicitC: c.explicitC, + explicitProperty: c.explicitProperty, + explicitVoid: c.explicitVoid +};; + +// lambdas have this: void for assignability purposes (and this unbound (free) for body checking) +let d = new D(); +let explicitXProperty: (this: { x: number }, m: number) => number; + +// from differing object types +c.explicitC = function(this: D, m: number) { return this.x + m }; +c.explicitProperty = explicitXProperty; + +c.explicitC = d.explicitD; +c.explicitC = d.explicitThis; +c.explicitThis = d.explicitD; +c.explicitThis = d.explicitThis; +c.explicitProperty = d.explicitD; +c.explicitThis = d.explicitThis; +c.explicitVoid = d.explicitD; +c.explicitVoid = d.explicitThis; + +/// class-based polymorphic assignability (with inheritance!) /// + +class Base1 { + x: number + public polymorphic(this: this): number { return this.x; } + explicit(this: Base1): number { return this.x; } + static explicitStatic(this: typeof Base1): number { return this.x; } +} +class Derived1 extends Base1 { + y: number +} +class Base2 { + y: number + polymorphic(this: this): number { return this.y; } + explicit(this: Base1): number { return this.x; } +} +class Derived2 extends Base2 { + x: number +} + + +let b1 = new Base1(); +let d1 = new Derived1(); +let b2 = new Base2(); +let d2 = new Derived2(); + +b1.polymorphic = b2.polymorphic // error, 'this.y' not in Base1: { x } +b1.explicit = b2.polymorphic // error, 'y' not in Base1: { x } + +d1.explicit = b2.polymorphic // error, 'y' not in Base1: { x } + +////// use this-type for construction with new //// +function VoidThis(this: void) { + +} +let voidThis = new VoidThis(); + +///// syntax-ish errors ///// +class ThisConstructor { + constructor(this: ThisConstructor, private n: number) { + } +} +interface ThisConstructorInterface { + new(this: ThisConstructor, n: number); +} +var thisConstructorType: new (this: number) => number; +function notFirst(a: number, this: C): number { return this.n; } + +///// parse errors ///// +function modifiers(async this: C): number { return this.n; } +function restParam(...this: C): number { return this.n; } +function optional(this?: C): number { return this.n; } +function decorated(@deco() this: C): number { return this.n; } +function initializer(this: C = new C()): number { return this.n; } + +// can't name parameters 'this' in a lambda. +c.explicitProperty = (this, m) => m + this.n; diff --git a/tests/cases/conformance/types/thisType/thisTypeInObjectLiterals.ts b/tests/cases/conformance/types/thisType/thisTypeInObjectLiterals.ts new file mode 100644 index 00000000000..599caf70f30 --- /dev/null +++ b/tests/cases/conformance/types/thisType/thisTypeInObjectLiterals.ts @@ -0,0 +1,33 @@ +let o = { + d: "bar", + m() { + return this.d.length; + }, + f: function() { + return this.d.length; + } +} + +let mutuallyRecursive = { + a: 100, + start() { + return this.passthrough(this.a); + }, + passthrough(n: number) { + return this.sub1(n); + }, + sub1(n: number): number { + if (n > 0) { + return this.passthrough(n - 1); + } + return n; + } +} +var i: number = mutuallyRecursive.start(); +interface I { + a: number; + start(): number; + passthrough(n: number): number; + sub1(n: number): number; +} +var impl: I = mutuallyRecursive; diff --git a/tests/cases/conformance/types/thisType/unionThisTypeInFunctions.ts b/tests/cases/conformance/types/thisType/unionThisTypeInFunctions.ts new file mode 100644 index 00000000000..4f74058cc48 --- /dev/null +++ b/tests/cases/conformance/types/thisType/unionThisTypeInFunctions.ts @@ -0,0 +1,11 @@ +interface Real { + method(this: this, n: number): void; + data: string; +} +interface Fake { + method(this: this, n: number): void; + data: number; +} +function test(r: Real | Fake) { + r.method(12); +} diff --git a/tests/cases/conformance/types/typeParameters/recurringTypeParamForContainerOfBase01.ts b/tests/cases/conformance/types/typeParameters/recurringTypeParamForContainerOfBase01.ts new file mode 100644 index 00000000000..e8484d30f95 --- /dev/null +++ b/tests/cases/conformance/types/typeParameters/recurringTypeParamForContainerOfBase01.ts @@ -0,0 +1,13 @@ +// @declaration: true + +interface BoxOfFoo> { + item: T +} + +interface Foo> { + self: T; +} + +interface Bar> extends Foo { + other: BoxOfFoo; +} \ No newline at end of file diff --git a/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/unionTypesAssignability.ts b/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/unionTypesAssignability.ts index 9ceee8845a5..90f16b6d15d 100644 --- a/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/unionTypesAssignability.ts +++ b/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/unionTypesAssignability.ts @@ -59,13 +59,14 @@ unionNumberString = null; unionDE = undefined; unionNumberString = undefined; -// type parameters -function foo(t: T, u: U) { - t = u; // error - u = t; // error - var x : T | U; - x = t; // ok - x = u; // ok - t = x; // error U not assignable to T - u = x; // error T not assignable to U +// type parameters +function foo(t: T, u: U) { + t = u; // error + u = t; // error + var x : T | U; + x = t; // ok + x = u; // ok + x = undefined; + t = x; // error U not assignable to T + u = x; // error T not assignable to U } diff --git a/tests/cases/conformance/types/typeRelationships/comparable/equalityStrictNulls.ts b/tests/cases/conformance/types/typeRelationships/comparable/equalityStrictNulls.ts new file mode 100644 index 00000000000..6b2744e8849 --- /dev/null +++ b/tests/cases/conformance/types/typeRelationships/comparable/equalityStrictNulls.ts @@ -0,0 +1,69 @@ +// @strictNullChecks: true + +function f1(x: string) { + if (x == undefined) { + } + if (x != undefined) { + } + if (x === undefined) { + } + if (x !== undefined) { + } + if (x == null) { + } + if (x != null) { + } + if (x === null) { + } + if (x !== null) { + } + if (undefined == x) { + } + if (undefined != x) { + } + if (undefined === x) { + } + if (undefined !== x) { + } + if (null == x) { + } + if (null != x) { + } + if (null === x) { + } + if (null !== x) { + } +} + +function f2() { + if (undefined == undefined) { + } + if (undefined == null) { + } + if (null == undefined) { + } + if (null == null) { + } +} + +function f3(a: number, b: boolean, c: { x: number }, d: number | string) { + if (a == null) { + } + if (b == null) { + } + if (c == null) { + } + if (d == null) { + } +} + +function f4(x: number) { + if (x > undefined) { + } + if (x < undefined) { + } + if (x >= undefined) { + } + if (x <= undefined) { + } +} diff --git a/tests/cases/conformance/types/typeRelationships/comparable/equalityWithIntersectionTypes01.ts b/tests/cases/conformance/types/typeRelationships/comparable/equalityWithIntersectionTypes01.ts new file mode 100644 index 00000000000..74c0ebb7412 --- /dev/null +++ b/tests/cases/conformance/types/typeRelationships/comparable/equalityWithIntersectionTypes01.ts @@ -0,0 +1,24 @@ +interface I1 { + p1: number +} + +interface I2 extends I1 { + p2: number; +} + +interface I3 { + p3: number; +} + +var x = { p1: 10, p2: 20, p3: 30 }; +var y: I1 & I3 = x; +var z: I2 = x; + +if (y === z || z === y) { +} +else if (y !== z || z !== y) { +} +else if (y == z || z == y) { +} +else if (y != z || z != y) { +} \ No newline at end of file diff --git a/tests/cases/conformance/types/typeRelationships/comparable/equalityWithUnionTypes01.ts b/tests/cases/conformance/types/typeRelationships/comparable/equalityWithUnionTypes01.ts new file mode 100644 index 00000000000..d83277b975a --- /dev/null +++ b/tests/cases/conformance/types/typeRelationships/comparable/equalityWithUnionTypes01.ts @@ -0,0 +1,20 @@ +interface I1 { + p1: number +} + +interface I2 extends I1 { + p2: number; +} + +var x = { p1: 10, p2: 20 }; +var y: number | I2 = x; +var z: I1 = x; + +if (y === z || z === y) { +} +else if (y !== z || z !== y) { +} +else if (y == z || z == y) { +} +else if (y != z || z != y) { +} \ No newline at end of file diff --git a/tests/cases/conformance/types/typeRelationships/comparable/switchCaseWithIntersectionTypes01.ts b/tests/cases/conformance/types/typeRelationships/comparable/switchCaseWithIntersectionTypes01.ts new file mode 100644 index 00000000000..fd629306b10 --- /dev/null +++ b/tests/cases/conformance/types/typeRelationships/comparable/switchCaseWithIntersectionTypes01.ts @@ -0,0 +1,25 @@ + +var strAndNum: string & number; +var numAndBool: number & boolean; +var str: string; +var num: number; +var bool: boolean; + +switch (strAndNum) { + // Identical + case strAndNum: + break; + + // Constituents + case str: + case num: + break; + + // Overlap in constituents + case numAndBool: + break; + + // No relation + case bool: + break; +} \ No newline at end of file diff --git a/tests/cases/conformance/types/typeRelationships/comparable/switchCaseWithUnionTypes01.ts b/tests/cases/conformance/types/typeRelationships/comparable/switchCaseWithUnionTypes01.ts new file mode 100644 index 00000000000..bdbfaf2df47 --- /dev/null +++ b/tests/cases/conformance/types/typeRelationships/comparable/switchCaseWithUnionTypes01.ts @@ -0,0 +1,25 @@ + +var strOrNum: string | number; +var numOrBool: number | boolean; +var str: string; +var num: number; +var bool: boolean; + +switch (strOrNum) { + // Identical + case strOrNum: + break; + + // Constituents + case str: + case num: + break; + + // Overlap in constituents + case numOrBool: + break; + + // No relation + case bool: + break; +} \ No newline at end of file diff --git a/tests/cases/conformance/types/typeRelationships/comparable/typeAssertionsWithIntersectionTypes01.ts b/tests/cases/conformance/types/typeRelationships/comparable/typeAssertionsWithIntersectionTypes01.ts new file mode 100644 index 00000000000..1afc760ef85 --- /dev/null +++ b/tests/cases/conformance/types/typeRelationships/comparable/typeAssertionsWithIntersectionTypes01.ts @@ -0,0 +1,20 @@ +interface I1 { + p1: number +} + +interface I2 extends I1 { + p2: number; +} + +interface I3 { + p3: number; +} + +var x = { p1: 10, p2: 20, p3: 30 }; +var y: I1 & I3 = x; +var z: I2 = x; + +var a = z; +var b = z; +var c = z; +var d = y; diff --git a/tests/cases/conformance/types/typeRelationships/comparable/typeAssertionsWithUnionTypes01.ts b/tests/cases/conformance/types/typeRelationships/comparable/typeAssertionsWithUnionTypes01.ts new file mode 100644 index 00000000000..3010c5f159a --- /dev/null +++ b/tests/cases/conformance/types/typeRelationships/comparable/typeAssertionsWithUnionTypes01.ts @@ -0,0 +1,16 @@ +interface I1 { + p1: number +} + +interface I2 extends I1 { + p2: number; +} + +var x = { p1: 10, p2: 20 }; +var y: number | I2 = x; +var z: I1 = x; + +var a = z; +var b = z; +var c = z; +var d = y; diff --git a/tests/cases/fourslash/breakpointValidationDestructuringAssignmentForArrayBindingPattern.ts b/tests/cases/fourslash/breakpointValidationDestructuringAssignmentForArrayBindingPattern.ts new file mode 100644 index 00000000000..c87268684b5 --- /dev/null +++ b/tests/cases/fourslash/breakpointValidationDestructuringAssignmentForArrayBindingPattern.ts @@ -0,0 +1,94 @@ +/// +////declare var console: { +//// log(msg: any): void; +////} +////type Robot = [number, string, string]; +////type MultiSkilledRobot = [string, [string, string]]; +////let robotA: Robot = [1, "mower", "mowing"]; +////function getRobot() { +//// return robotA; +////} +////let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; +////let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; +////function getMultiRobot() { +//// return multiRobotA; +////} +////let nameA: string, primarySkillA: string, secondarySkillA: string; +////let numberB: number, nameB: string; +////let numberA2: number, nameA2: string, skillA2: string, nameMA: string; +////let numberA3: number, robotAInfo: (number | string)[], multiRobotAInfo: (string | [string, string])[]; +////let i: number; +////for ([, nameA] = robotA, i = 0; i < 1; i++) { +//// console.log(nameA); +////} +////for ([, nameA] = getRobot(), i = 0; i < 1; i++) { +//// console.log(nameA); +////} +////for ([, nameA] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { +//// console.log(nameA); +////} +////for ([, [primarySkillA, secondarySkillA]] = multiRobotA, i = 0; i < 1; i++) { +//// console.log(primarySkillA); +////} +////for ([, [primarySkillA, secondarySkillA]] = getMultiRobot(), i = 0; i < 1; i++) { +//// console.log(primarySkillA); +////} +////for ([, [primarySkillA, secondarySkillA]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { +//// console.log(primarySkillA); +////} +////for ([numberB] = robotA, i = 0; i < 1; i++) { +//// console.log(numberB); +////} +////for ([numberB] = getRobot(), i = 0; i < 1; i++) { +//// console.log(numberB); +////} +////for ([numberB] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { +//// console.log(numberB); +////} +////for ([nameB] = multiRobotA, i = 0; i < 1; i++) { +//// console.log(nameB); +////} +////for ([nameB] = getMultiRobot(), i = 0; i < 1; i++) { +//// console.log(nameB); +////} +////for ([nameB] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { +//// console.log(nameB); +////} +////for ([numberA2, nameA2, skillA2] = robotA, i = 0; i < 1; i++) { +//// console.log(nameA2); +////} +////for ([numberA2, nameA2, skillA2] = getRobot(), i = 0; i < 1; i++) { +//// console.log(nameA2); +////} +////for ([numberA2, nameA2, skillA2] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { +//// console.log(nameA2); +////} +////for ([nameMA, [primarySkillA, secondarySkillA]] = multiRobotA, i = 0; i < 1; i++) { +//// console.log(nameMA); +////} +////for ([nameMA, [primarySkillA, secondarySkillA]] = getMultiRobot(), i = 0; i < 1; i++) { +//// console.log(nameMA); +////} +////for ([nameMA, [primarySkillA, secondarySkillA]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { +//// console.log(nameMA); +////} +////for ([numberA3, ...robotAInfo] = robotA, i = 0; i < 1; i++) { +//// console.log(numberA3); +////} +////for ([numberA3, ...robotAInfo] = getRobot(), i = 0; i < 1; i++) { +//// console.log(numberA3); +////} +////for ([numberA3, ...robotAInfo] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { +//// console.log(numberA3); +////} +////for ([...multiRobotAInfo] = multiRobotA, i = 0; i < 1; i++) { +//// console.log(multiRobotAInfo); +////} +////for ([...multiRobotAInfo] = getMultiRobot(), i = 0; i < 1; i++) { +//// console.log(multiRobotAInfo); +////} +////for ([...multiRobotAInfo] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { +//// console.log(multiRobotAInfo); +////} + +verify.baselineCurrentFileBreakpointLocations(); \ No newline at end of file diff --git a/tests/cases/fourslash/breakpointValidationDestructuringAssignmentForArrayBindingPatternDefaultValues.ts b/tests/cases/fourslash/breakpointValidationDestructuringAssignmentForArrayBindingPatternDefaultValues.ts new file mode 100644 index 00000000000..80e4a811fed --- /dev/null +++ b/tests/cases/fourslash/breakpointValidationDestructuringAssignmentForArrayBindingPatternDefaultValues.ts @@ -0,0 +1,109 @@ +/// +////declare var console: { +//// log(msg: any): void; +////} +////type Robot = [number, string, string]; +////type MultiSkilledRobot = [string, [string, string]]; +////let robotA: Robot = [1, "mower", "mowing"]; +////function getRobot() { +//// return robotA; +////} +////let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; +////let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; +////function getMultiRobot() { +//// return multiRobotA; +////} +////let nameA: string, primarySkillA: string, secondarySkillA: string; +////let numberB: number, nameB: string; +////let numberA2: number, nameA2: string, skillA2: string, nameMA: string; +////let numberA3: number, robotAInfo: (number | string)[], multiRobotAInfo: (string | [string, string])[]; +////let i: number; +////for ([, nameA = "name"] = robotA, i = 0; i < 1; i++) { +//// console.log(nameA); +////} +////for ([, nameA = "name"] = getRobot(), i = 0; i < 1; i++) { +//// console.log(nameA); +////} +////for ([, nameA = "name"] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { +//// console.log(nameA); +////} +////for ([, [ +//// primarySkillA = "primary", +//// secondarySkillA = "secondary" +////] = ["none", "none"]] = multiRobotA, i = 0; i < 1; i++) { +//// console.log(primarySkillA); +////} +////for ([, [ +//// primarySkillA = "primary", +//// secondarySkillA = "secondary" +////] = ["none", "none"]] = getMultiRobot(), i = 0; i < 1; i++) { +//// console.log(primarySkillA); +////} +////for ([, [ +//// primarySkillA = "primary", +//// secondarySkillA = "secondary" +////] = ["none", "none"]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { +//// console.log(primarySkillA); +////} +////for ([numberB = -1] = robotA, i = 0; i < 1; i++) { +//// console.log(numberB); +////} +////for ([numberB = -1] = getRobot(), i = 0; i < 1; i++) { +//// console.log(numberB); +////} +////for ([numberB = -1] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { +//// console.log(numberB); +////} +////for ([nameB = "name"] = multiRobotA, i = 0; i < 1; i++) { +//// console.log(nameB); +////} +////for ([nameB = "name"] = getMultiRobot(), i = 0; i < 1; i++) { +//// console.log(nameB); +////} +////for ([nameB = "name"] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { +//// console.log(nameB); +////} +////for ([numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = robotA, i = 0; i < 1; i++) { +//// console.log(nameA2); +////} +////for ([numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = getRobot(), i = 0; i < 1; i++) { +//// console.log(nameA2); +////} +////for ([numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { +//// console.log(nameA2); +////} +////for ([nameMA = "noName", +//// [ +//// primarySkillA = "primary", +//// secondarySkillA = "secondary" +//// ] = ["none", "none"] +//// ] = multiRobotA, i = 0; i < 1; i++) { +//// console.log(nameMA); +////} +////for ([nameMA = "noName", +//// [ +//// primarySkillA = "primary", +//// secondarySkillA = "secondary" +//// ] = ["none", "none"] +////] = getMultiRobot(), i = 0; i < 1; i++) { +//// console.log(nameMA); +////} +////for ([nameMA = "noName", +//// [ +//// primarySkillA = "primary", +//// secondarySkillA = "secondary" +//// ] = ["none", "none"] +////] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { +//// console.log(nameMA); +////} +////for ([numberA3 = -1, ...robotAInfo] = robotA, i = 0; i < 1; i++) { +//// console.log(numberA3); +////} +////for ([numberA3 = -1, ...robotAInfo] = getRobot(), i = 0; i < 1; i++) { +//// console.log(numberA3); +////} +////for ([numberA3 = -1, ...robotAInfo] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { +//// console.log(numberA3); +////} + +verify.baselineCurrentFileBreakpointLocations(); \ No newline at end of file diff --git a/tests/cases/fourslash/breakpointValidationDestructuringAssignmentForObjectBindingPattern.ts b/tests/cases/fourslash/breakpointValidationDestructuringAssignmentForObjectBindingPattern.ts new file mode 100644 index 00000000000..298fb2f9580 --- /dev/null +++ b/tests/cases/fourslash/breakpointValidationDestructuringAssignmentForObjectBindingPattern.ts @@ -0,0 +1,107 @@ +/// + +////declare var console: { +//// log(msg: any): void; +////} +////interface Robot { +//// name: string; +//// skill: string; +////} +////interface MultiRobot { +//// name: string; +//// skills: { +//// primary: string; +//// secondary: string; +//// }; +////} +////let robot: Robot = { name: "mower", skill: "mowing" }; +////let multiRobot: MultiRobot = { name: "mower", skills: { primary: "mowing", secondary: "none" } }; +////function getRobot() { +//// return robot; +////} +////function getMultiRobot() { +//// return multiRobot; +////} +////let nameA: string, primaryA: string, secondaryA: string, i: number, skillA: string; +////let name: string, primary: string, secondary: string, skill: string; +////for ({ name: nameA } = robot, i = 0; i < 1; i++) { +//// console.log(nameA); +////} +////for ({ name: nameA } = getRobot(), i = 0; i < 1; i++) { +//// console.log(nameA); +////} +////for ({ name: nameA } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { +//// console.log(nameA); +////} +////for ({ skills: { primary: primaryA, secondary: secondaryA } } = multiRobot, i = 0; i < 1; i++) { +//// console.log(primaryA); +////} +////for ({ skills: { primary: primaryA, secondary: secondaryA } } = getMultiRobot(), i = 0; i < 1; i++) { +//// console.log(primaryA); +////} +////for ({ skills: { primary: primaryA, secondary: secondaryA } } = +//// { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, +//// i = 0; i < 1; i++) { +//// console.log(primaryA); +////} +////for ({ name } = robot, i = 0; i < 1; i++) { +//// console.log(nameA); +////} +////for ({ name } = getRobot(), i = 0; i < 1; i++) { +//// console.log(nameA); +////} +////for ({ name } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { +//// console.log(nameA); +////} +////for ({ skills: { primary, secondary } } = multiRobot, i = 0; i < 1; i++) { +//// console.log(primaryA); +////} +////for ({ skills: { primary, secondary } } = getMultiRobot(), i = 0; i < 1; i++) { +//// console.log(primaryA); +////} +////for ({ skills: { primary, secondary } } = +//// { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, +//// i = 0; i < 1; i++) { +//// console.log(primaryA); +////} +////for ({ name: nameA, skill: skillA } = robot, i = 0; i < 1; i++) { +//// console.log(nameA); +////} +////for ({ name: nameA, skill: skillA } = getRobot(), i = 0; i < 1; i++) { +//// console.log(nameA); +////} +////for ({ name: nameA, skill: skillA } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { +//// console.log(nameA); +////} +////for ({ name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = multiRobot, i = 0; i < 1; i++) { +//// console.log(primaryA); +////} +////for ({ name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = getMultiRobot(), i = 0; i < 1; i++) { +//// console.log(primaryA); +////} +////for ({ name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = +//// { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, +//// i = 0; i < 1; i++) { +//// console.log(primaryA); +////} +////for ({ name, skill } = robot, i = 0; i < 1; i++) { +//// console.log(nameA); +////} +////for ({ name, skill } = getRobot(), i = 0; i < 1; i++) { +//// console.log(nameA); +////} +////for ({ name, skill } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { +//// console.log(nameA); +////} +////for ({ name, skills: { primary, secondary } } = multiRobot, i = 0; i < 1; i++) { +//// console.log(primaryA); +////} +////for ({ name, skills: { primary, secondary } } = getMultiRobot(), i = 0; i < 1; i++) { +//// console.log(primaryA); +////} +////for ({ name, skills: { primary, secondary } } = +//// { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, +//// i = 0; i < 1; i++) { +//// console.log(primaryA); +////} +verify.baselineCurrentFileBreakpointLocations(); \ No newline at end of file diff --git a/tests/cases/fourslash/breakpointValidationDestructuringAssignmentForObjectBindingPatternDefaultValues.ts b/tests/cases/fourslash/breakpointValidationDestructuringAssignmentForObjectBindingPatternDefaultValues.ts new file mode 100644 index 00000000000..161b58c91c2 --- /dev/null +++ b/tests/cases/fourslash/breakpointValidationDestructuringAssignmentForObjectBindingPatternDefaultValues.ts @@ -0,0 +1,168 @@ +/// +////declare var console: { +//// log(msg: any): void; +////} +////interface Robot { +//// name: string; +//// skill: string; +////} +////interface MultiRobot { +//// name: string; +//// skills: { +//// primary?: string; +//// secondary?: string; +//// }; +////} +////let robot: Robot = { name: "mower", skill: "mowing" }; +////let multiRobot: MultiRobot = { name: "mower", skills: { primary: "mowing", secondary: "none" } }; +////function getRobot() { +//// return robot; +////} +////function getMultiRobot() { +//// return multiRobot; +////} +////let nameA: string, primaryA: string, secondaryA: string, i: number, skillA: string; +////let name: string, primary: string, secondary: string, skill: string; +////for ({name: nameA = "noName" } = robot, i = 0; i < 1; i++) { +//// console.log(nameA); +////} +////for ({name: nameA = "noName" } = getRobot(), i = 0; i < 1; i++) { +//// console.log(nameA); +////} +////for ({name: nameA = "noName" } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { +//// console.log(nameA); +////} +////for ({ +//// skills: { +//// primary: primaryA = "primary", +//// secondary: secondaryA = "secondary" +//// } = { primary: "none", secondary: "none" } +////} = multiRobot, i = 0; i < 1; i++) { +//// console.log(primaryA); +////} +////for ({ +//// skills: { +//// primary: primaryA = "primary", +//// secondary: secondaryA = "secondary" +//// } = { primary: "none", secondary: "none" } +////} = getMultiRobot(), i = 0; i < 1; i++) { +//// console.log(primaryA); +////} +////for ({ +//// skills: { +//// primary: primaryA = "primary", +//// secondary: secondaryA = "secondary" +//// } = { primary: "none", secondary: "none" } +////} = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, +//// i = 0; i < 1; i++) { +//// console.log(primaryA); +////} +////for ({ name = "noName" } = robot, i = 0; i < 1; i++) { +//// console.log(nameA); +////} +////for ({ name = "noName" } = getRobot(), i = 0; i < 1; i++) { +//// console.log(nameA); +////} +////for ({ name = "noName" } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { +//// console.log(nameA); +////} +////for ({ +//// skills: { +//// primary = "primary", +//// secondary = "secondary" +//// } = { primary: "none", secondary: "none" } +////} = multiRobot, i = 0; i < 1; i++) { +//// console.log(primaryA); +////} +////for ({ +//// skills: { +//// primary = "primary", +//// secondary = "secondary" +//// } = { primary: "none", secondary: "none" } +////} = getMultiRobot(), i = 0; i < 1; i++) { +//// console.log(primaryA); +////} +////for ({ +//// skills: { +//// primary = "primary", +//// secondary = "secondary" +//// } = { primary: "none", secondary: "none" } +////} = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, +//// i = 0; i < 1; i++) { +//// console.log(primaryA); +////} +////for ({name: nameA = "noName", skill: skillA = "skill" } = robot, i = 0; i < 1; i++) { +//// console.log(nameA); +////} +////for ({name: nameA = "noName", skill: skillA = "skill" } = getRobot(), i = 0; i < 1; i++) { +//// console.log(nameA); +////} +////for ({name: nameA = "noName", skill: skillA = "skill" } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { +//// console.log(nameA); +////} +////for ({ +//// name: nameA = "noName", +//// skills: { +//// primary: primaryA = "primary", +//// secondary: secondaryA = "secondary" +//// } = { primary: "none", secondary: "none" } +////} = multiRobot, i = 0; i < 1; i++) { +//// console.log(primaryA); +////} +////for ({ +//// name: nameA = "noName", +//// skills: { +//// primary: primaryA = "primary", +//// secondary: secondaryA = "secondary" +//// } = { primary: "none", secondary: "none" } +////} = getMultiRobot(), i = 0; i < 1; i++) { +//// console.log(primaryA); +////} +////for ({ +//// name: nameA = "noName", +//// skills: { +//// primary: primaryA = "primary", +//// secondary: secondaryA = "secondary" +//// } = { primary: "none", secondary: "none" } +////} = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, +//// i = 0; i < 1; i++) { +//// console.log(primaryA); +////} +////for ({ name = "noName", skill = "skill" } = robot, i = 0; i < 1; i++) { +//// console.log(nameA); +////} +////for ({ name = "noName", skill = "skill" } = getRobot(), i = 0; i < 1; i++) { +//// console.log(nameA); +////} +////for ({ name = "noName", skill = "skill" } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { +//// console.log(nameA); +////} +////for ({ +//// name = "noName", +//// skills: { +//// primary = "primary", +//// secondary = "secondary" +//// } = { primary: "none", secondary: "none" } +////} = multiRobot, i = 0; i < 1; i++) { +//// console.log(primaryA); +////} +////for ({ +//// name = "noName", +//// skills: { +//// primary = "primary", +//// secondary = "secondary" +//// } = { primary: "none", secondary: "none" } +////} = getMultiRobot(), i = 0; i < 1; i++) { +//// console.log(primaryA); +////} +////for ({ +//// name = "noName", +//// skills: { +//// primary = "primary", +//// secondary = "secondary" +//// } = { primary: "none", secondary: "none" } +////} = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, +//// i = 0; i < 1; i++) { +//// console.log(primaryA); +////} +verify.baselineCurrentFileBreakpointLocations(); diff --git a/tests/cases/fourslash/breakpointValidationDestructuringAssignmentForOfArrayBindingPattern.ts b/tests/cases/fourslash/breakpointValidationDestructuringAssignmentForOfArrayBindingPattern.ts new file mode 100644 index 00000000000..5c30799813b --- /dev/null +++ b/tests/cases/fourslash/breakpointValidationDestructuringAssignmentForOfArrayBindingPattern.ts @@ -0,0 +1,95 @@ +/// +////declare var console: { +//// log(msg: any): void; +////} +////type Robot = [number, string, string]; +////type MultiSkilledRobot = [string, [string, string]]; +////let robotA: Robot = [1, "mower", "mowing"]; +////let robotB: Robot = [2, "trimmer", "trimming"]; +////let robots = [robotA, robotB]; +////function getRobots() { +//// return robots; +////} +////let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; +////let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; +////let multiRobots = [multiRobotA, multiRobotB]; +////function getMultiRobots() { +//// return multiRobots; +////} +////let nameA: string, primarySkillA: string, secondarySkillA: string; +////let numberB: number, nameB: string; +////let numberA2: number, nameA2: string, skillA2: string, nameMA: string; +////let numberA3: number, robotAInfo: (number | string)[], multiRobotAInfo: (string | [string, string])[]; +////for ([, nameA] of robots) { +//// console.log(nameA); +////} +////for ([, nameA] of getRobots()) { +//// console.log(nameA); +////} +////for ([, nameA] of [robotA, robotB]) { +//// console.log(nameA); +////} +////for ([, [primarySkillA, secondarySkillA]] of multiRobots) { +//// console.log(primarySkillA); +////} +////for ([, [primarySkillA, secondarySkillA]] of getMultiRobots()) { +//// console.log(primarySkillA); +////} +////for ([, [primarySkillA, secondarySkillA]] of [multiRobotA, multiRobotB]) { +//// console.log(primarySkillA); +////} +////for ([numberB] of robots) { +//// console.log(numberB); +////} +////for ([numberB] of getRobots()) { +//// console.log(numberB); +////} +////for ([numberB] of [robotA, robotB]) { +//// console.log(numberB); +////} +////for ([nameB] of multiRobots) { +//// console.log(nameB); +////} +////for ([nameB] of getMultiRobots()) { +//// console.log(nameB); +////} +////for ([nameB] of [multiRobotA, multiRobotB]) { +//// console.log(nameB); +////} +////for ([numberA2, nameA2, skillA2] of robots) { +//// console.log(nameA2); +////} +////for ([numberA2, nameA2, skillA2] of getRobots()) { +//// console.log(nameA2); +////} +////for ([numberA2, nameA2, skillA2] of [robotA, robotB]) { +//// console.log(nameA2); +////} +////for ([nameMA, [primarySkillA, secondarySkillA]] of multiRobots) { +//// console.log(nameMA); +////} +////for ([nameMA, [primarySkillA, secondarySkillA]] of getMultiRobots()) { +//// console.log(nameMA); +////} +////for ([nameMA, [primarySkillA, secondarySkillA]] of [multiRobotA, multiRobotB]) { +//// console.log(nameMA); +////} +////for ([numberA3, ...robotAInfo] of robots) { +//// console.log(numberA3); +////} +////for ([numberA3, ...robotAInfo] of getRobots()) { +//// console.log(numberA3); +////} +////for ([numberA3, ...robotAInfo] of [robotA, robotB]) { +//// console.log(numberA3); +////} +////for ([...multiRobotAInfo] of multiRobots) { +//// console.log(multiRobotAInfo); +////} +////for ([...multiRobotAInfo] of getMultiRobots()) { +//// console.log(multiRobotAInfo); +////} +////for ([...multiRobotAInfo] of [multiRobotA, multiRobotB]) { +//// console.log(multiRobotAInfo); +////} +verify.baselineCurrentFileBreakpointLocations(); \ No newline at end of file diff --git a/tests/cases/fourslash/breakpointValidationDestructuringAssignmentForOfArrayBindingPatternDefaultValues.ts b/tests/cases/fourslash/breakpointValidationDestructuringAssignmentForOfArrayBindingPatternDefaultValues.ts new file mode 100644 index 00000000000..8942987c468 --- /dev/null +++ b/tests/cases/fourslash/breakpointValidationDestructuringAssignmentForOfArrayBindingPatternDefaultValues.ts @@ -0,0 +1,104 @@ +/// +////declare var console: { +//// log(msg: any): void; +////} +////type Robot = [number, string, string]; +////type MultiSkilledRobot = [string, [string, string]]; +////let robotA: Robot = [1, "mower", "mowing"]; +////let robotB: Robot = [2, "trimmer", "trimming"]; +////let robots = [robotA, robotB]; +////function getRobots() { +//// return robots; +////} +////let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; +////let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; +////let multiRobots = [multiRobotA, multiRobotB]; +////function getMultiRobots() { +//// return multiRobots; +////} +////let nameA: string, primarySkillA: string, secondarySkillA: string; +////let numberB: number, nameB: string; +////let numberA2: number, nameA2: string, skillA2: string, nameMA: string; +////let numberA3: number, robotAInfo: (number | string)[], multiRobotAInfo: (string | [string, string])[]; +////for ([, nameA = "noName"] of robots) { +//// console.log(nameA); +////} +////for ([, nameA = "noName"] of getRobots()) { +//// console.log(nameA); +////} +////for ([, nameA = "noName"] of [robotA, robotB]) { +//// console.log(nameA); +////} +////for ([, [ +//// primarySkillA = "primary", +//// secondarySkillA = "secondary" +////] = ["skill1", "skill2"]] of multiRobots) { +//// console.log(primarySkillA); +////} +////for ([, [ +//// primarySkillA = "primary", +//// secondarySkillA = "secondary" +////] = ["skill1", "skill2"]] of getMultiRobots()) { +//// console.log(primarySkillA); +////} +////for ([, [ +//// primarySkillA = "primary", +//// secondarySkillA = "secondary" +////] = ["skill1", "skill2"]] of [multiRobotA, multiRobotB]) { +//// console.log(primarySkillA); +////} +////for ([numberB = -1] of robots) { +//// console.log(numberB); +////} +////for ([numberB = -1] of getRobots()) { +//// console.log(numberB); +////} +////for ([numberB = -1] of [robotA, robotB]) { +//// console.log(numberB); +////} +////for ([nameB = "noName"] of multiRobots) { +//// console.log(nameB); +////} +////for ([nameB = "noName"] of getMultiRobots()) { +//// console.log(nameB); +////} +////for ([nameB = "noName"] of [multiRobotA, multiRobotB]) { +//// console.log(nameB); +////} +////for ([numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of robots) { +//// console.log(nameA2); +////} +////for ([numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of getRobots()) { +//// console.log(nameA2); +////} +////for ([numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of [robotA, robotB]) { +//// console.log(nameA2); +////} +////for ([nameMA = "noName", [ +//// primarySkillA = "primary", +//// secondarySkillA = "secondary" +////] = ["skill1", "skill2"]] of multiRobots) { +//// console.log(nameMA); +////} +////for ([nameMA = "noName", [ +//// primarySkillA = "primary", +//// secondarySkillA = "secondary" +////] = ["skill1", "skill2"]] of getMultiRobots()) { +//// console.log(nameMA); +////} +////for ([nameMA = "noName", [ +//// primarySkillA = "primary", +//// secondarySkillA = "secondary" +////] = ["skill1", "skill2"]] of [multiRobotA, multiRobotB]) { +//// console.log(nameMA); +////} +////for ([numberA3 = -1, ...robotAInfo] of robots) { +//// console.log(numberA3); +////} +////for ([numberA3 = -1, ...robotAInfo] of getRobots()) { +//// console.log(numberA3); +////} +////for ([numberA3 = -1, ...robotAInfo] of [robotA, robotB]) { +//// console.log(numberA3); +////} +verify.baselineCurrentFileBreakpointLocations(); \ No newline at end of file diff --git a/tests/cases/fourslash/breakpointValidationDestructuringAssignmentForOfObjectBindingPattern.ts b/tests/cases/fourslash/breakpointValidationDestructuringAssignmentForOfObjectBindingPattern.ts new file mode 100644 index 00000000000..38a4832f14d --- /dev/null +++ b/tests/cases/fourslash/breakpointValidationDestructuringAssignmentForOfObjectBindingPattern.ts @@ -0,0 +1,104 @@ +/// + +////declare var console: { +//// log(msg: any): void; +////} +////interface Robot { +//// name: string; +//// skill: string; +////} +////interface MultiRobot { +//// name: string; +//// skills: { +//// primary: string; +//// secondary: string; +//// }; +////} +////let robots: Robot[] = [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]; +////let multiRobots: MultiRobot[] = [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, +//// { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]; +////function getRobots() { +//// return robots; +////} +////function getMultiRobots() { +//// return multiRobots; +////} +////let nameA: string, primaryA: string, secondaryA: string, i: number, skillA: string; +////let name: string, primary: string, secondary: string, skill: string; +////for ({name: nameA } of robots) { +//// console.log(nameA); +////} +////for ({name: nameA } of getRobots()) { +//// console.log(nameA); +////} +////for ({name: nameA } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { +//// console.log(nameA); +////} +////for ({ skills: { primary: primaryA, secondary: secondaryA } } of multiRobots) { +//// console.log(primaryA); +////} +////for ({ skills: { primary: primaryA, secondary: secondaryA } } of getMultiRobots()) { +//// console.log(primaryA); +////} +////for ({ skills: { primary: primaryA, secondary: secondaryA } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, +//// { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { +//// console.log(primaryA); +////} +////for ({name } of robots) { +//// console.log(nameA); +////} +////for ({name } of getRobots()) { +//// console.log(nameA); +////} +////for ({name } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { +//// console.log(nameA); +////} +////for ({ skills: { primary, secondary } } of multiRobots) { +//// console.log(primaryA); +////} +////for ({ skills: { primary, secondary } } of getMultiRobots()) { +//// console.log(primaryA); +////} +////for ({ skills: { primary, secondary } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, +//// { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { +//// console.log(primaryA); +////} +////for ({name: nameA, skill: skillA } of robots) { +//// console.log(nameA); +////} +////for ({name: nameA, skill: skillA } of getRobots()) { +//// console.log(nameA); +////} +////for ({name: nameA, skill: skillA } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { +//// console.log(nameA); +////} +////for ({name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of multiRobots) { +//// console.log(nameA); +////} +////for ({name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of getMultiRobots()) { +//// console.log(nameA); +////} +////for ({name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, +//// { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { +//// console.log(nameA); +////} +////for ({name, skill } of robots) { +//// console.log(nameA); +////} +////for ({name, skill } of getRobots()) { +//// console.log(nameA); +////} +////for ({name, skill } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { +//// console.log(nameA); +////} +////for ({name, skills: { primary, secondary } } of multiRobots) { +//// console.log(nameA); +////} +////for ({name, skills: { primary, secondary } } of getMultiRobots()) { +//// console.log(nameA); +////} +////for ({name, skills: { primary, secondary } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, +//// { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { +//// console.log(nameA); +////} +verify.baselineCurrentFileBreakpointLocations(); diff --git a/tests/cases/fourslash/breakpointValidationDestructuringAssignmentForOfObjectBindingPatternDefaultValues.ts b/tests/cases/fourslash/breakpointValidationDestructuringAssignmentForOfObjectBindingPatternDefaultValues.ts new file mode 100644 index 00000000000..2ec090d716d --- /dev/null +++ b/tests/cases/fourslash/breakpointValidationDestructuringAssignmentForOfObjectBindingPatternDefaultValues.ts @@ -0,0 +1,159 @@ +/// + +////declare var console: { +//// log(msg: any): void; +////} +////interface Robot { +//// name: string; +//// skill: string; +////} +////interface MultiRobot { +//// name: string; +//// skills: { +//// primary: string; +//// secondary: string; +//// }; +////} +////let robots: Robot[] = [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]; +////let multiRobots: MultiRobot[] = [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, +//// { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]; +////function getRobots() { +//// return robots; +////} +////function getMultiRobots() { +//// return multiRobots; +////} +////let nameA: string, primaryA: string, secondaryA: string, i: number, skillA: string; +////let name: string, primary: string, secondary: string, skill: string; +////for ({name: nameA = "noName" } of robots) { +//// console.log(nameA); +////} +////for ({name: nameA = "noName" } of getRobots()) { +//// console.log(nameA); +////} +////for ({name: nameA = "noName" } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { +//// console.log(nameA); +////} +////for ({ skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = +//// { primary: "nosKill", secondary: "noSkill" } } of multiRobots) { +//// console.log(primaryA); +////} +////for ({ skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = +//// { primary: "nosKill", secondary: "noSkill" } } of getMultiRobots()) { +//// console.log(primaryA); +////} +////for ({ skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = +//// { primary: "nosKill", secondary: "noSkill" } } of +//// [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, +//// { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { +//// console.log(primaryA); +////} +////for ({ name = "noName" } of robots) { +//// console.log(nameA); +////} +////for ({ name = "noName" } of getRobots()) { +//// console.log(nameA); +////} +////for ({ name = "noName" } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { +//// console.log(nameA); +////} +////for ({ +//// skills: { +//// primary = "primary", +//// secondary = "secondary" +//// } = { primary: "noSkill", secondary: "noSkill" } +////} of multiRobots) { +//// console.log(primaryA); +////} +////for ({ +//// skills: { +//// primary = "primary", +//// secondary = "secondary" +//// } = { primary: "noSkill", secondary: "noSkill" } +////} of getMultiRobots()) { +//// console.log(primaryA); +////} +////for ({ +//// skills: { +//// primary = "primary", +//// secondary = "secondary" +//// } = { primary: "noSkill", secondary: "noSkill" } +////} of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, +//// { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { +//// console.log(primaryA); +////} +////for ({name: nameA = "noName", skill: skillA = "noSkill" } of robots) { +//// console.log(nameA); +////} +////for ({name: nameA = "noName", skill: skillA = "noSkill" } of getRobots()) { +//// console.log(nameA); +////} +////for ({name: nameA = "noName", skill: skillA = "noSkill" } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { +//// console.log(nameA); +////} +////for ({ +//// name: nameA = "noName", +//// skills: { +//// primary: primaryA = "primary", +//// secondary: secondaryA = "secondary" +//// } = { primary: "noSkill", secondary: "noSkill" } +////} of multiRobots) { +//// console.log(nameA); +////} +////for ({ +//// name: nameA = "noName", +//// skills: { +//// primary: primaryA = "primary", +//// secondary: secondaryA = "secondary" +//// } = { primary: "noSkill", secondary: "noSkill" } +////} of getMultiRobots()) { +//// console.log(nameA); +////} +////for ({ +//// name: nameA = "noName", +//// skills: { +//// primary: primaryA = "primary", +//// secondary: secondaryA = "secondary" +//// } = { primary: "noSkill", secondary: "noSkill" } +////} of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, +//// { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { +//// console.log(nameA); +////} +////for ({ name = "noName", skill = "noSkill" } of robots) { +//// console.log(nameA); +////} +////for ({ name = "noName", skill = "noSkill" } of getRobots()) { +//// console.log(nameA); +////} +////for ({ name = "noName", skill = "noSkill" } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { +//// console.log(nameA); +////} +////for ({ +//// name = "noName", +//// skills: { +//// primary = "primary", +//// secondary = "secondary" +//// } = { primary: "noSkill", secondary: "noSkill" } +////} of multiRobots) { +//// console.log(nameA); +////} +////for ({ +//// name = "noName", +//// skills: { +//// primary = "primary", +//// secondary = "secondary" +//// } = { primary: "noSkill", secondary: "noSkill" } +////} of getMultiRobots()) { +//// console.log(nameA); +////} +////for ({ +//// name = "noName", +//// skills: { +//// primary = "primary", +//// secondary = "secondary" +//// } = { primary: "noSkill", secondary: "noSkill" } +////} of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, +//// { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { +//// console.log(nameA); +////} +verify.baselineCurrentFileBreakpointLocations(); diff --git a/tests/cases/fourslash/breakpointValidationDestructuringAssignmentStatementArrayBindingPattern.ts b/tests/cases/fourslash/breakpointValidationDestructuringAssignmentStatementArrayBindingPattern.ts new file mode 100644 index 00000000000..5fe69b42f1a --- /dev/null +++ b/tests/cases/fourslash/breakpointValidationDestructuringAssignmentStatementArrayBindingPattern.ts @@ -0,0 +1,55 @@ +/// +////declare var console: { +//// log(msg: any): void; +////} +////type Robot = [number, string, string]; +////type MultiSkilledRobot = [string, [string, string]]; +//// +////var robotA: Robot = [1, "mower", "mowing"]; +////var robotB: Robot = [2, "trimmer", "trimming"]; +////var multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; +////var multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; +//// +////let nameA: string, numberB: number, nameB: string, skillB: string; +////let robotAInfo: (number | string)[]; +//// +////let multiSkillB: [string, string], nameMB: string, primarySkillB: string, secondarySkillB: string; +////let multiRobotAInfo: (string | [string, string])[]; +//// +////[, nameA] = robotA; +////[, nameB] = getRobotB(); +////[, nameB] = [2, "trimmer", "trimming"]; +////[, multiSkillB] = multiRobotB; +////[, multiSkillB] = getMultiRobotB(); +////[, multiSkillB] = ["roomba", ["vaccum", "mopping"]]; +//// +////[numberB] = robotB; +////[numberB] = getRobotB(); +////[numberB] = [2, "trimmer", "trimming"]; +////[nameMB] = multiRobotB; +////[nameMB] = getMultiRobotB(); +////[nameMB] = ["trimmer", ["trimming", "edging"]]; +//// +////[numberB, nameB, skillB] = robotB; +////[numberB, nameB, skillB] = getRobotB(); +////[numberB, nameB, skillB] = [2, "trimmer", "trimming"]; +////[nameMB, [primarySkillB, secondarySkillB]] = multiRobotB; +////[nameMB, [primarySkillB, secondarySkillB]] = getMultiRobotB(); +////[nameMB, [primarySkillB, secondarySkillB]] = ["trimmer", ["trimming", "edging"]]; +//// +////[numberB, ...robotAInfo] = robotB; +////[numberB, ...robotAInfo] = getRobotB(); +////[numberB, ...robotAInfo] = [2, "trimmer", "trimming"]; +////[...multiRobotAInfo] = multiRobotA; +////[...multiRobotAInfo] = getMultiRobotB(); +////[...multiRobotAInfo] = ["trimmer", ["trimming", "edging"]]; +//// +////function getRobotB() { +//// return robotB; +////} +//// +////function getMultiRobotB() { +//// return multiRobotB; +////} + +verify.baselineCurrentFileBreakpointLocations(); \ No newline at end of file diff --git a/tests/cases/fourslash/breakpointValidationDestructuringAssignmentStatementArrayBindingPatternDefaultValues.ts b/tests/cases/fourslash/breakpointValidationDestructuringAssignmentStatementArrayBindingPatternDefaultValues.ts new file mode 100644 index 00000000000..354ec145aa4 --- /dev/null +++ b/tests/cases/fourslash/breakpointValidationDestructuringAssignmentStatementArrayBindingPatternDefaultValues.ts @@ -0,0 +1,53 @@ +/// +////declare var console: { +//// log(msg: any): void; +////} +////type Robot = [number, string, string]; +////type MultiSkilledRobot = [string, string[]]; +//// +////var robotA: Robot = [1, "mower", "mowing"]; +////var robotB: Robot = [2, "trimmer", "trimming"]; +////var multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; +////var multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; +//// +////let nameA: string, numberB: number, nameB: string, skillB: string; +////let robotAInfo: (number | string)[]; +//// +////let multiSkillB: string[], nameMB: string, primarySkillB: string, secondarySkillB: string; +////let multiRobotAInfo: (string | string[])[]; +//// +////[, nameA = "helloNoName"] = robotA; +////[, nameB = "helloNoName"] = getRobotB(); +////[, nameB = "helloNoName"] = [2, "trimmer", "trimming"]; +////[, multiSkillB = []] = multiRobotB; +////[, multiSkillB = []] = getMultiRobotB(); +////[, multiSkillB = []] = ["roomba", ["vaccum", "mopping"]]; +//// +////[numberB = -1] = robotB; +////[numberB = -1] = getRobotB(); +////[numberB = -1] = [2, "trimmer", "trimming"]; +////[nameMB = "helloNoName"] = multiRobotB; +////[nameMB = "helloNoName"] = getMultiRobotB(); +////[nameMB = "helloNoName"] = ["trimmer", ["trimming", "edging"]]; +//// +////[numberB = -1, nameB = "helloNoName", skillB = "noSkill"] = robotB; +////[numberB = -1, nameB = "helloNoName", skillB = "noSkill"] = getRobotB(); +////[numberB = -1, nameB = "helloNoName", skillB = "noSkill"] = [2, "trimmer", "trimming"]; +////[nameMB = "helloNoName", [primarySkillB = "noSkill", secondarySkillB = "noSkill"] = []] = multiRobotB; +////[nameMB = "helloNoName", [primarySkillB = "noSkill", secondarySkillB = "noSkill"] = []] = getMultiRobotB(); +////[nameMB = "helloNoName", [primarySkillB = "noSkill", secondarySkillB = "noSkill"] = []] = +//// ["trimmer", ["trimming", "edging"]]; +//// +////[numberB = -1, ...robotAInfo] = robotB; +////[numberB = -1, ...robotAInfo] = getRobotB(); +////[numberB = -1, ...robotAInfo] = [2, "trimmer", "trimming"]; +//// +////function getRobotB() { +//// return robotB; +////} +//// +////function getMultiRobotB() { +//// return multiRobotB; +////} + +verify.baselineCurrentFileBreakpointLocations(); \ No newline at end of file diff --git a/tests/cases/fourslash/breakpointValidationDestructuringForArrayBindingPattern.ts b/tests/cases/fourslash/breakpointValidationDestructuringForArrayBindingPattern.ts new file mode 100644 index 00000000000..c86ac7b0f30 --- /dev/null +++ b/tests/cases/fourslash/breakpointValidationDestructuringForArrayBindingPattern.ts @@ -0,0 +1,95 @@ +/// +////declare var console: { +//// log(msg: any): void; +////} +////type Robot = [number, string, string]; +////type MultiSkilledRobot = [string, [string, string]]; +//// +////let robotA: Robot = [1, "mower", "mowing"]; +////function getRobot() { +//// return robotA; +////} +//// +////let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; +////let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; +////function getMultiRobot() { +//// return multiRobotA; +////} +//// +////for (let [, nameA] = robotA, i = 0; i < 1; i++) { +//// console.log(nameA); +////} +////for (let [, nameA] = getRobot(), i = 0; i < 1; i++) { +//// console.log(nameA); +////} +////for (let [, nameA] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { +//// console.log(nameA); +////} +////for (let [, [primarySkillA, secondarySkillA]] = multiRobotA, i = 0; i < 1; i++) { +//// console.log(primarySkillA); +////} +////for (let [, [primarySkillA, secondarySkillA]] = getMultiRobot(), i = 0; i < 1; i++) { +//// console.log(primarySkillA); +////} +////for (let [, [primarySkillA, secondarySkillA]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { +//// console.log(primarySkillA); +////} +//// +////for (let [numberB] = robotA, i = 0; i < 1; i++) { +//// console.log(numberB); +////} +////for (let [numberB] = getRobot(), i = 0; i < 1; i++) { +//// console.log(numberB); +////} +////for (let [numberB] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { +//// console.log(numberB); +////} +////for (let [nameB] = multiRobotA, i = 0; i < 1; i++) { +//// console.log(nameB); +////} +////for (let [nameB] = getMultiRobot(), i = 0; i < 1; i++) { +//// console.log(nameB); +////} +////for (let [nameB] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { +//// console.log(nameB); +////} +//// +////for (let [numberA2, nameA2, skillA2] = robotA, i = 0; i < 1; i++) { +//// console.log(nameA2); +////} +////for (let [numberA2, nameA2, skillA2] = getRobot(), i = 0; i < 1; i++) { +//// console.log(nameA2); +////} +////for (let [numberA2, nameA2, skillA2] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { +//// console.log(nameA2); +////} +////for (let [nameMA, [primarySkillA, secondarySkillA]] = multiRobotA, i = 0; i < 1; i++) { +//// console.log(nameMA); +////} +////for (let [nameMA, [primarySkillA, secondarySkillA]] = getMultiRobot(), i = 0; i < 1; i++) { +//// console.log(nameMA); +////} +////for (let [nameMA, [primarySkillA, secondarySkillA]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { +//// console.log(nameMA); +////} +//// +////for (let [numberA3, ...robotAInfo] = robotA, i = 0; i < 1; i++) { +//// console.log(numberA3); +////} +////for (let [numberA3, ...robotAInfo] = getRobot(), i = 0; i < 1; i++) { +//// console.log(numberA3); +////} +////for (let [numberA3, ...robotAInfo] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { +//// console.log(numberA3); +////} +////for (let [...multiRobotAInfo] = multiRobotA, i = 0; i < 1; i++) { +//// console.log(multiRobotAInfo); +////} +////for (let [...multiRobotAInfo] = getMultiRobot(), i = 0; i < 1; i++) { +//// console.log(multiRobotAInfo); +////} +////for (let [...multiRobotAInfo] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { +//// console.log(multiRobotAInfo); +////} + +verify.baselineCurrentFileBreakpointLocations(); \ No newline at end of file diff --git a/tests/cases/fourslash/breakpointValidationDestructuringForArrayBindingPatternDefaultValues.ts b/tests/cases/fourslash/breakpointValidationDestructuringForArrayBindingPatternDefaultValues.ts new file mode 100644 index 00000000000..2ea402297b8 --- /dev/null +++ b/tests/cases/fourslash/breakpointValidationDestructuringForArrayBindingPatternDefaultValues.ts @@ -0,0 +1,104 @@ +/// +////declare var console: { +//// log(msg: any): void; +////} +////type Robot = [number, string, string]; +////type MultiSkilledRobot = [string, string[]]; +////let robotA: Robot = [1, "mower", "mowing"]; +////function getRobot() { +//// return robotA; +////} +////let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; +////let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; +////function getMultiRobot() { +//// return multiRobotA; +////} +////for (let [, nameA ="name"] = robotA, i = 0; i < 1; i++) { +//// console.log(nameA); +////} +////for (let [, nameA = "name"] = getRobot(), i = 0; i < 1; i++) { +//// console.log(nameA); +////} +////for (let [, nameA = "name"] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { +//// console.log(nameA); +////} +////for (let [, [ +//// primarySkillA = "primary", +//// secondarySkillA = "secondary" +////] = ["none", "none"]] = multiRobotA, i = 0; i < 1; i++) { +//// console.log(primarySkillA); +////} +////for (let [, [ +//// primarySkillA = "primary", +//// secondarySkillA = "secondary" +////] = ["none", "none"]] = getMultiRobot(), i = 0; i < 1; i++) { +//// console.log(primarySkillA); +////} +////for (let [, [ +//// primarySkillA = "primary", +//// secondarySkillA = "secondary" +////] = ["none", "none"]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { +//// console.log(primarySkillA); +////} +////for (let [numberB = -1] = robotA, i = 0; i < 1; i++) { +//// console.log(numberB); +////} +////for (let [numberB = -1] = getRobot(), i = 0; i < 1; i++) { +//// console.log(numberB); +////} +////for (let [numberB = -1] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { +//// console.log(numberB); +////} +////for (let [nameB = "name"] = multiRobotA, i = 0; i < 1; i++) { +//// console.log(nameB); +////} +////for (let [nameB = "name"] = getMultiRobot(), i = 0; i < 1; i++) { +//// console.log(nameB); +////} +////for (let [nameB = "name"] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { +//// console.log(nameB); +////} +////for (let [numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = robotA, i = 0; i < 1; i++) { +//// console.log(nameA2); +////} +////for (let [numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = getRobot(), i = 0; i < 1; i++) { +//// console.log(nameA2); +////} +////for (let [numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { +//// console.log(nameA2); +////} +////for (let +//// [nameMA = "noName", +//// [ +//// primarySkillA = "primary", +//// secondarySkillA = "secondary" +//// ] = ["none", "none"] +//// ] = multiRobotA, i = 0; i < 1; i++) { +//// console.log(nameMA); +////} +////for (let [nameMA = "noName", +//// [ +//// primarySkillA = "primary", +//// secondarySkillA = "secondary" +//// ] = ["none", "none"] +////] = getMultiRobot(), i = 0; i < 1; i++) { +//// console.log(nameMA); +////} +////for (let [nameMA = "noName", +//// [ +//// primarySkillA = "primary", +//// secondarySkillA = "secondary" +//// ] = ["none", "none"] +////] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { +//// console.log(nameMA); +////} +////for (let [numberA3 = -1, ...robotAInfo] = robotA, i = 0; i < 1; i++) { +//// console.log(numberA3); +////} +////for (let [numberA3 = -1, ...robotAInfo] = getRobot(), i = 0; i < 1; i++) { +//// console.log(numberA3); +////} +////for (let [numberA3 = -1, ...robotAInfo] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { +//// console.log(numberA3); +////} +verify.baselineCurrentFileBreakpointLocations(); \ No newline at end of file diff --git a/tests/cases/fourslash/breakpointValidationDestructuringForObjectBindingPattern.ts b/tests/cases/fourslash/breakpointValidationDestructuringForObjectBindingPattern.ts new file mode 100644 index 00000000000..fedbe748034 --- /dev/null +++ b/tests/cases/fourslash/breakpointValidationDestructuringForObjectBindingPattern.ts @@ -0,0 +1,64 @@ +/// +////declare var console: { +//// log(msg: any): void; +////} +////interface Robot { +//// name: string; +//// skill: string; +////} +////interface MultiRobot { +//// name: string; +//// skills: { +//// primary: string; +//// secondary: string; +//// }; +////} +////let robot: Robot = { name: "mower", skill: "mowing" }; +////let multiRobot: MultiRobot = { name: "mower", skills: { primary: "mowing", secondary: "none" } }; +////function getRobot() { +//// return robot; +////} +////function getMultiRobot() { +//// return multiRobot; +////} +////for (let {name: nameA } = robot, i = 0; i < 1; i++) { +//// console.log(nameA); +////} +////for (let {name: nameA } = getRobot(), i = 0; i < 1; i++) { +//// console.log(nameA); +////} +////for (let {name: nameA } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { +//// console.log(nameA); +////} +////for (let { skills: { primary: primaryA, secondary: secondaryA } } = multiRobot, i = 0; i < 1; i++) { +//// console.log(primaryA); +////} +////for (let { skills: { primary: primaryA, secondary: secondaryA } } = getMultiRobot(), i = 0; i < 1; i++) { +//// console.log(primaryA); +////} +////for (let { skills: { primary: primaryA, secondary: secondaryA } } = +//// { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, +//// i = 0; i < 1; i++) { +//// console.log(primaryA); +////} +////for (let {name: nameA, skill: skillA } = robot, i = 0; i < 1; i++) { +//// console.log(nameA); +////} +////for (let {name: nameA, skill: skillA } = getRobot(), i = 0; i < 1; i++) { +//// console.log(nameA); +////} +////for (let {name: nameA, skill: skillA } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { +//// console.log(nameA); +////} +////for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = multiRobot, i = 0; i < 1; i++) { +//// console.log(primaryA); +////} +////for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = getMultiRobot(), i = 0; i < 1; i++) { +//// console.log(primaryA); +////} +////for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } = +//// { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, +//// i = 0; i < 1; i++) { +//// console.log(primaryA); +////} +verify.baselineCurrentFileBreakpointLocations(); \ No newline at end of file diff --git a/tests/cases/fourslash/breakpointValidationDestructuringForObjectBindingPatternDefaultValues.ts b/tests/cases/fourslash/breakpointValidationDestructuringForObjectBindingPatternDefaultValues.ts new file mode 100644 index 00000000000..9ee1e75b0bf --- /dev/null +++ b/tests/cases/fourslash/breakpointValidationDestructuringForObjectBindingPatternDefaultValues.ts @@ -0,0 +1,96 @@ +/// +////declare var console: { +//// log(msg: any): void; +////} +////interface Robot { +//// name: string; +//// skill: string; +////} +////interface MultiRobot { +//// name: string; +//// skills: { +//// primary?: string; +//// secondary?: string; +//// }; +////} +////let robot: Robot = { name: "mower", skill: "mowing" }; +////let multiRobot: MultiRobot = { name: "mower", skills: { primary: "mowing", secondary: "none" } }; +////function getRobot() { +//// return robot; +////} +////function getMultiRobot() { +//// return multiRobot; +////} +////for (let {name: nameA= "noName" } = robot, i = 0; i < 1; i++) { +//// console.log(nameA); +////} +////for (let {name: nameA = "noName" } = getRobot(), i = 0; i < 1; i++) { +//// console.log(nameA); +////} +////for (let {name: nameA = "noName" } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { +//// console.log(nameA); +////} +////for (let { +//// skills: { +//// primary: primaryA = "primary", +//// secondary: secondaryA = "secondary" +//// } = { primary: "none", secondary: "none" } +////} = multiRobot, i = 0; i < 1; i++) { +//// console.log(primaryA); +////} +////for (let { +//// skills: { +//// primary: primaryA = "primary", +//// secondary: secondaryA = "secondary" +//// } = { primary: "none", secondary: "none" } +////} = getMultiRobot(), i = 0; i < 1; i++) { +//// console.log(primaryA); +////} +////for (let { +//// skills: { +//// primary: primaryA = "primary", +//// secondary: secondaryA = "secondary" +//// } = { primary: "none", secondary: "none" } +////} = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, +//// i = 0; i < 1; i++) { +//// console.log(primaryA); +////} +////for (let {name: nameA = "noName", skill: skillA = "skill" } = robot, i = 0; i < 1; i++) { +//// console.log(nameA); +////} +////for (let {name: nameA = "noName", skill: skillA = "skill" } = getRobot(), i = 0; i < 1; i++) { +//// console.log(nameA); +////} +////for (let {name: nameA = "noName", skill: skillA = "skill" } = { name: "trimmer", skill: "trimming" }, i = 0; i < 1; i++) { +//// console.log(nameA); +////} +////for (let { +//// name: nameA = "noName", +//// skills: { +//// primary: primaryA = "primary", +//// secondary: secondaryA = "secondary" +//// } = { primary: "none", secondary: "none" } +////} = multiRobot, i = 0; i < 1; i++) { +//// console.log(primaryA); +////} +////for (let { +//// name: nameA = "noName", +//// skills: { +//// primary: primaryA = "primary", +//// secondary: secondaryA = "secondary" +//// } = { primary: "none", secondary: "none" } +////} = getMultiRobot(), i = 0; i < 1; i++) { +//// console.log(primaryA); +////} +////for (let { +//// name: nameA = "noName", +//// skills: { +//// primary: primaryA = "primary", +//// secondary: secondaryA = "secondary" +//// } = { primary: "none", secondary: "none" } +////} = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }, +//// i = 0; i < 1; i++) { +//// console.log(primaryA); +////} + +verify.baselineCurrentFileBreakpointLocations(); \ No newline at end of file diff --git a/tests/cases/fourslash/breakpointValidationDestructuringForOfArrayBindingPattern.ts b/tests/cases/fourslash/breakpointValidationDestructuringForOfArrayBindingPattern.ts new file mode 100644 index 00000000000..90a726c9066 --- /dev/null +++ b/tests/cases/fourslash/breakpointValidationDestructuringForOfArrayBindingPattern.ts @@ -0,0 +1,91 @@ +/// +////declare var console: { +//// log(msg: any): void; +////} +////type Robot = [number, string, string]; +////type MultiSkilledRobot = [string, [string, string]]; +////let robotA: Robot = [1, "mower", "mowing"]; +////let robotB: Robot = [2, "trimmer", "trimming"]; +////let robots = [robotA, robotB]; +////function getRobots() { +//// return robots; +////} +////let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; +////let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; +////let multiRobots = [multiRobotA, multiRobotB]; +////function getMultiRobots() { +//// return multiRobots; +////} +////for (let [, nameA] of robots) { +//// console.log(nameA); +////} +////for (let [, nameA] of getRobots()) { +//// console.log(nameA); +////} +////for (let [, nameA] of [robotA, robotB]) { +//// console.log(nameA); +////} +////for (let [, [primarySkillA, secondarySkillA]] of multiRobots) { +//// console.log(primarySkillA); +////} +////for (let [, [primarySkillA, secondarySkillA]] of getMultiRobots()) { +//// console.log(primarySkillA); +////} +////for (let [, [primarySkillA, secondarySkillA]] of [multiRobotA, multiRobotB]) { +//// console.log(primarySkillA); +////} +////for (let [numberB] of robots) { +//// console.log(numberB); +////} +////for (let [numberB] of getRobots()) { +//// console.log(numberB); +////} +////for (let [numberB] of [robotA, robotB]) { +//// console.log(numberB); +////} +////for (let [nameB] of multiRobots) { +//// console.log(nameB); +////} +////for (let [nameB] of getMultiRobots()) { +//// console.log(nameB); +////} +////for (let [nameB] of [multiRobotA, multiRobotB]) { +//// console.log(nameB); +////} +////for (let [numberA2, nameA2, skillA2] of robots) { +//// console.log(nameA2); +////} +////for (let [numberA2, nameA2, skillA2] of getRobots()) { +//// console.log(nameA2); +////} +////for (let [numberA2, nameA2, skillA2] of [robotA, robotB]) { +//// console.log(nameA2); +////} +////for (let [nameMA, [primarySkillA, secondarySkillA]] of multiRobots) { +//// console.log(nameMA); +////} +////for (let [nameMA, [primarySkillA, secondarySkillA]] of getMultiRobots()) { +//// console.log(nameMA); +////} +////for (let [nameMA, [primarySkillA, secondarySkillA]] of [multiRobotA, multiRobotB]) { +//// console.log(nameMA); +////} +////for (let [numberA3, ...robotAInfo] of robots) { +//// console.log(numberA3); +////} +////for (let [numberA3, ...robotAInfo] of getRobots()) { +//// console.log(numberA3); +////} +////for (let [numberA3, ...robotAInfo] of [robotA, robotB]) { +//// console.log(numberA3); +////} +////for (let [...multiRobotAInfo] of multiRobots) { +//// console.log(multiRobotAInfo); +////} +////for (let [...multiRobotAInfo] of getMultiRobots()) { +//// console.log(multiRobotAInfo); +////} +////for (let [...multiRobotAInfo] of [multiRobotA, multiRobotB]) { +//// console.log(multiRobotAInfo); +////} +verify.baselineCurrentFileBreakpointLocations(); \ No newline at end of file diff --git a/tests/cases/fourslash/breakpointValidationDestructuringForOfArrayBindingPatternDefaultValues.ts b/tests/cases/fourslash/breakpointValidationDestructuringForOfArrayBindingPatternDefaultValues.ts new file mode 100644 index 00000000000..12689236080 --- /dev/null +++ b/tests/cases/fourslash/breakpointValidationDestructuringForOfArrayBindingPatternDefaultValues.ts @@ -0,0 +1,100 @@ +/// +////declare var console: { +//// log(msg: any): void; +////} +////type Robot = [number, string, string]; +////type MultiSkilledRobot = [string, [string, string]]; +////let robotA: Robot = [1, "mower", "mowing"]; +////let robotB: Robot = [2, "trimmer", "trimming"]; +////let robots = [robotA, robotB]; +////function getRobots() { +//// return robots; +////} +////let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; +////let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; +////let multiRobots = [multiRobotA, multiRobotB]; +////function getMultiRobots() { +//// return multiRobots; +////} +////for (let [, nameA = "noName"] of robots) { +//// console.log(nameA); +////} +////for (let [, nameA = "noName"] of getRobots()) { +//// console.log(nameA); +////} +////for (let [, nameA = "noName"] of [robotA, robotB]) { +//// console.log(nameA); +////} +////for (let [, [ +//// primarySkillA = "primary", +//// secondarySkillA = "secondary" +////] = ["skill1", "skill2"]] of multiRobots) { +//// console.log(primarySkillA); +////} +////for (let [, [ +//// primarySkillA = "primary", +//// secondarySkillA = "secondary" +////] = ["skill1", "skill2"]] of getMultiRobots()) { +//// console.log(primarySkillA); +////} +////for (let [, [ +//// primarySkillA = "primary", +//// secondarySkillA = "secondary" +////] = ["skill1", "skill2"]] of [multiRobotA, multiRobotB]) { +//// console.log(primarySkillA); +////} +////for (let [numberB = -1] of robots) { +//// console.log(numberB); +////} +////for (let [numberB = -1] of getRobots()) { +//// console.log(numberB); +////} +////for (let [numberB = -1] of [robotA, robotB]) { +//// console.log(numberB); +////} +////for (let [nameB = "noName"] of multiRobots) { +//// console.log(nameB); +////} +////for (let [nameB = "noName"] of getMultiRobots()) { +//// console.log(nameB); +////} +////for (let [nameB = "noName"] of [multiRobotA, multiRobotB]) { +//// console.log(nameB); +////} +////for (let [numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of robots) { +//// console.log(nameA2); +////} +////for (let [numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of getRobots()) { +//// console.log(nameA2); +////} +////for (let [numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of [robotA, robotB]) { +//// console.log(nameA2); +////} +////for (let [nameMA = "noName", [ +//// primarySkillA = "primary", +//// secondarySkillA = "secondary" +////] = ["skill1", "skill2"]] of multiRobots) { +//// console.log(nameMA); +////} +////for (let [nameMA = "noName", [ +//// primarySkillA = "primary", +//// secondarySkillA = "secondary" +////] = ["skill1", "skill2"]] of getMultiRobots()) { +//// console.log(nameMA); +////} +////for (let [nameMA = "noName", [ +//// primarySkillA = "primary", +//// secondarySkillA = "secondary" +////] = ["skill1", "skill2"]] of [multiRobotA, multiRobotB]) { +//// console.log(nameMA); +////} +////for (let [numberA3 = -1, ...robotAInfo] of robots) { +//// console.log(numberA3); +////} +////for (let [numberA3 = -1, ...robotAInfo] of getRobots()) { +//// console.log(numberA3); +////} +////for (let [numberA3 = -1, ...robotAInfo] of [robotA, robotB]) { +//// console.log(numberA3); +////} +verify.baselineCurrentFileBreakpointLocations(); \ No newline at end of file diff --git a/tests/cases/fourslash/breakpointValidationDestructuringForOfObjectBindingPattern.ts b/tests/cases/fourslash/breakpointValidationDestructuringForOfObjectBindingPattern.ts new file mode 100644 index 00000000000..8fc1b29bbc0 --- /dev/null +++ b/tests/cases/fourslash/breakpointValidationDestructuringForOfObjectBindingPattern.ts @@ -0,0 +1,63 @@ +/// +////declare var console: { +//// log(msg: any): void; +////} +////interface Robot { +//// name: string; +//// skill: string; +////} +////interface MultiRobot { +//// name: string; +//// skills: { +//// primary: string; +//// secondary: string; +//// }; +////} +////let robots: Robot[] = [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]; +////let multiRobots: MultiRobot[] = [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, +//// { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]; +////function getRobots() { +//// return robots; +////} +////function getMultiRobots() { +//// return multiRobots; +////} +////for (let {name: nameA } of robots) { +//// console.log(nameA); +////} +////for (let {name: nameA } of getRobots()) { +//// console.log(nameA); +////} +////for (let {name: nameA } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { +//// console.log(nameA); +////} +////for (let { skills: { primary: primaryA, secondary: secondaryA } } of multiRobots) { +//// console.log(primaryA); +////} +////for (let { skills: { primary: primaryA, secondary: secondaryA } } of getMultiRobots()) { +//// console.log(primaryA); +////} +////for (let { skills: { primary: primaryA, secondary: secondaryA } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, +//// { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { +//// console.log(primaryA); +////} +////for (let {name: nameA, skill: skillA } of robots) { +//// console.log(nameA); +////} +////for (let {name: nameA, skill: skillA } of getRobots()) { +//// console.log(nameA); +////} +////for (let {name: nameA, skill: skillA } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { +//// console.log(nameA); +////} +////for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of multiRobots) { +//// console.log(nameA); +////} +////for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of getMultiRobots()) { +//// console.log(nameA); +////} +////for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, +//// { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { +//// console.log(nameA); +////} +verify.baselineCurrentFileBreakpointLocations(); \ No newline at end of file diff --git a/tests/cases/fourslash/breakpointValidationDestructuringForOfObjectBindingPatternDefaultValues.ts b/tests/cases/fourslash/breakpointValidationDestructuringForOfObjectBindingPatternDefaultValues.ts new file mode 100644 index 00000000000..ded0584ec43 --- /dev/null +++ b/tests/cases/fourslash/breakpointValidationDestructuringForOfObjectBindingPatternDefaultValues.ts @@ -0,0 +1,85 @@ +/// +////declare var console: { +//// log(msg: any): void; +////} +////interface Robot { +//// name: string; +//// skill: string; +////} +////interface MultiRobot { +//// name: string; +//// skills: { +//// primary?: string; +//// secondary?: string; +//// }; +////} +////let robots: Robot[] = [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]; +////let multiRobots: MultiRobot[] = [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, +//// { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]; +////function getRobots() { +//// return robots; +////} +////function getMultiRobots() { +//// return multiRobots; +////} +////for (let {name: nameA = "noName" } of robots) { +//// console.log(nameA); +////} +////for (let {name: nameA = "noName" } of getRobots()) { +//// console.log(nameA); +////} +////for (let {name: nameA = "noName" } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { +//// console.log(nameA); +////} +////for (let { skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = +//// { primary: "nosKill", secondary: "noSkill" } } of multiRobots) { +//// console.log(primaryA); +////} +////for (let { skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = +//// { primary: "nosKill", secondary: "noSkill" } } of getMultiRobots()) { +//// console.log(primaryA); +////} +////for (let { skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = +//// { primary: "nosKill", secondary: "noSkill" } } of +//// [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, +//// { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { +//// console.log(primaryA); +////} +////for (let {name: nameA = "noName", skill: skillA = "noSkill" } of robots) { +//// console.log(nameA); +////} +////for (let {name: nameA = "noName", skill: skillA = "noSkill" } of getRobots()) { +//// console.log(nameA); +////} +////for (let {name: nameA = "noName", skill: skillA = "noSkill" } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { +//// console.log(nameA); +////} +////for (let { +//// name: nameA = "noName", +//// skills: { +//// primary: primaryA = "primary", +//// secondary: secondaryA = "secondary" +//// } = { primary: "noSkill", secondary: "noSkill" } +////} of multiRobots) { +//// console.log(nameA); +////} +////for (let { +//// name: nameA = "noName", +//// skills: { +//// primary: primaryA = "primary", +//// secondary: secondaryA = "secondary" +//// } = { primary: "noSkill", secondary: "noSkill" } +////} of getMultiRobots()) { +//// console.log(nameA); +////} +////for (let { +//// name: nameA = "noName", +//// skills: { +//// primary: primaryA = "primary", +//// secondary: secondaryA = "secondary" +//// } = { primary: "noSkill", secondary: "noSkill" } +////} of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, +//// { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { +//// console.log(nameA); +////} +verify.baselineCurrentFileBreakpointLocations(); \ No newline at end of file diff --git a/tests/cases/fourslash/breakpointValidationDestructuringParameterArrayBindingPattern.ts b/tests/cases/fourslash/breakpointValidationDestructuringParameterArrayBindingPattern.ts new file mode 100644 index 00000000000..c3f91122010 --- /dev/null +++ b/tests/cases/fourslash/breakpointValidationDestructuringParameterArrayBindingPattern.ts @@ -0,0 +1,29 @@ +/// + +////declare var console: { +//// log(msg: any): void; +////} +////type Robot = [number, string, string]; +////var robotA: Robot = [1, "mower", "mowing"]; +////function foo1([, nameA]: Robot) { +//// console.log(nameA); +////} +////function foo2([numberB]: Robot) { +//// console.log(numberB); +////} +////function foo3([numberA2, nameA2, skillA2]: Robot) { +//// console.log(nameA2); +////} +////function foo4([numberA3, ...robotAInfo]: Robot) { +//// console.log(robotAInfo); +////} +////foo1(robotA); +////foo1([2, "trimmer", "trimming"]); +////foo2(robotA); +////foo2([2, "trimmer", "trimming"]); +////foo3(robotA); +////foo3([2, "trimmer", "trimming"]); +////foo4(robotA); +////foo4([2, "trimmer", "trimming"]); + +verify.baselineCurrentFileBreakpointLocations(); \ No newline at end of file diff --git a/tests/cases/fourslash/breakpointValidationDestructuringParameterArrayBindingPattern2.ts b/tests/cases/fourslash/breakpointValidationDestructuringParameterArrayBindingPattern2.ts new file mode 100644 index 00000000000..fbedbe4abb0 --- /dev/null +++ b/tests/cases/fourslash/breakpointValidationDestructuringParameterArrayBindingPattern2.ts @@ -0,0 +1,29 @@ +/// + +////declare var console: { +//// log(msg: any): void; +////} +////type Robot = [string, [string, string]]; +////var robotA: Robot = ["trimmer", ["trimming", "edging"]]; +////function foo1([, skillA]: Robot) { +//// console.log(skillA); +////} +////function foo2([nameMB]: Robot) { +//// console.log(nameMB); +////} +////function foo3([nameMA, [primarySkillA, secondarySkillA]]: Robot) { +//// console.log(nameMA); +////} +////function foo4([...multiRobotAInfo]: Robot) { +//// console.log(multiRobotAInfo); +////} +////foo1(robotA); +////foo1(["roomba", ["vaccum", "mopping"]]); +////foo2(robotA); +////foo2(["roomba", ["vaccum", "mopping"]]); +////foo3(robotA); +////foo3(["roomba", ["vaccum", "mopping"]]); +////foo4(robotA); +////foo4(["roomba", ["vaccum", "mopping"]]); + +verify.baselineCurrentFileBreakpointLocations(); \ No newline at end of file diff --git a/tests/cases/fourslash/breakpointValidationDestructuringParameterArrayBindingPatternDefaultValues.ts b/tests/cases/fourslash/breakpointValidationDestructuringParameterArrayBindingPatternDefaultValues.ts new file mode 100644 index 00000000000..275135ca520 --- /dev/null +++ b/tests/cases/fourslash/breakpointValidationDestructuringParameterArrayBindingPatternDefaultValues.ts @@ -0,0 +1,28 @@ +/// +////declare var console: { +//// log(msg: any): void; +////} +////type Robot = [number, string, string]; +////var robotA: Robot = [1, "mower", "mowing"]; +////function foo1([, nameA = "noName"]: Robot = [-1, "name", "skill"]) { +//// console.log(nameA); +////} +////function foo2([numberB = -1]: Robot = [-1, "name", "skill"]) { +//// console.log(numberB); +////} +////function foo3([numberA2 = -1, nameA2 = "name", skillA2 = "skill"]: Robot = [-1, "name", "skill"]) { +//// console.log(nameA2); +////} +////function foo4([numberA3 = -1, ...robotAInfo]: Robot = [-1, "name", "skill"]) { +//// console.log(robotAInfo); +////} +////foo1(robotA); +////foo1([2, "trimmer", "trimming"]); +////foo2(robotA); +////foo2([2, "trimmer", "trimming"]); +////foo3(robotA); +////foo3([2, "trimmer", "trimming"]); +////foo4(robotA); +////foo4([2, "trimmer", "trimming"]); + +verify.baselineCurrentFileBreakpointLocations(); \ No newline at end of file diff --git a/tests/cases/fourslash/breakpointValidationDestructuringParameterArrayBindingPatternDefaultValues2.ts b/tests/cases/fourslash/breakpointValidationDestructuringParameterArrayBindingPatternDefaultValues2.ts new file mode 100644 index 00000000000..17d964618d1 --- /dev/null +++ b/tests/cases/fourslash/breakpointValidationDestructuringParameterArrayBindingPatternDefaultValues2.ts @@ -0,0 +1,25 @@ +/// +////declare var console: { +//// log(msg: any): void; +////} +////type Robot = [string, string[]]; +////var robotA: Robot = ["trimmer", ["trimming", "edging"]]; +////function foo1([, skillA = ["noSkill", "noSkill"]]: Robot= ["name", ["skill1", "skill2"]]) { +//// console.log(skillA); +////} +////function foo2([nameMB = "noName"]: Robot = ["name", ["skill1", "skill2"]]) { +//// console.log(nameMB); +////} +////function foo3([nameMA = "noName", [ +//// primarySkillA = "primary", +//// secondarySkillA = "secondary" +////] = ["noSkill", "noSkill"]]: Robot) { +//// console.log(nameMA); +////} +////foo1(robotA); +////foo1(["roomba", ["vaccum", "mopping"]]); +////foo2(robotA); +////foo2(["roomba", ["vaccum", "mopping"]]); +////foo3(robotA); +////foo3(["roomba", ["vaccum", "mopping"]]); +verify.baselineCurrentFileBreakpointLocations(); \ No newline at end of file diff --git a/tests/cases/fourslash/breakpointValidationDestructuringParameterNestedObjectBindingPattern.ts b/tests/cases/fourslash/breakpointValidationDestructuringParameterNestedObjectBindingPattern.ts new file mode 100644 index 00000000000..34b23d9fca2 --- /dev/null +++ b/tests/cases/fourslash/breakpointValidationDestructuringParameterNestedObjectBindingPattern.ts @@ -0,0 +1,28 @@ +/// +////declare var console: { +//// log(msg: string): void; +////} +////interface Robot { +//// name: string; +//// skills: { +//// primary: string; +//// secondary: string; +//// }; +////} +////var robotA: Robot = { name: "mower", skills: { primary: "mowing", secondary: "none" } }; +////function foo1({ skills: { primary: primaryA, secondary: secondaryA } }: Robot) { +//// console.log(primaryA); +////} +////function foo2({ name: nameC, skills: { primary: primaryB, secondary: secondaryB } }: Robot) { +//// console.log(secondaryB); +////} +////function foo3({ skills }: Robot) { +//// console.log(skills.primary); +////} +////foo1(robotA); +////foo1({ name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }); +////foo2(robotA); +////foo2({ name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }); +////foo3(robotA); +////foo3({ name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }); +verify.baselineCurrentFileBreakpointLocations(); diff --git a/tests/cases/fourslash/breakpointValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts b/tests/cases/fourslash/breakpointValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts new file mode 100644 index 00000000000..8eab866428b --- /dev/null +++ b/tests/cases/fourslash/breakpointValidationDestructuringParameterNestedObjectBindingPatternDefaultValues.ts @@ -0,0 +1,41 @@ +/// +////declare var console: { +//// log(msg: string): void; +////} +////interface Robot { +//// name: string; +//// skills: { +//// primary?: string; +//// secondary?: string; +//// }; +////} +////var robotA: Robot = { name: "mower", skills: { primary: "mowing", secondary: "none" } }; +////function foo1( +//// { +//// skills: { +//// primary: primaryA = "primary", +//// secondary: secondaryA = "secondary" +//// } = { primary: "SomeSkill", secondary: "someSkill" } +//// }: Robot = robotA) { +//// console.log(primaryA); +////} +////function foo2( +//// { +//// name: nameC = "name", +//// skills: { +//// primary: primaryB = "primary", +//// secondary: secondaryB = "secondary" +//// } = { primary: "SomeSkill", secondary: "someSkill" } +//// }: Robot = robotA) { +//// console.log(secondaryB); +////} +////function foo3({ skills = { primary: "SomeSkill", secondary: "someSkill" } }: Robot = robotA) { +//// console.log(skills.primary); +////} +////foo1(robotA); +////foo1({ name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }); +////foo2(robotA); +////foo2({ name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }); +////foo3(robotA); +////foo3({ name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }); +verify.baselineCurrentFileBreakpointLocations(); diff --git a/tests/cases/fourslash/breakpointValidationDestructuringParameterObjectBindingPattern.ts b/tests/cases/fourslash/breakpointValidationDestructuringParameterObjectBindingPattern.ts new file mode 100644 index 00000000000..1e3d7c905d4 --- /dev/null +++ b/tests/cases/fourslash/breakpointValidationDestructuringParameterObjectBindingPattern.ts @@ -0,0 +1,26 @@ +/// +////interface Robot { +//// name: string; +//// skill: string; +////} +////declare var console: { +//// log(msg: string): void; +////} +////var hello = "hello"; +////var robotA: Robot = { name: "mower", skill: "mowing" }; +////function foo1({ name: nameA }: Robot) { +//// console.log(nameA); +////} +////function foo2({ name: nameB, skill: skillB }: Robot) { +//// console.log(nameB); +////} +////function foo3({ name }: Robot) { +//// console.log(name); +////} +////foo1(robotA); +////foo1({ name: "Edger", skill: "cutting edges" }); +////foo2(robotA); +////foo2({ name: "Edger", skill: "cutting edges" }); +////foo3(robotA); +////foo3({ name: "Edger", skill: "cutting edges" }); +verify.baselineCurrentFileBreakpointLocations(); diff --git a/tests/cases/fourslash/breakpointValidationDestructuringParameterObjectBindingPatternDefaultValues.ts b/tests/cases/fourslash/breakpointValidationDestructuringParameterObjectBindingPatternDefaultValues.ts new file mode 100644 index 00000000000..bd87e346f6f --- /dev/null +++ b/tests/cases/fourslash/breakpointValidationDestructuringParameterObjectBindingPatternDefaultValues.ts @@ -0,0 +1,26 @@ +/// +////interface Robot { +//// name?: string; +//// skill?: string; +////} +////declare var console: { +//// log(msg: string): void; +////} +////var hello = "hello"; +////var robotA: Robot = { name: "mower", skill: "mowing" }; +////function foo1({ name: nameA = "" }: Robot = { }) { +//// console.log(nameA); +////} +////function foo2({ name: nameB = "", skill: skillB = "noSkill" }: Robot = {}) { +//// console.log(nameB); +////} +////function foo3({ name = "" }: Robot = {}) { +//// console.log(name); +////} +////foo1(robotA); +////foo1({ name: "Edger", skill: "cutting edges" }); +////foo2(robotA); +////foo2({ name: "Edger", skill: "cutting edges" }); +////foo3(robotA); +////foo3({ name: "Edger", skill: "cutting edges" }); +verify.baselineCurrentFileBreakpointLocations(); diff --git a/tests/cases/fourslash/breakpointValidationDestructuringVariableStatement.ts b/tests/cases/fourslash/breakpointValidationDestructuringVariableStatement.ts new file mode 100644 index 00000000000..311b49c3f95 --- /dev/null +++ b/tests/cases/fourslash/breakpointValidationDestructuringVariableStatement.ts @@ -0,0 +1,22 @@ +/// +////interface Robot { +//// name: string; +//// skill: string; +////} +////declare var console: { +//// log(msg: string): void; +////} +////var hello = "hello"; +////var robotA: Robot = { name: "mower", skill: "mowing" }; +////var robotB: Robot = { name: "trimmer", skill: "trimming" }; +////var { name: nameA } = robotA; +////var { name: nameB, skill: skillB } = robotB; +////var { name: nameC, skill: skillC } = { name: "Edger", skill: "cutting edges" }; +////if (nameA == nameB) { +//// console.log(skillB); +////} +////else { +//// console.log(nameC); +////} + +verify.baselineCurrentFileBreakpointLocations(); \ No newline at end of file diff --git a/tests/cases/fourslash/breakpointValidationDestructuringVariableStatement1.ts b/tests/cases/fourslash/breakpointValidationDestructuringVariableStatement1.ts new file mode 100644 index 00000000000..96dbd9d2ff6 --- /dev/null +++ b/tests/cases/fourslash/breakpointValidationDestructuringVariableStatement1.ts @@ -0,0 +1,30 @@ +/// +////interface Robot { +//// name: string; +//// skill: string; +////} +////declare var console: { +//// log(msg: string): void; +////} +////var hello = "hello"; +////var robotA: Robot = { name: "mower", skill: "mowing" }; +////var robotB: Robot = { name: "trimmer", skill: "trimming" }; +////var a: string, { name: nameA } = robotA; +////var b: string, { name: nameB, skill: skillB } = robotB; +////var c: string, { name: nameC, skill: skillC } = { name: "Edger", skill: "cutting edges" }; +//// +////var { name: nameA } = robotA, a = hello; +////var { name: nameB, skill: skillB } = robotB, b = " hello"; +////var { name: nameC, skill: skillC } = { name: "Edger", skill: "cutting edges" }, c = hello; +//// +////var a = hello, { name: nameA } = robotA, a1= "hello"; +////var b = hello, { name: nameB, skill: skillB } = robotB, b1 = "hello"; +////var c = hello, { name: nameC, skill: skillC } = { name: "Edger", skill: "cutting edges" }, c1 = hello; +////if (nameA == nameB) { +//// console.log(skillB); +////} +////else { +//// console.log(nameC); +////} + +verify.baselineCurrentFileBreakpointLocations(); \ No newline at end of file diff --git a/tests/cases/fourslash/breakpointValidationDestructuringVariableStatementArrayBindingPattern.ts b/tests/cases/fourslash/breakpointValidationDestructuringVariableStatementArrayBindingPattern.ts new file mode 100644 index 00000000000..eb4e3e17027 --- /dev/null +++ b/tests/cases/fourslash/breakpointValidationDestructuringVariableStatementArrayBindingPattern.ts @@ -0,0 +1,15 @@ +/// +////declare var console: { +//// log(msg: string): void; +////} +////type Robot = [number, string, string]; +////var robotA: Robot = [1, "mower", "mowing"]; +////var robotB: Robot = [2, "trimmer", "trimming"]; +////let [, nameA] = robotA; +////let [numberB] = robotB; +////let [numberA2, nameA2, skillA2] = robotA; +////let [numberC2] = [3, "edging", "Trimming edges"]; +////let [numberC, nameC, skillC] = [3, "edging", "Trimming edges"]; +////let [numberA3, ...robotAInfo] = robotA; + +verify.baselineCurrentFileBreakpointLocations(); \ No newline at end of file diff --git a/tests/cases/fourslash/breakpointValidationDestructuringVariableStatementArrayBindingPattern2.ts b/tests/cases/fourslash/breakpointValidationDestructuringVariableStatementArrayBindingPattern2.ts new file mode 100644 index 00000000000..265dae90ab9 --- /dev/null +++ b/tests/cases/fourslash/breakpointValidationDestructuringVariableStatementArrayBindingPattern2.ts @@ -0,0 +1,19 @@ +/// + +////declare var console: { +//// log(msg: string): void; +////} +////type MultiSkilledRobot = [string, [string, string]]; +////var multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; +////var multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; +//// +////let [, skillA] = multiRobotA; +////let [nameMB] = multiRobotB; +////let [nameMA, [primarySkillA, secondarySkillA]] = multiRobotA; +//// +////let [nameMC] = ["roomba", ["vaccum", "mopping"]]; +////let [nameMC2, [primarySkillC, secondarySkillC]] = ["roomba", ["vaccum", "mopping"]]; +//// +////let [...multiRobotAInfo] = multiRobotA; + +verify.baselineCurrentFileBreakpointLocations(); \ No newline at end of file diff --git a/tests/cases/fourslash/breakpointValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.ts b/tests/cases/fourslash/breakpointValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.ts new file mode 100644 index 00000000000..78b0646661e --- /dev/null +++ b/tests/cases/fourslash/breakpointValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.ts @@ -0,0 +1,15 @@ +/// +////declare var console: { +//// log(msg: string): void; +////} +////type Robot = [number, string, string]; +////var robotA: Robot = [1, "mower", "mowing"]; +////var robotB: Robot = [2, "trimmer", "trimming"]; +////let [, nameA = "noName"] = robotA; +////let [numberB = -1] = robotB; +////let [numberA2 = -1, nameA2 = "noName", skillA2 = "noSkill"] = robotA; +////let [numberC2 = -1] = [3, "edging", "Trimming edges"]; +////let [numberC = -1, nameC = "noName", skillC = "noSkill"] = [3, "edging", "Trimming edges"]; +////let [numberA3 = -1, ...robotAInfo] = robotA; + +verify.baselineCurrentFileBreakpointLocations(); \ No newline at end of file diff --git a/tests/cases/fourslash/breakpointValidationDestructuringVariableStatementArrayBindingPatternDefaultValues2.ts b/tests/cases/fourslash/breakpointValidationDestructuringVariableStatementArrayBindingPatternDefaultValues2.ts new file mode 100644 index 00000000000..ac25165696c --- /dev/null +++ b/tests/cases/fourslash/breakpointValidationDestructuringVariableStatementArrayBindingPatternDefaultValues2.ts @@ -0,0 +1,14 @@ +/// +////declare var console: { +//// log(msg: string): void; +////} +////type MultiSkilledRobot = [string, string[]]; +////var multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; +////var multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; +////let [, skillA = ["noSkill", "noSkill"]] = multiRobotA; +////let [nameMB = "noName" ] = multiRobotB; +////let [nameMA = "noName", [primarySkillA = "noSkill", secondarySkillA = "noSkill"] = ["noSkill", "noSkill"]] = multiRobotA; +////let [nameMC = "noName" ] = ["roomba", ["vaccum", "mopping"]]; +////let [nameMC2 = "noName", [primarySkillC = "noSkill", secondarySkillC = "noSkill"] = ["noSkill", "noSkill"]] = ["roomba", ["vaccum", "mopping"]]; + +verify.baselineCurrentFileBreakpointLocations(); \ No newline at end of file diff --git a/tests/cases/fourslash/breakpointValidationDestructuringVariableStatementDefaultValues.ts b/tests/cases/fourslash/breakpointValidationDestructuringVariableStatementDefaultValues.ts new file mode 100644 index 00000000000..0e28887a4c3 --- /dev/null +++ b/tests/cases/fourslash/breakpointValidationDestructuringVariableStatementDefaultValues.ts @@ -0,0 +1,22 @@ +/// +////interface Robot { +//// name: string; +//// skill: string; +////} +////declare var console: { +//// log(msg: string): void; +////} +////var hello = "hello"; +////var robotA: Robot = { name: "mower", skill: "mowing" }; +////var robotB: Robot = { name: "trimmer", skill: "trimming" }; +////var { name: nameA = "" } = robotA; +////var { name: nameB = "", skill: skillB = "" } = robotB; +////var { name: nameC = "", skill: skillC = "" } = { name: "Edger", skill: "cutting edges" }; +////if (nameA == nameB) { +//// console.log(skillB); +////} +////else { +//// console.log(nameC); +////} + +verify.baselineCurrentFileBreakpointLocations(); \ No newline at end of file diff --git a/tests/cases/fourslash/breakpointValidationDestructuringVariableStatementNestedObjectBindingPattern.ts b/tests/cases/fourslash/breakpointValidationDestructuringVariableStatementNestedObjectBindingPattern.ts new file mode 100644 index 00000000000..4656fd5c417 --- /dev/null +++ b/tests/cases/fourslash/breakpointValidationDestructuringVariableStatementNestedObjectBindingPattern.ts @@ -0,0 +1,26 @@ +/// +////declare var console: { +//// log(msg: string): void; +////} +////interface Robot { +//// name: string; +//// skills: { +//// primary: string; +//// secondary: string; +//// }; +////} +////var robotA: Robot = { name: "mower", skills: { primary: "mowing", secondary: "none" } }; +////var robotB: Robot = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }; +//// +////var { skills: { primary: primaryA, secondary: secondaryA } } = robotA; +////var { name: nameB, skills: { primary: primaryB, secondary: secondaryB } } = robotB; +////var { name: nameC, skills: { primary: primaryB, secondary: secondaryB } } = { name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }; +//// +////if (nameB == nameB) { +//// console.log(nameC); +////} +////else { +//// console.log(nameC); +////} + +verify.baselineCurrentFileBreakpointLocations(); \ No newline at end of file diff --git a/tests/cases/fourslash/breakpointValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts b/tests/cases/fourslash/breakpointValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts new file mode 100644 index 00000000000..282e91a57ce --- /dev/null +++ b/tests/cases/fourslash/breakpointValidationDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.ts @@ -0,0 +1,43 @@ +/// +////declare var console: { +//// log(msg: string): void; +////} +////interface Robot { +//// name: string; +//// skills: { +//// primary?: string; +//// secondary?: string; +//// }; +////} +////var robotA: Robot = { name: "mower", skills: { primary: "mowing", secondary: "none" } }; +////var robotB: Robot = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }; +//// +////var { +//// skills: { +//// primary: primaryA = "noSkill", +//// secondary: secondaryA = "noSkill" +//// } = { primary: "noSkill", secondary: "noSkill" } +////} = robotA; +////var { +//// name: nameB = "noNameSpecified", +//// skills: { +//// primary: primaryB = "noSkill", +//// secondary: secondaryB = "noSkill" +//// } = { primary: "noSkill", secondary: "noSkill" } +////} = robotB; +////var { +//// name: nameC = "noNameSpecified", +//// skills: { +//// primary: primaryB = "noSkill", +//// secondary: secondaryB = "noSkill" +//// } = { primary: "noSkill", secondary: "noSkill" } +////} = { name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }; +//// +////if (nameB == nameB) { +//// console.log(nameC); +////} +////else { +//// console.log(nameC); +////} + +verify.baselineCurrentFileBreakpointLocations(); \ No newline at end of file diff --git a/tests/cases/fourslash/cancellationWhenfindingAllRefsOnDefinition.ts b/tests/cases/fourslash/cancellationWhenfindingAllRefsOnDefinition.ts index 09f580bb965..48a698c5a47 100644 --- a/tests/cases/fourslash/cancellationWhenfindingAllRefsOnDefinition.ts +++ b/tests/cases/fourslash/cancellationWhenfindingAllRefsOnDefinition.ts @@ -17,7 +17,7 @@ ////} //@Filename: findAllRefsOnDefinition.ts -////import Second = require("findAllRefsOnDefinition-import"); +////import Second = require("./findAllRefsOnDefinition-import"); //// ////var second = new Second.Test() ////second.start(); diff --git a/tests/cases/fourslash/cloduleAsBaseClass2.ts b/tests/cases/fourslash/cloduleAsBaseClass2.ts index be2072afc43..310ae72d664 100644 --- a/tests/cases/fourslash/cloduleAsBaseClass2.ts +++ b/tests/cases/fourslash/cloduleAsBaseClass2.ts @@ -15,7 +15,7 @@ ////export = A; // @Filename: cloduleAsBaseClass2_1.ts -////import B = require('cloduleAsBaseClass2_0'); +////import B = require('./cloduleAsBaseClass2_0'); ////class D extends B { //// constructor() { //// super(1); diff --git a/tests/cases/fourslash/commentBraceCompletionPosition.ts b/tests/cases/fourslash/commentBraceCompletionPosition.ts new file mode 100644 index 00000000000..23b8240dcaf --- /dev/null +++ b/tests/cases/fourslash/commentBraceCompletionPosition.ts @@ -0,0 +1,23 @@ +/// + +//// /** +//// * inside jsdoc /*1*/ +//// */ +//// function f() { +//// // inside regular comment /*2*/ +//// var c = ""; +//// +//// /* inside multi- +//// line comment /*3*/ +//// */ +//// var y =12; +//// } + +goTo.marker('1'); +verify.not.isValidBraceCompletionAtPostion('('); + +goTo.marker('2'); +verify.not.isValidBraceCompletionAtPostion('('); + +goTo.marker('3'); +verify.not.isValidBraceCompletionAtPostion('('); \ No newline at end of file diff --git a/tests/cases/fourslash/commentsClassMembers.ts b/tests/cases/fourslash/commentsClassMembers.ts index 54b4f0253d4..d719253a57b 100644 --- a/tests/cases/fourslash/commentsClassMembers.ts +++ b/tests/cases/fourslash/commentsClassMembers.ts @@ -694,7 +694,7 @@ verify.completionListContains("a", "(parameter) a: number", "this is first param verify.quickInfoIs("(parameter) a: number", "this is first parameter a\nmore info about a"); goTo.marker('116'); -verify.quickInfoIs("class cWithConstructorProperty", ""); +verify.quickInfoIs("this: this", ""); goTo.marker('117'); verify.quickInfoIs("(local var) bbbb: number", ""); diff --git a/tests/cases/fourslash/commentsExternalModules.ts b/tests/cases/fourslash/commentsExternalModules.ts index 088a60d9119..c4bba7c444f 100644 --- a/tests/cases/fourslash/commentsExternalModules.ts +++ b/tests/cases/fourslash/commentsExternalModules.ts @@ -27,7 +27,7 @@ // @Filename: commentsExternalModules_file1.ts /////**This is on import declaration*/ -////import ex/*9*/tMod = require("commentsExternalModules_file0"); +////import ex/*9*/tMod = require("./commentsExternalModules_file0"); /////*10*/extMod./*11*/m1./*12*/fooExp/*13q*/ort(/*13*/); ////var new/*14*/Var = new extMod.m1.m2./*15*/c(); @@ -69,10 +69,10 @@ verify.memberListContains("i", "var m1.m2.i: m1.m2.c", "i"); goTo.file("commentsExternalModules_file1.ts"); goTo.marker('9'); -verify.quickInfoIs('import extMod = require("commentsExternalModules_file0")', "This is on import declaration"); +verify.quickInfoIs('import extMod = require("./commentsExternalModules_file0")', "This is on import declaration"); goTo.marker('10'); -verify.completionListContains("extMod", 'import extMod = require("commentsExternalModules_file0")', "This is on import declaration"); +verify.completionListContains("extMod", 'import extMod = require("./commentsExternalModules_file0")', "This is on import declaration"); goTo.marker('11'); verify.memberListContains("m1", "namespace extMod.m1"); diff --git a/tests/cases/fourslash/commentsImportDeclaration.ts b/tests/cases/fourslash/commentsImportDeclaration.ts index 35c6d45330d..884c63253d4 100644 --- a/tests/cases/fourslash/commentsImportDeclaration.ts +++ b/tests/cases/fourslash/commentsImportDeclaration.ts @@ -20,7 +20,7 @@ // @Filename: commentsImportDeclaration_file1.ts /////// /////** Import declaration*/ -////import /*3*/extMod = require("commentsImportDeclaration_file0/*4*/"); +////import /*3*/extMod = require("./commentsImportDeclaration_file0/*4*/"); ////extMod./*6*/m1./*7*/fooEx/*8q*/port(/*8*/); ////var new/*9*/Var = new extMod.m1.m2./*10*/c(); @@ -28,7 +28,7 @@ goTo.marker('2'); verify.quickInfoIs("namespace m1", "NamespaceComment"); goTo.marker('3'); -verify.quickInfoIs('import extMod = require("commentsImportDeclaration_file0")', "Import declaration"); +verify.quickInfoIs('import extMod = require("./commentsImportDeclaration_file0")', "Import declaration"); goTo.marker('6'); verify.memberListContains("m1", "namespace extMod.m1"); diff --git a/tests/cases/fourslash/completionEntryOnNarrowedType.ts b/tests/cases/fourslash/completionEntryOnNarrowedType.ts index 714d3390e76..f81572ccebf 100644 --- a/tests/cases/fourslash/completionEntryOnNarrowedType.ts +++ b/tests/cases/fourslash/completionEntryOnNarrowedType.ts @@ -3,10 +3,10 @@ ////function foo(strOrNum: string | number) { //// /*1*/ //// if (typeof strOrNum === "number") { -//// /*2*/ +//// strOrNum/*2*/; //// } //// else { -//// /*3*/ +//// strOrNum/*3*/; //// } ////} diff --git a/tests/cases/fourslash/completionInJsDoc.ts b/tests/cases/fourslash/completionInJsDoc.ts index 80516303856..e5cc7a3d2b6 100644 --- a/tests/cases/fourslash/completionInJsDoc.ts +++ b/tests/cases/fourslash/completionInJsDoc.ts @@ -23,11 +23,8 @@ ////// @pa/*7*/ ////var v7; //// -/////** @param { n/*8*/ } */ +/////** @return { n/*8*/ } */ ////var v8; -//// -/////** @return { n/*9*/ } */ -////var v9; goTo.marker('1'); verify.completionListContains("constructor"); @@ -57,6 +54,3 @@ verify.completionListIsEmpty(); goTo.marker('8'); verify.completionListContains('number'); -goTo.marker('9'); -verify.completionListContains('number'); - diff --git a/tests/cases/fourslash/completionInNamedImportLocation.ts b/tests/cases/fourslash/completionInNamedImportLocation.ts new file mode 100644 index 00000000000..596de652cc3 --- /dev/null +++ b/tests/cases/fourslash/completionInNamedImportLocation.ts @@ -0,0 +1,23 @@ +/// + +// @Filename: file.ts +////export var x = 10; +////export var y = 10; +////export default class C { +////} + + +// @Filename: a.ts +////import { /*1*/ } from "./file"; +////import { x, /*2*/ } from "./file"; + +goTo.file("a.ts"); +goTo.marker('1'); +verify.completionListContains("x", "var x: number"); +verify.completionListContains("y", "var y: number"); +verify.not.completionListContains("C"); + +goTo.marker('2'); +verify.not.completionListContains("x", "var x: number"); +verify.completionListContains("y", "var y: number"); +verify.not.completionListContains("C"); \ No newline at end of file diff --git a/tests/cases/fourslash/completionListEnumMembers.ts b/tests/cases/fourslash/completionListEnumMembers.ts index 9c24f6228b0..4f81af5a845 100644 --- a/tests/cases/fourslash/completionListEnumMembers.ts +++ b/tests/cases/fourslash/completionListEnumMembers.ts @@ -21,4 +21,4 @@ verify.memberListCount(0); goTo.marker('enumValueReference'); verify.memberListContains("toString"); verify.memberListContains("toFixed"); -verify.memberListCount(5); +verify.memberListCount(6); diff --git a/tests/cases/fourslash/completionListForTransitivelyExportedMembers01.ts b/tests/cases/fourslash/completionListForTransitivelyExportedMembers01.ts index 017b04592c1..c9fe659cd91 100644 --- a/tests/cases/fourslash/completionListForTransitivelyExportedMembers01.ts +++ b/tests/cases/fourslash/completionListForTransitivelyExportedMembers01.ts @@ -24,11 +24,11 @@ // @Filename: C.ts ////export var cVar = "see!"; -////export * from "A"; -////export * from "B" +////export * from "./A"; +////export * from "./B" // @Filename: D.ts -////import * as c from "C"; +////import * as c from "./C"; ////var x = c./**/ goTo.marker(); diff --git a/tests/cases/fourslash/completionListForTransitivelyExportedMembers02.ts b/tests/cases/fourslash/completionListForTransitivelyExportedMembers02.ts index 868859746b4..6f2e2f490b1 100644 --- a/tests/cases/fourslash/completionListForTransitivelyExportedMembers02.ts +++ b/tests/cases/fourslash/completionListForTransitivelyExportedMembers02.ts @@ -25,11 +25,11 @@ // @Filename: C.ts ////export var cVar = "see!"; -////export * from "A"; -////export * from "B" +////export * from "./A"; +////export * from "./B" // @Filename: D.ts -////import * as c from "C"; +////import * as c from "./C"; ////var x = c.Inner./**/ goTo.marker(); diff --git a/tests/cases/fourslash/completionListForTransitivelyExportedMembers03.ts b/tests/cases/fourslash/completionListForTransitivelyExportedMembers03.ts index 78ef3ec7c72..ae92a706e50 100644 --- a/tests/cases/fourslash/completionListForTransitivelyExportedMembers03.ts +++ b/tests/cases/fourslash/completionListForTransitivelyExportedMembers03.ts @@ -25,11 +25,11 @@ // @Filename: C.ts ////export var cVar = "see!"; -////export * from "A"; -////export * from "B" +////export * from "./A"; +////export * from "./B" // @Filename: D.ts -////import * as c from "C"; +////import * as c from "./C"; ////var x: c./**/ goTo.marker(); diff --git a/tests/cases/fourslash/completionListForTransitivelyExportedMembers04.ts b/tests/cases/fourslash/completionListForTransitivelyExportedMembers04.ts index 114e370d31d..44f2bf224ad 100644 --- a/tests/cases/fourslash/completionListForTransitivelyExportedMembers04.ts +++ b/tests/cases/fourslash/completionListForTransitivelyExportedMembers04.ts @@ -1,5 +1,5 @@ /// - +// @ModuleResolution: classic // @Filename: A.ts ////export interface I1 { one: number } diff --git a/tests/cases/fourslash/completionListInExportClause01.ts b/tests/cases/fourslash/completionListInExportClause01.ts index 12726444bd2..741a1ac333c 100644 --- a/tests/cases/fourslash/completionListInExportClause01.ts +++ b/tests/cases/fourslash/completionListInExportClause01.ts @@ -6,11 +6,11 @@ ////export function baz() { return 10; } // @Filename: m2.ts -////export {/*1*/, /*2*/ from "m1" -////export {/*3*/} from "m1" -////export {foo,/*4*/ from "m1" -////export {bar as /*5*/, /*6*/ from "m1" -////export {foo, bar, baz as b,/*7*/} from "m1" +////export {/*1*/, /*2*/ from "./m1" +////export {/*3*/} from "./m1" +////export {foo,/*4*/ from "./m1" +////export {bar as /*5*/, /*6*/ from "./m1" +////export {foo, bar, baz as b,/*7*/} from "./m1" function verifyCompletionAtMarker(marker: string, showBuilder: boolean, ...completions: string[]) { goTo.marker(marker); diff --git a/tests/cases/fourslash/completionListInImportClause01.ts b/tests/cases/fourslash/completionListInImportClause01.ts index 2b679ffe550..fb2beadc566 100644 --- a/tests/cases/fourslash/completionListInImportClause01.ts +++ b/tests/cases/fourslash/completionListInImportClause01.ts @@ -1,4 +1,5 @@ /// +// @ModuleResolution: classic // @Filename: m1.ts ////export var foo: number = 1; diff --git a/tests/cases/fourslash/declarationExpressions.ts b/tests/cases/fourslash/declarationExpressions.ts new file mode 100644 index 00000000000..7f2a64d8ecf --- /dev/null +++ b/tests/cases/fourslash/declarationExpressions.ts @@ -0,0 +1,30 @@ +/// + +////class A {} +////const B = class C { +//// public x; +////}; +////function D() {} +////const E = function F() {} +////console.log(function() {}, class {}); // Expression with no name should have no effect. +////console.log(function inner() {}); +////String(function fun() { class cls { public prop; } })); + +function navExact(name: string, kind: string) { + verify.navigationItemsListContains(name, kind, name, "exact"); +} + +navExact("A", "class"); +navExact("B", "const"); +navExact("C", "class"); +navExact("x", "property"); + +navExact("D", "function"); +navExact("E", "const"); +navExact("F", "function") + +navExact("inner", "function"); + +navExact("fun", "function"); +navExact("cls", "class"); +navExact("prop", "property"); diff --git a/tests/cases/fourslash/definition.ts b/tests/cases/fourslash/definition.ts index f403965fe12..13abe094376 100644 --- a/tests/cases/fourslash/definition.ts +++ b/tests/cases/fourslash/definition.ts @@ -1,7 +1,7 @@ /// // @Filename: b.ts -////import n = require('a/*1*/'); +////import n = require('./a/*1*/'); ////var x = new n.Foo(); // @Filename: a.ts diff --git a/tests/cases/fourslash/deleteClassWithEnumPresent.ts b/tests/cases/fourslash/deleteClassWithEnumPresent.ts index 2b7a02ec717..29f7c61e259 100644 --- a/tests/cases/fourslash/deleteClassWithEnumPresent.ts +++ b/tests/cases/fourslash/deleteClassWithEnumPresent.ts @@ -5,4 +5,4 @@ goTo.marker(); edit.deleteAtCaret('class Bar { }'.length); -verify.getScriptLexicalStructureListContains('Foo', 'enum', 'tests/cases/fourslash/deleteClassWithEnumPresent.ts', ''); \ No newline at end of file +verify.navigationBarContains('Foo', 'enum', 'tests/cases/fourslash/deleteClassWithEnumPresent.ts', ''); \ No newline at end of file diff --git a/tests/cases/fourslash/documentHighlightAtInheritedProperties1.ts b/tests/cases/fourslash/documentHighlightAtInheritedProperties1.ts new file mode 100644 index 00000000000..23f6445a004 --- /dev/null +++ b/tests/cases/fourslash/documentHighlightAtInheritedProperties1.ts @@ -0,0 +1,13 @@ +/// + +// @Filename: file1.ts +//// interface interface1 extends interface1 { +//// /*1*/doStuff(): void; +//// /*2*/propName: string; +//// } + +let markers = test.markers() +for (let marker of markers) { + goTo.position(marker.position); + verify.documentHighlightsAtPositionCount(1, ["file1.ts"]); +} diff --git a/tests/cases/fourslash/documentHighlightAtInheritedProperties2.ts b/tests/cases/fourslash/documentHighlightAtInheritedProperties2.ts new file mode 100644 index 00000000000..d4aadf96ed6 --- /dev/null +++ b/tests/cases/fourslash/documentHighlightAtInheritedProperties2.ts @@ -0,0 +1,13 @@ +/// + +// @Filename: file1.ts +//// class class1 extends class1 { +//// /*1*/doStuff() { } +//// /*2*/propName: string; +//// } + +let markers = test.markers() +for (let marker of markers) { + goTo.position(marker.position); + verify.documentHighlightsAtPositionCount(1, ["file1.ts"]); +} \ No newline at end of file diff --git a/tests/cases/fourslash/documentHighlightAtInheritedProperties3.ts b/tests/cases/fourslash/documentHighlightAtInheritedProperties3.ts new file mode 100644 index 00000000000..5e94bb387cd --- /dev/null +++ b/tests/cases/fourslash/documentHighlightAtInheritedProperties3.ts @@ -0,0 +1,17 @@ +/// + +// @Filename: file1.ts +//// interface interface1 extends interface1 { +//// /*1*/doStuff(): void; +//// /*2*/propName: string; +//// } +//// +//// var v: interface1; +//// v./*3*/propName; +//// v./*4*/doStuff(); + +let markers = test.markers() +for (let marker of markers) { + goTo.position(marker.position); + verify.documentHighlightsAtPositionCount(2, ["file1.ts"]); +} diff --git a/tests/cases/fourslash/documentHighlightAtInheritedProperties4.ts b/tests/cases/fourslash/documentHighlightAtInheritedProperties4.ts new file mode 100644 index 00000000000..50f459ebfdb --- /dev/null +++ b/tests/cases/fourslash/documentHighlightAtInheritedProperties4.ts @@ -0,0 +1,17 @@ +/// + +// @Filename: file1.ts +//// class class1 extends class1 { +//// /*1*/doStuff() { } +//// /*2*/propName: string; +//// } +//// +//// var c: class1; +//// c./*3*/doStuff(); +//// c./*4*/propName; + +let markers = test.markers() +for (let marker of markers) { + goTo.position(marker.position); + verify.documentHighlightsAtPositionCount(2, ["file1.ts"]); +} diff --git a/tests/cases/fourslash/documentHighlightAtInheritedProperties5.ts b/tests/cases/fourslash/documentHighlightAtInheritedProperties5.ts new file mode 100644 index 00000000000..b5f4cbb00a7 --- /dev/null +++ b/tests/cases/fourslash/documentHighlightAtInheritedProperties5.ts @@ -0,0 +1,30 @@ +/// + +// @Filename: file1.ts +//// interface C extends D { +//// /*0*/prop0: string; +//// /*1*/prop1: number; +//// } +//// +//// interface D extends C { +//// /*2*/prop0: string; +//// /*3*/prop1: number; +//// } +//// +//// var d: D; +//// d./*4*/prop1; + +goTo.marker("0"); +verify.documentHighlightsAtPositionCount(2, ["file1.ts"]); + +goTo.marker("1"); +verify.documentHighlightsAtPositionCount(3, ["file1.ts"]); + +goTo.marker("2"); +verify.documentHighlightsAtPositionCount(2, ["file1.ts"]); + +goTo.marker("3"); +verify.documentHighlightsAtPositionCount(3, ["file1.ts"]); + +goTo.marker("4"); +verify.documentHighlightsAtPositionCount(3, ["file1.ts"]); \ No newline at end of file diff --git a/tests/cases/fourslash/documentHighlightAtInheritedProperties6.ts b/tests/cases/fourslash/documentHighlightAtInheritedProperties6.ts new file mode 100644 index 00000000000..8f1089e567d --- /dev/null +++ b/tests/cases/fourslash/documentHighlightAtInheritedProperties6.ts @@ -0,0 +1,30 @@ +/// + +// @Filename: file1.ts +//// class C extends D { +//// /*0*/prop0: string; +//// /*1*/prop1: string; +//// } +//// +//// class D extends C { +//// /*2*/prop0: string; +//// /*3*/prop1: string; +//// } +//// +//// var d: D; +//// d./*4*/prop1; + +goTo.marker("0"); +verify.documentHighlightsAtPositionCount(1, ["file1.ts"]); + +goTo.marker("1"); +verify.documentHighlightsAtPositionCount(1, ["file1.ts"]); + +goTo.marker("2"); +verify.documentHighlightsAtPositionCount(1, ["file1.ts"]); + +goTo.marker("3"); +verify.documentHighlightsAtPositionCount(2, ["file1.ts"]); + +goTo.marker("4"); +verify.documentHighlightsAtPositionCount(2, ["file1.ts"]); \ No newline at end of file diff --git a/tests/cases/fourslash/exportEqualCallableInterface.ts b/tests/cases/fourslash/exportEqualCallableInterface.ts index 9ac54b31363..795df0c8695 100644 --- a/tests/cases/fourslash/exportEqualCallableInterface.ts +++ b/tests/cases/fourslash/exportEqualCallableInterface.ts @@ -9,7 +9,7 @@ // @Filename: exportEqualCallableInterface_file1.ts /////// -////import test = require('exportEqualCallableInterface_file0'); +////import test = require('./exportEqualCallableInterface_file0'); ////var t2: test; ////t2./**/ diff --git a/tests/cases/fourslash/exportEqualTypes.ts b/tests/cases/fourslash/exportEqualTypes.ts index 3fa3b71fef6..5da26aeb838 100644 --- a/tests/cases/fourslash/exportEqualTypes.ts +++ b/tests/cases/fourslash/exportEqualTypes.ts @@ -9,13 +9,13 @@ // @Filename: exportEqualTypes_file1.ts /////// -////import test = require('exportEqualTypes_file0'); +////import test = require('./exportEqualTypes_file0'); ////var t: /*1*/test; // var 't' should be of type 'test' ////var /*2*/r1 = t(); // Should return a Date ////var /*3*/r2 = t./*4*/foo; // t should have 'foo' in dropdown list and be of type 'string' goTo.marker('1'); -verify.quickInfoIs("import test = require('exportEqualTypes_file0')"); +verify.quickInfoIs("import test = require('./exportEqualTypes_file0')"); goTo.marker('2'); verify.quickInfoIs('var r1: Date'); goTo.marker('3'); diff --git a/tests/cases/fourslash/externalModuleIntellisense.ts b/tests/cases/fourslash/externalModuleIntellisense.ts index 4d909ceed21..93c7143a9c6 100644 --- a/tests/cases/fourslash/externalModuleIntellisense.ts +++ b/tests/cases/fourslash/externalModuleIntellisense.ts @@ -14,7 +14,7 @@ // @Filename: externalModuleIntellisense_file1.ts /////// -////import express = require('externalModuleIntellisense_file0'); +////import express = require('./externalModuleIntellisense_file0'); ////var x = express();/*1*/ goTo.marker('1'); diff --git a/tests/cases/fourslash/externalModuleWithExportAssignment.ts b/tests/cases/fourslash/externalModuleWithExportAssignment.ts index 09798ec5492..5d7e60f6ee5 100644 --- a/tests/cases/fourslash/externalModuleWithExportAssignment.ts +++ b/tests/cases/fourslash/externalModuleWithExportAssignment.ts @@ -18,7 +18,7 @@ ////export = m2; // @Filename: externalModuleWithExportAssignment_file1.ts -////import /*1*/a1 = require("externalModuleWithExportAssignment_file0"); +////import /*1*/a1 = require("./externalModuleWithExportAssignment_file0"); ////export var /*2*/a = a1; ////a./*3*/test1(/*4*/null, null, null); ////var /*6*/r1 = a.test2(/*5*/); @@ -30,7 +30,7 @@ goTo.file("externalModuleWithExportAssignment_file1.ts"); goTo.marker('1'); -verify.quickInfoIs('import a1 = require("externalModuleWithExportAssignment_file0")'); +verify.quickInfoIs('import a1 = require("./externalModuleWithExportAssignment_file0")'); goTo.marker('2'); verify.quickInfoIs("var a: {\n (): a1.connectExport;\n test1: a1.connectModule;\n test2(): a1.connectModule;\n}", undefined); diff --git a/tests/cases/fourslash/findAllRefsForComputedProperties.ts b/tests/cases/fourslash/findAllRefsForComputedProperties.ts new file mode 100644 index 00000000000..3ea226b3ce4 --- /dev/null +++ b/tests/cases/fourslash/findAllRefsForComputedProperties.ts @@ -0,0 +1,24 @@ +/// + + +////interface I { +//// ["[|prop1|]"]: () => void; +////} +//// +////class C implements I { +//// ["[|prop1|]"]: any; +////} +//// +////var x: I = { +//// ["[|prop1|]"]: function () { }, +////} + +let ranges = test.ranges(); +for (let range of ranges) { + goTo.position(range.start); + + verify.referencesCountIs(ranges.length); + for (let expectedReference of ranges) { + verify.referencesAtPositionContains(expectedReference); + } +} \ No newline at end of file diff --git a/tests/cases/fourslash/findAllRefsForComputedProperties2.ts b/tests/cases/fourslash/findAllRefsForComputedProperties2.ts new file mode 100644 index 00000000000..b9f6e9538eb --- /dev/null +++ b/tests/cases/fourslash/findAllRefsForComputedProperties2.ts @@ -0,0 +1,23 @@ +/// + +////interface I { +//// [[|42|]](): void; +////} +//// +////class C implements I { +//// [[|42|]]: any; +////} +//// +////var x: I = { +//// ["[|42|]"]: function () { } +////} + +let ranges = test.ranges(); +for (let range of ranges) { + goTo.position(range.start); + + verify.referencesCountIs(ranges.length); + for (let expectedReference of ranges) { + verify.referencesAtPositionContains(expectedReference); + } +} \ No newline at end of file diff --git a/tests/cases/fourslash/findAllRefsForObjectLiteralProperties.ts b/tests/cases/fourslash/findAllRefsForObjectLiteralProperties.ts new file mode 100644 index 00000000000..cb5e702dc90 --- /dev/null +++ b/tests/cases/fourslash/findAllRefsForObjectLiteralProperties.ts @@ -0,0 +1,20 @@ +/// + +////var x = { +//// [|property|]: {} +////}; +//// +////x.[|property|]; +//// +////let {[|property|]: pVar} = x; + + +let ranges = test.ranges(); +for (let range of ranges) { + goTo.position(range.start); + + verify.referencesCountIs(ranges.length); + for (let expectedReference of ranges) { + verify.referencesAtPositionContains(expectedReference); + } +} \ No newline at end of file diff --git a/tests/cases/fourslash/findAllRefsForStringLiteralTypes.ts b/tests/cases/fourslash/findAllRefsForStringLiteralTypes.ts new file mode 100644 index 00000000000..dcf7240312c --- /dev/null +++ b/tests/cases/fourslash/findAllRefsForStringLiteralTypes.ts @@ -0,0 +1,14 @@ +/// + +////type Options = "[|option 1|]" | "option 2"; +////let myOption: Options = "[|option 1|]"; + +let ranges = test.ranges(); +for (let range of ranges) { + goTo.position(range.start); + + verify.referencesCountIs(ranges.length); + for (let expectedReference of ranges) { + verify.referencesAtPositionContains(expectedReference); + } +} \ No newline at end of file diff --git a/tests/cases/fourslash/findAllRefsInClassExpression.ts b/tests/cases/fourslash/findAllRefsInClassExpression.ts new file mode 100644 index 00000000000..951acdd336c --- /dev/null +++ b/tests/cases/fourslash/findAllRefsInClassExpression.ts @@ -0,0 +1,16 @@ +/// + +////interface I { [|boom|](): void; } +////new class C implements I { +//// [|boom|](){} +////} + +let ranges = test.ranges() +for (let range of ranges) { + goTo.position(range.start); + + verify.referencesCountIs(ranges.length); + for (let expectedReference of ranges) { + verify.referencesAtPositionContains(expectedReference); + } +} \ No newline at end of file diff --git a/tests/cases/fourslash/findAllRefsInheritedProperties1.ts b/tests/cases/fourslash/findAllRefsInheritedProperties1.ts new file mode 100644 index 00000000000..b2755923d37 --- /dev/null +++ b/tests/cases/fourslash/findAllRefsInheritedProperties1.ts @@ -0,0 +1,25 @@ +/// + +//// class class1 extends class1 { +//// [|doStuff|]() { } +//// [|propName|]: string; +//// } +//// +//// var v: class1; +//// v.[|doStuff|](); +//// v.[|propName|]; + +function verifyReferences(query: FourSlashInterface.Range, references: FourSlashInterface.Range[]) { + goTo.position(query.start); + for (const ref of references) { + verify.referencesAtPositionContains(ref); + } +} + +const ranges = test.ranges(); +verify.assertHasRanges(ranges); +const [r0, r1, r2, r3] = ranges; +verifyReferences(r0, [r0, r2]); +verifyReferences(r1, [r1, r3]); +verifyReferences(r2, [r0, r2]); +verifyReferences(r3, [r1, r3]); \ No newline at end of file diff --git a/tests/cases/fourslash/findAllRefsInheritedProperties2.ts b/tests/cases/fourslash/findAllRefsInheritedProperties2.ts new file mode 100644 index 00000000000..1ab92c251da --- /dev/null +++ b/tests/cases/fourslash/findAllRefsInheritedProperties2.ts @@ -0,0 +1,25 @@ +/// + +//// interface interface1 extends interface1 { +//// [|doStuff|](): void; // r0 +//// [|propName|]: string; // r1 +//// } +//// +//// var v: interface1; +//// v.[|doStuff|](); // r2 +//// v.[|propName|]; // r3 + +function verifyReferences(query: FourSlashInterface.Range, references: FourSlashInterface.Range[]) { + goTo.position(query.start); + for (const ref of references) { + verify.referencesAtPositionContains(ref); + } +} + +const ranges = test.ranges(); +verify.assertHasRanges(ranges); +const [r0, r1, r2, r3] = ranges; +verifyReferences(r0, [r0, r2]); +verifyReferences(r1, [r1, r3]); +verifyReferences(r2, [r0, r2]); +verifyReferences(r3, [r1, r3]); \ No newline at end of file diff --git a/tests/cases/fourslash/findAllRefsInheritedProperties3.ts b/tests/cases/fourslash/findAllRefsInheritedProperties3.ts new file mode 100644 index 00000000000..9a46b08f357 --- /dev/null +++ b/tests/cases/fourslash/findAllRefsInheritedProperties3.ts @@ -0,0 +1,37 @@ +/// + +//// class class1 extends class1 { +//// [|doStuff|]() { } // r0 +//// [|propName|]: string; // r1 +//// } +//// interface interface1 extends interface1 { +//// [|doStuff|](): void; // r2 +//// [|propName|]: string; // r3 +//// } +//// class class2 extends class1 implements interface1 { +//// [|doStuff|]() { } // r4 +//// [|propName|]: string; // r5 +//// } +//// +//// var v: class2; +//// v.[|propName|]; // r6 +//// v.[|doStuff|](); // r7 + +function verifyReferences(query: FourSlashInterface.Range, references: FourSlashInterface.Range[]) { + goTo.position(query.start); + for (const ref of references) { + verify.referencesAtPositionContains(ref); + } +} + +const ranges = test.ranges(); +verify.assertHasRanges(ranges); +const [r0, r1, r2, r3, r4, r5, r6, r7] = ranges; +verifyReferences(r0, [r0]); +verifyReferences(r1, [r1, r5, r6]); +verifyReferences(r2, [r2, r4, r7]); +verifyReferences(r3, [r3, r5, r6]); +verifyReferences(r4, [r2, r4, r7]); +verifyReferences(r5, [r1, r3, r5, r6]); +verifyReferences(r6, [r1, r3, r5, r6]); +verifyReferences(r7, [r2, r4, r7]); \ No newline at end of file diff --git a/tests/cases/fourslash/findAllRefsInheritedProperties4.ts b/tests/cases/fourslash/findAllRefsInheritedProperties4.ts new file mode 100644 index 00000000000..bcd41331f73 --- /dev/null +++ b/tests/cases/fourslash/findAllRefsInheritedProperties4.ts @@ -0,0 +1,30 @@ +/// + +//// interface C extends D { +//// [|prop0|]: string; // r0 +//// [|prop1|]: number; // r1 +//// } +//// +//// interface D extends C { +//// [|prop0|]: string; // r2 +//// } +//// +//// var d: D; +//// d.[|prop0|]; // r3 +//// d.[|prop1|]; // r4 + +function verifyReferences(query: FourSlashInterface.Range, references: FourSlashInterface.Range[]) { + goTo.position(query.start); + for (const ref of references) { + verify.referencesAtPositionContains(ref); + } +} + +const ranges = test.ranges(); +verify.assertHasRanges(ranges); +const [r0, r1, r2, r3, r4] = ranges; +verifyReferences(r0, [r0, r2, r3]); +verifyReferences(r1, [r1]); +verifyReferences(r2, [r0, r2, r3]); +verifyReferences(r3, [r0, r2, r3]); +verifyReferences(r4, []); \ No newline at end of file diff --git a/tests/cases/fourslash/findAllRefsInheritedProperties5.ts b/tests/cases/fourslash/findAllRefsInheritedProperties5.ts new file mode 100644 index 00000000000..d4e02a36b09 --- /dev/null +++ b/tests/cases/fourslash/findAllRefsInheritedProperties5.ts @@ -0,0 +1,30 @@ +/// + +//// class C extends D { +//// [|prop0|]: string; // r0 +//// [|prop1|]: number; // r1 +//// } +//// +//// class D extends C { +//// [|prop0|]: string; // r2 +//// } +//// +//// var d: D; +//// d.[|prop0|]; // r3 +//// d.[|prop1|]; // r4 + +function verifyReferences(query: FourSlashInterface.Range, references: FourSlashInterface.Range[]) { + goTo.position(query.start); + for (const ref of references) { + verify.referencesAtPositionContains(ref); + } +} + +const ranges = test.ranges(); +verify.assertHasRanges(ranges); +const [r0, r1, r2, r3, r4] = ranges; +verifyReferences(r0, [r0]); +verifyReferences(r1, [r1]); +verifyReferences(r2, [r2, r3]); +verifyReferences(r3, [r2, r3]); +verifyReferences(r4, []); diff --git a/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName03.ts b/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName03.ts index 304fa9e42e9..8dc2b1e7bb8 100644 --- a/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName03.ts +++ b/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName03.ts @@ -6,7 +6,7 @@ ////} //// ////var foo: I; -////var [{ [|property1|]: prop1 }, { property1, property2 } ] = [foo, foo]; +////var [{ [|property1|]: prop1 }, { [|property1|], property2 } ] = [foo, foo]; let ranges = test.ranges(); for (let range of ranges) { diff --git a/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName04.ts b/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName04.ts index bdb37525f71..dfa0997774e 100644 --- a/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName04.ts +++ b/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName04.ts @@ -6,14 +6,12 @@ ////} //// ////function f({ /**/[|property1|]: p1 }: I, -//// { /*SHOULD_BE_A_REFERENCE*/property1 }: I, +//// { [|property1|] }: I, //// { property1: p2 }) { //// -//// return property1 + 1; +//// return [|property1|] + 1; ////} -// NOTE: In the future, the identifier at -// SHOULD_BE_A_REFERENCE should be in the set of ranges. goTo.marker(); let ranges = test.ranges(); diff --git a/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName06.ts b/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName06.ts index 67c7029861e..379d1d4d5f5 100644 --- a/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName06.ts +++ b/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName06.ts @@ -8,12 +8,12 @@ ////var elems: I[]; ////for (let { [|property1|]: p } of elems) { ////} -////for (let { property1 } of elems) { +////for (let { [|property1|] } of elems) { ////} ////for (var { [|property1|]: p1 } of elems) { ////} ////var p2; -////for ({ property1 : p2 } of elems) { +////for ({ [|property1|] : p2 } of elems) { ////} // Note: if this test ever changes, consider updating diff --git a/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName09.ts b/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName09.ts index e45359bcf1c..0b82c73e31d 100644 --- a/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName09.ts +++ b/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName09.ts @@ -1,19 +1,17 @@ /// ////interface I { -//// /*SHOULD_BE_A_REFERENCE1*/property1: number; +//// [|property1|]: number; //// property2: string; ////} //// -////function f({ /*SHOULD_BE_A_REFERENCE2*/property1: p1 }: I, +////function f({ [|property1|]: p1 }: I, //// { /**/[|property1|] }: I, //// { property1: p2 }) { //// //// return [|property1|] + 1; ////} -// NOTE: In the future, the identifiers at -// SHOULD_BE_A_REFERENCE[1/2] should be in the set of ranges. goTo.marker(); let ranges = test.ranges(); diff --git a/tests/cases/fourslash/findAllRefsOnDefinition.ts b/tests/cases/fourslash/findAllRefsOnDefinition.ts index 34144b74899..a25a6e1285f 100644 --- a/tests/cases/fourslash/findAllRefsOnDefinition.ts +++ b/tests/cases/fourslash/findAllRefsOnDefinition.ts @@ -17,7 +17,7 @@ ////} //@Filename: findAllRefsOnDefinition.ts -////import Second = require("findAllRefsOnDefinition-import"); +////import Second = require("./findAllRefsOnDefinition-import"); //// ////var second = new Second.Test() ////second.start(); diff --git a/tests/cases/fourslash/findAllRefsOnDefinition2.ts b/tests/cases/fourslash/findAllRefsOnDefinition2.ts index 1c03d392e4d..c9a116d4622 100644 --- a/tests/cases/fourslash/findAllRefsOnDefinition2.ts +++ b/tests/cases/fourslash/findAllRefsOnDefinition2.ts @@ -9,7 +9,7 @@ ////} //@Filename: findAllRefsOnDefinition2.ts -////import Second = require("findAllRefsOnDefinition2-import"); +////import Second = require("./findAllRefsOnDefinition2-import"); //// ////var start: Second.Test.start; ////var stop: Second.Test.stop; diff --git a/tests/cases/fourslash/findAllRefsOnImportAliases.ts b/tests/cases/fourslash/findAllRefsOnImportAliases.ts index dbfab33aa86..8460e3f39b2 100644 --- a/tests/cases/fourslash/findAllRefsOnImportAliases.ts +++ b/tests/cases/fourslash/findAllRefsOnImportAliases.ts @@ -5,12 +5,12 @@ ////} //@Filename: b.ts -////import { /*2*/Class } from "a"; +////import { /*2*/Class } from "./a"; //// ////var c = new /*3*/Class(); //@Filename: c.ts -////export { /*4*/Class } from "a"; +////export { /*4*/Class } from "./a"; goTo.file("a.ts"); goTo.marker("1"); diff --git a/tests/cases/fourslash/findAllRefsOnImportAliases2.ts b/tests/cases/fourslash/findAllRefsOnImportAliases2.ts index dca6b13bbd2..ab7a99e1e74 100644 --- a/tests/cases/fourslash/findAllRefsOnImportAliases2.ts +++ b/tests/cases/fourslash/findAllRefsOnImportAliases2.ts @@ -5,12 +5,12 @@ ////} //@Filename: b.ts -////import { /*2*/Class as /*3*/C2} from "a"; +////import { /*2*/Class as /*3*/C2} from "./a"; //// ////var c = new C2(); //@Filename: c.ts -////export { /*4*/Class as /*5*/C3 } from "a"; +////export { /*4*/Class as /*5*/C3 } from "./a"; goTo.file("a.ts"); goTo.marker("1"); diff --git a/tests/cases/fourslash/findReferencesAcrossMultipleProjects.ts b/tests/cases/fourslash/findReferencesAcrossMultipleProjects.ts new file mode 100644 index 00000000000..0ef7745f8f9 --- /dev/null +++ b/tests/cases/fourslash/findReferencesAcrossMultipleProjects.ts @@ -0,0 +1,17 @@ +/// + +//@Filename: a.ts +////var /*1*/x: number; + +//@Filename: b.ts +/////// +////x++; + +//@Filename: c.ts +/////// +////x++; + +goTo.file("a.ts"); +goTo.marker("1"); + +verify.referencesCountIs(3); \ No newline at end of file diff --git a/tests/cases/fourslash/findReferencesJSXTagName.ts b/tests/cases/fourslash/findReferencesJSXTagName.ts new file mode 100644 index 00000000000..a6170b4fc8f --- /dev/null +++ b/tests/cases/fourslash/findReferencesJSXTagName.ts @@ -0,0 +1,22 @@ +/// + +// @Filename: index.tsx +////import { /*1*/SubmissionComp } from "./RedditSubmission" +////function displaySubreddit(subreddit: string) { +//// let components = submissions +//// .map((value, index) => ); +////} + +// @Filename: RedditSubmission.ts +////export const /*3*/SubmissionComp = (submission: SubmissionProps) => +////
; + + +goTo.marker("1"); +verify.referencesCountIs(3); + +goTo.marker("2"); +verify.referencesCountIs(3); + +goTo.marker("3"); +verify.referencesCountIs(3); \ No newline at end of file diff --git a/tests/cases/fourslash/findReferencesJSXTagName2.ts b/tests/cases/fourslash/findReferencesJSXTagName2.ts new file mode 100644 index 00000000000..a7bb7fd97dd --- /dev/null +++ b/tests/cases/fourslash/findReferencesJSXTagName2.ts @@ -0,0 +1,11 @@ +/// + +// @Filename: index.tsx +////const /*1*/obj = {Component: () =>
}; +////const element = ; + +goTo.marker("1"); +verify.referencesCountIs(2); + +goTo.marker("2"); +verify.referencesCountIs(2); \ No newline at end of file diff --git a/tests/cases/fourslash/forIn.ts b/tests/cases/fourslash/forIn.ts index e24e161d96b..855d35917c1 100644 --- a/tests/cases/fourslash/forIn.ts +++ b/tests/cases/fourslash/forIn.ts @@ -5,4 +5,4 @@ goTo.marker(); -verify.quickInfoIs('var p: any', ""); +verify.quickInfoIs('var p: string', ""); diff --git a/tests/cases/fourslash/formatArrayLiteralExpression.ts b/tests/cases/fourslash/formatArrayLiteralExpression.ts new file mode 100644 index 00000000000..9c2224f8414 --- /dev/null +++ b/tests/cases/fourslash/formatArrayLiteralExpression.ts @@ -0,0 +1,45 @@ +/// + +////export let Things = [{ +//// Hat: 'hat', /*1*/ +//// Glove: 'glove', +//// Umbrella: 'umbrella' +////},{/*2*/ +//// Salad: 'salad', /*3*/ +//// Burrito: 'burrito', +//// Pie: 'pie' +//// }];/*4*/ +//// +////export let Things2 = [ +////{ +//// Hat: 'hat', /*5*/ +//// Glove: 'glove', +//// Umbrella: 'umbrella' +////}/*6*/, +//// { +//// Salad: 'salad', /*7*/ +//// Burrito: ['burrito', 'carne asada', 'tinga de res', 'tinga de pollo'], /*8*/ +//// Pie: 'pie' +//// }];/*9*/ + +format.document(); + +goTo.marker("1"); +verify.currentLineContentIs(" Hat: 'hat',"); +goTo.marker("2"); +verify.currentLineContentIs("}, {"); +goTo.marker("3"); +verify.currentLineContentIs(" Salad: 'salad',"); +goTo.marker("4"); +verify.currentLineContentIs("}];"); + +goTo.marker("5"); +verify.currentLineContentIs(" Hat: 'hat',"); +goTo.marker("6"); +verify.currentLineContentIs(" },"); +goTo.marker("7"); +verify.currentLineContentIs(" Salad: 'salad',"); +goTo.marker("8"); +verify.currentLineContentIs(" Burrito: ['burrito', 'carne asada', 'tinga de res', 'tinga de pollo'],"); +goTo.marker("9"); +verify.currentLineContentIs(" }];"); diff --git a/tests/cases/fourslash/formatDocumentWithTrivia.ts b/tests/cases/fourslash/formatDocumentWithTrivia.ts new file mode 100644 index 00000000000..d51677be81d --- /dev/null +++ b/tests/cases/fourslash/formatDocumentWithTrivia.ts @@ -0,0 +1,51 @@ +/// + +//// +////// whitespace below +//// +////// whitespace above +//// +////let x; +//// +////// abc +//// +////let y; +//// +////// whitespace above again +//// +////while (true) { +//// while (true) { +//// } +//// +//// // whitespace above +////} +//// +////// whitespace above again +//// +//// + +format.document(); + +verify.currentFileContentIs(` +// whitespace below + +// whitespace above + +let x; + +// abc + +let y; + +// whitespace above again + +while (true) { + while (true) { + } + + // whitespace above +} + +// whitespace above again + +`); diff --git a/tests/cases/fourslash/formatSelectionWithTrivia2.ts b/tests/cases/fourslash/formatSelectionWithTrivia2.ts new file mode 100644 index 00000000000..06b43009a22 --- /dev/null +++ b/tests/cases/fourslash/formatSelectionWithTrivia2.ts @@ -0,0 +1,10 @@ +/// + +/////*begin*/; +//// +/////*end*/ +//// + +format.selection('begin', 'end'); + +verify.currentFileContentIs(";\n\n\n "); diff --git a/tests/cases/fourslash/formatTemplateLiteral.ts b/tests/cases/fourslash/formatTemplateLiteral.ts index 68f2c8c9469..a10f8dba8f2 100644 --- a/tests/cases/fourslash/formatTemplateLiteral.ts +++ b/tests/cases/fourslash/formatTemplateLiteral.ts @@ -32,9 +32,9 @@ verify.currentLineContentIs("let w = `bar${3}`;"); goTo.marker("5"); verify.currentLineContentIs(" `template`;"); goTo.marker("6"); -verify.currentLineContentIs("String.raw `foo`;"); +verify.currentLineContentIs("String.raw`foo`;"); goTo.marker("7"); -verify.currentLineContentIs("String.raw `bar${3}`;"); +verify.currentLineContentIs("String.raw`bar${3}`;"); goTo.marker("spaceInside"); verify.currentLineContentIs('`Write ${JSON.stringify("")} and ${(765)} and ${346}`;'); \ No newline at end of file diff --git a/tests/cases/fourslash/formattingGlobalAugmentation1.ts b/tests/cases/fourslash/formattingGlobalAugmentation1.ts new file mode 100644 index 00000000000..04991006534 --- /dev/null +++ b/tests/cases/fourslash/formattingGlobalAugmentation1.ts @@ -0,0 +1,8 @@ +/// + +/////*1*/declare global { +////} + +format.document(); +goTo.marker("1"); +verify.currentLineContentIs("declare global {"); \ No newline at end of file diff --git a/tests/cases/fourslash/formattingGlobalAugmentation2.ts b/tests/cases/fourslash/formattingGlobalAugmentation2.ts new file mode 100644 index 00000000000..74f05e1a936 --- /dev/null +++ b/tests/cases/fourslash/formattingGlobalAugmentation2.ts @@ -0,0 +1,10 @@ +/// + +////declare module "A" { +/////*1*/ global { +//// } +////} + +format.document(); +goTo.marker("1"); +verify.currentLineContentIs(" global {"); \ No newline at end of file diff --git a/tests/cases/fourslash/formattingInExpressionsInTsx.ts b/tests/cases/fourslash/formattingInExpressionsInTsx.ts new file mode 100644 index 00000000000..f02a5a5b291 --- /dev/null +++ b/tests/cases/fourslash/formattingInExpressionsInTsx.ts @@ -0,0 +1,14 @@ +/// + +// @Filename: test.tsx +////import * as React from "react"; +////
+////
+ +goTo.marker("1"); +edit.insert(";"); +verify.currentLineContentIs(" return true;"); \ No newline at end of file diff --git a/tests/cases/fourslash/formattingJsxTexts.ts b/tests/cases/fourslash/formattingJsxTexts.ts new file mode 100644 index 00000000000..7772d11d66b --- /dev/null +++ b/tests/cases/fourslash/formattingJsxTexts.ts @@ -0,0 +1,116 @@ +/// + +//@Filename: file.tsx +////; + +format.document(); + +verify.currentFileContentIs(`;`); \ No newline at end of file diff --git a/tests/cases/fourslash/formattingOptionsChange.ts b/tests/cases/fourslash/formattingOptionsChange.ts index cdd8f61a215..f266a8e96c1 100644 --- a/tests/cases/fourslash/formattingOptionsChange.ts +++ b/tests/cases/fourslash/formattingOptionsChange.ts @@ -1,24 +1,26 @@ /// -/////*InsertSpaceAfterCommaDelimiter*/[1,2, 3]; +/////*InsertSpaceAfterCommaDelimiter*/[1,2, 3];[ 72 , ]; /////*InsertSpaceAfterSemicolonInForStatements*/for (i = 0;i; i++); /////*InsertSpaceBeforeAndAfterBinaryOperators*/1+2- 3 /////*InsertSpaceAfterKeywordsInControlFlowStatements*/if (true) { } /////*InsertSpaceAfterFunctionKeywordForAnonymousFunctions*/(function () { }) /////*InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis*/(1 ) -/////*InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets*/[1 ]; [ ]; []; [,] +/////*InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets*/[1 ]; [ ]; []; [,]; +/////*InsertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces*/`${1}`;`${ 1 }` /////*PlaceOpenBraceOnNewLineForFunctions*/class foo { ////} /////*PlaceOpenBraceOnNewLineForControlBlocks*/if (true) { ////} -runTest("InsertSpaceAfterCommaDelimiter", "[1, 2, 3];", "[1,2,3];"); +runTest("InsertSpaceAfterCommaDelimiter", "[1, 2, 3];[72,];", "[1,2,3];[72,];"); runTest("InsertSpaceAfterSemicolonInForStatements", "for (i = 0; i; i++);", "for (i = 0;i;i++);"); runTest("InsertSpaceBeforeAndAfterBinaryOperators", "1 + 2 - 3", "1+2-3"); runTest("InsertSpaceAfterKeywordsInControlFlowStatements", "if (true) { }", "if(true) { }"); runTest("InsertSpaceAfterFunctionKeywordForAnonymousFunctions", "(function () { })", "(function() { })"); runTest("InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis", " ( 1 )", " (1)"); -runTest("InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets", "[ 1 ];[];[];[ , ]", "[1];[];[];[, ]"); +runTest("InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets", "[ 1 ];[];[];[ , ];", "[1];[];[];[,];"); +runTest("InsertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces", "`${ 1 }`; `${ 1 }`", "`${1}`; `${1}`"); runTest("PlaceOpenBraceOnNewLineForFunctions", "class foo", "class foo {"); runTest("PlaceOpenBraceOnNewLineForControlBlocks", "if ( true )", "if ( true ) {"); diff --git a/tests/cases/fourslash/formattingReplaceSpacesWithTabs.ts b/tests/cases/fourslash/formattingReplaceSpacesWithTabs.ts new file mode 100644 index 00000000000..37039c5a7ad --- /dev/null +++ b/tests/cases/fourslash/formattingReplaceSpacesWithTabs.ts @@ -0,0 +1,35 @@ +/// + +////module Foo { +/////*1*/class Test { } +/////*2*/ class Test { } +/////*3*/ class Test { } +/////*4*/ class Test { } +/////*5*/ class Test { } +/////*6*/ class Test { } +/////*7*/ class Test { } +////} + +var options = format.copyFormatOptions(); +options.ConvertTabsToSpaces = false; +var oldOptions = format.setFormatOptions(options); +try { + format.document(); + goTo.marker("1"); + verify.currentLineContentIs("\tclass Test { }") + goTo.marker("2"); + verify.currentLineContentIs("\tclass Test { }") + goTo.marker("3"); + verify.currentLineContentIs("\tclass Test { }") + goTo.marker("4"); + verify.currentLineContentIs("\tclass Test { }") + goTo.marker("5"); + verify.currentLineContentIs("\tclass Test { }") + goTo.marker("6"); + verify.currentLineContentIs("\tclass Test { }") + goTo.marker("7"); + verify.currentLineContentIs("\tclass Test { }") +} +finally { + format.setFormatOptions(oldOptions); +} diff --git a/tests/cases/fourslash/formattingReplaceTabsWithSpaces.ts b/tests/cases/fourslash/formattingReplaceTabsWithSpaces.ts new file mode 100644 index 00000000000..ad5b5508c4f --- /dev/null +++ b/tests/cases/fourslash/formattingReplaceTabsWithSpaces.ts @@ -0,0 +1,27 @@ +/// + +////module Foo { +/////*1*/ class Test { } +/////*2*/ class Test { } +/////*3*/class Test { } +/////*4*/ class Test { } +/////*5*/ class Test { } +/////*6*/ class Test { } +/////*7*/ class Test { } +////} + +format.document(); +goTo.marker("1"); +verify.currentLineContentIs(" class Test { }") +goTo.marker("2"); +verify.currentLineContentIs(" class Test { }") +goTo.marker("3"); +verify.currentLineContentIs(" class Test { }") +goTo.marker("4"); +verify.currentLineContentIs(" class Test { }") +goTo.marker("5"); +verify.currentLineContentIs(" class Test { }") +goTo.marker("6"); +verify.currentLineContentIs(" class Test { }") +goTo.marker("7"); +verify.currentLineContentIs(" class Test { }") diff --git a/tests/cases/fourslash/formattingTemplates.ts b/tests/cases/fourslash/formattingTemplates.ts index c7decd10316..c759376335d 100644 --- a/tests/cases/fourslash/formattingTemplates.ts +++ b/tests/cases/fourslash/formattingTemplates.ts @@ -5,8 +5,8 @@ goTo.marker("1"); edit.insert(";"); -verify.currentLineContentIs("String.call `${123}`;"); +verify.currentLineContentIs("String.call`${123}`;"); goTo.marker("2"); edit.insert(";"); -verify.currentLineContentIs("String.call `${123} ${456}`;"); \ No newline at end of file +verify.currentLineContentIs("String.call`${123} ${456}`;"); \ No newline at end of file diff --git a/tests/cases/fourslash/formattingWithMultilineComments.ts b/tests/cases/fourslash/formattingWithMultilineComments.ts new file mode 100644 index 00000000000..04cdfbcf472 --- /dev/null +++ b/tests/cases/fourslash/formattingWithMultilineComments.ts @@ -0,0 +1,9 @@ +/// + +////f(/* +/////*2*/ */() => { /*1*/ }); + +goTo.marker("1"); +edit.insertLine(""); +goTo.marker("2"); +verify.currentLineContentIs(" */() => {"); \ No newline at end of file diff --git a/tests/cases/fourslash/fourslash.ts b/tests/cases/fourslash/fourslash.ts index dd443e942cf..08883f163f2 100644 --- a/tests/cases/fourslash/fourslash.ts +++ b/tests/cases/fourslash/fourslash.ts @@ -81,6 +81,7 @@ declare namespace FourSlashInterface { InsertSpaceAfterFunctionKeywordForAnonymousFunctions: boolean; InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean; InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: boolean; + InsertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: boolean; PlaceOpenBraceOnNewLineForFunctions: boolean; PlaceOpenBraceOnNewLineForControlBlocks: boolean; [s: string]: boolean | number | string; @@ -109,8 +110,8 @@ declare namespace FourSlashInterface { type(definitionIndex?: number): void; position(position: number, fileIndex?: number): any; position(position: number, fileName?: string): any; - file(index: number, content?: string): any; - file(name: string, content?: string): any; + file(index: number, content?: string, scriptKindName?: string): any; + file(name: string, content?: string, scriptKindName?: string): any; } class verifyNegatable { private negative; @@ -135,6 +136,7 @@ declare namespace FourSlashInterface { typeDefinitionCountIs(expectedCount: number): void; definitionLocationExists(): void; verifyDefinitionsName(name: string, containerName: string): void; + isValidBraceCompletionAtPostion(openingBrace?: string): void; } class verify extends verifyNegatable { assertHasRanges(ranges: FourSlash.Range[]): void; @@ -172,8 +174,10 @@ declare namespace FourSlashInterface { noMatchingBracePositionInCurrentFile(bracePosition: number): void; DocCommentTemplate(expectedText: string, expectedOffset: number, empty?: boolean): void; noDocCommentTemplate(): void; - getScriptLexicalStructureListCount(count: number): void; - getScriptLexicalStructureListContains(name: string, kind: string, fileName?: string, parentName?: string, isAdditionalSpan?: boolean, markerPosition?: number): void; + + navigationBarCount(count: number): void; + navigationBarContains(name: string, kind: string, fileName?: string, parentName?: string, isAdditionalSpan?: boolean, markerPosition?: number): void; + navigationBarChildItem(parent: string, text: string, kind: string): void; navigationItemsListCount(count: number, searchValue: string, matchKind?: string): void; navigationItemsListContains(name: string, kind: string, searchValue: string, matchKind: string, fileName?: string, parentName?: string): void; occurrencesAtPositionContains(range: Range, isWriteAccess?: boolean): void; @@ -233,6 +237,7 @@ declare namespace FourSlashInterface { printBreakpointAtCurrentLocation(): void; printNameOrDottedNameSpans(pos: number): void; printErrorList(): void; + printNavigationBar(): void; printNavigationItems(searchValue?: string): void; printScriptLexicalStructureItems(): void; printReferences(): void; @@ -337,6 +342,36 @@ declare namespace FourSlashInterface { text: string; textSpan?: TextSpan; }; + function jsxOpenTagName(text: string, position?: number): { + classificationType: string; + text: string; + textSpan?: TextSpan; + }; + function jsxCloseTagName(text: string, position?: number): { + classificationType: string; + text: string; + textSpan?: TextSpan; + }; + function jsxSelfClosingTagName(text: string, position?: number): { + classificationType: string; + text: string; + textSpan?: TextSpan; + }; + function jsxAttribute(text: string, position?: number): { + classificationType: string; + text: string; + textSpan?: TextSpan; + }; + function jsxText(text: string, position?: number): { + classificationType: string; + text: string; + textSpan?: TextSpan; + }; + function jsxAttributeStringLiteralValue(text: string, position?: number): { + classificationType: string; + text: string; + textSpan?: TextSpan; + }; } } declare function verifyOperationIsCancelled(f: any): void; diff --git a/tests/cases/fourslash/getJavaScriptCompletions1.ts b/tests/cases/fourslash/getJavaScriptCompletions1.ts new file mode 100644 index 00000000000..6d8f36aac1b --- /dev/null +++ b/tests/cases/fourslash/getJavaScriptCompletions1.ts @@ -0,0 +1,10 @@ +/// + +// @allowNonTsExtensions: true +// @Filename: Foo.js +/////** @type {number} */ +////var v; +////v./**/ + +goTo.marker(); +verify.completionListContains("toExponential", /*displayText:*/ undefined, /*documentation*/ undefined, "method"); diff --git a/tests/cases/fourslash/getJavaScriptCompletions10.ts b/tests/cases/fourslash/getJavaScriptCompletions10.ts new file mode 100644 index 00000000000..5fbd91e8988 --- /dev/null +++ b/tests/cases/fourslash/getJavaScriptCompletions10.ts @@ -0,0 +1,11 @@ +/// + +// @allowNonTsExtensions: true +// @Filename: Foo.js +/////** +//// * @type {function(this:number)} +//// */ +////function f() { this./**/ } + +goTo.marker(); +verify.completionListContains("toExponential", /*displayText:*/ undefined, /*documentation*/ undefined, "method"); \ No newline at end of file diff --git a/tests/cases/fourslash/getJavaScriptCompletions11.ts b/tests/cases/fourslash/getJavaScriptCompletions11.ts new file mode 100644 index 00000000000..f12f53fa960 --- /dev/null +++ b/tests/cases/fourslash/getJavaScriptCompletions11.ts @@ -0,0 +1,11 @@ +/// + +// @allowNonTsExtensions: true +// @Filename: Foo.js +/////** @type {number|string} */ +////var v; +////v./**/ + +goTo.marker(); +verify.completionListContains("toExponential", /*displayText:*/ undefined, /*documentation*/ undefined, "method"); +verify.completionListContains("charCodeAt", /*displayText:*/ undefined, /*documentation*/ undefined, "method"); \ No newline at end of file diff --git a/tests/cases/fourslash/getJavaScriptCompletions12.ts b/tests/cases/fourslash/getJavaScriptCompletions12.ts new file mode 100644 index 00000000000..99b14828854 --- /dev/null +++ b/tests/cases/fourslash/getJavaScriptCompletions12.ts @@ -0,0 +1,36 @@ +/// + +// @allowNonTsExtensions: true +// @Filename: Foo.js +/////** +//// * @param {number} input +//// * @param {string} currency +//// * @returns {number} +//// */ +////var convert = function(input, currency) { +//// switch(currency./*1*/) { +//// case "USD": +//// input./*2*/; +//// case "EUR": +//// return "" + rateToUsd.EUR; +//// case "CNY": +//// return {} + rateToUsd.CNY; +//// } +////} +////convert(1, "")./*3*/ +/////** +//// * @param {number} x +//// */ +////var test1 = function(x) { return x./*4*/ }, test2 = function(a) { return a./*5*/ }; + + +goTo.marker("1"); +verify.completionListContains("charCodeAt", /*displayText:*/ undefined, /*documentation*/ undefined, "method"); +goTo.marker("2"); +verify.completionListContains("toExponential", /*displayText:*/ undefined, /*documentation*/ undefined, "method"); +goTo.marker("3"); +verify.completionListContains("toExponential", /*displayText:*/ undefined, /*documentation*/ undefined, "method"); +goTo.marker("4"); +verify.completionListContains("toExponential", /*displayText:*/ undefined, /*documentation*/ undefined, "method"); +goTo.marker("5"); +verify.completionListContains("test1", /*displayText:*/ undefined, /*documentation*/ undefined, "warning"); \ No newline at end of file diff --git a/tests/cases/fourslash/getJavaScriptCompletions13.ts b/tests/cases/fourslash/getJavaScriptCompletions13.ts new file mode 100644 index 00000000000..438c73e304c --- /dev/null +++ b/tests/cases/fourslash/getJavaScriptCompletions13.ts @@ -0,0 +1,26 @@ +/// +// @allowNonTsExtensions: true + +// @Filename: file1.js + +////var file1Identifier = 1; +////interface Foo { FooProp: number }; + +// @Filename: file2.js + +////var file2Identifier1 = 2; +////var file2Identifier2 = 2; +/////*1*/ +////file2Identifier2./*2*/ + +goTo.marker("1"); +verify.completionListContains("file2Identifier1"); +verify.completionListContains("file2Identifier2"); +verify.completionListContains("file1Identifier"); +verify.not.completionListContains("FooProp"); + +goTo.marker("2"); +verify.completionListContains("file2Identifier1"); +verify.completionListContains("file2Identifier2"); +verify.not.completionListContains("file1Identifier") +verify.not.completionListContains("FooProp"); \ No newline at end of file diff --git a/tests/cases/fourslash/getJavaScriptCompletions14.ts b/tests/cases/fourslash/getJavaScriptCompletions14.ts new file mode 100644 index 00000000000..52a23065a5e --- /dev/null +++ b/tests/cases/fourslash/getJavaScriptCompletions14.ts @@ -0,0 +1,13 @@ +/// + +// @allowNonTsExtensions: true +// @Filename: file1.js +/////// +////interface Number { +//// toExponential(fractionDigits?: number): string; +////} +////var x = 1; +////x./*1*/ + +goTo.marker("1"); +verify.completionListContains("toExponential", /*displayText:*/ undefined, /*documentation*/ undefined, "method"); diff --git a/tests/cases/fourslash/getJavaScriptCompletions15.ts b/tests/cases/fourslash/getJavaScriptCompletions15.ts new file mode 100644 index 00000000000..2903cb6fa7c --- /dev/null +++ b/tests/cases/fourslash/getJavaScriptCompletions15.ts @@ -0,0 +1,29 @@ +/// + +// @allowNonTsExtensions: true +// @Filename: refFile1.ts +//// export var V = 1; + +// @Filename: refFile2.ts +//// export var V = "123" + +// @Filename: refFile3.ts +//// export var V = "123" + +// @Filename: main.js +//// import ref1 = require("./refFile1"); +//// var ref2 = require("./refFile2"); +//// ref1.V./*1*/; +//// ref2.V./*2*/; +//// var v = { x: require("./refFile3") }; +//// v.x./*3*/; +//// v.x.V./*4*/; + +goTo.marker("1"); +verify.completionListContains("toExponential"); +goTo.marker("2"); +verify.completionListContains("toLowerCase"); +goTo.marker("3"); +verify.completionListContains("V"); +goTo.marker("4"); +verify.completionListContains("toLowerCase"); diff --git a/tests/cases/fourslash/getJavaScriptCompletions16.ts b/tests/cases/fourslash/getJavaScriptCompletions16.ts new file mode 100644 index 00000000000..4d4b76d98d6 --- /dev/null +++ b/tests/cases/fourslash/getJavaScriptCompletions16.ts @@ -0,0 +1,35 @@ +/// + +// @allowNonTsExtensions: true +// @Filename: file.js +//// "use strict"; +//// +//// class Something { +//// +//// /** +//// * @param {number} a +//// */ +//// constructor(a, b) { +//// a/*body*/ +//// } +//// +//// /** +//// * @param {number} a +//// */ +//// method(a) { +//// a/*method*/ +//// } +//// } +//// let x = new Something(/*sig*/); + +goTo.marker('body'); +edit.insert('.'); +verify.completionListContains('toFixed', undefined, undefined, 'method'); +edit.backspace(); + +goTo.marker('sig'); +verify.currentSignatureHelpIs('Something(a: number, b: any): Something'); + +goTo.marker('method'); +edit.insert('.'); +verify.completionListContains('toFixed', undefined, undefined, 'method'); diff --git a/tests/cases/fourslash/getJavaScriptCompletions18.ts b/tests/cases/fourslash/getJavaScriptCompletions18.ts new file mode 100644 index 00000000000..a30d4943f4f --- /dev/null +++ b/tests/cases/fourslash/getJavaScriptCompletions18.ts @@ -0,0 +1,21 @@ +/// + +// @allowNonTsExtensions: true +// @Filename: file.js +//// /** +//// * @param {number} a +//// * @param {string} b +//// */ +//// exports.foo = function(a, b) { +//// a/*a*/; +//// b/*b*/ +//// }; + +goTo.marker('a'); +edit.insert('.'); +verify.completionListContains('toFixed', undefined, undefined, 'method'); + + +goTo.marker('b'); +edit.insert('.'); +verify.completionListContains('substr', undefined, undefined, 'method'); diff --git a/tests/cases/fourslash/getJavaScriptCompletions19.ts b/tests/cases/fourslash/getJavaScriptCompletions19.ts new file mode 100644 index 00000000000..5a361930e86 --- /dev/null +++ b/tests/cases/fourslash/getJavaScriptCompletions19.ts @@ -0,0 +1,25 @@ +/// + +// @allowNonTsExtensions: true +// @Filename: file.js +//// function fn() { +//// if (foo) { +//// return 0; +//// } else { +//// return '0'; +//// } +//// } +//// let x = fn(); +//// if(typeof x === 'string') { +//// x/*str*/ +//// } else { +//// x/*num*/ +//// } + +goTo.marker('str'); +edit.insert('.'); +verify.completionListContains('substr', undefined, undefined, 'method'); + +goTo.marker('num'); +edit.insert('.'); +verify.completionListContains('toFixed', undefined, undefined, 'method'); diff --git a/tests/cases/fourslash/getJavaScriptCompletions2.ts b/tests/cases/fourslash/getJavaScriptCompletions2.ts new file mode 100644 index 00000000000..0cb2de046a6 --- /dev/null +++ b/tests/cases/fourslash/getJavaScriptCompletions2.ts @@ -0,0 +1,10 @@ +/// + +// @allowNonTsExtensions: true +// @Filename: Foo.js +/////** @type {(number|string)} */ +////var v; +////v./**/ + +goTo.marker(); +verify.completionListContains("valueOf", /*displayText:*/ undefined, /*documentation*/ undefined, "method"); \ No newline at end of file diff --git a/tests/cases/fourslash/getJavaScriptCompletions20.ts b/tests/cases/fourslash/getJavaScriptCompletions20.ts new file mode 100644 index 00000000000..d254705bb91 --- /dev/null +++ b/tests/cases/fourslash/getJavaScriptCompletions20.ts @@ -0,0 +1,21 @@ +/// + +// @allowNonTsExtensions: true +// @Filename: file.js +//// /** +//// * A person +//// * @constructor +//// * @param {string} name - The name of the person. +//// * @param {number} age - The age of the person. +//// */ +//// function Person(name, age) { +//// this.name = name; +//// this.age = age; +//// } +//// +//// +//// Person.getName = 10; +//// Person.getNa/**/ = 10; + +goTo.marker(); +verify.not.memberListContains('getNa'); diff --git a/tests/cases/fourslash/getJavaScriptCompletions3.ts b/tests/cases/fourslash/getJavaScriptCompletions3.ts new file mode 100644 index 00000000000..13a6f1673e6 --- /dev/null +++ b/tests/cases/fourslash/getJavaScriptCompletions3.ts @@ -0,0 +1,10 @@ +/// + +// @allowNonTsExtensions: true +// @Filename: Foo.js +/////** @type {Array.} */ +////var v; +////v./**/ + +goTo.marker(); +verify.completionListContains("concat", /*displayText:*/ undefined, /*documentation*/ undefined, "method"); \ No newline at end of file diff --git a/tests/cases/fourslash/getJavaScriptCompletions4.ts b/tests/cases/fourslash/getJavaScriptCompletions4.ts new file mode 100644 index 00000000000..3719b8e1258 --- /dev/null +++ b/tests/cases/fourslash/getJavaScriptCompletions4.ts @@ -0,0 +1,10 @@ +/// + +// @allowNonTsExtensions: true +// @Filename: Foo.js +/////** @return {number} */ +////function foo(a,b) { } +////foo(1,2)./**/ + +goTo.marker(); +verify.completionListContains("toExponential", /*displayText:*/ undefined, /*documentation*/ undefined, "method"); \ No newline at end of file diff --git a/tests/cases/fourslash/getJavaScriptCompletions5.ts b/tests/cases/fourslash/getJavaScriptCompletions5.ts new file mode 100644 index 00000000000..348feef94c3 --- /dev/null +++ b/tests/cases/fourslash/getJavaScriptCompletions5.ts @@ -0,0 +1,15 @@ +/// + +// @allowNonTsExtensions: true +// @Filename: Foo.js +//// /** +//// * @template T +//// * @param {T} a +//// * @return {T} */ +//// function foo(a) { } +//// let x = /*1*/foo; +//// foo(1)./**/ + +goTo.marker('1'); +goTo.marker(); +verify.completionListContains("toExponential", /*displayText:*/ undefined, /*documentation*/ undefined, "method"); diff --git a/tests/cases/fourslash/getJavaScriptCompletions6.ts b/tests/cases/fourslash/getJavaScriptCompletions6.ts new file mode 100644 index 00000000000..9f9a42b5762 --- /dev/null +++ b/tests/cases/fourslash/getJavaScriptCompletions6.ts @@ -0,0 +1,13 @@ +/// + +// @allowNonTsExtensions: true +// @Filename: Foo.js +/////** +//// * @param {...number} a +//// */ +////function foo(a) { +//// a./**/ +////} + +goTo.marker(); +verify.completionListContains("concat", /*displayText:*/ undefined, /*documentation*/ undefined, "method"); \ No newline at end of file diff --git a/tests/cases/fourslash/getJavaScriptCompletions7.ts b/tests/cases/fourslash/getJavaScriptCompletions7.ts new file mode 100644 index 00000000000..d8b01cfb757 --- /dev/null +++ b/tests/cases/fourslash/getJavaScriptCompletions7.ts @@ -0,0 +1,13 @@ +/// + +// @allowNonTsExtensions: true +// @Filename: Foo.js +/////** +//// * @param {...number} a +//// */ +////function foo(a) { +//// a[0]./**/ +////} + +goTo.marker(); +verify.completionListContains("toExponential", /*displayText:*/ undefined, /*documentation*/ undefined, "method"); \ No newline at end of file diff --git a/tests/cases/fourslash/getJavaScriptCompletions8.ts b/tests/cases/fourslash/getJavaScriptCompletions8.ts new file mode 100644 index 00000000000..418aae676be --- /dev/null +++ b/tests/cases/fourslash/getJavaScriptCompletions8.ts @@ -0,0 +1,12 @@ +/// + +// @allowNonTsExtensions: true +// @Filename: Foo.js +/////** +//// * @type {function(): number} +//// */ +////var v; +////v()./**/ + +goTo.marker(); +verify.completionListContains("toExponential", /*displayText:*/ undefined, /*documentation*/ undefined, "method"); \ No newline at end of file diff --git a/tests/cases/fourslash/getJavaScriptCompletions9.ts b/tests/cases/fourslash/getJavaScriptCompletions9.ts new file mode 100644 index 00000000000..1619a2ca9fc --- /dev/null +++ b/tests/cases/fourslash/getJavaScriptCompletions9.ts @@ -0,0 +1,12 @@ +/// + +// @allowNonTsExtensions: true +// @Filename: Foo.js +/////** +//// * @type {function(new:number)} +//// */ +////var v; +////new v()./**/ + +goTo.marker(); +verify.completionListContains("toExponential", /*displayText:*/ undefined, /*documentation*/ undefined, "method"); \ No newline at end of file diff --git a/tests/cases/fourslash/getJavaScriptGlobalCompletions1.ts b/tests/cases/fourslash/getJavaScriptGlobalCompletions1.ts new file mode 100644 index 00000000000..240df24bf52 --- /dev/null +++ b/tests/cases/fourslash/getJavaScriptGlobalCompletions1.ts @@ -0,0 +1,15 @@ +/// + +// @allowNonTsExtensions: true +// @Filename: Foo.js +//// function f() { +//// // helloWorld leaks from here into the global space? +//// if (helloWorld) { +//// return 3; +//// } +//// return 5; +//// } +//// +//// hello/**/ + +verify.completionListContains('helloWorld'); diff --git a/tests/cases/fourslash/getJavaScriptQuickInfo1.ts b/tests/cases/fourslash/getJavaScriptQuickInfo1.ts new file mode 100644 index 00000000000..71072f1699a --- /dev/null +++ b/tests/cases/fourslash/getJavaScriptQuickInfo1.ts @@ -0,0 +1,9 @@ +/// + +// @allowNonTsExtensions: true +// @Filename: Foo.js +/////** @type {function(new:string,number)} */ +////var /**/v; + +goTo.marker(); +verify.quickInfoIs('var v: new (p1: number) => string'); \ No newline at end of file diff --git a/tests/cases/fourslash/getJavaScriptQuickInfo2.ts b/tests/cases/fourslash/getJavaScriptQuickInfo2.ts new file mode 100644 index 00000000000..ce347a62b27 --- /dev/null +++ b/tests/cases/fourslash/getJavaScriptQuickInfo2.ts @@ -0,0 +1,9 @@ +/// + +// @allowNonTsExtensions: true +// @Filename: Foo.js +/////** @param {number} [a] */ +////function /**/f(a) { } + +goTo.marker(); +verify.quickInfoIs('function f(a?: number): void'); \ No newline at end of file diff --git a/tests/cases/fourslash/getJavaScriptQuickInfo3.ts b/tests/cases/fourslash/getJavaScriptQuickInfo3.ts new file mode 100644 index 00000000000..2e094bd21f6 --- /dev/null +++ b/tests/cases/fourslash/getJavaScriptQuickInfo3.ts @@ -0,0 +1,9 @@ +/// + +// @allowNonTsExtensions: true +// @Filename: Foo.js +/////** @param {number[]} [a] */ +////function /**/f(a) { } + +goTo.marker(); +verify.quickInfoIs('function f(a?: number[]): void'); \ No newline at end of file diff --git a/tests/cases/fourslash/getJavaScriptQuickInfo4.ts b/tests/cases/fourslash/getJavaScriptQuickInfo4.ts new file mode 100644 index 00000000000..34ee10d97b7 --- /dev/null +++ b/tests/cases/fourslash/getJavaScriptQuickInfo4.ts @@ -0,0 +1,9 @@ +/// + +// @allowNonTsExtensions: true +// @Filename: Foo.js +/////** @param {[number,string]} [a] */ +////function /**/f(a) { } + +goTo.marker(); +verify.quickInfoIs('function f(a?: [number, string]): void'); \ No newline at end of file diff --git a/tests/cases/fourslash/getJavaScriptQuickInfo5.ts b/tests/cases/fourslash/getJavaScriptQuickInfo5.ts new file mode 100644 index 00000000000..004af0811b7 --- /dev/null +++ b/tests/cases/fourslash/getJavaScriptQuickInfo5.ts @@ -0,0 +1,9 @@ +/// + +// @allowNonTsExtensions: true +// @Filename: Foo.js +/////** @param {{b:number}} [a] */ +////function /**/f(a) { } + +goTo.marker(); +verify.quickInfoIs('function f(a?: {\n b: number;\n}): void'); \ No newline at end of file diff --git a/tests/cases/fourslash/getJavaScriptQuickInfo6.ts b/tests/cases/fourslash/getJavaScriptQuickInfo6.ts new file mode 100644 index 00000000000..3aebd19deda --- /dev/null +++ b/tests/cases/fourslash/getJavaScriptQuickInfo6.ts @@ -0,0 +1,9 @@ +/// + +// @allowNonTsExtensions: true +// @Filename: Foo.js +/////** @type {function(this:number)} */ +////function f() { /**/this } + +goTo.marker(); +verify.quickInfoIs('number'); \ No newline at end of file diff --git a/tests/cases/fourslash/getJavaScriptQuickInfo7.ts b/tests/cases/fourslash/getJavaScriptQuickInfo7.ts new file mode 100644 index 00000000000..5aa8474757d --- /dev/null +++ b/tests/cases/fourslash/getJavaScriptQuickInfo7.ts @@ -0,0 +1,20 @@ +/// + +// @allowNonTsExtensions: true +// @Filename: file.js +//// /** +//// * This is a very cool function that is very nice. +//// * @returns something +//// * @param p anotherthing +//// */ +//// function a1(p) { +//// try { +//// throw new Error('x'); +//// } catch (x) { x--; } +//// return 23; +//// } +//// +//// x - /**/a1() + +goTo.marker(); +verify.quickInfoExists(); \ No newline at end of file diff --git a/tests/cases/fourslash/getJavaScriptQuickInfo8.ts b/tests/cases/fourslash/getJavaScriptQuickInfo8.ts new file mode 100644 index 00000000000..09ac27ce595 --- /dev/null +++ b/tests/cases/fourslash/getJavaScriptQuickInfo8.ts @@ -0,0 +1,29 @@ +/// + +// @allowNonTsExtensions: true +// @Filename: file.js +//// let x = { +//// /** @type {number} */ +//// get m() { +//// return undefined; +//// } +//// } +//// x.m/*1*/; +//// +//// class Foo { +//// /** @type {string} */ +//// get b() { +//// return undefined; +//// } +//// } +//// var y = new Foo(); +//// y.b/*2*/; + +goTo.marker('1'); +edit.insert('.'); +verify.memberListContains('toFixed', undefined, undefined, 'method'); +edit.backspace(); + +goTo.marker('2'); +edit.insert('.'); +verify.memberListContains('substr', undefined, undefined, 'method'); diff --git a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics2.ts b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics2.ts index 198c39abe42..9ab29b41798 100644 --- a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics2.ts +++ b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics2.ts @@ -11,12 +11,5 @@ verify.getSemanticDiagnostics(`[ "length": 11, "category": "error", "code": 8003 - }, - { - "message": "Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file.", - "start": 0, - "length": 11, - "category": "error", - "code": 1148 } ]`); \ No newline at end of file diff --git a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics20.ts b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics20.ts deleted file mode 100644 index c34f860b5fe..00000000000 --- a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics20.ts +++ /dev/null @@ -1,16 +0,0 @@ -/// - -// @allowJs: true -// @Filename: a.js -//// var v = undefined; - -verify.getSyntacticDiagnostics(`[]`); -verify.getSemanticDiagnostics(`[ - { - "message": "'type assertion expressions' can only be used in a .ts file.", - "start": 9, - "length": 6, - "category": "error", - "code": 8016 - } -]`); \ No newline at end of file diff --git a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics21.ts b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics21.ts index b71677554a2..8a7120acbb3 100644 --- a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics21.ts +++ b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics21.ts @@ -1,15 +1,8 @@ /// // @allowJs: true +// @experimentalDecorators: true // @Filename: a.js //// @internal class C {} -verify.getSemanticDiagnostics(`[ - { - "message": "'decorators' can only be used in a .ts file.", - "start": 0, - "length": 9, - "category": "error", - "code": 8017 - } -]`); \ No newline at end of file +verify.getSemanticDiagnostics(`[]`); diff --git a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics23.ts b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics23.ts new file mode 100644 index 00000000000..2524e50e668 --- /dev/null +++ b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics23.ts @@ -0,0 +1,14 @@ +/// + +// @allowJs: true +// @Filename: a.js +//// function Person(age) { +//// if (age >= 18) { +//// this.canVote = true; +//// } else { +//// this.canVote = false; +//// } +//// } + +verify.getSyntacticDiagnostics(`[]`); +verify.getSemanticDiagnostics(`[]`); diff --git a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics24.ts b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics24.ts new file mode 100644 index 00000000000..cf70f883e99 --- /dev/null +++ b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics24.ts @@ -0,0 +1,16 @@ +/// + +// @allowJs: true +// @Filename: a.js +//// function Person(age) { +//// if (age >= 18) { +//// this.canVote = true; +//// } else { +//// this.canVote = 23; +//// } +//// } +//// let x = new Person(100); +//// x.canVote/**/; + +goTo.marker(); +verify.quickInfoIs('(property) Person.canVote: boolean | number'); diff --git a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics8.ts b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics8.ts index ba2d9faae8c..562f42124ae 100644 --- a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics8.ts +++ b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics8.ts @@ -7,8 +7,8 @@ verify.getSemanticDiagnostics(`[ { "message": "'type aliases' can only be used in a .ts file.", - "start": 0, - "length": 11, + "start": 5, + "length": 1, "category": "error", "code": 8008 } diff --git a/tests/cases/fourslash/getNavigationBarItems.ts b/tests/cases/fourslash/getNavigationBarItems.ts new file mode 100644 index 00000000000..8e9b8de5b05 --- /dev/null +++ b/tests/cases/fourslash/getNavigationBarItems.ts @@ -0,0 +1,11 @@ +/// + +////class C { +//// foo; +//// ["bar"]: string; +////} + +verify.navigationBarCount(3); +verify.navigationBarContains("C", "class"); +verify.navigationBarChildItem("C", "[\"bar\"]", "property"); +verify.navigationBarChildItem("C", "foo", "property"); diff --git a/tests/cases/fourslash/getOccurrencesStringLiteralTypes.ts b/tests/cases/fourslash/getOccurrencesStringLiteralTypes.ts new file mode 100644 index 00000000000..56af87497d5 --- /dev/null +++ b/tests/cases/fourslash/getOccurrencesStringLiteralTypes.ts @@ -0,0 +1,13 @@ +/// + +////function foo(a: "[|option 1|]") { } +////foo("[|option 1|]"); + +const ranges = test.ranges(); +for (let r of ranges) { + goTo.position(r.start); + + for (let range of ranges) { + verify.occurrencesAtPositionContains(range, false); + } +} diff --git a/tests/cases/fourslash/getOccurrencesStringLiterals.ts b/tests/cases/fourslash/getOccurrencesStringLiterals.ts new file mode 100644 index 00000000000..efa365cbbb8 --- /dev/null +++ b/tests/cases/fourslash/getOccurrencesStringLiterals.ts @@ -0,0 +1,10 @@ +/// + +////var x = "[|string|]"; +////function f(a = "[|initial value|]") { } + +const ranges = test.ranges(); +for (let r of ranges) { + goTo.position(r.start); + verify.occurrencesAtPositionCount(0); +} diff --git a/tests/cases/fourslash/getPreProcessedFile.ts b/tests/cases/fourslash/getPreProcessedFile.ts index aa0ff4c0669..03ce481c8ba 100644 --- a/tests/cases/fourslash/getPreProcessedFile.ts +++ b/tests/cases/fourslash/getPreProcessedFile.ts @@ -1,4 +1,5 @@ /// +// @ModuleResolution: classic // @Filename: refFile1.ts //// class D { } diff --git a/tests/cases/fourslash/getPropertySymbolsFromBaseTypesDoesntCrash.ts b/tests/cases/fourslash/getPropertySymbolsFromBaseTypesDoesntCrash.ts new file mode 100644 index 00000000000..0c89de63a43 --- /dev/null +++ b/tests/cases/fourslash/getPropertySymbolsFromBaseTypesDoesntCrash.ts @@ -0,0 +1,9 @@ +/// + +// @Filename: file1.ts +//// class ClassA implements IInterface { +//// private /*1*/value: number; +//// } + +goTo.marker("1"); +verify.documentHighlightsAtPositionCount(1, ["file1.ts"]); \ No newline at end of file diff --git a/tests/cases/fourslash/getQuickInfoForIntersectionTypes.ts b/tests/cases/fourslash/getQuickInfoForIntersectionTypes.ts new file mode 100644 index 00000000000..ecdd0954617 --- /dev/null +++ b/tests/cases/fourslash/getQuickInfoForIntersectionTypes.ts @@ -0,0 +1,8 @@ +////function f(): string & {(): any} { +//// return {}; +////} +////let x = f(); +////x/**/(); + +goTo.marker(); +verify.quickInfoIs("let x: () => any"); diff --git a/tests/cases/fourslash/goToDefinitionAcrossMultipleProjects.ts b/tests/cases/fourslash/goToDefinitionAcrossMultipleProjects.ts new file mode 100644 index 00000000000..bac47638be6 --- /dev/null +++ b/tests/cases/fourslash/goToDefinitionAcrossMultipleProjects.ts @@ -0,0 +1,17 @@ +/// + +//@Filename: a.ts +////var x: number; + +//@Filename: b.ts +////var x: number; + +//@Filename: c.ts +/////// +/////// +/////**/x++; + +goTo.file("c.ts"); +goTo.marker(); + +verify.definitionCountIs(2); \ No newline at end of file diff --git a/tests/cases/fourslash/goToDefinitionExternalModuleName.ts b/tests/cases/fourslash/goToDefinitionExternalModuleName.ts index f403965fe12..13abe094376 100644 --- a/tests/cases/fourslash/goToDefinitionExternalModuleName.ts +++ b/tests/cases/fourslash/goToDefinitionExternalModuleName.ts @@ -1,7 +1,7 @@ /// // @Filename: b.ts -////import n = require('a/*1*/'); +////import n = require('./a/*1*/'); ////var x = new n.Foo(); // @Filename: a.ts diff --git a/tests/cases/fourslash/goToDefinitionExternalModuleName2.ts b/tests/cases/fourslash/goToDefinitionExternalModuleName2.ts index df7b3310394..06be8e676dd 100644 --- a/tests/cases/fourslash/goToDefinitionExternalModuleName2.ts +++ b/tests/cases/fourslash/goToDefinitionExternalModuleName2.ts @@ -1,7 +1,7 @@ /// // @Filename: b.ts -////import n = require('a/*1*/'); +////import n = require('./a/*1*/'); ////var x = new n.Foo(); // @Filename: a.ts diff --git a/tests/cases/fourslash/goToDefinitionImportedNames.ts b/tests/cases/fourslash/goToDefinitionImportedNames.ts index 64eb2df96bf..98a791d23ae 100644 --- a/tests/cases/fourslash/goToDefinitionImportedNames.ts +++ b/tests/cases/fourslash/goToDefinitionImportedNames.ts @@ -1,7 +1,7 @@ /// // @Filename: b.ts -////export {/*classAliasDefinition*/Class} from "a"; +////export {/*classAliasDefinition*/Class} from "./a"; // @Filename: a.ts diff --git a/tests/cases/fourslash/goToDefinitionImportedNames2.ts b/tests/cases/fourslash/goToDefinitionImportedNames2.ts index 8533dad62a8..e5ab58d10cf 100644 --- a/tests/cases/fourslash/goToDefinitionImportedNames2.ts +++ b/tests/cases/fourslash/goToDefinitionImportedNames2.ts @@ -1,7 +1,7 @@ /// // @Filename: b.ts -////import {/*classAliasDefinition*/Class} from "a"; +////import {/*classAliasDefinition*/Class} from "./a"; // @Filename: a.ts diff --git a/tests/cases/fourslash/goToDefinitionImportedNames3.ts b/tests/cases/fourslash/goToDefinitionImportedNames3.ts index d55137575ef..5e9376d70cb 100644 --- a/tests/cases/fourslash/goToDefinitionImportedNames3.ts +++ b/tests/cases/fourslash/goToDefinitionImportedNames3.ts @@ -1,20 +1,20 @@ /// // @Filename: e.ts -//// import {M, /*classAliasDefinition*/C, I} from "d"; +//// import {M, /*classAliasDefinition*/C, I} from "./d"; //// var c = new /*classReference*/C(); // @Filename: d.ts -////export * from "c"; +////export * from "./c"; // @Filename: c.ts -////export {Module as M, Class as C, Interface as I} from "b"; +////export {Module as M, Class as C, Interface as I} from "./b"; // @Filename: b.ts -////export * from "a"; +////export * from "./a"; // @Filename: a.ts @@ -31,7 +31,7 @@ goTo.file("e.ts"); goTo.marker('classReference'); goTo.definition(); -verify.caretAtMarker('classAliasDefinition'); +verify.caretAtMarker('classDefinition'); goTo.marker('classAliasDefinition'); goTo.definition(); diff --git a/tests/cases/fourslash/goToDefinitionImportedNames4.ts b/tests/cases/fourslash/goToDefinitionImportedNames4.ts index cce49af874b..e0ef512dc41 100644 --- a/tests/cases/fourslash/goToDefinitionImportedNames4.ts +++ b/tests/cases/fourslash/goToDefinitionImportedNames4.ts @@ -1,7 +1,7 @@ /// // @Filename: b.ts -////import {Class as /*classAliasDefinition*/ClassAlias} from "a"; +////import {Class as /*classAliasDefinition*/ClassAlias} from "./a"; // @Filename: a.ts diff --git a/tests/cases/fourslash/goToDefinitionImportedNames5.ts b/tests/cases/fourslash/goToDefinitionImportedNames5.ts index 46a8c45e272..abd3bee998a 100644 --- a/tests/cases/fourslash/goToDefinitionImportedNames5.ts +++ b/tests/cases/fourslash/goToDefinitionImportedNames5.ts @@ -1,7 +1,7 @@ /// // @Filename: b.ts -////export {Class as /*classAliasDefinition*/ClassAlias} from "a"; +////export {Class as /*classAliasDefinition*/ClassAlias} from "./a"; // @Filename: a.ts diff --git a/tests/cases/fourslash/goToDefinitionImportedNames6.ts b/tests/cases/fourslash/goToDefinitionImportedNames6.ts index 27b6c55d107..c665946c3b1 100644 --- a/tests/cases/fourslash/goToDefinitionImportedNames6.ts +++ b/tests/cases/fourslash/goToDefinitionImportedNames6.ts @@ -1,7 +1,7 @@ /// // @Filename: b.ts -////import /*moduleAliasDefinition*/alias = require("a"); +////import /*moduleAliasDefinition*/alias = require("./a"); // @Filename: a.ts diff --git a/tests/cases/fourslash/goToDefinitionImportedNames7.ts b/tests/cases/fourslash/goToDefinitionImportedNames7.ts index 3c367600b1f..d5bcc499c7c 100644 --- a/tests/cases/fourslash/goToDefinitionImportedNames7.ts +++ b/tests/cases/fourslash/goToDefinitionImportedNames7.ts @@ -1,7 +1,7 @@ /// // @Filename: b.ts -////import /*classAliasDefinition*/defaultExport from "a"; +////import /*classAliasDefinition*/defaultExport from "./a"; // @Filename: a.ts diff --git a/tests/cases/fourslash/goToDefinitionTypeReferenceDirective.ts b/tests/cases/fourslash/goToDefinitionTypeReferenceDirective.ts new file mode 100644 index 00000000000..3aaa3ab980f --- /dev/null +++ b/tests/cases/fourslash/goToDefinitionTypeReferenceDirective.ts @@ -0,0 +1,13 @@ +/// + +// @typesRoot: src +// @Filename: src/types/lib/index.d.ts +/////*0*/declare let $: {x: number}; + +// @Filename: src/app.ts +//// /// +//// $.x; + +goTo.marker("1"); +goTo.definition(); +verify.caretAtMarker("0"); \ No newline at end of file diff --git a/tests/cases/fourslash/goToTypeDefinitionAliases.ts b/tests/cases/fourslash/goToTypeDefinitionAliases.ts index 19abc22ca30..da9d3d5a84e 100644 --- a/tests/cases/fourslash/goToTypeDefinitionAliases.ts +++ b/tests/cases/fourslash/goToTypeDefinitionAliases.ts @@ -7,12 +7,12 @@ ////export {I as I2}; // @Filename: goToTypeDefinitioAliases_module2.ts -////import {I2 as I3} from "goToTypeDefinitioAliases_module1"; +////import {I2 as I3} from "./goToTypeDefinitioAliases_module1"; ////var v1: I3; ////export {v1 as v2}; // @Filename: goToTypeDefinitioAliases_module3.ts -////import {/*reference1*/v2 as v3} from "goToTypeDefinitioAliases_module2"; +////import {/*reference1*/v2 as v3} from "./goToTypeDefinitioAliases_module2"; /////*reference2*/v3; goTo.marker('reference1'); diff --git a/tests/cases/fourslash/hoverOverComment.ts b/tests/cases/fourslash/hoverOverComment.ts new file mode 100644 index 00000000000..a9549a932f7 --- /dev/null +++ b/tests/cases/fourslash/hoverOverComment.ts @@ -0,0 +1,11 @@ +/// + +////export function f() {} +//////foo +/////**///moo + +goTo.marker(); +verify.quickInfoIs(""); +verify.verifyDefinitionsName("", ""); +verify.typeDefinitionCountIs(0); +verify.referencesCountIs(0); diff --git a/tests/cases/fourslash/indentationInAugmentations1.ts b/tests/cases/fourslash/indentationInAugmentations1.ts new file mode 100644 index 00000000000..8a9b81fdd67 --- /dev/null +++ b/tests/cases/fourslash/indentationInAugmentations1.ts @@ -0,0 +1,9 @@ +/// + +// @module: amd +//// export {} +//// declare global {/*1*/ + +goTo.marker("1"); +edit.insertLine(""); +verify.indentationIs(4); \ No newline at end of file diff --git a/tests/cases/fourslash/indentationInAugmentations2.ts b/tests/cases/fourslash/indentationInAugmentations2.ts new file mode 100644 index 00000000000..df2400207bb --- /dev/null +++ b/tests/cases/fourslash/indentationInAugmentations2.ts @@ -0,0 +1,8 @@ +/// + +//// declare module "A" { +//// global {/*1*/ + +goTo.marker("1"); +edit.insertLine(""); +verify.indentationIs(8); \ No newline at end of file diff --git a/tests/cases/fourslash/instanceTypesForGenericType1.ts b/tests/cases/fourslash/instanceTypesForGenericType1.ts index 96ee175383e..a3d119785bf 100644 --- a/tests/cases/fourslash/instanceTypesForGenericType1.ts +++ b/tests/cases/fourslash/instanceTypesForGenericType1.ts @@ -11,4 +11,4 @@ goTo.marker('1'); verify.quickInfoIs('(property) G.self: G'); goTo.marker('2'); -verify.quickInfoIs('class G'); \ No newline at end of file +verify.quickInfoIs('this: this'); \ No newline at end of file diff --git a/tests/cases/fourslash/javaScriptModules13.ts b/tests/cases/fourslash/javaScriptModules13.ts index 4eed369836f..bcf263a4b8c 100644 --- a/tests/cases/fourslash/javaScriptModules13.ts +++ b/tests/cases/fourslash/javaScriptModules13.ts @@ -13,7 +13,7 @@ //// var y = 10; // @Filename: consumer.js -//// var x = require('myMod'); +//// var x = require('./myMod'); //// /**/; goTo.file('consumer.js'); @@ -23,4 +23,6 @@ verify.completionListContains('y'); verify.not.completionListContains('invisible'); edit.insert('x.'); -verify.completionListContains('a'); +verify.memberListContains('a', undefined, undefined, 'property'); +edit.insert('a.'); +verify.memberListContains('toFixed', undefined, undefined, 'method'); diff --git a/tests/cases/fourslash/javaScriptModules15.ts b/tests/cases/fourslash/javaScriptModules15.ts index 5cd7545c83d..0636f0360af 100644 --- a/tests/cases/fourslash/javaScriptModules15.ts +++ b/tests/cases/fourslash/javaScriptModules15.ts @@ -14,7 +14,7 @@ //// } // @Filename: consumer.js -//// var x = require('myMod'); +//// var x = require('./myMod'); //// x/**/; goTo.file('consumer.js'); diff --git a/tests/cases/fourslash/javaScriptModules16.ts b/tests/cases/fourslash/javaScriptModules16.ts index c34660df59f..09a777f7d2c 100644 --- a/tests/cases/fourslash/javaScriptModules16.ts +++ b/tests/cases/fourslash/javaScriptModules16.ts @@ -9,7 +9,7 @@ //// exports.b = true; // @Filename: consumer.js -//// var x = require('myMod'); +//// var x = require('./myMod'); //// x/**/; goTo.file('consumer.js'); diff --git a/tests/cases/fourslash/javaScriptModules19.ts b/tests/cases/fourslash/javaScriptModules19.ts new file mode 100644 index 00000000000..564cbea722f --- /dev/null +++ b/tests/cases/fourslash/javaScriptModules19.ts @@ -0,0 +1,26 @@ +/// + +// Assignments to 'module.exports' create an external module + +// @allowJs: true +// @Filename: myMod.js +//// var x = { a: 10 }; +//// module.exports = x; + +// @Filename: isGlobal.js +//// var y = 10; + +// @Filename: consumer.js +//// var x = require('./myMod'); +//// /**/; + +goTo.file('consumer.js'); +goTo.marker(); + +verify.completionListContains('y'); +verify.not.completionListContains('invisible'); + +edit.insert('x.'); +verify.memberListContains('a', undefined, undefined, 'property'); +edit.insert('a.'); +verify.memberListContains('toFixed', undefined, undefined, 'method'); diff --git a/tests/cases/fourslash/javaScriptModulesError1.ts b/tests/cases/fourslash/javaScriptModulesError1.ts new file mode 100644 index 00000000000..f13b25a182e --- /dev/null +++ b/tests/cases/fourslash/javaScriptModulesError1.ts @@ -0,0 +1,12 @@ +/// + +// Error: Having more function parameters than entries in the dependency array + +// @allowNonTsExtensions: true +// @Filename: Foo.js +//// define('mod1', ['a'], /**/function(a, b) { +//// +//// }); + +// TODO: what should happen? +goTo.marker(); \ No newline at end of file diff --git a/tests/cases/fourslash/javascriptModules20.ts b/tests/cases/fourslash/javascriptModules20.ts new file mode 100644 index 00000000000..7ef5c73e1c3 --- /dev/null +++ b/tests/cases/fourslash/javascriptModules20.ts @@ -0,0 +1,13 @@ +/// +// @allowJs: true + +// @Filename: mod.js +//// function foo() { return {a: true}; } +//// module.exports = foo(); + +// @Filename: app.js +//// import * as mod from "./mod" +//// mod./**/ + +goTo.marker(); +verify.completionListContains('a'); diff --git a/tests/cases/fourslash/javascriptModules21.ts b/tests/cases/fourslash/javascriptModules21.ts new file mode 100644 index 00000000000..3a046515924 --- /dev/null +++ b/tests/cases/fourslash/javascriptModules21.ts @@ -0,0 +1,14 @@ +/// +// @allowJs: true +// @module: system + +// @Filename: mod.js +//// function foo() { return {a: true}; } +//// module.exports = foo(); + +// @Filename: app.js +//// import mod from "./mod" +//// mod./**/ + +goTo.marker(); +verify.completionListContains('a'); diff --git a/tests/cases/fourslash/javascriptModules22.ts b/tests/cases/fourslash/javascriptModules22.ts new file mode 100644 index 00000000000..89fa99b5ea2 --- /dev/null +++ b/tests/cases/fourslash/javascriptModules22.ts @@ -0,0 +1,32 @@ +/// +// @allowJs: true + +// @Filename: mod.js +//// function foo() { return {a: "hello, world"}; } +//// module.exports = foo(); + +// @Filename: mod2.js +//// var x = {name: 'test'}; +//// (function createExport(obj){ +//// module.exports = { +//// "default": x, +//// "sausages": {eggs: 2} +//// }; +//// })(); + +// @Filename: app.js +//// import {a} from "./mod" +//// import def, {sausages} from "./mod2" +//// a./**/ + +goTo.marker(); +verify.completionListContains('toString'); + +edit.backspace(2); +edit.insert("def."); +verify.completionListContains("name"); + +edit.insert("name;\nsausages."); +verify.completionListContains("eggs"); +edit.insert("eggs;"); +verify.numberOfErrorsInCurrentFile(0); diff --git a/tests/cases/fourslash/javascriptModules23.ts b/tests/cases/fourslash/javascriptModules23.ts new file mode 100644 index 00000000000..eafbea87baa --- /dev/null +++ b/tests/cases/fourslash/javascriptModules23.ts @@ -0,0 +1,12 @@ +/// + +// @Filename: mod.ts +//// var foo = {a: "test"}; +//// export = foo; + +// @Filename: app.ts +//// import {a} from "./mod" +//// a./**/ + +goTo.marker(); +verify.completionListContains('toString'); diff --git a/tests/cases/fourslash/javascriptModules24.ts b/tests/cases/fourslash/javascriptModules24.ts new file mode 100644 index 00000000000..5a0dd892db7 --- /dev/null +++ b/tests/cases/fourslash/javascriptModules24.ts @@ -0,0 +1,21 @@ +/// + +// @Filename: mod.ts +//// function foo() { return 42; } +//// namespace foo { +//// export function bar (a: string) { return a; } +//// } +//// export = foo; + +// @Filename: app.ts +//// import * as foo from "./mod" +//// foo/*1*/(); +//// foo.bar(/*2*/"test"); + +goTo.marker('1'); + +/**** BUG: Should be an error to invoke a call signature on a namespace import ****/ +//verify.errorExistsBeforeMarker('1'); +verify.quickInfoIs("(alias) foo(): number\nimport foo"); +goTo.marker('2'); +verify.signatureHelpArgumentCountIs(1); diff --git a/tests/cases/fourslash/javascriptModules25.ts b/tests/cases/fourslash/javascriptModules25.ts new file mode 100644 index 00000000000..aceada8af21 --- /dev/null +++ b/tests/cases/fourslash/javascriptModules25.ts @@ -0,0 +1,13 @@ +/// +// @allowJs: true + +// @Filename: mod.js +//// function foo() { return {a: true}; } +//// module.exports.a = foo; + +// @Filename: app.js +//// import * as mod from "./mod" +//// mod./**/ + +goTo.marker(); +verify.completionListContains('a'); diff --git a/tests/cases/fourslash/jsDocFunctionSignatures2.ts b/tests/cases/fourslash/jsDocFunctionSignatures2.ts new file mode 100644 index 00000000000..174ea7d6560 --- /dev/null +++ b/tests/cases/fourslash/jsDocFunctionSignatures2.ts @@ -0,0 +1,12 @@ +/// + +// @allowNonTsExtensions: true +// @Filename: Foo.js + +//// /** @type {function(string, boolean=): number} */ +//// var f6; +//// +//// f6('', /**/false) + +goTo.marker(); +verify.currentSignatureHelpIs('f6(p0: string, p1?: boolean): number') diff --git a/tests/cases/fourslash/jsDocFunctionSignatures3.ts b/tests/cases/fourslash/jsDocFunctionSignatures3.ts new file mode 100644 index 00000000000..3679035d31d --- /dev/null +++ b/tests/cases/fourslash/jsDocFunctionSignatures3.ts @@ -0,0 +1,32 @@ +/// + +// @allowNonTsExtensions: true +// @Filename: Foo.js + +//// var someObject = { +//// /** +//// * @param {string} param1 Some string param. +//// * @param {number} parm2 Some number param. +//// */ +//// someMethod: function(param1, param2) { +//// console.log(param1/*1*/); +//// return false; +//// }, +//// /** +//// * @param {number} p1 Some number param. +//// */ +//// otherMethod(p1) { +//// p1/*2*/ +//// } +//// +//// }; + +goTo.marker('1'); +edit.insert('.'); +verify.memberListContains('substr', undefined, undefined, 'method'); +edit.backspace(); + +goTo.marker('2'); +edit.insert('.'); +verify.memberListContains('toFixed', undefined, undefined, 'method'); +edit.backspace(); diff --git a/tests/cases/fourslash/jsDocFunctionSignatures4.ts b/tests/cases/fourslash/jsDocFunctionSignatures4.ts new file mode 100644 index 00000000000..e2b443d8d40 --- /dev/null +++ b/tests/cases/fourslash/jsDocFunctionSignatures4.ts @@ -0,0 +1,11 @@ +/// + +// @allowNonTsExtensions: true +// @Filename: Foo.js + +//// /** @param {function ({OwnerID:string,AwayID:string}):void} x +//// * @param {function (string):void} y */ +//// function fn(x, y) { } + +verify.numberOfErrorsInCurrentFile(0); + diff --git a/tests/cases/fourslash/jsDocGenerics1.ts b/tests/cases/fourslash/jsDocGenerics1.ts new file mode 100644 index 00000000000..61358e3f490 --- /dev/null +++ b/tests/cases/fourslash/jsDocGenerics1.ts @@ -0,0 +1,34 @@ +/// + +// @allowNonTsExtensions: true +// @Filename: ref.d.ts +//// namespace Thing { +//// export interface Thung { +//// a: number; +//// ] +//// ] + + +// @Filename: Foo.js +//// +//// /** @type {Array} */ +//// var v; +//// v[0]./*1*/ +//// +//// /** @type {{x: Array>}} */ +//// var w; +//// w.x[0][0]./*2*/ +//// +//// /** @type {Array} */ +//// var x; +//// x[0].a./*3*/ + + +goTo.marker('1'); +verify.memberListContains("toFixed", /*displayText:*/ undefined, /*documentation*/ undefined, "method"); + +goTo.marker('2'); +verify.memberListContains("toFixed", /*displayText:*/ undefined, /*documentation*/ undefined, "method"); + +goTo.marker('3'); +verify.memberListContains("toFixed", /*displayText:*/ undefined, /*documentation*/ undefined, "method"); diff --git a/tests/cases/fourslash/jsxBraceCompletionPosition.ts b/tests/cases/fourslash/jsxBraceCompletionPosition.ts new file mode 100644 index 00000000000..c1c331435ce --- /dev/null +++ b/tests/cases/fourslash/jsxBraceCompletionPosition.ts @@ -0,0 +1,47 @@ +/// + +//@Filename: file.tsx +//// declare var React: any; +//// +//// var x =
+//// /*1*/ +////
; +//// var y =
/*4*/
+//// var z =
+//// hello /*5*/ +////
+//// var z2 =
{ /*6*/ +////
+//// var z3 =
+//// { +//// /*7*/ +//// } +////
+ +goTo.marker('1'); +verify.not.isValidBraceCompletionAtPostion('('); +verify.isValidBraceCompletionAtPostion('{'); + +goTo.marker('2'); +verify.not.isValidBraceCompletionAtPostion('('); +verify.not.isValidBraceCompletionAtPostion('{'); + +goTo.marker('3'); +verify.not.isValidBraceCompletionAtPostion('('); +verify.isValidBraceCompletionAtPostion('{'); + +goTo.marker('4'); +verify.not.isValidBraceCompletionAtPostion('('); +verify.isValidBraceCompletionAtPostion('{'); + +goTo.marker('5'); +verify.not.isValidBraceCompletionAtPostion('('); +verify.isValidBraceCompletionAtPostion('{'); + +goTo.marker('6'); +verify.not.isValidBraceCompletionAtPostion('('); +verify.isValidBraceCompletionAtPostion('{'); + +goTo.marker('7'); +verify.not.isValidBraceCompletionAtPostion('('); +verify.isValidBraceCompletionAtPostion('{'); \ No newline at end of file diff --git a/tests/cases/fourslash/memberListOfEnumFromExternalModule.ts b/tests/cases/fourslash/memberListOfEnumFromExternalModule.ts index c93c8292138..42171ff2e8b 100644 --- a/tests/cases/fourslash/memberListOfEnumFromExternalModule.ts +++ b/tests/cases/fourslash/memberListOfEnumFromExternalModule.ts @@ -5,7 +5,7 @@ ////var topic = Topic.One; // @Filename: memberListOfEnumFromExternalModule_file1.ts -////import t = require('memberListOfEnumFromExternalModule_file0'); +////import t = require('./memberListOfEnumFromExternalModule_file0'); ////var topic = t.Topic./*1*/ goTo.file("memberListOfEnumFromExternalModule_file1.ts"); diff --git a/tests/cases/fourslash/memberListOnExplicitThis.ts b/tests/cases/fourslash/memberListOnExplicitThis.ts new file mode 100644 index 00000000000..b776a7c0641 --- /dev/null +++ b/tests/cases/fourslash/memberListOnExplicitThis.ts @@ -0,0 +1,29 @@ +/// + +////interface Restricted { +//// n: number; +////} +////class C1 implements Restricted { +//// n: number; +//// m: number; +//// f(this: this) {this./*1*/} // test on 'this.' +//// g(this: Restricted) {this./*2*/} +////} +////function f(this: void) {this./*3*/} +////function g(this: Restricted) {this./*4*/} + +goTo.marker('1'); +verify.memberListContains('f', '(method) C1.f(this: this): void'); +verify.memberListContains('g', '(method) C1.g(this: Restricted): void'); +verify.memberListContains('n', '(property) C1.n: number'); +verify.memberListContains('m', '(property) C1.m: number'); + +goTo.marker('2'); +verify.memberListContains('n', '(property) Restricted.n: number'); + +goTo.marker('3'); +verify.memberListIsEmpty(); + +goTo.marker('4'); +verify.memberListContains('n', '(property) Restricted.n: number'); + diff --git a/tests/cases/fourslash/mergedDeclarationsWithExportAssignment1.ts b/tests/cases/fourslash/mergedDeclarationsWithExportAssignment1.ts index 00b9aaf8447..791f519aa28 100644 --- a/tests/cases/fourslash/mergedDeclarationsWithExportAssignment1.ts +++ b/tests/cases/fourslash/mergedDeclarationsWithExportAssignment1.ts @@ -11,7 +11,7 @@ // @Filename: mergedDeclarationsWithExportAssignment1_file1.ts /////// -////import /*1*/Foo = require('mergedDeclarationsWithExportAssignment1_file0'); +////import /*1*/Foo = require('./mergedDeclarationsWithExportAssignment1_file0'); ////var /*3*/z = new /*2*/Foo(); ////var /*5*/r2 = Foo./*4*/x; @@ -19,7 +19,7 @@ edit.insert(''); goTo.marker('1'); -verify.quickInfoIs("import Foo = require('mergedDeclarationsWithExportAssignment1_file0')"); +verify.quickInfoIs("import Foo = require('./mergedDeclarationsWithExportAssignment1_file0')"); goTo.marker('2'); verify.completionListContains('Foo'); diff --git a/tests/cases/fourslash/navbar_const.ts b/tests/cases/fourslash/navbar_const.ts index 6c0738747f3..a2cdb80baef 100644 --- a/tests/cases/fourslash/navbar_const.ts +++ b/tests/cases/fourslash/navbar_const.ts @@ -3,7 +3,7 @@ //// {| "itemName": "c", "kind": "const", "parentName": "" |}const c = 0; test.markers().forEach(marker => { - verify.getScriptLexicalStructureListContains( + verify.navigationBarContains( marker.data.itemName, marker.data.kind, marker.fileName, diff --git a/tests/cases/fourslash/navbar_contains-no-duplicates.ts b/tests/cases/fourslash/navbar_contains-no-duplicates.ts index 49d570ed770..4c612136b55 100644 --- a/tests/cases/fourslash/navbar_contains-no-duplicates.ts +++ b/tests/cases/fourslash/navbar_contains-no-duplicates.ts @@ -29,7 +29,7 @@ test.markers().forEach(marker => { if (marker.data) { - verify.getScriptLexicalStructureListContains( + verify.navigationBarContains( marker.data.itemName, marker.data.kind, marker.fileName, @@ -38,4 +38,4 @@ test.markers().forEach(marker => { marker.position); } }); -verify.getScriptLexicalStructureListCount(12); \ No newline at end of file +verify.navigationBarCount(12); \ No newline at end of file diff --git a/tests/cases/fourslash/navbar_exportDefault.ts b/tests/cases/fourslash/navbar_exportDefault.ts index a8fe854fa28..a56eeb8b226 100644 --- a/tests/cases/fourslash/navbar_exportDefault.ts +++ b/tests/cases/fourslash/navbar_exportDefault.ts @@ -14,7 +14,7 @@ test.markers().forEach(marker => { goTo.file(marker.fileName); - verify.getScriptLexicalStructureListContains( + verify.navigationBarContains( marker.data.itemName, marker.data.kind, marker.fileName, diff --git a/tests/cases/fourslash/navbar_let.ts b/tests/cases/fourslash/navbar_let.ts index 841382abc53..c3b125526ef 100644 --- a/tests/cases/fourslash/navbar_let.ts +++ b/tests/cases/fourslash/navbar_let.ts @@ -3,7 +3,7 @@ //// {| "itemName": "c", "kind": "let", "parentName": "" |}let c = 0; test.markers().forEach(marker => { - verify.getScriptLexicalStructureListContains( + verify.navigationBarContains( marker.data.itemName, marker.data.kind, marker.fileName, diff --git a/tests/cases/fourslash/navigationBarItemsBindingPatterns.ts b/tests/cases/fourslash/navigationBarItemsBindingPatterns.ts index 2b363bfad3b..afac15daacc 100644 --- a/tests/cases/fourslash/navigationBarItemsBindingPatterns.ts +++ b/tests/cases/fourslash/navigationBarItemsBindingPatterns.ts @@ -6,16 +6,16 @@ ////const bar1, [c, d] ////var {e, x: [f, g]} = {a:1, x:[]}; -verify.getScriptLexicalStructureListCount(12); // global (1) + variable declarations (4) + binding patterns (7) -verify.getScriptLexicalStructureListContains("foo", "var"); -verify.getScriptLexicalStructureListContains("bar", "var"); -verify.getScriptLexicalStructureListContains("foo1", "let") -verify.getScriptLexicalStructureListContains("a", "let"); -verify.getScriptLexicalStructureListContains("b", "let"); -verify.getScriptLexicalStructureListContains("bar1", "const"); -verify.getScriptLexicalStructureListContains("c", "const"); -verify.getScriptLexicalStructureListContains("d", "const"); -verify.getScriptLexicalStructureListContains("e", "var"); -verify.getScriptLexicalStructureListContains("f", "var"); -verify.getScriptLexicalStructureListContains("g", "var"); +verify.navigationBarCount(12); // global (1) + variable declarations (4) + binding patterns (7) +verify.navigationBarContains("foo", "var"); +verify.navigationBarContains("bar", "var"); +verify.navigationBarContains("foo1", "let") +verify.navigationBarContains("a", "let"); +verify.navigationBarContains("b", "let"); +verify.navigationBarContains("bar1", "const"); +verify.navigationBarContains("c", "const"); +verify.navigationBarContains("d", "const"); +verify.navigationBarContains("e", "var"); +verify.navigationBarContains("f", "var"); +verify.navigationBarContains("g", "var"); diff --git a/tests/cases/fourslash/navigationBarItemsBindingPatternsInConstructor.ts b/tests/cases/fourslash/navigationBarItemsBindingPatternsInConstructor.ts index c496a0281e3..84c1d09efe7 100644 --- a/tests/cases/fourslash/navigationBarItemsBindingPatternsInConstructor.ts +++ b/tests/cases/fourslash/navigationBarItemsBindingPatternsInConstructor.ts @@ -11,4 +11,4 @@ //// } ////} -verify.getScriptLexicalStructureListCount(6); // 2x(class + field + constructor) +verify.navigationBarCount(6); // 2x(class + field + constructor) diff --git a/tests/cases/fourslash/navigationBarItemsEmptyConstructors.ts b/tests/cases/fourslash/navigationBarItemsEmptyConstructors.ts index 570b2f7518c..2255d29e293 100644 --- a/tests/cases/fourslash/navigationBarItemsEmptyConstructors.ts +++ b/tests/cases/fourslash/navigationBarItemsEmptyConstructors.ts @@ -5,8 +5,8 @@ //// } ////} -verify.getScriptLexicalStructureListContains("Test", "class"); -verify.getScriptLexicalStructureListContains("constructor", "constructor"); +verify.navigationBarContains("Test", "class"); +verify.navigationBarContains("constructor", "constructor"); // no other items -verify.getScriptLexicalStructureListCount(2); \ No newline at end of file +verify.navigationBarCount(2); \ No newline at end of file diff --git a/tests/cases/fourslash/navigationBarItemsExports.ts b/tests/cases/fourslash/navigationBarItemsExports.ts index d9db125b9b0..b88b60d0efb 100644 --- a/tests/cases/fourslash/navigationBarItemsExports.ts +++ b/tests/cases/fourslash/navigationBarItemsExports.ts @@ -11,8 +11,8 @@ test.markers().forEach((marker) => { if (marker.data) { - verify.getScriptLexicalStructureListContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName); + verify.navigationBarContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName); } }); -verify.getScriptLexicalStructureListCount(4); +verify.navigationBarCount(4); diff --git a/tests/cases/fourslash/navigationBarItemsFunctions.ts b/tests/cases/fourslash/navigationBarItemsFunctions.ts index b683790c60d..0948923c046 100644 --- a/tests/cases/fourslash/navigationBarItemsFunctions.ts +++ b/tests/cases/fourslash/navigationBarItemsFunctions.ts @@ -17,7 +17,7 @@ ////} test.markers().forEach((marker) => { - verify.getScriptLexicalStructureListContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName); + verify.navigationBarContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName); }); -verify.getScriptLexicalStructureListCount(8); // 4 functions + global. Note: there are 8 because of the functions show up at the top level and as child items. +verify.navigationBarCount(8); // 4 functions + global. Note: there are 8 because of the functions show up at the top level and as child items. diff --git a/tests/cases/fourslash/navigationBarItemsFunctionsBroken.ts b/tests/cases/fourslash/navigationBarItemsFunctionsBroken.ts index 7846a9723d1..e8bf1d33fc3 100644 --- a/tests/cases/fourslash/navigationBarItemsFunctionsBroken.ts +++ b/tests/cases/fourslash/navigationBarItemsFunctionsBroken.ts @@ -6,7 +6,7 @@ ////} test.markers().forEach((marker) => { - verify.getScriptLexicalStructureListContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName); + verify.navigationBarContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName); }); -verify.getScriptLexicalStructureListCount(3); // and 'f'. \ No newline at end of file +verify.navigationBarCount(3); // and 'f'. \ No newline at end of file diff --git a/tests/cases/fourslash/navigationBarItemsFunctionsBroken2.ts b/tests/cases/fourslash/navigationBarItemsFunctionsBroken2.ts index 50bf91e02d6..9576d4dd789 100644 --- a/tests/cases/fourslash/navigationBarItemsFunctionsBroken2.ts +++ b/tests/cases/fourslash/navigationBarItemsFunctionsBroken2.ts @@ -7,7 +7,7 @@ ////} test.markers().forEach((marker) => { - verify.getScriptLexicalStructureListContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName); + verify.navigationBarContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName); }); -verify.getScriptLexicalStructureListCount(3); // and 'f' \ No newline at end of file +verify.navigationBarCount(3); // and 'f' \ No newline at end of file diff --git a/tests/cases/fourslash/navigationBarItemsImports.ts b/tests/cases/fourslash/navigationBarItemsImports.ts index 8b0d02bd9f5..53619da310a 100644 --- a/tests/cases/fourslash/navigationBarItemsImports.ts +++ b/tests/cases/fourslash/navigationBarItemsImports.ts @@ -18,8 +18,8 @@ test.markers().forEach((marker) => { if (marker.data) { - verify.getScriptLexicalStructureListContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName); + verify.navigationBarContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName); } }); -verify.getScriptLexicalStructureListCount(9); +verify.navigationBarCount(9); diff --git a/tests/cases/fourslash/navigationBarItemsInsideMethodsAndConstructors.ts b/tests/cases/fourslash/navigationBarItemsInsideMethodsAndConstructors.ts new file mode 100644 index 00000000000..7aaa3d7f5a2 --- /dev/null +++ b/tests/cases/fourslash/navigationBarItemsInsideMethodsAndConstructors.ts @@ -0,0 +1,42 @@ +/// + +////class Class { +//// constructor() { +//// {| "itemName": "LocalFunctionInConstructor", "kind": "function", "parentName": "Class"|}function LocalFunctionInConstructor() { +//// +//// } +//// +//// {| "itemName": "LocalInterfaceInConstrcutor", "kind": "interface", "parentName": "foo"|}interface LocalInterfaceInConstrcutor { +//// } +//// +//// enum LocalEnumInConstructor { +//// {| "itemName": "LocalEnumMemberInConstructor", "kind": "property", "parentName": "LocalEnumInConstructor"|}LocalEnumMemberInConstructor, +//// } +//// } +//// +//// method() { +//// {| "itemName": "LocalFunctionInMethod", "kind": "function", "parentName": "foo"|}function LocalFunctionInMethod() { +//// {| "itemName": "LocalFunctionInLocalFunctionInMethod", "kind": "function", "parentName": "bar"|}function LocalFunctionInLocalFunctionInMethod() { +//// +//// } +//// } +//// +//// {| "itemName": "LocalInterfaceInMethod", "kind": "interface", "parentName": "foo"|}interface LocalInterfaceInMethod { +//// } +//// +//// enum LocalEnumInMethod { +//// {| "itemName": "LocalEnumMemberInMethod", "kind": "property", "parentName": "foo"|}LocalEnumMemberInMethod, +//// } +//// } +//// +//// emptyMethod() { // Non child functions method should not be duplicated +//// +//// } +////} + +test.markers().forEach((marker) => { + verify.navigationBarContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName); +}); + +// no other items +verify.navigationBarCount(17); diff --git a/tests/cases/fourslash/navigationBarItemsItems.ts b/tests/cases/fourslash/navigationBarItemsItems.ts index 67e14fe1009..3804a0dab55 100644 --- a/tests/cases/fourslash/navigationBarItemsItems.ts +++ b/tests/cases/fourslash/navigationBarItemsItems.ts @@ -45,8 +45,8 @@ test.markers().forEach((marker) => { if (marker.data) { - verify.getScriptLexicalStructureListContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName); + verify.navigationBarContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName); } }); -verify.getScriptLexicalStructureListCount(23); +verify.navigationBarCount(23); diff --git a/tests/cases/fourslash/navigationBarItemsItems2.ts b/tests/cases/fourslash/navigationBarItemsItems2.ts index 3b94260ddbd..d4ffde54051 100644 --- a/tests/cases/fourslash/navigationBarItemsItems2.ts +++ b/tests/cases/fourslash/navigationBarItemsItems2.ts @@ -8,5 +8,5 @@ edit.insertLine("module A"); edit.insert("export class "); // should not crash -verify.getScriptLexicalStructureListCount(2); +verify.navigationBarCount(2); diff --git a/tests/cases/fourslash/navigationBarItemsItemsContainsNoAnonymousFunctions.ts b/tests/cases/fourslash/navigationBarItemsItemsContainsNoAnonymousFunctions.ts index b7430ad03de..dac6e96ab93 100644 --- a/tests/cases/fourslash/navigationBarItemsItemsContainsNoAnonymousFunctions.ts +++ b/tests/cases/fourslash/navigationBarItemsItemsContainsNoAnonymousFunctions.ts @@ -30,15 +30,15 @@ ////} goTo.marker("file1"); -verify.getScriptLexicalStructureListCount(0); +verify.navigationBarCount(0); goTo.marker("file2"); -verify.getScriptLexicalStructureListContains("", "module"); -verify.getScriptLexicalStructureListContains("x", "var"); -verify.getScriptLexicalStructureListCount(2); +verify.navigationBarContains("", "module"); +verify.navigationBarContains("x", "var"); +verify.navigationBarCount(2); goTo.marker("file3"); -verify.getScriptLexicalStructureListContains("", "module"); -verify.getScriptLexicalStructureListContains("foo", "function"); -verify.getScriptLexicalStructureListContains("bar", "function"); -verify.getScriptLexicalStructureListCount(5); \ No newline at end of file +verify.navigationBarContains("", "module"); +verify.navigationBarContains("foo", "function"); +verify.navigationBarContains("bar", "function"); +verify.navigationBarCount(5); \ No newline at end of file diff --git a/tests/cases/fourslash/navigationBarItemsItemsExternalModules.ts b/tests/cases/fourslash/navigationBarItemsItemsExternalModules.ts index 550f1aed783..64a595cafb1 100644 --- a/tests/cases/fourslash/navigationBarItemsItemsExternalModules.ts +++ b/tests/cases/fourslash/navigationBarItemsItemsExternalModules.ts @@ -5,7 +5,7 @@ ////} test.markers().forEach((marker) => { - verify.getScriptLexicalStructureListContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName); + verify.navigationBarContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName); }); -verify.getScriptLexicalStructureListCount(2); // external module node + class + property +verify.navigationBarCount(2); // external module node + class + property diff --git a/tests/cases/fourslash/navigationBarItemsItemsExternalModules2.ts b/tests/cases/fourslash/navigationBarItemsItemsExternalModules2.ts index b0bf6eb3fa2..7c1c32cff76 100644 --- a/tests/cases/fourslash/navigationBarItemsItemsExternalModules2.ts +++ b/tests/cases/fourslash/navigationBarItemsItemsExternalModules2.ts @@ -9,7 +9,7 @@ ////export var x: number; test.markers().forEach((marker) => { - verify.getScriptLexicalStructureListContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName); + verify.navigationBarContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName); }); -verify.getScriptLexicalStructureListCount(4); // external module node + variable in module + class + property +verify.navigationBarCount(4); // external module node + variable in module + class + property diff --git a/tests/cases/fourslash/navigationBarItemsItemsExternalModules3.ts b/tests/cases/fourslash/navigationBarItemsItemsExternalModules3.ts index 9ef49e38776..193da9ff47b 100644 --- a/tests/cases/fourslash/navigationBarItemsItemsExternalModules3.ts +++ b/tests/cases/fourslash/navigationBarItemsItemsExternalModules3.ts @@ -9,7 +9,7 @@ ////export var x: number; test.markers().forEach((marker) => { - verify.getScriptLexicalStructureListContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName); + verify.navigationBarContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName); }); -verify.getScriptLexicalStructureListCount(4); // external module node + variable in module + class + property +verify.navigationBarCount(4); // external module node + variable in module + class + property diff --git a/tests/cases/fourslash/navigationBarItemsItemsModuleVariables.ts b/tests/cases/fourslash/navigationBarItemsItemsModuleVariables.ts index 85bf609105c..afc1acfb9cb 100644 --- a/tests/cases/fourslash/navigationBarItemsItemsModuleVariables.ts +++ b/tests/cases/fourslash/navigationBarItemsItemsModuleVariables.ts @@ -19,12 +19,12 @@ //// export var z = 0; ////} goTo.marker("file1"); -verify.getScriptLexicalStructureListContains("Module1", "module"); -verify.getScriptLexicalStructureListContains("x", "var"); +verify.navigationBarContains("Module1", "module"); +verify.navigationBarContains("x", "var"); // nothing else should show up -verify.getScriptLexicalStructureListCount(2); +verify.navigationBarCount(2); goTo.marker("file2"); -verify.getScriptLexicalStructureListContains("Module1.SubModule", "module"); -verify.getScriptLexicalStructureListContains("y", "var"); -verify.getScriptLexicalStructureListCount(2); +verify.navigationBarContains("Module1.SubModule", "module"); +verify.navigationBarContains("y", "var"); +verify.navigationBarCount(2); diff --git a/tests/cases/fourslash/navigationBarItemsMissingName1.ts b/tests/cases/fourslash/navigationBarItemsMissingName1.ts index c5282d696f3..98321039c5a 100644 --- a/tests/cases/fourslash/navigationBarItemsMissingName1.ts +++ b/tests/cases/fourslash/navigationBarItemsMissingName1.ts @@ -9,8 +9,8 @@ test.markers().forEach((marker) => { - verify.getScriptLexicalStructureListContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName); + verify.navigationBarContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName); }); /// Only have two named elements. -verify.getScriptLexicalStructureListCount(2); +verify.navigationBarCount(2); diff --git a/tests/cases/fourslash/navigationBarItemsMissingName2.ts b/tests/cases/fourslash/navigationBarItemsMissingName2.ts index bf0dc038991..d26aa0b553d 100644 --- a/tests/cases/fourslash/navigationBarItemsMissingName2.ts +++ b/tests/cases/fourslash/navigationBarItemsMissingName2.ts @@ -8,4 +8,4 @@ // The class is unnamed, so its method is not included either. -verify.getScriptLexicalStructureListCount(2); +verify.navigationBarCount(2); diff --git a/tests/cases/fourslash/navigationBarItemsModules.ts b/tests/cases/fourslash/navigationBarItemsModules.ts index a5fc9b641f9..2f6e1d7f844 100644 --- a/tests/cases/fourslash/navigationBarItemsModules.ts +++ b/tests/cases/fourslash/navigationBarItemsModules.ts @@ -39,10 +39,10 @@ test.markers().forEach((marker) => { - verify.getScriptLexicalStructureListContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName); + verify.navigationBarContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName); }); /// We have 8 module keywords, and 4 var keywords. /// The declarations of A.B.C.x do not get merged, so the 4 vars are independent. /// The two 'A' modules, however, do get merged, so in reality we have 7 modules. -verify.getScriptLexicalStructureListCount(11); +verify.navigationBarCount(11); diff --git a/tests/cases/fourslash/navigationBarItemsMultilineStringIdentifiers.ts b/tests/cases/fourslash/navigationBarItemsMultilineStringIdentifiers.ts index 59eca486b62..8856c4c044a 100644 --- a/tests/cases/fourslash/navigationBarItemsMultilineStringIdentifiers.ts +++ b/tests/cases/fourslash/navigationBarItemsMultilineStringIdentifiers.ts @@ -35,7 +35,7 @@ test.markers().forEach((marker) => { - verify.getScriptLexicalStructureListContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName); + verify.navigationBarContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName); }); -verify.getScriptLexicalStructureListCount(9); // interface w/ 2 properties, class w/ 2 properties, 3 modules \ No newline at end of file +verify.navigationBarCount(9); // interface w/ 2 properties, class w/ 2 properties, 3 modules \ No newline at end of file diff --git a/tests/cases/fourslash/navigationBarItemsPropertiesDefinedInConstructors.ts b/tests/cases/fourslash/navigationBarItemsPropertiesDefinedInConstructors.ts index adda43066a3..9b3f4aacd9c 100644 --- a/tests/cases/fourslash/navigationBarItemsPropertiesDefinedInConstructors.ts +++ b/tests/cases/fourslash/navigationBarItemsPropertiesDefinedInConstructors.ts @@ -6,10 +6,10 @@ //// } ////} -verify.getScriptLexicalStructureListContains("List", "class"); -verify.getScriptLexicalStructureListContains("constructor", "constructor"); -verify.getScriptLexicalStructureListContains("a", "property"); -verify.getScriptLexicalStructureListContains("b", "property"); +verify.navigationBarContains("List", "class"); +verify.navigationBarContains("constructor", "constructor"); +verify.navigationBarContains("a", "property"); +verify.navigationBarContains("b", "property"); // no other items -verify.getScriptLexicalStructureListCount(4); \ No newline at end of file +verify.navigationBarCount(4); \ No newline at end of file diff --git a/tests/cases/fourslash/navigationBarItemsSymbols1.ts b/tests/cases/fourslash/navigationBarItemsSymbols1.ts index e3dde6738e9..c9df85b3ece 100644 --- a/tests/cases/fourslash/navigationBarItemsSymbols1.ts +++ b/tests/cases/fourslash/navigationBarItemsSymbols1.ts @@ -11,7 +11,7 @@ ////} test.markers().forEach(marker => { - verify.getScriptLexicalStructureListContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName); + verify.navigationBarContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName); }); -verify.getScriptLexicalStructureListCount(test.markers().length); \ No newline at end of file +verify.navigationBarCount(test.markers().length); \ No newline at end of file diff --git a/tests/cases/fourslash/navigationBarItemsSymbols2.ts b/tests/cases/fourslash/navigationBarItemsSymbols2.ts index d048de895ec..579a6353c13 100644 --- a/tests/cases/fourslash/navigationBarItemsSymbols2.ts +++ b/tests/cases/fourslash/navigationBarItemsSymbols2.ts @@ -9,7 +9,7 @@ ////} test.markers().forEach(marker => { - verify.getScriptLexicalStructureListContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName); + verify.navigationBarContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName); }); -verify.getScriptLexicalStructureListCount(test.markers().length); \ No newline at end of file +verify.navigationBarCount(test.markers().length); \ No newline at end of file diff --git a/tests/cases/fourslash/navigationBarItemsSymbols3.ts b/tests/cases/fourslash/navigationBarItemsSymbols3.ts index 19f81037559..5677c0b6301 100644 --- a/tests/cases/fourslash/navigationBarItemsSymbols3.ts +++ b/tests/cases/fourslash/navigationBarItemsSymbols3.ts @@ -7,7 +7,7 @@ ////} test.markers().forEach(marker => { - verify.getScriptLexicalStructureListContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName); + verify.navigationBarContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName); }); -verify.getScriptLexicalStructureListCount(test.markers().length); \ No newline at end of file +verify.navigationBarCount(test.markers().length); \ No newline at end of file diff --git a/tests/cases/fourslash/navigationBarItemsTypeAlias.ts b/tests/cases/fourslash/navigationBarItemsTypeAlias.ts new file mode 100644 index 00000000000..50923256533 --- /dev/null +++ b/tests/cases/fourslash/navigationBarItemsTypeAlias.ts @@ -0,0 +1,6 @@ +/// + +////type T = number | string; + +verify.navigationBarCount(1); +verify.navigationBarContains("T", "type"); diff --git a/tests/cases/fourslash/navigationItemsInConstructorsExactMatch.ts b/tests/cases/fourslash/navigationItemsInConstructorsExactMatch.ts index 10397813fd0..5c6cf91a40a 100644 --- a/tests/cases/fourslash/navigationItemsInConstructorsExactMatch.ts +++ b/tests/cases/fourslash/navigationItemsInConstructorsExactMatch.ts @@ -2,7 +2,7 @@ ////class Test { //// private search1: number; -//// constructor(public search2: boolean, search3: string) { +//// constructor(public search2: boolean, readonly search3: string, search4: string) { //// } ////} @@ -10,3 +10,4 @@ var searchValue = "search"; verify.navigationItemsListContains("search1", "property", searchValue, "prefix"); verify.navigationItemsListContains("search2", "property", searchValue, "prefix"); +verify.navigationItemsListContains("search3", "property", searchValue, "prefix"); diff --git a/tests/cases/fourslash/objectLiteralBindingInParameter.ts b/tests/cases/fourslash/objectLiteralBindingInParameter.ts new file mode 100644 index 00000000000..b1cbd21d929 --- /dev/null +++ b/tests/cases/fourslash/objectLiteralBindingInParameter.ts @@ -0,0 +1,35 @@ +/// + +////interface I { x1: number; x2: string } +////function f(cb: (ev: I) => any) { } +////f(({/*1*/}) => 0); + +////[null].reduce(({/*2*/}, b) => b); + +////interface Foo { +//// m(x: { x1: number, x2: number }): void; +//// prop: I; +////} +////let x: Foo = { +//// m({ /*3*/ }) { +//// }, +//// get prop(): I { return undefined; }, +//// set prop({ /*4*/ }) { +//// } +////}; + +goTo.marker("1"); +verify.completionListContains("x1"); +verify.completionListContains("x2"); + +goTo.marker("2"); +verify.completionListContains("x1"); +verify.completionListContains("x2"); + +goTo.marker("3"); +verify.completionListContains("x1"); +verify.completionListContains("x2"); + +goTo.marker("4"); +verify.completionListContains("x1"); +verify.completionListContains("x2"); \ No newline at end of file diff --git a/tests/cases/fourslash/quickInfoDisplayPartsEnum.ts b/tests/cases/fourslash/quickInfoDisplayPartsEnum1.ts similarity index 100% rename from tests/cases/fourslash/quickInfoDisplayPartsEnum.ts rename to tests/cases/fourslash/quickInfoDisplayPartsEnum1.ts diff --git a/tests/cases/fourslash/quickInfoDisplayPartsEnum2.ts b/tests/cases/fourslash/quickInfoDisplayPartsEnum2.ts new file mode 100644 index 00000000000..ad08d84c1d5 --- /dev/null +++ b/tests/cases/fourslash/quickInfoDisplayPartsEnum2.ts @@ -0,0 +1,79 @@ +/// + +////enum /*1*/E { +//// /*2*/"e1", +//// /*3*/'e2' = 10, +//// /*4*/"e3" +////} +////var /*5*/eInstance: /*6*/E; +/////*7*/eInstance = /*8*/E./*9*/e1; +/////*10*/eInstance = /*11*/E./*12*/e2; +/////*13*/eInstance = /*14*/E./*15*/e3; +////const enum /*16*/constE { +//// /*17*/"e1", +//// /*18*/'e2' = 10, +//// /*19*/"e3" +////} +////var /*20*/eInstance1: /*21*/constE; +/////*22*/eInstance1 = /*23*/constE./*24*/e1; +/////*25*/eInstance1 = /*26*/constE./*27*/e2; +/////*28*/eInstance1 = /*29*/constE./*30*/e3; + +var marker = 0; +function verifyEnumDeclaration(enumName: string, instanceName: string, isConst?: boolean) { + verifyEnumDisplay(); + + verifyEnumMemberDisplay('"e1"', /*spanLength*/ 4, 0); + verifyEnumMemberDisplay("'e2'", /*spanLength*/ 4, 10); + verifyEnumMemberDisplay('"e3"', /*spanLength*/ 4, 11); + + verifyInstance(); + verifyEnumDisplay(); + + verifyInstance(); + verifyEnumDisplay(); + verifyEnumMemberDisplay('"e1"', /*spanLength*/ 2, 0); + + verifyInstance(); + verifyEnumDisplay(); + verifyEnumMemberDisplay("'e2'", /*spanLength*/ 2, 10); + + verifyInstance(); + verifyEnumDisplay(); + verifyEnumMemberDisplay('"e3"', /*spanLength*/ 2, 11); + + function verifyEnumDisplay() { + marker++; + goTo.marker(marker.toString()); + verify.verifyQuickInfoDisplayParts("enum", "", { start: test.markerByName(marker.toString()).position, length: enumName.length }, + (isConst ? [{ text: "const", kind: "keyword" }, { text: " ", kind: "space" }] : []).concat( + [{ text: "enum", kind: "keyword" }, { text: " ", kind: "space" }, { text: enumName, kind: "enumName" }]), + []);; + } + + function verifyEnumMemberDisplay(enumMemberName: string, spanLength: number, initializer: number) { + marker++; + goTo.marker(marker.toString()); + // Each of these names is a string literal, + // but since they're accessed by property accesses, + // we need to account for the quotes at the beginning and end. + verify.verifyQuickInfoDisplayParts("var", "", { start: test.markerByName(marker.toString()).position, length: spanLength }, + [{ text: "(", kind: "punctuation" }, { text: "enum member", kind: "text" }, { text: ")", kind: "punctuation" }, + { text: " ", kind: "space" }, { text: enumName, kind: "enumName" }, { text: "[", kind: "punctuation" }, { text: enumMemberName, kind: "stringLiteral" }, { text: "]", kind: "punctuation" }, + { text: " ", kind: "space" }, { text: "=", kind: "operator" }, { text: " ", kind: "space" }, { text: initializer.toString(), kind: "numericLiteral" }], + []); + } + + function verifyInstance() { + marker++; + goTo.marker(marker.toString()); + verify.verifyQuickInfoDisplayParts("var", "", { start: test.markerByName(marker.toString()).position, length: instanceName.length }, + [{ text: "var", kind: "keyword" }, + { text: " ", kind: "space" }, { text: instanceName, kind: "localName" }, { text: ":", kind: "punctuation" }, + { text: " ", kind: "space" }, { text: enumName, kind: "enumName" }], + []); + } +} + +verifyEnumDeclaration("E", "eInstance"); +verifyEnumDeclaration("constE", "eInstance1", /*isConst*/ true); diff --git a/tests/cases/fourslash/quickInfoDisplayPartsEnum3.ts b/tests/cases/fourslash/quickInfoDisplayPartsEnum3.ts new file mode 100644 index 00000000000..77fbda1e317 --- /dev/null +++ b/tests/cases/fourslash/quickInfoDisplayPartsEnum3.ts @@ -0,0 +1,80 @@ +/// + +////enum /*1*/E { +//// /*2*/"e1", +//// /*3*/'e2' = 10, +//// /*4*/"e3" +////} +////var /*5*/eInstance: /*6*/E; +/////*7*/eInstance = /*8*/E[/*9*/"e1"]; +/////*10*/eInstance = /*11*/E[/*12*/"e2"]; +/////*13*/eInstance = /*14*/E[/*15*/'e3']; +////const enum /*16*/constE { +//// /*17*/"e1", +//// /*18*/'e2' = 10, +//// /*19*/"e3" +////} +////var /*20*/eInstance1: /*21*/constE; +/////*22*/eInstance1 = /*23*/constE[/*24*/"e1"]; +/////*25*/eInstance1 = /*26*/constE[/*27*/"e2"]; +/////*28*/eInstance1 = /*29*/constE[/*30*/'e3']; + +var marker = 0; +function verifyEnumDeclaration(enumName: string, instanceName: string, isConst?: boolean) { + verifyEnumDisplay(); + + verifyEnumMemberDisplay('"e1"', /*spanLength*/ 4, 0); + verifyEnumMemberDisplay("'e2'", /*spanLength*/ 4, 10); + verifyEnumMemberDisplay('"e3"', /*spanLength*/ 4, 11); + + verifyInstance(); + verifyEnumDisplay(); + + verifyInstance(); + verifyEnumDisplay(); + verifyEnumMemberDisplay('"e1"', /*spanLength*/ 4, 0); + + verifyInstance(); + verifyEnumDisplay(); + verifyEnumMemberDisplay("'e2'", /*spanLength*/ 4, 10); + + verifyInstance(); + verifyEnumDisplay(); + verifyEnumMemberDisplay('"e3"', /*spanLength*/ 4, 11); + + function verifyEnumDisplay() { + marker++; + goTo.marker(marker.toString()); + verify.verifyQuickInfoDisplayParts("enum", "", { start: test.markerByName(marker.toString()).position, length: enumName.length }, + (isConst ? [{ text: "const", kind: "keyword" }, { text: " ", kind: "space" }] : []).concat( + [{ text: "enum", kind: "keyword" }, { text: " ", kind: "space" }, { text: enumName, kind: "enumName" }]), + []);; + } + + function verifyEnumMemberDisplay(enumMemberName: string, spanLength: number, initializer: number) { + marker++; + goTo.marker(marker.toString()); + // Each of these names is a string literal, + // but since they're accessed by property accesses, + // we need to account for the quotes at the beginning and end. + verify.verifyQuickInfoDisplayParts("var", "", { start: test.markerByName(marker.toString()).position, length: spanLength }, + [{ text: "(", kind: "punctuation" }, { text: "enum member", kind: "text" }, { text: ")", kind: "punctuation" }, + { text: " ", kind: "space" }, { text: enumName, kind: "enumName" }, { text: "[", kind: "punctuation" }, { text: enumMemberName, kind: "stringLiteral" }, { text: "]", kind: "punctuation" }, + { text: " ", kind: "space" }, { text: "=", kind: "operator" }, { text: " ", kind: "space" }, { text: initializer.toString(), kind: "numericLiteral" }], + []); + } + + function verifyInstance() { + marker++; + goTo.marker(marker.toString()); + verify.verifyQuickInfoDisplayParts("var", "", { start: test.markerByName(marker.toString()).position, length: instanceName.length }, + [{ text: "var", kind: "keyword" }, + { text: " ", kind: "space" }, { text: instanceName, kind: "localName" }, { text: ":", kind: "punctuation" }, + { text: " ", kind: "space" }, { text: enumName, kind: "enumName" }], + []); + } +} + +verifyEnumDeclaration("E", "eInstance"); +marker = 15; +//verifyEnumDeclaration("constE", "eInstance1", /*isConst*/ true); diff --git a/tests/cases/fourslash/quickInfoDisplayPartsExternalModuleAlias.ts b/tests/cases/fourslash/quickInfoDisplayPartsExternalModuleAlias.ts index 77e12476574..36ca4edac8d 100644 --- a/tests/cases/fourslash/quickInfoDisplayPartsExternalModuleAlias.ts +++ b/tests/cases/fourslash/quickInfoDisplayPartsExternalModuleAlias.ts @@ -7,9 +7,9 @@ ////} // @Filename: quickInfoDisplayPartsExternalModuleAlias_file1.ts -////import /*1*/a1 = require(/*mod1*/"quickInfoDisplayPartsExternalModuleAlias_file0"); +////import /*1*/a1 = require(/*mod1*/"./quickInfoDisplayPartsExternalModuleAlias_file0"); ////new /*2*/a1.m1.c(); -////export import /*3*/a2 = require(/*mod2*/"quickInfoDisplayPartsExternalModuleAlias_file0"); +////export import /*3*/a2 = require(/*mod2*/"./quickInfoDisplayPartsExternalModuleAlias_file0"); ////new /*4*/a2.m1.c(); var marker = 0; @@ -24,7 +24,7 @@ function verifyImport(name: string, isExported: boolean) { [{ text: "import", kind: "keyword" }, { text: " ", kind: "space" }, { text: name, kind: "aliasName" }, { text: " ", kind: "space" }, { text: "=", kind: "operator" }, { text: " ", kind: "space" }, { text: "require", kind: "keyword" }, { text: "(", kind: "punctuation" }, - { text: "\"quickInfoDisplayPartsExternalModuleAlias_file0\"", kind: "stringLiteral" }, + { text: "\"./quickInfoDisplayPartsExternalModuleAlias_file0\"", kind: "stringLiteral" }, { text: ")", kind: "punctuation" }], []); } @@ -35,7 +35,7 @@ verifyImport("a2", /*isExported*/true); function verifyExternalModuleStringLiteral(marker: string) { goTo.marker(marker); - verify.verifyQuickInfoDisplayParts("module", "", { start: test.markerByName(marker).position, length: "\"quickInfoDisplayPartsExternalModuleAlias_file0\"".length }, + verify.verifyQuickInfoDisplayParts("module", "", { start: test.markerByName(marker).position, length: "\"./quickInfoDisplayPartsExternalModuleAlias_file0\"".length }, [{ text: "module", kind: "keyword" }, { text: " ", kind: "space" }, { text: "a1", kind: "aliasName" }], []); } diff --git a/tests/cases/fourslash/quickInfoDisplayPartsLiteralLikeNames01.ts b/tests/cases/fourslash/quickInfoDisplayPartsLiteralLikeNames01.ts new file mode 100644 index 00000000000..939eb55610d --- /dev/null +++ b/tests/cases/fourslash/quickInfoDisplayPartsLiteralLikeNames01.ts @@ -0,0 +1,49 @@ +/// + +////class C { +//// public /*1*/1() { } +//// private /*2*/Infinity() { } +//// protected /*3*/NaN() { } +//// static /*4*/"stringLiteralName"() { } +//// method() { +//// this[/*5*/1](); +//// this[/*6*/"1"](); +//// this./*7*/Infinity(); +//// this[/*8*/"Infinity"](); +//// this./*9*/NaN(); +//// C./*10*/stringLiteralName(); +//// } + +verifyClassMethodWithElementAccessDisplay("1", "public", "1", "methodName", /*spanLength*/ "1".length); +verifyClassMethodWithPropertyAccessDisplay("2", "private", "Infinity", /*spanLength*/ "Infinity".length); +verifyClassMethodWithPropertyAccessDisplay("3", "protected", "NaN", /*spanLength*/ "NaN".length); +verifyClassMethodWithElementAccessDisplay("4", "static", '"stringLiteralName"', "stringLiteral", /*spanLength*/ '"stringLiteralName"'.length); +verifyClassMethodWithElementAccessDisplay("5", "public", "1", "methodName", /*spanLength*/ "1".length); +verifyClassMethodWithElementAccessDisplay("6", "public", "1", "methodName", /*spanLength*/ "1".length + 2); +verifyClassMethodWithPropertyAccessDisplay("7", "private", "Infinity", /*spanLength*/ "Infinity".length); +verifyClassMethodWithPropertyAccessDisplay("8", "private", "Infinity", /*spanLength*/ "Infinity".length + 2); +verifyClassMethodWithPropertyAccessDisplay("9", "protected", "NaN", /*spanLength*/ "NaN".length); +verifyClassMethodWithElementAccessDisplay("10", "static", '"stringLiteralName"', "stringLiteral", /*spanLength*/ "stringLiteralName".length); + + +function verifyClassMethodWithPropertyAccessDisplay(markerName: string, kindModifiers: string, methodName: string, spanLength: number) { + goTo.marker(markerName); + verify.verifyQuickInfoDisplayParts("method", kindModifiers, { start: test.markerByName(markerName).position, length: spanLength }, + [{ text: "(", kind: "punctuation" }, { text: "method", kind: "text" }, { text: ")", kind: "punctuation" }, + { text: " ", kind: "space" }, + { text: "C", kind: "className" }, { text: ".", kind: "punctuation" }, { text: methodName, kind: "methodName" }, + { text: "(", kind: "punctuation" }, { text: ")", kind: "punctuation" }, { text: ":", kind: "punctuation" }, + { text: " ", kind: "space" }, { text: "void", kind: "keyword" }], + []); +} + +function verifyClassMethodWithElementAccessDisplay(markerName: string, kindModifiers: string, methodName: string, methodDisplay: "methodName" | "stringLiteral", spanLength: number) { + goTo.marker(markerName); + verify.verifyQuickInfoDisplayParts("method", kindModifiers, { start: test.markerByName(markerName).position, length: spanLength }, + [{ text: "(", kind: "punctuation" }, { text: "method", kind: "text" }, { text: ")", kind: "punctuation" }, + { text: " ", kind: "space" }, + { text: "C", kind: "className" }, { text: "[", kind: "punctuation" }, { text: methodName, kind: methodDisplay }, { text: "]", kind: "punctuation" }, + { text: "(", kind: "punctuation" }, { text: ")", kind: "punctuation" }, { text: ":", kind: "punctuation" }, + { text: " ", kind: "space" }, { text: "void", kind: "keyword" }], + []); +} diff --git a/tests/cases/fourslash/quickInfoExportAssignmentOfGenericInterface.ts b/tests/cases/fourslash/quickInfoExportAssignmentOfGenericInterface.ts index bf77d12669f..e0b67a9f47d 100644 --- a/tests/cases/fourslash/quickInfoExportAssignmentOfGenericInterface.ts +++ b/tests/cases/fourslash/quickInfoExportAssignmentOfGenericInterface.ts @@ -7,7 +7,7 @@ ////export = Foo; // @Filename: quickInfoExportAssignmentOfGenericInterface_1.ts -////import a = require('quickInfoExportAssignmentOfGenericInterface_0'); +////import a = require('./quickInfoExportAssignmentOfGenericInterface_0'); ////export var /*1*/x: a>; ////x.a; diff --git a/tests/cases/fourslash/quickInfoForContextuallyTypedIife.ts b/tests/cases/fourslash/quickInfoForContextuallyTypedIife.ts new file mode 100644 index 00000000000..50a04876fc9 --- /dev/null +++ b/tests/cases/fourslash/quickInfoForContextuallyTypedIife.ts @@ -0,0 +1,38 @@ +/// + +////(({ q/*1*/, qq/*2*/ }, x/*3*/, { p/*4*/ }) => { +//// var s: number = q/*5*/; +//// var t: number = qq/*6*/; +//// var u: number = p/*7*/; +//// var v: number = x/*8*/; +//// return q; })({ q: 13, qq: 12 }, 1, { p: 14 }); +////((a/*9*/, b/*10*/, c/*11*/) => [a/*12*/,b/*13*/,c/*14*/])("foo", 101, false); + +goTo.marker('1'); +verify.quickInfoIs("var q: number"); +goTo.marker('2'); +verify.quickInfoIs("var qq: number"); +goTo.marker('3'); +verify.quickInfoIs("(parameter) x: number"); +goTo.marker('4'); +verify.quickInfoIs("var p: number"); +goTo.marker('5'); +verify.quickInfoIs("var q: number"); +goTo.marker('6'); +verify.quickInfoIs("var qq: number"); +goTo.marker('7'); +verify.quickInfoIs("var p: number"); +goTo.marker('8'); +verify.quickInfoIs("(parameter) x: number"); +goTo.marker('9'); +verify.quickInfoIs("(parameter) a: string"); +goTo.marker('10'); +verify.quickInfoIs("(parameter) b: number"); +goTo.marker('11'); +verify.quickInfoIs("(parameter) c: boolean"); +goTo.marker('12'); +verify.quickInfoIs("(parameter) a: string"); +goTo.marker('13'); +verify.quickInfoIs("(parameter) b: number"); +goTo.marker('14'); +verify.quickInfoIs("(parameter) c: boolean"); diff --git a/tests/cases/fourslash/quickInfoForRequire.ts b/tests/cases/fourslash/quickInfoForRequire.ts index 91d59cb4318..8e714c08736 100644 --- a/tests/cases/fourslash/quickInfoForRequire.ts +++ b/tests/cases/fourslash/quickInfoForRequire.ts @@ -4,7 +4,7 @@ ////export class a{} //@Filename: quickInfoForRequire_input.ts -////import a = require("AA/B/*1*/B"); +////import a = require("./AA/B/*1*/B"); goTo.marker('1'); verify.quickInfoIs('module a'); diff --git a/tests/cases/fourslash/quickInfoOnNarrowedType.ts b/tests/cases/fourslash/quickInfoOnNarrowedType.ts index bc1d8126d76..2c8f4c8e216 100644 --- a/tests/cases/fourslash/quickInfoOnNarrowedType.ts +++ b/tests/cases/fourslash/quickInfoOnNarrowedType.ts @@ -1,5 +1,7 @@ /// +// @strictNullChecks: true + ////function foo(strOrNum: string | number) { //// if (typeof /*1*/strOrNum === "number") { //// return /*2*/strOrNum; @@ -9,6 +11,13 @@ //// } ////} +////function bar() { +//// let s: string | undefined; +//// /*4*/s; +//// /*5*/s = "abc"; +//// /*6*/s; +////} + goTo.marker('1'); verify.quickInfoIs('(parameter) strOrNum: string | number'); verify.completionListContains("strOrNum", "(parameter) strOrNum: string | number"); @@ -20,3 +29,15 @@ verify.completionListContains("strOrNum", "(parameter) strOrNum: number"); goTo.marker('3'); verify.quickInfoIs('(parameter) strOrNum: string'); verify.completionListContains("strOrNum", "(parameter) strOrNum: string"); + +goTo.marker('4'); +verify.quickInfoIs('let s: string | undefined'); +verify.completionListContains("s", "let s: string | undefined"); + +goTo.marker('5'); +verify.quickInfoIs('let s: string | undefined'); +verify.completionListContains("s", "let s: string | undefined"); + +goTo.marker('6'); +verify.quickInfoIs('let s: string'); +verify.completionListContains("s", "let s: string"); diff --git a/tests/cases/fourslash/quickInfoOnNarrowedTypeInModule.ts b/tests/cases/fourslash/quickInfoOnNarrowedTypeInModule.ts index b2826d01650..1f95de35403 100644 --- a/tests/cases/fourslash/quickInfoOnNarrowedTypeInModule.ts +++ b/tests/cases/fourslash/quickInfoOnNarrowedTypeInModule.ts @@ -38,7 +38,19 @@ goTo.marker('3'); verify.quickInfoIs('var nonExportedStrOrNum: string'); verify.completionListContains("nonExportedStrOrNum", "var nonExportedStrOrNum: string"); -['4', '5', '6', '7', '8', '9'].forEach((marker, index, arr) => { +goTo.marker('4'); +verify.quickInfoIs('var m.exportedStrOrNum: string | number'); +verify.completionListContains("exportedStrOrNum", "var m.exportedStrOrNum: string | number"); + +goTo.marker('5'); +verify.quickInfoIs('var m.exportedStrOrNum: number'); +verify.completionListContains("exportedStrOrNum", "var m.exportedStrOrNum: number"); + +goTo.marker('6'); +verify.quickInfoIs('var m.exportedStrOrNum: string'); +verify.completionListContains("exportedStrOrNum", "var m.exportedStrOrNum: string"); + +['7', '8', '9'].forEach((marker, index, arr) => { goTo.marker(marker); verify.quickInfoIs('var m.exportedStrOrNum: string | number'); verify.completionListContains("exportedStrOrNum", "var m.exportedStrOrNum: string | number"); diff --git a/tests/cases/fourslash/quickInfoOnObjectLiteralWithOnlyGetter.ts b/tests/cases/fourslash/quickInfoOnObjectLiteralWithOnlyGetter.ts index 53f5e6988b7..a2e783d9ce0 100644 --- a/tests/cases/fourslash/quickInfoOnObjectLiteralWithOnlyGetter.ts +++ b/tests/cases/fourslash/quickInfoOnObjectLiteralWithOnlyGetter.ts @@ -9,7 +9,7 @@ ////var /*2*/x = point./*3*/x; goTo.marker('1'); -verify.quickInfoIs("function makePoint(x: number): {\n x: number;\n}", undefined); +verify.quickInfoIs("function makePoint(x: number): {\n readonly x: number;\n}", undefined); goTo.marker('2'); verify.quickInfoIs("var x: number", undefined); @@ -18,4 +18,4 @@ goTo.marker('3'); verify.memberListContains("x", "(property) x: number", undefined); goTo.marker('4'); -verify.quickInfoIs("var point: {\n x: number;\n}", undefined); +verify.quickInfoIs("var point: {\n readonly x: number;\n}", undefined); diff --git a/tests/cases/fourslash/quickInfoOnPrivateConstructorCall.ts b/tests/cases/fourslash/quickInfoOnPrivateConstructorCall.ts new file mode 100644 index 00000000000..5ebdcd815b2 --- /dev/null +++ b/tests/cases/fourslash/quickInfoOnPrivateConstructorCall.ts @@ -0,0 +1,9 @@ +/// + +////class A { +//// private constructor() {} +////} +////var x = new A(/*1*/ + +goTo.marker("1"); +verify.not.signatureHelpPresent(); \ No newline at end of file diff --git a/tests/cases/fourslash/quickInfoOnProtectedConstructorCall.ts b/tests/cases/fourslash/quickInfoOnProtectedConstructorCall.ts new file mode 100644 index 00000000000..094a07f3d51 --- /dev/null +++ b/tests/cases/fourslash/quickInfoOnProtectedConstructorCall.ts @@ -0,0 +1,9 @@ +/// + +////class A { +//// protected constructor() {} +////} +////var x = new A(/*1*/ + +goTo.marker("1"); +verify.not.signatureHelpPresent(); \ No newline at end of file diff --git a/tests/cases/fourslash/quickInfoOnThis.ts b/tests/cases/fourslash/quickInfoOnThis.ts index c4eecfca5d5..4191c0846ec 100644 --- a/tests/cases/fourslash/quickInfoOnThis.ts +++ b/tests/cases/fourslash/quickInfoOnThis.ts @@ -1,15 +1,38 @@ /// - -////function someFn1(someFn: { (): void; }) { } +////interface Restricted { +//// n: number; +////} +////function wrapper(wrapped: { (): void; }) { } ////class Foo { -//// public bar() { -//// someFn1( -//// function doSomething() { -//// console.log(th/**/is); +//// n: number; +//// prop1: th/*0*/is; +//// public explicitThis(this: this) { +//// wrapper( +//// function explicitVoid(this: void) { +//// console.log(th/*1*/is); //// } //// ) +//// console.log(th/*2*/is); +//// } +//// public explicitInterface(th/*3*/is: Restricted) { +//// console.log(th/*4*/is); +//// } +//// public explicitClass(th/*5*/is: Foo) { +//// console.log(th/*6*/is); //// } ////} -goTo.marker(); -verify.quickInfoIs('any'); +goTo.marker('0'); +verify.quickInfoIs('this: this'); +goTo.marker('1'); +verify.quickInfoIs('void'); +goTo.marker('2'); +verify.quickInfoIs('this: this'); +goTo.marker('3'); +verify.quickInfoIs('(parameter) this: Restricted'); +goTo.marker('4'); +verify.quickInfoIs('this: Restricted'); +goTo.marker('5'); +verify.quickInfoIs('(parameter) this: Foo'); +goTo.marker('6'); +verify.quickInfoIs('this: Foo'); \ No newline at end of file diff --git a/tests/cases/fourslash/quickInfoOnThis2.ts b/tests/cases/fourslash/quickInfoOnThis2.ts new file mode 100644 index 00000000000..01e172d8c4d --- /dev/null +++ b/tests/cases/fourslash/quickInfoOnThis2.ts @@ -0,0 +1,14 @@ +/// +////class Bar { +//// public explicitThis(this: this) { +//// console.log(th/*1*/is); +//// } +//// public explicitClass(this: Bar) { +//// console.log(thi/*2*/s); +//// } +////} + +goTo.marker('1'); +verify.quickInfoIs('this: this'); +goTo.marker('2'); +verify.quickInfoIs('this: Bar'); \ No newline at end of file diff --git a/tests/cases/fourslash/quickInfoOnThis3.ts b/tests/cases/fourslash/quickInfoOnThis3.ts new file mode 100644 index 00000000000..6988ac14860 --- /dev/null +++ b/tests/cases/fourslash/quickInfoOnThis3.ts @@ -0,0 +1,32 @@ +/// +////interface Restricted { +//// n: number; +////} +////function implicitAny(x: number): void { +//// return th/*1*/is; +////} +////function explicitVoid(th/*2*/is: void, x: number): void { +//// return th/*3*/is; +////} +////function explicitInterface(th/*4*/is: Restricted): void { +//// console.log(thi/*5*/s); +////} +////function explicitLiteral(th/*6*/is: { n: number }): void { +//// console.log(th/*7*/is); +////} + +goTo.marker('1'); +verify.quickInfoIs('any'); +goTo.marker('2'); +verify.quickInfoIs('(parameter) this: void'); +goTo.marker('3'); +verify.quickInfoIs('void'); +goTo.marker('4'); +verify.quickInfoIs('(parameter) this: Restricted'); +goTo.marker('5'); +verify.quickInfoIs('this: Restricted'); +goTo.marker('6'); + +verify.quickInfoIs('(parameter) this: {\n n: number;\n}'); +goTo.marker('7'); +verify.quickInfoIs('this: {\n n: number;\n}'); diff --git a/tests/cases/fourslash/quickInfoOnThis4.ts b/tests/cases/fourslash/quickInfoOnThis4.ts new file mode 100644 index 00000000000..17e0b80aaad --- /dev/null +++ b/tests/cases/fourslash/quickInfoOnThis4.ts @@ -0,0 +1,20 @@ +/// +////interface ContextualInterface { +//// m: number; +//// method(this: this, n: number); +////} +////let o: ContextualInterface = { +//// m: 12, +//// method(n) { +//// let x = this/*1*/.m; +//// } +////} +////interface ContextualInterface2 { +//// (this: void, n: number): void; +////} +////let contextualInterface2: ContextualInterface2 = function (th/*2*/is, n) { } + +goTo.marker('1'); +verify.quickInfoIs('this: ContextualInterface'); +goTo.marker('2'); +verify.quickInfoIs('(parameter) this: void'); diff --git a/tests/cases/fourslash/referencesForClassMembers.ts b/tests/cases/fourslash/referencesForClassMembers.ts new file mode 100644 index 00000000000..851c1b39ab0 --- /dev/null +++ b/tests/cases/fourslash/referencesForClassMembers.ts @@ -0,0 +1,32 @@ +/// + +////class Base { +//// /*1*/a: number; +//// /*2*/method(): void { } +////} +////class MyClass extends Base { +//// /*3*/a; +//// /*4*/method() { } +////} +//// +////var c: MyClass; +////c./*5*/a; +////c./*6*/method(); + +goTo.marker("1"); +verify.referencesCountIs(3); + +goTo.marker("2"); +verify.referencesCountIs(3); + +goTo.marker("3"); +verify.referencesCountIs(3); + +goTo.marker("4"); +verify.referencesCountIs(3); + +goTo.marker("5"); +verify.referencesCountIs(3); + +goTo.marker("6"); +verify.referencesCountIs(3); diff --git a/tests/cases/fourslash/referencesForClassMembersExtendingAbstractClass.ts b/tests/cases/fourslash/referencesForClassMembersExtendingAbstractClass.ts new file mode 100644 index 00000000000..fcabff979fb --- /dev/null +++ b/tests/cases/fourslash/referencesForClassMembersExtendingAbstractClass.ts @@ -0,0 +1,32 @@ +/// + +////abstract class Base { +//// abstract /*1*/a: number; +//// abstract /*2*/method(): void; +////} +////class MyClass extends Base { +//// /*3*/a; +//// /*4*/method() { } +////} +//// +////var c: MyClass; +////c./*5*/a; +////c./*6*/method(); + +goTo.marker("1"); +verify.referencesCountIs(3); + +goTo.marker("2"); +verify.referencesCountIs(3); + +goTo.marker("3"); +verify.referencesCountIs(3); + +goTo.marker("4"); +verify.referencesCountIs(3); + +goTo.marker("5"); +verify.referencesCountIs(3); + +goTo.marker("6"); +verify.referencesCountIs(3); diff --git a/tests/cases/fourslash/referencesForClassMembersExtendingGenericClass.ts b/tests/cases/fourslash/referencesForClassMembersExtendingGenericClass.ts new file mode 100644 index 00000000000..f0185fb39aa --- /dev/null +++ b/tests/cases/fourslash/referencesForClassMembersExtendingGenericClass.ts @@ -0,0 +1,32 @@ +/// + +////class Base { +//// /*1*/a: this; +//// /*2*/method(a?:T, b?:U): this { } +////} +////class MyClass extends Base { +//// /*3*/a; +//// /*4*/method() { } +////} +//// +////var c: MyClass; +////c./*5*/a; +////c./*6*/method(); + +goTo.marker("1"); +verify.referencesCountIs(3); + +goTo.marker("2"); +verify.referencesCountIs(3); + +goTo.marker("3"); +verify.referencesCountIs(3); + +goTo.marker("4"); +verify.referencesCountIs(3); + +goTo.marker("5"); +verify.referencesCountIs(3); + +goTo.marker("6"); +verify.referencesCountIs(3); diff --git a/tests/cases/fourslash/referencesForInheritedProperties3.ts b/tests/cases/fourslash/referencesForInheritedProperties3.ts new file mode 100644 index 00000000000..134f75da84b --- /dev/null +++ b/tests/cases/fourslash/referencesForInheritedProperties3.ts @@ -0,0 +1,15 @@ +/// + +//// interface interface1 extends interface1 { +//// /*1*/doStuff(): void; +//// /*2*/propName: string; +//// } +//// +//// var v: interface1; +//// v./*3*/propName; +//// v./*4*/doStuff(); + +test.markers().forEach(m => { + goTo.position(m.position, m.fileName); + verify.referencesCountIs(2); +}); \ No newline at end of file diff --git a/tests/cases/fourslash/referencesForInheritedProperties4.ts b/tests/cases/fourslash/referencesForInheritedProperties4.ts new file mode 100644 index 00000000000..10dcc9c77a2 --- /dev/null +++ b/tests/cases/fourslash/referencesForInheritedProperties4.ts @@ -0,0 +1,15 @@ +/// + +//// class class1 extends class1 { +//// /*1*/doStuff() { } +//// /*2*/propName: string; +//// } +//// +//// var c: class1; +//// c./*3*/doStuff(); +//// c./*4*/propName; + +test.markers().forEach(m => { + goTo.position(m.position, m.fileName); + verify.referencesCountIs(2); +}); \ No newline at end of file diff --git a/tests/cases/fourslash/referencesForInheritedProperties5.ts b/tests/cases/fourslash/referencesForInheritedProperties5.ts new file mode 100644 index 00000000000..722c5c96f0a --- /dev/null +++ b/tests/cases/fourslash/referencesForInheritedProperties5.ts @@ -0,0 +1,19 @@ +/// + +//// interface interface1 extends interface1 { +//// /*1*/doStuff(): void; +//// /*2*/propName: string; +//// } +//// interface interface2 extends interface1 { +//// /*3*/doStuff(): void; +//// /*4*/propName: string; +//// } +//// +//// var v: interface1; +//// v./*5*/propName; +//// v./*6*/doStuff(); + +test.markers().forEach(m => { + goTo.position(m.position, m.fileName); + verify.referencesCountIs(3); +}); \ No newline at end of file diff --git a/tests/cases/fourslash/referencesForInheritedProperties6.ts b/tests/cases/fourslash/referencesForInheritedProperties6.ts new file mode 100644 index 00000000000..ddd52447dc1 --- /dev/null +++ b/tests/cases/fourslash/referencesForInheritedProperties6.ts @@ -0,0 +1,32 @@ +/// + +//// class class1 extends class1 { +//// /*1*/doStuff() { } +//// /*2*/propName: string; +//// } +//// class class2 extends class1 { +//// /*3*/doStuff() { } +//// /*4*/propName: string; +//// } +//// +//// var v: class2; +//// v./*5*/propName; +//// v./*6*/doStuff(); + +goTo.marker("1"); +verify.referencesCountIs(3); + +goTo.marker("2"); +verify.referencesCountIs(3); + +goTo.marker("3"); +verify.referencesCountIs(3); + +goTo.marker("4"); +verify.referencesCountIs(3); + +goTo.marker("5"); +verify.referencesCountIs(3); + +goTo.marker("6"); +verify.referencesCountIs(3); \ No newline at end of file diff --git a/tests/cases/fourslash/referencesForInheritedProperties7.ts b/tests/cases/fourslash/referencesForInheritedProperties7.ts new file mode 100644 index 00000000000..5747e99615f --- /dev/null +++ b/tests/cases/fourslash/referencesForInheritedProperties7.ts @@ -0,0 +1,42 @@ +/// + +//// class class1 extends class1 { +//// /*1*/doStuff() { } +//// /*2*/propName: string; +//// } +//// interface interface1 extends interface1 { +//// /*3*/doStuff(): void; +//// /*4*/propName: string; +//// } +//// class class2 extends class1 implements interface1 { +//// /*5*/doStuff() { } +//// /*6*/propName: string; +//// } +//// +//// var v: class2; +//// v./*7*/propName; +//// v./*8*/doStuff(); + +goTo.marker("1"); +verify.referencesCountIs(3); + +goTo.marker("2"); +verify.referencesCountIs(3); + +goTo.marker("3"); +verify.referencesCountIs(3); + +goTo.marker("4"); +verify.referencesCountIs(3); + +goTo.marker("5"); +verify.referencesCountIs(4); + +goTo.marker("6"); +verify.referencesCountIs(4); + +goTo.marker("7"); +verify.referencesCountIs(4); + +goTo.marker("8"); +verify.referencesCountIs(4); \ No newline at end of file diff --git a/tests/cases/fourslash/referencesForInheritedProperties8.ts b/tests/cases/fourslash/referencesForInheritedProperties8.ts new file mode 100644 index 00000000000..f34b327a472 --- /dev/null +++ b/tests/cases/fourslash/referencesForInheritedProperties8.ts @@ -0,0 +1,27 @@ +/// + +//// interface C extends D { +//// /*0*/propD: number; +//// } +//// interface D extends C { +//// /*1*/propD: string; +//// /*3*/propC: number; +//// } +//// var d: D; +//// d./*2*/propD; +//// d./*4*/propC; + +goTo.marker("0"); +verify.referencesCountIs(3); + +goTo.marker("1"); +verify.referencesCountIs(3); + +goTo.marker("2"); +verify.referencesCountIs(3); + +goTo.marker("3"); +verify.referencesCountIs(2); + +goTo.marker("4"); +verify.referencesCountIs(2); \ No newline at end of file diff --git a/tests/cases/fourslash/referencesForInheritedProperties9.ts b/tests/cases/fourslash/referencesForInheritedProperties9.ts new file mode 100644 index 00000000000..b348d6e8cf6 --- /dev/null +++ b/tests/cases/fourslash/referencesForInheritedProperties9.ts @@ -0,0 +1,21 @@ +/// + +//// class D extends C { +//// /*0*/prop1: string; +//// } +//// +//// class C extends D { +//// /*1*/prop1: string; +//// } +//// +//// var c: C; +//// c./*2*/prop1; + +goTo.marker("0"); +verify.referencesCountIs(1); + +goTo.marker("1"); +verify.referencesCountIs(2) + +goTo.marker("2"); +verify.referencesCountIs(2) \ No newline at end of file diff --git a/tests/cases/fourslash/renameAcrossMultipleProjects.ts b/tests/cases/fourslash/renameAcrossMultipleProjects.ts new file mode 100644 index 00000000000..44b5c0baef4 --- /dev/null +++ b/tests/cases/fourslash/renameAcrossMultipleProjects.ts @@ -0,0 +1,17 @@ +/// + +//@Filename: a.ts +////var /*1*/[|x|]: number; + +//@Filename: b.ts +/////// +////[|x|]++; + +//@Filename: c.ts +/////// +////[|x|]++; + +goTo.file("a.ts"); +goTo.marker("1"); + +verify.renameLocations( /*findInStrings*/ false, /*findInComments*/ false); \ No newline at end of file diff --git a/tests/cases/fourslash/renameContextuallyTypedProperties.ts b/tests/cases/fourslash/renameContextuallyTypedProperties.ts new file mode 100644 index 00000000000..4feed49256f --- /dev/null +++ b/tests/cases/fourslash/renameContextuallyTypedProperties.ts @@ -0,0 +1,63 @@ +/// + +////interface I { +//// [|prop1|]: () => void; +//// prop2(): void; +////} +//// +////var o1: I = { +//// [|prop1|]() { }, +//// prop2() { } +////}; +//// +////var o2: I = { +//// [|prop1|]: () => { }, +//// prop2: () => { } +////}; +//// +////var o3: I = { +//// get [|prop1|]() { return () => { }; }, +//// get prop2() { return () => { }; } +////}; +//// +////var o4: I = { +//// set [|prop1|](v) { }, +//// set prop2(v) { } +////}; +//// +////var o5: I = { +//// "[|prop1|]"() { }, +//// "prop2"() { } +////}; +//// +////var o6: I = { +//// "[|prop1|]": function () { }, +//// "prop2": function () { } +////}; +//// +////var o7: I = { +//// ["[|prop1|]"]: function () { }, +//// ["prop2"]: function () { } +////}; +//// +////var o8: I = { +//// ["[|prop1|]"]() { }, +//// ["prop2"]() { } +////}; +//// +////var o9: I = { +//// get ["[|prop1|]"]() { return () => { }; }, +//// get ["prop2"]() { return () => { }; } +////}; +//// +////var o10: I = { +//// set ["[|prop1|]"](v) { }, +//// set ["prop2"](v) { } +////}; + +let ranges = test.ranges() +for (let range of ranges) { + goTo.file(range.fileName); + goTo.position(range.start); + verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false); +} diff --git a/tests/cases/fourslash/renameContextuallyTypedProperties2.ts b/tests/cases/fourslash/renameContextuallyTypedProperties2.ts new file mode 100644 index 00000000000..1887c7751a5 --- /dev/null +++ b/tests/cases/fourslash/renameContextuallyTypedProperties2.ts @@ -0,0 +1,63 @@ +/// + +////interface I { +//// prop1: () => void; +//// [|prop2|](): void; +////} +//// +////var o1: I = { +//// prop1() { }, +//// [|prop2|]() { } +////}; +//// +////var o2: I = { +//// prop1: () => { }, +//// [|prop2|]: () => { } +////}; +//// +////var o3: I = { +//// get prop1() { return () => { }; }, +//// get [|prop2|]() { return () => { }; } +////}; +//// +////var o4: I = { +//// set prop1(v) { }, +//// set [|prop2|](v) { } +////}; +//// +////var o5: I = { +//// "prop1"() { }, +//// "[|prop2|]"() { } +////}; +//// +////var o6: I = { +//// "prop1": function () { }, +//// "[|prop2|]": function () { } +////}; +//// +////var o7: I = { +//// ["prop1"]: function () { }, +//// ["[|prop2|]"]: function () { } +////}; +//// +////var o8: I = { +//// ["prop1"]() { }, +//// ["[|prop2|]"]() { } +////}; +//// +////var o9: I = { +//// get ["prop1"]() { return () => { }; }, +//// get ["[|prop2|]"]() { return () => { }; } +////}; +//// +////var o10: I = { +//// set ["prop1"](v) { }, +//// set ["[|prop2|]"](v) { } +////}; + +let ranges = test.ranges() +for (let range of ranges) { + goTo.file(range.fileName); + goTo.position(range.start); + verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false); +} diff --git a/tests/cases/fourslash/renameCrossJsTs01.ts b/tests/cases/fourslash/renameCrossJsTs01.ts new file mode 100644 index 00000000000..52cb4c587d1 --- /dev/null +++ b/tests/cases/fourslash/renameCrossJsTs01.ts @@ -0,0 +1,12 @@ +/// + +// @allowJs: true +// @Filename: a.js +////exports.[|area|] = function (r) { return r * r; } + +// @Filename: b.ts +////import { [|area|] } from './a'; +////var t = /**/[|area|](10); + +goTo.marker(); +verify.renameLocations( /*findInStrings*/ false, /*findInComments*/ false); \ No newline at end of file diff --git a/tests/cases/fourslash/renameCrossJsTs02.ts b/tests/cases/fourslash/renameCrossJsTs02.ts new file mode 100644 index 00000000000..7ff1ae96ff3 --- /dev/null +++ b/tests/cases/fourslash/renameCrossJsTs02.ts @@ -0,0 +1,12 @@ +/// + +// @allowJs: true +// @Filename: a.js +////exports./**/[|area|] = function (r) { return r * r; } + +// @Filename: b.ts +////import { [|area|] } from './a'; +////var t = [|area|](10); + +goTo.marker(); +verify.renameLocations( /*findInStrings*/ false, /*findInComments*/ false); \ No newline at end of file diff --git a/tests/cases/fourslash/renameDefaultImport.ts b/tests/cases/fourslash/renameDefaultImport.ts new file mode 100644 index 00000000000..fd9534e65f7 --- /dev/null +++ b/tests/cases/fourslash/renameDefaultImport.ts @@ -0,0 +1,19 @@ +/// + +// @Filename: B.ts +////export default class [|B|] { +//// test() { +//// } +////} + +// @Filename: A.ts +////import [|B|] from "./B"; +////let b = new [|B|](); +////b.test(); + +let ranges = test.ranges() +for (let range of ranges) { + goTo.file(range.fileName); + goTo.position(range.start); + verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false); +} diff --git a/tests/cases/fourslash/renameDefaultImportDifferentName.ts b/tests/cases/fourslash/renameDefaultImportDifferentName.ts new file mode 100644 index 00000000000..5965f1a63e9 --- /dev/null +++ b/tests/cases/fourslash/renameDefaultImportDifferentName.ts @@ -0,0 +1,23 @@ +/// + +// @Filename: B.ts +////export default class /*1*/C { +//// test() { +//// } +////} + +// @Filename: A.ts +////import [|B|] from "./B"; +////let b = new [|B|](); +////b.test(); + +goTo.file("B.ts"); +goTo.marker("1"); +verify.occurrencesAtPositionCount(1); + +goTo.file("A.ts"); +let ranges = test.ranges() +for (let range of ranges) { + goTo.position(range.start); + verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false); +} diff --git a/tests/cases/fourslash/renameDestructuringAssignment.ts b/tests/cases/fourslash/renameDestructuringAssignment.ts new file mode 100644 index 00000000000..b7b18f661d2 --- /dev/null +++ b/tests/cases/fourslash/renameDestructuringAssignment.ts @@ -0,0 +1,14 @@ +/// + +////interface I { +//// [|x|]: number; +////} +////var a: I; +////var x; +////({ [|x|]: x } = a); + +let ranges = test.ranges() +for (let range of ranges) { + goTo.position(range.start); + verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false); +} diff --git a/tests/cases/fourslash/renameDestructuringAssignmentInFor.ts b/tests/cases/fourslash/renameDestructuringAssignmentInFor.ts new file mode 100644 index 00000000000..6be57b81fa2 --- /dev/null +++ b/tests/cases/fourslash/renameDestructuringAssignmentInFor.ts @@ -0,0 +1,20 @@ +/// + +////interface I { +//// /*1*/[|property1|]: number; +//// property2: string; +////} +////var elems: I[]; +//// +////var p2: number, property1: number; +////for ({ [|property1|] } = elems[0]; p2 < 100; p2++) { +//// p2 = property1++; +////} +////for ({ /*2*/[|property1|]: p2 } = elems[0]; p2 < 100; p2++) { +////} + +goTo.marker("1"); +verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false); + +goTo.marker("2"); +verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false); diff --git a/tests/cases/fourslash/renameDestructuringAssignmentInFor2.ts b/tests/cases/fourslash/renameDestructuringAssignmentInFor2.ts new file mode 100644 index 00000000000..ca75e42394b --- /dev/null +++ b/tests/cases/fourslash/renameDestructuringAssignmentInFor2.ts @@ -0,0 +1,20 @@ +/// + +////interface I { +//// property1: number; +//// property2: string; +////} +////var elems: I[]; +//// +////var p2: number, [|property1|]: number; +////for ({ [|property1|] } = elems[0]; p2 < 100; p2++) { +//// p2 = [|property1|]++; +////} +////for ({ property1: p2 } = elems[0]; p2 < 100; p2++) { +////} + +let ranges = test.ranges() +for (let range of ranges) { + goTo.position(range.start); + verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false); +} diff --git a/tests/cases/fourslash/renameDestructuringAssignmentInForOf.ts b/tests/cases/fourslash/renameDestructuringAssignmentInForOf.ts new file mode 100644 index 00000000000..d965875d259 --- /dev/null +++ b/tests/cases/fourslash/renameDestructuringAssignmentInForOf.ts @@ -0,0 +1,20 @@ +/// + +////interface I { +//// /*1*/[|property1|]: number; +//// property2: string; +////} +////var elems: I[]; +//// +////var property1: number, p2: number; +////for ({ [|property1|] } of elems) { +//// property1++; +////} +////for ({ /*2*/[|property1|]: p2 } of elems) { +////} + +goTo.marker("1"); +verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false); + +goTo.marker("2"); +verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false); \ No newline at end of file diff --git a/tests/cases/fourslash/renameDestructuringAssignmentInForOf2.ts b/tests/cases/fourslash/renameDestructuringAssignmentInForOf2.ts new file mode 100644 index 00000000000..401b6776d2e --- /dev/null +++ b/tests/cases/fourslash/renameDestructuringAssignmentInForOf2.ts @@ -0,0 +1,20 @@ +/// + +////interface I { +//// property1: number; +//// property2: string; +////} +////var elems: I[]; +//// +////var [|property1|]: number, p2: number; +////for ({ [|property1|] } of elems) { +//// [|property1|]++; +////} +////for ({ property1: p2 } of elems) { +////} + +let ranges = test.ranges() +for (let range of ranges) { + goTo.position(range.start); + verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false); +} diff --git a/tests/cases/fourslash/renameDestructuringAssignmentNestedInArrayLiteral.ts b/tests/cases/fourslash/renameDestructuringAssignmentNestedInArrayLiteral.ts new file mode 100644 index 00000000000..9d5d2a041e5 --- /dev/null +++ b/tests/cases/fourslash/renameDestructuringAssignmentNestedInArrayLiteral.ts @@ -0,0 +1,15 @@ +/// + +////interface I { +//// /*1*/[|property1|]: number; +//// property2: string; +////} +////var elems: I[], p1: number, property1: number; +////[{ /*2*/[|property1|]: p1 }] = elems; +////[{ [|property1|] }] = elems; + +goTo.marker("1"); +verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false); + +goTo.marker("2"); +verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false); diff --git a/tests/cases/fourslash/renameDestructuringAssignmentNestedInArrayLiteral2.ts b/tests/cases/fourslash/renameDestructuringAssignmentNestedInArrayLiteral2.ts new file mode 100644 index 00000000000..c4db2de512f --- /dev/null +++ b/tests/cases/fourslash/renameDestructuringAssignmentNestedInArrayLiteral2.ts @@ -0,0 +1,15 @@ +/// + +////interface I { +//// property1: number; +//// property2: string; +////} +////var elems: I[], p1: number, [|property1|]: number; +////[{ property1: p1 }] = elems; +////[{ [|property1|] }] = elems; + +let ranges = test.ranges() +for (let range of ranges) { + goTo.position(range.start); + verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false); +} diff --git a/tests/cases/fourslash/renameDestructuringAssignmentNestedInFor.ts b/tests/cases/fourslash/renameDestructuringAssignmentNestedInFor.ts new file mode 100644 index 00000000000..e603c82dbd7 --- /dev/null +++ b/tests/cases/fourslash/renameDestructuringAssignmentNestedInFor.ts @@ -0,0 +1,22 @@ +/// + +////interface MultiRobot { +//// name: string; +//// skills: { +//// /*1*/[|primary|]: string; +//// secondary: string; +//// }; +////} +////let multiRobot: MultiRobot; +////for ({ skills: { /*2*/[|primary|]: primaryA, secondary: secondaryA } } = multiRobot, i = 0; i < 1; i++) { +//// console.log(primaryA); +////} +////for ({ skills: { [|primary|], secondary } } = multiRobot, i = 0; i < 1; i++) { +//// console.log(primary); +////} + +goTo.marker("1"); +verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false); + +goTo.marker("2"); +verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false); diff --git a/tests/cases/fourslash/renameDestructuringAssignmentNestedInFor2.ts b/tests/cases/fourslash/renameDestructuringAssignmentNestedInFor2.ts new file mode 100644 index 00000000000..89dc899c5bf --- /dev/null +++ b/tests/cases/fourslash/renameDestructuringAssignmentNestedInFor2.ts @@ -0,0 +1,23 @@ +/// + +////interface MultiRobot { +//// name: string; +//// skills: { +//// primary: string; +//// secondary: string; +//// }; +////} +////let multiRobot: MultiRobot, [|primary|]: string; +////for ({ skills: { primary: primaryA, secondary: secondaryA } } = multiRobot, i = 0; i < 1; i++) { +//// console.log(primaryA); +////} +////for ({ skills: { [|primary|], secondary } } = multiRobot, i = 0; i < 1; i++) { +//// console.log([|primary|]); +////} + +let ranges = test.ranges() +for (let range of ranges) { + goTo.position(range.start); + verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false); +} + diff --git a/tests/cases/fourslash/renameDestructuringAssignmentNestedInForOf.ts b/tests/cases/fourslash/renameDestructuringAssignmentNestedInForOf.ts new file mode 100644 index 00000000000..bef88d201d4 --- /dev/null +++ b/tests/cases/fourslash/renameDestructuringAssignmentNestedInForOf.ts @@ -0,0 +1,22 @@ +/// + +////interface MultiRobot { +//// name: string; +//// skills: { +//// /*1*/[|primary|]: string; +//// secondary: string; +//// }; +////} +////let multiRobots: MultiRobot[]; +////for ({ skills: { /*2*/[|primary|]: primaryA, secondary: secondaryA } } of multiRobots) { +//// console.log(primaryA); +////} +////for ({ skills: { [|primary|], secondary } } of multiRobots) { +//// console.log(primary); +////} + +goTo.marker("1"); +verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false); + +goTo.marker("2"); +verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false); diff --git a/tests/cases/fourslash/renameDestructuringAssignmentNestedInForOf2.ts b/tests/cases/fourslash/renameDestructuringAssignmentNestedInForOf2.ts new file mode 100644 index 00000000000..b684e6b6a81 --- /dev/null +++ b/tests/cases/fourslash/renameDestructuringAssignmentNestedInForOf2.ts @@ -0,0 +1,23 @@ +/// + +////interface MultiRobot { +//// name: string; +//// skills: { +//// primary: string; +//// secondary: string; +//// }; +////} +////let multiRobots: MultiRobot[], [|primary|]: string; +////for ({ skills: { primary: primaryA, secondary: secondaryA } } of multiRobots) { +//// console.log(primaryA); +////} +////for ({ skills: { [|primary|], secondary } } of multiRobots) { +//// console.log([|primary|]); +////} + + +let ranges = test.ranges() +for (let range of ranges) { + goTo.position(range.start); + verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false); +} diff --git a/tests/cases/fourslash/renameDestructuringClassProperty.ts b/tests/cases/fourslash/renameDestructuringClassProperty.ts new file mode 100644 index 00000000000..acc58f999c4 --- /dev/null +++ b/tests/cases/fourslash/renameDestructuringClassProperty.ts @@ -0,0 +1,23 @@ +/// + +////class A { +//// [|foo|]: string; +////} +////class B { +//// syntax1(a: A): void { +//// let { [|foo|] } = a; +//// } +//// syntax2(a: A): void { +//// let { [|foo|]: foo } = a; +//// } +//// syntax11(a: A): void { +//// let { [|foo|] } = a; +//// [|foo|] = "newString"; +//// } +////} + +let ranges = test.ranges() +for (let range of ranges) { + goTo.position(range.start); + verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false); +} diff --git a/tests/cases/fourslash/renameDestructuringDeclarationInFor.ts b/tests/cases/fourslash/renameDestructuringDeclarationInFor.ts new file mode 100644 index 00000000000..0edf9085092 --- /dev/null +++ b/tests/cases/fourslash/renameDestructuringDeclarationInFor.ts @@ -0,0 +1,20 @@ +/// + +////interface I { +//// [|property1|]: number; +//// property2: string; +////} +////var elems: I[]; +//// +////var p2: number, property1: number; +////for (let { [|property1|]: p2 } = elems[0]; p2 < 100; p2++) { +////} +////for (let { [|property1|] } = elems[0]; p2 < 100; p2++) { +//// [|property1|] = p2; +////} + +let ranges = test.ranges() +for (let range of ranges) { + goTo.position(range.start); + verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false); +} diff --git a/tests/cases/fourslash/renameDestructuringDeclarationInForOf.ts b/tests/cases/fourslash/renameDestructuringDeclarationInForOf.ts new file mode 100644 index 00000000000..1c2b04b7ab5 --- /dev/null +++ b/tests/cases/fourslash/renameDestructuringDeclarationInForOf.ts @@ -0,0 +1,19 @@ +/// + +////interface I { +//// [|property1|]: number; +//// property2: string; +////} +////var elems: I[]; +//// +////for (let { [|property1|] } of elems) { +//// [|property1|]++; +////} +////for (let { [|property1|]: p2 } of elems) { +////} + +let ranges = test.ranges() +for (let range of ranges) { + goTo.position(range.start); + verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false); +} diff --git a/tests/cases/fourslash/renameDestructuringFunctionParameter.ts b/tests/cases/fourslash/renameDestructuringFunctionParameter.ts new file mode 100644 index 00000000000..d1df0f58275 --- /dev/null +++ b/tests/cases/fourslash/renameDestructuringFunctionParameter.ts @@ -0,0 +1,10 @@ +/// + +////function f({[|a|]}: {[|a|]}) { +//// f({[|a|]}); +////} +let ranges = test.ranges(); +for (let range of ranges) { + goTo.position(range.start); + verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false); +} diff --git a/tests/cases/fourslash/renameDestructuringNestedBindingElement.ts b/tests/cases/fourslash/renameDestructuringNestedBindingElement.ts new file mode 100644 index 00000000000..1c4254b14ae --- /dev/null +++ b/tests/cases/fourslash/renameDestructuringNestedBindingElement.ts @@ -0,0 +1,22 @@ +/// + +////interface MultiRobot { +//// name: string; +//// skills: { +//// [|primary|]: string; +//// secondary: string; +//// }; +////} +////let multiRobots: MultiRobot[]; +////for (let { skills: {[|primary|]: primaryA, secondary: secondaryA } } of multiRobots) { +//// console.log(primaryA); +////} +////for (let { skills: {[|primary|], secondary } } of multiRobots) { +//// console.log([|primary|]); +////} + +let ranges = test.ranges() +for (let range of ranges) { + goTo.position(range.start); + verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false); +} diff --git a/tests/cases/fourslash/renameImportAndExport.ts b/tests/cases/fourslash/renameImportAndExport.ts new file mode 100644 index 00000000000..495e15c1e7e --- /dev/null +++ b/tests/cases/fourslash/renameImportAndExport.ts @@ -0,0 +1,10 @@ +/// + +////import [|a|] from "module"; +////export { [|a|] }; + +let ranges = test.ranges() +for (let range of ranges) { + goTo.position(range.start); + verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false); +} diff --git a/tests/cases/fourslash/renameImportAndExportInDiffFiles.ts b/tests/cases/fourslash/renameImportAndExportInDiffFiles.ts new file mode 100644 index 00000000000..7b098721196 --- /dev/null +++ b/tests/cases/fourslash/renameImportAndExportInDiffFiles.ts @@ -0,0 +1,18 @@ +/// + +// @Filename: a.ts +////export var /*1*/a; + +// @Filename: b.ts +////import { /*2*/a } from './a'; +////export { /*3*/a }; + +goTo.file("a.ts"); +goTo.marker("1"); + +goTo.file("b.ts"); +goTo.marker("2"); +verify.referencesCountIs(3); + +goTo.marker("3"); +verify.referencesCountIs(3); \ No newline at end of file diff --git a/tests/cases/fourslash/renameImportAndShorthand.ts b/tests/cases/fourslash/renameImportAndShorthand.ts new file mode 100644 index 00000000000..bc4746aebdd --- /dev/null +++ b/tests/cases/fourslash/renameImportAndShorthand.ts @@ -0,0 +1,10 @@ +/// + +////import [|foo|] from 'bar'; +////const bar = { [|foo|] }; + +let ranges = test.ranges() +for (let range of ranges) { + goTo.position(range.start); + verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false); +} diff --git a/tests/cases/fourslash/renameImportNamespaceAndShorthand.ts b/tests/cases/fourslash/renameImportNamespaceAndShorthand.ts new file mode 100644 index 00000000000..a6b06c11408 --- /dev/null +++ b/tests/cases/fourslash/renameImportNamespaceAndShorthand.ts @@ -0,0 +1,10 @@ +/// + +////import * as [|foo|] from 'bar'; +////const bar = { [|foo|] }; + +let ranges = test.ranges() +for (let range of ranges) { + goTo.position(range.start); + verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false); +} diff --git a/tests/cases/fourslash/renameImportOfExportEquals.ts b/tests/cases/fourslash/renameImportOfExportEquals.ts new file mode 100644 index 00000000000..9d71ee907c8 --- /dev/null +++ b/tests/cases/fourslash/renameImportOfExportEquals.ts @@ -0,0 +1,18 @@ +/// + +////declare namespace N { +//// export var x: number; +////} +////declare module "mod" { +//// export = N; +////} +////declare module "test" { +//// import * as [|N|] from "mod"; +//// export { [|N|] }; // Renaming N here would rename +////} + +let ranges = test.ranges() +for (let range of ranges) { + goTo.position(range.start); + verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false); +} diff --git a/tests/cases/fourslash/renameImportRequire.ts b/tests/cases/fourslash/renameImportRequire.ts new file mode 100644 index 00000000000..c26cc80b616 --- /dev/null +++ b/tests/cases/fourslash/renameImportRequire.ts @@ -0,0 +1,12 @@ +/// + +////import [|e|] = require("mod4"); +////[|e|]; +////a = { [|e|] }; +////export { [|e|] }; + +let ranges = test.ranges() +for (let range of ranges) { + goTo.position(range.start); + verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false); +} diff --git a/tests/cases/fourslash/renameInheritedProperties1.ts b/tests/cases/fourslash/renameInheritedProperties1.ts new file mode 100644 index 00000000000..4698fe3d97b --- /dev/null +++ b/tests/cases/fourslash/renameInheritedProperties1.ts @@ -0,0 +1,15 @@ +/// + +//// class class1 extends class1 { +//// [|propName|]: string; +//// } +//// +//// var v: class1; +//// v.[|propName|]; + +const ranges = test.ranges(); +verify.assertHasRanges(ranges); +for (const range of ranges) { + goTo.position(range.start); + verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false); +} \ No newline at end of file diff --git a/tests/cases/fourslash/renameInheritedProperties2.ts b/tests/cases/fourslash/renameInheritedProperties2.ts new file mode 100644 index 00000000000..ed99ec3e013 --- /dev/null +++ b/tests/cases/fourslash/renameInheritedProperties2.ts @@ -0,0 +1,15 @@ +/// + +//// class class1 extends class1 { +//// [|doStuff|]() { } +//// } +//// +//// var v: class1; +//// v.[|doStuff|](); + +let ranges = test.ranges(); +verify.assertHasRanges(ranges); +for (let range of ranges) { + goTo.position(range.start); + verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false); +} \ No newline at end of file diff --git a/tests/cases/fourslash/renameInheritedProperties3.ts b/tests/cases/fourslash/renameInheritedProperties3.ts new file mode 100644 index 00000000000..17e7785fbc7 --- /dev/null +++ b/tests/cases/fourslash/renameInheritedProperties3.ts @@ -0,0 +1,15 @@ +/// + +//// interface interface1 extends interface1 { +//// [|propName|]: string; +//// } +//// +//// var v: interface1; +//// v.[|propName|]; + +let ranges = test.ranges(); +verify.assertHasRanges(ranges); +for (let range of ranges) { + goTo.position(range.start); + verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false); +} \ No newline at end of file diff --git a/tests/cases/fourslash/renameInheritedProperties4.ts b/tests/cases/fourslash/renameInheritedProperties4.ts new file mode 100644 index 00000000000..ea2f7c40fbf --- /dev/null +++ b/tests/cases/fourslash/renameInheritedProperties4.ts @@ -0,0 +1,15 @@ +/// + +//// interface interface1 extends interface1 { +//// [|doStuff|](): string; +//// } +//// +//// var v: interface1; +//// v.[|doStuff|](); + +let ranges = test.ranges(); +verify.assertHasRanges(ranges); +for (let range of ranges) { + goTo.position(range.start); + verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false); +} \ No newline at end of file diff --git a/tests/cases/fourslash/renameInheritedProperties5.ts b/tests/cases/fourslash/renameInheritedProperties5.ts new file mode 100644 index 00000000000..45058827747 --- /dev/null +++ b/tests/cases/fourslash/renameInheritedProperties5.ts @@ -0,0 +1,17 @@ +/// + +//// interface C extends D { +//// propC: number; +//// } +//// interface D extends C { +//// [|propD|]: string; +//// } +//// var d: D; +//// d.[|propD|]; + +const ranges = test.ranges(); +verify.assertHasRanges(ranges); +for (const range of ranges) { + goTo.position(range.start); + verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false); +} diff --git a/tests/cases/fourslash/renameInheritedProperties6.ts b/tests/cases/fourslash/renameInheritedProperties6.ts new file mode 100644 index 00000000000..6bdd32ce3e0 --- /dev/null +++ b/tests/cases/fourslash/renameInheritedProperties6.ts @@ -0,0 +1,17 @@ +/// + +//// interface C extends D { +//// propD: number; +//// } +//// interface D extends C { +//// [|propC|]: number; +//// } +//// var d: D; +//// d.[|propC|]; + +const ranges = test.ranges(); +verify.assertHasRanges(ranges); +for (const range of ranges) { + goTo.position(range.start); + verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false); +} \ No newline at end of file diff --git a/tests/cases/fourslash/renameInheritedProperties7.ts b/tests/cases/fourslash/renameInheritedProperties7.ts new file mode 100644 index 00000000000..a2f8c5a2b51 --- /dev/null +++ b/tests/cases/fourslash/renameInheritedProperties7.ts @@ -0,0 +1,19 @@ +/// + +//// class C extends D { +//// [|prop1|]: string; +//// } +//// +//// class D extends C { +//// prop1: string; +//// } +//// +//// var c: C; +//// c.[|prop1|]; + +const ranges = test.ranges(); +verify.assertHasRanges(ranges); +for (const range of ranges) { + goTo.position(range.start); + verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false); +} \ No newline at end of file diff --git a/tests/cases/fourslash/renameInheritedProperties8.ts b/tests/cases/fourslash/renameInheritedProperties8.ts new file mode 100644 index 00000000000..119e1a477aa --- /dev/null +++ b/tests/cases/fourslash/renameInheritedProperties8.ts @@ -0,0 +1,19 @@ +/// + +//// class C implements D { +//// [|prop1|]: string; +//// } +//// +//// interface D extends C { +//// [|prop1|]: string; +//// } +//// +//// var c: C; +//// c.[|prop1|]; + +const ranges = test.ranges(); +verify.assertHasRanges(ranges); +for (const range of ranges) { + goTo.position(range.start); + verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false); +} \ No newline at end of file diff --git a/tests/cases/fourslash/renameJsExports01.ts b/tests/cases/fourslash/renameJsExports01.ts new file mode 100644 index 00000000000..923d30eedf9 --- /dev/null +++ b/tests/cases/fourslash/renameJsExports01.ts @@ -0,0 +1,12 @@ +/// + +// @allowJs: true +// @Filename: a.js +////exports.[|area|] = function (r) { return r * r; } + +// @Filename: b.js +////var mod = require('./a'); +////var t = mod./**/[|area|](10); + +goTo.marker(); +verify.renameLocations( /*findInStrings*/ false, /*findInComments*/ false); \ No newline at end of file diff --git a/tests/cases/fourslash/renameJsExports02.ts b/tests/cases/fourslash/renameJsExports02.ts new file mode 100644 index 00000000000..86b0471dc1f --- /dev/null +++ b/tests/cases/fourslash/renameJsExports02.ts @@ -0,0 +1,12 @@ +/// + +// @allowJs: true +// @Filename: a.js +////exports./**/[|area|] = function (r) { return r * r; } + +// @Filename: b.js +////var mod = require('./a'); +////var t = mod.[|area|](10); + +goTo.marker(); +verify.renameLocations( /*findInStrings*/ false, /*findInComments*/ false); \ No newline at end of file diff --git a/tests/cases/fourslash/renameJsPrototypeProperty01.ts b/tests/cases/fourslash/renameJsPrototypeProperty01.ts new file mode 100644 index 00000000000..f756f57edbf --- /dev/null +++ b/tests/cases/fourslash/renameJsPrototypeProperty01.ts @@ -0,0 +1,12 @@ +/// + +// @allowJs: true +// @Filename: a.js +////function bar() { +////} +////bar.prototype.[|x|] = 10; +////var t = new bar(); +////t./**/[|x|] = 11; + +goTo.marker(); +verify.renameLocations( /*findInStrings*/ false, /*findInComments*/ false); \ No newline at end of file diff --git a/tests/cases/fourslash/renameJsPrototypeProperty02.ts b/tests/cases/fourslash/renameJsPrototypeProperty02.ts new file mode 100644 index 00000000000..721dc312eb6 --- /dev/null +++ b/tests/cases/fourslash/renameJsPrototypeProperty02.ts @@ -0,0 +1,12 @@ +/// + +// @allowJs: true +// @Filename: a.js +////function bar() { +////} +////bar.prototype./**/[|x|] = 10; +////var t = new bar(); +////t.[|x|] = 11; + +goTo.marker(); +verify.renameLocations( /*findInStrings*/ false, /*findInComments*/ false); \ No newline at end of file diff --git a/tests/cases/fourslash/renameJsThisProperty01.ts b/tests/cases/fourslash/renameJsThisProperty01.ts new file mode 100644 index 00000000000..91338e0431d --- /dev/null +++ b/tests/cases/fourslash/renameJsThisProperty01.ts @@ -0,0 +1,12 @@ +/// + +// @allowJs: true +// @Filename: a.js +////function bar() { +//// this.[|x|] = 10; +////} +////var t = new bar(); +////t./**/[|x|] = 11; + +goTo.marker(); +verify.renameLocations( /*findInStrings*/ false, /*findInComments*/ false); \ No newline at end of file diff --git a/tests/cases/fourslash/renameJsThisProperty02.ts b/tests/cases/fourslash/renameJsThisProperty02.ts new file mode 100644 index 00000000000..8398507c9ca --- /dev/null +++ b/tests/cases/fourslash/renameJsThisProperty02.ts @@ -0,0 +1,12 @@ +/// + +// @allowJs: true +// @Filename: a.js +////function bar() { +//// this./**/[|x|] = 10; +////} +////var t = new bar(); +////t.[|x|] = 11; + +goTo.marker(); +verify.renameLocations( /*findInStrings*/ false, /*findInComments*/ false); \ No newline at end of file diff --git a/tests/cases/fourslash/renameStingLiterals.ts b/tests/cases/fourslash/renameStingLiterals.ts new file mode 100644 index 00000000000..0e1222f327a --- /dev/null +++ b/tests/cases/fourslash/renameStingLiterals.ts @@ -0,0 +1,12 @@ +/// + +////var y: "string" = "string; +////var x = "/*1*/string"; +////function f(a = "/*2*/initial value") { } + + +goTo.marker("1"); +verify.renameInfoFailed(); + +goTo.marker("2"); +verify.renameInfoFailed(); diff --git a/tests/cases/fourslash/renameStingPropertyNames.ts b/tests/cases/fourslash/renameStingPropertyNames.ts new file mode 100644 index 00000000000..a948220efad --- /dev/null +++ b/tests/cases/fourslash/renameStingPropertyNames.ts @@ -0,0 +1,20 @@ +/// + +////var o = { +//// [|prop|]: 0 +////}; +//// +////o = { +//// "[|prop|]": 1 +////}; +//// +////o["[|prop|]"]; +////o['[|prop|]']; +////o.[|prop|]; + + +let ranges = test.ranges(); +for (let range of ranges) { + goTo.position(range.start); + verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false); +} diff --git a/tests/cases/fourslash/renameStringLiteralTypes.ts b/tests/cases/fourslash/renameStringLiteralTypes.ts new file mode 100644 index 00000000000..f9df83371c1 --- /dev/null +++ b/tests/cases/fourslash/renameStringLiteralTypes.ts @@ -0,0 +1,18 @@ +/// + + +////interface AnimationOptions { +//// deltaX: number; +//// deltaY: number; +//// easing: "ease-in" | "ease-out" | "[|ease-in-out|]"; +////} +//// +////function animate(o: AnimationOptions) { } +//// +////animate({ deltaX: 100, deltaY: 100, easing: "[|ease-in-out|]" }); + +let ranges = test.ranges(); +for (let range of ranges) { + goTo.position(range.start); + verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false); +} diff --git a/tests/cases/fourslash/selfReferencedExternalModule.ts b/tests/cases/fourslash/selfReferencedExternalModule.ts index 39d785ffb0d..3c96c320784 100644 --- a/tests/cases/fourslash/selfReferencedExternalModule.ts +++ b/tests/cases/fourslash/selfReferencedExternalModule.ts @@ -1,9 +1,9 @@ /// // @Filename: app.ts -////export import A = require('app'); +////export import A = require('./app'); ////export var I = 1; ////A./**/I goTo.marker(); -verify.completionListContains("A", "import A = require('app')"); +verify.completionListContains("A", "import A = require('./app')"); verify.completionListContains("I", "var I: number"); diff --git a/tests/cases/fourslash/selfReferencedExternalModule2.ts b/tests/cases/fourslash/selfReferencedExternalModule2.ts index ab1f7a6c901..698cfdde11f 100644 --- a/tests/cases/fourslash/selfReferencedExternalModule2.ts +++ b/tests/cases/fourslash/selfReferencedExternalModule2.ts @@ -1,12 +1,12 @@ /// // @Filename: app.ts -////export import A = require('app2'); +////export import A = require('./app2'); ////export var I = 1; ////A./*1*/Y; ////A.B.A.B./*2*/I; // @Filename: app2.ts -////export import B = require('app'); +////export import B = require('./app'); ////export var Y = 1; goTo.marker("1"); diff --git a/tests/cases/fourslash/server/definition01.ts b/tests/cases/fourslash/server/definition01.ts index 8bf6e73c840..c0c297f89e5 100644 --- a/tests/cases/fourslash/server/definition01.ts +++ b/tests/cases/fourslash/server/definition01.ts @@ -1,7 +1,7 @@ /// // @Filename: b.ts -////import n = require('a/*1*/'); +////import n = require('./a/*1*/'); ////var x = new n.Foo(); // @Filename: a.ts diff --git a/tests/cases/fourslash/server/jsdocParamTagSpecialKeywords.ts b/tests/cases/fourslash/server/jsdocParamTagSpecialKeywords.ts new file mode 100644 index 00000000000..be7ca5f0dff --- /dev/null +++ b/tests/cases/fourslash/server/jsdocParamTagSpecialKeywords.ts @@ -0,0 +1,14 @@ +/// + +// @allowNonTsExtensions: true +// @Filename: test.js +//// /** +//// * @param {string} type +//// */ +//// function test(type) { +//// type./**/ +//// } + + +goTo.marker(); +verify.completionListContains("charAt"); \ No newline at end of file diff --git a/tests/cases/fourslash/server/navbar01.ts b/tests/cases/fourslash/server/navbar01.ts index 82ded5e6f54..8e76e7c017e 100644 --- a/tests/cases/fourslash/server/navbar01.ts +++ b/tests/cases/fourslash/server/navbar01.ts @@ -45,8 +45,8 @@ test.markers().forEach((marker) => { if (marker.data) { - verify.getScriptLexicalStructureListContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName); + verify.navigationBarContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName); } }); -verify.getScriptLexicalStructureListCount(23); +verify.navigationBarCount(23); diff --git a/tests/cases/fourslash/server/openFileWithSyntaxKind.ts b/tests/cases/fourslash/server/openFileWithSyntaxKind.ts new file mode 100644 index 00000000000..dcb1e54999e --- /dev/null +++ b/tests/cases/fourslash/server/openFileWithSyntaxKind.ts @@ -0,0 +1,19 @@ +/// + +// Because the fourslash runner automatically opens the first file with the default setting, +// to test the openFile function, the targeted file cannot be the first one. + +// @Filename: dumbFile.ts +//// var x; + +// @allowJs: true +// @Filename: test.ts +//// /** +//// * @type {number} +//// */ +//// var t; +//// t. + +goTo.file("test.ts", /*content*/ undefined, "JS"); +goTo.eof(); +verify.completionListContains("toExponential"); diff --git a/tests/cases/fourslash/server/projectInfo01.ts b/tests/cases/fourslash/server/projectInfo01.ts index 656647715f0..0d8707bf8a1 100644 --- a/tests/cases/fourslash/server/projectInfo01.ts +++ b/tests/cases/fourslash/server/projectInfo01.ts @@ -4,7 +4,7 @@ ////export var test = "test String" // @Filename: b.ts -////import test from "a" +////import test from "./a" // @Filename: c.ts /////// diff --git a/tests/cases/fourslash/server/projectWithNonExistentFiles.ts b/tests/cases/fourslash/server/projectWithNonExistentFiles.ts new file mode 100644 index 00000000000..ceba136bf96 --- /dev/null +++ b/tests/cases/fourslash/server/projectWithNonExistentFiles.ts @@ -0,0 +1,13 @@ +/// + +// @Filename: a.ts +////export var test = "test String" + +// @Filename: b.ts +////export var test2 = "test String" + +// @Filename: tsconfig.json +////{ "files": ["a.ts", "c.ts", "b.ts"] } + +goTo.file("a.ts"); +verify.ProjectInfo(["lib.d.ts", "a.ts", "b.ts"]) diff --git a/tests/cases/fourslash/server/referencesInConfiguredProject.ts b/tests/cases/fourslash/server/referencesInConfiguredProject.ts new file mode 100644 index 00000000000..9a0d7095a93 --- /dev/null +++ b/tests/cases/fourslash/server/referencesInConfiguredProject.ts @@ -0,0 +1,20 @@ +/// + +// Global class reference. + +// @Filename: referencesForGlobals_1.ts +////class /*2*/globalClass { +//// public f() { } +////} + +// @Filename: referencesForGlobals_2.ts +////var c = /*1*/globalClass(); + +// @Filename: tsconfig.json +////{ "files": ["referencesForGlobals_1.ts", "referencesForGlobals_2.ts"] } + +goTo.marker("1"); +verify.referencesCountIs(2); + +goTo.marker("2"); +verify.referencesCountIs(2); \ No newline at end of file diff --git a/tests/cases/fourslash/server/renameInConfiguredProject.ts b/tests/cases/fourslash/server/renameInConfiguredProject.ts new file mode 100644 index 00000000000..ecff87493a8 --- /dev/null +++ b/tests/cases/fourslash/server/renameInConfiguredProject.ts @@ -0,0 +1,13 @@ +/// + +// @Filename: referencesForGlobals_1.ts +////var [|globalName|] = 0; + +// @Filename: referencesForGlobals_2.ts +////var y = /*1*/[|globalName|]; + +// @Filename: tsconfig.json +////{ "files": ["referencesForGlobals_1.ts", "referencesForGlobals_2.ts"] } + +goTo.marker("1"); +verify.renameLocations(/*findInStrings:*/ true, /*findInComments:*/ true); diff --git a/tests/cases/fourslash/server/typedefinition01.ts b/tests/cases/fourslash/server/typedefinition01.ts index e7c37747aba..bde9f4dc4d8 100644 --- a/tests/cases/fourslash/server/typedefinition01.ts +++ b/tests/cases/fourslash/server/typedefinition01.ts @@ -1,7 +1,7 @@ /// // @Filename: b.ts -////import n = require('a'); +////import n = require('./a'); ////var x/*1*/ = new n.Foo(); // @Filename: a.ts diff --git a/tests/cases/fourslash/shims-pp/getCompletionsAtPosition.ts b/tests/cases/fourslash/shims-pp/getCompletionsAtPosition.ts index 714d3390e76..f81572ccebf 100644 --- a/tests/cases/fourslash/shims-pp/getCompletionsAtPosition.ts +++ b/tests/cases/fourslash/shims-pp/getCompletionsAtPosition.ts @@ -3,10 +3,10 @@ ////function foo(strOrNum: string | number) { //// /*1*/ //// if (typeof strOrNum === "number") { -//// /*2*/ +//// strOrNum/*2*/; //// } //// else { -//// /*3*/ +//// strOrNum/*3*/; //// } ////} diff --git a/tests/cases/fourslash/shims-pp/getNavigationBarItems.ts b/tests/cases/fourslash/shims-pp/getNavigationBarItems.ts index 6c0738747f3..a2cdb80baef 100644 --- a/tests/cases/fourslash/shims-pp/getNavigationBarItems.ts +++ b/tests/cases/fourslash/shims-pp/getNavigationBarItems.ts @@ -3,7 +3,7 @@ //// {| "itemName": "c", "kind": "const", "parentName": "" |}const c = 0; test.markers().forEach(marker => { - verify.getScriptLexicalStructureListContains( + verify.navigationBarContains( marker.data.itemName, marker.data.kind, marker.fileName, diff --git a/tests/cases/fourslash/shims-pp/getPreProcessedFile.ts b/tests/cases/fourslash/shims-pp/getPreProcessedFile.ts index aa0ff4c0669..03ce481c8ba 100644 --- a/tests/cases/fourslash/shims-pp/getPreProcessedFile.ts +++ b/tests/cases/fourslash/shims-pp/getPreProcessedFile.ts @@ -1,4 +1,5 @@ /// +// @ModuleResolution: classic // @Filename: refFile1.ts //// class D { } diff --git a/tests/cases/fourslash/shims-pp/getReferencesAtPosition.ts b/tests/cases/fourslash/shims-pp/getReferencesAtPosition.ts index 34144b74899..a25a6e1285f 100644 --- a/tests/cases/fourslash/shims-pp/getReferencesAtPosition.ts +++ b/tests/cases/fourslash/shims-pp/getReferencesAtPosition.ts @@ -17,7 +17,7 @@ ////} //@Filename: findAllRefsOnDefinition.ts -////import Second = require("findAllRefsOnDefinition-import"); +////import Second = require("./findAllRefsOnDefinition-import"); //// ////var second = new Second.Test() ////second.start(); diff --git a/tests/cases/fourslash/shims-pp/goToDefinitionTypeReferenceDirective.ts b/tests/cases/fourslash/shims-pp/goToDefinitionTypeReferenceDirective.ts new file mode 100644 index 00000000000..3aaa3ab980f --- /dev/null +++ b/tests/cases/fourslash/shims-pp/goToDefinitionTypeReferenceDirective.ts @@ -0,0 +1,13 @@ +/// + +// @typesRoot: src +// @Filename: src/types/lib/index.d.ts +/////*0*/declare let $: {x: number}; + +// @Filename: src/app.ts +//// /// +//// $.x; + +goTo.marker("1"); +goTo.definition(); +verify.caretAtMarker("0"); \ No newline at end of file diff --git a/tests/cases/fourslash/shims/getCompletionsAtPosition.ts b/tests/cases/fourslash/shims/getCompletionsAtPosition.ts index 714d3390e76..f81572ccebf 100644 --- a/tests/cases/fourslash/shims/getCompletionsAtPosition.ts +++ b/tests/cases/fourslash/shims/getCompletionsAtPosition.ts @@ -3,10 +3,10 @@ ////function foo(strOrNum: string | number) { //// /*1*/ //// if (typeof strOrNum === "number") { -//// /*2*/ +//// strOrNum/*2*/; //// } //// else { -//// /*3*/ +//// strOrNum/*3*/; //// } ////} diff --git a/tests/cases/fourslash/shims/getNavigationBarItems.ts b/tests/cases/fourslash/shims/getNavigationBarItems.ts index 6c0738747f3..a2cdb80baef 100644 --- a/tests/cases/fourslash/shims/getNavigationBarItems.ts +++ b/tests/cases/fourslash/shims/getNavigationBarItems.ts @@ -3,7 +3,7 @@ //// {| "itemName": "c", "kind": "const", "parentName": "" |}const c = 0; test.markers().forEach(marker => { - verify.getScriptLexicalStructureListContains( + verify.navigationBarContains( marker.data.itemName, marker.data.kind, marker.fileName, diff --git a/tests/cases/fourslash/shims/getPreProcessedFile.ts b/tests/cases/fourslash/shims/getPreProcessedFile.ts index aa0ff4c0669..03ce481c8ba 100644 --- a/tests/cases/fourslash/shims/getPreProcessedFile.ts +++ b/tests/cases/fourslash/shims/getPreProcessedFile.ts @@ -1,4 +1,5 @@ /// +// @ModuleResolution: classic // @Filename: refFile1.ts //// class D { } diff --git a/tests/cases/fourslash/shims/getReferencesAtPosition.ts b/tests/cases/fourslash/shims/getReferencesAtPosition.ts index 34144b74899..a25a6e1285f 100644 --- a/tests/cases/fourslash/shims/getReferencesAtPosition.ts +++ b/tests/cases/fourslash/shims/getReferencesAtPosition.ts @@ -17,7 +17,7 @@ ////} //@Filename: findAllRefsOnDefinition.ts -////import Second = require("findAllRefsOnDefinition-import"); +////import Second = require("./findAllRefsOnDefinition-import"); //// ////var second = new Second.Test() ////second.start(); diff --git a/tests/cases/fourslash/shims/goToDefinitionTypeReferenceDirective.ts b/tests/cases/fourslash/shims/goToDefinitionTypeReferenceDirective.ts new file mode 100644 index 00000000000..3aaa3ab980f --- /dev/null +++ b/tests/cases/fourslash/shims/goToDefinitionTypeReferenceDirective.ts @@ -0,0 +1,13 @@ +/// + +// @typesRoot: src +// @Filename: src/types/lib/index.d.ts +/////*0*/declare let $: {x: number}; + +// @Filename: src/app.ts +//// /// +//// $.x; + +goTo.marker("1"); +goTo.definition(); +verify.caretAtMarker("0"); \ No newline at end of file diff --git a/tests/cases/fourslash/signatureHelpThis.ts b/tests/cases/fourslash/signatureHelpThis.ts new file mode 100644 index 00000000000..2ac19c823c0 --- /dev/null +++ b/tests/cases/fourslash/signatureHelpThis.ts @@ -0,0 +1,43 @@ +/// +////class Foo { +//// public implicitAny(n: number) { +//// } +//// public explicitThis(this: this, n: number) { +//// console.log(this); +//// } +//// public explicitClass(this: Foo, n: number) { +//// console.log(this); +//// } +////} +//// +////function implicitAny(x: number): void { +//// return this; +////} +////function explicitVoid(this: void, x: number): void { +//// return this; +////} +////function explicitLiteral(this: { n: number }, x: number): void { +//// console.log(this); +////} +////let foo = new Foo(); +////foo.implicitAny(/*1*/); +////foo.explicitThis(/*2*/); +////foo.explicitClass(/*3*/); +////implicitAny(/*4*/12); +////explicitVoid(/*5*/13); +////let o = { n: 14, m: explicitLiteral }; +////o.m(/*6*/); + + +goTo.marker('1'); +verify.currentParameterHelpArgumentNameIs("n"); +goTo.marker('2'); +verify.currentParameterHelpArgumentNameIs("n"); +goTo.marker('3'); +verify.currentParameterHelpArgumentNameIs("n"); +goTo.marker('4'); +verify.currentParameterHelpArgumentNameIs("x"); +goTo.marker('5'); +verify.currentParameterHelpArgumentNameIs("x"); +goTo.marker('6'); +verify.currentParameterHelpArgumentNameIs("x"); diff --git a/tests/cases/fourslash/stringBraceCompletionPosition.ts b/tests/cases/fourslash/stringBraceCompletionPosition.ts new file mode 100644 index 00000000000..09a9a86b0f1 --- /dev/null +++ b/tests/cases/fourslash/stringBraceCompletionPosition.ts @@ -0,0 +1,16 @@ +/// + +//// var x = "/*1*/"; +//// var x = '/*2*/'; +//// var x = "hello \ +//// /*3*/"; + +goTo.marker('1'); +verify.not.isValidBraceCompletionAtPostion('('); + +goTo.marker('2'); +verify.not.isValidBraceCompletionAtPostion('('); + +goTo.marker('3'); +verify.not.isValidBraceCompletionAtPostion('('); + diff --git a/tests/cases/fourslash/stringTemplateBraceCompletionPosition.ts b/tests/cases/fourslash/stringTemplateBraceCompletionPosition.ts new file mode 100644 index 00000000000..33bcd4d0625 --- /dev/null +++ b/tests/cases/fourslash/stringTemplateBraceCompletionPosition.ts @@ -0,0 +1,16 @@ +/// + +//// var x = `/*1*/`; +//// var y = `hello /*2*/world, ${100}how /*3*/are you{ 200 } to/*4*/day!?` + +goTo.marker('1'); +verify.not.isValidBraceCompletionAtPostion('('); + +goTo.marker('2'); +verify.not.isValidBraceCompletionAtPostion('('); + +goTo.marker('3'); +verify.not.isValidBraceCompletionAtPostion('('); + +goTo.marker('4'); +verify.not.isValidBraceCompletionAtPostion('('); diff --git a/tests/cases/fourslash/superInsideInnerClass.ts b/tests/cases/fourslash/superInsideInnerClass.ts new file mode 100644 index 00000000000..3b85179b0d8 --- /dev/null +++ b/tests/cases/fourslash/superInsideInnerClass.ts @@ -0,0 +1,15 @@ +/// +////class Base { +//// constructor(n: number) { +//// } +////} +////class Derived extends Base { +//// constructor() { +//// class Nested { +//// [super(/*1*/)] = 11111 +//// } +//// } +////} + +goTo.marker('1'); +verify.signatureHelpCountIs(0); diff --git a/tests/cases/fourslash/syntacticClassificationsJsx1.ts b/tests/cases/fourslash/syntacticClassificationsJsx1.ts new file mode 100644 index 00000000000..e9de07c759b --- /dev/null +++ b/tests/cases/fourslash/syntacticClassificationsJsx1.ts @@ -0,0 +1,27 @@ +/// + +// @Filename: file1.tsx +////let x =
+//// some jsx text +////
; +//// +////let y = + +const c = classification; +verify.syntacticClassificationsAre( + c.keyword("let"), c.identifier("x"), c.operator("="), + c.punctuation("<"), + c.jsxOpenTagName("div"), + c.jsxAttribute("a"), c.operator("="), c.jsxAttributeStringLiteralValue(`"some-value"`), + c.jsxAttribute("b"), c.operator("="), c.punctuation("{"), c.numericLiteral("1"), c.punctuation("}"), + c.punctuation(">"), + c.jsxText(` + some jsx text +`), + c.punctuation("<"), c.punctuation("/"), c.jsxCloseTagName("div"), c.punctuation(">"), c.punctuation(";"), + c.keyword("let"), c.identifier("y"), c.operator("="), + c.punctuation("<"), + c.jsxSelfClosingTagName("element"), + c.jsxAttribute("attr"), c.operator("="), c.jsxAttributeStringLiteralValue(`"123"`), + c.punctuation("/"), c.punctuation(">") +) \ No newline at end of file diff --git a/tests/cases/fourslash/syntacticClassificationsJsx2.ts b/tests/cases/fourslash/syntacticClassificationsJsx2.ts new file mode 100644 index 00000000000..9110c6ce4b9 --- /dev/null +++ b/tests/cases/fourslash/syntacticClassificationsJsx2.ts @@ -0,0 +1,27 @@ +/// + +// @Filename: file1.tsx +////let x = +//// some jsx text +////; +//// +////let y = + +const c = classification; +verify.syntacticClassificationsAre( + c.keyword("let"), c.identifier("x"), c.operator("="), + c.punctuation("<"), + c.jsxOpenTagName("div.name"), + c.jsxAttribute("b"), c.operator("="), c.jsxAttributeStringLiteralValue(`"some-value"`), + c.jsxAttribute("c"), c.operator("="), c.punctuation("{"), c.numericLiteral("1"), c.punctuation("}"), + c.punctuation(">"), + c.jsxText(` + some jsx text +`), + c.punctuation("<"), c.punctuation("/"), c.jsxCloseTagName("div.name"), c.punctuation(">"), c.punctuation(";"), + c.keyword("let"), c.identifier("y"), c.operator("="), + c.punctuation("<"), + c.jsxSelfClosingTagName("element.name"), + c.jsxAttribute("attr"), c.operator("="), c.jsxAttributeStringLiteralValue(`"123"`), + c.punctuation("/"), c.punctuation(">") +) \ No newline at end of file diff --git a/tests/cases/fourslash/thisBindingInLambda.ts b/tests/cases/fourslash/thisBindingInLambda.ts index f6dfdbdec08..d9c43796bd8 100644 --- a/tests/cases/fourslash/thisBindingInLambda.ts +++ b/tests/cases/fourslash/thisBindingInLambda.ts @@ -9,4 +9,4 @@ ////} goTo.marker(); -verify.quickInfoIs('class Greeter'); +verify.quickInfoIs('this: this'); diff --git a/tests/cases/fourslash/thisPredicateFunctionCompletions01.ts b/tests/cases/fourslash/thisPredicateFunctionCompletions01.ts new file mode 100644 index 00000000000..8c9abb85418 --- /dev/null +++ b/tests/cases/fourslash/thisPredicateFunctionCompletions01.ts @@ -0,0 +1,52 @@ +/// + +//// class FileSystemObject { +//// isFile(): this is Item { +//// return this instanceof Item; +//// } +//// isDirectory(): this is Directory { +//// return this instanceof Directory; +//// } +//// isNetworked(): this is (Networked & this) { +//// return !!(this as Networked).host; +//// } +//// constructor(public path: string) {} +//// } +//// +//// class Item extends FileSystemObject { +//// constructor(path: string, public content: string) { super(path); } +//// } +//// class Directory extends FileSystemObject { +//// children: FileSystemObject[]; +//// } +//// interface Networked { +//// host: string; +//// } +//// +//// const obj: FileSystemObject = new Item("/foo", ""); +//// if (obj.isFile()) { +//// obj./*1*/; +//// if (obj.isNetworked()) { +//// obj./*2*/; +//// } +//// } +//// if (obj.isDirectory()) { +//// obj./*3*/; +//// if (obj.isNetworked()) { +//// obj./*4*/; +//// } +//// } +//// if (obj.isNetworked()) { +//// obj./*5*/; +//// } + +goTo.marker("1"); +verify.completionListContains("content"); +goTo.marker("2"); +verify.completionListContains("host"); +goTo.marker("3"); +verify.completionListContains("children"); +goTo.marker("4"); +verify.completionListContains("host"); +goTo.marker("5"); +verify.completionListContains("host"); \ No newline at end of file diff --git a/tests/cases/fourslash/thisPredicateFunctionCompletions02.ts b/tests/cases/fourslash/thisPredicateFunctionCompletions02.ts new file mode 100644 index 00000000000..e2e311ea649 --- /dev/null +++ b/tests/cases/fourslash/thisPredicateFunctionCompletions02.ts @@ -0,0 +1,43 @@ +/// + +//// interface Sundries { +//// broken: boolean; +//// } +//// +//// interface Supplies { +//// spoiled: boolean; +//// } +//// +//// interface Crate { +//// contents: T; +//// isSundries(): this is Crate; +//// isSupplies(): this is Crate; +//// isPackedTight(): this is (this & {extraContents: T}); +//// } +//// const crate: Crate; +//// if (crate.isPackedTight()) { +//// crate./*1*/; +//// } +//// if (crate.isSundries()) { +//// crate.contents./*2*/; +//// if (crate.isPackedTight()) { +//// crate./*3*/; +//// } +//// } +//// if (crate.isSupplies()) { +//// crate.contents./*4*/; +//// if (crate.isPackedTight()) { +//// crate./*5*/; +//// } +//// } + +goTo.marker("1"); +verify.completionListContains("extraContents"); +goTo.marker("2"); +verify.completionListContains("broken"); +goTo.marker("3"); +verify.completionListContains("extraContents"); +goTo.marker("4"); +verify.completionListContains("spoiled"); +goTo.marker("5"); +verify.completionListContains("extraContents"); \ No newline at end of file diff --git a/tests/cases/fourslash/thisPredicateFunctionCompletions.ts b/tests/cases/fourslash/thisPredicateFunctionCompletions03.ts similarity index 70% rename from tests/cases/fourslash/thisPredicateFunctionCompletions.ts rename to tests/cases/fourslash/thisPredicateFunctionCompletions03.ts index 3c93a859bf3..4985a1ca561 100644 --- a/tests/cases/fourslash/thisPredicateFunctionCompletions.ts +++ b/tests/cases/fourslash/thisPredicateFunctionCompletions03.ts @@ -38,20 +38,6 @@ //// b./*8*/; //// } //// -//// if (((a.isLeader)())) { -//// a./*9*/; -//// } -//// else if (((a).isFollower())) { -//// a./*10*/; -//// } -//// -//// if (((a["isLeader"])())) { -//// a./*11*/; -//// } -//// else if (((a)["isFollower"]())) { -//// a./*12*/; -//// } -//// //// let leader/*13*/Status = a.isLeader(); //// function isLeaderGuard(g: RoyalGuard) { //// return g.isLeader(); @@ -68,13 +54,3 @@ goTo.marker("6"); verify.completionListContains("lead"); goTo.marker("8"); verify.completionListContains("follow"); - -goTo.marker("9"); -verify.completionListContains("lead"); -goTo.marker("10"); -verify.completionListContains("follow"); - -goTo.marker("11"); -verify.completionListContains("lead"); -goTo.marker("12"); -verify.completionListContains("follow"); \ No newline at end of file diff --git a/tests/cases/fourslash/thisPredicateFunctionQuickInfo01.ts b/tests/cases/fourslash/thisPredicateFunctionQuickInfo01.ts new file mode 100644 index 00000000000..135df559189 --- /dev/null +++ b/tests/cases/fourslash/thisPredicateFunctionQuickInfo01.ts @@ -0,0 +1,59 @@ +/// + +//// class FileSystemObject { +//// /*1*/isFile(): this is Item { +//// return this instanceof Item; +//// } +//// /*2*/isDirectory(): this is Directory { +//// return this instanceof Directory; +//// } +//// /*3*/isNetworked(): this is (Networked & this) { +//// return !!(this as Networked).host; +//// } +//// constructor(public path: string) {} +//// } +//// +//// class Item extends FileSystemObject { +//// constructor(path: string, public content: string) { super(path); } +//// } +//// class Directory extends FileSystemObject { +//// children: FileSystemObject[]; +//// } +//// interface Networked { +//// host: string; +//// } +//// +//// const obj: FileSystemObject = new Item("/foo", ""); +//// if (obj.isFile/*4*/()) { +//// obj.; +//// if (obj.isNetworked/*5*/()) { +//// obj.; +//// } +//// } +//// if (obj.isDirectory/*6*/()) { +//// obj.; +//// if (obj.isNetworked/*7*/()) { +//// obj.; +//// } +//// } +//// if (obj.isNetworked/*8*/()) { +//// obj.; +//// } + +goTo.marker("1"); +verify.quickInfoIs("(method) FileSystemObject.isFile(): this is Item"); +goTo.marker("2"); +verify.quickInfoIs("(method) FileSystemObject.isDirectory(): this is Directory"); +goTo.marker("3"); +verify.quickInfoIs("(method) FileSystemObject.isNetworked(): this is Networked & this"); + +goTo.marker("4"); +verify.quickInfoIs("(method) FileSystemObject.isFile(): this is Item"); +goTo.marker("5"); +verify.quickInfoIs("(method) FileSystemObject.isNetworked(): this is Networked & Item"); +goTo.marker("6"); +verify.quickInfoIs("(method) FileSystemObject.isDirectory(): this is Directory"); +goTo.marker("7"); +verify.quickInfoIs("(method) FileSystemObject.isNetworked(): this is Networked & Directory"); +goTo.marker("8"); +verify.quickInfoIs("(method) FileSystemObject.isNetworked(): this is Networked & FileSystemObject"); \ No newline at end of file diff --git a/tests/cases/fourslash/thisPredicateFunctionQuickInfo02.ts b/tests/cases/fourslash/thisPredicateFunctionQuickInfo02.ts new file mode 100644 index 00000000000..b8135026c82 --- /dev/null +++ b/tests/cases/fourslash/thisPredicateFunctionQuickInfo02.ts @@ -0,0 +1,57 @@ +/// + +//// interface Sundries { +//// broken: boolean; +//// } +//// +//// interface Supplies { +//// spoiled: boolean; +//// } +//// +//// interface Crate { +//// contents: T; +//// /*1*/isSundries(): this is Crate; +//// /*2*/isSupplies(): this is Crate; +//// /*3*/isPackedTight(): this is (this & {extraContents: T}); +//// } +//// const crate: Crate; +//// if (crate.isPackedTight/*4*/()) { +//// crate.; +//// } +//// if (crate.isSundries/*5*/()) { +//// crate.contents.; +//// if (crate.isPackedTight/*6*/()) { +//// crate.; +//// } +//// } +//// if (crate.isSupplies/*7*/()) { +//// crate.contents.; +//// if (crate.isPackedTight/*8*/()) { +//// crate.; +//// } +//// } + +goTo.marker("1"); +verify.quickInfoIs("(method) Crate.isSundries(): this is Crate"); +goTo.marker("2"); +verify.quickInfoIs("(method) Crate.isSupplies(): this is Crate"); +goTo.marker("3"); +verify.quickInfoIs(`(method) Crate.isPackedTight(): this is this & { + extraContents: T; +}`); +goTo.marker("4"); +verify.quickInfoIs(`(method) Crate.isPackedTight(): this is Crate & { + extraContents: any; +}`); +goTo.marker("5"); +verify.quickInfoIs("(method) Crate.isSundries(): this is Crate"); +goTo.marker("6"); +verify.quickInfoIs(`(method) Crate.isPackedTight(): this is Crate & { + extraContents: Sundries; +}`); +goTo.marker("7"); +verify.quickInfoIs("(method) Crate.isSupplies(): this is Crate"); +goTo.marker("8"); +verify.quickInfoIs(`(method) Crate.isPackedTight(): this is Crate & { + extraContents: Supplies; +}`); \ No newline at end of file diff --git a/tests/cases/fourslash/thisPredicateMemberCompletions.ts b/tests/cases/fourslash/thisPredicateMemberCompletions.ts deleted file mode 100644 index 24ce742faac..00000000000 --- a/tests/cases/fourslash/thisPredicateMemberCompletions.ts +++ /dev/null @@ -1,95 +0,0 @@ -/// - -//// class FileSystemObject { -//// get is/*1*/File(): this is Item { -//// return this instanceof Item; -//// } -//// set is/*2*/File(param) { -//// // noop -//// } -//// get is/*3*/Directory(): this is Directory { -//// return this instanceof Directory; -//// } -//// is/*4*/Networked: this is (Networked & this); -//// constructor(public path: string) {} -//// } -//// -//// class Item extends FileSystemObject { -//// constructor(path: string, public content: string) { super(path); } -//// } -//// class Directory extends FileSystemObject { -//// children: FileSystemObject[]; -//// } -//// interface Networked { -//// host: string; -//// } -//// -//// interface Sundries { -//// broken: boolean; -//// } -//// -//// interface Supplies { -//// spoiled: boolean; -//// } -//// -//// interface Crate { -//// contents: T; -//// is/*5*/Sundries: this is Crate; -//// is/*6*/Supplies: this is Crate; -//// is/*7*/PackedTight: this is (this & {extraContents: T}); -//// } -//// -//// const obj: FileSystemObject = new Item("/foo", ""); -//// if (obj.is/*8*/File) { -//// obj./*9*/; -//// if (obj.is/*10*/Networked) { -//// obj./*11*/; -//// } -//// } -//// if (obj.is/*12*/Directory) { -//// obj./*13*/; -//// if (obj.is/*14*/Networked) { -//// obj./*15*/; -//// } -//// } -//// if (obj.is/*16*/Networked) { -//// obj./*17*/; -//// } -//// -//// const crate: Crate; -//// if (crate.is/*18*/PackedTight) { -//// crate./*19*/; -//// } -//// if (crate.is/*20*/Sundries) { -//// crate.contents./*21*/; -//// if (crate.is/*22*/PackedTight) { -//// crate./*23*/ -//// } -//// } -//// if (crate.is/*24*/Supplies) { -//// crate.contents./*25*/; -//// if (crate.is/*26*/PackedTight) { -//// crate./*27*/ -//// } -//// } - -goTo.marker("9"); -verify.completionListContains("content"); -goTo.marker("11"); -verify.completionListContains("host"); -goTo.marker("13"); -verify.completionListContains("children"); -goTo.marker("15"); -verify.completionListContains("host"); -goTo.marker("17"); -verify.completionListContains("host"); -goTo.marker("19"); -verify.completionListContains("extraContents"); -goTo.marker("21"); -verify.completionListContains("broken"); -goTo.marker("23"); -verify.completionListContains("extraContents"); -goTo.marker("25"); -verify.completionListContains("spoiled"); -goTo.marker("27"); -verify.completionListContains("extraContents"); \ No newline at end of file diff --git a/tests/cases/fourslash/thisPredicateMemberQuickInfo.ts b/tests/cases/fourslash/thisPredicateMemberQuickInfo.ts deleted file mode 100644 index 20d519e0008..00000000000 --- a/tests/cases/fourslash/thisPredicateMemberQuickInfo.ts +++ /dev/null @@ -1,117 +0,0 @@ -/// - -//// class FileSystemObject { -//// get is/*1*/File(): this is Item { -//// return this instanceof Item; -//// } -//// set is/*2*/File(param) { -//// // noop -//// } -//// get is/*3*/Directory(): this is Directory { -//// return this instanceof Directory; -//// } -//// is/*4*/Networked: this is (Networked & this); -//// constructor(public path: string) {} -//// } -//// -//// class Item extends FileSystemObject { -//// constructor(path: string, public content: string) { super(path); } -//// } -//// class Directory extends FileSystemObject { -//// children: FileSystemObject[]; -//// } -//// interface Networked { -//// host: string; -//// } -//// -//// interface Sundries { -//// broken: boolean; -//// } -//// -//// interface Supplies { -//// spoiled: boolean; -//// } -//// -//// interface Crate { -//// contents: T; -//// is/*5*/Sundries: this is Crate; -//// is/*6*/Supplies: this is Crate; -//// is/*7*/PackedTight: this is (this & {extraContents: T}); -//// } -//// -//// const obj: FileSystemObject = new Item("/foo", ""); -//// if (obj.is/*8*/File) { -//// obj./*9*/; -//// if (obj.is/*10*/Networked) { -//// obj./*11*/; -//// } -//// } -//// if (obj.is/*12*/Directory) { -//// obj./*13*/; -//// if (obj.is/*14*/Networked) { -//// obj./*15*/; -//// } -//// } -//// if (obj.is/*16*/Networked) { -//// obj./*17*/; -//// } -//// -//// const crate: Crate; -//// if (crate.is/*18*/PackedTight) { -//// crate./*19*/; -//// } -//// if (crate.is/*20*/Sundries) { -//// crate.contents./*21*/; -//// if (crate.is/*22*/PackedTight) { -//// crate./*23*/ -//// } -//// } -//// if (crate.is/*24*/Supplies) { -//// crate.contents./*25*/; -//// if (crate.is/*26*/PackedTight) { -//// crate./*27*/ -//// } -//// } - -goTo.marker("1"); -verify.quickInfoIs("(property) FileSystemObject.isFile: this is Item"); -goTo.marker("2"); -verify.quickInfoIs("(property) FileSystemObject.isFile: this is Item"); -goTo.marker("3"); -verify.quickInfoIs("(property) FileSystemObject.isDirectory: this is Directory"); -goTo.marker("4"); -verify.quickInfoIs("(property) FileSystemObject.isNetworked: this is Networked & this"); -goTo.marker("5"); -verify.quickInfoIs("(property) Crate.isSundries: this is Crate"); -goTo.marker("6"); -verify.quickInfoIs("(property) Crate.isSupplies: this is Crate"); -goTo.marker("7"); -verify.quickInfoIs(`(property) Crate.isPackedTight: this is this & { - extraContents: T; -}`); -goTo.marker("8"); -verify.quickInfoIs("(property) FileSystemObject.isFile: this is Item"); -goTo.marker("10"); -verify.quickInfoIs("(property) FileSystemObject.isNetworked: this is Networked & Item"); -goTo.marker("12"); -verify.quickInfoIs("(property) FileSystemObject.isDirectory: this is Directory"); -goTo.marker("14"); -verify.quickInfoIs("(property) FileSystemObject.isNetworked: this is Networked & Directory"); -goTo.marker("16"); -verify.quickInfoIs("(property) FileSystemObject.isNetworked: this is Networked & FileSystemObject"); -goTo.marker("18"); -verify.quickInfoIs(`(property) Crate.isPackedTight: this is Crate & { - extraContents: any; -}`); -goTo.marker("20"); -verify.quickInfoIs("(property) Crate.isSundries: this is Crate"); -goTo.marker("22"); -verify.quickInfoIs(`(property) Crate.isPackedTight: this is Crate & { - extraContents: Sundries; -}`); -goTo.marker("24"); -verify.quickInfoIs("(property) Crate.isSupplies: this is Crate"); -goTo.marker("26"); -verify.quickInfoIs(`(property) Crate.isPackedTight: this is Crate & { - extraContents: Supplies; -}`); \ No newline at end of file diff --git a/tests/cases/fourslash/tsxCompletion11.ts b/tests/cases/fourslash/tsxCompletion11.ts new file mode 100644 index 00000000000..5d9c869a9b6 --- /dev/null +++ b/tests/cases/fourslash/tsxCompletion11.ts @@ -0,0 +1,14 @@ +/// + +//@module: commonjs +//@jsx: preserve + +//@Filename: exporter.tsx +//// export class Thing { } + +//@Filename: file.tsx +//// import {Thing} from './exporter'; +//// var x1 =
+ +//@Filename: file.tsx +//// declare module JSX { +//// interface Element { } +//// interface IntrinsicElements { +//// div: { ONE: string; TWO: number; } +//// } +//// } +//// var x1 =
+ +//@Filename: file.tsx +//// declare module JSX { +//// interface Element { } +//// interface IntrinsicElements { +//// div: { ONE: string; TWO: number; } +//// } +//// } +//// var x1 =
+////

Hello world +//// + +goTo.marker("1"); +verify.memberListCount(1); +verify.completionListContains('div'); + +goTo.marker("2"); +verify.memberListCount(1); +verify.completionListContains('h1') diff --git a/tests/cases/fourslash/tsxCompletionOnClosingTagWithoutJSX1.ts b/tests/cases/fourslash/tsxCompletionOnClosingTagWithoutJSX1.ts new file mode 100644 index 00000000000..742009b487e --- /dev/null +++ b/tests/cases/fourslash/tsxCompletionOnClosingTagWithoutJSX1.ts @@ -0,0 +1,8 @@ +/// + +//@Filename: file.tsx +//// var x1 =
+ +//@Filename: file.tsx +//// var x1 =
+////

Hello world +//// + +goTo.marker("1"); +verify.memberListCount(1); +verify.completionListContains('div'); + +goTo.marker("2"); +verify.memberListCount(1); +verify.completionListContains('h1') diff --git a/tests/cases/fourslash/tsxCompletionOnOpeningTagWithoutJSX1.ts b/tests/cases/fourslash/tsxCompletionOnOpeningTagWithoutJSX1.ts new file mode 100644 index 00000000000..d0ef579f401 --- /dev/null +++ b/tests/cases/fourslash/tsxCompletionOnOpeningTagWithoutJSX1.ts @@ -0,0 +1,7 @@ +/// + +//@Filename: file.tsx +//// var x = + +//@Filename: file.tsx +//// var x1 = +//// class MyElement {} +//// var z = + +goTo.marker("1"); +verify.quickInfoIs("any", undefined); + +goTo.marker("2"); +verify.quickInfoIs("any", undefined);; + +goTo.marker("3"); +verify.quickInfoIs("class MyElement", undefined);; + +goTo.marker("4"); +verify.quickInfoIs("class MyElement", undefined);; \ No newline at end of file diff --git a/tests/cases/fourslash/tsxQuickInfo2.ts b/tests/cases/fourslash/tsxQuickInfo2.ts new file mode 100644 index 00000000000..0eb7a5100c4 --- /dev/null +++ b/tests/cases/fourslash/tsxQuickInfo2.ts @@ -0,0 +1,24 @@ +/// + +//@Filename: file.tsx +//// declare module JSX { +//// interface Element { } +//// interface IntrinsicElements { +//// div: any +//// } +//// } +//// var x1 = +//// class MyElement {} +//// var z = + +goTo.marker("1"); +verify.quickInfoIs("(property) JSX.IntrinsicElements.div: any", undefined); + +goTo.marker("2"); +verify.quickInfoIs("(property) JSX.IntrinsicElements.div: any", undefined);; + +goTo.marker("3"); +verify.quickInfoIs("class MyElement", undefined);; + +goTo.marker("4"); +verify.quickInfoIs("class MyElement", undefined);; \ No newline at end of file diff --git a/tests/cases/fourslash/validBraceCompletionPosition.ts b/tests/cases/fourslash/validBraceCompletionPosition.ts new file mode 100644 index 00000000000..57c30c27c21 --- /dev/null +++ b/tests/cases/fourslash/validBraceCompletionPosition.ts @@ -0,0 +1,23 @@ +/// + +//// function parseInt(/*1*/){} +//// class aa/*2*/{ +//// public b/*3*/(){} +//// } +//// interface I/*4*/{} +//// var x = /*5*/{ a:true } + +goTo.marker('1'); +verify.isValidBraceCompletionAtPostion('('); + +goTo.marker('2'); +verify.isValidBraceCompletionAtPostion('('); + +goTo.marker('3'); +verify.isValidBraceCompletionAtPostion('('); + +goTo.marker('4'); +verify.isValidBraceCompletionAtPostion('('); + +goTo.marker('5'); +verify.isValidBraceCompletionAtPostion('('); \ No newline at end of file diff --git a/tests/cases/fourslash/verifySingleFileEmitOutput1.ts b/tests/cases/fourslash/verifySingleFileEmitOutput1.ts index f1c9002390f..1921a6fe053 100644 --- a/tests/cases/fourslash/verifySingleFileEmitOutput1.ts +++ b/tests/cases/fourslash/verifySingleFileEmitOutput1.ts @@ -7,7 +7,7 @@ ////} // @Filename: verifySingleFileEmitOutput1_file1.ts -////import f = require("verifySingleFileEmitOutput1_file0"); +////import f = require("./verifySingleFileEmitOutput1_file0"); ////var /**/b = new f.A(); goTo.marker(); diff --git a/tests/cases/project/declarationDir.json b/tests/cases/project/declarationDir.json new file mode 100644 index 00000000000..3322694ddbd --- /dev/null +++ b/tests/cases/project/declarationDir.json @@ -0,0 +1,12 @@ +{ + "scenario": "declarationDir: specify declarationDir only", + "projectRoot": "tests/cases/projects/declarationDir", + "inputFiles": [ + "a.ts", + "subfolder/b.ts", + "subfolder/c.ts" + ], + "declaration": true, + "declarationDir": "declarations", + "baselineCheck": true +} \ No newline at end of file diff --git a/tests/cases/project/declarationDir2.json b/tests/cases/project/declarationDir2.json new file mode 100644 index 00000000000..c943ed7f57b --- /dev/null +++ b/tests/cases/project/declarationDir2.json @@ -0,0 +1,13 @@ +{ + "scenario": "declarationDir: specify declarationDir with outDir", + "projectRoot": "tests/cases/projects/declarationDir", + "inputFiles": [ + "a.ts", + "subfolder/b.ts", + "subfolder/c.ts" + ], + "outDir": "out", + "declaration": true, + "declarationDir": "declarations", + "baselineCheck": true +} \ No newline at end of file diff --git a/tests/cases/project/declarationDir3.json b/tests/cases/project/declarationDir3.json new file mode 100644 index 00000000000..b86e454c69d --- /dev/null +++ b/tests/cases/project/declarationDir3.json @@ -0,0 +1,13 @@ +{ + "scenario": "declarationDir: specify declarationDir with bundled output file", + "projectRoot": "tests/cases/projects/declarationDir", + "inputFiles": [ + "a.ts", + "subfolder/b.ts", + "subfolder/c.ts" + ], + "out": "out.js", + "declaration": true, + "declarationDir": "declarations", + "baselineCheck": true +} \ No newline at end of file diff --git a/tests/cases/projects/declarationDir/a.ts b/tests/cases/projects/declarationDir/a.ts new file mode 100644 index 00000000000..1b2c4286dc1 --- /dev/null +++ b/tests/cases/projects/declarationDir/a.ts @@ -0,0 +1,4 @@ +import {B} from './subfolder/b'; +export class A { + b: B; +} \ No newline at end of file diff --git a/tests/cases/projects/declarationDir/subfolder/b.ts b/tests/cases/projects/declarationDir/subfolder/b.ts new file mode 100644 index 00000000000..d87c6898050 --- /dev/null +++ b/tests/cases/projects/declarationDir/subfolder/b.ts @@ -0,0 +1,3 @@ +export class B { + +} \ No newline at end of file diff --git a/tests/cases/projects/declarationDir/subfolder/c.ts b/tests/cases/projects/declarationDir/subfolder/c.ts new file mode 100644 index 00000000000..17b540b0346 --- /dev/null +++ b/tests/cases/projects/declarationDir/subfolder/c.ts @@ -0,0 +1,5 @@ +import {A} from '../a'; + +export class C { + a: A; +} \ No newline at end of file diff --git a/tests/cases/unittests/cachingInServerLSHost.ts b/tests/cases/unittests/cachingInServerLSHost.ts index 0d2a9ebf54d..d227f61eb94 100644 --- a/tests/cases/unittests/cachingInServerLSHost.ts +++ b/tests/cases/unittests/cachingInServerLSHost.ts @@ -1,12 +1,22 @@ /// -module ts { +namespace ts { interface File { name: string; content: string; } - function createDefaultServerHost(fileMap: Map): server.ServerHost { + function createDefaultServerHost(fileMap: Map): server.ServerHost { + let existingDirectories: Map = {}; + forEachValue(fileMap, v => { + let dir = getDirectoryPath(v.name); + let previous: string; + do { + existingDirectories[dir] = true; + previous = dir; + dir = getDirectoryPath(dir); + } while (dir !== previous); + }); return { args: [], newLine: "\r\n", @@ -26,7 +36,7 @@ module ts { return hasProperty(fileMap, path); }, directoryExists: (path: string): boolean => { - throw new Error("NYI"); + return hasProperty(existingDirectories, path); }, createDirectory: (path: string) => { }, @@ -44,13 +54,15 @@ module ts { watchFile: (path, callback) => { return { close: () => { } - } + }; }, watchDirectory: (path, callback, recursive?) => { return { close: () => { } - } - } + }; + }, + setTimeout, + clearTimeout }; } @@ -69,7 +81,7 @@ module ts { let projectService = new server.ProjectService(serverHost, logger); let rootScriptInfo = projectService.openFile(rootFile, /* openedByClient */true); let project = projectService.createInferredProject(rootScriptInfo); - project.setProjectOptions( {files: [rootScriptInfo.fileName], compilerOptions: {module: ts.ModuleKind.AMD} } ); + project.setProjectOptions( {files: [rootScriptInfo.fileName], compilerOptions: {module: ts.ModuleKind.AMD} } ); return { project, rootScriptInfo @@ -118,8 +130,8 @@ module ts { return false; } fileExistsIsCalled = true; - assert.isTrue(fileName.indexOf('/f2.') !== -1); - return originalFileExists(fileName); + assert.isTrue(fileName.indexOf("/f2.") !== -1); + return originalFileExists.call(serverHost, fileName); }; let newContent = `import {x} from "f2"`; rootScriptInfo.editContent(0, rootScriptInfo.content.length, newContent); @@ -127,12 +139,12 @@ module ts { try { // trigger synchronization to make sure that LSHost will try to find 'f2' module on disk project.compilerService.languageService.getSemanticDiagnostics(imported.name); - assert.isTrue(false, `should not find file '${imported.name}'`) + assert.isTrue(false, `should not find file '${imported.name}'`); } - catch(e) { + catch (e) { assert.isTrue(e.message.indexOf(`Could not find file: '${imported.name}'.`) === 0); } - + assert.isTrue(fileExistsIsCalled); } { @@ -142,8 +154,8 @@ module ts { return false; } fileExistsCalled = true; - assert.isTrue(fileName.indexOf('/f1.') !== -1); - return originalFileExists(fileName); + assert.isTrue(fileName.indexOf("/f1.") !== -1); + return originalFileExists.call(serverHost, fileName); }; let newContent = `import {x} from "f1"`; @@ -166,12 +178,12 @@ module ts { it("loads missing files from disk", () => { let root: File = { - name: 'c:/foo.ts', + name: `c:/foo.ts`, content: `import {x} from "bar"` }; let imported: File = { - name: 'c:/bar.d.ts', + name: `c:/bar.d.ts`, content: `export var y = 1` }; @@ -188,7 +200,7 @@ module ts { fileExistsCalledForBar = fileName.indexOf("/bar.") !== -1; } - return originalFileExists(fileName); + return originalFileExists.call(serverHost, fileName); }; let { project, rootScriptInfo } = createProject(root.name, serverHost); @@ -201,11 +213,11 @@ module ts { // assert that import will success once file appear on disk fileMap[imported.name] = imported; fileExistsCalledForBar = false; - rootScriptInfo.editContent(0, rootScriptInfo.content.length, `import {y} from "bar"`) + rootScriptInfo.editContent(0, rootScriptInfo.content.length, `import {y} from "bar"`); diags = project.compilerService.languageService.getSemanticDiagnostics(root.name); assert.isTrue(fileExistsCalledForBar, "'fileExists' should be called"); assert.isTrue(diags.length === 0); - }) + }); }); } \ No newline at end of file diff --git a/tests/cases/unittests/commandLineParsing.ts b/tests/cases/unittests/commandLineParsing.ts new file mode 100644 index 00000000000..c59f6a4d78c --- /dev/null +++ b/tests/cases/unittests/commandLineParsing.ts @@ -0,0 +1,316 @@ +/// +/// + +namespace ts { + describe('parseCommandLine', () => { + + function assertParseResult(commandLine: string[], expectedParsedCommandLine: ts.ParsedCommandLine) { + const parsed = ts.parseCommandLine(commandLine); + const parsedCompilerOptions = JSON.stringify(parsed.options); + const expectedCompilerOptions = JSON.stringify(expectedParsedCommandLine.options); + assert.equal(parsedCompilerOptions, expectedCompilerOptions); + + const parsedErrors = parsed.errors; + const expectedErrors = expectedParsedCommandLine.errors; + assert.isTrue(parsedErrors.length === expectedErrors.length, `Expected error: ${JSON.stringify(expectedErrors)}. Actual error: ${JSON.stringify(parsedErrors)}.`); + for (let i = 0; i < parsedErrors.length; ++i) { + const parsedError = parsedErrors[i]; + const expectedError = expectedErrors[i]; + assert.equal(parsedError.code, expectedError.code); + assert.equal(parsedError.category, expectedError.category); + assert.equal(parsedError.messageText, expectedError.messageText); + } + + const parsedFileNames = parsed.fileNames; + const expectedFileNames = expectedParsedCommandLine.fileNames; + assert.isTrue(parsedFileNames.length === expectedFileNames.length, `Expected fileNames: [${JSON.stringify(expectedFileNames)}]. Actual fileNames: [${JSON.stringify(parsedFileNames)}].`); + for (let i = 0; i < parsedFileNames.length; ++i) { + const parsedFileName = parsedFileNames[i]; + const expectedFileName = expectedFileNames[i]; + assert.equal(parsedFileName, expectedFileName); + } + } + + it("Parse single option of library flag ", () => { + // --lib es6 0.ts + assertParseResult(["--lib", "es6", "0.ts"], + { + errors: [], + fileNames: ["0.ts"], + options: { + lib: ["lib.es2015.d.ts"] + } + }); + }); + + it("Parse multiple options of library flags ", () => { + // --lib es5,es2015.symbol.wellknown 0.ts + assertParseResult(["--lib", "es5,es2015.symbol.wellknown", "0.ts"], + { + errors: [], + fileNames: ["0.ts"], + options: { + lib: ["lib.es5.d.ts", "lib.es2015.symbol.wellknown.d.ts"] + } + }); + }); + + it("Parse invalid option of library flags ", () => { + // --lib es5,invalidOption 0.ts + assertParseResult(["--lib", "es5,invalidOption", "0.ts"], + { + errors: [{ + messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'dom', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object'", + category: ts.Diagnostics.Argument_for_0_option_must_be_Colon_1.category, + code: ts.Diagnostics.Argument_for_0_option_must_be_Colon_1.code, + + file: undefined, + start: undefined, + length: undefined, + }], + fileNames: ["0.ts"], + options: { + lib: ["lib.es5.d.ts"] + } + }); + }); + it("Parse empty options of --jsx ", () => { + // 0.ts --jsx + assertParseResult(["0.ts", "--jsx"], + { + errors: [{ + messageText: "Compiler option 'jsx' expects an argument.", + category: ts.Diagnostics.Compiler_option_0_expects_an_argument.category, + code: ts.Diagnostics.Compiler_option_0_expects_an_argument.code, + + file: undefined, + start: undefined, + length: undefined, + }, { + messageText: "Argument for '--jsx' option must be: 'preserve', 'react'", + category: ts.Diagnostics.Argument_for_0_option_must_be_Colon_1.category, + code: ts.Diagnostics.Argument_for_0_option_must_be_Colon_1.code, + + file: undefined, + start: undefined, + length: undefined, + }], + fileNames: ["0.ts"], + options: {} + }); + }); + + it("Parse empty options of --module ", () => { + // 0.ts -- + assertParseResult(["0.ts", "--module"], + { + errors: [{ + messageText: "Compiler option 'module' expects an argument.", + category: ts.Diagnostics.Compiler_option_0_expects_an_argument.category, + code: ts.Diagnostics.Compiler_option_0_expects_an_argument.code, + + file: undefined, + start: undefined, + length: undefined, + }, { + messageText: "Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015'", + category: ts.Diagnostics.Argument_for_0_option_must_be_Colon_1.category, + code: ts.Diagnostics.Argument_for_0_option_must_be_Colon_1.code, + + file: undefined, + start: undefined, + length: undefined, + }], + fileNames: ["0.ts"], + options: {} + }); + }); + + it("Parse empty options of --newLine ", () => { + // 0.ts --newLine + assertParseResult(["0.ts", "--newLine"], + { + errors: [{ + messageText: "Compiler option 'newLine' expects an argument.", + category: ts.Diagnostics.Compiler_option_0_expects_an_argument.category, + code: ts.Diagnostics.Compiler_option_0_expects_an_argument.code, + + file: undefined, + start: undefined, + length: undefined, + }, { + messageText: "Argument for '--newLine' option must be: 'crlf', 'lf'", + category: ts.Diagnostics.Argument_for_0_option_must_be_Colon_1.category, + code: ts.Diagnostics.Argument_for_0_option_must_be_Colon_1.code, + + file: undefined, + start: undefined, + length: undefined, + }], + fileNames: ["0.ts"], + options: {} + }); + }); + + it("Parse empty options of --target ", () => { + // 0.ts --target + assertParseResult(["0.ts", "--target"], + { + errors: [{ + messageText: "Compiler option 'target' expects an argument.", + category: ts.Diagnostics.Compiler_option_0_expects_an_argument.category, + code: ts.Diagnostics.Compiler_option_0_expects_an_argument.code, + + file: undefined, + start: undefined, + length: undefined, + }, { + messageText: "Argument for '--target' option must be: 'es3', 'es5', 'es6', 'es2015'", + category: ts.Diagnostics.Argument_for_0_option_must_be_Colon_1.category, + code: ts.Diagnostics.Argument_for_0_option_must_be_Colon_1.code, + + file: undefined, + start: undefined, + length: undefined, + }], + fileNames: ["0.ts"], + options: {} + }); + }); + + it("Parse empty options of --moduleResolution ", () => { + // 0.ts --moduleResolution + assertParseResult(["0.ts", "--moduleResolution"], + { + errors: [{ + messageText: "Compiler option 'moduleResolution' expects an argument.", + category: ts.Diagnostics.Compiler_option_0_expects_an_argument.category, + code: ts.Diagnostics.Compiler_option_0_expects_an_argument.code, + + file: undefined, + start: undefined, + length: undefined, + }, { + messageText: "Argument for '--moduleResolution' option must be: 'node', 'classic'", + category: ts.Diagnostics.Argument_for_0_option_must_be_Colon_1.category, + code: ts.Diagnostics.Argument_for_0_option_must_be_Colon_1.code, + + file: undefined, + start: undefined, + length: undefined, + }], + fileNames: ["0.ts"], + options: {} + }); + }); + + it("Parse empty options of --lib ", () => { + // 0.ts --lib + assertParseResult(["0.ts", "--lib"], + { + errors: [{ + messageText: "Compiler option 'lib' expects an argument.", + category: ts.Diagnostics.Compiler_option_0_expects_an_argument.category, + code: ts.Diagnostics.Compiler_option_0_expects_an_argument.code, + + file: undefined, + start: undefined, + length: undefined, + }, { + messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'dom', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object'", + category: ts.Diagnostics.Argument_for_0_option_must_be_Colon_1.category, + code: ts.Diagnostics.Argument_for_0_option_must_be_Colon_1.code, + + file: undefined, + start: undefined, + length: undefined, + }], + fileNames: ["0.ts"], + options: { + lib: [] + } + }); + }); + + it("Parse --lib option with extra comma ", () => { + // --lib es5, es7 0.ts + assertParseResult(["--lib", "es5,", "es7", "0.ts"], + { + errors: [{ + messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'dom', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object'", + category: ts.Diagnostics.Argument_for_0_option_must_be_Colon_1.category, + code: ts.Diagnostics.Argument_for_0_option_must_be_Colon_1.code, + + file: undefined, + start: undefined, + length: undefined, + }], + fileNames: ["es7", "0.ts"], + options: { + lib: ["lib.es5.d.ts"] + } + }); + }); + + it("Parse --lib option with trailing white-space ", () => { + // --lib es5, es7 0.ts + assertParseResult(["--lib", "es5, ", "es7", "0.ts"], + { + errors: [{ + messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'dom', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object'", + category: ts.Diagnostics.Argument_for_0_option_must_be_Colon_1.category, + code: ts.Diagnostics.Argument_for_0_option_must_be_Colon_1.code, + + file: undefined, + start: undefined, + length: undefined, + }], + fileNames: ["es7", "0.ts"], + options: { + lib: ["lib.es5.d.ts"] + } + }); + }); + + it("Parse multiple compiler flags with input files at the end", () => { + // --lib es5,es2015.symbol.wellknown --target es5 0.ts + assertParseResult(["--lib", "es5,es2015.symbol.wellknown", "--target", "es5", "0.ts"], + { + errors: [], + fileNames: ["0.ts"], + options: { + lib: ["lib.es5.d.ts", "lib.es2015.symbol.wellknown.d.ts"], + target: ts.ScriptTarget.ES5, + } + }); + }); + + it("Parse multiple compiler flags with input files in the middle", () => { + // --module commonjs --target es5 0.ts --lib es5,es2015.symbol.wellknown + assertParseResult(["--module", "commonjs", "--target", "es5", "0.ts", "--lib", "es5,es2015.symbol.wellknown"], + { + errors: [], + fileNames: ["0.ts"], + options: { + module: ts.ModuleKind.CommonJS, + target: ts.ScriptTarget.ES5, + lib: ["lib.es5.d.ts", "lib.es2015.symbol.wellknown.d.ts"], + } + }); + }); + + it("Parse multiple library compiler flags ", () => { + // --module commonjs --target es5 --lib es5 0.ts --library es2015.array,es2015.symbol.wellknown + assertParseResult(["--module", "commonjs", "--target", "es5", "--lib", "es5", "0.ts", "--lib", "es2015.core, es2015.symbol.wellknown "], + { + errors: [], + fileNames: ["0.ts"], + options: { + module: ts.ModuleKind.CommonJS, + target: ts.ScriptTarget.ES5, + lib: ["lib.es2015.core.d.ts", "lib.es2015.symbol.wellknown.d.ts"], + } + }); + }); + }); +} diff --git a/tests/cases/unittests/convertCompilerOptionsFromJson.ts b/tests/cases/unittests/convertCompilerOptionsFromJson.ts new file mode 100644 index 00000000000..b48d4ac451b --- /dev/null +++ b/tests/cases/unittests/convertCompilerOptionsFromJson.ts @@ -0,0 +1,479 @@ +/// +/// + +namespace ts { + describe('convertCompilerOptionsFromJson', () => { + function assertCompilerOptions(json: any, configFileName: string, expectedResult: { compilerOptions: CompilerOptions, errors: Diagnostic[] }) { + const { options: actualCompilerOptions, errors: actualErrors} = convertCompilerOptionsFromJson(json["compilerOptions"], "/apath/", configFileName); + + const parsedCompilerOptions = JSON.stringify(actualCompilerOptions); + const expectedCompilerOptions = JSON.stringify(expectedResult.compilerOptions); + assert.equal(parsedCompilerOptions, expectedCompilerOptions); + + const expectedErrors = expectedResult.errors; + assert.isTrue(expectedResult.errors.length === actualErrors.length, `Expected error: ${JSON.stringify(expectedResult.errors)}. Actual error: ${JSON.stringify(actualErrors)}.`); + for (let i = 0; i < actualErrors.length; ++i) { + const actualError = actualErrors[i]; + const expectedError = expectedErrors[i]; + assert.equal(actualError.code, expectedError.code); + assert.equal(actualError.category, expectedError.category); + assert.equal(actualError.messageText, expectedError.messageText); + } + } + + // tsconfig.json tests + it("Convert correctly format tsconfig.json to compiler-options ", () => { + assertCompilerOptions( + { + "compilerOptions": { + "module": "commonjs", + "target": "es5", + "noImplicitAny": false, + "sourceMap": false, + "lib": ["es5", "es2015.core", "es2015.symbol"] + } + }, "tsconfig.json", + { + compilerOptions: { + module: ModuleKind.CommonJS, + target: ScriptTarget.ES5, + noImplicitAny: false, + sourceMap: false, + lib: ["lib.es5.d.ts", "lib.es2015.core.d.ts", "lib.es2015.symbol.d.ts"] + }, + errors: [] + } + ); + }); + + it("Convert correctly format tsconfig.json with allowJs is false to compiler-options ", () => { + assertCompilerOptions( + { + "compilerOptions": { + "module": "commonjs", + "target": "es5", + "noImplicitAny": false, + "sourceMap": false, + "allowJs": false, + "lib": ["es5", "es2015.core", "es2015.symbol"] + } + }, "tsconfig.json", + { + compilerOptions: { + module: ModuleKind.CommonJS, + target: ScriptTarget.ES5, + noImplicitAny: false, + sourceMap: false, + allowJs: false, + lib: ["lib.es5.d.ts", "lib.es2015.core.d.ts", "lib.es2015.symbol.d.ts"] + }, + errors: [] + } + ); + }); + + it("Convert incorrect option of jsx to compiler-options ", () => { + assertCompilerOptions( + { + "compilerOptions": { + "module": "commonjs", + "target": "es5", + "noImplicitAny": false, + "sourceMap": false, + "jsx": "" + } + }, "tsconfig.json", + { + compilerOptions: { + module: ModuleKind.CommonJS, + target: ScriptTarget.ES5, + noImplicitAny: false, + sourceMap: false, + }, + errors: [{ + file: undefined, + start: 0, + length: 0, + messageText: "Argument for '--jsx' option must be: 'preserve', 'react'", + code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code, + category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category + }] + } + ); + }); + + it("Convert incorrect option of module to compiler-options ", () => { + assertCompilerOptions( + { + "compilerOptions": { + "module": "", + "target": "es5", + "noImplicitAny": false, + "sourceMap": false, + } + }, "tsconfig.json", + { + compilerOptions: { + target: ScriptTarget.ES5, + noImplicitAny: false, + sourceMap: false, + }, + errors: [{ + file: undefined, + start: 0, + length: 0, + messageText: "Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015'", + code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code, + category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category + }] + } + ); + }); + + it("Convert incorrect option of newLine to compiler-options ", () => { + assertCompilerOptions( + { + "compilerOptions": { + "newLine": "", + "target": "es5", + "noImplicitAny": false, + "sourceMap": false, + } + }, "tsconfig.json", + { + compilerOptions: { + target: ScriptTarget.ES5, + noImplicitAny: false, + sourceMap: false, + }, + errors: [{ + file: undefined, + start: 0, + length: 0, + messageText: "Argument for '--newLine' option must be: 'crlf', 'lf'", + code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code, + category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category + }] + } + ); + }); + + it("Convert incorrect option of target to compiler-options ", () => { + assertCompilerOptions( + { + "compilerOptions": { + "target": "", + "noImplicitAny": false, + "sourceMap": false, + } + }, "tsconfig.json", + { + compilerOptions: { + noImplicitAny: false, + sourceMap: false, + }, + errors: [{ + file: undefined, + start: 0, + length: 0, + messageText: "Argument for '--target' option must be: 'es3', 'es5', 'es6', 'es2015'", + code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code, + category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category + }] + } + ); + }); + + it("Convert incorrect option of module-resolution to compiler-options ", () => { + assertCompilerOptions( + { + "compilerOptions": { + "moduleResolution": "", + "noImplicitAny": false, + "sourceMap": false, + } + }, "tsconfig.json", + { + compilerOptions: { + noImplicitAny: false, + sourceMap: false, + }, + errors: [{ + file: undefined, + start: 0, + length: 0, + messageText: "Argument for '--moduleResolution' option must be: 'node', 'classic'", + code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code, + category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category + }] + } + ); + }); + + it("Convert incorrect option of libs to compiler-options ", () => { + assertCompilerOptions( + { + "compilerOptions": { + "module": "commonjs", + "target": "es5", + "noImplicitAny": false, + "sourceMap": false, + "lib": ["es5", "es2015.core", "incorrectLib"] + } + }, "tsconfig.json", + { + compilerOptions: { + module: ModuleKind.CommonJS, + target: ScriptTarget.ES5, + noImplicitAny: false, + sourceMap: false, + lib: ["lib.es5.d.ts", "lib.es2015.core.d.ts"] + }, + errors: [{ + file: undefined, + start: 0, + length: 0, + messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'dom', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object'", + code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code, + category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category + }] + } + ); + }); + + it("Convert empty string option of libs to compiler-options ", () => { + assertCompilerOptions( + { + "compilerOptions": { + "module": "commonjs", + "target": "es5", + "noImplicitAny": false, + "sourceMap": false, + "lib": ["es5", ""] + } + }, "tsconfig.json", + { + compilerOptions: { + module: ModuleKind.CommonJS, + target: ScriptTarget.ES5, + noImplicitAny: false, + sourceMap: false, + lib: ["lib.es5.d.ts"] + }, + errors: [{ + file: undefined, + start: 0, + length: 0, + messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'dom', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object'", + code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code, + category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category + }] + } + ); + }); + + it("Convert empty string option of libs to compiler-options ", () => { + assertCompilerOptions( + { + "compilerOptions": { + "module": "commonjs", + "target": "es5", + "noImplicitAny": false, + "sourceMap": false, + "lib": [""] + } + }, "tsconfig.json", + { + compilerOptions: { + module: ModuleKind.CommonJS, + target: ScriptTarget.ES5, + noImplicitAny: false, + sourceMap: false, + lib: [] + }, + errors: [{ + file: undefined, + start: 0, + length: 0, + messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'dom', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object'", + code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code, + category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category + }] + } + ); + }); + + it("Convert trailing-whitespace string option of libs to compiler-options ", () => { + assertCompilerOptions( + { + "compilerOptions": { + "module": "commonjs", + "target": "es5", + "noImplicitAny": false, + "sourceMap": false, + "lib": [" "] + } + }, "tsconfig.json", + { + compilerOptions: { + module: ModuleKind.CommonJS, + target: ScriptTarget.ES5, + noImplicitAny: false, + sourceMap: false, + lib: [] + }, + errors: [{ + file: undefined, + start: 0, + length: 0, + messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'dom', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object'", + code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code, + category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category + }] + } + ); + }); + + it("Convert empty option of libs to compiler-options ", () => { + assertCompilerOptions( + { + "compilerOptions": { + "module": "commonjs", + "target": "es5", + "noImplicitAny": false, + "sourceMap": false, + "lib": [] + } + }, "tsconfig.json", + { + compilerOptions: { + module: ModuleKind.CommonJS, + target: ScriptTarget.ES5, + noImplicitAny: false, + sourceMap: false, + lib: [] + }, + errors: [] + } + ); + }); + + it("Convert incorrectly format tsconfig.json to compiler-options ", () => { + assertCompilerOptions( + { + "compilerOptions": { + "modu": "commonjs", + } + }, "tsconfig.json", + { + compilerOptions: {}, + errors: [{ + file: undefined, + start: 0, + length: 0, + messageText: "Unknown compiler option 'modu'.", + code: Diagnostics.Unknown_compiler_option_0.code, + category: Diagnostics.Unknown_compiler_option_0.category + }] + } + ); + }); + + it("Convert default tsconfig.json to compiler-options ", () => { + assertCompilerOptions({}, "tsconfig.json", + { + compilerOptions: {} as CompilerOptions, + errors: [] + } + ); + }); + + // jsconfig.json + it("Convert correctly format jsconfig.json to compiler-options ", () => { + assertCompilerOptions( + { + "compilerOptions": { + "module": "commonjs", + "target": "es5", + "noImplicitAny": false, + "sourceMap": false, + "lib": ["es5", "es2015.core", "es2015.symbol"] + } + }, "jsconfig.json", + { + compilerOptions: { + allowJs: true, + module: ModuleKind.CommonJS, + target: ScriptTarget.ES5, + noImplicitAny: false, + sourceMap: false, + lib: ["lib.es5.d.ts", "lib.es2015.core.d.ts", "lib.es2015.symbol.d.ts"] + }, + errors: [] + } + ); + }); + + it("Convert correctly format jsconfig.json with allowJs is false to compiler-options ", () => { + assertCompilerOptions( + { + "compilerOptions": { + "module": "commonjs", + "target": "es5", + "noImplicitAny": false, + "sourceMap": false, + "allowJs": false, + "lib": ["es5", "es2015.core", "es2015.symbol"] + } + }, "jsconfig.json", + { + compilerOptions: { + allowJs: false, + module: ModuleKind.CommonJS, + target: ScriptTarget.ES5, + noImplicitAny: false, + sourceMap: false, + lib: ["lib.es5.d.ts", "lib.es2015.core.d.ts", "lib.es2015.symbol.d.ts"] + }, + errors: [] + } + ); + }); + + it("Convert incorrectly format jsconfig.json to compiler-options ", () => { + assertCompilerOptions( + { + "compilerOptions": { + "modu": "commonjs", + } + }, "jsconfig.json", + { + compilerOptions: + { + allowJs: true + }, + errors: [{ + file: undefined, + start: 0, + length: 0, + messageText: "Unknown compiler option 'modu'.", + code: Diagnostics.Unknown_compiler_option_0.code, + category: Diagnostics.Unknown_compiler_option_0.category + }] + } + ); + }); + + it("Convert default jsconfig.json to compiler-options ", () => { + assertCompilerOptions({}, "jsconfig.json", + { + compilerOptions: + { + allowJs: true + }, + errors: [] + } + ); + }); + }); +} diff --git a/tests/cases/unittests/convertToBase64.ts b/tests/cases/unittests/convertToBase64.ts index 76f56f77477..c73d7531c40 100644 --- a/tests/cases/unittests/convertToBase64.ts +++ b/tests/cases/unittests/convertToBase64.ts @@ -8,26 +8,28 @@ module ts { assert.equal(actual, expected, "Encoded string using convertToBase64 does not match buffer.toString('base64')"); } - it("Converts ASCII charaters correctly", () => { - runTest(" !\"#$ %&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"); - }); + if (Buffer) { + it("Converts ASCII charaters correctly", () => { + runTest(" !\"#$ %&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"); + }); - it("Converts escape sequences correctly", () => { - runTest("\t\n\r\\\"\'\u0062"); - }); + it("Converts escape sequences correctly", () => { + runTest("\t\n\r\\\"\'\u0062"); + }); - it("Converts simple unicode characters correctly", () => { - runTest("ΠΣ ٵپ औठ ⺐⺠"); - }); + it("Converts simple unicode characters correctly", () => { + runTest("ΠΣ ٵپ औठ ⺐⺠"); + }); - it("Converts simple code snippet correctly", () => { - runTest(`/// + it("Converts simple code snippet correctly", () => { + runTest(`/// var x: string = "string"; console.log(x);`); - }); + }); - it("Converts simple code snippet with unicode characters correctly", () => { - runTest(`var Π = 3.1415; console.log(Π);`); - }); + it("Converts simple code snippet with unicode characters correctly", () => { + runTest(`var Π = 3.1415; console.log(Π);`); + }); + } }); } diff --git a/tests/cases/unittests/convertTypingOptionsFromJson.ts b/tests/cases/unittests/convertTypingOptionsFromJson.ts new file mode 100644 index 00000000000..3cd15a17c61 --- /dev/null +++ b/tests/cases/unittests/convertTypingOptionsFromJson.ts @@ -0,0 +1,187 @@ +/// +/// + +namespace ts { + describe('convertTypingOptionsFromJson', () => { + function assertTypingOptions(json: any, configFileName: string, expectedResult: { typingOptions: TypingOptions, errors: Diagnostic[] }) { + const { options: actualTypingOptions, errors: actualErrors } = convertTypingOptionsFromJson(json["typingOptions"], "/apath/", configFileName); + const parsedTypingOptions = JSON.stringify(actualTypingOptions); + const expectedTypingOptions = JSON.stringify(expectedResult.typingOptions); + assert.equal(parsedTypingOptions, expectedTypingOptions); + + const expectedErrors = expectedResult.errors; + assert.isTrue(expectedResult.errors.length === actualErrors.length, `Expected error: ${JSON.stringify(expectedResult.errors)}. Actual error: ${JSON.stringify(actualErrors)}.`); + for (let i = 0; i < actualErrors.length; ++i) { + const actualError = actualErrors[i]; + const expectedError = expectedErrors[i]; + assert.equal(actualError.code, expectedError.code, `Expected error-code: ${JSON.stringify(expectedError.code)}. Actual error-code: ${JSON.stringify(actualError.code)}.`); + assert.equal(actualError.category, expectedError.category, `Expected error-category: ${JSON.stringify(expectedError.category)}. Actual error-category: ${JSON.stringify(actualError.category)}.`); + } + } + + // tsconfig.json + it("Convert correctly format tsconfig.json to typing-options ", () => { + assertTypingOptions( + { + "typingOptions": + { + "enableAutoDiscovery": true, + "include": ["0.d.ts", "1.d.ts"], + "exclude": ["0.js", "1.js"] + } + }, + "tsconfig.json", + { + typingOptions: + { + enableAutoDiscovery: true, + include: ["0.d.ts", "1.d.ts"], + exclude: ["0.js", "1.js"] + }, + errors: [] + }); + }); + + it("Convert incorrect format tsconfig.json to typing-options ", () => { + assertTypingOptions( + { + "typingOptions": + { + "enableAutoDiscovy": true, + } + }, "tsconfig.json", + { + typingOptions: + { + enableAutoDiscovery: false, + include: [], + exclude: [] + }, + errors: [ + { + category: Diagnostics.Unknown_typing_option_0.category, + code: Diagnostics.Unknown_typing_option_0.code, + file: undefined, + start: 0, + length: 0, + messageText: undefined + } + ] + }); + }); + + it("Convert default tsconfig.json to typing-options ", () => { + assertTypingOptions({}, "tsconfig.json", + { + typingOptions: + { + enableAutoDiscovery: false, + include: [], + exclude: [] + }, + errors: [] + }); + }); + + it("Convert tsconfig.json with only enableAutoDiscovery property to typing-options ", () => { + assertTypingOptions( + { + "typingOptions": + { + "enableAutoDiscovery": true + } + }, "tsconfig.json", + { + typingOptions: + { + enableAutoDiscovery: true, + include: [], + exclude: [] + }, + errors: [] + }); + }); + + // jsconfig.json + it("Convert jsconfig.json to typing-options ", () => { + assertTypingOptions( + { + "typingOptions": + { + "enableAutoDiscovery": false, + "include": ["0.d.ts"], + "exclude": ["0.js"] + } + }, "jsconfig.json", + { + typingOptions: + { + enableAutoDiscovery: false, + include: ["0.d.ts"], + exclude: ["0.js"] + }, + errors: [] + }); + }); + + it("Convert default jsconfig.json to typing-options ", () => { + assertTypingOptions({ }, "jsconfig.json", + { + typingOptions: + { + enableAutoDiscovery: true, + include: [], + exclude: [] + }, + errors: [] + }); + }); + + it("Convert incorrect format jsconfig.json to typing-options ", () => { + assertTypingOptions( + { + "typingOptions": + { + "enableAutoDiscovy": true, + } + }, "jsconfig.json", + { + typingOptions: + { + enableAutoDiscovery: true, + include: [], + exclude: [] + }, + errors: [ + { + category: Diagnostics.Unknown_compiler_option_0.category, + code: Diagnostics.Unknown_typing_option_0.code, + file: undefined, + start: 0, + length: 0, + messageText: undefined + } + ] + }); + }); + + it("Convert jsconfig.json with only enableAutoDiscovery property to typing-options ", () => { + assertTypingOptions( + { + "typingOptions": + { + "enableAutoDiscovery": false + } + }, "jsconfig.json", + { + typingOptions: + { + enableAutoDiscovery: false, + include: [], + exclude: [] + }, + errors: [] + }); + }); + }); +} diff --git a/tests/cases/unittests/jsDocParsing.ts b/tests/cases/unittests/jsDocParsing.ts index ebba6e8a1a6..1bd7b1147ca 100644 --- a/tests/cases/unittests/jsDocParsing.ts +++ b/tests/cases/unittests/jsDocParsing.ts @@ -1,4 +1,5 @@ /// +/// /// /// @@ -10,6 +11,7 @@ module ts { assert.isTrue(typeAndDiagnostics && typeAndDiagnostics.diagnostics.length === 0); let result = Utils.sourceFileToJSON(typeAndDiagnostics.jsDocTypeExpression.type); + assert.equal(result, expected); } @@ -791,6 +793,7 @@ module ts { "kind": "Identifier", "pos": 1, "end": 10, + "originalKeywordKind": "UndefinedKeyword", "text": "undefined" } }`); @@ -985,15 +988,29 @@ module ts { describe("DocComments", () => { function parsesCorrectly(content: string, expected: string) { let comment = parseIsolatedJSDocComment(content); - Debug.assert(comment && comment.diagnostics.length === 0); + if (!comment) { + Debug.fail('Comment failed to parse entirely'); + } + if (comment.diagnostics.length > 0) { + Debug.fail('Comment has at least one diagnostic: ' + comment.diagnostics[0].messageText); + } let result = JSON.stringify(comment.jsDocComment, (k, v) => { return v && v.pos !== undefined ? JSON.parse(Utils.sourceFileToJSON(v)) : v; - }, " "); - - assert.equal(result, expected); + }, 4); + + if (result !== expected) { + // Turn on a human-readable diff + if (typeof require !== 'undefined') { + require('chai').config.showDiff = true; + chai.expect(JSON.parse(result)).equal(JSON.parse(expected)); + } + else { + assert.equal(result, expected); + } + } } function parsesIncorrectly(content: string) { @@ -1577,7 +1594,7 @@ module ts { "0": { "kind": "JSDocParameterTag", "pos": 8, - "end": 30, + "end": 31, "atToken": { "kind": "AtToken", "pos": 8, @@ -1609,7 +1626,7 @@ module ts { }, "length": 1, "pos": 8, - "end": 30 + "end": 31 } }`); }); @@ -1627,7 +1644,7 @@ module ts { "0": { "kind": "JSDocParameterTag", "pos": 8, - "end": 31, + "end": 36, "atToken": { "kind": "AtToken", "pos": 8, @@ -1659,7 +1676,7 @@ module ts { }, "length": 1, "pos": 8, - "end": 31 + "end": 36 } }`); }); @@ -2113,7 +2130,7 @@ module ts { "0": { "kind": "JSDocTemplateTag", "pos": 8, - "end": 24, + "end": 23, "atToken": { "kind": "AtToken", "pos": 8, @@ -2150,12 +2167,12 @@ module ts { }, "length": 2, "pos": 17, - "end": 24 + "end": 23 } }, "length": 1, "pos": 8, - "end": 24 + "end": 23 } }`); }); diff --git a/tests/cases/unittests/matchFiles.ts b/tests/cases/unittests/matchFiles.ts index faccd31b88f..792bad51899 100644 --- a/tests/cases/unittests/matchFiles.ts +++ b/tests/cases/unittests/matchFiles.ts @@ -109,7 +109,9 @@ namespace ts { wildcardDirectories: {}, }; const actual = ts.parseJsonConfigFileContent(json, caseInsensitiveHost, caseInsensitiveBasePath); - assert.deepEqual(actual, expected); + assert.deepEqual(actual.fileNames, expected.fileNames); + assert.deepEqual(actual.wildcardDirectories, expected.wildcardDirectories); + assert.deepEqual(actual.errors, expected.errors); }); it("missing files are still present", () => { const json = { @@ -128,7 +130,9 @@ namespace ts { wildcardDirectories: {}, }; const actual = ts.parseJsonConfigFileContent(json, caseInsensitiveHost, caseInsensitiveBasePath); - assert.deepEqual(actual, expected); + assert.deepEqual(actual.fileNames, expected.fileNames); + assert.deepEqual(actual.wildcardDirectories, expected.wildcardDirectories); + assert.deepEqual(actual.errors, expected.errors); }); it("are not removed due to excludes", () => { const json = { @@ -150,7 +154,9 @@ namespace ts { wildcardDirectories: {}, }; const actual = ts.parseJsonConfigFileContent(json, caseInsensitiveHost, caseInsensitiveBasePath); - assert.deepEqual(actual, expected); + assert.deepEqual(actual.fileNames, expected.fileNames); + assert.deepEqual(actual.wildcardDirectories, expected.wildcardDirectories); + assert.deepEqual(actual.errors, expected.errors); }); }); @@ -172,7 +178,9 @@ namespace ts { wildcardDirectories: {}, }; const actual = ts.parseJsonConfigFileContent(json, caseInsensitiveHost, caseInsensitiveBasePath); - assert.deepEqual(actual, expected); + assert.deepEqual(actual.fileNames, expected.fileNames); + assert.deepEqual(actual.wildcardDirectories, expected.wildcardDirectories); + assert.deepEqual(actual.errors, expected.errors); }); it("with non .ts file extensions are excluded", () => { const json = { @@ -188,7 +196,9 @@ namespace ts { wildcardDirectories: {}, }; const actual = ts.parseJsonConfigFileContent(json, caseInsensitiveHost, caseInsensitiveBasePath); - assert.deepEqual(actual, expected); + assert.deepEqual(actual.fileNames, expected.fileNames); + assert.deepEqual(actual.wildcardDirectories, expected.wildcardDirectories); + assert.deepEqual(actual.errors, expected.errors); }); it("with missing files are excluded", () => { const json = { @@ -204,7 +214,9 @@ namespace ts { wildcardDirectories: {}, }; const actual = ts.parseJsonConfigFileContent(json, caseInsensitiveHost, caseInsensitiveBasePath); - assert.deepEqual(actual, expected); + assert.deepEqual(actual.fileNames, expected.fileNames); + assert.deepEqual(actual.wildcardDirectories, expected.wildcardDirectories); + assert.deepEqual(actual.errors, expected.errors); }); it("with literal excludes", () => { const json = { @@ -225,7 +237,9 @@ namespace ts { wildcardDirectories: {}, }; const actual = ts.parseJsonConfigFileContent(json, caseInsensitiveHost, caseInsensitiveBasePath); - assert.deepEqual(actual, expected); + assert.deepEqual(actual.fileNames, expected.fileNames); + assert.deepEqual(actual.wildcardDirectories, expected.wildcardDirectories); + assert.deepEqual(actual.errors, expected.errors); }); it("with wildcard excludes", () => { const json = { @@ -253,7 +267,9 @@ namespace ts { wildcardDirectories: {}, }; const actual = ts.parseJsonConfigFileContent(json, caseInsensitiveHost, caseInsensitiveBasePath); - assert.deepEqual(actual, expected); + assert.deepEqual(actual.fileNames, expected.fileNames); + assert.deepEqual(actual.wildcardDirectories, expected.wildcardDirectories); + assert.deepEqual(actual.errors, expected.errors); }); it("with recursive excludes", () => { const json = { @@ -280,7 +296,9 @@ namespace ts { wildcardDirectories: {}, }; const actual = ts.parseJsonConfigFileContent(json, caseInsensitiveHost, caseInsensitiveBasePath); - assert.deepEqual(actual, expected); + assert.deepEqual(actual.fileNames, expected.fileNames); + assert.deepEqual(actual.wildcardDirectories, expected.wildcardDirectories); + assert.deepEqual(actual.errors, expected.errors); }); it("with case sensitive exclude", () => { const json = { @@ -300,7 +318,9 @@ namespace ts { wildcardDirectories: {}, }; const actual = ts.parseJsonConfigFileContent(json, caseSensitiveHost, caseSensitiveBasePath); - assert.deepEqual(actual, expected); + assert.deepEqual(actual.fileNames, expected.fileNames); + assert.deepEqual(actual.wildcardDirectories, expected.wildcardDirectories); + assert.deepEqual(actual.errors, expected.errors); }); }); @@ -324,7 +344,9 @@ namespace ts { }, }; const actual = ts.parseJsonConfigFileContent(json, caseInsensitiveHost, caseInsensitiveBasePath); - assert.deepEqual(actual, expected); + assert.deepEqual(actual.fileNames, expected.fileNames); + assert.deepEqual(actual.wildcardDirectories, expected.wildcardDirectories); + assert.deepEqual(actual.errors, expected.errors); }); it("`*` matches only ts files", () => { const json = { @@ -345,7 +367,9 @@ namespace ts { }, }; const actual = ts.parseJsonConfigFileContent(json, caseInsensitiveHost, caseInsensitiveBasePath); - assert.deepEqual(actual, expected); + assert.deepEqual(actual.fileNames, expected.fileNames); + assert.deepEqual(actual.wildcardDirectories, expected.wildcardDirectories); + assert.deepEqual(actual.errors, expected.errors); }); it("`?` matches only a single character", () => { const json = { @@ -365,7 +389,9 @@ namespace ts { }, }; const actual = ts.parseJsonConfigFileContent(json, caseInsensitiveHost, caseInsensitiveBasePath); - assert.deepEqual(actual, expected); + assert.deepEqual(actual.fileNames, expected.fileNames); + assert.deepEqual(actual.wildcardDirectories, expected.wildcardDirectories); + assert.deepEqual(actual.errors, expected.errors); }); it("with recursive directory", () => { const json = { @@ -387,7 +413,9 @@ namespace ts { }, }; const actual = ts.parseJsonConfigFileContent(json, caseInsensitiveHost, caseInsensitiveBasePath); - assert.deepEqual(actual, expected); + assert.deepEqual(actual.fileNames, expected.fileNames); + assert.deepEqual(actual.wildcardDirectories, expected.wildcardDirectories); + assert.deepEqual(actual.errors, expected.errors); }); it("case sensitive", () => { const json = { @@ -406,7 +434,9 @@ namespace ts { }, }; const actual = ts.parseJsonConfigFileContent(json, caseSensitiveHost, caseSensitiveBasePath); - assert.deepEqual(actual, expected); + assert.deepEqual(actual.fileNames, expected.fileNames); + assert.deepEqual(actual.wildcardDirectories, expected.wildcardDirectories); + assert.deepEqual(actual.errors, expected.errors); }); it("with missing files are excluded", () => { const json = { @@ -423,7 +453,9 @@ namespace ts { }, }; const actual = ts.parseJsonConfigFileContent(json, caseInsensitiveHost, caseInsensitiveBasePath); - assert.deepEqual(actual, expected); + assert.deepEqual(actual.fileNames, expected.fileNames); + assert.deepEqual(actual.wildcardDirectories, expected.wildcardDirectories); + assert.deepEqual(actual.errors, expected.errors); }); it("always include literal files", () => { const json = { @@ -448,7 +480,9 @@ namespace ts { }, }; const actual = ts.parseJsonConfigFileContent(json, caseInsensitiveHost, caseInsensitiveBasePath); - assert.deepEqual(actual, expected); + assert.deepEqual(actual.fileNames, expected.fileNames); + assert.deepEqual(actual.wildcardDirectories, expected.wildcardDirectories); + assert.deepEqual(actual.errors, expected.errors); }); it("exclude folders", () => { const json = { @@ -473,7 +507,9 @@ namespace ts { } }; const actual = ts.parseJsonConfigFileContent(json, caseInsensitiveHost, caseInsensitiveBasePath); - assert.deepEqual(actual, expected); + assert.deepEqual(actual.fileNames, expected.fileNames); + assert.deepEqual(actual.wildcardDirectories, expected.wildcardDirectories); + assert.deepEqual(actual.errors, expected.errors); }); it("exclude .js files when allowJs=false", () => { const json = { @@ -495,7 +531,9 @@ namespace ts { } }; const actual = ts.parseJsonConfigFileContent(json, caseInsensitiveHost, caseInsensitiveBasePath); - assert.deepEqual(actual, expected); + assert.deepEqual(actual.fileNames, expected.fileNames); + assert.deepEqual(actual.wildcardDirectories, expected.wildcardDirectories); + assert.deepEqual(actual.errors, expected.errors); }); it("include .js files when allowJs=true", () => { const json = { @@ -520,7 +558,9 @@ namespace ts { } }; const actual = ts.parseJsonConfigFileContent(json, caseInsensitiveHost, caseInsensitiveBasePath); - assert.deepEqual(actual, expected); + assert.deepEqual(actual.fileNames, expected.fileNames); + assert.deepEqual(actual.wildcardDirectories, expected.wildcardDirectories); + assert.deepEqual(actual.errors, expected.errors); }); it("include paths outside of the project", () => { const json = { @@ -544,7 +584,9 @@ namespace ts { } }; const actual = ts.parseJsonConfigFileContent(json, caseInsensitiveHost, caseInsensitiveBasePath); - assert.deepEqual(actual, expected); + assert.deepEqual(actual.fileNames, expected.fileNames); + assert.deepEqual(actual.wildcardDirectories, expected.wildcardDirectories); + assert.deepEqual(actual.errors, expected.errors); }); it("with jsx=none, allowJs=false", () => { const json = { @@ -567,7 +609,9 @@ namespace ts { } }; const actual = ts.parseJsonConfigFileContent(json, caseInsensitiveMixedExtensionHost, caseInsensitiveBasePath); - assert.deepEqual(actual, expected); + assert.deepEqual(actual.fileNames, expected.fileNames); + assert.deepEqual(actual.wildcardDirectories, expected.wildcardDirectories); + assert.deepEqual(actual.errors, expected.errors); }); it("with jsx=preserve, allowJs=false", () => { const json = { @@ -592,7 +636,9 @@ namespace ts { } }; const actual = ts.parseJsonConfigFileContent(json, caseInsensitiveMixedExtensionHost, caseInsensitiveBasePath); - assert.deepEqual(actual, expected); + assert.deepEqual(actual.fileNames, expected.fileNames); + assert.deepEqual(actual.wildcardDirectories, expected.wildcardDirectories); + assert.deepEqual(actual.errors, expected.errors); }); it("with jsx=none, allowJs=true", () => { const json = { @@ -617,7 +663,9 @@ namespace ts { } }; const actual = ts.parseJsonConfigFileContent(json, caseInsensitiveMixedExtensionHost, caseInsensitiveBasePath); - assert.deepEqual(actual, expected); + assert.deepEqual(actual.fileNames, expected.fileNames); + assert.deepEqual(actual.wildcardDirectories, expected.wildcardDirectories); + assert.deepEqual(actual.errors, expected.errors); }); it("with jsx=preserve, allowJs=true", () => { const json = { @@ -644,7 +692,9 @@ namespace ts { } }; const actual = ts.parseJsonConfigFileContent(json, caseInsensitiveMixedExtensionHost, caseInsensitiveBasePath); - assert.deepEqual(actual, expected); + assert.deepEqual(actual.fileNames, expected.fileNames); + assert.deepEqual(actual.wildcardDirectories, expected.wildcardDirectories); + assert.deepEqual(actual.errors, expected.errors); }); describe("with trailing recursive directory", () => { it("in includes", () => { @@ -662,7 +712,9 @@ namespace ts { wildcardDirectories: {} }; const actual = ts.parseJsonConfigFileContent(json, caseInsensitiveHost, caseInsensitiveBasePath); - assert.deepEqual(actual, expected); + assert.deepEqual(actual.fileNames, expected.fileNames); + assert.deepEqual(actual.wildcardDirectories, expected.wildcardDirectories); + assert.deepEqual(actual.errors, expected.errors); }); it("in excludes", () => { const json = { @@ -680,7 +732,9 @@ namespace ts { wildcardDirectories: {} }; const actual = ts.parseJsonConfigFileContent(json, caseInsensitiveHost, caseInsensitiveBasePath); - assert.deepEqual(actual, expected); + assert.deepEqual(actual.fileNames, expected.fileNames); + assert.deepEqual(actual.wildcardDirectories, expected.wildcardDirectories); + assert.deepEqual(actual.errors, expected.errors); }); }); describe("with multiple recursive directory patterns", () => { @@ -699,7 +753,9 @@ namespace ts { wildcardDirectories: {} }; const actual = ts.parseJsonConfigFileContent(json, caseInsensitiveHost, caseInsensitiveBasePath); - assert.deepEqual(actual, expected); + assert.deepEqual(actual.fileNames, expected.fileNames); + assert.deepEqual(actual.wildcardDirectories, expected.wildcardDirectories); + assert.deepEqual(actual.errors, expected.errors); }); it("in excludes", () => { const json = { @@ -726,7 +782,9 @@ namespace ts { } }; const actual = ts.parseJsonConfigFileContent(json, caseInsensitiveHost, caseInsensitiveBasePath); - assert.deepEqual(actual, expected); + assert.deepEqual(actual.fileNames, expected.fileNames); + assert.deepEqual(actual.wildcardDirectories, expected.wildcardDirectories); + assert.deepEqual(actual.errors, expected.errors); }); }); }); diff --git a/tests/cases/unittests/moduleResolution.ts b/tests/cases/unittests/moduleResolution.ts index 5b924650401..29fde331892 100644 --- a/tests/cases/unittests/moduleResolution.ts +++ b/tests/cases/unittests/moduleResolution.ts @@ -26,15 +26,36 @@ module ts { content?: string } - function createModuleResolutionHost(...files: File[]): ModuleResolutionHost { + function createModuleResolutionHost(hasDirectoryExists: boolean, ...files: File[]): ModuleResolutionHost { let map = arrayToMap(files, f => f.name); - return { fileExists, readFile }; - - function fileExists(path: string): boolean { - return hasProperty(map, path); + if (hasDirectoryExists) { + const directories: Map = {}; + for (const f of files) { + let name = getDirectoryPath(f.name); + while (true) { + directories[name] = name; + let baseName = getDirectoryPath(name); + if (baseName === name) { + break; + } + name = baseName; + } + } + return { + readFile, + directoryExists: path => { + return hasProperty(directories, path); + }, + fileExists: path => { + assert.isTrue(hasProperty(directories, getDirectoryPath(path)), `'fileExists' '${path}' request in non-existing directory`); + return hasProperty(map, path); + } + } + } + else { + return { readFile, fileExists: path => hasProperty(map, path), }; } - function readFile(path: string): string { return hasProperty(map, path) ? map[path].content : undefined; } @@ -51,9 +72,14 @@ module ts { function testLoadAsFile(containingFileName: string, moduleFileNameNoExt: string, moduleName: string): void { for (let ext of supportedTypeScriptExtensions) { + test(ext, /*hasDirectoryExists*/ false); + test(ext, /*hasDirectoryExists*/ true); + } + + function test(ext: string, hasDirectoryExists: boolean) { let containingFile = { name: containingFileName } let moduleFile = { name: moduleFileNameNoExt + ext } - let resolution = nodeModuleNameResolver(moduleName, containingFile.name, {}, createModuleResolutionHost(containingFile, moduleFile)); + let resolution = nodeModuleNameResolver(moduleName, containingFile.name, {}, createModuleResolutionHost(hasDirectoryExists, containingFile, moduleFile)); assert.equal(resolution.resolvedModule.resolvedFileName, moduleFile.name); assert.equal(!!resolution.resolvedModule.isExternalLibraryImport, false); @@ -69,6 +95,7 @@ module ts { } assert.deepEqual(resolution.failedLookupLocations, failedLookupLocations); + } } @@ -89,14 +116,19 @@ module ts { }); function testLoadingFromPackageJson(containingFileName: string, packageJsonFileName: string, fieldRef: string, moduleFileName: string, moduleName: string): void { - let containingFile = { name: containingFileName }; - let packageJson = { name: packageJsonFileName, content: JSON.stringify({ "typings": fieldRef }) }; - let moduleFile = { name: moduleFileName }; - let resolution = nodeModuleNameResolver(moduleName, containingFile.name, {}, createModuleResolutionHost(containingFile, packageJson, moduleFile)); - assert.equal(resolution.resolvedModule.resolvedFileName, moduleFile.name); - assert.equal(!!resolution.resolvedModule.isExternalLibraryImport, false); - // expect three failed lookup location - attempt to load module as file with all supported extensions - assert.equal(resolution.failedLookupLocations.length, supportedTypeScriptExtensions.length); + test(/*hasDirectoryExists*/ false); + test(/*hasDirectoryExists*/ true); + + function test(hasDirectoryExists: boolean) { + let containingFile = { name: containingFileName }; + let packageJson = { name: packageJsonFileName, content: JSON.stringify({ "typings": fieldRef }) }; + let moduleFile = { name: moduleFileName }; + let resolution = nodeModuleNameResolver(moduleName, containingFile.name, {}, createModuleResolutionHost(hasDirectoryExists, containingFile, packageJson, moduleFile)); + assert.equal(resolution.resolvedModule.resolvedFileName, moduleFile.name); + assert.equal(!!resolution.resolvedModule.isExternalLibraryImport, false); + // expect three failed lookup location - attempt to load module as file with all supported extensions + assert.equal(resolution.failedLookupLocations.length, supportedTypeScriptExtensions.length); + } } it("module name as directory - load from 'typings'", () => { @@ -107,16 +139,21 @@ module ts { }); function testTypingsIgnored(typings: any): void { - let containingFile = { name: "/a/b.ts" }; - let packageJson = { name: "/node_modules/b/package.json", content: JSON.stringify({ "typings": typings }) }; - let moduleFile = { name: "/a/b.d.ts" }; + test(/*hasDirectoryExists*/ false); + test(/*hasDirectoryExists*/ true); - let indexPath = "/node_modules/b/index.d.ts"; - let indexFile = { name: indexPath } + function test(hasDirectoryExists: boolean) { + let containingFile = { name: "/a/b.ts" }; + let packageJson = { name: "/node_modules/b/package.json", content: JSON.stringify({ "typings": typings }) }; + let moduleFile = { name: "/a/b.d.ts" }; - let resolution = nodeModuleNameResolver("b", containingFile.name, {}, createModuleResolutionHost(containingFile, packageJson, moduleFile, indexFile)); + let indexPath = "/node_modules/b/index.d.ts"; + let indexFile = { name: indexPath } - assert.equal(resolution.resolvedModule.resolvedFileName, indexPath); + let resolution = nodeModuleNameResolver("b", containingFile.name, {}, createModuleResolutionHost(hasDirectoryExists, containingFile, packageJson, moduleFile, indexFile)); + + assert.equal(resolution.resolvedModule.resolvedFileName, indexPath); + } } it("module name as directory - handle invalid 'typings'", () => { @@ -128,89 +165,144 @@ module ts { }); it("module name as directory - load index.d.ts", () => { - let containingFile = { name: "/a/b/c.ts" }; - let packageJson = { name: "/a/b/foo/package.json", content: JSON.stringify({ main: "/c/d" }) }; - let indexFile = { name: "/a/b/foo/index.d.ts" }; - let resolution = nodeModuleNameResolver("./foo", containingFile.name, {}, createModuleResolutionHost(containingFile, packageJson, indexFile)); - assert.equal(resolution.resolvedModule.resolvedFileName, indexFile.name); - assert.equal(!!resolution.resolvedModule.isExternalLibraryImport, false); - assert.deepEqual(resolution.failedLookupLocations, [ - "/a/b/foo.ts", - "/a/b/foo.tsx", - "/a/b/foo.d.ts", - "/a/b/foo/index.ts", - "/a/b/foo/index.tsx", - ]); + test(/*hasDirectoryExists*/ false); + test(/*hasDirectoryExists*/ true); + + function test(hasDirectoryExists: boolean) { + let containingFile = { name: "/a/b/c.ts" }; + let packageJson = { name: "/a/b/foo/package.json", content: JSON.stringify({ main: "/c/d" }) }; + let indexFile = { name: "/a/b/foo/index.d.ts" }; + let resolution = nodeModuleNameResolver("./foo", containingFile.name, {}, createModuleResolutionHost(hasDirectoryExists, containingFile, packageJson, indexFile)); + assert.equal(resolution.resolvedModule.resolvedFileName, indexFile.name); + assert.equal(!!resolution.resolvedModule.isExternalLibraryImport, false); + assert.deepEqual(resolution.failedLookupLocations, [ + "/a/b/foo.ts", + "/a/b/foo.tsx", + "/a/b/foo.d.ts", + "/a/b/foo/index.ts", + "/a/b/foo/index.tsx", + ]); + } }); }); describe("Node module resolution - non-relative paths", () => { it("load module as file - ts files not loaded", () => { - let containingFile = { name: "/a/b/c/d/e.ts" }; - let moduleFile = { name: "/a/b/node_modules/foo.ts" }; - let resolution = nodeModuleNameResolver("foo", containingFile.name, {}, createModuleResolutionHost(containingFile, moduleFile)); - assert.equal(resolution.resolvedModule.resolvedFileName, moduleFile.name); - assert.deepEqual(resolution.failedLookupLocations, [ - "/a/b/c/d/node_modules/foo.ts", - "/a/b/c/d/node_modules/foo.tsx", - "/a/b/c/d/node_modules/foo.d.ts", - "/a/b/c/d/node_modules/foo/package.json", - "/a/b/c/d/node_modules/foo/index.ts", - "/a/b/c/d/node_modules/foo/index.tsx", - "/a/b/c/d/node_modules/foo/index.d.ts", - "/a/b/c/node_modules/foo.ts", - "/a/b/c/node_modules/foo.tsx", - "/a/b/c/node_modules/foo.d.ts", - "/a/b/c/node_modules/foo/package.json", - "/a/b/c/node_modules/foo/index.ts", - "/a/b/c/node_modules/foo/index.tsx", - "/a/b/c/node_modules/foo/index.d.ts", - ]) + test(/*hasDirectoryExists*/ false); + test(/*hasDirectoryExists*/ true); + + function test(hasDirectoryExists: boolean) { + let containingFile = { name: "/a/b/c/d/e.ts" }; + let moduleFile = { name: "/a/b/node_modules/foo.ts" }; + let resolution = nodeModuleNameResolver("foo", containingFile.name, {}, createModuleResolutionHost(hasDirectoryExists, containingFile, moduleFile)); + assert.equal(resolution.resolvedModule.resolvedFileName, moduleFile.name); + assert.deepEqual(resolution.failedLookupLocations, [ + "/a/b/c/d/node_modules/foo.ts", + "/a/b/c/d/node_modules/foo.tsx", + "/a/b/c/d/node_modules/foo.d.ts", + "/a/b/c/d/node_modules/foo/package.json", + "/a/b/c/d/node_modules/foo/index.ts", + "/a/b/c/d/node_modules/foo/index.tsx", + "/a/b/c/d/node_modules/foo/index.d.ts", + "/a/b/c/d/node_modules/@types/foo.ts", + "/a/b/c/d/node_modules/@types/foo.tsx", + "/a/b/c/d/node_modules/@types/foo.d.ts", + "/a/b/c/d/node_modules/@types/foo/package.json", + "/a/b/c/d/node_modules/@types/foo/index.ts", + "/a/b/c/d/node_modules/@types/foo/index.tsx", + "/a/b/c/d/node_modules/@types/foo/index.d.ts", + "/a/b/c/node_modules/foo.ts", + "/a/b/c/node_modules/foo.tsx", + "/a/b/c/node_modules/foo.d.ts", + "/a/b/c/node_modules/foo/package.json", + "/a/b/c/node_modules/foo/index.ts", + "/a/b/c/node_modules/foo/index.tsx", + "/a/b/c/node_modules/foo/index.d.ts", + "/a/b/c/node_modules/@types/foo.ts", + "/a/b/c/node_modules/@types/foo.tsx", + "/a/b/c/node_modules/@types/foo.d.ts", + "/a/b/c/node_modules/@types/foo/package.json", + "/a/b/c/node_modules/@types/foo/index.ts", + "/a/b/c/node_modules/@types/foo/index.tsx", + "/a/b/c/node_modules/@types/foo/index.d.ts", + ]) + } }); it("load module as file", () => { - let containingFile = { name: "/a/b/c/d/e.ts" }; - let moduleFile = { name: "/a/b/node_modules/foo.d.ts" }; - let resolution = nodeModuleNameResolver("foo", containingFile.name, {}, createModuleResolutionHost(containingFile, moduleFile)); - assert.equal(resolution.resolvedModule.resolvedFileName, moduleFile.name); - assert.equal(resolution.resolvedModule.isExternalLibraryImport, true); + test(/*hasDirectoryExists*/ false); + test(/*hasDirectoryExists*/ true); + + function test(hasDirectoryExists: boolean) { + let containingFile = { name: "/a/b/c/d/e.ts" }; + let moduleFile = { name: "/a/b/node_modules/foo.d.ts" }; + let resolution = nodeModuleNameResolver("foo", containingFile.name, {}, createModuleResolutionHost(hasDirectoryExists, containingFile, moduleFile)); + assert.equal(resolution.resolvedModule.resolvedFileName, moduleFile.name); + assert.equal(resolution.resolvedModule.isExternalLibraryImport, true); + } }); it("load module as directory", () => { - let containingFile = { name: "/a/node_modules/b/c/node_modules/d/e.ts" }; - let moduleFile = { name: "/a/node_modules/foo/index.d.ts" }; - let resolution = nodeModuleNameResolver("foo", containingFile.name, {}, createModuleResolutionHost(containingFile, moduleFile)); - assert.equal(resolution.resolvedModule.resolvedFileName, moduleFile.name); - assert.equal(resolution.resolvedModule.isExternalLibraryImport, true); - assert.deepEqual(resolution.failedLookupLocations, [ - "/a/node_modules/b/c/node_modules/d/node_modules/foo.ts", - "/a/node_modules/b/c/node_modules/d/node_modules/foo.tsx", - "/a/node_modules/b/c/node_modules/d/node_modules/foo.d.ts", - "/a/node_modules/b/c/node_modules/d/node_modules/foo/package.json", - "/a/node_modules/b/c/node_modules/d/node_modules/foo/index.ts", - "/a/node_modules/b/c/node_modules/d/node_modules/foo/index.tsx", - "/a/node_modules/b/c/node_modules/d/node_modules/foo/index.d.ts", - "/a/node_modules/b/c/node_modules/foo.ts", - "/a/node_modules/b/c/node_modules/foo.tsx", - "/a/node_modules/b/c/node_modules/foo.d.ts", - "/a/node_modules/b/c/node_modules/foo/package.json", - "/a/node_modules/b/c/node_modules/foo/index.ts", - "/a/node_modules/b/c/node_modules/foo/index.tsx", - "/a/node_modules/b/c/node_modules/foo/index.d.ts", - "/a/node_modules/b/node_modules/foo.ts", - "/a/node_modules/b/node_modules/foo.tsx", - "/a/node_modules/b/node_modules/foo.d.ts", - "/a/node_modules/b/node_modules/foo/package.json", - "/a/node_modules/b/node_modules/foo/index.ts", - "/a/node_modules/b/node_modules/foo/index.tsx", - "/a/node_modules/b/node_modules/foo/index.d.ts", - "/a/node_modules/foo.ts", - "/a/node_modules/foo.tsx", - "/a/node_modules/foo.d.ts", - "/a/node_modules/foo/package.json", - "/a/node_modules/foo/index.ts", - "/a/node_modules/foo/index.tsx" - ]); + test(/*hasDirectoryExists*/ false); + test(/*hasDirectoryExists*/ true); + + function test(hasDirectoryExists: boolean) { + let containingFile = { name: "/a/node_modules/b/c/node_modules/d/e.ts" }; + let moduleFile = { name: "/a/node_modules/foo/index.d.ts" }; + let resolution = nodeModuleNameResolver("foo", containingFile.name, {}, createModuleResolutionHost(hasDirectoryExists, containingFile, moduleFile)); + assert.equal(resolution.resolvedModule.resolvedFileName, moduleFile.name); + assert.equal(resolution.resolvedModule.isExternalLibraryImport, true); + assert.deepEqual(resolution.failedLookupLocations, [ + "/a/node_modules/b/c/node_modules/d/node_modules/foo.ts", + "/a/node_modules/b/c/node_modules/d/node_modules/foo.tsx", + "/a/node_modules/b/c/node_modules/d/node_modules/foo.d.ts", + "/a/node_modules/b/c/node_modules/d/node_modules/foo/package.json", + "/a/node_modules/b/c/node_modules/d/node_modules/foo/index.ts", + "/a/node_modules/b/c/node_modules/d/node_modules/foo/index.tsx", + "/a/node_modules/b/c/node_modules/d/node_modules/foo/index.d.ts", + "/a/node_modules/b/c/node_modules/d/node_modules/@types/foo.ts", + "/a/node_modules/b/c/node_modules/d/node_modules/@types/foo.tsx", + "/a/node_modules/b/c/node_modules/d/node_modules/@types/foo.d.ts", + "/a/node_modules/b/c/node_modules/d/node_modules/@types/foo/package.json", + "/a/node_modules/b/c/node_modules/d/node_modules/@types/foo/index.ts", + "/a/node_modules/b/c/node_modules/d/node_modules/@types/foo/index.tsx", + "/a/node_modules/b/c/node_modules/d/node_modules/@types/foo/index.d.ts", + "/a/node_modules/b/c/node_modules/foo.ts", + "/a/node_modules/b/c/node_modules/foo.tsx", + "/a/node_modules/b/c/node_modules/foo.d.ts", + "/a/node_modules/b/c/node_modules/foo/package.json", + "/a/node_modules/b/c/node_modules/foo/index.ts", + "/a/node_modules/b/c/node_modules/foo/index.tsx", + "/a/node_modules/b/c/node_modules/foo/index.d.ts", + "/a/node_modules/b/c/node_modules/@types/foo.ts", + "/a/node_modules/b/c/node_modules/@types/foo.tsx", + "/a/node_modules/b/c/node_modules/@types/foo.d.ts", + "/a/node_modules/b/c/node_modules/@types/foo/package.json", + "/a/node_modules/b/c/node_modules/@types/foo/index.ts", + "/a/node_modules/b/c/node_modules/@types/foo/index.tsx", + "/a/node_modules/b/c/node_modules/@types/foo/index.d.ts", + "/a/node_modules/b/node_modules/foo.ts", + "/a/node_modules/b/node_modules/foo.tsx", + "/a/node_modules/b/node_modules/foo.d.ts", + "/a/node_modules/b/node_modules/foo/package.json", + "/a/node_modules/b/node_modules/foo/index.ts", + "/a/node_modules/b/node_modules/foo/index.tsx", + "/a/node_modules/b/node_modules/foo/index.d.ts", + "/a/node_modules/b/node_modules/@types/foo.ts", + "/a/node_modules/b/node_modules/@types/foo.tsx", + "/a/node_modules/b/node_modules/@types/foo.d.ts", + "/a/node_modules/b/node_modules/@types/foo/package.json", + "/a/node_modules/b/node_modules/@types/foo/index.ts", + "/a/node_modules/b/node_modules/@types/foo/index.tsx", + "/a/node_modules/b/node_modules/@types/foo/index.d.ts", + "/a/node_modules/foo.ts", + "/a/node_modules/foo.tsx", + "/a/node_modules/foo.d.ts", + "/a/node_modules/foo/package.json", + "/a/node_modules/foo/index.ts", + "/a/node_modules/foo/index.tsx" + ]); + } }); }); @@ -400,4 +492,581 @@ import b = require("./moduleB.ts"); test(files, { module: ts.ModuleKind.CommonJS, forceConsistentCasingInFileNames: true }, "/a/B/c", /* useCaseSensitiveFileNames */ false, ["moduleD.ts"], []); }) }); + + describe("baseUrl augmented module resolution", () => { + + it("module resolution without path mappings/rootDirs", () => { + test(/*hasDirectoryExists*/ false); + test(/*hasDirectoryExists*/ true); + + function test(hasDirectoryExists: boolean) { + const file1: File = { name: "/root/folder1/file1.ts" }; + const file2: File = { name: "/root/folder2/file2.ts" }; + const file3: File = { name: "/root/folder2/file3.ts" }; + const host = createModuleResolutionHost(hasDirectoryExists, file1, file2, file3); + for (const moduleResolution of [ ModuleResolutionKind.NodeJs, ModuleResolutionKind.Classic ]) { + const options: CompilerOptions = { moduleResolution, baseUrl: "/root" }; + { + const result = resolveModuleName("folder2/file2", file1.name, options, host); + assert.isTrue(result.resolvedModule !== undefined, "module should be resolved"); + assert.equal(result.resolvedModule.resolvedFileName, file2.name); + assert.deepEqual(result.failedLookupLocations, []); + } + { + const result = resolveModuleName("./file3", file2.name, options, host); + assert.isTrue(result.resolvedModule !== undefined, "module should be resolved"); + assert.equal(result.resolvedModule.resolvedFileName, file3.name); + assert.deepEqual(result.failedLookupLocations, []); + } + { + const result = resolveModuleName("/root/folder1/file1", file2.name, options, host); + assert.isTrue(result.resolvedModule !== undefined, "module should be resolved"); + assert.equal(result.resolvedModule.resolvedFileName, file1.name); + assert.deepEqual(result.failedLookupLocations, []); + } + } + } + // add failure tests + }); + + it("node + baseUrl", () => { + test(/*hasDirectoryExists*/ false); + test(/*hasDirectoryExists*/ true); + + function test(hasDirectoryExists: boolean) { + const main: File = { name: "/root/a/b/main.ts" }; + const m1: File = { name: "/root/m1.ts" }; // load file as module + const m2: File = { name: "/root/m2/index.d.ts" }; // load folder as module + const m3: File = { name: "/root/m3/package.json", content: JSON.stringify({ typings: "dist/typings.d.ts" }) }; + const m3Typings: File = { name: "/root/m3/dist/typings.d.ts" }; + const m4: File = { name: "/root/node_modules/m4.ts" }; // fallback to node + + const options: CompilerOptions = { moduleResolution: ModuleResolutionKind.NodeJs, baseUrl: "/root" }; + const host = createModuleResolutionHost(hasDirectoryExists, main, m1, m2, m3, m3Typings, m4); + + check("m1", main, m1); + check("m2", main, m2); + check("m3", main, m3Typings); + check("m4", main, m4); + + function check(name: string, caller: File, expected: File) { + const result = resolveModuleName(name, caller.name, options, host); + assert.isTrue(result.resolvedModule !== undefined); + assert.equal(result.resolvedModule.resolvedFileName, expected.name); + } + } + }); + + it("classic + baseUrl", () => { + test(/*hasDirectoryExists*/ false); + test(/*hasDirectoryExists*/ true); + + function test(hasDirectoryExists: boolean) { + const main: File = { name: "/root/a/b/main.ts" }; + const m1: File = { name: "/root/x/m1.ts" }; // load from base url + const m2: File = { name: "/m2.ts" }; // fallback to classic + + const options: CompilerOptions = { moduleResolution: ModuleResolutionKind.Classic, baseUrl: "/root/x", jsx: JsxEmit.React }; + const host = createModuleResolutionHost(hasDirectoryExists, main, m1, m2); + + check("m1", main, m1); + check("m2", main, m2); + + function check(name: string, caller: File, expected: File) { + const result = resolveModuleName(name, caller.name, options, host); + assert.isTrue(result.resolvedModule !== undefined); + assert.equal(result.resolvedModule.resolvedFileName, expected.name); + } + } + }) + + it("node + baseUrl + path mappings", () => { + test(/*hasDirectoryExists*/ false); + test(/*hasDirectoryExists*/ true); + + function test(hasDirectoryExists: boolean) { + const main: File = { name: "/root/folder1/main.ts" }; + + const file1: File = { name: "/root/folder1/file1.ts" }; + const file2: File = { name: "/root/generated/folder1/file2.ts" } // load remapped file as module + const file3: File = { name: "/root/generated/folder2/file3/index.d.ts" } // load folder a module + const file4Typings: File = { name: "/root/generated/folder2/file4/package.json", content: JSON.stringify({ typings: "dist/types.d.ts" })}; + const file4: File = { name: "/root/generated/folder2/file4/dist/types.d.ts" }; // load file pointed by typings + const file5: File = { name: "/root/someanotherfolder/file5/index.d.ts" } // load remapped module from folder + const file6: File = { name: "/root/node_modules/file6.ts" }; // fallback to node + const host = createModuleResolutionHost(hasDirectoryExists, file1, file2, file3, file4, file4Typings, file5, file6); + + const options: CompilerOptions = { + moduleResolution: ModuleResolutionKind.NodeJs, + baseUrl: "/root", + jsx: JsxEmit.React, + paths: { + "*": [ + "*", + "generated/*" + ], + "somefolder/*": [ + "someanotherfolder/*" + ] + } + }; + check("folder1/file1", file1, []); + check("folder1/file2", file2, [ + // first try the '*' + "/root/folder1/file2.ts", + "/root/folder1/file2.tsx", + "/root/folder1/file2.d.ts", + "/root/folder1/file2/package.json", + "/root/folder1/file2/index.ts", + "/root/folder1/file2/index.tsx", + "/root/folder1/file2/index.d.ts" + // then first attempt on 'generated/*' was successful + ]); + check("folder2/file3", file3, [ + // first try '*' + "/root/folder2/file3.ts", + "/root/folder2/file3.tsx", + "/root/folder2/file3.d.ts", + "/root/folder2/file3/package.json", + "/root/folder2/file3/index.ts", + "/root/folder2/file3/index.tsx", + "/root/folder2/file3/index.d.ts", + // then use remapped location + "/root/generated/folder2/file3.ts", + "/root/generated/folder2/file3.tsx", + "/root/generated/folder2/file3.d.ts", + "/root/generated/folder2/file3/package.json", + "/root/generated/folder2/file3/index.ts", + "/root/generated/folder2/file3/index.tsx", + // success on index.d.ts + ]); + check("folder2/file4", file4, [ + // first try '*' + "/root/folder2/file4.ts", + "/root/folder2/file4.tsx", + "/root/folder2/file4.d.ts", + "/root/folder2/file4/package.json", + "/root/folder2/file4/index.ts", + "/root/folder2/file4/index.tsx", + "/root/folder2/file4/index.d.ts", + // try to load from file from remapped location + "/root/generated/folder2/file4.ts", + "/root/generated/folder2/file4.tsx", + "/root/generated/folder2/file4.d.ts" + // success on loading as from folder + ]); + check("somefolder/file5", file5, [ + // load from remapped location + // first load from fle + "/root/someanotherfolder/file5.ts", + "/root/someanotherfolder/file5.tsx", + "/root/someanotherfolder/file5.d.ts", + // load from folder + "/root/someanotherfolder/file5/package.json", + "/root/someanotherfolder/file5/index.ts", + "/root/someanotherfolder/file5/index.tsx", + // success on index.d.ts + ]); + check("file6", file6, [ + // first try * + // load from file + "/root/file6.ts", + "/root/file6.tsx", + "/root/file6.d.ts", + // load from folder + "/root/file6/package.json", + "/root/file6/index.ts", + "/root/file6/index.tsx", + "/root/file6/index.d.ts", + // then try 'generated/*' + // load from file + "/root/generated/file6.ts", + "/root/generated/file6.tsx", + "/root/generated/file6.d.ts", + // load from folder + "/root/generated/file6/package.json", + "/root/generated/file6/index.ts", + "/root/generated/file6/index.tsx", + "/root/generated/file6/index.d.ts", + // fallback to standard node behavior + // load from file + "/root/folder1/node_modules/file6.ts", + "/root/folder1/node_modules/file6.tsx", + "/root/folder1/node_modules/file6.d.ts", + // load from folder + "/root/folder1/node_modules/file6/package.json", + "/root/folder1/node_modules/file6/index.ts", + "/root/folder1/node_modules/file6/index.tsx", + "/root/folder1/node_modules/file6/index.d.ts", + "/root/folder1/node_modules/@types/file6.ts", + "/root/folder1/node_modules/@types/file6.tsx", + "/root/folder1/node_modules/@types/file6.d.ts", + "/root/folder1/node_modules/@types/file6/package.json", + "/root/folder1/node_modules/@types/file6/index.ts", + "/root/folder1/node_modules/@types/file6/index.tsx", + "/root/folder1/node_modules/@types/file6/index.d.ts" + // success on /root/node_modules/file6.ts + ]); + + function check(name: string, expected: File, expectedFailedLookups: string[]) { + const result = resolveModuleName(name, main.name, options, host); + assert.isTrue(result.resolvedModule !== undefined, "module should be resolved"); + assert.equal(result.resolvedModule.resolvedFileName, expected.name); + assert.deepEqual(result.failedLookupLocations, expectedFailedLookups); + } + } + }); + + it ("classic + baseUrl + path mappings", () => { + // classic mode does not use directoryExists + test(/*hasDirectoryExists*/ false); + + function test(hasDirectoryExists: boolean) { + const main: File = { name: "/root/folder1/main.ts" }; + + const file1: File = { name: "/root/folder1/file1.ts" }; + const file2: File = { name: "/root/generated/folder1/file2.ts" }; + const file3: File = { name: "/folder1/file3.ts" }; // fallback to classic + const host = createModuleResolutionHost(hasDirectoryExists, file1, file2, file3); + + const options: CompilerOptions = { + moduleResolution: ModuleResolutionKind.Classic, + baseUrl: "/root", + jsx: JsxEmit.React, + paths: { + "*": [ + "*", + "generated/*" + ], + "somefolder/*": [ + "someanotherfolder/*" + ] + } + }; + check("folder1/file1", file1, []); + check("folder1/file2", file2, [ + // first try '*' + "/root/folder1/file2.ts", + "/root/folder1/file2.tsx", + "/root/folder1/file2.d.ts", + // success when using 'generated/*' + ]); + check("folder1/file3", file3, [ + // first try '*' + "/root/folder1/file3.ts", + "/root/folder1/file3.tsx", + "/root/folder1/file3.d.ts", + // then try 'generated/*' + "/root/generated/folder1/file3.ts", + "/root/generated/folder1/file3.tsx", + "/root/generated/folder1/file3.d.ts", + // fallback to classic + "/root/folder1/folder1/file3.ts", + "/root/folder1/folder1/file3.tsx", + "/root/folder1/folder1/file3.d.ts", + "/root/folder1/file3.ts", + "/root/folder1/file3.tsx", + "/root/folder1/file3.d.ts", + ]); + + function check(name: string, expected: File, expectedFailedLookups: string[]) { + const result = resolveModuleName(name, main.name, options, host); + assert.isTrue(result.resolvedModule !== undefined, "module should be resolved"); + assert.equal(result.resolvedModule.resolvedFileName, expected.name); + assert.deepEqual(result.failedLookupLocations, expectedFailedLookups); + } + } + }) + + it ("node + rootDirs", () => { + test(/*hasDirectoryExists*/ false); + test(/*hasDirectoryExists*/ true); + + function test(hasDirectoryExists: boolean) { + let file1: File = { name: "/root/folder1/file1.ts" }; + let file1_1: File = { name: "/root/folder1/file1_1/index.d.ts" }; + let file2: File = { name: "/root/generated/folder1/file2.ts" }; + let file3: File = { name: "/root/generated/folder2/file3.ts" }; + const host = createModuleResolutionHost(hasDirectoryExists, file1, file1_1, file2, file3); + const options: CompilerOptions = { + moduleResolution: ModuleResolutionKind.NodeJs, + rootDirs: [ + "/root", + "/root/generated/" + ] + }; + check("./file2", file1, file2, [ + // first try current location + // load from file + "/root/folder1/file2.ts", + "/root/folder1/file2.tsx", + "/root/folder1/file2.d.ts", + // load from folder + "/root/folder1/file2/package.json", + "/root/folder1/file2/index.ts", + "/root/folder1/file2/index.tsx", + "/root/folder1/file2/index.d.ts", + // success after using alternative rootDir entry + ]); + check("../folder1/file1", file3, file1, [ + // first try current location + // load from file + "/root/generated/folder1/file1.ts", + "/root/generated/folder1/file1.tsx", + "/root/generated/folder1/file1.d.ts", + // load from module + "/root/generated/folder1/file1/package.json", + "/root/generated/folder1/file1/index.ts", + "/root/generated/folder1/file1/index.tsx", + "/root/generated/folder1/file1/index.d.ts", + // success after using alternative rootDir entry + ]); + check("../folder1/file1_1", file3, file1_1, [ + // first try current location + // load from file + "/root/generated/folder1/file1_1.ts", + "/root/generated/folder1/file1_1.tsx", + "/root/generated/folder1/file1_1.d.ts", + // load from folder + "/root/generated/folder1/file1_1/package.json", + "/root/generated/folder1/file1_1/index.ts", + "/root/generated/folder1/file1_1/index.tsx", + "/root/generated/folder1/file1_1/index.d.ts", + // try alternative rootDir entry + // load from file + "/root/folder1/file1_1.ts", + "/root/folder1/file1_1.tsx", + "/root/folder1/file1_1.d.ts", + // load from directory + "/root/folder1/file1_1/package.json", + "/root/folder1/file1_1/index.ts", + "/root/folder1/file1_1/index.tsx", + // success on loading '/root/folder1/file1_1/index.d.ts' + ]); + + function check(name: string, container: File, expected: File, expectedFailedLookups: string[]) { + const result = resolveModuleName(name, container.name, options, host); + assert.isTrue(result.resolvedModule !== undefined, "module should be resolved"); + assert.equal(result.resolvedModule.resolvedFileName, expected.name); + assert.deepEqual(result.failedLookupLocations,expectedFailedLookups); + } + } + }); + + it ("classic + rootDirs", () => { + test(/*hasDirectoryExists*/ false); + + function test(hasDirectoryExists: boolean) { + let file1: File = { name: "/root/folder1/file1.ts" }; + let file2: File = { name: "/root/generated/folder1/file2.ts" }; + let file3: File = { name: "/root/generated/folder2/file3.ts" }; + let file4: File = { name: "/folder1/file1_1.ts" }; + const host = createModuleResolutionHost(hasDirectoryExists, file1, file2, file3, file4); + const options: CompilerOptions = { + moduleResolution: ModuleResolutionKind.Classic, + jsx: JsxEmit.React, + rootDirs: [ + "/root", + "/root/generated/" + ] + }; + check("./file2", file1, file2, [ + // first load from current location + "/root/folder1/file2.ts", + "/root/folder1/file2.tsx", + "/root/folder1/file2.d.ts", + // then try alternative rootDir entry + ]); + check("../folder1/file1", file3, file1, [ + // first load from current location + "/root/generated/folder1/file1.ts", + "/root/generated/folder1/file1.tsx", + "/root/generated/folder1/file1.d.ts", + // then try alternative rootDir entry + ]); + check("folder1/file1_1", file3, file4, [ + // current location + "/root/generated/folder2/folder1/file1_1.ts", + "/root/generated/folder2/folder1/file1_1.tsx", + "/root/generated/folder2/folder1/file1_1.d.ts", + // other entry in rootDirs + "/root/generated/folder1/file1_1.ts", + "/root/generated/folder1/file1_1.tsx", + "/root/generated/folder1/file1_1.d.ts", + // fallback + "/root/folder1/file1_1.ts", + "/root/folder1/file1_1.tsx", + "/root/folder1/file1_1.d.ts", + // found one + ]); + + function check(name: string, container: File, expected: File, expectedFailedLookups: string[]) { + const result = resolveModuleName(name, container.name, options, host); + assert.isTrue(result.resolvedModule !== undefined, "module should be resolved"); + assert.equal(result.resolvedModule.resolvedFileName, expected.name); + assert.deepEqual(result.failedLookupLocations,expectedFailedLookups); + } + } + }); + + it ("nested node module", () => { + test(/*hasDirectoryExists*/ false); + test(/*hasDirectoryExists*/ true); + + function test(hasDirectoryExists: boolean) { + const app: File = { name: "/root/src/app.ts" } + const libsPackage: File = { name: "/root/src/libs/guid/package.json", content: JSON.stringify({ typings: "dist/guid.d.ts" }) }; + const libsTypings: File = { name: "/root/src/libs/guid/dist/guid.d.ts" }; + const host = createModuleResolutionHost(hasDirectoryExists, app, libsPackage, libsTypings); + const options: CompilerOptions = { + moduleResolution: ModuleResolutionKind.NodeJs, + baseUrl: "/root", + paths: { + "libs/guid": [ "src/libs/guid" ] + } + }; + const result = resolveModuleName("libs/guid", app.name, options, host); + assert.isTrue(result.resolvedModule !== undefined, "module should be resolved"); + assert.equal(result.resolvedModule.resolvedFileName, libsTypings.name); + assert.deepEqual(result.failedLookupLocations, [ + // first try to load module as file + "/root/src/libs/guid.ts", + "/root/src/libs/guid.tsx", + "/root/src/libs/guid.d.ts", + ]); + } + }) + }); + + function notImplemented(name: string): () => any { + return () => assert(`${name} is not implemented and should not be called`); + } + + describe("ModuleResolutionHost.directoryExists", () => { + it("No 'fileExists' calls if containing directory is missing", () => { + const host: ModuleResolutionHost = { + readFile: notImplemented("readFile"), + fileExists: notImplemented("fileExists"), + directoryExists: _ => false + }; + + const result = resolveModuleName("someName", "/a/b/c/d", { moduleResolution: ModuleResolutionKind.NodeJs }, host); + assert(!result.resolvedModule); + }); + }); + + describe("Type reference directive resolution: ", () => { + function test(typesRoot: string, typeDirective: string, primary: boolean, initialFile: File, targetFile: File, ...otherFiles: File[]) { + const host = createModuleResolutionHost(false, ...[initialFile, targetFile].concat(...otherFiles)); + const result = resolveTypeReferenceDirective(typeDirective, initialFile.name, {typesRoot}, host); + assert(result.resolvedTypeReferenceDirective.resolvedFileName !== undefined, "expected type directive to be resolved"); + assert.equal(result.resolvedTypeReferenceDirective.resolvedFileName, targetFile.name, "unexpected result of type reference resolution"); + assert.equal(result.resolvedTypeReferenceDirective.primary, primary, "unexpected 'primary' value"); + } + + it("Can be resolved from primary location", () => { + { + const f1 = { name: "/root/src/app.ts" } + const f2 = { name: "/root/src/types/lib/index.d.ts" }; + test(/*typesRoot*/"/root/src", /* typeDirective */"lib", /*primary*/ true, f1, f2); + } + { + const f1 = { name: "/root/src/app.ts" } + const f2 = { name: "/root/src/types/lib/typings/lib.d.ts" }; + const package = { name: "/root/src/types/lib/package.json", content: JSON.stringify({types: "typings/lib.d.ts"}) }; + test(/*typesRoot*/"/root/src", /* typeDirective */"lib", /*primary*/ true, f1, f2, package); + } + { + const f1 = { name: "/root/src/app.ts" } + const f2 = { name: "/root/src/node_modules/lib/index.d.ts" }; + test(/*typesRoot*/"/root/src", /* typeDirective */"lib", /*primary*/ true, f1, f2); + } + { + const f1 = { name: "/root/src/app.ts" } + const f2 = { name: "/root/src/node_modules/lib/typings/lib.d.ts" }; + const package = { name: "/root/src/node_modules/lib/package.json", content: JSON.stringify({types: "typings/lib.d.ts"}) }; + test(/*typesRoot*/"/root/src", /* typeDirective */"lib", /*primary*/ true, f1, f2, package); + } + { + const f1 = { name: "/root/src/app.ts" } + const f2 = { name: "/root/src/node_modules/@types/lib/index.d.ts" }; + test(/*typesRoot*/"/root/src", /* typeDirective */"lib", /*primary*/ true, f1, f2); + } + { + const f1 = { name: "/root/src/app.ts" } + const f2 = { name: "/root/src/node_modules/@types/lib/typings/lib.d.ts" }; + const package = { name: "/root/src/node_modules/@types/lib/package.json", content: JSON.stringify({types: "typings/lib.d.ts"}) }; + test(/*typesRoot*/"/root/src", /* typeDirective */"lib", /*primary*/ true, f1, f2, package); + } + }); + it("Can be resolved from secondary location", () => { + { + const f1 = { name: "/root/src/app.ts" } + const f2 = { name: "/root/node_modules/lib.d.ts" }; + test(/*typesRoot*/"/root/src", /* typeDirective */"lib", /*primary*/ false, f1, f2); + } + { + const f1 = { name: "/root/src/app.ts" } + const f2 = { name: "/root/node_modules/lib/index.d.ts" }; + test(/*typesRoot*/"/root/src", /* typeDirective */"lib", /*primary*/ false, f1, f2); + } + { + const f1 = { name: "/root/src/app.ts" } + const f2 = { name: "/root/node_modules/lib/typings/lib.d.ts" }; + const package = { name: "/root/node_modules/lib/package.json", content: JSON.stringify({typings: "typings/lib.d.ts"}) }; + test(/*typesRoot*/"/root/src", /* typeDirective */"lib", /*primary*/ false, f1, f2, package); + } + { + const f1 = { name: "/root/src/app.ts" } + const f2 = { name: "/root/node_modules/@types/lib/index.d.ts" }; + test(/*typesRoot*/"/root/src", /* typeDirective */"lib", /*primary*/ false, f1, f2); + } + { + const f1 = { name: "/root/src/app.ts" } + const f2 = { name: "/root/node_modules/@types/lib/typings/lib.d.ts" }; + const package = { name: "/root/node_modules/@types/lib/package.json", content: JSON.stringify({typings: "typings/lib.d.ts"}) }; + test(/*typesRoot*/"/root/src", /* typeDirective */"lib", /*primary*/ false, f1, f2, package); + } + }); + it("Primary resolution overrides secondary resolutions", () => { + { + const f1 = { name: "/root/src/a/b/c/app.ts" }; + const f2 = { name: "/root/src/types/lib/index.d.ts" }; + const f3 = { name: "/root/src/a/b/node_modules/lib.d.ts" } + test(/*typesRoot*/"/root/src", /* typeDirective */"lib", /*primary*/ true, f1, f2, f3); + } + }) + it("Reused program keeps errors", () => { + const f1 = { name: "/root/src/a/b/c/d/e/app.ts", content: `/// ` }; + const f2 = { name: "/root/src/a/b/c/d/node_modules/lib/index.d.ts", content: `declare var x: number;` }; + const f3 = { name: "/root/src/a/b/c/d/f/g/app.ts", content: `/// ` }; + const f4 = { name: "/root/src/a/b/c/d/f/node_modules/lib/index.d.ts", content: `declare var x: number;` }; + const files = [f1, f2, f3, f4]; + + const names = map(files, f => f.name); + const sourceFiles = arrayToMap(map(files, f => createSourceFile(f.name, f.content, ScriptTarget.ES6)), f => f.fileName); + const compilerHost: CompilerHost = { + fileExists : fileName => hasProperty(sourceFiles, fileName), + getSourceFile: fileName => sourceFiles[fileName], + getDefaultLibFileName: () => "lib.d.ts", + writeFile(file, text) { + throw new Error("NYI"); + }, + getCurrentDirectory: () => "/", + getCanonicalFileName: f => f.toLowerCase(), + getNewLine: () => "\r\n", + useCaseSensitiveFileNames: () => false, + readFile: fileName => hasProperty(sourceFiles, fileName) ? sourceFiles[fileName].text : undefined + }; + const program1 = createProgram(names, {}, compilerHost); + const diagnostics1 = program1.getFileProcessingDiagnostics().getDiagnostics(); + assert.equal(diagnostics1.length, 1, "expected one diagnostic"); + + const program2 = createProgram(names, {}, compilerHost, program1); + assert.isTrue(program1.structureIsReused); + const diagnostics2 = program1.getFileProcessingDiagnostics().getDiagnostics(); + assert.equal(diagnostics2.length, 1, "expected one diagnostic"); + assert.equal(diagnostics1[0].messageText, diagnostics2[0].messageText, "expected one diagnostic"); + }) + }); } \ No newline at end of file diff --git a/tests/cases/unittests/reuseProgramStructure.ts b/tests/cases/unittests/reuseProgramStructure.ts index 5f313eeae2b..61d5d56ca2c 100644 --- a/tests/cases/unittests/reuseProgramStructure.ts +++ b/tests/cases/unittests/reuseProgramStructure.ts @@ -118,13 +118,13 @@ module ts { return ""; }, getCanonicalFileName(fileName): string { - return sys.useCaseSensitiveFileNames ? fileName : fileName.toLowerCase(); + return sys && sys.useCaseSensitiveFileNames ? fileName : fileName.toLowerCase(); }, useCaseSensitiveFileNames(): boolean { - return sys.useCaseSensitiveFileNames; + return sys && sys.useCaseSensitiveFileNames; }, getNewLine(): string { - return sys.newLine; + return sys ? sys.newLine : newLine; }, fileExists: fileName => hasProperty(files, fileName), readFile: fileName => { @@ -160,36 +160,55 @@ module ts { return size; } - function checkResolvedModulesCache(program: Program, fileName: string, expectedContent: Map): void { + function checkResolvedModule(expected: ResolvedModule, actual: ResolvedModule): void { + assert.isTrue(actual !== undefined); + assert.isTrue(expected.resolvedFileName === actual.resolvedFileName, `'resolvedFileName': expected '${expected.resolvedFileName}' to be equal to '${actual.resolvedFileName}'`); + assert.isTrue(expected.isExternalLibraryImport === actual.isExternalLibraryImport, `'isExternalLibraryImport': expected '${expected.isExternalLibraryImport}' to be equal to '${actual.isExternalLibraryImport}'`); + } + + function checkResolvedTypeDirective(expected: ResolvedTypeReferenceDirective, actual: ResolvedTypeReferenceDirective): void { + assert.isTrue(actual !== undefined); + assert.isTrue(expected.resolvedFileName === actual.resolvedFileName, `'resolvedFileName': expected '${expected.resolvedFileName}' to be equal to '${actual.resolvedFileName}'`); + assert.isTrue(expected.primary === actual.primary, `'primary': expected '${expected.primary}' to be equal to '${actual.primary}'`); + } + + function checkCache(caption: string, program: Program, fileName: string, expectedContent: Map, getCache: (f: SourceFile) => Map, entryChecker: (expected: T, original:T) => void): void { let file = program.getSourceFile(fileName); assert.isTrue(file !== undefined, `cannot find file ${fileName}`); + const cache = getCache(file) if (expectedContent === undefined) { - assert.isTrue(file.resolvedModules === undefined, "expected resolvedModules to be undefined"); + assert.isTrue(cache === undefined, `expected ${caption} to be undefined`); } else { - assert.isTrue(file.resolvedModules !== undefined, "expected resolvedModuled to be set"); - let actualCacheSize = getSizeOfMap(file.resolvedModules); + assert.isTrue(cache !== undefined, `expected ${caption} to be set`); + let actualCacheSize = getSizeOfMap(cache); let expectedSize = getSizeOfMap(expectedContent); assert.isTrue(actualCacheSize === expectedSize, `expected actual size: ${actualCacheSize} to be equal to ${expectedSize}`); for (let id in expectedContent) { if (hasProperty(expectedContent, id)) { - assert.isTrue(hasProperty(file.resolvedModules, id), `expected ${id} to be found in resolved modules`); + if (expectedContent[id]) { const expected = expectedContent[id]; - const actual = file.resolvedModules[id]; - assert.isTrue(actual !== undefined); - assert.isTrue(expected.resolvedFileName === actual.resolvedFileName, `'resolvedFileName': expected '${expected.resolvedFileName}' to be equal to '${actual.resolvedFileName}'`); - assert.isTrue(expected.isExternalLibraryImport === actual.isExternalLibraryImport, `'shouldBeProperExternalModule': expected '${expected.isExternalLibraryImport}' to be equal to '${actual.isExternalLibraryImport}'`); - } - else { - assert.isTrue(file.resolvedModules[id] === undefined); + const actual = cache[id]; + entryChecker(expected, actual); } } + else { + assert.isTrue(cache[id] === undefined); + } } } } + function checkResolvedModulesCache(program: Program, fileName: string, expectedContent: Map): void { + checkCache("resolved modules", program, fileName, expectedContent, f => f.resolvedModules, checkResolvedModule); + } + + function checkResolvedTypeDirectivesCache(program: Program, fileName: string, expectedContent: Map): void { + checkCache("resolved type directives", program, fileName, expectedContent, f => f.resolvedTypeReferenceDirectiveNames, checkResolvedTypeDirective); + } + describe("Reuse program structure", () => { let target = ScriptTarget.Latest; let files = [ @@ -197,9 +216,11 @@ module ts { ` /// /// +/// `, "",`var x = 1`) }, { name: "b.ts", text: SourceText.New(`/// `, "", `var y = 2`) }, { name: "c.ts", text: SourceText.New("", "", `var z = 1;`) }, + { name: "types/typerefs/index.d.ts", text: SourceText.New("", "", `declare let z: number;`) }, ] it("successful if change does not affect imports", () => { @@ -213,6 +234,17 @@ module ts { assert.equal(program1Diagnostics.length, program2Diagnostics.length); }); + it("successful if change does not affect type reference directives", () => { + var program_1 = newProgram(files, ["a.ts"], { target }); + var program_2 = updateProgram(program_1, ["a.ts"], { target }, files => { + files[0].text = files[0].text.updateProgram("var x = 100"); + }); + assert.isTrue(program_1.structureIsReused); + let program1Diagnostics = program_1.getSemanticDiagnostics(program_1.getSourceFile("a.ts")) + let program2Diagnostics = program_2.getSemanticDiagnostics(program_1.getSourceFile("a.ts")) + assert.equal(program1Diagnostics.length, program2Diagnostics.length); + }); + it("fails if change affects tripleslash references", () => { var program_1 = newProgram(files, ["a.ts"], { target }); var program_2 = updateProgram(program_1, ["a.ts"], { target }, files => { @@ -232,11 +264,35 @@ module ts { assert.isTrue(!program_1.structureIsReused); }); + it("fails if change affects type directives", () => { + var program_1 = newProgram(files, ["a.ts"], { target }); + var program_2 = updateProgram(program_1, ["a.ts"], { target }, files => { + let newReferences = ` +/// +/// +/// `; + files[0].text = files[0].text.updateReferences(newReferences); + }); + assert.isTrue(!program_1.structureIsReused); + }); + it("fails if module kind changes", () => { var program_1 = newProgram(files, ["a.ts"], { target, module: ModuleKind.CommonJS }); var program_2 = updateProgram(program_1, ["a.ts"], { target, module: ModuleKind.AMD }, files => void 0); assert.isTrue(!program_1.structureIsReused); }); + + it("fails if rootdir changes", () => { + var program_1 = newProgram(files, ["a.ts"], { target, module: ModuleKind.CommonJS, rootDir: "/a/b" }); + var program_2 = updateProgram(program_1, ["a.ts"], { target, module: ModuleKind.CommonJS, rootDir: "/a/c" }, files => void 0); + assert.isTrue(!program_1.structureIsReused); + }); + + it("fails if config path changes", () => { + var program_1 = newProgram(files, ["a.ts"], { target, module: ModuleKind.CommonJS, configFilePath: "/a/b/tsconfig.json" }); + var program_2 = updateProgram(program_1, ["a.ts"], { target, module: ModuleKind.CommonJS, configFilePath: "/a/c/tsconfig.json" }, files => void 0); + assert.isTrue(!program_1.structureIsReused); + }); it("resolution cache follows imports", () => { let files = [ @@ -274,5 +330,49 @@ module ts { assert.isTrue(!program_3.structureIsReused); checkResolvedModulesCache(program_4, "a.ts", { "b": { resolvedFileName: "b.ts" }, "c": undefined }); }); - }) + + it("resolved type directives cache follows type directives", () => { + let files = [ + { name: "/a.ts", text: SourceText.New("/// ", "", "var x = $") }, + { name: "/types/typedefs/index.d.ts", text: SourceText.New("", "", "declare var $: number") }, + ]; + var options: CompilerOptions = { target, typesRoot: "/" }; + + var program_1 = newProgram(files, ["/a.ts"], options); + checkResolvedTypeDirectivesCache(program_1, "/a.ts", { "typedefs": { resolvedFileName: "/types/typedefs/index.d.ts", primary: true } }); + checkResolvedTypeDirectivesCache(program_1, "/types/typedefs/index.d.ts", undefined); + + var program_2 = updateProgram(program_1, ["/a.ts"], options, files => { + files[0].text = files[0].text.updateProgram("var x = 2"); + }); + assert.isTrue(program_1.structureIsReused); + + // content of resolution cache should not change + checkResolvedTypeDirectivesCache(program_1, "/a.ts", { "typedefs": { resolvedFileName: "/types/typedefs/index.d.ts", primary: true } }); + checkResolvedTypeDirectivesCache(program_1, "/types/typedefs/index.d.ts", undefined); + + // type reference directives has changed - program is not reused + var program_3 = updateProgram(program_2, ["/a.ts"], options, files => { + files[0].text = files[0].text.updateReferences(""); + }); + + assert.isTrue(!program_2.structureIsReused); + checkResolvedTypeDirectivesCache(program_3, "/a.ts", undefined); + + var program_4 = updateProgram(program_3, ["/a.ts"], options, files => { + let newReferences = `/// + /// + `; + files[0].text = files[0].text.updateReferences(newReferences); + }); + assert.isTrue(!program_3.structureIsReused); + checkResolvedTypeDirectivesCache(program_1, "/a.ts", { "typedefs": { resolvedFileName: "/types/typedefs/index.d.ts", primary: true } }); + }); + }); + + describe("host is optional", () => { + it("should work if host is not provided", () => { + createProgram([], {}); + }) + }); } \ No newline at end of file diff --git a/tests/cases/unittests/services/colorization.ts b/tests/cases/unittests/services/colorization.ts index 82f2e106aa4..f40dc730800 100644 --- a/tests/cases/unittests/services/colorization.ts +++ b/tests/cases/unittests/services/colorization.ts @@ -9,10 +9,10 @@ interface ClassificationEntry { describe('Colorization', function () { // Use the shim adapter to ensure test coverage of the shim layer for the classifier - var languageServiceAdapter = new Harness.LanguageService.ShimLanugageServiceAdapter(/*preprocessToResolve*/ false); + var languageServiceAdapter = new Harness.LanguageService.ShimLanguageServiceAdapter(/*preprocessToResolve*/ false); var classifier = languageServiceAdapter.getClassifier(); - function getEntryAtPosistion(result: ts.ClassificationResult, position: number) { + function getEntryAtPosition(result: ts.ClassificationResult, position: number) { var entryPosition = 0; for (var i = 0, n = result.entries.length; i < n; i++) { var entry = result.entries[i]; @@ -55,7 +55,7 @@ describe('Colorization', function () { var actualEntryPosition = expectedEntry.position !== undefined ? expectedEntry.position : text.indexOf(expectedEntry.value); assert(actualEntryPosition >= 0, "token: '" + expectedEntry.value + "' does not exit in text: '" + text + "'."); - var actualEntry = getEntryAtPosistion(result, actualEntryPosition); + var actualEntry = getEntryAtPosition(result, actualEntryPosition); assert(actualEntry, "Could not find classification entry for '" + expectedEntry.value + "' at position: " + actualEntryPosition); assert.equal(actualEntry.classification, expectedEntry.classification, "Classification class does not match expected. Expected: " + ts.TokenClass[expectedEntry.classification] + ", Actual: " + ts.TokenClass[actualEntry.classification]); diff --git a/tests/cases/unittests/services/preProcessFile.ts b/tests/cases/unittests/services/preProcessFile.ts index d9ddaf0f256..7fa25b440c5 100644 --- a/tests/cases/unittests/services/preProcessFile.ts +++ b/tests/cases/unittests/services/preProcessFile.ts @@ -1,48 +1,41 @@ /// /// +declare namespace chai.assert { + function deepEqual(actual: any, expected: any): void; +} + describe('PreProcessFile:', function () { function test(sourceText: string, readImportFile: boolean, detectJavaScriptImports: boolean, expectedPreProcess: ts.PreProcessedFileInfo): void { var resultPreProcess = ts.preProcessFile(sourceText, readImportFile, detectJavaScriptImports); - var resultIsLibFile = resultPreProcess.isLibFile; - var resultImportedFiles = resultPreProcess.importedFiles; - var resultReferencedFiles = resultPreProcess.referencedFiles; + assert.equal(resultPreProcess.isLibFile, expectedPreProcess.isLibFile, "Pre-processed file has different value for isLibFile. Expected: " + expectedPreProcess.isLibFile + ". Actual: " + resultPreProcess.isLibFile); - var expectedIsLibFile = expectedPreProcess.isLibFile; - var expectedImportedFiles = expectedPreProcess.importedFiles; - var expectedReferencedFiles = expectedPreProcess.referencedFiles; + checkFileReferenceList("Imported files", expectedPreProcess.importedFiles, resultPreProcess.importedFiles); + checkFileReferenceList("Referenced files", expectedPreProcess.referencedFiles, resultPreProcess.referencedFiles); + checkFileReferenceList("Type reference directives", expectedPreProcess.typeReferenceDirectives, resultPreProcess.typeReferenceDirectives); - assert.equal(resultIsLibFile, expectedIsLibFile, "Pre-processed file has different value for isLibFile. Expected: " + expectedPreProcess + ". Actual: " + resultIsLibFile); + assert.deepEqual(resultPreProcess.ambientExternalModules, expectedPreProcess.ambientExternalModules); + } - assert.equal(resultImportedFiles.length, expectedImportedFiles.length, - "Array's length of imported files does not match expected. Expected: " + expectedImportedFiles.length + ". Actual: " + resultImportedFiles.length); - - assert.equal(resultReferencedFiles.length, expectedReferencedFiles.length, - "Array's length of referenced files does not match expected. Expected: " + expectedReferencedFiles.length + ". Actual: " + resultReferencedFiles.length); - - for (var i = 0; i < expectedImportedFiles.length; ++i) { - var resultImportedFile = resultImportedFiles[i]; - var expectedImportedFile = expectedImportedFiles[i]; - - assert.equal(resultImportedFile.fileName, expectedImportedFile.fileName, "Imported file path does not match expected. Expected: " + expectedImportedFile.fileName + ". Actual: " + resultImportedFile.fileName + "."); - - assert.equal(resultImportedFile.pos, expectedImportedFile.pos, "Imported file position does not match expected. Expected: " + expectedImportedFile.pos + ". Actual: " + resultImportedFile.pos + "."); - - assert.equal(resultImportedFile.end, expectedImportedFile.end, "Imported file length does not match expected. Expected: " + expectedImportedFile.end + ". Actual: " + resultImportedFile.end + "."); + function checkFileReferenceList(kind: string, expected: ts.FileReference[], actual: ts.FileReference[]) { + if (expected === actual) { + return; } + if (!expected) { + assert.isTrue(false, `Expected ${JSON.stringify(expected)}, got ${JSON.stringify(actual)}`); + } + assert.equal(actual.length, expected.length, `[${kind}] Actual array's length does not match expected length. Expected files: ${JSON.stringify(expected)}, actual files: ${JSON.stringify(actual)}`); - for (var i = 0; i < expectedReferencedFiles.length; ++i) { - var resultReferencedFile = resultReferencedFiles[i]; - var expectedReferencedFile = expectedReferencedFiles[i]; - - assert.equal(resultReferencedFile.fileName, expectedReferencedFile.fileName, "Referenced file path does not match expected. Expected: " + expectedReferencedFile.fileName + ". Actual: " + resultReferencedFile.fileName + "."); - - assert.equal(resultReferencedFile.pos, expectedReferencedFile.pos, "Referenced file position does not match expected. Expected: " + expectedReferencedFile.pos + ". Actual: " + resultReferencedFile.pos + "."); - - assert.equal(resultReferencedFile.end, expectedReferencedFile.end, "Referenced file length does not match expected. Expected: " + expectedReferencedFile.end + ". Actual: " + resultReferencedFile.end + "."); + for (var i = 0; i < expected.length; ++i) { + var actualReference = actual[i]; + var expectedReference = expected[i]; + assert.equal(actualReference.fileName, expectedReference.fileName, `[${kind}] actual file path does not match expected. Expected: "${expectedReference.fileName}". Actual: "${actualReference.fileName}".`); + assert.equal(actualReference.pos, expectedReference.pos, `[${kind}] actual file start position does not match expected. Expected: "${expectedReference.pos}". Actual: "${actualReference.pos}".`); + assert.equal(actualReference.end, expectedReference.end, `[${kind}] actual file end pos does not match expected. Expected: "${expectedReference.end}". Actual: "${actualReference.end}".`); } } + describe("Test preProcessFiles,", function () { it("Correctly return referenced files from triple slash", function () { test("///" + "\n" + "///" + "\n" + "///" + "\n" + "///", @@ -52,6 +45,7 @@ describe('PreProcessFile:', function () { referencedFiles: [{ fileName: "refFile1.ts", pos: 0, end: 37 }, { fileName: "refFile2.ts", pos: 38, end: 73 }, { fileName: "refFile3.ts", pos: 74, end: 109 }, { fileName: "..\\refFile4d.ts", pos: 110, end: 150 }], importedFiles: [], + typeReferenceDirectives: [], ambientExternalModules: undefined, isLibFile: false }); @@ -64,6 +58,7 @@ describe('PreProcessFile:', function () { { referencedFiles: [], importedFiles: [], + typeReferenceDirectives: [], ambientExternalModules: undefined, isLibFile: false }); @@ -75,6 +70,7 @@ describe('PreProcessFile:', function () { /* detectJavaScriptImports */ false, { referencedFiles: [], + typeReferenceDirectives: [], importedFiles: [{ fileName: "r1.ts", pos: 20, end: 25 }, { fileName: "r2.ts", pos: 49, end: 54 }, { fileName: "r3.ts", pos: 78, end: 83 }, { fileName: "r4.ts", pos: 106, end: 111 }, { fileName: "r5.ts", pos: 138, end: 143 }], ambientExternalModules: undefined, @@ -88,6 +84,7 @@ describe('PreProcessFile:', function () { /* detectJavaScriptImports */ false, { referencedFiles: [], + typeReferenceDirectives: [], importedFiles: [], ambientExternalModules: undefined, isLibFile: false @@ -100,6 +97,7 @@ describe('PreProcessFile:', function () { /* detectJavaScriptImports */ false, { referencedFiles: [], + typeReferenceDirectives: [], importedFiles: [{ fileName: "r3.ts", pos: 73, end: 78 }], ambientExternalModules: undefined, isLibFile: false @@ -112,6 +110,7 @@ describe('PreProcessFile:', function () { /* detectJavaScriptImports */ false, { referencedFiles: [{ fileName: "refFile1.ts", pos: 0, end: 35 }, { fileName: "refFile2.ts", pos: 36, end: 71 }], + typeReferenceDirectives: [], importedFiles: [{ fileName: "r1.ts", pos: 92, end: 97 }, { fileName: "r2.ts", pos: 121, end: 126 }], ambientExternalModules: undefined, isLibFile: false @@ -124,6 +123,7 @@ describe('PreProcessFile:', function () { /* detectJavaScriptImports */ false, { referencedFiles: [{ fileName: "refFile1.ts", pos: 0, end: 35 }], + typeReferenceDirectives: [], importedFiles: [{ fileName: "r1.ts", pos: 91, end: 96 }, { fileName: "r3.ts", pos: 148, end: 153 }], ambientExternalModules: undefined, isLibFile: false @@ -142,6 +142,7 @@ describe('PreProcessFile:', function () { /* detectJavaScriptImports */ false, { referencedFiles: [], + typeReferenceDirectives: [], importedFiles: [ { fileName: "m1", pos: 20, end: 22 }, { fileName: "m2", pos: 51, end: 53 }, @@ -165,6 +166,7 @@ describe('PreProcessFile:', function () { /* detectJavaScriptImports */ false, { referencedFiles: [], + typeReferenceDirectives: [], importedFiles: [ { fileName: "m1", pos: 14, end: 16 }, { fileName: "m2", pos: 36, end: 38 }, @@ -183,11 +185,12 @@ describe('PreProcessFile:', function () { function foo() { } `, - /* readImports */ false, + /* readImports */ true, /* detectJavaScriptImports */ false, { referencedFiles: [], + typeReferenceDirectives: [], importedFiles: [], ambientExternalModules: ["B"], isLibFile: false @@ -200,6 +203,7 @@ describe('PreProcessFile:', function () { /* detectJavaScriptImports */ false, { referencedFiles: [], + typeReferenceDirectives: [], importedFiles: [ { fileName: "m1", pos: 26, end: 28 } ], @@ -218,6 +222,7 @@ describe('PreProcessFile:', function () { /* detectJavaScriptImports */ true, { referencedFiles: [], + typeReferenceDirectives: [], importedFiles: [ { fileName: "m1", pos: 39, end: 41 }, { fileName: "m2", pos: 74, end: 76 }, @@ -237,6 +242,7 @@ describe('PreProcessFile:', function () { /* detectJavaScriptImports */ true, { referencedFiles: [], + typeReferenceDirectives: [], importedFiles: [ { fileName: "mod1", pos: 21, end: 25 }, { fileName: "mod2", pos: 29, end: 33 }, @@ -254,6 +260,7 @@ describe('PreProcessFile:', function () { /* detectJavaScriptImports */ true, { referencedFiles: [], + typeReferenceDirectives: [], importedFiles: [ { fileName: "mod1", pos: 28, end: 32 }, { fileName: "mod2", pos: 36, end: 40 }, @@ -262,6 +269,196 @@ describe('PreProcessFile:', function () { isLibFile: false }) }); + it("correctly handles augmentations in external modules - 1", () => { + test(` + declare module "../Observable" { + interface I {} + } + + export {} + `, + /*readImportFile*/ true, + /*detectJavaScriptImports*/ false, + { + referencedFiles: [], + typeReferenceDirectives: [], + importedFiles: [ + { "fileName": "../Observable", "pos": 28, "end": 41 } + ], + ambientExternalModules: undefined, + isLibFile: false + }) + }); + it("correctly handles augmentations in external modules - 2", () => { + test(` + declare module "../Observable" { + interface I {} + } + + import * as x from "m"; + `, + /*readImportFile*/ true, + /*detectJavaScriptImports*/ false, + { + referencedFiles: [], + typeReferenceDirectives: [], + importedFiles: [ + { "fileName": "m", "pos": 135, "end": 136 }, + { "fileName": "../Observable", "pos": 28, "end": 41 } + ], + ambientExternalModules: undefined, + isLibFile: false + }) + }); + it("correctly handles augmentations in external modules - 3", () => { + test(` + declare module "../Observable" { + interface I {} + } + + import m = require("m"); + `, + /*readImportFile*/ true, + /*detectJavaScriptImports*/ false, + { + referencedFiles: [], + typeReferenceDirectives: [], + importedFiles: [ + { "fileName": "m", "pos": 135, "end": 136 }, + { "fileName": "../Observable", "pos": 28, "end": 41 } + ], + ambientExternalModules: undefined, + isLibFile: false + }) + }); + it("correctly handles augmentations in external modules - 4", () => { + test(` + declare module "../Observable" { + interface I {} + } + namespace N {} + export = N; + `, + /*readImportFile*/ true, + /*detectJavaScriptImports*/ false, + { + referencedFiles: [], + typeReferenceDirectives: [], + importedFiles: [ + { "fileName": "../Observable", "pos": 28, "end": 41 } + ], + ambientExternalModules: undefined, + isLibFile: false + }) + }); + it("correctly handles augmentations in external modules - 5", () => { + test(` + declare module "../Observable" { + interface I {} + } + namespace N {} + export import IN = N; + `, + /*readImportFile*/ true, + /*detectJavaScriptImports*/ false, + { + referencedFiles: [], + typeReferenceDirectives: [], + importedFiles: [ + { "fileName": "../Observable", "pos": 28, "end": 41 } + ], + ambientExternalModules: undefined, + isLibFile: false + }) + }); + it("correctly handles augmentations in external modules - 6", () => { + test(` + declare module "../Observable" { + interface I {} + } + export let x = 1; + `, + /*readImportFile*/ true, + /*detectJavaScriptImports*/ false, + { + referencedFiles: [], + typeReferenceDirectives: [], + importedFiles: [ + { "fileName": "../Observable", "pos": 28, "end": 41 } + ], + ambientExternalModules: undefined, + isLibFile: false + }) + }); + it ("correctly handles augmentations in ambient external modules - 1", () => { + test(` + declare module "m1" { + export * from "m2"; + declare module "augmentation" { + interface I {} + } + } + `, + /*readImportFile*/ true, + /*detectJavaScriptImports*/ false, + { + referencedFiles: [], + typeReferenceDirectives: [], + importedFiles: [ + { "fileName": "m2", "pos": 65, "end": 67 }, + { "fileName": "augmentation", "pos": 102, "end": 114 } + ], + ambientExternalModules: ["m1"], + isLibFile: false + }); + }); + it ("correctly handles augmentations in ambient external modules - 2", () => { + test(` + namespace M { var x; } + import IM = M; + declare module "m1" { + export * from "m2"; + declare module "augmentation" { + interface I {} + } + } + `, + /*readImportFile*/ true, + /*detectJavaScriptImports*/ false, + { + referencedFiles: [], + typeReferenceDirectives: [], + importedFiles: [ + { "fileName": "m2", "pos": 127, "end": 129 }, + { "fileName": "augmentation", "pos": 164, "end": 176 } + ], + ambientExternalModules: ["m1"], + isLibFile: false + }); + }); + it ("correctly recognizes type reference directives", () => { + test(` + /// + /// + /// + /// + `, + /*readImportFile*/ true, + /*detectJavaScriptImports*/ false, + { + referencedFiles: [ + { "pos": 13, "end": 38, "fileName": "a" }, + { "pos": 91, "end": 117, "fileName": "a2" } + ], + typeReferenceDirectives: [ + { "pos": 51, "end": 78, "fileName": "a1" }, + { "pos": 130, "end": 157, "fileName": "a3" } + ], + importedFiles: [], + ambientExternalModules: undefined, + isLibFile: false + }); + }) }); }); diff --git a/tests/cases/unittests/session.ts b/tests/cases/unittests/session.ts index 41f4bc599f6..a90f7d2ec84 100644 --- a/tests/cases/unittests/session.ts +++ b/tests/cases/unittests/session.ts @@ -18,7 +18,9 @@ namespace ts.server { getExecutingFilePath(): string { return void 0; }, getCurrentDirectory(): string { return void 0; }, readDirectory(): string[] { return []; }, - exit(): void {} + exit(): void { }, + setTimeout(callback, ms, ...args) { return 0; }, + clearTimeout(timeoutId) { } }; const mockLogger: Logger = { close(): void {}, @@ -36,7 +38,7 @@ namespace ts.server { let lastSent: protocol.Message; beforeEach(() => { - session = new Session(mockHost, Buffer.byteLength, process.hrtime, mockLogger); + session = new Session(mockHost, Utils.byteLength, process.hrtime, mockLogger); session.send = (msg: protocol.Message) => { lastSent = msg; }; @@ -161,7 +163,7 @@ namespace ts.server { it("is an overrideable handle which sends protocol messages over the wire", () => { const msg = {seq: 0, type: "none"}; const strmsg = JSON.stringify(msg); - const len = 1 + Buffer.byteLength(strmsg, "utf8"); + const len = 1 + Utils.byteLength(strmsg, "utf8"); const resultMsg = `Content-Length: ${len}\r\n\r\n${strmsg}\n`; session.send = Session.prototype.send; @@ -253,7 +255,7 @@ namespace ts.server { lastSent: protocol.Message; customHandler = "testhandler"; constructor() { - super(mockHost, Buffer.byteLength, process.hrtime, mockLogger); + super(mockHost, Utils.byteLength, process.hrtime, mockLogger); this.addProtocolHandler(this.customHandler, () => { return {response: undefined, responseRequired: true}; }); @@ -311,7 +313,7 @@ namespace ts.server { class InProcSession extends Session { private queue: protocol.Request[] = []; constructor(private client: InProcClient) { - super(mockHost, Buffer.byteLength, process.hrtime, mockLogger); + super(mockHost, Utils.byteLength, process.hrtime, mockLogger); this.addProtocolHandler("echo", (req: protocol.Request) => ({ response: req.arguments, responseRequired: true diff --git a/tests/cases/unittests/transpile.ts b/tests/cases/unittests/transpile.ts index 882b4e2094b..4a821071439 100644 --- a/tests/cases/unittests/transpile.ts +++ b/tests/cases/unittests/transpile.ts @@ -85,11 +85,6 @@ module ts { } - it("Generates correct compilerOptions diagnostics", () => { - // Expecting 5047: "Option 'isolatedModules' can only be used when either option'--module' is provided or option 'target' is 'ES6' or higher." - test(`var x = 0;`, { expectedDiagnosticCodes: [5047] }); - }); - it("Generates no diagnostics with valid inputs", () => { // No errors test(`var x = 0;`, { options: { compilerOptions: { module: ModuleKind.CommonJS } } }); @@ -134,7 +129,10 @@ var x = 0;`, it("Sets module name", () => { let output = - `System.register("NamedModule", [], function(exports_1, __moduleName) {\n "use strict";\n var x;\n` + + `System.register("NamedModule", [], function(exports_1, context_1) {\n` + + ` "use strict";\n` + + ` var __moduleName = context_1 && context_1.id;\n` + + ` var x;\n` + ` return {\n` + ` setters:[],\n` + ` execute: function() {\n` + @@ -159,8 +157,9 @@ var x = 0;`, `declare function use(a: any);\n` + `use(foo);` let output = - `System.register(["SomeOtherName"], function(exports_1, __moduleName) {\n` + + `System.register(["SomeOtherName"], function(exports_1, context_1) {\n` + ` "use strict";\n` + + ` var __moduleName = context_1 && context_1.id;\n` + ` var SomeName_1;\n` + ` return {\n` + ` setters:[\n` + @@ -278,7 +277,7 @@ var x = 0;`, it("Supports backslashes in file name", () => { test("var x", { expectedOutput: `"use strict";\r\nvar x;\r\n`, options: { fileName: "a\\b.ts" }}); }); - + it("transpile file as 'tsx' if 'jsx' is specified", () => { let input = `var x =
`; let output = `"use strict";\nvar x = React.createElement("div", null);\n`; @@ -287,5 +286,19 @@ var x = 0;`, options: { compilerOptions: { jsx: JsxEmit.React, newLine: NewLineKind.LineFeed } } }) }); + + it("transpile .js files", () => { + const input = "const a = 10;"; + const output = `"use strict";\nvar a = 10;\n`; + test(input, { + expectedOutput: output, + options: { compilerOptions: { newLine: NewLineKind.LineFeed, module: ModuleKind.CommonJS }, fileName: "input.js", reportDiagnostics: true }, + expectedDiagnosticCodes: [] + }); + }) + + it("Supports urls in file name", () => { + test("var x", { expectedOutput: `"use strict";\r\nvar x;\r\n`, options: { fileName: "http://somewhere/directory//directory2/file.ts" } }); + }); }); } diff --git a/tests/cases/unittests/tsconfigParsing.ts b/tests/cases/unittests/tsconfigParsing.ts index 3603d22f314..581575c9479 100644 --- a/tests/cases/unittests/tsconfigParsing.ts +++ b/tests/cases/unittests/tsconfigParsing.ts @@ -2,6 +2,31 @@ /// namespace ts { + class MockParseConfigHost extends Utils.VirtualFileSystem implements ParseConfigHost { + constructor(currentDirectory: string, ignoreCase: boolean, files: string[]) { + super(currentDirectory, ignoreCase); + for (const file of files) { + this.addFile(file); + } + } + + readDirectory(path: string, extensions: string[], excludes: string[], includes: string[]) { + return matchFiles(path, extensions, excludes, includes, this.useCaseSensitiveFileNames, this.currentDirectory, (path: string) => this.getAccessibleFileSystemEntries(path)); + } + + getAccessibleFileSystemEntries(path: string) { + const entry = this.traversePath(path); + if (entry && entry.isDirectory()) { + const directory = entry; + return { + files: map(directory.getFiles(), f => f.name), + directories: map(directory.getDirectories(), d => d.name) + }; + } + return { files: [], directories: [] }; + } + } + describe('parseConfigFileTextToJson', () => { function assertParseResult(jsonText: string, expectedConfigObject: { config?: any; error?: Diagnostic }) { let parsed = ts.parseConfigFileTextToJson("/apath/tsconfig.json", jsonText); @@ -14,6 +39,40 @@ namespace ts { assert.isTrue(undefined !== parsed.error); } + function assertParseErrorWithExcludesKeyword(jsonText: string) { + let parsed = ts.parseConfigFileTextToJson("/apath/tsconfig.json", jsonText); + let parsedCommand = ts.parseJsonConfigFileContent(parsed, ts.sys, "tests/cases/unittests"); + assert.isTrue(undefined !== parsedCommand.errors); + } + + function assertParseFileList(jsonText: string, configFileName: string, basePath: string, allFileList: string[], expectedFileList: string[]) { + const json = JSON.parse(jsonText); + const host: ParseConfigHost = new MockParseConfigHost(basePath, true, allFileList); + const parsed = ts.parseJsonConfigFileContent(json, host, basePath, /*existingOptions*/ undefined, configFileName); + assert.isTrue(arrayIsEqualTo(parsed.fileNames.sort(), expectedFileList.sort())); + + function mockReadDirectory(rootDir: string, extension: string, exclude: string[]): string[] { + const result: string[] = []; + const fullExcludeDirectories = ts.map(exclude, directory => combinePaths(rootDir, directory)); + for (const file of allFileList) { + let shouldExclude = false; + for (const fullExcludeDirectorie of fullExcludeDirectories) { + if (file.indexOf(fullExcludeDirectorie) >= 0) { + shouldExclude = true; + break; + } + } + if (shouldExclude) { + continue; + } + if (fileExtensionIs(file, extension)) { + result.push(file); + } + } + return result; + } + } + it("returns empty config for file with only whitespaces", () => { assertParseResult("", { config : {} }); assertParseResult(" ", { config : {} }); @@ -82,5 +141,90 @@ namespace ts { it("returns object with error when json is invalid", () => { assertParseError("invalid"); }); + + it("returns object when users correctly specify library", () => { + assertParseResult( + `{ + "compilerOptions": { + "lib": "es5" + } + }`, { + config: { compilerOptions: { lib: "es5" } } + }); + + assertParseResult( + `{ + "compilerOptions": { + "lib": "es5,es6" + } + }`, { + config: { compilerOptions: { lib: "es5,es6" } } + }); + }); + + it("returns error when tsconfig have excludes", () => { + assertParseErrorWithExcludesKeyword( + `{ + "compilerOptions": { + "lib": "es5" + }, + "excludes": [ + "foge.ts" + ] + }`); + }); + + it("ignore dotted files and folders", () => { + assertParseFileList( + `{}`, + "tsconfig.json", + "/apath", + ["/apath/test.ts", "/apath/.git/a.ts", "/apath/.b.ts", "/apath/..c.ts"], + ["/apath/test.ts"] + ) + }); + + it("allow dotted files and folders when explicitly requested", () => { + assertParseFileList( + `{ + "files": ["/apath/.git/a.ts", "/apath/.b.ts", "/apath/..c.ts"] + }`, + "tsconfig.json", + "/apath", + ["/apath/test.ts", "/apath/.git/a.ts", "/apath/.b.ts", "/apath/..c.ts"], + ["/apath/.git/a.ts", "/apath/.b.ts", "/apath/..c.ts"] + ) + }); + + it("always exclude outDir", () => { + const tsconfigWithoutExclude = + `{ + "compilerOptions": { + "outDir": "bin" + } + }`; + const tsconfigWithExclude = + `{ + "compilerOptions": { + "outDir": "bin" + }, + "exclude": [ "obj" ] + }`; + const rootDir = "/"; + const allFiles = ["/bin/a.ts", "/b.ts"]; + const expectedFiles = ["/b.ts"]; + assertParseFileList(tsconfigWithoutExclude, "tsconfig.json", rootDir, allFiles, expectedFiles); + assertParseFileList(tsconfigWithExclude, "tsconfig.json", rootDir, allFiles, expectedFiles); + }) + + it("implicitly exclude common package folders", () => { + assertParseFileList( + `{}`, + "tsconfig.json", + "/", + ["/node_modules/a.ts", "/bower_components/b.ts", "/jspm_packages/c.ts", "/d.ts", "/folder/e.ts"], + ["/d.ts", "/folder/e.ts"] + ) + }) }); } diff --git a/tests/cases/unittests/versionCache.ts b/tests/cases/unittests/versionCache.ts index c1d283ca8cd..131b40278a7 100644 --- a/tests/cases/unittests/versionCache.ts +++ b/tests/cases/unittests/versionCache.ts @@ -1,13 +1,13 @@ /// /// -module ts { +namespace ts { function editFlat(position: number, deletedLength: number, newText: string, source: string) { return source.substring(0, position) + newText + source.substring(position + deletedLength, source.length); } function lineColToPosition(lineIndex: server.LineIndex, line: number, col: number) { - var lineInfo = lineIndex.lineNumberToInfo(line); + const lineInfo = lineIndex.lineNumberToInfo(line); return (lineInfo.offset + col - 1); } @@ -19,9 +19,9 @@ module ts { assert.equal(editedText, checkText); } - describe('VersionCache TS code', () => { + describe(`VersionCache TS code`, () => { let validateEditAtLineCharIndex: (line: number, char: number, deleteLength: number, insertString: string) => void; - + before(() => { let testContent = `/// var x = 10; @@ -32,9 +32,9 @@ class Point { } k=y; var p:Point=new Point(); -var q:Point=p;` +var q:Point=p;`; - let {lines, lineMap} = server.LineIndex.linesFromText(testContent); + let { lines } = server.LineIndex.linesFromText(testContent); assert.isTrue(lines.length > 0, "Failed to initialize test text. Expected text to have at least one line"); let lineIndex = new server.LineIndex(); @@ -48,34 +48,34 @@ var q:Point=p;` after(() => { validateEditAtLineCharIndex = undefined; - }) + }); - it('change 9 1 0 1 {"y"}', () => { + it(`change 9 1 0 1 {"y"}`, () => { validateEditAtLineCharIndex(9, 1, 0, "y"); }); - it('change 9 2 0 1 {"."}', () => { + it(`change 9 2 0 1 {"."}`, () => { validateEditAtLineCharIndex(9, 2, 0, "."); }); - it('change 9 3 0 1 {"\\n"}', () => { + it(`change 9 3 0 1 {"\\n"}`, () => { validateEditAtLineCharIndex(9, 3, 0, "\n"); }); - it('change 10 1 0 10 {"\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n"}', () => { + it(`change 10 1 0 10 {"\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n"}`, () => { validateEditAtLineCharIndex(10, 1, 0, "\n\n\n\n\n\n\n\n\n\n"); }); - it('change 19 1 1 0', () => { + it(`change 19 1 1 0`, () => { validateEditAtLineCharIndex(19, 1, 1, ""); }); - it('change 18 1 1 0', () => { + it(`change 18 1 1 0`, () => { validateEditAtLineCharIndex(18, 1, 1, ""); }); }); - describe('VersionCache simple text', () => { + describe(`VersionCache simple text`, () => { let validateEditAtPosition: (position: number, deleteLength: number, insertString: string) => void; let testContent: string; let lines: string[]; @@ -88,7 +88,7 @@ that ate the grass that was purple at the tips and grew 1cm per day`; - ({lines, lineMap} = server.LineIndex.linesFromText(testContent)); + ({ lines, lineMap } = server.LineIndex.linesFromText(testContent)); assert.isTrue(lines.length > 0, "Failed to initialize test text. Expected text to have at least one line"); let lineIndex = new server.LineIndex(); @@ -96,90 +96,90 @@ and grew 1cm per day`; validateEditAtPosition = (position: number, deleteLength: number, insertString: string) => { validateEdit(lineIndex, testContent, position, deleteLength, insertString); - } + }; }); after(() => { - validateEditAtPosition = undefined; - testContent = undefined; - lines = undefined; - lineMap = undefined; + validateEditAtPosition = undefined; + testContent = undefined; + lines = undefined; + lineMap = undefined; }); - it('Insert at end of file', () => { + it(`Insert at end of file`, () => { validateEditAtPosition(testContent.length, 0, "hmmmm...\r\n"); }); - it('Unusual line endings merge', () => { + it(`Unusual line endings merge`, () => { validateEditAtPosition(lines[0].length - 1, lines[1].length, ""); }); - it('Delete whole line and nothing but line (last line)', () => { + it(`Delete whole line and nothing but line (last line)`, () => { validateEditAtPosition(lineMap[lineMap.length - 2], lines[lines.length - 1].length, ""); }); - it('Delete whole line and nothing but line (first line)', () => { + it(`Delete whole line and nothing but line (first line)`, () => { validateEditAtPosition(0, lines[0].length, ""); }); - it('Delete whole line (first line) and insert with no line breaks', () => { + it(`Delete whole line (first line) and insert with no line breaks`, () => { validateEditAtPosition(0, lines[0].length, "moo, moo, moo! "); }); - it('Delete whole line (first line) and insert with multiple line breaks', () => { + it(`Delete whole line (first line) and insert with multiple line breaks`, () => { validateEditAtPosition(0, lines[0].length, "moo, \r\nmoo, \r\nmoo! "); }); - it('Delete multiple lines and nothing but lines (first and second lines)', () => { + it(`Delete multiple lines and nothing but lines (first and second lines)`, () => { validateEditAtPosition(0, lines[0].length + lines[1].length, ""); }); - it('Delete multiple lines and nothing but lines (second and third lines)', () => { + it(`Delete multiple lines and nothing but lines (second and third lines)`, () => { validateEditAtPosition(lines[0].length, lines[1].length + lines[2].length, ""); }); - it('Insert multiple line breaks', () => { + it(`Insert multiple line breaks`, () => { validateEditAtPosition(21, 1, "cr...\r\ncr...\r\ncr...\r\ncr...\r\ncr...\r\ncr...\r\ncr...\r\ncr...\r\ncr...\r\ncr...\r\ncr...\r\ncr"); }); - it('Insert multiple line breaks', () => { + it(`Insert multiple line breaks`, () => { validateEditAtPosition(21, 1, "cr...\r\ncr...\r\ncr"); }); - it('Insert multiple line breaks with leading \\n', () => { + it(`Insert multiple line breaks with leading \\n`, () => { validateEditAtPosition(21, 1, "\ncr...\r\ncr...\r\ncr"); }); - it('Single line no line breaks deleted or inserted, delete 1 char', () => { + it(`Single line no line breaks deleted or inserted, delete 1 char`, () => { validateEditAtPosition(21, 1, ""); }); - it('Single line no line breaks deleted or inserted, insert 1 char', () => { + it(`Single line no line breaks deleted or inserted, insert 1 char`, () => { validateEditAtPosition(21, 0, "b"); }); - it('Single line no line breaks deleted or inserted, delete 1, insert 2 chars', () => { + it(`Single line no line breaks deleted or inserted, delete 1, insert 2 chars`, () => { validateEditAtPosition(21, 1, "cr"); }); - it('Delete across line break (just the line break)', () => { + it(`Delete across line break (just the line break)`, () => { validateEditAtPosition(21, 22, ""); }); - it('Delete across line break', () => { + it(`Delete across line break`, () => { validateEditAtPosition(21, 32, ""); }); - it('Delete across multiple line breaks and insert no line breaks', () => { + it(`Delete across multiple line breaks and insert no line breaks`, () => { validateEditAtPosition(21, 42, ""); }); - it('Delete across multiple line breaks and insert text', () => { + it(`Delete across multiple line breaks and insert text`, () => { validateEditAtPosition(21, 42, "slithery "); }); }); - describe('VersionCache stress test', () => { + describe(`VersionCache stress test`, () => { let rsa: number[] = []; let la: number[] = []; let las: number[] = []; @@ -187,7 +187,7 @@ and grew 1cm per day`; let ersa: number[] = []; let ela: number[] = []; const iterationCount = 20; - //const iterationCount = 20000; // uncomment for testing + // const iterationCount = 20000; // uncomment for testing let lines: string[]; let lineMap: number[]; let lineIndex: server.LineIndex; @@ -200,7 +200,7 @@ and grew 1cm per day`; let totalChars = testContent.length; assert.isTrue(totalChars > 0, "Failed to read test file."); - ({lines, lineMap} = server.LineIndex.linesFromText(testContent)); + ({ lines, lineMap } = server.LineIndex.linesFromText(testContent)); assert.isTrue(lines.length > 0, "Failed to initialize test text. Expected text to have at least one line"); lineIndex = new server.LineIndex(); @@ -271,7 +271,7 @@ and grew 1cm per day`; }); it("Edit ScriptVersionCache ", () => { - let svc = server.ScriptVersionCache.fromString(ts.sys, testContent); + let svc = server.ScriptVersionCache.fromString(ts.sys, testContent); let checkText = testContent; for (let i = 0; i < iterationCount; i++) { @@ -316,4 +316,4 @@ and grew 1cm per day`; } }); }); -} +} \ No newline at end of file diff --git a/tslint.json b/tslint.json index 2d2e42d4383..f789af46cea 100644 --- a/tslint.json +++ b/tslint.json @@ -13,7 +13,8 @@ ], "no-var-keyword": true, "quotemark": [true, - "double" + "double", + "avoid-escape" ], "semicolon": true, "whitespace": [true, @@ -37,7 +38,7 @@ "no-internal-module": true, "no-trailing-whitespace": true, "no-inferrable-types": true, - "no-null": true, + "no-null-keyword": true, "no-unused-variable": true, "boolean-trivia": true, "type-operator-spacing": true,

{ x: P; } >C : Symbol(C, Decl(genericConstraint3.ts, 0, 0)) >P : Symbol(P, Decl(genericConstraint3.ts, 0, 12)) ->x : Symbol(x, Decl(genericConstraint3.ts, 0, 16)) +>x : Symbol(C.x, Decl(genericConstraint3.ts, 0, 16)) >P : Symbol(P, Decl(genericConstraint3.ts, 0, 12)) interface A> { x: U; } @@ -11,7 +11,7 @@ interface A> { x: U; } >U : Symbol(U, Decl(genericConstraint3.ts, 1, 14)) >C : Symbol(C, Decl(genericConstraint3.ts, 0, 0)) >T : Symbol(T, Decl(genericConstraint3.ts, 1, 12)) ->x : Symbol(x, Decl(genericConstraint3.ts, 1, 32)) +>x : Symbol(A.x, Decl(genericConstraint3.ts, 1, 32)) >U : Symbol(U, Decl(genericConstraint3.ts, 1, 14)) interface B extends A<{}, { x: {} }> { } // Should not produce an error diff --git a/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes.symbols b/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes.symbols index 68df4a89b36..57c0e6d0a21 100644 --- a/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes.symbols +++ b/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes.symbols @@ -6,12 +6,12 @@ declare module EndGate { >ICloneable : Symbol(ICloneable, Decl(genericConstraintOnExtendedBuiltinTypes.ts, 0, 24)) Clone(): any; ->Clone : Symbol(Clone, Decl(genericConstraintOnExtendedBuiltinTypes.ts, 1, 33)) +>Clone : Symbol(ICloneable.Clone, Decl(genericConstraintOnExtendedBuiltinTypes.ts, 1, 33)) } } interface Number extends EndGate.ICloneable { } ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(genericConstraintOnExtendedBuiltinTypes.ts, 4, 1)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(genericConstraintOnExtendedBuiltinTypes.ts, 4, 1)) >EndGate.ICloneable : Symbol(EndGate.ICloneable, Decl(genericConstraintOnExtendedBuiltinTypes.ts, 0, 24)) >EndGate : Symbol(EndGate, Decl(genericConstraintOnExtendedBuiltinTypes.ts, 0, 0), Decl(genericConstraintOnExtendedBuiltinTypes.ts, 6, 47), Decl(genericConstraintOnExtendedBuiltinTypes.ts, 17, 1)) >ICloneable : Symbol(EndGate.ICloneable, Decl(genericConstraintOnExtendedBuiltinTypes.ts, 0, 24)) @@ -26,7 +26,7 @@ module EndGate.Tweening { >ICloneable : Symbol(ICloneable, Decl(genericConstraintOnExtendedBuiltinTypes.ts, 0, 24)) private _from: T; ->_from : Symbol(_from, Decl(genericConstraintOnExtendedBuiltinTypes.ts, 9, 45)) +>_from : Symbol(Tween._from, Decl(genericConstraintOnExtendedBuiltinTypes.ts, 9, 45)) >T : Symbol(T, Decl(genericConstraintOnExtendedBuiltinTypes.ts, 9, 23)) @@ -35,9 +35,9 @@ module EndGate.Tweening { >T : Symbol(T, Decl(genericConstraintOnExtendedBuiltinTypes.ts, 9, 23)) this._from = from.Clone(); ->this._from : Symbol(_from, Decl(genericConstraintOnExtendedBuiltinTypes.ts, 9, 45)) +>this._from : Symbol(Tween._from, Decl(genericConstraintOnExtendedBuiltinTypes.ts, 9, 45)) >this : Symbol(Tween, Decl(genericConstraintOnExtendedBuiltinTypes.ts, 8, 25)) ->_from : Symbol(_from, Decl(genericConstraintOnExtendedBuiltinTypes.ts, 9, 45)) +>_from : Symbol(Tween._from, Decl(genericConstraintOnExtendedBuiltinTypes.ts, 9, 45)) >from.Clone : Symbol(ICloneable.Clone, Decl(genericConstraintOnExtendedBuiltinTypes.ts, 1, 33)) >from : Symbol(from, Decl(genericConstraintOnExtendedBuiltinTypes.ts, 13, 20)) >Clone : Symbol(ICloneable.Clone, Decl(genericConstraintOnExtendedBuiltinTypes.ts, 1, 33)) diff --git a/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes2.symbols b/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes2.symbols index c5e9f0a79f5..63251ba000d 100644 --- a/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes2.symbols +++ b/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes2.symbols @@ -6,12 +6,12 @@ module EndGate { >ICloneable : Symbol(ICloneable, Decl(genericConstraintOnExtendedBuiltinTypes2.ts, 0, 16)) Clone(): any; ->Clone : Symbol(Clone, Decl(genericConstraintOnExtendedBuiltinTypes2.ts, 1, 33)) +>Clone : Symbol(ICloneable.Clone, Decl(genericConstraintOnExtendedBuiltinTypes2.ts, 1, 33)) } } interface Number extends EndGate.ICloneable { } ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(genericConstraintOnExtendedBuiltinTypes2.ts, 4, 1)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(genericConstraintOnExtendedBuiltinTypes2.ts, 4, 1)) >EndGate.ICloneable : Symbol(EndGate.ICloneable, Decl(genericConstraintOnExtendedBuiltinTypes2.ts, 0, 16)) >EndGate : Symbol(EndGate, Decl(genericConstraintOnExtendedBuiltinTypes2.ts, 0, 0), Decl(genericConstraintOnExtendedBuiltinTypes2.ts, 6, 47), Decl(genericConstraintOnExtendedBuiltinTypes2.ts, 16, 1)) >ICloneable : Symbol(EndGate.ICloneable, Decl(genericConstraintOnExtendedBuiltinTypes2.ts, 0, 16)) @@ -26,7 +26,7 @@ module EndGate.Tweening { >ICloneable : Symbol(ICloneable, Decl(genericConstraintOnExtendedBuiltinTypes2.ts, 0, 16)) private _from: T; ->_from : Symbol(_from, Decl(genericConstraintOnExtendedBuiltinTypes2.ts, 9, 45)) +>_from : Symbol(Tween._from, Decl(genericConstraintOnExtendedBuiltinTypes2.ts, 9, 45)) >T : Symbol(T, Decl(genericConstraintOnExtendedBuiltinTypes2.ts, 9, 23)) constructor(from: T) { @@ -34,9 +34,9 @@ module EndGate.Tweening { >T : Symbol(T, Decl(genericConstraintOnExtendedBuiltinTypes2.ts, 9, 23)) this._from = from.Clone(); ->this._from : Symbol(_from, Decl(genericConstraintOnExtendedBuiltinTypes2.ts, 9, 45)) +>this._from : Symbol(Tween._from, Decl(genericConstraintOnExtendedBuiltinTypes2.ts, 9, 45)) >this : Symbol(Tween, Decl(genericConstraintOnExtendedBuiltinTypes2.ts, 8, 25)) ->_from : Symbol(_from, Decl(genericConstraintOnExtendedBuiltinTypes2.ts, 9, 45)) +>_from : Symbol(Tween._from, Decl(genericConstraintOnExtendedBuiltinTypes2.ts, 9, 45)) >from.Clone : Symbol(ICloneable.Clone, Decl(genericConstraintOnExtendedBuiltinTypes2.ts, 1, 33)) >from : Symbol(from, Decl(genericConstraintOnExtendedBuiltinTypes2.ts, 12, 20)) >Clone : Symbol(ICloneable.Clone, Decl(genericConstraintOnExtendedBuiltinTypes2.ts, 1, 33)) @@ -51,7 +51,7 @@ module EndGate.Tweening { export class NumberTween extends Tween{ >NumberTween : Symbol(NumberTween, Decl(genericConstraintOnExtendedBuiltinTypes2.ts, 18, 25)) >Tween : Symbol(Tween, Decl(genericConstraintOnExtendedBuiltinTypes2.ts, 8, 25)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(genericConstraintOnExtendedBuiltinTypes2.ts, 4, 1)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(genericConstraintOnExtendedBuiltinTypes2.ts, 4, 1)) constructor(from: number) { >from : Symbol(from, Decl(genericConstraintOnExtendedBuiltinTypes2.ts, 20, 20)) diff --git a/tests/baselines/reference/genericDerivedTypeWithSpecializedBase2.errors.txt b/tests/baselines/reference/genericDerivedTypeWithSpecializedBase2.errors.txt index 38818b59863..1e5e3b6ee96 100644 --- a/tests/baselines/reference/genericDerivedTypeWithSpecializedBase2.errors.txt +++ b/tests/baselines/reference/genericDerivedTypeWithSpecializedBase2.errors.txt @@ -1,7 +1,6 @@ tests/cases/compiler/genericDerivedTypeWithSpecializedBase2.ts(11,1): error TS2322: Type 'B' is not assignable to type 'A<{ length: number; foo: number; }>'. Types of property 'x' are incompatible. Type 'string' is not assignable to type '{ length: number; foo: number; }'. - Property 'foo' is missing in type 'String'. ==== tests/cases/compiler/genericDerivedTypeWithSpecializedBase2.ts (1 errors) ==== @@ -20,5 +19,4 @@ tests/cases/compiler/genericDerivedTypeWithSpecializedBase2.ts(11,1): error TS23 !!! error TS2322: Type 'B' is not assignable to type 'A<{ length: number; foo: number; }>'. !!! error TS2322: Types of property 'x' are incompatible. !!! error TS2322: Type 'string' is not assignable to type '{ length: number; foo: number; }'. -!!! error TS2322: Property 'foo' is missing in type 'String'. \ No newline at end of file diff --git a/tests/baselines/reference/genericFunctionSpecializations1.symbols b/tests/baselines/reference/genericFunctionSpecializations1.symbols index aaf607cbd47..717e07455f4 100644 --- a/tests/baselines/reference/genericFunctionSpecializations1.symbols +++ b/tests/baselines/reference/genericFunctionSpecializations1.symbols @@ -18,7 +18,7 @@ function foo4(test: string); // valid function foo4(test: T) { } >foo4 : Symbol(foo4, Decl(genericFunctionSpecializations1.ts, 1, 29), Decl(genericFunctionSpecializations1.ts, 3, 31)) >T : Symbol(T, Decl(genericFunctionSpecializations1.ts, 4, 14)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >test : Symbol(test, Decl(genericFunctionSpecializations1.ts, 4, 32)) >T : Symbol(T, Decl(genericFunctionSpecializations1.ts, 4, 14)) diff --git a/tests/baselines/reference/genericFunctions3.symbols b/tests/baselines/reference/genericFunctions3.symbols index 8b257500325..bf071722b29 100644 --- a/tests/baselines/reference/genericFunctions3.symbols +++ b/tests/baselines/reference/genericFunctions3.symbols @@ -4,7 +4,7 @@ interface Query { >T : Symbol(T, Decl(genericFunctions3.ts, 0, 16)) foo(x: string): Query; ->foo : Symbol(foo, Decl(genericFunctions3.ts, 0, 20)) +>foo : Symbol(Query.foo, Decl(genericFunctions3.ts, 0, 20)) >x : Symbol(x, Decl(genericFunctions3.ts, 1, 8)) >Query : Symbol(Query, Decl(genericFunctions3.ts, 0, 0)) >T : Symbol(T, Decl(genericFunctions3.ts, 0, 16)) diff --git a/tests/baselines/reference/genericFunctionsWithOptionalParameters1.symbols b/tests/baselines/reference/genericFunctionsWithOptionalParameters1.symbols index fd79d736ffd..e8d3e904ae0 100644 --- a/tests/baselines/reference/genericFunctionsWithOptionalParameters1.symbols +++ b/tests/baselines/reference/genericFunctionsWithOptionalParameters1.symbols @@ -3,7 +3,7 @@ interface Utils { >Utils : Symbol(Utils, Decl(genericFunctionsWithOptionalParameters1.ts, 0, 0)) fold(c?: Array, folder?: (s: S, t: T) => T, init?: S): T; ->fold : Symbol(fold, Decl(genericFunctionsWithOptionalParameters1.ts, 0, 17)) +>fold : Symbol(Utils.fold, Decl(genericFunctionsWithOptionalParameters1.ts, 0, 17)) >T : Symbol(T, Decl(genericFunctionsWithOptionalParameters1.ts, 1, 8)) >S : Symbol(S, Decl(genericFunctionsWithOptionalParameters1.ts, 1, 10)) >c : Symbol(c, Decl(genericFunctionsWithOptionalParameters1.ts, 1, 14)) diff --git a/tests/baselines/reference/genericFunctionsWithOptionalParameters3.symbols b/tests/baselines/reference/genericFunctionsWithOptionalParameters3.symbols index d033f7b66bb..398c3a0e71f 100644 --- a/tests/baselines/reference/genericFunctionsWithOptionalParameters3.symbols +++ b/tests/baselines/reference/genericFunctionsWithOptionalParameters3.symbols @@ -4,7 +4,7 @@ class Collection { >T : Symbol(T, Decl(genericFunctionsWithOptionalParameters3.ts, 0, 17)) public add(x: T) { } ->add : Symbol(add, Decl(genericFunctionsWithOptionalParameters3.ts, 0, 21)) +>add : Symbol(Collection.add, Decl(genericFunctionsWithOptionalParameters3.ts, 0, 21)) >x : Symbol(x, Decl(genericFunctionsWithOptionalParameters3.ts, 1, 15)) >T : Symbol(T, Decl(genericFunctionsWithOptionalParameters3.ts, 0, 17)) } @@ -12,7 +12,7 @@ interface Utils { >Utils : Symbol(Utils, Decl(genericFunctionsWithOptionalParameters3.ts, 2, 1)) fold(c?: Collection, folder?: (s: S, t: T) => T, init?: S): T; ->fold : Symbol(fold, Decl(genericFunctionsWithOptionalParameters3.ts, 3, 17)) +>fold : Symbol(Utils.fold, Decl(genericFunctionsWithOptionalParameters3.ts, 3, 17)) >T : Symbol(T, Decl(genericFunctionsWithOptionalParameters3.ts, 4, 9)) >S : Symbol(S, Decl(genericFunctionsWithOptionalParameters3.ts, 4, 11)) >c : Symbol(c, Decl(genericFunctionsWithOptionalParameters3.ts, 4, 15)) @@ -29,7 +29,7 @@ interface Utils { >T : Symbol(T, Decl(genericFunctionsWithOptionalParameters3.ts, 4, 9)) mapReduce(c: Collection, mapper: (x: T) => U, reducer: (y: U) => V): Collection; ->mapReduce : Symbol(mapReduce, Decl(genericFunctionsWithOptionalParameters3.ts, 4, 75)) +>mapReduce : Symbol(Utils.mapReduce, Decl(genericFunctionsWithOptionalParameters3.ts, 4, 75)) >T : Symbol(T, Decl(genericFunctionsWithOptionalParameters3.ts, 5, 14)) >U : Symbol(U, Decl(genericFunctionsWithOptionalParameters3.ts, 5, 16)) >V : Symbol(V, Decl(genericFunctionsWithOptionalParameters3.ts, 5, 19)) @@ -63,7 +63,7 @@ var r3 = utils.mapReduce(c, (x) => { return 1 }, (y) => { return new Date() }); >c : Symbol(c, Decl(genericFunctionsWithOptionalParameters3.ts, 8, 3)) >x : Symbol(x, Decl(genericFunctionsWithOptionalParameters3.ts, 9, 29)) >y : Symbol(y, Decl(genericFunctionsWithOptionalParameters3.ts, 9, 50)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) var r4 = utils.mapReduce(c, (x: string) => { return 1 }, (y: number) => { return new Date() }); >r4 : Symbol(r4, Decl(genericFunctionsWithOptionalParameters3.ts, 10, 3)) @@ -73,7 +73,7 @@ var r4 = utils.mapReduce(c, (x: string) => { return 1 }, (y: number) => { return >c : Symbol(c, Decl(genericFunctionsWithOptionalParameters3.ts, 8, 3)) >x : Symbol(x, Decl(genericFunctionsWithOptionalParameters3.ts, 10, 29)) >y : Symbol(y, Decl(genericFunctionsWithOptionalParameters3.ts, 10, 58)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) var f1 = (x: string) => { return 1 }; >f1 : Symbol(f1, Decl(genericFunctionsWithOptionalParameters3.ts, 11, 3)) @@ -82,7 +82,7 @@ var f1 = (x: string) => { return 1 }; var f2 = (y: number) => { return new Date() }; >f2 : Symbol(f2, Decl(genericFunctionsWithOptionalParameters3.ts, 12, 3)) >y : Symbol(y, Decl(genericFunctionsWithOptionalParameters3.ts, 12, 10)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) var r5 = utils.mapReduce(c, f1, f2); >r5 : Symbol(r5, Decl(genericFunctionsWithOptionalParameters3.ts, 13, 3)) diff --git a/tests/baselines/reference/genericImplements.symbols b/tests/baselines/reference/genericImplements.symbols index b3bffdc1b6d..21d56ab08f1 100644 --- a/tests/baselines/reference/genericImplements.symbols +++ b/tests/baselines/reference/genericImplements.symbols @@ -1,17 +1,17 @@ === tests/cases/compiler/genericImplements.ts === class A { a; }; >A : Symbol(A, Decl(genericImplements.ts, 0, 0)) ->a : Symbol(a, Decl(genericImplements.ts, 0, 9)) +>a : Symbol(A.a, Decl(genericImplements.ts, 0, 9)) class B { b; }; >B : Symbol(B, Decl(genericImplements.ts, 0, 15)) ->b : Symbol(b, Decl(genericImplements.ts, 1, 9)) +>b : Symbol(B.b, Decl(genericImplements.ts, 1, 9)) interface I { >I : Symbol(I, Decl(genericImplements.ts, 1, 15)) f(): T; ->f : Symbol(f, Decl(genericImplements.ts, 2, 13)) +>f : Symbol(I.f, Decl(genericImplements.ts, 2, 13)) >T : Symbol(T, Decl(genericImplements.ts, 3, 6)) >A : Symbol(A, Decl(genericImplements.ts, 0, 0)) >T : Symbol(T, Decl(genericImplements.ts, 3, 6)) @@ -24,7 +24,7 @@ class X implements I { >I : Symbol(I, Decl(genericImplements.ts, 1, 15)) f(): T { return undefined; } ->f : Symbol(f, Decl(genericImplements.ts, 7, 22)) +>f : Symbol(X.f, Decl(genericImplements.ts, 7, 22)) >T : Symbol(T, Decl(genericImplements.ts, 8, 6)) >B : Symbol(B, Decl(genericImplements.ts, 0, 15)) >T : Symbol(T, Decl(genericImplements.ts, 8, 6)) @@ -38,7 +38,7 @@ class Y implements I { >I : Symbol(I, Decl(genericImplements.ts, 1, 15)) f(): T { return undefined; } ->f : Symbol(f, Decl(genericImplements.ts, 12, 22)) +>f : Symbol(Y.f, Decl(genericImplements.ts, 12, 22)) >T : Symbol(T, Decl(genericImplements.ts, 13, 6)) >A : Symbol(A, Decl(genericImplements.ts, 0, 0)) >T : Symbol(T, Decl(genericImplements.ts, 13, 6)) @@ -52,7 +52,7 @@ class Z implements I { >I : Symbol(I, Decl(genericImplements.ts, 1, 15)) f(): T { return undefined; } ->f : Symbol(f, Decl(genericImplements.ts, 17, 22)) +>f : Symbol(Z.f, Decl(genericImplements.ts, 17, 22)) >T : Symbol(T, Decl(genericImplements.ts, 18, 6)) >T : Symbol(T, Decl(genericImplements.ts, 18, 6)) >undefined : Symbol(undefined) diff --git a/tests/baselines/reference/genericInference2.symbols b/tests/baselines/reference/genericInference2.symbols index 52b80747cb9..3389bf3a97b 100644 --- a/tests/baselines/reference/genericInference2.symbols +++ b/tests/baselines/reference/genericInference2.symbols @@ -14,13 +14,13 @@ >T : Symbol(T, Decl(genericInference2.ts, 1, 35)) N: number; ->N : Symbol(N, Decl(genericInference2.ts, 3, 27)) +>N : Symbol(Observable.N, Decl(genericInference2.ts, 3, 27)) g: boolean; ->g : Symbol(g, Decl(genericInference2.ts, 4, 21)) +>g : Symbol(Observable.g, Decl(genericInference2.ts, 4, 21)) r: T; ->r : Symbol(r, Decl(genericInference2.ts, 5, 22)) +>r : Symbol(Observable.r, Decl(genericInference2.ts, 5, 22)) >T : Symbol(T, Decl(genericInference2.ts, 1, 35)) } export function observable(value: T): Observable; diff --git a/tests/baselines/reference/genericInheritedDefaultConstructors.js b/tests/baselines/reference/genericInheritedDefaultConstructors.js new file mode 100644 index 00000000000..170ef89abb2 --- /dev/null +++ b/tests/baselines/reference/genericInheritedDefaultConstructors.js @@ -0,0 +1,31 @@ +//// [genericInheritedDefaultConstructors.ts] +// repro from #8166 +interface Constructor { + new(...args: any[]): T; + prototype: T; +} + +class A { a: U; } +class B extends A { b: V; } +var c:Constructor> = B; // shouldn't error here + + +//// [genericInheritedDefaultConstructors.js] +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var A = (function () { + function A() { + } + return A; +}()); +var B = (function (_super) { + __extends(B, _super); + function B() { + _super.apply(this, arguments); + } + return B; +}(A)); +var c = B; // shouldn't error here diff --git a/tests/baselines/reference/genericInheritedDefaultConstructors.symbols b/tests/baselines/reference/genericInheritedDefaultConstructors.symbols new file mode 100644 index 00000000000..42a98b54c16 --- /dev/null +++ b/tests/baselines/reference/genericInheritedDefaultConstructors.symbols @@ -0,0 +1,35 @@ +=== tests/cases/compiler/genericInheritedDefaultConstructors.ts === +// repro from #8166 +interface Constructor { +>Constructor : Symbol(Constructor, Decl(genericInheritedDefaultConstructors.ts, 0, 0)) +>T : Symbol(T, Decl(genericInheritedDefaultConstructors.ts, 1, 22)) + + new(...args: any[]): T; +>args : Symbol(args, Decl(genericInheritedDefaultConstructors.ts, 2, 8)) +>T : Symbol(T, Decl(genericInheritedDefaultConstructors.ts, 1, 22)) + + prototype: T; +>prototype : Symbol(Constructor.prototype, Decl(genericInheritedDefaultConstructors.ts, 2, 27)) +>T : Symbol(T, Decl(genericInheritedDefaultConstructors.ts, 1, 22)) +} + +class A { a: U; } +>A : Symbol(A, Decl(genericInheritedDefaultConstructors.ts, 4, 1)) +>U : Symbol(U, Decl(genericInheritedDefaultConstructors.ts, 6, 8)) +>a : Symbol(A.a, Decl(genericInheritedDefaultConstructors.ts, 6, 12)) +>U : Symbol(U, Decl(genericInheritedDefaultConstructors.ts, 6, 8)) + +class B extends A { b: V; } +>B : Symbol(B, Decl(genericInheritedDefaultConstructors.ts, 6, 20)) +>V : Symbol(V, Decl(genericInheritedDefaultConstructors.ts, 7, 8)) +>A : Symbol(A, Decl(genericInheritedDefaultConstructors.ts, 4, 1)) +>V : Symbol(V, Decl(genericInheritedDefaultConstructors.ts, 7, 8)) +>b : Symbol(B.b, Decl(genericInheritedDefaultConstructors.ts, 7, 25)) +>V : Symbol(V, Decl(genericInheritedDefaultConstructors.ts, 7, 8)) + +var c:Constructor> = B; // shouldn't error here +>c : Symbol(c, Decl(genericInheritedDefaultConstructors.ts, 8, 3)) +>Constructor : Symbol(Constructor, Decl(genericInheritedDefaultConstructors.ts, 0, 0)) +>B : Symbol(B, Decl(genericInheritedDefaultConstructors.ts, 6, 20)) +>B : Symbol(B, Decl(genericInheritedDefaultConstructors.ts, 6, 20)) + diff --git a/tests/baselines/reference/genericInheritedDefaultConstructors.types b/tests/baselines/reference/genericInheritedDefaultConstructors.types new file mode 100644 index 00000000000..e0b4b7251f9 --- /dev/null +++ b/tests/baselines/reference/genericInheritedDefaultConstructors.types @@ -0,0 +1,35 @@ +=== tests/cases/compiler/genericInheritedDefaultConstructors.ts === +// repro from #8166 +interface Constructor { +>Constructor : Constructor +>T : T + + new(...args: any[]): T; +>args : any[] +>T : T + + prototype: T; +>prototype : T +>T : T +} + +class A { a: U; } +>A : A +>U : U +>a : U +>U : U + +class B extends A { b: V; } +>B : B +>V : V +>A : A +>V : V +>b : V +>V : V + +var c:Constructor> = B; // shouldn't error here +>c : Constructor> +>Constructor : Constructor +>B : B +>B : typeof B + diff --git a/tests/baselines/reference/genericInstanceOf.symbols b/tests/baselines/reference/genericInstanceOf.symbols index c1636724892..83242a198e1 100644 --- a/tests/baselines/reference/genericInstanceOf.symbols +++ b/tests/baselines/reference/genericInstanceOf.symbols @@ -10,21 +10,21 @@ class C { >T : Symbol(T, Decl(genericInstanceOf.ts, 4, 8)) constructor(public a: T, public b: F) {} ->a : Symbol(a, Decl(genericInstanceOf.ts, 5, 16)) +>a : Symbol(C.a, Decl(genericInstanceOf.ts, 5, 16)) >T : Symbol(T, Decl(genericInstanceOf.ts, 4, 8)) ->b : Symbol(b, Decl(genericInstanceOf.ts, 5, 28)) +>b : Symbol(C.b, Decl(genericInstanceOf.ts, 5, 28)) >F : Symbol(F, Decl(genericInstanceOf.ts, 0, 0)) foo() { ->foo : Symbol(foo, Decl(genericInstanceOf.ts, 5, 44)) +>foo : Symbol(C.foo, Decl(genericInstanceOf.ts, 5, 44)) if (this.a instanceof this.b) { ->this.a : Symbol(a, Decl(genericInstanceOf.ts, 5, 16)) +>this.a : Symbol(C.a, Decl(genericInstanceOf.ts, 5, 16)) >this : Symbol(C, Decl(genericInstanceOf.ts, 2, 1)) ->a : Symbol(a, Decl(genericInstanceOf.ts, 5, 16)) ->this.b : Symbol(b, Decl(genericInstanceOf.ts, 5, 28)) +>a : Symbol(C.a, Decl(genericInstanceOf.ts, 5, 16)) +>this.b : Symbol(C.b, Decl(genericInstanceOf.ts, 5, 28)) >this : Symbol(C, Decl(genericInstanceOf.ts, 2, 1)) ->b : Symbol(b, Decl(genericInstanceOf.ts, 5, 28)) +>b : Symbol(C.b, Decl(genericInstanceOf.ts, 5, 28)) } } } diff --git a/tests/baselines/reference/genericInstantiationEquivalentToObjectLiteral.symbols b/tests/baselines/reference/genericInstantiationEquivalentToObjectLiteral.symbols index 51579bad2d5..b65224cd0c8 100644 --- a/tests/baselines/reference/genericInstantiationEquivalentToObjectLiteral.symbols +++ b/tests/baselines/reference/genericInstantiationEquivalentToObjectLiteral.symbols @@ -3,9 +3,9 @@ interface Pair { first: T1; second: T2; } >Pair : Symbol(Pair, Decl(genericInstantiationEquivalentToObjectLiteral.ts, 0, 0)) >T1 : Symbol(T1, Decl(genericInstantiationEquivalentToObjectLiteral.ts, 0, 15)) >T2 : Symbol(T2, Decl(genericInstantiationEquivalentToObjectLiteral.ts, 0, 18)) ->first : Symbol(first, Decl(genericInstantiationEquivalentToObjectLiteral.ts, 0, 24)) +>first : Symbol(Pair.first, Decl(genericInstantiationEquivalentToObjectLiteral.ts, 0, 24)) >T1 : Symbol(T1, Decl(genericInstantiationEquivalentToObjectLiteral.ts, 0, 15)) ->second : Symbol(second, Decl(genericInstantiationEquivalentToObjectLiteral.ts, 0, 35)) +>second : Symbol(Pair.second, Decl(genericInstantiationEquivalentToObjectLiteral.ts, 0, 35)) >T2 : Symbol(T2, Decl(genericInstantiationEquivalentToObjectLiteral.ts, 0, 18)) var x: Pair diff --git a/tests/baselines/reference/genericInterfaceImplementation.symbols b/tests/baselines/reference/genericInterfaceImplementation.symbols index 5816396081f..0b9ef1b90ae 100644 --- a/tests/baselines/reference/genericInterfaceImplementation.symbols +++ b/tests/baselines/reference/genericInterfaceImplementation.symbols @@ -4,11 +4,11 @@ interface IOption { >A : Symbol(A, Decl(genericInterfaceImplementation.ts, 0, 18)) get(): A; ->get : Symbol(get, Decl(genericInterfaceImplementation.ts, 0, 22)) +>get : Symbol(IOption.get, Decl(genericInterfaceImplementation.ts, 0, 22)) >A : Symbol(A, Decl(genericInterfaceImplementation.ts, 0, 18)) flatten(): IOption; ->flatten : Symbol(flatten, Decl(genericInterfaceImplementation.ts, 1, 13)) +>flatten : Symbol(IOption.flatten, Decl(genericInterfaceImplementation.ts, 1, 13)) >B : Symbol(B, Decl(genericInterfaceImplementation.ts, 3, 12)) >IOption : Symbol(IOption, Decl(genericInterfaceImplementation.ts, 0, 0)) >B : Symbol(B, Decl(genericInterfaceImplementation.ts, 3, 12)) @@ -21,14 +21,14 @@ class None implements IOption{ >T : Symbol(T, Decl(genericInterfaceImplementation.ts, 6, 11)) get(): T { ->get : Symbol(get, Decl(genericInterfaceImplementation.ts, 6, 36)) +>get : Symbol(None.get, Decl(genericInterfaceImplementation.ts, 6, 36)) >T : Symbol(T, Decl(genericInterfaceImplementation.ts, 6, 11)) throw null; } flatten() : IOption { ->flatten : Symbol(flatten, Decl(genericInterfaceImplementation.ts, 9, 5)) +>flatten : Symbol(None.flatten, Decl(genericInterfaceImplementation.ts, 9, 5)) >U : Symbol(U, Decl(genericInterfaceImplementation.ts, 11, 12)) >IOption : Symbol(IOption, Decl(genericInterfaceImplementation.ts, 0, 0)) >U : Symbol(U, Decl(genericInterfaceImplementation.ts, 11, 12)) diff --git a/tests/baselines/reference/genericInterfaceTypeCall.symbols b/tests/baselines/reference/genericInterfaceTypeCall.symbols index e28ce8f8d80..fe640fd2e53 100644 --- a/tests/baselines/reference/genericInterfaceTypeCall.symbols +++ b/tests/baselines/reference/genericInterfaceTypeCall.symbols @@ -4,7 +4,7 @@ interface Foo { >T : Symbol(T, Decl(genericInterfaceTypeCall.ts, 0, 14)) reject(arg: T): void; ->reject : Symbol(reject, Decl(genericInterfaceTypeCall.ts, 0, 18)) +>reject : Symbol(Foo.reject, Decl(genericInterfaceTypeCall.ts, 0, 18)) >arg : Symbol(arg, Decl(genericInterfaceTypeCall.ts, 1, 11)) >T : Symbol(T, Decl(genericInterfaceTypeCall.ts, 0, 14)) } @@ -17,13 +17,13 @@ interface bar { >T : Symbol(T, Decl(genericInterfaceTypeCall.ts, 5, 14)) fail(func: (arg: T) => void ): void; ->fail : Symbol(fail, Decl(genericInterfaceTypeCall.ts, 5, 18)) +>fail : Symbol(bar.fail, Decl(genericInterfaceTypeCall.ts, 5, 18)) >func : Symbol(func, Decl(genericInterfaceTypeCall.ts, 6, 9)) >arg : Symbol(arg, Decl(genericInterfaceTypeCall.ts, 6, 16)) >T : Symbol(T, Decl(genericInterfaceTypeCall.ts, 5, 14)) fail2(func2: { (arg: T): void; }): void; ->fail2 : Symbol(fail2, Decl(genericInterfaceTypeCall.ts, 6, 40)) +>fail2 : Symbol(bar.fail2, Decl(genericInterfaceTypeCall.ts, 6, 40)) >func2 : Symbol(func2, Decl(genericInterfaceTypeCall.ts, 7, 10)) >arg : Symbol(arg, Decl(genericInterfaceTypeCall.ts, 7, 20)) >T : Symbol(T, Decl(genericInterfaceTypeCall.ts, 5, 14)) diff --git a/tests/baselines/reference/genericMethodOverspecialization.symbols b/tests/baselines/reference/genericMethodOverspecialization.symbols index 808addf068c..329ca2de675 100644 --- a/tests/baselines/reference/genericMethodOverspecialization.symbols +++ b/tests/baselines/reference/genericMethodOverspecialization.symbols @@ -6,10 +6,10 @@ interface HTMLElement { >HTMLElement : Symbol(HTMLElement, Decl(genericMethodOverspecialization.ts, 0, 62)) clientWidth: number; ->clientWidth : Symbol(clientWidth, Decl(genericMethodOverspecialization.ts, 2, 23)) +>clientWidth : Symbol(HTMLElement.clientWidth, Decl(genericMethodOverspecialization.ts, 2, 23)) isDisabled: boolean; ->isDisabled : Symbol(isDisabled, Decl(genericMethodOverspecialization.ts, 3, 24)) +>isDisabled : Symbol(HTMLElement.isDisabled, Decl(genericMethodOverspecialization.ts, 3, 24)) } declare var document: Document; @@ -20,7 +20,7 @@ interface Document { >Document : Symbol(Document, Decl(genericMethodOverspecialization.ts, 7, 31)) getElementById(elementId: string): HTMLElement; ->getElementById : Symbol(getElementById, Decl(genericMethodOverspecialization.ts, 8, 20)) +>getElementById : Symbol(Document.getElementById, Decl(genericMethodOverspecialization.ts, 8, 20)) >elementId : Symbol(elementId, Decl(genericMethodOverspecialization.ts, 9, 19)) >HTMLElement : Symbol(HTMLElement, Decl(genericMethodOverspecialization.ts, 0, 62)) } diff --git a/tests/baselines/reference/genericMethodOverspecialization.types b/tests/baselines/reference/genericMethodOverspecialization.types index 0ad302da94e..375eefaa86c 100644 --- a/tests/baselines/reference/genericMethodOverspecialization.types +++ b/tests/baselines/reference/genericMethodOverspecialization.types @@ -53,9 +53,9 @@ var elements = names.map(function (name) { var xxx = elements.filter(function (e) { >xxx : HTMLElement[] >elements.filter(function (e) { return !e.isDisabled;}) : HTMLElement[] ->elements.filter : (callbackfn: (value: HTMLElement, index: number, array: HTMLElement[]) => boolean, thisArg?: any) => HTMLElement[] +>elements.filter : (callbackfn: (value: HTMLElement, index: number, array: HTMLElement[]) => any, thisArg?: any) => HTMLElement[] >elements : HTMLElement[] ->filter : (callbackfn: (value: HTMLElement, index: number, array: HTMLElement[]) => boolean, thisArg?: any) => HTMLElement[] +>filter : (callbackfn: (value: HTMLElement, index: number, array: HTMLElement[]) => any, thisArg?: any) => HTMLElement[] >function (e) { return !e.isDisabled;} : (e: HTMLElement) => boolean >e : HTMLElement diff --git a/tests/baselines/reference/genericObjectLitReturnType.symbols b/tests/baselines/reference/genericObjectLitReturnType.symbols index f3253bdf810..8dacec9a8c5 100644 --- a/tests/baselines/reference/genericObjectLitReturnType.symbols +++ b/tests/baselines/reference/genericObjectLitReturnType.symbols @@ -4,7 +4,7 @@ class X >T : Symbol(T, Decl(genericObjectLitReturnType.ts, 0, 8)) { f(t: T) { return { a: t }; } ->f : Symbol(f, Decl(genericObjectLitReturnType.ts, 1, 1)) +>f : Symbol(X.f, Decl(genericObjectLitReturnType.ts, 1, 1)) >t : Symbol(t, Decl(genericObjectLitReturnType.ts, 2, 6)) >T : Symbol(T, Decl(genericObjectLitReturnType.ts, 0, 8)) >a : Symbol(a, Decl(genericObjectLitReturnType.ts, 2, 22)) diff --git a/tests/baselines/reference/genericOfACloduleType1.symbols b/tests/baselines/reference/genericOfACloduleType1.symbols index b2bb95a8ef1..07a677b60c0 100644 --- a/tests/baselines/reference/genericOfACloduleType1.symbols +++ b/tests/baselines/reference/genericOfACloduleType1.symbols @@ -2,7 +2,7 @@ class G{ bar(x: T) { return x; } } >G : Symbol(G, Decl(genericOfACloduleType1.ts, 0, 0)) >T : Symbol(T, Decl(genericOfACloduleType1.ts, 0, 8)) ->bar : Symbol(bar, Decl(genericOfACloduleType1.ts, 0, 11)) +>bar : Symbol(G.bar, Decl(genericOfACloduleType1.ts, 0, 11)) >x : Symbol(x, Decl(genericOfACloduleType1.ts, 0, 16)) >T : Symbol(T, Decl(genericOfACloduleType1.ts, 0, 8)) >x : Symbol(x, Decl(genericOfACloduleType1.ts, 0, 16)) @@ -12,7 +12,7 @@ module M { export class C { foo() { } } >C : Symbol(C, Decl(genericOfACloduleType1.ts, 1, 10), Decl(genericOfACloduleType1.ts, 2, 32)) ->foo : Symbol(foo, Decl(genericOfACloduleType1.ts, 2, 20)) +>foo : Symbol(C.foo, Decl(genericOfACloduleType1.ts, 2, 20)) export module C { >C : Symbol(C, Decl(genericOfACloduleType1.ts, 1, 10), Decl(genericOfACloduleType1.ts, 2, 32)) diff --git a/tests/baselines/reference/genericOfACloduleType2.symbols b/tests/baselines/reference/genericOfACloduleType2.symbols index 2f4fe34818c..4999d227bbc 100644 --- a/tests/baselines/reference/genericOfACloduleType2.symbols +++ b/tests/baselines/reference/genericOfACloduleType2.symbols @@ -2,7 +2,7 @@ class G{ bar(x: T) { return x; } } >G : Symbol(G, Decl(genericOfACloduleType2.ts, 0, 0)) >T : Symbol(T, Decl(genericOfACloduleType2.ts, 0, 8)) ->bar : Symbol(bar, Decl(genericOfACloduleType2.ts, 0, 11)) +>bar : Symbol(G.bar, Decl(genericOfACloduleType2.ts, 0, 11)) >x : Symbol(x, Decl(genericOfACloduleType2.ts, 0, 16)) >T : Symbol(T, Decl(genericOfACloduleType2.ts, 0, 8)) >x : Symbol(x, Decl(genericOfACloduleType2.ts, 0, 16)) @@ -12,7 +12,7 @@ module M { export class C { foo() { } } >C : Symbol(C, Decl(genericOfACloduleType2.ts, 1, 10), Decl(genericOfACloduleType2.ts, 2, 32)) ->foo : Symbol(foo, Decl(genericOfACloduleType2.ts, 2, 20)) +>foo : Symbol(C.foo, Decl(genericOfACloduleType2.ts, 2, 20)) export module C { >C : Symbol(C, Decl(genericOfACloduleType2.ts, 1, 10), Decl(genericOfACloduleType2.ts, 2, 32)) diff --git a/tests/baselines/reference/genericOverloadSignatures.symbols b/tests/baselines/reference/genericOverloadSignatures.symbols index 76343fb1898..148aead0616 100644 --- a/tests/baselines/reference/genericOverloadSignatures.symbols +++ b/tests/baselines/reference/genericOverloadSignatures.symbols @@ -33,13 +33,13 @@ interface I2 { >I2 : Symbol(I2, Decl(genericOverloadSignatures.ts, 7, 17)) f(x: T): number; ->f : Symbol(f, Decl(genericOverloadSignatures.ts, 9, 14), Decl(genericOverloadSignatures.ts, 10, 23)) +>f : Symbol(I2.f, Decl(genericOverloadSignatures.ts, 9, 14), Decl(genericOverloadSignatures.ts, 10, 23)) >T : Symbol(T, Decl(genericOverloadSignatures.ts, 10, 6)) >x : Symbol(x, Decl(genericOverloadSignatures.ts, 10, 9)) >T : Symbol(T, Decl(genericOverloadSignatures.ts, 10, 6)) f(x: T): string; ->f : Symbol(f, Decl(genericOverloadSignatures.ts, 9, 14), Decl(genericOverloadSignatures.ts, 10, 23)) +>f : Symbol(I2.f, Decl(genericOverloadSignatures.ts, 9, 14), Decl(genericOverloadSignatures.ts, 10, 23)) >T : Symbol(T, Decl(genericOverloadSignatures.ts, 11, 6)) >x : Symbol(x, Decl(genericOverloadSignatures.ts, 11, 9)) >T : Symbol(T, Decl(genericOverloadSignatures.ts, 11, 6)) @@ -50,12 +50,12 @@ interface I3 { >T : Symbol(T, Decl(genericOverloadSignatures.ts, 14, 13)) f(x: T): number; ->f : Symbol(f, Decl(genericOverloadSignatures.ts, 14, 17), Decl(genericOverloadSignatures.ts, 15, 20)) +>f : Symbol(I3.f, Decl(genericOverloadSignatures.ts, 14, 17), Decl(genericOverloadSignatures.ts, 15, 20)) >x : Symbol(x, Decl(genericOverloadSignatures.ts, 15, 6)) >T : Symbol(T, Decl(genericOverloadSignatures.ts, 14, 13)) f(x: T): string; ->f : Symbol(f, Decl(genericOverloadSignatures.ts, 14, 17), Decl(genericOverloadSignatures.ts, 15, 20)) +>f : Symbol(I3.f, Decl(genericOverloadSignatures.ts, 14, 17), Decl(genericOverloadSignatures.ts, 15, 20)) >x : Symbol(x, Decl(genericOverloadSignatures.ts, 16, 6)) >T : Symbol(T, Decl(genericOverloadSignatures.ts, 14, 13)) } diff --git a/tests/baselines/reference/genericPrototypeProperty.symbols b/tests/baselines/reference/genericPrototypeProperty.symbols index ca2fe000dce..130d9669327 100644 --- a/tests/baselines/reference/genericPrototypeProperty.symbols +++ b/tests/baselines/reference/genericPrototypeProperty.symbols @@ -4,11 +4,11 @@ class C { >T : Symbol(T, Decl(genericPrototypeProperty.ts, 0, 8)) x: T; ->x : Symbol(x, Decl(genericPrototypeProperty.ts, 0, 12)) +>x : Symbol(C.x, Decl(genericPrototypeProperty.ts, 0, 12)) >T : Symbol(T, Decl(genericPrototypeProperty.ts, 0, 8)) foo(x: T): T { return null; } ->foo : Symbol(foo, Decl(genericPrototypeProperty.ts, 1, 9)) +>foo : Symbol(C.foo, Decl(genericPrototypeProperty.ts, 1, 9)) >x : Symbol(x, Decl(genericPrototypeProperty.ts, 2, 8)) >T : Symbol(T, Decl(genericPrototypeProperty.ts, 0, 8)) >T : Symbol(T, Decl(genericPrototypeProperty.ts, 0, 8)) diff --git a/tests/baselines/reference/genericPrototypeProperty2.symbols b/tests/baselines/reference/genericPrototypeProperty2.symbols index f7d55162154..71709239cef 100644 --- a/tests/baselines/reference/genericPrototypeProperty2.symbols +++ b/tests/baselines/reference/genericPrototypeProperty2.symbols @@ -1,13 +1,13 @@ === tests/cases/compiler/genericPrototypeProperty2.ts === interface EventTarget { x } >EventTarget : Symbol(EventTarget, Decl(genericPrototypeProperty2.ts, 0, 0)) ->x : Symbol(x, Decl(genericPrototypeProperty2.ts, 0, 23)) +>x : Symbol(EventTarget.x, Decl(genericPrototypeProperty2.ts, 0, 23)) class BaseEvent { >BaseEvent : Symbol(BaseEvent, Decl(genericPrototypeProperty2.ts, 0, 27)) target: EventTarget; ->target : Symbol(target, Decl(genericPrototypeProperty2.ts, 1, 17)) +>target : Symbol(BaseEvent.target, Decl(genericPrototypeProperty2.ts, 1, 17)) >EventTarget : Symbol(EventTarget, Decl(genericPrototypeProperty2.ts, 0, 0)) } @@ -18,14 +18,14 @@ class MyEvent extends BaseEvent { >BaseEvent : Symbol(BaseEvent, Decl(genericPrototypeProperty2.ts, 0, 27)) target: T; ->target : Symbol(target, Decl(genericPrototypeProperty2.ts, 5, 56)) +>target : Symbol(MyEvent.target, Decl(genericPrototypeProperty2.ts, 5, 56)) >T : Symbol(T, Decl(genericPrototypeProperty2.ts, 5, 14)) } class BaseEventWrapper { >BaseEventWrapper : Symbol(BaseEventWrapper, Decl(genericPrototypeProperty2.ts, 7, 1)) t: BaseEvent; ->t : Symbol(t, Decl(genericPrototypeProperty2.ts, 8, 24)) +>t : Symbol(BaseEventWrapper.t, Decl(genericPrototypeProperty2.ts, 8, 24)) >BaseEvent : Symbol(BaseEvent, Decl(genericPrototypeProperty2.ts, 0, 27)) } @@ -34,6 +34,6 @@ class MyEventWrapper extends BaseEventWrapper { >BaseEventWrapper : Symbol(BaseEventWrapper, Decl(genericPrototypeProperty2.ts, 7, 1)) t: MyEvent; // any satisfies constraint and passes assignability check between 'target' properties ->t : Symbol(t, Decl(genericPrototypeProperty2.ts, 12, 47)) +>t : Symbol(MyEventWrapper.t, Decl(genericPrototypeProperty2.ts, 12, 47)) >MyEvent : Symbol(MyEvent, Decl(genericPrototypeProperty2.ts, 3, 1)) } diff --git a/tests/baselines/reference/genericPrototypeProperty3.symbols b/tests/baselines/reference/genericPrototypeProperty3.symbols index fb28fbcc89d..7f8c57ff2ea 100644 --- a/tests/baselines/reference/genericPrototypeProperty3.symbols +++ b/tests/baselines/reference/genericPrototypeProperty3.symbols @@ -3,7 +3,7 @@ class BaseEvent { >BaseEvent : Symbol(BaseEvent, Decl(genericPrototypeProperty3.ts, 0, 0)) target: {}; ->target : Symbol(target, Decl(genericPrototypeProperty3.ts, 0, 17)) +>target : Symbol(BaseEvent.target, Decl(genericPrototypeProperty3.ts, 0, 17)) } class MyEvent extends BaseEvent { // T is instantiated to any in the prototype, which is assignable to {} @@ -12,14 +12,14 @@ class MyEvent extends BaseEvent { // T is instantiated to any in the prototyp >BaseEvent : Symbol(BaseEvent, Decl(genericPrototypeProperty3.ts, 0, 0)) target: T; ->target : Symbol(target, Decl(genericPrototypeProperty3.ts, 4, 36)) +>target : Symbol(MyEvent.target, Decl(genericPrototypeProperty3.ts, 4, 36)) >T : Symbol(T, Decl(genericPrototypeProperty3.ts, 4, 14)) } class BaseEventWrapper { >BaseEventWrapper : Symbol(BaseEventWrapper, Decl(genericPrototypeProperty3.ts, 6, 1)) t: BaseEvent; ->t : Symbol(t, Decl(genericPrototypeProperty3.ts, 7, 24)) +>t : Symbol(BaseEventWrapper.t, Decl(genericPrototypeProperty3.ts, 7, 24)) >BaseEvent : Symbol(BaseEvent, Decl(genericPrototypeProperty3.ts, 0, 0)) } @@ -28,6 +28,6 @@ class MyEventWrapper extends BaseEventWrapper { >BaseEventWrapper : Symbol(BaseEventWrapper, Decl(genericPrototypeProperty3.ts, 6, 1)) t: MyEvent; ->t : Symbol(t, Decl(genericPrototypeProperty3.ts, 11, 47)) +>t : Symbol(MyEventWrapper.t, Decl(genericPrototypeProperty3.ts, 11, 47)) >MyEvent : Symbol(MyEvent, Decl(genericPrototypeProperty3.ts, 2, 1)) } diff --git a/tests/baselines/reference/genericRecursiveImplicitConstructorErrors2.symbols b/tests/baselines/reference/genericRecursiveImplicitConstructorErrors2.symbols index ff8d19ff6e6..16171917561 100644 --- a/tests/baselines/reference/genericRecursiveImplicitConstructorErrors2.symbols +++ b/tests/baselines/reference/genericRecursiveImplicitConstructorErrors2.symbols @@ -32,7 +32,7 @@ module TypeScript2 { } // link methods public addOutgoingLink(linkTo: PullSymbol, kind: SymbolLinkKind) { ->addOutgoingLink : Symbol(addOutgoingLink, Decl(genericRecursiveImplicitConstructorErrors2.ts, 12, 5)) +>addOutgoingLink : Symbol(PullSymbol.addOutgoingLink, Decl(genericRecursiveImplicitConstructorErrors2.ts, 12, 5)) >A : Symbol(A, Decl(genericRecursiveImplicitConstructorErrors2.ts, 14, 27)) >B : Symbol(B, Decl(genericRecursiveImplicitConstructorErrors2.ts, 14, 29)) >C : Symbol(C, Decl(genericRecursiveImplicitConstructorErrors2.ts, 14, 31)) @@ -44,7 +44,7 @@ module TypeScript2 { } public getType(): PullTypeSymbol { ->getType : Symbol(getType, Decl(genericRecursiveImplicitConstructorErrors2.ts, 16, 5)) +>getType : Symbol(PullSymbol.getType, Decl(genericRecursiveImplicitConstructorErrors2.ts, 16, 5)) >A : Symbol(A, Decl(genericRecursiveImplicitConstructorErrors2.ts, 18, 19)) >B : Symbol(B, Decl(genericRecursiveImplicitConstructorErrors2.ts, 18, 21)) >C : Symbol(C, Decl(genericRecursiveImplicitConstructorErrors2.ts, 18, 23)) diff --git a/tests/baselines/reference/genericRestArgs.errors.txt b/tests/baselines/reference/genericRestArgs.errors.txt index 99106ebd795..8a977452958 100644 --- a/tests/baselines/reference/genericRestArgs.errors.txt +++ b/tests/baselines/reference/genericRestArgs.errors.txt @@ -4,7 +4,6 @@ tests/cases/compiler/genericRestArgs.ts(5,34): error TS2345: Argument of type 's tests/cases/compiler/genericRestArgs.ts(10,12): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. Type argument candidate 'number' is not a valid type argument because it is not a supertype of candidate 'string'. tests/cases/compiler/genericRestArgs.ts(12,30): error TS2345: Argument of type 'number' is not assignable to parameter of type 'any[]'. - Property 'length' is missing in type 'Number'. ==== tests/cases/compiler/genericRestArgs.ts (4 errors) ==== @@ -29,5 +28,4 @@ tests/cases/compiler/genericRestArgs.ts(12,30): error TS2345: Argument of type ' var a2Gb = makeArrayG(1, ""); var a2Gc = makeArrayG(1, ""); // error ~ -!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'any[]'. -!!! error TS2345: Property 'length' is missing in type 'Number'. \ No newline at end of file +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'any[]'. \ No newline at end of file diff --git a/tests/baselines/reference/genericReversingTypeParameters.symbols b/tests/baselines/reference/genericReversingTypeParameters.symbols index 05eb102f36b..2a77e5496be 100644 --- a/tests/baselines/reference/genericReversingTypeParameters.symbols +++ b/tests/baselines/reference/genericReversingTypeParameters.symbols @@ -5,19 +5,19 @@ class BiMap { >V : Symbol(V, Decl(genericReversingTypeParameters.ts, 0, 14)) private inverseBiMap: BiMap; ->inverseBiMap : Symbol(inverseBiMap, Decl(genericReversingTypeParameters.ts, 0, 19)) +>inverseBiMap : Symbol(BiMap.inverseBiMap, Decl(genericReversingTypeParameters.ts, 0, 19)) >BiMap : Symbol(BiMap, Decl(genericReversingTypeParameters.ts, 0, 0)) >V : Symbol(V, Decl(genericReversingTypeParameters.ts, 0, 14)) >K : Symbol(K, Decl(genericReversingTypeParameters.ts, 0, 12)) public get(key: K): V { return null; } ->get : Symbol(get, Decl(genericReversingTypeParameters.ts, 1, 38)) +>get : Symbol(BiMap.get, Decl(genericReversingTypeParameters.ts, 1, 38)) >key : Symbol(key, Decl(genericReversingTypeParameters.ts, 2, 15)) >K : Symbol(K, Decl(genericReversingTypeParameters.ts, 0, 12)) >V : Symbol(V, Decl(genericReversingTypeParameters.ts, 0, 14)) public inverse(): BiMap { return null; } ->inverse : Symbol(inverse, Decl(genericReversingTypeParameters.ts, 2, 42)) +>inverse : Symbol(BiMap.inverse, Decl(genericReversingTypeParameters.ts, 2, 42)) >BiMap : Symbol(BiMap, Decl(genericReversingTypeParameters.ts, 0, 0)) >V : Symbol(V, Decl(genericReversingTypeParameters.ts, 0, 14)) >K : Symbol(K, Decl(genericReversingTypeParameters.ts, 0, 12)) diff --git a/tests/baselines/reference/genericReversingTypeParameters2.symbols b/tests/baselines/reference/genericReversingTypeParameters2.symbols index d33dbd3a64b..43f6db8ecba 100644 --- a/tests/baselines/reference/genericReversingTypeParameters2.symbols +++ b/tests/baselines/reference/genericReversingTypeParameters2.symbols @@ -5,19 +5,19 @@ class BiMap { >V : Symbol(V, Decl(genericReversingTypeParameters2.ts, 0, 14)) private inverseBiMap: BiMap; ->inverseBiMap : Symbol(inverseBiMap, Decl(genericReversingTypeParameters2.ts, 0, 19)) +>inverseBiMap : Symbol(BiMap.inverseBiMap, Decl(genericReversingTypeParameters2.ts, 0, 19)) >BiMap : Symbol(BiMap, Decl(genericReversingTypeParameters2.ts, 0, 0)) >V : Symbol(V, Decl(genericReversingTypeParameters2.ts, 0, 14)) >K : Symbol(K, Decl(genericReversingTypeParameters2.ts, 0, 12)) public get(key: K): V { return null; } ->get : Symbol(get, Decl(genericReversingTypeParameters2.ts, 1, 38)) +>get : Symbol(BiMap.get, Decl(genericReversingTypeParameters2.ts, 1, 38)) >key : Symbol(key, Decl(genericReversingTypeParameters2.ts, 2, 15)) >K : Symbol(K, Decl(genericReversingTypeParameters2.ts, 0, 12)) >V : Symbol(V, Decl(genericReversingTypeParameters2.ts, 0, 14)) public inverse(): BiMap { return null; } ->inverse : Symbol(inverse, Decl(genericReversingTypeParameters2.ts, 2, 42)) +>inverse : Symbol(BiMap.inverse, Decl(genericReversingTypeParameters2.ts, 2, 42)) >BiMap : Symbol(BiMap, Decl(genericReversingTypeParameters2.ts, 0, 0)) >V : Symbol(V, Decl(genericReversingTypeParameters2.ts, 0, 14)) >K : Symbol(K, Decl(genericReversingTypeParameters2.ts, 0, 12)) diff --git a/tests/baselines/reference/genericSignatureIdentity.symbols b/tests/baselines/reference/genericSignatureIdentity.symbols index afd12ec266a..b5caa87b0a5 100644 --- a/tests/baselines/reference/genericSignatureIdentity.symbols +++ b/tests/baselines/reference/genericSignatureIdentity.symbols @@ -9,7 +9,7 @@ var x: { (x: T): T; >T : Symbol(T, Decl(genericSignatureIdentity.ts, 6, 5)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(genericSignatureIdentity.ts, 6, 21)) >T : Symbol(T, Decl(genericSignatureIdentity.ts, 6, 5)) >T : Symbol(T, Decl(genericSignatureIdentity.ts, 6, 5)) diff --git a/tests/baselines/reference/genericSpecializationToTypeLiteral1.symbols b/tests/baselines/reference/genericSpecializationToTypeLiteral1.symbols index 78203ddacf6..057b6ec6548 100644 --- a/tests/baselines/reference/genericSpecializationToTypeLiteral1.symbols +++ b/tests/baselines/reference/genericSpecializationToTypeLiteral1.symbols @@ -4,7 +4,7 @@ interface IEnumerable { >T : Symbol(T, Decl(genericSpecializationToTypeLiteral1.ts, 0, 22)) zip(second: IEnumerable, resultSelector: (first: T, second: T, index: number) => TResult): IEnumerable; ->zip : Symbol(zip, Decl(genericSpecializationToTypeLiteral1.ts, 0, 26), Decl(genericSpecializationToTypeLiteral1.ts, 2, 128), Decl(genericSpecializationToTypeLiteral1.ts, 3, 117)) +>zip : Symbol(IEnumerable.zip, Decl(genericSpecializationToTypeLiteral1.ts, 0, 26), Decl(genericSpecializationToTypeLiteral1.ts, 2, 128), Decl(genericSpecializationToTypeLiteral1.ts, 3, 117)) >TResult : Symbol(TResult, Decl(genericSpecializationToTypeLiteral1.ts, 2, 8)) >second : Symbol(second, Decl(genericSpecializationToTypeLiteral1.ts, 2, 17)) >IEnumerable : Symbol(IEnumerable, Decl(genericSpecializationToTypeLiteral1.ts, 0, 0)) @@ -20,7 +20,7 @@ interface IEnumerable { >TResult : Symbol(TResult, Decl(genericSpecializationToTypeLiteral1.ts, 2, 8)) zip(second: T[], resultSelector: (first: T, second: T, index: number) => TResult): IEnumerable; ->zip : Symbol(zip, Decl(genericSpecializationToTypeLiteral1.ts, 0, 26), Decl(genericSpecializationToTypeLiteral1.ts, 2, 128), Decl(genericSpecializationToTypeLiteral1.ts, 3, 117)) +>zip : Symbol(IEnumerable.zip, Decl(genericSpecializationToTypeLiteral1.ts, 0, 26), Decl(genericSpecializationToTypeLiteral1.ts, 2, 128), Decl(genericSpecializationToTypeLiteral1.ts, 3, 117)) >TResult : Symbol(TResult, Decl(genericSpecializationToTypeLiteral1.ts, 3, 8)) >second : Symbol(second, Decl(genericSpecializationToTypeLiteral1.ts, 3, 17)) >T : Symbol(T, Decl(genericSpecializationToTypeLiteral1.ts, 0, 22)) @@ -35,14 +35,14 @@ interface IEnumerable { >TResult : Symbol(TResult, Decl(genericSpecializationToTypeLiteral1.ts, 3, 8)) zip(...params: any[]): IEnumerable; // last one is selector ->zip : Symbol(zip, Decl(genericSpecializationToTypeLiteral1.ts, 0, 26), Decl(genericSpecializationToTypeLiteral1.ts, 2, 128), Decl(genericSpecializationToTypeLiteral1.ts, 3, 117)) +>zip : Symbol(IEnumerable.zip, Decl(genericSpecializationToTypeLiteral1.ts, 0, 26), Decl(genericSpecializationToTypeLiteral1.ts, 2, 128), Decl(genericSpecializationToTypeLiteral1.ts, 3, 117)) >TResult : Symbol(TResult, Decl(genericSpecializationToTypeLiteral1.ts, 4, 8)) >params : Symbol(params, Decl(genericSpecializationToTypeLiteral1.ts, 4, 17)) >IEnumerable : Symbol(IEnumerable, Decl(genericSpecializationToTypeLiteral1.ts, 0, 0)) >TResult : Symbol(TResult, Decl(genericSpecializationToTypeLiteral1.ts, 4, 8)) merge(...params: IEnumerable[]): IEnumerable; ->merge : Symbol(merge, Decl(genericSpecializationToTypeLiteral1.ts, 4, 57), Decl(genericSpecializationToTypeLiteral1.ts, 6, 64)) +>merge : Symbol(IEnumerable.merge, Decl(genericSpecializationToTypeLiteral1.ts, 4, 57), Decl(genericSpecializationToTypeLiteral1.ts, 6, 64)) >TResult : Symbol(TResult, Decl(genericSpecializationToTypeLiteral1.ts, 6, 10)) >params : Symbol(params, Decl(genericSpecializationToTypeLiteral1.ts, 6, 19)) >IEnumerable : Symbol(IEnumerable, Decl(genericSpecializationToTypeLiteral1.ts, 0, 0)) @@ -51,7 +51,7 @@ interface IEnumerable { >T : Symbol(T, Decl(genericSpecializationToTypeLiteral1.ts, 0, 22)) merge(...params: T[][]): IEnumerable; ->merge : Symbol(merge, Decl(genericSpecializationToTypeLiteral1.ts, 4, 57), Decl(genericSpecializationToTypeLiteral1.ts, 6, 64)) +>merge : Symbol(IEnumerable.merge, Decl(genericSpecializationToTypeLiteral1.ts, 4, 57), Decl(genericSpecializationToTypeLiteral1.ts, 6, 64)) >TResult : Symbol(TResult, Decl(genericSpecializationToTypeLiteral1.ts, 7, 10)) >params : Symbol(params, Decl(genericSpecializationToTypeLiteral1.ts, 7, 19)) >T : Symbol(T, Decl(genericSpecializationToTypeLiteral1.ts, 0, 22)) @@ -60,7 +60,7 @@ interface IEnumerable { concat(...sequences: IEnumerable[]): IEnumerable; ->concat : Symbol(concat, Decl(genericSpecializationToTypeLiteral1.ts, 7, 53), Decl(genericSpecializationToTypeLiteral1.ts, 10, 59)) +>concat : Symbol(IEnumerable.concat, Decl(genericSpecializationToTypeLiteral1.ts, 7, 53), Decl(genericSpecializationToTypeLiteral1.ts, 10, 59)) >sequences : Symbol(sequences, Decl(genericSpecializationToTypeLiteral1.ts, 10, 11)) >IEnumerable : Symbol(IEnumerable, Decl(genericSpecializationToTypeLiteral1.ts, 0, 0)) >T : Symbol(T, Decl(genericSpecializationToTypeLiteral1.ts, 0, 22)) @@ -68,14 +68,14 @@ interface IEnumerable { >T : Symbol(T, Decl(genericSpecializationToTypeLiteral1.ts, 0, 22)) concat(...sequences: T[]): IEnumerable; ->concat : Symbol(concat, Decl(genericSpecializationToTypeLiteral1.ts, 7, 53), Decl(genericSpecializationToTypeLiteral1.ts, 10, 59)) +>concat : Symbol(IEnumerable.concat, Decl(genericSpecializationToTypeLiteral1.ts, 7, 53), Decl(genericSpecializationToTypeLiteral1.ts, 10, 59)) >sequences : Symbol(sequences, Decl(genericSpecializationToTypeLiteral1.ts, 11, 11)) >T : Symbol(T, Decl(genericSpecializationToTypeLiteral1.ts, 0, 22)) >IEnumerable : Symbol(IEnumerable, Decl(genericSpecializationToTypeLiteral1.ts, 0, 0)) >T : Symbol(T, Decl(genericSpecializationToTypeLiteral1.ts, 0, 22)) insert(index: number, second: IEnumerable): IEnumerable; ->insert : Symbol(insert, Decl(genericSpecializationToTypeLiteral1.ts, 11, 46)) +>insert : Symbol(IEnumerable.insert, Decl(genericSpecializationToTypeLiteral1.ts, 11, 46)) >index : Symbol(index, Decl(genericSpecializationToTypeLiteral1.ts, 13, 11)) >second : Symbol(second, Decl(genericSpecializationToTypeLiteral1.ts, 13, 25)) >IEnumerable : Symbol(IEnumerable, Decl(genericSpecializationToTypeLiteral1.ts, 0, 0)) @@ -84,13 +84,13 @@ interface IEnumerable { >T : Symbol(T, Decl(genericSpecializationToTypeLiteral1.ts, 0, 22)) sequenceEqual(second: IEnumerable): boolean; ->sequenceEqual : Symbol(sequenceEqual, Decl(genericSpecializationToTypeLiteral1.ts, 13, 66), Decl(genericSpecializationToTypeLiteral1.ts, 15, 51), Decl(genericSpecializationToTypeLiteral1.ts, 16, 104), Decl(genericSpecializationToTypeLiteral1.ts, 17, 40)) +>sequenceEqual : Symbol(IEnumerable.sequenceEqual, Decl(genericSpecializationToTypeLiteral1.ts, 13, 66), Decl(genericSpecializationToTypeLiteral1.ts, 15, 51), Decl(genericSpecializationToTypeLiteral1.ts, 16, 104), Decl(genericSpecializationToTypeLiteral1.ts, 17, 40)) >second : Symbol(second, Decl(genericSpecializationToTypeLiteral1.ts, 15, 18)) >IEnumerable : Symbol(IEnumerable, Decl(genericSpecializationToTypeLiteral1.ts, 0, 0)) >T : Symbol(T, Decl(genericSpecializationToTypeLiteral1.ts, 0, 22)) sequenceEqual(second: IEnumerable, compareSelector: (element: T) => TCompare): boolean; ->sequenceEqual : Symbol(sequenceEqual, Decl(genericSpecializationToTypeLiteral1.ts, 13, 66), Decl(genericSpecializationToTypeLiteral1.ts, 15, 51), Decl(genericSpecializationToTypeLiteral1.ts, 16, 104), Decl(genericSpecializationToTypeLiteral1.ts, 17, 40)) +>sequenceEqual : Symbol(IEnumerable.sequenceEqual, Decl(genericSpecializationToTypeLiteral1.ts, 13, 66), Decl(genericSpecializationToTypeLiteral1.ts, 15, 51), Decl(genericSpecializationToTypeLiteral1.ts, 16, 104), Decl(genericSpecializationToTypeLiteral1.ts, 17, 40)) >TCompare : Symbol(TCompare, Decl(genericSpecializationToTypeLiteral1.ts, 16, 18)) >second : Symbol(second, Decl(genericSpecializationToTypeLiteral1.ts, 16, 28)) >IEnumerable : Symbol(IEnumerable, Decl(genericSpecializationToTypeLiteral1.ts, 0, 0)) @@ -101,12 +101,12 @@ interface IEnumerable { >TCompare : Symbol(TCompare, Decl(genericSpecializationToTypeLiteral1.ts, 16, 18)) sequenceEqual(second: T[]): boolean; ->sequenceEqual : Symbol(sequenceEqual, Decl(genericSpecializationToTypeLiteral1.ts, 13, 66), Decl(genericSpecializationToTypeLiteral1.ts, 15, 51), Decl(genericSpecializationToTypeLiteral1.ts, 16, 104), Decl(genericSpecializationToTypeLiteral1.ts, 17, 40)) +>sequenceEqual : Symbol(IEnumerable.sequenceEqual, Decl(genericSpecializationToTypeLiteral1.ts, 13, 66), Decl(genericSpecializationToTypeLiteral1.ts, 15, 51), Decl(genericSpecializationToTypeLiteral1.ts, 16, 104), Decl(genericSpecializationToTypeLiteral1.ts, 17, 40)) >second : Symbol(second, Decl(genericSpecializationToTypeLiteral1.ts, 17, 18)) >T : Symbol(T, Decl(genericSpecializationToTypeLiteral1.ts, 0, 22)) sequenceEqual(second: T[], compareSelector: (element: T) => TCompare): boolean; ->sequenceEqual : Symbol(sequenceEqual, Decl(genericSpecializationToTypeLiteral1.ts, 13, 66), Decl(genericSpecializationToTypeLiteral1.ts, 15, 51), Decl(genericSpecializationToTypeLiteral1.ts, 16, 104), Decl(genericSpecializationToTypeLiteral1.ts, 17, 40)) +>sequenceEqual : Symbol(IEnumerable.sequenceEqual, Decl(genericSpecializationToTypeLiteral1.ts, 13, 66), Decl(genericSpecializationToTypeLiteral1.ts, 15, 51), Decl(genericSpecializationToTypeLiteral1.ts, 16, 104), Decl(genericSpecializationToTypeLiteral1.ts, 17, 40)) >TCompare : Symbol(TCompare, Decl(genericSpecializationToTypeLiteral1.ts, 18, 18)) >second : Symbol(second, Decl(genericSpecializationToTypeLiteral1.ts, 18, 28)) >T : Symbol(T, Decl(genericSpecializationToTypeLiteral1.ts, 0, 22)) @@ -116,7 +116,7 @@ interface IEnumerable { >TCompare : Symbol(TCompare, Decl(genericSpecializationToTypeLiteral1.ts, 18, 18)) toDictionary(keySelector: (element: T) => TKey): IDictionary; ->toDictionary : Symbol(toDictionary, Decl(genericSpecializationToTypeLiteral1.ts, 18, 93), Decl(genericSpecializationToTypeLiteral1.ts, 20, 82), Decl(genericSpecializationToTypeLiteral1.ts, 21, 134)) +>toDictionary : Symbol(IEnumerable.toDictionary, Decl(genericSpecializationToTypeLiteral1.ts, 18, 93), Decl(genericSpecializationToTypeLiteral1.ts, 20, 82), Decl(genericSpecializationToTypeLiteral1.ts, 21, 134)) >TKey : Symbol(TKey, Decl(genericSpecializationToTypeLiteral1.ts, 20, 17)) >keySelector : Symbol(keySelector, Decl(genericSpecializationToTypeLiteral1.ts, 20, 23)) >element : Symbol(element, Decl(genericSpecializationToTypeLiteral1.ts, 20, 37)) @@ -126,7 +126,7 @@ interface IEnumerable { >TKey : Symbol(TKey, Decl(genericSpecializationToTypeLiteral1.ts, 20, 17)) toDictionary(keySelector: (element: T) => TKey, elementSelector: (element: T) => TValue): IDictionary; ->toDictionary : Symbol(toDictionary, Decl(genericSpecializationToTypeLiteral1.ts, 18, 93), Decl(genericSpecializationToTypeLiteral1.ts, 20, 82), Decl(genericSpecializationToTypeLiteral1.ts, 21, 134)) +>toDictionary : Symbol(IEnumerable.toDictionary, Decl(genericSpecializationToTypeLiteral1.ts, 18, 93), Decl(genericSpecializationToTypeLiteral1.ts, 20, 82), Decl(genericSpecializationToTypeLiteral1.ts, 21, 134)) >TKey : Symbol(TKey, Decl(genericSpecializationToTypeLiteral1.ts, 21, 17)) >TValue : Symbol(TValue, Decl(genericSpecializationToTypeLiteral1.ts, 21, 22)) >keySelector : Symbol(keySelector, Decl(genericSpecializationToTypeLiteral1.ts, 21, 31)) @@ -142,7 +142,7 @@ interface IEnumerable { >TValue : Symbol(TValue, Decl(genericSpecializationToTypeLiteral1.ts, 21, 22)) toDictionary(keySelector: (element: T) => TKey, elementSelector: (element: T) => TValue, compareSelector: (key: TKey) => TCompare): IDictionary; ->toDictionary : Symbol(toDictionary, Decl(genericSpecializationToTypeLiteral1.ts, 18, 93), Decl(genericSpecializationToTypeLiteral1.ts, 20, 82), Decl(genericSpecializationToTypeLiteral1.ts, 21, 134)) +>toDictionary : Symbol(IEnumerable.toDictionary, Decl(genericSpecializationToTypeLiteral1.ts, 18, 93), Decl(genericSpecializationToTypeLiteral1.ts, 20, 82), Decl(genericSpecializationToTypeLiteral1.ts, 21, 134)) >TKey : Symbol(TKey, Decl(genericSpecializationToTypeLiteral1.ts, 22, 17)) >TValue : Symbol(TValue, Decl(genericSpecializationToTypeLiteral1.ts, 22, 22)) >TCompare : Symbol(TCompare, Decl(genericSpecializationToTypeLiteral1.ts, 22, 30)) @@ -169,7 +169,7 @@ interface IDictionary { >TValue : Symbol(TValue, Decl(genericSpecializationToTypeLiteral1.ts, 25, 27)) toEnumerable(): IEnumerable<{ key: TKey; value: TValue }>; ->toEnumerable : Symbol(toEnumerable, Decl(genericSpecializationToTypeLiteral1.ts, 25, 37)) +>toEnumerable : Symbol(IDictionary.toEnumerable, Decl(genericSpecializationToTypeLiteral1.ts, 25, 37)) >IEnumerable : Symbol(IEnumerable, Decl(genericSpecializationToTypeLiteral1.ts, 0, 0)) >key : Symbol(key, Decl(genericSpecializationToTypeLiteral1.ts, 26, 33)) >TKey : Symbol(TKey, Decl(genericSpecializationToTypeLiteral1.ts, 25, 22)) diff --git a/tests/baselines/reference/genericSpecializations1.symbols b/tests/baselines/reference/genericSpecializations1.symbols index 87f31276b3f..79e591d3186 100644 --- a/tests/baselines/reference/genericSpecializations1.symbols +++ b/tests/baselines/reference/genericSpecializations1.symbols @@ -4,7 +4,7 @@ interface IFoo { >T : Symbol(T, Decl(genericSpecializations1.ts, 0, 15)) foo(x: T): T; // no error on implementors because IFoo's T is different from foo's T ->foo : Symbol(foo, Decl(genericSpecializations1.ts, 0, 19)) +>foo : Symbol(IFoo.foo, Decl(genericSpecializations1.ts, 0, 19)) >T : Symbol(T, Decl(genericSpecializations1.ts, 1, 8)) >x : Symbol(x, Decl(genericSpecializations1.ts, 1, 11)) >T : Symbol(T, Decl(genericSpecializations1.ts, 1, 8)) @@ -16,7 +16,7 @@ class IntFooBad implements IFoo { >IFoo : Symbol(IFoo, Decl(genericSpecializations1.ts, 0, 0)) foo(x: string): string { return null; } ->foo : Symbol(foo, Decl(genericSpecializations1.ts, 4, 41)) +>foo : Symbol(IntFooBad.foo, Decl(genericSpecializations1.ts, 4, 41)) >x : Symbol(x, Decl(genericSpecializations1.ts, 5, 8)) } @@ -25,7 +25,7 @@ class StringFoo2 implements IFoo { >IFoo : Symbol(IFoo, Decl(genericSpecializations1.ts, 0, 0)) foo(x: string): string { return null; } ->foo : Symbol(foo, Decl(genericSpecializations1.ts, 8, 42)) +>foo : Symbol(StringFoo2.foo, Decl(genericSpecializations1.ts, 8, 42)) >x : Symbol(x, Decl(genericSpecializations1.ts, 9, 8)) } @@ -34,7 +34,7 @@ class StringFoo3 implements IFoo { >IFoo : Symbol(IFoo, Decl(genericSpecializations1.ts, 0, 0)) foo(x: T): T { return null; } ->foo : Symbol(foo, Decl(genericSpecializations1.ts, 12, 42)) +>foo : Symbol(StringFoo3.foo, Decl(genericSpecializations1.ts, 12, 42)) >T : Symbol(T, Decl(genericSpecializations1.ts, 13, 8)) >x : Symbol(x, Decl(genericSpecializations1.ts, 13, 11)) >T : Symbol(T, Decl(genericSpecializations1.ts, 13, 8)) diff --git a/tests/baselines/reference/genericSpecializations3.errors.txt b/tests/baselines/reference/genericSpecializations3.errors.txt index ccaa839f9d0..87a7d5bcce7 100644 --- a/tests/baselines/reference/genericSpecializations3.errors.txt +++ b/tests/baselines/reference/genericSpecializations3.errors.txt @@ -2,17 +2,17 @@ tests/cases/compiler/genericSpecializations3.ts(8,7): error TS2420: Class 'IntFo Types of property 'foo' are incompatible. Type '(x: string) => string' is not assignable to type '(x: number) => number'. Types of parameters 'x' and 'x' are incompatible. - Type 'string' is not assignable to type 'number'. + Type 'number' is not assignable to type 'string'. tests/cases/compiler/genericSpecializations3.ts(28,1): error TS2322: Type 'StringFoo2' is not assignable to type 'IntFoo'. Types of property 'foo' are incompatible. Type '(x: string) => string' is not assignable to type '(x: number) => number'. Types of parameters 'x' and 'x' are incompatible. - Type 'string' is not assignable to type 'number'. + Type 'number' is not assignable to type 'string'. tests/cases/compiler/genericSpecializations3.ts(29,1): error TS2322: Type 'IntFoo' is not assignable to type 'StringFoo2'. Types of property 'foo' are incompatible. Type '(x: number) => number' is not assignable to type '(x: string) => string'. Types of parameters 'x' and 'x' are incompatible. - Type 'number' is not assignable to type 'string'. + Type 'string' is not assignable to type 'number'. ==== tests/cases/compiler/genericSpecializations3.ts (3 errors) ==== @@ -29,7 +29,7 @@ tests/cases/compiler/genericSpecializations3.ts(29,1): error TS2322: Type 'IntFo !!! error TS2420: Types of property 'foo' are incompatible. !!! error TS2420: Type '(x: string) => string' is not assignable to type '(x: number) => number'. !!! error TS2420: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2420: Type 'string' is not assignable to type 'number'. +!!! error TS2420: Type 'number' is not assignable to type 'string'. foo(x: string): string { return null; } } @@ -55,14 +55,14 @@ tests/cases/compiler/genericSpecializations3.ts(29,1): error TS2322: Type 'IntFo !!! error TS2322: Types of property 'foo' are incompatible. !!! error TS2322: Type '(x: string) => string' is not assignable to type '(x: number) => number'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. stringFoo2 = intFoo; // error ~~~~~~~~~~ !!! error TS2322: Type 'IntFoo' is not assignable to type 'StringFoo2'. !!! error TS2322: Types of property 'foo' are incompatible. !!! error TS2322: Type '(x: number) => number' is not assignable to type '(x: string) => string'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2322: Type 'number' is not assignable to type 'string'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. class StringFoo3 implements IFoo { // error diff --git a/tests/baselines/reference/genericTypeAliases.symbols b/tests/baselines/reference/genericTypeAliases.symbols index 1a1d0e51487..d5f68ec0615 100644 --- a/tests/baselines/reference/genericTypeAliases.symbols +++ b/tests/baselines/reference/genericTypeAliases.symbols @@ -130,11 +130,11 @@ interface Tuple { >B : Symbol(B, Decl(genericTypeAliases.ts, 41, 18)) a: A; ->a : Symbol(a, Decl(genericTypeAliases.ts, 41, 23)) +>a : Symbol(Tuple.a, Decl(genericTypeAliases.ts, 41, 23)) >A : Symbol(A, Decl(genericTypeAliases.ts, 41, 16)) b: B; ->b : Symbol(b, Decl(genericTypeAliases.ts, 42, 9)) +>b : Symbol(Tuple.b, Decl(genericTypeAliases.ts, 42, 9)) >B : Symbol(B, Decl(genericTypeAliases.ts, 41, 18)) } @@ -152,7 +152,7 @@ interface TaggedPair extends Pair { >T : Symbol(T, Decl(genericTypeAliases.ts, 48, 21)) tag: string; ->tag : Symbol(tag, Decl(genericTypeAliases.ts, 48, 41)) +>tag : Symbol(TaggedPair.tag, Decl(genericTypeAliases.ts, 48, 41)) } var p: TaggedPair; diff --git a/tests/baselines/reference/genericTypeArgumentInference1.symbols b/tests/baselines/reference/genericTypeArgumentInference1.symbols index 7b88a84337e..da48fc7919d 100644 --- a/tests/baselines/reference/genericTypeArgumentInference1.symbols +++ b/tests/baselines/reference/genericTypeArgumentInference1.symbols @@ -18,7 +18,7 @@ module Underscore { >Static : Symbol(Static, Decl(genericTypeArgumentInference1.ts, 3, 5)) all(list: T[], iterator?: Iterator, context?: any): T; ->all : Symbol(all, Decl(genericTypeArgumentInference1.ts, 4, 29)) +>all : Symbol(Static.all, Decl(genericTypeArgumentInference1.ts, 4, 29)) >T : Symbol(T, Decl(genericTypeArgumentInference1.ts, 5, 12)) >list : Symbol(list, Decl(genericTypeArgumentInference1.ts, 5, 15)) >T : Symbol(T, Decl(genericTypeArgumentInference1.ts, 5, 12)) @@ -29,7 +29,7 @@ module Underscore { >T : Symbol(T, Decl(genericTypeArgumentInference1.ts, 5, 12)) identity(value: T): T; ->identity : Symbol(identity, Decl(genericTypeArgumentInference1.ts, 5, 77)) +>identity : Symbol(Static.identity, Decl(genericTypeArgumentInference1.ts, 5, 77)) >T : Symbol(T, Decl(genericTypeArgumentInference1.ts, 6, 17)) >value : Symbol(value, Decl(genericTypeArgumentInference1.ts, 6, 20)) >T : Symbol(T, Decl(genericTypeArgumentInference1.ts, 6, 17)) diff --git a/tests/baselines/reference/genericTypeAssertions1.errors.txt b/tests/baselines/reference/genericTypeAssertions1.errors.txt index 5479c5f948e..aa5f14f5da8 100644 --- a/tests/baselines/reference/genericTypeAssertions1.errors.txt +++ b/tests/baselines/reference/genericTypeAssertions1.errors.txt @@ -2,8 +2,8 @@ tests/cases/compiler/genericTypeAssertions1.ts(3,5): error TS2322: Type 'A>' is not assignable to type 'A'. Type 'A' is not assignable to type 'number'. -tests/cases/compiler/genericTypeAssertions1.ts(4,21): error TS2352: Neither type 'A' nor type 'A>' is assignable to the other. - Type 'number' is not assignable to type 'A'. +tests/cases/compiler/genericTypeAssertions1.ts(4,21): error TS2352: Type 'A' cannot be converted to type 'A>'. + Type 'number' is not comparable to type 'A'. ==== tests/cases/compiler/genericTypeAssertions1.ts (3 errors) ==== @@ -18,5 +18,5 @@ tests/cases/compiler/genericTypeAssertions1.ts(4,21): error TS2352: Neither type !!! error TS2322: Type 'A>' is not assignable to type 'A'. !!! error TS2322: Type 'A' is not assignable to type 'number'. ~~~~~~~~~~~~~~~~~ -!!! error TS2352: Neither type 'A' nor type 'A>' is assignable to the other. -!!! error TS2352: Type 'number' is not assignable to type 'A'. \ No newline at end of file +!!! error TS2352: Type 'A' cannot be converted to type 'A>'. +!!! error TS2352: Type 'number' is not comparable to type 'A'. \ No newline at end of file diff --git a/tests/baselines/reference/genericTypeAssertions2.errors.txt b/tests/baselines/reference/genericTypeAssertions2.errors.txt index eda4c83646c..756690f1783 100644 --- a/tests/baselines/reference/genericTypeAssertions2.errors.txt +++ b/tests/baselines/reference/genericTypeAssertions2.errors.txt @@ -2,10 +2,10 @@ tests/cases/compiler/genericTypeAssertions2.ts(10,5): error TS2322: Type 'B void' is not assignable to type '(x: number) => void'. Types of parameters 'x' and 'x' are incompatible. - Type 'string' is not assignable to type 'number'. + Type 'number' is not assignable to type 'string'. tests/cases/compiler/genericTypeAssertions2.ts(11,5): error TS2322: Type 'A' is not assignable to type 'B'. Property 'bar' is missing in type 'A'. -tests/cases/compiler/genericTypeAssertions2.ts(13,21): error TS2352: Neither type 'undefined[]' nor type 'A' is assignable to the other. +tests/cases/compiler/genericTypeAssertions2.ts(13,21): error TS2352: Type 'undefined[]' cannot be converted to type 'A'. Property 'foo' is missing in type 'undefined[]'. @@ -25,7 +25,7 @@ tests/cases/compiler/genericTypeAssertions2.ts(13,21): error TS2352: Neither typ !!! error TS2322: Types of property 'foo' are incompatible. !!! error TS2322: Type '(x: string) => void' is not assignable to type '(x: number) => void'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. var r3: B = >new B(); // error ~~ !!! error TS2322: Type 'A' is not assignable to type 'B'. @@ -33,5 +33,5 @@ tests/cases/compiler/genericTypeAssertions2.ts(13,21): error TS2352: Neither typ var r4: A = >new A(); var r5: A = >[]; // error ~~~~~~~~~~~~~ -!!! error TS2352: Neither type 'undefined[]' nor type 'A' is assignable to the other. +!!! error TS2352: Type 'undefined[]' cannot be converted to type 'A'. !!! error TS2352: Property 'foo' is missing in type 'undefined[]'. \ No newline at end of file diff --git a/tests/baselines/reference/genericTypeAssertions4.errors.txt b/tests/baselines/reference/genericTypeAssertions4.errors.txt index 055de774b39..401834930f3 100644 --- a/tests/baselines/reference/genericTypeAssertions4.errors.txt +++ b/tests/baselines/reference/genericTypeAssertions4.errors.txt @@ -1,8 +1,8 @@ tests/cases/compiler/genericTypeAssertions4.ts(19,5): error TS2322: Type 'A' is not assignable to type 'T'. tests/cases/compiler/genericTypeAssertions4.ts(20,5): error TS2322: Type 'B' is not assignable to type 'T'. tests/cases/compiler/genericTypeAssertions4.ts(21,5): error TS2322: Type 'C' is not assignable to type 'T'. -tests/cases/compiler/genericTypeAssertions4.ts(23,9): error TS2352: Neither type 'B' nor type 'T' is assignable to the other. -tests/cases/compiler/genericTypeAssertions4.ts(24,9): error TS2352: Neither type 'C' nor type 'T' is assignable to the other. +tests/cases/compiler/genericTypeAssertions4.ts(23,9): error TS2352: Type 'B' cannot be converted to type 'T'. +tests/cases/compiler/genericTypeAssertions4.ts(24,9): error TS2352: Type 'C' cannot be converted to type 'T'. ==== tests/cases/compiler/genericTypeAssertions4.ts (5 errors) ==== @@ -36,8 +36,8 @@ tests/cases/compiler/genericTypeAssertions4.ts(24,9): error TS2352: Neither type y = a; y = b; // error: cannot convert B to T ~~~~ -!!! error TS2352: Neither type 'B' nor type 'T' is assignable to the other. +!!! error TS2352: Type 'B' cannot be converted to type 'T'. y = c; // error: cannot convert C to T ~~~~ -!!! error TS2352: Neither type 'C' nor type 'T' is assignable to the other. +!!! error TS2352: Type 'C' cannot be converted to type 'T'. } \ No newline at end of file diff --git a/tests/baselines/reference/genericTypeAssertions5.errors.txt b/tests/baselines/reference/genericTypeAssertions5.errors.txt index e315a7f122a..45f76073363 100644 --- a/tests/baselines/reference/genericTypeAssertions5.errors.txt +++ b/tests/baselines/reference/genericTypeAssertions5.errors.txt @@ -1,8 +1,8 @@ tests/cases/compiler/genericTypeAssertions5.ts(19,5): error TS2322: Type 'A' is not assignable to type 'T'. tests/cases/compiler/genericTypeAssertions5.ts(20,5): error TS2322: Type 'B' is not assignable to type 'T'. tests/cases/compiler/genericTypeAssertions5.ts(21,5): error TS2322: Type 'C' is not assignable to type 'T'. -tests/cases/compiler/genericTypeAssertions5.ts(23,9): error TS2352: Neither type 'B' nor type 'T' is assignable to the other. -tests/cases/compiler/genericTypeAssertions5.ts(24,9): error TS2352: Neither type 'C' nor type 'T' is assignable to the other. +tests/cases/compiler/genericTypeAssertions5.ts(23,9): error TS2352: Type 'B' cannot be converted to type 'T'. +tests/cases/compiler/genericTypeAssertions5.ts(24,9): error TS2352: Type 'C' cannot be converted to type 'T'. ==== tests/cases/compiler/genericTypeAssertions5.ts (5 errors) ==== @@ -36,8 +36,8 @@ tests/cases/compiler/genericTypeAssertions5.ts(24,9): error TS2352: Neither type y = a; y = b; // error: cannot convert B to T ~~~~ -!!! error TS2352: Neither type 'B' nor type 'T' is assignable to the other. +!!! error TS2352: Type 'B' cannot be converted to type 'T'. y = c; // error: cannot convert C to T ~~~~ -!!! error TS2352: Neither type 'C' nor type 'T' is assignable to the other. +!!! error TS2352: Type 'C' cannot be converted to type 'T'. } \ No newline at end of file diff --git a/tests/baselines/reference/genericTypeAssertions6.errors.txt b/tests/baselines/reference/genericTypeAssertions6.errors.txt index 29ca99ecb1a..1bda683b88a 100644 --- a/tests/baselines/reference/genericTypeAssertions6.errors.txt +++ b/tests/baselines/reference/genericTypeAssertions6.errors.txt @@ -1,7 +1,7 @@ -tests/cases/compiler/genericTypeAssertions6.ts(8,13): error TS2352: Neither type 'U' nor type 'T' is assignable to the other. -tests/cases/compiler/genericTypeAssertions6.ts(9,13): error TS2352: Neither type 'T' nor type 'U' is assignable to the other. -tests/cases/compiler/genericTypeAssertions6.ts(19,17): error TS2352: Neither type 'U' nor type 'T' is assignable to the other. - Type 'Date' is not assignable to type 'T'. +tests/cases/compiler/genericTypeAssertions6.ts(8,13): error TS2352: Type 'U' cannot be converted to type 'T'. +tests/cases/compiler/genericTypeAssertions6.ts(9,13): error TS2352: Type 'T' cannot be converted to type 'U'. +tests/cases/compiler/genericTypeAssertions6.ts(19,17): error TS2352: Type 'U' cannot be converted to type 'T'. + Type 'Date' is not comparable to type 'T'. ==== tests/cases/compiler/genericTypeAssertions6.ts (3 errors) ==== @@ -14,10 +14,10 @@ tests/cases/compiler/genericTypeAssertions6.ts(19,17): error TS2352: Neither typ f(x: T, y: U) { x = y; ~~~~ -!!! error TS2352: Neither type 'U' nor type 'T' is assignable to the other. +!!! error TS2352: Type 'U' cannot be converted to type 'T'. y = x; ~~~~ -!!! error TS2352: Neither type 'T' nor type 'U' is assignable to the other. +!!! error TS2352: Type 'T' cannot be converted to type 'U'. } } @@ -29,8 +29,8 @@ tests/cases/compiler/genericTypeAssertions6.ts(19,17): error TS2352: Neither typ var d = new Date(); var e = new Date(); ~~~~~~~~~~~~~~~~ -!!! error TS2352: Neither type 'U' nor type 'T' is assignable to the other. -!!! error TS2352: Type 'Date' is not assignable to type 'T'. +!!! error TS2352: Type 'U' cannot be converted to type 'T'. +!!! error TS2352: Type 'Date' is not comparable to type 'T'. } } diff --git a/tests/baselines/reference/genericTypeParameterEquivalence2.types b/tests/baselines/reference/genericTypeParameterEquivalence2.types index 3b2c533543d..44e495088bc 100644 --- a/tests/baselines/reference/genericTypeParameterEquivalence2.types +++ b/tests/baselines/reference/genericTypeParameterEquivalence2.types @@ -27,9 +27,9 @@ function compose(f: (b: B) => C, g: (a:A) => B): (a:A) => C { >f(g.apply(null, a)) : C >f : (b: B) => C >g.apply(null, a) : any ->g.apply : (thisArg: any, argArray?: any) => any +>g.apply : (this: Function, thisArg: any, argArray?: any) => any >g : (a: A) => B ->apply : (thisArg: any, argArray?: any) => any +>apply : (this: Function, thisArg: any, argArray?: any) => any >null : null >a : A diff --git a/tests/baselines/reference/genericTypeWithCallableMembers.symbols b/tests/baselines/reference/genericTypeWithCallableMembers.symbols index f162ddf64cc..810f67316d4 100644 --- a/tests/baselines/reference/genericTypeWithCallableMembers.symbols +++ b/tests/baselines/reference/genericTypeWithCallableMembers.symbols @@ -12,25 +12,25 @@ class C { >Constructable : Symbol(Constructable, Decl(genericTypeWithCallableMembers.ts, 0, 0)) constructor(public data: T, public data2: Constructable) { } ->data : Symbol(data, Decl(genericTypeWithCallableMembers.ts, 5, 16)) +>data : Symbol(C.data, Decl(genericTypeWithCallableMembers.ts, 5, 16)) >T : Symbol(T, Decl(genericTypeWithCallableMembers.ts, 4, 8)) ->data2 : Symbol(data2, Decl(genericTypeWithCallableMembers.ts, 5, 31)) +>data2 : Symbol(C.data2, Decl(genericTypeWithCallableMembers.ts, 5, 31)) >Constructable : Symbol(Constructable, Decl(genericTypeWithCallableMembers.ts, 0, 0)) create() { ->create : Symbol(create, Decl(genericTypeWithCallableMembers.ts, 5, 64)) +>create : Symbol(C.create, Decl(genericTypeWithCallableMembers.ts, 5, 64)) var x = new this.data(); // no error >x : Symbol(x, Decl(genericTypeWithCallableMembers.ts, 7, 11)) ->this.data : Symbol(data, Decl(genericTypeWithCallableMembers.ts, 5, 16)) +>this.data : Symbol(C.data, Decl(genericTypeWithCallableMembers.ts, 5, 16)) >this : Symbol(C, Decl(genericTypeWithCallableMembers.ts, 2, 1)) ->data : Symbol(data, Decl(genericTypeWithCallableMembers.ts, 5, 16)) +>data : Symbol(C.data, Decl(genericTypeWithCallableMembers.ts, 5, 16)) var x2 = new this.data2(); // was error, shouldn't be >x2 : Symbol(x2, Decl(genericTypeWithCallableMembers.ts, 8, 11)) ->this.data2 : Symbol(data2, Decl(genericTypeWithCallableMembers.ts, 5, 31)) +>this.data2 : Symbol(C.data2, Decl(genericTypeWithCallableMembers.ts, 5, 31)) >this : Symbol(C, Decl(genericTypeWithCallableMembers.ts, 2, 1)) ->data2 : Symbol(data2, Decl(genericTypeWithCallableMembers.ts, 5, 31)) +>data2 : Symbol(C.data2, Decl(genericTypeWithCallableMembers.ts, 5, 31)) } } diff --git a/tests/baselines/reference/genericTypeWithMultipleBases1.symbols b/tests/baselines/reference/genericTypeWithMultipleBases1.symbols index f38f47e9038..87a6e9a75ca 100644 --- a/tests/baselines/reference/genericTypeWithMultipleBases1.symbols +++ b/tests/baselines/reference/genericTypeWithMultipleBases1.symbols @@ -3,14 +3,14 @@ export interface I1 { >I1 : Symbol(I1, Decl(genericTypeWithMultipleBases1.ts, 0, 0)) m1: () => void; ->m1 : Symbol(m1, Decl(genericTypeWithMultipleBases1.ts, 0, 21)) +>m1 : Symbol(I1.m1, Decl(genericTypeWithMultipleBases1.ts, 0, 21)) } export interface I2 { >I2 : Symbol(I2, Decl(genericTypeWithMultipleBases1.ts, 2, 1)) m2: () => void; ->m2 : Symbol(m2, Decl(genericTypeWithMultipleBases1.ts, 4, 21)) +>m2 : Symbol(I2.m2, Decl(genericTypeWithMultipleBases1.ts, 4, 21)) } export interface I3 extends I1, I2 { @@ -21,7 +21,7 @@ export interface I3 extends I1, I2 { //export interface I3 extends I2, I1 { p1: T; ->p1 : Symbol(p1, Decl(genericTypeWithMultipleBases1.ts, 8, 39)) +>p1 : Symbol(I3.p1, Decl(genericTypeWithMultipleBases1.ts, 8, 39)) >T : Symbol(T, Decl(genericTypeWithMultipleBases1.ts, 8, 20)) } diff --git a/tests/baselines/reference/genericTypeWithMultipleBases2.symbols b/tests/baselines/reference/genericTypeWithMultipleBases2.symbols index e5b97ce73fa..c15e1820f4b 100644 --- a/tests/baselines/reference/genericTypeWithMultipleBases2.symbols +++ b/tests/baselines/reference/genericTypeWithMultipleBases2.symbols @@ -3,14 +3,14 @@ export interface I1 { >I1 : Symbol(I1, Decl(genericTypeWithMultipleBases2.ts, 0, 0)) m1: () => void; ->m1 : Symbol(m1, Decl(genericTypeWithMultipleBases2.ts, 0, 21)) +>m1 : Symbol(I1.m1, Decl(genericTypeWithMultipleBases2.ts, 0, 21)) } export interface I2 { >I2 : Symbol(I2, Decl(genericTypeWithMultipleBases2.ts, 2, 1)) m2: () => void; ->m2 : Symbol(m2, Decl(genericTypeWithMultipleBases2.ts, 4, 21)) +>m2 : Symbol(I2.m2, Decl(genericTypeWithMultipleBases2.ts, 4, 21)) } export interface I3 extends I2, I1 { @@ -20,7 +20,7 @@ export interface I3 extends I2, I1 { >I1 : Symbol(I1, Decl(genericTypeWithMultipleBases2.ts, 0, 0)) p1: T; ->p1 : Symbol(p1, Decl(genericTypeWithMultipleBases2.ts, 8, 39)) +>p1 : Symbol(I3.p1, Decl(genericTypeWithMultipleBases2.ts, 8, 39)) >T : Symbol(T, Decl(genericTypeWithMultipleBases2.ts, 8, 20)) } diff --git a/tests/baselines/reference/genericTypeWithMultipleBases3.symbols b/tests/baselines/reference/genericTypeWithMultipleBases3.symbols index 024ddcdf374..d645c829a35 100644 --- a/tests/baselines/reference/genericTypeWithMultipleBases3.symbols +++ b/tests/baselines/reference/genericTypeWithMultipleBases3.symbols @@ -4,7 +4,7 @@ interface IA { >T : Symbol(T, Decl(genericTypeWithMultipleBases3.ts, 0, 13)) foo(x: T): T; ->foo : Symbol(foo, Decl(genericTypeWithMultipleBases3.ts, 0, 17)) +>foo : Symbol(IA.foo, Decl(genericTypeWithMultipleBases3.ts, 0, 17)) >x : Symbol(x, Decl(genericTypeWithMultipleBases3.ts, 2, 4)) >T : Symbol(T, Decl(genericTypeWithMultipleBases3.ts, 0, 13)) >T : Symbol(T, Decl(genericTypeWithMultipleBases3.ts, 0, 13)) @@ -16,7 +16,7 @@ interface IB { >T : Symbol(T, Decl(genericTypeWithMultipleBases3.ts, 6, 13)) bar(x: T): T; ->bar : Symbol(bar, Decl(genericTypeWithMultipleBases3.ts, 6, 17)) +>bar : Symbol(IB.bar, Decl(genericTypeWithMultipleBases3.ts, 6, 17)) >x : Symbol(x, Decl(genericTypeWithMultipleBases3.ts, 8, 4)) >T : Symbol(T, Decl(genericTypeWithMultipleBases3.ts, 6, 13)) >T : Symbol(T, Decl(genericTypeWithMultipleBases3.ts, 6, 13)) diff --git a/tests/baselines/reference/genericTypeWithNonGenericBaseMisMatch.errors.txt b/tests/baselines/reference/genericTypeWithNonGenericBaseMisMatch.errors.txt index 0fe15afcf33..3ec6fa5e9f6 100644 --- a/tests/baselines/reference/genericTypeWithNonGenericBaseMisMatch.errors.txt +++ b/tests/baselines/reference/genericTypeWithNonGenericBaseMisMatch.errors.txt @@ -2,17 +2,14 @@ tests/cases/compiler/genericTypeWithNonGenericBaseMisMatch.ts(4,7): error TS2420 Types of property 'f' are incompatible. Type '(a: T) => void' is not assignable to type '(a: { a: number; }) => void'. Types of parameters 'a' and 'a' are incompatible. - Type 'T' is not assignable to type '{ a: number; }'. - Type '{ a: string; }' is not assignable to type '{ a: number; }'. - Types of property 'a' are incompatible. - Type 'string' is not assignable to type 'number'. + Type '{ a: number; }' is not assignable to type 'T'. tests/cases/compiler/genericTypeWithNonGenericBaseMisMatch.ts(8,5): error TS2322: Type 'X<{ a: string; }>' is not assignable to type 'I'. Types of property 'f' are incompatible. Type '(a: { a: string; }) => void' is not assignable to type '(a: { a: number; }) => void'. Types of parameters 'a' and 'a' are incompatible. - Type '{ a: string; }' is not assignable to type '{ a: number; }'. + Type '{ a: number; }' is not assignable to type '{ a: string; }'. Types of property 'a' are incompatible. - Type 'string' is not assignable to type 'number'. + Type 'number' is not assignable to type 'string'. ==== tests/cases/compiler/genericTypeWithNonGenericBaseMisMatch.ts (2 errors) ==== @@ -25,10 +22,7 @@ tests/cases/compiler/genericTypeWithNonGenericBaseMisMatch.ts(8,5): error TS2322 !!! error TS2420: Types of property 'f' are incompatible. !!! error TS2420: Type '(a: T) => void' is not assignable to type '(a: { a: number; }) => void'. !!! error TS2420: Types of parameters 'a' and 'a' are incompatible. -!!! error TS2420: Type 'T' is not assignable to type '{ a: number; }'. -!!! error TS2420: Type '{ a: string; }' is not assignable to type '{ a: number; }'. -!!! error TS2420: Types of property 'a' are incompatible. -!!! error TS2420: Type 'string' is not assignable to type 'number'. +!!! error TS2420: Type '{ a: number; }' is not assignable to type 'T'. f(a: T): void { } } var x = new X<{ a: string }>(); @@ -38,7 +32,7 @@ tests/cases/compiler/genericTypeWithNonGenericBaseMisMatch.ts(8,5): error TS2322 !!! error TS2322: Types of property 'f' are incompatible. !!! error TS2322: Type '(a: { a: string; }) => void' is not assignable to type '(a: { a: number; }) => void'. !!! error TS2322: Types of parameters 'a' and 'a' are incompatible. -!!! error TS2322: Type '{ a: string; }' is not assignable to type '{ a: number; }'. +!!! error TS2322: Type '{ a: number; }' is not assignable to type '{ a: string; }'. !!! error TS2322: Types of property 'a' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/genericWithCallSignatureReturningSpecialization.symbols b/tests/baselines/reference/genericWithCallSignatureReturningSpecialization.symbols index 02e73f4819e..3de80ba3f1c 100644 --- a/tests/baselines/reference/genericWithCallSignatureReturningSpecialization.symbols +++ b/tests/baselines/reference/genericWithCallSignatureReturningSpecialization.symbols @@ -4,7 +4,7 @@ interface B { >T : Symbol(T, Decl(genericWithCallSignatureReturningSpecialization.ts, 0, 12)) f(): B; ->f : Symbol(f, Decl(genericWithCallSignatureReturningSpecialization.ts, 0, 16)) +>f : Symbol(B.f, Decl(genericWithCallSignatureReturningSpecialization.ts, 0, 16)) >B : Symbol(B, Decl(genericWithCallSignatureReturningSpecialization.ts, 0, 0)) (value: T): void; diff --git a/tests/baselines/reference/genericWithCallSignatures1.symbols b/tests/baselines/reference/genericWithCallSignatures1.symbols index d791308b46e..de20c7c14aa 100644 --- a/tests/baselines/reference/genericWithCallSignatures1.symbols +++ b/tests/baselines/reference/genericWithCallSignatures1.symbols @@ -4,17 +4,17 @@ class MyClass { >MyClass : Symbol(MyClass, Decl(genericWithCallSignatures_1.ts, 0, 0)) public callableThing: CallableExtention; ->callableThing : Symbol(callableThing, Decl(genericWithCallSignatures_1.ts, 1, 15)) +>callableThing : Symbol(MyClass.callableThing, Decl(genericWithCallSignatures_1.ts, 1, 15)) >CallableExtention : Symbol(CallableExtention, Decl(genericWithCallSignatures_0.ts, 3, 1)) public myMethod() { ->myMethod : Symbol(myMethod, Decl(genericWithCallSignatures_1.ts, 2, 52)) +>myMethod : Symbol(MyClass.myMethod, Decl(genericWithCallSignatures_1.ts, 2, 52)) var x = this.callableThing(); >x : Symbol(x, Decl(genericWithCallSignatures_1.ts, 5, 11)) ->this.callableThing : Symbol(callableThing, Decl(genericWithCallSignatures_1.ts, 1, 15)) +>this.callableThing : Symbol(MyClass.callableThing, Decl(genericWithCallSignatures_1.ts, 1, 15)) >this : Symbol(MyClass, Decl(genericWithCallSignatures_1.ts, 0, 0)) ->callableThing : Symbol(callableThing, Decl(genericWithCallSignatures_1.ts, 1, 15)) +>callableThing : Symbol(MyClass.callableThing, Decl(genericWithCallSignatures_1.ts, 1, 15)) } } === tests/cases/compiler/genericWithCallSignatures_0.ts === diff --git a/tests/baselines/reference/genericWithIndexerOfTypeParameterType1.symbols b/tests/baselines/reference/genericWithIndexerOfTypeParameterType1.symbols index 26918e9ebfb..ac7abff8d52 100644 --- a/tests/baselines/reference/genericWithIndexerOfTypeParameterType1.symbols +++ b/tests/baselines/reference/genericWithIndexerOfTypeParameterType1.symbols @@ -4,17 +4,17 @@ class LazyArray { >T : Symbol(T, Decl(genericWithIndexerOfTypeParameterType1.ts, 0, 16)) private objects = <{ [objectId: string]: T; }>{}; ->objects : Symbol(objects, Decl(genericWithIndexerOfTypeParameterType1.ts, 0, 20)) +>objects : Symbol(LazyArray.objects, Decl(genericWithIndexerOfTypeParameterType1.ts, 0, 20)) >objectId : Symbol(objectId, Decl(genericWithIndexerOfTypeParameterType1.ts, 1, 26)) >T : Symbol(T, Decl(genericWithIndexerOfTypeParameterType1.ts, 0, 16)) array() { ->array : Symbol(array, Decl(genericWithIndexerOfTypeParameterType1.ts, 1, 53)) +>array : Symbol(LazyArray.array, Decl(genericWithIndexerOfTypeParameterType1.ts, 1, 53)) return this.objects; ->this.objects : Symbol(objects, Decl(genericWithIndexerOfTypeParameterType1.ts, 0, 20)) +>this.objects : Symbol(LazyArray.objects, Decl(genericWithIndexerOfTypeParameterType1.ts, 0, 20)) >this : Symbol(LazyArray, Decl(genericWithIndexerOfTypeParameterType1.ts, 0, 0)) ->objects : Symbol(objects, Decl(genericWithIndexerOfTypeParameterType1.ts, 0, 20)) +>objects : Symbol(LazyArray.objects, Decl(genericWithIndexerOfTypeParameterType1.ts, 0, 20)) } } var lazyArray = new LazyArray(); diff --git a/tests/baselines/reference/genericWithIndexerOfTypeParameterType1.types b/tests/baselines/reference/genericWithIndexerOfTypeParameterType1.types index 337993dc2a6..a316773e5c8 100644 --- a/tests/baselines/reference/genericWithIndexerOfTypeParameterType1.types +++ b/tests/baselines/reference/genericWithIndexerOfTypeParameterType1.types @@ -8,7 +8,7 @@ class LazyArray { ><{ [objectId: string]: T; }>{} : { [objectId: string]: T; } >objectId : string >T : T ->{} : { [x: string]: undefined; } +>{} : {} array() { >array : () => { [objectId: string]: T; } diff --git a/tests/baselines/reference/genericWithIndexerOfTypeParameterType2.symbols b/tests/baselines/reference/genericWithIndexerOfTypeParameterType2.symbols index d09abef57be..d029796b2b1 100644 --- a/tests/baselines/reference/genericWithIndexerOfTypeParameterType2.symbols +++ b/tests/baselines/reference/genericWithIndexerOfTypeParameterType2.symbols @@ -5,7 +5,7 @@ export class Collection { >CollectionItem : Symbol(CollectionItem, Decl(genericWithIndexerOfTypeParameterType2.ts, 6, 1)) _itemsByKey: { [key: string]: TItem; }; ->_itemsByKey : Symbol(_itemsByKey, Decl(genericWithIndexerOfTypeParameterType2.ts, 0, 55)) +>_itemsByKey : Symbol(Collection._itemsByKey, Decl(genericWithIndexerOfTypeParameterType2.ts, 0, 55)) >key : Symbol(key, Decl(genericWithIndexerOfTypeParameterType2.ts, 1, 20)) >TItem : Symbol(TItem, Decl(genericWithIndexerOfTypeParameterType2.ts, 0, 24)) } @@ -16,7 +16,7 @@ export class List extends Collection{ >ListItem : Symbol(ListItem, Decl(genericWithIndexerOfTypeParameterType2.ts, 8, 30)) Bar() {} ->Bar : Symbol(Bar, Decl(genericWithIndexerOfTypeParameterType2.ts, 4, 47)) +>Bar : Symbol(List.Bar, Decl(genericWithIndexerOfTypeParameterType2.ts, 4, 47)) } export class CollectionItem {} @@ -27,6 +27,6 @@ export class ListItem extends CollectionItem { >CollectionItem : Symbol(CollectionItem, Decl(genericWithIndexerOfTypeParameterType2.ts, 6, 1)) __isNew: boolean; ->__isNew : Symbol(__isNew, Decl(genericWithIndexerOfTypeParameterType2.ts, 10, 46)) +>__isNew : Symbol(ListItem.__isNew, Decl(genericWithIndexerOfTypeParameterType2.ts, 10, 46)) } diff --git a/tests/baselines/reference/generics0.symbols b/tests/baselines/reference/generics0.symbols index 801b56fe718..9d23b667790 100644 --- a/tests/baselines/reference/generics0.symbols +++ b/tests/baselines/reference/generics0.symbols @@ -4,7 +4,7 @@ interface G { >T : Symbol(T, Decl(generics0.ts, 0, 12)) x: T; ->x : Symbol(x, Decl(generics0.ts, 0, 16)) +>x : Symbol(G.x, Decl(generics0.ts, 0, 16)) >T : Symbol(T, Decl(generics0.ts, 0, 12)) } diff --git a/tests/baselines/reference/generics1NoError.symbols b/tests/baselines/reference/generics1NoError.symbols index fcf820f79c4..12d6bac9459 100644 --- a/tests/baselines/reference/generics1NoError.symbols +++ b/tests/baselines/reference/generics1NoError.symbols @@ -1,17 +1,17 @@ === tests/cases/compiler/generics1NoError.ts === interface A { a: string; } >A : Symbol(A, Decl(generics1NoError.ts, 0, 0)) ->a : Symbol(a, Decl(generics1NoError.ts, 0, 13)) +>a : Symbol(A.a, Decl(generics1NoError.ts, 0, 13)) interface B extends A { b: string; } >B : Symbol(B, Decl(generics1NoError.ts, 0, 26)) >A : Symbol(A, Decl(generics1NoError.ts, 0, 0)) ->b : Symbol(b, Decl(generics1NoError.ts, 1, 23)) +>b : Symbol(B.b, Decl(generics1NoError.ts, 1, 23)) interface C extends B { c: string; } >C : Symbol(C, Decl(generics1NoError.ts, 1, 36)) >B : Symbol(B, Decl(generics1NoError.ts, 0, 26)) ->c : Symbol(c, Decl(generics1NoError.ts, 2, 23)) +>c : Symbol(C.c, Decl(generics1NoError.ts, 2, 23)) interface G { >G : Symbol(G, Decl(generics1NoError.ts, 2, 36)) @@ -20,11 +20,11 @@ interface G { >B : Symbol(B, Decl(generics1NoError.ts, 0, 26)) x: T; ->x : Symbol(x, Decl(generics1NoError.ts, 3, 29)) +>x : Symbol(G.x, Decl(generics1NoError.ts, 3, 29)) >T : Symbol(T, Decl(generics1NoError.ts, 3, 12)) y: U; ->y : Symbol(y, Decl(generics1NoError.ts, 4, 9)) +>y : Symbol(G.y, Decl(generics1NoError.ts, 4, 9)) >U : Symbol(U, Decl(generics1NoError.ts, 3, 14)) } var v1: G; // Ok diff --git a/tests/baselines/reference/generics2NoError.symbols b/tests/baselines/reference/generics2NoError.symbols index 165eb435a50..6c7f00bdcbe 100644 --- a/tests/baselines/reference/generics2NoError.symbols +++ b/tests/baselines/reference/generics2NoError.symbols @@ -1,17 +1,17 @@ === tests/cases/compiler/generics2NoError.ts === interface A { a: string; } >A : Symbol(A, Decl(generics2NoError.ts, 0, 0)) ->a : Symbol(a, Decl(generics2NoError.ts, 0, 13)) +>a : Symbol(A.a, Decl(generics2NoError.ts, 0, 13)) interface B extends A { b: string; } >B : Symbol(B, Decl(generics2NoError.ts, 0, 26)) >A : Symbol(A, Decl(generics2NoError.ts, 0, 0)) ->b : Symbol(b, Decl(generics2NoError.ts, 1, 23)) +>b : Symbol(B.b, Decl(generics2NoError.ts, 1, 23)) interface C extends B { c: string; } >C : Symbol(C, Decl(generics2NoError.ts, 1, 36)) >B : Symbol(B, Decl(generics2NoError.ts, 0, 26)) ->c : Symbol(c, Decl(generics2NoError.ts, 2, 23)) +>c : Symbol(C.c, Decl(generics2NoError.ts, 2, 23)) interface G { >G : Symbol(G, Decl(generics2NoError.ts, 2, 36)) @@ -20,11 +20,11 @@ interface G { >B : Symbol(B, Decl(generics2NoError.ts, 0, 26)) x: T; ->x : Symbol(x, Decl(generics2NoError.ts, 3, 29)) +>x : Symbol(G.x, Decl(generics2NoError.ts, 3, 29)) >T : Symbol(T, Decl(generics2NoError.ts, 3, 12)) y: U; ->y : Symbol(y, Decl(generics2NoError.ts, 4, 9)) +>y : Symbol(G.y, Decl(generics2NoError.ts, 4, 9)) >U : Symbol(U, Decl(generics2NoError.ts, 3, 14)) } diff --git a/tests/baselines/reference/generics3.symbols b/tests/baselines/reference/generics3.symbols index be9c583ff5f..c5e882b221a 100644 --- a/tests/baselines/reference/generics3.symbols +++ b/tests/baselines/reference/generics3.symbols @@ -2,16 +2,16 @@ class C { private x: T; } >C : Symbol(C, Decl(generics3.ts, 0, 0)) >T : Symbol(T, Decl(generics3.ts, 0, 8)) ->x : Symbol(x, Decl(generics3.ts, 0, 12)) +>x : Symbol(C.x, Decl(generics3.ts, 0, 12)) >T : Symbol(T, Decl(generics3.ts, 0, 8)) interface X { f(): string; } >X : Symbol(X, Decl(generics3.ts, 0, 28)) ->f : Symbol(f, Decl(generics3.ts, 1, 13)) +>f : Symbol(X.f, Decl(generics3.ts, 1, 13)) interface Y { f(): string; } >Y : Symbol(Y, Decl(generics3.ts, 1, 28)) ->f : Symbol(f, Decl(generics3.ts, 2, 13)) +>f : Symbol(Y.f, Decl(generics3.ts, 2, 13)) var a: C; >a : Symbol(a, Decl(generics3.ts, 3, 3)) diff --git a/tests/baselines/reference/generics4NoError.symbols b/tests/baselines/reference/generics4NoError.symbols index 9ea547d4db9..dd7eca8d2b4 100644 --- a/tests/baselines/reference/generics4NoError.symbols +++ b/tests/baselines/reference/generics4NoError.symbols @@ -2,16 +2,16 @@ class C { private x: T; } >C : Symbol(C, Decl(generics4NoError.ts, 0, 0)) >T : Symbol(T, Decl(generics4NoError.ts, 0, 8)) ->x : Symbol(x, Decl(generics4NoError.ts, 0, 12)) +>x : Symbol(C.x, Decl(generics4NoError.ts, 0, 12)) >T : Symbol(T, Decl(generics4NoError.ts, 0, 8)) interface X { f(): string; } >X : Symbol(X, Decl(generics4NoError.ts, 0, 28)) ->f : Symbol(f, Decl(generics4NoError.ts, 1, 13)) +>f : Symbol(X.f, Decl(generics4NoError.ts, 1, 13)) interface Y { f(): boolean; } >Y : Symbol(Y, Decl(generics4NoError.ts, 1, 28)) ->f : Symbol(f, Decl(generics4NoError.ts, 2, 13)) +>f : Symbol(Y.f, Decl(generics4NoError.ts, 2, 13)) var a: C; >a : Symbol(a, Decl(generics4NoError.ts, 3, 3)) diff --git a/tests/baselines/reference/getAndSetNotIdenticalType.errors.txt b/tests/baselines/reference/getAndSetNotIdenticalType.errors.txt index 6c55f966eee..a16cbfe7b37 100644 --- a/tests/baselines/reference/getAndSetNotIdenticalType.errors.txt +++ b/tests/baselines/reference/getAndSetNotIdenticalType.errors.txt @@ -1,23 +1,21 @@ -tests/cases/compiler/getAndSetNotIdenticalType.ts(2,5): error TS2380: 'get' and 'set' accessor must have the same type. tests/cases/compiler/getAndSetNotIdenticalType.ts(2,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/getAndSetNotIdenticalType.ts(5,5): error TS2380: 'get' and 'set' accessor must have the same type. +tests/cases/compiler/getAndSetNotIdenticalType.ts(2,9): error TS2380: 'get' and 'set' accessor must have the same type. tests/cases/compiler/getAndSetNotIdenticalType.ts(5,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/getAndSetNotIdenticalType.ts(5,9): error TS2380: 'get' and 'set' accessor must have the same type. ==== tests/cases/compiler/getAndSetNotIdenticalType.ts (4 errors) ==== class C { get x(): number { - ~~~~~~~~~~~~~~~~~ ~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + ~ +!!! error TS2380: 'get' and 'set' accessor must have the same type. return 1; - ~~~~~~~~~~~~~~~~~ } - ~~~~~ -!!! error TS2380: 'get' and 'set' accessor must have the same type. set x(v: string) { } - ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2380: 'get' and 'set' accessor must have the same type. ~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + ~ +!!! error TS2380: 'get' and 'set' accessor must have the same type. } \ No newline at end of file diff --git a/tests/baselines/reference/getAndSetNotIdenticalType2.errors.txt b/tests/baselines/reference/getAndSetNotIdenticalType2.errors.txt index 5cdb9b3a36f..c9fae8cc89c 100644 --- a/tests/baselines/reference/getAndSetNotIdenticalType2.errors.txt +++ b/tests/baselines/reference/getAndSetNotIdenticalType2.errors.txt @@ -1,7 +1,7 @@ -tests/cases/compiler/getAndSetNotIdenticalType2.ts(5,5): error TS2380: 'get' and 'set' accessor must have the same type. tests/cases/compiler/getAndSetNotIdenticalType2.ts(5,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/getAndSetNotIdenticalType2.ts(8,5): error TS2380: 'get' and 'set' accessor must have the same type. +tests/cases/compiler/getAndSetNotIdenticalType2.ts(5,9): error TS2380: 'get' and 'set' accessor must have the same type. tests/cases/compiler/getAndSetNotIdenticalType2.ts(8,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/getAndSetNotIdenticalType2.ts(8,9): error TS2380: 'get' and 'set' accessor must have the same type. tests/cases/compiler/getAndSetNotIdenticalType2.ts(9,9): error TS2322: Type 'A' is not assignable to type 'A'. Type 'string' is not assignable to type 'T'. @@ -12,26 +12,22 @@ tests/cases/compiler/getAndSetNotIdenticalType2.ts(9,9): error TS2322: Type 'A { data: A; get x(): A { - ~~~~~~~~~~~~~~~ ~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. - return this.data; - ~~~~~~~~~~~~~~~~~~~~~~~~~ - } - ~~~~~ + ~ !!! error TS2380: 'get' and 'set' accessor must have the same type. + return this.data; + } set x(v: A) { - ~~~~~~~~~~~~~~~~~~~~~ ~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + ~ +!!! error TS2380: 'get' and 'set' accessor must have the same type. this.data = v; - ~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~ !!! error TS2322: Type 'A' is not assignable to type 'A'. !!! error TS2322: Type 'string' is not assignable to type 'T'. } - ~~~~~ -!!! error TS2380: 'get' and 'set' accessor must have the same type. } var x = new C(); diff --git a/tests/baselines/reference/getAndSetNotIdenticalType3.errors.txt b/tests/baselines/reference/getAndSetNotIdenticalType3.errors.txt index 0aac384f7c3..3fb17d65a40 100644 --- a/tests/baselines/reference/getAndSetNotIdenticalType3.errors.txt +++ b/tests/baselines/reference/getAndSetNotIdenticalType3.errors.txt @@ -1,7 +1,7 @@ -tests/cases/compiler/getAndSetNotIdenticalType3.ts(5,5): error TS2380: 'get' and 'set' accessor must have the same type. tests/cases/compiler/getAndSetNotIdenticalType3.ts(5,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/getAndSetNotIdenticalType3.ts(8,5): error TS2380: 'get' and 'set' accessor must have the same type. +tests/cases/compiler/getAndSetNotIdenticalType3.ts(5,9): error TS2380: 'get' and 'set' accessor must have the same type. tests/cases/compiler/getAndSetNotIdenticalType3.ts(8,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/getAndSetNotIdenticalType3.ts(8,9): error TS2380: 'get' and 'set' accessor must have the same type. tests/cases/compiler/getAndSetNotIdenticalType3.ts(9,9): error TS2322: Type 'A' is not assignable to type 'A'. Type 'string' is not assignable to type 'number'. @@ -12,26 +12,22 @@ tests/cases/compiler/getAndSetNotIdenticalType3.ts(9,9): error TS2322: Type 'A { data: A; get x(): A { - ~~~~~~~~~~~~~~~~~~~~ ~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. - return this.data; - ~~~~~~~~~~~~~~~~~~~~~~~~~ - } - ~~~~~ + ~ !!! error TS2380: 'get' and 'set' accessor must have the same type. + return this.data; + } set x(v: A) { - ~~~~~~~~~~~~~~~~~~~~~ ~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + ~ +!!! error TS2380: 'get' and 'set' accessor must have the same type. this.data = v; - ~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~ !!! error TS2322: Type 'A' is not assignable to type 'A'. !!! error TS2322: Type 'string' is not assignable to type 'number'. } - ~~~~~ -!!! error TS2380: 'get' and 'set' accessor must have the same type. } var x = new C(); diff --git a/tests/baselines/reference/giant.js b/tests/baselines/reference/giant.js index 2a04541ef28..149a975d413 100644 --- a/tests/baselines/reference/giant.js +++ b/tests/baselines/reference/giant.js @@ -1120,11 +1120,11 @@ export declare class eC { pF(): void; private rF(); pgF(): void; - pgF: any; + readonly pgF: any; psF(param: any): void; psF: any; private rgF(); - private rgF; + private readonly rgF; private rsF(param); private rsF; static tV: any; @@ -1132,7 +1132,7 @@ export declare class eC { static tsF(param: any): void; static tsF: any; static tgF(): void; - static tgF: any; + static readonly tgF: any; } export interface eI { (): any; @@ -1172,11 +1172,11 @@ export declare module eM { pF(): void; private rF(); pgF(): void; - pgF: any; + readonly pgF: any; psF(param: any): void; psF: any; private rgF(); - private rgF; + private readonly rgF; private rsF(param); private rsF; static tV: any; @@ -1184,7 +1184,7 @@ export declare module eM { static tsF(param: any): void; static tsF: any; static tgF(): void; - static tgF: any; + static readonly tgF: any; } interface eI { (): any; @@ -1239,11 +1239,11 @@ export declare module eM { pF(): void; private rF(); pgF(): void; - pgF: any; + readonly pgF: any; psF(param: any): void; psF: any; private rgF(); - private rgF; + private readonly rgF; private rsF(param); private rsF; static tV: any; @@ -1251,7 +1251,7 @@ export declare module eM { static tsF(param: any): void; static tsF: any; static tgF(): void; - static tgF: any; + static readonly tgF: any; } module eaM { var V: any; @@ -1281,11 +1281,11 @@ export declare class eaC { pF(): void; private rF(); pgF(): void; - pgF: any; + readonly pgF: any; psF(param: any): void; psF: any; private rgF(); - private rgF; + private readonly rgF; private rsF(param); private rsF; static tV: any; @@ -1293,7 +1293,7 @@ export declare class eaC { static tsF(param: any): void; static tsF: any; static tgF(): void; - static tgF: any; + static readonly tgF: any; } export declare module eaM { var V: any; diff --git a/tests/baselines/reference/globalIsContextualKeyword.js b/tests/baselines/reference/globalIsContextualKeyword.js new file mode 100644 index 00000000000..b6fa566c91a --- /dev/null +++ b/tests/baselines/reference/globalIsContextualKeyword.js @@ -0,0 +1,34 @@ +//// [globalIsContextualKeyword.ts] +function a() { + let global = 1; +} +function b() { + class global {} +} + +namespace global { +} + +function foo(global: number) { +} + +let obj = { + global: "123" +} + +//// [globalIsContextualKeyword.js] +function a() { + var global = 1; +} +function b() { + var global = (function () { + function global() { + } + return global; + }()); +} +function foo(global) { +} +var obj = { + global: "123" +}; diff --git a/tests/baselines/reference/globalIsContextualKeyword.symbols b/tests/baselines/reference/globalIsContextualKeyword.symbols new file mode 100644 index 00000000000..edc1cebbc95 --- /dev/null +++ b/tests/baselines/reference/globalIsContextualKeyword.symbols @@ -0,0 +1,29 @@ +=== tests/cases/compiler/globalIsContextualKeyword.ts === +function a() { +>a : Symbol(a, Decl(globalIsContextualKeyword.ts, 0, 0)) + + let global = 1; +>global : Symbol(global, Decl(globalIsContextualKeyword.ts, 1, 7)) +} +function b() { +>b : Symbol(b, Decl(globalIsContextualKeyword.ts, 2, 1)) + + class global {} +>global : Symbol(global, Decl(globalIsContextualKeyword.ts, 3, 14)) +} + +namespace global { +>global : Symbol(global, Decl(globalIsContextualKeyword.ts, 5, 1)) +} + +function foo(global: number) { +>foo : Symbol(foo, Decl(globalIsContextualKeyword.ts, 8, 1)) +>global : Symbol(global, Decl(globalIsContextualKeyword.ts, 10, 13)) +} + +let obj = { +>obj : Symbol(obj, Decl(globalIsContextualKeyword.ts, 13, 3)) + + global: "123" +>global : Symbol(global, Decl(globalIsContextualKeyword.ts, 13, 11)) +} diff --git a/tests/baselines/reference/globalIsContextualKeyword.types b/tests/baselines/reference/globalIsContextualKeyword.types new file mode 100644 index 00000000000..d0bf624af6d --- /dev/null +++ b/tests/baselines/reference/globalIsContextualKeyword.types @@ -0,0 +1,32 @@ +=== tests/cases/compiler/globalIsContextualKeyword.ts === +function a() { +>a : () => void + + let global = 1; +>global : number +>1 : number +} +function b() { +>b : () => void + + class global {} +>global : global +} + +namespace global { +>global : any +} + +function foo(global: number) { +>foo : (global: number) => void +>global : number +} + +let obj = { +>obj : { global: string; } +>{ global: "123"} : { global: string; } + + global: "123" +>global : string +>"123" : string +} diff --git a/tests/baselines/reference/heterogeneousArrayLiterals.symbols b/tests/baselines/reference/heterogeneousArrayLiterals.symbols index c1d98b5873a..e74a037703b 100644 --- a/tests/baselines/reference/heterogeneousArrayLiterals.symbols +++ b/tests/baselines/reference/heterogeneousArrayLiterals.symbols @@ -52,17 +52,17 @@ var n = [[() => 1], [() => '']]; // {}[] class Base { foo: string; } >Base : Symbol(Base, Decl(heterogeneousArrayLiterals.ts, 18, 32)) ->foo : Symbol(foo, Decl(heterogeneousArrayLiterals.ts, 20, 12)) +>foo : Symbol(Base.foo, Decl(heterogeneousArrayLiterals.ts, 20, 12)) class Derived extends Base { bar: string; } >Derived : Symbol(Derived, Decl(heterogeneousArrayLiterals.ts, 20, 27), Decl(heterogeneousArrayLiterals.ts, 25, 23)) >Base : Symbol(Base, Decl(heterogeneousArrayLiterals.ts, 18, 32)) ->bar : Symbol(bar, Decl(heterogeneousArrayLiterals.ts, 21, 28)) +>bar : Symbol(Derived.bar, Decl(heterogeneousArrayLiterals.ts, 21, 28)) class Derived2 extends Base { baz: string; } >Derived2 : Symbol(Derived2, Decl(heterogeneousArrayLiterals.ts, 21, 43)) >Base : Symbol(Base, Decl(heterogeneousArrayLiterals.ts, 18, 32)) ->baz : Symbol(baz, Decl(heterogeneousArrayLiterals.ts, 22, 29)) +>baz : Symbol(Derived2.baz, Decl(heterogeneousArrayLiterals.ts, 22, 29)) var base: Base; >base : Symbol(base, Decl(heterogeneousArrayLiterals.ts, 23, 3)) diff --git a/tests/baselines/reference/icomparable.symbols b/tests/baselines/reference/icomparable.symbols index 03eac6b5bec..5d3621ce178 100644 --- a/tests/baselines/reference/icomparable.symbols +++ b/tests/baselines/reference/icomparable.symbols @@ -4,7 +4,7 @@ >T : Symbol(T, Decl(icomparable.ts, 0, 26)) compareTo(other: T); ->compareTo : Symbol(compareTo, Decl(icomparable.ts, 0, 30)) +>compareTo : Symbol(IComparable.compareTo, Decl(icomparable.ts, 0, 30)) >other : Symbol(other, Decl(icomparable.ts, 1, 17)) >T : Symbol(T, Decl(icomparable.ts, 0, 26)) } diff --git a/tests/baselines/reference/ifDoWhileStatements.symbols b/tests/baselines/reference/ifDoWhileStatements.symbols index 80c8fc7f1d8..b0ec471aa48 100644 --- a/tests/baselines/reference/ifDoWhileStatements.symbols +++ b/tests/baselines/reference/ifDoWhileStatements.symbols @@ -4,7 +4,7 @@ interface I { >I : Symbol(I, Decl(ifDoWhileStatements.ts, 0, 0)) id: number; ->id : Symbol(id, Decl(ifDoWhileStatements.ts, 1, 13)) +>id : Symbol(I.id, Decl(ifDoWhileStatements.ts, 1, 13)) } class C implements I { @@ -12,10 +12,10 @@ class C implements I { >I : Symbol(I, Decl(ifDoWhileStatements.ts, 0, 0)) id: number; ->id : Symbol(id, Decl(ifDoWhileStatements.ts, 5, 22)) +>id : Symbol(C.id, Decl(ifDoWhileStatements.ts, 5, 22)) name: string; ->name : Symbol(name, Decl(ifDoWhileStatements.ts, 6, 15)) +>name : Symbol(C.name, Decl(ifDoWhileStatements.ts, 6, 15)) } class C2 extends C { @@ -23,7 +23,7 @@ class C2 extends C { >C : Symbol(C, Decl(ifDoWhileStatements.ts, 3, 1)) valid: boolean; ->valid : Symbol(valid, Decl(ifDoWhileStatements.ts, 10, 20)) +>valid : Symbol(C2.valid, Decl(ifDoWhileStatements.ts, 10, 20)) } class D{ @@ -31,16 +31,16 @@ class D{ >T : Symbol(T, Decl(ifDoWhileStatements.ts, 14, 8)) source: T; ->source : Symbol(source, Decl(ifDoWhileStatements.ts, 14, 11)) +>source : Symbol(D.source, Decl(ifDoWhileStatements.ts, 14, 11)) >T : Symbol(T, Decl(ifDoWhileStatements.ts, 14, 8)) recurse: D; ->recurse : Symbol(recurse, Decl(ifDoWhileStatements.ts, 15, 14)) +>recurse : Symbol(D.recurse, Decl(ifDoWhileStatements.ts, 15, 14)) >D : Symbol(D, Decl(ifDoWhileStatements.ts, 12, 1)) >T : Symbol(T, Decl(ifDoWhileStatements.ts, 14, 8)) wrapped: D> ->wrapped : Symbol(wrapped, Decl(ifDoWhileStatements.ts, 16, 18)) +>wrapped : Symbol(D.wrapped, Decl(ifDoWhileStatements.ts, 16, 18)) >D : Symbol(D, Decl(ifDoWhileStatements.ts, 12, 1)) >D : Symbol(D, Decl(ifDoWhileStatements.ts, 12, 1)) >T : Symbol(T, Decl(ifDoWhileStatements.ts, 14, 8)) @@ -62,7 +62,7 @@ module M { >A : Symbol(A, Decl(ifDoWhileStatements.ts, 23, 10)) name: string; ->name : Symbol(name, Decl(ifDoWhileStatements.ts, 24, 20)) +>name : Symbol(A.name, Decl(ifDoWhileStatements.ts, 24, 20)) } export function F2(x: number): string { return x.toString(); } @@ -80,7 +80,7 @@ module N { >A : Symbol(A, Decl(ifDoWhileStatements.ts, 31, 10)) id: number; ->id : Symbol(id, Decl(ifDoWhileStatements.ts, 32, 20)) +>id : Symbol(A.id, Decl(ifDoWhileStatements.ts, 32, 20)) } export function F2(x: number): string { return x.toString(); } diff --git a/tests/baselines/reference/illegalGenericWrapping1.symbols b/tests/baselines/reference/illegalGenericWrapping1.symbols index f4ab78ceb69..ca197cf341e 100644 --- a/tests/baselines/reference/illegalGenericWrapping1.symbols +++ b/tests/baselines/reference/illegalGenericWrapping1.symbols @@ -4,13 +4,13 @@ interface Sequence { >T : Symbol(T, Decl(illegalGenericWrapping1.ts, 0, 19)) each(iterator: (value: T) => void ): void; ->each : Symbol(each, Decl(illegalGenericWrapping1.ts, 0, 23)) +>each : Symbol(Sequence.each, Decl(illegalGenericWrapping1.ts, 0, 23)) >iterator : Symbol(iterator, Decl(illegalGenericWrapping1.ts, 1, 9)) >value : Symbol(value, Decl(illegalGenericWrapping1.ts, 1, 20)) >T : Symbol(T, Decl(illegalGenericWrapping1.ts, 0, 19)) map(iterator: (value: T) => U): Sequence; ->map : Symbol(map, Decl(illegalGenericWrapping1.ts, 1, 46)) +>map : Symbol(Sequence.map, Decl(illegalGenericWrapping1.ts, 1, 46)) >U : Symbol(U, Decl(illegalGenericWrapping1.ts, 2, 8)) >iterator : Symbol(iterator, Decl(illegalGenericWrapping1.ts, 2, 11)) >value : Symbol(value, Decl(illegalGenericWrapping1.ts, 2, 22)) @@ -20,7 +20,7 @@ interface Sequence { >U : Symbol(U, Decl(illegalGenericWrapping1.ts, 2, 8)) filter(iterator: (value: T) => boolean): Sequence; ->filter : Symbol(filter, Decl(illegalGenericWrapping1.ts, 2, 51)) +>filter : Symbol(Sequence.filter, Decl(illegalGenericWrapping1.ts, 2, 51)) >iterator : Symbol(iterator, Decl(illegalGenericWrapping1.ts, 3, 11)) >value : Symbol(value, Decl(illegalGenericWrapping1.ts, 3, 22)) >T : Symbol(T, Decl(illegalGenericWrapping1.ts, 0, 19)) @@ -28,7 +28,7 @@ interface Sequence { >T : Symbol(T, Decl(illegalGenericWrapping1.ts, 0, 19)) groupBy(keySelector: (value: T) => K): Sequence<{ key: K; items: Sequence; }>; ->groupBy : Symbol(groupBy, Decl(illegalGenericWrapping1.ts, 3, 57)) +>groupBy : Symbol(Sequence.groupBy, Decl(illegalGenericWrapping1.ts, 3, 57)) >K : Symbol(K, Decl(illegalGenericWrapping1.ts, 4, 12)) >keySelector : Symbol(keySelector, Decl(illegalGenericWrapping1.ts, 4, 15)) >value : Symbol(value, Decl(illegalGenericWrapping1.ts, 4, 29)) diff --git a/tests/baselines/reference/implementArrayInterface.js b/tests/baselines/reference/implementArrayInterface.js index b75de77ea97..733a861071b 100644 --- a/tests/baselines/reference/implementArrayInterface.js +++ b/tests/baselines/reference/implementArrayInterface.js @@ -10,7 +10,7 @@ declare class MyArray implements Array { reverse(): T[]; shift(): T; slice(start?: number, end?: number): T[]; - sort(compareFn?: (a: T, b: T) => number): T[]; + sort(compareFn?: (a: T, b: T) => number): this; splice(start: number): T[]; splice(start: number, deleteCount: number, ...items: T[]): T[]; unshift(...items: T[]): number; diff --git a/tests/baselines/reference/implementArrayInterface.symbols b/tests/baselines/reference/implementArrayInterface.symbols index 5a671d41de3..e6a15a8774f 100644 --- a/tests/baselines/reference/implementArrayInterface.symbols +++ b/tests/baselines/reference/implementArrayInterface.symbols @@ -6,13 +6,13 @@ declare class MyArray implements Array { >T : Symbol(T, Decl(implementArrayInterface.ts, 0, 22)) toString(): string; ->toString : Symbol(toString, Decl(implementArrayInterface.ts, 0, 46)) +>toString : Symbol(MyArray.toString, Decl(implementArrayInterface.ts, 0, 46)) toLocaleString(): string; ->toLocaleString : Symbol(toLocaleString, Decl(implementArrayInterface.ts, 1, 23)) +>toLocaleString : Symbol(MyArray.toLocaleString, Decl(implementArrayInterface.ts, 1, 23)) concat(...items: U[]): T[]; ->concat : Symbol(concat, Decl(implementArrayInterface.ts, 2, 29), Decl(implementArrayInterface.ts, 3, 46)) +>concat : Symbol(MyArray.concat, Decl(implementArrayInterface.ts, 2, 29), Decl(implementArrayInterface.ts, 3, 46)) >U : Symbol(U, Decl(implementArrayInterface.ts, 3, 11)) >T : Symbol(T, Decl(implementArrayInterface.ts, 0, 22)) >items : Symbol(items, Decl(implementArrayInterface.ts, 3, 26)) @@ -20,54 +20,53 @@ declare class MyArray implements Array { >T : Symbol(T, Decl(implementArrayInterface.ts, 0, 22)) concat(...items: T[]): T[]; ->concat : Symbol(concat, Decl(implementArrayInterface.ts, 2, 29), Decl(implementArrayInterface.ts, 3, 46)) +>concat : Symbol(MyArray.concat, Decl(implementArrayInterface.ts, 2, 29), Decl(implementArrayInterface.ts, 3, 46)) >items : Symbol(items, Decl(implementArrayInterface.ts, 4, 11)) >T : Symbol(T, Decl(implementArrayInterface.ts, 0, 22)) >T : Symbol(T, Decl(implementArrayInterface.ts, 0, 22)) join(separator?: string): string; ->join : Symbol(join, Decl(implementArrayInterface.ts, 4, 31)) +>join : Symbol(MyArray.join, Decl(implementArrayInterface.ts, 4, 31)) >separator : Symbol(separator, Decl(implementArrayInterface.ts, 5, 9)) pop(): T; ->pop : Symbol(pop, Decl(implementArrayInterface.ts, 5, 37)) +>pop : Symbol(MyArray.pop, Decl(implementArrayInterface.ts, 5, 37)) >T : Symbol(T, Decl(implementArrayInterface.ts, 0, 22)) push(...items: T[]): number; ->push : Symbol(push, Decl(implementArrayInterface.ts, 6, 13)) +>push : Symbol(MyArray.push, Decl(implementArrayInterface.ts, 6, 13)) >items : Symbol(items, Decl(implementArrayInterface.ts, 7, 9)) >T : Symbol(T, Decl(implementArrayInterface.ts, 0, 22)) reverse(): T[]; ->reverse : Symbol(reverse, Decl(implementArrayInterface.ts, 7, 32)) +>reverse : Symbol(MyArray.reverse, Decl(implementArrayInterface.ts, 7, 32)) >T : Symbol(T, Decl(implementArrayInterface.ts, 0, 22)) shift(): T; ->shift : Symbol(shift, Decl(implementArrayInterface.ts, 8, 19)) +>shift : Symbol(MyArray.shift, Decl(implementArrayInterface.ts, 8, 19)) >T : Symbol(T, Decl(implementArrayInterface.ts, 0, 22)) slice(start?: number, end?: number): T[]; ->slice : Symbol(slice, Decl(implementArrayInterface.ts, 9, 15)) +>slice : Symbol(MyArray.slice, Decl(implementArrayInterface.ts, 9, 15)) >start : Symbol(start, Decl(implementArrayInterface.ts, 10, 10)) >end : Symbol(end, Decl(implementArrayInterface.ts, 10, 25)) >T : Symbol(T, Decl(implementArrayInterface.ts, 0, 22)) - sort(compareFn?: (a: T, b: T) => number): T[]; ->sort : Symbol(sort, Decl(implementArrayInterface.ts, 10, 45)) + sort(compareFn?: (a: T, b: T) => number): this; +>sort : Symbol(MyArray.sort, Decl(implementArrayInterface.ts, 10, 45)) >compareFn : Symbol(compareFn, Decl(implementArrayInterface.ts, 11, 9)) >a : Symbol(a, Decl(implementArrayInterface.ts, 11, 22)) >T : Symbol(T, Decl(implementArrayInterface.ts, 0, 22)) >b : Symbol(b, Decl(implementArrayInterface.ts, 11, 27)) ->T : Symbol(T, Decl(implementArrayInterface.ts, 0, 22)) >T : Symbol(T, Decl(implementArrayInterface.ts, 0, 22)) splice(start: number): T[]; ->splice : Symbol(splice, Decl(implementArrayInterface.ts, 11, 50), Decl(implementArrayInterface.ts, 12, 31)) +>splice : Symbol(MyArray.splice, Decl(implementArrayInterface.ts, 11, 51), Decl(implementArrayInterface.ts, 12, 31)) >start : Symbol(start, Decl(implementArrayInterface.ts, 12, 11)) >T : Symbol(T, Decl(implementArrayInterface.ts, 0, 22)) splice(start: number, deleteCount: number, ...items: T[]): T[]; ->splice : Symbol(splice, Decl(implementArrayInterface.ts, 11, 50), Decl(implementArrayInterface.ts, 12, 31)) +>splice : Symbol(MyArray.splice, Decl(implementArrayInterface.ts, 11, 51), Decl(implementArrayInterface.ts, 12, 31)) >start : Symbol(start, Decl(implementArrayInterface.ts, 13, 11)) >deleteCount : Symbol(deleteCount, Decl(implementArrayInterface.ts, 13, 25)) >items : Symbol(items, Decl(implementArrayInterface.ts, 13, 46)) @@ -75,24 +74,24 @@ declare class MyArray implements Array { >T : Symbol(T, Decl(implementArrayInterface.ts, 0, 22)) unshift(...items: T[]): number; ->unshift : Symbol(unshift, Decl(implementArrayInterface.ts, 13, 67)) +>unshift : Symbol(MyArray.unshift, Decl(implementArrayInterface.ts, 13, 67)) >items : Symbol(items, Decl(implementArrayInterface.ts, 14, 12)) >T : Symbol(T, Decl(implementArrayInterface.ts, 0, 22)) indexOf(searchElement: T, fromIndex?: number): number; ->indexOf : Symbol(indexOf, Decl(implementArrayInterface.ts, 14, 35)) +>indexOf : Symbol(MyArray.indexOf, Decl(implementArrayInterface.ts, 14, 35)) >searchElement : Symbol(searchElement, Decl(implementArrayInterface.ts, 16, 12)) >T : Symbol(T, Decl(implementArrayInterface.ts, 0, 22)) >fromIndex : Symbol(fromIndex, Decl(implementArrayInterface.ts, 16, 29)) lastIndexOf(searchElement: T, fromIndex?: number): number; ->lastIndexOf : Symbol(lastIndexOf, Decl(implementArrayInterface.ts, 16, 58)) +>lastIndexOf : Symbol(MyArray.lastIndexOf, Decl(implementArrayInterface.ts, 16, 58)) >searchElement : Symbol(searchElement, Decl(implementArrayInterface.ts, 17, 16)) >T : Symbol(T, Decl(implementArrayInterface.ts, 0, 22)) >fromIndex : Symbol(fromIndex, Decl(implementArrayInterface.ts, 17, 33)) every(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; ->every : Symbol(every, Decl(implementArrayInterface.ts, 17, 62)) +>every : Symbol(MyArray.every, Decl(implementArrayInterface.ts, 17, 62)) >callbackfn : Symbol(callbackfn, Decl(implementArrayInterface.ts, 18, 10)) >value : Symbol(value, Decl(implementArrayInterface.ts, 18, 23)) >T : Symbol(T, Decl(implementArrayInterface.ts, 0, 22)) @@ -102,7 +101,7 @@ declare class MyArray implements Array { >thisArg : Symbol(thisArg, Decl(implementArrayInterface.ts, 18, 71)) some(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; ->some : Symbol(some, Decl(implementArrayInterface.ts, 18, 96)) +>some : Symbol(MyArray.some, Decl(implementArrayInterface.ts, 18, 96)) >callbackfn : Symbol(callbackfn, Decl(implementArrayInterface.ts, 19, 9)) >value : Symbol(value, Decl(implementArrayInterface.ts, 19, 22)) >T : Symbol(T, Decl(implementArrayInterface.ts, 0, 22)) @@ -112,7 +111,7 @@ declare class MyArray implements Array { >thisArg : Symbol(thisArg, Decl(implementArrayInterface.ts, 19, 70)) forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void; ->forEach : Symbol(forEach, Decl(implementArrayInterface.ts, 19, 95)) +>forEach : Symbol(MyArray.forEach, Decl(implementArrayInterface.ts, 19, 95)) >callbackfn : Symbol(callbackfn, Decl(implementArrayInterface.ts, 20, 12)) >value : Symbol(value, Decl(implementArrayInterface.ts, 20, 25)) >T : Symbol(T, Decl(implementArrayInterface.ts, 0, 22)) @@ -122,7 +121,7 @@ declare class MyArray implements Array { >thisArg : Symbol(thisArg, Decl(implementArrayInterface.ts, 20, 70)) map(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[]; ->map : Symbol(map, Decl(implementArrayInterface.ts, 20, 92)) +>map : Symbol(MyArray.map, Decl(implementArrayInterface.ts, 20, 92)) >U : Symbol(U, Decl(implementArrayInterface.ts, 21, 8)) >callbackfn : Symbol(callbackfn, Decl(implementArrayInterface.ts, 21, 11)) >value : Symbol(value, Decl(implementArrayInterface.ts, 21, 24)) @@ -135,7 +134,7 @@ declare class MyArray implements Array { >U : Symbol(U, Decl(implementArrayInterface.ts, 21, 8)) filter(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): T[]; ->filter : Symbol(filter, Decl(implementArrayInterface.ts, 21, 87)) +>filter : Symbol(MyArray.filter, Decl(implementArrayInterface.ts, 21, 87)) >callbackfn : Symbol(callbackfn, Decl(implementArrayInterface.ts, 22, 11)) >value : Symbol(value, Decl(implementArrayInterface.ts, 22, 24)) >T : Symbol(T, Decl(implementArrayInterface.ts, 0, 22)) @@ -146,7 +145,7 @@ declare class MyArray implements Array { >T : Symbol(T, Decl(implementArrayInterface.ts, 0, 22)) reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; ->reduce : Symbol(reduce, Decl(implementArrayInterface.ts, 22, 93), Decl(implementArrayInterface.ts, 23, 120)) +>reduce : Symbol(MyArray.reduce, Decl(implementArrayInterface.ts, 22, 93), Decl(implementArrayInterface.ts, 23, 120)) >callbackfn : Symbol(callbackfn, Decl(implementArrayInterface.ts, 23, 11)) >previousValue : Symbol(previousValue, Decl(implementArrayInterface.ts, 23, 24)) >T : Symbol(T, Decl(implementArrayInterface.ts, 0, 22)) @@ -161,7 +160,7 @@ declare class MyArray implements Array { >T : Symbol(T, Decl(implementArrayInterface.ts, 0, 22)) reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; ->reduce : Symbol(reduce, Decl(implementArrayInterface.ts, 22, 93), Decl(implementArrayInterface.ts, 23, 120)) +>reduce : Symbol(MyArray.reduce, Decl(implementArrayInterface.ts, 22, 93), Decl(implementArrayInterface.ts, 23, 120)) >U : Symbol(U, Decl(implementArrayInterface.ts, 24, 11)) >callbackfn : Symbol(callbackfn, Decl(implementArrayInterface.ts, 24, 14)) >previousValue : Symbol(previousValue, Decl(implementArrayInterface.ts, 24, 27)) @@ -177,7 +176,7 @@ declare class MyArray implements Array { >U : Symbol(U, Decl(implementArrayInterface.ts, 24, 11)) reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; ->reduceRight : Symbol(reduceRight, Decl(implementArrayInterface.ts, 24, 122), Decl(implementArrayInterface.ts, 25, 125)) +>reduceRight : Symbol(MyArray.reduceRight, Decl(implementArrayInterface.ts, 24, 122), Decl(implementArrayInterface.ts, 25, 125)) >callbackfn : Symbol(callbackfn, Decl(implementArrayInterface.ts, 25, 16)) >previousValue : Symbol(previousValue, Decl(implementArrayInterface.ts, 25, 29)) >T : Symbol(T, Decl(implementArrayInterface.ts, 0, 22)) @@ -192,7 +191,7 @@ declare class MyArray implements Array { >T : Symbol(T, Decl(implementArrayInterface.ts, 0, 22)) reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; ->reduceRight : Symbol(reduceRight, Decl(implementArrayInterface.ts, 24, 122), Decl(implementArrayInterface.ts, 25, 125)) +>reduceRight : Symbol(MyArray.reduceRight, Decl(implementArrayInterface.ts, 24, 122), Decl(implementArrayInterface.ts, 25, 125)) >U : Symbol(U, Decl(implementArrayInterface.ts, 26, 16)) >callbackfn : Symbol(callbackfn, Decl(implementArrayInterface.ts, 26, 19)) >previousValue : Symbol(previousValue, Decl(implementArrayInterface.ts, 26, 32)) @@ -208,7 +207,7 @@ declare class MyArray implements Array { >U : Symbol(U, Decl(implementArrayInterface.ts, 26, 16)) length: number; ->length : Symbol(length, Decl(implementArrayInterface.ts, 26, 127)) +>length : Symbol(MyArray.length, Decl(implementArrayInterface.ts, 26, 127)) [n: number]: T; >n : Symbol(n, Decl(implementArrayInterface.ts, 30, 5)) diff --git a/tests/baselines/reference/implementArrayInterface.types b/tests/baselines/reference/implementArrayInterface.types index 347fcf37693..2085cfdf6e0 100644 --- a/tests/baselines/reference/implementArrayInterface.types +++ b/tests/baselines/reference/implementArrayInterface.types @@ -52,13 +52,12 @@ declare class MyArray implements Array { >end : number >T : T - sort(compareFn?: (a: T, b: T) => number): T[]; ->sort : (compareFn?: (a: T, b: T) => number) => T[] + sort(compareFn?: (a: T, b: T) => number): this; +>sort : (compareFn?: (a: T, b: T) => number) => this >compareFn : (a: T, b: T) => number >a : T >T : T >b : T ->T : T >T : T splice(start: number): T[]; diff --git a/tests/baselines/reference/implementGenericWithMismatchedTypes.errors.txt b/tests/baselines/reference/implementGenericWithMismatchedTypes.errors.txt index 7a128b87764..4652acc8d10 100644 --- a/tests/baselines/reference/implementGenericWithMismatchedTypes.errors.txt +++ b/tests/baselines/reference/implementGenericWithMismatchedTypes.errors.txt @@ -2,7 +2,7 @@ tests/cases/compiler/implementGenericWithMismatchedTypes.ts(7,7): error TS2420: Types of property 'foo' are incompatible. Type '(x: string) => number' is not assignable to type '(x: T) => T'. Types of parameters 'x' and 'x' are incompatible. - Type 'string' is not assignable to type 'T'. + Type 'T' is not assignable to type 'string'. tests/cases/compiler/implementGenericWithMismatchedTypes.ts(16,7): error TS2420: Class 'C2' incorrectly implements interface 'IFoo2'. Types of property 'foo' are incompatible. Type '(x: Tstring) => number' is not assignable to type '(x: T) => T'. @@ -22,7 +22,7 @@ tests/cases/compiler/implementGenericWithMismatchedTypes.ts(16,7): error TS2420: !!! error TS2420: Types of property 'foo' are incompatible. !!! error TS2420: Type '(x: string) => number' is not assignable to type '(x: T) => T'. !!! error TS2420: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2420: Type 'string' is not assignable to type 'T'. +!!! error TS2420: Type 'T' is not assignable to type 'string'. foo(x: string): number { return null; } diff --git a/tests/baselines/reference/implementInterfaceAnyMemberWithVoid.symbols b/tests/baselines/reference/implementInterfaceAnyMemberWithVoid.symbols index bf53a92dcd3..7cc8e6f92ac 100644 --- a/tests/baselines/reference/implementInterfaceAnyMemberWithVoid.symbols +++ b/tests/baselines/reference/implementInterfaceAnyMemberWithVoid.symbols @@ -3,7 +3,7 @@ interface I { >I : Symbol(I, Decl(implementInterfaceAnyMemberWithVoid.ts, 0, 0)) foo(value: number); ->foo : Symbol(foo, Decl(implementInterfaceAnyMemberWithVoid.ts, 0, 13)) +>foo : Symbol(I.foo, Decl(implementInterfaceAnyMemberWithVoid.ts, 0, 13)) >value : Symbol(value, Decl(implementInterfaceAnyMemberWithVoid.ts, 1, 8)) } @@ -12,7 +12,7 @@ class Bug implements I { >I : Symbol(I, Decl(implementInterfaceAnyMemberWithVoid.ts, 0, 0)) public foo(value: number) { ->foo : Symbol(foo, Decl(implementInterfaceAnyMemberWithVoid.ts, 4, 24)) +>foo : Symbol(Bug.foo, Decl(implementInterfaceAnyMemberWithVoid.ts, 4, 24)) >value : Symbol(value, Decl(implementInterfaceAnyMemberWithVoid.ts, 5, 15)) } } diff --git a/tests/baselines/reference/implementingAnInterfaceExtendingClassWithPrivates2.errors.txt b/tests/baselines/reference/implementingAnInterfaceExtendingClassWithPrivates2.errors.txt index c6c0be3896c..ec5c1eba68c 100644 --- a/tests/baselines/reference/implementingAnInterfaceExtendingClassWithPrivates2.errors.txt +++ b/tests/baselines/reference/implementingAnInterfaceExtendingClassWithPrivates2.errors.txt @@ -16,7 +16,7 @@ tests/cases/conformance/interfaces/interfacesExtendingClasses/implementingAnInte Property 'z' is missing in type 'Bar3'. tests/cases/conformance/interfaces/interfacesExtendingClasses/implementingAnInterfaceExtendingClassWithPrivates2.ts(67,11): error TS2420: Class 'Bar' incorrectly implements interface 'I'. Property 'y' is missing in type 'Bar'. -tests/cases/conformance/interfaces/interfacesExtendingClasses/implementingAnInterfaceExtendingClassWithPrivates2.ts(73,14): error TS2341: Property 'x' is private and only accessible within class 'Foo'. +tests/cases/conformance/interfaces/interfacesExtendingClasses/implementingAnInterfaceExtendingClassWithPrivates2.ts(73,16): error TS2341: Property 'x' is private and only accessible within class 'Foo'. tests/cases/conformance/interfaces/interfacesExtendingClasses/implementingAnInterfaceExtendingClassWithPrivates2.ts(74,16): error TS2339: Property 'y' does not exist on type 'Bar'. tests/cases/conformance/interfaces/interfacesExtendingClasses/implementingAnInterfaceExtendingClassWithPrivates2.ts(76,11): error TS2415: Class 'Bar2' incorrectly extends base class 'Foo'. Property 'x' is private in type 'Foo' but not in type 'Bar2'. @@ -129,7 +129,7 @@ tests/cases/conformance/interfaces/interfacesExtendingClasses/implementingAnInte var b: Bar; var r1 = b.z; var r2 = b.x; // error - ~~~ + ~ !!! error TS2341: Property 'x' is private and only accessible within class 'Foo'. var r3 = b.y; // error ~ diff --git a/tests/baselines/reference/implementsInClassExpression.symbols b/tests/baselines/reference/implementsInClassExpression.symbols index f65c3456320..48a44d91e9c 100644 --- a/tests/baselines/reference/implementsInClassExpression.symbols +++ b/tests/baselines/reference/implementsInClassExpression.symbols @@ -3,7 +3,7 @@ interface Foo { >Foo : Symbol(Foo, Decl(implementsInClassExpression.ts, 0, 0)) doThing(): void; ->doThing : Symbol(doThing, Decl(implementsInClassExpression.ts, 0, 15)) +>doThing : Symbol(Foo.doThing, Decl(implementsInClassExpression.ts, 0, 15)) } let cls = class implements Foo { diff --git a/tests/baselines/reference/implicitAnyAnyReturningFunction.symbols b/tests/baselines/reference/implicitAnyAnyReturningFunction.symbols index 73e91853255..4571820db7b 100644 --- a/tests/baselines/reference/implicitAnyAnyReturningFunction.symbols +++ b/tests/baselines/reference/implicitAnyAnyReturningFunction.symbols @@ -19,13 +19,13 @@ class C { >C : Symbol(C, Decl(implicitAnyAnyReturningFunction.ts, 7, 1)) public A() { ->A : Symbol(A, Decl(implicitAnyAnyReturningFunction.ts, 9, 9)) +>A : Symbol(C.A, Decl(implicitAnyAnyReturningFunction.ts, 9, 9)) return ""; } public B() { ->B : Symbol(B, Decl(implicitAnyAnyReturningFunction.ts, 12, 5)) +>B : Symbol(C.B, Decl(implicitAnyAnyReturningFunction.ts, 12, 5)) var someLocal: any = {}; >someLocal : Symbol(someLocal, Decl(implicitAnyAnyReturningFunction.ts, 15, 11)) diff --git a/tests/baselines/reference/implicitAnyFromCircularInference.errors.txt b/tests/baselines/reference/implicitAnyFromCircularInference.errors.txt index 36538aef4f3..bb43d96b003 100644 --- a/tests/baselines/reference/implicitAnyFromCircularInference.errors.txt +++ b/tests/baselines/reference/implicitAnyFromCircularInference.errors.txt @@ -8,7 +8,7 @@ tests/cases/compiler/implicitAnyFromCircularInference.ts(23,10): error TS7024: F tests/cases/compiler/implicitAnyFromCircularInference.ts(26,10): error TS7023: 'h' 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. tests/cases/compiler/implicitAnyFromCircularInference.ts(28,14): error TS7023: 'foo' 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. tests/cases/compiler/implicitAnyFromCircularInference.ts(41,5): error TS7022: 's' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer. -tests/cases/compiler/implicitAnyFromCircularInference.ts(46,5): error TS7023: 'x' 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. +tests/cases/compiler/implicitAnyFromCircularInference.ts(46,9): error TS7023: 'x' 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. ==== tests/cases/compiler/implicitAnyFromCircularInference.ts (11 errors) ==== @@ -78,11 +78,9 @@ tests/cases/compiler/implicitAnyFromCircularInference.ts(46,5): error TS7023: 'x class D { // Error expected get x() { - ~~~~~~~~~ - return this.x; - ~~~~~~~~~~~~~~~~~~~~~~ - } - ~~~~~ + ~ !!! error TS7023: 'x' 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. + return this.x; + } } \ No newline at end of file diff --git a/tests/baselines/reference/implicitAnyGenerics.symbols b/tests/baselines/reference/implicitAnyGenerics.symbols index 865f48fdd59..22718f1b9d4 100644 --- a/tests/baselines/reference/implicitAnyGenerics.symbols +++ b/tests/baselines/reference/implicitAnyGenerics.symbols @@ -5,7 +5,7 @@ class C { >T : Symbol(T, Decl(implicitAnyGenerics.ts, 1, 8)) x: T; ->x : Symbol(x, Decl(implicitAnyGenerics.ts, 1, 12)) +>x : Symbol(C.x, Decl(implicitAnyGenerics.ts, 1, 12)) >T : Symbol(T, Decl(implicitAnyGenerics.ts, 1, 8)) } diff --git a/tests/baselines/reference/implicitAnyGetAndSetAccessorWithAnyReturnType.errors.txt b/tests/baselines/reference/implicitAnyGetAndSetAccessorWithAnyReturnType.errors.txt index 4d9008cd56a..460ff97b10e 100644 --- a/tests/baselines/reference/implicitAnyGetAndSetAccessorWithAnyReturnType.errors.txt +++ b/tests/baselines/reference/implicitAnyGetAndSetAccessorWithAnyReturnType.errors.txt @@ -1,11 +1,11 @@ tests/cases/compiler/implicitAnyGetAndSetAccessorWithAnyReturnType.ts(3,5): error TS7008: Member 'getAndSet' implicitly has an 'any' type. tests/cases/compiler/implicitAnyGetAndSetAccessorWithAnyReturnType.ts(4,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/implicitAnyGetAndSetAccessorWithAnyReturnType.ts(9,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/implicitAnyGetAndSetAccessorWithAnyReturnType.ts(15,5): error TS7016: Property 'haveOnlySet' implicitly has type 'any', because its 'set' accessor lacks a type annotation. tests/cases/compiler/implicitAnyGetAndSetAccessorWithAnyReturnType.ts(15,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/implicitAnyGetAndSetAccessorWithAnyReturnType.ts(15,16): error TS7016: Property 'haveOnlySet' implicitly has type 'any', because its 'set' accessor lacks a type annotation. tests/cases/compiler/implicitAnyGetAndSetAccessorWithAnyReturnType.ts(15,28): error TS7006: Parameter 'newXValue' implicitly has an 'any' type. -tests/cases/compiler/implicitAnyGetAndSetAccessorWithAnyReturnType.ts(20,5): error TS7010: 'haveOnlyGet', which lacks return-type annotation, implicitly has an 'any' return type. tests/cases/compiler/implicitAnyGetAndSetAccessorWithAnyReturnType.ts(20,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/implicitAnyGetAndSetAccessorWithAnyReturnType.ts(20,16): error TS7010: 'haveOnlyGet', which lacks return-type annotation, implicitly has an 'any' return type. ==== tests/cases/compiler/implicitAnyGetAndSetAccessorWithAnyReturnType.ts (8 errors) ==== @@ -30,24 +30,21 @@ tests/cases/compiler/implicitAnyGetAndSetAccessorWithAnyReturnType.ts(20,16): er class SetterOnly { public set haveOnlySet(newXValue) { // error at "haveOnlySet, newXValue" - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + ~~~~~~~~~~~ +!!! error TS7016: Property 'haveOnlySet' implicitly has type 'any', because its 'set' accessor lacks a type annotation. ~~~~~~~~~ !!! error TS7006: Parameter 'newXValue' implicitly has an 'any' type. } - ~~~~~ -!!! error TS7016: Property 'haveOnlySet' implicitly has type 'any', because its 'set' accessor lacks a type annotation. } class GetterOnly { public get haveOnlyGet() { // error at "haveOnlyGet" - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. - return null; - ~~~~~~~~~~~~~~~~~~~~ - } - ~~~~~ + ~~~~~~~~~~~ !!! error TS7010: 'haveOnlyGet', which lacks return-type annotation, implicitly has an 'any' return type. + return null; + } } \ No newline at end of file diff --git a/tests/baselines/reference/implicitAnyInAmbientDeclaration.errors.txt b/tests/baselines/reference/implicitAnyInAmbientDeclaration.errors.txt index 1e66f26d0d2..493fc13db04 100644 --- a/tests/baselines/reference/implicitAnyInAmbientDeclaration.errors.txt +++ b/tests/baselines/reference/implicitAnyInAmbientDeclaration.errors.txt @@ -1,10 +1,9 @@ tests/cases/compiler/implicitAnyInAmbientDeclaration.ts(3,9): error TS7008: Member 'publicMember' implicitly has an 'any' type. tests/cases/compiler/implicitAnyInAmbientDeclaration.ts(6,16): error TS7010: 'publicFunction', which lacks return-type annotation, implicitly has an 'any' return type. tests/cases/compiler/implicitAnyInAmbientDeclaration.ts(6,31): error TS7006: Parameter 'x' implicitly has an 'any' type. -tests/cases/compiler/implicitAnyInAmbientDeclaration.ts(8,9): error TS1089: 'private' modifier cannot appear on a constructor declaration. -==== tests/cases/compiler/implicitAnyInAmbientDeclaration.ts (4 errors) ==== +==== tests/cases/compiler/implicitAnyInAmbientDeclaration.ts (3 errors) ==== module Test { declare class C { public publicMember; // this should be an error @@ -19,7 +18,5 @@ tests/cases/compiler/implicitAnyInAmbientDeclaration.ts(8,9): error TS1089: 'pri !!! error TS7006: Parameter 'x' implicitly has an 'any' type. private privateFunction(privateParam); // this should not be an error private constructor(privateParam); - ~~~~~~~ -!!! error TS1089: 'private' modifier cannot appear on a constructor declaration. } } \ No newline at end of file diff --git a/tests/baselines/reference/implicitAnyInAmbientDeclaration2.d.errors.txt b/tests/baselines/reference/implicitAnyInAmbientDeclaration2.d.errors.txt index 54fe39e2efe..03de82c731d 100644 --- a/tests/baselines/reference/implicitAnyInAmbientDeclaration2.d.errors.txt +++ b/tests/baselines/reference/implicitAnyInAmbientDeclaration2.d.errors.txt @@ -4,11 +4,10 @@ tests/cases/compiler/implicitAnyInAmbientDeclaration2.d.ts(2,13): error TS7005: tests/cases/compiler/implicitAnyInAmbientDeclaration2.d.ts(4,5): error TS7008: Member 'publicMember' implicitly has an 'any' type. tests/cases/compiler/implicitAnyInAmbientDeclaration2.d.ts(7,12): error TS7010: 'publicFunction', which lacks return-type annotation, implicitly has an 'any' return type. tests/cases/compiler/implicitAnyInAmbientDeclaration2.d.ts(7,27): error TS7006: Parameter 'x' implicitly has an 'any' type. -tests/cases/compiler/implicitAnyInAmbientDeclaration2.d.ts(9,5): error TS1089: 'private' modifier cannot appear on a constructor declaration. tests/cases/compiler/implicitAnyInAmbientDeclaration2.d.ts(13,24): error TS7006: Parameter 'publicConsParam' implicitly has an 'any' type. -==== tests/cases/compiler/implicitAnyInAmbientDeclaration2.d.ts (8 errors) ==== +==== tests/cases/compiler/implicitAnyInAmbientDeclaration2.d.ts (7 errors) ==== declare function foo(x); // this should be an error ~~~ !!! error TS7010: 'foo', which lacks return-type annotation, implicitly has an 'any' return type. @@ -30,8 +29,6 @@ tests/cases/compiler/implicitAnyInAmbientDeclaration2.d.ts(13,24): error TS7006: !!! error TS7006: Parameter 'x' implicitly has an 'any' type. private privateFunction(privateParam); // this should not be an error private constructor(privateParam); // this should not be an error - ~~~~~~~ -!!! error TS1089: 'private' modifier cannot appear on a constructor declaration. } declare class D { diff --git a/tests/baselines/reference/implicitAnyInCatch.symbols b/tests/baselines/reference/implicitAnyInCatch.symbols index e576593da82..7ce3ac40f36 100644 --- a/tests/baselines/reference/implicitAnyInCatch.symbols +++ b/tests/baselines/reference/implicitAnyInCatch.symbols @@ -13,7 +13,7 @@ class C { >C : Symbol(C, Decl(implicitAnyInCatch.ts, 4, 25)) public temp() { ->temp : Symbol(temp, Decl(implicitAnyInCatch.ts, 6, 9)) +>temp : Symbol(C.temp, Decl(implicitAnyInCatch.ts, 6, 9)) for (var x in this) { >x : Symbol(x, Decl(implicitAnyInCatch.ts, 8, 16)) diff --git a/tests/baselines/reference/implicitAnyInCatch.types b/tests/baselines/reference/implicitAnyInCatch.types index cd0dd2d2423..015d41b123f 100644 --- a/tests/baselines/reference/implicitAnyInCatch.types +++ b/tests/baselines/reference/implicitAnyInCatch.types @@ -12,7 +12,7 @@ try { } catch (error) { >2147024809 : number } for (var key in this) { } ->key : any +>key : string >this : any class C { @@ -22,7 +22,7 @@ class C { >temp : () => void for (var x in this) { ->x : any +>x : string >this : this } } diff --git a/tests/baselines/reference/implicitIndexSignatures.js b/tests/baselines/reference/implicitIndexSignatures.js new file mode 100644 index 00000000000..6403f1f1543 --- /dev/null +++ b/tests/baselines/reference/implicitIndexSignatures.js @@ -0,0 +1,85 @@ +//// [implicitIndexSignatures.ts] +type StringMap = { [x: string]: string }; + +const empty1 = {}; +let empty2: {}; +const names1 = { a: "foo", b: "bar" }; +let names2: { a: string, b: string }; +let map: StringMap; +map = { x: "xxx", y: "yyy" }; +map = empty1; +map = empty2; +map = names1; +map = names2; + +declare function getStringIndexValue(map: { [x: string]: T }): T; +declare function getNumberIndexValue(map: { [x: number]: T }): T; + +function f1() { + const o1 = { a: 1, b: 2 }; + let o2: { a: number, b: number }; + const v1 = getStringIndexValue(o1); + const v2 = getStringIndexValue(o2); +} + +function f2() { + const o1 = { a: "1", b: "2" }; + let o2: { a: string, b: string }; + const v1 = getStringIndexValue(o1); + const v2 = getStringIndexValue(o2); +} + +function f3() { + const o1 = { a: 1, b: "2" }; + let o2: { a: number, b: string }; + const v1 = getStringIndexValue(o1); + const v2 = getStringIndexValue(o2); +} + +function f4() { + const o1 = { 0: "0", 1: "1", count: 2 }; + let o2: { 0: string, 1: string, count: number }; + const v1 = getStringIndexValue(o1); + const v2 = getStringIndexValue(o2); + const v3 = getNumberIndexValue(o1); + const v4 = getNumberIndexValue(o2); +} + + +//// [implicitIndexSignatures.js] +var empty1 = {}; +var empty2; +var names1 = { a: "foo", b: "bar" }; +var names2; +var map; +map = { x: "xxx", y: "yyy" }; +map = empty1; +map = empty2; +map = names1; +map = names2; +function f1() { + var o1 = { a: 1, b: 2 }; + var o2; + var v1 = getStringIndexValue(o1); + var v2 = getStringIndexValue(o2); +} +function f2() { + var o1 = { a: "1", b: "2" }; + var o2; + var v1 = getStringIndexValue(o1); + var v2 = getStringIndexValue(o2); +} +function f3() { + var o1 = { a: 1, b: "2" }; + var o2; + var v1 = getStringIndexValue(o1); + var v2 = getStringIndexValue(o2); +} +function f4() { + var o1 = { 0: "0", 1: "1", count: 2 }; + var o2; + var v1 = getStringIndexValue(o1); + var v2 = getStringIndexValue(o2); + var v3 = getNumberIndexValue(o1); + var v4 = getNumberIndexValue(o2); +} diff --git a/tests/baselines/reference/implicitIndexSignatures.symbols b/tests/baselines/reference/implicitIndexSignatures.symbols new file mode 100644 index 00000000000..a014e7e942c --- /dev/null +++ b/tests/baselines/reference/implicitIndexSignatures.symbols @@ -0,0 +1,166 @@ +=== tests/cases/compiler/implicitIndexSignatures.ts === +type StringMap = { [x: string]: string }; +>StringMap : Symbol(StringMap, Decl(implicitIndexSignatures.ts, 0, 0)) +>x : Symbol(x, Decl(implicitIndexSignatures.ts, 0, 20)) + +const empty1 = {}; +>empty1 : Symbol(empty1, Decl(implicitIndexSignatures.ts, 2, 5)) + +let empty2: {}; +>empty2 : Symbol(empty2, Decl(implicitIndexSignatures.ts, 3, 3)) + +const names1 = { a: "foo", b: "bar" }; +>names1 : Symbol(names1, Decl(implicitIndexSignatures.ts, 4, 5)) +>a : Symbol(a, Decl(implicitIndexSignatures.ts, 4, 16)) +>b : Symbol(b, Decl(implicitIndexSignatures.ts, 4, 26)) + +let names2: { a: string, b: string }; +>names2 : Symbol(names2, Decl(implicitIndexSignatures.ts, 5, 3)) +>a : Symbol(a, Decl(implicitIndexSignatures.ts, 5, 13)) +>b : Symbol(b, Decl(implicitIndexSignatures.ts, 5, 24)) + +let map: StringMap; +>map : Symbol(map, Decl(implicitIndexSignatures.ts, 6, 3)) +>StringMap : Symbol(StringMap, Decl(implicitIndexSignatures.ts, 0, 0)) + +map = { x: "xxx", y: "yyy" }; +>map : Symbol(map, Decl(implicitIndexSignatures.ts, 6, 3)) +>x : Symbol(x, Decl(implicitIndexSignatures.ts, 7, 7)) +>y : Symbol(y, Decl(implicitIndexSignatures.ts, 7, 17)) + +map = empty1; +>map : Symbol(map, Decl(implicitIndexSignatures.ts, 6, 3)) +>empty1 : Symbol(empty1, Decl(implicitIndexSignatures.ts, 2, 5)) + +map = empty2; +>map : Symbol(map, Decl(implicitIndexSignatures.ts, 6, 3)) +>empty2 : Symbol(empty2, Decl(implicitIndexSignatures.ts, 3, 3)) + +map = names1; +>map : Symbol(map, Decl(implicitIndexSignatures.ts, 6, 3)) +>names1 : Symbol(names1, Decl(implicitIndexSignatures.ts, 4, 5)) + +map = names2; +>map : Symbol(map, Decl(implicitIndexSignatures.ts, 6, 3)) +>names2 : Symbol(names2, Decl(implicitIndexSignatures.ts, 5, 3)) + +declare function getStringIndexValue(map: { [x: string]: T }): T; +>getStringIndexValue : Symbol(getStringIndexValue, Decl(implicitIndexSignatures.ts, 11, 13)) +>T : Symbol(T, Decl(implicitIndexSignatures.ts, 13, 37)) +>map : Symbol(map, Decl(implicitIndexSignatures.ts, 13, 40)) +>x : Symbol(x, Decl(implicitIndexSignatures.ts, 13, 48)) +>T : Symbol(T, Decl(implicitIndexSignatures.ts, 13, 37)) +>T : Symbol(T, Decl(implicitIndexSignatures.ts, 13, 37)) + +declare function getNumberIndexValue(map: { [x: number]: T }): T; +>getNumberIndexValue : Symbol(getNumberIndexValue, Decl(implicitIndexSignatures.ts, 13, 68)) +>T : Symbol(T, Decl(implicitIndexSignatures.ts, 14, 37)) +>map : Symbol(map, Decl(implicitIndexSignatures.ts, 14, 40)) +>x : Symbol(x, Decl(implicitIndexSignatures.ts, 14, 48)) +>T : Symbol(T, Decl(implicitIndexSignatures.ts, 14, 37)) +>T : Symbol(T, Decl(implicitIndexSignatures.ts, 14, 37)) + +function f1() { +>f1 : Symbol(f1, Decl(implicitIndexSignatures.ts, 14, 68)) + + const o1 = { a: 1, b: 2 }; +>o1 : Symbol(o1, Decl(implicitIndexSignatures.ts, 17, 9)) +>a : Symbol(a, Decl(implicitIndexSignatures.ts, 17, 16)) +>b : Symbol(b, Decl(implicitIndexSignatures.ts, 17, 22)) + + let o2: { a: number, b: number }; +>o2 : Symbol(o2, Decl(implicitIndexSignatures.ts, 18, 7)) +>a : Symbol(a, Decl(implicitIndexSignatures.ts, 18, 13)) +>b : Symbol(b, Decl(implicitIndexSignatures.ts, 18, 24)) + + const v1 = getStringIndexValue(o1); +>v1 : Symbol(v1, Decl(implicitIndexSignatures.ts, 19, 9)) +>getStringIndexValue : Symbol(getStringIndexValue, Decl(implicitIndexSignatures.ts, 11, 13)) +>o1 : Symbol(o1, Decl(implicitIndexSignatures.ts, 17, 9)) + + const v2 = getStringIndexValue(o2); +>v2 : Symbol(v2, Decl(implicitIndexSignatures.ts, 20, 9)) +>getStringIndexValue : Symbol(getStringIndexValue, Decl(implicitIndexSignatures.ts, 11, 13)) +>o2 : Symbol(o2, Decl(implicitIndexSignatures.ts, 18, 7)) +} + +function f2() { +>f2 : Symbol(f2, Decl(implicitIndexSignatures.ts, 21, 1)) + + const o1 = { a: "1", b: "2" }; +>o1 : Symbol(o1, Decl(implicitIndexSignatures.ts, 24, 9)) +>a : Symbol(a, Decl(implicitIndexSignatures.ts, 24, 16)) +>b : Symbol(b, Decl(implicitIndexSignatures.ts, 24, 24)) + + let o2: { a: string, b: string }; +>o2 : Symbol(o2, Decl(implicitIndexSignatures.ts, 25, 7)) +>a : Symbol(a, Decl(implicitIndexSignatures.ts, 25, 13)) +>b : Symbol(b, Decl(implicitIndexSignatures.ts, 25, 24)) + + const v1 = getStringIndexValue(o1); +>v1 : Symbol(v1, Decl(implicitIndexSignatures.ts, 26, 9)) +>getStringIndexValue : Symbol(getStringIndexValue, Decl(implicitIndexSignatures.ts, 11, 13)) +>o1 : Symbol(o1, Decl(implicitIndexSignatures.ts, 24, 9)) + + const v2 = getStringIndexValue(o2); +>v2 : Symbol(v2, Decl(implicitIndexSignatures.ts, 27, 9)) +>getStringIndexValue : Symbol(getStringIndexValue, Decl(implicitIndexSignatures.ts, 11, 13)) +>o2 : Symbol(o2, Decl(implicitIndexSignatures.ts, 25, 7)) +} + +function f3() { +>f3 : Symbol(f3, Decl(implicitIndexSignatures.ts, 28, 1)) + + const o1 = { a: 1, b: "2" }; +>o1 : Symbol(o1, Decl(implicitIndexSignatures.ts, 31, 9)) +>a : Symbol(a, Decl(implicitIndexSignatures.ts, 31, 16)) +>b : Symbol(b, Decl(implicitIndexSignatures.ts, 31, 22)) + + let o2: { a: number, b: string }; +>o2 : Symbol(o2, Decl(implicitIndexSignatures.ts, 32, 7)) +>a : Symbol(a, Decl(implicitIndexSignatures.ts, 32, 13)) +>b : Symbol(b, Decl(implicitIndexSignatures.ts, 32, 24)) + + const v1 = getStringIndexValue(o1); +>v1 : Symbol(v1, Decl(implicitIndexSignatures.ts, 33, 9)) +>getStringIndexValue : Symbol(getStringIndexValue, Decl(implicitIndexSignatures.ts, 11, 13)) +>o1 : Symbol(o1, Decl(implicitIndexSignatures.ts, 31, 9)) + + const v2 = getStringIndexValue(o2); +>v2 : Symbol(v2, Decl(implicitIndexSignatures.ts, 34, 9)) +>getStringIndexValue : Symbol(getStringIndexValue, Decl(implicitIndexSignatures.ts, 11, 13)) +>o2 : Symbol(o2, Decl(implicitIndexSignatures.ts, 32, 7)) +} + +function f4() { +>f4 : Symbol(f4, Decl(implicitIndexSignatures.ts, 35, 1)) + + const o1 = { 0: "0", 1: "1", count: 2 }; +>o1 : Symbol(o1, Decl(implicitIndexSignatures.ts, 38, 9)) +>count : Symbol(count, Decl(implicitIndexSignatures.ts, 38, 32)) + + let o2: { 0: string, 1: string, count: number }; +>o2 : Symbol(o2, Decl(implicitIndexSignatures.ts, 39, 7)) +>count : Symbol(count, Decl(implicitIndexSignatures.ts, 39, 35)) + + const v1 = getStringIndexValue(o1); +>v1 : Symbol(v1, Decl(implicitIndexSignatures.ts, 40, 9)) +>getStringIndexValue : Symbol(getStringIndexValue, Decl(implicitIndexSignatures.ts, 11, 13)) +>o1 : Symbol(o1, Decl(implicitIndexSignatures.ts, 38, 9)) + + const v2 = getStringIndexValue(o2); +>v2 : Symbol(v2, Decl(implicitIndexSignatures.ts, 41, 9)) +>getStringIndexValue : Symbol(getStringIndexValue, Decl(implicitIndexSignatures.ts, 11, 13)) +>o2 : Symbol(o2, Decl(implicitIndexSignatures.ts, 39, 7)) + + const v3 = getNumberIndexValue(o1); +>v3 : Symbol(v3, Decl(implicitIndexSignatures.ts, 42, 9)) +>getNumberIndexValue : Symbol(getNumberIndexValue, Decl(implicitIndexSignatures.ts, 13, 68)) +>o1 : Symbol(o1, Decl(implicitIndexSignatures.ts, 38, 9)) + + const v4 = getNumberIndexValue(o2); +>v4 : Symbol(v4, Decl(implicitIndexSignatures.ts, 43, 9)) +>getNumberIndexValue : Symbol(getNumberIndexValue, Decl(implicitIndexSignatures.ts, 13, 68)) +>o2 : Symbol(o2, Decl(implicitIndexSignatures.ts, 39, 7)) +} + diff --git a/tests/baselines/reference/implicitIndexSignatures.types b/tests/baselines/reference/implicitIndexSignatures.types new file mode 100644 index 00000000000..7d335c00491 --- /dev/null +++ b/tests/baselines/reference/implicitIndexSignatures.types @@ -0,0 +1,201 @@ +=== tests/cases/compiler/implicitIndexSignatures.ts === +type StringMap = { [x: string]: string }; +>StringMap : { [x: string]: string; } +>x : string + +const empty1 = {}; +>empty1 : {} +>{} : {} + +let empty2: {}; +>empty2 : {} + +const names1 = { a: "foo", b: "bar" }; +>names1 : { a: string; b: string; } +>{ a: "foo", b: "bar" } : { a: string; b: string; } +>a : string +>"foo" : string +>b : string +>"bar" : string + +let names2: { a: string, b: string }; +>names2 : { a: string; b: string; } +>a : string +>b : string + +let map: StringMap; +>map : { [x: string]: string; } +>StringMap : { [x: string]: string; } + +map = { x: "xxx", y: "yyy" }; +>map = { x: "xxx", y: "yyy" } : { x: string; y: string; } +>map : { [x: string]: string; } +>{ x: "xxx", y: "yyy" } : { x: string; y: string; } +>x : string +>"xxx" : string +>y : string +>"yyy" : string + +map = empty1; +>map = empty1 : {} +>map : { [x: string]: string; } +>empty1 : {} + +map = empty2; +>map = empty2 : {} +>map : { [x: string]: string; } +>empty2 : {} + +map = names1; +>map = names1 : { a: string; b: string; } +>map : { [x: string]: string; } +>names1 : { a: string; b: string; } + +map = names2; +>map = names2 : { a: string; b: string; } +>map : { [x: string]: string; } +>names2 : { a: string; b: string; } + +declare function getStringIndexValue(map: { [x: string]: T }): T; +>getStringIndexValue : (map: { [x: string]: T; }) => T +>T : T +>map : { [x: string]: T; } +>x : string +>T : T +>T : T + +declare function getNumberIndexValue(map: { [x: number]: T }): T; +>getNumberIndexValue : (map: { [x: number]: T; }) => T +>T : T +>map : { [x: number]: T; } +>x : number +>T : T +>T : T + +function f1() { +>f1 : () => void + + const o1 = { a: 1, b: 2 }; +>o1 : { a: number; b: number; } +>{ a: 1, b: 2 } : { a: number; b: number; } +>a : number +>1 : number +>b : number +>2 : number + + let o2: { a: number, b: number }; +>o2 : { a: number; b: number; } +>a : number +>b : number + + const v1 = getStringIndexValue(o1); +>v1 : number +>getStringIndexValue(o1) : number +>getStringIndexValue : (map: { [x: string]: T; }) => T +>o1 : { a: number; b: number; } + + const v2 = getStringIndexValue(o2); +>v2 : number +>getStringIndexValue(o2) : number +>getStringIndexValue : (map: { [x: string]: T; }) => T +>o2 : { a: number; b: number; } +} + +function f2() { +>f2 : () => void + + const o1 = { a: "1", b: "2" }; +>o1 : { a: string; b: string; } +>{ a: "1", b: "2" } : { a: string; b: string; } +>a : string +>"1" : string +>b : string +>"2" : string + + let o2: { a: string, b: string }; +>o2 : { a: string; b: string; } +>a : string +>b : string + + const v1 = getStringIndexValue(o1); +>v1 : string +>getStringIndexValue(o1) : string +>getStringIndexValue : (map: { [x: string]: T; }) => T +>o1 : { a: string; b: string; } + + const v2 = getStringIndexValue(o2); +>v2 : string +>getStringIndexValue(o2) : string +>getStringIndexValue : (map: { [x: string]: T; }) => T +>o2 : { a: string; b: string; } +} + +function f3() { +>f3 : () => void + + const o1 = { a: 1, b: "2" }; +>o1 : { a: number; b: string; } +>{ a: 1, b: "2" } : { a: number; b: string; } +>a : number +>1 : number +>b : string +>"2" : string + + let o2: { a: number, b: string }; +>o2 : { a: number; b: string; } +>a : number +>b : string + + const v1 = getStringIndexValue(o1); +>v1 : number | string +>getStringIndexValue(o1) : number | string +>getStringIndexValue : (map: { [x: string]: T; }) => T +>o1 : { a: number; b: string; } + + const v2 = getStringIndexValue(o2); +>v2 : number | string +>getStringIndexValue(o2) : number | string +>getStringIndexValue : (map: { [x: string]: T; }) => T +>o2 : { a: number; b: string; } +} + +function f4() { +>f4 : () => void + + const o1 = { 0: "0", 1: "1", count: 2 }; +>o1 : { 0: string; 1: string; count: number; } +>{ 0: "0", 1: "1", count: 2 } : { 0: string; 1: string; count: number; } +>"0" : string +>"1" : string +>count : number +>2 : number + + let o2: { 0: string, 1: string, count: number }; +>o2 : { 0: string; 1: string; count: number; } +>count : number + + const v1 = getStringIndexValue(o1); +>v1 : string | number +>getStringIndexValue(o1) : string | number +>getStringIndexValue : (map: { [x: string]: T; }) => T +>o1 : { 0: string; 1: string; count: number; } + + const v2 = getStringIndexValue(o2); +>v2 : string | number +>getStringIndexValue(o2) : string | number +>getStringIndexValue : (map: { [x: string]: T; }) => T +>o2 : { 0: string; 1: string; count: number; } + + const v3 = getNumberIndexValue(o1); +>v3 : string +>getNumberIndexValue(o1) : string +>getNumberIndexValue : (map: { [x: number]: T; }) => T +>o1 : { 0: string; 1: string; count: number; } + + const v4 = getNumberIndexValue(o2); +>v4 : string +>getNumberIndexValue(o2) : string +>getNumberIndexValue : (map: { [x: number]: T; }) => T +>o2 : { 0: string; 1: string; count: number; } +} + diff --git a/tests/baselines/reference/importAliasAnExternalModuleInsideAnInternalModule.errors.txt b/tests/baselines/reference/importAliasAnExternalModuleInsideAnInternalModule.errors.txt deleted file mode 100644 index 56d1549f853..00000000000 --- a/tests/baselines/reference/importAliasAnExternalModuleInsideAnInternalModule.errors.txt +++ /dev/null @@ -1,18 +0,0 @@ -tests/cases/compiler/importAliasAnExternalModuleInsideAnInternalModule_file0.ts(1,15): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. - - -==== tests/cases/compiler/importAliasAnExternalModuleInsideAnInternalModule_file1.ts (0 errors) ==== - import r = require('importAliasAnExternalModuleInsideAnInternalModule_file0'); - module m_private { - //import r2 = require('m'); // would be error - export import C = r; // no error - C.m.foo(); - } - -==== tests/cases/compiler/importAliasAnExternalModuleInsideAnInternalModule_file0.ts (1 errors) ==== - export module m { - ~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. - export function foo() { } - } - \ No newline at end of file diff --git a/tests/baselines/reference/importAliasAnExternalModuleInsideAnInternalModule.js b/tests/baselines/reference/importAliasAnExternalModuleInsideAnInternalModule.js index 81b0d2fdac9..94c084df512 100644 --- a/tests/baselines/reference/importAliasAnExternalModuleInsideAnInternalModule.js +++ b/tests/baselines/reference/importAliasAnExternalModuleInsideAnInternalModule.js @@ -6,7 +6,7 @@ export module m { } //// [importAliasAnExternalModuleInsideAnInternalModule_file1.ts] -import r = require('importAliasAnExternalModuleInsideAnInternalModule_file0'); +import r = require('./importAliasAnExternalModuleInsideAnInternalModule_file0'); module m_private { //import r2 = require('m'); // would be error export import C = r; // no error @@ -23,7 +23,7 @@ var m; })(m = exports.m || (exports.m = {})); //// [importAliasAnExternalModuleInsideAnInternalModule_file1.js] "use strict"; -var r = require('importAliasAnExternalModuleInsideAnInternalModule_file0'); +var r = require('./importAliasAnExternalModuleInsideAnInternalModule_file0'); var m_private; (function (m_private) { //import r2 = require('m'); // would be error diff --git a/tests/baselines/reference/importAliasAnExternalModuleInsideAnInternalModule.symbols b/tests/baselines/reference/importAliasAnExternalModuleInsideAnInternalModule.symbols new file mode 100644 index 00000000000..ffaca4a0ec5 --- /dev/null +++ b/tests/baselines/reference/importAliasAnExternalModuleInsideAnInternalModule.symbols @@ -0,0 +1,28 @@ +=== tests/cases/compiler/importAliasAnExternalModuleInsideAnInternalModule_file1.ts === +import r = require('./importAliasAnExternalModuleInsideAnInternalModule_file0'); +>r : Symbol(r, Decl(importAliasAnExternalModuleInsideAnInternalModule_file1.ts, 0, 0)) + +module m_private { +>m_private : Symbol(m_private, Decl(importAliasAnExternalModuleInsideAnInternalModule_file1.ts, 0, 80)) + + //import r2 = require('m'); // would be error + export import C = r; // no error +>C : Symbol(C, Decl(importAliasAnExternalModuleInsideAnInternalModule_file1.ts, 1, 18)) +>r : Symbol(C, Decl(importAliasAnExternalModuleInsideAnInternalModule_file0.ts, 0, 0)) + + C.m.foo(); +>C.m.foo : Symbol(C.m.foo, Decl(importAliasAnExternalModuleInsideAnInternalModule_file0.ts, 0, 17)) +>C.m : Symbol(C.m, Decl(importAliasAnExternalModuleInsideAnInternalModule_file0.ts, 0, 0)) +>C : Symbol(C, Decl(importAliasAnExternalModuleInsideAnInternalModule_file1.ts, 1, 18)) +>m : Symbol(C.m, Decl(importAliasAnExternalModuleInsideAnInternalModule_file0.ts, 0, 0)) +>foo : Symbol(C.m.foo, Decl(importAliasAnExternalModuleInsideAnInternalModule_file0.ts, 0, 17)) +} + +=== tests/cases/compiler/importAliasAnExternalModuleInsideAnInternalModule_file0.ts === +export module m { +>m : Symbol(m, Decl(importAliasAnExternalModuleInsideAnInternalModule_file0.ts, 0, 0)) + + export function foo() { } +>foo : Symbol(foo, Decl(importAliasAnExternalModuleInsideAnInternalModule_file0.ts, 0, 17)) +} + diff --git a/tests/baselines/reference/importAliasAnExternalModuleInsideAnInternalModule.types b/tests/baselines/reference/importAliasAnExternalModuleInsideAnInternalModule.types new file mode 100644 index 00000000000..34b71829d38 --- /dev/null +++ b/tests/baselines/reference/importAliasAnExternalModuleInsideAnInternalModule.types @@ -0,0 +1,29 @@ +=== tests/cases/compiler/importAliasAnExternalModuleInsideAnInternalModule_file1.ts === +import r = require('./importAliasAnExternalModuleInsideAnInternalModule_file0'); +>r : typeof r + +module m_private { +>m_private : typeof m_private + + //import r2 = require('m'); // would be error + export import C = r; // no error +>C : typeof C +>r : typeof C + + C.m.foo(); +>C.m.foo() : void +>C.m.foo : () => void +>C.m : typeof C.m +>C : typeof C +>m : typeof C.m +>foo : () => void +} + +=== tests/cases/compiler/importAliasAnExternalModuleInsideAnInternalModule_file0.ts === +export module m { +>m : typeof m + + export function foo() { } +>foo : () => void +} + diff --git a/tests/baselines/reference/importAliasIdentifiers.symbols b/tests/baselines/reference/importAliasIdentifiers.symbols index 3b2ba0ea46a..c299aef9142 100644 --- a/tests/baselines/reference/importAliasIdentifiers.symbols +++ b/tests/baselines/reference/importAliasIdentifiers.symbols @@ -6,8 +6,8 @@ module moduleA { >Point : Symbol(Point, Decl(importAliasIdentifiers.ts, 0, 16)) constructor(public x: number, public y: number) { } ->x : Symbol(x, Decl(importAliasIdentifiers.ts, 2, 20)) ->y : Symbol(y, Decl(importAliasIdentifiers.ts, 2, 37)) +>x : Symbol(Point.x, Decl(importAliasIdentifiers.ts, 2, 20)) +>y : Symbol(Point.y, Decl(importAliasIdentifiers.ts, 2, 37)) } } @@ -34,7 +34,7 @@ class clodule { >clodule : Symbol(clodule, Decl(importAliasIdentifiers.ts, 10, 33), Decl(importAliasIdentifiers.ts, 14, 1)) name: string; ->name : Symbol(name, Decl(importAliasIdentifiers.ts, 12, 15)) +>name : Symbol(clodule.name, Decl(importAliasIdentifiers.ts, 12, 15)) } module clodule { @@ -44,8 +44,8 @@ module clodule { >Point : Symbol(Point, Decl(importAliasIdentifiers.ts, 16, 16)) x: number; y: number; ->x : Symbol(x, Decl(importAliasIdentifiers.ts, 17, 28)) ->y : Symbol(y, Decl(importAliasIdentifiers.ts, 18, 18)) +>x : Symbol(Point.x, Decl(importAliasIdentifiers.ts, 17, 28)) +>y : Symbol(Point.y, Decl(importAliasIdentifiers.ts, 18, 18)) } var Point: Point = { x: 0, y: 0 }; >Point : Symbol(Point, Decl(importAliasIdentifiers.ts, 16, 16), Decl(importAliasIdentifiers.ts, 20, 7)) @@ -89,8 +89,8 @@ module fundule { >Point : Symbol(Point, Decl(importAliasIdentifiers.ts, 34, 16)) x: number; y: number; ->x : Symbol(x, Decl(importAliasIdentifiers.ts, 35, 28)) ->y : Symbol(y, Decl(importAliasIdentifiers.ts, 36, 18)) +>x : Symbol(Point.x, Decl(importAliasIdentifiers.ts, 35, 28)) +>y : Symbol(Point.y, Decl(importAliasIdentifiers.ts, 36, 18)) } var Point: Point = { x: 0, y: 0 }; >Point : Symbol(Point, Decl(importAliasIdentifiers.ts, 34, 16), Decl(importAliasIdentifiers.ts, 38, 7)) diff --git a/tests/baselines/reference/importAndVariableDeclarationConflict2.symbols b/tests/baselines/reference/importAndVariableDeclarationConflict2.symbols index 570bb5e2b98..d8d9b1d7f4c 100644 --- a/tests/baselines/reference/importAndVariableDeclarationConflict2.symbols +++ b/tests/baselines/reference/importAndVariableDeclarationConflict2.symbols @@ -15,7 +15,7 @@ class C { >C : Symbol(C, Decl(importAndVariableDeclarationConflict2.ts, 4, 15)) public foo() { ->foo : Symbol(foo, Decl(importAndVariableDeclarationConflict2.ts, 6, 9)) +>foo : Symbol(C.foo, Decl(importAndVariableDeclarationConflict2.ts, 6, 9)) var x = ''; >x : Symbol(x, Decl(importAndVariableDeclarationConflict2.ts, 8, 7)) diff --git a/tests/baselines/reference/importDecl.symbols b/tests/baselines/reference/importDecl.symbols index 32b9f3bb2a7..91df857ae98 100644 --- a/tests/baselines/reference/importDecl.symbols +++ b/tests/baselines/reference/importDecl.symbols @@ -154,7 +154,7 @@ export class d { >d : Symbol(d, Decl(importDecl_require.ts, 0, 0)) foo: string; ->foo : Symbol(foo, Decl(importDecl_require.ts, 0, 16)) +>foo : Symbol(d.foo, Decl(importDecl_require.ts, 0, 16)) } export var x: d; >x : Symbol(x, Decl(importDecl_require.ts, 3, 10)) @@ -169,7 +169,7 @@ export class d { >d : Symbol(d, Decl(importDecl_require1.ts, 0, 0)) bar: string; ->bar : Symbol(bar, Decl(importDecl_require1.ts, 0, 16)) +>bar : Symbol(d.bar, Decl(importDecl_require1.ts, 0, 16)) } var x: d; >x : Symbol(x, Decl(importDecl_require1.ts, 3, 3)) @@ -184,7 +184,7 @@ export class d { >d : Symbol(d, Decl(importDecl_require2.ts, 0, 0)) baz: string; ->baz : Symbol(baz, Decl(importDecl_require2.ts, 0, 16)) +>baz : Symbol(d.baz, Decl(importDecl_require2.ts, 0, 16)) } export var x: d; >x : Symbol(x, Decl(importDecl_require2.ts, 3, 10)) @@ -199,7 +199,7 @@ export class d { >d : Symbol(d, Decl(importDecl_require3.ts, 0, 0)) bing: string; ->bing : Symbol(bing, Decl(importDecl_require3.ts, 0, 16)) +>bing : Symbol(d.bing, Decl(importDecl_require3.ts, 0, 16)) } export var x: d; >x : Symbol(x, Decl(importDecl_require3.ts, 3, 10)) diff --git a/tests/baselines/reference/importDeclRefereingExternalModuleWithNoResolve.errors.txt b/tests/baselines/reference/importDeclRefereingExternalModuleWithNoResolve.errors.txt index 34cfe02305f..4bfe02c0467 100644 --- a/tests/baselines/reference/importDeclRefereingExternalModuleWithNoResolve.errors.txt +++ b/tests/baselines/reference/importDeclRefereingExternalModuleWithNoResolve.errors.txt @@ -1,18 +1,15 @@ -tests/cases/compiler/importDeclRefereingExternalModuleWithNoResolve.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/compiler/importDeclRefereingExternalModuleWithNoResolve.ts(1,20): error TS2307: Cannot find module 'externalModule'. -tests/cases/compiler/importDeclRefereingExternalModuleWithNoResolve.ts(2,16): error TS2435: Ambient modules cannot be nested in other modules or namespaces. +tests/cases/compiler/importDeclRefereingExternalModuleWithNoResolve.ts(2,16): error TS2664: Invalid module name in augmentation, module 'm1' cannot be found. tests/cases/compiler/importDeclRefereingExternalModuleWithNoResolve.ts(3,26): error TS2307: Cannot find module 'externalModule'. -==== tests/cases/compiler/importDeclRefereingExternalModuleWithNoResolve.ts (4 errors) ==== +==== tests/cases/compiler/importDeclRefereingExternalModuleWithNoResolve.ts (3 errors) ==== import b = require("externalModule"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ~~~~~~~~~~~~~~~~ !!! error TS2307: Cannot find module 'externalModule'. declare module "m1" { ~~~~ -!!! error TS2435: Ambient modules cannot be nested in other modules or namespaces. +!!! error TS2664: Invalid module name in augmentation, module 'm1' cannot be found. import im2 = require("externalModule"); ~~~~~~~~~~~~~~~~ !!! error TS2307: Cannot find module 'externalModule'. diff --git a/tests/baselines/reference/importDeclWithClassModifiers.errors.txt b/tests/baselines/reference/importDeclWithClassModifiers.errors.txt index b7f60881e6e..1116741818b 100644 --- a/tests/baselines/reference/importDeclWithClassModifiers.errors.txt +++ b/tests/baselines/reference/importDeclWithClassModifiers.errors.txt @@ -1,29 +1,38 @@ -tests/cases/compiler/importDeclWithClassModifiers.ts(5,8): error TS1044: 'public' modifier cannot appear on a module element. +tests/cases/compiler/importDeclWithClassModifiers.ts(5,8): error TS1044: 'public' modifier cannot appear on a module or namespace element. +tests/cases/compiler/importDeclWithClassModifiers.ts(5,26): error TS2304: Cannot find name 'x'. tests/cases/compiler/importDeclWithClassModifiers.ts(5,28): error TS2305: Module 'x' has no exported member 'c'. -tests/cases/compiler/importDeclWithClassModifiers.ts(6,8): error TS1044: 'private' modifier cannot appear on a module element. +tests/cases/compiler/importDeclWithClassModifiers.ts(6,8): error TS1044: 'private' modifier cannot appear on a module or namespace element. +tests/cases/compiler/importDeclWithClassModifiers.ts(6,27): error TS2304: Cannot find name 'x'. tests/cases/compiler/importDeclWithClassModifiers.ts(6,29): error TS2305: Module 'x' has no exported member 'c'. -tests/cases/compiler/importDeclWithClassModifiers.ts(7,8): error TS1044: 'static' modifier cannot appear on a module element. +tests/cases/compiler/importDeclWithClassModifiers.ts(7,8): error TS1044: 'static' modifier cannot appear on a module or namespace element. +tests/cases/compiler/importDeclWithClassModifiers.ts(7,26): error TS2304: Cannot find name 'x'. tests/cases/compiler/importDeclWithClassModifiers.ts(7,28): error TS2305: Module 'x' has no exported member 'c'. -==== tests/cases/compiler/importDeclWithClassModifiers.ts (6 errors) ==== +==== tests/cases/compiler/importDeclWithClassModifiers.ts (9 errors) ==== module x { interface c { } } export public import a = x.c; ~~~~~~ -!!! error TS1044: 'public' modifier cannot appear on a module element. +!!! error TS1044: 'public' modifier cannot appear on a module or namespace element. + ~ +!!! error TS2304: Cannot find name 'x'. ~ !!! error TS2305: Module 'x' has no exported member 'c'. export private import b = x.c; ~~~~~~~ -!!! error TS1044: 'private' modifier cannot appear on a module element. +!!! error TS1044: 'private' modifier cannot appear on a module or namespace element. + ~ +!!! error TS2304: Cannot find name 'x'. ~ !!! error TS2305: Module 'x' has no exported member 'c'. export static import c = x.c; ~~~~~~ -!!! error TS1044: 'static' modifier cannot appear on a module element. +!!! error TS1044: 'static' modifier cannot appear on a module or namespace element. + ~ +!!! error TS2304: Cannot find name 'x'. ~ !!! error TS2305: Module 'x' has no exported member 'c'. var b: a; diff --git a/tests/baselines/reference/importDeclWithClassModifiers.js b/tests/baselines/reference/importDeclWithClassModifiers.js index ce074cf696d..0af92b1976a 100644 --- a/tests/baselines/reference/importDeclWithClassModifiers.js +++ b/tests/baselines/reference/importDeclWithClassModifiers.js @@ -12,5 +12,8 @@ var b: a; //// [importDeclWithClassModifiers.js] define(["require", "exports"], function (require, exports) { "use strict"; + exports.a = x.c; + exports.b = x.c; + exports.c = x.c; var b; }); diff --git a/tests/baselines/reference/importDeclWithDeclareModifier.errors.txt b/tests/baselines/reference/importDeclWithDeclareModifier.errors.txt index 9e3d012aeb6..8de1a1cea68 100644 --- a/tests/baselines/reference/importDeclWithDeclareModifier.errors.txt +++ b/tests/baselines/reference/importDeclWithDeclareModifier.errors.txt @@ -1,5 +1,5 @@ -tests/cases/compiler/importDeclWithDeclareModifier.ts(5,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/compiler/importDeclWithDeclareModifier.ts(5,9): error TS1029: 'export' modifier must precede 'declare' modifier. +tests/cases/compiler/importDeclWithDeclareModifier.ts(5,27): error TS2304: Cannot find name 'x'. tests/cases/compiler/importDeclWithDeclareModifier.ts(5,29): error TS2305: Module 'x' has no exported member 'c'. @@ -9,10 +9,10 @@ tests/cases/compiler/importDeclWithDeclareModifier.ts(5,29): error TS2305: Modul } } declare export import a = x.c; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ~~~~~~ !!! error TS1029: 'export' modifier must precede 'declare' modifier. + ~ +!!! error TS2304: Cannot find name 'x'. ~ !!! error TS2305: Module 'x' has no exported member 'c'. var b: a; diff --git a/tests/baselines/reference/importDeclWithExportModifier.errors.txt b/tests/baselines/reference/importDeclWithExportModifier.errors.txt index 9fb53fbd3ea..b20896ec6e7 100644 --- a/tests/baselines/reference/importDeclWithExportModifier.errors.txt +++ b/tests/baselines/reference/importDeclWithExportModifier.errors.txt @@ -1,12 +1,15 @@ +tests/cases/compiler/importDeclWithExportModifier.ts(5,19): error TS2304: Cannot find name 'x'. tests/cases/compiler/importDeclWithExportModifier.ts(5,21): error TS2305: Module 'x' has no exported member 'c'. -==== tests/cases/compiler/importDeclWithExportModifier.ts (1 errors) ==== +==== tests/cases/compiler/importDeclWithExportModifier.ts (2 errors) ==== module x { interface c { } } export import a = x.c; + ~ +!!! error TS2304: Cannot find name 'x'. ~ !!! error TS2305: Module 'x' has no exported member 'c'. var b: a; diff --git a/tests/baselines/reference/importDeclWithExportModifier.js b/tests/baselines/reference/importDeclWithExportModifier.js index 4ff25cfa37d..c04bf542b58 100644 --- a/tests/baselines/reference/importDeclWithExportModifier.js +++ b/tests/baselines/reference/importDeclWithExportModifier.js @@ -10,5 +10,6 @@ var b: a; //// [importDeclWithExportModifier.js] define(["require", "exports"], function (require, exports) { "use strict"; + exports.a = x.c; var b; }); diff --git a/tests/baselines/reference/importDeclWithExportModifierAndExportAssignment.errors.txt b/tests/baselines/reference/importDeclWithExportModifierAndExportAssignment.errors.txt index 4d2084b7f08..d5c2f2b9712 100644 --- a/tests/baselines/reference/importDeclWithExportModifierAndExportAssignment.errors.txt +++ b/tests/baselines/reference/importDeclWithExportModifierAndExportAssignment.errors.txt @@ -1,13 +1,16 @@ +tests/cases/compiler/importDeclWithExportModifierAndExportAssignment.ts(5,19): error TS2304: Cannot find name 'x'. tests/cases/compiler/importDeclWithExportModifierAndExportAssignment.ts(5,21): error TS2305: Module 'x' has no exported member 'c'. tests/cases/compiler/importDeclWithExportModifierAndExportAssignment.ts(6,1): error TS2309: An export assignment cannot be used in a module with other exported elements. -==== tests/cases/compiler/importDeclWithExportModifierAndExportAssignment.ts (2 errors) ==== +==== tests/cases/compiler/importDeclWithExportModifierAndExportAssignment.ts (3 errors) ==== module x { interface c { } } export import a = x.c; + ~ +!!! error TS2304: Cannot find name 'x'. ~ !!! error TS2305: Module 'x' has no exported member 'c'. export = x; diff --git a/tests/baselines/reference/importDeclWithExportModifierAndExportAssignment.js b/tests/baselines/reference/importDeclWithExportModifierAndExportAssignment.js index f4264878076..da41309d56b 100644 --- a/tests/baselines/reference/importDeclWithExportModifierAndExportAssignment.js +++ b/tests/baselines/reference/importDeclWithExportModifierAndExportAssignment.js @@ -8,3 +8,4 @@ export = x; //// [importDeclWithExportModifierAndExportAssignment.js] "use strict"; +exports.a = x.c; diff --git a/tests/baselines/reference/importDeclarationUsedAsTypeQuery.symbols b/tests/baselines/reference/importDeclarationUsedAsTypeQuery.symbols index 0cd2498e2af..b0eedcddc62 100644 --- a/tests/baselines/reference/importDeclarationUsedAsTypeQuery.symbols +++ b/tests/baselines/reference/importDeclarationUsedAsTypeQuery.symbols @@ -12,6 +12,6 @@ export class B { >B : Symbol(B, Decl(importDeclarationUsedAsTypeQuery_require.ts, 0, 0)) id: number; ->id : Symbol(id, Decl(importDeclarationUsedAsTypeQuery_require.ts, 0, 16)) +>id : Symbol(B.id, Decl(importDeclarationUsedAsTypeQuery_require.ts, 0, 16)) } diff --git a/tests/baselines/reference/importImportOnlyModule.symbols b/tests/baselines/reference/importImportOnlyModule.symbols index 902f1b45a68..a56fe3752e2 100644 --- a/tests/baselines/reference/importImportOnlyModule.symbols +++ b/tests/baselines/reference/importImportOnlyModule.symbols @@ -11,7 +11,7 @@ export class C1 { >C1 : Symbol(C1, Decl(foo_0.ts, 0, 0)) m1 = 42; ->m1 : Symbol(m1, Decl(foo_0.ts, 0, 17)) +>m1 : Symbol(C1.m1, Decl(foo_0.ts, 0, 17)) static s1 = true; >s1 : Symbol(C1.s1, Decl(foo_0.ts, 1, 9)) diff --git a/tests/baselines/reference/importInTypePosition.symbols b/tests/baselines/reference/importInTypePosition.symbols index 08f55093c50..93a4908b7a8 100644 --- a/tests/baselines/reference/importInTypePosition.symbols +++ b/tests/baselines/reference/importInTypePosition.symbols @@ -6,8 +6,8 @@ module A { >Point : Symbol(Point, Decl(importInTypePosition.ts, 0, 10)) constructor(public x: number, public y: number) { } ->x : Symbol(x, Decl(importInTypePosition.ts, 2, 20)) ->y : Symbol(y, Decl(importInTypePosition.ts, 2, 37)) +>x : Symbol(Point.x, Decl(importInTypePosition.ts, 2, 20)) +>y : Symbol(Point.y, Decl(importInTypePosition.ts, 2, 37)) } export var Origin = new Point(0, 0); >Origin : Symbol(Origin, Decl(importInTypePosition.ts, 4, 14)) diff --git a/tests/baselines/reference/importOnAliasedIdentifiers.symbols b/tests/baselines/reference/importOnAliasedIdentifiers.symbols index 7717799d4db..0ee0e83db80 100644 --- a/tests/baselines/reference/importOnAliasedIdentifiers.symbols +++ b/tests/baselines/reference/importOnAliasedIdentifiers.symbols @@ -4,7 +4,7 @@ module A { export interface X { s: string } >X : Symbol(X, Decl(importOnAliasedIdentifiers.ts, 0, 10), Decl(importOnAliasedIdentifiers.ts, 2, 14)) ->s : Symbol(s, Decl(importOnAliasedIdentifiers.ts, 1, 24)) +>s : Symbol(X.s, Decl(importOnAliasedIdentifiers.ts, 1, 24)) export var X: X; >X : Symbol(X, Decl(importOnAliasedIdentifiers.ts, 0, 10), Decl(importOnAliasedIdentifiers.ts, 2, 14)) @@ -15,7 +15,7 @@ module B { interface A { n: number } >A : Symbol(A, Decl(importOnAliasedIdentifiers.ts, 4, 10)) ->n : Symbol(n, Decl(importOnAliasedIdentifiers.ts, 5, 17)) +>n : Symbol(A.n, Decl(importOnAliasedIdentifiers.ts, 5, 17)) import Y = A; // Alias only for module A >Y : Symbol(Y, Decl(importOnAliasedIdentifiers.ts, 5, 29)) diff --git a/tests/baselines/reference/importStatements.symbols b/tests/baselines/reference/importStatements.symbols index b160dcf2888..3a5a4ff2a31 100644 --- a/tests/baselines/reference/importStatements.symbols +++ b/tests/baselines/reference/importStatements.symbols @@ -6,8 +6,8 @@ module A { >Point : Symbol(Point, Decl(importStatements.ts, 0, 10)) constructor(public x: number, public y: number) { } ->x : Symbol(x, Decl(importStatements.ts, 2, 20)) ->y : Symbol(y, Decl(importStatements.ts, 2, 37)) +>x : Symbol(Point.x, Decl(importStatements.ts, 2, 20)) +>y : Symbol(Point.y, Decl(importStatements.ts, 2, 37)) } export var Origin = new Point(0, 0); diff --git a/tests/baselines/reference/importUsedInExtendsList1.symbols b/tests/baselines/reference/importUsedInExtendsList1.symbols index 263b4f50ed8..4ee60e8d670 100644 --- a/tests/baselines/reference/importUsedInExtendsList1.symbols +++ b/tests/baselines/reference/importUsedInExtendsList1.symbols @@ -22,5 +22,5 @@ var r: string = s.foo; === tests/cases/compiler/importUsedInExtendsList1_require.ts === export class Super { foo: string; } >Super : Symbol(Super, Decl(importUsedInExtendsList1_require.ts, 0, 0)) ->foo : Symbol(foo, Decl(importUsedInExtendsList1_require.ts, 0, 20)) +>foo : Symbol(Super.foo, Decl(importUsedInExtendsList1_require.ts, 0, 20)) diff --git a/tests/baselines/reference/import_reference-exported-alias.symbols b/tests/baselines/reference/import_reference-exported-alias.symbols index 424bb4bc8b4..5a7e8b8c5c7 100644 --- a/tests/baselines/reference/import_reference-exported-alias.symbols +++ b/tests/baselines/reference/import_reference-exported-alias.symbols @@ -29,7 +29,7 @@ module App { >UserServices : Symbol(UserServices, Decl(file1.ts, 1, 28)) public getUserName(): string { ->getUserName : Symbol(getUserName, Decl(file1.ts, 2, 35)) +>getUserName : Symbol(UserServices.getUserName, Decl(file1.ts, 2, 35)) return "Bill Gates"; } diff --git a/tests/baselines/reference/import_reference-to-type-alias.symbols b/tests/baselines/reference/import_reference-to-type-alias.symbols index 2fef0714a3a..6d096c1cba3 100644 --- a/tests/baselines/reference/import_reference-to-type-alias.symbols +++ b/tests/baselines/reference/import_reference-to-type-alias.symbols @@ -27,7 +27,7 @@ export module App { >UserServices : Symbol(UserServices, Decl(file1.ts, 1, 28)) public getUserName(): string { ->getUserName : Symbol(getUserName, Decl(file1.ts, 2, 35)) +>getUserName : Symbol(UserServices.getUserName, Decl(file1.ts, 2, 35)) return "Bill Gates"; } diff --git a/tests/baselines/reference/import_unneeded-require-when-referenecing-aliased-type-throug-array.symbols b/tests/baselines/reference/import_unneeded-require-when-referenecing-aliased-type-throug-array.symbols index bfc29cd8032..c8de5db1707 100644 --- a/tests/baselines/reference/import_unneeded-require-when-referenecing-aliased-type-throug-array.symbols +++ b/tests/baselines/reference/import_unneeded-require-when-referenecing-aliased-type-throug-array.symbols @@ -19,7 +19,7 @@ declare module "ITest" { >Name : Symbol(Name, Decl(b.ts, 0, 24)) name: string; ->name : Symbol(name, Decl(b.ts, 1, 20)) +>name : Symbol(Name.name, Decl(b.ts, 1, 20)) } export = Name; >Name : Symbol(Name, Decl(b.ts, 0, 24)) diff --git a/tests/baselines/reference/importedAliasesInTypePositions.symbols b/tests/baselines/reference/importedAliasesInTypePositions.symbols index 50a6b582655..1d28900c22f 100644 --- a/tests/baselines/reference/importedAliasesInTypePositions.symbols +++ b/tests/baselines/reference/importedAliasesInTypePositions.symbols @@ -18,7 +18,7 @@ export module ImportingModule { >UsesReferredType : Symbol(UsesReferredType, Decl(file2.ts, 3, 31)) constructor(private referred: ReferredTo) { } ->referred : Symbol(referred, Decl(file2.ts, 5, 20)) +>referred : Symbol(UsesReferredType.referred, Decl(file2.ts, 5, 20)) >ReferredTo : Symbol(ReferredTo, Decl(file2.ts, 0, 35)) } } @@ -33,7 +33,7 @@ export module elaborate.nested.mod.name { >ReferredTo : Symbol(ReferredTo, Decl(file1.ts, 0, 41)) doSomething(): void { ->doSomething : Symbol(doSomething, Decl(file1.ts, 1, 29)) +>doSomething : Symbol(ReferredTo.doSomething, Decl(file1.ts, 1, 29)) } } } diff --git a/tests/baselines/reference/importsImplicitlyReadonly.errors.txt b/tests/baselines/reference/importsImplicitlyReadonly.errors.txt new file mode 100644 index 00000000000..cc6e1918020 --- /dev/null +++ b/tests/baselines/reference/importsImplicitlyReadonly.errors.txt @@ -0,0 +1,34 @@ +tests/cases/conformance/externalModules/b.ts(6,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/externalModules/b.ts(7,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/externalModules/b.ts(8,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. +tests/cases/conformance/externalModules/b.ts(9,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. + + +==== tests/cases/conformance/externalModules/b.ts (4 errors) ==== + import { x, y } from "./a"; + import * as a1 from "./a"; + import a2 = require("./a"); + const a3 = a1; + + x = 1; // Error + ~ +!!! error TS2364: Invalid left-hand side of assignment expression. + y = 1; // Error + ~ +!!! error TS2364: Invalid left-hand side of assignment expression. + a1.x = 1; // Error + ~~~~ +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. + a1.y = 1; // Error + ~~~~ +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. + a2.x = 1; + a2.y = 1; + a3.x = 1; + a3.y = 1; +==== tests/cases/conformance/externalModules/a.ts (0 errors) ==== + + export var x = 1; + var y = 1; + export { y }; + \ No newline at end of file diff --git a/tests/baselines/reference/importsImplicitlyReadonly.js b/tests/baselines/reference/importsImplicitlyReadonly.js new file mode 100644 index 00000000000..4630de598cc --- /dev/null +++ b/tests/baselines/reference/importsImplicitlyReadonly.js @@ -0,0 +1,42 @@ +//// [tests/cases/conformance/externalModules/importsImplicitlyReadonly.ts] //// + +//// [a.ts] + +export var x = 1; +var y = 1; +export { y }; + +//// [b.ts] +import { x, y } from "./a"; +import * as a1 from "./a"; +import a2 = require("./a"); +const a3 = a1; + +x = 1; // Error +y = 1; // Error +a1.x = 1; // Error +a1.y = 1; // Error +a2.x = 1; +a2.y = 1; +a3.x = 1; +a3.y = 1; + +//// [a.js] +"use strict"; +exports.x = 1; +var y = 1; +exports.y = y; +//// [b.js] +"use strict"; +var a_1 = require("./a"); +var a1 = require("./a"); +var a2 = require("./a"); +var a3 = a1; +a_1.x = 1; // Error +a_1.y = 1; // Error +a1.x = 1; // Error +a1.y = 1; // Error +a2.x = 1; +a2.y = 1; +a3.x = 1; +a3.y = 1; diff --git a/tests/baselines/reference/inOperatorWithGeneric.symbols b/tests/baselines/reference/inOperatorWithGeneric.symbols index 7a84d7dce6b..0088fef0fa3 100644 --- a/tests/baselines/reference/inOperatorWithGeneric.symbols +++ b/tests/baselines/reference/inOperatorWithGeneric.symbols @@ -4,7 +4,7 @@ class C { >T : Symbol(T, Decl(inOperatorWithGeneric.ts, 0, 8)) foo(x:T) { ->foo : Symbol(foo, Decl(inOperatorWithGeneric.ts, 0, 12)) +>foo : Symbol(C.foo, Decl(inOperatorWithGeneric.ts, 0, 12)) >x : Symbol(x, Decl(inOperatorWithGeneric.ts, 1, 8)) >T : Symbol(T, Decl(inOperatorWithGeneric.ts, 0, 8)) diff --git a/tests/baselines/reference/inOperatorWithGeneric.types b/tests/baselines/reference/inOperatorWithGeneric.types index 2048e11082a..facdb7b50e2 100644 --- a/tests/baselines/reference/inOperatorWithGeneric.types +++ b/tests/baselines/reference/inOperatorWithGeneric.types @@ -9,7 +9,7 @@ class C { >T : T for (var p in x) { ->p : any +>p : string >x : T } } diff --git a/tests/baselines/reference/inOperatorWithValidOperands.symbols b/tests/baselines/reference/inOperatorWithValidOperands.symbols index 07e0bd4f6de..75e561989e7 100644 --- a/tests/baselines/reference/inOperatorWithValidOperands.symbols +++ b/tests/baselines/reference/inOperatorWithValidOperands.symbols @@ -61,11 +61,11 @@ function foo(t: T) { interface X { x: number } >X : Symbol(X, Decl(inOperatorWithValidOperands.ts, 22, 1)) ->x : Symbol(x, Decl(inOperatorWithValidOperands.ts, 24, 13)) +>x : Symbol(X.x, Decl(inOperatorWithValidOperands.ts, 24, 13)) interface Y { y: number } >Y : Symbol(Y, Decl(inOperatorWithValidOperands.ts, 24, 25)) ->y : Symbol(y, Decl(inOperatorWithValidOperands.ts, 25, 13)) +>y : Symbol(Y.y, Decl(inOperatorWithValidOperands.ts, 25, 13)) var c1: X | Y; >c1 : Symbol(c1, Decl(inOperatorWithValidOperands.ts, 27, 3)) diff --git a/tests/baselines/reference/incompatibleTypes.errors.txt b/tests/baselines/reference/incompatibleTypes.errors.txt index e612600a7f8..cb6de6576b2 100644 --- a/tests/baselines/reference/incompatibleTypes.errors.txt +++ b/tests/baselines/reference/incompatibleTypes.errors.txt @@ -6,7 +6,7 @@ tests/cases/compiler/incompatibleTypes.ts(15,7): error TS2420: Class 'C2' incorr Types of property 'p1' are incompatible. Type '(n: number) => number' is not assignable to type '(s: string) => number'. Types of parameters 'n' and 's' are incompatible. - Type 'number' is not assignable to type 'string'. + Type 'string' is not assignable to type 'number'. tests/cases/compiler/incompatibleTypes.ts(25,7): error TS2420: Class 'C3' incorrectly implements interface 'IFoo3'. Types of property 'p1' are incompatible. Type 'number' is not assignable to type 'string'. @@ -52,7 +52,7 @@ tests/cases/compiler/incompatibleTypes.ts(74,5): error TS2322: Type '(a: any) => !!! error TS2420: Types of property 'p1' are incompatible. !!! error TS2420: Type '(n: number) => number' is not assignable to type '(s: string) => number'. !!! error TS2420: Types of parameters 'n' and 's' are incompatible. -!!! error TS2420: Type 'number' is not assignable to type 'string'. +!!! error TS2420: Type 'string' is not assignable to type 'number'. public p1(n:number) { return 0; } diff --git a/tests/baselines/reference/incrementOperatorWithAnyOtherType.symbols b/tests/baselines/reference/incrementOperatorWithAnyOtherType.symbols index d0af700ea8e..338ab905064 100644 --- a/tests/baselines/reference/incrementOperatorWithAnyOtherType.symbols +++ b/tests/baselines/reference/incrementOperatorWithAnyOtherType.symbols @@ -19,7 +19,7 @@ class A { >A : Symbol(A, Decl(incrementOperatorWithAnyOtherType.ts, 5, 23)) public a: any; ->a : Symbol(a, Decl(incrementOperatorWithAnyOtherType.ts, 6, 9)) +>a : Symbol(A.a, Decl(incrementOperatorWithAnyOtherType.ts, 6, 9)) } module M { >M : Symbol(M, Decl(incrementOperatorWithAnyOtherType.ts, 8, 1)) diff --git a/tests/baselines/reference/incrementOperatorWithEnumType.errors.txt b/tests/baselines/reference/incrementOperatorWithEnumType.errors.txt index 9bcf6c7612f..fc8b682b59e 100644 --- a/tests/baselines/reference/incrementOperatorWithEnumType.errors.txt +++ b/tests/baselines/reference/incrementOperatorWithEnumType.errors.txt @@ -1,21 +1,27 @@ -tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumType.ts(7,23): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. -tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumType.ts(12,1): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumType.ts(6,25): error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumType.ts(7,23): error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumType.ts(10,3): error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumType.ts(12,1): error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property. -==== tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumType.ts (2 errors) ==== +==== tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumType.ts (4 errors) ==== // ++ operator on enum type enum ENUM1 { A, B, "" }; // expression var ResultIsNumber1 = ++ENUM1["B"]; + ~~~~~~~~~~ +!!! error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property. var ResultIsNumber2 = ENUM1.B++; ~~~~~~~ -!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property. // miss assignment operator ++ENUM1["B"]; + ~~~~~~~~~~ +!!! error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property. ENUM1.B++; ~~~~~~~ -!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. \ No newline at end of file +!!! error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property. \ No newline at end of file diff --git a/tests/baselines/reference/incrementOperatorWithNumberType.symbols b/tests/baselines/reference/incrementOperatorWithNumberType.symbols index 3523e15135c..b7e67e5dfec 100644 --- a/tests/baselines/reference/incrementOperatorWithNumberType.symbols +++ b/tests/baselines/reference/incrementOperatorWithNumberType.symbols @@ -10,7 +10,7 @@ class A { >A : Symbol(A, Decl(incrementOperatorWithNumberType.ts, 2, 31)) public a: number; ->a : Symbol(a, Decl(incrementOperatorWithNumberType.ts, 4, 9)) +>a : Symbol(A.a, Decl(incrementOperatorWithNumberType.ts, 4, 9)) } module M { >M : Symbol(M, Decl(incrementOperatorWithNumberType.ts, 6, 1)) diff --git a/tests/baselines/reference/indexSignaturesInferentialTyping.types b/tests/baselines/reference/indexSignaturesInferentialTyping.types index 328dbc18e4f..8545a7d4ca9 100644 --- a/tests/baselines/reference/indexSignaturesInferentialTyping.types +++ b/tests/baselines/reference/indexSignaturesInferentialTyping.types @@ -21,15 +21,15 @@ var x1 = foo({ 0: 0, 1: 1 }); // type should be number >x1 : number >foo({ 0: 0, 1: 1 }) : number >foo : (items: { [index: number]: T; }) => T ->{ 0: 0, 1: 1 } : { [x: number]: number; 0: number; 1: number; } +>{ 0: 0, 1: 1 } : { 0: number; 1: number; } >0 : number >1 : number var x2 = foo({ zero: 0, one: 1 }); ->x2 : any ->foo({ zero: 0, one: 1 }) : any +>x2 : {} +>foo({ zero: 0, one: 1 }) : {} >foo : (items: { [index: number]: T; }) => T ->{ zero: 0, one: 1 } : { [x: number]: undefined; zero: number; one: number; } +>{ zero: 0, one: 1 } : { zero: number; one: number; } >zero : number >0 : number >one : number @@ -39,7 +39,7 @@ var x3 = bar({ 0: 0, 1: 1 }); >x3 : number >bar({ 0: 0, 1: 1 }) : number >bar : (items: { [index: string]: T; }) => T ->{ 0: 0, 1: 1 } : { [x: string]: number; 0: number; 1: number; } +>{ 0: 0, 1: 1 } : { 0: number; 1: number; } >0 : number >1 : number @@ -47,7 +47,7 @@ var x4 = bar({ zero: 0, one: 1 }); // type should be number >x4 : number >bar({ zero: 0, one: 1 }) : number >bar : (items: { [index: string]: T; }) => T ->{ zero: 0, one: 1 } : { [x: string]: number; zero: number; one: number; } +>{ zero: 0, one: 1 } : { zero: number; one: number; } >zero : number >0 : number >one : number diff --git a/tests/baselines/reference/indexer.symbols b/tests/baselines/reference/indexer.symbols index 409bd8092d6..a713beadccd 100644 --- a/tests/baselines/reference/indexer.symbols +++ b/tests/baselines/reference/indexer.symbols @@ -3,7 +3,7 @@ interface JQueryElement { >JQueryElement : Symbol(JQueryElement, Decl(indexer.ts, 0, 0)) id:string; ->id : Symbol(id, Decl(indexer.ts, 0, 25)) +>id : Symbol(JQueryElement.id, Decl(indexer.ts, 0, 25)) } interface JQuery { diff --git a/tests/baselines/reference/indexer.types b/tests/baselines/reference/indexer.types index a0142bb9383..f24c90f6ea1 100644 --- a/tests/baselines/reference/indexer.types +++ b/tests/baselines/reference/indexer.types @@ -17,7 +17,7 @@ interface JQuery { var jq:JQuery={ 0: { id : "a" }, 1: { id : "b" } }; >jq : JQuery >JQuery : JQuery ->{ 0: { id : "a" }, 1: { id : "b" } } : { [x: number]: { id: string; }; 0: { id: string; }; 1: { id: string; }; } +>{ 0: { id : "a" }, 1: { id : "b" } } : { 0: { id: string; }; 1: { id: string; }; } >{ id : "a" } : { id: string; } >id : string >"a" : string diff --git a/tests/baselines/reference/indexer2.symbols b/tests/baselines/reference/indexer2.symbols index c23debb925c..77c024fc8cb 100644 --- a/tests/baselines/reference/indexer2.symbols +++ b/tests/baselines/reference/indexer2.symbols @@ -6,7 +6,7 @@ interface IDirectChildrenMap { >IDirectChildrenMap : Symbol(IDirectChildrenMap, Decl(indexer2.ts, 0, 32)) hasOwnProperty(objectId: number) : boolean; ->hasOwnProperty : Symbol(hasOwnProperty, Decl(indexer2.ts, 1, 30)) +>hasOwnProperty : Symbol(IDirectChildrenMap.hasOwnProperty, Decl(indexer2.ts, 1, 30)) >objectId : Symbol(objectId, Decl(indexer2.ts, 2, 23)) [objectId: number] : IHeapObjectProperty[]; diff --git a/tests/baselines/reference/indexer2.types b/tests/baselines/reference/indexer2.types index 7f1ccd41cb5..ff82707edd3 100644 --- a/tests/baselines/reference/indexer2.types +++ b/tests/baselines/reference/indexer2.types @@ -17,5 +17,5 @@ var directChildrenMap = {}; >directChildrenMap : IDirectChildrenMap >{} : IDirectChildrenMap >IDirectChildrenMap : IDirectChildrenMap ->{} : { [x: number]: undefined; } +>{} : {} diff --git a/tests/baselines/reference/indexer3.symbols b/tests/baselines/reference/indexer3.symbols index fa6f905def6..03b055b343f 100644 --- a/tests/baselines/reference/indexer3.symbols +++ b/tests/baselines/reference/indexer3.symbols @@ -2,10 +2,10 @@ var dateMap: { [x: string]: Date; } = {} >dateMap : Symbol(dateMap, Decl(indexer3.ts, 0, 3)) >x : Symbol(x, Decl(indexer3.ts, 0, 16)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) var r: Date = dateMap["hello"] // result type includes indexer using BCT >r : Symbol(r, Decl(indexer3.ts, 1, 3)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >dateMap : Symbol(dateMap, Decl(indexer3.ts, 0, 3)) diff --git a/tests/baselines/reference/indexer3.types b/tests/baselines/reference/indexer3.types index 8f0582f782a..28bcd9cab0c 100644 --- a/tests/baselines/reference/indexer3.types +++ b/tests/baselines/reference/indexer3.types @@ -3,7 +3,7 @@ var dateMap: { [x: string]: Date; } = {} >dateMap : { [x: string]: Date; } >x : string >Date : Date ->{} : { [x: string]: undefined; } +>{} : {} var r: Date = dateMap["hello"] // result type includes indexer using BCT >r : Date diff --git a/tests/baselines/reference/indexerA.symbols b/tests/baselines/reference/indexerA.symbols index d549c3359d9..b254618673a 100644 --- a/tests/baselines/reference/indexerA.symbols +++ b/tests/baselines/reference/indexerA.symbols @@ -3,7 +3,7 @@ class JQueryElement { >JQueryElement : Symbol(JQueryElement, Decl(indexerA.ts, 0, 0)) id:string; ->id : Symbol(id, Decl(indexerA.ts, 0, 21)) +>id : Symbol(JQueryElement.id, Decl(indexerA.ts, 0, 21)) } class JQuery { diff --git a/tests/baselines/reference/indexerA.types b/tests/baselines/reference/indexerA.types index c6ff81b3a26..ee6351eae33 100644 --- a/tests/baselines/reference/indexerA.types +++ b/tests/baselines/reference/indexerA.types @@ -17,7 +17,7 @@ class JQuery { var jq:JQuery={ 0: { id : "a" }, 1: { id : "b" } }; >jq : JQuery >JQuery : JQuery ->{ 0: { id : "a" }, 1: { id : "b" } } : { [x: number]: { id: string; }; 0: { id: string; }; 1: { id: string; }; } +>{ 0: { id : "a" }, 1: { id : "b" } } : { 0: { id: string; }; 1: { id: string; }; } >{ id : "a" } : { id: string; } >id : string >"a" : string diff --git a/tests/baselines/reference/indexerAssignability.errors.txt b/tests/baselines/reference/indexerAssignability.errors.txt deleted file mode 100644 index 44c2184517e..00000000000 --- a/tests/baselines/reference/indexerAssignability.errors.txt +++ /dev/null @@ -1,28 +0,0 @@ -tests/cases/compiler/indexerAssignability.ts(5,1): error TS2322: Type '{ [n: number]: string; }' is not assignable to type '{ [s: string]: string; }'. - Index signature is missing in type '{ [n: number]: string; }'. -tests/cases/compiler/indexerAssignability.ts(6,1): error TS2322: Type '{}' is not assignable to type '{ [s: string]: string; }'. - Index signature is missing in type '{}'. -tests/cases/compiler/indexerAssignability.ts(8,1): error TS2322: Type '{}' is not assignable to type '{ [n: number]: string; }'. - Index signature is missing in type '{}'. - - -==== tests/cases/compiler/indexerAssignability.ts (3 errors) ==== - var a: { [s: string]: string; }; - var b: { [n: number]: string; }; - var c: {}; - - a = b; - ~ -!!! error TS2322: Type '{ [n: number]: string; }' is not assignable to type '{ [s: string]: string; }'. -!!! error TS2322: Index signature is missing in type '{ [n: number]: string; }'. - a = c; - ~ -!!! error TS2322: Type '{}' is not assignable to type '{ [s: string]: string; }'. -!!! error TS2322: Index signature is missing in type '{}'. - b = a; - b = c; - ~ -!!! error TS2322: Type '{}' is not assignable to type '{ [n: number]: string; }'. -!!! error TS2322: Index signature is missing in type '{}'. - c = a; - c = b; \ No newline at end of file diff --git a/tests/baselines/reference/indexerAssignability.symbols b/tests/baselines/reference/indexerAssignability.symbols new file mode 100644 index 00000000000..379a2885e2c --- /dev/null +++ b/tests/baselines/reference/indexerAssignability.symbols @@ -0,0 +1,36 @@ +=== tests/cases/compiler/indexerAssignability.ts === +var a: { [s: string]: string; }; +>a : Symbol(a, Decl(indexerAssignability.ts, 0, 3)) +>s : Symbol(s, Decl(indexerAssignability.ts, 0, 10)) + +var b: { [n: number]: string; }; +>b : Symbol(b, Decl(indexerAssignability.ts, 1, 3)) +>n : Symbol(n, Decl(indexerAssignability.ts, 1, 10)) + +var c: {}; +>c : Symbol(c, Decl(indexerAssignability.ts, 2, 3)) + +a = b; +>a : Symbol(a, Decl(indexerAssignability.ts, 0, 3)) +>b : Symbol(b, Decl(indexerAssignability.ts, 1, 3)) + +a = c; +>a : Symbol(a, Decl(indexerAssignability.ts, 0, 3)) +>c : Symbol(c, Decl(indexerAssignability.ts, 2, 3)) + +b = a; +>b : Symbol(b, Decl(indexerAssignability.ts, 1, 3)) +>a : Symbol(a, Decl(indexerAssignability.ts, 0, 3)) + +b = c; +>b : Symbol(b, Decl(indexerAssignability.ts, 1, 3)) +>c : Symbol(c, Decl(indexerAssignability.ts, 2, 3)) + +c = a; +>c : Symbol(c, Decl(indexerAssignability.ts, 2, 3)) +>a : Symbol(a, Decl(indexerAssignability.ts, 0, 3)) + +c = b; +>c : Symbol(c, Decl(indexerAssignability.ts, 2, 3)) +>b : Symbol(b, Decl(indexerAssignability.ts, 1, 3)) + diff --git a/tests/baselines/reference/indexerAssignability.types b/tests/baselines/reference/indexerAssignability.types new file mode 100644 index 00000000000..bd301b59224 --- /dev/null +++ b/tests/baselines/reference/indexerAssignability.types @@ -0,0 +1,42 @@ +=== tests/cases/compiler/indexerAssignability.ts === +var a: { [s: string]: string; }; +>a : { [s: string]: string; } +>s : string + +var b: { [n: number]: string; }; +>b : { [n: number]: string; } +>n : number + +var c: {}; +>c : {} + +a = b; +>a = b : { [n: number]: string; } +>a : { [s: string]: string; } +>b : { [n: number]: string; } + +a = c; +>a = c : {} +>a : { [s: string]: string; } +>c : {} + +b = a; +>b = a : { [s: string]: string; } +>b : { [n: number]: string; } +>a : { [s: string]: string; } + +b = c; +>b = c : {} +>b : { [n: number]: string; } +>c : {} + +c = a; +>c = a : { [s: string]: string; } +>c : {} +>a : { [s: string]: string; } + +c = b; +>c = b : { [n: number]: string; } +>c : {} +>b : { [n: number]: string; } + diff --git a/tests/baselines/reference/indexerReturningTypeParameter1.symbols b/tests/baselines/reference/indexerReturningTypeParameter1.symbols index 0bb1e305c80..b9c2e7a4c16 100644 --- a/tests/baselines/reference/indexerReturningTypeParameter1.symbols +++ b/tests/baselines/reference/indexerReturningTypeParameter1.symbols @@ -3,7 +3,7 @@ interface f { >f : Symbol(f, Decl(indexerReturningTypeParameter1.ts, 0, 0)) groupBy(): { [key: string]: T[]; }; ->groupBy : Symbol(groupBy, Decl(indexerReturningTypeParameter1.ts, 0, 13)) +>groupBy : Symbol(f.groupBy, Decl(indexerReturningTypeParameter1.ts, 0, 13)) >T : Symbol(T, Decl(indexerReturningTypeParameter1.ts, 1, 12)) >key : Symbol(key, Decl(indexerReturningTypeParameter1.ts, 1, 21)) >T : Symbol(T, Decl(indexerReturningTypeParameter1.ts, 1, 12)) @@ -22,7 +22,7 @@ class c { >c : Symbol(c, Decl(indexerReturningTypeParameter1.ts, 4, 20)) groupBy(): { [key: string]: T[]; } { ->groupBy : Symbol(groupBy, Decl(indexerReturningTypeParameter1.ts, 6, 9)) +>groupBy : Symbol(c.groupBy, Decl(indexerReturningTypeParameter1.ts, 6, 9)) >T : Symbol(T, Decl(indexerReturningTypeParameter1.ts, 7, 12)) >key : Symbol(key, Decl(indexerReturningTypeParameter1.ts, 7, 21)) >T : Symbol(T, Decl(indexerReturningTypeParameter1.ts, 7, 12)) diff --git a/tests/baselines/reference/indexersInClassType.symbols b/tests/baselines/reference/indexersInClassType.symbols index 0852463c37d..c57c7cf7522 100644 --- a/tests/baselines/reference/indexersInClassType.symbols +++ b/tests/baselines/reference/indexersInClassType.symbols @@ -4,19 +4,19 @@ class C { [x: number]: Date; >x : Symbol(x, Decl(indexersInClassType.ts, 1, 5)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) [x: string]: Object; >x : Symbol(x, Decl(indexersInClassType.ts, 2, 5)) >Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) 1: Date; ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) 'a': {} fn() { ->fn : Symbol(fn, Decl(indexersInClassType.ts, 4, 11)) +>fn : Symbol(C.fn, Decl(indexersInClassType.ts, 4, 11)) return this; >this : Symbol(C, Decl(indexersInClassType.ts, 0, 0)) @@ -36,12 +36,12 @@ var r = c.fn(); var r2 = r[1]; >r2 : Symbol(r2, Decl(indexersInClassType.ts, 13, 3)) >r : Symbol(r, Decl(indexersInClassType.ts, 12, 3)) ->1 : Symbol(C.1, Decl(indexersInClassType.ts, 2, 24)) +>1 : Symbol(C[1], Decl(indexersInClassType.ts, 2, 24)) var r3 = r.a >r3 : Symbol(r3, Decl(indexersInClassType.ts, 14, 3)) ->r.a : Symbol(C.'a', Decl(indexersInClassType.ts, 3, 12)) +>r.a : Symbol(C['a'], Decl(indexersInClassType.ts, 3, 12)) >r : Symbol(r, Decl(indexersInClassType.ts, 12, 3)) ->a : Symbol(C.'a', Decl(indexersInClassType.ts, 3, 12)) +>a : Symbol(C['a'], Decl(indexersInClassType.ts, 3, 12)) diff --git a/tests/baselines/reference/inferSecondaryParameter.symbols b/tests/baselines/reference/inferSecondaryParameter.symbols index 5522770c02f..b6817d8fd52 100644 --- a/tests/baselines/reference/inferSecondaryParameter.symbols +++ b/tests/baselines/reference/inferSecondaryParameter.symbols @@ -3,7 +3,7 @@ interface Ib { m(test: string, fn: Function); } >Ib : Symbol(Ib, Decl(inferSecondaryParameter.ts, 0, 0)) ->m : Symbol(m, Decl(inferSecondaryParameter.ts, 2, 14)) +>m : Symbol(Ib.m, Decl(inferSecondaryParameter.ts, 2, 14)) >test : Symbol(test, Decl(inferSecondaryParameter.ts, 2, 17)) >fn : Symbol(fn, Decl(inferSecondaryParameter.ts, 2, 30)) >Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) diff --git a/tests/baselines/reference/inferenceLimit.js b/tests/baselines/reference/inferenceLimit.js new file mode 100644 index 00000000000..a74bf59df44 --- /dev/null +++ b/tests/baselines/reference/inferenceLimit.js @@ -0,0 +1,82 @@ +//// [tests/cases/compiler/inferenceLimit.ts] //// + +//// [file1.ts] +"use strict"; +import * as MyModule from "./mymodule"; + +export class BrokenClass { + + constructor() {} + + public brokenMethod(field: string, value: string) { + return new Promise>((resolve, reject) => { + + let result: Array = []; + + let populateItems = (order) => { + return new Promise((resolve, reject) => { + this.doStuff(order.id) + .then((items) => { + order.items = items; + resolve(order); + }); + }); + }; + + return Promise.all(result.map(populateItems)) + .then((orders: Array) => { + resolve(orders); + }); + }); + } + + public async doStuff(id: number) { + return; + } +} + +//// [mymodule.ts] +export interface MyModel { + id: number; +} + +//// [mymodule.js] +"use strict"; +//// [file1.js] +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator.throw(value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments)).next()); + }); +}; +class BrokenClass { + constructor() { + } + brokenMethod(field, value) { + return new Promise((resolve, reject) => { + let result = []; + let populateItems = (order) => { + return new Promise((resolve, reject) => { + this.doStuff(order.id) + .then((items) => { + order.items = items; + resolve(order); + }); + }); + }; + return Promise.all(result.map(populateItems)) + .then((orders) => { + resolve(orders); + }); + }); + } + doStuff(id) { + return __awaiter(this, void 0, void 0, function* () { + return; + }); + } +} +exports.BrokenClass = BrokenClass; diff --git a/tests/baselines/reference/inferenceLimit.symbols b/tests/baselines/reference/inferenceLimit.symbols new file mode 100644 index 00000000000..bedea9ce1f0 --- /dev/null +++ b/tests/baselines/reference/inferenceLimit.symbols @@ -0,0 +1,101 @@ +=== tests/cases/compiler/file1.ts === +"use strict"; +import * as MyModule from "./mymodule"; +>MyModule : Symbol(MyModule, Decl(file1.ts, 1, 6)) + +export class BrokenClass { +>BrokenClass : Symbol(BrokenClass, Decl(file1.ts, 1, 39)) + + constructor() {} + + public brokenMethod(field: string, value: string) { +>brokenMethod : Symbol(BrokenClass.brokenMethod, Decl(file1.ts, 5, 18)) +>field : Symbol(field, Decl(file1.ts, 7, 22)) +>value : Symbol(value, Decl(file1.ts, 7, 36)) + + return new Promise>((resolve, reject) => { +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>MyModule : Symbol(MyModule, Decl(file1.ts, 1, 6)) +>MyModel : Symbol(MyModule.MyModel, Decl(mymodule.ts, 0, 0)) +>resolve : Symbol(resolve, Decl(file1.ts, 8, 47)) +>reject : Symbol(reject, Decl(file1.ts, 8, 55)) + + let result: Array = []; +>result : Symbol(result, Decl(file1.ts, 10, 7)) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>MyModule : Symbol(MyModule, Decl(file1.ts, 1, 6)) +>MyModel : Symbol(MyModule.MyModel, Decl(mymodule.ts, 0, 0)) + + let populateItems = (order) => { +>populateItems : Symbol(populateItems, Decl(file1.ts, 12, 7)) +>order : Symbol(order, Decl(file1.ts, 12, 25)) + + return new Promise((resolve, reject) => { +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>resolve : Symbol(resolve, Decl(file1.ts, 13, 26)) +>reject : Symbol(reject, Decl(file1.ts, 13, 34)) + + this.doStuff(order.id) +>this.doStuff(order.id) .then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>this.doStuff : Symbol(BrokenClass.doStuff, Decl(file1.ts, 27, 3)) +>this : Symbol(BrokenClass, Decl(file1.ts, 1, 39)) +>doStuff : Symbol(BrokenClass.doStuff, Decl(file1.ts, 27, 3)) +>order : Symbol(order, Decl(file1.ts, 12, 25)) + + .then((items) => { +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>items : Symbol(items, Decl(file1.ts, 15, 17)) + + order.items = items; +>order : Symbol(order, Decl(file1.ts, 12, 25)) +>items : Symbol(items, Decl(file1.ts, 15, 17)) + + resolve(order); +>resolve : Symbol(resolve, Decl(file1.ts, 13, 26)) +>order : Symbol(order, Decl(file1.ts, 12, 25)) + + }); + }); + }; + + return Promise.all(result.map(populateItems)) +>Promise.all(result.map(populateItems)) .then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>Promise.all : Symbol(PromiseConstructor.all, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>all : Symbol(PromiseConstructor.all, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>result.map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --)) +>result : Symbol(result, Decl(file1.ts, 10, 7)) +>map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --)) +>populateItems : Symbol(populateItems, Decl(file1.ts, 12, 7)) + + .then((orders: Array) => { +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>orders : Symbol(orders, Decl(file1.ts, 23, 13)) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>MyModule : Symbol(MyModule, Decl(file1.ts, 1, 6)) +>MyModel : Symbol(MyModule.MyModel, Decl(mymodule.ts, 0, 0)) + + resolve(orders); +>resolve : Symbol(resolve, Decl(file1.ts, 8, 47)) +>orders : Symbol(orders, Decl(file1.ts, 23, 13)) + + }); + }); + } + + public async doStuff(id: number) { +>doStuff : Symbol(BrokenClass.doStuff, Decl(file1.ts, 27, 3)) +>id : Symbol(id, Decl(file1.ts, 29, 23)) + + return; + } +} + +=== tests/cases/compiler/mymodule.ts === +export interface MyModel { +>MyModel : Symbol(MyModel, Decl(mymodule.ts, 0, 0)) + + id: number; +>id : Symbol(MyModel.id, Decl(mymodule.ts, 0, 26)) +} diff --git a/tests/baselines/reference/inferenceLimit.types b/tests/baselines/reference/inferenceLimit.types new file mode 100644 index 00000000000..58f9b1e4ae0 --- /dev/null +++ b/tests/baselines/reference/inferenceLimit.types @@ -0,0 +1,123 @@ +=== tests/cases/compiler/file1.ts === +"use strict"; +>"use strict" : string + +import * as MyModule from "./mymodule"; +>MyModule : typeof MyModule + +export class BrokenClass { +>BrokenClass : BrokenClass + + constructor() {} + + public brokenMethod(field: string, value: string) { +>brokenMethod : (field: string, value: string) => Promise +>field : string +>value : string + + return new Promise>((resolve, reject) => { +>new Promise>((resolve, reject) => { let result: Array = []; let populateItems = (order) => { return new Promise((resolve, reject) => { this.doStuff(order.id) .then((items) => { order.items = items; resolve(order); }); }); }; return Promise.all(result.map(populateItems)) .then((orders: Array) => { resolve(orders); }); }) : Promise +>Promise : PromiseConstructor +>Array : T[] +>MyModule : any +>MyModel : MyModule.MyModel +>(resolve, reject) => { let result: Array = []; let populateItems = (order) => { return new Promise((resolve, reject) => { this.doStuff(order.id) .then((items) => { order.items = items; resolve(order); }); }); }; return Promise.all(result.map(populateItems)) .then((orders: Array) => { resolve(orders); }); } : (resolve: (value?: MyModule.MyModel[] | PromiseLike) => void, reject: (reason?: any) => void) => Promise +>resolve : (value?: MyModule.MyModel[] | PromiseLike) => void +>reject : (reason?: any) => void + + let result: Array = []; +>result : MyModule.MyModel[] +>Array : T[] +>MyModule : any +>MyModel : MyModule.MyModel +>[] : undefined[] + + let populateItems = (order) => { +>populateItems : (order: any) => Promise<{}> +>(order) => { return new Promise((resolve, reject) => { this.doStuff(order.id) .then((items) => { order.items = items; resolve(order); }); }); } : (order: any) => Promise<{}> +>order : any + + return new Promise((resolve, reject) => { +>new Promise((resolve, reject) => { this.doStuff(order.id) .then((items) => { order.items = items; resolve(order); }); }) : Promise<{}> +>Promise : PromiseConstructor +>(resolve, reject) => { this.doStuff(order.id) .then((items) => { order.items = items; resolve(order); }); } : (resolve: (value?: {} | PromiseLike<{}>) => void, reject: (reason?: any) => void) => void +>resolve : (value?: {} | PromiseLike<{}>) => void +>reject : (reason?: any) => void + + this.doStuff(order.id) +>this.doStuff(order.id) .then((items) => { order.items = items; resolve(order); }) : Promise +>this.doStuff(order.id) .then : { (onfulfilled?: (value: void) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled?: (value: void) => TResult | PromiseLike, onrejected?: (reason: any) => void): Promise; } +>this.doStuff(order.id) : Promise +>this.doStuff : (id: number) => Promise +>this : this +>doStuff : (id: number) => Promise +>order.id : any +>order : any +>id : any + + .then((items) => { +>then : { (onfulfilled?: (value: void) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled?: (value: void) => TResult | PromiseLike, onrejected?: (reason: any) => void): Promise; } +>(items) => { order.items = items; resolve(order); } : (items: void) => void +>items : void + + order.items = items; +>order.items = items : void +>order.items : any +>order : any +>items : any +>items : void + + resolve(order); +>resolve(order) : void +>resolve : (value?: {} | PromiseLike<{}>) => void +>order : any + + }); + }); + }; + + return Promise.all(result.map(populateItems)) +>Promise.all(result.map(populateItems)) .then((orders: Array) => { resolve(orders); }) : Promise +>Promise.all(result.map(populateItems)) .then : { (onfulfilled?: (value: {}[]) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled?: (value: {}[]) => TResult | PromiseLike, onrejected?: (reason: any) => void): Promise; } +>Promise.all(result.map(populateItems)) : Promise<{}[]> +>Promise.all : { (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike, T10 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike]): Promise<[T1, T2, T3, T4, T5]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike]): Promise<[T1, T2, T3, T4]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike]): Promise<[T1, T2, T3]>; (values: [T1 | PromiseLike, T2 | PromiseLike]): Promise<[T1, T2]>; (values: Iterable>): Promise; } +>Promise : PromiseConstructor +>all : { (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike, T10 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike]): Promise<[T1, T2, T3, T4, T5]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike]): Promise<[T1, T2, T3, T4]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike]): Promise<[T1, T2, T3]>; (values: [T1 | PromiseLike, T2 | PromiseLike]): Promise<[T1, T2]>; (values: Iterable>): Promise; } +>result.map(populateItems) : Promise<{}>[] +>result.map : (callbackfn: (value: MyModule.MyModel, index: number, array: MyModule.MyModel[]) => U, thisArg?: any) => U[] +>result : MyModule.MyModel[] +>map : (callbackfn: (value: MyModule.MyModel, index: number, array: MyModule.MyModel[]) => U, thisArg?: any) => U[] +>populateItems : (order: any) => Promise<{}> + + .then((orders: Array) => { +>then : { (onfulfilled?: (value: {}[]) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled?: (value: {}[]) => TResult | PromiseLike, onrejected?: (reason: any) => void): Promise; } +>(orders: Array) => { resolve(orders); } : (orders: MyModule.MyModel[]) => void +>orders : MyModule.MyModel[] +>Array : T[] +>MyModule : any +>MyModel : MyModule.MyModel + + resolve(orders); +>resolve(orders) : void +>resolve : (value?: MyModule.MyModel[] | PromiseLike) => void +>orders : MyModule.MyModel[] + + }); + }); + } + + public async doStuff(id: number) { +>doStuff : (id: number) => Promise +>id : number + + return; + } +} + +=== tests/cases/compiler/mymodule.ts === +export interface MyModel { +>MyModel : MyModel + + id: number; +>id : number +} diff --git a/tests/baselines/reference/inferentialTypingObjectLiteralMethod1.symbols b/tests/baselines/reference/inferentialTypingObjectLiteralMethod1.symbols index 07812704840..37e58850d4f 100644 --- a/tests/baselines/reference/inferentialTypingObjectLiteralMethod1.symbols +++ b/tests/baselines/reference/inferentialTypingObjectLiteralMethod1.symbols @@ -5,7 +5,7 @@ interface Int { >U : Symbol(U, Decl(inferentialTypingObjectLiteralMethod1.ts, 0, 16)) method(x: T): U; ->method : Symbol(method, Decl(inferentialTypingObjectLiteralMethod1.ts, 0, 21)) +>method : Symbol(Int.method, Decl(inferentialTypingObjectLiteralMethod1.ts, 0, 21)) >x : Symbol(x, Decl(inferentialTypingObjectLiteralMethod1.ts, 1, 11)) >T : Symbol(T, Decl(inferentialTypingObjectLiteralMethod1.ts, 0, 14)) >U : Symbol(U, Decl(inferentialTypingObjectLiteralMethod1.ts, 0, 16)) diff --git a/tests/baselines/reference/inferentialTypingObjectLiteralMethod2.types b/tests/baselines/reference/inferentialTypingObjectLiteralMethod2.types index be937410cef..f70305739b8 100644 --- a/tests/baselines/reference/inferentialTypingObjectLiteralMethod2.types +++ b/tests/baselines/reference/inferentialTypingObjectLiteralMethod2.types @@ -30,13 +30,13 @@ foo("", { method(p1) { return p1.length } }, { method(p2) { return undefined } } >foo("", { method(p1) { return p1.length } }, { method(p2) { return undefined } }) : string >foo : (x: T, y: Int, z: Int) => T >"" : string ->{ method(p1) { return p1.length } } : { [x: string]: (p1: string) => number; method(p1: string): number; } +>{ method(p1) { return p1.length } } : { method(p1: string): number; } >method : (p1: string) => number >p1 : string >p1.length : number >p1 : string >length : number ->{ method(p2) { return undefined } } : { [x: string]: (p2: number) => any; method(p2: number): any; } +>{ method(p2) { return undefined } } : { method(p2: number): any; } >method : (p2: number) => any >p2 : number >undefined : undefined diff --git a/tests/baselines/reference/inferentialTypingUsingApparentType3.symbols b/tests/baselines/reference/inferentialTypingUsingApparentType3.symbols index ac3058e8649..f5f73420fe3 100644 --- a/tests/baselines/reference/inferentialTypingUsingApparentType3.symbols +++ b/tests/baselines/reference/inferentialTypingUsingApparentType3.symbols @@ -4,7 +4,7 @@ interface Field { >T : Symbol(T, Decl(inferentialTypingUsingApparentType3.ts, 0, 16)) clean(input: T): T ->clean : Symbol(clean, Decl(inferentialTypingUsingApparentType3.ts, 0, 20)) +>clean : Symbol(Field.clean, Decl(inferentialTypingUsingApparentType3.ts, 0, 20)) >input : Symbol(input, Decl(inferentialTypingUsingApparentType3.ts, 1, 10)) >T : Symbol(T, Decl(inferentialTypingUsingApparentType3.ts, 0, 16)) >T : Symbol(T, Decl(inferentialTypingUsingApparentType3.ts, 0, 16)) @@ -15,7 +15,7 @@ class CharField implements Field { >Field : Symbol(Field, Decl(inferentialTypingUsingApparentType3.ts, 0, 0)) clean(input: string) { ->clean : Symbol(clean, Decl(inferentialTypingUsingApparentType3.ts, 4, 42)) +>clean : Symbol(CharField.clean, Decl(inferentialTypingUsingApparentType3.ts, 4, 42)) >input : Symbol(input, Decl(inferentialTypingUsingApparentType3.ts, 5, 10)) return "Yup"; @@ -27,7 +27,7 @@ class NumberField implements Field { >Field : Symbol(Field, Decl(inferentialTypingUsingApparentType3.ts, 0, 0)) clean(input: number) { ->clean : Symbol(clean, Decl(inferentialTypingUsingApparentType3.ts, 10, 44)) +>clean : Symbol(NumberField.clean, Decl(inferentialTypingUsingApparentType3.ts, 10, 44)) >input : Symbol(input, Decl(inferentialTypingUsingApparentType3.ts, 11, 10)) return 123; @@ -42,7 +42,7 @@ class ObjectField }> { >Field : Symbol(Field, Decl(inferentialTypingUsingApparentType3.ts, 0, 0)) constructor(public fields: T) { } ->fields : Symbol(fields, Decl(inferentialTypingUsingApparentType3.ts, 17, 16)) +>fields : Symbol(ObjectField.fields, Decl(inferentialTypingUsingApparentType3.ts, 17, 16)) >T : Symbol(T, Decl(inferentialTypingUsingApparentType3.ts, 16, 20)) } diff --git a/tests/baselines/reference/inferentialTypingUsingApparentType3.types b/tests/baselines/reference/inferentialTypingUsingApparentType3.types index 9e0a4ceaea6..e375fe981e8 100644 --- a/tests/baselines/reference/inferentialTypingUsingApparentType3.types +++ b/tests/baselines/reference/inferentialTypingUsingApparentType3.types @@ -49,10 +49,10 @@ class ObjectField }> { } var person = new ObjectField({ ->person : ObjectField<{}, { [x: string]: NumberField | CharField; id: NumberField; name: CharField; }> ->new ObjectField({ id: new NumberField(), name: new CharField()}) : ObjectField<{}, { [x: string]: NumberField | CharField; id: NumberField; name: CharField; }> +>person : ObjectField<{}, { id: NumberField; name: CharField; }> +>new ObjectField({ id: new NumberField(), name: new CharField()}) : ObjectField<{}, { id: NumberField; name: CharField; }> >ObjectField : typeof ObjectField ->{ id: new NumberField(), name: new CharField()} : { [x: string]: NumberField | CharField; id: NumberField; name: CharField; } +>{ id: new NumberField(), name: new CharField()} : { id: NumberField; name: CharField; } id: new NumberField(), >id : NumberField @@ -68,8 +68,8 @@ var person = new ObjectField({ person.fields.id; >person.fields.id : NumberField ->person.fields : { [x: string]: NumberField | CharField; id: NumberField; name: CharField; } ->person : ObjectField<{}, { [x: string]: NumberField | CharField; id: NumberField; name: CharField; }> ->fields : { [x: string]: NumberField | CharField; id: NumberField; name: CharField; } +>person.fields : { id: NumberField; name: CharField; } +>person : ObjectField<{}, { id: NumberField; name: CharField; }> +>fields : { id: NumberField; name: CharField; } >id : NumberField diff --git a/tests/baselines/reference/infiniteExpandingTypeThroughInheritanceInstantiation.symbols b/tests/baselines/reference/infiniteExpandingTypeThroughInheritanceInstantiation.symbols index 2640ec367dc..802d9c7af4f 100644 --- a/tests/baselines/reference/infiniteExpandingTypeThroughInheritanceInstantiation.symbols +++ b/tests/baselines/reference/infiniteExpandingTypeThroughInheritanceInstantiation.symbols @@ -4,7 +4,7 @@ interface A >T : Symbol(T, Decl(infiniteExpandingTypeThroughInheritanceInstantiation.ts, 0, 12)) { x: A> ->x : Symbol(x, Decl(infiniteExpandingTypeThroughInheritanceInstantiation.ts, 1, 1)) +>x : Symbol(A.x, Decl(infiniteExpandingTypeThroughInheritanceInstantiation.ts, 1, 1)) >A : Symbol(A, Decl(infiniteExpandingTypeThroughInheritanceInstantiation.ts, 0, 0)) >B : Symbol(B, Decl(infiniteExpandingTypeThroughInheritanceInstantiation.ts, 3, 1)) >T : Symbol(T, Decl(infiniteExpandingTypeThroughInheritanceInstantiation.ts, 0, 12)) @@ -17,7 +17,7 @@ interface B extends A // error >T : Symbol(T, Decl(infiniteExpandingTypeThroughInheritanceInstantiation.ts, 5, 12)) { x: B> ->x : Symbol(x, Decl(infiniteExpandingTypeThroughInheritanceInstantiation.ts, 6, 1)) +>x : Symbol(B.x, Decl(infiniteExpandingTypeThroughInheritanceInstantiation.ts, 6, 1)) >B : Symbol(B, Decl(infiniteExpandingTypeThroughInheritanceInstantiation.ts, 3, 1)) >A : Symbol(A, Decl(infiniteExpandingTypeThroughInheritanceInstantiation.ts, 0, 0)) >T : Symbol(T, Decl(infiniteExpandingTypeThroughInheritanceInstantiation.ts, 5, 12)) diff --git a/tests/baselines/reference/infiniteExpansionThroughInstantiation2.symbols b/tests/baselines/reference/infiniteExpansionThroughInstantiation2.symbols index 0c5b0cf5a65..37d2151feba 100644 --- a/tests/baselines/reference/infiniteExpansionThroughInstantiation2.symbols +++ b/tests/baselines/reference/infiniteExpansionThroughInstantiation2.symbols @@ -9,7 +9,7 @@ interface AA> // now an error due to referencing type parameter >T : Symbol(T, Decl(infiniteExpansionThroughInstantiation2.ts, 3, 13)) { x: T ->x : Symbol(x, Decl(infiniteExpansionThroughInstantiation2.ts, 4, 1)) +>x : Symbol(AA.x, Decl(infiniteExpansionThroughInstantiation2.ts, 4, 1)) >T : Symbol(T, Decl(infiniteExpansionThroughInstantiation2.ts, 3, 13)) } diff --git a/tests/baselines/reference/infiniteExpansionThroughTypeInference.symbols b/tests/baselines/reference/infiniteExpansionThroughTypeInference.symbols index ba90d5c74a8..db6ec796be3 100644 --- a/tests/baselines/reference/infiniteExpansionThroughTypeInference.symbols +++ b/tests/baselines/reference/infiniteExpansionThroughTypeInference.symbols @@ -4,13 +4,13 @@ interface G { >T : Symbol(T, Decl(infiniteExpansionThroughTypeInference.ts, 0, 12)) x: G> // infinitely expanding type reference ->x : Symbol(x, Decl(infiniteExpansionThroughTypeInference.ts, 0, 16)) +>x : Symbol(G.x, Decl(infiniteExpansionThroughTypeInference.ts, 0, 16)) >G : Symbol(G, Decl(infiniteExpansionThroughTypeInference.ts, 0, 0)) >G : Symbol(G, Decl(infiniteExpansionThroughTypeInference.ts, 0, 0)) >T : Symbol(T, Decl(infiniteExpansionThroughTypeInference.ts, 0, 12)) y: T ->y : Symbol(y, Decl(infiniteExpansionThroughTypeInference.ts, 1, 14)) +>y : Symbol(G.y, Decl(infiniteExpansionThroughTypeInference.ts, 1, 14)) >T : Symbol(T, Decl(infiniteExpansionThroughTypeInference.ts, 0, 12)) } diff --git a/tests/baselines/reference/infinitelyExpandingBaseTypes1.symbols b/tests/baselines/reference/infinitelyExpandingBaseTypes1.symbols index dc3456602bb..2491583471a 100644 --- a/tests/baselines/reference/infinitelyExpandingBaseTypes1.symbols +++ b/tests/baselines/reference/infinitelyExpandingBaseTypes1.symbols @@ -4,7 +4,7 @@ interface A >T : Symbol(T, Decl(infinitelyExpandingBaseTypes1.ts, 0, 12)) { x : A> ->x : Symbol(x, Decl(infinitelyExpandingBaseTypes1.ts, 1, 1)) +>x : Symbol(A.x, Decl(infinitelyExpandingBaseTypes1.ts, 1, 1)) >A : Symbol(A, Decl(infinitelyExpandingBaseTypes1.ts, 0, 0)) >A : Symbol(A, Decl(infinitelyExpandingBaseTypes1.ts, 0, 0)) >T : Symbol(T, Decl(infinitelyExpandingBaseTypes1.ts, 0, 12)) @@ -15,7 +15,7 @@ interface B >T : Symbol(T, Decl(infinitelyExpandingBaseTypes1.ts, 5, 12)) { x : B ->x : Symbol(x, Decl(infinitelyExpandingBaseTypes1.ts, 6, 1)) +>x : Symbol(B.x, Decl(infinitelyExpandingBaseTypes1.ts, 6, 1)) >B : Symbol(B, Decl(infinitelyExpandingBaseTypes1.ts, 3, 1)) >T : Symbol(T, Decl(infinitelyExpandingBaseTypes1.ts, 5, 12)) } diff --git a/tests/baselines/reference/infinitelyExpandingBaseTypes2.symbols b/tests/baselines/reference/infinitelyExpandingBaseTypes2.symbols index 8379ea16878..7a5d41201c8 100644 --- a/tests/baselines/reference/infinitelyExpandingBaseTypes2.symbols +++ b/tests/baselines/reference/infinitelyExpandingBaseTypes2.symbols @@ -4,7 +4,7 @@ interface A >T : Symbol(T, Decl(infinitelyExpandingBaseTypes2.ts, 0, 12)) { x : A<()=>T> ->x : Symbol(x, Decl(infinitelyExpandingBaseTypes2.ts, 1, 1)) +>x : Symbol(A.x, Decl(infinitelyExpandingBaseTypes2.ts, 1, 1)) >A : Symbol(A, Decl(infinitelyExpandingBaseTypes2.ts, 0, 0)) >T : Symbol(T, Decl(infinitelyExpandingBaseTypes2.ts, 0, 12)) } @@ -14,7 +14,7 @@ interface B >T : Symbol(T, Decl(infinitelyExpandingBaseTypes2.ts, 5, 12)) { x : B<()=>T> ->x : Symbol(x, Decl(infinitelyExpandingBaseTypes2.ts, 6, 1)) +>x : Symbol(B.x, Decl(infinitelyExpandingBaseTypes2.ts, 6, 1)) >B : Symbol(B, Decl(infinitelyExpandingBaseTypes2.ts, 3, 1)) >T : Symbol(T, Decl(infinitelyExpandingBaseTypes2.ts, 5, 12)) } diff --git a/tests/baselines/reference/infinitelyExpandingTypeAssignability.symbols b/tests/baselines/reference/infinitelyExpandingTypeAssignability.symbols index 1907ff33cf6..75274353304 100644 --- a/tests/baselines/reference/infinitelyExpandingTypeAssignability.symbols +++ b/tests/baselines/reference/infinitelyExpandingTypeAssignability.symbols @@ -4,7 +4,7 @@ interface A { >T : Symbol(T, Decl(infinitelyExpandingTypeAssignability.ts, 0, 12)) x : T ->x : Symbol(x, Decl(infinitelyExpandingTypeAssignability.ts, 0, 16)) +>x : Symbol(A.x, Decl(infinitelyExpandingTypeAssignability.ts, 0, 16)) >T : Symbol(T, Decl(infinitelyExpandingTypeAssignability.ts, 0, 12)) } diff --git a/tests/baselines/reference/infinitelyExpandingTypes3.symbols b/tests/baselines/reference/infinitelyExpandingTypes3.symbols index fbc14afc80f..18aed686442 100644 --- a/tests/baselines/reference/infinitelyExpandingTypes3.symbols +++ b/tests/baselines/reference/infinitelyExpandingTypes3.symbols @@ -4,16 +4,16 @@ interface List { >T : Symbol(T, Decl(infinitelyExpandingTypes3.ts, 0, 15)) data: T; ->data : Symbol(data, Decl(infinitelyExpandingTypes3.ts, 0, 19)) +>data : Symbol(List.data, Decl(infinitelyExpandingTypes3.ts, 0, 19)) >T : Symbol(T, Decl(infinitelyExpandingTypes3.ts, 0, 15)) next: List; // will be recursive reference when OwnerList is expanded ->next : Symbol(next, Decl(infinitelyExpandingTypes3.ts, 1, 12)) +>next : Symbol(List.next, Decl(infinitelyExpandingTypes3.ts, 1, 12)) >List : Symbol(List, Decl(infinitelyExpandingTypes3.ts, 0, 0)) >T : Symbol(T, Decl(infinitelyExpandingTypes3.ts, 0, 15)) owner: OwnerList; ->owner : Symbol(owner, Decl(infinitelyExpandingTypes3.ts, 2, 18)) +>owner : Symbol(List.owner, Decl(infinitelyExpandingTypes3.ts, 2, 18)) >OwnerList : Symbol(OwnerList, Decl(infinitelyExpandingTypes3.ts, 4, 1)) >T : Symbol(T, Decl(infinitelyExpandingTypes3.ts, 0, 15)) } @@ -26,7 +26,7 @@ interface OwnerList extends List> { >U : Symbol(U, Decl(infinitelyExpandingTypes3.ts, 6, 20)) name: string; ->name : Symbol(name, Decl(infinitelyExpandingTypes3.ts, 6, 46)) +>name : Symbol(OwnerList.name, Decl(infinitelyExpandingTypes3.ts, 6, 46)) } interface OwnerList2 extends List> { @@ -37,7 +37,7 @@ interface OwnerList2 extends List> { >U : Symbol(U, Decl(infinitelyExpandingTypes3.ts, 10, 21)) name: string; ->name : Symbol(name, Decl(infinitelyExpandingTypes3.ts, 10, 47)) +>name : Symbol(OwnerList2.name, Decl(infinitelyExpandingTypes3.ts, 10, 47)) } var o1: OwnerList; diff --git a/tests/baselines/reference/infinitelyExpandingTypes4.symbols b/tests/baselines/reference/infinitelyExpandingTypes4.symbols index af0aee01216..e394c612171 100644 --- a/tests/baselines/reference/infinitelyExpandingTypes4.symbols +++ b/tests/baselines/reference/infinitelyExpandingTypes4.symbols @@ -5,7 +5,7 @@ interface Query { // ... groupBy(keySelector: (item: T) => K): Query>; ->groupBy : Symbol(groupBy, Decl(infinitelyExpandingTypes4.ts, 0, 20)) +>groupBy : Symbol(Query.groupBy, Decl(infinitelyExpandingTypes4.ts, 0, 20)) >K : Symbol(K, Decl(infinitelyExpandingTypes4.ts, 2, 12)) >keySelector : Symbol(keySelector, Decl(infinitelyExpandingTypes4.ts, 2, 15)) >item : Symbol(item, Decl(infinitelyExpandingTypes4.ts, 2, 29)) @@ -25,7 +25,7 @@ interface QueryEnumerator { // ... groupBy(keySelector: (item: T) => K): QueryEnumerator>; ->groupBy : Symbol(groupBy, Decl(infinitelyExpandingTypes4.ts, 6, 30)) +>groupBy : Symbol(QueryEnumerator.groupBy, Decl(infinitelyExpandingTypes4.ts, 6, 30)) >K : Symbol(K, Decl(infinitelyExpandingTypes4.ts, 8, 12)) >keySelector : Symbol(keySelector, Decl(infinitelyExpandingTypes4.ts, 8, 15)) >item : Symbol(item, Decl(infinitelyExpandingTypes4.ts, 8, 29)) @@ -47,7 +47,7 @@ interface Grouping extends Query { >T : Symbol(T, Decl(infinitelyExpandingTypes4.ts, 12, 21)) key(): K; ->key : Symbol(key, Decl(infinitelyExpandingTypes4.ts, 12, 43)) +>key : Symbol(Grouping.key, Decl(infinitelyExpandingTypes4.ts, 12, 43)) >K : Symbol(K, Decl(infinitelyExpandingTypes4.ts, 12, 19)) } diff --git a/tests/baselines/reference/infinitelyExpandingTypes5.symbols b/tests/baselines/reference/infinitelyExpandingTypes5.symbols index d67d605559e..32283da9c5d 100644 --- a/tests/baselines/reference/infinitelyExpandingTypes5.symbols +++ b/tests/baselines/reference/infinitelyExpandingTypes5.symbols @@ -4,7 +4,7 @@ interface Query { >T : Symbol(T, Decl(infinitelyExpandingTypes5.ts, 0, 16)) foo(x: T): Query; ->foo : Symbol(foo, Decl(infinitelyExpandingTypes5.ts, 0, 20)) +>foo : Symbol(Query.foo, Decl(infinitelyExpandingTypes5.ts, 0, 20)) >x : Symbol(x, Decl(infinitelyExpandingTypes5.ts, 1, 8)) >T : Symbol(T, Decl(infinitelyExpandingTypes5.ts, 0, 16)) >Query : Symbol(Query, Decl(infinitelyExpandingTypes5.ts, 0, 0)) diff --git a/tests/baselines/reference/infinitelyExpandingTypesNonGenericBase.symbols b/tests/baselines/reference/infinitelyExpandingTypesNonGenericBase.symbols index dfa5d6e03ed..7c54dd7c12c 100644 --- a/tests/baselines/reference/infinitelyExpandingTypesNonGenericBase.symbols +++ b/tests/baselines/reference/infinitelyExpandingTypesNonGenericBase.symbols @@ -4,7 +4,7 @@ class Functionality { >V : Symbol(V, Decl(infinitelyExpandingTypesNonGenericBase.ts, 0, 20)) property: Options; ->property : Symbol(property, Decl(infinitelyExpandingTypesNonGenericBase.ts, 0, 24)) +>property : Symbol(Functionality.property, Decl(infinitelyExpandingTypesNonGenericBase.ts, 0, 24)) >Options : Symbol(Options, Decl(infinitelyExpandingTypesNonGenericBase.ts, 13, 1)) >V : Symbol(V, Decl(infinitelyExpandingTypesNonGenericBase.ts, 0, 20)) } @@ -19,7 +19,7 @@ class A extends Base { >Base : Symbol(Base, Decl(infinitelyExpandingTypesNonGenericBase.ts, 2, 1)) options: Options[]>; ->options : Symbol(options, Decl(infinitelyExpandingTypesNonGenericBase.ts, 7, 25)) +>options : Symbol(A.options, Decl(infinitelyExpandingTypesNonGenericBase.ts, 7, 25)) >Options : Symbol(Options, Decl(infinitelyExpandingTypesNonGenericBase.ts, 13, 1)) >Functionality : Symbol(Functionality, Decl(infinitelyExpandingTypesNonGenericBase.ts, 0, 0)) >T : Symbol(T, Decl(infinitelyExpandingTypesNonGenericBase.ts, 7, 8)) @@ -30,7 +30,7 @@ interface OptionsBase { >T : Symbol(T, Decl(infinitelyExpandingTypesNonGenericBase.ts, 11, 22)) Options: Options; ->Options : Symbol(Options, Decl(infinitelyExpandingTypesNonGenericBase.ts, 11, 26)) +>Options : Symbol(OptionsBase.Options, Decl(infinitelyExpandingTypesNonGenericBase.ts, 11, 26)) >Options : Symbol(Options, Decl(infinitelyExpandingTypesNonGenericBase.ts, 13, 1)) >T : Symbol(T, Decl(infinitelyExpandingTypesNonGenericBase.ts, 11, 22)) } diff --git a/tests/baselines/reference/infinitelyGenerativeInheritance1.symbols b/tests/baselines/reference/infinitelyGenerativeInheritance1.symbols index 54ecd9c965b..8b8e05c444a 100644 --- a/tests/baselines/reference/infinitelyGenerativeInheritance1.symbols +++ b/tests/baselines/reference/infinitelyGenerativeInheritance1.symbols @@ -4,11 +4,11 @@ interface Stack { >T : Symbol(T, Decl(infinitelyGenerativeInheritance1.ts, 0, 16)) pop(): T ->pop : Symbol(pop, Decl(infinitelyGenerativeInheritance1.ts, 0, 20)) +>pop : Symbol(Stack.pop, Decl(infinitelyGenerativeInheritance1.ts, 0, 20)) >T : Symbol(T, Decl(infinitelyGenerativeInheritance1.ts, 0, 16)) zip(a: Stack): Stack<{ x: T; y: S }> ->zip : Symbol(zip, Decl(infinitelyGenerativeInheritance1.ts, 1, 14)) +>zip : Symbol(Stack.zip, Decl(infinitelyGenerativeInheritance1.ts, 1, 14)) >S : Symbol(S, Decl(infinitelyGenerativeInheritance1.ts, 2, 10)) >a : Symbol(a, Decl(infinitelyGenerativeInheritance1.ts, 2, 13)) >Stack : Symbol(Stack, Decl(infinitelyGenerativeInheritance1.ts, 0, 0)) @@ -27,7 +27,7 @@ interface MyStack extends Stack { >T : Symbol(T, Decl(infinitelyGenerativeInheritance1.ts, 5, 18)) zip(a: Stack): Stack<{ x: T; y: S }> ->zip : Symbol(zip, Decl(infinitelyGenerativeInheritance1.ts, 5, 39)) +>zip : Symbol(MyStack.zip, Decl(infinitelyGenerativeInheritance1.ts, 5, 39)) >S : Symbol(S, Decl(infinitelyGenerativeInheritance1.ts, 6, 10)) >a : Symbol(a, Decl(infinitelyGenerativeInheritance1.ts, 6, 13)) >Stack : Symbol(Stack, Decl(infinitelyGenerativeInheritance1.ts, 0, 0)) diff --git a/tests/baselines/reference/inheritSameNamePrivatePropertiesFromSameOrigin.symbols b/tests/baselines/reference/inheritSameNamePrivatePropertiesFromSameOrigin.symbols index 55655889ca4..d7904335010 100644 --- a/tests/baselines/reference/inheritSameNamePrivatePropertiesFromSameOrigin.symbols +++ b/tests/baselines/reference/inheritSameNamePrivatePropertiesFromSameOrigin.symbols @@ -3,7 +3,7 @@ class B { >B : Symbol(B, Decl(inheritSameNamePrivatePropertiesFromSameOrigin.ts, 0, 0)) private x: number; ->x : Symbol(x, Decl(inheritSameNamePrivatePropertiesFromSameOrigin.ts, 0, 9)) +>x : Symbol(B.x, Decl(inheritSameNamePrivatePropertiesFromSameOrigin.ts, 0, 9)) } class C extends B { } >C : Symbol(C, Decl(inheritSameNamePrivatePropertiesFromSameOrigin.ts, 2, 1)) @@ -19,5 +19,5 @@ interface A extends C, C2 { // ok >C2 : Symbol(C2, Decl(inheritSameNamePrivatePropertiesFromSameOrigin.ts, 3, 21)) y: string; ->y : Symbol(y, Decl(inheritSameNamePrivatePropertiesFromSameOrigin.ts, 7, 27)) +>y : Symbol(A.y, Decl(inheritSameNamePrivatePropertiesFromSameOrigin.ts, 7, 27)) } diff --git a/tests/baselines/reference/inheritanceMemberFuncOverridingMethod.symbols b/tests/baselines/reference/inheritanceMemberFuncOverridingMethod.symbols index 4c496fcc240..696ac88cd78 100644 --- a/tests/baselines/reference/inheritanceMemberFuncOverridingMethod.symbols +++ b/tests/baselines/reference/inheritanceMemberFuncOverridingMethod.symbols @@ -3,7 +3,7 @@ class a { >a : Symbol(a, Decl(inheritanceMemberFuncOverridingMethod.ts, 0, 0)) x() { ->x : Symbol(x, Decl(inheritanceMemberFuncOverridingMethod.ts, 0, 9)) +>x : Symbol(a.x, Decl(inheritanceMemberFuncOverridingMethod.ts, 0, 9)) return "10"; } @@ -14,7 +14,7 @@ class b extends a { >a : Symbol(a, Decl(inheritanceMemberFuncOverridingMethod.ts, 0, 0)) x() { ->x : Symbol(x, Decl(inheritanceMemberFuncOverridingMethod.ts, 6, 19)) +>x : Symbol(b.x, Decl(inheritanceMemberFuncOverridingMethod.ts, 6, 19)) return "20"; } diff --git a/tests/baselines/reference/inheritanceMemberPropertyOverridingProperty.symbols b/tests/baselines/reference/inheritanceMemberPropertyOverridingProperty.symbols index bf755882165..6a3f8e50206 100644 --- a/tests/baselines/reference/inheritanceMemberPropertyOverridingProperty.symbols +++ b/tests/baselines/reference/inheritanceMemberPropertyOverridingProperty.symbols @@ -3,7 +3,7 @@ class a { >a : Symbol(a, Decl(inheritanceMemberPropertyOverridingProperty.ts, 0, 0)) x: () => string; ->x : Symbol(x, Decl(inheritanceMemberPropertyOverridingProperty.ts, 0, 9)) +>x : Symbol(a.x, Decl(inheritanceMemberPropertyOverridingProperty.ts, 0, 9)) } class b extends a { @@ -11,5 +11,5 @@ class b extends a { >a : Symbol(a, Decl(inheritanceMemberPropertyOverridingProperty.ts, 0, 0)) x: () => string; ->x : Symbol(x, Decl(inheritanceMemberPropertyOverridingProperty.ts, 4, 19)) +>x : Symbol(b.x, Decl(inheritanceMemberPropertyOverridingProperty.ts, 4, 19)) } diff --git a/tests/baselines/reference/inheritanceOfGenericConstructorMethod1.symbols b/tests/baselines/reference/inheritanceOfGenericConstructorMethod1.symbols index 108170e8895..dad2ac6f886 100644 --- a/tests/baselines/reference/inheritanceOfGenericConstructorMethod1.symbols +++ b/tests/baselines/reference/inheritanceOfGenericConstructorMethod1.symbols @@ -12,7 +12,7 @@ class B extends A {} var a = new A(); >a : Symbol(a, Decl(inheritanceOfGenericConstructorMethod1.ts, 2, 3)) >A : Symbol(A, Decl(inheritanceOfGenericConstructorMethod1.ts, 0, 0)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) var b1 = new B(); // no error >b1 : Symbol(b1, Decl(inheritanceOfGenericConstructorMethod1.ts, 3, 3)) @@ -21,12 +21,12 @@ var b1 = new B(); // no error var b2: B = new B(); // no error >b2 : Symbol(b2, Decl(inheritanceOfGenericConstructorMethod1.ts, 4, 3)) >B : Symbol(B, Decl(inheritanceOfGenericConstructorMethod1.ts, 0, 14)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >B : Symbol(B, Decl(inheritanceOfGenericConstructorMethod1.ts, 0, 14)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) var b3 = new B(); // error, could not select overload for 'new' expression >b3 : Symbol(b3, Decl(inheritanceOfGenericConstructorMethod1.ts, 5, 3)) >B : Symbol(B, Decl(inheritanceOfGenericConstructorMethod1.ts, 0, 14)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) diff --git a/tests/baselines/reference/inheritanceStaticFunctionOverridingInstanceProperty.symbols b/tests/baselines/reference/inheritanceStaticFunctionOverridingInstanceProperty.symbols index bf2f3d3aa15..8c0be543d99 100644 --- a/tests/baselines/reference/inheritanceStaticFunctionOverridingInstanceProperty.symbols +++ b/tests/baselines/reference/inheritanceStaticFunctionOverridingInstanceProperty.symbols @@ -3,7 +3,7 @@ class a { >a : Symbol(a, Decl(inheritanceStaticFunctionOverridingInstanceProperty.ts, 0, 0)) x: string; ->x : Symbol(x, Decl(inheritanceStaticFunctionOverridingInstanceProperty.ts, 0, 9)) +>x : Symbol(a.x, Decl(inheritanceStaticFunctionOverridingInstanceProperty.ts, 0, 9)) } class b extends a { diff --git a/tests/baselines/reference/inheritedGenericCallSignature.symbols b/tests/baselines/reference/inheritedGenericCallSignature.symbols index f70e4c7d75f..57469f4dad8 100644 --- a/tests/baselines/reference/inheritedGenericCallSignature.symbols +++ b/tests/baselines/reference/inheritedGenericCallSignature.symbols @@ -24,7 +24,7 @@ interface I2 extends I1 { >T : Symbol(T, Decl(inheritedGenericCallSignature.ts, 12, 13)) b: T; ->b : Symbol(b, Decl(inheritedGenericCallSignature.ts, 12, 33)) +>b : Symbol(I2.b, Decl(inheritedGenericCallSignature.ts, 12, 33)) >T : Symbol(T, Decl(inheritedGenericCallSignature.ts, 12, 13)) } @@ -34,7 +34,7 @@ interface I2 extends I1 { var x: I2; >x : Symbol(x, Decl(inheritedGenericCallSignature.ts, 20, 3)) >I2 : Symbol(I2, Decl(inheritedGenericCallSignature.ts, 8, 19)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) diff --git a/tests/baselines/reference/inheritedMembersAndIndexSignaturesFromDifferentBases2.symbols b/tests/baselines/reference/inheritedMembersAndIndexSignaturesFromDifferentBases2.symbols index 2cc31a14f7f..167cdaff838 100644 --- a/tests/baselines/reference/inheritedMembersAndIndexSignaturesFromDifferentBases2.symbols +++ b/tests/baselines/reference/inheritedMembersAndIndexSignaturesFromDifferentBases2.symbols @@ -12,7 +12,7 @@ interface B { >B : Symbol(B, Decl(inheritedMembersAndIndexSignaturesFromDifferentBases2.ts, 2, 1)) foo: number; ->foo : Symbol(foo, Decl(inheritedMembersAndIndexSignaturesFromDifferentBases2.ts, 4, 13)) +>foo : Symbol(B.foo, Decl(inheritedMembersAndIndexSignaturesFromDifferentBases2.ts, 4, 13)) } interface C extends B, A { } // Should succeed diff --git a/tests/baselines/reference/initializerReferencingConstructorParameters.errors.txt b/tests/baselines/reference/initializerReferencingConstructorParameters.errors.txt index 623bd535745..eb6744d656b 100644 --- a/tests/baselines/reference/initializerReferencingConstructorParameters.errors.txt +++ b/tests/baselines/reference/initializerReferencingConstructorParameters.errors.txt @@ -1,9 +1,9 @@ tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorParameters.ts(4,9): error TS2304: Cannot find name 'x'. tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorParameters.ts(5,15): error TS2304: Cannot find name 'x'. -tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorParameters.ts(10,9): error TS2304: Cannot find name 'x'. +tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorParameters.ts(10,9): error TS2663: Cannot find name 'x'. Did you mean the instance member 'this.x'? tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorParameters.ts(11,15): error TS2304: Cannot find name 'x'. tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorParameters.ts(17,15): error TS1003: Identifier expected. -tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorParameters.ts(23,9): error TS2304: Cannot find name 'x'. +tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorParameters.ts(23,9): error TS2663: Cannot find name 'x'. Did you mean the instance member 'this.x'? ==== tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorParameters.ts (6 errors) ==== @@ -22,7 +22,7 @@ tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencin class D { a = x; // error ~ -!!! error TS2304: Cannot find name 'x'. +!!! error TS2663: Cannot find name 'x'. Did you mean the instance member 'this.x'? b: typeof x; // error ~ !!! error TS2304: Cannot find name 'x'. @@ -41,6 +41,6 @@ tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencin a = this.x; // ok b = x; // error ~ -!!! error TS2304: Cannot find name 'x'. +!!! error TS2663: Cannot find name 'x'. Did you mean the instance member 'this.x'? constructor(public x: T) { } } \ No newline at end of file diff --git a/tests/baselines/reference/innerAliases2.symbols b/tests/baselines/reference/innerAliases2.symbols index 541fc03ffbd..31198f9276c 100644 --- a/tests/baselines/reference/innerAliases2.symbols +++ b/tests/baselines/reference/innerAliases2.symbols @@ -6,7 +6,7 @@ module _provider { >UsefulClass : Symbol(UsefulClass, Decl(innerAliases2.ts, 0, 18)) public foo() { ->foo : Symbol(foo, Decl(innerAliases2.ts, 1, 42)) +>foo : Symbol(UsefulClass.foo, Decl(innerAliases2.ts, 1, 42)) } } } diff --git a/tests/baselines/reference/innerBoundLambdaEmit.symbols b/tests/baselines/reference/innerBoundLambdaEmit.symbols index 48bbe1fad4b..8d886cc433a 100644 --- a/tests/baselines/reference/innerBoundLambdaEmit.symbols +++ b/tests/baselines/reference/innerBoundLambdaEmit.symbols @@ -13,7 +13,7 @@ interface Array { >T : Symbol(T, Decl(lib.d.ts, --, --), Decl(innerBoundLambdaEmit.ts, 5, 16)) toFoo(): M.Foo ->toFoo : Symbol(toFoo, Decl(innerBoundLambdaEmit.ts, 5, 20)) +>toFoo : Symbol(Array.toFoo, Decl(innerBoundLambdaEmit.ts, 5, 20)) >M : Symbol(M, Decl(innerBoundLambdaEmit.ts, 0, 0)) >Foo : Symbol(M.Foo, Decl(innerBoundLambdaEmit.ts, 0, 10)) } diff --git a/tests/baselines/reference/innerExtern.symbols b/tests/baselines/reference/innerExtern.symbols index 142af91a46f..9a56f4eed12 100644 --- a/tests/baselines/reference/innerExtern.symbols +++ b/tests/baselines/reference/innerExtern.symbols @@ -15,7 +15,7 @@ module A { >C : Symbol(C, Decl(innerExtern.ts, 4, 21)) x = BB.Elephant.X; ->x : Symbol(x, Decl(innerExtern.ts, 5, 24)) +>x : Symbol(C.x, Decl(innerExtern.ts, 5, 24)) >BB.Elephant : Symbol(BB.Elephant, Decl(innerExtern.ts, 2, 18)) >BB : Symbol(BB, Decl(innerExtern.ts, 0, 10)) >Elephant : Symbol(BB.Elephant, Decl(innerExtern.ts, 2, 18)) diff --git a/tests/baselines/reference/innerTypeParameterShadowingOuterOne.symbols b/tests/baselines/reference/innerTypeParameterShadowingOuterOne.symbols index 36502a9988d..d3488b4db72 100644 --- a/tests/baselines/reference/innerTypeParameterShadowingOuterOne.symbols +++ b/tests/baselines/reference/innerTypeParameterShadowingOuterOne.symbols @@ -5,12 +5,12 @@ function f() { >f : Symbol(f, Decl(innerTypeParameterShadowingOuterOne.ts, 0, 0)) >T : Symbol(T, Decl(innerTypeParameterShadowingOuterOne.ts, 3, 11)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function g() { >g : Symbol(g, Decl(innerTypeParameterShadowingOuterOne.ts, 3, 30)) >T : Symbol(T, Decl(innerTypeParameterShadowingOuterOne.ts, 4, 15)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) var x: T; >x : Symbol(x, Decl(innerTypeParameterShadowingOuterOne.ts, 5, 11)) @@ -34,16 +34,16 @@ function f() { function f2() { >f2 : Symbol(f2, Decl(innerTypeParameterShadowingOuterOne.ts, 10, 1)) >T : Symbol(T, Decl(innerTypeParameterShadowingOuterOne.ts, 12, 12)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >U : Symbol(U, Decl(innerTypeParameterShadowingOuterOne.ts, 12, 27)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function g() { >g : Symbol(g, Decl(innerTypeParameterShadowingOuterOne.ts, 12, 47)) >T : Symbol(T, Decl(innerTypeParameterShadowingOuterOne.ts, 13, 15)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >U : Symbol(U, Decl(innerTypeParameterShadowingOuterOne.ts, 13, 32)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) var x: U; >x : Symbol(x, Decl(innerTypeParameterShadowingOuterOne.ts, 14, 11)) diff --git a/tests/baselines/reference/innerTypeParameterShadowingOuterOne2.symbols b/tests/baselines/reference/innerTypeParameterShadowingOuterOne2.symbols index e19ab7aad28..1a54ab4024a 100644 --- a/tests/baselines/reference/innerTypeParameterShadowingOuterOne2.symbols +++ b/tests/baselines/reference/innerTypeParameterShadowingOuterOne2.symbols @@ -5,12 +5,12 @@ class C { >C : Symbol(C, Decl(innerTypeParameterShadowingOuterOne2.ts, 0, 0)) >T : Symbol(T, Decl(innerTypeParameterShadowingOuterOne2.ts, 3, 8)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) g() { ->g : Symbol(g, Decl(innerTypeParameterShadowingOuterOne2.ts, 3, 25)) +>g : Symbol(C.g, Decl(innerTypeParameterShadowingOuterOne2.ts, 3, 25)) >T : Symbol(T, Decl(innerTypeParameterShadowingOuterOne2.ts, 4, 6)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) var x: T; >x : Symbol(x, Decl(innerTypeParameterShadowingOuterOne2.ts, 5, 11)) @@ -23,7 +23,7 @@ class C { } h() { ->h : Symbol(h, Decl(innerTypeParameterShadowingOuterOne2.ts, 7, 5)) +>h : Symbol(C.h, Decl(innerTypeParameterShadowingOuterOne2.ts, 7, 5)) var x: T; >x : Symbol(x, Decl(innerTypeParameterShadowingOuterOne2.ts, 10, 11)) @@ -39,16 +39,16 @@ class C { class C2 { >C2 : Symbol(C2, Decl(innerTypeParameterShadowingOuterOne2.ts, 13, 1)) >T : Symbol(T, Decl(innerTypeParameterShadowingOuterOne2.ts, 15, 9)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >U : Symbol(U, Decl(innerTypeParameterShadowingOuterOne2.ts, 15, 24)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) g() { ->g : Symbol(g, Decl(innerTypeParameterShadowingOuterOne2.ts, 15, 42)) +>g : Symbol(C2.g, Decl(innerTypeParameterShadowingOuterOne2.ts, 15, 42)) >T : Symbol(T, Decl(innerTypeParameterShadowingOuterOne2.ts, 16, 6)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >U : Symbol(U, Decl(innerTypeParameterShadowingOuterOne2.ts, 16, 23)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) var x: U; >x : Symbol(x, Decl(innerTypeParameterShadowingOuterOne2.ts, 17, 11)) @@ -61,7 +61,7 @@ class C2 { } h() { ->h : Symbol(h, Decl(innerTypeParameterShadowingOuterOne2.ts, 19, 5)) +>h : Symbol(C2.h, Decl(innerTypeParameterShadowingOuterOne2.ts, 19, 5)) var x: U; >x : Symbol(x, Decl(innerTypeParameterShadowingOuterOne2.ts, 22, 11)) diff --git a/tests/baselines/reference/instanceAndStaticDeclarations1.symbols b/tests/baselines/reference/instanceAndStaticDeclarations1.symbols index 8e9d4a320a0..270f911e86c 100644 --- a/tests/baselines/reference/instanceAndStaticDeclarations1.symbols +++ b/tests/baselines/reference/instanceAndStaticDeclarations1.symbols @@ -5,28 +5,28 @@ class Point { >Point : Symbol(Point, Decl(instanceAndStaticDeclarations1.ts, 0, 0)) constructor(public x: number, public y: number) { } ->x : Symbol(x, Decl(instanceAndStaticDeclarations1.ts, 3, 16)) ->y : Symbol(y, Decl(instanceAndStaticDeclarations1.ts, 3, 33)) +>x : Symbol(Point.x, Decl(instanceAndStaticDeclarations1.ts, 3, 16)) +>y : Symbol(Point.y, Decl(instanceAndStaticDeclarations1.ts, 3, 33)) public distance(p: Point) { ->distance : Symbol(distance, Decl(instanceAndStaticDeclarations1.ts, 3, 55)) +>distance : Symbol(Point.distance, Decl(instanceAndStaticDeclarations1.ts, 3, 55)) >p : Symbol(p, Decl(instanceAndStaticDeclarations1.ts, 4, 20)) >Point : Symbol(Point, Decl(instanceAndStaticDeclarations1.ts, 0, 0)) var dx = this.x - p.x; >dx : Symbol(dx, Decl(instanceAndStaticDeclarations1.ts, 5, 11)) ->this.x : Symbol(x, Decl(instanceAndStaticDeclarations1.ts, 3, 16)) +>this.x : Symbol(Point.x, Decl(instanceAndStaticDeclarations1.ts, 3, 16)) >this : Symbol(Point, Decl(instanceAndStaticDeclarations1.ts, 0, 0)) ->x : Symbol(x, Decl(instanceAndStaticDeclarations1.ts, 3, 16)) +>x : Symbol(Point.x, Decl(instanceAndStaticDeclarations1.ts, 3, 16)) >p.x : Symbol(Point.x, Decl(instanceAndStaticDeclarations1.ts, 3, 16)) >p : Symbol(p, Decl(instanceAndStaticDeclarations1.ts, 4, 20)) >x : Symbol(Point.x, Decl(instanceAndStaticDeclarations1.ts, 3, 16)) var dy = this.y - p.y; >dy : Symbol(dy, Decl(instanceAndStaticDeclarations1.ts, 6, 11)) ->this.y : Symbol(y, Decl(instanceAndStaticDeclarations1.ts, 3, 33)) +>this.y : Symbol(Point.y, Decl(instanceAndStaticDeclarations1.ts, 3, 33)) >this : Symbol(Point, Decl(instanceAndStaticDeclarations1.ts, 0, 0)) ->y : Symbol(y, Decl(instanceAndStaticDeclarations1.ts, 3, 33)) +>y : Symbol(Point.y, Decl(instanceAndStaticDeclarations1.ts, 3, 33)) >p.y : Symbol(Point.y, Decl(instanceAndStaticDeclarations1.ts, 3, 33)) >p : Symbol(p, Decl(instanceAndStaticDeclarations1.ts, 4, 20)) >y : Symbol(Point.y, Decl(instanceAndStaticDeclarations1.ts, 3, 33)) diff --git a/tests/baselines/reference/instanceMemberInitialization.symbols b/tests/baselines/reference/instanceMemberInitialization.symbols index adc192208ca..42117133759 100644 --- a/tests/baselines/reference/instanceMemberInitialization.symbols +++ b/tests/baselines/reference/instanceMemberInitialization.symbols @@ -3,7 +3,7 @@ class C { >C : Symbol(C, Decl(instanceMemberInitialization.ts, 0, 0)) x = 1; ->x : Symbol(x, Decl(instanceMemberInitialization.ts, 0, 9)) +>x : Symbol(C.x, Decl(instanceMemberInitialization.ts, 0, 9)) } var c = new C(); diff --git a/tests/baselines/reference/instanceOfAssignability.symbols b/tests/baselines/reference/instanceOfAssignability.symbols index 1bf39df2dd2..382ee29e34a 100644 --- a/tests/baselines/reference/instanceOfAssignability.symbols +++ b/tests/baselines/reference/instanceOfAssignability.symbols @@ -3,10 +3,10 @@ interface Base { >Base : Symbol(Base, Decl(instanceOfAssignability.ts, 0, 0)) foo: string|number; ->foo : Symbol(foo, Decl(instanceOfAssignability.ts, 0, 16)) +>foo : Symbol(Base.foo, Decl(instanceOfAssignability.ts, 0, 16)) optional?: number; ->optional : Symbol(optional, Decl(instanceOfAssignability.ts, 1, 20)) +>optional : Symbol(Base.optional, Decl(instanceOfAssignability.ts, 1, 20)) } // Derived1 is assignable to, but not a subtype of, Base @@ -15,7 +15,7 @@ class Derived1 implements Base { >Base : Symbol(Base, Decl(instanceOfAssignability.ts, 0, 0)) foo: string; ->foo : Symbol(foo, Decl(instanceOfAssignability.ts, 6, 32)) +>foo : Symbol(Derived1.foo, Decl(instanceOfAssignability.ts, 6, 32)) } // Derived2 is a subtype of Base that is not assignable to Derived1 class Derived2 implements Base { @@ -23,27 +23,27 @@ class Derived2 implements Base { >Base : Symbol(Base, Decl(instanceOfAssignability.ts, 0, 0)) foo: number; ->foo : Symbol(foo, Decl(instanceOfAssignability.ts, 10, 32)) +>foo : Symbol(Derived2.foo, Decl(instanceOfAssignability.ts, 10, 32)) optional: number; ->optional : Symbol(optional, Decl(instanceOfAssignability.ts, 11, 13)) +>optional : Symbol(Derived2.optional, Decl(instanceOfAssignability.ts, 11, 13)) } class Animal { >Animal : Symbol(Animal, Decl(instanceOfAssignability.ts, 13, 1)) move; ->move : Symbol(move, Decl(instanceOfAssignability.ts, 15, 14)) +>move : Symbol(Animal.move, Decl(instanceOfAssignability.ts, 15, 14)) } class Mammal extends Animal { milk; } >Mammal : Symbol(Mammal, Decl(instanceOfAssignability.ts, 17, 1)) >Animal : Symbol(Animal, Decl(instanceOfAssignability.ts, 13, 1)) ->milk : Symbol(milk, Decl(instanceOfAssignability.ts, 18, 29)) +>milk : Symbol(Mammal.milk, Decl(instanceOfAssignability.ts, 18, 29)) class Giraffe extends Mammal { neck; } >Giraffe : Symbol(Giraffe, Decl(instanceOfAssignability.ts, 18, 37)) >Mammal : Symbol(Mammal, Decl(instanceOfAssignability.ts, 17, 1)) ->neck : Symbol(neck, Decl(instanceOfAssignability.ts, 19, 30)) +>neck : Symbol(Giraffe.neck, Decl(instanceOfAssignability.ts, 19, 30)) function fn1(x: Array|Array|boolean) { >fn1 : Symbol(fn1, Decl(instanceOfAssignability.ts, 19, 38)) @@ -171,21 +171,21 @@ function fn7(x: Array|Array) { interface Alpha { a } >Alpha : Symbol(Alpha, Decl(instanceOfAssignability.ts, 75, 1)) ->a : Symbol(a, Decl(instanceOfAssignability.ts, 77, 17)) +>a : Symbol(Alpha.a, Decl(instanceOfAssignability.ts, 77, 17)) interface Beta { b } >Beta : Symbol(Beta, Decl(instanceOfAssignability.ts, 77, 21)) ->b : Symbol(b, Decl(instanceOfAssignability.ts, 78, 16)) +>b : Symbol(Beta.b, Decl(instanceOfAssignability.ts, 78, 16)) interface Gamma { c } >Gamma : Symbol(Gamma, Decl(instanceOfAssignability.ts, 78, 20)) ->c : Symbol(c, Decl(instanceOfAssignability.ts, 79, 17)) +>c : Symbol(Gamma.c, Decl(instanceOfAssignability.ts, 79, 17)) class ABC { a; b; c; } >ABC : Symbol(ABC, Decl(instanceOfAssignability.ts, 79, 21)) ->a : Symbol(a, Decl(instanceOfAssignability.ts, 80, 11)) ->b : Symbol(b, Decl(instanceOfAssignability.ts, 80, 14)) ->c : Symbol(c, Decl(instanceOfAssignability.ts, 80, 17)) +>a : Symbol(ABC.a, Decl(instanceOfAssignability.ts, 80, 11)) +>b : Symbol(ABC.b, Decl(instanceOfAssignability.ts, 80, 14)) +>c : Symbol(ABC.c, Decl(instanceOfAssignability.ts, 80, 17)) function fn8(x: Alpha|Beta|Gamma) { >fn8 : Symbol(fn8, Decl(instanceOfAssignability.ts, 80, 22)) diff --git a/tests/baselines/reference/instanceOfAssignability.types b/tests/baselines/reference/instanceOfAssignability.types index 12b2d326062..70d068fb0cc 100644 --- a/tests/baselines/reference/instanceOfAssignability.types +++ b/tests/baselines/reference/instanceOfAssignability.types @@ -133,8 +133,8 @@ function fn5(x: Derived1) { // 1.5: y: Derived1 // Want: ??? let y = x; ->y : Derived1 ->x : Derived1 +>y : never +>x : never } } diff --git a/tests/baselines/reference/instanceOfInExternalModules.symbols b/tests/baselines/reference/instanceOfInExternalModules.symbols index 45d158fc62e..0834916c1b2 100644 --- a/tests/baselines/reference/instanceOfInExternalModules.symbols +++ b/tests/baselines/reference/instanceOfInExternalModules.symbols @@ -17,5 +17,5 @@ function IsFoo(value: any): boolean { === tests/cases/compiler/instanceOfInExternalModules_require.ts === export class Foo { foo: string; } >Foo : Symbol(Foo, Decl(instanceOfInExternalModules_require.ts, 0, 0)) ->foo : Symbol(foo, Decl(instanceOfInExternalModules_require.ts, 0, 18)) +>foo : Symbol(Foo.foo, Decl(instanceOfInExternalModules_require.ts, 0, 18)) diff --git a/tests/baselines/reference/instanceSubtypeCheck1.symbols b/tests/baselines/reference/instanceSubtypeCheck1.symbols index c7f4bb4152d..c9b1a7f0cba 100644 --- a/tests/baselines/reference/instanceSubtypeCheck1.symbols +++ b/tests/baselines/reference/instanceSubtypeCheck1.symbols @@ -4,7 +4,7 @@ interface A >T : Symbol(T, Decl(instanceSubtypeCheck1.ts, 0, 12)) { x: A> ->x : Symbol(x, Decl(instanceSubtypeCheck1.ts, 1, 1)) +>x : Symbol(A.x, Decl(instanceSubtypeCheck1.ts, 1, 1)) >A : Symbol(A, Decl(instanceSubtypeCheck1.ts, 0, 0)) >B : Symbol(B, Decl(instanceSubtypeCheck1.ts, 3, 1)) >T : Symbol(T, Decl(instanceSubtypeCheck1.ts, 0, 12)) @@ -17,7 +17,7 @@ interface B extends A >T : Symbol(T, Decl(instanceSubtypeCheck1.ts, 5, 12)) { x: B> ->x : Symbol(x, Decl(instanceSubtypeCheck1.ts, 6, 1)) +>x : Symbol(B.x, Decl(instanceSubtypeCheck1.ts, 6, 1)) >B : Symbol(B, Decl(instanceSubtypeCheck1.ts, 3, 1)) >A : Symbol(A, Decl(instanceSubtypeCheck1.ts, 0, 0)) >T : Symbol(T, Decl(instanceSubtypeCheck1.ts, 5, 12)) diff --git a/tests/baselines/reference/instanceSubtypeCheck2.errors.txt b/tests/baselines/reference/instanceSubtypeCheck2.errors.txt index ba93c2ef127..81982ac3ec7 100644 --- a/tests/baselines/reference/instanceSubtypeCheck2.errors.txt +++ b/tests/baselines/reference/instanceSubtypeCheck2.errors.txt @@ -1,7 +1,6 @@ tests/cases/compiler/instanceSubtypeCheck2.ts(5,7): error TS2415: Class 'C2' incorrectly extends base class 'C1'. Types of property 'x' are incompatible. Type 'string' is not assignable to type 'C2'. - Property 'x' is missing in type 'String'. ==== tests/cases/compiler/instanceSubtypeCheck2.ts (1 errors) ==== @@ -14,6 +13,5 @@ tests/cases/compiler/instanceSubtypeCheck2.ts(5,7): error TS2415: Class 'C2' !!! error TS2415: Class 'C2' incorrectly extends base class 'C1'. !!! error TS2415: Types of property 'x' are incompatible. !!! error TS2415: Type 'string' is not assignable to type 'C2'. -!!! error TS2415: Property 'x' is missing in type 'String'. x: string } \ No newline at end of file diff --git a/tests/baselines/reference/instantiateCrossFileMerge.js b/tests/baselines/reference/instantiateCrossFileMerge.js new file mode 100644 index 00000000000..cf452b599bd --- /dev/null +++ b/tests/baselines/reference/instantiateCrossFileMerge.js @@ -0,0 +1,15 @@ +//// [tests/cases/compiler/instantiateCrossFileMerge.ts] //// + +//// [first.ts] +declare class P { + constructor(callback: (resolve: (value: R) => void) => void); +} + +//// [second.ts] +interface P { } +new P(r => { r('foo') }); + + +//// [first.js] +//// [second.js] +new P(function (r) { r('foo'); }); diff --git a/tests/baselines/reference/instantiateCrossFileMerge.symbols b/tests/baselines/reference/instantiateCrossFileMerge.symbols new file mode 100644 index 00000000000..64f9586f48d --- /dev/null +++ b/tests/baselines/reference/instantiateCrossFileMerge.symbols @@ -0,0 +1,22 @@ +=== tests/cases/compiler/first.ts === +declare class P { +>P : Symbol(P, Decl(first.ts, 0, 0), Decl(second.ts, 0, 0)) +>R : Symbol(R, Decl(first.ts, 0, 16), Decl(second.ts, 0, 12)) + + constructor(callback: (resolve: (value: R) => void) => void); +>callback : Symbol(callback, Decl(first.ts, 1, 16)) +>resolve : Symbol(resolve, Decl(first.ts, 1, 27)) +>value : Symbol(value, Decl(first.ts, 1, 37)) +>R : Symbol(R, Decl(first.ts, 0, 16), Decl(second.ts, 0, 12)) +} + +=== tests/cases/compiler/second.ts === +interface P { } +>P : Symbol(P, Decl(first.ts, 0, 0), Decl(second.ts, 0, 0)) +>R : Symbol(R, Decl(first.ts, 0, 16), Decl(second.ts, 0, 12)) + +new P(r => { r('foo') }); +>P : Symbol(P, Decl(first.ts, 0, 0), Decl(second.ts, 0, 0)) +>r : Symbol(r, Decl(second.ts, 1, 14)) +>r : Symbol(r, Decl(second.ts, 1, 14)) + diff --git a/tests/baselines/reference/instantiateCrossFileMerge.types b/tests/baselines/reference/instantiateCrossFileMerge.types new file mode 100644 index 00000000000..8fbeaab3d1f --- /dev/null +++ b/tests/baselines/reference/instantiateCrossFileMerge.types @@ -0,0 +1,26 @@ +=== tests/cases/compiler/first.ts === +declare class P { +>P : P +>R : R + + constructor(callback: (resolve: (value: R) => void) => void); +>callback : (resolve: (value: R) => void) => void +>resolve : (value: R) => void +>value : R +>R : R +} + +=== tests/cases/compiler/second.ts === +interface P { } +>P : P +>R : R + +new P(r => { r('foo') }); +>new P(r => { r('foo') }) : P +>P : typeof P +>r => { r('foo') } : (r: (value: string) => void) => void +>r : (value: string) => void +>r('foo') : void +>r : (value: string) => void +>'foo' : string + diff --git a/tests/baselines/reference/instantiateGenericClassWithZeroTypeArguments.symbols b/tests/baselines/reference/instantiateGenericClassWithZeroTypeArguments.symbols index b20387d9b80..499cd94f3ff 100644 --- a/tests/baselines/reference/instantiateGenericClassWithZeroTypeArguments.symbols +++ b/tests/baselines/reference/instantiateGenericClassWithZeroTypeArguments.symbols @@ -6,7 +6,7 @@ class C { >T : Symbol(T, Decl(instantiateGenericClassWithZeroTypeArguments.ts, 2, 8)) x: T; ->x : Symbol(x, Decl(instantiateGenericClassWithZeroTypeArguments.ts, 2, 12)) +>x : Symbol(C.x, Decl(instantiateGenericClassWithZeroTypeArguments.ts, 2, 12)) >T : Symbol(T, Decl(instantiateGenericClassWithZeroTypeArguments.ts, 2, 8)) } @@ -20,11 +20,11 @@ class D { >U : Symbol(U, Decl(instantiateGenericClassWithZeroTypeArguments.ts, 8, 10)) x: T ->x : Symbol(x, Decl(instantiateGenericClassWithZeroTypeArguments.ts, 8, 15)) +>x : Symbol(D.x, Decl(instantiateGenericClassWithZeroTypeArguments.ts, 8, 15)) >T : Symbol(T, Decl(instantiateGenericClassWithZeroTypeArguments.ts, 8, 8)) y: U ->y : Symbol(y, Decl(instantiateGenericClassWithZeroTypeArguments.ts, 9, 8)) +>y : Symbol(D.y, Decl(instantiateGenericClassWithZeroTypeArguments.ts, 9, 8)) >U : Symbol(U, Decl(instantiateGenericClassWithZeroTypeArguments.ts, 8, 10)) } diff --git a/tests/baselines/reference/instantiatedBaseTypeConstraints.symbols b/tests/baselines/reference/instantiatedBaseTypeConstraints.symbols index e92097c309c..923465505ca 100644 --- a/tests/baselines/reference/instantiatedBaseTypeConstraints.symbols +++ b/tests/baselines/reference/instantiatedBaseTypeConstraints.symbols @@ -8,7 +8,7 @@ interface Foo, C> { >C : Symbol(C, Decl(instantiatedBaseTypeConstraints.ts, 0, 34)) foo(bar: C): void; ->foo : Symbol(foo, Decl(instantiatedBaseTypeConstraints.ts, 0, 39)) +>foo : Symbol(Foo.foo, Decl(instantiatedBaseTypeConstraints.ts, 0, 39)) >bar : Symbol(bar, Decl(instantiatedBaseTypeConstraints.ts, 1, 6)) >C : Symbol(C, Decl(instantiatedBaseTypeConstraints.ts, 0, 34)) } @@ -19,7 +19,7 @@ class Bar implements Foo { >Bar : Symbol(Bar, Decl(instantiatedBaseTypeConstraints.ts, 2, 1)) foo(bar: string): void { ->foo : Symbol(foo, Decl(instantiatedBaseTypeConstraints.ts, 4, 39)) +>foo : Symbol(Bar.foo, Decl(instantiatedBaseTypeConstraints.ts, 4, 39)) >bar : Symbol(bar, Decl(instantiatedBaseTypeConstraints.ts, 5, 6)) } } diff --git a/tests/baselines/reference/instantiatedModule.symbols b/tests/baselines/reference/instantiatedModule.symbols index 42e0edcd221..acad3db7ea4 100644 --- a/tests/baselines/reference/instantiatedModule.symbols +++ b/tests/baselines/reference/instantiatedModule.symbols @@ -6,8 +6,8 @@ module M { export interface Point { x: number; y: number } >Point : Symbol(Point, Decl(instantiatedModule.ts, 2, 10), Decl(instantiatedModule.ts, 4, 14)) ->x : Symbol(x, Decl(instantiatedModule.ts, 3, 28)) ->y : Symbol(y, Decl(instantiatedModule.ts, 3, 39)) +>x : Symbol(Point.x, Decl(instantiatedModule.ts, 3, 28)) +>y : Symbol(Point.y, Decl(instantiatedModule.ts, 3, 39)) export var Point = 1; >Point : Symbol(Point, Decl(instantiatedModule.ts, 2, 10), Decl(instantiatedModule.ts, 4, 14)) @@ -56,10 +56,10 @@ module M2 { >Point : Symbol(Point, Decl(instantiatedModule.ts, 20, 11)) x: number; ->x : Symbol(x, Decl(instantiatedModule.ts, 21, 24)) +>x : Symbol(Point.x, Decl(instantiatedModule.ts, 21, 24)) y: number; ->y : Symbol(y, Decl(instantiatedModule.ts, 22, 18)) +>y : Symbol(Point.y, Decl(instantiatedModule.ts, 22, 18)) static Origin(): Point { >Origin : Symbol(Point.Origin, Decl(instantiatedModule.ts, 23, 18)) diff --git a/tests/baselines/reference/instantiatedReturnTypeContravariance.symbols b/tests/baselines/reference/instantiatedReturnTypeContravariance.symbols index f64ebfdce21..c43082200bf 100644 --- a/tests/baselines/reference/instantiatedReturnTypeContravariance.symbols +++ b/tests/baselines/reference/instantiatedReturnTypeContravariance.symbols @@ -4,10 +4,10 @@ interface B { >T : Symbol(T, Decl(instantiatedReturnTypeContravariance.ts, 0, 12)) name: string; ->name : Symbol(name, Decl(instantiatedReturnTypeContravariance.ts, 0, 16)) +>name : Symbol(B.name, Decl(instantiatedReturnTypeContravariance.ts, 0, 16)) x(): T; ->x : Symbol(x, Decl(instantiatedReturnTypeContravariance.ts, 2, 13)) +>x : Symbol(B.x, Decl(instantiatedReturnTypeContravariance.ts, 2, 13)) >T : Symbol(T, Decl(instantiatedReturnTypeContravariance.ts, 0, 12)) } @@ -16,7 +16,7 @@ class c { >c : Symbol(c, Decl(instantiatedReturnTypeContravariance.ts, 6, 1)) foo(): B { ->foo : Symbol(foo, Decl(instantiatedReturnTypeContravariance.ts, 8, 9)) +>foo : Symbol(c.foo, Decl(instantiatedReturnTypeContravariance.ts, 8, 9)) >B : Symbol(B, Decl(instantiatedReturnTypeContravariance.ts, 0, 0)) return null; @@ -30,7 +30,7 @@ class d extends c { >c : Symbol(c, Decl(instantiatedReturnTypeContravariance.ts, 6, 1)) foo(): B { ->foo : Symbol(foo, Decl(instantiatedReturnTypeContravariance.ts, 18, 19)) +>foo : Symbol(d.foo, Decl(instantiatedReturnTypeContravariance.ts, 18, 19)) >B : Symbol(B, Decl(instantiatedReturnTypeContravariance.ts, 0, 0)) return null; diff --git a/tests/baselines/reference/intTypeCheck.errors.txt b/tests/baselines/reference/intTypeCheck.errors.txt index 3d805a65822..0d19c6b2b6e 100644 --- a/tests/baselines/reference/intTypeCheck.errors.txt +++ b/tests/baselines/reference/intTypeCheck.errors.txt @@ -9,7 +9,6 @@ tests/cases/compiler/intTypeCheck.ts(101,5): error TS2322: Type 'Base' is not as tests/cases/compiler/intTypeCheck.ts(103,5): error TS2322: Type '() => void' is not assignable to type 'i1'. Property 'p' is missing in type '() => void'. tests/cases/compiler/intTypeCheck.ts(106,5): error TS2322: Type 'boolean' is not assignable to type 'i1'. - Property 'p' is missing in type 'Boolean'. tests/cases/compiler/intTypeCheck.ts(106,20): error TS1109: Expression expected. tests/cases/compiler/intTypeCheck.ts(106,21): error TS2304: Cannot find name 'i1'. tests/cases/compiler/intTypeCheck.ts(107,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. @@ -38,7 +37,6 @@ tests/cases/compiler/intTypeCheck.ts(134,22): error TS2304: Cannot find name 'i3 tests/cases/compiler/intTypeCheck.ts(135,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. tests/cases/compiler/intTypeCheck.ts(142,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. tests/cases/compiler/intTypeCheck.ts(148,5): error TS2322: Type 'boolean' is not assignable to type 'i4'. - Index signature is missing in type 'Boolean'. tests/cases/compiler/intTypeCheck.ts(148,21): error TS1109: Expression expected. tests/cases/compiler/intTypeCheck.ts(148,22): error TS2304: Cannot find name 'i4'. tests/cases/compiler/intTypeCheck.ts(149,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. @@ -52,7 +50,6 @@ tests/cases/compiler/intTypeCheck.ts(157,5): error TS2322: Type 'Base' is not as tests/cases/compiler/intTypeCheck.ts(159,5): error TS2322: Type '() => void' is not assignable to type 'i5'. Property 'p' is missing in type '() => void'. tests/cases/compiler/intTypeCheck.ts(162,5): error TS2322: Type 'boolean' is not assignable to type 'i5'. - Property 'p' is missing in type 'Boolean'. tests/cases/compiler/intTypeCheck.ts(162,21): error TS1109: Expression expected. tests/cases/compiler/intTypeCheck.ts(162,22): error TS2304: Cannot find name 'i5'. tests/cases/compiler/intTypeCheck.ts(163,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. @@ -73,7 +70,7 @@ tests/cases/compiler/intTypeCheck.ts(182,5): error TS2322: Type '{}' is not assi Type '{}' provides no match for the signature 'new (): any' tests/cases/compiler/intTypeCheck.ts(183,5): error TS2322: Type 'Object' is not assignable to type 'i7'. Type 'Object' provides no match for the signature 'new (): any' -tests/cases/compiler/intTypeCheck.ts(185,17): error TS2352: Neither type 'Base' nor type 'i7' is assignable to the other. +tests/cases/compiler/intTypeCheck.ts(185,17): error TS2352: Type 'Base' cannot be converted to type 'i7'. Type 'Base' provides no match for the signature 'new (): any' tests/cases/compiler/intTypeCheck.ts(187,5): error TS2322: Type '() => void' is not assignable to type 'i7'. Type '() => void' provides no match for the signature 'new (): any' @@ -83,7 +80,6 @@ tests/cases/compiler/intTypeCheck.ts(190,22): error TS2304: Cannot find name 'i7 tests/cases/compiler/intTypeCheck.ts(191,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. tests/cases/compiler/intTypeCheck.ts(198,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. tests/cases/compiler/intTypeCheck.ts(204,5): error TS2322: Type 'boolean' is not assignable to type 'i8'. - Index signature is missing in type 'Boolean'. tests/cases/compiler/intTypeCheck.ts(204,21): error TS1109: Expression expected. tests/cases/compiler/intTypeCheck.ts(204,22): error TS2304: Cannot find name 'i8'. tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. @@ -215,7 +211,6 @@ tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: Cannot use 'new' wit var obj9: i1 = new anyVar; ~~~~ !!! error TS2322: Type 'boolean' is not assignable to type 'i1'. -!!! error TS2322: Property 'p' is missing in type 'Boolean'. ~ !!! error TS1109: Expression expected. ~~ @@ -307,7 +302,6 @@ tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: Cannot use 'new' wit var obj42: i4 = new anyVar; ~~~~~ !!! error TS2322: Type 'boolean' is not assignable to type 'i4'. -!!! error TS2322: Index signature is missing in type 'Boolean'. ~ !!! error TS1109: Expression expected. ~~ @@ -344,7 +338,6 @@ tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: Cannot use 'new' wit var obj53: i5 = new anyVar; ~~~~~ !!! error TS2322: Type 'boolean' is not assignable to type 'i5'. -!!! error TS2322: Property 'p' is missing in type 'Boolean'. ~ !!! error TS1109: Expression expected. ~~ @@ -403,7 +396,7 @@ tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: Cannot use 'new' wit var obj69: i7 = new obj66; var obj70: i7 = new Base; ~~~~~~~~~~~~ -!!! error TS2352: Neither type 'Base' nor type 'i7' is assignable to the other. +!!! error TS2352: Type 'Base' cannot be converted to type 'i7'. !!! error TS2352: Type 'Base' provides no match for the signature 'new (): any' var obj71: i7 = null; var obj72: i7 = function () { }; @@ -439,7 +432,6 @@ tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: Cannot use 'new' wit var obj86: i8 = new anyVar; ~~~~~ !!! error TS2322: Type 'boolean' is not assignable to type 'i8'. -!!! error TS2322: Index signature is missing in type 'Boolean'. ~ !!! error TS1109: Expression expected. ~~ diff --git a/tests/baselines/reference/interMixingModulesInterfaces0.symbols b/tests/baselines/reference/interMixingModulesInterfaces0.symbols index 6b482053b2e..e16469da656 100644 --- a/tests/baselines/reference/interMixingModulesInterfaces0.symbols +++ b/tests/baselines/reference/interMixingModulesInterfaces0.symbols @@ -17,10 +17,10 @@ module A { >B : Symbol(B, Decl(interMixingModulesInterfaces0.ts, 0, 10), Decl(interMixingModulesInterfaces0.ts, 6, 5)) name: string; ->name : Symbol(name, Decl(interMixingModulesInterfaces0.ts, 8, 24)) +>name : Symbol(B.name, Decl(interMixingModulesInterfaces0.ts, 8, 24)) value: number; ->value : Symbol(value, Decl(interMixingModulesInterfaces0.ts, 9, 21)) +>value : Symbol(B.value, Decl(interMixingModulesInterfaces0.ts, 9, 21)) } } diff --git a/tests/baselines/reference/interMixingModulesInterfaces1.symbols b/tests/baselines/reference/interMixingModulesInterfaces1.symbols index 39162cf5a42..ffc583b1236 100644 --- a/tests/baselines/reference/interMixingModulesInterfaces1.symbols +++ b/tests/baselines/reference/interMixingModulesInterfaces1.symbols @@ -6,10 +6,10 @@ module A { >B : Symbol(B, Decl(interMixingModulesInterfaces1.ts, 0, 10), Decl(interMixingModulesInterfaces1.ts, 5, 5)) name: string; ->name : Symbol(name, Decl(interMixingModulesInterfaces1.ts, 2, 24)) +>name : Symbol(B.name, Decl(interMixingModulesInterfaces1.ts, 2, 24)) value: number; ->value : Symbol(value, Decl(interMixingModulesInterfaces1.ts, 3, 21)) +>value : Symbol(B.value, Decl(interMixingModulesInterfaces1.ts, 3, 21)) } export module B { diff --git a/tests/baselines/reference/interMixingModulesInterfaces2.symbols b/tests/baselines/reference/interMixingModulesInterfaces2.symbols index 0362909047a..10f0a0267af 100644 --- a/tests/baselines/reference/interMixingModulesInterfaces2.symbols +++ b/tests/baselines/reference/interMixingModulesInterfaces2.symbols @@ -6,10 +6,10 @@ module A { >B : Symbol(B, Decl(interMixingModulesInterfaces2.ts, 0, 10)) name: string; ->name : Symbol(name, Decl(interMixingModulesInterfaces2.ts, 2, 24)) +>name : Symbol(A.B.name, Decl(interMixingModulesInterfaces2.ts, 2, 24)) value: number; ->value : Symbol(value, Decl(interMixingModulesInterfaces2.ts, 3, 21)) +>value : Symbol(A.B.value, Decl(interMixingModulesInterfaces2.ts, 3, 21)) } module B { diff --git a/tests/baselines/reference/interMixingModulesInterfaces3.symbols b/tests/baselines/reference/interMixingModulesInterfaces3.symbols index 482cc883930..d66812c6f3d 100644 --- a/tests/baselines/reference/interMixingModulesInterfaces3.symbols +++ b/tests/baselines/reference/interMixingModulesInterfaces3.symbols @@ -17,10 +17,10 @@ module A { >B : Symbol(B, Decl(interMixingModulesInterfaces3.ts, 6, 5)) name: string; ->name : Symbol(name, Decl(interMixingModulesInterfaces3.ts, 8, 24)) +>name : Symbol(A.B.name, Decl(interMixingModulesInterfaces3.ts, 8, 24)) value: number; ->value : Symbol(value, Decl(interMixingModulesInterfaces3.ts, 9, 21)) +>value : Symbol(A.B.value, Decl(interMixingModulesInterfaces3.ts, 9, 21)) } } diff --git a/tests/baselines/reference/interMixingModulesInterfaces4.symbols b/tests/baselines/reference/interMixingModulesInterfaces4.symbols index 498b34c721f..d33db455162 100644 --- a/tests/baselines/reference/interMixingModulesInterfaces4.symbols +++ b/tests/baselines/reference/interMixingModulesInterfaces4.symbols @@ -16,10 +16,10 @@ module A { >B : Symbol(B, Decl(interMixingModulesInterfaces4.ts, 0, 10), Decl(interMixingModulesInterfaces4.ts, 6, 5)) name: string; ->name : Symbol(name, Decl(interMixingModulesInterfaces4.ts, 8, 17)) +>name : Symbol(B.name, Decl(interMixingModulesInterfaces4.ts, 8, 17)) value: number; ->value : Symbol(value, Decl(interMixingModulesInterfaces4.ts, 9, 21)) +>value : Symbol(B.value, Decl(interMixingModulesInterfaces4.ts, 9, 21)) } } diff --git a/tests/baselines/reference/interMixingModulesInterfaces5.symbols b/tests/baselines/reference/interMixingModulesInterfaces5.symbols index 7f45a62c858..17c3908961a 100644 --- a/tests/baselines/reference/interMixingModulesInterfaces5.symbols +++ b/tests/baselines/reference/interMixingModulesInterfaces5.symbols @@ -6,10 +6,10 @@ module A { >B : Symbol(B, Decl(interMixingModulesInterfaces5.ts, 0, 10), Decl(interMixingModulesInterfaces5.ts, 5, 5)) name: string; ->name : Symbol(name, Decl(interMixingModulesInterfaces5.ts, 2, 17)) +>name : Symbol(B.name, Decl(interMixingModulesInterfaces5.ts, 2, 17)) value: number; ->value : Symbol(value, Decl(interMixingModulesInterfaces5.ts, 3, 21)) +>value : Symbol(B.value, Decl(interMixingModulesInterfaces5.ts, 3, 21)) } export module B { diff --git a/tests/baselines/reference/interface0.symbols b/tests/baselines/reference/interface0.symbols index 25e12370916..d9020e16dc0 100644 --- a/tests/baselines/reference/interface0.symbols +++ b/tests/baselines/reference/interface0.symbols @@ -4,7 +4,7 @@ interface Generic { >T : Symbol(T, Decl(interface0.ts, 0, 18)) x: T; ->x : Symbol(x, Decl(interface0.ts, 0, 22)) +>x : Symbol(Generic.x, Decl(interface0.ts, 0, 22)) >T : Symbol(T, Decl(interface0.ts, 0, 18)) } diff --git a/tests/baselines/reference/interfaceAssignmentCompat.errors.txt b/tests/baselines/reference/interfaceAssignmentCompat.errors.txt index 237358b42de..df06eb1bd6c 100644 --- a/tests/baselines/reference/interfaceAssignmentCompat.errors.txt +++ b/tests/baselines/reference/interfaceAssignmentCompat.errors.txt @@ -1,10 +1,9 @@ tests/cases/compiler/interfaceAssignmentCompat.ts(32,18): error TS2345: Argument of type '(a: IFrenchEye, b: IFrenchEye) => number' is not assignable to parameter of type '(a: IEye, b: IEye) => number'. Types of parameters 'a' and 'a' are incompatible. - Type 'IFrenchEye' is not assignable to type 'IEye'. - Property 'color' is missing in type 'IFrenchEye'. + Type 'IEye' is not assignable to type 'IFrenchEye'. + Property 'coleur' is missing in type 'IEye'. tests/cases/compiler/interfaceAssignmentCompat.ts(37,29): error TS2339: Property '_map' does not exist on type 'typeof Color'. tests/cases/compiler/interfaceAssignmentCompat.ts(42,13): error TS2322: Type 'IEye' is not assignable to type 'IFrenchEye'. - Property 'coleur' is missing in type 'IEye'. tests/cases/compiler/interfaceAssignmentCompat.ts(44,9): error TS2322: Type 'IEye[]' is not assignable to type 'IFrenchEye[]'. Type 'IEye' is not assignable to type 'IFrenchEye'. @@ -45,8 +44,8 @@ tests/cases/compiler/interfaceAssignmentCompat.ts(44,9): error TS2322: Type 'IEy ~~~~~~~~~~~ !!! error TS2345: Argument of type '(a: IFrenchEye, b: IFrenchEye) => number' is not assignable to parameter of type '(a: IEye, b: IEye) => number'. !!! error TS2345: Types of parameters 'a' and 'a' are incompatible. -!!! error TS2345: Type 'IFrenchEye' is not assignable to type 'IEye'. -!!! error TS2345: Property 'color' is missing in type 'IFrenchEye'. +!!! error TS2345: Type 'IEye' is not assignable to type 'IFrenchEye'. +!!! error TS2345: Property 'coleur' is missing in type 'IEye'. // type of z inferred from specialized array type var z=x.sort(CompareEyes); // ok @@ -61,7 +60,6 @@ tests/cases/compiler/interfaceAssignmentCompat.ts(44,9): error TS2322: Type 'IEy eeks[j]=z[j]; // nope: element assignment ~~~~~~~ !!! error TS2322: Type 'IEye' is not assignable to type 'IFrenchEye'. -!!! error TS2322: Property 'coleur' is missing in type 'IEye'. } eeks=z; // nope: array assignment ~~~~ diff --git a/tests/baselines/reference/interfaceClassMerging.symbols b/tests/baselines/reference/interfaceClassMerging.symbols index eda94cedafd..566e341108f 100644 --- a/tests/baselines/reference/interfaceClassMerging.symbols +++ b/tests/baselines/reference/interfaceClassMerging.symbols @@ -3,34 +3,34 @@ interface Foo { >Foo : Symbol(Foo, Decl(interfaceClassMerging.ts, 0, 0), Decl(interfaceClassMerging.ts, 5, 1)) method(a: number): string; ->method : Symbol(method, Decl(interfaceClassMerging.ts, 0, 15)) +>method : Symbol(Foo.method, Decl(interfaceClassMerging.ts, 0, 15)) >a : Symbol(a, Decl(interfaceClassMerging.ts, 1, 11)) optionalMethod?(a: number): string; ->optionalMethod : Symbol(optionalMethod, Decl(interfaceClassMerging.ts, 1, 30)) +>optionalMethod : Symbol(Foo.optionalMethod, Decl(interfaceClassMerging.ts, 1, 30)) >a : Symbol(a, Decl(interfaceClassMerging.ts, 2, 20)) property: string; ->property : Symbol(property, Decl(interfaceClassMerging.ts, 2, 39)) +>property : Symbol(Foo.property, Decl(interfaceClassMerging.ts, 2, 39)) optionalProperty?: string; ->optionalProperty : Symbol(optionalProperty, Decl(interfaceClassMerging.ts, 3, 21)) +>optionalProperty : Symbol(Foo.optionalProperty, Decl(interfaceClassMerging.ts, 3, 21)) } class Foo { >Foo : Symbol(Foo, Decl(interfaceClassMerging.ts, 0, 0), Decl(interfaceClassMerging.ts, 5, 1)) additionalProperty: string; ->additionalProperty : Symbol(additionalProperty, Decl(interfaceClassMerging.ts, 7, 11)) +>additionalProperty : Symbol(Foo.additionalProperty, Decl(interfaceClassMerging.ts, 7, 11)) additionalMethod(a: number): string { ->additionalMethod : Symbol(additionalMethod, Decl(interfaceClassMerging.ts, 8, 31)) +>additionalMethod : Symbol(Foo.additionalMethod, Decl(interfaceClassMerging.ts, 8, 31)) >a : Symbol(a, Decl(interfaceClassMerging.ts, 10, 21)) return this.method(0); ->this.method : Symbol(method, Decl(interfaceClassMerging.ts, 0, 15)) +>this.method : Symbol(Foo.method, Decl(interfaceClassMerging.ts, 0, 15)) >this : Symbol(Foo, Decl(interfaceClassMerging.ts, 0, 0), Decl(interfaceClassMerging.ts, 5, 1)) ->method : Symbol(method, Decl(interfaceClassMerging.ts, 0, 15)) +>method : Symbol(Foo.method, Decl(interfaceClassMerging.ts, 0, 15)) } } @@ -39,7 +39,7 @@ class Bar extends Foo { >Foo : Symbol(Foo, Decl(interfaceClassMerging.ts, 0, 0), Decl(interfaceClassMerging.ts, 5, 1)) method(a: number) { ->method : Symbol(method, Decl(interfaceClassMerging.ts, 15, 23)) +>method : Symbol(Bar.method, Decl(interfaceClassMerging.ts, 15, 23)) >a : Symbol(a, Decl(interfaceClassMerging.ts, 16, 11)) return this.optionalProperty; diff --git a/tests/baselines/reference/interfaceClassMerging2.symbols b/tests/baselines/reference/interfaceClassMerging2.symbols index 290b49fdb3d..afd48131daf 100644 --- a/tests/baselines/reference/interfaceClassMerging2.symbols +++ b/tests/baselines/reference/interfaceClassMerging2.symbols @@ -3,20 +3,20 @@ interface Foo { >Foo : Symbol(Foo, Decl(interfaceClassMerging2.ts, 0, 0), Decl(interfaceClassMerging2.ts, 3, 1)) interfaceFooMethod(): this; ->interfaceFooMethod : Symbol(interfaceFooMethod, Decl(interfaceClassMerging2.ts, 0, 15)) +>interfaceFooMethod : Symbol(Foo.interfaceFooMethod, Decl(interfaceClassMerging2.ts, 0, 15)) interfaceFooProperty: this; ->interfaceFooProperty : Symbol(interfaceFooProperty, Decl(interfaceClassMerging2.ts, 1, 31)) +>interfaceFooProperty : Symbol(Foo.interfaceFooProperty, Decl(interfaceClassMerging2.ts, 1, 31)) } class Foo { >Foo : Symbol(Foo, Decl(interfaceClassMerging2.ts, 0, 0), Decl(interfaceClassMerging2.ts, 3, 1)) classFooProperty: this; ->classFooProperty : Symbol(classFooProperty, Decl(interfaceClassMerging2.ts, 5, 11)) +>classFooProperty : Symbol(Foo.classFooProperty, Decl(interfaceClassMerging2.ts, 5, 11)) classFooMethod(): this { ->classFooMethod : Symbol(classFooMethod, Decl(interfaceClassMerging2.ts, 6, 27)) +>classFooMethod : Symbol(Foo.classFooMethod, Decl(interfaceClassMerging2.ts, 6, 27)) return this; >this : Symbol(Foo, Decl(interfaceClassMerging2.ts, 0, 0), Decl(interfaceClassMerging2.ts, 3, 1)) @@ -28,10 +28,10 @@ interface Bar { >Bar : Symbol(Bar, Decl(interfaceClassMerging2.ts, 11, 1), Decl(interfaceClassMerging2.ts, 17, 1)) interfaceBarMethod(): this; ->interfaceBarMethod : Symbol(interfaceBarMethod, Decl(interfaceClassMerging2.ts, 14, 15)) +>interfaceBarMethod : Symbol(Bar.interfaceBarMethod, Decl(interfaceClassMerging2.ts, 14, 15)) interfaceBarProperty: this; ->interfaceBarProperty : Symbol(interfaceBarProperty, Decl(interfaceClassMerging2.ts, 15, 31)) +>interfaceBarProperty : Symbol(Bar.interfaceBarProperty, Decl(interfaceClassMerging2.ts, 15, 31)) } class Bar extends Foo { @@ -39,10 +39,10 @@ class Bar extends Foo { >Foo : Symbol(Foo, Decl(interfaceClassMerging2.ts, 0, 0), Decl(interfaceClassMerging2.ts, 3, 1)) classBarProperty: this; ->classBarProperty : Symbol(classBarProperty, Decl(interfaceClassMerging2.ts, 19, 23)) +>classBarProperty : Symbol(Bar.classBarProperty, Decl(interfaceClassMerging2.ts, 19, 23)) classBarMethod(): this { ->classBarMethod : Symbol(classBarMethod, Decl(interfaceClassMerging2.ts, 20, 27)) +>classBarMethod : Symbol(Bar.classBarMethod, Decl(interfaceClassMerging2.ts, 20, 27)) return this; >this : Symbol(Bar, Decl(interfaceClassMerging2.ts, 11, 1), Decl(interfaceClassMerging2.ts, 17, 1)) diff --git a/tests/baselines/reference/interfaceContextualType.symbols b/tests/baselines/reference/interfaceContextualType.symbols index 34831880431..9334740e133 100644 --- a/tests/baselines/reference/interfaceContextualType.symbols +++ b/tests/baselines/reference/interfaceContextualType.symbols @@ -3,10 +3,10 @@ export interface IOptions { >IOptions : Symbol(IOptions, Decl(interfaceContextualType.ts, 0, 0)) italic?: boolean; ->italic : Symbol(italic, Decl(interfaceContextualType.ts, 0, 27)) +>italic : Symbol(IOptions.italic, Decl(interfaceContextualType.ts, 0, 27)) bold?: boolean; ->bold : Symbol(bold, Decl(interfaceContextualType.ts, 1, 21)) +>bold : Symbol(IOptions.bold, Decl(interfaceContextualType.ts, 1, 21)) } export interface IMap { >IMap : Symbol(IMap, Decl(interfaceContextualType.ts, 3, 1)) @@ -20,30 +20,30 @@ class Bug { >Bug : Symbol(Bug, Decl(interfaceContextualType.ts, 6, 1)) public values: IMap; ->values : Symbol(values, Decl(interfaceContextualType.ts, 8, 11)) +>values : Symbol(Bug.values, Decl(interfaceContextualType.ts, 8, 11)) >IMap : Symbol(IMap, Decl(interfaceContextualType.ts, 3, 1)) ok() { ->ok : Symbol(ok, Decl(interfaceContextualType.ts, 9, 24)) +>ok : Symbol(Bug.ok, Decl(interfaceContextualType.ts, 9, 24)) this.values = {}; ->this.values : Symbol(values, Decl(interfaceContextualType.ts, 8, 11)) +>this.values : Symbol(Bug.values, Decl(interfaceContextualType.ts, 8, 11)) >this : Symbol(Bug, Decl(interfaceContextualType.ts, 6, 1)) ->values : Symbol(values, Decl(interfaceContextualType.ts, 8, 11)) +>values : Symbol(Bug.values, Decl(interfaceContextualType.ts, 8, 11)) this.values['comments'] = { italic: true }; ->this.values : Symbol(values, Decl(interfaceContextualType.ts, 8, 11)) +>this.values : Symbol(Bug.values, Decl(interfaceContextualType.ts, 8, 11)) >this : Symbol(Bug, Decl(interfaceContextualType.ts, 6, 1)) ->values : Symbol(values, Decl(interfaceContextualType.ts, 8, 11)) +>values : Symbol(Bug.values, Decl(interfaceContextualType.ts, 8, 11)) >italic : Symbol(italic, Decl(interfaceContextualType.ts, 12, 35)) } shouldBeOK() { ->shouldBeOK : Symbol(shouldBeOK, Decl(interfaceContextualType.ts, 13, 5)) +>shouldBeOK : Symbol(Bug.shouldBeOK, Decl(interfaceContextualType.ts, 13, 5)) this.values = { ->this.values : Symbol(values, Decl(interfaceContextualType.ts, 8, 11)) +>this.values : Symbol(Bug.values, Decl(interfaceContextualType.ts, 8, 11)) >this : Symbol(Bug, Decl(interfaceContextualType.ts, 6, 1)) ->values : Symbol(values, Decl(interfaceContextualType.ts, 8, 11)) +>values : Symbol(Bug.values, Decl(interfaceContextualType.ts, 8, 11)) comments: { italic: true } >comments : Symbol(comments, Decl(interfaceContextualType.ts, 15, 23)) diff --git a/tests/baselines/reference/interfaceContextualType.types b/tests/baselines/reference/interfaceContextualType.types index e827f9a9d9b..0e835a2f1f9 100644 --- a/tests/baselines/reference/interfaceContextualType.types +++ b/tests/baselines/reference/interfaceContextualType.types @@ -27,11 +27,11 @@ class Bug { >ok : () => void this.values = {}; ->this.values = {} : { [x: string]: undefined; } +>this.values = {} : {} >this.values : IMap >this : this >values : IMap ->{} : { [x: string]: undefined; } +>{} : {} this.values['comments'] = { italic: true }; >this.values['comments'] = { italic: true } : { italic: boolean; } @@ -48,11 +48,11 @@ class Bug { >shouldBeOK : () => void this.values = { ->this.values = { comments: { italic: true } } : { [x: string]: { italic: boolean; }; comments: { italic: boolean; }; } +>this.values = { comments: { italic: true } } : { comments: { italic: boolean; }; } >this.values : IMap >this : this >values : IMap ->{ comments: { italic: true } } : { [x: string]: { italic: boolean; }; comments: { italic: boolean; }; } +>{ comments: { italic: true } } : { comments: { italic: boolean; }; } comments: { italic: true } >comments : { italic: boolean; } diff --git a/tests/baselines/reference/interfaceDeclaration5.symbols b/tests/baselines/reference/interfaceDeclaration5.symbols index 3478a56693a..feccd58e0b5 100644 --- a/tests/baselines/reference/interfaceDeclaration5.symbols +++ b/tests/baselines/reference/interfaceDeclaration5.symbols @@ -1,7 +1,7 @@ === tests/cases/compiler/interfaceDeclaration5.ts === export interface I1 { item:string; } >I1 : Symbol(I1, Decl(interfaceDeclaration5.ts, 0, 0)) ->item : Symbol(item, Decl(interfaceDeclaration5.ts, 0, 21)) +>item : Symbol(I1.item, Decl(interfaceDeclaration5.ts, 0, 21)) export class C1 { } >C1 : Symbol(C1, Decl(interfaceDeclaration5.ts, 0, 36)) diff --git a/tests/baselines/reference/interfaceExtendingClassWithPrivates.errors.txt b/tests/baselines/reference/interfaceExtendingClassWithPrivates.errors.txt index d80df216c79..13e4c3b6e86 100644 --- a/tests/baselines/reference/interfaceExtendingClassWithPrivates.errors.txt +++ b/tests/baselines/reference/interfaceExtendingClassWithPrivates.errors.txt @@ -1,6 +1,6 @@ tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithPrivates.ts(5,11): error TS2430: Interface 'I' incorrectly extends interface 'Foo'. Property 'x' is private in type 'Foo' but not in type 'I'. -tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithPrivates.ts(15,10): error TS2341: Property 'x' is private and only accessible within class 'Foo'. +tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithPrivates.ts(15,12): error TS2341: Property 'x' is private and only accessible within class 'Foo'. ==== tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithPrivates.ts (2 errors) ==== @@ -22,5 +22,5 @@ tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtending var i: I2; var r = i.y; var r2 = i.x; // error - ~~~ + ~ !!! error TS2341: Property 'x' is private and only accessible within class 'Foo'. \ No newline at end of file diff --git a/tests/baselines/reference/interfaceExtendingClassWithPrivates2.errors.txt b/tests/baselines/reference/interfaceExtendingClassWithPrivates2.errors.txt index 7850c10fe26..ea0e50af058 100644 --- a/tests/baselines/reference/interfaceExtendingClassWithPrivates2.errors.txt +++ b/tests/baselines/reference/interfaceExtendingClassWithPrivates2.errors.txt @@ -4,8 +4,8 @@ tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtending Property 'x' is private in type 'Bar' but not in type 'I4'. tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithPrivates2.ts(12,11): error TS2430: Interface 'I4' incorrectly extends interface 'Foo'. Property 'x' is private in type 'Foo' but not in type 'I4'. -tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithPrivates2.ts(26,10): error TS2341: Property 'x' is private and only accessible within class 'Foo'. -tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithPrivates2.ts(27,10): error TS2341: Property 'y' is private and only accessible within class 'Baz'. +tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithPrivates2.ts(26,12): error TS2341: Property 'x' is private and only accessible within class 'Foo'. +tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithPrivates2.ts(27,12): error TS2341: Property 'y' is private and only accessible within class 'Baz'. ==== tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithPrivates2.ts (5 errors) ==== @@ -44,8 +44,8 @@ tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtending var i: I5; var r: string = i.z; var r2 = i.x; // error - ~~~ + ~ !!! error TS2341: Property 'x' is private and only accessible within class 'Foo'. var r3 = i.y; // error - ~~~ + ~ !!! error TS2341: Property 'y' is private and only accessible within class 'Baz'. \ No newline at end of file diff --git a/tests/baselines/reference/interfaceExtendingClassWithProtecteds.errors.txt b/tests/baselines/reference/interfaceExtendingClassWithProtecteds.errors.txt index 05651c92976..eb5eb371c01 100644 --- a/tests/baselines/reference/interfaceExtendingClassWithProtecteds.errors.txt +++ b/tests/baselines/reference/interfaceExtendingClassWithProtecteds.errors.txt @@ -1,6 +1,6 @@ tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithProtecteds.ts(5,11): error TS2430: Interface 'I' incorrectly extends interface 'Foo'. Property 'x' is protected but type 'I' is not a class derived from 'Foo'. -tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithProtecteds.ts(15,10): error TS2445: Property 'x' is protected and only accessible within class 'Foo' and its subclasses. +tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithProtecteds.ts(15,12): error TS2445: Property 'x' is protected and only accessible within class 'Foo' and its subclasses. ==== tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithProtecteds.ts (2 errors) ==== @@ -22,5 +22,5 @@ tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtending var i: I2; var r = i.y; var r2 = i.x; // error - ~~~ + ~ !!! error TS2445: Property 'x' is protected and only accessible within class 'Foo' and its subclasses. \ No newline at end of file diff --git a/tests/baselines/reference/interfaceExtendingClassWithProtecteds2.errors.txt b/tests/baselines/reference/interfaceExtendingClassWithProtecteds2.errors.txt index 48e3b7d7e6c..a957482362c 100644 --- a/tests/baselines/reference/interfaceExtendingClassWithProtecteds2.errors.txt +++ b/tests/baselines/reference/interfaceExtendingClassWithProtecteds2.errors.txt @@ -4,8 +4,8 @@ tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtending Property 'x' is protected but type 'I4' is not a class derived from 'Bar'. tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithProtecteds2.ts(12,11): error TS2430: Interface 'I4' incorrectly extends interface 'Foo'. Property 'x' is protected but type 'I4' is not a class derived from 'Foo'. -tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithProtecteds2.ts(26,10): error TS2445: Property 'x' is protected and only accessible within class 'Foo' and its subclasses. -tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithProtecteds2.ts(27,10): error TS2445: Property 'y' is protected and only accessible within class 'Baz' and its subclasses. +tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithProtecteds2.ts(26,12): error TS2445: Property 'x' is protected and only accessible within class 'Foo' and its subclasses. +tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithProtecteds2.ts(27,12): error TS2445: Property 'y' is protected and only accessible within class 'Baz' and its subclasses. ==== tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithProtecteds2.ts (5 errors) ==== @@ -44,8 +44,8 @@ tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtending var i: I5; var r: string = i.z; var r2 = i.x; // error - ~~~ + ~ !!! error TS2445: Property 'x' is protected and only accessible within class 'Foo' and its subclasses. var r3 = i.y; // error - ~~~ + ~ !!! error TS2445: Property 'y' is protected and only accessible within class 'Baz' and its subclasses. \ No newline at end of file diff --git a/tests/baselines/reference/interfaceExtendsClass1.symbols b/tests/baselines/reference/interfaceExtendsClass1.symbols index 6caa2013a25..5873419cc0b 100644 --- a/tests/baselines/reference/interfaceExtendsClass1.symbols +++ b/tests/baselines/reference/interfaceExtendsClass1.symbols @@ -3,28 +3,28 @@ class Control { >Control : Symbol(Control, Decl(interfaceExtendsClass1.ts, 0, 0)) private state: any; ->state : Symbol(state, Decl(interfaceExtendsClass1.ts, 0, 15)) +>state : Symbol(Control.state, Decl(interfaceExtendsClass1.ts, 0, 15)) } interface SelectableControl extends Control { >SelectableControl : Symbol(SelectableControl, Decl(interfaceExtendsClass1.ts, 2, 1)) >Control : Symbol(Control, Decl(interfaceExtendsClass1.ts, 0, 0)) select(): void; ->select : Symbol(select, Decl(interfaceExtendsClass1.ts, 3, 45)) +>select : Symbol(SelectableControl.select, Decl(interfaceExtendsClass1.ts, 3, 45)) } class Button extends Control { >Button : Symbol(Button, Decl(interfaceExtendsClass1.ts, 5, 1)) >Control : Symbol(Control, Decl(interfaceExtendsClass1.ts, 0, 0)) select() { } ->select : Symbol(select, Decl(interfaceExtendsClass1.ts, 6, 30)) +>select : Symbol(Button.select, Decl(interfaceExtendsClass1.ts, 6, 30)) } class TextBox extends Control { >TextBox : Symbol(TextBox, Decl(interfaceExtendsClass1.ts, 8, 1)) >Control : Symbol(Control, Decl(interfaceExtendsClass1.ts, 0, 0)) select() { } ->select : Symbol(select, Decl(interfaceExtendsClass1.ts, 9, 31)) +>select : Symbol(TextBox.select, Decl(interfaceExtendsClass1.ts, 9, 31)) } class Image extends Control { >Image : Symbol(Image, Decl(interfaceExtendsClass1.ts, 11, 1)) @@ -34,6 +34,6 @@ class Location { >Location : Symbol(Location, Decl(interfaceExtendsClass1.ts, 13, 1)) select() { } ->select : Symbol(select, Decl(interfaceExtendsClass1.ts, 14, 16)) +>select : Symbol(Location.select, Decl(interfaceExtendsClass1.ts, 14, 16)) } diff --git a/tests/baselines/reference/interfaceImplementation7.errors.txt b/tests/baselines/reference/interfaceImplementation7.errors.txt index b297015dfbe..1025a1f5296 100644 --- a/tests/baselines/reference/interfaceImplementation7.errors.txt +++ b/tests/baselines/reference/interfaceImplementation7.errors.txt @@ -4,7 +4,6 @@ tests/cases/compiler/interfaceImplementation7.ts(7,7): error TS2420: Class 'C1' Types of property 'name' are incompatible. Type '() => string' is not assignable to type '() => { s: string; n: number; }'. Type 'string' is not assignable to type '{ s: string; n: number; }'. - Property 's' is missing in type 'String'. ==== tests/cases/compiler/interfaceImplementation7.ts (2 errors) ==== @@ -23,7 +22,6 @@ tests/cases/compiler/interfaceImplementation7.ts(7,7): error TS2420: Class 'C1' !!! error TS2420: Types of property 'name' are incompatible. !!! error TS2420: Type '() => string' is not assignable to type '() => { s: string; n: number; }'. !!! error TS2420: Type 'string' is not assignable to type '{ s: string; n: number; }'. -!!! error TS2420: Property 's' is missing in type 'String'. public name(): string { return ""; } } \ No newline at end of file diff --git a/tests/baselines/reference/interfaceInReopenedModule.symbols b/tests/baselines/reference/interfaceInReopenedModule.symbols index 3cde824b451..0e4d2918a4f 100644 --- a/tests/baselines/reference/interfaceInReopenedModule.symbols +++ b/tests/baselines/reference/interfaceInReopenedModule.symbols @@ -14,7 +14,7 @@ module m { >n : Symbol(n, Decl(interfaceInReopenedModule.ts, 5, 18)) private n: f; ->n : Symbol(n, Decl(interfaceInReopenedModule.ts, 6, 20)) +>n : Symbol(n.n, Decl(interfaceInReopenedModule.ts, 6, 20)) >f : Symbol(f, Decl(interfaceInReopenedModule.ts, 4, 10)) } } diff --git a/tests/baselines/reference/interfaceOnly.symbols b/tests/baselines/reference/interfaceOnly.symbols index 70473ff3139..2de5dca6dfb 100644 --- a/tests/baselines/reference/interfaceOnly.symbols +++ b/tests/baselines/reference/interfaceOnly.symbols @@ -3,9 +3,9 @@ interface foo { >foo : Symbol(foo, Decl(interfaceOnly.ts, 0, 0)) foo(); ->foo : Symbol(foo, Decl(interfaceOnly.ts, 0, 15)) +>foo : Symbol(foo.foo, Decl(interfaceOnly.ts, 0, 15)) f2 (f: ()=> void); ->f2 : Symbol(f2, Decl(interfaceOnly.ts, 1, 10)) +>f2 : Symbol(foo.f2, Decl(interfaceOnly.ts, 1, 10)) >f : Symbol(f, Decl(interfaceOnly.ts, 2, 8)) } diff --git a/tests/baselines/reference/interfacePropertiesWithSameName1.symbols b/tests/baselines/reference/interfacePropertiesWithSameName1.symbols index aa002fa4af2..1948b1f244e 100644 --- a/tests/baselines/reference/interfacePropertiesWithSameName1.symbols +++ b/tests/baselines/reference/interfacePropertiesWithSameName1.symbols @@ -3,20 +3,20 @@ interface Mover { >Mover : Symbol(Mover, Decl(interfacePropertiesWithSameName1.ts, 0, 0)) move(): void; ->move : Symbol(move, Decl(interfacePropertiesWithSameName1.ts, 0, 17)) +>move : Symbol(Mover.move, Decl(interfacePropertiesWithSameName1.ts, 0, 17)) getStatus(): { speed: number; }; ->getStatus : Symbol(getStatus, Decl(interfacePropertiesWithSameName1.ts, 1, 17)) +>getStatus : Symbol(Mover.getStatus, Decl(interfacePropertiesWithSameName1.ts, 1, 17)) >speed : Symbol(speed, Decl(interfacePropertiesWithSameName1.ts, 2, 18)) } interface Shaker { >Shaker : Symbol(Shaker, Decl(interfacePropertiesWithSameName1.ts, 3, 1)) shake(): void; ->shake : Symbol(shake, Decl(interfacePropertiesWithSameName1.ts, 4, 18)) +>shake : Symbol(Shaker.shake, Decl(interfacePropertiesWithSameName1.ts, 4, 18)) getStatus(): { frequency: number; }; ->getStatus : Symbol(getStatus, Decl(interfacePropertiesWithSameName1.ts, 5, 18)) +>getStatus : Symbol(Shaker.getStatus, Decl(interfacePropertiesWithSameName1.ts, 5, 18)) >frequency : Symbol(frequency, Decl(interfacePropertiesWithSameName1.ts, 6, 18)) } @@ -26,7 +26,7 @@ interface MoverShaker extends Mover, Shaker { >Shaker : Symbol(Shaker, Decl(interfacePropertiesWithSameName1.ts, 3, 1)) getStatus(): { speed: number; frequency: number; }; ->getStatus : Symbol(getStatus, Decl(interfacePropertiesWithSameName1.ts, 9, 45)) +>getStatus : Symbol(MoverShaker.getStatus, Decl(interfacePropertiesWithSameName1.ts, 9, 45)) >speed : Symbol(speed, Decl(interfacePropertiesWithSameName1.ts, 10, 18)) >frequency : Symbol(frequency, Decl(interfacePropertiesWithSameName1.ts, 10, 33)) } diff --git a/tests/baselines/reference/interfaceSubtyping.symbols b/tests/baselines/reference/interfaceSubtyping.symbols index 6f77110885f..887f8e3d6b6 100644 --- a/tests/baselines/reference/interfaceSubtyping.symbols +++ b/tests/baselines/reference/interfaceSubtyping.symbols @@ -3,16 +3,16 @@ interface iface { >iface : Symbol(iface, Decl(interfaceSubtyping.ts, 0, 0)) foo(): void; ->foo : Symbol(foo, Decl(interfaceSubtyping.ts, 0, 17)) +>foo : Symbol(iface.foo, Decl(interfaceSubtyping.ts, 0, 17)) } class Camera implements iface{ >Camera : Symbol(Camera, Decl(interfaceSubtyping.ts, 2, 1)) >iface : Symbol(iface, Decl(interfaceSubtyping.ts, 0, 0)) constructor (public str: string) { ->str : Symbol(str, Decl(interfaceSubtyping.ts, 4, 17)) +>str : Symbol(Camera.str, Decl(interfaceSubtyping.ts, 4, 17)) } foo() { return "s"; } ->foo : Symbol(foo, Decl(interfaceSubtyping.ts, 5, 5)) +>foo : Symbol(Camera.foo, Decl(interfaceSubtyping.ts, 5, 5)) } diff --git a/tests/baselines/reference/interfaceThatHidesBaseProperty.symbols b/tests/baselines/reference/interfaceThatHidesBaseProperty.symbols index 2705aef2b27..d168a881990 100644 --- a/tests/baselines/reference/interfaceThatHidesBaseProperty.symbols +++ b/tests/baselines/reference/interfaceThatHidesBaseProperty.symbols @@ -3,7 +3,7 @@ interface Base { >Base : Symbol(Base, Decl(interfaceThatHidesBaseProperty.ts, 0, 0)) x: { a: number }; ->x : Symbol(x, Decl(interfaceThatHidesBaseProperty.ts, 0, 16)) +>x : Symbol(Base.x, Decl(interfaceThatHidesBaseProperty.ts, 0, 16)) >a : Symbol(a, Decl(interfaceThatHidesBaseProperty.ts, 1, 8)) } @@ -12,7 +12,7 @@ interface Derived extends Base { >Base : Symbol(Base, Decl(interfaceThatHidesBaseProperty.ts, 0, 0)) x: { ->x : Symbol(x, Decl(interfaceThatHidesBaseProperty.ts, 4, 32)) +>x : Symbol(Derived.x, Decl(interfaceThatHidesBaseProperty.ts, 4, 32)) a: number; b: number; >a : Symbol(a, Decl(interfaceThatHidesBaseProperty.ts, 5, 8)) diff --git a/tests/baselines/reference/interfaceWithAccessibilityModifiers.errors.txt b/tests/baselines/reference/interfaceWithAccessibilityModifiers.errors.txt index ecf803d522b..1c6f8f1939d 100644 --- a/tests/baselines/reference/interfaceWithAccessibilityModifiers.errors.txt +++ b/tests/baselines/reference/interfaceWithAccessibilityModifiers.errors.txt @@ -1,6 +1,6 @@ -tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithAccessibilityModifiers.ts(3,5): error TS1131: Property or signature expected. -tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithAccessibilityModifiers.ts(4,5): error TS1131: Property or signature expected. -tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithAccessibilityModifiers.ts(5,5): error TS1131: Property or signature expected. +tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithAccessibilityModifiers.ts(3,5): error TS1070: 'public' modifier cannot appear on a type member. +tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithAccessibilityModifiers.ts(4,5): error TS1070: 'private' modifier cannot appear on a type member. +tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithAccessibilityModifiers.ts(5,5): error TS1070: 'protected' modifier cannot appear on a type member. ==== tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithAccessibilityModifiers.ts (3 errors) ==== @@ -8,11 +8,11 @@ tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithAccessibil interface Foo { public a: any; ~~~~~~ -!!! error TS1131: Property or signature expected. +!!! error TS1070: 'public' modifier cannot appear on a type member. private b: any; ~~~~~~~ -!!! error TS1131: Property or signature expected. +!!! error TS1070: 'private' modifier cannot appear on a type member. protected c: any; ~~~~~~~~~ -!!! error TS1131: Property or signature expected. +!!! error TS1070: 'protected' modifier cannot appear on a type member. } \ No newline at end of file diff --git a/tests/baselines/reference/interfaceWithCommaSeparators.symbols b/tests/baselines/reference/interfaceWithCommaSeparators.symbols index e96a8852d56..a2f76d1791b 100644 --- a/tests/baselines/reference/interfaceWithCommaSeparators.symbols +++ b/tests/baselines/reference/interfaceWithCommaSeparators.symbols @@ -6,6 +6,6 @@ var v: { bar(): void, baz } interface Foo { bar(): void, baz } >Foo : Symbol(Foo, Decl(interfaceWithCommaSeparators.ts, 0, 27)) ->bar : Symbol(bar, Decl(interfaceWithCommaSeparators.ts, 1, 15)) ->baz : Symbol(baz, Decl(interfaceWithCommaSeparators.ts, 1, 28)) +>bar : Symbol(Foo.bar, Decl(interfaceWithCommaSeparators.ts, 1, 15)) +>baz : Symbol(Foo.baz, Decl(interfaceWithCommaSeparators.ts, 1, 28)) diff --git a/tests/baselines/reference/interfaceWithMultipleDeclarations.errors.txt b/tests/baselines/reference/interfaceWithMultipleDeclarations.errors.txt index e4b37db8a7a..79d8b4a509a 100644 --- a/tests/baselines/reference/interfaceWithMultipleDeclarations.errors.txt +++ b/tests/baselines/reference/interfaceWithMultipleDeclarations.errors.txt @@ -1,14 +1,14 @@ -tests/cases/compiler/interfaceWithMultipleDeclarations.ts(3,11): error TS2428: All declarations of an interface must have identical type parameters. -tests/cases/compiler/interfaceWithMultipleDeclarations.ts(5,11): error TS2428: All declarations of an interface must have identical type parameters. -tests/cases/compiler/interfaceWithMultipleDeclarations.ts(7,11): error TS2428: All declarations of an interface must have identical type parameters. -tests/cases/compiler/interfaceWithMultipleDeclarations.ts(9,11): error TS2428: All declarations of an interface must have identical type parameters. -tests/cases/compiler/interfaceWithMultipleDeclarations.ts(11,11): error TS2428: All declarations of an interface must have identical type parameters. -tests/cases/compiler/interfaceWithMultipleDeclarations.ts(16,11): error TS2428: All declarations of an interface must have identical type parameters. -tests/cases/compiler/interfaceWithMultipleDeclarations.ts(18,11): error TS2428: All declarations of an interface must have identical type parameters. -tests/cases/compiler/interfaceWithMultipleDeclarations.ts(20,11): error TS2428: All declarations of an interface must have identical type parameters. -tests/cases/compiler/interfaceWithMultipleDeclarations.ts(22,11): error TS2428: All declarations of an interface must have identical type parameters. -tests/cases/compiler/interfaceWithMultipleDeclarations.ts(24,11): error TS2428: All declarations of an interface must have identical type parameters. -tests/cases/compiler/interfaceWithMultipleDeclarations.ts(29,11): error TS2428: All declarations of an interface must have identical type parameters. +tests/cases/compiler/interfaceWithMultipleDeclarations.ts(3,11): error TS2428: All declarations of 'I1' must have identical type parameters. +tests/cases/compiler/interfaceWithMultipleDeclarations.ts(5,11): error TS2428: All declarations of 'I1' must have identical type parameters. +tests/cases/compiler/interfaceWithMultipleDeclarations.ts(7,11): error TS2428: All declarations of 'I1' must have identical type parameters. +tests/cases/compiler/interfaceWithMultipleDeclarations.ts(9,11): error TS2428: All declarations of 'I1' must have identical type parameters. +tests/cases/compiler/interfaceWithMultipleDeclarations.ts(11,11): error TS2428: All declarations of 'I1' must have identical type parameters. +tests/cases/compiler/interfaceWithMultipleDeclarations.ts(16,11): error TS2428: All declarations of 'I2' must have identical type parameters. +tests/cases/compiler/interfaceWithMultipleDeclarations.ts(18,11): error TS2428: All declarations of 'I2' must have identical type parameters. +tests/cases/compiler/interfaceWithMultipleDeclarations.ts(20,11): error TS2428: All declarations of 'I2' must have identical type parameters. +tests/cases/compiler/interfaceWithMultipleDeclarations.ts(22,11): error TS2428: All declarations of 'I2' must have identical type parameters. +tests/cases/compiler/interfaceWithMultipleDeclarations.ts(24,11): error TS2428: All declarations of 'I2' must have identical type parameters. +tests/cases/compiler/interfaceWithMultipleDeclarations.ts(29,11): error TS2428: All declarations of 'I3' must have identical type parameters. ==== tests/cases/compiler/interfaceWithMultipleDeclarations.ts (11 errors) ==== @@ -16,53 +16,53 @@ tests/cases/compiler/interfaceWithMultipleDeclarations.ts(29,11): error TS2428: } interface I1 { // Name mismatch ~~ -!!! error TS2428: All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations of 'I1' must have identical type parameters. } interface I1 { // Length mismatch ~~ -!!! error TS2428: All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations of 'I1' must have identical type parameters. } interface I1 { // constraint present ~~ -!!! error TS2428: All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations of 'I1' must have identical type parameters. } interface I1 { // Length mismatch ~~ -!!! error TS2428: All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations of 'I1' must have identical type parameters. } interface I1 { // Length mismatch ~~ -!!! error TS2428: All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations of 'I1' must have identical type parameters. } interface I2 { } interface I2 string> { // constraint mismatch ~~ -!!! error TS2428: All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations of 'I2' must have identical type parameters. } interface I2 { // constraint absent ~~ -!!! error TS2428: All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations of 'I2' must have identical type parameters. } interface I2 { // name mismatch ~~ -!!! error TS2428: All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations of 'I2' must have identical type parameters. } interface I2 { // length mismatch ~~ -!!! error TS2428: All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations of 'I2' must have identical type parameters. } interface I2 { // length mismatch ~~ -!!! error TS2428: All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations of 'I2' must have identical type parameters. } interface I3 { } interface I3 { // length mismatch ~~ -!!! error TS2428: All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations of 'I3' must have identical type parameters. } class Foo { diff --git a/tests/baselines/reference/interfaceWithOptionalProperty.symbols b/tests/baselines/reference/interfaceWithOptionalProperty.symbols index 262b3f01ccc..90e5b666693 100644 --- a/tests/baselines/reference/interfaceWithOptionalProperty.symbols +++ b/tests/baselines/reference/interfaceWithOptionalProperty.symbols @@ -4,5 +4,5 @@ interface I { >I : Symbol(I, Decl(interfaceWithOptionalProperty.ts, 0, 0)) x?: number; ->x : Symbol(x, Decl(interfaceWithOptionalProperty.ts, 1, 13)) +>x : Symbol(I.x, Decl(interfaceWithOptionalProperty.ts, 1, 13)) } diff --git a/tests/baselines/reference/interfaceWithPrivateMember.errors.txt b/tests/baselines/reference/interfaceWithPrivateMember.errors.txt index dc1cfeabed5..ecbd9ec293c 100644 --- a/tests/baselines/reference/interfaceWithPrivateMember.errors.txt +++ b/tests/baselines/reference/interfaceWithPrivateMember.errors.txt @@ -1,32 +1,26 @@ -tests/cases/conformance/types/namedTypes/interfaceWithPrivateMember.ts(5,5): error TS1131: Property or signature expected. -tests/cases/conformance/types/namedTypes/interfaceWithPrivateMember.ts(9,5): error TS1131: Property or signature expected. -tests/cases/conformance/types/namedTypes/interfaceWithPrivateMember.ts(13,5): error TS1131: Property or signature expected. -tests/cases/conformance/types/namedTypes/interfaceWithPrivateMember.ts(13,16): error TS2304: Cannot find name 'string'. -tests/cases/conformance/types/namedTypes/interfaceWithPrivateMember.ts(14,1): error TS1128: Declaration or statement expected. +tests/cases/conformance/types/namedTypes/interfaceWithPrivateMember.ts(5,5): error TS1070: 'private' modifier cannot appear on a type member. +tests/cases/conformance/types/namedTypes/interfaceWithPrivateMember.ts(9,5): error TS1070: 'private' modifier cannot appear on a type member. +tests/cases/conformance/types/namedTypes/interfaceWithPrivateMember.ts(13,5): error TS1070: 'private' modifier cannot appear on a type member. -==== tests/cases/conformance/types/namedTypes/interfaceWithPrivateMember.ts (5 errors) ==== +==== tests/cases/conformance/types/namedTypes/interfaceWithPrivateMember.ts (3 errors) ==== // interfaces do not permit private members, these are errors interface I { private x: string; ~~~~~~~ -!!! error TS1131: Property or signature expected. +!!! error TS1070: 'private' modifier cannot appear on a type member. } interface I2 { private y: T; ~~~~~~~ -!!! error TS1131: Property or signature expected. +!!! error TS1070: 'private' modifier cannot appear on a type member. } var x: { private y: string; ~~~~~~~ -!!! error TS1131: Property or signature expected. - ~~~~~~ -!!! error TS2304: Cannot find name 'string'. - } - ~ -!!! error TS1128: Declaration or statement expected. \ No newline at end of file +!!! error TS1070: 'private' modifier cannot appear on a type member. + } \ No newline at end of file diff --git a/tests/baselines/reference/interfaceWithPrivateMember.js b/tests/baselines/reference/interfaceWithPrivateMember.js index ceb388b1eae..d59037cf058 100644 --- a/tests/baselines/reference/interfaceWithPrivateMember.js +++ b/tests/baselines/reference/interfaceWithPrivateMember.js @@ -17,4 +17,3 @@ var x: { //// [interfaceWithPrivateMember.js] // interfaces do not permit private members, these are errors var x; -y: string; diff --git a/tests/baselines/reference/interfaceWithPropertyOfEveryType.symbols b/tests/baselines/reference/interfaceWithPropertyOfEveryType.symbols index f248bba02f0..46b0edd378b 100644 --- a/tests/baselines/reference/interfaceWithPropertyOfEveryType.symbols +++ b/tests/baselines/reference/interfaceWithPropertyOfEveryType.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithPropertyOfEveryType.ts === class C { foo: string; } >C : Symbol(C, Decl(interfaceWithPropertyOfEveryType.ts, 0, 0)) ->foo : Symbol(foo, Decl(interfaceWithPropertyOfEveryType.ts, 0, 9)) +>foo : Symbol(C.foo, Decl(interfaceWithPropertyOfEveryType.ts, 0, 9)) function f1() { } >f1 : Symbol(f1, Decl(interfaceWithPropertyOfEveryType.ts, 0, 24)) @@ -20,59 +20,59 @@ interface Foo { >Foo : Symbol(Foo, Decl(interfaceWithPropertyOfEveryType.ts, 5, 12)) a: number; ->a : Symbol(a, Decl(interfaceWithPropertyOfEveryType.ts, 7, 15)) +>a : Symbol(Foo.a, Decl(interfaceWithPropertyOfEveryType.ts, 7, 15)) b: string; ->b : Symbol(b, Decl(interfaceWithPropertyOfEveryType.ts, 8, 14)) +>b : Symbol(Foo.b, Decl(interfaceWithPropertyOfEveryType.ts, 8, 14)) c: boolean; ->c : Symbol(c, Decl(interfaceWithPropertyOfEveryType.ts, 9, 14)) +>c : Symbol(Foo.c, Decl(interfaceWithPropertyOfEveryType.ts, 9, 14)) d: any; ->d : Symbol(d, Decl(interfaceWithPropertyOfEveryType.ts, 10, 15)) +>d : Symbol(Foo.d, Decl(interfaceWithPropertyOfEveryType.ts, 10, 15)) e: void; ->e : Symbol(e, Decl(interfaceWithPropertyOfEveryType.ts, 11, 11)) +>e : Symbol(Foo.e, Decl(interfaceWithPropertyOfEveryType.ts, 11, 11)) f: number[]; ->f : Symbol(f, Decl(interfaceWithPropertyOfEveryType.ts, 12, 12)) +>f : Symbol(Foo.f, Decl(interfaceWithPropertyOfEveryType.ts, 12, 12)) g: Object; ->g : Symbol(g, Decl(interfaceWithPropertyOfEveryType.ts, 13, 16)) +>g : Symbol(Foo.g, Decl(interfaceWithPropertyOfEveryType.ts, 13, 16)) >Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) h: (x: number) => number; ->h : Symbol(h, Decl(interfaceWithPropertyOfEveryType.ts, 14, 14)) +>h : Symbol(Foo.h, Decl(interfaceWithPropertyOfEveryType.ts, 14, 14)) >x : Symbol(x, Decl(interfaceWithPropertyOfEveryType.ts, 15, 8)) i: (x: T) => T; ->i : Symbol(i, Decl(interfaceWithPropertyOfEveryType.ts, 15, 29)) +>i : Symbol(Foo.i, Decl(interfaceWithPropertyOfEveryType.ts, 15, 29)) >T : Symbol(T, Decl(interfaceWithPropertyOfEveryType.ts, 16, 8)) >x : Symbol(x, Decl(interfaceWithPropertyOfEveryType.ts, 16, 11)) >T : Symbol(T, Decl(interfaceWithPropertyOfEveryType.ts, 16, 8)) >T : Symbol(T, Decl(interfaceWithPropertyOfEveryType.ts, 16, 8)) j: Foo; ->j : Symbol(j, Decl(interfaceWithPropertyOfEveryType.ts, 16, 22)) +>j : Symbol(Foo.j, Decl(interfaceWithPropertyOfEveryType.ts, 16, 22)) >Foo : Symbol(Foo, Decl(interfaceWithPropertyOfEveryType.ts, 5, 12)) k: C; ->k : Symbol(k, Decl(interfaceWithPropertyOfEveryType.ts, 17, 11)) +>k : Symbol(Foo.k, Decl(interfaceWithPropertyOfEveryType.ts, 17, 11)) >C : Symbol(C, Decl(interfaceWithPropertyOfEveryType.ts, 0, 0)) l: typeof f1; ->l : Symbol(l, Decl(interfaceWithPropertyOfEveryType.ts, 18, 9)) +>l : Symbol(Foo.l, Decl(interfaceWithPropertyOfEveryType.ts, 18, 9)) >f1 : Symbol(f1, Decl(interfaceWithPropertyOfEveryType.ts, 0, 24)) m: typeof M; ->m : Symbol(m, Decl(interfaceWithPropertyOfEveryType.ts, 19, 17)) +>m : Symbol(Foo.m, Decl(interfaceWithPropertyOfEveryType.ts, 19, 17)) >M : Symbol(M, Decl(interfaceWithPropertyOfEveryType.ts, 1, 17)) n: {}; ->n : Symbol(n, Decl(interfaceWithPropertyOfEveryType.ts, 20, 16)) +>n : Symbol(Foo.n, Decl(interfaceWithPropertyOfEveryType.ts, 20, 16)) o: E; ->o : Symbol(o, Decl(interfaceWithPropertyOfEveryType.ts, 21, 10)) +>o : Symbol(Foo.o, Decl(interfaceWithPropertyOfEveryType.ts, 21, 10)) >E : Symbol(E, Decl(interfaceWithPropertyOfEveryType.ts, 4, 1)) } diff --git a/tests/baselines/reference/interfacedecl.symbols b/tests/baselines/reference/interfacedecl.symbols index eb9cce5f1fd..48a89a94129 100644 --- a/tests/baselines/reference/interfacedecl.symbols +++ b/tests/baselines/reference/interfacedecl.symbols @@ -19,33 +19,33 @@ interface a0 { >s : Symbol(s, Decl(interfacedecl.ts, 8, 5)) p1; ->p1 : Symbol(p1, Decl(interfacedecl.ts, 8, 21)) +>p1 : Symbol(a0.p1, Decl(interfacedecl.ts, 8, 21)) p2: string; ->p2 : Symbol(p2, Decl(interfacedecl.ts, 10, 7)) +>p2 : Symbol(a0.p2, Decl(interfacedecl.ts, 10, 7)) p3?; ->p3 : Symbol(p3, Decl(interfacedecl.ts, 11, 15)) +>p3 : Symbol(a0.p3, Decl(interfacedecl.ts, 11, 15)) p4?: number; ->p4 : Symbol(p4, Decl(interfacedecl.ts, 12, 8)) +>p4 : Symbol(a0.p4, Decl(interfacedecl.ts, 12, 8)) p5: (s: number) =>string; ->p5 : Symbol(p5, Decl(interfacedecl.ts, 13, 16)) +>p5 : Symbol(a0.p5, Decl(interfacedecl.ts, 13, 16)) >s : Symbol(s, Decl(interfacedecl.ts, 14, 9)) f1(); ->f1 : Symbol(f1, Decl(interfacedecl.ts, 14, 29)) +>f1 : Symbol(a0.f1, Decl(interfacedecl.ts, 14, 29)) f2? (); ->f2 : Symbol(f2, Decl(interfacedecl.ts, 16, 9)) +>f2 : Symbol(a0.f2, Decl(interfacedecl.ts, 16, 9)) f3(a: string): number; ->f3 : Symbol(f3, Decl(interfacedecl.ts, 17, 11)) +>f3 : Symbol(a0.f3, Decl(interfacedecl.ts, 17, 11)) >a : Symbol(a, Decl(interfacedecl.ts, 18, 7)) f4? (s: number): string; ->f4 : Symbol(f4, Decl(interfacedecl.ts, 18, 26)) +>f4 : Symbol(a0.f4, Decl(interfacedecl.ts, 18, 26)) >s : Symbol(s, Decl(interfacedecl.ts, 19, 9)) } diff --git a/tests/baselines/reference/internalAliasClassInsideLocalModuleWithExport.symbols b/tests/baselines/reference/internalAliasClassInsideLocalModuleWithExport.symbols index f3a796cf66c..85c5c72cfe1 100644 --- a/tests/baselines/reference/internalAliasClassInsideLocalModuleWithExport.symbols +++ b/tests/baselines/reference/internalAliasClassInsideLocalModuleWithExport.symbols @@ -6,7 +6,7 @@ export module x { >c : Symbol(c, Decl(internalAliasClassInsideLocalModuleWithExport.ts, 0, 17)) foo(a: number) { ->foo : Symbol(foo, Decl(internalAliasClassInsideLocalModuleWithExport.ts, 1, 20)) +>foo : Symbol(c.foo, Decl(internalAliasClassInsideLocalModuleWithExport.ts, 1, 20)) >a : Symbol(a, Decl(internalAliasClassInsideLocalModuleWithExport.ts, 2, 12)) return a; diff --git a/tests/baselines/reference/internalAliasClassInsideLocalModuleWithoutExport.symbols b/tests/baselines/reference/internalAliasClassInsideLocalModuleWithoutExport.symbols index 5c1d8b16afc..1df4c67b78e 100644 --- a/tests/baselines/reference/internalAliasClassInsideLocalModuleWithoutExport.symbols +++ b/tests/baselines/reference/internalAliasClassInsideLocalModuleWithoutExport.symbols @@ -6,7 +6,7 @@ export module x { >c : Symbol(c, Decl(internalAliasClassInsideLocalModuleWithoutExport.ts, 0, 17)) foo(a: number) { ->foo : Symbol(foo, Decl(internalAliasClassInsideLocalModuleWithoutExport.ts, 1, 20)) +>foo : Symbol(c.foo, Decl(internalAliasClassInsideLocalModuleWithoutExport.ts, 1, 20)) >a : Symbol(a, Decl(internalAliasClassInsideLocalModuleWithoutExport.ts, 2, 12)) return a; diff --git a/tests/baselines/reference/internalAliasClassInsideTopLevelModuleWithExport.symbols b/tests/baselines/reference/internalAliasClassInsideTopLevelModuleWithExport.symbols index 1b4d44307e3..b3c0bc487c5 100644 --- a/tests/baselines/reference/internalAliasClassInsideTopLevelModuleWithExport.symbols +++ b/tests/baselines/reference/internalAliasClassInsideTopLevelModuleWithExport.symbols @@ -6,7 +6,7 @@ export module x { >c : Symbol(c, Decl(internalAliasClassInsideTopLevelModuleWithExport.ts, 0, 17)) foo(a: number) { ->foo : Symbol(foo, Decl(internalAliasClassInsideTopLevelModuleWithExport.ts, 1, 20)) +>foo : Symbol(c.foo, Decl(internalAliasClassInsideTopLevelModuleWithExport.ts, 1, 20)) >a : Symbol(a, Decl(internalAliasClassInsideTopLevelModuleWithExport.ts, 2, 12)) return a; diff --git a/tests/baselines/reference/internalAliasClassInsideTopLevelModuleWithoutExport.symbols b/tests/baselines/reference/internalAliasClassInsideTopLevelModuleWithoutExport.symbols index b4e720cec94..08112614a57 100644 --- a/tests/baselines/reference/internalAliasClassInsideTopLevelModuleWithoutExport.symbols +++ b/tests/baselines/reference/internalAliasClassInsideTopLevelModuleWithoutExport.symbols @@ -6,7 +6,7 @@ export module x { >c : Symbol(c, Decl(internalAliasClassInsideTopLevelModuleWithoutExport.ts, 0, 17)) foo(a: number) { ->foo : Symbol(foo, Decl(internalAliasClassInsideTopLevelModuleWithoutExport.ts, 1, 20)) +>foo : Symbol(c.foo, Decl(internalAliasClassInsideTopLevelModuleWithoutExport.ts, 1, 20)) >a : Symbol(a, Decl(internalAliasClassInsideTopLevelModuleWithoutExport.ts, 2, 12)) return a; diff --git a/tests/baselines/reference/internalAliasUninitializedModule.symbols b/tests/baselines/reference/internalAliasUninitializedModule.symbols index 95af5c5699d..bdb777461a6 100644 --- a/tests/baselines/reference/internalAliasUninitializedModule.symbols +++ b/tests/baselines/reference/internalAliasUninitializedModule.symbols @@ -9,7 +9,7 @@ module a { >I : Symbol(I, Decl(internalAliasUninitializedModule.ts, 1, 21)) foo(); ->foo : Symbol(foo, Decl(internalAliasUninitializedModule.ts, 2, 28)) +>foo : Symbol(I.foo, Decl(internalAliasUninitializedModule.ts, 2, 28)) } } } diff --git a/tests/baselines/reference/internalAliasUninitializedModuleInsideLocalModuleWithExport.symbols b/tests/baselines/reference/internalAliasUninitializedModuleInsideLocalModuleWithExport.symbols index 861859ce2ea..3050a92eaad 100644 --- a/tests/baselines/reference/internalAliasUninitializedModuleInsideLocalModuleWithExport.symbols +++ b/tests/baselines/reference/internalAliasUninitializedModuleInsideLocalModuleWithExport.symbols @@ -9,7 +9,7 @@ export module a { >I : Symbol(I, Decl(internalAliasUninitializedModuleInsideLocalModuleWithExport.ts, 1, 21)) foo(); ->foo : Symbol(foo, Decl(internalAliasUninitializedModuleInsideLocalModuleWithExport.ts, 2, 28)) +>foo : Symbol(I.foo, Decl(internalAliasUninitializedModuleInsideLocalModuleWithExport.ts, 2, 28)) } } } diff --git a/tests/baselines/reference/internalAliasUninitializedModuleInsideLocalModuleWithoutExport.symbols b/tests/baselines/reference/internalAliasUninitializedModuleInsideLocalModuleWithoutExport.symbols index 433426c9fd9..f1e7ecaa8b5 100644 --- a/tests/baselines/reference/internalAliasUninitializedModuleInsideLocalModuleWithoutExport.symbols +++ b/tests/baselines/reference/internalAliasUninitializedModuleInsideLocalModuleWithoutExport.symbols @@ -9,7 +9,7 @@ export module a { >I : Symbol(I, Decl(internalAliasUninitializedModuleInsideLocalModuleWithoutExport.ts, 1, 21)) foo(); ->foo : Symbol(foo, Decl(internalAliasUninitializedModuleInsideLocalModuleWithoutExport.ts, 2, 28)) +>foo : Symbol(I.foo, Decl(internalAliasUninitializedModuleInsideLocalModuleWithoutExport.ts, 2, 28)) } } } diff --git a/tests/baselines/reference/internalAliasUninitializedModuleInsideTopLevelModuleWithExport.symbols b/tests/baselines/reference/internalAliasUninitializedModuleInsideTopLevelModuleWithExport.symbols index 14428deac43..5ecf784fccc 100644 --- a/tests/baselines/reference/internalAliasUninitializedModuleInsideTopLevelModuleWithExport.symbols +++ b/tests/baselines/reference/internalAliasUninitializedModuleInsideTopLevelModuleWithExport.symbols @@ -9,7 +9,7 @@ export module a { >I : Symbol(I, Decl(internalAliasUninitializedModuleInsideTopLevelModuleWithExport.ts, 1, 21)) foo(); ->foo : Symbol(foo, Decl(internalAliasUninitializedModuleInsideTopLevelModuleWithExport.ts, 2, 28)) +>foo : Symbol(I.foo, Decl(internalAliasUninitializedModuleInsideTopLevelModuleWithExport.ts, 2, 28)) } } } diff --git a/tests/baselines/reference/internalAliasUninitializedModuleInsideTopLevelModuleWithoutExport.symbols b/tests/baselines/reference/internalAliasUninitializedModuleInsideTopLevelModuleWithoutExport.symbols index cd17daeb023..aed4d7e7374 100644 --- a/tests/baselines/reference/internalAliasUninitializedModuleInsideTopLevelModuleWithoutExport.symbols +++ b/tests/baselines/reference/internalAliasUninitializedModuleInsideTopLevelModuleWithoutExport.symbols @@ -9,7 +9,7 @@ export module a { >I : Symbol(I, Decl(internalAliasUninitializedModuleInsideTopLevelModuleWithoutExport.ts, 1, 21)) foo(); ->foo : Symbol(foo, Decl(internalAliasUninitializedModuleInsideTopLevelModuleWithoutExport.ts, 2, 28)) +>foo : Symbol(I.foo, Decl(internalAliasUninitializedModuleInsideTopLevelModuleWithoutExport.ts, 2, 28)) } } } diff --git a/tests/baselines/reference/internalImportInstantiatedModuleMergedWithClassNotReferencingInstanceNoConflict.symbols b/tests/baselines/reference/internalImportInstantiatedModuleMergedWithClassNotReferencingInstanceNoConflict.symbols index e1098948fd6..81e07de2dfd 100644 --- a/tests/baselines/reference/internalImportInstantiatedModuleMergedWithClassNotReferencingInstanceNoConflict.symbols +++ b/tests/baselines/reference/internalImportInstantiatedModuleMergedWithClassNotReferencingInstanceNoConflict.symbols @@ -3,14 +3,14 @@ class A { >A : Symbol(A, Decl(internalImportInstantiatedModuleMergedWithClassNotReferencingInstanceNoConflict.ts, 0, 0), Decl(internalImportInstantiatedModuleMergedWithClassNotReferencingInstanceNoConflict.ts, 2, 1)) aProp: string; ->aProp : Symbol(aProp, Decl(internalImportInstantiatedModuleMergedWithClassNotReferencingInstanceNoConflict.ts, 0, 9)) +>aProp : Symbol(A.aProp, Decl(internalImportInstantiatedModuleMergedWithClassNotReferencingInstanceNoConflict.ts, 0, 9)) } module A { >A : Symbol(A, Decl(internalImportInstantiatedModuleMergedWithClassNotReferencingInstanceNoConflict.ts, 0, 0), Decl(internalImportInstantiatedModuleMergedWithClassNotReferencingInstanceNoConflict.ts, 2, 1)) export interface X { s: string } >X : Symbol(X, Decl(internalImportInstantiatedModuleMergedWithClassNotReferencingInstanceNoConflict.ts, 3, 10)) ->s : Symbol(s, Decl(internalImportInstantiatedModuleMergedWithClassNotReferencingInstanceNoConflict.ts, 4, 24)) +>s : Symbol(X.s, Decl(internalImportInstantiatedModuleMergedWithClassNotReferencingInstanceNoConflict.ts, 4, 24)) export var a = 10; >a : Symbol(a, Decl(internalImportInstantiatedModuleMergedWithClassNotReferencingInstanceNoConflict.ts, 5, 14)) diff --git a/tests/baselines/reference/internalImportUnInstantiatedModuleMergedWithClassNotReferencingInstanceNoConflict.symbols b/tests/baselines/reference/internalImportUnInstantiatedModuleMergedWithClassNotReferencingInstanceNoConflict.symbols index 5852777fe1c..2cf6a029bc8 100644 --- a/tests/baselines/reference/internalImportUnInstantiatedModuleMergedWithClassNotReferencingInstanceNoConflict.symbols +++ b/tests/baselines/reference/internalImportUnInstantiatedModuleMergedWithClassNotReferencingInstanceNoConflict.symbols @@ -3,14 +3,14 @@ class A { >A : Symbol(A, Decl(internalImportUnInstantiatedModuleMergedWithClassNotReferencingInstanceNoConflict.ts, 0, 0), Decl(internalImportUnInstantiatedModuleMergedWithClassNotReferencingInstanceNoConflict.ts, 2, 1)) aProp: string; ->aProp : Symbol(aProp, Decl(internalImportUnInstantiatedModuleMergedWithClassNotReferencingInstanceNoConflict.ts, 0, 9)) +>aProp : Symbol(A.aProp, Decl(internalImportUnInstantiatedModuleMergedWithClassNotReferencingInstanceNoConflict.ts, 0, 9)) } module A { >A : Symbol(A, Decl(internalImportUnInstantiatedModuleMergedWithClassNotReferencingInstanceNoConflict.ts, 0, 0), Decl(internalImportUnInstantiatedModuleMergedWithClassNotReferencingInstanceNoConflict.ts, 2, 1)) export interface X { s: string } >X : Symbol(X, Decl(internalImportUnInstantiatedModuleMergedWithClassNotReferencingInstanceNoConflict.ts, 3, 10)) ->s : Symbol(s, Decl(internalImportUnInstantiatedModuleMergedWithClassNotReferencingInstanceNoConflict.ts, 4, 24)) +>s : Symbol(X.s, Decl(internalImportUnInstantiatedModuleMergedWithClassNotReferencingInstanceNoConflict.ts, 4, 24)) } module B { diff --git a/tests/baselines/reference/internalImportUnInstantiatedModuleNotReferencingInstanceNoConflict.symbols b/tests/baselines/reference/internalImportUnInstantiatedModuleNotReferencingInstanceNoConflict.symbols index 06df9fbfa3f..0281e502026 100644 --- a/tests/baselines/reference/internalImportUnInstantiatedModuleNotReferencingInstanceNoConflict.symbols +++ b/tests/baselines/reference/internalImportUnInstantiatedModuleNotReferencingInstanceNoConflict.symbols @@ -4,7 +4,7 @@ module A { export interface X { s: string } >X : Symbol(X, Decl(internalImportUnInstantiatedModuleNotReferencingInstanceNoConflict.ts, 0, 10)) ->s : Symbol(s, Decl(internalImportUnInstantiatedModuleNotReferencingInstanceNoConflict.ts, 1, 24)) +>s : Symbol(X.s, Decl(internalImportUnInstantiatedModuleNotReferencingInstanceNoConflict.ts, 1, 24)) } module B { diff --git a/tests/baselines/reference/intersectionAndUnionTypes.errors.txt b/tests/baselines/reference/intersectionAndUnionTypes.errors.txt index 4f26cc63ba3..5a04d4f25d3 100644 --- a/tests/baselines/reference/intersectionAndUnionTypes.errors.txt +++ b/tests/baselines/reference/intersectionAndUnionTypes.errors.txt @@ -1,5 +1,6 @@ tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(19,1): error TS2322: Type 'A' is not assignable to type 'A & B'. Type 'A' is not assignable to type 'B'. + Property 'b' is missing in type 'A'. tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(20,1): error TS2322: Type 'B' is not assignable to type 'A & B'. Type 'B' is not assignable to type 'A'. Property 'a' is missing in type 'B'. @@ -7,50 +8,50 @@ tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(23,1): e Type 'A' is not assignable to type '(A & B) | (C & D)'. Type 'A' is not assignable to type 'C & D'. Type 'A' is not assignable to type 'C'. + Property 'c' is missing in type 'A'. tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(25,1): error TS2322: Type 'C | D' is not assignable to type '(A & B) | (C & D)'. Type 'C' is not assignable to type '(A & B) | (C & D)'. Type 'C' is not assignable to type 'C & D'. Type 'C' is not assignable to type 'D'. + Property 'd' is missing in type 'C'. tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(26,1): error TS2322: Type '(A & B) | (C & D)' is not assignable to type 'A & B'. Type 'C & D' is not assignable to type 'A & B'. Type 'C & D' is not assignable to type 'A'. - Type 'D' is not assignable to type 'A'. + Property 'a' is missing in type 'C & D'. tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(27,1): error TS2322: Type '(A & B) | (C & D)' is not assignable to type 'A | B'. Type 'C & D' is not assignable to type 'A | B'. Type 'C & D' is not assignable to type 'B'. - Type 'D' is not assignable to type 'B'. + Property 'b' is missing in type 'C & D'. tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(28,1): error TS2322: Type '(A & B) | (C & D)' is not assignable to type 'C & D'. Type 'A & B' is not assignable to type 'C & D'. Type 'A & B' is not assignable to type 'C'. - Type 'B' is not assignable to type 'C'. + Property 'c' is missing in type 'A & B'. tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(29,1): error TS2322: Type '(A & B) | (C & D)' is not assignable to type 'C | D'. Type 'A & B' is not assignable to type 'C | D'. Type 'A & B' is not assignable to type 'D'. - Type 'B' is not assignable to type 'D'. + Property 'd' is missing in type 'A & B'. tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(31,1): error TS2322: Type 'A & B' is not assignable to type '(A | B) & (C | D)'. Type 'A & B' is not assignable to type 'C | D'. Type 'A & B' is not assignable to type 'D'. - Type 'B' is not assignable to type 'D'. tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(32,1): error TS2322: Type 'A | B' is not assignable to type '(A | B) & (C | D)'. Type 'A' is not assignable to type '(A | B) & (C | D)'. Type 'A' is not assignable to type 'C | D'. Type 'A' is not assignable to type 'D'. + Property 'd' is missing in type 'A'. tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(33,1): error TS2322: Type 'C & D' is not assignable to type '(A | B) & (C | D)'. Type 'C & D' is not assignable to type 'A | B'. Type 'C & D' is not assignable to type 'B'. - Type 'D' is not assignable to type 'B'. tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(34,1): error TS2322: Type 'C | D' is not assignable to type '(A | B) & (C | D)'. Type 'C' is not assignable to type '(A | B) & (C | D)'. Type 'C' is not assignable to type 'A | B'. Type 'C' is not assignable to type 'B'. + Property 'b' is missing in type 'C'. tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(35,1): error TS2322: Type '(A | B) & (C | D)' is not assignable to type 'A & B'. Type '(A | B) & (C | D)' is not assignable to type 'A'. - Type 'C | D' is not assignable to type 'A'. - Type 'C' is not assignable to type 'A'. + Property 'a' is missing in type '(A | B) & (C | D)'. tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(37,1): error TS2322: Type '(A | B) & (C | D)' is not assignable to type 'C & D'. Type '(A | B) & (C | D)' is not assignable to type 'C'. - Type 'C | D' is not assignable to type 'C'. - Type 'D' is not assignable to type 'C'. + Property 'c' is missing in type '(A | B) & (C | D)'. ==== tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts (14 errors) ==== @@ -76,6 +77,7 @@ tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(37,1): e ~~~ !!! error TS2322: Type 'A' is not assignable to type 'A & B'. !!! error TS2322: Type 'A' is not assignable to type 'B'. +!!! error TS2322: Property 'b' is missing in type 'A'. anb = b; ~~~ !!! error TS2322: Type 'B' is not assignable to type 'A & B'. @@ -89,6 +91,7 @@ tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(37,1): e !!! error TS2322: Type 'A' is not assignable to type '(A & B) | (C & D)'. !!! error TS2322: Type 'A' is not assignable to type 'C & D'. !!! error TS2322: Type 'A' is not assignable to type 'C'. +!!! error TS2322: Property 'c' is missing in type 'A'. x = cnd; // Ok x = cod; ~ @@ -96,67 +99,66 @@ tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(37,1): e !!! error TS2322: Type 'C' is not assignable to type '(A & B) | (C & D)'. !!! error TS2322: Type 'C' is not assignable to type 'C & D'. !!! error TS2322: Type 'C' is not assignable to type 'D'. +!!! error TS2322: Property 'd' is missing in type 'C'. anb = x; ~~~ !!! error TS2322: Type '(A & B) | (C & D)' is not assignable to type 'A & B'. !!! error TS2322: Type 'C & D' is not assignable to type 'A & B'. !!! error TS2322: Type 'C & D' is not assignable to type 'A'. -!!! error TS2322: Type 'D' is not assignable to type 'A'. +!!! error TS2322: Property 'a' is missing in type 'C & D'. aob = x; ~~~ !!! error TS2322: Type '(A & B) | (C & D)' is not assignable to type 'A | B'. !!! error TS2322: Type 'C & D' is not assignable to type 'A | B'. !!! error TS2322: Type 'C & D' is not assignable to type 'B'. -!!! error TS2322: Type 'D' is not assignable to type 'B'. +!!! error TS2322: Property 'b' is missing in type 'C & D'. cnd = x; ~~~ !!! error TS2322: Type '(A & B) | (C & D)' is not assignable to type 'C & D'. !!! error TS2322: Type 'A & B' is not assignable to type 'C & D'. !!! error TS2322: Type 'A & B' is not assignable to type 'C'. -!!! error TS2322: Type 'B' is not assignable to type 'C'. +!!! error TS2322: Property 'c' is missing in type 'A & B'. cod = x; ~~~ !!! error TS2322: Type '(A & B) | (C & D)' is not assignable to type 'C | D'. !!! error TS2322: Type 'A & B' is not assignable to type 'C | D'. !!! error TS2322: Type 'A & B' is not assignable to type 'D'. -!!! error TS2322: Type 'B' is not assignable to type 'D'. +!!! error TS2322: Property 'd' is missing in type 'A & B'. y = anb; ~ !!! error TS2322: Type 'A & B' is not assignable to type '(A | B) & (C | D)'. !!! error TS2322: Type 'A & B' is not assignable to type 'C | D'. !!! error TS2322: Type 'A & B' is not assignable to type 'D'. -!!! error TS2322: Type 'B' is not assignable to type 'D'. y = aob; ~ !!! error TS2322: Type 'A | B' is not assignable to type '(A | B) & (C | D)'. !!! error TS2322: Type 'A' is not assignable to type '(A | B) & (C | D)'. !!! error TS2322: Type 'A' is not assignable to type 'C | D'. !!! error TS2322: Type 'A' is not assignable to type 'D'. +!!! error TS2322: Property 'd' is missing in type 'A'. y = cnd; ~ !!! error TS2322: Type 'C & D' is not assignable to type '(A | B) & (C | D)'. !!! error TS2322: Type 'C & D' is not assignable to type 'A | B'. !!! error TS2322: Type 'C & D' is not assignable to type 'B'. -!!! error TS2322: Type 'D' is not assignable to type 'B'. y = cod; ~ !!! error TS2322: Type 'C | D' is not assignable to type '(A | B) & (C | D)'. !!! error TS2322: Type 'C' is not assignable to type '(A | B) & (C | D)'. !!! error TS2322: Type 'C' is not assignable to type 'A | B'. !!! error TS2322: Type 'C' is not assignable to type 'B'. +!!! error TS2322: Property 'b' is missing in type 'C'. anb = y; ~~~ !!! error TS2322: Type '(A | B) & (C | D)' is not assignable to type 'A & B'. !!! error TS2322: Type '(A | B) & (C | D)' is not assignable to type 'A'. -!!! error TS2322: Type 'C | D' is not assignable to type 'A'. -!!! error TS2322: Type 'C' is not assignable to type 'A'. +!!! error TS2322: Property 'a' is missing in type '(A | B) & (C | D)'. aob = y; // Ok cnd = y; ~~~ !!! error TS2322: Type '(A | B) & (C | D)' is not assignable to type 'C & D'. !!! error TS2322: Type '(A | B) & (C | D)' is not assignable to type 'C'. -!!! error TS2322: Type 'C | D' is not assignable to type 'C'. -!!! error TS2322: Type 'D' is not assignable to type 'C'. +!!! error TS2322: Property 'c' is missing in type '(A | B) & (C | D)'. cod = y; // Ok \ No newline at end of file diff --git a/tests/baselines/reference/intersectionTypeEquivalence.symbols b/tests/baselines/reference/intersectionTypeEquivalence.symbols index 2bec452c44e..effcd2759e5 100644 --- a/tests/baselines/reference/intersectionTypeEquivalence.symbols +++ b/tests/baselines/reference/intersectionTypeEquivalence.symbols @@ -1,15 +1,15 @@ === tests/cases/conformance/types/intersection/intersectionTypeEquivalence.ts === interface A { a: string } >A : Symbol(A, Decl(intersectionTypeEquivalence.ts, 0, 0)) ->a : Symbol(a, Decl(intersectionTypeEquivalence.ts, 0, 13)) +>a : Symbol(A.a, Decl(intersectionTypeEquivalence.ts, 0, 13)) interface B { b: string } >B : Symbol(B, Decl(intersectionTypeEquivalence.ts, 0, 25)) ->b : Symbol(b, Decl(intersectionTypeEquivalence.ts, 1, 13)) +>b : Symbol(B.b, Decl(intersectionTypeEquivalence.ts, 1, 13)) interface C { c: string } >C : Symbol(C, Decl(intersectionTypeEquivalence.ts, 1, 25)) ->c : Symbol(c, Decl(intersectionTypeEquivalence.ts, 2, 13)) +>c : Symbol(C.c, Decl(intersectionTypeEquivalence.ts, 2, 13)) // A & B is equivalent to B & A. var y: A & B; diff --git a/tests/baselines/reference/intersectionTypeMembers.symbols b/tests/baselines/reference/intersectionTypeMembers.symbols index ebec69b4ebe..9ec66ef64b9 100644 --- a/tests/baselines/reference/intersectionTypeMembers.symbols +++ b/tests/baselines/reference/intersectionTypeMembers.symbols @@ -4,15 +4,15 @@ interface A { a: string } >A : Symbol(A, Decl(intersectionTypeMembers.ts, 0, 0)) ->a : Symbol(a, Decl(intersectionTypeMembers.ts, 3, 13)) +>a : Symbol(A.a, Decl(intersectionTypeMembers.ts, 3, 13)) interface B { b: string } >B : Symbol(B, Decl(intersectionTypeMembers.ts, 3, 25)) ->b : Symbol(b, Decl(intersectionTypeMembers.ts, 4, 13)) +>b : Symbol(B.b, Decl(intersectionTypeMembers.ts, 4, 13)) interface C { c: string } >C : Symbol(C, Decl(intersectionTypeMembers.ts, 4, 25)) ->c : Symbol(c, Decl(intersectionTypeMembers.ts, 5, 13)) +>c : Symbol(C.c, Decl(intersectionTypeMembers.ts, 5, 13)) var abc: A & B & C; >abc : Symbol(abc, Decl(intersectionTypeMembers.ts, 7, 3)) @@ -37,17 +37,17 @@ abc.c = "hello"; interface X { x: A } >X : Symbol(X, Decl(intersectionTypeMembers.ts, 10, 16)) ->x : Symbol(x, Decl(intersectionTypeMembers.ts, 12, 13)) +>x : Symbol(X.x, Decl(intersectionTypeMembers.ts, 12, 13)) >A : Symbol(A, Decl(intersectionTypeMembers.ts, 0, 0)) interface Y { x: B } >Y : Symbol(Y, Decl(intersectionTypeMembers.ts, 12, 20)) ->x : Symbol(x, Decl(intersectionTypeMembers.ts, 13, 13)) +>x : Symbol(Y.x, Decl(intersectionTypeMembers.ts, 13, 13)) >B : Symbol(B, Decl(intersectionTypeMembers.ts, 3, 25)) interface Z { x: C } >Z : Symbol(Z, Decl(intersectionTypeMembers.ts, 13, 20)) ->x : Symbol(x, Decl(intersectionTypeMembers.ts, 14, 13)) +>x : Symbol(Z.x, Decl(intersectionTypeMembers.ts, 14, 13)) >C : Symbol(C, Decl(intersectionTypeMembers.ts, 4, 25)) var xyz: X & Y & Z; diff --git a/tests/baselines/reference/invalidBooleanAssignments.errors.txt b/tests/baselines/reference/invalidBooleanAssignments.errors.txt index 84ced226113..99d32aff9bc 100644 --- a/tests/baselines/reference/invalidBooleanAssignments.errors.txt +++ b/tests/baselines/reference/invalidBooleanAssignments.errors.txt @@ -3,9 +3,7 @@ tests/cases/conformance/types/primitives/boolean/invalidBooleanAssignments.ts(4, tests/cases/conformance/types/primitives/boolean/invalidBooleanAssignments.ts(5,5): error TS2322: Type 'boolean' is not assignable to type 'void'. tests/cases/conformance/types/primitives/boolean/invalidBooleanAssignments.ts(9,5): error TS2322: Type 'boolean' is not assignable to type 'E'. tests/cases/conformance/types/primitives/boolean/invalidBooleanAssignments.ts(12,5): error TS2322: Type 'boolean' is not assignable to type 'C'. - Property 'foo' is missing in type 'Boolean'. tests/cases/conformance/types/primitives/boolean/invalidBooleanAssignments.ts(15,5): error TS2322: Type 'boolean' is not assignable to type 'I'. - Property 'bar' is missing in type 'Boolean'. tests/cases/conformance/types/primitives/boolean/invalidBooleanAssignments.ts(17,5): error TS2322: Type 'boolean' is not assignable to type '() => string'. tests/cases/conformance/types/primitives/boolean/invalidBooleanAssignments.ts(21,1): error TS2364: Invalid left-hand side of assignment expression. tests/cases/conformance/types/primitives/boolean/invalidBooleanAssignments.ts(24,5): error TS2322: Type 'boolean' is not assignable to type 'T'. @@ -35,13 +33,11 @@ tests/cases/conformance/types/primitives/boolean/invalidBooleanAssignments.ts(26 var f: C = x; ~ !!! error TS2322: Type 'boolean' is not assignable to type 'C'. -!!! error TS2322: Property 'foo' is missing in type 'Boolean'. interface I { bar: string } var g: I = x; ~ !!! error TS2322: Type 'boolean' is not assignable to type 'I'. -!!! error TS2322: Property 'bar' is missing in type 'Boolean'. var h: { (): string } = x; ~ diff --git a/tests/baselines/reference/invalidImportAliasIdentifiers.js b/tests/baselines/reference/invalidImportAliasIdentifiers.js index 312ce2ba3c2..b7b931fa494 100644 --- a/tests/baselines/reference/invalidImportAliasIdentifiers.js +++ b/tests/baselines/reference/invalidImportAliasIdentifiers.js @@ -27,13 +27,17 @@ import i = I; //// [invalidImportAliasIdentifiers.js] // none of these should work, since non are actually modules var V = 12; +var v = V; var C = (function () { function C() { } return C; }()); +var c = C; var E; (function (E) { E[E["Red"] = 0] = "Red"; E[E["Blue"] = 1] = "Blue"; })(E || (E = {})); +var e = E; +var i = I; diff --git a/tests/baselines/reference/invalidModuleWithStatementsOfEveryKind.errors.txt b/tests/baselines/reference/invalidModuleWithStatementsOfEveryKind.errors.txt index 101ee0124cc..797f3b1fe9a 100644 --- a/tests/baselines/reference/invalidModuleWithStatementsOfEveryKind.errors.txt +++ b/tests/baselines/reference/invalidModuleWithStatementsOfEveryKind.errors.txt @@ -1,24 +1,24 @@ -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(4,5): error TS1044: 'public' modifier cannot appear on a module element. -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(6,5): error TS1044: 'public' modifier cannot appear on a module element. -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(12,5): error TS1044: 'public' modifier cannot appear on a module element. -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(13,5): error TS1044: 'public' modifier cannot appear on a module element. -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(15,5): error TS1044: 'public' modifier cannot appear on a module element. -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(19,5): error TS1044: 'public' modifier cannot appear on a module element. -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(25,5): error TS1044: 'public' modifier cannot appear on a module element. -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(29,5): error TS1044: 'private' modifier cannot appear on a module element. -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(31,5): error TS1044: 'private' modifier cannot appear on a module element. -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(37,5): error TS1044: 'private' modifier cannot appear on a module element. -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(38,5): error TS1044: 'private' modifier cannot appear on a module element. -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(40,5): error TS1044: 'private' modifier cannot appear on a module element. -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(44,5): error TS1044: 'private' modifier cannot appear on a module element. -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(50,5): error TS1044: 'private' modifier cannot appear on a module element. -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(55,5): error TS1044: 'static' modifier cannot appear on a module element. -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(57,5): error TS1044: 'static' modifier cannot appear on a module element. -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(63,5): error TS1044: 'static' modifier cannot appear on a module element. -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(64,5): error TS1044: 'static' modifier cannot appear on a module element. -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(66,5): error TS1044: 'static' modifier cannot appear on a module element. -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(70,5): error TS1044: 'static' modifier cannot appear on a module element. -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(76,5): error TS1044: 'static' modifier cannot appear on a module element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(4,5): error TS1044: 'public' modifier cannot appear on a module or namespace element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(6,5): error TS1044: 'public' modifier cannot appear on a module or namespace element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(12,5): error TS1044: 'public' modifier cannot appear on a module or namespace element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(13,5): error TS1044: 'public' modifier cannot appear on a module or namespace element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(15,5): error TS1044: 'public' modifier cannot appear on a module or namespace element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(19,5): error TS1044: 'public' modifier cannot appear on a module or namespace element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(25,5): error TS1044: 'public' modifier cannot appear on a module or namespace element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(29,5): error TS1044: 'private' modifier cannot appear on a module or namespace element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(31,5): error TS1044: 'private' modifier cannot appear on a module or namespace element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(37,5): error TS1044: 'private' modifier cannot appear on a module or namespace element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(38,5): error TS1044: 'private' modifier cannot appear on a module or namespace element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(40,5): error TS1044: 'private' modifier cannot appear on a module or namespace element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(44,5): error TS1044: 'private' modifier cannot appear on a module or namespace element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(50,5): error TS1044: 'private' modifier cannot appear on a module or namespace element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(55,5): error TS1044: 'static' modifier cannot appear on a module or namespace element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(57,5): error TS1044: 'static' modifier cannot appear on a module or namespace element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(63,5): error TS1044: 'static' modifier cannot appear on a module or namespace element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(64,5): error TS1044: 'static' modifier cannot appear on a module or namespace element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(66,5): error TS1044: 'static' modifier cannot appear on a module or namespace element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(70,5): error TS1044: 'static' modifier cannot appear on a module or namespace element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(76,5): error TS1044: 'static' modifier cannot appear on a module or namespace element. ==== tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts (21 errors) ==== @@ -27,11 +27,11 @@ tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOf module Y { public class A { s: string } ~~~~~~ -!!! error TS1044: 'public' modifier cannot appear on a module element. +!!! error TS1044: 'public' modifier cannot appear on a module or namespace element. public class BB extends A { ~~~~~~ -!!! error TS1044: 'public' modifier cannot appear on a module element. +!!! error TS1044: 'public' modifier cannot appear on a module or namespace element. id: number; } } @@ -39,20 +39,20 @@ tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOf module Y2 { public class AA { s: T } ~~~~~~ -!!! error TS1044: 'public' modifier cannot appear on a module element. +!!! error TS1044: 'public' modifier cannot appear on a module or namespace element. public interface I { id: number } ~~~~~~ -!!! error TS1044: 'public' modifier cannot appear on a module element. +!!! error TS1044: 'public' modifier cannot appear on a module or namespace element. public class B extends AA implements I { id: number } ~~~~~~ -!!! error TS1044: 'public' modifier cannot appear on a module element. +!!! error TS1044: 'public' modifier cannot appear on a module or namespace element. } module Y3 { public module Module { ~~~~~~ -!!! error TS1044: 'public' modifier cannot appear on a module element. +!!! error TS1044: 'public' modifier cannot appear on a module or namespace element. class A { s: string } } } @@ -60,17 +60,17 @@ tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOf module Y4 { public enum Color { Blue, Red } ~~~~~~ -!!! error TS1044: 'public' modifier cannot appear on a module element. +!!! error TS1044: 'public' modifier cannot appear on a module or namespace element. } module YY { private class A { s: string } ~~~~~~~ -!!! error TS1044: 'private' modifier cannot appear on a module element. +!!! error TS1044: 'private' modifier cannot appear on a module or namespace element. private class BB extends A { ~~~~~~~ -!!! error TS1044: 'private' modifier cannot appear on a module element. +!!! error TS1044: 'private' modifier cannot appear on a module or namespace element. id: number; } } @@ -78,20 +78,20 @@ tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOf module YY2 { private class AA { s: T } ~~~~~~~ -!!! error TS1044: 'private' modifier cannot appear on a module element. +!!! error TS1044: 'private' modifier cannot appear on a module or namespace element. private interface I { id: number } ~~~~~~~ -!!! error TS1044: 'private' modifier cannot appear on a module element. +!!! error TS1044: 'private' modifier cannot appear on a module or namespace element. private class B extends AA implements I { id: number } ~~~~~~~ -!!! error TS1044: 'private' modifier cannot appear on a module element. +!!! error TS1044: 'private' modifier cannot appear on a module or namespace element. } module YY3 { private module Module { ~~~~~~~ -!!! error TS1044: 'private' modifier cannot appear on a module element. +!!! error TS1044: 'private' modifier cannot appear on a module or namespace element. class A { s: string } } } @@ -99,18 +99,18 @@ tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOf module YY4 { private enum Color { Blue, Red } ~~~~~~~ -!!! error TS1044: 'private' modifier cannot appear on a module element. +!!! error TS1044: 'private' modifier cannot appear on a module or namespace element. } module YYY { static class A { s: string } ~~~~~~ -!!! error TS1044: 'static' modifier cannot appear on a module element. +!!! error TS1044: 'static' modifier cannot appear on a module or namespace element. static class BB extends A { ~~~~~~ -!!! error TS1044: 'static' modifier cannot appear on a module element. +!!! error TS1044: 'static' modifier cannot appear on a module or namespace element. id: number; } } @@ -118,20 +118,20 @@ tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOf module YYY2 { static class AA { s: T } ~~~~~~ -!!! error TS1044: 'static' modifier cannot appear on a module element. +!!! error TS1044: 'static' modifier cannot appear on a module or namespace element. static interface I { id: number } ~~~~~~ -!!! error TS1044: 'static' modifier cannot appear on a module element. +!!! error TS1044: 'static' modifier cannot appear on a module or namespace element. static class B extends AA implements I { id: number } ~~~~~~ -!!! error TS1044: 'static' modifier cannot appear on a module element. +!!! error TS1044: 'static' modifier cannot appear on a module or namespace element. } module YYY3 { static module Module { ~~~~~~ -!!! error TS1044: 'static' modifier cannot appear on a module element. +!!! error TS1044: 'static' modifier cannot appear on a module or namespace element. class A { s: string } } } @@ -139,6 +139,6 @@ tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOf module YYY4 { static enum Color { Blue, Red } ~~~~~~ -!!! error TS1044: 'static' modifier cannot appear on a module element. +!!! error TS1044: 'static' modifier cannot appear on a module or namespace element. } \ No newline at end of file diff --git a/tests/baselines/reference/invalidModuleWithVarStatements.errors.txt b/tests/baselines/reference/invalidModuleWithVarStatements.errors.txt index ad8d457670a..347e558eddd 100644 --- a/tests/baselines/reference/invalidModuleWithVarStatements.errors.txt +++ b/tests/baselines/reference/invalidModuleWithVarStatements.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithVarStatements.ts(4,5): error TS1044: 'public' modifier cannot appear on a module element. -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithVarStatements.ts(8,5): error TS1044: 'public' modifier cannot appear on a module element. -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithVarStatements.ts(12,5): error TS1044: 'static' modifier cannot appear on a module element. -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithVarStatements.ts(16,5): error TS1044: 'static' modifier cannot appear on a module element. -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithVarStatements.ts(20,5): error TS1044: 'private' modifier cannot appear on a module element. -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithVarStatements.ts(25,5): error TS1044: 'private' modifier cannot appear on a module element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithVarStatements.ts(4,5): error TS1044: 'public' modifier cannot appear on a module or namespace element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithVarStatements.ts(8,5): error TS1044: 'public' modifier cannot appear on a module or namespace element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithVarStatements.ts(12,5): error TS1044: 'static' modifier cannot appear on a module or namespace element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithVarStatements.ts(16,5): error TS1044: 'static' modifier cannot appear on a module or namespace element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithVarStatements.ts(20,5): error TS1044: 'private' modifier cannot appear on a module or namespace element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithVarStatements.ts(25,5): error TS1044: 'private' modifier cannot appear on a module or namespace element. ==== tests/cases/conformance/internalModules/moduleBody/invalidModuleWithVarStatements.ts (6 errors) ==== @@ -12,37 +12,37 @@ tests/cases/conformance/internalModules/moduleBody/invalidModuleWithVarStatement module Y { public var x: number = 0; ~~~~~~ -!!! error TS1044: 'public' modifier cannot appear on a module element. +!!! error TS1044: 'public' modifier cannot appear on a module or namespace element. } module Y2 { public function fn(x: string) { } ~~~~~~ -!!! error TS1044: 'public' modifier cannot appear on a module element. +!!! error TS1044: 'public' modifier cannot appear on a module or namespace element. } module Y4 { static var x: number = 0; ~~~~~~ -!!! error TS1044: 'static' modifier cannot appear on a module element. +!!! error TS1044: 'static' modifier cannot appear on a module or namespace element. } module YY { static function fn(x: string) { } ~~~~~~ -!!! error TS1044: 'static' modifier cannot appear on a module element. +!!! error TS1044: 'static' modifier cannot appear on a module or namespace element. } module YY2 { private var x: number = 0; ~~~~~~~ -!!! error TS1044: 'private' modifier cannot appear on a module element. +!!! error TS1044: 'private' modifier cannot appear on a module or namespace element. } module YY3 { private function fn(x: string) { } ~~~~~~~ -!!! error TS1044: 'private' modifier cannot appear on a module element. +!!! error TS1044: 'private' modifier cannot appear on a module or namespace element. } \ No newline at end of file diff --git a/tests/baselines/reference/invalidNumberAssignments.errors.txt b/tests/baselines/reference/invalidNumberAssignments.errors.txt index 7eb5e6cb897..fd8acaba032 100644 --- a/tests/baselines/reference/invalidNumberAssignments.errors.txt +++ b/tests/baselines/reference/invalidNumberAssignments.errors.txt @@ -2,13 +2,9 @@ tests/cases/conformance/types/primitives/number/invalidNumberAssignments.ts(3,5) tests/cases/conformance/types/primitives/number/invalidNumberAssignments.ts(4,5): error TS2322: Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/primitives/number/invalidNumberAssignments.ts(5,5): error TS2322: Type 'number' is not assignable to type 'void'. tests/cases/conformance/types/primitives/number/invalidNumberAssignments.ts(9,5): error TS2322: Type 'number' is not assignable to type 'C'. - Property 'foo' is missing in type 'Number'. tests/cases/conformance/types/primitives/number/invalidNumberAssignments.ts(12,5): error TS2322: Type 'number' is not assignable to type 'I'. - Property 'bar' is missing in type 'Number'. tests/cases/conformance/types/primitives/number/invalidNumberAssignments.ts(14,5): error TS2322: Type 'number' is not assignable to type '{ baz: string; }'. - Property 'baz' is missing in type 'Number'. tests/cases/conformance/types/primitives/number/invalidNumberAssignments.ts(15,5): error TS2322: Type 'number' is not assignable to type '{ 0: number; }'. - Property '0' is missing in type 'Number'. tests/cases/conformance/types/primitives/number/invalidNumberAssignments.ts(18,1): error TS2364: Invalid left-hand side of assignment expression. tests/cases/conformance/types/primitives/number/invalidNumberAssignments.ts(21,5): error TS2322: Type 'number' is not assignable to type 'T'. tests/cases/conformance/types/primitives/number/invalidNumberAssignments.ts(23,1): error TS2364: Invalid left-hand side of assignment expression. @@ -32,22 +28,18 @@ tests/cases/conformance/types/primitives/number/invalidNumberAssignments.ts(23,1 var e: C = x; ~ !!! error TS2322: Type 'number' is not assignable to type 'C'. -!!! error TS2322: Property 'foo' is missing in type 'Number'. interface I { bar: string; } var f: I = x; ~ !!! error TS2322: Type 'number' is not assignable to type 'I'. -!!! error TS2322: Property 'bar' is missing in type 'Number'. var g: { baz: string } = 1; ~ !!! error TS2322: Type 'number' is not assignable to type '{ baz: string; }'. -!!! error TS2322: Property 'baz' is missing in type 'Number'. var g2: { 0: number } = 1; ~~ !!! error TS2322: Type 'number' is not assignable to type '{ 0: number; }'. -!!! error TS2322: Property '0' is missing in type 'Number'. module M { export var x = 1; } M = x; diff --git a/tests/baselines/reference/invalidStringAssignments.errors.txt b/tests/baselines/reference/invalidStringAssignments.errors.txt index e67106bef92..d7ac2134dc1 100644 --- a/tests/baselines/reference/invalidStringAssignments.errors.txt +++ b/tests/baselines/reference/invalidStringAssignments.errors.txt @@ -2,13 +2,9 @@ tests/cases/conformance/types/primitives/string/invalidStringAssignments.ts(3,5) tests/cases/conformance/types/primitives/string/invalidStringAssignments.ts(4,5): error TS2322: Type 'string' is not assignable to type 'number'. tests/cases/conformance/types/primitives/string/invalidStringAssignments.ts(5,5): error TS2322: Type 'string' is not assignable to type 'void'. tests/cases/conformance/types/primitives/string/invalidStringAssignments.ts(9,5): error TS2322: Type 'string' is not assignable to type 'C'. - Property 'foo' is missing in type 'String'. tests/cases/conformance/types/primitives/string/invalidStringAssignments.ts(12,5): error TS2322: Type 'string' is not assignable to type 'I'. - Property 'bar' is missing in type 'String'. tests/cases/conformance/types/primitives/string/invalidStringAssignments.ts(14,5): error TS2322: Type 'number' is not assignable to type '{ baz: string; }'. - Property 'baz' is missing in type 'Number'. tests/cases/conformance/types/primitives/string/invalidStringAssignments.ts(15,5): error TS2322: Type 'number' is not assignable to type '{ 0: number; }'. - Property '0' is missing in type 'Number'. tests/cases/conformance/types/primitives/string/invalidStringAssignments.ts(18,1): error TS2364: Invalid left-hand side of assignment expression. tests/cases/conformance/types/primitives/string/invalidStringAssignments.ts(21,5): error TS2322: Type 'string' is not assignable to type 'T'. tests/cases/conformance/types/primitives/string/invalidStringAssignments.ts(23,1): error TS2364: Invalid left-hand side of assignment expression. @@ -33,22 +29,18 @@ tests/cases/conformance/types/primitives/string/invalidStringAssignments.ts(26,5 var e: C = x; ~ !!! error TS2322: Type 'string' is not assignable to type 'C'. -!!! error TS2322: Property 'foo' is missing in type 'String'. interface I { bar: string; } var f: I = x; ~ !!! error TS2322: Type 'string' is not assignable to type 'I'. -!!! error TS2322: Property 'bar' is missing in type 'String'. var g: { baz: string } = 1; ~ !!! error TS2322: Type 'number' is not assignable to type '{ baz: string; }'. -!!! error TS2322: Property 'baz' is missing in type 'Number'. var g2: { 0: number } = 1; ~~ !!! error TS2322: Type 'number' is not assignable to type '{ 0: number; }'. -!!! error TS2322: Property '0' is missing in type 'Number'. module M { export var x = 1; } M = x; diff --git a/tests/baselines/reference/invalidThisEmitInContextualObjectLiteral.js b/tests/baselines/reference/invalidThisEmitInContextualObjectLiteral.js new file mode 100644 index 00000000000..d3bfa819bc9 --- /dev/null +++ b/tests/baselines/reference/invalidThisEmitInContextualObjectLiteral.js @@ -0,0 +1,27 @@ +//// [invalidThisEmitInContextualObjectLiteral.ts] +interface IDef { + p1: (e:string) => void; + p2: () => (n: number) => any; +} + +class TestController { + public m(def: IDef) { } + public p = this.m({ + p1: e => { }, + p2: () => { return vvvvvvvvv => this; }, + }); +} + + +//// [invalidThisEmitInContextualObjectLiteral.js] +var TestController = (function () { + function TestController() { + var _this = this; + this.p = this.m({ + p1: function (e) { }, + p2: function () { return function (vvvvvvvvv) { return _this; }; } + }); + } + TestController.prototype.m = function (def) { }; + return TestController; +}()); diff --git a/tests/baselines/reference/invalidThisEmitInContextualObjectLiteral.symbols b/tests/baselines/reference/invalidThisEmitInContextualObjectLiteral.symbols new file mode 100644 index 00000000000..bb20fce76cd --- /dev/null +++ b/tests/baselines/reference/invalidThisEmitInContextualObjectLiteral.symbols @@ -0,0 +1,39 @@ +=== tests/cases/compiler/invalidThisEmitInContextualObjectLiteral.ts === +interface IDef { +>IDef : Symbol(IDef, Decl(invalidThisEmitInContextualObjectLiteral.ts, 0, 0)) + + p1: (e:string) => void; +>p1 : Symbol(IDef.p1, Decl(invalidThisEmitInContextualObjectLiteral.ts, 0, 16)) +>e : Symbol(e, Decl(invalidThisEmitInContextualObjectLiteral.ts, 1, 6)) + + p2: () => (n: number) => any; +>p2 : Symbol(IDef.p2, Decl(invalidThisEmitInContextualObjectLiteral.ts, 1, 24)) +>n : Symbol(n, Decl(invalidThisEmitInContextualObjectLiteral.ts, 2, 12)) +} + +class TestController { +>TestController : Symbol(TestController, Decl(invalidThisEmitInContextualObjectLiteral.ts, 3, 1)) + + public m(def: IDef) { } +>m : Symbol(TestController.m, Decl(invalidThisEmitInContextualObjectLiteral.ts, 5, 22)) +>def : Symbol(def, Decl(invalidThisEmitInContextualObjectLiteral.ts, 6, 10)) +>IDef : Symbol(IDef, Decl(invalidThisEmitInContextualObjectLiteral.ts, 0, 0)) + + public p = this.m({ +>p : Symbol(TestController.p, Decl(invalidThisEmitInContextualObjectLiteral.ts, 6, 24)) +>this.m : Symbol(TestController.m, Decl(invalidThisEmitInContextualObjectLiteral.ts, 5, 22)) +>this : Symbol(TestController, Decl(invalidThisEmitInContextualObjectLiteral.ts, 3, 1)) +>m : Symbol(TestController.m, Decl(invalidThisEmitInContextualObjectLiteral.ts, 5, 22)) + + p1: e => { }, +>p1 : Symbol(p1, Decl(invalidThisEmitInContextualObjectLiteral.ts, 7, 20)) +>e : Symbol(e, Decl(invalidThisEmitInContextualObjectLiteral.ts, 8, 5)) + + p2: () => { return vvvvvvvvv => this; }, +>p2 : Symbol(p2, Decl(invalidThisEmitInContextualObjectLiteral.ts, 8, 15)) +>vvvvvvvvv : Symbol(vvvvvvvvv, Decl(invalidThisEmitInContextualObjectLiteral.ts, 9, 20)) +>this : Symbol(TestController, Decl(invalidThisEmitInContextualObjectLiteral.ts, 3, 1)) + + }); +} + diff --git a/tests/baselines/reference/invalidThisEmitInContextualObjectLiteral.types b/tests/baselines/reference/invalidThisEmitInContextualObjectLiteral.types new file mode 100644 index 00000000000..290b0a78eb2 --- /dev/null +++ b/tests/baselines/reference/invalidThisEmitInContextualObjectLiteral.types @@ -0,0 +1,44 @@ +=== tests/cases/compiler/invalidThisEmitInContextualObjectLiteral.ts === +interface IDef { +>IDef : IDef + + p1: (e:string) => void; +>p1 : (e: string) => void +>e : string + + p2: () => (n: number) => any; +>p2 : () => (n: number) => any +>n : number +} + +class TestController { +>TestController : TestController + + public m(def: IDef) { } +>m : (def: IDef) => void +>def : IDef +>IDef : IDef + + public p = this.m({ +>p : void +>this.m({ p1: e => { }, p2: () => { return vvvvvvvvv => this; }, }) : void +>this.m : (def: IDef) => void +>this : this +>m : (def: IDef) => void +>{ p1: e => { }, p2: () => { return vvvvvvvvv => this; }, } : { p1: (e: string) => void; p2: () => {}; } + + p1: e => { }, +>p1 : (e: string) => void +>e => { } : (e: string) => void +>e : string + + p2: () => { return vvvvvvvvv => this; }, +>p2 : () => {} +>() => { return vvvvvvvvv => this; } : () => {} +>vvvvvvvvv => this : (vvvvvvvvv: number) => this +>vvvvvvvvv : number +>this : this + + }); +} + diff --git a/tests/baselines/reference/invalidUndefinedAssignments.errors.txt b/tests/baselines/reference/invalidUndefinedAssignments.errors.txt index 4c32b1a6c8e..5eff2e7ff1a 100644 --- a/tests/baselines/reference/invalidUndefinedAssignments.errors.txt +++ b/tests/baselines/reference/invalidUndefinedAssignments.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/types/primitives/undefined/invalidUndefinedAssignments.ts(4,1): error TS2364: Invalid left-hand side of assignment expression. -tests/cases/conformance/types/primitives/undefined/invalidUndefinedAssignments.ts(5,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/types/primitives/undefined/invalidUndefinedAssignments.ts(5,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. tests/cases/conformance/types/primitives/undefined/invalidUndefinedAssignments.ts(9,1): error TS2364: Invalid left-hand side of assignment expression. tests/cases/conformance/types/primitives/undefined/invalidUndefinedAssignments.ts(14,1): error TS2304: Cannot find name 'I'. tests/cases/conformance/types/primitives/undefined/invalidUndefinedAssignments.ts(17,1): error TS2364: Invalid left-hand side of assignment expression. @@ -15,7 +15,7 @@ tests/cases/conformance/types/primitives/undefined/invalidUndefinedAssignments.t !!! error TS2364: Invalid left-hand side of assignment expression. E.A = x; ~~~ -!!! error TS2364: Invalid left-hand side of assignment expression. +!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property. class C { foo: string } var f: C; diff --git a/tests/baselines/reference/invalidUndefinedValues.symbols b/tests/baselines/reference/invalidUndefinedValues.symbols index 5a9b81fde31..748adc75eec 100644 --- a/tests/baselines/reference/invalidUndefinedValues.symbols +++ b/tests/baselines/reference/invalidUndefinedValues.symbols @@ -24,7 +24,7 @@ x = null; class C { foo: string } >C : Symbol(C, Decl(invalidUndefinedValues.ts, 7, 9)) ->foo : Symbol(foo, Decl(invalidUndefinedValues.ts, 9, 9)) +>foo : Symbol(C.foo, Decl(invalidUndefinedValues.ts, 9, 9)) var b: C; >b : Symbol(b, Decl(invalidUndefinedValues.ts, 10, 3)) @@ -40,7 +40,7 @@ x = b; interface I { foo: string } >I : Symbol(I, Decl(invalidUndefinedValues.ts, 12, 6)) ->foo : Symbol(foo, Decl(invalidUndefinedValues.ts, 14, 13)) +>foo : Symbol(I.foo, Decl(invalidUndefinedValues.ts, 14, 13)) var c: I; >c : Symbol(c, Decl(invalidUndefinedValues.ts, 15, 3)) diff --git a/tests/baselines/reference/invalidVoidAssignments.errors.txt b/tests/baselines/reference/invalidVoidAssignments.errors.txt index 9c6be972d3b..af8cec62672 100644 --- a/tests/baselines/reference/invalidVoidAssignments.errors.txt +++ b/tests/baselines/reference/invalidVoidAssignments.errors.txt @@ -4,9 +4,7 @@ tests/cases/conformance/types/primitives/void/invalidVoidAssignments.ts(5,5): er tests/cases/conformance/types/primitives/void/invalidVoidAssignments.ts(9,5): error TS2322: Type 'void' is not assignable to type 'C'. tests/cases/conformance/types/primitives/void/invalidVoidAssignments.ts(12,5): error TS2322: Type 'void' is not assignable to type 'I'. tests/cases/conformance/types/primitives/void/invalidVoidAssignments.ts(14,5): error TS2322: Type 'number' is not assignable to type '{ baz: string; }'. - Property 'baz' is missing in type 'Number'. tests/cases/conformance/types/primitives/void/invalidVoidAssignments.ts(15,5): error TS2322: Type 'number' is not assignable to type '{ 0: number; }'. - Property '0' is missing in type 'Number'. tests/cases/conformance/types/primitives/void/invalidVoidAssignments.ts(18,1): error TS2364: Invalid left-hand side of assignment expression. tests/cases/conformance/types/primitives/void/invalidVoidAssignments.ts(21,5): error TS2322: Type 'void' is not assignable to type 'T'. tests/cases/conformance/types/primitives/void/invalidVoidAssignments.ts(23,1): error TS2364: Invalid left-hand side of assignment expression. @@ -42,11 +40,9 @@ tests/cases/conformance/types/primitives/void/invalidVoidAssignments.ts(29,1): e var g: { baz: string } = 1; ~ !!! error TS2322: Type 'number' is not assignable to type '{ baz: string; }'. -!!! error TS2322: Property 'baz' is missing in type 'Number'. var g2: { 0: number } = 1; ~~ !!! error TS2322: Type 'number' is not assignable to type '{ 0: number; }'. -!!! error TS2322: Property '0' is missing in type 'Number'. module M { export var x = 1; } M = x; diff --git a/tests/baselines/reference/ipromise2.symbols b/tests/baselines/reference/ipromise2.symbols index be936f4512a..f4c4d2a0375 100644 --- a/tests/baselines/reference/ipromise2.symbols +++ b/tests/baselines/reference/ipromise2.symbols @@ -8,7 +8,7 @@ declare module Windows.Foundation { >T : Symbol(T, Decl(ipromise2.ts, 1, 30)) then(success?: (value: T) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void ): Windows.Foundation.IPromise; ->then : Symbol(then, Decl(ipromise2.ts, 1, 34), Decl(ipromise2.ts, 2, 159), Decl(ipromise2.ts, 3, 149), Decl(ipromise2.ts, 4, 149)) +>then : Symbol(IPromise.then, Decl(ipromise2.ts, 1, 34), Decl(ipromise2.ts, 2, 159), Decl(ipromise2.ts, 3, 149), Decl(ipromise2.ts, 4, 149)) >U : Symbol(U, Decl(ipromise2.ts, 2, 13)) >success : Symbol(success, Decl(ipromise2.ts, 2, 16)) >value : Symbol(value, Decl(ipromise2.ts, 2, 27)) @@ -27,7 +27,7 @@ declare module Windows.Foundation { >U : Symbol(U, Decl(ipromise2.ts, 2, 13)) then(success?: (value: T) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void ): Windows.Foundation.IPromise; ->then : Symbol(then, Decl(ipromise2.ts, 1, 34), Decl(ipromise2.ts, 2, 159), Decl(ipromise2.ts, 3, 149), Decl(ipromise2.ts, 4, 149)) +>then : Symbol(IPromise.then, Decl(ipromise2.ts, 1, 34), Decl(ipromise2.ts, 2, 159), Decl(ipromise2.ts, 3, 149), Decl(ipromise2.ts, 4, 149)) >U : Symbol(U, Decl(ipromise2.ts, 3, 13)) >success : Symbol(success, Decl(ipromise2.ts, 3, 16)) >value : Symbol(value, Decl(ipromise2.ts, 3, 27)) @@ -45,7 +45,7 @@ declare module Windows.Foundation { >U : Symbol(U, Decl(ipromise2.ts, 3, 13)) then(success?: (value: T) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void ): Windows.Foundation.IPromise; ->then : Symbol(then, Decl(ipromise2.ts, 1, 34), Decl(ipromise2.ts, 2, 159), Decl(ipromise2.ts, 3, 149), Decl(ipromise2.ts, 4, 149)) +>then : Symbol(IPromise.then, Decl(ipromise2.ts, 1, 34), Decl(ipromise2.ts, 2, 159), Decl(ipromise2.ts, 3, 149), Decl(ipromise2.ts, 4, 149)) >U : Symbol(U, Decl(ipromise2.ts, 4, 13)) >success : Symbol(success, Decl(ipromise2.ts, 4, 16)) >value : Symbol(value, Decl(ipromise2.ts, 4, 27)) @@ -63,7 +63,7 @@ declare module Windows.Foundation { >U : Symbol(U, Decl(ipromise2.ts, 4, 13)) then(success?: (value: T) => U, error?: (error: any) => U, progress?: (progress: any) => void ): Windows.Foundation.IPromise; ->then : Symbol(then, Decl(ipromise2.ts, 1, 34), Decl(ipromise2.ts, 2, 159), Decl(ipromise2.ts, 3, 149), Decl(ipromise2.ts, 4, 149)) +>then : Symbol(IPromise.then, Decl(ipromise2.ts, 1, 34), Decl(ipromise2.ts, 2, 159), Decl(ipromise2.ts, 3, 149), Decl(ipromise2.ts, 4, 149)) >U : Symbol(U, Decl(ipromise2.ts, 5, 13)) >success : Symbol(success, Decl(ipromise2.ts, 5, 16)) >value : Symbol(value, Decl(ipromise2.ts, 5, 27)) @@ -80,7 +80,7 @@ declare module Windows.Foundation { >U : Symbol(U, Decl(ipromise2.ts, 5, 13)) done(success?: (value: T) => any, error?: (error: any) => any, progress?: (progress: any) => void ): void; ->done : Symbol(done, Decl(ipromise2.ts, 5, 139)) +>done : Symbol(IPromise.done, Decl(ipromise2.ts, 5, 139)) >U : Symbol(U, Decl(ipromise2.ts, 6, 13)) >success : Symbol(success, Decl(ipromise2.ts, 6, 16)) >value : Symbol(value, Decl(ipromise2.ts, 6, 27)) @@ -91,7 +91,7 @@ declare module Windows.Foundation { >progress : Symbol(progress, Decl(ipromise2.ts, 6, 86)) value: T; ->value : Symbol(value, Decl(ipromise2.ts, 6, 117)) +>value : Symbol(IPromise.value, Decl(ipromise2.ts, 6, 117)) >T : Symbol(T, Decl(ipromise2.ts, 1, 30)) } } diff --git a/tests/baselines/reference/ipromise3.symbols b/tests/baselines/reference/ipromise3.symbols index 3605a94fc88..c264f8e2280 100644 --- a/tests/baselines/reference/ipromise3.symbols +++ b/tests/baselines/reference/ipromise3.symbols @@ -4,7 +4,7 @@ interface IPromise3 { >T : Symbol(T, Decl(ipromise3.ts, 0, 20)) then(success?: (value: T) => IPromise3, error?: (error: any) => IPromise3, progress?: (progress: any) => void ): IPromise3; ->then : Symbol(then, Decl(ipromise3.ts, 0, 24), Decl(ipromise3.ts, 1, 139), Decl(ipromise3.ts, 2, 128), Decl(ipromise3.ts, 3, 128)) +>then : Symbol(IPromise3.then, Decl(ipromise3.ts, 0, 24), Decl(ipromise3.ts, 1, 139), Decl(ipromise3.ts, 2, 128), Decl(ipromise3.ts, 3, 128)) >U : Symbol(U, Decl(ipromise3.ts, 1, 9)) >success : Symbol(success, Decl(ipromise3.ts, 1, 12)) >value : Symbol(value, Decl(ipromise3.ts, 1, 23)) @@ -21,7 +21,7 @@ interface IPromise3 { >U : Symbol(U, Decl(ipromise3.ts, 1, 9)) then(success?: (value: T) => IPromise3, error?: (error: any) => U, progress?: (progress: any) => void ): IPromise3; ->then : Symbol(then, Decl(ipromise3.ts, 0, 24), Decl(ipromise3.ts, 1, 139), Decl(ipromise3.ts, 2, 128), Decl(ipromise3.ts, 3, 128)) +>then : Symbol(IPromise3.then, Decl(ipromise3.ts, 0, 24), Decl(ipromise3.ts, 1, 139), Decl(ipromise3.ts, 2, 128), Decl(ipromise3.ts, 3, 128)) >U : Symbol(U, Decl(ipromise3.ts, 2, 9)) >success : Symbol(success, Decl(ipromise3.ts, 2, 12)) >value : Symbol(value, Decl(ipromise3.ts, 2, 23)) @@ -37,7 +37,7 @@ interface IPromise3 { >U : Symbol(U, Decl(ipromise3.ts, 2, 9)) then(success?: (value: T) => U, error?: (error: any) => IPromise3, progress?: (progress: any) => void ): IPromise3; ->then : Symbol(then, Decl(ipromise3.ts, 0, 24), Decl(ipromise3.ts, 1, 139), Decl(ipromise3.ts, 2, 128), Decl(ipromise3.ts, 3, 128)) +>then : Symbol(IPromise3.then, Decl(ipromise3.ts, 0, 24), Decl(ipromise3.ts, 1, 139), Decl(ipromise3.ts, 2, 128), Decl(ipromise3.ts, 3, 128)) >U : Symbol(U, Decl(ipromise3.ts, 3, 9)) >success : Symbol(success, Decl(ipromise3.ts, 3, 12)) >value : Symbol(value, Decl(ipromise3.ts, 3, 23)) @@ -53,7 +53,7 @@ interface IPromise3 { >U : Symbol(U, Decl(ipromise3.ts, 3, 9)) then(success?: (value: T) => U, error?: (error: any) => U, progress?: (progress: any) => void ): IPromise3; ->then : Symbol(then, Decl(ipromise3.ts, 0, 24), Decl(ipromise3.ts, 1, 139), Decl(ipromise3.ts, 2, 128), Decl(ipromise3.ts, 3, 128)) +>then : Symbol(IPromise3.then, Decl(ipromise3.ts, 0, 24), Decl(ipromise3.ts, 1, 139), Decl(ipromise3.ts, 2, 128), Decl(ipromise3.ts, 3, 128)) >U : Symbol(U, Decl(ipromise3.ts, 4, 9)) >success : Symbol(success, Decl(ipromise3.ts, 4, 12)) >value : Symbol(value, Decl(ipromise3.ts, 4, 23)) @@ -68,7 +68,7 @@ interface IPromise3 { >U : Symbol(U, Decl(ipromise3.ts, 4, 9)) done? (success?: (value: T) => any, error?: (error: any) => any, progress?: (progress: any) => void ): void; ->done : Symbol(done, Decl(ipromise3.ts, 4, 117)) +>done : Symbol(IPromise3.done, Decl(ipromise3.ts, 4, 117)) >U : Symbol(U, Decl(ipromise3.ts, 5, 11)) >success : Symbol(success, Decl(ipromise3.ts, 5, 14)) >value : Symbol(value, Decl(ipromise3.ts, 5, 25)) diff --git a/tests/baselines/reference/ipromise4.symbols b/tests/baselines/reference/ipromise4.symbols index 65ae5f90cfe..58055fdc59d 100644 --- a/tests/baselines/reference/ipromise4.symbols +++ b/tests/baselines/reference/ipromise4.symbols @@ -8,7 +8,7 @@ declare module Windows.Foundation { >T : Symbol(T, Decl(ipromise4.ts, 1, 30)) then(success?: (value: T) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void ): Windows.Foundation.IPromise; ->then : Symbol(then, Decl(ipromise4.ts, 1, 34), Decl(ipromise4.ts, 2, 159), Decl(ipromise4.ts, 3, 149), Decl(ipromise4.ts, 4, 149)) +>then : Symbol(IPromise.then, Decl(ipromise4.ts, 1, 34), Decl(ipromise4.ts, 2, 159), Decl(ipromise4.ts, 3, 149), Decl(ipromise4.ts, 4, 149)) >U : Symbol(U, Decl(ipromise4.ts, 2, 13)) >success : Symbol(success, Decl(ipromise4.ts, 2, 16)) >value : Symbol(value, Decl(ipromise4.ts, 2, 27)) @@ -27,7 +27,7 @@ declare module Windows.Foundation { >U : Symbol(U, Decl(ipromise4.ts, 2, 13)) then(success?: (value: T) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void ): Windows.Foundation.IPromise; ->then : Symbol(then, Decl(ipromise4.ts, 1, 34), Decl(ipromise4.ts, 2, 159), Decl(ipromise4.ts, 3, 149), Decl(ipromise4.ts, 4, 149)) +>then : Symbol(IPromise.then, Decl(ipromise4.ts, 1, 34), Decl(ipromise4.ts, 2, 159), Decl(ipromise4.ts, 3, 149), Decl(ipromise4.ts, 4, 149)) >U : Symbol(U, Decl(ipromise4.ts, 3, 13)) >success : Symbol(success, Decl(ipromise4.ts, 3, 16)) >value : Symbol(value, Decl(ipromise4.ts, 3, 27)) @@ -45,7 +45,7 @@ declare module Windows.Foundation { >U : Symbol(U, Decl(ipromise4.ts, 3, 13)) then(success?: (value: T) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void ): Windows.Foundation.IPromise; ->then : Symbol(then, Decl(ipromise4.ts, 1, 34), Decl(ipromise4.ts, 2, 159), Decl(ipromise4.ts, 3, 149), Decl(ipromise4.ts, 4, 149)) +>then : Symbol(IPromise.then, Decl(ipromise4.ts, 1, 34), Decl(ipromise4.ts, 2, 159), Decl(ipromise4.ts, 3, 149), Decl(ipromise4.ts, 4, 149)) >U : Symbol(U, Decl(ipromise4.ts, 4, 13)) >success : Symbol(success, Decl(ipromise4.ts, 4, 16)) >value : Symbol(value, Decl(ipromise4.ts, 4, 27)) @@ -63,7 +63,7 @@ declare module Windows.Foundation { >U : Symbol(U, Decl(ipromise4.ts, 4, 13)) then(success?: (value: T) => U, error?: (error: any) => U, progress?: (progress: any) => void ): Windows.Foundation.IPromise; ->then : Symbol(then, Decl(ipromise4.ts, 1, 34), Decl(ipromise4.ts, 2, 159), Decl(ipromise4.ts, 3, 149), Decl(ipromise4.ts, 4, 149)) +>then : Symbol(IPromise.then, Decl(ipromise4.ts, 1, 34), Decl(ipromise4.ts, 2, 159), Decl(ipromise4.ts, 3, 149), Decl(ipromise4.ts, 4, 149)) >U : Symbol(U, Decl(ipromise4.ts, 5, 13)) >success : Symbol(success, Decl(ipromise4.ts, 5, 16)) >value : Symbol(value, Decl(ipromise4.ts, 5, 27)) @@ -80,7 +80,7 @@ declare module Windows.Foundation { >U : Symbol(U, Decl(ipromise4.ts, 5, 13)) done? (success?: (value: T) => any, error?: (error: any) => any, progress?: (progress: any) => void ): void; ->done : Symbol(done, Decl(ipromise4.ts, 5, 139)) +>done : Symbol(IPromise.done, Decl(ipromise4.ts, 5, 139)) >U : Symbol(U, Decl(ipromise4.ts, 6, 15)) >success : Symbol(success, Decl(ipromise4.ts, 6, 18)) >value : Symbol(value, Decl(ipromise4.ts, 6, 29)) diff --git a/tests/baselines/reference/isArray.types b/tests/baselines/reference/isArray.types index de54e9d064c..bc452b12bef 100644 --- a/tests/baselines/reference/isArray.types +++ b/tests/baselines/reference/isArray.types @@ -4,7 +4,7 @@ var maybeArray: number | number[]; if (Array.isArray(maybeArray)) { ->Array.isArray(maybeArray) : arg is any[] +>Array.isArray(maybeArray) : boolean >Array.isArray : (arg: any) => arg is any[] >Array : ArrayConstructor >isArray : (arg: any) => arg is any[] diff --git a/tests/baselines/reference/isDeclarationVisibleNodeKinds.js b/tests/baselines/reference/isDeclarationVisibleNodeKinds.js index 99e1ac72acd..e24032eb858 100644 --- a/tests/baselines/reference/isDeclarationVisibleNodeKinds.js +++ b/tests/baselines/reference/isDeclarationVisibleNodeKinds.js @@ -193,7 +193,7 @@ declare module schema { } declare module schema { class T { - createValidator9: (data: T) => T; + readonly createValidator9: (data: T) => T; createValidator10: (data: T) => T; } } diff --git a/tests/baselines/reference/isDeclarationVisibleNodeKinds.symbols b/tests/baselines/reference/isDeclarationVisibleNodeKinds.symbols index 2af21772cfb..ecc68121f37 100644 --- a/tests/baselines/reference/isDeclarationVisibleNodeKinds.symbols +++ b/tests/baselines/reference/isDeclarationVisibleNodeKinds.symbols @@ -146,7 +146,7 @@ module schema { >T : Symbol(T, Decl(isDeclarationVisibleNodeKinds.ts, 59, 15)) get createValidator9(): (data: T) => T { ->createValidator9 : Symbol(createValidator9, Decl(isDeclarationVisibleNodeKinds.ts, 60, 20)) +>createValidator9 : Symbol(T.createValidator9, Decl(isDeclarationVisibleNodeKinds.ts, 60, 20)) >T : Symbol(T, Decl(isDeclarationVisibleNodeKinds.ts, 61, 33)) >data : Symbol(data, Decl(isDeclarationVisibleNodeKinds.ts, 61, 36)) >T : Symbol(T, Decl(isDeclarationVisibleNodeKinds.ts, 61, 33)) @@ -157,7 +157,7 @@ module schema { } set createValidator10(v: (data: T) => T) { ->createValidator10 : Symbol(createValidator10, Decl(isDeclarationVisibleNodeKinds.ts, 63, 9)) +>createValidator10 : Symbol(T.createValidator10, Decl(isDeclarationVisibleNodeKinds.ts, 63, 9)) >v : Symbol(v, Decl(isDeclarationVisibleNodeKinds.ts, 65, 30)) >T : Symbol(T, Decl(isDeclarationVisibleNodeKinds.ts, 65, 34)) >data : Symbol(data, Decl(isDeclarationVisibleNodeKinds.ts, 65, 37)) diff --git a/tests/baselines/reference/isolatedModulesPlainFile-System.js b/tests/baselines/reference/isolatedModulesPlainFile-System.js index 44eec5161c0..39320759740 100644 --- a/tests/baselines/reference/isolatedModulesPlainFile-System.js +++ b/tests/baselines/reference/isolatedModulesPlainFile-System.js @@ -5,8 +5,9 @@ run(1); //// [isolatedModulesPlainFile-System.js] -System.register([], function(exports_1, __moduleName) { +System.register([], function(exports_1, context_1) { "use strict"; + var __moduleName = context_1 && context_1.id; return { setters:[], execute: function() { diff --git a/tests/baselines/reference/isolatedModulesSourceMap.js.map b/tests/baselines/reference/isolatedModulesSourceMap.js.map index 3d86a0a7144..a6778476dda 100644 --- a/tests/baselines/reference/isolatedModulesSourceMap.js.map +++ b/tests/baselines/reference/isolatedModulesSourceMap.js.map @@ -1,2 +1,2 @@ //// [file1.js.map] -{"version":3,"file":"file1.js","sourceRoot":"","sources":["file1.ts"],"names":[],"mappings":"AACA,WAAW,CAAC,GAAG,CAAC,CAAC"} \ No newline at end of file +{"version":3,"file":"file1.js","sourceRoot":"","sources":["file1.ts"],"names":[],"mappings":"AACA,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/isolatedModulesSourceMap.sourcemap.txt b/tests/baselines/reference/isolatedModulesSourceMap.sourcemap.txt index 7edf071f5d1..57f604125d3 100644 --- a/tests/baselines/reference/isolatedModulesSourceMap.sourcemap.txt +++ b/tests/baselines/reference/isolatedModulesSourceMap.sourcemap.txt @@ -10,24 +10,27 @@ sourceFile:file1.ts ------------------------------------------------------------------- >>>export var x = 1; 1 > -2 >^^^^^^^^^^^ -3 > ^ -4 > ^^^ -5 > ^ -6 > ^ -7 > ^^^^^^^^^^^^^^^-> +2 >^^^^^^^ +3 > ^^^^ +4 > ^ +5 > ^^^ +6 > ^ +7 > ^ +8 > ^^^^^^^^^^^^^^^-> 1 > > -2 >export var -3 > x -4 > = -5 > 1 -6 > ; +2 >export +3 > var +4 > x +5 > = +6 > 1 +7 > ; 1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(1, 12) Source(2, 12) + SourceIndex(0) -3 >Emitted(1, 13) Source(2, 13) + SourceIndex(0) -4 >Emitted(1, 16) Source(2, 16) + SourceIndex(0) -5 >Emitted(1, 17) Source(2, 17) + SourceIndex(0) -6 >Emitted(1, 18) Source(2, 18) + SourceIndex(0) +2 >Emitted(1, 8) Source(2, 8) + SourceIndex(0) +3 >Emitted(1, 12) Source(2, 12) + SourceIndex(0) +4 >Emitted(1, 13) Source(2, 13) + SourceIndex(0) +5 >Emitted(1, 16) Source(2, 16) + SourceIndex(0) +6 >Emitted(1, 17) Source(2, 17) + SourceIndex(0) +7 >Emitted(1, 18) Source(2, 18) + SourceIndex(0) --- >>>//# sourceMappingURL=file1.js.map \ No newline at end of file diff --git a/tests/baselines/reference/isolatedModulesUnspecifiedModule.errors.txt b/tests/baselines/reference/isolatedModulesUnspecifiedModule.errors.txt deleted file mode 100644 index fbb2f0041d6..00000000000 --- a/tests/baselines/reference/isolatedModulesUnspecifiedModule.errors.txt +++ /dev/null @@ -1,6 +0,0 @@ -error TS5047: Option 'isolatedModules' can only be used when either option '--module' is provided or option 'target' is 'ES2015' or higher. - - -!!! error TS5047: Option 'isolatedModules' can only be used when either option '--module' is provided or option 'target' is 'ES2015' or higher. -==== tests/cases/compiler/file1.ts (0 errors) ==== - export var x; \ No newline at end of file diff --git a/tests/baselines/reference/isolatedModulesUnspecifiedModule.symbols b/tests/baselines/reference/isolatedModulesUnspecifiedModule.symbols new file mode 100644 index 00000000000..625dbfbe699 --- /dev/null +++ b/tests/baselines/reference/isolatedModulesUnspecifiedModule.symbols @@ -0,0 +1,4 @@ +=== tests/cases/compiler/file1.ts === +export var x; +>x : Symbol(x, Decl(file1.ts, 0, 10)) + diff --git a/tests/baselines/reference/isolatedModulesUnspecifiedModule.types b/tests/baselines/reference/isolatedModulesUnspecifiedModule.types new file mode 100644 index 00000000000..27dca700bb9 --- /dev/null +++ b/tests/baselines/reference/isolatedModulesUnspecifiedModule.types @@ -0,0 +1,4 @@ +=== tests/cases/compiler/file1.ts === +export var x; +>x : any + diff --git a/tests/baselines/reference/iterableArrayPattern1.symbols b/tests/baselines/reference/iterableArrayPattern1.symbols index 2877a2233da..4921fc8ec9c 100644 --- a/tests/baselines/reference/iterableArrayPattern1.symbols +++ b/tests/baselines/reference/iterableArrayPattern1.symbols @@ -8,12 +8,12 @@ class SymbolIterator { >SymbolIterator : Symbol(SymbolIterator, Decl(iterableArrayPattern1.ts, 0, 32)) next() { ->next : Symbol(next, Decl(iterableArrayPattern1.ts, 1, 22)) +>next : Symbol(SymbolIterator.next, Decl(iterableArrayPattern1.ts, 1, 22)) return { value: Symbol(), >value : Symbol(value, Decl(iterableArrayPattern1.ts, 3, 16)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) done: false >done : Symbol(done, Decl(iterableArrayPattern1.ts, 4, 28)) @@ -22,9 +22,9 @@ class SymbolIterator { } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; >this : Symbol(SymbolIterator, Decl(iterableArrayPattern1.ts, 0, 32)) diff --git a/tests/baselines/reference/iterableArrayPattern11.symbols b/tests/baselines/reference/iterableArrayPattern11.symbols index 6181edbf1fd..e1b3713f9dd 100644 --- a/tests/baselines/reference/iterableArrayPattern11.symbols +++ b/tests/baselines/reference/iterableArrayPattern11.symbols @@ -11,18 +11,18 @@ fun(new FooIterator); class Bar { x } >Bar : Symbol(Bar, Decl(iterableArrayPattern11.ts, 1, 21)) ->x : Symbol(x, Decl(iterableArrayPattern11.ts, 2, 11)) +>x : Symbol(Bar.x, Decl(iterableArrayPattern11.ts, 2, 11)) class Foo extends Bar { y } >Foo : Symbol(Foo, Decl(iterableArrayPattern11.ts, 2, 15)) >Bar : Symbol(Bar, Decl(iterableArrayPattern11.ts, 1, 21)) ->y : Symbol(y, Decl(iterableArrayPattern11.ts, 3, 23)) +>y : Symbol(Foo.y, Decl(iterableArrayPattern11.ts, 3, 23)) class FooIterator { >FooIterator : Symbol(FooIterator, Decl(iterableArrayPattern11.ts, 3, 27)) next() { ->next : Symbol(next, Decl(iterableArrayPattern11.ts, 4, 19)) +>next : Symbol(FooIterator.next, Decl(iterableArrayPattern11.ts, 4, 19)) return { value: new Foo, @@ -36,9 +36,9 @@ class FooIterator { } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; >this : Symbol(FooIterator, Decl(iterableArrayPattern11.ts, 3, 27)) diff --git a/tests/baselines/reference/iterableArrayPattern12.symbols b/tests/baselines/reference/iterableArrayPattern12.symbols index e4b4baf3bd5..4044544d17b 100644 --- a/tests/baselines/reference/iterableArrayPattern12.symbols +++ b/tests/baselines/reference/iterableArrayPattern12.symbols @@ -11,18 +11,18 @@ fun(new FooIterator); class Bar { x } >Bar : Symbol(Bar, Decl(iterableArrayPattern12.ts, 1, 21)) ->x : Symbol(x, Decl(iterableArrayPattern12.ts, 2, 11)) +>x : Symbol(Bar.x, Decl(iterableArrayPattern12.ts, 2, 11)) class Foo extends Bar { y } >Foo : Symbol(Foo, Decl(iterableArrayPattern12.ts, 2, 15)) >Bar : Symbol(Bar, Decl(iterableArrayPattern12.ts, 1, 21)) ->y : Symbol(y, Decl(iterableArrayPattern12.ts, 3, 23)) +>y : Symbol(Foo.y, Decl(iterableArrayPattern12.ts, 3, 23)) class FooIterator { >FooIterator : Symbol(FooIterator, Decl(iterableArrayPattern12.ts, 3, 27)) next() { ->next : Symbol(next, Decl(iterableArrayPattern12.ts, 4, 19)) +>next : Symbol(FooIterator.next, Decl(iterableArrayPattern12.ts, 4, 19)) return { value: new Foo, @@ -36,9 +36,9 @@ class FooIterator { } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; >this : Symbol(FooIterator, Decl(iterableArrayPattern12.ts, 3, 27)) diff --git a/tests/baselines/reference/iterableArrayPattern13.symbols b/tests/baselines/reference/iterableArrayPattern13.symbols index 02f219e7092..c04d66fa6d4 100644 --- a/tests/baselines/reference/iterableArrayPattern13.symbols +++ b/tests/baselines/reference/iterableArrayPattern13.symbols @@ -10,18 +10,18 @@ fun(new FooIterator); class Bar { x } >Bar : Symbol(Bar, Decl(iterableArrayPattern13.ts, 1, 21)) ->x : Symbol(x, Decl(iterableArrayPattern13.ts, 2, 11)) +>x : Symbol(Bar.x, Decl(iterableArrayPattern13.ts, 2, 11)) class Foo extends Bar { y } >Foo : Symbol(Foo, Decl(iterableArrayPattern13.ts, 2, 15)) >Bar : Symbol(Bar, Decl(iterableArrayPattern13.ts, 1, 21)) ->y : Symbol(y, Decl(iterableArrayPattern13.ts, 3, 23)) +>y : Symbol(Foo.y, Decl(iterableArrayPattern13.ts, 3, 23)) class FooIterator { >FooIterator : Symbol(FooIterator, Decl(iterableArrayPattern13.ts, 3, 27)) next() { ->next : Symbol(next, Decl(iterableArrayPattern13.ts, 4, 19)) +>next : Symbol(FooIterator.next, Decl(iterableArrayPattern13.ts, 4, 19)) return { value: new Foo, @@ -35,9 +35,9 @@ class FooIterator { } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; >this : Symbol(FooIterator, Decl(iterableArrayPattern13.ts, 3, 27)) diff --git a/tests/baselines/reference/iterableArrayPattern2.symbols b/tests/baselines/reference/iterableArrayPattern2.symbols index dad1262cee9..50d3352b9e7 100644 --- a/tests/baselines/reference/iterableArrayPattern2.symbols +++ b/tests/baselines/reference/iterableArrayPattern2.symbols @@ -8,12 +8,12 @@ class SymbolIterator { >SymbolIterator : Symbol(SymbolIterator, Decl(iterableArrayPattern2.ts, 0, 35)) next() { ->next : Symbol(next, Decl(iterableArrayPattern2.ts, 1, 22)) +>next : Symbol(SymbolIterator.next, Decl(iterableArrayPattern2.ts, 1, 22)) return { value: Symbol(), >value : Symbol(value, Decl(iterableArrayPattern2.ts, 3, 16)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) done: false >done : Symbol(done, Decl(iterableArrayPattern2.ts, 4, 28)) @@ -22,9 +22,9 @@ class SymbolIterator { } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; >this : Symbol(SymbolIterator, Decl(iterableArrayPattern2.ts, 0, 35)) diff --git a/tests/baselines/reference/iterableArrayPattern3.symbols b/tests/baselines/reference/iterableArrayPattern3.symbols index e0372862b9e..6cf09801382 100644 --- a/tests/baselines/reference/iterableArrayPattern3.symbols +++ b/tests/baselines/reference/iterableArrayPattern3.symbols @@ -12,18 +12,18 @@ var a: Bar, b: Bar; class Bar { x } >Bar : Symbol(Bar, Decl(iterableArrayPattern3.ts, 1, 25)) ->x : Symbol(x, Decl(iterableArrayPattern3.ts, 2, 11)) +>x : Symbol(Bar.x, Decl(iterableArrayPattern3.ts, 2, 11)) class Foo extends Bar { y } >Foo : Symbol(Foo, Decl(iterableArrayPattern3.ts, 2, 15)) >Bar : Symbol(Bar, Decl(iterableArrayPattern3.ts, 1, 25)) ->y : Symbol(y, Decl(iterableArrayPattern3.ts, 3, 23)) +>y : Symbol(Foo.y, Decl(iterableArrayPattern3.ts, 3, 23)) class FooIterator { >FooIterator : Symbol(FooIterator, Decl(iterableArrayPattern3.ts, 3, 27)) next() { ->next : Symbol(next, Decl(iterableArrayPattern3.ts, 4, 19)) +>next : Symbol(FooIterator.next, Decl(iterableArrayPattern3.ts, 4, 19)) return { value: new Foo, @@ -37,9 +37,9 @@ class FooIterator { } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; >this : Symbol(FooIterator, Decl(iterableArrayPattern3.ts, 3, 27)) diff --git a/tests/baselines/reference/iterableArrayPattern30.symbols b/tests/baselines/reference/iterableArrayPattern30.symbols index 393d9fbca51..b6597922490 100644 --- a/tests/baselines/reference/iterableArrayPattern30.symbols +++ b/tests/baselines/reference/iterableArrayPattern30.symbols @@ -4,5 +4,5 @@ const [[k1, v1], [k2, v2]] = new Map([["", true], ["hello", true]]) >v1 : Symbol(v1, Decl(iterableArrayPattern30.ts, 0, 11)) >k2 : Symbol(k2, Decl(iterableArrayPattern30.ts, 0, 18)) >v2 : Symbol(v2, Decl(iterableArrayPattern30.ts, 0, 21)) ->Map : Symbol(Map, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Map : Symbol(Map, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --)) diff --git a/tests/baselines/reference/iterableArrayPattern4.symbols b/tests/baselines/reference/iterableArrayPattern4.symbols index fb1cce1b8f9..651c60cf08f 100644 --- a/tests/baselines/reference/iterableArrayPattern4.symbols +++ b/tests/baselines/reference/iterableArrayPattern4.symbols @@ -12,18 +12,18 @@ var a: Bar, b: Bar[]; class Bar { x } >Bar : Symbol(Bar, Decl(iterableArrayPattern4.ts, 1, 28)) ->x : Symbol(x, Decl(iterableArrayPattern4.ts, 2, 11)) +>x : Symbol(Bar.x, Decl(iterableArrayPattern4.ts, 2, 11)) class Foo extends Bar { y } >Foo : Symbol(Foo, Decl(iterableArrayPattern4.ts, 2, 15)) >Bar : Symbol(Bar, Decl(iterableArrayPattern4.ts, 1, 28)) ->y : Symbol(y, Decl(iterableArrayPattern4.ts, 3, 23)) +>y : Symbol(Foo.y, Decl(iterableArrayPattern4.ts, 3, 23)) class FooIterator { >FooIterator : Symbol(FooIterator, Decl(iterableArrayPattern4.ts, 3, 27)) next() { ->next : Symbol(next, Decl(iterableArrayPattern4.ts, 4, 19)) +>next : Symbol(FooIterator.next, Decl(iterableArrayPattern4.ts, 4, 19)) return { value: new Foo, @@ -37,9 +37,9 @@ class FooIterator { } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; >this : Symbol(FooIterator, Decl(iterableArrayPattern4.ts, 3, 27)) diff --git a/tests/baselines/reference/iterableArrayPattern9.symbols b/tests/baselines/reference/iterableArrayPattern9.symbols index 07d580fcea1..d85329c4507 100644 --- a/tests/baselines/reference/iterableArrayPattern9.symbols +++ b/tests/baselines/reference/iterableArrayPattern9.symbols @@ -7,18 +7,18 @@ function fun([a, b] = new FooIterator) { } class Bar { x } >Bar : Symbol(Bar, Decl(iterableArrayPattern9.ts, 0, 42)) ->x : Symbol(x, Decl(iterableArrayPattern9.ts, 1, 11)) +>x : Symbol(Bar.x, Decl(iterableArrayPattern9.ts, 1, 11)) class Foo extends Bar { y } >Foo : Symbol(Foo, Decl(iterableArrayPattern9.ts, 1, 15)) >Bar : Symbol(Bar, Decl(iterableArrayPattern9.ts, 0, 42)) ->y : Symbol(y, Decl(iterableArrayPattern9.ts, 2, 23)) +>y : Symbol(Foo.y, Decl(iterableArrayPattern9.ts, 2, 23)) class FooIterator { >FooIterator : Symbol(FooIterator, Decl(iterableArrayPattern9.ts, 2, 27)) next() { ->next : Symbol(next, Decl(iterableArrayPattern9.ts, 3, 19)) +>next : Symbol(FooIterator.next, Decl(iterableArrayPattern9.ts, 3, 19)) return { value: new Foo, @@ -32,9 +32,9 @@ class FooIterator { } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; >this : Symbol(FooIterator, Decl(iterableArrayPattern9.ts, 2, 27)) diff --git a/tests/baselines/reference/iterableContextualTyping1.symbols b/tests/baselines/reference/iterableContextualTyping1.symbols index 5af4fdbcd78..7a7f77e7898 100644 --- a/tests/baselines/reference/iterableContextualTyping1.symbols +++ b/tests/baselines/reference/iterableContextualTyping1.symbols @@ -1,10 +1,10 @@ === tests/cases/conformance/expressions/contextualTyping/iterableContextualTyping1.ts === var iter: Iterable<(x: string) => number> = [s => s.length]; >iter : Symbol(iter, Decl(iterableContextualTyping1.ts, 0, 3)) ->Iterable : Symbol(Iterable, Decl(lib.d.ts, --, --)) +>Iterable : Symbol(Iterable, Decl(lib.es2015.iterable.d.ts, --, --)) >x : Symbol(x, Decl(iterableContextualTyping1.ts, 0, 20)) >s : Symbol(s, Decl(iterableContextualTyping1.ts, 0, 45)) ->s.length : Symbol(String.length, Decl(lib.d.ts, --, --)) +>s.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) >s : Symbol(s, Decl(iterableContextualTyping1.ts, 0, 45)) ->length : Symbol(String.length, Decl(lib.d.ts, --, --)) +>length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) diff --git a/tests/baselines/reference/iteratorSpreadInArray.symbols b/tests/baselines/reference/iteratorSpreadInArray.symbols index d24abca314b..7fc2d469eae 100644 --- a/tests/baselines/reference/iteratorSpreadInArray.symbols +++ b/tests/baselines/reference/iteratorSpreadInArray.symbols @@ -7,12 +7,12 @@ class SymbolIterator { >SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInArray.ts, 0, 36)) next() { ->next : Symbol(next, Decl(iteratorSpreadInArray.ts, 2, 22)) +>next : Symbol(SymbolIterator.next, Decl(iteratorSpreadInArray.ts, 2, 22)) return { value: Symbol(), >value : Symbol(value, Decl(iteratorSpreadInArray.ts, 4, 16)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) done: false >done : Symbol(done, Decl(iteratorSpreadInArray.ts, 5, 28)) @@ -21,9 +21,9 @@ class SymbolIterator { } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; >this : Symbol(SymbolIterator, Decl(iteratorSpreadInArray.ts, 0, 36)) diff --git a/tests/baselines/reference/iteratorSpreadInArray11.symbols b/tests/baselines/reference/iteratorSpreadInArray11.symbols index f982bf2deab..6194a8305aa 100644 --- a/tests/baselines/reference/iteratorSpreadInArray11.symbols +++ b/tests/baselines/reference/iteratorSpreadInArray11.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/spread/iteratorSpreadInArray11.ts === var iter: Iterable; >iter : Symbol(iter, Decl(iteratorSpreadInArray11.ts, 0, 3)) ->Iterable : Symbol(Iterable, Decl(lib.d.ts, --, --)) +>Iterable : Symbol(Iterable, Decl(lib.es2015.iterable.d.ts, --, --)) var array = [...iter]; >array : Symbol(array, Decl(iteratorSpreadInArray11.ts, 1, 3)) diff --git a/tests/baselines/reference/iteratorSpreadInArray2.symbols b/tests/baselines/reference/iteratorSpreadInArray2.symbols index 029d83d2111..8d39834c17f 100644 --- a/tests/baselines/reference/iteratorSpreadInArray2.symbols +++ b/tests/baselines/reference/iteratorSpreadInArray2.symbols @@ -8,12 +8,12 @@ class SymbolIterator { >SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInArray2.ts, 0, 59)) next() { ->next : Symbol(next, Decl(iteratorSpreadInArray2.ts, 2, 22)) +>next : Symbol(SymbolIterator.next, Decl(iteratorSpreadInArray2.ts, 2, 22)) return { value: Symbol(), >value : Symbol(value, Decl(iteratorSpreadInArray2.ts, 4, 16)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) done: false >done : Symbol(done, Decl(iteratorSpreadInArray2.ts, 5, 28)) @@ -22,9 +22,9 @@ class SymbolIterator { } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; >this : Symbol(SymbolIterator, Decl(iteratorSpreadInArray2.ts, 0, 59)) @@ -35,7 +35,7 @@ class NumberIterator { >NumberIterator : Symbol(NumberIterator, Decl(iteratorSpreadInArray2.ts, 13, 1)) next() { ->next : Symbol(next, Decl(iteratorSpreadInArray2.ts, 15, 22)) +>next : Symbol(NumberIterator.next, Decl(iteratorSpreadInArray2.ts, 15, 22)) return { value: 0, @@ -48,9 +48,9 @@ class NumberIterator { } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; >this : Symbol(NumberIterator, Decl(iteratorSpreadInArray2.ts, 13, 1)) diff --git a/tests/baselines/reference/iteratorSpreadInArray3.symbols b/tests/baselines/reference/iteratorSpreadInArray3.symbols index 05f90d44174..c110733dd66 100644 --- a/tests/baselines/reference/iteratorSpreadInArray3.symbols +++ b/tests/baselines/reference/iteratorSpreadInArray3.symbols @@ -7,12 +7,12 @@ class SymbolIterator { >SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInArray3.ts, 0, 47)) next() { ->next : Symbol(next, Decl(iteratorSpreadInArray3.ts, 2, 22)) +>next : Symbol(SymbolIterator.next, Decl(iteratorSpreadInArray3.ts, 2, 22)) return { value: Symbol(), >value : Symbol(value, Decl(iteratorSpreadInArray3.ts, 4, 16)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) done: false >done : Symbol(done, Decl(iteratorSpreadInArray3.ts, 5, 28)) @@ -21,9 +21,9 @@ class SymbolIterator { } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; >this : Symbol(SymbolIterator, Decl(iteratorSpreadInArray3.ts, 0, 47)) diff --git a/tests/baselines/reference/iteratorSpreadInArray4.symbols b/tests/baselines/reference/iteratorSpreadInArray4.symbols index e7ace40c4de..e1159ee0e96 100644 --- a/tests/baselines/reference/iteratorSpreadInArray4.symbols +++ b/tests/baselines/reference/iteratorSpreadInArray4.symbols @@ -7,12 +7,12 @@ class SymbolIterator { >SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInArray4.ts, 0, 42)) next() { ->next : Symbol(next, Decl(iteratorSpreadInArray4.ts, 2, 22)) +>next : Symbol(SymbolIterator.next, Decl(iteratorSpreadInArray4.ts, 2, 22)) return { value: Symbol(), >value : Symbol(value, Decl(iteratorSpreadInArray4.ts, 4, 16)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) done: false >done : Symbol(done, Decl(iteratorSpreadInArray4.ts, 5, 28)) @@ -21,9 +21,9 @@ class SymbolIterator { } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; >this : Symbol(SymbolIterator, Decl(iteratorSpreadInArray4.ts, 0, 42)) diff --git a/tests/baselines/reference/iteratorSpreadInArray6.errors.txt b/tests/baselines/reference/iteratorSpreadInArray6.errors.txt index b90ac5f203c..8148ce43de7 100644 --- a/tests/baselines/reference/iteratorSpreadInArray6.errors.txt +++ b/tests/baselines/reference/iteratorSpreadInArray6.errors.txt @@ -1,11 +1,15 @@ -tests/cases/conformance/es6/spread/iteratorSpreadInArray6.ts(2,14): error TS2345: Argument of type 'symbol[]' is not assignable to parameter of type 'number'. +tests/cases/conformance/es6/spread/iteratorSpreadInArray6.ts(2,14): error TS2345: Argument of type 'symbol[]' is not assignable to parameter of type 'number | number[]'. + Type 'symbol[]' is not assignable to type 'number[]'. + Type 'symbol' is not assignable to type 'number'. ==== tests/cases/conformance/es6/spread/iteratorSpreadInArray6.ts (1 errors) ==== var array: number[] = [0, 1]; array.concat([...new SymbolIterator]); ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type 'symbol[]' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type 'symbol[]' is not assignable to parameter of type 'number | number[]'. +!!! error TS2345: Type 'symbol[]' is not assignable to type 'number[]'. +!!! error TS2345: Type 'symbol' is not assignable to type 'number'. class SymbolIterator { next() { diff --git a/tests/baselines/reference/iteratorSpreadInArray7.symbols b/tests/baselines/reference/iteratorSpreadInArray7.symbols index e498e68b9eb..853e07b908a 100644 --- a/tests/baselines/reference/iteratorSpreadInArray7.symbols +++ b/tests/baselines/reference/iteratorSpreadInArray7.symbols @@ -3,21 +3,21 @@ var array: symbol[]; >array : Symbol(array, Decl(iteratorSpreadInArray7.ts, 0, 3)) array.concat([...new SymbolIterator]); ->array.concat : Symbol(Array.concat, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>array.concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --)) >array : Symbol(array, Decl(iteratorSpreadInArray7.ts, 0, 3)) ->concat : Symbol(Array.concat, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --)) >SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInArray7.ts, 1, 38)) class SymbolIterator { >SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInArray7.ts, 1, 38)) next() { ->next : Symbol(next, Decl(iteratorSpreadInArray7.ts, 3, 22)) +>next : Symbol(SymbolIterator.next, Decl(iteratorSpreadInArray7.ts, 3, 22)) return { value: Symbol(), >value : Symbol(value, Decl(iteratorSpreadInArray7.ts, 5, 16)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) done: false >done : Symbol(done, Decl(iteratorSpreadInArray7.ts, 6, 28)) @@ -26,9 +26,9 @@ class SymbolIterator { } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; >this : Symbol(SymbolIterator, Decl(iteratorSpreadInArray7.ts, 1, 38)) diff --git a/tests/baselines/reference/iteratorSpreadInArray7.types b/tests/baselines/reference/iteratorSpreadInArray7.types index 6a279838060..f1dd8ebf855 100644 --- a/tests/baselines/reference/iteratorSpreadInArray7.types +++ b/tests/baselines/reference/iteratorSpreadInArray7.types @@ -4,9 +4,9 @@ var array: symbol[]; array.concat([...new SymbolIterator]); >array.concat([...new SymbolIterator]) : symbol[] ->array.concat : { (...items: U[]): symbol[]; (...items: symbol[]): symbol[]; } +>array.concat : (...items: (symbol | symbol[])[]) => symbol[] >array : symbol[] ->concat : { (...items: U[]): symbol[]; (...items: symbol[]): symbol[]; } +>concat : (...items: (symbol | symbol[])[]) => symbol[] >[...new SymbolIterator] : symbol[] >...new SymbolIterator : symbol >new SymbolIterator : SymbolIterator diff --git a/tests/baselines/reference/iteratorSpreadInCall11.symbols b/tests/baselines/reference/iteratorSpreadInCall11.symbols index e504283a3bd..098a7b9b9ce 100644 --- a/tests/baselines/reference/iteratorSpreadInCall11.symbols +++ b/tests/baselines/reference/iteratorSpreadInCall11.symbols @@ -14,12 +14,12 @@ class SymbolIterator { >SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInCall11.ts, 2, 42)) next() { ->next : Symbol(next, Decl(iteratorSpreadInCall11.ts, 4, 22)) +>next : Symbol(SymbolIterator.next, Decl(iteratorSpreadInCall11.ts, 4, 22)) return { value: Symbol(), >value : Symbol(value, Decl(iteratorSpreadInCall11.ts, 6, 16)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) done: false >done : Symbol(done, Decl(iteratorSpreadInCall11.ts, 7, 28)) @@ -28,9 +28,9 @@ class SymbolIterator { } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; >this : Symbol(SymbolIterator, Decl(iteratorSpreadInCall11.ts, 2, 42)) diff --git a/tests/baselines/reference/iteratorSpreadInCall12.symbols b/tests/baselines/reference/iteratorSpreadInCall12.symbols index 4b7f553e969..f989860f04e 100644 --- a/tests/baselines/reference/iteratorSpreadInCall12.symbols +++ b/tests/baselines/reference/iteratorSpreadInCall12.symbols @@ -17,12 +17,12 @@ class SymbolIterator { >SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInCall12.ts, 4, 1)) next() { ->next : Symbol(next, Decl(iteratorSpreadInCall12.ts, 6, 22)) +>next : Symbol(SymbolIterator.next, Decl(iteratorSpreadInCall12.ts, 6, 22)) return { value: Symbol(), >value : Symbol(value, Decl(iteratorSpreadInCall12.ts, 8, 16)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) done: false >done : Symbol(done, Decl(iteratorSpreadInCall12.ts, 9, 28)) @@ -31,9 +31,9 @@ class SymbolIterator { } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; >this : Symbol(SymbolIterator, Decl(iteratorSpreadInCall12.ts, 4, 1)) @@ -44,7 +44,7 @@ class StringIterator { >StringIterator : Symbol(StringIterator, Decl(iteratorSpreadInCall12.ts, 17, 1)) next() { ->next : Symbol(next, Decl(iteratorSpreadInCall12.ts, 19, 22)) +>next : Symbol(StringIterator.next, Decl(iteratorSpreadInCall12.ts, 19, 22)) return { value: "", @@ -57,9 +57,9 @@ class StringIterator { } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; >this : Symbol(StringIterator, Decl(iteratorSpreadInCall12.ts, 17, 1)) diff --git a/tests/baselines/reference/iteratorSpreadInCall3.symbols b/tests/baselines/reference/iteratorSpreadInCall3.symbols index 402b156002f..8557b6c8319 100644 --- a/tests/baselines/reference/iteratorSpreadInCall3.symbols +++ b/tests/baselines/reference/iteratorSpreadInCall3.symbols @@ -11,12 +11,12 @@ class SymbolIterator { >SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInCall3.ts, 2, 32)) next() { ->next : Symbol(next, Decl(iteratorSpreadInCall3.ts, 3, 22)) +>next : Symbol(SymbolIterator.next, Decl(iteratorSpreadInCall3.ts, 3, 22)) return { value: Symbol(), >value : Symbol(value, Decl(iteratorSpreadInCall3.ts, 5, 16)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) done: false >done : Symbol(done, Decl(iteratorSpreadInCall3.ts, 6, 28)) @@ -25,9 +25,9 @@ class SymbolIterator { } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; >this : Symbol(SymbolIterator, Decl(iteratorSpreadInCall3.ts, 2, 32)) diff --git a/tests/baselines/reference/iteratorSpreadInCall5.symbols b/tests/baselines/reference/iteratorSpreadInCall5.symbols index 855b434f07c..0ed608e0589 100644 --- a/tests/baselines/reference/iteratorSpreadInCall5.symbols +++ b/tests/baselines/reference/iteratorSpreadInCall5.symbols @@ -12,12 +12,12 @@ class SymbolIterator { >SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInCall5.ts, 2, 43)) next() { ->next : Symbol(next, Decl(iteratorSpreadInCall5.ts, 3, 22)) +>next : Symbol(SymbolIterator.next, Decl(iteratorSpreadInCall5.ts, 3, 22)) return { value: Symbol(), >value : Symbol(value, Decl(iteratorSpreadInCall5.ts, 5, 16)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) done: false >done : Symbol(done, Decl(iteratorSpreadInCall5.ts, 6, 28)) @@ -26,9 +26,9 @@ class SymbolIterator { } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; >this : Symbol(SymbolIterator, Decl(iteratorSpreadInCall5.ts, 2, 43)) @@ -39,7 +39,7 @@ class StringIterator { >StringIterator : Symbol(StringIterator, Decl(iteratorSpreadInCall5.ts, 14, 1)) next() { ->next : Symbol(next, Decl(iteratorSpreadInCall5.ts, 16, 22)) +>next : Symbol(StringIterator.next, Decl(iteratorSpreadInCall5.ts, 16, 22)) return { value: "", @@ -52,9 +52,9 @@ class StringIterator { } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; >this : Symbol(StringIterator, Decl(iteratorSpreadInCall5.ts, 14, 1)) diff --git a/tests/baselines/reference/iteratorSpreadInCall6.errors.txt b/tests/baselines/reference/iteratorSpreadInCall6.errors.txt index 0a0da985ace..ee9945f7af6 100644 --- a/tests/baselines/reference/iteratorSpreadInCall6.errors.txt +++ b/tests/baselines/reference/iteratorSpreadInCall6.errors.txt @@ -1,12 +1,10 @@ tests/cases/conformance/es6/spread/iteratorSpreadInCall6.ts(1,28): error TS2345: Argument of type 'string' is not assignable to parameter of type 'symbol | number'. - Type 'string' is not assignable to type 'number'. ==== tests/cases/conformance/es6/spread/iteratorSpreadInCall6.ts (1 errors) ==== foo(...new SymbolIterator, ...new StringIterator); ~~~~~~~~~~~~~~~~~~~~~ !!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'symbol | number'. -!!! error TS2345: Type 'string' is not assignable to type 'number'. function foo(...s: (symbol | number)[]) { } class SymbolIterator { diff --git a/tests/baselines/reference/iteratorsAndStrictNullChecks.js b/tests/baselines/reference/iteratorsAndStrictNullChecks.js new file mode 100644 index 00000000000..97007917de5 --- /dev/null +++ b/tests/baselines/reference/iteratorsAndStrictNullChecks.js @@ -0,0 +1,22 @@ +//// [iteratorsAndStrictNullChecks.ts] + +// for..of +for (const x of ["a", "b"]) { + x.substring; +} + +// Spread +const xs = [1, 2, 3]; +const ys = [4, 5]; +xs.push(...ys); + + +//// [iteratorsAndStrictNullChecks.js] +// for..of +for (const x of ["a", "b"]) { + x.substring; +} +// Spread +const xs = [1, 2, 3]; +const ys = [4, 5]; +xs.push(...ys); diff --git a/tests/baselines/reference/iteratorsAndStrictNullChecks.symbols b/tests/baselines/reference/iteratorsAndStrictNullChecks.symbols new file mode 100644 index 00000000000..8201a845a0f --- /dev/null +++ b/tests/baselines/reference/iteratorsAndStrictNullChecks.symbols @@ -0,0 +1,25 @@ +=== tests/cases/compiler/iteratorsAndStrictNullChecks.ts === + +// for..of +for (const x of ["a", "b"]) { +>x : Symbol(x, Decl(iteratorsAndStrictNullChecks.ts, 2, 10)) + + x.substring; +>x.substring : Symbol(String.substring, Decl(lib.es5.d.ts, --, --)) +>x : Symbol(x, Decl(iteratorsAndStrictNullChecks.ts, 2, 10)) +>substring : Symbol(String.substring, Decl(lib.es5.d.ts, --, --)) +} + +// Spread +const xs = [1, 2, 3]; +>xs : Symbol(xs, Decl(iteratorsAndStrictNullChecks.ts, 7, 5)) + +const ys = [4, 5]; +>ys : Symbol(ys, Decl(iteratorsAndStrictNullChecks.ts, 8, 5)) + +xs.push(...ys); +>xs.push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --)) +>xs : Symbol(xs, Decl(iteratorsAndStrictNullChecks.ts, 7, 5)) +>push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --)) +>ys : Symbol(ys, Decl(iteratorsAndStrictNullChecks.ts, 8, 5)) + diff --git a/tests/baselines/reference/iteratorsAndStrictNullChecks.types b/tests/baselines/reference/iteratorsAndStrictNullChecks.types new file mode 100644 index 00000000000..ce1d7430f77 --- /dev/null +++ b/tests/baselines/reference/iteratorsAndStrictNullChecks.types @@ -0,0 +1,37 @@ +=== tests/cases/compiler/iteratorsAndStrictNullChecks.ts === + +// for..of +for (const x of ["a", "b"]) { +>x : string +>["a", "b"] : string[] +>"a" : string +>"b" : string + + x.substring; +>x.substring : (start: number, end?: number | undefined) => string +>x : string +>substring : (start: number, end?: number | undefined) => string +} + +// Spread +const xs = [1, 2, 3]; +>xs : number[] +>[1, 2, 3] : number[] +>1 : number +>2 : number +>3 : number + +const ys = [4, 5]; +>ys : number[] +>[4, 5] : number[] +>4 : number +>5 : number + +xs.push(...ys); +>xs.push(...ys) : number +>xs.push : (...items: number[]) => number +>xs : number[] +>push : (...items: number[]) => number +>...ys : number +>ys : number[] + diff --git a/tests/baselines/reference/jsFileCompilationBindMultipleDefaultExports.errors.txt b/tests/baselines/reference/jsFileCompilationBindMultipleDefaultExports.errors.txt index 733f66922ab..05fecf03d30 100644 --- a/tests/baselines/reference/jsFileCompilationBindMultipleDefaultExports.errors.txt +++ b/tests/baselines/reference/jsFileCompilationBindMultipleDefaultExports.errors.txt @@ -1,10 +1,9 @@ tests/cases/compiler/a.js(1,22): error TS2528: A module cannot have multiple default exports. tests/cases/compiler/a.js(3,1): error TS2528: A module cannot have multiple default exports. -tests/cases/compiler/a.js(3,1): error TS8003: 'export=' can only be used in a .ts file. tests/cases/compiler/a.js(3,16): error TS1109: Expression expected. -==== tests/cases/compiler/a.js (4 errors) ==== +==== tests/cases/compiler/a.js (3 errors) ==== export default class a { ~ !!! error TS2528: A module cannot have multiple default exports. @@ -12,7 +11,5 @@ tests/cases/compiler/a.js(3,16): error TS1109: Expression expected. export default var a = 10; ~~~~~~~~~~~~~~ !!! error TS2528: A module cannot have multiple default exports. - ~~~~~~~~~~~~~~ -!!! error TS8003: 'export=' can only be used in a .ts file. ~~~ !!! error TS1109: Expression expected. \ No newline at end of file diff --git a/tests/baselines/reference/jsFileCompilationClassMethodContainingArrowFunction.symbols b/tests/baselines/reference/jsFileCompilationClassMethodContainingArrowFunction.symbols index 8db5aa87a5b..0f6ba844290 100644 --- a/tests/baselines/reference/jsFileCompilationClassMethodContainingArrowFunction.symbols +++ b/tests/baselines/reference/jsFileCompilationClassMethodContainingArrowFunction.symbols @@ -4,15 +4,15 @@ class c { >c : Symbol(c, Decl(a.js, 0, 0)) method(a) { ->method : Symbol(method, Decl(a.js, 1, 9)) +>method : Symbol(c.method, Decl(a.js, 1, 9)) >a : Symbol(a, Decl(a.js, 2, 11)) let x = a => this.method(a); >x : Symbol(x, Decl(a.js, 3, 11)) >a : Symbol(a, Decl(a.js, 3, 15)) ->this.method : Symbol(method, Decl(a.js, 1, 9)) +>this.method : Symbol(c.method, Decl(a.js, 1, 9)) >this : Symbol(c, Decl(a.js, 0, 0)) ->method : Symbol(method, Decl(a.js, 1, 9)) +>method : Symbol(c.method, Decl(a.js, 1, 9)) >a : Symbol(a, Decl(a.js, 3, 15)) } } diff --git a/tests/baselines/reference/jsFileCompilationDecoratorSyntax.errors.txt b/tests/baselines/reference/jsFileCompilationDecoratorSyntax.errors.txt deleted file mode 100644 index a39d2e1665c..00000000000 --- a/tests/baselines/reference/jsFileCompilationDecoratorSyntax.errors.txt +++ /dev/null @@ -1,9 +0,0 @@ -error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. -tests/cases/compiler/a.js(1,1): error TS8017: 'decorators' can only be used in a .ts file. - - -!!! error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. -==== tests/cases/compiler/a.js (1 errors) ==== - @internal class C { } - ~~~~~~~~~ -!!! error TS8017: 'decorators' can only be used in a .ts file. \ No newline at end of file diff --git a/tests/baselines/reference/jsFileCompilationDecoratorSyntax.symbols b/tests/baselines/reference/jsFileCompilationDecoratorSyntax.symbols new file mode 100644 index 00000000000..02973b43147 --- /dev/null +++ b/tests/baselines/reference/jsFileCompilationDecoratorSyntax.symbols @@ -0,0 +1,4 @@ +=== tests/cases/compiler/a.js === +@internal class C { } +>C : Symbol(C, Decl(a.js, 0, 0)) + diff --git a/tests/baselines/reference/jsFileCompilationDecoratorSyntax.types b/tests/baselines/reference/jsFileCompilationDecoratorSyntax.types new file mode 100644 index 00000000000..ee1f14129d5 --- /dev/null +++ b/tests/baselines/reference/jsFileCompilationDecoratorSyntax.types @@ -0,0 +1,5 @@ +=== tests/cases/compiler/a.js === +@internal class C { } +>internal : any +>C : C + diff --git a/tests/baselines/reference/jsFileCompilationExportAssignmentSyntax.errors.txt b/tests/baselines/reference/jsFileCompilationExportAssignmentSyntax.errors.txt index 7e67c6325e0..f537941c55c 100644 --- a/tests/baselines/reference/jsFileCompilationExportAssignmentSyntax.errors.txt +++ b/tests/baselines/reference/jsFileCompilationExportAssignmentSyntax.errors.txt @@ -1,12 +1,9 @@ error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. -tests/cases/compiler/a.js(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/compiler/a.js(1,1): error TS8003: 'export=' can only be used in a .ts file. !!! error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. -==== tests/cases/compiler/a.js (2 errors) ==== +==== tests/cases/compiler/a.js (1 errors) ==== export = b; ~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. - ~~~~~~~~~~~ !!! error TS8003: 'export=' can only be used in a .ts file. \ No newline at end of file diff --git a/tests/baselines/reference/jsFileCompilationLetDeclarationOrder2.errors.txt b/tests/baselines/reference/jsFileCompilationLetDeclarationOrder2.errors.txt index b88c73e0439..21390cc2955 100644 --- a/tests/baselines/reference/jsFileCompilationLetDeclarationOrder2.errors.txt +++ b/tests/baselines/reference/jsFileCompilationLetDeclarationOrder2.errors.txt @@ -1,13 +1,10 @@ error TS5053: Option 'allowJs' cannot be specified with option 'declaration'. -tests/cases/compiler/a.ts(2,1): error TS2448: Block-scoped variable 'a' used before its declaration. !!! error TS5053: Option 'allowJs' cannot be specified with option 'declaration'. -==== tests/cases/compiler/a.ts (1 errors) ==== +==== tests/cases/compiler/a.ts (0 errors) ==== let b = 30; a = 10; - ~ -!!! error TS2448: Block-scoped variable 'a' used before its declaration. ==== tests/cases/compiler/b.js (0 errors) ==== let a = 10; b = 30; diff --git a/tests/baselines/reference/jsFileCompilationRestParamJsDocFunction.js b/tests/baselines/reference/jsFileCompilationRestParamJsDocFunction.js new file mode 100644 index 00000000000..e1675ff7131 --- /dev/null +++ b/tests/baselines/reference/jsFileCompilationRestParamJsDocFunction.js @@ -0,0 +1,51 @@ +//// [_apply.js] + +/** + * A faster alternative to `Function#apply`, this function invokes `func` + * with the `this` binding of `thisArg` and the arguments of `args`. + * + * @private + * @param {Function} func The function to invoke. + * @param {*} thisArg The `this` binding of `func`. + * @param {...*} args The arguments to invoke `func` with. + * @returns {*} Returns the result of `func`. + */ +function apply(func, thisArg, args) { + var length = args.length; + switch (length) { + case 0: return func.call(thisArg); + case 1: return func.call(thisArg, args[0]); + case 2: return func.call(thisArg, args[0], args[1]); + case 3: return func.call(thisArg, args[0], args[1], args[2]); + } + return func.apply(thisArg, args); +} + +export default apply; + +//// [apply.js] +define("_apply", ["require", "exports"], function (require, exports) { + "use strict"; + /** + * A faster alternative to `Function#apply`, this function invokes `func` + * with the `this` binding of `thisArg` and the arguments of `args`. + * + * @private + * @param {Function} func The function to invoke. + * @param {*} thisArg The `this` binding of `func`. + * @param {...*} args The arguments to invoke `func` with. + * @returns {*} Returns the result of `func`. + */ + function apply(func, thisArg, args) { + var length = args.length; + switch (length) { + case 0: return func.call(thisArg); + case 1: return func.call(thisArg, args[0]); + case 2: return func.call(thisArg, args[0], args[1]); + case 3: return func.call(thisArg, args[0], args[1], args[2]); + } + return func.apply(thisArg, args); + } + exports.__esModule = true; + exports["default"] = apply; +}); diff --git a/tests/baselines/reference/jsFileCompilationRestParamJsDocFunction.symbols b/tests/baselines/reference/jsFileCompilationRestParamJsDocFunction.symbols new file mode 100644 index 00000000000..f21653d475b --- /dev/null +++ b/tests/baselines/reference/jsFileCompilationRestParamJsDocFunction.symbols @@ -0,0 +1,68 @@ +=== tests/cases/compiler/_apply.js === + +/** + * A faster alternative to `Function#apply`, this function invokes `func` + * with the `this` binding of `thisArg` and the arguments of `args`. + * + * @private + * @param {Function} func The function to invoke. + * @param {*} thisArg The `this` binding of `func`. + * @param {...*} args The arguments to invoke `func` with. + * @returns {*} Returns the result of `func`. + */ +function apply(func, thisArg, args) { +>apply : Symbol(apply, Decl(_apply.js, 0, 0)) +>func : Symbol(func, Decl(_apply.js, 11, 15)) +>thisArg : Symbol(thisArg, Decl(_apply.js, 11, 20)) +>args : Symbol(args, Decl(_apply.js, 11, 29)) + + var length = args.length; +>length : Symbol(length, Decl(_apply.js, 12, 7)) +>args.length : Symbol(Array.length, Decl(lib.d.ts, --, --)) +>args : Symbol(args, Decl(_apply.js, 11, 29)) +>length : Symbol(Array.length, Decl(lib.d.ts, --, --)) + + switch (length) { +>length : Symbol(length, Decl(_apply.js, 12, 7)) + + case 0: return func.call(thisArg); +>func.call : Symbol(Function.call, Decl(lib.d.ts, --, --)) +>func : Symbol(func, Decl(_apply.js, 11, 15)) +>call : Symbol(Function.call, Decl(lib.d.ts, --, --)) +>thisArg : Symbol(thisArg, Decl(_apply.js, 11, 20)) + + case 1: return func.call(thisArg, args[0]); +>func.call : Symbol(Function.call, Decl(lib.d.ts, --, --)) +>func : Symbol(func, Decl(_apply.js, 11, 15)) +>call : Symbol(Function.call, Decl(lib.d.ts, --, --)) +>thisArg : Symbol(thisArg, Decl(_apply.js, 11, 20)) +>args : Symbol(args, Decl(_apply.js, 11, 29)) + + case 2: return func.call(thisArg, args[0], args[1]); +>func.call : Symbol(Function.call, Decl(lib.d.ts, --, --)) +>func : Symbol(func, Decl(_apply.js, 11, 15)) +>call : Symbol(Function.call, Decl(lib.d.ts, --, --)) +>thisArg : Symbol(thisArg, Decl(_apply.js, 11, 20)) +>args : Symbol(args, Decl(_apply.js, 11, 29)) +>args : Symbol(args, Decl(_apply.js, 11, 29)) + + case 3: return func.call(thisArg, args[0], args[1], args[2]); +>func.call : Symbol(Function.call, Decl(lib.d.ts, --, --)) +>func : Symbol(func, Decl(_apply.js, 11, 15)) +>call : Symbol(Function.call, Decl(lib.d.ts, --, --)) +>thisArg : Symbol(thisArg, Decl(_apply.js, 11, 20)) +>args : Symbol(args, Decl(_apply.js, 11, 29)) +>args : Symbol(args, Decl(_apply.js, 11, 29)) +>args : Symbol(args, Decl(_apply.js, 11, 29)) + } + return func.apply(thisArg, args); +>func.apply : Symbol(Function.apply, Decl(lib.d.ts, --, --)) +>func : Symbol(func, Decl(_apply.js, 11, 15)) +>apply : Symbol(Function.apply, Decl(lib.d.ts, --, --)) +>thisArg : Symbol(thisArg, Decl(_apply.js, 11, 20)) +>args : Symbol(args, Decl(_apply.js, 11, 29)) +} + +export default apply; +>apply : Symbol(apply, Decl(_apply.js, 0, 0)) + diff --git a/tests/baselines/reference/jsFileCompilationRestParamJsDocFunction.types b/tests/baselines/reference/jsFileCompilationRestParamJsDocFunction.types new file mode 100644 index 00000000000..fbfe9d3edae --- /dev/null +++ b/tests/baselines/reference/jsFileCompilationRestParamJsDocFunction.types @@ -0,0 +1,89 @@ +=== tests/cases/compiler/_apply.js === + +/** + * A faster alternative to `Function#apply`, this function invokes `func` + * with the `this` binding of `thisArg` and the arguments of `args`. + * + * @private + * @param {Function} func The function to invoke. + * @param {*} thisArg The `this` binding of `func`. + * @param {...*} args The arguments to invoke `func` with. + * @returns {*} Returns the result of `func`. + */ +function apply(func, thisArg, args) { +>apply : (func: Function, thisArg: any, ...args: any[]) => any +>func : Function +>thisArg : any +>args : any[] + + var length = args.length; +>length : number +>args.length : number +>args : any[] +>length : number + + switch (length) { +>length : number + + case 0: return func.call(thisArg); +>0 : number +>func.call(thisArg) : any +>func.call : (this: Function, thisArg: any, ...argArray: any[]) => any +>func : Function +>call : (this: Function, thisArg: any, ...argArray: any[]) => any +>thisArg : any + + case 1: return func.call(thisArg, args[0]); +>1 : number +>func.call(thisArg, args[0]) : any +>func.call : (this: Function, thisArg: any, ...argArray: any[]) => any +>func : Function +>call : (this: Function, thisArg: any, ...argArray: any[]) => any +>thisArg : any +>args[0] : any +>args : any[] +>0 : number + + case 2: return func.call(thisArg, args[0], args[1]); +>2 : number +>func.call(thisArg, args[0], args[1]) : any +>func.call : (this: Function, thisArg: any, ...argArray: any[]) => any +>func : Function +>call : (this: Function, thisArg: any, ...argArray: any[]) => any +>thisArg : any +>args[0] : any +>args : any[] +>0 : number +>args[1] : any +>args : any[] +>1 : number + + case 3: return func.call(thisArg, args[0], args[1], args[2]); +>3 : number +>func.call(thisArg, args[0], args[1], args[2]) : any +>func.call : (this: Function, thisArg: any, ...argArray: any[]) => any +>func : Function +>call : (this: Function, thisArg: any, ...argArray: any[]) => any +>thisArg : any +>args[0] : any +>args : any[] +>0 : number +>args[1] : any +>args : any[] +>1 : number +>args[2] : any +>args : any[] +>2 : number + } + return func.apply(thisArg, args); +>func.apply(thisArg, args) : any +>func.apply : (this: Function, thisArg: any, argArray?: any) => any +>func : Function +>apply : (this: Function, thisArg: any, argArray?: any) => any +>thisArg : any +>args : any[] +} + +export default apply; +>apply : (func: Function, thisArg: any, ...args: any[]) => any + diff --git a/tests/baselines/reference/jsFileCompilationSyntaxError.errors.txt b/tests/baselines/reference/jsFileCompilationSyntaxError.errors.txt index 6e55ff30f04..d98a1e7e7bb 100644 --- a/tests/baselines/reference/jsFileCompilationSyntaxError.errors.txt +++ b/tests/baselines/reference/jsFileCompilationSyntaxError.errors.txt @@ -1,14 +1,11 @@ error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. -tests/cases/compiler/a.js(3,6): error TS1223: 'type' tag already specified. !!! error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. -==== tests/cases/compiler/a.js (1 errors) ==== +==== tests/cases/compiler/a.js (0 errors) ==== /** * @type {number} * @type {string} - ~~~~ -!!! error TS1223: 'type' tag already specified. */ var v; \ No newline at end of file diff --git a/tests/baselines/reference/jsFileCompilationTypeAliasSyntax.errors.txt b/tests/baselines/reference/jsFileCompilationTypeAliasSyntax.errors.txt index bc4d8e903ad..2b5112e1ce2 100644 --- a/tests/baselines/reference/jsFileCompilationTypeAliasSyntax.errors.txt +++ b/tests/baselines/reference/jsFileCompilationTypeAliasSyntax.errors.txt @@ -1,9 +1,9 @@ error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. -tests/cases/compiler/a.js(1,1): error TS8008: 'type aliases' can only be used in a .ts file. +tests/cases/compiler/a.js(1,6): error TS8008: 'type aliases' can only be used in a .ts file. !!! error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. ==== tests/cases/compiler/a.js (1 errors) ==== type a = b; - ~~~~~~~~~~~ + ~ !!! error TS8008: 'type aliases' can only be used in a .ts file. \ No newline at end of file diff --git a/tests/baselines/reference/jsFileCompilationTypeAssertions.errors.txt b/tests/baselines/reference/jsFileCompilationTypeAssertions.errors.txt index e73ee46fb89..662eea4d405 100644 --- a/tests/baselines/reference/jsFileCompilationTypeAssertions.errors.txt +++ b/tests/baselines/reference/jsFileCompilationTypeAssertions.errors.txt @@ -1,9 +1,12 @@ error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. -tests/cases/compiler/a.js(1,10): error TS8016: 'type assertion expressions' can only be used in a .ts file. +tests/cases/compiler/a.js(1,10): error TS17008: JSX element 'string' has no corresponding closing tag. +tests/cases/compiler/a.js(1,27): error TS1005: 'undefined; ~~~~~~ -!!! error TS8016: 'type assertion expressions' can only be used in a .ts file. \ No newline at end of file +!!! error TS17008: JSX element 'string' has no corresponding closing tag. + +!!! error TS1005: ' undefined, 2); +JSON.stringify(value, undefined, 2); + +//// [json.stringify.js] +var value = null; +JSON.stringify(value, undefined, 2); +JSON.stringify(value, null, 2); +JSON.stringify(value, ["a", 1], 2); +JSON.stringify(value, function (k) { return undefined; }, 2); +JSON.stringify(value, undefined, 2); diff --git a/tests/baselines/reference/json.stringify.symbols b/tests/baselines/reference/json.stringify.symbols new file mode 100644 index 00000000000..3c3c20ef30a --- /dev/null +++ b/tests/baselines/reference/json.stringify.symbols @@ -0,0 +1,39 @@ +=== tests/cases/compiler/json.stringify.ts === + +var value = null; +>value : Symbol(value, Decl(json.stringify.ts, 1, 3)) + +JSON.stringify(value, undefined, 2); +>JSON.stringify : Symbol(JSON.stringify, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>JSON : Symbol(JSON, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>stringify : Symbol(JSON.stringify, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>value : Symbol(value, Decl(json.stringify.ts, 1, 3)) +>undefined : Symbol(undefined) + +JSON.stringify(value, null, 2); +>JSON.stringify : Symbol(JSON.stringify, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>JSON : Symbol(JSON, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>stringify : Symbol(JSON.stringify, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>value : Symbol(value, Decl(json.stringify.ts, 1, 3)) + +JSON.stringify(value, ["a", 1], 2); +>JSON.stringify : Symbol(JSON.stringify, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>JSON : Symbol(JSON, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>stringify : Symbol(JSON.stringify, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>value : Symbol(value, Decl(json.stringify.ts, 1, 3)) + +JSON.stringify(value, (k) => undefined, 2); +>JSON.stringify : Symbol(JSON.stringify, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>JSON : Symbol(JSON, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>stringify : Symbol(JSON.stringify, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>value : Symbol(value, Decl(json.stringify.ts, 1, 3)) +>k : Symbol(k, Decl(json.stringify.ts, 5, 23)) +>undefined : Symbol(undefined) + +JSON.stringify(value, undefined, 2); +>JSON.stringify : Symbol(JSON.stringify, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>JSON : Symbol(JSON, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>stringify : Symbol(JSON.stringify, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>value : Symbol(value, Decl(json.stringify.ts, 1, 3)) +>undefined : Symbol(undefined) + diff --git a/tests/baselines/reference/json.stringify.types b/tests/baselines/reference/json.stringify.types new file mode 100644 index 00000000000..7cce2d3ed24 --- /dev/null +++ b/tests/baselines/reference/json.stringify.types @@ -0,0 +1,55 @@ +=== tests/cases/compiler/json.stringify.ts === + +var value = null; +>value : null +>null : null + +JSON.stringify(value, undefined, 2); +>JSON.stringify(value, undefined, 2) : string +>JSON.stringify : { (value: any, replacer?: ((key: string, value: any) => any) | undefined, space?: string | number | undefined): string; (value: any, replacer?: (number | string)[] | null | undefined, space?: string | number | undefined): string; } +>JSON : JSON +>stringify : { (value: any, replacer?: ((key: string, value: any) => any) | undefined, space?: string | number | undefined): string; (value: any, replacer?: (number | string)[] | null | undefined, space?: string | number | undefined): string; } +>value : null +>undefined : undefined +>2 : number + +JSON.stringify(value, null, 2); +>JSON.stringify(value, null, 2) : string +>JSON.stringify : { (value: any, replacer?: ((key: string, value: any) => any) | undefined, space?: string | number | undefined): string; (value: any, replacer?: (number | string)[] | null | undefined, space?: string | number | undefined): string; } +>JSON : JSON +>stringify : { (value: any, replacer?: ((key: string, value: any) => any) | undefined, space?: string | number | undefined): string; (value: any, replacer?: (number | string)[] | null | undefined, space?: string | number | undefined): string; } +>value : null +>null : null +>2 : number + +JSON.stringify(value, ["a", 1], 2); +>JSON.stringify(value, ["a", 1], 2) : string +>JSON.stringify : { (value: any, replacer?: ((key: string, value: any) => any) | undefined, space?: string | number | undefined): string; (value: any, replacer?: (number | string)[] | null | undefined, space?: string | number | undefined): string; } +>JSON : JSON +>stringify : { (value: any, replacer?: ((key: string, value: any) => any) | undefined, space?: string | number | undefined): string; (value: any, replacer?: (number | string)[] | null | undefined, space?: string | number | undefined): string; } +>value : null +>["a", 1] : (string | number)[] +>"a" : string +>1 : number +>2 : number + +JSON.stringify(value, (k) => undefined, 2); +>JSON.stringify(value, (k) => undefined, 2) : string +>JSON.stringify : { (value: any, replacer?: ((key: string, value: any) => any) | undefined, space?: string | number | undefined): string; (value: any, replacer?: (number | string)[] | null | undefined, space?: string | number | undefined): string; } +>JSON : JSON +>stringify : { (value: any, replacer?: ((key: string, value: any) => any) | undefined, space?: string | number | undefined): string; (value: any, replacer?: (number | string)[] | null | undefined, space?: string | number | undefined): string; } +>value : null +>(k) => undefined : (k: string) => undefined +>k : string +>undefined : undefined +>2 : number + +JSON.stringify(value, undefined, 2); +>JSON.stringify(value, undefined, 2) : string +>JSON.stringify : { (value: any, replacer?: ((key: string, value: any) => any) | undefined, space?: string | number | undefined): string; (value: any, replacer?: (number | string)[] | null | undefined, space?: string | number | undefined): string; } +>JSON : JSON +>stringify : { (value: any, replacer?: ((key: string, value: any) => any) | undefined, space?: string | number | undefined): string; (value: any, replacer?: (number | string)[] | null | undefined, space?: string | number | undefined): string; } +>value : null +>undefined : undefined +>2 : number + diff --git a/tests/baselines/reference/jsxAndTypeAssertion.errors.txt b/tests/baselines/reference/jsxAndTypeAssertion.errors.txt index aebabf15133..d0e9bcf145b 100644 --- a/tests/baselines/reference/jsxAndTypeAssertion.errors.txt +++ b/tests/baselines/reference/jsxAndTypeAssertion.errors.txt @@ -1,14 +1,20 @@ +tests/cases/conformance/jsx/jsxAndTypeAssertion.tsx(7,6): error TS17008: JSX element 'any' has no corresponding closing tag. tests/cases/conformance/jsx/jsxAndTypeAssertion.tsx(7,13): error TS2304: Cannot find name 'test'. tests/cases/conformance/jsx/jsxAndTypeAssertion.tsx(7,17): error TS1005: '}' expected. +tests/cases/conformance/jsx/jsxAndTypeAssertion.tsx(9,6): error TS17008: JSX element 'any' has no corresponding closing tag. +tests/cases/conformance/jsx/jsxAndTypeAssertion.tsx(11,6): error TS17008: JSX element 'foo' has no corresponding closing tag. tests/cases/conformance/jsx/jsxAndTypeAssertion.tsx(11,32): error TS1005: '}' expected. tests/cases/conformance/jsx/jsxAndTypeAssertion.tsx(13,36): error TS1005: '}' expected. +tests/cases/conformance/jsx/jsxAndTypeAssertion.tsx(15,17): error TS17008: JSX element 'foo' has no corresponding closing tag. tests/cases/conformance/jsx/jsxAndTypeAssertion.tsx(15,45): error TS1005: '}' expected. +tests/cases/conformance/jsx/jsxAndTypeAssertion.tsx(19,2): error TS17008: JSX element 'foo' has no corresponding closing tag. +tests/cases/conformance/jsx/jsxAndTypeAssertion.tsx(19,8): error TS17008: JSX element 'foo' has no corresponding closing tag. +tests/cases/conformance/jsx/jsxAndTypeAssertion.tsx(19,13): error TS17008: JSX element 'foo' has no corresponding closing tag. tests/cases/conformance/jsx/jsxAndTypeAssertion.tsx(22,1): error TS1005: ':' expected. -tests/cases/conformance/jsx/jsxAndTypeAssertion.tsx(22,1): error TS17002: Expected corresponding JSX closing tag for 'any'. -tests/cases/conformance/jsx/jsxAndTypeAssertion.tsx(22,1): error TS17002: Expected corresponding JSX closing tag for 'foo'. +tests/cases/conformance/jsx/jsxAndTypeAssertion.tsx(22,1): error TS1005: ' { test: }; + ~~~ +!!! error TS17008: JSX element 'any' has no corresponding closing tag. ~~~~ !!! error TS2304: Cannot find name 'test'. ~ !!! error TS1005: '}' expected. x = ; + ~~~ +!!! error TS17008: JSX element 'any' has no corresponding closing tag. x = hello {{}} ; + ~~~ +!!! error TS17008: JSX element 'foo' has no corresponding closing tag. ~ !!! error TS1005: '}' expected. @@ -32,18 +44,24 @@ tests/cases/conformance/jsx/jsxAndTypeAssertion.tsx(22,1): error TS17002: Expect !!! error TS1005: '}' expected. x = {}}>hello{{}}; + ~~~ +!!! error TS17008: JSX element 'foo' has no corresponding closing tag. ~ !!! error TS1005: '}' expected. x = x, x = ; {{/foo/.test(x) ? : }} + ~~~ +!!! error TS17008: JSX element 'foo' has no corresponding closing tag. + ~~~ +!!! error TS17008: JSX element 'foo' has no corresponding closing tag. + ~~~ +!!! error TS17008: JSX element 'foo' has no corresponding closing tag. !!! error TS1005: ':' expected. -!!! error TS17002: Expected corresponding JSX closing tag for 'any'. - -!!! error TS17002: Expected corresponding JSX closing tag for 'foo'. \ No newline at end of file +!!! error TS1005: 'React : Symbol(React, Decl(jsxEmitAttributeWithPreserve.tsx, 1, 11)) +>foo : Symbol(unknown) >data : Symbol(unknown) diff --git a/tests/baselines/reference/jsxHash.symbols b/tests/baselines/reference/jsxHash.symbols index 8a6ad0849f0..ddba4832d2c 100644 --- a/tests/baselines/reference/jsxHash.symbols +++ b/tests/baselines/reference/jsxHash.symbols @@ -1,34 +1,68 @@ === tests/cases/compiler/jsxHash.tsx === var t02 = {0}#; >t02 : Symbol(t02, Decl(jsxHash.tsx, 0, 3)) +>a : Symbol(unknown) +>a : Symbol(unknown) var t03 = #{0}; >t03 : Symbol(t03, Decl(jsxHash.tsx, 1, 3)) +>a : Symbol(unknown) +>a : Symbol(unknown) var t04 = #{0}#; >t04 : Symbol(t04, Decl(jsxHash.tsx, 2, 3)) +>a : Symbol(unknown) +>a : Symbol(unknown) var t05 = #; >t05 : Symbol(t05, Decl(jsxHash.tsx, 3, 3)) +>a : Symbol(unknown) +>i : Symbol(unknown) +>i : Symbol(unknown) +>a : Symbol(unknown) var t06 = #; >t06 : Symbol(t06, Decl(jsxHash.tsx, 4, 3)) +>a : Symbol(unknown) +>i : Symbol(unknown) +>i : Symbol(unknown) +>a : Symbol(unknown) var t07 = ##; >t07 : Symbol(t07, Decl(jsxHash.tsx, 5, 3)) +>a : Symbol(unknown) +>i : Symbol(unknown) +>i : Symbol(unknown) +>a : Symbol(unknown) var t08 = #; >t08 : Symbol(t08, Decl(jsxHash.tsx, 6, 3)) +>a : Symbol(unknown) +>i : Symbol(unknown) +>i : Symbol(unknown) +>a : Symbol(unknown) var t09 = ##; >t09 : Symbol(t09, Decl(jsxHash.tsx, 7, 3)) +>a : Symbol(unknown) +>i : Symbol(unknown) +>i : Symbol(unknown) +>a : Symbol(unknown) var t10 = #; >t10 : Symbol(t10, Decl(jsxHash.tsx, 8, 3)) +>a : Symbol(unknown) +>i : Symbol(unknown) +>a : Symbol(unknown) var t11 = #; >t11 : Symbol(t11, Decl(jsxHash.tsx, 9, 3)) +>a : Symbol(unknown) +>i : Symbol(unknown) +>a : Symbol(unknown) var t12 = #; >t12 : Symbol(t12, Decl(jsxHash.tsx, 10, 3)) +>a : Symbol(unknown) +>a : Symbol(unknown) diff --git a/tests/baselines/reference/jsxImportInAttribute.symbols b/tests/baselines/reference/jsxImportInAttribute.symbols index 845001b22c0..252b5cc98e4 100644 --- a/tests/baselines/reference/jsxImportInAttribute.symbols +++ b/tests/baselines/reference/jsxImportInAttribute.symbols @@ -8,6 +8,7 @@ let x = Test; // emit test_1.default >Test : Symbol(Test, Decl(consumer.tsx, 1, 6)) ; // ? +>anything : Symbol(unknown) >attr : Symbol(unknown) >Test : Symbol(Test, Decl(consumer.tsx, 1, 6)) diff --git a/tests/baselines/reference/jsxInvalidEsprimaTestSuite.errors.txt b/tests/baselines/reference/jsxInvalidEsprimaTestSuite.errors.txt index 578159dc651..237c3399e88 100644 --- a/tests/baselines/reference/jsxInvalidEsprimaTestSuite.errors.txt +++ b/tests/baselines/reference/jsxInvalidEsprimaTestSuite.errors.txt @@ -50,6 +50,8 @@ tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(17,3): error TS1003: tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(17,11): error TS1109: Expression expected. tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(17,13): error TS2304: Cannot find name 'a'. tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(17,22): error TS1109: Expression expected. +tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(18,2): error TS17008: JSX element 'a' has no corresponding closing tag. +tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(19,2): error TS17008: JSX element 'a' has no corresponding closing tag. tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(22,10): error TS1005: '}' expected. tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(23,20): error TS1003: Identifier expected. tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(24,15): error TS1003: Identifier expected. @@ -58,14 +60,16 @@ tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(25,7): error TS2304: tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(27,17): error TS1005: '>' expected. tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(28,10): error TS2304: Cannot find name 'props'. tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(28,28): error TS1005: '>' expected. +tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(32,2): error TS17008: JSX element 'a' has no corresponding closing tag. tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(32,6): error TS1005: '{' expected. +tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(33,2): error TS17008: JSX element 'a' has no corresponding closing tag. tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(33,6): error TS1005: '{' expected. tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(33,7): error TS1109: Expression expected. tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(35,4): error TS1003: Identifier expected. -tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(35,21): error TS17002: Expected corresponding JSX closing tag for 'a'. +tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(35,21): error TS1005: '; @@ -188,7 +192,11 @@ tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(35,21): error TS17002 ~ !!! error TS1109: Expression expected. ; + ~ +!!! error TS17008: JSX element 'a' has no corresponding closing tag. ; + ~ +!!! error TS17008: JSX element 'a' has no corresponding closing tag. var x =